From: support Date: Wed, 6 Apr 2022 14:14:00 +0000 (+0000) Subject: Built motion from commit 5ae82ce5.|2.6.7 X-Git-Url: http://repos.xcallymotion.com/base//%22http:/www.gravatar.com/avatar/%7B%7Bhash%7D%7D/%22?a=commitdiff_plain;h=9e72c9afa674406dccfdd10991f909dbb94b9a46;p=motion2.git Built motion from commit 5ae82ce5.|2.6.7 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 278b492..cc2a70f 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-06T13:24:09.107Z", + "time": "2022-04-06T14:06:53.454Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 5ccdb21..cb436eb 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-06T13:24:09.107Z", + "time": "2022-04-06T14:06:53.454Z", "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 a8ba5c5..5f85305 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 _0x8a02=['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','getDataValue','action','contactManager','integration','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','STRING','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)]'];(function(_0x371f33,_0x278a69){var _0x246c96=function(_0x4f8bad){while(--_0x4f8bad){_0x371f33['push'](_0x371f33['shift']());}};_0x246c96(++_0x278a69);}(_0x8a02,0x1a9));var _0x28a0=function(_0x56d281,_0x461c77){_0x56d281=_0x56d281-0x0;var _0x5a3142=_0x8a02[_0x56d281];return _0x5a3142;};'use strict';var Sequelize=require(_0x28a0('0x0'));module[_0x28a0('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x54dd0c){return this[_0x28a0('0x2')](_0x28a0('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x28a0('0x4'),_0x28a0('0x5'),'motionbar',_0x28a0('0x6'),'urlForward',_0x28a0('0x7'),_0x28a0('0x8'),_0x28a0('0x9')]],'msg':_0x28a0('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x28a0('0xb')},'data2':{'type':Sequelize[_0x28a0('0xc')](0x1000),'comment':_0x28a0('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x28a0('0xe')},'data4':{'type':Sequelize[_0x28a0('0xc')](0x1000),'comments':_0x28a0('0xf')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x28a0('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x28a0('0x11')},'data7':{'type':Sequelize[_0x28a0('0x12')],'comments':_0x28a0('0x13')}}; \ No newline at end of file +var _0x7522=['action','STRING','contactManager','integration','motionbar','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','getDataValue'];(function(_0x13e36a,_0x57de74){var _0x5c9f65=function(_0x9f33f3){while(--_0x9f33f3){_0x13e36a['push'](_0x13e36a['shift']());}};_0x5c9f65(++_0x57de74);}(_0x7522,0x12f));var _0x2752=function(_0x576dd3,_0x5a22fa){_0x576dd3=_0x576dd3-0x0;var _0x52a931=_0x7522[_0x576dd3];return _0x52a931;};'use strict';var Sequelize=require(_0x2752('0x0'));module[_0x2752('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x9c6fb1){return this[_0x2752('0x2')](_0x2752('0x3'));}},'action':{'type':Sequelize[_0x2752('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x2752('0x5'),_0x2752('0x6'),_0x2752('0x7'),_0x2752('0x8'),'urlForward',_0x2752('0x9'),'bot',_0x2752('0xa')]],'msg':_0x2752('0xb')}},'comment':_0x2752('0xb')},'data1':{'type':Sequelize[_0x2752('0x4')](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[_0x2752('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x2752('0x4')](0x1000),'comment':_0x2752('0xc')},'data4':{'type':Sequelize[_0x2752('0x4')](0x1000),'comments':_0x2752('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x2752('0xe')},'data6':{'type':Sequelize[_0x2752('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x2752('0xf')],'comments':_0x2752('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 025b604..49c7a21 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 _0x02c9=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x31dc60,_0x805e4e){var _0x2d4cfe=function(_0x388fef){while(--_0x388fef){_0x31dc60['push'](_0x31dc60['shift']());}};_0x2d4cfe(++_0x805e4e);}(_0x02c9,0x1db));var _0x902c=function(_0x34694a,_0x3b3224){_0x34694a=_0x34694a-0x0;var _0x3ac315=_0x02c9[_0x34694a];return _0x3ac315;};'use strict';var emlformat=require(_0x902c('0x0'));var rimraf=require(_0x902c('0x1'));var zipdir=require(_0x902c('0x2'));var jsonpatch=require(_0x902c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x902c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x902c('0x5'));var sox=require(_0x902c('0x6'));var csv=require(_0x902c('0x7'));var ejs=require(_0x902c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x902c('0x9'));var squel=require(_0x902c('0xa'));var crypto=require(_0x902c('0xb'));var jsforce=require(_0x902c('0xc'));var deskjs=require(_0x902c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x902c('0xe'));var Redis=require(_0x902c('0xf'));var authService=require(_0x902c('0x10'));var qs=require(_0x902c('0x11'));var as=require(_0x902c('0x12'));var hardwareService=require(_0x902c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x902c('0x14'));var config=require(_0x902c('0x15'));var licenseUtil=require(_0x902c('0x16'));var db=require(_0x902c('0x17'))['db'];function respondWithStatusCode(_0x2a3570,_0x26c09d){_0x26c09d=_0x26c09d||0xcc;return function(_0x420b5b){if(_0x420b5b){return _0x2a3570['sendStatus'](_0x26c09d);}return _0x2a3570[_0x902c('0x18')](_0x26c09d)[_0x902c('0x19')]();};}function respondWithResult(_0x35ee8f,_0x187d04){_0x187d04=_0x187d04||0xc8;return function(_0x2d5e93){if(_0x2d5e93){return _0x35ee8f['status'](_0x187d04)[_0x902c('0x1a')](_0x2d5e93);}};}function respondWithFilteredResult(_0xbeca83,_0x22f137){return function(_0x49d445){if(_0x49d445){var _0x2edc6d=typeof _0x22f137['offset']===_0x902c('0x1b')&&typeof _0x22f137[_0x902c('0x1c')]===_0x902c('0x1b');var _0x9f601b=_0x49d445[_0x902c('0x1d')];var _0x516afc=_0x2edc6d?0x0:_0x22f137[_0x902c('0x1e')];var _0xa8f92a=_0x2edc6d?_0x49d445[_0x902c('0x1d')]:_0x22f137['offset']+_0x22f137['limit'];var _0x2f4544;if(_0xa8f92a>=_0x9f601b){_0xa8f92a=_0x9f601b;_0x2f4544=0xc8;}else{_0x2f4544=0xce;}_0xbeca83[_0x902c('0x18')](_0x2f4544);return _0xbeca83['set'](_0x902c('0x1f'),_0x516afc+'-'+_0xa8f92a+'/'+_0x9f601b)[_0x902c('0x1a')](_0x49d445);}return null;};}function patchUpdates(_0x45c363){return function(_0x1b60ab){try{jsonpatch[_0x902c('0x20')](_0x1b60ab,_0x45c363,!![]);}catch(_0x3165fd){return BPromise[_0x902c('0x21')](_0x3165fd);}return _0x1b60ab[_0x902c('0x22')]();};}function saveUpdates(_0x4bb293,_0x33e74f){return function(_0x307573){if(_0x307573){return _0x307573[_0x902c('0x23')](_0x4bb293)[_0x902c('0x24')](function(_0x1e60a4){return _0x1e60a4;});}return null;};}function removeEntity(_0x631500,_0x373caa){return function(_0x243460){if(_0x243460){return _0x243460[_0x902c('0x25')]()[_0x902c('0x24')](function(){_0x631500[_0x902c('0x18')](0xcc)[_0x902c('0x19')]();});}};}function handleEntityNotFound(_0x5953c6,_0x155a55){return function(_0x13d3cb){if(!_0x13d3cb){_0x5953c6[_0x902c('0x26')](0x194);}return _0x13d3cb;};}function handleError(_0x3ff6db,_0x2c0869){_0x2c0869=_0x2c0869||0x1f4;return function(_0x15b542){logger[_0x902c('0x27')](_0x15b542[_0x902c('0x28')]);if(_0x15b542[_0x902c('0x29')]){delete _0x15b542['name'];}_0x3ff6db[_0x902c('0x18')](_0x2c0869)[_0x902c('0x2a')](_0x15b542);};}exports[_0x902c('0x23')]=function(_0x5c3c81,_0xc9fac5){if(_0x5c3c81['body']['id']){delete _0x5c3c81[_0x902c('0x2b')]['id'];}return db[_0x902c('0x2c')][_0x902c('0x2d')]({'where':{'id':_0x5c3c81[_0x902c('0x2e')]['id']}})['then'](handleEntityNotFound(_0xc9fac5,null))[_0x902c('0x24')](saveUpdates(_0x5c3c81[_0x902c('0x2b')],null))['then'](respondWithResult(_0xc9fac5,null))[_0x902c('0x2f')](handleError(_0xc9fac5,null));};exports[_0x902c('0x25')]=function(_0x5920d1,_0x124281){return db[_0x902c('0x2c')][_0x902c('0x2d')]({'where':{'id':_0x5920d1[_0x902c('0x2e')]['id']}})['then'](handleEntityNotFound(_0x124281,null))[_0x902c('0x24')](removeEntity(_0x124281,null))[_0x902c('0x2f')](handleError(_0x124281,null));}; \ No newline at end of file +var _0x1a7c=['then','destroy','sendStatus','error','stack','name','body','Action','find','params','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update'];(function(_0x451c84,_0xc44ca){var _0x404605=function(_0x3c04c1){while(--_0x3c04c1){_0x451c84['push'](_0x451c84['shift']());}};_0x404605(++_0xc44ca);}(_0x1a7c,0x95));var _0xc1a7=function(_0x54b0f3,_0x1fe2f7){_0x54b0f3=_0x54b0f3-0x0;var _0x5ae957=_0x1a7c[_0x54b0f3];return _0x5ae957;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1a7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1a7('0x1'));var rp=require(_0xc1a7('0x2'));var moment=require('moment');var BPromise=require(_0xc1a7('0x3'));var Mustache=require(_0xc1a7('0x4'));var util=require('util');var path=require(_0xc1a7('0x5'));var sox=require(_0xc1a7('0x6'));var csv=require(_0xc1a7('0x7'));var ejs=require(_0xc1a7('0x8'));var fs=require('fs');var fs_extra=require(_0xc1a7('0x9'));var _=require('lodash');var squel=require(_0xc1a7('0xa'));var crypto=require(_0xc1a7('0xb'));var jsforce=require(_0xc1a7('0xc'));var deskjs=require(_0xc1a7('0xd'));var toCsv=require(_0xc1a7('0x7'));var querystring=require(_0xc1a7('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc1a7('0xf'));var qs=require(_0xc1a7('0x10'));var as=require(_0xc1a7('0x11'));var hardwareService=require(_0xc1a7('0x12'));var logger=require(_0xc1a7('0x13'))(_0xc1a7('0x14'));var utils=require(_0xc1a7('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc1a7('0x16'))['db'];function respondWithStatusCode(_0x5e5176,_0x4c2f07){_0x4c2f07=_0x4c2f07||0xcc;return function(_0x2a4818){if(_0x2a4818){return _0x5e5176['sendStatus'](_0x4c2f07);}return _0x5e5176[_0xc1a7('0x17')](_0x4c2f07)[_0xc1a7('0x18')]();};}function respondWithResult(_0xee03b1,_0x2b56a1){_0x2b56a1=_0x2b56a1||0xc8;return function(_0x3612ba){if(_0x3612ba){return _0xee03b1['status'](_0x2b56a1)['json'](_0x3612ba);}};}function respondWithFilteredResult(_0x522b6a,_0x36e0fe){return function(_0x4e19d1){if(_0x4e19d1){var _0x3ccec3=typeof _0x36e0fe[_0xc1a7('0x19')]===_0xc1a7('0x1a')&&typeof _0x36e0fe[_0xc1a7('0x1b')]===_0xc1a7('0x1a');var _0x3bbaf9=_0x4e19d1[_0xc1a7('0x1c')];var _0x4f403f=_0x3ccec3?0x0:_0x36e0fe[_0xc1a7('0x19')];var _0x52a463=_0x3ccec3?_0x4e19d1[_0xc1a7('0x1c')]:_0x36e0fe['offset']+_0x36e0fe[_0xc1a7('0x1b')];var _0x3105c8;if(_0x52a463>=_0x3bbaf9){_0x52a463=_0x3bbaf9;_0x3105c8=0xc8;}else{_0x3105c8=0xce;}_0x522b6a[_0xc1a7('0x17')](_0x3105c8);return _0x522b6a['set'](_0xc1a7('0x1d'),_0x4f403f+'-'+_0x52a463+'/'+_0x3bbaf9)[_0xc1a7('0x1e')](_0x4e19d1);}return null;};}function patchUpdates(_0x41fae9){return function(_0x3f5cf7){try{jsonpatch[_0xc1a7('0x1f')](_0x3f5cf7,_0x41fae9,!![]);}catch(_0x3abcb9){return BPromise[_0xc1a7('0x20')](_0x3abcb9);}return _0x3f5cf7[_0xc1a7('0x21')]();};}function saveUpdates(_0x274dcb,_0x438985){return function(_0x16aa44){if(_0x16aa44){return _0x16aa44[_0xc1a7('0x22')](_0x274dcb)[_0xc1a7('0x23')](function(_0x27d3fd){return _0x27d3fd;});}return null;};}function removeEntity(_0x135b5e,_0x21a254){return function(_0x9f1553){if(_0x9f1553){return _0x9f1553[_0xc1a7('0x24')]()[_0xc1a7('0x23')](function(){_0x135b5e[_0xc1a7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9eeef6,_0x21fc6a){return function(_0x56eabd){if(!_0x56eabd){_0x9eeef6[_0xc1a7('0x25')](0x194);}return _0x56eabd;};}function handleError(_0x13ccce,_0x1650f0){_0x1650f0=_0x1650f0||0x1f4;return function(_0x2a3034){logger[_0xc1a7('0x26')](_0x2a3034[_0xc1a7('0x27')]);if(_0x2a3034[_0xc1a7('0x28')]){delete _0x2a3034[_0xc1a7('0x28')];}_0x13ccce[_0xc1a7('0x17')](_0x1650f0)['send'](_0x2a3034);};}exports[_0xc1a7('0x22')]=function(_0x303ab8,_0x74348d){if(_0x303ab8[_0xc1a7('0x29')]['id']){delete _0x303ab8[_0xc1a7('0x29')]['id'];}return db[_0xc1a7('0x2a')][_0xc1a7('0x2b')]({'where':{'id':_0x303ab8[_0xc1a7('0x2c')]['id']}})[_0xc1a7('0x23')](handleEntityNotFound(_0x74348d,null))[_0xc1a7('0x23')](saveUpdates(_0x303ab8[_0xc1a7('0x29')],null))['then'](respondWithResult(_0x74348d,null))[_0xc1a7('0x2d')](handleError(_0x74348d,null));};exports[_0xc1a7('0x24')]=function(_0x4bf991,_0x51dcb9){return db[_0xc1a7('0x2a')]['find']({'where':{'id':_0x4bf991[_0xc1a7('0x2c')]['id']}})[_0xc1a7('0x23')](handleEntityNotFound(_0x51dcb9,null))[_0xc1a7('0x23')](removeEntity(_0x51dcb9,null))[_0xc1a7('0x2d')](handleError(_0x51dcb9,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index a3d8a9a..3f4c53e 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 _0xde82=['./action.attributes','exports','define','tools_actions','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x408193,_0x388396){var _0x40e295=function(_0x318396){while(--_0x318396){_0x408193['push'](_0x408193['shift']());}};_0x40e295(++_0x388396);}(_0xde82,0xe0));var _0x2de8=function(_0xf3a154,_0x568aa0){_0xf3a154=_0xf3a154-0x0;var _0x35e9cf=_0xde82[_0xf3a154];return _0x35e9cf;};'use strict';var _=require(_0x2de8('0x0'));var util=require('util');var logger=require(_0x2de8('0x1'))(_0x2de8('0x2'));var moment=require(_0x2de8('0x3'));var BPromise=require(_0x2de8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2de8('0x5'));var rimraf=require(_0x2de8('0x6'));var config=require('../../config/environment');var attributes=require(_0x2de8('0x7'));module[_0x2de8('0x8')]=function(_0x34664e,_0x57f8eb){return _0x34664e[_0x2de8('0x9')]('Action',attributes,{'tableName':_0x2de8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c3c=['./action.attributes','Action','tools_actions','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4db483,_0x5293a9){var _0x401534=function(_0x15d072){while(--_0x15d072){_0x4db483['push'](_0x4db483['shift']());}};_0x401534(++_0x5293a9);}(_0x8c3c,0x142));var _0xc8c3=function(_0x2fa132,_0x14ab75){_0x2fa132=_0x2fa132-0x0;var _0x411d53=_0x8c3c[_0x2fa132];return _0x411d53;};'use strict';var _=require(_0xc8c3('0x0'));var util=require(_0xc8c3('0x1'));var logger=require(_0xc8c3('0x2'))(_0xc8c3('0x3'));var moment=require('moment');var BPromise=require(_0xc8c3('0x4'));var rp=require(_0xc8c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8c3('0x6'));var config=require(_0xc8c3('0x7'));var attributes=require(_0xc8c3('0x8'));module['exports']=function(_0x8a8f82,_0x1a4adb){return _0x8a8f82['define'](_0xc8c3('0x9'),attributes,{'tableName':_0xc8c3('0xa'),'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 7d30b2b..0a2e931 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 _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5ad88e,_0x5d42a1){var _0x549079=function(_0x3a4d6f){while(--_0x3a4d6f){_0x5ad88e['push'](_0x5ad88e['shift']());}};_0x549079(++_0x5d42a1);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x16bfae,_0x36ed25){_0x16bfae=_0x16bfae-0x0;var _0x3870f5=_0x7fbe[_0x16bfae];return _0x3870f5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x5e1914,_0x1313a3){var _0x4fb013=function(_0x31be59){while(--_0x31be59){_0x5e1914['push'](_0x5e1914['shift']());}};_0x4fb013(++_0x1313a3);}(_0xe14b,0x93));var _0xbe14=function(_0x20b807,_0x35fa4a){_0x20b807=_0x20b807-0x0;var _0x147302=_0xe14b[_0x20b807];return _0x147302;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index c7abd67..e429b36 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 _0x1e29=['../../components/interaction/service','put','/:id','update','destroy','multer','util','path','express','Router'];(function(_0x80a18e,_0x3d749){var _0x56f354=function(_0x68f489){while(--_0x68f489){_0x80a18e['push'](_0x80a18e['shift']());}};_0x56f354(++_0x3d749);}(_0x1e29,0xcd));var _0x91e2=function(_0x45b824,_0x38d8f1){_0x45b824=_0x45b824-0x0;var _0x52635c=_0x1e29[_0x45b824];return _0x52635c;};'use strict';var multer=require(_0x91e2('0x0'));var util=require(_0x91e2('0x1'));var path=require(_0x91e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x91e2('0x3'));var router=express[_0x91e2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x91e2('0x5'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x91e2('0x6')](_0x91e2('0x7'),auth['isAuthenticated'](),controller[_0x91e2('0x8')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x91e2('0x9')]);module['exports']=router; \ No newline at end of file +var _0x9434=['isAuthenticated','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./action.controller'];(function(_0x53e137,_0x4cfdcd){var _0x39ae2e=function(_0x25a0ed){while(--_0x25a0ed){_0x53e137['push'](_0x53e137['shift']());}};_0x39ae2e(++_0x4cfdcd);}(_0x9434,0x71));var _0x4943=function(_0x430e88,_0x1eabcb){_0x430e88=_0x430e88-0x0;var _0x5616e0=_0x9434[_0x430e88];return _0x5616e0;};'use strict';var multer=require(_0x4943('0x0'));var util=require(_0x4943('0x1'));var path=require('path');var timeout=require(_0x4943('0x2'));var express=require(_0x4943('0x3'));var router=express[_0x4943('0x4')]();var fs_extra=require(_0x4943('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4943('0x6'));var config=require('../../config/environment');var controller=require(_0x4943('0x7'));router['put']('/:id',auth[_0x4943('0x8')](),controller[_0x4943('0x9')]);router[_0x4943('0xa')]('/:id',auth[_0x4943('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 3102f4f..6aade28 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 _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0x517d65,_0x29cbc3){var _0xf911de=function(_0x1389ee){while(--_0x1389ee){_0x517d65['push'](_0x517d65['shift']());}};_0xf911de(++_0x29cbc3);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x4da133,_0x3f7748){var _0xf1969e=function(_0x46055e){while(--_0x46055e){_0x4da133['push'](_0x4da133['shift']());}};_0xf1969e(++_0x3f7748);}(_0xb138,0x1dd));var _0x8b13=function(_0x37f2d6,_0x2aa0ca){_0x37f2d6=_0x37f2d6-0x0;var _0x2b3d86=_0xb138[_0x37f2d6];return _0x2b3d86;};'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 8ea72c1..4ee8136 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 _0x8df2=['autoAssociation','UserProfileResource','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','MIN(%s)','GROUP_CONCAT(%s)','ROUND(%s)','groupBy','parse','output','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','map','AnalyticCustomReport','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','include','findAll','rows','catch','show','rawAttributes','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId'];(function(_0x27f7d6,_0x13fc7a){var _0x277c28=function(_0x5ac74d){while(--_0x5ac74d){_0x27f7d6['push'](_0x27f7d6['shift']());}};_0x277c28(++_0x13fc7a);}(_0x8df2,0x1b1));var _0x28df=function(_0x1c7a3c,_0x2639ac){_0x1c7a3c=_0x1c7a3c-0x0;var _0x36e66c=_0x8df2[_0x1c7a3c];return _0x36e66c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28df('0x0'));var zipdir=require(_0x28df('0x1'));var jsonpatch=require(_0x28df('0x2'));var rp=require(_0x28df('0x3'));var moment=require('moment');var BPromise=require(_0x28df('0x4'));var Mustache=require('mustache');var util=require(_0x28df('0x5'));var path=require('path');var sox=require(_0x28df('0x6'));var csv=require(_0x28df('0x7'));var ejs=require(_0x28df('0x8'));var fs=require('fs');var fs_extra=require(_0x28df('0x9'));var _=require(_0x28df('0xa'));var squel=require(_0x28df('0xb'));var crypto=require(_0x28df('0xc'));var jsforce=require(_0x28df('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x28df('0x7'));var querystring=require(_0x28df('0xe'));var Papa=require(_0x28df('0xf'));var Redis=require(_0x28df('0x10'));var authService=require(_0x28df('0x11'));var qs=require(_0x28df('0x12'));var as=require(_0x28df('0x13'));var hardwareService=require(_0x28df('0x14'));var logger=require('../../config/logger')(_0x28df('0x15'));var utils=require(_0x28df('0x16'));var config=require(_0x28df('0x17'));var licenseUtil=require(_0x28df('0x18'));var db=require(_0x28df('0x19'))['db'];var dbH=require(_0x28df('0x19'))[_0x28df('0x1a')];function respondWithStatusCode(_0x4d5018,_0x868d34){_0x868d34=_0x868d34||0xcc;return function(_0x18fe9e){if(_0x18fe9e){return _0x4d5018[_0x28df('0x1b')](_0x868d34);}return _0x4d5018[_0x28df('0x1c')](_0x868d34)['end']();};}function respondWithResult(_0x3691bb,_0x591526){_0x591526=_0x591526||0xc8;return function(_0x27c443){if(_0x27c443){return _0x3691bb[_0x28df('0x1c')](_0x591526)[_0x28df('0x1d')](_0x27c443);}};}function respondWithFilteredResult(_0x52fa5b,_0x11a39c){return function(_0x11afb5){if(_0x11afb5){var _0x163937=typeof _0x11a39c['offset']==='undefined'&&typeof _0x11a39c[_0x28df('0x1e')]==='undefined';var _0x586bba=_0x11afb5[_0x28df('0x1f')];var _0x24af0d=_0x163937?0x0:_0x11a39c[_0x28df('0x20')];var _0x508aca=_0x163937?_0x11afb5['count']:_0x11a39c[_0x28df('0x20')]+_0x11a39c[_0x28df('0x1e')];var _0x2a066b;if(_0x508aca>=_0x586bba){_0x508aca=_0x586bba;_0x2a066b=0xc8;}else{_0x2a066b=0xce;}_0x52fa5b[_0x28df('0x1c')](_0x2a066b);return _0x52fa5b[_0x28df('0x21')](_0x28df('0x22'),_0x24af0d+'-'+_0x508aca+'/'+_0x586bba)[_0x28df('0x1d')](_0x11afb5);}return null;};}function patchUpdates(_0x3230c1){return function(_0x6d8934){try{jsonpatch[_0x28df('0x23')](_0x6d8934,_0x3230c1,!![]);}catch(_0x2d3b01){return BPromise[_0x28df('0x24')](_0x2d3b01);}return _0x6d8934[_0x28df('0x25')]();};}function saveUpdates(_0xd9facc,_0x4ee7c3){return function(_0x2c8975){if(_0x2c8975){return _0x2c8975[_0x28df('0x26')](_0xd9facc)[_0x28df('0x27')](function(_0x5d46cf){return _0x5d46cf;});}return null;};}function removeEntity(_0x239f6d,_0x950856){return function(_0x141152){if(_0x141152){return _0x141152[_0x28df('0x28')]()[_0x28df('0x27')](function(){var _0x659ed0=_0x141152[_0x28df('0x29')]({'plain':!![]});var _0x227750='CustomReports';return db['UserProfileResource'][_0x28df('0x28')]({'where':{'type':_0x227750,'resourceId':_0x659ed0['id']}})[_0x28df('0x27')](function(){return _0x141152;});})[_0x28df('0x27')](function(){_0x239f6d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc04899,_0x680ca6){return function(_0x2489a5){if(!_0x2489a5){_0xc04899[_0x28df('0x1b')](0x194);}return _0x2489a5;};}function handleError(_0x205c95,_0x3b6328){_0x3b6328=_0x3b6328||0x1f4;return function(_0x289a12){logger['error'](_0x289a12[_0x28df('0x2a')]);if(_0x289a12[_0x28df('0x2b')]){delete _0x289a12[_0x28df('0x2b')];}_0x205c95['status'](_0x3b6328)['send'](_0x289a12);};}exports['index']=function(_0x171e12,_0x3f8748){var _0xca07d0={},_0x47fc26={},_0x472074={'count':0x0,'rows':[]};var _0x3493d2=_[_0x28df('0x2c')](db[_0x28df('0x2d')]['rawAttributes'],function(_0x384ac6){return{'name':_0x384ac6[_0x28df('0x2e')],'type':_0x384ac6[_0x28df('0x2f')][_0x28df('0x30')]};});_0x47fc26['model']=_[_0x28df('0x2c')](_0x3493d2,_0x28df('0x2b'));_0x47fc26[_0x28df('0x31')]=_[_0x28df('0x32')](_0x171e12[_0x28df('0x31')]);_0x47fc26['filters']=_['intersection'](_0x47fc26[_0x28df('0x33')],_0x47fc26[_0x28df('0x31')]);_0xca07d0[_0x28df('0x34')]=_[_0x28df('0x35')](_0x47fc26[_0x28df('0x33')],qs[_0x28df('0x36')](_0x171e12[_0x28df('0x31')][_0x28df('0x36')]));_0xca07d0['attributes']=_0xca07d0[_0x28df('0x34')][_0x28df('0x37')]?_0xca07d0['attributes']:_0x47fc26['model'];if(!_0x171e12[_0x28df('0x31')][_0x28df('0x38')](_0x28df('0x39'))){_0xca07d0[_0x28df('0x1e')]=qs['limit'](_0x171e12[_0x28df('0x31')]['limit']);_0xca07d0[_0x28df('0x20')]=qs[_0x28df('0x20')](_0x171e12[_0x28df('0x31')][_0x28df('0x20')]);}_0xca07d0[_0x28df('0x3a')]=qs[_0x28df('0x3b')](_0x171e12[_0x28df('0x31')][_0x28df('0x3b')]);_0xca07d0[_0x28df('0x3c')]=qs[_0x28df('0x3d')](_['pick'](_0x171e12[_0x28df('0x31')],_0x47fc26[_0x28df('0x3d')]),_0x3493d2);if(_0x171e12[_0x28df('0x31')][_0x28df('0x3e')]){_0xca07d0[_0x28df('0x3c')]=_['merge'](_0xca07d0[_0x28df('0x3c')],{'$or':_['map'](_0x3493d2,function(_0x12fb78){if(_0x12fb78['type']!==_0x28df('0x3f')){var _0x36b38b={};_0x36b38b[_0x12fb78[_0x28df('0x2b')]]={'$like':'%'+_0x171e12[_0x28df('0x31')][_0x28df('0x3e')]+'%'};return _0x36b38b;}})});}_0xca07d0=_['merge']({},_0xca07d0,_0x171e12['options']);var _0x29f573={'where':_0xca07d0[_0x28df('0x3c')]};return db[_0x28df('0x2d')]['count'](_0x29f573)[_0x28df('0x27')](function(_0x4dd28d){_0x472074[_0x28df('0x1f')]=_0x4dd28d;if(_0x171e12[_0x28df('0x31')]['includeAll']){_0xca07d0[_0x28df('0x40')]=[{'all':!![]}];}return db[_0x28df('0x2d')][_0x28df('0x41')](_0xca07d0);})[_0x28df('0x27')](function(_0x2cc300){_0x472074[_0x28df('0x42')]=_0x2cc300;return _0x472074;})[_0x28df('0x27')](respondWithFilteredResult(_0x3f8748,_0xca07d0))[_0x28df('0x43')](handleError(_0x3f8748,null));};exports[_0x28df('0x44')]=function(_0x45b268,_0x5edef1){var _0xc257ca={'raw':![],'where':{'id':_0x45b268['params']['id']}},_0x175344={};_0x175344['model']=_[_0x28df('0x32')](db[_0x28df('0x2d')][_0x28df('0x45')]);_0x175344[_0x28df('0x31')]=_[_0x28df('0x32')](_0x45b268[_0x28df('0x31')]);_0x175344['filters']=_['intersection'](_0x175344[_0x28df('0x33')],_0x175344[_0x28df('0x31')]);_0xc257ca['attributes']=_[_0x28df('0x35')](_0x175344['model'],qs[_0x28df('0x36')](_0x45b268[_0x28df('0x31')][_0x28df('0x36')]));_0xc257ca['attributes']=_0xc257ca[_0x28df('0x34')][_0x28df('0x37')]?_0xc257ca[_0x28df('0x34')]:_0x175344['model'];if(_0x45b268[_0x28df('0x31')][_0x28df('0x46')]){_0xc257ca[_0x28df('0x40')]=[{'all':!![]}];}_0xc257ca=_['merge']({},_0xc257ca,_0x45b268[_0x28df('0x47')]);return db[_0x28df('0x2d')][_0x28df('0x48')](_0xc257ca)[_0x28df('0x27')](handleEntityNotFound(_0x5edef1,null))[_0x28df('0x27')](respondWithResult(_0x5edef1,null))[_0x28df('0x43')](handleError(_0x5edef1,null));};exports[_0x28df('0x49')]=function(_0x14eca4,_0x39647a){return db['AnalyticCustomReport'][_0x28df('0x49')](_0x14eca4['body'],{})[_0x28df('0x27')](function(_0x10aced){var _0x3e8ea5=_0x14eca4[_0x28df('0x4a')][_0x28df('0x29')]({'plain':!![]});if(!_0x3e8ea5)throw new Error(_0x28df('0x4b'));if(_0x3e8ea5[_0x28df('0x4c')]===_0x28df('0x4a')){var _0x2e2782=_0x10aced[_0x28df('0x29')]({'plain':!![]});var _0x4ffb0b=_0x28df('0x4d');return db[_0x28df('0x4e')][_0x28df('0x48')]({'where':{'name':_0x4ffb0b,'userProfileId':_0x3e8ea5[_0x28df('0x4f')]},'raw':!![]})[_0x28df('0x27')](function(_0x740dc8){if(_0x740dc8&&_0x740dc8[_0x28df('0x50')]===0x0){return db[_0x28df('0x51')][_0x28df('0x49')]({'name':_0x2e2782[_0x28df('0x2b')],'resourceId':_0x2e2782['id'],'type':_0x28df('0x52'),'sectionId':_0x740dc8['id']},{})[_0x28df('0x27')](function(){return _0x10aced;});}else{return _0x10aced;}})[_0x28df('0x43')](function(_0x4285ce){logger[_0x28df('0x53')](_0x28df('0x54'),_0x4285ce);throw _0x4285ce;});}return _0x10aced;})['then'](respondWithResult(_0x39647a,0xc9))[_0x28df('0x43')](handleError(_0x39647a,null));};exports[_0x28df('0x26')]=function(_0x20acdc,_0x130cf0){if(_0x20acdc[_0x28df('0x55')]['id']){delete _0x20acdc[_0x28df('0x55')]['id'];}return db[_0x28df('0x2d')][_0x28df('0x48')]({'where':{'id':_0x20acdc[_0x28df('0x56')]['id']}})[_0x28df('0x27')](handleEntityNotFound(_0x130cf0,null))[_0x28df('0x27')](saveUpdates(_0x20acdc[_0x28df('0x55')],null))['then'](respondWithResult(_0x130cf0,null))[_0x28df('0x43')](handleError(_0x130cf0,null));};exports[_0x28df('0x28')]=function(_0x588a8c,_0x37ecac){return db[_0x28df('0x2d')][_0x28df('0x48')]({'where':{'id':_0x588a8c[_0x28df('0x56')]['id']}})[_0x28df('0x27')](handleEntityNotFound(_0x37ecac,null))['then'](removeEntity(_0x37ecac,null))[_0x28df('0x43')](handleError(_0x37ecac,null));};exports[_0x28df('0x57')]=function(_0x15d5dc,_0x13740e){var _0x1a5577=0xa;var _0x55e472=[_0x28df('0x58'),_0x28df('0x59'),_0x28df('0x5a'),_0x28df('0x5b')];var _0x494c8f={'SUM':_0x28df('0x5c'),'COUNT':_0x28df('0x5d'),'COUNT DISTINCT':_0x28df('0x5e'),'MAX':_0x28df('0x5f'),'MIN':'MIN(%s)','AVG':_0x28df('0x60'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x28df('0x61')};var _0x4068b5={'SEC_TO_TIME':_0x28df('0x62'),'DATE':_0x28df('0x63'),'HOUR':_0x28df('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x28df('0x65')};var _0x57cb04=function(_0x500a0f){return!_[_0x28df('0x66')]([_0x28df('0x67'),_0x28df('0x68'),_0x28df('0x69'),_0x28df('0x6a')],_0x500a0f);};var _0xce011a=function(_0x2f7e6a){if(!_0x2f7e6a||!_0x2f7e6a[_0x28df('0x6b')][_0x28df('0x37')]){return'';}for(var _0x315039='(',_0x10db1e=0x0;_0x10db1e<_0x2f7e6a[_0x28df('0x6b')]['length'];_0x10db1e+=0x1){_0x10db1e>0x0&&(_0x315039+='\x20'+_0x2f7e6a[_0x28df('0x6c')]+'\x20');_0x315039+=_0x2f7e6a[_0x28df('0x6b')][_0x10db1e]['group']?_0xce011a(_0x2f7e6a[_0x28df('0x6b')][_0x10db1e][_0x28df('0x6d')]):_0x2f7e6a[_0x28df('0x6b')][_0x10db1e][_0x28df('0x6e')]+'\x20'+_0x2f7e6a[_0x28df('0x6b')][_0x10db1e]['condition']+(_0x57cb04(_0x2f7e6a[_0x28df('0x6b')][_0x10db1e][_0x28df('0x6f')])?'\x20'+_0x2f7e6a[_0x28df('0x6b')][_0x10db1e][_0x28df('0x70')]:'');}return _0x315039+')';};var _0x34b224={'where':{'id':_0x15d5dc[_0x28df('0x56')]['id']}},_0x1fc504,_0x2bf6af,_0x273f7e,_0x5c743d,_0x10ce25;_0x34b224=_[_0x28df('0x71')]({},_0x34b224,_0x15d5dc[_0x28df('0x47')]);return db[_0x28df('0x2d')][_0x28df('0x48')](_0x34b224)[_0x28df('0x27')](function(_0x32e654){if(_0x32e654){_0x1fc504=_0x32e654;return _0x32e654[_0x28df('0x72')]();}return null;})[_0x28df('0x27')](function(_0x482414){if(_0x482414){if(!_0x482414['length']){throw new db[(_0x28df('0x73'))][(_0x28df('0x74'))](_0x28df('0x75'),0x193);}_0x2bf6af=_0x482414;return db[_0x28df('0x76')][_0x28df('0x41')]({'raw':!![]});}return null;})[_0x28df('0x27')](function(_0x33fa17){if(_0x33fa17){_0x273f7e=_[_0x28df('0x77')](_0x33fa17,'id');var _0x5cebcb;var _0x4416ed=squel[_0x28df('0x78')]();_0x4416ed[_0x28df('0x79')](_0x1fc504[_0x28df('0x7a')]);for(var _0x254945=0x0;_0x254945<_0x2bf6af[_0x28df('0x37')];_0x254945+=0x1){_0x5cebcb=_0x2bf6af[_0x254945][_0x28df('0x7b')]?_0x273f7e[_0x2bf6af[_0x254945][_0x28df('0x7b')]][_0x28df('0x7c')]:_0x2bf6af[_0x254945][_0x28df('0x6e')];_0x5cebcb=_0x2bf6af[_0x254945][_0x28df('0x7d')]?_[_0x28df('0x7e')](_0x494c8f[_0x2bf6af[_0x254945]['function']],'%s',_0x5cebcb):_0x5cebcb;_0x5cebcb=_0x2bf6af[_0x254945][_0x28df('0x7f')]?_[_0x28df('0x7e')](_0x4068b5[_0x2bf6af[_0x254945]['format']],'%s',_0x5cebcb):_0x5cebcb;if(_0x2bf6af[_0x254945]['groupBy']){_0x4416ed[_0x28df('0x6d')](_0x5cebcb);}_0x2bf6af[_0x254945][_0x28df('0x80')]&&_0x4416ed[_0x28df('0x3a')](_0x5cebcb,_0x2bf6af[_0x254945]['orderBy']===_0x28df('0x81')?![]:!![]);_0x4416ed[_0x28df('0x6e')](_0x5cebcb,_0x2bf6af[_0x254945][_0x28df('0x82')]||_0x5cebcb);}if(_0x1fc504[_0x28df('0x83')]){_0x1fc504['joins']=JSON['parse'](_0x1fc504[_0x28df('0x83')]);for(var _0x266f89=0x0;_0x266f89<_0x1fc504[_0x28df('0x83')][_0x28df('0x37')];_0x266f89+=0x1){if(_0x1fc504[_0x28df('0x83')][_0x266f89]['type']&&_[_0x28df('0x66')](_0x55e472,_0x1fc504[_0x28df('0x83')][_0x266f89][_0x28df('0x2f')])&&_0x1fc504[_0x28df('0x83')][_0x266f89]['parentKey']&&_0x1fc504[_0x28df('0x83')][_0x266f89][_0x28df('0x84')]&&_0x1fc504['joins'][_0x266f89][_0x28df('0x85')]){_0x4416ed[_0x1fc504[_0x28df('0x83')][_0x266f89]['type']](_0x1fc504[_0x28df('0x83')][_0x266f89]['foreignTable'],null,util['format'](_0x28df('0x86'),_0x1fc504[_0x28df('0x7a')],_0x1fc504[_0x28df('0x83')][_0x266f89][_0x28df('0x87')],_0x1fc504['joins'][_0x266f89][_0x28df('0x84')],_0x1fc504[_0x28df('0x83')][_0x266f89][_0x28df('0x85')]));}}}if(_0x1fc504[_0x28df('0x88')]){_0x1fc504[_0x28df('0x88')]=JSON['parse'](_0x1fc504[_0x28df('0x88')]);_0x4416ed[_0x28df('0x3c')](_0xce011a(_0x1fc504[_0x28df('0x88')]['group']));}_0x10ce25=_0x4416ed[_0x28df('0x89')]();_0x4416ed[_0x28df('0x1e')](_0x1a5577);_0x4416ed['offset'](0x0);logger[_0x28df('0x8a')](_0x28df('0x8b'),_0x4416ed['toString']());return dbH['sequelize'][_0x28df('0x31')](_0x4416ed['toString'](),{'type':dbH[_0x28df('0x8c')][_0x28df('0x8d')][_0x28df('0x8e')]});}})[_0x28df('0x27')](respondWithResult(_0x13740e,null))[_0x28df('0x43')](handleError(_0x13740e,null));};function runReport(_0x54c2d3,_0x48d0d2,_0x1ef0d2){var _0xa6f466=_0x48d0d2['name'];var _0xff79de=0xa;var _0x36e98d=['join',_0x28df('0x59'),_0x28df('0x5a'),_0x28df('0x5b')];var _0x4e97fa={'SUM':'SUM(%s)','COUNT':_0x28df('0x5d'),'COUNT DISTINCT':_0x28df('0x5e'),'MAX':'MAX(%s)','MIN':_0x28df('0x8f'),'AVG':_0x28df('0x60'),'GROUP_CONCAT':_0x28df('0x90'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x28df('0x61')};var _0x4a84c9={'SEC_TO_TIME':_0x28df('0x62'),'DATE':_0x28df('0x63'),'HOUR':_0x28df('0x64'),'ROUND':_0x28df('0x91'),'UNIX_TIMESTAMP':_0x28df('0x65')};var _0x496862=function(_0x2724e0){return!_['includes'](['IS\x20NULL',_0x28df('0x68'),_0x28df('0x69'),_0x28df('0x6a')],_0x2724e0);};var _0x5cdede=function(_0x4df21a){if(!_0x4df21a||!_0x4df21a['rules'][_0x28df('0x37')]){return'';}for(var _0x3bef0b='(',_0x3bf87d=0x0;_0x3bf87d<_0x4df21a['rules'][_0x28df('0x37')];_0x3bf87d+=0x1){_0x3bf87d>0x0&&(_0x3bef0b+='\x20'+_0x4df21a['operator']+'\x20');_0x3bef0b+=_0x4df21a['rules'][_0x3bf87d][_0x28df('0x6d')]?_0x5cdede(_0x4df21a[_0x28df('0x6b')][_0x3bf87d][_0x28df('0x6d')]):_0x4df21a[_0x28df('0x6b')][_0x3bf87d][_0x28df('0x6e')]+'\x20'+_0x4df21a[_0x28df('0x6b')][_0x3bf87d]['condition']+(_0x496862(_0x4df21a['rules'][_0x3bf87d][_0x28df('0x6f')])?'\x20'+_0x4df21a[_0x28df('0x6b')][_0x3bf87d]['value']:'');}return _0x3bef0b+')';};var _0x42b864={'where':{'id':_0x54c2d3['id']}},_0x4cdd56,_0x314bcb,_0x2aa012,_0x2d5a06,_0x2591fd;_0x42b864=_[_0x28df('0x71')]({},_0x42b864,_0x1ef0d2);return db[_0x28df('0x2d')][_0x28df('0x48')](_0x42b864)[_0x28df('0x27')](function(_0x2ee437){if(_0x2ee437){_0x4cdd56=_0x2ee437;return _0x2ee437[_0x28df('0x72')]();}return null;})[_0x28df('0x27')](function(_0x3e099a){if(_0x3e099a){if(!_0x3e099a[_0x28df('0x37')]){throw new db[(_0x28df('0x73'))][(_0x28df('0x74'))](_0x28df('0x75'),0x193);}_0x314bcb=_0x3e099a;return db[_0x28df('0x76')]['findAll']({'raw':!![]});}return null;})[_0x28df('0x27')](function(_0x249262){if(_0x249262){_0x2aa012=_[_0x28df('0x77')](_0x249262,'id');var _0x190863;var _0x2aedc3=squel[_0x28df('0x78')]();_0x2aedc3[_0x28df('0x79')](_0x4cdd56[_0x28df('0x7a')]);for(var _0x3189bd=0x0;_0x3189bd<_0x314bcb['length'];_0x3189bd+=0x1){_0x190863=_0x314bcb[_0x3189bd][_0x28df('0x7b')]?_0x2aa012[_0x314bcb[_0x3189bd][_0x28df('0x7b')]][_0x28df('0x7c')]:_0x314bcb[_0x3189bd][_0x28df('0x6e')];_0x190863=_0x314bcb[_0x3189bd][_0x28df('0x7d')]?_[_0x28df('0x7e')](_0x4e97fa[_0x314bcb[_0x3189bd]['function']],'%s',_0x190863):_0x190863;_0x190863=_0x314bcb[_0x3189bd][_0x28df('0x7f')]?_[_0x28df('0x7e')](_0x4a84c9[_0x314bcb[_0x3189bd][_0x28df('0x7f')]],'%s',_0x190863):_0x190863;if(_0x314bcb[_0x3189bd][_0x28df('0x92')]){_0x2aedc3[_0x28df('0x6d')](_0x190863);}_0x314bcb[_0x3189bd][_0x28df('0x80')]&&_0x2aedc3[_0x28df('0x3a')](_0x190863,_0x314bcb[_0x3189bd][_0x28df('0x80')]==='DESC'?![]:!![]);_0x2aedc3[_0x28df('0x6e')](_0x190863,_0x314bcb[_0x3189bd]['alias']||_0x190863);}if(_0x4cdd56[_0x28df('0x83')]){_0x4cdd56[_0x28df('0x83')]=JSON[_0x28df('0x93')](_0x4cdd56['joins']);for(var _0x5c76a5=0x0;_0x5c76a5<_0x4cdd56[_0x28df('0x83')][_0x28df('0x37')];_0x5c76a5+=0x1){if(_0x4cdd56['joins'][_0x5c76a5][_0x28df('0x2f')]&&_[_0x28df('0x66')](_0x36e98d,_0x4cdd56[_0x28df('0x83')][_0x5c76a5][_0x28df('0x2f')])&&_0x4cdd56[_0x28df('0x83')][_0x5c76a5][_0x28df('0x87')]&&_0x4cdd56['joins'][_0x5c76a5][_0x28df('0x84')]&&_0x4cdd56[_0x28df('0x83')][_0x5c76a5][_0x28df('0x85')]){_0x2aedc3[_0x4cdd56['joins'][_0x5c76a5][_0x28df('0x2f')]](_0x4cdd56['joins'][_0x5c76a5]['foreignTable'],null,util[_0x28df('0x7f')](_0x28df('0x86'),_0x4cdd56[_0x28df('0x7a')],_0x4cdd56['joins'][_0x5c76a5][_0x28df('0x87')],_0x4cdd56[_0x28df('0x83')][_0x5c76a5]['foreignTable'],_0x4cdd56['joins'][_0x5c76a5][_0x28df('0x85')]));}}}if(_0x4cdd56['conditions']){_0x4cdd56[_0x28df('0x88')]=JSON[_0x28df('0x93')](_0x4cdd56[_0x28df('0x88')]);_0x2aedc3['where'](_0x5cdede(_0x4cdd56[_0x28df('0x88')][_0x28df('0x6d')]));}_0x2591fd=_0x2aedc3[_0x28df('0x89')]();_0x2aedc3[_0x28df('0x1e')](_0xff79de);_0x2aedc3[_0x28df('0x20')](0x0);return;}})['then'](function(){if(_0x48d0d2[_0x28df('0x94')]==='web'){return null;}var _0x568860=_[_0x28df('0x71')](_0x48d0d2,{'name':_0x48d0d2['fullPath']||_0x48d0d2[_0x28df('0x2b')]||_0x4cdd56[_0x28df('0x2b')],'basename':_0xa6f466,'savename':util['format'](_0x28df('0x95'),_0x48d0d2[_0x28df('0x2b')]||_0x4cdd56['name'],require(_0x28df('0x96'))[_0x28df('0x97')](0x4),_0x48d0d2['output']||_0x28df('0x98')),'reportId':_0x4cdd56['id'],'reportType':_0x28df('0x99')});return db['AnalyticExtractedReport'][_0x28df('0x49')](_0x568860,{'raw':!![]});})[_0x28df('0x27')](function(_0x3e490b){if(_0x4cdd56[_0x28df('0x7a')]===_0x28df('0x9a')){_0x2591fd['where'](_0x4cdd56['table']+_0x28df('0x9b'),_0x48d0d2[_0x28df('0x9c')],_0x48d0d2[_0x28df('0x9d')]);}else{_0x2591fd[_0x28df('0x3c')](_0x4cdd56['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x48d0d2['startDate'],_0x48d0d2[_0x28df('0x9d')]);}if(_0x3e490b){logger[_0x28df('0x9e')](_0x28df('0x9f'),_0x2591fd[_0x28df('0xa0')]());require(_0x28df('0xa1'))[_0x28df('0xa2')](path['join'](__dirname,_0x28df('0xa3'),_0x3e490b[_0x28df('0x94')]),[_0x3e490b['id'],_0x2591fd[_0x28df('0xa0')](),path[_0x28df('0x58')](__dirname,_0x28df('0xa4'),_0x3e490b[_0x28df('0xa5')]),_0xa6f466]);return _0x3e490b;}else{var _0x4c8663=squel[_0x28df('0x78')]();_0x4c8663[_0x28df('0x79')]('('+_0x2591fd[_0x28df('0xa0')]()+')',_0x28df('0xa6'));_0x4c8663[_0x28df('0x6e')](_0x28df('0xa7'),_0x28df('0x1f'));_0x2591fd[_0x28df('0x1e')](_0x48d0d2[_0x28df('0x1e')]||_0xff79de);_0x2591fd[_0x28df('0x20')](_0x48d0d2[_0x28df('0x20')]||0x0);return dbH['sequelize'][_0x28df('0x31')](_0x4c8663['toString'](),{'type':dbH[_0x28df('0x8c')][_0x28df('0x8d')]['SELECT']})[_0x28df('0x27')](function(_0x4afb26){if(!_0x4afb26[_0x28df('0x37')]){_0x2d5a06=0x0;}else{_0x2d5a06=_0x4afb26[0x0][_0x28df('0x1f')]||0x0;}return dbH[_0x28df('0x8c')][_0x28df('0x31')](_0x2591fd[_0x28df('0xa0')](),{'type':dbH[_0x28df('0x8c')][_0x28df('0x8d')][_0x28df('0x8e')]});})['then'](function(_0x23414b){return{'rows':_0x23414b||[],'count':_0x2d5a06};});}});}exports[_0x28df('0xa8')]=function(_0xc2c98e,_0x4fc20a){return runReport(_0xc2c98e[_0x28df('0x56')],_0xc2c98e[_0x28df('0x31')],_0xc2c98e[_0x28df('0x47')])['then'](respondWithResult(_0x4fc20a,null))[_0x28df('0x43')](handleError(_0x4fc20a,null));};exports[_0x28df('0xa9')]=runReport;exports['query']=function(_0x142729,_0x548575){var _0x510e70=0xa;var _0xe552=[_0x28df('0x58'),_0x28df('0x59'),_0x28df('0x5a'),_0x28df('0x5b')];var _0x54b711={'SUM':_0x28df('0x5c'),'COUNT':_0x28df('0x5d'),'COUNT DISTINCT':_0x28df('0x5e'),'MAX':_0x28df('0x5f'),'MIN':_0x28df('0x8f'),'AVG':_0x28df('0x60'),'GROUP_CONCAT':_0x28df('0x90'),'GROUP_CONCAT ASC':_0x28df('0xaa'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x412642={'SEC_TO_TIME':_0x28df('0x62'),'DATE':_0x28df('0x63'),'HOUR':_0x28df('0x64'),'ROUND':_0x28df('0x91'),'UNIX_TIMESTAMP':_0x28df('0x65')};var _0x5b66ec=function(_0x2d35df){return!_['includes']([_0x28df('0x67'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x28df('0x6a')],_0x2d35df);};var _0xba2728=function(_0x2dbd90){if(!_0x2dbd90||!_0x2dbd90[_0x28df('0x6b')][_0x28df('0x37')]){return'';}for(var _0x1a66be='(',_0x4381f6=0x0;_0x4381f6<_0x2dbd90['rules'][_0x28df('0x37')];_0x4381f6+=0x1){_0x4381f6>0x0&&(_0x1a66be+='\x20'+_0x2dbd90[_0x28df('0x6c')]+'\x20');_0x1a66be+=_0x2dbd90[_0x28df('0x6b')][_0x4381f6]['group']?_0xba2728(_0x2dbd90[_0x28df('0x6b')][_0x4381f6][_0x28df('0x6d')]):_0x2dbd90[_0x28df('0x6b')][_0x4381f6][_0x28df('0x6e')]+'\x20'+_0x2dbd90[_0x28df('0x6b')][_0x4381f6][_0x28df('0x6f')]+(_0x5b66ec(_0x2dbd90[_0x28df('0x6b')][_0x4381f6][_0x28df('0x6f')])?'\x20'+_0x2dbd90[_0x28df('0x6b')][_0x4381f6][_0x28df('0x70')]:'');}return _0x1a66be+')';};var _0x483180={'where':{'id':_0x142729['params']['id']}},_0x2ceae9,_0x32909f,_0x32b8e1,_0x3f581c,_0x218c71;_0x483180=_[_0x28df('0x71')]({},_0x483180,_0x142729[_0x28df('0x47')]);return db['AnalyticCustomReport'][_0x28df('0x48')](_0x483180)['then'](function(_0x2cd16a){if(_0x2cd16a){_0x2ceae9=_0x2cd16a;return _0x2cd16a[_0x28df('0x72')]();}return null;})[_0x28df('0x27')](function(_0x29dac9){if(_0x29dac9){if(!_0x29dac9[_0x28df('0x37')]){throw new db['Sequelize'][(_0x28df('0x74'))](_0x28df('0x75'),0x193);}_0x32909f=_0x29dac9;return db[_0x28df('0x76')][_0x28df('0x41')]({'raw':!![]});}return null;})[_0x28df('0x27')](function(_0x4559d7){if(_0x4559d7){_0x32b8e1=_[_0x28df('0x77')](_0x4559d7,'id');var _0x99f4d0;var _0x2d90d0=squel[_0x28df('0x78')]();_0x2d90d0[_0x28df('0x79')](_0x2ceae9['table']);for(var _0x446a49=0x0;_0x446a49<_0x32909f[_0x28df('0x37')];_0x446a49+=0x1){_0x99f4d0=_0x32909f[_0x446a49][_0x28df('0x7b')]?_0x32b8e1[_0x32909f[_0x446a49][_0x28df('0x7b')]]['metric']:_0x32909f[_0x446a49][_0x28df('0x6e')];_0x99f4d0=_0x32909f[_0x446a49][_0x28df('0x7d')]?_[_0x28df('0x7e')](_0x54b711[_0x32909f[_0x446a49][_0x28df('0x7d')]],'%s',_0x99f4d0):_0x99f4d0;_0x99f4d0=_0x32909f[_0x446a49]['format']?_['replace'](_0x412642[_0x32909f[_0x446a49][_0x28df('0x7f')]],'%s',_0x99f4d0):_0x99f4d0;if(_0x32909f[_0x446a49]['groupBy']){_0x2d90d0[_0x28df('0x6d')](_0x99f4d0);}_0x32909f[_0x446a49][_0x28df('0x80')]&&_0x2d90d0[_0x28df('0x3a')](_0x99f4d0,_0x32909f[_0x446a49]['orderBy']===_0x28df('0x81')?![]:!![]);_0x2d90d0[_0x28df('0x6e')](_0x99f4d0,_0x32909f[_0x446a49][_0x28df('0x82')]||_0x99f4d0);}if(_0x2ceae9[_0x28df('0x83')]){_0x2ceae9[_0x28df('0x83')]=JSON[_0x28df('0x93')](_0x2ceae9[_0x28df('0x83')]);for(var _0x428030=0x0;_0x428030<_0x2ceae9['joins'][_0x28df('0x37')];_0x428030+=0x1){if(_0x2ceae9['joins'][_0x428030][_0x28df('0x2f')]&&_[_0x28df('0x66')](_0xe552,_0x2ceae9[_0x28df('0x83')][_0x428030][_0x28df('0x2f')])&&_0x2ceae9['joins'][_0x428030][_0x28df('0x87')]&&_0x2ceae9['joins'][_0x428030][_0x28df('0x84')]&&_0x2ceae9['joins'][_0x428030][_0x28df('0x85')]){_0x2d90d0[_0x2ceae9['joins'][_0x428030][_0x28df('0x2f')]](_0x2ceae9['joins'][_0x428030][_0x28df('0x84')],null,util[_0x28df('0x7f')](_0x28df('0x86'),_0x2ceae9['table'],_0x2ceae9[_0x28df('0x83')][_0x428030]['parentKey'],_0x2ceae9[_0x28df('0x83')][_0x428030]['foreignTable'],_0x2ceae9[_0x28df('0x83')][_0x428030][_0x28df('0x85')]));}}}if(_0x2ceae9[_0x28df('0x88')]){_0x2ceae9[_0x28df('0x88')]=JSON[_0x28df('0x93')](_0x2ceae9[_0x28df('0x88')]);_0x2d90d0[_0x28df('0x3c')](_0xba2728(_0x2ceae9[_0x28df('0x88')][_0x28df('0x6d')]));}_0x218c71=_0x2d90d0[_0x28df('0x89')]();_0x2d90d0[_0x28df('0x1e')](_0x510e70);_0x2d90d0[_0x28df('0x20')](0x0);logger['debug'](_0x28df('0x8b'),_0x2d90d0['toString']());return dbH['sequelize'][_0x28df('0x31')](_0x2d90d0['toString'](),{'type':dbH[_0x28df('0x8c')][_0x28df('0x8d')][_0x28df('0x8e')]});}})[_0x28df('0x27')](function(){return{'sql':_0x218c71[_0x28df('0xa0')]()};})[_0x28df('0x27')](respondWithResult(_0x548575,null))[_0x28df('0x43')](handleError(_0x548575,null));}; \ No newline at end of file +var _0x7cbd=['generate','csv','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','savename','COUNT(*)','SELECT','run','runReport','AVG(%s)','groupBy','Limited\x20Query:','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','format','replace','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','keyBy','MetricId','metric','output','web','%s-%s.%s','randomstring'];(function(_0x5b1aed,_0x322c17){var _0x26add8=function(_0x58a9d7){while(--_0x58a9d7){_0x5b1aed['push'](_0x5b1aed['shift']());}};_0x26add8(++_0x322c17);}(_0x7cbd,0xb9));var _0xd7cb=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x7cbd[_0x173d7e];return _0x2220d6;};'use strict';var emlformat=require(_0xd7cb('0x0'));var rimraf=require(_0xd7cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd7cb('0x2'));var moment=require(_0xd7cb('0x3'));var BPromise=require(_0xd7cb('0x4'));var Mustache=require('mustache');var util=require(_0xd7cb('0x5'));var path=require(_0xd7cb('0x6'));var sox=require(_0xd7cb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7cb('0x8'));var squel=require(_0xd7cb('0x9'));var crypto=require(_0xd7cb('0xa'));var jsforce=require(_0xd7cb('0xb'));var deskjs=require(_0xd7cb('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd7cb('0xd'));var Papa=require(_0xd7cb('0xe'));var Redis=require(_0xd7cb('0xf'));var authService=require(_0xd7cb('0x10'));var qs=require(_0xd7cb('0x11'));var as=require(_0xd7cb('0x12'));var hardwareService=require(_0xd7cb('0x13'));var logger=require(_0xd7cb('0x14'))(_0xd7cb('0x15'));var utils=require(_0xd7cb('0x16'));var config=require(_0xd7cb('0x17'));var licenseUtil=require(_0xd7cb('0x18'));var db=require(_0xd7cb('0x19'))['db'];var dbH=require(_0xd7cb('0x19'))[_0xd7cb('0x1a')];function respondWithStatusCode(_0x166969,_0x243187){_0x243187=_0x243187||0xcc;return function(_0x293af2){if(_0x293af2){return _0x166969[_0xd7cb('0x1b')](_0x243187);}return _0x166969['status'](_0x243187)[_0xd7cb('0x1c')]();};}function respondWithResult(_0x2d86c8,_0x506981){_0x506981=_0x506981||0xc8;return function(_0x308185){if(_0x308185){return _0x2d86c8[_0xd7cb('0x1d')](_0x506981)[_0xd7cb('0x1e')](_0x308185);}};}function respondWithFilteredResult(_0x54b738,_0x34f217){return function(_0x3186a6){if(_0x3186a6){var _0x57af5b=typeof _0x34f217[_0xd7cb('0x1f')]===_0xd7cb('0x20')&&typeof _0x34f217[_0xd7cb('0x21')]==='undefined';var _0x4a026e=_0x3186a6[_0xd7cb('0x22')];var _0x23b582=_0x57af5b?0x0:_0x34f217['offset'];var _0x356327=_0x57af5b?_0x3186a6[_0xd7cb('0x22')]:_0x34f217[_0xd7cb('0x1f')]+_0x34f217['limit'];var _0x55f7f6;if(_0x356327>=_0x4a026e){_0x356327=_0x4a026e;_0x55f7f6=0xc8;}else{_0x55f7f6=0xce;}_0x54b738[_0xd7cb('0x1d')](_0x55f7f6);return _0x54b738[_0xd7cb('0x23')](_0xd7cb('0x24'),_0x23b582+'-'+_0x356327+'/'+_0x4a026e)[_0xd7cb('0x1e')](_0x3186a6);}return null;};}function patchUpdates(_0x1cb0cb){return function(_0x31b994){try{jsonpatch[_0xd7cb('0x25')](_0x31b994,_0x1cb0cb,!![]);}catch(_0x2a4e9f){return BPromise['reject'](_0x2a4e9f);}return _0x31b994[_0xd7cb('0x26')]();};}function saveUpdates(_0x4ac38c,_0x340817){return function(_0x3f2edf){if(_0x3f2edf){return _0x3f2edf[_0xd7cb('0x27')](_0x4ac38c)[_0xd7cb('0x28')](function(_0x255025){return _0x255025;});}return null;};}function removeEntity(_0x5b5c74,_0x200e39){return function(_0xab80a2){if(_0xab80a2){return _0xab80a2[_0xd7cb('0x29')]()[_0xd7cb('0x28')](function(){var _0x536d2d=_0xab80a2[_0xd7cb('0x2a')]({'plain':!![]});var _0x59e491=_0xd7cb('0x2b');return db[_0xd7cb('0x2c')][_0xd7cb('0x29')]({'where':{'type':_0x59e491,'resourceId':_0x536d2d['id']}})[_0xd7cb('0x28')](function(){return _0xab80a2;});})[_0xd7cb('0x28')](function(){_0x5b5c74['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x589eba,_0x4a7ae2){return function(_0x18cf55){if(!_0x18cf55){_0x589eba['sendStatus'](0x194);}return _0x18cf55;};}function handleError(_0x21a6f3,_0x49cbad){_0x49cbad=_0x49cbad||0x1f4;return function(_0x105787){logger[_0xd7cb('0x2d')](_0x105787[_0xd7cb('0x2e')]);if(_0x105787[_0xd7cb('0x2f')]){delete _0x105787[_0xd7cb('0x2f')];}_0x21a6f3[_0xd7cb('0x1d')](_0x49cbad)[_0xd7cb('0x30')](_0x105787);};}exports[_0xd7cb('0x31')]=function(_0x568833,_0x2ad5ab){var _0x2c9251={},_0x9cf5ed={},_0x13e90b={'count':0x0,'rows':[]};var _0x32bff5=_['map'](db[_0xd7cb('0x32')][_0xd7cb('0x33')],function(_0x120413){return{'name':_0x120413[_0xd7cb('0x34')],'type':_0x120413[_0xd7cb('0x35')][_0xd7cb('0x36')]};});_0x9cf5ed[_0xd7cb('0x37')]=_[_0xd7cb('0x38')](_0x32bff5,'name');_0x9cf5ed[_0xd7cb('0x39')]=_[_0xd7cb('0x3a')](_0x568833[_0xd7cb('0x39')]);_0x9cf5ed[_0xd7cb('0x3b')]=_[_0xd7cb('0x3c')](_0x9cf5ed[_0xd7cb('0x37')],_0x9cf5ed['query']);_0x2c9251['attributes']=_[_0xd7cb('0x3c')](_0x9cf5ed['model'],qs[_0xd7cb('0x3d')](_0x568833[_0xd7cb('0x39')]['fields']));_0x2c9251['attributes']=_0x2c9251['attributes']['length']?_0x2c9251[_0xd7cb('0x3e')]:_0x9cf5ed['model'];if(!_0x568833[_0xd7cb('0x39')][_0xd7cb('0x3f')](_0xd7cb('0x40'))){_0x2c9251['limit']=qs[_0xd7cb('0x21')](_0x568833[_0xd7cb('0x39')][_0xd7cb('0x21')]);_0x2c9251[_0xd7cb('0x1f')]=qs[_0xd7cb('0x1f')](_0x568833[_0xd7cb('0x39')][_0xd7cb('0x1f')]);}_0x2c9251[_0xd7cb('0x41')]=qs['sort'](_0x568833[_0xd7cb('0x39')][_0xd7cb('0x42')]);_0x2c9251[_0xd7cb('0x43')]=qs[_0xd7cb('0x3b')](_[_0xd7cb('0x44')](_0x568833[_0xd7cb('0x39')],_0x9cf5ed[_0xd7cb('0x3b')]),_0x32bff5);if(_0x568833[_0xd7cb('0x39')]['filter']){_0x2c9251['where']=_[_0xd7cb('0x45')](_0x2c9251[_0xd7cb('0x43')],{'$or':_['map'](_0x32bff5,function(_0xd9adaa){if(_0xd9adaa[_0xd7cb('0x35')]!==_0xd7cb('0x46')){var _0x30d665={};_0x30d665[_0xd9adaa['name']]={'$like':'%'+_0x568833[_0xd7cb('0x39')]['filter']+'%'};return _0x30d665;}})});}_0x2c9251=_['merge']({},_0x2c9251,_0x568833[_0xd7cb('0x47')]);var _0x4d7e7e={'where':_0x2c9251[_0xd7cb('0x43')]};return db[_0xd7cb('0x32')][_0xd7cb('0x22')](_0x4d7e7e)['then'](function(_0x232575){_0x13e90b[_0xd7cb('0x22')]=_0x232575;if(_0x568833['query'][_0xd7cb('0x48')]){_0x2c9251[_0xd7cb('0x49')]=[{'all':!![]}];}return db[_0xd7cb('0x32')][_0xd7cb('0x4a')](_0x2c9251);})['then'](function(_0x2631ca){_0x13e90b[_0xd7cb('0x4b')]=_0x2631ca;return _0x13e90b;})[_0xd7cb('0x28')](respondWithFilteredResult(_0x2ad5ab,_0x2c9251))[_0xd7cb('0x4c')](handleError(_0x2ad5ab,null));};exports[_0xd7cb('0x4d')]=function(_0x2df494,_0x44718b){var _0x20250e={'raw':![],'where':{'id':_0x2df494[_0xd7cb('0x4e')]['id']}},_0x5bb271={};_0x5bb271[_0xd7cb('0x37')]=_['keys'](db[_0xd7cb('0x32')][_0xd7cb('0x33')]);_0x5bb271[_0xd7cb('0x39')]=_[_0xd7cb('0x3a')](_0x2df494[_0xd7cb('0x39')]);_0x5bb271['filters']=_[_0xd7cb('0x3c')](_0x5bb271[_0xd7cb('0x37')],_0x5bb271[_0xd7cb('0x39')]);_0x20250e[_0xd7cb('0x3e')]=_[_0xd7cb('0x3c')](_0x5bb271['model'],qs[_0xd7cb('0x3d')](_0x2df494[_0xd7cb('0x39')][_0xd7cb('0x3d')]));_0x20250e[_0xd7cb('0x3e')]=_0x20250e[_0xd7cb('0x3e')][_0xd7cb('0x4f')]?_0x20250e['attributes']:_0x5bb271[_0xd7cb('0x37')];if(_0x2df494[_0xd7cb('0x39')]['includeAll']){_0x20250e[_0xd7cb('0x49')]=[{'all':!![]}];}_0x20250e=_['merge']({},_0x20250e,_0x2df494['options']);return db[_0xd7cb('0x32')][_0xd7cb('0x50')](_0x20250e)[_0xd7cb('0x28')](handleEntityNotFound(_0x44718b,null))[_0xd7cb('0x28')](respondWithResult(_0x44718b,null))[_0xd7cb('0x4c')](handleError(_0x44718b,null));};exports[_0xd7cb('0x51')]=function(_0x50fbdd,_0x28e6ca){return db[_0xd7cb('0x32')][_0xd7cb('0x51')](_0x50fbdd[_0xd7cb('0x52')],{})[_0xd7cb('0x28')](function(_0x264f3d){var _0x56044c=_0x50fbdd[_0xd7cb('0x53')]['get']({'plain':!![]});if(!_0x56044c)throw new Error(_0xd7cb('0x54'));if(_0x56044c[_0xd7cb('0x55')]===_0xd7cb('0x53')){var _0x1375b9=_0x264f3d[_0xd7cb('0x2a')]({'plain':!![]});var _0x3df897=_0xd7cb('0x56');return db['UserProfileSection']['find']({'where':{'name':_0x3df897,'userProfileId':_0x56044c[_0xd7cb('0x57')]},'raw':!![]})[_0xd7cb('0x28')](function(_0x6f0d9f){if(_0x6f0d9f&&_0x6f0d9f[_0xd7cb('0x58')]===0x0){return db[_0xd7cb('0x2c')][_0xd7cb('0x51')]({'name':_0x1375b9[_0xd7cb('0x2f')],'resourceId':_0x1375b9['id'],'type':_0xd7cb('0x2b'),'sectionId':_0x6f0d9f['id']},{})[_0xd7cb('0x28')](function(){return _0x264f3d;});}else{return _0x264f3d;}})[_0xd7cb('0x4c')](function(_0x1ecfc2){logger[_0xd7cb('0x2d')](_0xd7cb('0x59'),_0x1ecfc2);throw _0x1ecfc2;});}return _0x264f3d;})[_0xd7cb('0x28')](respondWithResult(_0x28e6ca,0xc9))['catch'](handleError(_0x28e6ca,null));};exports[_0xd7cb('0x27')]=function(_0x161542,_0x4c1c98){if(_0x161542['body']['id']){delete _0x161542[_0xd7cb('0x52')]['id'];}return db[_0xd7cb('0x32')][_0xd7cb('0x50')]({'where':{'id':_0x161542['params']['id']}})[_0xd7cb('0x28')](handleEntityNotFound(_0x4c1c98,null))[_0xd7cb('0x28')](saveUpdates(_0x161542[_0xd7cb('0x52')],null))[_0xd7cb('0x28')](respondWithResult(_0x4c1c98,null))['catch'](handleError(_0x4c1c98,null));};exports['destroy']=function(_0x575953,_0x40873b){return db[_0xd7cb('0x32')][_0xd7cb('0x50')]({'where':{'id':_0x575953[_0xd7cb('0x4e')]['id']}})[_0xd7cb('0x28')](handleEntityNotFound(_0x40873b,null))[_0xd7cb('0x28')](removeEntity(_0x40873b,null))['catch'](handleError(_0x40873b,null));};exports[_0xd7cb('0x5a')]=function(_0x46d01d,_0xc5ef31){var _0x1720e3=0xa;var _0x539f4c=[_0xd7cb('0x5b'),_0xd7cb('0x5c'),'right_join',_0xd7cb('0x5d')];var _0x241b38={'SUM':'SUM(%s)','COUNT':_0xd7cb('0x5e'),'COUNT DISTINCT':_0xd7cb('0x5f'),'MAX':_0xd7cb('0x60'),'MIN':_0xd7cb('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd7cb('0x62'),'GROUP_CONCAT ASC':_0xd7cb('0x63'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3ffb79={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd7cb('0x64'),'HOUR':_0xd7cb('0x65'),'ROUND':_0xd7cb('0x66'),'UNIX_TIMESTAMP':_0xd7cb('0x67')};var _0xd91467=function(_0x29ee06){return!_[_0xd7cb('0x68')]([_0xd7cb('0x69'),_0xd7cb('0x6a'),_0xd7cb('0x6b'),_0xd7cb('0x6c')],_0x29ee06);};var _0x13d0a0=function(_0x56d03f){if(!_0x56d03f||!_0x56d03f['rules'][_0xd7cb('0x4f')]){return'';}for(var _0x4b2bf5='(',_0x52ffe6=0x0;_0x52ffe6<_0x56d03f['rules'][_0xd7cb('0x4f')];_0x52ffe6+=0x1){_0x52ffe6>0x0&&(_0x4b2bf5+='\x20'+_0x56d03f[_0xd7cb('0x6d')]+'\x20');_0x4b2bf5+=_0x56d03f[_0xd7cb('0x6e')][_0x52ffe6][_0xd7cb('0x6f')]?_0x13d0a0(_0x56d03f[_0xd7cb('0x6e')][_0x52ffe6]['group']):_0x56d03f[_0xd7cb('0x6e')][_0x52ffe6][_0xd7cb('0x70')]+'\x20'+_0x56d03f[_0xd7cb('0x6e')][_0x52ffe6][_0xd7cb('0x71')]+(_0xd91467(_0x56d03f[_0xd7cb('0x6e')][_0x52ffe6][_0xd7cb('0x71')])?'\x20'+_0x56d03f[_0xd7cb('0x6e')][_0x52ffe6][_0xd7cb('0x72')]:'');}return _0x4b2bf5+')';};var _0x231b50={'where':{'id':_0x46d01d[_0xd7cb('0x4e')]['id']}},_0x256302,_0x45a8c8,_0x3da9ba,_0x589685,_0x2ae544;_0x231b50=_[_0xd7cb('0x45')]({},_0x231b50,_0x46d01d[_0xd7cb('0x47')]);return db[_0xd7cb('0x32')][_0xd7cb('0x50')](_0x231b50)['then'](function(_0x27b4b2){if(_0x27b4b2){_0x256302=_0x27b4b2;return _0x27b4b2[_0xd7cb('0x73')]();}return null;})[_0xd7cb('0x28')](function(_0x12f9f1){if(_0x12f9f1){if(!_0x12f9f1[_0xd7cb('0x4f')]){throw new db[(_0xd7cb('0x74'))][(_0xd7cb('0x75'))](_0xd7cb('0x76'),0x193);}_0x45a8c8=_0x12f9f1;return db[_0xd7cb('0x77')][_0xd7cb('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x10b602){if(_0x10b602){_0x3da9ba=_['keyBy'](_0x10b602,'id');var _0x30d36d;var _0x3b7c12=squel[_0xd7cb('0x78')]();_0x3b7c12[_0xd7cb('0x79')](_0x256302[_0xd7cb('0x7a')]);for(var _0x235dfa=0x0;_0x235dfa<_0x45a8c8['length'];_0x235dfa+=0x1){_0x30d36d=_0x45a8c8[_0x235dfa]['MetricId']?_0x3da9ba[_0x45a8c8[_0x235dfa]['MetricId']]['metric']:_0x45a8c8[_0x235dfa][_0xd7cb('0x70')];_0x30d36d=_0x45a8c8[_0x235dfa][_0xd7cb('0x7b')]?_['replace'](_0x241b38[_0x45a8c8[_0x235dfa][_0xd7cb('0x7b')]],'%s',_0x30d36d):_0x30d36d;_0x30d36d=_0x45a8c8[_0x235dfa][_0xd7cb('0x7c')]?_[_0xd7cb('0x7d')](_0x3ffb79[_0x45a8c8[_0x235dfa][_0xd7cb('0x7c')]],'%s',_0x30d36d):_0x30d36d;if(_0x45a8c8[_0x235dfa]['groupBy']){_0x3b7c12['group'](_0x30d36d);}_0x45a8c8[_0x235dfa][_0xd7cb('0x7e')]&&_0x3b7c12['order'](_0x30d36d,_0x45a8c8[_0x235dfa][_0xd7cb('0x7e')]===_0xd7cb('0x7f')?![]:!![]);_0x3b7c12[_0xd7cb('0x70')](_0x30d36d,_0x45a8c8[_0x235dfa][_0xd7cb('0x80')]||_0x30d36d);}if(_0x256302[_0xd7cb('0x81')]){_0x256302[_0xd7cb('0x81')]=JSON[_0xd7cb('0x82')](_0x256302[_0xd7cb('0x81')]);for(var _0x509d52=0x0;_0x509d52<_0x256302[_0xd7cb('0x81')]['length'];_0x509d52+=0x1){if(_0x256302['joins'][_0x509d52][_0xd7cb('0x35')]&&_['includes'](_0x539f4c,_0x256302[_0xd7cb('0x81')][_0x509d52]['type'])&&_0x256302[_0xd7cb('0x81')][_0x509d52][_0xd7cb('0x83')]&&_0x256302['joins'][_0x509d52][_0xd7cb('0x84')]&&_0x256302[_0xd7cb('0x81')][_0x509d52][_0xd7cb('0x85')]){_0x3b7c12[_0x256302[_0xd7cb('0x81')][_0x509d52][_0xd7cb('0x35')]](_0x256302[_0xd7cb('0x81')][_0x509d52][_0xd7cb('0x84')],null,util['format'](_0xd7cb('0x86'),_0x256302[_0xd7cb('0x7a')],_0x256302['joins'][_0x509d52][_0xd7cb('0x83')],_0x256302[_0xd7cb('0x81')][_0x509d52][_0xd7cb('0x84')],_0x256302['joins'][_0x509d52][_0xd7cb('0x85')]));}}}if(_0x256302[_0xd7cb('0x87')]){_0x256302[_0xd7cb('0x87')]=JSON[_0xd7cb('0x82')](_0x256302[_0xd7cb('0x87')]);_0x3b7c12[_0xd7cb('0x43')](_0x13d0a0(_0x256302[_0xd7cb('0x87')][_0xd7cb('0x6f')]));}_0x2ae544=_0x3b7c12[_0xd7cb('0x88')]();_0x3b7c12[_0xd7cb('0x21')](_0x1720e3);_0x3b7c12['offset'](0x0);logger[_0xd7cb('0x89')]('Limited\x20Query:',_0x3b7c12['toString']());return dbH[_0xd7cb('0x8a')][_0xd7cb('0x39')](_0x3b7c12[_0xd7cb('0x8b')](),{'type':dbH['sequelize'][_0xd7cb('0x8c')]['SELECT']});}})['then'](respondWithResult(_0xc5ef31,null))['catch'](handleError(_0xc5ef31,null));};function runReport(_0x51aea9,_0x17fc1f,_0xa3467f){var _0x23f0b7=_0x17fc1f[_0xd7cb('0x2f')];var _0x6aa708=0xa;var _0x18303f=[_0xd7cb('0x5b'),_0xd7cb('0x5c'),_0xd7cb('0x8d'),'cross_join'];var _0xe1fb36={'SUM':_0xd7cb('0x8e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd7cb('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd7cb('0x62'),'GROUP_CONCAT ASC':_0xd7cb('0x63'),'GROUP_CONCAT DESC':_0xd7cb('0x8f')};var _0xb28ed9={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xd7cb('0x65'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4b6c9b=function(_0x421701){return!_[_0xd7cb('0x68')](['IS\x20NULL',_0xd7cb('0x6a'),_0xd7cb('0x6b'),_0xd7cb('0x6c')],_0x421701);};var _0x79fe2e=function(_0x8f0933){if(!_0x8f0933||!_0x8f0933[_0xd7cb('0x6e')]['length']){return'';}for(var _0x29405d='(',_0x165bf1=0x0;_0x165bf1<_0x8f0933['rules'][_0xd7cb('0x4f')];_0x165bf1+=0x1){_0x165bf1>0x0&&(_0x29405d+='\x20'+_0x8f0933[_0xd7cb('0x6d')]+'\x20');_0x29405d+=_0x8f0933[_0xd7cb('0x6e')][_0x165bf1][_0xd7cb('0x6f')]?_0x79fe2e(_0x8f0933[_0xd7cb('0x6e')][_0x165bf1][_0xd7cb('0x6f')]):_0x8f0933[_0xd7cb('0x6e')][_0x165bf1][_0xd7cb('0x70')]+'\x20'+_0x8f0933['rules'][_0x165bf1][_0xd7cb('0x71')]+(_0x4b6c9b(_0x8f0933[_0xd7cb('0x6e')][_0x165bf1]['condition'])?'\x20'+_0x8f0933[_0xd7cb('0x6e')][_0x165bf1]['value']:'');}return _0x29405d+')';};var _0x1845af={'where':{'id':_0x51aea9['id']}},_0x14a00b,_0x2674a0,_0x524756,_0x368940,_0x9dd168;_0x1845af=_[_0xd7cb('0x45')]({},_0x1845af,_0xa3467f);return db['AnalyticCustomReport'][_0xd7cb('0x50')](_0x1845af)['then'](function(_0x17f6eb){if(_0x17f6eb){_0x14a00b=_0x17f6eb;return _0x17f6eb[_0xd7cb('0x73')]();}return null;})[_0xd7cb('0x28')](function(_0xe87b58){if(_0xe87b58){if(!_0xe87b58['length']){throw new db[(_0xd7cb('0x74'))][(_0xd7cb('0x75'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2674a0=_0xe87b58;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd7cb('0x28')](function(_0x513893){if(_0x513893){_0x524756=_[_0xd7cb('0x90')](_0x513893,'id');var _0x1a7cbb;var _0x3a4ace=squel[_0xd7cb('0x78')]();_0x3a4ace[_0xd7cb('0x79')](_0x14a00b[_0xd7cb('0x7a')]);for(var _0x498654=0x0;_0x498654<_0x2674a0[_0xd7cb('0x4f')];_0x498654+=0x1){_0x1a7cbb=_0x2674a0[_0x498654][_0xd7cb('0x91')]?_0x524756[_0x2674a0[_0x498654]['MetricId']][_0xd7cb('0x92')]:_0x2674a0[_0x498654][_0xd7cb('0x70')];_0x1a7cbb=_0x2674a0[_0x498654]['function']?_[_0xd7cb('0x7d')](_0xe1fb36[_0x2674a0[_0x498654][_0xd7cb('0x7b')]],'%s',_0x1a7cbb):_0x1a7cbb;_0x1a7cbb=_0x2674a0[_0x498654]['format']?_[_0xd7cb('0x7d')](_0xb28ed9[_0x2674a0[_0x498654][_0xd7cb('0x7c')]],'%s',_0x1a7cbb):_0x1a7cbb;if(_0x2674a0[_0x498654]['groupBy']){_0x3a4ace['group'](_0x1a7cbb);}_0x2674a0[_0x498654][_0xd7cb('0x7e')]&&_0x3a4ace[_0xd7cb('0x41')](_0x1a7cbb,_0x2674a0[_0x498654][_0xd7cb('0x7e')]===_0xd7cb('0x7f')?![]:!![]);_0x3a4ace[_0xd7cb('0x70')](_0x1a7cbb,_0x2674a0[_0x498654][_0xd7cb('0x80')]||_0x1a7cbb);}if(_0x14a00b[_0xd7cb('0x81')]){_0x14a00b[_0xd7cb('0x81')]=JSON[_0xd7cb('0x82')](_0x14a00b[_0xd7cb('0x81')]);for(var _0x49b382=0x0;_0x49b382<_0x14a00b[_0xd7cb('0x81')][_0xd7cb('0x4f')];_0x49b382+=0x1){if(_0x14a00b[_0xd7cb('0x81')][_0x49b382][_0xd7cb('0x35')]&&_[_0xd7cb('0x68')](_0x18303f,_0x14a00b['joins'][_0x49b382][_0xd7cb('0x35')])&&_0x14a00b[_0xd7cb('0x81')][_0x49b382]['parentKey']&&_0x14a00b[_0xd7cb('0x81')][_0x49b382]['foreignTable']&&_0x14a00b[_0xd7cb('0x81')][_0x49b382][_0xd7cb('0x85')]){_0x3a4ace[_0x14a00b[_0xd7cb('0x81')][_0x49b382][_0xd7cb('0x35')]](_0x14a00b[_0xd7cb('0x81')][_0x49b382][_0xd7cb('0x84')],null,util['format'](_0xd7cb('0x86'),_0x14a00b[_0xd7cb('0x7a')],_0x14a00b[_0xd7cb('0x81')][_0x49b382][_0xd7cb('0x83')],_0x14a00b['joins'][_0x49b382]['foreignTable'],_0x14a00b['joins'][_0x49b382][_0xd7cb('0x85')]));}}}if(_0x14a00b[_0xd7cb('0x87')]){_0x14a00b[_0xd7cb('0x87')]=JSON[_0xd7cb('0x82')](_0x14a00b[_0xd7cb('0x87')]);_0x3a4ace[_0xd7cb('0x43')](_0x79fe2e(_0x14a00b[_0xd7cb('0x87')][_0xd7cb('0x6f')]));}_0x9dd168=_0x3a4ace[_0xd7cb('0x88')]();_0x3a4ace[_0xd7cb('0x21')](_0x6aa708);_0x3a4ace[_0xd7cb('0x1f')](0x0);return;}})[_0xd7cb('0x28')](function(){if(_0x17fc1f[_0xd7cb('0x93')]===_0xd7cb('0x94')){return null;}var _0x38a1ff=_[_0xd7cb('0x45')](_0x17fc1f,{'name':_0x17fc1f['fullPath']||_0x17fc1f[_0xd7cb('0x2f')]||_0x14a00b[_0xd7cb('0x2f')],'basename':_0x23f0b7,'savename':util[_0xd7cb('0x7c')](_0xd7cb('0x95'),_0x17fc1f[_0xd7cb('0x2f')]||_0x14a00b['name'],require(_0xd7cb('0x96'))[_0xd7cb('0x97')](0x4),_0x17fc1f[_0xd7cb('0x93')]||_0xd7cb('0x98')),'reportId':_0x14a00b['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xd7cb('0x51')](_0x38a1ff,{'raw':!![]});})[_0xd7cb('0x28')](function(_0x31f1cd){if(_0x14a00b[_0xd7cb('0x7a')]===_0xd7cb('0x99')){_0x9dd168['where'](_0x14a00b[_0xd7cb('0x7a')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x17fc1f['startDate'],_0x17fc1f[_0xd7cb('0x9a')]);}else{_0x9dd168[_0xd7cb('0x43')](_0x14a00b[_0xd7cb('0x7a')]+_0xd7cb('0x9b'),_0x17fc1f['startDate'],_0x17fc1f[_0xd7cb('0x9a')]);}if(_0x31f1cd){logger['info'](_0xd7cb('0x9c'),_0x9dd168[_0xd7cb('0x8b')]());require(_0xd7cb('0x9d'))[_0xd7cb('0x9e')](path[_0xd7cb('0x5b')](__dirname,_0xd7cb('0x9f'),_0x31f1cd[_0xd7cb('0x93')]),[_0x31f1cd['id'],_0x9dd168[_0xd7cb('0x8b')](),path[_0xd7cb('0x5b')](__dirname,'../../files/reports',_0x31f1cd[_0xd7cb('0xa0')]),_0x23f0b7]);return _0x31f1cd;}else{var _0x13bea6=squel['select']();_0x13bea6[_0xd7cb('0x79')]('('+_0x9dd168[_0xd7cb('0x8b')]()+')','countTable');_0x13bea6['field'](_0xd7cb('0xa1'),_0xd7cb('0x22'));_0x9dd168['limit'](_0x17fc1f[_0xd7cb('0x21')]||_0x6aa708);_0x9dd168[_0xd7cb('0x1f')](_0x17fc1f[_0xd7cb('0x1f')]||0x0);return dbH['sequelize'][_0xd7cb('0x39')](_0x13bea6['toString'](),{'type':dbH[_0xd7cb('0x8a')][_0xd7cb('0x8c')][_0xd7cb('0xa2')]})[_0xd7cb('0x28')](function(_0x464dd2){if(!_0x464dd2[_0xd7cb('0x4f')]){_0x368940=0x0;}else{_0x368940=_0x464dd2[0x0][_0xd7cb('0x22')]||0x0;}return dbH['sequelize'][_0xd7cb('0x39')](_0x9dd168[_0xd7cb('0x8b')](),{'type':dbH[_0xd7cb('0x8a')][_0xd7cb('0x8c')][_0xd7cb('0xa2')]});})[_0xd7cb('0x28')](function(_0x45f19e){return{'rows':_0x45f19e||[],'count':_0x368940};});}});}exports[_0xd7cb('0xa3')]=function(_0xb76cd0,_0x239193){return runReport(_0xb76cd0[_0xd7cb('0x4e')],_0xb76cd0['query'],_0xb76cd0[_0xd7cb('0x47')])[_0xd7cb('0x28')](respondWithResult(_0x239193,null))['catch'](handleError(_0x239193,null));};exports[_0xd7cb('0xa4')]=runReport;exports[_0xd7cb('0x39')]=function(_0x58a8fa,_0x4303ef){var _0x59e857=0xa;var _0x43c806=[_0xd7cb('0x5b'),_0xd7cb('0x5c'),_0xd7cb('0x8d'),_0xd7cb('0x5d')];var _0x348e34={'SUM':_0xd7cb('0x8e'),'COUNT':_0xd7cb('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xd7cb('0x61'),'AVG':_0xd7cb('0xa5'),'GROUP_CONCAT':_0xd7cb('0x62'),'GROUP_CONCAT ASC':_0xd7cb('0x63'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x11f4ea={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd7cb('0x64'),'HOUR':_0xd7cb('0x65'),'ROUND':_0xd7cb('0x66'),'UNIX_TIMESTAMP':_0xd7cb('0x67')};var _0x21ecc2=function(_0x3c4e6c){return!_[_0xd7cb('0x68')]([_0xd7cb('0x69'),_0xd7cb('0x6a'),_0xd7cb('0x6b'),_0xd7cb('0x6c')],_0x3c4e6c);};var _0x4d8313=function(_0x9cebba){if(!_0x9cebba||!_0x9cebba[_0xd7cb('0x6e')][_0xd7cb('0x4f')]){return'';}for(var _0x4e8919='(',_0x3debdb=0x0;_0x3debdb<_0x9cebba['rules'][_0xd7cb('0x4f')];_0x3debdb+=0x1){_0x3debdb>0x0&&(_0x4e8919+='\x20'+_0x9cebba['operator']+'\x20');_0x4e8919+=_0x9cebba[_0xd7cb('0x6e')][_0x3debdb][_0xd7cb('0x6f')]?_0x4d8313(_0x9cebba['rules'][_0x3debdb]['group']):_0x9cebba[_0xd7cb('0x6e')][_0x3debdb][_0xd7cb('0x70')]+'\x20'+_0x9cebba[_0xd7cb('0x6e')][_0x3debdb][_0xd7cb('0x71')]+(_0x21ecc2(_0x9cebba[_0xd7cb('0x6e')][_0x3debdb]['condition'])?'\x20'+_0x9cebba[_0xd7cb('0x6e')][_0x3debdb][_0xd7cb('0x72')]:'');}return _0x4e8919+')';};var _0x566c78={'where':{'id':_0x58a8fa['params']['id']}},_0x396004,_0x3a0145,_0x184d50,_0x350621,_0x2f9d72;_0x566c78=_[_0xd7cb('0x45')]({},_0x566c78,_0x58a8fa['options']);return db[_0xd7cb('0x32')][_0xd7cb('0x50')](_0x566c78)[_0xd7cb('0x28')](function(_0x525de9){if(_0x525de9){_0x396004=_0x525de9;return _0x525de9[_0xd7cb('0x73')]();}return null;})[_0xd7cb('0x28')](function(_0x5d8eed){if(_0x5d8eed){if(!_0x5d8eed[_0xd7cb('0x4f')]){throw new db[(_0xd7cb('0x74'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3a0145=_0x5d8eed;return db['AnalyticMetric'][_0xd7cb('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x5ad13d){if(_0x5ad13d){_0x184d50=_[_0xd7cb('0x90')](_0x5ad13d,'id');var _0x2235cc;var _0x3a7ccc=squel[_0xd7cb('0x78')]();_0x3a7ccc[_0xd7cb('0x79')](_0x396004[_0xd7cb('0x7a')]);for(var _0x2a24be=0x0;_0x2a24be<_0x3a0145[_0xd7cb('0x4f')];_0x2a24be+=0x1){_0x2235cc=_0x3a0145[_0x2a24be][_0xd7cb('0x91')]?_0x184d50[_0x3a0145[_0x2a24be][_0xd7cb('0x91')]][_0xd7cb('0x92')]:_0x3a0145[_0x2a24be][_0xd7cb('0x70')];_0x2235cc=_0x3a0145[_0x2a24be][_0xd7cb('0x7b')]?_[_0xd7cb('0x7d')](_0x348e34[_0x3a0145[_0x2a24be][_0xd7cb('0x7b')]],'%s',_0x2235cc):_0x2235cc;_0x2235cc=_0x3a0145[_0x2a24be]['format']?_['replace'](_0x11f4ea[_0x3a0145[_0x2a24be][_0xd7cb('0x7c')]],'%s',_0x2235cc):_0x2235cc;if(_0x3a0145[_0x2a24be][_0xd7cb('0xa6')]){_0x3a7ccc[_0xd7cb('0x6f')](_0x2235cc);}_0x3a0145[_0x2a24be][_0xd7cb('0x7e')]&&_0x3a7ccc['order'](_0x2235cc,_0x3a0145[_0x2a24be]['orderBy']===_0xd7cb('0x7f')?![]:!![]);_0x3a7ccc[_0xd7cb('0x70')](_0x2235cc,_0x3a0145[_0x2a24be][_0xd7cb('0x80')]||_0x2235cc);}if(_0x396004[_0xd7cb('0x81')]){_0x396004[_0xd7cb('0x81')]=JSON[_0xd7cb('0x82')](_0x396004[_0xd7cb('0x81')]);for(var _0x3dd5e0=0x0;_0x3dd5e0<_0x396004[_0xd7cb('0x81')][_0xd7cb('0x4f')];_0x3dd5e0+=0x1){if(_0x396004[_0xd7cb('0x81')][_0x3dd5e0]['type']&&_[_0xd7cb('0x68')](_0x43c806,_0x396004[_0xd7cb('0x81')][_0x3dd5e0][_0xd7cb('0x35')])&&_0x396004['joins'][_0x3dd5e0]['parentKey']&&_0x396004[_0xd7cb('0x81')][_0x3dd5e0]['foreignTable']&&_0x396004[_0xd7cb('0x81')][_0x3dd5e0][_0xd7cb('0x85')]){_0x3a7ccc[_0x396004[_0xd7cb('0x81')][_0x3dd5e0][_0xd7cb('0x35')]](_0x396004[_0xd7cb('0x81')][_0x3dd5e0][_0xd7cb('0x84')],null,util[_0xd7cb('0x7c')](_0xd7cb('0x86'),_0x396004[_0xd7cb('0x7a')],_0x396004['joins'][_0x3dd5e0]['parentKey'],_0x396004[_0xd7cb('0x81')][_0x3dd5e0]['foreignTable'],_0x396004[_0xd7cb('0x81')][_0x3dd5e0][_0xd7cb('0x85')]));}}}if(_0x396004[_0xd7cb('0x87')]){_0x396004[_0xd7cb('0x87')]=JSON[_0xd7cb('0x82')](_0x396004['conditions']);_0x3a7ccc['where'](_0x4d8313(_0x396004[_0xd7cb('0x87')][_0xd7cb('0x6f')]));}_0x2f9d72=_0x3a7ccc[_0xd7cb('0x88')]();_0x3a7ccc[_0xd7cb('0x21')](_0x59e857);_0x3a7ccc['offset'](0x0);logger['debug'](_0xd7cb('0xa7'),_0x3a7ccc[_0xd7cb('0x8b')]());return dbH['sequelize']['query'](_0x3a7ccc[_0xd7cb('0x8b')](),{'type':dbH[_0xd7cb('0x8a')]['QueryTypes'][_0xd7cb('0xa2')]});}})[_0xd7cb('0x28')](function(){return{'sql':_0x2f9d72[_0xd7cb('0x8b')]()};})['then'](respondWithResult(_0x4303ef,null))[_0xd7cb('0x4c')](handleError(_0x4303ef,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index c693945..d9bd9d9 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 _0xba89=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment','request-promise'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xba89,0x193));var _0x9ba8=function(_0x3f017a,_0x24ba1f){_0x3f017a=_0x3f017a-0x0;var _0x172281=_0xba89[_0x3f017a];return _0x172281;};'use strict';var _=require(_0x9ba8('0x0'));var util=require(_0x9ba8('0x1'));var logger=require('../../config/logger')(_0x9ba8('0x2'));var moment=require(_0x9ba8('0x3'));var BPromise=require('bluebird');var rp=require(_0x9ba8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ba8('0x5'));var config=require(_0x9ba8('0x6'));var attributes=require(_0x9ba8('0x7'));module[_0x9ba8('0x8')]=function(_0x97113f,_0x35950b){return _0x97113f[_0x9ba8('0x9')](_0x9ba8('0xa'),attributes,{'tableName':_0x9ba8('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0071=['exports','define','AnalyticCustomReport','analytics_custom_reports','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x3041dc,_0x17d011){var _0x38fd56=function(_0x591601){while(--_0x591601){_0x3041dc['push'](_0x3041dc['shift']());}};_0x38fd56(++_0x17d011);}(_0x0071,0x117));var _0x1007=function(_0x26679e,_0x508e1c){_0x26679e=_0x26679e-0x0;var _0x18c847=_0x0071[_0x26679e];return _0x18c847;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1007('0x0'))(_0x1007('0x1'));var moment=require('moment');var BPromise=require(_0x1007('0x2'));var rp=require(_0x1007('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1007('0x4'));var config=require(_0x1007('0x5'));var attributes=require(_0x1007('0x6'));module[_0x1007('0x7')]=function(_0x191b7b,_0x567754){return _0x191b7b[_0x1007('0x8')](_0x1007('0x9'),attributes,{'tableName':_0x1007('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 96250fd..04fbac1 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 _0xa45b=['http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa45b,0x19d));var _0xba45=function(_0x37de20,_0x742c09){_0x37de20=_0x37de20-0x0;var _0xa5b52e=_0xa45b[_0x37de20];return _0xa5b52e;};'use strict';var _=require(_0xba45('0x0'));var util=require(_0xba45('0x1'));var moment=require(_0xba45('0x2'));var BPromise=require(_0xba45('0x3'));var rs=require(_0xba45('0x4'));var fs=require('fs');var Redis=require(_0xba45('0x5'));var db=require(_0xba45('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xba45('0x7'))(_0xba45('0x8'));var config=require(_0xba45('0x9'));var jayson=require(_0xba45('0xa'));var client=jayson[_0xba45('0xb')][_0xba45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb3fac4,_0x3c9ed3,_0x1a9974){return new BPromise(function(_0x352984,_0x1b7936){return client[_0xba45('0xd')](_0xb3fac4,_0x1a9974)[_0xba45('0xe')](function(_0x3594ef){logger[_0xba45('0xf')](_0xba45('0x10'),_0x3c9ed3,_0xba45('0x11'));logger[_0xba45('0x12')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3c9ed3,_0xba45('0x11'),JSON[_0xba45('0x13')](_0x3594ef));if(_0x3594ef[_0xba45('0x14')]){if(_0x3594ef['error'][_0xba45('0x15')]===0x1f4){logger[_0xba45('0x14')](_0xba45('0x10'),_0x3c9ed3,_0x3594ef[_0xba45('0x14')]['message']);return _0x1b7936(_0x3594ef[_0xba45('0x14')][_0xba45('0x16')]);}logger['error'](_0xba45('0x10'),_0x3c9ed3,_0x3594ef[_0xba45('0x14')][_0xba45('0x16')]);return _0x352984(_0x3594ef[_0xba45('0x14')]['message']);}else{logger[_0xba45('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3c9ed3,_0xba45('0x11'));_0x352984(_0x3594ef[_0xba45('0x17')][_0xba45('0x16')]);}})[_0xba45('0x18')](function(_0x516c16){logger[_0xba45('0x14')](_0xba45('0x10'),_0x3c9ed3,_0x516c16);_0x1b7936(_0x516c16);});});} \ No newline at end of file +var _0x7bc2=['jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0x7bc2,0xad));var _0x27bc=function(_0x135898,_0xccb464){_0x135898=_0x135898-0x0;var _0x27368e=_0x7bc2[_0x135898];return _0x27368e;};'use strict';var _=require(_0x27bc('0x0'));var util=require(_0x27bc('0x1'));var moment=require(_0x27bc('0x2'));var BPromise=require(_0x27bc('0x3'));var rs=require(_0x27bc('0x4'));var fs=require('fs');var Redis=require(_0x27bc('0x5'));var db=require(_0x27bc('0x6'))['db'];var utils=require(_0x27bc('0x7'));var logger=require(_0x27bc('0x8'))(_0x27bc('0x9'));var config=require(_0x27bc('0xa'));var jayson=require(_0x27bc('0xb'));var client=jayson['client'][_0x27bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c1329,_0x1ddd7e,_0x42dd23){return new BPromise(function(_0x5c4190,_0x46b10c){return client[_0x27bc('0xd')](_0x4c1329,_0x42dd23)[_0x27bc('0xe')](function(_0x3ef077){logger[_0x27bc('0xf')](_0x27bc('0x10'),_0x1ddd7e,_0x27bc('0x11'));logger[_0x27bc('0x12')](_0x27bc('0x13'),_0x1ddd7e,'request\x20sent',JSON[_0x27bc('0x14')](_0x3ef077));if(_0x3ef077[_0x27bc('0x15')]){if(_0x3ef077['error']['code']===0x1f4){logger[_0x27bc('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1ddd7e,_0x3ef077[_0x27bc('0x15')][_0x27bc('0x16')]);return _0x46b10c(_0x3ef077[_0x27bc('0x15')][_0x27bc('0x16')]);}logger[_0x27bc('0x15')](_0x27bc('0x10'),_0x1ddd7e,_0x3ef077[_0x27bc('0x15')][_0x27bc('0x16')]);return _0x5c4190(_0x3ef077[_0x27bc('0x15')][_0x27bc('0x16')]);}else{logger['info'](_0x27bc('0x10'),_0x1ddd7e,'request\x20sent');_0x5c4190(_0x3ef077['result']['message']);}})['catch'](function(_0x2b52b1){logger[_0x27bc('0x15')](_0x27bc('0x10'),_0x1ddd7e,_0x2b52b1);_0x46b10c(_0x2b52b1);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index c952df5..ca19c10 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 _0xd37c=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','run','post','create','put','destroy','multer','util'];(function(_0x46bc12,_0x5e2b34){var _0x44e497=function(_0x335051){while(--_0x335051){_0x46bc12['push'](_0x46bc12['shift']());}};_0x44e497(++_0x5e2b34);}(_0xd37c,0x1e1));var _0xcd37=function(_0x4fd40a,_0xa699ab){_0x4fd40a=_0x4fd40a-0x0;var _0x586cc6=_0xd37c[_0x4fd40a];return _0x586cc6;};'use strict';var multer=require(_0xcd37('0x0'));var util=require(_0xcd37('0x1'));var path=require(_0xcd37('0x2'));var timeout=require(_0xcd37('0x3'));var express=require(_0xcd37('0x4'));var router=express[_0xcd37('0x5')]();var fs_extra=require(_0xcd37('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcd37('0x7'));var config=require(_0xcd37('0x8'));var controller=require(_0xcd37('0x9'));router[_0xcd37('0xa')]('/',auth[_0xcd37('0xb')](),controller[_0xcd37('0xc')]);router[_0xcd37('0xa')](_0xcd37('0xd'),auth[_0xcd37('0xb')](),controller['show']);router[_0xcd37('0xa')](_0xcd37('0xe'),auth[_0xcd37('0xb')](),controller[_0xcd37('0xf')]);router[_0xcd37('0xa')]('/:id/run',auth['isAuthenticated'](),controller[_0xcd37('0x10')]);router[_0xcd37('0xa')]('/:id/query',auth[_0xcd37('0xb')](),controller['query']);router[_0xcd37('0x11')]('/',auth['isAuthenticated'](),controller[_0xcd37('0x12')]);router[_0xcd37('0x13')](_0xcd37('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xcd37('0xd'),auth[_0xcd37('0xb')](),controller[_0xcd37('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4e15=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0xbd09e4,_0x42e6ae){var _0x55e630=function(_0x9b1917){while(--_0x9b1917){_0xbd09e4['push'](_0xbd09e4['shift']());}};_0x55e630(++_0x42e6ae);}(_0x4e15,0x1c6));var _0x54e1=function(_0x354da0,_0x1ee027){_0x354da0=_0x354da0-0x0;var _0x3c9244=_0x4e15[_0x354da0];return _0x3c9244;};'use strict';var multer=require(_0x54e1('0x0'));var util=require(_0x54e1('0x1'));var path=require(_0x54e1('0x2'));var timeout=require(_0x54e1('0x3'));var express=require(_0x54e1('0x4'));var router=express[_0x54e1('0x5')]();var fs_extra=require(_0x54e1('0x6'));var auth=require(_0x54e1('0x7'));var interaction=require(_0x54e1('0x8'));var config=require(_0x54e1('0x9'));var controller=require(_0x54e1('0xa'));router[_0x54e1('0xb')]('/',auth[_0x54e1('0xc')](),controller[_0x54e1('0xd')]);router['get'](_0x54e1('0xe'),auth[_0x54e1('0xc')](),controller[_0x54e1('0xf')]);router[_0x54e1('0xb')](_0x54e1('0x10'),auth[_0x54e1('0xc')](),controller[_0x54e1('0x11')]);router['get'](_0x54e1('0x12'),auth[_0x54e1('0xc')](),controller['run']);router[_0x54e1('0xb')](_0x54e1('0x13'),auth[_0x54e1('0xc')](),controller[_0x54e1('0x14')]);router[_0x54e1('0x15')]('/',auth[_0x54e1('0xc')](),controller[_0x54e1('0x16')]);router[_0x54e1('0x17')](_0x54e1('0xe'),auth[_0x54e1('0xc')](),controller[_0x54e1('0x18')]);router[_0x54e1('0x19')](_0x54e1('0xe'),auth[_0x54e1('0xc')](),controller['destroy']);module[_0x54e1('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index cd08bf8..171b13e 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 _0xae24=['sequelize','STRING'];(function(_0x4744ce,_0x476e99){var _0x41cf3f=function(_0x4dd841){while(--_0x4dd841){_0x4744ce['push'](_0x4744ce['shift']());}};_0x41cf3f(++_0x476e99);}(_0xae24,0x182));var _0x4ae2=function(_0x1f15de,_0x327ced){_0x1f15de=_0x1f15de-0x0;var _0x12b6a7=_0xae24[_0x1f15de];return _0x12b6a7;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4ae2('0x1')]},'table':{'type':Sequelize[_0x4ae2('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4445a9,_0x4d7cc8){_0x4445a9=_0x4445a9-0x0;var _0x18d7f8=_0xb4c7[_0x4445a9];return _0x18d7f8;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 98289a7..880a29a 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 _0xf494=['name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','operator','condition','getFields','groupBy','clone','output','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack'];(function(_0x4e9467,_0x3e7800){var _0x5fe528=function(_0x6938ea){while(--_0x6938ea){_0x4e9467['push'](_0x4e9467['shift']());}};_0x5fe528(++_0x3e7800);}(_0xf494,0x1c6));var _0x4f49=function(_0x50e05c,_0x16834d){_0x50e05c=_0x50e05c-0x0;var _0x17b8fe=_0xf494[_0x50e05c];return _0x17b8fe;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var dbH=require(_0x4f49('0x18'))['dbH'];function respondWithStatusCode(_0x1e1c37,_0x111a8b){_0x111a8b=_0x111a8b||0xcc;return function(_0x1b9145){if(_0x1b9145){return _0x1e1c37[_0x4f49('0x19')](_0x111a8b);}return _0x1e1c37[_0x4f49('0x1a')](_0x111a8b)[_0x4f49('0x1b')]();};}function respondWithResult(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xc8;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1a')](_0x5c373e)[_0x4f49('0x1c')](_0x515ace);}};}function respondWithFilteredResult(_0x5878f4,_0x5bdfaf){return function(_0x2f0a0d){if(_0x2f0a0d){var _0x2ecaaa=typeof _0x5bdfaf[_0x4f49('0x1d')]==='undefined'&&typeof _0x5bdfaf[_0x4f49('0x1e')]===_0x4f49('0x1f');var _0x4e85df=_0x2f0a0d['count'];var _0x5bb23b=_0x2ecaaa?0x0:_0x5bdfaf['offset'];var _0x47f1e8=_0x2ecaaa?_0x2f0a0d[_0x4f49('0x20')]:_0x5bdfaf[_0x4f49('0x1d')]+_0x5bdfaf[_0x4f49('0x1e')];var _0x407042;if(_0x47f1e8>=_0x4e85df){_0x47f1e8=_0x4e85df;_0x407042=0xc8;}else{_0x407042=0xce;}_0x5878f4['status'](_0x407042);return _0x5878f4[_0x4f49('0x21')](_0x4f49('0x22'),_0x5bb23b+'-'+_0x47f1e8+'/'+_0x4e85df)[_0x4f49('0x1c')](_0x2f0a0d);}return null;};}function patchUpdates(_0xaab5e7){return function(_0xea82f8){try{jsonpatch['apply'](_0xea82f8,_0xaab5e7,!![]);}catch(_0x3e7e28){return BPromise[_0x4f49('0x23')](_0x3e7e28);}return _0xea82f8[_0x4f49('0x24')]();};}function saveUpdates(_0x53b57d,_0x40755e){return function(_0x1d70a7){if(_0x1d70a7){return _0x1d70a7[_0x4f49('0x25')](_0x53b57d)[_0x4f49('0x26')](function(_0x9d30aa){return _0x9d30aa;});}return null;};}function removeEntity(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x27')]()[_0x4f49('0x26')](function(){var _0x4fedbb=_0x4e9041[_0x4f49('0x28')]({'plain':!![]});var _0x2c1519=_0x4f49('0x29');return db['UserProfileResource'][_0x4f49('0x27')]({'where':{'type':_0x2c1519,'resourceId':_0x4fedbb['id']}})[_0x4f49('0x26')](function(){return _0x4e9041;});})[_0x4f49('0x26')](function(){_0x36187b[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x122404,_0x4915af){return function(_0x50c571){if(!_0x50c571){_0x122404[_0x4f49('0x19')](0x194);}return _0x50c571;};}function handleError(_0x2c00ee,_0x605c91){_0x605c91=_0x605c91||0x1f4;return function(_0x560050){logger[_0x4f49('0x2a')](_0x560050[_0x4f49('0x2b')]);if(_0x560050[_0x4f49('0x2c')]){delete _0x560050['name'];}_0x2c00ee['status'](_0x605c91)[_0x4f49('0x2d')](_0x560050);};}exports[_0x4f49('0x2e')]=function(_0x7a6ea0,_0x5e7076){var _0x1eaac6={},_0x35aa33={},_0x173657={'count':0x0,'rows':[]};var _0x2ceda4=_[_0x4f49('0x2f')](db[_0x4f49('0x30')][_0x4f49('0x31')],function(_0x45ae19){return{'name':_0x45ae19[_0x4f49('0x32')],'type':_0x45ae19[_0x4f49('0x33')][_0x4f49('0x34')]};});_0x35aa33[_0x4f49('0x35')]=_[_0x4f49('0x2f')](_0x2ceda4,_0x4f49('0x2c'));_0x35aa33[_0x4f49('0x36')]=_[_0x4f49('0x37')](_0x7a6ea0[_0x4f49('0x36')]);_0x35aa33[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x35aa33['model'],_0x35aa33[_0x4f49('0x36')]);_0x1eaac6[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x35aa33[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3b')]));_0x1eaac6[_0x4f49('0x3a')]=_0x1eaac6[_0x4f49('0x3a')][_0x4f49('0x3c')]?_0x1eaac6[_0x4f49('0x3a')]:_0x35aa33[_0x4f49('0x35')];if(!_0x7a6ea0[_0x4f49('0x36')]['hasOwnProperty'](_0x4f49('0x3d'))){_0x1eaac6[_0x4f49('0x1e')]=qs[_0x4f49('0x1e')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1e')]);_0x1eaac6[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1d')]);}_0x1eaac6[_0x4f49('0x3e')]=qs[_0x4f49('0x3f')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3f')]);_0x1eaac6[_0x4f49('0x40')]=qs['filters'](_[_0x4f49('0x41')](_0x7a6ea0[_0x4f49('0x36')],_0x35aa33['filters']),_0x2ceda4);if(_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x42')]){_0x1eaac6['where']=_[_0x4f49('0x43')](_0x1eaac6[_0x4f49('0x40')],{'$or':_[_0x4f49('0x2f')](_0x2ceda4,function(_0x200b1d){if(_0x200b1d[_0x4f49('0x33')]!==_0x4f49('0x44')){var _0x29e910={};_0x29e910[_0x200b1d['name']]={'$like':'%'+_0x7a6ea0['query']['filter']+'%'};return _0x29e910;}})});}_0x1eaac6=_[_0x4f49('0x43')]({},_0x1eaac6,_0x7a6ea0[_0x4f49('0x45')]);var _0x2e4355={'where':_0x1eaac6[_0x4f49('0x40')]};return db[_0x4f49('0x30')][_0x4f49('0x20')](_0x2e4355)[_0x4f49('0x26')](function(_0x23720a){_0x173657[_0x4f49('0x20')]=_0x23720a;if(_0x7a6ea0['query']['includeAll']){_0x1eaac6[_0x4f49('0x46')]=[{'all':!![]}];}return db[_0x4f49('0x30')][_0x4f49('0x47')](_0x1eaac6);})['then'](function(_0x2d6b56){_0x173657['rows']=_0x2d6b56;return _0x173657;})['then'](respondWithFilteredResult(_0x5e7076,_0x1eaac6))[_0x4f49('0x48')](handleError(_0x5e7076,null));};exports[_0x4f49('0x49')]=function(_0x40eadc,_0x497cb8){var _0x287781={'raw':!![],'where':{'id':_0x40eadc['params']['id']}},_0x11b4df={};_0x11b4df[_0x4f49('0x35')]=_['keys'](db[_0x4f49('0x30')][_0x4f49('0x31')]);_0x11b4df[_0x4f49('0x36')]=_['keys'](_0x40eadc[_0x4f49('0x36')]);_0x11b4df[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],_0x11b4df[_0x4f49('0x36')]);_0x287781[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x40eadc[_0x4f49('0x36')]['fields']));_0x287781[_0x4f49('0x3a')]=_0x287781[_0x4f49('0x3a')]['length']?_0x287781[_0x4f49('0x3a')]:_0x11b4df['model'];if(_0x40eadc[_0x4f49('0x36')][_0x4f49('0x4a')]){_0x287781[_0x4f49('0x46')]=[{'all':!![]}];}_0x287781=_[_0x4f49('0x43')]({},_0x287781,_0x40eadc['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x287781)[_0x4f49('0x26')](handleEntityNotFound(_0x497cb8,null))[_0x4f49('0x26')](respondWithResult(_0x497cb8,null))[_0x4f49('0x48')](handleError(_0x497cb8,null));};exports[_0x4f49('0x4c')]=function(_0x37fdb7,_0xd282c){return db[_0x4f49('0x30')][_0x4f49('0x4c')](_0x37fdb7[_0x4f49('0x4d')],{})[_0x4f49('0x26')](function(_0x148031){var _0x2104d0=_0x37fdb7[_0x4f49('0x4e')][_0x4f49('0x28')]({'plain':!![]});if(!_0x2104d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2104d0['role']===_0x4f49('0x4e')){var _0x197670=_0x148031[_0x4f49('0x28')]({'plain':!![]});var _0xe46c90=_0x4f49('0x4f');return db[_0x4f49('0x50')][_0x4f49('0x4b')]({'where':{'name':_0xe46c90,'userProfileId':_0x2104d0['userProfileId']},'raw':!![]})[_0x4f49('0x26')](function(_0x4ff0a2){if(_0x4ff0a2&&_0x4ff0a2[_0x4f49('0x51')]===0x0){return db[_0x4f49('0x52')][_0x4f49('0x4c')]({'name':_0x197670[_0x4f49('0x2c')],'resourceId':_0x197670['id'],'type':'DefaultReports','sectionId':_0x4ff0a2['id']},{})[_0x4f49('0x26')](function(){return _0x148031;});}else{return _0x148031;}})['catch'](function(_0x52d18c){logger[_0x4f49('0x2a')](_0x4f49('0x53'),_0x52d18c);throw _0x52d18c;});}return _0x148031;})[_0x4f49('0x26')](respondWithResult(_0xd282c,0xc9))[_0x4f49('0x48')](handleError(_0xd282c,null));};exports['update']=function(_0x599c51,_0xd7f47b){if(_0x599c51[_0x4f49('0x4d')]['id']){delete _0x599c51['body']['id'];}return db[_0x4f49('0x30')]['find']({'where':{'id':_0x599c51['params']['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0xd7f47b,null))['then'](saveUpdates(_0x599c51[_0x4f49('0x4d')],null))['then'](respondWithResult(_0xd7f47b,null))[_0x4f49('0x48')](handleError(_0xd7f47b,null));};exports[_0x4f49('0x27')]=function(_0x2472c9,_0x883408){return db[_0x4f49('0x30')][_0x4f49('0x4b')]({'where':{'id':_0x2472c9[_0x4f49('0x54')]['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0x883408,null))['then'](removeEntity(_0x883408,null))[_0x4f49('0x48')](handleError(_0x883408,null));};exports['preview']=function(_0x213608,_0x1f640d){var _0xc4fc6b=0xa;var _0x467f12=[_0x4f49('0x55'),_0x4f49('0x56'),'right_join',_0x4f49('0x57')];var _0xd3689c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x564bf5={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x21807e=function(_0x265988){return!_[_0x4f49('0x62')](['IS\x20NULL',_0x4f49('0x63'),_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x265988);};var _0x293839=function(_0x17b15){if(!_0x17b15||!_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x28ea73='(',_0x1b80f2=0x0;_0x1b80f2<_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')];_0x1b80f2+=0x1){_0x1b80f2>0x0&&(_0x28ea73+='\x20'+_0x17b15['operator']+'\x20');_0x28ea73+=_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]?_0x293839(_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]):_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x67')]+'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition']+(_0x21807e(_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition'])?'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x68')]:'');}return _0x28ea73+')';};var _0x4714c7={'where':{'id':_0x213608[_0x4f49('0x54')]['id']}},_0xf29378,_0xc7743e,_0x3f2f3f,_0x61a565,_0x297698;_0x4714c7=_[_0x4f49('0x43')]({},_0x4714c7,_0x213608['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x4714c7)[_0x4f49('0x26')](function(_0x2cdaa4){if(_0x2cdaa4){_0xf29378=_0x2cdaa4;return _0x2cdaa4['getFields']();}return null;})['then'](function(_0x28e8ae){if(_0x28e8ae){if(!_0x28e8ae['length']){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0xc7743e=_0x28e8ae;return db[_0x4f49('0x6c')][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x179431){if(_0x179431){_0x3f2f3f=_[_0x4f49('0x6d')](_0x179431,'id');var _0x3823f0;var _0x3e9b47=squel[_0x4f49('0x6e')]();_0x3e9b47[_0x4f49('0x6f')](_0xf29378[_0x4f49('0x70')]);for(var _0xd53de8=0x0;_0xd53de8<_0xc7743e[_0x4f49('0x3c')];_0xd53de8+=0x1){_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x71')]?_0x3f2f3f[_0xc7743e[_0xd53de8][_0x4f49('0x71')]][_0x4f49('0x72')]:_0xc7743e[_0xd53de8][_0x4f49('0x67')];_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0xd3689c[_0xc7743e[_0xd53de8][_0x4f49('0x73')]],'%s',_0x3823f0):_0x3823f0;_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x564bf5[_0xc7743e[_0xd53de8][_0x4f49('0x75')]],'%s',_0x3823f0):_0x3823f0;if(_0xc7743e[_0xd53de8]['groupBy']){_0x3e9b47[_0x4f49('0x66')](_0x3823f0);}_0xc7743e[_0xd53de8]['orderBy']&&_0x3e9b47[_0x4f49('0x3e')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x76')]===_0x4f49('0x77')?![]:!![]);_0x3e9b47[_0x4f49('0x67')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x78')]||_0x3823f0);}if(_0xf29378[_0x4f49('0x79')]){_0xf29378[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0xf29378[_0x4f49('0x79')]);for(var _0x541ac6=0x0;_0x541ac6<_0xf29378['joins'][_0x4f49('0x3c')];_0x541ac6+=0x1){if(_0xf29378['joins'][_0x541ac6][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x467f12,_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')])&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['parentKey']&&_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')]&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['foreignKey']){_0x3e9b47[_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')]](_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')],null,util['format'](_0x4f49('0x7c'),_0xf29378[_0x4f49('0x70')],_0xf29378['joins'][_0x541ac6][_0x4f49('0x7d')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7b')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7e')]));}}}if(_0xf29378[_0x4f49('0x7f')]){_0xf29378['conditions']=JSON[_0x4f49('0x7a')](_0xf29378['conditions']);_0x3e9b47[_0x4f49('0x40')](_0x293839(_0xf29378['conditions'][_0x4f49('0x66')]));}_0x297698=_0x3e9b47['clone']();_0x3e9b47[_0x4f49('0x1e')](_0xc4fc6b);_0x3e9b47[_0x4f49('0x1d')](0x0);logger[_0x4f49('0x80')](_0x4f49('0x81'),_0x3e9b47['toString']());return dbH[_0x4f49('0x82')]['query'](_0x3e9b47[_0x4f49('0x83')](),{'type':dbH['sequelize'][_0x4f49('0x84')]['SELECT']});}})['then'](respondWithResult(_0x1f640d,null))[_0x4f49('0x48')](handleError(_0x1f640d,null));};function runReport(_0x20b2be,_0x16cb4d,_0x4c0e7a){var _0x289810=_0x16cb4d[_0x4f49('0x2c')];var _0x5c33c9=0xa;var _0x5d52ae=['join',_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x87439={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x2902a1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x389679=function(_0x5304c3){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),'IS\x20NOT\x20NULL',_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x5304c3);};var _0x351a33=function(_0x4d72a0){if(!_0x4d72a0||!_0x4d72a0[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x2ef19e='(',_0x6ad599=0x0;_0x6ad599<_0x4d72a0[_0x4f49('0x65')]['length'];_0x6ad599+=0x1){_0x6ad599>0x0&&(_0x2ef19e+='\x20'+_0x4d72a0[_0x4f49('0x8a')]+'\x20');_0x2ef19e+=_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x66')]?_0x351a33(_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['group']):_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['field']+'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['condition']+(_0x389679(_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x8b')])?'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x68')]:'');}return _0x2ef19e+')';};var _0x111e90={'where':{'id':_0x20b2be['id']}},_0xd253ed,_0x323a3a,_0xe0adc3,_0x3a26ff,_0x64f0ee;_0x111e90=_['merge']({},_0x111e90,_0x4c0e7a);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x111e90)[_0x4f49('0x26')](function(_0x299849){if(_0x299849){_0xd253ed=_0x299849;return _0x299849[_0x4f49('0x8c')]();}return null;})[_0x4f49('0x26')](function(_0x55b28b){if(_0x55b28b){if(!_0x55b28b[_0x4f49('0x3c')]){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x323a3a=_0x55b28b;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3c4e88){if(_0x3c4e88){_0xe0adc3=_[_0x4f49('0x6d')](_0x3c4e88,'id');var _0x5c5d2;var _0xa880a2=squel['select']();_0xa880a2[_0x4f49('0x6f')](_0xd253ed[_0x4f49('0x70')]);for(var _0x11c0a0=0x0;_0x11c0a0<_0x323a3a[_0x4f49('0x3c')];_0x11c0a0+=0x1){_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x71')]?_0xe0adc3[_0x323a3a[_0x11c0a0][_0x4f49('0x71')]][_0x4f49('0x72')]:_0x323a3a[_0x11c0a0][_0x4f49('0x67')];_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0x87439[_0x323a3a[_0x11c0a0][_0x4f49('0x73')]],'%s',_0x5c5d2):_0x5c5d2;_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x2902a1[_0x323a3a[_0x11c0a0][_0x4f49('0x75')]],'%s',_0x5c5d2):_0x5c5d2;if(_0x323a3a[_0x11c0a0][_0x4f49('0x8d')]){_0xa880a2[_0x4f49('0x66')](_0x5c5d2);}_0x323a3a[_0x11c0a0][_0x4f49('0x76')]&&_0xa880a2[_0x4f49('0x3e')](_0x5c5d2,_0x323a3a[_0x11c0a0]['orderBy']===_0x4f49('0x77')?![]:!![]);_0xa880a2[_0x4f49('0x67')](_0x5c5d2,_0x323a3a[_0x11c0a0][_0x4f49('0x78')]||_0x5c5d2);}if(_0xd253ed[_0x4f49('0x79')]){_0xd253ed['joins']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x79')]);for(var _0x594460=0x0;_0x594460<_0xd253ed[_0x4f49('0x79')]['length'];_0x594460+=0x1){if(_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x5d52ae,_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')])&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7d')]&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')]&&_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']){_0xa880a2[_0xd253ed['joins'][_0x594460][_0x4f49('0x33')]](_0xd253ed['joins'][_0x594460][_0x4f49('0x7b')],null,util[_0x4f49('0x75')]('%s.%s\x20=\x20%s.%s',_0xd253ed['table'],_0xd253ed[_0x4f49('0x79')][_0x594460]['parentKey'],_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')],_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']));}}}if(_0xd253ed[_0x4f49('0x7f')]){_0xd253ed['conditions']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x7f')]);_0xa880a2[_0x4f49('0x40')](_0x351a33(_0xd253ed['conditions'][_0x4f49('0x66')]));}_0x64f0ee=_0xa880a2[_0x4f49('0x8e')]();_0xa880a2[_0x4f49('0x1e')](_0x5c33c9);_0xa880a2['offset'](0x0);return;}})['then'](function(){if(_0x16cb4d[_0x4f49('0x8f')]==='web'){return null;}var _0x2bc9df=_[_0x4f49('0x43')](_0x16cb4d,{'name':_0x16cb4d[_0x4f49('0x90')]||_0x16cb4d['name']||_0xd253ed[_0x4f49('0x2c')],'basename':_0x289810,'savename':util['format'](_0x4f49('0x91'),_0x16cb4d[_0x4f49('0x2c')]||_0xd253ed[_0x4f49('0x2c')],require('randomstring')[_0x4f49('0x92')](0x4),_0x16cb4d[_0x4f49('0x8f')]||_0x4f49('0x93')),'reportId':_0xd253ed['id'],'reportType':_0x4f49('0x94')});return db[_0x4f49('0x95')][_0x4f49('0x4c')](_0x2bc9df,{'raw':!![]});})['then'](function(_0x5b6ac7){if(_0xd253ed[_0x4f49('0x70')]===_0x4f49('0x96')){_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+_0x4f49('0x97'),_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}else{_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}if(_0x5b6ac7){logger[_0x4f49('0x9a')]('Run\x20Query:',_0x64f0ee[_0x4f49('0x83')]());require(_0x4f49('0x9b'))[_0x4f49('0x9c')](path['join'](__dirname,_0x4f49('0x9d'),_0x5b6ac7[_0x4f49('0x8f')]),[_0x5b6ac7['id'],_0x64f0ee[_0x4f49('0x83')](),path['join'](__dirname,_0x4f49('0x9e'),_0x5b6ac7[_0x4f49('0x9f')]),_0x289810]);return _0x5b6ac7;}else{var _0x5efb11=squel['select']();_0x5efb11[_0x4f49('0x6f')]('('+_0x64f0ee[_0x4f49('0x83')]()+')',_0x4f49('0xa0'));_0x5efb11[_0x4f49('0x67')](_0x4f49('0xa1'),_0x4f49('0x20'));_0x64f0ee['limit'](_0x16cb4d['limit']||_0x5c33c9);_0x64f0ee['offset'](_0x16cb4d[_0x4f49('0x1d')]||0x0);return dbH[_0x4f49('0x82')]['query'](_0x5efb11[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')]['SELECT']})['then'](function(_0x3633b5){if(!_0x3633b5['length']){_0x3a26ff=0x0;}else{_0x3a26ff=_0x3633b5[0x0][_0x4f49('0x20')]||0x0;}return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x64f0ee[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')]['QueryTypes'][_0x4f49('0xa2')]});})[_0x4f49('0x26')](function(_0x45c938){return{'rows':_0x45c938||[],'count':_0x3a26ff};});}});}exports[_0x4f49('0xa3')]=function(_0x4a4d75,_0x93e85d){return runReport(_0x4a4d75[_0x4f49('0x54')],_0x4a4d75['query'],_0x4a4d75[_0x4f49('0x45')])[_0x4f49('0x26')](respondWithResult(_0x93e85d,null))[_0x4f49('0x48')](handleError(_0x93e85d,null));};exports[_0x4f49('0xa4')]=runReport;exports[_0x4f49('0x36')]=function(_0x40991b,_0x56290f){var _0x4994b6=0xa;var _0x1c7d87=[_0x4f49('0x55'),_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x5cd00a={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0xd876f1={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x1ae2c9=function(_0x566634){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),_0x4f49('0x63'),'IS\x20EMPTY',_0x4f49('0xa5')],_0x566634);};var _0x541dc2=function(_0x4061bf){if(!_0x4061bf||!_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x1bc18d='(',_0x5e6103=0x0;_0x5e6103<_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')];_0x5e6103+=0x1){_0x5e6103>0x0&&(_0x1bc18d+='\x20'+_0x4061bf[_0x4f49('0x8a')]+'\x20');_0x1bc18d+=_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]?_0x541dc2(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]):_0x4061bf[_0x4f49('0x65')][_0x5e6103]['field']+'\x20'+_0x4061bf['rules'][_0x5e6103][_0x4f49('0x8b')]+(_0x1ae2c9(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x8b')])?'\x20'+_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x68')]:'');}return _0x1bc18d+')';};var _0x29dbab={'where':{'id':_0x40991b[_0x4f49('0x54')]['id']}},_0x5f459b,_0x1d090f,_0x37d2f4,_0x5bcb36,_0x3f04fa;_0x29dbab=_[_0x4f49('0x43')]({},_0x29dbab,_0x40991b['options']);return db['AnalyticDefaultReport'][_0x4f49('0x4b')](_0x29dbab)[_0x4f49('0x26')](function(_0x200848){if(_0x200848){_0x5f459b=_0x200848;return _0x200848['getFields']();}return null;})[_0x4f49('0x26')](function(_0x48f4bc){if(_0x48f4bc){if(!_0x48f4bc[_0x4f49('0x3c')]){throw new db['Sequelize'][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x1d090f=_0x48f4bc;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x513bc9){if(_0x513bc9){_0x37d2f4=_[_0x4f49('0x6d')](_0x513bc9,'id');var _0x47567c;var _0x5f1538=squel[_0x4f49('0x6e')]();_0x5f1538[_0x4f49('0x6f')](_0x5f459b[_0x4f49('0x70')]);for(var _0xd91e48=0x0;_0xd91e48<_0x1d090f[_0x4f49('0x3c')];_0xd91e48+=0x1){_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x71')]?_0x37d2f4[_0x1d090f[_0xd91e48]['MetricId']][_0x4f49('0x72')]:_0x1d090f[_0xd91e48][_0x4f49('0x67')];_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x73')]?_['replace'](_0x5cd00a[_0x1d090f[_0xd91e48][_0x4f49('0x73')]],'%s',_0x47567c):_0x47567c;_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0xd876f1[_0x1d090f[_0xd91e48][_0x4f49('0x75')]],'%s',_0x47567c):_0x47567c;if(_0x1d090f[_0xd91e48][_0x4f49('0x8d')]){_0x5f1538[_0x4f49('0x66')](_0x47567c);}_0x1d090f[_0xd91e48][_0x4f49('0x76')]&&_0x5f1538['order'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x76')]==='DESC'?![]:!![]);_0x5f1538['field'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x78')]||_0x47567c);}if(_0x5f459b['joins']){_0x5f459b[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x79')]);for(var _0x85eb3f=0x0;_0x85eb3f<_0x5f459b[_0x4f49('0x79')][_0x4f49('0x3c')];_0x85eb3f+=0x1){if(_0x5f459b['joins'][_0x85eb3f][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x1c7d87,_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')])&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')]&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable']&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]){_0x5f1538[_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')]](_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7b')],null,util[_0x4f49('0x75')](_0x4f49('0x7c'),_0x5f459b[_0x4f49('0x70')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable'],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]));}}}if(_0x5f459b['conditions']){_0x5f459b[_0x4f49('0x7f')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x7f')]);_0x5f1538[_0x4f49('0x40')](_0x541dc2(_0x5f459b[_0x4f49('0x7f')][_0x4f49('0x66')]));}_0x3f04fa=_0x5f1538['clone']();_0x5f1538['limit'](_0x4994b6);_0x5f1538['offset'](0x0);logger['debug'](_0x4f49('0x81'),_0x5f1538['toString']());return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x5f1538[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')][_0x4f49('0xa2')]});}})['then'](function(){return{'sql':_0x3f04fa[_0x4f49('0x83')]()};})['then'](respondWithResult(_0x56290f,null))[_0x4f49('0x48')](handleError(_0x56290f,null));}; \ No newline at end of file +var _0x2ef3=['Sequelize','from','foreignKey','output','web','fullPath','generate','csv','cdr','startDate','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','IS\x20NOT\x20EMPTY','metric','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','update','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','operator','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x2ef3,0xba));var _0x32ef=function(_0x5d6f82,_0x1ec9b6){_0x5d6f82=_0x5d6f82-0x0;var _0x4f1af0=_0x2ef3[_0x5d6f82];return _0x4f1af0;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x32ef('0x18'))['dbH'];function respondWithStatusCode(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xcc;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['sendStatus'](_0x1ef1ae);}return _0x3e98df[_0x32ef('0x19')](_0x1ef1ae)['end']();};}function respondWithResult(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xc8;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x19')](_0x40a6e6)['json'](_0x93d492);}};}function respondWithFilteredResult(_0x55bf0b,_0x531e30){return function(_0x13db1a){if(_0x13db1a){var _0x3950e6=typeof _0x531e30[_0x32ef('0x1a')]==='undefined'&&typeof _0x531e30['limit']===_0x32ef('0x1b');var _0x1a9476=_0x13db1a[_0x32ef('0x1c')];var _0x57863c=_0x3950e6?0x0:_0x531e30[_0x32ef('0x1a')];var _0x33e230=_0x3950e6?_0x13db1a['count']:_0x531e30[_0x32ef('0x1a')]+_0x531e30[_0x32ef('0x1d')];var _0x26aff3;if(_0x33e230>=_0x1a9476){_0x33e230=_0x1a9476;_0x26aff3=0xc8;}else{_0x26aff3=0xce;}_0x55bf0b[_0x32ef('0x19')](_0x26aff3);return _0x55bf0b[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x57863c+'-'+_0x33e230+'/'+_0x1a9476)['json'](_0x13db1a);}return null;};}function patchUpdates(_0x3c5b78){return function(_0x5cc3ef){try{jsonpatch[_0x32ef('0x20')](_0x5cc3ef,_0x3c5b78,!![]);}catch(_0x3a20ca){return BPromise['reject'](_0x3a20ca);}return _0x5cc3ef[_0x32ef('0x21')]();};}function saveUpdates(_0x97780,_0x5e8898){return function(_0x55f7f2){if(_0x55f7f2){return _0x55f7f2['update'](_0x97780)[_0x32ef('0x22')](function(_0xb30fab){return _0xb30fab;});}return null;};}function removeEntity(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x23')]()['then'](function(){var _0x51a412=_0x59585f[_0x32ef('0x24')]({'plain':!![]});var _0x14d4b3=_0x32ef('0x25');return db[_0x32ef('0x26')][_0x32ef('0x23')]({'where':{'type':_0x14d4b3,'resourceId':_0x51a412['id']}})[_0x32ef('0x22')](function(){return _0x59585f;});})[_0x32ef('0x22')](function(){_0x225feb[_0x32ef('0x19')](0xcc)[_0x32ef('0x27')]();});}};}function handleEntityNotFound(_0x2f52d7,_0x1335e2){return function(_0xba4b3f){if(!_0xba4b3f){_0x2f52d7['sendStatus'](0x194);}return _0xba4b3f;};}function handleError(_0xd65fde,_0x2f5d06){_0x2f5d06=_0x2f5d06||0x1f4;return function(_0x5a04cd){logger[_0x32ef('0x28')](_0x5a04cd[_0x32ef('0x29')]);if(_0x5a04cd[_0x32ef('0x2a')]){delete _0x5a04cd[_0x32ef('0x2a')];}_0xd65fde['status'](_0x2f5d06)[_0x32ef('0x2b')](_0x5a04cd);};}exports[_0x32ef('0x2c')]=function(_0x31dbc3,_0x2ac686){var _0x1b668a={},_0x1a6ed2={},_0x1a122d={'count':0x0,'rows':[]};var _0x575f3e=_[_0x32ef('0x2d')](db['AnalyticDefaultReport'][_0x32ef('0x2e')],function(_0x2b6c6a){return{'name':_0x2b6c6a['fieldName'],'type':_0x2b6c6a[_0x32ef('0x2f')][_0x32ef('0x30')]};});_0x1a6ed2[_0x32ef('0x31')]=_[_0x32ef('0x2d')](_0x575f3e,_0x32ef('0x2a'));_0x1a6ed2['query']=_['keys'](_0x31dbc3[_0x32ef('0x32')]);_0x1a6ed2['filters']=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],_0x1a6ed2[_0x32ef('0x32')]);_0x1b668a[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],qs['fields'](_0x31dbc3['query']['fields']));_0x1b668a[_0x32ef('0x34')]=_0x1b668a[_0x32ef('0x34')][_0x32ef('0x35')]?_0x1b668a['attributes']:_0x1a6ed2['model'];if(!_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x36')](_0x32ef('0x37'))){_0x1b668a['limit']=qs['limit'](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1d')]);_0x1b668a[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1a')]);}_0x1b668a[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x31dbc3[_0x32ef('0x32')]['sort']);_0x1b668a[_0x32ef('0x3a')]=qs[_0x32ef('0x3b')](_[_0x32ef('0x3c')](_0x31dbc3['query'],_0x1a6ed2[_0x32ef('0x3b')]),_0x575f3e);if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x3d')]){_0x1b668a[_0x32ef('0x3a')]=_[_0x32ef('0x3e')](_0x1b668a[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x2d')](_0x575f3e,function(_0x1cebed){if(_0x1cebed[_0x32ef('0x2f')]!==_0x32ef('0x3f')){var _0xb4db74={};_0xb4db74[_0x1cebed[_0x32ef('0x2a')]]={'$like':'%'+_0x31dbc3['query'][_0x32ef('0x3d')]+'%'};return _0xb4db74;}})});}_0x1b668a=_[_0x32ef('0x3e')]({},_0x1b668a,_0x31dbc3[_0x32ef('0x40')]);var _0x1733e3={'where':_0x1b668a[_0x32ef('0x3a')]};return db[_0x32ef('0x41')][_0x32ef('0x1c')](_0x1733e3)['then'](function(_0x538758){_0x1a122d[_0x32ef('0x1c')]=_0x538758;if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x42')]){_0x1b668a[_0x32ef('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x32ef('0x44')](_0x1b668a);})[_0x32ef('0x22')](function(_0x5d2f06){_0x1a122d[_0x32ef('0x45')]=_0x5d2f06;return _0x1a122d;})['then'](respondWithFilteredResult(_0x2ac686,_0x1b668a))[_0x32ef('0x46')](handleError(_0x2ac686,null));};exports[_0x32ef('0x47')]=function(_0x37a497,_0x3be46d){var _0x2c2b62={'raw':!![],'where':{'id':_0x37a497[_0x32ef('0x48')]['id']}},_0x2310ae={};_0x2310ae[_0x32ef('0x31')]=_[_0x32ef('0x49')](db[_0x32ef('0x41')]['rawAttributes']);_0x2310ae[_0x32ef('0x32')]=_['keys'](_0x37a497[_0x32ef('0x32')]);_0x2310ae[_0x32ef('0x3b')]=_[_0x32ef('0x33')](_0x2310ae['model'],_0x2310ae[_0x32ef('0x32')]);_0x2c2b62[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x2310ae[_0x32ef('0x31')],qs[_0x32ef('0x4a')](_0x37a497[_0x32ef('0x32')][_0x32ef('0x4a')]));_0x2c2b62['attributes']=_0x2c2b62['attributes'][_0x32ef('0x35')]?_0x2c2b62[_0x32ef('0x34')]:_0x2310ae[_0x32ef('0x31')];if(_0x37a497[_0x32ef('0x32')][_0x32ef('0x42')]){_0x2c2b62[_0x32ef('0x43')]=[{'all':!![]}];}_0x2c2b62=_[_0x32ef('0x3e')]({},_0x2c2b62,_0x37a497[_0x32ef('0x40')]);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2c2b62)[_0x32ef('0x22')](handleEntityNotFound(_0x3be46d,null))[_0x32ef('0x22')](respondWithResult(_0x3be46d,null))[_0x32ef('0x46')](handleError(_0x3be46d,null));};exports['create']=function(_0x420f00,_0x12fbd7){return db[_0x32ef('0x41')][_0x32ef('0x4c')](_0x420f00[_0x32ef('0x4d')],{})[_0x32ef('0x22')](function(_0x278696){var _0x1acded=_0x420f00[_0x32ef('0x4e')][_0x32ef('0x24')]({'plain':!![]});if(!_0x1acded)throw new Error(_0x32ef('0x4f'));if(_0x1acded[_0x32ef('0x50')]===_0x32ef('0x4e')){var _0x326445=_0x278696[_0x32ef('0x24')]({'plain':!![]});var _0x3fb4d8=_0x32ef('0x51');return db[_0x32ef('0x52')]['find']({'where':{'name':_0x3fb4d8,'userProfileId':_0x1acded['userProfileId']},'raw':!![]})[_0x32ef('0x22')](function(_0x259c32){if(_0x259c32&&_0x259c32[_0x32ef('0x53')]===0x0){return db[_0x32ef('0x26')][_0x32ef('0x4c')]({'name':_0x326445[_0x32ef('0x2a')],'resourceId':_0x326445['id'],'type':_0x32ef('0x25'),'sectionId':_0x259c32['id']},{})[_0x32ef('0x22')](function(){return _0x278696;});}else{return _0x278696;}})[_0x32ef('0x46')](function(_0x368bf1){logger[_0x32ef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368bf1);throw _0x368bf1;});}return _0x278696;})[_0x32ef('0x22')](respondWithResult(_0x12fbd7,0xc9))[_0x32ef('0x46')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x54')]=function(_0x3fe01f,_0x38314a){if(_0x3fe01f[_0x32ef('0x4d')]['id']){delete _0x3fe01f['body']['id'];}return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x3fe01f[_0x32ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x38314a,null))[_0x32ef('0x22')](saveUpdates(_0x3fe01f['body'],null))[_0x32ef('0x22')](respondWithResult(_0x38314a,null))[_0x32ef('0x46')](handleError(_0x38314a,null));};exports['destroy']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x206ad5[_0x32ef('0x48')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x22')](removeEntity(_0x59e5f9,null))[_0x32ef('0x46')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x55')]=function(_0x56260f,_0x56cc75){var _0xdfa103=0xa;var _0x52232a=['join',_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0x6aae59={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0xbd059e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ac877=function(_0x3c31d0){return!_[_0x32ef('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x3c31d0);};var _0x17f447=function(_0x5bb114){if(!_0x5bb114||!_0x5bb114['rules'][_0x32ef('0x35')]){return'';}for(var _0x208989='(',_0x10cb37=0x0;_0x10cb37<_0x5bb114['rules'][_0x32ef('0x35')];_0x10cb37+=0x1){_0x10cb37>0x0&&(_0x208989+='\x20'+_0x5bb114[_0x32ef('0x65')]+'\x20');_0x208989+=_0x5bb114[_0x32ef('0x66')][_0x10cb37]['group']?_0x17f447(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x67')]):_0x5bb114['rules'][_0x10cb37]['field']+'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')]+(_0x2ac877(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')])?'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x69')]:'');}return _0x208989+')';};var _0x4c89e8={'where':{'id':_0x56260f[_0x32ef('0x48')]['id']}},_0x285330,_0x63b65,_0x25b6d6,_0x36ed97,_0x21e930;_0x4c89e8=_[_0x32ef('0x3e')]({},_0x4c89e8,_0x56260f[_0x32ef('0x40')]);return db[_0x32ef('0x41')]['find'](_0x4c89e8)[_0x32ef('0x22')](function(_0x29ff58){if(_0x29ff58){_0x285330=_0x29ff58;return _0x29ff58[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0x79ae28){if(_0x79ae28){if(!_0x79ae28['length']){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x63b65=_0x79ae28;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x526fb1){if(_0x526fb1){_0x25b6d6=_[_0x32ef('0x6e')](_0x526fb1,'id');var _0x544045;var _0x216e2f=squel[_0x32ef('0x6f')]();_0x216e2f['from'](_0x285330['table']);for(var _0x2c9f7a=0x0;_0x2c9f7a<_0x63b65[_0x32ef('0x35')];_0x2c9f7a+=0x1){_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x70')]?_0x25b6d6[_0x63b65[_0x2c9f7a]['MetricId']]['metric']:_0x63b65[_0x2c9f7a][_0x32ef('0x71')];_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x6aae59[_0x63b65[_0x2c9f7a][_0x32ef('0x72')]],'%s',_0x544045):_0x544045;_0x544045=_0x63b65[_0x2c9f7a]['format']?_[_0x32ef('0x73')](_0xbd059e[_0x63b65[_0x2c9f7a][_0x32ef('0x74')]],'%s',_0x544045):_0x544045;if(_0x63b65[_0x2c9f7a][_0x32ef('0x75')]){_0x216e2f[_0x32ef('0x67')](_0x544045);}_0x63b65[_0x2c9f7a][_0x32ef('0x76')]&&_0x216e2f[_0x32ef('0x38')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x216e2f[_0x32ef('0x71')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x78')]||_0x544045);}if(_0x285330[_0x32ef('0x79')]){_0x285330[_0x32ef('0x79')]=JSON['parse'](_0x285330['joins']);for(var _0x3a9c97=0x0;_0x3a9c97<_0x285330[_0x32ef('0x79')]['length'];_0x3a9c97+=0x1){if(_0x285330[_0x32ef('0x79')][_0x3a9c97]['type']&&_[_0x32ef('0x63')](_0x52232a,_0x285330[_0x32ef('0x79')][_0x3a9c97][_0x32ef('0x2f')])&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7a')]&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')]&&_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']){_0x216e2f[_0x285330['joins'][_0x3a9c97][_0x32ef('0x2f')]](_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')],null,util['format'](_0x32ef('0x7c'),_0x285330[_0x32ef('0x7d')],_0x285330[_0x32ef('0x79')][_0x3a9c97]['parentKey'],_0x285330['joins'][_0x3a9c97]['foreignTable'],_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']));}}}if(_0x285330[_0x32ef('0x7e')]){_0x285330[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x285330[_0x32ef('0x7e')]);_0x216e2f[_0x32ef('0x3a')](_0x17f447(_0x285330[_0x32ef('0x7e')]['group']));}_0x21e930=_0x216e2f[_0x32ef('0x80')]();_0x216e2f['limit'](_0xdfa103);_0x216e2f['offset'](0x0);logger[_0x32ef('0x81')]('Limited\x20Query:',_0x216e2f[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')]['query'](_0x216e2f[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')][_0x32ef('0x84')][_0x32ef('0x85')]});}})[_0x32ef('0x22')](respondWithResult(_0x56cc75,null))[_0x32ef('0x46')](handleError(_0x56cc75,null));};function runReport(_0x4b5506,_0x51736f,_0x35b10d){var _0x5e0b55=_0x51736f[_0x32ef('0x2a')];var _0x266688=0xa;var _0x114d8e=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),'cross_join'];var _0x3232ca={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':_0x32ef('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x211fb1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0xfb4845=function(_0x21067e){return!_[_0x32ef('0x63')](['IS\x20NULL',_0x32ef('0x8b'),_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x21067e);};var _0x35653b=function(_0x5ea727){if(!_0x5ea727||!_0x5ea727[_0x32ef('0x66')]['length']){return'';}for(var _0x43f36e='(',_0x39300f=0x0;_0x39300f<_0x5ea727[_0x32ef('0x66')][_0x32ef('0x35')];_0x39300f+=0x1){_0x39300f>0x0&&(_0x43f36e+='\x20'+_0x5ea727['operator']+'\x20');_0x43f36e+=_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x67')]?_0x35653b(_0x5ea727[_0x32ef('0x66')][_0x39300f]['group']):_0x5ea727['rules'][_0x39300f]['field']+'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')]+(_0xfb4845(_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')])?'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f]['value']:'');}return _0x43f36e+')';};var _0x2678e3={'where':{'id':_0x4b5506['id']}},_0x5b3deb,_0x471de6,_0x7b0ea5,_0xc43e1,_0x4baa7a;_0x2678e3=_[_0x32ef('0x3e')]({},_0x2678e3,_0x35b10d);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2678e3)[_0x32ef('0x22')](function(_0x28bebb){if(_0x28bebb){_0x5b3deb=_0x28bebb;return _0x28bebb['getFields']();}return null;})[_0x32ef('0x22')](function(_0x484df0){if(_0x484df0){if(!_0x484df0[_0x32ef('0x35')]){throw new db[(_0x32ef('0x8c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x471de6=_0x484df0;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x3b9896){if(_0x3b9896){_0x7b0ea5=_['keyBy'](_0x3b9896,'id');var _0x356fd4;var _0x51ca6e=squel['select']();_0x51ca6e[_0x32ef('0x8d')](_0x5b3deb['table']);for(var _0x2237cf=0x0;_0x2237cf<_0x471de6[_0x32ef('0x35')];_0x2237cf+=0x1){_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x70')]?_0x7b0ea5[_0x471de6[_0x2237cf]['MetricId']]['metric']:_0x471de6[_0x2237cf][_0x32ef('0x71')];_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x3232ca[_0x471de6[_0x2237cf][_0x32ef('0x72')]],'%s',_0x356fd4):_0x356fd4;_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x211fb1[_0x471de6[_0x2237cf][_0x32ef('0x74')]],'%s',_0x356fd4):_0x356fd4;if(_0x471de6[_0x2237cf]['groupBy']){_0x51ca6e[_0x32ef('0x67')](_0x356fd4);}_0x471de6[_0x2237cf][_0x32ef('0x76')]&&_0x51ca6e[_0x32ef('0x38')](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x76')]==='DESC'?![]:!![]);_0x51ca6e['field'](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x78')]||_0x356fd4);}if(_0x5b3deb['joins']){_0x5b3deb[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x5b3deb['joins']);for(var _0x5c7594=0x0;_0x5c7594<_0x5b3deb['joins'][_0x32ef('0x35')];_0x5c7594+=0x1){if(_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x2f')]&&_[_0x32ef('0x63')](_0x114d8e,_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x2f')])&&_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x8e')]){_0x51ca6e[_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['type']](_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')],null,util[_0x32ef('0x74')](_0x32ef('0x7c'),_0x5b3deb[_0x32ef('0x7d')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7b')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['foreignKey']));}}}if(_0x5b3deb[_0x32ef('0x7e')]){_0x5b3deb['conditions']=JSON[_0x32ef('0x7f')](_0x5b3deb[_0x32ef('0x7e')]);_0x51ca6e[_0x32ef('0x3a')](_0x35653b(_0x5b3deb[_0x32ef('0x7e')][_0x32ef('0x67')]));}_0x4baa7a=_0x51ca6e['clone']();_0x51ca6e[_0x32ef('0x1d')](_0x266688);_0x51ca6e[_0x32ef('0x1a')](0x0);return;}})[_0x32ef('0x22')](function(){if(_0x51736f[_0x32ef('0x8f')]===_0x32ef('0x90')){return null;}var _0x1cfdd8=_[_0x32ef('0x3e')](_0x51736f,{'name':_0x51736f[_0x32ef('0x91')]||_0x51736f[_0x32ef('0x2a')]||_0x5b3deb['name'],'basename':_0x5e0b55,'savename':util['format']('%s-%s.%s',_0x51736f[_0x32ef('0x2a')]||_0x5b3deb[_0x32ef('0x2a')],require('randomstring')[_0x32ef('0x92')](0x4),_0x51736f['output']||_0x32ef('0x93')),'reportId':_0x5b3deb['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x32ef('0x4c')](_0x1cfdd8,{'raw':!![]});})[_0x32ef('0x22')](function(_0x118d2e){if(_0x5b3deb[_0x32ef('0x7d')]===_0x32ef('0x94')){_0x4baa7a['where'](_0x5b3deb[_0x32ef('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x51736f[_0x32ef('0x95')],_0x51736f['endDate']);}else{_0x4baa7a['where'](_0x5b3deb['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51736f['startDate'],_0x51736f[_0x32ef('0x96')]);}if(_0x118d2e){logger[_0x32ef('0x97')]('Run\x20Query:',_0x4baa7a[_0x32ef('0x82')]());require(_0x32ef('0x98'))[_0x32ef('0x99')](path[_0x32ef('0x86')](__dirname,_0x32ef('0x9a'),_0x118d2e[_0x32ef('0x8f')]),[_0x118d2e['id'],_0x4baa7a['toString'](),path[_0x32ef('0x86')](__dirname,'../../files/reports',_0x118d2e[_0x32ef('0x9b')]),_0x5e0b55]);return _0x118d2e;}else{var _0x1be713=squel['select']();_0x1be713[_0x32ef('0x8d')]('('+_0x4baa7a['toString']()+')',_0x32ef('0x9c'));_0x1be713[_0x32ef('0x71')](_0x32ef('0x9d'),_0x32ef('0x1c'));_0x4baa7a['limit'](_0x51736f[_0x32ef('0x1d')]||_0x266688);_0x4baa7a[_0x32ef('0x1a')](_0x51736f[_0x32ef('0x1a')]||0x0);return dbH[_0x32ef('0x83')]['query'](_0x1be713[_0x32ef('0x82')](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]})[_0x32ef('0x22')](function(_0x28ef17){if(!_0x28ef17[_0x32ef('0x35')]){_0xc43e1=0x0;}else{_0xc43e1=_0x28ef17[0x0][_0x32ef('0x1c')]||0x0;}return dbH['sequelize'][_0x32ef('0x32')](_0x4baa7a['toString'](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]});})[_0x32ef('0x22')](function(_0x3956e7){return{'rows':_0x3956e7||[],'count':_0xc43e1};});}});}exports['run']=function(_0x8d3b24,_0x642716){return runReport(_0x8d3b24[_0x32ef('0x48')],_0x8d3b24[_0x32ef('0x32')],_0x8d3b24['options'])['then'](respondWithResult(_0x642716,null))['catch'](handleError(_0x642716,null));};exports[_0x32ef('0x9e')]=runReport;exports[_0x32ef('0x32')]=function(_0x4454f3,_0xc92dcc){var _0x3d18b9=0xa;var _0x9233cb=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0xa76912={'SUM':'SUM(%s)','COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0x1526a1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0x2d4d2f=function(_0x292488){return!_[_0x32ef('0x63')]([_0x32ef('0x9f'),_0x32ef('0x8b'),_0x32ef('0x64'),_0x32ef('0xa0')],_0x292488);};var _0x50b674=function(_0x379d40){if(!_0x379d40||!_0x379d40[_0x32ef('0x66')][_0x32ef('0x35')]){return'';}for(var _0x4b7a4d='(',_0x16525b=0x0;_0x16525b<_0x379d40['rules'][_0x32ef('0x35')];_0x16525b+=0x1){_0x16525b>0x0&&(_0x4b7a4d+='\x20'+_0x379d40[_0x32ef('0x65')]+'\x20');_0x4b7a4d+=_0x379d40[_0x32ef('0x66')][_0x16525b]['group']?_0x50b674(_0x379d40[_0x32ef('0x66')][_0x16525b]['group']):_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x71')]+'\x20'+_0x379d40['rules'][_0x16525b][_0x32ef('0x68')]+(_0x2d4d2f(_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x68')])?'\x20'+_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x69')]:'');}return _0x4b7a4d+')';};var _0x264075={'where':{'id':_0x4454f3[_0x32ef('0x48')]['id']}},_0x3798d1,_0x4befa9,_0x493ae9,_0x143d39,_0x497948;_0x264075=_[_0x32ef('0x3e')]({},_0x264075,_0x4454f3['options']);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x264075)['then'](function(_0x1200c9){if(_0x1200c9){_0x3798d1=_0x1200c9;return _0x1200c9[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0xa5f787){if(_0xa5f787){if(!_0xa5f787[_0x32ef('0x35')]){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x4befa9=_0xa5f787;return db['AnalyticMetric'][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){_0x493ae9=_[_0x32ef('0x6e')](_0x55ad11,'id');var _0x2971a8;var _0x522c22=squel[_0x32ef('0x6f')]();_0x522c22[_0x32ef('0x8d')](_0x3798d1['table']);for(var _0xb41a01=0x0;_0xb41a01<_0x4befa9[_0x32ef('0x35')];_0xb41a01+=0x1){_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x70')]?_0x493ae9[_0x4befa9[_0xb41a01][_0x32ef('0x70')]][_0x32ef('0xa1')]:_0x4befa9[_0xb41a01][_0x32ef('0x71')];_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x72')]?_['replace'](_0xa76912[_0x4befa9[_0xb41a01]['function']],'%s',_0x2971a8):_0x2971a8;_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x1526a1[_0x4befa9[_0xb41a01][_0x32ef('0x74')]],'%s',_0x2971a8):_0x2971a8;if(_0x4befa9[_0xb41a01]['groupBy']){_0x522c22[_0x32ef('0x67')](_0x2971a8);}_0x4befa9[_0xb41a01][_0x32ef('0x76')]&&_0x522c22['order'](_0x2971a8,_0x4befa9[_0xb41a01][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x522c22['field'](_0x2971a8,_0x4befa9[_0xb41a01]['alias']||_0x2971a8);}if(_0x3798d1[_0x32ef('0x79')]){_0x3798d1[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x3798d1['joins']);for(var _0x5f4eab=0x0;_0x5f4eab<_0x3798d1['joins'][_0x32ef('0x35')];_0x5f4eab+=0x1){if(_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')]&&_['includes'](_0x9233cb,_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')])&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['parentKey']&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')]&&_0x3798d1['joins'][_0x5f4eab]['foreignKey']){_0x522c22[_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['type']](_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3798d1[_0x32ef('0x7d')],_0x3798d1['joins'][_0x5f4eab][_0x32ef('0x7a')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x8e')]));}}}if(_0x3798d1[_0x32ef('0x7e')]){_0x3798d1[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x3798d1[_0x32ef('0x7e')]);_0x522c22[_0x32ef('0x3a')](_0x50b674(_0x3798d1['conditions']['group']));}_0x497948=_0x522c22[_0x32ef('0x80')]();_0x522c22[_0x32ef('0x1d')](_0x3d18b9);_0x522c22[_0x32ef('0x1a')](0x0);logger[_0x32ef('0x81')](_0x32ef('0xa2'),_0x522c22[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')][_0x32ef('0x32')](_0x522c22[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')]['QueryTypes'][_0x32ef('0x85')]});}})[_0x32ef('0x22')](function(){return{'sql':_0x497948[_0x32ef('0x82')]()};})[_0x32ef('0x22')](respondWithResult(_0xc92dcc,null))[_0x32ef('0x46')](handleError(_0xc92dcc,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index db60b65..d6446dc 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 _0x4256=['rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x251b02,_0x38c0f7){var _0x14017c=function(_0x7a976a){while(--_0x7a976a){_0x251b02['push'](_0x251b02['shift']());}};_0x14017c(++_0x38c0f7);}(_0x4256,0x148));var _0x6425=function(_0x4a209a,_0x575ff9){_0x4a209a=_0x4a209a-0x0;var _0x4b3c20=_0x4256[_0x4a209a];return _0x4b3c20;};'use strict';var _=require(_0x6425('0x0'));var util=require(_0x6425('0x1'));var logger=require(_0x6425('0x2'))(_0x6425('0x3'));var moment=require(_0x6425('0x4'));var BPromise=require(_0x6425('0x5'));var rp=require(_0x6425('0x6'));var fs=require('fs');var path=require(_0x6425('0x7'));var rimraf=require(_0x6425('0x8'));var config=require(_0x6425('0x9'));var attributes=require('./analyticDefaultReport.attributes');module[_0x6425('0xa')]=function(_0x384476,_0x2caeed){return _0x384476[_0x6425('0xb')](_0x6425('0xc'),attributes,{'tableName':_0x6425('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x028e=['bluebird','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','lodash','util','../../config/logger','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x028e,0x71));var _0xe028=function(_0x11f24d,_0x58f26a){_0x11f24d=_0x11f24d-0x0;var _0x1a86e6=_0x028e[_0x11f24d];return _0x1a86e6;};'use strict';var _=require(_0xe028('0x0'));var util=require(_0xe028('0x1'));var logger=require(_0xe028('0x2'))(_0xe028('0x3'));var moment=require('moment');var BPromise=require(_0xe028('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe028('0x5'));var attributes=require(_0xe028('0x6'));module[_0xe028('0x7')]=function(_0x34e511,_0x3bc0d6){return _0x34e511['define']('AnalyticDefaultReport',attributes,{'tableName':_0xe028('0x8'),'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 bb393df..adc83fa 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 _0xcea9=['code','message','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x399b34,_0x30d7e0){var _0xd355a7=function(_0x515fe8){while(--_0x515fe8){_0x399b34['push'](_0x399b34['shift']());}};_0xd355a7(++_0x30d7e0);}(_0xcea9,0x1e2));var _0x9cea=function(_0x55730b,_0x160fe8){_0x55730b=_0x55730b-0x0;var _0x548413=_0xcea9[_0x55730b];return _0x548413;};'use strict';var _=require(_0x9cea('0x0'));var util=require(_0x9cea('0x1'));var moment=require(_0x9cea('0x2'));var BPromise=require('bluebird');var rs=require(_0x9cea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cea('0x4'))['db'];var utils=require(_0x9cea('0x5'));var logger=require(_0x9cea('0x6'))('rpc');var config=require(_0x9cea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9cea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1930c5,_0x497fa9,_0x5bc605){return new BPromise(function(_0x487740,_0xefdc1a){return client[_0x9cea('0x9')](_0x1930c5,_0x5bc605)[_0x9cea('0xa')](function(_0x5aa49f){logger[_0x9cea('0xb')](_0x9cea('0xc'),_0x497fa9,_0x9cea('0xd'));logger[_0x9cea('0xe')](_0x9cea('0xf'),_0x497fa9,'request\x20sent',JSON[_0x9cea('0x10')](_0x5aa49f));if(_0x5aa49f[_0x9cea('0x11')]){if(_0x5aa49f['error'][_0x9cea('0x12')]===0x1f4){logger[_0x9cea('0x11')](_0x9cea('0xc'),_0x497fa9,_0x5aa49f[_0x9cea('0x11')][_0x9cea('0x13')]);return _0xefdc1a(_0x5aa49f['error'][_0x9cea('0x13')]);}logger[_0x9cea('0x11')](_0x9cea('0xc'),_0x497fa9,_0x5aa49f[_0x9cea('0x11')]['message']);return _0x487740(_0x5aa49f[_0x9cea('0x11')][_0x9cea('0x13')]);}else{logger[_0x9cea('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x497fa9,_0x9cea('0xd'));_0x487740(_0x5aa49f['result'][_0x9cea('0x13')]);}})['catch'](function(_0x353655){logger[_0x9cea('0x11')](_0x9cea('0xc'),_0x497fa9,_0x353655);_0xefdc1a(_0x353655);});});} \ No newline at end of file +var _0xb711=['util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x7d152a,_0x2e9d56){var _0x35c0ae=function(_0x598bd4){while(--_0x598bd4){_0x7d152a['push'](_0x7d152a['shift']());}};_0x35c0ae(++_0x2e9d56);}(_0xb711,0x113));var _0x1b71=function(_0x2e0b2f,_0x25172b){_0x2e0b2f=_0x2e0b2f-0x0;var _0x5cf0fa=_0xb711[_0x2e0b2f];return _0x5cf0fa;};'use strict';var _=require(_0x1b71('0x0'));var util=require(_0x1b71('0x1'));var moment=require('moment');var BPromise=require(_0x1b71('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b71('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b71('0x4'))(_0x1b71('0x5'));var config=require(_0x1b71('0x6'));var jayson=require(_0x1b71('0x7'));var client=jayson[_0x1b71('0x8')][_0x1b71('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x498ed5,_0x276dff,_0x301e89){return new BPromise(function(_0xa642e0,_0xece037){return client[_0x1b71('0xa')](_0x498ed5,_0x301e89)[_0x1b71('0xb')](function(_0x5b5ba7){logger['info'](_0x1b71('0xc'),_0x276dff,_0x1b71('0xd'));logger[_0x1b71('0xe')](_0x1b71('0xf'),_0x276dff,_0x1b71('0xd'),JSON[_0x1b71('0x10')](_0x5b5ba7));if(_0x5b5ba7[_0x1b71('0x11')]){if(_0x5b5ba7['error'][_0x1b71('0x12')]===0x1f4){logger[_0x1b71('0x11')](_0x1b71('0xc'),_0x276dff,_0x5b5ba7['error'][_0x1b71('0x13')]);return _0xece037(_0x5b5ba7[_0x1b71('0x11')][_0x1b71('0x13')]);}logger[_0x1b71('0x11')](_0x1b71('0xc'),_0x276dff,_0x5b5ba7[_0x1b71('0x11')][_0x1b71('0x13')]);return _0xa642e0(_0x5b5ba7[_0x1b71('0x11')][_0x1b71('0x13')]);}else{logger[_0x1b71('0x14')](_0x1b71('0xc'),_0x276dff,'request\x20sent');_0xa642e0(_0x5b5ba7[_0x1b71('0x15')][_0x1b71('0x13')]);}})[_0x1b71('0x16')](function(_0x409816){logger[_0x1b71('0x11')](_0x1b71('0xc'),_0x276dff,_0x409816);_0xece037(_0x409816);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 86d2e82..ca6b3c1 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 _0x9c49=['multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','get','preview','/:id/run','/:id/query','post','create','put','update','destroy','exports'];(function(_0x1ebf08,_0x7a822b){var _0x1adb9d=function(_0xd4688){while(--_0xd4688){_0x1ebf08['push'](_0x1ebf08['shift']());}};_0x1adb9d(++_0x7a822b);}(_0x9c49,0x1c8));var _0x99c4=function(_0x18bf47,_0x400206){_0x18bf47=_0x18bf47-0x0;var _0x408e64=_0x9c49[_0x18bf47];return _0x408e64;};'use strict';var multer=require(_0x99c4('0x0'));var util=require(_0x99c4('0x1'));var path=require('path');var timeout=require(_0x99c4('0x2'));var express=require('express');var router=express[_0x99c4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x99c4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x99c4('0x5'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x99c4('0x6')](),controller[_0x99c4('0x7')]);router['get'](_0x99c4('0x8'),auth[_0x99c4('0x6')](),controller['show']);router[_0x99c4('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0x99c4('0xa')]);router['get'](_0x99c4('0xb'),auth[_0x99c4('0x6')](),controller['run']);router[_0x99c4('0x9')](_0x99c4('0xc'),auth[_0x99c4('0x6')](),controller['query']);router[_0x99c4('0xd')]('/',auth[_0x99c4('0x6')](),controller[_0x99c4('0xe')]);router[_0x99c4('0xf')](_0x99c4('0x8'),auth[_0x99c4('0x6')](),controller[_0x99c4('0x10')]);router['delete'](_0x99c4('0x8'),auth[_0x99c4('0x6')](),controller[_0x99c4('0x11')]);module[_0x99c4('0x12')]=router; \ No newline at end of file +var _0x19b7=['get','isAuthenticated','/:id/preview','/:id/run','run','/:id/query','query','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x19b7,0x157));var _0x719b=function(_0x47ca08,_0x3c48da){_0x47ca08=_0x47ca08-0x0;var _0x17636f=_0x19b7[_0x47ca08];return _0x17636f;};'use strict';var multer=require('multer');var util=require(_0x719b('0x0'));var path=require(_0x719b('0x1'));var timeout=require(_0x719b('0x2'));var express=require(_0x719b('0x3'));var router=express[_0x719b('0x4')]();var fs_extra=require(_0x719b('0x5'));var auth=require(_0x719b('0x6'));var interaction=require(_0x719b('0x7'));var config=require('../../config/environment');var controller=require(_0x719b('0x8'));router[_0x719b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x719b('0xa')](),controller['show']);router[_0x719b('0x9')](_0x719b('0xb'),auth[_0x719b('0xa')](),controller['preview']);router[_0x719b('0x9')](_0x719b('0xc'),auth[_0x719b('0xa')](),controller[_0x719b('0xd')]);router['get'](_0x719b('0xe'),auth[_0x719b('0xa')](),controller[_0x719b('0xf')]);router['post']('/',auth[_0x719b('0xa')](),controller[_0x719b('0x10')]);router['put'](_0x719b('0x11'),auth[_0x719b('0xa')](),controller[_0x719b('0x12')]);router[_0x719b('0x13')](_0x719b('0x11'),auth['isAuthenticated'](),controller[_0x719b('0x14')]);module[_0x719b('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 41002eb..a70434e 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 _0x3f7f=['sequelize','moment','STRING','ENUM','csv','pdf','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x49f02c,_0xaa1372){var _0x193b81=function(_0x3cc300){while(--_0x3cc300){_0x49f02c['push'](_0x49f02c['shift']());}};_0x193b81(++_0xaa1372);}(_0x3f7f,0x16b));var _0xf3f7=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3f7f[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0xf3f7('0x0'));var moment=require(_0xf3f7('0x1'));module['exports']={'name':{'type':Sequelize[_0xf3f7('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xf3f7('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xf3f7('0x3')](_0xf3f7('0x4'),_0xf3f7('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0xf3f7('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xf3f7('0x6')]},'endDate':{'type':Sequelize[_0xf3f7('0x6')]},'status':{'type':Sequelize[_0xf3f7('0x2')],'defaultValue':_0xf3f7('0x7')},'type':{'type':Sequelize['ENUM'](_0xf3f7('0x8'),_0xf3f7('0x9')),'allowNull':![],'defaultValue':_0xf3f7('0x8')},'reportId':{'type':Sequelize[_0xf3f7('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x96ad=['moment','exports','STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x27e025,_0x2264f3){var _0x563bde=function(_0x22cd55){while(--_0x22cd55){_0x27e025['push'](_0x27e025['shift']());}};_0x563bde(++_0x2264f3);}(_0x96ad,0xf0));var _0xd96a=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x96ad[_0x28a5ad];return _0x176b8a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd96a('0x0'));module[_0xd96a('0x1')]={'name':{'type':Sequelize[_0xd96a('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xd96a('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xd96a('0x3')]('csv',_0xd96a('0x4'),_0xd96a('0x5')),'allowNull':![],'defaultValue':_0xd96a('0x6')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xd96a('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0xd96a('0x8')},'type':{'type':Sequelize[_0xd96a('0x3')](_0xd96a('0x9'),_0xd96a('0xa')),'allowNull':![],'defaultValue':_0xd96a('0x9')},'reportId':{'type':Sequelize[_0xd96a('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xd96a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index f0ca3ae..2572f5f 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 _0x38dc=['output','existsSync','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','format','%s.%s','toLowerCase','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../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','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','filter','merge','where','options','includeAll','include','rows','catch','show','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename'];(function(_0x3ec641,_0x2bb3b3){var _0xf002a2=function(_0x522f70){while(--_0x522f70){_0x3ec641['push'](_0x3ec641['shift']());}};_0xf002a2(++_0x2bb3b3);}(_0x38dc,0x6b));var _0xc38d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x38dc[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc38d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc38d('0x1'));var moment=require(_0xc38d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc38d('0x3'));var util=require(_0xc38d('0x4'));var path=require(_0xc38d('0x5'));var sox=require(_0xc38d('0x6'));var csv=require(_0xc38d('0x7'));var ejs=require(_0xc38d('0x8'));var fs=require('fs');var fs_extra=require(_0xc38d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc38d('0xa'));var jsforce=require(_0xc38d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc38d('0x7'));var querystring=require(_0xc38d('0xc'));var Papa=require(_0xc38d('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc38d('0xe'));var as=require(_0xc38d('0xf'));var hardwareService=require(_0xc38d('0x10'));var logger=require(_0xc38d('0x11'))('api');var utils=require(_0xc38d('0x12'));var config=require(_0xc38d('0x13'));var licenseUtil=require(_0xc38d('0x14'));var db=require(_0xc38d('0x15'))['db'];function respondWithStatusCode(_0x2748c1,_0x29c85d){_0x29c85d=_0x29c85d||0xcc;return function(_0x5a689c){if(_0x5a689c){return _0x2748c1['sendStatus'](_0x29c85d);}return _0x2748c1[_0xc38d('0x16')](_0x29c85d)[_0xc38d('0x17')]();};}function respondWithResult(_0x19cd72,_0x1d40df){_0x1d40df=_0x1d40df||0xc8;return function(_0x2c239f){if(_0x2c239f){return _0x19cd72[_0xc38d('0x16')](_0x1d40df)[_0xc38d('0x18')](_0x2c239f);}};}function respondWithFilteredResult(_0x3460d9,_0x3aded6){return function(_0x1a78f3){if(_0x1a78f3){var _0x35864b=typeof _0x3aded6[_0xc38d('0x19')]===_0xc38d('0x1a')&&typeof _0x3aded6[_0xc38d('0x1b')]===_0xc38d('0x1a');var _0x5bd11c=_0x1a78f3[_0xc38d('0x1c')];var _0x5d4b27=_0x35864b?0x0:_0x3aded6[_0xc38d('0x19')];var _0x1d0c2b=_0x35864b?_0x1a78f3['count']:_0x3aded6[_0xc38d('0x19')]+_0x3aded6['limit'];var _0x424b74;if(_0x1d0c2b>=_0x5bd11c){_0x1d0c2b=_0x5bd11c;_0x424b74=0xc8;}else{_0x424b74=0xce;}_0x3460d9[_0xc38d('0x16')](_0x424b74);return _0x3460d9[_0xc38d('0x1d')]('Content-Range',_0x5d4b27+'-'+_0x1d0c2b+'/'+_0x5bd11c)[_0xc38d('0x18')](_0x1a78f3);}return null;};}function patchUpdates(_0x1a671f){return function(_0x1ad239){try{jsonpatch[_0xc38d('0x1e')](_0x1ad239,_0x1a671f,!![]);}catch(_0xf29bc8){return BPromise[_0xc38d('0x1f')](_0xf29bc8);}return _0x1ad239[_0xc38d('0x20')]();};}function saveUpdates(_0x4ced7f,_0x549d07){return function(_0x5b525a){if(_0x5b525a){return _0x5b525a[_0xc38d('0x21')](_0x4ced7f)[_0xc38d('0x22')](function(_0xcabdc7){return _0xcabdc7;});}return null;};}function removeEntity(_0x3a088b,_0x3c14f1){return function(_0x1fd785){if(_0x1fd785){return _0x1fd785['destroy']()['then'](function(){var _0x28a810=_0x1fd785[_0xc38d('0x23')]({'plain':!![]});var _0x26e487=_0xc38d('0x24');return db[_0xc38d('0x25')][_0xc38d('0x26')]({'where':{'type':_0x26e487,'resourceId':_0x28a810['id']}})[_0xc38d('0x22')](function(){return _0x1fd785;});})[_0xc38d('0x22')](function(){_0x3a088b[_0xc38d('0x16')](0xcc)[_0xc38d('0x17')]();});}};}function handleEntityNotFound(_0x333965,_0x40b869){return function(_0x538acb){if(!_0x538acb){_0x333965[_0xc38d('0x27')](0x194);}return _0x538acb;};}function handleError(_0x135974,_0x53152f){_0x53152f=_0x53152f||0x1f4;return function(_0x2c5612){logger[_0xc38d('0x28')](_0x2c5612[_0xc38d('0x29')]);if(_0x2c5612[_0xc38d('0x2a')]){delete _0x2c5612[_0xc38d('0x2a')];}_0x135974[_0xc38d('0x16')](_0x53152f)[_0xc38d('0x2b')](_0x2c5612);};}exports[_0xc38d('0x2c')]=function(_0x862e3,_0x493ca7){var _0x4aeada={},_0xa6f4c7={},_0x56a1b4={'count':0x0,'rows':[]};var _0x3b15d3=_[_0xc38d('0x2d')](db[_0xc38d('0x2e')][_0xc38d('0x2f')],function(_0x2f3410){return{'name':_0x2f3410[_0xc38d('0x30')],'type':_0x2f3410[_0xc38d('0x31')][_0xc38d('0x32')]};});_0xa6f4c7[_0xc38d('0x33')]=_[_0xc38d('0x2d')](_0x3b15d3,_0xc38d('0x2a'));_0xa6f4c7[_0xc38d('0x34')]=_[_0xc38d('0x35')](_0x862e3[_0xc38d('0x34')]);_0xa6f4c7[_0xc38d('0x36')]=_['intersection'](_0xa6f4c7['model'],_0xa6f4c7[_0xc38d('0x34')]);_0x4aeada[_0xc38d('0x37')]=_['intersection'](_0xa6f4c7['model'],qs['fields'](_0x862e3[_0xc38d('0x34')][_0xc38d('0x38')]));_0x4aeada[_0xc38d('0x37')]=_0x4aeada[_0xc38d('0x37')][_0xc38d('0x39')]?_0x4aeada[_0xc38d('0x37')]:_0xa6f4c7[_0xc38d('0x33')];if(!_0x862e3[_0xc38d('0x34')][_0xc38d('0x3a')]('nolimit')){_0x4aeada[_0xc38d('0x1b')]=qs[_0xc38d('0x1b')](_0x862e3[_0xc38d('0x34')][_0xc38d('0x1b')]);_0x4aeada[_0xc38d('0x19')]=qs[_0xc38d('0x19')](_0x862e3['query'][_0xc38d('0x19')]);}_0x4aeada['order']=qs['sort'](_0x862e3[_0xc38d('0x34')][_0xc38d('0x3b')]);_0x4aeada['where']=qs['filters'](_['pick'](_0x862e3[_0xc38d('0x34')],_0xa6f4c7[_0xc38d('0x36')]),_0x3b15d3);if(_0x862e3[_0xc38d('0x34')][_0xc38d('0x3c')]){_0x4aeada['where']=_[_0xc38d('0x3d')](_0x4aeada[_0xc38d('0x3e')],{'$or':_[_0xc38d('0x2d')](_0x3b15d3,function(_0x25bc4a){if(_0x25bc4a[_0xc38d('0x31')]!=='VIRTUAL'){var _0x1e1ee7={};_0x1e1ee7[_0x25bc4a['name']]={'$like':'%'+_0x862e3['query'][_0xc38d('0x3c')]+'%'};return _0x1e1ee7;}})});}_0x4aeada=_[_0xc38d('0x3d')]({},_0x4aeada,_0x862e3[_0xc38d('0x3f')]);var _0x41b919={'where':_0x4aeada['where']};return db[_0xc38d('0x2e')]['count'](_0x41b919)[_0xc38d('0x22')](function(_0x9d10a7){_0x56a1b4[_0xc38d('0x1c')]=_0x9d10a7;if(_0x862e3[_0xc38d('0x34')][_0xc38d('0x40')]){_0x4aeada[_0xc38d('0x41')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x4aeada);})['then'](function(_0x329f80){_0x56a1b4[_0xc38d('0x42')]=_0x329f80;return _0x56a1b4;})['then'](respondWithFilteredResult(_0x493ca7,_0x4aeada))[_0xc38d('0x43')](handleError(_0x493ca7,null));};exports[_0xc38d('0x44')]=function(_0x2297c9,_0x22c683){var _0x4bdf08={'raw':!![],'where':{'id':_0x2297c9[_0xc38d('0x45')]['id']}},_0x44ad38={};_0x44ad38['model']=_[_0xc38d('0x35')](db['AnalyticExtractedReport'][_0xc38d('0x2f')]);_0x44ad38[_0xc38d('0x34')]=_['keys'](_0x2297c9['query']);_0x44ad38['filters']=_['intersection'](_0x44ad38[_0xc38d('0x33')],_0x44ad38['query']);_0x4bdf08[_0xc38d('0x37')]=_[_0xc38d('0x46')](_0x44ad38[_0xc38d('0x33')],qs['fields'](_0x2297c9['query'][_0xc38d('0x38')]));_0x4bdf08['attributes']=_0x4bdf08['attributes']['length']?_0x4bdf08[_0xc38d('0x37')]:_0x44ad38[_0xc38d('0x33')];if(_0x2297c9['query']['includeAll']){_0x4bdf08[_0xc38d('0x41')]=[{'all':!![]}];}_0x4bdf08=_[_0xc38d('0x3d')]({},_0x4bdf08,_0x2297c9[_0xc38d('0x3f')]);return db[_0xc38d('0x2e')]['find'](_0x4bdf08)[_0xc38d('0x22')](handleEntityNotFound(_0x22c683,null))[_0xc38d('0x22')](respondWithResult(_0x22c683,null))[_0xc38d('0x43')](handleError(_0x22c683,null));};exports[_0xc38d('0x47')]=function(_0x59e975,_0x19d6bd){return db[_0xc38d('0x2e')][_0xc38d('0x47')](_0x59e975[_0xc38d('0x48')],{})[_0xc38d('0x22')](function(_0x2072c2){var _0x1177a6=_0x59e975[_0xc38d('0x49')][_0xc38d('0x23')]({'plain':!![]});if(!_0x1177a6)throw new Error(_0xc38d('0x4a'));if(_0x1177a6[_0xc38d('0x4b')]===_0xc38d('0x49')){var _0x2fb257=_0x2072c2[_0xc38d('0x23')]({'plain':!![]});var _0x36a18a='ExtractedReports';return db[_0xc38d('0x4c')][_0xc38d('0x4d')]({'where':{'name':_0x36a18a,'userProfileId':_0x1177a6[_0xc38d('0x4e')]},'raw':!![]})[_0xc38d('0x22')](function(_0x55f06a){if(_0x55f06a&&_0x55f06a[_0xc38d('0x4f')]===0x0){return db['UserProfileResource'][_0xc38d('0x47')]({'name':_0x2fb257[_0xc38d('0x2a')],'resourceId':_0x2fb257['id'],'type':_0x55f06a['name'],'sectionId':_0x55f06a['id']},{})[_0xc38d('0x22')](function(){return _0x2072c2;});}else{return _0x2072c2;}})[_0xc38d('0x43')](function(_0x46627a){logger[_0xc38d('0x28')](_0xc38d('0x50'),_0x46627a);throw _0x46627a;});}return _0x2072c2;})[_0xc38d('0x22')](respondWithResult(_0x19d6bd,0xc9))['catch'](handleError(_0x19d6bd,null));};exports[_0xc38d('0x21')]=function(_0x181ae8,_0x2f0179){if(_0x181ae8[_0xc38d('0x48')]['id']){delete _0x181ae8[_0xc38d('0x48')]['id'];}return db[_0xc38d('0x2e')]['find']({'where':{'id':_0x181ae8[_0xc38d('0x45')]['id']}})[_0xc38d('0x22')](handleEntityNotFound(_0x2f0179,null))['then'](saveUpdates(_0x181ae8[_0xc38d('0x48')],null))['then'](respondWithResult(_0x2f0179,null))[_0xc38d('0x43')](handleError(_0x2f0179,null));};exports[_0xc38d('0x26')]=function(_0x5661d5,_0x48c19d){return db[_0xc38d('0x2e')][_0xc38d('0x4d')]({'where':{'id':_0x5661d5[_0xc38d('0x45')]['id']}})['then'](handleEntityNotFound(_0x48c19d,null))[_0xc38d('0x22')](removeEntity(_0x48c19d,null))[_0xc38d('0x43')](handleError(_0x48c19d,null));};exports[_0xc38d('0x51')]=function(_0x1966ca,_0x59ca25,_0x3f5cef){return db[_0xc38d('0x2e')][_0xc38d('0x4d')]({'where':{'id':_0x1966ca[_0xc38d('0x45')]['id']},'attributes':[_0xc38d('0x2a'),_0xc38d('0x52'),'savename',_0xc38d('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x59ca25,null))[_0xc38d('0x22')](function(_0x3fd820){if(_0x3fd820){if(!fs[_0xc38d('0x54')](path['join'](config[_0xc38d('0x55')],_0xc38d('0x56'),_0x3fd820[_0xc38d('0x57')]))){throw new db[(_0xc38d('0x58'))][(_0xc38d('0x59'))](_0xc38d('0x5a'));}if(_0x1966ca[_0xc38d('0x34')]['exists']){return _0x59ca25[_0xc38d('0x27')](0xc8);}return _0x59ca25[_0xc38d('0x51')](path[_0xc38d('0x5b')](config['root'],'server/files/reports',_0x3fd820[_0xc38d('0x57')]),util[_0xc38d('0x5c')](_0xc38d('0x5d'),_0x3fd820[_0xc38d('0x52')]||_0x3fd820[_0xc38d('0x2a')],_0x3fd820[_0xc38d('0x53')][_0xc38d('0x5e')]()));}})[_0xc38d('0x43')](handleError(_0x59ca25,null));}; \ No newline at end of file +var _0x4f68=['savename','output','existsSync','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','%s.%s','toLowerCase','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','error','name','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','download'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x4f68,0x11e));var _0x84f6=function(_0x240449,_0x512fd9){_0x240449=_0x240449-0x0;var _0x1ac45e=_0x4f68[_0x240449];return _0x1ac45e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x84f6('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84f6('0x1'));var moment=require('moment');var BPromise=require(_0x84f6('0x2'));var Mustache=require(_0x84f6('0x3'));var util=require('util');var path=require(_0x84f6('0x4'));var sox=require(_0x84f6('0x5'));var csv=require(_0x84f6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84f6('0x7'));var _=require(_0x84f6('0x8'));var squel=require(_0x84f6('0x9'));var crypto=require(_0x84f6('0xa'));var jsforce=require(_0x84f6('0xb'));var deskjs=require(_0x84f6('0xc'));var toCsv=require(_0x84f6('0x6'));var querystring=require(_0x84f6('0xd'));var Papa=require(_0x84f6('0xe'));var Redis=require('ioredis');var authService=require(_0x84f6('0xf'));var qs=require(_0x84f6('0x10'));var as=require(_0x84f6('0x11'));var hardwareService=require(_0x84f6('0x12'));var logger=require(_0x84f6('0x13'))(_0x84f6('0x14'));var utils=require(_0x84f6('0x15'));var config=require(_0x84f6('0x16'));var licenseUtil=require(_0x84f6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b4d37,_0x418809){_0x418809=_0x418809||0xcc;return function(_0xbcaad7){if(_0xbcaad7){return _0x1b4d37[_0x84f6('0x18')](_0x418809);}return _0x1b4d37[_0x84f6('0x19')](_0x418809)[_0x84f6('0x1a')]();};}function respondWithResult(_0x39699d,_0x4a5733){_0x4a5733=_0x4a5733||0xc8;return function(_0x4b349c){if(_0x4b349c){return _0x39699d['status'](_0x4a5733)[_0x84f6('0x1b')](_0x4b349c);}};}function respondWithFilteredResult(_0x578c81,_0x54adbb){return function(_0x139374){if(_0x139374){var _0x288066=typeof _0x54adbb[_0x84f6('0x1c')]==='undefined'&&typeof _0x54adbb[_0x84f6('0x1d')]==='undefined';var _0x32115f=_0x139374['count'];var _0x15c6bb=_0x288066?0x0:_0x54adbb['offset'];var _0x3d1cec=_0x288066?_0x139374[_0x84f6('0x1e')]:_0x54adbb[_0x84f6('0x1c')]+_0x54adbb[_0x84f6('0x1d')];var _0x1fd074;if(_0x3d1cec>=_0x32115f){_0x3d1cec=_0x32115f;_0x1fd074=0xc8;}else{_0x1fd074=0xce;}_0x578c81[_0x84f6('0x19')](_0x1fd074);return _0x578c81[_0x84f6('0x1f')](_0x84f6('0x20'),_0x15c6bb+'-'+_0x3d1cec+'/'+_0x32115f)[_0x84f6('0x1b')](_0x139374);}return null;};}function patchUpdates(_0x37abb8){return function(_0x224b15){try{jsonpatch[_0x84f6('0x21')](_0x224b15,_0x37abb8,!![]);}catch(_0x18316e){return BPromise[_0x84f6('0x22')](_0x18316e);}return _0x224b15['save']();};}function saveUpdates(_0x176abe,_0x4c1f33){return function(_0x38b7eb){if(_0x38b7eb){return _0x38b7eb[_0x84f6('0x23')](_0x176abe)[_0x84f6('0x24')](function(_0x392bf3){return _0x392bf3;});}return null;};}function removeEntity(_0x24c011,_0x2d7733){return function(_0x3aff59){if(_0x3aff59){return _0x3aff59[_0x84f6('0x25')]()['then'](function(){var _0x57cd1a=_0x3aff59[_0x84f6('0x26')]({'plain':!![]});var _0x1f07c3='ExtractedReports';return db['UserProfileResource'][_0x84f6('0x25')]({'where':{'type':_0x1f07c3,'resourceId':_0x57cd1a['id']}})[_0x84f6('0x24')](function(){return _0x3aff59;});})[_0x84f6('0x24')](function(){_0x24c011['status'](0xcc)[_0x84f6('0x1a')]();});}};}function handleEntityNotFound(_0x3c7162,_0x43f65f){return function(_0x45d494){if(!_0x45d494){_0x3c7162[_0x84f6('0x18')](0x194);}return _0x45d494;};}function handleError(_0x4dfcbe,_0x31f460){_0x31f460=_0x31f460||0x1f4;return function(_0x5ce0b2){logger[_0x84f6('0x27')](_0x5ce0b2['stack']);if(_0x5ce0b2[_0x84f6('0x28')]){delete _0x5ce0b2[_0x84f6('0x28')];}_0x4dfcbe[_0x84f6('0x19')](_0x31f460)['send'](_0x5ce0b2);};}exports[_0x84f6('0x29')]=function(_0x2041a8,_0x52bc59){var _0x1e9c81={},_0x587386={},_0x229dd7={'count':0x0,'rows':[]};var _0x3ece71=_[_0x84f6('0x2a')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x27ed1d){return{'name':_0x27ed1d[_0x84f6('0x2b')],'type':_0x27ed1d['type']['key']};});_0x587386[_0x84f6('0x2c')]=_[_0x84f6('0x2a')](_0x3ece71,_0x84f6('0x28'));_0x587386[_0x84f6('0x2d')]=_[_0x84f6('0x2e')](_0x2041a8[_0x84f6('0x2d')]);_0x587386[_0x84f6('0x2f')]=_[_0x84f6('0x30')](_0x587386[_0x84f6('0x2c')],_0x587386[_0x84f6('0x2d')]);_0x1e9c81[_0x84f6('0x31')]=_[_0x84f6('0x30')](_0x587386[_0x84f6('0x2c')],qs[_0x84f6('0x32')](_0x2041a8[_0x84f6('0x2d')]['fields']));_0x1e9c81[_0x84f6('0x31')]=_0x1e9c81['attributes'][_0x84f6('0x33')]?_0x1e9c81[_0x84f6('0x31')]:_0x587386['model'];if(!_0x2041a8[_0x84f6('0x2d')][_0x84f6('0x34')](_0x84f6('0x35'))){_0x1e9c81[_0x84f6('0x1d')]=qs[_0x84f6('0x1d')](_0x2041a8[_0x84f6('0x2d')]['limit']);_0x1e9c81['offset']=qs['offset'](_0x2041a8[_0x84f6('0x2d')]['offset']);}_0x1e9c81[_0x84f6('0x36')]=qs[_0x84f6('0x37')](_0x2041a8[_0x84f6('0x2d')][_0x84f6('0x37')]);_0x1e9c81[_0x84f6('0x38')]=qs['filters'](_[_0x84f6('0x39')](_0x2041a8[_0x84f6('0x2d')],_0x587386['filters']),_0x3ece71);if(_0x2041a8['query'][_0x84f6('0x3a')]){_0x1e9c81[_0x84f6('0x38')]=_['merge'](_0x1e9c81[_0x84f6('0x38')],{'$or':_[_0x84f6('0x2a')](_0x3ece71,function(_0x8e5d56){if(_0x8e5d56[_0x84f6('0x3b')]!==_0x84f6('0x3c')){var _0x1757c8={};_0x1757c8[_0x8e5d56[_0x84f6('0x28')]]={'$like':'%'+_0x2041a8[_0x84f6('0x2d')]['filter']+'%'};return _0x1757c8;}})});}_0x1e9c81=_[_0x84f6('0x3d')]({},_0x1e9c81,_0x2041a8['options']);var _0x267eb7={'where':_0x1e9c81['where']};return db[_0x84f6('0x3e')][_0x84f6('0x1e')](_0x267eb7)['then'](function(_0x2b964f){_0x229dd7['count']=_0x2b964f;if(_0x2041a8['query'][_0x84f6('0x3f')]){_0x1e9c81[_0x84f6('0x40')]=[{'all':!![]}];}return db[_0x84f6('0x3e')][_0x84f6('0x41')](_0x1e9c81);})[_0x84f6('0x24')](function(_0x168b73){_0x229dd7[_0x84f6('0x42')]=_0x168b73;return _0x229dd7;})[_0x84f6('0x24')](respondWithFilteredResult(_0x52bc59,_0x1e9c81))[_0x84f6('0x43')](handleError(_0x52bc59,null));};exports[_0x84f6('0x44')]=function(_0x27a695,_0x42e78a){var _0xed11a4={'raw':!![],'where':{'id':_0x27a695['params']['id']}},_0x5df5b6={};_0x5df5b6[_0x84f6('0x2c')]=_[_0x84f6('0x2e')](db['AnalyticExtractedReport'][_0x84f6('0x45')]);_0x5df5b6[_0x84f6('0x2d')]=_[_0x84f6('0x2e')](_0x27a695[_0x84f6('0x2d')]);_0x5df5b6['filters']=_['intersection'](_0x5df5b6[_0x84f6('0x2c')],_0x5df5b6['query']);_0xed11a4[_0x84f6('0x31')]=_[_0x84f6('0x30')](_0x5df5b6[_0x84f6('0x2c')],qs[_0x84f6('0x32')](_0x27a695[_0x84f6('0x2d')]['fields']));_0xed11a4[_0x84f6('0x31')]=_0xed11a4[_0x84f6('0x31')]['length']?_0xed11a4['attributes']:_0x5df5b6['model'];if(_0x27a695[_0x84f6('0x2d')][_0x84f6('0x3f')]){_0xed11a4[_0x84f6('0x40')]=[{'all':!![]}];}_0xed11a4=_[_0x84f6('0x3d')]({},_0xed11a4,_0x27a695['options']);return db[_0x84f6('0x3e')][_0x84f6('0x46')](_0xed11a4)[_0x84f6('0x24')](handleEntityNotFound(_0x42e78a,null))[_0x84f6('0x24')](respondWithResult(_0x42e78a,null))[_0x84f6('0x43')](handleError(_0x42e78a,null));};exports['create']=function(_0x4ae3a0,_0x239dc4){return db[_0x84f6('0x3e')][_0x84f6('0x47')](_0x4ae3a0[_0x84f6('0x48')],{})[_0x84f6('0x24')](function(_0x490e59){var _0x462074=_0x4ae3a0[_0x84f6('0x49')][_0x84f6('0x26')]({'plain':!![]});if(!_0x462074)throw new Error(_0x84f6('0x4a'));if(_0x462074[_0x84f6('0x4b')]===_0x84f6('0x49')){var _0x4016f1=_0x490e59['get']({'plain':!![]});var _0x3f0a2c='ExtractedReports';return db[_0x84f6('0x4c')][_0x84f6('0x46')]({'where':{'name':_0x3f0a2c,'userProfileId':_0x462074[_0x84f6('0x4d')]},'raw':!![]})[_0x84f6('0x24')](function(_0xdca0a8){if(_0xdca0a8&&_0xdca0a8[_0x84f6('0x4e')]===0x0){return db[_0x84f6('0x4f')][_0x84f6('0x47')]({'name':_0x4016f1[_0x84f6('0x28')],'resourceId':_0x4016f1['id'],'type':_0xdca0a8[_0x84f6('0x28')],'sectionId':_0xdca0a8['id']},{})[_0x84f6('0x24')](function(){return _0x490e59;});}else{return _0x490e59;}})['catch'](function(_0xb3b3a8){logger[_0x84f6('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb3b3a8);throw _0xb3b3a8;});}return _0x490e59;})[_0x84f6('0x24')](respondWithResult(_0x239dc4,0xc9))[_0x84f6('0x43')](handleError(_0x239dc4,null));};exports['update']=function(_0x592e7a,_0x30a83b){if(_0x592e7a['body']['id']){delete _0x592e7a[_0x84f6('0x48')]['id'];}return db[_0x84f6('0x3e')][_0x84f6('0x46')]({'where':{'id':_0x592e7a[_0x84f6('0x50')]['id']}})[_0x84f6('0x24')](handleEntityNotFound(_0x30a83b,null))[_0x84f6('0x24')](saveUpdates(_0x592e7a['body'],null))[_0x84f6('0x24')](respondWithResult(_0x30a83b,null))['catch'](handleError(_0x30a83b,null));};exports[_0x84f6('0x25')]=function(_0x1b189e,_0x5ec9c6){return db['AnalyticExtractedReport'][_0x84f6('0x46')]({'where':{'id':_0x1b189e['params']['id']}})[_0x84f6('0x24')](handleEntityNotFound(_0x5ec9c6,null))[_0x84f6('0x24')](removeEntity(_0x5ec9c6,null))['catch'](handleError(_0x5ec9c6,null));};exports[_0x84f6('0x51')]=function(_0x10b357,_0x1e1e61,_0xd81e42){return db[_0x84f6('0x3e')][_0x84f6('0x46')]({'where':{'id':_0x10b357[_0x84f6('0x50')]['id']},'attributes':[_0x84f6('0x28'),'basename',_0x84f6('0x52'),_0x84f6('0x53')],'raw':!![]})[_0x84f6('0x24')](handleEntityNotFound(_0x1e1e61,null))[_0x84f6('0x24')](function(_0x551a43){if(_0x551a43){if(!fs[_0x84f6('0x54')](path['join'](config[_0x84f6('0x55')],'server/files/reports',_0x551a43[_0x84f6('0x52')]))){throw new db[(_0x84f6('0x56'))]['ValidationError'](_0x84f6('0x57'));}if(_0x10b357[_0x84f6('0x2d')][_0x84f6('0x58')]){return _0x1e1e61[_0x84f6('0x18')](0xc8);}return _0x1e1e61[_0x84f6('0x51')](path['join'](config[_0x84f6('0x55')],_0x84f6('0x59'),_0x551a43[_0x84f6('0x52')]),util['format'](_0x84f6('0x5a'),_0x551a43['basename']||_0x551a43[_0x84f6('0x28')],_0x551a43['output'][_0x84f6('0x5b')]()));}})[_0x84f6('0x43')](handleError(_0x1e1e61,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index ca64a8e..0351209 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 _0xe91b=['../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x119ef1,_0x17c4e5){var _0x33fcc5=function(_0x3fada2){while(--_0x3fada2){_0x119ef1['push'](_0x119ef1['shift']());}};_0x33fcc5(++_0x17c4e5);}(_0xe91b,0x101));var _0xbe91=function(_0x467cb0,_0x303070){_0x467cb0=_0x467cb0-0x0;var _0x2153f7=_0xe91b[_0x467cb0];return _0x2153f7;};'use strict';var _=require(_0xbe91('0x0'));var util=require(_0xbe91('0x1'));var logger=require(_0xbe91('0x2'))(_0xbe91('0x3'));var moment=require(_0xbe91('0x4'));var BPromise=require(_0xbe91('0x5'));var rp=require(_0xbe91('0x6'));var fs=require('fs');var path=require(_0xbe91('0x7'));var rimraf=require(_0xbe91('0x8'));var config=require(_0xbe91('0x9'));var attributes=require(_0xbe91('0xa'));module[_0xbe91('0xb')]=function(_0x339b24,_0x5774bf){return _0x339b24[_0xbe91('0xc')]('AnalyticExtractedReport',attributes,{'tableName':_0xbe91('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c6e=['path','../../config/environment','exports','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','bluebird'];(function(_0x78cdea,_0x4d7fdc){var _0x4bf7da=function(_0x138a32){while(--_0x138a32){_0x78cdea['push'](_0x78cdea['shift']());}};_0x4bf7da(++_0x4d7fdc);}(_0x0c6e,0x116));var _0xe0c6=function(_0xf6cba6,_0x1d5375){_0xf6cba6=_0xf6cba6-0x0;var _0x5315c8=_0x0c6e[_0xf6cba6];return _0x5315c8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe0c6('0x0'))('api');var moment=require('moment');var BPromise=require(_0xe0c6('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0c6('0x2'));var rimraf=require('rimraf');var config=require(_0xe0c6('0x3'));var attributes=require('./analyticExtractedReport.attributes');module[_0xe0c6('0x4')]=function(_0x574c2b,_0x36dda1){return _0x574c2b['define'](_0xe0c6('0x5'),attributes,{'tableName':_0xe0c6('0x6'),'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 d8acdd4..27ad509 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 _0xa9ba=['stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent'];(function(_0x7a97e0,_0x24151f){var _0x180320=function(_0x33b1d1){while(--_0x33b1d1){_0x7a97e0['push'](_0x7a97e0['shift']());}};_0x180320(++_0x24151f);}(_0xa9ba,0x16e));var _0xaa9b=function(_0x9d7196,_0x2155ab){_0x9d7196=_0x9d7196-0x0;var _0x15a2eb=_0xa9ba[_0x9d7196];return _0x15a2eb;};'use strict';var _=require('lodash');var util=require(_0xaa9b('0x0'));var moment=require(_0xaa9b('0x1'));var BPromise=require(_0xaa9b('0x2'));var rs=require(_0xaa9b('0x3'));var fs=require('fs');var Redis=require(_0xaa9b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa9b('0x5'));var logger=require(_0xaa9b('0x6'))(_0xaa9b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaa9b('0x8')][_0xaa9b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd0d065,_0x56f41d,_0x3cc80f){return new BPromise(function(_0x18f8fd,_0x4638f2){return client[_0xaa9b('0xa')](_0xd0d065,_0x3cc80f)['then'](function(_0x4b338d){logger[_0xaa9b('0xb')](_0xaa9b('0xc'),_0x56f41d,'request\x20sent');logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x56f41d,_0xaa9b('0xd'),JSON[_0xaa9b('0xe')](_0x4b338d));if(_0x4b338d[_0xaa9b('0xf')]){if(_0x4b338d[_0xaa9b('0xf')]['code']===0x1f4){logger[_0xaa9b('0xf')](_0xaa9b('0xc'),_0x56f41d,_0x4b338d[_0xaa9b('0xf')]['message']);return _0x4638f2(_0x4b338d['error'][_0xaa9b('0x10')]);}logger[_0xaa9b('0xf')](_0xaa9b('0xc'),_0x56f41d,_0x4b338d[_0xaa9b('0xf')][_0xaa9b('0x10')]);return _0x18f8fd(_0x4b338d['error'][_0xaa9b('0x10')]);}else{logger[_0xaa9b('0xb')](_0xaa9b('0xc'),_0x56f41d,_0xaa9b('0xd'));_0x18f8fd(_0x4b338d[_0xaa9b('0x11')][_0xaa9b('0x10')]);}})[_0xaa9b('0x12')](function(_0x26fa6d){logger['error'](_0xaa9b('0xc'),_0x56f41d,_0x26fa6d);_0x4638f2(_0x26fa6d);});});} \ No newline at end of file +var _0x889d=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x346f62,_0x5079bc){var _0x1783a8=function(_0x3dca5e){while(--_0x3dca5e){_0x346f62['push'](_0x346f62['shift']());}};_0x1783a8(++_0x5079bc);}(_0x889d,0x64));var _0xd889=function(_0x181a7b,_0x45b715){_0x181a7b=_0x181a7b-0x0;var _0x2344d4=_0x889d[_0x181a7b];return _0x2344d4;};'use strict';var _=require(_0xd889('0x0'));var util=require(_0xd889('0x1'));var moment=require(_0xd889('0x2'));var BPromise=require(_0xd889('0x3'));var rs=require(_0xd889('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd889('0x5'))['db'];var utils=require(_0xd889('0x6'));var logger=require('../../config/logger')(_0xd889('0x7'));var config=require(_0xd889('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd889('0x9')][_0xd889('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48d516,_0x296269,_0x5bb6f9){return new BPromise(function(_0x494685,_0x37391a){return client[_0xd889('0xb')](_0x48d516,_0x5bb6f9)[_0xd889('0xc')](function(_0x4671a0){logger['info'](_0xd889('0xd'),_0x296269,'request\x20sent');logger['debug'](_0xd889('0xe'),_0x296269,_0xd889('0xf'),JSON['stringify'](_0x4671a0));if(_0x4671a0[_0xd889('0x10')]){if(_0x4671a0[_0xd889('0x10')]['code']===0x1f4){logger[_0xd889('0x10')](_0xd889('0xd'),_0x296269,_0x4671a0['error'][_0xd889('0x11')]);return _0x37391a(_0x4671a0[_0xd889('0x10')][_0xd889('0x11')]);}logger['error'](_0xd889('0xd'),_0x296269,_0x4671a0['error'][_0xd889('0x11')]);return _0x494685(_0x4671a0[_0xd889('0x10')][_0xd889('0x11')]);}else{logger[_0xd889('0x12')](_0xd889('0xd'),_0x296269,'request\x20sent');_0x494685(_0x4671a0[_0xd889('0x13')][_0xd889('0x11')]);}})[_0xd889('0x14')](function(_0xb6a4de){logger[_0xd889('0x10')](_0xd889('0xd'),_0x296269,_0xb6a4de);_0x37391a(_0xb6a4de);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 16dffc5..cab2f5a 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 _0x4b45=['show','/:id/download','download','post','/:id','update','destroy','exports','util','path','connect-timeout','Router','get','isAuthenticated'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x4b45,0x19e));var _0x54b4=function(_0x47a618,_0x1252bc){_0x47a618=_0x47a618-0x0;var _0x5840f5=_0x4b45[_0x47a618];return _0x5840f5;};'use strict';var multer=require('multer');var util=require(_0x54b4('0x0'));var path=require(_0x54b4('0x1'));var timeout=require(_0x54b4('0x2'));var express=require('express');var router=express[_0x54b4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x54b4('0x4')]('/',auth[_0x54b4('0x5')](),controller['index']);router[_0x54b4('0x4')]('/:id',auth[_0x54b4('0x5')](),controller[_0x54b4('0x6')]);router[_0x54b4('0x4')](_0x54b4('0x7'),auth[_0x54b4('0x5')](),controller[_0x54b4('0x8')]);router[_0x54b4('0x9')]('/',auth[_0x54b4('0x5')](),controller['create']);router['put'](_0x54b4('0xa'),auth[_0x54b4('0x5')](),controller[_0x54b4('0xb')]);router['delete'](_0x54b4('0xa'),auth[_0x54b4('0x5')](),controller[_0x54b4('0xc')]);module[_0x54b4('0xd')]=router; \ No newline at end of file +var _0x1fbe=['../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','/:id/download','download','post','create','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x1fbe,0x14d));var _0xe1fb=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x1fbe[_0x1044e5];return _0x5ad0dd;};'use strict';var multer=require(_0xe1fb('0x0'));var util=require('util');var path=require(_0xe1fb('0x1'));var timeout=require(_0xe1fb('0x2'));var express=require(_0xe1fb('0x3'));var router=express[_0xe1fb('0x4')]();var fs_extra=require(_0xe1fb('0x5'));var auth=require(_0xe1fb('0x6'));var interaction=require(_0xe1fb('0x7'));var config=require(_0xe1fb('0x8'));var controller=require(_0xe1fb('0x9'));router['get']('/',auth[_0xe1fb('0xa')](),controller[_0xe1fb('0xb')]);router[_0xe1fb('0xc')](_0xe1fb('0xd'),auth[_0xe1fb('0xa')](),controller['show']);router[_0xe1fb('0xc')](_0xe1fb('0xe'),auth['isAuthenticated'](),controller[_0xe1fb('0xf')]);router[_0xe1fb('0x10')]('/',auth['isAuthenticated'](),controller[_0xe1fb('0x11')]);router['put'](_0xe1fb('0xd'),auth[_0xe1fb('0xa')](),controller['update']);router[_0xe1fb('0x12')](_0xe1fb('0xd'),auth[_0xe1fb('0xa')](),controller['destroy']);module[_0xe1fb('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e466d93..6bf683c 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 _0xd102=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd102,0xf8));var _0x2d10=function(_0x4fab09,_0x2e343b){_0x4fab09=_0x4fab09-0x0;var _0xf457df=_0xd102[_0x4fab09];return _0xf457df;};'use strict';var Sequelize=require(_0x2d10('0x0'));module[_0x2d10('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x2d10('0x2')]},'format':{'type':Sequelize[_0x2d10('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x2d10('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x956e=['BOOLEAN','exports','STRING'];(function(_0x2c4292,_0x39be32){var _0x50fff0=function(_0x178ee){while(--_0x178ee){_0x2c4292['push'](_0x2c4292['shift']());}};_0x50fff0(++_0x39be32);}(_0x956e,0x1e4));var _0xe956=function(_0x296923,_0x4adaed){_0x296923=_0x296923-0x0;var _0x29af70=_0x956e[_0x296923];return _0x29af70;};'use strict';var Sequelize=require('sequelize');module[_0xe956('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xe956('0x1')]},'format':{'type':Sequelize[_0xe956('0x1')]},'groupBy':{'type':Sequelize[_0xe956('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xe956('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index e59b12c..e7f3074 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 _0x19ee=['bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','findAll','rows','catch','show','params','include','create','body','bulkCreate','find','bulkDestroy','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir'];(function(_0x4bc56e,_0x4f2fc0){var _0x29c230=function(_0x2068d2){while(--_0x2068d2){_0x4bc56e['push'](_0x4bc56e['shift']());}};_0x29c230(++_0x4f2fc0);}(_0x19ee,0xe1));var _0xe19e=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0x19ee[_0x118afa];return _0x167d76;};'use strict';var emlformat=require(_0xe19e('0x0'));var rimraf=require(_0xe19e('0x1'));var zipdir=require(_0xe19e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe19e('0x3'));var Mustache=require(_0xe19e('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe19e('0x5'));var csv=require('to-csv');var ejs=require(_0xe19e('0x6'));var fs=require('fs');var fs_extra=require(_0xe19e('0x7'));var _=require(_0xe19e('0x8'));var squel=require('squel');var crypto=require(_0xe19e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe19e('0xa'));var toCsv=require(_0xe19e('0xb'));var querystring=require(_0xe19e('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe19e('0xd'))(_0xe19e('0xe'));var utils=require('../../config/utils');var config=require(_0xe19e('0xf'));var licenseUtil=require(_0xe19e('0x10'));var db=require(_0xe19e('0x11'))['db'];function respondWithStatusCode(_0x3ab8df,_0x32585e){_0x32585e=_0x32585e||0xcc;return function(_0xe4e142){if(_0xe4e142){return _0x3ab8df[_0xe19e('0x12')](_0x32585e);}return _0x3ab8df['status'](_0x32585e)[_0xe19e('0x13')]();};}function respondWithResult(_0x371e43,_0x3e3152){_0x3e3152=_0x3e3152||0xc8;return function(_0x597f6e){if(_0x597f6e){return _0x371e43[_0xe19e('0x14')](_0x3e3152)[_0xe19e('0x15')](_0x597f6e);}};}function respondWithFilteredResult(_0x46e3d1,_0x394144){return function(_0x12c0ba){if(_0x12c0ba){var _0x3a066d=typeof _0x394144['offset']===_0xe19e('0x16')&&typeof _0x394144[_0xe19e('0x17')]===_0xe19e('0x16');var _0x5401c7=_0x12c0ba[_0xe19e('0x18')];var _0x2b5095=_0x3a066d?0x0:_0x394144[_0xe19e('0x19')];var _0x48617e=_0x3a066d?_0x12c0ba['count']:_0x394144['offset']+_0x394144['limit'];var _0x3f0051;if(_0x48617e>=_0x5401c7){_0x48617e=_0x5401c7;_0x3f0051=0xc8;}else{_0x3f0051=0xce;}_0x46e3d1[_0xe19e('0x14')](_0x3f0051);return _0x46e3d1[_0xe19e('0x1a')](_0xe19e('0x1b'),_0x2b5095+'-'+_0x48617e+'/'+_0x5401c7)['json'](_0x12c0ba);}return null;};}function patchUpdates(_0x573c5b){return function(_0x172319){try{jsonpatch[_0xe19e('0x1c')](_0x172319,_0x573c5b,!![]);}catch(_0xcb19c4){return BPromise[_0xe19e('0x1d')](_0xcb19c4);}return _0x172319[_0xe19e('0x1e')]();};}function saveUpdates(_0x17d568,_0x423020){return function(_0x17a621){if(_0x17a621){return _0x17a621['update'](_0x17d568)['then'](function(_0x550c42){return _0x550c42;});}return null;};}function removeEntity(_0x483901,_0x3b8d65){return function(_0x1fee81){if(_0x1fee81){return _0x1fee81[_0xe19e('0x1f')]()[_0xe19e('0x20')](function(){_0x483901[_0xe19e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x101899,_0x2b2a09){return function(_0x25840a){if(!_0x25840a){_0x101899[_0xe19e('0x12')](0x194);}return _0x25840a;};}function handleError(_0xd5e757,_0xd8cffb){_0xd8cffb=_0xd8cffb||0x1f4;return function(_0x14ca7d){logger[_0xe19e('0x21')](_0x14ca7d[_0xe19e('0x22')]);if(_0x14ca7d[_0xe19e('0x23')]){delete _0x14ca7d[_0xe19e('0x23')];}_0xd5e757['status'](_0xd8cffb)[_0xe19e('0x24')](_0x14ca7d);};}exports[_0xe19e('0x25')]=function(_0x1bb022,_0x515c3f){var _0x3f0145={},_0x4bf47a={},_0x5d4541={'count':0x0,'rows':[]};var _0x40160d=_[_0xe19e('0x26')](db[_0xe19e('0x27')][_0xe19e('0x28')],function(_0x2d85ed){return{'name':_0x2d85ed[_0xe19e('0x29')],'type':_0x2d85ed['type'][_0xe19e('0x2a')]};});_0x4bf47a['model']=_[_0xe19e('0x26')](_0x40160d,_0xe19e('0x23'));_0x4bf47a[_0xe19e('0x2b')]=_[_0xe19e('0x2c')](_0x1bb022['query']);_0x4bf47a[_0xe19e('0x2d')]=_[_0xe19e('0x2e')](_0x4bf47a['model'],_0x4bf47a['query']);_0x3f0145['attributes']=_[_0xe19e('0x2e')](_0x4bf47a[_0xe19e('0x2f')],qs['fields'](_0x1bb022['query'][_0xe19e('0x30')]));_0x3f0145[_0xe19e('0x31')]=_0x3f0145[_0xe19e('0x31')][_0xe19e('0x32')]?_0x3f0145['attributes']:_0x4bf47a[_0xe19e('0x2f')];if(!_0x1bb022[_0xe19e('0x2b')]['hasOwnProperty'](_0xe19e('0x33'))){_0x3f0145[_0xe19e('0x17')]=qs['limit'](_0x1bb022[_0xe19e('0x2b')]['limit']);_0x3f0145[_0xe19e('0x19')]=qs[_0xe19e('0x19')](_0x1bb022[_0xe19e('0x2b')][_0xe19e('0x19')]);}_0x3f0145[_0xe19e('0x34')]=qs[_0xe19e('0x35')](_0x1bb022[_0xe19e('0x2b')]['sort']);_0x3f0145[_0xe19e('0x36')]=qs[_0xe19e('0x2d')](_[_0xe19e('0x37')](_0x1bb022[_0xe19e('0x2b')],_0x4bf47a[_0xe19e('0x2d')]),_0x40160d);if(_0x1bb022['query'][_0xe19e('0x38')]){_0x3f0145[_0xe19e('0x36')]=_[_0xe19e('0x39')](_0x3f0145[_0xe19e('0x36')],{'$or':_[_0xe19e('0x26')](_0x40160d,function(_0x4c4a8e){if(_0x4c4a8e[_0xe19e('0x3a')]!=='VIRTUAL'){var _0x4f66f4={};_0x4f66f4[_0x4c4a8e[_0xe19e('0x23')]]={'$like':'%'+_0x1bb022[_0xe19e('0x2b')]['filter']+'%'};return _0x4f66f4;}})});}_0x3f0145=_['merge']({},_0x3f0145,_0x1bb022[_0xe19e('0x3b')]);var _0x80b663={'where':_0x3f0145[_0xe19e('0x36')]};return db[_0xe19e('0x27')][_0xe19e('0x18')](_0x80b663)[_0xe19e('0x20')](function(_0x1a1e04){_0x5d4541[_0xe19e('0x18')]=_0x1a1e04;if(_0x1bb022[_0xe19e('0x2b')]['includeAll']){_0x3f0145['include']=[{'all':!![]}];}return db[_0xe19e('0x27')][_0xe19e('0x3c')](_0x3f0145);})[_0xe19e('0x20')](function(_0x7070ee){_0x5d4541[_0xe19e('0x3d')]=_0x7070ee;return _0x5d4541;})['then'](respondWithFilteredResult(_0x515c3f,_0x3f0145))[_0xe19e('0x3e')](handleError(_0x515c3f,null));};exports[_0xe19e('0x3f')]=function(_0x71a84d,_0x1a2a47){var _0x25acdf={'raw':![],'where':{'id':_0x71a84d[_0xe19e('0x40')]['id']}},_0x59a5a0={};_0x59a5a0[_0xe19e('0x2f')]=_[_0xe19e('0x2c')](db[_0xe19e('0x27')][_0xe19e('0x28')]);_0x59a5a0[_0xe19e('0x2b')]=_[_0xe19e('0x2c')](_0x71a84d[_0xe19e('0x2b')]);_0x59a5a0[_0xe19e('0x2d')]=_[_0xe19e('0x2e')](_0x59a5a0[_0xe19e('0x2f')],_0x59a5a0[_0xe19e('0x2b')]);_0x25acdf[_0xe19e('0x31')]=_['intersection'](_0x59a5a0[_0xe19e('0x2f')],qs[_0xe19e('0x30')](_0x71a84d['query']['fields']));_0x25acdf[_0xe19e('0x31')]=_0x25acdf[_0xe19e('0x31')][_0xe19e('0x32')]?_0x25acdf['attributes']:_0x59a5a0['model'];if(_0x71a84d['query']['includeAll']){_0x25acdf[_0xe19e('0x41')]=[{'all':!![]}];}_0x25acdf=_['merge']({},_0x25acdf,_0x71a84d[_0xe19e('0x3b')]);return db[_0xe19e('0x27')]['find'](_0x25acdf)[_0xe19e('0x20')](handleEntityNotFound(_0x1a2a47,null))[_0xe19e('0x20')](respondWithResult(_0x1a2a47,null))[_0xe19e('0x3e')](handleError(_0x1a2a47,null));};exports[_0xe19e('0x42')]=function(_0x145e6f,_0x305a2a){return db[_0xe19e('0x27')][_0xe19e('0x42')](_0x145e6f[_0xe19e('0x43')],{})[_0xe19e('0x20')](respondWithResult(_0x305a2a,0xc9))[_0xe19e('0x3e')](handleError(_0x305a2a,null));};exports[_0xe19e('0x44')]=function(_0x1ff924,_0x5be079){return db['AnalyticFieldReport'][_0xe19e('0x44')](_0x1ff924['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5be079,0xc9))[_0xe19e('0x3e')](handleError(_0x5be079,null));};exports['update']=function(_0x4f7fb7,_0x3ff71f){if(_0x4f7fb7[_0xe19e('0x43')]['id']){delete _0x4f7fb7['body']['id'];}return db['AnalyticFieldReport'][_0xe19e('0x45')]({'where':{'id':_0x4f7fb7['params']['id']}})[_0xe19e('0x20')](handleEntityNotFound(_0x3ff71f,null))[_0xe19e('0x20')](saveUpdates(_0x4f7fb7[_0xe19e('0x43')],null))['then'](respondWithResult(_0x3ff71f,null))[_0xe19e('0x3e')](handleError(_0x3ff71f,null));};exports[_0xe19e('0x1f')]=function(_0x3734c1,_0x3eb035){return db[_0xe19e('0x27')][_0xe19e('0x45')]({'where':{'id':_0x3734c1[_0xe19e('0x40')]['id']}})[_0xe19e('0x20')](handleEntityNotFound(_0x3eb035,null))[_0xe19e('0x20')](removeEntity(_0x3eb035,null))[_0xe19e('0x3e')](handleError(_0x3eb035,null));};exports[_0xe19e('0x46')]=function(_0x3807a7,_0x850647){return db[_0xe19e('0x27')][_0xe19e('0x1f')]({'where':{'id':_0x3807a7['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x850647,0xcc))[_0xe19e('0x3e')](handleError(_0x850647,null));};exports[_0xe19e('0x47')]=function(_0x4c43d9,_0x413f1a,_0x2c7266){return db[_0xe19e('0x48')][_0xe19e('0x49')]({'where':{'id':_0x4c43d9[_0xe19e('0x40')]['id']}})[_0xe19e('0x20')](handleEntityNotFound(_0x413f1a,null))['then'](function(_0x5cd94d){if(_0x5cd94d){return db['sequelize'][_0xe19e('0x4a')](function(_0x2b7e79){return db[_0xe19e('0x27')]['destroy']({'where':{'CustomReportId':_0x4c43d9[_0xe19e('0x40')]['id']},'transaction':_0x2b7e79})[_0xe19e('0x20')](function(_0x4547c6){var _0x13f188=_[_0xe19e('0x26')](_0x4c43d9[_0xe19e('0x43')],function(_0x2775a6){delete _0x2775a6['id'];_0x2775a6[_0xe19e('0x4b')]=_0x4c43d9['params']['id'];return _0x2775a6;});return db[_0xe19e('0x27')][_0xe19e('0x44')](_0x13f188,{'transaction':_0x2b7e79});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x4c43d9[_0xe19e('0x40')]['id']}});});}})[_0xe19e('0x20')](respondWithResult(_0x413f1a,null))['catch'](handleError(_0x413f1a,null));}; \ No newline at end of file +var _0x13fc=['findAll','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','map','AnalyticFieldReport','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','body','bulkCreate','update','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','params','CustomReportId'];(function(_0x6bd32b,_0x2a6baa){var _0x2e3f04=function(_0x4733c1){while(--_0x4733c1){_0x6bd32b['push'](_0x6bd32b['shift']());}};_0x2e3f04(++_0x2a6baa);}(_0x13fc,0xe5));var _0xc13f=function(_0x32279c,_0x154cd7){_0x32279c=_0x32279c-0x0;var _0x3c377f=_0x13fc[_0x32279c];return _0x3c377f;};'use strict';var emlformat=require(_0xc13f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc13f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc13f('0x2'));var moment=require(_0xc13f('0x3'));var BPromise=require(_0xc13f('0x4'));var Mustache=require(_0xc13f('0x5'));var util=require(_0xc13f('0x6'));var path=require(_0xc13f('0x7'));var sox=require(_0xc13f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc13f('0x9'));var _=require('lodash');var squel=require(_0xc13f('0xa'));var crypto=require(_0xc13f('0xb'));var jsforce=require(_0xc13f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc13f('0xd'));var querystring=require(_0xc13f('0xe'));var Papa=require(_0xc13f('0xf'));var Redis=require(_0xc13f('0x10'));var authService=require(_0xc13f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc13f('0x12'))(_0xc13f('0x13'));var utils=require(_0xc13f('0x14'));var config=require(_0xc13f('0x15'));var licenseUtil=require(_0xc13f('0x16'));var db=require(_0xc13f('0x17'))['db'];function respondWithStatusCode(_0x36716e,_0x10fa99){_0x10fa99=_0x10fa99||0xcc;return function(_0x3a0f2b){if(_0x3a0f2b){return _0x36716e[_0xc13f('0x18')](_0x10fa99);}return _0x36716e[_0xc13f('0x19')](_0x10fa99)[_0xc13f('0x1a')]();};}function respondWithResult(_0x56dedd,_0x5d86b8){_0x5d86b8=_0x5d86b8||0xc8;return function(_0x42d76a){if(_0x42d76a){return _0x56dedd[_0xc13f('0x19')](_0x5d86b8)[_0xc13f('0x1b')](_0x42d76a);}};}function respondWithFilteredResult(_0x5386b6,_0x184848){return function(_0x10c367){if(_0x10c367){var _0x561259=typeof _0x184848[_0xc13f('0x1c')]===_0xc13f('0x1d')&&typeof _0x184848[_0xc13f('0x1e')]===_0xc13f('0x1d');var _0x417543=_0x10c367[_0xc13f('0x1f')];var _0x1b0fb1=_0x561259?0x0:_0x184848[_0xc13f('0x1c')];var _0x232db1=_0x561259?_0x10c367[_0xc13f('0x1f')]:_0x184848[_0xc13f('0x1c')]+_0x184848[_0xc13f('0x1e')];var _0x5c6e65;if(_0x232db1>=_0x417543){_0x232db1=_0x417543;_0x5c6e65=0xc8;}else{_0x5c6e65=0xce;}_0x5386b6['status'](_0x5c6e65);return _0x5386b6['set']('Content-Range',_0x1b0fb1+'-'+_0x232db1+'/'+_0x417543)[_0xc13f('0x1b')](_0x10c367);}return null;};}function patchUpdates(_0x1f5700){return function(_0xffbb22){try{jsonpatch[_0xc13f('0x20')](_0xffbb22,_0x1f5700,!![]);}catch(_0x36dbd5){return BPromise[_0xc13f('0x21')](_0x36dbd5);}return _0xffbb22[_0xc13f('0x22')]();};}function saveUpdates(_0x11423c,_0x3aeb7c){return function(_0x181dfa){if(_0x181dfa){return _0x181dfa['update'](_0x11423c)[_0xc13f('0x23')](function(_0x4ed553){return _0x4ed553;});}return null;};}function removeEntity(_0x2074a7,_0x102b5c){return function(_0x5dabb2){if(_0x5dabb2){return _0x5dabb2[_0xc13f('0x24')]()[_0xc13f('0x23')](function(){_0x2074a7[_0xc13f('0x19')](0xcc)[_0xc13f('0x1a')]();});}};}function handleEntityNotFound(_0x3236fb,_0x25d110){return function(_0x96f7e0){if(!_0x96f7e0){_0x3236fb[_0xc13f('0x18')](0x194);}return _0x96f7e0;};}function handleError(_0x88e83a,_0x3111b1){_0x3111b1=_0x3111b1||0x1f4;return function(_0x332226){logger[_0xc13f('0x25')](_0x332226[_0xc13f('0x26')]);if(_0x332226[_0xc13f('0x27')]){delete _0x332226[_0xc13f('0x27')];}_0x88e83a[_0xc13f('0x19')](_0x3111b1)['send'](_0x332226);};}exports['index']=function(_0x264b9c,_0x3538e7){var _0x51b272={},_0x17cb7d={},_0x27b2b1={'count':0x0,'rows':[]};var _0x37a66a=_[_0xc13f('0x28')](db[_0xc13f('0x29')]['rawAttributes'],function(_0x37f024){return{'name':_0x37f024['fieldName'],'type':_0x37f024[_0xc13f('0x2a')]['key']};});_0x17cb7d[_0xc13f('0x2b')]=_[_0xc13f('0x28')](_0x37a66a,_0xc13f('0x27'));_0x17cb7d[_0xc13f('0x2c')]=_['keys'](_0x264b9c[_0xc13f('0x2c')]);_0x17cb7d[_0xc13f('0x2d')]=_[_0xc13f('0x2e')](_0x17cb7d['model'],_0x17cb7d[_0xc13f('0x2c')]);_0x51b272[_0xc13f('0x2f')]=_[_0xc13f('0x2e')](_0x17cb7d[_0xc13f('0x2b')],qs['fields'](_0x264b9c[_0xc13f('0x2c')]['fields']));_0x51b272['attributes']=_0x51b272['attributes']['length']?_0x51b272[_0xc13f('0x2f')]:_0x17cb7d[_0xc13f('0x2b')];if(!_0x264b9c[_0xc13f('0x2c')][_0xc13f('0x30')](_0xc13f('0x31'))){_0x51b272[_0xc13f('0x1e')]=qs[_0xc13f('0x1e')](_0x264b9c[_0xc13f('0x2c')][_0xc13f('0x1e')]);_0x51b272[_0xc13f('0x1c')]=qs[_0xc13f('0x1c')](_0x264b9c[_0xc13f('0x2c')][_0xc13f('0x1c')]);}_0x51b272['order']=qs['sort'](_0x264b9c[_0xc13f('0x2c')]['sort']);_0x51b272[_0xc13f('0x32')]=qs['filters'](_[_0xc13f('0x33')](_0x264b9c['query'],_0x17cb7d['filters']),_0x37a66a);if(_0x264b9c[_0xc13f('0x2c')]['filter']){_0x51b272['where']=_[_0xc13f('0x34')](_0x51b272['where'],{'$or':_[_0xc13f('0x28')](_0x37a66a,function(_0x38db64){if(_0x38db64[_0xc13f('0x2a')]!==_0xc13f('0x35')){var _0x58c97e={};_0x58c97e[_0x38db64[_0xc13f('0x27')]]={'$like':'%'+_0x264b9c[_0xc13f('0x2c')][_0xc13f('0x36')]+'%'};return _0x58c97e;}})});}_0x51b272=_[_0xc13f('0x34')]({},_0x51b272,_0x264b9c[_0xc13f('0x37')]);var _0xa4fd9a={'where':_0x51b272[_0xc13f('0x32')]};return db[_0xc13f('0x29')][_0xc13f('0x1f')](_0xa4fd9a)[_0xc13f('0x23')](function(_0x4d25cf){_0x27b2b1[_0xc13f('0x1f')]=_0x4d25cf;if(_0x264b9c[_0xc13f('0x2c')][_0xc13f('0x38')]){_0x51b272[_0xc13f('0x39')]=[{'all':!![]}];}return db[_0xc13f('0x29')]['findAll'](_0x51b272);})['then'](function(_0x2dacdf){_0x27b2b1[_0xc13f('0x3a')]=_0x2dacdf;return _0x27b2b1;})[_0xc13f('0x23')](respondWithFilteredResult(_0x3538e7,_0x51b272))[_0xc13f('0x3b')](handleError(_0x3538e7,null));};exports[_0xc13f('0x3c')]=function(_0x16132f,_0x3413a6){var _0x17fa70={'raw':![],'where':{'id':_0x16132f['params']['id']}},_0x1d9e27={};_0x1d9e27[_0xc13f('0x2b')]=_[_0xc13f('0x3d')](db[_0xc13f('0x29')][_0xc13f('0x3e')]);_0x1d9e27[_0xc13f('0x2c')]=_['keys'](_0x16132f['query']);_0x1d9e27[_0xc13f('0x2d')]=_[_0xc13f('0x2e')](_0x1d9e27[_0xc13f('0x2b')],_0x1d9e27['query']);_0x17fa70[_0xc13f('0x2f')]=_['intersection'](_0x1d9e27['model'],qs['fields'](_0x16132f[_0xc13f('0x2c')]['fields']));_0x17fa70[_0xc13f('0x2f')]=_0x17fa70['attributes']['length']?_0x17fa70[_0xc13f('0x2f')]:_0x1d9e27[_0xc13f('0x2b')];if(_0x16132f[_0xc13f('0x2c')][_0xc13f('0x38')]){_0x17fa70['include']=[{'all':!![]}];}_0x17fa70=_[_0xc13f('0x34')]({},_0x17fa70,_0x16132f[_0xc13f('0x37')]);return db[_0xc13f('0x29')][_0xc13f('0x3f')](_0x17fa70)[_0xc13f('0x23')](handleEntityNotFound(_0x3413a6,null))[_0xc13f('0x23')](respondWithResult(_0x3413a6,null))[_0xc13f('0x3b')](handleError(_0x3413a6,null));};exports[_0xc13f('0x40')]=function(_0x350c51,_0x21316b){return db[_0xc13f('0x29')][_0xc13f('0x40')](_0x350c51[_0xc13f('0x41')],{})[_0xc13f('0x23')](respondWithResult(_0x21316b,0xc9))['catch'](handleError(_0x21316b,null));};exports[_0xc13f('0x42')]=function(_0x54d803,_0x6f8fbd){return db[_0xc13f('0x29')][_0xc13f('0x42')](_0x54d803[_0xc13f('0x41')],{'raw':![],'individualHooks':!![]})[_0xc13f('0x23')](respondWithResult(_0x6f8fbd,0xc9))[_0xc13f('0x3b')](handleError(_0x6f8fbd,null));};exports[_0xc13f('0x43')]=function(_0x1f6c16,_0x198755){if(_0x1f6c16[_0xc13f('0x41')]['id']){delete _0x1f6c16['body']['id'];}return db[_0xc13f('0x29')][_0xc13f('0x3f')]({'where':{'id':_0x1f6c16['params']['id']}})[_0xc13f('0x23')](handleEntityNotFound(_0x198755,null))[_0xc13f('0x23')](saveUpdates(_0x1f6c16[_0xc13f('0x41')],null))[_0xc13f('0x23')](respondWithResult(_0x198755,null))[_0xc13f('0x3b')](handleError(_0x198755,null));};exports['destroy']=function(_0x5c7753,_0xc97d31){return db[_0xc13f('0x29')][_0xc13f('0x3f')]({'where':{'id':_0x5c7753['params']['id']}})[_0xc13f('0x23')](handleEntityNotFound(_0xc97d31,null))['then'](removeEntity(_0xc97d31,null))[_0xc13f('0x3b')](handleError(_0xc97d31,null));};exports[_0xc13f('0x44')]=function(_0x57617f,_0x1eb048){return db[_0xc13f('0x29')][_0xc13f('0x24')]({'where':{'id':_0x57617f[_0xc13f('0x2c')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xc13f('0x23')](respondWithResult(_0x1eb048,0xcc))['catch'](handleError(_0x1eb048,null));};exports[_0xc13f('0x45')]=function(_0x4b1d5a,_0x5d7c7c,_0x26bd5){return db[_0xc13f('0x46')]['findOne']({'where':{'id':_0x4b1d5a['params']['id']}})[_0xc13f('0x23')](handleEntityNotFound(_0x5d7c7c,null))[_0xc13f('0x23')](function(_0x37d99d){if(_0x37d99d){return db[_0xc13f('0x47')][_0xc13f('0x48')](function(_0x34cc1a){return db[_0xc13f('0x29')]['destroy']({'where':{'CustomReportId':_0x4b1d5a[_0xc13f('0x49')]['id']},'transaction':_0x34cc1a})[_0xc13f('0x23')](function(_0x3eb453){var _0x1461c4=_[_0xc13f('0x28')](_0x4b1d5a[_0xc13f('0x41')],function(_0x595ae3){delete _0x595ae3['id'];_0x595ae3[_0xc13f('0x4a')]=_0x4b1d5a[_0xc13f('0x49')]['id'];return _0x595ae3;});return db[_0xc13f('0x29')][_0xc13f('0x42')](_0x1461c4,{'transaction':_0x34cc1a});});})[_0xc13f('0x23')](function(){return db[_0xc13f('0x29')][_0xc13f('0x4b')]({'where':{'CustomReportId':_0x4b1d5a[_0xc13f('0x49')]['id']}});});}})[_0xc13f('0x23')](respondWithResult(_0x5d7c7c,null))[_0xc13f('0x3b')](handleError(_0x5d7c7c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 2928f27..dccebdc 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 _0x9187=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x5448a9,_0x4764da){var _0x1924af=function(_0x34f9bf){while(--_0x34f9bf){_0x5448a9['push'](_0x5448a9['shift']());}};_0x1924af(++_0x4764da);}(_0x9187,0x1d0));var _0x7918=function(_0x7d5b1b,_0x20e692){_0x7d5b1b=_0x7d5b1b-0x0;var _0x51988c=_0x9187[_0x7d5b1b];return _0x51988c;};'use strict';var _=require(_0x7918('0x0'));var util=require(_0x7918('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7918('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7918('0x3'));var config=require(_0x7918('0x4'));var attributes=require(_0x7918('0x5'));module[_0x7918('0x6')]=function(_0x4f67e1,_0x260081){return _0x4f67e1[_0x7918('0x7')](_0x7918('0x8'),attributes,{'tableName':_0x7918('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8301=['api','moment','bluebird','request-promise','path','rimraf','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger'];(function(_0x83d650,_0x527216){var _0x300857=function(_0x57adad){while(--_0x57adad){_0x83d650['push'](_0x83d650['shift']());}};_0x300857(++_0x527216);}(_0x8301,0x136));var _0x1830=function(_0xf4add4,_0x5b9cc1){_0xf4add4=_0xf4add4-0x0;var _0x1c42fb=_0x8301[_0xf4add4];return _0x1c42fb;};'use strict';var _=require(_0x1830('0x0'));var util=require('util');var logger=require(_0x1830('0x1'))(_0x1830('0x2'));var moment=require(_0x1830('0x3'));var BPromise=require(_0x1830('0x4'));var rp=require(_0x1830('0x5'));var fs=require('fs');var path=require(_0x1830('0x6'));var rimraf=require(_0x1830('0x7'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x1830('0x8')]=function(_0x15486d,_0x1823d3){return _0x15486d[_0x1830('0x9')](_0x1830('0xa'),attributes,{'tableName':_0x1830('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 39b48a3..dde0408 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 _0xc92e=['request','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xc92e,0x1d9));var _0xec92=function(_0x3f5b69,_0x29662b){_0x3f5b69=_0x3f5b69-0x0;var _0x210d91=_0xc92e[_0x3f5b69];return _0x210d91;};'use strict';var _=require(_0xec92('0x0'));var util=require(_0xec92('0x1'));var moment=require('moment');var BPromise=require(_0xec92('0x2'));var rs=require(_0xec92('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec92('0x4'))(_0xec92('0x5'));var config=require(_0xec92('0x6'));var jayson=require(_0xec92('0x7'));var client=jayson[_0xec92('0x8')][_0xec92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2aa10b,_0xe62556,_0x202e31){return new BPromise(function(_0x5b768c,_0x44a0d8){return client[_0xec92('0xa')](_0x2aa10b,_0x202e31)['then'](function(_0x3aac21){logger[_0xec92('0xb')](_0xec92('0xc'),_0xe62556,'request\x20sent');logger[_0xec92('0xd')](_0xec92('0xe'),_0xe62556,_0xec92('0xf'),JSON['stringify'](_0x3aac21));if(_0x3aac21['error']){if(_0x3aac21['error'][_0xec92('0x10')]===0x1f4){logger[_0xec92('0x11')](_0xec92('0xc'),_0xe62556,_0x3aac21[_0xec92('0x11')]['message']);return _0x44a0d8(_0x3aac21[_0xec92('0x11')]['message']);}logger[_0xec92('0x11')](_0xec92('0xc'),_0xe62556,_0x3aac21[_0xec92('0x11')][_0xec92('0x12')]);return _0x5b768c(_0x3aac21[_0xec92('0x11')][_0xec92('0x12')]);}else{logger[_0xec92('0xb')](_0xec92('0xc'),_0xe62556,_0xec92('0xf'));_0x5b768c(_0x3aac21[_0xec92('0x13')]['message']);}})[_0xec92('0x14')](function(_0x53f52b){logger[_0xec92('0x11')](_0xec92('0xc'),_0xe62556,_0x53f52b);_0x44a0d8(_0x53f52b);});});} \ No newline at end of file +var _0xbe42=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x10d373,_0x2a4e16){var _0x1cac4c=function(_0x505e08){while(--_0x505e08){_0x10d373['push'](_0x10d373['shift']());}};_0x1cac4c(++_0x2a4e16);}(_0xbe42,0x1ae));var _0x2be4=function(_0x838813,_0x448f0f){_0x838813=_0x838813-0x0;var _0x2bd32d=_0xbe42[_0x838813];return _0x2bd32d;};'use strict';var _=require(_0x2be4('0x0'));var util=require(_0x2be4('0x1'));var moment=require(_0x2be4('0x2'));var BPromise=require(_0x2be4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2be4('0x4'));var db=require(_0x2be4('0x5'))['db'];var utils=require(_0x2be4('0x6'));var logger=require('../../config/logger')(_0x2be4('0x7'));var config=require(_0x2be4('0x8'));var jayson=require(_0x2be4('0x9'));var client=jayson[_0x2be4('0xa')][_0x2be4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15f149,_0x2bf681,_0x2646e3){return new BPromise(function(_0x44c427,_0x43ef61){return client[_0x2be4('0xc')](_0x15f149,_0x2646e3)[_0x2be4('0xd')](function(_0x53acb6){logger[_0x2be4('0xe')](_0x2be4('0xf'),_0x2bf681,_0x2be4('0x10'));logger['debug'](_0x2be4('0x11'),_0x2bf681,'request\x20sent',JSON[_0x2be4('0x12')](_0x53acb6));if(_0x53acb6[_0x2be4('0x13')]){if(_0x53acb6[_0x2be4('0x13')][_0x2be4('0x14')]===0x1f4){logger[_0x2be4('0x13')](_0x2be4('0xf'),_0x2bf681,_0x53acb6[_0x2be4('0x13')][_0x2be4('0x15')]);return _0x43ef61(_0x53acb6[_0x2be4('0x13')][_0x2be4('0x15')]);}logger[_0x2be4('0x13')](_0x2be4('0xf'),_0x2bf681,_0x53acb6[_0x2be4('0x13')][_0x2be4('0x15')]);return _0x44c427(_0x53acb6[_0x2be4('0x13')]['message']);}else{logger[_0x2be4('0xe')](_0x2be4('0xf'),_0x2bf681,_0x2be4('0x10'));_0x44c427(_0x53acb6[_0x2be4('0x16')]['message']);}})['catch'](function(_0x2c8364){logger[_0x2be4('0x13')](_0x2be4('0xf'),_0x2bf681,_0x2c8364);_0x43ef61(_0x2c8364);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 9c2534a..a49946a 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(_0x12cbed,_0x250b62){var _0x56ba23=function(_0x572337){while(--_0x572337){_0x12cbed['push'](_0x12cbed['shift']());}};_0x56ba23(++_0x250b62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x2fbac2,_0x2b7376){var _0x52bc10=function(_0x4272e4){while(--_0x4272e4){_0x2fbac2['push'](_0x2fbac2['shift']());}};_0x52bc10(++_0x2b7376);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 7001457..9ff5ebe 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 _0x0d74=['STRING','TEXT','sequelize','exports'];(function(_0x579216,_0x287466){var _0x1c5ca9=function(_0x2b3084){while(--_0x2b3084){_0x579216['push'](_0x579216['shift']());}};_0x1c5ca9(++_0x287466);}(_0x0d74,0x146));var _0x40d7=function(_0xa43082,_0x24156b){_0xa43082=_0xa43082-0x0;var _0x64a0c6=_0x0d74[_0xa43082];return _0x64a0c6;};'use strict';var Sequelize=require(_0x40d7('0x0'));module[_0x40d7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x40d7('0x2')]},'metric':{'type':Sequelize[_0x40d7('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc5cf=['name','TEXT','sequelize','exports','STRING'];(function(_0x14f161,_0x2699b3){var _0x4a9a17=function(_0x2d2177){while(--_0x2d2177){_0x14f161['push'](_0x14f161['shift']());}};_0x4a9a17(++_0x2699b3);}(_0xc5cf,0x15b));var _0xfc5c=function(_0x4cfb5c,_0x5cdb52){_0x4cfb5c=_0x4cfb5c-0x0;var _0x45097c=_0xc5cf[_0x4cfb5c];return _0x45097c;};'use strict';var Sequelize=require(_0xfc5c('0x0'));module[_0xfc5c('0x1')]={'name':{'type':Sequelize[_0xfc5c('0x2')],'allowNull':![],'unique':_0xfc5c('0x3')},'table':{'type':Sequelize[_0xfc5c('0x2')]},'metric':{'type':Sequelize[_0xfc5c('0x4')]},'description':{'type':Sequelize[_0xfc5c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index f8f25eb..7a86802 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 _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x2f8028,_0x158207){var _0x42acbb=function(_0x52e8b7){while(--_0x52e8b7){_0x2f8028['push'](_0x2f8028['shift']());}};_0x42acbb(++_0x158207);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x00bb[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file +var _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x4356cc,_0x5f19b2){var _0x26863f=function(_0x36f4ff){while(--_0x36f4ff){_0x4356cc['push'](_0x4356cc['shift']());}};_0x26863f(++_0x5f19b2);}(_0x9a19,0x114));var _0x99a1=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9a19[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index f60868b..ee493ae 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 _0x8ce1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics'];(function(_0x281b57,_0x11632e){var _0x37a22d=function(_0x123d4c){while(--_0x123d4c){_0x281b57['push'](_0x281b57['shift']());}};_0x37a22d(++_0x11632e);}(_0x8ce1,0x152));var _0x18ce=function(_0x495f2a,_0x223c84){_0x495f2a=_0x495f2a-0x0;var _0x137470=_0x8ce1[_0x495f2a];return _0x137470;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18ce('0x7'));var config=require(_0x18ce('0x8'));var attributes=require(_0x18ce('0x9'));module[_0x18ce('0xa')]=function(_0x532604,_0x17d12a){return _0x532604[_0x18ce('0xb')]('AnalyticMetric',attributes,{'tableName':_0x18ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3d8=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x24dc59,_0x92ae8e){var _0x8d63ea=function(_0x1d72de){while(--_0x1d72de){_0x24dc59['push'](_0x24dc59['shift']());}};_0x8d63ea(++_0x92ae8e);}(_0xb3d8,0xdc));var _0x8b3d=function(_0x3730eb,_0x96ee91){_0x3730eb=_0x3730eb-0x0;var _0x5701be=_0xb3d8[_0x3730eb];return _0x5701be;};'use strict';var _=require('lodash');var util=require(_0x8b3d('0x0'));var logger=require(_0x8b3d('0x1'))(_0x8b3d('0x2'));var moment=require(_0x8b3d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b3d('0x4'));var rimraf=require(_0x8b3d('0x5'));var config=require(_0x8b3d('0x6'));var attributes=require(_0x8b3d('0x7'));module[_0x8b3d('0x8')]=function(_0x22d97b,_0x3b0f04){return _0x22d97b[_0x8b3d('0x9')](_0x8b3d('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 23877cf..0c308e1 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 _0xe01c=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','randomstring','../../config/utils'];(function(_0x3616ef,_0x211fd1){var _0x4df78b=function(_0x21ec0f){while(--_0x21ec0f){_0x3616ef['push'](_0x3616ef['shift']());}};_0x4df78b(++_0x211fd1);}(_0xe01c,0x14f));var _0xce01=function(_0x561ab7,_0x436ad1){_0x561ab7=_0x561ab7-0x0;var _0x4c995e=_0xe01c[_0x561ab7];return _0x4c995e;};'use strict';var _=require(_0xce01('0x0'));var util=require(_0xce01('0x1'));var moment=require(_0xce01('0x2'));var BPromise=require('bluebird');var rs=require(_0xce01('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce01('0x4'));var logger=require(_0xce01('0x5'))('rpc');var config=require(_0xce01('0x6'));var jayson=require(_0xce01('0x7'));var client=jayson[_0xce01('0x8')][_0xce01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ecba4,_0x2b2b29,_0x19b3a2){return new BPromise(function(_0x901e28,_0xe915ea){return client[_0xce01('0xa')](_0x2ecba4,_0x19b3a2)[_0xce01('0xb')](function(_0x28ed4e){logger[_0xce01('0xc')](_0xce01('0xd'),_0x2b2b29,_0xce01('0xe'));logger[_0xce01('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2b2b29,_0xce01('0xe'),JSON[_0xce01('0x10')](_0x28ed4e));if(_0x28ed4e[_0xce01('0x11')]){if(_0x28ed4e[_0xce01('0x11')][_0xce01('0x12')]===0x1f4){logger[_0xce01('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x2b2b29,_0x28ed4e[_0xce01('0x11')][_0xce01('0x13')]);return _0xe915ea(_0x28ed4e[_0xce01('0x11')][_0xce01('0x13')]);}logger[_0xce01('0x11')](_0xce01('0xd'),_0x2b2b29,_0x28ed4e[_0xce01('0x11')][_0xce01('0x13')]);return _0x901e28(_0x28ed4e[_0xce01('0x11')][_0xce01('0x13')]);}else{logger[_0xce01('0xc')](_0xce01('0xd'),_0x2b2b29,_0xce01('0xe'));_0x901e28(_0x28ed4e['result']['message']);}})['catch'](function(_0x1a0d14){logger[_0xce01('0x11')](_0xce01('0xd'),_0x2b2b29,_0x1a0d14);_0xe915ea(_0x1a0d14);});});} \ No newline at end of file +var _0xd07e=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd07e,0x14c));var _0xed07=function(_0x2fcbaa,_0x35eeb4){_0x2fcbaa=_0x2fcbaa-0x0;var _0x206a5a=_0xd07e[_0x2fcbaa];return _0x206a5a;};'use strict';var _=require('lodash');var util=require(_0xed07('0x0'));var moment=require(_0xed07('0x1'));var BPromise=require(_0xed07('0x2'));var rs=require(_0xed07('0x3'));var fs=require('fs');var Redis=require(_0xed07('0x4'));var db=require(_0xed07('0x5'))['db'];var utils=require(_0xed07('0x6'));var logger=require(_0xed07('0x7'))(_0xed07('0x8'));var config=require('../../config/environment');var jayson=require(_0xed07('0x9'));var client=jayson[_0xed07('0xa')][_0xed07('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2649db,_0x268ed7,_0x58cc48){return new BPromise(function(_0x1af133,_0x4fe486){return client[_0xed07('0xc')](_0x2649db,_0x58cc48)[_0xed07('0xd')](function(_0x14110d){logger[_0xed07('0xe')](_0xed07('0xf'),_0x268ed7,_0xed07('0x10'));logger[_0xed07('0x11')](_0xed07('0x12'),_0x268ed7,_0xed07('0x10'),JSON[_0xed07('0x13')](_0x14110d));if(_0x14110d[_0xed07('0x14')]){if(_0x14110d[_0xed07('0x14')][_0xed07('0x15')]===0x1f4){logger[_0xed07('0x14')](_0xed07('0xf'),_0x268ed7,_0x14110d[_0xed07('0x14')][_0xed07('0x16')]);return _0x4fe486(_0x14110d[_0xed07('0x14')][_0xed07('0x16')]);}logger[_0xed07('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x268ed7,_0x14110d['error'][_0xed07('0x16')]);return _0x1af133(_0x14110d[_0xed07('0x14')][_0xed07('0x16')]);}else{logger[_0xed07('0xe')](_0xed07('0xf'),_0x268ed7,_0xed07('0x10'));_0x1af133(_0x14110d[_0xed07('0x17')][_0xed07('0x16')]);}})[_0xed07('0x18')](function(_0x4f0e3e){logger['error'](_0xed07('0xf'),_0x268ed7,_0x4f0e3e);_0x4fe486(_0x4f0e3e);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index fe82d84..07f92b0 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 _0x6dc0=['multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticMetric.controller','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports'];(function(_0xa6330,_0x54d0c2){var _0x4755aa=function(_0x44dffd){while(--_0x44dffd){_0xa6330['push'](_0xa6330['shift']());}};_0x4755aa(++_0x54d0c2);}(_0x6dc0,0x18c));var _0x06dc=function(_0x5ce2e7,_0x36735e){_0x5ce2e7=_0x5ce2e7-0x0;var _0x15e5f5=_0x6dc0[_0x5ce2e7];return _0x15e5f5;};'use strict';var multer=require(_0x06dc('0x0'));var util=require('util');var path=require(_0x06dc('0x1'));var timeout=require(_0x06dc('0x2'));var express=require(_0x06dc('0x3'));var router=express[_0x06dc('0x4')]();var fs_extra=require(_0x06dc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x06dc('0x6'));var controller=require(_0x06dc('0x7'));router['get']('/',auth[_0x06dc('0x8')](),controller[_0x06dc('0x9')]);router['get'](_0x06dc('0xa'),auth['isAuthenticated'](),controller[_0x06dc('0xb')]);router[_0x06dc('0xc')]('/',auth[_0x06dc('0x8')](),controller[_0x06dc('0xd')]);router[_0x06dc('0xe')]('/:id',auth[_0x06dc('0x8')](),controller['update']);router[_0x06dc('0xf')](_0x06dc('0xa'),auth['isAuthenticated'](),controller[_0x06dc('0x10')]);module[_0x06dc('0x11')]=router; \ No newline at end of file +var _0x3ca4=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x506330,_0x10062e){var _0x3dd612=function(_0x1978b3){while(--_0x1978b3){_0x506330['push'](_0x506330['shift']());}};_0x3dd612(++_0x10062e);}(_0x3ca4,0x17d));var _0x43ca=function(_0x3d0e7e,_0x564590){_0x3d0e7e=_0x3d0e7e-0x0;var _0x4819aa=_0x3ca4[_0x3d0e7e];return _0x4819aa;};'use strict';var multer=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var path=require(_0x43ca('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x43ca('0x3')]();var fs_extra=require(_0x43ca('0x4'));var auth=require(_0x43ca('0x5'));var interaction=require(_0x43ca('0x6'));var config=require(_0x43ca('0x7'));var controller=require(_0x43ca('0x8'));router[_0x43ca('0x9')]('/',auth['isAuthenticated'](),controller[_0x43ca('0xa')]);router[_0x43ca('0x9')](_0x43ca('0xb'),auth[_0x43ca('0xc')](),controller[_0x43ca('0xd')]);router[_0x43ca('0xe')]('/',auth[_0x43ca('0xc')](),controller[_0x43ca('0xf')]);router['put']('/:id',auth[_0x43ca('0xc')](),controller[_0x43ca('0x10')]);router[_0x43ca('0x11')](_0x43ca('0xb'),auth['isAuthenticated'](),controller[_0x43ca('0x12')]);module[_0x43ca('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 6a87640..cf101d1 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 _0x95ba=['exports','TEXT','sequelize'];(function(_0xab9864,_0x5ab487){var _0x500468=function(_0x441a7c){while(--_0x441a7c){_0xab9864['push'](_0xab9864['shift']());}};_0x500468(++_0x5ab487);}(_0x95ba,0x17c));var _0xa95b=function(_0x46f940,_0xc854e2){_0x46f940=_0x46f940-0x0;var _0x4572f3=_0x95ba[_0x46f940];return _0x4572f3;};'use strict';var Sequelize=require(_0xa95b('0x0'));module[_0xa95b('0x1')]={'tree':{'type':Sequelize[_0xa95b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7ca3=['exports','TEXT','sequelize'];(function(_0x4d46ee,_0xa971ad){var _0x3f9536=function(_0xe885c2){while(--_0xe885c2){_0x4d46ee['push'](_0x4d46ee['shift']());}};_0x3f9536(++_0xa971ad);}(_0x7ca3,0x17c));var _0x37ca=function(_0x29db71,_0x306de1){_0x29db71=_0x29db71-0x0;var _0x2c8a07=_0x7ca3[_0x29db71];return _0x2c8a07;};'use strict';var Sequelize=require(_0x37ca('0x0'));module[_0x37ca('0x1')]={'tree':{'type':Sequelize[_0x37ca('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 5665b1a..c048a64 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 _0xfb4b=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfb4b,0x7f));var _0xbfb4=function(_0x4722c7,_0x326525){_0x4722c7=_0x4722c7-0x0;var _0x24cb31=_0xfb4b[_0x4722c7];return _0x24cb31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbfb4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbfb4('0x1'));var rp=require('request-promise');var moment=require(_0xbfb4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbfb4('0x3'));var util=require(_0xbfb4('0x4'));var path=require(_0xbfb4('0x5'));var sox=require('sox');var csv=require(_0xbfb4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfb4('0x7'));var _=require(_0xbfb4('0x8'));var squel=require(_0xbfb4('0x9'));var crypto=require(_0xbfb4('0xa'));var jsforce=require(_0xbfb4('0xb'));var deskjs=require(_0xbfb4('0xc'));var toCsv=require(_0xbfb4('0x6'));var querystring=require(_0xbfb4('0xd'));var Papa=require(_0xbfb4('0xe'));var Redis=require(_0xbfb4('0xf'));var authService=require(_0xbfb4('0x10'));var qs=require(_0xbfb4('0x11'));var as=require(_0xbfb4('0x12'));var hardwareService=require(_0xbfb4('0x13'));var logger=require(_0xbfb4('0x14'))(_0xbfb4('0x15'));var utils=require(_0xbfb4('0x16'));var config=require(_0xbfb4('0x17'));var licenseUtil=require(_0xbfb4('0x18'));var db=require(_0xbfb4('0x19'))['db'];function respondWithStatusCode(_0x55802a,_0x4286c8){_0x4286c8=_0x4286c8||0xcc;return function(_0x23b52c){if(_0x23b52c){return _0x55802a[_0xbfb4('0x1a')](_0x4286c8);}return _0x55802a['status'](_0x4286c8)[_0xbfb4('0x1b')]();};}function respondWithResult(_0xe4a76f,_0x4fecb4){_0x4fecb4=_0x4fecb4||0xc8;return function(_0x61ce21){if(_0x61ce21){return _0xe4a76f[_0xbfb4('0x1c')](_0x4fecb4)[_0xbfb4('0x1d')](_0x61ce21);}};}function respondWithFilteredResult(_0x453b2b,_0x41dece){return function(_0x14b621){if(_0x14b621){var _0x55c538=typeof _0x41dece[_0xbfb4('0x1e')]==='undefined'&&typeof _0x41dece[_0xbfb4('0x1f')]===_0xbfb4('0x20');var _0xfb0f38=_0x14b621['count'];var _0x5b41a4=_0x55c538?0x0:_0x41dece[_0xbfb4('0x1e')];var _0x130a27=_0x55c538?_0x14b621[_0xbfb4('0x21')]:_0x41dece[_0xbfb4('0x1e')]+_0x41dece[_0xbfb4('0x1f')];var _0x5d9335;if(_0x130a27>=_0xfb0f38){_0x130a27=_0xfb0f38;_0x5d9335=0xc8;}else{_0x5d9335=0xce;}_0x453b2b[_0xbfb4('0x1c')](_0x5d9335);return _0x453b2b['set'](_0xbfb4('0x22'),_0x5b41a4+'-'+_0x130a27+'/'+_0xfb0f38)['json'](_0x14b621);}return null;};}function patchUpdates(_0x2c53e3){return function(_0x5887c8){try{jsonpatch[_0xbfb4('0x23')](_0x5887c8,_0x2c53e3,!![]);}catch(_0x294a66){return BPromise[_0xbfb4('0x24')](_0x294a66);}return _0x5887c8[_0xbfb4('0x25')]();};}function saveUpdates(_0x17d80a,_0x1a79c7){return function(_0x302c5e){if(_0x302c5e){return _0x302c5e[_0xbfb4('0x26')](_0x17d80a)[_0xbfb4('0x27')](function(_0x424ce4){return _0x424ce4;});}return null;};}function removeEntity(_0x45b9ee,_0x50137b){return function(_0x1749b0){if(_0x1749b0){return _0x1749b0[_0xbfb4('0x28')]()[_0xbfb4('0x27')](function(){_0x45b9ee[_0xbfb4('0x1c')](0xcc)[_0xbfb4('0x1b')]();});}};}function handleEntityNotFound(_0x3c0618,_0x5a5e76){return function(_0x27ce4d){if(!_0x27ce4d){_0x3c0618['sendStatus'](0x194);}return _0x27ce4d;};}function handleError(_0x20561d,_0x28a421){_0x28a421=_0x28a421||0x1f4;return function(_0x2c47b6){logger['error'](_0x2c47b6[_0xbfb4('0x29')]);if(_0x2c47b6['name']){delete _0x2c47b6['name'];}_0x20561d[_0xbfb4('0x1c')](_0x28a421)['send'](_0x2c47b6);};}exports[_0xbfb4('0x2a')]=function(_0x34f3a3,_0x2d1edb){var _0x117a96={},_0x20e5bb={},_0x310873={'count':0x0,'rows':[]};var _0x4f0e06=_[_0xbfb4('0x2b')](db[_0xbfb4('0x2c')][_0xbfb4('0x2d')],function(_0x59d90e){return{'name':_0x59d90e[_0xbfb4('0x2e')],'type':_0x59d90e[_0xbfb4('0x2f')]['key']};});_0x20e5bb[_0xbfb4('0x30')]=_[_0xbfb4('0x2b')](_0x4f0e06,'name');_0x20e5bb[_0xbfb4('0x31')]=_[_0xbfb4('0x32')](_0x34f3a3[_0xbfb4('0x31')]);_0x20e5bb[_0xbfb4('0x33')]=_[_0xbfb4('0x34')](_0x20e5bb['model'],_0x20e5bb[_0xbfb4('0x31')]);_0x117a96[_0xbfb4('0x35')]=_[_0xbfb4('0x34')](_0x20e5bb['model'],qs['fields'](_0x34f3a3[_0xbfb4('0x31')][_0xbfb4('0x36')]));_0x117a96[_0xbfb4('0x35')]=_0x117a96[_0xbfb4('0x35')][_0xbfb4('0x37')]?_0x117a96['attributes']:_0x20e5bb['model'];if(!_0x34f3a3['query']['hasOwnProperty'](_0xbfb4('0x38'))){_0x117a96[_0xbfb4('0x1f')]=qs['limit'](_0x34f3a3['query']['limit']);_0x117a96[_0xbfb4('0x1e')]=qs['offset'](_0x34f3a3[_0xbfb4('0x31')]['offset']);}_0x117a96['order']=qs[_0xbfb4('0x39')](_0x34f3a3[_0xbfb4('0x31')][_0xbfb4('0x39')]);_0x117a96['where']=qs[_0xbfb4('0x33')](_[_0xbfb4('0x3a')](_0x34f3a3[_0xbfb4('0x31')],_0x20e5bb['filters']),_0x4f0e06);if(_0x34f3a3[_0xbfb4('0x31')][_0xbfb4('0x3b')]){_0x117a96[_0xbfb4('0x3c')]=_['merge'](_0x117a96[_0xbfb4('0x3c')],{'$or':_[_0xbfb4('0x2b')](_0x4f0e06,function(_0x50b361){if(_0x50b361[_0xbfb4('0x2f')]!==_0xbfb4('0x3d')){var _0x14d082={};_0x14d082[_0x50b361[_0xbfb4('0x3e')]]={'$like':'%'+_0x34f3a3[_0xbfb4('0x31')][_0xbfb4('0x3b')]+'%'};return _0x14d082;}})});}_0x117a96=_[_0xbfb4('0x3f')]({},_0x117a96,_0x34f3a3[_0xbfb4('0x40')]);var _0x21198b={'where':_0x117a96[_0xbfb4('0x3c')]};return db[_0xbfb4('0x2c')][_0xbfb4('0x21')](_0x21198b)[_0xbfb4('0x27')](function(_0x19694c){_0x310873[_0xbfb4('0x21')]=_0x19694c;if(_0x34f3a3[_0xbfb4('0x31')][_0xbfb4('0x41')]){_0x117a96[_0xbfb4('0x42')]=[{'all':!![]}];}return db[_0xbfb4('0x2c')][_0xbfb4('0x43')](_0x117a96);})['then'](function(_0x5743e2){_0x310873[_0xbfb4('0x44')]=_0x5743e2;return _0x310873;})[_0xbfb4('0x27')](respondWithFilteredResult(_0x2d1edb,_0x117a96))[_0xbfb4('0x45')](handleError(_0x2d1edb,null));};exports[_0xbfb4('0x46')]=function(_0x5cf060,_0x299bcf){var _0x455c26={'raw':!![],'where':{'id':_0x5cf060[_0xbfb4('0x47')]['id']}},_0x16aa13={};_0x16aa13['model']=_[_0xbfb4('0x32')](db[_0xbfb4('0x2c')][_0xbfb4('0x2d')]);_0x16aa13[_0xbfb4('0x31')]=_[_0xbfb4('0x32')](_0x5cf060[_0xbfb4('0x31')]);_0x16aa13[_0xbfb4('0x33')]=_[_0xbfb4('0x34')](_0x16aa13['model'],_0x16aa13[_0xbfb4('0x31')]);_0x455c26[_0xbfb4('0x35')]=_[_0xbfb4('0x34')](_0x16aa13[_0xbfb4('0x30')],qs[_0xbfb4('0x36')](_0x5cf060[_0xbfb4('0x31')]['fields']));_0x455c26[_0xbfb4('0x35')]=_0x455c26[_0xbfb4('0x35')]['length']?_0x455c26['attributes']:_0x16aa13[_0xbfb4('0x30')];if(_0x5cf060[_0xbfb4('0x31')][_0xbfb4('0x41')]){_0x455c26[_0xbfb4('0x42')]=[{'all':!![]}];}_0x455c26=_[_0xbfb4('0x3f')]({},_0x455c26,_0x5cf060[_0xbfb4('0x40')]);return db[_0xbfb4('0x2c')][_0xbfb4('0x48')](_0x455c26)[_0xbfb4('0x27')](handleEntityNotFound(_0x299bcf,null))[_0xbfb4('0x27')](respondWithResult(_0x299bcf,null))[_0xbfb4('0x45')](handleError(_0x299bcf,null));};exports[_0xbfb4('0x49')]=function(_0x2ed802,_0x579cb4){return db[_0xbfb4('0x2c')][_0xbfb4('0x49')](_0x2ed802[_0xbfb4('0x4a')],{})[_0xbfb4('0x27')](respondWithResult(_0x579cb4,0xc9))['catch'](handleError(_0x579cb4,null));};exports[_0xbfb4('0x26')]=function(_0x5eac20,_0x452142){if(_0x5eac20['body']['id']){delete _0x5eac20['body']['id'];}return db['AnalyticTreeReport'][_0xbfb4('0x48')]({'where':{'id':_0x5eac20[_0xbfb4('0x47')]['id']}})['then'](handleEntityNotFound(_0x452142,null))['then'](saveUpdates(_0x5eac20[_0xbfb4('0x4a')],null))['then'](respondWithResult(_0x452142,null))[_0xbfb4('0x45')](handleError(_0x452142,null));};exports[_0xbfb4('0x28')]=function(_0x6afa06,_0xbe22ae){return db[_0xbfb4('0x2c')][_0xbfb4('0x48')]({'where':{'id':_0x6afa06['params']['id']}})[_0xbfb4('0x27')](handleEntityNotFound(_0xbe22ae,null))[_0xbfb4('0x27')](removeEntity(_0xbe22ae,null))[_0xbfb4('0x45')](handleError(_0xbe22ae,null));}; \ No newline at end of file +var _0xc85f=['querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','AnalyticTreeReport','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js'];(function(_0x32f8d7,_0x4da0bd){var _0x29ea63=function(_0x26c9d8){while(--_0x26c9d8){_0x32f8d7['push'](_0x32f8d7['shift']());}};_0x29ea63(++_0x4da0bd);}(_0xc85f,0x163));var _0xfc85=function(_0x3553b5,_0x27c233){_0x3553b5=_0x3553b5-0x0;var _0x47f68e=_0xc85f[_0x3553b5];return _0x47f68e;};'use strict';var emlformat=require(_0xfc85('0x0'));var rimraf=require(_0xfc85('0x1'));var zipdir=require(_0xfc85('0x2'));var jsonpatch=require(_0xfc85('0x3'));var rp=require(_0xfc85('0x4'));var moment=require(_0xfc85('0x5'));var BPromise=require(_0xfc85('0x6'));var Mustache=require(_0xfc85('0x7'));var util=require(_0xfc85('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xfc85('0x9'));var ejs=require(_0xfc85('0xa'));var fs=require('fs');var fs_extra=require(_0xfc85('0xb'));var _=require(_0xfc85('0xc'));var squel=require(_0xfc85('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc85('0xe'));var toCsv=require(_0xfc85('0x9'));var querystring=require(_0xfc85('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfc85('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc85('0x11'));var logger=require(_0xfc85('0x12'))(_0xfc85('0x13'));var utils=require(_0xfc85('0x14'));var config=require(_0xfc85('0x15'));var licenseUtil=require(_0xfc85('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30b843,_0x3d90f6){_0x3d90f6=_0x3d90f6||0xcc;return function(_0x27f0eb){if(_0x27f0eb){return _0x30b843[_0xfc85('0x17')](_0x3d90f6);}return _0x30b843['status'](_0x3d90f6)[_0xfc85('0x18')]();};}function respondWithResult(_0x3d0906,_0x2503a6){_0x2503a6=_0x2503a6||0xc8;return function(_0x19dfde){if(_0x19dfde){return _0x3d0906['status'](_0x2503a6)[_0xfc85('0x19')](_0x19dfde);}};}function respondWithFilteredResult(_0x25db48,_0x504922){return function(_0x3068b6){if(_0x3068b6){var _0x3845b1=typeof _0x504922['offset']===_0xfc85('0x1a')&&typeof _0x504922[_0xfc85('0x1b')]===_0xfc85('0x1a');var _0x1f7d35=_0x3068b6[_0xfc85('0x1c')];var _0x4ad72b=_0x3845b1?0x0:_0x504922[_0xfc85('0x1d')];var _0x4b2a37=_0x3845b1?_0x3068b6[_0xfc85('0x1c')]:_0x504922[_0xfc85('0x1d')]+_0x504922[_0xfc85('0x1b')];var _0x13d158;if(_0x4b2a37>=_0x1f7d35){_0x4b2a37=_0x1f7d35;_0x13d158=0xc8;}else{_0x13d158=0xce;}_0x25db48[_0xfc85('0x1e')](_0x13d158);return _0x25db48[_0xfc85('0x1f')](_0xfc85('0x20'),_0x4ad72b+'-'+_0x4b2a37+'/'+_0x1f7d35)[_0xfc85('0x19')](_0x3068b6);}return null;};}function patchUpdates(_0x157c39){return function(_0x4e20c1){try{jsonpatch[_0xfc85('0x21')](_0x4e20c1,_0x157c39,!![]);}catch(_0x1e690a){return BPromise[_0xfc85('0x22')](_0x1e690a);}return _0x4e20c1[_0xfc85('0x23')]();};}function saveUpdates(_0x5f3586,_0x40cb71){return function(_0x5dd0b1){if(_0x5dd0b1){return _0x5dd0b1[_0xfc85('0x24')](_0x5f3586)[_0xfc85('0x25')](function(_0x56db18){return _0x56db18;});}return null;};}function removeEntity(_0x122111,_0x2eec52){return function(_0x5a030b){if(_0x5a030b){return _0x5a030b[_0xfc85('0x26')]()[_0xfc85('0x25')](function(){_0x122111[_0xfc85('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35bb69,_0x4aa3df){return function(_0x340633){if(!_0x340633){_0x35bb69[_0xfc85('0x17')](0x194);}return _0x340633;};}function handleError(_0x3f513c,_0x34187b){_0x34187b=_0x34187b||0x1f4;return function(_0x24adf3){logger[_0xfc85('0x27')](_0x24adf3[_0xfc85('0x28')]);if(_0x24adf3[_0xfc85('0x29')]){delete _0x24adf3['name'];}_0x3f513c[_0xfc85('0x1e')](_0x34187b)[_0xfc85('0x2a')](_0x24adf3);};}exports[_0xfc85('0x2b')]=function(_0x38a8bf,_0x1bb7e5){var _0x1fe253={},_0x438715={},_0x254778={'count':0x0,'rows':[]};var _0x202f66=_[_0xfc85('0x2c')](db['AnalyticTreeReport'][_0xfc85('0x2d')],function(_0x59eb35){return{'name':_0x59eb35[_0xfc85('0x2e')],'type':_0x59eb35[_0xfc85('0x2f')]['key']};});_0x438715[_0xfc85('0x30')]=_[_0xfc85('0x2c')](_0x202f66,_0xfc85('0x29'));_0x438715[_0xfc85('0x31')]=_[_0xfc85('0x32')](_0x38a8bf[_0xfc85('0x31')]);_0x438715[_0xfc85('0x33')]=_[_0xfc85('0x34')](_0x438715[_0xfc85('0x30')],_0x438715[_0xfc85('0x31')]);_0x1fe253['attributes']=_[_0xfc85('0x34')](_0x438715['model'],qs[_0xfc85('0x35')](_0x38a8bf[_0xfc85('0x31')]['fields']));_0x1fe253[_0xfc85('0x36')]=_0x1fe253['attributes'][_0xfc85('0x37')]?_0x1fe253[_0xfc85('0x36')]:_0x438715['model'];if(!_0x38a8bf[_0xfc85('0x31')][_0xfc85('0x38')](_0xfc85('0x39'))){_0x1fe253[_0xfc85('0x1b')]=qs['limit'](_0x38a8bf[_0xfc85('0x31')][_0xfc85('0x1b')]);_0x1fe253[_0xfc85('0x1d')]=qs[_0xfc85('0x1d')](_0x38a8bf['query']['offset']);}_0x1fe253[_0xfc85('0x3a')]=qs[_0xfc85('0x3b')](_0x38a8bf['query'][_0xfc85('0x3b')]);_0x1fe253[_0xfc85('0x3c')]=qs[_0xfc85('0x33')](_[_0xfc85('0x3d')](_0x38a8bf['query'],_0x438715['filters']),_0x202f66);if(_0x38a8bf[_0xfc85('0x31')][_0xfc85('0x3e')]){_0x1fe253[_0xfc85('0x3c')]=_[_0xfc85('0x3f')](_0x1fe253[_0xfc85('0x3c')],{'$or':_[_0xfc85('0x2c')](_0x202f66,function(_0x131636){if(_0x131636[_0xfc85('0x2f')]!=='VIRTUAL'){var _0x5bc62b={};_0x5bc62b[_0x131636[_0xfc85('0x29')]]={'$like':'%'+_0x38a8bf[_0xfc85('0x31')][_0xfc85('0x3e')]+'%'};return _0x5bc62b;}})});}_0x1fe253=_[_0xfc85('0x3f')]({},_0x1fe253,_0x38a8bf['options']);var _0xbb964b={'where':_0x1fe253[_0xfc85('0x3c')]};return db[_0xfc85('0x40')][_0xfc85('0x1c')](_0xbb964b)['then'](function(_0xbc5158){_0x254778[_0xfc85('0x1c')]=_0xbc5158;if(_0x38a8bf[_0xfc85('0x31')][_0xfc85('0x41')]){_0x1fe253['include']=[{'all':!![]}];}return db[_0xfc85('0x40')][_0xfc85('0x42')](_0x1fe253);})[_0xfc85('0x25')](function(_0x3a2863){_0x254778[_0xfc85('0x43')]=_0x3a2863;return _0x254778;})[_0xfc85('0x25')](respondWithFilteredResult(_0x1bb7e5,_0x1fe253))[_0xfc85('0x44')](handleError(_0x1bb7e5,null));};exports[_0xfc85('0x45')]=function(_0x1d533c,_0x1ffe51){var _0x5d764d={'raw':!![],'where':{'id':_0x1d533c[_0xfc85('0x46')]['id']}},_0x46f3cf={};_0x46f3cf[_0xfc85('0x30')]=_[_0xfc85('0x32')](db[_0xfc85('0x40')][_0xfc85('0x2d')]);_0x46f3cf[_0xfc85('0x31')]=_[_0xfc85('0x32')](_0x1d533c['query']);_0x46f3cf[_0xfc85('0x33')]=_[_0xfc85('0x34')](_0x46f3cf[_0xfc85('0x30')],_0x46f3cf[_0xfc85('0x31')]);_0x5d764d[_0xfc85('0x36')]=_[_0xfc85('0x34')](_0x46f3cf[_0xfc85('0x30')],qs['fields'](_0x1d533c[_0xfc85('0x31')][_0xfc85('0x35')]));_0x5d764d[_0xfc85('0x36')]=_0x5d764d[_0xfc85('0x36')][_0xfc85('0x37')]?_0x5d764d[_0xfc85('0x36')]:_0x46f3cf[_0xfc85('0x30')];if(_0x1d533c[_0xfc85('0x31')][_0xfc85('0x41')]){_0x5d764d['include']=[{'all':!![]}];}_0x5d764d=_[_0xfc85('0x3f')]({},_0x5d764d,_0x1d533c['options']);return db[_0xfc85('0x40')][_0xfc85('0x47')](_0x5d764d)[_0xfc85('0x25')](handleEntityNotFound(_0x1ffe51,null))['then'](respondWithResult(_0x1ffe51,null))[_0xfc85('0x44')](handleError(_0x1ffe51,null));};exports['create']=function(_0x32d674,_0x213019){return db[_0xfc85('0x40')][_0xfc85('0x48')](_0x32d674[_0xfc85('0x49')],{})[_0xfc85('0x25')](respondWithResult(_0x213019,0xc9))[_0xfc85('0x44')](handleError(_0x213019,null));};exports[_0xfc85('0x24')]=function(_0x1a3865,_0x54b6ac){if(_0x1a3865[_0xfc85('0x49')]['id']){delete _0x1a3865[_0xfc85('0x49')]['id'];}return db[_0xfc85('0x40')][_0xfc85('0x47')]({'where':{'id':_0x1a3865[_0xfc85('0x46')]['id']}})['then'](handleEntityNotFound(_0x54b6ac,null))['then'](saveUpdates(_0x1a3865[_0xfc85('0x49')],null))[_0xfc85('0x25')](respondWithResult(_0x54b6ac,null))[_0xfc85('0x44')](handleError(_0x54b6ac,null));};exports[_0xfc85('0x26')]=function(_0x344097,_0x88f8ed){return db[_0xfc85('0x40')]['find']({'where':{'id':_0x344097[_0xfc85('0x46')]['id']}})[_0xfc85('0x25')](handleEntityNotFound(_0x88f8ed,null))[_0xfc85('0x25')](removeEntity(_0x88f8ed,null))[_0xfc85('0x44')](handleError(_0x88f8ed,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index d1eac63..84612f5 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 _0x134d=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3ab53f,_0x508ae7){var _0x42c654=function(_0x4095e2){while(--_0x4095e2){_0x3ab53f['push'](_0x3ab53f['shift']());}};_0x42c654(++_0x508ae7);}(_0x134d,0x173));var _0xd134=function(_0x530a5d,_0x59d1ae){_0x530a5d=_0x530a5d-0x0;var _0x1b297d=_0x134d[_0x530a5d];return _0x1b297d;};'use strict';var _=require('lodash');var util=require(_0xd134('0x0'));var logger=require(_0xd134('0x1'))(_0xd134('0x2'));var moment=require(_0xd134('0x3'));var BPromise=require(_0xd134('0x4'));var rp=require(_0xd134('0x5'));var fs=require('fs');var path=require(_0xd134('0x6'));var rimraf=require(_0xd134('0x7'));var config=require(_0xd134('0x8'));var attributes=require(_0xd134('0x9'));module[_0xd134('0xa')]=function(_0x5d6249,_0x5911a5){return _0x5d6249[_0xd134('0xb')](_0xd134('0xc'),attributes,{'tableName':_0xd134('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f2b=['define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x266c69,_0xa8e09b){var _0x5f40b1=function(_0x462884){while(--_0x462884){_0x266c69['push'](_0x266c69['shift']());}};_0x5f40b1(++_0xa8e09b);}(_0x3f2b,0x9d));var _0xb3f2=function(_0x4a6949,_0x19f035){_0x4a6949=_0x4a6949-0x0;var _0x142277=_0x3f2b[_0x4a6949];return _0x142277;};'use strict';var _=require(_0xb3f2('0x0'));var util=require(_0xb3f2('0x1'));var logger=require(_0xb3f2('0x2'))(_0xb3f2('0x3'));var moment=require(_0xb3f2('0x4'));var BPromise=require(_0xb3f2('0x5'));var rp=require(_0xb3f2('0x6'));var fs=require('fs');var path=require(_0xb3f2('0x7'));var rimraf=require('rimraf');var config=require(_0xb3f2('0x8'));var attributes=require(_0xb3f2('0x9'));module[_0xb3f2('0xa')]=function(_0x58609b,_0x421be4){return _0x58609b[_0xb3f2('0xb')](_0xb3f2('0xc'),attributes,{'tableName':_0xb3f2('0xd'),'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 6089a78..06a316c 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x5d628f,_0xdfa6ac){var _0x68983a=function(_0x3c28ae){while(--_0x3c28ae){_0x5d628f['push'](_0x5d628f['shift']());}};_0x68983a(++_0xdfa6ac);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2de25a,_0x5df46f){_0x2de25a=_0x2de25a-0x0;var _0x132f44=_0x5f2f[_0x2de25a];return _0x132f44;};'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')]('AnalyticTreeReport,\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);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\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(_0x1bb832,_0x366797){_0x1bb832=_0x1bb832-0x0;var _0x38bc37=_0x7a54[_0x1bb832];return _0x38bc37;};'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')]('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index d0d2bbe..fda5717 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 _0x2472=['put','update','exports','util','path','Router','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x3609af,_0x3d20ea){var _0x438412=function(_0x3bc2a4){while(--_0x3bc2a4){_0x3609af['push'](_0x3609af['shift']());}};_0x438412(++_0x3d20ea);}(_0x2472,0xe3));var _0x2247=function(_0x4eb2b5,_0x35d937){_0x4eb2b5=_0x4eb2b5-0x0;var _0x226ef8=_0x2472[_0x4eb2b5];return _0x226ef8;};'use strict';var multer=require('multer');var util=require(_0x2247('0x0'));var path=require(_0x2247('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2247('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2247('0x3'));var config=require('../../config/environment');var controller=require(_0x2247('0x4'));router[_0x2247('0x5')]('/',auth[_0x2247('0x6')](),controller[_0x2247('0x7')]);router[_0x2247('0x5')](_0x2247('0x8'),auth[_0x2247('0x6')](),controller[_0x2247('0x9')]);router[_0x2247('0xa')]('/',auth[_0x2247('0x6')](),controller['create']);router[_0x2247('0xb')]('/:id',auth[_0x2247('0x6')](),controller[_0x2247('0xc')]);router['delete'](_0x2247('0x8'),auth[_0x2247('0x6')](),controller['destroy']);module[_0x2247('0xd')]=router; \ No newline at end of file +var _0xa6b6=['../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xa6b6,0x171));var _0x6a6b=function(_0x161587,_0x5c4528){_0x161587=_0x161587-0x0;var _0x293546=_0xa6b6[_0x161587];return _0x293546;};'use strict';var multer=require(_0x6a6b('0x0'));var util=require(_0x6a6b('0x1'));var path=require(_0x6a6b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6a6b('0x3'));var auth=require(_0x6a6b('0x4'));var interaction=require(_0x6a6b('0x5'));var config=require('../../config/environment');var controller=require(_0x6a6b('0x6'));router[_0x6a6b('0x7')]('/',auth[_0x6a6b('0x8')](),controller[_0x6a6b('0x9')]);router[_0x6a6b('0x7')](_0x6a6b('0xa'),auth[_0x6a6b('0x8')](),controller[_0x6a6b('0xb')]);router[_0x6a6b('0xc')]('/',auth[_0x6a6b('0x8')](),controller[_0x6a6b('0xd')]);router['put'](_0x6a6b('0xa'),auth['isAuthenticated'](),controller[_0x6a6b('0xe')]);router[_0x6a6b('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6a6b('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index ce80c58..41ad5e6 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 _0xeedf=['sequelize','exports','STRING'];(function(_0x5c0431,_0x122734){var _0x516bfa=function(_0x4528e4){while(--_0x4528e4){_0x5c0431['push'](_0x5c0431['shift']());}};_0x516bfa(++_0x122734);}(_0xeedf,0x12c));var _0xfeed=function(_0x204912,_0x491149){_0x204912=_0x204912-0x0;var _0x568075=_0xeedf[_0x204912];return _0x568075;};'use strict';var Sequelize=require(_0xfeed('0x0'));module[_0xfeed('0x1')]={'name':{'type':Sequelize[_0xfeed('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfeed('0x2')]}}; \ No newline at end of file +var _0xecd5=['exports','STRING'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xecd5,0x110));var _0x5ecd=function(_0x32849f,_0x530722){_0x32849f=_0x32849f-0x0;var _0x2b34c7=_0xecd5[_0x32849f];return _0x2b34c7;};'use strict';var Sequelize=require('sequelize');module[_0x5ecd('0x0')]={'name':{'type':Sequelize[_0x5ecd('0x1')]},'basename':{'type':Sequelize[_0x5ecd('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index f66207d..32cbcd4 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 _0xf57f=['options','include','findAll','show','params','keys','Attachment','find','catch','clone','includeAll','get','omit','createdAt','updatedAt','body','create','file','basename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL'];(function(_0x2a2f72,_0x2dead3){var _0x369c6a=function(_0x252507){while(--_0x252507){_0x2a2f72['push'](_0x2a2f72['shift']());}};_0x369c6a(++_0x2dead3);}(_0xf57f,0x166));var _0xff57=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0xf57f[_0x31abee];return _0x3c1761;};'use strict';var emlformat=require(_0xff57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff57('0x1'));var jsonpatch=require(_0xff57('0x2'));var rp=require('request-promise');var moment=require(_0xff57('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xff57('0x4'));var sox=require(_0xff57('0x5'));var csv=require(_0xff57('0x6'));var ejs=require(_0xff57('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff57('0x8'));var squel=require('squel');var crypto=require(_0xff57('0x9'));var jsforce=require(_0xff57('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xff57('0x6'));var querystring=require(_0xff57('0xb'));var Papa=require('papaparse');var Redis=require(_0xff57('0xc'));var authService=require(_0xff57('0xd'));var qs=require(_0xff57('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff57('0xf'));var logger=require(_0xff57('0x10'))(_0xff57('0x11'));var utils=require(_0xff57('0x12'));var config=require(_0xff57('0x13'));var licenseUtil=require(_0xff57('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57c351,_0x322f1b){_0x322f1b=_0x322f1b||0xcc;return function(_0xa0ba48){if(_0xa0ba48){return _0x57c351['sendStatus'](_0x322f1b);}return _0x57c351[_0xff57('0x15')](_0x322f1b)[_0xff57('0x16')]();};}function respondWithResult(_0x292b3e,_0x4255d6){_0x4255d6=_0x4255d6||0xc8;return function(_0x2e830a){if(_0x2e830a){return _0x292b3e['status'](_0x4255d6)['json'](_0x2e830a);}};}function respondWithFilteredResult(_0x491eac,_0x3f2995){return function(_0x276127){if(_0x276127){var _0x2ed712=typeof _0x3f2995[_0xff57('0x17')]==='undefined'&&typeof _0x3f2995[_0xff57('0x18')]===_0xff57('0x19');var _0x1b4e66=_0x276127[_0xff57('0x1a')];var _0x4cf6fd=_0x2ed712?0x0:_0x3f2995[_0xff57('0x17')];var _0x1307c3=_0x2ed712?_0x276127[_0xff57('0x1a')]:_0x3f2995[_0xff57('0x17')]+_0x3f2995[_0xff57('0x18')];var _0x46cc53;if(_0x1307c3>=_0x1b4e66){_0x1307c3=_0x1b4e66;_0x46cc53=0xc8;}else{_0x46cc53=0xce;}_0x491eac[_0xff57('0x15')](_0x46cc53);return _0x491eac[_0xff57('0x1b')](_0xff57('0x1c'),_0x4cf6fd+'-'+_0x1307c3+'/'+_0x1b4e66)[_0xff57('0x1d')](_0x276127);}return null;};}function patchUpdates(_0xb1a8bd){return function(_0x53bf82){try{jsonpatch['apply'](_0x53bf82,_0xb1a8bd,!![]);}catch(_0x493d67){return BPromise[_0xff57('0x1e')](_0x493d67);}return _0x53bf82[_0xff57('0x1f')]();};}function saveUpdates(_0x532c6c,_0x568fd5){return function(_0x4fae20){if(_0x4fae20){return _0x4fae20['update'](_0x532c6c)[_0xff57('0x20')](function(_0x21ac20){return _0x21ac20;});}return null;};}function removeEntity(_0x4bb241,_0x39fd56){return function(_0x1977de){if(_0x1977de){return _0x1977de['destroy']()[_0xff57('0x20')](function(){_0x4bb241[_0xff57('0x15')](0xcc)[_0xff57('0x16')]();});}};}function handleEntityNotFound(_0x8c32f5,_0x1eb8bb){return function(_0x195a97){if(!_0x195a97){_0x8c32f5[_0xff57('0x21')](0x194);}return _0x195a97;};}function handleError(_0x13970a,_0x44886f){_0x44886f=_0x44886f||0x1f4;return function(_0x3699c0){logger[_0xff57('0x22')](_0x3699c0[_0xff57('0x23')]);if(_0x3699c0['name']){delete _0x3699c0[_0xff57('0x24')];}_0x13970a['status'](_0x44886f)['send'](_0x3699c0);};}exports[_0xff57('0x25')]=function(_0x4a2387,_0x49834e){var _0x3aa3e5={},_0x4f319c={},_0x27314e={'count':0x0,'rows':[]};var _0x13ba0b=_[_0xff57('0x26')](db['Attachment'][_0xff57('0x27')],function(_0x235e57){return{'name':_0x235e57[_0xff57('0x28')],'type':_0x235e57[_0xff57('0x29')]['key']};});_0x4f319c[_0xff57('0x2a')]=_[_0xff57('0x26')](_0x13ba0b,_0xff57('0x24'));_0x4f319c[_0xff57('0x2b')]=_['keys'](_0x4a2387[_0xff57('0x2b')]);_0x4f319c['filters']=_[_0xff57('0x2c')](_0x4f319c[_0xff57('0x2a')],_0x4f319c[_0xff57('0x2b')]);_0x3aa3e5[_0xff57('0x2d')]=_['intersection'](_0x4f319c[_0xff57('0x2a')],qs['fields'](_0x4a2387['query'][_0xff57('0x2e')]));_0x3aa3e5['attributes']=_0x3aa3e5[_0xff57('0x2d')][_0xff57('0x2f')]?_0x3aa3e5[_0xff57('0x2d')]:_0x4f319c[_0xff57('0x2a')];if(!_0x4a2387[_0xff57('0x2b')][_0xff57('0x30')](_0xff57('0x31'))){_0x3aa3e5[_0xff57('0x18')]=qs[_0xff57('0x18')](_0x4a2387[_0xff57('0x2b')]['limit']);_0x3aa3e5[_0xff57('0x17')]=qs['offset'](_0x4a2387[_0xff57('0x2b')][_0xff57('0x17')]);}_0x3aa3e5['order']=qs[_0xff57('0x32')](_0x4a2387[_0xff57('0x2b')][_0xff57('0x32')]);_0x3aa3e5['where']=qs[_0xff57('0x33')](_[_0xff57('0x34')](_0x4a2387[_0xff57('0x2b')],_0x4f319c['filters']),_0x13ba0b);if(_0x4a2387['query'][_0xff57('0x35')]){_0x3aa3e5[_0xff57('0x36')]=_[_0xff57('0x37')](_0x3aa3e5[_0xff57('0x36')],{'$or':_[_0xff57('0x26')](_0x13ba0b,function(_0x273b4b){if(_0x273b4b[_0xff57('0x29')]!==_0xff57('0x38')){var _0x364e9f={};_0x364e9f[_0x273b4b[_0xff57('0x24')]]={'$like':'%'+_0x4a2387[_0xff57('0x2b')][_0xff57('0x35')]+'%'};return _0x364e9f;}})});}_0x3aa3e5=_[_0xff57('0x37')]({},_0x3aa3e5,_0x4a2387[_0xff57('0x39')]);var _0x5086f3={'where':_0x3aa3e5[_0xff57('0x36')]};return db['Attachment'][_0xff57('0x1a')](_0x5086f3)['then'](function(_0x4c49ab){_0x27314e[_0xff57('0x1a')]=_0x4c49ab;if(_0x4a2387['query']['includeAll']){_0x3aa3e5[_0xff57('0x3a')]=[{'all':!![]}];}return db['Attachment'][_0xff57('0x3b')](_0x3aa3e5);})[_0xff57('0x20')](function(_0x1c1d4c){_0x27314e['rows']=_0x1c1d4c;return _0x27314e;})[_0xff57('0x20')](respondWithFilteredResult(_0x49834e,_0x3aa3e5))['catch'](handleError(_0x49834e,null));};exports[_0xff57('0x3c')]=function(_0x5939c2,_0x2098cf){var _0x6f220e={'raw':!![],'where':{'id':_0x5939c2[_0xff57('0x3d')]['id']}},_0x403f9b={};_0x403f9b[_0xff57('0x2a')]=_[_0xff57('0x3e')](db[_0xff57('0x3f')][_0xff57('0x27')]);_0x403f9b[_0xff57('0x2b')]=_[_0xff57('0x3e')](_0x5939c2[_0xff57('0x2b')]);_0x403f9b[_0xff57('0x33')]=_[_0xff57('0x2c')](_0x403f9b['model'],_0x403f9b[_0xff57('0x2b')]);_0x6f220e['attributes']=_[_0xff57('0x2c')](_0x403f9b['model'],qs[_0xff57('0x2e')](_0x5939c2[_0xff57('0x2b')][_0xff57('0x2e')]));_0x6f220e[_0xff57('0x2d')]=_0x6f220e[_0xff57('0x2d')][_0xff57('0x2f')]?_0x6f220e[_0xff57('0x2d')]:_0x403f9b[_0xff57('0x2a')];if(_0x5939c2['query']['includeAll']){_0x6f220e[_0xff57('0x3a')]=[{'all':!![]}];}_0x6f220e=_[_0xff57('0x37')]({},_0x6f220e,_0x5939c2['options']);return db['Attachment'][_0xff57('0x40')](_0x6f220e)['then'](handleEntityNotFound(_0x2098cf,null))[_0xff57('0x20')](respondWithResult(_0x2098cf,null))[_0xff57('0x41')](handleError(_0x2098cf,null));};exports[_0xff57('0x42')]=function(_0x4f7f35,_0x2911ee){var _0x273be7={'where':{'id':_0x4f7f35[_0xff57('0x3d')]['id']}},_0x66c534={};_0x66c534[_0xff57('0x2a')]=_[_0xff57('0x3e')](db[_0xff57('0x3f')][_0xff57('0x27')]);_0x273be7['attributes']=_[_0xff57('0x2c')](_0x66c534['model'],qs['fields'](_0x4f7f35[_0xff57('0x2b')][_0xff57('0x2e')]));_0x273be7['attributes']=_0x273be7[_0xff57('0x2d')][_0xff57('0x2f')]?_0x273be7[_0xff57('0x2d')]:_0x66c534[_0xff57('0x2a')];if(_0x4f7f35[_0xff57('0x2b')][_0xff57('0x43')]){_0x273be7['include']=[{'all':!![]}];}_0x273be7=_[_0xff57('0x37')]({},_0x273be7,_0x4f7f35['options']);return db[_0xff57('0x3f')]['find'](_0x273be7)[_0xff57('0x20')](handleEntityNotFound(_0x2911ee,null))['then'](function(_0xed4a6f){if(_0xed4a6f){var _0x1f513d=_0xed4a6f[_0xff57('0x44')]({'plain':!![]});_0x1f513d=qs[_0xff57('0x45')](_0x1f513d,['id',_0xff57('0x46'),_0xff57('0x47')]);_0x4f7f35[_0xff57('0x48')]=_[_0xff57('0x45')](_0x4f7f35['body'],['id','createdAt',_0xff57('0x47')]);return db['Attachment'][_0xff57('0x49')](_[_0xff57('0x37')](_0x1f513d,_0x4f7f35[_0xff57('0x48')]),{'include':_0x4f7f35[_0xff57('0x2b')][_0xff57('0x43')]?[{'all':!![]}]:undefined});}})[_0xff57('0x20')](respondWithResult(_0x2911ee,0xc9))[_0xff57('0x41')](handleError(_0x2911ee,null));};exports['update']=function(_0x211a35,_0x12355a){if(_0x211a35['body']['id']){delete _0x211a35[_0xff57('0x48')]['id'];}return db[_0xff57('0x3f')][_0xff57('0x40')]({'where':{'id':_0x211a35['params']['id']}})[_0xff57('0x20')](handleEntityNotFound(_0x12355a,null))[_0xff57('0x20')](saveUpdates(_0x211a35['body'],null))['then'](respondWithResult(_0x12355a,null))[_0xff57('0x41')](handleError(_0x12355a,null));};exports['destroy']=function(_0x2b0342,_0x1cec55){return db['Attachment'][_0xff57('0x40')]({'where':{'id':_0x2b0342[_0xff57('0x3d')]['id']}})[_0xff57('0x20')](handleEntityNotFound(_0x1cec55,null))[_0xff57('0x20')](removeEntity(_0x1cec55,null))[_0xff57('0x41')](handleError(_0x1cec55,null));};exports[_0xff57('0x49')]=function(_0x2c8bf2,_0x3bf119,_0x34ed44){_0x2c8bf2[_0xff57('0x48')][_0xff57('0x24')]=_0x2c8bf2[_0xff57('0x4a')]['originalname'];_0x2c8bf2['body'][_0xff57('0x4b')]=_0x2c8bf2['file']['filename'];_0x2c8bf2['body'][_0xff57('0x29')]=_0x2c8bf2[_0xff57('0x4a')]['mimetype'];return db[_0xff57('0x3f')][_0xff57('0x49')](_0x2c8bf2[_0xff57('0x48')])['then'](respondWithResult(_0x3bf119,0xc9))[_0xff57('0x41')](handleError(_0x3bf119,null));};exports[_0xff57('0x4c')]=function(_0x2f7427,_0x26ead9,_0x36be45){return db['Attachment'][_0xff57('0x4d')]({'where':{'id':_0x2f7427['params']['id']},'raw':!![]})[_0xff57('0x20')](handleEntityNotFound(_0x26ead9,null))[_0xff57('0x20')](function(_0x4518e0){if(_0x4518e0){var _0x1e3f54=_0x4518e0[_0xff57('0x4e')]!==null;var _0x95d87d=path[_0xff57('0x4f')](config[_0xff57('0x50')],_0xff57('0x51'));if(_0x1e3f54){_0x95d87d=path[_0xff57('0x4f')](_0x95d87d,_0xff57('0x52'));}var _0x490c04=path[_0xff57('0x4f')](_0x95d87d,_0x4518e0['basename']);return _0x26ead9[_0xff57('0x4c')](_0x490c04);}})[_0xff57('0x41')](handleError(_0x26ead9,null));}; \ No newline at end of file +var _0x27bf=['status','end','json','offset','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','Attachment','include','findAll','catch','params','includeAll','find','clone','rawAttributes','get','omit','createdAt','updatedAt','create','body','file','originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','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'];(function(_0x2dffb4,_0x4bbbf3){var _0x4174ec=function(_0x13ec24){while(--_0x13ec24){_0x2dffb4['push'](_0x2dffb4['shift']());}};_0x4174ec(++_0x4bbbf3);}(_0x27bf,0x14e));var _0xf27b=function(_0xbe46a1,_0x496093){_0xbe46a1=_0xbe46a1-0x0;var _0x399489=_0x27bf[_0xbe46a1];return _0x399489;};'use strict';var emlformat=require(_0xf27b('0x0'));var rimraf=require(_0xf27b('0x1'));var zipdir=require(_0xf27b('0x2'));var jsonpatch=require(_0xf27b('0x3'));var rp=require('request-promise');var moment=require(_0xf27b('0x4'));var BPromise=require(_0xf27b('0x5'));var Mustache=require(_0xf27b('0x6'));var util=require(_0xf27b('0x7'));var path=require(_0xf27b('0x8'));var sox=require(_0xf27b('0x9'));var csv=require(_0xf27b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf27b('0xb'));var squel=require(_0xf27b('0xc'));var crypto=require(_0xf27b('0xd'));var jsforce=require(_0xf27b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf27b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf27b('0x10'));var qs=require(_0xf27b('0x11'));var as=require(_0xf27b('0x12'));var hardwareService=require(_0xf27b('0x13'));var logger=require(_0xf27b('0x14'))(_0xf27b('0x15'));var utils=require(_0xf27b('0x16'));var config=require(_0xf27b('0x17'));var licenseUtil=require(_0xf27b('0x18'));var db=require(_0xf27b('0x19'))['db'];function respondWithStatusCode(_0x1cffb7,_0x224efc){_0x224efc=_0x224efc||0xcc;return function(_0x23403c){if(_0x23403c){return _0x1cffb7['sendStatus'](_0x224efc);}return _0x1cffb7[_0xf27b('0x1a')](_0x224efc)[_0xf27b('0x1b')]();};}function respondWithResult(_0x199d02,_0x327fc8){_0x327fc8=_0x327fc8||0xc8;return function(_0x21402b){if(_0x21402b){return _0x199d02[_0xf27b('0x1a')](_0x327fc8)[_0xf27b('0x1c')](_0x21402b);}};}function respondWithFilteredResult(_0x510fc2,_0x214d76){return function(_0x58dd31){if(_0x58dd31){var _0x19ee90=typeof _0x214d76[_0xf27b('0x1d')]==='undefined'&&typeof _0x214d76[_0xf27b('0x1e')]==='undefined';var _0x6a1766=_0x58dd31[_0xf27b('0x1f')];var _0x249e9b=_0x19ee90?0x0:_0x214d76['offset'];var _0x1e22be=_0x19ee90?_0x58dd31[_0xf27b('0x1f')]:_0x214d76['offset']+_0x214d76[_0xf27b('0x1e')];var _0x4175cd;if(_0x1e22be>=_0x6a1766){_0x1e22be=_0x6a1766;_0x4175cd=0xc8;}else{_0x4175cd=0xce;}_0x510fc2[_0xf27b('0x1a')](_0x4175cd);return _0x510fc2['set'](_0xf27b('0x20'),_0x249e9b+'-'+_0x1e22be+'/'+_0x6a1766)['json'](_0x58dd31);}return null;};}function patchUpdates(_0x5c9f70){return function(_0x2b2cf3){try{jsonpatch[_0xf27b('0x21')](_0x2b2cf3,_0x5c9f70,!![]);}catch(_0xe8eeb){return BPromise[_0xf27b('0x22')](_0xe8eeb);}return _0x2b2cf3['save']();};}function saveUpdates(_0x25af00,_0x431ba4){return function(_0x5edcc7){if(_0x5edcc7){return _0x5edcc7[_0xf27b('0x23')](_0x25af00)[_0xf27b('0x24')](function(_0x53ab3a){return _0x53ab3a;});}return null;};}function removeEntity(_0x30bdcd,_0x66e78e){return function(_0x2446dd){if(_0x2446dd){return _0x2446dd[_0xf27b('0x25')]()['then'](function(){_0x30bdcd[_0xf27b('0x1a')](0xcc)[_0xf27b('0x1b')]();});}};}function handleEntityNotFound(_0x31c1ae,_0x292358){return function(_0x311994){if(!_0x311994){_0x31c1ae[_0xf27b('0x26')](0x194);}return _0x311994;};}function handleError(_0x2e6355,_0x3291ca){_0x3291ca=_0x3291ca||0x1f4;return function(_0x4251bb){logger[_0xf27b('0x27')](_0x4251bb[_0xf27b('0x28')]);if(_0x4251bb[_0xf27b('0x29')]){delete _0x4251bb['name'];}_0x2e6355[_0xf27b('0x1a')](_0x3291ca)[_0xf27b('0x2a')](_0x4251bb);};}exports[_0xf27b('0x2b')]=function(_0x2a0f63,_0xd77301){var _0x40b1c4={},_0x58f3b9={},_0xfe1fc4={'count':0x0,'rows':[]};var _0x30cd3d=_[_0xf27b('0x2c')](db['Attachment']['rawAttributes'],function(_0x1cad44){return{'name':_0x1cad44[_0xf27b('0x2d')],'type':_0x1cad44[_0xf27b('0x2e')]['key']};});_0x58f3b9['model']=_[_0xf27b('0x2c')](_0x30cd3d,'name');_0x58f3b9[_0xf27b('0x2f')]=_[_0xf27b('0x30')](_0x2a0f63[_0xf27b('0x2f')]);_0x58f3b9[_0xf27b('0x31')]=_[_0xf27b('0x32')](_0x58f3b9[_0xf27b('0x33')],_0x58f3b9[_0xf27b('0x2f')]);_0x40b1c4[_0xf27b('0x34')]=_[_0xf27b('0x32')](_0x58f3b9['model'],qs[_0xf27b('0x35')](_0x2a0f63[_0xf27b('0x2f')]['fields']));_0x40b1c4[_0xf27b('0x34')]=_0x40b1c4[_0xf27b('0x34')][_0xf27b('0x36')]?_0x40b1c4[_0xf27b('0x34')]:_0x58f3b9[_0xf27b('0x33')];if(!_0x2a0f63[_0xf27b('0x2f')][_0xf27b('0x37')](_0xf27b('0x38'))){_0x40b1c4[_0xf27b('0x1e')]=qs[_0xf27b('0x1e')](_0x2a0f63['query'][_0xf27b('0x1e')]);_0x40b1c4[_0xf27b('0x1d')]=qs[_0xf27b('0x1d')](_0x2a0f63['query'][_0xf27b('0x1d')]);}_0x40b1c4['order']=qs[_0xf27b('0x39')](_0x2a0f63[_0xf27b('0x2f')][_0xf27b('0x39')]);_0x40b1c4[_0xf27b('0x3a')]=qs[_0xf27b('0x31')](_['pick'](_0x2a0f63[_0xf27b('0x2f')],_0x58f3b9['filters']),_0x30cd3d);if(_0x2a0f63[_0xf27b('0x2f')][_0xf27b('0x3b')]){_0x40b1c4[_0xf27b('0x3a')]=_['merge'](_0x40b1c4[_0xf27b('0x3a')],{'$or':_[_0xf27b('0x2c')](_0x30cd3d,function(_0x41058c){if(_0x41058c['type']!==_0xf27b('0x3c')){var _0xe51d9e={};_0xe51d9e[_0x41058c['name']]={'$like':'%'+_0x2a0f63[_0xf27b('0x2f')][_0xf27b('0x3b')]+'%'};return _0xe51d9e;}})});}_0x40b1c4=_[_0xf27b('0x3d')]({},_0x40b1c4,_0x2a0f63[_0xf27b('0x3e')]);var _0x4f3515={'where':_0x40b1c4[_0xf27b('0x3a')]};return db[_0xf27b('0x3f')]['count'](_0x4f3515)[_0xf27b('0x24')](function(_0x1b8bd2){_0xfe1fc4[_0xf27b('0x1f')]=_0x1b8bd2;if(_0x2a0f63[_0xf27b('0x2f')]['includeAll']){_0x40b1c4[_0xf27b('0x40')]=[{'all':!![]}];}return db['Attachment'][_0xf27b('0x41')](_0x40b1c4);})[_0xf27b('0x24')](function(_0x36ee8a){_0xfe1fc4['rows']=_0x36ee8a;return _0xfe1fc4;})[_0xf27b('0x24')](respondWithFilteredResult(_0xd77301,_0x40b1c4))[_0xf27b('0x42')](handleError(_0xd77301,null));};exports['show']=function(_0x5364f2,_0x59ca9c){var _0x46931e={'raw':!![],'where':{'id':_0x5364f2[_0xf27b('0x43')]['id']}},_0x343212={};_0x343212[_0xf27b('0x33')]=_[_0xf27b('0x30')](db[_0xf27b('0x3f')]['rawAttributes']);_0x343212[_0xf27b('0x2f')]=_['keys'](_0x5364f2[_0xf27b('0x2f')]);_0x343212[_0xf27b('0x31')]=_[_0xf27b('0x32')](_0x343212['model'],_0x343212[_0xf27b('0x2f')]);_0x46931e[_0xf27b('0x34')]=_[_0xf27b('0x32')](_0x343212['model'],qs['fields'](_0x5364f2[_0xf27b('0x2f')]['fields']));_0x46931e[_0xf27b('0x34')]=_0x46931e['attributes'][_0xf27b('0x36')]?_0x46931e[_0xf27b('0x34')]:_0x343212[_0xf27b('0x33')];if(_0x5364f2[_0xf27b('0x2f')][_0xf27b('0x44')]){_0x46931e[_0xf27b('0x40')]=[{'all':!![]}];}_0x46931e=_[_0xf27b('0x3d')]({},_0x46931e,_0x5364f2[_0xf27b('0x3e')]);return db[_0xf27b('0x3f')][_0xf27b('0x45')](_0x46931e)['then'](handleEntityNotFound(_0x59ca9c,null))[_0xf27b('0x24')](respondWithResult(_0x59ca9c,null))[_0xf27b('0x42')](handleError(_0x59ca9c,null));};exports[_0xf27b('0x46')]=function(_0x3951a2,_0x24912){var _0x5acff9={'where':{'id':_0x3951a2[_0xf27b('0x43')]['id']}},_0x203b6e={};_0x203b6e['model']=_[_0xf27b('0x30')](db[_0xf27b('0x3f')][_0xf27b('0x47')]);_0x5acff9[_0xf27b('0x34')]=_[_0xf27b('0x32')](_0x203b6e[_0xf27b('0x33')],qs[_0xf27b('0x35')](_0x3951a2[_0xf27b('0x2f')]['fields']));_0x5acff9[_0xf27b('0x34')]=_0x5acff9[_0xf27b('0x34')][_0xf27b('0x36')]?_0x5acff9['attributes']:_0x203b6e['model'];if(_0x3951a2[_0xf27b('0x2f')]['includeAll']){_0x5acff9[_0xf27b('0x40')]=[{'all':!![]}];}_0x5acff9=_[_0xf27b('0x3d')]({},_0x5acff9,_0x3951a2[_0xf27b('0x3e')]);return db['Attachment']['find'](_0x5acff9)[_0xf27b('0x24')](handleEntityNotFound(_0x24912,null))[_0xf27b('0x24')](function(_0x3de91d){if(_0x3de91d){var _0x267f1f=_0x3de91d[_0xf27b('0x48')]({'plain':!![]});_0x267f1f=qs[_0xf27b('0x49')](_0x267f1f,['id',_0xf27b('0x4a'),'updatedAt']);_0x3951a2['body']=_[_0xf27b('0x49')](_0x3951a2['body'],['id',_0xf27b('0x4a'),_0xf27b('0x4b')]);return db[_0xf27b('0x3f')][_0xf27b('0x4c')](_['merge'](_0x267f1f,_0x3951a2[_0xf27b('0x4d')]),{'include':_0x3951a2['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xf27b('0x24')](respondWithResult(_0x24912,0xc9))[_0xf27b('0x42')](handleError(_0x24912,null));};exports[_0xf27b('0x23')]=function(_0x39b22e,_0x29e462){if(_0x39b22e[_0xf27b('0x4d')]['id']){delete _0x39b22e['body']['id'];}return db[_0xf27b('0x3f')][_0xf27b('0x45')]({'where':{'id':_0x39b22e['params']['id']}})['then'](handleEntityNotFound(_0x29e462,null))[_0xf27b('0x24')](saveUpdates(_0x39b22e['body'],null))[_0xf27b('0x24')](respondWithResult(_0x29e462,null))[_0xf27b('0x42')](handleError(_0x29e462,null));};exports['destroy']=function(_0x5c5267,_0x4a3f95){return db[_0xf27b('0x3f')][_0xf27b('0x45')]({'where':{'id':_0x5c5267[_0xf27b('0x43')]['id']}})[_0xf27b('0x24')](handleEntityNotFound(_0x4a3f95,null))[_0xf27b('0x24')](removeEntity(_0x4a3f95,null))['catch'](handleError(_0x4a3f95,null));};exports[_0xf27b('0x4c')]=function(_0x5cbe1e,_0xe25b4c,_0x51d88a){_0x5cbe1e['body'][_0xf27b('0x29')]=_0x5cbe1e[_0xf27b('0x4e')][_0xf27b('0x4f')];_0x5cbe1e['body'][_0xf27b('0x50')]=_0x5cbe1e[_0xf27b('0x4e')][_0xf27b('0x51')];_0x5cbe1e[_0xf27b('0x4d')][_0xf27b('0x2e')]=_0x5cbe1e[_0xf27b('0x4e')][_0xf27b('0x52')];return db['Attachment'][_0xf27b('0x4c')](_0x5cbe1e[_0xf27b('0x4d')])[_0xf27b('0x24')](respondWithResult(_0xe25b4c,0xc9))[_0xf27b('0x42')](handleError(_0xe25b4c,null));};exports['download']=function(_0x3cff39,_0x3fdf2c,_0x1e3abb){return db[_0xf27b('0x3f')][_0xf27b('0x53')]({'where':{'id':_0x3cff39['params']['id']},'raw':!![]})[_0xf27b('0x24')](handleEntityNotFound(_0x3fdf2c,null))[_0xf27b('0x24')](function(_0xc48d01){if(_0xc48d01){var _0x64731f=_0xc48d01[_0xf27b('0x54')]!==null;var _0xd8ddae=path['join'](config[_0xf27b('0x55')],_0xf27b('0x56'));if(_0x64731f){_0xd8ddae=path[_0xf27b('0x57')](_0xd8ddae,_0xf27b('0x58'));}var _0x36d8c5=path[_0xf27b('0x57')](_0xd8ddae,_0xc48d01[_0xf27b('0x50')]);return _0x3fdf2c[_0xf27b('0x59')](_0x36d8c5);}})['catch'](handleError(_0x3fdf2c,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index b1962b6..0ec28c2 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 _0x9ed5=['bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','attachments','util','../../config/logger','moment'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x9ed5,0x126));var _0x59ed=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x9ed5[_0x27bd2c];return _0x3784ea;};'use strict';var _=require('lodash');var util=require(_0x59ed('0x0'));var logger=require(_0x59ed('0x1'))('api');var moment=require(_0x59ed('0x2'));var BPromise=require(_0x59ed('0x3'));var rp=require(_0x59ed('0x4'));var fs=require('fs');var path=require(_0x59ed('0x5'));var rimraf=require(_0x59ed('0x6'));var config=require(_0x59ed('0x7'));var attributes=require(_0x59ed('0x8'));module[_0x59ed('0x9')]=function(_0x583118,_0xb1d3db){return _0x583118['define']('Attachment',attributes,{'tableName':_0x59ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1806=['bluebird','path','rimraf','./attachment.attributes','exports','define','Attachment','attachments','../../config/logger','moment'];(function(_0x4536a5,_0x4cbae1){var _0x4ed53a=function(_0x194805){while(--_0x194805){_0x4536a5['push'](_0x4536a5['shift']());}};_0x4ed53a(++_0x4cbae1);}(_0x1806,0x9e));var _0x6180=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1806[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6180('0x0'))('api');var moment=require(_0x6180('0x1'));var BPromise=require(_0x6180('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6180('0x3'));var rimraf=require(_0x6180('0x4'));var config=require('../../config/environment');var attributes=require(_0x6180('0x5'));module[_0x6180('0x6')]=function(_0x2d63f4,_0x4eb429){return _0x2d63f4[_0x6180('0x7')](_0x6180('0x8'),attributes,{'tableName':_0x6180('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 3e35751..516f4ad 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 _0xae79=['options','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','create','body'];(function(_0x2ab2cc,_0xe88512){var _0x4f89f6=function(_0x3f6e6c){while(--_0x3f6e6c){_0x2ab2cc['push'](_0x2ab2cc['shift']());}};_0x4f89f6(++_0xe88512);}(_0xae79,0x1d3));var _0x9ae7=function(_0x58d4ff,_0x20a955){_0x58d4ff=_0x58d4ff-0x0;var _0x227eea=_0xae79[_0x58d4ff];return _0x227eea;};'use strict';var _=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var moment=require(_0x9ae7('0x2'));var BPromise=require(_0x9ae7('0x3'));var rs=require(_0x9ae7('0x4'));var fs=require('fs');var Redis=require(_0x9ae7('0x5'));var db=require(_0x9ae7('0x6'))['db'];var utils=require(_0x9ae7('0x7'));var logger=require(_0x9ae7('0x8'))(_0x9ae7('0x9'));var config=require(_0x9ae7('0xa'));var jayson=require(_0x9ae7('0xb'));var client=jayson[_0x9ae7('0xc')][_0x9ae7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x409d34,_0x57114d,_0x2761c2){return new BPromise(function(_0x47774e,_0x3c7738){return client[_0x9ae7('0xe')](_0x409d34,_0x2761c2)[_0x9ae7('0xf')](function(_0xc023d2){logger['info'](_0x9ae7('0x10'),_0x57114d,'request\x20sent');logger[_0x9ae7('0x11')](_0x9ae7('0x12'),_0x57114d,_0x9ae7('0x13'),JSON[_0x9ae7('0x14')](_0xc023d2));if(_0xc023d2[_0x9ae7('0x15')]){if(_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x16')]===0x1f4){logger['error'](_0x9ae7('0x10'),_0x57114d,_0xc023d2[_0x9ae7('0x15')]['message']);return _0x3c7738(_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x17')]);}logger[_0x9ae7('0x15')](_0x9ae7('0x10'),_0x57114d,_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x17')]);return _0x47774e(_0xc023d2[_0x9ae7('0x15')]['message']);}else{logger[_0x9ae7('0x18')](_0x9ae7('0x10'),_0x57114d,_0x9ae7('0x13'));_0x47774e(_0xc023d2[_0x9ae7('0x19')]['message']);}})[_0x9ae7('0x1a')](function(_0xe1a2d1){logger[_0x9ae7('0x15')]('Attachment,\x20%s,\x20%s',_0x57114d,_0xe1a2d1);_0x3c7738(_0xe1a2d1);});});}exports['CreateAttachment']=function(_0x2c7643){var _0x5e69c2=this;return new Promise(function(_0x5d6ad1,_0x5d0635){return db['Attachment'][_0x9ae7('0x1b')](_0x2c7643[_0x9ae7('0x1c')],{'raw':_0x2c7643[_0x9ae7('0x1d')]?_0x2c7643[_0x9ae7('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x9ae7('0xf')](function(_0x1d94fb){logger['info'](_0x9ae7('0x1e'),_0x2c7643);logger['debug'](_0x9ae7('0x1e'),_0x2c7643,JSON[_0x9ae7('0x14')](_0x1d94fb));_0x5d6ad1(_0x1d94fb);})['catch'](function(_0x356559){logger['error']('CreateAttachment',_0x356559[_0x9ae7('0x17')],_0x2c7643);_0x5d0635(_0x5e69c2[_0x9ae7('0x15')](0x1f4,_0x356559[_0x9ae7('0x17')]));});});}; \ No newline at end of file +var _0x9567=['../../config/utils','../../config/logger','../../config/environment','client','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateAttachment','create','options','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x4bbb84,_0x32d824){var _0x279ef5=function(_0x52f376){while(--_0x52f376){_0x4bbb84['push'](_0x4bbb84['shift']());}};_0x279ef5(++_0x32d824);}(_0x9567,0xdc));var _0x7956=function(_0x39cf69,_0x1ddc96){_0x39cf69=_0x39cf69-0x0;var _0x4c0fa6=_0x9567[_0x39cf69];return _0x4c0fa6;};'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')]('Attachment,\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);});});}exports[_0x7956('0x15')]=function(_0x5e6b90){var _0x5c3afb=this;return new Promise(function(_0x10b29c,_0x811122){return db['Attachment'][_0x7956('0x16')](_0x5e6b90['body'],{'raw':_0x5e6b90[_0x7956('0x17')]?_0x5e6b90[_0x7956('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7956('0xa')](function(_0x2e31cd){logger[_0x7956('0xb')]('CreateAttachment',_0x5e6b90);logger[_0x7956('0xd')]('CreateAttachment',_0x5e6b90,JSON[_0x7956('0x18')](_0x2e31cd));_0x10b29c(_0x2e31cd);})['catch'](function(_0x427500){logger[_0x7956('0x10')](_0x7956('0x15'),_0x427500[_0x7956('0x12')],_0x5e6b90);_0x811122(_0x5c3afb['error'](0x1f4,_0x427500[_0x7956('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 8122923..e172257 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x379b3d,_0xb565a7){var _0x5ae947=function(_0x31311b){while(--_0x31311b){_0x379b3d['push'](_0x379b3d['shift']());}};_0x5ae947(++_0xb565a7);}(_0x2032,0xd9));var _0x2203=function(_0x38bd5a,_0x526d00){_0x38bd5a=_0x38bd5a-0x0;var _0x3089a5=_0x2032[_0x38bd5a];return _0x3089a5;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _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(_0x3fe968,_0x4737f0){var _0x5241b5=function(_0x5b34c7){while(--_0x5b34c7){_0x3fe968['push'](_0x3fe968['shift']());}};_0x5241b5(++_0x4737f0);}(_0x2032,0xd9));var _0x2203=function(_0x5bcece,_0x3c0214){_0x5bcece=_0x5bcece-0x0;var _0x1092a2=_0x2032[_0x5bcece];return _0x1092a2;};'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 2964315..7758574 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 _0xca15=['password','salt','role','disabled','blocked','blockedAt','online','agent','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','undefined','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name'];(function(_0x1bd027,_0x565a42){var _0x193de7=function(_0x4af495){while(--_0x4af495){_0x1bd027['push'](_0x1bd027['shift']());}};_0x193de7(++_0x565a42);}(_0xca15,0x83));var _0x5ca1=function(_0x7f6bc8,_0x98c3bf){_0x7f6bc8=_0x7f6bc8-0x0;var _0xb899c7=_0xca15[_0x7f6bc8];return _0xb899c7;};'use strict';var passport=require(_0x5ca1('0x0'));var LocalStrategy=require(_0x5ca1('0x1'))['Strategy'];var moment=require(_0x5ca1('0x2'));var ActiveDirectory=require(_0x5ca1('0x3'));var BPromise=require(_0x5ca1('0x4'));var util=require(_0x5ca1('0x5'));var db=require(_0x5ca1('0x6'))['db'];var authService=require(_0x5ca1('0x7'));var utils=require(_0x5ca1('0x8'));var config=require(_0x5ca1('0x9'));var logger=require(_0x5ca1('0xa'))(_0x5ca1('0xb'));function isActiveDirectoryConfigured(_0x265bc4){var _0x34d3d3=![];if(typeof _0x265bc4['activedirectory']!==_0x5ca1('0xc')){_0x34d3d3=_0x265bc4[_0x5ca1('0xd')][_0x5ca1('0xe')]&&_0x265bc4['activedirectory'][_0x5ca1('0xf')]&&_0x265bc4[_0x5ca1('0xd')][_0x5ca1('0x10')];}return _0x34d3d3;}function adAuthenticate(_0x5a2b42,_0x430be1,_0x51dcd0){return new BPromise(function(_0x47692a,_0x5cdb1d){try{var _0x5d0bd2=new ActiveDirectory(_0x5a2b42);_0x5d0bd2[_0x5ca1('0x11')](_0x430be1,_0x51dcd0,function(_0x3ab58,_0x257315){if(_0x3ab58){logger[_0x5ca1('0x12')](_0x5ca1('0x13'),_0x430be1,util[_0x5ca1('0x14')](_0x3ab58,{'showHidden':![],'depth':null}));_0x5cdb1d(_0x5ca1('0x15'));}else if(!_0x257315){logger[_0x5ca1('0x12')](_0x5ca1('0x16'),_0x430be1);_0x5cdb1d('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x47692a(_0x257315);}});}catch(_0x41ad97){_0x5cdb1d(_0x41ad97);}});}function ActiveDirectoryAuthenticate(_0x4bb32d,_0x2bf279,_0x1cfb4e,_0x4c8944){var _0x281acd,_0x16019f;if(!isActiveDirectoryConfigured(config)){logger[_0x5ca1('0x12')](_0x5ca1('0x17'),_0x2bf279);return _0x4c8944(null,![],{'message':_0x5ca1('0x15')});}return db[_0x5ca1('0x18')][_0x5ca1('0x19')]({'where':{'id':0x1},'attributes':[_0x5ca1('0x1a'),_0x5ca1('0x1b')],'raw':!![]})[_0x5ca1('0x1c')](function(_0x19b69a){_0x281acd=_0x19b69a;if(!_0x281acd[_0x5ca1('0x1a')]){logger[_0x5ca1('0x12')](_0x5ca1('0x1d'),_0x2bf279);throw new Error(_0x5ca1('0x15'));}return _0x4bb32d['findOne']({'attributes':['id',_0x5ca1('0x1e'),_0x5ca1('0x1f'),_0x5ca1('0x20'),_0x5ca1('0x21'),_0x5ca1('0x22'),_0x5ca1('0x23'),_0x5ca1('0x24'),_0x5ca1('0x25')],'where':{'name':_0x2bf279,'role':{'$or':['admin','user',_0x5ca1('0x26')]},'adSsoEnabled':!![]}});})['then'](function(_0x266de9){if(!_0x266de9||_0x266de9&&_0x266de9['name']!==_0x2bf279){throw new Error(_0x5ca1('0x15'));}_0x16019f=_0x266de9;var _0x3ac510=_0x16019f[_0x5ca1('0x1e')]+'@'+config['activedirectory'][_0x5ca1('0x10')];return adAuthenticate(config[_0x5ca1('0xd')],_0x3ac510,_0x1cfb4e);})['then'](function(_0x59252f){if(_0x16019f[_0x5ca1('0x22')]){throw new Error(_0x5ca1('0x15'));}if(_0x281acd[_0x5ca1('0x1b')]>0x0){if(_0x16019f[_0x5ca1('0x23')]){if(moment(_0x16019f[_0x5ca1('0x24')])[_0x5ca1('0x27')](_0x281acd[_0x5ca1('0x1b')],_0x5ca1('0x28'))>moment()){throw new Error(_0x5ca1('0x15'));}return utils[_0x5ca1('0x29')](_0x16019f,0x0,![],null)[_0x5ca1('0x1c')](function(){return utils[_0x5ca1('0x2a')](_0x16019f);})[_0x5ca1('0x1c')](function(){return _0x4c8944(null,_0x16019f);});}else{return utils[_0x5ca1('0x2a')](_0x16019f)[_0x5ca1('0x1c')](function(){return _0x4c8944(null,_0x16019f);});}}else{return utils['getLicense'](_0x16019f)[_0x5ca1('0x1c')](function(){return _0x4c8944(null,_0x16019f);});}})[_0x5ca1('0x2b')](function(_0x456aa8){return _0x4c8944(null,![],_0x456aa8);});}function handleError(_0x39939d,_0x4c1926,_0x595527){return _0x39939d[_0x5ca1('0x2c')](_0x4c1926||0x1f4)[_0x5ca1('0x2d')]({'message':_0x595527?_0x595527[_0x5ca1('0x2e')]||_0x595527:''});}exports[_0x5ca1('0x2f')]=function(_0x465921,_0x7add6c,_0x3e82f3){passport[_0x5ca1('0x11')](_0x5ca1('0x30'),function(_0x12fb2d,_0x2c8c0c,_0x360f1d){var _0x51adf5=_0x12fb2d||_0x360f1d;if(_0x51adf5){return handleError(_0x7add6c,0x191,_0x51adf5);}if(!_0x2c8c0c){return handleError(_0x7add6c,0x194,{'message':_0x5ca1('0x31')});}else{var _0x212691={'payload':{'id':_0x2c8c0c['id'],'role':_0x2c8c0c[_0x5ca1('0x21')]},'options':{'expiresIn':0x15180}};return authService[_0x5ca1('0x32')](_0x212691)[_0x5ca1('0x1c')](function(_0x5837c6){_0x7add6c[_0x5ca1('0x33')]({'id':_0x2c8c0c['id'],'token':_0x5837c6,'statusCall':'','isAlreadyLogged':_0x2c8c0c['online']});});}})(_0x465921,_0x7add6c,_0x3e82f3);};passport[_0x5ca1('0x34')](_0x5ca1('0x30'),new LocalStrategy({'usernameField':_0x5ca1('0x1e'),'passwordField':_0x5ca1('0x1f')},function(_0x545705,_0x2b80ec,_0x1f6f15){return ActiveDirectoryAuthenticate(db[_0x5ca1('0x35')],_0x545705,_0x2b80ec,_0x1f6f15);})); \ No newline at end of file +var _0x8411=['blocked','blockedAt','online','user','agent','add','minutes','clearBlockUser','getLicense','catch','status','send','message','ad-login','json','User','Strategy','moment','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled'];(function(_0x126a75,_0x30d0fc){var _0x5b3ab9=function(_0x42382c){while(--_0x42382c){_0x126a75['push'](_0x126a75['shift']());}};_0x5b3ab9(++_0x30d0fc);}(_0x8411,0x118));var _0x1841=function(_0x4cba83,_0x81e88f){_0x4cba83=_0x4cba83-0x0;var _0x4375e0=_0x8411[_0x4cba83];return _0x4375e0;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')[_0x1841('0x0')];var moment=require(_0x1841('0x1'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0x1841('0x2'));var db=require(_0x1841('0x3'))['db'];var authService=require(_0x1841('0x4'));var utils=require(_0x1841('0x5'));var config=require(_0x1841('0x6'));var logger=require('../../config/logger')(_0x1841('0x7'));function isActiveDirectoryConfigured(_0x54a581){var _0x4224eb=![];if(typeof _0x54a581[_0x1841('0x8')]!==_0x1841('0x9')){_0x4224eb=_0x54a581[_0x1841('0x8')][_0x1841('0xa')]&&_0x54a581[_0x1841('0x8')][_0x1841('0xb')]&&_0x54a581[_0x1841('0x8')][_0x1841('0xc')];}return _0x4224eb;}function adAuthenticate(_0x4218ae,_0x108644,_0x1ae8b8){return new BPromise(function(_0x1a3293,_0x19422d){try{var _0x2d7810=new ActiveDirectory(_0x4218ae);_0x2d7810[_0x1841('0xd')](_0x108644,_0x1ae8b8,function(_0x16570d,_0x293ca7){if(_0x16570d){logger[_0x1841('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x108644,util[_0x1841('0xf')](_0x16570d,{'showHidden':![],'depth':null}));_0x19422d(_0x1841('0x10'));}else if(!_0x293ca7){logger[_0x1841('0xe')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x108644);_0x19422d('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1a3293(_0x293ca7);}});}catch(_0x415393){_0x19422d(_0x415393);}});}function ActiveDirectoryAuthenticate(_0x443172,_0x4c9df4,_0x101dfd,_0x9dc9c8){var _0x3e7e22,_0x287c5e;if(!isActiveDirectoryConfigured(config)){logger[_0x1841('0xe')](_0x1841('0x11'),_0x4c9df4);return _0x9dc9c8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x1841('0x12')][_0x1841('0x13')]({'where':{'id':0x1},'attributes':[_0x1841('0x14'),_0x1841('0x15')],'raw':!![]})[_0x1841('0x16')](function(_0x16917f){_0x3e7e22=_0x16917f;if(!_0x3e7e22[_0x1841('0x14')]){logger[_0x1841('0xe')](_0x1841('0x17'),_0x4c9df4);throw new Error(_0x1841('0x10'));}return _0x443172[_0x1841('0x13')]({'attributes':['id',_0x1841('0x18'),_0x1841('0x19'),_0x1841('0x1a'),'role',_0x1841('0x1b'),_0x1841('0x1c'),_0x1841('0x1d'),_0x1841('0x1e')],'where':{'name':_0x4c9df4,'role':{'$or':['admin',_0x1841('0x1f'),_0x1841('0x20')]},'adSsoEnabled':!![]}});})[_0x1841('0x16')](function(_0x1ed975){if(!_0x1ed975||_0x1ed975&&_0x1ed975[_0x1841('0x18')]!==_0x4c9df4){throw new Error(_0x1841('0x10'));}_0x287c5e=_0x1ed975;var _0x28a0d2=_0x287c5e[_0x1841('0x18')]+'@'+config[_0x1841('0x8')][_0x1841('0xc')];return adAuthenticate(config[_0x1841('0x8')],_0x28a0d2,_0x101dfd);})[_0x1841('0x16')](function(_0x60ab64){if(_0x287c5e['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x3e7e22[_0x1841('0x15')]>0x0){if(_0x287c5e['blocked']){if(moment(_0x287c5e[_0x1841('0x1d')])[_0x1841('0x21')](_0x3e7e22[_0x1841('0x15')],_0x1841('0x22'))>moment()){throw new Error(_0x1841('0x10'));}return utils[_0x1841('0x23')](_0x287c5e,0x0,![],null)[_0x1841('0x16')](function(){return utils[_0x1841('0x24')](_0x287c5e);})[_0x1841('0x16')](function(){return _0x9dc9c8(null,_0x287c5e);});}else{return utils[_0x1841('0x24')](_0x287c5e)['then'](function(){return _0x9dc9c8(null,_0x287c5e);});}}else{return utils['getLicense'](_0x287c5e)[_0x1841('0x16')](function(){return _0x9dc9c8(null,_0x287c5e);});}})[_0x1841('0x25')](function(_0x4eddde){return _0x9dc9c8(null,![],_0x4eddde);});}function handleError(_0x1f0985,_0x302824,_0x336e60){return _0x1f0985[_0x1841('0x26')](_0x302824||0x1f4)[_0x1841('0x27')]({'message':_0x336e60?_0x336e60[_0x1841('0x28')]||_0x336e60:''});}exports['login']=function(_0x2056cb,_0x3c952c,_0x34aaf2){passport[_0x1841('0xd')](_0x1841('0x29'),function(_0x10e12e,_0x5d3242,_0x371856){var _0x37cc52=_0x10e12e||_0x371856;if(_0x37cc52){return handleError(_0x3c952c,0x191,_0x37cc52);}if(!_0x5d3242){return handleError(_0x3c952c,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x296269={'payload':{'id':_0x5d3242['id'],'role':_0x5d3242['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x296269)[_0x1841('0x16')](function(_0x11d8ee){_0x3c952c[_0x1841('0x2a')]({'id':_0x5d3242['id'],'token':_0x11d8ee,'statusCall':'','isAlreadyLogged':_0x5d3242[_0x1841('0x1e')]});});}})(_0x2056cb,_0x3c952c,_0x34aaf2);};passport['use'](_0x1841('0x29'),new LocalStrategy({'usernameField':_0x1841('0x18'),'passwordField':_0x1841('0x19')},function(_0x59b4dd,_0x423a99,_0x1e3261){return ActiveDirectoryAuthenticate(db[_0x1841('0x2b')],_0x59b4dd,_0x423a99,_0x1e3261);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 268e594..42055ad 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 _0x41ef=['exports','express','./authActiveDirectory.controller','post','login'];(function(_0x3a852f,_0x28fa07){var _0x3f40a5=function(_0x57c7e8){while(--_0x57c7e8){_0x3a852f['push'](_0x3a852f['shift']());}};_0x3f40a5(++_0x28fa07);}(_0x41ef,0x1eb));var _0xf41e=function(_0x1e4598,_0x1ba223){_0x1e4598=_0x1e4598-0x0;var _0x53b3ee=_0x41ef[_0x1e4598];return _0x53b3ee;};'use strict';var express=require(_0xf41e('0x0'));var router=express['Router']();var controller=require(_0xf41e('0x1'));router[_0xf41e('0x2')]('/',controller[_0xf41e('0x3')]);module[_0xf41e('0x4')]=router; \ No newline at end of file +var _0xa08c=['login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x20f38a,_0x6dd961){var _0x2ccf9f=function(_0x586553){while(--_0x586553){_0x20f38a['push'](_0x20f38a['shift']());}};_0x2ccf9f(++_0x6dd961);}(_0xa08c,0x133));var _0xca08=function(_0x276c4f,_0x55eee3){_0x276c4f=_0x276c4f-0x0;var _0x551485=_0xa08c[_0x276c4f];return _0x551485;};'use strict';var express=require(_0xca08('0x0'));var router=express[_0xca08('0x1')]();var controller=require(_0xca08('0x2'));router['post']('/',controller[_0xca08('0x3')]);module[_0xca08('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 66eb18c..e41478d 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(_0x1089d4,_0x382a95){var _0xd170aa=function(_0x349cb3){while(--_0x349cb3){_0x1089d4['push'](_0x1089d4['shift']());}};_0xd170aa(++_0x382a95);}(_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 _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x7a54,0x106));var _0x47a5=function(_0x4a763a,_0x4350e2){_0x4a763a=_0x4a763a-0x0;var _0xaf1e01=_0x7a54[_0x4a763a];return _0xaf1e01;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 20595ee..0f09ae1 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 _0x7119=['login','callback','isMiddleware','setTokenCookie','exports','passport','./authGoogle.controller','../../components/auth/service','get'];(function(_0x579751,_0x4b96a2){var _0x1d00ba=function(_0x24cefc){while(--_0x24cefc){_0x579751['push'](_0x579751['shift']());}};_0x1d00ba(++_0x4b96a2);}(_0x7119,0x1c7));var _0x9711=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x7119[_0x57d13b];return _0x467696;};'use strict';var express=require('express');var passport=require(_0x9711('0x0'));var router=express['Router']();var controller=require(_0x9711('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x9711('0x2'));router[_0x9711('0x3')]('/',controller[_0x9711('0x4')]);router[_0x9711('0x3')]('/callback',controller[_0x9711('0x5')],authService[_0x9711('0x6')],userController[_0x9711('0x4')],authService[_0x9711('0x7')]);module[_0x9711('0x8')]=router; \ No newline at end of file +var _0x9f13=['../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','login','exports','express','passport','Router','./authGoogle.controller'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x9f13,0x1f4));var _0x39f1=function(_0x40fa64,_0xb797a4){_0x40fa64=_0x40fa64-0x0;var _0x272ab0=_0x9f13[_0x40fa64];return _0x272ab0;};'use strict';var express=require(_0x39f1('0x0'));var passport=require(_0x39f1('0x1'));var router=express[_0x39f1('0x2')]();var controller=require(_0x39f1('0x3'));var userController=require(_0x39f1('0x4'));var authService=require(_0x39f1('0x5'));router[_0x39f1('0x6')]('/',controller['login']);router[_0x39f1('0x6')](_0x39f1('0x7'),controller[_0x39f1('0x8')],authService[_0x39f1('0x9')],userController[_0x39f1('0xa')],authService['setTokenCookie']);module[_0x39f1('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index ad96a07..c0293dc 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 _0x75ad=['minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','previousPasswords','validatePasswordHistory','Password\x20reset!','use','User','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','blockDuration','name','password','salt','role','disabled','blocked','admin','user','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','allowedLoginAttempts','blockedAt'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x75ad,0xd7));var _0xd75a=function(_0x1fe8a9,_0x374e5e){_0x1fe8a9=_0x1fe8a9-0x0;var _0x507e1c=_0x75ad[_0x1fe8a9];return _0x507e1c;};'use strict';var util=require(_0xd75a('0x0'));var passport=require(_0xd75a('0x1'));var LocalStrategy=require(_0xd75a('0x2'))[_0xd75a('0x3')];var jayson=require(_0xd75a('0x4'));var _=require(_0xd75a('0x5'));var rs=require('randomstring');var moment=require(_0xd75a('0x6'));var db=require(_0xd75a('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xd75a('0x8'));var client=jayson[_0xd75a('0x9')][_0xd75a('0xa')]({'port':0x232b});function localAuthenticate(_0x2d2ff4,_0x5c8ef9,_0x40ee1f,_0x396cd1){var _0x4c7bbe,_0x12a0de;return db[_0xd75a('0xb')][_0xd75a('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xd75a('0xd')],'raw':!![]})['then'](function(_0x593d01){_0x4c7bbe=_0x593d01;return _0x2d2ff4[_0xd75a('0xc')]({'attributes':['id',_0xd75a('0xe'),_0xd75a('0xf'),_0xd75a('0x10'),_0xd75a('0x11'),_0xd75a('0x12'),_0xd75a('0x13'),'blockedAt','loginAttempts'],'where':{'name':_0x5c8ef9,'role':{'$or':[_0xd75a('0x14'),_0xd75a('0x15'),'agent']}}});})[_0xd75a('0x16')](function(_0x28346e){if(!_0x28346e||_0x28346e&&_0x28346e[_0xd75a('0xe')]!==_0x5c8ef9){throw new Error(_0xd75a('0x17'));}else{_0x12a0de=_0x28346e;return _0x12a0de;}})[_0xd75a('0x16')](function(){_0x12a0de[_0xd75a('0x18')](_0x40ee1f,function(_0x431be2,_0x3f7b43){var _0x3b26fc=_0x12a0de[_0xd75a('0x19')]+0x1;if(_0x431be2){return _0x396cd1(_0x431be2);}else if(!_0x3f7b43){if(_0x12a0de[_0xd75a('0x12')]){return _0x396cd1(null,![],{'message':_0xd75a('0x17')});}else if(_0x4c7bbe[_0xd75a('0x1a')]>0x0){if(_0x12a0de['blocked']){if(_0x4c7bbe[_0xd75a('0xd')]>0x0){if(moment(_0x12a0de[_0xd75a('0x1b')])['add'](_0x4c7bbe['blockDuration'],_0xd75a('0x1c'))>moment()){return _0x396cd1(null,![],{'message':_0xd75a('0x17')});}else{return utils[_0xd75a('0x1d')](_0x12a0de,_0x3b26fc,![],null)['then'](function(){return _0x396cd1(null,![],{'message':_0xd75a('0x17')});});}}else{return _0x396cd1(null,![],{'message':_0xd75a('0x17')});}}else{if(_0x3b26fc>=_0x4c7bbe[_0xd75a('0x1a')]){return utils['clearBlockUser'](_0x12a0de,0x0,!![],moment())[_0xd75a('0x16')](function(){return _0x396cd1(null,![],{'message':_0xd75a('0x17')});});}else{return utils[_0xd75a('0x1d')](_0x12a0de,_0x3b26fc,![],null)[_0xd75a('0x16')](function(){return _0x396cd1(null,![],{'message':_0xd75a('0x17')});});}}}else{return _0x396cd1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x12a0de[_0xd75a('0x12')]){return _0x396cd1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4c7bbe['allowedLoginAttempts']>0x0){if(_0x12a0de[_0xd75a('0x13')]){if(_0x4c7bbe[_0xd75a('0xd')]>0x0){if(moment(_0x12a0de[_0xd75a('0x1b')])['add'](_0x4c7bbe[_0xd75a('0xd')],'minutes')>moment()){return _0x396cd1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xd75a('0x1d')](_0x12a0de,0x0,![],null)['then'](function(){return utils[_0xd75a('0x1e')](_0x12a0de);})['then'](function(){return _0x396cd1(null,_0x12a0de);});}}else{return _0x396cd1(null,![],{'message':_0xd75a('0x17')});}}else{return utils[_0xd75a('0x1d')](_0x12a0de,0x0,![],null)['then'](function(){return utils[_0xd75a('0x1e')](_0x12a0de);})[_0xd75a('0x16')](function(){return _0x396cd1(null,_0x12a0de);})[_0xd75a('0x1f')](function(_0x2a21aa){return _0x396cd1(null,![],_0x2a21aa);});}}else{if(_0x12a0de[_0xd75a('0x13')]){return _0x396cd1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x12a0de)[_0xd75a('0x16')](function(){return _0x396cd1(null,_0x12a0de);});}}}});})[_0xd75a('0x1f')](function(_0x186a10){return _0x396cd1(null,![],_0x186a10);});}function sendServiceMail(_0x1de00b){return db[_0xd75a('0x20')][_0xd75a('0x21')]({'where':{'service':!![]},'attributes':['id',_0xd75a('0xe'),'email'],'include':[{'model':db[_0xd75a('0x22')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x4473e2){if(!_0x4473e2){throw new Error(_0xd75a('0x23'));}var _0x68ebe7=_0x4473e2[_0xd75a('0x24')]();var _0x39754e={'account':_0x68ebe7,'message':_['merge']({'from':util[_0xd75a('0x25')](_0xd75a('0x26'),_0x4473e2[_0xd75a('0xe')],_0x4473e2[_0xd75a('0x27')]||_0x4473e2['Smtp'][_0xd75a('0x15')])},_0x1de00b)};return client[_0xd75a('0x28')](_0xd75a('0x29'),_0x39754e);})[_0xd75a('0x16')](function(_0x110fa5){if(_0x110fa5[_0xd75a('0x2a')]){throw new Error(util[_0xd75a('0x25')](_0xd75a('0x2b'),_0x110fa5[_0xd75a('0x2a')][_0xd75a('0x2c')]||JSON[_0xd75a('0x2d')](_0x110fa5[_0xd75a('0x2a')])));}return!![];});}function handleError(_0x3517a1,_0xb031e9,_0x4b41fa){return _0x3517a1[_0xd75a('0x2e')](_0xb031e9||0x1f4)[_0xd75a('0x2f')]({'message':_0x4b41fa?_0x4b41fa['message']||_0x4b41fa:''});}exports['login']=function(_0x3c15f9,_0x141867,_0x194942){passport['authenticate'](_0xd75a('0x30'),function(_0x4590c4,_0x19f744,_0x2f1b98){var _0xa99280=_0x4590c4||_0x2f1b98;if(_0xa99280){return handleError(_0x141867,0x191,_0xa99280);}if(!_0x19f744){return handleError(_0x141867,0x194,{'message':_0xd75a('0x31')});}else{var _0x184f91={'payload':{'id':_0x19f744['id'],'role':_0x19f744[_0xd75a('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xd75a('0x32')](_0x184f91)[_0xd75a('0x16')](function(_0x35fdfd){_0x141867[_0xd75a('0x33')]({'id':_0x19f744['id'],'token':_0x35fdfd,'statusCall':'','isAlreadyLogged':_0x19f744[_0xd75a('0x34')]});});}})(_0x3c15f9,_0x141867,_0x194942);};exports[_0xd75a('0x35')]=function(_0x1b0703,_0x47d75e){if(!_0x1b0703[_0xd75a('0x36')][_0xd75a('0x27')]){return handleError(_0x47d75e,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x460377=rs[_0xd75a('0x37')]();_0x1b0703[_0xd75a('0x36')]['email']=_0x1b0703[_0xd75a('0x36')][_0xd75a('0x27')][_0xd75a('0x38')]()[_0xd75a('0x39')]();var _0x2f90a7;return db[_0xd75a('0xb')][_0xd75a('0xc')]({'where':{'id':0x1},'attributes':[_0xd75a('0x1a'),'blockDuration'],'raw':!![]})[_0xd75a('0x16')](function(_0x5f5c5d){_0x2f90a7=_0x5f5c5d;return db['User'][_0xd75a('0x21')]({'where':{'email':_0x1b0703[_0xd75a('0x36')][_0xd75a('0x27')]}});})[_0xd75a('0x16')](function(_0xbe68f5){if(!_0xbe68f5){throw new Error(_0xd75a('0x3a'));}if(_0xbe68f5[_0xd75a('0x12')]){throw new Error(_0xd75a('0x3b'));}if(_0xbe68f5[_0xd75a('0x13')]){if(moment(_0xbe68f5[_0xd75a('0x1b')])[_0xd75a('0x3c')](_0x2f90a7[_0xd75a('0xd')],_0xd75a('0x1c'))>moment()){throw new Error(_0xd75a('0x3d'));}else{_0xbe68f5['blocked']=![];_0xbe68f5[_0xd75a('0x1b')]=null;}}_0xbe68f5[_0xd75a('0x3e')]=_0x460377;_0xbe68f5[_0xd75a('0x3f')]=Date[_0xd75a('0x40')]()+0x36ee80;return _0xbe68f5[_0xd75a('0x41')]();})[_0xd75a('0x16')](function(){return sendServiceMail({'to':_0x1b0703[_0xd75a('0x36')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xd75a('0x42')+_0xd75a('0x43')+_0xd75a('0x44')+_0x1b0703[_0xd75a('0x45')]['host']+'/reset/'+_0x460377+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xd75a('0x16')](function(){_0x47d75e[_0xd75a('0x2e')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0xd75a('0x1f')](function(_0x44c4fb){return handleError(_0x47d75e,0x1f4,_0x44c4fb);});};exports[_0xd75a('0x46')]=function(_0x5307a5,_0x5d126e){return db['User'][_0xd75a('0x21')]({'where':{'resetPasswordToken':_0x5307a5[_0xd75a('0x47')][_0xd75a('0x48')],'resetPasswordExpires':{'$gt':Date[_0xd75a('0x40')]()}}})['then'](function(_0xf8be1a){if(!_0xf8be1a){throw new Error(_0xd75a('0x49'));}return db[_0xd75a('0xb')]['findOne']({'attributes':['id',_0xd75a('0x4a'),'enforcePasswordHistory',_0xd75a('0x4b')]})[_0xd75a('0x16')](function(_0xf97f3d){if(_0xf97f3d[_0xd75a('0x4a')])authService['validatePasswordPattern'](_0x5307a5[_0xd75a('0x36')][_0xd75a('0xf')]);if(!_0xf97f3d['enforcePasswordHistory']||!_0xf8be1a[_0xd75a('0x4c')])return _0xf8be1a;authService[_0xd75a('0x4d')](_0x5307a5['body'][_0xd75a('0xf')],_0xf8be1a[_0xd75a('0x4c')],_0xf97f3d[_0xd75a('0x4b')]);return _0xf8be1a;})[_0xd75a('0x16')](function(){_0xf8be1a[_0xd75a('0xf')]=_0x5307a5[_0xd75a('0x36')][_0xd75a('0xf')];_0xf8be1a[_0xd75a('0x3e')]=null;_0xf8be1a[_0xd75a('0x3f')]=null;return _0xf8be1a['save']();});})[_0xd75a('0x16')](function(){_0x5d126e[_0xd75a('0x2e')](0xc8)[_0xd75a('0x2f')]({'message':_0xd75a('0x4e')});})[_0xd75a('0x1f')](function(_0x3e9ea0){return handleError(_0x5d126e,0x1f4,_0x3e9ea0);});};passport[_0xd75a('0x4f')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0xd75a('0xf')},function(_0x4e9f22,_0x1797db,_0x3253f4){return localAuthenticate(db[_0xd75a('0x50')],_0x4e9f22,_0x1797db,_0x3253f4);})); \ No newline at end of file +var _0x915c=['Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','role','disabled','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','blockDuration','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','user','request','SendMail','error','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0x915c,0xb7));var _0xc915=function(_0x36b8f4,_0x15f119){_0x36b8f4=_0x36b8f4-0x0;var _0x287feb=_0x915c[_0x36b8f4];return _0x287feb;};'use strict';var util=require(_0xc915('0x0'));var passport=require(_0xc915('0x1'));var LocalStrategy=require(_0xc915('0x2'))[_0xc915('0x3')];var jayson=require(_0xc915('0x4'));var _=require(_0xc915('0x5'));var rs=require(_0xc915('0x6'));var moment=require(_0xc915('0x7'));var db=require(_0xc915('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc915('0x9'));var client=jayson[_0xc915('0xa')][_0xc915('0xb')]({'port':0x232b});function localAuthenticate(_0x4510d3,_0x1da764,_0x74763d,_0x57c617){var _0x20a704,_0x58dafa;return db[_0xc915('0xc')][_0xc915('0xd')]({'where':{'id':0x1},'attributes':[_0xc915('0xe'),'blockDuration'],'raw':!![]})[_0xc915('0xf')](function(_0x315184){_0x20a704=_0x315184;return _0x4510d3['findOne']({'attributes':['id',_0xc915('0x10'),_0xc915('0x11'),'salt',_0xc915('0x12'),_0xc915('0x13'),'blocked',_0xc915('0x14'),_0xc915('0x15')],'where':{'name':_0x1da764,'role':{'$or':[_0xc915('0x16'),'user',_0xc915('0x17')]}}});})[_0xc915('0xf')](function(_0x47906f){if(!_0x47906f||_0x47906f&&_0x47906f[_0xc915('0x10')]!==_0x1da764){throw new Error(_0xc915('0x18'));}else{_0x58dafa=_0x47906f;return _0x58dafa;}})[_0xc915('0xf')](function(){_0x58dafa['authenticate'](_0x74763d,function(_0x90f29c,_0x20546d){var _0x15ddf3=_0x58dafa[_0xc915('0x15')]+0x1;if(_0x90f29c){return _0x57c617(_0x90f29c);}else if(!_0x20546d){if(_0x58dafa[_0xc915('0x13')]){return _0x57c617(null,![],{'message':_0xc915('0x18')});}else if(_0x20a704[_0xc915('0xe')]>0x0){if(_0x58dafa[_0xc915('0x19')]){if(_0x20a704['blockDuration']>0x0){if(moment(_0x58dafa['blockedAt'])[_0xc915('0x1a')](_0x20a704[_0xc915('0x1b')],'minutes')>moment()){return _0x57c617(null,![],{'message':_0xc915('0x18')});}else{return utils['clearBlockUser'](_0x58dafa,_0x15ddf3,![],null)[_0xc915('0xf')](function(){return _0x57c617(null,![],{'message':_0xc915('0x18')});});}}else{return _0x57c617(null,![],{'message':_0xc915('0x18')});}}else{if(_0x15ddf3>=_0x20a704[_0xc915('0xe')]){return utils[_0xc915('0x1c')](_0x58dafa,0x0,!![],moment())[_0xc915('0xf')](function(){return _0x57c617(null,![],{'message':_0xc915('0x18')});});}else{return utils['clearBlockUser'](_0x58dafa,_0x15ddf3,![],null)[_0xc915('0xf')](function(){return _0x57c617(null,![],{'message':_0xc915('0x18')});});}}}else{return _0x57c617(null,![],{'message':_0xc915('0x18')});}}else{if(_0x58dafa[_0xc915('0x13')]){return _0x57c617(null,![],{'message':_0xc915('0x18')});}else if(_0x20a704[_0xc915('0xe')]>0x0){if(_0x58dafa[_0xc915('0x19')]){if(_0x20a704[_0xc915('0x1b')]>0x0){if(moment(_0x58dafa[_0xc915('0x14')])[_0xc915('0x1a')](_0x20a704['blockDuration'],_0xc915('0x1d'))>moment()){return _0x57c617(null,![],{'message':_0xc915('0x18')});}else{return utils['clearBlockUser'](_0x58dafa,0x0,![],null)[_0xc915('0xf')](function(){return utils[_0xc915('0x1e')](_0x58dafa);})['then'](function(){return _0x57c617(null,_0x58dafa);});}}else{return _0x57c617(null,![],{'message':_0xc915('0x18')});}}else{return utils['clearBlockUser'](_0x58dafa,0x0,![],null)[_0xc915('0xf')](function(){return utils[_0xc915('0x1e')](_0x58dafa);})[_0xc915('0xf')](function(){return _0x57c617(null,_0x58dafa);})[_0xc915('0x1f')](function(_0x32fa29){return _0x57c617(null,![],_0x32fa29);});}}else{if(_0x58dafa['blocked']){return _0x57c617(null,![],{'message':_0xc915('0x18')});}else{return utils[_0xc915('0x1e')](_0x58dafa)[_0xc915('0xf')](function(){return _0x57c617(null,_0x58dafa);});}}}});})['catch'](function(_0xf26dcc){return _0x57c617(null,![],_0xf26dcc);});}function sendServiceMail(_0x1470f2){return db[_0xc915('0x20')][_0xc915('0x21')]({'where':{'service':!![]},'attributes':['id',_0xc915('0x10'),_0xc915('0x22')],'include':[{'model':db[_0xc915('0x23')],'as':_0xc915('0x24'),'include':[{'model':db[_0xc915('0x25')],'as':_0xc915('0x25')}]}]})['then'](function(_0x30eb4d){if(!_0x30eb4d){throw new Error(_0xc915('0x26'));}var _0x37fe04=_0x30eb4d[_0xc915('0x27')]();var _0x118511={'account':_0x37fe04,'message':_[_0xc915('0x28')]({'from':util[_0xc915('0x29')]('\x22%s\x22\x20<%s>',_0x30eb4d[_0xc915('0x10')],_0x30eb4d[_0xc915('0x22')]||_0x30eb4d[_0xc915('0x24')][_0xc915('0x2a')])},_0x1470f2)};return client[_0xc915('0x2b')](_0xc915('0x2c'),_0x118511);})[_0xc915('0xf')](function(_0x3d1008){if(_0x3d1008[_0xc915('0x2d')]){throw new Error(util[_0xc915('0x29')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x3d1008[_0xc915('0x2d')][_0xc915('0x2e')]||JSON[_0xc915('0x2f')](_0x3d1008['error'])));}return!![];});}function handleError(_0x20710a,_0x1ddd45,_0x5548ce){return _0x20710a[_0xc915('0x30')](_0x1ddd45||0x1f4)[_0xc915('0x31')]({'message':_0x5548ce?_0x5548ce['message']||_0x5548ce:''});}exports[_0xc915('0x32')]=function(_0x186cb8,_0xb4984a,_0x2b764b){passport[_0xc915('0x33')](_0xc915('0x34'),function(_0x82696c,_0x472a37,_0x5a82dc){var _0x53b8c9=_0x82696c||_0x5a82dc;if(_0x53b8c9){return handleError(_0xb4984a,0x191,_0x53b8c9);}if(!_0x472a37){return handleError(_0xb4984a,0x194,{'message':_0xc915('0x35')});}else{var _0x19f7df={'payload':{'id':_0x472a37['id'],'role':_0x472a37[_0xc915('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xc915('0x36')](_0x19f7df)['then'](function(_0x4f4f79){_0xb4984a['json']({'id':_0x472a37['id'],'token':_0x4f4f79,'statusCall':'','isAlreadyLogged':_0x472a37['online']});});}})(_0x186cb8,_0xb4984a,_0x2b764b);};exports[_0xc915('0x37')]=function(_0x37afb5,_0x2cbc44){if(!_0x37afb5[_0xc915('0x38')][_0xc915('0x22')]){return handleError(_0x2cbc44,0x1f4,{'message':_0xc915('0x39')});}var _0x2b376f=rs[_0xc915('0x3a')]();_0x37afb5['body'][_0xc915('0x22')]=_0x37afb5['body'][_0xc915('0x22')][_0xc915('0x3b')]()[_0xc915('0x3c')]();var _0x30a7bf;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xc915('0xe'),'blockDuration'],'raw':!![]})['then'](function(_0x2fc044){_0x30a7bf=_0x2fc044;return db[_0xc915('0x3d')][_0xc915('0x21')]({'where':{'email':_0x37afb5[_0xc915('0x38')][_0xc915('0x22')]}});})[_0xc915('0xf')](function(_0x39b027){if(!_0x39b027){throw new Error(_0xc915('0x3e'));}if(_0x39b027[_0xc915('0x13')]){throw new Error(_0xc915('0x3f'));}if(_0x39b027['blocked']){if(moment(_0x39b027['blockedAt'])[_0xc915('0x1a')](_0x30a7bf[_0xc915('0x1b')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x39b027[_0xc915('0x19')]=![];_0x39b027['blockedAt']=null;}}_0x39b027[_0xc915('0x40')]=_0x2b376f;_0x39b027[_0xc915('0x41')]=Date[_0xc915('0x42')]()+0x36ee80;return _0x39b027[_0xc915('0x43')]();})[_0xc915('0xf')](function(){return sendServiceMail({'to':_0x37afb5['body'][_0xc915('0x22')],'subject':_0xc915('0x44'),'text':_0xc915('0x45')+_0xc915('0x46')+_0xc915('0x47')+_0x37afb5['headers'][_0xc915('0x48')]+'/reset/'+_0x2b376f+'\x0a\x0a'+_0xc915('0x49')});})[_0xc915('0xf')](function(){_0x2cbc44[_0xc915('0x30')](0xc8)[_0xc915('0x31')]({'message':_0xc915('0x4a')});})['catch'](function(_0x2c882e){return handleError(_0x2cbc44,0x1f4,_0x2c882e);});};exports[_0xc915('0x4b')]=function(_0x40878e,_0x4e6a21){return db[_0xc915('0x3d')][_0xc915('0x21')]({'where':{'resetPasswordToken':_0x40878e[_0xc915('0x4c')][_0xc915('0x4d')],'resetPasswordExpires':{'$gt':Date[_0xc915('0x42')]()}}})['then'](function(_0x462a1b){if(!_0x462a1b){throw new Error(_0xc915('0x4e'));}return db['Setting'][_0xc915('0xd')]({'attributes':['id','securePassword',_0xc915('0x4f'),_0xc915('0x50')]})[_0xc915('0xf')](function(_0x441a57){if(_0x441a57[_0xc915('0x51')])authService[_0xc915('0x52')](_0x40878e['body'][_0xc915('0x11')]);if(!_0x441a57[_0xc915('0x4f')]||!_0x462a1b[_0xc915('0x53')])return _0x462a1b;authService[_0xc915('0x54')](_0x40878e['body'][_0xc915('0x11')],_0x462a1b[_0xc915('0x53')],_0x441a57[_0xc915('0x50')]);return _0x462a1b;})[_0xc915('0xf')](function(){_0x462a1b[_0xc915('0x11')]=_0x40878e[_0xc915('0x38')][_0xc915('0x11')];_0x462a1b['resetPasswordToken']=null;_0x462a1b['resetPasswordExpires']=null;return _0x462a1b[_0xc915('0x43')]();});})[_0xc915('0xf')](function(){_0x4e6a21[_0xc915('0x30')](0xc8)['send']({'message':_0xc915('0x55')});})[_0xc915('0x1f')](function(_0x107f39){return handleError(_0x4e6a21,0x1f4,_0x107f39);});};passport[_0xc915('0x56')](_0xc915('0x34'),new LocalStrategy({'usernameField':_0xc915('0x10'),'passwordField':'password'},function(_0x399b1c,_0xbed1c,_0x5ee970){return localAuthenticate(db[_0xc915('0x3d')],_0x399b1c,_0xbed1c,_0x5ee970);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 51c78e3..4707575 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 _0xc323=['exports','express','./authLocal.controller','post','login','/forgot','/reset/:token'];(function(_0x448c9a,_0x36ed05){var _0x185c40=function(_0x61fe86){while(--_0x61fe86){_0x448c9a['push'](_0x448c9a['shift']());}};_0x185c40(++_0x36ed05);}(_0xc323,0x1d6));var _0x3c32=function(_0x5d27a6,_0x5b3184){_0x5d27a6=_0x5d27a6-0x0;var _0x221530=_0xc323[_0x5d27a6];return _0x221530;};'use strict';var express=require(_0x3c32('0x0'));var router=express['Router']();var controller=require(_0x3c32('0x1'));router[_0x3c32('0x2')]('/',controller[_0x3c32('0x3')]);router['post'](_0x3c32('0x4'),controller['forgot']);router['post'](_0x3c32('0x5'),controller['reset']);module[_0x3c32('0x6')]=router; \ No newline at end of file +var _0x22d3=['reset','exports','Router','./authLocal.controller','post','/forgot','forgot','/reset/:token'];(function(_0x5c3e11,_0x4dd35b){var _0x4e9064=function(_0x5ae0cf){while(--_0x5ae0cf){_0x5c3e11['push'](_0x5c3e11['shift']());}};_0x4e9064(++_0x4dd35b);}(_0x22d3,0x11a));var _0x322d=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x22d3[_0x10004e];return _0x5af990;};'use strict';var express=require('express');var router=express[_0x322d('0x0')]();var controller=require(_0x322d('0x1'));router[_0x322d('0x2')]('/',controller['login']);router[_0x322d('0x2')](_0x322d('0x3'),controller[_0x322d('0x4')]);router[_0x322d('0x2')](_0x322d('0x5'),controller[_0x322d('0x6')]);module[_0x322d('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e66c3f6..e5fd2e0 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 _0xb222=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x22d53d,_0x339808){var _0x40dd91=function(_0x1ea0a6){while(--_0x1ea0a6){_0x22d53d['push'](_0x22d53d['shift']());}};_0x40dd91(++_0x339808);}(_0xb222,0xcd));var _0x2b22=function(_0x3260fa,_0x24dbb7){_0x3260fa=_0x3260fa-0x0;var _0x120340=_0xb222[_0x3260fa];return _0x120340;};'use strict';var Sequelize=require(_0x2b22('0x0'));module[_0x2b22('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x2b22('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x2b22('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2b22('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xd105=['exports','STRING','BOOLEAN'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xd105,0x144));var _0x5d10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd105[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x5d10('0x0')]={'name':{'type':Sequelize[_0x5d10('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x5d10('0x1')]},'description':{'type':Sequelize[_0x5d10('0x1')]},'status':{'type':Sequelize[_0x5d10('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index a48e3c0..329e48f 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 _0x6c61=['options','Automation','includeAll','include','findAll','catch','show','params','find','body','Condition','ids','getConditions','length','pick','nolimit','addActions','Action','omit','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL'];(function(_0x2e5fef,_0x252152){var _0xe38c0c=function(_0x1ded16){while(--_0x1ded16){_0x2e5fef['push'](_0x2e5fef['shift']());}};_0xe38c0c(++_0x252152);}(_0x6c61,0x169));var _0x16c6=function(_0x5646ff,_0x2dc956){_0x5646ff=_0x5646ff-0x0;var _0x2d9a0e=_0x6c61[_0x5646ff];return _0x2d9a0e;};'use strict';var emlformat=require(_0x16c6('0x0'));var rimraf=require(_0x16c6('0x1'));var zipdir=require(_0x16c6('0x2'));var jsonpatch=require(_0x16c6('0x3'));var rp=require(_0x16c6('0x4'));var moment=require('moment');var BPromise=require(_0x16c6('0x5'));var Mustache=require(_0x16c6('0x6'));var util=require('util');var path=require(_0x16c6('0x7'));var sox=require(_0x16c6('0x8'));var csv=require(_0x16c6('0x9'));var ejs=require(_0x16c6('0xa'));var fs=require('fs');var fs_extra=require(_0x16c6('0xb'));var _=require(_0x16c6('0xc'));var squel=require(_0x16c6('0xd'));var crypto=require('crypto');var jsforce=require(_0x16c6('0xe'));var deskjs=require(_0x16c6('0xf'));var toCsv=require(_0x16c6('0x9'));var querystring=require(_0x16c6('0x10'));var Papa=require(_0x16c6('0x11'));var Redis=require('ioredis');var authService=require(_0x16c6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x16c6('0x13'));var hardwareService=require(_0x16c6('0x14'));var logger=require(_0x16c6('0x15'))(_0x16c6('0x16'));var utils=require(_0x16c6('0x17'));var config=require(_0x16c6('0x18'));var licenseUtil=require(_0x16c6('0x19'));var db=require(_0x16c6('0x1a'))['db'];function respondWithStatusCode(_0x5e3677,_0x2ab493){_0x2ab493=_0x2ab493||0xcc;return function(_0x4cee50){if(_0x4cee50){return _0x5e3677['sendStatus'](_0x2ab493);}return _0x5e3677[_0x16c6('0x1b')](_0x2ab493)[_0x16c6('0x1c')]();};}function respondWithResult(_0x9c697,_0x3d2766){_0x3d2766=_0x3d2766||0xc8;return function(_0x1aeb94){if(_0x1aeb94){return _0x9c697[_0x16c6('0x1b')](_0x3d2766)[_0x16c6('0x1d')](_0x1aeb94);}};}function respondWithFilteredResult(_0x2b4e6f,_0x2a110e){return function(_0x5e7d24){if(_0x5e7d24){var _0x2227af=typeof _0x2a110e[_0x16c6('0x1e')]===_0x16c6('0x1f')&&typeof _0x2a110e[_0x16c6('0x20')]===_0x16c6('0x1f');var _0x5e4885=_0x5e7d24[_0x16c6('0x21')];var _0x597c47=_0x2227af?0x0:_0x2a110e[_0x16c6('0x1e')];var _0xcc8480=_0x2227af?_0x5e7d24[_0x16c6('0x21')]:_0x2a110e['offset']+_0x2a110e[_0x16c6('0x20')];var _0x3ddcbf;if(_0xcc8480>=_0x5e4885){_0xcc8480=_0x5e4885;_0x3ddcbf=0xc8;}else{_0x3ddcbf=0xce;}_0x2b4e6f[_0x16c6('0x1b')](_0x3ddcbf);return _0x2b4e6f[_0x16c6('0x22')](_0x16c6('0x23'),_0x597c47+'-'+_0xcc8480+'/'+_0x5e4885)[_0x16c6('0x1d')](_0x5e7d24);}return null;};}function patchUpdates(_0x55b975){return function(_0x16c5c0){try{jsonpatch[_0x16c6('0x24')](_0x16c5c0,_0x55b975,!![]);}catch(_0x3387c4){return BPromise[_0x16c6('0x25')](_0x3387c4);}return _0x16c5c0[_0x16c6('0x26')]();};}function saveUpdates(_0x28d634,_0x40f53a){return function(_0x4e1f93){if(_0x4e1f93){return _0x4e1f93[_0x16c6('0x27')](_0x28d634)[_0x16c6('0x28')](function(_0x4d92ee){return _0x4d92ee;});}return null;};}function removeEntity(_0x45620c,_0x39ebd8){return function(_0xe0927f){if(_0xe0927f){return _0xe0927f[_0x16c6('0x29')]()[_0x16c6('0x28')](function(){_0x45620c[_0x16c6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32b789,_0x3b25fe){return function(_0x3a3a33){if(!_0x3a3a33){_0x32b789[_0x16c6('0x2a')](0x194);}return _0x3a3a33;};}function handleError(_0x36c2cb,_0x449b1b){_0x449b1b=_0x449b1b||0x1f4;return function(_0x4f26e8){logger['error'](_0x4f26e8['stack']);if(_0x4f26e8['name']){delete _0x4f26e8['name'];}_0x36c2cb[_0x16c6('0x1b')](_0x449b1b)[_0x16c6('0x2b')](_0x4f26e8);};}exports[_0x16c6('0x2c')]=function(_0x5c12b3,_0x24c742){var _0x28ebfb={},_0x39cffc={},_0x2ef3f7={'count':0x0,'rows':[]};var _0x16c8b8=_[_0x16c6('0x2d')](db['Automation'][_0x16c6('0x2e')],function(_0x78dfde){return{'name':_0x78dfde[_0x16c6('0x2f')],'type':_0x78dfde[_0x16c6('0x30')]['key']};});_0x39cffc[_0x16c6('0x31')]=_[_0x16c6('0x2d')](_0x16c8b8,_0x16c6('0x32'));_0x39cffc[_0x16c6('0x33')]=_[_0x16c6('0x34')](_0x5c12b3[_0x16c6('0x33')]);_0x39cffc['filters']=_['intersection'](_0x39cffc[_0x16c6('0x31')],_0x39cffc['query']);_0x28ebfb[_0x16c6('0x35')]=_[_0x16c6('0x36')](_0x39cffc['model'],qs['fields'](_0x5c12b3[_0x16c6('0x33')][_0x16c6('0x37')]));_0x28ebfb[_0x16c6('0x35')]=_0x28ebfb[_0x16c6('0x35')]['length']?_0x28ebfb[_0x16c6('0x35')]:_0x39cffc[_0x16c6('0x31')];if(!_0x5c12b3[_0x16c6('0x33')][_0x16c6('0x38')]('nolimit')){_0x28ebfb['limit']=qs['limit'](_0x5c12b3[_0x16c6('0x33')]['limit']);_0x28ebfb[_0x16c6('0x1e')]=qs[_0x16c6('0x1e')](_0x5c12b3['query'][_0x16c6('0x1e')]);}_0x28ebfb[_0x16c6('0x39')]=qs[_0x16c6('0x3a')](_0x5c12b3['query'][_0x16c6('0x3a')]);_0x28ebfb[_0x16c6('0x3b')]=qs['filters'](_['pick'](_0x5c12b3[_0x16c6('0x33')],_0x39cffc[_0x16c6('0x3c')]),_0x16c8b8);if(_0x5c12b3[_0x16c6('0x33')][_0x16c6('0x3d')]){_0x28ebfb[_0x16c6('0x3b')]=_[_0x16c6('0x3e')](_0x28ebfb[_0x16c6('0x3b')],{'$or':_[_0x16c6('0x2d')](_0x16c8b8,function(_0x46b09f){if(_0x46b09f[_0x16c6('0x30')]!==_0x16c6('0x3f')){var _0x15d9a4={};_0x15d9a4[_0x46b09f[_0x16c6('0x32')]]={'$like':'%'+_0x5c12b3['query'][_0x16c6('0x3d')]+'%'};return _0x15d9a4;}})});}_0x28ebfb=_[_0x16c6('0x3e')]({},_0x28ebfb,_0x5c12b3[_0x16c6('0x40')]);var _0x5299f4={'where':_0x28ebfb[_0x16c6('0x3b')]};return db[_0x16c6('0x41')][_0x16c6('0x21')](_0x5299f4)[_0x16c6('0x28')](function(_0x97db5d){_0x2ef3f7[_0x16c6('0x21')]=_0x97db5d;if(_0x5c12b3[_0x16c6('0x33')][_0x16c6('0x42')]){_0x28ebfb[_0x16c6('0x43')]=[{'all':!![]}];}return db[_0x16c6('0x41')][_0x16c6('0x44')](_0x28ebfb);})[_0x16c6('0x28')](function(_0x2e21cd){_0x2ef3f7['rows']=_0x2e21cd;return _0x2ef3f7;})['then'](respondWithFilteredResult(_0x24c742,_0x28ebfb))[_0x16c6('0x45')](handleError(_0x24c742,null));};exports[_0x16c6('0x46')]=function(_0x2b4e4f,_0x4a1af1){var _0x495128={'raw':![],'where':{'id':_0x2b4e4f[_0x16c6('0x47')]['id']}},_0x550b99={};_0x550b99[_0x16c6('0x31')]=_[_0x16c6('0x34')](db[_0x16c6('0x41')][_0x16c6('0x2e')]);_0x550b99['query']=_[_0x16c6('0x34')](_0x2b4e4f[_0x16c6('0x33')]);_0x550b99[_0x16c6('0x3c')]=_[_0x16c6('0x36')](_0x550b99[_0x16c6('0x31')],_0x550b99[_0x16c6('0x33')]);_0x495128['attributes']=_[_0x16c6('0x36')](_0x550b99[_0x16c6('0x31')],qs[_0x16c6('0x37')](_0x2b4e4f[_0x16c6('0x33')][_0x16c6('0x37')]));_0x495128[_0x16c6('0x35')]=_0x495128[_0x16c6('0x35')]['length']?_0x495128[_0x16c6('0x35')]:_0x550b99[_0x16c6('0x31')];if(_0x2b4e4f[_0x16c6('0x33')][_0x16c6('0x42')]){_0x495128['include']=[{'all':!![]}];}_0x495128=_[_0x16c6('0x3e')]({},_0x495128,_0x2b4e4f['options']);return db['Automation'][_0x16c6('0x48')](_0x495128)[_0x16c6('0x28')](handleEntityNotFound(_0x4a1af1,null))[_0x16c6('0x28')](respondWithResult(_0x4a1af1,null))[_0x16c6('0x45')](handleError(_0x4a1af1,null));};exports['create']=function(_0x206257,_0x3c60db){return db[_0x16c6('0x41')]['create'](_0x206257['body'],{})['then'](respondWithResult(_0x3c60db,0xc9))[_0x16c6('0x45')](handleError(_0x3c60db,null));};exports[_0x16c6('0x27')]=function(_0x43d8ed,_0xff3277){if(_0x43d8ed[_0x16c6('0x49')]['id']){delete _0x43d8ed[_0x16c6('0x49')]['id'];}return db[_0x16c6('0x41')][_0x16c6('0x48')]({'where':{'id':_0x43d8ed[_0x16c6('0x47')]['id']}})[_0x16c6('0x28')](handleEntityNotFound(_0xff3277,null))[_0x16c6('0x28')](saveUpdates(_0x43d8ed[_0x16c6('0x49')],null))[_0x16c6('0x28')](respondWithResult(_0xff3277,null))[_0x16c6('0x45')](handleError(_0xff3277,null));};exports[_0x16c6('0x29')]=function(_0x280a2a,_0x4be668){return db[_0x16c6('0x41')][_0x16c6('0x48')]({'where':{'id':_0x280a2a[_0x16c6('0x47')]['id']}})['then'](handleEntityNotFound(_0x4be668,null))['then'](removeEntity(_0x4be668,null))[_0x16c6('0x45')](handleError(_0x4be668,null));};exports['addConditions']=function(_0x407d88,_0x1c1a49,_0x488b7c){return db[_0x16c6('0x4a')]['find']({'where':{'id':_0x407d88[_0x16c6('0x47')]['id']}})[_0x16c6('0x28')](handleEntityNotFound(_0x1c1a49,null))['then'](function(_0x46afbc){if(_0x46afbc){return _0x46afbc['addConditions'](_0x407d88[_0x16c6('0x49')][_0x16c6('0x4b')],_['omit'](_0x407d88[_0x16c6('0x49')],[_0x16c6('0x4b'),'id'])||{});}})[_0x16c6('0x28')](respondWithResult(_0x1c1a49,null))[_0x16c6('0x45')](handleError(_0x1c1a49,null));};exports[_0x16c6('0x4c')]=function(_0x40fd70,_0x139031,_0x49c600){var _0x4d9f68={};var _0x120dff={};var _0x8b88fa;var _0x374b65;return db[_0x16c6('0x41')]['findOne']({'where':{'id':_0x40fd70['params']['id']}})[_0x16c6('0x28')](handleEntityNotFound(_0x139031,null))[_0x16c6('0x28')](function(_0x55042a){if(_0x55042a){_0x8b88fa=_0x55042a;_0x120dff[_0x16c6('0x31')]=_[_0x16c6('0x34')](db[_0x16c6('0x4a')][_0x16c6('0x2e')]);_0x120dff['query']=_[_0x16c6('0x34')](_0x40fd70['query']);_0x120dff['filters']=_[_0x16c6('0x36')](_0x120dff[_0x16c6('0x31')],_0x120dff[_0x16c6('0x33')]);_0x4d9f68[_0x16c6('0x35')]=_[_0x16c6('0x36')](_0x120dff['model'],qs[_0x16c6('0x37')](_0x40fd70[_0x16c6('0x33')][_0x16c6('0x37')]));_0x4d9f68[_0x16c6('0x35')]=_0x4d9f68[_0x16c6('0x35')][_0x16c6('0x4d')]?_0x4d9f68[_0x16c6('0x35')]:_0x120dff[_0x16c6('0x31')];_0x4d9f68[_0x16c6('0x39')]=qs[_0x16c6('0x3a')](_0x40fd70['query'][_0x16c6('0x3a')]);_0x4d9f68[_0x16c6('0x3b')]=qs['filters'](_[_0x16c6('0x4e')](_0x40fd70[_0x16c6('0x33')],_0x120dff[_0x16c6('0x3c')]));if(_0x40fd70['query'][_0x16c6('0x3d')]){_0x4d9f68[_0x16c6('0x3b')]=_[_0x16c6('0x3e')](_0x4d9f68[_0x16c6('0x3b')],{'$or':_['map'](_0x4d9f68[_0x16c6('0x35')],function(_0x841309){var _0x3834d9={};_0x3834d9[_0x841309]={'$like':'%'+_0x40fd70[_0x16c6('0x33')][_0x16c6('0x3d')]+'%'};return _0x3834d9;})});}_0x4d9f68=_[_0x16c6('0x3e')]({},_0x4d9f68,_0x40fd70[_0x16c6('0x40')]);return _0x8b88fa[_0x16c6('0x4c')](_0x4d9f68);}})['then'](function(_0x421de9){if(_0x421de9){_0x374b65=_0x421de9['length'];if(!_0x40fd70['query'][_0x16c6('0x38')](_0x16c6('0x4f'))){_0x4d9f68[_0x16c6('0x20')]=qs['limit'](_0x40fd70[_0x16c6('0x33')][_0x16c6('0x20')]);_0x4d9f68[_0x16c6('0x1e')]=qs[_0x16c6('0x1e')](_0x40fd70[_0x16c6('0x33')]['offset']);}return _0x8b88fa[_0x16c6('0x4c')](_0x4d9f68);}})[_0x16c6('0x28')](function(_0x44aa96){if(_0x44aa96){return _0x44aa96?{'count':_0x374b65,'rows':_0x44aa96}:null;}})[_0x16c6('0x28')](respondWithResult(_0x139031,null))[_0x16c6('0x45')](handleError(_0x139031,null));};exports[_0x16c6('0x50')]=function(_0x1f37ec,_0xd2816b,_0x2ff565){return db[_0x16c6('0x51')][_0x16c6('0x48')]({'where':{'id':_0x1f37ec[_0x16c6('0x47')]['id']}})[_0x16c6('0x28')](handleEntityNotFound(_0xd2816b,null))[_0x16c6('0x28')](function(_0x26007e){if(_0x26007e){return _0x26007e['addActions'](_0x1f37ec[_0x16c6('0x49')][_0x16c6('0x4b')],_[_0x16c6('0x52')](_0x1f37ec[_0x16c6('0x49')],['ids','id'])||{});}})[_0x16c6('0x28')](respondWithResult(_0xd2816b,null))['catch'](handleError(_0xd2816b,null));};exports[_0x16c6('0x53')]=function(_0x3a9c66,_0x5a8ee6,_0xedb471){var _0xe0b0dd={};var _0x4d6352={};var _0x543352;var _0x281212;return db[_0x16c6('0x41')][_0x16c6('0x54')]({'where':{'id':_0x3a9c66['params']['id']}})[_0x16c6('0x28')](handleEntityNotFound(_0x5a8ee6,null))[_0x16c6('0x28')](function(_0xa279ab){if(_0xa279ab){_0x543352=_0xa279ab;_0x4d6352['model']=_[_0x16c6('0x34')](db[_0x16c6('0x51')][_0x16c6('0x2e')]);_0x4d6352['query']=_[_0x16c6('0x34')](_0x3a9c66[_0x16c6('0x33')]);_0x4d6352[_0x16c6('0x3c')]=_[_0x16c6('0x36')](_0x4d6352['model'],_0x4d6352[_0x16c6('0x33')]);_0xe0b0dd[_0x16c6('0x35')]=_[_0x16c6('0x36')](_0x4d6352[_0x16c6('0x31')],qs[_0x16c6('0x37')](_0x3a9c66[_0x16c6('0x33')]['fields']));_0xe0b0dd[_0x16c6('0x35')]=_0xe0b0dd[_0x16c6('0x35')][_0x16c6('0x4d')]?_0xe0b0dd['attributes']:_0x4d6352[_0x16c6('0x31')];_0xe0b0dd['order']=qs[_0x16c6('0x3a')](_0x3a9c66[_0x16c6('0x33')]['sort']);_0xe0b0dd[_0x16c6('0x3b')]=qs[_0x16c6('0x3c')](_['pick'](_0x3a9c66[_0x16c6('0x33')],_0x4d6352[_0x16c6('0x3c')]));if(_0x3a9c66[_0x16c6('0x33')][_0x16c6('0x3d')]){_0xe0b0dd[_0x16c6('0x3b')]=_[_0x16c6('0x3e')](_0xe0b0dd[_0x16c6('0x3b')],{'$or':_[_0x16c6('0x2d')](_0xe0b0dd[_0x16c6('0x35')],function(_0x558bd6){var _0x18ed07={};_0x18ed07[_0x558bd6]={'$like':'%'+_0x3a9c66['query'][_0x16c6('0x3d')]+'%'};return _0x18ed07;})});}_0xe0b0dd=_[_0x16c6('0x3e')]({},_0xe0b0dd,_0x3a9c66[_0x16c6('0x40')]);return _0x543352['getActions'](_0xe0b0dd);}})[_0x16c6('0x28')](function(_0x29c976){if(_0x29c976){_0x281212=_0x29c976['length'];if(!_0x3a9c66[_0x16c6('0x33')][_0x16c6('0x38')]('nolimit')){_0xe0b0dd[_0x16c6('0x20')]=qs[_0x16c6('0x20')](_0x3a9c66[_0x16c6('0x33')][_0x16c6('0x20')]);_0xe0b0dd[_0x16c6('0x1e')]=qs[_0x16c6('0x1e')](_0x3a9c66[_0x16c6('0x33')][_0x16c6('0x1e')]);}return _0x543352[_0x16c6('0x53')](_0xe0b0dd);}})[_0x16c6('0x28')](function(_0x34752e){if(_0x34752e){return _0x34752e?{'count':_0x281212,'rows':_0x34752e}:null;}})[_0x16c6('0x28')](respondWithResult(_0x5a8ee6,null))[_0x16c6('0x45')](handleError(_0x5a8ee6,null));}; \ No newline at end of file +var _0xd1f2=['merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','Automation','length','find','create','update','body','params','addConditions','Condition','ids','omit','findOne','getConditions','Action','getActions','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','reject','save','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x39bd4a,_0x4e23f1){var _0x2354af=function(_0x703508){while(--_0x703508){_0x39bd4a['push'](_0x39bd4a['shift']());}};_0x2354af(++_0x4e23f1);}(_0xd1f2,0x1b9));var _0x2d1f=function(_0x18c101,_0x32cb6d){_0x18c101=_0x18c101-0x0;var _0x7305b4=_0xd1f2[_0x18c101];return _0x7305b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d1f('0x0'));var zipdir=require(_0x2d1f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d1f('0x2'));var moment=require('moment');var BPromise=require(_0x2d1f('0x3'));var Mustache=require(_0x2d1f('0x4'));var util=require(_0x2d1f('0x5'));var path=require(_0x2d1f('0x6'));var sox=require(_0x2d1f('0x7'));var csv=require(_0x2d1f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2d1f('0x9'));var jsforce=require(_0x2d1f('0xa'));var deskjs=require(_0x2d1f('0xb'));var toCsv=require(_0x2d1f('0x8'));var querystring=require(_0x2d1f('0xc'));var Papa=require(_0x2d1f('0xd'));var Redis=require(_0x2d1f('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2d1f('0xf'));var hardwareService=require(_0x2d1f('0x10'));var logger=require(_0x2d1f('0x11'))(_0x2d1f('0x12'));var utils=require(_0x2d1f('0x13'));var config=require(_0x2d1f('0x14'));var licenseUtil=require(_0x2d1f('0x15'));var db=require(_0x2d1f('0x16'))['db'];function respondWithStatusCode(_0x153103,_0x2bfec1){_0x2bfec1=_0x2bfec1||0xcc;return function(_0x58940e){if(_0x58940e){return _0x153103[_0x2d1f('0x17')](_0x2bfec1);}return _0x153103[_0x2d1f('0x18')](_0x2bfec1)[_0x2d1f('0x19')]();};}function respondWithResult(_0x579306,_0x4b7df4){_0x4b7df4=_0x4b7df4||0xc8;return function(_0x33bf7a){if(_0x33bf7a){return _0x579306['status'](_0x4b7df4)[_0x2d1f('0x1a')](_0x33bf7a);}};}function respondWithFilteredResult(_0x2b2492,_0x127903){return function(_0x245b83){if(_0x245b83){var _0x181dcf=typeof _0x127903['offset']===_0x2d1f('0x1b')&&typeof _0x127903[_0x2d1f('0x1c')]===_0x2d1f('0x1b');var _0x2708f7=_0x245b83['count'];var _0x4f1f74=_0x181dcf?0x0:_0x127903[_0x2d1f('0x1d')];var _0x5972f1=_0x181dcf?_0x245b83[_0x2d1f('0x1e')]:_0x127903[_0x2d1f('0x1d')]+_0x127903[_0x2d1f('0x1c')];var _0x5c164b;if(_0x5972f1>=_0x2708f7){_0x5972f1=_0x2708f7;_0x5c164b=0xc8;}else{_0x5c164b=0xce;}_0x2b2492[_0x2d1f('0x18')](_0x5c164b);return _0x2b2492[_0x2d1f('0x1f')]('Content-Range',_0x4f1f74+'-'+_0x5972f1+'/'+_0x2708f7)[_0x2d1f('0x1a')](_0x245b83);}return null;};}function patchUpdates(_0x255781){return function(_0x347bcc){try{jsonpatch['apply'](_0x347bcc,_0x255781,!![]);}catch(_0x48fb01){return BPromise[_0x2d1f('0x20')](_0x48fb01);}return _0x347bcc[_0x2d1f('0x21')]();};}function saveUpdates(_0x4457c0,_0x2f3183){return function(_0x3d90ba){if(_0x3d90ba){return _0x3d90ba['update'](_0x4457c0)['then'](function(_0x25d132){return _0x25d132;});}return null;};}function removeEntity(_0x3e0be9,_0xbe00ae){return function(_0x489931){if(_0x489931){return _0x489931[_0x2d1f('0x22')]()['then'](function(){_0x3e0be9[_0x2d1f('0x18')](0xcc)[_0x2d1f('0x19')]();});}};}function handleEntityNotFound(_0x22bd8a,_0x158b84){return function(_0x425a7a){if(!_0x425a7a){_0x22bd8a['sendStatus'](0x194);}return _0x425a7a;};}function handleError(_0xc5f207,_0x56ab57){_0x56ab57=_0x56ab57||0x1f4;return function(_0x454768){logger[_0x2d1f('0x23')](_0x454768[_0x2d1f('0x24')]);if(_0x454768[_0x2d1f('0x25')]){delete _0x454768[_0x2d1f('0x25')];}_0xc5f207[_0x2d1f('0x18')](_0x56ab57)[_0x2d1f('0x26')](_0x454768);};}exports[_0x2d1f('0x27')]=function(_0x3b798b,_0x566ce1){var _0x1ee937={},_0x121f0e={},_0x10be9b={'count':0x0,'rows':[]};var _0x598d8a=_[_0x2d1f('0x28')](db['Automation'][_0x2d1f('0x29')],function(_0x485339){return{'name':_0x485339[_0x2d1f('0x2a')],'type':_0x485339['type']['key']};});_0x121f0e[_0x2d1f('0x2b')]=_[_0x2d1f('0x28')](_0x598d8a,'name');_0x121f0e[_0x2d1f('0x2c')]=_[_0x2d1f('0x2d')](_0x3b798b[_0x2d1f('0x2c')]);_0x121f0e[_0x2d1f('0x2e')]=_[_0x2d1f('0x2f')](_0x121f0e[_0x2d1f('0x2b')],_0x121f0e[_0x2d1f('0x2c')]);_0x1ee937['attributes']=_[_0x2d1f('0x2f')](_0x121f0e[_0x2d1f('0x2b')],qs[_0x2d1f('0x30')](_0x3b798b[_0x2d1f('0x2c')][_0x2d1f('0x30')]));_0x1ee937[_0x2d1f('0x31')]=_0x1ee937[_0x2d1f('0x31')]['length']?_0x1ee937['attributes']:_0x121f0e[_0x2d1f('0x2b')];if(!_0x3b798b['query'][_0x2d1f('0x32')](_0x2d1f('0x33'))){_0x1ee937['limit']=qs[_0x2d1f('0x1c')](_0x3b798b[_0x2d1f('0x2c')][_0x2d1f('0x1c')]);_0x1ee937[_0x2d1f('0x1d')]=qs[_0x2d1f('0x1d')](_0x3b798b['query'][_0x2d1f('0x1d')]);}_0x1ee937[_0x2d1f('0x34')]=qs[_0x2d1f('0x35')](_0x3b798b[_0x2d1f('0x2c')][_0x2d1f('0x35')]);_0x1ee937[_0x2d1f('0x36')]=qs['filters'](_[_0x2d1f('0x37')](_0x3b798b[_0x2d1f('0x2c')],_0x121f0e[_0x2d1f('0x2e')]),_0x598d8a);if(_0x3b798b['query'][_0x2d1f('0x38')]){_0x1ee937[_0x2d1f('0x36')]=_[_0x2d1f('0x39')](_0x1ee937['where'],{'$or':_['map'](_0x598d8a,function(_0x2aed86){if(_0x2aed86[_0x2d1f('0x3a')]!==_0x2d1f('0x3b')){var _0x232a9a={};_0x232a9a[_0x2aed86[_0x2d1f('0x25')]]={'$like':'%'+_0x3b798b[_0x2d1f('0x2c')]['filter']+'%'};return _0x232a9a;}})});}_0x1ee937=_[_0x2d1f('0x39')]({},_0x1ee937,_0x3b798b[_0x2d1f('0x3c')]);var _0x24ec2f={'where':_0x1ee937['where']};return db['Automation'][_0x2d1f('0x1e')](_0x24ec2f)[_0x2d1f('0x3d')](function(_0x31bfee){_0x10be9b[_0x2d1f('0x1e')]=_0x31bfee;if(_0x3b798b[_0x2d1f('0x2c')][_0x2d1f('0x3e')]){_0x1ee937[_0x2d1f('0x3f')]=[{'all':!![]}];}return db['Automation'][_0x2d1f('0x40')](_0x1ee937);})[_0x2d1f('0x3d')](function(_0x5853d6){_0x10be9b[_0x2d1f('0x41')]=_0x5853d6;return _0x10be9b;})[_0x2d1f('0x3d')](respondWithFilteredResult(_0x566ce1,_0x1ee937))[_0x2d1f('0x42')](handleError(_0x566ce1,null));};exports[_0x2d1f('0x43')]=function(_0x215d45,_0x44422a){var _0x3caad8={'raw':![],'where':{'id':_0x215d45['params']['id']}},_0x387075={};_0x387075[_0x2d1f('0x2b')]=_['keys'](db[_0x2d1f('0x44')][_0x2d1f('0x29')]);_0x387075[_0x2d1f('0x2c')]=_[_0x2d1f('0x2d')](_0x215d45[_0x2d1f('0x2c')]);_0x387075[_0x2d1f('0x2e')]=_['intersection'](_0x387075[_0x2d1f('0x2b')],_0x387075[_0x2d1f('0x2c')]);_0x3caad8[_0x2d1f('0x31')]=_[_0x2d1f('0x2f')](_0x387075[_0x2d1f('0x2b')],qs[_0x2d1f('0x30')](_0x215d45[_0x2d1f('0x2c')][_0x2d1f('0x30')]));_0x3caad8[_0x2d1f('0x31')]=_0x3caad8[_0x2d1f('0x31')][_0x2d1f('0x45')]?_0x3caad8[_0x2d1f('0x31')]:_0x387075[_0x2d1f('0x2b')];if(_0x215d45[_0x2d1f('0x2c')][_0x2d1f('0x3e')]){_0x3caad8[_0x2d1f('0x3f')]=[{'all':!![]}];}_0x3caad8=_[_0x2d1f('0x39')]({},_0x3caad8,_0x215d45[_0x2d1f('0x3c')]);return db[_0x2d1f('0x44')][_0x2d1f('0x46')](_0x3caad8)['then'](handleEntityNotFound(_0x44422a,null))[_0x2d1f('0x3d')](respondWithResult(_0x44422a,null))[_0x2d1f('0x42')](handleError(_0x44422a,null));};exports[_0x2d1f('0x47')]=function(_0x4d0536,_0x341d96){return db[_0x2d1f('0x44')][_0x2d1f('0x47')](_0x4d0536['body'],{})['then'](respondWithResult(_0x341d96,0xc9))[_0x2d1f('0x42')](handleError(_0x341d96,null));};exports[_0x2d1f('0x48')]=function(_0x535e98,_0x3fa093){if(_0x535e98[_0x2d1f('0x49')]['id']){delete _0x535e98['body']['id'];}return db[_0x2d1f('0x44')]['find']({'where':{'id':_0x535e98[_0x2d1f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3fa093,null))[_0x2d1f('0x3d')](saveUpdates(_0x535e98['body'],null))[_0x2d1f('0x3d')](respondWithResult(_0x3fa093,null))[_0x2d1f('0x42')](handleError(_0x3fa093,null));};exports['destroy']=function(_0x3165c4,_0x3194a2){return db[_0x2d1f('0x44')][_0x2d1f('0x46')]({'where':{'id':_0x3165c4[_0x2d1f('0x4a')]['id']}})[_0x2d1f('0x3d')](handleEntityNotFound(_0x3194a2,null))[_0x2d1f('0x3d')](removeEntity(_0x3194a2,null))[_0x2d1f('0x42')](handleError(_0x3194a2,null));};exports[_0x2d1f('0x4b')]=function(_0x406268,_0x2777f2,_0x299677){return db[_0x2d1f('0x4c')][_0x2d1f('0x46')]({'where':{'id':_0x406268[_0x2d1f('0x4a')]['id']}})[_0x2d1f('0x3d')](handleEntityNotFound(_0x2777f2,null))[_0x2d1f('0x3d')](function(_0x1878db){if(_0x1878db){return _0x1878db['addConditions'](_0x406268[_0x2d1f('0x49')][_0x2d1f('0x4d')],_[_0x2d1f('0x4e')](_0x406268[_0x2d1f('0x49')],[_0x2d1f('0x4d'),'id'])||{});}})[_0x2d1f('0x3d')](respondWithResult(_0x2777f2,null))[_0x2d1f('0x42')](handleError(_0x2777f2,null));};exports['getConditions']=function(_0x5ab22c,_0x5c27b7,_0x2f21a6){var _0x324c71={};var _0x5a2b96={};var _0x567396;var _0x235de5;return db[_0x2d1f('0x44')][_0x2d1f('0x4f')]({'where':{'id':_0x5ab22c['params']['id']}})['then'](handleEntityNotFound(_0x5c27b7,null))[_0x2d1f('0x3d')](function(_0x53ffbc){if(_0x53ffbc){_0x567396=_0x53ffbc;_0x5a2b96[_0x2d1f('0x2b')]=_[_0x2d1f('0x2d')](db[_0x2d1f('0x4c')][_0x2d1f('0x29')]);_0x5a2b96[_0x2d1f('0x2c')]=_[_0x2d1f('0x2d')](_0x5ab22c[_0x2d1f('0x2c')]);_0x5a2b96[_0x2d1f('0x2e')]=_['intersection'](_0x5a2b96['model'],_0x5a2b96['query']);_0x324c71[_0x2d1f('0x31')]=_['intersection'](_0x5a2b96[_0x2d1f('0x2b')],qs[_0x2d1f('0x30')](_0x5ab22c['query']['fields']));_0x324c71[_0x2d1f('0x31')]=_0x324c71['attributes'][_0x2d1f('0x45')]?_0x324c71[_0x2d1f('0x31')]:_0x5a2b96['model'];_0x324c71[_0x2d1f('0x34')]=qs[_0x2d1f('0x35')](_0x5ab22c[_0x2d1f('0x2c')][_0x2d1f('0x35')]);_0x324c71[_0x2d1f('0x36')]=qs['filters'](_[_0x2d1f('0x37')](_0x5ab22c[_0x2d1f('0x2c')],_0x5a2b96[_0x2d1f('0x2e')]));if(_0x5ab22c[_0x2d1f('0x2c')]['filter']){_0x324c71[_0x2d1f('0x36')]=_['merge'](_0x324c71[_0x2d1f('0x36')],{'$or':_['map'](_0x324c71[_0x2d1f('0x31')],function(_0x2a9f8d){var _0x355dbe={};_0x355dbe[_0x2a9f8d]={'$like':'%'+_0x5ab22c[_0x2d1f('0x2c')][_0x2d1f('0x38')]+'%'};return _0x355dbe;})});}_0x324c71=_['merge']({},_0x324c71,_0x5ab22c[_0x2d1f('0x3c')]);return _0x567396[_0x2d1f('0x50')](_0x324c71);}})['then'](function(_0x2cee56){if(_0x2cee56){_0x235de5=_0x2cee56[_0x2d1f('0x45')];if(!_0x5ab22c[_0x2d1f('0x2c')]['hasOwnProperty']('nolimit')){_0x324c71[_0x2d1f('0x1c')]=qs[_0x2d1f('0x1c')](_0x5ab22c['query'][_0x2d1f('0x1c')]);_0x324c71['offset']=qs['offset'](_0x5ab22c[_0x2d1f('0x2c')][_0x2d1f('0x1d')]);}return _0x567396[_0x2d1f('0x50')](_0x324c71);}})[_0x2d1f('0x3d')](function(_0x131a4c){if(_0x131a4c){return _0x131a4c?{'count':_0x235de5,'rows':_0x131a4c}:null;}})['then'](respondWithResult(_0x5c27b7,null))[_0x2d1f('0x42')](handleError(_0x5c27b7,null));};exports['addActions']=function(_0x2767ea,_0x2a6853,_0x247315){return db['Action'][_0x2d1f('0x46')]({'where':{'id':_0x2767ea['params']['id']}})['then'](handleEntityNotFound(_0x2a6853,null))['then'](function(_0x37b9bf){if(_0x37b9bf){return _0x37b9bf['addActions'](_0x2767ea['body'][_0x2d1f('0x4d')],_[_0x2d1f('0x4e')](_0x2767ea[_0x2d1f('0x49')],[_0x2d1f('0x4d'),'id'])||{});}})[_0x2d1f('0x3d')](respondWithResult(_0x2a6853,null))['catch'](handleError(_0x2a6853,null));};exports['getActions']=function(_0x1367a9,_0x27a508,_0x535950){var _0x48c5d9={};var _0x2323e6={};var _0x4a6966;var _0x28c242;return db['Automation']['findOne']({'where':{'id':_0x1367a9[_0x2d1f('0x4a')]['id']}})[_0x2d1f('0x3d')](handleEntityNotFound(_0x27a508,null))['then'](function(_0x3385f9){if(_0x3385f9){_0x4a6966=_0x3385f9;_0x2323e6[_0x2d1f('0x2b')]=_[_0x2d1f('0x2d')](db[_0x2d1f('0x51')]['rawAttributes']);_0x2323e6[_0x2d1f('0x2c')]=_[_0x2d1f('0x2d')](_0x1367a9[_0x2d1f('0x2c')]);_0x2323e6[_0x2d1f('0x2e')]=_['intersection'](_0x2323e6[_0x2d1f('0x2b')],_0x2323e6['query']);_0x48c5d9[_0x2d1f('0x31')]=_[_0x2d1f('0x2f')](_0x2323e6['model'],qs[_0x2d1f('0x30')](_0x1367a9[_0x2d1f('0x2c')][_0x2d1f('0x30')]));_0x48c5d9['attributes']=_0x48c5d9['attributes'][_0x2d1f('0x45')]?_0x48c5d9[_0x2d1f('0x31')]:_0x2323e6[_0x2d1f('0x2b')];_0x48c5d9['order']=qs[_0x2d1f('0x35')](_0x1367a9['query']['sort']);_0x48c5d9[_0x2d1f('0x36')]=qs[_0x2d1f('0x2e')](_[_0x2d1f('0x37')](_0x1367a9[_0x2d1f('0x2c')],_0x2323e6[_0x2d1f('0x2e')]));if(_0x1367a9['query'][_0x2d1f('0x38')]){_0x48c5d9[_0x2d1f('0x36')]=_[_0x2d1f('0x39')](_0x48c5d9[_0x2d1f('0x36')],{'$or':_[_0x2d1f('0x28')](_0x48c5d9['attributes'],function(_0x4ac1ee){var _0x82270c={};_0x82270c[_0x4ac1ee]={'$like':'%'+_0x1367a9[_0x2d1f('0x2c')][_0x2d1f('0x38')]+'%'};return _0x82270c;})});}_0x48c5d9=_[_0x2d1f('0x39')]({},_0x48c5d9,_0x1367a9['options']);return _0x4a6966[_0x2d1f('0x52')](_0x48c5d9);}})[_0x2d1f('0x3d')](function(_0x5d51ed){if(_0x5d51ed){_0x28c242=_0x5d51ed[_0x2d1f('0x45')];if(!_0x1367a9[_0x2d1f('0x2c')][_0x2d1f('0x32')](_0x2d1f('0x33'))){_0x48c5d9[_0x2d1f('0x1c')]=qs[_0x2d1f('0x1c')](_0x1367a9['query'][_0x2d1f('0x1c')]);_0x48c5d9[_0x2d1f('0x1d')]=qs[_0x2d1f('0x1d')](_0x1367a9[_0x2d1f('0x2c')][_0x2d1f('0x1d')]);}return _0x4a6966['getActions'](_0x48c5d9);}})[_0x2d1f('0x3d')](function(_0x52d24f){if(_0x52d24f){return _0x52d24f?{'count':_0x28c242,'rows':_0x52d24f}:null;}})['then'](respondWithResult(_0x27a508,null))[_0x2d1f('0x42')](handleError(_0x27a508,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 06c632a..612e3a3 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 _0xeb3f=['../../config/logger','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeb3f,0x1f3));var _0xfeb3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xeb3f[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xfeb3('0x0'));var logger=require(_0xfeb3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfeb3('0x2'));var fs=require('fs');var path=require(_0xfeb3('0x3'));var rimraf=require(_0xfeb3('0x4'));var config=require(_0xfeb3('0x5'));var attributes=require(_0xfeb3('0x6'));module[_0xfeb3('0x7')]=function(_0x9ea1cb,_0x3b83da){return _0x9ea1cb['define'](_0xfeb3('0x8'),attributes,{'tableName':_0xfeb3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa45c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util','api'];(function(_0x32ae4e,_0x1dd4b0){var _0x1084a7=function(_0x50c403){while(--_0x50c403){_0x32ae4e['push'](_0x32ae4e['shift']());}};_0x1084a7(++_0x1dd4b0);}(_0xa45c,0xb4));var _0xca45=function(_0x580955,_0x1ad93f){_0x580955=_0x580955-0x0;var _0x1c727f=_0xa45c[_0x580955];return _0x1c727f;};'use strict';var _=require('lodash');var util=require(_0xca45('0x0'));var logger=require('../../config/logger')(_0xca45('0x1'));var moment=require(_0xca45('0x2'));var BPromise=require(_0xca45('0x3'));var rp=require(_0xca45('0x4'));var fs=require('fs');var path=require(_0xca45('0x5'));var rimraf=require(_0xca45('0x6'));var config=require(_0xca45('0x7'));var attributes=require(_0xca45('0x8'));module[_0xca45('0x9')]=function(_0x435859,_0x45ca44){return _0x435859[_0xca45('0xa')](_0xca45('0xb'),attributes,{'tableName':_0xca45('0xc'),'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 8dee1e5..2cac947 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 _0xdfb1=['../../config/logger','client','http','request','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xf8cca2,_0x12a2df){var _0x2ef044=function(_0x5e6c6b){while(--_0x5e6c6b){_0xf8cca2['push'](_0xf8cca2['shift']());}};_0x2ef044(++_0x12a2df);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x2d13a3,_0x480de5){_0x2d13a3=_0x2d13a3-0x0;var _0x5a993c=_0xdfb1[_0x2d13a3];return _0x5a993c;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var moment=require(_0x1dfb('0x2'));var BPromise=require(_0x1dfb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dfb('0x4'));var db=require(_0x1dfb('0x5'))['db'];var utils=require(_0x1dfb('0x6'));var logger=require(_0x1dfb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1dfb('0x8')][_0x1dfb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e10d9,_0x496be7,_0x42d45e){return new BPromise(function(_0x491406,_0x141081){return client[_0x1dfb('0xa')](_0x1e10d9,_0x42d45e)['then'](function(_0x24d8b9){logger[_0x1dfb('0xb')](_0x1dfb('0xc'),_0x496be7,'request\x20sent');logger[_0x1dfb('0xd')](_0x1dfb('0xe'),_0x496be7,_0x1dfb('0xf'),JSON[_0x1dfb('0x10')](_0x24d8b9));if(_0x24d8b9[_0x1dfb('0x11')]){if(_0x24d8b9[_0x1dfb('0x11')][_0x1dfb('0x12')]===0x1f4){logger[_0x1dfb('0x11')](_0x1dfb('0xc'),_0x496be7,_0x24d8b9['error'][_0x1dfb('0x13')]);return _0x141081(_0x24d8b9[_0x1dfb('0x11')]['message']);}logger[_0x1dfb('0x11')](_0x1dfb('0xc'),_0x496be7,_0x24d8b9[_0x1dfb('0x11')]['message']);return _0x491406(_0x24d8b9[_0x1dfb('0x11')][_0x1dfb('0x13')]);}else{logger[_0x1dfb('0xb')]('Automation,\x20%s,\x20%s',_0x496be7,_0x1dfb('0xf'));_0x491406(_0x24d8b9[_0x1dfb('0x14')][_0x1dfb('0x13')]);}})['catch'](function(_0x1186d1){logger[_0x1dfb('0x11')](_0x1dfb('0xc'),_0x496be7,_0x1186d1);_0x141081(_0x1186d1);});});} \ No newline at end of file +var _0xb6da=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xff3f4a,_0x50f3b4){var _0x13db8a=function(_0x41d3c6){while(--_0x41d3c6){_0xff3f4a['push'](_0xff3f4a['shift']());}};_0x13db8a(++_0x50f3b4);}(_0xb6da,0x8e));var _0xab6d=function(_0x58ddb5,_0x16e1f7){_0x58ddb5=_0x58ddb5-0x0;var _0xc2a5bf=_0xb6da[_0x58ddb5];return _0xc2a5bf;};'use strict';var _=require(_0xab6d('0x0'));var util=require('util');var moment=require(_0xab6d('0x1'));var BPromise=require(_0xab6d('0x2'));var rs=require(_0xab6d('0x3'));var fs=require('fs');var Redis=require(_0xab6d('0x4'));var db=require(_0xab6d('0x5'))['db'];var utils=require(_0xab6d('0x6'));var logger=require(_0xab6d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab6d('0x8'));var client=jayson[_0xab6d('0x9')][_0xab6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130285,_0x359bef,_0x44d5fa){return new BPromise(function(_0x4ba0f7,_0x2e30f1){return client['request'](_0x130285,_0x44d5fa)[_0xab6d('0xb')](function(_0x590cfa){logger['info'](_0xab6d('0xc'),_0x359bef,_0xab6d('0xd'));logger['debug'](_0xab6d('0xe'),_0x359bef,'request\x20sent',JSON['stringify'](_0x590cfa));if(_0x590cfa[_0xab6d('0xf')]){if(_0x590cfa[_0xab6d('0xf')][_0xab6d('0x10')]===0x1f4){logger[_0xab6d('0xf')](_0xab6d('0xc'),_0x359bef,_0x590cfa[_0xab6d('0xf')][_0xab6d('0x11')]);return _0x2e30f1(_0x590cfa[_0xab6d('0xf')]['message']);}logger[_0xab6d('0xf')](_0xab6d('0xc'),_0x359bef,_0x590cfa[_0xab6d('0xf')][_0xab6d('0x11')]);return _0x4ba0f7(_0x590cfa[_0xab6d('0xf')][_0xab6d('0x11')]);}else{logger['info'](_0xab6d('0xc'),_0x359bef,_0xab6d('0xd'));_0x4ba0f7(_0x590cfa[_0xab6d('0x12')]['message']);}})[_0xab6d('0x13')](function(_0x3bd40a){logger[_0xab6d('0xf')](_0xab6d('0xc'),_0x359bef,_0x3bd40a);_0x2e30f1(_0x3bd40a);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index af7f0d0..195ec19 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 _0xd8ee=['../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','/:id/conditions','getActions','create','post','addActions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x59014b,_0x294587){var _0x176fc9=function(_0x755cce){while(--_0x755cce){_0x59014b['push'](_0x59014b['shift']());}};_0x176fc9(++_0x294587);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x4e0f60,_0x426fe6){_0x4e0f60=_0x4e0f60-0x0;var _0x48e1ef=_0xd8ee[_0x4e0f60];return _0x48e1ef;};'use strict';var multer=require(_0xed8e('0x0'));var util=require('util');var path=require(_0xed8e('0x1'));var timeout=require(_0xed8e('0x2'));var express=require(_0xed8e('0x3'));var router=express['Router']();var fs_extra=require(_0xed8e('0x4'));var auth=require(_0xed8e('0x5'));var interaction=require(_0xed8e('0x6'));var config=require(_0xed8e('0x7'));var controller=require(_0xed8e('0x8'));router[_0xed8e('0x9')]('/',auth['isAuthenticated'](),controller[_0xed8e('0xa')]);router[_0xed8e('0x9')](_0xed8e('0xb'),auth[_0xed8e('0xc')](),controller[_0xed8e('0xd')]);router[_0xed8e('0x9')](_0xed8e('0xe'),auth['isAuthenticated'](),controller['getConditions']);router[_0xed8e('0x9')]('/:id/actions',auth['isAuthenticated'](),controller[_0xed8e('0xf')]);router['post']('/',auth[_0xed8e('0xc')](),controller[_0xed8e('0x10')]);router['post'](_0xed8e('0xe'),auth[_0xed8e('0xc')](),controller['addConditions']);router[_0xed8e('0x11')]('/:id/actions',auth[_0xed8e('0xc')](),controller[_0xed8e('0x12')]);router[_0xed8e('0x13')](_0xed8e('0xb'),auth[_0xed8e('0xc')](),controller[_0xed8e('0x14')]);router[_0xed8e('0x15')](_0xed8e('0xb'),auth[_0xed8e('0xc')](),controller[_0xed8e('0x16')]);module[_0xed8e('0x17')]=router; \ No newline at end of file +var _0xac5c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','getActions','post','create','addActions','put','destroy','exports','multer','util'];(function(_0x2b5ae7,_0x4cf577){var _0x43faff=function(_0x2c6eff){while(--_0x2c6eff){_0x2b5ae7['push'](_0x2b5ae7['shift']());}};_0x43faff(++_0x4cf577);}(_0xac5c,0x10f));var _0xcac5=function(_0x225ff0,_0x152ece){_0x225ff0=_0x225ff0-0x0;var _0x497f5d=_0xac5c[_0x225ff0];return _0x497f5d;};'use strict';var multer=require(_0xcac5('0x0'));var util=require(_0xcac5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcac5('0x2'));var router=express[_0xcac5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcac5('0x4'));var interaction=require(_0xcac5('0x5'));var config=require(_0xcac5('0x6'));var controller=require(_0xcac5('0x7'));router[_0xcac5('0x8')]('/',auth[_0xcac5('0x9')](),controller[_0xcac5('0xa')]);router['get'](_0xcac5('0xb'),auth[_0xcac5('0x9')](),controller['show']);router[_0xcac5('0x8')](_0xcac5('0xc'),auth[_0xcac5('0x9')](),controller[_0xcac5('0xd')]);router[_0xcac5('0x8')]('/:id/actions',auth[_0xcac5('0x9')](),controller[_0xcac5('0xe')]);router[_0xcac5('0xf')]('/',auth[_0xcac5('0x9')](),controller[_0xcac5('0x10')]);router['post'](_0xcac5('0xc'),auth[_0xcac5('0x9')](),controller['addConditions']);router[_0xcac5('0xf')]('/:id/actions',auth['isAuthenticated'](),controller[_0xcac5('0x11')]);router[_0xcac5('0x12')](_0xcac5('0xb'),auth[_0xcac5('0x9')](),controller['update']);router['delete'](_0xcac5('0xb'),auth['isAuthenticated'](),controller[_0xcac5('0x13')]);module[_0xcac5('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 3ef89a2..a6c4bac 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 _0x0e8c=['NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x329990,_0x3f6357){var _0x1092b6=function(_0x82b85){while(--_0x82b85){_0x329990['push'](_0x329990['shift']());}};_0x1092b6(++_0x3f6357);}(_0x0e8c,0x1e0));var _0xc0e8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0e8c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xc0e8('0x0')]={'name':{'type':Sequelize[_0xc0e8('0x1')],'unique':_0xc0e8('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc0e8('0x3')](_0xc0e8('0x4')),'allowNull':![],'defaultValue':_0xc0e8('0x4')},'description':{'type':Sequelize[_0xc0e8('0x1')]},'active':{'type':Sequelize[_0xc0e8('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc0e8('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc0e8('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc0e8('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xc0e8('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)[_0xc0e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc0e8('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc0e8('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)[_0xc0e8('0x9')],'defaultValue':0x3,'comment':_0xc0e8('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc0e8('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc0e8('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc0e8('0x1')],'defaultValue':_0xc0e8('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xc0e8('0x11'),'never',_0xc0e8('0x12')),'defaultValue':_0xc0e8('0x11')},'dialAMDActive':{'type':Sequelize[_0xc0e8('0x5')],'defaultValue':0x0,'comment':_0xc0e8('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xc0e8('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc0e8('0x7')](0x9)[_0xc0e8('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc0e8('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc0e8('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc0e8('0x7')](0x9)[_0xc0e8('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc0e8('0x7')](0x9)[_0xc0e8('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc0e8('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc0e8('0x7')](0x9)[_0xc0e8('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc0e8('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc0e8('0x7')](0x9)[_0xc0e8('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc0e8('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc0e8('0x3')]('DESC','ASC'),'defaultValue':_0xc0e8('0x19')},'dialPrefix':{'type':Sequelize[_0xc0e8('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc0e8('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc0e8('0x1a')},'dialCutDigit':{'type':Sequelize[_0xc0e8('0x7')](0x3)[_0xc0e8('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc0e8('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)[_0xc0e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc0e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)[_0xc0e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc0e8('0x20')}}; \ No newline at end of file +var _0xd75d=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#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','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x2a5dbd,_0x8f6f0d){var _0x167312=function(_0x2c5481){while(--_0x2c5481){_0x2a5dbd['push'](_0x2a5dbd['shift']());}};_0x167312(++_0x8f6f0d);}(_0xd75d,0x185));var _0xdd75=function(_0x18550b,_0x75f16a){_0x18550b=_0x18550b-0x0;var _0xa07369=_0xd75d[_0x18550b];return _0xa07369;};'use strict';var Sequelize=require(_0xdd75('0x0'));module[_0xdd75('0x1')]={'name':{'type':Sequelize[_0xdd75('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xdd75('0x3')](_0xdd75('0x4')),'allowNull':![],'defaultValue':_0xdd75('0x4')},'description':{'type':Sequelize[_0xdd75('0x2')]},'active':{'type':Sequelize[_0xdd75('0x5')],'defaultValue':0x0,'comment':_0xdd75('0x6')},'limitCalls':{'type':Sequelize[_0xdd75('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xdd75('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdd75('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdd75('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xdd75('0x7')](0x3)[_0xdd75('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd75('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdd75('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdd75('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdd75('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xdd75('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd75('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdd75('0x7')](0x3)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdd75('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xdd75('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xdd75('0x3')](_0xdd75('0xf'),'never','onlyIfOpen'),'defaultValue':_0xdd75('0xf')},'dialAMDActive':{'type':Sequelize[_0xdd75('0x5')],'defaultValue':0x0,'comment':_0xdd75('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0xdd75('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xdd75('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdd75('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdd75('0x7')](0x9)[_0xdd75('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdd75('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdd75('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdd75('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xdd75('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdd75('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdd75('0x7')](0x9)[_0xdd75('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdd75('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdd75('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdd75('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdd75('0x7')](0x9)[_0xdd75('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdd75('0x17')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xdd75('0x18')),'defaultValue':_0xdd75('0x19')},'dialPrefix':{'type':Sequelize[_0xdd75('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdd75('0x7')](0x3)[_0xdd75('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdd75('0x1a')},'dialCutDigit':{'type':Sequelize[_0xdd75('0x7')](0x3)[_0xdd75('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdd75('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdd75('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd75('0x1b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdd75('0x7')](0x3)[_0xdd75('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd75('0x1c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd75('0x1d')},'dialMachineMaxRetry':{'type':Sequelize[_0xdd75('0x7')](0x3)[_0xdd75('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd75('0x1e')},'dialMachineRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdd75('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd75('0x1f')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 5dd9cc0..38d869f 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 _0x301e=['error','name','index','map','Campaign','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','autoAssociation','getHoppers','CmHopper','CampaignId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','select','field','NOW()','ContactId','CmListId','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?','toString','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','IvrCampaigns','UserProfileResource'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x301e,0x6e));var _0xe301=function(_0x3c6df7,_0x538710){_0x3c6df7=_0x3c6df7-0x0;var _0x2d3584=_0x301e[_0x3c6df7];return _0x2d3584;};'use strict';var emlformat=require(_0xe301('0x0'));var rimraf=require(_0xe301('0x1'));var zipdir=require(_0xe301('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe301('0x3'));var moment=require(_0xe301('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe301('0x5'));var util=require(_0xe301('0x6'));var path=require(_0xe301('0x7'));var sox=require(_0xe301('0x8'));var csv=require(_0xe301('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe301('0xa'));var _=require(_0xe301('0xb'));var squel=require(_0xe301('0xc'));var crypto=require(_0xe301('0xd'));var jsforce=require(_0xe301('0xe'));var deskjs=require(_0xe301('0xf'));var toCsv=require(_0xe301('0x9'));var querystring=require(_0xe301('0x10'));var Papa=require(_0xe301('0x11'));var Redis=require(_0xe301('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe301('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe301('0x14'));var logger=require('../../config/logger')(_0xe301('0x15'));var utils=require(_0xe301('0x16'));var config=require(_0xe301('0x17'));var licenseUtil=require(_0xe301('0x18'));var db=require(_0xe301('0x19'))['db'];function respondWithStatusCode(_0x34c4c0,_0x9400ef){_0x9400ef=_0x9400ef||0xcc;return function(_0x5132d1){if(_0x5132d1){return _0x34c4c0[_0xe301('0x1a')](_0x9400ef);}return _0x34c4c0[_0xe301('0x1b')](_0x9400ef)[_0xe301('0x1c')]();};}function respondWithResult(_0xca2b87,_0x2aba8f){_0x2aba8f=_0x2aba8f||0xc8;return function(_0x17d7bf){if(_0x17d7bf){return _0xca2b87[_0xe301('0x1b')](_0x2aba8f)[_0xe301('0x1d')](_0x17d7bf);}};}function respondWithFilteredResult(_0x1f2017,_0x3a362a){return function(_0x4525c8){if(_0x4525c8){var _0x5e9a54=typeof _0x3a362a['offset']===_0xe301('0x1e')&&typeof _0x3a362a[_0xe301('0x1f')]==='undefined';var _0x4a65f3=_0x4525c8[_0xe301('0x20')];var _0x57b2cf=_0x5e9a54?0x0:_0x3a362a[_0xe301('0x21')];var _0x40673a=_0x5e9a54?_0x4525c8[_0xe301('0x20')]:_0x3a362a[_0xe301('0x21')]+_0x3a362a['limit'];var _0x38fbf8;if(_0x40673a>=_0x4a65f3){_0x40673a=_0x4a65f3;_0x38fbf8=0xc8;}else{_0x38fbf8=0xce;}_0x1f2017['status'](_0x38fbf8);return _0x1f2017[_0xe301('0x22')](_0xe301('0x23'),_0x57b2cf+'-'+_0x40673a+'/'+_0x4a65f3)[_0xe301('0x1d')](_0x4525c8);}return null;};}function patchUpdates(_0x549a71){return function(_0x576ebb){try{jsonpatch['apply'](_0x576ebb,_0x549a71,!![]);}catch(_0x1ed005){return BPromise['reject'](_0x1ed005);}return _0x576ebb[_0xe301('0x24')]();};}function saveUpdates(_0x3a97d2,_0x4a722a){return function(_0xd51582){if(_0xd51582){return _0xd51582[_0xe301('0x25')](_0x3a97d2)[_0xe301('0x26')](function(_0x70d8e){return _0x70d8e;});}return null;};}function removeEntity(_0x1f4957,_0xa8cf12){return function(_0x559fb0){if(_0x559fb0){return _0x559fb0[_0xe301('0x27')]()[_0xe301('0x26')](function(){var _0x215654=_0x559fb0['get']({'plain':!![]});var _0x195f1d=_0xe301('0x28');return db[_0xe301('0x29')][_0xe301('0x27')]({'where':{'type':_0x195f1d,'resourceId':_0x215654['id']}})[_0xe301('0x26')](function(){return _0x559fb0;});})[_0xe301('0x26')](function(){_0x1f4957['status'](0xcc)[_0xe301('0x1c')]();});}};}function handleEntityNotFound(_0x5a0625,_0x29a1a2){return function(_0x2214f8){if(!_0x2214f8){_0x5a0625[_0xe301('0x1a')](0x194);}return _0x2214f8;};}function handleError(_0xbcbd5,_0x31eec6){_0x31eec6=_0x31eec6||0x1f4;return function(_0x55dc45){logger[_0xe301('0x2a')](_0x55dc45['stack']);if(_0x55dc45[_0xe301('0x2b')]){delete _0x55dc45[_0xe301('0x2b')];}_0xbcbd5[_0xe301('0x1b')](_0x31eec6)['send'](_0x55dc45);};}exports[_0xe301('0x2c')]=function(_0x144548,_0x43ba1d){var _0x13fcd4={},_0x2ad878={},_0x380786={'count':0x0,'rows':[]};var _0x1b886d=_[_0xe301('0x2d')](db[_0xe301('0x2e')][_0xe301('0x2f')],function(_0x387378){return{'name':_0x387378['fieldName'],'type':_0x387378['type'][_0xe301('0x30')]};});_0x2ad878[_0xe301('0x31')]=_[_0xe301('0x2d')](_0x1b886d,_0xe301('0x2b'));_0x2ad878[_0xe301('0x32')]=_[_0xe301('0x33')](_0x144548['query']);_0x2ad878[_0xe301('0x34')]=_[_0xe301('0x35')](_0x2ad878[_0xe301('0x31')],_0x2ad878[_0xe301('0x32')]);_0x13fcd4[_0xe301('0x36')]=_['intersection'](_0x2ad878[_0xe301('0x31')],qs[_0xe301('0x37')](_0x144548['query'][_0xe301('0x37')]));_0x13fcd4[_0xe301('0x36')]=_0x13fcd4[_0xe301('0x36')][_0xe301('0x38')]?_0x13fcd4[_0xe301('0x36')]:_0x2ad878[_0xe301('0x31')];if(!_0x144548[_0xe301('0x32')][_0xe301('0x39')](_0xe301('0x3a'))){_0x13fcd4[_0xe301('0x1f')]=qs['limit'](_0x144548[_0xe301('0x32')][_0xe301('0x1f')]);_0x13fcd4[_0xe301('0x21')]=qs[_0xe301('0x21')](_0x144548['query'][_0xe301('0x21')]);}_0x13fcd4[_0xe301('0x3b')]=qs[_0xe301('0x3c')](_0x144548['query']['sort']);_0x13fcd4[_0xe301('0x3d')]=qs['filters'](_[_0xe301('0x3e')](_0x144548[_0xe301('0x32')],_0x2ad878[_0xe301('0x34')]),_0x1b886d);if(_0x144548[_0xe301('0x32')][_0xe301('0x3f')]){_0x13fcd4[_0xe301('0x3d')]=_[_0xe301('0x40')](_0x13fcd4['where'],{'$or':_[_0xe301('0x2d')](_0x1b886d,function(_0xb03a08){if(_0xb03a08[_0xe301('0x41')]!==_0xe301('0x42')){var _0x260f1b={};_0x260f1b[_0xb03a08[_0xe301('0x2b')]]={'$like':'%'+_0x144548['query'][_0xe301('0x3f')]+'%'};return _0x260f1b;}})});}_0x13fcd4=_[_0xe301('0x40')]({},_0x13fcd4,_0x144548[_0xe301('0x43')]);var _0x53eff2={'where':_0x13fcd4[_0xe301('0x3d')]};return db['Campaign'][_0xe301('0x20')](_0x53eff2)[_0xe301('0x26')](function(_0x458d81){_0x380786[_0xe301('0x20')]=_0x458d81;if(_0x144548[_0xe301('0x32')][_0xe301('0x44')]){_0x13fcd4[_0xe301('0x45')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x13fcd4);})[_0xe301('0x26')](function(_0x4bda55){_0x380786['rows']=_0x4bda55;return _0x380786;})['then'](respondWithFilteredResult(_0x43ba1d,_0x13fcd4))[_0xe301('0x46')](handleError(_0x43ba1d,null));};exports[_0xe301('0x47')]=function(_0x21a7b2,_0x43f570){var _0x1ea516={'raw':![],'where':{'id':_0x21a7b2[_0xe301('0x48')]['id']}},_0x311c4e={};_0x311c4e[_0xe301('0x31')]=_['keys'](db['Campaign'][_0xe301('0x2f')]);_0x311c4e[_0xe301('0x32')]=_[_0xe301('0x33')](_0x21a7b2['query']);_0x311c4e[_0xe301('0x34')]=_['intersection'](_0x311c4e['model'],_0x311c4e[_0xe301('0x32')]);_0x1ea516[_0xe301('0x36')]=_[_0xe301('0x35')](_0x311c4e[_0xe301('0x31')],qs[_0xe301('0x37')](_0x21a7b2['query'][_0xe301('0x37')]));_0x1ea516['attributes']=_0x1ea516[_0xe301('0x36')][_0xe301('0x38')]?_0x1ea516[_0xe301('0x36')]:_0x311c4e['model'];if(_0x21a7b2['query']['includeAll']){_0x1ea516[_0xe301('0x45')]=[{'all':!![]}];}_0x1ea516=_[_0xe301('0x40')]({},_0x1ea516,_0x21a7b2[_0xe301('0x43')]);return db['Campaign'][_0xe301('0x49')](_0x1ea516)[_0xe301('0x26')](handleEntityNotFound(_0x43f570,null))[_0xe301('0x26')](respondWithResult(_0x43f570,null))[_0xe301('0x46')](handleError(_0x43f570,null));};exports['create']=function(_0x5101a3,_0x3ae24c){return db['Campaign'][_0xe301('0x4a')](_0x5101a3[_0xe301('0x4b')],{})[_0xe301('0x26')](function(_0x6e46ba){var _0x525ebf=_0x5101a3[_0xe301('0x4c')][_0xe301('0x4d')]({'plain':!![]});if(!_0x525ebf)throw new Error(_0xe301('0x4e'));if(_0x525ebf[_0xe301('0x4f')]===_0xe301('0x4c')){var _0x4ec53a=_0x6e46ba[_0xe301('0x4d')]({'plain':!![]});var _0x14b006='IvrCampaigns';return db[_0xe301('0x50')][_0xe301('0x49')]({'where':{'name':_0x14b006,'userProfileId':_0x525ebf[_0xe301('0x51')]},'raw':!![]})[_0xe301('0x26')](function(_0x9a81c1){if(_0x9a81c1&&_0x9a81c1['autoAssociation']===0x0){return db[_0xe301('0x29')][_0xe301('0x4a')]({'name':_0x4ec53a[_0xe301('0x2b')],'resourceId':_0x4ec53a['id'],'type':_0x9a81c1[_0xe301('0x2b')],'sectionId':_0x9a81c1['id']},{})[_0xe301('0x26')](function(){return _0x6e46ba;});}else{return _0x6e46ba;}})[_0xe301('0x46')](function(_0x326eea){logger['error'](_0xe301('0x52'),_0x326eea);throw _0x326eea;});}return _0x6e46ba;})[_0xe301('0x26')](respondWithResult(_0x3ae24c,0xc9))[_0xe301('0x46')](handleError(_0x3ae24c,null));};exports[_0xe301('0x53')]=function(_0x485015,_0x375f34){var _0x5eabac={'where':{'id':_0x485015[_0xe301('0x48')]['id']}},_0x3ea172={};_0x3ea172[_0xe301('0x31')]=_[_0xe301('0x33')](db[_0xe301('0x2e')]['rawAttributes']);_0x5eabac[_0xe301('0x36')]=_[_0xe301('0x35')](_0x3ea172['model'],qs[_0xe301('0x37')](_0x485015['query']['fields']));_0x5eabac[_0xe301('0x36')]=_0x5eabac['attributes']['length']?_0x5eabac['attributes']:_0x3ea172['model'];if(_0x485015[_0xe301('0x32')][_0xe301('0x44')]){_0x5eabac[_0xe301('0x45')]=[{'all':!![]}];}_0x5eabac=_[_0xe301('0x40')]({},_0x5eabac,_0x485015['options']);return db['Campaign'][_0xe301('0x49')](_0x5eabac)[_0xe301('0x26')](handleEntityNotFound(_0x375f34,null))[_0xe301('0x26')](function(_0x5aa494){if(_0x5aa494){var _0x4dba2c=_0x5aa494[_0xe301('0x4d')]({'plain':!![]});_0x4dba2c=qs[_0xe301('0x54')](_0x4dba2c,['id','createdAt',_0xe301('0x55')]);_0x485015[_0xe301('0x4b')]=_['omit'](_0x485015['body'],['id',_0xe301('0x56'),_0xe301('0x55')]);return db['Campaign'][_0xe301('0x4a')](_[_0xe301('0x40')](_0x4dba2c,_0x485015[_0xe301('0x4b')]),{'include':_0x485015['query'][_0xe301('0x44')]?[{'all':!![]}]:undefined})[_0xe301('0x26')](function(_0x9a3600){var _0x3050d7=_0x485015[_0xe301('0x4c')][_0xe301('0x4d')]({'plain':!![]});if(!_0x3050d7)throw new Error(_0xe301('0x4e'));if(_0x3050d7[_0xe301('0x4f')]==='user'){var _0x5cdd9a=_0x9a3600[_0xe301('0x4d')]({'plain':!![]});var _0x4d365f=_0xe301('0x28');return db[_0xe301('0x50')][_0xe301('0x49')]({'where':{'name':_0x4d365f,'userProfileId':_0x3050d7[_0xe301('0x51')]},'raw':!![]})[_0xe301('0x26')](function(_0x45ff14){if(_0x45ff14&&_0x45ff14[_0xe301('0x57')]===0x0){return db[_0xe301('0x29')][_0xe301('0x4a')]({'name':_0x5cdd9a[_0xe301('0x2b')],'resourceId':_0x5cdd9a['id'],'type':_0x45ff14['name'],'sectionId':_0x45ff14['id']},{})[_0xe301('0x26')](function(){return _0x9a3600;});}else{return _0x9a3600;}})[_0xe301('0x46')](function(_0x536367){logger['error'](_0xe301('0x52'),_0x536367);throw _0x536367;});}return _0x9a3600;});}})['then'](respondWithResult(_0x375f34,0xc9))[_0xe301('0x46')](handleError(_0x375f34,null));};exports[_0xe301('0x25')]=function(_0xfa6a10,_0x471ae8){if(_0xfa6a10[_0xe301('0x4b')]['id']){delete _0xfa6a10[_0xe301('0x4b')]['id'];}return db[_0xe301('0x2e')]['find']({'where':{'id':_0xfa6a10[_0xe301('0x48')]['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x471ae8,null))['then'](saveUpdates(_0xfa6a10[_0xe301('0x4b')],null))[_0xe301('0x26')](respondWithResult(_0x471ae8,null))['catch'](handleError(_0x471ae8,null));};exports[_0xe301('0x27')]=function(_0x51fab4,_0x4a96cb){return db['Campaign'][_0xe301('0x49')]({'where':{'id':_0x51fab4[_0xe301('0x48')]['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x4a96cb,null))[_0xe301('0x26')](removeEntity(_0x4a96cb,null))[_0xe301('0x46')](handleError(_0x4a96cb,null));};exports[_0xe301('0x58')]=function(_0x74ea35,_0x1e1719,_0x3a5a1a){var _0x4cb2b5={'raw':!![],'where':{}};var _0x199a53={};var _0x3ab901={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x74ea35['params']['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x1e1719,null))[_0xe301('0x26')](function(_0x3b3fe8){if(_0x3b3fe8){_0x199a53[_0xe301('0x31')]=_[_0xe301('0x33')](db[_0xe301('0x59')][_0xe301('0x2f')]);_0x199a53[_0xe301('0x32')]=_[_0xe301('0x33')](_0x74ea35[_0xe301('0x32')]);_0x199a53[_0xe301('0x34')]=_[_0xe301('0x35')](_0x199a53[_0xe301('0x31')],_0x199a53[_0xe301('0x32')]);_0x4cb2b5['attributes']=_[_0xe301('0x35')](_0x199a53[_0xe301('0x31')],qs['fields'](_0x74ea35[_0xe301('0x32')]['fields']));_0x4cb2b5[_0xe301('0x36')]=_0x4cb2b5['attributes'][_0xe301('0x38')]?_0x4cb2b5[_0xe301('0x36')]:_0x199a53['model'];if(!_0x74ea35['query'][_0xe301('0x39')](_0xe301('0x3a'))){_0x4cb2b5[_0xe301('0x1f')]=qs[_0xe301('0x1f')](_0x74ea35[_0xe301('0x32')]['limit']);_0x4cb2b5['offset']=qs[_0xe301('0x21')](_0x74ea35[_0xe301('0x32')]['offset']);}_0x4cb2b5['order']=qs[_0xe301('0x3c')](_0x74ea35[_0xe301('0x32')][_0xe301('0x3c')]);_0x4cb2b5[_0xe301('0x3d')]=qs[_0xe301('0x34')](_[_0xe301('0x3e')](_0x74ea35[_0xe301('0x32')],_0x199a53[_0xe301('0x34')]));_0x4cb2b5['where'][_0xe301('0x5a')]=_0x3b3fe8['id'];if(_0x74ea35[_0xe301('0x32')][_0xe301('0x3f')]){_0x4cb2b5['where']=_[_0xe301('0x40')](_0x4cb2b5[_0xe301('0x3d')],{'$or':_[_0xe301('0x2d')](_0x4cb2b5[_0xe301('0x36')],function(_0x36b09b){var _0x1e663f={};_0x1e663f[_0x36b09b]={'$like':'%'+_0x74ea35[_0xe301('0x32')][_0xe301('0x3f')]+'%'};return _0x1e663f;})});}_0x4cb2b5=_['merge']({},_0x4cb2b5,_0x74ea35['options']);return db[_0xe301('0x59')][_0xe301('0x20')]({'where':_0x4cb2b5[_0xe301('0x3d')]})[_0xe301('0x26')](function(_0xb9f930){_0x3ab901[_0xe301('0x20')]=_0xb9f930;if(_0x74ea35[_0xe301('0x32')][_0xe301('0x44')]){_0x4cb2b5['include']=[{'all':!![]}];}return db[_0xe301('0x59')][_0xe301('0x5b')](_0x4cb2b5);})[_0xe301('0x26')](function(_0x278e2b){_0x3ab901[_0xe301('0x5c')]=_0x278e2b;return _0x3ab901;});}})[_0xe301('0x26')](respondWithFilteredResult(_0x1e1719,_0x4cb2b5))[_0xe301('0x46')](handleError(_0x1e1719,null));};exports[_0xe301('0x5d')]=function(_0x452a63,_0x2799e8,_0xe09cef){var _0x31a79d={'raw':!![],'where':{}};var _0x40777b={};var _0x4364fe={'count':0x0,'rows':[]};return db[_0xe301('0x2e')][_0xe301('0x5e')]({'where':{'id':_0x452a63['params']['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x2799e8,null))['then'](function(_0x29406d){if(_0x29406d){_0x40777b[_0xe301('0x31')]=_[_0xe301('0x33')](db[_0xe301('0x5f')]['rawAttributes']);_0x40777b[_0xe301('0x32')]=_['keys'](_0x452a63['query']);_0x40777b[_0xe301('0x34')]=_['intersection'](_0x40777b['model'],_0x40777b[_0xe301('0x32')]);_0x31a79d['attributes']=_[_0xe301('0x35')](_0x40777b[_0xe301('0x31')],qs[_0xe301('0x37')](_0x452a63[_0xe301('0x32')][_0xe301('0x37')]));_0x31a79d['attributes']=_0x31a79d['attributes'][_0xe301('0x38')]?_0x31a79d['attributes']:_0x40777b[_0xe301('0x31')];if(!_0x452a63['query'][_0xe301('0x39')]('nolimit')){_0x31a79d['limit']=qs[_0xe301('0x1f')](_0x452a63[_0xe301('0x32')]['limit']);_0x31a79d[_0xe301('0x21')]=qs[_0xe301('0x21')](_0x452a63['query'][_0xe301('0x21')]);}_0x31a79d[_0xe301('0x3b')]=qs[_0xe301('0x3c')](_0x452a63['query'][_0xe301('0x3c')]);_0x31a79d[_0xe301('0x3d')]=qs[_0xe301('0x34')](_['pick'](_0x452a63[_0xe301('0x32')],_0x40777b['filters']));_0x31a79d[_0xe301('0x3d')]['CampaignId']=_0x29406d['id'];if(_0x452a63[_0xe301('0x32')][_0xe301('0x3f')]){_0x31a79d['where']=_[_0xe301('0x40')](_0x31a79d[_0xe301('0x3d')],{'$or':_[_0xe301('0x2d')](_0x31a79d[_0xe301('0x36')],function(_0x2d8a5){var _0x5d1342={};_0x5d1342[_0x2d8a5]={'$like':'%'+_0x452a63[_0xe301('0x32')]['filter']+'%'};return _0x5d1342;})});}_0x31a79d=_[_0xe301('0x40')]({},_0x31a79d,_0x452a63[_0xe301('0x43')]);return db[_0xe301('0x5f')][_0xe301('0x20')]({'where':_0x31a79d['where']})[_0xe301('0x26')](function(_0x27bb65){_0x4364fe[_0xe301('0x20')]=_0x27bb65;if(_0x452a63[_0xe301('0x32')][_0xe301('0x44')]){_0x31a79d['include']=[{'all':!![]}];}return db[_0xe301('0x5f')][_0xe301('0x5b')](_0x31a79d);})[_0xe301('0x26')](function(_0x594422){_0x4364fe[_0xe301('0x5c')]=_0x594422;return _0x4364fe;});}})[_0xe301('0x26')](respondWithFilteredResult(_0x2799e8,_0x31a79d))[_0xe301('0x46')](handleError(_0x2799e8,null));};exports[_0xe301('0x60')]=function(_0x13d15c,_0x60c389,_0x2b22e8){var _0x25f2b4={'raw':!![],'where':{}};var _0x315b92={};var _0x413865={'count':0x0,'rows':[]};return db[_0xe301('0x2e')][_0xe301('0x5e')]({'where':{'id':_0x13d15c[_0xe301('0x48')]['id']}})['then'](handleEntityNotFound(_0x60c389,null))[_0xe301('0x26')](function(_0x43d7ae){if(_0x43d7ae){_0x315b92[_0xe301('0x31')]=_[_0xe301('0x33')](db[_0xe301('0x61')]['rawAttributes']);_0x315b92['query']=_[_0xe301('0x33')](_0x13d15c[_0xe301('0x32')]);_0x315b92[_0xe301('0x34')]=_[_0xe301('0x35')](_0x315b92[_0xe301('0x31')],_0x315b92[_0xe301('0x32')]);_0x25f2b4[_0xe301('0x36')]=_[_0xe301('0x35')](_0x315b92['model'],qs[_0xe301('0x37')](_0x13d15c[_0xe301('0x32')][_0xe301('0x37')]));_0x25f2b4['attributes']=_0x25f2b4['attributes'][_0xe301('0x38')]?_0x25f2b4[_0xe301('0x36')]:_0x315b92['model'];if(!_0x13d15c['query']['hasOwnProperty'](_0xe301('0x3a'))){_0x25f2b4[_0xe301('0x1f')]=qs[_0xe301('0x1f')](_0x13d15c[_0xe301('0x32')][_0xe301('0x1f')]);_0x25f2b4[_0xe301('0x21')]=qs[_0xe301('0x21')](_0x13d15c[_0xe301('0x32')][_0xe301('0x21')]);}_0x25f2b4[_0xe301('0x3b')]=qs[_0xe301('0x3c')](_0x13d15c[_0xe301('0x32')]['sort']);_0x25f2b4[_0xe301('0x3d')]=qs[_0xe301('0x34')](_[_0xe301('0x3e')](_0x13d15c[_0xe301('0x32')],_0x315b92[_0xe301('0x34')]));_0x25f2b4[_0xe301('0x3d')][_0xe301('0x5a')]=_0x43d7ae['id'];if(_0x13d15c['query']['filter']){_0x25f2b4[_0xe301('0x3d')]=_['merge'](_0x25f2b4[_0xe301('0x3d')],{'$or':_[_0xe301('0x2d')](_0x25f2b4[_0xe301('0x36')],function(_0x5fe076){var _0x11b481={};_0x11b481[_0x5fe076]={'$like':'%'+_0x13d15c[_0xe301('0x32')]['filter']+'%'};return _0x11b481;})});}_0x25f2b4=_['merge']({},_0x25f2b4,_0x13d15c[_0xe301('0x43')]);return db['CmHopperFinal'][_0xe301('0x20')]({'where':_0x25f2b4[_0xe301('0x3d')]})[_0xe301('0x26')](function(_0xd5d948){_0x413865[_0xe301('0x20')]=_0xd5d948;if(_0x13d15c[_0xe301('0x32')][_0xe301('0x44')]){_0x25f2b4[_0xe301('0x45')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x25f2b4);})[_0xe301('0x26')](function(_0x568008){_0x413865[_0xe301('0x5c')]=_0x568008;return _0x413865;});}})['then'](respondWithFilteredResult(_0x60c389,_0x25f2b4))[_0xe301('0x46')](handleError(_0x60c389,null));};exports[_0xe301('0x62')]=function(_0x24f75c,_0x1a0e4b,_0x21d73a){var _0x507460={'raw':!![],'where':{}};var _0x3a09b9={};var _0x5ccebc={'count':0x0,'rows':[]};return db[_0xe301('0x2e')][_0xe301('0x5e')]({'where':{'id':_0x24f75c[_0xe301('0x48')]['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x1a0e4b,null))[_0xe301('0x26')](function(_0x493795){if(_0x493795){_0x3a09b9[_0xe301('0x31')]=_['keys'](db[_0xe301('0x63')][_0xe301('0x2f')]);_0x3a09b9[_0xe301('0x32')]=_[_0xe301('0x33')](_0x24f75c['query']);_0x3a09b9['filters']=_['intersection'](_0x3a09b9[_0xe301('0x31')],_0x3a09b9[_0xe301('0x32')]);_0x507460[_0xe301('0x36')]=_['intersection'](_0x3a09b9[_0xe301('0x31')],qs[_0xe301('0x37')](_0x24f75c[_0xe301('0x32')]['fields']));_0x507460['attributes']=_0x507460[_0xe301('0x36')][_0xe301('0x38')]?_0x507460[_0xe301('0x36')]:_0x3a09b9['model'];if(!_0x24f75c[_0xe301('0x32')][_0xe301('0x39')](_0xe301('0x3a'))){_0x507460['limit']=qs[_0xe301('0x1f')](_0x24f75c[_0xe301('0x32')][_0xe301('0x1f')]);_0x507460[_0xe301('0x21')]=qs[_0xe301('0x21')](_0x24f75c[_0xe301('0x32')]['offset']);}_0x507460[_0xe301('0x3b')]=qs[_0xe301('0x3c')](_0x24f75c[_0xe301('0x32')][_0xe301('0x3c')]);_0x507460[_0xe301('0x3d')]=qs['filters'](_['pick'](_0x24f75c['query'],_0x3a09b9[_0xe301('0x34')]));_0x507460[_0xe301('0x3d')][_0xe301('0x5a')]=_0x493795['id'];if(_0x24f75c['query']['filter']){_0x507460[_0xe301('0x3d')]=_[_0xe301('0x40')](_0x507460[_0xe301('0x3d')],{'$or':_[_0xe301('0x2d')](_0x507460[_0xe301('0x36')],function(_0x1a163f){var _0x5219fd={};_0x5219fd[_0x1a163f]={'$like':'%'+_0x24f75c[_0xe301('0x32')][_0xe301('0x3f')]+'%'};return _0x5219fd;})});}_0x507460=_[_0xe301('0x40')]({},_0x507460,_0x24f75c[_0xe301('0x43')]);return db['CmHopperBlack']['count']({'where':_0x507460[_0xe301('0x3d')]})[_0xe301('0x26')](function(_0x5686d0){_0x5ccebc[_0xe301('0x20')]=_0x5686d0;if(_0x24f75c['query'][_0xe301('0x44')]){_0x507460[_0xe301('0x45')]=[{'all':!![]}];}return db[_0xe301('0x63')][_0xe301('0x5b')](_0x507460);})[_0xe301('0x26')](function(_0x10cae9){_0x5ccebc[_0xe301('0x5c')]=_0x10cae9;return _0x5ccebc;});}})['then'](respondWithFilteredResult(_0x1a0e4b,_0x507460))[_0xe301('0x46')](handleError(_0x1a0e4b,null));};exports[_0xe301('0x64')]=function(_0x8622ae,_0x405bcb,_0x5de860){var _0x16af45={};var _0x1872b2={};var _0xa45a35;var _0x56437c;return db[_0xe301('0x2e')]['findOne']({'where':{'id':_0x8622ae['params']['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x405bcb,null))[_0xe301('0x26')](function(_0x17b31d){if(_0x17b31d){_0xa45a35=_0x17b31d;_0x1872b2['model']=_[_0xe301('0x33')](db[_0xe301('0x65')][_0xe301('0x2f')]);_0x1872b2['query']=_[_0xe301('0x33')](_0x8622ae[_0xe301('0x32')]);_0x1872b2[_0xe301('0x34')]=_[_0xe301('0x35')](_0x1872b2[_0xe301('0x31')],_0x1872b2[_0xe301('0x32')]);_0x16af45['attributes']=_[_0xe301('0x35')](_0x1872b2['model'],qs[_0xe301('0x37')](_0x8622ae['query']['fields']));_0x16af45['attributes']=_0x16af45[_0xe301('0x36')]['length']?_0x16af45[_0xe301('0x36')]:_0x1872b2['model'];_0x16af45[_0xe301('0x3b')]=qs[_0xe301('0x3c')](_0x8622ae[_0xe301('0x32')][_0xe301('0x3c')]);_0x16af45[_0xe301('0x3d')]=qs[_0xe301('0x34')](_[_0xe301('0x3e')](_0x8622ae[_0xe301('0x32')],_0x1872b2['filters']));if(_0x8622ae[_0xe301('0x32')][_0xe301('0x3f')]){_0x16af45['where']=_['merge'](_0x16af45['where'],{'$or':_[_0xe301('0x2d')](_0x16af45[_0xe301('0x36')],function(_0x550445){var _0x4de898={};_0x4de898[_0x550445]={'$like':'%'+_0x8622ae['query'][_0xe301('0x3f')]+'%'};return _0x4de898;})});}_0x16af45=_[_0xe301('0x40')]({},_0x16af45,_0x8622ae[_0xe301('0x43')]);return _0xa45a35['getLists'](_0x16af45);}})[_0xe301('0x26')](function(_0x518cd4){if(_0x518cd4){_0x56437c=_0x518cd4[_0xe301('0x38')];if(!_0x8622ae[_0xe301('0x32')][_0xe301('0x39')](_0xe301('0x3a'))){_0x16af45[_0xe301('0x1f')]=qs['limit'](_0x8622ae[_0xe301('0x32')]['limit']);_0x16af45[_0xe301('0x21')]=qs[_0xe301('0x21')](_0x8622ae[_0xe301('0x32')][_0xe301('0x21')]);}return _0xa45a35[_0xe301('0x64')](_0x16af45);}})['then'](function(_0x331b39){if(_0x331b39){return _0x331b39?{'count':_0x56437c,'rows':_0x331b39}:null;}})['then'](respondWithResult(_0x405bcb,null))[_0xe301('0x46')](handleError(_0x405bcb,null));};exports[_0xe301('0x66')]=function(_0x1c35b6,_0x12f79b,_0x1316f0){var _0x2fcdd9,_0x3a7458;var _0x17f00e=[];var _0x1cfdfa=moment()['format'](_0xe301('0x67'));return db[_0xe301('0x2e')][_0xe301('0x49')]({'where':{'id':_0x1c35b6[_0xe301('0x48')]['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x12f79b,null))['then'](function(_0x18f135){if(_0x18f135){_0x3a7458=_0x18f135;return _0x18f135['addLists'](_0x1c35b6[_0xe301('0x4b')]['ids'],_[_0xe301('0x54')](_0x1c35b6[_0xe301('0x4b')],[_0xe301('0x68'),'id'])||{});}return null;})[_0xe301('0x69')](function(_0xd7a2f7){var _0x150ef2;var _0x36d52a;_0x2fcdd9=_0xd7a2f7||[];var _0xecc418=[];if(_0xd7a2f7){for(var _0x3ef2fb=0x0;_0x3ef2fb<_0xd7a2f7[_0xe301('0x38')];_0x3ef2fb+=0x1){var _0x41996c=_0xd7a2f7[_0x3ef2fb][_0xe301('0x4d')]({'plain':!![]});_0x3a7458['dialCheckDuplicateType']=_0x1c35b6[_0xe301('0x4b')][_0xe301('0x6a')]?_0x1c35b6['body'][_0xe301('0x6a')]:_0x3a7458[_0xe301('0x6a')];switch(_0x3a7458[_0xe301('0x6a')]){case _0xe301('0x6b'):_0x150ef2=squel[_0xe301('0x6c')]()[_0xe301('0x6d')](_0xe301('0x6e'))[_0xe301('0x6f')]([_0xe301('0x70'),_0xe301('0x71'),'ContactId','ListId',_0xe301('0x5a'),'createdAt',_0xe301('0x55')],squel[_0xe301('0x72')]()['field'](_0xe301('0x70'),_0xe301('0x70'))[_0xe301('0x73')](_0xe301('0x74'),'scheduledAt')[_0xe301('0x73')]('id',_0xe301('0x75'))[_0xe301('0x73')](_0x41996c[_0xe301('0x76')]['toString'](),_0xe301('0x77'))[_0xe301('0x73')](_0x1c35b6[_0xe301('0x48')]['id']['toString'](),_0xe301('0x5a'))[_0xe301('0x73')]('\x27'+_0x1cfdfa+'\x27',_0xe301('0x56'))['field']('\x27'+_0x1cfdfa+'\x27',_0xe301('0x55'))[_0xe301('0x78')](_0xe301('0x79'))[_0xe301('0x3d')](_0xe301('0x7a'))[_0xe301('0x3d')]('ListId\x20=\x20?',_0x41996c[_0xe301('0x76')]['toString']())[_0xe301('0x3d')](_0xe301('0x7b'))[_0xe301('0x3d')](_0xe301('0x7c'),squel['select']()[_0xe301('0x73')](_0xe301('0x7d'))[_0xe301('0x78')](_0xe301('0x7e'))[_0xe301('0x3d')](_0xe301('0x7f'),_0x1c35b6['params']['id'][_0xe301('0x80')]()))['where'](_0xe301('0x7c'),squel[_0xe301('0x72')]()[_0xe301('0x73')](_0xe301('0x81'))[_0xe301('0x78')](_0xe301('0x6e'))['where'](_0xe301('0x7f'),_0x1c35b6[_0xe301('0x48')]['id']['toString']())))[_0xe301('0x80')]();break;case'onlyIfOpen':_0x150ef2=squel[_0xe301('0x6c')]()['into'](_0xe301('0x6e'))[_0xe301('0x6f')](['phone',_0xe301('0x71'),_0xe301('0x75'),'ListId','CampaignId','createdAt',_0xe301('0x55')],squel['select']()[_0xe301('0x73')]('phone','phone')[_0xe301('0x73')]('NOW()',_0xe301('0x71'))[_0xe301('0x73')]('id',_0xe301('0x75'))['field'](_0x41996c[_0xe301('0x76')]['toString'](),_0xe301('0x77'))[_0xe301('0x73')](_0x1c35b6[_0xe301('0x48')]['id'][_0xe301('0x80')](),_0xe301('0x5a'))[_0xe301('0x73')]('\x27'+_0x1cfdfa+'\x27','createdAt')[_0xe301('0x73')]('\x27'+_0x1cfdfa+'\x27','updatedAt')['from'](_0xe301('0x79'))[_0xe301('0x3d')](_0xe301('0x7a'))['where'](_0xe301('0x82'),_0x41996c[_0xe301('0x76')]['toString']())[_0xe301('0x3d')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xe301('0x7c'),squel['select']()['field'](_0xe301('0x81'))[_0xe301('0x78')]('cm_hopper')[_0xe301('0x3d')](_0xe301('0x7f'),_0x1c35b6[_0xe301('0x48')]['id'][_0xe301('0x80')]())))[_0xe301('0x80')]();break;default:_0x150ef2=squel[_0xe301('0x6c')]()[_0xe301('0x6d')]('cm_hopper')['fromQuery'](['phone',_0xe301('0x71'),_0xe301('0x75'),_0xe301('0x77'),_0xe301('0x5a'),_0xe301('0x56'),_0xe301('0x55')],squel[_0xe301('0x72')]()[_0xe301('0x73')](_0xe301('0x70'),_0xe301('0x70'))[_0xe301('0x73')](_0xe301('0x74'),'scheduledAt')['field']('id','ContactId')[_0xe301('0x73')](_0x41996c[_0xe301('0x76')]['toString'](),_0xe301('0x77'))[_0xe301('0x73')](_0x1c35b6['params']['id'][_0xe301('0x80')](),_0xe301('0x5a'))['field']('\x27'+_0x1cfdfa+'\x27',_0xe301('0x56'))[_0xe301('0x73')]('\x27'+_0x1cfdfa+'\x27','updatedAt')[_0xe301('0x78')]('cm_contacts')[_0xe301('0x3d')](_0xe301('0x7a'))[_0xe301('0x3d')](_0xe301('0x82'),_0x41996c['CmListId'][_0xe301('0x80')]())['where'](_0xe301('0x7b')))['toString']();}_0x36d52a=squel[_0xe301('0x6c')]()[_0xe301('0x6d')](_0xe301('0x83'))['fromQuery']([_0xe301('0x84'),_0xe301('0x71'),_0xe301('0x70'),_0xe301('0x85'),_0xe301('0x56'),_0xe301('0x55')],squel[_0xe301('0x72')]()[_0xe301('0x73')](_0xe301('0x86'),'id')[_0xe301('0x73')](_0xe301('0x74'),'scheduledAt')['field'](_0xe301('0x87'),_0xe301('0x70'))['field'](_0xe301('0x88'),'OrderBy')[_0xe301('0x73')]('\x27'+_0x1cfdfa+'\x27',_0xe301('0x56'))['field']('\x27'+_0x1cfdfa+'\x27',_0xe301('0x55'))[_0xe301('0x78')](_0xe301('0x89'),'ci')[_0xe301('0x8a')](_0xe301('0x6e'),'h',_0xe301('0x8b'))[_0xe301('0x3d')](_0xe301('0x8c'),_0x41996c[_0xe301('0x76')][_0xe301('0x80')]())[_0xe301('0x3d')](_0xe301('0x8d'),_0x1c35b6[_0xe301('0x48')]['id'][_0xe301('0x80')]())[_0xe301('0x3d')](_0xe301('0x8e'),_0x1cfdfa))[_0xe301('0x80')]();_0xecc418[_0xe301('0x8f')](db[_0xe301('0x90')][_0xe301('0x32')](_0x150ef2));_0x17f00e[_0xe301('0x8f')](db[_0xe301('0x90')]['query'](_0x36d52a));}return BPromise['all'](_0xecc418);}})[_0xe301('0x26')](function(){return BPromise[_0xe301('0x91')](_0x17f00e);})['then'](function(){return _0x2fcdd9;})['then'](respondWithResult(_0x12f79b,null))[_0xe301('0x46')](handleError(_0x12f79b,null));};exports[_0xe301('0x92')]=function(_0x1d05af,_0x4a3de4,_0x584f0b){return db[_0xe301('0x2e')]['find']({'where':{'id':_0x1d05af['params']['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x4a3de4,null))[_0xe301('0x26')](function(_0x2f3e08){if(_0x2f3e08){return _0x2f3e08['removeLists'](_0x1d05af['query'][_0xe301('0x68')]);}})[_0xe301('0x26')](function(_0x27acc5){if(_0x27acc5){return db['CmHopper']['destroy']({'where':{'ListId':_0x1d05af[_0xe301('0x32')][_0xe301('0x68')],'CampaignId':_0x1d05af[_0xe301('0x48')]['id']}})[_0xe301('0x26')](function(){return _0x27acc5;});}})['then'](respondWithStatusCode(_0x4a3de4,null))[_0xe301('0x46')](handleError(_0x4a3de4,null));};exports[_0xe301('0x93')]=function(_0x56d660,_0x27e423,_0x504938){var _0x516914={};var _0xfa470a={};var _0xa1e70b;var _0x25816c;return db[_0xe301('0x2e')][_0xe301('0x5e')]({'where':{'id':_0x56d660['params']['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x27e423,null))['then'](function(_0xce54af){if(_0xce54af){_0xa1e70b=_0xce54af;_0xfa470a[_0xe301('0x31')]=_['keys'](db[_0xe301('0x65')][_0xe301('0x2f')]);_0xfa470a[_0xe301('0x32')]=_[_0xe301('0x33')](_0x56d660[_0xe301('0x32')]);_0xfa470a[_0xe301('0x34')]=_[_0xe301('0x35')](_0xfa470a[_0xe301('0x31')],_0xfa470a[_0xe301('0x32')]);_0x516914[_0xe301('0x36')]=_['intersection'](_0xfa470a[_0xe301('0x31')],qs[_0xe301('0x37')](_0x56d660[_0xe301('0x32')][_0xe301('0x37')]));_0x516914[_0xe301('0x36')]=_0x516914[_0xe301('0x36')]['length']?_0x516914[_0xe301('0x36')]:_0xfa470a[_0xe301('0x31')];_0x516914['order']=qs[_0xe301('0x3c')](_0x56d660[_0xe301('0x32')]['sort']);_0x516914['where']=qs[_0xe301('0x34')](_[_0xe301('0x3e')](_0x56d660[_0xe301('0x32')],_0xfa470a[_0xe301('0x34')]));if(_0x56d660[_0xe301('0x32')][_0xe301('0x3f')]){_0x516914[_0xe301('0x3d')]=_[_0xe301('0x40')](_0x516914[_0xe301('0x3d')],{'$or':_['map'](_0x516914[_0xe301('0x36')],function(_0x2f408c){var _0x288397={};_0x288397[_0x2f408c]={'$like':'%'+_0x56d660['query'][_0xe301('0x3f')]+'%'};return _0x288397;})});}_0x516914=_['merge']({},_0x516914,_0x56d660[_0xe301('0x43')]);return _0xa1e70b['getBlackLists'](_0x516914);}})[_0xe301('0x26')](function(_0x2b7bcb){if(_0x2b7bcb){_0x25816c=_0x2b7bcb[_0xe301('0x38')];if(!_0x56d660[_0xe301('0x32')][_0xe301('0x39')]('nolimit')){_0x516914[_0xe301('0x1f')]=qs[_0xe301('0x1f')](_0x56d660[_0xe301('0x32')]['limit']);_0x516914['offset']=qs['offset'](_0x56d660['query'][_0xe301('0x21')]);}return _0xa1e70b[_0xe301('0x93')](_0x516914);}})['then'](function(_0x1ec2ec){if(_0x1ec2ec){return _0x1ec2ec?{'count':_0x25816c,'rows':_0x1ec2ec}:null;}})[_0xe301('0x26')](respondWithResult(_0x27e423,null))[_0xe301('0x46')](handleError(_0x27e423,null));};exports[_0xe301('0x94')]=function(_0x5bfec2,_0x584168,_0x1adf05){var _0x5bc019,_0xbfe3bd;var _0x2e351c=[];var _0x11bfb6=moment()[_0xe301('0x95')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xe301('0x2e')]['find']({'where':{'id':_0x5bfec2[_0xe301('0x48')]['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x584168,null))[_0xe301('0x26')](function(_0x57748d){if(_0x57748d){_0xbfe3bd=_0x57748d;return _0x57748d[_0xe301('0x94')](_0x5bfec2['body'][_0xe301('0x68')],_[_0xe301('0x54')](_0x5bfec2[_0xe301('0x4b')],[_0xe301('0x68'),'id'])||{});}return null;})[_0xe301('0x69')](function(_0x1a9644){var _0x5eab32;var _0x4e94d6;_0x5bc019=_0x1a9644||[];var _0x5863bf=[];if(_0x1a9644){for(var _0x431536=0x0;_0x431536<_0x1a9644[_0xe301('0x38')];_0x431536+=0x1){var _0x4bb05e=_0x1a9644[_0x431536][_0xe301('0x4d')]({'plain':!![]});_0x5eab32=squel[_0xe301('0x6c')]()[_0xe301('0x6d')](_0xe301('0x96'))[_0xe301('0x6f')](['phone','ContactId',_0xe301('0x77'),_0xe301('0x5a'),'createdAt','updatedAt'],squel[_0xe301('0x72')]()[_0xe301('0x73')]('phone','phone')['field']('id',_0xe301('0x75'))[_0xe301('0x73')](_0x4bb05e[_0xe301('0x76')][_0xe301('0x80')](),_0xe301('0x77'))[_0xe301('0x73')](_0x5bfec2[_0xe301('0x48')]['id']['toString'](),'CampaignId')[_0xe301('0x73')](_0xe301('0x74'),_0xe301('0x56'))[_0xe301('0x73')]('NOW()','updatedAt')[_0xe301('0x78')](_0xe301('0x79'))['where']('deletedAt\x20IS\x20NULL')[_0xe301('0x3d')](_0xe301('0x82'),_0x4bb05e['CmListId'][_0xe301('0x80')]())[_0xe301('0x3d')](_0xe301('0x7b')))['toString']();_0x5863bf[_0xe301('0x8f')](db[_0xe301('0x90')]['query'](_0x5eab32));}return BPromise[_0xe301('0x91')](_0x5863bf);}})['then'](function(){return _0x5bc019;})[_0xe301('0x26')](respondWithResult(_0x584168,null))[_0xe301('0x46')](handleError(_0x584168,null));};exports[_0xe301('0x97')]=function(_0x28dc58,_0x1cfc9f,_0x1972d0){return db[_0xe301('0x2e')][_0xe301('0x49')]({'where':{'id':_0x28dc58[_0xe301('0x48')]['id']}})['then'](handleEntityNotFound(_0x1cfc9f,null))[_0xe301('0x26')](function(_0x412fb7){if(_0x412fb7){return _0x412fb7[_0xe301('0x97')](_0x28dc58[_0xe301('0x32')][_0xe301('0x68')]);}})[_0xe301('0x26')](function(_0x17d3cf){if(_0x17d3cf){return db[_0xe301('0x63')]['destroy']({'where':{'ListId':_0x28dc58[_0xe301('0x32')]['ids'],'CampaignId':_0x28dc58['params']['id']}})[_0xe301('0x26')](function(){return _0x17d3cf;});}})[_0xe301('0x26')](respondWithStatusCode(_0x1cfc9f,null))[_0xe301('0x46')](handleError(_0x1cfc9f,null));}; \ No newline at end of file +var _0x959e=['fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','deletedAt\x20IS\x20NULL','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','save','update','IvrCampaigns','UserProfileResource','then','stack','name','send','index','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','destroy','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','into'];(function(_0x5d96ee,_0x523278){var _0x39092b=function(_0x4ae30b){while(--_0x4ae30b){_0x5d96ee['push'](_0x5d96ee['shift']());}};_0x39092b(++_0x523278);}(_0x959e,0x1e2));var _0xe959=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x959e[_0xa60623];return _0x4a6487;};'use strict';var emlformat=require(_0xe959('0x0'));var rimraf=require(_0xe959('0x1'));var zipdir=require(_0xe959('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe959('0x3'));var moment=require(_0xe959('0x4'));var BPromise=require(_0xe959('0x5'));var Mustache=require(_0xe959('0x6'));var util=require(_0xe959('0x7'));var path=require(_0xe959('0x8'));var sox=require('sox');var csv=require(_0xe959('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe959('0xa'));var _=require(_0xe959('0xb'));var squel=require(_0xe959('0xc'));var crypto=require(_0xe959('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe959('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe959('0xe'));var authService=require(_0xe959('0xf'));var qs=require(_0xe959('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe959('0x11'));var logger=require(_0xe959('0x12'))(_0xe959('0x13'));var utils=require('../../config/utils');var config=require(_0xe959('0x14'));var licenseUtil=require(_0xe959('0x15'));var db=require(_0xe959('0x16'))['db'];function respondWithStatusCode(_0x3deca7,_0x1fa963){_0x1fa963=_0x1fa963||0xcc;return function(_0x5c7a12){if(_0x5c7a12){return _0x3deca7[_0xe959('0x17')](_0x1fa963);}return _0x3deca7['status'](_0x1fa963)[_0xe959('0x18')]();};}function respondWithResult(_0x5bd09e,_0x468f60){_0x468f60=_0x468f60||0xc8;return function(_0x2e68f7){if(_0x2e68f7){return _0x5bd09e[_0xe959('0x19')](_0x468f60)[_0xe959('0x1a')](_0x2e68f7);}};}function respondWithFilteredResult(_0x16a8da,_0x3bd45f){return function(_0x16835a){if(_0x16835a){var _0x48cc78=typeof _0x3bd45f['offset']==='undefined'&&typeof _0x3bd45f[_0xe959('0x1b')]==='undefined';var _0x26d496=_0x16835a[_0xe959('0x1c')];var _0x432c38=_0x48cc78?0x0:_0x3bd45f['offset'];var _0x326c4f=_0x48cc78?_0x16835a[_0xe959('0x1c')]:_0x3bd45f[_0xe959('0x1d')]+_0x3bd45f['limit'];var _0x7cd26d;if(_0x326c4f>=_0x26d496){_0x326c4f=_0x26d496;_0x7cd26d=0xc8;}else{_0x7cd26d=0xce;}_0x16a8da['status'](_0x7cd26d);return _0x16a8da[_0xe959('0x1e')](_0xe959('0x1f'),_0x432c38+'-'+_0x326c4f+'/'+_0x26d496)[_0xe959('0x1a')](_0x16835a);}return null;};}function patchUpdates(_0x40171c){return function(_0x4ad6ac){try{jsonpatch[_0xe959('0x20')](_0x4ad6ac,_0x40171c,!![]);}catch(_0x53cfcb){return BPromise['reject'](_0x53cfcb);}return _0x4ad6ac[_0xe959('0x21')]();};}function saveUpdates(_0x59ac7e,_0x5521e9){return function(_0x1bbf4f){if(_0x1bbf4f){return _0x1bbf4f[_0xe959('0x22')](_0x59ac7e)['then'](function(_0x34af4a){return _0x34af4a;});}return null;};}function removeEntity(_0x37f638,_0x5e2dda){return function(_0x4a0739){if(_0x4a0739){return _0x4a0739['destroy']()['then'](function(){var _0xbe0c93=_0x4a0739['get']({'plain':!![]});var _0x1a1cd9=_0xe959('0x23');return db[_0xe959('0x24')]['destroy']({'where':{'type':_0x1a1cd9,'resourceId':_0xbe0c93['id']}})[_0xe959('0x25')](function(){return _0x4a0739;});})[_0xe959('0x25')](function(){_0x37f638[_0xe959('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf5e0ed,_0x1cc676){return function(_0x2a39ad){if(!_0x2a39ad){_0xf5e0ed[_0xe959('0x17')](0x194);}return _0x2a39ad;};}function handleError(_0xbd3635,_0x14a521){_0x14a521=_0x14a521||0x1f4;return function(_0x562d76){logger['error'](_0x562d76[_0xe959('0x26')]);if(_0x562d76[_0xe959('0x27')]){delete _0x562d76[_0xe959('0x27')];}_0xbd3635['status'](_0x14a521)[_0xe959('0x28')](_0x562d76);};}exports[_0xe959('0x29')]=function(_0x6ba7a9,_0x147442){var _0x3eba7c={},_0x570cc1={},_0x55f000={'count':0x0,'rows':[]};var _0x2e1a73=_['map'](db[_0xe959('0x2a')][_0xe959('0x2b')],function(_0x1341c4){return{'name':_0x1341c4[_0xe959('0x2c')],'type':_0x1341c4[_0xe959('0x2d')][_0xe959('0x2e')]};});_0x570cc1[_0xe959('0x2f')]=_['map'](_0x2e1a73,'name');_0x570cc1[_0xe959('0x30')]=_[_0xe959('0x31')](_0x6ba7a9[_0xe959('0x30')]);_0x570cc1[_0xe959('0x32')]=_[_0xe959('0x33')](_0x570cc1[_0xe959('0x2f')],_0x570cc1[_0xe959('0x30')]);_0x3eba7c[_0xe959('0x34')]=_[_0xe959('0x33')](_0x570cc1['model'],qs[_0xe959('0x35')](_0x6ba7a9['query'][_0xe959('0x35')]));_0x3eba7c[_0xe959('0x34')]=_0x3eba7c['attributes'][_0xe959('0x36')]?_0x3eba7c[_0xe959('0x34')]:_0x570cc1[_0xe959('0x2f')];if(!_0x6ba7a9[_0xe959('0x30')][_0xe959('0x37')]('nolimit')){_0x3eba7c[_0xe959('0x1b')]=qs[_0xe959('0x1b')](_0x6ba7a9[_0xe959('0x30')]['limit']);_0x3eba7c['offset']=qs[_0xe959('0x1d')](_0x6ba7a9[_0xe959('0x30')][_0xe959('0x1d')]);}_0x3eba7c[_0xe959('0x38')]=qs[_0xe959('0x39')](_0x6ba7a9[_0xe959('0x30')][_0xe959('0x39')]);_0x3eba7c[_0xe959('0x3a')]=qs[_0xe959('0x32')](_['pick'](_0x6ba7a9[_0xe959('0x30')],_0x570cc1[_0xe959('0x32')]),_0x2e1a73);if(_0x6ba7a9[_0xe959('0x30')][_0xe959('0x3b')]){_0x3eba7c[_0xe959('0x3a')]=_[_0xe959('0x3c')](_0x3eba7c['where'],{'$or':_[_0xe959('0x3d')](_0x2e1a73,function(_0x4db9e5){if(_0x4db9e5[_0xe959('0x2d')]!==_0xe959('0x3e')){var _0x1af15b={};_0x1af15b[_0x4db9e5['name']]={'$like':'%'+_0x6ba7a9[_0xe959('0x30')][_0xe959('0x3b')]+'%'};return _0x1af15b;}})});}_0x3eba7c=_['merge']({},_0x3eba7c,_0x6ba7a9[_0xe959('0x3f')]);var _0x4e9310={'where':_0x3eba7c[_0xe959('0x3a')]};return db[_0xe959('0x2a')][_0xe959('0x1c')](_0x4e9310)['then'](function(_0x25ebe8){_0x55f000[_0xe959('0x1c')]=_0x25ebe8;if(_0x6ba7a9[_0xe959('0x30')][_0xe959('0x40')]){_0x3eba7c[_0xe959('0x41')]=[{'all':!![]}];}return db[_0xe959('0x2a')][_0xe959('0x42')](_0x3eba7c);})[_0xe959('0x25')](function(_0x813fe7){_0x55f000['rows']=_0x813fe7;return _0x55f000;})['then'](respondWithFilteredResult(_0x147442,_0x3eba7c))[_0xe959('0x43')](handleError(_0x147442,null));};exports[_0xe959('0x44')]=function(_0x475bdc,_0x20ea89){var _0x2ee38b={'raw':![],'where':{'id':_0x475bdc[_0xe959('0x45')]['id']}},_0x1d5cb6={};_0x1d5cb6[_0xe959('0x2f')]=_[_0xe959('0x31')](db[_0xe959('0x2a')][_0xe959('0x2b')]);_0x1d5cb6[_0xe959('0x30')]=_[_0xe959('0x31')](_0x475bdc['query']);_0x1d5cb6[_0xe959('0x32')]=_[_0xe959('0x33')](_0x1d5cb6[_0xe959('0x2f')],_0x1d5cb6[_0xe959('0x30')]);_0x2ee38b[_0xe959('0x34')]=_['intersection'](_0x1d5cb6['model'],qs['fields'](_0x475bdc[_0xe959('0x30')][_0xe959('0x35')]));_0x2ee38b[_0xe959('0x34')]=_0x2ee38b[_0xe959('0x34')][_0xe959('0x36')]?_0x2ee38b[_0xe959('0x34')]:_0x1d5cb6[_0xe959('0x2f')];if(_0x475bdc[_0xe959('0x30')][_0xe959('0x40')]){_0x2ee38b[_0xe959('0x41')]=[{'all':!![]}];}_0x2ee38b=_[_0xe959('0x3c')]({},_0x2ee38b,_0x475bdc['options']);return db[_0xe959('0x2a')]['find'](_0x2ee38b)['then'](handleEntityNotFound(_0x20ea89,null))[_0xe959('0x25')](respondWithResult(_0x20ea89,null))['catch'](handleError(_0x20ea89,null));};exports[_0xe959('0x46')]=function(_0x3ef0cc,_0x4bd6de){return db[_0xe959('0x2a')][_0xe959('0x46')](_0x3ef0cc[_0xe959('0x47')],{})[_0xe959('0x25')](function(_0x53a733){var _0x2b23af=_0x3ef0cc['user'][_0xe959('0x48')]({'plain':!![]});if(!_0x2b23af)throw new Error(_0xe959('0x49'));if(_0x2b23af['role']===_0xe959('0x4a')){var _0x3f5b8f=_0x53a733[_0xe959('0x48')]({'plain':!![]});var _0x1d08ed=_0xe959('0x23');return db[_0xe959('0x4b')][_0xe959('0x4c')]({'where':{'name':_0x1d08ed,'userProfileId':_0x2b23af[_0xe959('0x4d')]},'raw':!![]})[_0xe959('0x25')](function(_0x2d7d15){if(_0x2d7d15&&_0x2d7d15[_0xe959('0x4e')]===0x0){return db[_0xe959('0x24')]['create']({'name':_0x3f5b8f['name'],'resourceId':_0x3f5b8f['id'],'type':_0x2d7d15['name'],'sectionId':_0x2d7d15['id']},{})[_0xe959('0x25')](function(){return _0x53a733;});}else{return _0x53a733;}})[_0xe959('0x43')](function(_0x5dd705){logger[_0xe959('0x4f')](_0xe959('0x50'),_0x5dd705);throw _0x5dd705;});}return _0x53a733;})[_0xe959('0x25')](respondWithResult(_0x4bd6de,0xc9))['catch'](handleError(_0x4bd6de,null));};exports['clone']=function(_0x5e435b,_0x52ddcf){var _0x524181={'where':{'id':_0x5e435b[_0xe959('0x45')]['id']}},_0x4679d3={};_0x4679d3[_0xe959('0x2f')]=_[_0xe959('0x31')](db[_0xe959('0x2a')][_0xe959('0x2b')]);_0x524181[_0xe959('0x34')]=_[_0xe959('0x33')](_0x4679d3[_0xe959('0x2f')],qs[_0xe959('0x35')](_0x5e435b[_0xe959('0x30')][_0xe959('0x35')]));_0x524181[_0xe959('0x34')]=_0x524181['attributes']['length']?_0x524181[_0xe959('0x34')]:_0x4679d3[_0xe959('0x2f')];if(_0x5e435b[_0xe959('0x30')]['includeAll']){_0x524181['include']=[{'all':!![]}];}_0x524181=_[_0xe959('0x3c')]({},_0x524181,_0x5e435b[_0xe959('0x3f')]);return db[_0xe959('0x2a')][_0xe959('0x4c')](_0x524181)[_0xe959('0x25')](handleEntityNotFound(_0x52ddcf,null))[_0xe959('0x25')](function(_0x2a83c1){if(_0x2a83c1){var _0x57e046=_0x2a83c1[_0xe959('0x48')]({'plain':!![]});_0x57e046=qs[_0xe959('0x51')](_0x57e046,['id',_0xe959('0x52'),_0xe959('0x53')]);_0x5e435b[_0xe959('0x47')]=_[_0xe959('0x51')](_0x5e435b[_0xe959('0x47')],['id',_0xe959('0x52'),_0xe959('0x53')]);return db['Campaign'][_0xe959('0x46')](_['merge'](_0x57e046,_0x5e435b['body']),{'include':_0x5e435b[_0xe959('0x30')][_0xe959('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x2423c5){var _0x1829b8=_0x5e435b[_0xe959('0x4a')][_0xe959('0x48')]({'plain':!![]});if(!_0x1829b8)throw new Error(_0xe959('0x49'));if(_0x1829b8['role']==='user'){var _0x22b4c3=_0x2423c5[_0xe959('0x48')]({'plain':!![]});var _0x8ae9e7=_0xe959('0x23');return db[_0xe959('0x4b')]['find']({'where':{'name':_0x8ae9e7,'userProfileId':_0x1829b8[_0xe959('0x4d')]},'raw':!![]})[_0xe959('0x25')](function(_0x59d4eb){if(_0x59d4eb&&_0x59d4eb[_0xe959('0x4e')]===0x0){return db[_0xe959('0x24')]['create']({'name':_0x22b4c3[_0xe959('0x27')],'resourceId':_0x22b4c3['id'],'type':_0x59d4eb[_0xe959('0x27')],'sectionId':_0x59d4eb['id']},{})['then'](function(){return _0x2423c5;});}else{return _0x2423c5;}})[_0xe959('0x43')](function(_0x4de8cd){logger[_0xe959('0x4f')](_0xe959('0x50'),_0x4de8cd);throw _0x4de8cd;});}return _0x2423c5;});}})[_0xe959('0x25')](respondWithResult(_0x52ddcf,0xc9))['catch'](handleError(_0x52ddcf,null));};exports['update']=function(_0x535074,_0x222d97){if(_0x535074[_0xe959('0x47')]['id']){delete _0x535074['body']['id'];}return db[_0xe959('0x2a')][_0xe959('0x4c')]({'where':{'id':_0x535074[_0xe959('0x45')]['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x222d97,null))[_0xe959('0x25')](saveUpdates(_0x535074[_0xe959('0x47')],null))[_0xe959('0x25')](respondWithResult(_0x222d97,null))[_0xe959('0x43')](handleError(_0x222d97,null));};exports[_0xe959('0x54')]=function(_0x3704d8,_0x5445c2){return db[_0xe959('0x2a')]['find']({'where':{'id':_0x3704d8['params']['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x5445c2,null))['then'](removeEntity(_0x5445c2,null))[_0xe959('0x43')](handleError(_0x5445c2,null));};exports[_0xe959('0x55')]=function(_0x5acf08,_0x5ae0f3,_0x54d466){var _0x17459b={'raw':!![],'where':{}};var _0x1359be={};var _0x3dce85={'count':0x0,'rows':[]};return db['Campaign'][_0xe959('0x56')]({'where':{'id':_0x5acf08[_0xe959('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ae0f3,null))[_0xe959('0x25')](function(_0x527d8f){if(_0x527d8f){_0x1359be[_0xe959('0x2f')]=_[_0xe959('0x31')](db[_0xe959('0x57')]['rawAttributes']);_0x1359be[_0xe959('0x30')]=_[_0xe959('0x31')](_0x5acf08[_0xe959('0x30')]);_0x1359be['filters']=_[_0xe959('0x33')](_0x1359be[_0xe959('0x2f')],_0x1359be[_0xe959('0x30')]);_0x17459b[_0xe959('0x34')]=_[_0xe959('0x33')](_0x1359be[_0xe959('0x2f')],qs['fields'](_0x5acf08[_0xe959('0x30')][_0xe959('0x35')]));_0x17459b[_0xe959('0x34')]=_0x17459b[_0xe959('0x34')]['length']?_0x17459b[_0xe959('0x34')]:_0x1359be['model'];if(!_0x5acf08[_0xe959('0x30')]['hasOwnProperty'](_0xe959('0x58'))){_0x17459b[_0xe959('0x1b')]=qs[_0xe959('0x1b')](_0x5acf08[_0xe959('0x30')][_0xe959('0x1b')]);_0x17459b[_0xe959('0x1d')]=qs[_0xe959('0x1d')](_0x5acf08[_0xe959('0x30')][_0xe959('0x1d')]);}_0x17459b[_0xe959('0x38')]=qs[_0xe959('0x39')](_0x5acf08[_0xe959('0x30')][_0xe959('0x39')]);_0x17459b[_0xe959('0x3a')]=qs['filters'](_[_0xe959('0x59')](_0x5acf08[_0xe959('0x30')],_0x1359be['filters']));_0x17459b[_0xe959('0x3a')][_0xe959('0x5a')]=_0x527d8f['id'];if(_0x5acf08['query']['filter']){_0x17459b['where']=_['merge'](_0x17459b[_0xe959('0x3a')],{'$or':_[_0xe959('0x3d')](_0x17459b[_0xe959('0x34')],function(_0x260098){var _0x1a9a81={};_0x1a9a81[_0x260098]={'$like':'%'+_0x5acf08[_0xe959('0x30')][_0xe959('0x3b')]+'%'};return _0x1a9a81;})});}_0x17459b=_[_0xe959('0x3c')]({},_0x17459b,_0x5acf08[_0xe959('0x3f')]);return db[_0xe959('0x57')][_0xe959('0x1c')]({'where':_0x17459b[_0xe959('0x3a')]})['then'](function(_0x7aef49){_0x3dce85['count']=_0x7aef49;if(_0x5acf08['query'][_0xe959('0x40')]){_0x17459b[_0xe959('0x41')]=[{'all':!![]}];}return db[_0xe959('0x57')][_0xe959('0x42')](_0x17459b);})[_0xe959('0x25')](function(_0x216295){_0x3dce85[_0xe959('0x5b')]=_0x216295;return _0x3dce85;});}})[_0xe959('0x25')](respondWithFilteredResult(_0x5ae0f3,_0x17459b))[_0xe959('0x43')](handleError(_0x5ae0f3,null));};exports[_0xe959('0x5c')]=function(_0x24d15e,_0x5afa59,_0x4e9e4d){var _0x57a83a={'raw':!![],'where':{}};var _0x201bfe={};var _0x274139={'count':0x0,'rows':[]};return db[_0xe959('0x2a')]['findOne']({'where':{'id':_0x24d15e['params']['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x5afa59,null))[_0xe959('0x25')](function(_0x1dca35){if(_0x1dca35){_0x201bfe[_0xe959('0x2f')]=_[_0xe959('0x31')](db[_0xe959('0x5d')][_0xe959('0x2b')]);_0x201bfe[_0xe959('0x30')]=_[_0xe959('0x31')](_0x24d15e[_0xe959('0x30')]);_0x201bfe['filters']=_[_0xe959('0x33')](_0x201bfe[_0xe959('0x2f')],_0x201bfe['query']);_0x57a83a[_0xe959('0x34')]=_['intersection'](_0x201bfe[_0xe959('0x2f')],qs['fields'](_0x24d15e[_0xe959('0x30')]['fields']));_0x57a83a[_0xe959('0x34')]=_0x57a83a[_0xe959('0x34')][_0xe959('0x36')]?_0x57a83a[_0xe959('0x34')]:_0x201bfe['model'];if(!_0x24d15e['query']['hasOwnProperty'](_0xe959('0x58'))){_0x57a83a[_0xe959('0x1b')]=qs[_0xe959('0x1b')](_0x24d15e['query'][_0xe959('0x1b')]);_0x57a83a[_0xe959('0x1d')]=qs[_0xe959('0x1d')](_0x24d15e[_0xe959('0x30')][_0xe959('0x1d')]);}_0x57a83a[_0xe959('0x38')]=qs[_0xe959('0x39')](_0x24d15e['query'][_0xe959('0x39')]);_0x57a83a[_0xe959('0x3a')]=qs[_0xe959('0x32')](_[_0xe959('0x59')](_0x24d15e[_0xe959('0x30')],_0x201bfe[_0xe959('0x32')]));_0x57a83a[_0xe959('0x3a')][_0xe959('0x5a')]=_0x1dca35['id'];if(_0x24d15e['query']['filter']){_0x57a83a[_0xe959('0x3a')]=_[_0xe959('0x3c')](_0x57a83a['where'],{'$or':_['map'](_0x57a83a[_0xe959('0x34')],function(_0x1a59cd){var _0x325362={};_0x325362[_0x1a59cd]={'$like':'%'+_0x24d15e['query'][_0xe959('0x3b')]+'%'};return _0x325362;})});}_0x57a83a=_[_0xe959('0x3c')]({},_0x57a83a,_0x24d15e[_0xe959('0x3f')]);return db[_0xe959('0x5d')]['count']({'where':_0x57a83a[_0xe959('0x3a')]})[_0xe959('0x25')](function(_0x5ba992){_0x274139[_0xe959('0x1c')]=_0x5ba992;if(_0x24d15e[_0xe959('0x30')][_0xe959('0x40')]){_0x57a83a[_0xe959('0x41')]=[{'all':!![]}];}return db[_0xe959('0x5d')][_0xe959('0x42')](_0x57a83a);})[_0xe959('0x25')](function(_0x24337d){_0x274139[_0xe959('0x5b')]=_0x24337d;return _0x274139;});}})[_0xe959('0x25')](respondWithFilteredResult(_0x5afa59,_0x57a83a))['catch'](handleError(_0x5afa59,null));};exports[_0xe959('0x5e')]=function(_0x5a3d83,_0x2bc990,_0x38ff42){var _0x18d43a={'raw':!![],'where':{}};var _0x8285db={};var _0x2eb185={'count':0x0,'rows':[]};return db['Campaign'][_0xe959('0x56')]({'where':{'id':_0x5a3d83[_0xe959('0x45')]['id']}})['then'](handleEntityNotFound(_0x2bc990,null))['then'](function(_0x49e36e){if(_0x49e36e){_0x8285db[_0xe959('0x2f')]=_['keys'](db[_0xe959('0x5f')][_0xe959('0x2b')]);_0x8285db[_0xe959('0x30')]=_[_0xe959('0x31')](_0x5a3d83[_0xe959('0x30')]);_0x8285db[_0xe959('0x32')]=_['intersection'](_0x8285db['model'],_0x8285db[_0xe959('0x30')]);_0x18d43a['attributes']=_[_0xe959('0x33')](_0x8285db[_0xe959('0x2f')],qs['fields'](_0x5a3d83['query'][_0xe959('0x35')]));_0x18d43a[_0xe959('0x34')]=_0x18d43a[_0xe959('0x34')]['length']?_0x18d43a[_0xe959('0x34')]:_0x8285db[_0xe959('0x2f')];if(!_0x5a3d83[_0xe959('0x30')][_0xe959('0x37')](_0xe959('0x58'))){_0x18d43a['limit']=qs[_0xe959('0x1b')](_0x5a3d83[_0xe959('0x30')]['limit']);_0x18d43a['offset']=qs[_0xe959('0x1d')](_0x5a3d83[_0xe959('0x30')][_0xe959('0x1d')]);}_0x18d43a[_0xe959('0x38')]=qs[_0xe959('0x39')](_0x5a3d83[_0xe959('0x30')][_0xe959('0x39')]);_0x18d43a[_0xe959('0x3a')]=qs[_0xe959('0x32')](_['pick'](_0x5a3d83[_0xe959('0x30')],_0x8285db[_0xe959('0x32')]));_0x18d43a['where']['CampaignId']=_0x49e36e['id'];if(_0x5a3d83['query'][_0xe959('0x3b')]){_0x18d43a[_0xe959('0x3a')]=_[_0xe959('0x3c')](_0x18d43a['where'],{'$or':_['map'](_0x18d43a[_0xe959('0x34')],function(_0x4fe6de){var _0x3471f5={};_0x3471f5[_0x4fe6de]={'$like':'%'+_0x5a3d83[_0xe959('0x30')]['filter']+'%'};return _0x3471f5;})});}_0x18d43a=_[_0xe959('0x3c')]({},_0x18d43a,_0x5a3d83[_0xe959('0x3f')]);return db[_0xe959('0x5f')][_0xe959('0x1c')]({'where':_0x18d43a[_0xe959('0x3a')]})['then'](function(_0x590d93){_0x2eb185[_0xe959('0x1c')]=_0x590d93;if(_0x5a3d83[_0xe959('0x30')]['includeAll']){_0x18d43a[_0xe959('0x41')]=[{'all':!![]}];}return db[_0xe959('0x5f')][_0xe959('0x42')](_0x18d43a);})[_0xe959('0x25')](function(_0x18d23f){_0x2eb185[_0xe959('0x5b')]=_0x18d23f;return _0x2eb185;});}})[_0xe959('0x25')](respondWithFilteredResult(_0x2bc990,_0x18d43a))[_0xe959('0x43')](handleError(_0x2bc990,null));};exports[_0xe959('0x60')]=function(_0x1cdd45,_0x1b17a4,_0x3d78a1){var _0x2de441={'raw':!![],'where':{}};var _0x1a7e33={};var _0x3a1ab0={'count':0x0,'rows':[]};return db['Campaign'][_0xe959('0x56')]({'where':{'id':_0x1cdd45[_0xe959('0x45')]['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x1b17a4,null))[_0xe959('0x25')](function(_0x2bb9d1){if(_0x2bb9d1){_0x1a7e33[_0xe959('0x2f')]=_['keys'](db[_0xe959('0x61')][_0xe959('0x2b')]);_0x1a7e33[_0xe959('0x30')]=_[_0xe959('0x31')](_0x1cdd45[_0xe959('0x30')]);_0x1a7e33[_0xe959('0x32')]=_['intersection'](_0x1a7e33[_0xe959('0x2f')],_0x1a7e33[_0xe959('0x30')]);_0x2de441[_0xe959('0x34')]=_[_0xe959('0x33')](_0x1a7e33['model'],qs[_0xe959('0x35')](_0x1cdd45['query'][_0xe959('0x35')]));_0x2de441['attributes']=_0x2de441[_0xe959('0x34')][_0xe959('0x36')]?_0x2de441['attributes']:_0x1a7e33['model'];if(!_0x1cdd45[_0xe959('0x30')]['hasOwnProperty']('nolimit')){_0x2de441[_0xe959('0x1b')]=qs[_0xe959('0x1b')](_0x1cdd45[_0xe959('0x30')][_0xe959('0x1b')]);_0x2de441[_0xe959('0x1d')]=qs[_0xe959('0x1d')](_0x1cdd45[_0xe959('0x30')][_0xe959('0x1d')]);}_0x2de441['order']=qs[_0xe959('0x39')](_0x1cdd45['query'][_0xe959('0x39')]);_0x2de441['where']=qs['filters'](_['pick'](_0x1cdd45['query'],_0x1a7e33[_0xe959('0x32')]));_0x2de441[_0xe959('0x3a')][_0xe959('0x5a')]=_0x2bb9d1['id'];if(_0x1cdd45[_0xe959('0x30')][_0xe959('0x3b')]){_0x2de441[_0xe959('0x3a')]=_[_0xe959('0x3c')](_0x2de441[_0xe959('0x3a')],{'$or':_['map'](_0x2de441[_0xe959('0x34')],function(_0x409f69){var _0x289491={};_0x289491[_0x409f69]={'$like':'%'+_0x1cdd45[_0xe959('0x30')]['filter']+'%'};return _0x289491;})});}_0x2de441=_['merge']({},_0x2de441,_0x1cdd45[_0xe959('0x3f')]);return db[_0xe959('0x61')][_0xe959('0x1c')]({'where':_0x2de441[_0xe959('0x3a')]})[_0xe959('0x25')](function(_0x3235f1){_0x3a1ab0[_0xe959('0x1c')]=_0x3235f1;if(_0x1cdd45[_0xe959('0x30')][_0xe959('0x40')]){_0x2de441[_0xe959('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xe959('0x42')](_0x2de441);})[_0xe959('0x25')](function(_0x4b681e){_0x3a1ab0[_0xe959('0x5b')]=_0x4b681e;return _0x3a1ab0;});}})['then'](respondWithFilteredResult(_0x1b17a4,_0x2de441))[_0xe959('0x43')](handleError(_0x1b17a4,null));};exports[_0xe959('0x62')]=function(_0x14cedd,_0x4bca24,_0x56c81c){var _0x468d12={};var _0x2d53cc={};var _0x2246b3;var _0x3419ad;return db[_0xe959('0x2a')][_0xe959('0x56')]({'where':{'id':_0x14cedd[_0xe959('0x45')]['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x4bca24,null))[_0xe959('0x25')](function(_0x2be10d){if(_0x2be10d){_0x2246b3=_0x2be10d;_0x2d53cc['model']=_[_0xe959('0x31')](db['CmList'][_0xe959('0x2b')]);_0x2d53cc['query']=_[_0xe959('0x31')](_0x14cedd[_0xe959('0x30')]);_0x2d53cc['filters']=_[_0xe959('0x33')](_0x2d53cc[_0xe959('0x2f')],_0x2d53cc[_0xe959('0x30')]);_0x468d12[_0xe959('0x34')]=_[_0xe959('0x33')](_0x2d53cc[_0xe959('0x2f')],qs[_0xe959('0x35')](_0x14cedd['query']['fields']));_0x468d12[_0xe959('0x34')]=_0x468d12['attributes'][_0xe959('0x36')]?_0x468d12[_0xe959('0x34')]:_0x2d53cc[_0xe959('0x2f')];_0x468d12[_0xe959('0x38')]=qs['sort'](_0x14cedd['query']['sort']);_0x468d12[_0xe959('0x3a')]=qs[_0xe959('0x32')](_[_0xe959('0x59')](_0x14cedd[_0xe959('0x30')],_0x2d53cc[_0xe959('0x32')]));if(_0x14cedd['query'][_0xe959('0x3b')]){_0x468d12[_0xe959('0x3a')]=_['merge'](_0x468d12[_0xe959('0x3a')],{'$or':_['map'](_0x468d12[_0xe959('0x34')],function(_0x205094){var _0x53cc08={};_0x53cc08[_0x205094]={'$like':'%'+_0x14cedd[_0xe959('0x30')]['filter']+'%'};return _0x53cc08;})});}_0x468d12=_[_0xe959('0x3c')]({},_0x468d12,_0x14cedd[_0xe959('0x3f')]);return _0x2246b3[_0xe959('0x62')](_0x468d12);}})[_0xe959('0x25')](function(_0x9e4cc7){if(_0x9e4cc7){_0x3419ad=_0x9e4cc7[_0xe959('0x36')];if(!_0x14cedd['query']['hasOwnProperty'](_0xe959('0x58'))){_0x468d12[_0xe959('0x1b')]=qs[_0xe959('0x1b')](_0x14cedd[_0xe959('0x30')][_0xe959('0x1b')]);_0x468d12[_0xe959('0x1d')]=qs[_0xe959('0x1d')](_0x14cedd['query']['offset']);}return _0x2246b3[_0xe959('0x62')](_0x468d12);}})[_0xe959('0x25')](function(_0x13a7f1){if(_0x13a7f1){return _0x13a7f1?{'count':_0x3419ad,'rows':_0x13a7f1}:null;}})[_0xe959('0x25')](respondWithResult(_0x4bca24,null))[_0xe959('0x43')](handleError(_0x4bca24,null));};exports[_0xe959('0x63')]=function(_0x2d5152,_0x37b9cc,_0x54cefa){var _0x30ae03,_0x59a8e2;var _0xa15684=[];var _0x2cb28d=moment()[_0xe959('0x64')](_0xe959('0x65'));return db[_0xe959('0x2a')][_0xe959('0x4c')]({'where':{'id':_0x2d5152[_0xe959('0x45')]['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x37b9cc,null))[_0xe959('0x25')](function(_0x48397d){if(_0x48397d){_0x59a8e2=_0x48397d;return _0x48397d[_0xe959('0x63')](_0x2d5152[_0xe959('0x47')][_0xe959('0x66')],_[_0xe959('0x51')](_0x2d5152[_0xe959('0x47')],['ids','id'])||{});}return null;})[_0xe959('0x67')](function(_0x2a9668){var _0x339650;var _0x2a8ad3;_0x30ae03=_0x2a9668||[];var _0x565296=[];if(_0x2a9668){for(var _0x1287f6=0x0;_0x1287f6<_0x2a9668[_0xe959('0x36')];_0x1287f6+=0x1){var _0x253a27=_0x2a9668[_0x1287f6]['get']({'plain':!![]});_0x59a8e2[_0xe959('0x68')]=_0x2d5152[_0xe959('0x47')][_0xe959('0x68')]?_0x2d5152['body'][_0xe959('0x68')]:_0x59a8e2[_0xe959('0x68')];switch(_0x59a8e2[_0xe959('0x68')]){case'always':_0x339650=squel['insert']()[_0xe959('0x69')]('cm_hopper')[_0xe959('0x6a')](['phone',_0xe959('0x6b'),_0xe959('0x6c'),_0xe959('0x6d'),_0xe959('0x5a'),_0xe959('0x52'),_0xe959('0x53')],squel[_0xe959('0x6e')]()[_0xe959('0x6f')](_0xe959('0x70'),_0xe959('0x70'))['field'](_0xe959('0x71'),_0xe959('0x6b'))[_0xe959('0x6f')]('id','ContactId')[_0xe959('0x6f')](_0x253a27[_0xe959('0x72')][_0xe959('0x73')](),_0xe959('0x6d'))[_0xe959('0x6f')](_0x2d5152[_0xe959('0x45')]['id']['toString'](),_0xe959('0x5a'))['field']('\x27'+_0x2cb28d+'\x27','createdAt')[_0xe959('0x6f')]('\x27'+_0x2cb28d+'\x27',_0xe959('0x53'))[_0xe959('0x74')](_0xe959('0x75'))[_0xe959('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0xe959('0x76'),_0x253a27[_0xe959('0x72')]['toString']())[_0xe959('0x3a')](_0xe959('0x77'))['where'](_0xe959('0x78'),squel[_0xe959('0x6e')]()[_0xe959('0x6f')](_0xe959('0x79'))[_0xe959('0x74')](_0xe959('0x7a'))[_0xe959('0x3a')](_0xe959('0x7b'),_0x2d5152['params']['id'][_0xe959('0x73')]()))[_0xe959('0x3a')](_0xe959('0x78'),squel[_0xe959('0x6e')]()['field'](_0xe959('0x7c'))['from'](_0xe959('0x7d'))['where'](_0xe959('0x7b'),_0x2d5152[_0xe959('0x45')]['id'][_0xe959('0x73')]())))['toString']();break;case _0xe959('0x7e'):_0x339650=squel[_0xe959('0x7f')]()[_0xe959('0x69')](_0xe959('0x7d'))['fromQuery'](['phone',_0xe959('0x6b'),_0xe959('0x6c'),'ListId','CampaignId',_0xe959('0x52'),_0xe959('0x53')],squel['select']()[_0xe959('0x6f')](_0xe959('0x70'),_0xe959('0x70'))[_0xe959('0x6f')](_0xe959('0x71'),'scheduledAt')['field']('id',_0xe959('0x6c'))[_0xe959('0x6f')](_0x253a27['CmListId'][_0xe959('0x73')](),_0xe959('0x6d'))[_0xe959('0x6f')](_0x2d5152[_0xe959('0x45')]['id'][_0xe959('0x73')](),_0xe959('0x5a'))[_0xe959('0x6f')]('\x27'+_0x2cb28d+'\x27','createdAt')['field']('\x27'+_0x2cb28d+'\x27',_0xe959('0x53'))[_0xe959('0x74')](_0xe959('0x75'))['where'](_0xe959('0x80'))['where'](_0xe959('0x76'),_0x253a27[_0xe959('0x72')][_0xe959('0x73')]())[_0xe959('0x3a')](_0xe959('0x77'))[_0xe959('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe959('0x6f')](_0xe959('0x7c'))[_0xe959('0x74')](_0xe959('0x7d'))[_0xe959('0x3a')]('CampaignId\x20=\x20?',_0x2d5152[_0xe959('0x45')]['id'][_0xe959('0x73')]())))['toString']();break;default:_0x339650=squel['insert']()['into'](_0xe959('0x7d'))['fromQuery']([_0xe959('0x70'),'scheduledAt',_0xe959('0x6c'),_0xe959('0x6d'),_0xe959('0x5a'),'createdAt','updatedAt'],squel['select']()['field'](_0xe959('0x70'),_0xe959('0x70'))[_0xe959('0x6f')](_0xe959('0x71'),_0xe959('0x6b'))[_0xe959('0x6f')]('id','ContactId')[_0xe959('0x6f')](_0x253a27['CmListId'][_0xe959('0x73')](),'ListId')[_0xe959('0x6f')](_0x2d5152['params']['id'][_0xe959('0x73')](),_0xe959('0x5a'))[_0xe959('0x6f')]('\x27'+_0x2cb28d+'\x27',_0xe959('0x52'))[_0xe959('0x6f')]('\x27'+_0x2cb28d+'\x27',_0xe959('0x53'))[_0xe959('0x74')](_0xe959('0x75'))[_0xe959('0x3a')](_0xe959('0x80'))[_0xe959('0x3a')](_0xe959('0x76'),_0x253a27[_0xe959('0x72')][_0xe959('0x73')]())[_0xe959('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0xe959('0x73')]();}_0x2a8ad3=squel[_0xe959('0x7f')]()[_0xe959('0x69')]('cm_hopper_additional_phones')[_0xe959('0x6a')]([_0xe959('0x81'),_0xe959('0x6b'),_0xe959('0x70'),_0xe959('0x82'),_0xe959('0x52'),_0xe959('0x53')],squel[_0xe959('0x6e')]()['field'](_0xe959('0x83'),'id')[_0xe959('0x6f')]('NOW()',_0xe959('0x6b'))[_0xe959('0x6f')](_0xe959('0x84'),_0xe959('0x70'))['field'](_0xe959('0x85'),_0xe959('0x82'))[_0xe959('0x6f')]('\x27'+_0x2cb28d+'\x27',_0xe959('0x52'))[_0xe959('0x6f')]('\x27'+_0x2cb28d+'\x27',_0xe959('0x53'))[_0xe959('0x74')](_0xe959('0x86'),'ci')[_0xe959('0x87')]('cm_hopper','h',_0xe959('0x88'))[_0xe959('0x3a')](_0xe959('0x89'),_0x253a27['CmListId']['toString']())['where'](_0xe959('0x8a'),_0x2d5152[_0xe959('0x45')]['id'][_0xe959('0x73')]())[_0xe959('0x3a')]('h.createdAt\x20=\x20?',_0x2cb28d))[_0xe959('0x73')]();_0x565296['push'](db['sequelize'][_0xe959('0x30')](_0x339650));_0xa15684[_0xe959('0x8b')](db[_0xe959('0x8c')][_0xe959('0x30')](_0x2a8ad3));}return BPromise[_0xe959('0x8d')](_0x565296);}})['then'](function(){return BPromise[_0xe959('0x8d')](_0xa15684);})[_0xe959('0x25')](function(){return _0x30ae03;})[_0xe959('0x25')](respondWithResult(_0x37b9cc,null))[_0xe959('0x43')](handleError(_0x37b9cc,null));};exports[_0xe959('0x8e')]=function(_0x58610f,_0x4220fa,_0x5fd409){return db['Campaign'][_0xe959('0x4c')]({'where':{'id':_0x58610f[_0xe959('0x45')]['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x4220fa,null))[_0xe959('0x25')](function(_0x113df5){if(_0x113df5){return _0x113df5[_0xe959('0x8e')](_0x58610f[_0xe959('0x30')][_0xe959('0x66')]);}})[_0xe959('0x25')](function(_0x300f25){if(_0x300f25){return db['CmHopper'][_0xe959('0x54')]({'where':{'ListId':_0x58610f[_0xe959('0x30')][_0xe959('0x66')],'CampaignId':_0x58610f[_0xe959('0x45')]['id']}})[_0xe959('0x25')](function(){return _0x300f25;});}})[_0xe959('0x25')](respondWithStatusCode(_0x4220fa,null))[_0xe959('0x43')](handleError(_0x4220fa,null));};exports[_0xe959('0x8f')]=function(_0x15cf08,_0x5b5ab5,_0x5ed44c){var _0x8f8873={};var _0x17deae={};var _0x34213f;var _0x11af9a;return db[_0xe959('0x2a')][_0xe959('0x56')]({'where':{'id':_0x15cf08['params']['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x5b5ab5,null))[_0xe959('0x25')](function(_0x512181){if(_0x512181){_0x34213f=_0x512181;_0x17deae[_0xe959('0x2f')]=_[_0xe959('0x31')](db['CmList'][_0xe959('0x2b')]);_0x17deae['query']=_['keys'](_0x15cf08[_0xe959('0x30')]);_0x17deae[_0xe959('0x32')]=_[_0xe959('0x33')](_0x17deae[_0xe959('0x2f')],_0x17deae[_0xe959('0x30')]);_0x8f8873['attributes']=_['intersection'](_0x17deae[_0xe959('0x2f')],qs[_0xe959('0x35')](_0x15cf08[_0xe959('0x30')][_0xe959('0x35')]));_0x8f8873[_0xe959('0x34')]=_0x8f8873['attributes'][_0xe959('0x36')]?_0x8f8873['attributes']:_0x17deae[_0xe959('0x2f')];_0x8f8873['order']=qs['sort'](_0x15cf08[_0xe959('0x30')][_0xe959('0x39')]);_0x8f8873['where']=qs[_0xe959('0x32')](_[_0xe959('0x59')](_0x15cf08[_0xe959('0x30')],_0x17deae[_0xe959('0x32')]));if(_0x15cf08[_0xe959('0x30')][_0xe959('0x3b')]){_0x8f8873['where']=_['merge'](_0x8f8873[_0xe959('0x3a')],{'$or':_[_0xe959('0x3d')](_0x8f8873[_0xe959('0x34')],function(_0x3bc421){var _0x13016c={};_0x13016c[_0x3bc421]={'$like':'%'+_0x15cf08[_0xe959('0x30')][_0xe959('0x3b')]+'%'};return _0x13016c;})});}_0x8f8873=_[_0xe959('0x3c')]({},_0x8f8873,_0x15cf08['options']);return _0x34213f['getBlackLists'](_0x8f8873);}})['then'](function(_0x459cd4){if(_0x459cd4){_0x11af9a=_0x459cd4[_0xe959('0x36')];if(!_0x15cf08[_0xe959('0x30')][_0xe959('0x37')](_0xe959('0x58'))){_0x8f8873[_0xe959('0x1b')]=qs[_0xe959('0x1b')](_0x15cf08[_0xe959('0x30')][_0xe959('0x1b')]);_0x8f8873[_0xe959('0x1d')]=qs['offset'](_0x15cf08['query'][_0xe959('0x1d')]);}return _0x34213f[_0xe959('0x8f')](_0x8f8873);}})[_0xe959('0x25')](function(_0x2c51a5){if(_0x2c51a5){return _0x2c51a5?{'count':_0x11af9a,'rows':_0x2c51a5}:null;}})[_0xe959('0x25')](respondWithResult(_0x5b5ab5,null))[_0xe959('0x43')](handleError(_0x5b5ab5,null));};exports[_0xe959('0x90')]=function(_0x23b8a7,_0x56d876,_0x851245){var _0x15739d,_0x1ac93e;var _0x5d2adf=[];var _0x458028=moment()[_0xe959('0x64')](_0xe959('0x65'));return db[_0xe959('0x2a')][_0xe959('0x4c')]({'where':{'id':_0x23b8a7[_0xe959('0x45')]['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x56d876,null))['then'](function(_0x5afc54){if(_0x5afc54){_0x1ac93e=_0x5afc54;return _0x5afc54[_0xe959('0x90')](_0x23b8a7['body'][_0xe959('0x66')],_['omit'](_0x23b8a7['body'],[_0xe959('0x66'),'id'])||{});}return null;})[_0xe959('0x67')](function(_0x37bd75){var _0x5d8179;var _0x54c716;_0x15739d=_0x37bd75||[];var _0x563353=[];if(_0x37bd75){for(var _0xdb4e84=0x0;_0xdb4e84<_0x37bd75[_0xe959('0x36')];_0xdb4e84+=0x1){var _0x8179cb=_0x37bd75[_0xdb4e84][_0xe959('0x48')]({'plain':!![]});_0x5d8179=squel[_0xe959('0x7f')]()[_0xe959('0x69')](_0xe959('0x91'))[_0xe959('0x6a')]([_0xe959('0x70'),_0xe959('0x6c'),'ListId',_0xe959('0x5a'),_0xe959('0x52'),_0xe959('0x53')],squel[_0xe959('0x6e')]()[_0xe959('0x6f')](_0xe959('0x70'),_0xe959('0x70'))[_0xe959('0x6f')]('id','ContactId')[_0xe959('0x6f')](_0x8179cb[_0xe959('0x72')][_0xe959('0x73')](),_0xe959('0x6d'))['field'](_0x23b8a7[_0xe959('0x45')]['id']['toString'](),_0xe959('0x5a'))['field'](_0xe959('0x71'),_0xe959('0x52'))[_0xe959('0x6f')](_0xe959('0x71'),_0xe959('0x53'))[_0xe959('0x74')](_0xe959('0x75'))[_0xe959('0x3a')](_0xe959('0x80'))[_0xe959('0x3a')](_0xe959('0x76'),_0x8179cb[_0xe959('0x72')][_0xe959('0x73')]())[_0xe959('0x3a')](_0xe959('0x77')))['toString']();_0x563353[_0xe959('0x8b')](db[_0xe959('0x8c')][_0xe959('0x30')](_0x5d8179));}return BPromise[_0xe959('0x8d')](_0x563353);}})['then'](function(){return _0x15739d;})['then'](respondWithResult(_0x56d876,null))['catch'](handleError(_0x56d876,null));};exports[_0xe959('0x92')]=function(_0x370ffc,_0x50bcea,_0x19a64a){return db['Campaign']['find']({'where':{'id':_0x370ffc['params']['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x50bcea,null))['then'](function(_0xbbfb25){if(_0xbbfb25){return _0xbbfb25['removeBlackLists'](_0x370ffc[_0xe959('0x30')][_0xe959('0x66')]);}})['then'](function(_0x535b64){if(_0x535b64){return db[_0xe959('0x61')][_0xe959('0x54')]({'where':{'ListId':_0x370ffc[_0xe959('0x30')]['ids'],'CampaignId':_0x370ffc[_0xe959('0x45')]['id']}})[_0xe959('0x25')](function(){return _0x535b64;});}})['then'](respondWithStatusCode(_0x50bcea,null))[_0xe959('0x43')](handleError(_0x50bcea,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 98c12ec..fc413f9 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x3410f3,_0x516979){var _0x5f2755=function(_0x305883){while(--_0x305883){_0x3410f3['push'](_0x3410f3['shift']());}};_0x5f2755(++_0x516979);}(_0x7a54,0x106));var _0x47a5=function(_0x2a9494,_0x4f59c4){_0x2a9494=_0x2a9494-0x0;var _0x214216=_0x7a54[_0x2a9494];return _0x214216;};'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 +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x16446a,_0x5e9140){var _0x2c7051=function(_0x2e6a25){while(--_0x2e6a25){_0x16446a['push'](_0x16446a['shift']());}};_0x2c7051(++_0x5e9140);}(_0x7a54,0x106));var _0x47a5=function(_0x3f0407,_0x25a746){_0x3f0407=_0x3f0407-0x0;var _0x25863d=_0x7a54[_0x3f0407];return _0x25863d;};'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 f16f811..76e18a9 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 _0xef38=['include','info','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','attributes','limit','map','model'];(function(_0x517802,_0x2b4bc3){var _0x1dbe68=function(_0xd6e08c){while(--_0xd6e08c){_0x517802['push'](_0x517802['shift']());}};_0x1dbe68(++_0x2b4bc3);}(_0xef38,0x122));var _0x8ef3=function(_0x55b73e,_0x4f9036){_0x55b73e=_0x55b73e-0x0;var _0x2175cd=_0xef38[_0x55b73e];return _0x2175cd;};'use strict';var _=require('lodash');var util=require(_0x8ef3('0x0'));var moment=require(_0x8ef3('0x1'));var BPromise=require(_0x8ef3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef3('0x3'))['db'];var utils=require(_0x8ef3('0x4'));var logger=require(_0x8ef3('0x5'))(_0x8ef3('0x6'));var config=require(_0x8ef3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8ef3('0x8')][_0x8ef3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ee13,_0x2c9ccd,_0x26107d){return new BPromise(function(_0x217874,_0x12b6c0){return client[_0x8ef3('0xa')](_0x50ee13,_0x26107d)[_0x8ef3('0xb')](function(_0xc4b3b3){logger['info'](_0x8ef3('0xc'),_0x2c9ccd,_0x8ef3('0xd'));logger[_0x8ef3('0xe')](_0x8ef3('0xf'),_0x2c9ccd,_0x8ef3('0xd'),JSON[_0x8ef3('0x10')](_0xc4b3b3));if(_0xc4b3b3[_0x8ef3('0x11')]){if(_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x12')]===0x1f4){logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);return _0x12b6c0(_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);}logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);return _0x217874(_0xc4b3b3['error'][_0x8ef3('0x13')]);}else{logger['info'](_0x8ef3('0xc'),_0x2c9ccd,'request\x20sent');_0x217874(_0xc4b3b3[_0x8ef3('0x14')][_0x8ef3('0x13')]);}})['catch'](function(_0x56884c){logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0x56884c);_0x12b6c0(_0x56884c);});});}exports[_0x8ef3('0x15')]=function(_0x434aa9){var _0x5296f2=this;return new Promise(function(_0x5cbed2,_0x29025b){return db[_0x8ef3('0x16')][_0x8ef3('0x17')]({'raw':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9['options'][_0x8ef3('0x19')]===undefined?!![]:![]:!![],'where':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9[_0x8ef3('0x18')]['where']||null:null,'attributes':_0x434aa9['options']?_0x434aa9[_0x8ef3('0x18')][_0x8ef3('0x1a')]||null:null,'limit':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9[_0x8ef3('0x18')][_0x8ef3('0x1b')]||null:null,'include':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9[_0x8ef3('0x18')]['include']?_[_0x8ef3('0x1c')](_0x434aa9[_0x8ef3('0x18')]['include'],function(_0xa9829e){return{'model':db[_0xa9829e[_0x8ef3('0x1d')]],'as':_0xa9829e['as'],'attributes':_0xa9829e[_0x8ef3('0x1a')],'include':_0xa9829e[_0x8ef3('0x1e')]?_[_0x8ef3('0x1c')](_0xa9829e['include'],function(_0x18ef45){return{'model':db[_0x18ef45[_0x8ef3('0x1d')]],'as':_0x18ef45['as'],'attributes':_0x18ef45[_0x8ef3('0x1a')],'include':_0x18ef45[_0x8ef3('0x1e')]?_['map'](_0x18ef45[_0x8ef3('0x1e')],function(_0x28637a){return{'model':db[_0x28637a[_0x8ef3('0x1d')]],'as':_0x28637a['as'],'attributes':_0x28637a[_0x8ef3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8ef3('0xb')](function(_0x28748f){logger[_0x8ef3('0x1f')](_0x8ef3('0x15'),_0x434aa9);logger[_0x8ef3('0xe')](_0x8ef3('0x15'),_0x434aa9,JSON[_0x8ef3('0x10')](_0x28748f));_0x5cbed2(_0x28748f);})['catch'](function(_0x4408f9){logger[_0x8ef3('0x11')](_0x8ef3('0x15'),_0x4408f9[_0x8ef3('0x13')],_0x434aa9);_0x29025b(_0x5296f2[_0x8ef3('0x11')](0x1f4,_0x4408f9[_0x8ef3('0x13')]));});});}; \ No newline at end of file +var _0x98e1=['client','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','message','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','stringify','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0x98e1,0x160));var _0x198e=function(_0x26a692,_0xacd9b7){_0x26a692=_0x26a692-0x0;var _0x277f46=_0x98e1[_0x26a692];return _0x277f46;};'use strict';var _=require('lodash');var util=require(_0x198e('0x0'));var moment=require(_0x198e('0x1'));var BPromise=require(_0x198e('0x2'));var rs=require(_0x198e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x198e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x198e('0x5'));var config=require(_0x198e('0x6'));var jayson=require(_0x198e('0x7'));var client=jayson[_0x198e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545114,_0x46ac1b,_0x4d45d6){return new BPromise(function(_0x3322c5,_0x5ba06f){return client[_0x198e('0x9')](_0x545114,_0x4d45d6)[_0x198e('0xa')](function(_0x1ea2bf){logger[_0x198e('0xb')](_0x198e('0xc'),_0x46ac1b,_0x198e('0xd'));logger[_0x198e('0xe')](_0x198e('0xf'),_0x46ac1b,_0x198e('0xd'),JSON['stringify'](_0x1ea2bf));if(_0x1ea2bf[_0x198e('0x10')]){if(_0x1ea2bf[_0x198e('0x10')]['code']===0x1f4){logger[_0x198e('0x10')]('Campaign,\x20%s,\x20%s',_0x46ac1b,_0x1ea2bf[_0x198e('0x10')]['message']);return _0x5ba06f(_0x1ea2bf['error']['message']);}logger['error'](_0x198e('0xc'),_0x46ac1b,_0x1ea2bf[_0x198e('0x10')][_0x198e('0x11')]);return _0x3322c5(_0x1ea2bf['error'][_0x198e('0x11')]);}else{logger[_0x198e('0xb')](_0x198e('0xc'),_0x46ac1b,'request\x20sent');_0x3322c5(_0x1ea2bf['result']['message']);}})['catch'](function(_0x57f15e){logger[_0x198e('0x10')]('Campaign,\x20%s,\x20%s',_0x46ac1b,_0x57f15e);_0x5ba06f(_0x57f15e);});});}exports['GetCampaign']=function(_0x440975){var _0x46c980=this;return new Promise(function(_0x2485ea,_0x4cbf50){return db[_0x198e('0x12')][_0x198e('0x13')]({'raw':_0x440975[_0x198e('0x14')]?_0x440975[_0x198e('0x14')][_0x198e('0x15')]===undefined?!![]:![]:!![],'where':_0x440975['options']?_0x440975[_0x198e('0x14')][_0x198e('0x16')]||null:null,'attributes':_0x440975['options']?_0x440975[_0x198e('0x14')][_0x198e('0x17')]||null:null,'limit':_0x440975[_0x198e('0x14')]?_0x440975[_0x198e('0x14')][_0x198e('0x18')]||null:null,'include':_0x440975[_0x198e('0x14')]?_0x440975['options'][_0x198e('0x19')]?_[_0x198e('0x1a')](_0x440975[_0x198e('0x14')][_0x198e('0x19')],function(_0x17d04d){return{'model':db[_0x17d04d[_0x198e('0x1b')]],'as':_0x17d04d['as'],'attributes':_0x17d04d[_0x198e('0x17')],'include':_0x17d04d['include']?_[_0x198e('0x1a')](_0x17d04d[_0x198e('0x19')],function(_0x1fceba){return{'model':db[_0x1fceba[_0x198e('0x1b')]],'as':_0x1fceba['as'],'attributes':_0x1fceba[_0x198e('0x17')],'include':_0x1fceba[_0x198e('0x19')]?_[_0x198e('0x1a')](_0x1fceba[_0x198e('0x19')],function(_0x66c071){return{'model':db[_0x66c071['model']],'as':_0x66c071['as'],'attributes':_0x66c071['attributes']};}):[]};}):[]};}):[]:[]})[_0x198e('0xa')](function(_0x1a249c){logger['info']('GetCampaign',_0x440975);logger[_0x198e('0xe')](_0x198e('0x1c'),_0x440975,JSON[_0x198e('0x1d')](_0x1a249c));_0x2485ea(_0x1a249c);})['catch'](function(_0x5e657e){logger[_0x198e('0x10')](_0x198e('0x1c'),_0x5e657e[_0x198e('0x11')],_0x440975);_0x4cbf50(_0x46c980[_0x198e('0x10')](0x1f4,_0x5e657e[_0x198e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index cc6bc27..3972e6e 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 _0x43b8=['post','/:id/clone','addLists','addBlackLists','put','/:id','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists'];(function(_0x2164a2,_0x4f1072){var _0x4d2275=function(_0x52968b){while(--_0x52968b){_0x2164a2['push'](_0x2164a2['shift']());}};_0x4d2275(++_0x4f1072);}(_0x43b8,0x1bd));var _0x843b=function(_0x244694,_0x4c866f){_0x244694=_0x244694-0x0;var _0x282042=_0x43b8[_0x244694];return _0x282042;};'use strict';var multer=require(_0x843b('0x0'));var util=require(_0x843b('0x1'));var path=require(_0x843b('0x2'));var timeout=require(_0x843b('0x3'));var express=require(_0x843b('0x4'));var router=express[_0x843b('0x5')]();var fs_extra=require(_0x843b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x843b('0x7'));var config=require(_0x843b('0x8'));var controller=require('./campaign.controller');router[_0x843b('0x9')]('/',auth[_0x843b('0xa')](),controller['index']);router[_0x843b('0x9')]('/:id',auth[_0x843b('0xa')](),controller['show']);router[_0x843b('0x9')](_0x843b('0xb'),auth[_0x843b('0xa')](),controller[_0x843b('0xc')]);router[_0x843b('0x9')](_0x843b('0xd'),auth[_0x843b('0xa')](),controller['getHopperHistories']);router[_0x843b('0x9')]('/:id/hopper_finals',auth[_0x843b('0xa')](),controller[_0x843b('0xe')]);router[_0x843b('0x9')](_0x843b('0xf'),auth[_0x843b('0xa')](),controller[_0x843b('0x10')]);router['get'](_0x843b('0x11'),auth[_0x843b('0xa')](),controller[_0x843b('0x12')]);router[_0x843b('0x9')]('/:id/blacklists',auth[_0x843b('0xa')](),controller[_0x843b('0x13')]);router[_0x843b('0x14')]('/',auth[_0x843b('0xa')](),controller['create']);router['post'](_0x843b('0x15'),auth[_0x843b('0xa')](),controller['clone']);router[_0x843b('0x14')](_0x843b('0x11'),auth['isAuthenticated'](),controller[_0x843b('0x16')]);router[_0x843b('0x14')]('/:id/blacklists',auth[_0x843b('0xa')](),controller[_0x843b('0x17')]);router[_0x843b('0x18')](_0x843b('0x19'),auth[_0x843b('0xa')](),controller['update']);router[_0x843b('0x1a')](_0x843b('0x19'),auth[_0x843b('0xa')](),controller[_0x843b('0x1b')]);router[_0x843b('0x1a')](_0x843b('0x11'),auth[_0x843b('0xa')](),controller[_0x843b('0x1c')]);router[_0x843b('0x1a')]('/:id/blacklists',auth[_0x843b('0xa')](),controller[_0x843b('0x1d')]);module[_0x843b('0x1e')]=router; \ No newline at end of file +var _0x0ca4=['put','update','delete','destroy','removeLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','/:id/blacklists','getBlackLists','create','clone','post','/:id/lists','addLists','addBlackLists'];(function(_0x6237a0,_0x2b681b){var _0x37c8da=function(_0x47eba1){while(--_0x47eba1){_0x6237a0['push'](_0x6237a0['shift']());}};_0x37c8da(++_0x2b681b);}(_0x0ca4,0x15a));var _0x40ca=function(_0x16da80,_0x43672e){_0x16da80=_0x16da80-0x0;var _0x180dbf=_0x0ca4[_0x16da80];return _0x180dbf;};'use strict';var multer=require(_0x40ca('0x0'));var util=require('util');var path=require(_0x40ca('0x1'));var timeout=require(_0x40ca('0x2'));var express=require(_0x40ca('0x3'));var router=express[_0x40ca('0x4')]();var fs_extra=require(_0x40ca('0x5'));var auth=require(_0x40ca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x40ca('0x7'));var controller=require(_0x40ca('0x8'));router[_0x40ca('0x9')]('/',auth[_0x40ca('0xa')](),controller[_0x40ca('0xb')]);router[_0x40ca('0x9')](_0x40ca('0xc'),auth[_0x40ca('0xa')](),controller[_0x40ca('0xd')]);router[_0x40ca('0x9')](_0x40ca('0xe'),auth['isAuthenticated'](),controller[_0x40ca('0xf')]);router[_0x40ca('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x40ca('0x9')](_0x40ca('0x10'),auth[_0x40ca('0xa')](),controller[_0x40ca('0x11')]);router[_0x40ca('0x9')](_0x40ca('0x12'),auth[_0x40ca('0xa')](),controller['getHopperBlacks']);router[_0x40ca('0x9')]('/:id/lists',auth['isAuthenticated'](),controller[_0x40ca('0x13')]);router[_0x40ca('0x9')](_0x40ca('0x14'),auth['isAuthenticated'](),controller[_0x40ca('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x40ca('0x16')]);router['post']('/:id/clone',auth[_0x40ca('0xa')](),controller[_0x40ca('0x17')]);router[_0x40ca('0x18')](_0x40ca('0x19'),auth[_0x40ca('0xa')](),controller[_0x40ca('0x1a')]);router['post'](_0x40ca('0x14'),auth['isAuthenticated'](),controller[_0x40ca('0x1b')]);router[_0x40ca('0x1c')](_0x40ca('0xc'),auth[_0x40ca('0xa')](),controller[_0x40ca('0x1d')]);router[_0x40ca('0x1e')]('/:id',auth[_0x40ca('0xa')](),controller[_0x40ca('0x1f')]);router[_0x40ca('0x1e')](_0x40ca('0x19'),auth[_0x40ca('0xa')](),controller[_0x40ca('0x20')]);router[_0x40ca('0x1e')](_0x40ca('0x14'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x40ca('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index ab9ad60..b53f60b 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 _0x7c79=['TEXT','getDataValue','key','sequelize','exports','STRING'];(function(_0x11f755,_0x5bf90b){var _0x11b47f=function(_0x46efb8){while(--_0x46efb8){_0x11f755['push'](_0x11f755['shift']());}};_0x11b47f(++_0x5bf90b);}(_0x7c79,0x171));var _0x97c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c79[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x97c7('0x0'));module[_0x97c7('0x1')]={'key':{'type':Sequelize[_0x97c7('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x97c7('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x97c7('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x97c7('0x4')](_0x97c7('0x5'));}}}; \ No newline at end of file +var _0xd0d1=['sequelize','STRING','VIRTUAL','getDataValue'];(function(_0x1643cb,_0x8af3cc){var _0x2d1147=function(_0x556e53){while(--_0x556e53){_0x1643cb['push'](_0x1643cb['shift']());}};_0x2d1147(++_0x8af3cc);}(_0xd0d1,0x16c));var _0x1d0d=function(_0xaf7008,_0x5c3cf2){_0xaf7008=_0xaf7008-0x0;var _0x1196bc=_0xd0d1[_0xaf7008];return _0x1196bc;};'use strict';var Sequelize=require(_0x1d0d('0x0'));module['exports']={'key':{'type':Sequelize[_0x1d0d('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x1d0d('0x1')]},'name':{'type':Sequelize[_0x1d0d('0x2')],'get':function(){return this[_0x1d0d('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 3e3fdce..1341021 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 _0xa24a=['undefined','count','Content-Range','apply','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','length','includeAll','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','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','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit'];(function(_0x1c468d,_0x50b31f){var _0x29202e=function(_0x73f11){while(--_0x73f11){_0x1c468d['push'](_0x1c468d['shift']());}};_0x29202e(++_0x50b31f);}(_0xa24a,0x97));var _0xaa24=function(_0x21e6d8,_0xa3aa85){_0x21e6d8=_0x21e6d8-0x0;var _0x42f051=_0xa24a[_0x21e6d8];return _0x42f051;};'use strict';var emlformat=require(_0xaa24('0x0'));var rimraf=require(_0xaa24('0x1'));var zipdir=require(_0xaa24('0x2'));var jsonpatch=require(_0xaa24('0x3'));var rp=require(_0xaa24('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa24('0x5'));var path=require(_0xaa24('0x6'));var sox=require(_0xaa24('0x7'));var csv=require(_0xaa24('0x8'));var ejs=require(_0xaa24('0x9'));var fs=require('fs');var fs_extra=require(_0xaa24('0xa'));var _=require(_0xaa24('0xb'));var squel=require(_0xaa24('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa24('0xd'));var toCsv=require(_0xaa24('0x8'));var querystring=require(_0xaa24('0xe'));var Papa=require(_0xaa24('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa24('0x10'));var hardwareService=require(_0xaa24('0x11'));var logger=require(_0xaa24('0x12'))(_0xaa24('0x13'));var utils=require(_0xaa24('0x14'));var config=require(_0xaa24('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450eaf,_0x4c8919){_0x4c8919=_0x4c8919||0xcc;return function(_0x3bea94){if(_0x3bea94){return _0x450eaf[_0xaa24('0x16')](_0x4c8919);}return _0x450eaf[_0xaa24('0x17')](_0x4c8919)['end']();};}function respondWithResult(_0xd1805c,_0x42959a){_0x42959a=_0x42959a||0xc8;return function(_0x490b00){if(_0x490b00){return _0xd1805c['status'](_0x42959a)[_0xaa24('0x18')](_0x490b00);}};}function respondWithFilteredResult(_0x59d08b,_0x458807){return function(_0x276e8d){if(_0x276e8d){var _0x238b21=typeof _0x458807[_0xaa24('0x19')]==='undefined'&&typeof _0x458807[_0xaa24('0x1a')]===_0xaa24('0x1b');var _0x1ef38e=_0x276e8d[_0xaa24('0x1c')];var _0x597f70=_0x238b21?0x0:_0x458807[_0xaa24('0x19')];var _0x5889cf=_0x238b21?_0x276e8d['count']:_0x458807[_0xaa24('0x19')]+_0x458807['limit'];var _0xf83a55;if(_0x5889cf>=_0x1ef38e){_0x5889cf=_0x1ef38e;_0xf83a55=0xc8;}else{_0xf83a55=0xce;}_0x59d08b[_0xaa24('0x17')](_0xf83a55);return _0x59d08b['set'](_0xaa24('0x1d'),_0x597f70+'-'+_0x5889cf+'/'+_0x1ef38e)[_0xaa24('0x18')](_0x276e8d);}return null;};}function patchUpdates(_0x514817){return function(_0x26972d){try{jsonpatch[_0xaa24('0x1e')](_0x26972d,_0x514817,!![]);}catch(_0x77bbb8){return BPromise[_0xaa24('0x1f')](_0x77bbb8);}return _0x26972d['save']();};}function saveUpdates(_0x57db55,_0x4b9057){return function(_0x12a939){if(_0x12a939){return _0x12a939[_0xaa24('0x20')](_0x57db55)[_0xaa24('0x21')](function(_0x4433ae){return _0x4433ae;});}return null;};}function removeEntity(_0x47bae5,_0x1a9e5d){return function(_0x100c93){if(_0x100c93){return _0x100c93[_0xaa24('0x22')]()[_0xaa24('0x21')](function(){var _0x18c3d9=_0x100c93[_0xaa24('0x23')]({'plain':!![]});var _0x2079e5=_0xaa24('0x24');return db[_0xaa24('0x25')][_0xaa24('0x22')]({'where':{'type':_0x2079e5,'resourceId':_0x18c3d9['id']}})['then'](function(){return _0x100c93;});})[_0xaa24('0x21')](function(){_0x47bae5[_0xaa24('0x17')](0xcc)[_0xaa24('0x26')]();});}};}function handleEntityNotFound(_0x51f933,_0x52318d){return function(_0x1635fa){if(!_0x1635fa){_0x51f933[_0xaa24('0x16')](0x194);}return _0x1635fa;};}function handleError(_0x154aec,_0x389a56){_0x389a56=_0x389a56||0x1f4;return function(_0x49a0d5){logger[_0xaa24('0x27')](_0x49a0d5[_0xaa24('0x28')]);if(_0x49a0d5[_0xaa24('0x29')]){delete _0x49a0d5[_0xaa24('0x29')];}_0x154aec['status'](_0x389a56)[_0xaa24('0x2a')](_0x49a0d5);};}exports[_0xaa24('0x2b')]=function(_0x3db536,_0x532a16){var _0x1a771d={},_0x17a40d={},_0xaecd7a={'count':0x0,'rows':[]};var _0x3da5fe=_['map'](db[_0xaa24('0x2c')][_0xaa24('0x2d')],function(_0x503eed){return{'name':_0x503eed[_0xaa24('0x2e')],'type':_0x503eed[_0xaa24('0x2f')][_0xaa24('0x30')]};});_0x17a40d[_0xaa24('0x31')]=_[_0xaa24('0x32')](_0x3da5fe,_0xaa24('0x29'));_0x17a40d[_0xaa24('0x33')]=_[_0xaa24('0x34')](_0x3db536[_0xaa24('0x33')]);_0x17a40d[_0xaa24('0x35')]=_[_0xaa24('0x36')](_0x17a40d[_0xaa24('0x31')],_0x17a40d[_0xaa24('0x33')]);_0x1a771d[_0xaa24('0x37')]=_[_0xaa24('0x36')](_0x17a40d[_0xaa24('0x31')],qs[_0xaa24('0x38')](_0x3db536[_0xaa24('0x33')]['fields']));_0x1a771d['attributes']=_0x1a771d[_0xaa24('0x37')]['length']?_0x1a771d[_0xaa24('0x37')]:_0x17a40d[_0xaa24('0x31')];if(!_0x3db536['query'][_0xaa24('0x39')](_0xaa24('0x3a'))){_0x1a771d[_0xaa24('0x1a')]=qs[_0xaa24('0x1a')](_0x3db536['query'][_0xaa24('0x1a')]);_0x1a771d[_0xaa24('0x19')]=qs[_0xaa24('0x19')](_0x3db536[_0xaa24('0x33')][_0xaa24('0x19')]);}_0x1a771d['order']=qs[_0xaa24('0x3b')](_0x3db536[_0xaa24('0x33')]['sort']);_0x1a771d[_0xaa24('0x3c')]=qs[_0xaa24('0x35')](_[_0xaa24('0x3d')](_0x3db536[_0xaa24('0x33')],_0x17a40d[_0xaa24('0x35')]),_0x3da5fe);if(_0x3db536[_0xaa24('0x33')][_0xaa24('0x3e')]){_0x1a771d['where']=_[_0xaa24('0x3f')](_0x1a771d[_0xaa24('0x3c')],{'$or':[{'key':{'$like':'%'+_0x3db536[_0xaa24('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0x3db536[_0xaa24('0x33')][_0xaa24('0x3e')]+'%'}}]});}_0x1a771d=_[_0xaa24('0x3f')]({},_0x1a771d,_0x3db536[_0xaa24('0x40')]);var _0x50b83b={'where':_0x1a771d[_0xaa24('0x3c')]};return db['CannedAnswer'][_0xaa24('0x1c')](_0x50b83b)[_0xaa24('0x21')](function(_0x350bc9){_0xaecd7a[_0xaa24('0x1c')]=_0x350bc9;if(_0x3db536[_0xaa24('0x33')]['includeAll']){_0x1a771d[_0xaa24('0x41')]=[{'all':!![]}];}return db[_0xaa24('0x2c')][_0xaa24('0x42')](_0x1a771d);})[_0xaa24('0x21')](function(_0x5479cd){_0xaecd7a[_0xaa24('0x43')]=_0x5479cd;return _0xaecd7a;})[_0xaa24('0x21')](respondWithFilteredResult(_0x532a16,_0x1a771d))[_0xaa24('0x44')](handleError(_0x532a16,null));};exports['show']=function(_0x18ad24,_0x888df3){var _0x44660c={'raw':!![],'where':{'id':_0x18ad24[_0xaa24('0x45')]['id']}},_0x5699e0={};_0x5699e0[_0xaa24('0x31')]=_['keys'](db[_0xaa24('0x2c')][_0xaa24('0x2d')]);_0x5699e0['query']=_['keys'](_0x18ad24[_0xaa24('0x33')]);_0x5699e0[_0xaa24('0x35')]=_[_0xaa24('0x36')](_0x5699e0[_0xaa24('0x31')],_0x5699e0['query']);_0x44660c[_0xaa24('0x37')]=_[_0xaa24('0x36')](_0x5699e0[_0xaa24('0x31')],qs[_0xaa24('0x38')](_0x18ad24[_0xaa24('0x33')][_0xaa24('0x38')]));_0x44660c[_0xaa24('0x37')]=_0x44660c[_0xaa24('0x37')][_0xaa24('0x46')]?_0x44660c[_0xaa24('0x37')]:_0x5699e0[_0xaa24('0x31')];if(_0x18ad24['query'][_0xaa24('0x47')]){_0x44660c[_0xaa24('0x41')]=[{'all':!![]}];}_0x44660c=_[_0xaa24('0x3f')]({},_0x44660c,_0x18ad24[_0xaa24('0x40')]);return db[_0xaa24('0x2c')][_0xaa24('0x48')](_0x44660c)[_0xaa24('0x21')](handleEntityNotFound(_0x888df3,null))[_0xaa24('0x21')](respondWithResult(_0x888df3,null))['catch'](handleError(_0x888df3,null));};exports['update']=function(_0xa96522,_0x4b78fa){if(_0xa96522[_0xaa24('0x49')]['id']){delete _0xa96522['body']['id'];}return db[_0xaa24('0x2c')][_0xaa24('0x48')]({'where':{'id':_0xa96522[_0xaa24('0x45')]['id']}})[_0xaa24('0x21')](handleEntityNotFound(_0x4b78fa,null))[_0xaa24('0x21')](saveUpdates(_0xa96522[_0xaa24('0x49')],null))['then'](respondWithResult(_0x4b78fa,null))[_0xaa24('0x44')](handleError(_0x4b78fa,null));};exports[_0xaa24('0x22')]=function(_0x2d7970,_0xdb43e7){return db[_0xaa24('0x2c')]['find']({'where':{'id':_0x2d7970[_0xaa24('0x45')]['id']}})[_0xaa24('0x21')](handleEntityNotFound(_0xdb43e7,null))[_0xaa24('0x21')](removeEntity(_0xdb43e7,null))['catch'](handleError(_0xdb43e7,null));};exports['create']=function(_0x53ca8c,_0x17299e){var _0x2ba345={'key':_0x53ca8c[_0xaa24('0x49')]['key']};if(_0x53ca8c[_0xaa24('0x49')][_0xaa24('0x4a')]){_0x2ba345[_0xaa24('0x4a')]=_0x53ca8c[_0xaa24('0x49')][_0xaa24('0x4a')];}else if(_0x53ca8c[_0xaa24('0x49')]['SmsAccountId']){_0x2ba345[_0xaa24('0x4b')]=_0x53ca8c['body']['SmsAccountId'];}else if(_0x53ca8c[_0xaa24('0x49')][_0xaa24('0x4c')]){_0x2ba345[_0xaa24('0x4c')]=_0x53ca8c[_0xaa24('0x49')][_0xaa24('0x4c')];}else if(_0x53ca8c[_0xaa24('0x49')][_0xaa24('0x4d')]){_0x2ba345['ChatWebsiteId']=_0x53ca8c[_0xaa24('0x49')][_0xaa24('0x4d')];}return db[_0xaa24('0x2c')]['find']({'where':_0x2ba345})[_0xaa24('0x21')](function(_0x2166d3){if(_0x2166d3){throw new db[(_0xaa24('0x4e'))][(_0xaa24('0x4f'))](_0xaa24('0x50'));}return db[_0xaa24('0x2c')][_0xaa24('0x51')](_0x53ca8c['body']);})[_0xaa24('0x21')](function(_0x5971e6){var _0x5bfc2b=_0x53ca8c[_0xaa24('0x52')][_0xaa24('0x23')]({'plain':!![]});if(!_0x5bfc2b)throw new Error(_0xaa24('0x53'));if(_0x5bfc2b[_0xaa24('0x54')]==='user'){var _0x17f3e2=_0x5971e6['get']({'plain':!![]});return db[_0xaa24('0x55')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x5bfc2b[_0xaa24('0x56')]},'raw':!![]})[_0xaa24('0x21')](function(_0x418a9d){if(_0x418a9d&&_0x418a9d[_0xaa24('0x57')]===0x0){return db[_0xaa24('0x25')][_0xaa24('0x51')]({'name':_0x17f3e2['name'],'resourceId':_0x17f3e2['id'],'type':_0x418a9d[_0xaa24('0x29')],'sectionId':_0x418a9d['id']},{})[_0xaa24('0x21')](function(){return _0x5971e6;});}else{return _0x5971e6;}})[_0xaa24('0x44')](function(_0x1dce7c){logger[_0xaa24('0x27')](_0xaa24('0x58'),_0x1dce7c);throw _0x1dce7c;});}return _0x5971e6;})['then'](respondWithResult(_0x17299e,0xc9))[_0xaa24('0x44')](handleError(_0x17299e,null));}; \ No newline at end of file +var _0x94ff=['stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','update','destroy','then','CannedAnswers','UserProfileResource','end','error'];(function(_0x421376,_0x1b449d){var _0x396d60=function(_0x4c4876){while(--_0x4c4876){_0x421376['push'](_0x421376['shift']());}};_0x396d60(++_0x1b449d);}(_0x94ff,0x186));var _0xf94f=function(_0x15dc77,_0x54d8b8){_0x15dc77=_0x15dc77-0x0;var _0x5e592e=_0x94ff[_0x15dc77];return _0x5e592e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf94f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf94f('0x1'));var moment=require('moment');var BPromise=require(_0xf94f('0x2'));var Mustache=require(_0xf94f('0x3'));var util=require('util');var path=require(_0xf94f('0x4'));var sox=require(_0xf94f('0x5'));var csv=require('to-csv');var ejs=require(_0xf94f('0x6'));var fs=require('fs');var fs_extra=require(_0xf94f('0x7'));var _=require(_0xf94f('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf94f('0x9'));var toCsv=require('to-csv');var querystring=require(_0xf94f('0xa'));var Papa=require(_0xf94f('0xb'));var Redis=require(_0xf94f('0xc'));var authService=require(_0xf94f('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf94f('0xe'))(_0xf94f('0xf'));var utils=require('../../config/utils');var config=require(_0xf94f('0x10'));var licenseUtil=require(_0xf94f('0x11'));var db=require(_0xf94f('0x12'))['db'];function respondWithStatusCode(_0x4c6701,_0x25fc83){_0x25fc83=_0x25fc83||0xcc;return function(_0x16a04e){if(_0x16a04e){return _0x4c6701[_0xf94f('0x13')](_0x25fc83);}return _0x4c6701[_0xf94f('0x14')](_0x25fc83)['end']();};}function respondWithResult(_0x33127e,_0x147d9d){_0x147d9d=_0x147d9d||0xc8;return function(_0x3a8578){if(_0x3a8578){return _0x33127e['status'](_0x147d9d)[_0xf94f('0x15')](_0x3a8578);}};}function respondWithFilteredResult(_0x408815,_0x47070c){return function(_0x5a5d2a){if(_0x5a5d2a){var _0x22c5f5=typeof _0x47070c[_0xf94f('0x16')]===_0xf94f('0x17')&&typeof _0x47070c['limit']===_0xf94f('0x17');var _0x350b17=_0x5a5d2a[_0xf94f('0x18')];var _0x4a8c7b=_0x22c5f5?0x0:_0x47070c[_0xf94f('0x16')];var _0x1747c3=_0x22c5f5?_0x5a5d2a[_0xf94f('0x18')]:_0x47070c[_0xf94f('0x16')]+_0x47070c['limit'];var _0x13145f;if(_0x1747c3>=_0x350b17){_0x1747c3=_0x350b17;_0x13145f=0xc8;}else{_0x13145f=0xce;}_0x408815[_0xf94f('0x14')](_0x13145f);return _0x408815[_0xf94f('0x19')](_0xf94f('0x1a'),_0x4a8c7b+'-'+_0x1747c3+'/'+_0x350b17)[_0xf94f('0x15')](_0x5a5d2a);}return null;};}function patchUpdates(_0x5de797){return function(_0x3acd16){try{jsonpatch['apply'](_0x3acd16,_0x5de797,!![]);}catch(_0x2b65b4){return BPromise[_0xf94f('0x1b')](_0x2b65b4);}return _0x3acd16['save']();};}function saveUpdates(_0x5a6627,_0x3bd161){return function(_0x5e280f){if(_0x5e280f){return _0x5e280f[_0xf94f('0x1c')](_0x5a6627)['then'](function(_0x2f7b5a){return _0x2f7b5a;});}return null;};}function removeEntity(_0x35311b,_0x3c64bc){return function(_0x4f397c){if(_0x4f397c){return _0x4f397c[_0xf94f('0x1d')]()[_0xf94f('0x1e')](function(){var _0x2728de=_0x4f397c['get']({'plain':!![]});var _0x30dcf3=_0xf94f('0x1f');return db[_0xf94f('0x20')]['destroy']({'where':{'type':_0x30dcf3,'resourceId':_0x2728de['id']}})[_0xf94f('0x1e')](function(){return _0x4f397c;});})[_0xf94f('0x1e')](function(){_0x35311b[_0xf94f('0x14')](0xcc)[_0xf94f('0x21')]();});}};}function handleEntityNotFound(_0x17b420,_0x360e4c){return function(_0x4a6d28){if(!_0x4a6d28){_0x17b420[_0xf94f('0x13')](0x194);}return _0x4a6d28;};}function handleError(_0x31a09b,_0xa7f381){_0xa7f381=_0xa7f381||0x1f4;return function(_0xd5d97e){logger[_0xf94f('0x22')](_0xd5d97e[_0xf94f('0x23')]);if(_0xd5d97e[_0xf94f('0x24')]){delete _0xd5d97e[_0xf94f('0x24')];}_0x31a09b[_0xf94f('0x14')](_0xa7f381)[_0xf94f('0x25')](_0xd5d97e);};}exports['index']=function(_0x41dd6d,_0x12aa56){var _0x2e3846={},_0x1e7394={},_0x7b5bd0={'count':0x0,'rows':[]};var _0x176023=_[_0xf94f('0x26')](db[_0xf94f('0x27')][_0xf94f('0x28')],function(_0x375c17){return{'name':_0x375c17[_0xf94f('0x29')],'type':_0x375c17[_0xf94f('0x2a')][_0xf94f('0x2b')]};});_0x1e7394[_0xf94f('0x2c')]=_['map'](_0x176023,_0xf94f('0x24'));_0x1e7394[_0xf94f('0x2d')]=_[_0xf94f('0x2e')](_0x41dd6d['query']);_0x1e7394[_0xf94f('0x2f')]=_['intersection'](_0x1e7394[_0xf94f('0x2c')],_0x1e7394[_0xf94f('0x2d')]);_0x2e3846[_0xf94f('0x30')]=_[_0xf94f('0x31')](_0x1e7394['model'],qs[_0xf94f('0x32')](_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x32')]));_0x2e3846['attributes']=_0x2e3846[_0xf94f('0x30')]['length']?_0x2e3846[_0xf94f('0x30')]:_0x1e7394[_0xf94f('0x2c')];if(!_0x41dd6d['query'][_0xf94f('0x33')](_0xf94f('0x34'))){_0x2e3846[_0xf94f('0x35')]=qs['limit'](_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x35')]);_0x2e3846[_0xf94f('0x16')]=qs[_0xf94f('0x16')](_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x16')]);}_0x2e3846['order']=qs['sort'](_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x36')]);_0x2e3846[_0xf94f('0x37')]=qs['filters'](_[_0xf94f('0x38')](_0x41dd6d[_0xf94f('0x2d')],_0x1e7394[_0xf94f('0x2f')]),_0x176023);if(_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x39')]){_0x2e3846[_0xf94f('0x37')]=_[_0xf94f('0x3a')](_0x2e3846[_0xf94f('0x37')],{'$or':[{'key':{'$like':'%'+_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x39')]+'%'}},{'value':{'$like':'%'+_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x39')]+'%'}}]});}_0x2e3846=_[_0xf94f('0x3a')]({},_0x2e3846,_0x41dd6d[_0xf94f('0x3b')]);var _0x2f444e={'where':_0x2e3846[_0xf94f('0x37')]};return db['CannedAnswer'][_0xf94f('0x18')](_0x2f444e)[_0xf94f('0x1e')](function(_0x1d752f){_0x7b5bd0['count']=_0x1d752f;if(_0x41dd6d[_0xf94f('0x2d')]['includeAll']){_0x2e3846[_0xf94f('0x3c')]=[{'all':!![]}];}return db[_0xf94f('0x27')][_0xf94f('0x3d')](_0x2e3846);})[_0xf94f('0x1e')](function(_0x4adc99){_0x7b5bd0[_0xf94f('0x3e')]=_0x4adc99;return _0x7b5bd0;})[_0xf94f('0x1e')](respondWithFilteredResult(_0x12aa56,_0x2e3846))[_0xf94f('0x3f')](handleError(_0x12aa56,null));};exports[_0xf94f('0x40')]=function(_0x2b4045,_0x365bc7){var _0x1db51c={'raw':!![],'where':{'id':_0x2b4045[_0xf94f('0x41')]['id']}},_0x4356ac={};_0x4356ac[_0xf94f('0x2c')]=_[_0xf94f('0x2e')](db[_0xf94f('0x27')]['rawAttributes']);_0x4356ac['query']=_[_0xf94f('0x2e')](_0x2b4045[_0xf94f('0x2d')]);_0x4356ac[_0xf94f('0x2f')]=_[_0xf94f('0x31')](_0x4356ac[_0xf94f('0x2c')],_0x4356ac[_0xf94f('0x2d')]);_0x1db51c['attributes']=_[_0xf94f('0x31')](_0x4356ac[_0xf94f('0x2c')],qs[_0xf94f('0x32')](_0x2b4045[_0xf94f('0x2d')][_0xf94f('0x32')]));_0x1db51c[_0xf94f('0x30')]=_0x1db51c['attributes'][_0xf94f('0x42')]?_0x1db51c['attributes']:_0x4356ac['model'];if(_0x2b4045[_0xf94f('0x2d')][_0xf94f('0x43')]){_0x1db51c[_0xf94f('0x3c')]=[{'all':!![]}];}_0x1db51c=_[_0xf94f('0x3a')]({},_0x1db51c,_0x2b4045['options']);return db[_0xf94f('0x27')][_0xf94f('0x44')](_0x1db51c)['then'](handleEntityNotFound(_0x365bc7,null))[_0xf94f('0x1e')](respondWithResult(_0x365bc7,null))['catch'](handleError(_0x365bc7,null));};exports['update']=function(_0xad7f72,_0x1e9d21){if(_0xad7f72[_0xf94f('0x45')]['id']){delete _0xad7f72[_0xf94f('0x45')]['id'];}return db[_0xf94f('0x27')][_0xf94f('0x44')]({'where':{'id':_0xad7f72[_0xf94f('0x41')]['id']}})[_0xf94f('0x1e')](handleEntityNotFound(_0x1e9d21,null))[_0xf94f('0x1e')](saveUpdates(_0xad7f72[_0xf94f('0x45')],null))[_0xf94f('0x1e')](respondWithResult(_0x1e9d21,null))[_0xf94f('0x3f')](handleError(_0x1e9d21,null));};exports[_0xf94f('0x1d')]=function(_0x2c1b68,_0x573317){return db['CannedAnswer'][_0xf94f('0x44')]({'where':{'id':_0x2c1b68[_0xf94f('0x41')]['id']}})[_0xf94f('0x1e')](handleEntityNotFound(_0x573317,null))[_0xf94f('0x1e')](removeEntity(_0x573317,null))[_0xf94f('0x3f')](handleError(_0x573317,null));};exports[_0xf94f('0x46')]=function(_0x14dafe,_0x60a43){var _0x1bb64b={'key':_0x14dafe[_0xf94f('0x45')][_0xf94f('0x2b')]};if(_0x14dafe['body'][_0xf94f('0x47')]){_0x1bb64b[_0xf94f('0x47')]=_0x14dafe[_0xf94f('0x45')][_0xf94f('0x47')];}else if(_0x14dafe[_0xf94f('0x45')][_0xf94f('0x48')]){_0x1bb64b['SmsAccountId']=_0x14dafe[_0xf94f('0x45')][_0xf94f('0x48')];}else if(_0x14dafe[_0xf94f('0x45')][_0xf94f('0x49')]){_0x1bb64b['OpenchannelAccountId']=_0x14dafe['body'][_0xf94f('0x49')];}else if(_0x14dafe[_0xf94f('0x45')][_0xf94f('0x4a')]){_0x1bb64b[_0xf94f('0x4a')]=_0x14dafe[_0xf94f('0x45')]['ChatWebsiteId'];}return db[_0xf94f('0x27')]['find']({'where':_0x1bb64b})[_0xf94f('0x1e')](function(_0x39f303){if(_0x39f303){throw new db[(_0xf94f('0x4b'))][(_0xf94f('0x4c'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xf94f('0x27')][_0xf94f('0x46')](_0x14dafe[_0xf94f('0x45')]);})[_0xf94f('0x1e')](function(_0x3c7b19){var _0x203ef6=_0x14dafe[_0xf94f('0x4d')][_0xf94f('0x4e')]({'plain':!![]});if(!_0x203ef6)throw new Error(_0xf94f('0x4f'));if(_0x203ef6[_0xf94f('0x50')]===_0xf94f('0x4d')){var _0x4297d3=_0x3c7b19[_0xf94f('0x4e')]({'plain':!![]});return db[_0xf94f('0x51')]['find']({'where':{'name':_0xf94f('0x1f'),'userProfileId':_0x203ef6[_0xf94f('0x52')]},'raw':!![]})[_0xf94f('0x1e')](function(_0x1e7052){if(_0x1e7052&&_0x1e7052[_0xf94f('0x53')]===0x0){return db[_0xf94f('0x20')]['create']({'name':_0x4297d3[_0xf94f('0x24')],'resourceId':_0x4297d3['id'],'type':_0x1e7052[_0xf94f('0x24')],'sectionId':_0x1e7052['id']},{})[_0xf94f('0x1e')](function(){return _0x3c7b19;});}else{return _0x3c7b19;}})[_0xf94f('0x3f')](function(_0x1d39a2){logger['error'](_0xf94f('0x54'),_0x1d39a2);throw _0x1d39a2;});}return _0x3c7b19;})['then'](respondWithResult(_0x60a43,0xc9))['catch'](handleError(_0x60a43,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 41405f7..2ebf64f 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 _0x43b7=['request-promise','path','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x4dffc2,_0x498606){var _0x25af99=function(_0x984268){while(--_0x984268){_0x4dffc2['push'](_0x4dffc2['shift']());}};_0x25af99(++_0x498606);}(_0x43b7,0xa3));var _0x743b=function(_0x1eaade,_0xdc34){_0x1eaade=_0x1eaade-0x0;var _0x557821=_0x43b7[_0x1eaade];return _0x557821;};'use strict';var _=require(_0x743b('0x0'));var util=require(_0x743b('0x1'));var logger=require(_0x743b('0x2'))(_0x743b('0x3'));var moment=require('moment');var BPromise=require(_0x743b('0x4'));var rp=require(_0x743b('0x5'));var fs=require('fs');var path=require(_0x743b('0x6'));var rimraf=require('rimraf');var config=require(_0x743b('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x743b('0x8')]=function(_0x3de02b,_0x12d0f4){return _0x3de02b['define'](_0x743b('0x9'),attributes,{'tableName':_0x743b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x743b('0xb')});}; \ No newline at end of file +var _0x694d=['define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports'];(function(_0x1f4b18,_0x4e777c){var _0xde3957=function(_0x1dcbbc){while(--_0x1dcbbc){_0x1f4b18['push'](_0x1f4b18['shift']());}};_0xde3957(++_0x4e777c);}(_0x694d,0x16c));var _0xd694=function(_0x4565a6,_0x5ada44){_0x4565a6=_0x4565a6-0x0;var _0x2010f8=_0x694d[_0x4565a6];return _0x2010f8;};'use strict';var _=require(_0xd694('0x0'));var util=require(_0xd694('0x1'));var logger=require(_0xd694('0x2'))(_0xd694('0x3'));var moment=require('moment');var BPromise=require(_0xd694('0x4'));var rp=require(_0xd694('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd694('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0xd694('0x7')]=function(_0x3e04f6,_0x8130f){return _0x3e04f6[_0xd694('0x8')](_0xd694('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd694('0xa'),'collate':_0xd694('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 579900a..2a25209 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(_0x464c85,_0x3b2237){var _0x4ee07c=function(_0x1371ef){while(--_0x1371ef){_0x464c85['push'](_0x464c85['shift']());}};_0x4ee07c(++_0x3b2237);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x348e63,_0x567959){var _0x17680c=function(_0x9d67c2){while(--_0x9d67c2){_0x348e63['push'](_0x348e63['shift']());}};_0x17680c(++_0x567959);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 1ca02da..9e6acdc 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 _0x8baa=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','multer','util','path'];(function(_0x41e4eb,_0x58029b){var _0x3d54b3=function(_0x54f1ff){while(--_0x54f1ff){_0x41e4eb['push'](_0x41e4eb['shift']());}};_0x3d54b3(++_0x58029b);}(_0x8baa,0x11d));var _0xa8ba=function(_0x5b1a0a,_0x1540a9){_0x5b1a0a=_0x5b1a0a-0x0;var _0x5b9b87=_0x8baa[_0x5b1a0a];return _0x5b9b87;};'use strict';var multer=require(_0xa8ba('0x0'));var util=require(_0xa8ba('0x1'));var path=require(_0xa8ba('0x2'));var timeout=require(_0xa8ba('0x3'));var express=require(_0xa8ba('0x4'));var router=express['Router']();var fs_extra=require(_0xa8ba('0x5'));var auth=require(_0xa8ba('0x6'));var interaction=require(_0xa8ba('0x7'));var config=require(_0xa8ba('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xa8ba('0x9')](),controller['index']);router[_0xa8ba('0xa')](_0xa8ba('0xb'),auth['isAuthenticated'](),controller[_0xa8ba('0xc')]);router[_0xa8ba('0xd')]('/',auth[_0xa8ba('0x9')](),controller['create']);router[_0xa8ba('0xe')](_0xa8ba('0xb'),auth[_0xa8ba('0x9')](),controller[_0xa8ba('0xf')]);router[_0xa8ba('0x10')]('/:id',auth[_0xa8ba('0x9')](),controller[_0xa8ba('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9fe8=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports'];(function(_0x58cf07,_0x2e3858){var _0x42afe0=function(_0x3c71ff){while(--_0x3c71ff){_0x58cf07['push'](_0x58cf07['shift']());}};_0x42afe0(++_0x2e3858);}(_0x9fe8,0x19e));var _0x89fe=function(_0x130df6,_0x12ad73){_0x130df6=_0x130df6-0x0;var _0x82df5f=_0x9fe8[_0x130df6];return _0x82df5f;};'use strict';var multer=require(_0x89fe('0x0'));var util=require(_0x89fe('0x1'));var path=require(_0x89fe('0x2'));var timeout=require(_0x89fe('0x3'));var express=require('express');var router=express[_0x89fe('0x4')]();var fs_extra=require(_0x89fe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x89fe('0x6'));var config=require(_0x89fe('0x7'));var controller=require('./cannedAnswer.controller');router[_0x89fe('0x8')]('/',auth[_0x89fe('0x9')](),controller[_0x89fe('0xa')]);router[_0x89fe('0x8')](_0x89fe('0xb'),auth['isAuthenticated'](),controller[_0x89fe('0xc')]);router['post']('/',auth[_0x89fe('0x9')](),controller[_0x89fe('0xd')]);router[_0x89fe('0xe')]('/:id',auth[_0x89fe('0x9')](),controller['update']);router[_0x89fe('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x89fe('0x10')]);module[_0x89fe('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 32b5529..7051c48 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 _0x6002=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x6002,0x103));var _0x2600=function(_0x30f2fd,_0x1207b4){_0x30f2fd=_0x30f2fd-0x0;var _0x42adbc=_0x6002[_0x30f2fd];return _0x42adbc;};'use strict';var Sequelize=require(_0x2600('0x0'));module[_0x2600('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x2600('0x2')},'clid':{'type':Sequelize[_0x2600('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x2600('0x3')]},'dcontext':{'type':Sequelize[_0x2600('0x3')]},'channel':{'type':Sequelize[_0x2600('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x2600('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2600('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x2600('0x3')]},'sequence':{'type':Sequelize[_0x2600('0x3')]},'peeraccount':{'type':Sequelize[_0x2600('0x3')]},'type':{'type':Sequelize[_0x2600('0x3')]},'tag':{'type':Sequelize[_0x2600('0x3')]}}; \ No newline at end of file +var _0x5081=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x101134,_0x1ed1d3){var _0xc47acc=function(_0x7ea469){while(--_0x7ea469){_0x101134['push'](_0x101134['shift']());}};_0xc47acc(++_0x1ed1d3);}(_0x5081,0x148));var _0x1508=function(_0x2a287a,_0x3cfd27){_0x2a287a=_0x2a287a-0x0;var _0x57f271=_0x5081[_0x2a287a];return _0x57f271;};'use strict';var Sequelize=require(_0x1508('0x0'));module[_0x1508('0x1')]={'calldate':{'type':Sequelize[_0x1508('0x2')],'allowNull':![],'defaultValue':_0x1508('0x3')},'clid':{'type':Sequelize[_0x1508('0x4')]},'src':{'type':Sequelize[_0x1508('0x4')]},'dst':{'type':Sequelize[_0x1508('0x4')]},'dcontext':{'type':Sequelize[_0x1508('0x4')]},'channel':{'type':Sequelize[_0x1508('0x4')]},'dstchannel':{'type':Sequelize[_0x1508('0x4')]},'lastapp':{'type':Sequelize[_0x1508('0x4')]},'lastdata':{'type':Sequelize[_0x1508('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1508('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x1508('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1508('0x4')]},'userfield':{'type':Sequelize[_0x1508('0x4')]},'uniqueid':{'type':Sequelize[_0x1508('0x4')]},'linkedid':{'type':Sequelize[_0x1508('0x4')]},'sequence':{'type':Sequelize[_0x1508('0x4')]},'peeraccount':{'type':Sequelize[_0x1508('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 73bedd5..07ed04a 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 _0xf767=['apply','save','then','error','stack','name','map','Cdr','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','merge','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','count','limit','status','set','json'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xf767,0x76));var _0x7f76=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0xf767[_0x1b2422];return _0x376573;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f76('0x0'));var zipdir=require(_0x7f76('0x1'));var jsonpatch=require(_0x7f76('0x2'));var rp=require(_0x7f76('0x3'));var moment=require(_0x7f76('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f76('0x5'));var util=require(_0x7f76('0x6'));var path=require(_0x7f76('0x7'));var sox=require(_0x7f76('0x8'));var csv=require('to-csv');var ejs=require(_0x7f76('0x9'));var fs=require('fs');var fs_extra=require(_0x7f76('0xa'));var _=require(_0x7f76('0xb'));var squel=require(_0x7f76('0xc'));var crypto=require(_0x7f76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f76('0xe'));var toCsv=require(_0x7f76('0xf'));var querystring=require(_0x7f76('0x10'));var Papa=require(_0x7f76('0x11'));var Redis=require('ioredis');var authService=require(_0x7f76('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f76('0x13'));var hardwareService=require(_0x7f76('0x14'));var logger=require(_0x7f76('0x15'))(_0x7f76('0x16'));var utils=require(_0x7f76('0x17'));var config=require(_0x7f76('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f76('0x19'))['db'];function respondWithStatusCode(_0x2cd1b3,_0x47403b){_0x47403b=_0x47403b||0xcc;return function(_0x32392b){if(_0x32392b){return _0x2cd1b3[_0x7f76('0x1a')](_0x47403b);}return _0x2cd1b3['status'](_0x47403b)[_0x7f76('0x1b')]();};}function respondWithResult(_0x4d8de0,_0x42a9d3){_0x42a9d3=_0x42a9d3||0xc8;return function(_0x256f79){if(_0x256f79){return _0x4d8de0['status'](_0x42a9d3)['json'](_0x256f79);}};}function respondWithFilteredResult(_0x58d2f3,_0xe81aa9){return function(_0x2df2db){if(_0x2df2db){var _0x286e96=typeof _0xe81aa9['offset']===_0x7f76('0x1c')&&typeof _0xe81aa9['limit']===_0x7f76('0x1c');var _0x3ceb6a=_0x2df2db[_0x7f76('0x1d')];var _0x4802ff=_0x286e96?0x0:_0xe81aa9['offset'];var _0x494537=_0x286e96?_0x2df2db['count']:_0xe81aa9['offset']+_0xe81aa9[_0x7f76('0x1e')];var _0xdb1407;if(_0x494537>=_0x3ceb6a){_0x494537=_0x3ceb6a;_0xdb1407=0xc8;}else{_0xdb1407=0xce;}_0x58d2f3[_0x7f76('0x1f')](_0xdb1407);return _0x58d2f3[_0x7f76('0x20')]('Content-Range',_0x4802ff+'-'+_0x494537+'/'+_0x3ceb6a)[_0x7f76('0x21')](_0x2df2db);}return null;};}function patchUpdates(_0x557c0f){return function(_0x38c4d6){try{jsonpatch[_0x7f76('0x22')](_0x38c4d6,_0x557c0f,!![]);}catch(_0x5a28b0){return BPromise['reject'](_0x5a28b0);}return _0x38c4d6[_0x7f76('0x23')]();};}function saveUpdates(_0xb647d8,_0x5efed5){return function(_0x3f2536){if(_0x3f2536){return _0x3f2536['update'](_0xb647d8)[_0x7f76('0x24')](function(_0x333056){return _0x333056;});}return null;};}function removeEntity(_0x31993d,_0x3deb00){return function(_0x3eea75){if(_0x3eea75){return _0x3eea75['destroy']()[_0x7f76('0x24')](function(){_0x31993d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197519,_0x45f1c9){return function(_0x3492f4){if(!_0x3492f4){_0x197519['sendStatus'](0x194);}return _0x3492f4;};}function handleError(_0xbe6ac1,_0x1347bf){_0x1347bf=_0x1347bf||0x1f4;return function(_0x3e624d){logger[_0x7f76('0x25')](_0x3e624d[_0x7f76('0x26')]);if(_0x3e624d['name']){delete _0x3e624d[_0x7f76('0x27')];}_0xbe6ac1[_0x7f76('0x1f')](_0x1347bf)['send'](_0x3e624d);};}exports['index']=function(_0xe459de,_0x58829a){var _0x1dd664={},_0x3542e3={},_0xd5ba7={'count':0x0,'rows':[]};var _0x393bdd=_[_0x7f76('0x28')](db[_0x7f76('0x29')]['rawAttributes'],function(_0x3570ec){return{'name':_0x3570ec[_0x7f76('0x2a')],'type':_0x3570ec[_0x7f76('0x2b')][_0x7f76('0x2c')]};});_0x3542e3['model']=_[_0x7f76('0x28')](_0x393bdd,_0x7f76('0x27'));_0x3542e3[_0x7f76('0x2d')]=_['keys'](_0xe459de[_0x7f76('0x2d')]);_0x3542e3[_0x7f76('0x2e')]=_[_0x7f76('0x2f')](_0x3542e3[_0x7f76('0x30')],_0x3542e3[_0x7f76('0x2d')]);_0x1dd664[_0x7f76('0x31')]=_[_0x7f76('0x2f')](_0x3542e3[_0x7f76('0x30')],qs[_0x7f76('0x32')](_0xe459de[_0x7f76('0x2d')][_0x7f76('0x32')]));_0x1dd664[_0x7f76('0x31')]=_0x1dd664[_0x7f76('0x31')]['length']?_0x1dd664[_0x7f76('0x31')]:_0x3542e3[_0x7f76('0x30')];if(!_0xe459de[_0x7f76('0x2d')][_0x7f76('0x33')](_0x7f76('0x34'))){_0x1dd664[_0x7f76('0x1e')]=qs[_0x7f76('0x1e')](_0xe459de[_0x7f76('0x2d')]['limit']);_0x1dd664[_0x7f76('0x35')]=qs['offset'](_0xe459de['query'][_0x7f76('0x35')]);}_0x1dd664['order']=qs[_0x7f76('0x36')](_0xe459de[_0x7f76('0x2d')]['sort']);_0x1dd664[_0x7f76('0x37')]=qs['filters'](_['pick'](_0xe459de[_0x7f76('0x2d')],_0x3542e3[_0x7f76('0x2e')]),_0x393bdd);if(_0xe459de[_0x7f76('0x2d')][_0x7f76('0x38')]){_0x1dd664[_0x7f76('0x37')]=_['merge'](_0x1dd664[_0x7f76('0x37')],{'$or':_[_0x7f76('0x28')](_0x393bdd,function(_0x4edf74){if(_0x4edf74['type']!==_0x7f76('0x39')){var _0x4ea167={};_0x4ea167[_0x4edf74[_0x7f76('0x27')]]={'$like':'%'+_0xe459de[_0x7f76('0x2d')][_0x7f76('0x38')]+'%'};return _0x4ea167;}})});}_0x1dd664=_['merge']({},_0x1dd664,_0xe459de[_0x7f76('0x3a')]);var _0x26b537={'where':_0x1dd664[_0x7f76('0x37')]};return db[_0x7f76('0x29')][_0x7f76('0x1d')](_0x26b537)[_0x7f76('0x24')](function(_0x58649f){_0xd5ba7['count']=_0x58649f;if(_0xe459de[_0x7f76('0x2d')][_0x7f76('0x3b')]){_0x1dd664[_0x7f76('0x3c')]=[{'all':!![]}];}return db[_0x7f76('0x29')][_0x7f76('0x3d')](_0x1dd664);})[_0x7f76('0x24')](function(_0x401284){_0xd5ba7[_0x7f76('0x3e')]=_0x401284;return _0xd5ba7;})[_0x7f76('0x24')](respondWithFilteredResult(_0x58829a,_0x1dd664))[_0x7f76('0x3f')](handleError(_0x58829a,null));};exports[_0x7f76('0x40')]=function(_0x313d37,_0x3229b9){var _0x391d04={'raw':!![],'where':{'id':_0x313d37[_0x7f76('0x41')]['id']}},_0x2a43f1={};_0x2a43f1[_0x7f76('0x30')]=_[_0x7f76('0x42')](db['Cdr'][_0x7f76('0x43')]);_0x2a43f1[_0x7f76('0x2d')]=_[_0x7f76('0x42')](_0x313d37['query']);_0x2a43f1['filters']=_[_0x7f76('0x2f')](_0x2a43f1['model'],_0x2a43f1[_0x7f76('0x2d')]);_0x391d04['attributes']=_['intersection'](_0x2a43f1[_0x7f76('0x30')],qs[_0x7f76('0x32')](_0x313d37[_0x7f76('0x2d')][_0x7f76('0x32')]));_0x391d04[_0x7f76('0x31')]=_0x391d04[_0x7f76('0x31')][_0x7f76('0x44')]?_0x391d04[_0x7f76('0x31')]:_0x2a43f1[_0x7f76('0x30')];if(_0x313d37[_0x7f76('0x2d')][_0x7f76('0x3b')]){_0x391d04[_0x7f76('0x3c')]=[{'all':!![]}];}_0x391d04=_[_0x7f76('0x45')]({},_0x391d04,_0x313d37[_0x7f76('0x3a')]);return db['Cdr'][_0x7f76('0x46')](_0x391d04)['then'](handleEntityNotFound(_0x3229b9,null))[_0x7f76('0x24')](respondWithResult(_0x3229b9,null))[_0x7f76('0x3f')](handleError(_0x3229b9,null));};exports[_0x7f76('0x47')]=function(_0x39bbef,_0x487b1f){return db[_0x7f76('0x29')][_0x7f76('0x47')](_0x39bbef[_0x7f76('0x48')],{})[_0x7f76('0x24')](respondWithResult(_0x487b1f,0xc9))['catch'](handleError(_0x487b1f,null));};exports[_0x7f76('0x49')]=function(_0xd87fe7,_0x53f77a){if(_0xd87fe7[_0x7f76('0x48')]['id']){delete _0xd87fe7[_0x7f76('0x48')]['id'];}return db[_0x7f76('0x29')]['find']({'where':{'id':_0xd87fe7[_0x7f76('0x41')]['id']}})[_0x7f76('0x24')](handleEntityNotFound(_0x53f77a,null))[_0x7f76('0x24')](saveUpdates(_0xd87fe7[_0x7f76('0x48')],null))[_0x7f76('0x24')](respondWithResult(_0x53f77a,null))[_0x7f76('0x3f')](handleError(_0x53f77a,null));};exports[_0x7f76('0x4a')]=function(_0x42abd9,_0x1a4d3c){return db[_0x7f76('0x29')][_0x7f76('0x46')]({'where':{'id':_0x42abd9[_0x7f76('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a4d3c,null))[_0x7f76('0x24')](removeEntity(_0x1a4d3c,null))['catch'](handleError(_0x1a4d3c,null));};exports[_0x7f76('0x4b')]=function(_0x3bcd59,_0x171c71){return db['Cdr'][_0x7f76('0x4b')]()[_0x7f76('0x24')](respondWithResult(_0x171c71,null))['catch'](handleError(_0x171c71,null));}; \ No newline at end of file +var _0xa990=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','json','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x206f4b,_0x346117){var _0x20599c=function(_0x2f15b3){while(--_0x2f15b3){_0x206f4b['push'](_0x206f4b['shift']());}};_0x20599c(++_0x346117);}(_0xa990,0xc9));var _0x0a99=function(_0x3f1ca5,_0x4c9c36){_0x3f1ca5=_0x3f1ca5-0x0;var _0x193ab3=_0xa990[_0x3f1ca5];return _0x193ab3;};'use strict';var emlformat=require(_0x0a99('0x0'));var rimraf=require(_0x0a99('0x1'));var zipdir=require(_0x0a99('0x2'));var jsonpatch=require(_0x0a99('0x3'));var rp=require(_0x0a99('0x4'));var moment=require(_0x0a99('0x5'));var BPromise=require(_0x0a99('0x6'));var Mustache=require(_0x0a99('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0a99('0x8'));var csv=require(_0x0a99('0x9'));var ejs=require(_0x0a99('0xa'));var fs=require('fs');var fs_extra=require(_0x0a99('0xb'));var _=require(_0x0a99('0xc'));var squel=require(_0x0a99('0xd'));var crypto=require(_0x0a99('0xe'));var jsforce=require(_0x0a99('0xf'));var deskjs=require(_0x0a99('0x10'));var toCsv=require(_0x0a99('0x9'));var querystring=require(_0x0a99('0x11'));var Papa=require('papaparse');var Redis=require(_0x0a99('0x12'));var authService=require(_0x0a99('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a99('0x14'));var logger=require(_0x0a99('0x15'))(_0x0a99('0x16'));var utils=require(_0x0a99('0x17'));var config=require(_0x0a99('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a99('0x19'))['db'];function respondWithStatusCode(_0x3aaaad,_0x57ab88){_0x57ab88=_0x57ab88||0xcc;return function(_0xb6a34d){if(_0xb6a34d){return _0x3aaaad[_0x0a99('0x1a')](_0x57ab88);}return _0x3aaaad[_0x0a99('0x1b')](_0x57ab88)[_0x0a99('0x1c')]();};}function respondWithResult(_0x346061,_0x23d018){_0x23d018=_0x23d018||0xc8;return function(_0x18c124){if(_0x18c124){return _0x346061[_0x0a99('0x1b')](_0x23d018)['json'](_0x18c124);}};}function respondWithFilteredResult(_0x5a17e1,_0x2c40db){return function(_0x3ac17e){if(_0x3ac17e){var _0xb7356c=typeof _0x2c40db['offset']===_0x0a99('0x1d')&&typeof _0x2c40db['limit']==='undefined';var _0x20104c=_0x3ac17e[_0x0a99('0x1e')];var _0x3de006=_0xb7356c?0x0:_0x2c40db[_0x0a99('0x1f')];var _0x572ce5=_0xb7356c?_0x3ac17e['count']:_0x2c40db[_0x0a99('0x1f')]+_0x2c40db[_0x0a99('0x20')];var _0xbe23f3;if(_0x572ce5>=_0x20104c){_0x572ce5=_0x20104c;_0xbe23f3=0xc8;}else{_0xbe23f3=0xce;}_0x5a17e1[_0x0a99('0x1b')](_0xbe23f3);return _0x5a17e1['set']('Content-Range',_0x3de006+'-'+_0x572ce5+'/'+_0x20104c)[_0x0a99('0x21')](_0x3ac17e);}return null;};}function patchUpdates(_0x4d0c78){return function(_0x1e8d30){try{jsonpatch['apply'](_0x1e8d30,_0x4d0c78,!![]);}catch(_0x191ee4){return BPromise['reject'](_0x191ee4);}return _0x1e8d30[_0x0a99('0x22')]();};}function saveUpdates(_0x356681,_0x3b1d60){return function(_0x1c1e5c){if(_0x1c1e5c){return _0x1c1e5c[_0x0a99('0x23')](_0x356681)[_0x0a99('0x24')](function(_0x19c870){return _0x19c870;});}return null;};}function removeEntity(_0x1d803c,_0x398dd2){return function(_0x5745ca){if(_0x5745ca){return _0x5745ca['destroy']()[_0x0a99('0x24')](function(){_0x1d803c[_0x0a99('0x1b')](0xcc)[_0x0a99('0x1c')]();});}};}function handleEntityNotFound(_0x518617,_0x5d917c){return function(_0x371b31){if(!_0x371b31){_0x518617[_0x0a99('0x1a')](0x194);}return _0x371b31;};}function handleError(_0x1b0e94,_0x40e765){_0x40e765=_0x40e765||0x1f4;return function(_0x10e70f){logger[_0x0a99('0x25')](_0x10e70f[_0x0a99('0x26')]);if(_0x10e70f[_0x0a99('0x27')]){delete _0x10e70f[_0x0a99('0x27')];}_0x1b0e94['status'](_0x40e765)[_0x0a99('0x28')](_0x10e70f);};}exports['index']=function(_0x47bc34,_0x4e597b){var _0x223bdb={},_0x379c7e={},_0x13d26a={'count':0x0,'rows':[]};var _0x26c0c0=_[_0x0a99('0x29')](db[_0x0a99('0x2a')][_0x0a99('0x2b')],function(_0x47da33){return{'name':_0x47da33[_0x0a99('0x2c')],'type':_0x47da33[_0x0a99('0x2d')][_0x0a99('0x2e')]};});_0x379c7e[_0x0a99('0x2f')]=_['map'](_0x26c0c0,'name');_0x379c7e['query']=_[_0x0a99('0x30')](_0x47bc34[_0x0a99('0x31')]);_0x379c7e[_0x0a99('0x32')]=_['intersection'](_0x379c7e[_0x0a99('0x2f')],_0x379c7e[_0x0a99('0x31')]);_0x223bdb[_0x0a99('0x33')]=_[_0x0a99('0x34')](_0x379c7e[_0x0a99('0x2f')],qs[_0x0a99('0x35')](_0x47bc34[_0x0a99('0x31')]['fields']));_0x223bdb[_0x0a99('0x33')]=_0x223bdb[_0x0a99('0x33')][_0x0a99('0x36')]?_0x223bdb[_0x0a99('0x33')]:_0x379c7e[_0x0a99('0x2f')];if(!_0x47bc34['query'][_0x0a99('0x37')]('nolimit')){_0x223bdb['limit']=qs['limit'](_0x47bc34['query'][_0x0a99('0x20')]);_0x223bdb['offset']=qs[_0x0a99('0x1f')](_0x47bc34[_0x0a99('0x31')][_0x0a99('0x1f')]);}_0x223bdb[_0x0a99('0x38')]=qs[_0x0a99('0x39')](_0x47bc34[_0x0a99('0x31')][_0x0a99('0x39')]);_0x223bdb[_0x0a99('0x3a')]=qs[_0x0a99('0x32')](_[_0x0a99('0x3b')](_0x47bc34[_0x0a99('0x31')],_0x379c7e[_0x0a99('0x32')]),_0x26c0c0);if(_0x47bc34[_0x0a99('0x31')]['filter']){_0x223bdb[_0x0a99('0x3a')]=_[_0x0a99('0x3c')](_0x223bdb['where'],{'$or':_[_0x0a99('0x29')](_0x26c0c0,function(_0x549bb9){if(_0x549bb9[_0x0a99('0x2d')]!=='VIRTUAL'){var _0x541178={};_0x541178[_0x549bb9[_0x0a99('0x27')]]={'$like':'%'+_0x47bc34[_0x0a99('0x31')][_0x0a99('0x3d')]+'%'};return _0x541178;}})});}_0x223bdb=_['merge']({},_0x223bdb,_0x47bc34[_0x0a99('0x3e')]);var _0x11e046={'where':_0x223bdb[_0x0a99('0x3a')]};return db['Cdr'][_0x0a99('0x1e')](_0x11e046)[_0x0a99('0x24')](function(_0x23e4b9){_0x13d26a[_0x0a99('0x1e')]=_0x23e4b9;if(_0x47bc34['query'][_0x0a99('0x3f')]){_0x223bdb['include']=[{'all':!![]}];}return db['Cdr'][_0x0a99('0x40')](_0x223bdb);})['then'](function(_0x185495){_0x13d26a['rows']=_0x185495;return _0x13d26a;})[_0x0a99('0x24')](respondWithFilteredResult(_0x4e597b,_0x223bdb))[_0x0a99('0x41')](handleError(_0x4e597b,null));};exports[_0x0a99('0x42')]=function(_0x29da8a,_0x57b999){var _0xcee64a={'raw':!![],'where':{'id':_0x29da8a[_0x0a99('0x43')]['id']}},_0x97158c={};_0x97158c[_0x0a99('0x2f')]=_['keys'](db['Cdr']['rawAttributes']);_0x97158c[_0x0a99('0x31')]=_['keys'](_0x29da8a[_0x0a99('0x31')]);_0x97158c['filters']=_['intersection'](_0x97158c['model'],_0x97158c['query']);_0xcee64a[_0x0a99('0x33')]=_['intersection'](_0x97158c[_0x0a99('0x2f')],qs[_0x0a99('0x35')](_0x29da8a['query'][_0x0a99('0x35')]));_0xcee64a[_0x0a99('0x33')]=_0xcee64a['attributes'][_0x0a99('0x36')]?_0xcee64a['attributes']:_0x97158c[_0x0a99('0x2f')];if(_0x29da8a[_0x0a99('0x31')]['includeAll']){_0xcee64a[_0x0a99('0x44')]=[{'all':!![]}];}_0xcee64a=_['merge']({},_0xcee64a,_0x29da8a['options']);return db[_0x0a99('0x2a')][_0x0a99('0x45')](_0xcee64a)[_0x0a99('0x24')](handleEntityNotFound(_0x57b999,null))[_0x0a99('0x24')](respondWithResult(_0x57b999,null))[_0x0a99('0x41')](handleError(_0x57b999,null));};exports['create']=function(_0x476207,_0x174298){return db[_0x0a99('0x2a')][_0x0a99('0x46')](_0x476207[_0x0a99('0x47')],{})[_0x0a99('0x24')](respondWithResult(_0x174298,0xc9))[_0x0a99('0x41')](handleError(_0x174298,null));};exports[_0x0a99('0x23')]=function(_0x1cd328,_0x1621d9){if(_0x1cd328['body']['id']){delete _0x1cd328['body']['id'];}return db[_0x0a99('0x2a')][_0x0a99('0x45')]({'where':{'id':_0x1cd328[_0x0a99('0x43')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x1621d9,null))[_0x0a99('0x24')](saveUpdates(_0x1cd328[_0x0a99('0x47')],null))['then'](respondWithResult(_0x1621d9,null))[_0x0a99('0x41')](handleError(_0x1621d9,null));};exports[_0x0a99('0x48')]=function(_0x55fee0,_0x11ed07){return db[_0x0a99('0x2a')]['find']({'where':{'id':_0x55fee0[_0x0a99('0x43')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x11ed07,null))[_0x0a99('0x24')](removeEntity(_0x11ed07,null))[_0x0a99('0x41')](handleError(_0x11ed07,null));};exports[_0x0a99('0x49')]=function(_0x2411ea,_0xbdfb18){return db['Cdr'][_0x0a99('0x49')]()[_0x0a99('0x24')](respondWithResult(_0xbdfb18,null))[_0x0a99('0x41')](handleError(_0xbdfb18,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 60f2668..355e1aa 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(_0x25463d,_0x3f28fb){var _0x21ed76=function(_0x9ae3ce){while(--_0x9ae3ce){_0x25463d['push'](_0x25463d['shift']());}};_0x21ed76(++_0x3f28fb);}(_0x7a54,0x106));var _0x47a5=function(_0x5f546b,_0x594c94){_0x5f546b=_0x5f546b-0x0;var _0x11733d=_0x7a54[_0x5f546b];return _0x11733d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x189599,_0xdd106a){var _0x152ed2=function(_0x330775){while(--_0x330775){_0x189599['push'](_0x189599['shift']());}};_0x152ed2(++_0xdd106a);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 7fdb366..d627620 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 _0xfb10=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','Cdr,\x20%s,\x20%s','result','catch','util'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xfb10,0x1ed));var _0x0fb1=function(_0x405f33,_0x49fa77){_0x405f33=_0x405f33-0x0;var _0x3b9b8d=_0xfb10[_0x405f33];return _0x3b9b8d;};'use strict';var _=require('lodash');var util=require(_0x0fb1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fb1('0x1'));var fs=require('fs');var Redis=require(_0x0fb1('0x2'));var db=require(_0x0fb1('0x3'))['db'];var utils=require(_0x0fb1('0x4'));var logger=require(_0x0fb1('0x5'))('rpc');var config=require(_0x0fb1('0x6'));var jayson=require(_0x0fb1('0x7'));var client=jayson[_0x0fb1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15a2e6,_0x5ddf18,_0x543f20){return new BPromise(function(_0x106ccd,_0x266e7c){return client['request'](_0x15a2e6,_0x543f20)[_0x0fb1('0x9')](function(_0x5d4d21){logger[_0x0fb1('0xa')]('Cdr,\x20%s,\x20%s',_0x5ddf18,'request\x20sent');logger[_0x0fb1('0xb')](_0x0fb1('0xc'),_0x5ddf18,'request\x20sent',JSON[_0x0fb1('0xd')](_0x5d4d21));if(_0x5d4d21[_0x0fb1('0xe')]){if(_0x5d4d21[_0x0fb1('0xe')]['code']===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x5ddf18,_0x5d4d21[_0x0fb1('0xe')][_0x0fb1('0xf')]);return _0x266e7c(_0x5d4d21[_0x0fb1('0xe')][_0x0fb1('0xf')]);}logger[_0x0fb1('0xe')](_0x0fb1('0x10'),_0x5ddf18,_0x5d4d21[_0x0fb1('0xe')][_0x0fb1('0xf')]);return _0x106ccd(_0x5d4d21[_0x0fb1('0xe')][_0x0fb1('0xf')]);}else{logger[_0x0fb1('0xa')](_0x0fb1('0x10'),_0x5ddf18,'request\x20sent');_0x106ccd(_0x5d4d21[_0x0fb1('0x11')][_0x0fb1('0xf')]);}})[_0x0fb1('0x12')](function(_0x465484){logger[_0x0fb1('0xe')](_0x0fb1('0x10'),_0x5ddf18,_0x465484);_0x266e7c(_0x465484);});});} \ No newline at end of file +var _0x97fc=['Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4042de,_0x31c003){var _0x408ce3=function(_0x37647a){while(--_0x37647a){_0x4042de['push'](_0x4042de['shift']());}};_0x408ce3(++_0x31c003);}(_0x97fc,0x193));var _0xc97f=function(_0x2ef83e,_0x3b64b4){_0x2ef83e=_0x2ef83e-0x0;var _0xdc5499=_0x97fc[_0x2ef83e];return _0xdc5499;};'use strict';var _=require(_0xc97f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc97f('0x1'));var rs=require(_0xc97f('0x2'));var fs=require('fs');var Redis=require(_0xc97f('0x3'));var db=require(_0xc97f('0x4'))['db'];var utils=require(_0xc97f('0x5'));var logger=require('../../config/logger')(_0xc97f('0x6'));var config=require('../../config/environment');var jayson=require(_0xc97f('0x7'));var client=jayson[_0xc97f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x475e52,_0x3a280b,_0x481735){return new BPromise(function(_0x3e4e65,_0x1f651e){return client[_0xc97f('0x9')](_0x475e52,_0x481735)[_0xc97f('0xa')](function(_0x5d51b6){logger[_0xc97f('0xb')](_0xc97f('0xc'),_0x3a280b,_0xc97f('0xd'));logger[_0xc97f('0xe')](_0xc97f('0xf'),_0x3a280b,_0xc97f('0xd'),JSON[_0xc97f('0x10')](_0x5d51b6));if(_0x5d51b6[_0xc97f('0x11')]){if(_0x5d51b6[_0xc97f('0x11')][_0xc97f('0x12')]===0x1f4){logger[_0xc97f('0x11')](_0xc97f('0xc'),_0x3a280b,_0x5d51b6[_0xc97f('0x11')][_0xc97f('0x13')]);return _0x1f651e(_0x5d51b6[_0xc97f('0x11')][_0xc97f('0x13')]);}logger['error'](_0xc97f('0xc'),_0x3a280b,_0x5d51b6[_0xc97f('0x11')][_0xc97f('0x13')]);return _0x3e4e65(_0x5d51b6[_0xc97f('0x11')][_0xc97f('0x13')]);}else{logger['info'](_0xc97f('0xc'),_0x3a280b,'request\x20sent');_0x3e4e65(_0x5d51b6[_0xc97f('0x14')]['message']);}})[_0xc97f('0x15')](function(_0x5b0763){logger[_0xc97f('0x11')]('Cdr,\x20%s,\x20%s',_0x3a280b,_0x5b0763);_0x1f651e(_0x5b0763);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 3cd8256..4b0cd35 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0xa06e0b,_0x6c2305){var _0x14142f=function(_0x2ac612){while(--_0x2ac612){_0xa06e0b['push'](_0xa06e0b['shift']());}};_0x14142f(++_0x6c2305);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x555bbd,_0x196748){var _0x3184d7=function(_0x274943){while(--_0x274943){_0x555bbd['push'](_0x555bbd['shift']());}};_0x3184d7(++_0x196748);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 6189207..2ce5dcb 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 _0x00a8=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x00a8,0x6f));var _0x800a=function(_0x411272,_0x5c5851){_0x411272=_0x411272-0x0;var _0x27f560=_0x00a8[_0x411272];return _0x27f560;};'use strict';var Sequelize=require(_0x800a('0x0'));module[_0x800a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x800a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x800a('0x3')]()},'description':{'type':Sequelize[_0x800a('0x2')]},'interval':{'type':Sequelize[_0x800a('0x2')],'defaultValue':_0x800a('0x4')}}; \ No newline at end of file +var _0xfee2=['INTEGER','STRING','TEXT'];(function(_0x4df17c,_0x2d2b61){var _0x4e79b5=function(_0x2134a5){while(--_0x2134a5){_0x4df17c['push'](_0x4df17c['shift']());}};_0x4e79b5(++_0x2d2b61);}(_0xfee2,0x1ec));var _0x2fee=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xfee2[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x2fee('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x2fee('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2fee('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 42b1b80..74b8db8 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 _0xa45c=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','request-promise','bluebird','util'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0xa45c,0x6d));var _0xca45=function(_0x289112,_0x36b9f2){_0x289112=_0x289112-0x0;var _0x19e669=_0xa45c[_0x289112];return _0x19e669;};'use strict';var emlformat=require(_0xca45('0x0'));var rimraf=require(_0xca45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xca45('0x2'));var moment=require('moment');var BPromise=require(_0xca45('0x3'));var Mustache=require('mustache');var util=require(_0xca45('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xca45('0x5'));var ejs=require(_0xca45('0x6'));var fs=require('fs');var fs_extra=require(_0xca45('0x7'));var _=require(_0xca45('0x8'));var squel=require('squel');var crypto=require(_0xca45('0x9'));var jsforce=require(_0xca45('0xa'));var deskjs=require(_0xca45('0xb'));var toCsv=require(_0xca45('0x5'));var querystring=require(_0xca45('0xc'));var Papa=require('papaparse');var Redis=require(_0xca45('0xd'));var authService=require(_0xca45('0xe'));var qs=require(_0xca45('0xf'));var as=require(_0xca45('0x10'));var hardwareService=require(_0xca45('0x11'));var logger=require(_0xca45('0x12'))(_0xca45('0x13'));var utils=require('../../config/utils');var config=require(_0xca45('0x14'));var licenseUtil=require(_0xca45('0x15'));var db=require(_0xca45('0x16'))['db'];function respondWithStatusCode(_0x17ebf7,_0x580c43){_0x580c43=_0x580c43||0xcc;return function(_0x3044b1){if(_0x3044b1){return _0x17ebf7[_0xca45('0x17')](_0x580c43);}return _0x17ebf7[_0xca45('0x18')](_0x580c43)['end']();};}function respondWithResult(_0x214939,_0x569ba6){_0x569ba6=_0x569ba6||0xc8;return function(_0x22ce19){if(_0x22ce19){return _0x214939[_0xca45('0x18')](_0x569ba6)[_0xca45('0x19')](_0x22ce19);}};}function respondWithFilteredResult(_0x1c822d,_0x35b130){return function(_0x323b19){if(_0x323b19){var _0x18dd61=typeof _0x35b130['offset']===_0xca45('0x1a')&&typeof _0x35b130['limit']==='undefined';var _0x213986=_0x323b19[_0xca45('0x1b')];var _0x553af4=_0x18dd61?0x0:_0x35b130[_0xca45('0x1c')];var _0x184bbf=_0x18dd61?_0x323b19['count']:_0x35b130[_0xca45('0x1c')]+_0x35b130[_0xca45('0x1d')];var _0x446243;if(_0x184bbf>=_0x213986){_0x184bbf=_0x213986;_0x446243=0xc8;}else{_0x446243=0xce;}_0x1c822d[_0xca45('0x18')](_0x446243);return _0x1c822d['set'](_0xca45('0x1e'),_0x553af4+'-'+_0x184bbf+'/'+_0x213986)[_0xca45('0x19')](_0x323b19);}return null;};}function patchUpdates(_0x1a16f1){return function(_0xdea7de){try{jsonpatch['apply'](_0xdea7de,_0x1a16f1,!![]);}catch(_0x2c0a39){return BPromise[_0xca45('0x1f')](_0x2c0a39);}return _0xdea7de[_0xca45('0x20')]();};}function saveUpdates(_0x34bb8d,_0x2068df){return function(_0x3e8068){if(_0x3e8068){return _0x3e8068[_0xca45('0x21')](_0x34bb8d)[_0xca45('0x22')](function(_0x14cd25){return _0x14cd25;});}return null;};}function removeEntity(_0x4998b5,_0x3d9007){return function(_0x1acb89){if(_0x1acb89){return _0x1acb89[_0xca45('0x23')]()[_0xca45('0x22')](function(){_0x4998b5[_0xca45('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5927e2,_0x4d4869){return function(_0x28d9f1){if(!_0x28d9f1){_0x5927e2['sendStatus'](0x194);}return _0x28d9f1;};}function handleError(_0x5c36c7,_0x3547cd){_0x3547cd=_0x3547cd||0x1f4;return function(_0x3e3b03){logger[_0xca45('0x24')](_0x3e3b03[_0xca45('0x25')]);if(_0x3e3b03[_0xca45('0x26')]){delete _0x3e3b03['name'];}_0x5c36c7[_0xca45('0x18')](_0x3547cd)[_0xca45('0x27')](_0x3e3b03);};}exports[_0xca45('0x28')]=function(_0x4d546c,_0x4da9b6){var _0x592ad2={'raw':!![],'where':{'id':_0x4d546c[_0xca45('0x29')]['id']}},_0x430591={};_0x430591['model']=_[_0xca45('0x2a')](db[_0xca45('0x2b')][_0xca45('0x2c')]);_0x430591[_0xca45('0x2d')]=_['keys'](_0x4d546c['query']);_0x430591['filters']=_[_0xca45('0x2e')](_0x430591['model'],_0x430591['query']);_0x592ad2['attributes']=_[_0xca45('0x2e')](_0x430591['model'],qs['fields'](_0x4d546c[_0xca45('0x2d')][_0xca45('0x2f')]));_0x592ad2[_0xca45('0x30')]=_0x592ad2['attributes'][_0xca45('0x31')]?_0x592ad2[_0xca45('0x30')]:_0x430591['model'];if(_0x4d546c[_0xca45('0x2d')][_0xca45('0x32')]){_0x592ad2[_0xca45('0x33')]=[{'all':!![]}];}_0x592ad2=_[_0xca45('0x34')]({},_0x592ad2,_0x4d546c[_0xca45('0x35')]);return db[_0xca45('0x2b')][_0xca45('0x36')](_0x592ad2)[_0xca45('0x22')](handleEntityNotFound(_0x4da9b6,null))[_0xca45('0x22')](respondWithResult(_0x4da9b6,null))[_0xca45('0x37')](handleError(_0x4da9b6,null));};exports[_0xca45('0x21')]=function(_0x3045e7,_0x1d594c){if(_0x3045e7['body']['id']){delete _0x3045e7['body']['id'];}return db['ChatApplication'][_0xca45('0x36')]({'where':{'id':_0x3045e7[_0xca45('0x29')]['id']}})['then'](handleEntityNotFound(_0x1d594c,null))['then'](saveUpdates(_0x3045e7[_0xca45('0x38')],null))['then'](respondWithResult(_0x1d594c,null))[_0xca45('0x37')](handleError(_0x1d594c,null));};exports['destroy']=function(_0x4de1d0,_0x231043){return db[_0xca45('0x2b')][_0xca45('0x36')]({'where':{'id':_0x4de1d0[_0xca45('0x29')]['id']}})['then'](handleEntityNotFound(_0x231043,null))[_0xca45('0x22')](removeEntity(_0x231043,null))['catch'](handleError(_0x231043,null));}; \ No newline at end of file +var _0x82b0=['length','attributes','includeAll','merge','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields'];(function(_0x32e2d7,_0x17e17c){var _0x356379=function(_0x2e6e5d){while(--_0x2e6e5d){_0x32e2d7['push'](_0x32e2d7['shift']());}};_0x356379(++_0x17e17c);}(_0x82b0,0x81));var _0x082b=function(_0x7abd7,_0x1ca3f9){_0x7abd7=_0x7abd7-0x0;var _0x3a2577=_0x82b0[_0x7abd7];return _0x3a2577;};'use strict';var emlformat=require(_0x082b('0x0'));var rimraf=require(_0x082b('0x1'));var zipdir=require(_0x082b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x082b('0x3'));var moment=require(_0x082b('0x4'));var BPromise=require(_0x082b('0x5'));var Mustache=require(_0x082b('0x6'));var util=require('util');var path=require(_0x082b('0x7'));var sox=require(_0x082b('0x8'));var csv=require(_0x082b('0x9'));var ejs=require(_0x082b('0xa'));var fs=require('fs');var fs_extra=require(_0x082b('0xb'));var _=require('lodash');var squel=require(_0x082b('0xc'));var crypto=require(_0x082b('0xd'));var jsforce=require(_0x082b('0xe'));var deskjs=require(_0x082b('0xf'));var toCsv=require(_0x082b('0x9'));var querystring=require(_0x082b('0x10'));var Papa=require(_0x082b('0x11'));var Redis=require(_0x082b('0x12'));var authService=require(_0x082b('0x13'));var qs=require(_0x082b('0x14'));var as=require(_0x082b('0x15'));var hardwareService=require(_0x082b('0x16'));var logger=require(_0x082b('0x17'))(_0x082b('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x082b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54bffb,_0x1c1f9d){_0x1c1f9d=_0x1c1f9d||0xcc;return function(_0x324251){if(_0x324251){return _0x54bffb['sendStatus'](_0x1c1f9d);}return _0x54bffb[_0x082b('0x1a')](_0x1c1f9d)[_0x082b('0x1b')]();};}function respondWithResult(_0x27bc44,_0x1f0c32){_0x1f0c32=_0x1f0c32||0xc8;return function(_0x40e206){if(_0x40e206){return _0x27bc44['status'](_0x1f0c32)[_0x082b('0x1c')](_0x40e206);}};}function respondWithFilteredResult(_0x1dc46e,_0x49db08){return function(_0x2c4f86){if(_0x2c4f86){var _0x588d8a=typeof _0x49db08[_0x082b('0x1d')]===_0x082b('0x1e')&&typeof _0x49db08['limit']===_0x082b('0x1e');var _0x4785fb=_0x2c4f86[_0x082b('0x1f')];var _0x3aa0ed=_0x588d8a?0x0:_0x49db08['offset'];var _0x2772e9=_0x588d8a?_0x2c4f86[_0x082b('0x1f')]:_0x49db08[_0x082b('0x1d')]+_0x49db08[_0x082b('0x20')];var _0x1e8fa5;if(_0x2772e9>=_0x4785fb){_0x2772e9=_0x4785fb;_0x1e8fa5=0xc8;}else{_0x1e8fa5=0xce;}_0x1dc46e[_0x082b('0x1a')](_0x1e8fa5);return _0x1dc46e[_0x082b('0x21')](_0x082b('0x22'),_0x3aa0ed+'-'+_0x2772e9+'/'+_0x4785fb)['json'](_0x2c4f86);}return null;};}function patchUpdates(_0x9faf2){return function(_0x2fffc3){try{jsonpatch[_0x082b('0x23')](_0x2fffc3,_0x9faf2,!![]);}catch(_0x5aab0a){return BPromise[_0x082b('0x24')](_0x5aab0a);}return _0x2fffc3[_0x082b('0x25')]();};}function saveUpdates(_0x42c0ab,_0x56fbd2){return function(_0x47c0d9){if(_0x47c0d9){return _0x47c0d9[_0x082b('0x26')](_0x42c0ab)['then'](function(_0x5cb670){return _0x5cb670;});}return null;};}function removeEntity(_0x3ae657,_0xaa7eb){return function(_0x271340){if(_0x271340){return _0x271340[_0x082b('0x27')]()[_0x082b('0x28')](function(){_0x3ae657['status'](0xcc)[_0x082b('0x1b')]();});}};}function handleEntityNotFound(_0x1254fd,_0x40d737){return function(_0x1082bf){if(!_0x1082bf){_0x1254fd[_0x082b('0x29')](0x194);}return _0x1082bf;};}function handleError(_0x8c3c9,_0x1b6dfc){_0x1b6dfc=_0x1b6dfc||0x1f4;return function(_0x4e30e8){logger[_0x082b('0x2a')](_0x4e30e8['stack']);if(_0x4e30e8[_0x082b('0x2b')]){delete _0x4e30e8['name'];}_0x8c3c9[_0x082b('0x1a')](_0x1b6dfc)[_0x082b('0x2c')](_0x4e30e8);};}exports['show']=function(_0x2279d7,_0x4b172b){var _0x228a5a={'raw':!![],'where':{'id':_0x2279d7[_0x082b('0x2d')]['id']}},_0x55d059={};_0x55d059[_0x082b('0x2e')]=_[_0x082b('0x2f')](db[_0x082b('0x30')][_0x082b('0x31')]);_0x55d059[_0x082b('0x32')]=_[_0x082b('0x2f')](_0x2279d7[_0x082b('0x32')]);_0x55d059[_0x082b('0x33')]=_[_0x082b('0x34')](_0x55d059[_0x082b('0x2e')],_0x55d059[_0x082b('0x32')]);_0x228a5a['attributes']=_[_0x082b('0x34')](_0x55d059[_0x082b('0x2e')],qs[_0x082b('0x35')](_0x2279d7[_0x082b('0x32')][_0x082b('0x35')]));_0x228a5a['attributes']=_0x228a5a['attributes'][_0x082b('0x36')]?_0x228a5a[_0x082b('0x37')]:_0x55d059['model'];if(_0x2279d7[_0x082b('0x32')][_0x082b('0x38')]){_0x228a5a['include']=[{'all':!![]}];}_0x228a5a=_[_0x082b('0x39')]({},_0x228a5a,_0x2279d7['options']);return db[_0x082b('0x30')][_0x082b('0x3a')](_0x228a5a)['then'](handleEntityNotFound(_0x4b172b,null))[_0x082b('0x28')](respondWithResult(_0x4b172b,null))[_0x082b('0x3b')](handleError(_0x4b172b,null));};exports[_0x082b('0x26')]=function(_0x16880f,_0x171bd8){if(_0x16880f['body']['id']){delete _0x16880f[_0x082b('0x3c')]['id'];}return db['ChatApplication'][_0x082b('0x3a')]({'where':{'id':_0x16880f[_0x082b('0x2d')]['id']}})[_0x082b('0x28')](handleEntityNotFound(_0x171bd8,null))[_0x082b('0x28')](saveUpdates(_0x16880f[_0x082b('0x3c')],null))[_0x082b('0x28')](respondWithResult(_0x171bd8,null))[_0x082b('0x3b')](handleError(_0x171bd8,null));};exports[_0x082b('0x27')]=function(_0x56f15c,_0x1e4745){return db[_0x082b('0x30')]['find']({'where':{'id':_0x56f15c[_0x082b('0x2d')]['id']}})[_0x082b('0x28')](handleEntityNotFound(_0x1e4745,null))[_0x082b('0x28')](removeEntity(_0x1e4745,null))[_0x082b('0x3b')](handleError(_0x1e4745,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index dd6da38..ed8fa29 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 _0xe7b3=['moment','bluebird','request-promise','rimraf','exports','define','lodash','api'];(function(_0x47872a,_0x2919a9){var _0x1cc71b=function(_0x275781){while(--_0x275781){_0x47872a['push'](_0x47872a['shift']());}};_0x1cc71b(++_0x2919a9);}(_0xe7b3,0x1b6));var _0x3e7b=function(_0x421322,_0x263804){_0x421322=_0x421322-0x0;var _0x48899e=_0xe7b3[_0x421322];return _0x48899e;};'use strict';var _=require(_0x3e7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3e7b('0x1'));var moment=require(_0x3e7b('0x2'));var BPromise=require(_0x3e7b('0x3'));var rp=require(_0x3e7b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e7b('0x5'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x3e7b('0x6')]=function(_0x1ac21f,_0x2506c4){return _0x1ac21f[_0x3e7b('0x7')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x20bc=['chat_applications','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','ChatApplication'];(function(_0x275cea,_0x3cc1eb){var _0x5691bd=function(_0x176fd1){while(--_0x176fd1){_0x275cea['push'](_0x275cea['shift']());}};_0x5691bd(++_0x3cc1eb);}(_0x20bc,0x1c5));var _0xc20b=function(_0x2e9b5b,_0x3e1332){_0x2e9b5b=_0x2e9b5b-0x0;var _0x734c46=_0x20bc[_0x2e9b5b];return _0x734c46;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc20b('0x0'))(_0xc20b('0x1'));var moment=require(_0xc20b('0x2'));var BPromise=require(_0xc20b('0x3'));var rp=require(_0xc20b('0x4'));var fs=require('fs');var path=require(_0xc20b('0x5'));var rimraf=require('rimraf');var config=require(_0xc20b('0x6'));var attributes=require('./chatApplication.attributes');module[_0xc20b('0x7')]=function(_0x18de6c,_0x5828da){return _0x18de6c['define'](_0xc20b('0x8'),attributes,{'tableName':_0xc20b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc20b('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 91249c2..0886366 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 _0xa923=['client','request','then','info','ChatApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa923,0xa5));var _0x3a92=function(_0x511a9a,_0x2f28e6){_0x511a9a=_0x511a9a-0x0;var _0x46b11e=_0xa923[_0x511a9a];return _0x46b11e;};'use strict';var _=require(_0x3a92('0x0'));var util=require(_0x3a92('0x1'));var moment=require(_0x3a92('0x2'));var BPromise=require(_0x3a92('0x3'));var rs=require(_0x3a92('0x4'));var fs=require('fs');var Redis=require(_0x3a92('0x5'));var db=require(_0x3a92('0x6'))['db'];var utils=require(_0x3a92('0x7'));var logger=require(_0x3a92('0x8'))('rpc');var config=require(_0x3a92('0x9'));var jayson=require(_0x3a92('0xa'));var client=jayson[_0x3a92('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c9cc0,_0x389161,_0xe64a53){return new BPromise(function(_0x4c3386,_0x865afe){return client[_0x3a92('0xc')](_0x4c9cc0,_0xe64a53)[_0x3a92('0xd')](function(_0x2f4e3d){logger[_0x3a92('0xe')](_0x3a92('0xf'),_0x389161,'request\x20sent');logger[_0x3a92('0x10')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x389161,_0x3a92('0x11'),JSON['stringify'](_0x2f4e3d));if(_0x2f4e3d['error']){if(_0x2f4e3d[_0x3a92('0x12')][_0x3a92('0x13')]===0x1f4){logger['error'](_0x3a92('0xf'),_0x389161,_0x2f4e3d[_0x3a92('0x12')]['message']);return _0x865afe(_0x2f4e3d[_0x3a92('0x12')][_0x3a92('0x14')]);}logger['error'](_0x3a92('0xf'),_0x389161,_0x2f4e3d[_0x3a92('0x12')]['message']);return _0x4c3386(_0x2f4e3d[_0x3a92('0x12')][_0x3a92('0x14')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x389161,_0x3a92('0x11'));_0x4c3386(_0x2f4e3d[_0x3a92('0x15')][_0x3a92('0x14')]);}})['catch'](function(_0x41d1e5){logger['error'](_0x3a92('0xf'),_0x389161,_0x41d1e5);_0x865afe(_0x41d1e5);});});} \ No newline at end of file +var _0x56f4=['request\x20sent','stringify','error','code','message','catch','lodash','util','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','ChatApplication,\x20%s,\x20%s'];(function(_0x1b1b7b,_0xf3cb03){var _0x4d3852=function(_0x2d5494){while(--_0x2d5494){_0x1b1b7b['push'](_0x1b1b7b['shift']());}};_0x4d3852(++_0xf3cb03);}(_0x56f4,0x6f));var _0x456f=function(_0x119091,_0x118d6d){_0x119091=_0x119091-0x0;var _0x503f8c=_0x56f4[_0x119091];return _0x503f8c;};'use strict';var _=require(_0x456f('0x0'));var util=require(_0x456f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x456f('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x456f('0x3'))(_0x456f('0x4'));var config=require(_0x456f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x456f('0x6')][_0x456f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3fcec2,_0x206a99,_0x39b92e){return new BPromise(function(_0x118494,_0x2abb4c){return client['request'](_0x3fcec2,_0x39b92e)['then'](function(_0x423fa4){logger['info'](_0x456f('0x8'),_0x206a99,_0x456f('0x9'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x206a99,_0x456f('0x9'),JSON[_0x456f('0xa')](_0x423fa4));if(_0x423fa4[_0x456f('0xb')]){if(_0x423fa4['error'][_0x456f('0xc')]===0x1f4){logger['error'](_0x456f('0x8'),_0x206a99,_0x423fa4[_0x456f('0xb')][_0x456f('0xd')]);return _0x2abb4c(_0x423fa4['error'][_0x456f('0xd')]);}logger[_0x456f('0xb')](_0x456f('0x8'),_0x206a99,_0x423fa4[_0x456f('0xb')]['message']);return _0x118494(_0x423fa4['error'][_0x456f('0xd')]);}else{logger['info'](_0x456f('0x8'),_0x206a99,_0x456f('0x9'));_0x118494(_0x423fa4['result'][_0x456f('0xd')]);}})[_0x456f('0xe')](function(_0x320624){logger[_0x456f('0xb')](_0x456f('0x8'),_0x206a99,_0x320624);_0x2abb4c(_0x320624);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 556ff25..736ccb0 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 _0xf151=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','show','put','/:id','isAuthenticated','delete','destroy','exports','multer'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xf151,0x1af));var _0x1f15=function(_0x295c83,_0x3d922c){_0x295c83=_0x295c83-0x0;var _0xb99aed=_0xf151[_0x295c83];return _0xb99aed;};'use strict';var multer=require(_0x1f15('0x0'));var util=require(_0x1f15('0x1'));var path=require(_0x1f15('0x2'));var timeout=require(_0x1f15('0x3'));var express=require(_0x1f15('0x4'));var router=express[_0x1f15('0x5')]();var fs_extra=require(_0x1f15('0x6'));var auth=require(_0x1f15('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1f15('0x8'));var controller=require(_0x1f15('0x9'));router[_0x1f15('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1f15('0xb')]);router[_0x1f15('0xc')](_0x1f15('0xd'),auth[_0x1f15('0xe')](),controller['update']);router[_0x1f15('0xf')]('/:id',auth[_0x1f15('0xe')](),controller[_0x1f15('0x10')]);module[_0x1f15('0x11')]=router; \ No newline at end of file +var _0x1f31=['util','path','express','Router','fs-extra','../../components/interaction/service','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update','destroy'];(function(_0x2e4e9f,_0x85c591){var _0x4e84dd=function(_0x27a81d){while(--_0x27a81d){_0x2e4e9f['push'](_0x2e4e9f['shift']());}};_0x4e84dd(++_0x85c591);}(_0x1f31,0xa8));var _0x11f3=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x1f31[_0xbec8e6];return _0x4aa6f2;};'use strict';var multer=require('multer');var util=require(_0x11f3('0x0'));var path=require(_0x11f3('0x1'));var timeout=require('connect-timeout');var express=require(_0x11f3('0x2'));var router=express[_0x11f3('0x3')]();var fs_extra=require(_0x11f3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x11f3('0x5'));var config=require('../../config/environment');var controller=require(_0x11f3('0x6'));router[_0x11f3('0x7')](_0x11f3('0x8'),auth['isAuthenticated'](),controller[_0x11f3('0x9')]);router[_0x11f3('0xa')]('/:id',auth[_0x11f3('0xb')](),controller[_0x11f3('0xc')]);router['delete'](_0x11f3('0x8'),auth[_0x11f3('0xb')](),controller[_0x11f3('0xd')]);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 8dac48a..51a0a39 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 _0x0496=['BOOLEAN','sequelize','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0496,0x199));var _0x6049=function(_0x3d3ed3,_0x5de6fe){_0x3d3ed3=_0x3d3ed3-0x0;var _0x10223f=_0x0496[_0x3d3ed3];return _0x10223f;};'use strict';var Sequelize=require(_0x6049('0x0'));module['exports']={'name':{'type':Sequelize[_0x6049('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6049('0x1')]},'write':{'type':Sequelize[_0x6049('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6f08=['sequelize','exports','STRING','BOOLEAN'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x6f08,0x9c));var _0x86f0=function(_0x12b21a,_0x3f846e){_0x12b21a=_0x12b21a-0x0;var _0x235760=_0x6f08[_0x12b21a];return _0x235760;};'use strict';var Sequelize=require(_0x86f0('0x0'));module[_0x86f0('0x1')]={'name':{'type':Sequelize[_0x86f0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x86f0('0x2')]},'write':{'type':Sequelize[_0x86f0('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 0fb1a70..135ecec 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 _0x8885=['../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','then','destroy','error','name','send','index','map','ChatGroup','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x118be1,_0x2ee67b){var _0x402517=function(_0x1a3526){while(--_0x1a3526){_0x118be1['push'](_0x118be1['shift']());}};_0x402517(++_0x2ee67b);}(_0x8885,0xab));var _0x5888=function(_0xa22f4e,_0x205c84){_0xa22f4e=_0xa22f4e-0x0;var _0xb2a0a9=_0x8885[_0xa22f4e];return _0xb2a0a9;};'use strict';var emlformat=require(_0x5888('0x0'));var rimraf=require(_0x5888('0x1'));var zipdir=require(_0x5888('0x2'));var jsonpatch=require(_0x5888('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5888('0x4'));var Mustache=require(_0x5888('0x5'));var util=require(_0x5888('0x6'));var path=require(_0x5888('0x7'));var sox=require(_0x5888('0x8'));var csv=require('to-csv');var ejs=require(_0x5888('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5888('0xa'));var squel=require(_0x5888('0xb'));var crypto=require(_0x5888('0xc'));var jsforce=require(_0x5888('0xd'));var deskjs=require(_0x5888('0xe'));var toCsv=require(_0x5888('0xf'));var querystring=require(_0x5888('0x10'));var Papa=require(_0x5888('0x11'));var Redis=require(_0x5888('0x12'));var authService=require(_0x5888('0x13'));var qs=require(_0x5888('0x14'));var as=require(_0x5888('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5888('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5888('0x17'));var licenseUtil=require(_0x5888('0x18'));var db=require(_0x5888('0x19'))['db'];config['redis']=_['defaults'](config[_0x5888('0x1a')],{'host':_0x5888('0x1b'),'port':0x18eb});var socket=require(_0x5888('0x1c'))(new Redis(config[_0x5888('0x1a')]));require(_0x5888('0x1d'))[_0x5888('0x1e')](socket);function respondWithStatusCode(_0x52dce8,_0x1f1402){_0x1f1402=_0x1f1402||0xcc;return function(_0x123f07){if(_0x123f07){return _0x52dce8['sendStatus'](_0x1f1402);}return _0x52dce8[_0x5888('0x1f')](_0x1f1402)[_0x5888('0x20')]();};}function respondWithResult(_0x28dc21,_0x4df586){_0x4df586=_0x4df586||0xc8;return function(_0x81a3cd){if(_0x81a3cd){return _0x28dc21[_0x5888('0x1f')](_0x4df586)[_0x5888('0x21')](_0x81a3cd);}};}function respondWithFilteredResult(_0x224370,_0x1d99c2){return function(_0x4a9347){if(_0x4a9347){var _0x2616b3=typeof _0x1d99c2[_0x5888('0x22')]==='undefined'&&typeof _0x1d99c2[_0x5888('0x23')]===_0x5888('0x24');var _0x5cf452=_0x4a9347[_0x5888('0x25')];var _0x572ac8=_0x2616b3?0x0:_0x1d99c2['offset'];var _0x38098f=_0x2616b3?_0x4a9347[_0x5888('0x25')]:_0x1d99c2[_0x5888('0x22')]+_0x1d99c2[_0x5888('0x23')];var _0x233768;if(_0x38098f>=_0x5cf452){_0x38098f=_0x5cf452;_0x233768=0xc8;}else{_0x233768=0xce;}_0x224370[_0x5888('0x1f')](_0x233768);return _0x224370['set'](_0x5888('0x26'),_0x572ac8+'-'+_0x38098f+'/'+_0x5cf452)[_0x5888('0x21')](_0x4a9347);}return null;};}function patchUpdates(_0x772c14){return function(_0x5d537b){try{jsonpatch['apply'](_0x5d537b,_0x772c14,!![]);}catch(_0xede875){return BPromise[_0x5888('0x27')](_0xede875);}return _0x5d537b[_0x5888('0x28')]();};}function saveUpdates(_0x58c087,_0x5f388b){return function(_0x195e4a){if(_0x195e4a){return _0x195e4a['update'](_0x58c087)[_0x5888('0x29')](function(_0x419f5a){return _0x419f5a;});}return null;};}function removeEntity(_0x427ff2,_0x2a5deb){return function(_0x1b2bdf){if(_0x1b2bdf){return _0x1b2bdf[_0x5888('0x2a')]()[_0x5888('0x29')](function(){_0x427ff2[_0x5888('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c761d,_0x553663){return function(_0x4a660b){if(!_0x4a660b){_0x5c761d['sendStatus'](0x194);}return _0x4a660b;};}function handleError(_0x2a7357,_0x4fd949){_0x4fd949=_0x4fd949||0x1f4;return function(_0x42fbb3){logger[_0x5888('0x2b')](_0x42fbb3['stack']);if(_0x42fbb3[_0x5888('0x2c')]){delete _0x42fbb3[_0x5888('0x2c')];}_0x2a7357[_0x5888('0x1f')](_0x4fd949)[_0x5888('0x2d')](_0x42fbb3);};}exports[_0x5888('0x2e')]=function(_0x596967,_0x3d164c){var _0x35e474={},_0x1ec968={},_0xa784a4={'count':0x0,'rows':[]};var _0x3ed3e9=_[_0x5888('0x2f')](db[_0x5888('0x30')][_0x5888('0x31')],function(_0x3d67b3){return{'name':_0x3d67b3['fieldName'],'type':_0x3d67b3['type']['key']};});_0x1ec968[_0x5888('0x32')]=_['map'](_0x3ed3e9,_0x5888('0x2c'));_0x1ec968[_0x5888('0x33')]=_[_0x5888('0x34')](_0x596967['query']);_0x1ec968[_0x5888('0x35')]=_[_0x5888('0x36')](_0x1ec968[_0x5888('0x32')],_0x1ec968[_0x5888('0x33')]);_0x35e474[_0x5888('0x37')]=_[_0x5888('0x36')](_0x1ec968['model'],qs[_0x5888('0x38')](_0x596967[_0x5888('0x33')]['fields']));_0x35e474[_0x5888('0x37')]=_0x35e474['attributes'][_0x5888('0x39')]?_0x35e474[_0x5888('0x37')]:_0x1ec968['model'];if(!_0x596967[_0x5888('0x33')][_0x5888('0x3a')]('nolimit')){_0x35e474[_0x5888('0x23')]=qs[_0x5888('0x23')](_0x596967[_0x5888('0x33')][_0x5888('0x23')]);_0x35e474[_0x5888('0x22')]=qs[_0x5888('0x22')](_0x596967[_0x5888('0x33')][_0x5888('0x22')]);}_0x35e474[_0x5888('0x3b')]=qs[_0x5888('0x3c')](_0x596967['query']['sort']);_0x35e474[_0x5888('0x3d')]=qs[_0x5888('0x35')](_['pick'](_0x596967['query'],_0x1ec968[_0x5888('0x35')]),_0x3ed3e9);if(_0x596967[_0x5888('0x33')][_0x5888('0x3e')]){_0x35e474[_0x5888('0x3d')]=_[_0x5888('0x3f')](_0x35e474['where'],{'$or':_[_0x5888('0x2f')](_0x3ed3e9,function(_0x3860e4){if(_0x3860e4[_0x5888('0x40')]!==_0x5888('0x41')){var _0x426c46={};_0x426c46[_0x3860e4[_0x5888('0x2c')]]={'$like':'%'+_0x596967[_0x5888('0x33')]['filter']+'%'};return _0x426c46;}})});}_0x35e474=_[_0x5888('0x3f')]({},_0x35e474,_0x596967[_0x5888('0x42')]);var _0x43beb1={'where':_0x35e474[_0x5888('0x3d')]};return db['ChatGroup']['count'](_0x43beb1)['then'](function(_0xdd2d95){_0xa784a4[_0x5888('0x25')]=_0xdd2d95;if(_0x596967['query'][_0x5888('0x43')]){_0x35e474[_0x5888('0x44')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x35e474);})[_0x5888('0x29')](function(_0x414fc6){_0xa784a4[_0x5888('0x45')]=_0x414fc6;return _0xa784a4;})[_0x5888('0x29')](respondWithFilteredResult(_0x3d164c,_0x35e474))[_0x5888('0x46')](handleError(_0x3d164c,null));};exports[_0x5888('0x47')]=function(_0xff0313,_0x50ccd1){var _0x25eae5={'raw':!![],'where':{'id':_0xff0313[_0x5888('0x48')]['id']}},_0x28f1a0={};_0x28f1a0['model']=_[_0x5888('0x34')](db['ChatGroup'][_0x5888('0x31')]);_0x28f1a0[_0x5888('0x33')]=_[_0x5888('0x34')](_0xff0313['query']);_0x28f1a0['filters']=_[_0x5888('0x36')](_0x28f1a0['model'],_0x28f1a0['query']);_0x25eae5['attributes']=_['intersection'](_0x28f1a0[_0x5888('0x32')],qs[_0x5888('0x38')](_0xff0313[_0x5888('0x33')][_0x5888('0x38')]));_0x25eae5['attributes']=_0x25eae5['attributes'][_0x5888('0x39')]?_0x25eae5[_0x5888('0x37')]:_0x28f1a0[_0x5888('0x32')];if(_0xff0313[_0x5888('0x33')][_0x5888('0x43')]){_0x25eae5['include']=[{'all':!![]}];}_0x25eae5=_[_0x5888('0x3f')]({},_0x25eae5,_0xff0313[_0x5888('0x42')]);return db[_0x5888('0x30')][_0x5888('0x49')](_0x25eae5)[_0x5888('0x29')](handleEntityNotFound(_0x50ccd1,null))[_0x5888('0x29')](respondWithResult(_0x50ccd1,null))[_0x5888('0x46')](handleError(_0x50ccd1,null));};exports[_0x5888('0x4a')]=function(_0x5c226d,_0x2296d0){return db[_0x5888('0x30')]['create'](_0x5c226d[_0x5888('0x4b')],{})['then'](respondWithResult(_0x2296d0,0xc9))[_0x5888('0x46')](handleError(_0x2296d0,null));};exports['update']=function(_0xe076d9,_0x15de42){if(_0xe076d9[_0x5888('0x4b')]['id']){delete _0xe076d9[_0x5888('0x4b')]['id'];}return db[_0x5888('0x30')][_0x5888('0x49')]({'where':{'id':_0xe076d9[_0x5888('0x48')]['id']}})['then'](handleEntityNotFound(_0x15de42,null))[_0x5888('0x29')](saveUpdates(_0xe076d9['body'],null))[_0x5888('0x29')](respondWithResult(_0x15de42,null))[_0x5888('0x46')](handleError(_0x15de42,null));};exports[_0x5888('0x2a')]=function(_0x40ad6c,_0x8cab23){return db[_0x5888('0x30')][_0x5888('0x49')]({'where':{'id':_0x40ad6c[_0x5888('0x48')]['id']}})[_0x5888('0x29')](handleEntityNotFound(_0x8cab23,null))[_0x5888('0x29')](removeEntity(_0x8cab23,null))[_0x5888('0x46')](handleError(_0x8cab23,null));};exports['describe']=function(_0x4be6f1,_0x1356e8){return db[_0x5888('0x30')][_0x5888('0x4c')]()[_0x5888('0x29')](respondWithResult(_0x1356e8,null))[_0x5888('0x46')](handleError(_0x1356e8,null));};exports[_0x5888('0x4d')]=function(_0x4f5556,_0x5780dd,_0x1f37d4){return db[_0x5888('0x4e')]['count']({'where':{'ChatGroupId':_0x4f5556['params']['id'],'ToId':_0x4f5556[_0x5888('0x4f')]['id'],'read':![]}})[_0x5888('0x29')](function(_0x4e7473){return{'id':_[_0x5888('0x50')](_0x4f5556[_0x5888('0x48')]['id']),'count':_0x4e7473};})['then'](respondWithResult(_0x5780dd,null))[_0x5888('0x46')](handleError(_0x5780dd,null));};exports[_0x5888('0x51')]=function(_0x1a8b54,_0x4a2320,_0x36cae6){return db[_0x5888('0x30')][_0x5888('0x49')]({'where':{'id':_0x1a8b54[_0x5888('0x48')]['id']}})[_0x5888('0x29')](handleEntityNotFound(_0x4a2320,null))[_0x5888('0x29')](function(_0x4a5eeb){if(_0x4a5eeb){return _0x4a5eeb[_0x5888('0x51')](_0x1a8b54[_0x5888('0x4b')][_0x5888('0x52')],_[_0x5888('0x53')](_0x1a8b54['body'],[_0x5888('0x52'),'id'])||{});}})[_0x5888('0x29')](respondWithResult(_0x4a2320,null))[_0x5888('0x46')](handleError(_0x4a2320,null));};exports[_0x5888('0x54')]=function(_0x35ad7b,_0x284bac,_0x5bd138){var _0x3c62f8={};var _0x43a9c6={};var _0x5f412a;var _0x5d6b29;return db[_0x5888('0x30')][_0x5888('0x55')]({'where':{'id':_0x35ad7b['params']['id']}})['then'](handleEntityNotFound(_0x284bac,null))[_0x5888('0x29')](function(_0x4aa449){if(_0x4aa449){_0x5f412a=_0x4aa449;_0x43a9c6[_0x5888('0x32')]=_[_0x5888('0x34')](db[_0x5888('0x56')][_0x5888('0x31')]);_0x43a9c6[_0x5888('0x33')]=_[_0x5888('0x34')](_0x35ad7b[_0x5888('0x33')]);_0x43a9c6[_0x5888('0x35')]=_[_0x5888('0x36')](_0x43a9c6[_0x5888('0x32')],_0x43a9c6[_0x5888('0x33')]);_0x3c62f8[_0x5888('0x37')]=_[_0x5888('0x36')](_0x43a9c6[_0x5888('0x32')],qs['fields'](_0x35ad7b[_0x5888('0x33')][_0x5888('0x38')]));_0x3c62f8['attributes']=_0x3c62f8[_0x5888('0x37')]['length']?_0x3c62f8[_0x5888('0x37')]:_0x43a9c6[_0x5888('0x32')];_0x3c62f8[_0x5888('0x3b')]=qs[_0x5888('0x3c')](_0x35ad7b[_0x5888('0x33')][_0x5888('0x3c')]);_0x3c62f8[_0x5888('0x3d')]=qs[_0x5888('0x35')](_['pick'](_0x35ad7b[_0x5888('0x33')],_0x43a9c6[_0x5888('0x35')]));if(_0x35ad7b['query'][_0x5888('0x3e')]){_0x3c62f8[_0x5888('0x3d')]=_[_0x5888('0x3f')](_0x3c62f8[_0x5888('0x3d')],{'$or':_[_0x5888('0x2f')](_0x3c62f8[_0x5888('0x37')],function(_0x4947db){var _0x1083e7={};_0x1083e7[_0x4947db]={'$like':'%'+_0x35ad7b[_0x5888('0x33')]['filter']+'%'};return _0x1083e7;})});}_0x3c62f8=_[_0x5888('0x3f')]({},_0x3c62f8,_0x35ad7b[_0x5888('0x42')]);return _0x5f412a[_0x5888('0x54')](_0x3c62f8);}})[_0x5888('0x29')](function(_0x55ec97){if(_0x55ec97){_0x5d6b29=_0x55ec97[_0x5888('0x39')];if(!_0x35ad7b[_0x5888('0x33')][_0x5888('0x3a')]('nolimit')){_0x3c62f8[_0x5888('0x23')]=qs['limit'](_0x35ad7b[_0x5888('0x33')]['limit']);_0x3c62f8[_0x5888('0x22')]=qs[_0x5888('0x22')](_0x35ad7b[_0x5888('0x33')]['offset']);}return _0x5f412a[_0x5888('0x54')](_0x3c62f8);}})[_0x5888('0x29')](function(_0x2a4fa2){if(_0x2a4fa2){return _0x2a4fa2?{'count':_0x5d6b29,'rows':_0x2a4fa2}:null;}})['then'](respondWithResult(_0x284bac,null))['catch'](handleError(_0x284bac,null));};exports[_0x5888('0x57')]=function(_0x559862,_0x1ddca2,_0x368417){return db['ChatGroup'][_0x5888('0x49')]({'where':{'id':_0x559862[_0x5888('0x48')]['id']}})[_0x5888('0x29')](handleEntityNotFound(_0x1ddca2,null))[_0x5888('0x29')](function(_0x4aa10f){if(_0x4aa10f){return _0x4aa10f[_0x5888('0x57')](_0x559862[_0x5888('0x33')][_0x5888('0x52')]);}})['then'](respondWithStatusCode(_0x1ddca2,null))['catch'](handleError(_0x1ddca2,null));};exports[_0x5888('0x58')]=function(_0x53ad32,_0x272621,_0x2bf4cb){if(_0x53ad32['body']['id']){delete _0x53ad32['body']['id'];}return db[_0x5888('0x30')]['find']({'where':{'id':_0x53ad32[_0x5888('0x48')]['id']}})[_0x5888('0x29')](handleEntityNotFound(_0x272621,null))[_0x5888('0x29')](function(_0x1347a2){if(_0x1347a2){_0x53ad32[_0x5888('0x4b')][_0x5888('0x59')]=_0x1347a2['id'];return db[_0x5888('0x4e')]['create'](_0x53ad32[_0x5888('0x4b')]);}})[_0x5888('0x29')](respondWithResult(_0x272621,null))['catch'](handleError(_0x272621,null));};exports[_0x5888('0x5a')]=function(_0x3eb98f,_0x5353c6,_0x1c615a){var _0x19a25a={};var _0x5c8695={};var _0x4029d4;var _0x3b4fa6;return db['ChatGroup'][_0x5888('0x55')]({'where':{'id':_0x3eb98f[_0x5888('0x48')]['id']}})[_0x5888('0x29')](handleEntityNotFound(_0x5353c6,null))[_0x5888('0x29')](function(_0x265a61){if(_0x265a61){_0x4029d4=_0x265a61;_0x5c8695[_0x5888('0x32')]=_[_0x5888('0x34')](db['ChatInternalMessage'][_0x5888('0x31')]);_0x5c8695[_0x5888('0x33')]=_[_0x5888('0x34')](_0x3eb98f[_0x5888('0x33')]);_0x5c8695[_0x5888('0x35')]=_[_0x5888('0x36')](_0x5c8695[_0x5888('0x32')],_0x5c8695[_0x5888('0x33')]);_0x19a25a[_0x5888('0x37')]=_[_0x5888('0x36')](_0x5c8695[_0x5888('0x32')],qs['fields'](_0x3eb98f[_0x5888('0x33')][_0x5888('0x38')]));_0x19a25a[_0x5888('0x37')]=_0x19a25a[_0x5888('0x37')][_0x5888('0x39')]?_0x19a25a[_0x5888('0x37')]:_0x5c8695[_0x5888('0x32')];_0x19a25a[_0x5888('0x3b')]=qs[_0x5888('0x3c')](_0x3eb98f['query'][_0x5888('0x3c')]);_0x19a25a[_0x5888('0x3d')]=qs[_0x5888('0x35')](_[_0x5888('0x5b')](_0x3eb98f['query'],_0x5c8695[_0x5888('0x35')]));if(_0x3eb98f[_0x5888('0x33')][_0x5888('0x3e')]){_0x19a25a[_0x5888('0x3d')]=_[_0x5888('0x3f')](_0x19a25a[_0x5888('0x3d')],{'$or':_[_0x5888('0x2f')](_0x19a25a['attributes'],function(_0x4936e9){var _0x278d25={};_0x278d25[_0x4936e9]={'$like':'%'+_0x3eb98f[_0x5888('0x33')][_0x5888('0x3e')]+'%'};return _0x278d25;})});}if(_0x3eb98f[_0x5888('0x33')][_0x5888('0x5c')]){var _0x21f683=_0x3eb98f[_0x5888('0x33')][_0x5888('0x5c')][_0x5888('0x5d')](',');var _0x19bf34={};_0x19bf34[_0x21f683[0x0]]={'$gte':moment(_0x21f683[0x1])[_0x5888('0x5e')](_0x5888('0x5f'))};_0x19a25a['where']=_[_0x5888('0x3f')](_0x19a25a[_0x5888('0x3d')],_0x19bf34);}_0x19a25a=_['merge']({},_0x19a25a,_0x3eb98f[_0x5888('0x42')]);return _0x4029d4[_0x5888('0x5a')](_0x19a25a);}})[_0x5888('0x29')](function(_0x3b8825){if(_0x3b8825){_0x3b4fa6=_0x3b8825[_0x5888('0x39')];if(!_0x3eb98f['query'][_0x5888('0x3a')](_0x5888('0x60'))){_0x19a25a[_0x5888('0x23')]=qs[_0x5888('0x23')](_0x3eb98f[_0x5888('0x33')]['limit']);_0x19a25a[_0x5888('0x22')]=qs[_0x5888('0x22')](_0x3eb98f[_0x5888('0x33')]['offset']);}return _0x4029d4[_0x5888('0x5a')](_0x19a25a);}})[_0x5888('0x29')](function(_0x43ba13){if(_0x43ba13){return _0x43ba13?{'count':_0x3b4fa6,'rows':_0x43ba13}:null;}})[_0x5888('0x29')](respondWithResult(_0x5353c6,null))[_0x5888('0x46')](handleError(_0x5353c6,null));}; \ No newline at end of file +var _0xd2b2=['rows','show','params','rawAttributes','find','catch','create','body','destroy','describe','getUnread','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','filter','addMessage','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','then','stack','name','index','map','ChatGroup','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd2b2,0x138));var _0x2d2b=function(_0x55eaf7,_0x2ddd6c){_0x55eaf7=_0x55eaf7-0x0;var _0x461760=_0xd2b2[_0x55eaf7];return _0x461760;};'use strict';var emlformat=require(_0x2d2b('0x0'));var rimraf=require(_0x2d2b('0x1'));var zipdir=require(_0x2d2b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d2b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2d2b('0x4'));var util=require(_0x2d2b('0x5'));var path=require(_0x2d2b('0x6'));var sox=require(_0x2d2b('0x7'));var csv=require(_0x2d2b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d2b('0x9'));var _=require(_0x2d2b('0xa'));var squel=require(_0x2d2b('0xb'));var crypto=require(_0x2d2b('0xc'));var jsforce=require(_0x2d2b('0xd'));var deskjs=require(_0x2d2b('0xe'));var toCsv=require(_0x2d2b('0x8'));var querystring=require(_0x2d2b('0xf'));var Papa=require(_0x2d2b('0x10'));var Redis=require('ioredis');var authService=require(_0x2d2b('0x11'));var qs=require(_0x2d2b('0x12'));var as=require(_0x2d2b('0x13'));var hardwareService=require(_0x2d2b('0x14'));var logger=require(_0x2d2b('0x15'))(_0x2d2b('0x16'));var utils=require(_0x2d2b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2d2b('0x18'));var db=require('../../mysqldb')['db'];config[_0x2d2b('0x19')]=_[_0x2d2b('0x1a')](config[_0x2d2b('0x19')],{'host':_0x2d2b('0x1b'),'port':0x18eb});var socket=require(_0x2d2b('0x1c'))(new Redis(config[_0x2d2b('0x19')]));require(_0x2d2b('0x1d'))['register'](socket);function respondWithStatusCode(_0x33c73c,_0x97e7cb){_0x97e7cb=_0x97e7cb||0xcc;return function(_0x26b2c3){if(_0x26b2c3){return _0x33c73c[_0x2d2b('0x1e')](_0x97e7cb);}return _0x33c73c[_0x2d2b('0x1f')](_0x97e7cb)[_0x2d2b('0x20')]();};}function respondWithResult(_0x7cb236,_0x20b419){_0x20b419=_0x20b419||0xc8;return function(_0x3e5736){if(_0x3e5736){return _0x7cb236['status'](_0x20b419)['json'](_0x3e5736);}};}function respondWithFilteredResult(_0x1c104b,_0x9c5be0){return function(_0x74c6ce){if(_0x74c6ce){var _0x2ea5c5=typeof _0x9c5be0[_0x2d2b('0x21')]===_0x2d2b('0x22')&&typeof _0x9c5be0[_0x2d2b('0x23')]===_0x2d2b('0x22');var _0x598198=_0x74c6ce[_0x2d2b('0x24')];var _0x17ccc4=_0x2ea5c5?0x0:_0x9c5be0['offset'];var _0x5be82c=_0x2ea5c5?_0x74c6ce[_0x2d2b('0x24')]:_0x9c5be0[_0x2d2b('0x21')]+_0x9c5be0['limit'];var _0x50cf85;if(_0x5be82c>=_0x598198){_0x5be82c=_0x598198;_0x50cf85=0xc8;}else{_0x50cf85=0xce;}_0x1c104b[_0x2d2b('0x1f')](_0x50cf85);return _0x1c104b[_0x2d2b('0x25')]('Content-Range',_0x17ccc4+'-'+_0x5be82c+'/'+_0x598198)['json'](_0x74c6ce);}return null;};}function patchUpdates(_0x445ee1){return function(_0x600be9){try{jsonpatch[_0x2d2b('0x26')](_0x600be9,_0x445ee1,!![]);}catch(_0x2fb5dc){return BPromise[_0x2d2b('0x27')](_0x2fb5dc);}return _0x600be9['save']();};}function saveUpdates(_0x54dd46,_0xea390f){return function(_0x48e376){if(_0x48e376){return _0x48e376['update'](_0x54dd46)[_0x2d2b('0x28')](function(_0x222dd7){return _0x222dd7;});}return null;};}function removeEntity(_0x2eb048,_0x5769ae){return function(_0x15de29){if(_0x15de29){return _0x15de29['destroy']()[_0x2d2b('0x28')](function(){_0x2eb048[_0x2d2b('0x1f')](0xcc)[_0x2d2b('0x20')]();});}};}function handleEntityNotFound(_0x43b375,_0xa2a23d){return function(_0xded75){if(!_0xded75){_0x43b375[_0x2d2b('0x1e')](0x194);}return _0xded75;};}function handleError(_0x51afc6,_0x2ab2a5){_0x2ab2a5=_0x2ab2a5||0x1f4;return function(_0x343241){logger['error'](_0x343241[_0x2d2b('0x29')]);if(_0x343241['name']){delete _0x343241[_0x2d2b('0x2a')];}_0x51afc6['status'](_0x2ab2a5)['send'](_0x343241);};}exports[_0x2d2b('0x2b')]=function(_0x59fbfc,_0x486cd7){var _0x28a1d6={},_0x4498d8={},_0x5bcf31={'count':0x0,'rows':[]};var _0x2d5e1d=_[_0x2d2b('0x2c')](db[_0x2d2b('0x2d')]['rawAttributes'],function(_0x13e51a){return{'name':_0x13e51a[_0x2d2b('0x2e')],'type':_0x13e51a[_0x2d2b('0x2f')][_0x2d2b('0x30')]};});_0x4498d8['model']=_[_0x2d2b('0x2c')](_0x2d5e1d,'name');_0x4498d8[_0x2d2b('0x31')]=_[_0x2d2b('0x32')](_0x59fbfc['query']);_0x4498d8['filters']=_['intersection'](_0x4498d8[_0x2d2b('0x33')],_0x4498d8['query']);_0x28a1d6[_0x2d2b('0x34')]=_[_0x2d2b('0x35')](_0x4498d8[_0x2d2b('0x33')],qs[_0x2d2b('0x36')](_0x59fbfc['query'][_0x2d2b('0x36')]));_0x28a1d6[_0x2d2b('0x34')]=_0x28a1d6[_0x2d2b('0x34')][_0x2d2b('0x37')]?_0x28a1d6[_0x2d2b('0x34')]:_0x4498d8[_0x2d2b('0x33')];if(!_0x59fbfc['query'][_0x2d2b('0x38')](_0x2d2b('0x39'))){_0x28a1d6[_0x2d2b('0x23')]=qs[_0x2d2b('0x23')](_0x59fbfc['query'][_0x2d2b('0x23')]);_0x28a1d6['offset']=qs[_0x2d2b('0x21')](_0x59fbfc[_0x2d2b('0x31')]['offset']);}_0x28a1d6[_0x2d2b('0x3a')]=qs[_0x2d2b('0x3b')](_0x59fbfc[_0x2d2b('0x31')]['sort']);_0x28a1d6['where']=qs[_0x2d2b('0x3c')](_['pick'](_0x59fbfc[_0x2d2b('0x31')],_0x4498d8[_0x2d2b('0x3c')]),_0x2d5e1d);if(_0x59fbfc['query']['filter']){_0x28a1d6[_0x2d2b('0x3d')]=_[_0x2d2b('0x3e')](_0x28a1d6[_0x2d2b('0x3d')],{'$or':_[_0x2d2b('0x2c')](_0x2d5e1d,function(_0x247ef7){if(_0x247ef7[_0x2d2b('0x2f')]!==_0x2d2b('0x3f')){var _0x56b181={};_0x56b181[_0x247ef7[_0x2d2b('0x2a')]]={'$like':'%'+_0x59fbfc[_0x2d2b('0x31')]['filter']+'%'};return _0x56b181;}})});}_0x28a1d6=_[_0x2d2b('0x3e')]({},_0x28a1d6,_0x59fbfc[_0x2d2b('0x40')]);var _0x356415={'where':_0x28a1d6[_0x2d2b('0x3d')]};return db[_0x2d2b('0x2d')][_0x2d2b('0x24')](_0x356415)[_0x2d2b('0x28')](function(_0x2fd60a){_0x5bcf31[_0x2d2b('0x24')]=_0x2fd60a;if(_0x59fbfc[_0x2d2b('0x31')][_0x2d2b('0x41')]){_0x28a1d6[_0x2d2b('0x42')]=[{'all':!![]}];}return db[_0x2d2b('0x2d')][_0x2d2b('0x43')](_0x28a1d6);})['then'](function(_0x3a0024){_0x5bcf31[_0x2d2b('0x44')]=_0x3a0024;return _0x5bcf31;})[_0x2d2b('0x28')](respondWithFilteredResult(_0x486cd7,_0x28a1d6))['catch'](handleError(_0x486cd7,null));};exports[_0x2d2b('0x45')]=function(_0x238ffa,_0x2b0d58){var _0x512de0={'raw':!![],'where':{'id':_0x238ffa[_0x2d2b('0x46')]['id']}},_0x12d43a={};_0x12d43a[_0x2d2b('0x33')]=_[_0x2d2b('0x32')](db['ChatGroup'][_0x2d2b('0x47')]);_0x12d43a['query']=_[_0x2d2b('0x32')](_0x238ffa[_0x2d2b('0x31')]);_0x12d43a[_0x2d2b('0x3c')]=_['intersection'](_0x12d43a[_0x2d2b('0x33')],_0x12d43a[_0x2d2b('0x31')]);_0x512de0['attributes']=_[_0x2d2b('0x35')](_0x12d43a[_0x2d2b('0x33')],qs[_0x2d2b('0x36')](_0x238ffa[_0x2d2b('0x31')][_0x2d2b('0x36')]));_0x512de0['attributes']=_0x512de0[_0x2d2b('0x34')]['length']?_0x512de0[_0x2d2b('0x34')]:_0x12d43a[_0x2d2b('0x33')];if(_0x238ffa[_0x2d2b('0x31')][_0x2d2b('0x41')]){_0x512de0['include']=[{'all':!![]}];}_0x512de0=_[_0x2d2b('0x3e')]({},_0x512de0,_0x238ffa[_0x2d2b('0x40')]);return db[_0x2d2b('0x2d')][_0x2d2b('0x48')](_0x512de0)['then'](handleEntityNotFound(_0x2b0d58,null))[_0x2d2b('0x28')](respondWithResult(_0x2b0d58,null))[_0x2d2b('0x49')](handleError(_0x2b0d58,null));};exports[_0x2d2b('0x4a')]=function(_0x5723ed,_0x2370e5){return db[_0x2d2b('0x2d')]['create'](_0x5723ed[_0x2d2b('0x4b')],{})[_0x2d2b('0x28')](respondWithResult(_0x2370e5,0xc9))[_0x2d2b('0x49')](handleError(_0x2370e5,null));};exports['update']=function(_0x23e8df,_0x5c5dd2){if(_0x23e8df[_0x2d2b('0x4b')]['id']){delete _0x23e8df['body']['id'];}return db[_0x2d2b('0x2d')][_0x2d2b('0x48')]({'where':{'id':_0x23e8df[_0x2d2b('0x46')]['id']}})[_0x2d2b('0x28')](handleEntityNotFound(_0x5c5dd2,null))[_0x2d2b('0x28')](saveUpdates(_0x23e8df['body'],null))[_0x2d2b('0x28')](respondWithResult(_0x5c5dd2,null))[_0x2d2b('0x49')](handleError(_0x5c5dd2,null));};exports[_0x2d2b('0x4c')]=function(_0x4dca25,_0x531b9e){return db[_0x2d2b('0x2d')][_0x2d2b('0x48')]({'where':{'id':_0x4dca25[_0x2d2b('0x46')]['id']}})[_0x2d2b('0x28')](handleEntityNotFound(_0x531b9e,null))[_0x2d2b('0x28')](removeEntity(_0x531b9e,null))['catch'](handleError(_0x531b9e,null));};exports[_0x2d2b('0x4d')]=function(_0x81bc2c,_0x2a05f4){return db[_0x2d2b('0x2d')][_0x2d2b('0x4d')]()[_0x2d2b('0x28')](respondWithResult(_0x2a05f4,null))[_0x2d2b('0x49')](handleError(_0x2a05f4,null));};exports[_0x2d2b('0x4e')]=function(_0x590121,_0x56332e,_0x527b88){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x590121[_0x2d2b('0x46')]['id'],'ToId':_0x590121['user']['id'],'read':![]}})[_0x2d2b('0x28')](function(_0x51bd7c){return{'id':_[_0x2d2b('0x4f')](_0x590121[_0x2d2b('0x46')]['id']),'count':_0x51bd7c};})[_0x2d2b('0x28')](respondWithResult(_0x56332e,null))[_0x2d2b('0x49')](handleError(_0x56332e,null));};exports[_0x2d2b('0x50')]=function(_0xca1805,_0xbb876a,_0x57fb7c){return db[_0x2d2b('0x2d')]['find']({'where':{'id':_0xca1805[_0x2d2b('0x46')]['id']}})[_0x2d2b('0x28')](handleEntityNotFound(_0xbb876a,null))[_0x2d2b('0x28')](function(_0xebb9c1){if(_0xebb9c1){return _0xebb9c1[_0x2d2b('0x50')](_0xca1805['body'][_0x2d2b('0x51')],_[_0x2d2b('0x52')](_0xca1805[_0x2d2b('0x4b')],['ids','id'])||{});}})[_0x2d2b('0x28')](respondWithResult(_0xbb876a,null))[_0x2d2b('0x49')](handleError(_0xbb876a,null));};exports[_0x2d2b('0x53')]=function(_0x5a08fc,_0x3e59f8,_0x1fcbf6){var _0x403792={};var _0x1a300d={};var _0x2f358c;var _0x50f92c;return db[_0x2d2b('0x2d')][_0x2d2b('0x54')]({'where':{'id':_0x5a08fc[_0x2d2b('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e59f8,null))[_0x2d2b('0x28')](function(_0x315001){if(_0x315001){_0x2f358c=_0x315001;_0x1a300d[_0x2d2b('0x33')]=_[_0x2d2b('0x32')](db[_0x2d2b('0x55')][_0x2d2b('0x47')]);_0x1a300d[_0x2d2b('0x31')]=_[_0x2d2b('0x32')](_0x5a08fc['query']);_0x1a300d[_0x2d2b('0x3c')]=_['intersection'](_0x1a300d['model'],_0x1a300d[_0x2d2b('0x31')]);_0x403792['attributes']=_['intersection'](_0x1a300d[_0x2d2b('0x33')],qs[_0x2d2b('0x36')](_0x5a08fc[_0x2d2b('0x31')][_0x2d2b('0x36')]));_0x403792[_0x2d2b('0x34')]=_0x403792['attributes']['length']?_0x403792[_0x2d2b('0x34')]:_0x1a300d[_0x2d2b('0x33')];_0x403792[_0x2d2b('0x3a')]=qs[_0x2d2b('0x3b')](_0x5a08fc['query'][_0x2d2b('0x3b')]);_0x403792['where']=qs['filters'](_[_0x2d2b('0x56')](_0x5a08fc[_0x2d2b('0x31')],_0x1a300d['filters']));if(_0x5a08fc[_0x2d2b('0x31')][_0x2d2b('0x57')]){_0x403792['where']=_[_0x2d2b('0x3e')](_0x403792[_0x2d2b('0x3d')],{'$or':_[_0x2d2b('0x2c')](_0x403792['attributes'],function(_0x2f4c14){var _0x2ab14f={};_0x2ab14f[_0x2f4c14]={'$like':'%'+_0x5a08fc['query'][_0x2d2b('0x57')]+'%'};return _0x2ab14f;})});}_0x403792=_[_0x2d2b('0x3e')]({},_0x403792,_0x5a08fc['options']);return _0x2f358c[_0x2d2b('0x53')](_0x403792);}})['then'](function(_0x13d44c){if(_0x13d44c){_0x50f92c=_0x13d44c['length'];if(!_0x5a08fc[_0x2d2b('0x31')]['hasOwnProperty']('nolimit')){_0x403792[_0x2d2b('0x23')]=qs[_0x2d2b('0x23')](_0x5a08fc[_0x2d2b('0x31')][_0x2d2b('0x23')]);_0x403792[_0x2d2b('0x21')]=qs['offset'](_0x5a08fc[_0x2d2b('0x31')][_0x2d2b('0x21')]);}return _0x2f358c[_0x2d2b('0x53')](_0x403792);}})[_0x2d2b('0x28')](function(_0x9e1ff4){if(_0x9e1ff4){return _0x9e1ff4?{'count':_0x50f92c,'rows':_0x9e1ff4}:null;}})[_0x2d2b('0x28')](respondWithResult(_0x3e59f8,null))[_0x2d2b('0x49')](handleError(_0x3e59f8,null));};exports['removeMembers']=function(_0x1d4be9,_0x2a2183,_0x2dcb1a){return db[_0x2d2b('0x2d')][_0x2d2b('0x48')]({'where':{'id':_0x1d4be9['params']['id']}})[_0x2d2b('0x28')](handleEntityNotFound(_0x2a2183,null))['then'](function(_0x279cce){if(_0x279cce){return _0x279cce['removeMembers'](_0x1d4be9[_0x2d2b('0x31')][_0x2d2b('0x51')]);}})[_0x2d2b('0x28')](respondWithStatusCode(_0x2a2183,null))[_0x2d2b('0x49')](handleError(_0x2a2183,null));};exports[_0x2d2b('0x58')]=function(_0x2684eb,_0x3e215b,_0xbc86af){if(_0x2684eb[_0x2d2b('0x4b')]['id']){delete _0x2684eb['body']['id'];}return db[_0x2d2b('0x2d')][_0x2d2b('0x48')]({'where':{'id':_0x2684eb['params']['id']}})[_0x2d2b('0x28')](handleEntityNotFound(_0x3e215b,null))['then'](function(_0x37d63f){if(_0x37d63f){_0x2684eb['body']['ChatGroupId']=_0x37d63f['id'];return db[_0x2d2b('0x59')]['create'](_0x2684eb[_0x2d2b('0x4b')]);}})[_0x2d2b('0x28')](respondWithResult(_0x3e215b,null))[_0x2d2b('0x49')](handleError(_0x3e215b,null));};exports[_0x2d2b('0x5a')]=function(_0x263df0,_0x40bf4d,_0x1a74c3){var _0x16ff0f={};var _0xf08c2a={};var _0x4d09ee;var _0x201ce7;return db[_0x2d2b('0x2d')][_0x2d2b('0x54')]({'where':{'id':_0x263df0[_0x2d2b('0x46')]['id']}})[_0x2d2b('0x28')](handleEntityNotFound(_0x40bf4d,null))[_0x2d2b('0x28')](function(_0x3391b7){if(_0x3391b7){_0x4d09ee=_0x3391b7;_0xf08c2a['model']=_[_0x2d2b('0x32')](db[_0x2d2b('0x59')]['rawAttributes']);_0xf08c2a['query']=_[_0x2d2b('0x32')](_0x263df0[_0x2d2b('0x31')]);_0xf08c2a[_0x2d2b('0x3c')]=_['intersection'](_0xf08c2a[_0x2d2b('0x33')],_0xf08c2a[_0x2d2b('0x31')]);_0x16ff0f[_0x2d2b('0x34')]=_[_0x2d2b('0x35')](_0xf08c2a['model'],qs[_0x2d2b('0x36')](_0x263df0[_0x2d2b('0x31')][_0x2d2b('0x36')]));_0x16ff0f[_0x2d2b('0x34')]=_0x16ff0f[_0x2d2b('0x34')][_0x2d2b('0x37')]?_0x16ff0f[_0x2d2b('0x34')]:_0xf08c2a[_0x2d2b('0x33')];_0x16ff0f[_0x2d2b('0x3a')]=qs['sort'](_0x263df0[_0x2d2b('0x31')][_0x2d2b('0x3b')]);_0x16ff0f[_0x2d2b('0x3d')]=qs[_0x2d2b('0x3c')](_[_0x2d2b('0x56')](_0x263df0[_0x2d2b('0x31')],_0xf08c2a[_0x2d2b('0x3c')]));if(_0x263df0['query']['filter']){_0x16ff0f[_0x2d2b('0x3d')]=_[_0x2d2b('0x3e')](_0x16ff0f[_0x2d2b('0x3d')],{'$or':_[_0x2d2b('0x2c')](_0x16ff0f[_0x2d2b('0x34')],function(_0x1ce237){var _0x5778a7={};_0x5778a7[_0x1ce237]={'$like':'%'+_0x263df0[_0x2d2b('0x31')][_0x2d2b('0x57')]+'%'};return _0x5778a7;})});}if(_0x263df0[_0x2d2b('0x31')]['$gte']){var _0x3ad178=_0x263df0[_0x2d2b('0x31')][_0x2d2b('0x5b')][_0x2d2b('0x5c')](',');var _0x4adaf4={};_0x4adaf4[_0x3ad178[0x0]]={'$gte':moment(_0x3ad178[0x1])[_0x2d2b('0x5d')](_0x2d2b('0x5e'))};_0x16ff0f[_0x2d2b('0x3d')]=_['merge'](_0x16ff0f[_0x2d2b('0x3d')],_0x4adaf4);}_0x16ff0f=_[_0x2d2b('0x3e')]({},_0x16ff0f,_0x263df0[_0x2d2b('0x40')]);return _0x4d09ee[_0x2d2b('0x5a')](_0x16ff0f);}})[_0x2d2b('0x28')](function(_0x1beea8){if(_0x1beea8){_0x201ce7=_0x1beea8['length'];if(!_0x263df0[_0x2d2b('0x31')]['hasOwnProperty'](_0x2d2b('0x39'))){_0x16ff0f[_0x2d2b('0x23')]=qs[_0x2d2b('0x23')](_0x263df0[_0x2d2b('0x31')][_0x2d2b('0x23')]);_0x16ff0f['offset']=qs[_0x2d2b('0x21')](_0x263df0[_0x2d2b('0x31')][_0x2d2b('0x21')]);}return _0x4d09ee['getMessages'](_0x16ff0f);}})['then'](function(_0x745af6){if(_0x745af6){return _0x745af6?{'count':_0x201ce7,'rows':_0x745af6}:null;}})[_0x2d2b('0x28')](respondWithResult(_0x40bf4d,null))['catch'](handleError(_0x40bf4d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 8d31580..5c643bd 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 _0x1c77=['ChatGroup','setMaxListeners','save','update','emit','hasOwnProperty','../../mysqldb'];(function(_0x4d655e,_0x4804ac){var _0x23a831=function(_0x4a0914){while(--_0x4a0914){_0x4d655e['push'](_0x4d655e['shift']());}};_0x23a831(++_0x4804ac);}(_0x1c77,0xed));var _0x71c7=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x1c77[_0x506172];return _0x2723c0;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x71c7('0x0'))['db'][_0x71c7('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x71c7('0x2')](0x0);var events={'afterCreate':_0x71c7('0x3'),'afterUpdate':_0x71c7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29ab58){return function(_0x37620a,_0x1f314c,_0x305ff7){ChatGroupEvents[_0x71c7('0x5')](_0x29ab58+':'+_0x37620a['id'],_0x37620a);ChatGroupEvents[_0x71c7('0x5')](_0x29ab58,_0x37620a);_0x305ff7(null);};}for(var e in events){if(events[_0x71c7('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x7d8a=['ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d8a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa7d8('0x0'));var ChatGroup=require(_0xa7d8('0x1'))['db'][_0xa7d8('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xa7d8('0x3')](0x0);var events={'afterCreate':_0xa7d8('0x4'),'afterUpdate':_0xa7d8('0x5'),'afterDestroy':_0xa7d8('0x6')};function emitEvent(_0x2b5af1){return function(_0x14a7d3,_0x199cdd,_0x1162e1){ChatGroupEvents[_0xa7d8('0x7')](_0x2b5af1+':'+_0x14a7d3['id'],_0x14a7d3);ChatGroupEvents[_0xa7d8('0x7')](_0x2b5af1,_0x14a7d3);_0x1162e1(null);};}for(var e in events){if(events[_0xa7d8('0x8')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xa7d8('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 d386fa6..5f6c219 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 _0x894f=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','api','bluebird','rimraf'];(function(_0x4d1413,_0x311027){var _0x10dd2a=function(_0x19d9fd){while(--_0x19d9fd){_0x4d1413['push'](_0x4d1413['shift']());}};_0x10dd2a(++_0x311027);}(_0x894f,0x7f));var _0xf894=function(_0x55ab34,_0x18ca9f){_0x55ab34=_0x55ab34-0x0;var _0x1936da=_0x894f[_0x55ab34];return _0x1936da;};'use strict';var _=require(_0xf894('0x0'));var util=require('util');var logger=require(_0xf894('0x1'))(_0xf894('0x2'));var moment=require('moment');var BPromise=require(_0xf894('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf894('0x4'));var config=require(_0xf894('0x5'));var attributes=require(_0xf894('0x6'));module[_0xf894('0x7')]=function(_0x12e3eb,_0x10bc14){return _0x12e3eb[_0xf894('0x8')](_0xf894('0x9'),attributes,{'tableName':_0xf894('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8501=['../../config/logger','api','moment','../../config/environment','exports','ChatGroup','chat_groups','lodash','util'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x8501,0x11e));var _0x1850=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0x8501[_0x49ad79];return _0xa4e38a;};'use strict';var _=require(_0x1850('0x0'));var util=require(_0x1850('0x1'));var logger=require(_0x1850('0x2'))(_0x1850('0x3'));var moment=require(_0x1850('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1850('0x5'));var attributes=require('./chatGroup.attributes');module[_0x1850('0x6')]=function(_0x4ffcc9,_0x453fab){return _0x4ffcc9['define'](_0x1850('0x7'),attributes,{'tableName':_0x1850('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 12057d5..f601867 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 _0x8388=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x23ab7f,_0x4251d2){var _0x405ca9=function(_0x47e585){while(--_0x47e585){_0x23ab7f['push'](_0x23ab7f['shift']());}};_0x405ca9(++_0x4251d2);}(_0x8388,0x18d));var _0x8838=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8388[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x8838('0x0'));var util=require(_0x8838('0x1'));var moment=require(_0x8838('0x2'));var BPromise=require(_0x8838('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8838('0x4'));var db=require(_0x8838('0x5'))['db'];var utils=require(_0x8838('0x6'));var logger=require(_0x8838('0x7'))(_0x8838('0x8'));var config=require('../../config/environment');var jayson=require(_0x8838('0x9'));var client=jayson[_0x8838('0xa')]['http']({'port':0x232a});config[_0x8838('0xb')]=_[_0x8838('0xc')](config[_0x8838('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8838('0xd'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x8838('0xe')](socket);function respondWithRpcPromise(_0x4b5419,_0x4aedc9,_0x336b66){return new BPromise(function(_0x28de3d,_0x1e728e){return client[_0x8838('0xf')](_0x4b5419,_0x336b66)['then'](function(_0xd472af){logger[_0x8838('0x10')](_0x8838('0x11'),_0x4aedc9,_0x8838('0x12'));logger['debug'](_0x8838('0x13'),_0x4aedc9,'request\x20sent',JSON['stringify'](_0xd472af));if(_0xd472af[_0x8838('0x14')]){if(_0xd472af[_0x8838('0x14')][_0x8838('0x15')]===0x1f4){logger[_0x8838('0x14')](_0x8838('0x11'),_0x4aedc9,_0xd472af[_0x8838('0x14')][_0x8838('0x16')]);return _0x1e728e(_0xd472af[_0x8838('0x14')]['message']);}logger[_0x8838('0x14')](_0x8838('0x11'),_0x4aedc9,_0xd472af['error'][_0x8838('0x16')]);return _0x28de3d(_0xd472af[_0x8838('0x14')][_0x8838('0x16')]);}else{logger['info'](_0x8838('0x11'),_0x4aedc9,'request\x20sent');_0x28de3d(_0xd472af[_0x8838('0x17')][_0x8838('0x16')]);}})[_0x8838('0x18')](function(_0x4eb6e2){logger[_0x8838('0x14')](_0x8838('0x11'),_0x4aedc9,_0x4eb6e2);_0x1e728e(_0x4eb6e2);});});} \ No newline at end of file +var _0x514e=['info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x442955,_0x410333){var _0x14f4b3=function(_0x3f0bc3){while(--_0x3f0bc3){_0x442955['push'](_0x442955['shift']());}};_0x14f4b3(++_0x410333);}(_0x514e,0x146));var _0xe514=function(_0x3d260d,_0x52c05d){_0x3d260d=_0x3d260d-0x0;var _0x152dc1=_0x514e[_0x3d260d];return _0x152dc1;};'use strict';var _=require(_0xe514('0x0'));var util=require(_0xe514('0x1'));var moment=require(_0xe514('0x2'));var BPromise=require(_0xe514('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe514('0x4'));var db=require(_0xe514('0x5'))['db'];var utils=require(_0xe514('0x6'));var logger=require(_0xe514('0x7'))(_0xe514('0x8'));var config=require(_0xe514('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe514('0xa')][_0xe514('0xb')]({'port':0x232a});config[_0xe514('0xc')]=_[_0xe514('0xd')](config[_0xe514('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe514('0xe'))(new Redis(config[_0xe514('0xc')]));require(_0xe514('0xf'))['register'](socket);function respondWithRpcPromise(_0x343e58,_0x1109cd,_0xc51a5d){return new BPromise(function(_0x5f07c9,_0x3f370){return client[_0xe514('0x10')](_0x343e58,_0xc51a5d)['then'](function(_0x3a6350){logger['info'](_0xe514('0x11'),_0x1109cd,_0xe514('0x12'));logger[_0xe514('0x13')](_0xe514('0x14'),_0x1109cd,'request\x20sent',JSON[_0xe514('0x15')](_0x3a6350));if(_0x3a6350['error']){if(_0x3a6350[_0xe514('0x16')][_0xe514('0x17')]===0x1f4){logger['error'](_0xe514('0x11'),_0x1109cd,_0x3a6350['error'][_0xe514('0x18')]);return _0x3f370(_0x3a6350[_0xe514('0x16')][_0xe514('0x18')]);}logger[_0xe514('0x16')](_0xe514('0x11'),_0x1109cd,_0x3a6350[_0xe514('0x16')]['message']);return _0x5f07c9(_0x3a6350[_0xe514('0x16')][_0xe514('0x18')]);}else{logger[_0xe514('0x19')]('ChatGroup,\x20%s,\x20%s',_0x1109cd,_0xe514('0x12'));_0x5f07c9(_0x3a6350['result']['message']);}})[_0xe514('0x1a')](function(_0x46d7d1){logger[_0xe514('0x16')](_0xe514('0x11'),_0x1109cd,_0x46d7d1);_0x3f370(_0x46d7d1);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 327b2b9..0738ba6 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 _0xe765=['update','emit','register','length','chatGroup:','save','remove'];(function(_0x52ef06,_0x19c8c1){var _0x3d06d2=function(_0x437fb3){while(--_0x437fb3){_0x52ef06['push'](_0x52ef06['shift']());}};_0x3d06d2(++_0x19c8c1);}(_0xe765,0x11d));var _0x5e76=function(_0x4b351e,_0xad9b86){_0x4b351e=_0x4b351e-0x0;var _0x123e52=_0xe765[_0x4b351e];return _0x123e52;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x5e76('0x0'),_0x5e76('0x1'),_0x5e76('0x2')];function createListener(_0x2e2bd9,_0x1428ba){return function(_0xd42406){_0x1428ba[_0x5e76('0x3')](_0x2e2bd9,_0xd42406);};}function removeListener(_0x579f20,_0x188d83){return function(){ChatGroupEvents['removeListener'](_0x579f20,_0x188d83);};}exports[_0x5e76('0x4')]=function(_0x3113c6){for(var _0x2f016e=0x0,_0x33656e=events[_0x5e76('0x5')];_0x2f016e<_0x33656e;_0x2f016e++){var _0x32faec=events[_0x2f016e];var _0x3ad255=createListener(_0x5e76('0x6')+_0x32faec,_0x3113c6);ChatGroupEvents['on'](_0x32faec,_0x3ad255);}}; \ No newline at end of file +var _0x8b6b=['update','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x8b6b,0x6d));var _0xb8b6=function(_0xcb93bc,_0x5e45ca){_0xcb93bc=_0xcb93bc-0x0;var _0x214eb1=_0x8b6b[_0xcb93bc];return _0x214eb1;};'use strict';var ChatGroupEvents=require(_0xb8b6('0x0'));var events=[_0xb8b6('0x1'),_0xb8b6('0x2'),_0xb8b6('0x3')];function createListener(_0x3fd6e3,_0x4e4608){return function(_0x5d461d){_0x4e4608['emit'](_0x3fd6e3,_0x5d461d);};}function removeListener(_0x40cad3,_0x411479){return function(){ChatGroupEvents[_0xb8b6('0x4')](_0x40cad3,_0x411479);};}exports[_0xb8b6('0x5')]=function(_0x339b16){for(var _0x27549c=0x0,_0x1707ce=events[_0xb8b6('0x6')];_0x27549c<_0x1707ce;_0x27549c++){var _0x6ec1d9=events[_0x27549c];var _0x275723=createListener(_0xb8b6('0x7')+_0x6ec1d9,_0x339b16);ChatGroupEvents['on'](_0x6ec1d9,_0x275723);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index bfbfaee..0ec952c 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 _0x5291=['path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','addMessage','/:id','delete','removeMembers','exports','multer','util'];(function(_0x4f13f3,_0x350d48){var _0x2921cd=function(_0xc0125c){while(--_0xc0125c){_0x4f13f3['push'](_0x4f13f3['shift']());}};_0x2921cd(++_0x350d48);}(_0x5291,0xc6));var _0x1529=function(_0x1ca579,_0x38651d){_0x1ca579=_0x1ca579-0x0;var _0x5e9ea2=_0x5291[_0x1ca579];return _0x5e9ea2;};'use strict';var multer=require(_0x1529('0x0'));var util=require(_0x1529('0x1'));var path=require(_0x1529('0x2'));var timeout=require('connect-timeout');var express=require(_0x1529('0x3'));var router=express[_0x1529('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1529('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1529('0x6'));var controller=require('./chatGroup.controller');router[_0x1529('0x7')]('/',auth[_0x1529('0x8')](),controller[_0x1529('0x9')]);router[_0x1529('0x7')](_0x1529('0xa'),auth['isAuthenticated'](),controller[_0x1529('0xb')]);router[_0x1529('0x7')]('/:id',auth[_0x1529('0x8')](),controller['show']);router[_0x1529('0x7')]('/:id/unread',auth[_0x1529('0x8')](),controller[_0x1529('0xc')]);router[_0x1529('0x7')](_0x1529('0xd'),auth['isAuthenticated'](),controller[_0x1529('0xe')]);router[_0x1529('0x7')](_0x1529('0xf'),auth[_0x1529('0x8')](),controller[_0x1529('0x10')]);router['post']('/',auth[_0x1529('0x8')](),controller[_0x1529('0x11')]);router[_0x1529('0x12')](_0x1529('0xd'),auth[_0x1529('0x8')](),controller[_0x1529('0x13')]);router[_0x1529('0x12')](_0x1529('0xf'),auth[_0x1529('0x8')](),controller[_0x1529('0x14')]);router['put'](_0x1529('0x15'),auth[_0x1529('0x8')](),controller['update']);router[_0x1529('0x16')](_0x1529('0x15'),auth[_0x1529('0x8')](),controller['destroy']);router['delete'](_0x1529('0xd'),auth[_0x1529('0x8')](),controller[_0x1529('0x17')]);module[_0x1529('0x18')]=router; \ No newline at end of file +var _0x9981=['removeMembers','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id/unread','getUnread','getMembers','post','create','/:id/members','/:id/messages','put','delete','/:id','destroy'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x9981,0x1bc));var _0x1998=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9981[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require(_0x1998('0x0'));var path=require(_0x1998('0x1'));var timeout=require('connect-timeout');var express=require(_0x1998('0x2'));var router=express[_0x1998('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1998('0x4'));var interaction=require(_0x1998('0x5'));var config=require(_0x1998('0x6'));var controller=require(_0x1998('0x7'));router['get']('/',auth[_0x1998('0x8')](),controller[_0x1998('0x9')]);router[_0x1998('0xa')](_0x1998('0xb'),auth[_0x1998('0x8')](),controller[_0x1998('0xc')]);router['get']('/:id',auth[_0x1998('0x8')](),controller['show']);router[_0x1998('0xa')](_0x1998('0xd'),auth[_0x1998('0x8')](),controller[_0x1998('0xe')]);router[_0x1998('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0x1998('0xf')]);router[_0x1998('0xa')]('/:id/messages',auth[_0x1998('0x8')](),controller['getMessages']);router[_0x1998('0x10')]('/',auth['isAuthenticated'](),controller[_0x1998('0x11')]);router['post'](_0x1998('0x12'),auth[_0x1998('0x8')](),controller['addMembers']);router[_0x1998('0x10')](_0x1998('0x13'),auth['isAuthenticated'](),controller['addMessage']);router[_0x1998('0x14')]('/:id',auth[_0x1998('0x8')](),controller['update']);router[_0x1998('0x15')](_0x1998('0x16'),auth['isAuthenticated'](),controller[_0x1998('0x17')]);router[_0x1998('0x15')](_0x1998('0x12'),auth[_0x1998('0x8')](),controller[_0x1998('0x18')]);module[_0x1998('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 37d2434..6b67bf3 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 _0x4bde=['STRING','DATE','long','out','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x550ae2,_0x395896){_0x550ae2=_0x550ae2-0x0;var _0x236657=_0x4bde[_0x550ae2];return _0x236657;};'use strict';var Sequelize=require(_0xe4bd('0x0'));module[_0xe4bd('0x1')]={'closed':{'type':Sequelize[_0xe4bd('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xe4bd('0x3')](_0xe4bd('0x4'),_0xe4bd('0x5')),'defaultValue':_0xe4bd('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xe4bd('0x6')]},'mailTranscript':{'type':Sequelize[_0xe4bd('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xe4bd('0x8')]},'disposition':{'type':Sequelize[_0xe4bd('0x7')]},'secondDisposition':{'type':Sequelize[_0xe4bd('0x7')]},'thirdDisposition':{'type':Sequelize[_0xe4bd('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xe4bd('0x7')]},'browserVersion':{'type':Sequelize[_0xe4bd('0x7')]},'osName':{'type':Sequelize[_0xe4bd('0x7')]},'osVersion':{'type':Sequelize[_0xe4bd('0x7')]},'deviceModel':{'type':Sequelize[_0xe4bd('0x7')]},'deviceVendor':{'type':Sequelize[_0xe4bd('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xe4bd('0x6')](_0xe4bd('0x9'))},'read1stAt':{'type':Sequelize[_0xe4bd('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe4bd('0x3')]('in',_0xe4bd('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xe4bd('0x7')]},'customerPort':{'type':Sequelize[_0xe4bd('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xe4bd('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8e44=['BOOLEAN','star','thumb','TEXT','STRING','DATE','long','out','sequelize','exports'];(function(_0x1b1c3d,_0x1f36ce){var _0x4f2fe5=function(_0x35263e){while(--_0x35263e){_0x1b1c3d['push'](_0x1b1c3d['shift']());}};_0x4f2fe5(++_0x1f36ce);}(_0x8e44,0x1ac));var _0x48e4=function(_0x344dc4,_0x50eb33){_0x344dc4=_0x344dc4-0x0;var _0x3e722f=_0x8e44[_0x344dc4];return _0x3e722f;};'use strict';var Sequelize=require(_0x48e4('0x0'));module[_0x48e4('0x1')]={'closed':{'type':Sequelize[_0x48e4('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x48e4('0x3'),_0x48e4('0x4')),'defaultValue':_0x48e4('0x3')},'ratingMessage':{'type':Sequelize[_0x48e4('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x48e4('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x48e4('0x7')]},'disposition':{'type':Sequelize[_0x48e4('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x48e4('0x6')]},'browserName':{'type':Sequelize[_0x48e4('0x6')]},'browserVersion':{'type':Sequelize[_0x48e4('0x6')]},'osName':{'type':Sequelize[_0x48e4('0x6')]},'osVersion':{'type':Sequelize[_0x48e4('0x6')]},'deviceModel':{'type':Sequelize[_0x48e4('0x6')]},'deviceVendor':{'type':Sequelize[_0x48e4('0x6')]},'deviceType':{'type':Sequelize[_0x48e4('0x6')]},'referer':{'type':Sequelize[_0x48e4('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x48e4('0x5')](_0x48e4('0x8'))},'read1stAt':{'type':Sequelize[_0x48e4('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x48e4('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x48e4('0x6')]},'customerPort':{'type':Sequelize[_0x48e4('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x48e4('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 0fc706d..942e4d7 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 _0x3164=['unlinkSync','rimraf','bluebird','mustache','util','path','lodash','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','ChatInteraction,\x20%s,\x20%s','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','stack','name','merge','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','query','params','keys','attributes','intersection','fields','length','include','find','create','body','describe','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','sendStatus','Interaction\x20already\x20assigned','closed','AbandonInteraction','originalname','file','mimetype','Attachment','ChatOfflineMessageId','join','offline-chat/','basename','mailTranscript','root','format','transcript-%s.txt','Messages','User','ChatWebsite','ContactId','UserId','%s%d','agentAlias','Visitor','website_alias','agent_alias','alias','fullname','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','model','filters','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','secret','options','includeAgent','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','read','Account','Owner','get','mkdirSync','N.A.','disposition','browserName','osName','referer','customerIp','customerPort','createReadStream','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','err'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0x3164,0x18b));var _0x4316=function(_0x3add15,_0x1556a8){_0x3add15=_0x3add15-0x0;var _0x4171d0=_0x3164[_0x3add15];return _0x4171d0;};'use strict';var rimraf=require(_0x4316('0x0'));var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4316('0x1'));var Mustache=require(_0x4316('0x2'));var util=require(_0x4316('0x3'));var path=require(_0x4316('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4316('0x5'));var Redis=require('ioredis');var interaction=require(_0x4316('0x6'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x4316('0x7'))('api');var config=require(_0x4316('0x8'));var db=require(_0x4316('0x9'))['db'];config[_0x4316('0xa')]=_['defaults'](config[_0x4316('0xa')],{'host':_0x4316('0xb'),'port':0x18eb});var socket=require(_0x4316('0xc'))(new Redis(config[_0x4316('0xa')]));require(_0x4316('0xd'))[_0x4316('0xe')](socket);var jayson=require(_0x4316('0xf'));var client=jayson[_0x4316('0x10')][_0x4316('0x11')]({'port':0x232b});var client9004=jayson[_0x4316('0x10')][_0x4316('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x2582f0,_0x2f7ea7,_0x47ff00,_0x349e82){return new BPromise(function(_0x45606a,_0x473fe0){var _0xdc18b7=_0x349e82||client;return _0xdc18b7[_0x4316('0x12')](_0x2582f0,_0x47ff00)[_0x4316('0x13')](function(_0x216a87){logger[_0x4316('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x2f7ea7,_0x4316('0x15'));logger['debug'](_0x4316('0x16'),_0x2f7ea7,_0x4316('0x15'),JSON['stringify'](_0x216a87));if(_0x216a87[_0x4316('0x17')]){if(_0x216a87[_0x4316('0x17')][_0x4316('0x18')]===0x1f4){logger[_0x4316('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x2f7ea7,_0x216a87[_0x4316('0x17')][_0x4316('0x19')]);return _0x473fe0(_0x216a87[_0x4316('0x17')][_0x4316('0x19')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2f7ea7,_0x216a87[_0x4316('0x17')][_0x4316('0x19')]);return _0x45606a(_0x216a87[_0x4316('0x17')][_0x4316('0x19')]);}else{logger[_0x4316('0x14')](_0x4316('0x1a'),_0x2f7ea7,_0x4316('0x15'));_0x45606a(_0x216a87['result'][_0x4316('0x19')]);}})[_0x4316('0x1b')](function(_0x2b35b3){logger[_0x4316('0x17')](_0x4316('0x1a'),_0x2f7ea7,_0x2b35b3);_0x473fe0(_0x2b35b3);});});}function respondWithStatusCode(_0x3bc68c,_0x489c9c){_0x489c9c=_0x489c9c||0xcc;return function(_0x40446d){if(_0x40446d){return _0x3bc68c['sendStatus'](_0x489c9c);}return _0x3bc68c[_0x4316('0x1c')](_0x489c9c)[_0x4316('0x1d')]();};}function respondWithResult(_0x1a1dd7,_0x486a15){_0x486a15=_0x486a15||0xc8;return function(_0x170384){if(_0x170384){return _0x1a1dd7[_0x4316('0x1c')](_0x486a15)[_0x4316('0x1e')](_0x170384);}};}function respondWithFilteredResult(_0x51dccd,_0x3caeda){return function(_0x15e63d){if(_0x15e63d){var _0x388dc3=typeof _0x3caeda[_0x4316('0x1f')]==='undefined'&&typeof _0x3caeda[_0x4316('0x20')]===_0x4316('0x21');var _0x3e2eb0=_0x15e63d[_0x4316('0x22')];var _0x10e7e5=_0x388dc3?0x0:_0x3caeda['offset'];var _0x4e5670=_0x388dc3?_0x15e63d[_0x4316('0x22')]:_0x3caeda[_0x4316('0x1f')]+_0x3caeda[_0x4316('0x20')];var _0x4da7aa;if(_0x4e5670>=_0x3e2eb0){_0x4e5670=_0x3e2eb0;_0x4da7aa=0xc8;}else{_0x4da7aa=0xce;}_0x51dccd[_0x4316('0x1c')](_0x4da7aa);return _0x51dccd[_0x4316('0x23')](_0x4316('0x24'),_0x10e7e5+'-'+_0x4e5670+'/'+_0x3e2eb0)[_0x4316('0x1e')](_0x15e63d);}return null;};}function saveUpdates(_0x2b9b3f){return function(_0x32e5a6){if(_0x32e5a6){return _0x32e5a6[_0x4316('0x25')](_0x2b9b3f)[_0x4316('0x13')](function(_0x59a6e6){return _0x59a6e6;});}return null;};}function removeEntity(_0x155718){return function(_0x339008){if(_0x339008){return _0x339008[_0x4316('0x26')]()[_0x4316('0x13')](function(){_0x155718[_0x4316('0x1c')](0xcc)[_0x4316('0x1d')]();});}};}function handleEntityNotFound(_0x56cd16){return function(_0x3830a7){if(!_0x3830a7){_0x56cd16['sendStatus'](0x194);}return _0x3830a7;};}function handleError(_0x553aff,_0x301dff){_0x301dff=_0x301dff||0x1f4;return function(_0xe9c243){logger[_0x4316('0x17')](_0xe9c243[_0x4316('0x27')]);if(_0xe9c243[_0x4316('0x28')]){delete _0xe9c243[_0x4316('0x28')];}_0x553aff[_0x4316('0x1c')](_0x301dff)['send'](_0xe9c243);};}function getMustacheRender(_0x58d3e6,_0x3ea64b){return Mustache['render'](_0x58d3e6,_[_0x4316('0x29')](_0x3ea64b['body'],{'contact':_0x3ea64b[_0x4316('0x2a')],'message':_0x3ea64b[_0x4316('0x19')],'agent':_0x3ea64b[_0x4316('0x2b')],'interaction':_0x3ea64b[_0x4316('0x2c')],'account':_0x3ea64b[_0x4316('0x2d')]}))||'';}exports[_0x4316('0x2e')]=function(_0x28f59e,_0x584069){var _0x57ab81={};var _0x4af228=_[_0x4316('0x2f')](db[_0x4316('0x30')][_0x4316('0x31')],function(_0x391b6b){return{'name':_0x391b6b[_0x4316('0x32')],'type':_0x391b6b[_0x4316('0x33')][_0x4316('0x34')]};});_0x57ab81=qs[_0x4316('0x35')](_0x4af228,_0x28f59e);return interaction['findAll']('chat',_0x28f59e[_0x4316('0x36')],_0x28f59e['user'],_0x57ab81,_0x4af228)[_0x4316('0x13')](respondWithFilteredResult(_0x584069,_0x57ab81))[_0x4316('0x1b')](handleError(_0x584069,null));};exports['show']=function(_0x41b90f,_0xd7919b){var _0x1ac8f6={'raw':![],'where':{'id':_0x41b90f[_0x4316('0x37')]['id']}},_0x3883ef={};_0x3883ef['model']=_[_0x4316('0x38')](db[_0x4316('0x30')][_0x4316('0x31')]);_0x3883ef[_0x4316('0x36')]=_[_0x4316('0x38')](_0x41b90f[_0x4316('0x36')]);_0x3883ef['filters']=_['intersection'](_0x3883ef['model'],_0x3883ef[_0x4316('0x36')]);_0x1ac8f6[_0x4316('0x39')]=_[_0x4316('0x3a')](_0x3883ef['model'],qs['fields'](_0x41b90f[_0x4316('0x36')][_0x4316('0x3b')]));_0x1ac8f6[_0x4316('0x39')]=_0x1ac8f6[_0x4316('0x39')][_0x4316('0x3c')]?_0x1ac8f6[_0x4316('0x39')]:_0x3883ef['model'];if(_0x41b90f[_0x4316('0x36')]['includeAll']){_0x1ac8f6[_0x4316('0x3d')]=[{'all':!![]}];}_0x1ac8f6=_[_0x4316('0x29')]({},_0x1ac8f6,_0x41b90f['options']);return db['ChatInteraction'][_0x4316('0x3e')](_0x1ac8f6)[_0x4316('0x13')](handleEntityNotFound(_0xd7919b,null))['then'](respondWithResult(_0xd7919b,null))[_0x4316('0x1b')](handleError(_0xd7919b,null));};exports[_0x4316('0x3f')]=function(_0x2819bc,_0x2f38c1){return db[_0x4316('0x30')][_0x4316('0x3f')](_0x2819bc[_0x4316('0x40')],{})[_0x4316('0x13')](respondWithResult(_0x2f38c1,0xc9))[_0x4316('0x1b')](handleError(_0x2f38c1,null));};exports['update']=function(_0x24beb9,_0x3591de){if(_0x24beb9[_0x4316('0x40')]['id']){delete _0x24beb9[_0x4316('0x40')]['id'];}return db[_0x4316('0x30')][_0x4316('0x3e')]({'where':{'id':_0x24beb9[_0x4316('0x37')]['id']}})[_0x4316('0x13')](handleEntityNotFound(_0x3591de,null))[_0x4316('0x13')](saveUpdates(_0x24beb9[_0x4316('0x40')],null))[_0x4316('0x13')](respondWithResult(_0x3591de,null))['catch'](handleError(_0x3591de,null));};exports['destroy']=function(_0x52de26,_0x2a0da8){return db['ChatInteraction'][_0x4316('0x3e')]({'where':{'id':_0x52de26[_0x4316('0x37')]['id']}})['then'](handleEntityNotFound(_0x2a0da8,null))[_0x4316('0x13')](removeEntity(_0x2a0da8,null))[_0x4316('0x1b')](handleError(_0x2a0da8,null));};exports[_0x4316('0x41')]=function(_0x336ead,_0x4dde34){return db[_0x4316('0x30')]['describe']()[_0x4316('0x13')](respondWithResult(_0x4dde34,null))[_0x4316('0x1b')](handleError(_0x4dde34,null));};exports['createVidaooSession']=function(_0x45c72a,_0x1c47b2){var _0xd1f897=_0x45c72a[_0x4316('0x37')]['id'];var _0x18583a;var _0x2b82e1;var _0x22e422;return db[_0x4316('0x30')][_0x4316('0x42')]({'where':{'id':_0xd1f897}})[_0x4316('0x13')](function(_0x46a84){_0x18583a=_0x46a84;return db['ChatWebsite'][_0x4316('0x42')]({'where':{'id':_0x46a84[_0x4316('0x43')]},'attributes':['id',_0x4316('0x44'),_0x4316('0x45'),_0x4316('0x46'),_0x4316('0x47'),_0x4316('0x48')],'raw':!![]});})['then'](function(_0x424903){if(_0x424903&&_0x424903['vidaooApiKey']&&_0x424903[_0x4316('0x45')]){_0x2b82e1=_0x424903;var _0x1b7fc2={'interaction':{'id':_0xd1f897},'agent':{'id':_0x45c72a[_0x4316('0x49')]['id'],'name':_0x45c72a['user']['name'],'fullname':_0x45c72a[_0x4316('0x49')]['fullname'],'email':_0x45c72a['user'][_0x4316('0x4a')]},'contact':_0x45c72a['body'][_0x4316('0x2a')],'account':_0x45c72a['body'][_0x4316('0x2d')]};var _0x1adbb5={'rejectUnauthorized':![],'method':'POST','url':_0x4316('0x4b'),'headers':{'X-APIKEY':_0x424903[_0x4316('0x44')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x45c72a[_0x4316('0x49')][_0x4316('0x4a')]],'buttons':null,'topic':_0x2b82e1[_0x4316('0x46')],'note':_[_0x4316('0x4c')](_0x2b82e1['vidaooNote'])?null:getMustacheRender(_0x2b82e1[_0x4316('0x47')],_0x1b7fc2),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x4316('0x4c')](_0x2b82e1[_0x4316('0x48')])){var _0x4db346=getMustacheRender(_0x2b82e1['vidaooMetadata'],_0x1b7fc2);var _0x6f263b=JSON[_0x4316('0x4d')](_0x4db346);_0x1adbb5[_0x4316('0x40')]['metadata']=_0x6f263b;}}catch(_0x137afc){throw new db[(_0x4316('0x4e'))]['ValidationError'](_0x4316('0x4f'));}return rp(_0x1adbb5);}else{throw new db['Sequelize']['ValidationError'](_0x4316('0x50'));}})[_0x4316('0x13')](function(_0x148af6){_0x22e422=_0x148af6;if(_0x22e422['id']){var _0x4cb86c={'body':_0x22e422['join_url'],'ChatWebsiteId':_0x2b82e1['id'],'ChatInteractionId':_0x18583a['id'],'direction':_0x4316('0x51'),'UserId':_0x45c72a[_0x4316('0x49')]['id']};return db[_0x4316('0x52')][_0x4316('0x3f')](_0x4cb86c,{});}else{throw new db[(_0x4316('0x4e'))][(_0x4316('0x53'))](_0x4316('0x54'));}})[_0x4316('0x13')](function(){return _0x18583a[_0x4316('0x55')]({'vidaooSessionId':_0x22e422['id']});})[_0x4316('0x13')](respondWithResult(_0x1c47b2,null))[_0x4316('0x1b')](handleError(_0x1c47b2,null));};exports['customUpdate']=function(_0x34f555,_0x208fcf){if(_0x34f555[_0x4316('0x40')]['id']){delete _0x34f555[_0x4316('0x40')]['id'];}return db['ChatInteraction'][_0x4316('0x3e')]({'where':{'id':_0x34f555['params']['id']},'include':[{'model':db[_0x4316('0x56')],'as':_0x4316('0x57')}]})[_0x4316('0x13')](handleEntityNotFound(_0x208fcf,null))[_0x4316('0x13')](saveUpdates(_0x34f555[_0x4316('0x40')],null))[_0x4316('0x13')](respondWithResult(_0x208fcf,null))[_0x4316('0x1b')](handleError(_0x208fcf,null));};exports[_0x4316('0x58')]=function(_0x21f94c,_0x429e6c){if(_0x21f94c[_0x4316('0x40')]['id']){delete _0x21f94c[_0x4316('0x40')]['id'];}return db['ChatInteraction'][_0x4316('0x3e')]({'where':{'id':_0x21f94c[_0x4316('0x37')]['id']}})['then'](function(_0x990fb3){if(!_0x990fb3){logger[_0x4316('0x17')](_0x4316('0x59'),'abandon',0x194,'entity\x20not\x20found');_0x429e6c[_0x4316('0x5a')](0x194);}else{if(_0x990fb3['UserId']){throw new db[(_0x4316('0x4e'))]['ValidationError'](_0x4316('0x5b'));}}return _0x990fb3;})[_0x4316('0x13')](function(_0x55e732){if(_0x55e732){return _0x55e732['update']({'closed':_0x21f94c[_0x4316('0x40')][_0x4316('0x5c')],'disposition':_0x21f94c[_0x4316('0x40')]['disposition']})[_0x4316('0x13')](function(_0x1065a0){return _0x1065a0;});}})[_0x4316('0x13')](function(){return respondWithRpcPromise(_0x4316('0x5d'),_0x4316('0x58'),_0x21f94c[_0x4316('0x40')],client9004);})[_0x4316('0x13')](respondWithResult(_0x429e6c,null))[_0x4316('0x1b')](handleError(_0x429e6c,null));};exports['attachmentUpload']=function(_0x2bd942,_0x3b3cd9){_0x2bd942[_0x4316('0x40')][_0x4316('0x28')]=_0x2bd942['file'][_0x4316('0x5e')];_0x2bd942[_0x4316('0x40')]['basename']=_0x2bd942['file']['filename'];_0x2bd942[_0x4316('0x40')][_0x4316('0x33')]=_0x2bd942[_0x4316('0x5f')][_0x4316('0x60')];return db[_0x4316('0x61')][_0x4316('0x3f')](_0x2bd942[_0x4316('0x40')])['then'](respondWithResult(_0x3b3cd9,0xc9))[_0x4316('0x1b')](handleError(_0x3b3cd9,null));};exports['attachmentDownload']=function(_0x456f42,_0x53465d){return db[_0x4316('0x30')]['findOne']({'where':{'id':_0x456f42[_0x4316('0x37')]['id']},'raw':!![]})[_0x4316('0x13')](handleEntityNotFound(_0x53465d,null))['then'](function(_0x19671e){if(_0x19671e){if(_0x19671e[_0x4316('0x5c')]){return _0x53465d['status'](0x193)[_0x4316('0x1e')]({'status':0x193,'message':'Unauthorized'});}return db[_0x4316('0x61')][_0x4316('0x42')]({'where':{'id':_0x456f42[_0x4316('0x36')]['attachId']},'raw':!![]})[_0x4316('0x13')](handleEntityNotFound(_0x53465d,null));}})[_0x4316('0x13')](function(_0x11ec60){if(_0x11ec60){var _0x3cb51a=_0x11ec60[_0x4316('0x62')]!==null;var _0x2b7be6=path[_0x4316('0x63')](config['root'],'server/files/attachments/');if(_0x3cb51a){_0x2b7be6=path[_0x4316('0x63')](_0x2b7be6,_0x4316('0x64'));}var _0x2a99dc=path['join'](_0x2b7be6,_0x11ec60[_0x4316('0x65')]);return _0x53465d['download'](_0x2a99dc);}})[_0x4316('0x1b')](handleError(_0x53465d,null));};exports['close']=function(_0x391aa5,_0x55bd88){var _0x54bace=null;var _0x55408b=null;var _0x4fec6d=null;if(_0x391aa5[_0x4316('0x40')]['id']){delete _0x391aa5[_0x4316('0x40')]['id'];}if(_0x391aa5[_0x4316('0x40')][_0x4316('0x66')]){_0x4fec6d=path[_0x4316('0x63')](config[_0x4316('0x67')],'server/files/chat/upload/',util[_0x4316('0x68')](_0x4316('0x69'),Date['now']()));_0x391aa5[_0x4316('0x40')]['pathTranscript']=_0x4fec6d;}return db[_0x4316('0x30')]['find']({'where':{'id':_0x391aa5[_0x4316('0x37')]['id']},'include':[{'model':db[_0x4316('0x52')],'as':_0x4316('0x6a'),'include':[{'model':db[_0x4316('0x6b')],'as':_0x4316('0x6b')}]}]})[_0x4316('0x13')](handleEntityNotFound(_0x55bd88,null))[_0x4316('0x13')](saveUpdates(_0x391aa5[_0x4316('0x40')],null))['then'](function(_0x1182b2){if(_0x1182b2){_0x54bace=_0x1182b2;return db[_0x4316('0x6c')]['find']({'where':{'id':_0x54bace['ChatWebsiteId']}});}})[_0x4316('0x13')](function(_0x16bdfc){if(_0x16bdfc){_0x55408b=_0x16bdfc;return db[_0x4316('0x56')][_0x4316('0x3e')]({'where':{'id':_0x54bace[_0x4316('0x6d')]}});}})[_0x4316('0x13')](function(_0x3af946){if(_0x3af946){if(_0x4fec6d){var _0x3faef3=null;for(var _0x183caa=0x1;_0x183caa<_0x54bace[_0x4316('0x6a')][_0x4316('0x3c')];++_0x183caa){_0x3faef3=_0x54bace['Messages'][_0x183caa];var _0xc25d0a=_0x3faef3[_0x4316('0x6e')]?util[_0x4316('0x68')](_0x4316('0x6f'),_0x55408b[_0x4316('0x70')],_0x3faef3['UserId']):'System';var _0x49b5d8=_0x391aa5[_0x4316('0x40')]['customer']||util[_0x4316('0x68')](_0x4316('0x6f'),_0x4316('0x71'),_0x3faef3[_0x4316('0x6d')]);switch(_0x55408b['agentIdentifier']){case _0x4316('0x72'):_0xc25d0a=_0x3faef3[_0x4316('0x6e')]?util['format'](_0x4316('0x6f'),_0x55408b[_0x4316('0x70')],_0x3faef3[_0x4316('0x6e')]):'System';break;case _0x4316('0x73'):_0xc25d0a=_0x3faef3['UserId']?_0x3faef3['User'][_0x4316('0x74')]||_0x3faef3['User'][_0x4316('0x75')]:_0x4316('0x76');break;case _0x4316('0x77'):_0xc25d0a=_0x3faef3[_0x4316('0x6e')]?_0x3faef3[_0x4316('0x6b')]['fullname']:_0x4316('0x76');break;default:_0xc25d0a=_0x3faef3[_0x4316('0x6e')]?util[_0x4316('0x68')](_0x4316('0x6f'),_0x55408b[_0x4316('0x70')],_0x3faef3[_0x4316('0x6e')]):_0x4316('0x76');}var _0x5b18f8=util[_0x4316('0x68')](_0x4316('0x78'),moment(_0x3faef3[_0x4316('0x79')])['format'](_0x4316('0x7a')),_0x3faef3[_0x4316('0x7b')]==='in'?_0x49b5d8:_0xc25d0a,_0x3faef3[_0x4316('0x40')]);if(!_0x3faef3['secret']){fs['appendFileSync'](_0x4fec6d,_0x5b18f8);}}return db['MailAccount'][_0x4316('0x42')]({'where':{'service':!![]},'include':[{'model':db[_0x4316('0x7c')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x4316('0x7d')],'as':_0x4316('0x7d'),'raw':!![]}]}]});}}})[_0x4316('0x13')](function(_0x534fca){if(!_0x534fca||!_0x534fca[_0x4316('0x7e')]||!_0x391aa5[_0x4316('0x40')])return _0x54bace;var _0x1b4231=_0x534fca[_0x4316('0x7f')]();return respondWithRpcPromise(_0x4316('0x80'),_0x4316('0x81'),{'account':_0x1b4231,'message':{'from':util['format'](_0x4316('0x82'),_0x534fca[_0x4316('0x28')],_0x534fca[_0x4316('0x4a')]||_0x534fca['Smtp'][_0x4316('0x49')]),'to':_0x391aa5[_0x4316('0x40')][_0x4316('0x66')],'subject':'Mail\x20Transcript','text':util[_0x4316('0x68')](_0x4316('0x83'),_0x391aa5[_0x4316('0x40')][_0x4316('0x66')]),'attachments':[{'path':_0x4fec6d}]}})['then'](function(){return _0x54bace;})['catch'](function(_0x4886fd){logger[_0x4316('0x17')](_0x4886fd);});})[_0x4316('0x13')](respondWithStatusCode(_0x55bd88,0xc8))[_0x4316('0x1b')](handleError(_0x55bd88,null));};exports[_0x4316('0x84')]=function(_0x52c7ff,_0x28e349){return db['ChatMessage'][_0x4316('0x3e')]({'where':{'id':_0x52c7ff[_0x4316('0x37')]['id']}})[_0x4316('0x13')](handleEntityNotFound(_0x28e349,null))[_0x4316('0x13')](function(_0x1d52e1){if(_0x1d52e1){return _0x1d52e1[_0x4316('0x84')](_0x52c7ff[_0x4316('0x40')]['ids'],_[_0x4316('0x85')](_0x52c7ff[_0x4316('0x40')],[_0x4316('0x86'),'id'])||{});}})[_0x4316('0x13')](respondWithResult(_0x28e349,null))[_0x4316('0x1b')](handleError(_0x28e349,null));};exports[_0x4316('0x87')]=function(_0x10368d,_0x3efa55){var _0x13b744={'raw':![],'where':{}};var _0x5d84ae={};var _0x4ac7f5={'count':0x0,'rows':[]};return db[_0x4316('0x30')][_0x4316('0x42')]({'where':{'id':_0x10368d[_0x4316('0x37')]['id']}})[_0x4316('0x13')](handleEntityNotFound(_0x3efa55,null))['then'](function(_0x3dea94){if(_0x3dea94){_0x5d84ae[_0x4316('0x88')]=_[_0x4316('0x38')](db['ChatMessage'][_0x4316('0x31')]);_0x5d84ae[_0x4316('0x36')]=_[_0x4316('0x38')](_0x10368d[_0x4316('0x36')]);_0x5d84ae[_0x4316('0x89')]=_[_0x4316('0x3a')](_0x5d84ae['model'],_0x5d84ae[_0x4316('0x36')]);_0x13b744[_0x4316('0x39')]=_['intersection'](_0x5d84ae[_0x4316('0x88')],qs['fields'](_0x10368d[_0x4316('0x36')][_0x4316('0x3b')]));_0x13b744[_0x4316('0x39')]=_0x13b744[_0x4316('0x39')][_0x4316('0x3c')]?_0x13b744[_0x4316('0x39')]:_0x5d84ae[_0x4316('0x88')];if(!_0x10368d['query'][_0x4316('0x8a')](_0x4316('0x8b'))){_0x13b744[_0x4316('0x20')]=qs['limit'](_0x10368d[_0x4316('0x36')][_0x4316('0x20')]);_0x13b744[_0x4316('0x1f')]=qs[_0x4316('0x1f')](_0x10368d[_0x4316('0x36')]['offset']);}_0x13b744[_0x4316('0x8c')]=qs[_0x4316('0x8d')](_0x10368d[_0x4316('0x36')][_0x4316('0x8d')]);_0x13b744[_0x4316('0x8e')]=qs['filters'](_[_0x4316('0x8f')](_0x10368d['query'],_0x5d84ae[_0x4316('0x89')]));_0x13b744['where'][_0x4316('0x90')]=_0x3dea94['id'];if(_0x10368d[_0x4316('0x36')][_0x4316('0x91')]){_0x13b744[_0x4316('0x8e')]=_[_0x4316('0x29')](_0x13b744['where'],{'$or':_[_0x4316('0x2f')](_0x13b744[_0x4316('0x39')],function(_0x3b928b){var _0x2cfc0c={};_0x2cfc0c[_0x3b928b]={'$like':'%'+_0x10368d[_0x4316('0x36')][_0x4316('0x91')]+'%'};return _0x2cfc0c;})});}if(_0x10368d[_0x4316('0x36')][_0x4316('0x92')]){var _0x2bc75d=_0x10368d[_0x4316('0x36')][_0x4316('0x92')][_0x4316('0x93')](',');var _0x5c8cc4={};_0x5c8cc4[_0x2bc75d[0x0]]={'$gte':moment(_0x2bc75d[0x1])['format'](_0x4316('0x94'))};_0x13b744[_0x4316('0x8e')]=_[_0x4316('0x29')](_0x13b744[_0x4316('0x8e')],_0x5c8cc4);}_0x13b744=_[_0x4316('0x29')]({},_0x13b744,_0x10368d['options']);return db[_0x4316('0x52')][_0x4316('0x22')]({'where':_0x13b744[_0x4316('0x8e')]})[_0x4316('0x13')](function(_0x4b9386){_0x4ac7f5[_0x4316('0x22')]=_0x4b9386;if(_0x10368d[_0x4316('0x36')][_0x4316('0x95')]){_0x13b744['include']=[{'all':!![]}];}return db['ChatMessage'][_0x4316('0x96')](_0x13b744);})[_0x4316('0x13')](function(_0x1aee4a){_0x4ac7f5[_0x4316('0x97')]=_0x1aee4a;return _0x4ac7f5;});}})['then'](respondWithFilteredResult(_0x3efa55,_0x13b744))[_0x4316('0x1b')](handleError(_0x3efa55,null));};exports['getMyMessages']=function(_0x11cd0d,_0x234bbb){var _0x4e3c41={'where':{}},_0xb2dca2={},_0x15872a={'count':0x0,'rows':[]};return db[_0x4316('0x30')]['findOne']({'where':{'id':_0x11cd0d[_0x4316('0x37')]['id']}})[_0x4316('0x13')](handleEntityNotFound(_0x234bbb,null))[_0x4316('0x13')](function(_0xeacd3e){if(_0xeacd3e){_0xb2dca2[_0x4316('0x88')]=_['keys'](db['ChatMessage'][_0x4316('0x31')]);_0xb2dca2['query']=_[_0x4316('0x38')](_0x11cd0d[_0x4316('0x36')]);_0xb2dca2[_0x4316('0x89')]=_[_0x4316('0x3a')](_0xb2dca2[_0x4316('0x88')],_0xb2dca2[_0x4316('0x36')]);_0x4e3c41[_0x4316('0x39')]=_[_0x4316('0x3a')](_0xb2dca2[_0x4316('0x88')],qs[_0x4316('0x3b')](_0x11cd0d[_0x4316('0x36')][_0x4316('0x3b')]));_0x4e3c41['attributes']=_0x4e3c41['attributes'][_0x4316('0x3c')]?_0x4e3c41[_0x4316('0x39')]:_0xb2dca2[_0x4316('0x88')];if(!_0x11cd0d[_0x4316('0x36')]['hasOwnProperty'](_0x4316('0x8b'))){_0x4e3c41['limit']=qs[_0x4316('0x20')](_0x11cd0d[_0x4316('0x36')][_0x4316('0x20')]);_0x4e3c41[_0x4316('0x1f')]=qs[_0x4316('0x1f')](_0x11cd0d['query'][_0x4316('0x1f')]);}_0x4e3c41[_0x4316('0x8c')]=qs[_0x4316('0x8d')](_0x11cd0d['query'][_0x4316('0x8d')]);_0x4e3c41[_0x4316('0x8e')]=qs['filters'](_[_0x4316('0x8f')](_0x11cd0d[_0x4316('0x36')],_0xb2dca2[_0x4316('0x89')]));_0x4e3c41[_0x4316('0x8e')][_0x4316('0x90')]=_0xeacd3e['id'];if(_0x11cd0d['query']['filter']){_0x4e3c41['where']=_[_0x4316('0x29')](_0x4e3c41[_0x4316('0x8e')],{'$or':_[_0x4316('0x2f')](_0x4e3c41[_0x4316('0x39')],function(_0x2ef3e8){var _0x12c40d={};_0x12c40d[_0x2ef3e8]={'$like':'%'+_0x11cd0d[_0x4316('0x36')][_0x4316('0x91')]+'%'};return _0x12c40d;})});}_0x4e3c41[_0x4316('0x8e')][_0x4316('0x98')]=![];if(_0x11cd0d[_0x4316('0x36')]['id']){_0x4e3c41[_0x4316('0x8e')]['id']={'$gt':_0x11cd0d['query']['id']};}_0x4e3c41=_[_0x4316('0x29')]({},_0x4e3c41,_0x11cd0d[_0x4316('0x99')]);return db[_0x4316('0x52')][_0x4316('0x22')]({'where':_0x4e3c41[_0x4316('0x8e')]})[_0x4316('0x13')](function(_0x250192){_0x15872a[_0x4316('0x22')]=_0x250192;_0x4e3c41['include']=[];if(_0x11cd0d[_0x4316('0x36')][_0x4316('0x9a')]){_0x4e3c41[_0x4316('0x3d')]['push']({'model':db[_0x4316('0x6b')],'as':'User','attributes':['id','fullname','alias']});}if(_0x11cd0d[_0x4316('0x36')]['includeAll']){_0x4e3c41[_0x4316('0x3d')]=[{'all':!![]}];}return db[_0x4316('0x52')]['findAll'](_0x4e3c41);})[_0x4316('0x13')](function(_0x339f40){_0x15872a[_0x4316('0x97')]=_0x339f40;return _0x15872a;});}})[_0x4316('0x13')](respondWithFilteredResult(_0x234bbb,_0x4e3c41))[_0x4316('0x1b')](handleError(_0x234bbb,null));};exports['addTags']=function(_0x1bc168,_0x4d76e0){return db[_0x4316('0x30')][_0x4316('0x3e')]({'where':{'id':_0x1bc168[_0x4316('0x37')]['id']}})['then'](handleEntityNotFound(_0x4d76e0,null))[_0x4316('0x13')](function(_0x5e9fd9){if(_0x5e9fd9){return _0x5e9fd9['setTags'](_0x1bc168['body'][_0x4316('0x86')],_['omit'](_0x1bc168[_0x4316('0x40')],[_0x4316('0x86'),'id'])||{})[_0x4316('0x9b')](function(){return db[_0x4316('0x9c')][_0x4316('0x96')]({'attributes':['id',_0x4316('0x28'),_0x4316('0x9d')],'where':{'id':_0x1bc168['body'][_0x4316('0x86')]}});})[_0x4316('0x13')](function(_0x938400){socket[_0x4316('0x9e')](_0x4316('0x9f'),{'id':Number(_0x1bc168[_0x4316('0x37')]['id']),'tags':_0x938400||[]});return{'id':Number(_0x1bc168['params']['id']),'tags':_0x938400||[]};});}})[_0x4316('0x13')](respondWithResult(_0x4d76e0,null))[_0x4316('0x1b')](handleError(_0x4d76e0,null));};exports[_0x4316('0xa0')]=function(_0x225f39,_0x4f20a8){return db[_0x4316('0x30')][_0x4316('0x3e')]({'where':{'id':_0x225f39[_0x4316('0x37')]['id']}})[_0x4316('0x13')](handleEntityNotFound(_0x4f20a8,null))[_0x4316('0x13')](function(_0x2a20e1){if(_0x2a20e1){return _0x2a20e1[_0x4316('0xa0')](_0x225f39['query'][_0x4316('0x86')]);}})['then'](respondWithStatusCode(_0x4f20a8,null))[_0x4316('0x1b')](handleError(_0x4f20a8,null));};exports[_0x4316('0xa1')]=function(_0x359965,_0x5845c1){var _0x64ca90=moment()[_0x4316('0xa2')]()[_0x4316('0xa3')]();var _0x423e57=path['join'](config['root'],_0x4316('0xa4'),_0x4316('0xa5'),_0x4316('0xa6'));var _0x395560=path[_0x4316('0x63')](config['root'],_0x4316('0xa4'),_0x4316('0xa5'),_0x4316('0xa7'));var _0x1c3eaf=path[_0x4316('0x63')](_0x423e57,_0x64ca90);var _0x466940=util[_0x4316('0x68')](_0x4316('0xa8'),_0x359965[_0x4316('0x37')]['id'],_0x64ca90);var _0x59e692=path['join'](_0x423e57,_0x466940);var _0x3f4f09=[];_0x3f4f09[_0x4316('0xa9')]({'model':db[_0x4316('0x6b')],'as':_0x4316('0x6b'),'attributes':['id',_0x4316('0x75')],'raw':!![]});_0x3f4f09[_0x4316('0xa9')]({'model':db[_0x4316('0x56')],'as':_0x4316('0x57'),'attributes':['id',_0x4316('0xaa'),_0x4316('0xab')],'raw':!![]});if(_0x359965[_0x4316('0x36')][_0x4316('0xa7')]){_0x3f4f09[_0x4316('0xa9')]({'model':db[_0x4316('0x61')],'as':_0x4316('0x61'),'raw':!![]});}var _0x236291=[{'model':db[_0x4316('0x52')],'as':_0x4316('0x6a'),'attributes':['id',_0x4316('0x40'),_0x4316('0x79'),_0x4316('0x7b'),_0x4316('0x98'),_0x4316('0xac')],'include':_0x3f4f09}];_0x236291['push']({'model':db['ChatWebsite'],'as':_0x4316('0xad'),'attributes':['id','name']});_0x236291[_0x4316('0xa9')]({'model':db['User'],'as':_0x4316('0xae'),'attributes':['id','fullname']});return db[_0x4316('0x30')][_0x4316('0x3e')]({'where':{'id':_0x359965['params']['id']},'include':_0x236291})[_0x4316('0x13')](handleEntityNotFound(_0x5845c1,null))[_0x4316('0x13')](function(_0x3348d0){if(_0x3348d0){var _0x5a993f=_0x3348d0[_0x4316('0xaf')]({'plain':!![]});fs[_0x4316('0xb0')](_0x1c3eaf);var _0x396f6b={'channel':'Chat','account':_0x5a993f[_0x4316('0xad')][_0x4316('0x28')],'agent':_0x5a993f['Owner']?_0x5a993f[_0x4316('0xae')]['fullname']:_0x4316('0xb1'),'createdAt':moment(_0x5a993f[_0x4316('0x79')])[_0x4316('0x68')](_0x4316('0x94'))[_0x4316('0xa3')](),'closedAt':_0x5a993f['closed']?moment(_0x5a993f['closedAt'])[_0x4316('0x68')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4316('0xa3')]():'','disposition':_0x5a993f[_0x4316('0xb2')],'chatInfo':{'browser':_0x5a993f[_0x4316('0xb3')],'os':_0x5a993f[_0x4316('0xb4')],'referer':_0x5a993f[_0x4316('0xb5')],'customerIp':_0x5a993f[_0x4316('0xb6')],'customerPort':_0x5a993f[_0x4316('0xb7')]?_0x5a993f[_0x4316('0xb7')]:_0x4316('0xb1')},'messages':_(_0x5a993f[_0x4316('0x6a')])['tail']()[_0x4316('0x91')]({'secret':![]})['map'](function(_0x308214){if(_0x308214[_0x4316('0x61')]){var _0x3577b3=path['join'](_0x395560,_0x308214[_0x4316('0x61')][_0x4316('0x65')]);if(fs['existsSync'](_0x3577b3)){fs[_0x4316('0xb8')](_0x3577b3)[_0x4316('0xb9')](fs[_0x4316('0xba')](path['join'](_0x1c3eaf,_0x308214[_0x4316('0x61')][_0x4316('0x65')])));}}return{'date':moment(_0x308214[_0x4316('0x79')])[_0x4316('0x68')](_0x4316('0x94'))[_0x4316('0xa3')](),'sender':_0x308214[_0x4316('0x7b')]===_0x4316('0x51')?_0x308214[_0x4316('0x6b')]?_0x308214[_0x4316('0x6b')][_0x4316('0x75')]:_0x4316('0x76'):_0x308214['Contact'][_0x4316('0xaa')]+(_0x308214[_0x4316('0x57')][_0x4316('0xab')]?'\x20'+_0x308214['Contact'][_0x4316('0xab')]:''),'body':_0x308214[_0x4316('0x61')]?_0x308214[_0x4316('0x61')][_0x4316('0x65')]:_0x308214['body'],'direction':_0x308214[_0x4316('0x7b')]===_0x4316('0x51')?'A':'C','secret':_0x308214[_0x4316('0x98')],'read':_0x308214['read'],'attachment':_0x308214['Attachment']};})[_0x4316('0xbb')]()};return ejs[_0x4316('0xbc')](path[_0x4316('0x63')](config[_0x4316('0x67')],_0x4316('0xa4'),_0x4316('0xbd'),_0x4316('0xbe')),{'interaction':_0x396f6b})['then'](function(_0x1ca6d6){var _0x23064d=path['join'](_0x1c3eaf,_0x4316('0xbf')+_0x5a993f['id']+'-'+_0x64ca90+_0x4316('0xc0'));var _0x59c24a={'path':_0x23064d,'channel':_0x4316('0xc1'),'interactionId':_0x5a993f['id']};return pdf[_0x4316('0xc2')](_0x1ca6d6,_0x59c24a);})[_0x4316('0x13')](function(){return new Promise(function(_0x4e7a84,_0x59004d){zipdir(_0x1c3eaf,{'saveTo':_0x59e692},function(_0x47addd,_0x49bd90){if(_0x47addd)return _0x59004d(_0x47addd);return _0x4e7a84(_0x49bd90);});})[_0x4316('0x13')](function(){return new BPromise(function(_0x11398e,_0x1c5e88){rimraf(_0x1c3eaf,function(_0xe540c6){if(_0xe540c6)_0x1c5e88(_0xe540c6);return _0x11398e();});});})[_0x4316('0x13')](function(){return _0x5845c1[_0x4316('0xa1')](_0x59e692,_0x466940,function(_0x570eca){if(_0x570eca){logger[_0x4316('0x17')](_0x4316('0xc3'),_0x570eca);}else{fs[_0x4316('0xc4')](_0x59e692);}});});});}else{return _0x5845c1[_0x4316('0x5a')](0xc8);}})[_0x4316('0x1b')](handleError(_0x5845c1,null));}; \ No newline at end of file +var _0xf76c=['err','unlinkSync','rimraf','request-promise','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','status','end','json','offset','undefined','count','set','Content-Range','stack','name','send','render','merge','agent','interaction','account','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','show','model','keys','filters','attributes','fields','includeAll','create','body','update','find','params','destroy','describe','ChatInteraction','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooApiKey','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','sendStatus','Interaction\x20already\x20assigned','disposition','originalname','basename','file','mimetype','Attachment','attachmentDownload','closed','attachId','join','root','offline-chat/','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','Messages','User','length','UserId','%s%d','agentAlias','System','Visitor','ContactId','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','intersection','nolimit','limit','order','sort','where','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','ChatInteractionId','map','includeAgent','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','toString','server','files','tmp','attachments','transcript-%d-%s.zip','push','fullname','firstName','lastName','read','Account','Owner','get','mkdirSync','N.A.','osName','referer','customerIp','customerPort','tail','createReadStream','pipe','out','renderFile','views','.pdf','createPdfFromHTML'];(function(_0x47bf73,_0x5a4957){var _0x419b53=function(_0x24ed96){while(--_0x24ed96){_0x47bf73['push'](_0x47bf73['shift']());}};_0x419b53(++_0x5a4957);}(_0xf76c,0x1a6));var _0xcf76=function(_0x386b03,_0x5d0000){_0x386b03=_0x386b03-0x0;var _0xd3d524=_0xf76c[_0x386b03];return _0xd3d524;};'use strict';var rimraf=require(_0xcf76('0x0'));var zipdir=require('zip-dir');var rp=require(_0xcf76('0x1'));var moment=require('moment');var BPromise=require(_0xcf76('0x2'));var Mustache=require(_0xcf76('0x3'));var util=require(_0xcf76('0x4'));var path=require(_0xcf76('0x5'));var ejs=require(_0xcf76('0x6'));var fs=require('fs');var _=require(_0xcf76('0x7'));var Redis=require(_0xcf76('0x8'));var interaction=require(_0xcf76('0x9'));var qs=require(_0xcf76('0xa'));var pdf=require(_0xcf76('0xb'));var logger=require(_0xcf76('0xc'))(_0xcf76('0xd'));var config=require(_0xcf76('0xe'));var db=require(_0xcf76('0xf'))['db'];config[_0xcf76('0x10')]=_[_0xcf76('0x11')](config[_0xcf76('0x10')],{'host':_0xcf76('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf76('0x10')]));require(_0xcf76('0x13'))[_0xcf76('0x14')](socket);var jayson=require(_0xcf76('0x15'));var client=jayson[_0xcf76('0x16')][_0xcf76('0x17')]({'port':0x232b});var client9004=jayson['client'][_0xcf76('0x17')]({'port':0x232c});function respondWithRpcPromise(_0xd53272,_0x43ac07,_0x36ac3e,_0x19bef8){return new BPromise(function(_0x1d244c,_0x2c699b){var _0x257966=_0x19bef8||client;return _0x257966[_0xcf76('0x18')](_0xd53272,_0x36ac3e)[_0xcf76('0x19')](function(_0x2db105){logger[_0xcf76('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x43ac07,'request\x20sent');logger[_0xcf76('0x1b')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x43ac07,_0xcf76('0x1c'),JSON['stringify'](_0x2db105));if(_0x2db105[_0xcf76('0x1d')]){if(_0x2db105['error'][_0xcf76('0x1e')]===0x1f4){logger[_0xcf76('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x43ac07,_0x2db105[_0xcf76('0x1d')][_0xcf76('0x1f')]);return _0x2c699b(_0x2db105[_0xcf76('0x1d')][_0xcf76('0x1f')]);}logger[_0xcf76('0x1d')](_0xcf76('0x20'),_0x43ac07,_0x2db105[_0xcf76('0x1d')][_0xcf76('0x1f')]);return _0x1d244c(_0x2db105[_0xcf76('0x1d')][_0xcf76('0x1f')]);}else{logger[_0xcf76('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x43ac07,_0xcf76('0x1c'));_0x1d244c(_0x2db105[_0xcf76('0x21')][_0xcf76('0x1f')]);}})[_0xcf76('0x22')](function(_0x106a82){logger[_0xcf76('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x43ac07,_0x106a82);_0x2c699b(_0x106a82);});});}function respondWithStatusCode(_0x5d65a8,_0x283513){_0x283513=_0x283513||0xcc;return function(_0x62e6f9){if(_0x62e6f9){return _0x5d65a8['sendStatus'](_0x283513);}return _0x5d65a8[_0xcf76('0x23')](_0x283513)[_0xcf76('0x24')]();};}function respondWithResult(_0x42ee71,_0x1c2b0c){_0x1c2b0c=_0x1c2b0c||0xc8;return function(_0x591ebb){if(_0x591ebb){return _0x42ee71['status'](_0x1c2b0c)[_0xcf76('0x25')](_0x591ebb);}};}function respondWithFilteredResult(_0x51dd39,_0x28bb36){return function(_0x17f6ce){if(_0x17f6ce){var _0x242ee6=typeof _0x28bb36[_0xcf76('0x26')]===_0xcf76('0x27')&&typeof _0x28bb36['limit']===_0xcf76('0x27');var _0x17e87b=_0x17f6ce['count'];var _0x219c91=_0x242ee6?0x0:_0x28bb36[_0xcf76('0x26')];var _0x4b087c=_0x242ee6?_0x17f6ce[_0xcf76('0x28')]:_0x28bb36['offset']+_0x28bb36['limit'];var _0x112e32;if(_0x4b087c>=_0x17e87b){_0x4b087c=_0x17e87b;_0x112e32=0xc8;}else{_0x112e32=0xce;}_0x51dd39['status'](_0x112e32);return _0x51dd39[_0xcf76('0x29')](_0xcf76('0x2a'),_0x219c91+'-'+_0x4b087c+'/'+_0x17e87b)[_0xcf76('0x25')](_0x17f6ce);}return null;};}function saveUpdates(_0x153936){return function(_0x43ce25){if(_0x43ce25){return _0x43ce25['update'](_0x153936)[_0xcf76('0x19')](function(_0x23ef9e){return _0x23ef9e;});}return null;};}function removeEntity(_0x1b5635){return function(_0x9f461c){if(_0x9f461c){return _0x9f461c['destroy']()[_0xcf76('0x19')](function(){_0x1b5635['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe3c876){return function(_0x25f278){if(!_0x25f278){_0xe3c876['sendStatus'](0x194);}return _0x25f278;};}function handleError(_0x5a4c58,_0x25f3af){_0x25f3af=_0x25f3af||0x1f4;return function(_0x5f2249){logger[_0xcf76('0x1d')](_0x5f2249[_0xcf76('0x2b')]);if(_0x5f2249[_0xcf76('0x2c')]){delete _0x5f2249[_0xcf76('0x2c')];}_0x5a4c58[_0xcf76('0x23')](_0x25f3af)[_0xcf76('0x2d')](_0x5f2249);};}function getMustacheRender(_0x4f3d29,_0x4931ff){return Mustache[_0xcf76('0x2e')](_0x4f3d29,_[_0xcf76('0x2f')](_0x4931ff['body'],{'contact':_0x4931ff['contact'],'message':_0x4931ff[_0xcf76('0x1f')],'agent':_0x4931ff[_0xcf76('0x30')],'interaction':_0x4931ff[_0xcf76('0x31')],'account':_0x4931ff[_0xcf76('0x32')]}))||'';}exports['index']=function(_0x44e971,_0x5ca8c1){var _0x48cc54={};var _0x33f0cb=_['map'](db['ChatInteraction'][_0xcf76('0x33')],function(_0x406e90){return{'name':_0x406e90[_0xcf76('0x34')],'type':_0x406e90[_0xcf76('0x35')][_0xcf76('0x36')]};});_0x48cc54=qs[_0xcf76('0x37')](_0x33f0cb,_0x44e971);return interaction[_0xcf76('0x38')](_0xcf76('0x39'),_0x44e971[_0xcf76('0x3a')],_0x44e971[_0xcf76('0x3b')],_0x48cc54,_0x33f0cb)[_0xcf76('0x19')](respondWithFilteredResult(_0x5ca8c1,_0x48cc54))[_0xcf76('0x22')](handleError(_0x5ca8c1,null));};exports[_0xcf76('0x3c')]=function(_0x56edaf,_0x14ab99){var _0x5452e7={'raw':![],'where':{'id':_0x56edaf['params']['id']}},_0x241926={};_0x241926[_0xcf76('0x3d')]=_[_0xcf76('0x3e')](db['ChatInteraction'][_0xcf76('0x33')]);_0x241926[_0xcf76('0x3a')]=_[_0xcf76('0x3e')](_0x56edaf[_0xcf76('0x3a')]);_0x241926[_0xcf76('0x3f')]=_['intersection'](_0x241926[_0xcf76('0x3d')],_0x241926[_0xcf76('0x3a')]);_0x5452e7[_0xcf76('0x40')]=_['intersection'](_0x241926['model'],qs[_0xcf76('0x41')](_0x56edaf[_0xcf76('0x3a')][_0xcf76('0x41')]));_0x5452e7[_0xcf76('0x40')]=_0x5452e7[_0xcf76('0x40')]['length']?_0x5452e7[_0xcf76('0x40')]:_0x241926[_0xcf76('0x3d')];if(_0x56edaf[_0xcf76('0x3a')][_0xcf76('0x42')]){_0x5452e7['include']=[{'all':!![]}];}_0x5452e7=_[_0xcf76('0x2f')]({},_0x5452e7,_0x56edaf['options']);return db['ChatInteraction']['find'](_0x5452e7)['then'](handleEntityNotFound(_0x14ab99,null))[_0xcf76('0x19')](respondWithResult(_0x14ab99,null))['catch'](handleError(_0x14ab99,null));};exports[_0xcf76('0x43')]=function(_0x5a3f01,_0x511c9c){return db['ChatInteraction'][_0xcf76('0x43')](_0x5a3f01[_0xcf76('0x44')],{})[_0xcf76('0x19')](respondWithResult(_0x511c9c,0xc9))[_0xcf76('0x22')](handleError(_0x511c9c,null));};exports[_0xcf76('0x45')]=function(_0x55faa4,_0x292e65){if(_0x55faa4[_0xcf76('0x44')]['id']){delete _0x55faa4[_0xcf76('0x44')]['id'];}return db['ChatInteraction'][_0xcf76('0x46')]({'where':{'id':_0x55faa4[_0xcf76('0x47')]['id']}})[_0xcf76('0x19')](handleEntityNotFound(_0x292e65,null))[_0xcf76('0x19')](saveUpdates(_0x55faa4[_0xcf76('0x44')],null))[_0xcf76('0x19')](respondWithResult(_0x292e65,null))[_0xcf76('0x22')](handleError(_0x292e65,null));};exports[_0xcf76('0x48')]=function(_0x47e990,_0x88dde9){return db['ChatInteraction'][_0xcf76('0x46')]({'where':{'id':_0x47e990['params']['id']}})[_0xcf76('0x19')](handleEntityNotFound(_0x88dde9,null))[_0xcf76('0x19')](removeEntity(_0x88dde9,null))[_0xcf76('0x22')](handleError(_0x88dde9,null));};exports[_0xcf76('0x49')]=function(_0x54eb6b,_0x5d8b95){return db[_0xcf76('0x4a')][_0xcf76('0x49')]()[_0xcf76('0x19')](respondWithResult(_0x5d8b95,null))[_0xcf76('0x22')](handleError(_0x5d8b95,null));};exports[_0xcf76('0x4b')]=function(_0x1be64b,_0x50ae6a){var _0x5b4857=_0x1be64b[_0xcf76('0x47')]['id'];var _0x45dec8;var _0x4817ca;var _0x392dfc;return db['ChatInteraction'][_0xcf76('0x4c')]({'where':{'id':_0x5b4857}})['then'](function(_0x2bb951){_0x45dec8=_0x2bb951;return db[_0xcf76('0x4d')][_0xcf76('0x4c')]({'where':{'id':_0x2bb951[_0xcf76('0x4e')]},'attributes':['id','vidaooApiKey',_0xcf76('0x4f'),_0xcf76('0x50'),'vidaooNote','vidaooMetadata'],'raw':!![]});})['then'](function(_0x5bf40e){if(_0x5bf40e&&_0x5bf40e[_0xcf76('0x51')]&&_0x5bf40e[_0xcf76('0x4f')]){_0x4817ca=_0x5bf40e;var _0x385515={'interaction':{'id':_0x5b4857},'agent':{'id':_0x1be64b['user']['id'],'name':_0x1be64b[_0xcf76('0x3b')]['name'],'fullname':_0x1be64b[_0xcf76('0x3b')]['fullname'],'email':_0x1be64b[_0xcf76('0x3b')][_0xcf76('0x52')]},'contact':_0x1be64b[_0xcf76('0x44')][_0xcf76('0x53')],'account':_0x1be64b['body'][_0xcf76('0x32')]};var _0x517bce={'rejectUnauthorized':![],'method':_0xcf76('0x54'),'url':_0xcf76('0x55'),'headers':{'X-APIKEY':_0x5bf40e[_0xcf76('0x51')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1be64b['user'][_0xcf76('0x52')]],'buttons':null,'topic':_0x4817ca[_0xcf76('0x50')],'note':_[_0xcf76('0x56')](_0x4817ca[_0xcf76('0x57')])?null:getMustacheRender(_0x4817ca[_0xcf76('0x57')],_0x385515),'metadata':null},'redirect':_0xcf76('0x58'),'json':!![]};try{if(!_[_0xcf76('0x56')](_0x4817ca[_0xcf76('0x59')])){var _0x55292a=getMustacheRender(_0x4817ca['vidaooMetadata'],_0x385515);var _0x1a67d0=JSON['parse'](_0x55292a);_0x517bce['body'][_0xcf76('0x5a')]=_0x1a67d0;}}catch(_0x192a49){throw new db['Sequelize'][(_0xcf76('0x5b'))](_0xcf76('0x5c'));}return rp(_0x517bce);}else{throw new db[(_0xcf76('0x5d'))]['ValidationError'](_0xcf76('0x5e'));}})[_0xcf76('0x19')](function(_0x25753c){_0x392dfc=_0x25753c;if(_0x392dfc['id']){var _0x21db63={'body':_0x392dfc[_0xcf76('0x5f')],'ChatWebsiteId':_0x4817ca['id'],'ChatInteractionId':_0x45dec8['id'],'direction':'out','UserId':_0x1be64b[_0xcf76('0x3b')]['id']};return db[_0xcf76('0x60')][_0xcf76('0x43')](_0x21db63,{});}else{throw new db[(_0xcf76('0x5d'))][(_0xcf76('0x5b'))](_0xcf76('0x61'));}})[_0xcf76('0x19')](function(){return _0x45dec8[_0xcf76('0x62')]({'vidaooSessionId':_0x392dfc['id']});})['then'](respondWithResult(_0x50ae6a,null))[_0xcf76('0x22')](handleError(_0x50ae6a,null));};exports['customUpdate']=function(_0x323221,_0x5a76dd){if(_0x323221[_0xcf76('0x44')]['id']){delete _0x323221[_0xcf76('0x44')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x323221[_0xcf76('0x47')]['id']},'include':[{'model':db[_0xcf76('0x63')],'as':_0xcf76('0x64')}]})['then'](handleEntityNotFound(_0x5a76dd,null))[_0xcf76('0x19')](saveUpdates(_0x323221[_0xcf76('0x44')],null))[_0xcf76('0x19')](respondWithResult(_0x5a76dd,null))[_0xcf76('0x22')](handleError(_0x5a76dd,null));};exports['abandon']=function(_0x3d3319,_0x4748e3){if(_0x3d3319[_0xcf76('0x44')]['id']){delete _0x3d3319[_0xcf76('0x44')]['id'];}return db[_0xcf76('0x4a')][_0xcf76('0x46')]({'where':{'id':_0x3d3319[_0xcf76('0x47')]['id']}})[_0xcf76('0x19')](function(_0x205416){if(!_0x205416){logger[_0xcf76('0x1d')](_0xcf76('0x65'),_0xcf76('0x66'),0x194,_0xcf76('0x67'));_0x4748e3[_0xcf76('0x68')](0x194);}else{if(_0x205416['UserId']){throw new db[(_0xcf76('0x5d'))][(_0xcf76('0x5b'))](_0xcf76('0x69'));}}return _0x205416;})[_0xcf76('0x19')](function(_0x4a3fe8){if(_0x4a3fe8){return _0x4a3fe8[_0xcf76('0x45')]({'closed':_0x3d3319[_0xcf76('0x44')]['closed'],'disposition':_0x3d3319['body'][_0xcf76('0x6a')]})['then'](function(_0x1dad94){return _0x1dad94;});}})[_0xcf76('0x19')](function(){return respondWithRpcPromise('AbandonInteraction',_0xcf76('0x66'),_0x3d3319['body'],client9004);})[_0xcf76('0x19')](respondWithResult(_0x4748e3,null))[_0xcf76('0x22')](handleError(_0x4748e3,null));};exports['attachmentUpload']=function(_0x3bd8a9,_0x193c12){_0x3bd8a9[_0xcf76('0x44')][_0xcf76('0x2c')]=_0x3bd8a9['file'][_0xcf76('0x6b')];_0x3bd8a9['body'][_0xcf76('0x6c')]=_0x3bd8a9[_0xcf76('0x6d')]['filename'];_0x3bd8a9[_0xcf76('0x44')][_0xcf76('0x35')]=_0x3bd8a9[_0xcf76('0x6d')][_0xcf76('0x6e')];return db[_0xcf76('0x6f')][_0xcf76('0x43')](_0x3bd8a9['body'])[_0xcf76('0x19')](respondWithResult(_0x193c12,0xc9))['catch'](handleError(_0x193c12,null));};exports[_0xcf76('0x70')]=function(_0x39a12c,_0x2373e7){return db['ChatInteraction'][_0xcf76('0x4c')]({'where':{'id':_0x39a12c['params']['id']},'raw':!![]})[_0xcf76('0x19')](handleEntityNotFound(_0x2373e7,null))[_0xcf76('0x19')](function(_0x517f35){if(_0x517f35){if(_0x517f35[_0xcf76('0x71')]){return _0x2373e7[_0xcf76('0x23')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0xcf76('0x6f')]['findOne']({'where':{'id':_0x39a12c[_0xcf76('0x3a')][_0xcf76('0x72')]},'raw':!![]})[_0xcf76('0x19')](handleEntityNotFound(_0x2373e7,null));}})[_0xcf76('0x19')](function(_0x38e7ab){if(_0x38e7ab){var _0x19d698=_0x38e7ab['ChatOfflineMessageId']!==null;var _0x2a3947=path[_0xcf76('0x73')](config[_0xcf76('0x74')],'server/files/attachments/');if(_0x19d698){_0x2a3947=path[_0xcf76('0x73')](_0x2a3947,_0xcf76('0x75'));}var _0x5dd019=path[_0xcf76('0x73')](_0x2a3947,_0x38e7ab[_0xcf76('0x6c')]);return _0x2373e7['download'](_0x5dd019);}})['catch'](handleError(_0x2373e7,null));};exports['close']=function(_0x2713bf,_0x3ff543){var _0x46bf36=null;var _0x2b20d0=null;var _0x5e3f84=null;if(_0x2713bf[_0xcf76('0x44')]['id']){delete _0x2713bf[_0xcf76('0x44')]['id'];}if(_0x2713bf[_0xcf76('0x44')][_0xcf76('0x76')]){_0x5e3f84=path[_0xcf76('0x73')](config['root'],_0xcf76('0x77'),util[_0xcf76('0x78')]('transcript-%s.txt',Date[_0xcf76('0x79')]()));_0x2713bf['body'][_0xcf76('0x7a')]=_0x5e3f84;}return db[_0xcf76('0x4a')]['find']({'where':{'id':_0x2713bf[_0xcf76('0x47')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xcf76('0x7b'),'include':[{'model':db['User'],'as':_0xcf76('0x7c')}]}]})[_0xcf76('0x19')](handleEntityNotFound(_0x3ff543,null))[_0xcf76('0x19')](saveUpdates(_0x2713bf['body'],null))[_0xcf76('0x19')](function(_0xdf40c4){if(_0xdf40c4){_0x46bf36=_0xdf40c4;return db['ChatWebsite'][_0xcf76('0x46')]({'where':{'id':_0x46bf36['ChatWebsiteId']}});}})['then'](function(_0x5e6352){if(_0x5e6352){_0x2b20d0=_0x5e6352;return db[_0xcf76('0x63')][_0xcf76('0x46')]({'where':{'id':_0x46bf36['ContactId']}});}})['then'](function(_0x57b3f7){if(_0x57b3f7){if(_0x5e3f84){var _0x47f60a=null;for(var _0x570b31=0x1;_0x570b31<_0x46bf36['Messages'][_0xcf76('0x7d')];++_0x570b31){_0x47f60a=_0x46bf36[_0xcf76('0x7b')][_0x570b31];var _0x45aa22=_0x47f60a[_0xcf76('0x7e')]?util[_0xcf76('0x78')](_0xcf76('0x7f'),_0x2b20d0[_0xcf76('0x80')],_0x47f60a[_0xcf76('0x7e')]):_0xcf76('0x81');var _0x176f25=_0x2713bf[_0xcf76('0x44')]['customer']||util[_0xcf76('0x78')]('%s%d',_0xcf76('0x82'),_0x47f60a[_0xcf76('0x83')]);switch(_0x2b20d0[_0xcf76('0x84')]){case _0xcf76('0x85'):_0x45aa22=_0x47f60a[_0xcf76('0x7e')]?util['format'](_0xcf76('0x7f'),_0x2b20d0['agentAlias'],_0x47f60a['UserId']):'System';break;case'agent_alias':_0x45aa22=_0x47f60a[_0xcf76('0x7e')]?_0x47f60a['User'][_0xcf76('0x86')]||_0x47f60a['User']['fullname']:_0xcf76('0x81');break;case _0xcf76('0x87'):_0x45aa22=_0x47f60a['UserId']?_0x47f60a['User']['fullname']:_0xcf76('0x81');break;default:_0x45aa22=_0x47f60a['UserId']?util[_0xcf76('0x78')](_0xcf76('0x7f'),_0x2b20d0['agentAlias'],_0x47f60a[_0xcf76('0x7e')]):_0xcf76('0x81');}var _0x28e923=util[_0xcf76('0x78')](_0xcf76('0x88'),moment(_0x47f60a[_0xcf76('0x89')])[_0xcf76('0x78')](_0xcf76('0x8a')),_0x47f60a[_0xcf76('0x8b')]==='in'?_0x176f25:_0x45aa22,_0x47f60a[_0xcf76('0x44')]);if(!_0x47f60a[_0xcf76('0x8c')]){fs[_0xcf76('0x8d')](_0x5e3f84,_0x28e923);}}return db[_0xcf76('0x8e')][_0xcf76('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0xcf76('0x8f')],'as':_0xcf76('0x90'),'raw':!![],'include':[{'model':db[_0xcf76('0x91')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xcf76('0x19')](function(_0x3b10fa){if(!_0x3b10fa||!_0x3b10fa[_0xcf76('0x90')]||!_0x2713bf[_0xcf76('0x44')])return _0x46bf36;var _0x3495be=_0x3b10fa['getSmtpOptions']();return respondWithRpcPromise(_0xcf76('0x92'),_0xcf76('0x93'),{'account':_0x3495be,'message':{'from':util[_0xcf76('0x78')](_0xcf76('0x94'),_0x3b10fa[_0xcf76('0x2c')],_0x3b10fa[_0xcf76('0x52')]||_0x3b10fa[_0xcf76('0x90')]['user']),'to':_0x2713bf[_0xcf76('0x44')][_0xcf76('0x76')],'subject':_0xcf76('0x95'),'text':util[_0xcf76('0x78')](_0xcf76('0x96'),_0x2713bf[_0xcf76('0x44')][_0xcf76('0x76')]),'attachments':[{'path':_0x5e3f84}]}})['then'](function(){return _0x46bf36;})[_0xcf76('0x22')](function(_0xc2e55f){logger[_0xcf76('0x1d')](_0xc2e55f);});})[_0xcf76('0x19')](respondWithStatusCode(_0x3ff543,0xc8))['catch'](handleError(_0x3ff543,null));};exports[_0xcf76('0x97')]=function(_0x1fb71c,_0x263f99){return db['ChatMessage']['find']({'where':{'id':_0x1fb71c[_0xcf76('0x47')]['id']}})['then'](handleEntityNotFound(_0x263f99,null))[_0xcf76('0x19')](function(_0x51fd5b){if(_0x51fd5b){return _0x51fd5b[_0xcf76('0x97')](_0x1fb71c['body'][_0xcf76('0x98')],_[_0xcf76('0x99')](_0x1fb71c[_0xcf76('0x44')],[_0xcf76('0x98'),'id'])||{});}})[_0xcf76('0x19')](respondWithResult(_0x263f99,null))[_0xcf76('0x22')](handleError(_0x263f99,null));};exports[_0xcf76('0x9a')]=function(_0x428358,_0x407ce3){var _0x4e120f={'raw':![],'where':{}};var _0x1ee457={};var _0x20ffb5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xcf76('0x4c')]({'where':{'id':_0x428358[_0xcf76('0x47')]['id']}})[_0xcf76('0x19')](handleEntityNotFound(_0x407ce3,null))['then'](function(_0x42e635){if(_0x42e635){_0x1ee457[_0xcf76('0x3d')]=_[_0xcf76('0x3e')](db['ChatMessage'][_0xcf76('0x33')]);_0x1ee457[_0xcf76('0x3a')]=_['keys'](_0x428358['query']);_0x1ee457[_0xcf76('0x3f')]=_[_0xcf76('0x9b')](_0x1ee457[_0xcf76('0x3d')],_0x1ee457[_0xcf76('0x3a')]);_0x4e120f['attributes']=_[_0xcf76('0x9b')](_0x1ee457['model'],qs[_0xcf76('0x41')](_0x428358[_0xcf76('0x3a')][_0xcf76('0x41')]));_0x4e120f[_0xcf76('0x40')]=_0x4e120f['attributes'][_0xcf76('0x7d')]?_0x4e120f[_0xcf76('0x40')]:_0x1ee457[_0xcf76('0x3d')];if(!_0x428358[_0xcf76('0x3a')]['hasOwnProperty'](_0xcf76('0x9c'))){_0x4e120f['limit']=qs[_0xcf76('0x9d')](_0x428358['query'][_0xcf76('0x9d')]);_0x4e120f[_0xcf76('0x26')]=qs['offset'](_0x428358[_0xcf76('0x3a')]['offset']);}_0x4e120f[_0xcf76('0x9e')]=qs[_0xcf76('0x9f')](_0x428358[_0xcf76('0x3a')]['sort']);_0x4e120f[_0xcf76('0xa0')]=qs[_0xcf76('0x3f')](_[_0xcf76('0xa1')](_0x428358[_0xcf76('0x3a')],_0x1ee457[_0xcf76('0x3f')]));_0x4e120f['where']['ChatInteractionId']=_0x42e635['id'];if(_0x428358[_0xcf76('0x3a')][_0xcf76('0xa2')]){_0x4e120f[_0xcf76('0xa0')]=_[_0xcf76('0x2f')](_0x4e120f[_0xcf76('0xa0')],{'$or':_['map'](_0x4e120f[_0xcf76('0x40')],function(_0xc0d98a){var _0x385f23={};_0x385f23[_0xc0d98a]={'$like':'%'+_0x428358[_0xcf76('0x3a')]['filter']+'%'};return _0x385f23;})});}if(_0x428358[_0xcf76('0x3a')][_0xcf76('0xa3')]){var _0x5eae95=_0x428358['query'][_0xcf76('0xa3')]['split'](',');var _0x207a36={};_0x207a36[_0x5eae95[0x0]]={'$gte':moment(_0x5eae95[0x1])['format'](_0xcf76('0xa4'))};_0x4e120f[_0xcf76('0xa0')]=_[_0xcf76('0x2f')](_0x4e120f[_0xcf76('0xa0')],_0x207a36);}_0x4e120f=_['merge']({},_0x4e120f,_0x428358[_0xcf76('0xa5')]);return db['ChatMessage'][_0xcf76('0x28')]({'where':_0x4e120f['where']})['then'](function(_0x17d2dc){_0x20ffb5['count']=_0x17d2dc;if(_0x428358[_0xcf76('0x3a')][_0xcf76('0x42')]){_0x4e120f[_0xcf76('0xa6')]=[{'all':!![]}];}return db[_0xcf76('0x60')][_0xcf76('0x38')](_0x4e120f);})['then'](function(_0x362283){_0x20ffb5[_0xcf76('0xa7')]=_0x362283;return _0x20ffb5;});}})[_0xcf76('0x19')](respondWithFilteredResult(_0x407ce3,_0x4e120f))[_0xcf76('0x22')](handleError(_0x407ce3,null));};exports['getMyMessages']=function(_0x4bc359,_0x2a83ab){var _0x1b2705={'where':{}},_0x275e09={},_0x29a166={'count':0x0,'rows':[]};return db[_0xcf76('0x4a')][_0xcf76('0x4c')]({'where':{'id':_0x4bc359[_0xcf76('0x47')]['id']}})[_0xcf76('0x19')](handleEntityNotFound(_0x2a83ab,null))['then'](function(_0x4c1389){if(_0x4c1389){_0x275e09[_0xcf76('0x3d')]=_['keys'](db[_0xcf76('0x60')]['rawAttributes']);_0x275e09[_0xcf76('0x3a')]=_[_0xcf76('0x3e')](_0x4bc359[_0xcf76('0x3a')]);_0x275e09[_0xcf76('0x3f')]=_[_0xcf76('0x9b')](_0x275e09[_0xcf76('0x3d')],_0x275e09['query']);_0x1b2705[_0xcf76('0x40')]=_[_0xcf76('0x9b')](_0x275e09[_0xcf76('0x3d')],qs[_0xcf76('0x41')](_0x4bc359['query'][_0xcf76('0x41')]));_0x1b2705[_0xcf76('0x40')]=_0x1b2705[_0xcf76('0x40')][_0xcf76('0x7d')]?_0x1b2705[_0xcf76('0x40')]:_0x275e09[_0xcf76('0x3d')];if(!_0x4bc359[_0xcf76('0x3a')]['hasOwnProperty']('nolimit')){_0x1b2705[_0xcf76('0x9d')]=qs[_0xcf76('0x9d')](_0x4bc359[_0xcf76('0x3a')]['limit']);_0x1b2705[_0xcf76('0x26')]=qs[_0xcf76('0x26')](_0x4bc359[_0xcf76('0x3a')][_0xcf76('0x26')]);}_0x1b2705['order']=qs[_0xcf76('0x9f')](_0x4bc359[_0xcf76('0x3a')][_0xcf76('0x9f')]);_0x1b2705[_0xcf76('0xa0')]=qs[_0xcf76('0x3f')](_['pick'](_0x4bc359[_0xcf76('0x3a')],_0x275e09[_0xcf76('0x3f')]));_0x1b2705[_0xcf76('0xa0')][_0xcf76('0xa8')]=_0x4c1389['id'];if(_0x4bc359[_0xcf76('0x3a')][_0xcf76('0xa2')]){_0x1b2705[_0xcf76('0xa0')]=_[_0xcf76('0x2f')](_0x1b2705[_0xcf76('0xa0')],{'$or':_[_0xcf76('0xa9')](_0x1b2705['attributes'],function(_0x313aad){var _0x50ee9a={};_0x50ee9a[_0x313aad]={'$like':'%'+_0x4bc359['query'][_0xcf76('0xa2')]+'%'};return _0x50ee9a;})});}_0x1b2705[_0xcf76('0xa0')][_0xcf76('0x8c')]=![];if(_0x4bc359[_0xcf76('0x3a')]['id']){_0x1b2705[_0xcf76('0xa0')]['id']={'$gt':_0x4bc359[_0xcf76('0x3a')]['id']};}_0x1b2705=_[_0xcf76('0x2f')]({},_0x1b2705,_0x4bc359['options']);return db[_0xcf76('0x60')]['count']({'where':_0x1b2705[_0xcf76('0xa0')]})['then'](function(_0x4ba314){_0x29a166[_0xcf76('0x28')]=_0x4ba314;_0x1b2705[_0xcf76('0xa6')]=[];if(_0x4bc359['query'][_0xcf76('0xaa')]){_0x1b2705['include']['push']({'model':db[_0xcf76('0x7c')],'as':_0xcf76('0x7c'),'attributes':['id','fullname','alias']});}if(_0x4bc359['query'][_0xcf76('0x42')]){_0x1b2705['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x1b2705);})[_0xcf76('0x19')](function(_0x438b45){_0x29a166[_0xcf76('0xa7')]=_0x438b45;return _0x29a166;});}})[_0xcf76('0x19')](respondWithFilteredResult(_0x2a83ab,_0x1b2705))['catch'](handleError(_0x2a83ab,null));};exports[_0xcf76('0xab')]=function(_0x4d1106,_0x5ad5a0){return db[_0xcf76('0x4a')][_0xcf76('0x46')]({'where':{'id':_0x4d1106[_0xcf76('0x47')]['id']}})[_0xcf76('0x19')](handleEntityNotFound(_0x5ad5a0,null))[_0xcf76('0x19')](function(_0x46d34d){if(_0x46d34d){return _0x46d34d[_0xcf76('0xac')](_0x4d1106[_0xcf76('0x44')][_0xcf76('0x98')],_['omit'](_0x4d1106[_0xcf76('0x44')],[_0xcf76('0x98'),'id'])||{})[_0xcf76('0xad')](function(){return db[_0xcf76('0xae')]['findAll']({'attributes':['id',_0xcf76('0x2c'),_0xcf76('0xaf')],'where':{'id':_0x4d1106['body'][_0xcf76('0x98')]}});})[_0xcf76('0x19')](function(_0x34e943){socket[_0xcf76('0xb0')](_0xcf76('0xb1'),{'id':Number(_0x4d1106['params']['id']),'tags':_0x34e943||[]});return{'id':Number(_0x4d1106[_0xcf76('0x47')]['id']),'tags':_0x34e943||[]};});}})[_0xcf76('0x19')](respondWithResult(_0x5ad5a0,null))[_0xcf76('0x22')](handleError(_0x5ad5a0,null));};exports['removeTags']=function(_0x3ca927,_0x55deac){return db[_0xcf76('0x4a')][_0xcf76('0x46')]({'where':{'id':_0x3ca927['params']['id']}})[_0xcf76('0x19')](handleEntityNotFound(_0x55deac,null))['then'](function(_0x571564){if(_0x571564){return _0x571564[_0xcf76('0xb2')](_0x3ca927['query'][_0xcf76('0x98')]);}})[_0xcf76('0x19')](respondWithStatusCode(_0x55deac,null))['catch'](handleError(_0x55deac,null));};exports[_0xcf76('0xb3')]=function(_0x4416ee,_0x2089e8){var _0x4b6c51=moment()['unix']()[_0xcf76('0xb4')]();var _0x188a09=path[_0xcf76('0x73')](config[_0xcf76('0x74')],_0xcf76('0xb5'),_0xcf76('0xb6'),_0xcf76('0xb7'));var _0xb23641=path[_0xcf76('0x73')](config[_0xcf76('0x74')],'server',_0xcf76('0xb6'),_0xcf76('0xb8'));var _0x193321=path[_0xcf76('0x73')](_0x188a09,_0x4b6c51);var _0x397fd7=util[_0xcf76('0x78')](_0xcf76('0xb9'),_0x4416ee[_0xcf76('0x47')]['id'],_0x4b6c51);var _0x1c925c=path['join'](_0x188a09,_0x397fd7);var _0x40bb90=[];_0x40bb90[_0xcf76('0xba')]({'model':db[_0xcf76('0x7c')],'as':_0xcf76('0x7c'),'attributes':['id',_0xcf76('0xbb')],'raw':!![]});_0x40bb90[_0xcf76('0xba')]({'model':db[_0xcf76('0x63')],'as':_0xcf76('0x64'),'attributes':['id',_0xcf76('0xbc'),_0xcf76('0xbd')],'raw':!![]});if(_0x4416ee['query']['attachments']){_0x40bb90[_0xcf76('0xba')]({'model':db[_0xcf76('0x6f')],'as':'Attachment','raw':!![]});}var _0x3f2536=[{'model':db[_0xcf76('0x60')],'as':'Messages','attributes':['id',_0xcf76('0x44'),_0xcf76('0x89'),_0xcf76('0x8b'),_0xcf76('0x8c'),_0xcf76('0xbe')],'include':_0x40bb90}];_0x3f2536['push']({'model':db[_0xcf76('0x4d')],'as':_0xcf76('0xbf'),'attributes':['id','name']});_0x3f2536['push']({'model':db[_0xcf76('0x7c')],'as':_0xcf76('0xc0'),'attributes':['id',_0xcf76('0xbb')]});return db[_0xcf76('0x4a')][_0xcf76('0x46')]({'where':{'id':_0x4416ee[_0xcf76('0x47')]['id']},'include':_0x3f2536})[_0xcf76('0x19')](handleEntityNotFound(_0x2089e8,null))[_0xcf76('0x19')](function(_0x3e519b){if(_0x3e519b){var _0x13c394=_0x3e519b[_0xcf76('0xc1')]({'plain':!![]});fs[_0xcf76('0xc2')](_0x193321);var _0x25cf6d={'channel':'Chat','account':_0x13c394['Account'][_0xcf76('0x2c')],'agent':_0x13c394[_0xcf76('0xc0')]?_0x13c394[_0xcf76('0xc0')][_0xcf76('0xbb')]:_0xcf76('0xc3'),'createdAt':moment(_0x13c394[_0xcf76('0x89')])[_0xcf76('0x78')]('YYYY-MM-DD\x20HH:mm:ss')[_0xcf76('0xb4')](),'closedAt':_0x13c394[_0xcf76('0x71')]?moment(_0x13c394['closedAt'])[_0xcf76('0x78')](_0xcf76('0xa4'))[_0xcf76('0xb4')]():'','disposition':_0x13c394[_0xcf76('0x6a')],'chatInfo':{'browser':_0x13c394['browserName'],'os':_0x13c394[_0xcf76('0xc4')],'referer':_0x13c394[_0xcf76('0xc5')],'customerIp':_0x13c394[_0xcf76('0xc6')],'customerPort':_0x13c394[_0xcf76('0xc7')]?_0x13c394[_0xcf76('0xc7')]:_0xcf76('0xc3')},'messages':_(_0x13c394[_0xcf76('0x7b')])[_0xcf76('0xc8')]()['filter']({'secret':![]})[_0xcf76('0xa9')](function(_0x244984){if(_0x244984['Attachment']){var _0x446c2d=path[_0xcf76('0x73')](_0xb23641,_0x244984[_0xcf76('0x6f')][_0xcf76('0x6c')]);if(fs['existsSync'](_0x446c2d)){fs[_0xcf76('0xc9')](_0x446c2d)[_0xcf76('0xca')](fs['createWriteStream'](path[_0xcf76('0x73')](_0x193321,_0x244984['Attachment'][_0xcf76('0x6c')])));}}return{'date':moment(_0x244984[_0xcf76('0x89')])[_0xcf76('0x78')](_0xcf76('0xa4'))[_0xcf76('0xb4')](),'sender':_0x244984[_0xcf76('0x8b')]==='out'?_0x244984['User']?_0x244984[_0xcf76('0x7c')][_0xcf76('0xbb')]:'System':_0x244984[_0xcf76('0x64')][_0xcf76('0xbc')]+(_0x244984[_0xcf76('0x64')][_0xcf76('0xbd')]?'\x20'+_0x244984[_0xcf76('0x64')]['lastName']:''),'body':_0x244984[_0xcf76('0x6f')]?_0x244984[_0xcf76('0x6f')][_0xcf76('0x6c')]:_0x244984['body'],'direction':_0x244984[_0xcf76('0x8b')]===_0xcf76('0xcb')?'A':'C','secret':_0x244984[_0xcf76('0x8c')],'read':_0x244984[_0xcf76('0xbe')],'attachment':_0x244984[_0xcf76('0x6f')]};})['value']()};return ejs[_0xcf76('0xcc')](path['join'](config[_0xcf76('0x74')],_0xcf76('0xb5'),_0xcf76('0xcd'),'downloadInteraction.ejs'),{'interaction':_0x25cf6d})['then'](function(_0x7e08ff){var _0x3825a2=path[_0xcf76('0x73')](_0x193321,'transcript-'+_0x13c394['id']+'-'+_0x4b6c51+_0xcf76('0xce'));var _0x5876f3={'path':_0x3825a2,'channel':'Chat','interactionId':_0x13c394['id']};return pdf[_0xcf76('0xcf')](_0x7e08ff,_0x5876f3);})[_0xcf76('0x19')](function(){return new Promise(function(_0xda3d26,_0x161fe3){zipdir(_0x193321,{'saveTo':_0x1c925c},function(_0x5b1196,_0x2527fa){if(_0x5b1196)return _0x161fe3(_0x5b1196);return _0xda3d26(_0x2527fa);});})[_0xcf76('0x19')](function(){return new BPromise(function(_0x48bdb7,_0x3d5017){rimraf(_0x193321,function(_0x389774){if(_0x389774)_0x3d5017(_0x389774);return _0x48bdb7();});});})[_0xcf76('0x19')](function(){return _0x2089e8[_0xcf76('0xb3')](_0x1c925c,_0x397fd7,function(_0x33061d){if(_0x33061d){logger[_0xcf76('0x1d')](_0xcf76('0xd0'),_0x33061d);}else{fs[_0xcf76('0xd1')](_0x1c925c);}});});});}else{return _0x2089e8[_0xcf76('0x68')](0xc8);}})['catch'](handleError(_0x2089e8,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 0554189..cd6dc97 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 _0xb8c8=['Users','map','findAll','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue'];(function(_0x2d89f8,_0x2959e7){var _0x3e6700=function(_0x37bcec){while(--_0x37bcec){_0x2d89f8['push'](_0x2d89f8['shift']());}};_0x3e6700(++_0x2959e7);}(_0xb8c8,0xbb));var _0x8b8c=function(_0x472e18,_0xd42b15){_0x472e18=_0x472e18-0x0;var _0x195882=_0xb8c8[_0x472e18];return _0x195882;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x8b8c('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0x8b8c('0x0'))['db'][_0x8b8c('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8b8c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b8c('0x3'),'afterDestroy':_0x8b8c('0x4')};function emitEvent(_0x3d5cf5){return function(_0x515260,_0x42e7c8,_0x1bac18){_0x515260[_0x8b8c('0x5')]({'attributes':['id'],'raw':!![]})[_0x8b8c('0x6')](function(_0x26f791){_0x515260[_0x8b8c('0x7')](_0x8b8c('0x8'),_0x26f791[_0x8b8c('0x9')](function(_0x17ac61){return{'id':_0x17ac61['id']};}));return ChatMessage[_0x8b8c('0xa')]({'where':{'ChatInteractionId':_0x515260['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b8c('0x6')](function(_0x2a856e){_0x515260['setDataValue']('unreadMessages',_0x2a856e['length']);ChatInteractionEvents[_0x8b8c('0xb')](_0x3d5cf5+':'+_0x515260['id'],_0x515260);ChatInteractionEvents[_0x8b8c('0xb')](_0x3d5cf5,_0x515260);_0x1bac18(null);})['catch'](_0x1bac18(null));};}for(var e in events){if(events[_0x8b8c('0xc')](e)){var event=events[e];ChatInteraction[_0x8b8c('0xd')](e,emitEvent(event));}}module[_0x8b8c('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0xe79b=['../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x16743a,_0x34d3ad){var _0x5bf565=function(_0x299268){while(--_0x299268){_0x16743a['push'](_0x16743a['shift']());}};_0x5bf565(++_0x34d3ad);}(_0xe79b,0x10a));var _0xbe79=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0xe79b[_0x1a87b3];return _0x37e84d;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xbe79('0x0'))['db'][_0xbe79('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0xbe79('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xbe79('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbe79('0x4'),'afterDestroy':_0xbe79('0x5')};function emitEvent(_0x115547){return function(_0x46e3c8,_0x22172b,_0x5c6d0c){_0x46e3c8[_0xbe79('0x6')]({'attributes':['id'],'raw':!![]})[_0xbe79('0x7')](function(_0x5777e7){_0x46e3c8[_0xbe79('0x8')](_0xbe79('0x9'),_0x5777e7[_0xbe79('0xa')](function(_0xa68265){return{'id':_0xa68265['id']};}));return ChatMessage[_0xbe79('0xb')]({'where':{'ChatInteractionId':_0x46e3c8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1835e9){_0x46e3c8[_0xbe79('0x8')](_0xbe79('0xc'),_0x1835e9[_0xbe79('0xd')]);ChatInteractionEvents[_0xbe79('0xe')](_0x115547+':'+_0x46e3c8['id'],_0x46e3c8);ChatInteractionEvents[_0xbe79('0xe')](_0x115547,_0x46e3c8);_0x5c6d0c(null);})[_0xbe79('0xf')](_0x5c6d0c(null));};}for(var e in events){if(events[_0xbe79('0x10')](e)){var event=events[e];ChatInteraction[_0xbe79('0x11')](e,emitEvent(event));}}module[_0xbe79('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index cf0640c..a63dbe6 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 _0xf914=['moment','bluebird','request-promise','path','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x37cab3,_0x3969ff){var _0x1c601f=function(_0x38b36a){while(--_0x38b36a){_0x37cab3['push'](_0x37cab3['shift']());}};_0x1c601f(++_0x3969ff);}(_0xf914,0x85));var _0x4f91=function(_0x4f7418,_0x1755cc){_0x4f7418=_0x4f7418-0x0;var _0x4afe7e=_0xf914[_0x4f7418];return _0x4afe7e;};'use strict';var _=require(_0x4f91('0x0'));var util=require(_0x4f91('0x1'));var logger=require(_0x4f91('0x2'))('api');var moment=require(_0x4f91('0x3'));var BPromise=require(_0x4f91('0x4'));var rp=require(_0x4f91('0x5'));var fs=require('fs');var path=require(_0x4f91('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4f91('0x7'));module[_0x4f91('0x8')]=function(_0x2b5be3,_0x3cf294){return _0x2b5be3['define'](_0x4f91('0x9'),attributes,{'tableName':_0x4f91('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f5aea,_0x52069c,_0x1cd1c3){if(_0x5f5aea['changed'](_0x4f91('0xb'))){_0x5f5aea[_0x4f91('0xc')]=moment()[_0x4f91('0xd')](_0x4f91('0xe'));}_0x1cd1c3(null,_0x5f5aea);}},'charset':_0x4f91('0xf'),'collate':_0x4f91('0x10')});}; \ No newline at end of file +var _0x06ef=['define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports'];(function(_0x528a6e,_0x15abad){var _0x2cf224=function(_0x2c4e14){while(--_0x2c4e14){_0x528a6e['push'](_0x528a6e['shift']());}};_0x2cf224(++_0x15abad);}(_0x06ef,0x1c9));var _0xf06e=function(_0x15d469,_0x533556){_0x15d469=_0x15d469-0x0;var _0x3dccfd=_0x06ef[_0x15d469];return _0x3dccfd;};'use strict';var _=require(_0xf06e('0x0'));var util=require(_0xf06e('0x1'));var logger=require(_0xf06e('0x2'))(_0xf06e('0x3'));var moment=require(_0xf06e('0x4'));var BPromise=require('bluebird');var rp=require(_0xf06e('0x5'));var fs=require('fs');var path=require(_0xf06e('0x6'));var rimraf=require(_0xf06e('0x7'));var config=require(_0xf06e('0x8'));var attributes=require(_0xf06e('0x9'));module[_0xf06e('0xa')]=function(_0x605c13,_0x275f9c){return _0x605c13[_0xf06e('0xb')](_0xf06e('0xc'),attributes,{'tableName':_0xf06e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x320266,_0x5873d4,_0x41ed9d){if(_0x320266[_0xf06e('0xe')](_0xf06e('0xf'))){_0x320266['closedAt']=moment()[_0xf06e('0x10')](_0xf06e('0x11'));}_0x41ed9d(null,_0x320266);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 0975248..c21ba16 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 _0x6ea4=['debug','AddTagsToChatInteraction','addTags','body','omit','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit'];(function(_0x54e30f,_0x3d2450){var _0x8accde=function(_0x4eca4a){while(--_0x4eca4a){_0x54e30f['push'](_0x54e30f['shift']());}};_0x8accde(++_0x3d2450);}(_0x6ea4,0x1d6));var _0x46ea=function(_0x50ed5c,_0x38e2f2){_0x50ed5c=_0x50ed5c-0x0;var _0x42905c=_0x6ea4[_0x50ed5c];return _0x42905c;};'use strict';var _=require(_0x46ea('0x0'));var util=require('util');var moment=require(_0x46ea('0x1'));var BPromise=require(_0x46ea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x46ea('0x4'));var logger=require('../../config/logger')(_0x46ea('0x5'));var config=require(_0x46ea('0x6'));var jayson=require(_0x46ea('0x7'));var client=jayson['client'][_0x46ea('0x8')]({'port':0x232a});config[_0x46ea('0x9')]=_[_0x46ea('0xa')](config[_0x46ea('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x46ea('0xb'))(new Redis(config[_0x46ea('0x9')]));require(_0x46ea('0xc'))[_0x46ea('0xd')](socket);function respondWithRpcPromise(_0x6f2eb1,_0x5589fa,_0x3c1629){return new BPromise(function(_0x3d1df7,_0x590614){return client[_0x46ea('0xe')](_0x6f2eb1,_0x3c1629)[_0x46ea('0xf')](function(_0x59ded9){logger[_0x46ea('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x5589fa,_0x46ea('0x11'));logger['debug'](_0x46ea('0x12'),_0x5589fa,'request\x20sent',JSON[_0x46ea('0x13')](_0x59ded9));if(_0x59ded9[_0x46ea('0x14')]){if(_0x59ded9[_0x46ea('0x14')][_0x46ea('0x15')]===0x1f4){logger[_0x46ea('0x14')](_0x46ea('0x16'),_0x5589fa,_0x59ded9[_0x46ea('0x14')][_0x46ea('0x17')]);return _0x590614(_0x59ded9[_0x46ea('0x14')][_0x46ea('0x17')]);}logger[_0x46ea('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x5589fa,_0x59ded9[_0x46ea('0x14')][_0x46ea('0x17')]);return _0x3d1df7(_0x59ded9[_0x46ea('0x14')][_0x46ea('0x17')]);}else{logger[_0x46ea('0x10')](_0x46ea('0x16'),_0x5589fa,_0x46ea('0x11'));_0x3d1df7(_0x59ded9[_0x46ea('0x18')]['message']);}})[_0x46ea('0x19')](function(_0x566b74){logger[_0x46ea('0x14')](_0x46ea('0x16'),_0x5589fa,_0x566b74);_0x590614(_0x566b74);});});}exports[_0x46ea('0x1a')]=function(_0x18ded4){var _0x57a5f6=this;return new Promise(function(_0x4b160b,_0x25309a){return db[_0x46ea('0x1b')][_0x46ea('0x1c')](_0x18ded4['body'],{'raw':_0x18ded4[_0x46ea('0x1d')]?_0x18ded4['options'][_0x46ea('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18ded4[_0x46ea('0x1d')]?_0x18ded4[_0x46ea('0x1d')][_0x46ea('0x1f')]||null:null,'attributes':_0x18ded4['options']?_0x18ded4['options'][_0x46ea('0x20')]||null:null,'limit':_0x18ded4[_0x46ea('0x1d')]?_0x18ded4[_0x46ea('0x1d')][_0x46ea('0x21')]||null:null})['then'](function(_0x33ffb0){logger['info'](_0x46ea('0x1a'),_0x18ded4);logger[_0x46ea('0x22')](_0x46ea('0x1a'),_0x18ded4,JSON[_0x46ea('0x13')](_0x33ffb0));_0x4b160b(_0x33ffb0);})[_0x46ea('0x19')](function(_0xaaca10){logger['error'](_0x46ea('0x1a'),_0xaaca10['message'],_0x18ded4);_0x25309a(_0x57a5f6['error'](0x1f4,_0xaaca10[_0x46ea('0x17')]));});});};exports[_0x46ea('0x23')]=function(_0x571666){return new Promise(function(_0x3a2a15,_0x3bbb63){return db['ChatInteraction']['find']({'where':_0x571666[_0x46ea('0x1d')]?_0x571666[_0x46ea('0x1d')]['where']||null:null})[_0x46ea('0xf')](function(_0x59d00b){if(_0x59d00b){return _0x59d00b[_0x46ea('0x24')](_0x571666[_0x46ea('0x25')]['ids'],_[_0x46ea('0x26')](_0x571666[_0x46ea('0x25')],[_0x46ea('0x27'),'id'])||{});}})[_0x46ea('0x28')](function(_0x2b1e86){logger[_0x46ea('0x10')]('AddTags',_0x571666);logger[_0x46ea('0x22')](_0x46ea('0x29'),_0x571666,JSON[_0x46ea('0x13')](_0x2b1e86));_0x3a2a15(_0x2b1e86);})['catch'](function(_0x3d125a){logger['error'](_0x46ea('0x29'),_0x3d125a[_0x46ea('0x17')],_0x571666);_0x3bbb63(_this['error'](0x1f4,_0x3d125a['message']));});});}; \ No newline at end of file +var _0xa831=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','lodash'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0xa831,0x18b));var _0x1a83=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xa831[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0x1a83('0x0'));var util=require('util');var moment=require(_0x1a83('0x1'));var BPromise=require(_0x1a83('0x2'));var rs=require(_0x1a83('0x3'));var fs=require('fs');var Redis=require(_0x1a83('0x4'));var db=require(_0x1a83('0x5'))['db'];var utils=require(_0x1a83('0x6'));var logger=require(_0x1a83('0x7'))('rpc');var config=require(_0x1a83('0x8'));var jayson=require(_0x1a83('0x9'));var client=jayson[_0x1a83('0xa')]['http']({'port':0x232a});config['redis']=_[_0x1a83('0xb')](config[_0x1a83('0xc')],{'host':_0x1a83('0xd'),'port':0x18eb});var socket=require(_0x1a83('0xe'))(new Redis(config[_0x1a83('0xc')]));require(_0x1a83('0xf'))[_0x1a83('0x10')](socket);function respondWithRpcPromise(_0x3b7d34,_0xebb3f4,_0x47ecf7){return new BPromise(function(_0x20e5a8,_0x5ebfd0){return client['request'](_0x3b7d34,_0x47ecf7)[_0x1a83('0x11')](function(_0x5a5233){logger[_0x1a83('0x12')](_0x1a83('0x13'),_0xebb3f4,'request\x20sent');logger[_0x1a83('0x14')](_0x1a83('0x15'),_0xebb3f4,_0x1a83('0x16'),JSON['stringify'](_0x5a5233));if(_0x5a5233[_0x1a83('0x17')]){if(_0x5a5233[_0x1a83('0x17')][_0x1a83('0x18')]===0x1f4){logger['error'](_0x1a83('0x13'),_0xebb3f4,_0x5a5233[_0x1a83('0x17')][_0x1a83('0x19')]);return _0x5ebfd0(_0x5a5233[_0x1a83('0x17')]['message']);}logger[_0x1a83('0x17')](_0x1a83('0x13'),_0xebb3f4,_0x5a5233[_0x1a83('0x17')][_0x1a83('0x19')]);return _0x20e5a8(_0x5a5233['error']['message']);}else{logger[_0x1a83('0x12')](_0x1a83('0x13'),_0xebb3f4,'request\x20sent');_0x20e5a8(_0x5a5233[_0x1a83('0x1a')]['message']);}})[_0x1a83('0x1b')](function(_0x290e1f){logger['error'](_0x1a83('0x13'),_0xebb3f4,_0x290e1f);_0x5ebfd0(_0x290e1f);});});}exports[_0x1a83('0x1c')]=function(_0x4e41ea){var _0x29f29c=this;return new Promise(function(_0x432433,_0x3e7ca8){return db[_0x1a83('0x1d')][_0x1a83('0x1e')](_0x4e41ea[_0x1a83('0x1f')],{'raw':_0x4e41ea['options']?_0x4e41ea[_0x1a83('0x20')][_0x1a83('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e41ea[_0x1a83('0x20')]?_0x4e41ea['options'][_0x1a83('0x22')]||null:null,'attributes':_0x4e41ea[_0x1a83('0x20')]?_0x4e41ea['options'][_0x1a83('0x23')]||null:null,'limit':_0x4e41ea[_0x1a83('0x20')]?_0x4e41ea['options'][_0x1a83('0x24')]||null:null})[_0x1a83('0x11')](function(_0x12cd43){logger['info'](_0x1a83('0x1c'),_0x4e41ea);logger['debug'](_0x1a83('0x1c'),_0x4e41ea,JSON[_0x1a83('0x25')](_0x12cd43));_0x432433(_0x12cd43);})[_0x1a83('0x1b')](function(_0x2f5d94){logger[_0x1a83('0x17')](_0x1a83('0x1c'),_0x2f5d94[_0x1a83('0x19')],_0x4e41ea);_0x3e7ca8(_0x29f29c[_0x1a83('0x17')](0x1f4,_0x2f5d94[_0x1a83('0x19')]));});});};exports[_0x1a83('0x26')]=function(_0x67058c){return new Promise(function(_0x48234b,_0x22b80c){return db['ChatInteraction'][_0x1a83('0x27')]({'where':_0x67058c['options']?_0x67058c[_0x1a83('0x20')][_0x1a83('0x22')]||null:null})[_0x1a83('0x11')](function(_0x461275){if(_0x461275){return _0x461275[_0x1a83('0x28')](_0x67058c[_0x1a83('0x1f')][_0x1a83('0x29')],_[_0x1a83('0x2a')](_0x67058c[_0x1a83('0x1f')],[_0x1a83('0x29'),'id'])||{});}})['spread'](function(_0x2cbbea){logger['info'](_0x1a83('0x2b'),_0x67058c);logger['debug'](_0x1a83('0x2b'),_0x67058c,JSON[_0x1a83('0x25')](_0x2cbbea));_0x48234b(_0x2cbbea);})[_0x1a83('0x1b')](function(_0x1c0d8d){logger['error'](_0x1a83('0x2b'),_0x1c0d8d[_0x1a83('0x19')],_0x67058c);_0x22b80c(_this[_0x1a83('0x17')](0x1f4,_0x1c0d8d[_0x1a83('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8b0e42f..2597eb8 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 _0xf6ae=['./chatInteraction.events','save','remove','update','emit','removeListener','length','chatInteraction:'];(function(_0x2f2619,_0x27618f){var _0x4f958f=function(_0x3a432d){while(--_0x3a432d){_0x2f2619['push'](_0x2f2619['shift']());}};_0x4f958f(++_0x27618f);}(_0xf6ae,0x1d0));var _0xef6a=function(_0x435c0e,_0x394a4a){_0x435c0e=_0x435c0e-0x0;var _0x1742ef=_0xf6ae[_0x435c0e];return _0x1742ef;};'use strict';var ChatInteractionEvents=require(_0xef6a('0x0'));var events=[_0xef6a('0x1'),_0xef6a('0x2'),_0xef6a('0x3')];function createListener(_0x64cfb5,_0x4d18b9){return function(_0x92937a){_0x4d18b9[_0xef6a('0x4')](_0x64cfb5,_0x92937a);};}function removeListener(_0x3ba9a1,_0x40ecb6){return function(){ChatInteractionEvents[_0xef6a('0x5')](_0x3ba9a1,_0x40ecb6);};}exports['register']=function(_0x1f8c67){for(var _0xb53a73=0x0,_0x78a4f1=events[_0xef6a('0x6')];_0xb53a73<_0x78a4f1;_0xb53a73++){var _0x55c966=events[_0xb53a73];var _0x5641ba=createListener(_0xef6a('0x7')+_0x55c966,_0x1f8c67);ChatInteractionEvents['on'](_0x55c966,_0x5641ba);}}; \ No newline at end of file +var _0x4634=['removeListener','register','length','save','remove','update','emit'];(function(_0x205a12,_0x5d1d07){var _0x2ae9cc=function(_0x3b2e01){while(--_0x3b2e01){_0x205a12['push'](_0x205a12['shift']());}};_0x2ae9cc(++_0x5d1d07);}(_0x4634,0xe3));var _0x4463=function(_0x584981,_0x879ae2){_0x584981=_0x584981-0x0;var _0x5c9992=_0x4634[_0x584981];return _0x5c9992;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x4463('0x0'),_0x4463('0x1'),_0x4463('0x2')];function createListener(_0xed2d17,_0x2458b1){return function(_0x3252a4){_0x2458b1[_0x4463('0x3')](_0xed2d17,_0x3252a4);};}function removeListener(_0x4ad792,_0x18ff63){return function(){ChatInteractionEvents[_0x4463('0x4')](_0x4ad792,_0x18ff63);};}exports[_0x4463('0x5')]=function(_0x4b7dc3){for(var _0x449d81=0x0,_0x18f97a=events[_0x4463('0x6')];_0x449d81<_0x18f97a;_0x449d81++){var _0x22a9ae=events[_0x449d81];var _0x235705=createListener('chatInteraction:'+_0x22a9ae,_0x4b7dc3);ChatInteractionEvents['on'](_0x22a9ae,_0x235705);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 0ce0ff7..831bb25 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 _0x7605=['createVidaooSession','root','server/files/attachments/','format','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','chat','chatinteraction:update','update','put','customUpdate','/:id/abandon','/:id/close','delete','chatinteraction:destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/download','create','post','/:id/vidaoo'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7605,0x191));var _0x5760=function(_0x41ff01,_0x432b4e){_0x41ff01=_0x41ff01-0x0;var _0x165ebc=_0x7605[_0x41ff01];return _0x165ebc;};'use strict';var multer=require(_0x5760('0x0'));var util=require(_0x5760('0x1'));var path=require(_0x5760('0x2'));var timeout=require('connect-timeout');var express=require(_0x5760('0x3'));var router=express[_0x5760('0x4')]();var fs_extra=require(_0x5760('0x5'));var auth=require(_0x5760('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5760('0x7'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x5760('0x8')](),controller[_0x5760('0x9')]);router['get'](_0x5760('0xa'),auth['isAuthenticated'](),controller[_0x5760('0xb')]);router[_0x5760('0xc')](_0x5760('0xd'),auth[_0x5760('0xe')](),controller['show']);router[_0x5760('0xc')]('/:id/attachment_download',auth[_0x5760('0xe')](),controller[_0x5760('0xf')]);router[_0x5760('0xc')](_0x5760('0x10'),auth[_0x5760('0x8')](),controller[_0x5760('0x11')]);router[_0x5760('0xc')]('/:id/my_messages',auth[_0x5760('0xe')](),controller['getMyMessages']);router[_0x5760('0xc')](_0x5760('0x12'),auth[_0x5760('0x8')](),controller['download']);router['post']('/',auth[_0x5760('0x8')](),controller[_0x5760('0x13')]);router[_0x5760('0x14')](_0x5760('0x15'),auth[_0x5760('0x8')](),controller[_0x5760('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ef837,_0x164215,_0xf67730){_0xf67730(null,path['join'](config[_0x5760('0x17')],_0x5760('0x18')));},'filename':function(_0x1aeb3f,_0x2c9b25,_0x571dad){_0x571dad(null,util[_0x5760('0x19')]('%s-%s',Date['now'](),_0x2c9b25[_0x5760('0x1a')][_0x5760('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x5760('0x1c'),upload[_0x5760('0x1d')](_0x5760('0x1e')),controller[_0x5760('0x1f')]);router[_0x5760('0x14')](_0x5760('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x5760('0x20')]);router[_0x5760('0x14')](_0x5760('0x21'),auth[_0x5760('0x8')](),interaction[_0x5760('0x22')]('chat',_0x5760('0x23')),controller['addTags']);router['put']('/:id',auth[_0x5760('0x8')](),interaction[_0x5760('0x22')](_0x5760('0x24'),_0x5760('0x25')),controller[_0x5760('0x26')]);router[_0x5760('0x27')]('/:id/custom_update',controller[_0x5760('0x28')]);router[_0x5760('0x27')](_0x5760('0x29'),auth[_0x5760('0xe')](),controller['abandon']);router[_0x5760('0x27')](_0x5760('0x2a'),controller['close']);router[_0x5760('0x2b')](_0x5760('0xd'),auth[_0x5760('0x8')](),interaction[_0x5760('0x22')](_0x5760('0x24'),_0x5760('0x2c')),controller['destroy']);router['delete'](_0x5760('0x21'),auth[_0x5760('0x8')](),controller[_0x5760('0x2d')]);module[_0x5760('0x2e')]=router; \ No newline at end of file +var _0xfcc9=['delete','destroy','removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','originalname','single','file','attachmentUpload','addMessage','/:id/tags','addTags','put','tracked','chat','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close'];(function(_0x3246a6,_0x2a685a){var _0x1df64d=function(_0x4868ad){while(--_0x4868ad){_0x3246a6['push'](_0x3246a6['shift']());}};_0x1df64d(++_0x2a685a);}(_0xfcc9,0x161));var _0x9fcc=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0xfcc9[_0x2d126e];return _0xcb04d3;};'use strict';var multer=require(_0x9fcc('0x0'));var util=require(_0x9fcc('0x1'));var path=require(_0x9fcc('0x2'));var timeout=require(_0x9fcc('0x3'));var express=require('express');var router=express[_0x9fcc('0x4')]();var fs_extra=require(_0x9fcc('0x5'));var auth=require(_0x9fcc('0x6'));var interaction=require(_0x9fcc('0x7'));var config=require('../../config/environment');var controller=require(_0x9fcc('0x8'));router[_0x9fcc('0x9')]('/',auth[_0x9fcc('0xa')](),controller[_0x9fcc('0xb')]);router[_0x9fcc('0x9')](_0x9fcc('0xc'),auth[_0x9fcc('0xa')](),controller['describe']);router[_0x9fcc('0x9')](_0x9fcc('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x9fcc('0xe')]);router[_0x9fcc('0x9')](_0x9fcc('0xf'),auth[_0x9fcc('0x10')](),controller['attachmentDownload']);router[_0x9fcc('0x9')](_0x9fcc('0x11'),auth[_0x9fcc('0xa')](),controller[_0x9fcc('0x12')]);router[_0x9fcc('0x9')](_0x9fcc('0x13'),auth[_0x9fcc('0x10')](),controller[_0x9fcc('0x14')]);router[_0x9fcc('0x9')](_0x9fcc('0x15'),auth[_0x9fcc('0xa')](),controller[_0x9fcc('0x16')]);router['post']('/',auth[_0x9fcc('0xa')](),controller[_0x9fcc('0x17')]);router[_0x9fcc('0x18')](_0x9fcc('0x19'),auth['isAuthenticated'](),controller[_0x9fcc('0x1a')]);var upload=multer({'storage':multer[_0x9fcc('0x1b')]({'destination':function(_0x845f5a,_0x1f7191,_0x901c64){_0x901c64(null,path[_0x9fcc('0x1c')](config[_0x9fcc('0x1d')],_0x9fcc('0x1e')));},'filename':function(_0x9b9ddf,_0x41ffa1,_0x45bba5){_0x45bba5(null,util['format']('%s-%s',Date['now'](),_0x41ffa1[_0x9fcc('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x9fcc('0x20')](_0x9fcc('0x21')),controller[_0x9fcc('0x22')]);router['post'](_0x9fcc('0x11'),auth[_0x9fcc('0x10')](),controller[_0x9fcc('0x23')]);router[_0x9fcc('0x18')](_0x9fcc('0x24'),auth[_0x9fcc('0xa')](),interaction['tracked']('chat','chatinteraction:addtags'),controller[_0x9fcc('0x25')]);router[_0x9fcc('0x26')](_0x9fcc('0xd'),auth[_0x9fcc('0xa')](),interaction[_0x9fcc('0x27')](_0x9fcc('0x28'),'chatinteraction:update'),controller[_0x9fcc('0x29')]);router['put'](_0x9fcc('0x2a'),controller[_0x9fcc('0x2b')]);router['put'](_0x9fcc('0x2c'),auth['isChatInteractionAuthorized'](),controller[_0x9fcc('0x2d')]);router['put']('/:id/close',controller[_0x9fcc('0x2e')]);router[_0x9fcc('0x2f')]('/:id',auth[_0x9fcc('0xa')](),interaction[_0x9fcc('0x27')]('chat','chatinteraction:destroy'),controller[_0x9fcc('0x30')]);router[_0x9fcc('0x2f')](_0x9fcc('0x24'),auth[_0x9fcc('0xa')](),controller[_0x9fcc('0x31')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 5fb1c5a..250bc62 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 _0xdb69=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x5d0fe6,_0x40ae52){var _0x2ce912=function(_0x260da2){while(--_0x260da2){_0x5d0fe6['push'](_0x5d0fe6['shift']());}};_0x2ce912(++_0x40ae52);}(_0xdb69,0x170));var _0x9db6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xdb69[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0x9db6('0x0')]={'body':{'type':Sequelize[_0x9db6('0x1')](_0x9db6('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9db6('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9db6('0x4')]}}; \ No newline at end of file +var _0xeb15=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x4369ef,_0x33cde3){var _0xf9dac4=function(_0x3f9af1){while(--_0x3f9af1){_0x4369ef['push'](_0x4369ef['shift']());}};_0xf9dac4(++_0x33cde3);}(_0xeb15,0x10d));var _0x5eb1=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xeb15[_0x31b5a5];return _0x364cc9;};'use strict';var Sequelize=require(_0x5eb1('0x0'));module['exports']={'body':{'type':Sequelize[_0x5eb1('0x1')](_0x5eb1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5eb1('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5eb1('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 01d6b6c..d972fbb 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 _0xe687=['eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','get','messages','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','admin','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','filter','resourceId','push','FromId','ToId','read','-createdAt','all'];(function(_0x15c667,_0x306a08){var _0x540e10=function(_0x48e90e){while(--_0x48e90e){_0x15c667['push'](_0x15c667['shift']());}};_0x540e10(++_0x306a08);}(_0xe687,0xdc));var _0x7e68=function(_0x4637cd,_0x26a717){_0x4637cd=_0x4637cd-0x0;var _0x4fa2e6=_0xe687[_0x4637cd];return _0x4fa2e6;};'use strict';var emlformat=require(_0x7e68('0x0'));var rimraf=require(_0x7e68('0x1'));var zipdir=require(_0x7e68('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7e68('0x3'));var util=require(_0x7e68('0x4'));var path=require(_0x7e68('0x5'));var sox=require(_0x7e68('0x6'));var csv=require(_0x7e68('0x7'));var ejs=require(_0x7e68('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e68('0x9'));var squel=require('squel');var crypto=require(_0x7e68('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7e68('0xb'));var toCsv=require(_0x7e68('0x7'));var querystring=require(_0x7e68('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7e68('0xd'));var qs=require(_0x7e68('0xe'));var as=require(_0x7e68('0xf'));var hardwareService=require(_0x7e68('0x10'));var logger=require(_0x7e68('0x11'))(_0x7e68('0x12'));var utils=require(_0x7e68('0x13'));var config=require(_0x7e68('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e68('0x15'))['db'];config[_0x7e68('0x16')]=_['defaults'](config[_0x7e68('0x16')],{'host':_0x7e68('0x17'),'port':0x18eb});var socket=require(_0x7e68('0x18'))(new Redis(config[_0x7e68('0x16')]));require(_0x7e68('0x19'))[_0x7e68('0x1a')](socket);function respondWithStatusCode(_0x2952da,_0x1cb50c){_0x1cb50c=_0x1cb50c||0xcc;return function(_0x515c00){if(_0x515c00){return _0x2952da['sendStatus'](_0x1cb50c);}return _0x2952da[_0x7e68('0x1b')](_0x1cb50c)[_0x7e68('0x1c')]();};}function respondWithResult(_0x1d7020,_0x2c581b){_0x2c581b=_0x2c581b||0xc8;return function(_0x4ef9a2){if(_0x4ef9a2){return _0x1d7020[_0x7e68('0x1b')](_0x2c581b)[_0x7e68('0x1d')](_0x4ef9a2);}};}function respondWithFilteredResult(_0x187fa4,_0xbdb84a){return function(_0x14f49e){if(_0x14f49e){var _0xca7e1c=typeof _0xbdb84a[_0x7e68('0x1e')]==='undefined'&&typeof _0xbdb84a['limit']===_0x7e68('0x1f');var _0x412621=_0x14f49e['count'];var _0x455321=_0xca7e1c?0x0:_0xbdb84a['offset'];var _0x1469c5=_0xca7e1c?_0x14f49e[_0x7e68('0x20')]:_0xbdb84a[_0x7e68('0x1e')]+_0xbdb84a['limit'];var _0x491a64;if(_0x1469c5>=_0x412621){_0x1469c5=_0x412621;_0x491a64=0xc8;}else{_0x491a64=0xce;}_0x187fa4[_0x7e68('0x1b')](_0x491a64);return _0x187fa4['set'](_0x7e68('0x21'),_0x455321+'-'+_0x1469c5+'/'+_0x412621)[_0x7e68('0x1d')](_0x14f49e);}return null;};}function patchUpdates(_0x34f46b){return function(_0x75abe1){try{jsonpatch[_0x7e68('0x22')](_0x75abe1,_0x34f46b,!![]);}catch(_0x4ccdc6){return BPromise[_0x7e68('0x23')](_0x4ccdc6);}return _0x75abe1[_0x7e68('0x24')]();};}function saveUpdates(_0x208d3e,_0x574907){return function(_0x5534b5){if(_0x5534b5){return _0x5534b5[_0x7e68('0x25')](_0x208d3e)[_0x7e68('0x26')](function(_0x55d013){return _0x55d013;});}return null;};}function removeEntity(_0x2c4217,_0x7b5b28){return function(_0x399e3a){if(_0x399e3a){return _0x399e3a[_0x7e68('0x27')]()[_0x7e68('0x26')](function(){_0x2c4217[_0x7e68('0x1b')](0xcc)[_0x7e68('0x1c')]();});}};}function handleEntityNotFound(_0x1c79f5,_0x14526a){return function(_0x20d5d0){if(!_0x20d5d0){_0x1c79f5[_0x7e68('0x28')](0x194);}return _0x20d5d0;};}function handleError(_0x347a88,_0x4bcca6){_0x4bcca6=_0x4bcca6||0x1f4;return function(_0x88f291){logger[_0x7e68('0x29')](_0x88f291['stack']);if(_0x88f291[_0x7e68('0x2a')]){delete _0x88f291[_0x7e68('0x2a')];}_0x347a88['status'](_0x4bcca6)[_0x7e68('0x2b')](_0x88f291);};}exports[_0x7e68('0x2c')]=function(_0x5dd517,_0x2c07a1){var _0x1ca674={},_0x556dc1={},_0x1a4d5a={'count':0x0,'rows':[]};var _0x45effd=_[_0x7e68('0x2d')](db[_0x7e68('0x2e')][_0x7e68('0x2f')],function(_0x5abe81){return{'name':_0x5abe81[_0x7e68('0x30')],'type':_0x5abe81[_0x7e68('0x31')][_0x7e68('0x32')]};});_0x556dc1[_0x7e68('0x33')]=_['map'](_0x45effd,_0x7e68('0x2a'));_0x556dc1[_0x7e68('0x34')]=_[_0x7e68('0x35')](_0x5dd517[_0x7e68('0x34')]);_0x556dc1[_0x7e68('0x36')]=_[_0x7e68('0x37')](_0x556dc1[_0x7e68('0x33')],_0x556dc1[_0x7e68('0x34')]);_0x1ca674[_0x7e68('0x38')]=_[_0x7e68('0x37')](_0x556dc1[_0x7e68('0x33')],qs[_0x7e68('0x39')](_0x5dd517[_0x7e68('0x34')]['fields']));_0x1ca674['attributes']=_0x1ca674[_0x7e68('0x38')]['length']?_0x1ca674['attributes']:_0x556dc1[_0x7e68('0x33')];if(!_0x5dd517[_0x7e68('0x34')][_0x7e68('0x3a')](_0x7e68('0x3b'))){_0x1ca674['limit']=qs[_0x7e68('0x3c')](_0x5dd517[_0x7e68('0x34')][_0x7e68('0x3c')]);_0x1ca674[_0x7e68('0x1e')]=qs['offset'](_0x5dd517['query'][_0x7e68('0x1e')]);}_0x1ca674[_0x7e68('0x3d')]=qs[_0x7e68('0x3e')](_0x5dd517[_0x7e68('0x34')][_0x7e68('0x3e')]);_0x1ca674[_0x7e68('0x3f')]=qs['filters'](_['pick'](_0x5dd517[_0x7e68('0x34')],_0x556dc1[_0x7e68('0x36')]),_0x45effd);if(_0x5dd517[_0x7e68('0x34')]['filter']){_0x1ca674[_0x7e68('0x3f')]=_[_0x7e68('0x40')](_0x1ca674[_0x7e68('0x3f')],{'$or':_[_0x7e68('0x2d')](_0x45effd,function(_0x4490d4){if(_0x4490d4[_0x7e68('0x31')]!=='VIRTUAL'){var _0x490564={};_0x490564[_0x4490d4[_0x7e68('0x2a')]]={'$like':'%'+_0x5dd517[_0x7e68('0x34')]['filter']+'%'};return _0x490564;}})});}_0x1ca674=_[_0x7e68('0x40')]({},_0x1ca674,_0x5dd517[_0x7e68('0x41')]);var _0x36e310={'where':_0x1ca674[_0x7e68('0x3f')]};return db[_0x7e68('0x2e')][_0x7e68('0x20')](_0x36e310)[_0x7e68('0x26')](function(_0x48537f){_0x1a4d5a[_0x7e68('0x20')]=_0x48537f;if(_0x5dd517['query'][_0x7e68('0x42')]){_0x1ca674[_0x7e68('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x7e68('0x44')](_0x1ca674);})['then'](function(_0x40e201){_0x1a4d5a[_0x7e68('0x45')]=_0x40e201;return _0x1a4d5a;})[_0x7e68('0x26')](respondWithFilteredResult(_0x2c07a1,_0x1ca674))[_0x7e68('0x46')](handleError(_0x2c07a1,null));};exports[_0x7e68('0x47')]=function(_0x5f1f69,_0x3df0ad){var _0x12af1f={'raw':!![],'where':{'id':_0x5f1f69[_0x7e68('0x48')]['id']}},_0x47b5f2={};_0x47b5f2['model']=_[_0x7e68('0x35')](db[_0x7e68('0x2e')][_0x7e68('0x2f')]);_0x47b5f2[_0x7e68('0x34')]=_[_0x7e68('0x35')](_0x5f1f69['query']);_0x47b5f2[_0x7e68('0x36')]=_[_0x7e68('0x37')](_0x47b5f2[_0x7e68('0x33')],_0x47b5f2[_0x7e68('0x34')]);_0x12af1f[_0x7e68('0x38')]=_[_0x7e68('0x37')](_0x47b5f2[_0x7e68('0x33')],qs[_0x7e68('0x39')](_0x5f1f69[_0x7e68('0x34')][_0x7e68('0x39')]));_0x12af1f[_0x7e68('0x38')]=_0x12af1f[_0x7e68('0x38')][_0x7e68('0x49')]?_0x12af1f['attributes']:_0x47b5f2[_0x7e68('0x33')];if(_0x5f1f69[_0x7e68('0x34')][_0x7e68('0x42')]){_0x12af1f['include']=[{'all':!![]}];}_0x12af1f=_[_0x7e68('0x40')]({},_0x12af1f,_0x5f1f69[_0x7e68('0x41')]);return db[_0x7e68('0x2e')][_0x7e68('0x4a')](_0x12af1f)[_0x7e68('0x26')](handleEntityNotFound(_0x3df0ad,null))[_0x7e68('0x26')](respondWithResult(_0x3df0ad,null))['catch'](handleError(_0x3df0ad,null));};exports[_0x7e68('0x4b')]=function(_0x406867,_0x5991e9){return db[_0x7e68('0x2e')][_0x7e68('0x4b')](_0x406867[_0x7e68('0x4c')],{})[_0x7e68('0x26')](respondWithResult(_0x5991e9,0xc9))['catch'](handleError(_0x5991e9,null));};exports[_0x7e68('0x25')]=function(_0x54e69f,_0x41b3a1){if(_0x54e69f[_0x7e68('0x4c')]['id']){delete _0x54e69f[_0x7e68('0x4c')]['id'];}return db[_0x7e68('0x2e')][_0x7e68('0x4a')]({'where':{'id':_0x54e69f['params']['id']}})[_0x7e68('0x26')](handleEntityNotFound(_0x41b3a1,null))[_0x7e68('0x26')](saveUpdates(_0x54e69f[_0x7e68('0x4c')],null))[_0x7e68('0x26')](respondWithResult(_0x41b3a1,null))['catch'](handleError(_0x41b3a1,null));};exports[_0x7e68('0x27')]=function(_0x45df03,_0x502c20){return db[_0x7e68('0x2e')]['find']({'where':{'id':_0x45df03[_0x7e68('0x48')]['id']}})[_0x7e68('0x26')](handleEntityNotFound(_0x502c20,null))[_0x7e68('0x26')](removeEntity(_0x502c20,null))[_0x7e68('0x46')](handleError(_0x502c20,null));};exports[_0x7e68('0x4d')]=function(_0x21575d,_0x2ce3d1){return db[_0x7e68('0x2e')]['describe']()['then'](respondWithResult(_0x2ce3d1,null))[_0x7e68('0x46')](handleError(_0x2ce3d1,null));};function wrapUser(_0x4cd11f){return function(_0x5cb073){var _0x5a14db=_0x4cd11f[_0x7e68('0x4e')]({'plain':!![]});_0x5a14db[_0x7e68('0x4f')]=[];if(_0x5cb073){_0x5a14db['lastMessageAt']=_0x5cb073[_0x7e68('0x50')];_0x5a14db['lastMessage']=_0x5cb073;}else{_0x5a14db['lastMessageAt']=moment(0x0)[_0x7e68('0x51')](_0x7e68('0x52'));_0x5a14db[_0x7e68('0x53')]={};}return _0x5a14db;};}exports[_0x7e68('0x54')]=function(_0x52994f,_0x46f8b9,_0x34d6fa){var _0x1eddb0=[];return db['User'][_0x7e68('0x44')]({'where':{'role':[_0x7e68('0x55'),_0x7e68('0x56'),_0x7e68('0x57')]},'attributes':['id',_0x7e68('0x58'),_0x7e68('0x2a'),_0x7e68('0x59'),_0x7e68('0x5a'),_0x7e68('0x5b'),_0x7e68('0x5c'),'lastLoginAt',_0x7e68('0x5d'),_0x7e68('0x5e')],'order':qs[_0x7e68('0x3e')](_0x7e68('0x5f')),'include':[{'model':db[_0x7e68('0x60')],'as':_0x7e68('0x61'),'attributes':['id',_0x7e68('0x2a'),'type'],'through':{'attributes':[]}}]})[_0x7e68('0x26')](function(_0x5fab1f){if(_0x5fab1f){var _0x4e99aa=_0x52994f[_0x7e68('0x57')]['get']({'plain':!![]});if(!_0x4e99aa)throw new Error(_0x7e68('0x62'));if(_0x4e99aa[_0x7e68('0x59')]==='user'){return db['UserProfileSection'][_0x7e68('0x4a')]({'where':{'name':_0x7e68('0x63'),'userProfileId':_0x4e99aa[_0x7e68('0x64')]},'raw':!![]})[_0x7e68('0x26')](function(_0x31d34e){if(_0x31d34e){if(_0x31d34e[_0x7e68('0x65')]===0x0){return db['UserProfileResource'][_0x7e68('0x44')]({'where':{'sectionId':_0x31d34e['id']},'raw':!![]})[_0x7e68('0x26')](function(_0x2be70f){var _0x1b07da=[];if(_['isEmpty'](_0x2be70f)){_0x1b07da=_[_0x7e68('0x66')](_0x5fab1f,function(_0x417107){if(_0x417107[_0x7e68('0x59')]!==_0x7e68('0x55')){return _0x417107;}});return _0x1b07da;}else{for(var _0x4b2892=0x0;_0x4b2892<_0x5fab1f[_0x7e68('0x49')];_0x4b2892++){var _0x415d6a=_0x5fab1f[_0x4b2892];if(_0x415d6a[_0x7e68('0x59')]===_0x7e68('0x55')){var _0x3fb430=_[_0x7e68('0x4a')](_0x2be70f,function(_0x23ce15){return _0x23ce15[_0x7e68('0x67')]===_0x415d6a['id'];});if(_0x3fb430)_0x1b07da[_0x7e68('0x68')](_0x415d6a);}else{_0x1b07da[_0x7e68('0x68')](_0x415d6a);}}return _0x1b07da;}});}else{return _0x5fab1f;}}else{var _0x1fadb2=_[_0x7e68('0x66')](_0x5fab1f,function(_0x3b320e){if(_0x3b320e['role']!==_0x7e68('0x55')){return _0x3b320e;}});return _0x1fadb2;}});}else{return _0x5fab1f;}}})[_0x7e68('0x26')](function(_0x239e6b){var _0x2256ac=[];if(_0x239e6b){_0x1eddb0=_0x239e6b;for(var _0x2cfb2e=0x0;_0x2cfb2e<_0x239e6b[_0x7e68('0x49')];_0x2cfb2e+=0x1){_0x1eddb0[_0x2cfb2e]['messages']=[];_0x2256ac[_0x7e68('0x68')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x52994f[_0x7e68('0x57')]['id'],_0x239e6b[_0x2cfb2e]['id']],'ToId':[_0x52994f[_0x7e68('0x57')]['id'],_0x239e6b[_0x2cfb2e]['id']],'ChatGroupId':null},'attributes':['id',_0x7e68('0x50'),_0x7e68('0x69'),_0x7e68('0x6a'),_0x7e68('0x6b'),_0x7e68('0x4c')],'order':qs[_0x7e68('0x3e')](_0x7e68('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7e68('0x26')](wrapUser(_0x239e6b[_0x2cfb2e])));}return BPromise[_0x7e68('0x6d')](_0x2256ac);}return[];})[_0x7e68('0x26')](function(_0x2daccb){return{'rows':_0x2daccb,'count':_0x2daccb[_0x7e68('0x49')]};})[_0x7e68('0x26')](respondWithResult(_0x46f8b9,null))['catch'](handleError(_0x46f8b9,null));}; \ No newline at end of file +var _0xe363=['userProfileId','UserProfileResource','isEmpty','agent','resourceId','push','ToId','read','-createdAt','eml-format','rimraf','zip-dir','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','catch','options','create','body','params','describe','messages','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','User','findAll','admin','user','fullname','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Agents'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe363,0x1bd));var _0x3e36=function(_0x25d87d,_0xad468c){_0x25d87d=_0x25d87d-0x0;var _0x54e42b=_0xe363[_0x25d87d];return _0x54e42b;};'use strict';var emlformat=require(_0x3e36('0x0'));var rimraf=require(_0x3e36('0x1'));var zipdir=require(_0x3e36('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3e36('0x3'));var util=require('util');var path=require(_0x3e36('0x4'));var sox=require('sox');var csv=require(_0x3e36('0x5'));var ejs=require(_0x3e36('0x6'));var fs=require('fs');var fs_extra=require(_0x3e36('0x7'));var _=require(_0x3e36('0x8'));var squel=require(_0x3e36('0x9'));var crypto=require(_0x3e36('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3e36('0xb'));var Papa=require(_0x3e36('0xc'));var Redis=require(_0x3e36('0xd'));var authService=require(_0x3e36('0xe'));var qs=require(_0x3e36('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e36('0x10'));var logger=require(_0x3e36('0x11'))(_0x3e36('0x12'));var utils=require(_0x3e36('0x13'));var config=require(_0x3e36('0x14'));var licenseUtil=require(_0x3e36('0x15'));var db=require(_0x3e36('0x16'))['db'];config[_0x3e36('0x17')]=_[_0x3e36('0x18')](config[_0x3e36('0x17')],{'host':_0x3e36('0x19'),'port':0x18eb});var socket=require(_0x3e36('0x1a'))(new Redis(config[_0x3e36('0x17')]));require('./chatInternalMessage.socket')[_0x3e36('0x1b')](socket);function respondWithStatusCode(_0x5c4afe,_0x5f8ae2){_0x5f8ae2=_0x5f8ae2||0xcc;return function(_0x2f5a4e){if(_0x2f5a4e){return _0x5c4afe['sendStatus'](_0x5f8ae2);}return _0x5c4afe[_0x3e36('0x1c')](_0x5f8ae2)[_0x3e36('0x1d')]();};}function respondWithResult(_0x41654f,_0xc6970){_0xc6970=_0xc6970||0xc8;return function(_0xcda193){if(_0xcda193){return _0x41654f['status'](_0xc6970)['json'](_0xcda193);}};}function respondWithFilteredResult(_0x16b9ee,_0x3a059f){return function(_0x49c422){if(_0x49c422){var _0x5bef23=typeof _0x3a059f[_0x3e36('0x1e')]===_0x3e36('0x1f')&&typeof _0x3a059f['limit']===_0x3e36('0x1f');var _0xedf502=_0x49c422[_0x3e36('0x20')];var _0x12f0d7=_0x5bef23?0x0:_0x3a059f[_0x3e36('0x1e')];var _0x11895c=_0x5bef23?_0x49c422['count']:_0x3a059f['offset']+_0x3a059f[_0x3e36('0x21')];var _0xa23342;if(_0x11895c>=_0xedf502){_0x11895c=_0xedf502;_0xa23342=0xc8;}else{_0xa23342=0xce;}_0x16b9ee[_0x3e36('0x1c')](_0xa23342);return _0x16b9ee['set'](_0x3e36('0x22'),_0x12f0d7+'-'+_0x11895c+'/'+_0xedf502)[_0x3e36('0x23')](_0x49c422);}return null;};}function patchUpdates(_0x43386e){return function(_0x180831){try{jsonpatch[_0x3e36('0x24')](_0x180831,_0x43386e,!![]);}catch(_0x296c33){return BPromise[_0x3e36('0x25')](_0x296c33);}return _0x180831[_0x3e36('0x26')]();};}function saveUpdates(_0x2b5e90,_0xe2cbf8){return function(_0x4ff7d6){if(_0x4ff7d6){return _0x4ff7d6[_0x3e36('0x27')](_0x2b5e90)[_0x3e36('0x28')](function(_0x3df290){return _0x3df290;});}return null;};}function removeEntity(_0x2474a7,_0x3a3b79){return function(_0x5a8b62){if(_0x5a8b62){return _0x5a8b62[_0x3e36('0x29')]()[_0x3e36('0x28')](function(){_0x2474a7[_0x3e36('0x1c')](0xcc)[_0x3e36('0x1d')]();});}};}function handleEntityNotFound(_0x250f6e,_0x500a85){return function(_0xe37eaf){if(!_0xe37eaf){_0x250f6e[_0x3e36('0x2a')](0x194);}return _0xe37eaf;};}function handleError(_0x12a802,_0x146852){_0x146852=_0x146852||0x1f4;return function(_0x4aa750){logger[_0x3e36('0x2b')](_0x4aa750[_0x3e36('0x2c')]);if(_0x4aa750[_0x3e36('0x2d')]){delete _0x4aa750[_0x3e36('0x2d')];}_0x12a802[_0x3e36('0x1c')](_0x146852)[_0x3e36('0x2e')](_0x4aa750);};}exports[_0x3e36('0x2f')]=function(_0x3733a9,_0x384a22){var _0x54826d={},_0x23c644={},_0x1ed197={'count':0x0,'rows':[]};var _0x1d18d5=_[_0x3e36('0x30')](db[_0x3e36('0x31')][_0x3e36('0x32')],function(_0x49963b){return{'name':_0x49963b[_0x3e36('0x33')],'type':_0x49963b[_0x3e36('0x34')]['key']};});_0x23c644[_0x3e36('0x35')]=_[_0x3e36('0x30')](_0x1d18d5,_0x3e36('0x2d'));_0x23c644[_0x3e36('0x36')]=_[_0x3e36('0x37')](_0x3733a9[_0x3e36('0x36')]);_0x23c644[_0x3e36('0x38')]=_['intersection'](_0x23c644[_0x3e36('0x35')],_0x23c644[_0x3e36('0x36')]);_0x54826d[_0x3e36('0x39')]=_[_0x3e36('0x3a')](_0x23c644[_0x3e36('0x35')],qs[_0x3e36('0x3b')](_0x3733a9[_0x3e36('0x36')][_0x3e36('0x3b')]));_0x54826d[_0x3e36('0x39')]=_0x54826d['attributes'][_0x3e36('0x3c')]?_0x54826d[_0x3e36('0x39')]:_0x23c644['model'];if(!_0x3733a9[_0x3e36('0x36')][_0x3e36('0x3d')](_0x3e36('0x3e'))){_0x54826d[_0x3e36('0x21')]=qs[_0x3e36('0x21')](_0x3733a9[_0x3e36('0x36')]['limit']);_0x54826d[_0x3e36('0x1e')]=qs[_0x3e36('0x1e')](_0x3733a9['query'][_0x3e36('0x1e')]);}_0x54826d[_0x3e36('0x3f')]=qs[_0x3e36('0x40')](_0x3733a9[_0x3e36('0x36')]['sort']);_0x54826d[_0x3e36('0x41')]=qs[_0x3e36('0x38')](_['pick'](_0x3733a9[_0x3e36('0x36')],_0x23c644[_0x3e36('0x38')]),_0x1d18d5);if(_0x3733a9[_0x3e36('0x36')][_0x3e36('0x42')]){_0x54826d[_0x3e36('0x41')]=_[_0x3e36('0x43')](_0x54826d['where'],{'$or':_['map'](_0x1d18d5,function(_0x4ae395){if(_0x4ae395[_0x3e36('0x34')]!==_0x3e36('0x44')){var _0x1432b5={};_0x1432b5[_0x4ae395[_0x3e36('0x2d')]]={'$like':'%'+_0x3733a9[_0x3e36('0x36')][_0x3e36('0x42')]+'%'};return _0x1432b5;}})});}_0x54826d=_['merge']({},_0x54826d,_0x3733a9['options']);var _0x227af1={'where':_0x54826d[_0x3e36('0x41')]};return db['ChatInternalMessage']['count'](_0x227af1)[_0x3e36('0x28')](function(_0x2119f4){_0x1ed197[_0x3e36('0x20')]=_0x2119f4;if(_0x3733a9[_0x3e36('0x36')]['includeAll']){_0x54826d[_0x3e36('0x45')]=[{'all':!![]}];}return db[_0x3e36('0x31')]['findAll'](_0x54826d);})[_0x3e36('0x28')](function(_0x91e414){_0x1ed197['rows']=_0x91e414;return _0x1ed197;})[_0x3e36('0x28')](respondWithFilteredResult(_0x384a22,_0x54826d))[_0x3e36('0x46')](handleError(_0x384a22,null));};exports['show']=function(_0x428231,_0x258310){var _0x2147ba={'raw':!![],'where':{'id':_0x428231['params']['id']}},_0x2152ca={};_0x2152ca[_0x3e36('0x35')]=_[_0x3e36('0x37')](db[_0x3e36('0x31')]['rawAttributes']);_0x2152ca['query']=_[_0x3e36('0x37')](_0x428231[_0x3e36('0x36')]);_0x2152ca[_0x3e36('0x38')]=_[_0x3e36('0x3a')](_0x2152ca['model'],_0x2152ca[_0x3e36('0x36')]);_0x2147ba[_0x3e36('0x39')]=_[_0x3e36('0x3a')](_0x2152ca['model'],qs['fields'](_0x428231[_0x3e36('0x36')]['fields']));_0x2147ba[_0x3e36('0x39')]=_0x2147ba['attributes']['length']?_0x2147ba[_0x3e36('0x39')]:_0x2152ca[_0x3e36('0x35')];if(_0x428231[_0x3e36('0x36')]['includeAll']){_0x2147ba['include']=[{'all':!![]}];}_0x2147ba=_[_0x3e36('0x43')]({},_0x2147ba,_0x428231[_0x3e36('0x47')]);return db[_0x3e36('0x31')]['find'](_0x2147ba)['then'](handleEntityNotFound(_0x258310,null))['then'](respondWithResult(_0x258310,null))[_0x3e36('0x46')](handleError(_0x258310,null));};exports['create']=function(_0x421076,_0x51f5f3){return db['ChatInternalMessage'][_0x3e36('0x48')](_0x421076[_0x3e36('0x49')],{})[_0x3e36('0x28')](respondWithResult(_0x51f5f3,0xc9))[_0x3e36('0x46')](handleError(_0x51f5f3,null));};exports[_0x3e36('0x27')]=function(_0x2f8846,_0x2352de){if(_0x2f8846[_0x3e36('0x49')]['id']){delete _0x2f8846[_0x3e36('0x49')]['id'];}return db[_0x3e36('0x31')]['find']({'where':{'id':_0x2f8846[_0x3e36('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2352de,null))[_0x3e36('0x28')](saveUpdates(_0x2f8846[_0x3e36('0x49')],null))[_0x3e36('0x28')](respondWithResult(_0x2352de,null))[_0x3e36('0x46')](handleError(_0x2352de,null));};exports[_0x3e36('0x29')]=function(_0x5667b9,_0x3b3e13){return db[_0x3e36('0x31')]['find']({'where':{'id':_0x5667b9[_0x3e36('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b3e13,null))[_0x3e36('0x28')](removeEntity(_0x3b3e13,null))[_0x3e36('0x46')](handleError(_0x3b3e13,null));};exports[_0x3e36('0x4b')]=function(_0x338e9d,_0x5693aa){return db[_0x3e36('0x31')][_0x3e36('0x4b')]()[_0x3e36('0x28')](respondWithResult(_0x5693aa,null))[_0x3e36('0x46')](handleError(_0x5693aa,null));};function wrapUser(_0x3a5898){return function(_0x5cbcd3){var _0xa8a425=_0x3a5898['get']({'plain':!![]});_0xa8a425[_0x3e36('0x4c')]=[];if(_0x5cbcd3){_0xa8a425['lastMessageAt']=_0x5cbcd3[_0x3e36('0x4d')];_0xa8a425[_0x3e36('0x4e')]=_0x5cbcd3;}else{_0xa8a425[_0x3e36('0x4f')]=moment(0x0)['format'](_0x3e36('0x50'));_0xa8a425['lastMessage']={};}return _0xa8a425;};}exports['getUsers']=function(_0x5a6697,_0x4553cf,_0x5aefdb){var _0x2ad2a8=[];return db[_0x3e36('0x51')][_0x3e36('0x52')]({'where':{'role':['agent',_0x3e36('0x53'),_0x3e36('0x54')]},'attributes':['id',_0x3e36('0x55'),_0x3e36('0x2d'),'role',_0x3e36('0x56'),_0x3e36('0x57'),_0x3e36('0x58'),_0x3e36('0x59'),'allowmessenger',_0x3e36('0x5a')],'order':qs['sort'](_0x3e36('0x5b')),'include':[{'model':db[_0x3e36('0x5c')],'as':_0x3e36('0x5d'),'attributes':['id',_0x3e36('0x2d'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x41222d){if(_0x41222d){var _0x289e78=_0x5a6697[_0x3e36('0x54')][_0x3e36('0x5e')]({'plain':!![]});if(!_0x289e78)throw new Error(_0x3e36('0x5f'));if(_0x289e78[_0x3e36('0x60')]==='user'){return db[_0x3e36('0x61')][_0x3e36('0x62')]({'where':{'name':_0x3e36('0x63'),'userProfileId':_0x289e78[_0x3e36('0x64')]},'raw':!![]})[_0x3e36('0x28')](function(_0x2ea843){if(_0x2ea843){if(_0x2ea843['autoAssociation']===0x0){return db[_0x3e36('0x65')][_0x3e36('0x52')]({'where':{'sectionId':_0x2ea843['id']},'raw':!![]})['then'](function(_0x294c85){var _0x4108a9=[];if(_[_0x3e36('0x66')](_0x294c85)){_0x4108a9=_[_0x3e36('0x42')](_0x41222d,function(_0x49eeb4){if(_0x49eeb4[_0x3e36('0x60')]!==_0x3e36('0x67')){return _0x49eeb4;}});return _0x4108a9;}else{for(var _0x439ad3=0x0;_0x439ad3<_0x41222d['length'];_0x439ad3++){var _0x51b5e3=_0x41222d[_0x439ad3];if(_0x51b5e3['role']==='agent'){var _0x197287=_['find'](_0x294c85,function(_0x258036){return _0x258036[_0x3e36('0x68')]===_0x51b5e3['id'];});if(_0x197287)_0x4108a9[_0x3e36('0x69')](_0x51b5e3);}else{_0x4108a9[_0x3e36('0x69')](_0x51b5e3);}}return _0x4108a9;}});}else{return _0x41222d;}}else{var _0x5a54e1=_[_0x3e36('0x42')](_0x41222d,function(_0x3818a6){if(_0x3818a6[_0x3e36('0x60')]!==_0x3e36('0x67')){return _0x3818a6;}});return _0x5a54e1;}});}else{return _0x41222d;}}})[_0x3e36('0x28')](function(_0x1c4cfd){var _0x40d61c=[];if(_0x1c4cfd){_0x2ad2a8=_0x1c4cfd;for(var _0x309d64=0x0;_0x309d64<_0x1c4cfd[_0x3e36('0x3c')];_0x309d64+=0x1){_0x2ad2a8[_0x309d64][_0x3e36('0x4c')]=[];_0x40d61c['push'](db['ChatInternalMessage'][_0x3e36('0x62')]({'where':{'FromId':[_0x5a6697['user']['id'],_0x1c4cfd[_0x309d64]['id']],'ToId':[_0x5a6697[_0x3e36('0x54')]['id'],_0x1c4cfd[_0x309d64]['id']],'ChatGroupId':null},'attributes':['id',_0x3e36('0x4d'),'FromId',_0x3e36('0x6a'),_0x3e36('0x6b'),_0x3e36('0x49')],'order':qs[_0x3e36('0x40')](_0x3e36('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3e36('0x28')](wrapUser(_0x1c4cfd[_0x309d64])));}return BPromise['all'](_0x40d61c);}return[];})[_0x3e36('0x28')](function(_0x3256ea){return{'rows':_0x3256ea,'count':_0x3256ea[_0x3e36('0x3c')]};})[_0x3e36('0x28')](respondWithResult(_0x4553cf,null))[_0x3e36('0x46')](handleError(_0x4553cf,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a15a149..b9103f2 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 _0x3176=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3176,0x1d8));var _0x6317=function(_0x2b81b6,_0x45d457){_0x2b81b6=_0x2b81b6-0x0;var _0x49d16f=_0x3176[_0x2b81b6];return _0x49d16f;};'use strict';var EventEmitter=require(_0x6317('0x0'));var ChatInternalMessage=require(_0x6317('0x1'))['db'][_0x6317('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6317('0x3')](0x0);var events={'afterCreate':_0x6317('0x4'),'afterUpdate':_0x6317('0x5'),'afterDestroy':_0x6317('0x6')};function emitEvent(_0x39565b){return function(_0x2cba9c,_0x26a4c7,_0x14cc52){ChatInternalMessageEvents[_0x6317('0x7')](_0x39565b+':'+_0x2cba9c['id'],_0x2cba9c);ChatInternalMessageEvents[_0x6317('0x7')](_0x39565b,_0x2cba9c);_0x14cc52(null);};}for(var e in events){if(events[_0x6317('0x8')](e)){var event=events[e];ChatInternalMessage[_0x6317('0x9')](e,emitEvent(event));}}module[_0x6317('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x4200=['hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x4200,0x188));var _0x0420=function(_0x225536,_0x315c28){_0x225536=_0x225536-0x0;var _0x4c39e5=_0x4200[_0x225536];return _0x4c39e5;};'use strict';var EventEmitter=require(_0x0420('0x0'));var ChatInternalMessage=require(_0x0420('0x1'))['db'][_0x0420('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0420('0x3')](0x0);var events={'afterCreate':_0x0420('0x4'),'afterUpdate':_0x0420('0x5'),'afterDestroy':_0x0420('0x6')};function emitEvent(_0x3ab500){return function(_0x370bf7,_0x58c1d4,_0x3142a3){ChatInternalMessageEvents[_0x0420('0x7')](_0x3ab500+':'+_0x370bf7['id'],_0x370bf7);ChatInternalMessageEvents[_0x0420('0x7')](_0x3ab500,_0x370bf7);_0x3142a3(null);};}for(var e in events){if(events[_0x0420('0x8')](e)){var event=events[e];ChatInternalMessage[_0x0420('0x9')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index e45e8e7..460ca13 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 _0x072f=['./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2529fb,_0xab4612){var _0x15f6ed=function(_0x39b93f){while(--_0x39b93f){_0x2529fb['push'](_0x2529fb['shift']());}};_0x15f6ed(++_0xab4612);}(_0x072f,0x122));var _0xf072=function(_0x4a93c9,_0x4b5005){_0x4a93c9=_0x4a93c9-0x0;var _0x42ad3f=_0x072f[_0x4a93c9];return _0x42ad3f;};'use strict';var _=require(_0xf072('0x0'));var util=require(_0xf072('0x1'));var logger=require(_0xf072('0x2'))(_0xf072('0x3'));var moment=require(_0xf072('0x4'));var BPromise=require(_0xf072('0x5'));var rp=require(_0xf072('0x6'));var fs=require('fs');var path=require(_0xf072('0x7'));var rimraf=require(_0xf072('0x8'));var config=require(_0xf072('0x9'));var attributes=require(_0xf072('0xa'));module[_0xf072('0xb')]=function(_0x5e701f,_0x244037){return _0x5e701f['define'](_0xf072('0xc'),attributes,{'tableName':_0xf072('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf072('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7903=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x7903,0x148));var _0x3790=function(_0x3fbfc4,_0x244e54){_0x3fbfc4=_0x3fbfc4-0x0;var _0x469cb9=_0x7903[_0x3fbfc4];return _0x469cb9;};'use strict';var _=require(_0x3790('0x0'));var util=require(_0x3790('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3790('0x2'));var BPromise=require(_0x3790('0x3'));var rp=require(_0x3790('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3790('0x5'));var config=require(_0x3790('0x6'));var attributes=require(_0x3790('0x7'));module[_0x3790('0x8')]=function(_0xd129fb,_0x253ae9){return _0xd129fb[_0x3790('0x9')](_0x3790('0xa'),attributes,{'tableName':_0x3790('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3790('0xc'),'collate':_0x3790('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 112ba16..728018a 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 _0x91d9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x91d9,0xe0));var _0x991d=function(_0x17020d,_0x265527){_0x17020d=_0x17020d-0x0;var _0x1623b8=_0x91d9[_0x17020d];return _0x1623b8;};'use strict';var _=require('lodash');var util=require(_0x991d('0x0'));var moment=require(_0x991d('0x1'));var BPromise=require(_0x991d('0x2'));var rs=require(_0x991d('0x3'));var fs=require('fs');var Redis=require(_0x991d('0x4'));var db=require(_0x991d('0x5'))['db'];var utils=require(_0x991d('0x6'));var logger=require('../../config/logger')(_0x991d('0x7'));var config=require(_0x991d('0x8'));var jayson=require(_0x991d('0x9'));var client=jayson[_0x991d('0xa')]['http']({'port':0x232a});config[_0x991d('0xb')]=_[_0x991d('0xc')](config[_0x991d('0xb')],{'host':_0x991d('0xd'),'port':0x18eb});var socket=require(_0x991d('0xe'))(new Redis(config[_0x991d('0xb')]));require('./chatInternalMessage.socket')[_0x991d('0xf')](socket);function respondWithRpcPromise(_0x332cbe,_0x53da15,_0x416b78){return new BPromise(function(_0x343b13,_0x4be5e8){return client[_0x991d('0x10')](_0x332cbe,_0x416b78)[_0x991d('0x11')](function(_0x15c769){logger[_0x991d('0x12')](_0x991d('0x13'),_0x53da15,_0x991d('0x14'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x53da15,'request\x20sent',JSON[_0x991d('0x15')](_0x15c769));if(_0x15c769[_0x991d('0x16')]){if(_0x15c769[_0x991d('0x16')]['code']===0x1f4){logger[_0x991d('0x16')](_0x991d('0x13'),_0x53da15,_0x15c769['error'][_0x991d('0x17')]);return _0x4be5e8(_0x15c769[_0x991d('0x16')][_0x991d('0x17')]);}logger['error'](_0x991d('0x13'),_0x53da15,_0x15c769['error'][_0x991d('0x17')]);return _0x343b13(_0x15c769['error']['message']);}else{logger[_0x991d('0x12')](_0x991d('0x13'),_0x53da15,_0x991d('0x14'));_0x343b13(_0x15c769[_0x991d('0x18')][_0x991d('0x17')]);}})['catch'](function(_0x46122f){logger['error'](_0x991d('0x13'),_0x53da15,_0x46122f);_0x4be5e8(_0x46122f);});});} \ No newline at end of file +var _0xd5bf=['register','then','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter'];(function(_0x25689f,_0x37a6fb){var _0x364094=function(_0x29b5d8){while(--_0x29b5d8){_0x25689f['push'](_0x25689f['shift']());}};_0x364094(++_0x37a6fb);}(_0xd5bf,0x66));var _0xfd5b=function(_0x5b338a,_0x254f6f){_0x5b338a=_0x5b338a-0x0;var _0x5b23f8=_0xd5bf[_0x5b338a];return _0x5b23f8;};'use strict';var _=require(_0xfd5b('0x0'));var util=require(_0xfd5b('0x1'));var moment=require(_0xfd5b('0x2'));var BPromise=require(_0xfd5b('0x3'));var rs=require(_0xfd5b('0x4'));var fs=require('fs');var Redis=require(_0xfd5b('0x5'));var db=require(_0xfd5b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfd5b('0x7'));var config=require(_0xfd5b('0x8'));var jayson=require(_0xfd5b('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xfd5b('0xa')]=_[_0xfd5b('0xb')](config[_0xfd5b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfd5b('0xc'))(new Redis(config[_0xfd5b('0xa')]));require('./chatInternalMessage.socket')[_0xfd5b('0xd')](socket);function respondWithRpcPromise(_0x40b49b,_0x5eefe8,_0x20222a){return new BPromise(function(_0x56e7e7,_0x29ee53){return client['request'](_0x40b49b,_0x20222a)[_0xfd5b('0xe')](function(_0x4b3da7){logger[_0xfd5b('0xf')](_0xfd5b('0x10'),_0x5eefe8,'request\x20sent');logger['debug'](_0xfd5b('0x11'),_0x5eefe8,_0xfd5b('0x12'),JSON['stringify'](_0x4b3da7));if(_0x4b3da7[_0xfd5b('0x13')]){if(_0x4b3da7[_0xfd5b('0x13')][_0xfd5b('0x14')]===0x1f4){logger[_0xfd5b('0x13')](_0xfd5b('0x10'),_0x5eefe8,_0x4b3da7[_0xfd5b('0x13')][_0xfd5b('0x15')]);return _0x29ee53(_0x4b3da7[_0xfd5b('0x13')][_0xfd5b('0x15')]);}logger[_0xfd5b('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x5eefe8,_0x4b3da7[_0xfd5b('0x13')][_0xfd5b('0x15')]);return _0x56e7e7(_0x4b3da7[_0xfd5b('0x13')][_0xfd5b('0x15')]);}else{logger['info'](_0xfd5b('0x10'),_0x5eefe8,'request\x20sent');_0x56e7e7(_0x4b3da7['result'][_0xfd5b('0x15')]);}})[_0xfd5b('0x16')](function(_0x4bd45e){logger[_0xfd5b('0x13')](_0xfd5b('0x10'),_0x5eefe8,_0x4bd45e);_0x29ee53(_0x4bd45e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 3b4ef11..5b356d4 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 _0xf9ad=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf9ad,0xf1));var _0xdf9a=function(_0x58c952,_0x303f83){_0x58c952=_0x58c952-0x0;var _0x1be0b3=_0xf9ad[_0x58c952];return _0x1be0b3;};'use strict';var ChatInternalMessageEvents=require(_0xdf9a('0x0'));var events=[_0xdf9a('0x1'),_0xdf9a('0x2'),_0xdf9a('0x3')];function createListener(_0x4af242,_0x53f1fd){return function(_0x58bc7d){_0x53f1fd[_0xdf9a('0x4')](_0x4af242,_0x58bc7d);};}function removeListener(_0x25010c,_0x381dda){return function(){ChatInternalMessageEvents[_0xdf9a('0x5')](_0x25010c,_0x381dda);};}exports[_0xdf9a('0x6')]=function(_0x498c0d){for(var _0xa2f117=0x0,_0x25772e=events[_0xdf9a('0x7')];_0xa2f117<_0x25772e;_0xa2f117++){var _0x3469de=events[_0xa2f117];var _0x10fc37=createListener(_0xdf9a('0x8')+_0x3469de,_0x498c0d);ChatInternalMessageEvents['on'](_0x3469de,_0x10fc37);}}; \ No newline at end of file +var _0x0fee=['chatInternalMessage:','emit','removeListener','register','length'];(function(_0x2067e3,_0x19bcb2){var _0x180c44=function(_0x53751f){while(--_0x53751f){_0x2067e3['push'](_0x2067e3['shift']());}};_0x180c44(++_0x19bcb2);}(_0x0fee,0x1af));var _0xe0fe=function(_0x3646b4,_0x16af8f){_0x3646b4=_0x3646b4-0x0;var _0x16184a=_0x0fee[_0x3646b4];return _0x16184a;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save','remove','update'];function createListener(_0x53cbba,_0x4ac8fc){return function(_0x12d326){_0x4ac8fc[_0xe0fe('0x0')](_0x53cbba,_0x12d326);};}function removeListener(_0x10401f,_0x24db67){return function(){ChatInternalMessageEvents[_0xe0fe('0x1')](_0x10401f,_0x24db67);};}exports[_0xe0fe('0x2')]=function(_0x6850ec){for(var _0x3ce791=0x0,_0x483415=events[_0xe0fe('0x3')];_0x3ce791<_0x483415;_0x3ce791++){var _0x3e83f0=events[_0x3ce791];var _0x157361=createListener(_0xe0fe('0x4')+_0x3e83f0,_0x6850ec);ChatInternalMessageEvents['on'](_0x3e83f0,_0x157361);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index ddb102d..f16abec 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 _0x0a0a=['Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x26dae2,_0x1fc18e){var _0xf3c9f4=function(_0x4f77d9){while(--_0x4f77d9){_0x26dae2['push'](_0x26dae2['shift']());}};_0xf3c9f4(++_0x1fc18e);}(_0x0a0a,0x11c));var _0xa0a0=function(_0x1dfdd6,_0x10b2dd){_0x1dfdd6=_0x1dfdd6-0x0;var _0x1929db=_0x0a0a[_0x1dfdd6];return _0x1929db;};'use strict';var multer=require(_0xa0a0('0x0'));var util=require(_0xa0a0('0x1'));var path=require(_0xa0a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xa0a0('0x3'));var router=express[_0xa0a0('0x4')]();var fs_extra=require(_0xa0a0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a0('0x6'));var config=require(_0xa0a0('0x7'));var controller=require(_0xa0a0('0x8'));router['get']('/',auth[_0xa0a0('0x9')](),controller[_0xa0a0('0xa')]);router[_0xa0a0('0xb')](_0xa0a0('0xc'),auth[_0xa0a0('0x9')](),controller[_0xa0a0('0xd')]);router['get'](_0xa0a0('0xe'),auth[_0xa0a0('0x9')](),controller['getUsers']);router[_0xa0a0('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa0a0('0xf')]);router[_0xa0a0('0x10')]('/',auth[_0xa0a0('0x9')](),controller[_0xa0a0('0x11')]);router[_0xa0a0('0x12')](_0xa0a0('0x13'),controller[_0xa0a0('0x14')]);router[_0xa0a0('0x15')]('/:id',auth[_0xa0a0('0x9')](),controller[_0xa0a0('0x16')]);module[_0xa0a0('0x17')]=router; \ No newline at end of file +var _0x733e=['isAuthenticated','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x5305e6,_0x12781f){var _0x30c6f2=function(_0x423fe7){while(--_0x423fe7){_0x5305e6['push'](_0x5305e6['shift']());}};_0x30c6f2(++_0x12781f);}(_0x733e,0x115));var _0xe733=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x733e[_0xe501ff];return _0x17135d;};'use strict';var multer=require(_0xe733('0x0'));var util=require(_0xe733('0x1'));var path=require(_0xe733('0x2'));var timeout=require(_0xe733('0x3'));var express=require('express');var router=express[_0xe733('0x4')]();var fs_extra=require(_0xe733('0x5'));var auth=require(_0xe733('0x6'));var interaction=require(_0xe733('0x7'));var config=require(_0xe733('0x8'));var controller=require(_0xe733('0x9'));router[_0xe733('0xa')]('/',auth[_0xe733('0xb')](),controller['index']);router[_0xe733('0xa')](_0xe733('0xc'),auth[_0xe733('0xb')](),controller[_0xe733('0xd')]);router['get'](_0xe733('0xe'),auth['isAuthenticated'](),controller[_0xe733('0xf')]);router['get'](_0xe733('0x10'),auth[_0xe733('0xb')](),controller[_0xe733('0x11')]);router[_0xe733('0x12')]('/',auth[_0xe733('0xb')](),controller[_0xe733('0x13')]);router['put']('/:id',controller[_0xe733('0x14')]);router[_0xe733('0x15')](_0xe733('0x10'),auth[_0xe733('0xb')](),controller[_0xe733('0x16')]);module[_0xe733('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index fc3b0d7..1a18916 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 _0xe5b5=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x347379,_0x37de29){var _0x1e6dbf=function(_0x137484){while(--_0x137484){_0x347379['push'](_0x347379['shift']());}};_0x1e6dbf(++_0x37de29);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0xe5b5[_0x15ca1a];return _0x507626;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'body':{'type':Sequelize[_0x5e5b('0x2')](_0x5e5b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5e5b('0x5')]('in',_0x5e5b('0x6')),'defaultValue':_0x5e5b('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5e5b('0x7')]},'providerName':{'type':Sequelize[_0x5e5b('0x8')]},'providerResponse':{'type':Sequelize[_0x5e5b('0x2')]}}; \ No newline at end of file +var _0x1bd1=['BOOLEAN','DATE','STRING','sequelize','exports','TEXT'];(function(_0x2ef476,_0x19dc5a){var _0x4c11b0=function(_0x5989dc){while(--_0x5989dc){_0x2ef476['push'](_0x2ef476['shift']());}};_0x4c11b0(++_0x19dc5a);}(_0x1bd1,0x123));var _0x11bd=function(_0x10cb1e,_0x1974aa){_0x10cb1e=_0x10cb1e-0x0;var _0x51bbc9=_0x1bd1[_0x10cb1e];return _0x51bbc9;};'use strict';var Sequelize=require(_0x11bd('0x0'));module[_0x11bd('0x1')]={'body':{'type':Sequelize[_0x11bd('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x11bd('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x11bd('0x4')]},'providerName':{'type':Sequelize[_0x11bd('0x5')]},'providerResponse':{'type':Sequelize[_0x11bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 319d816..20744e7 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 _0xe2ea=['interface','motionChannel','rejectmessage','formData','eml-format','rimraf','fast-json-patch','request-promise','moment','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','fields','length','find','create','body','update','describe','chat-interactions','chat','read','readAt','format','UserId','user','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','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','Sequelize','QueryTypes','SELECT','agent','fullname','email','internal','manual','SIP/%s','channel','accept','EventManager','parse','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','contact'];(function(_0x76d0dd,_0x16716d){var _0x508d20=function(_0x15af09){while(--_0x15af09){_0x76d0dd['push'](_0x76d0dd['shift']());}};_0x508d20(++_0x16716d);}(_0xe2ea,0x8c));var _0xae2e=function(_0x55f075,_0x7d0cd3){_0x55f075=_0x55f075-0x0;var _0xea7256=_0xe2ea[_0x55f075];return _0xea7256;};'use strict';var emlformat=require(_0xae2e('0x0'));var rimraf=require(_0xae2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae2e('0x2'));var rp=require(_0xae2e('0x3'));var moment=require(_0xae2e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xae2e('0x5'));var util=require(_0xae2e('0x6'));var path=require(_0xae2e('0x7'));var sox=require(_0xae2e('0x8'));var csv=require(_0xae2e('0x9'));var ejs=require(_0xae2e('0xa'));var fs=require('fs');var fs_extra=require(_0xae2e('0xb'));var _=require(_0xae2e('0xc'));var squel=require('squel');var crypto=require(_0xae2e('0xd'));var jsforce=require(_0xae2e('0xe'));var deskjs=require(_0xae2e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xae2e('0x10'));var Papa=require(_0xae2e('0x11'));var Redis=require(_0xae2e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xae2e('0x13'));var as=require(_0xae2e('0x14'));var hardwareService=require(_0xae2e('0x15'));var logger=require(_0xae2e('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xae2e('0x17'));var db=require(_0xae2e('0x18'))['db'];config[_0xae2e('0x19')]=_[_0xae2e('0x1a')](config['redis'],{'host':_0xae2e('0x1b'),'port':0x18eb});var socket=require(_0xae2e('0x1c'))(new Redis(config[_0xae2e('0x19')]));require(_0xae2e('0x1d'))[_0xae2e('0x1e')](socket);var jayson=require(_0xae2e('0x1f'));var client=jayson['client'][_0xae2e('0x20')]({'port':0x232c});var client9002=jayson[_0xae2e('0x21')][_0xae2e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xa0e592,_0x113409,_0x2a33fb,_0x2a135f){return new BPromise(function(_0x29401c,_0x42ff52){var _0x3690f9=_0x2a135f||client;return _0x3690f9[_0xae2e('0x22')](_0xa0e592,_0x2a33fb)[_0xae2e('0x23')](function(_0x3b0570){logger[_0xae2e('0x24')]('ChatMessage,\x20%s,\x20%s',_0x113409,_0xae2e('0x25'));logger[_0xae2e('0x26')](_0xae2e('0x27'),_0x113409,_0xae2e('0x25'),JSON[_0xae2e('0x28')](_0x3b0570));if(_0x3b0570['error']){if(_0x3b0570[_0xae2e('0x29')][_0xae2e('0x2a')]===0x1f4){logger[_0xae2e('0x29')](_0xae2e('0x2b'),_0x113409,_0x3b0570[_0xae2e('0x29')]['message']);return _0x42ff52(_0x3b0570[_0xae2e('0x29')][_0xae2e('0x2c')]);}logger[_0xae2e('0x29')](_0xae2e('0x2b'),_0x113409,_0x3b0570[_0xae2e('0x29')][_0xae2e('0x2c')]);return _0x29401c(_0x3b0570['error'][_0xae2e('0x2c')]);}else{logger[_0xae2e('0x24')]('ChatMessage,\x20%s,\x20%s',_0x113409,'request\x20sent');_0x29401c(_0x3b0570[_0xae2e('0x2d')]['message']);}})[_0xae2e('0x2e')](function(_0x5297a0){logger[_0xae2e('0x29')]('ChatMessage,\x20%s,\x20%s',_0x113409,_0x5297a0);_0x42ff52(_0x5297a0);});});}function respondWithStatusCode(_0x23a959,_0x839e02){_0x839e02=_0x839e02||0xcc;return function(_0x2d54dc){if(_0x2d54dc){return _0x23a959[_0xae2e('0x2f')](_0x839e02);}return _0x23a959[_0xae2e('0x30')](_0x839e02)[_0xae2e('0x31')]();};}function respondWithResult(_0x5579ee,_0x51c003){_0x51c003=_0x51c003||0xc8;return function(_0x55b12f){if(_0x55b12f){return _0x5579ee[_0xae2e('0x30')](_0x51c003)[_0xae2e('0x32')](_0x55b12f);}};}function respondWithFilteredResult(_0x735f6d,_0x4d743b){return function(_0x369a3f){if(_0x369a3f){var _0x51c273=typeof _0x4d743b[_0xae2e('0x33')]===_0xae2e('0x34')&&typeof _0x4d743b[_0xae2e('0x35')]===_0xae2e('0x34');var _0x494c2b=_0x369a3f[_0xae2e('0x36')];var _0x1aedef=_0x51c273?0x0:_0x4d743b['offset'];var _0x516435=_0x51c273?_0x369a3f[_0xae2e('0x36')]:_0x4d743b[_0xae2e('0x33')]+_0x4d743b[_0xae2e('0x35')];var _0x30c87f;if(_0x516435>=_0x494c2b){_0x516435=_0x494c2b;_0x30c87f=0xc8;}else{_0x30c87f=0xce;}_0x735f6d[_0xae2e('0x30')](_0x30c87f);return _0x735f6d['set']('Content-Range',_0x1aedef+'-'+_0x516435+'/'+_0x494c2b)[_0xae2e('0x32')](_0x369a3f);}return null;};}function patchUpdates(_0x5746d4){return function(_0x45b3fe){try{jsonpatch[_0xae2e('0x37')](_0x45b3fe,_0x5746d4,!![]);}catch(_0x67584c){return BPromise[_0xae2e('0x38')](_0x67584c);}return _0x45b3fe[_0xae2e('0x39')]();};}function saveUpdates(_0x2dc771,_0x158685){return function(_0x3e4ad9){if(_0x3e4ad9){return _0x3e4ad9['update'](_0x2dc771)['then'](function(_0x3ee747){return _0x3ee747;});}return null;};}function removeEntity(_0x40c3c1,_0x445e4e){return function(_0x35073d){if(_0x35073d){return _0x35073d[_0xae2e('0x3a')]()[_0xae2e('0x23')](function(){_0x40c3c1[_0xae2e('0x30')](0xcc)[_0xae2e('0x31')]();});}};}function handleEntityNotFound(_0x4e7fac,_0x4994f0){return function(_0x26365c){if(!_0x26365c){_0x4e7fac[_0xae2e('0x2f')](0x194);}return _0x26365c;};}function handleError(_0x7371e5,_0x3319ba){_0x3319ba=_0x3319ba||0x1f4;return function(_0x4de38f){logger[_0xae2e('0x29')](_0x4de38f[_0xae2e('0x3b')]);if(_0x4de38f[_0xae2e('0x3c')]){delete _0x4de38f[_0xae2e('0x3c')];}_0x7371e5[_0xae2e('0x30')](_0x3319ba)[_0xae2e('0x3d')](_0x4de38f);};}exports[_0xae2e('0x3e')]=function(_0x1c547c,_0x4ca077){var _0x48f3ae={},_0x40c62e={},_0x1f684b={'count':0x0,'rows':[]};var _0x37038a=_[_0xae2e('0x3f')](db[_0xae2e('0x40')][_0xae2e('0x41')],function(_0x3a83b7){return{'name':_0x3a83b7[_0xae2e('0x42')],'type':_0x3a83b7['type']['key']};});_0x40c62e[_0xae2e('0x43')]=_[_0xae2e('0x3f')](_0x37038a,'name');_0x40c62e[_0xae2e('0x44')]=_[_0xae2e('0x45')](_0x1c547c[_0xae2e('0x44')]);_0x40c62e[_0xae2e('0x46')]=_[_0xae2e('0x47')](_0x40c62e[_0xae2e('0x43')],_0x40c62e[_0xae2e('0x44')]);_0x48f3ae['attributes']=_[_0xae2e('0x47')](_0x40c62e[_0xae2e('0x43')],qs['fields'](_0x1c547c[_0xae2e('0x44')]['fields']));_0x48f3ae[_0xae2e('0x48')]=_0x48f3ae['attributes']['length']?_0x48f3ae['attributes']:_0x40c62e['model'];if(!_0x1c547c[_0xae2e('0x44')][_0xae2e('0x49')]('nolimit')){_0x48f3ae[_0xae2e('0x35')]=qs[_0xae2e('0x35')](_0x1c547c[_0xae2e('0x44')]['limit']);_0x48f3ae[_0xae2e('0x33')]=qs[_0xae2e('0x33')](_0x1c547c['query'][_0xae2e('0x33')]);}_0x48f3ae[_0xae2e('0x4a')]=qs['sort'](_0x1c547c[_0xae2e('0x44')][_0xae2e('0x4b')]);_0x48f3ae[_0xae2e('0x4c')]=qs['filters'](_[_0xae2e('0x4d')](_0x1c547c['query'],_0x40c62e['filters']),_0x37038a);if(_0x1c547c[_0xae2e('0x44')][_0xae2e('0x4e')]){_0x48f3ae[_0xae2e('0x4c')]=_[_0xae2e('0x4f')](_0x48f3ae[_0xae2e('0x4c')],{'$or':_['map'](_0x37038a,function(_0x26d79e){if(_0x26d79e[_0xae2e('0x50')]!==_0xae2e('0x51')){var _0x333b03={};_0x333b03[_0x26d79e[_0xae2e('0x3c')]]={'$like':'%'+_0x1c547c[_0xae2e('0x44')][_0xae2e('0x4e')]+'%'};return _0x333b03;}})});}_0x48f3ae=_[_0xae2e('0x4f')]({},_0x48f3ae,_0x1c547c[_0xae2e('0x52')]);var _0x1ac2bf={'where':_0x48f3ae[_0xae2e('0x4c')]};return db[_0xae2e('0x40')][_0xae2e('0x36')](_0x1ac2bf)[_0xae2e('0x23')](function(_0x4ab85e){_0x1f684b[_0xae2e('0x36')]=_0x4ab85e;if(_0x1c547c[_0xae2e('0x44')][_0xae2e('0x53')]){_0x48f3ae[_0xae2e('0x54')]=[{'all':!![]}];}return db[_0xae2e('0x40')][_0xae2e('0x55')](_0x48f3ae);})[_0xae2e('0x23')](function(_0x3728b1){_0x1f684b['rows']=_0x3728b1;return _0x1f684b;})['then'](respondWithFilteredResult(_0x4ca077,_0x48f3ae))['catch'](handleError(_0x4ca077,null));};exports[_0xae2e('0x56')]=function(_0xdf3d88,_0x4a1415){var _0x546eeb={'raw':!![],'where':{'id':_0xdf3d88[_0xae2e('0x57')]['id']}},_0x2c1044={};_0x2c1044[_0xae2e('0x43')]=_['keys'](db['ChatMessage'][_0xae2e('0x41')]);_0x2c1044[_0xae2e('0x44')]=_[_0xae2e('0x45')](_0xdf3d88[_0xae2e('0x44')]);_0x2c1044[_0xae2e('0x46')]=_[_0xae2e('0x47')](_0x2c1044['model'],_0x2c1044[_0xae2e('0x44')]);_0x546eeb[_0xae2e('0x48')]=_['intersection'](_0x2c1044[_0xae2e('0x43')],qs['fields'](_0xdf3d88[_0xae2e('0x44')][_0xae2e('0x58')]));_0x546eeb[_0xae2e('0x48')]=_0x546eeb[_0xae2e('0x48')][_0xae2e('0x59')]?_0x546eeb[_0xae2e('0x48')]:_0x2c1044[_0xae2e('0x43')];if(_0xdf3d88[_0xae2e('0x44')][_0xae2e('0x53')]){_0x546eeb[_0xae2e('0x54')]=[{'all':!![]}];}_0x546eeb=_[_0xae2e('0x4f')]({},_0x546eeb,_0xdf3d88[_0xae2e('0x52')]);return db['ChatMessage'][_0xae2e('0x5a')](_0x546eeb)[_0xae2e('0x23')](handleEntityNotFound(_0x4a1415,null))[_0xae2e('0x23')](respondWithResult(_0x4a1415,null))[_0xae2e('0x2e')](handleError(_0x4a1415,null));};exports['create']=function(_0x19c365,_0x44918c){return db[_0xae2e('0x40')][_0xae2e('0x5b')](_0x19c365[_0xae2e('0x5c')],{})[_0xae2e('0x23')](respondWithResult(_0x44918c,0xc9))[_0xae2e('0x2e')](handleError(_0x44918c,null));};exports[_0xae2e('0x5d')]=function(_0x49b4bc,_0x1254f5){if(_0x49b4bc[_0xae2e('0x5c')]['id']){delete _0x49b4bc[_0xae2e('0x5c')]['id'];}return db['ChatMessage'][_0xae2e('0x5a')]({'where':{'id':_0x49b4bc['params']['id']}})['then'](handleEntityNotFound(_0x1254f5,null))[_0xae2e('0x23')](saveUpdates(_0x49b4bc[_0xae2e('0x5c')],null))[_0xae2e('0x23')](respondWithResult(_0x1254f5,null))[_0xae2e('0x2e')](handleError(_0x1254f5,null));};exports[_0xae2e('0x3a')]=function(_0xbf1fa6,_0x20a472){return db['ChatMessage'][_0xae2e('0x5a')]({'where':{'id':_0xbf1fa6[_0xae2e('0x57')]['id']}})[_0xae2e('0x23')](handleEntityNotFound(_0x20a472,null))[_0xae2e('0x23')](removeEntity(_0x20a472,null))['catch'](handleError(_0x20a472,null));};exports[_0xae2e('0x5e')]=function(_0x1f19f8,_0x4bb091){return db[_0xae2e('0x40')]['describe']()[_0xae2e('0x23')](respondWithResult(_0x4bb091,null))[_0xae2e('0x2e')](handleError(_0x4bb091,null));};var interaction_log=require(_0xae2e('0x16'))(_0xae2e('0x5f'));exports['accept']=function(_0x540af4,_0x38bfd9,_0x5608f7){var _0xe41b63={'agent':{},'channel':_0xae2e('0x60')};if(_0x540af4[_0xae2e('0x5c')]['id']){delete _0x540af4[_0xae2e('0x5c')]['id'];}_0x540af4[_0xae2e('0x5c')][_0xae2e('0x61')]=!![];_0x540af4['body'][_0xae2e('0x62')]=moment()[_0xae2e('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x540af4[_0xae2e('0x5c')][_0xae2e('0x64')]=_0x540af4[_0xae2e('0x5c')][_0xae2e('0x64')]||_0x540af4[_0xae2e('0x65')]['id'];_0xe41b63['agent']['id']=_0x540af4['body'][_0xae2e('0x64')];return db['ChatMessage']['find']({'where':{'id':_0x540af4[_0xae2e('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x38bfd9,null))[_0xae2e('0x23')](saveUpdates(_0x540af4[_0xae2e('0x5c')],null))['then'](function(_0x501074){if(_0x501074){_0xe41b63[_0xae2e('0x2c')]=_0x501074['get']({'plain':!![]});return db[_0xae2e('0x66')][_0xae2e('0x5a')]({'where':{'id':_0x501074[_0xae2e('0x67')]}});}return null;})[_0xae2e('0x23')](handleEntityNotFound(_0x38bfd9,null))['then'](function(_0x5d5080){if(_0x5d5080){return _0x5d5080['update']({'UserId':_0x540af4[_0xae2e('0x5c')]['UserId'],'read1stAt':_[_0xae2e('0x68')](_0x5d5080[_0xae2e('0x69')])?moment()['format'](_0xae2e('0x6a')):undefined});}return null;})[_0xae2e('0x23')](function(_0x10ae33){if(_0x10ae33){_0xe41b63[_0xae2e('0x6b')]=_0x10ae33['get']({'plain':!![]});interaction_log[_0xae2e('0x24')](_0xae2e('0x6c'),_0x540af4[_0xae2e('0x65')]['id'],_0x540af4[_0xae2e('0x65')][_0xae2e('0x3c')],_0x540af4['user'][_0xae2e('0x6d')],_0xe41b63[_0xae2e('0x6b')]['id'],_0x540af4[_0xae2e('0x5c')]?JSON[_0xae2e('0x28')](_0x540af4['body']):_0xae2e('0x6e'));return respondWithRpcPromise(_0xae2e('0x6f'),_0xae2e('0x70'),_0xe41b63);}return null;})['then'](function(_0x576b49){var _0x2d8e4d=_0xae2e('0x71')+_0x576b49[_0xae2e('0x2c')][_0xae2e('0x72')];return db[_0xae2e('0x73')][_0xae2e('0x44')](_0x2d8e4d,{'type':db[_0xae2e('0x74')][_0xae2e('0x75')][_0xae2e('0x76')],'raw':!![]})[_0xae2e('0x23')](function(_0x5f40b9){return _0x5f40b9;});})[_0xae2e('0x23')](function(_0xb43af2){if(_0xb43af2){_0xe41b63['message']['contact']=_0xb43af2[0x0];if(!_0x540af4[_0xae2e('0x5c')]['UserId'])return;return db['User'][_0xae2e('0x5a')]({'where':{'id':_0x540af4['body'][_0xae2e('0x64')],'role':_0xae2e('0x77')},'attributes':['id',_0xae2e('0x3c'),_0xae2e('0x78'),_0xae2e('0x79'),_0xae2e('0x7a')],'raw':!![]});}return null;})[_0xae2e('0x23')](function(_0x7730c0){if(!_0x7730c0)return null;_0xe41b63[_0xae2e('0x2c')]['agent']=_0x7730c0;return _0xe41b63;})[_0xae2e('0x23')](function(_0x38b488){if(_0x38b488){if(_0x540af4[_0xae2e('0x5c')][_0xae2e('0x7b')]){_0xe41b63[_0xae2e('0x2c')]['interface']=util[_0xae2e('0x63')](_0xae2e('0x7c'),_0x540af4[_0xae2e('0x65')][_0xae2e('0x3c')]);_0xe41b63['message'][_0xae2e('0x7d')]=_0xe41b63[_0xae2e('0x7d')];_0xe41b63['message']['motionChannel']=_0xe41b63[_0xae2e('0x7d')];_0xe41b63[_0xae2e('0x2c')]['event']=_0xae2e('0x7e');return respondWithRpcPromise(_0xae2e('0x7f'),_0xae2e('0x7f'),{'event':'acceptmessage','message':_['merge'](_0xe41b63[_0xae2e('0x2c')],JSON[_0xae2e('0x80')](_0xe41b63['interaction']['formData']))},client9002)[_0xae2e('0x23')](function(){return _0xe41b63;});}return _0xe41b63;}return null;})[_0xae2e('0x23')](respondWithResult(_0x38bfd9,null))['catch'](handleError(_0x38bfd9,null));};var interaction_log=require(_0xae2e('0x16'))(_0xae2e('0x5f'));exports[_0xae2e('0x38')]=function(_0x49c0ff,_0x483cf8,_0x513432){var _0x833604={'agent':{},'channel':'chat'};if(_0x49c0ff[_0xae2e('0x5c')]['id']){delete _0x49c0ff[_0xae2e('0x5c')]['id'];}_0x49c0ff[_0xae2e('0x5c')][_0xae2e('0x64')]=_0x49c0ff[_0xae2e('0x5c')][_0xae2e('0x64')]||_0x49c0ff['user']['id'];_0x833604[_0xae2e('0x77')]['id']=_0x49c0ff[_0xae2e('0x5c')][_0xae2e('0x64')];return db[_0xae2e('0x40')][_0xae2e('0x5a')]({'where':{'id':_0x49c0ff['params']['id'],'UserId':null}})[_0xae2e('0x23')](handleEntityNotFound(_0x483cf8,null))['then'](function(_0x185094){if(_0x185094){_0x833604[_0xae2e('0x2c')]=_0x185094[_0xae2e('0x81')]({'plain':!![]});return db[_0xae2e('0x66')][_0xae2e('0x5a')]({'where':{'id':_0x185094['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x483cf8,null))[_0xae2e('0x23')](function(_0x41a873){if(_0x41a873){_0x833604[_0xae2e('0x6b')]=_0x41a873['get']({'plain':!![]});interaction_log[_0xae2e('0x24')](_0xae2e('0x82'),_0x49c0ff['user']['id'],_0x49c0ff[_0xae2e('0x65')][_0xae2e('0x3c')],_0x49c0ff['user'][_0xae2e('0x6d')],_0x833604['interaction']['id'],_0x49c0ff['body']?JSON['stringify'](_0x49c0ff[_0xae2e('0x5c')]):_0xae2e('0x6e'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x833604);}return null;})[_0xae2e('0x23')](function(_0x28e20a){var _0x24cd9f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x28e20a[_0xae2e('0x2c')][_0xae2e('0x72')];return db[_0xae2e('0x73')][_0xae2e('0x44')](_0x24cd9f,{'type':db[_0xae2e('0x74')]['QueryTypes']['SELECT'],'raw':!![]})[_0xae2e('0x23')](function(_0x2864ae){return _0x2864ae;});})[_0xae2e('0x23')](function(_0x11f675){if(_0x11f675){_0x833604[_0xae2e('0x2c')][_0xae2e('0x83')]=_0x11f675[0x0];if(!_0x49c0ff[_0xae2e('0x5c')][_0xae2e('0x64')])return;return db['User'][_0xae2e('0x5a')]({'where':{'id':_0x49c0ff[_0xae2e('0x5c')][_0xae2e('0x64')],'role':'agent'},'attributes':['id','name',_0xae2e('0x78'),'email',_0xae2e('0x7a')],'raw':!![]});}return null;})[_0xae2e('0x23')](function(_0x39631){if(!_0x39631)return null;_0x833604['message']['agent']=_0x39631;return _0x833604;})['then'](function(_0x205493){if(_0x205493){_0x205493[_0xae2e('0x2c')][_0xae2e('0x84')]=util['format'](_0xae2e('0x7c'),_0x49c0ff[_0xae2e('0x65')][_0xae2e('0x3c')]);_0x205493['message'][_0xae2e('0x7d')]=_0x833604[_0xae2e('0x7d')];_0x205493['message'][_0xae2e('0x85')]=_0x833604[_0xae2e('0x7d')];_0x205493[_0xae2e('0x2c')]['event']=_0xae2e('0x38');respondWithRpcPromise('EventManager',_0xae2e('0x7f'),{'event':_0xae2e('0x86'),'message':_[_0xae2e('0x4f')](_0x833604[_0xae2e('0x2c')],JSON[_0xae2e('0x80')](_0x833604[_0xae2e('0x6b')][_0xae2e('0x87')]))},client9002);return _0x833604;}return null;})['then'](respondWithResult(_0x483cf8,null))['catch'](handleError(_0x483cf8,null));}; \ No newline at end of file +var _0xca52=['end','status','offset','undefined','limit','count','Content-Range','json','save','update','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','describe','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','internal','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','chat-interactions','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT','fullname','email','interface','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','jayson/promise','request','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xca52,0xdb));var _0x2ca5=function(_0x2ec1a2,_0x2213e8){_0x2ec1a2=_0x2ec1a2-0x0;var _0x5ee2d5=_0xca52[_0x2ec1a2];return _0x5ee2d5;};'use strict';var emlformat=require(_0x2ca5('0x0'));var rimraf=require(_0x2ca5('0x1'));var zipdir=require(_0x2ca5('0x2'));var jsonpatch=require(_0x2ca5('0x3'));var rp=require(_0x2ca5('0x4'));var moment=require(_0x2ca5('0x5'));var BPromise=require(_0x2ca5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2ca5('0x7'));var sox=require(_0x2ca5('0x8'));var csv=require(_0x2ca5('0x9'));var ejs=require(_0x2ca5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ca5('0xb'));var squel=require(_0x2ca5('0xc'));var crypto=require(_0x2ca5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2ca5('0x9'));var querystring=require(_0x2ca5('0xe'));var Papa=require('papaparse');var Redis=require(_0x2ca5('0xf'));var authService=require(_0x2ca5('0x10'));var qs=require(_0x2ca5('0x11'));var as=require(_0x2ca5('0x12'));var hardwareService=require(_0x2ca5('0x13'));var logger=require(_0x2ca5('0x14'))(_0x2ca5('0x15'));var utils=require(_0x2ca5('0x16'));var config=require(_0x2ca5('0x17'));var licenseUtil=require(_0x2ca5('0x18'));var db=require(_0x2ca5('0x19'))['db'];config['redis']=_[_0x2ca5('0x1a')](config[_0x2ca5('0x1b')],{'host':_0x2ca5('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x2ca5('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38fe3a,_0xede778,_0xb3d1dd,_0x3c86b7){return new BPromise(function(_0x19e33e,_0x4e2e4c){var _0x14e172=_0x3c86b7||client;return _0x14e172[_0x2ca5('0x1e')](_0x38fe3a,_0xb3d1dd)[_0x2ca5('0x1f')](function(_0x5ac534){logger[_0x2ca5('0x20')](_0x2ca5('0x21'),_0xede778,'request\x20sent');logger['debug'](_0x2ca5('0x22'),_0xede778,'request\x20sent',JSON[_0x2ca5('0x23')](_0x5ac534));if(_0x5ac534[_0x2ca5('0x24')]){if(_0x5ac534[_0x2ca5('0x24')]['code']===0x1f4){logger[_0x2ca5('0x24')](_0x2ca5('0x21'),_0xede778,_0x5ac534[_0x2ca5('0x24')][_0x2ca5('0x25')]);return _0x4e2e4c(_0x5ac534[_0x2ca5('0x24')][_0x2ca5('0x25')]);}logger['error'](_0x2ca5('0x21'),_0xede778,_0x5ac534[_0x2ca5('0x24')][_0x2ca5('0x25')]);return _0x19e33e(_0x5ac534[_0x2ca5('0x24')][_0x2ca5('0x25')]);}else{logger[_0x2ca5('0x20')](_0x2ca5('0x21'),_0xede778,_0x2ca5('0x26'));_0x19e33e(_0x5ac534[_0x2ca5('0x27')][_0x2ca5('0x25')]);}})[_0x2ca5('0x28')](function(_0x3be809){logger['error'](_0x2ca5('0x21'),_0xede778,_0x3be809);_0x4e2e4c(_0x3be809);});});}function respondWithStatusCode(_0x2a9296,_0x53dfc1){_0x53dfc1=_0x53dfc1||0xcc;return function(_0x292567){if(_0x292567){return _0x2a9296['sendStatus'](_0x53dfc1);}return _0x2a9296['status'](_0x53dfc1)[_0x2ca5('0x29')]();};}function respondWithResult(_0x333f89,_0x12ae7f){_0x12ae7f=_0x12ae7f||0xc8;return function(_0xf0119){if(_0xf0119){return _0x333f89[_0x2ca5('0x2a')](_0x12ae7f)['json'](_0xf0119);}};}function respondWithFilteredResult(_0x12f410,_0xc3920){return function(_0x336ab2){if(_0x336ab2){var _0x41fb84=typeof _0xc3920[_0x2ca5('0x2b')]===_0x2ca5('0x2c')&&typeof _0xc3920[_0x2ca5('0x2d')]===_0x2ca5('0x2c');var _0x484d3c=_0x336ab2[_0x2ca5('0x2e')];var _0x592964=_0x41fb84?0x0:_0xc3920[_0x2ca5('0x2b')];var _0x2d450c=_0x41fb84?_0x336ab2[_0x2ca5('0x2e')]:_0xc3920[_0x2ca5('0x2b')]+_0xc3920[_0x2ca5('0x2d')];var _0x5f1e6b;if(_0x2d450c>=_0x484d3c){_0x2d450c=_0x484d3c;_0x5f1e6b=0xc8;}else{_0x5f1e6b=0xce;}_0x12f410[_0x2ca5('0x2a')](_0x5f1e6b);return _0x12f410['set'](_0x2ca5('0x2f'),_0x592964+'-'+_0x2d450c+'/'+_0x484d3c)[_0x2ca5('0x30')](_0x336ab2);}return null;};}function patchUpdates(_0x119f94){return function(_0x576915){try{jsonpatch['apply'](_0x576915,_0x119f94,!![]);}catch(_0x5b8106){return BPromise['reject'](_0x5b8106);}return _0x576915[_0x2ca5('0x31')]();};}function saveUpdates(_0xea4d9c,_0x929899){return function(_0x519981){if(_0x519981){return _0x519981[_0x2ca5('0x32')](_0xea4d9c)['then'](function(_0x59a941){return _0x59a941;});}return null;};}function removeEntity(_0xdef9a2,_0xc7b308){return function(_0x26e7db){if(_0x26e7db){return _0x26e7db['destroy']()[_0x2ca5('0x1f')](function(){_0xdef9a2['status'](0xcc)[_0x2ca5('0x29')]();});}};}function handleEntityNotFound(_0x39efda,_0x1d831b){return function(_0x23b13d){if(!_0x23b13d){_0x39efda[_0x2ca5('0x33')](0x194);}return _0x23b13d;};}function handleError(_0x2df45e,_0x58fe8f){_0x58fe8f=_0x58fe8f||0x1f4;return function(_0x2ce0a7){logger[_0x2ca5('0x24')](_0x2ce0a7[_0x2ca5('0x34')]);if(_0x2ce0a7[_0x2ca5('0x35')]){delete _0x2ce0a7['name'];}_0x2df45e[_0x2ca5('0x2a')](_0x58fe8f)[_0x2ca5('0x36')](_0x2ce0a7);};}exports[_0x2ca5('0x37')]=function(_0x124a8a,_0x56e541){var _0x239c75={},_0x5d00d1={},_0x44c868={'count':0x0,'rows':[]};var _0x2314f0=_[_0x2ca5('0x38')](db[_0x2ca5('0x39')][_0x2ca5('0x3a')],function(_0x19c28b){return{'name':_0x19c28b[_0x2ca5('0x3b')],'type':_0x19c28b['type'][_0x2ca5('0x3c')]};});_0x5d00d1[_0x2ca5('0x3d')]=_[_0x2ca5('0x38')](_0x2314f0,'name');_0x5d00d1['query']=_[_0x2ca5('0x3e')](_0x124a8a[_0x2ca5('0x3f')]);_0x5d00d1[_0x2ca5('0x40')]=_[_0x2ca5('0x41')](_0x5d00d1[_0x2ca5('0x3d')],_0x5d00d1['query']);_0x239c75[_0x2ca5('0x42')]=_[_0x2ca5('0x41')](_0x5d00d1['model'],qs[_0x2ca5('0x43')](_0x124a8a[_0x2ca5('0x3f')][_0x2ca5('0x43')]));_0x239c75[_0x2ca5('0x42')]=_0x239c75['attributes']['length']?_0x239c75[_0x2ca5('0x42')]:_0x5d00d1[_0x2ca5('0x3d')];if(!_0x124a8a[_0x2ca5('0x3f')][_0x2ca5('0x44')](_0x2ca5('0x45'))){_0x239c75[_0x2ca5('0x2d')]=qs[_0x2ca5('0x2d')](_0x124a8a[_0x2ca5('0x3f')][_0x2ca5('0x2d')]);_0x239c75['offset']=qs[_0x2ca5('0x2b')](_0x124a8a['query'][_0x2ca5('0x2b')]);}_0x239c75['order']=qs[_0x2ca5('0x46')](_0x124a8a['query'][_0x2ca5('0x46')]);_0x239c75['where']=qs[_0x2ca5('0x40')](_['pick'](_0x124a8a[_0x2ca5('0x3f')],_0x5d00d1[_0x2ca5('0x40')]),_0x2314f0);if(_0x124a8a[_0x2ca5('0x3f')][_0x2ca5('0x47')]){_0x239c75[_0x2ca5('0x48')]=_['merge'](_0x239c75[_0x2ca5('0x48')],{'$or':_['map'](_0x2314f0,function(_0x566483){if(_0x566483['type']!==_0x2ca5('0x49')){var _0x4201fb={};_0x4201fb[_0x566483[_0x2ca5('0x35')]]={'$like':'%'+_0x124a8a[_0x2ca5('0x3f')][_0x2ca5('0x47')]+'%'};return _0x4201fb;}})});}_0x239c75=_[_0x2ca5('0x4a')]({},_0x239c75,_0x124a8a[_0x2ca5('0x4b')]);var _0x174a2f={'where':_0x239c75[_0x2ca5('0x48')]};return db[_0x2ca5('0x39')][_0x2ca5('0x2e')](_0x174a2f)[_0x2ca5('0x1f')](function(_0x42c081){_0x44c868[_0x2ca5('0x2e')]=_0x42c081;if(_0x124a8a[_0x2ca5('0x3f')][_0x2ca5('0x4c')]){_0x239c75[_0x2ca5('0x4d')]=[{'all':!![]}];}return db[_0x2ca5('0x39')][_0x2ca5('0x4e')](_0x239c75);})[_0x2ca5('0x1f')](function(_0x43e057){_0x44c868[_0x2ca5('0x4f')]=_0x43e057;return _0x44c868;})['then'](respondWithFilteredResult(_0x56e541,_0x239c75))[_0x2ca5('0x28')](handleError(_0x56e541,null));};exports[_0x2ca5('0x50')]=function(_0x177513,_0x440438){var _0x47dbfb={'raw':!![],'where':{'id':_0x177513[_0x2ca5('0x51')]['id']}},_0x2c9305={};_0x2c9305['model']=_[_0x2ca5('0x3e')](db['ChatMessage'][_0x2ca5('0x3a')]);_0x2c9305[_0x2ca5('0x3f')]=_['keys'](_0x177513[_0x2ca5('0x3f')]);_0x2c9305[_0x2ca5('0x40')]=_[_0x2ca5('0x41')](_0x2c9305[_0x2ca5('0x3d')],_0x2c9305['query']);_0x47dbfb[_0x2ca5('0x42')]=_[_0x2ca5('0x41')](_0x2c9305[_0x2ca5('0x3d')],qs['fields'](_0x177513['query']['fields']));_0x47dbfb[_0x2ca5('0x42')]=_0x47dbfb['attributes']['length']?_0x47dbfb[_0x2ca5('0x42')]:_0x2c9305[_0x2ca5('0x3d')];if(_0x177513['query'][_0x2ca5('0x4c')]){_0x47dbfb[_0x2ca5('0x4d')]=[{'all':!![]}];}_0x47dbfb=_[_0x2ca5('0x4a')]({},_0x47dbfb,_0x177513[_0x2ca5('0x4b')]);return db['ChatMessage'][_0x2ca5('0x52')](_0x47dbfb)['then'](handleEntityNotFound(_0x440438,null))[_0x2ca5('0x1f')](respondWithResult(_0x440438,null))['catch'](handleError(_0x440438,null));};exports['create']=function(_0x17a9e2,_0x4c2510){return db['ChatMessage'][_0x2ca5('0x53')](_0x17a9e2[_0x2ca5('0x54')],{})['then'](respondWithResult(_0x4c2510,0xc9))[_0x2ca5('0x28')](handleError(_0x4c2510,null));};exports[_0x2ca5('0x32')]=function(_0x3f9fce,_0x5b6df2){if(_0x3f9fce['body']['id']){delete _0x3f9fce[_0x2ca5('0x54')]['id'];}return db['ChatMessage'][_0x2ca5('0x52')]({'where':{'id':_0x3f9fce[_0x2ca5('0x51')]['id']}})['then'](handleEntityNotFound(_0x5b6df2,null))[_0x2ca5('0x1f')](saveUpdates(_0x3f9fce['body'],null))[_0x2ca5('0x1f')](respondWithResult(_0x5b6df2,null))[_0x2ca5('0x28')](handleError(_0x5b6df2,null));};exports[_0x2ca5('0x55')]=function(_0x334166,_0x1fd6da){return db[_0x2ca5('0x39')]['find']({'where':{'id':_0x334166[_0x2ca5('0x51')]['id']}})[_0x2ca5('0x1f')](handleEntityNotFound(_0x1fd6da,null))[_0x2ca5('0x1f')](removeEntity(_0x1fd6da,null))[_0x2ca5('0x28')](handleError(_0x1fd6da,null));};exports[_0x2ca5('0x56')]=function(_0x2cdcef,_0xd7c5ab){return db[_0x2ca5('0x39')][_0x2ca5('0x56')]()[_0x2ca5('0x1f')](respondWithResult(_0xd7c5ab,null))['catch'](handleError(_0xd7c5ab,null));};var interaction_log=require(_0x2ca5('0x14'))('chat-interactions');exports['accept']=function(_0x48ae13,_0x243d1d,_0xfb8589){var _0x4c58d7={'agent':{},'channel':_0x2ca5('0x57')};if(_0x48ae13[_0x2ca5('0x54')]['id']){delete _0x48ae13['body']['id'];}_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x58')]=!![];_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x59')]=moment()[_0x2ca5('0x5a')](_0x2ca5('0x5b'));_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x5c')]=_0x48ae13['body']['UserId']||_0x48ae13[_0x2ca5('0x5d')]['id'];_0x4c58d7[_0x2ca5('0x5e')]['id']=_0x48ae13['body']['UserId'];return db[_0x2ca5('0x39')][_0x2ca5('0x52')]({'where':{'id':_0x48ae13[_0x2ca5('0x51')]['id'],'UserId':null}})[_0x2ca5('0x1f')](handleEntityNotFound(_0x243d1d,null))['then'](saveUpdates(_0x48ae13[_0x2ca5('0x54')],null))[_0x2ca5('0x1f')](function(_0x4634c5){if(_0x4634c5){_0x4c58d7['message']=_0x4634c5[_0x2ca5('0x5f')]({'plain':!![]});return db[_0x2ca5('0x60')][_0x2ca5('0x52')]({'where':{'id':_0x4634c5[_0x2ca5('0x61')]}});}return null;})[_0x2ca5('0x1f')](handleEntityNotFound(_0x243d1d,null))[_0x2ca5('0x1f')](function(_0x2ae0fa){if(_0x2ae0fa){return _0x2ae0fa[_0x2ca5('0x32')]({'UserId':_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x5c')],'read1stAt':_[_0x2ca5('0x62')](_0x2ae0fa['read1stAt'])?moment()[_0x2ca5('0x5a')](_0x2ca5('0x5b')):undefined});}return null;})['then'](function(_0x1dc608){if(_0x1dc608){_0x4c58d7[_0x2ca5('0x63')]=_0x1dc608[_0x2ca5('0x5f')]({'plain':!![]});interaction_log[_0x2ca5('0x20')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48ae13[_0x2ca5('0x5d')]['id'],_0x48ae13[_0x2ca5('0x5d')][_0x2ca5('0x35')],_0x48ae13[_0x2ca5('0x5d')][_0x2ca5('0x64')],_0x4c58d7[_0x2ca5('0x63')]['id'],_0x48ae13[_0x2ca5('0x54')]?JSON['stringify'](_0x48ae13[_0x2ca5('0x54')]):_0x2ca5('0x65'));return respondWithRpcPromise(_0x2ca5('0x66'),_0x2ca5('0x67'),_0x4c58d7);}return null;})[_0x2ca5('0x1f')](function(_0x49d7ed){var _0xa9847c=_0x2ca5('0x68')+_0x49d7ed[_0x2ca5('0x25')][_0x2ca5('0x69')];return db[_0x2ca5('0x6a')][_0x2ca5('0x3f')](_0xa9847c,{'type':db[_0x2ca5('0x6b')][_0x2ca5('0x6c')]['SELECT'],'raw':!![]})[_0x2ca5('0x1f')](function(_0x261ae3){return _0x261ae3;});})[_0x2ca5('0x1f')](function(_0x4f6c77){if(_0x4f6c77){_0x4c58d7[_0x2ca5('0x25')][_0x2ca5('0x6d')]=_0x4f6c77[0x0];if(!_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x5c')])return;return db[_0x2ca5('0x6e')]['find']({'where':{'id':_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x5c')],'role':_0x2ca5('0x5e')},'attributes':['id',_0x2ca5('0x35'),'fullname','email',_0x2ca5('0x6f')],'raw':!![]});}return null;})['then'](function(_0x1e57d5){if(!_0x1e57d5)return null;_0x4c58d7[_0x2ca5('0x25')][_0x2ca5('0x5e')]=_0x1e57d5;return _0x4c58d7;})[_0x2ca5('0x1f')](function(_0x13f122){if(_0x13f122){if(_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x70')]){_0x4c58d7[_0x2ca5('0x25')]['interface']=util[_0x2ca5('0x5a')](_0x2ca5('0x71'),_0x48ae13['user'][_0x2ca5('0x35')]);_0x4c58d7[_0x2ca5('0x25')][_0x2ca5('0x72')]=_0x4c58d7[_0x2ca5('0x72')];_0x4c58d7[_0x2ca5('0x25')][_0x2ca5('0x73')]=_0x4c58d7[_0x2ca5('0x72')];_0x4c58d7['message'][_0x2ca5('0x74')]=_0x2ca5('0x75');return respondWithRpcPromise(_0x2ca5('0x76'),_0x2ca5('0x76'),{'event':_0x2ca5('0x77'),'message':_[_0x2ca5('0x4a')](_0x4c58d7[_0x2ca5('0x25')],JSON[_0x2ca5('0x78')](_0x4c58d7[_0x2ca5('0x63')]['formData']))},client9002)['then'](function(){return _0x4c58d7;});}return _0x4c58d7;}return null;})[_0x2ca5('0x1f')](respondWithResult(_0x243d1d,null))[_0x2ca5('0x28')](handleError(_0x243d1d,null));};var interaction_log=require(_0x2ca5('0x14'))(_0x2ca5('0x79'));exports[_0x2ca5('0x7a')]=function(_0x4c6e49,_0x104ead,_0x5ad1be){var _0x5a12f2={'agent':{},'channel':_0x2ca5('0x57')};if(_0x4c6e49['body']['id']){delete _0x4c6e49[_0x2ca5('0x54')]['id'];}_0x4c6e49['body'][_0x2ca5('0x5c')]=_0x4c6e49[_0x2ca5('0x54')][_0x2ca5('0x5c')]||_0x4c6e49['user']['id'];_0x5a12f2[_0x2ca5('0x5e')]['id']=_0x4c6e49[_0x2ca5('0x54')][_0x2ca5('0x5c')];return db[_0x2ca5('0x39')][_0x2ca5('0x52')]({'where':{'id':_0x4c6e49[_0x2ca5('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x104ead,null))[_0x2ca5('0x1f')](function(_0x5af326){if(_0x5af326){_0x5a12f2[_0x2ca5('0x25')]=_0x5af326[_0x2ca5('0x5f')]({'plain':!![]});return db[_0x2ca5('0x60')][_0x2ca5('0x52')]({'where':{'id':_0x5af326[_0x2ca5('0x61')]}});}return null;})[_0x2ca5('0x1f')](handleEntityNotFound(_0x104ead,null))[_0x2ca5('0x1f')](function(_0x18738b){if(_0x18738b){_0x5a12f2[_0x2ca5('0x63')]=_0x18738b[_0x2ca5('0x5f')]({'plain':!![]});interaction_log[_0x2ca5('0x20')](_0x2ca5('0x7b'),_0x4c6e49[_0x2ca5('0x5d')]['id'],_0x4c6e49[_0x2ca5('0x5d')][_0x2ca5('0x35')],_0x4c6e49['user'][_0x2ca5('0x64')],_0x5a12f2[_0x2ca5('0x63')]['id'],_0x4c6e49[_0x2ca5('0x54')]?JSON[_0x2ca5('0x23')](_0x4c6e49['body']):_0x2ca5('0x65'));return respondWithRpcPromise('RejectMessage',_0x2ca5('0x7c'),_0x5a12f2);}return null;})['then'](function(_0x3075aa){var _0x21190d=_0x2ca5('0x68')+_0x3075aa['message'][_0x2ca5('0x69')];return db[_0x2ca5('0x6a')][_0x2ca5('0x3f')](_0x21190d,{'type':db[_0x2ca5('0x6b')][_0x2ca5('0x6c')][_0x2ca5('0x7d')],'raw':!![]})['then'](function(_0x257614){return _0x257614;});})[_0x2ca5('0x1f')](function(_0x4b6a0f){if(_0x4b6a0f){_0x5a12f2[_0x2ca5('0x25')][_0x2ca5('0x6d')]=_0x4b6a0f[0x0];if(!_0x4c6e49[_0x2ca5('0x54')][_0x2ca5('0x5c')])return;return db[_0x2ca5('0x6e')][_0x2ca5('0x52')]({'where':{'id':_0x4c6e49['body']['UserId'],'role':'agent'},'attributes':['id',_0x2ca5('0x35'),_0x2ca5('0x7e'),_0x2ca5('0x7f'),_0x2ca5('0x6f')],'raw':!![]});}return null;})[_0x2ca5('0x1f')](function(_0x42f2a6){if(!_0x42f2a6)return null;_0x5a12f2[_0x2ca5('0x25')][_0x2ca5('0x5e')]=_0x42f2a6;return _0x5a12f2;})[_0x2ca5('0x1f')](function(_0x28d618){if(_0x28d618){_0x28d618[_0x2ca5('0x25')][_0x2ca5('0x80')]=util[_0x2ca5('0x5a')](_0x2ca5('0x71'),_0x4c6e49[_0x2ca5('0x5d')][_0x2ca5('0x35')]);_0x28d618[_0x2ca5('0x25')]['channel']=_0x5a12f2[_0x2ca5('0x72')];_0x28d618[_0x2ca5('0x25')]['motionChannel']=_0x5a12f2[_0x2ca5('0x72')];_0x28d618['message'][_0x2ca5('0x74')]='reject';respondWithRpcPromise(_0x2ca5('0x76'),'EventManager',{'event':'rejectmessage','message':_[_0x2ca5('0x4a')](_0x5a12f2['message'],JSON['parse'](_0x5a12f2[_0x2ca5('0x63')][_0x2ca5('0x81')]))},client9002);return _0x5a12f2;}return null;})[_0x2ca5('0x1f')](respondWithResult(_0x104ead,null))['catch'](handleError(_0x104ead,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index ade88bb..5b135c3 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 _0x9db1=['emit','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x17babc,_0x5c68f3){var _0x2bb70b=function(_0x428fdd){while(--_0x428fdd){_0x17babc['push'](_0x17babc['shift']());}};_0x2bb70b(++_0x5c68f3);}(_0x9db1,0x142));var _0x19db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9db1[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x19db('0x0'));var ChatMessage=require(_0x19db('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x19db('0x2')](0x0);var events={'afterCreate':_0x19db('0x3'),'afterUpdate':_0x19db('0x4'),'afterDestroy':_0x19db('0x5')};function emitEvent(_0x185178){return function(_0x19d39a,_0x39a20b,_0x232b51){ChatMessageEvents[_0x19db('0x6')](_0x185178+':'+_0x19d39a['id'],_0x19d39a);ChatMessageEvents[_0x19db('0x6')](_0x185178,_0x19d39a);_0x232b51(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x19db('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xce5a=['hook','exports','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0xb113d7,_0x2fc306){var _0xd5a08d=function(_0x873634){while(--_0x873634){_0xb113d7['push'](_0xb113d7['shift']());}};_0xd5a08d(++_0x2fc306);}(_0xce5a,0xfe));var _0xace5=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xce5a[_0x5951e8];return _0x20a1f5;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xace5('0x0'))['db'][_0xace5('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xace5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xace5('0x3'),'afterDestroy':_0xace5('0x4')};function emitEvent(_0x5f19f0){return function(_0x1b43ac,_0x463116,_0x53a469){ChatMessageEvents[_0xace5('0x5')](_0x5f19f0+':'+_0x1b43ac['id'],_0x1b43ac);ChatMessageEvents[_0xace5('0x5')](_0x5f19f0,_0x1b43ac);_0x53a469(null);};}for(var e in events){if(events[_0xace5('0x6')](e)){var event=events[e];ChatMessage[_0xace5('0x7')](e,emitEvent(event));}}module[_0xace5('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index fd90f7d..dc3ccc6 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 _0x69e5=['direction','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','toLowerCase'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x69e5,0x123));var _0x569e=function(_0x4d521e,_0x58ba39){_0x4d521e=_0x4d521e-0x0;var _0x3beb42=_0x69e5[_0x4d521e];return _0x3beb42;};'use strict';var _=require(_0x569e('0x0'));var util=require(_0x569e('0x1'));var logger=require(_0x569e('0x2'))(_0x569e('0x3'));var moment=require(_0x569e('0x4'));var BPromise=require(_0x569e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x569e('0x6'));var rimraf=require(_0x569e('0x7'));var config=require(_0x569e('0x8'));var attributes=require(_0x569e('0x9'));module[_0x569e('0xa')]=function(_0x599a33,_0x4642a1){return _0x599a33[_0x569e('0xb')](_0x569e('0xc'),attributes,{'tableName':_0x569e('0xd'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x569e('0xe')],'type':_0x569e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x762a2c,_0x34654a,_0x483674){var _0x4945b9=_0x599a33[_0x569e('0x10')];var _0x3fb853=_0x762a2c[_0x569e('0x11')]({'plain':!![]});if(_0x3fb853['direction'][_0x569e('0x12')]()==='in'||_0x3fb853[_0x569e('0x13')][_0x569e('0x12')]()===_0x569e('0x14')&&!_0x3fb853['secret']&&!_[_0x569e('0x15')](_0x3fb853[_0x569e('0x16')])){_0x4945b9[_0x569e('0x17')][_0x569e('0x18')]({'where':{'id':_0x3fb853[_0x569e('0x19')]}})[_0x569e('0x1a')](function(_0xe42b1a){if(_0xe42b1a){_0xe42b1a['update']({'lastMsgAt':_0x3fb853[_0x569e('0x1b')],'lastMsgDirection':_0x3fb853[_0x569e('0x13')]['toLowerCase']()});}})[_0x569e('0x1c')](function(_0x1ac433){console[_0x569e('0x1d')](_0x1ac433);});}_0x483674();}},'charset':_0x569e('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdec1=['ChatInteractionId','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne'];(function(_0x26073a,_0x4652df){var _0x2ab2ad=function(_0x4a378e){while(--_0x4a378e){_0x26073a['push'](_0x26073a['shift']());}};_0x2ab2ad(++_0x4652df);}(_0xdec1,0x11d));var _0x1dec=function(_0x2c2784,_0x36faed){_0x2c2784=_0x2c2784-0x0;var _0x1a8b32=_0xdec1[_0x2c2784];return _0x1a8b32;};'use strict';var _=require(_0x1dec('0x0'));var util=require('util');var logger=require(_0x1dec('0x1'))(_0x1dec('0x2'));var moment=require(_0x1dec('0x3'));var BPromise=require(_0x1dec('0x4'));var rp=require(_0x1dec('0x5'));var fs=require('fs');var path=require(_0x1dec('0x6'));var rimraf=require(_0x1dec('0x7'));var config=require(_0x1dec('0x8'));var attributes=require(_0x1dec('0x9'));module[_0x1dec('0xa')]=function(_0x8f8be1,_0x108f91){return _0x8f8be1[_0x1dec('0xb')](_0x1dec('0xc'),attributes,{'tableName':_0x1dec('0xd'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x1dec('0xe')],'type':_0x1dec('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49420c,_0x2eca5c,_0x12f4ef){var _0x3aa428=_0x8f8be1[_0x1dec('0x10')];var _0x4c1222=_0x49420c[_0x1dec('0x11')]({'plain':!![]});if(_0x4c1222[_0x1dec('0x12')][_0x1dec('0x13')]()==='in'||_0x4c1222[_0x1dec('0x12')][_0x1dec('0x13')]()==='out'&&!_0x4c1222[_0x1dec('0x14')]&&!_[_0x1dec('0x15')](_0x4c1222[_0x1dec('0x16')])){_0x3aa428[_0x1dec('0x17')][_0x1dec('0x18')]({'where':{'id':_0x4c1222[_0x1dec('0x19')]}})['then'](function(_0x3c1fa5){if(_0x3c1fa5){_0x3c1fa5['update']({'lastMsgAt':_0x4c1222[_0x1dec('0x1a')],'lastMsgDirection':_0x4c1222[_0x1dec('0x12')][_0x1dec('0x13')]()});}})[_0x1dec('0x1b')](function(_0x22656d){console[_0x1dec('0x1c')](_0x22656d);});}_0x12f4ef();}},'charset':_0x1dec('0x1d'),'collate':_0x1dec('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 9313124..ce2e30d 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 _0x612a=['body','options','raw','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateChatMessage','ChatMessage','create'];(function(_0x26e8bf,_0x5054d7){var _0x15a67b=function(_0x329fd3){while(--_0x329fd3){_0x26e8bf['push'](_0x26e8bf['shift']());}};_0x15a67b(++_0x5054d7);}(_0x612a,0xa4));var _0xa612=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0x612a[_0x52e363];return _0x3fc2b5;};'use strict';var _=require('lodash');var util=require(_0xa612('0x0'));var moment=require(_0xa612('0x1'));var BPromise=require(_0xa612('0x2'));var rs=require(_0xa612('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa612('0x4'))['db'];var utils=require(_0xa612('0x5'));var logger=require(_0xa612('0x6'))(_0xa612('0x7'));var config=require(_0xa612('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa612('0x9')][_0xa612('0xa')]({'port':0x232a});config[_0xa612('0xb')]=_[_0xa612('0xc')](config[_0xa612('0xb')],{'host':_0xa612('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')[_0xa612('0xe')](socket);function respondWithRpcPromise(_0x1bbe8f,_0x505311,_0x2fff63){return new BPromise(function(_0x423cf8,_0x1c3cc8){return client[_0xa612('0xf')](_0x1bbe8f,_0x2fff63)[_0xa612('0x10')](function(_0x555ccb){logger[_0xa612('0x11')](_0xa612('0x12'),_0x505311,_0xa612('0x13'));logger[_0xa612('0x14')](_0xa612('0x15'),_0x505311,_0xa612('0x13'),JSON[_0xa612('0x16')](_0x555ccb));if(_0x555ccb[_0xa612('0x17')]){if(_0x555ccb[_0xa612('0x17')]['code']===0x1f4){logger[_0xa612('0x17')]('ChatMessage,\x20%s,\x20%s',_0x505311,_0x555ccb[_0xa612('0x17')]['message']);return _0x1c3cc8(_0x555ccb[_0xa612('0x17')][_0xa612('0x18')]);}logger[_0xa612('0x17')](_0xa612('0x12'),_0x505311,_0x555ccb[_0xa612('0x17')]['message']);return _0x423cf8(_0x555ccb['error'][_0xa612('0x18')]);}else{logger[_0xa612('0x11')](_0xa612('0x12'),_0x505311,_0xa612('0x13'));_0x423cf8(_0x555ccb['result']['message']);}})['catch'](function(_0x4df57c){logger[_0xa612('0x17')]('ChatMessage,\x20%s,\x20%s',_0x505311,_0x4df57c);_0x1c3cc8(_0x4df57c);});});}exports[_0xa612('0x19')]=function(_0x3de6f9){var _0x516221=this;return new Promise(function(_0x33de7d,_0x53d2d7){return db[_0xa612('0x1a')][_0xa612('0x1b')](_0x3de6f9[_0xa612('0x1c')],{'raw':_0x3de6f9[_0xa612('0x1d')]?_0x3de6f9[_0xa612('0x1d')][_0xa612('0x1e')]===undefined?!![]:![]:!![]})[_0xa612('0x10')](function(_0x4221b2){logger[_0xa612('0x11')](_0xa612('0x19'),_0x3de6f9);logger[_0xa612('0x14')](_0xa612('0x19'),_0x3de6f9,JSON[_0xa612('0x16')](_0x4221b2));_0x33de7d(_0x4221b2);})[_0xa612('0x1f')](function(_0x1409b8){logger[_0xa612('0x17')](_0xa612('0x19'),_0x1409b8[_0xa612('0x18')],_0x3de6f9);_0x53d2d7(_0x516221[_0xa612('0x17')](0x1f4,_0x1409b8[_0xa612('0x18')]));});});}; \ No newline at end of file +var _0x26e4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateChatMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x57c067,_0x147938){var _0x1fb541=function(_0x34fa73){while(--_0x34fa73){_0x57c067['push'](_0x57c067['shift']());}};_0x1fb541(++_0x147938);}(_0x26e4,0xe1));var _0x426e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x26e4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x426e('0x0'));var util=require('util');var moment=require(_0x426e('0x1'));var BPromise=require(_0x426e('0x2'));var rs=require(_0x426e('0x3'));var fs=require('fs');var Redis=require(_0x426e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x426e('0x5'));var logger=require(_0x426e('0x6'))(_0x426e('0x7'));var config=require(_0x426e('0x8'));var jayson=require(_0x426e('0x9'));var client=jayson[_0x426e('0xa')][_0x426e('0xb')]({'port':0x232a});config[_0x426e('0xc')]=_[_0x426e('0xd')](config[_0x426e('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x426e('0xe'))[_0x426e('0xf')](socket);function respondWithRpcPromise(_0xa1bffd,_0x218bed,_0x4fc6c7){return new BPromise(function(_0xde24ff,_0x37350c){return client[_0x426e('0x10')](_0xa1bffd,_0x4fc6c7)[_0x426e('0x11')](function(_0x458af8){logger['info'](_0x426e('0x12'),_0x218bed,_0x426e('0x13'));logger[_0x426e('0x14')](_0x426e('0x15'),_0x218bed,_0x426e('0x13'),JSON['stringify'](_0x458af8));if(_0x458af8[_0x426e('0x16')]){if(_0x458af8['error'][_0x426e('0x17')]===0x1f4){logger[_0x426e('0x16')]('ChatMessage,\x20%s,\x20%s',_0x218bed,_0x458af8[_0x426e('0x16')][_0x426e('0x18')]);return _0x37350c(_0x458af8['error']['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x218bed,_0x458af8[_0x426e('0x16')][_0x426e('0x18')]);return _0xde24ff(_0x458af8[_0x426e('0x16')][_0x426e('0x18')]);}else{logger[_0x426e('0x19')](_0x426e('0x12'),_0x218bed,_0x426e('0x13'));_0xde24ff(_0x458af8[_0x426e('0x1a')][_0x426e('0x18')]);}})[_0x426e('0x1b')](function(_0x39322d){logger[_0x426e('0x16')](_0x426e('0x12'),_0x218bed,_0x39322d);_0x37350c(_0x39322d);});});}exports[_0x426e('0x1c')]=function(_0x486701){var _0x119cb8=this;return new Promise(function(_0x11a096,_0x23b031){return db['ChatMessage'][_0x426e('0x1d')](_0x486701[_0x426e('0x1e')],{'raw':_0x486701[_0x426e('0x1f')]?_0x486701[_0x426e('0x1f')][_0x426e('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x51cff4){logger[_0x426e('0x19')]('CreateChatMessage',_0x486701);logger['debug'](_0x426e('0x1c'),_0x486701,JSON['stringify'](_0x51cff4));_0x11a096(_0x51cff4);})[_0x426e('0x1b')](function(_0x218024){logger[_0x426e('0x16')](_0x426e('0x1c'),_0x218024[_0x426e('0x18')],_0x486701);_0x23b031(_0x119cb8[_0x426e('0x16')](0x1f4,_0x218024[_0x426e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 4cfe8fe..ee852c2 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 _0xee14=['length','chatMessage:','remove','update','emit','removeListener'];(function(_0x38a660,_0x3a6593){var _0x5a601c=function(_0x2190a8){while(--_0x2190a8){_0x38a660['push'](_0x38a660['shift']());}};_0x5a601c(++_0x3a6593);}(_0xee14,0x13a));var _0x4ee1=function(_0x52021d,_0x1f0186){_0x52021d=_0x52021d-0x0;var _0x349db=_0xee14[_0x52021d];return _0x349db;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x4ee1('0x0'),_0x4ee1('0x1')];function createListener(_0x34e49d,_0x1fa407){return function(_0x18e3c4){_0x1fa407[_0x4ee1('0x2')](_0x34e49d,_0x18e3c4);};}function removeListener(_0x34a0ae,_0x1e5fb6){return function(){ChatMessageEvents[_0x4ee1('0x3')](_0x34a0ae,_0x1e5fb6);};}exports['register']=function(_0xba6d36){for(var _0x573700=0x0,_0x327c18=events[_0x4ee1('0x4')];_0x573700<_0x327c18;_0x573700++){var _0x187656=events[_0x573700];var _0x293d5f=createListener(_0x4ee1('0x5')+_0x187656,_0xba6d36);ChatMessageEvents['on'](_0x187656,_0x293d5f);}}; \ No newline at end of file +var _0x7da7=['save','remove','register','chatMessage:','./chatMessage.events'];(function(_0x78dc83,_0x3c0e2f){var _0x6532ee=function(_0x247a8f){while(--_0x247a8f){_0x78dc83['push'](_0x78dc83['shift']());}};_0x6532ee(++_0x3c0e2f);}(_0x7da7,0x10d));var _0x77da=function(_0x3a21c0,_0x348451){_0x3a21c0=_0x3a21c0-0x0;var _0x411e84=_0x7da7[_0x3a21c0];return _0x411e84;};'use strict';var ChatMessageEvents=require(_0x77da('0x0'));var events=[_0x77da('0x1'),_0x77da('0x2'),'update'];function createListener(_0x59892b,_0x37667b){return function(_0xaaefb1){_0x37667b['emit'](_0x59892b,_0xaaefb1);};}function removeListener(_0x3a9fa6,_0x37b3d9){return function(){ChatMessageEvents['removeListener'](_0x3a9fa6,_0x37b3d9);};}exports[_0x77da('0x3')]=function(_0xc54a12){for(var _0x47da81=0x0,_0x30afe0=events['length'];_0x47da81<_0x30afe0;_0x47da81++){var _0x1191de=events[_0x47da81];var _0x13992e=createListener(_0x77da('0x4')+_0x1191de,_0xc54a12);ChatMessageEvents['on'](_0x1191de,_0x13992e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 3cee03e..372c111 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 _0xa079=['create','put','update','/:id/accept','accept','/:id/reject','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','show','tracked','chat'];(function(_0x42b1f6,_0x3df91b){var _0x37ee4f=function(_0x55df2){while(--_0x55df2){_0x42b1f6['push'](_0x42b1f6['shift']());}};_0x37ee4f(++_0x3df91b);}(_0xa079,0x1b8));var _0x9a07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa079[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9a07('0x0'));var util=require(_0x9a07('0x1'));var path=require(_0x9a07('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a07('0x3'));var router=express[_0x9a07('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9a07('0x5'));var config=require(_0x9a07('0x6'));var controller=require(_0x9a07('0x7'));router[_0x9a07('0x8')]('/',auth[_0x9a07('0x9')](),controller[_0x9a07('0xa')]);router[_0x9a07('0x8')](_0x9a07('0xb'),auth[_0x9a07('0x9')](),controller['describe']);router['get'](_0x9a07('0xc'),auth[_0x9a07('0x9')](),controller[_0x9a07('0xd')]);router['post']('/',auth[_0x9a07('0x9')](),interaction[_0x9a07('0xe')](_0x9a07('0xf'),'chatmessage:create'),controller[_0x9a07('0x10')]);router[_0x9a07('0x11')](_0x9a07('0xc'),controller[_0x9a07('0x12')]);router[_0x9a07('0x11')](_0x9a07('0x13'),auth['isAuthenticated'](),controller[_0x9a07('0x14')]);router[_0x9a07('0x11')](_0x9a07('0x15'),auth[_0x9a07('0x9')](),controller['reject']);router[_0x9a07('0x16')]('/:id',auth[_0x9a07('0x9')](),controller['destroy']);module[_0x9a07('0x17')]=router; \ No newline at end of file +var _0x958d=['accept','/:id/reject','reject','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','post','tracked','chat','create','put','update','/:id/accept'];(function(_0x14114a,_0x143008){var _0x212e1f=function(_0x15b714){while(--_0x15b714){_0x14114a['push'](_0x14114a['shift']());}};_0x212e1f(++_0x143008);}(_0x958d,0xb3));var _0xd958=function(_0xe4da3a,_0x701be1){_0xe4da3a=_0xe4da3a-0x0;var _0x53de02=_0x958d[_0xe4da3a];return _0x53de02;};'use strict';var multer=require(_0xd958('0x0'));var util=require(_0xd958('0x1'));var path=require(_0xd958('0x2'));var timeout=require('connect-timeout');var express=require(_0xd958('0x3'));var router=express[_0xd958('0x4')]();var fs_extra=require(_0xd958('0x5'));var auth=require(_0xd958('0x6'));var interaction=require(_0xd958('0x7'));var config=require('../../config/environment');var controller=require(_0xd958('0x8'));router[_0xd958('0x9')]('/',auth[_0xd958('0xa')](),controller[_0xd958('0xb')]);router[_0xd958('0x9')]('/describe',auth[_0xd958('0xa')](),controller[_0xd958('0xc')]);router['get'](_0xd958('0xd'),auth[_0xd958('0xa')](),controller['show']);router[_0xd958('0xe')]('/',auth[_0xd958('0xa')](),interaction[_0xd958('0xf')](_0xd958('0x10'),'chatmessage:create'),controller[_0xd958('0x11')]);router[_0xd958('0x12')]('/:id',controller[_0xd958('0x13')]);router['put'](_0xd958('0x14'),auth[_0xd958('0xa')](),controller[_0xd958('0x15')]);router[_0xd958('0x12')](_0xd958('0x16'),auth[_0xd958('0xa')](),controller[_0xd958('0x17')]);router[_0xd958('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index d767749..eddf552 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(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3aaef5,_0x16cdc8){_0x3aaef5=_0x3aaef5-0x0;var _0x4c0ed5=_0x0b0e[_0x3aaef5];return _0x4c0ed5;};'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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x47378a,_0x20bc70){var _0x120fdb=function(_0x2885ec){while(--_0x2885ec){_0x47378a['push'](_0x47378a['shift']());}};_0x120fdb(++_0x20bc70);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f368d,_0x419bc2){_0x2f368d=_0x2f368d-0x0;var _0x14860b=_0x5f2f[_0x2f368d];return _0x14860b;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 2e6d01e..cd8641f 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(_0x5ba4c5,_0x4f3319){var _0x3209aa=function(_0x576cae){while(--_0x576cae){_0x5ba4c5['push'](_0x5ba4c5['shift']());}};_0x3209aa(++_0x4f3319);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 _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(_0x540824,_0x3b1ae6){var _0x17134b=function(_0x2fec92){while(--_0x2fec92){_0x540824['push'](_0x540824['shift']());}};_0x17134b(++_0x3b1ae6);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index a4cbd84..b2d7d26 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 _0x3930=['hook','exports','../../mysqldb','setMaxListeners','update','emit'];(function(_0x1bb030,_0x27d05f){var _0x28ef4f=function(_0xb1150e){while(--_0xb1150e){_0x1bb030['push'](_0x1bb030['shift']());}};_0x28ef4f(++_0x27d05f);}(_0x3930,0x12e));var _0x0393=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x3930[_0x3239f5];return _0x3559c8;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x0393('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x0393('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0393('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1f9762){return function(_0x4da057,_0x4f603f,_0x288d3a){ChatOfflineMessageEvents[_0x0393('0x3')](_0x1f9762+':'+_0x4da057['id'],_0x4da057);ChatOfflineMessageEvents[_0x0393('0x3')](_0x1f9762,_0x4da057);_0x288d3a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x0393('0x4')](e,emitEvent(event));}}module[_0x0393('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x02b6=['hook','exports','events','ChatOfflineMessage','setMaxListeners','save','emit'];(function(_0x3194b5,_0x495239){var _0x50f2dc=function(_0x13abed){while(--_0x13abed){_0x3194b5['push'](_0x3194b5['shift']());}};_0x50f2dc(++_0x495239);}(_0x02b6,0xfe));var _0x602b=function(_0x3a5715,_0x3d13e6){_0x3a5715=_0x3a5715-0x0;var _0x3460a9=_0x02b6[_0x3a5715];return _0x3460a9;};'use strict';var EventEmitter=require(_0x602b('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x602b('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x602b('0x2')](0x0);var events={'afterCreate':_0x602b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x8291f){return function(_0x31f4a4,_0x33cc82,_0x2eec97){ChatOfflineMessageEvents['emit'](_0x8291f+':'+_0x31f4a4['id'],_0x31f4a4);ChatOfflineMessageEvents[_0x602b('0x4')](_0x8291f,_0x31f4a4);_0x2eec97(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x602b('0x5')](e,emitEvent(event));}}module[_0x602b('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 86b3d98..6b0d17b 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 _0x279f=['exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x4839eb,_0x364008){var _0x2982e4=function(_0x4b370c){while(--_0x4b370c){_0x4839eb['push'](_0x4839eb['shift']());}};_0x2982e4(++_0x364008);}(_0x279f,0x18b));var _0xf279=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x279f[_0x1928c9];return _0x51b5fb;};'use strict';var attributes=require(_0xf279('0x0'));module[_0xf279('0x1')]=function(_0x379d6c){return _0x379d6c[_0xf279('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0xf279('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf279('0x4'),'collate':_0xf279('0x5')});}; \ No newline at end of file +var _0xc998=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc998,0xe4));var _0x8c99=function(_0x28acd6,_0x1ea44b){_0x28acd6=_0x28acd6-0x0;var _0x49e00d=_0xc998[_0x28acd6];return _0x49e00d;};'use strict';var attributes=require(_0x8c99('0x0'));module[_0x8c99('0x1')]=function(_0x4d9209){return _0x4d9209[_0x8c99('0x2')](_0x8c99('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8c99('0x4'),'collate':_0x8c99('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index c6f042e..af7d13b 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 _0x3d32=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x13342f,_0x3d6303){var _0x2fc1fc=function(_0x2d991f){while(--_0x2d991f){_0x13342f['push'](_0x13342f['shift']());}};_0x2fc1fc(++_0x3d6303);}(_0x3d32,0x13c));var _0x23d3=function(_0x43e218,_0x41ef9b){_0x43e218=_0x43e218-0x0;var _0xf1d7e=_0x3d32[_0x43e218];return _0xf1d7e;};'use strict';var _=require(_0x23d3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23d3('0x1'))['db'];var utils=require(_0x23d3('0x2'));var logger=require(_0x23d3('0x3'))(_0x23d3('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x23d3('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14d62f,_0x5a2af9,_0x4c9b7f){return new BPromise(function(_0x5265d9,_0x39aa95){return client['request'](_0x14d62f,_0x4c9b7f)['then'](function(_0x426e17){logger[_0x23d3('0x6')](_0x23d3('0x7'),_0x5a2af9,_0x23d3('0x8'));logger['debug'](_0x23d3('0x9'),_0x5a2af9,_0x23d3('0x8'),JSON['stringify'](_0x426e17));if(_0x426e17[_0x23d3('0xa')]){if(_0x426e17['error']['code']===0x1f4){logger[_0x23d3('0xa')](_0x23d3('0x7'),_0x5a2af9,_0x426e17[_0x23d3('0xa')]['message']);return _0x39aa95(_0x426e17[_0x23d3('0xa')][_0x23d3('0xb')]);}logger[_0x23d3('0xa')](_0x23d3('0x7'),_0x5a2af9,_0x426e17[_0x23d3('0xa')][_0x23d3('0xb')]);return _0x5265d9(_0x426e17['error']['message']);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x5a2af9,_0x23d3('0x8'));_0x5265d9(_0x426e17['result'][_0x23d3('0xb')]);}})[_0x23d3('0xc')](function(_0xcb2a9){logger[_0x23d3('0xa')](_0x23d3('0x7'),_0x5a2af9,_0xcb2a9);_0x39aa95(_0xcb2a9);});});} \ No newline at end of file +var _0x9aed=['message','result','catch','moment','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x50ef26,_0x10e500){var _0x34c395=function(_0x53b312){while(--_0x53b312){_0x50ef26['push'](_0x50ef26['shift']());}};_0x34c395(++_0x10e500);}(_0x9aed,0x9c));var _0xd9ae=function(_0x43a464,_0xeea76d){_0x43a464=_0x43a464-0x0;var _0x38d98a=_0x9aed[_0x43a464];return _0x38d98a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd9ae('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9ae('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd9ae('0x2'))(_0xd9ae('0x3'));var config=require(_0xd9ae('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xd9ae('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39c9e7,_0x344903,_0xa638c9){return new BPromise(function(_0x2ec7a4,_0x243e6c){return client['request'](_0x39c9e7,_0xa638c9)[_0xd9ae('0x6')](function(_0x290eb3){logger[_0xd9ae('0x7')](_0xd9ae('0x8'),_0x344903,_0xd9ae('0x9'));logger['debug'](_0xd9ae('0xa'),_0x344903,_0xd9ae('0x9'),JSON[_0xd9ae('0xb')](_0x290eb3));if(_0x290eb3[_0xd9ae('0xc')]){if(_0x290eb3['error'][_0xd9ae('0xd')]===0x1f4){logger[_0xd9ae('0xc')](_0xd9ae('0x8'),_0x344903,_0x290eb3['error'][_0xd9ae('0xe')]);return _0x243e6c(_0x290eb3[_0xd9ae('0xc')][_0xd9ae('0xe')]);}logger['error'](_0xd9ae('0x8'),_0x344903,_0x290eb3['error'][_0xd9ae('0xe')]);return _0x2ec7a4(_0x290eb3[_0xd9ae('0xc')]['message']);}else{logger[_0xd9ae('0x7')]('ChatOfflineMessage,\x20%s,\x20%s',_0x344903,_0xd9ae('0x9'));_0x2ec7a4(_0x290eb3[_0xd9ae('0xf')][_0xd9ae('0xe')]);}})[_0xd9ae('0x10')](function(_0x46450e){logger[_0xd9ae('0xc')](_0xd9ae('0x8'),_0x344903,_0x46450e);_0x243e6c(_0x46450e);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 2f14270..b8cc221 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 _0xb9ea=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','destroy','exports','multer'];(function(_0x17a80c,_0xfad831){var _0x4d7e6b=function(_0x5739e6){while(--_0x5739e6){_0x17a80c['push'](_0x17a80c['shift']());}};_0x4d7e6b(++_0xfad831);}(_0xb9ea,0x131));var _0xab9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb9ea[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xab9e('0x0'));var util=require('util');var path=require(_0xab9e('0x1'));var timeout=require('connect-timeout');var express=require(_0xab9e('0x2'));var router=express[_0xab9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xab9e('0x4'));var interaction=require(_0xab9e('0x5'));var config=require(_0xab9e('0x6'));var controller=require(_0xab9e('0x7'));router[_0xab9e('0x8')]('/',auth[_0xab9e('0x9')](),controller['index']);router[_0xab9e('0x8')](_0xab9e('0xa'),auth['isAuthenticated'](),controller[_0xab9e('0xb')]);router[_0xab9e('0x8')](_0xab9e('0xc'),auth[_0xab9e('0x9')](),controller[_0xab9e('0xd')]);router[_0xab9e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xab9e('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xab9e('0x10')]);module[_0xab9e('0x11')]=router; \ No newline at end of file +var _0xc665=['path','express','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x2ca83c,_0x45190a){var _0xe0648f=function(_0x4f8247){while(--_0x4f8247){_0x2ca83c['push'](_0x2ca83c['shift']());}};_0xe0648f(++_0x45190a);}(_0xc665,0x19e));var _0x5c66=function(_0x4c4cbf,_0x1e6e6){_0x4c4cbf=_0x4c4cbf-0x0;var _0xa65774=_0xc665[_0x4c4cbf];return _0xa65774;};'use strict';var multer=require(_0x5c66('0x0'));var util=require(_0x5c66('0x1'));var path=require(_0x5c66('0x2'));var timeout=require('connect-timeout');var express=require(_0x5c66('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5c66('0x4'));var controller=require(_0x5c66('0x5'));router[_0x5c66('0x6')]('/',auth[_0x5c66('0x7')](),controller[_0x5c66('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x5c66('0x7')](),controller[_0x5c66('0x9')]);router['post']('/',auth[_0x5c66('0x7')](),controller[_0x5c66('0xa')]);router[_0x5c66('0xb')](_0x5c66('0xc'),auth[_0x5c66('0x7')](),controller[_0x5c66('0xd')]);router[_0x5c66('0xe')](_0x5c66('0xc'),auth[_0x5c66('0x7')](),controller[_0x5c66('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c2df612..38eb5ed 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 _0xacfc=['STRING','ENUM','mouseOver','timeout','INTEGER','exports'];(function(_0x403ce7,_0x5e2728){var _0x550430=function(_0x11ee32){while(--_0x11ee32){_0x403ce7['push'](_0x403ce7['shift']());}};_0x550430(++_0x5e2728);}(_0xacfc,0x77));var _0xcacf=function(_0x3a861c,_0xf07f4c){_0x3a861c=_0x3a861c-0x0;var _0xbb4383=_0xacfc[_0x3a861c];return _0xbb4383;};'use strict';var Sequelize=require('sequelize');module[_0xcacf('0x0')]={'name':{'type':Sequelize[_0xcacf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xcacf('0x2')](_0xcacf('0x3'),_0xcacf('0x4')),'defaultValue':_0xcacf('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcacf('0x5')]}}; \ No newline at end of file +var _0x760b=['sequelize','exports','ENUM','timeout','mouseOver','STRING'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x760b,0x14a));var _0xb760=function(_0x470cae,_0x82f4a2){_0x470cae=_0x470cae-0x0;var _0x11e17e=_0x760b[_0x470cae];return _0x11e17e;};'use strict';var Sequelize=require(_0xb760('0x0'));module[_0xb760('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb760('0x2')]('mouseOver',_0xb760('0x3')),'defaultValue':_0xb760('0x4')},'selector':{'type':Sequelize[_0xb760('0x5')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 8af5c19..8b3d28a 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 _0x394e=['find','then','catch','create','body','params','eml-format','rimraf','fast-json-patch','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','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','sendStatus','error','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options'];(function(_0xba4dfb,_0x443432){var _0x3952d4=function(_0x10d738){while(--_0x10d738){_0xba4dfb['push'](_0xba4dfb['shift']());}};_0x3952d4(++_0x443432);}(_0x394e,0x88));var _0xe394=function(_0x28202e,_0x5d0604){_0x28202e=_0x28202e-0x0;var _0x126f8b=_0x394e[_0x28202e];return _0x126f8b;};'use strict';var emlformat=require(_0xe394('0x0'));var rimraf=require(_0xe394('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe394('0x2'));var rp=require(_0xe394('0x3'));var moment=require(_0xe394('0x4'));var BPromise=require(_0xe394('0x5'));var Mustache=require('mustache');var util=require(_0xe394('0x6'));var path=require(_0xe394('0x7'));var sox=require(_0xe394('0x8'));var csv=require(_0xe394('0x9'));var ejs=require(_0xe394('0xa'));var fs=require('fs');var fs_extra=require(_0xe394('0xb'));var _=require(_0xe394('0xc'));var squel=require(_0xe394('0xd'));var crypto=require(_0xe394('0xe'));var jsforce=require(_0xe394('0xf'));var deskjs=require(_0xe394('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe394('0x11'));var authService=require(_0xe394('0x12'));var qs=require(_0xe394('0x13'));var as=require(_0xe394('0x14'));var hardwareService=require(_0xe394('0x15'));var logger=require(_0xe394('0x16'))(_0xe394('0x17'));var utils=require(_0xe394('0x18'));var config=require(_0xe394('0x19'));var licenseUtil=require(_0xe394('0x1a'));var db=require(_0xe394('0x1b'))['db'];function respondWithStatusCode(_0x383e2c,_0x575a03){_0x575a03=_0x575a03||0xcc;return function(_0x5730b5){if(_0x5730b5){return _0x383e2c['sendStatus'](_0x575a03);}return _0x383e2c[_0xe394('0x1c')](_0x575a03)[_0xe394('0x1d')]();};}function respondWithResult(_0x4f1bf8,_0x996771){_0x996771=_0x996771||0xc8;return function(_0x61e157){if(_0x61e157){return _0x4f1bf8[_0xe394('0x1c')](_0x996771)[_0xe394('0x1e')](_0x61e157);}};}function respondWithFilteredResult(_0x1f4f71,_0x1c26db){return function(_0x56aafa){if(_0x56aafa){var _0x47afc4=typeof _0x1c26db[_0xe394('0x1f')]===_0xe394('0x20')&&typeof _0x1c26db[_0xe394('0x21')]===_0xe394('0x20');var _0x4a7a5b=_0x56aafa[_0xe394('0x22')];var _0x4b0d41=_0x47afc4?0x0:_0x1c26db[_0xe394('0x1f')];var _0x25c3b1=_0x47afc4?_0x56aafa[_0xe394('0x22')]:_0x1c26db['offset']+_0x1c26db[_0xe394('0x21')];var _0x28ab96;if(_0x25c3b1>=_0x4a7a5b){_0x25c3b1=_0x4a7a5b;_0x28ab96=0xc8;}else{_0x28ab96=0xce;}_0x1f4f71[_0xe394('0x1c')](_0x28ab96);return _0x1f4f71['set'](_0xe394('0x23'),_0x4b0d41+'-'+_0x25c3b1+'/'+_0x4a7a5b)[_0xe394('0x1e')](_0x56aafa);}return null;};}function patchUpdates(_0x1066a3){return function(_0x203a91){try{jsonpatch[_0xe394('0x24')](_0x203a91,_0x1066a3,!![]);}catch(_0x1a9004){return BPromise[_0xe394('0x25')](_0x1a9004);}return _0x203a91[_0xe394('0x26')]();};}function saveUpdates(_0x39ce6d,_0x36ef72){return function(_0x402fd5){if(_0x402fd5){return _0x402fd5[_0xe394('0x27')](_0x39ce6d)['then'](function(_0x133c8b){return _0x133c8b;});}return null;};}function removeEntity(_0x459bfe,_0x11c795){return function(_0x1b766c){if(_0x1b766c){return _0x1b766c[_0xe394('0x28')]()['then'](function(){_0x459bfe[_0xe394('0x1c')](0xcc)[_0xe394('0x1d')]();});}};}function handleEntityNotFound(_0x156f6b,_0x44c3e7){return function(_0x4ebf7d){if(!_0x4ebf7d){_0x156f6b[_0xe394('0x29')](0x194);}return _0x4ebf7d;};}function handleError(_0x446a53,_0x22597b){_0x22597b=_0x22597b||0x1f4;return function(_0xc6cb2d){logger[_0xe394('0x2a')](_0xc6cb2d['stack']);if(_0xc6cb2d[_0xe394('0x2b')]){delete _0xc6cb2d[_0xe394('0x2b')];}_0x446a53[_0xe394('0x1c')](_0x22597b)[_0xe394('0x2c')](_0xc6cb2d);};}exports[_0xe394('0x2d')]=function(_0x24146d,_0x3d7693){var _0xdd67a6={'raw':!![],'where':{'id':_0x24146d['params']['id']}},_0x1abc74={};_0x1abc74[_0xe394('0x2e')]=_[_0xe394('0x2f')](db[_0xe394('0x30')][_0xe394('0x31')]);_0x1abc74[_0xe394('0x32')]=_['keys'](_0x24146d['query']);_0x1abc74[_0xe394('0x33')]=_[_0xe394('0x34')](_0x1abc74[_0xe394('0x2e')],_0x1abc74['query']);_0xdd67a6[_0xe394('0x35')]=_['intersection'](_0x1abc74['model'],qs[_0xe394('0x36')](_0x24146d[_0xe394('0x32')][_0xe394('0x36')]));_0xdd67a6[_0xe394('0x35')]=_0xdd67a6[_0xe394('0x35')][_0xe394('0x37')]?_0xdd67a6[_0xe394('0x35')]:_0x1abc74[_0xe394('0x2e')];if(_0x24146d[_0xe394('0x32')][_0xe394('0x38')]){_0xdd67a6[_0xe394('0x39')]=[{'all':!![]}];}_0xdd67a6=_['merge']({},_0xdd67a6,_0x24146d[_0xe394('0x3a')]);return db[_0xe394('0x30')][_0xe394('0x3b')](_0xdd67a6)[_0xe394('0x3c')](handleEntityNotFound(_0x3d7693,null))[_0xe394('0x3c')](respondWithResult(_0x3d7693,null))[_0xe394('0x3d')](handleError(_0x3d7693,null));};exports['create']=function(_0x4beed1,_0x33d225){return db[_0xe394('0x30')][_0xe394('0x3e')](_0x4beed1[_0xe394('0x3f')],{})[_0xe394('0x3c')](respondWithResult(_0x33d225,0xc9))[_0xe394('0x3d')](handleError(_0x33d225,null));};exports[_0xe394('0x27')]=function(_0x36c37f,_0x2e3a1e){if(_0x36c37f[_0xe394('0x3f')]['id']){delete _0x36c37f[_0xe394('0x3f')]['id'];}return db[_0xe394('0x30')][_0xe394('0x3b')]({'where':{'id':_0x36c37f[_0xe394('0x40')]['id']}})[_0xe394('0x3c')](handleEntityNotFound(_0x2e3a1e,null))['then'](saveUpdates(_0x36c37f[_0xe394('0x3f')],null))[_0xe394('0x3c')](respondWithResult(_0x2e3a1e,null))[_0xe394('0x3d')](handleError(_0x2e3a1e,null));};exports[_0xe394('0x28')]=function(_0x44b00a,_0x4b7152){return db['ChatProactiveAction'][_0xe394('0x3b')]({'where':{'id':_0x44b00a['params']['id']}})[_0xe394('0x3c')](handleEntityNotFound(_0x4b7152,null))[_0xe394('0x3c')](removeEntity(_0x4b7152,null))[_0xe394('0x3d')](handleError(_0x4b7152,null));}; \ No newline at end of file +var _0x9417=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x5cd042,_0xba348){var _0x10490b=function(_0xce382f){while(--_0xce382f){_0x5cd042['push'](_0x5cd042['shift']());}};_0x10490b(++_0xba348);}(_0x9417,0xb4));var _0x7941=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0x9417[_0x9fb081];return _0x43f8b0;};'use strict';var emlformat=require(_0x7941('0x0'));var rimraf=require(_0x7941('0x1'));var zipdir=require(_0x7941('0x2'));var jsonpatch=require(_0x7941('0x3'));var rp=require('request-promise');var moment=require(_0x7941('0x4'));var BPromise=require(_0x7941('0x5'));var Mustache=require(_0x7941('0x6'));var util=require(_0x7941('0x7'));var path=require(_0x7941('0x8'));var sox=require(_0x7941('0x9'));var csv=require(_0x7941('0xa'));var ejs=require(_0x7941('0xb'));var fs=require('fs');var fs_extra=require(_0x7941('0xc'));var _=require(_0x7941('0xd'));var squel=require('squel');var crypto=require(_0x7941('0xe'));var jsforce=require(_0x7941('0xf'));var deskjs=require(_0x7941('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7941('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7941('0x12'));var qs=require(_0x7941('0x13'));var as=require(_0x7941('0x14'));var hardwareService=require(_0x7941('0x15'));var logger=require(_0x7941('0x16'))(_0x7941('0x17'));var utils=require(_0x7941('0x18'));var config=require(_0x7941('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7941('0x1a'))['db'];function respondWithStatusCode(_0x51aab8,_0x12b674){_0x12b674=_0x12b674||0xcc;return function(_0x46a86a){if(_0x46a86a){return _0x51aab8['sendStatus'](_0x12b674);}return _0x51aab8['status'](_0x12b674)[_0x7941('0x1b')]();};}function respondWithResult(_0x59f371,_0x18936d){_0x18936d=_0x18936d||0xc8;return function(_0x45c08f){if(_0x45c08f){return _0x59f371[_0x7941('0x1c')](_0x18936d)[_0x7941('0x1d')](_0x45c08f);}};}function respondWithFilteredResult(_0x1da410,_0x41b098){return function(_0x55320b){if(_0x55320b){var _0x11623c=typeof _0x41b098[_0x7941('0x1e')]===_0x7941('0x1f')&&typeof _0x41b098[_0x7941('0x20')]===_0x7941('0x1f');var _0x256f45=_0x55320b[_0x7941('0x21')];var _0x573b44=_0x11623c?0x0:_0x41b098[_0x7941('0x1e')];var _0x533559=_0x11623c?_0x55320b['count']:_0x41b098[_0x7941('0x1e')]+_0x41b098['limit'];var _0x17442f;if(_0x533559>=_0x256f45){_0x533559=_0x256f45;_0x17442f=0xc8;}else{_0x17442f=0xce;}_0x1da410[_0x7941('0x1c')](_0x17442f);return _0x1da410[_0x7941('0x22')]('Content-Range',_0x573b44+'-'+_0x533559+'/'+_0x256f45)['json'](_0x55320b);}return null;};}function patchUpdates(_0x645e4c){return function(_0x4d3b28){try{jsonpatch[_0x7941('0x23')](_0x4d3b28,_0x645e4c,!![]);}catch(_0x57809b){return BPromise[_0x7941('0x24')](_0x57809b);}return _0x4d3b28[_0x7941('0x25')]();};}function saveUpdates(_0x42ff1f,_0x45ae78){return function(_0x3c2ae5){if(_0x3c2ae5){return _0x3c2ae5[_0x7941('0x26')](_0x42ff1f)[_0x7941('0x27')](function(_0x5287e0){return _0x5287e0;});}return null;};}function removeEntity(_0x20dd64,_0x531f20){return function(_0x36ff77){if(_0x36ff77){return _0x36ff77[_0x7941('0x28')]()[_0x7941('0x27')](function(){_0x20dd64[_0x7941('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55f679,_0x1e61e0){return function(_0x5ad836){if(!_0x5ad836){_0x55f679['sendStatus'](0x194);}return _0x5ad836;};}function handleError(_0x5f09c1,_0x43caf0){_0x43caf0=_0x43caf0||0x1f4;return function(_0x1b59e2){logger[_0x7941('0x29')](_0x1b59e2[_0x7941('0x2a')]);if(_0x1b59e2[_0x7941('0x2b')]){delete _0x1b59e2['name'];}_0x5f09c1[_0x7941('0x1c')](_0x43caf0)[_0x7941('0x2c')](_0x1b59e2);};}exports[_0x7941('0x2d')]=function(_0x240052,_0x23f617){var _0x24cc75={'raw':!![],'where':{'id':_0x240052['params']['id']}},_0xd2b022={};_0xd2b022[_0x7941('0x2e')]=_[_0x7941('0x2f')](db[_0x7941('0x30')]['rawAttributes']);_0xd2b022[_0x7941('0x31')]=_['keys'](_0x240052[_0x7941('0x31')]);_0xd2b022[_0x7941('0x32')]=_[_0x7941('0x33')](_0xd2b022['model'],_0xd2b022[_0x7941('0x31')]);_0x24cc75[_0x7941('0x34')]=_['intersection'](_0xd2b022[_0x7941('0x2e')],qs[_0x7941('0x35')](_0x240052['query'][_0x7941('0x35')]));_0x24cc75[_0x7941('0x34')]=_0x24cc75['attributes'][_0x7941('0x36')]?_0x24cc75[_0x7941('0x34')]:_0xd2b022[_0x7941('0x2e')];if(_0x240052[_0x7941('0x31')][_0x7941('0x37')]){_0x24cc75[_0x7941('0x38')]=[{'all':!![]}];}_0x24cc75=_[_0x7941('0x39')]({},_0x24cc75,_0x240052['options']);return db[_0x7941('0x30')][_0x7941('0x3a')](_0x24cc75)['then'](handleEntityNotFound(_0x23f617,null))[_0x7941('0x27')](respondWithResult(_0x23f617,null))[_0x7941('0x3b')](handleError(_0x23f617,null));};exports[_0x7941('0x3c')]=function(_0x1d03d7,_0x1173b8){return db[_0x7941('0x30')]['create'](_0x1d03d7[_0x7941('0x3d')],{})[_0x7941('0x27')](respondWithResult(_0x1173b8,0xc9))[_0x7941('0x3b')](handleError(_0x1173b8,null));};exports[_0x7941('0x26')]=function(_0x469317,_0x1ff304){if(_0x469317[_0x7941('0x3d')]['id']){delete _0x469317['body']['id'];}return db[_0x7941('0x30')][_0x7941('0x3a')]({'where':{'id':_0x469317['params']['id']}})['then'](handleEntityNotFound(_0x1ff304,null))[_0x7941('0x27')](saveUpdates(_0x469317[_0x7941('0x3d')],null))[_0x7941('0x27')](respondWithResult(_0x1ff304,null))[_0x7941('0x3b')](handleError(_0x1ff304,null));};exports[_0x7941('0x28')]=function(_0x2a59f6,_0x234554){return db[_0x7941('0x30')]['find']({'where':{'id':_0x2a59f6[_0x7941('0x3e')]['id']}})['then'](handleEntityNotFound(_0x234554,null))[_0x7941('0x27')](removeEntity(_0x234554,null))[_0x7941('0x3b')](handleError(_0x234554,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2b84a74..0a5feba 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 _0xce3d=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions','lodash','util'];(function(_0x5cd900,_0x351efb){var _0x5c71f6=function(_0x44b444){while(--_0x44b444){_0x5cd900['push'](_0x5cd900['shift']());}};_0x5c71f6(++_0x351efb);}(_0xce3d,0x1e2));var _0xdce3=function(_0x261931,_0x5b654a){_0x261931=_0x261931-0x0;var _0x11083a=_0xce3d[_0x261931];return _0x11083a;};'use strict';var _=require(_0xdce3('0x0'));var util=require(_0xdce3('0x1'));var logger=require(_0xdce3('0x2'))(_0xdce3('0x3'));var moment=require('moment');var BPromise=require(_0xdce3('0x4'));var rp=require(_0xdce3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdce3('0x6'));var config=require(_0xdce3('0x7'));var attributes=require(_0xdce3('0x8'));module['exports']=function(_0x4cd2d7,_0x3b946b){return _0x4cd2d7[_0xdce3('0x9')]('ChatProactiveAction',attributes,{'tableName':_0xdce3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe272=['rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x25c659,_0x553ea8){var _0x14fee9=function(_0x17403c){while(--_0x17403c){_0x25c659['push'](_0x25c659['shift']());}};_0x14fee9(++_0x553ea8);}(_0xe272,0x1e7));var _0x2e27=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xe272[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x2e27('0x0'));var util=require(_0x2e27('0x1'));var logger=require(_0x2e27('0x2'))(_0x2e27('0x3'));var moment=require(_0x2e27('0x4'));var BPromise=require(_0x2e27('0x5'));var rp=require(_0x2e27('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e27('0x7'));var config=require(_0x2e27('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x2e27('0x9')]=function(_0x4a66dc,_0x307412){return _0x4a66dc[_0x2e27('0xa')](_0x2e27('0xb'),attributes,{'tableName':_0x2e27('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 68448c6..3adb5c1 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 _0xd932=['client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x114d05,_0x2c629d){var _0x3e444c=function(_0x51a55d){while(--_0x51a55d){_0x114d05['push'](_0x114d05['shift']());}};_0x3e444c(++_0x2c629d);}(_0xd932,0x6a));var _0x2d93=function(_0x53eb44,_0x32e433){_0x53eb44=_0x53eb44-0x0;var _0x2bb889=_0xd932[_0x53eb44];return _0x2bb889;};'use strict';var _=require(_0x2d93('0x0'));var util=require(_0x2d93('0x1'));var moment=require(_0x2d93('0x2'));var BPromise=require(_0x2d93('0x3'));var rs=require(_0x2d93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d93('0x5'));var logger=require('../../config/logger')(_0x2d93('0x6'));var config=require(_0x2d93('0x7'));var jayson=require(_0x2d93('0x8'));var client=jayson[_0x2d93('0x9')][_0x2d93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f2863,_0x5efc29,_0x5b7d00){return new BPromise(function(_0x238b0e,_0x36f272){return client[_0x2d93('0xb')](_0x2f2863,_0x5b7d00)[_0x2d93('0xc')](function(_0x27407a){logger[_0x2d93('0xd')](_0x2d93('0xe'),_0x5efc29,_0x2d93('0xf'));logger[_0x2d93('0x10')](_0x2d93('0x11'),_0x5efc29,_0x2d93('0xf'),JSON[_0x2d93('0x12')](_0x27407a));if(_0x27407a['error']){if(_0x27407a['error']['code']===0x1f4){logger[_0x2d93('0x13')](_0x2d93('0xe'),_0x5efc29,_0x27407a[_0x2d93('0x13')][_0x2d93('0x14')]);return _0x36f272(_0x27407a['error'][_0x2d93('0x14')]);}logger[_0x2d93('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x5efc29,_0x27407a[_0x2d93('0x13')]['message']);return _0x238b0e(_0x27407a['error'][_0x2d93('0x14')]);}else{logger['info'](_0x2d93('0xe'),_0x5efc29,_0x2d93('0xf'));_0x238b0e(_0x27407a[_0x2d93('0x15')]['message']);}})[_0x2d93('0x16')](function(_0x387772){logger[_0x2d93('0x13')](_0x2d93('0xe'),_0x5efc29,_0x387772);_0x36f272(_0x387772);});});} \ No newline at end of file +var _0x682e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x682e,0x119));var _0xe682=function(_0xfb2f7d,_0x58d8fa){_0xfb2f7d=_0xfb2f7d-0x0;var _0x164866=_0x682e[_0xfb2f7d];return _0x164866;};'use strict';var _=require(_0xe682('0x0'));var util=require('util');var moment=require(_0xe682('0x1'));var BPromise=require(_0xe682('0x2'));var rs=require(_0xe682('0x3'));var fs=require('fs');var Redis=require(_0xe682('0x4'));var db=require(_0xe682('0x5'))['db'];var utils=require(_0xe682('0x6'));var logger=require(_0xe682('0x7'))(_0xe682('0x8'));var config=require(_0xe682('0x9'));var jayson=require(_0xe682('0xa'));var client=jayson[_0xe682('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x82fa21,_0x1d766a,_0x214393){return new BPromise(function(_0x283937,_0x5d9cd5){return client[_0xe682('0xc')](_0x82fa21,_0x214393)[_0xe682('0xd')](function(_0xc6d5fe){logger[_0xe682('0xe')](_0xe682('0xf'),_0x1d766a,_0xe682('0x10'));logger['debug'](_0xe682('0x11'),_0x1d766a,_0xe682('0x10'),JSON['stringify'](_0xc6d5fe));if(_0xc6d5fe[_0xe682('0x12')]){if(_0xc6d5fe[_0xe682('0x12')][_0xe682('0x13')]===0x1f4){logger[_0xe682('0x12')](_0xe682('0xf'),_0x1d766a,_0xc6d5fe[_0xe682('0x12')][_0xe682('0x14')]);return _0x5d9cd5(_0xc6d5fe['error'][_0xe682('0x14')]);}logger[_0xe682('0x12')](_0xe682('0xf'),_0x1d766a,_0xc6d5fe[_0xe682('0x12')][_0xe682('0x14')]);return _0x283937(_0xc6d5fe[_0xe682('0x12')][_0xe682('0x14')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x1d766a,_0xe682('0x10'));_0x283937(_0xc6d5fe[_0xe682('0x15')][_0xe682('0x14')]);}})['catch'](function(_0x11b0aa){logger[_0xe682('0x12')](_0xe682('0xf'),_0x1d766a,_0x11b0aa);_0x5d9cd5(_0x11b0aa);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index d5ed268..bb35a23 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 _0x8d0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x35c2ba,_0x46f478){_0x35c2ba=_0x35c2ba-0x0;var _0x44a7fa=_0x8d0e[_0x35c2ba];return _0x44a7fa;};'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']('/:id',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0xc')]('/',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['update']);router[_0xe8d0('0x10')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd8fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','isAuthenticated','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x2fd7d9,_0x585704){var _0xd3d662=function(_0x1dc7eb){while(--_0x1dc7eb){_0x2fd7d9['push'](_0x2fd7d9['shift']());}};_0xd3d662(++_0x585704);}(_0xd8fb,0x99));var _0xbd8f=function(_0x46f334,_0x2c63fa){_0x46f334=_0x46f334-0x0;var _0x3db125=_0xd8fb[_0x46f334];return _0x3db125;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/:id',auth[_0xbd8f('0x8')](),controller['show']);router[_0xbd8f('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0xc')]);router[_0xbd8f('0xd')](_0xbd8f('0xe'),auth['isAuthenticated'](),controller[_0xbd8f('0xf')]);module[_0xbd8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 9c5ad86..e639046 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 _0x1033=['rrmemory','beepall','roundrobin','exports','STRING','name','ENUM'];(function(_0x3743af,_0xada0ec){var _0x2d19a2=function(_0x42fef1){while(--_0x42fef1){_0x3743af['push'](_0x3743af['shift']());}};_0x2d19a2(++_0xada0ec);}(_0x1033,0xe3));var _0x3103=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x1033[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require('sequelize');module[_0x3103('0x0')]={'name':{'type':Sequelize[_0x3103('0x1')],'unique':_0x3103('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3103('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3103('0x3')](_0x3103('0x4'),_0x3103('0x5'),_0x3103('0x6'))}}; \ No newline at end of file +var _0x6023=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','name'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x6023,0x105));var _0x3602=function(_0x30f160,_0x185cea){_0x30f160=_0x30f160-0x0;var _0x87795=_0x6023[_0x30f160];return _0x87795;};'use strict';var Sequelize=require(_0x3602('0x0'));module[_0x3602('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3602('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3602('0x3')]},'timeout':{'type':Sequelize[_0x3602('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3602('0x5')]('rrmemory',_0x3602('0x6'),_0x3602('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 0e77332..45675cd 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 _0x7757=['offset','limit','count','Content-Range','json','apply','save','update','destroy','ChatQueues','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end'];(function(_0x33b30e,_0x11d1e6){var _0x17693e=function(_0x2e7c76){while(--_0x2e7c76){_0x33b30e['push'](_0x33b30e['shift']());}};_0x17693e(++_0x11d1e6);}(_0x7757,0x109));var _0x7775=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7757[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x7775('0x0'));var rimraf=require(_0x7775('0x1'));var zipdir=require(_0x7775('0x2'));var jsonpatch=require(_0x7775('0x3'));var rp=require(_0x7775('0x4'));var moment=require(_0x7775('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7775('0x6'));var util=require(_0x7775('0x7'));var path=require(_0x7775('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7775('0x9'));var fs=require('fs');var fs_extra=require(_0x7775('0xa'));var _=require(_0x7775('0xb'));var squel=require(_0x7775('0xc'));var crypto=require('crypto');var jsforce=require(_0x7775('0xd'));var deskjs=require(_0x7775('0xe'));var toCsv=require(_0x7775('0xf'));var querystring=require(_0x7775('0x10'));var Papa=require(_0x7775('0x11'));var Redis=require(_0x7775('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7775('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7775('0x14'));var logger=require(_0x7775('0x15'))(_0x7775('0x16'));var utils=require(_0x7775('0x17'));var config=require(_0x7775('0x18'));var licenseUtil=require(_0x7775('0x19'));var db=require('../../mysqldb')['db'];config[_0x7775('0x1a')]=_['defaults'](config[_0x7775('0x1a')],{'host':_0x7775('0x1b'),'port':0x18eb});var socket=require(_0x7775('0x1c'))(new Redis(config[_0x7775('0x1a')]));require(_0x7775('0x1d'))[_0x7775('0x1e')](socket);var jayson=require(_0x7775('0x1f'));var client=jayson[_0x7775('0x20')][_0x7775('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2d72c2,_0x94a3b3,_0x4f1e8a,_0x4109c8){return new BPromise(function(_0x334fda,_0x394278){var _0xafaa68=_0x4109c8||client;return _0xafaa68[_0x7775('0x22')](_0x2d72c2,_0x4f1e8a)[_0x7775('0x23')](function(_0xec3f9d){logger[_0x7775('0x24')](_0x7775('0x25'),_0x94a3b3,_0x7775('0x26'));logger[_0x7775('0x27')](_0x7775('0x28'),_0x94a3b3,_0x7775('0x26'),JSON[_0x7775('0x29')](_0xec3f9d));if(_0xec3f9d[_0x7775('0x2a')]){if(_0xec3f9d[_0x7775('0x2a')][_0x7775('0x2b')]===0x1f4){logger[_0x7775('0x2a')](_0x7775('0x25'),_0x94a3b3,_0xec3f9d[_0x7775('0x2a')][_0x7775('0x2c')]);return _0x394278(_0xec3f9d[_0x7775('0x2a')]['message']);}logger[_0x7775('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x94a3b3,_0xec3f9d[_0x7775('0x2a')]['message']);return _0x334fda(_0xec3f9d[_0x7775('0x2a')][_0x7775('0x2c')]);}else{logger[_0x7775('0x24')](_0x7775('0x25'),_0x94a3b3,_0x7775('0x26'));_0x334fda(_0xec3f9d[_0x7775('0x2d')]['message']);}})['catch'](function(_0x5ae5d6){logger['error'](_0x7775('0x25'),_0x94a3b3,_0x5ae5d6);_0x394278(_0x5ae5d6);});});}function respondWithStatusCode(_0x4cdc03,_0x5206af){_0x5206af=_0x5206af||0xcc;return function(_0x3d8056){if(_0x3d8056){return _0x4cdc03[_0x7775('0x2e')](_0x5206af);}return _0x4cdc03[_0x7775('0x2f')](_0x5206af)[_0x7775('0x30')]();};}function respondWithResult(_0xb0705f,_0x5b5833){_0x5b5833=_0x5b5833||0xc8;return function(_0x2c1c9a){if(_0x2c1c9a){return _0xb0705f[_0x7775('0x2f')](_0x5b5833)['json'](_0x2c1c9a);}};}function respondWithFilteredResult(_0x8982a5,_0x1c9520){return function(_0x291f18){if(_0x291f18){var _0x1c338d=typeof _0x1c9520[_0x7775('0x31')]==='undefined'&&typeof _0x1c9520[_0x7775('0x32')]==='undefined';var _0x2bdca9=_0x291f18[_0x7775('0x33')];var _0x561c22=_0x1c338d?0x0:_0x1c9520['offset'];var _0x3a152e=_0x1c338d?_0x291f18['count']:_0x1c9520[_0x7775('0x31')]+_0x1c9520['limit'];var _0x4e076e;if(_0x3a152e>=_0x2bdca9){_0x3a152e=_0x2bdca9;_0x4e076e=0xc8;}else{_0x4e076e=0xce;}_0x8982a5[_0x7775('0x2f')](_0x4e076e);return _0x8982a5['set'](_0x7775('0x34'),_0x561c22+'-'+_0x3a152e+'/'+_0x2bdca9)[_0x7775('0x35')](_0x291f18);}return null;};}function patchUpdates(_0x2ed364){return function(_0x5cd1a0){try{jsonpatch[_0x7775('0x36')](_0x5cd1a0,_0x2ed364,!![]);}catch(_0x27ff80){return BPromise['reject'](_0x27ff80);}return _0x5cd1a0[_0x7775('0x37')]();};}function saveUpdates(_0x3134da,_0x59d20b){return function(_0xa12dce){if(_0xa12dce){return _0xa12dce[_0x7775('0x38')](_0x3134da)[_0x7775('0x23')](function(_0x116606){return _0x116606;});}return null;};}function removeEntity(_0xf0e931,_0x364b92){return function(_0x30fe83){if(_0x30fe83){return _0x30fe83[_0x7775('0x39')]()['then'](function(){var _0x19cb23=_0x30fe83['get']({'plain':!![]});var _0x31bca2=_0x7775('0x3a');return db['UserProfileResource'][_0x7775('0x39')]({'where':{'type':_0x31bca2,'resourceId':_0x19cb23['id']}})[_0x7775('0x23')](function(){return _0x30fe83;});})[_0x7775('0x23')](function(){_0xf0e931['status'](0xcc)[_0x7775('0x30')]();});}};}function handleEntityNotFound(_0x3a090b,_0x5bdb82){return function(_0x407085){if(!_0x407085){_0x3a090b[_0x7775('0x2e')](0x194);}return _0x407085;};}function handleError(_0x24b764,_0x7ec77c){_0x7ec77c=_0x7ec77c||0x1f4;return function(_0x2720a7){logger[_0x7775('0x2a')](_0x2720a7[_0x7775('0x3b')]);if(_0x2720a7['name']){delete _0x2720a7[_0x7775('0x3c')];}_0x24b764[_0x7775('0x2f')](_0x7ec77c)[_0x7775('0x3d')](_0x2720a7);};}exports[_0x7775('0x3e')]=function(_0x1a2ce0,_0x4dfe77){var _0x45bb82={},_0xb9b90c={},_0x3a69a0={'count':0x0,'rows':[]};var _0x17c5e1=_[_0x7775('0x3f')](db[_0x7775('0x40')][_0x7775('0x41')],function(_0x5a44f9){return{'name':_0x5a44f9[_0x7775('0x42')],'type':_0x5a44f9[_0x7775('0x43')][_0x7775('0x44')]};});_0xb9b90c[_0x7775('0x45')]=_[_0x7775('0x3f')](_0x17c5e1,_0x7775('0x3c'));_0xb9b90c[_0x7775('0x46')]=_[_0x7775('0x47')](_0x1a2ce0[_0x7775('0x46')]);_0xb9b90c[_0x7775('0x48')]=_[_0x7775('0x49')](_0xb9b90c['model'],_0xb9b90c[_0x7775('0x46')]);_0x45bb82[_0x7775('0x4a')]=_['intersection'](_0xb9b90c[_0x7775('0x45')],qs[_0x7775('0x4b')](_0x1a2ce0[_0x7775('0x46')][_0x7775('0x4b')]));_0x45bb82[_0x7775('0x4a')]=_0x45bb82[_0x7775('0x4a')][_0x7775('0x4c')]?_0x45bb82[_0x7775('0x4a')]:_0xb9b90c[_0x7775('0x45')];if(!_0x1a2ce0['query'][_0x7775('0x4d')](_0x7775('0x4e'))){_0x45bb82['limit']=qs[_0x7775('0x32')](_0x1a2ce0[_0x7775('0x46')]['limit']);_0x45bb82[_0x7775('0x31')]=qs[_0x7775('0x31')](_0x1a2ce0[_0x7775('0x46')][_0x7775('0x31')]);}_0x45bb82[_0x7775('0x4f')]=qs[_0x7775('0x50')](_0x1a2ce0[_0x7775('0x46')]['sort']);_0x45bb82['where']=qs[_0x7775('0x48')](_[_0x7775('0x51')](_0x1a2ce0[_0x7775('0x46')],_0xb9b90c[_0x7775('0x48')]),_0x17c5e1);if(_0x1a2ce0[_0x7775('0x46')][_0x7775('0x52')]){_0x45bb82[_0x7775('0x53')]=_[_0x7775('0x54')](_0x45bb82['where'],{'$or':_['map'](_0x17c5e1,function(_0x17de1b){if(_0x17de1b[_0x7775('0x43')]!==_0x7775('0x55')){var _0x34da5c={};_0x34da5c[_0x17de1b[_0x7775('0x3c')]]={'$like':'%'+_0x1a2ce0['query']['filter']+'%'};return _0x34da5c;}})});}_0x45bb82=_['merge']({},_0x45bb82,_0x1a2ce0[_0x7775('0x56')]);var _0x22268a={'where':_0x45bb82[_0x7775('0x53')]};return db[_0x7775('0x40')][_0x7775('0x33')](_0x22268a)[_0x7775('0x23')](function(_0x4f265c){_0x3a69a0[_0x7775('0x33')]=_0x4f265c;if(_0x1a2ce0[_0x7775('0x46')]['includeAll']){_0x45bb82[_0x7775('0x57')]=[{'all':!![]}];}return db[_0x7775('0x40')][_0x7775('0x58')](_0x45bb82);})[_0x7775('0x23')](function(_0x590f03){_0x3a69a0[_0x7775('0x59')]=_0x590f03;return _0x3a69a0;})[_0x7775('0x23')](respondWithFilteredResult(_0x4dfe77,_0x45bb82))['catch'](handleError(_0x4dfe77,null));};exports[_0x7775('0x5a')]=function(_0x2899db,_0x5f3310){var _0x214bc4={'raw':!![],'where':{'id':_0x2899db[_0x7775('0x5b')]['id']}},_0x1c1dea={};_0x1c1dea[_0x7775('0x45')]=_[_0x7775('0x47')](db[_0x7775('0x40')][_0x7775('0x41')]);_0x1c1dea['query']=_['keys'](_0x2899db[_0x7775('0x46')]);_0x1c1dea[_0x7775('0x48')]=_[_0x7775('0x49')](_0x1c1dea[_0x7775('0x45')],_0x1c1dea[_0x7775('0x46')]);_0x214bc4[_0x7775('0x4a')]=_[_0x7775('0x49')](_0x1c1dea[_0x7775('0x45')],qs[_0x7775('0x4b')](_0x2899db['query'][_0x7775('0x4b')]));_0x214bc4['attributes']=_0x214bc4[_0x7775('0x4a')][_0x7775('0x4c')]?_0x214bc4['attributes']:_0x1c1dea[_0x7775('0x45')];if(_0x2899db[_0x7775('0x46')][_0x7775('0x5c')]){_0x214bc4['include']=[{'all':!![]}];}_0x214bc4=_[_0x7775('0x54')]({},_0x214bc4,_0x2899db[_0x7775('0x56')]);return db[_0x7775('0x40')][_0x7775('0x5d')](_0x214bc4)[_0x7775('0x23')](handleEntityNotFound(_0x5f3310,null))[_0x7775('0x23')](respondWithResult(_0x5f3310,null))[_0x7775('0x5e')](handleError(_0x5f3310,null));};exports[_0x7775('0x5f')]=function(_0x14a323,_0x17fdfa){return db[_0x7775('0x40')]['create'](_0x14a323[_0x7775('0x60')],{})[_0x7775('0x23')](function(_0x142cb4){var _0x46fd10=_0x14a323[_0x7775('0x61')]['get']({'plain':!![]});if(!_0x46fd10)throw new Error(_0x7775('0x62'));if(_0x46fd10[_0x7775('0x63')]===_0x7775('0x61')){var _0x38c1be=_0x142cb4[_0x7775('0x64')]({'plain':!![]});var _0x774e72=_0x7775('0x3a');return db[_0x7775('0x65')][_0x7775('0x5d')]({'where':{'name':_0x774e72,'userProfileId':_0x46fd10['userProfileId']},'raw':!![]})['then'](function(_0x3da737){if(_0x3da737&&_0x3da737['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x38c1be[_0x7775('0x3c')],'resourceId':_0x38c1be['id'],'type':_0x3da737['name'],'sectionId':_0x3da737['id']},{})[_0x7775('0x23')](function(){return _0x142cb4;});}else{return _0x142cb4;}})[_0x7775('0x5e')](function(_0x410cc1){logger[_0x7775('0x2a')](_0x7775('0x66'),_0x410cc1);throw _0x410cc1;});}return _0x142cb4;})[_0x7775('0x23')](respondWithResult(_0x17fdfa,0xc9))['catch'](handleError(_0x17fdfa,null));};exports[_0x7775('0x38')]=function(_0xa1b0db,_0x2ff700){if(_0xa1b0db[_0x7775('0x60')]['id']){delete _0xa1b0db[_0x7775('0x60')]['id'];}return db[_0x7775('0x40')][_0x7775('0x5d')]({'where':{'id':_0xa1b0db['params']['id']}})[_0x7775('0x23')](handleEntityNotFound(_0x2ff700,null))[_0x7775('0x23')](saveUpdates(_0xa1b0db[_0x7775('0x60')],null))[_0x7775('0x23')](respondWithResult(_0x2ff700,null))[_0x7775('0x5e')](handleError(_0x2ff700,null));};exports[_0x7775('0x39')]=function(_0x30fc06,_0x25c2aa){return db[_0x7775('0x40')][_0x7775('0x5d')]({'where':{'id':_0x30fc06[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](handleEntityNotFound(_0x25c2aa,null))['then'](removeEntity(_0x25c2aa,null))[_0x7775('0x5e')](handleError(_0x25c2aa,null));};exports[_0x7775('0x67')]=function(_0x10e794,_0x132548){return db[_0x7775('0x40')][_0x7775('0x67')]()['then'](respondWithResult(_0x132548,null))[_0x7775('0x5e')](handleError(_0x132548,null));};exports['getMembers']=function(_0xe888b7,_0x4dbb69,_0x1a2163){var _0xc051a0={'raw':!![],'where':{}},_0x10eba6={},_0x982264;return db[_0x7775('0x40')][_0x7775('0x68')]({'where':{'id':_0xe888b7[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](handleEntityNotFound(_0x4dbb69,null))['then'](function(_0x50941b){if(_0x50941b){_0x982264=_0x50941b[_0x7775('0x64')]({'plain':!![]});_0x10eba6[_0x7775('0x45')]=_['keys'](db['UserChatQueue'][_0x7775('0x41')]);_0x10eba6[_0x7775('0x46')]=_[_0x7775('0x47')](_0xe888b7[_0x7775('0x46')]);_0x10eba6[_0x7775('0x48')]=_[_0x7775('0x49')](_0x10eba6[_0x7775('0x45')],_0x10eba6[_0x7775('0x46')]);_0xc051a0[_0x7775('0x4a')]=_[_0x7775('0x49')](_0x10eba6[_0x7775('0x45')],qs[_0x7775('0x4b')](_0xe888b7[_0x7775('0x46')]['fields']));_0xc051a0[_0x7775('0x4a')]=_0xc051a0['attributes'][_0x7775('0x4c')]?_0xc051a0['attributes']:_0x10eba6[_0x7775('0x45')];if(!_0xe888b7[_0x7775('0x46')][_0x7775('0x4d')](_0x7775('0x4e'))){_0xc051a0['limit']=qs[_0x7775('0x32')](_0xe888b7[_0x7775('0x46')]['limit']);_0xc051a0['offset']=qs[_0x7775('0x31')](_0xe888b7[_0x7775('0x46')][_0x7775('0x31')]);}_0xc051a0[_0x7775('0x4f')]=qs[_0x7775('0x50')](_0xe888b7[_0x7775('0x46')]['sort']);_0xc051a0['where']=qs['filters'](_[_0x7775('0x51')](_0xe888b7[_0x7775('0x46')],_0x10eba6[_0x7775('0x48')]));_0xc051a0['where']['ChatQueueId']=_0x50941b['id'];if(_0xe888b7[_0x7775('0x46')][_0x7775('0x52')]){_0xc051a0[_0x7775('0x53')]=_[_0x7775('0x54')](_0xc051a0[_0x7775('0x53')],{'$or':_['map'](_0xc051a0[_0x7775('0x4a')],function(_0xe50d87){var _0x443da6={};_0x443da6[_0xe50d87]={'$like':'%'+_0xe888b7['query'][_0x7775('0x52')]+'%'};return _0x443da6;})});}_0xc051a0=_[_0x7775('0x54')]({},_0xc051a0,_0xe888b7['options']);return db[_0x7775('0x69')][_0x7775('0x58')](_0xc051a0);}})['then'](function(_0x49f035){if(_0x49f035){return db[_0x7775('0x6a')][_0x7775('0x6b')]({'where':{'id':_[_0x7775('0x3f')](_0x49f035,_0x7775('0x6c')),'role':_0x7775('0x6d')},'attributes':['id','name',_0x7775('0x6e'),_0x7775('0x6f'),_0x7775('0x70')]});}})[_0x7775('0x23')](function(_0x5774f3){if(_0x5774f3){return{'count':_0x5774f3[_0x7775('0x33')],'rows':_[_0x7775('0x3f')](_0x5774f3['rows'],function(_0x3cbc31){return{'membername':_0x3cbc31[_0x7775('0x3c')],'UserId':_0x3cbc31['id'],'queue_name':_0x982264[_0x7775('0x3c')],'ChatQueueId':_0x982264['id'],'interface':util[_0x7775('0x71')](_0x7775('0x72'),_0x7775('0x73'),_0x3cbc31['name']),'penalty':0x0,'paused':_0x3cbc31[_0x7775('0x6e')],'createdAt':_0x3cbc31[_0x7775('0x70')],'updatedAt':_0x3cbc31[_0x7775('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7775('0x23')](respondWithFilteredResult(_0x4dbb69,_0xc051a0))[_0x7775('0x5e')](handleError(_0x4dbb69,null));};exports[_0x7775('0x74')]=function(_0xa29bf,_0x1044bf,_0x2b186d){var _0x26001f={};var _0x213b4a={};var _0x1aa42c;var _0x105438;return db[_0x7775('0x40')]['findOne']({'where':{'id':_0xa29bf[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](handleEntityNotFound(_0x1044bf,null))[_0x7775('0x23')](function(_0x529940){if(_0x529940){_0x1aa42c=_0x529940;_0x213b4a[_0x7775('0x45')]=_[_0x7775('0x47')](db[_0x7775('0x75')][_0x7775('0x41')]);_0x213b4a[_0x7775('0x46')]=_[_0x7775('0x47')](_0xa29bf[_0x7775('0x46')]);_0x213b4a['filters']=_['intersection'](_0x213b4a['model'],_0x213b4a[_0x7775('0x46')]);_0x26001f[_0x7775('0x4a')]=_[_0x7775('0x49')](_0x213b4a[_0x7775('0x45')],qs['fields'](_0xa29bf[_0x7775('0x46')][_0x7775('0x4b')]));_0x26001f[_0x7775('0x4a')]=_0x26001f[_0x7775('0x4a')][_0x7775('0x4c')]?_0x26001f[_0x7775('0x4a')]:_0x213b4a[_0x7775('0x45')];_0x26001f['order']=qs[_0x7775('0x50')](_0xa29bf[_0x7775('0x46')]['sort']);_0x26001f['where']=qs[_0x7775('0x48')](_[_0x7775('0x51')](_0xa29bf['query'],_0x213b4a[_0x7775('0x48')]));if(_0xa29bf[_0x7775('0x46')][_0x7775('0x52')]){_0x26001f['where']=_['merge'](_0x26001f['where'],{'$or':_[_0x7775('0x3f')](_0x26001f[_0x7775('0x4a')],function(_0x274c9c){var _0x595193={};_0x595193[_0x274c9c]={'$like':'%'+_0xa29bf[_0x7775('0x46')]['filter']+'%'};return _0x595193;})});}_0x26001f=_[_0x7775('0x54')]({},_0x26001f,_0xa29bf[_0x7775('0x56')]);return _0x1aa42c[_0x7775('0x74')](_0x26001f);}})['then'](function(_0x3fcc86){if(_0x3fcc86){_0x105438=_0x3fcc86[_0x7775('0x4c')];if(!_0xa29bf[_0x7775('0x46')]['hasOwnProperty'](_0x7775('0x4e'))){_0x26001f['limit']=qs['limit'](_0xa29bf[_0x7775('0x46')][_0x7775('0x32')]);_0x26001f[_0x7775('0x31')]=qs[_0x7775('0x31')](_0xa29bf[_0x7775('0x46')][_0x7775('0x31')]);}return _0x1aa42c['getTeams'](_0x26001f);}})['then'](function(_0x119de1){if(_0x119de1){return _0x119de1?{'count':_0x105438,'rows':_0x119de1}:null;}})[_0x7775('0x23')](respondWithResult(_0x1044bf,null))[_0x7775('0x5e')](handleError(_0x1044bf,null));};exports['addTeams']=function(_0x5011fc,_0xeec62e,_0x31bb93){var _0x4dad75=_0x5011fc[_0x7775('0x60')][_0x7775('0x76')];return db['Team'][_0x7775('0x58')]({'where':{'id':_0x4dad75},'attributes':['id'],'include':[{'model':db[_0x7775('0x6a')],'as':_0x7775('0x77'),'attributes':['id',_0x7775('0x3c'),_0x7775('0x78'),_0x7775('0x79'),_0x7775('0x7a')],'raw':!![]}]})[_0x7775('0x23')](function(_0x3ebb09){if(_0x3ebb09){var _0x4dae19=_[_0x7775('0x7b')](_0x3ebb09,function(_0x3c81ca){var _0x5cb556=_0x3c81ca[_0x7775('0x64')]({'plain':!![]});return _0x5cb556[_0x7775('0x77')];});return db[_0x7775('0x40')][_0x7775('0x5d')]({'where':{'id':_0x5011fc[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](function(_0x3b3e68){return db[_0x7775('0x7c')]['transaction'](function(_0x39d8bc){return _0x3b3e68[_0x7775('0x7d')](_0x4dad75,{'transaction':_0x39d8bc})[_0x7775('0x23')](function(){return BPromise[_0x7775('0x7e')](_0x4dae19,function(_0x448229){return db[_0x7775('0x69')][_0x7775('0x7f')]({'where':{'UserId':_0x448229['id'],'ChatQueueId':_0x5011fc[_0x7775('0x5b')]['id']},'transaction':_0x39d8bc});});})['then'](function(){_0x4dae19[_0x7775('0x80')](function(_0x1613cc){socket[_0x7775('0x81')](_0x7775('0x82'),{'UserId':_0x1613cc['id'],'ChatQueueId':_0x3b3e68['id']});});});});});}})[_0x7775('0x23')](respondWithStatusCode(_0xeec62e,null))['catch'](handleError(_0xeec62e,null));};exports[_0x7775('0x83')]=function(_0x2939b0,_0xdafde0,_0x40bed0){return db[_0x7775('0x75')][_0x7775('0x58')]({'where':{'id':_0x2939b0[_0x7775('0x46')][_0x7775('0x76')]},'attributes':['id'],'include':[{'model':db[_0x7775('0x6a')],'as':_0x7775('0x77'),'attributes':['id'],'raw':!![]}]})[_0x7775('0x23')](handleEntityNotFound(_0xdafde0,null))['then'](function(_0x1faa73){var _0x1b274a=_[_0x7775('0x3f')](_0x1faa73,'id');var _0x37d582=[];var _0x30210d=[];var _0x53c5c2=squel['select']();_0x53c5c2[_0x7775('0x84')](_0x7775('0x85'))[_0x7775('0x86')](_0x7775('0x87'),'tq')[_0x7775('0x88')](_0x7775('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7775('0x53')](_0x7775('0x8a'),_0x2939b0[_0x7775('0x5b')]['id']);for(var _0x5590fc=0x0;_0x5590fc<_0x1faa73[_0x7775('0x4c')];_0x5590fc+=0x1){let _0x55d2d2=_0x1faa73[_0x5590fc];for(var _0x67cbb9=0x0;_0x67cbb9<_0x55d2d2[_0x7775('0x77')][_0x7775('0x4c')];_0x67cbb9+=0x1){let _0x3dabf7=_0x55d2d2[_0x7775('0x77')][_0x67cbb9];var _0x10f7af=_0x53c5c2['clone']();_0x10f7af[_0x7775('0x53')](_0x7775('0x8b'),_0x3dabf7['id']);_0x30210d['push'](db[_0x7775('0x7c')][_0x7775('0x46')](_0x10f7af[_0x7775('0x8c')](),{'type':db[_0x7775('0x7c')][_0x7775('0x8d')][_0x7775('0x8e')]})[_0x7775('0x23')](function(_0x33cd6f){if(_0x33cd6f['length']===0x1){return _0x3dabf7['id'];}else{var _0x248b87=_[_0x7775('0x8f')](_[_0x7775('0x3f')](_0x33cd6f,_0x7775('0x90')),function(_0x273345){return _[_0x7775('0x91')](_0x1b274a,_0x273345);});if(_0x248b87){return _0x3dabf7['id'];}}}));}}return BPromise[_0x7775('0x92')](_0x30210d)[_0x7775('0x23')](function(_0x30de88){_0x37d582=_(_0x37d582)[_0x7775('0x93')](_0x30de88)[_0x7775('0x94')]()[_0x7775('0x95')]();return db[_0x7775('0x40')][_0x7775('0x5d')]({'where':{'id':_0x2939b0[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](function(_0x5ca750){return db[_0x7775('0x7c')][_0x7775('0x96')](function(_0xcf1f85){return _0x5ca750[_0x7775('0x83')](_0x2939b0['query']['ids'],{'transaction':_0xcf1f85})[_0x7775('0x23')](function(){if(!_[_0x7775('0x97')](_0x37d582)){return _0x5ca750[_0x7775('0x98')](_0x37d582,{'transaction':_0xcf1f85});}})[_0x7775('0x23')](function(){_0x37d582[_0x7775('0x80')](function(_0x597080){socket[_0x7775('0x81')](_0x7775('0x99'),{'UserId':_0x597080,'ChatQueueId':_0x5ca750['id']});});});});});});})[_0x7775('0x23')](respondWithStatusCode(_0xdafde0,null))[_0x7775('0x5e')](handleError(_0xdafde0,null));};exports[_0x7775('0x9a')]=function(_0x1e949d,_0x5dab76,_0x81f90f){return db['ChatQueue'][_0x7775('0x5d')]({'where':{'id':_0x1e949d[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](handleEntityNotFound(_0x5dab76,null))[_0x7775('0x23')](function(_0x142d2c){if(_0x142d2c){return _0x142d2c[_0x7775('0x9a')](_0x1e949d[_0x7775('0x60')][_0x7775('0x76')],_[_0x7775('0x9b')](_0x1e949d[_0x7775('0x60')],['ids','id'])||{})['spread'](function(_0x312007){for(var _0x570a26=0x0;_0x570a26<_0x1e949d[_0x7775('0x60')]['ids'][_0x7775('0x4c')];_0x570a26+=0x1){socket[_0x7775('0x81')]('userChatQueue:save',{'UserId':Number(_0x1e949d[_0x7775('0x60')][_0x7775('0x76')][_0x570a26]),'ChatQueueId':Number(_0x1e949d['params']['id'])});}return _0x312007;});}})['then'](respondWithResult(_0x5dab76,null))[_0x7775('0x5e')](handleError(_0x5dab76,null));};exports[_0x7775('0x98')]=function(_0x139d19,_0x11298b,_0x66aedb){return db[_0x7775('0x40')]['find']({'where':{'id':_0x139d19[_0x7775('0x5b')]['id']}})['then'](handleEntityNotFound(_0x11298b,null))['then'](function(_0x3c5393){if(_0x3c5393){return _0x3c5393[_0x7775('0x98')](_0x139d19[_0x7775('0x46')][_0x7775('0x76')])[_0x7775('0x23')](function(){if(_['isArray'](_0x139d19[_0x7775('0x46')][_0x7775('0x76')])){for(var _0x12795b=0x0;_0x12795b<_0x139d19[_0x7775('0x46')][_0x7775('0x76')][_0x7775('0x4c')];_0x12795b+=0x1){socket['emit'](_0x7775('0x99'),{'UserId':Number(_0x139d19[_0x7775('0x46')][_0x7775('0x76')][_0x12795b]),'ChatQueueId':Number(_0x139d19[_0x7775('0x5b')]['id'])});}}else{socket['emit'](_0x7775('0x99'),{'UserId':Number(_0x139d19[_0x7775('0x46')][_0x7775('0x76')]),'ChatQueueId':Number(_0x139d19[_0x7775('0x5b')]['id'])});}});}})[_0x7775('0x23')](respondWithStatusCode(_0x11298b,null))[_0x7775('0x5e')](handleError(_0x11298b,null));};exports['getAgents']=function(_0x55b838,_0x20630c,_0x493168){var _0xcc37ee={};var _0x1ce2fb={};var _0x323259;var _0x4f48cd;return db[_0x7775('0x40')][_0x7775('0x68')]({'where':{'id':_0x55b838[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](handleEntityNotFound(_0x20630c,null))[_0x7775('0x23')](function(_0x2fe2e7){if(_0x2fe2e7){_0x323259=_0x2fe2e7;_0x1ce2fb[_0x7775('0x45')]=_[_0x7775('0x47')](db[_0x7775('0x6a')][_0x7775('0x41')]);_0x1ce2fb[_0x7775('0x46')]=_[_0x7775('0x47')](_0x55b838['query']);_0x1ce2fb[_0x7775('0x48')]=_[_0x7775('0x49')](_0x1ce2fb['model'],_0x1ce2fb[_0x7775('0x46')]);_0xcc37ee[_0x7775('0x4a')]=_[_0x7775('0x49')](_0x1ce2fb[_0x7775('0x45')],qs[_0x7775('0x4b')](_0x55b838['query'][_0x7775('0x4b')]));_0xcc37ee['attributes']=_0xcc37ee[_0x7775('0x4a')][_0x7775('0x4c')]?_0xcc37ee[_0x7775('0x4a')]:_0x1ce2fb['model'];_0xcc37ee[_0x7775('0x4f')]=qs[_0x7775('0x50')](_0x55b838[_0x7775('0x46')][_0x7775('0x50')]);_0xcc37ee[_0x7775('0x53')]=qs[_0x7775('0x48')](_[_0x7775('0x51')](_0x55b838[_0x7775('0x46')],_0x1ce2fb[_0x7775('0x48')]));if(_0x55b838['query'][_0x7775('0x52')]){_0xcc37ee[_0x7775('0x53')]=_[_0x7775('0x54')](_0xcc37ee['where'],{'$or':_[_0x7775('0x3f')](_0xcc37ee[_0x7775('0x4a')],function(_0x500579){var _0x1c5f6={};_0x1c5f6[_0x500579]={'$like':'%'+_0x55b838[_0x7775('0x46')][_0x7775('0x52')]+'%'};return _0x1c5f6;})});}_0xcc37ee=_[_0x7775('0x54')]({},_0xcc37ee,_0x55b838[_0x7775('0x56')]);return _0x323259[_0x7775('0x9c')](_0xcc37ee);}})[_0x7775('0x23')](function(_0x3ee2f6){if(_0x3ee2f6){_0x4f48cd=_0x3ee2f6['length'];if(!_0x55b838[_0x7775('0x46')][_0x7775('0x4d')](_0x7775('0x4e'))){_0xcc37ee[_0x7775('0x32')]=qs['limit'](_0x55b838[_0x7775('0x46')]['limit']);_0xcc37ee[_0x7775('0x31')]=qs['offset'](_0x55b838[_0x7775('0x46')][_0x7775('0x31')]);}return _0x323259[_0x7775('0x9c')](_0xcc37ee);}})['then'](function(_0xd62005){if(_0xd62005){return _0xd62005?{'count':_0x4f48cd,'rows':_0xd62005}:null;}})[_0x7775('0x23')](respondWithResult(_0x20630c,null))[_0x7775('0x5e')](handleError(_0x20630c,null));}; \ No newline at end of file +var _0xb0a5=['fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','order','ChatQueueId','findAll','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','findOne','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','all','union','removeAgents','addAgents','spread','userChatQueue:remove','getAgents','fast-json-patch','request-promise','bluebird','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x1296f0,_0x4331c3){var _0x4b2a0f=function(_0x316f53){while(--_0x316f53){_0x1296f0['push'](_0x1296f0['shift']());}};_0x4b2a0f(++_0x4331c3);}(_0xb0a5,0x1e3));var _0x5b0a=function(_0x5d160,_0xa4838e){_0x5d160=_0x5d160-0x0;var _0x1d180d=_0xb0a5[_0x5d160];return _0x1d180d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5b0a('0x0'));var rp=require(_0x5b0a('0x1'));var moment=require('moment');var BPromise=require(_0x5b0a('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5b0a('0x3'));var sox=require('sox');var csv=require(_0x5b0a('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b0a('0x5'));var _=require('lodash');var squel=require(_0x5b0a('0x6'));var crypto=require('crypto');var jsforce=require(_0x5b0a('0x7'));var deskjs=require(_0x5b0a('0x8'));var toCsv=require(_0x5b0a('0x4'));var querystring=require(_0x5b0a('0x9'));var Papa=require(_0x5b0a('0xa'));var Redis=require(_0x5b0a('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x5b0a('0xc'));var as=require(_0x5b0a('0xd'));var hardwareService=require(_0x5b0a('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x5b0a('0xf'));var config=require(_0x5b0a('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b0a('0x11'))['db'];config[_0x5b0a('0x12')]=_[_0x5b0a('0x13')](config[_0x5b0a('0x12')],{'host':_0x5b0a('0x14'),'port':0x18eb});var socket=require(_0x5b0a('0x15'))(new Redis(config['redis']));require(_0x5b0a('0x16'))['register'](socket);var jayson=require(_0x5b0a('0x17'));var client=jayson[_0x5b0a('0x18')][_0x5b0a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x212794,_0x47557e,_0x5dee57,_0x1630ac){return new BPromise(function(_0x37ebdf,_0x43f620){var _0x43253b=_0x1630ac||client;return _0x43253b[_0x5b0a('0x1a')](_0x212794,_0x5dee57)['then'](function(_0x4aa8af){logger['info'](_0x5b0a('0x1b'),_0x47557e,_0x5b0a('0x1c'));logger[_0x5b0a('0x1d')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x47557e,_0x5b0a('0x1c'),JSON[_0x5b0a('0x1e')](_0x4aa8af));if(_0x4aa8af[_0x5b0a('0x1f')]){if(_0x4aa8af[_0x5b0a('0x1f')]['code']===0x1f4){logger[_0x5b0a('0x1f')]('ChatQueue,\x20%s,\x20%s',_0x47557e,_0x4aa8af[_0x5b0a('0x1f')]['message']);return _0x43f620(_0x4aa8af['error'][_0x5b0a('0x20')]);}logger[_0x5b0a('0x1f')](_0x5b0a('0x1b'),_0x47557e,_0x4aa8af['error'][_0x5b0a('0x20')]);return _0x37ebdf(_0x4aa8af['error'][_0x5b0a('0x20')]);}else{logger[_0x5b0a('0x21')](_0x5b0a('0x1b'),_0x47557e,_0x5b0a('0x1c'));_0x37ebdf(_0x4aa8af[_0x5b0a('0x22')][_0x5b0a('0x20')]);}})['catch'](function(_0x595113){logger[_0x5b0a('0x1f')](_0x5b0a('0x1b'),_0x47557e,_0x595113);_0x43f620(_0x595113);});});}function respondWithStatusCode(_0x2a3c5d,_0x4701e9){_0x4701e9=_0x4701e9||0xcc;return function(_0xacb9aa){if(_0xacb9aa){return _0x2a3c5d[_0x5b0a('0x23')](_0x4701e9);}return _0x2a3c5d[_0x5b0a('0x24')](_0x4701e9)['end']();};}function respondWithResult(_0x3dc282,_0x5e4a9e){_0x5e4a9e=_0x5e4a9e||0xc8;return function(_0x46d685){if(_0x46d685){return _0x3dc282[_0x5b0a('0x24')](_0x5e4a9e)[_0x5b0a('0x25')](_0x46d685);}};}function respondWithFilteredResult(_0x586861,_0x418ad1){return function(_0x2bc069){if(_0x2bc069){var _0x466d0d=typeof _0x418ad1[_0x5b0a('0x26')]===_0x5b0a('0x27')&&typeof _0x418ad1['limit']===_0x5b0a('0x27');var _0xb07541=_0x2bc069[_0x5b0a('0x28')];var _0x5e995c=_0x466d0d?0x0:_0x418ad1[_0x5b0a('0x26')];var _0x1b422e=_0x466d0d?_0x2bc069[_0x5b0a('0x28')]:_0x418ad1['offset']+_0x418ad1[_0x5b0a('0x29')];var _0x40b380;if(_0x1b422e>=_0xb07541){_0x1b422e=_0xb07541;_0x40b380=0xc8;}else{_0x40b380=0xce;}_0x586861[_0x5b0a('0x24')](_0x40b380);return _0x586861['set'](_0x5b0a('0x2a'),_0x5e995c+'-'+_0x1b422e+'/'+_0xb07541)[_0x5b0a('0x25')](_0x2bc069);}return null;};}function patchUpdates(_0x2e9916){return function(_0x21d964){try{jsonpatch['apply'](_0x21d964,_0x2e9916,!![]);}catch(_0xead213){return BPromise[_0x5b0a('0x2b')](_0xead213);}return _0x21d964[_0x5b0a('0x2c')]();};}function saveUpdates(_0x1df966,_0x18d91e){return function(_0x21d0f8){if(_0x21d0f8){return _0x21d0f8[_0x5b0a('0x2d')](_0x1df966)[_0x5b0a('0x2e')](function(_0x523635){return _0x523635;});}return null;};}function removeEntity(_0x56f0bf,_0x513930){return function(_0x2e2189){if(_0x2e2189){return _0x2e2189[_0x5b0a('0x2f')]()[_0x5b0a('0x2e')](function(){var _0x5099b7=_0x2e2189[_0x5b0a('0x30')]({'plain':!![]});var _0x421af2=_0x5b0a('0x31');return db[_0x5b0a('0x32')][_0x5b0a('0x2f')]({'where':{'type':_0x421af2,'resourceId':_0x5099b7['id']}})[_0x5b0a('0x2e')](function(){return _0x2e2189;});})[_0x5b0a('0x2e')](function(){_0x56f0bf[_0x5b0a('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5acb63,_0xa4d8c0){return function(_0x15191a){if(!_0x15191a){_0x5acb63[_0x5b0a('0x23')](0x194);}return _0x15191a;};}function handleError(_0x38d47e,_0xcef7ea){_0xcef7ea=_0xcef7ea||0x1f4;return function(_0x2f01b1){logger[_0x5b0a('0x1f')](_0x2f01b1['stack']);if(_0x2f01b1[_0x5b0a('0x33')]){delete _0x2f01b1[_0x5b0a('0x33')];}_0x38d47e[_0x5b0a('0x24')](_0xcef7ea)[_0x5b0a('0x34')](_0x2f01b1);};}exports[_0x5b0a('0x35')]=function(_0x41f746,_0x1ce2cd){var _0x7927c4={},_0x3b0fc5={},_0x266b94={'count':0x0,'rows':[]};var _0x3efc54=_[_0x5b0a('0x36')](db[_0x5b0a('0x37')][_0x5b0a('0x38')],function(_0x3a7cdc){return{'name':_0x3a7cdc[_0x5b0a('0x39')],'type':_0x3a7cdc[_0x5b0a('0x3a')]['key']};});_0x3b0fc5[_0x5b0a('0x3b')]=_[_0x5b0a('0x36')](_0x3efc54,'name');_0x3b0fc5[_0x5b0a('0x3c')]=_[_0x5b0a('0x3d')](_0x41f746[_0x5b0a('0x3c')]);_0x3b0fc5[_0x5b0a('0x3e')]=_[_0x5b0a('0x3f')](_0x3b0fc5['model'],_0x3b0fc5[_0x5b0a('0x3c')]);_0x7927c4[_0x5b0a('0x40')]=_[_0x5b0a('0x3f')](_0x3b0fc5[_0x5b0a('0x3b')],qs[_0x5b0a('0x41')](_0x41f746[_0x5b0a('0x3c')][_0x5b0a('0x41')]));_0x7927c4[_0x5b0a('0x40')]=_0x7927c4[_0x5b0a('0x40')][_0x5b0a('0x42')]?_0x7927c4[_0x5b0a('0x40')]:_0x3b0fc5[_0x5b0a('0x3b')];if(!_0x41f746[_0x5b0a('0x3c')][_0x5b0a('0x43')](_0x5b0a('0x44'))){_0x7927c4['limit']=qs[_0x5b0a('0x29')](_0x41f746[_0x5b0a('0x3c')][_0x5b0a('0x29')]);_0x7927c4['offset']=qs[_0x5b0a('0x26')](_0x41f746['query']['offset']);}_0x7927c4['order']=qs[_0x5b0a('0x45')](_0x41f746[_0x5b0a('0x3c')]['sort']);_0x7927c4[_0x5b0a('0x46')]=qs[_0x5b0a('0x3e')](_[_0x5b0a('0x47')](_0x41f746['query'],_0x3b0fc5[_0x5b0a('0x3e')]),_0x3efc54);if(_0x41f746[_0x5b0a('0x3c')]['filter']){_0x7927c4[_0x5b0a('0x46')]=_[_0x5b0a('0x48')](_0x7927c4[_0x5b0a('0x46')],{'$or':_[_0x5b0a('0x36')](_0x3efc54,function(_0x1b2edc){if(_0x1b2edc[_0x5b0a('0x3a')]!==_0x5b0a('0x49')){var _0x27d83a={};_0x27d83a[_0x1b2edc[_0x5b0a('0x33')]]={'$like':'%'+_0x41f746['query'][_0x5b0a('0x4a')]+'%'};return _0x27d83a;}})});}_0x7927c4=_[_0x5b0a('0x48')]({},_0x7927c4,_0x41f746[_0x5b0a('0x4b')]);var _0x2f3696={'where':_0x7927c4['where']};return db['ChatQueue'][_0x5b0a('0x28')](_0x2f3696)[_0x5b0a('0x2e')](function(_0x27f47f){_0x266b94['count']=_0x27f47f;if(_0x41f746[_0x5b0a('0x3c')][_0x5b0a('0x4c')]){_0x7927c4[_0x5b0a('0x4d')]=[{'all':!![]}];}return db[_0x5b0a('0x37')]['findAll'](_0x7927c4);})[_0x5b0a('0x2e')](function(_0x37fb99){_0x266b94[_0x5b0a('0x4e')]=_0x37fb99;return _0x266b94;})[_0x5b0a('0x2e')](respondWithFilteredResult(_0x1ce2cd,_0x7927c4))[_0x5b0a('0x4f')](handleError(_0x1ce2cd,null));};exports[_0x5b0a('0x50')]=function(_0x8f23cf,_0x562c0f){var _0x292ab9={'raw':!![],'where':{'id':_0x8f23cf[_0x5b0a('0x51')]['id']}},_0x3e688d={};_0x3e688d[_0x5b0a('0x3b')]=_[_0x5b0a('0x3d')](db[_0x5b0a('0x37')]['rawAttributes']);_0x3e688d[_0x5b0a('0x3c')]=_[_0x5b0a('0x3d')](_0x8f23cf[_0x5b0a('0x3c')]);_0x3e688d[_0x5b0a('0x3e')]=_[_0x5b0a('0x3f')](_0x3e688d[_0x5b0a('0x3b')],_0x3e688d[_0x5b0a('0x3c')]);_0x292ab9[_0x5b0a('0x40')]=_['intersection'](_0x3e688d[_0x5b0a('0x3b')],qs['fields'](_0x8f23cf[_0x5b0a('0x3c')]['fields']));_0x292ab9['attributes']=_0x292ab9[_0x5b0a('0x40')][_0x5b0a('0x42')]?_0x292ab9[_0x5b0a('0x40')]:_0x3e688d[_0x5b0a('0x3b')];if(_0x8f23cf[_0x5b0a('0x3c')][_0x5b0a('0x4c')]){_0x292ab9[_0x5b0a('0x4d')]=[{'all':!![]}];}_0x292ab9=_[_0x5b0a('0x48')]({},_0x292ab9,_0x8f23cf[_0x5b0a('0x4b')]);return db['ChatQueue'][_0x5b0a('0x52')](_0x292ab9)[_0x5b0a('0x2e')](handleEntityNotFound(_0x562c0f,null))[_0x5b0a('0x2e')](respondWithResult(_0x562c0f,null))[_0x5b0a('0x4f')](handleError(_0x562c0f,null));};exports[_0x5b0a('0x53')]=function(_0x1a247c,_0x289954){return db['ChatQueue']['create'](_0x1a247c[_0x5b0a('0x54')],{})[_0x5b0a('0x2e')](function(_0x598da2){var _0x40b3ba=_0x1a247c[_0x5b0a('0x55')][_0x5b0a('0x30')]({'plain':!![]});if(!_0x40b3ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40b3ba[_0x5b0a('0x56')]===_0x5b0a('0x55')){var _0x45bd49=_0x598da2[_0x5b0a('0x30')]({'plain':!![]});var _0x1df356=_0x5b0a('0x31');return db['UserProfileSection']['find']({'where':{'name':_0x1df356,'userProfileId':_0x40b3ba[_0x5b0a('0x57')]},'raw':!![]})[_0x5b0a('0x2e')](function(_0x2bdc20){if(_0x2bdc20&&_0x2bdc20['autoAssociation']===0x0){return db['UserProfileResource'][_0x5b0a('0x53')]({'name':_0x45bd49['name'],'resourceId':_0x45bd49['id'],'type':_0x2bdc20[_0x5b0a('0x33')],'sectionId':_0x2bdc20['id']},{})['then'](function(){return _0x598da2;});}else{return _0x598da2;}})['catch'](function(_0x10d297){logger['error'](_0x5b0a('0x58'),_0x10d297);throw _0x10d297;});}return _0x598da2;})[_0x5b0a('0x2e')](respondWithResult(_0x289954,0xc9))[_0x5b0a('0x4f')](handleError(_0x289954,null));};exports[_0x5b0a('0x2d')]=function(_0x4490c7,_0xf4cd05){if(_0x4490c7[_0x5b0a('0x54')]['id']){delete _0x4490c7[_0x5b0a('0x54')]['id'];}return db['ChatQueue'][_0x5b0a('0x52')]({'where':{'id':_0x4490c7['params']['id']}})[_0x5b0a('0x2e')](handleEntityNotFound(_0xf4cd05,null))[_0x5b0a('0x2e')](saveUpdates(_0x4490c7[_0x5b0a('0x54')],null))['then'](respondWithResult(_0xf4cd05,null))[_0x5b0a('0x4f')](handleError(_0xf4cd05,null));};exports[_0x5b0a('0x2f')]=function(_0x5b2210,_0x4704f4){return db[_0x5b0a('0x37')]['find']({'where':{'id':_0x5b2210[_0x5b0a('0x51')]['id']}})['then'](handleEntityNotFound(_0x4704f4,null))['then'](removeEntity(_0x4704f4,null))[_0x5b0a('0x4f')](handleError(_0x4704f4,null));};exports[_0x5b0a('0x59')]=function(_0x3fa50a,_0x4e7346){return db[_0x5b0a('0x37')]['describe']()[_0x5b0a('0x2e')](respondWithResult(_0x4e7346,null))[_0x5b0a('0x4f')](handleError(_0x4e7346,null));};exports[_0x5b0a('0x5a')]=function(_0x56a4c7,_0x39c6ed,_0x21a5e6){var _0x258b0e={'raw':!![],'where':{}},_0x1df42f={},_0x349556;return db[_0x5b0a('0x37')]['findOne']({'where':{'id':_0x56a4c7[_0x5b0a('0x51')]['id']}})['then'](handleEntityNotFound(_0x39c6ed,null))[_0x5b0a('0x2e')](function(_0x2e89d2){if(_0x2e89d2){_0x349556=_0x2e89d2[_0x5b0a('0x30')]({'plain':!![]});_0x1df42f[_0x5b0a('0x3b')]=_[_0x5b0a('0x3d')](db[_0x5b0a('0x5b')][_0x5b0a('0x38')]);_0x1df42f['query']=_[_0x5b0a('0x3d')](_0x56a4c7[_0x5b0a('0x3c')]);_0x1df42f[_0x5b0a('0x3e')]=_[_0x5b0a('0x3f')](_0x1df42f[_0x5b0a('0x3b')],_0x1df42f[_0x5b0a('0x3c')]);_0x258b0e[_0x5b0a('0x40')]=_[_0x5b0a('0x3f')](_0x1df42f[_0x5b0a('0x3b')],qs[_0x5b0a('0x41')](_0x56a4c7[_0x5b0a('0x3c')][_0x5b0a('0x41')]));_0x258b0e[_0x5b0a('0x40')]=_0x258b0e[_0x5b0a('0x40')][_0x5b0a('0x42')]?_0x258b0e[_0x5b0a('0x40')]:_0x1df42f[_0x5b0a('0x3b')];if(!_0x56a4c7[_0x5b0a('0x3c')][_0x5b0a('0x43')]('nolimit')){_0x258b0e['limit']=qs[_0x5b0a('0x29')](_0x56a4c7[_0x5b0a('0x3c')]['limit']);_0x258b0e[_0x5b0a('0x26')]=qs[_0x5b0a('0x26')](_0x56a4c7[_0x5b0a('0x3c')][_0x5b0a('0x26')]);}_0x258b0e[_0x5b0a('0x5c')]=qs[_0x5b0a('0x45')](_0x56a4c7[_0x5b0a('0x3c')]['sort']);_0x258b0e[_0x5b0a('0x46')]=qs['filters'](_[_0x5b0a('0x47')](_0x56a4c7['query'],_0x1df42f[_0x5b0a('0x3e')]));_0x258b0e[_0x5b0a('0x46')][_0x5b0a('0x5d')]=_0x2e89d2['id'];if(_0x56a4c7['query'][_0x5b0a('0x4a')]){_0x258b0e['where']=_[_0x5b0a('0x48')](_0x258b0e['where'],{'$or':_[_0x5b0a('0x36')](_0x258b0e[_0x5b0a('0x40')],function(_0x2db562){var _0x41db0d={};_0x41db0d[_0x2db562]={'$like':'%'+_0x56a4c7[_0x5b0a('0x3c')][_0x5b0a('0x4a')]+'%'};return _0x41db0d;})});}_0x258b0e=_[_0x5b0a('0x48')]({},_0x258b0e,_0x56a4c7[_0x5b0a('0x4b')]);return db[_0x5b0a('0x5b')][_0x5b0a('0x5e')](_0x258b0e);}})['then'](function(_0x4e064c){if(_0x4e064c){return db[_0x5b0a('0x5f')][_0x5b0a('0x60')]({'where':{'id':_[_0x5b0a('0x36')](_0x4e064c,'UserId'),'role':_0x5b0a('0x61')},'attributes':['id',_0x5b0a('0x33'),_0x5b0a('0x62'),_0x5b0a('0x63'),_0x5b0a('0x64')]});}})[_0x5b0a('0x2e')](function(_0x5b9dc1){if(_0x5b9dc1){return{'count':_0x5b9dc1[_0x5b0a('0x28')],'rows':_['map'](_0x5b9dc1[_0x5b0a('0x4e')],function(_0x1a3f4a){return{'membername':_0x1a3f4a[_0x5b0a('0x33')],'UserId':_0x1a3f4a['id'],'queue_name':_0x349556[_0x5b0a('0x33')],'ChatQueueId':_0x349556['id'],'interface':util['format'](_0x5b0a('0x65'),_0x5b0a('0x66'),_0x1a3f4a['name']),'penalty':0x0,'paused':_0x1a3f4a['chatPause'],'createdAt':_0x1a3f4a[_0x5b0a('0x64')],'updatedAt':_0x1a3f4a[_0x5b0a('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5b0a('0x2e')](respondWithFilteredResult(_0x39c6ed,_0x258b0e))[_0x5b0a('0x4f')](handleError(_0x39c6ed,null));};exports['getTeams']=function(_0x2ec51b,_0x2d572f,_0x2288fe){var _0x2f525d={};var _0x86293={};var _0x5d92fb;var _0x25fb9e;return db['ChatQueue'][_0x5b0a('0x67')]({'where':{'id':_0x2ec51b['params']['id']}})[_0x5b0a('0x2e')](handleEntityNotFound(_0x2d572f,null))['then'](function(_0x2d65c5){if(_0x2d65c5){_0x5d92fb=_0x2d65c5;_0x86293[_0x5b0a('0x3b')]=_[_0x5b0a('0x3d')](db['Team'][_0x5b0a('0x38')]);_0x86293['query']=_[_0x5b0a('0x3d')](_0x2ec51b['query']);_0x86293['filters']=_['intersection'](_0x86293[_0x5b0a('0x3b')],_0x86293['query']);_0x2f525d['attributes']=_[_0x5b0a('0x3f')](_0x86293[_0x5b0a('0x3b')],qs[_0x5b0a('0x41')](_0x2ec51b[_0x5b0a('0x3c')][_0x5b0a('0x41')]));_0x2f525d['attributes']=_0x2f525d[_0x5b0a('0x40')]['length']?_0x2f525d[_0x5b0a('0x40')]:_0x86293[_0x5b0a('0x3b')];_0x2f525d[_0x5b0a('0x5c')]=qs[_0x5b0a('0x45')](_0x2ec51b['query'][_0x5b0a('0x45')]);_0x2f525d[_0x5b0a('0x46')]=qs[_0x5b0a('0x3e')](_['pick'](_0x2ec51b[_0x5b0a('0x3c')],_0x86293[_0x5b0a('0x3e')]));if(_0x2ec51b[_0x5b0a('0x3c')][_0x5b0a('0x4a')]){_0x2f525d['where']=_[_0x5b0a('0x48')](_0x2f525d['where'],{'$or':_[_0x5b0a('0x36')](_0x2f525d[_0x5b0a('0x40')],function(_0x3d70b5){var _0x2d0f38={};_0x2d0f38[_0x3d70b5]={'$like':'%'+_0x2ec51b[_0x5b0a('0x3c')][_0x5b0a('0x4a')]+'%'};return _0x2d0f38;})});}_0x2f525d=_[_0x5b0a('0x48')]({},_0x2f525d,_0x2ec51b['options']);return _0x5d92fb[_0x5b0a('0x68')](_0x2f525d);}})[_0x5b0a('0x2e')](function(_0x3a20d2){if(_0x3a20d2){_0x25fb9e=_0x3a20d2[_0x5b0a('0x42')];if(!_0x2ec51b[_0x5b0a('0x3c')]['hasOwnProperty']('nolimit')){_0x2f525d[_0x5b0a('0x29')]=qs[_0x5b0a('0x29')](_0x2ec51b[_0x5b0a('0x3c')]['limit']);_0x2f525d[_0x5b0a('0x26')]=qs[_0x5b0a('0x26')](_0x2ec51b['query'][_0x5b0a('0x26')]);}return _0x5d92fb[_0x5b0a('0x68')](_0x2f525d);}})['then'](function(_0x1b3acd){if(_0x1b3acd){return _0x1b3acd?{'count':_0x25fb9e,'rows':_0x1b3acd}:null;}})['then'](respondWithResult(_0x2d572f,null))[_0x5b0a('0x4f')](handleError(_0x2d572f,null));};exports[_0x5b0a('0x69')]=function(_0x2c5b4c,_0xf7472a,_0x257924){var _0x56da7e=_0x2c5b4c[_0x5b0a('0x54')][_0x5b0a('0x6a')];return db[_0x5b0a('0x6b')][_0x5b0a('0x5e')]({'where':{'id':_0x56da7e},'attributes':['id'],'include':[{'model':db[_0x5b0a('0x5f')],'as':_0x5b0a('0x6c'),'attributes':['id',_0x5b0a('0x33'),_0x5b0a('0x6d'),_0x5b0a('0x6e'),_0x5b0a('0x6f')],'raw':!![]}]})[_0x5b0a('0x2e')](function(_0x45f724){if(_0x45f724){var _0x206265=_[_0x5b0a('0x70')](_0x45f724,function(_0xb9b775){var _0x294495=_0xb9b775['get']({'plain':!![]});return _0x294495[_0x5b0a('0x6c')];});return db[_0x5b0a('0x37')][_0x5b0a('0x52')]({'where':{'id':_0x2c5b4c[_0x5b0a('0x51')]['id']}})[_0x5b0a('0x2e')](function(_0x4500f3){return db[_0x5b0a('0x71')][_0x5b0a('0x72')](function(_0x1e2b1b){return _0x4500f3[_0x5b0a('0x69')](_0x56da7e,{'transaction':_0x1e2b1b})['then'](function(){return BPromise['each'](_0x206265,function(_0x312e89){return db[_0x5b0a('0x5b')][_0x5b0a('0x73')]({'where':{'UserId':_0x312e89['id'],'ChatQueueId':_0x2c5b4c[_0x5b0a('0x51')]['id']},'transaction':_0x1e2b1b});});})['then'](function(){_0x206265[_0x5b0a('0x74')](function(_0x44ad98){socket[_0x5b0a('0x75')](_0x5b0a('0x76'),{'UserId':_0x44ad98['id'],'ChatQueueId':_0x4500f3['id']});});});});});}})['then'](respondWithStatusCode(_0xf7472a,null))[_0x5b0a('0x4f')](handleError(_0xf7472a,null));};exports[_0x5b0a('0x77')]=function(_0x13aaca,_0x59a310,_0x22435c){return db[_0x5b0a('0x6b')][_0x5b0a('0x5e')]({'where':{'id':_0x13aaca[_0x5b0a('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5b0a('0x5f')],'as':_0x5b0a('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x5b0a('0x2e')](handleEntityNotFound(_0x59a310,null))[_0x5b0a('0x2e')](function(_0x326195){var _0x37a1c4=_[_0x5b0a('0x36')](_0x326195,'id');var _0x3c6db8=[];var _0x170179=[];var _0x453e06=squel[_0x5b0a('0x78')]();_0x453e06[_0x5b0a('0x79')](_0x5b0a('0x7a'))['from']('team_has_chat_queues','tq')['join'](_0x5b0a('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5b0a('0x46')](_0x5b0a('0x7c'),_0x13aaca[_0x5b0a('0x51')]['id']);for(var _0x2cb6f7=0x0;_0x2cb6f7<_0x326195['length'];_0x2cb6f7+=0x1){let _0x1356b9=_0x326195[_0x2cb6f7];for(var _0x3860ad=0x0;_0x3860ad<_0x1356b9['Agents']['length'];_0x3860ad+=0x1){let _0x217d39=_0x1356b9[_0x5b0a('0x6c')][_0x3860ad];var _0x25cb35=_0x453e06[_0x5b0a('0x7d')]();_0x25cb35[_0x5b0a('0x46')](_0x5b0a('0x7e'),_0x217d39['id']);_0x170179[_0x5b0a('0x7f')](db[_0x5b0a('0x71')][_0x5b0a('0x3c')](_0x25cb35['toString'](),{'type':db[_0x5b0a('0x71')][_0x5b0a('0x80')]['SELECT']})['then'](function(_0x30b298){if(_0x30b298[_0x5b0a('0x42')]===0x1){return _0x217d39['id'];}else{var _0x52c551=_[_0x5b0a('0x81')](_['map'](_0x30b298,'TeamId'),function(_0x40021c){return _['includes'](_0x37a1c4,_0x40021c);});if(_0x52c551){return _0x217d39['id'];}}}));}}return BPromise[_0x5b0a('0x82')](_0x170179)['then'](function(_0x14c1df){_0x3c6db8=_(_0x3c6db8)[_0x5b0a('0x83')](_0x14c1df)['compact']()['value']();return db[_0x5b0a('0x37')][_0x5b0a('0x52')]({'where':{'id':_0x13aaca[_0x5b0a('0x51')]['id']}})[_0x5b0a('0x2e')](function(_0x1118f4){return db[_0x5b0a('0x71')][_0x5b0a('0x72')](function(_0x807b5a){return _0x1118f4[_0x5b0a('0x77')](_0x13aaca[_0x5b0a('0x3c')][_0x5b0a('0x6a')],{'transaction':_0x807b5a})[_0x5b0a('0x2e')](function(){if(!_['isEmpty'](_0x3c6db8)){return _0x1118f4[_0x5b0a('0x84')](_0x3c6db8,{'transaction':_0x807b5a});}})['then'](function(){_0x3c6db8['forEach'](function(_0x2179e0){socket['emit']('userChatQueue:remove',{'UserId':_0x2179e0,'ChatQueueId':_0x1118f4['id']});});});});});});})[_0x5b0a('0x2e')](respondWithStatusCode(_0x59a310,null))[_0x5b0a('0x4f')](handleError(_0x59a310,null));};exports['addAgents']=function(_0x43724a,_0x4fe728,_0x445fa0){return db[_0x5b0a('0x37')][_0x5b0a('0x52')]({'where':{'id':_0x43724a[_0x5b0a('0x51')]['id']}})[_0x5b0a('0x2e')](handleEntityNotFound(_0x4fe728,null))[_0x5b0a('0x2e')](function(_0x27f004){if(_0x27f004){return _0x27f004[_0x5b0a('0x85')](_0x43724a[_0x5b0a('0x54')]['ids'],_['omit'](_0x43724a[_0x5b0a('0x54')],['ids','id'])||{})[_0x5b0a('0x86')](function(_0x5462a4){for(var _0x51c988=0x0;_0x51c988<_0x43724a[_0x5b0a('0x54')][_0x5b0a('0x6a')][_0x5b0a('0x42')];_0x51c988+=0x1){socket[_0x5b0a('0x75')](_0x5b0a('0x76'),{'UserId':Number(_0x43724a[_0x5b0a('0x54')][_0x5b0a('0x6a')][_0x51c988]),'ChatQueueId':Number(_0x43724a[_0x5b0a('0x51')]['id'])});}return _0x5462a4;});}})[_0x5b0a('0x2e')](respondWithResult(_0x4fe728,null))[_0x5b0a('0x4f')](handleError(_0x4fe728,null));};exports[_0x5b0a('0x84')]=function(_0x28d001,_0x362aaa,_0x47f0c9){return db[_0x5b0a('0x37')][_0x5b0a('0x52')]({'where':{'id':_0x28d001[_0x5b0a('0x51')]['id']}})['then'](handleEntityNotFound(_0x362aaa,null))['then'](function(_0x44fec1){if(_0x44fec1){return _0x44fec1['removeAgents'](_0x28d001[_0x5b0a('0x3c')][_0x5b0a('0x6a')])[_0x5b0a('0x2e')](function(){if(_['isArray'](_0x28d001[_0x5b0a('0x3c')][_0x5b0a('0x6a')])){for(var _0x3047c0=0x0;_0x3047c0<_0x28d001['query'][_0x5b0a('0x6a')]['length'];_0x3047c0+=0x1){socket[_0x5b0a('0x75')](_0x5b0a('0x87'),{'UserId':Number(_0x28d001['query'][_0x5b0a('0x6a')][_0x3047c0]),'ChatQueueId':Number(_0x28d001[_0x5b0a('0x51')]['id'])});}}else{socket[_0x5b0a('0x75')](_0x5b0a('0x87'),{'UserId':Number(_0x28d001[_0x5b0a('0x3c')]['ids']),'ChatQueueId':Number(_0x28d001[_0x5b0a('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x362aaa,null))[_0x5b0a('0x4f')](handleError(_0x362aaa,null));};exports[_0x5b0a('0x88')]=function(_0x1bacc5,_0x12e36f,_0x65ddf4){var _0x3d7247={};var _0x134a6f={};var _0x5da1dd;var _0x27f3b1;return db['ChatQueue'][_0x5b0a('0x67')]({'where':{'id':_0x1bacc5[_0x5b0a('0x51')]['id']}})['then'](handleEntityNotFound(_0x12e36f,null))['then'](function(_0x4caf7b){if(_0x4caf7b){_0x5da1dd=_0x4caf7b;_0x134a6f[_0x5b0a('0x3b')]=_[_0x5b0a('0x3d')](db[_0x5b0a('0x5f')][_0x5b0a('0x38')]);_0x134a6f[_0x5b0a('0x3c')]=_[_0x5b0a('0x3d')](_0x1bacc5[_0x5b0a('0x3c')]);_0x134a6f['filters']=_[_0x5b0a('0x3f')](_0x134a6f[_0x5b0a('0x3b')],_0x134a6f[_0x5b0a('0x3c')]);_0x3d7247[_0x5b0a('0x40')]=_[_0x5b0a('0x3f')](_0x134a6f[_0x5b0a('0x3b')],qs['fields'](_0x1bacc5[_0x5b0a('0x3c')][_0x5b0a('0x41')]));_0x3d7247[_0x5b0a('0x40')]=_0x3d7247['attributes'][_0x5b0a('0x42')]?_0x3d7247[_0x5b0a('0x40')]:_0x134a6f[_0x5b0a('0x3b')];_0x3d7247['order']=qs[_0x5b0a('0x45')](_0x1bacc5['query'][_0x5b0a('0x45')]);_0x3d7247[_0x5b0a('0x46')]=qs[_0x5b0a('0x3e')](_[_0x5b0a('0x47')](_0x1bacc5[_0x5b0a('0x3c')],_0x134a6f[_0x5b0a('0x3e')]));if(_0x1bacc5['query']['filter']){_0x3d7247[_0x5b0a('0x46')]=_['merge'](_0x3d7247['where'],{'$or':_[_0x5b0a('0x36')](_0x3d7247[_0x5b0a('0x40')],function(_0x17360f){var _0x3fdfa5={};_0x3fdfa5[_0x17360f]={'$like':'%'+_0x1bacc5[_0x5b0a('0x3c')][_0x5b0a('0x4a')]+'%'};return _0x3fdfa5;})});}_0x3d7247=_[_0x5b0a('0x48')]({},_0x3d7247,_0x1bacc5[_0x5b0a('0x4b')]);return _0x5da1dd['getAgents'](_0x3d7247);}})[_0x5b0a('0x2e')](function(_0x49251a){if(_0x49251a){_0x27f3b1=_0x49251a['length'];if(!_0x1bacc5[_0x5b0a('0x3c')][_0x5b0a('0x43')](_0x5b0a('0x44'))){_0x3d7247['limit']=qs[_0x5b0a('0x29')](_0x1bacc5[_0x5b0a('0x3c')]['limit']);_0x3d7247['offset']=qs[_0x5b0a('0x26')](_0x1bacc5['query']['offset']);}return _0x5da1dd[_0x5b0a('0x88')](_0x3d7247);}})[_0x5b0a('0x2e')](function(_0x5603b6){if(_0x5603b6){return _0x5603b6?{'count':_0x27f3b1,'rows':_0x5603b6}:null;}})[_0x5b0a('0x2e')](respondWithResult(_0x12e36f,null))['catch'](handleError(_0x12e36f,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 9b00253..309cfc3 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 _0x59a0=['exports','events','../../mysqldb','ChatQueue','save','update','remove','emit','hook'];(function(_0x37a887,_0x5abb88){var _0x52ff95=function(_0x4065ee){while(--_0x4065ee){_0x37a887['push'](_0x37a887['shift']());}};_0x52ff95(++_0x5abb88);}(_0x59a0,0x184));var _0x059a=function(_0x2717e6,_0x397bff){_0x2717e6=_0x2717e6-0x0;var _0x2944f1=_0x59a0[_0x2717e6];return _0x2944f1;};'use strict';var EventEmitter=require(_0x059a('0x0'));var ChatQueue=require(_0x059a('0x1'))['db'][_0x059a('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x059a('0x3'),'afterUpdate':_0x059a('0x4'),'afterDestroy':_0x059a('0x5')};function emitEvent(_0x36e384){return function(_0x542f60,_0x5a637e,_0x5d1a34){ChatQueueEvents['emit'](_0x36e384+':'+_0x542f60['id'],_0x542f60);ChatQueueEvents[_0x059a('0x6')](_0x36e384,_0x542f60);_0x5d1a34(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x059a('0x7')](e,emitEvent(event));}}module[_0x059a('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x8734=['update','emit','events','ChatQueue','setMaxListeners','save'];(function(_0x2a7ed0,_0x23e60f){var _0x56c2cb=function(_0x429885){while(--_0x429885){_0x2a7ed0['push'](_0x2a7ed0['shift']());}};_0x56c2cb(++_0x23e60f);}(_0x8734,0x134));var _0x4873=function(_0xd6df5e,_0x4a4e46){_0xd6df5e=_0xd6df5e-0x0;var _0x155b12=_0x8734[_0xd6df5e];return _0x155b12;};'use strict';var EventEmitter=require(_0x4873('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x4873('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4873('0x2')](0x0);var events={'afterCreate':_0x4873('0x3'),'afterUpdate':_0x4873('0x4'),'afterDestroy':'remove'};function emitEvent(_0x35bd54){return function(_0x5bcb32,_0x1ae455,_0x2528ff){ChatQueueEvents['emit'](_0x35bd54+':'+_0x5bcb32['id'],_0x5bcb32);ChatQueueEvents[_0x4873('0x5')](_0x35bd54,_0x5bcb32);_0x2528ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](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 a31c146..a03d4e1 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 _0x1ddb=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','ChatQueue','lodash','util','../../config/logger','api'];(function(_0x5165a2,_0x2fc38d){var _0x5edefb=function(_0x275942){while(--_0x275942){_0x5165a2['push'](_0x5165a2['shift']());}};_0x5edefb(++_0x2fc38d);}(_0x1ddb,0x125));var _0xb1dd=function(_0x2de564,_0x14ac58){_0x2de564=_0x2de564-0x0;var _0x5b7809=_0x1ddb[_0x2de564];return _0x5b7809;};'use strict';var _=require(_0xb1dd('0x0'));var util=require(_0xb1dd('0x1'));var logger=require(_0xb1dd('0x2'))(_0xb1dd('0x3'));var moment=require(_0xb1dd('0x4'));var BPromise=require(_0xb1dd('0x5'));var rp=require(_0xb1dd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb1dd('0x7'));var config=require(_0xb1dd('0x8'));var attributes=require(_0xb1dd('0x9'));module['exports']=function(_0xe9628,_0x17b35d){return _0xe9628['define'](_0xb1dd('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70a0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','util','../../config/logger','api'];(function(_0x5cc231,_0x40002f){var _0x1f48c2=function(_0x32a83f){while(--_0x32a83f){_0x5cc231['push'](_0x5cc231['shift']());}};_0x1f48c2(++_0x40002f);}(_0x70a0,0x1d6));var _0x070a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x70a0[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x070a('0x0'));var logger=require(_0x070a('0x1'))(_0x070a('0x2'));var moment=require(_0x070a('0x3'));var BPromise=require(_0x070a('0x4'));var rp=require(_0x070a('0x5'));var fs=require('fs');var path=require(_0x070a('0x6'));var rimraf=require(_0x070a('0x7'));var config=require(_0x070a('0x8'));var attributes=require(_0x070a('0x9'));module[_0x070a('0xa')]=function(_0x1ebed0,_0x112fe0){return _0x1ebed0['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 540f4d4..3225ae9 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 _0x9bb3=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','map','include','model','debug','ShowChatQueue','lodash','util','moment','bluebird'];(function(_0xaca3f,_0x52732c){var _0x386c4d=function(_0x3542ad){while(--_0x3542ad){_0xaca3f['push'](_0xaca3f['shift']());}};_0x386c4d(++_0x52732c);}(_0x9bb3,0x134));var _0x39bb=function(_0x19f5a7,_0x5c99bc){_0x19f5a7=_0x19f5a7-0x0;var _0x6f4800=_0x9bb3[_0x19f5a7];return _0x6f4800;};'use strict';var _=require(_0x39bb('0x0'));var util=require(_0x39bb('0x1'));var moment=require(_0x39bb('0x2'));var BPromise=require(_0x39bb('0x3'));var rs=require(_0x39bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x39bb('0x5'));var logger=require(_0x39bb('0x6'))(_0x39bb('0x7'));var config=require(_0x39bb('0x8'));var jayson=require(_0x39bb('0x9'));var client=jayson[_0x39bb('0xa')][_0x39bb('0xb')]({'port':0x232a});config[_0x39bb('0xc')]=_[_0x39bb('0xd')](config[_0x39bb('0xc')],{'host':_0x39bb('0xe'),'port':0x18eb});var socket=require(_0x39bb('0xf'))(new Redis(config[_0x39bb('0xc')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3eb2f9,_0x39362a,_0x4b7e6f){return new BPromise(function(_0x15c485,_0x5215fb){return client[_0x39bb('0x10')](_0x3eb2f9,_0x4b7e6f)[_0x39bb('0x11')](function(_0x2fce1c){logger['info'](_0x39bb('0x12'),_0x39362a,'request\x20sent');logger['debug'](_0x39bb('0x13'),_0x39362a,_0x39bb('0x14'),JSON[_0x39bb('0x15')](_0x2fce1c));if(_0x2fce1c[_0x39bb('0x16')]){if(_0x2fce1c[_0x39bb('0x16')][_0x39bb('0x17')]===0x1f4){logger[_0x39bb('0x16')]('ChatQueue,\x20%s,\x20%s',_0x39362a,_0x2fce1c['error'][_0x39bb('0x18')]);return _0x5215fb(_0x2fce1c['error'][_0x39bb('0x18')]);}logger[_0x39bb('0x16')](_0x39bb('0x12'),_0x39362a,_0x2fce1c[_0x39bb('0x16')][_0x39bb('0x18')]);return _0x15c485(_0x2fce1c[_0x39bb('0x16')][_0x39bb('0x18')]);}else{logger[_0x39bb('0x19')](_0x39bb('0x12'),_0x39362a,_0x39bb('0x14'));_0x15c485(_0x2fce1c['result'][_0x39bb('0x18')]);}})[_0x39bb('0x1a')](function(_0x369be0){logger['error'](_0x39bb('0x12'),_0x39362a,_0x369be0);_0x5215fb(_0x369be0);});});}exports[_0x39bb('0x1b')]=function(_0xd92981){var _0x1b90a4=this;return new Promise(function(_0x148fe1,_0xfa6090){return db[_0x39bb('0x1c')][_0x39bb('0x1d')]({'raw':_0xd92981['options']?_0xd92981[_0x39bb('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xd92981['options']?_0xd92981[_0x39bb('0x1e')][_0x39bb('0x1f')]||null:null,'attributes':_0xd92981['options']?_0xd92981['options'][_0x39bb('0x20')]||null:null,'limit':_0xd92981[_0x39bb('0x1e')]?_0xd92981['options'][_0x39bb('0x21')]||null:null,'include':_0xd92981[_0x39bb('0x1e')]?_0xd92981[_0x39bb('0x1e')]['include']?_[_0x39bb('0x22')](_0xd92981['options'][_0x39bb('0x23')],function(_0x3d1cef){return{'model':db[_0x3d1cef[_0x39bb('0x24')]],'as':_0x3d1cef['as'],'attributes':_0x3d1cef[_0x39bb('0x20')],'include':_0x3d1cef[_0x39bb('0x23')]?_['map'](_0x3d1cef['include'],function(_0xe597b8){return{'model':db[_0xe597b8[_0x39bb('0x24')]],'as':_0xe597b8['as'],'attributes':_0xe597b8['attributes'],'include':_0xe597b8['include']?_[_0x39bb('0x22')](_0xe597b8[_0x39bb('0x23')],function(_0x14440b){return{'model':db[_0x14440b['model']],'as':_0x14440b['as'],'attributes':_0x14440b[_0x39bb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f9fe2){logger[_0x39bb('0x19')]('GetChatQueue',_0xd92981);logger[_0x39bb('0x25')](_0x39bb('0x1b'),_0xd92981,JSON[_0x39bb('0x15')](_0x1f9fe2));_0x148fe1(_0x1f9fe2);})[_0x39bb('0x1a')](function(_0x1cdef1){logger[_0x39bb('0x16')](_0x39bb('0x1b'),_0x1cdef1[_0x39bb('0x18')],_0xd92981);_0xfa6090(_0x1b90a4[_0x39bb('0x16')](0x1f4,_0x1cdef1[_0x39bb('0x18')]));});});};exports[_0x39bb('0x26')]=function(_0x3e137a){var _0x370d22=this;return new Promise(function(_0x5e0ae8,_0x182460){return db[_0x39bb('0x1c')]['find']({'raw':_0x3e137a[_0x39bb('0x1e')]?_0x3e137a[_0x39bb('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3e137a[_0x39bb('0x1e')]?_0x3e137a[_0x39bb('0x1e')][_0x39bb('0x1f')]||null:null,'attributes':_0x3e137a['options']?_0x3e137a['options']['attributes']||null:null,'include':_0x3e137a[_0x39bb('0x1e')]?_0x3e137a[_0x39bb('0x1e')][_0x39bb('0x23')]?_[_0x39bb('0x22')](_0x3e137a['options'][_0x39bb('0x23')],function(_0x4cd284){return{'model':db[_0x4cd284[_0x39bb('0x24')]],'as':_0x4cd284['as'],'attributes':_0x4cd284['attributes'],'include':_0x4cd284['include']?_['map'](_0x4cd284['include'],function(_0x16e8ea){return{'model':db[_0x16e8ea[_0x39bb('0x24')]],'as':_0x16e8ea['as'],'attributes':_0x16e8ea['attributes'],'include':_0x16e8ea[_0x39bb('0x23')]?_[_0x39bb('0x22')](_0x16e8ea['include'],function(_0x4c62a0){return{'model':db[_0x4c62a0[_0x39bb('0x24')]],'as':_0x4c62a0['as'],'attributes':_0x4c62a0[_0x39bb('0x20')]};}):[]};}):[]};}):[]:[]})[_0x39bb('0x11')](function(_0x119ac7){logger[_0x39bb('0x19')](_0x39bb('0x26'),_0x3e137a);logger[_0x39bb('0x25')](_0x39bb('0x26'),_0x3e137a,JSON[_0x39bb('0x15')](_0x119ac7));_0x5e0ae8(_0x119ac7);})[_0x39bb('0x1a')](function(_0x94de2b){logger['error']('ShowChatQueue',_0x94de2b[_0x39bb('0x18')],_0x3e137a);_0x182460(_0x370d22[_0x39bb('0x16')](0x1f4,_0x94de2b[_0x39bb('0x18')]));});});}; \ No newline at end of file +var _0x0664=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatQueue.socket','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','map','model','ShowChatQueue','find','then','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x252699,_0x134b4e){var _0x56d0c6=function(_0x5551a8){while(--_0x5551a8){_0x252699['push'](_0x252699['shift']());}};_0x56d0c6(++_0x134b4e);}(_0x0664,0x93));var _0x4066=function(_0x3790c1,_0x596e3a){_0x3790c1=_0x3790c1-0x0;var _0x334c6d=_0x0664[_0x3790c1];return _0x334c6d;};'use strict';var _=require('lodash');var util=require(_0x4066('0x0'));var moment=require('moment');var BPromise=require(_0x4066('0x1'));var rs=require(_0x4066('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4066('0x3'))['db'];var utils=require(_0x4066('0x4'));var logger=require(_0x4066('0x5'))(_0x4066('0x6'));var config=require(_0x4066('0x7'));var jayson=require(_0x4066('0x8'));var client=jayson[_0x4066('0x9')][_0x4066('0xa')]({'port':0x232a});config[_0x4066('0xb')]=_[_0x4066('0xc')](config['redis'],{'host':_0x4066('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4066('0xb')]));require(_0x4066('0xe'))['register'](socket);function respondWithRpcPromise(_0x5f3d44,_0x1da4d8,_0x3ea971){return new BPromise(function(_0x16a1f7,_0x41ad8b){return client['request'](_0x5f3d44,_0x3ea971)['then'](function(_0x52d31c){logger['info'](_0x4066('0xf'),_0x1da4d8,_0x4066('0x10'));logger[_0x4066('0x11')](_0x4066('0x12'),_0x1da4d8,_0x4066('0x10'),JSON[_0x4066('0x13')](_0x52d31c));if(_0x52d31c[_0x4066('0x14')]){if(_0x52d31c[_0x4066('0x14')]['code']===0x1f4){logger[_0x4066('0x14')](_0x4066('0xf'),_0x1da4d8,_0x52d31c['error'][_0x4066('0x15')]);return _0x41ad8b(_0x52d31c['error'][_0x4066('0x15')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x1da4d8,_0x52d31c[_0x4066('0x14')][_0x4066('0x15')]);return _0x16a1f7(_0x52d31c[_0x4066('0x14')][_0x4066('0x15')]);}else{logger[_0x4066('0x16')](_0x4066('0xf'),_0x1da4d8,_0x4066('0x10'));_0x16a1f7(_0x52d31c[_0x4066('0x17')][_0x4066('0x15')]);}})[_0x4066('0x18')](function(_0x511cfa){logger['error'](_0x4066('0xf'),_0x1da4d8,_0x511cfa);_0x41ad8b(_0x511cfa);});});}exports[_0x4066('0x19')]=function(_0x5b02a4){var _0x414e6c=this;return new Promise(function(_0x215d68,_0x382950){return db[_0x4066('0x1a')][_0x4066('0x1b')]({'raw':_0x5b02a4[_0x4066('0x1c')]?_0x5b02a4['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b02a4['options']?_0x5b02a4['options'][_0x4066('0x1d')]||null:null,'attributes':_0x5b02a4[_0x4066('0x1c')]?_0x5b02a4[_0x4066('0x1c')][_0x4066('0x1e')]||null:null,'limit':_0x5b02a4[_0x4066('0x1c')]?_0x5b02a4['options'][_0x4066('0x1f')]||null:null,'include':_0x5b02a4[_0x4066('0x1c')]?_0x5b02a4[_0x4066('0x1c')][_0x4066('0x20')]?_[_0x4066('0x21')](_0x5b02a4['options']['include'],function(_0x2984ef){return{'model':db[_0x2984ef[_0x4066('0x22')]],'as':_0x2984ef['as'],'attributes':_0x2984ef[_0x4066('0x1e')],'include':_0x2984ef[_0x4066('0x20')]?_[_0x4066('0x21')](_0x2984ef[_0x4066('0x20')],function(_0x1f9e34){return{'model':db[_0x1f9e34[_0x4066('0x22')]],'as':_0x1f9e34['as'],'attributes':_0x1f9e34[_0x4066('0x1e')],'include':_0x1f9e34[_0x4066('0x20')]?_[_0x4066('0x21')](_0x1f9e34[_0x4066('0x20')],function(_0x540a9){return{'model':db[_0x540a9[_0x4066('0x22')]],'as':_0x540a9['as'],'attributes':_0x540a9[_0x4066('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x80e095){logger['info']('GetChatQueue',_0x5b02a4);logger['debug'](_0x4066('0x19'),_0x5b02a4,JSON['stringify'](_0x80e095));_0x215d68(_0x80e095);})[_0x4066('0x18')](function(_0x2a39e7){logger[_0x4066('0x14')]('GetChatQueue',_0x2a39e7[_0x4066('0x15')],_0x5b02a4);_0x382950(_0x414e6c['error'](0x1f4,_0x2a39e7[_0x4066('0x15')]));});});};exports[_0x4066('0x23')]=function(_0x5eaaca){var _0x4924cf=this;return new Promise(function(_0x3363e8,_0x10dbde){return db['ChatQueue'][_0x4066('0x24')]({'raw':_0x5eaaca[_0x4066('0x1c')]?_0x5eaaca[_0x4066('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5eaaca[_0x4066('0x1c')]?_0x5eaaca['options'][_0x4066('0x1d')]||null:null,'attributes':_0x5eaaca[_0x4066('0x1c')]?_0x5eaaca[_0x4066('0x1c')][_0x4066('0x1e')]||null:null,'include':_0x5eaaca[_0x4066('0x1c')]?_0x5eaaca[_0x4066('0x1c')][_0x4066('0x20')]?_[_0x4066('0x21')](_0x5eaaca[_0x4066('0x1c')][_0x4066('0x20')],function(_0x219010){return{'model':db[_0x219010[_0x4066('0x22')]],'as':_0x219010['as'],'attributes':_0x219010['attributes'],'include':_0x219010[_0x4066('0x20')]?_[_0x4066('0x21')](_0x219010['include'],function(_0x1e1134){return{'model':db[_0x1e1134[_0x4066('0x22')]],'as':_0x1e1134['as'],'attributes':_0x1e1134['attributes'],'include':_0x1e1134[_0x4066('0x20')]?_[_0x4066('0x21')](_0x1e1134[_0x4066('0x20')],function(_0x470fa6){return{'model':db[_0x470fa6[_0x4066('0x22')]],'as':_0x470fa6['as'],'attributes':_0x470fa6[_0x4066('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4066('0x25')](function(_0x178ca2){logger[_0x4066('0x16')]('ShowChatQueue',_0x5eaaca);logger[_0x4066('0x11')](_0x4066('0x23'),_0x5eaaca,JSON['stringify'](_0x178ca2));_0x3363e8(_0x178ca2);})[_0x4066('0x18')](function(_0x3c0e01){logger[_0x4066('0x14')]('ShowChatQueue',_0x3c0e01[_0x4066('0x15')],_0x5eaaca);_0x10dbde(_0x4924cf[_0x4066('0x14')](0x1f4,_0x3c0e01[_0x4066('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index ccada0f..0ae441c 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 _0x72b1=['register','length','./chatQueue.events','remove','update','emit','removeListener'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x72b1,0x16e));var _0x172b=function(_0x44e4fa,_0x2df5b5){_0x44e4fa=_0x44e4fa-0x0;var _0x2c3c0f=_0x72b1[_0x44e4fa];return _0x2c3c0f;};'use strict';var ChatQueueEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatQueueEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatQueue:'+_0x517363,_0x475fd6);ChatQueueEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file +var _0x7bae=['remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x3765ff,_0x16916e){var _0x333f28=function(_0x208816){while(--_0x208816){_0x3765ff['push'](_0x3765ff['shift']());}};_0x333f28(++_0x16916e);}(_0x7bae,0x13b));var _0xe7ba=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x7bae[_0xa8883];return _0x479426;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0xe7ba('0x0'),_0xe7ba('0x1')];function createListener(_0x503803,_0x3963c7){return function(_0x4f2e91){_0x3963c7[_0xe7ba('0x2')](_0x503803,_0x4f2e91);};}function removeListener(_0x10908b,_0x166acb){return function(){ChatQueueEvents[_0xe7ba('0x3')](_0x10908b,_0x166acb);};}exports[_0xe7ba('0x4')]=function(_0xfd3a22){for(var _0x2d31df=0x0,_0x3c5e59=events[_0xe7ba('0x5')];_0x2d31df<_0x3c5e59;_0x2d31df++){var _0x34fb18=events[_0x2d31df];var _0x160565=createListener(_0xe7ba('0x6')+_0x34fb18,_0xfd3a22);ChatQueueEvents['on'](_0x34fb18,_0x160565);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 7d33abb..41e8611 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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x359d00,_0x215da8){var _0x511edd=function(_0x105448){while(--_0x105448){_0x359d00['push'](_0x359d00['shift']());}};_0x511edd(++_0x215da8);}(_0xe14b,0x93));var _0xbe14=function(_0x2f7819,_0x4303da){_0x2f7819=_0x2f7819-0x0;var _0x2c418d=_0xe14b[_0x2f7819];return _0x2c418d;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0xdb627f,_0x364a0c){var _0x2233a8=function(_0xfac23e){while(--_0xfac23e){_0xdb627f['push'](_0xdb627f['shift']());}};_0x2233a8(++_0x364a0c);}(_0x55ca,0x126));var _0xa55c=function(_0x465533,_0x56ab66){_0x465533=_0x465533-0x0;var _0x49489b=_0x55ca[_0x465533];return _0x49489b;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 58f2d15..890e57f 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 _0xfead=['STRING','DATE','moment','sequelize','exports'];(function(_0x228fcc,_0x491886){var _0x19d09c=function(_0x459fd5){while(--_0x459fd5){_0x228fcc['push'](_0x228fcc['shift']());}};_0x19d09c(++_0x491886);}(_0xfead,0x1d8));var _0xdfea=function(_0x5f30c1,_0x5c9c25){_0x5f30c1=_0x5f30c1-0x0;var _0xd3c44d=_0xfead[_0x5f30c1];return _0xd3c44d;};'use strict';var moment=require(_0xdfea('0x0'));var Sequelize=require(_0xdfea('0x1'));module[_0xdfea('0x2')]={'uniqueid':{'type':Sequelize[_0xdfea('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xdfea('0x3')]},'joinAt':{'type':Sequelize[_0xdfea('0x4')]},'leaveAt':{'type':Sequelize[_0xdfea('0x4')]},'acceptAt':{'type':Sequelize[_0xdfea('0x4')]},'exitAt':{'type':Sequelize[_0xdfea('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb6be=['STRING','DATE','moment','sequelize'];(function(_0x562785,_0x9bb9c4){var _0x303a17=function(_0x225660){while(--_0x225660){_0x562785['push'](_0x562785['shift']());}};_0x303a17(++_0x9bb9c4);}(_0xb6be,0x132));var _0xeb6b=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xb6be[_0x1ae5ab];return _0x1ce001;};'use strict';var moment=require(_0xeb6b('0x0'));var Sequelize=require(_0xeb6b('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xeb6b('0x2')]},'joinAt':{'type':Sequelize[_0xeb6b('0x3')]},'leaveAt':{'type':Sequelize[_0xeb6b('0x3')]},'acceptAt':{'type':Sequelize[_0xeb6b('0x3')]},'exitAt':{'type':Sequelize[_0xeb6b('0x3')]},'reason':{'type':Sequelize[_0xeb6b('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index ea25516..38e699d 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 _0x9fd4=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','ChatQueueReport','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x9fd4,0x16c));var _0x49fd=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0x9fd4[_0x5c72ee];return _0x231876;};'use strict';var emlformat=require(_0x49fd('0x0'));var rimraf=require(_0x49fd('0x1'));var zipdir=require(_0x49fd('0x2'));var jsonpatch=require(_0x49fd('0x3'));var rp=require(_0x49fd('0x4'));var moment=require(_0x49fd('0x5'));var BPromise=require(_0x49fd('0x6'));var Mustache=require(_0x49fd('0x7'));var util=require(_0x49fd('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x49fd('0x9'));var ejs=require(_0x49fd('0xa'));var fs=require('fs');var fs_extra=require(_0x49fd('0xb'));var _=require(_0x49fd('0xc'));var squel=require('squel');var crypto=require(_0x49fd('0xd'));var jsforce=require(_0x49fd('0xe'));var deskjs=require(_0x49fd('0xf'));var toCsv=require(_0x49fd('0x9'));var querystring=require(_0x49fd('0x10'));var Papa=require('papaparse');var Redis=require(_0x49fd('0x11'));var authService=require(_0x49fd('0x12'));var qs=require(_0x49fd('0x13'));var as=require(_0x49fd('0x14'));var hardwareService=require(_0x49fd('0x15'));var logger=require(_0x49fd('0x16'))(_0x49fd('0x17'));var utils=require('../../config/utils');var config=require(_0x49fd('0x18'));var licenseUtil=require(_0x49fd('0x19'));var db=require(_0x49fd('0x1a'))['db'];function respondWithStatusCode(_0x40d1b0,_0x15dabd){_0x15dabd=_0x15dabd||0xcc;return function(_0x206bd8){if(_0x206bd8){return _0x40d1b0[_0x49fd('0x1b')](_0x15dabd);}return _0x40d1b0[_0x49fd('0x1c')](_0x15dabd)[_0x49fd('0x1d')]();};}function respondWithResult(_0x652890,_0x157b09){_0x157b09=_0x157b09||0xc8;return function(_0x44c18c){if(_0x44c18c){return _0x652890[_0x49fd('0x1c')](_0x157b09)[_0x49fd('0x1e')](_0x44c18c);}};}function respondWithFilteredResult(_0x264ab1,_0x201109){return function(_0x2859f2){if(_0x2859f2){var _0x3ca675=typeof _0x201109[_0x49fd('0x1f')]===_0x49fd('0x20')&&typeof _0x201109[_0x49fd('0x21')]===_0x49fd('0x20');var _0x320fe5=_0x2859f2[_0x49fd('0x22')];var _0xb55d24=_0x3ca675?0x0:_0x201109[_0x49fd('0x1f')];var _0x598793=_0x3ca675?_0x2859f2[_0x49fd('0x22')]:_0x201109[_0x49fd('0x1f')]+_0x201109['limit'];var _0x5c323a;if(_0x598793>=_0x320fe5){_0x598793=_0x320fe5;_0x5c323a=0xc8;}else{_0x5c323a=0xce;}_0x264ab1[_0x49fd('0x1c')](_0x5c323a);return _0x264ab1['set'](_0x49fd('0x23'),_0xb55d24+'-'+_0x598793+'/'+_0x320fe5)[_0x49fd('0x1e')](_0x2859f2);}return null;};}function patchUpdates(_0x599315){return function(_0xf7efcf){try{jsonpatch[_0x49fd('0x24')](_0xf7efcf,_0x599315,!![]);}catch(_0x5ae3bc){return BPromise[_0x49fd('0x25')](_0x5ae3bc);}return _0xf7efcf[_0x49fd('0x26')]();};}function saveUpdates(_0x2e1c40,_0x290f59){return function(_0x20fa0d){if(_0x20fa0d){return _0x20fa0d[_0x49fd('0x27')](_0x2e1c40)['then'](function(_0x46019d){return _0x46019d;});}return null;};}function removeEntity(_0xd43815,_0x8f202b){return function(_0x4bf811){if(_0x4bf811){return _0x4bf811[_0x49fd('0x28')]()[_0x49fd('0x29')](function(){_0xd43815[_0x49fd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x597161,_0x497469){return function(_0x13c5a8){if(!_0x13c5a8){_0x597161[_0x49fd('0x1b')](0x194);}return _0x13c5a8;};}function handleError(_0x4ec190,_0x302ab2){_0x302ab2=_0x302ab2||0x1f4;return function(_0x9587b9){logger[_0x49fd('0x2a')](_0x9587b9[_0x49fd('0x2b')]);if(_0x9587b9[_0x49fd('0x2c')]){delete _0x9587b9['name'];}_0x4ec190[_0x49fd('0x1c')](_0x302ab2)['send'](_0x9587b9);};}exports[_0x49fd('0x2d')]=function(_0x89badc,_0x54acb5){var _0x203038={},_0x2c8568={},_0x23374c={'count':0x0,'rows':[]};var _0x43826f=_[_0x49fd('0x2e')](db[_0x49fd('0x2f')][_0x49fd('0x30')],function(_0x242203){return{'name':_0x242203['fieldName'],'type':_0x242203[_0x49fd('0x31')]['key']};});_0x2c8568[_0x49fd('0x32')]=_['map'](_0x43826f,_0x49fd('0x2c'));_0x2c8568[_0x49fd('0x33')]=_[_0x49fd('0x34')](_0x89badc['query']);_0x2c8568['filters']=_['intersection'](_0x2c8568[_0x49fd('0x32')],_0x2c8568[_0x49fd('0x33')]);_0x203038['attributes']=_[_0x49fd('0x35')](_0x2c8568['model'],qs['fields'](_0x89badc[_0x49fd('0x33')][_0x49fd('0x36')]));_0x203038[_0x49fd('0x37')]=_0x203038[_0x49fd('0x37')][_0x49fd('0x38')]?_0x203038['attributes']:_0x2c8568['model'];if(!_0x89badc[_0x49fd('0x33')][_0x49fd('0x39')](_0x49fd('0x3a'))){_0x203038[_0x49fd('0x21')]=qs['limit'](_0x89badc[_0x49fd('0x33')][_0x49fd('0x21')]);_0x203038[_0x49fd('0x1f')]=qs[_0x49fd('0x1f')](_0x89badc[_0x49fd('0x33')][_0x49fd('0x1f')]);}_0x203038[_0x49fd('0x3b')]=qs[_0x49fd('0x3c')](_0x89badc[_0x49fd('0x33')][_0x49fd('0x3c')]);_0x203038[_0x49fd('0x3d')]=qs['filters'](_[_0x49fd('0x3e')](_0x89badc[_0x49fd('0x33')],_0x2c8568[_0x49fd('0x3f')]),_0x43826f);if(_0x89badc[_0x49fd('0x33')][_0x49fd('0x40')]){_0x203038[_0x49fd('0x3d')]=_[_0x49fd('0x41')](_0x203038[_0x49fd('0x3d')],{'$or':_[_0x49fd('0x2e')](_0x43826f,function(_0x4a1856){if(_0x4a1856[_0x49fd('0x31')]!=='VIRTUAL'){var _0x46e84c={};_0x46e84c[_0x4a1856[_0x49fd('0x2c')]]={'$like':'%'+_0x89badc['query'][_0x49fd('0x40')]+'%'};return _0x46e84c;}})});}_0x203038=_[_0x49fd('0x41')]({},_0x203038,_0x89badc['options']);var _0x1f9a65={'where':_0x203038['where']};return db['ChatQueueReport']['count'](_0x1f9a65)[_0x49fd('0x29')](function(_0x32982e){_0x23374c[_0x49fd('0x22')]=_0x32982e;if(_0x89badc[_0x49fd('0x33')]['includeAll']){_0x203038[_0x49fd('0x42')]=[{'all':!![]}];}return db[_0x49fd('0x2f')][_0x49fd('0x43')](_0x203038);})[_0x49fd('0x29')](function(_0x115c5a){_0x23374c[_0x49fd('0x44')]=_0x115c5a;return _0x23374c;})[_0x49fd('0x29')](respondWithFilteredResult(_0x54acb5,_0x203038))[_0x49fd('0x45')](handleError(_0x54acb5,null));};exports['show']=function(_0x255a73,_0x2c8ab1){var _0x4dce94={'raw':!![],'where':{'id':_0x255a73[_0x49fd('0x46')]['id']}},_0x3be41b={};_0x3be41b['model']=_[_0x49fd('0x34')](db['ChatQueueReport'][_0x49fd('0x30')]);_0x3be41b[_0x49fd('0x33')]=_[_0x49fd('0x34')](_0x255a73[_0x49fd('0x33')]);_0x3be41b['filters']=_['intersection'](_0x3be41b[_0x49fd('0x32')],_0x3be41b['query']);_0x4dce94[_0x49fd('0x37')]=_[_0x49fd('0x35')](_0x3be41b[_0x49fd('0x32')],qs[_0x49fd('0x36')](_0x255a73['query'][_0x49fd('0x36')]));_0x4dce94[_0x49fd('0x37')]=_0x4dce94[_0x49fd('0x37')][_0x49fd('0x38')]?_0x4dce94[_0x49fd('0x37')]:_0x3be41b[_0x49fd('0x32')];if(_0x255a73[_0x49fd('0x33')][_0x49fd('0x47')]){_0x4dce94[_0x49fd('0x42')]=[{'all':!![]}];}_0x4dce94=_[_0x49fd('0x41')]({},_0x4dce94,_0x255a73[_0x49fd('0x48')]);return db[_0x49fd('0x2f')][_0x49fd('0x49')](_0x4dce94)[_0x49fd('0x29')](handleEntityNotFound(_0x2c8ab1,null))['then'](respondWithResult(_0x2c8ab1,null))['catch'](handleError(_0x2c8ab1,null));};exports[_0x49fd('0x4a')]=function(_0xa3518f,_0x42287e){return db[_0x49fd('0x2f')]['create'](_0xa3518f[_0x49fd('0x4b')],{})[_0x49fd('0x29')](respondWithResult(_0x42287e,0xc9))['catch'](handleError(_0x42287e,null));};exports[_0x49fd('0x27')]=function(_0x270360,_0xaac56f){if(_0x270360[_0x49fd('0x4b')]['id']){delete _0x270360[_0x49fd('0x4b')]['id'];}return db[_0x49fd('0x2f')][_0x49fd('0x49')]({'where':{'id':_0x270360[_0x49fd('0x46')]['id']}})[_0x49fd('0x29')](handleEntityNotFound(_0xaac56f,null))[_0x49fd('0x29')](saveUpdates(_0x270360[_0x49fd('0x4b')],null))['then'](respondWithResult(_0xaac56f,null))[_0x49fd('0x45')](handleError(_0xaac56f,null));};exports[_0x49fd('0x28')]=function(_0x32694b,_0x263cf3){return db[_0x49fd('0x2f')][_0x49fd('0x49')]({'where':{'id':_0x32694b['params']['id']}})['then'](handleEntityNotFound(_0x263cf3,null))[_0x49fd('0x29')](removeEntity(_0x263cf3,null))[_0x49fd('0x45')](handleError(_0x263cf3,null));};exports[_0x49fd('0x4c')]=function(_0x5c34c0,_0x31783f){return db[_0x49fd('0x2f')]['describe']()['then'](respondWithResult(_0x31783f,null))['catch'](handleError(_0x31783f,null));}; \ No newline at end of file +var _0x6f44=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','map','ChatQueueReport','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','count','includeAll','include','rows','catch','params','keys','rawAttributes','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x34ea04,_0x165a66){var _0x2b6576=function(_0x23de38){while(--_0x23de38){_0x34ea04['push'](_0x34ea04['shift']());}};_0x2b6576(++_0x165a66);}(_0x6f44,0x1ea));var _0x46f4=function(_0x176095,_0x5ccb73){_0x176095=_0x176095-0x0;var _0x2f80a4=_0x6f44[_0x176095];return _0x2f80a4;};'use strict';var emlformat=require(_0x46f4('0x0'));var rimraf=require(_0x46f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46f4('0x2'));var rp=require(_0x46f4('0x3'));var moment=require(_0x46f4('0x4'));var BPromise=require(_0x46f4('0x5'));var Mustache=require(_0x46f4('0x6'));var util=require(_0x46f4('0x7'));var path=require(_0x46f4('0x8'));var sox=require(_0x46f4('0x9'));var csv=require(_0x46f4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46f4('0xb'));var _=require(_0x46f4('0xc'));var squel=require(_0x46f4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46f4('0xe'));var toCsv=require(_0x46f4('0xa'));var querystring=require('querystring');var Papa=require(_0x46f4('0xf'));var Redis=require('ioredis');var authService=require(_0x46f4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x46f4('0x11'));var hardwareService=require(_0x46f4('0x12'));var logger=require(_0x46f4('0x13'))(_0x46f4('0x14'));var utils=require(_0x46f4('0x15'));var config=require(_0x46f4('0x16'));var licenseUtil=require(_0x46f4('0x17'));var db=require(_0x46f4('0x18'))['db'];function respondWithStatusCode(_0x21d4a6,_0x1f4748){_0x1f4748=_0x1f4748||0xcc;return function(_0x1dd233){if(_0x1dd233){return _0x21d4a6[_0x46f4('0x19')](_0x1f4748);}return _0x21d4a6['status'](_0x1f4748)[_0x46f4('0x1a')]();};}function respondWithResult(_0x33f73c,_0x52db86){_0x52db86=_0x52db86||0xc8;return function(_0x44a55b){if(_0x44a55b){return _0x33f73c[_0x46f4('0x1b')](_0x52db86)[_0x46f4('0x1c')](_0x44a55b);}};}function respondWithFilteredResult(_0x4dd2fb,_0x3dc516){return function(_0x4e0661){if(_0x4e0661){var _0x4e84ce=typeof _0x3dc516[_0x46f4('0x1d')]===_0x46f4('0x1e')&&typeof _0x3dc516[_0x46f4('0x1f')]==='undefined';var _0x5c191a=_0x4e0661['count'];var _0x5d3471=_0x4e84ce?0x0:_0x3dc516[_0x46f4('0x1d')];var _0x433297=_0x4e84ce?_0x4e0661['count']:_0x3dc516[_0x46f4('0x1d')]+_0x3dc516[_0x46f4('0x1f')];var _0x2232d6;if(_0x433297>=_0x5c191a){_0x433297=_0x5c191a;_0x2232d6=0xc8;}else{_0x2232d6=0xce;}_0x4dd2fb[_0x46f4('0x1b')](_0x2232d6);return _0x4dd2fb['set'](_0x46f4('0x20'),_0x5d3471+'-'+_0x433297+'/'+_0x5c191a)[_0x46f4('0x1c')](_0x4e0661);}return null;};}function patchUpdates(_0x1627db){return function(_0x6476f0){try{jsonpatch[_0x46f4('0x21')](_0x6476f0,_0x1627db,!![]);}catch(_0xdb9f25){return BPromise['reject'](_0xdb9f25);}return _0x6476f0[_0x46f4('0x22')]();};}function saveUpdates(_0x2b88d3,_0x39760b){return function(_0x4ba21a){if(_0x4ba21a){return _0x4ba21a[_0x46f4('0x23')](_0x2b88d3)[_0x46f4('0x24')](function(_0x185ec2){return _0x185ec2;});}return null;};}function removeEntity(_0x47528b,_0x36092e){return function(_0x41be5e){if(_0x41be5e){return _0x41be5e[_0x46f4('0x25')]()[_0x46f4('0x24')](function(){_0x47528b[_0x46f4('0x1b')](0xcc)[_0x46f4('0x1a')]();});}};}function handleEntityNotFound(_0x2ad553,_0x16cd7f){return function(_0x197e55){if(!_0x197e55){_0x2ad553['sendStatus'](0x194);}return _0x197e55;};}function handleError(_0x46e96d,_0x30d4fc){_0x30d4fc=_0x30d4fc||0x1f4;return function(_0xb23194){logger[_0x46f4('0x26')](_0xb23194[_0x46f4('0x27')]);if(_0xb23194[_0x46f4('0x28')]){delete _0xb23194['name'];}_0x46e96d[_0x46f4('0x1b')](_0x30d4fc)['send'](_0xb23194);};}exports['index']=function(_0x53ac21,_0x2cf22c){var _0x57ff78={},_0x1fb343={},_0x183f0c={'count':0x0,'rows':[]};var _0x3c8c91=_[_0x46f4('0x29')](db[_0x46f4('0x2a')]['rawAttributes'],function(_0x1d512b){return{'name':_0x1d512b[_0x46f4('0x2b')],'type':_0x1d512b[_0x46f4('0x2c')]['key']};});_0x1fb343[_0x46f4('0x2d')]=_[_0x46f4('0x29')](_0x3c8c91,_0x46f4('0x28'));_0x1fb343['query']=_['keys'](_0x53ac21[_0x46f4('0x2e')]);_0x1fb343[_0x46f4('0x2f')]=_[_0x46f4('0x30')](_0x1fb343['model'],_0x1fb343[_0x46f4('0x2e')]);_0x57ff78[_0x46f4('0x31')]=_['intersection'](_0x1fb343[_0x46f4('0x2d')],qs['fields'](_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x32')]));_0x57ff78[_0x46f4('0x31')]=_0x57ff78[_0x46f4('0x31')][_0x46f4('0x33')]?_0x57ff78['attributes']:_0x1fb343[_0x46f4('0x2d')];if(!_0x53ac21[_0x46f4('0x2e')]['hasOwnProperty'](_0x46f4('0x34'))){_0x57ff78[_0x46f4('0x1f')]=qs[_0x46f4('0x1f')](_0x53ac21[_0x46f4('0x2e')]['limit']);_0x57ff78[_0x46f4('0x1d')]=qs['offset'](_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x1d')]);}_0x57ff78[_0x46f4('0x35')]=qs[_0x46f4('0x36')](_0x53ac21['query'][_0x46f4('0x36')]);_0x57ff78['where']=qs['filters'](_[_0x46f4('0x37')](_0x53ac21['query'],_0x1fb343['filters']),_0x3c8c91);if(_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x38')]){_0x57ff78['where']=_[_0x46f4('0x39')](_0x57ff78['where'],{'$or':_[_0x46f4('0x29')](_0x3c8c91,function(_0x190c1a){if(_0x190c1a[_0x46f4('0x2c')]!==_0x46f4('0x3a')){var _0x5c6662={};_0x5c6662[_0x190c1a[_0x46f4('0x28')]]={'$like':'%'+_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x38')]+'%'};return _0x5c6662;}})});}_0x57ff78=_['merge']({},_0x57ff78,_0x53ac21['options']);var _0x4a44a6={'where':_0x57ff78[_0x46f4('0x3b')]};return db[_0x46f4('0x2a')][_0x46f4('0x3c')](_0x4a44a6)[_0x46f4('0x24')](function(_0x57bfd2){_0x183f0c[_0x46f4('0x3c')]=_0x57bfd2;if(_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x3d')]){_0x57ff78[_0x46f4('0x3e')]=[{'all':!![]}];}return db[_0x46f4('0x2a')]['findAll'](_0x57ff78);})[_0x46f4('0x24')](function(_0x306400){_0x183f0c[_0x46f4('0x3f')]=_0x306400;return _0x183f0c;})[_0x46f4('0x24')](respondWithFilteredResult(_0x2cf22c,_0x57ff78))[_0x46f4('0x40')](handleError(_0x2cf22c,null));};exports['show']=function(_0x549af3,_0x4e11cb){var _0x21ce83={'raw':!![],'where':{'id':_0x549af3[_0x46f4('0x41')]['id']}},_0x1c0513={};_0x1c0513['model']=_[_0x46f4('0x42')](db[_0x46f4('0x2a')][_0x46f4('0x43')]);_0x1c0513[_0x46f4('0x2e')]=_[_0x46f4('0x42')](_0x549af3[_0x46f4('0x2e')]);_0x1c0513[_0x46f4('0x2f')]=_[_0x46f4('0x30')](_0x1c0513[_0x46f4('0x2d')],_0x1c0513[_0x46f4('0x2e')]);_0x21ce83[_0x46f4('0x31')]=_[_0x46f4('0x30')](_0x1c0513[_0x46f4('0x2d')],qs['fields'](_0x549af3[_0x46f4('0x2e')][_0x46f4('0x32')]));_0x21ce83[_0x46f4('0x31')]=_0x21ce83[_0x46f4('0x31')][_0x46f4('0x33')]?_0x21ce83[_0x46f4('0x31')]:_0x1c0513['model'];if(_0x549af3['query']['includeAll']){_0x21ce83[_0x46f4('0x3e')]=[{'all':!![]}];}_0x21ce83=_[_0x46f4('0x39')]({},_0x21ce83,_0x549af3[_0x46f4('0x44')]);return db[_0x46f4('0x2a')][_0x46f4('0x45')](_0x21ce83)[_0x46f4('0x24')](handleEntityNotFound(_0x4e11cb,null))[_0x46f4('0x24')](respondWithResult(_0x4e11cb,null))[_0x46f4('0x40')](handleError(_0x4e11cb,null));};exports[_0x46f4('0x46')]=function(_0xf73c15,_0x21319d){return db[_0x46f4('0x2a')]['create'](_0xf73c15[_0x46f4('0x47')],{})[_0x46f4('0x24')](respondWithResult(_0x21319d,0xc9))[_0x46f4('0x40')](handleError(_0x21319d,null));};exports['update']=function(_0x5a6d1f,_0x1fedc8){if(_0x5a6d1f[_0x46f4('0x47')]['id']){delete _0x5a6d1f[_0x46f4('0x47')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x5a6d1f[_0x46f4('0x41')]['id']}})[_0x46f4('0x24')](handleEntityNotFound(_0x1fedc8,null))[_0x46f4('0x24')](saveUpdates(_0x5a6d1f[_0x46f4('0x47')],null))[_0x46f4('0x24')](respondWithResult(_0x1fedc8,null))[_0x46f4('0x40')](handleError(_0x1fedc8,null));};exports['destroy']=function(_0x18f0e0,_0x2bbb25){return db[_0x46f4('0x2a')]['find']({'where':{'id':_0x18f0e0[_0x46f4('0x41')]['id']}})[_0x46f4('0x24')](handleEntityNotFound(_0x2bbb25,null))[_0x46f4('0x24')](removeEntity(_0x2bbb25,null))[_0x46f4('0x40')](handleError(_0x2bbb25,null));};exports['describe']=function(_0x26f39a,_0x478dd7){return db[_0x46f4('0x2a')][_0x46f4('0x48')]()[_0x46f4('0x24')](respondWithResult(_0x478dd7,null))['catch'](handleError(_0x478dd7,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 1dfbadd..ed0b803 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x4deae2,_0x124e5c){var _0x140c9f=function(_0x59d15f){while(--_0x59d15f){_0x4deae2['push'](_0x4deae2['shift']());}};_0x140c9f(++_0x124e5c);}(_0x757a,0xde));var _0xa757=function(_0x3f7cb6,_0x2241fe){_0x3f7cb6=_0x3f7cb6-0x0;var _0x1f8011=_0x757a[_0x3f7cb6];return _0x1f8011;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x497809,_0x451ba0){var _0x865565=function(_0x5428c1){while(--_0x5428c1){_0x497809['push'](_0x497809['shift']());}};_0x865565(++_0x451ba0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xb7e7[_0x34bf97];return _0x292719;};'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 cee4eef..6d2f27f 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 _0x8145=['result','catch','CreateChatQueueReport','ChatQueueReport','options','raw','debug','UpdateChatQueueReport','update','body','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x551fce,_0x131ca9){var _0x485540=function(_0x45176e){while(--_0x45176e){_0x551fce['push'](_0x551fce['shift']());}};_0x485540(++_0x131ca9);}(_0x8145,0xdd));var _0x5814=function(_0x59ccfd,_0x2e888d){_0x59ccfd=_0x59ccfd-0x0;var _0xb7ac6=_0x8145[_0x59ccfd];return _0xb7ac6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5814('0x0'));var BPromise=require(_0x5814('0x1'));var rs=require(_0x5814('0x2'));var fs=require('fs');var Redis=require(_0x5814('0x3'));var db=require(_0x5814('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5814('0x5'))(_0x5814('0x6'));var config=require('../../config/environment');var jayson=require(_0x5814('0x7'));var client=jayson['client'][_0x5814('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x201f77,_0x3d199e,_0x282ab7){return new BPromise(function(_0x567751,_0x1aad8f){return client[_0x5814('0x9')](_0x201f77,_0x282ab7)[_0x5814('0xa')](function(_0x5dd689){logger[_0x5814('0xb')](_0x5814('0xc'),_0x3d199e,_0x5814('0xd'));logger['debug'](_0x5814('0xe'),_0x3d199e,_0x5814('0xd'),JSON[_0x5814('0xf')](_0x5dd689));if(_0x5dd689[_0x5814('0x10')]){if(_0x5dd689[_0x5814('0x10')][_0x5814('0x11')]===0x1f4){logger[_0x5814('0x10')](_0x5814('0xc'),_0x3d199e,_0x5dd689[_0x5814('0x10')][_0x5814('0x12')]);return _0x1aad8f(_0x5dd689[_0x5814('0x10')]['message']);}logger[_0x5814('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x3d199e,_0x5dd689[_0x5814('0x10')][_0x5814('0x12')]);return _0x567751(_0x5dd689[_0x5814('0x10')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x3d199e,_0x5814('0xd'));_0x567751(_0x5dd689[_0x5814('0x13')][_0x5814('0x12')]);}})[_0x5814('0x14')](function(_0x38f48a){logger[_0x5814('0x10')](_0x5814('0xc'),_0x3d199e,_0x38f48a);_0x1aad8f(_0x38f48a);});});}exports[_0x5814('0x15')]=function(_0x3e2d8e){var _0x4c243d=this;return new Promise(function(_0x2a1ce5,_0x3c79e6){return db[_0x5814('0x16')]['create'](_0x3e2d8e['body'],{'raw':_0x3e2d8e[_0x5814('0x17')]?_0x3e2d8e[_0x5814('0x17')][_0x5814('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x30c3e6){logger[_0x5814('0xb')]('CreateChatQueueReport',_0x3e2d8e);logger[_0x5814('0x19')]('CreateChatQueueReport',_0x3e2d8e,JSON[_0x5814('0xf')](_0x30c3e6));_0x2a1ce5(_0x30c3e6);})['catch'](function(_0x5ea866){logger['error'](_0x5814('0x15'),_0x5ea866[_0x5814('0x12')],_0x3e2d8e);_0x3c79e6(_0x4c243d['error'](0x1f4,_0x5ea866[_0x5814('0x12')]));});});};exports[_0x5814('0x1a')]=function(_0xa9d511){var _0x591ece=this;return new Promise(function(_0x135529,_0x193a76){return db[_0x5814('0x16')][_0x5814('0x1b')](_0xa9d511[_0x5814('0x1c')],{'raw':_0xa9d511[_0x5814('0x17')]?_0xa9d511[_0x5814('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa9d511[_0x5814('0x17')]?_0xa9d511[_0x5814('0x17')][_0x5814('0x1d')]||null:null,'attributes':_0xa9d511['options']?_0xa9d511['options']['attributes']||null:null,'limit':_0xa9d511[_0x5814('0x17')]?_0xa9d511[_0x5814('0x17')]['limit']||null:null})[_0x5814('0xa')](function(_0x352b69){logger[_0x5814('0xb')](_0x5814('0x1a'),_0xa9d511);logger['debug']('UpdateChatQueueReport',_0xa9d511,JSON[_0x5814('0xf')](_0x352b69));_0x135529(_0x352b69);})[_0x5814('0x14')](function(_0x590a0b){logger['error'](_0x5814('0x1a'),_0x590a0b[_0x5814('0x12')],_0xa9d511);_0x193a76(_0x591ece[_0x5814('0x10')](0x1f4,_0x590a0b[_0x5814('0x12')]));});});}; \ No newline at end of file +var _0x2408=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','CreateChatQueueReport','ChatQueueReport','options','UpdateChatQueueReport','update','raw','where','limit','then','lodash','util'];(function(_0x238d75,_0x7681cc){var _0x1244b7=function(_0x169db4){while(--_0x169db4){_0x238d75['push'](_0x238d75['shift']());}};_0x1244b7(++_0x7681cc);}(_0x2408,0x172));var _0x8240=function(_0x12dc5d,_0x262f06){_0x12dc5d=_0x12dc5d-0x0;var _0x3dc618=_0x2408[_0x12dc5d];return _0x3dc618;};'use strict';var _=require(_0x8240('0x0'));var util=require(_0x8240('0x1'));var moment=require('moment');var BPromise=require(_0x8240('0x2'));var rs=require(_0x8240('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8240('0x4'))['db'];var utils=require(_0x8240('0x5'));var logger=require('../../config/logger')(_0x8240('0x6'));var config=require(_0x8240('0x7'));var jayson=require(_0x8240('0x8'));var client=jayson[_0x8240('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7377,_0x475136,_0x48831b){return new BPromise(function(_0x6922b2,_0x2cc931){return client[_0x8240('0xa')](_0x1d7377,_0x48831b)['then'](function(_0x232acc){logger['info'](_0x8240('0xb'),_0x475136,'request\x20sent');logger[_0x8240('0xc')](_0x8240('0xd'),_0x475136,'request\x20sent',JSON[_0x8240('0xe')](_0x232acc));if(_0x232acc[_0x8240('0xf')]){if(_0x232acc[_0x8240('0xf')][_0x8240('0x10')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x475136,_0x232acc[_0x8240('0xf')][_0x8240('0x11')]);return _0x2cc931(_0x232acc[_0x8240('0xf')][_0x8240('0x11')]);}logger[_0x8240('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x475136,_0x232acc[_0x8240('0xf')][_0x8240('0x11')]);return _0x6922b2(_0x232acc[_0x8240('0xf')][_0x8240('0x11')]);}else{logger[_0x8240('0x12')](_0x8240('0xb'),_0x475136,_0x8240('0x13'));_0x6922b2(_0x232acc[_0x8240('0x14')]['message']);}})[_0x8240('0x15')](function(_0x178683){logger[_0x8240('0xf')](_0x8240('0xb'),_0x475136,_0x178683);_0x2cc931(_0x178683);});});}exports[_0x8240('0x16')]=function(_0x19dde1){var _0xfa76f5=this;return new Promise(function(_0xda231c,_0x1162fa){return db[_0x8240('0x17')]['create'](_0x19dde1['body'],{'raw':_0x19dde1[_0x8240('0x18')]?_0x19dde1[_0x8240('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c3910){logger[_0x8240('0x12')](_0x8240('0x16'),_0x19dde1);logger[_0x8240('0xc')]('CreateChatQueueReport',_0x19dde1,JSON[_0x8240('0xe')](_0x4c3910));_0xda231c(_0x4c3910);})['catch'](function(_0x2c27a9){logger[_0x8240('0xf')](_0x8240('0x16'),_0x2c27a9[_0x8240('0x11')],_0x19dde1);_0x1162fa(_0xfa76f5[_0x8240('0xf')](0x1f4,_0x2c27a9[_0x8240('0x11')]));});});};exports[_0x8240('0x19')]=function(_0x56ce24){var _0x4737e1=this;return new Promise(function(_0x541e44,_0x3c1f06){return db['ChatQueueReport'][_0x8240('0x1a')](_0x56ce24['body'],{'raw':_0x56ce24['options']?_0x56ce24['options'][_0x8240('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56ce24[_0x8240('0x18')]?_0x56ce24[_0x8240('0x18')][_0x8240('0x1c')]||null:null,'attributes':_0x56ce24[_0x8240('0x18')]?_0x56ce24[_0x8240('0x18')]['attributes']||null:null,'limit':_0x56ce24[_0x8240('0x18')]?_0x56ce24[_0x8240('0x18')][_0x8240('0x1d')]||null:null})[_0x8240('0x1e')](function(_0x1efefc){logger[_0x8240('0x12')](_0x8240('0x19'),_0x56ce24);logger['debug'](_0x8240('0x19'),_0x56ce24,JSON[_0x8240('0xe')](_0x1efefc));_0x541e44(_0x1efefc);})[_0x8240('0x15')](function(_0x3106c5){logger['error'](_0x8240('0x19'),_0x3106c5[_0x8240('0x11')],_0x56ce24);_0x3c1f06(_0x4737e1['error'](0x1f4,_0x3106c5[_0x8240('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 9c2cf8f..0be6e40 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 _0x50c6=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x2fe0fe,_0x46da20){var _0x62d3f2=function(_0x3b722c){while(--_0x3b722c){_0x2fe0fe['push'](_0x2fe0fe['shift']());}};_0x62d3f2(++_0x46da20);}(_0x50c6,0x113));var _0x650c=function(_0x3650d1,_0x4d275e){_0x3650d1=_0x3650d1-0x0;var _0x32f21e=_0x50c6[_0x3650d1];return _0x32f21e;};'use strict';var multer=require(_0x650c('0x0'));var util=require(_0x650c('0x1'));var path=require(_0x650c('0x2'));var timeout=require(_0x650c('0x3'));var express=require(_0x650c('0x4'));var router=express[_0x650c('0x5')]();var fs_extra=require(_0x650c('0x6'));var auth=require(_0x650c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x650c('0x8'));var controller=require('./chatQueueReport.controller');router[_0x650c('0x9')]('/',auth[_0x650c('0xa')](),controller[_0x650c('0xb')]);router['get'](_0x650c('0xc'),auth[_0x650c('0xa')](),controller[_0x650c('0xd')]);router[_0x650c('0x9')](_0x650c('0xe'),auth[_0x650c('0xa')](),controller[_0x650c('0xf')]);router[_0x650c('0x10')]('/',auth[_0x650c('0xa')](),controller[_0x650c('0x11')]);router[_0x650c('0x12')](_0x650c('0xe'),auth['isAuthenticated'](),controller[_0x650c('0x13')]);router[_0x650c('0x14')]('/:id',auth[_0x650c('0xa')](),controller[_0x650c('0x15')]);module[_0x650c('0x16')]=router; \ No newline at end of file +var _0x10eb=['get','isAuthenticated','/describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./chatQueueReport.controller'];(function(_0x24b283,_0x510549){var _0x23d8a1=function(_0xc309f){while(--_0xc309f){_0x24b283['push'](_0x24b283['shift']());}};_0x23d8a1(++_0x510549);}(_0x10eb,0x106));var _0xb10e=function(_0x296e52,_0x428515){_0x296e52=_0x296e52-0x0;var _0x286070=_0x10eb[_0x296e52];return _0x286070;};'use strict';var multer=require(_0xb10e('0x0'));var util=require(_0xb10e('0x1'));var path=require(_0xb10e('0x2'));var timeout=require(_0xb10e('0x3'));var express=require('express');var router=express[_0xb10e('0x4')]();var fs_extra=require(_0xb10e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb10e('0x6'));var controller=require(_0xb10e('0x7'));router[_0xb10e('0x8')]('/',auth[_0xb10e('0x9')](),controller['index']);router['get'](_0xb10e('0xa'),auth[_0xb10e('0x9')](),controller['describe']);router['get'](_0xb10e('0xb'),auth[_0xb10e('0x9')](),controller[_0xb10e('0xc')]);router[_0xb10e('0xd')]('/',auth[_0xb10e('0x9')](),controller[_0xb10e('0xe')]);router['put'](_0xb10e('0xb'),auth[_0xb10e('0x9')](),controller[_0xb10e('0xf')]);router[_0xb10e('0x10')](_0xb10e('0xb'),auth[_0xb10e('0x9')](),controller['destroy']);module[_0xb10e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index d8b9fe1..8f8129f 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x39215e,_0x3938b9){var _0x443f38=function(_0x399f47){while(--_0x399f47){_0x39215e['push'](_0x39215e['shift']());}};_0x443f38(++_0x3938b9);}(_0xedd9,0xfc));var _0x9edd=function(_0x3431e2,_0x13b280){_0x3431e2=_0x3431e2-0x0;var _0x2cacfa=_0xedd9[_0x3431e2];return _0x2cacfa;};'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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x418815,_0x524351){var _0x3ab866=function(_0x2078e8){while(--_0x2078e8){_0x418815['push'](_0x418815['shift']());}};_0x3ab866(++_0x524351);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0xcb91[_0x541a67];return _0x45da2a;};'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 30be5ee..6f4a70d 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 _0x9d6e=['end','error','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then'];(function(_0x58a31f,_0x568175){var _0x4986a1=function(_0x29263e){while(--_0x29263e){_0x58a31f['push'](_0x58a31f['shift']());}};_0x4986a1(++_0x568175);}(_0x9d6e,0x111));var _0xe9d6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9d6e[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9d6('0x0'));var zipdir=require(_0xe9d6('0x1'));var jsonpatch=require(_0xe9d6('0x2'));var rp=require(_0xe9d6('0x3'));var moment=require(_0xe9d6('0x4'));var BPromise=require(_0xe9d6('0x5'));var Mustache=require(_0xe9d6('0x6'));var util=require('util');var path=require(_0xe9d6('0x7'));var sox=require(_0xe9d6('0x8'));var csv=require(_0xe9d6('0x9'));var ejs=require(_0xe9d6('0xa'));var fs=require('fs');var fs_extra=require(_0xe9d6('0xb'));var _=require(_0xe9d6('0xc'));var squel=require('squel');var crypto=require(_0xe9d6('0xd'));var jsforce=require(_0xe9d6('0xe'));var deskjs=require(_0xe9d6('0xf'));var toCsv=require(_0xe9d6('0x9'));var querystring=require(_0xe9d6('0x10'));var Papa=require('papaparse');var Redis=require(_0xe9d6('0x11'));var authService=require(_0xe9d6('0x12'));var qs=require(_0xe9d6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9d6('0x14'))(_0xe9d6('0x15'));var utils=require(_0xe9d6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe9d6('0x17'));var db=require(_0xe9d6('0x18'))['db'];function respondWithStatusCode(_0x21f5e9,_0x3784a6){_0x3784a6=_0x3784a6||0xcc;return function(_0x4ca6f5){if(_0x4ca6f5){return _0x21f5e9[_0xe9d6('0x19')](_0x3784a6);}return _0x21f5e9[_0xe9d6('0x1a')](_0x3784a6)['end']();};}function respondWithResult(_0x6a2634,_0x48bb43){_0x48bb43=_0x48bb43||0xc8;return function(_0x4a8058){if(_0x4a8058){return _0x6a2634['status'](_0x48bb43)['json'](_0x4a8058);}};}function respondWithFilteredResult(_0x41f905,_0x2e7781){return function(_0x228856){if(_0x228856){var _0xe8f2ad=typeof _0x2e7781['offset']===_0xe9d6('0x1b')&&typeof _0x2e7781[_0xe9d6('0x1c')]==='undefined';var _0x15aad0=_0x228856[_0xe9d6('0x1d')];var _0x3f71a3=_0xe8f2ad?0x0:_0x2e7781[_0xe9d6('0x1e')];var _0x18b506=_0xe8f2ad?_0x228856['count']:_0x2e7781['offset']+_0x2e7781[_0xe9d6('0x1c')];var _0x1d2999;if(_0x18b506>=_0x15aad0){_0x18b506=_0x15aad0;_0x1d2999=0xc8;}else{_0x1d2999=0xce;}_0x41f905['status'](_0x1d2999);return _0x41f905[_0xe9d6('0x1f')](_0xe9d6('0x20'),_0x3f71a3+'-'+_0x18b506+'/'+_0x15aad0)[_0xe9d6('0x21')](_0x228856);}return null;};}function patchUpdates(_0x296146){return function(_0x5417c3){try{jsonpatch[_0xe9d6('0x22')](_0x5417c3,_0x296146,!![]);}catch(_0x2ef86e){return BPromise['reject'](_0x2ef86e);}return _0x5417c3[_0xe9d6('0x23')]();};}function saveUpdates(_0x1dd090,_0x1b62c9){return function(_0x939813){if(_0x939813){return _0x939813[_0xe9d6('0x24')](_0x1dd090)['then'](function(_0x4b111d){return _0x4b111d;});}return null;};}function removeEntity(_0x2a3f9f,_0x16d5de){return function(_0x26bbaa){if(_0x26bbaa){return _0x26bbaa[_0xe9d6('0x25')]()[_0xe9d6('0x26')](function(){_0x2a3f9f[_0xe9d6('0x1a')](0xcc)[_0xe9d6('0x27')]();});}};}function handleEntityNotFound(_0x48155d,_0x36aa1e){return function(_0xef0156){if(!_0xef0156){_0x48155d[_0xe9d6('0x19')](0x194);}return _0xef0156;};}function handleError(_0x222fb4,_0x2f863a){_0x2f863a=_0x2f863a||0x1f4;return function(_0x228b61){logger[_0xe9d6('0x28')](_0x228b61[_0xe9d6('0x29')]);if(_0x228b61['name']){delete _0x228b61[_0xe9d6('0x2a')];}_0x222fb4[_0xe9d6('0x1a')](_0x2f863a)[_0xe9d6('0x2b')](_0x228b61);};}exports[_0xe9d6('0x2c')]=function(_0x4457ee,_0x2badf2){var _0x48d710={},_0x413f1a={},_0x14ba78={'count':0x0,'rows':[]};var _0x448a4e=_['map'](db[_0xe9d6('0x2d')][_0xe9d6('0x2e')],function(_0xdbd372){return{'name':_0xdbd372[_0xe9d6('0x2f')],'type':_0xdbd372[_0xe9d6('0x30')][_0xe9d6('0x31')]};});_0x413f1a[_0xe9d6('0x32')]=_[_0xe9d6('0x33')](_0x448a4e,_0xe9d6('0x2a'));_0x413f1a[_0xe9d6('0x34')]=_[_0xe9d6('0x35')](_0x4457ee[_0xe9d6('0x34')]);_0x413f1a[_0xe9d6('0x36')]=_['intersection'](_0x413f1a[_0xe9d6('0x32')],_0x413f1a[_0xe9d6('0x34')]);_0x48d710['attributes']=_[_0xe9d6('0x37')](_0x413f1a[_0xe9d6('0x32')],qs[_0xe9d6('0x38')](_0x4457ee['query']['fields']));_0x48d710[_0xe9d6('0x39')]=_0x48d710['attributes'][_0xe9d6('0x3a')]?_0x48d710[_0xe9d6('0x39')]:_0x413f1a['model'];if(!_0x4457ee[_0xe9d6('0x34')][_0xe9d6('0x3b')]('nolimit')){_0x48d710[_0xe9d6('0x1c')]=qs[_0xe9d6('0x1c')](_0x4457ee[_0xe9d6('0x34')]['limit']);_0x48d710[_0xe9d6('0x1e')]=qs[_0xe9d6('0x1e')](_0x4457ee[_0xe9d6('0x34')][_0xe9d6('0x1e')]);}_0x48d710[_0xe9d6('0x3c')]=qs[_0xe9d6('0x3d')](_0x4457ee['query'][_0xe9d6('0x3d')]);_0x48d710[_0xe9d6('0x3e')]=qs['filters'](_[_0xe9d6('0x3f')](_0x4457ee['query'],_0x413f1a[_0xe9d6('0x36')]),_0x448a4e);if(_0x4457ee[_0xe9d6('0x34')][_0xe9d6('0x40')]){_0x48d710[_0xe9d6('0x3e')]=_[_0xe9d6('0x41')](_0x48d710[_0xe9d6('0x3e')],{'$or':_[_0xe9d6('0x33')](_0x448a4e,function(_0x115cb9){if(_0x115cb9[_0xe9d6('0x30')]!==_0xe9d6('0x42')){var _0x31b9c9={};_0x31b9c9[_0x115cb9[_0xe9d6('0x2a')]]={'$like':'%'+_0x4457ee[_0xe9d6('0x34')][_0xe9d6('0x40')]+'%'};return _0x31b9c9;}})});}_0x48d710=_[_0xe9d6('0x41')]({},_0x48d710,_0x4457ee[_0xe9d6('0x43')]);var _0x548789={'where':_0x48d710[_0xe9d6('0x3e')]};return db[_0xe9d6('0x2d')]['count'](_0x548789)[_0xe9d6('0x26')](function(_0x31f890){_0x14ba78[_0xe9d6('0x1d')]=_0x31f890;if(_0x4457ee[_0xe9d6('0x34')][_0xe9d6('0x44')]){_0x48d710['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xe9d6('0x45')](_0x48d710);})[_0xe9d6('0x26')](function(_0x47c8d7){_0x14ba78[_0xe9d6('0x46')]=_0x47c8d7;return _0x14ba78;})[_0xe9d6('0x26')](respondWithFilteredResult(_0x2badf2,_0x48d710))[_0xe9d6('0x47')](handleError(_0x2badf2,null));};exports['show']=function(_0x3428c6,_0x31f95b){var _0x443ebf={'raw':!![],'where':{'id':_0x3428c6[_0xe9d6('0x48')]['id']}},_0x3a2331={};_0x3a2331['model']=_[_0xe9d6('0x35')](db[_0xe9d6('0x2d')][_0xe9d6('0x2e')]);_0x3a2331[_0xe9d6('0x34')]=_[_0xe9d6('0x35')](_0x3428c6[_0xe9d6('0x34')]);_0x3a2331[_0xe9d6('0x36')]=_[_0xe9d6('0x37')](_0x3a2331[_0xe9d6('0x32')],_0x3a2331[_0xe9d6('0x34')]);_0x443ebf[_0xe9d6('0x39')]=_['intersection'](_0x3a2331[_0xe9d6('0x32')],qs[_0xe9d6('0x38')](_0x3428c6['query'][_0xe9d6('0x38')]));_0x443ebf[_0xe9d6('0x39')]=_0x443ebf[_0xe9d6('0x39')][_0xe9d6('0x3a')]?_0x443ebf['attributes']:_0x3a2331[_0xe9d6('0x32')];if(_0x3428c6['query'][_0xe9d6('0x44')]){_0x443ebf[_0xe9d6('0x49')]=[{'all':!![]}];}_0x443ebf=_[_0xe9d6('0x41')]({},_0x443ebf,_0x3428c6['options']);return db[_0xe9d6('0x2d')][_0xe9d6('0x4a')](_0x443ebf)['then'](handleEntityNotFound(_0x31f95b,null))['then'](respondWithResult(_0x31f95b,null))[_0xe9d6('0x47')](handleError(_0x31f95b,null));};exports['create']=function(_0xac3382,_0x21247b){return db['ChatTransferReport'][_0xe9d6('0x4b')](_0xac3382[_0xe9d6('0x4c')],{})['then'](respondWithResult(_0x21247b,0xc9))[_0xe9d6('0x47')](handleError(_0x21247b,null));};exports[_0xe9d6('0x24')]=function(_0x28aee5,_0x4a7237){if(_0x28aee5[_0xe9d6('0x4c')]['id']){delete _0x28aee5[_0xe9d6('0x4c')]['id'];}return db[_0xe9d6('0x2d')][_0xe9d6('0x4a')]({'where':{'id':_0x28aee5['params']['id']}})[_0xe9d6('0x26')](handleEntityNotFound(_0x4a7237,null))[_0xe9d6('0x26')](saveUpdates(_0x28aee5[_0xe9d6('0x4c')],null))[_0xe9d6('0x26')](respondWithResult(_0x4a7237,null))[_0xe9d6('0x47')](handleError(_0x4a7237,null));};exports[_0xe9d6('0x25')]=function(_0x4325e1,_0x45c685){return db[_0xe9d6('0x2d')][_0xe9d6('0x4a')]({'where':{'id':_0x4325e1[_0xe9d6('0x48')]['id']}})[_0xe9d6('0x26')](handleEntityNotFound(_0x45c685,null))[_0xe9d6('0x26')](removeEntity(_0x45c685,null))[_0xe9d6('0x47')](handleError(_0x45c685,null));};exports[_0xe9d6('0x4d')]=function(_0x1a26fe,_0x5c2d6c){return db[_0xe9d6('0x2d')][_0xe9d6('0x4d')]()['then'](respondWithResult(_0x5c2d6c,null))[_0xe9d6('0x47')](handleError(_0x5c2d6c,null));}; \ No newline at end of file +var _0x4faa=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','then','destroy','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','params','catch','describe','eml-format','rimraf','moment'];(function(_0x3b5067,_0x402005){var _0x43a3b0=function(_0x4278c6){while(--_0x4278c6){_0x3b5067['push'](_0x3b5067['shift']());}};_0x43a3b0(++_0x402005);}(_0x4faa,0x8f));var _0xa4fa=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x4faa[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0xa4fa('0x0'));var rimraf=require(_0xa4fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa4fa('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa4fa('0x3'));var util=require(_0xa4fa('0x4'));var path=require(_0xa4fa('0x5'));var sox=require('sox');var csv=require(_0xa4fa('0x6'));var ejs=require(_0xa4fa('0x7'));var fs=require('fs');var fs_extra=require(_0xa4fa('0x8'));var _=require(_0xa4fa('0x9'));var squel=require(_0xa4fa('0xa'));var crypto=require(_0xa4fa('0xb'));var jsforce=require(_0xa4fa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa4fa('0x6'));var querystring=require(_0xa4fa('0xd'));var Papa=require(_0xa4fa('0xe'));var Redis=require('ioredis');var authService=require(_0xa4fa('0xf'));var qs=require(_0xa4fa('0x10'));var as=require(_0xa4fa('0x11'));var hardwareService=require(_0xa4fa('0x12'));var logger=require(_0xa4fa('0x13'))(_0xa4fa('0x14'));var utils=require(_0xa4fa('0x15'));var config=require(_0xa4fa('0x16'));var licenseUtil=require(_0xa4fa('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a9bfd,_0x431690){_0x431690=_0x431690||0xcc;return function(_0x3e8020){if(_0x3e8020){return _0x1a9bfd[_0xa4fa('0x18')](_0x431690);}return _0x1a9bfd[_0xa4fa('0x19')](_0x431690)[_0xa4fa('0x1a')]();};}function respondWithResult(_0x2cf4b5,_0x37b346){_0x37b346=_0x37b346||0xc8;return function(_0xf4b493){if(_0xf4b493){return _0x2cf4b5[_0xa4fa('0x19')](_0x37b346)[_0xa4fa('0x1b')](_0xf4b493);}};}function respondWithFilteredResult(_0x1f1871,_0x31fcce){return function(_0xa1c46d){if(_0xa1c46d){var _0x413a62=typeof _0x31fcce[_0xa4fa('0x1c')]===_0xa4fa('0x1d')&&typeof _0x31fcce[_0xa4fa('0x1e')]==='undefined';var _0xf75196=_0xa1c46d[_0xa4fa('0x1f')];var _0xb9b90d=_0x413a62?0x0:_0x31fcce[_0xa4fa('0x1c')];var _0x2bfd0c=_0x413a62?_0xa1c46d[_0xa4fa('0x1f')]:_0x31fcce[_0xa4fa('0x1c')]+_0x31fcce['limit'];var _0x456448;if(_0x2bfd0c>=_0xf75196){_0x2bfd0c=_0xf75196;_0x456448=0xc8;}else{_0x456448=0xce;}_0x1f1871[_0xa4fa('0x19')](_0x456448);return _0x1f1871['set']('Content-Range',_0xb9b90d+'-'+_0x2bfd0c+'/'+_0xf75196)[_0xa4fa('0x1b')](_0xa1c46d);}return null;};}function patchUpdates(_0x2de93c){return function(_0x114431){try{jsonpatch[_0xa4fa('0x20')](_0x114431,_0x2de93c,!![]);}catch(_0x4c3978){return BPromise['reject'](_0x4c3978);}return _0x114431['save']();};}function saveUpdates(_0x478ae2,_0x948f85){return function(_0x91fb2e){if(_0x91fb2e){return _0x91fb2e['update'](_0x478ae2)[_0xa4fa('0x21')](function(_0x337ae6){return _0x337ae6;});}return null;};}function removeEntity(_0x113524,_0x42c676){return function(_0x36af3f){if(_0x36af3f){return _0x36af3f[_0xa4fa('0x22')]()[_0xa4fa('0x21')](function(){_0x113524[_0xa4fa('0x19')](0xcc)[_0xa4fa('0x1a')]();});}};}function handleEntityNotFound(_0x52e14c,_0x4e430e){return function(_0x528a3c){if(!_0x528a3c){_0x52e14c[_0xa4fa('0x18')](0x194);}return _0x528a3c;};}function handleError(_0x18dd3f,_0x302d80){_0x302d80=_0x302d80||0x1f4;return function(_0x182b10){logger[_0xa4fa('0x23')](_0x182b10[_0xa4fa('0x24')]);if(_0x182b10[_0xa4fa('0x25')]){delete _0x182b10[_0xa4fa('0x25')];}_0x18dd3f['status'](_0x302d80)[_0xa4fa('0x26')](_0x182b10);};}exports['index']=function(_0x2a96d2,_0xd28914){var _0x3f9974={},_0x110011={},_0xf987a6={'count':0x0,'rows':[]};var _0x3c2953=_[_0xa4fa('0x27')](db[_0xa4fa('0x28')][_0xa4fa('0x29')],function(_0x3be477){return{'name':_0x3be477[_0xa4fa('0x2a')],'type':_0x3be477['type'][_0xa4fa('0x2b')]};});_0x110011[_0xa4fa('0x2c')]=_['map'](_0x3c2953,'name');_0x110011['query']=_[_0xa4fa('0x2d')](_0x2a96d2[_0xa4fa('0x2e')]);_0x110011['filters']=_[_0xa4fa('0x2f')](_0x110011[_0xa4fa('0x2c')],_0x110011[_0xa4fa('0x2e')]);_0x3f9974[_0xa4fa('0x30')]=_[_0xa4fa('0x2f')](_0x110011[_0xa4fa('0x2c')],qs['fields'](_0x2a96d2[_0xa4fa('0x2e')]['fields']));_0x3f9974[_0xa4fa('0x30')]=_0x3f9974['attributes'][_0xa4fa('0x31')]?_0x3f9974[_0xa4fa('0x30')]:_0x110011[_0xa4fa('0x2c')];if(!_0x2a96d2[_0xa4fa('0x2e')][_0xa4fa('0x32')](_0xa4fa('0x33'))){_0x3f9974[_0xa4fa('0x1e')]=qs[_0xa4fa('0x1e')](_0x2a96d2[_0xa4fa('0x2e')]['limit']);_0x3f9974[_0xa4fa('0x1c')]=qs[_0xa4fa('0x1c')](_0x2a96d2[_0xa4fa('0x2e')][_0xa4fa('0x1c')]);}_0x3f9974[_0xa4fa('0x34')]=qs[_0xa4fa('0x35')](_0x2a96d2[_0xa4fa('0x2e')][_0xa4fa('0x35')]);_0x3f9974['where']=qs[_0xa4fa('0x36')](_[_0xa4fa('0x37')](_0x2a96d2[_0xa4fa('0x2e')],_0x110011[_0xa4fa('0x36')]),_0x3c2953);if(_0x2a96d2['query'][_0xa4fa('0x38')]){_0x3f9974[_0xa4fa('0x39')]=_[_0xa4fa('0x3a')](_0x3f9974[_0xa4fa('0x39')],{'$or':_[_0xa4fa('0x27')](_0x3c2953,function(_0x478450){if(_0x478450[_0xa4fa('0x3b')]!==_0xa4fa('0x3c')){var _0x353f0c={};_0x353f0c[_0x478450[_0xa4fa('0x25')]]={'$like':'%'+_0x2a96d2[_0xa4fa('0x2e')][_0xa4fa('0x38')]+'%'};return _0x353f0c;}})});}_0x3f9974=_['merge']({},_0x3f9974,_0x2a96d2[_0xa4fa('0x3d')]);var _0x50ee29={'where':_0x3f9974[_0xa4fa('0x39')]};return db[_0xa4fa('0x28')][_0xa4fa('0x1f')](_0x50ee29)[_0xa4fa('0x21')](function(_0x27f5f1){_0xf987a6[_0xa4fa('0x1f')]=_0x27f5f1;if(_0x2a96d2[_0xa4fa('0x2e')][_0xa4fa('0x3e')]){_0x3f9974[_0xa4fa('0x3f')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xa4fa('0x40')](_0x3f9974);})[_0xa4fa('0x21')](function(_0x2473b5){_0xf987a6[_0xa4fa('0x41')]=_0x2473b5;return _0xf987a6;})[_0xa4fa('0x21')](respondWithFilteredResult(_0xd28914,_0x3f9974))['catch'](handleError(_0xd28914,null));};exports[_0xa4fa('0x42')]=function(_0x103d88,_0x285e88){var _0x370198={'raw':!![],'where':{'id':_0x103d88['params']['id']}},_0x5aa283={};_0x5aa283[_0xa4fa('0x2c')]=_[_0xa4fa('0x2d')](db['ChatTransferReport'][_0xa4fa('0x29')]);_0x5aa283[_0xa4fa('0x2e')]=_[_0xa4fa('0x2d')](_0x103d88[_0xa4fa('0x2e')]);_0x5aa283[_0xa4fa('0x36')]=_['intersection'](_0x5aa283[_0xa4fa('0x2c')],_0x5aa283[_0xa4fa('0x2e')]);_0x370198[_0xa4fa('0x30')]=_[_0xa4fa('0x2f')](_0x5aa283['model'],qs['fields'](_0x103d88[_0xa4fa('0x2e')]['fields']));_0x370198[_0xa4fa('0x30')]=_0x370198['attributes'][_0xa4fa('0x31')]?_0x370198['attributes']:_0x5aa283['model'];if(_0x103d88[_0xa4fa('0x2e')][_0xa4fa('0x3e')]){_0x370198['include']=[{'all':!![]}];}_0x370198=_[_0xa4fa('0x3a')]({},_0x370198,_0x103d88[_0xa4fa('0x3d')]);return db['ChatTransferReport'][_0xa4fa('0x43')](_0x370198)['then'](handleEntityNotFound(_0x285e88,null))['then'](respondWithResult(_0x285e88,null))['catch'](handleError(_0x285e88,null));};exports[_0xa4fa('0x44')]=function(_0x4ce7a4,_0x393e7f){return db[_0xa4fa('0x28')]['create'](_0x4ce7a4[_0xa4fa('0x45')],{})['then'](respondWithResult(_0x393e7f,0xc9))['catch'](handleError(_0x393e7f,null));};exports['update']=function(_0x49b382,_0x533c8a){if(_0x49b382['body']['id']){delete _0x49b382['body']['id'];}return db[_0xa4fa('0x28')]['find']({'where':{'id':_0x49b382[_0xa4fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x533c8a,null))[_0xa4fa('0x21')](saveUpdates(_0x49b382[_0xa4fa('0x45')],null))[_0xa4fa('0x21')](respondWithResult(_0x533c8a,null))[_0xa4fa('0x47')](handleError(_0x533c8a,null));};exports[_0xa4fa('0x22')]=function(_0x581366,_0x4535f0){return db[_0xa4fa('0x28')]['find']({'where':{'id':_0x581366['params']['id']}})['then'](handleEntityNotFound(_0x4535f0,null))[_0xa4fa('0x21')](removeEntity(_0x4535f0,null))[_0xa4fa('0x47')](handleError(_0x4535f0,null));};exports[_0xa4fa('0x48')]=function(_0x54463f,_0x233928){return db['ChatTransferReport'][_0xa4fa('0x48')]()[_0xa4fa('0x21')](respondWithResult(_0x233928,null))[_0xa4fa('0x47')](handleError(_0x233928,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 61b9b5e..309b547 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 _0x0544=['path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x26ba35,_0x3816f5){var _0x1d073e=function(_0x7ff982){while(--_0x7ff982){_0x26ba35['push'](_0x26ba35['shift']());}};_0x1d073e(++_0x3816f5);}(_0x0544,0x6b));var _0x4054=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0x0544[_0x2136a6];return _0x55b948;};'use strict';var _=require('lodash');var util=require(_0x4054('0x0'));var logger=require(_0x4054('0x1'))('api');var moment=require(_0x4054('0x2'));var BPromise=require(_0x4054('0x3'));var rp=require(_0x4054('0x4'));var fs=require('fs');var path=require(_0x4054('0x5'));var rimraf=require(_0x4054('0x6'));var config=require(_0x4054('0x7'));var attributes=require(_0x4054('0x8'));module[_0x4054('0x9')]=function(_0x37e492,_0x4ef540){return _0x37e492[_0x4054('0xa')](_0x4054('0xb'),attributes,{'tableName':_0x4054('0xc'),'paranoid':![],'indexes':[{'name':_0x4054('0xd'),'fields':[_0x4054('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9db8=['lodash','util','../../config/logger','moment','request-promise','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid'];(function(_0x512a50,_0x3057c2){var _0x57c236=function(_0x59338c){while(--_0x59338c){_0x512a50['push'](_0x512a50['shift']());}};_0x57c236(++_0x3057c2);}(_0x9db8,0x14a));var _0x89db=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x9db8[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0x89db('0x0'));var util=require(_0x89db('0x1'));var logger=require(_0x89db('0x2'))('api');var moment=require(_0x89db('0x3'));var BPromise=require('bluebird');var rp=require(_0x89db('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x89db('0x5'));var attributes=require(_0x89db('0x6'));module[_0x89db('0x7')]=function(_0x3e5a70,_0x2ae77e){return _0x3e5a70[_0x89db('0x8')](_0x89db('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x89db('0xa'),'fields':[_0x89db('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 19dce5f..d2774cb 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 _0x305f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util'];(function(_0x47e41e,_0x12bf58){var _0xf81f18=function(_0x217456){while(--_0x217456){_0x47e41e['push'](_0x47e41e['shift']());}};_0xf81f18(++_0x12bf58);}(_0x305f,0x1c6));var _0xf305=function(_0x1b0bd0,_0xbbe219){_0x1b0bd0=_0x1b0bd0-0x0;var _0x2a0018=_0x305f[_0x1b0bd0];return _0x2a0018;};'use strict';var _=require(_0xf305('0x0'));var util=require(_0xf305('0x1'));var moment=require(_0xf305('0x2'));var BPromise=require(_0xf305('0x3'));var rs=require(_0xf305('0x4'));var fs=require('fs');var Redis=require(_0xf305('0x5'));var db=require(_0xf305('0x6'))['db'];var utils=require(_0xf305('0x7'));var logger=require('../../config/logger')(_0xf305('0x8'));var config=require('../../config/environment');var jayson=require(_0xf305('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x176f8c,_0xd87da6,_0x2e1d5b){return new BPromise(function(_0x29d811,_0x338014){return client[_0xf305('0xa')](_0x176f8c,_0x2e1d5b)['then'](function(_0x33a479){logger[_0xf305('0xb')](_0xf305('0xc'),_0xd87da6,_0xf305('0xd'));logger[_0xf305('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xd87da6,_0xf305('0xd'),JSON['stringify'](_0x33a479));if(_0x33a479[_0xf305('0xf')]){if(_0x33a479[_0xf305('0xf')][_0xf305('0x10')]===0x1f4){logger[_0xf305('0xf')](_0xf305('0xc'),_0xd87da6,_0x33a479[_0xf305('0xf')][_0xf305('0x11')]);return _0x338014(_0x33a479[_0xf305('0xf')][_0xf305('0x11')]);}logger['error'](_0xf305('0xc'),_0xd87da6,_0x33a479['error'][_0xf305('0x11')]);return _0x29d811(_0x33a479[_0xf305('0xf')][_0xf305('0x11')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0xd87da6,_0xf305('0xd'));_0x29d811(_0x33a479[_0xf305('0x12')]['message']);}})['catch'](function(_0x42edb8){logger[_0xf305('0xf')](_0xf305('0xc'),_0xd87da6,_0x42edb8);_0x338014(_0x42edb8);});});} \ No newline at end of file +var _0x737f=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','lodash','util','moment'];(function(_0xd72e20,_0x1b7c31){var _0xe99992=function(_0x33f902){while(--_0x33f902){_0xd72e20['push'](_0xd72e20['shift']());}};_0xe99992(++_0x1b7c31);}(_0x737f,0x1d8));var _0xf737=function(_0x14a36e,_0x43c479){_0x14a36e=_0x14a36e-0x0;var _0x958c2c=_0x737f[_0x14a36e];return _0x958c2c;};'use strict';var _=require(_0xf737('0x0'));var util=require(_0xf737('0x1'));var moment=require(_0xf737('0x2'));var BPromise=require('bluebird');var rs=require(_0xf737('0x3'));var fs=require('fs');var Redis=require(_0xf737('0x4'));var db=require(_0xf737('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf737('0x6'));var config=require(_0xf737('0x7'));var jayson=require(_0xf737('0x8'));var client=jayson['client'][_0xf737('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x331837,_0x289eaa,_0x493942){return new BPromise(function(_0xc9e977,_0x5bdb46){return client['request'](_0x331837,_0x493942)[_0xf737('0xa')](function(_0x2f2e29){logger[_0xf737('0xb')](_0xf737('0xc'),_0x289eaa,'request\x20sent');logger[_0xf737('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x289eaa,_0xf737('0xe'),JSON[_0xf737('0xf')](_0x2f2e29));if(_0x2f2e29['error']){if(_0x2f2e29['error']['code']===0x1f4){logger[_0xf737('0x10')](_0xf737('0xc'),_0x289eaa,_0x2f2e29[_0xf737('0x10')][_0xf737('0x11')]);return _0x5bdb46(_0x2f2e29[_0xf737('0x10')][_0xf737('0x11')]);}logger[_0xf737('0x10')](_0xf737('0xc'),_0x289eaa,_0x2f2e29['error'][_0xf737('0x11')]);return _0xc9e977(_0x2f2e29[_0xf737('0x10')][_0xf737('0x11')]);}else{logger[_0xf737('0xb')](_0xf737('0xc'),_0x289eaa,_0xf737('0xe'));_0xc9e977(_0x2f2e29['result']['message']);}})[_0xf737('0x12')](function(_0x2be4bd){logger[_0xf737('0x10')](_0xf737('0xc'),_0x289eaa,_0x2be4bd);_0x5bdb46(_0x2be4bd);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 4de85b8..ea13ccf 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 _0x4911=['get','describe','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x5b8c2f,_0x20bb13){var _0x425952=function(_0x5c604a){while(--_0x5c604a){_0x5b8c2f['push'](_0x5b8c2f['shift']());}};_0x425952(++_0x20bb13);}(_0x4911,0x7c));var _0x1491=function(_0x5d289a,_0x352880){_0x5d289a=_0x5d289a-0x0;var _0x14bd5f=_0x4911[_0x5d289a];return _0x14bd5f;};'use strict';var multer=require(_0x1491('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1491('0x1'));var express=require(_0x1491('0x2'));var router=express[_0x1491('0x3')]();var fs_extra=require(_0x1491('0x4'));var auth=require(_0x1491('0x5'));var interaction=require(_0x1491('0x6'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x1491('0x7')](),controller[_0x1491('0x8')]);router[_0x1491('0x9')]('/describe',auth[_0x1491('0x7')](),controller[_0x1491('0xa')]);router[_0x1491('0x9')](_0x1491('0xb'),auth['isAuthenticated'](),controller[_0x1491('0xc')]);router['post']('/',auth[_0x1491('0x7')](),controller[_0x1491('0xd')]);router[_0x1491('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1491('0xf')]);router[_0x1491('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1491('0x11')]);module[_0x1491('0x12')]=router; \ No newline at end of file +var _0x83d4=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete'];(function(_0x3ba537,_0x56b969){var _0x585c1a=function(_0x1dd30b){while(--_0x1dd30b){_0x3ba537['push'](_0x3ba537['shift']());}};_0x585c1a(++_0x56b969);}(_0x83d4,0x178));var _0x483d=function(_0x149cb4,_0x400116){_0x149cb4=_0x149cb4-0x0;var _0x3c7207=_0x83d4[_0x149cb4];return _0x3c7207;};'use strict';var multer=require(_0x483d('0x0'));var util=require(_0x483d('0x1'));var path=require(_0x483d('0x2'));var timeout=require(_0x483d('0x3'));var express=require(_0x483d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x483d('0x5'));var interaction=require(_0x483d('0x6'));var config=require(_0x483d('0x7'));var controller=require(_0x483d('0x8'));router[_0x483d('0x9')]('/',auth[_0x483d('0xa')](),controller[_0x483d('0xb')]);router['get'](_0x483d('0xc'),auth[_0x483d('0xa')](),controller['describe']);router[_0x483d('0x9')]('/:id',auth[_0x483d('0xa')](),controller[_0x483d('0xd')]);router[_0x483d('0xe')]('/',auth[_0x483d('0xa')](),controller[_0x483d('0xf')]);router[_0x483d('0x10')](_0x483d('0x11'),auth[_0x483d('0xa')](),controller[_0x483d('0x12')]);router[_0x483d('0x13')](_0x483d('0x11'),auth[_0x483d('0xa')](),controller[_0x483d('0x14')]);module[_0x483d('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index bb914e9..f529284 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 _0xf3cd=['rounded','squared','We\x20are\x20here!','Chat','Send','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM'];(function(_0x255cab,_0x53a59e){var _0x53fd8b=function(_0x4268c4){while(--_0x4268c4){_0x255cab['push'](_0x255cab['shift']());}};_0x53fd8b(++_0x53a59e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4131da,_0x124783){_0x4131da=_0x4131da-0x0;var _0x583242=_0xf3cd[_0x4131da];return _0x583242;};'use strict';var Sequelize=require(_0xdf3c('0x0'));var rs=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'name':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![],'unique':_0xdf3c('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x5')},'mapKeyOffline':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x6')},'customerAlias':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![],'defaultValue':_0xdf3c('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdf3c('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![],'defaultValue':_0xdf3c('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xdf3c('0x3')]},'animation':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xdf3c('0xa')](_0xdf3c('0xb'),_0xdf3c('0xc')),'defaultValue':_0xdf3c('0xb')},'header_online':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0xd')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xdf3c('0xe')},'offline_chat_button':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0xf')},'header_offline':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdf3c('0x10')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xdf3c('0x11')]},'closingQuestion':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x14')},'noteTitle':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x15')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdf3c('0x16')},'closingMessage':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x17')},'closingMessageButton':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0xf')},'skipMessageButton':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x18')},'conditionAgreement':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x19')},'ratingType':{'type':Sequelize['ENUM']('star',_0xdf3c('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xdf3c('0x10')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xdf3c('0x11')],'defaultValue':function(){return JSON[_0xdf3c('0x1b')]({'items':[{'type':_0xdf3c('0x1c'),'variable':null,'config':{'placeholder':_0xdf3c('0x1d'),'type':_0xdf3c('0x1e'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xdf3c('0x1c'),'props':{'title':_0xdf3c('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xdf3c('0x5'),'type':_0xdf3c('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xdf3c('0x1f')](_0xdf3c('0x20'))?JSON[_0xdf3c('0x21')](this[_0xdf3c('0x1f')](_0xdf3c('0x20'))):{};},'set':function(_0x1adee4){return this['setDataValue'](_0xdf3c('0x20'),JSON[_0xdf3c('0x1b')](_0x1adee4));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xdf3c('0x1b')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xdf3c('0x5')},'variable':null},{'type':_0xdf3c('0x22'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xdf3c('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xdf3c('0x1f')](_0xdf3c('0x24'))?JSON[_0xdf3c('0x21')](this['getDataValue'](_0xdf3c('0x24'))):{};},'set':function(_0x2a2d94){return this['setDataValue']('offlineForm',JSON[_0xdf3c('0x1b')](_0x2a2d94));}},'token':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':function(){return rs[_0xdf3c('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xdf3c('0x3')]},'forwardOffline':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x26')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdf3c('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x28')},'offlineMessageBody':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x29')},'skipUnmanaged':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xdf3c('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xdf3c('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xdf3c('0x2b')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x2c')},'messagesAlignment':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x2d')},'defaultTitle':{'type':Sequelize[_0xdf3c('0x3')]},'customerAvatar':{'type':Sequelize[_0xdf3c('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xdf3c('0x10')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdf3c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xdf3c('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdf3c('0x10')],'comment':_0xdf3c('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![],'comment':_0xdf3c('0x30'),'set':function(_0x3098cb){if(!_0x3098cb)this[_0xdf3c('0x31')](_0xdf3c('0x32'),null);this[_0xdf3c('0x31')](_0xdf3c('0x33'),_0x3098cb);}},'vidaooEscalation':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xdf3c('0x3')]},'vidaooTopic':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xdf3c('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xdf3c('0x11')]}}; \ No newline at end of file +var _0xf109=['#011F6A','#ffffff','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','INTEGER','stringify','input','name','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','TEXT','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','sequelize','randomstring','exports','STRING','email','Agent'];(function(_0x4d6dba,_0x2769b9){var _0x5680ff=function(_0x5dc8b5){while(--_0x5dc8b5){_0x4d6dba['push'](_0x4d6dba['shift']());}};_0x5680ff(++_0x2769b9);}(_0xf109,0xce));var _0x9f10=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xf109[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require(_0x9f10('0x0'));var rs=require(_0x9f10('0x1'));module[_0x9f10('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x9f10('0x3')]},'mapKey':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x4')},'mapKeyOffline':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x4')},'key':{'type':Sequelize[_0x9f10('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x5')},'customerAlias':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9f10('0x3')],'allowNull':![],'defaultValue':_0x9f10('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9f10('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9f10('0x3')],'allowNull':![],'defaultValue':_0x9f10('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x9f10('0x3')],'allowNull':![],'defaultValue':_0x9f10('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9f10('0x3')]},'animation':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x9f10('0x9')]('rounded','squared'),'defaultValue':_0x9f10('0xa')},'header_online':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0xc')},'offline_chat_button':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0xe')},'download_transcript':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x12')},'noteTitle':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0xd')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x16')},'ratingType':{'type':Sequelize[_0x9f10('0x9')](_0x9f10('0x17'),_0x9f10('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x9f10('0x19')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x9f10('0x1a')]({'items':[{'type':_0x9f10('0x1b'),'variable':null,'config':{'placeholder':_0x9f10('0x1c'),'type':'text','required':!![]},'props':{'title':_0x9f10('0x1c'),'helpText':''}},{'type':_0x9f10('0x1b'),'props':{'title':_0x9f10('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x9f10('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9f10('0x1d')](_0x9f10('0x1e'))?JSON['parse'](this[_0x9f10('0x1d')](_0x9f10('0x1e'))):{};},'set':function(_0x11cae7){return this[_0x9f10('0x1f')]('onlineForm',JSON['stringify'](_0x11cae7));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x9f10('0x1a')]({'items':[{'type':'input','props':{'title':_0x9f10('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x9f10('0x4'),'type':_0x9f10('0x4')},'variable':null},{'type':_0x9f10('0x20'),'config':{'placeholder':_0x9f10('0x21')},'props':{'title':'Comments','helpText':_0x9f10('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x9f10('0x1d')](_0x9f10('0x23'))?JSON[_0x9f10('0x24')](this[_0x9f10('0x1d')](_0x9f10('0x23'))):{};},'set':function(_0x581b1d){return this[_0x9f10('0x1f')](_0x9f10('0x23'),JSON[_0x9f10('0x1a')](_0x581b1d));}},'token':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x25')},'waitingMessage':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x26')},'offlineMessageBody':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x15')},'sendUnmanaged':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9f10('0x29')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9f10('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9f10('0x29')],'defaultValue':function(){return _0x9f10('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x2c')},'verticalAlignment':{'type':Sequelize[_0x9f10('0x19')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x2d')},'messagesAlignment':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x2e')},'defaultTitle':{'type':Sequelize[_0x9f10('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9f10('0x19')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9f10('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9f10('0x19')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9f10('0x19')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9f10('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![],'comment':_0x9f10('0x31'),'set':function(_0x433e70){if(!_0x433e70)this[_0x9f10('0x1f')](_0x9f10('0x32'),null);this[_0x9f10('0x1f')](_0x9f10('0x33'),_0x433e70);}},'vidaooEscalation':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9f10('0x3')]},'vidaooTopic':{'type':Sequelize[_0x9f10('0x3')],'allowNull':![],'defaultValue':_0x9f10('0x34')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 9b5aec1..3eee0af 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 _0xd73b=['sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','finally','getApplications','addProactiveActions','omit','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','status','json','undefined','limit','offset','count','Content-Range','update','destroy','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','findAll','catch','show','mandatoryDispositionPause','includeAll','options','create','body','user','get','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','sort','include','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','ValidationError','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','Applications','list','applications','priority','asc','account','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','firstName','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','CompanyId','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','basename','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','subjectOffline','email','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','../../config/license/util','virtual','License','increment','chatLicenseExceeded','some','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','textButtonColor','backgroundColor','hideWhenOffline','addApplications'];(function(_0x4d235a,_0x581a63){var _0x261f27=function(_0x44e838){while(--_0x44e838){_0x4d235a['push'](_0x4d235a['shift']());}};_0x261f27(++_0x581a63);}(_0xd73b,0x14c));var _0xbd73=function(_0x405227,_0x52d46a){_0x405227=_0x405227-0x0;var _0x667fee=_0xd73b[_0x405227];return _0x667fee;};'use strict';var BPromise=require(_0xbd73('0x0'));var Mustache=require(_0xbd73('0x1'));var util=require(_0xbd73('0x2'));var path=require(_0xbd73('0x3'));var ejs=require(_0xbd73('0x4'));var fs=require('fs');var fs_extra=require(_0xbd73('0x5'));var _=require(_0xbd73('0x6'));var querystring=require(_0xbd73('0x7'));var Redis=require(_0xbd73('0x8'));var qs=require(_0xbd73('0x9'));var logger=require(_0xbd73('0xa'))(_0xbd73('0xb'));var config=require(_0xbd73('0xc'));var db=require(_0xbd73('0xd'))['db'];config[_0xbd73('0xe')]=_[_0xbd73('0xf')](config['redis'],{'host':_0xbd73('0x10'),'port':0x18eb});var socket=require(_0xbd73('0x11'))(new Redis(config[_0xbd73('0xe')]));require(_0xbd73('0x12'))[_0xbd73('0x13')](socket);var htmlToText=require(_0xbd73('0x14'));var jayson=require(_0xbd73('0x15'));var client=jayson[_0xbd73('0x16')][_0xbd73('0x17')]({'port':0x232c});var client9002=jayson[_0xbd73('0x16')][_0xbd73('0x17')]({'port':0x232a});var client9003=jayson[_0xbd73('0x16')][_0xbd73('0x17')]({'port':0x232b});var client9001=jayson['client'][_0xbd73('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x40f731,_0x1d6fd3,_0x2025f8,_0x192569){return new BPromise(function(_0x30105f,_0x577266){var _0x105c3f=_0x192569||client;return _0x105c3f[_0xbd73('0x18')](_0x40f731,_0x2025f8)[_0xbd73('0x19')](function(_0x2eb35c){logger[_0xbd73('0x1a')](_0xbd73('0x1b'),_0x1d6fd3,'request\x20sent');logger[_0xbd73('0x1c')](_0xbd73('0x1d'),_0x1d6fd3,'request\x20sent',JSON[_0xbd73('0x1e')](_0x2eb35c));if(_0x2eb35c[_0xbd73('0x1f')]){if(_0x2eb35c['error'][_0xbd73('0x20')]===0x1f4){logger['error'](_0xbd73('0x1b'),_0x1d6fd3,_0x2eb35c[_0xbd73('0x1f')][_0xbd73('0x21')]);return _0x577266(_0x2eb35c[_0xbd73('0x1f')][_0xbd73('0x21')]);}logger[_0xbd73('0x1f')](_0xbd73('0x1b'),_0x1d6fd3,_0x2eb35c[_0xbd73('0x1f')]['message']);return _0x30105f(_0x2eb35c[_0xbd73('0x1f')][_0xbd73('0x21')]);}else{logger[_0xbd73('0x1a')](_0xbd73('0x1b'),_0x1d6fd3,_0xbd73('0x22'));_0x30105f(_0x2eb35c[_0xbd73('0x23')][_0xbd73('0x21')]);}})['catch'](function(_0x5cd2cc){logger[_0xbd73('0x1f')](_0xbd73('0x1b'),_0x1d6fd3,_0x5cd2cc);_0x577266(_0x5cd2cc);});});}function respondWithStatusCode(_0x439da1,_0x58b575){_0x58b575=_0x58b575||0xcc;return function(_0x588a26){if(_0x588a26){return _0x439da1['sendStatus'](_0x58b575);}return _0x439da1[_0xbd73('0x24')](_0x58b575)['end']();};}function respondWithResult(_0x83ab9f,_0x127581){_0x127581=_0x127581||0xc8;return function(_0x3069c3){if(_0x3069c3){return _0x83ab9f[_0xbd73('0x24')](_0x127581)[_0xbd73('0x25')](_0x3069c3);}};}function respondWithFilteredResult(_0x18f58d,_0x468e6a){return function(_0x22c2ab){if(_0x22c2ab){var _0x3d966a=typeof _0x468e6a['offset']===_0xbd73('0x26')&&typeof _0x468e6a[_0xbd73('0x27')]===_0xbd73('0x26');var _0x151795=_0x22c2ab['count'];var _0x23ffd8=_0x3d966a?0x0:_0x468e6a[_0xbd73('0x28')];var _0x9d69b=_0x3d966a?_0x22c2ab[_0xbd73('0x29')]:_0x468e6a['offset']+_0x468e6a[_0xbd73('0x27')];var _0x49cd51;if(_0x9d69b>=_0x151795){_0x9d69b=_0x151795;_0x49cd51=0xc8;}else{_0x49cd51=0xce;}_0x18f58d['status'](_0x49cd51);return _0x18f58d['set'](_0xbd73('0x2a'),_0x23ffd8+'-'+_0x9d69b+'/'+_0x151795)['json'](_0x22c2ab);}return null;};}function saveUpdates(_0x40248a){return function(_0x2a8077){if(_0x2a8077){return _0x2a8077[_0xbd73('0x2b')](_0x40248a)['then'](function(_0xd23d15){return _0xd23d15;});}return null;};}function removeEntity(_0x1c24eb){return function(_0x283813){if(_0x283813){return _0x283813[_0xbd73('0x2c')]()[_0xbd73('0x19')](function(){var _0x1da9a3=_0x283813['get']({'plain':!![]});var _0xce5b35=_0xbd73('0x2d');return db[_0xbd73('0x2e')][_0xbd73('0x2c')]({'where':{'type':_0xce5b35,'resourceId':_0x1da9a3['id']}})[_0xbd73('0x19')](function(){return _0x283813;});})[_0xbd73('0x19')](function(){_0x1c24eb[_0xbd73('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36fa65){return function(_0x540a8c){if(!_0x540a8c){_0x36fa65['sendStatus'](0x194);}return _0x540a8c;};}function handleError(_0x29dec0,_0x245bcd){_0x245bcd=_0x245bcd||0x1f4;return function(_0x39f22f){logger[_0xbd73('0x1f')](_0x39f22f[_0xbd73('0x2f')]);if(_0x39f22f[_0xbd73('0x30')]){delete _0x39f22f['name'];}_0x29dec0['status'](_0x245bcd)[_0xbd73('0x31')](_0x39f22f);};}exports[_0xbd73('0x32')]=function(_0x51f52b,_0x3c15b5){var _0x2bfeb6={'include':[{'model':db[_0xbd73('0x33')],'as':'mandatoryDispositionPause'}]},_0x579845={},_0x315e53={'count':0x0,'rows':[]};var _0x3a13e1=_[_0xbd73('0x34')](db[_0xbd73('0x35')][_0xbd73('0x36')],function(_0x133bbb){return{'name':_0x133bbb[_0xbd73('0x37')],'type':_0x133bbb['type']['key']};});_0x579845[_0xbd73('0x38')]=_[_0xbd73('0x34')](_0x3a13e1,'name');_0x579845[_0xbd73('0x39')]=_[_0xbd73('0x3a')](_0x51f52b['query']);_0x579845[_0xbd73('0x3b')]=_['intersection'](_0x579845[_0xbd73('0x38')],_0x579845[_0xbd73('0x39')]);_0x2bfeb6[_0xbd73('0x3c')]=_[_0xbd73('0x3d')](_0x579845[_0xbd73('0x38')],qs[_0xbd73('0x3e')](_0x51f52b[_0xbd73('0x39')][_0xbd73('0x3e')]));_0x2bfeb6[_0xbd73('0x3c')]=_0x2bfeb6[_0xbd73('0x3c')][_0xbd73('0x3f')]?_0x2bfeb6[_0xbd73('0x3c')]:_0x579845['model'];if(!_0x51f52b[_0xbd73('0x39')][_0xbd73('0x40')](_0xbd73('0x41'))){_0x2bfeb6['limit']=qs[_0xbd73('0x27')](_0x51f52b[_0xbd73('0x39')][_0xbd73('0x27')]);_0x2bfeb6[_0xbd73('0x28')]=qs['offset'](_0x51f52b[_0xbd73('0x39')]['offset']);}_0x2bfeb6[_0xbd73('0x42')]=qs['sort'](_0x51f52b[_0xbd73('0x39')]['sort']);_0x2bfeb6[_0xbd73('0x43')]=qs['filters'](_[_0xbd73('0x44')](_0x51f52b['query'],_0x579845['filters']),_0x3a13e1);if(_0x51f52b['query'][_0xbd73('0x45')]){_0x2bfeb6[_0xbd73('0x43')]=_[_0xbd73('0x46')](_0x2bfeb6[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x3a13e1,function(_0x63bb35){if(_0x63bb35[_0xbd73('0x47')]!==_0xbd73('0x48')){var _0x8611ac={};_0x8611ac[_0x63bb35[_0xbd73('0x30')]]={'$like':'%'+_0x51f52b[_0xbd73('0x39')][_0xbd73('0x45')]+'%'};return _0x8611ac;}})});}_0x2bfeb6=_[_0xbd73('0x46')]({},_0x2bfeb6,_0x51f52b['options']);var _0x89c288={'where':_0x2bfeb6[_0xbd73('0x43')]};return db['ChatWebsite'][_0xbd73('0x29')](_0x89c288)[_0xbd73('0x19')](function(_0x5c8009){_0x315e53[_0xbd73('0x29')]=_0x5c8009;if(_0x51f52b[_0xbd73('0x39')]['includeAll']){_0x2bfeb6['include']=[{'all':!![]}];}return db[_0xbd73('0x35')][_0xbd73('0x49')](_0x2bfeb6);})[_0xbd73('0x19')](function(_0x5ef664){_0x315e53['rows']=_0x5ef664;return _0x315e53;})['then'](respondWithFilteredResult(_0x3c15b5,_0x2bfeb6))[_0xbd73('0x4a')](handleError(_0x3c15b5,null));};exports[_0xbd73('0x4b')]=function(_0x3d3ae0,_0x994ba5){var _0x1668d5={'raw':![],'where':{'id':_0x3d3ae0['params']['id']},'include':[{'model':db[_0xbd73('0x33')],'as':_0xbd73('0x4c')}]},_0x3e6997={};_0x3e6997[_0xbd73('0x38')]=_['keys'](db[_0xbd73('0x35')]['rawAttributes']);_0x3e6997[_0xbd73('0x39')]=_[_0xbd73('0x3a')](_0x3d3ae0[_0xbd73('0x39')]);_0x3e6997[_0xbd73('0x3b')]=_[_0xbd73('0x3d')](_0x3e6997[_0xbd73('0x38')],_0x3e6997[_0xbd73('0x39')]);_0x1668d5[_0xbd73('0x3c')]=_[_0xbd73('0x3d')](_0x3e6997[_0xbd73('0x38')],qs[_0xbd73('0x3e')](_0x3d3ae0[_0xbd73('0x39')][_0xbd73('0x3e')]));_0x1668d5[_0xbd73('0x3c')]=_0x1668d5['attributes']['length']?_0x1668d5[_0xbd73('0x3c')]:_0x3e6997['model'];if(_0x3d3ae0['query'][_0xbd73('0x4d')]){_0x1668d5['include']=[{'all':!![]}];}_0x1668d5=_[_0xbd73('0x46')]({},_0x1668d5,_0x3d3ae0[_0xbd73('0x4e')]);return db[_0xbd73('0x35')]['find'](_0x1668d5)[_0xbd73('0x19')](handleEntityNotFound(_0x994ba5,null))[_0xbd73('0x19')](respondWithResult(_0x994ba5,null))[_0xbd73('0x4a')](handleError(_0x994ba5,null));};exports[_0xbd73('0x4f')]=function(_0x54da4d,_0x2ecbf8){return db[_0xbd73('0x35')][_0xbd73('0x4f')](_0x54da4d[_0xbd73('0x50')],{})[_0xbd73('0x19')](function(_0x429b27){var _0x5b067e=_0x54da4d[_0xbd73('0x51')][_0xbd73('0x52')]({'plain':!![]});if(!_0x5b067e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b067e[_0xbd73('0x53')]===_0xbd73('0x51')){var _0x5634e4=_0x429b27[_0xbd73('0x52')]({'plain':!![]});var _0x340b03='ChatWebsites';return db['UserProfileSection'][_0xbd73('0x54')]({'where':{'name':_0x340b03,'userProfileId':_0x5b067e['userProfileId']},'raw':!![]})[_0xbd73('0x19')](function(_0x283015){if(_0x283015&&_0x283015[_0xbd73('0x55')]===0x0){return db[_0xbd73('0x2e')]['create']({'name':_0x5634e4[_0xbd73('0x30')],'resourceId':_0x5634e4['id'],'type':_0x283015[_0xbd73('0x30')],'sectionId':_0x283015['id']},{})[_0xbd73('0x19')](function(){return _0x429b27;});}else{return _0x429b27;}})[_0xbd73('0x4a')](function(_0x5e909f){logger[_0xbd73('0x1f')](_0xbd73('0x56'),_0x5e909f);throw _0x5e909f;});}return _0x429b27;})[_0xbd73('0x19')](respondWithResult(_0x2ecbf8,0xc9))[_0xbd73('0x4a')](handleError(_0x2ecbf8,null));};exports[_0xbd73('0x2b')]=function(_0x514d37,_0x37dd32){if(_0x514d37['body']['id']){delete _0x514d37[_0xbd73('0x50')]['id'];}return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x514d37[_0xbd73('0x57')]['id']},'include':[{'model':db[_0xbd73('0x33')],'as':'mandatoryDispositionPause'}]})[_0xbd73('0x19')](handleEntityNotFound(_0x37dd32,null))['then'](saveUpdates(_0x514d37[_0xbd73('0x50')],null))['then'](respondWithResult(_0x37dd32,null))[_0xbd73('0x4a')](handleError(_0x37dd32,null));};exports['destroy']=function(_0x1ed76f,_0x2a8cae){return db['ChatWebsite'][_0xbd73('0x54')]({'where':{'id':_0x1ed76f[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x2a8cae,null))[_0xbd73('0x19')](removeEntity(_0x2a8cae,null))[_0xbd73('0x4a')](handleError(_0x2a8cae,null));};exports[_0xbd73('0x58')]=function(_0x2a2b35,_0x3c10bd){return db[_0xbd73('0x35')][_0xbd73('0x58')]()[_0xbd73('0x19')](respondWithResult(_0x3c10bd,null))[_0xbd73('0x4a')](handleError(_0x3c10bd,null));};exports[_0xbd73('0x59')]=function(_0x90d9de,_0x3de0ec){if(_0x90d9de[_0xbd73('0x50')]['id']){delete _0x90d9de[_0xbd73('0x50')]['id'];}return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x90d9de[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x3de0ec,null))[_0xbd73('0x19')](function(_0x4b7326){if(_0x4b7326){_0x90d9de[_0xbd73('0x50')][_0xbd73('0x5a')]=_0x4b7326['id'];return db[_0xbd73('0x5b')][_0xbd73('0x4f')](_0x90d9de[_0xbd73('0x50')]);}})[_0xbd73('0x19')](respondWithResult(_0x3de0ec,null))[_0xbd73('0x4a')](handleError(_0x3de0ec,null));};exports['getDispositions']=function(_0x149bd4,_0x3d2e65){var _0xb3dc86={'raw':![],'where':{}};var _0x82179={};var _0x4f3980={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x149bd4[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x3d2e65,null))[_0xbd73('0x19')](function(_0x4181bb){if(_0x4181bb){_0x82179[_0xbd73('0x38')]=_[_0xbd73('0x3a')](db['Disposition'][_0xbd73('0x36')]);_0x82179['query']=_[_0xbd73('0x3a')](_0x149bd4[_0xbd73('0x39')]);_0x82179[_0xbd73('0x3b')]=_[_0xbd73('0x3d')](_0x82179[_0xbd73('0x38')],_0x82179[_0xbd73('0x39')]);_0xb3dc86[_0xbd73('0x3c')]=_[_0xbd73('0x3d')](_0x82179[_0xbd73('0x38')],qs['fields'](_0x149bd4[_0xbd73('0x39')][_0xbd73('0x3e')]));_0xb3dc86[_0xbd73('0x3c')]=_0xb3dc86['attributes'][_0xbd73('0x3f')]?_0xb3dc86[_0xbd73('0x3c')]:_0x82179[_0xbd73('0x38')];if(!_0x149bd4[_0xbd73('0x39')]['hasOwnProperty'](_0xbd73('0x41'))){_0xb3dc86[_0xbd73('0x27')]=qs[_0xbd73('0x27')](_0x149bd4[_0xbd73('0x39')][_0xbd73('0x27')]);_0xb3dc86[_0xbd73('0x28')]=qs[_0xbd73('0x28')](_0x149bd4[_0xbd73('0x39')][_0xbd73('0x28')]);}_0xb3dc86['order']=qs[_0xbd73('0x5c')](_0x149bd4['query']['sort']);_0xb3dc86[_0xbd73('0x43')]=qs['filters'](_['pick'](_0x149bd4[_0xbd73('0x39')],_0x82179[_0xbd73('0x3b')]));_0xb3dc86['where'][_0xbd73('0x5a')]=_0x4181bb['id'];if(_0x149bd4[_0xbd73('0x39')][_0xbd73('0x45')]){_0xb3dc86[_0xbd73('0x43')]=_['merge'](_0xb3dc86[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0xb3dc86[_0xbd73('0x3c')],function(_0xe7ad22){var _0xb2e3cc={};_0xb2e3cc[_0xe7ad22]={'$like':'%'+_0x149bd4['query'][_0xbd73('0x45')]+'%'};return _0xb2e3cc;})});}_0xb3dc86=_[_0xbd73('0x46')]({},_0xb3dc86,_0x149bd4[_0xbd73('0x4e')]);return db[_0xbd73('0x5b')][_0xbd73('0x29')]({'where':_0xb3dc86['where']})[_0xbd73('0x19')](function(_0x26b58b){_0x4f3980['count']=_0x26b58b;if(_0x149bd4[_0xbd73('0x39')][_0xbd73('0x4d')]){_0xb3dc86[_0xbd73('0x5d')]=[{'all':!![]}];}return db[_0xbd73('0x5b')][_0xbd73('0x49')](_0xb3dc86);})[_0xbd73('0x19')](function(_0x352eca){_0x4f3980[_0xbd73('0x5e')]=_0x352eca;return _0x4f3980;});}})[_0xbd73('0x19')](respondWithFilteredResult(_0x3d2e65,_0xb3dc86))[_0xbd73('0x4a')](handleError(_0x3d2e65,null));};exports[_0xbd73('0x5f')]=function(_0x56516c,_0x131790){return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x56516c[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x131790,null))['then'](function(_0x538b73){if(_0x538b73){return _0x538b73[_0xbd73('0x5f')](_0x56516c[_0xbd73('0x39')]['ids']);}})[_0xbd73('0x19')](respondWithStatusCode(_0x131790,null))[_0xbd73('0x4a')](handleError(_0x131790,null));};exports[_0xbd73('0x60')]=function(_0x48cadd,_0x3b203f){if(_0x48cadd['body']['id']){delete _0x48cadd[_0xbd73('0x50')]['id'];}return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x48cadd[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x3b203f,null))[_0xbd73('0x19')](function(_0x317e5c){if(_0x317e5c){_0x48cadd[_0xbd73('0x50')]['ChatWebsiteId']=_0x317e5c['id'];return db[_0xbd73('0x61')][_0xbd73('0x4f')](_0x48cadd[_0xbd73('0x50')]);}})[_0xbd73('0x19')](respondWithResult(_0x3b203f,null))[_0xbd73('0x4a')](handleError(_0x3b203f,null));};exports[_0xbd73('0x62')]=function(_0x1e06d1,_0xb10f66){var _0x21edf5={'raw':![],'where':{}};var _0x588c81={};var _0x5c0bdc={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbd73('0x63')]({'where':{'id':_0x1e06d1[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0xb10f66,null))[_0xbd73('0x19')](function(_0x250c52){if(_0x250c52){_0x588c81[_0xbd73('0x38')]=_[_0xbd73('0x3a')](db[_0xbd73('0x61')][_0xbd73('0x36')]);_0x588c81['query']=_[_0xbd73('0x3a')](_0x1e06d1[_0xbd73('0x39')]);_0x588c81[_0xbd73('0x3b')]=_[_0xbd73('0x3d')](_0x588c81[_0xbd73('0x38')],_0x588c81['query']);_0x21edf5[_0xbd73('0x3c')]=_['intersection'](_0x588c81[_0xbd73('0x38')],qs[_0xbd73('0x3e')](_0x1e06d1[_0xbd73('0x39')]['fields']));_0x21edf5[_0xbd73('0x3c')]=_0x21edf5[_0xbd73('0x3c')][_0xbd73('0x3f')]?_0x21edf5[_0xbd73('0x3c')]:_0x588c81[_0xbd73('0x38')];if(!_0x1e06d1['query']['hasOwnProperty'](_0xbd73('0x41'))){_0x21edf5[_0xbd73('0x27')]=qs[_0xbd73('0x27')](_0x1e06d1[_0xbd73('0x39')][_0xbd73('0x27')]);_0x21edf5[_0xbd73('0x28')]=qs[_0xbd73('0x28')](_0x1e06d1[_0xbd73('0x39')][_0xbd73('0x28')]);}_0x21edf5[_0xbd73('0x42')]=qs[_0xbd73('0x5c')](_0x1e06d1[_0xbd73('0x39')]['sort']);_0x21edf5[_0xbd73('0x43')]=qs[_0xbd73('0x3b')](_[_0xbd73('0x44')](_0x1e06d1[_0xbd73('0x39')],_0x588c81['filters']));_0x21edf5[_0xbd73('0x43')][_0xbd73('0x5a')]=_0x250c52['id'];if(_0x1e06d1['query']['filter']){_0x21edf5['where']=_['merge'](_0x21edf5[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x21edf5[_0xbd73('0x3c')],function(_0xc7f152){var _0x2b00c3={};_0x2b00c3[_0xc7f152]={'$like':'%'+_0x1e06d1['query'][_0xbd73('0x45')]+'%'};return _0x2b00c3;})});}_0x21edf5=_[_0xbd73('0x46')]({},_0x21edf5,_0x1e06d1['options']);return db[_0xbd73('0x61')][_0xbd73('0x29')]({'where':_0x21edf5[_0xbd73('0x43')]})[_0xbd73('0x19')](function(_0x5fb170){_0x5c0bdc[_0xbd73('0x29')]=_0x5fb170;if(_0x1e06d1[_0xbd73('0x39')]['includeAll']){_0x21edf5['include']=[{'all':!![]}];}return db[_0xbd73('0x61')][_0xbd73('0x49')](_0x21edf5);})[_0xbd73('0x19')](function(_0x53440d){_0x5c0bdc[_0xbd73('0x5e')]=_0x53440d;return _0x5c0bdc;});}})['then'](respondWithFilteredResult(_0xb10f66,_0x21edf5))[_0xbd73('0x4a')](handleError(_0xb10f66,null));};exports[_0xbd73('0x64')]=function(_0x58d25c,_0xaac3){return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x58d25c[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0xaac3,null))[_0xbd73('0x19')](function(_0x303ce8){if(_0x303ce8){return _0x303ce8[_0xbd73('0x64')](_0x58d25c[_0xbd73('0x39')][_0xbd73('0x65')]);}})[_0xbd73('0x19')](respondWithStatusCode(_0xaac3,null))[_0xbd73('0x4a')](handleError(_0xaac3,null));};exports[_0xbd73('0x66')]=function(_0xc0fef0,_0x38bc03){_0xc0fef0[_0xbd73('0x50')][_0xbd73('0x67')]=_0xc0fef0[_0xbd73('0x68')][_0xbd73('0x69')];return db[_0xbd73('0x35')]['find']({'where':{'id':_0xc0fef0[_0xbd73('0x57')]['id']}})['then'](handleEntityNotFound(_0x38bc03,null))['then'](saveUpdates(_0xc0fef0['body'],null))[_0xbd73('0x19')](respondWithResult(_0x38bc03,null))['catch'](handleError(_0x38bc03,null));};exports[_0xbd73('0x6a')]=function(_0x2b10ab,_0x576bc3){_0x2b10ab[_0xbd73('0x50')]['agentAvatar']=_0x2b10ab[_0xbd73('0x68')][_0xbd73('0x69')];return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x2b10ab['params']['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x576bc3,null))[_0xbd73('0x19')](saveUpdates(_0x2b10ab[_0xbd73('0x50')],null))[_0xbd73('0x19')](respondWithResult(_0x576bc3,null))[_0xbd73('0x4a')](handleError(_0x576bc3,null));};exports[_0xbd73('0x6b')]=function(_0xea8b95,_0xcb20d7){_0xea8b95[_0xbd73('0x50')][_0xbd73('0x6c')]=_0xea8b95[_0xbd73('0x68')][_0xbd73('0x69')];return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0xea8b95['params']['id']}})['then'](handleEntityNotFound(_0xcb20d7,null))[_0xbd73('0x19')](saveUpdates(_0xea8b95[_0xbd73('0x50')],null))[_0xbd73('0x19')](respondWithResult(_0xcb20d7,null))[_0xbd73('0x4a')](handleError(_0xcb20d7,null));};exports[_0xbd73('0x6d')]=function(_0x89bd9c,_0x4f73c0){_0x89bd9c[_0xbd73('0x50')][_0xbd73('0x6e')]=_0x89bd9c[_0xbd73('0x68')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x89bd9c[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x4f73c0,null))[_0xbd73('0x19')](saveUpdates(_0x89bd9c[_0xbd73('0x50')],null))['then'](respondWithResult(_0x4f73c0,null))[_0xbd73('0x4a')](handleError(_0x4f73c0,null));};exports[_0xbd73('0x6f')]=function(_0x21bc9f,_0x24e22a){var _0x4b04f4=path[_0xbd73('0x70')](config['root'],_0xbd73('0x71'));var _0x24cc8b={'where':{'id':_0x21bc9f['params']['id']},'attributes':['id',_0xbd73('0x67')],'raw':!![]};var _0x1e1a9e=![];return require('../../config/license/util')[_0xbd73('0x72')]()['then'](function(_0x67cb04){if(_0x67cb04){_0x1e1a9e=_0x67cb04[_0xbd73('0x73')];}})[_0xbd73('0x19')](function(){return db['ChatWebsite']['find'](_0x24cc8b);})['then'](handleEntityNotFound(_0x24e22a,null))[_0xbd73('0x19')](function(_0x224c92){if(_0x224c92){if(!_[_0xbd73('0x74')](_0x224c92[_0xbd73('0x67')])){if(fs[_0xbd73('0x75')](path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0x77'),_0x224c92[_0xbd73('0x67')]))&&_0x1e1a9e){_0x4b04f4=path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0x77'),_0x224c92[_0xbd73('0x67')]);}}return _0x24e22a[_0xbd73('0x78')](_0x4b04f4);}})[_0xbd73('0x4a')](handleError(_0x24e22a,null));};exports[_0xbd73('0x79')]=function(_0x54ba11,_0x2930ba){var _0x1ecc76=path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0x7a'));var _0x1cdbea={'where':{'id':_0x54ba11[_0xbd73('0x57')]['id']},'attributes':['id',_0xbd73('0x7b')],'raw':!![]};return db[_0xbd73('0x35')][_0xbd73('0x54')](_0x1cdbea)[_0xbd73('0x19')](handleEntityNotFound(_0x2930ba,null))['then'](function(_0x4af797){if(_0x4af797){if(!_[_0xbd73('0x74')](_0x4af797['agentAvatar'])){if(fs[_0xbd73('0x75')](path[_0xbd73('0x70')](config[_0xbd73('0x76')],'server/files/images/avatars/',_0x4af797['agentAvatar']))){_0x1ecc76=path[_0xbd73('0x70')](config['root'],_0xbd73('0x7c'),_0x4af797[_0xbd73('0x7b')]);}}return _0x2930ba['download'](_0x1ecc76);}})[_0xbd73('0x4a')](handleError(_0x2930ba,null));};exports[_0xbd73('0x7d')]=function(_0x288826,_0x492aed){var _0x484239=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x34d64d={'where':{'id':_0x288826[_0xbd73('0x57')]['id']},'attributes':['id','customerAvatar',_0xbd73('0x7e')],'raw':!![]};return db[_0xbd73('0x35')][_0xbd73('0x54')](_0x34d64d)['then'](handleEntityNotFound(_0x492aed,null))[_0xbd73('0x19')](function(_0x31d267){if(_0x31d267){if(!_['isNil'](_0x31d267[_0xbd73('0x6c')])){if(fs[_0xbd73('0x75')](path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0x7c'),_0x31d267[_0xbd73('0x6c')]))&&_0x31d267[_0xbd73('0x7e')]){_0x484239=path['join'](config['root'],'server/files/images/avatars/',_0x31d267[_0xbd73('0x6c')]);}}return _0x492aed[_0xbd73('0x78')](_0x484239);}})[_0xbd73('0x4a')](handleError(_0x492aed,null));};exports['getSystemAvatar']=function(_0x2615d7,_0x13680a){var _0x5b1ffd=path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0x7f'));var _0x4e2efc={'where':{'id':_0x2615d7[_0xbd73('0x57')]['id']},'attributes':['id',_0xbd73('0x6e')],'raw':!![]};return db[_0xbd73('0x35')]['find'](_0x4e2efc)['then'](handleEntityNotFound(_0x13680a,null))[_0xbd73('0x19')](function(_0x46ebd4){if(_0x46ebd4){if(!_[_0xbd73('0x74')](_0x46ebd4['systemAvatar'])){if(fs[_0xbd73('0x75')](path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0x7c'),_0x46ebd4[_0xbd73('0x6e')]))){_0x5b1ffd=path['join'](config[_0xbd73('0x76')],'server/files/images/avatars/',_0x46ebd4[_0xbd73('0x6e')]);}}return _0x13680a[_0xbd73('0x78')](_0x5b1ffd);}})['catch'](handleError(_0x13680a,null));};exports[_0xbd73('0x80')]=function(_0x1a8677,_0x5a4851){var _0x51611b=require(_0xbd73('0x81'));var _0x4d7ece=new _0x51611b();var _0x192c35=_0x4d7ece[_0xbd73('0x82')](_0x1a8677[_0xbd73('0x83')][_0xbd73('0x84')])[_0xbd73('0x85')]();var _0xb29ea4={'body':_0x1a8677['body'],'channel':_0xbd73('0x86')};var _0x22a2e0=[];var _0x1c4945=[];var _0x2600af={};var _0x4b331c=![];return db[_0xbd73('0x87')]['describe']()['then'](function(_0x468cf6){if(!_0x468cf6){throw new db[(_0xbd73('0x88'))]['ValidationError'](_0xbd73('0x89'));}_0x22a2e0=_[_0xbd73('0x8a')](_[_0xbd73('0x3a')](_0x468cf6),[_0xbd73('0x8b'),_0xbd73('0x8c')]);_0x1c4945=_['difference'](_[_0xbd73('0x3a')](_0x468cf6),[_0xbd73('0x8b'),_0xbd73('0x8c'),'CompanyId',_0xbd73('0x8d')]);if(_0x1a8677[_0xbd73('0x50')]['id']){delete _0x1a8677[_0xbd73('0x50')]['id'];}if(_[_0xbd73('0x74')](_0x1a8677[_0xbd73('0x50')][_0xbd73('0x8e')])){throw new db[(_0xbd73('0x88'))]['ValidationError'](_0xbd73('0x8f'));}if(_['isNil'](_0x1a8677[_0xbd73('0x50')][_0xbd73('0x50')])||_0x1a8677[_0xbd73('0x50')]['body']===''){throw new db[(_0xbd73('0x88'))]['ValidationError'](_0xbd73('0x90'));}if(_[_0xbd73('0x74')](_0x1a8677['body']['mapKey'])){throw new db[(_0xbd73('0x88'))][(_0xbd73('0x91'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c4945);}if(!_[_0xbd73('0x92')](_0x1c4945,_0x1a8677[_0xbd73('0x50')][_0xbd73('0x93')])){throw new db[(_0xbd73('0x88'))][(_0xbd73('0x91'))](_0xbd73('0x94')+_0x1c4945);}_0x2600af[_0x1a8677[_0xbd73('0x50')][_0xbd73('0x93')]]=_0x1a8677[_0xbd73('0x50')][_0xbd73('0x8e')];})[_0xbd73('0x19')](function(){return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x1a8677[_0xbd73('0x57')]['id']},'include':[{'model':db[_0xbd73('0x95')],'as':_0xbd73('0x96'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2600af,'limit':0x1,'order':[[_0xbd73('0x8c'),_0xbd73('0x97')]]}]},{'model':db['ChatApplication'],'as':_0xbd73('0x98')}]});})['then'](handleEntityNotFound(_0x5a4851,null))['then'](function(_0x2af548){if(_0x2af548&&_0x2af548[_0xbd73('0x96')]){_0xb29ea4['account']=_0x2af548;_0xb29ea4['applications']=_0x2af548['Applications'];_0xb29ea4[_0xbd73('0x99')]=_0x2af548[_0xbd73('0x96')];_0xb29ea4['applications']=_['orderBy'](_0xb29ea4[_0xbd73('0x9a')],[_0xbd73('0x9b')],[_0xbd73('0x9c')]);if(_0xb29ea4[_0xbd73('0x9d')]['Applications']){delete _0xb29ea4[_0xbd73('0x9d')]['Applications'];}if(_0xb29ea4[_0xbd73('0x9d')][_0xbd73('0x96')]&&_0xb29ea4['account'][_0xbd73('0x96')][_0xbd73('0x9e')]['length']){return _0xb29ea4[_0xbd73('0x9d')][_0xbd73('0x96')][_0xbd73('0x9e')][0x0];}var _0x38ae88=_[_0xbd73('0xf')](_0x1a8677[_0xbd73('0x50')],{'firstName':_0x1a8677[_0xbd73('0x50')][_0xbd73('0x8e')],'ListId':_0x2af548[_0xbd73('0x8d')]});_0x38ae88[_0x1a8677[_0xbd73('0x50')]['mapKey']]=_0x1a8677['body'][_0xbd73('0x8e')];return db[_0xbd73('0x87')][_0xbd73('0x4f')](_0x38ae88,{'fields':_0x22a2e0,'raw':!![]});}})[_0xbd73('0x19')](handleEntityNotFound(_0x5a4851,null))[_0xbd73('0x19')](function(_0x13207f){_0xb29ea4[_0xbd73('0x9f')]=_0x13207f;var _0x52eae7=_0x1a8677['body'][_0xbd73('0xa0')];if(_0x1a8677[_0xbd73('0x83')][_0xbd73('0xa1')]){_0x52eae7=_0x1a8677['headers']['cf-connecting-ip'];}else if(_0x1a8677[_0xbd73('0x83')][_0xbd73('0xa2')]){_0x52eae7=_['first'](_0x1a8677[_0xbd73('0x83')][_0xbd73('0xa2')][_0xbd73('0xa3')](','));}if(_0x13207f){var _0x38b05c={'ContactId':_0x13207f['id'],'ChatWebsiteId':_0x1a8677[_0xbd73('0x57')]['id'],'from':(_0x13207f['firstName']||'')+'\x20'+(_0x13207f[_0xbd73('0xa4')]||''),'customerIp':_0x52eae7,'customerPort':_0x1a8677[_0xbd73('0x83')]['x-real-port']?_0x1a8677[_0xbd73('0x83')]['x-real-port']:null,'referer':_0x1a8677[_0xbd73('0x50')][_0xbd73('0xa5')],'browserName':_0x192c35[_0xbd73('0xa6')][_0xbd73('0x30')]&&_0x192c35['browser'][_0xbd73('0xa7')]?util[_0xbd73('0xa8')](_0xbd73('0xa9'),_0x192c35[_0xbd73('0xa6')][_0xbd73('0x30')],_0x192c35[_0xbd73('0xa6')][_0xbd73('0xa7')]):_0xbd73('0xaa'),'browserVersion':_0x192c35[_0xbd73('0xa6')][_0xbd73('0xa7')]||_0xbd73('0xaa'),'osName':util[_0xbd73('0xa8')](_0xbd73('0xa9'),_0x192c35['os'][_0xbd73('0x30')],_0x192c35['os'][_0xbd73('0xa7')]),'osVersion':_0x192c35['os'][_0xbd73('0xa7')],'deviceModel':_0x192c35[_0xbd73('0xab')][_0xbd73('0x38')]&&_0x192c35['device']['vendor']?util['format'](_0xbd73('0xac'),_0x192c35[_0xbd73('0xab')]['model'],_0x192c35[_0xbd73('0xab')]['vendor'],_0x192c35[_0xbd73('0xab')][_0xbd73('0x47')]):null,'deviceVendor':_0x192c35[_0xbd73('0xab')][_0xbd73('0xad')],'deviceType':_0x192c35[_0xbd73('0xab')][_0xbd73('0x47')],'formData':JSON[_0xbd73('0x1e')](_0x1a8677[_0xbd73('0x50')])};var _0x4f7732={'ChatWebsiteId':_0x1a8677[_0xbd73('0x57')]['id'],'closed':![]};if(_0x1a8677[_0xbd73('0x50')][_0xbd73('0xae')]){_0x4f7732[_0xbd73('0xae')]=_0x1a8677[_0xbd73('0x50')][_0xbd73('0xae')];return db[_0xbd73('0xaf')]['find']({'where':_0x4f7732})[_0xbd73('0x19')](function(_0x403faf){if(_0x403faf){return[_0x403faf,![]];}_0x38b05c[_0xbd73('0xae')]=_0x1a8677['body'][_0xbd73('0xae')];_0x38b05c[_0xbd73('0xb0')]=_0x1a8677[_0xbd73('0x50')][_0xbd73('0xb0')];return db[_0xbd73('0xaf')][_0xbd73('0x4f')](_0x38b05c)[_0xbd73('0x19')](function(_0x2297d7){return[_0x2297d7,!![]];});});}_0x4f7732['ContactId']=_0x13207f['id'];if(_0x1a8677[_0xbd73('0x50')][_0xbd73('0xb1')]&&_0x1a8677['body'][_0xbd73('0xb1')]['id']){_0x4f7732['id']=_0x1a8677['body'][_0xbd73('0xb1')]['id'];return db[_0xbd73('0xaf')][_0xbd73('0x54')]({'where':_0x4f7732})[_0xbd73('0x19')](function(_0x3b0c4d){if(_0x3b0c4d){return[_0x3b0c4d,![]];}return db[_0xbd73('0xaf')][_0xbd73('0x4f')](_0x38b05c)[_0xbd73('0x19')](function(_0x151316){return[_0x151316,!![]];});});}return db['ChatInteraction'][_0xbd73('0x4f')](_0x38b05c)[_0xbd73('0x19')](function(_0x518e70){return[_0x518e70,!![]];});}})[_0xbd73('0xb2')](function(_0x835d19,_0x487ffc){if(_0x835d19){_0x4b331c=_0x487ffc;if(!_0x487ffc){var _0x59e3bd={'from':(_0xb29ea4[_0xbd73('0x9f')][_0xbd73('0xb3')]||'')+'\x20'+(_0xb29ea4[_0xbd73('0x9f')][_0xbd73('0xa4')]||'')};if(_0x1a8677[_0xbd73('0x50')]['threadId']&&_0x1a8677['body'][_0xbd73('0xb4')]&&_0x1a8677[_0xbd73('0x50')][_0xbd73('0xae')]!=_0x1a8677[_0xbd73('0x50')][_0xbd73('0xb4')]){_0x59e3bd[_0xbd73('0xae')]=_0x1a8677['body'][_0xbd73('0xb4')];}return _0x835d19[_0xbd73('0x2b')](_0x59e3bd);}else{return _0x835d19;}}})[_0xbd73('0x19')](function(_0xbb616){_0xb29ea4[_0xbd73('0xb1')]=_0xbb616[_0xbd73('0x52')]({'plain':!![]});_0xb29ea4[_0xbd73('0xb1')][_0xbd73('0xb5')]=_0x4b331c;if(_0xb29ea4[_0xbd73('0xb1')][_0xbd73('0xb5')]){if(_0xb29ea4[_0xbd73('0x9d')]['autoclose']){_0xb29ea4[_0xbd73('0x9a')][_0xbd73('0xb6')]({'id':0x0,'priority':_0xb29ea4[_0xbd73('0x9a')]['length']+0x1,'app':_0xbd73('0xb7'),'appdata':_0xbd73('0xb8'),'interval':_0xbd73('0xb9')});}}return db[_0xbd73('0xba')][_0xbd73('0x4f')]({'body':_0x1a8677[_0xbd73('0x50')][_0xbd73('0x50')],'ChatWebsiteId':_0x1a8677[_0xbd73('0x57')]['id'],'ChatInteractionId':_0xbb616['id'],'direction':'in','ContactId':_0xb29ea4['contact']['id'],'AttachmentId':_0x1a8677[_0xbd73('0x50')]['AttachmentId']});})[_0xbd73('0x19')](function(_0x9942cd){_0xb29ea4[_0xbd73('0x21')]=_0x9942cd;if(_0xb29ea4[_0xbd73('0xb1')]['UserId']){return db[_0xbd73('0xbb')][_0xbd73('0x54')]({'attributes':['id',_0xbd73('0x30')],'where':{'id':_0xb29ea4[_0xbd73('0xb1')]['UserId']}})[_0xbd73('0x19')](function(_0x28935a){if(_0x28935a){_0xb29ea4['applications'][_0xbd73('0xbc')]({'id':0x0,'priority':0x0,'app':_0xbd73('0xbd'),'appdata':_0x28935a[_0xbd73('0x30')]+','+(_0xb29ea4[_0xbd73('0x9d')][_0xbd73('0xbe')]||0xa),'interval':_0xbd73('0xb9')});_0xb29ea4[_0xbd73('0xbf')]=!![];}return respondWithRpcPromise(_0xbd73('0xc0'),_0xbd73('0xc1'),_0xb29ea4);});}return respondWithRpcPromise('Start',_0xbd73('0xc1'),_0xb29ea4);})[_0xbd73('0x19')](function(_0x57636c){respondWithRpcPromise(_0xbd73('0xc2'),_0xbd73('0xc2'),{'event':'notify','message':_0x57636c},client9002);return _0x57636c;})[_0xbd73('0x19')](respondWithResult(_0x5a4851,null))[_0xbd73('0x4a')](handleError(_0x5a4851,null));};exports[_0xbd73('0xc3')]=function(_0x1d210e,_0x31b627){var _0x434d81,_0x1d4675,_0x170643;var _0x4dd8c1=[];var _0x55b94b={};var _0x514a7b=_0x1d210e[_0xbd73('0xc4')]||[];var _0x2c9a0d=[];var _0x1f6d69;return db[_0xbd73('0x87')][_0xbd73('0x58')]()[_0xbd73('0x19')](function(_0x4a8902){if(!_0x4a8902){throw new db[(_0xbd73('0x88'))][(_0xbd73('0x91'))]('no\x20available\x20attributes');}_0x4dd8c1=_[_0xbd73('0x8a')](_['keys'](_0x4a8902),[_0xbd73('0x8b'),_0xbd73('0x8c'),_0xbd73('0xc5'),_0xbd73('0x8d')]);if(_0x1d210e[_0xbd73('0x50')]['id']){delete _0x1d210e[_0xbd73('0x50')]['id'];}if(_[_0xbd73('0x74')](_0x1d210e[_0xbd73('0x50')][_0xbd73('0x8e')])){throw _0x31b627[_0xbd73('0x24')](0x1f4)['send'](new db[(_0xbd73('0x88'))][(_0xbd73('0x91'))](_0xbd73('0x8f')));}if(_[_0xbd73('0x74')](_0x1d210e[_0xbd73('0x50')][_0xbd73('0x50')])||_0x1d210e[_0xbd73('0x50')]['body']===''){throw _0x31b627[_0xbd73('0x24')](0x1f4)['send'](new db[(_0xbd73('0x88'))]['ValidationError'](_0xbd73('0x90')));}if(_[_0xbd73('0x74')](_0x1d210e[_0xbd73('0x50')][_0xbd73('0xc6')])){throw _0x31b627['status'](0x1f4)[_0xbd73('0x31')](new db['Sequelize'][(_0xbd73('0x91'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4dd8c1));}if(!_[_0xbd73('0x92')](_0x4dd8c1,_0x1d210e[_0xbd73('0x50')]['mapKeyOffline'])){throw _0x31b627['status'](0x1f4)[_0xbd73('0x31')](new db[(_0xbd73('0x88'))][(_0xbd73('0x91'))](_0xbd73('0xc7')+_0x4dd8c1));}_0x55b94b[_0x1d210e['body'][_0xbd73('0xc6')]]=_0x1d210e[_0xbd73('0x50')][_0xbd73('0x8e')];})[_0xbd73('0x19')](function(){return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x1d210e[_0xbd73('0x57')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db['MailAccount'],'as':_0xbd73('0xc8')}]});})['then'](handleEntityNotFound(_0x31b627,null))[_0xbd73('0x19')](function(_0x59e2ac){if(_0x59e2ac&&_0x59e2ac['List']){_0x1d4675=_0x59e2ac;var _0x294f53=_['defaults'](_0x1d210e[_0xbd73('0x50')],{'firstName':_0x1d210e[_0xbd73('0x50')][_0xbd73('0x8e')],'phone':_0x1d210e[_0xbd73('0x50')][_0xbd73('0x8e')],'ListId':_0x59e2ac[_0xbd73('0x8d')]});_0x294f53[_0x1d210e[_0xbd73('0x50')][_0xbd73('0xc6')]]=_0x1d210e['body'][_0xbd73('0x8e')];return db[_0xbd73('0x87')]['findOrCreate']({'where':_0x55b94b,'defaults':_0x294f53});}})[_0xbd73('0xb2')](function(_0x274d26){if(_0x274d26){_0x170643=_0x274d26;var _0x156f4e=fs[_0xbd73('0xc9')](path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0xca')),_0xbd73('0xcb'));var _0x10c9a6=ejs[_0xbd73('0xcc')](_0x156f4e,{'body':_[_0xbd73('0xcd')](_0x1d210e[_0xbd73('0x50')][_0xbd73('0x50')]),'bodyTitle':_0x1d4675[_0xbd73('0xce')]});return db[_0xbd73('0xcf')]['create']({'body':_0x10c9a6,'plainBody':htmlToText[_0xbd73('0xd0')](_0x10c9a6),'ContactId':_0x274d26['id'],'ChatWebsiteId':_0x1d4675['id']});}})[_0xbd73('0x19')](function(_0x4a6c0f){_0x1f6d69=_0x4a6c0f;if(_0x514a7b[_0xbd73('0x3f')]){var _0x31ab84=_0x514a7b['map'](function(_0x29e476){return{'name':_0x29e476[_0xbd73('0xd1')],'basename':_0x29e476['filename'],'type':_0x29e476[_0xbd73('0xd2')],'ChatOfflineMessageId':_0x4a6c0f['id']};});_0x2c9a0d=_0x31ab84[_0xbd73('0x34')](_0x618d20=>{var _0x46277a={'filename':_0x618d20[_0xbd73('0x30')],'path':path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0xd3'),_0xbd73('0xc4'),_0xbd73('0xd4'),'offline-chat',_0x618d20[_0xbd73('0xd5')])};return _0x46277a;});if(!_0x1d4675['openNewInteraction']){return db['sequelize'][_0xbd73('0xd6')](function(_0x585404){return db[_0xbd73('0xd7')][_0xbd73('0xd8')](_0x31ab84,{'transaction':_0x585404});});}}})[_0xbd73('0x19')](function(){if(_0x1f6d69){_0x434d81=_0x1f6d69;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xbd73('0xd9')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xbd73('0xda')],'as':_0xbd73('0xda'),'raw':!![]}]}]});}})['then'](function(_0x392b3f){if(_0x392b3f&&_0x392b3f[_0xbd73('0xdb')]&&_0x1d4675[_0xbd73('0xdc')]&&_0x1d4675['forwardOfflineAddress']){var _0xfc4cf2=_0x392b3f[_0xbd73('0xdd')]();return respondWithRpcPromise(_0xbd73('0xde'),_0xbd73('0xdf'),{'account':_0xfc4cf2,'message':{'from':util[_0xbd73('0xa8')](_0xbd73('0xe0'),_0x392b3f[_0xbd73('0x30')],_0x392b3f['email']||_0x392b3f[_0xbd73('0xdb')][_0xbd73('0x51')]),'to':_0x1d4675[_0xbd73('0xe1')],'subject':_0x1d4675[_0xbd73('0xe2')],'html':_0x434d81[_0xbd73('0x50')],'attachments':_0x2c9a0d}},client9003)[_0xbd73('0x19')](function(){return _0x434d81;})['catch'](function(_0x56a623){logger[_0xbd73('0x1f')](_0x56a623);});}})['then'](function(){if(_0x1d4675&&_0x1d4675['openNewInteraction']&&_0x1d4675[_0xbd73('0xe3')]){var _0x5593f8=[];if(_0x514a7b[_0xbd73('0x3f')]){_0x5593f8=_0x514a7b['map'](function(_0xc54f8c){return{'name':_0xc54f8c[_0xbd73('0xd1')],'basename':_0xc54f8c['filename'],'type':_0xc54f8c[_0xbd73('0xd2')],'ChatOfflineMessageId':_0x1f6d69['id']};});}var _0x16ca38;if(!_['isNil'](_0x1d4675['subjectOffline'])){var _0x30d4f=_['map'](_0x1d210e['body'],function(_0x3bf4ac){return _0x3bf4ac;});var _0x3bf752=_[_0xbd73('0xe4')](_0x30d4f)[0x0];var _0x2326e4=_[_0xbd73('0xe5')](_0x3bf752,function(_0x9d9bd3){return _0x9d9bd3;});_0x16ca38=_0x2326e4[0x1][_0x1d4675[_0xbd73('0xe6')]];}var _0x21c2da={'from':_0x170643[_0xbd73('0xe7')],'firstName':_0x170643[_0xbd73('0xb3')],'lastName':_0x170643[_0xbd73('0xa4')],'mapKey':_0xbd73('0xe7'),'message':{'from':_0x170643[_0xbd73('0xe7')],'to':_0x1d4675[_0xbd73('0xc8')][_0xbd73('0xe7')],'cc':'','subject':_[_0xbd73('0x74')](_0x16ca38)?_0x1d4675[_0xbd73('0xe2')]:_0x16ca38,'messageId':'','sentAt':new Date(),'attach':_0x5593f8[_0xbd73('0x3f')],'attachments':_0x5593f8,'originChannel':_0xbd73('0xe8'),'ChatWebsiteId':_0x1d4675['id'],'ChatOfflineMessageId':_0x434d81['id'],'originTo':_0x1d4675[_0xbd73('0xc8')][_0xbd73('0xe7')]},'body':_0x434d81[_0xbd73('0x50')]};var _0x360f6c={'account':{'id':_0x1d4675[_0xbd73('0xe3')]},'body':_0x21c2da,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xbd73('0xe9'),_0xbd73('0xea'),_0x360f6c,client9001)['then'](function(){return _0x434d81;})[_0xbd73('0x4a')](function(_0xa5c37a){logger[_0xbd73('0x1f')](_0xa5c37a);});}return;})[_0xbd73('0x19')](function(){if(_0x434d81){return _0x434d81;}})[_0xbd73('0x19')](respondWithResult(_0x31b627,null))[_0xbd73('0x4a')](function(_0x4d08ec){logger[_0xbd73('0x1f')]('catch',_0x4d08ec);for(var _0x1300a6 of _0x514a7b){var _0x44f796=path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0xd3'),_0xbd73('0xc4'),'attachments',_0xbd73('0xeb'),_0x1300a6[_0xbd73('0x69')]);fs_extra[_0xbd73('0xec')](_0x44f796)[_0xbd73('0x4a')](function(_0x46219a){logger[_0xbd73('0x1f')](_0xbd73('0xed'),_0x44f796,_0x46219a);});}});};exports[_0xbd73('0xee')]=function(_0x9888,_0x24a20f){return db[_0xbd73('0xaf')][_0xbd73('0x54')]({'where':{'id':_0x9888[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x24a20f,null))[_0xbd73('0x19')](function(_0x250eb4){if(_0x250eb4){return _0x250eb4['addInteraction'](_0x9888[_0xbd73('0x50')][_0xbd73('0x65')],_['omit'](_0x9888[_0xbd73('0x50')],['ids','id'])||{});}})[_0xbd73('0x19')](respondWithResult(_0x24a20f,null))[_0xbd73('0x4a')](handleError(_0x24a20f,null));};exports['getInteractions']=function(_0x38f052,_0x30da80){var _0x2a2e9a={'raw':![],'where':{}};var _0x3ddaf4={};var _0x23fcba={'count':0x0,'rows':[]};return db[_0xbd73('0x35')][_0xbd73('0x63')]({'where':{'id':_0x38f052[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x30da80,null))[_0xbd73('0x19')](function(_0x5c649f){if(_0x5c649f){_0x3ddaf4[_0xbd73('0x38')]=_[_0xbd73('0x3a')](db['ChatInteraction'][_0xbd73('0x36')]);_0x3ddaf4['query']=_[_0xbd73('0x3a')](_0x38f052[_0xbd73('0x39')]);_0x3ddaf4['filters']=_[_0xbd73('0x3d')](_0x3ddaf4[_0xbd73('0x38')],_0x3ddaf4[_0xbd73('0x39')]);_0x2a2e9a['attributes']=_[_0xbd73('0x3d')](_0x3ddaf4[_0xbd73('0x38')],qs['fields'](_0x38f052[_0xbd73('0x39')]['fields']));_0x2a2e9a[_0xbd73('0x3c')]=_0x2a2e9a[_0xbd73('0x3c')][_0xbd73('0x3f')]?_0x2a2e9a[_0xbd73('0x3c')]:_0x3ddaf4[_0xbd73('0x38')];if(!_0x38f052[_0xbd73('0x39')][_0xbd73('0x40')](_0xbd73('0x41'))){_0x2a2e9a[_0xbd73('0x27')]=qs[_0xbd73('0x27')](_0x38f052[_0xbd73('0x39')][_0xbd73('0x27')]);_0x2a2e9a[_0xbd73('0x28')]=qs[_0xbd73('0x28')](_0x38f052['query'][_0xbd73('0x28')]);}_0x2a2e9a[_0xbd73('0x42')]=qs[_0xbd73('0x5c')](_0x38f052['query'][_0xbd73('0x5c')]);_0x2a2e9a[_0xbd73('0x43')]=qs[_0xbd73('0x3b')](_['pick'](_0x38f052[_0xbd73('0x39')],_0x3ddaf4[_0xbd73('0x3b')]));_0x2a2e9a[_0xbd73('0x43')][_0xbd73('0x5a')]=_0x5c649f['id'];if(_0x38f052[_0xbd73('0x39')][_0xbd73('0x45')]){_0x2a2e9a[_0xbd73('0x43')]=_[_0xbd73('0x46')](_0x2a2e9a[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x2a2e9a[_0xbd73('0x3c')],function(_0x2efcc0){var _0x4e2a1d={};_0x4e2a1d[_0x2efcc0]={'$like':'%'+_0x38f052[_0xbd73('0x39')][_0xbd73('0x45')]+'%'};return _0x4e2a1d;})});}_0x2a2e9a=_[_0xbd73('0x46')]({},_0x2a2e9a,_0x38f052['options']);return db['ChatInteraction'][_0xbd73('0x29')]({'where':_0x2a2e9a[_0xbd73('0x43')]})['then'](function(_0x13d599){_0x23fcba[_0xbd73('0x29')]=_0x13d599;if(_0x38f052[_0xbd73('0x39')]['includeAll']){_0x2a2e9a[_0xbd73('0x5d')]=[{'model':db[_0xbd73('0x87')],'as':_0xbd73('0xef'),'required':![]},{'model':db[_0xbd73('0xbb')],'as':_0xbd73('0xf0'),'attributes':[_0xbd73('0x30'),_0xbd73('0xf1'),_0xbd73('0xf2')],'required':![]},{'model':db[_0xbd73('0xf3')],'as':_0xbd73('0xf4'),'attributes':['id',_0xbd73('0x30'),_0xbd73('0xf5')],'where':_0x38f052[_0xbd73('0x39')][_0xbd73('0xf6')]?{'id':_0x38f052[_0xbd73('0x39')][_0xbd73('0xf6')]}:undefined,'required':_0x38f052['query'][_0xbd73('0xf6')]?!![]:![]}];}return db['ChatInteraction'][_0xbd73('0x49')](_0x2a2e9a);})[_0xbd73('0x19')](function(_0x4fe8cb){_0x23fcba[_0xbd73('0x5e')]=_0x4fe8cb;return _0x23fcba;});}})['then'](respondWithFilteredResult(_0x30da80,_0x2a2e9a))[_0xbd73('0x4a')](handleError(_0x30da80,null));};function iftimePromise(_0x1d6503,_0x1ba7b3){return respondWithRpcPromise(_0xbd73('0xf7'),_0xbd73('0xf8'),{'command':_0x1ba7b3[_0xbd73('0xf9')]?util[_0xbd73('0xa8')](_0xbd73('0xfa'),_0x1d6503[_0xbd73('0xfb')],_0x1ba7b3['timezone']):util[_0xbd73('0xa8')](_0xbd73('0xfc'),_0x1d6503[_0xbd73('0xfb')])},client9002)['then'](function(_0x11d058){var _0x54f405=_0x11d058&&_0x11d058['indexOf'](_0xbd73('0xfd'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1ba7b3['id'],_0x1d6503['id'],_0x1d6503[_0xbd73('0xfb')],_0x54f405?_0xbd73('0xfe'):'OFFLINE',_0x1ba7b3[_0xbd73('0xf9')]?_0x1ba7b3[_0xbd73('0xf9')]:_0xbd73('0xff'));return _0x54f405;})['catch'](function(_0x10ab87){logger[_0xbd73('0x1f')](_0xbd73('0x100'),_0x1ba7b3['id'],_0x1d6503['id'],_0x1d6503[_0xbd73('0xfb')],util[_0xbd73('0x101')](_0x10ab87,{'showHidden':![],'depth':null}),_0x1ba7b3[_0xbd73('0xf9')]?_0x1ba7b3[_0xbd73('0xf9')]:_0xbd73('0xff'));return![];});}exports['getSnippet']=function(_0x2ab827,_0x206764){var _0x3d0761=0x0;var _0x170125=0x0;var _0xb9fce1=![];var _0x2595b2;var _0x45852b;return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x2ab827['params']['id']},'include':[{'model':db[_0xbd73('0x102')],'as':_0xbd73('0x102'),'include':[{'model':db['Interval'],'as':_0xbd73('0x103'),'attributes':['id',_0xbd73('0xfb')],'raw':!![]}]}]})[_0xbd73('0x19')](handleEntityNotFound(_0x206764,null))[_0xbd73('0x19')](function(_0x3f40f2){if(_0x3f40f2){_0x2595b2=_0x3f40f2;return _0x3f40f2['getProactiveActions']({'raw':!![]});}})[_0xbd73('0x19')](function(_0x5e2814){if(_0x2595b2){if(_0x5e2814){_0x45852b=_0x5e2814;}}return require(_0xbd73('0x104'))[_0xbd73('0x72')]();})['then'](function(_0x2340a2){if(_0x2340a2){_0x170125=_0x2340a2[_0xbd73('0x105')];_0xb9fce1=_0x2340a2[_0xbd73('0x73')];}})[_0xbd73('0x19')](function(){return db['ChatInteraction'][_0xbd73('0x29')]({'where':{'closed':![]}});})[_0xbd73('0x19')](function(_0x4db64b){_0x3d0761=_0x4db64b;if(_0x170125&&_0x4db64b>_0x170125){return db[_0xbd73('0x106')][_0xbd73('0x63')]({'where':{'id':0x1}})[_0xbd73('0x19')](function(_0x4bd356){if(_0x4bd356){_0x4bd356[_0xbd73('0x107')](_0xbd73('0x108'));}});}})[_0xbd73('0x19')](function(){if(_0x2595b2['Interval']&&_0x2595b2[_0xbd73('0x102')]['Intervals']){var _0x5e5ef1=[];for(var _0x2e8b35=0x0;_0x2e8b35<_0x2595b2['Interval'][_0xbd73('0x103')][_0xbd73('0x3f')];_0x2e8b35++){var _0x198a81=_0x2595b2[_0xbd73('0x102')][_0xbd73('0x103')][_0x2e8b35][_0xbd73('0x52')]({'plain':!![]});_0x5e5ef1[_0xbd73('0xb6')](iftimePromise(_0x198a81,_0x2595b2));}return BPromise['all'](_0x5e5ef1)[_0xbd73('0x19')](function(_0x337211){return _[_0xbd73('0x109')](_0x337211);});}else{return!![];}})[_0xbd73('0x19')](function(_0x45a588){var _0x414b1f=fs['readFileSync'](path[_0xbd73('0x70')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x45a820={'remote':_0x2595b2[_0xbd73('0x10a')],'query':querystring['stringify'](_[_0xbd73('0x46')](_0x2595b2[_0xbd73('0x52')]({'plain':!![]}),{'customerIp':_0x2ab827['headers'][_0xbd73('0xa2')]||_0x2ab827[_0xbd73('0x83')][_0xbd73('0x10b')]||_0x2ab827[_0xbd73('0x10c')][_0xbd73('0x10d')]||_0x2ab827['ip'],'referer':_0x2ab827[_0xbd73('0x83')]['referer'],'openedInteractions':_0x3d0761,'maxInteractions':_0x170125,'virtual':_0xb9fce1[_0xbd73('0x105')],'online':_0x45a588,'custom':_0xb9fce1}))[_0xbd73('0x10e')](/'/g,'\x5c\x27')};_0x206764[_0xbd73('0x31')](ejs[_0xbd73('0xcc')](Mustache[_0xbd73('0xcc')](_0x414b1f,_0x45a820),{'proactiveActions':_0x45852b,'alignment':_0x2595b2[_0xbd73('0x10f')],'verticalAlignment':_0x2595b2[_0xbd73('0x110')],'div_color':_0x2595b2[_0xbd73('0xf5')],'labelText':_0x2595b2['labelText'],'text_color':_0x2595b2[_0xbd73('0x111')],'text_button_color':_0x2595b2[_0xbd73('0x112')],'button_color':_0x2595b2['color_button'],'background_color':_0x2595b2[_0xbd73('0x113')],'hideWhenOffline':_0x2595b2[_0xbd73('0x114')],'interval':_0x2595b2['IntervalId']}));})[_0xbd73('0x4a')](handleError(_0x206764,null));};exports[_0xbd73('0x115')]=function(_0x489a73,_0x909c24){var _0x51de11=_0x489a73[_0xbd73('0x57')]['id'];var _0x3a3615=_0x489a73[_0xbd73('0x50')];var _0x431aee=0xc8;var _0x575071=null;return db[_0xbd73('0x116')][_0xbd73('0xd6')]({'isolationLevel':db[_0xbd73('0x116')][_0xbd73('0x117')][_0xbd73('0x118')][_0xbd73('0x119')]},function(_0x35a138){return db['ChatWebsite']['findOne']({'where':{'id':_0x51de11},'transaction':_0x35a138})[_0xbd73('0x19')](function(_0x44d626){if(_0x44d626){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x51de11},'transaction':_0x35a138})[_0xbd73('0x19')](function(){var _0x389250=_[_0xbd73('0x34')](_0x3a3615,function(_0x1b37e2){_0x1b37e2[_0xbd73('0x5a')]=_0x51de11;return _0x1b37e2;});return db[_0xbd73('0x11a')][_0xbd73('0xd8')](_0x389250,{'transaction':_0x35a138});});}else{_0x431aee=0x194;_0x575071=[];}});})[_0xbd73('0x19')](function(){if(_0x431aee!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x51de11},'order':_0xbd73('0x9b')})[_0xbd73('0x19')](function(_0x2f3113){_0x575071=_0x2f3113;});}})['catch'](function(_0x4e1107){_0x431aee=0x1f4;logger[_0xbd73('0x1f')](_0x4e1107[_0xbd73('0x2f')]);if(_0x4e1107['name']){delete _0x4e1107[_0xbd73('0x30')];}_0x575071=_0x4e1107;})[_0xbd73('0x11b')](function(){if(_0x575071===null){_0x909c24['sendStatus'](_0x431aee);}else{if(_0x431aee===0x1f4){_0x909c24[_0xbd73('0x24')](_0x431aee)[_0xbd73('0x31')](_0x575071);}else{_0x909c24[_0xbd73('0x24')](_0x431aee)[_0xbd73('0x25')](_0x575071);}}});};exports[_0xbd73('0x11c')]=function(_0xf7a018,_0x3e68f5){var _0x1f9076={};var _0x460a34={};var _0x70fe38;var _0x16004b;return db[_0xbd73('0x35')]['findOne']({'where':{'id':_0xf7a018['params']['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x3e68f5,null))[_0xbd73('0x19')](function(_0x143869){if(_0x143869){_0x70fe38=_0x143869;_0x460a34[_0xbd73('0x38')]=_['keys'](db[_0xbd73('0x11a')][_0xbd73('0x36')]);_0x460a34['query']=_[_0xbd73('0x3a')](_0xf7a018['query']);_0x460a34[_0xbd73('0x3b')]=_[_0xbd73('0x3d')](_0x460a34['model'],_0x460a34[_0xbd73('0x39')]);_0x1f9076[_0xbd73('0x3c')]=_[_0xbd73('0x3d')](_0x460a34[_0xbd73('0x38')],qs[_0xbd73('0x3e')](_0xf7a018[_0xbd73('0x39')]['fields']));_0x1f9076['attributes']=_0x1f9076['attributes'][_0xbd73('0x3f')]?_0x1f9076[_0xbd73('0x3c')]:_0x460a34[_0xbd73('0x38')];_0x1f9076[_0xbd73('0x42')]=qs[_0xbd73('0x5c')](_0xf7a018[_0xbd73('0x39')][_0xbd73('0x5c')]);_0x1f9076[_0xbd73('0x43')]=qs['filters'](_[_0xbd73('0x44')](_0xf7a018[_0xbd73('0x39')],_0x460a34['filters']));if(_0xf7a018[_0xbd73('0x39')]['filter']){_0x1f9076[_0xbd73('0x43')]=_['merge'](_0x1f9076[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x1f9076[_0xbd73('0x3c')],function(_0x30622d){var _0x720df1={};_0x720df1[_0x30622d]={'$like':'%'+_0xf7a018['query'][_0xbd73('0x45')]+'%'};return _0x720df1;})});}_0x1f9076=_[_0xbd73('0x46')]({},_0x1f9076,_0xf7a018[_0xbd73('0x4e')]);return _0x70fe38['getApplications'](_0x1f9076);}})['then'](function(_0x4b4e56){if(_0x4b4e56){_0x16004b=_0x4b4e56['length'];if(!_0xf7a018[_0xbd73('0x39')][_0xbd73('0x40')](_0xbd73('0x41'))){_0x1f9076[_0xbd73('0x27')]=qs[_0xbd73('0x27')](_0xf7a018['query'][_0xbd73('0x27')]);_0x1f9076[_0xbd73('0x28')]=qs[_0xbd73('0x28')](_0xf7a018[_0xbd73('0x39')][_0xbd73('0x28')]);}return _0x70fe38[_0xbd73('0x11c')](_0x1f9076);}})['then'](function(_0x1d7198){if(_0x1d7198){return _0x1d7198?{'count':_0x16004b,'rows':_0x1d7198}:null;}})[_0xbd73('0x19')](respondWithResult(_0x3e68f5,null))[_0xbd73('0x4a')](handleError(_0x3e68f5,null));};exports['addProactiveActions']=function(_0x510e86,_0x3899b7){return db['chatProactiveAction'][_0xbd73('0x54')]({'where':{'id':_0x510e86['params']['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x3899b7,null))[_0xbd73('0x19')](function(_0x4a39b7){if(_0x4a39b7){return _0x4a39b7[_0xbd73('0x11d')](_0x510e86[_0xbd73('0x50')][_0xbd73('0x65')],_[_0xbd73('0x11e')](_0x510e86[_0xbd73('0x50')],['ids','id'])||{});}})[_0xbd73('0x19')](respondWithResult(_0x3899b7,null))['catch'](handleError(_0x3899b7,null));};exports[_0xbd73('0x11f')]=function(_0x2a80bc,_0x1f3f35){var _0x3fb346={};var _0x398e6b={};var _0x44568d;var _0x5a84b7;return db[_0xbd73('0x35')][_0xbd73('0x63')]({'where':{'id':_0x2a80bc[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x1f3f35,null))[_0xbd73('0x19')](function(_0xf8fb9e){if(_0xf8fb9e){_0x44568d=_0xf8fb9e;_0x398e6b[_0xbd73('0x38')]=_[_0xbd73('0x3a')](db[_0xbd73('0x120')]['rawAttributes']);_0x398e6b['query']=_['keys'](_0x2a80bc[_0xbd73('0x39')]);_0x398e6b[_0xbd73('0x3b')]=_[_0xbd73('0x3d')](_0x398e6b[_0xbd73('0x38')],_0x398e6b[_0xbd73('0x39')]);_0x3fb346[_0xbd73('0x3c')]=_[_0xbd73('0x3d')](_0x398e6b[_0xbd73('0x38')],qs[_0xbd73('0x3e')](_0x2a80bc[_0xbd73('0x39')]['fields']));_0x3fb346[_0xbd73('0x3c')]=_0x3fb346['attributes']['length']?_0x3fb346[_0xbd73('0x3c')]:_0x398e6b[_0xbd73('0x38')];_0x3fb346['order']=qs[_0xbd73('0x5c')](_0x2a80bc[_0xbd73('0x39')][_0xbd73('0x5c')]);_0x3fb346[_0xbd73('0x43')]=qs[_0xbd73('0x3b')](_[_0xbd73('0x44')](_0x2a80bc['query'],_0x398e6b['filters']));if(_0x2a80bc['query'][_0xbd73('0x45')]){_0x3fb346[_0xbd73('0x43')]=_[_0xbd73('0x46')](_0x3fb346[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x3fb346[_0xbd73('0x3c')],function(_0x42d039){var _0x3a3a8a={};_0x3a3a8a[_0x42d039]={'$like':'%'+_0x2a80bc[_0xbd73('0x39')]['filter']+'%'};return _0x3a3a8a;})});}_0x3fb346=_[_0xbd73('0x46')]({},_0x3fb346,_0x2a80bc[_0xbd73('0x4e')]);return _0x44568d[_0xbd73('0x11f')](_0x3fb346);}})[_0xbd73('0x19')](function(_0x4eeb4e){if(_0x4eeb4e){_0x5a84b7=_0x4eeb4e[_0xbd73('0x3f')];if(!_0x2a80bc[_0xbd73('0x39')][_0xbd73('0x40')](_0xbd73('0x41'))){_0x3fb346[_0xbd73('0x27')]=qs[_0xbd73('0x27')](_0x2a80bc[_0xbd73('0x39')][_0xbd73('0x27')]);_0x3fb346[_0xbd73('0x28')]=qs[_0xbd73('0x28')](_0x2a80bc[_0xbd73('0x39')]['offset']);}return _0x44568d[_0xbd73('0x11f')](_0x3fb346);}})[_0xbd73('0x19')](function(_0x5e56d6){if(_0x5e56d6){return _0x5e56d6?{'count':_0x5a84b7,'rows':_0x5e56d6}:null;}})[_0xbd73('0x19')](respondWithResult(_0x1f3f35,null))[_0xbd73('0x4a')](handleError(_0x1f3f35,null));};exports[_0xbd73('0x121')]=function(_0x30f07f,_0x40a24b){var _0x192f3f=_0x30f07f[_0xbd73('0x39')][_0xbd73('0x122')]===_0xbd73('0x123')?_0xbd73('0x124'):_0xbd73('0x125');return db[_0xbd73('0x35')][_0xbd73('0x54')]({'attributes':['id',_0x192f3f],'where':{'id':_0x30f07f[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x40a24b,null))[_0xbd73('0x19')](function(_0x2062a4){if(_0x2062a4){var _0x364785=_0x2062a4[_0x192f3f];var _0x1f37af=_0x364785&&_0x364785['items']?_0x364785[_0xbd73('0x126')]:[];_0x40a24b[_0xbd73('0x31')]({'fromKey':_[_0xbd73('0x74')](_0x364785[_0xbd73('0x127')])?undefined:_0x364785[_0xbd73('0x127')],'count':_0x1f37af[_0xbd73('0x3f')],'rows':_0x1f37af});}})['catch'](handleError(_0x40a24b,null));};exports[_0xbd73('0x128')]=function(_0x367a14,_0x6ac66e){var _0x283ea7={'raw':![],'where':{}};var _0x2dcba3={};var _0x4bc7cc={'count':0x0,'rows':[]};return db[_0xbd73('0x35')][_0xbd73('0x63')]({'where':{'id':_0x367a14[_0xbd73('0x57')]['id']}})['then'](handleEntityNotFound(_0x6ac66e,null))[_0xbd73('0x19')](function(_0x19cb76){if(_0x19cb76){_0x2dcba3['model']=_['keys'](db[_0xbd73('0xcf')]['rawAttributes']);_0x2dcba3['query']=_[_0xbd73('0x3a')](_0x367a14[_0xbd73('0x39')]);_0x2dcba3[_0xbd73('0x3b')]=_['intersection'](_0x2dcba3[_0xbd73('0x38')],_0x2dcba3[_0xbd73('0x39')]);_0x283ea7[_0xbd73('0x3c')]=_[_0xbd73('0x3d')](_0x2dcba3[_0xbd73('0x38')],qs[_0xbd73('0x3e')](_0x367a14[_0xbd73('0x39')][_0xbd73('0x3e')]));_0x283ea7[_0xbd73('0x3c')]=_0x283ea7[_0xbd73('0x3c')][_0xbd73('0x3f')]?_0x283ea7[_0xbd73('0x3c')]:_0x2dcba3[_0xbd73('0x38')];if(!_0x367a14[_0xbd73('0x39')]['hasOwnProperty'](_0xbd73('0x41'))){_0x283ea7['limit']=qs['limit'](_0x367a14['query']['limit']);_0x283ea7[_0xbd73('0x28')]=qs[_0xbd73('0x28')](_0x367a14[_0xbd73('0x39')][_0xbd73('0x28')]);}_0x283ea7[_0xbd73('0x42')]=qs[_0xbd73('0x5c')](_0x367a14[_0xbd73('0x39')][_0xbd73('0x5c')]);_0x283ea7[_0xbd73('0x43')]=qs[_0xbd73('0x3b')](_[_0xbd73('0x44')](_0x367a14['query'],_0x2dcba3[_0xbd73('0x3b')]));_0x283ea7[_0xbd73('0x43')][_0xbd73('0x5a')]=_0x19cb76['id'];if(_0x367a14['query']['filter']){_0x283ea7[_0xbd73('0x43')]=_['merge'](_0x283ea7[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x283ea7[_0xbd73('0x3c')],function(_0x23c4a1){var _0x366caf={};_0x366caf[_0x23c4a1]={'$like':'%'+_0x367a14['query'][_0xbd73('0x45')]+'%'};return _0x366caf;})});}_0x283ea7=_[_0xbd73('0x46')]({},_0x283ea7,_0x367a14['options']);return db[_0xbd73('0xcf')][_0xbd73('0x29')]({'where':_0x283ea7[_0xbd73('0x43')]})[_0xbd73('0x19')](function(_0x2e82bb){_0x4bc7cc[_0xbd73('0x29')]=_0x2e82bb;if(_0x367a14[_0xbd73('0x39')]['includeAll']){_0x283ea7[_0xbd73('0x5d')]=[{'all':!![]}];}else{_0x283ea7['include']=[{'model':db[_0xbd73('0x87')],'as':_0xbd73('0xef'),'required':![]},{'model':db[_0xbd73('0xd7')],'as':_0xbd73('0x129'),'required':![]}];}return db[_0xbd73('0xcf')][_0xbd73('0x49')](_0x283ea7);})[_0xbd73('0x19')](function(_0x58d8ee){_0x4bc7cc[_0xbd73('0x5e')]=_0x58d8ee;return _0x4bc7cc;});}})[_0xbd73('0x19')](respondWithFilteredResult(_0x6ac66e,_0x283ea7))[_0xbd73('0x4a')](handleError(_0x6ac66e,null));};exports[_0xbd73('0x12a')]=function(_0x5f13cc,_0x5e24b0){return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x5f13cc[_0xbd73('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e24b0,null))[_0xbd73('0x19')](function(_0x446e5e){if(_0x446e5e){return _0x446e5e[_0xbd73('0x12a')](_0x5f13cc['body'][_0xbd73('0x65')],_[_0xbd73('0x11e')](_0x5f13cc[_0xbd73('0x50')],['ids','id'])||{})[_0xbd73('0xb2')](function(_0x1bc924){for(var _0x4b1903=0x0;_0x4b1903<_0x5f13cc[_0xbd73('0x50')][_0xbd73('0x65')][_0xbd73('0x3f')];_0x4b1903+=0x1){socket[_0xbd73('0x12b')](_0xbd73('0x12c'),{'UserId':Number(_0x5f13cc['body']['ids'][_0x4b1903]),'ChatWebsiteId':Number(_0x5f13cc[_0xbd73('0x57')]['id'])});}return _0x1bc924;});}})[_0xbd73('0x19')](respondWithResult(_0x5e24b0,null))[_0xbd73('0x4a')](handleError(_0x5e24b0,null));};exports[_0xbd73('0x12d')]=function(_0x46f545,_0x35026d){return db['ChatWebsite']['find']({'where':{'id':_0x46f545[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x35026d,null))['then'](function(_0x482bc1){if(_0x482bc1){return _0x482bc1[_0xbd73('0x12d')](_0x46f545[_0xbd73('0x39')][_0xbd73('0x65')])['then'](function(){if(_[_0xbd73('0x12e')](_0x46f545['query'][_0xbd73('0x65')])){for(var _0x100972=0x0;_0x100972<_0x46f545['query'][_0xbd73('0x65')][_0xbd73('0x3f')];_0x100972+=0x1){socket['emit'](_0xbd73('0x12f'),{'UserId':Number(_0x46f545[_0xbd73('0x39')]['ids'][_0x100972]),'ChatWebsiteId':Number(_0x46f545[_0xbd73('0x57')]['id'])});}}else{socket[_0xbd73('0x12b')]('userChatWebsite:remove',{'UserId':Number(_0x46f545[_0xbd73('0x39')][_0xbd73('0x65')]),'ChatWebsiteId':Number(_0x46f545[_0xbd73('0x57')]['id'])});}});}})[_0xbd73('0x19')](respondWithStatusCode(_0x35026d,null))[_0xbd73('0x4a')](handleError(_0x35026d,null));};exports[_0xbd73('0x130')]=function(_0x20ba2d,_0xc2fd83){var _0x5e7892={};var _0x39b05d={};var _0x5f1907;var _0x230045;return db['ChatWebsite'][_0xbd73('0x63')]({'where':{'id':_0x20ba2d[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0xc2fd83,null))[_0xbd73('0x19')](function(_0x58eb9f){if(_0x58eb9f){_0x5f1907=_0x58eb9f;_0x39b05d[_0xbd73('0x38')]=_[_0xbd73('0x3a')](db[_0xbd73('0xbb')]['rawAttributes']);_0x39b05d['query']=_['keys'](_0x20ba2d[_0xbd73('0x39')]);_0x39b05d[_0xbd73('0x3b')]=_[_0xbd73('0x3d')](_0x39b05d[_0xbd73('0x38')],_0x39b05d[_0xbd73('0x39')]);_0x5e7892[_0xbd73('0x3c')]=_['intersection'](_0x39b05d[_0xbd73('0x38')],qs['fields'](_0x20ba2d[_0xbd73('0x39')]['fields']));_0x5e7892[_0xbd73('0x3c')]=_0x5e7892[_0xbd73('0x3c')]['length']?_0x5e7892[_0xbd73('0x3c')]:_0x39b05d[_0xbd73('0x38')];_0x5e7892[_0xbd73('0x42')]=qs[_0xbd73('0x5c')](_0x20ba2d['query']['sort']);_0x5e7892['where']=qs[_0xbd73('0x3b')](_['pick'](_0x20ba2d[_0xbd73('0x39')],_0x39b05d['filters']));if(_0x20ba2d[_0xbd73('0x39')]['filter']){_0x5e7892[_0xbd73('0x43')]=_['merge'](_0x5e7892[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x5e7892[_0xbd73('0x3c')],function(_0x332022){var _0x3f1ee4={};_0x3f1ee4[_0x332022]={'$like':'%'+_0x20ba2d[_0xbd73('0x39')][_0xbd73('0x45')]+'%'};return _0x3f1ee4;})});}_0x5e7892=_['merge']({},_0x5e7892,_0x20ba2d[_0xbd73('0x4e')]);return _0x5f1907[_0xbd73('0x130')](_0x5e7892);}})[_0xbd73('0x19')](function(_0x56422f){if(_0x56422f){_0x230045=_0x56422f[_0xbd73('0x3f')];if(!_0x20ba2d['query'][_0xbd73('0x40')](_0xbd73('0x41'))){_0x5e7892['limit']=qs[_0xbd73('0x27')](_0x20ba2d[_0xbd73('0x39')][_0xbd73('0x27')]);_0x5e7892['offset']=qs[_0xbd73('0x28')](_0x20ba2d['query']['offset']);}return _0x5f1907[_0xbd73('0x130')](_0x5e7892);}})[_0xbd73('0x19')](function(_0x7b24fc){if(_0x7b24fc){return _0x7b24fc?{'count':_0x230045,'rows':_0x7b24fc}:null;}})[_0xbd73('0x19')](respondWithResult(_0xc2fd83,null))[_0xbd73('0x4a')](handleError(_0xc2fd83,null));}; \ No newline at end of file +var _0x22ea=['includes','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy','priority','asc','defaults','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','version','format','%s\x20%s','browser','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','files','send','mapKeyOffline','MailAccount','findOrCreate','readFileSync','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','NotifyMailAccount','notifyMail','server','addInteraction','Contact','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','fs-extra','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','catch','sendStatus','status','json','undefined','limit','count','offset','set','update','destroy','get','end','stack','name','map','ChatWebsite','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','Pause','mandatoryDispositionPause','keys','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','sort','options','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','isNil','existsSync','join','server/files/images/logos/','getAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x2ccc71,_0x1c458a){var _0x20fa15=function(_0x320e61){while(--_0x320e61){_0x2ccc71['push'](_0x2ccc71['shift']());}};_0x20fa15(++_0x1c458a);}(_0x22ea,0x98));var _0xa22e=function(_0x5706c9,_0x536d73){_0x5706c9=_0x5706c9-0x0;var _0x46a585=_0x22ea[_0x5706c9];return _0x46a585;};'use strict';var BPromise=require(_0xa22e('0x0'));var Mustache=require(_0xa22e('0x1'));var util=require(_0xa22e('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa22e('0x3'));var _=require('lodash');var querystring=require('querystring');var Redis=require('ioredis');var qs=require(_0xa22e('0x4'));var logger=require(_0xa22e('0x5'))(_0xa22e('0x6'));var config=require(_0xa22e('0x7'));var db=require(_0xa22e('0x8'))['db'];config[_0xa22e('0x9')]=_['defaults'](config[_0xa22e('0x9')],{'host':_0xa22e('0xa'),'port':0x18eb});var socket=require(_0xa22e('0xb'))(new Redis(config[_0xa22e('0x9')]));require(_0xa22e('0xc'))['register'](socket);var htmlToText=require(_0xa22e('0xd'));var jayson=require(_0xa22e('0xe'));var client=jayson[_0xa22e('0xf')][_0xa22e('0x10')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson['client'][_0xa22e('0x10')]({'port':0x232b});var client9001=jayson[_0xa22e('0xf')][_0xa22e('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x592c72,_0x5051e3,_0x1c3306,_0x214476){return new BPromise(function(_0x4b7db6,_0x439b0b){var _0x38bbfa=_0x214476||client;return _0x38bbfa[_0xa22e('0x11')](_0x592c72,_0x1c3306)[_0xa22e('0x12')](function(_0xcf2dac){logger[_0xa22e('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x5051e3,'request\x20sent');logger[_0xa22e('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5051e3,_0xa22e('0x15'),JSON[_0xa22e('0x16')](_0xcf2dac));if(_0xcf2dac['error']){if(_0xcf2dac[_0xa22e('0x17')][_0xa22e('0x18')]===0x1f4){logger[_0xa22e('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5051e3,_0xcf2dac[_0xa22e('0x17')][_0xa22e('0x19')]);return _0x439b0b(_0xcf2dac[_0xa22e('0x17')][_0xa22e('0x19')]);}logger[_0xa22e('0x17')](_0xa22e('0x1a'),_0x5051e3,_0xcf2dac['error'][_0xa22e('0x19')]);return _0x4b7db6(_0xcf2dac[_0xa22e('0x17')][_0xa22e('0x19')]);}else{logger[_0xa22e('0x13')](_0xa22e('0x1a'),_0x5051e3,_0xa22e('0x15'));_0x4b7db6(_0xcf2dac['result'][_0xa22e('0x19')]);}})[_0xa22e('0x1b')](function(_0x1f11b0){logger[_0xa22e('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5051e3,_0x1f11b0);_0x439b0b(_0x1f11b0);});});}function respondWithStatusCode(_0x592ab1,_0x2eec4e){_0x2eec4e=_0x2eec4e||0xcc;return function(_0x475d0f){if(_0x475d0f){return _0x592ab1[_0xa22e('0x1c')](_0x2eec4e);}return _0x592ab1[_0xa22e('0x1d')](_0x2eec4e)['end']();};}function respondWithResult(_0x278292,_0x1b12c2){_0x1b12c2=_0x1b12c2||0xc8;return function(_0x21ee85){if(_0x21ee85){return _0x278292[_0xa22e('0x1d')](_0x1b12c2)[_0xa22e('0x1e')](_0x21ee85);}};}function respondWithFilteredResult(_0x227d6c,_0x133038){return function(_0x3cb97e){if(_0x3cb97e){var _0x145299=typeof _0x133038['offset']===_0xa22e('0x1f')&&typeof _0x133038[_0xa22e('0x20')]===_0xa22e('0x1f');var _0x47522b=_0x3cb97e[_0xa22e('0x21')];var _0x13d055=_0x145299?0x0:_0x133038[_0xa22e('0x22')];var _0x1387f3=_0x145299?_0x3cb97e[_0xa22e('0x21')]:_0x133038[_0xa22e('0x22')]+_0x133038[_0xa22e('0x20')];var _0x5abb32;if(_0x1387f3>=_0x47522b){_0x1387f3=_0x47522b;_0x5abb32=0xc8;}else{_0x5abb32=0xce;}_0x227d6c[_0xa22e('0x1d')](_0x5abb32);return _0x227d6c[_0xa22e('0x23')]('Content-Range',_0x13d055+'-'+_0x1387f3+'/'+_0x47522b)[_0xa22e('0x1e')](_0x3cb97e);}return null;};}function saveUpdates(_0x2a045c){return function(_0x21e539){if(_0x21e539){return _0x21e539[_0xa22e('0x24')](_0x2a045c)['then'](function(_0x337f09){return _0x337f09;});}return null;};}function removeEntity(_0x421e9c){return function(_0x140e08){if(_0x140e08){return _0x140e08[_0xa22e('0x25')]()[_0xa22e('0x12')](function(){var _0x3f5c89=_0x140e08[_0xa22e('0x26')]({'plain':!![]});var _0x2de1f8='ChatWebsites';return db['UserProfileResource'][_0xa22e('0x25')]({'where':{'type':_0x2de1f8,'resourceId':_0x3f5c89['id']}})[_0xa22e('0x12')](function(){return _0x140e08;});})[_0xa22e('0x12')](function(){_0x421e9c['status'](0xcc)[_0xa22e('0x27')]();});}};}function handleEntityNotFound(_0x52b9dd){return function(_0x565569){if(!_0x565569){_0x52b9dd[_0xa22e('0x1c')](0x194);}return _0x565569;};}function handleError(_0x15434c,_0x2683af){_0x2683af=_0x2683af||0x1f4;return function(_0x2127c4){logger[_0xa22e('0x17')](_0x2127c4[_0xa22e('0x28')]);if(_0x2127c4[_0xa22e('0x29')]){delete _0x2127c4[_0xa22e('0x29')];}_0x15434c[_0xa22e('0x1d')](_0x2683af)['send'](_0x2127c4);};}exports['index']=function(_0x4eca7c,_0x1c79a5){var _0x4a0cdd={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2fc728={},_0x5435b4={'count':0x0,'rows':[]};var _0x29fb3f=_[_0xa22e('0x2a')](db[_0xa22e('0x2b')]['rawAttributes'],function(_0x2c18a6){return{'name':_0x2c18a6['fieldName'],'type':_0x2c18a6[_0xa22e('0x2c')][_0xa22e('0x2d')]};});_0x2fc728['model']=_['map'](_0x29fb3f,_0xa22e('0x29'));_0x2fc728[_0xa22e('0x2e')]=_['keys'](_0x4eca7c[_0xa22e('0x2e')]);_0x2fc728['filters']=_[_0xa22e('0x2f')](_0x2fc728['model'],_0x2fc728[_0xa22e('0x2e')]);_0x4a0cdd['attributes']=_[_0xa22e('0x2f')](_0x2fc728[_0xa22e('0x30')],qs['fields'](_0x4eca7c['query'][_0xa22e('0x31')]));_0x4a0cdd[_0xa22e('0x32')]=_0x4a0cdd[_0xa22e('0x32')][_0xa22e('0x33')]?_0x4a0cdd[_0xa22e('0x32')]:_0x2fc728[_0xa22e('0x30')];if(!_0x4eca7c[_0xa22e('0x2e')][_0xa22e('0x34')](_0xa22e('0x35'))){_0x4a0cdd[_0xa22e('0x20')]=qs[_0xa22e('0x20')](_0x4eca7c[_0xa22e('0x2e')][_0xa22e('0x20')]);_0x4a0cdd[_0xa22e('0x22')]=qs['offset'](_0x4eca7c['query']['offset']);}_0x4a0cdd[_0xa22e('0x36')]=qs['sort'](_0x4eca7c[_0xa22e('0x2e')]['sort']);_0x4a0cdd[_0xa22e('0x37')]=qs[_0xa22e('0x38')](_[_0xa22e('0x39')](_0x4eca7c[_0xa22e('0x2e')],_0x2fc728['filters']),_0x29fb3f);if(_0x4eca7c[_0xa22e('0x2e')][_0xa22e('0x3a')]){_0x4a0cdd[_0xa22e('0x37')]=_[_0xa22e('0x3b')](_0x4a0cdd[_0xa22e('0x37')],{'$or':_[_0xa22e('0x2a')](_0x29fb3f,function(_0x3aeec8){if(_0x3aeec8[_0xa22e('0x2c')]!==_0xa22e('0x3c')){var _0x56955e={};_0x56955e[_0x3aeec8['name']]={'$like':'%'+_0x4eca7c[_0xa22e('0x2e')][_0xa22e('0x3a')]+'%'};return _0x56955e;}})});}_0x4a0cdd=_['merge']({},_0x4a0cdd,_0x4eca7c['options']);var _0x3e5943={'where':_0x4a0cdd[_0xa22e('0x37')]};return db['ChatWebsite'][_0xa22e('0x21')](_0x3e5943)[_0xa22e('0x12')](function(_0x96d2a9){_0x5435b4[_0xa22e('0x21')]=_0x96d2a9;if(_0x4eca7c[_0xa22e('0x2e')][_0xa22e('0x3d')]){_0x4a0cdd[_0xa22e('0x3e')]=[{'all':!![]}];}return db['ChatWebsite'][_0xa22e('0x3f')](_0x4a0cdd);})['then'](function(_0x332ab4){_0x5435b4['rows']=_0x332ab4;return _0x5435b4;})[_0xa22e('0x12')](respondWithFilteredResult(_0x1c79a5,_0x4a0cdd))[_0xa22e('0x1b')](handleError(_0x1c79a5,null));};exports['show']=function(_0x46a9cf,_0x50e76a){var _0x451519={'raw':![],'where':{'id':_0x46a9cf['params']['id']},'include':[{'model':db[_0xa22e('0x40')],'as':_0xa22e('0x41')}]},_0x5e05ee={};_0x5e05ee[_0xa22e('0x30')]=_[_0xa22e('0x42')](db[_0xa22e('0x2b')][_0xa22e('0x43')]);_0x5e05ee['query']=_['keys'](_0x46a9cf[_0xa22e('0x2e')]);_0x5e05ee[_0xa22e('0x38')]=_['intersection'](_0x5e05ee['model'],_0x5e05ee[_0xa22e('0x2e')]);_0x451519['attributes']=_[_0xa22e('0x2f')](_0x5e05ee[_0xa22e('0x30')],qs[_0xa22e('0x31')](_0x46a9cf[_0xa22e('0x2e')][_0xa22e('0x31')]));_0x451519[_0xa22e('0x32')]=_0x451519[_0xa22e('0x32')][_0xa22e('0x33')]?_0x451519[_0xa22e('0x32')]:_0x5e05ee['model'];if(_0x46a9cf[_0xa22e('0x2e')]['includeAll']){_0x451519[_0xa22e('0x3e')]=[{'all':!![]}];}_0x451519=_[_0xa22e('0x3b')]({},_0x451519,_0x46a9cf['options']);return db[_0xa22e('0x2b')][_0xa22e('0x44')](_0x451519)[_0xa22e('0x12')](handleEntityNotFound(_0x50e76a,null))[_0xa22e('0x12')](respondWithResult(_0x50e76a,null))[_0xa22e('0x1b')](handleError(_0x50e76a,null));};exports[_0xa22e('0x45')]=function(_0x1f0b41,_0x5916a7){return db[_0xa22e('0x2b')][_0xa22e('0x45')](_0x1f0b41[_0xa22e('0x46')],{})[_0xa22e('0x12')](function(_0x39be68){var _0xc980c4=_0x1f0b41['user']['get']({'plain':!![]});if(!_0xc980c4)throw new Error(_0xa22e('0x47'));if(_0xc980c4[_0xa22e('0x48')]==='user'){var _0x1fa320=_0x39be68[_0xa22e('0x26')]({'plain':!![]});var _0x52568b=_0xa22e('0x49');return db[_0xa22e('0x4a')][_0xa22e('0x44')]({'where':{'name':_0x52568b,'userProfileId':_0xc980c4[_0xa22e('0x4b')]},'raw':!![]})['then'](function(_0x7101c8){if(_0x7101c8&&_0x7101c8[_0xa22e('0x4c')]===0x0){return db[_0xa22e('0x4d')][_0xa22e('0x45')]({'name':_0x1fa320[_0xa22e('0x29')],'resourceId':_0x1fa320['id'],'type':_0x7101c8[_0xa22e('0x29')],'sectionId':_0x7101c8['id']},{})[_0xa22e('0x12')](function(){return _0x39be68;});}else{return _0x39be68;}})[_0xa22e('0x1b')](function(_0x4d467e){logger[_0xa22e('0x17')](_0xa22e('0x4e'),_0x4d467e);throw _0x4d467e;});}return _0x39be68;})[_0xa22e('0x12')](respondWithResult(_0x5916a7,0xc9))[_0xa22e('0x1b')](handleError(_0x5916a7,null));};exports[_0xa22e('0x24')]=function(_0x2d5255,_0x26d9fa){if(_0x2d5255[_0xa22e('0x46')]['id']){delete _0x2d5255[_0xa22e('0x46')]['id'];}return db[_0xa22e('0x2b')]['find']({'where':{'id':_0x2d5255[_0xa22e('0x4f')]['id']},'include':[{'model':db[_0xa22e('0x40')],'as':_0xa22e('0x41')}]})['then'](handleEntityNotFound(_0x26d9fa,null))[_0xa22e('0x12')](saveUpdates(_0x2d5255['body'],null))[_0xa22e('0x12')](respondWithResult(_0x26d9fa,null))['catch'](handleError(_0x26d9fa,null));};exports[_0xa22e('0x25')]=function(_0x4255a6,_0xaebe7e){return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x4255a6[_0xa22e('0x4f')]['id']}})['then'](handleEntityNotFound(_0xaebe7e,null))['then'](removeEntity(_0xaebe7e,null))['catch'](handleError(_0xaebe7e,null));};exports[_0xa22e('0x50')]=function(_0x38e41a,_0x1aacf4){return db[_0xa22e('0x2b')][_0xa22e('0x50')]()[_0xa22e('0x12')](respondWithResult(_0x1aacf4,null))['catch'](handleError(_0x1aacf4,null));};exports[_0xa22e('0x51')]=function(_0x131ff0,_0x3f5a0e){if(_0x131ff0[_0xa22e('0x46')]['id']){delete _0x131ff0[_0xa22e('0x46')]['id'];}return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x131ff0['params']['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x3f5a0e,null))[_0xa22e('0x12')](function(_0x59ec6a){if(_0x59ec6a){_0x131ff0['body'][_0xa22e('0x52')]=_0x59ec6a['id'];return db[_0xa22e('0x53')][_0xa22e('0x45')](_0x131ff0[_0xa22e('0x46')]);}})[_0xa22e('0x12')](respondWithResult(_0x3f5a0e,null))['catch'](handleError(_0x3f5a0e,null));};exports[_0xa22e('0x54')]=function(_0x1df760,_0x38ea33){var _0xa4777b={'raw':![],'where':{}};var _0x5d3273={};var _0x4ec2d3={'count':0x0,'rows':[]};return db[_0xa22e('0x2b')][_0xa22e('0x55')]({'where':{'id':_0x1df760['params']['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x38ea33,null))['then'](function(_0x42643c){if(_0x42643c){_0x5d3273['model']=_['keys'](db[_0xa22e('0x53')][_0xa22e('0x43')]);_0x5d3273[_0xa22e('0x2e')]=_[_0xa22e('0x42')](_0x1df760[_0xa22e('0x2e')]);_0x5d3273[_0xa22e('0x38')]=_[_0xa22e('0x2f')](_0x5d3273[_0xa22e('0x30')],_0x5d3273[_0xa22e('0x2e')]);_0xa4777b['attributes']=_[_0xa22e('0x2f')](_0x5d3273[_0xa22e('0x30')],qs[_0xa22e('0x31')](_0x1df760['query'][_0xa22e('0x31')]));_0xa4777b[_0xa22e('0x32')]=_0xa4777b['attributes'][_0xa22e('0x33')]?_0xa4777b['attributes']:_0x5d3273['model'];if(!_0x1df760[_0xa22e('0x2e')][_0xa22e('0x34')](_0xa22e('0x35'))){_0xa4777b[_0xa22e('0x20')]=qs['limit'](_0x1df760[_0xa22e('0x2e')][_0xa22e('0x20')]);_0xa4777b['offset']=qs['offset'](_0x1df760[_0xa22e('0x2e')][_0xa22e('0x22')]);}_0xa4777b[_0xa22e('0x36')]=qs[_0xa22e('0x56')](_0x1df760[_0xa22e('0x2e')]['sort']);_0xa4777b[_0xa22e('0x37')]=qs[_0xa22e('0x38')](_[_0xa22e('0x39')](_0x1df760['query'],_0x5d3273[_0xa22e('0x38')]));_0xa4777b[_0xa22e('0x37')][_0xa22e('0x52')]=_0x42643c['id'];if(_0x1df760[_0xa22e('0x2e')][_0xa22e('0x3a')]){_0xa4777b['where']=_[_0xa22e('0x3b')](_0xa4777b[_0xa22e('0x37')],{'$or':_['map'](_0xa4777b[_0xa22e('0x32')],function(_0x443823){var _0x51ddf2={};_0x51ddf2[_0x443823]={'$like':'%'+_0x1df760[_0xa22e('0x2e')][_0xa22e('0x3a')]+'%'};return _0x51ddf2;})});}_0xa4777b=_[_0xa22e('0x3b')]({},_0xa4777b,_0x1df760[_0xa22e('0x57')]);return db[_0xa22e('0x53')]['count']({'where':_0xa4777b['where']})[_0xa22e('0x12')](function(_0x4ee193){_0x4ec2d3[_0xa22e('0x21')]=_0x4ee193;if(_0x1df760[_0xa22e('0x2e')][_0xa22e('0x3d')]){_0xa4777b[_0xa22e('0x3e')]=[{'all':!![]}];}return db[_0xa22e('0x53')][_0xa22e('0x3f')](_0xa4777b);})[_0xa22e('0x12')](function(_0x5c3947){_0x4ec2d3[_0xa22e('0x58')]=_0x5c3947;return _0x4ec2d3;});}})[_0xa22e('0x12')](respondWithFilteredResult(_0x38ea33,_0xa4777b))[_0xa22e('0x1b')](handleError(_0x38ea33,null));};exports[_0xa22e('0x59')]=function(_0x378fdc,_0x5c5240){return db[_0xa22e('0x2b')]['find']({'where':{'id':_0x378fdc[_0xa22e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5c5240,null))['then'](function(_0x5bf6ae){if(_0x5bf6ae){return _0x5bf6ae[_0xa22e('0x59')](_0x378fdc[_0xa22e('0x2e')][_0xa22e('0x5a')]);}})[_0xa22e('0x12')](respondWithStatusCode(_0x5c5240,null))[_0xa22e('0x1b')](handleError(_0x5c5240,null));};exports[_0xa22e('0x5b')]=function(_0x2be1c1,_0x404b67){if(_0x2be1c1[_0xa22e('0x46')]['id']){delete _0x2be1c1[_0xa22e('0x46')]['id'];}return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x2be1c1[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x404b67,null))[_0xa22e('0x12')](function(_0x37b2b9){if(_0x37b2b9){_0x2be1c1[_0xa22e('0x46')]['ChatWebsiteId']=_0x37b2b9['id'];return db[_0xa22e('0x5c')][_0xa22e('0x45')](_0x2be1c1[_0xa22e('0x46')]);}})['then'](respondWithResult(_0x404b67,null))[_0xa22e('0x1b')](handleError(_0x404b67,null));};exports[_0xa22e('0x5d')]=function(_0x226b3a,_0x302855){var _0x3d1ac9={'raw':![],'where':{}};var _0x468549={};var _0x458bf6={'count':0x0,'rows':[]};return db[_0xa22e('0x2b')][_0xa22e('0x55')]({'where':{'id':_0x226b3a[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x302855,null))[_0xa22e('0x12')](function(_0x1fb819){if(_0x1fb819){_0x468549['model']=_[_0xa22e('0x42')](db[_0xa22e('0x5c')][_0xa22e('0x43')]);_0x468549[_0xa22e('0x2e')]=_['keys'](_0x226b3a['query']);_0x468549[_0xa22e('0x38')]=_[_0xa22e('0x2f')](_0x468549['model'],_0x468549['query']);_0x3d1ac9[_0xa22e('0x32')]=_[_0xa22e('0x2f')](_0x468549[_0xa22e('0x30')],qs[_0xa22e('0x31')](_0x226b3a[_0xa22e('0x2e')][_0xa22e('0x31')]));_0x3d1ac9['attributes']=_0x3d1ac9[_0xa22e('0x32')]['length']?_0x3d1ac9[_0xa22e('0x32')]:_0x468549[_0xa22e('0x30')];if(!_0x226b3a[_0xa22e('0x2e')][_0xa22e('0x34')]('nolimit')){_0x3d1ac9['limit']=qs[_0xa22e('0x20')](_0x226b3a['query'][_0xa22e('0x20')]);_0x3d1ac9[_0xa22e('0x22')]=qs[_0xa22e('0x22')](_0x226b3a[_0xa22e('0x2e')]['offset']);}_0x3d1ac9[_0xa22e('0x36')]=qs[_0xa22e('0x56')](_0x226b3a['query'][_0xa22e('0x56')]);_0x3d1ac9[_0xa22e('0x37')]=qs['filters'](_[_0xa22e('0x39')](_0x226b3a[_0xa22e('0x2e')],_0x468549[_0xa22e('0x38')]));_0x3d1ac9[_0xa22e('0x37')][_0xa22e('0x52')]=_0x1fb819['id'];if(_0x226b3a[_0xa22e('0x2e')][_0xa22e('0x3a')]){_0x3d1ac9['where']=_[_0xa22e('0x3b')](_0x3d1ac9[_0xa22e('0x37')],{'$or':_[_0xa22e('0x2a')](_0x3d1ac9[_0xa22e('0x32')],function(_0xb52c3a){var _0x260b08={};_0x260b08[_0xb52c3a]={'$like':'%'+_0x226b3a['query'][_0xa22e('0x3a')]+'%'};return _0x260b08;})});}_0x3d1ac9=_[_0xa22e('0x3b')]({},_0x3d1ac9,_0x226b3a[_0xa22e('0x57')]);return db[_0xa22e('0x5c')][_0xa22e('0x21')]({'where':_0x3d1ac9[_0xa22e('0x37')]})[_0xa22e('0x12')](function(_0x127945){_0x458bf6[_0xa22e('0x21')]=_0x127945;if(_0x226b3a[_0xa22e('0x2e')][_0xa22e('0x3d')]){_0x3d1ac9[_0xa22e('0x3e')]=[{'all':!![]}];}return db[_0xa22e('0x5c')][_0xa22e('0x3f')](_0x3d1ac9);})[_0xa22e('0x12')](function(_0x4afd01){_0x458bf6[_0xa22e('0x58')]=_0x4afd01;return _0x458bf6;});}})[_0xa22e('0x12')](respondWithFilteredResult(_0x302855,_0x3d1ac9))[_0xa22e('0x1b')](handleError(_0x302855,null));};exports[_0xa22e('0x5e')]=function(_0x2f385e,_0x8efd0){return db['ChatWebsite']['find']({'where':{'id':_0x2f385e[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x8efd0,null))[_0xa22e('0x12')](function(_0x57e8ad){if(_0x57e8ad){return _0x57e8ad[_0xa22e('0x5e')](_0x2f385e[_0xa22e('0x2e')]['ids']);}})[_0xa22e('0x12')](respondWithStatusCode(_0x8efd0,null))[_0xa22e('0x1b')](handleError(_0x8efd0,null));};exports[_0xa22e('0x5f')]=function(_0x153031,_0x58281c){_0x153031[_0xa22e('0x46')]['sitepic']=_0x153031[_0xa22e('0x60')][_0xa22e('0x61')];return db[_0xa22e('0x2b')]['find']({'where':{'id':_0x153031['params']['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x58281c,null))[_0xa22e('0x12')](saveUpdates(_0x153031['body'],null))[_0xa22e('0x12')](respondWithResult(_0x58281c,null))[_0xa22e('0x1b')](handleError(_0x58281c,null));};exports[_0xa22e('0x62')]=function(_0x531aef,_0x177d05){_0x531aef[_0xa22e('0x46')][_0xa22e('0x63')]=_0x531aef[_0xa22e('0x60')][_0xa22e('0x61')];return db['ChatWebsite']['find']({'where':{'id':_0x531aef['params']['id']}})['then'](handleEntityNotFound(_0x177d05,null))[_0xa22e('0x12')](saveUpdates(_0x531aef['body'],null))[_0xa22e('0x12')](respondWithResult(_0x177d05,null))[_0xa22e('0x1b')](handleError(_0x177d05,null));};exports[_0xa22e('0x64')]=function(_0x1c6894,_0x52014e){_0x1c6894[_0xa22e('0x46')][_0xa22e('0x65')]=_0x1c6894[_0xa22e('0x60')][_0xa22e('0x61')];return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x1c6894[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x52014e,null))[_0xa22e('0x12')](saveUpdates(_0x1c6894['body'],null))['then'](respondWithResult(_0x52014e,null))[_0xa22e('0x1b')](handleError(_0x52014e,null));};exports[_0xa22e('0x66')]=function(_0x401683,_0x48ab17){_0x401683[_0xa22e('0x46')][_0xa22e('0x67')]=_0x401683[_0xa22e('0x60')][_0xa22e('0x61')];return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x401683[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x48ab17,null))[_0xa22e('0x12')](saveUpdates(_0x401683[_0xa22e('0x46')],null))[_0xa22e('0x12')](respondWithResult(_0x48ab17,null))[_0xa22e('0x1b')](handleError(_0x48ab17,null));};exports['getLogo']=function(_0x5e4500,_0x45cbb2){var _0x46196c=path['join'](config[_0xa22e('0x68')],_0xa22e('0x69'));var _0x1c66b2={'where':{'id':_0x5e4500[_0xa22e('0x4f')]['id']},'attributes':['id',_0xa22e('0x6a')],'raw':!![]};var _0x1b2581=![];return require(_0xa22e('0x6b'))['getLicense']()[_0xa22e('0x12')](function(_0xf800e1){if(_0xf800e1){_0x1b2581=_0xf800e1[_0xa22e('0x6c')];}})[_0xa22e('0x12')](function(){return db[_0xa22e('0x2b')][_0xa22e('0x44')](_0x1c66b2);})['then'](handleEntityNotFound(_0x45cbb2,null))['then'](function(_0x127947){if(_0x127947){if(!_[_0xa22e('0x6d')](_0x127947[_0xa22e('0x6a')])){if(fs[_0xa22e('0x6e')](path['join'](config[_0xa22e('0x68')],'server/files/images/logos/',_0x127947[_0xa22e('0x6a')]))&&_0x1b2581){_0x46196c=path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x70'),_0x127947[_0xa22e('0x6a')]);}}return _0x45cbb2['download'](_0x46196c);}})[_0xa22e('0x1b')](handleError(_0x45cbb2,null));};exports[_0xa22e('0x71')]=function(_0x4fd2c6,_0x4b265d){var _0x1536a9=path[_0xa22e('0x6f')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x4d0a11={'where':{'id':_0x4fd2c6[_0xa22e('0x4f')]['id']},'attributes':['id',_0xa22e('0x63')],'raw':!![]};return db[_0xa22e('0x2b')][_0xa22e('0x44')](_0x4d0a11)[_0xa22e('0x12')](handleEntityNotFound(_0x4b265d,null))[_0xa22e('0x12')](function(_0x320837){if(_0x320837){if(!_['isNil'](_0x320837[_0xa22e('0x63')])){if(fs[_0xa22e('0x6e')](path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x72'),_0x320837[_0xa22e('0x63')]))){_0x1536a9=path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x72'),_0x320837[_0xa22e('0x63')]);}}return _0x4b265d[_0xa22e('0x73')](_0x1536a9);}})[_0xa22e('0x1b')](handleError(_0x4b265d,null));};exports[_0xa22e('0x74')]=function(_0x47f554,_0x5f0b97){var _0x2da203=path[_0xa22e('0x6f')](config['root'],_0xa22e('0x75'));var _0x5e27d5={'where':{'id':_0x47f554[_0xa22e('0x4f')]['id']},'attributes':['id',_0xa22e('0x65'),_0xa22e('0x76')],'raw':!![]};return db[_0xa22e('0x2b')][_0xa22e('0x44')](_0x5e27d5)[_0xa22e('0x12')](handleEntityNotFound(_0x5f0b97,null))[_0xa22e('0x12')](function(_0x17d742){if(_0x17d742){if(!_['isNil'](_0x17d742[_0xa22e('0x65')])){if(fs[_0xa22e('0x6e')](path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x72'),_0x17d742[_0xa22e('0x65')]))&&_0x17d742[_0xa22e('0x76')]){_0x2da203=path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x72'),_0x17d742[_0xa22e('0x65')]);}}return _0x5f0b97['download'](_0x2da203);}})[_0xa22e('0x1b')](handleError(_0x5f0b97,null));};exports[_0xa22e('0x77')]=function(_0x36f1cc,_0x537fc9){var _0x568ea4=path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x78'));var _0x4724cd={'where':{'id':_0x36f1cc[_0xa22e('0x4f')]['id']},'attributes':['id',_0xa22e('0x67')],'raw':!![]};return db['ChatWebsite'][_0xa22e('0x44')](_0x4724cd)['then'](handleEntityNotFound(_0x537fc9,null))['then'](function(_0x42b25e){if(_0x42b25e){if(!_[_0xa22e('0x6d')](_0x42b25e['systemAvatar'])){if(fs[_0xa22e('0x6e')](path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x72'),_0x42b25e[_0xa22e('0x67')]))){_0x568ea4=path[_0xa22e('0x6f')](config['root'],_0xa22e('0x72'),_0x42b25e[_0xa22e('0x67')]);}}return _0x537fc9[_0xa22e('0x73')](_0x568ea4);}})[_0xa22e('0x1b')](handleError(_0x537fc9,null));};exports[_0xa22e('0x79')]=function(_0x1b36db,_0x506c63){var _0x153117=require(_0xa22e('0x7a'));var _0x3ed0fa=new _0x153117();var _0x3b6a33=_0x3ed0fa[_0xa22e('0x7b')](_0x1b36db['headers'][_0xa22e('0x7c')])[_0xa22e('0x7d')]();var _0xf65ff0={'body':_0x1b36db[_0xa22e('0x46')],'channel':'chat'};var _0x34debb=[];var _0x11c05a=[];var _0x125634={};var _0x1f0fe4=![];return db[_0xa22e('0x7e')]['describe']()[_0xa22e('0x12')](function(_0x49c55c){if(!_0x49c55c){throw new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))](_0xa22e('0x81'));}_0x34debb=_[_0xa22e('0x82')](_[_0xa22e('0x42')](_0x49c55c),[_0xa22e('0x83'),_0xa22e('0x84')]);_0x11c05a=_[_0xa22e('0x82')](_['keys'](_0x49c55c),[_0xa22e('0x83'),_0xa22e('0x84'),_0xa22e('0x85'),_0xa22e('0x86')]);if(_0x1b36db[_0xa22e('0x46')]['id']){delete _0x1b36db[_0xa22e('0x46')]['id'];}if(_['isNil'](_0x1b36db[_0xa22e('0x46')][_0xa22e('0x87')])){throw new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))](_0xa22e('0x88'));}if(_[_0xa22e('0x6d')](_0x1b36db['body'][_0xa22e('0x46')])||_0x1b36db[_0xa22e('0x46')][_0xa22e('0x46')]===''){throw new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))](_0xa22e('0x89'));}if(_[_0xa22e('0x6d')](_0x1b36db[_0xa22e('0x46')][_0xa22e('0x8a')])){throw new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11c05a);}if(!_[_0xa22e('0x8b')](_0x11c05a,_0x1b36db['body'][_0xa22e('0x8a')])){throw new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11c05a);}_0x125634[_0x1b36db[_0xa22e('0x46')][_0xa22e('0x8a')]]=_0x1b36db[_0xa22e('0x46')][_0xa22e('0x87')];})['then'](function(){return db[_0xa22e('0x2b')]['find']({'where':{'id':_0x1b36db[_0xa22e('0x4f')]['id']},'include':[{'model':db[_0xa22e('0x8c')],'as':_0xa22e('0x8d'),'include':[{'model':db[_0xa22e('0x7e')],'as':_0xa22e('0x8e'),'where':_0x125634,'limit':0x1,'order':[[_0xa22e('0x84'),_0xa22e('0x8f')]]}]},{'model':db[_0xa22e('0x90')],'as':_0xa22e('0x91')}]});})[_0xa22e('0x12')](handleEntityNotFound(_0x506c63,null))['then'](function(_0x105aa5){if(_0x105aa5&&_0x105aa5[_0xa22e('0x8d')]){_0xf65ff0[_0xa22e('0x92')]=_0x105aa5;_0xf65ff0[_0xa22e('0x93')]=_0x105aa5[_0xa22e('0x91')];_0xf65ff0['list']=_0x105aa5['List'];_0xf65ff0[_0xa22e('0x93')]=_[_0xa22e('0x94')](_0xf65ff0[_0xa22e('0x93')],[_0xa22e('0x95')],[_0xa22e('0x96')]);if(_0xf65ff0[_0xa22e('0x92')][_0xa22e('0x91')]){delete _0xf65ff0[_0xa22e('0x92')][_0xa22e('0x91')];}if(_0xf65ff0[_0xa22e('0x92')]['List']&&_0xf65ff0[_0xa22e('0x92')][_0xa22e('0x8d')][_0xa22e('0x8e')][_0xa22e('0x33')]){return _0xf65ff0[_0xa22e('0x92')][_0xa22e('0x8d')][_0xa22e('0x8e')][0x0];}var _0x44005d=_[_0xa22e('0x97')](_0x1b36db[_0xa22e('0x46')],{'firstName':_0x1b36db[_0xa22e('0x46')][_0xa22e('0x87')],'ListId':_0x105aa5[_0xa22e('0x86')]});_0x44005d[_0x1b36db[_0xa22e('0x46')][_0xa22e('0x8a')]]=_0x1b36db[_0xa22e('0x46')]['from'];return db['CmContact'][_0xa22e('0x45')](_0x44005d,{'fields':_0x34debb,'raw':!![]});}})[_0xa22e('0x12')](handleEntityNotFound(_0x506c63,null))[_0xa22e('0x12')](function(_0x567651){_0xf65ff0[_0xa22e('0x98')]=_0x567651;var _0x24fed9=_0x1b36db[_0xa22e('0x46')][_0xa22e('0x99')];if(_0x1b36db[_0xa22e('0x9a')][_0xa22e('0x9b')]){_0x24fed9=_0x1b36db[_0xa22e('0x9a')][_0xa22e('0x9b')];}else if(_0x1b36db['headers'][_0xa22e('0x9c')]){_0x24fed9=_[_0xa22e('0x9d')](_0x1b36db['headers'][_0xa22e('0x9c')][_0xa22e('0x9e')](','));}if(_0x567651){var _0x23654e={'ContactId':_0x567651['id'],'ChatWebsiteId':_0x1b36db[_0xa22e('0x4f')]['id'],'from':(_0x567651[_0xa22e('0x9f')]||'')+'\x20'+(_0x567651[_0xa22e('0xa0')]||''),'customerIp':_0x24fed9,'customerPort':_0x1b36db[_0xa22e('0x9a')][_0xa22e('0xa1')]?_0x1b36db['headers'][_0xa22e('0xa1')]:null,'referer':_0x1b36db[_0xa22e('0x46')][_0xa22e('0xa2')],'browserName':_0x3b6a33['browser'][_0xa22e('0x29')]&&_0x3b6a33['browser'][_0xa22e('0xa3')]?util[_0xa22e('0xa4')](_0xa22e('0xa5'),_0x3b6a33[_0xa22e('0xa6')][_0xa22e('0x29')],_0x3b6a33[_0xa22e('0xa6')][_0xa22e('0xa3')]):_0xa22e('0xa7'),'browserVersion':_0x3b6a33[_0xa22e('0xa6')][_0xa22e('0xa3')]||_0xa22e('0xa7'),'osName':util['format'](_0xa22e('0xa5'),_0x3b6a33['os'][_0xa22e('0x29')],_0x3b6a33['os']['version']),'osVersion':_0x3b6a33['os'][_0xa22e('0xa3')],'deviceModel':_0x3b6a33[_0xa22e('0xa8')][_0xa22e('0x30')]&&_0x3b6a33[_0xa22e('0xa8')][_0xa22e('0xa9')]?util['format'](_0xa22e('0xaa'),_0x3b6a33[_0xa22e('0xa8')][_0xa22e('0x30')],_0x3b6a33['device'][_0xa22e('0xa9')],_0x3b6a33['device'][_0xa22e('0x2c')]):null,'deviceVendor':_0x3b6a33[_0xa22e('0xa8')][_0xa22e('0xa9')],'deviceType':_0x3b6a33['device']['type'],'formData':JSON['stringify'](_0x1b36db[_0xa22e('0x46')])};var _0x1be673={'ChatWebsiteId':_0x1b36db['params']['id'],'closed':![]};if(_0x1b36db[_0xa22e('0x46')][_0xa22e('0xab')]){_0x1be673[_0xa22e('0xab')]=_0x1b36db[_0xa22e('0x46')]['threadId'];return db[_0xa22e('0xac')][_0xa22e('0x44')]({'where':_0x1be673})[_0xa22e('0x12')](function(_0x3cfcd7){if(_0x3cfcd7){return[_0x3cfcd7,![]];}_0x23654e[_0xa22e('0xab')]=_0x1b36db[_0xa22e('0x46')][_0xa22e('0xab')];_0x23654e[_0xa22e('0xad')]=_0x1b36db[_0xa22e('0x46')][_0xa22e('0xad')];return db[_0xa22e('0xac')]['create'](_0x23654e)[_0xa22e('0x12')](function(_0x192926){return[_0x192926,!![]];});});}_0x1be673[_0xa22e('0xae')]=_0x567651['id'];if(_0x1b36db['body']['interaction']&&_0x1b36db[_0xa22e('0x46')][_0xa22e('0xaf')]['id']){_0x1be673['id']=_0x1b36db['body']['interaction']['id'];return db[_0xa22e('0xac')][_0xa22e('0x44')]({'where':_0x1be673})[_0xa22e('0x12')](function(_0x3385b4){if(_0x3385b4){return[_0x3385b4,![]];}return db['ChatInteraction'][_0xa22e('0x45')](_0x23654e)[_0xa22e('0x12')](function(_0x3d1bc9){return[_0x3d1bc9,!![]];});});}return db[_0xa22e('0xac')][_0xa22e('0x45')](_0x23654e)[_0xa22e('0x12')](function(_0x453a46){return[_0x453a46,!![]];});}})[_0xa22e('0xb0')](function(_0x188a18,_0x29551a){if(_0x188a18){_0x1f0fe4=_0x29551a;if(!_0x29551a){var _0x3ce2ee={'from':(_0xf65ff0['contact'][_0xa22e('0x9f')]||'')+'\x20'+(_0xf65ff0['contact'][_0xa22e('0xa0')]||'')};if(_0x1b36db[_0xa22e('0x46')][_0xa22e('0xab')]&&_0x1b36db[_0xa22e('0x46')][_0xa22e('0xb1')]&&_0x1b36db['body'][_0xa22e('0xab')]!=_0x1b36db['body'][_0xa22e('0xb1')]){_0x3ce2ee['threadId']=_0x1b36db[_0xa22e('0x46')][_0xa22e('0xb1')];}return _0x188a18[_0xa22e('0x24')](_0x3ce2ee);}else{return _0x188a18;}}})['then'](function(_0x41b291){_0xf65ff0[_0xa22e('0xaf')]=_0x41b291[_0xa22e('0x26')]({'plain':!![]});_0xf65ff0[_0xa22e('0xaf')]['created']=_0x1f0fe4;if(_0xf65ff0[_0xa22e('0xaf')]['created']){if(_0xf65ff0[_0xa22e('0x92')]['autoclose']){_0xf65ff0[_0xa22e('0x93')][_0xa22e('0xb2')]({'id':0x0,'priority':_0xf65ff0['applications']['length']+0x1,'app':_0xa22e('0xb3'),'appdata':_0xa22e('0xb4'),'interval':_0xa22e('0xb5')});}}return db[_0xa22e('0xb6')][_0xa22e('0x45')]({'body':_0x1b36db[_0xa22e('0x46')][_0xa22e('0x46')],'ChatWebsiteId':_0x1b36db[_0xa22e('0x4f')]['id'],'ChatInteractionId':_0x41b291['id'],'direction':'in','ContactId':_0xf65ff0[_0xa22e('0x98')]['id'],'AttachmentId':_0x1b36db[_0xa22e('0x46')][_0xa22e('0xb7')]});})[_0xa22e('0x12')](function(_0x494b77){_0xf65ff0[_0xa22e('0x19')]=_0x494b77;if(_0xf65ff0[_0xa22e('0xaf')][_0xa22e('0xb8')]){return db[_0xa22e('0xb9')]['find']({'attributes':['id',_0xa22e('0x29')],'where':{'id':_0xf65ff0[_0xa22e('0xaf')][_0xa22e('0xb8')]}})[_0xa22e('0x12')](function(_0xc14603){if(_0xc14603){_0xf65ff0[_0xa22e('0x93')][_0xa22e('0xba')]({'id':0x0,'priority':0x0,'app':_0xa22e('0xbb'),'appdata':_0xc14603['name']+','+(_0xf65ff0[_0xa22e('0x92')][_0xa22e('0xbc')]||0xa),'interval':_0xa22e('0xb5')});_0xf65ff0[_0xa22e('0xbd')]=!![];}return respondWithRpcPromise('Start',_0xa22e('0xbe'),_0xf65ff0);});}return respondWithRpcPromise(_0xa22e('0xbf'),'startRouting',_0xf65ff0);})[_0xa22e('0x12')](function(_0x5e1011){respondWithRpcPromise(_0xa22e('0xc0'),'EventManager',{'event':_0xa22e('0x79'),'message':_0x5e1011},client9002);return _0x5e1011;})['then'](respondWithResult(_0x506c63,null))[_0xa22e('0x1b')](handleError(_0x506c63,null));};exports[_0xa22e('0xc1')]=function(_0x48c572,_0x1cd053){var _0x57c47a,_0x354e15,_0x4077ab;var _0x3f46e0=[];var _0x4d4831={};var _0x2605db=_0x48c572[_0xa22e('0xc2')]||[];var _0x1063c9=[];var _0x41874d;return db['CmContact'][_0xa22e('0x50')]()['then'](function(_0x4e2b39){if(!_0x4e2b39){throw new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))]('no\x20available\x20attributes');}_0x3f46e0=_['difference'](_[_0xa22e('0x42')](_0x4e2b39),[_0xa22e('0x83'),_0xa22e('0x84'),'CompanyId',_0xa22e('0x86')]);if(_0x48c572[_0xa22e('0x46')]['id']){delete _0x48c572['body']['id'];}if(_['isNil'](_0x48c572[_0xa22e('0x46')][_0xa22e('0x87')])){throw _0x1cd053[_0xa22e('0x1d')](0x1f4)[_0xa22e('0xc3')](new db['Sequelize']['ValidationError'](_0xa22e('0x88')));}if(_[_0xa22e('0x6d')](_0x48c572[_0xa22e('0x46')][_0xa22e('0x46')])||_0x48c572[_0xa22e('0x46')][_0xa22e('0x46')]===''){throw _0x1cd053['status'](0x1f4)[_0xa22e('0xc3')](new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa22e('0x6d')](_0x48c572[_0xa22e('0x46')][_0xa22e('0xc4')])){throw _0x1cd053[_0xa22e('0x1d')](0x1f4)[_0xa22e('0xc3')](new db[(_0xa22e('0x7f'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f46e0));}if(!_[_0xa22e('0x8b')](_0x3f46e0,_0x48c572['body'][_0xa22e('0xc4')])){throw _0x1cd053[_0xa22e('0x1d')](0x1f4)[_0xa22e('0xc3')](new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f46e0));}_0x4d4831[_0x48c572[_0xa22e('0x46')][_0xa22e('0xc4')]]=_0x48c572['body'][_0xa22e('0x87')];})[_0xa22e('0x12')](function(){return db['ChatWebsite'][_0xa22e('0x44')]({'where':{'id':_0x48c572['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0xa22e('0xc5')],'as':'MailAccount'}]});})[_0xa22e('0x12')](handleEntityNotFound(_0x1cd053,null))[_0xa22e('0x12')](function(_0x168550){if(_0x168550&&_0x168550[_0xa22e('0x8d')]){_0x354e15=_0x168550;var _0xeb9dcc=_[_0xa22e('0x97')](_0x48c572[_0xa22e('0x46')],{'firstName':_0x48c572[_0xa22e('0x46')][_0xa22e('0x87')],'phone':_0x48c572[_0xa22e('0x46')][_0xa22e('0x87')],'ListId':_0x168550[_0xa22e('0x86')]});_0xeb9dcc[_0x48c572[_0xa22e('0x46')][_0xa22e('0xc4')]]=_0x48c572['body'][_0xa22e('0x87')];return db[_0xa22e('0x7e')][_0xa22e('0xc6')]({'where':_0x4d4831,'defaults':_0xeb9dcc});}})['spread'](function(_0x499d3e){if(_0x499d3e){_0x4077ab=_0x499d3e;var _0x3f6e5a=fs[_0xa22e('0xc7')](path[_0xa22e('0x6f')](config[_0xa22e('0x68')],'server/files/templates/chatOfflineMessage.ejs'),_0xa22e('0xc8'));var _0x53fc94=ejs['render'](_0x3f6e5a,{'body':_[_0xa22e('0xc9')](_0x48c572['body'][_0xa22e('0x46')]),'bodyTitle':_0x354e15[_0xa22e('0xca')]});return db[_0xa22e('0xcb')]['create']({'body':_0x53fc94,'plainBody':htmlToText[_0xa22e('0xcc')](_0x53fc94),'ContactId':_0x499d3e['id'],'ChatWebsiteId':_0x354e15['id']});}})[_0xa22e('0x12')](function(_0x4e795c){_0x41874d=_0x4e795c;if(_0x2605db[_0xa22e('0x33')]){var _0x5a0283=_0x2605db[_0xa22e('0x2a')](function(_0x4e4497){return{'name':_0x4e4497[_0xa22e('0xcd')],'basename':_0x4e4497[_0xa22e('0x61')],'type':_0x4e4497[_0xa22e('0xce')],'ChatOfflineMessageId':_0x4e795c['id']};});_0x1063c9=_0x5a0283[_0xa22e('0x2a')](_0x1f8029=>{var _0x15e90c={'filename':_0x1f8029['name'],'path':path['join'](config[_0xa22e('0x68')],'server',_0xa22e('0xc2'),_0xa22e('0xcf'),_0xa22e('0xd0'),_0x1f8029[_0xa22e('0xd1')])};return _0x15e90c;});if(!_0x354e15[_0xa22e('0xd2')]){return db[_0xa22e('0xd3')][_0xa22e('0xd4')](function(_0x220bb0){return db[_0xa22e('0xd5')][_0xa22e('0xd6')](_0x5a0283,{'transaction':_0x220bb0});});}}})[_0xa22e('0x12')](function(){if(_0x41874d){_0x57c47a=_0x41874d;return db[_0xa22e('0xc5')][_0xa22e('0x55')]({'where':{'service':!![]},'include':[{'model':db[_0xa22e('0xd7')],'as':_0xa22e('0xd8'),'raw':!![],'include':[{'model':db[_0xa22e('0xd9')],'as':_0xa22e('0xd9'),'raw':!![]}]}]});}})[_0xa22e('0x12')](function(_0x30cac4){if(_0x30cac4&&_0x30cac4[_0xa22e('0xd8')]&&_0x354e15['forwardOffline']&&_0x354e15['forwardOfflineAddress']){var _0xdd7780=_0x30cac4[_0xa22e('0xda')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0xdd7780,'message':{'from':util[_0xa22e('0xa4')](_0xa22e('0xdb'),_0x30cac4[_0xa22e('0x29')],_0x30cac4[_0xa22e('0xdc')]||_0x30cac4[_0xa22e('0xd8')]['user']),'to':_0x354e15[_0xa22e('0xdd')],'subject':_0x354e15[_0xa22e('0xde')],'html':_0x57c47a[_0xa22e('0x46')],'attachments':_0x1063c9}},client9003)[_0xa22e('0x12')](function(){return _0x57c47a;})[_0xa22e('0x1b')](function(_0x166cd1){logger[_0xa22e('0x17')](_0x166cd1);});}})[_0xa22e('0x12')](function(){if(_0x354e15&&_0x354e15['openNewInteraction']&&_0x354e15[_0xa22e('0xdf')]){var _0x5c634b=[];if(_0x2605db[_0xa22e('0x33')]){_0x5c634b=_0x2605db[_0xa22e('0x2a')](function(_0x19fa9b){return{'name':_0x19fa9b[_0xa22e('0xcd')],'basename':_0x19fa9b[_0xa22e('0x61')],'type':_0x19fa9b['mimetype'],'ChatOfflineMessageId':_0x41874d['id']};});}var _0x323066;if(!_[_0xa22e('0x6d')](_0x354e15[_0xa22e('0xe0')])){var _0x459e52=_[_0xa22e('0x2a')](_0x48c572['body'],function(_0x34524b){return _0x34524b;});var _0x4f520b=_[_0xa22e('0xe1')](_0x459e52)[0x0];var _0x3e1cf7=_['mapValues'](_0x4f520b,function(_0x56f001){return _0x56f001;});_0x323066=_0x3e1cf7[0x1][_0x354e15['subjectOffline']];}var _0x3f487f={'from':_0x4077ab[_0xa22e('0xdc')],'firstName':_0x4077ab[_0xa22e('0x9f')],'lastName':_0x4077ab['lastName'],'mapKey':'email','message':{'from':_0x4077ab['email'],'to':_0x354e15[_0xa22e('0xc5')][_0xa22e('0xdc')],'cc':'','subject':_[_0xa22e('0x6d')](_0x323066)?_0x354e15[_0xa22e('0xde')]:_0x323066,'messageId':'','sentAt':new Date(),'attach':_0x5c634b[_0xa22e('0x33')],'attachments':_0x5c634b,'originChannel':'Chat','ChatWebsiteId':_0x354e15['id'],'ChatOfflineMessageId':_0x57c47a['id'],'originTo':_0x354e15['MailAccount'][_0xa22e('0xdc')]},'body':_0x57c47a[_0xa22e('0x46')]};var _0x2a7935={'account':{'id':_0x354e15['MailAccountId']},'body':_0x3f487f,'log':_0xa22e('0xe2')};return respondWithRpcPromise(_0xa22e('0xe2'),_0xa22e('0xe3'),_0x2a7935,client9001)[_0xa22e('0x12')](function(){return _0x57c47a;})['catch'](function(_0x5c02d){logger[_0xa22e('0x17')](_0x5c02d);});}return;})[_0xa22e('0x12')](function(){if(_0x57c47a){return _0x57c47a;}})[_0xa22e('0x12')](respondWithResult(_0x1cd053,null))[_0xa22e('0x1b')](function(_0x5c4c66){logger['error']('catch',_0x5c4c66);for(var _0x1a2592 of _0x2605db){var _0x173284=path[_0xa22e('0x6f')](config['root'],_0xa22e('0xe4'),'files','attachments','offline-chat',_0x1a2592[_0xa22e('0x61')]);fs_extra['remove'](_0x173284)[_0xa22e('0x1b')](function(_0x131d90){logger[_0xa22e('0x17')]('Could\x20not\x20remove\x20attachment\x20file',_0x173284,_0x131d90);});}});};exports[_0xa22e('0xe5')]=function(_0x205ffc,_0x26a3ca){return db[_0xa22e('0xac')][_0xa22e('0x44')]({'where':{'id':_0x205ffc[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x26a3ca,null))[_0xa22e('0x12')](function(_0x3d63b5){if(_0x3d63b5){return _0x3d63b5['addInteraction'](_0x205ffc[_0xa22e('0x46')]['ids'],_['omit'](_0x205ffc[_0xa22e('0x46')],[_0xa22e('0x5a'),'id'])||{});}})[_0xa22e('0x12')](respondWithResult(_0x26a3ca,null))[_0xa22e('0x1b')](handleError(_0x26a3ca,null));};exports['getInteractions']=function(_0x1a68f5,_0x36423b){var _0x251308={'raw':![],'where':{}};var _0x32ad72={};var _0x31df37={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa22e('0x55')]({'where':{'id':_0x1a68f5['params']['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x36423b,null))[_0xa22e('0x12')](function(_0x2e8274){if(_0x2e8274){_0x32ad72[_0xa22e('0x30')]=_[_0xa22e('0x42')](db[_0xa22e('0xac')][_0xa22e('0x43')]);_0x32ad72[_0xa22e('0x2e')]=_[_0xa22e('0x42')](_0x1a68f5['query']);_0x32ad72[_0xa22e('0x38')]=_[_0xa22e('0x2f')](_0x32ad72[_0xa22e('0x30')],_0x32ad72[_0xa22e('0x2e')]);_0x251308[_0xa22e('0x32')]=_[_0xa22e('0x2f')](_0x32ad72[_0xa22e('0x30')],qs[_0xa22e('0x31')](_0x1a68f5[_0xa22e('0x2e')][_0xa22e('0x31')]));_0x251308[_0xa22e('0x32')]=_0x251308[_0xa22e('0x32')][_0xa22e('0x33')]?_0x251308['attributes']:_0x32ad72[_0xa22e('0x30')];if(!_0x1a68f5[_0xa22e('0x2e')][_0xa22e('0x34')](_0xa22e('0x35'))){_0x251308[_0xa22e('0x20')]=qs[_0xa22e('0x20')](_0x1a68f5[_0xa22e('0x2e')][_0xa22e('0x20')]);_0x251308[_0xa22e('0x22')]=qs['offset'](_0x1a68f5[_0xa22e('0x2e')][_0xa22e('0x22')]);}_0x251308['order']=qs[_0xa22e('0x56')](_0x1a68f5[_0xa22e('0x2e')]['sort']);_0x251308[_0xa22e('0x37')]=qs[_0xa22e('0x38')](_['pick'](_0x1a68f5[_0xa22e('0x2e')],_0x32ad72[_0xa22e('0x38')]));_0x251308[_0xa22e('0x37')][_0xa22e('0x52')]=_0x2e8274['id'];if(_0x1a68f5['query'][_0xa22e('0x3a')]){_0x251308[_0xa22e('0x37')]=_[_0xa22e('0x3b')](_0x251308['where'],{'$or':_[_0xa22e('0x2a')](_0x251308['attributes'],function(_0x3bd1b7){var _0x2b93c2={};_0x2b93c2[_0x3bd1b7]={'$like':'%'+_0x1a68f5['query'][_0xa22e('0x3a')]+'%'};return _0x2b93c2;})});}_0x251308=_[_0xa22e('0x3b')]({},_0x251308,_0x1a68f5['options']);return db['ChatInteraction'][_0xa22e('0x21')]({'where':_0x251308[_0xa22e('0x37')]})['then'](function(_0x2186c6){_0x31df37[_0xa22e('0x21')]=_0x2186c6;if(_0x1a68f5[_0xa22e('0x2e')]['includeAll']){_0x251308['include']=[{'model':db[_0xa22e('0x7e')],'as':_0xa22e('0xe6'),'required':![]},{'model':db[_0xa22e('0xb9')],'as':'Owner','attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xa22e('0xe7')],'as':_0xa22e('0xe8'),'attributes':['id',_0xa22e('0x29'),_0xa22e('0xe9')],'where':_0x1a68f5['query']['tag']?{'id':_0x1a68f5[_0xa22e('0x2e')]['tag']}:undefined,'required':_0x1a68f5[_0xa22e('0x2e')][_0xa22e('0xea')]?!![]:![]}];}return db['ChatInteraction'][_0xa22e('0x3f')](_0x251308);})['then'](function(_0xf0c383){_0x31df37[_0xa22e('0x58')]=_0xf0c383;return _0x31df37;});}})[_0xa22e('0x12')](respondWithFilteredResult(_0x36423b,_0x251308))[_0xa22e('0x1b')](handleError(_0x36423b,null));};function iftimePromise(_0x48f40e,_0x4b9b3c){return respondWithRpcPromise(_0xa22e('0xeb'),_0xa22e('0xec'),{'command':_0x4b9b3c[_0xa22e('0xed')]?util['format'](_0xa22e('0xee'),_0x48f40e[_0xa22e('0xef')],_0x4b9b3c[_0xa22e('0xed')]):util[_0xa22e('0xa4')]('iftime\x20%s',_0x48f40e['interval'])},client9002)[_0xa22e('0x12')](function(_0x1c8e5b){var _0x71e596=_0x1c8e5b&&_0x1c8e5b[_0xa22e('0xf0')](_0xa22e('0xf1'))>=0x0?!![]:![];logger[_0xa22e('0x13')](_0xa22e('0xf2'),_0x4b9b3c['id'],_0x48f40e['id'],_0x48f40e['interval'],_0x71e596?_0xa22e('0xf3'):'OFFLINE',_0x4b9b3c['timezone']?_0x4b9b3c[_0xa22e('0xed')]:_0xa22e('0xf4'));return _0x71e596;})[_0xa22e('0x1b')](function(_0x2e802a){logger[_0xa22e('0x17')](_0xa22e('0xf2'),_0x4b9b3c['id'],_0x48f40e['id'],_0x48f40e['interval'],util[_0xa22e('0xf5')](_0x2e802a,{'showHidden':![],'depth':null}),_0x4b9b3c[_0xa22e('0xed')]?_0x4b9b3c[_0xa22e('0xed')]:'No\x20timezone');return![];});}exports[_0xa22e('0xec')]=function(_0x2839e9,_0x4204f3){var _0x4fc5fe=0x0;var _0x19294e=0x0;var _0x1bcb4a=![];var _0x46bce4;var _0x2e3cbf;return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x2839e9[_0xa22e('0x4f')]['id']},'include':[{'model':db[_0xa22e('0xf6')],'as':'Interval','include':[{'model':db[_0xa22e('0xf6')],'as':_0xa22e('0xf7'),'attributes':['id',_0xa22e('0xef')],'raw':!![]}]}]})[_0xa22e('0x12')](handleEntityNotFound(_0x4204f3,null))[_0xa22e('0x12')](function(_0xabac88){if(_0xabac88){_0x46bce4=_0xabac88;return _0xabac88[_0xa22e('0xf8')]({'raw':!![]});}})[_0xa22e('0x12')](function(_0x19c45c){if(_0x46bce4){if(_0x19c45c){_0x2e3cbf=_0x19c45c;}}return require(_0xa22e('0x6b'))['getLicense']();})[_0xa22e('0x12')](function(_0x5400a1){if(_0x5400a1){_0x19294e=_0x5400a1[_0xa22e('0xf9')];_0x1bcb4a=_0x5400a1[_0xa22e('0x6c')];}})[_0xa22e('0x12')](function(){return db[_0xa22e('0xac')][_0xa22e('0x21')]({'where':{'closed':![]}});})['then'](function(_0x12a587){_0x4fc5fe=_0x12a587;if(_0x19294e&&_0x12a587>_0x19294e){return db[_0xa22e('0xfa')][_0xa22e('0x55')]({'where':{'id':0x1}})[_0xa22e('0x12')](function(_0x68b5e9){if(_0x68b5e9){_0x68b5e9[_0xa22e('0xfb')]('chatLicenseExceeded');}});}})[_0xa22e('0x12')](function(){if(_0x46bce4[_0xa22e('0xf6')]&&_0x46bce4[_0xa22e('0xf6')]['Intervals']){var _0x58c750=[];for(var _0x136a2f=0x0;_0x136a2f<_0x46bce4[_0xa22e('0xf6')][_0xa22e('0xf7')][_0xa22e('0x33')];_0x136a2f++){var _0x460da0=_0x46bce4[_0xa22e('0xf6')][_0xa22e('0xf7')][_0x136a2f][_0xa22e('0x26')]({'plain':!![]});_0x58c750[_0xa22e('0xb2')](iftimePromise(_0x460da0,_0x46bce4));}return BPromise[_0xa22e('0xfc')](_0x58c750)[_0xa22e('0x12')](function(_0x549295){return _[_0xa22e('0xfd')](_0x549295);});}else{return!![];}})[_0xa22e('0x12')](function(_0x31679d){var _0x252ba8=fs[_0xa22e('0xc7')](path['join'](config[_0xa22e('0x68')],_0xa22e('0xfe')),_0xa22e('0xc8'));var _0x4e8099={'remote':_0x46bce4[_0xa22e('0xff')],'query':querystring['stringify'](_[_0xa22e('0x3b')](_0x46bce4[_0xa22e('0x26')]({'plain':!![]}),{'customerIp':_0x2839e9[_0xa22e('0x9a')][_0xa22e('0x9c')]||_0x2839e9[_0xa22e('0x9a')][_0xa22e('0x100')]||_0x2839e9[_0xa22e('0x101')][_0xa22e('0x102')]||_0x2839e9['ip'],'referer':_0x2839e9['headers'][_0xa22e('0xa2')],'openedInteractions':_0x4fc5fe,'maxInteractions':_0x19294e,'virtual':_0x1bcb4a[_0xa22e('0xf9')],'online':_0x31679d,'custom':_0x1bcb4a}))[_0xa22e('0x103')](/'/g,'\x5c\x27')};_0x4204f3[_0xa22e('0xc3')](ejs['render'](Mustache[_0xa22e('0x104')](_0x252ba8,_0x4e8099),{'proactiveActions':_0x2e3cbf,'alignment':_0x46bce4[_0xa22e('0x105')],'verticalAlignment':_0x46bce4['verticalAlignment'],'div_color':_0x46bce4['color'],'labelText':_0x46bce4[_0xa22e('0x106')],'text_color':_0x46bce4[_0xa22e('0x107')],'text_button_color':_0x46bce4[_0xa22e('0x108')],'button_color':_0x46bce4[_0xa22e('0x109')],'background_color':_0x46bce4['backgroundColor'],'hideWhenOffline':_0x46bce4[_0xa22e('0x10a')],'interval':_0x46bce4[_0xa22e('0x10b')]}));})[_0xa22e('0x1b')](handleError(_0x4204f3,null));};exports[_0xa22e('0x10c')]=function(_0x47500b,_0x30bd85){var _0x11106d=_0x47500b[_0xa22e('0x4f')]['id'];var _0x596448=_0x47500b['body'];var _0x3ce862=0xc8;var _0x24434f=null;return db['sequelize'][_0xa22e('0xd4')]({'isolationLevel':db[_0xa22e('0xd3')]['Transaction']['ISOLATION_LEVELS'][_0xa22e('0x10d')]},function(_0x30cf32){return db['ChatWebsite'][_0xa22e('0x55')]({'where':{'id':_0x11106d},'transaction':_0x30cf32})['then'](function(_0x2f9056){if(_0x2f9056){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x11106d},'transaction':_0x30cf32})[_0xa22e('0x12')](function(){var _0x384329=_[_0xa22e('0x2a')](_0x596448,function(_0x17c08d){_0x17c08d[_0xa22e('0x52')]=_0x11106d;return _0x17c08d;});return db[_0xa22e('0x90')][_0xa22e('0xd6')](_0x384329,{'transaction':_0x30cf32});});}else{_0x3ce862=0x194;_0x24434f=[];}});})['then'](function(){if(_0x3ce862!==0x194){return db[_0xa22e('0x90')][_0xa22e('0x10e')]({'where':{'ChatWebsiteId':_0x11106d},'order':_0xa22e('0x95')})[_0xa22e('0x12')](function(_0x439bde){_0x24434f=_0x439bde;});}})[_0xa22e('0x1b')](function(_0x4a836e){_0x3ce862=0x1f4;logger['error'](_0x4a836e[_0xa22e('0x28')]);if(_0x4a836e[_0xa22e('0x29')]){delete _0x4a836e['name'];}_0x24434f=_0x4a836e;})['finally'](function(){if(_0x24434f===null){_0x30bd85[_0xa22e('0x1c')](_0x3ce862);}else{if(_0x3ce862===0x1f4){_0x30bd85[_0xa22e('0x1d')](_0x3ce862)['send'](_0x24434f);}else{_0x30bd85[_0xa22e('0x1d')](_0x3ce862)['json'](_0x24434f);}}});};exports[_0xa22e('0x10f')]=function(_0x467feb,_0x5bef63){var _0x2f2b5e={};var _0x1c7e18={};var _0x177ca8;var _0x2ad8a9;return db['ChatWebsite']['findOne']({'where':{'id':_0x467feb['params']['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x5bef63,null))[_0xa22e('0x12')](function(_0x28e515){if(_0x28e515){_0x177ca8=_0x28e515;_0x1c7e18[_0xa22e('0x30')]=_['keys'](db['ChatApplication'][_0xa22e('0x43')]);_0x1c7e18[_0xa22e('0x2e')]=_['keys'](_0x467feb[_0xa22e('0x2e')]);_0x1c7e18['filters']=_[_0xa22e('0x2f')](_0x1c7e18[_0xa22e('0x30')],_0x1c7e18[_0xa22e('0x2e')]);_0x2f2b5e['attributes']=_[_0xa22e('0x2f')](_0x1c7e18['model'],qs[_0xa22e('0x31')](_0x467feb[_0xa22e('0x2e')]['fields']));_0x2f2b5e['attributes']=_0x2f2b5e[_0xa22e('0x32')]['length']?_0x2f2b5e[_0xa22e('0x32')]:_0x1c7e18['model'];_0x2f2b5e['order']=qs[_0xa22e('0x56')](_0x467feb[_0xa22e('0x2e')][_0xa22e('0x56')]);_0x2f2b5e['where']=qs[_0xa22e('0x38')](_[_0xa22e('0x39')](_0x467feb[_0xa22e('0x2e')],_0x1c7e18[_0xa22e('0x38')]));if(_0x467feb[_0xa22e('0x2e')][_0xa22e('0x3a')]){_0x2f2b5e[_0xa22e('0x37')]=_[_0xa22e('0x3b')](_0x2f2b5e[_0xa22e('0x37')],{'$or':_[_0xa22e('0x2a')](_0x2f2b5e[_0xa22e('0x32')],function(_0x1d2b5c){var _0x50f148={};_0x50f148[_0x1d2b5c]={'$like':'%'+_0x467feb['query']['filter']+'%'};return _0x50f148;})});}_0x2f2b5e=_[_0xa22e('0x3b')]({},_0x2f2b5e,_0x467feb[_0xa22e('0x57')]);return _0x177ca8[_0xa22e('0x10f')](_0x2f2b5e);}})[_0xa22e('0x12')](function(_0x4a785c){if(_0x4a785c){_0x2ad8a9=_0x4a785c[_0xa22e('0x33')];if(!_0x467feb[_0xa22e('0x2e')][_0xa22e('0x34')](_0xa22e('0x35'))){_0x2f2b5e[_0xa22e('0x20')]=qs[_0xa22e('0x20')](_0x467feb['query']['limit']);_0x2f2b5e[_0xa22e('0x22')]=qs[_0xa22e('0x22')](_0x467feb['query'][_0xa22e('0x22')]);}return _0x177ca8['getApplications'](_0x2f2b5e);}})[_0xa22e('0x12')](function(_0x30ecaa){if(_0x30ecaa){return _0x30ecaa?{'count':_0x2ad8a9,'rows':_0x30ecaa}:null;}})[_0xa22e('0x12')](respondWithResult(_0x5bef63,null))[_0xa22e('0x1b')](handleError(_0x5bef63,null));};exports[_0xa22e('0x110')]=function(_0xe13136,_0x1b14e0){return db[_0xa22e('0x111')][_0xa22e('0x44')]({'where':{'id':_0xe13136[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x1b14e0,null))['then'](function(_0x5d2387){if(_0x5d2387){return _0x5d2387['addProactiveActions'](_0xe13136[_0xa22e('0x46')]['ids'],_[_0xa22e('0x112')](_0xe13136[_0xa22e('0x46')],['ids','id'])||{});}})[_0xa22e('0x12')](respondWithResult(_0x1b14e0,null))[_0xa22e('0x1b')](handleError(_0x1b14e0,null));};exports[_0xa22e('0xf8')]=function(_0x1e88a4,_0x29605b){var _0x403f70={};var _0x32b2f9={};var _0x3974f0;var _0x4c1148;return db[_0xa22e('0x2b')]['findOne']({'where':{'id':_0x1e88a4[_0xa22e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x29605b,null))[_0xa22e('0x12')](function(_0x5c6ab0){if(_0x5c6ab0){_0x3974f0=_0x5c6ab0;_0x32b2f9['model']=_[_0xa22e('0x42')](db[_0xa22e('0x113')]['rawAttributes']);_0x32b2f9[_0xa22e('0x2e')]=_[_0xa22e('0x42')](_0x1e88a4['query']);_0x32b2f9[_0xa22e('0x38')]=_[_0xa22e('0x2f')](_0x32b2f9[_0xa22e('0x30')],_0x32b2f9[_0xa22e('0x2e')]);_0x403f70[_0xa22e('0x32')]=_[_0xa22e('0x2f')](_0x32b2f9['model'],qs[_0xa22e('0x31')](_0x1e88a4[_0xa22e('0x2e')][_0xa22e('0x31')]));_0x403f70[_0xa22e('0x32')]=_0x403f70['attributes'][_0xa22e('0x33')]?_0x403f70[_0xa22e('0x32')]:_0x32b2f9['model'];_0x403f70[_0xa22e('0x36')]=qs['sort'](_0x1e88a4['query'][_0xa22e('0x56')]);_0x403f70[_0xa22e('0x37')]=qs[_0xa22e('0x38')](_[_0xa22e('0x39')](_0x1e88a4[_0xa22e('0x2e')],_0x32b2f9[_0xa22e('0x38')]));if(_0x1e88a4['query']['filter']){_0x403f70[_0xa22e('0x37')]=_[_0xa22e('0x3b')](_0x403f70['where'],{'$or':_[_0xa22e('0x2a')](_0x403f70[_0xa22e('0x32')],function(_0x362187){var _0x2d1ee3={};_0x2d1ee3[_0x362187]={'$like':'%'+_0x1e88a4[_0xa22e('0x2e')][_0xa22e('0x3a')]+'%'};return _0x2d1ee3;})});}_0x403f70=_[_0xa22e('0x3b')]({},_0x403f70,_0x1e88a4[_0xa22e('0x57')]);return _0x3974f0['getProactiveActions'](_0x403f70);}})[_0xa22e('0x12')](function(_0x579d31){if(_0x579d31){_0x4c1148=_0x579d31[_0xa22e('0x33')];if(!_0x1e88a4['query'][_0xa22e('0x34')](_0xa22e('0x35'))){_0x403f70[_0xa22e('0x20')]=qs[_0xa22e('0x20')](_0x1e88a4[_0xa22e('0x2e')][_0xa22e('0x20')]);_0x403f70[_0xa22e('0x22')]=qs[_0xa22e('0x22')](_0x1e88a4[_0xa22e('0x2e')][_0xa22e('0x22')]);}return _0x3974f0[_0xa22e('0xf8')](_0x403f70);}})[_0xa22e('0x12')](function(_0x1e2329){if(_0x1e2329){return _0x1e2329?{'count':_0x4c1148,'rows':_0x1e2329}:null;}})['then'](respondWithResult(_0x29605b,null))['catch'](handleError(_0x29605b,null));};exports[_0xa22e('0x114')]=function(_0x57a5c3,_0x538b94){var _0xf13519=_0x57a5c3['query'][_0xa22e('0x115')]===_0xa22e('0x116')?'offlineForm':_0xa22e('0x117');return db['ChatWebsite'][_0xa22e('0x44')]({'attributes':['id',_0xf13519],'where':{'id':_0x57a5c3[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x538b94,null))[_0xa22e('0x12')](function(_0x49683c){if(_0x49683c){var _0x39b930=_0x49683c[_0xf13519];var _0x15f9bd=_0x39b930&&_0x39b930[_0xa22e('0x118')]?_0x39b930[_0xa22e('0x118')]:[];_0x538b94['send']({'fromKey':_['isNil'](_0x39b930[_0xa22e('0x119')])?undefined:_0x39b930[_0xa22e('0x119')],'count':_0x15f9bd[_0xa22e('0x33')],'rows':_0x15f9bd});}})[_0xa22e('0x1b')](handleError(_0x538b94,null));};exports[_0xa22e('0x11a')]=function(_0x394b15,_0x26f89c){var _0x35c69e={'raw':![],'where':{}};var _0x5b59ae={};var _0x3afe03={'count':0x0,'rows':[]};return db[_0xa22e('0x2b')][_0xa22e('0x55')]({'where':{'id':_0x394b15[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x26f89c,null))['then'](function(_0x5dbb11){if(_0x5dbb11){_0x5b59ae['model']=_[_0xa22e('0x42')](db['ChatOfflineMessage'][_0xa22e('0x43')]);_0x5b59ae['query']=_['keys'](_0x394b15[_0xa22e('0x2e')]);_0x5b59ae[_0xa22e('0x38')]=_['intersection'](_0x5b59ae[_0xa22e('0x30')],_0x5b59ae['query']);_0x35c69e[_0xa22e('0x32')]=_[_0xa22e('0x2f')](_0x5b59ae[_0xa22e('0x30')],qs[_0xa22e('0x31')](_0x394b15[_0xa22e('0x2e')][_0xa22e('0x31')]));_0x35c69e[_0xa22e('0x32')]=_0x35c69e[_0xa22e('0x32')]['length']?_0x35c69e['attributes']:_0x5b59ae[_0xa22e('0x30')];if(!_0x394b15['query'][_0xa22e('0x34')](_0xa22e('0x35'))){_0x35c69e[_0xa22e('0x20')]=qs[_0xa22e('0x20')](_0x394b15[_0xa22e('0x2e')][_0xa22e('0x20')]);_0x35c69e[_0xa22e('0x22')]=qs['offset'](_0x394b15[_0xa22e('0x2e')][_0xa22e('0x22')]);}_0x35c69e['order']=qs['sort'](_0x394b15[_0xa22e('0x2e')][_0xa22e('0x56')]);_0x35c69e[_0xa22e('0x37')]=qs[_0xa22e('0x38')](_[_0xa22e('0x39')](_0x394b15[_0xa22e('0x2e')],_0x5b59ae[_0xa22e('0x38')]));_0x35c69e['where']['ChatWebsiteId']=_0x5dbb11['id'];if(_0x394b15['query'][_0xa22e('0x3a')]){_0x35c69e[_0xa22e('0x37')]=_[_0xa22e('0x3b')](_0x35c69e[_0xa22e('0x37')],{'$or':_[_0xa22e('0x2a')](_0x35c69e[_0xa22e('0x32')],function(_0x461ff5){var _0x1784c7={};_0x1784c7[_0x461ff5]={'$like':'%'+_0x394b15[_0xa22e('0x2e')][_0xa22e('0x3a')]+'%'};return _0x1784c7;})});}_0x35c69e=_[_0xa22e('0x3b')]({},_0x35c69e,_0x394b15[_0xa22e('0x57')]);return db[_0xa22e('0xcb')]['count']({'where':_0x35c69e['where']})[_0xa22e('0x12')](function(_0x256a94){_0x3afe03[_0xa22e('0x21')]=_0x256a94;if(_0x394b15[_0xa22e('0x2e')][_0xa22e('0x3d')]){_0x35c69e['include']=[{'all':!![]}];}else{_0x35c69e[_0xa22e('0x3e')]=[{'model':db[_0xa22e('0x7e')],'as':_0xa22e('0xe6'),'required':![]},{'model':db[_0xa22e('0xd5')],'as':_0xa22e('0x11b'),'required':![]}];}return db[_0xa22e('0xcb')][_0xa22e('0x3f')](_0x35c69e);})[_0xa22e('0x12')](function(_0x81b77){_0x3afe03[_0xa22e('0x58')]=_0x81b77;return _0x3afe03;});}})['then'](respondWithFilteredResult(_0x26f89c,_0x35c69e))['catch'](handleError(_0x26f89c,null));};exports[_0xa22e('0x11c')]=function(_0x4f4b91,_0x545f1f){return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x4f4b91[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x545f1f,null))[_0xa22e('0x12')](function(_0x1b74a3){if(_0x1b74a3){return _0x1b74a3['addAgents'](_0x4f4b91[_0xa22e('0x46')][_0xa22e('0x5a')],_[_0xa22e('0x112')](_0x4f4b91['body'],[_0xa22e('0x5a'),'id'])||{})[_0xa22e('0xb0')](function(_0x46d0aa){for(var _0x186c23=0x0;_0x186c23<_0x4f4b91[_0xa22e('0x46')][_0xa22e('0x5a')]['length'];_0x186c23+=0x1){socket[_0xa22e('0x11d')](_0xa22e('0x11e'),{'UserId':Number(_0x4f4b91['body'][_0xa22e('0x5a')][_0x186c23]),'ChatWebsiteId':Number(_0x4f4b91[_0xa22e('0x4f')]['id'])});}return _0x46d0aa;});}})[_0xa22e('0x12')](respondWithResult(_0x545f1f,null))['catch'](handleError(_0x545f1f,null));};exports[_0xa22e('0x11f')]=function(_0x51662f,_0x315595){return db['ChatWebsite'][_0xa22e('0x44')]({'where':{'id':_0x51662f[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x315595,null))[_0xa22e('0x12')](function(_0x336f20){if(_0x336f20){return _0x336f20[_0xa22e('0x11f')](_0x51662f[_0xa22e('0x2e')][_0xa22e('0x5a')])['then'](function(){if(_[_0xa22e('0x120')](_0x51662f[_0xa22e('0x2e')]['ids'])){for(var _0x34f947=0x0;_0x34f947<_0x51662f[_0xa22e('0x2e')]['ids'][_0xa22e('0x33')];_0x34f947+=0x1){socket['emit'](_0xa22e('0x121'),{'UserId':Number(_0x51662f[_0xa22e('0x2e')][_0xa22e('0x5a')][_0x34f947]),'ChatWebsiteId':Number(_0x51662f['params']['id'])});}}else{socket[_0xa22e('0x11d')](_0xa22e('0x121'),{'UserId':Number(_0x51662f[_0xa22e('0x2e')][_0xa22e('0x5a')]),'ChatWebsiteId':Number(_0x51662f[_0xa22e('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x315595,null))[_0xa22e('0x1b')](handleError(_0x315595,null));};exports[_0xa22e('0x122')]=function(_0x5761e9,_0xd7e1c3){var _0x2f75a4={};var _0xf87a8c={};var _0x3794fd;var _0x3e9787;return db[_0xa22e('0x2b')][_0xa22e('0x55')]({'where':{'id':_0x5761e9[_0xa22e('0x4f')]['id']}})['then'](handleEntityNotFound(_0xd7e1c3,null))['then'](function(_0x13654){if(_0x13654){_0x3794fd=_0x13654;_0xf87a8c[_0xa22e('0x30')]=_[_0xa22e('0x42')](db[_0xa22e('0xb9')][_0xa22e('0x43')]);_0xf87a8c[_0xa22e('0x2e')]=_[_0xa22e('0x42')](_0x5761e9['query']);_0xf87a8c['filters']=_[_0xa22e('0x2f')](_0xf87a8c['model'],_0xf87a8c[_0xa22e('0x2e')]);_0x2f75a4[_0xa22e('0x32')]=_[_0xa22e('0x2f')](_0xf87a8c[_0xa22e('0x30')],qs['fields'](_0x5761e9[_0xa22e('0x2e')][_0xa22e('0x31')]));_0x2f75a4[_0xa22e('0x32')]=_0x2f75a4[_0xa22e('0x32')]['length']?_0x2f75a4[_0xa22e('0x32')]:_0xf87a8c[_0xa22e('0x30')];_0x2f75a4[_0xa22e('0x36')]=qs['sort'](_0x5761e9[_0xa22e('0x2e')]['sort']);_0x2f75a4[_0xa22e('0x37')]=qs[_0xa22e('0x38')](_[_0xa22e('0x39')](_0x5761e9[_0xa22e('0x2e')],_0xf87a8c['filters']));if(_0x5761e9[_0xa22e('0x2e')][_0xa22e('0x3a')]){_0x2f75a4[_0xa22e('0x37')]=_[_0xa22e('0x3b')](_0x2f75a4[_0xa22e('0x37')],{'$or':_[_0xa22e('0x2a')](_0x2f75a4['attributes'],function(_0x5c9d21){var _0x91f83c={};_0x91f83c[_0x5c9d21]={'$like':'%'+_0x5761e9[_0xa22e('0x2e')][_0xa22e('0x3a')]+'%'};return _0x91f83c;})});}_0x2f75a4=_[_0xa22e('0x3b')]({},_0x2f75a4,_0x5761e9['options']);return _0x3794fd[_0xa22e('0x122')](_0x2f75a4);}})[_0xa22e('0x12')](function(_0x577574){if(_0x577574){_0x3e9787=_0x577574[_0xa22e('0x33')];if(!_0x5761e9[_0xa22e('0x2e')][_0xa22e('0x34')](_0xa22e('0x35'))){_0x2f75a4[_0xa22e('0x20')]=qs[_0xa22e('0x20')](_0x5761e9[_0xa22e('0x2e')][_0xa22e('0x20')]);_0x2f75a4[_0xa22e('0x22')]=qs[_0xa22e('0x22')](_0x5761e9[_0xa22e('0x2e')][_0xa22e('0x22')]);}return _0x3794fd[_0xa22e('0x122')](_0x2f75a4);}})[_0xa22e('0x12')](function(_0x502c03){if(_0x502c03){return _0x502c03?{'count':_0x3e9787,'rows':_0x502c03}:null;}})['then'](respondWithResult(_0xd7e1c3,null))[_0xa22e('0x1b')](handleError(_0xd7e1c3,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 484ef37..4f5fb9d 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 _0x5089=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x22afe1,_0x2a6f2d){var _0x3bb5b9=function(_0x177218){while(--_0x177218){_0x22afe1['push'](_0x22afe1['shift']());}};_0x3bb5b9(++_0x2a6f2d);}(_0x5089,0x1bb));var _0x9508=function(_0x3b2244,_0x54873f){_0x3b2244=_0x3b2244-0x0;var _0x2dcc14=_0x5089[_0x3b2244];return _0x2dcc14;};'use strict';var EventEmitter=require(_0x9508('0x0'));var ChatWebsite=require(_0x9508('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9508('0x2')](0x0);var events={'afterCreate':_0x9508('0x3'),'afterUpdate':_0x9508('0x4'),'afterDestroy':_0x9508('0x5')};function emitEvent(_0x172549){return function(_0x59d3ee,_0x86540d,_0x5e80fa){ChatWebsiteEvents[_0x9508('0x6')](_0x172549+':'+_0x59d3ee['id'],_0x59d3ee);ChatWebsiteEvents[_0x9508('0x6')](_0x172549,_0x59d3ee);_0x5e80fa(null);};}for(var e in events){if(events[_0x9508('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x9508('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xcee8=['hasOwnProperty','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit'];(function(_0x381dbb,_0x4a1419){var _0x301378=function(_0xd1993c){while(--_0xd1993c){_0x381dbb['push'](_0x381dbb['shift']());}};_0x301378(++_0x4a1419);}(_0xcee8,0xb1));var _0x8cee=function(_0x2f1f74,_0x4a884e){_0x2f1f74=_0x2f1f74-0x0;var _0x1170fc=_0xcee8[_0x2f1f74];return _0x1170fc;};'use strict';var EventEmitter=require(_0x8cee('0x0'));var ChatWebsite=require(_0x8cee('0x1'))['db'][_0x8cee('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8cee('0x3')](0x0);var events={'afterCreate':_0x8cee('0x4'),'afterUpdate':_0x8cee('0x5'),'afterDestroy':'remove'};function emitEvent(_0x127360){return function(_0x4e4143,_0xffd42d,_0x1ec415){ChatWebsiteEvents['emit'](_0x127360+':'+_0x4e4143['id'],_0x4e4143);ChatWebsiteEvents[_0x8cee('0x6')](_0x127360,_0x4e4143);_0x1ec415(null);};}for(var e in events){if(events[_0x8cee('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 54f4594..54b84ef 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 _0x7bd5=['lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite'];(function(_0x90142b,_0x3b8e05){var _0x49d6cd=function(_0x1a72b6){while(--_0x1a72b6){_0x90142b['push'](_0x90142b['shift']());}};_0x49d6cd(++_0x3b8e05);}(_0x7bd5,0x82));var _0x57bd=function(_0x313f18,_0x317e02){_0x313f18=_0x313f18-0x0;var _0x592fbb=_0x7bd5[_0x313f18];return _0x592fbb;};'use strict';var _=require(_0x57bd('0x0'));var util=require(_0x57bd('0x1'));var logger=require('../../config/logger')(_0x57bd('0x2'));var moment=require('moment');var BPromise=require(_0x57bd('0x3'));var rp=require(_0x57bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57bd('0x5'));var config=require(_0x57bd('0x6'));var attributes=require(_0x57bd('0x7'));module[_0x57bd('0x8')]=function(_0x4527c,_0x162094){return _0x4527c['define'](_0x57bd('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8de=['chat_websites','util','../../config/logger','moment','bluebird','request-promise','rimraf','./chatWebsite.attributes','exports','ChatWebsite'];(function(_0x20fc79,_0x35186d){var _0x39a80e=function(_0x3c756a){while(--_0x3c756a){_0x20fc79['push'](_0x20fc79['shift']());}};_0x39a80e(++_0x35186d);}(_0xa8de,0x187));var _0xea8d=function(_0x2c4be0,_0x41af29){_0x2c4be0=_0x2c4be0-0x0;var _0xf2a3dc=_0xa8de[_0x2c4be0];return _0xf2a3dc;};'use strict';var _=require('lodash');var util=require(_0xea8d('0x0'));var logger=require(_0xea8d('0x1'))('api');var moment=require(_0xea8d('0x2'));var BPromise=require(_0xea8d('0x3'));var rp=require(_0xea8d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea8d('0x5'));var config=require('../../config/environment');var attributes=require(_0xea8d('0x6'));module[_0xea8d('0x7')]=function(_0x540548,_0x49f1d4){return _0x540548['define'](_0xea8d('0x8'),attributes,{'tableName':_0xea8d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 39d5508..95e0b6f 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 _0x6b25=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b25,0xdf));var _0x56b2=function(_0x2cafdb,_0x15833a){_0x2cafdb=_0x2cafdb-0x0;var _0x4d4970=_0x6b25[_0x2cafdb];return _0x4d4970;};'use strict';var _=require(_0x56b2('0x0'));var util=require(_0x56b2('0x1'));var moment=require(_0x56b2('0x2'));var BPromise=require(_0x56b2('0x3'));var rs=require(_0x56b2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56b2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x56b2('0x6'))(_0x56b2('0x7'));var config=require(_0x56b2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x56b2('0x9')][_0x56b2('0xa')]({'port':0x232a});config[_0x56b2('0xb')]=_[_0x56b2('0xc')](config[_0x56b2('0xb')],{'host':_0x56b2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56b2('0xb')]));require(_0x56b2('0xe'))[_0x56b2('0xf')](socket);function respondWithRpcPromise(_0x5cfc6c,_0x66bbb2,_0xc0bf8a){return new BPromise(function(_0x344005,_0x458fbc){return client[_0x56b2('0x10')](_0x5cfc6c,_0xc0bf8a)[_0x56b2('0x11')](function(_0x5d4c9a){logger['info'](_0x56b2('0x12'),_0x66bbb2,_0x56b2('0x13'));logger[_0x56b2('0x14')](_0x56b2('0x15'),_0x66bbb2,'request\x20sent',JSON[_0x56b2('0x16')](_0x5d4c9a));if(_0x5d4c9a['error']){if(_0x5d4c9a[_0x56b2('0x17')]['code']===0x1f4){logger[_0x56b2('0x17')](_0x56b2('0x12'),_0x66bbb2,_0x5d4c9a[_0x56b2('0x17')][_0x56b2('0x18')]);return _0x458fbc(_0x5d4c9a['error'][_0x56b2('0x18')]);}logger[_0x56b2('0x17')](_0x56b2('0x12'),_0x66bbb2,_0x5d4c9a[_0x56b2('0x17')][_0x56b2('0x18')]);return _0x344005(_0x5d4c9a['error'][_0x56b2('0x18')]);}else{logger[_0x56b2('0x19')](_0x56b2('0x12'),_0x66bbb2,_0x56b2('0x13'));_0x344005(_0x5d4c9a[_0x56b2('0x1a')][_0x56b2('0x18')]);}})[_0x56b2('0x1b')](function(_0x49bcdb){logger[_0x56b2('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x66bbb2,_0x49bcdb);_0x458fbc(_0x49bcdb);});});} \ No newline at end of file +var _0xef27=['../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','util','bluebird','randomstring','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xef27,0x17c));var _0x7ef2=function(_0x908522,_0x37d960){_0x908522=_0x908522-0x0;var _0x50c7a8=_0xef27[_0x908522];return _0x50c7a8;};'use strict';var _=require('lodash');var util=require(_0x7ef2('0x0'));var moment=require('moment');var BPromise=require(_0x7ef2('0x1'));var rs=require(_0x7ef2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ef2('0x3'))['db'];var utils=require(_0x7ef2('0x4'));var logger=require(_0x7ef2('0x5'))(_0x7ef2('0x6'));var config=require(_0x7ef2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7ef2('0x8')]['http']({'port':0x232a});config[_0x7ef2('0x9')]=_['defaults'](config[_0x7ef2('0x9')],{'host':_0x7ef2('0xa'),'port':0x18eb});var socket=require(_0x7ef2('0xb'))(new Redis(config[_0x7ef2('0x9')]));require(_0x7ef2('0xc'))[_0x7ef2('0xd')](socket);function respondWithRpcPromise(_0x2ec3ec,_0x146eb9,_0x3d8261){return new BPromise(function(_0xc69d6c,_0xc2ff54){return client[_0x7ef2('0xe')](_0x2ec3ec,_0x3d8261)[_0x7ef2('0xf')](function(_0x44bbee){logger[_0x7ef2('0x10')](_0x7ef2('0x11'),_0x146eb9,'request\x20sent');logger[_0x7ef2('0x12')](_0x7ef2('0x13'),_0x146eb9,_0x7ef2('0x14'),JSON['stringify'](_0x44bbee));if(_0x44bbee[_0x7ef2('0x15')]){if(_0x44bbee[_0x7ef2('0x15')][_0x7ef2('0x16')]===0x1f4){logger['error'](_0x7ef2('0x11'),_0x146eb9,_0x44bbee['error'][_0x7ef2('0x17')]);return _0xc2ff54(_0x44bbee['error']['message']);}logger[_0x7ef2('0x15')](_0x7ef2('0x11'),_0x146eb9,_0x44bbee[_0x7ef2('0x15')]['message']);return _0xc69d6c(_0x44bbee[_0x7ef2('0x15')][_0x7ef2('0x17')]);}else{logger[_0x7ef2('0x10')](_0x7ef2('0x11'),_0x146eb9,_0x7ef2('0x14'));_0xc69d6c(_0x44bbee['result'][_0x7ef2('0x17')]);}})['catch'](function(_0x34392b){logger[_0x7ef2('0x15')](_0x7ef2('0x11'),_0x146eb9,_0x34392b);_0xc2ff54(_0x34392b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d0a03a6..b9b43f9 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 _0xa8e9=['emit','removeListener','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xa8e9,0x168));var _0x9a8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa8e9[_0x3dd15e];return _0x231fd0;};'use strict';var ChatWebsiteEvents=require(_0x9a8e('0x0'));var events=[_0x9a8e('0x1'),_0x9a8e('0x2'),_0x9a8e('0x3')];function createListener(_0x817b5d,_0x4d1176){return function(_0x519352){_0x4d1176[_0x9a8e('0x4')](_0x817b5d,_0x519352);};}function removeListener(_0x40e3e0,_0x50e862){return function(){ChatWebsiteEvents[_0x9a8e('0x5')](_0x40e3e0,_0x50e862);};}exports['register']=function(_0x40246f){for(var _0x1b0528=0x0,_0x1d2cd0=events['length'];_0x1b0528<_0x1d2cd0;_0x1b0528++){var _0xb2d343=events[_0x1b0528];var _0x4df3ef=createListener(_0x9a8e('0x6')+_0xb2d343,_0x40246f);ChatWebsiteEvents['on'](_0xb2d343,_0x4df3ef);}}; \ No newline at end of file +var _0x0154=['removeListener','register','chatWebsite:','save','remove','update','emit'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0x0154,0x73));var _0x4015=function(_0x35ba14,_0x31f105){_0x35ba14=_0x35ba14-0x0;var _0x102ca7=_0x0154[_0x35ba14];return _0x102ca7;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x4015('0x0'),_0x4015('0x1'),_0x4015('0x2')];function createListener(_0x53dc12,_0x5e97c6){return function(_0xcd8249){_0x5e97c6[_0x4015('0x3')](_0x53dc12,_0xcd8249);};}function removeListener(_0x5e8e7d,_0xf18edf){return function(){ChatWebsiteEvents[_0x4015('0x4')](_0x5e8e7d,_0xf18edf);};}exports[_0x4015('0x5')]=function(_0x50120f){for(var _0x1ec2ea=0x0,_0x59d2ea=events['length'];_0x1ec2ea<_0x59d2ea;_0x1ec2ea++){var _0x5d3bcc=events[_0x1ec2ea];var _0x1e326e=createListener(_0x4015('0x6')+_0x5d3bcc,_0x50120f);ChatWebsiteEvents['on'](_0x5d3bcc,_0x1e326e);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c8b5330..af59b37 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 _0xe612=['getAnswers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','addDisposition','addAnswer','diskStorage','root','%s-%s','originalname','single','addLogo','join','server/files/images/avatars/','format','now','file','addAvatar','addCustomerAvatar','addSystemAvatar','notify','attachments','offline-chat','ensureDir','replace','extname','any','offline','/:id/interactions','addInteraction','addApplications','/:id/users','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x1c2362,_0x397a51){var _0x44300d=function(_0x309430){while(--_0x309430){_0x1c2362['push'](_0x1c2362['shift']());}};_0x44300d(++_0x397a51);}(_0xe612,0x19d));var _0x2e61=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe612[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x2e61('0x0'));var util=require(_0x2e61('0x1'));var path=require(_0x2e61('0x2'));var timeout=require(_0x2e61('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2e61('0x4'));var auth=require(_0x2e61('0x5'));var interaction=require(_0x2e61('0x6'));var config=require(_0x2e61('0x7'));var controller=require(_0x2e61('0x8'));router[_0x2e61('0x9')]('/',auth[_0x2e61('0xa')](),controller[_0x2e61('0xb')]);router[_0x2e61('0x9')](_0x2e61('0xc'),auth[_0x2e61('0xa')](),controller[_0x2e61('0xd')]);router['get'](_0x2e61('0xe'),auth[_0x2e61('0xa')](),controller[_0x2e61('0xf')]);router[_0x2e61('0x9')](_0x2e61('0x10'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x11')]);router[_0x2e61('0x9')](_0x2e61('0x12'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x13')]);router[_0x2e61('0x9')](_0x2e61('0x14'),controller['getLogo']);router[_0x2e61('0x9')](_0x2e61('0x15'),controller['getAvatar']);router[_0x2e61('0x9')](_0x2e61('0x16'),controller[_0x2e61('0x17')]);router[_0x2e61('0x9')](_0x2e61('0x18'),controller[_0x2e61('0x19')]);router['get']('/:id/interactions',auth[_0x2e61('0xa')](),controller[_0x2e61('0x1a')]);router['get'](_0x2e61('0x1b'),controller[_0x2e61('0x1c')]);router[_0x2e61('0x9')](_0x2e61('0x1d'),auth[_0x2e61('0xa')](),controller['getApplications']);router[_0x2e61('0x9')](_0x2e61('0x1e'),auth[_0x2e61('0xa')](),controller['getProactiveActions']);router[_0x2e61('0x9')](_0x2e61('0x1f'),controller[_0x2e61('0x20')]);router[_0x2e61('0x9')](_0x2e61('0x21'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x22')]);router[_0x2e61('0x9')]('/:id/users',auth[_0x2e61('0xa')](),controller[_0x2e61('0x23')]);router[_0x2e61('0x24')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2e61('0x24')](_0x2e61('0x10'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x25')]);router[_0x2e61('0x24')](_0x2e61('0x12'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x26')]);var upload=multer({'storage':multer[_0x2e61('0x27')]({'destination':function(_0x1b4a4f,_0x457795,_0x558947){_0x558947(null,path['join'](config[_0x2e61('0x28')],'server/files/images/logos/'));},'filename':function(_0x11fd4f,_0x10bd67,_0x4c7232){_0x4c7232(null,util['format'](_0x2e61('0x29'),Date['now'](),_0x10bd67[_0x2e61('0x2a')]));}})});router[_0x2e61('0x24')](_0x2e61('0x14'),upload[_0x2e61('0x2b')]('file'),controller[_0x2e61('0x2c')]);var upload=multer({'storage':multer[_0x2e61('0x27')]({'destination':function(_0x993e56,_0x179661,_0x40097d){_0x40097d(null,path[_0x2e61('0x2d')](config[_0x2e61('0x28')],_0x2e61('0x2e')));},'filename':function(_0x597254,_0x4752f8,_0x3508e1){_0x3508e1(null,util[_0x2e61('0x2f')](_0x2e61('0x29'),Date[_0x2e61('0x30')](),_0x4752f8[_0x2e61('0x2a')]));}})});router[_0x2e61('0x24')]('/:id/avatar',upload[_0x2e61('0x2b')](_0x2e61('0x31')),controller[_0x2e61('0x32')]);var upload=multer({'storage':multer[_0x2e61('0x27')]({'destination':function(_0x413e77,_0x5d37f5,_0x5eae91){_0x5eae91(null,path[_0x2e61('0x2d')](config[_0x2e61('0x28')],_0x2e61('0x2e')));},'filename':function(_0x5a04dd,_0x44c1a2,_0x127e18){_0x127e18(null,util[_0x2e61('0x2f')](_0x2e61('0x29'),Date[_0x2e61('0x30')](),_0x44c1a2['originalname']));}})});router[_0x2e61('0x24')](_0x2e61('0x16'),upload['single'](_0x2e61('0x31')),controller[_0x2e61('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x314aec,_0x437d51,_0x505ff4){_0x505ff4(null,path[_0x2e61('0x2d')](config[_0x2e61('0x28')],'server/files/images/avatars/'));},'filename':function(_0x5ac3e8,_0x2146ad,_0x37a5d4){_0x37a5d4(null,util[_0x2e61('0x2f')]('%s-%s',Date[_0x2e61('0x30')](),_0x2146ad[_0x2e61('0x2a')]));}})});router[_0x2e61('0x24')](_0x2e61('0x18'),upload[_0x2e61('0x2b')]('file'),controller[_0x2e61('0x34')]);router['post']('/:id/notify',controller[_0x2e61('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x2e61('0x27')]({'destination':function(_0x2f1f2d,_0x3d77c0,_0x4528ae){const _0x15849f=path[_0x2e61('0x2d')](config['root'],'server/files',_0x2e61('0x36'),_0x2e61('0x37'));fs_extra[_0x2e61('0x38')](_0x15849f,function(){_0x4528ae(null,_0x15849f);});},'filename':function(_0x125a84,_0x2b6060,_0x5adb3b){const _0x4735d8=_0x2b6060[_0x2e61('0x2a')][_0x2e61('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2f9cbc=path[_0x2e61('0x3a')](_0x4735d8);const _0x2d6cec=Date[_0x2e61('0x30')]()+'-'+_0x4735d8[_0x2e61('0x39')](_0x2f9cbc,'')+_0x2f9cbc;_0x5adb3b(null,_0x2d6cec);}})});router[_0x2e61('0x24')]('/:id/offline',offlineUploadMulter[_0x2e61('0x3b')](),controller[_0x2e61('0x3c')]);router['post'](_0x2e61('0x3d'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x3e')]);router['post'](_0x2e61('0x1d'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x3f')]);router['post']('/:id/proactive_actions',auth[_0x2e61('0xa')](),controller['addProactiveActions']);router[_0x2e61('0x24')](_0x2e61('0x40'),auth['isAuthenticated'](),controller[_0x2e61('0x41')]);router[_0x2e61('0x42')](_0x2e61('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x2e61('0x43')](_0x2e61('0xe'),auth['isAuthenticated'](),controller[_0x2e61('0x44')]);router[_0x2e61('0x43')](_0x2e61('0x10'),auth['isAuthenticated'](),controller[_0x2e61('0x45')]);router[_0x2e61('0x43')](_0x2e61('0x12'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x46')]);router['delete'](_0x2e61('0x40'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x47')]);module['exports']=router; \ No newline at end of file +var _0x633f=['destroy','/:id/dispositions','removeDispositions','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet','/:id/proactive_actions','getProactiveActions','/:id/offline_messages','getOfflineMessages','/:id/users','create','post','addDisposition','addAnswer','join','format','%s-%s','now','originalname','single','addLogo','diskStorage','server/files/images/avatars/','/:id/avatar','file','addAvatar','addCustomerAvatar','/:id/notify','notify','root','server/files','offline-chat','ensureDir','replace','any','offline','/:id/interactions','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete'];(function(_0x485de1,_0x5df409){var _0x53647e=function(_0x4f4f2d){while(--_0x4f4f2d){_0x485de1['push'](_0x485de1['shift']());}};_0x53647e(++_0x5df409);}(_0x633f,0x8d));var _0xf633=function(_0x3aa6c9,_0x498f87){_0x3aa6c9=_0x3aa6c9-0x0;var _0x4e48a7=_0x633f[_0x3aa6c9];return _0x4e48a7;};'use strict';var multer=require(_0xf633('0x0'));var util=require(_0xf633('0x1'));var path=require(_0xf633('0x2'));var timeout=require('connect-timeout');var express=require(_0xf633('0x3'));var router=express['Router']();var fs_extra=require(_0xf633('0x4'));var auth=require(_0xf633('0x5'));var interaction=require(_0xf633('0x6'));var config=require(_0xf633('0x7'));var controller=require(_0xf633('0x8'));router[_0xf633('0x9')]('/',auth[_0xf633('0xa')](),controller[_0xf633('0xb')]);router[_0xf633('0x9')]('/describe',auth[_0xf633('0xa')](),controller[_0xf633('0xc')]);router[_0xf633('0x9')](_0xf633('0xd'),auth[_0xf633('0xa')](),controller['show']);router[_0xf633('0x9')]('/:id/dispositions',auth[_0xf633('0xa')](),controller['getDispositions']);router[_0xf633('0x9')]('/:id/canned_answers',auth[_0xf633('0xa')](),controller[_0xf633('0xe')]);router['get'](_0xf633('0xf'),controller[_0xf633('0x10')]);router['get']('/:id/avatar',controller[_0xf633('0x11')]);router['get'](_0xf633('0x12'),controller[_0xf633('0x13')]);router[_0xf633('0x9')](_0xf633('0x14'),controller[_0xf633('0x15')]);router[_0xf633('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xf633('0x16')]);router['get']('/:id/snippet',controller[_0xf633('0x17')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xf633('0x9')](_0xf633('0x18'),auth[_0xf633('0xa')](),controller[_0xf633('0x19')]);router['get']('/:id/fields',controller['getFields']);router[_0xf633('0x9')](_0xf633('0x1a'),auth[_0xf633('0xa')](),controller[_0xf633('0x1b')]);router['get'](_0xf633('0x1c'),auth[_0xf633('0xa')](),controller['getAgents']);router['post']('/',auth[_0xf633('0xa')](),controller[_0xf633('0x1d')]);router[_0xf633('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf633('0x1f')]);router[_0xf633('0x1e')]('/:id/canned_answers',auth[_0xf633('0xa')](),controller[_0xf633('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x127948,_0x81c529,_0x4fd86d){_0x4fd86d(null,path[_0xf633('0x21')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1d0a36,_0x1a3e4d,_0x190c51){_0x190c51(null,util[_0xf633('0x22')](_0xf633('0x23'),Date[_0xf633('0x24')](),_0x1a3e4d[_0xf633('0x25')]));}})});router[_0xf633('0x1e')]('/:id/logo',upload[_0xf633('0x26')]('file'),controller[_0xf633('0x27')]);var upload=multer({'storage':multer[_0xf633('0x28')]({'destination':function(_0x8db2b2,_0x37487d,_0x1e824b){_0x1e824b(null,path['join'](config['root'],_0xf633('0x29')));},'filename':function(_0x4eb597,_0x11cd60,_0x46e7b4){_0x46e7b4(null,util['format'](_0xf633('0x23'),Date[_0xf633('0x24')](),_0x11cd60[_0xf633('0x25')]));}})});router['post'](_0xf633('0x2a'),upload[_0xf633('0x26')](_0xf633('0x2b')),controller[_0xf633('0x2c')]);var upload=multer({'storage':multer[_0xf633('0x28')]({'destination':function(_0x4886bb,_0x9a89d0,_0x40fa7c){_0x40fa7c(null,path[_0xf633('0x21')](config['root'],_0xf633('0x29')));},'filename':function(_0x207696,_0x37a37d,_0x5c2eff){_0x5c2eff(null,util[_0xf633('0x22')](_0xf633('0x23'),Date[_0xf633('0x24')](),_0x37a37d[_0xf633('0x25')]));}})});router[_0xf633('0x1e')](_0xf633('0x12'),upload[_0xf633('0x26')](_0xf633('0x2b')),controller[_0xf633('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x395754,_0x386b41,_0x52bbcc){_0x52bbcc(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x593f30,_0xb65ebd,_0x568182){_0x568182(null,util[_0xf633('0x22')](_0xf633('0x23'),Date[_0xf633('0x24')](),_0xb65ebd['originalname']));}})});router[_0xf633('0x1e')](_0xf633('0x14'),upload['single'](_0xf633('0x2b')),controller['addSystemAvatar']);router[_0xf633('0x1e')](_0xf633('0x2e'),controller[_0xf633('0x2f')]);const offlineUploadMulter=multer({'storage':multer[_0xf633('0x28')]({'destination':function(_0x514b42,_0x33caec,_0x41a471){const _0x597b5c=path[_0xf633('0x21')](config[_0xf633('0x30')],_0xf633('0x31'),'attachments',_0xf633('0x32'));fs_extra[_0xf633('0x33')](_0x597b5c,function(){_0x41a471(null,_0x597b5c);});},'filename':function(_0x10e589,_0x3632f9,_0x157d2c){const _0x5a0c8b=_0x3632f9[_0xf633('0x25')][_0xf633('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x12341b=path['extname'](_0x5a0c8b);const _0x29e94d=Date[_0xf633('0x24')]()+'-'+_0x5a0c8b[_0xf633('0x34')](_0x12341b,'')+_0x12341b;_0x157d2c(null,_0x29e94d);}})});router['post']('/:id/offline',offlineUploadMulter[_0xf633('0x35')](),controller[_0xf633('0x36')]);router[_0xf633('0x1e')](_0xf633('0x37'),auth[_0xf633('0xa')](),controller['addInteraction']);router[_0xf633('0x1e')](_0xf633('0x38'),auth['isAuthenticated'](),controller[_0xf633('0x39')]);router[_0xf633('0x1e')](_0xf633('0x18'),auth[_0xf633('0xa')](),controller[_0xf633('0x3a')]);router[_0xf633('0x1e')](_0xf633('0x1c'),auth[_0xf633('0xa')](),controller[_0xf633('0x3b')]);router[_0xf633('0x3c')](_0xf633('0xd'),auth['isAuthenticated'](),controller[_0xf633('0x3d')]);router[_0xf633('0x3e')](_0xf633('0xd'),auth[_0xf633('0xa')](),controller[_0xf633('0x3f')]);router[_0xf633('0x3e')](_0xf633('0x40'),auth[_0xf633('0xa')](),controller[_0xf633('0x41')]);router[_0xf633('0x3e')]('/:id/canned_answers',auth[_0xf633('0xa')](),controller['removeAnswers']);router[_0xf633('0x3e')](_0xf633('0x1c'),auth[_0xf633('0xa')](),controller[_0xf633('0x42')]);module[_0xf633('0x43')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 372641f..dee79b5 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 _0x9423=['use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs'];(function(_0x4f95f8,_0xb3da1b){var _0x3b41ec=function(_0x3fb5f1){while(--_0x3fb5f1){_0x4f95f8['push'](_0x4f95f8['shift']());}};_0x3b41ec(++_0xb3da1b);}(_0x9423,0x1e3));var _0x3942=function(_0x14e366,_0x5177ce){_0x14e366=_0x14e366-0x0;var _0x52c7ff=_0x9423[_0x14e366];return _0x52c7ff;};var beaverLogger=require(_0x3942('0x0'));var express=require('express');var auth=require(_0x3942('0x1'));var config=require(_0x3942('0x2'));var router=express[_0x3942('0x3')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x1b996b,_0x748db,_0x2212c4){var _0x46f013=_0x1b996b[_0x3942('0x4')]['get'](_0x3942('0x5'));if(!_0x46f013){throw new Error(_0x3942('0x6'));}return beaverLogger[_0x3942('0x7')]({'uri':_0x3942('0x8'),'logger':_0x46f013,'enableCors':!isProduction})(_0x1b996b,_0x748db,_0x2212c4);}router[_0x3942('0x9')](auth[_0x3942('0xa')](),clientSideLogs);module[_0x3942('0xb')]=router; \ No newline at end of file +var _0x3c93=['production','app','get','Client-Side\x20logger\x20not\x20found!','/client-logs','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','env'];(function(_0x4f454d,_0x23628e){var _0x3b260=function(_0x19d6f6){while(--_0x19d6f6){_0x4f454d['push'](_0x4f454d['shift']());}};_0x3b260(++_0x23628e);}(_0x3c93,0x1c3));var _0x33c9=function(_0x2e58fe,_0x1bb5c3){_0x2e58fe=_0x2e58fe-0x0;var _0x2f297e=_0x3c93[_0x2e58fe];return _0x2f297e;};var beaverLogger=require(_0x33c9('0x0'));var express=require(_0x33c9('0x1'));var auth=require(_0x33c9('0x2'));var config=require(_0x33c9('0x3'));var router=express['Router']();var isProduction=config[_0x33c9('0x4')]===_0x33c9('0x5')||![];function clientSideLogs(_0x5bc320,_0x5e6b1b,_0x1ac6de){var _0x1d0944=_0x5bc320[_0x33c9('0x6')][_0x33c9('0x7')]('client-side-logger');if(!_0x1d0944){throw new Error(_0x33c9('0x8'));}return beaverLogger['expressEndpoint']({'uri':_0x33c9('0x9'),'logger':_0x1d0944,'enableCors':!isProduction})(_0x5bc320,_0x5e6b1b,_0x1ac6de);}router['use'](auth[_0x33c9('0xa')](),clientSideLogs);module[_0x33c9('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 47acc00..21bea80 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 _0x8ea7=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x3d92cb,_0x11aa36){var _0x50026d=function(_0x43df54){while(--_0x43df54){_0x3d92cb['push'](_0x3d92cb['shift']());}};_0x50026d(++_0x11aa36);}(_0x8ea7,0x19e));var _0x78ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78ea('0x0'));module[_0x78ea('0x1')]={'name':{'type':Sequelize[_0x78ea('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x78ea('0x3')](_0x78ea('0x4'),_0x78ea('0x5'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x78ea('0x3')](_0x78ea('0x6'),_0x78ea('0x7'))},'data1':{'type':Sequelize[_0x78ea('0x2')],'comment':_0x78ea('0x8')},'data2':{'type':Sequelize[_0x78ea('0x2')],'comment':_0x78ea('0x9')},'data3':{'type':Sequelize[_0x78ea('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x78ea('0x2')],'comment':_0x78ea('0xa')},'data5':{'type':Sequelize[_0x78ea('0xb')],'comment':_0x78ea('0xc')},'data6':{'type':Sequelize[_0x78ea('0xb')],'comment':_0x78ea('0xd')},'data7':{'type':Sequelize[_0x78ea('0xb')],'comment':_0x78ea('0xe')}}; \ No newline at end of file +var _0x38fc=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','AmazonAWS','Google','MicrosoftAzure','ENUM','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x1f8f66,_0x5dc25a){var _0x3b992d=function(_0x25dadb){while(--_0x25dadb){_0x1f8f66['push'](_0x1f8f66['shift']());}};_0x3b992d(++_0x5dc25a);}(_0x38fc,0xb7));var _0xc38f=function(_0x27e43d,_0x3841bf){_0x27e43d=_0x27e43d-0x0;var _0xaa45f2=_0x38fc[_0x27e43d];return _0xaa45f2;};'use strict';var Sequelize=require(_0xc38f('0x0'));module[_0xc38f('0x1')]={'name':{'type':Sequelize[_0xc38f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xc38f('0x3'),_0xc38f('0x4'),_0xc38f('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc38f('0x6')](_0xc38f('0x7'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':_0xc38f('0x8')},'data2':{'type':Sequelize[_0xc38f('0x2')],'comment':_0xc38f('0x9')},'data3':{'type':Sequelize['STRING'],'comment':_0xc38f('0xa')},'data4':{'type':Sequelize[_0xc38f('0x2')],'comment':_0xc38f('0xb')},'data5':{'type':Sequelize[_0xc38f('0xc')],'comment':_0xc38f('0xd')},'data6':{'type':Sequelize[_0xc38f('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xc38f('0xc')],'comment':_0xc38f('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a398fbd..dd4ba99 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 _0xf0f6=['data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','destroy','name','padEnd','slice','CloudProvider','fieldName','type','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','merge','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','length','options','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','error','state','Invalid\x20state\x20parameter','parse','from','toString','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code'];(function(_0x35c2fc,_0xabea37){var _0x4727fd=function(_0x4eccfe){while(--_0x4eccfe){_0x35c2fc['push'](_0x35c2fc['shift']());}};_0x4727fd(++_0xabea37);}(_0xf0f6,0x1db));var _0x6f0f=function(_0x2685da,_0x3c928b){_0x2685da=_0x2685da-0x0;var _0x3b43f5=_0xf0f6[_0x2685da];return _0x3b43f5;};'use strict';var _=require(_0x6f0f('0x0'));var Redis=require(_0x6f0f('0x1'));var qs=require(_0x6f0f('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x6f0f('0x3'));var db=require(_0x6f0f('0x4'))['db'];var oauth=require(_0x6f0f('0x5'));config[_0x6f0f('0x6')]=_[_0x6f0f('0x7')](config[_0x6f0f('0x6')],{'host':_0x6f0f('0x8'),'port':0x18eb});var socket=require(_0x6f0f('0x9'))(new Redis(config[_0x6f0f('0x6')]));var redis=new Redis(config[_0x6f0f('0x6')]);function respondWithStatusCode(_0x54648a,_0x1e0fae){_0x1e0fae=_0x1e0fae||0xcc;return function(_0x33b0ab){if(_0x33b0ab){return _0x54648a[_0x6f0f('0xa')](_0x1e0fae);}return _0x54648a['status'](_0x1e0fae)[_0x6f0f('0xb')]();};}function respondWithResult(_0x177cb5,_0xfbf9ec){_0xfbf9ec=_0xfbf9ec||0xc8;return function(_0x291767){if(_0x291767){return _0x177cb5[_0x6f0f('0xc')](_0xfbf9ec)[_0x6f0f('0xd')](_0x291767);}};}function respondWithFilteredResult(_0x2b4e07,_0x409680){return function(_0x6010fa){if(_0x6010fa){var _0x3e41d6=typeof _0x409680[_0x6f0f('0xe')]==='undefined'&&typeof _0x409680['limit']===_0x6f0f('0xf');var _0x2c7c9b=_0x6010fa['count'];var _0x3edcbd=_0x3e41d6?0x0:_0x409680[_0x6f0f('0xe')];var _0x38b5fb=_0x3e41d6?_0x6010fa[_0x6f0f('0x10')]:_0x409680['offset']+_0x409680[_0x6f0f('0x11')];var _0x278ca3;if(_0x38b5fb>=_0x2c7c9b){_0x38b5fb=_0x2c7c9b;_0x278ca3=0xc8;}else{_0x278ca3=0xce;}_0x2b4e07[_0x6f0f('0xc')](_0x278ca3);return _0x2b4e07['set'](_0x6f0f('0x12'),_0x3edcbd+'-'+_0x38b5fb+'/'+_0x2c7c9b)[_0x6f0f('0xd')](_0x6010fa);}return null;};}function saveUpdates(_0x4ac85c){return function(_0x1d00c2){if(_0x1d00c2){return _0x1d00c2[_0x6f0f('0x13')](_0x4ac85c)[_0x6f0f('0x14')](function(_0x31b890){return _0x31b890;});}return null;};}function removeEntity(_0x20c560){return function(_0x5caa97){if(_0x5caa97){return _0x5caa97[_0x6f0f('0x15')]()[_0x6f0f('0x14')](function(){_0x20c560[_0x6f0f('0xc')](0xcc)[_0x6f0f('0xb')]();});}};}function handleEntityNotFound(_0x39f20f){return function(_0x1e1ce4){if(!_0x1e1ce4){_0x39f20f[_0x6f0f('0xa')](0x194);}return _0x1e1ce4;};}function handleError(_0x4dbc2f,_0x13ad64){_0x13ad64=_0x13ad64||0x1f4;return function(_0x53974a){logger['error'](_0x53974a['stack']);if(_0x53974a[_0x6f0f('0x16')]){delete _0x53974a['name'];}_0x4dbc2f['status'](_0x13ad64)['send'](_0x53974a);};}function maskClientSecret(_0x2614fe){return _[_0x6f0f('0x17')](_0x2614fe[_0x6f0f('0x18')](0x0,0x3),0x14,'*');}exports['index']=function(_0x36666d,_0x4df79){var _0x160a4e={},_0x4e327f={},_0x497f4f={'count':0x0,'rows':[]};var _0x34dac4=_['map'](db[_0x6f0f('0x19')]['rawAttributes'],function(_0xb1d805){return{'name':_0xb1d805[_0x6f0f('0x1a')],'type':_0xb1d805[_0x6f0f('0x1b')]['key']};});_0x4e327f[_0x6f0f('0x1c')]=_[_0x6f0f('0x1d')](_0x34dac4,'name');_0x4e327f['query']=_[_0x6f0f('0x1e')](_0x36666d['query']);_0x4e327f['filters']=_[_0x6f0f('0x1f')](_0x4e327f[_0x6f0f('0x1c')],_0x4e327f[_0x6f0f('0x20')]);_0x160a4e[_0x6f0f('0x21')]=_['intersection'](_0x4e327f[_0x6f0f('0x1c')],qs[_0x6f0f('0x22')](_0x36666d[_0x6f0f('0x20')]['fields']));_0x160a4e['attributes']=_0x160a4e['attributes']['length']?_0x160a4e['attributes']:_0x4e327f[_0x6f0f('0x1c')];if(!_0x36666d['query'][_0x6f0f('0x23')](_0x6f0f('0x24'))){_0x160a4e[_0x6f0f('0x11')]=qs['limit'](_0x36666d[_0x6f0f('0x20')]['limit']);_0x160a4e[_0x6f0f('0xe')]=qs[_0x6f0f('0xe')](_0x36666d['query'][_0x6f0f('0xe')]);}_0x160a4e[_0x6f0f('0x25')]=qs['sort'](_0x36666d[_0x6f0f('0x20')][_0x6f0f('0x26')]);_0x160a4e[_0x6f0f('0x27')]=qs['filters'](_['pick'](_0x36666d[_0x6f0f('0x20')],_0x4e327f[_0x6f0f('0x28')]),_0x34dac4);if(_0x36666d['query']['filter']){_0x160a4e['where']=_['merge'](_0x160a4e[_0x6f0f('0x27')],{'$or':_[_0x6f0f('0x1d')](_0x34dac4,function(_0x4ccb42){if(_0x4ccb42['type']!==_0x6f0f('0x29')){var _0x2256c8={};_0x2256c8[_0x4ccb42[_0x6f0f('0x16')]]={'$like':'%'+_0x36666d[_0x6f0f('0x20')]['filter']+'%'};return _0x2256c8;}})});}_0x160a4e=_[_0x6f0f('0x2a')]({},_0x160a4e,_0x36666d['options']);var _0x3ba548={'where':_0x160a4e[_0x6f0f('0x27')]};return db[_0x6f0f('0x19')][_0x6f0f('0x10')](_0x3ba548)[_0x6f0f('0x14')](function(_0x31f981){_0x497f4f[_0x6f0f('0x10')]=_0x31f981;if(_0x36666d['query'][_0x6f0f('0x2b')]){_0x160a4e[_0x6f0f('0x2c')]=[{'all':!![]}];}return db[_0x6f0f('0x19')][_0x6f0f('0x2d')](_0x160a4e);})[_0x6f0f('0x14')](function(_0x23f51a){_0x497f4f[_0x6f0f('0x2e')]=_['map'](_0x23f51a,function(_0x57325e){if(_0x57325e[_0x6f0f('0x2f')]===_0x6f0f('0x30')){var _0x21e5de=encryptor[_0x6f0f('0x31')](_0x57325e['data3']);_0x57325e[_0x6f0f('0x32')]=maskClientSecret(_0x21e5de);}return _0x57325e;});return _0x497f4f;})[_0x6f0f('0x14')](respondWithFilteredResult(_0x4df79,_0x160a4e))[_0x6f0f('0x33')](handleError(_0x4df79,null));};exports[_0x6f0f('0x34')]=function(_0x33ae08,_0x2f2bff){var _0x4080d2={'raw':!![],'where':{'id':_0x33ae08[_0x6f0f('0x35')]['id']}},_0x12e19d={};_0x12e19d[_0x6f0f('0x1c')]=_['keys'](db[_0x6f0f('0x19')][_0x6f0f('0x36')]);_0x12e19d['query']=_[_0x6f0f('0x1e')](_0x33ae08[_0x6f0f('0x20')]);_0x12e19d['filters']=_[_0x6f0f('0x1f')](_0x12e19d['model'],_0x12e19d[_0x6f0f('0x20')]);_0x4080d2[_0x6f0f('0x21')]=_[_0x6f0f('0x1f')](_0x12e19d['model'],qs[_0x6f0f('0x22')](_0x33ae08[_0x6f0f('0x20')][_0x6f0f('0x22')]));_0x4080d2['attributes']=_0x4080d2[_0x6f0f('0x21')][_0x6f0f('0x37')]?_0x4080d2[_0x6f0f('0x21')]:_0x12e19d[_0x6f0f('0x1c')];if(_0x33ae08[_0x6f0f('0x20')][_0x6f0f('0x2b')]){_0x4080d2[_0x6f0f('0x2c')]=[{'all':!![]}];}_0x4080d2=_[_0x6f0f('0x2a')]({},_0x4080d2,_0x33ae08[_0x6f0f('0x38')]);return db[_0x6f0f('0x19')][_0x6f0f('0x39')](_0x4080d2)['then'](handleEntityNotFound(_0x2f2bff,null))[_0x6f0f('0x14')](function(_0x5e386a){if(_0x5e386a[_0x6f0f('0x2f')]===_0x6f0f('0x30')){var _0x2246d4=encryptor['decryptString'](_0x5e386a[_0x6f0f('0x32')]);_0x5e386a[_0x6f0f('0x32')]=maskClientSecret(_0x2246d4);}return _0x5e386a;})[_0x6f0f('0x14')](respondWithResult(_0x2f2bff,null))[_0x6f0f('0x33')](handleError(_0x2f2bff,null));};exports[_0x6f0f('0x3a')]=function(_0x1c11e3,_0x3ae2d1){if(!_0x1c11e3[_0x6f0f('0x3b')][_0x6f0f('0x16')])throw new Error(_0x6f0f('0x3c'));if(!_0x1c11e3['body']['service'])throw new Error(_0x6f0f('0x3d'));var _0x504d05=db[_0x6f0f('0x19')][_0x6f0f('0x36')]['service'][_0x6f0f('0x3e')];if(!_0x504d05[_0x6f0f('0x3f')](_0x1c11e3['body'][_0x6f0f('0x2f')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x504d05[_0x6f0f('0x40')](',\x20'));if(_0x1c11e3['body'][_0x6f0f('0x2f')]===_0x6f0f('0x30')&&_0x1c11e3['body']['data3']){_0x1c11e3[_0x6f0f('0x3b')][_0x6f0f('0x32')]=encryptor['encryptString'](_0x1c11e3[_0x6f0f('0x3b')]['data3']);}return db[_0x6f0f('0x19')][_0x6f0f('0x3a')](_0x1c11e3[_0x6f0f('0x3b')],{})[_0x6f0f('0x14')](respondWithResult(_0x3ae2d1,0xc9))[_0x6f0f('0x33')](handleError(_0x3ae2d1,null));};exports['update']=function(_0x2cc512,_0x56f4f8){if(_0x2cc512['body']['id']){delete _0x2cc512[_0x6f0f('0x3b')]['id'];}return db['CloudProvider'][_0x6f0f('0x39')]({'where':{'id':_0x2cc512[_0x6f0f('0x35')]['id']}})[_0x6f0f('0x14')](handleEntityNotFound(_0x56f4f8,null))[_0x6f0f('0x14')](function(_0x39640f){if(_0x39640f['service']==='MicrosoftAzure'&&_0x2cc512['body'][_0x6f0f('0x32')]){_0x2cc512['body'][_0x6f0f('0x32')]=encryptor[_0x6f0f('0x41')](_0x2cc512[_0x6f0f('0x3b')][_0x6f0f('0x32')]);}return _0x39640f;})[_0x6f0f('0x14')](saveUpdates(_0x2cc512[_0x6f0f('0x3b')],null))[_0x6f0f('0x14')](respondWithResult(_0x56f4f8,null))[_0x6f0f('0x33')](handleError(_0x56f4f8,null));};exports[_0x6f0f('0x15')]=function(_0x5d5705,_0x4ca897){return db[_0x6f0f('0x19')][_0x6f0f('0x39')]({'where':{'id':_0x5d5705[_0x6f0f('0x35')]['id']}})[_0x6f0f('0x14')](handleEntityNotFound(_0x4ca897,null))['then'](removeEntity(_0x4ca897,null))['catch'](handleError(_0x4ca897,null));};exports[_0x6f0f('0x42')]=function(_0x3d2daf,_0x25ee49){return db[_0x6f0f('0x19')][_0x6f0f('0x43')]({'where':{'id':_0x3d2daf['params']['id']},'raw':!![]})['then'](function(_0x5abf2f){if(!_0x5abf2f)return _0x25ee49[_0x6f0f('0xa')](0x194);return{'url':oauth[_0x6f0f('0x44')](_0x5abf2f,_0x3d2daf['user']['id'])};})[_0x6f0f('0x14')](respondWithResult(_0x25ee49,null))[_0x6f0f('0x33')](handleError(_0x25ee49,null));};exports[_0x6f0f('0x45')]=function(_0x2230c4,_0x2a561a){var _0x631492=_0x2230c4[_0x6f0f('0x3b')];var _0x305c48;var _0x518739;if(_0x631492[_0x6f0f('0x46')])throw _0x631492;redis['get'](_0x631492[_0x6f0f('0x47')])[_0x6f0f('0x14')](function(_0x37cac8){if(!_0x37cac8)throw new Error(_0x6f0f('0x48'));_0x305c48=JSON[_0x6f0f('0x49')](_0x37cac8);var _0x5db4ad=Buffer[_0x6f0f('0x4a')](_0x631492['state'],'base64')[_0x6f0f('0x4b')]('ascii');_0x518739=JSON[_0x6f0f('0x49')](_0x5db4ad);if(!oauth[_0x6f0f('0x4c')](_0x631492[_0x6f0f('0x4d')],_0x305c48[_0x6f0f('0x4e')]))throw new Error(_0x6f0f('0x4f'));redis[_0x6f0f('0x50')](_0x631492[_0x6f0f('0x47')]);return oauth[_0x6f0f('0x51')](_0x631492[_0x6f0f('0x52')],_0x305c48);})[_0x6f0f('0x14')](function(_0x160301){_0x305c48[_0x6f0f('0x53')]=_0x160301[_0x6f0f('0x54')];_0x305c48[_0x6f0f('0x55')]=_0x160301[_0x6f0f('0x56')];return db[_0x6f0f('0x19')][_0x6f0f('0x13')]({'data5':_0x305c48[_0x6f0f('0x53')],'data6':_0x305c48[_0x6f0f('0x55')]},{'where':{'id':_0x305c48['id']}});})['then'](function(){oauth[_0x6f0f('0x57')](_0x305c48);socket[_0x6f0f('0x58')]('microsoftAuthorization:success',{'id':_0x518739['id']});return;})['then'](respondWithStatusCode(_0x2a561a,null))[_0x6f0f('0x33')](function(_0x24ba77){if(_0x518739){socket[_0x6f0f('0x58')](_0x6f0f('0x59'),{'id':_0x518739['id']});}if(!_0x305c48){logger[_0x6f0f('0x46')]('Invalid\x20authentication\x20state\x20parameter',_0x24ba77);return _0x2a561a[_0x6f0f('0xc')](0x1f4)['send'](_0x24ba77[_0x6f0f('0x5a')]);}logger[_0x6f0f('0x46')](_0x6f0f('0x5b'),_0x305c48['id'],JSON[_0x6f0f('0x5c')](_0x24ba77));});}; \ No newline at end of file +var _0x25c3=['parse','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','microsoftAuthorization:success','emit','microsoftAuthorization:error','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','socket.io-emitter','redis','status','end','json','offset','undefined','limit','count','set','update','then','sendStatus','error','name','send','index','CloudProvider','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','MicrosoftAzure','data3','catch','show','params','keys','length','includeAll','options','service','decryptString','create','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','find','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter'];(function(_0x292456,_0x9a9d5){var _0x2e4bfe=function(_0x3a4584){while(--_0x3a4584){_0x292456['push'](_0x292456['shift']());}};_0x2e4bfe(++_0x9a9d5);}(_0x25c3,0xd0));var _0x325c=function(_0x445908,_0x106a15){_0x445908=_0x445908-0x0;var _0x37da57=_0x25c3[_0x445908];return _0x37da57;};'use strict';var _=require(_0x325c('0x0'));var Redis=require(_0x325c('0x1'));var qs=require(_0x325c('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x325c('0x3'));var logger=require(_0x325c('0x4'))(_0x325c('0x5'));var db=require(_0x325c('0x6'))['db'];var oauth=require(_0x325c('0x7'));config['redis']=_[_0x325c('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x325c('0x9'))(new Redis(config[_0x325c('0xa')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x3d0af6,_0x20fe50){_0x20fe50=_0x20fe50||0xcc;return function(_0xe4b9a5){if(_0xe4b9a5){return _0x3d0af6['sendStatus'](_0x20fe50);}return _0x3d0af6[_0x325c('0xb')](_0x20fe50)[_0x325c('0xc')]();};}function respondWithResult(_0x316aac,_0xee9709){_0xee9709=_0xee9709||0xc8;return function(_0x10a55d){if(_0x10a55d){return _0x316aac[_0x325c('0xb')](_0xee9709)[_0x325c('0xd')](_0x10a55d);}};}function respondWithFilteredResult(_0x5e1d44,_0x39b41e){return function(_0x874b7c){if(_0x874b7c){var _0x3959f9=typeof _0x39b41e[_0x325c('0xe')]===_0x325c('0xf')&&typeof _0x39b41e[_0x325c('0x10')]===_0x325c('0xf');var _0x22ab65=_0x874b7c[_0x325c('0x11')];var _0x2da61a=_0x3959f9?0x0:_0x39b41e[_0x325c('0xe')];var _0x2f3b80=_0x3959f9?_0x874b7c[_0x325c('0x11')]:_0x39b41e[_0x325c('0xe')]+_0x39b41e[_0x325c('0x10')];var _0x212291;if(_0x2f3b80>=_0x22ab65){_0x2f3b80=_0x22ab65;_0x212291=0xc8;}else{_0x212291=0xce;}_0x5e1d44[_0x325c('0xb')](_0x212291);return _0x5e1d44[_0x325c('0x12')]('Content-Range',_0x2da61a+'-'+_0x2f3b80+'/'+_0x22ab65)[_0x325c('0xd')](_0x874b7c);}return null;};}function saveUpdates(_0x47b12f){return function(_0x4be8ec){if(_0x4be8ec){return _0x4be8ec[_0x325c('0x13')](_0x47b12f)[_0x325c('0x14')](function(_0x54d2d4){return _0x54d2d4;});}return null;};}function removeEntity(_0xda5727){return function(_0x4b07d3){if(_0x4b07d3){return _0x4b07d3['destroy']()[_0x325c('0x14')](function(){_0xda5727[_0x325c('0xb')](0xcc)[_0x325c('0xc')]();});}};}function handleEntityNotFound(_0x372155){return function(_0xb1f22f){if(!_0xb1f22f){_0x372155[_0x325c('0x15')](0x194);}return _0xb1f22f;};}function handleError(_0x3de9fa,_0x5dfbde){_0x5dfbde=_0x5dfbde||0x1f4;return function(_0x396e7c){logger[_0x325c('0x16')](_0x396e7c['stack']);if(_0x396e7c[_0x325c('0x17')]){delete _0x396e7c[_0x325c('0x17')];}_0x3de9fa[_0x325c('0xb')](_0x5dfbde)[_0x325c('0x18')](_0x396e7c);};}function maskClientSecret(_0x3c458f){return _['padEnd'](_0x3c458f['slice'](0x0,0x3),0x14,'*');}exports[_0x325c('0x19')]=function(_0x326d69,_0x5a741b){var _0x3d28a5={},_0x184841={},_0x599936={'count':0x0,'rows':[]};var _0x5777eb=_['map'](db[_0x325c('0x1a')][_0x325c('0x1b')],function(_0x40485c){return{'name':_0x40485c[_0x325c('0x1c')],'type':_0x40485c['type'][_0x325c('0x1d')]};});_0x184841[_0x325c('0x1e')]=_[_0x325c('0x1f')](_0x5777eb,_0x325c('0x17'));_0x184841[_0x325c('0x20')]=_['keys'](_0x326d69[_0x325c('0x20')]);_0x184841[_0x325c('0x21')]=_[_0x325c('0x22')](_0x184841[_0x325c('0x1e')],_0x184841['query']);_0x3d28a5['attributes']=_[_0x325c('0x22')](_0x184841[_0x325c('0x1e')],qs[_0x325c('0x23')](_0x326d69[_0x325c('0x20')]['fields']));_0x3d28a5['attributes']=_0x3d28a5['attributes']['length']?_0x3d28a5[_0x325c('0x24')]:_0x184841[_0x325c('0x1e')];if(!_0x326d69[_0x325c('0x20')]['hasOwnProperty']('nolimit')){_0x3d28a5[_0x325c('0x10')]=qs['limit'](_0x326d69['query']['limit']);_0x3d28a5[_0x325c('0xe')]=qs[_0x325c('0xe')](_0x326d69[_0x325c('0x20')][_0x325c('0xe')]);}_0x3d28a5[_0x325c('0x25')]=qs[_0x325c('0x26')](_0x326d69[_0x325c('0x20')]['sort']);_0x3d28a5[_0x325c('0x27')]=qs[_0x325c('0x21')](_[_0x325c('0x28')](_0x326d69['query'],_0x184841['filters']),_0x5777eb);if(_0x326d69[_0x325c('0x20')][_0x325c('0x29')]){_0x3d28a5[_0x325c('0x27')]=_[_0x325c('0x2a')](_0x3d28a5['where'],{'$or':_[_0x325c('0x1f')](_0x5777eb,function(_0x1449b8){if(_0x1449b8[_0x325c('0x2b')]!==_0x325c('0x2c')){var _0x4313ff={};_0x4313ff[_0x1449b8[_0x325c('0x17')]]={'$like':'%'+_0x326d69['query'][_0x325c('0x29')]+'%'};return _0x4313ff;}})});}_0x3d28a5=_[_0x325c('0x2a')]({},_0x3d28a5,_0x326d69['options']);var _0x676cfe={'where':_0x3d28a5[_0x325c('0x27')]};return db[_0x325c('0x1a')][_0x325c('0x11')](_0x676cfe)[_0x325c('0x14')](function(_0x4c4c1c){_0x599936[_0x325c('0x11')]=_0x4c4c1c;if(_0x326d69['query']['includeAll']){_0x3d28a5[_0x325c('0x2d')]=[{'all':!![]}];}return db[_0x325c('0x1a')][_0x325c('0x2e')](_0x3d28a5);})['then'](function(_0x2b6c3a){_0x599936[_0x325c('0x2f')]=_['map'](_0x2b6c3a,function(_0x3b259e){if(_0x3b259e['service']===_0x325c('0x30')){var _0x1cb6f0=encryptor['decryptString'](_0x3b259e[_0x325c('0x31')]);_0x3b259e[_0x325c('0x31')]=maskClientSecret(_0x1cb6f0);}return _0x3b259e;});return _0x599936;})[_0x325c('0x14')](respondWithFilteredResult(_0x5a741b,_0x3d28a5))[_0x325c('0x32')](handleError(_0x5a741b,null));};exports[_0x325c('0x33')]=function(_0x15fe82,_0x561080){var _0x48f9c3={'raw':!![],'where':{'id':_0x15fe82[_0x325c('0x34')]['id']}},_0x45b72b={};_0x45b72b[_0x325c('0x1e')]=_['keys'](db[_0x325c('0x1a')][_0x325c('0x1b')]);_0x45b72b[_0x325c('0x20')]=_[_0x325c('0x35')](_0x15fe82[_0x325c('0x20')]);_0x45b72b['filters']=_[_0x325c('0x22')](_0x45b72b[_0x325c('0x1e')],_0x45b72b[_0x325c('0x20')]);_0x48f9c3['attributes']=_[_0x325c('0x22')](_0x45b72b[_0x325c('0x1e')],qs[_0x325c('0x23')](_0x15fe82[_0x325c('0x20')][_0x325c('0x23')]));_0x48f9c3[_0x325c('0x24')]=_0x48f9c3[_0x325c('0x24')][_0x325c('0x36')]?_0x48f9c3[_0x325c('0x24')]:_0x45b72b[_0x325c('0x1e')];if(_0x15fe82[_0x325c('0x20')][_0x325c('0x37')]){_0x48f9c3[_0x325c('0x2d')]=[{'all':!![]}];}_0x48f9c3=_[_0x325c('0x2a')]({},_0x48f9c3,_0x15fe82[_0x325c('0x38')]);return db[_0x325c('0x1a')]['find'](_0x48f9c3)['then'](handleEntityNotFound(_0x561080,null))[_0x325c('0x14')](function(_0xa4f6b5){if(_0xa4f6b5[_0x325c('0x39')]===_0x325c('0x30')){var _0x5def82=encryptor[_0x325c('0x3a')](_0xa4f6b5[_0x325c('0x31')]);_0xa4f6b5[_0x325c('0x31')]=maskClientSecret(_0x5def82);}return _0xa4f6b5;})[_0x325c('0x14')](respondWithResult(_0x561080,null))[_0x325c('0x32')](handleError(_0x561080,null));};exports[_0x325c('0x3b')]=function(_0x2f4d7e,_0x5b9a09){if(!_0x2f4d7e[_0x325c('0x3c')][_0x325c('0x17')])throw new Error(_0x325c('0x3d'));if(!_0x2f4d7e['body'][_0x325c('0x39')])throw new Error('Service\x20parameter\x20not\x20specified');var _0xde6da0=db[_0x325c('0x1a')][_0x325c('0x1b')][_0x325c('0x39')][_0x325c('0x3e')];if(!_0xde6da0[_0x325c('0x3f')](_0x2f4d7e['body'][_0x325c('0x39')]))throw new Error(_0x325c('0x40')+_0xde6da0[_0x325c('0x41')](',\x20'));if(_0x2f4d7e[_0x325c('0x3c')][_0x325c('0x39')]===_0x325c('0x30')&&_0x2f4d7e[_0x325c('0x3c')]['data3']){_0x2f4d7e[_0x325c('0x3c')][_0x325c('0x31')]=encryptor[_0x325c('0x42')](_0x2f4d7e['body'][_0x325c('0x31')]);}return db[_0x325c('0x1a')]['create'](_0x2f4d7e[_0x325c('0x3c')],{})[_0x325c('0x14')](respondWithResult(_0x5b9a09,0xc9))['catch'](handleError(_0x5b9a09,null));};exports[_0x325c('0x13')]=function(_0x347958,_0x1a1489){if(_0x347958[_0x325c('0x3c')]['id']){delete _0x347958[_0x325c('0x3c')]['id'];}return db['CloudProvider'][_0x325c('0x43')]({'where':{'id':_0x347958[_0x325c('0x34')]['id']}})['then'](handleEntityNotFound(_0x1a1489,null))[_0x325c('0x14')](function(_0x2f9ead){if(_0x2f9ead[_0x325c('0x39')]===_0x325c('0x30')&&_0x347958[_0x325c('0x3c')][_0x325c('0x31')]){_0x347958[_0x325c('0x3c')][_0x325c('0x31')]=encryptor[_0x325c('0x42')](_0x347958['body'][_0x325c('0x31')]);}return _0x2f9ead;})[_0x325c('0x14')](saveUpdates(_0x347958['body'],null))[_0x325c('0x14')](respondWithResult(_0x1a1489,null))[_0x325c('0x32')](handleError(_0x1a1489,null));};exports['destroy']=function(_0x3cc348,_0x714bbd){return db['CloudProvider'][_0x325c('0x43')]({'where':{'id':_0x3cc348['params']['id']}})[_0x325c('0x14')](handleEntityNotFound(_0x714bbd,null))[_0x325c('0x14')](removeEntity(_0x714bbd,null))[_0x325c('0x32')](handleError(_0x714bbd,null));};exports['oauth2MicrosoftAuthorize']=function(_0x44ce46,_0x472666){return db['CloudProvider'][_0x325c('0x44')]({'where':{'id':_0x44ce46[_0x325c('0x34')]['id']},'raw':!![]})['then'](function(_0x183d75){if(!_0x183d75)return _0x472666['sendStatus'](0x194);return{'url':oauth[_0x325c('0x45')](_0x183d75,_0x44ce46[_0x325c('0x46')]['id'])};})[_0x325c('0x14')](respondWithResult(_0x472666,null))[_0x325c('0x32')](handleError(_0x472666,null));};exports[_0x325c('0x47')]=function(_0x46f619,_0xa4933c){var _0x518396=_0x46f619['body'];var _0x519c27;var _0x3b5fa7;if(_0x518396[_0x325c('0x16')])throw _0x518396;redis['get'](_0x518396[_0x325c('0x48')])[_0x325c('0x14')](function(_0x1289c1){if(!_0x1289c1)throw new Error(_0x325c('0x49'));_0x519c27=JSON[_0x325c('0x4a')](_0x1289c1);var _0x5e31ff=Buffer['from'](_0x518396[_0x325c('0x48')],_0x325c('0x4b'))[_0x325c('0x4c')](_0x325c('0x4d'));_0x3b5fa7=JSON[_0x325c('0x4a')](_0x5e31ff);if(!oauth[_0x325c('0x4e')](_0x518396[_0x325c('0x4f')],_0x519c27[_0x325c('0x50')]))throw new Error(_0x325c('0x51'));redis[_0x325c('0x52')](_0x518396[_0x325c('0x48')]);return oauth[_0x325c('0x53')](_0x518396[_0x325c('0x54')],_0x519c27);})[_0x325c('0x14')](function(_0x266a25){_0x519c27[_0x325c('0x55')]=_0x266a25[_0x325c('0x56')];_0x519c27[_0x325c('0x57')]=_0x266a25[_0x325c('0x58')];return db[_0x325c('0x1a')][_0x325c('0x13')]({'data5':_0x519c27[_0x325c('0x55')],'data6':_0x519c27[_0x325c('0x57')]},{'where':{'id':_0x519c27['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x519c27);socket['emit'](_0x325c('0x59'),{'id':_0x3b5fa7['id']});return;})[_0x325c('0x14')](respondWithStatusCode(_0xa4933c,null))[_0x325c('0x32')](function(_0x1b5de5){if(_0x3b5fa7){socket[_0x325c('0x5a')](_0x325c('0x5b'),{'id':_0x3b5fa7['id']});}if(!_0x519c27){logger[_0x325c('0x16')]('Invalid\x20authentication\x20state\x20parameter',_0x1b5de5);return _0xa4933c[_0x325c('0xb')](0x1f4)[_0x325c('0x18')](_0x1b5de5['message']);}logger['error'](_0x325c('0x5c'),_0x519c27['id'],JSON[_0x325c('0x5d')](_0x1b5de5));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index ba92521..1e26266 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 _0x2e98=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','define'];(function(_0x6d8384,_0x31ccaf){var _0x59dac7=function(_0x442093){while(--_0x442093){_0x6d8384['push'](_0x6d8384['shift']());}};_0x59dac7(++_0x31ccaf);}(_0x2e98,0x8c));var _0x82e9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2e98[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x82e9('0x0'))(_0x82e9('0x1'));var moment=require(_0x82e9('0x2'));var BPromise=require(_0x82e9('0x3'));var rp=require(_0x82e9('0x4'));var fs=require('fs');var path=require(_0x82e9('0x5'));var rimraf=require('rimraf');var config=require(_0x82e9('0x6'));var attributes=require(_0x82e9('0x7'));module[_0x82e9('0x8')]=function(_0x37e969,_0x7249e2){return _0x37e969[_0x82e9('0x9')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x096a=['../../config/environment','./cloudProvider.attributes','exports','cloud_providers','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x096a,0x1b2));var _0xa096=function(_0x51235c,_0x310731){_0x51235c=_0x51235c-0x0;var _0x43d852=_0x096a[_0x51235c];return _0x43d852;};'use strict';var _=require(_0xa096('0x0'));var util=require('util');var logger=require(_0xa096('0x1'))(_0xa096('0x2'));var moment=require('moment');var BPromise=require(_0xa096('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa096('0x4'));var rimraf=require(_0xa096('0x5'));var config=require(_0xa096('0x6'));var attributes=require(_0xa096('0x7'));module[_0xa096('0x8')]=function(_0x14f3c1,_0x5a9350){return _0x14f3c1['define']('CloudProvider',attributes,{'tableName':_0xa096('0x9'),'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 29b5e0d..e00e158 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 _0x1663=['then','refresh_token','data6','POST','data5','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','data4','decryptString','intervals','findAll','all','inspect','error','jsonwebtoken','moment','request-promise','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','map','type','Dynamics365','push','/.default','join','Outlook365','data7','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','data1','redirect_uri','response_mode','form_post','state','nonce','prompt','key','value','oauth2Claims','replace','oauth2/','set','iss','issuer','aud','audience','isAfter','unix','exp','resolve','data3','CloudProvider'];(function(_0x5020fa,_0x2c6b89){var _0x5f0706=function(_0x94da7b){while(--_0x94da7b){_0x5020fa['push'](_0x5020fa['shift']());}};_0x5f0706(++_0x2c6b89);}(_0x1663,0xa2));var _0x3166=function(_0x333151,_0x347994){_0x333151=_0x333151-0x0;var _0x52ead1=_0x1663[_0x333151];return _0x52ead1;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x3166('0x0'));var moment=require(_0x3166('0x1'));var Redis=require('ioredis');var rp=require(_0x3166('0x2'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require(_0x3166('0x3'));var logger=require(_0x3166('0x4'))(_0x3166('0x5'));var schedule=require(_0x3166('0x6'));var db=require(_0x3166('0x7'))['db'];config[_0x3166('0x8')]=_['defaults'](config[_0x3166('0x8')],{'host':_0x3166('0x9'),'port':0x18eb});var redis=new Redis(config[_0x3166('0x8')]);var MICROSOFT_AUTH_URL=_0x3166('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x3166('0xb'),'profile',_0x3166('0xc'),_0x3166('0xd'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x3166('0xe'),_0x3166('0xf')],'Dynamics365':[_0x3166('0xb'),_0x3166('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0x3166('0x10');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1cf199){var _0x46a4a2=_[_0x3166('0x11')](AZURE_AUTH_SCOPES[_0x1cf199[_0x3166('0x12')]]);if(_0x1cf199[_0x3166('0x12')]===_0x3166('0x13'))_0x46a4a2[_0x3166('0x14')](_0x1cf199['data7']+_0x3166('0x15'));return _0x46a4a2[_0x3166('0x16')]('\x20');}function getAccessTokenScope(_0x161c9b){if(_0x161c9b[_0x3166('0x12')]===_0x3166('0x17'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x161c9b['type']==='Dynamics365')return _0x161c9b[_0x3166('0x18')]+_0x3166('0x15');}function generateMicrosoftAuthorizationUrl(_0x2e1fed,_0x1fc373){var _0x17ba06=MICROSOFT_AUTH_URL['replace'](_0x3166('0x19'),_0x2e1fed[_0x3166('0x1a')]);var _0x41df46=[_0x3166('0x1b'),_0x3166('0x1c')];var _0x52a160=Buffer[_0x3166('0x1d')](JSON[_0x3166('0x1e')]({'id':_0x1fc373}))[_0x3166('0x1f')](_0x3166('0x20'));var _0x293e2e=crypto[_0x3166('0x21')](0x10)[_0x3166('0x1f')]('hex');var _0x1bc29c=getAuthorizationScopes(_0x2e1fed);var _0xcae2f8=[{'key':'client_id','value':_0x2e1fed[_0x3166('0x22')]},{'key':'response_type','value':encodeURIComponent(_0x41df46[_0x3166('0x16')]('\x20'))},{'key':_0x3166('0x23'),'value':_0x2e1fed['data4']},{'key':_0x3166('0x24'),'value':_0x3166('0x25')},{'key':'scope','value':encodeURIComponent(_0x1bc29c)},{'key':_0x3166('0x26'),'value':_0x52a160},{'key':_0x3166('0x27'),'value':_0x293e2e},{'key':_0x3166('0x28'),'value':'login'}];var _0x4c975d=_0x17ba06+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x3166('0x11')](_0xcae2f8,function(_0x43fee7){return _0x43fee7[_0x3166('0x29')]+'='+_0x43fee7[_0x3166('0x2a')];})[_0x3166('0x16')]('&');_0x2e1fed[_0x3166('0x2b')]={'issuer':_0x17ba06[_0x3166('0x2c')](_0x3166('0x2d'),''),'audience':_0x2e1fed[_0x3166('0x22')],'state':_0x52a160,'nonce':_0x293e2e};redis[_0x3166('0x2e')](_0x52a160,JSON[_0x3166('0x1e')](_0x2e1fed));return _0x4c975d;}function isValidIdToken(_0x22e705,_0x1a1450){try{var _0x3373af=jwt['decode'](_0x22e705,{'complete':!![]});var _0x5a33c6=_0x3373af['payload'];if(_0x5a33c6[_0x3166('0x2f')]!==_0x1a1450[_0x3166('0x30')])return![];if(_0x5a33c6[_0x3166('0x31')]!==_0x1a1450[_0x3166('0x32')])return![];if(_0x5a33c6[_0x3166('0x27')]!==_0x1a1450[_0x3166('0x27')])return![];if(moment()[_0x3166('0x33')](moment[_0x3166('0x34')](_0x5a33c6[_0x3166('0x35')])))return![];return!![];}catch(_0x453afa){throw _0x453afa;}}function refreshOauth2MicrosoftAccessToken(_0x4ca94d){return Promise[_0x3166('0x36')]()['then'](function(){if(_0x4ca94d[_0x3166('0x37')])return _0x4ca94d;return db[_0x3166('0x38')]['findOne']({'where':{'id':_0x4ca94d['id']},'raw':!![]});})[_0x3166('0x39')](function(_0x40036f){var _0x12acb7={'grant_type':_0x3166('0x3a'),'refresh_token':_0x40036f[_0x3166('0x3b')],'scope':getAccessTokenScope(_0x40036f),'redirect_uri':_0x40036f['data4'],'client_id':_0x40036f[_0x3166('0x22')],'client_secret':encryptor['decryptString'](_0x40036f['data3'])};var _0x306f0a={'method':_0x3166('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x3166('0x2c')]('{TENANT_ID}',_0x40036f['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x12acb7,'json':!![]};return rp(_0x306f0a);})[_0x3166('0x39')](function(_0x43250a){_0x4ca94d[_0x3166('0x3d')]=_0x43250a[_0x3166('0x3e')];_0x4ca94d[_0x3166('0x3b')]=_0x43250a[_0x3166('0x3a')];return db[_0x3166('0x38')][_0x3166('0x3f')]({'data5':_0x4ca94d[_0x3166('0x3d')],'data6':_0x4ca94d[_0x3166('0x3b')]},{'where':{'id':_0x4ca94d['id']}});})[_0x3166('0x39')](function(){return _0x4ca94d;})[_0x3166('0x40')](function(_0x571ce3){logger['error'](_0x3166('0x41'),_0x4ca94d['id'],_0x571ce3);});}function getOauth2MicrosoftAccessToken(_0x1d4e37,_0x58fec0){var _0x30cbab={'grant_type':'authorization_code','code':_0x1d4e37,'scope':getAccessTokenScope(_0x58fec0),'redirect_uri':_0x58fec0[_0x3166('0x42')],'client_id':_0x58fec0[_0x3166('0x22')],'client_secret':encryptor[_0x3166('0x43')](_0x58fec0[_0x3166('0x37')])};var _0x42bc91={'method':_0x3166('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x3166('0x2c')](_0x3166('0x19'),_0x58fec0[_0x3166('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x30cbab,'json':!![]};return rp(_0x42bc91);}function startRefreshInterval(_0x30b44c){var _0x3c4505=schedule['intervals'];if(_0x3c4505[_0x30b44c['id']])clearInterval(_0x3c4505[_0x30b44c['id']]);_0x3c4505[_0x30b44c['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x30b44c['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x3166('0x44')]=_0x3c4505;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x3166('0x45')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x597cd0){var _0x5dd612=_0x597cd0[_0x3166('0x11')](function(_0x4acf91){return refreshOauth2MicrosoftAccessToken(_0x4acf91)['then'](function(_0x520d5a){startRefreshInterval(_0x520d5a);});});return Promise[_0x3166('0x46')](_0x5dd612);})[_0x3166('0x40')](function(_0x3017bb){var _0x5ed9b4=_0x3017bb?util[_0x3166('0x47')](_0x3017bb,{'showHidden':![],'depth':null}):'';logger[_0x3166('0x48')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x5ed9b4);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xb222=['util','../../config/logger','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','offline_access','/authorize','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','id_token','from','stringify','toString','base64','hex','client_id','response_type','redirect_uri','data4','response_mode','form_post','scope','nonce','prompt','login','key','value','oauth2/','data1','set','decode','payload','iss','issuer','aud','audience','isAfter','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','catch','error','authorization_code','intervals','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise'];(function(_0x9f27ef,_0xf53771){var _0x5ed282=function(_0x1fb91a){while(--_0x1fb91a){_0x9f27ef['push'](_0x9f27ef['shift']());}};_0x5ed282(++_0xf53771);}(_0xb222,0xe4));var _0x2b22=function(_0x1707af,_0x17ab07){_0x1707af=_0x1707af-0x0;var _0x44b17c=_0xb222[_0x1707af];return _0x44b17c;};'use strict';var _=require(_0x2b22('0x0'));var crypto=require(_0x2b22('0x1'));var jwt=require(_0x2b22('0x2'));var moment=require(_0x2b22('0x3'));var Redis=require(_0x2b22('0x4'));var rp=require(_0x2b22('0x5'));var util=require(_0x2b22('0x6'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x2b22('0x7'))('api');var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x2b22('0x8'))['db'];config[_0x2b22('0x9')]=_[_0x2b22('0xa')](config[_0x2b22('0x9')],{'host':_0x2b22('0xb'),'port':0x18eb});var redis=new Redis(config[_0x2b22('0x9')]);var MICROSOFT_AUTH_URL=_0x2b22('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x2b22('0xd'),_0x2b22('0xe'),_0x2b22('0xf'),'offline_access',_0x2b22('0x10'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x2b22('0xd'),_0x2b22('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x2b22('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2d878d){var _0x4d5bcc=_[_0x2b22('0x13')](AZURE_AUTH_SCOPES[_0x2d878d[_0x2b22('0x14')]]);if(_0x2d878d[_0x2b22('0x14')]===_0x2b22('0x15'))_0x4d5bcc[_0x2b22('0x16')](_0x2d878d[_0x2b22('0x17')]+_0x2b22('0x18'));return _0x4d5bcc[_0x2b22('0x19')]('\x20');}function getAccessTokenScope(_0x12b246){if(_0x12b246[_0x2b22('0x14')]===_0x2b22('0x1a'))return _0x2b22('0x10');if(_0x12b246['type']===_0x2b22('0x15'))return _0x12b246[_0x2b22('0x17')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x2dad0e,_0x4cb62e){var _0x2cc364=MICROSOFT_AUTH_URL[_0x2b22('0x1b')](_0x2b22('0x1c'),_0x2dad0e[_0x2b22('0x1d')]);var _0x517fe3=['code',_0x2b22('0x1e')];var _0x1f85ba=Buffer[_0x2b22('0x1f')](JSON[_0x2b22('0x20')]({'id':_0x4cb62e}))[_0x2b22('0x21')](_0x2b22('0x22'));var _0x2e9040=crypto['randomBytes'](0x10)[_0x2b22('0x21')](_0x2b22('0x23'));var _0x4c5c4d=getAuthorizationScopes(_0x2dad0e);var _0x306f49=[{'key':_0x2b22('0x24'),'value':_0x2dad0e['data1']},{'key':_0x2b22('0x25'),'value':encodeURIComponent(_0x517fe3[_0x2b22('0x19')]('\x20'))},{'key':_0x2b22('0x26'),'value':_0x2dad0e[_0x2b22('0x27')]},{'key':_0x2b22('0x28'),'value':_0x2b22('0x29')},{'key':_0x2b22('0x2a'),'value':encodeURIComponent(_0x4c5c4d)},{'key':'state','value':_0x1f85ba},{'key':_0x2b22('0x2b'),'value':_0x2e9040},{'key':_0x2b22('0x2c'),'value':_0x2b22('0x2d')}];var _0x53d5c9=_0x2cc364+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x2b22('0x13')](_0x306f49,function(_0x4e07ec){return _0x4e07ec[_0x2b22('0x2e')]+'='+_0x4e07ec[_0x2b22('0x2f')];})[_0x2b22('0x19')]('&');_0x2dad0e['oauth2Claims']={'issuer':_0x2cc364['replace'](_0x2b22('0x30'),''),'audience':_0x2dad0e[_0x2b22('0x31')],'state':_0x1f85ba,'nonce':_0x2e9040};redis[_0x2b22('0x32')](_0x1f85ba,JSON[_0x2b22('0x20')](_0x2dad0e));return _0x53d5c9;}function isValidIdToken(_0x38f73e,_0x499db2){try{var _0x47a939=jwt[_0x2b22('0x33')](_0x38f73e,{'complete':!![]});var _0x19dc22=_0x47a939[_0x2b22('0x34')];if(_0x19dc22[_0x2b22('0x35')]!==_0x499db2[_0x2b22('0x36')])return![];if(_0x19dc22[_0x2b22('0x37')]!==_0x499db2[_0x2b22('0x38')])return![];if(_0x19dc22[_0x2b22('0x2b')]!==_0x499db2['nonce'])return![];if(moment()[_0x2b22('0x39')](moment['unix'](_0x19dc22[_0x2b22('0x3a')])))return![];return!![];}catch(_0x533d3a){throw _0x533d3a;}}function refreshOauth2MicrosoftAccessToken(_0xf08860){return Promise[_0x2b22('0x3b')]()[_0x2b22('0x3c')](function(){if(_0xf08860[_0x2b22('0x3d')])return _0xf08860;return db[_0x2b22('0x3e')][_0x2b22('0x3f')]({'where':{'id':_0xf08860['id']},'raw':!![]});})[_0x2b22('0x3c')](function(_0x12ab20){var _0xf45e62={'grant_type':_0x2b22('0x40'),'refresh_token':_0x12ab20[_0x2b22('0x41')],'scope':getAccessTokenScope(_0x12ab20),'redirect_uri':_0x12ab20[_0x2b22('0x27')],'client_id':_0x12ab20['data1'],'client_secret':encryptor[_0x2b22('0x42')](_0x12ab20[_0x2b22('0x3d')])};var _0x1b41f5={'method':_0x2b22('0x43'),'uri':MICROSOFT_AUTH_URL[_0x2b22('0x1b')](_0x2b22('0x1c'),_0x12ab20['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xf45e62,'json':!![]};return rp(_0x1b41f5);})[_0x2b22('0x3c')](function(_0x33efa6){_0xf08860[_0x2b22('0x44')]=_0x33efa6[_0x2b22('0x45')];_0xf08860[_0x2b22('0x41')]=_0x33efa6[_0x2b22('0x40')];return db[_0x2b22('0x3e')][_0x2b22('0x46')]({'data5':_0xf08860[_0x2b22('0x44')],'data6':_0xf08860[_0x2b22('0x41')]},{'where':{'id':_0xf08860['id']}});})['then'](function(){return _0xf08860;})[_0x2b22('0x47')](function(_0x20a85a){logger[_0x2b22('0x48')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0xf08860['id'],_0x20a85a);});}function getOauth2MicrosoftAccessToken(_0x1e2162,_0x3a8af5){var _0x227e0b={'grant_type':_0x2b22('0x49'),'code':_0x1e2162,'scope':getAccessTokenScope(_0x3a8af5),'redirect_uri':_0x3a8af5['data4'],'client_id':_0x3a8af5[_0x2b22('0x31')],'client_secret':encryptor[_0x2b22('0x42')](_0x3a8af5[_0x2b22('0x3d')])};var _0x2b04a1={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x2b22('0x1b')](_0x2b22('0x1c'),_0x3a8af5['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x227e0b,'json':!![]};return rp(_0x2b04a1);}function startRefreshInterval(_0x15f24d){var _0x4e6e2d=schedule[_0x2b22('0x4a')];if(_0x4e6e2d[_0x15f24d['id']])clearInterval(_0x4e6e2d[_0x15f24d['id']]);_0x4e6e2d[_0x15f24d['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x15f24d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x2b22('0x4a')]=_0x4e6e2d;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x2b22('0x3c')](function(_0x179feb){var _0x569ae2=_0x179feb[_0x2b22('0x13')](function(_0x3fa54c){return refreshOauth2MicrosoftAccessToken(_0x3fa54c)['then'](function(_0x12bbf5){startRefreshInterval(_0x12bbf5);});});return Promise[_0x2b22('0x4b')](_0x569ae2);})[_0x2b22('0x47')](function(_0x145c96){var _0x2bedde=_0x145c96?util['inspect'](_0x145c96,{'showHidden':![],'depth':null}):'';logger[_0x2b22('0x48')](_0x2b22('0x4c'),_0x2bedde);});}module[_0x2b22('0x4d')]={'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 d115c40..2351bdc 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 _0xba6f=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CloudProvider,\x20%s,\x20%s','request\x20sent'];(function(_0x57db2b,_0x21397e){var _0x381abb=function(_0x210534){while(--_0x210534){_0x57db2b['push'](_0x57db2b['shift']());}};_0x381abb(++_0x21397e);}(_0xba6f,0x1d0));var _0xfba6=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0xba6f[_0x23f8c8];return _0x3dc718;};'use strict';var _=require(_0xfba6('0x0'));var util=require('util');var moment=require(_0xfba6('0x1'));var BPromise=require(_0xfba6('0x2'));var rs=require(_0xfba6('0x3'));var fs=require('fs');var Redis=require(_0xfba6('0x4'));var db=require(_0xfba6('0x5'))['db'];var utils=require(_0xfba6('0x6'));var logger=require(_0xfba6('0x7'))(_0xfba6('0x8'));var config=require(_0xfba6('0x9'));var jayson=require(_0xfba6('0xa'));var client=jayson[_0xfba6('0xb')][_0xfba6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x99e213,_0x5d86c3,_0x1b3c5c){return new BPromise(function(_0x2bd0e6,_0x4dd2a2){return client['request'](_0x99e213,_0x1b3c5c)['then'](function(_0x3effea){logger[_0xfba6('0xd')](_0xfba6('0xe'),_0x5d86c3,_0xfba6('0xf'));logger[_0xfba6('0x10')](_0xfba6('0x11'),_0x5d86c3,_0xfba6('0xf'),JSON[_0xfba6('0x12')](_0x3effea));if(_0x3effea[_0xfba6('0x13')]){if(_0x3effea[_0xfba6('0x13')][_0xfba6('0x14')]===0x1f4){logger['error'](_0xfba6('0xe'),_0x5d86c3,_0x3effea[_0xfba6('0x13')][_0xfba6('0x15')]);return _0x4dd2a2(_0x3effea[_0xfba6('0x13')]['message']);}logger[_0xfba6('0x13')]('CloudProvider,\x20%s,\x20%s',_0x5d86c3,_0x3effea['error'][_0xfba6('0x15')]);return _0x2bd0e6(_0x3effea[_0xfba6('0x13')][_0xfba6('0x15')]);}else{logger[_0xfba6('0xd')](_0xfba6('0xe'),_0x5d86c3,_0xfba6('0xf'));_0x2bd0e6(_0x3effea[_0xfba6('0x16')][_0xfba6('0x15')]);}})[_0xfba6('0x17')](function(_0x228add){logger[_0xfba6('0x13')](_0xfba6('0xe'),_0x5d86c3,_0x228add);_0x4dd2a2(_0x228add);});});} \ No newline at end of file +var _0xb4f4=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x78d8b4,_0x1c9824){var _0x49b14a=function(_0x3f5d35){while(--_0x3f5d35){_0x78d8b4['push'](_0x78d8b4['shift']());}};_0x49b14a(++_0x1c9824);}(_0xb4f4,0xda));var _0x4b4f=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xb4f4[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0x4b4f('0x0'));var util=require(_0x4b4f('0x1'));var moment=require('moment');var BPromise=require(_0x4b4f('0x2'));var rs=require(_0x4b4f('0x3'));var fs=require('fs');var Redis=require(_0x4b4f('0x4'));var db=require(_0x4b4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b4f('0x6'))(_0x4b4f('0x7'));var config=require(_0x4b4f('0x8'));var jayson=require(_0x4b4f('0x9'));var client=jayson[_0x4b4f('0xa')][_0x4b4f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x405321,_0x58c1e5,_0x5ba9b0){return new BPromise(function(_0x108b4e,_0x2c647f){return client[_0x4b4f('0xc')](_0x405321,_0x5ba9b0)[_0x4b4f('0xd')](function(_0x25e0c9){logger['info'](_0x4b4f('0xe'),_0x58c1e5,_0x4b4f('0xf'));logger[_0x4b4f('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x58c1e5,_0x4b4f('0xf'),JSON[_0x4b4f('0x11')](_0x25e0c9));if(_0x25e0c9['error']){if(_0x25e0c9[_0x4b4f('0x12')][_0x4b4f('0x13')]===0x1f4){logger[_0x4b4f('0x12')](_0x4b4f('0xe'),_0x58c1e5,_0x25e0c9[_0x4b4f('0x12')][_0x4b4f('0x14')]);return _0x2c647f(_0x25e0c9[_0x4b4f('0x12')][_0x4b4f('0x14')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x58c1e5,_0x25e0c9[_0x4b4f('0x12')][_0x4b4f('0x14')]);return _0x108b4e(_0x25e0c9['error'][_0x4b4f('0x14')]);}else{logger[_0x4b4f('0x15')](_0x4b4f('0xe'),_0x58c1e5,'request\x20sent');_0x108b4e(_0x25e0c9[_0x4b4f('0x16')][_0x4b4f('0x14')]);}})[_0x4b4f('0x17')](function(_0x57d09a){logger[_0x4b4f('0x12')](_0x4b4f('0xe'),_0x58c1e5,_0x57d09a);_0x2c647f(_0x57d09a);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 8dfb7b5..8bd1d85 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 _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x214cdf,_0x458085){var _0x232d5b=function(_0x1546d8){while(--_0x1546d8){_0x214cdf['push'](_0x214cdf['shift']());}};_0x232d5b(++_0x458085);}(_0x2ef3,0xba));var _0x32ef=function(_0x5bc03d,_0x274ed1){_0x5bc03d=_0x5bc03d-0x0;var _0x30285d=_0x2ef3[_0x5bc03d];return _0x30285d;};'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['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=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(_0x2534cf,_0x545be6){var _0x221461=function(_0x379e83){while(--_0x379e83){_0x2534cf['push'](_0x2534cf['shift']());}};_0x221461(++_0x545be6);}(_0x1261,0x144));var _0x1126=function(_0x2effa6,_0x1440d7){_0x2effa6=_0x2effa6-0x0;var _0x226598=_0x1261[_0x2effa6];return _0x226598;};'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 8366015..e111d6a 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 _0x4829=['name','exports','STRING'];(function(_0x4291c8,_0x496c13){var _0x40ee75=function(_0x3ac215){while(--_0x3ac215){_0x4291c8['push'](_0x4291c8['shift']());}};_0x40ee75(++_0x496c13);}(_0x4829,0xcd));var _0x9482=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x4829[_0x3d4876];return _0x58ca9d;};'use strict';var Sequelize=require('sequelize');module[_0x9482('0x0')]={'name':{'type':Sequelize[_0x9482('0x1')],'unique':_0x9482('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9482('0x1')]},'companyId':{'type':Sequelize[_0x9482('0x1')]},'website':{'type':Sequelize[_0x9482('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9482('0x1')]},'type':{'type':Sequelize[_0x9482('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9482('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9482('0x1')]},'email':{'type':Sequelize[_0x9482('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9482('0x1')]},'sStreet':{'type':Sequelize[_0x9482('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x9482('0x1')]},'sCountry':{'type':Sequelize[_0x9482('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7a30=['sequelize','exports','STRING','name'];(function(_0xb03c1c,_0x2f98ed){var _0x507e93=function(_0xbb4f3f){while(--_0xbb4f3f){_0xb03c1c['push'](_0xb03c1c['shift']());}};_0x507e93(++_0x2f98ed);}(_0x7a30,0x8c));var _0x07a3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7a30[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x07a3('0x0'));module[_0x07a3('0x1')]={'name':{'type':Sequelize[_0x07a3('0x2')],'unique':_0x07a3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x07a3('0x2')]},'companyId':{'type':Sequelize[_0x07a3('0x2')]},'website':{'type':Sequelize[_0x07a3('0x2')]},'phone':{'type':Sequelize[_0x07a3('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x07a3('0x2')]},'street':{'type':Sequelize[_0x07a3('0x2')]},'postalCode':{'type':Sequelize[_0x07a3('0x2')]},'city':{'type':Sequelize[_0x07a3('0x2')]},'country':{'type':Sequelize[_0x07a3('0x2')]},'email':{'type':Sequelize[_0x07a3('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x07a3('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x07a3('0x2')]},'sCity':{'type':Sequelize[_0x07a3('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x07a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 6c5dc03..2b5b190 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 _0x6f8f=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Companies','error','stack','name','send','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','merge','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','addContacts','ids','omit','getContacts','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0x6f8f,0x90));var _0xf6f8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f8f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf6f8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf6f8('0x1'));var rp=require(_0xf6f8('0x2'));var moment=require(_0xf6f8('0x3'));var BPromise=require(_0xf6f8('0x4'));var Mustache=require(_0xf6f8('0x5'));var util=require(_0xf6f8('0x6'));var path=require(_0xf6f8('0x7'));var sox=require(_0xf6f8('0x8'));var csv=require('to-csv');var ejs=require(_0xf6f8('0x9'));var fs=require('fs');var fs_extra=require(_0xf6f8('0xa'));var _=require(_0xf6f8('0xb'));var squel=require(_0xf6f8('0xc'));var crypto=require('crypto');var jsforce=require(_0xf6f8('0xd'));var deskjs=require(_0xf6f8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf6f8('0xf'));var Papa=require(_0xf6f8('0x10'));var Redis=require(_0xf6f8('0x11'));var authService=require(_0xf6f8('0x12'));var qs=require(_0xf6f8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6f8('0x14'));var logger=require(_0xf6f8('0x15'))(_0xf6f8('0x16'));var utils=require('../../config/utils');var config=require(_0xf6f8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e6ca0,_0x556b93){_0x556b93=_0x556b93||0xcc;return function(_0x42d711){if(_0x42d711){return _0x2e6ca0['sendStatus'](_0x556b93);}return _0x2e6ca0[_0xf6f8('0x18')](_0x556b93)[_0xf6f8('0x19')]();};}function respondWithResult(_0x213998,_0x2e6ae2){_0x2e6ae2=_0x2e6ae2||0xc8;return function(_0x5a71d3){if(_0x5a71d3){return _0x213998[_0xf6f8('0x18')](_0x2e6ae2)[_0xf6f8('0x1a')](_0x5a71d3);}};}function respondWithFilteredResult(_0x3f9b6b,_0x19b107){return function(_0x2dadf0){if(_0x2dadf0){var _0x19ef31=typeof _0x19b107[_0xf6f8('0x1b')]===_0xf6f8('0x1c')&&typeof _0x19b107[_0xf6f8('0x1d')]===_0xf6f8('0x1c');var _0x16dc05=_0x2dadf0[_0xf6f8('0x1e')];var _0x15cf16=_0x19ef31?0x0:_0x19b107[_0xf6f8('0x1b')];var _0x4310fe=_0x19ef31?_0x2dadf0[_0xf6f8('0x1e')]:_0x19b107[_0xf6f8('0x1b')]+_0x19b107['limit'];var _0x4b9752;if(_0x4310fe>=_0x16dc05){_0x4310fe=_0x16dc05;_0x4b9752=0xc8;}else{_0x4b9752=0xce;}_0x3f9b6b['status'](_0x4b9752);return _0x3f9b6b[_0xf6f8('0x1f')](_0xf6f8('0x20'),_0x15cf16+'-'+_0x4310fe+'/'+_0x16dc05)[_0xf6f8('0x1a')](_0x2dadf0);}return null;};}function patchUpdates(_0x30b27e){return function(_0x4dea46){try{jsonpatch[_0xf6f8('0x21')](_0x4dea46,_0x30b27e,!![]);}catch(_0x145dc4){return BPromise[_0xf6f8('0x22')](_0x145dc4);}return _0x4dea46[_0xf6f8('0x23')]();};}function saveUpdates(_0x17acbe,_0x1aa550){return function(_0x3b6a39){if(_0x3b6a39){return _0x3b6a39[_0xf6f8('0x24')](_0x17acbe)['then'](function(_0x238627){return _0x238627;});}return null;};}function removeEntity(_0x3eea5d,_0x3f6721){return function(_0x5a4c9c){if(_0x5a4c9c){return _0x5a4c9c[_0xf6f8('0x25')]()[_0xf6f8('0x26')](function(){var _0x2de292=_0x5a4c9c[_0xf6f8('0x27')]({'plain':!![]});var _0x2e0144=_0xf6f8('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e0144,'resourceId':_0x2de292['id']}})[_0xf6f8('0x26')](function(){return _0x5a4c9c;});})[_0xf6f8('0x26')](function(){_0x3eea5d['status'](0xcc)[_0xf6f8('0x19')]();});}};}function handleEntityNotFound(_0x4f1a62,_0x36c8d9){return function(_0x52647a){if(!_0x52647a){_0x4f1a62['sendStatus'](0x194);}return _0x52647a;};}function handleError(_0x3e3fb7,_0x59ca24){_0x59ca24=_0x59ca24||0x1f4;return function(_0x20d7c1){logger[_0xf6f8('0x29')](_0x20d7c1[_0xf6f8('0x2a')]);if(_0x20d7c1['name']){delete _0x20d7c1[_0xf6f8('0x2b')];}_0x3e3fb7['status'](_0x59ca24)[_0xf6f8('0x2c')](_0x20d7c1);};}exports['index']=function(_0x183d35,_0x302fd3){var _0x5e6ae5={},_0x4af85b={},_0x1359da={'count':0x0,'rows':[]};return db['CmCompany'][_0xf6f8('0x2d')]()[_0xf6f8('0x26')](function(_0x125a9e){_0x4af85b[_0xf6f8('0x2e')]=_[_0xf6f8('0x2f')](_0x125a9e);_0x4af85b[_0xf6f8('0x30')]=_[_0xf6f8('0x2f')](_0x183d35[_0xf6f8('0x30')]);_0x4af85b[_0xf6f8('0x31')]=_[_0xf6f8('0x32')](_0x4af85b['model'],_0x4af85b[_0xf6f8('0x30')]);_0x5e6ae5[_0xf6f8('0x33')]=_[_0xf6f8('0x32')](_0x4af85b[_0xf6f8('0x2e')],qs[_0xf6f8('0x34')](_0x183d35[_0xf6f8('0x30')]['fields']));_0x5e6ae5[_0xf6f8('0x33')]=_0x5e6ae5['attributes'][_0xf6f8('0x35')]?_0x5e6ae5[_0xf6f8('0x33')]:_0x4af85b[_0xf6f8('0x2e')];if(!_0x183d35[_0xf6f8('0x30')][_0xf6f8('0x36')](_0xf6f8('0x37'))){_0x5e6ae5['limit']=qs['limit'](_0x183d35[_0xf6f8('0x30')]['limit']);_0x5e6ae5[_0xf6f8('0x1b')]=qs[_0xf6f8('0x1b')](_0x183d35[_0xf6f8('0x30')]['offset']);}_0x5e6ae5[_0xf6f8('0x38')]=qs['sort'](_0x183d35['query'][_0xf6f8('0x39')]);_0x5e6ae5[_0xf6f8('0x3a')]=qs[_0xf6f8('0x31')](_[_0xf6f8('0x3b')](_0x183d35[_0xf6f8('0x30')],_0x4af85b[_0xf6f8('0x31')]),_0x125a9e);if(_0x183d35[_0xf6f8('0x30')]['filter']){_0x5e6ae5[_0xf6f8('0x3a')]=_['merge'](_0x5e6ae5['where'],{'$or':_[_0xf6f8('0x3c')](_0x5e6ae5[_0xf6f8('0x33')],function(_0xa09bcf){var _0x173247={};_0x173247[_0xa09bcf]={'$like':'%'+_0x183d35['query'][_0xf6f8('0x3d')]+'%'};return _0x173247;})});}_0x5e6ae5=_[_0xf6f8('0x3e')]({},_0x5e6ae5,_0x183d35[_0xf6f8('0x3f')]);var _0x497d93={'where':_0x5e6ae5['where']};return db[_0xf6f8('0x40')]['count'](_0x497d93)[_0xf6f8('0x26')](function(_0x164548){_0x1359da[_0xf6f8('0x1e')]=_0x164548;if(_0x183d35[_0xf6f8('0x30')][_0xf6f8('0x41')]){_0x5e6ae5[_0xf6f8('0x42')]=[{'all':!![]}];}return db[_0xf6f8('0x40')][_0xf6f8('0x43')](_0x5e6ae5);})[_0xf6f8('0x26')](function(_0x15fe9d){_0x1359da[_0xf6f8('0x44')]=_0x15fe9d;return _0x1359da;})['then'](respondWithFilteredResult(_0x302fd3,_0x5e6ae5))[_0xf6f8('0x45')](handleError(_0x302fd3,null));})[_0xf6f8('0x45')](handleError(_0x302fd3,null));};exports[_0xf6f8('0x46')]=function(_0x5157d2,_0x234a8c){var _0x2c9b97={'raw':![],'where':{'id':_0x5157d2[_0xf6f8('0x47')]['id']}},_0x42683b={};_0x42683b['model']=_['keys'](db[_0xf6f8('0x40')]['rawAttributes']);_0x42683b[_0xf6f8('0x30')]=_[_0xf6f8('0x2f')](_0x5157d2[_0xf6f8('0x30')]);_0x42683b['filters']=_[_0xf6f8('0x32')](_0x42683b[_0xf6f8('0x2e')],_0x42683b[_0xf6f8('0x30')]);_0x2c9b97[_0xf6f8('0x33')]=_[_0xf6f8('0x32')](_0x42683b[_0xf6f8('0x2e')],qs[_0xf6f8('0x34')](_0x5157d2[_0xf6f8('0x30')][_0xf6f8('0x34')]));_0x2c9b97[_0xf6f8('0x33')]=_0x2c9b97[_0xf6f8('0x33')][_0xf6f8('0x35')]?_0x2c9b97[_0xf6f8('0x33')]:_0x42683b['model'];if(_0x5157d2[_0xf6f8('0x30')][_0xf6f8('0x41')]){_0x2c9b97['include']=[{'all':!![]}];}_0x2c9b97=_['merge']({},_0x2c9b97,_0x5157d2[_0xf6f8('0x3f')]);return db['CmCompany'][_0xf6f8('0x48')](_0x2c9b97)[_0xf6f8('0x26')](handleEntityNotFound(_0x234a8c,null))[_0xf6f8('0x26')](respondWithResult(_0x234a8c,null))[_0xf6f8('0x45')](handleError(_0x234a8c,null));};exports[_0xf6f8('0x49')]=function(_0x457f16,_0x3013bc){return db['CmCompany'][_0xf6f8('0x49')](_0x457f16[_0xf6f8('0x4a')],{})[_0xf6f8('0x26')](function(_0x85bc34){var _0x3decd7=_0x457f16['user'][_0xf6f8('0x27')]({'plain':!![]});if(!_0x3decd7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3decd7['role']===_0xf6f8('0x4b')){var _0x12bba8=_0x85bc34[_0xf6f8('0x27')]({'plain':!![]});var _0x3a1056=_0xf6f8('0x28');return db[_0xf6f8('0x4c')][_0xf6f8('0x48')]({'where':{'name':_0x3a1056,'userProfileId':_0x3decd7[_0xf6f8('0x4d')]},'raw':!![]})[_0xf6f8('0x26')](function(_0xa4a051){if(_0xa4a051&&_0xa4a051[_0xf6f8('0x4e')]===0x0){return db[_0xf6f8('0x4f')][_0xf6f8('0x49')]({'name':_0x12bba8[_0xf6f8('0x2b')],'resourceId':_0x12bba8['id'],'type':_0xa4a051['name'],'sectionId':_0xa4a051['id']},{})['then'](function(){return _0x85bc34;});}else{return _0x85bc34;}})[_0xf6f8('0x45')](function(_0x558f24){logger[_0xf6f8('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x558f24);throw _0x558f24;});}return _0x85bc34;})[_0xf6f8('0x26')](respondWithResult(_0x3013bc,0xc9))[_0xf6f8('0x45')](handleError(_0x3013bc,null));};exports[_0xf6f8('0x24')]=function(_0x89662f,_0x499850){if(_0x89662f[_0xf6f8('0x4a')]['id']){delete _0x89662f[_0xf6f8('0x4a')]['id'];}return db[_0xf6f8('0x40')]['find']({'where':{'id':_0x89662f[_0xf6f8('0x47')]['id']}})[_0xf6f8('0x26')](handleEntityNotFound(_0x499850,null))[_0xf6f8('0x26')](saveUpdates(_0x89662f[_0xf6f8('0x4a')],null))[_0xf6f8('0x26')](respondWithResult(_0x499850,null))['catch'](handleError(_0x499850,null));};exports[_0xf6f8('0x25')]=function(_0x5a4041,_0x1aac88){return db[_0xf6f8('0x40')]['find']({'where':{'id':_0x5a4041['params']['id']}})[_0xf6f8('0x26')](handleEntityNotFound(_0x1aac88,null))['then'](removeEntity(_0x1aac88,null))[_0xf6f8('0x45')](handleError(_0x1aac88,null));};exports[_0xf6f8('0x2d')]=function(_0x3192af,_0x528d73){return db[_0xf6f8('0x40')]['describe']()[_0xf6f8('0x26')](respondWithResult(_0x528d73,null))[_0xf6f8('0x45')](handleError(_0x528d73,null));};exports[_0xf6f8('0x50')]=function(_0x89bbd6,_0x39d0f4,_0x36a31d){return db['CmContact'][_0xf6f8('0x48')]({'where':{'id':_0x89bbd6[_0xf6f8('0x47')]['id']}})[_0xf6f8('0x26')](handleEntityNotFound(_0x39d0f4,null))['then'](function(_0x9ebf7){if(_0x9ebf7){return _0x9ebf7[_0xf6f8('0x50')](_0x89bbd6[_0xf6f8('0x4a')][_0xf6f8('0x51')],_[_0xf6f8('0x52')](_0x89bbd6['body'],[_0xf6f8('0x51'),'id'])||{});}})[_0xf6f8('0x26')](respondWithResult(_0x39d0f4,null))['catch'](handleError(_0x39d0f4,null));};exports[_0xf6f8('0x53')]=function(_0x426432,_0x3d5873,_0x5aed59){var _0x108b60={};var _0x193e04={};var _0x8a591e;var _0x35f355;return db['CmCompany'][_0xf6f8('0x54')]({'where':{'id':_0x426432[_0xf6f8('0x47')]['id']}})[_0xf6f8('0x26')](handleEntityNotFound(_0x3d5873,null))[_0xf6f8('0x26')](function(_0x39faf2){if(_0x39faf2){_0x8a591e=_0x39faf2;_0x193e04['model']=_[_0xf6f8('0x2f')](db['CmContact']['rawAttributes']);_0x193e04[_0xf6f8('0x30')]=_[_0xf6f8('0x2f')](_0x426432[_0xf6f8('0x30')]);_0x193e04[_0xf6f8('0x31')]=_[_0xf6f8('0x32')](_0x193e04[_0xf6f8('0x2e')],_0x193e04[_0xf6f8('0x30')]);_0x108b60['attributes']=_[_0xf6f8('0x32')](_0x193e04[_0xf6f8('0x2e')],qs[_0xf6f8('0x34')](_0x426432[_0xf6f8('0x30')]['fields']));_0x108b60[_0xf6f8('0x33')]=_0x108b60[_0xf6f8('0x33')]['length']?_0x108b60[_0xf6f8('0x33')]:_0x193e04[_0xf6f8('0x2e')];_0x108b60[_0xf6f8('0x38')]=qs[_0xf6f8('0x39')](_0x426432[_0xf6f8('0x30')][_0xf6f8('0x39')]);_0x108b60[_0xf6f8('0x3a')]=qs[_0xf6f8('0x31')](_[_0xf6f8('0x3b')](_0x426432[_0xf6f8('0x30')],_0x193e04[_0xf6f8('0x31')]));if(_0x426432['query']['filter']){_0x108b60['where']=_[_0xf6f8('0x3e')](_0x108b60[_0xf6f8('0x3a')],{'$or':_[_0xf6f8('0x3c')](_0x108b60[_0xf6f8('0x33')],function(_0x5b2d8d){var _0x472dc5={};_0x472dc5[_0x5b2d8d]={'$like':'%'+_0x426432[_0xf6f8('0x30')][_0xf6f8('0x3d')]+'%'};return _0x472dc5;})});}_0x108b60=_['merge']({},_0x108b60,_0x426432[_0xf6f8('0x3f')]);return _0x8a591e[_0xf6f8('0x53')](_0x108b60);}})[_0xf6f8('0x26')](function(_0x7004e7){if(_0x7004e7){_0x35f355=_0x7004e7[_0xf6f8('0x35')];if(!_0x426432[_0xf6f8('0x30')][_0xf6f8('0x36')](_0xf6f8('0x37'))){_0x108b60['limit']=qs[_0xf6f8('0x1d')](_0x426432[_0xf6f8('0x30')]['limit']);_0x108b60[_0xf6f8('0x1b')]=qs[_0xf6f8('0x1b')](_0x426432['query'][_0xf6f8('0x1b')]);}return _0x8a591e[_0xf6f8('0x53')](_0x108b60);}})[_0xf6f8('0x26')](function(_0x17aeb6){if(_0x17aeb6){return _0x17aeb6?{'count':_0x35f355,'rows':_0x17aeb6}:null;}})[_0xf6f8('0x26')](respondWithResult(_0x3d5873,null))[_0xf6f8('0x45')](handleError(_0x3d5873,null));}; \ No newline at end of file +var _0xa79c=['Companies','destroy','error','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addContacts','CmContact','ids','omit','getContacts','findOne','rawAttributes','length','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','then','get'];(function(_0x236487,_0x39046f){var _0x1c64cc=function(_0x5e1bfb){while(--_0x5e1bfb){_0x236487['push'](_0x236487['shift']());}};_0x1c64cc(++_0x39046f);}(_0xa79c,0xd8));var _0xca79=function(_0x332a8a,_0x47c675){_0x332a8a=_0x332a8a-0x0;var _0x5c287a=_0xa79c[_0x332a8a];return _0x5c287a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca79('0x0'));var zipdir=require(_0xca79('0x1'));var jsonpatch=require(_0xca79('0x2'));var rp=require(_0xca79('0x3'));var moment=require(_0xca79('0x4'));var BPromise=require(_0xca79('0x5'));var Mustache=require(_0xca79('0x6'));var util=require('util');var path=require(_0xca79('0x7'));var sox=require('sox');var csv=require(_0xca79('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca79('0x9'));var _=require(_0xca79('0xa'));var squel=require(_0xca79('0xb'));var crypto=require(_0xca79('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xca79('0x8'));var querystring=require(_0xca79('0xd'));var Papa=require(_0xca79('0xe'));var Redis=require('ioredis');var authService=require(_0xca79('0xf'));var qs=require(_0xca79('0x10'));var as=require(_0xca79('0x11'));var hardwareService=require(_0xca79('0x12'));var logger=require(_0xca79('0x13'))(_0xca79('0x14'));var utils=require(_0xca79('0x15'));var config=require(_0xca79('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xca79('0x17'))['db'];function respondWithStatusCode(_0x568a1f,_0x25dd8e){_0x25dd8e=_0x25dd8e||0xcc;return function(_0x4e5913){if(_0x4e5913){return _0x568a1f[_0xca79('0x18')](_0x25dd8e);}return _0x568a1f[_0xca79('0x19')](_0x25dd8e)[_0xca79('0x1a')]();};}function respondWithResult(_0x35986e,_0xc61781){_0xc61781=_0xc61781||0xc8;return function(_0x122cfe){if(_0x122cfe){return _0x35986e['status'](_0xc61781)[_0xca79('0x1b')](_0x122cfe);}};}function respondWithFilteredResult(_0x548739,_0x19cb88){return function(_0x1db4ca){if(_0x1db4ca){var _0x2bea05=typeof _0x19cb88[_0xca79('0x1c')]==='undefined'&&typeof _0x19cb88[_0xca79('0x1d')]===_0xca79('0x1e');var _0x1642a5=_0x1db4ca['count'];var _0x90dade=_0x2bea05?0x0:_0x19cb88[_0xca79('0x1c')];var _0x292f67=_0x2bea05?_0x1db4ca[_0xca79('0x1f')]:_0x19cb88[_0xca79('0x1c')]+_0x19cb88[_0xca79('0x1d')];var _0x4b199d;if(_0x292f67>=_0x1642a5){_0x292f67=_0x1642a5;_0x4b199d=0xc8;}else{_0x4b199d=0xce;}_0x548739[_0xca79('0x19')](_0x4b199d);return _0x548739[_0xca79('0x20')]('Content-Range',_0x90dade+'-'+_0x292f67+'/'+_0x1642a5)[_0xca79('0x1b')](_0x1db4ca);}return null;};}function patchUpdates(_0x3b4597){return function(_0x43f928){try{jsonpatch[_0xca79('0x21')](_0x43f928,_0x3b4597,!![]);}catch(_0x3cf25b){return BPromise['reject'](_0x3cf25b);}return _0x43f928['save']();};}function saveUpdates(_0x59c6d2,_0x4338d1){return function(_0x4e0c39){if(_0x4e0c39){return _0x4e0c39['update'](_0x59c6d2)['then'](function(_0x3c5658){return _0x3c5658;});}return null;};}function removeEntity(_0x2c6ca4,_0x8e25e3){return function(_0x13aad6){if(_0x13aad6){return _0x13aad6['destroy']()[_0xca79('0x22')](function(){var _0x5d2233=_0x13aad6[_0xca79('0x23')]({'plain':!![]});var _0x2bf4e0=_0xca79('0x24');return db['UserProfileResource'][_0xca79('0x25')]({'where':{'type':_0x2bf4e0,'resourceId':_0x5d2233['id']}})[_0xca79('0x22')](function(){return _0x13aad6;});})[_0xca79('0x22')](function(){_0x2c6ca4[_0xca79('0x19')](0xcc)[_0xca79('0x1a')]();});}};}function handleEntityNotFound(_0x5d304b,_0x4cd7ce){return function(_0x1856f1){if(!_0x1856f1){_0x5d304b['sendStatus'](0x194);}return _0x1856f1;};}function handleError(_0x3600fd,_0x2f2811){_0x2f2811=_0x2f2811||0x1f4;return function(_0x3919d1){logger[_0xca79('0x26')](_0x3919d1['stack']);if(_0x3919d1[_0xca79('0x27')]){delete _0x3919d1[_0xca79('0x27')];}_0x3600fd[_0xca79('0x19')](_0x2f2811)[_0xca79('0x28')](_0x3919d1);};}exports[_0xca79('0x29')]=function(_0x3b834f,_0x1e48be){var _0x1584bb={},_0x3b31bc={},_0x2d355f={'count':0x0,'rows':[]};return db[_0xca79('0x2a')][_0xca79('0x2b')]()[_0xca79('0x22')](function(_0x389670){_0x3b31bc[_0xca79('0x2c')]=_[_0xca79('0x2d')](_0x389670);_0x3b31bc[_0xca79('0x2e')]=_[_0xca79('0x2d')](_0x3b834f[_0xca79('0x2e')]);_0x3b31bc[_0xca79('0x2f')]=_[_0xca79('0x30')](_0x3b31bc[_0xca79('0x2c')],_0x3b31bc['query']);_0x1584bb[_0xca79('0x31')]=_[_0xca79('0x30')](_0x3b31bc[_0xca79('0x2c')],qs[_0xca79('0x32')](_0x3b834f[_0xca79('0x2e')][_0xca79('0x32')]));_0x1584bb[_0xca79('0x31')]=_0x1584bb[_0xca79('0x31')]['length']?_0x1584bb[_0xca79('0x31')]:_0x3b31bc[_0xca79('0x2c')];if(!_0x3b834f[_0xca79('0x2e')][_0xca79('0x33')](_0xca79('0x34'))){_0x1584bb[_0xca79('0x1d')]=qs[_0xca79('0x1d')](_0x3b834f[_0xca79('0x2e')][_0xca79('0x1d')]);_0x1584bb[_0xca79('0x1c')]=qs['offset'](_0x3b834f[_0xca79('0x2e')][_0xca79('0x1c')]);}_0x1584bb[_0xca79('0x35')]=qs[_0xca79('0x36')](_0x3b834f[_0xca79('0x2e')][_0xca79('0x36')]);_0x1584bb[_0xca79('0x37')]=qs[_0xca79('0x2f')](_[_0xca79('0x38')](_0x3b834f[_0xca79('0x2e')],_0x3b31bc['filters']),_0x389670);if(_0x3b834f[_0xca79('0x2e')][_0xca79('0x39')]){_0x1584bb[_0xca79('0x37')]=_[_0xca79('0x3a')](_0x1584bb[_0xca79('0x37')],{'$or':_[_0xca79('0x3b')](_0x1584bb[_0xca79('0x31')],function(_0x4a5655){var _0x53f883={};_0x53f883[_0x4a5655]={'$like':'%'+_0x3b834f['query']['filter']+'%'};return _0x53f883;})});}_0x1584bb=_['merge']({},_0x1584bb,_0x3b834f[_0xca79('0x3c')]);var _0x332e87={'where':_0x1584bb[_0xca79('0x37')]};return db[_0xca79('0x2a')][_0xca79('0x1f')](_0x332e87)[_0xca79('0x22')](function(_0x425327){_0x2d355f['count']=_0x425327;if(_0x3b834f[_0xca79('0x2e')][_0xca79('0x3d')]){_0x1584bb[_0xca79('0x3e')]=[{'all':!![]}];}return db[_0xca79('0x2a')]['findAll'](_0x1584bb);})[_0xca79('0x22')](function(_0x16fb5f){_0x2d355f[_0xca79('0x3f')]=_0x16fb5f;return _0x2d355f;})['then'](respondWithFilteredResult(_0x1e48be,_0x1584bb))['catch'](handleError(_0x1e48be,null));})['catch'](handleError(_0x1e48be,null));};exports[_0xca79('0x40')]=function(_0x69d714,_0x186d66){var _0x1e908d={'raw':![],'where':{'id':_0x69d714[_0xca79('0x41')]['id']}},_0x527f1d={};_0x527f1d[_0xca79('0x2c')]=_[_0xca79('0x2d')](db[_0xca79('0x2a')]['rawAttributes']);_0x527f1d[_0xca79('0x2e')]=_[_0xca79('0x2d')](_0x69d714[_0xca79('0x2e')]);_0x527f1d['filters']=_['intersection'](_0x527f1d[_0xca79('0x2c')],_0x527f1d['query']);_0x1e908d[_0xca79('0x31')]=_['intersection'](_0x527f1d[_0xca79('0x2c')],qs[_0xca79('0x32')](_0x69d714['query'][_0xca79('0x32')]));_0x1e908d[_0xca79('0x31')]=_0x1e908d[_0xca79('0x31')]['length']?_0x1e908d[_0xca79('0x31')]:_0x527f1d[_0xca79('0x2c')];if(_0x69d714[_0xca79('0x2e')][_0xca79('0x3d')]){_0x1e908d[_0xca79('0x3e')]=[{'all':!![]}];}_0x1e908d=_['merge']({},_0x1e908d,_0x69d714[_0xca79('0x3c')]);return db[_0xca79('0x2a')][_0xca79('0x42')](_0x1e908d)['then'](handleEntityNotFound(_0x186d66,null))[_0xca79('0x22')](respondWithResult(_0x186d66,null))[_0xca79('0x43')](handleError(_0x186d66,null));};exports[_0xca79('0x44')]=function(_0x19719e,_0x24449d){return db[_0xca79('0x2a')][_0xca79('0x44')](_0x19719e[_0xca79('0x45')],{})['then'](function(_0x5bd3f5){var _0x4c6d23=_0x19719e[_0xca79('0x46')]['get']({'plain':!![]});if(!_0x4c6d23)throw new Error(_0xca79('0x47'));if(_0x4c6d23[_0xca79('0x48')]===_0xca79('0x46')){var _0x38d884=_0x5bd3f5['get']({'plain':!![]});var _0x41ffc9='Companies';return db[_0xca79('0x49')][_0xca79('0x42')]({'where':{'name':_0x41ffc9,'userProfileId':_0x4c6d23[_0xca79('0x4a')]},'raw':!![]})['then'](function(_0x58799){if(_0x58799&&_0x58799[_0xca79('0x4b')]===0x0){return db['UserProfileResource'][_0xca79('0x44')]({'name':_0x38d884[_0xca79('0x27')],'resourceId':_0x38d884['id'],'type':_0x58799['name'],'sectionId':_0x58799['id']},{})['then'](function(){return _0x5bd3f5;});}else{return _0x5bd3f5;}})[_0xca79('0x43')](function(_0x205b10){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x205b10);throw _0x205b10;});}return _0x5bd3f5;})[_0xca79('0x22')](respondWithResult(_0x24449d,0xc9))['catch'](handleError(_0x24449d,null));};exports['update']=function(_0x3cdd36,_0x1dfa18){if(_0x3cdd36['body']['id']){delete _0x3cdd36[_0xca79('0x45')]['id'];}return db[_0xca79('0x2a')]['find']({'where':{'id':_0x3cdd36[_0xca79('0x41')]['id']}})[_0xca79('0x22')](handleEntityNotFound(_0x1dfa18,null))[_0xca79('0x22')](saveUpdates(_0x3cdd36[_0xca79('0x45')],null))[_0xca79('0x22')](respondWithResult(_0x1dfa18,null))['catch'](handleError(_0x1dfa18,null));};exports[_0xca79('0x25')]=function(_0x48a741,_0x86358b){return db['CmCompany']['find']({'where':{'id':_0x48a741[_0xca79('0x41')]['id']}})['then'](handleEntityNotFound(_0x86358b,null))[_0xca79('0x22')](removeEntity(_0x86358b,null))[_0xca79('0x43')](handleError(_0x86358b,null));};exports[_0xca79('0x2b')]=function(_0x2f8bbb,_0x4e3cf0){return db[_0xca79('0x2a')][_0xca79('0x2b')]()['then'](respondWithResult(_0x4e3cf0,null))[_0xca79('0x43')](handleError(_0x4e3cf0,null));};exports[_0xca79('0x4c')]=function(_0x5bda30,_0x412866,_0xb2142){return db[_0xca79('0x4d')][_0xca79('0x42')]({'where':{'id':_0x5bda30[_0xca79('0x41')]['id']}})[_0xca79('0x22')](handleEntityNotFound(_0x412866,null))[_0xca79('0x22')](function(_0x3eecce){if(_0x3eecce){return _0x3eecce['addContacts'](_0x5bda30[_0xca79('0x45')][_0xca79('0x4e')],_[_0xca79('0x4f')](_0x5bda30[_0xca79('0x45')],[_0xca79('0x4e'),'id'])||{});}})[_0xca79('0x22')](respondWithResult(_0x412866,null))[_0xca79('0x43')](handleError(_0x412866,null));};exports[_0xca79('0x50')]=function(_0x3b6f67,_0x2381b6,_0xf9a53){var _0x5de678={};var _0x4d1178={};var _0x135ac3;var _0x1a0e5d;return db[_0xca79('0x2a')][_0xca79('0x51')]({'where':{'id':_0x3b6f67[_0xca79('0x41')]['id']}})['then'](handleEntityNotFound(_0x2381b6,null))['then'](function(_0x6ddce6){if(_0x6ddce6){_0x135ac3=_0x6ddce6;_0x4d1178[_0xca79('0x2c')]=_[_0xca79('0x2d')](db['CmContact'][_0xca79('0x52')]);_0x4d1178[_0xca79('0x2e')]=_[_0xca79('0x2d')](_0x3b6f67['query']);_0x4d1178[_0xca79('0x2f')]=_['intersection'](_0x4d1178[_0xca79('0x2c')],_0x4d1178['query']);_0x5de678[_0xca79('0x31')]=_[_0xca79('0x30')](_0x4d1178[_0xca79('0x2c')],qs[_0xca79('0x32')](_0x3b6f67[_0xca79('0x2e')][_0xca79('0x32')]));_0x5de678[_0xca79('0x31')]=_0x5de678[_0xca79('0x31')]['length']?_0x5de678[_0xca79('0x31')]:_0x4d1178[_0xca79('0x2c')];_0x5de678[_0xca79('0x35')]=qs[_0xca79('0x36')](_0x3b6f67[_0xca79('0x2e')][_0xca79('0x36')]);_0x5de678[_0xca79('0x37')]=qs[_0xca79('0x2f')](_[_0xca79('0x38')](_0x3b6f67[_0xca79('0x2e')],_0x4d1178[_0xca79('0x2f')]));if(_0x3b6f67[_0xca79('0x2e')]['filter']){_0x5de678[_0xca79('0x37')]=_[_0xca79('0x3a')](_0x5de678[_0xca79('0x37')],{'$or':_[_0xca79('0x3b')](_0x5de678[_0xca79('0x31')],function(_0x581864){var _0x1189db={};_0x1189db[_0x581864]={'$like':'%'+_0x3b6f67[_0xca79('0x2e')]['filter']+'%'};return _0x1189db;})});}_0x5de678=_['merge']({},_0x5de678,_0x3b6f67['options']);return _0x135ac3['getContacts'](_0x5de678);}})[_0xca79('0x22')](function(_0x401ea0){if(_0x401ea0){_0x1a0e5d=_0x401ea0[_0xca79('0x53')];if(!_0x3b6f67['query']['hasOwnProperty'](_0xca79('0x34'))){_0x5de678[_0xca79('0x1d')]=qs['limit'](_0x3b6f67[_0xca79('0x2e')][_0xca79('0x1d')]);_0x5de678['offset']=qs[_0xca79('0x1c')](_0x3b6f67['query'][_0xca79('0x1c')]);}return _0x135ac3[_0xca79('0x50')](_0x5de678);}})[_0xca79('0x22')](function(_0x1d7a98){if(_0x1d7a98){return _0x1d7a98?{'count':_0x1a0e5d,'rows':_0x1d7a98}:null;}})['then'](respondWithResult(_0x2381b6,null))[_0xca79('0x43')](handleError(_0x2381b6,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 96728ee..c839952 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 _0xef5b=['./cmCompany.attributes','exports','define','cm_companies','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x40e59a,_0x2608dd){var _0x571c0d=function(_0x563802){while(--_0x563802){_0x40e59a['push'](_0x40e59a['shift']());}};_0x571c0d(++_0x2608dd);}(_0xef5b,0x70));var _0xbef5=function(_0x3d75df,_0x286e7a){_0x3d75df=_0x3d75df-0x0;var _0x25d327=_0xef5b[_0x3d75df];return _0x25d327;};'use strict';var _=require('lodash');var util=require(_0xbef5('0x0'));var logger=require('../../config/logger')(_0xbef5('0x1'));var moment=require(_0xbef5('0x2'));var BPromise=require(_0xbef5('0x3'));var rp=require(_0xbef5('0x4'));var fs=require('fs');var path=require(_0xbef5('0x5'));var rimraf=require(_0xbef5('0x6'));var config=require(_0xbef5('0x7'));var attributes=require(_0xbef5('0x8'));module[_0xbef5('0x9')]=function(_0x4ea6f0,_0x135b2f){return _0x4ea6f0[_0xbef5('0xa')]('CmCompany',attributes,{'tableName':_0xbef5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea98=['util','api','moment','path','../../config/environment','define','CmCompany','cm_companies'];(function(_0xf9fcc9,_0x46350e){var _0x396114=function(_0x3418fe){while(--_0x3418fe){_0xf9fcc9['push'](_0xf9fcc9['shift']());}};_0x396114(++_0x46350e);}(_0xea98,0x180));var _0x8ea9=function(_0x25e4c7,_0x3986c5){_0x25e4c7=_0x25e4c7-0x0;var _0x333f1e=_0xea98[_0x25e4c7];return _0x333f1e;};'use strict';var _=require('lodash');var util=require(_0x8ea9('0x0'));var logger=require('../../config/logger')(_0x8ea9('0x1'));var moment=require(_0x8ea9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ea9('0x3'));var rimraf=require('rimraf');var config=require(_0x8ea9('0x4'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x422cf5,_0x1ce77e){return _0x422cf5[_0x8ea9('0x5')](_0x8ea9('0x6'),attributes,{'tableName':_0x8ea9('0x7'),'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 a8c6959..1c29845 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 _0x2a5d=['code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x420746,_0x26dd66){var _0x1c6de2=function(_0x1162d7){while(--_0x1162d7){_0x420746['push'](_0x420746['shift']());}};_0x1c6de2(++_0x26dd66);}(_0x2a5d,0x6d));var _0xd2a5=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x2a5d[_0x176329];return _0x31997c;};'use strict';var _=require(_0xd2a5('0x0'));var util=require('util');var moment=require(_0xd2a5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd2a5('0x2'));var db=require(_0xd2a5('0x3'))['db'];var utils=require(_0xd2a5('0x4'));var logger=require(_0xd2a5('0x5'))('rpc');var config=require(_0xd2a5('0x6'));var jayson=require(_0xd2a5('0x7'));var client=jayson[_0xd2a5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e599c,_0x5746ed,_0x1efbbb){return new BPromise(function(_0x437e81,_0xb18eda){return client['request'](_0x5e599c,_0x1efbbb)[_0xd2a5('0x9')](function(_0x5219c3){logger[_0xd2a5('0xa')](_0xd2a5('0xb'),_0x5746ed,_0xd2a5('0xc'));logger[_0xd2a5('0xd')](_0xd2a5('0xe'),_0x5746ed,_0xd2a5('0xc'),JSON[_0xd2a5('0xf')](_0x5219c3));if(_0x5219c3[_0xd2a5('0x10')]){if(_0x5219c3['error'][_0xd2a5('0x11')]===0x1f4){logger[_0xd2a5('0x10')](_0xd2a5('0xb'),_0x5746ed,_0x5219c3['error'][_0xd2a5('0x12')]);return _0xb18eda(_0x5219c3[_0xd2a5('0x10')][_0xd2a5('0x12')]);}logger[_0xd2a5('0x10')](_0xd2a5('0xb'),_0x5746ed,_0x5219c3['error']['message']);return _0x437e81(_0x5219c3[_0xd2a5('0x10')][_0xd2a5('0x12')]);}else{logger[_0xd2a5('0xa')](_0xd2a5('0xb'),_0x5746ed,_0xd2a5('0xc'));_0x437e81(_0x5219c3[_0xd2a5('0x13')]['message']);}})[_0xd2a5('0x14')](function(_0x5edb54){logger[_0xd2a5('0x10')](_0xd2a5('0xb'),_0x5746ed,_0x5edb54);_0xb18eda(_0x5edb54);});});} \ No newline at end of file +var _0xa29a=['request\x20sent','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x54f3e8,_0x3ed493){var _0x267b37=function(_0x58247e){while(--_0x58247e){_0x54f3e8['push'](_0x54f3e8['shift']());}};_0x267b37(++_0x3ed493);}(_0xa29a,0xd5));var _0xaa29=function(_0x2d98ac,_0x4e6161){_0x2d98ac=_0x2d98ac-0x0;var _0x444708=_0xa29a[_0x2d98ac];return _0x444708;};'use strict';var _=require(_0xaa29('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa29('0x1'));var rs=require(_0xaa29('0x2'));var fs=require('fs');var Redis=require(_0xaa29('0x3'));var db=require(_0xaa29('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa29('0x5'))('rpc');var config=require(_0xaa29('0x6'));var jayson=require(_0xaa29('0x7'));var client=jayson[_0xaa29('0x8')][_0xaa29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35f2fb,_0x1283d1,_0x39c0c3){return new BPromise(function(_0x108a38,_0x12d7c0){return client[_0xaa29('0xa')](_0x35f2fb,_0x39c0c3)[_0xaa29('0xb')](function(_0x52df12){logger[_0xaa29('0xc')](_0xaa29('0xd'),_0x1283d1,'request\x20sent');logger['debug'](_0xaa29('0xe'),_0x1283d1,_0xaa29('0xf'),JSON['stringify'](_0x52df12));if(_0x52df12[_0xaa29('0x10')]){if(_0x52df12[_0xaa29('0x10')]['code']===0x1f4){logger[_0xaa29('0x10')](_0xaa29('0xd'),_0x1283d1,_0x52df12[_0xaa29('0x10')][_0xaa29('0x11')]);return _0x12d7c0(_0x52df12[_0xaa29('0x10')][_0xaa29('0x11')]);}logger[_0xaa29('0x10')](_0xaa29('0xd'),_0x1283d1,_0x52df12[_0xaa29('0x10')][_0xaa29('0x11')]);return _0x108a38(_0x52df12[_0xaa29('0x10')][_0xaa29('0x11')]);}else{logger[_0xaa29('0xc')]('CmCompany,\x20%s,\x20%s',_0x1283d1,_0xaa29('0xf'));_0x108a38(_0x52df12['result'][_0xaa29('0x11')]);}})[_0xaa29('0x12')](function(_0x406a86){logger[_0xaa29('0x10')](_0xaa29('0xd'),_0x1283d1,_0x406a86);_0x12d7c0(_0x406a86);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 727208e..6fcfd1a 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 _0x0291=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','./cmCompany.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete'];(function(_0x544d7a,_0x3be1fd){var _0x46fc8c=function(_0x34ec20){while(--_0x34ec20){_0x544d7a['push'](_0x544d7a['shift']());}};_0x46fc8c(++_0x3be1fd);}(_0x0291,0x162));var _0x1029=function(_0x523a3b,_0x21e2b5){_0x523a3b=_0x523a3b-0x0;var _0x1b113d=_0x0291[_0x523a3b];return _0x1b113d;};'use strict';var multer=require(_0x1029('0x0'));var util=require(_0x1029('0x1'));var path=require('path');var timeout=require(_0x1029('0x2'));var express=require('express');var router=express[_0x1029('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1029('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1029('0x5'));router['get']('/',auth[_0x1029('0x6')](),controller['index']);router[_0x1029('0x7')](_0x1029('0x8'),auth[_0x1029('0x6')](),controller[_0x1029('0x9')]);router[_0x1029('0x7')](_0x1029('0xa'),auth['isAuthenticated'](),controller[_0x1029('0xb')]);router['get'](_0x1029('0xc'),auth[_0x1029('0x6')](),controller[_0x1029('0xd')]);router[_0x1029('0xe')]('/',auth[_0x1029('0x6')](),controller[_0x1029('0xf')]);router['post'](_0x1029('0xc'),auth[_0x1029('0x6')](),controller[_0x1029('0x10')]);router[_0x1029('0x11')]('/:id',auth[_0x1029('0x6')](),controller[_0x1029('0x12')]);router[_0x1029('0x13')](_0x1029('0xa'),auth['isAuthenticated'](),controller[_0x1029('0x14')]);module[_0x1029('0x15')]=router; \ No newline at end of file +var _0x83d0=['/:id/contacts','getContacts','create','addContacts','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x83d0,0x76));var _0x083d=function(_0x2d497f,_0x2f5113){_0x2d497f=_0x2d497f-0x0;var _0x58eb02=_0x83d0[_0x2d497f];return _0x58eb02;};'use strict';var multer=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var path=require(_0x083d('0x2'));var timeout=require(_0x083d('0x3'));var express=require('express');var router=express[_0x083d('0x4')]();var fs_extra=require(_0x083d('0x5'));var auth=require(_0x083d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x083d('0x7'));var controller=require(_0x083d('0x8'));router[_0x083d('0x9')]('/',auth[_0x083d('0xa')](),controller['index']);router[_0x083d('0x9')](_0x083d('0xb'),auth[_0x083d('0xa')](),controller['describe']);router[_0x083d('0x9')](_0x083d('0xc'),auth[_0x083d('0xa')](),controller[_0x083d('0xd')]);router[_0x083d('0x9')](_0x083d('0xe'),auth['isAuthenticated'](),controller[_0x083d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x083d('0x10')]);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0x083d('0x11')]);router[_0x083d('0x12')]('/:id',auth[_0x083d('0xa')](),controller[_0x083d('0x13')]);router['delete'](_0x083d('0xc'),auth[_0x083d('0xa')](),controller[_0x083d('0x14')]);module[_0x083d('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index c655cf0..2979506 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 _0xf62d=['STRING','TEXT','INTEGER','UNSIGNED','NOW','sequelize','exports'];(function(_0x26fd67,_0x510e30){var _0x840207=function(_0x1372c9){while(--_0x1372c9){_0x26fd67['push'](_0x26fd67['shift']());}};_0x840207(++_0x510e30);}(_0xf62d,0x1b7));var _0xdf62=function(_0x4eab97,_0x52a55f){_0x4eab97=_0x4eab97-0x0;var _0x41f8b2=_0xf62d[_0x4eab97];return _0x41f8b2;};'use strict';var _=require('lodash');var Sequelize=require(_0xdf62('0x0'));module[_0xdf62('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xdf62('0x2')]},'postalCode':{'type':Sequelize[_0xdf62('0x2')]},'city':{'type':Sequelize[_0xdf62('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xdf62('0x2')]},'description':{'type':Sequelize[_0xdf62('0x3')]},'phone':{'type':Sequelize[_0xdf62('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xdf62('0x2')]},'url':{'type':Sequelize[_0xdf62('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xdf62('0x2')]},'skype':{'type':Sequelize[_0xdf62('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xdf62('0x2')]},'line':{'type':Sequelize[_0xdf62('0x2')]},'wechat':{'type':Sequelize[_0xdf62('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xdf62('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xdf62('0x2')]},'priority':{'type':Sequelize[_0xdf62('0x4')](0x2)[_0xdf62('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xdf62('0x6')]},'dialTimezone':{'type':Sequelize[_0xdf62('0x2')]},'utcOffset':{'type':Sequelize[_0xdf62('0x4')]}}; \ No newline at end of file +var _0x66ef=['exports','STRING','TEXT','UNSIGNED','DATE','NOW','INTEGER','sequelize'];(function(_0x45eee2,_0x4d8c9e){var _0x4eb329=function(_0x3d99a5){while(--_0x3d99a5){_0x45eee2['push'](_0x45eee2['shift']());}};_0x4eb329(++_0x4d8c9e);}(_0x66ef,0x147));var _0xf66e=function(_0x20dc38,_0x371fbf){_0x20dc38=_0x20dc38-0x0;var _0x42a113=_0x66ef[_0x20dc38];return _0x42a113;};'use strict';var _=require('lodash');var Sequelize=require(_0xf66e('0x0'));module[_0xf66e('0x1')]={'firstName':{'type':Sequelize[_0xf66e('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf66e('0x2')]},'street':{'type':Sequelize[_0xf66e('0x2')]},'postalCode':{'type':Sequelize[_0xf66e('0x2')]},'city':{'type':Sequelize[_0xf66e('0x2')]},'country':{'type':Sequelize[_0xf66e('0x2')]},'dateOfBirth':{'type':Sequelize[_0xf66e('0x2')]},'description':{'type':Sequelize[_0xf66e('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xf66e('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf66e('0x2')]},'url':{'type':Sequelize[_0xf66e('0x2')]},'facebook':{'type':Sequelize[_0xf66e('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xf66e('0x2')]},'skype':{'type':Sequelize[_0xf66e('0x2')]},'teams':{'type':Sequelize[_0xf66e('0x2')]},'viber':{'type':Sequelize[_0xf66e('0x2')]},'line':{'type':Sequelize[_0xf66e('0x2')]},'wechat':{'type':Sequelize[_0xf66e('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xf66e('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xf66e('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf66e('0x5')],'defaultValue':Sequelize[_0xf66e('0x6')]},'dialTimezone':{'type':Sequelize[_0xf66e('0x2')]},'utcOffset':{'type':Sequelize[_0xf66e('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index a7efcbe..732abb1 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 _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 4437bb9..53bbe52 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 _0xa209=['remove','emit','exports','events','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0xa209,0x1bb));var _0x9a20=function(_0x47cda4,_0x23ec19){_0x47cda4=_0x47cda4-0x0;var _0xc16bae=_0xa209[_0x47cda4];return _0xc16bae;};'use strict';var EventEmitter=require(_0x9a20('0x0'));var CmContact=require(_0x9a20('0x1'))['db'][_0x9a20('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9a20('0x3')](0x0);var events={'afterCreate':_0x9a20('0x4'),'afterUpdate':'update','afterDestroy':_0x9a20('0x5')};function emitEvent(_0x4fa418){return function(_0x2a3096,_0x529711,_0x45b657){CmContactEvents['emit'](_0x4fa418+':'+_0x2a3096['id'],_0x2a3096);CmContactEvents[_0x9a20('0x6')](_0x4fa418,_0x2a3096);_0x45b657(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x9a20('0x7')]=CmContactEvents; \ No newline at end of file +var _0x73da=['CmContact','setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0xeb29b5,_0x460b52){var _0x551565=function(_0x5eaa41){while(--_0x5eaa41){_0xeb29b5['push'](_0xeb29b5['shift']());}};_0x551565(++_0x460b52);}(_0x73da,0x136));var _0xa73d=function(_0x279645,_0x2ed6c5){_0x279645=_0x279645-0x0;var _0x1b6272=_0x73da[_0x279645];return _0x1b6272;};'use strict';var EventEmitter=require(_0xa73d('0x0'));var CmContact=require(_0xa73d('0x1'))['db'][_0xa73d('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xa73d('0x3')](0x0);var events={'afterCreate':_0xa73d('0x4'),'afterUpdate':'update','afterDestroy':_0xa73d('0x5')};function emitEvent(_0x40b69a){return function(_0x50513d,_0x590ba8,_0x160ab1){CmContactEvents[_0xa73d('0x6')](_0x40b69a+':'+_0x50513d['id'],_0x50513d);CmContactEvents[_0xa73d('0x6')](_0x40b69a,_0x50513d);_0x160ab1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xa73d('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 e07099e..1d4ae16 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 _0x4bb2=['afterCreate','Campaign','timezones','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','get','always','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','message','findAll','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','firstName','lastName','mobile','email','FULLTEXT','utf8mb4_unicode_ci','models','cmContact','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','then','dialTimezone','utcOffset','minutes','ret','CmHopper','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','error'];(function(_0x117020,_0x5932e3){var _0x35c4cf=function(_0x19b83d){while(--_0x19b83d){_0x117020['push'](_0x117020['shift']());}};_0x35c4cf(++_0x5932e3);}(_0x4bb2,0xb4));var _0x24bb=function(_0x4ebc8f,_0x71255){_0x4ebc8f=_0x4ebc8f-0x0;var _0x1b94a8=_0x4bb2[_0x4ebc8f];return _0x1b94a8;};'use strict';var _=require(_0x24bb('0x0'));var util=require(_0x24bb('0x1'));var logger=require(_0x24bb('0x2'))(_0x24bb('0x3'));var moment=require(_0x24bb('0x4'));var BPromise=require(_0x24bb('0x5'));var rp=require(_0x24bb('0x6'));var fs=require('fs');var path=require(_0x24bb('0x7'));var rimraf=require('rimraf');var config=require(_0x24bb('0x8'));var shared=require(_0x24bb('0x9'));var attributes=require(_0x24bb('0xa'));module[_0x24bb('0xb')]=function(_0x3cab2a,_0x12cc44){return _0x3cab2a[_0x24bb('0xc')](_0x24bb('0xd'),attributes,{'tableName':_0x24bb('0xe'),'paranoid':!![],'indexes':[{'name':_0x24bb('0xf'),'fields':[_0x24bb('0xf')]},{'name':'fti_cm_contacts','fields':[_0x24bb('0x10'),_0x24bb('0x11'),_0x24bb('0xf'),_0x24bb('0x12'),'fax',_0x24bb('0x13')],'type':_0x24bb('0x14')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x24bb('0x15'),'hooks':{'afterCreate':function(_0x2aa4ac,_0x4fb588,_0xbdfee0){var _0x470754=_0x3cab2a[_0x24bb('0x16')];var _0x5b9587=_0x2aa4ac['get']({'plain':!![]});function _0x2dfa1c(){return function(_0x33fae9){logger['error'](_0x24bb('0x17'),'afterCreate',util[_0x24bb('0x18')](_0x33fae9,{'showHidden':![],'depth':null}));};}function _0xd51185(_0x39cc04,_0x470f86){var _0x13e96e=_0x470f86[_0x24bb('0x19')]?_0x470f86[_0x24bb('0x19')]:moment()[_0x24bb('0x1a')](_0x24bb('0x1b'));return new BPromise(function(_0x24e1cf,_0x23fe8d){if(_[_0x24bb('0x1c')](_0x470f86['dialTimezone'])){_0x24e1cf({'ret':_0x13e96e});}else{_0x470754[_0x24bb('0x1d')][_0x24bb('0x1e')]({'where':{'id':_0x39cc04['id']}})[_0x24bb('0x1f')](function(_0x394f4){if(!_['isNil'](_0x394f4)){var _0x9433e1=_0x394f4[_0x24bb('0x20')];if(!_[_0x24bb('0x1c')](_0x9433e1)){var _0x5d7356=shared['timezones'];var _0x1ad9bd=_0x5d7356[_0x9433e1];var _0x506ca4=_0x5d7356[_0x470f86[_0x24bb('0x20')]];if(!_[_0x24bb('0x1c')](_0x1ad9bd)&&!_[_0x24bb('0x1c')](_0x506ca4)){var _0x219c7f=_0x1ad9bd['utcOffset']-_0x506ca4[_0x24bb('0x21')];_0x13e96e=_0x470f86[_0x24bb('0x19')]?_0x470f86[_0x24bb('0x19')]:moment();var _0x5ddcf3=moment(_0x13e96e)['add'](_0x219c7f,_0x24bb('0x22'));_0x24e1cf({'ret':_0x5ddcf3[_0x24bb('0x1a')](_0x24bb('0x1b'))});}else _0x24e1cf({'ret':_0x13e96e});}else _0x24e1cf({'ret':_0x13e96e});}else{_0x24e1cf({'ret':_0x13e96e});}});}});return 0xa;}var _0x33f837=function(_0xeda30){return new BPromise(function(_0x241fc1,_0x62902c){_0xd51185(_0xeda30,_0x5b9587)['then'](function(_0x5a152d){_0x5b9587['scheduledat']=_0x5a152d[_0x24bb('0x23')];_0x470754[_0x24bb('0x24')][_0x24bb('0x1e')]({'where':{'phone':_0x5b9587[_0x24bb('0xf')],'VoiceQueueId':_0xeda30['id']}})[_0x24bb('0x1f')](function(_0x154465){if(!_[_0x24bb('0x1c')](_0x154465)){throw new Error('cmContact,\x20afterCreate\x20'+_0x5b9587[_0x24bb('0xf')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0xeda30['id']);}return _0x470754[_0x24bb('0x24')]['create']({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587[_0x24bb('0x25')],'priority':_0x5b9587[_0x24bb('0x26')]?_0x5b9587[_0x24bb('0x26')]:0x2,'scheduledat':_0x5b9587[_0x24bb('0x19')]?_0x5b9587[_0x24bb('0x19')]:moment()[_0x24bb('0x1a')](_0x24bb('0x1b')),'callback':_0x5b9587[_0x24bb('0x27')]?!![]:![],'callbackuniqueid':_0x5b9587['callbackUniqueid']?_0x5b9587[_0x24bb('0x27')]:undefined,'callbackat':_0x5b9587[_0x24bb('0x27')]?moment()[_0x24bb('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xeda30['id']});})[_0x24bb('0x28')](function(_0x17e2de){_0x62902c(_0x17e2de);});});});};var _0x361283=function(_0x5a8078){return new BPromise(function(_0x2ffa4c,_0x2be83f){_0xd51185(_0x5a8078,_0x5b9587)[_0x24bb('0x1f')](function(_0x498b4c){_0x5b9587[_0x24bb('0x19')]=_0x498b4c[_0x24bb('0x23')];_0x470754[_0x24bb('0x24')]['findOne']({'where':{'phone':_0x5b9587[_0x24bb('0xf')],'VoiceQueueId':_0x5a8078['id']}})[_0x24bb('0x1f')](function(_0x2fa111){if(!_[_0x24bb('0x1c')](_0x2fa111)){throw new Error(_0x24bb('0x29')+_0x5b9587['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5a8078['id']);}return _0x470754['CmHopperFinal'][_0x24bb('0x1e')]({'where':{'calleridnum':_0x5b9587['phone'],'VoiceQueueId':_0x5a8078['id']}});})['then'](function(_0x2e6f87){if(!_['isNil'](_0x2e6f87)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x5b9587[_0x24bb('0xf')]+_0x24bb('0x2a')+_0x5a8078['id']);}return _0x470754['CmHopper'][_0x24bb('0x2b')]({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587[_0x24bb('0x25')],'priority':_0x5b9587['priority']?_0x5b9587[_0x24bb('0x26')]:0x2,'scheduledat':_0x5b9587['scheduledat']?_0x5b9587[_0x24bb('0x19')]:moment()[_0x24bb('0x1a')](_0x24bb('0x1b')),'callback':_0x5b9587[_0x24bb('0x27')]?!![]:![],'callbackuniqueid':_0x5b9587[_0x24bb('0x27')]?_0x5b9587['callbackUniqueid']:undefined,'callbackat':_0x5b9587['callbackUniqueid']?moment()[_0x24bb('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5a8078['id']});})[_0x24bb('0x28')](function(_0x30b9c8){_0x2be83f(_0x30b9c8);});});});};function _0x1817da(){return function(_0x4ad33a){logger[_0x24bb('0x2c')](_0x24bb('0x17'),_0x24bb('0x2d'),util[_0x24bb('0x18')](_0x4ad33a,{'showHidden':![],'depth':null}));};}function _0x4d39b9(_0x5718b0,_0x56e0d9){var _0x11e49e=_0x56e0d9[_0x24bb('0x19')]?_0x56e0d9[_0x24bb('0x19')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x25f94d,_0xd9f044){if(_[_0x24bb('0x1c')](_0x56e0d9['dialTimezone'])){_0x25f94d({'ret':_0x11e49e});}else{_0x470754[_0x24bb('0x2e')][_0x24bb('0x1e')]({'where':{'id':_0x5718b0['id']}})[_0x24bb('0x1f')](function(_0x345d86){if(!_[_0x24bb('0x1c')](_0x345d86)){var _0x392557=_0x345d86[_0x24bb('0x20')];if(!_[_0x24bb('0x1c')](_0x392557)){var _0x114d21=shared[_0x24bb('0x2f')];var _0x22485e=_0x114d21[_0x392557];var _0x34abb3=_0x114d21[_0x56e0d9['dialTimezone']];if(!_[_0x24bb('0x1c')](_0x22485e)&&!_['isNil'](_0x34abb3)){var _0x35e360=_0x22485e[_0x24bb('0x21')]-_0x34abb3[_0x24bb('0x21')];_0x11e49e=_0x56e0d9[_0x24bb('0x19')]?_0x56e0d9[_0x24bb('0x19')]:moment();var _0x1025ea=moment(_0x11e49e)[_0x24bb('0x30')](_0x35e360,_0x24bb('0x22'));_0x25f94d({'ret':_0x1025ea[_0x24bb('0x1a')](_0x24bb('0x1b'))});}else _0x25f94d({'ret':_0x11e49e});}else _0x25f94d({'ret':_0x11e49e});}else{_0x25f94d({'ret':_0x11e49e});}});}});return 0xa;}var _0x18fe3c=function(_0x422373){return new BPromise(function(_0x50edfa,_0x37eed5){_0x4d39b9(_0x422373,_0x5b9587)[_0x24bb('0x1f')](function(_0x1902de){_0x5b9587[_0x24bb('0x19')]=_0x1902de[_0x24bb('0x23')];_0x470754[_0x24bb('0x24')][_0x24bb('0x1e')]({'where':{'phone':_0x5b9587[_0x24bb('0xf')],'CampaignId':_0x422373['id']}})[_0x24bb('0x1f')](function(_0x811e2d){if(!_['isNil'](_0x811e2d)){throw new Error('cmContact,\x20afterCreate\x20'+_0x5b9587[_0x24bb('0xf')]+_0x24bb('0x31')+_0x422373['id']);}return _0x470754[_0x24bb('0x24')][_0x24bb('0x2b')]({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587[_0x24bb('0x25')],'priority':_0x5b9587[_0x24bb('0x26')]?_0x5b9587['priority']:0x2,'scheduledat':_0x5b9587[_0x24bb('0x19')]?_0x5b9587['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5b9587[_0x24bb('0x27')]?!![]:![],'callbackuniqueid':_0x5b9587[_0x24bb('0x27')]?_0x5b9587[_0x24bb('0x27')]:undefined,'callbackat':_0x5b9587[_0x24bb('0x27')]?moment()[_0x24bb('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x422373['id']});})['catch'](function(_0x14fa9b){_0x37eed5(_0x14fa9b);});});});};var _0x50e3ef=function(_0x66db1f){return new BPromise(function(_0x47306e,_0x51963a){_0x4d39b9(_0x66db1f,_0x5b9587)[_0x24bb('0x1f')](function(_0x30ce3b){_0x5b9587[_0x24bb('0x19')]=_0x30ce3b[_0x24bb('0x23')];_0x470754[_0x24bb('0x24')][_0x24bb('0x1e')]({'where':{'phone':_0x5b9587[_0x24bb('0xf')],'CampaignId':_0x66db1f['id']}})['then'](function(_0x33b6b9){if(!_[_0x24bb('0x1c')](_0x33b6b9)){throw new Error(_0x24bb('0x29')+_0x5b9587[_0x24bb('0xf')]+_0x24bb('0x32')+_0x66db1f['id']);}return _0x470754[_0x24bb('0x33')]['findOne']({'where':{'calleridnum':_0x5b9587['phone'],'CampaignId':_0x66db1f['id']}});})[_0x24bb('0x1f')](function(_0xdcbfbd){if(!_[_0x24bb('0x1c')](_0xdcbfbd)){throw new Error(_0x24bb('0x34')+_0x5b9587[_0x24bb('0xf')]+_0x24bb('0x35')+_0x66db1f['id']);}return _0x470754[_0x24bb('0x24')][_0x24bb('0x2b')]({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587['ListId'],'priority':_0x5b9587['priority']?_0x5b9587[_0x24bb('0x26')]:0x2,'scheduledat':_0x5b9587['scheduledat']?_0x5b9587['scheduledat']:moment()['format'](_0x24bb('0x1b')),'callback':_0x5b9587[_0x24bb('0x27')]?!![]:![],'callbackuniqueid':_0x5b9587[_0x24bb('0x27')]?_0x5b9587[_0x24bb('0x27')]:undefined,'callbackat':_0x5b9587[_0x24bb('0x27')]?moment()[_0x24bb('0x1a')](_0x24bb('0x1b')):undefined,'CampaignId':_0x66db1f['id']});})[_0x24bb('0x28')](function(_0x2d0758){_0x51963a(_0x2d0758);});});});};if(_0x5b9587[_0x24bb('0x25')]){_0x470754['VoiceQueue']['findAll']({'where':{'type':_0x24bb('0x36')},'attributes':['id',_0x24bb('0x37'),_0x24bb('0x20')],'include':[{'model':_0x470754[_0x24bb('0x38')],'as':_0x24bb('0x39'),'where':{'id':_0x5b9587[_0x24bb('0x25')]}}]})[_0x24bb('0x1f')](function(_0x5ef430){if(_0x5ef430){var _0x156388=[];for(var _0xdf5d89=0x0,_0x189c9b;_0xdf5d89<_0x5ef430[_0x24bb('0x3a')];_0xdf5d89+=0x1){_0x189c9b=_0x5ef430[_0xdf5d89][_0x24bb('0x3b')]({'plain':!![]});switch(_0x189c9b['dialCheckDuplicateType']){case _0x24bb('0x3c'):_0x361283(_0x189c9b)[_0x24bb('0x28')](_0x2dfa1c());break;case _0x24bb('0x3d'):_0x33f837(_0x189c9b)[_0x24bb('0x28')](_0x2dfa1c());break;default:_0x4d39b9(_0x189c9b,_0x5b9587)[_0x24bb('0x1f')](function(_0x351868){_0x5b9587['scheduledat']=_0x351868[_0x24bb('0x23')];_0x470754['CmHopper'][_0x24bb('0x2b')]({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587['ListId'],'scheduledat':_0x5b9587[_0x24bb('0x19')]?_0x5b9587[_0x24bb('0x19')]:moment()[_0x24bb('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x5b9587[_0x24bb('0x26')]?_0x5b9587[_0x24bb('0x26')]:0x2,'callback':_0x5b9587[_0x24bb('0x27')]?!![]:![],'callbackuniqueid':_0x5b9587[_0x24bb('0x27')]?_0x5b9587[_0x24bb('0x27')]:undefined,'callbackat':_0x5b9587[_0x24bb('0x27')]?moment()[_0x24bb('0x1a')](_0x24bb('0x1b')):undefined,'VoiceQueueId':_0x189c9b['id']})[_0x24bb('0x28')](_0x2dfa1c());});}}}})[_0x24bb('0x1f')](function(){return _0x470754[_0x24bb('0x1d')]['findAll']({'where':{'type':_0x24bb('0x36')},'attributes':['id'],'include':[{'model':_0x470754['CmList'],'as':_0x24bb('0x3e'),'where':{'id':_0x5b9587[_0x24bb('0x25')]}}]})[_0x24bb('0x1f')](function(_0x3cfe62){if(_0x3cfe62){var _0xa6bfb1=[];for(var _0x3a0685=0x0,_0x1022bf;_0x3a0685<_0x3cfe62[_0x24bb('0x3a')];_0x3a0685+=0x1){_0x1022bf=_0x3cfe62[_0x3a0685][_0x24bb('0x3b')]({'plain':!![]});_0x470754['CmHopperBlack'][_0x24bb('0x2b')]({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587[_0x24bb('0x25')],'VoiceQueueId':_0x1022bf['id']})[_0x24bb('0x28')](function(_0x4e656c){logger[_0x24bb('0x2c')](_0x24bb('0x3f'),'afterCreate',_0x4e656c[_0x24bb('0x40')]);});}}});})[_0x24bb('0x1f')](function(){return _0x470754['Campaign'][_0x24bb('0x41')]({'attributes':['id',_0x24bb('0x37'),'dialTimezone'],'include':[{'model':_0x470754[_0x24bb('0x38')],'as':_0x24bb('0x39'),'where':{'id':_0x5b9587[_0x24bb('0x25')]}}]})[_0x24bb('0x1f')](function(_0x2d57e9){if(_0x2d57e9){var _0x5f1a72=[];for(var _0x56f797=0x0,_0x367156;_0x56f797<_0x2d57e9[_0x24bb('0x3a')];_0x56f797+=0x1){_0x367156=_0x2d57e9[_0x56f797][_0x24bb('0x3b')]({'plain':!![]});switch(_0x367156['dialCheckDuplicateType']){case _0x24bb('0x3c'):_0x50e3ef(_0x367156)['catch'](_0x1817da());break;case'onlyIfOpen':_0x18fe3c(_0x367156)['catch'](_0x1817da());break;default:_0x470754[_0x24bb('0x24')]['create']({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587[_0x24bb('0x25')],'scheduledat':_0x5b9587['scheduledat']?_0x5b9587[_0x24bb('0x19')]:moment()[_0x24bb('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x5b9587[_0x24bb('0x26')]?_0x5b9587[_0x24bb('0x26')]:0x2,'callback':_0x5b9587[_0x24bb('0x27')]?!![]:![],'callbackuniqueid':_0x5b9587[_0x24bb('0x27')]?_0x5b9587['callbackUniqueid']:undefined,'callbackat':_0x5b9587['callbackUniqueid']?moment()[_0x24bb('0x1a')](_0x24bb('0x1b')):undefined,'CampaignId':_0x367156['id']})[_0x24bb('0x28')](_0x1817da());}}}});})[_0x24bb('0x1f')](function(){return _0x470754[_0x24bb('0x2e')][_0x24bb('0x41')]({'attributes':['id'],'include':[{'model':_0x470754['CmList'],'as':'BlackLists','where':{'id':_0x5b9587[_0x24bb('0x25')]}}]})['then'](function(_0x388a88){if(_0x388a88){var _0x1fd7c6=[];for(var _0x2c1a5a=0x0,_0x253e03;_0x2c1a5a<_0x388a88['length'];_0x2c1a5a+=0x1){_0x253e03=_0x388a88[_0x2c1a5a][_0x24bb('0x3b')]({'plain':!![]});_0x470754['CmHopperBlack'][_0x24bb('0x2b')]({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587[_0x24bb('0x25')],'CampaignId':_0x253e03['id']})[_0x24bb('0x28')](function(_0x1f0569){logger[_0x24bb('0x2c')]('cmContact,\x20%s,\x20%s',_0x24bb('0x2d'),_0x1f0569[_0x24bb('0x40')]);});}}});})[_0x24bb('0x1f')](function(){_0xbdfee0();})[_0x24bb('0x28')](function(_0xe3c52a){logger['error'](_0x24bb('0x3f'),_0x24bb('0x2d'),_0xe3c52a[_0x24bb('0x40')]);_0xbdfee0(_0xe3c52a);});}else{_0xbdfee0(new Error(_0x24bb('0x42')));}},'afterDestroy':function(_0x19614b,_0x229db8,_0x4d1ab9){var _0x358718=_0x3cab2a[_0x24bb('0x16')];var _0x126947=_0x19614b[_0x24bb('0x3b')]({'plain':!![]});return _0x358718['CmHopper'][_0x24bb('0x41')]({'raw':!![],'where':{'ListId':_0x126947[_0x24bb('0x25')],'ContactId':_0x126947['id']}})['then'](function(_0x1cc0f1){if(!_[_0x24bb('0x43')](_0x1cc0f1)){var _0x27d17a=[];for(var _0x16f8ea=0x0;_0x16f8ea<_0x1cc0f1[_0x24bb('0x3a')];_0x16f8ea+=0x1){var _0x1e922b=_0x358718[_0x24bb('0x24')][_0x24bb('0x44')]({'where':{'ListId':_0x1cc0f1[_0x16f8ea][_0x24bb('0x25')],'ContactId':_0x1cc0f1[_0x16f8ea][_0x24bb('0x45')],'VoiceQueueId':_0x1cc0f1[_0x16f8ea][_0x24bb('0x46')],'CampaignId':_0x1cc0f1[_0x16f8ea]['CampaignId']}});_0x27d17a[_0x24bb('0x47')](_0x1e922b);}return BPromise[_0x24bb('0x48')](_0x27d17a);}})[_0x24bb('0x1f')](function(_0x2fec7){logger[_0x24bb('0x49')](_0x24bb('0x4a'),util[_0x24bb('0x18')](_0x2fec7,{'showHidden':![],'depth':null}));_0x4d1ab9();})[_0x24bb('0x28')](function(_0x53d063){logger[_0x24bb('0x2c')]('[CmContact][afterDestroy][Error]',util[_0x24bb('0x18')](_0x53d063,{'showHidden':![],'depth':null}));_0x4d1ab9(_0x53d063);});}}});}; \ No newline at end of file +var _0xa643=['phone','fti_cm_contacts','firstName','mobile','email','FULLTEXT','utf8mb4_unicode_ci','models','get','error','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','findOne','then','isNil','timezones','utcOffset','add','minutes','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','create','cmContact','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','bluebird','../../config/environment','../../config/environment/shared','./cmContact.attributes','define','CmContact','cm_contacts'];(function(_0x47642a,_0x5c2651){var _0x1d674f=function(_0x1e4606){while(--_0x1e4606){_0x47642a['push'](_0x47642a['shift']());}};_0x1d674f(++_0x5c2651);}(_0xa643,0x119));var _0x3a64=function(_0x2cdf84,_0x5ed00f){_0x2cdf84=_0x2cdf84-0x0;var _0x2af121=_0xa643[_0x2cdf84];return _0x2af121;};'use strict';var _=require('lodash');var util=require(_0x3a64('0x0'));var logger=require(_0x3a64('0x1'))(_0x3a64('0x2'));var moment=require(_0x3a64('0x3'));var BPromise=require(_0x3a64('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3a64('0x5'));var shared=require(_0x3a64('0x6'));var attributes=require(_0x3a64('0x7'));module['exports']=function(_0x49c31d,_0x53c635){return _0x49c31d[_0x3a64('0x8')](_0x3a64('0x9'),attributes,{'tableName':_0x3a64('0xa'),'paranoid':!![],'indexes':[{'name':_0x3a64('0xb'),'fields':[_0x3a64('0xb')]},{'name':_0x3a64('0xc'),'fields':[_0x3a64('0xd'),'lastName',_0x3a64('0xb'),_0x3a64('0xe'),'fax',_0x3a64('0xf')],'type':_0x3a64('0x10')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x3a64('0x11'),'hooks':{'afterCreate':function(_0x31c1e3,_0x55396d,_0xf320c3){var _0x2df44b=_0x49c31d[_0x3a64('0x12')];var _0x4a54fc=_0x31c1e3[_0x3a64('0x13')]({'plain':!![]});function _0x3f0515(){return function(_0x16a8ab){logger[_0x3a64('0x14')]('cmContact',_0x3a64('0x15'),util[_0x3a64('0x16')](_0x16a8ab,{'showHidden':![],'depth':null}));};}function _0x348b54(_0x227da0,_0x2d0327){var _0x3d69b7=_0x2d0327[_0x3a64('0x17')]?_0x2d0327['scheduledat']:moment()[_0x3a64('0x18')](_0x3a64('0x19'));return new BPromise(function(_0x41b46d,_0x258dd6){if(_['isNil'](_0x2d0327[_0x3a64('0x1a')])){_0x41b46d({'ret':_0x3d69b7});}else{_0x2df44b['VoiceQueue'][_0x3a64('0x1b')]({'where':{'id':_0x227da0['id']}})[_0x3a64('0x1c')](function(_0x1f103e){if(!_[_0x3a64('0x1d')](_0x1f103e)){var _0x11074a=_0x1f103e[_0x3a64('0x1a')];if(!_[_0x3a64('0x1d')](_0x11074a)){var _0x15a4bd=shared[_0x3a64('0x1e')];var _0x2f8b48=_0x15a4bd[_0x11074a];var _0x19b2e0=_0x15a4bd[_0x2d0327['dialTimezone']];if(!_[_0x3a64('0x1d')](_0x2f8b48)&&!_[_0x3a64('0x1d')](_0x19b2e0)){var _0x15991a=_0x2f8b48[_0x3a64('0x1f')]-_0x19b2e0[_0x3a64('0x1f')];_0x3d69b7=_0x2d0327[_0x3a64('0x17')]?_0x2d0327['scheduledat']:moment();var _0x48f6fc=moment(_0x3d69b7)[_0x3a64('0x20')](_0x15991a,_0x3a64('0x21'));_0x41b46d({'ret':_0x48f6fc[_0x3a64('0x18')](_0x3a64('0x19'))});}else _0x41b46d({'ret':_0x3d69b7});}else _0x41b46d({'ret':_0x3d69b7});}else{_0x41b46d({'ret':_0x3d69b7});}});}});return 0xa;}var _0x21c8f3=function(_0x2ea3ba){return new BPromise(function(_0x9be972,_0x307deb){_0x348b54(_0x2ea3ba,_0x4a54fc)[_0x3a64('0x1c')](function(_0x8e54f9){_0x4a54fc[_0x3a64('0x17')]=_0x8e54f9[_0x3a64('0x22')];_0x2df44b['CmHopper']['findOne']({'where':{'phone':_0x4a54fc[_0x3a64('0xb')],'VoiceQueueId':_0x2ea3ba['id']}})[_0x3a64('0x1c')](function(_0x4b108d){if(!_[_0x3a64('0x1d')](_0x4b108d)){throw new Error(_0x3a64('0x23')+_0x4a54fc[_0x3a64('0xb')]+_0x3a64('0x24')+_0x2ea3ba['id']);}return _0x2df44b[_0x3a64('0x25')]['create']({'phone':_0x4a54fc['phone'],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc[_0x3a64('0x26')],'priority':_0x4a54fc[_0x3a64('0x27')]?_0x4a54fc['priority']:0x2,'scheduledat':_0x4a54fc[_0x3a64('0x17')]?_0x4a54fc['scheduledat']:moment()[_0x3a64('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4a54fc[_0x3a64('0x28')]?!![]:![],'callbackuniqueid':_0x4a54fc[_0x3a64('0x28')]?_0x4a54fc[_0x3a64('0x28')]:undefined,'callbackat':_0x4a54fc[_0x3a64('0x28')]?moment()[_0x3a64('0x18')](_0x3a64('0x19')):undefined,'VoiceQueueId':_0x2ea3ba['id']});})[_0x3a64('0x29')](function(_0x426f6e){_0x307deb(_0x426f6e);});});});};var _0x1af555=function(_0x521db1){return new BPromise(function(_0x244ebb,_0x548964){_0x348b54(_0x521db1,_0x4a54fc)[_0x3a64('0x1c')](function(_0x40314f){_0x4a54fc['scheduledat']=_0x40314f[_0x3a64('0x22')];_0x2df44b[_0x3a64('0x25')][_0x3a64('0x1b')]({'where':{'phone':_0x4a54fc[_0x3a64('0xb')],'VoiceQueueId':_0x521db1['id']}})['then'](function(_0x35c9ce){if(!_[_0x3a64('0x1d')](_0x35c9ce)){throw new Error(_0x3a64('0x23')+_0x4a54fc[_0x3a64('0xb')]+_0x3a64('0x2a')+_0x521db1['id']);}return _0x2df44b[_0x3a64('0x2b')][_0x3a64('0x1b')]({'where':{'calleridnum':_0x4a54fc[_0x3a64('0xb')],'VoiceQueueId':_0x521db1['id']}});})[_0x3a64('0x1c')](function(_0x89b2c2){if(!_['isNil'](_0x89b2c2)){throw new Error(_0x3a64('0x2c')+_0x4a54fc[_0x3a64('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x521db1['id']);}return _0x2df44b[_0x3a64('0x25')][_0x3a64('0x2d')]({'phone':_0x4a54fc[_0x3a64('0xb')],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc[_0x3a64('0x26')],'priority':_0x4a54fc['priority']?_0x4a54fc[_0x3a64('0x27')]:0x2,'scheduledat':_0x4a54fc[_0x3a64('0x17')]?_0x4a54fc['scheduledat']:moment()[_0x3a64('0x18')](_0x3a64('0x19')),'callback':_0x4a54fc[_0x3a64('0x28')]?!![]:![],'callbackuniqueid':_0x4a54fc['callbackUniqueid']?_0x4a54fc[_0x3a64('0x28')]:undefined,'callbackat':_0x4a54fc[_0x3a64('0x28')]?moment()[_0x3a64('0x18')](_0x3a64('0x19')):undefined,'VoiceQueueId':_0x521db1['id']});})[_0x3a64('0x29')](function(_0x1bd3fc){_0x548964(_0x1bd3fc);});});});};function _0x4c69a3(){return function(_0x11e727){logger['error'](_0x3a64('0x2e'),'afterCreate',util[_0x3a64('0x16')](_0x11e727,{'showHidden':![],'depth':null}));};}function _0x1b2937(_0x4e7ad2,_0x1198d6){var _0x280bf9=_0x1198d6[_0x3a64('0x17')]?_0x1198d6[_0x3a64('0x17')]:moment()[_0x3a64('0x18')](_0x3a64('0x19'));return new BPromise(function(_0xd80f29,_0x3519eb){if(_[_0x3a64('0x1d')](_0x1198d6['dialTimezone'])){_0xd80f29({'ret':_0x280bf9});}else{_0x2df44b[_0x3a64('0x2f')][_0x3a64('0x1b')]({'where':{'id':_0x4e7ad2['id']}})['then'](function(_0x313d58){if(!_[_0x3a64('0x1d')](_0x313d58)){var _0x44285c=_0x313d58[_0x3a64('0x1a')];if(!_['isNil'](_0x44285c)){var _0x4701e4=shared[_0x3a64('0x1e')];var _0x2e175b=_0x4701e4[_0x44285c];var _0x1fbff5=_0x4701e4[_0x1198d6[_0x3a64('0x1a')]];if(!_['isNil'](_0x2e175b)&&!_[_0x3a64('0x1d')](_0x1fbff5)){var _0x5dec10=_0x2e175b[_0x3a64('0x1f')]-_0x1fbff5[_0x3a64('0x1f')];_0x280bf9=_0x1198d6[_0x3a64('0x17')]?_0x1198d6[_0x3a64('0x17')]:moment();var _0x1653a3=moment(_0x280bf9)[_0x3a64('0x20')](_0x5dec10,'minutes');_0xd80f29({'ret':_0x1653a3[_0x3a64('0x18')](_0x3a64('0x19'))});}else _0xd80f29({'ret':_0x280bf9});}else _0xd80f29({'ret':_0x280bf9});}else{_0xd80f29({'ret':_0x280bf9});}});}});return 0xa;}var _0x3d7c3b=function(_0x2c0478){return new BPromise(function(_0x467355,_0x528f64){_0x1b2937(_0x2c0478,_0x4a54fc)[_0x3a64('0x1c')](function(_0x5938fa){_0x4a54fc[_0x3a64('0x17')]=_0x5938fa[_0x3a64('0x22')];_0x2df44b[_0x3a64('0x25')]['findOne']({'where':{'phone':_0x4a54fc[_0x3a64('0xb')],'CampaignId':_0x2c0478['id']}})['then'](function(_0xb19267){if(!_[_0x3a64('0x1d')](_0xb19267)){throw new Error(_0x3a64('0x23')+_0x4a54fc[_0x3a64('0xb')]+_0x3a64('0x30')+_0x2c0478['id']);}return _0x2df44b[_0x3a64('0x25')][_0x3a64('0x2d')]({'phone':_0x4a54fc['phone'],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc['ListId'],'priority':_0x4a54fc[_0x3a64('0x27')]?_0x4a54fc[_0x3a64('0x27')]:0x2,'scheduledat':_0x4a54fc['scheduledat']?_0x4a54fc[_0x3a64('0x17')]:moment()[_0x3a64('0x18')](_0x3a64('0x19')),'callback':_0x4a54fc[_0x3a64('0x28')]?!![]:![],'callbackuniqueid':_0x4a54fc[_0x3a64('0x28')]?_0x4a54fc['callbackUniqueid']:undefined,'callbackat':_0x4a54fc[_0x3a64('0x28')]?moment()[_0x3a64('0x18')](_0x3a64('0x19')):undefined,'CampaignId':_0x2c0478['id']});})['catch'](function(_0x4f9bed){_0x528f64(_0x4f9bed);});});});};var _0x2dddd2=function(_0x5a2129){return new BPromise(function(_0x19a776,_0x114e98){_0x1b2937(_0x5a2129,_0x4a54fc)['then'](function(_0x413f43){_0x4a54fc[_0x3a64('0x17')]=_0x413f43[_0x3a64('0x22')];_0x2df44b[_0x3a64('0x25')]['findOne']({'where':{'phone':_0x4a54fc[_0x3a64('0xb')],'CampaignId':_0x5a2129['id']}})['then'](function(_0x4427d2){if(!_[_0x3a64('0x1d')](_0x4427d2)){throw new Error(_0x3a64('0x23')+_0x4a54fc[_0x3a64('0xb')]+_0x3a64('0x31')+_0x5a2129['id']);}return _0x2df44b['CmHopperFinal'][_0x3a64('0x1b')]({'where':{'calleridnum':_0x4a54fc[_0x3a64('0xb')],'CampaignId':_0x5a2129['id']}});})[_0x3a64('0x1c')](function(_0x1e91a0){if(!_['isNil'](_0x1e91a0)){throw new Error(_0x3a64('0x2c')+_0x4a54fc['phone']+_0x3a64('0x32')+_0x5a2129['id']);}return _0x2df44b[_0x3a64('0x25')][_0x3a64('0x2d')]({'phone':_0x4a54fc[_0x3a64('0xb')],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc[_0x3a64('0x26')],'priority':_0x4a54fc[_0x3a64('0x27')]?_0x4a54fc[_0x3a64('0x27')]:0x2,'scheduledat':_0x4a54fc[_0x3a64('0x17')]?_0x4a54fc[_0x3a64('0x17')]:moment()[_0x3a64('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4a54fc[_0x3a64('0x28')]?!![]:![],'callbackuniqueid':_0x4a54fc['callbackUniqueid']?_0x4a54fc[_0x3a64('0x28')]:undefined,'callbackat':_0x4a54fc[_0x3a64('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5a2129['id']});})['catch'](function(_0x4d9c36){_0x114e98(_0x4d9c36);});});});};if(_0x4a54fc[_0x3a64('0x26')]){_0x2df44b[_0x3a64('0x33')][_0x3a64('0x34')]({'where':{'type':_0x3a64('0x35')},'attributes':['id',_0x3a64('0x36'),_0x3a64('0x1a')],'include':[{'model':_0x2df44b[_0x3a64('0x37')],'as':_0x3a64('0x38'),'where':{'id':_0x4a54fc[_0x3a64('0x26')]}}]})[_0x3a64('0x1c')](function(_0x5d21ae){if(_0x5d21ae){var _0x30a450=[];for(var _0x400874=0x0,_0x1ac2e7;_0x400874<_0x5d21ae['length'];_0x400874+=0x1){_0x1ac2e7=_0x5d21ae[_0x400874][_0x3a64('0x13')]({'plain':!![]});switch(_0x1ac2e7[_0x3a64('0x36')]){case _0x3a64('0x39'):_0x1af555(_0x1ac2e7)[_0x3a64('0x29')](_0x3f0515());break;case _0x3a64('0x3a'):_0x21c8f3(_0x1ac2e7)[_0x3a64('0x29')](_0x3f0515());break;default:_0x1b2937(_0x1ac2e7,_0x4a54fc)[_0x3a64('0x1c')](function(_0x43c889){_0x4a54fc[_0x3a64('0x17')]=_0x43c889[_0x3a64('0x22')];_0x2df44b[_0x3a64('0x25')][_0x3a64('0x2d')]({'phone':_0x4a54fc[_0x3a64('0xb')],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc[_0x3a64('0x26')],'scheduledat':_0x4a54fc[_0x3a64('0x17')]?_0x4a54fc[_0x3a64('0x17')]:moment()[_0x3a64('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x4a54fc[_0x3a64('0x27')]?_0x4a54fc['priority']:0x2,'callback':_0x4a54fc[_0x3a64('0x28')]?!![]:![],'callbackuniqueid':_0x4a54fc[_0x3a64('0x28')]?_0x4a54fc[_0x3a64('0x28')]:undefined,'callbackat':_0x4a54fc[_0x3a64('0x28')]?moment()[_0x3a64('0x18')](_0x3a64('0x19')):undefined,'VoiceQueueId':_0x1ac2e7['id']})[_0x3a64('0x29')](_0x3f0515());});}}}})['then'](function(){return _0x2df44b[_0x3a64('0x33')]['findAll']({'where':{'type':_0x3a64('0x35')},'attributes':['id'],'include':[{'model':_0x2df44b[_0x3a64('0x37')],'as':_0x3a64('0x3b'),'where':{'id':_0x4a54fc[_0x3a64('0x26')]}}]})[_0x3a64('0x1c')](function(_0x4bef6a){if(_0x4bef6a){var _0x16419c=[];for(var _0x33a7d9=0x0,_0x464bb4;_0x33a7d9<_0x4bef6a[_0x3a64('0x3c')];_0x33a7d9+=0x1){_0x464bb4=_0x4bef6a[_0x33a7d9][_0x3a64('0x13')]({'plain':!![]});_0x2df44b[_0x3a64('0x3d')][_0x3a64('0x2d')]({'phone':_0x4a54fc['phone'],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc[_0x3a64('0x26')],'VoiceQueueId':_0x464bb4['id']})[_0x3a64('0x29')](function(_0x1d0f5c){logger[_0x3a64('0x14')](_0x3a64('0x3e'),'afterCreate',_0x1d0f5c[_0x3a64('0x3f')]);});}}});})[_0x3a64('0x1c')](function(){return _0x2df44b[_0x3a64('0x2f')][_0x3a64('0x34')]({'attributes':['id',_0x3a64('0x36'),_0x3a64('0x1a')],'include':[{'model':_0x2df44b[_0x3a64('0x37')],'as':_0x3a64('0x38'),'where':{'id':_0x4a54fc[_0x3a64('0x26')]}}]})[_0x3a64('0x1c')](function(_0x1c08b1){if(_0x1c08b1){var _0x37f504=[];for(var _0x13af15=0x0,_0xea20df;_0x13af15<_0x1c08b1[_0x3a64('0x3c')];_0x13af15+=0x1){_0xea20df=_0x1c08b1[_0x13af15][_0x3a64('0x13')]({'plain':!![]});switch(_0xea20df['dialCheckDuplicateType']){case'always':_0x2dddd2(_0xea20df)[_0x3a64('0x29')](_0x4c69a3());break;case _0x3a64('0x3a'):_0x3d7c3b(_0xea20df)['catch'](_0x4c69a3());break;default:_0x2df44b[_0x3a64('0x25')]['create']({'phone':_0x4a54fc['phone'],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc['ListId'],'scheduledat':_0x4a54fc[_0x3a64('0x17')]?_0x4a54fc[_0x3a64('0x17')]:moment()[_0x3a64('0x18')](_0x3a64('0x19')),'priority':_0x4a54fc[_0x3a64('0x27')]?_0x4a54fc[_0x3a64('0x27')]:0x2,'callback':_0x4a54fc[_0x3a64('0x28')]?!![]:![],'callbackuniqueid':_0x4a54fc[_0x3a64('0x28')]?_0x4a54fc[_0x3a64('0x28')]:undefined,'callbackat':_0x4a54fc[_0x3a64('0x28')]?moment()[_0x3a64('0x18')](_0x3a64('0x19')):undefined,'CampaignId':_0xea20df['id']})['catch'](_0x4c69a3());}}}});})[_0x3a64('0x1c')](function(){return _0x2df44b[_0x3a64('0x2f')][_0x3a64('0x34')]({'attributes':['id'],'include':[{'model':_0x2df44b['CmList'],'as':'BlackLists','where':{'id':_0x4a54fc[_0x3a64('0x26')]}}]})[_0x3a64('0x1c')](function(_0x26e5eb){if(_0x26e5eb){var _0x15947d=[];for(var _0x4c9075=0x0,_0x2f18fd;_0x4c9075<_0x26e5eb[_0x3a64('0x3c')];_0x4c9075+=0x1){_0x2f18fd=_0x26e5eb[_0x4c9075][_0x3a64('0x13')]({'plain':!![]});_0x2df44b[_0x3a64('0x3d')]['create']({'phone':_0x4a54fc[_0x3a64('0xb')],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc[_0x3a64('0x26')],'CampaignId':_0x2f18fd['id']})['catch'](function(_0x20c0e4){logger[_0x3a64('0x14')](_0x3a64('0x3e'),_0x3a64('0x15'),_0x20c0e4[_0x3a64('0x3f')]);});}}});})[_0x3a64('0x1c')](function(){_0xf320c3();})[_0x3a64('0x29')](function(_0xbc1080){logger[_0x3a64('0x14')]('cmContact,\x20%s,\x20%s','afterCreate',_0xbc1080[_0x3a64('0x3f')]);_0xf320c3(_0xbc1080);});}else{_0xf320c3(new Error(_0x3a64('0x40')));}},'afterDestroy':function(_0x28b6e0,_0x3a350a,_0x3fa957){var _0x5bdb5b=_0x49c31d['models'];var _0x547937=_0x28b6e0['get']({'plain':!![]});return _0x5bdb5b['CmHopper'][_0x3a64('0x34')]({'raw':!![],'where':{'ListId':_0x547937[_0x3a64('0x26')],'ContactId':_0x547937['id']}})[_0x3a64('0x1c')](function(_0x4ae22a){if(!_['isEmpty'](_0x4ae22a)){var _0x3a007f=[];for(var _0x1acd5f=0x0;_0x1acd5f<_0x4ae22a[_0x3a64('0x3c')];_0x1acd5f+=0x1){var _0x3a6d91=_0x5bdb5b['CmHopper'][_0x3a64('0x41')]({'where':{'ListId':_0x4ae22a[_0x1acd5f][_0x3a64('0x26')],'ContactId':_0x4ae22a[_0x1acd5f][_0x3a64('0x42')],'VoiceQueueId':_0x4ae22a[_0x1acd5f][_0x3a64('0x43')],'CampaignId':_0x4ae22a[_0x1acd5f]['CampaignId']}});_0x3a007f[_0x3a64('0x44')](_0x3a6d91);}return BPromise[_0x3a64('0x45')](_0x3a007f);}})[_0x3a64('0x1c')](function(_0x19817e){logger[_0x3a64('0x46')](_0x3a64('0x47'),util[_0x3a64('0x16')](_0x19817e,{'showHidden':![],'depth':null}));_0x3fa957();})['catch'](function(_0x1efb0b){logger[_0x3a64('0x14')](_0x3a64('0x48'),util[_0x3a64('0x16')](_0x1efb0b,{'showHidden':![],'depth':null}));_0x3fa957(_0x1efb0b);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 10d94a1..3848d19 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 _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_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 squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\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(_0x16cd88,_0x350729){var _0x4b8f22=function(_0x38cf3d){while(--_0x38cf3d){_0x16cd88['push'](_0x16cd88['shift']());}};_0x4b8f22(++_0x350729);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 3565de3..237d1db 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 _0xa25c=['INTEGER','STRING','PHONE','exports'];(function(_0x23d5c9,_0x51be1b){var _0x1b23a1=function(_0x5a0b45){while(--_0x5a0b45){_0x23d5c9['push'](_0x23d5c9['shift']());}};_0x1b23a1(++_0x51be1b);}(_0xa25c,0x13f));var _0xca25=function(_0x390b40,_0x32a62e){_0x390b40=_0x390b40-0x0;var _0x11a416=_0xa25c[_0x390b40];return _0x11a416;};'use strict';var Sequelize=require('sequelize');module[_0xca25('0x0')]={'CmContactId':{'type':Sequelize[_0xca25('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xca25('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xca25('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xca25('0x2')],'defaultValue':_0xca25('0x3')},'OrderBy':{'type':Sequelize[_0xca25('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xca25('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x9990=['STRING','PHONE','exports','INTEGER'];(function(_0x33d020,_0x5249f4){var _0xc3bfca=function(_0x459212){while(--_0x459212){_0x33d020['push'](_0x33d020['shift']());}};_0xc3bfca(++_0x5249f4);}(_0x9990,0xf6));var _0x0999=function(_0x158988,_0x30addd){_0x158988=_0x158988-0x0;var _0x2bd5cd=_0x9990[_0x158988];return _0x2bd5cd;};'use strict';var Sequelize=require('sequelize');module[_0x0999('0x0')]={'CmContactId':{'type':Sequelize[_0x0999('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x0999('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x0999('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x0999('0x2')],'defaultValue':_0x0999('0x3')},'OrderBy':{'type':Sequelize[_0x0999('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x0999('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 36405e8..edbeb24 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 _0x8fff=['ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','set','reject','update','destroy','then','UserProfileResource','end','error','stack','name','index','map','CmContactHasItem','fieldName','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','keys','rawAttributes','find','create','body','user','get','role','CmContactHasItems','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse'];(function(_0x292a48,_0xb843c3){var _0x2b1a2d=function(_0x184ccd){while(--_0x184ccd){_0x292a48['push'](_0x292a48['shift']());}};_0x2b1a2d(++_0xb843c3);}(_0x8fff,0x1ac));var _0xf8ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fff[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf8ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf8ff('0x1'));var jsonpatch=require(_0xf8ff('0x2'));var rp=require(_0xf8ff('0x3'));var moment=require(_0xf8ff('0x4'));var BPromise=require(_0xf8ff('0x5'));var Mustache=require(_0xf8ff('0x6'));var util=require(_0xf8ff('0x7'));var path=require('path');var sox=require(_0xf8ff('0x8'));var csv=require('to-csv');var ejs=require(_0xf8ff('0x9'));var fs=require('fs');var fs_extra=require(_0xf8ff('0xa'));var _=require('lodash');var squel=require(_0xf8ff('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf8ff('0xc'));var toCsv=require(_0xf8ff('0xd'));var querystring=require(_0xf8ff('0xe'));var Papa=require(_0xf8ff('0xf'));var Redis=require(_0xf8ff('0x10'));var authService=require(_0xf8ff('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf8ff('0x12'));var utils=require(_0xf8ff('0x13'));var config=require(_0xf8ff('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f13f2,_0x343700){_0x343700=_0x343700||0xcc;return function(_0x33f540){if(_0x33f540){return _0x2f13f2[_0xf8ff('0x15')](_0x343700);}return _0x2f13f2[_0xf8ff('0x16')](_0x343700)['end']();};}function respondWithResult(_0x514323,_0x30f28c){_0x30f28c=_0x30f28c||0xc8;return function(_0x249b2d){if(_0x249b2d){return _0x514323[_0xf8ff('0x16')](_0x30f28c)[_0xf8ff('0x17')](_0x249b2d);}};}function respondWithFilteredResult(_0x4db919,_0x5ea406){return function(_0x34f93b){if(_0x34f93b){var _0x201ed9=typeof _0x5ea406[_0xf8ff('0x18')]==='undefined'&&typeof _0x5ea406[_0xf8ff('0x19')]===_0xf8ff('0x1a');var _0x62e52f=_0x34f93b[_0xf8ff('0x1b')];var _0x1a8be1=_0x201ed9?0x0:_0x5ea406[_0xf8ff('0x18')];var _0x212f61=_0x201ed9?_0x34f93b[_0xf8ff('0x1b')]:_0x5ea406[_0xf8ff('0x18')]+_0x5ea406[_0xf8ff('0x19')];var _0x5d6d9a;if(_0x212f61>=_0x62e52f){_0x212f61=_0x62e52f;_0x5d6d9a=0xc8;}else{_0x5d6d9a=0xce;}_0x4db919[_0xf8ff('0x16')](_0x5d6d9a);return _0x4db919[_0xf8ff('0x1c')]('Content-Range',_0x1a8be1+'-'+_0x212f61+'/'+_0x62e52f)[_0xf8ff('0x17')](_0x34f93b);}return null;};}function patchUpdates(_0x193f28){return function(_0x4ec53f){try{jsonpatch['apply'](_0x4ec53f,_0x193f28,!![]);}catch(_0x3d6dc2){return BPromise[_0xf8ff('0x1d')](_0x3d6dc2);}return _0x4ec53f['save']();};}function saveUpdates(_0x3f6449,_0x32d2df){return function(_0x307d91){if(_0x307d91){return _0x307d91[_0xf8ff('0x1e')](_0x3f6449)['then'](function(_0x4ae326){return _0x4ae326;});}return null;};}function removeEntity(_0x45b999,_0x58509d){return function(_0x549de1){if(_0x549de1){return _0x549de1[_0xf8ff('0x1f')]()[_0xf8ff('0x20')](function(){var _0x4e5980=_0x549de1['get']({'plain':!![]});var _0x6c6c6b='CmContactHasItems';return db[_0xf8ff('0x21')][_0xf8ff('0x1f')]({'where':{'type':_0x6c6c6b,'resourceId':_0x4e5980['id']}})[_0xf8ff('0x20')](function(){return _0x549de1;});})['then'](function(){_0x45b999['status'](0xcc)[_0xf8ff('0x22')]();});}};}function handleEntityNotFound(_0x2930bb,_0x2a9ef0){return function(_0xdb8828){if(!_0xdb8828){_0x2930bb[_0xf8ff('0x15')](0x194);}return _0xdb8828;};}function handleError(_0xe88fd6,_0x4bcb3a){_0x4bcb3a=_0x4bcb3a||0x1f4;return function(_0x48423d){logger[_0xf8ff('0x23')](_0x48423d[_0xf8ff('0x24')]);if(_0x48423d[_0xf8ff('0x25')]){delete _0x48423d[_0xf8ff('0x25')];}_0xe88fd6[_0xf8ff('0x16')](_0x4bcb3a)['send'](_0x48423d);};}exports[_0xf8ff('0x26')]=function(_0x1ffcc7,_0x352617){var _0x1a1228={},_0x3b74af={},_0x1ff9bf={'count':0x0,'rows':[]};var _0x7dfc5=_[_0xf8ff('0x27')](db[_0xf8ff('0x28')]['rawAttributes'],function(_0x326207){return{'name':_0x326207[_0xf8ff('0x29')],'type':_0x326207['type']['key']};});_0x3b74af[_0xf8ff('0x2a')]=_['map'](_0x7dfc5,_0xf8ff('0x25'));_0x3b74af['query']=_['keys'](_0x1ffcc7[_0xf8ff('0x2b')]);_0x3b74af[_0xf8ff('0x2c')]=_['intersection'](_0x3b74af[_0xf8ff('0x2a')],_0x3b74af[_0xf8ff('0x2b')]);_0x1a1228[_0xf8ff('0x2d')]=_[_0xf8ff('0x2e')](_0x3b74af[_0xf8ff('0x2a')],qs[_0xf8ff('0x2f')](_0x1ffcc7['query']['fields']));_0x1a1228['attributes']=_0x1a1228[_0xf8ff('0x2d')]['length']?_0x1a1228[_0xf8ff('0x2d')]:_0x3b74af[_0xf8ff('0x2a')];if(!_0x1ffcc7[_0xf8ff('0x2b')][_0xf8ff('0x30')](_0xf8ff('0x31'))){_0x1a1228[_0xf8ff('0x19')]=qs[_0xf8ff('0x19')](_0x1ffcc7[_0xf8ff('0x2b')][_0xf8ff('0x19')]);_0x1a1228[_0xf8ff('0x18')]=qs[_0xf8ff('0x18')](_0x1ffcc7[_0xf8ff('0x2b')][_0xf8ff('0x18')]);}_0x1a1228[_0xf8ff('0x32')]=qs[_0xf8ff('0x33')](_0x1ffcc7[_0xf8ff('0x2b')]['sort']);_0x1a1228[_0xf8ff('0x34')]=qs['filters'](_[_0xf8ff('0x35')](_0x1ffcc7[_0xf8ff('0x2b')],_0x3b74af[_0xf8ff('0x2c')]),_0x7dfc5);if(_0x1ffcc7[_0xf8ff('0x2b')][_0xf8ff('0x36')]){_0x1a1228[_0xf8ff('0x34')]=_[_0xf8ff('0x37')](_0x1a1228[_0xf8ff('0x34')],{'$or':_['map'](_0x7dfc5,function(_0x5dff64){if(_0x5dff64[_0xf8ff('0x38')]!=='VIRTUAL'){var _0x7ea15b={};_0x7ea15b[_0x5dff64[_0xf8ff('0x25')]]={'$like':'%'+_0x1ffcc7['query'][_0xf8ff('0x36')]+'%'};return _0x7ea15b;}})});}_0x1a1228=_[_0xf8ff('0x37')]({},_0x1a1228,_0x1ffcc7[_0xf8ff('0x39')]);var _0x2f342c={'where':_0x1a1228[_0xf8ff('0x34')]};return db[_0xf8ff('0x28')][_0xf8ff('0x1b')](_0x2f342c)[_0xf8ff('0x20')](function(_0x47d62b){_0x1ff9bf[_0xf8ff('0x1b')]=_0x47d62b;if(_0x1ffcc7['query'][_0xf8ff('0x3a')]){_0x1a1228[_0xf8ff('0x3b')]=[{'all':!![]}];}return db[_0xf8ff('0x28')][_0xf8ff('0x3c')](_0x1a1228);})[_0xf8ff('0x20')](function(_0x502c6a){_0x1ff9bf['rows']=_0x502c6a;return _0x1ff9bf;})[_0xf8ff('0x20')](respondWithFilteredResult(_0x352617,_0x1a1228))[_0xf8ff('0x3d')](handleError(_0x352617,null));};exports['show']=function(_0xfbd8b4,_0x41c696){var _0x2f40db={'raw':!![],'where':{'id':_0xfbd8b4['params']['id']}},_0x2bd90b={};_0x2bd90b[_0xf8ff('0x2a')]=_[_0xf8ff('0x3e')](db[_0xf8ff('0x28')][_0xf8ff('0x3f')]);_0x2bd90b[_0xf8ff('0x2b')]=_[_0xf8ff('0x3e')](_0xfbd8b4['query']);_0x2bd90b[_0xf8ff('0x2c')]=_[_0xf8ff('0x2e')](_0x2bd90b['model'],_0x2bd90b[_0xf8ff('0x2b')]);_0x2f40db['attributes']=_[_0xf8ff('0x2e')](_0x2bd90b[_0xf8ff('0x2a')],qs[_0xf8ff('0x2f')](_0xfbd8b4['query'][_0xf8ff('0x2f')]));_0x2f40db[_0xf8ff('0x2d')]=_0x2f40db[_0xf8ff('0x2d')]['length']?_0x2f40db['attributes']:_0x2bd90b[_0xf8ff('0x2a')];if(_0xfbd8b4['query']['includeAll']){_0x2f40db[_0xf8ff('0x3b')]=[{'all':!![]}];}_0x2f40db=_[_0xf8ff('0x37')]({},_0x2f40db,_0xfbd8b4[_0xf8ff('0x39')]);return db[_0xf8ff('0x28')][_0xf8ff('0x40')](_0x2f40db)['then'](handleEntityNotFound(_0x41c696,null))['then'](respondWithResult(_0x41c696,null))[_0xf8ff('0x3d')](handleError(_0x41c696,null));};exports['create']=function(_0x4ae4eb,_0x33d11b){return db[_0xf8ff('0x28')][_0xf8ff('0x41')](_0x4ae4eb[_0xf8ff('0x42')],{})[_0xf8ff('0x20')](function(_0x246bf3){var _0x436742=_0x4ae4eb[_0xf8ff('0x43')][_0xf8ff('0x44')]({'plain':!![]});if(!_0x436742)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x436742[_0xf8ff('0x45')]==='user'){var _0x2f257d=_0x246bf3[_0xf8ff('0x44')]({'plain':!![]});var _0x290d91=_0xf8ff('0x46');return db[_0xf8ff('0x47')][_0xf8ff('0x40')]({'where':{'name':_0x290d91,'userProfileId':_0x436742['userProfileId']},'raw':!![]})['then'](function(_0x2b77f7){if(_0x2b77f7&&_0x2b77f7['autoAssociation']===0x0){return db[_0xf8ff('0x21')][_0xf8ff('0x41')]({'name':_0x2f257d[_0xf8ff('0x25')],'resourceId':_0x2f257d['id'],'type':_0x2b77f7[_0xf8ff('0x25')],'sectionId':_0x2b77f7['id']},{})[_0xf8ff('0x20')](function(){return _0x246bf3;});}else{return _0x246bf3;}})[_0xf8ff('0x3d')](function(_0x56a7ed){logger[_0xf8ff('0x23')](_0xf8ff('0x48'),_0x56a7ed);throw _0x56a7ed;});}return _0x246bf3;})[_0xf8ff('0x20')](respondWithResult(_0x33d11b,0xc9))[_0xf8ff('0x3d')](handleError(_0x33d11b,null));};exports['update']=function(_0x36b5d8,_0x396877){if(_0x36b5d8[_0xf8ff('0x42')]['id']){delete _0x36b5d8['body']['id'];}return db['CmContactHasItem'][_0xf8ff('0x40')]({'where':{'id':_0x36b5d8[_0xf8ff('0x49')]['id']}})[_0xf8ff('0x20')](handleEntityNotFound(_0x396877,null))[_0xf8ff('0x20')](saveUpdates(_0x36b5d8[_0xf8ff('0x42')],null))[_0xf8ff('0x20')](respondWithResult(_0x396877,null))['catch'](handleError(_0x396877,null));};exports[_0xf8ff('0x1f')]=function(_0x1e21f0,_0x460306){return db[_0xf8ff('0x28')][_0xf8ff('0x40')]({'where':{'id':_0x1e21f0[_0xf8ff('0x49')]['id']}})[_0xf8ff('0x20')](handleEntityNotFound(_0x460306,null))['then'](removeEntity(_0x460306,null))[_0xf8ff('0x3d')](handleError(_0x460306,null));}; \ No newline at end of file +var _0x02ae=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','apply','reject','save','destroy','then','get','CmContactHasItems','UserProfileResource','end','stack','name','send','index','map','rawAttributes','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','CmContactHasItem','count','includeAll','rows','catch','params','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs'];(function(_0x5d6448,_0x53522f){var _0x58c195=function(_0x200a2f){while(--_0x200a2f){_0x5d6448['push'](_0x5d6448['shift']());}};_0x58c195(++_0x53522f);}(_0x02ae,0x1c6));var _0xe02a=function(_0x11b1f9,_0x56ea40){_0x11b1f9=_0x11b1f9-0x0;var _0x443d2c=_0x02ae[_0x11b1f9];return _0x443d2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe02a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe02a('0x1'));var rp=require(_0xe02a('0x2'));var moment=require('moment');var BPromise=require(_0xe02a('0x3'));var Mustache=require('mustache');var util=require(_0xe02a('0x4'));var path=require('path');var sox=require(_0xe02a('0x5'));var csv=require(_0xe02a('0x6'));var ejs=require(_0xe02a('0x7'));var fs=require('fs');var fs_extra=require(_0xe02a('0x8'));var _=require(_0xe02a('0x9'));var squel=require('squel');var crypto=require(_0xe02a('0xa'));var jsforce=require(_0xe02a('0xb'));var deskjs=require(_0xe02a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe02a('0xd'));var Papa=require('papaparse');var Redis=require(_0xe02a('0xe'));var authService=require(_0xe02a('0xf'));var qs=require(_0xe02a('0x10'));var as=require(_0xe02a('0x11'));var hardwareService=require(_0xe02a('0x12'));var logger=require(_0xe02a('0x13'))(_0xe02a('0x14'));var utils=require(_0xe02a('0x15'));var config=require(_0xe02a('0x16'));var licenseUtil=require(_0xe02a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b9f4e,_0x50a47f){_0x50a47f=_0x50a47f||0xcc;return function(_0x435754){if(_0x435754){return _0x5b9f4e[_0xe02a('0x18')](_0x50a47f);}return _0x5b9f4e[_0xe02a('0x19')](_0x50a47f)['end']();};}function respondWithResult(_0x18f88a,_0x32a256){_0x32a256=_0x32a256||0xc8;return function(_0x987bc2){if(_0x987bc2){return _0x18f88a[_0xe02a('0x19')](_0x32a256)[_0xe02a('0x1a')](_0x987bc2);}};}function respondWithFilteredResult(_0x1d3662,_0x1ec544){return function(_0x188a9c){if(_0x188a9c){var _0x1387a9=typeof _0x1ec544[_0xe02a('0x1b')]==='undefined'&&typeof _0x1ec544[_0xe02a('0x1c')]===_0xe02a('0x1d');var _0x234afb=_0x188a9c['count'];var _0x4cf8b4=_0x1387a9?0x0:_0x1ec544[_0xe02a('0x1b')];var _0x3574af=_0x1387a9?_0x188a9c['count']:_0x1ec544[_0xe02a('0x1b')]+_0x1ec544[_0xe02a('0x1c')];var _0x16eaf8;if(_0x3574af>=_0x234afb){_0x3574af=_0x234afb;_0x16eaf8=0xc8;}else{_0x16eaf8=0xce;}_0x1d3662[_0xe02a('0x19')](_0x16eaf8);return _0x1d3662['set']('Content-Range',_0x4cf8b4+'-'+_0x3574af+'/'+_0x234afb)['json'](_0x188a9c);}return null;};}function patchUpdates(_0x509cca){return function(_0x11f9f5){try{jsonpatch[_0xe02a('0x1e')](_0x11f9f5,_0x509cca,!![]);}catch(_0x13fe4b){return BPromise[_0xe02a('0x1f')](_0x13fe4b);}return _0x11f9f5[_0xe02a('0x20')]();};}function saveUpdates(_0x236a2b,_0x3fff73){return function(_0x40880d){if(_0x40880d){return _0x40880d['update'](_0x236a2b)['then'](function(_0x54a4e8){return _0x54a4e8;});}return null;};}function removeEntity(_0x2c60e3,_0xa6cd01){return function(_0x208238){if(_0x208238){return _0x208238[_0xe02a('0x21')]()[_0xe02a('0x22')](function(){var _0x140957=_0x208238[_0xe02a('0x23')]({'plain':!![]});var _0x3a8ee3=_0xe02a('0x24');return db[_0xe02a('0x25')]['destroy']({'where':{'type':_0x3a8ee3,'resourceId':_0x140957['id']}})[_0xe02a('0x22')](function(){return _0x208238;});})[_0xe02a('0x22')](function(){_0x2c60e3[_0xe02a('0x19')](0xcc)[_0xe02a('0x26')]();});}};}function handleEntityNotFound(_0x222a21,_0x3463b9){return function(_0x12849c){if(!_0x12849c){_0x222a21[_0xe02a('0x18')](0x194);}return _0x12849c;};}function handleError(_0x4b79c6,_0x572522){_0x572522=_0x572522||0x1f4;return function(_0x1da55f){logger['error'](_0x1da55f[_0xe02a('0x27')]);if(_0x1da55f[_0xe02a('0x28')]){delete _0x1da55f[_0xe02a('0x28')];}_0x4b79c6[_0xe02a('0x19')](_0x572522)[_0xe02a('0x29')](_0x1da55f);};}exports[_0xe02a('0x2a')]=function(_0x3c60f0,_0x27befb){var _0x1ae396={},_0x43ff5f={},_0x210acb={'count':0x0,'rows':[]};var _0x1880a2=_[_0xe02a('0x2b')](db['CmContactHasItem'][_0xe02a('0x2c')],function(_0x2e770a){return{'name':_0x2e770a['fieldName'],'type':_0x2e770a['type'][_0xe02a('0x2d')]};});_0x43ff5f[_0xe02a('0x2e')]=_[_0xe02a('0x2b')](_0x1880a2,'name');_0x43ff5f['query']=_['keys'](_0x3c60f0['query']);_0x43ff5f[_0xe02a('0x2f')]=_[_0xe02a('0x30')](_0x43ff5f[_0xe02a('0x2e')],_0x43ff5f['query']);_0x1ae396['attributes']=_['intersection'](_0x43ff5f[_0xe02a('0x2e')],qs['fields'](_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x32')]));_0x1ae396['attributes']=_0x1ae396[_0xe02a('0x33')][_0xe02a('0x34')]?_0x1ae396['attributes']:_0x43ff5f['model'];if(!_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x35')]('nolimit')){_0x1ae396[_0xe02a('0x1c')]=qs[_0xe02a('0x1c')](_0x3c60f0['query'][_0xe02a('0x1c')]);_0x1ae396[_0xe02a('0x1b')]=qs['offset'](_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x1b')]);}_0x1ae396[_0xe02a('0x36')]=qs[_0xe02a('0x37')](_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x37')]);_0x1ae396['where']=qs[_0xe02a('0x2f')](_[_0xe02a('0x38')](_0x3c60f0[_0xe02a('0x31')],_0x43ff5f['filters']),_0x1880a2);if(_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x39')]){_0x1ae396[_0xe02a('0x3a')]=_[_0xe02a('0x3b')](_0x1ae396['where'],{'$or':_[_0xe02a('0x2b')](_0x1880a2,function(_0xf913f8){if(_0xf913f8['type']!=='VIRTUAL'){var _0x2d053e={};_0x2d053e[_0xf913f8[_0xe02a('0x28')]]={'$like':'%'+_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x39')]+'%'};return _0x2d053e;}})});}_0x1ae396=_[_0xe02a('0x3b')]({},_0x1ae396,_0x3c60f0[_0xe02a('0x3c')]);var _0x4dda41={'where':_0x1ae396['where']};return db[_0xe02a('0x3d')][_0xe02a('0x3e')](_0x4dda41)[_0xe02a('0x22')](function(_0x493024){_0x210acb[_0xe02a('0x3e')]=_0x493024;if(_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x3f')]){_0x1ae396['include']=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x1ae396);})[_0xe02a('0x22')](function(_0x341e56){_0x210acb[_0xe02a('0x40')]=_0x341e56;return _0x210acb;})[_0xe02a('0x22')](respondWithFilteredResult(_0x27befb,_0x1ae396))[_0xe02a('0x41')](handleError(_0x27befb,null));};exports['show']=function(_0x22c106,_0x161b19){var _0x2f52d6={'raw':!![],'where':{'id':_0x22c106[_0xe02a('0x42')]['id']}},_0x5efcda={};_0x5efcda['model']=_[_0xe02a('0x43')](db[_0xe02a('0x3d')][_0xe02a('0x2c')]);_0x5efcda[_0xe02a('0x31')]=_[_0xe02a('0x43')](_0x22c106[_0xe02a('0x31')]);_0x5efcda[_0xe02a('0x2f')]=_['intersection'](_0x5efcda[_0xe02a('0x2e')],_0x5efcda[_0xe02a('0x31')]);_0x2f52d6[_0xe02a('0x33')]=_[_0xe02a('0x30')](_0x5efcda[_0xe02a('0x2e')],qs[_0xe02a('0x32')](_0x22c106[_0xe02a('0x31')][_0xe02a('0x32')]));_0x2f52d6[_0xe02a('0x33')]=_0x2f52d6['attributes']['length']?_0x2f52d6[_0xe02a('0x33')]:_0x5efcda['model'];if(_0x22c106['query']['includeAll']){_0x2f52d6[_0xe02a('0x44')]=[{'all':!![]}];}_0x2f52d6=_[_0xe02a('0x3b')]({},_0x2f52d6,_0x22c106['options']);return db['CmContactHasItem'][_0xe02a('0x45')](_0x2f52d6)[_0xe02a('0x22')](handleEntityNotFound(_0x161b19,null))[_0xe02a('0x22')](respondWithResult(_0x161b19,null))[_0xe02a('0x41')](handleError(_0x161b19,null));};exports[_0xe02a('0x46')]=function(_0x52f600,_0x3af073){return db[_0xe02a('0x3d')][_0xe02a('0x46')](_0x52f600['body'],{})[_0xe02a('0x22')](function(_0x2869a5){var _0x8a6c33=_0x52f600[_0xe02a('0x47')]['get']({'plain':!![]});if(!_0x8a6c33)throw new Error(_0xe02a('0x48'));if(_0x8a6c33[_0xe02a('0x49')]===_0xe02a('0x47')){var _0x3764e4=_0x2869a5[_0xe02a('0x23')]({'plain':!![]});var _0x243b1f='CmContactHasItems';return db[_0xe02a('0x4a')][_0xe02a('0x45')]({'where':{'name':_0x243b1f,'userProfileId':_0x8a6c33[_0xe02a('0x4b')]},'raw':!![]})[_0xe02a('0x22')](function(_0x33cd29){if(_0x33cd29&&_0x33cd29['autoAssociation']===0x0){return db[_0xe02a('0x25')][_0xe02a('0x46')]({'name':_0x3764e4[_0xe02a('0x28')],'resourceId':_0x3764e4['id'],'type':_0x33cd29[_0xe02a('0x28')],'sectionId':_0x33cd29['id']},{})[_0xe02a('0x22')](function(){return _0x2869a5;});}else{return _0x2869a5;}})[_0xe02a('0x41')](function(_0x4ed773){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ed773);throw _0x4ed773;});}return _0x2869a5;})[_0xe02a('0x22')](respondWithResult(_0x3af073,0xc9))[_0xe02a('0x41')](handleError(_0x3af073,null));};exports['update']=function(_0x295ff6,_0x3a588f){if(_0x295ff6[_0xe02a('0x4c')]['id']){delete _0x295ff6[_0xe02a('0x4c')]['id'];}return db['CmContactHasItem'][_0xe02a('0x45')]({'where':{'id':_0x295ff6[_0xe02a('0x42')]['id']}})['then'](handleEntityNotFound(_0x3a588f,null))[_0xe02a('0x22')](saveUpdates(_0x295ff6['body'],null))[_0xe02a('0x22')](respondWithResult(_0x3a588f,null))['catch'](handleError(_0x3a588f,null));};exports[_0xe02a('0x21')]=function(_0x18f7a9,_0x122cb9){return db[_0xe02a('0x3d')][_0xe02a('0x45')]({'where':{'id':_0x18f7a9[_0xe02a('0x42')]['id']}})[_0xe02a('0x22')](handleEntityNotFound(_0x122cb9,null))[_0xe02a('0x22')](removeEntity(_0x122cb9,null))[_0xe02a('0x41')](handleError(_0x122cb9,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 79893f0..665a07d 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 _0x85be=['rimraf','./cmContactHasItem.attributes','exports','define','cm_contact_has_items','lodash','util','api','moment','request-promise','path'];(function(_0x5e6c43,_0x132a12){var _0x23d90e=function(_0x279b49){while(--_0x279b49){_0x5e6c43['push'](_0x5e6c43['shift']());}};_0x23d90e(++_0x132a12);}(_0x85be,0x1c8));var _0xe85b=function(_0x2d4ed0,_0x4692e9){_0x2d4ed0=_0x2d4ed0-0x0;var _0x23bb55=_0x85be[_0x2d4ed0];return _0x23bb55;};'use strict';var _=require(_0xe85b('0x0'));var util=require(_0xe85b('0x1'));var logger=require('../../config/logger')(_0xe85b('0x2'));var moment=require(_0xe85b('0x3'));var BPromise=require('bluebird');var rp=require(_0xe85b('0x4'));var fs=require('fs');var path=require(_0xe85b('0x5'));var rimraf=require(_0xe85b('0x6'));var config=require('../../config/environment');var attributes=require(_0xe85b('0x7'));module[_0xe85b('0x8')]=function(_0x32c3e9,_0x1fa0e1){return _0x32c3e9[_0xe85b('0x9')]('CmContactHasItem',attributes,{'tableName':_0xe85b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70c9=['bluebird','request-promise','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','util','../../config/logger','api','moment'];(function(_0x4a1256,_0x1750a0){var _0x476d1a=function(_0x5753ee){while(--_0x5753ee){_0x4a1256['push'](_0x4a1256['shift']());}};_0x476d1a(++_0x1750a0);}(_0x70c9,0x193));var _0x970c=function(_0x2d17d9,_0x107d70){_0x2d17d9=_0x2d17d9-0x0;var _0xb12fbf=_0x70c9[_0x2d17d9];return _0xb12fbf;};'use strict';var _=require('lodash');var util=require(_0x970c('0x0'));var logger=require(_0x970c('0x1'))(_0x970c('0x2'));var moment=require(_0x970c('0x3'));var BPromise=require(_0x970c('0x4'));var rp=require(_0x970c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x970c('0x6'));var attributes=require(_0x970c('0x7'));module[_0x970c('0x8')]=function(_0x3d4564,_0x49950b){return _0x3d4564[_0x970c('0x9')](_0x970c('0xa'),attributes,{'tableName':'cm_contact_has_items','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 6e48a65..6be8b05 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 _0x78c1=['jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3d6533,_0x594c70){var _0x25dc67=function(_0xe7d925){while(--_0xe7d925){_0x3d6533['push'](_0x3d6533['shift']());}};_0x25dc67(++_0x594c70);}(_0x78c1,0x19d));var _0x178c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x78c1[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x178c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x178c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x178c('0x2'));var db=require(_0x178c('0x3'))['db'];var utils=require(_0x178c('0x4'));var logger=require('../../config/logger')(_0x178c('0x5'));var config=require(_0x178c('0x6'));var jayson=require(_0x178c('0x7'));var client=jayson[_0x178c('0x8')][_0x178c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12171e,_0x41ade0,_0x475ccf){return new BPromise(function(_0x171bf1,_0x9b53ab){return client[_0x178c('0xa')](_0x12171e,_0x475ccf)['then'](function(_0x451874){logger[_0x178c('0xb')](_0x178c('0xc'),_0x41ade0,_0x178c('0xd'));logger['debug'](_0x178c('0xe'),_0x41ade0,_0x178c('0xd'),JSON[_0x178c('0xf')](_0x451874));if(_0x451874['error']){if(_0x451874[_0x178c('0x10')][_0x178c('0x11')]===0x1f4){logger[_0x178c('0x10')](_0x178c('0xc'),_0x41ade0,_0x451874[_0x178c('0x10')][_0x178c('0x12')]);return _0x9b53ab(_0x451874[_0x178c('0x10')][_0x178c('0x12')]);}logger[_0x178c('0x10')](_0x178c('0xc'),_0x41ade0,_0x451874[_0x178c('0x10')][_0x178c('0x12')]);return _0x171bf1(_0x451874[_0x178c('0x10')]['message']);}else{logger[_0x178c('0xb')](_0x178c('0xc'),_0x41ade0,_0x178c('0xd'));_0x171bf1(_0x451874[_0x178c('0x13')]['message']);}})['catch'](function(_0x2bbd28){logger[_0x178c('0x10')](_0x178c('0xc'),_0x41ade0,_0x2bbd28);_0x9b53ab(_0x2bbd28);});});} \ No newline at end of file +var _0xc73d=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message'];(function(_0x58539f,_0x5c9937){var _0x5151fa=function(_0x1be30c){while(--_0x1be30c){_0x58539f['push'](_0x58539f['shift']());}};_0x5151fa(++_0x5c9937);}(_0xc73d,0x188));var _0xdc73=function(_0x181945,_0x180cb8){_0x181945=_0x181945-0x0;var _0x3a129c=_0xc73d[_0x181945];return _0x3a129c;};'use strict';var _=require(_0xdc73('0x0'));var util=require(_0xdc73('0x1'));var moment=require(_0xdc73('0x2'));var BPromise=require(_0xdc73('0x3'));var rs=require(_0xdc73('0x4'));var fs=require('fs');var Redis=require(_0xdc73('0x5'));var db=require(_0xdc73('0x6'))['db'];var utils=require(_0xdc73('0x7'));var logger=require(_0xdc73('0x8'))('rpc');var config=require(_0xdc73('0x9'));var jayson=require(_0xdc73('0xa'));var client=jayson[_0xdc73('0xb')][_0xdc73('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1739fa,_0x50287f,_0x20de48){return new BPromise(function(_0x69f4e7,_0xd35213){return client[_0xdc73('0xd')](_0x1739fa,_0x20de48)[_0xdc73('0xe')](function(_0x1d1344){logger[_0xdc73('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x50287f,_0xdc73('0x10'));logger[_0xdc73('0x11')](_0xdc73('0x12'),_0x50287f,_0xdc73('0x10'),JSON[_0xdc73('0x13')](_0x1d1344));if(_0x1d1344[_0xdc73('0x14')]){if(_0x1d1344[_0xdc73('0x14')][_0xdc73('0x15')]===0x1f4){logger[_0xdc73('0x14')](_0xdc73('0x16'),_0x50287f,_0x1d1344['error'][_0xdc73('0x17')]);return _0xd35213(_0x1d1344['error'][_0xdc73('0x17')]);}logger[_0xdc73('0x14')]('CmContactHasItem,\x20%s,\x20%s',_0x50287f,_0x1d1344[_0xdc73('0x14')][_0xdc73('0x17')]);return _0x69f4e7(_0x1d1344[_0xdc73('0x14')][_0xdc73('0x17')]);}else{logger['info'](_0xdc73('0x16'),_0x50287f,_0xdc73('0x10'));_0x69f4e7(_0x1d1344[_0xdc73('0x18')][_0xdc73('0x17')]);}})[_0xdc73('0x19')](function(_0x3eea7c){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x50287f,_0x3eea7c);_0xd35213(_0x3eea7c);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 548d2e6..de869a8 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 _0x478d=['create','put','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4ad9e3,_0x287e3c){var _0x42134b=function(_0x31b916){while(--_0x31b916){_0x4ad9e3['push'](_0x4ad9e3['shift']());}};_0x42134b(++_0x287e3c);}(_0x478d,0x89));var _0xd478=function(_0x3bd6c4,_0x2f5e7e){_0x3bd6c4=_0x3bd6c4-0x0;var _0x43018a=_0x478d[_0x3bd6c4];return _0x43018a;};'use strict';var multer=require(_0xd478('0x0'));var util=require(_0xd478('0x1'));var path=require(_0xd478('0x2'));var timeout=require(_0xd478('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd478('0x4'));var auth=require(_0xd478('0x5'));var interaction=require(_0xd478('0x6'));var config=require(_0xd478('0x7'));var controller=require(_0xd478('0x8'));router[_0xd478('0x9')]('/',auth[_0xd478('0xa')](),controller[_0xd478('0xb')]);router[_0xd478('0x9')](_0xd478('0xc'),auth['isAuthenticated'](),controller[_0xd478('0xd')]);router[_0xd478('0xe')]('/',auth[_0xd478('0xa')](),controller[_0xd478('0xf')]);router[_0xd478('0x10')](_0xd478('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd478('0xc'),auth['isAuthenticated'](),controller[_0xd478('0x11')]);module[_0xd478('0x12')]=router; \ No newline at end of file +var _0xa631=['../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x32e4de,_0x7da1c5){var _0x51ba2a=function(_0x2a7322){while(--_0x2a7322){_0x32e4de['push'](_0x32e4de['shift']());}};_0x51ba2a(++_0x7da1c5);}(_0xa631,0xb8));var _0x1a63=function(_0x4cd76e,_0xdf00d6){_0x4cd76e=_0x4cd76e-0x0;var _0x470253=_0xa631[_0x4cd76e];return _0x470253;};'use strict';var multer=require(_0x1a63('0x0'));var util=require('util');var path=require(_0x1a63('0x1'));var timeout=require(_0x1a63('0x2'));var express=require(_0x1a63('0x3'));var router=express['Router']();var fs_extra=require(_0x1a63('0x4'));var auth=require(_0x1a63('0x5'));var interaction=require(_0x1a63('0x6'));var config=require(_0x1a63('0x7'));var controller=require(_0x1a63('0x8'));router[_0x1a63('0x9')]('/',auth[_0x1a63('0xa')](),controller[_0x1a63('0xb')]);router[_0x1a63('0x9')]('/:id',auth[_0x1a63('0xa')](),controller['show']);router[_0x1a63('0xc')]('/',auth[_0x1a63('0xa')](),controller[_0x1a63('0xd')]);router[_0x1a63('0xe')]('/:id',auth[_0x1a63('0xa')](),controller['update']);router[_0x1a63('0xf')](_0x1a63('0x10'),auth[_0x1a63('0xa')](),controller[_0x1a63('0x11')]);module[_0x1a63('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 7952d53..5b4c930 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 _0x2681=['values','stringify','BOOLEAN','ENUM','voice','lodash','getDataValue','STRING','setDataValue','alias','TEXT','select','parse'];(function(_0x134857,_0x26e253){var _0x34808c=function(_0x19ab3b){while(--_0x19ab3b){_0x134857['push'](_0x134857['shift']());}};_0x34808c(++_0x26e253);}(_0x2681,0xc8));var _0x1268=function(_0x5c9044,_0x4d8595){_0x5c9044=_0x5c9044-0x0;var _0x300857=_0x2681[_0x5c9044];return _0x300857;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1268('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x38c8bf){return this[_0x1268('0x1')]('alias');}},'alias':{'type':Sequelize[_0x1268('0x2')],'allowNull':![],'set':function(_0x26c5b1){this[_0x1268('0x3')](_0x1268('0x4'),_0x26c5b1?_0x26c5b1:this[_0x1268('0x1')]('name'));}},'type':{'type':Sequelize[_0x1268('0x2')],'allowNull':![]},'values':{'type':Sequelize[_0x1268('0x5')]('long'),'get':function(){if(this[_0x1268('0x1')]('type')===_0x1268('0x6')){return JSON[_0x1268('0x7')](this['getDataValue']('values'));}else{return this[_0x1268('0x1')](_0x1268('0x8'));}},'set':function(_0x4ce17f){if(Array['isArray'](_0x4ce17f)){this['setDataValue'](_0x1268('0x8'),JSON[_0x1268('0x9')](_0x4ce17f));}else{this[_0x1268('0x3')](_0x1268('0x8'),_0x4ce17f);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1268('0xa')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1268('0xb')](_0x1268('0xc'))}}; \ No newline at end of file +var _0xd262=['values','isArray','setDataValue','ENUM','voice','VIRTUAL','getDataValue','alias','name','STRING','TEXT','type','select','parse'];(function(_0xcaf223,_0xd39f07){var _0x17e00d=function(_0xe2852e){while(--_0xe2852e){_0xcaf223['push'](_0xcaf223['shift']());}};_0x17e00d(++_0xd39f07);}(_0xd262,0x155));var _0x2d26=function(_0x3f20b9,_0x51b2bc){_0x3f20b9=_0x3f20b9-0x0;var _0xd99499=_0xd262[_0x3f20b9];return _0xd99499;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x2d26('0x0')],'get':function(_0x5ce021){return this[_0x2d26('0x1')](_0x2d26('0x2'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x59ef86){this['setDataValue'](_0x2d26('0x2'),_0x59ef86?_0x59ef86:this[_0x2d26('0x1')](_0x2d26('0x3')));}},'type':{'type':Sequelize[_0x2d26('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x2d26('0x5')]('long'),'get':function(){if(this[_0x2d26('0x1')](_0x2d26('0x6'))===_0x2d26('0x7')){return JSON[_0x2d26('0x8')](this['getDataValue']('values'));}else{return this[_0x2d26('0x1')](_0x2d26('0x9'));}},'set':function(_0x12e905){if(Array[_0x2d26('0xa')](_0x12e905)){this[_0x2d26('0xb')](_0x2d26('0x9'),JSON['stringify'](_0x12e905));}else{this[_0x2d26('0xb')](_0x2d26('0x9'),_0x12e905);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x2d26('0xc')](_0x2d26('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index dadafdf..54cfa31 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 _0xea4e=['Sequelize','text','TEXT','number','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','update','then','destroy','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','body','create','transaction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xea4e,0x160));var _0xeea4=function(_0x319fc1,_0x29179b){_0x319fc1=_0x319fc1-0x0;var _0xb768af=_0xea4e[_0x319fc1];return _0xb768af;};'use strict';var emlformat=require(_0xeea4('0x0'));var rimraf=require(_0xeea4('0x1'));var zipdir=require(_0xeea4('0x2'));var jsonpatch=require(_0xeea4('0x3'));var rp=require('request-promise');var moment=require(_0xeea4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeea4('0x5'));var util=require('util');var path=require(_0xeea4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeea4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeea4('0x8'));var squel=require(_0xeea4('0x9'));var crypto=require(_0xeea4('0xa'));var jsforce=require(_0xeea4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeea4('0xc'));var Papa=require('papaparse');var Redis=require(_0xeea4('0xd'));var authService=require(_0xeea4('0xe'));var qs=require(_0xeea4('0xf'));var as=require(_0xeea4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeea4('0x11'))(_0xeea4('0x12'));var utils=require(_0xeea4('0x13'));var config=require(_0xeea4('0x14'));var licenseUtil=require(_0xeea4('0x15'));var db=require(_0xeea4('0x16'))['db'];function respondWithStatusCode(_0x1457a9,_0x1f480a){_0x1f480a=_0x1f480a||0xcc;return function(_0x312a45){if(_0x312a45){return _0x1457a9[_0xeea4('0x17')](_0x1f480a);}return _0x1457a9['status'](_0x1f480a)[_0xeea4('0x18')]();};}function respondWithResult(_0x1c9ad0,_0x46510b){_0x46510b=_0x46510b||0xc8;return function(_0x184709){if(_0x184709){return _0x1c9ad0[_0xeea4('0x19')](_0x46510b)[_0xeea4('0x1a')](_0x184709);}};}function respondWithFilteredResult(_0x568c91,_0x5c8f3c){return function(_0x446417){if(_0x446417){var _0x577b48=typeof _0x5c8f3c[_0xeea4('0x1b')]==='undefined'&&typeof _0x5c8f3c[_0xeea4('0x1c')]===_0xeea4('0x1d');var _0x522fee=_0x446417['count'];var _0xd8aed1=_0x577b48?0x0:_0x5c8f3c[_0xeea4('0x1b')];var _0x28640a=_0x577b48?_0x446417[_0xeea4('0x1e')]:_0x5c8f3c[_0xeea4('0x1b')]+_0x5c8f3c[_0xeea4('0x1c')];var _0x219aac;if(_0x28640a>=_0x522fee){_0x28640a=_0x522fee;_0x219aac=0xc8;}else{_0x219aac=0xce;}_0x568c91[_0xeea4('0x19')](_0x219aac);return _0x568c91['set'](_0xeea4('0x1f'),_0xd8aed1+'-'+_0x28640a+'/'+_0x522fee)[_0xeea4('0x1a')](_0x446417);}return null;};}function patchUpdates(_0x239113){return function(_0x1c201f){try{jsonpatch[_0xeea4('0x20')](_0x1c201f,_0x239113,!![]);}catch(_0x84bfe6){return BPromise['reject'](_0x84bfe6);}return _0x1c201f['save']();};}function saveUpdates(_0x5737c0,_0x4715d1){return function(_0x53d495){if(_0x53d495){return _0x53d495[_0xeea4('0x21')](_0x5737c0)[_0xeea4('0x22')](function(_0x3fab45){return _0x3fab45;});}return null;};}function removeEntity(_0x71deb0,_0x223ba3){return function(_0x1c25fd){if(_0x1c25fd){return _0x1c25fd[_0xeea4('0x23')]()[_0xeea4('0x22')](function(){_0x71deb0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x76acfb,_0x35cabf){return function(_0xccadce){if(!_0xccadce){_0x76acfb[_0xeea4('0x17')](0x194);}return _0xccadce;};}function handleError(_0x4cdb16,_0x1cb614){_0x1cb614=_0x1cb614||0x1f4;return function(_0x42e747){logger[_0xeea4('0x24')](_0x42e747['stack']);if(_0x42e747[_0xeea4('0x25')]){delete _0x42e747['name'];}_0x4cdb16['status'](_0x1cb614)[_0xeea4('0x26')](_0x42e747);};}exports[_0xeea4('0x27')]=function(_0x273e29,_0x48e8f4){var _0x4ad0d1={},_0x22eacd={},_0x3b6e7a={'count':0x0,'rows':[]};var _0x2412e0=_[_0xeea4('0x28')](db[_0xeea4('0x29')][_0xeea4('0x2a')],function(_0x51dfe5){return{'name':_0x51dfe5[_0xeea4('0x2b')],'type':_0x51dfe5[_0xeea4('0x2c')][_0xeea4('0x2d')]};});_0x22eacd[_0xeea4('0x2e')]=_[_0xeea4('0x2f')](_[_0xeea4('0x28')](_0x2412e0,'name'),[_0xeea4('0x25')]);_0x22eacd['query']=_[_0xeea4('0x30')](_0x273e29[_0xeea4('0x31')]);_0x22eacd[_0xeea4('0x32')]=_[_0xeea4('0x33')](_0x22eacd['model'],_0x22eacd[_0xeea4('0x31')]);_0x4ad0d1['attributes']=_[_0xeea4('0x33')](_0x22eacd[_0xeea4('0x2e')],qs['fields'](_0x273e29[_0xeea4('0x31')][_0xeea4('0x34')]));_0x4ad0d1[_0xeea4('0x35')]=_0x4ad0d1[_0xeea4('0x35')][_0xeea4('0x36')]?_0x4ad0d1[_0xeea4('0x35')]:_0x22eacd[_0xeea4('0x2e')];if(!_0x273e29[_0xeea4('0x31')][_0xeea4('0x37')](_0xeea4('0x38'))){_0x4ad0d1[_0xeea4('0x1c')]=qs[_0xeea4('0x1c')](_0x273e29[_0xeea4('0x31')][_0xeea4('0x1c')]);_0x4ad0d1[_0xeea4('0x1b')]=qs[_0xeea4('0x1b')](_0x273e29[_0xeea4('0x31')]['offset']);}_0x4ad0d1[_0xeea4('0x39')]=qs['sort'](_0x273e29[_0xeea4('0x31')][_0xeea4('0x3a')]);_0x4ad0d1[_0xeea4('0x3b')]=qs[_0xeea4('0x32')](_[_0xeea4('0x3c')](_0x273e29[_0xeea4('0x31')],_0x22eacd['filters']),_0x2412e0);if(_0x273e29[_0xeea4('0x31')][_0xeea4('0x3d')]){_0x4ad0d1['where']=_['merge'](_0x4ad0d1['where'],{'$or':_['map'](_0x2412e0,function(_0x84a35f){if(_0x84a35f['type']!=='VIRTUAL'){var _0x41cede={};_0x41cede[_0x84a35f[_0xeea4('0x25')]]={'$like':'%'+_0x273e29[_0xeea4('0x31')][_0xeea4('0x3d')]+'%'};return _0x41cede;}})});}_0x4ad0d1=_[_0xeea4('0x3e')]({},_0x4ad0d1,_0x273e29[_0xeea4('0x3f')]);var _0xe605d8={'where':_0x4ad0d1[_0xeea4('0x3b')]};return db[_0xeea4('0x29')][_0xeea4('0x1e')](_0xe605d8)[_0xeea4('0x22')](function(_0x1295ac){_0x3b6e7a[_0xeea4('0x1e')]=_0x1295ac;if(_0x273e29['query'][_0xeea4('0x40')]){_0x4ad0d1[_0xeea4('0x41')]=[{'all':!![]}];}return db['CmCustomField'][_0xeea4('0x42')](_0x4ad0d1);})['then'](function(_0x3e96b1){_0x3b6e7a['rows']=_0x3e96b1;return _0x3b6e7a;})[_0xeea4('0x22')](respondWithFilteredResult(_0x48e8f4,_0x4ad0d1))[_0xeea4('0x43')](handleError(_0x48e8f4,null));};exports['show']=function(_0xd324a,_0x52073e){var _0x4d99ac={'raw':!![],'where':{'id':_0xd324a[_0xeea4('0x44')]['id']}},_0xa22820={};_0xa22820[_0xeea4('0x2e')]=_[_0xeea4('0x30')](db[_0xeea4('0x29')][_0xeea4('0x2a')]);_0xa22820[_0xeea4('0x31')]=_[_0xeea4('0x30')](_0xd324a[_0xeea4('0x31')]);_0xa22820[_0xeea4('0x32')]=_[_0xeea4('0x33')](_0xa22820['model'],_0xa22820['query']);_0x4d99ac['attributes']=_[_0xeea4('0x33')](_0xa22820[_0xeea4('0x2e')],qs[_0xeea4('0x34')](_0xd324a[_0xeea4('0x31')][_0xeea4('0x34')]));_0x4d99ac[_0xeea4('0x35')]=_0x4d99ac['attributes'][_0xeea4('0x36')]?_0x4d99ac[_0xeea4('0x35')]:_0xa22820[_0xeea4('0x2e')];if(_0xd324a[_0xeea4('0x31')][_0xeea4('0x40')]){_0x4d99ac[_0xeea4('0x41')]=[{'all':!![]}];}_0x4d99ac=_['merge']({},_0x4d99ac,_0xd324a[_0xeea4('0x3f')]);return db[_0xeea4('0x29')][_0xeea4('0x45')](_0x4d99ac)[_0xeea4('0x22')](handleEntityNotFound(_0x52073e,null))[_0xeea4('0x22')](respondWithResult(_0x52073e,null))[_0xeea4('0x43')](handleError(_0x52073e,null));};exports[_0xeea4('0x21')]=function(_0x3de4f9,_0x10cf09){if(_0x3de4f9[_0xeea4('0x46')]['id']){delete _0x3de4f9[_0xeea4('0x46')]['id'];}return db['CmCustomField'][_0xeea4('0x45')]({'where':{'id':_0x3de4f9['params']['id']}})[_0xeea4('0x22')](handleEntityNotFound(_0x10cf09,null))[_0xeea4('0x22')](saveUpdates(_0x3de4f9['body'],null))['then'](respondWithResult(_0x10cf09,null))[_0xeea4('0x43')](handleError(_0x10cf09,null));};exports[_0xeea4('0x23')]=function(_0x3a5ef7,_0x52aff9){return db[_0xeea4('0x29')]['find']({'where':{'id':_0x3a5ef7[_0xeea4('0x44')]['id']}})[_0xeea4('0x22')](handleEntityNotFound(_0x52aff9,null))['then'](removeEntity(_0x52aff9,null))[_0xeea4('0x43')](handleError(_0x52aff9,null));};exports[_0xeea4('0x47')]=function(_0x344621,_0x5c8821){var _0x2bd065;return db['sequelize'][_0xeea4('0x48')](function(_0x362c37){return db[_0xeea4('0x29')][_0xeea4('0x47')](_0x344621[_0xeea4('0x46')],{'transaction':_0x362c37})[_0xeea4('0x22')](function(_0x24f1f0){_0x2bd065=_0x24f1f0;var _0x341306={'type':db[_0xeea4('0x49')]['TEXT'],'transaction':_0x362c37};switch(_0x344621[_0xeea4('0x46')]['type']){case _0xeea4('0x4a'):_0x341306[_0xeea4('0x2c')]=db[_0xeea4('0x49')][_0xeea4('0x4b')];break;case _0xeea4('0x4c'):_0x341306[_0xeea4('0x2c')]=db[_0xeea4('0x49')]['INTEGER'];break;case _0xeea4('0x4d'):_0x341306['type']=db[_0xeea4('0x49')][_0xeea4('0x4e')];_0x341306[_0xeea4('0x4f')]=![];break;default:}return db[_0xeea4('0x50')][_0xeea4('0x51')][_0xeea4('0x52')](_0xeea4('0x53'),util['format'](_0xeea4('0x54'),_0x2bd065['id']),_0x341306);})['then'](function(){return _0x2bd065;});})[_0xeea4('0x22')](respondWithResult(_0x5c8821,0xc9))[_0xeea4('0x43')](handleError(_0x5c8821,null));}; \ No newline at end of file +var _0x7863=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','key','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','includeAll','find','body','params','catch','create','sequelize','transaction','Sequelize','TEXT','type','text','number','INTEGER','switch','defaultValue','addColumn','format','cf_%d','rimraf','request-promise','bluebird'];(function(_0x22b993,_0x5261be){var _0x4556d4=function(_0x5e216e){while(--_0x5e216e){_0x22b993['push'](_0x22b993['shift']());}};_0x4556d4(++_0x5261be);}(_0x7863,0x18d));var _0x3786=function(_0x71ae3c,_0x49c7a8){_0x71ae3c=_0x71ae3c-0x0;var _0x267933=_0x7863[_0x71ae3c];return _0x267933;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3786('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3786('0x1'));var moment=require('moment');var BPromise=require(_0x3786('0x2'));var Mustache=require('mustache');var util=require(_0x3786('0x3'));var path=require(_0x3786('0x4'));var sox=require('sox');var csv=require(_0x3786('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3786('0x6'));var _=require(_0x3786('0x7'));var squel=require(_0x3786('0x8'));var crypto=require(_0x3786('0x9'));var jsforce=require(_0x3786('0xa'));var deskjs=require(_0x3786('0xb'));var toCsv=require(_0x3786('0x5'));var querystring=require(_0x3786('0xc'));var Papa=require(_0x3786('0xd'));var Redis=require(_0x3786('0xe'));var authService=require(_0x3786('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3786('0x10'))(_0x3786('0x11'));var utils=require(_0x3786('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3786('0x13'));var db=require(_0x3786('0x14'))['db'];function respondWithStatusCode(_0x44ce50,_0x47e315){_0x47e315=_0x47e315||0xcc;return function(_0x2f1b2b){if(_0x2f1b2b){return _0x44ce50['sendStatus'](_0x47e315);}return _0x44ce50[_0x3786('0x15')](_0x47e315)[_0x3786('0x16')]();};}function respondWithResult(_0xda9d09,_0x5b331f){_0x5b331f=_0x5b331f||0xc8;return function(_0x481062){if(_0x481062){return _0xda9d09[_0x3786('0x15')](_0x5b331f)['json'](_0x481062);}};}function respondWithFilteredResult(_0x16c314,_0x20e983){return function(_0x4f8d25){if(_0x4f8d25){var _0x302740=typeof _0x20e983[_0x3786('0x17')]===_0x3786('0x18')&&typeof _0x20e983['limit']===_0x3786('0x18');var _0x59384e=_0x4f8d25[_0x3786('0x19')];var _0xcb081f=_0x302740?0x0:_0x20e983[_0x3786('0x17')];var _0xf97e12=_0x302740?_0x4f8d25[_0x3786('0x19')]:_0x20e983[_0x3786('0x17')]+_0x20e983['limit'];var _0x14959f;if(_0xf97e12>=_0x59384e){_0xf97e12=_0x59384e;_0x14959f=0xc8;}else{_0x14959f=0xce;}_0x16c314[_0x3786('0x15')](_0x14959f);return _0x16c314[_0x3786('0x1a')]('Content-Range',_0xcb081f+'-'+_0xf97e12+'/'+_0x59384e)['json'](_0x4f8d25);}return null;};}function patchUpdates(_0x2c3cad){return function(_0xee0e71){try{jsonpatch[_0x3786('0x1b')](_0xee0e71,_0x2c3cad,!![]);}catch(_0x5270a7){return BPromise['reject'](_0x5270a7);}return _0xee0e71[_0x3786('0x1c')]();};}function saveUpdates(_0x4b226d,_0x15c541){return function(_0x2332d9){if(_0x2332d9){return _0x2332d9[_0x3786('0x1d')](_0x4b226d)[_0x3786('0x1e')](function(_0x50a473){return _0x50a473;});}return null;};}function removeEntity(_0x1bf821,_0x21377b){return function(_0x2aae80){if(_0x2aae80){return _0x2aae80[_0x3786('0x1f')]()[_0x3786('0x1e')](function(){_0x1bf821[_0x3786('0x15')](0xcc)[_0x3786('0x16')]();});}};}function handleEntityNotFound(_0x1b0a91,_0x4fd3a2){return function(_0x4cf538){if(!_0x4cf538){_0x1b0a91['sendStatus'](0x194);}return _0x4cf538;};}function handleError(_0x4405b2,_0x438887){_0x438887=_0x438887||0x1f4;return function(_0x494a0d){logger[_0x3786('0x20')](_0x494a0d[_0x3786('0x21')]);if(_0x494a0d['name']){delete _0x494a0d[_0x3786('0x22')];}_0x4405b2[_0x3786('0x15')](_0x438887)[_0x3786('0x23')](_0x494a0d);};}exports[_0x3786('0x24')]=function(_0x784a23,_0x508063){var _0x3a5d08={},_0x3a9067={},_0x26891d={'count':0x0,'rows':[]};var _0x591688=_[_0x3786('0x25')](db[_0x3786('0x26')][_0x3786('0x27')],function(_0x5ab384){return{'name':_0x5ab384['fieldName'],'type':_0x5ab384['type'][_0x3786('0x28')]};});_0x3a9067['model']=_[_0x3786('0x29')](_['map'](_0x591688,_0x3786('0x22')),[_0x3786('0x22')]);_0x3a9067[_0x3786('0x2a')]=_['keys'](_0x784a23[_0x3786('0x2a')]);_0x3a9067[_0x3786('0x2b')]=_[_0x3786('0x2c')](_0x3a9067[_0x3786('0x2d')],_0x3a9067[_0x3786('0x2a')]);_0x3a5d08[_0x3786('0x2e')]=_[_0x3786('0x2c')](_0x3a9067[_0x3786('0x2d')],qs[_0x3786('0x2f')](_0x784a23['query']['fields']));_0x3a5d08['attributes']=_0x3a5d08[_0x3786('0x2e')][_0x3786('0x30')]?_0x3a5d08[_0x3786('0x2e')]:_0x3a9067[_0x3786('0x2d')];if(!_0x784a23[_0x3786('0x2a')][_0x3786('0x31')](_0x3786('0x32'))){_0x3a5d08[_0x3786('0x33')]=qs['limit'](_0x784a23['query']['limit']);_0x3a5d08['offset']=qs[_0x3786('0x17')](_0x784a23['query'][_0x3786('0x17')]);}_0x3a5d08[_0x3786('0x34')]=qs[_0x3786('0x35')](_0x784a23['query'][_0x3786('0x35')]);_0x3a5d08[_0x3786('0x36')]=qs[_0x3786('0x2b')](_[_0x3786('0x37')](_0x784a23['query'],_0x3a9067[_0x3786('0x2b')]),_0x591688);if(_0x784a23[_0x3786('0x2a')]['filter']){_0x3a5d08[_0x3786('0x36')]=_[_0x3786('0x38')](_0x3a5d08['where'],{'$or':_['map'](_0x591688,function(_0x30cdf1){if(_0x30cdf1['type']!==_0x3786('0x39')){var _0x31b78c={};_0x31b78c[_0x30cdf1[_0x3786('0x22')]]={'$like':'%'+_0x784a23[_0x3786('0x2a')]['filter']+'%'};return _0x31b78c;}})});}_0x3a5d08=_[_0x3786('0x38')]({},_0x3a5d08,_0x784a23[_0x3786('0x3a')]);var _0x218853={'where':_0x3a5d08[_0x3786('0x36')]};return db[_0x3786('0x26')][_0x3786('0x19')](_0x218853)[_0x3786('0x1e')](function(_0x1900fe){_0x26891d[_0x3786('0x19')]=_0x1900fe;if(_0x784a23[_0x3786('0x2a')]['includeAll']){_0x3a5d08[_0x3786('0x3b')]=[{'all':!![]}];}return db[_0x3786('0x26')][_0x3786('0x3c')](_0x3a5d08);})[_0x3786('0x1e')](function(_0xce7249){_0x26891d['rows']=_0xce7249;return _0x26891d;})['then'](respondWithFilteredResult(_0x508063,_0x3a5d08))['catch'](handleError(_0x508063,null));};exports['show']=function(_0x2c0ae5,_0x3cc839){var _0x304c07={'raw':!![],'where':{'id':_0x2c0ae5['params']['id']}},_0x4c3ad0={};_0x4c3ad0[_0x3786('0x2d')]=_['keys'](db['CmCustomField']['rawAttributes']);_0x4c3ad0[_0x3786('0x2a')]=_['keys'](_0x2c0ae5[_0x3786('0x2a')]);_0x4c3ad0[_0x3786('0x2b')]=_[_0x3786('0x2c')](_0x4c3ad0[_0x3786('0x2d')],_0x4c3ad0[_0x3786('0x2a')]);_0x304c07[_0x3786('0x2e')]=_[_0x3786('0x2c')](_0x4c3ad0[_0x3786('0x2d')],qs[_0x3786('0x2f')](_0x2c0ae5[_0x3786('0x2a')]['fields']));_0x304c07[_0x3786('0x2e')]=_0x304c07[_0x3786('0x2e')][_0x3786('0x30')]?_0x304c07[_0x3786('0x2e')]:_0x4c3ad0[_0x3786('0x2d')];if(_0x2c0ae5[_0x3786('0x2a')][_0x3786('0x3d')]){_0x304c07[_0x3786('0x3b')]=[{'all':!![]}];}_0x304c07=_['merge']({},_0x304c07,_0x2c0ae5['options']);return db[_0x3786('0x26')][_0x3786('0x3e')](_0x304c07)[_0x3786('0x1e')](handleEntityNotFound(_0x3cc839,null))[_0x3786('0x1e')](respondWithResult(_0x3cc839,null))['catch'](handleError(_0x3cc839,null));};exports[_0x3786('0x1d')]=function(_0x3a4e5c,_0x46a3a0){if(_0x3a4e5c[_0x3786('0x3f')]['id']){delete _0x3a4e5c[_0x3786('0x3f')]['id'];}return db[_0x3786('0x26')]['find']({'where':{'id':_0x3a4e5c['params']['id']}})[_0x3786('0x1e')](handleEntityNotFound(_0x46a3a0,null))['then'](saveUpdates(_0x3a4e5c[_0x3786('0x3f')],null))[_0x3786('0x1e')](respondWithResult(_0x46a3a0,null))['catch'](handleError(_0x46a3a0,null));};exports[_0x3786('0x1f')]=function(_0x2b7a58,_0x2757fc){return db['CmCustomField'][_0x3786('0x3e')]({'where':{'id':_0x2b7a58[_0x3786('0x40')]['id']}})[_0x3786('0x1e')](handleEntityNotFound(_0x2757fc,null))[_0x3786('0x1e')](removeEntity(_0x2757fc,null))[_0x3786('0x41')](handleError(_0x2757fc,null));};exports[_0x3786('0x42')]=function(_0x5b722a,_0x3916f7){var _0x2f9d24;return db[_0x3786('0x43')][_0x3786('0x44')](function(_0x2bab5f){return db[_0x3786('0x26')][_0x3786('0x42')](_0x5b722a[_0x3786('0x3f')],{'transaction':_0x2bab5f})[_0x3786('0x1e')](function(_0x33da9e){_0x2f9d24=_0x33da9e;var _0x85af35={'type':db[_0x3786('0x45')][_0x3786('0x46')],'transaction':_0x2bab5f};switch(_0x5b722a[_0x3786('0x3f')][_0x3786('0x47')]){case _0x3786('0x48'):_0x85af35['type']=db[_0x3786('0x45')][_0x3786('0x46')];break;case _0x3786('0x49'):_0x85af35[_0x3786('0x47')]=db[_0x3786('0x45')][_0x3786('0x4a')];break;case _0x3786('0x4b'):_0x85af35[_0x3786('0x47')]=db['Sequelize']['BOOLEAN'];_0x85af35[_0x3786('0x4c')]=![];break;default:}return db[_0x3786('0x43')]['queryInterface'][_0x3786('0x4d')]('cm_contacts',util[_0x3786('0x4e')](_0x3786('0x4f'),_0x2f9d24['id']),_0x85af35);})[_0x3786('0x1e')](function(){return _0x2f9d24;});})['then'](respondWithResult(_0x3916f7,0xc9))[_0x3786('0x41')](handleError(_0x3916f7,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index fc1f4c0..a7cf9bc 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 _0xeea4=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5af954,_0x56ee93){var _0x34e676=function(_0x29595c){while(--_0x29595c){_0x5af954['push'](_0x5af954['shift']());}};_0x34e676(++_0x56ee93);}(_0xeea4,0x13a));var _0x4eea=function(_0x51544a,_0x1968e1){_0x51544a=_0x51544a-0x0;var _0x56839b=_0xeea4[_0x51544a];return _0x56839b;};'use strict';var _=require(_0x4eea('0x0'));var util=require('util');var logger=require(_0x4eea('0x1'))(_0x4eea('0x2'));var moment=require(_0x4eea('0x3'));var BPromise=require(_0x4eea('0x4'));var rp=require(_0x4eea('0x5'));var fs=require('fs');var path=require(_0x4eea('0x6'));var rimraf=require(_0x4eea('0x7'));var config=require(_0x4eea('0x8'));var attributes=require(_0x4eea('0x9'));module[_0x4eea('0xa')]=function(_0x775718,_0xdbeee1){return _0x775718[_0x4eea('0xb')](_0x4eea('0xc'),attributes,{'tableName':_0x4eea('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x696c=['request-promise','path','rimraf','../../config/environment','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment','bluebird'];(function(_0x392831,_0x4a558b){var _0x3f6f75=function(_0x2cc9d6){while(--_0x2cc9d6){_0x392831['push'](_0x392831['shift']());}};_0x3f6f75(++_0x4a558b);}(_0x696c,0x17b));var _0xc696=function(_0x479988,_0x17b763){_0x479988=_0x479988-0x0;var _0x17610c=_0x696c[_0x479988];return _0x17610c;};'use strict';var _=require(_0xc696('0x0'));var util=require(_0xc696('0x1'));var logger=require(_0xc696('0x2'))('api');var moment=require(_0xc696('0x3'));var BPromise=require(_0xc696('0x4'));var rp=require(_0xc696('0x5'));var fs=require('fs');var path=require(_0xc696('0x6'));var rimraf=require(_0xc696('0x7'));var config=require(_0xc696('0x8'));var attributes=require('./cmCustomField.attributes');module[_0xc696('0x9')]=function(_0x1b8479,_0x3d3149){return _0x1b8479['define'](_0xc696('0xa'),attributes,{'tableName':_0xc696('0xb'),'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 6908c9c..9299f7e 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 _0xbeb9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','code','error','CmCustomField,\x20%s,\x20%s','message','catch'];(function(_0x1505e5,_0x5cc291){var _0x5b1dcd=function(_0x18bfe5){while(--_0x18bfe5){_0x1505e5['push'](_0x1505e5['shift']());}};_0x5b1dcd(++_0x5cc291);}(_0xbeb9,0x108));var _0x9beb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbeb9[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x9beb('0x0'));var moment=require(_0x9beb('0x1'));var BPromise=require(_0x9beb('0x2'));var rs=require(_0x9beb('0x3'));var fs=require('fs');var Redis=require(_0x9beb('0x4'));var db=require(_0x9beb('0x5'))['db'];var utils=require(_0x9beb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9beb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9beb('0x8')][_0x9beb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dff78,_0x18fbe6,_0x4cf422){return new BPromise(function(_0x272c82,_0x2e9288){return client[_0x9beb('0xa')](_0x5dff78,_0x4cf422)[_0x9beb('0xb')](function(_0x228d70){logger[_0x9beb('0xc')]('CmCustomField,\x20%s,\x20%s',_0x18fbe6,_0x9beb('0xd'));logger[_0x9beb('0xe')](_0x9beb('0xf'),_0x18fbe6,_0x9beb('0xd'),JSON[_0x9beb('0x10')](_0x228d70));if(_0x228d70['error']){if(_0x228d70['error'][_0x9beb('0x11')]===0x1f4){logger[_0x9beb('0x12')](_0x9beb('0x13'),_0x18fbe6,_0x228d70[_0x9beb('0x12')][_0x9beb('0x14')]);return _0x2e9288(_0x228d70[_0x9beb('0x12')]['message']);}logger[_0x9beb('0x12')](_0x9beb('0x13'),_0x18fbe6,_0x228d70[_0x9beb('0x12')][_0x9beb('0x14')]);return _0x272c82(_0x228d70[_0x9beb('0x12')]['message']);}else{logger[_0x9beb('0xc')](_0x9beb('0x13'),_0x18fbe6,_0x9beb('0xd'));_0x272c82(_0x228d70['result'][_0x9beb('0x14')]);}})[_0x9beb('0x15')](function(_0x212090){logger[_0x9beb('0x12')]('CmCustomField,\x20%s,\x20%s',_0x18fbe6,_0x212090);_0x2e9288(_0x212090);});});} \ No newline at end of file +var _0x0d53=['request','info','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x4a7529,_0xba0830){var _0x254252=function(_0x53cbea){while(--_0x53cbea){_0x4a7529['push'](_0x4a7529['shift']());}};_0x254252(++_0xba0830);}(_0x0d53,0x79));var _0x30d5=function(_0x3294e6,_0x20fdb6){_0x3294e6=_0x3294e6-0x0;var _0x4fce75=_0x0d53[_0x3294e6];return _0x4fce75;};'use strict';var _=require(_0x30d5('0x0'));var util=require(_0x30d5('0x1'));var moment=require('moment');var BPromise=require(_0x30d5('0x2'));var rs=require(_0x30d5('0x3'));var fs=require('fs');var Redis=require(_0x30d5('0x4'));var db=require(_0x30d5('0x5'))['db'];var utils=require(_0x30d5('0x6'));var logger=require(_0x30d5('0x7'))(_0x30d5('0x8'));var config=require(_0x30d5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x30d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fc92a,_0x5c4b47,_0x4c114f){return new BPromise(function(_0x35efd8,_0x46ec19){return client[_0x30d5('0xb')](_0x4fc92a,_0x4c114f)['then'](function(_0x2edb28){logger[_0x30d5('0xc')]('CmCustomField,\x20%s,\x20%s',_0x5c4b47,_0x30d5('0xd'));logger['debug'](_0x30d5('0xe'),_0x5c4b47,_0x30d5('0xd'),JSON[_0x30d5('0xf')](_0x2edb28));if(_0x2edb28[_0x30d5('0x10')]){if(_0x2edb28[_0x30d5('0x10')][_0x30d5('0x11')]===0x1f4){logger[_0x30d5('0x10')]('CmCustomField,\x20%s,\x20%s',_0x5c4b47,_0x2edb28[_0x30d5('0x10')]['message']);return _0x46ec19(_0x2edb28[_0x30d5('0x10')]['message']);}logger[_0x30d5('0x10')](_0x30d5('0x12'),_0x5c4b47,_0x2edb28[_0x30d5('0x10')][_0x30d5('0x13')]);return _0x35efd8(_0x2edb28[_0x30d5('0x10')][_0x30d5('0x13')]);}else{logger[_0x30d5('0xc')](_0x30d5('0x12'),_0x5c4b47,_0x30d5('0xd'));_0x35efd8(_0x2edb28[_0x30d5('0x14')]['message']);}})[_0x30d5('0x15')](function(_0x2e9656){logger[_0x30d5('0x10')](_0x30d5('0x12'),_0x5c4b47,_0x2e9656);_0x46ec19(_0x2e9656);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 3a057d5..c2c831b 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 _0xe647=['isAuthenticated','/:id','show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get'];(function(_0x41828b,_0x278d36){var _0x1a3afb=function(_0x5985c8){while(--_0x5985c8){_0x41828b['push'](_0x41828b['shift']());}};_0x1a3afb(++_0x278d36);}(_0xe647,0x16d));var _0x7e64=function(_0x670b46,_0x2208ed){_0x670b46=_0x670b46-0x0;var _0x5a5ff2=_0xe647[_0x670b46];return _0x5a5ff2;};'use strict';var multer=require(_0x7e64('0x0'));var util=require(_0x7e64('0x1'));var path=require('path');var timeout=require(_0x7e64('0x2'));var express=require(_0x7e64('0x3'));var router=express[_0x7e64('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7e64('0x5'));var config=require(_0x7e64('0x6'));var controller=require(_0x7e64('0x7'));router[_0x7e64('0x8')]('/',auth[_0x7e64('0x9')](),controller['index']);router[_0x7e64('0x8')](_0x7e64('0xa'),auth[_0x7e64('0x9')](),controller[_0x7e64('0xb')]);router[_0x7e64('0xc')]('/',auth[_0x7e64('0x9')](),controller[_0x7e64('0xd')]);router[_0x7e64('0xe')](_0x7e64('0xa'),auth[_0x7e64('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7e64('0x9')](),controller[_0x7e64('0xf')]);module[_0x7e64('0x10')]=router; \ No newline at end of file +var _0xf939=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','isAuthenticated','show','post','create','put','/:id'];(function(_0xeff2c3,_0x3a5a82){var _0x2cade6=function(_0x5a26a1){while(--_0x5a26a1){_0xeff2c3['push'](_0xeff2c3['shift']());}};_0x2cade6(++_0x3a5a82);}(_0xf939,0x1b8));var _0x9f93=function(_0x5be062,_0x48a5aa){_0x5be062=_0x5be062-0x0;var _0x1aa1b6=_0xf939[_0x5be062];return _0x1aa1b6;};'use strict';var multer=require(_0x9f93('0x0'));var util=require('util');var path=require(_0x9f93('0x1'));var timeout=require(_0x9f93('0x2'));var express=require(_0x9f93('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9f93('0x4'));var interaction=require(_0x9f93('0x5'));var config=require(_0x9f93('0x6'));var controller=require(_0x9f93('0x7'));router[_0x9f93('0x8')]('/',auth['isAuthenticated'](),controller[_0x9f93('0x9')]);router[_0x9f93('0x8')]('/:id',auth[_0x9f93('0xa')](),controller[_0x9f93('0xb')]);router[_0x9f93('0xc')]('/',auth[_0x9f93('0xa')](),controller[_0x9f93('0xd')]);router[_0x9f93('0xe')](_0x9f93('0xf'),auth[_0x9f93('0xa')](),controller['update']);router[_0x9f93('0x10')](_0x9f93('0xf'),auth['isAuthenticated'](),controller[_0x9f93('0x11')]);module[_0x9f93('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 23e7277..ec777bd 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 _0xd51c=['exports','STRING','BOOLEAN','INTEGER','DATE','UNSIGNED','contactListQueue','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd51c,0x117));var _0xcd51=function(_0x437edb,_0x5ea790){_0x437edb=_0x437edb-0x0;var _0x3ea54a=_0xd51c[_0x437edb];return _0x3ea54a;};'use strict';var moment=require('moment');var Sequelize=require(_0xcd51('0x0'));module[_0xcd51('0x1')]={'phone':{'type':Sequelize[_0xcd51('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xcd51('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xcd51('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcd51('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xcd51('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcd51('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcd51('0x5')]},'priority':{'type':Sequelize[_0xcd51('0x4')](0x2)[_0xcd51('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xcd51('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xcd51('0x4')],'unique':_0xcd51('0x7')},'ListId':{'type':Sequelize[_0xcd51('0x4')],'unique':_0xcd51('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xcd51('0x4')],'unique':_0xcd51('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xcd51('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcd51('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcd51('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xcd51('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xcd51('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xcd51('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x5f3b=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','contactListQueue','moment','exports'];(function(_0x583405,_0x1a0d4b){var _0x30810b=function(_0x40119b){while(--_0x40119b){_0x583405['push'](_0x583405['shift']());}};_0x30810b(++_0x1a0d4b);}(_0x5f3b,0x1b7));var _0xb5f3=function(_0x268103,_0x373d73){_0x268103=_0x268103-0x0;var _0x209dfa=_0x5f3b[_0x268103];return _0x209dfa;};'use strict';var moment=require(_0xb5f3('0x0'));var Sequelize=require('sequelize');module[_0xb5f3('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xb5f3('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb5f3('0x3')],'defaultValue':moment()[_0xb5f3('0x4')](_0xb5f3('0x5'))},'countbusyretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb5f3('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb5f3('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb5f3('0x3')]},'priority':{'type':Sequelize[_0xb5f3('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb5f3('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb5f3('0x6')],'unique':_0xb5f3('0x8')},'ListId':{'type':Sequelize[_0xb5f3('0x6')],'unique':_0xb5f3('0x8')},'UserId':{'type':Sequelize[_0xb5f3('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xb5f3('0x8')},'CampaignId':{'type':Sequelize[_0xb5f3('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xb5f3('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb5f3('0x7')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'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 c26a439..8b5fbd8 100644 --- a/server/api/cmHopper/cmHopper.controller.js +++ b/server/api/cmHopper/cmHopper.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd87=['count','set','Content-Range','update','then','sendStatus','error','stack','name','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','rows','catch','show','create','body','find','params','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','dataValues','createdAt','updatedAt','state','statedesc','membername','user','UserId','deleted','deletedat','calleridnum','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','hopperIds','priority','ASC','DESC','isEmpty','scheduledAt','scheduledat','phone','recallme','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','LOCK','CmList','getOpenContacts','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit'];(function(_0x4c3070,_0xc2fb4c){var _0x536a44=function(_0x1412a5){while(--_0x1412a5){_0x4c3070['push'](_0x4c3070['shift']());}};_0x536a44(++_0xc2fb4c);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x7fd8('0x0'));var _=require(_0x7fd8('0x1'));var qs=require(_0x7fd8('0x2'));var logger=require(_0x7fd8('0x3'))(_0x7fd8('0x4'));var shared=require(_0x7fd8('0x5'));var db=require(_0x7fd8('0x6'))['db'];function respondWithResult(_0x42b06c,_0x4429f2){_0x4429f2=_0x4429f2||0xc8;return function(_0x43b442){if(_0x43b442){return _0x42b06c[_0x7fd8('0x7')](_0x4429f2)['json'](_0x43b442);}};}function respondWithFilteredResult(_0x1395b6,_0x10a778){return function(_0x55681d){if(_0x55681d){var _0x378037=typeof _0x10a778[_0x7fd8('0x8')]===_0x7fd8('0x9')&&typeof _0x10a778[_0x7fd8('0xa')]===_0x7fd8('0x9');var _0x515439=_0x55681d[_0x7fd8('0xb')];var _0x18e3ea=_0x378037?0x0:_0x10a778[_0x7fd8('0x8')];var _0x596d03=_0x378037?_0x55681d['count']:_0x10a778['offset']+_0x10a778[_0x7fd8('0xa')];var _0x4e6096;if(_0x596d03>=_0x515439){_0x596d03=_0x515439;_0x4e6096=0xc8;}else{_0x4e6096=0xce;}_0x1395b6[_0x7fd8('0x7')](_0x4e6096);return _0x1395b6[_0x7fd8('0xc')](_0x7fd8('0xd'),_0x18e3ea+'-'+_0x596d03+'/'+_0x515439)['json'](_0x55681d);}return null;};}function saveUpdates(_0x136770,_0x2cccdb){return function(_0xe84aa7){if(_0xe84aa7){return _0xe84aa7[_0x7fd8('0xe')](_0x136770)[_0x7fd8('0xf')](function(_0x5b7061){return _0x5b7061;});}return null;};}function handleEntityNotFound(_0x1af365,_0x17a3a1){return function(_0x1d481a){if(!_0x1d481a){_0x1af365[_0x7fd8('0x10')](0x194);}return _0x1d481a;};}function handleError(_0x250a02,_0x38d45a){_0x38d45a=_0x38d45a||0x1f4;return function(_0x1a4a52){logger[_0x7fd8('0x11')](_0x1a4a52[_0x7fd8('0x12')]);if(_0x1a4a52[_0x7fd8('0x13')]){delete _0x1a4a52[_0x7fd8('0x13')];}_0x250a02['status'](_0x38d45a)['send'](_0x1a4a52);};}exports['index']=function(_0xab57f7,_0xce23dc){var _0x48734c={},_0x39e301={},_0xb6f53b={'count':0x0,'rows':[]};var _0x40b134=_[_0x7fd8('0x14')](db[_0x7fd8('0x15')][_0x7fd8('0x16')],function(_0x2edf31){return{'name':_0x2edf31[_0x7fd8('0x17')],'type':_0x2edf31['type'][_0x7fd8('0x18')]};});_0x39e301[_0x7fd8('0x19')]=_[_0x7fd8('0x14')](_0x40b134,_0x7fd8('0x13'));_0x39e301[_0x7fd8('0x1a')]=_[_0x7fd8('0x1b')](_0xab57f7['query']);_0x39e301[_0x7fd8('0x1c')]=_[_0x7fd8('0x1d')](_0x39e301[_0x7fd8('0x19')],_0x39e301[_0x7fd8('0x1a')]);_0x39e301['filters']=_[_0x7fd8('0x1e')](_0x39e301[_0x7fd8('0x1c')],[_0x7fd8('0x1f'),_0x7fd8('0x20'),_0x7fd8('0x21'),'$gte','$lt',_0x7fd8('0x22'),_0x7fd8('0x23'),_0x7fd8('0x24'),_0x7fd8('0x25'),_0x7fd8('0x26'),'$notBetween',_0x7fd8('0x27'),_0x7fd8('0x28'),_0x7fd8('0x29'),_0x7fd8('0x2a'),_0x7fd8('0x2b'),'$notILike','$like',_0x7fd8('0x2c'),_0x7fd8('0x2d'),_0x7fd8('0x2e'),_0x7fd8('0x2f')]);_0x48734c['attributes']=_['intersection'](_0x39e301[_0x7fd8('0x19')],qs['fields'](_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x30')]));_0x48734c[_0x7fd8('0x31')]=_0x48734c['attributes'][_0x7fd8('0x32')]?_0x48734c['attributes']:_0x39e301[_0x7fd8('0x19')];if(!_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x33')](_0x7fd8('0x34'))){_0x48734c[_0x7fd8('0xa')]=qs[_0x7fd8('0xa')](_0xab57f7[_0x7fd8('0x1a')]['limit']);_0x48734c[_0x7fd8('0x8')]=qs[_0x7fd8('0x8')](_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x8')]);}_0x48734c[_0x7fd8('0x35')]=qs[_0x7fd8('0x36')](_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x36')]);_0x48734c['where']=qs['filters'](_[_0x7fd8('0x37')](_0xab57f7[_0x7fd8('0x1a')],_0x39e301[_0x7fd8('0x1c')]),_0x40b134);if(_0xab57f7['query'][_0x7fd8('0x38')]){_0x48734c['where']=_['merge'](_0x48734c[_0x7fd8('0x39')],{'$or':_[_0x7fd8('0x14')](_0x40b134,function(_0x298dd6){if(_0x298dd6[_0x7fd8('0x3a')]!==_0x7fd8('0x3b')){var _0x3a889e={};_0x3a889e[_0x298dd6[_0x7fd8('0x13')]]={'$like':'%'+_0xab57f7[_0x7fd8('0x1a')]['filter']+'%'};return _0x3a889e;}})});}_0x48734c=_[_0x7fd8('0x3c')]({},_0x48734c,_0xab57f7['options']);var _0x5e6231={'where':_0x48734c[_0x7fd8('0x39')]};return db['CmHopper']['count'](_0x5e6231)['then'](function(_0x6c5e52){_0xb6f53b[_0x7fd8('0xb')]=_0x6c5e52;if(_0xab57f7['query'][_0x7fd8('0x3d')]){_0x48734c[_0x7fd8('0x3e')]=[{'all':!![]}];}return db[_0x7fd8('0x15')]['findAll'](_0x48734c);})['then'](function(_0x4ec65a){_0xb6f53b[_0x7fd8('0x3f')]=_0x4ec65a;return _0xb6f53b;})[_0x7fd8('0xf')](respondWithFilteredResult(_0xce23dc,_0x48734c))[_0x7fd8('0x40')](handleError(_0xce23dc,null));};exports[_0x7fd8('0x41')]=function(_0x1d2eca,_0x1b8737){var _0x2b5abb={'raw':!![],'where':{'id':_0x1d2eca['params']['id']}},_0x501f59={};_0x501f59['model']=_[_0x7fd8('0x1b')](db[_0x7fd8('0x15')][_0x7fd8('0x16')]);_0x501f59['query']=_[_0x7fd8('0x1b')](_0x1d2eca[_0x7fd8('0x1a')]);_0x501f59[_0x7fd8('0x1c')]=_[_0x7fd8('0x1d')](_0x501f59['model'],_0x501f59[_0x7fd8('0x1a')]);_0x2b5abb[_0x7fd8('0x31')]=_['intersection'](_0x501f59[_0x7fd8('0x19')],qs['fields'](_0x1d2eca[_0x7fd8('0x1a')][_0x7fd8('0x30')]));_0x2b5abb[_0x7fd8('0x31')]=_0x2b5abb[_0x7fd8('0x31')]['length']?_0x2b5abb[_0x7fd8('0x31')]:_0x501f59[_0x7fd8('0x19')];if(_0x1d2eca[_0x7fd8('0x1a')][_0x7fd8('0x3d')]){_0x2b5abb[_0x7fd8('0x3e')]=[{'all':!![]}];}_0x2b5abb=_[_0x7fd8('0x3c')]({},_0x2b5abb,_0x1d2eca['options']);return db['CmHopper']['find'](_0x2b5abb)[_0x7fd8('0xf')](handleEntityNotFound(_0x1b8737,null))[_0x7fd8('0xf')](respondWithResult(_0x1b8737,null))['catch'](handleError(_0x1b8737,null));};exports['create']=function(_0x328e81,_0x371a02){return db['CmHopper'][_0x7fd8('0x42')](_0x328e81[_0x7fd8('0x43')],{})[_0x7fd8('0xf')](respondWithResult(_0x371a02,0xc9))['catch'](handleError(_0x371a02,null));};exports[_0x7fd8('0xe')]=function(_0x47462e,_0x4f6a65){if(_0x47462e[_0x7fd8('0x43')]['id']){delete _0x47462e['body']['id'];}return db[_0x7fd8('0x15')][_0x7fd8('0x44')]({'where':{'id':_0x47462e[_0x7fd8('0x45')]['id']}})[_0x7fd8('0xf')](handleEntityNotFound(_0x4f6a65,null))[_0x7fd8('0xf')](saveUpdates(_0x47462e[_0x7fd8('0x43')],null))[_0x7fd8('0xf')](respondWithResult(_0x4f6a65,null))[_0x7fd8('0x40')](handleError(_0x4f6a65,null));};exports['describe']=function(_0x1666e7,_0x5ca89e){return db[_0x7fd8('0x15')][_0x7fd8('0x46')]()['then'](respondWithResult(_0x5ca89e,null))[_0x7fd8('0x40')](handleError(_0x5ca89e,null));};exports[_0x7fd8('0x47')]=function(_0x5cbc91,_0x5e3a45){var _0x59dc51;var _0xcfb3a8=_0x5cbc91['params']['id'];return db[_0x7fd8('0x15')][_0x7fd8('0x44')]({'where':{'id':_0x5cbc91[_0x7fd8('0x45')]['id']}})[_0x7fd8('0xf')](handleEntityNotFound(_0x5e3a45,null))[_0x7fd8('0xf')](function(_0x4bbd34){if(_0x4bbd34){return _0x4bbd34['destroy']()[_0x7fd8('0xf')](function(_0x46c230){return _0x46c230;});}})[_0x7fd8('0xf')](function(_0x169317){_0x59dc51=_0x169317;if(_0x169317){if(_0x169317['VoiceQueueId']||_0x169317[_0x7fd8('0x48')]){return db[_0x169317['VoiceQueueId']?_0x7fd8('0x49'):_0x7fd8('0x4a')][_0x7fd8('0x44')]({'where':{'id':_0x169317[_0x7fd8('0x4b')]?_0x169317[_0x7fd8('0x4b')]:_0x169317[_0x7fd8('0x48')]},'attributes':['id',_0x7fd8('0x13')],'raw':!![]});}}})[_0x7fd8('0xf')](function(_0x369e11){var _0x20f460={};if(_0x369e11){_[_0x7fd8('0x3c')](_0x20f460,_['omit'](_0x59dc51[_0x7fd8('0x4c')],[_0x7fd8('0x4d'),_0x7fd8('0x4e'),'id']));_0x20f460[_0x7fd8('0x4f')]=0x15;_0x20f460[_0x7fd8('0x50')]='deleted';_0x20f460['campaign']=_0x369e11['name'];_0x20f460[_0x7fd8('0x51')]=_0x5cbc91[_0x7fd8('0x52')][_0x7fd8('0x13')];_0x20f460[_0x7fd8('0x53')]=_0x5cbc91[_0x7fd8('0x52')]['id'];_0x20f460[_0x7fd8('0x54')]=!![];_0x20f460[_0x7fd8('0x55')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x20f460[_0x7fd8('0x56')]=_0x59dc51['phone'];_0x20f460[_0x7fd8('0x57')]=_0x59dc51[_0x7fd8('0x4b')]?'queue':_0x7fd8('0x58');return db[_0x7fd8('0x59')]['find']({'where':{'id':_0x20f460[_0x7fd8('0x5a')]},'attributes':[_0x7fd8('0x5b'),_0x7fd8('0x5c')]})[_0x7fd8('0xf')](function(_0x47013a){if(!_[_0x7fd8('0x5d')](_0x5e3a45)&&!_[_0x7fd8('0x5d')](_0x47013a['firstName'])){_0x20f460[_0x7fd8('0x5e')]=_0x47013a[_0x7fd8('0x5b')];if(!_[_0x7fd8('0x5d')](_0x47013a[_0x7fd8('0x5c')])){_0x20f460[_0x7fd8('0x5e')]+='\x20'+_0x47013a['lastName'];}}})[_0x7fd8('0x5f')](function(){return db[_0x7fd8('0x60')][_0x7fd8('0x42')](_0x20f460);});}})['then'](function(_0x5e7495){return db[_0x7fd8('0x61')][_0x7fd8('0x47')]({'where':{'CmHopperId':_0xcfb3a8}});})[_0x7fd8('0xf')](function(){return _0x5e3a45[_0x7fd8('0x7')](0xcc)[_0x7fd8('0x62')]();})[_0x7fd8('0x40')](handleError(_0x5e3a45,null));};exports['getPreview']=function(_0x24756f,_0x1cb6e4){var _0xa04550=[];return db[_0x7fd8('0x59')]['describe']()[_0x7fd8('0xf')](function(_0x6118d7){_0xa04550=_[_0x7fd8('0x1b')](_0x6118d7);return _0x24756f[_0x7fd8('0x52')][_0x7fd8('0x63')]({'where':{'type':_0x7fd8('0x64'),'dialActive':!![],'dialMethod':_0x7fd8('0x65')},'attributes':['id',_0x7fd8('0x66'),_0x7fd8('0x67')],'raw':!![]});})[_0x7fd8('0xf')](function(_0x3fc049){if(_0x3fc049&&_0x3fc049[_0x7fd8('0x32')]){return db[_0x7fd8('0x68')][_0x7fd8('0x69')](function(_0x5cb9a0){var _0x48e1cc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7fd8('0x6a')](_0x7fd8('0x6b'))},'VoiceQueueId':{'$in':_[_0x7fd8('0x14')](_0x3fc049,'id')},'$or':[{'UserId':null},{'UserId':_0x24756f[_0x7fd8('0x52')]['id']}]};var _0xd62b0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3fc049)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x7fd8('0x14')]('id')[_0x7fd8('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x24756f['user']['id']}]};var _0x4c04b3={'$or':[_0x48e1cc,_0xd62b0]};var _0x489bf3=[];if(_0x24756f[_0x7fd8('0x43')][_0x7fd8('0x6d')]&&_0x24756f[_0x7fd8('0x43')][_0x7fd8('0x6d')]===_0x7fd8('0x6e')){if(!_['isEmpty'](_0x24756f['body'][_0x7fd8('0x6f')])){_0x4c04b3['id']={'$in':_0x24756f[_0x7fd8('0x43')]['hopperIds']};}_0x489bf3=[[_0x7fd8('0x70'),_0x7fd8('0x71')],['scheduledAt',_0x3fc049[0x0][_0x7fd8('0x66')]==='ASC'?_0x7fd8('0x72'):'ASC'],db[_0x7fd8('0x68')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x7fd8('0x72')]];}else{if(!_[_0x7fd8('0x73')](_0x24756f['body'][_0x7fd8('0x6f')])){_0x4c04b3['id']={'$notIn':_0x24756f['body'][_0x7fd8('0x6f')]};}_0x489bf3=[[_0x7fd8('0x70'),_0x7fd8('0x72')],[_0x7fd8('0x74'),_0x3fc049[0x0][_0x7fd8('0x66')]],db[_0x7fd8('0x68')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x7fd8('0x71')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x7fd8('0x75'),_0x7fd8('0x76'),_0x7fd8('0x77')],'where':_0x4c04b3,'order':_0x489bf3,'transaction':_0x5cb9a0,'lock':_0x5cb9a0['LOCK'][_0x7fd8('0x78')],'include':[{'model':db[_0x7fd8('0x59')],'as':_0x7fd8('0x79'),'attributes':_0xa04550,'include':[{'model':db[_0x7fd8('0x7a')],'as':_0x7fd8('0x7b'),'attributes':['id',_0x7fd8('0x13')]}]},{'model':db['CmList'],'as':_0x7fd8('0x7c'),'attributes':['id',_0x7fd8('0x13')]},{'model':db[_0x7fd8('0x49')],'as':_0x7fd8('0x7d'),'attributes':['id',_0x7fd8('0x13'),_0x7fd8('0x7e')]}]})[_0x7fd8('0xf')](function(_0x1c46eb){if(_0x1c46eb){return _0x1c46eb['update']({'UserId':_0x24756f[_0x7fd8('0x52')]['id']},{'transaction':_0x5cb9a0});}});});}})[_0x7fd8('0xf')](handleEntityNotFound(_0x1cb6e4,null))[_0x7fd8('0xf')](respondWithResult(_0x1cb6e4,null))['catch'](handleError(_0x1cb6e4,null));};exports[_0x7fd8('0x7f')]=function(_0x4394f3,_0x1fd9bc,_0x4426cb){var _0x43fef0=[];var _0xafff06=_0x4394f3['params']['id'];var _0x335333=_0x4394f3[_0x7fd8('0x52')]['id'];return db[_0x7fd8('0x59')][_0x7fd8('0x46')]()['then'](function(_0x72429a){_0x43fef0=_[_0x7fd8('0x1b')](_0x72429a);return db[_0x7fd8('0x68')][_0x7fd8('0x69')](function(_0x42e7ae){const _0x296119={'id':_0xafff06};return db['CmHopper']['findOne']({'attributes':['id','scheduledat',_0x7fd8('0x77')],'where':_0x296119,'transaction':_0x42e7ae,'lock':_0x42e7ae[_0x7fd8('0x80')]['UPDATE'],'include':[{'model':db[_0x7fd8('0x59')],'as':'Contact','attributes':_0x43fef0,'include':[{'model':db[_0x7fd8('0x7a')],'as':_0x7fd8('0x7b'),'attributes':['id',_0x7fd8('0x13')]}]},{'model':db[_0x7fd8('0x81')],'as':_0x7fd8('0x7c'),'attributes':['id',_0x7fd8('0x13')]},{'model':db[_0x7fd8('0x49')],'as':_0x7fd8('0x7d'),'attributes':['id',_0x7fd8('0x13'),_0x7fd8('0x7e')]}]})[_0x7fd8('0xf')](function(_0x446b01){if(_0x446b01){return _0x446b01[_0x7fd8('0xe')]({'UserId':_0x335333},{'transaction':_0x42e7ae});}});});})['then'](handleEntityNotFound(_0x1fd9bc,null))[_0x7fd8('0xf')](respondWithResult(_0x1fd9bc,null))[_0x7fd8('0x40')](handleError(_0x1fd9bc,null));};exports[_0x7fd8('0x82')]=function(_0x3c353c,_0x68df89){return _0x3c353c['user'][_0x7fd8('0x63')]({'where':{'type':_0x7fd8('0x64'),'dialActive':!![],'dialMethod':_0x7fd8('0x65')},'attributes':['id'],'raw':!![]})[_0x7fd8('0xf')](function(_0x58f956){if(_0x58f956&&_0x58f956[_0x7fd8('0x32')]){return db[_0x7fd8('0x15')][_0x7fd8('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7fd8('0x6a')](_0x7fd8('0x6b'))},'VoiceQueueId':{'$in':_['map'](_0x58f956,'id')},'$or':[{'UserId':null},{'UserId':_0x3c353c[_0x7fd8('0x52')]['id']}]}});}return 0x0;})['then'](function(_0x111114){if(!_[_0x7fd8('0x5d')](_0x111114)&&_[_0x7fd8('0x83')](_0x111114)){return _0x68df89['status'](0xc8)[_0x7fd8('0x84')]({'contacts':_0x111114});}else{logger[_0x7fd8('0x11')](_0x7fd8('0x85'),_0x7fd8('0x82'),0x194,'entity\x20not\x20found');_0x68df89[_0x7fd8('0x10')](0x194);}})[_0x7fd8('0x40')](handleError(_0x68df89,null));};exports[_0x7fd8('0x86')]=function(_0x4cfe36,_0x408a07){var _0x148843=shared[_0x7fd8('0x87')];var _0xb66bee=[];_[_0x7fd8('0x14')](_0x148843,function(_0x147343){_0xb66bee[_0x7fd8('0x88')]({'id':_0x147343[_0x7fd8('0x13')],'name':_0x147343[_0x7fd8('0x13')],'utcOffset':_0x147343[_0x7fd8('0x89')]});});return _0x408a07['status'](0xc8)[_0x7fd8('0x84')]({'tz':_0xb66bee});};exports[_0x7fd8('0x8a')]=function(_0x2affd1,_0x15025d){var _0x56aff8=shared[_0x7fd8('0x87')];var _0x5f28fa={};if(!_['isNil'](_0x56aff8[_0x2affd1[_0x7fd8('0x43')]['id']]))_0x5f28fa=_0x56aff8[_0x2affd1['body']['id']];return _0x15025d[_0x7fd8('0x7')](0xc8)[_0x7fd8('0x84')](_0x5f28fa);}; \ No newline at end of file +var _0xcb99=['getPreviewRecall','recallme','Company','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','json','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','$contained','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','CmHopper','findAll','rows','catch','show','params','fields','include','find','create','update','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','statedesc','deleted','campaign','membername','UserId','user','format','YYYY-MM-DD\x20HH:mm:ss','queue','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','destroy','end','CmContact','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','scheduledat','phone','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue'];(function(_0x49328c,_0x27dd83){var _0x171d08=function(_0x5c7f45){while(--_0x5c7f45){_0x49328c['push'](_0x49328c['shift']());}};_0x171d08(++_0x27dd83);}(_0xcb99,0x8b));var _0x9cb9=function(_0x84a85,_0x54e55c){_0x84a85=_0x84a85-0x0;var _0x1c2943=_0xcb99[_0x84a85];return _0x1c2943;};'use strict';var moment=require(_0x9cb9('0x0'));var _=require('lodash');var qs=require(_0x9cb9('0x1'));var logger=require('../../config/logger')('api');var shared=require(_0x9cb9('0x2'));var db=require(_0x9cb9('0x3'))['db'];function respondWithResult(_0x124c48,_0x51f2ee){_0x51f2ee=_0x51f2ee||0xc8;return function(_0x167735){if(_0x167735){return _0x124c48[_0x9cb9('0x4')](_0x51f2ee)['json'](_0x167735);}};}function respondWithFilteredResult(_0x214b72,_0x509cfc){return function(_0x2ed26a){if(_0x2ed26a){var _0xa84493=typeof _0x509cfc[_0x9cb9('0x5')]===_0x9cb9('0x6')&&typeof _0x509cfc[_0x9cb9('0x7')]===_0x9cb9('0x6');var _0x106f17=_0x2ed26a[_0x9cb9('0x8')];var _0x48d99a=_0xa84493?0x0:_0x509cfc['offset'];var _0xe6d275=_0xa84493?_0x2ed26a[_0x9cb9('0x8')]:_0x509cfc[_0x9cb9('0x5')]+_0x509cfc['limit'];var _0x3be02c;if(_0xe6d275>=_0x106f17){_0xe6d275=_0x106f17;_0x3be02c=0xc8;}else{_0x3be02c=0xce;}_0x214b72[_0x9cb9('0x4')](_0x3be02c);return _0x214b72['set']('Content-Range',_0x48d99a+'-'+_0xe6d275+'/'+_0x106f17)[_0x9cb9('0x9')](_0x2ed26a);}return null;};}function saveUpdates(_0x2e687e,_0x3382c8){return function(_0x1bcb05){if(_0x1bcb05){return _0x1bcb05['update'](_0x2e687e)[_0x9cb9('0xa')](function(_0x37dc98){return _0x37dc98;});}return null;};}function handleEntityNotFound(_0x3ec500,_0x32352d){return function(_0x18fa1f){if(!_0x18fa1f){_0x3ec500[_0x9cb9('0xb')](0x194);}return _0x18fa1f;};}function handleError(_0xc0bf6,_0x2132be){_0x2132be=_0x2132be||0x1f4;return function(_0x3975a5){logger[_0x9cb9('0xc')](_0x3975a5[_0x9cb9('0xd')]);if(_0x3975a5[_0x9cb9('0xe')]){delete _0x3975a5[_0x9cb9('0xe')];}_0xc0bf6[_0x9cb9('0x4')](_0x2132be)[_0x9cb9('0xf')](_0x3975a5);};}exports[_0x9cb9('0x10')]=function(_0x41e598,_0x5a6fba){var _0x4e89cf={},_0x59fcae={},_0x1a23d3={'count':0x0,'rows':[]};var _0x50169f=_['map'](db['CmHopper'][_0x9cb9('0x11')],function(_0x5b2aa3){return{'name':_0x5b2aa3[_0x9cb9('0x12')],'type':_0x5b2aa3[_0x9cb9('0x13')][_0x9cb9('0x14')]};});_0x59fcae[_0x9cb9('0x15')]=_[_0x9cb9('0x16')](_0x50169f,_0x9cb9('0xe'));_0x59fcae[_0x9cb9('0x17')]=_[_0x9cb9('0x18')](_0x41e598[_0x9cb9('0x17')]);_0x59fcae[_0x9cb9('0x19')]=_[_0x9cb9('0x1a')](_0x59fcae[_0x9cb9('0x15')],_0x59fcae[_0x9cb9('0x17')]);_0x59fcae[_0x9cb9('0x19')]=_['concat'](_0x59fcae['filters'],[_0x9cb9('0x1b'),_0x9cb9('0x1c'),_0x9cb9('0x1d'),_0x9cb9('0x1e'),_0x9cb9('0x1f'),_0x9cb9('0x20'),_0x9cb9('0x21'),_0x9cb9('0x22'),_0x9cb9('0x23'),'$between',_0x9cb9('0x24'),_0x9cb9('0x25'),_0x9cb9('0x26'),_0x9cb9('0x27'),'$notLike',_0x9cb9('0x28'),'$notILike',_0x9cb9('0x27'),_0x9cb9('0x29'),_0x9cb9('0x2a'),_0x9cb9('0x2b'),'$any']);_0x4e89cf[_0x9cb9('0x2c')]=_[_0x9cb9('0x1a')](_0x59fcae[_0x9cb9('0x15')],qs['fields'](_0x41e598[_0x9cb9('0x17')]['fields']));_0x4e89cf[_0x9cb9('0x2c')]=_0x4e89cf[_0x9cb9('0x2c')][_0x9cb9('0x2d')]?_0x4e89cf[_0x9cb9('0x2c')]:_0x59fcae[_0x9cb9('0x15')];if(!_0x41e598[_0x9cb9('0x17')]['hasOwnProperty'](_0x9cb9('0x2e'))){_0x4e89cf[_0x9cb9('0x7')]=qs[_0x9cb9('0x7')](_0x41e598['query']['limit']);_0x4e89cf[_0x9cb9('0x5')]=qs[_0x9cb9('0x5')](_0x41e598[_0x9cb9('0x17')]['offset']);}_0x4e89cf['order']=qs[_0x9cb9('0x2f')](_0x41e598[_0x9cb9('0x17')]['sort']);_0x4e89cf[_0x9cb9('0x30')]=qs[_0x9cb9('0x19')](_[_0x9cb9('0x31')](_0x41e598[_0x9cb9('0x17')],_0x59fcae[_0x9cb9('0x19')]),_0x50169f);if(_0x41e598['query'][_0x9cb9('0x32')]){_0x4e89cf[_0x9cb9('0x30')]=_['merge'](_0x4e89cf[_0x9cb9('0x30')],{'$or':_['map'](_0x50169f,function(_0x1f72b2){if(_0x1f72b2[_0x9cb9('0x13')]!=='VIRTUAL'){var _0x5668c4={};_0x5668c4[_0x1f72b2[_0x9cb9('0xe')]]={'$like':'%'+_0x41e598[_0x9cb9('0x17')][_0x9cb9('0x32')]+'%'};return _0x5668c4;}})});}_0x4e89cf=_[_0x9cb9('0x33')]({},_0x4e89cf,_0x41e598[_0x9cb9('0x34')]);var _0x2dd463={'where':_0x4e89cf[_0x9cb9('0x30')]};return db['CmHopper'][_0x9cb9('0x8')](_0x2dd463)[_0x9cb9('0xa')](function(_0x4496a4){_0x1a23d3[_0x9cb9('0x8')]=_0x4496a4;if(_0x41e598[_0x9cb9('0x17')][_0x9cb9('0x35')]){_0x4e89cf['include']=[{'all':!![]}];}return db[_0x9cb9('0x36')][_0x9cb9('0x37')](_0x4e89cf);})[_0x9cb9('0xa')](function(_0x31f8d7){_0x1a23d3[_0x9cb9('0x38')]=_0x31f8d7;return _0x1a23d3;})[_0x9cb9('0xa')](respondWithFilteredResult(_0x5a6fba,_0x4e89cf))[_0x9cb9('0x39')](handleError(_0x5a6fba,null));};exports[_0x9cb9('0x3a')]=function(_0x481377,_0x597db6){var _0x448113={'raw':!![],'where':{'id':_0x481377[_0x9cb9('0x3b')]['id']}},_0x5c0811={};_0x5c0811['model']=_[_0x9cb9('0x18')](db[_0x9cb9('0x36')][_0x9cb9('0x11')]);_0x5c0811[_0x9cb9('0x17')]=_['keys'](_0x481377[_0x9cb9('0x17')]);_0x5c0811['filters']=_[_0x9cb9('0x1a')](_0x5c0811[_0x9cb9('0x15')],_0x5c0811[_0x9cb9('0x17')]);_0x448113[_0x9cb9('0x2c')]=_[_0x9cb9('0x1a')](_0x5c0811['model'],qs[_0x9cb9('0x3c')](_0x481377[_0x9cb9('0x17')][_0x9cb9('0x3c')]));_0x448113[_0x9cb9('0x2c')]=_0x448113[_0x9cb9('0x2c')][_0x9cb9('0x2d')]?_0x448113[_0x9cb9('0x2c')]:_0x5c0811[_0x9cb9('0x15')];if(_0x481377[_0x9cb9('0x17')]['includeAll']){_0x448113[_0x9cb9('0x3d')]=[{'all':!![]}];}_0x448113=_[_0x9cb9('0x33')]({},_0x448113,_0x481377[_0x9cb9('0x34')]);return db[_0x9cb9('0x36')][_0x9cb9('0x3e')](_0x448113)['then'](handleEntityNotFound(_0x597db6,null))[_0x9cb9('0xa')](respondWithResult(_0x597db6,null))[_0x9cb9('0x39')](handleError(_0x597db6,null));};exports[_0x9cb9('0x3f')]=function(_0x52c295,_0x2813ce){return db[_0x9cb9('0x36')][_0x9cb9('0x3f')](_0x52c295['body'],{})[_0x9cb9('0xa')](respondWithResult(_0x2813ce,0xc9))[_0x9cb9('0x39')](handleError(_0x2813ce,null));};exports[_0x9cb9('0x40')]=function(_0x45bbdd,_0x2920fb){if(_0x45bbdd[_0x9cb9('0x41')]['id']){delete _0x45bbdd['body']['id'];}return db[_0x9cb9('0x36')][_0x9cb9('0x3e')]({'where':{'id':_0x45bbdd[_0x9cb9('0x3b')]['id']}})[_0x9cb9('0xa')](handleEntityNotFound(_0x2920fb,null))[_0x9cb9('0xa')](saveUpdates(_0x45bbdd[_0x9cb9('0x41')],null))[_0x9cb9('0xa')](respondWithResult(_0x2920fb,null))[_0x9cb9('0x39')](handleError(_0x2920fb,null));};exports[_0x9cb9('0x42')]=function(_0x28efec,_0x11e990){return db[_0x9cb9('0x36')][_0x9cb9('0x42')]()['then'](respondWithResult(_0x11e990,null))[_0x9cb9('0x39')](handleError(_0x11e990,null));};exports['destroy']=function(_0x40ae9b,_0x23fece){var _0x401f1e;var _0x5a7691=_0x40ae9b[_0x9cb9('0x3b')]['id'];return db[_0x9cb9('0x36')][_0x9cb9('0x3e')]({'where':{'id':_0x40ae9b[_0x9cb9('0x3b')]['id']}})['then'](handleEntityNotFound(_0x23fece,null))['then'](function(_0x57475e){if(_0x57475e){return _0x57475e['destroy']()['then'](function(_0x527e4a){return _0x527e4a;});}})[_0x9cb9('0xa')](function(_0x4490ec){_0x401f1e=_0x4490ec;if(_0x4490ec){if(_0x4490ec[_0x9cb9('0x43')]||_0x4490ec['CampaignId']){return db[_0x4490ec[_0x9cb9('0x43')]?_0x9cb9('0x44'):_0x9cb9('0x45')][_0x9cb9('0x3e')]({'where':{'id':_0x4490ec[_0x9cb9('0x43')]?_0x4490ec[_0x9cb9('0x43')]:_0x4490ec[_0x9cb9('0x46')]},'attributes':['id',_0x9cb9('0xe')],'raw':!![]});}}})['then'](function(_0x5b8ffa){var _0x58df82={};if(_0x5b8ffa){_[_0x9cb9('0x33')](_0x58df82,_[_0x9cb9('0x47')](_0x401f1e[_0x9cb9('0x48')],[_0x9cb9('0x49'),'updatedAt','id']));_0x58df82['state']=0x15;_0x58df82[_0x9cb9('0x4a')]=_0x9cb9('0x4b');_0x58df82[_0x9cb9('0x4c')]=_0x5b8ffa['name'];_0x58df82[_0x9cb9('0x4d')]=_0x40ae9b['user'][_0x9cb9('0xe')];_0x58df82[_0x9cb9('0x4e')]=_0x40ae9b[_0x9cb9('0x4f')]['id'];_0x58df82[_0x9cb9('0x4b')]=!![];_0x58df82['deletedat']=moment()[_0x9cb9('0x50')](_0x9cb9('0x51'));_0x58df82['calleridnum']=_0x401f1e['phone'];_0x58df82['campaigntype']=_0x401f1e[_0x9cb9('0x43')]?_0x9cb9('0x52'):'ivr';return db['CmContact'][_0x9cb9('0x3e')]({'where':{'id':_0x58df82[_0x9cb9('0x53')]},'attributes':[_0x9cb9('0x54'),_0x9cb9('0x55')]})[_0x9cb9('0xa')](function(_0x4e030a){if(!_[_0x9cb9('0x56')](_0x23fece)&&!_['isNil'](_0x4e030a['firstName'])){_0x58df82[_0x9cb9('0x57')]=_0x4e030a[_0x9cb9('0x54')];if(!_[_0x9cb9('0x56')](_0x4e030a['lastName'])){_0x58df82[_0x9cb9('0x57')]+='\x20'+_0x4e030a[_0x9cb9('0x55')];}}})[_0x9cb9('0x58')](function(){return db[_0x9cb9('0x59')][_0x9cb9('0x3f')](_0x58df82);});}})[_0x9cb9('0xa')](function(_0x21f73a){return db[_0x9cb9('0x5a')][_0x9cb9('0x5b')]({'where':{'CmHopperId':_0x5a7691}});})[_0x9cb9('0xa')](function(){return _0x23fece[_0x9cb9('0x4')](0xcc)[_0x9cb9('0x5c')]();})[_0x9cb9('0x39')](handleError(_0x23fece,null));};exports['getPreview']=function(_0x4dfc6e,_0x3e19ca){var _0x41ff82=[];return db[_0x9cb9('0x5d')]['describe']()[_0x9cb9('0xa')](function(_0xfd180d){_0x41ff82=_['keys'](_0xfd180d);return _0x4dfc6e['user'][_0x9cb9('0x5e')]({'where':{'type':_0x9cb9('0x5f'),'dialActive':!![],'dialMethod':_0x9cb9('0x60')},'attributes':['id','dialOrderByScheduledAt',_0x9cb9('0x61')],'raw':!![]});})['then'](function(_0x4473c6){if(_0x4473c6&&_0x4473c6[_0x9cb9('0x2d')]){return db[_0x9cb9('0x62')][_0x9cb9('0x63')](function(_0x3b3897){var _0x2d1b65={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x9cb9('0x16')](_0x4473c6,'id')},'$or':[{'UserId':null},{'UserId':_0x4dfc6e[_0x9cb9('0x4f')]['id']}]};var _0x38acc6={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4473c6)[_0x9cb9('0x32')](['dialPreviewAutoRecallMe',0x0])[_0x9cb9('0x16')]('id')[_0x9cb9('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x4dfc6e[_0x9cb9('0x4f')]['id']}]};var _0x58b9b3={'$or':[_0x2d1b65,_0x38acc6]};var _0x4f11b6=[];if(_0x4dfc6e['body']['direction']&&_0x4dfc6e[_0x9cb9('0x41')]['direction']===_0x9cb9('0x65')){if(!_[_0x9cb9('0x66')](_0x4dfc6e[_0x9cb9('0x41')][_0x9cb9('0x67')])){_0x58b9b3['id']={'$in':_0x4dfc6e[_0x9cb9('0x41')][_0x9cb9('0x67')]};}_0x4f11b6=[[_0x9cb9('0x68'),_0x9cb9('0x69')],[_0x9cb9('0x6a'),_0x4473c6[0x0]['dialOrderByScheduledAt']==='ASC'?_0x9cb9('0x6b'):_0x9cb9('0x69')],db['sequelize']['literal'](_0x9cb9('0x6c')),['id',_0x9cb9('0x6b')]];}else{if(!_['isEmpty'](_0x4dfc6e['body']['hopperIds'])){_0x58b9b3['id']={'$notIn':_0x4dfc6e['body'][_0x9cb9('0x67')]};}_0x4f11b6=[['priority',_0x9cb9('0x6b')],[_0x9cb9('0x6a'),_0x4473c6[0x0]['dialOrderByScheduledAt']],db[_0x9cb9('0x62')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0x9cb9('0x36')][_0x9cb9('0x6d')]({'attributes':['id',_0x9cb9('0x6e'),_0x9cb9('0x6f'),'recallme'],'where':_0x58b9b3,'order':_0x4f11b6,'transaction':_0x3b3897,'lock':_0x3b3897[_0x9cb9('0x70')][_0x9cb9('0x71')],'include':[{'model':db['CmContact'],'as':_0x9cb9('0x72'),'attributes':_0x41ff82,'include':[{'model':db[_0x9cb9('0x73')],'as':'Company','attributes':['id',_0x9cb9('0xe')]}]},{'model':db[_0x9cb9('0x74')],'as':_0x9cb9('0x75'),'attributes':['id',_0x9cb9('0xe')]},{'model':db[_0x9cb9('0x44')],'as':_0x9cb9('0x76'),'attributes':['id','name','dialActive']}]})[_0x9cb9('0xa')](function(_0x2c2ff1){if(_0x2c2ff1){return _0x2c2ff1[_0x9cb9('0x40')]({'UserId':_0x4dfc6e[_0x9cb9('0x4f')]['id']},{'transaction':_0x3b3897});}});});}})[_0x9cb9('0xa')](handleEntityNotFound(_0x3e19ca,null))[_0x9cb9('0xa')](respondWithResult(_0x3e19ca,null))[_0x9cb9('0x39')](handleError(_0x3e19ca,null));};exports[_0x9cb9('0x77')]=function(_0x24f574,_0x4eb9c6,_0x23a727){var _0x1ef68b=[];var _0x3ceb83=_0x24f574['params']['id'];var _0x7d8ce8=_0x24f574[_0x9cb9('0x4f')]['id'];return db[_0x9cb9('0x5d')][_0x9cb9('0x42')]()['then'](function(_0x222393){_0x1ef68b=_[_0x9cb9('0x18')](_0x222393);return db[_0x9cb9('0x62')][_0x9cb9('0x63')](function(_0x30342f){const _0x203156={'id':_0x3ceb83};return db[_0x9cb9('0x36')][_0x9cb9('0x6d')]({'attributes':['id',_0x9cb9('0x6e'),_0x9cb9('0x78')],'where':_0x203156,'transaction':_0x30342f,'lock':_0x30342f[_0x9cb9('0x70')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x1ef68b,'include':[{'model':db[_0x9cb9('0x73')],'as':_0x9cb9('0x79'),'attributes':['id','name']}]},{'model':db[_0x9cb9('0x74')],'as':_0x9cb9('0x75'),'attributes':['id','name']},{'model':db[_0x9cb9('0x44')],'as':'Queue','attributes':['id',_0x9cb9('0xe'),'dialActive']}]})[_0x9cb9('0xa')](function(_0xd49604){if(_0xd49604){return _0xd49604[_0x9cb9('0x40')]({'UserId':_0x7d8ce8},{'transaction':_0x30342f});}});});})[_0x9cb9('0xa')](handleEntityNotFound(_0x4eb9c6,null))[_0x9cb9('0xa')](respondWithResult(_0x4eb9c6,null))['catch'](handleError(_0x4eb9c6,null));};exports[_0x9cb9('0x7a')]=function(_0x303dfc,_0x3a60d3){return _0x303dfc['user']['getVoiceQueues']({'where':{'type':_0x9cb9('0x5f'),'dialActive':!![],'dialMethod':_0x9cb9('0x60')},'attributes':['id'],'raw':!![]})[_0x9cb9('0xa')](function(_0x288782){if(_0x288782&&_0x288782['length']){return db[_0x9cb9('0x36')][_0x9cb9('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x9cb9('0x51'))},'VoiceQueueId':{'$in':_[_0x9cb9('0x16')](_0x288782,'id')},'$or':[{'UserId':null},{'UserId':_0x303dfc[_0x9cb9('0x4f')]['id']}]}});}return 0x0;})[_0x9cb9('0xa')](function(_0x54043e){if(!_[_0x9cb9('0x56')](_0x54043e)&&_[_0x9cb9('0x7b')](_0x54043e)){return _0x3a60d3[_0x9cb9('0x4')](0xc8)[_0x9cb9('0x9')]({'contacts':_0x54043e});}else{logger[_0x9cb9('0xc')](_0x9cb9('0x7c'),_0x9cb9('0x7a'),0x194,'entity\x20not\x20found');_0x3a60d3[_0x9cb9('0xb')](0x194);}})['catch'](handleError(_0x3a60d3,null));};exports['getTimezones']=function(_0x54d5ed,_0x5341d1){var _0x32130f=shared['timezones'];var _0x4c2ca1=[];_[_0x9cb9('0x16')](_0x32130f,function(_0x465945){_0x4c2ca1[_0x9cb9('0x7d')]({'id':_0x465945[_0x9cb9('0xe')],'name':_0x465945[_0x9cb9('0xe')],'utcOffset':_0x465945[_0x9cb9('0x7e')]});});return _0x5341d1[_0x9cb9('0x4')](0xc8)[_0x9cb9('0x9')]({'tz':_0x4c2ca1});};exports[_0x9cb9('0x7f')]=function(_0x206abd,_0x5971eb){var _0xe48750=shared[_0x9cb9('0x80')];var _0x13b776={};if(!_[_0x9cb9('0x56')](_0xe48750[_0x206abd[_0x9cb9('0x41')]['id']]))_0x13b776=_0xe48750[_0x206abd['body']['id']];return _0x5971eb['status'](0xc8)[_0x9cb9('0x9')](_0x13b776);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 1f9c939..ad0149a 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 _0x0295=['define','scheduledat','phone','priority','lodash','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x0295,0x1f0));var _0x5029=function(_0x2a2f52,_0x37a983){_0x2a2f52=_0x2a2f52-0x0;var _0x1e1816=_0x0295[_0x2a2f52];return _0x1e1816;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x5029('0x9')]},{'name':'phone','fields':[_0x5029('0xa')]},{'name':'priority','fields':[_0x5029('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone'];(function(_0x59b289,_0x247a13){var _0x4e90e8=function(_0x3c0da7){while(--_0x3c0da7){_0x59b289['push'](_0x59b289['shift']());}};_0x4e90e8(++_0x247a13);}(_0xeff8,0x186));var _0x8eff=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xeff8[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x8eff('0xb'),'fields':[_0x8eff('0xb')]},{'name':_0x8eff('0xc'),'fields':[_0x8eff('0xc')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index d2c61fc..ee96fbe 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 _0xe124=['util','bluebird','../../config/logger','rpc','client','http','then','info','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowCmHopper','CmHopper','find','debug','create','body','CreateCmHopper','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','sequelize','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','update','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','transaction','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','order','GetCmHopperPreview','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','NOW()'];(function(_0x44aee2,_0x49a5ff){var _0x1bafde=function(_0x16bc26){while(--_0x16bc26){_0x44aee2['push'](_0x44aee2['shift']());}};_0x1bafde(++_0x49a5ff);}(_0xe124,0x154));var _0x4e12=function(_0x477588,_0x591b7d){_0x477588=_0x477588-0x0;var _0x25860a=_0xe124[_0x477588];return _0x25860a;};'use strict';var _=require('lodash');var util=require(_0x4e12('0x0'));var moment=require('moment');var BPromise=require(_0x4e12('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x4e12('0x2'))(_0x4e12('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x4e12('0x4')][_0x4e12('0x5')]({'port':0x232a});function respondWithRpcPromise(_0xc28242,_0x2f668f,_0x248d47){return new BPromise(function(_0x49f46d,_0x3d10ca){return client['request'](_0xc28242,_0x248d47)[_0x4e12('0x6')](function(_0x4a2e6e){logger[_0x4e12('0x7')]('CmHopper,\x20%s,\x20%s',_0x2f668f,_0x4e12('0x8'));logger['debug'](_0x4e12('0x9'),_0x2f668f,'request\x20sent',JSON['stringify'](_0x4a2e6e));if(_0x4a2e6e['error']){if(_0x4a2e6e[_0x4e12('0xa')][_0x4e12('0xb')]===0x1f4){logger[_0x4e12('0xa')](_0x4e12('0xc'),_0x2f668f,_0x4a2e6e['error'][_0x4e12('0xd')]);return _0x3d10ca(_0x4a2e6e['error']['message']);}logger['error']('CmHopper,\x20%s,\x20%s',_0x2f668f,_0x4a2e6e[_0x4e12('0xa')][_0x4e12('0xd')]);return _0x49f46d(_0x4a2e6e[_0x4e12('0xa')]['message']);}else{logger[_0x4e12('0x7')]('CmHopper,\x20%s,\x20%s',_0x2f668f,'request\x20sent');_0x49f46d(_0x4a2e6e[_0x4e12('0xe')][_0x4e12('0xd')]);}})[_0x4e12('0xf')](function(_0x1827ef){logger[_0x4e12('0xa')]('CmHopper,\x20%s,\x20%s',_0x2f668f,_0x1827ef);_0x3d10ca(_0x1827ef);});});}exports[_0x4e12('0x10')]=function(_0x383096){var _0x30202c=this;return new Promise(function(_0x155dec,_0x51707b){return db['CmHopper'][_0x4e12('0x11')]({'raw':_0x383096[_0x4e12('0x12')]?_0x383096[_0x4e12('0x12')][_0x4e12('0x13')]===undefined?!![]:![]:!![],'where':_0x383096['options']?_0x383096[_0x4e12('0x12')][_0x4e12('0x14')]||null:null,'attributes':_0x383096[_0x4e12('0x12')]?_0x383096['options']['attributes']||null:null,'limit':_0x383096[_0x4e12('0x12')]?_0x383096[_0x4e12('0x12')][_0x4e12('0x15')]||null:null,'include':_0x383096[_0x4e12('0x12')]?_0x383096['options'][_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x383096[_0x4e12('0x12')][_0x4e12('0x16')],function(_0x5a08ae){return{'model':db[_0x5a08ae[_0x4e12('0x18')]],'as':_0x5a08ae['as'],'attributes':_0x5a08ae[_0x4e12('0x19')],'include':_0x5a08ae[_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x5a08ae['include'],function(_0x22d2cc){return{'model':db[_0x22d2cc[_0x4e12('0x18')]],'as':_0x22d2cc['as'],'attributes':_0x22d2cc[_0x4e12('0x19')],'include':_0x22d2cc[_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x22d2cc[_0x4e12('0x16')],function(_0x4b96f5){return{'model':db[_0x4b96f5[_0x4e12('0x18')]],'as':_0x4b96f5['as'],'attributes':_0x4b96f5[_0x4e12('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e12('0x6')](function(_0x50c3b7){logger[_0x4e12('0x7')](_0x4e12('0x10'),_0x383096);logger['debug']('GetCmHopper',_0x383096,JSON[_0x4e12('0x1a')](_0x50c3b7));_0x155dec(_0x50c3b7);})[_0x4e12('0xf')](function(_0xfefd5d){logger[_0x4e12('0xa')](_0x4e12('0x10'),_0xfefd5d['message'],_0x383096);_0x51707b(_0x30202c[_0x4e12('0xa')](0x1f4,_0xfefd5d[_0x4e12('0xd')]));});});};exports[_0x4e12('0x1b')]=function(_0x5ed06c){var _0x47541b=this;return new Promise(function(_0x4b4148,_0x761f97){return db[_0x4e12('0x1c')][_0x4e12('0x1d')]({'raw':_0x5ed06c['options']?_0x5ed06c[_0x4e12('0x12')][_0x4e12('0x13')]===undefined?!![]:![]:!![],'where':_0x5ed06c[_0x4e12('0x12')]?_0x5ed06c[_0x4e12('0x12')]['where']||null:null,'attributes':_0x5ed06c[_0x4e12('0x12')]?_0x5ed06c[_0x4e12('0x12')][_0x4e12('0x19')]||null:null,'include':_0x5ed06c[_0x4e12('0x12')]?_0x5ed06c[_0x4e12('0x12')][_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x5ed06c['options'][_0x4e12('0x16')],function(_0x5d70ef){return{'model':db[_0x5d70ef[_0x4e12('0x18')]],'as':_0x5d70ef['as'],'attributes':_0x5d70ef[_0x4e12('0x19')],'include':_0x5d70ef[_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x5d70ef['include'],function(_0x3ecc4a){return{'model':db[_0x3ecc4a[_0x4e12('0x18')]],'as':_0x3ecc4a['as'],'attributes':_0x3ecc4a[_0x4e12('0x19')],'include':_0x3ecc4a['include']?_[_0x4e12('0x17')](_0x3ecc4a[_0x4e12('0x16')],function(_0x3ba948){return{'model':db[_0x3ba948[_0x4e12('0x18')]],'as':_0x3ba948['as'],'attributes':_0x3ba948[_0x4e12('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e12('0x6')](function(_0x4a9301){logger['info'](_0x4e12('0x1b'),_0x5ed06c);logger[_0x4e12('0x1e')](_0x4e12('0x1b'),_0x5ed06c,JSON[_0x4e12('0x1a')](_0x4a9301));_0x4b4148(_0x4a9301);})[_0x4e12('0xf')](function(_0x158b1d){logger[_0x4e12('0xa')]('ShowCmHopper',_0x158b1d['message'],_0x5ed06c);_0x761f97(_0x47541b['error'](0x1f4,_0x158b1d[_0x4e12('0xd')]));});});};exports['CreateCmHopper']=function(_0x5ce774){var _0x23093f=this;return new Promise(function(_0xd81d28,_0x432055){return db[_0x4e12('0x1c')][_0x4e12('0x1f')](_0x5ce774[_0x4e12('0x20')],{'raw':_0x5ce774['options']?_0x5ce774[_0x4e12('0x12')][_0x4e12('0x13')]===undefined?!![]:![]:!![]})['then'](function(_0x221ac4){logger[_0x4e12('0x7')](_0x4e12('0x21'),_0x5ce774);logger['debug'](_0x4e12('0x21'),_0x5ce774,JSON[_0x4e12('0x1a')](_0x221ac4));_0xd81d28(_0x221ac4);})[_0x4e12('0xf')](function(_0x45058d){logger[_0x4e12('0xa')](_0x4e12('0x21'),_0x45058d['message'],_0x5ce774);_0x432055(_0x23093f['error'](0x1f4,_0x45058d['message']));});});};exports[_0x4e12('0x22')]=function(_0x167c59){var _0x2f7fd2=this;return new Promise(function(_0x4f7af2,_0x27cd51){return db['CmHopper']['update'](_0x167c59[_0x4e12('0x20')],{'raw':_0x167c59[_0x4e12('0x12')]?_0x167c59[_0x4e12('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x167c59['options']?_0x167c59[_0x4e12('0x12')]['where']||null:null,'attributes':_0x167c59[_0x4e12('0x12')]?_0x167c59[_0x4e12('0x12')][_0x4e12('0x19')]||null:null,'limit':_0x167c59[_0x4e12('0x12')]?_0x167c59['options'][_0x4e12('0x15')]||null:null})[_0x4e12('0x6')](function(_0x489c95){logger['info'](_0x4e12('0x22'),_0x167c59);logger[_0x4e12('0x7')](_0x4e12('0x23'),JSON[_0x4e12('0x1a')](_0x167c59[_0x4e12('0x12')][_0x4e12('0x14')]),_0x167c59[_0x4e12('0x20')][_0x4e12('0x24')]);logger[_0x4e12('0x1e')]('UpdateCmHopper',_0x167c59,JSON[_0x4e12('0x1a')](_0x489c95));_0x4f7af2(_0x489c95);})['catch'](function(_0x937a73){logger['error'](_0x4e12('0x22'),_0x937a73[_0x4e12('0xd')],_0x167c59);_0x27cd51(_0x2f7fd2[_0x4e12('0xa')](0x1f4,_0x937a73[_0x4e12('0xd')]));});});};exports[_0x4e12('0x25')]=function(_0x2b7309){var _0x5e9b6e=this;return new Promise(function(_0x5f300a,_0x165433){return db[_0x4e12('0x1c')][_0x4e12('0x26')]({'where':_0x2b7309[_0x4e12('0x12')]?_0x2b7309[_0x4e12('0x12')][_0x4e12('0x14')]||null:null})[_0x4e12('0x6')](function(_0xa15b7b){logger[_0x4e12('0x7')](_0x4e12('0x25'),_0x2b7309);logger[_0x4e12('0x1e')](_0x4e12('0x25'),_0x2b7309,JSON[_0x4e12('0x1a')](_0xa15b7b));_0x5f300a(_0xa15b7b);})[_0x4e12('0xf')](function(_0x3a780a){logger[_0x4e12('0xa')]('DestroyCmHopper',_0x3a780a[_0x4e12('0xd')],_0x2b7309);_0x165433(_0x5e9b6e[_0x4e12('0xa')](0x1f4,_0x3a780a[_0x4e12('0xd')]));});});};exports['GetContactDialer']=function(_0x11a89d){var _0x394742=this;return new Promise(function(_0xec5f1,_0x2fa339){return db[_0x4e12('0x27')]['describe']()['then'](function(_0x1b3a6e){return db[_0x4e12('0x28')]['transaction'](function(_0x578928){return db[_0x4e12('0x1c')][_0x4e12('0x11')]({'where':_0x11a89d[_0x4e12('0x12')]?_0x11a89d[_0x4e12('0x12')][_0x4e12('0x14')]||null:null,'attributes':_0x11a89d[_0x4e12('0x12')]?_0x11a89d[_0x4e12('0x12')][_0x4e12('0x19')]||null:null,'limit':_0x11a89d[_0x4e12('0x12')]?_0x11a89d[_0x4e12('0x12')]['limit']||null:null,'order':_0x11a89d[_0x4e12('0x12')]?_0x11a89d[_0x4e12('0x12')]['order']||null:null,'transaction':_0x578928,'lock':_0x578928['LOCK'][_0x4e12('0x29')],'include':[{'model':db['CmContact'],'as':_0x4e12('0x2a'),'attributes':_[_0x4e12('0x2b')](_0x1b3a6e)},{'model':db[_0x4e12('0x2c')],'as':_0x4e12('0x2d'),'attributes':['id',_0x4e12('0x2e'),_0x4e12('0x2f')]}]})[_0x4e12('0x6')](function(_0x2334bd){var _0x1a3a37=[];var _0x46dc70=[];for(var _0x2ac1aa=0x0;_0x2ac1aa<_0x2334bd[_0x4e12('0x30')];_0x2ac1aa+=0x1){var _0x29c221=_0x2334bd[_0x2ac1aa][_0x4e12('0x31')];if(_0x29c221===null){_0x1a3a37[_0x4e12('0x32')](_0x2334bd[_0x2ac1aa][_0x4e12('0x33')](_0x11a89d[_0x4e12('0x20')],{'transaction':_0x578928}));}else if(!_0x46dc70[_0x4e12('0x34')](_0x29c221)){_0x46dc70['push'](_0x29c221);_0x1a3a37[_0x4e12('0x32')](_0x2334bd[_0x2ac1aa][_0x4e12('0x33')](_0x11a89d[_0x4e12('0x20')],{'transaction':_0x578928}));}}return BPromise[_0x4e12('0x35')](_0x1a3a37);});})[_0x4e12('0x6')](function(_0x17831a){logger[_0x4e12('0x7')](_0x4e12('0x36'),_0x11a89d);if(_0x17831a['length']>0x0){logger[_0x4e12('0x7')](_0x4e12('0x37'),_0x17831a[0x0][_0x4e12('0x38')]['id'],_0x17831a[0x0][_0x4e12('0x38')]['ContactId'],_0x17831a[0x0][_0x4e12('0x38')][_0x4e12('0x24')]);}logger['debug'](_0x4e12('0x36'),_0x11a89d,JSON[_0x4e12('0x1a')](_0x17831a));_0xec5f1(_0x17831a);})[_0x4e12('0xf')](function(_0x3bedeb){logger[_0x4e12('0xa')]('GetContactDialer',_0x3bedeb[_0x4e12('0xd')],_0x11a89d);_0x2fa339(_0x394742['error'](0x1f4,_0x3bedeb[_0x4e12('0xd')]));});});});};exports[_0x4e12('0x39')]=function(_0x106de4){var _0x5ae129=this;return new Promise(function(_0x4535c6,_0x24ea9c){return db[_0x4e12('0x28')][_0x4e12('0x3a')](function(_0x2acf19){return db['CmHopperFinal'][_0x4e12('0x1f')](_0x106de4[_0x4e12('0x20')],{'raw':_0x106de4['options']?_0x106de4['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x2acf19})[_0x4e12('0x6')](function(){logger[_0x4e12('0x7')](_0x4e12('0x3b'),JSON['stringify'](_0x106de4[_0x4e12('0x12')]['where']),_0x106de4[_0x4e12('0x12')]['where'][_0x4e12('0x24')]);return db['CmHopper'][_0x4e12('0x26')]({'where':_0x106de4[_0x4e12('0x12')]?_0x106de4[_0x4e12('0x12')]['where']||null:null,'transaction':_0x2acf19});});})[_0x4e12('0x6')](function(_0x127607){logger[_0x4e12('0x7')](_0x4e12('0x39'),_0x106de4);logger[_0x4e12('0x1e')](_0x4e12('0x39'),_0x106de4,JSON['stringify'](_0x127607));_0x4535c6(_0x127607);})[_0x4e12('0xf')](function(_0x467567){logger[_0x4e12('0xa')](_0x4e12('0x39'),_0x467567[_0x4e12('0xd')],_0x106de4);_0x24ea9c(_0x5ae129[_0x4e12('0xa')](0x1f4,_0x467567[_0x4e12('0xd')]));});});};exports[_0x4e12('0x3c')]=function(_0x236e1f){var _0x19d6fe=this;return new Promise(function(_0x4b9c2f,_0x5ac026){return db['CmHopper'][_0x4e12('0x11')]({'raw':_0x236e1f[_0x4e12('0x12')]?_0x236e1f['options'][_0x4e12('0x13')]===undefined?!![]:![]:!![],'where':_0x236e1f['options']?_0x236e1f[_0x4e12('0x12')][_0x4e12('0x14')]||null:null,'attributes':[[db[_0x4e12('0x28')]['fn'](_0x4e12('0x3d'),db[_0x4e12('0x28')]['fn']('IF',db[_0x4e12('0x28')][_0x4e12('0x3e')](_0x4e12('0x3f')+util[_0x4e12('0x40')]('\x22%s\x22',moment()[_0x4e12('0x40')](_0x4e12('0x41')))+_0x4e12('0x42')))),_0x4e12('0x43')]]})[_0x4e12('0x6')](function(_0x31a997){logger[_0x4e12('0x7')](_0x4e12('0x3c'),_0x236e1f);logger[_0x4e12('0x1e')](_0x4e12('0x3c'),_0x236e1f,JSON[_0x4e12('0x1a')](_0x31a997));_0x4b9c2f(_0x31a997);})[_0x4e12('0xf')](function(_0x53d1ef){logger[_0x4e12('0xa')](_0x4e12('0x3c'),_0x53d1ef['message'],_0x236e1f);_0x5ac026(_0x19d6fe[_0x4e12('0xa')](0x1f4,_0x53d1ef[_0x4e12('0xd')]));});});};exports[_0x4e12('0x44')]=function(_0x3a7814){var _0x5d9de2=this;return new Promise(function(_0x22cce2,_0x2853bf){return db[_0x4e12('0x27')][_0x4e12('0x45')]()[_0x4e12('0x6')](function(_0x357570){return db[_0x4e12('0x28')][_0x4e12('0x3a')](function(_0x24bb27){return db[_0x4e12('0x1c')][_0x4e12('0x11')]({'where':_0x3a7814[_0x4e12('0x12')]?_0x3a7814[_0x4e12('0x12')][_0x4e12('0x14')]||null:null,'attributes':_0x3a7814[_0x4e12('0x12')]?_0x3a7814[_0x4e12('0x12')][_0x4e12('0x19')]||null:null,'limit':0x1,'order':_0x3a7814['options']?_0x3a7814[_0x4e12('0x12')][_0x4e12('0x46')]||null:null,'group':db[_0x4e12('0x1c')][_0x4e12('0x31')],'transaction':_0x24bb27,'lock':_0x24bb27['LOCK'][_0x4e12('0x29')],'include':_0x3a7814['options']?_0x3a7814[_0x4e12('0x12')][_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x3a7814[_0x4e12('0x12')][_0x4e12('0x16')],function(_0x146d66){return{'model':db[_0x146d66[_0x4e12('0x18')]],'as':_0x146d66['as'],'attributes':_0x146d66[_0x4e12('0x19')],'include':_0x146d66[_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x146d66['include'],function(_0xbb914){return{'model':db[_0xbb914[_0x4e12('0x18')]],'as':_0xbb914['as'],'attributes':_0xbb914[_0x4e12('0x19')],'include':_0xbb914[_0x4e12('0x16')]?_[_0x4e12('0x17')](_0xbb914[_0x4e12('0x16')],function(_0x3080e0){return{'model':db[_0x3080e0[_0x4e12('0x18')]],'as':_0x3080e0['as'],'attributes':_0x3080e0[_0x4e12('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e12('0x6')](function(_0x5871ad){var _0x46f1b1=[];for(var _0x3f2dcc=0x0;_0x3f2dcc<_0x5871ad[_0x4e12('0x30')];_0x3f2dcc+=0x1){_0x46f1b1[_0x4e12('0x32')](_0x5871ad[_0x3f2dcc][_0x4e12('0x33')](_0x3a7814[_0x4e12('0x20')],{'transaction':_0x24bb27}));}return BPromise['all'](_0x46f1b1);});})[_0x4e12('0x6')](function(_0xcd106b){logger['info'](_0x4e12('0x44'),_0x3a7814);logger[_0x4e12('0x1e')](_0x4e12('0x44'),_0x3a7814,JSON[_0x4e12('0x1a')](_0xcd106b));_0x22cce2(_0xcd106b);})[_0x4e12('0xf')](function(_0x378963){logger[_0x4e12('0xa')]('GetContactRecallMe',_0x378963['message'],_0x3a7814);_0x2853bf(_0x5d9de2[_0x4e12('0xa')](0x1f4,_0x378963[_0x4e12('0xd')]));});});});};exports[_0x4e12('0x47')]=function(_0x259b4d){var _0x17c33f=this;return new Promise(function(_0x40462e,_0x3f682d){db['CmContact'][_0x4e12('0x45')]()[_0x4e12('0x6')](function(_0x41b1bb){return db[_0x4e12('0x1c')]['findAll']({'raw':_0x259b4d[_0x4e12('0x12')]?_0x259b4d['options'][_0x4e12('0x13')]===undefined?!![]:![]:!![],'where':_0x259b4d[_0x4e12('0x12')]?_0x259b4d[_0x4e12('0x12')][_0x4e12('0x14')]||null:null,'attributes':_0x259b4d['options']?_0x259b4d[_0x4e12('0x12')][_0x4e12('0x19')]||null:null,'limit':_0x259b4d[_0x4e12('0x12')]?_0x259b4d[_0x4e12('0x12')][_0x4e12('0x15')]||null:null,'include':_0x259b4d['options']?_0x259b4d[_0x4e12('0x12')][_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x259b4d[_0x4e12('0x12')][_0x4e12('0x16')],function(_0x53f5bd){return{'model':db[_0x53f5bd[_0x4e12('0x18')]],'as':_0x53f5bd['as'],'attributes':_0x53f5bd['as']===_0x4e12('0x2a')?_[_0x4e12('0x2b')](_0x41b1bb):_0x53f5bd['attributes'],'include':_0x53f5bd[_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x53f5bd['include'],function(_0x26314a){return{'model':db[_0x26314a[_0x4e12('0x18')]],'as':_0x26314a['as'],'attributes':_0x26314a[_0x4e12('0x19')],'include':_0x26314a[_0x4e12('0x16')]?_['map'](_0x26314a[_0x4e12('0x16')],function(_0x499995){return{'model':db[_0x499995[_0x4e12('0x18')]],'as':_0x499995['as'],'attributes':_0x499995[_0x4e12('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e12('0x6')](function(_0x45aa9d){logger['info']('GetCmHopper',_0x259b4d);logger[_0x4e12('0x1e')](_0x4e12('0x10'),_0x259b4d,JSON['stringify'](_0x45aa9d));_0x40462e(_0x45aa9d);})[_0x4e12('0xf')](function(_0xd5f317){logger[_0x4e12('0xa')](_0x4e12('0x10'),_0xd5f317[_0x4e12('0xd')],_0x259b4d);_0x3f682d(_0x17c33f['error'](0x1f4,_0xd5f317[_0x4e12('0xd')]));});});});};exports['GetContactByPhone']=function(_0x581305){var _0xdf4fe0=this;return new Promise(function(_0x4f6093,_0x1d5156){return db[_0x4e12('0x27')]['findOne']({'raw':!![],'where':{'phone':_0x581305[_0x4e12('0x12')]['where'][_0x4e12('0x48')]},'attributes':['id',_0x4e12('0x49')],'order':[['id',_0x4e12('0x4a')]]})[_0x4e12('0x6')](function(_0x45b14f){logger[_0x4e12('0x7')](_0x4e12('0x4b'),_0x581305);logger[_0x4e12('0x1e')](_0x4e12('0x4b'),_0x581305,JSON[_0x4e12('0x1a')](_0x45b14f));_0x4f6093(_0x45b14f);})[_0x4e12('0xf')](function(_0x3fccdd){logger[_0x4e12('0xa')](_0x4e12('0x4b'),_0x3fccdd[_0x4e12('0xd')],_0x581305);_0x1d5156(_0xdf4fe0[_0x4e12('0xa')](0x1f4,_0x3fccdd['message']));});});};exports[_0x4e12('0x4c')]=function(_0x530030){var _0x2430d3=this;return new Promise(function(_0x12f49c,_0x1e6cd9){return db[_0x4e12('0x28')][_0x4e12('0x3a')](function(_0x34a338){return db['CmHopper'][_0x4e12('0x33')](_0x530030['body'],{'where':{},'transaction':_0x34a338})['then'](function(_0xb761dd){logger['info'](_0x4e12('0x4c'),_0x530030);logger[_0x4e12('0x1e')](_0x4e12('0x4c'),_0x530030,JSON[_0x4e12('0x1a')](_0xb761dd));_0x12f49c(_0xb761dd);})['catch'](function(_0x41c476){logger[_0x4e12('0xa')](_0x4e12('0x4c'),_0x41c476[_0x4e12('0xd')],_0x530030);_0x1e6cd9(_0x2430d3[_0x4e12('0xa')](0x1f4,_0x41c476[_0x4e12('0xd')]));});});});};exports[_0x4e12('0x4d')]=function(_0x5bf75e){var _0xbefb2e=this;var _0x5c9630=_0x5bf75e[_0x4e12('0x20')][_0x4e12('0x14')]['voiceQueueIds'];var _0x4ca520=_0x5bf75e[_0x4e12('0x20')]['where'][_0x4e12('0x4e')];var _0x531599=_0x5bf75e['body']['where'][_0x4e12('0x4f')];return new Promise(function(_0xc99fa0,_0x593e00){return db[_0x4e12('0x1c')]['findAll']({'where':{'voiceQueueId':{'$in':_0x5c9630},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4e12('0x28')][_0x4e12('0x3e')](_0x4e12('0x50')+_0x4ca520+_0x4e12('0x51')),'$gt':db[_0x4e12('0x28')][_0x4e12('0x3e')]('NOW()')}},'UserId':{'$in':_0x531599}},'include':[{'model':db[_0x4e12('0x27')],'as':_0x4e12('0x2a')},{'model':db[_0x4e12('0x2c')],'as':'Agent','attributes':['id',_0x4e12('0x2e'),_0x4e12('0x2f')]},{'model':db[_0x4e12('0x52')],'as':_0x4e12('0x53')}]})[_0x4e12('0x6')](function(_0x1980ab){if(_0x1980ab[_0x4e12('0x30')]>0x0){return db[_0x4e12('0x28')][_0x4e12('0x3a')](function(_0x230921){return db[_0x4e12('0x1c')]['update']({'recallmeNotifiedDate':db[_0x4e12('0x28')]['literal'](_0x4e12('0x54'))},{'where':{'id':{'$in':_[_0x4e12('0x17')](_0x1980ab,'id')}},'transaction':_0x230921})[_0x4e12('0x6')](function(){_0xc99fa0(_0x1980ab);})['catch'](function(_0x22da86){logger['error'](_0x4e12('0x4d'),_0x22da86['message'],_0x5bf75e);_0x593e00(_0xbefb2e[_0x4e12('0xa')](0x1f4,_0x22da86[_0x4e12('0xd')]));});})[_0x4e12('0xf')](function(_0x54521a){logger[_0x4e12('0xa')]('CmHopperHandlePreviewRecallNotifications',_0x54521a[_0x4e12('0xd')],_0x5bf75e);_0x593e00(_0xbefb2e[_0x4e12('0xa')](0x1f4,_0x54521a[_0x4e12('0xd')]));});}else{_0xc99fa0(_0x1980ab);}});});}; \ No newline at end of file +var _0x143a=['name','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','moment','bluebird','../../mysqldb','../../config/logger','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','include','model','catch','find','ShowCmHopper','stringify','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','order','LOCK','Contact','keys','User','Agent','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','GetContactByPhone','phone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()'];(function(_0x3790f1,_0x1f6272){var _0x3978cd=function(_0x33390c){while(--_0x33390c){_0x3790f1['push'](_0x3790f1['shift']());}};_0x3978cd(++_0x1f6272);}(_0x143a,0x1c1));var _0xa143=function(_0x31ddea,_0x40de6d){_0x31ddea=_0x31ddea-0x0;var _0x12539b=_0x143a[_0x31ddea];return _0x12539b;};'use strict';var _=require(_0xa143('0x0'));var util=require('util');var moment=require(_0xa143('0x1'));var BPromise=require(_0xa143('0x2'));var db=require(_0xa143('0x3'))['db'];var logger=require(_0xa143('0x4'))('rpc');var jayson=require('jayson/promise');var client=jayson[_0xa143('0x5')][_0xa143('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x513195,_0x1fe314,_0x4ea719){return new BPromise(function(_0x594b3d,_0x3df418){return client[_0xa143('0x7')](_0x513195,_0x4ea719)[_0xa143('0x8')](function(_0x4b1b05){logger['info'](_0xa143('0x9'),_0x1fe314,_0xa143('0xa'));logger[_0xa143('0xb')](_0xa143('0xc'),_0x1fe314,_0xa143('0xa'),JSON['stringify'](_0x4b1b05));if(_0x4b1b05[_0xa143('0xd')]){if(_0x4b1b05[_0xa143('0xd')][_0xa143('0xe')]===0x1f4){logger[_0xa143('0xd')](_0xa143('0x9'),_0x1fe314,_0x4b1b05[_0xa143('0xd')][_0xa143('0xf')]);return _0x3df418(_0x4b1b05[_0xa143('0xd')][_0xa143('0xf')]);}logger[_0xa143('0xd')]('CmHopper,\x20%s,\x20%s',_0x1fe314,_0x4b1b05['error'][_0xa143('0xf')]);return _0x594b3d(_0x4b1b05[_0xa143('0xd')][_0xa143('0xf')]);}else{logger[_0xa143('0x10')](_0xa143('0x9'),_0x1fe314,_0xa143('0xa'));_0x594b3d(_0x4b1b05[_0xa143('0x11')][_0xa143('0xf')]);}})['catch'](function(_0x352eda){logger[_0xa143('0xd')](_0xa143('0x9'),_0x1fe314,_0x352eda);_0x3df418(_0x352eda);});});}exports[_0xa143('0x12')]=function(_0x9bec4b){var _0x1ea9b1=this;return new Promise(function(_0x5b235c,_0x15f360){return db[_0xa143('0x13')][_0xa143('0x14')]({'raw':_0x9bec4b[_0xa143('0x15')]?_0x9bec4b[_0xa143('0x15')][_0xa143('0x16')]===undefined?!![]:![]:!![],'where':_0x9bec4b[_0xa143('0x15')]?_0x9bec4b[_0xa143('0x15')][_0xa143('0x17')]||null:null,'attributes':_0x9bec4b['options']?_0x9bec4b[_0xa143('0x15')][_0xa143('0x18')]||null:null,'limit':_0x9bec4b['options']?_0x9bec4b[_0xa143('0x15')][_0xa143('0x19')]||null:null,'include':_0x9bec4b[_0xa143('0x15')]?_0x9bec4b[_0xa143('0x15')]['include']?_[_0xa143('0x1a')](_0x9bec4b[_0xa143('0x15')][_0xa143('0x1b')],function(_0x677999){return{'model':db[_0x677999[_0xa143('0x1c')]],'as':_0x677999['as'],'attributes':_0x677999[_0xa143('0x18')],'include':_0x677999[_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x677999[_0xa143('0x1b')],function(_0x472550){return{'model':db[_0x472550['model']],'as':_0x472550['as'],'attributes':_0x472550[_0xa143('0x18')],'include':_0x472550[_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x472550[_0xa143('0x1b')],function(_0x5c4edb){return{'model':db[_0x5c4edb[_0xa143('0x1c')]],'as':_0x5c4edb['as'],'attributes':_0x5c4edb[_0xa143('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa143('0x8')](function(_0x3ff330){logger[_0xa143('0x10')](_0xa143('0x12'),_0x9bec4b);logger[_0xa143('0xb')](_0xa143('0x12'),_0x9bec4b,JSON['stringify'](_0x3ff330));_0x5b235c(_0x3ff330);})[_0xa143('0x1d')](function(_0x5ec3e1){logger[_0xa143('0xd')](_0xa143('0x12'),_0x5ec3e1[_0xa143('0xf')],_0x9bec4b);_0x15f360(_0x1ea9b1['error'](0x1f4,_0x5ec3e1[_0xa143('0xf')]));});});};exports['ShowCmHopper']=function(_0x2d19a0){var _0x1e8e76=this;return new Promise(function(_0x1e82cb,_0x43ffa4){return db[_0xa143('0x13')][_0xa143('0x1e')]({'raw':_0x2d19a0['options']?_0x2d19a0[_0xa143('0x15')][_0xa143('0x16')]===undefined?!![]:![]:!![],'where':_0x2d19a0[_0xa143('0x15')]?_0x2d19a0['options'][_0xa143('0x17')]||null:null,'attributes':_0x2d19a0['options']?_0x2d19a0[_0xa143('0x15')][_0xa143('0x18')]||null:null,'include':_0x2d19a0['options']?_0x2d19a0[_0xa143('0x15')][_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x2d19a0[_0xa143('0x15')][_0xa143('0x1b')],function(_0x5b2408){return{'model':db[_0x5b2408[_0xa143('0x1c')]],'as':_0x5b2408['as'],'attributes':_0x5b2408['attributes'],'include':_0x5b2408[_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x5b2408[_0xa143('0x1b')],function(_0x5b5d77){return{'model':db[_0x5b5d77[_0xa143('0x1c')]],'as':_0x5b5d77['as'],'attributes':_0x5b5d77['attributes'],'include':_0x5b5d77['include']?_[_0xa143('0x1a')](_0x5b5d77['include'],function(_0x39e68b){return{'model':db[_0x39e68b[_0xa143('0x1c')]],'as':_0x39e68b['as'],'attributes':_0x39e68b[_0xa143('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa143('0x8')](function(_0x5ed04e){logger[_0xa143('0x10')](_0xa143('0x1f'),_0x2d19a0);logger[_0xa143('0xb')](_0xa143('0x1f'),_0x2d19a0,JSON[_0xa143('0x20')](_0x5ed04e));_0x1e82cb(_0x5ed04e);})['catch'](function(_0x479872){logger[_0xa143('0xd')](_0xa143('0x1f'),_0x479872[_0xa143('0xf')],_0x2d19a0);_0x43ffa4(_0x1e8e76['error'](0x1f4,_0x479872[_0xa143('0xf')]));});});};exports[_0xa143('0x21')]=function(_0x155ec7){var _0x464c67=this;return new Promise(function(_0x26ded8,_0x338fb8){return db[_0xa143('0x13')][_0xa143('0x22')](_0x155ec7[_0xa143('0x23')],{'raw':_0x155ec7[_0xa143('0x15')]?_0x155ec7[_0xa143('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xa143('0x8')](function(_0x123bb8){logger['info'](_0xa143('0x21'),_0x155ec7);logger['debug']('CreateCmHopper',_0x155ec7,JSON[_0xa143('0x20')](_0x123bb8));_0x26ded8(_0x123bb8);})['catch'](function(_0x5e785b){logger[_0xa143('0xd')]('CreateCmHopper',_0x5e785b['message'],_0x155ec7);_0x338fb8(_0x464c67[_0xa143('0xd')](0x1f4,_0x5e785b['message']));});});};exports[_0xa143('0x24')]=function(_0x587512){var _0x423319=this;return new Promise(function(_0x373b2a,_0x27c12c){return db['CmHopper'][_0xa143('0x25')](_0x587512[_0xa143('0x23')],{'raw':_0x587512['options']?_0x587512[_0xa143('0x15')][_0xa143('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x587512[_0xa143('0x15')]?_0x587512[_0xa143('0x15')][_0xa143('0x17')]||null:null,'attributes':_0x587512[_0xa143('0x15')]?_0x587512[_0xa143('0x15')][_0xa143('0x18')]||null:null,'limit':_0x587512[_0xa143('0x15')]?_0x587512[_0xa143('0x15')]['limit']||null:null})['then'](function(_0x45305a){logger[_0xa143('0x10')]('UpdateCmHopper',_0x587512);logger[_0xa143('0x10')](_0xa143('0x26'),JSON[_0xa143('0x20')](_0x587512[_0xa143('0x15')][_0xa143('0x17')]),_0x587512['body'][_0xa143('0x27')]);logger[_0xa143('0xb')](_0xa143('0x24'),_0x587512,JSON[_0xa143('0x20')](_0x45305a));_0x373b2a(_0x45305a);})[_0xa143('0x1d')](function(_0x329cdb){logger[_0xa143('0xd')](_0xa143('0x24'),_0x329cdb[_0xa143('0xf')],_0x587512);_0x27c12c(_0x423319[_0xa143('0xd')](0x1f4,_0x329cdb[_0xa143('0xf')]));});});};exports[_0xa143('0x28')]=function(_0x3885fa){var _0xb2cedd=this;return new Promise(function(_0x246afb,_0x1f9a81){return db['CmHopper'][_0xa143('0x29')]({'where':_0x3885fa[_0xa143('0x15')]?_0x3885fa['options']['where']||null:null})[_0xa143('0x8')](function(_0xac3498){logger[_0xa143('0x10')](_0xa143('0x28'),_0x3885fa);logger[_0xa143('0xb')](_0xa143('0x28'),_0x3885fa,JSON[_0xa143('0x20')](_0xac3498));_0x246afb(_0xac3498);})[_0xa143('0x1d')](function(_0x4b5229){logger[_0xa143('0xd')](_0xa143('0x28'),_0x4b5229['message'],_0x3885fa);_0x1f9a81(_0xb2cedd[_0xa143('0xd')](0x1f4,_0x4b5229[_0xa143('0xf')]));});});};exports['GetContactDialer']=function(_0x5f0a1b){var _0xa1c18f=this;return new Promise(function(_0x49d1c8,_0x48289f){return db[_0xa143('0x2a')][_0xa143('0x2b')]()[_0xa143('0x8')](function(_0x4a6063){return db[_0xa143('0x2c')][_0xa143('0x2d')](function(_0x364cf1){return db['CmHopper']['findAll']({'where':_0x5f0a1b[_0xa143('0x15')]?_0x5f0a1b[_0xa143('0x15')][_0xa143('0x17')]||null:null,'attributes':_0x5f0a1b[_0xa143('0x15')]?_0x5f0a1b[_0xa143('0x15')][_0xa143('0x18')]||null:null,'limit':_0x5f0a1b['options']?_0x5f0a1b['options'][_0xa143('0x19')]||null:null,'order':_0x5f0a1b[_0xa143('0x15')]?_0x5f0a1b['options'][_0xa143('0x2e')]||null:null,'transaction':_0x364cf1,'lock':_0x364cf1[_0xa143('0x2f')]['UPDATE'],'include':[{'model':db[_0xa143('0x2a')],'as':_0xa143('0x30'),'attributes':_[_0xa143('0x31')](_0x4a6063)},{'model':db[_0xa143('0x32')],'as':_0xa143('0x33'),'attributes':['id','name',_0xa143('0x34')]}]})[_0xa143('0x8')](function(_0x136637){var _0x6c37c8=[];var _0x98c104=[];for(var _0x183e49=0x0;_0x183e49<_0x136637[_0xa143('0x35')];_0x183e49+=0x1){var _0x2dc84a=_0x136637[_0x183e49][_0xa143('0x36')];if(_0x2dc84a===null){_0x6c37c8[_0xa143('0x37')](_0x136637[_0x183e49]['update'](_0x5f0a1b[_0xa143('0x23')],{'transaction':_0x364cf1}));}else if(!_0x98c104[_0xa143('0x38')](_0x2dc84a)){_0x98c104[_0xa143('0x37')](_0x2dc84a);_0x6c37c8[_0xa143('0x37')](_0x136637[_0x183e49][_0xa143('0x25')](_0x5f0a1b['body'],{'transaction':_0x364cf1}));}}return BPromise[_0xa143('0x39')](_0x6c37c8);});})[_0xa143('0x8')](function(_0x1c3dd7){logger[_0xa143('0x10')]('GetContactDialer',_0x5f0a1b);if(_0x1c3dd7[_0xa143('0x35')]>0x0){logger[_0xa143('0x10')](_0xa143('0x3a'),_0x1c3dd7[0x0][_0xa143('0x3b')]['id'],_0x1c3dd7[0x0][_0xa143('0x3b')][_0xa143('0x3c')],_0x1c3dd7[0x0]['dataValues'][_0xa143('0x27')]);}logger[_0xa143('0xb')](_0xa143('0x3d'),_0x5f0a1b,JSON[_0xa143('0x20')](_0x1c3dd7));_0x49d1c8(_0x1c3dd7);})[_0xa143('0x1d')](function(_0x5c5b54){logger[_0xa143('0xd')](_0xa143('0x3d'),_0x5c5b54[_0xa143('0xf')],_0x5f0a1b);_0x48289f(_0xa1c18f[_0xa143('0xd')](0x1f4,_0x5c5b54['message']));});});});};exports[_0xa143('0x3e')]=function(_0x5852d0){var _0x57facc=this;return new Promise(function(_0x43432c,_0x41ebd4){return db[_0xa143('0x2c')][_0xa143('0x2d')](function(_0x3d41ab){return db[_0xa143('0x3f')][_0xa143('0x22')](_0x5852d0[_0xa143('0x23')],{'raw':_0x5852d0[_0xa143('0x15')]?_0x5852d0[_0xa143('0x15')]['raw']===undefined?!![]:![]:!![],'transaction':_0x3d41ab})[_0xa143('0x8')](function(){logger[_0xa143('0x10')](_0xa143('0x40'),JSON[_0xa143('0x20')](_0x5852d0[_0xa143('0x15')]['where']),_0x5852d0[_0xa143('0x15')]['where'][_0xa143('0x27')]);return db['CmHopper'][_0xa143('0x29')]({'where':_0x5852d0['options']?_0x5852d0[_0xa143('0x15')][_0xa143('0x17')]||null:null,'transaction':_0x3d41ab});});})[_0xa143('0x8')](function(_0x473005){logger['info'](_0xa143('0x3e'),_0x5852d0);logger['debug'](_0xa143('0x3e'),_0x5852d0,JSON[_0xa143('0x20')](_0x473005));_0x43432c(_0x473005);})[_0xa143('0x1d')](function(_0xd7bef1){logger[_0xa143('0xd')](_0xa143('0x3e'),_0xd7bef1[_0xa143('0xf')],_0x5852d0);_0x41ebd4(_0x57facc[_0xa143('0xd')](0x1f4,_0xd7bef1['message']));});});};exports['CountReScheduled']=function(_0x43185a){var _0x398985=this;return new Promise(function(_0x585186,_0x3b1e1c){return db[_0xa143('0x13')][_0xa143('0x14')]({'raw':_0x43185a[_0xa143('0x15')]?_0x43185a[_0xa143('0x15')][_0xa143('0x16')]===undefined?!![]:![]:!![],'where':_0x43185a[_0xa143('0x15')]?_0x43185a[_0xa143('0x15')]['where']||null:null,'attributes':[[db[_0xa143('0x2c')]['fn'](_0xa143('0x41'),db['sequelize']['fn']('IF',db[_0xa143('0x2c')][_0xa143('0x42')](_0xa143('0x43')+util[_0xa143('0x44')](_0xa143('0x45'),moment()[_0xa143('0x44')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xa143('0x46')))),_0xa143('0x47')]]})['then'](function(_0x5af7e6){logger[_0xa143('0x10')](_0xa143('0x48'),_0x43185a);logger['debug'](_0xa143('0x48'),_0x43185a,JSON[_0xa143('0x20')](_0x5af7e6));_0x585186(_0x5af7e6);})[_0xa143('0x1d')](function(_0x51b6e9){logger['error'](_0xa143('0x48'),_0x51b6e9[_0xa143('0xf')],_0x43185a);_0x3b1e1c(_0x398985[_0xa143('0xd')](0x1f4,_0x51b6e9['message']));});});};exports[_0xa143('0x49')]=function(_0x2fec72){var _0x36b10b=this;return new Promise(function(_0x2fe6a8,_0x569d98){return db['CmContact'][_0xa143('0x2b')]()[_0xa143('0x8')](function(_0x177833){return db[_0xa143('0x2c')]['transaction'](function(_0x17a102){return db[_0xa143('0x13')][_0xa143('0x14')]({'where':_0x2fec72[_0xa143('0x15')]?_0x2fec72[_0xa143('0x15')][_0xa143('0x17')]||null:null,'attributes':_0x2fec72[_0xa143('0x15')]?_0x2fec72[_0xa143('0x15')]['attributes']||null:null,'limit':0x1,'order':_0x2fec72[_0xa143('0x15')]?_0x2fec72['options'][_0xa143('0x2e')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x17a102,'lock':_0x17a102['LOCK'][_0xa143('0x4a')],'include':_0x2fec72[_0xa143('0x15')]?_0x2fec72['options'][_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x2fec72['options'][_0xa143('0x1b')],function(_0x5b4253){return{'model':db[_0x5b4253[_0xa143('0x1c')]],'as':_0x5b4253['as'],'attributes':_0x5b4253['attributes'],'include':_0x5b4253[_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x5b4253[_0xa143('0x1b')],function(_0x36e36f){return{'model':db[_0x36e36f[_0xa143('0x1c')]],'as':_0x36e36f['as'],'attributes':_0x36e36f['attributes'],'include':_0x36e36f[_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x36e36f[_0xa143('0x1b')],function(_0xf0fdd6){return{'model':db[_0xf0fdd6[_0xa143('0x1c')]],'as':_0xf0fdd6['as'],'attributes':_0xf0fdd6['attributes']};}):[]};}):[]};}):[]:[]})[_0xa143('0x8')](function(_0x386753){var _0x18edf3=[];for(var _0x38f74e=0x0;_0x38f74e<_0x386753[_0xa143('0x35')];_0x38f74e+=0x1){_0x18edf3[_0xa143('0x37')](_0x386753[_0x38f74e][_0xa143('0x25')](_0x2fec72[_0xa143('0x23')],{'transaction':_0x17a102}));}return BPromise[_0xa143('0x39')](_0x18edf3);});})[_0xa143('0x8')](function(_0x38e898){logger[_0xa143('0x10')](_0xa143('0x49'),_0x2fec72);logger[_0xa143('0xb')](_0xa143('0x49'),_0x2fec72,JSON[_0xa143('0x20')](_0x38e898));_0x2fe6a8(_0x38e898);})['catch'](function(_0x31daec){logger[_0xa143('0xd')](_0xa143('0x49'),_0x31daec['message'],_0x2fec72);_0x569d98(_0x36b10b['error'](0x1f4,_0x31daec[_0xa143('0xf')]));});});});};exports[_0xa143('0x4b')]=function(_0x1ca37d){var _0x586b64=this;return new Promise(function(_0x513d8c,_0x1d703c){db[_0xa143('0x2a')]['describe']()[_0xa143('0x8')](function(_0x2f1fb2){return db['CmHopper'][_0xa143('0x14')]({'raw':_0x1ca37d[_0xa143('0x15')]?_0x1ca37d[_0xa143('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1ca37d[_0xa143('0x15')]?_0x1ca37d[_0xa143('0x15')][_0xa143('0x17')]||null:null,'attributes':_0x1ca37d[_0xa143('0x15')]?_0x1ca37d[_0xa143('0x15')][_0xa143('0x18')]||null:null,'limit':_0x1ca37d[_0xa143('0x15')]?_0x1ca37d['options']['limit']||null:null,'include':_0x1ca37d[_0xa143('0x15')]?_0x1ca37d[_0xa143('0x15')][_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x1ca37d['options'][_0xa143('0x1b')],function(_0x4e748e){return{'model':db[_0x4e748e[_0xa143('0x1c')]],'as':_0x4e748e['as'],'attributes':_0x4e748e['as']===_0xa143('0x30')?_[_0xa143('0x31')](_0x2f1fb2):_0x4e748e[_0xa143('0x18')],'include':_0x4e748e[_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x4e748e['include'],function(_0x53f159){return{'model':db[_0x53f159[_0xa143('0x1c')]],'as':_0x53f159['as'],'attributes':_0x53f159[_0xa143('0x18')],'include':_0x53f159['include']?_[_0xa143('0x1a')](_0x53f159[_0xa143('0x1b')],function(_0x3bed8c){return{'model':db[_0x3bed8c[_0xa143('0x1c')]],'as':_0x3bed8c['as'],'attributes':_0x3bed8c[_0xa143('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa143('0x8')](function(_0x5470f){logger[_0xa143('0x10')](_0xa143('0x12'),_0x1ca37d);logger[_0xa143('0xb')](_0xa143('0x12'),_0x1ca37d,JSON['stringify'](_0x5470f));_0x513d8c(_0x5470f);})[_0xa143('0x1d')](function(_0x30b962){logger[_0xa143('0xd')]('GetCmHopper',_0x30b962['message'],_0x1ca37d);_0x1d703c(_0x586b64[_0xa143('0xd')](0x1f4,_0x30b962[_0xa143('0xf')]));});});});};exports[_0xa143('0x4c')]=function(_0x1967b6){var _0x2d3da8=this;return new Promise(function(_0x4c8d11,_0x49fa8b){return db[_0xa143('0x2a')]['findOne']({'raw':!![],'where':{'phone':_0x1967b6['options'][_0xa143('0x17')][_0xa143('0x4d')]},'attributes':['id','dialTimezone'],'order':[['id',_0xa143('0x4e')]]})['then'](function(_0x44aa7c){logger[_0xa143('0x10')](_0xa143('0x4f'),_0x1967b6);logger['debug'](_0xa143('0x4f'),_0x1967b6,JSON[_0xa143('0x20')](_0x44aa7c));_0x4c8d11(_0x44aa7c);})[_0xa143('0x1d')](function(_0x498721){logger[_0xa143('0xd')](_0xa143('0x4f'),_0x498721[_0xa143('0xf')],_0x1967b6);_0x49fa8b(_0x2d3da8[_0xa143('0xd')](0x1f4,_0x498721['message']));});});};exports['ResetActiveCalls']=function(_0x1c2dbd){var _0x214d54=this;return new Promise(function(_0x3ec8d6,_0x17fd33){return db[_0xa143('0x2c')]['transaction'](function(_0x461d0c){return db[_0xa143('0x13')]['update'](_0x1c2dbd[_0xa143('0x23')],{'where':{},'transaction':_0x461d0c})['then'](function(_0x1e742c){logger['info']('ResetActiveCalls',_0x1c2dbd);logger['debug'](_0xa143('0x50'),_0x1c2dbd,JSON[_0xa143('0x20')](_0x1e742c));_0x3ec8d6(_0x1e742c);})[_0xa143('0x1d')](function(_0x3ac73f){logger[_0xa143('0xd')]('ResetActiveCalls',_0x3ac73f['message'],_0x1c2dbd);_0x17fd33(_0x214d54[_0xa143('0xd')](0x1f4,_0x3ac73f[_0xa143('0xf')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0xc3273e){var _0x34171a=this;var _0x214416=_0xc3273e[_0xa143('0x23')][_0xa143('0x17')][_0xa143('0x51')];var _0x447499=_0xc3273e[_0xa143('0x23')][_0xa143('0x17')]['interval'];var _0x7b645e=_0xc3273e[_0xa143('0x23')][_0xa143('0x17')][_0xa143('0x52')];return new Promise(function(_0x53b392,_0x2892f3){return db[_0xa143('0x13')][_0xa143('0x14')]({'where':{'voiceQueueId':{'$in':_0x214416},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xa143('0x2c')][_0xa143('0x42')](_0xa143('0x53')+_0x447499+'\x20MINUTE'),'$gt':db[_0xa143('0x2c')][_0xa143('0x42')](_0xa143('0x54'))}},'UserId':{'$in':_0x7b645e}},'include':[{'model':db['CmContact'],'as':_0xa143('0x30')},{'model':db[_0xa143('0x32')],'as':_0xa143('0x33'),'attributes':['id',_0xa143('0x55'),'voicePause']},{'model':db[_0xa143('0x56')],'as':_0xa143('0x57')}]})['then'](function(_0x47794f){if(_0x47794f['length']>0x0){return db['sequelize'][_0xa143('0x2d')](function(_0x491197){return db[_0xa143('0x13')][_0xa143('0x25')]({'recallmeNotifiedDate':db['sequelize'][_0xa143('0x42')]('NOW()')},{'where':{'id':{'$in':_[_0xa143('0x1a')](_0x47794f,'id')}},'transaction':_0x491197})[_0xa143('0x8')](function(){_0x53b392(_0x47794f);})[_0xa143('0x1d')](function(_0x8d066a){logger[_0xa143('0xd')](_0xa143('0x58'),_0x8d066a[_0xa143('0xf')],_0xc3273e);_0x2892f3(_0x34171a[_0xa143('0xd')](0x1f4,_0x8d066a[_0xa143('0xf')]));});})[_0xa143('0x1d')](function(_0x116f4c){logger[_0xa143('0xd')](_0xa143('0x58'),_0x116f4c['message'],_0xc3273e);_0x2892f3(_0x34171a['error'](0x1f4,_0x116f4c[_0xa143('0xf')]));});}else{_0x53b392(_0x47794f);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 18655bb..985b78f 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 _0x5799=['/timezone','getTimezone','update','exports','express','../../components/auth/service','get','isAuthenticated','describe','/opencontacts','/timezones','getTimezones','/:id','post','create','/preview','getPreview'];(function(_0x2b8e36,_0x4145eb){var _0x3255a6=function(_0x52cb14){while(--_0x52cb14){_0x2b8e36['push'](_0x2b8e36['shift']());}};_0x3255a6(++_0x4145eb);}(_0x5799,0x1ad));var _0x9579=function(_0x2f4c94,_0x112089){_0x2f4c94=_0x2f4c94-0x0;var _0x4f6e55=_0x5799[_0x2f4c94];return _0x4f6e55;};'use strict';var express=require(_0x9579('0x0'));var router=express['Router']();var auth=require(_0x9579('0x1'));var controller=require('./cmHopper.controller');router[_0x9579('0x2')]('/',auth[_0x9579('0x3')](),controller['index']);router[_0x9579('0x2')]('/describe',auth[_0x9579('0x3')](),controller[_0x9579('0x4')]);router[_0x9579('0x2')](_0x9579('0x5'),auth[_0x9579('0x3')](),controller['getOpenContacts']);router['get'](_0x9579('0x6'),auth[_0x9579('0x3')](),controller[_0x9579('0x7')]);router['get'](_0x9579('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x9579('0x2')]('/:id/previewrecall',auth[_0x9579('0x3')](),controller['getPreviewRecall']);router[_0x9579('0x9')]('/',auth[_0x9579('0x3')](),controller[_0x9579('0xa')]);router['post'](_0x9579('0xb'),auth['isAuthenticated'](),controller[_0x9579('0xc')]);router[_0x9579('0x9')](_0x9579('0xd'),auth['isAuthenticated'](),controller[_0x9579('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9579('0xf')]);router['delete'](_0x9579('0x8'),auth[_0x9579('0x3')](),controller['destroy']);module[_0x9579('0x10')]=router; \ No newline at end of file +var _0xf118=['index','get','/describe','describe','/opencontacts','getTimezones','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated'];(function(_0x727101,_0x3c37e1){var _0x1ddc48=function(_0x2d4146){while(--_0x2d4146){_0x727101['push'](_0x727101['shift']());}};_0x1ddc48(++_0x3c37e1);}(_0xf118,0x17b));var _0x8f11=function(_0x2bc2a2,_0x51e95f){_0x2bc2a2=_0x2bc2a2-0x0;var _0x20de67=_0xf118[_0x2bc2a2];return _0x20de67;};'use strict';var express=require(_0x8f11('0x0'));var router=express[_0x8f11('0x1')]();var auth=require(_0x8f11('0x2'));var controller=require(_0x8f11('0x3'));router['get']('/',auth[_0x8f11('0x4')](),controller[_0x8f11('0x5')]);router[_0x8f11('0x6')](_0x8f11('0x7'),auth[_0x8f11('0x4')](),controller[_0x8f11('0x8')]);router[_0x8f11('0x6')](_0x8f11('0x9'),auth[_0x8f11('0x4')](),controller['getOpenContacts']);router['get']('/timezones',auth[_0x8f11('0x4')](),controller[_0x8f11('0xa')]);router[_0x8f11('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x8f11('0xb')]);router[_0x8f11('0x6')](_0x8f11('0xc'),auth[_0x8f11('0x4')](),controller[_0x8f11('0xd')]);router[_0x8f11('0xe')]('/',auth['isAuthenticated'](),controller[_0x8f11('0xf')]);router[_0x8f11('0xe')](_0x8f11('0x10'),auth[_0x8f11('0x4')](),controller[_0x8f11('0x11')]);router['post'](_0x8f11('0x12'),auth['isAuthenticated'](),controller['getTimezone']);router[_0x8f11('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8f11('0x14')]);router[_0x8f11('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8f11('0x16')]);module[_0x8f11('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 8d5026a..ff6f465 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 _0x21ec=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER'];(function(_0x3442f9,_0x3e901f){var _0x286f5=function(_0x4c11c7){while(--_0x4c11c7){_0x3442f9['push'](_0x3442f9['shift']());}};_0x286f5(++_0x3e901f);}(_0x21ec,0x12c));var _0xc21e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x21ec[_0xefd519];return _0x4bb882;};'use strict';var moment=require(_0xc21e('0x0'));var Sequelize=require(_0xc21e('0x1'));module[_0xc21e('0x2')]={'CmHopperId':{'type':Sequelize[_0xc21e('0x3')]},'phone':{'type':Sequelize[_0xc21e('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xc21e('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xc21e('0x5')],'defaultValue':moment()[_0xc21e('0x6')](_0xc21e('0x7'))},'countbusyretry':{'type':Sequelize[_0xc21e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc21e('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc21e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc21e('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc21e('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfe30=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe30,0x1a2));var _0x0fe3=function(_0x22ec80,_0x304732){_0x22ec80=_0x22ec80-0x0;var _0x3018b4=_0xfe30[_0x22ec80];return _0x3018b4;};'use strict';var moment=require(_0x0fe3('0x0'));var Sequelize=require('sequelize');module[_0x0fe3('0x1')]={'CmHopperId':{'type':Sequelize[_0x0fe3('0x2')]},'phone':{'type':Sequelize[_0x0fe3('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0fe3('0x4')],'defaultValue':moment()[_0x0fe3('0x5')](_0x0fe3('0x6'))},'countbusyretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 5a1fb20..86c252a 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 _0x1fb5=['send','map','CmHopperAdditionalPhone','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x1fb5,0x1c1));var _0x51fb=function(_0x12c877,_0x3b5ef7){_0x12c877=_0x12c877-0x0;var _0x3e592d=_0x1fb5[_0x12c877];return _0x3e592d;};'use strict';var emlformat=require(_0x51fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51fb('0x1'));var jsonpatch=require(_0x51fb('0x2'));var rp=require('request-promise');var moment=require(_0x51fb('0x3'));var BPromise=require(_0x51fb('0x4'));var Mustache=require('mustache');var util=require(_0x51fb('0x5'));var path=require(_0x51fb('0x6'));var sox=require(_0x51fb('0x7'));var csv=require('to-csv');var ejs=require(_0x51fb('0x8'));var fs=require('fs');var fs_extra=require(_0x51fb('0x9'));var _=require(_0x51fb('0xa'));var squel=require(_0x51fb('0xb'));var crypto=require(_0x51fb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x51fb('0xd'));var toCsv=require(_0x51fb('0xe'));var querystring=require('querystring');var Papa=require(_0x51fb('0xf'));var Redis=require('ioredis');var authService=require(_0x51fb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x51fb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51fb('0x12'))('api');var utils=require(_0x51fb('0x13'));var config=require(_0x51fb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x51fb('0x15'))['db'];function respondWithStatusCode(_0x18889d,_0x4ed7d6){_0x4ed7d6=_0x4ed7d6||0xcc;return function(_0x1966bf){if(_0x1966bf){return _0x18889d['sendStatus'](_0x4ed7d6);}return _0x18889d[_0x51fb('0x16')](_0x4ed7d6)[_0x51fb('0x17')]();};}function respondWithResult(_0x4498eb,_0x24bc50){_0x24bc50=_0x24bc50||0xc8;return function(_0xd5b2d7){if(_0xd5b2d7){return _0x4498eb[_0x51fb('0x16')](_0x24bc50)[_0x51fb('0x18')](_0xd5b2d7);}};}function respondWithFilteredResult(_0x47efba,_0xd916d0){return function(_0xba5a9e){if(_0xba5a9e){var _0x494a83=typeof _0xd916d0[_0x51fb('0x19')]===_0x51fb('0x1a')&&typeof _0xd916d0['limit']===_0x51fb('0x1a');var _0x9c91e9=_0xba5a9e[_0x51fb('0x1b')];var _0x2e5c8f=_0x494a83?0x0:_0xd916d0[_0x51fb('0x19')];var _0x58f8e7=_0x494a83?_0xba5a9e['count']:_0xd916d0['offset']+_0xd916d0[_0x51fb('0x1c')];var _0xacf4a5;if(_0x58f8e7>=_0x9c91e9){_0x58f8e7=_0x9c91e9;_0xacf4a5=0xc8;}else{_0xacf4a5=0xce;}_0x47efba[_0x51fb('0x16')](_0xacf4a5);return _0x47efba[_0x51fb('0x1d')](_0x51fb('0x1e'),_0x2e5c8f+'-'+_0x58f8e7+'/'+_0x9c91e9)['json'](_0xba5a9e);}return null;};}function patchUpdates(_0x539e42){return function(_0x45c63d){try{jsonpatch[_0x51fb('0x1f')](_0x45c63d,_0x539e42,!![]);}catch(_0x345dbe){return BPromise[_0x51fb('0x20')](_0x345dbe);}return _0x45c63d[_0x51fb('0x21')]();};}function saveUpdates(_0x2f26b6,_0xc5db27){return function(_0x10d9e7){if(_0x10d9e7){return _0x10d9e7[_0x51fb('0x22')](_0x2f26b6)[_0x51fb('0x23')](function(_0x57633c){return _0x57633c;});}return null;};}function removeEntity(_0x57e78b,_0x518fe4){return function(_0x3f0333){if(_0x3f0333){return _0x3f0333[_0x51fb('0x24')]()[_0x51fb('0x23')](function(){var _0x328fba=_0x3f0333[_0x51fb('0x25')]({'plain':!![]});var _0x46685d=_0x51fb('0x26');return db[_0x51fb('0x27')][_0x51fb('0x24')]({'where':{'type':_0x46685d,'resourceId':_0x328fba['id']}})[_0x51fb('0x23')](function(){return _0x3f0333;});})['then'](function(){_0x57e78b[_0x51fb('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d5189,_0x3881d7){return function(_0x452f9a){if(!_0x452f9a){_0x1d5189['sendStatus'](0x194);}return _0x452f9a;};}function handleError(_0x577c4a,_0xacc281){_0xacc281=_0xacc281||0x1f4;return function(_0x3dfcf6){logger[_0x51fb('0x28')](_0x3dfcf6[_0x51fb('0x29')]);if(_0x3dfcf6[_0x51fb('0x2a')]){delete _0x3dfcf6[_0x51fb('0x2a')];}_0x577c4a[_0x51fb('0x16')](_0xacc281)[_0x51fb('0x2b')](_0x3dfcf6);};}exports['index']=function(_0x2c1932,_0x519b76){var _0x485f95={},_0x5225c0={},_0x219463={'count':0x0,'rows':[]};var _0x1ce1b6=_[_0x51fb('0x2c')](db[_0x51fb('0x2d')]['rawAttributes'],function(_0x718e39){return{'name':_0x718e39[_0x51fb('0x2e')],'type':_0x718e39['type']['key']};});_0x5225c0['model']=_['map'](_0x1ce1b6,_0x51fb('0x2a'));_0x5225c0[_0x51fb('0x2f')]=_[_0x51fb('0x30')](_0x2c1932[_0x51fb('0x2f')]);_0x5225c0[_0x51fb('0x31')]=_[_0x51fb('0x32')](_0x5225c0[_0x51fb('0x33')],_0x5225c0['query']);_0x485f95[_0x51fb('0x34')]=_[_0x51fb('0x32')](_0x5225c0[_0x51fb('0x33')],qs[_0x51fb('0x35')](_0x2c1932[_0x51fb('0x2f')]['fields']));_0x485f95[_0x51fb('0x34')]=_0x485f95[_0x51fb('0x34')]['length']?_0x485f95[_0x51fb('0x34')]:_0x5225c0[_0x51fb('0x33')];if(!_0x2c1932[_0x51fb('0x2f')][_0x51fb('0x36')]('nolimit')){_0x485f95[_0x51fb('0x1c')]=qs[_0x51fb('0x1c')](_0x2c1932[_0x51fb('0x2f')][_0x51fb('0x1c')]);_0x485f95['offset']=qs[_0x51fb('0x19')](_0x2c1932['query'][_0x51fb('0x19')]);}_0x485f95[_0x51fb('0x37')]=qs[_0x51fb('0x38')](_0x2c1932[_0x51fb('0x2f')][_0x51fb('0x38')]);_0x485f95[_0x51fb('0x39')]=qs[_0x51fb('0x31')](_[_0x51fb('0x3a')](_0x2c1932[_0x51fb('0x2f')],_0x5225c0[_0x51fb('0x31')]),_0x1ce1b6);if(_0x2c1932['query'][_0x51fb('0x3b')]){_0x485f95['where']=_[_0x51fb('0x3c')](_0x485f95[_0x51fb('0x39')],{'$or':_['map'](_0x1ce1b6,function(_0x2bfa9b){if(_0x2bfa9b[_0x51fb('0x3d')]!=='VIRTUAL'){var _0x3c63fc={};_0x3c63fc[_0x2bfa9b[_0x51fb('0x2a')]]={'$like':'%'+_0x2c1932[_0x51fb('0x2f')][_0x51fb('0x3b')]+'%'};return _0x3c63fc;}})});}_0x485f95=_[_0x51fb('0x3c')]({},_0x485f95,_0x2c1932[_0x51fb('0x3e')]);var _0x3ad778={'where':_0x485f95[_0x51fb('0x39')]};return db[_0x51fb('0x2d')][_0x51fb('0x1b')](_0x3ad778)['then'](function(_0x359297){_0x219463[_0x51fb('0x1b')]=_0x359297;if(_0x2c1932[_0x51fb('0x2f')][_0x51fb('0x3f')]){_0x485f95[_0x51fb('0x40')]=[{'all':!![]}];}return db[_0x51fb('0x2d')][_0x51fb('0x41')](_0x485f95);})[_0x51fb('0x23')](function(_0x28298c){_0x219463[_0x51fb('0x42')]=_0x28298c;return _0x219463;})[_0x51fb('0x23')](respondWithFilteredResult(_0x519b76,_0x485f95))[_0x51fb('0x43')](handleError(_0x519b76,null));};exports[_0x51fb('0x44')]=function(_0x3085bb,_0x51ab4c){var _0x122820={'raw':!![],'where':{'id':_0x3085bb[_0x51fb('0x45')]['id']}},_0x5f1542={};_0x5f1542[_0x51fb('0x33')]=_[_0x51fb('0x30')](db[_0x51fb('0x2d')][_0x51fb('0x46')]);_0x5f1542['query']=_[_0x51fb('0x30')](_0x3085bb['query']);_0x5f1542['filters']=_['intersection'](_0x5f1542[_0x51fb('0x33')],_0x5f1542[_0x51fb('0x2f')]);_0x122820[_0x51fb('0x34')]=_[_0x51fb('0x32')](_0x5f1542['model'],qs[_0x51fb('0x35')](_0x3085bb[_0x51fb('0x2f')][_0x51fb('0x35')]));_0x122820[_0x51fb('0x34')]=_0x122820['attributes'][_0x51fb('0x47')]?_0x122820[_0x51fb('0x34')]:_0x5f1542[_0x51fb('0x33')];if(_0x3085bb[_0x51fb('0x2f')]['includeAll']){_0x122820[_0x51fb('0x40')]=[{'all':!![]}];}_0x122820=_['merge']({},_0x122820,_0x3085bb[_0x51fb('0x3e')]);return db[_0x51fb('0x2d')][_0x51fb('0x48')](_0x122820)[_0x51fb('0x23')](handleEntityNotFound(_0x51ab4c,null))[_0x51fb('0x23')](respondWithResult(_0x51ab4c,null))[_0x51fb('0x43')](handleError(_0x51ab4c,null));};exports[_0x51fb('0x49')]=function(_0x437f3c,_0x40dceb){return db[_0x51fb('0x2d')][_0x51fb('0x49')](_0x437f3c[_0x51fb('0x4a')],{})[_0x51fb('0x23')](function(_0x3ad1ee){var _0x227a31=_0x437f3c['user'][_0x51fb('0x25')]({'plain':!![]});if(!_0x227a31)throw new Error(_0x51fb('0x4b'));if(_0x227a31[_0x51fb('0x4c')]===_0x51fb('0x4d')){var _0x51146d=_0x3ad1ee[_0x51fb('0x25')]({'plain':!![]});var _0x46c19d=_0x51fb('0x26');return db[_0x51fb('0x4e')][_0x51fb('0x48')]({'where':{'name':_0x46c19d,'userProfileId':_0x227a31[_0x51fb('0x4f')]},'raw':!![]})['then'](function(_0x40f894){if(_0x40f894&&_0x40f894[_0x51fb('0x50')]===0x0){return db[_0x51fb('0x27')][_0x51fb('0x49')]({'name':_0x51146d['name'],'resourceId':_0x51146d['id'],'type':_0x40f894['name'],'sectionId':_0x40f894['id']},{})[_0x51fb('0x23')](function(){return _0x3ad1ee;});}else{return _0x3ad1ee;}})[_0x51fb('0x43')](function(_0x53b8e5){logger['error'](_0x51fb('0x51'),_0x53b8e5);throw _0x53b8e5;});}return _0x3ad1ee;})[_0x51fb('0x23')](respondWithResult(_0x40dceb,0xc9))[_0x51fb('0x43')](handleError(_0x40dceb,null));};exports[_0x51fb('0x22')]=function(_0x524ac6,_0x2018da){if(_0x524ac6[_0x51fb('0x4a')]['id']){delete _0x524ac6['body']['id'];}return db['CmHopperAdditionalPhone'][_0x51fb('0x48')]({'where':{'id':_0x524ac6['params']['id']}})['then'](handleEntityNotFound(_0x2018da,null))[_0x51fb('0x23')](saveUpdates(_0x524ac6[_0x51fb('0x4a')],null))['then'](respondWithResult(_0x2018da,null))[_0x51fb('0x43')](handleError(_0x2018da,null));};exports[_0x51fb('0x24')]=function(_0x4371ff,_0x4a0c10){return db[_0x51fb('0x2d')]['find']({'where':{'id':_0x4371ff[_0x51fb('0x45')]['id']}})[_0x51fb('0x23')](handleEntityNotFound(_0x4a0c10,null))['then'](removeEntity(_0x4a0c10,null))[_0x51fb('0x43')](handleError(_0x4a0c10,null));}; \ No newline at end of file +var _0xe834=['get','CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','destroy','then'];(function(_0x3fc869,_0xc7a1c7){var _0x376ded=function(_0x279778){while(--_0x279778){_0x3fc869['push'](_0x3fc869['shift']());}};_0x376ded(++_0xc7a1c7);}(_0xe834,0xc1));var _0x4e83=function(_0x10eb40,_0x3f5002){_0x10eb40=_0x10eb40-0x0;var _0x36e2d1=_0xe834[_0x10eb40];return _0x36e2d1;};'use strict';var emlformat=require(_0x4e83('0x0'));var rimraf=require(_0x4e83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e83('0x2'));var rp=require(_0x4e83('0x3'));var moment=require(_0x4e83('0x4'));var BPromise=require(_0x4e83('0x5'));var Mustache=require('mustache');var util=require(_0x4e83('0x6'));var path=require(_0x4e83('0x7'));var sox=require('sox');var csv=require(_0x4e83('0x8'));var ejs=require(_0x4e83('0x9'));var fs=require('fs');var fs_extra=require(_0x4e83('0xa'));var _=require(_0x4e83('0xb'));var squel=require(_0x4e83('0xc'));var crypto=require(_0x4e83('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4e83('0xe'));var Papa=require(_0x4e83('0xf'));var Redis=require(_0x4e83('0x10'));var authService=require(_0x4e83('0x11'));var qs=require(_0x4e83('0x12'));var as=require(_0x4e83('0x13'));var hardwareService=require(_0x4e83('0x14'));var logger=require(_0x4e83('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4e83('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e83('0x17'))['db'];function respondWithStatusCode(_0x21b66c,_0x389954){_0x389954=_0x389954||0xcc;return function(_0xca6f19){if(_0xca6f19){return _0x21b66c[_0x4e83('0x18')](_0x389954);}return _0x21b66c[_0x4e83('0x19')](_0x389954)[_0x4e83('0x1a')]();};}function respondWithResult(_0x50d655,_0x52a612){_0x52a612=_0x52a612||0xc8;return function(_0x590132){if(_0x590132){return _0x50d655['status'](_0x52a612)['json'](_0x590132);}};}function respondWithFilteredResult(_0x37c56c,_0x4122e9){return function(_0x20696b){if(_0x20696b){var _0xc19501=typeof _0x4122e9['offset']===_0x4e83('0x1b')&&typeof _0x4122e9['limit']==='undefined';var _0x69532f=_0x20696b[_0x4e83('0x1c')];var _0x41f3b5=_0xc19501?0x0:_0x4122e9['offset'];var _0x29f855=_0xc19501?_0x20696b[_0x4e83('0x1c')]:_0x4122e9[_0x4e83('0x1d')]+_0x4122e9[_0x4e83('0x1e')];var _0x229771;if(_0x29f855>=_0x69532f){_0x29f855=_0x69532f;_0x229771=0xc8;}else{_0x229771=0xce;}_0x37c56c[_0x4e83('0x19')](_0x229771);return _0x37c56c['set'](_0x4e83('0x1f'),_0x41f3b5+'-'+_0x29f855+'/'+_0x69532f)[_0x4e83('0x20')](_0x20696b);}return null;};}function patchUpdates(_0x402c6e){return function(_0x28cf7d){try{jsonpatch[_0x4e83('0x21')](_0x28cf7d,_0x402c6e,!![]);}catch(_0x50587e){return BPromise[_0x4e83('0x22')](_0x50587e);}return _0x28cf7d[_0x4e83('0x23')]();};}function saveUpdates(_0x2ed1e8,_0x39206a){return function(_0x1de062){if(_0x1de062){return _0x1de062['update'](_0x2ed1e8)['then'](function(_0x4bf164){return _0x4bf164;});}return null;};}function removeEntity(_0x3adb1c,_0x467c48){return function(_0x5afeb0){if(_0x5afeb0){return _0x5afeb0[_0x4e83('0x24')]()[_0x4e83('0x25')](function(){var _0x14694d=_0x5afeb0[_0x4e83('0x26')]({'plain':!![]});var _0x5b03c6=_0x4e83('0x27');return db[_0x4e83('0x28')]['destroy']({'where':{'type':_0x5b03c6,'resourceId':_0x14694d['id']}})[_0x4e83('0x25')](function(){return _0x5afeb0;});})['then'](function(){_0x3adb1c[_0x4e83('0x19')](0xcc)[_0x4e83('0x1a')]();});}};}function handleEntityNotFound(_0x260306,_0x572d36){return function(_0x375009){if(!_0x375009){_0x260306[_0x4e83('0x18')](0x194);}return _0x375009;};}function handleError(_0x14577e,_0x359b44){_0x359b44=_0x359b44||0x1f4;return function(_0x31f53d){logger['error'](_0x31f53d[_0x4e83('0x29')]);if(_0x31f53d[_0x4e83('0x2a')]){delete _0x31f53d[_0x4e83('0x2a')];}_0x14577e[_0x4e83('0x19')](_0x359b44)[_0x4e83('0x2b')](_0x31f53d);};}exports[_0x4e83('0x2c')]=function(_0x459021,_0x3569ac){var _0x4f5d51={},_0x347c7e={},_0x4c7359={'count':0x0,'rows':[]};var _0x1610a5=_[_0x4e83('0x2d')](db[_0x4e83('0x2e')]['rawAttributes'],function(_0x365b21){return{'name':_0x365b21[_0x4e83('0x2f')],'type':_0x365b21[_0x4e83('0x30')]['key']};});_0x347c7e[_0x4e83('0x31')]=_['map'](_0x1610a5,'name');_0x347c7e['query']=_[_0x4e83('0x32')](_0x459021[_0x4e83('0x33')]);_0x347c7e[_0x4e83('0x34')]=_[_0x4e83('0x35')](_0x347c7e[_0x4e83('0x31')],_0x347c7e[_0x4e83('0x33')]);_0x4f5d51['attributes']=_['intersection'](_0x347c7e[_0x4e83('0x31')],qs[_0x4e83('0x36')](_0x459021[_0x4e83('0x33')][_0x4e83('0x36')]));_0x4f5d51['attributes']=_0x4f5d51[_0x4e83('0x37')][_0x4e83('0x38')]?_0x4f5d51[_0x4e83('0x37')]:_0x347c7e['model'];if(!_0x459021['query'][_0x4e83('0x39')]('nolimit')){_0x4f5d51[_0x4e83('0x1e')]=qs['limit'](_0x459021['query']['limit']);_0x4f5d51['offset']=qs[_0x4e83('0x1d')](_0x459021[_0x4e83('0x33')][_0x4e83('0x1d')]);}_0x4f5d51['order']=qs['sort'](_0x459021['query']['sort']);_0x4f5d51[_0x4e83('0x3a')]=qs[_0x4e83('0x34')](_['pick'](_0x459021[_0x4e83('0x33')],_0x347c7e['filters']),_0x1610a5);if(_0x459021[_0x4e83('0x33')][_0x4e83('0x3b')]){_0x4f5d51[_0x4e83('0x3a')]=_[_0x4e83('0x3c')](_0x4f5d51[_0x4e83('0x3a')],{'$or':_[_0x4e83('0x2d')](_0x1610a5,function(_0x522cb3){if(_0x522cb3['type']!==_0x4e83('0x3d')){var _0x693c54={};_0x693c54[_0x522cb3[_0x4e83('0x2a')]]={'$like':'%'+_0x459021[_0x4e83('0x33')][_0x4e83('0x3b')]+'%'};return _0x693c54;}})});}_0x4f5d51=_[_0x4e83('0x3c')]({},_0x4f5d51,_0x459021['options']);var _0x3b2bad={'where':_0x4f5d51[_0x4e83('0x3a')]};return db[_0x4e83('0x2e')]['count'](_0x3b2bad)[_0x4e83('0x25')](function(_0x508b23){_0x4c7359[_0x4e83('0x1c')]=_0x508b23;if(_0x459021[_0x4e83('0x33')][_0x4e83('0x3e')]){_0x4f5d51['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x4e83('0x3f')](_0x4f5d51);})['then'](function(_0x28efc0){_0x4c7359[_0x4e83('0x40')]=_0x28efc0;return _0x4c7359;})[_0x4e83('0x25')](respondWithFilteredResult(_0x3569ac,_0x4f5d51))[_0x4e83('0x41')](handleError(_0x3569ac,null));};exports[_0x4e83('0x42')]=function(_0x51b390,_0x133c60){var _0x135c2f={'raw':!![],'where':{'id':_0x51b390[_0x4e83('0x43')]['id']}},_0x1b1c66={};_0x1b1c66['model']=_[_0x4e83('0x32')](db[_0x4e83('0x2e')]['rawAttributes']);_0x1b1c66['query']=_['keys'](_0x51b390[_0x4e83('0x33')]);_0x1b1c66[_0x4e83('0x34')]=_[_0x4e83('0x35')](_0x1b1c66[_0x4e83('0x31')],_0x1b1c66[_0x4e83('0x33')]);_0x135c2f[_0x4e83('0x37')]=_[_0x4e83('0x35')](_0x1b1c66[_0x4e83('0x31')],qs['fields'](_0x51b390['query']['fields']));_0x135c2f[_0x4e83('0x37')]=_0x135c2f['attributes'][_0x4e83('0x38')]?_0x135c2f[_0x4e83('0x37')]:_0x1b1c66[_0x4e83('0x31')];if(_0x51b390[_0x4e83('0x33')][_0x4e83('0x3e')]){_0x135c2f[_0x4e83('0x44')]=[{'all':!![]}];}_0x135c2f=_[_0x4e83('0x3c')]({},_0x135c2f,_0x51b390['options']);return db[_0x4e83('0x2e')][_0x4e83('0x45')](_0x135c2f)['then'](handleEntityNotFound(_0x133c60,null))[_0x4e83('0x25')](respondWithResult(_0x133c60,null))['catch'](handleError(_0x133c60,null));};exports[_0x4e83('0x46')]=function(_0x4c98fc,_0x36025e){return db[_0x4e83('0x2e')][_0x4e83('0x46')](_0x4c98fc['body'],{})[_0x4e83('0x25')](function(_0x240917){var _0xe01fd7=_0x4c98fc[_0x4e83('0x47')][_0x4e83('0x26')]({'plain':!![]});if(!_0xe01fd7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe01fd7[_0x4e83('0x48')]===_0x4e83('0x47')){var _0x212107=_0x240917[_0x4e83('0x26')]({'plain':!![]});var _0x3d6ac0=_0x4e83('0x27');return db['UserProfileSection'][_0x4e83('0x45')]({'where':{'name':_0x3d6ac0,'userProfileId':_0xe01fd7[_0x4e83('0x49')]},'raw':!![]})[_0x4e83('0x25')](function(_0x5de578){if(_0x5de578&&_0x5de578['autoAssociation']===0x0){return db[_0x4e83('0x28')][_0x4e83('0x46')]({'name':_0x212107['name'],'resourceId':_0x212107['id'],'type':_0x5de578[_0x4e83('0x2a')],'sectionId':_0x5de578['id']},{})['then'](function(){return _0x240917;});}else{return _0x240917;}})[_0x4e83('0x41')](function(_0x319324){logger['error'](_0x4e83('0x4a'),_0x319324);throw _0x319324;});}return _0x240917;})[_0x4e83('0x25')](respondWithResult(_0x36025e,0xc9))[_0x4e83('0x41')](handleError(_0x36025e,null));};exports[_0x4e83('0x4b')]=function(_0x2825ad,_0x4cab3c){if(_0x2825ad[_0x4e83('0x4c')]['id']){delete _0x2825ad['body']['id'];}return db[_0x4e83('0x2e')][_0x4e83('0x45')]({'where':{'id':_0x2825ad[_0x4e83('0x43')]['id']}})[_0x4e83('0x25')](handleEntityNotFound(_0x4cab3c,null))[_0x4e83('0x25')](saveUpdates(_0x2825ad[_0x4e83('0x4c')],null))[_0x4e83('0x25')](respondWithResult(_0x4cab3c,null))[_0x4e83('0x41')](handleError(_0x4cab3c,null));};exports['destroy']=function(_0x90f200,_0x5e8f52){return db[_0x4e83('0x2e')][_0x4e83('0x45')]({'where':{'id':_0x90f200[_0x4e83('0x43')]['id']}})[_0x4e83('0x25')](handleEntityNotFound(_0x5e8f52,null))[_0x4e83('0x25')](removeEntity(_0x5e8f52,null))[_0x4e83('0x41')](handleError(_0x5e8f52,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index c28e20d..2e12957 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 _0xcacd=['path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','moment','bluebird','request-promise'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0xcacd,0x1bf));var _0xdcac=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xcacd[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xdcac('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdcac('0x1'));var BPromise=require(_0xdcac('0x2'));var rp=require(_0xdcac('0x3'));var fs=require('fs');var path=require(_0xdcac('0x4'));var rimraf=require(_0xdcac('0x5'));var config=require('../../config/environment');var attributes=require(_0xdcac('0x6'));module[_0xdcac('0x7')]=function(_0x208907,_0x58af9f){return _0x208907[_0xdcac('0x8')](_0xdcac('0x9'),attributes,{'tableName':_0xdcac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c7e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','api'];(function(_0x2c0e4c,_0x203e04){var _0x176a73=function(_0x16a8b0){while(--_0x16a8b0){_0x2c0e4c['push'](_0x2c0e4c['shift']());}};_0x176a73(++_0x203e04);}(_0x3c7e,0xdb));var _0xe3c7=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0x3c7e[_0x52096b];return _0x2b1cc7;};'use strict';var _=require('lodash');var util=require(_0xe3c7('0x0'));var logger=require('../../config/logger')(_0xe3c7('0x1'));var moment=require(_0xe3c7('0x2'));var BPromise=require(_0xe3c7('0x3'));var rp=require(_0xe3c7('0x4'));var fs=require('fs');var path=require(_0xe3c7('0x5'));var rimraf=require(_0xe3c7('0x6'));var config=require(_0xe3c7('0x7'));var attributes=require(_0xe3c7('0x8'));module[_0xe3c7('0x9')]=function(_0x595d55,_0x3e0da8){return _0x595d55[_0xe3c7('0xa')](_0xe3c7('0xb'),attributes,{'tableName':_0xe3c7('0xc'),'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 5856839..c9f261e 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 _0x261c=['countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x3a2ee2,_0x59d56b){var _0x1e7d1e=function(_0x815530){while(--_0x815530){_0x3a2ee2['push'](_0x3a2ee2['shift']());}};_0x1e7d1e(++_0x59d56b);}(_0x261c,0x101));var _0xc261=function(_0x5bca8f,_0x1683d5){_0x5bca8f=_0x5bca8f-0x0;var _0x20fd20=_0x261c[_0x5bca8f];return _0x20fd20;};'use strict';var _=require(_0xc261('0x0'));var util=require(_0xc261('0x1'));var moment=require(_0xc261('0x2'));var BPromise=require('bluebird');var rs=require(_0xc261('0x3'));var fs=require('fs');var Redis=require(_0xc261('0x4'));var db=require(_0xc261('0x5'))['db'];var utils=require(_0xc261('0x6'));var logger=require(_0xc261('0x7'))(_0xc261('0x8'));var config=require(_0xc261('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc261('0xa')][_0xc261('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30c0a2,_0x52d7c9,_0x5c4a9f){return new BPromise(function(_0xe9ba0e,_0x559ca5){return client[_0xc261('0xc')](_0x30c0a2,_0x5c4a9f)[_0xc261('0xd')](function(_0x596a45){logger[_0xc261('0xe')](_0xc261('0xf'),_0x52d7c9,_0xc261('0x10'));logger[_0xc261('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x52d7c9,_0xc261('0x10'),JSON['stringify'](_0x596a45));if(_0x596a45['error']){if(_0x596a45[_0xc261('0x12')][_0xc261('0x13')]===0x1f4){logger[_0xc261('0x12')](_0xc261('0xf'),_0x52d7c9,_0x596a45[_0xc261('0x12')][_0xc261('0x14')]);return _0x559ca5(_0x596a45[_0xc261('0x12')][_0xc261('0x14')]);}logger[_0xc261('0x12')](_0xc261('0xf'),_0x52d7c9,_0x596a45['error'][_0xc261('0x14')]);return _0xe9ba0e(_0x596a45[_0xc261('0x12')][_0xc261('0x14')]);}else{logger[_0xc261('0xe')](_0xc261('0xf'),_0x52d7c9,'request\x20sent');_0xe9ba0e(_0x596a45[_0xc261('0x15')][_0xc261('0x14')]);}})[_0xc261('0x16')](function(_0x477735){logger[_0xc261('0x12')](_0xc261('0xf'),_0x52d7c9,_0x477735);_0x559ca5(_0x477735);});});}exports[_0xc261('0x17')]=function(_0x1c345b){var _0x3c898c=this;return new Promise(function(_0x32e431,_0x14780b){return db[_0xc261('0x18')][_0xc261('0x19')]({'raw':!![],'where':{'ContactId':_0x1c345b[_0xc261('0x1a')]['ContactId'],'ListId':_0x1c345b['body'][_0xc261('0x1b')],'VoiceQueueId':_0x1c345b[_0xc261('0x1a')][_0xc261('0x1c')]===undefined?null:_0x1c345b['body'][_0xc261('0x1c')],'CampaignId':_0x1c345b[_0xc261('0x1a')][_0xc261('0x1d')]===undefined?null:_0x1c345b[_0xc261('0x1a')][_0xc261('0x1d')]}})[_0xc261('0xd')](function(_0x1739d3){if(_0x1739d3!=null){return db[_0xc261('0x1e')][_0xc261('0x19')]({'raw':!![],'where':{'CmHopperId':_0x1739d3['id'],'OrderBy':{'$gt':_0x1739d3[_0xc261('0x1f')]}},'order':[['OrderBy',_0xc261('0x20')]]})[_0xc261('0xd')](function(_0x17dd40){var _0x60a1ab=0x0;if(_0x17dd40){if(_0x17dd40[_0xc261('0x21')]+_0x17dd40[_0xc261('0x22')]+_0x17dd40[_0xc261('0x23')]+_0x17dd40[_0xc261('0x24')]+_0x17dd40[_0xc261('0x25')]+_0x17dd40[_0xc261('0x26')]+_0x17dd40[_0xc261('0x27')]+_0x17dd40[_0xc261('0x28')]<_0x1c345b[_0xc261('0x29')][_0xc261('0x2a')])_0x60a1ab=0x1;_0x32e431({'additional':_0x60a1ab});}else{return db[_0xc261('0x1e')][_0xc261('0x19')]({'raw':!![],'where':{'CmHopperId':_0x1739d3['id']},'order':[[_0xc261('0x1f'),_0xc261('0x20')]]})['then'](function(_0x59866f){var _0x3322df=0x0;if(_0x59866f){if(_0x59866f['countbusyretry']+_0x59866f[_0xc261('0x22')]+_0x59866f['countnoanswerretry']+_0x59866f['countnosuchnumberretry']+_0x59866f[_0xc261('0x25')]+_0x59866f[_0xc261('0x26')]+_0x59866f[_0xc261('0x27')]+_0x59866f[_0xc261('0x28')]<_0x1c345b[_0xc261('0x29')][_0xc261('0x2a')])_0x3322df=0x1;_0x32e431({'additional':_0x3322df});}else{_0x32e431({'additional':0x0});}})['catch'](function(_0x165352){logger[_0xc261('0x12')](_0xc261('0x17'),_0x165352['message']);_0x14780b(_0x3c898c[_0xc261('0x12')](0x1f4,_0x165352[_0xc261('0x14')]));});}})[_0xc261('0x16')](function(_0x3cc583){logger[_0xc261('0x12')](_0xc261('0x17'),_0x3cc583[_0xc261('0x14')]);_0x14780b(_0x3c898c[_0xc261('0x12')](0x1f4,_0x3cc583[_0xc261('0x14')]));});}else _0x32e431({'additional':0x0});});});};exports[_0xc261('0x2b')]=function(_0x1015c7){var _0x3269a7=this;return new Promise(function(_0x197c75,_0x2b759d){return db[_0xc261('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x1015c7[_0xc261('0x1a')][_0xc261('0x2c')],'ListId':_0x1015c7[_0xc261('0x1a')][_0xc261('0x1b')],'VoiceQueueId':_0x1015c7[_0xc261('0x1a')][_0xc261('0x1c')]===undefined?null:_0x1015c7[_0xc261('0x1a')]['VoiceQueueId'],'CampaignId':_0x1015c7[_0xc261('0x1a')][_0xc261('0x1d')]===undefined?null:_0x1015c7['body']['CampaignId']}})[_0xc261('0xd')](function(_0x3def24){if(_0x3def24!=null){return db[_0xc261('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3def24['id'],'OrderBy':{'$gte':_0x3def24[_0xc261('0x1f')]}},'order':[['OrderBy',_0xc261('0x20')]]})[_0xc261('0xd')](function(_0x17037b){if(_0x17037b)return activateAdditionalPhone(_0x3def24,_0x1015c7['body'],_0x17037b,_0x1015c7[_0xc261('0x2d')],_0x1015c7[_0xc261('0x2e')])[_0xc261('0xd')](function(_0x57b98c){_0x197c75(_0x57b98c);});else{return db[_0xc261('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3def24['id']},'order':[[_0xc261('0x1f'),'ASC']]})['then'](function(_0x5d5378){if(_0x5d5378)return activateAdditionalPhone(_0x3def24,_0x1015c7[_0xc261('0x1a')],_0x5d5378,_0x1015c7[_0xc261('0x2d')],_0x1015c7[_0xc261('0x2e')])[_0xc261('0xd')](function(_0x566d46){_0x197c75(_0x566d46);});else{_0x197c75({'id':_0x3def24['id'],'phone':''});}})[_0xc261('0x16')](function(_0x1ddd09){logger[_0xc261('0x12')](_0xc261('0x17'),_0x1ddd09[_0xc261('0x14')]);_0x2b759d(_0x3269a7[_0xc261('0x12')](0x1f4,_0x1ddd09[_0xc261('0x14')]));});}})['catch'](function(_0x4d9a1e){logger['error'](_0xc261('0x17'),_0x4d9a1e[_0xc261('0x14')]);_0x2b759d(_0x3269a7['error'](0x1f4,_0x4d9a1e[_0xc261('0x14')]));});}else _0x197c75(0x1);});});};function activateAdditionalPhone(_0x3f6bb6,_0x34a029,_0x1eca77,_0x86e5eb,_0x4177d9){return new Promise(function(_0x4c4f9,_0x190352){var _0x4c431c;if(_[_0xc261('0x2f')](_0x1eca77[_0xc261('0x30')])){_0x1eca77[_0xc261('0x30')]=moment();}if(moment()>moment(_0x1eca77[_0xc261('0x30')])){_0x4c431c=moment()[_0xc261('0x31')](_0x4177d9||0x3,'minutes');}else{if(_0x1eca77[_0xc261('0x1f')]==0x0){_0x4c431c=moment(_0x1eca77[_0xc261('0x30')]);}else{_0x4c431c=moment()[_0xc261('0x31')](_0x4177d9||0x3,_0xc261('0x32'));}}if(_[_0xc261('0x2f')](_0x4c431c)){_0x4c431c=moment()[_0xc261('0x31')](_0x4177d9||0x3,_0xc261('0x32'));}var _0x15e855={'phone':_0x3f6bb6[_0xc261('0x33')],'active':0x0,'OrderBy':_[_0xc261('0x2f')](_0x3f6bb6[_0xc261('0x1f')])?0x0:_0x3f6bb6[_0xc261('0x1f')],'scheduledat':moment()[_0xc261('0x31')](_0x86e5eb||0x1,'minutes'),'countbusyretry':_0x34a029[_0xc261('0x21')],'countcongestionretry':_0x34a029['countcongestionretry'],'countnoanswerretry':_0x34a029['countnoanswerretry'],'countnosuchnumberretry':_0x34a029['countnosuchnumberretry'],'countdropretry':_0x34a029[_0xc261('0x25')],'countabandonedretry':_0x34a029[_0xc261('0x26')],'countmachineretry':_0x34a029[_0xc261('0x27')],'countagentrejectretry':_0x34a029[_0xc261('0x28')],'createdAt':_0x34a029[_0xc261('0x34')],'updatedAt':_0x34a029['updatedAt']};var _0x3cfecd={'CmHopperId':_0x3f6bb6['id'],'phone':_0x1eca77['phone'],'active':0x0,'OrderBy':_['isNil'](_0x1eca77[_0xc261('0x1f')])?0x0:_0x1eca77[_0xc261('0x1f')],'scheduledat':_0x4c431c,'countbusyretry':_0x1eca77[_0xc261('0x21')],'countcongestionretry':_0x1eca77[_0xc261('0x22')],'countnoanswerretry':_0x1eca77[_0xc261('0x23')],'countnosuchnumberretry':_0x1eca77[_0xc261('0x24')],'countdropretry':_0x1eca77[_0xc261('0x25')],'countabandonedretry':_0x1eca77[_0xc261('0x26')],'countmachineretry':_0x1eca77[_0xc261('0x27')],'countagentrejectretry':_0x1eca77[_0xc261('0x28')],'createdAt':_0x1eca77['createdAt'],'updatedAt':_0x1eca77['updatedAt']};return db[_0xc261('0x35')][_0xc261('0x36')](function(_0x30bd43){return db[_0xc261('0x1e')][_0xc261('0x37')](_0x15e855,{'where':{'id':_0x1eca77['id']}},{'transaction':_0x30bd43})[_0xc261('0xd')](function(){return db['CmHopper']['update'](_0x3cfecd,{'where':{'id':_0x3f6bb6['id']}},{'transaction':_0x30bd43});});})['then'](function(_0x485453){_0x4c4f9({'id':_0x3f6bb6['id'],'phone':_0x1eca77[_0xc261('0x33')]});})[_0xc261('0x16')](function(_0x4ed9da){logger[_0xc261('0x12')](_0xc261('0x38'),_0x4ed9da['message']);_0x190352({'error':_0x4ed9da[_0xc261('0x14')]});});});}exports['IncrementPreviewCounters']=function(_0x28d3c6){var _0x566cc1=this;return new Promise(function(_0x18b6b1,_0x4087a9){return db[_0xc261('0x18')][_0xc261('0x37')](_0x28d3c6['body'][_0xc261('0x39')],{'where':{'id':_0x28d3c6['body']['id']}})[_0xc261('0xd')](function(_0x9c4e73){_0x18b6b1(_0x9c4e73);})[_0xc261('0x16')](function(_0x250704){logger[_0xc261('0x12')](_0xc261('0x3a'),_0x250704[_0xc261('0x14')]);_0x4087a9(_0x566cc1[_0xc261('0x12')](0x1f4,_0x250704['message']));});});}; \ No newline at end of file +var _0x1cf0=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','findOne','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','ASC'];(function(_0x37cfe7,_0x38c2e2){var _0x182fdd=function(_0x53baf2){while(--_0x53baf2){_0x37cfe7['push'](_0x37cfe7['shift']());}};_0x182fdd(++_0x38c2e2);}(_0x1cf0,0x182));var _0x01cf=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x1cf0[_0x53bcc3];return _0x47c959;};'use strict';var _=require(_0x01cf('0x0'));var util=require(_0x01cf('0x1'));var moment=require(_0x01cf('0x2'));var BPromise=require(_0x01cf('0x3'));var rs=require(_0x01cf('0x4'));var fs=require('fs');var Redis=require(_0x01cf('0x5'));var db=require(_0x01cf('0x6'))['db'];var utils=require(_0x01cf('0x7'));var logger=require(_0x01cf('0x8'))(_0x01cf('0x9'));var config=require(_0x01cf('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x01cf('0xb')][_0x01cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44f84e,_0x28c4f8,_0x5abce3){return new BPromise(function(_0x5cca6a,_0x1a2442){return client[_0x01cf('0xd')](_0x44f84e,_0x5abce3)[_0x01cf('0xe')](function(_0x15b021){logger[_0x01cf('0xf')](_0x01cf('0x10'),_0x28c4f8,_0x01cf('0x11'));logger[_0x01cf('0x12')](_0x01cf('0x13'),_0x28c4f8,_0x01cf('0x11'),JSON[_0x01cf('0x14')](_0x15b021));if(_0x15b021[_0x01cf('0x15')]){if(_0x15b021[_0x01cf('0x15')]['code']===0x1f4){logger[_0x01cf('0x15')](_0x01cf('0x10'),_0x28c4f8,_0x15b021[_0x01cf('0x15')][_0x01cf('0x16')]);return _0x1a2442(_0x15b021['error'][_0x01cf('0x16')]);}logger[_0x01cf('0x15')](_0x01cf('0x10'),_0x28c4f8,_0x15b021[_0x01cf('0x15')][_0x01cf('0x16')]);return _0x5cca6a(_0x15b021['error']['message']);}else{logger[_0x01cf('0xf')](_0x01cf('0x10'),_0x28c4f8,_0x01cf('0x11'));_0x5cca6a(_0x15b021[_0x01cf('0x17')][_0x01cf('0x16')]);}})[_0x01cf('0x18')](function(_0x23b12a){logger[_0x01cf('0x15')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x28c4f8,_0x23b12a);_0x1a2442(_0x23b12a);});});}exports[_0x01cf('0x19')]=function(_0x18095e){var _0x56655f=this;return new Promise(function(_0x56d8f5,_0x258bfc){return db[_0x01cf('0x1a')]['findOne']({'raw':!![],'where':{'ContactId':_0x18095e[_0x01cf('0x1b')][_0x01cf('0x1c')],'ListId':_0x18095e[_0x01cf('0x1b')][_0x01cf('0x1d')],'VoiceQueueId':_0x18095e[_0x01cf('0x1b')][_0x01cf('0x1e')]===undefined?null:_0x18095e[_0x01cf('0x1b')][_0x01cf('0x1e')],'CampaignId':_0x18095e['body'][_0x01cf('0x1f')]===undefined?null:_0x18095e[_0x01cf('0x1b')][_0x01cf('0x1f')]}})[_0x01cf('0xe')](function(_0xea3044){if(_0xea3044!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0xea3044['id'],'OrderBy':{'$gt':_0xea3044[_0x01cf('0x20')]}},'order':[[_0x01cf('0x20'),_0x01cf('0x21')]]})[_0x01cf('0xe')](function(_0x14760c){var _0x29dbfc=0x0;if(_0x14760c){if(_0x14760c[_0x01cf('0x22')]+_0x14760c[_0x01cf('0x23')]+_0x14760c[_0x01cf('0x24')]+_0x14760c[_0x01cf('0x25')]+_0x14760c[_0x01cf('0x26')]+_0x14760c[_0x01cf('0x27')]+_0x14760c[_0x01cf('0x28')]+_0x14760c[_0x01cf('0x29')]<_0x18095e[_0x01cf('0x2a')][_0x01cf('0x2b')])_0x29dbfc=0x1;_0x56d8f5({'additional':_0x29dbfc});}else{return db[_0x01cf('0x2c')][_0x01cf('0x2d')]({'raw':!![],'where':{'CmHopperId':_0xea3044['id']},'order':[[_0x01cf('0x20'),_0x01cf('0x21')]]})['then'](function(_0x486105){var _0x2f63db=0x0;if(_0x486105){if(_0x486105['countbusyretry']+_0x486105[_0x01cf('0x23')]+_0x486105[_0x01cf('0x24')]+_0x486105[_0x01cf('0x25')]+_0x486105[_0x01cf('0x26')]+_0x486105[_0x01cf('0x27')]+_0x486105['countmachineretry']+_0x486105[_0x01cf('0x29')]<_0x18095e[_0x01cf('0x2a')][_0x01cf('0x2b')])_0x2f63db=0x1;_0x56d8f5({'additional':_0x2f63db});}else{_0x56d8f5({'additional':0x0});}})[_0x01cf('0x18')](function(_0x1f8a7e){logger[_0x01cf('0x15')](_0x01cf('0x19'),_0x1f8a7e[_0x01cf('0x16')]);_0x258bfc(_0x56655f['error'](0x1f4,_0x1f8a7e[_0x01cf('0x16')]));});}})[_0x01cf('0x18')](function(_0x4aa682){logger[_0x01cf('0x15')](_0x01cf('0x19'),_0x4aa682[_0x01cf('0x16')]);_0x258bfc(_0x56655f[_0x01cf('0x15')](0x1f4,_0x4aa682[_0x01cf('0x16')]));});}else _0x56d8f5({'additional':0x0});});});};exports[_0x01cf('0x2e')]=function(_0x3b7283){var _0x3373fd=this;return new Promise(function(_0x589ca8,_0x189186){return db[_0x01cf('0x1a')][_0x01cf('0x2d')]({'raw':!![],'where':{'ContactId':_0x3b7283['body'][_0x01cf('0x1c')],'ListId':_0x3b7283[_0x01cf('0x1b')][_0x01cf('0x1d')],'VoiceQueueId':_0x3b7283[_0x01cf('0x1b')]['VoiceQueueId']===undefined?null:_0x3b7283[_0x01cf('0x1b')][_0x01cf('0x1e')],'CampaignId':_0x3b7283['body'][_0x01cf('0x1f')]===undefined?null:_0x3b7283['body'][_0x01cf('0x1f')]}})[_0x01cf('0xe')](function(_0x32fa61){if(_0x32fa61!=null){return db[_0x01cf('0x2c')][_0x01cf('0x2d')]({'raw':!![],'where':{'CmHopperId':_0x32fa61['id'],'OrderBy':{'$gte':_0x32fa61['OrderBy']}},'order':[[_0x01cf('0x20'),'ASC']]})[_0x01cf('0xe')](function(_0x5f230e){if(_0x5f230e)return activateAdditionalPhone(_0x32fa61,_0x3b7283['body'],_0x5f230e,_0x3b7283[_0x01cf('0x2f')],_0x3b7283[_0x01cf('0x30')])['then'](function(_0x463f88){_0x589ca8(_0x463f88);});else{return db[_0x01cf('0x2c')][_0x01cf('0x2d')]({'raw':!![],'where':{'CmHopperId':_0x32fa61['id']},'order':[['OrderBy',_0x01cf('0x21')]]})['then'](function(_0xa0487c){if(_0xa0487c)return activateAdditionalPhone(_0x32fa61,_0x3b7283[_0x01cf('0x1b')],_0xa0487c,_0x3b7283[_0x01cf('0x2f')],_0x3b7283[_0x01cf('0x30')])[_0x01cf('0xe')](function(_0x435d01){_0x589ca8(_0x435d01);});else{_0x589ca8({'id':_0x32fa61['id'],'phone':''});}})['catch'](function(_0x2ca6b0){logger[_0x01cf('0x15')](_0x01cf('0x19'),_0x2ca6b0[_0x01cf('0x16')]);_0x189186(_0x3373fd[_0x01cf('0x15')](0x1f4,_0x2ca6b0[_0x01cf('0x16')]));});}})[_0x01cf('0x18')](function(_0x3747fe){logger['error'](_0x01cf('0x19'),_0x3747fe[_0x01cf('0x16')]);_0x189186(_0x3373fd[_0x01cf('0x15')](0x1f4,_0x3747fe[_0x01cf('0x16')]));});}else _0x589ca8(0x1);});});};function activateAdditionalPhone(_0x2c8ed1,_0x465a58,_0x5cdb5d,_0x2dab32,_0x5d6b5f){return new Promise(function(_0x233a61,_0x12eab7){var _0x407cbf;if(_[_0x01cf('0x31')](_0x5cdb5d[_0x01cf('0x32')])){_0x5cdb5d['scheduledat']=moment();}if(moment()>moment(_0x5cdb5d[_0x01cf('0x32')])){_0x407cbf=moment()[_0x01cf('0x33')](_0x5d6b5f||0x3,_0x01cf('0x34'));}else{if(_0x5cdb5d[_0x01cf('0x20')]==0x0){_0x407cbf=moment(_0x5cdb5d[_0x01cf('0x32')]);}else{_0x407cbf=moment()[_0x01cf('0x33')](_0x5d6b5f||0x3,_0x01cf('0x34'));}}if(_[_0x01cf('0x31')](_0x407cbf)){_0x407cbf=moment()[_0x01cf('0x33')](_0x5d6b5f||0x3,_0x01cf('0x34'));}var _0xa3079e={'phone':_0x2c8ed1[_0x01cf('0x35')],'active':0x0,'OrderBy':_['isNil'](_0x2c8ed1[_0x01cf('0x20')])?0x0:_0x2c8ed1[_0x01cf('0x20')],'scheduledat':moment()[_0x01cf('0x33')](_0x2dab32||0x1,_0x01cf('0x34')),'countbusyretry':_0x465a58[_0x01cf('0x22')],'countcongestionretry':_0x465a58[_0x01cf('0x23')],'countnoanswerretry':_0x465a58[_0x01cf('0x24')],'countnosuchnumberretry':_0x465a58[_0x01cf('0x25')],'countdropretry':_0x465a58[_0x01cf('0x26')],'countabandonedretry':_0x465a58[_0x01cf('0x27')],'countmachineretry':_0x465a58[_0x01cf('0x28')],'countagentrejectretry':_0x465a58[_0x01cf('0x29')],'createdAt':_0x465a58[_0x01cf('0x36')],'updatedAt':_0x465a58[_0x01cf('0x37')]};var _0x47058c={'CmHopperId':_0x2c8ed1['id'],'phone':_0x5cdb5d[_0x01cf('0x35')],'active':0x0,'OrderBy':_[_0x01cf('0x31')](_0x5cdb5d[_0x01cf('0x20')])?0x0:_0x5cdb5d['OrderBy'],'scheduledat':_0x407cbf,'countbusyretry':_0x5cdb5d['countbusyretry'],'countcongestionretry':_0x5cdb5d[_0x01cf('0x23')],'countnoanswerretry':_0x5cdb5d['countnoanswerretry'],'countnosuchnumberretry':_0x5cdb5d[_0x01cf('0x25')],'countdropretry':_0x5cdb5d[_0x01cf('0x26')],'countabandonedretry':_0x5cdb5d['countabandonedretry'],'countmachineretry':_0x5cdb5d[_0x01cf('0x28')],'countagentrejectretry':_0x5cdb5d[_0x01cf('0x29')],'createdAt':_0x5cdb5d[_0x01cf('0x36')],'updatedAt':_0x5cdb5d['updatedAt']};return db[_0x01cf('0x38')]['transaction'](function(_0xe8db03){return db[_0x01cf('0x2c')][_0x01cf('0x39')](_0xa3079e,{'where':{'id':_0x5cdb5d['id']}},{'transaction':_0xe8db03})['then'](function(){return db[_0x01cf('0x1a')][_0x01cf('0x39')](_0x47058c,{'where':{'id':_0x2c8ed1['id']}},{'transaction':_0xe8db03});});})[_0x01cf('0xe')](function(_0x2dea23){_0x233a61({'id':_0x2c8ed1['id'],'phone':_0x5cdb5d[_0x01cf('0x35')]});})[_0x01cf('0x18')](function(_0x291e91){logger[_0x01cf('0x15')]('activateAdditionalPhone',_0x291e91[_0x01cf('0x16')]);_0x12eab7({'error':_0x291e91[_0x01cf('0x16')]});});});}exports[_0x01cf('0x3a')]=function(_0x4edc89){var _0x1695a2=this;return new Promise(function(_0x4b5b3d,_0x4df767){return db['CmHopper'][_0x01cf('0x39')](_0x4edc89[_0x01cf('0x1b')][_0x01cf('0x3b')],{'where':{'id':_0x4edc89['body']['id']}})['then'](function(_0x58e28b){_0x4b5b3d(_0x58e28b);})[_0x01cf('0x18')](function(_0x4ad666){logger[_0x01cf('0x15')](_0x01cf('0x3a'),_0x4ad666['message']);_0x4df767(_0x1695a2['error'](0x1f4,_0x4ad666[_0x01cf('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 335a4a1..23556c3 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 _0x10dc=['post','create','delete','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated'];(function(_0x1bb6da,_0x109949){var _0xebfd99=function(_0x954e8c){while(--_0x954e8c){_0x1bb6da['push'](_0x1bb6da['shift']());}};_0xebfd99(++_0x109949);}(_0x10dc,0x13f));var _0xc10d=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0x10dc[_0x1cb0b4];return _0x525b60;};'use strict';var multer=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var path=require(_0xc10d('0x2'));var timeout=require(_0xc10d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc10d('0x4'));var config=require(_0xc10d('0x5'));var controller=require(_0xc10d('0x6'));router[_0xc10d('0x7')]('/',auth['isAuthenticated'](),controller[_0xc10d('0x8')]);router[_0xc10d('0x7')](_0xc10d('0x9'),auth[_0xc10d('0xa')](),controller['show']);router[_0xc10d('0xb')]('/',auth['isAuthenticated'](),controller[_0xc10d('0xc')]);router['put']('/:id',auth[_0xc10d('0xa')](),controller['update']);router[_0xc10d('0xd')](_0xc10d('0x9'),auth[_0xc10d('0xa')](),controller['destroy']);module[_0xc10d('0xe')]=router; \ No newline at end of file +var _0xfbd5=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x11807a,_0xb04cc2){var _0x347921=function(_0x12389a){while(--_0x12389a){_0x11807a['push'](_0x11807a['shift']());}};_0x347921(++_0xb04cc2);}(_0xfbd5,0x7e));var _0x5fbd=function(_0x1281dd,_0x34277c){_0x1281dd=_0x1281dd-0x0;var _0x30a8d3=_0xfbd5[_0x1281dd];return _0x30a8d3;};'use strict';var multer=require('multer');var util=require(_0x5fbd('0x0'));var path=require('path');var timeout=require(_0x5fbd('0x1'));var express=require('express');var router=express[_0x5fbd('0x2')]();var fs_extra=require(_0x5fbd('0x3'));var auth=require(_0x5fbd('0x4'));var interaction=require(_0x5fbd('0x5'));var config=require(_0x5fbd('0x6'));var controller=require(_0x5fbd('0x7'));router[_0x5fbd('0x8')]('/',auth[_0x5fbd('0x9')](),controller['index']);router[_0x5fbd('0x8')](_0x5fbd('0xa'),auth['isAuthenticated'](),controller[_0x5fbd('0xb')]);router[_0x5fbd('0xc')]('/',auth[_0x5fbd('0x9')](),controller[_0x5fbd('0xd')]);router[_0x5fbd('0xe')](_0x5fbd('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5fbd('0xf')](_0x5fbd('0xa'),auth[_0x5fbd('0x9')](),controller[_0x5fbd('0x10')]);module[_0x5fbd('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 02490ae..d3080b5 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 _0x9483=['INTEGER','contactListQueue','moment','sequelize','STRING'];(function(_0x4581c3,_0x5bdaaf){var _0x35a854=function(_0x4e14fa){while(--_0x4e14fa){_0x4581c3['push'](_0x4581c3['shift']());}};_0x35a854(++_0x5bdaaf);}(_0x9483,0x12e));var _0x3948=function(_0x7ce723,_0x5f08a8){_0x7ce723=_0x7ce723-0x0;var _0xd9c5c=_0x9483[_0x7ce723];return _0xd9c5c;};'use strict';var moment=require(_0x3948('0x0'));var Sequelize=require(_0x3948('0x1'));module['exports']={'phone':{'type':Sequelize[_0x3948('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3948('0x3')],'unique':_0x3948('0x4')},'ListId':{'type':Sequelize[_0x3948('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x3948('0x3')],'unique':_0x3948('0x4')}}; \ No newline at end of file +var _0x3916=['contactListQueue','INTEGER','moment','exports','STRING'];(function(_0xcd7e9b,_0xe99af){var _0xa9196a=function(_0x56238d){while(--_0x56238d){_0xcd7e9b['push'](_0xcd7e9b['shift']());}};_0xa9196a(++_0xe99af);}(_0x3916,0x18d));var _0x6391=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x3916[_0x4bed75];return _0x2dd8e8;};'use strict';var moment=require(_0x6391('0x0'));var Sequelize=require('sequelize');module[_0x6391('0x1')]={'phone':{'type':Sequelize[_0x6391('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x6391('0x3')},'ListId':{'type':Sequelize[_0x6391('0x4')],'unique':_0x6391('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x6391('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index ef41329..6538b24 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 _0x2906=['intersection','fields','query','length','nolimit','order','sort','where','filter','merge','options','CmHopperBlack','include','rows','catch','params','includeAll','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','count','Content-Range','apply','update','then','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','filters','attributes'];(function(_0x307724,_0x2e185d){var _0x5d3431=function(_0x3ad2a6){while(--_0x3ad2a6){_0x307724['push'](_0x307724['shift']());}};_0x5d3431(++_0x2e185d);}(_0x2906,0xe0));var _0x6290=function(_0xcbb8db,_0x1f0a12){_0xcbb8db=_0xcbb8db-0x0;var _0x2fdcac=_0x2906[_0xcbb8db];return _0x2fdcac;};'use strict';var emlformat=require(_0x6290('0x0'));var rimraf=require(_0x6290('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6290('0x2'));var rp=require('request-promise');var moment=require(_0x6290('0x3'));var BPromise=require(_0x6290('0x4'));var Mustache=require(_0x6290('0x5'));var util=require(_0x6290('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6290('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6290('0x8'));var squel=require('squel');var crypto=require(_0x6290('0x9'));var jsforce=require(_0x6290('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6290('0xb'));var querystring=require(_0x6290('0xc'));var Papa=require(_0x6290('0xd'));var Redis=require(_0x6290('0xe'));var authService=require(_0x6290('0xf'));var qs=require(_0x6290('0x10'));var as=require(_0x6290('0x11'));var hardwareService=require(_0x6290('0x12'));var logger=require(_0x6290('0x13'))(_0x6290('0x14'));var utils=require(_0x6290('0x15'));var config=require(_0x6290('0x16'));var licenseUtil=require(_0x6290('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa58ce7,_0x4f0301){_0x4f0301=_0x4f0301||0xcc;return function(_0x31420d){if(_0x31420d){return _0xa58ce7['sendStatus'](_0x4f0301);}return _0xa58ce7[_0x6290('0x18')](_0x4f0301)[_0x6290('0x19')]();};}function respondWithResult(_0x1560f1,_0x4614c0){_0x4614c0=_0x4614c0||0xc8;return function(_0x151db9){if(_0x151db9){return _0x1560f1['status'](_0x4614c0)[_0x6290('0x1a')](_0x151db9);}};}function respondWithFilteredResult(_0x50d7b5,_0x226453){return function(_0x5ba781){if(_0x5ba781){var _0x204336=typeof _0x226453['offset']===_0x6290('0x1b')&&typeof _0x226453[_0x6290('0x1c')]===_0x6290('0x1b');var _0x3080e3=_0x5ba781['count'];var _0x43b43c=_0x204336?0x0:_0x226453[_0x6290('0x1d')];var _0x55f676=_0x204336?_0x5ba781[_0x6290('0x1e')]:_0x226453['offset']+_0x226453[_0x6290('0x1c')];var _0x45b322;if(_0x55f676>=_0x3080e3){_0x55f676=_0x3080e3;_0x45b322=0xc8;}else{_0x45b322=0xce;}_0x50d7b5[_0x6290('0x18')](_0x45b322);return _0x50d7b5['set'](_0x6290('0x1f'),_0x43b43c+'-'+_0x55f676+'/'+_0x3080e3)[_0x6290('0x1a')](_0x5ba781);}return null;};}function patchUpdates(_0x54100b){return function(_0x14ac6b){try{jsonpatch[_0x6290('0x20')](_0x14ac6b,_0x54100b,!![]);}catch(_0x2579a3){return BPromise['reject'](_0x2579a3);}return _0x14ac6b['save']();};}function saveUpdates(_0x2ccf34,_0x161526){return function(_0x4f9424){if(_0x4f9424){return _0x4f9424[_0x6290('0x21')](_0x2ccf34)[_0x6290('0x22')](function(_0x218861){return _0x218861;});}return null;};}function removeEntity(_0x2f4b9b,_0x30274c){return function(_0x20f26a){if(_0x20f26a){return _0x20f26a['destroy']()['then'](function(){_0x2f4b9b['status'](0xcc)[_0x6290('0x19')]();});}};}function handleEntityNotFound(_0x321ac4,_0x2fecc4){return function(_0x5eaa99){if(!_0x5eaa99){_0x321ac4['sendStatus'](0x194);}return _0x5eaa99;};}function handleError(_0x4c058b,_0x198e1f){_0x198e1f=_0x198e1f||0x1f4;return function(_0x1be6ad){logger[_0x6290('0x23')](_0x1be6ad[_0x6290('0x24')]);if(_0x1be6ad['name']){delete _0x1be6ad[_0x6290('0x25')];}_0x4c058b[_0x6290('0x18')](_0x198e1f)[_0x6290('0x26')](_0x1be6ad);};}exports[_0x6290('0x27')]=function(_0x5452f7,_0x3f1570){var _0x26bdf0={},_0x142b05={},_0x130d86={'count':0x0,'rows':[]};var _0x316f6a=_[_0x6290('0x28')](db['CmHopperBlack'][_0x6290('0x29')],function(_0x57e38b){return{'name':_0x57e38b['fieldName'],'type':_0x57e38b[_0x6290('0x2a')][_0x6290('0x2b')]};});_0x142b05[_0x6290('0x2c')]=_['map'](_0x316f6a,'name');_0x142b05['query']=_[_0x6290('0x2d')](_0x5452f7['query']);_0x142b05[_0x6290('0x2e')]=_['intersection'](_0x142b05[_0x6290('0x2c')],_0x142b05['query']);_0x26bdf0[_0x6290('0x2f')]=_[_0x6290('0x30')](_0x142b05['model'],qs[_0x6290('0x31')](_0x5452f7[_0x6290('0x32')][_0x6290('0x31')]));_0x26bdf0[_0x6290('0x2f')]=_0x26bdf0[_0x6290('0x2f')][_0x6290('0x33')]?_0x26bdf0[_0x6290('0x2f')]:_0x142b05[_0x6290('0x2c')];if(!_0x5452f7[_0x6290('0x32')]['hasOwnProperty'](_0x6290('0x34'))){_0x26bdf0[_0x6290('0x1c')]=qs['limit'](_0x5452f7[_0x6290('0x32')][_0x6290('0x1c')]);_0x26bdf0[_0x6290('0x1d')]=qs['offset'](_0x5452f7['query'][_0x6290('0x1d')]);}_0x26bdf0[_0x6290('0x35')]=qs['sort'](_0x5452f7[_0x6290('0x32')][_0x6290('0x36')]);_0x26bdf0[_0x6290('0x37')]=qs[_0x6290('0x2e')](_['pick'](_0x5452f7[_0x6290('0x32')],_0x142b05[_0x6290('0x2e')]),_0x316f6a);if(_0x5452f7[_0x6290('0x32')][_0x6290('0x38')]){_0x26bdf0[_0x6290('0x37')]=_[_0x6290('0x39')](_0x26bdf0[_0x6290('0x37')],{'$or':_['map'](_0x316f6a,function(_0x119e4b){if(_0x119e4b['type']!=='VIRTUAL'){var _0x3649a5={};_0x3649a5[_0x119e4b[_0x6290('0x25')]]={'$like':'%'+_0x5452f7[_0x6290('0x32')][_0x6290('0x38')]+'%'};return _0x3649a5;}})});}_0x26bdf0=_['merge']({},_0x26bdf0,_0x5452f7[_0x6290('0x3a')]);var _0x4080d4={'where':_0x26bdf0[_0x6290('0x37')]};return db[_0x6290('0x3b')][_0x6290('0x1e')](_0x4080d4)[_0x6290('0x22')](function(_0x4fdcfc){_0x130d86[_0x6290('0x1e')]=_0x4fdcfc;if(_0x5452f7[_0x6290('0x32')]['includeAll']){_0x26bdf0[_0x6290('0x3c')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x26bdf0);})[_0x6290('0x22')](function(_0x37a2f9){_0x130d86[_0x6290('0x3d')]=_0x37a2f9;return _0x130d86;})[_0x6290('0x22')](respondWithFilteredResult(_0x3f1570,_0x26bdf0))[_0x6290('0x3e')](handleError(_0x3f1570,null));};exports['show']=function(_0x5cbb6f,_0x278c5a){var _0xfaa27e={'raw':!![],'where':{'id':_0x5cbb6f[_0x6290('0x3f')]['id']}},_0x464347={};_0x464347[_0x6290('0x2c')]=_[_0x6290('0x2d')](db[_0x6290('0x3b')]['rawAttributes']);_0x464347[_0x6290('0x32')]=_[_0x6290('0x2d')](_0x5cbb6f[_0x6290('0x32')]);_0x464347[_0x6290('0x2e')]=_[_0x6290('0x30')](_0x464347[_0x6290('0x2c')],_0x464347[_0x6290('0x32')]);_0xfaa27e[_0x6290('0x2f')]=_[_0x6290('0x30')](_0x464347[_0x6290('0x2c')],qs['fields'](_0x5cbb6f[_0x6290('0x32')][_0x6290('0x31')]));_0xfaa27e[_0x6290('0x2f')]=_0xfaa27e['attributes'][_0x6290('0x33')]?_0xfaa27e['attributes']:_0x464347['model'];if(_0x5cbb6f[_0x6290('0x32')][_0x6290('0x40')]){_0xfaa27e['include']=[{'all':!![]}];}_0xfaa27e=_[_0x6290('0x39')]({},_0xfaa27e,_0x5cbb6f['options']);return db[_0x6290('0x3b')]['find'](_0xfaa27e)[_0x6290('0x22')](handleEntityNotFound(_0x278c5a,null))['then'](respondWithResult(_0x278c5a,null))[_0x6290('0x3e')](handleError(_0x278c5a,null));};exports[_0x6290('0x21')]=function(_0x19ce84,_0x3d3ded){if(_0x19ce84[_0x6290('0x41')]['id']){delete _0x19ce84[_0x6290('0x41')]['id'];}return db['CmHopperBlack'][_0x6290('0x42')]({'where':{'id':_0x19ce84[_0x6290('0x3f')]['id']}})[_0x6290('0x22')](handleEntityNotFound(_0x3d3ded,null))['then'](saveUpdates(_0x19ce84[_0x6290('0x41')],null))[_0x6290('0x22')](respondWithResult(_0x3d3ded,null))[_0x6290('0x3e')](handleError(_0x3d3ded,null));};exports['destroy']=function(_0x553137,_0x369edc){return db[_0x6290('0x3b')]['find']({'where':{'id':_0x553137['params']['id']}})[_0x6290('0x22')](handleEntityNotFound(_0x369edc,null))[_0x6290('0x22')](removeEntity(_0x369edc,null))[_0x6290('0x3e')](handleError(_0x369edc,null));};exports[_0x6290('0x43')]=function(_0x3998d9,_0x157717){return db['CmHopperBlack'][_0x6290('0x43')]()[_0x6290('0x22')](respondWithResult(_0x157717,null))[_0x6290('0x3e')](handleError(_0x157717,null));}; \ No newline at end of file +var _0x5580=['index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','catch','body','find','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','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','save','update','then','error','stack','name','send'];(function(_0x32504a,_0x475539){var _0x536848=function(_0x5d3040){while(--_0x5d3040){_0x32504a['push'](_0x32504a['shift']());}};_0x536848(++_0x475539);}(_0x5580,0xbd));var _0x0558=function(_0x2439b8,_0x53c970){_0x2439b8=_0x2439b8-0x0;var _0x12c79e=_0x5580[_0x2439b8];return _0x12c79e;};'use strict';var emlformat=require(_0x0558('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0558('0x1'));var jsonpatch=require(_0x0558('0x2'));var rp=require(_0x0558('0x3'));var moment=require(_0x0558('0x4'));var BPromise=require(_0x0558('0x5'));var Mustache=require(_0x0558('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0558('0x7'));var csv=require(_0x0558('0x8'));var ejs=require(_0x0558('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0558('0xa'));var squel=require('squel');var crypto=require(_0x0558('0xb'));var jsforce=require(_0x0558('0xc'));var deskjs=require(_0x0558('0xd'));var toCsv=require(_0x0558('0x8'));var querystring=require('querystring');var Papa=require(_0x0558('0xe'));var Redis=require(_0x0558('0xf'));var authService=require(_0x0558('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0558('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0558('0x12'))(_0x0558('0x13'));var utils=require(_0x0558('0x14'));var config=require(_0x0558('0x15'));var licenseUtil=require(_0x0558('0x16'));var db=require(_0x0558('0x17'))['db'];function respondWithStatusCode(_0x32aa51,_0x270ca9){_0x270ca9=_0x270ca9||0xcc;return function(_0x5cbaa3){if(_0x5cbaa3){return _0x32aa51[_0x0558('0x18')](_0x270ca9);}return _0x32aa51[_0x0558('0x19')](_0x270ca9)[_0x0558('0x1a')]();};}function respondWithResult(_0x629ccd,_0x2325f2){_0x2325f2=_0x2325f2||0xc8;return function(_0x3caba6){if(_0x3caba6){return _0x629ccd[_0x0558('0x19')](_0x2325f2)[_0x0558('0x1b')](_0x3caba6);}};}function respondWithFilteredResult(_0x547ec4,_0x4ef5a7){return function(_0x522d03){if(_0x522d03){var _0x277115=typeof _0x4ef5a7[_0x0558('0x1c')]===_0x0558('0x1d')&&typeof _0x4ef5a7[_0x0558('0x1e')]===_0x0558('0x1d');var _0x3f5e73=_0x522d03[_0x0558('0x1f')];var _0x3f8b67=_0x277115?0x0:_0x4ef5a7[_0x0558('0x1c')];var _0x233d4b=_0x277115?_0x522d03[_0x0558('0x1f')]:_0x4ef5a7[_0x0558('0x1c')]+_0x4ef5a7['limit'];var _0x5482d8;if(_0x233d4b>=_0x3f5e73){_0x233d4b=_0x3f5e73;_0x5482d8=0xc8;}else{_0x5482d8=0xce;}_0x547ec4['status'](_0x5482d8);return _0x547ec4[_0x0558('0x20')](_0x0558('0x21'),_0x3f8b67+'-'+_0x233d4b+'/'+_0x3f5e73)[_0x0558('0x1b')](_0x522d03);}return null;};}function patchUpdates(_0x39e554){return function(_0x2f200d){try{jsonpatch[_0x0558('0x22')](_0x2f200d,_0x39e554,!![]);}catch(_0x347bb8){return BPromise['reject'](_0x347bb8);}return _0x2f200d[_0x0558('0x23')]();};}function saveUpdates(_0x19ff11,_0x492485){return function(_0x3d7ab9){if(_0x3d7ab9){return _0x3d7ab9[_0x0558('0x24')](_0x19ff11)['then'](function(_0x3e01d1){return _0x3e01d1;});}return null;};}function removeEntity(_0x1fd224,_0x4837bc){return function(_0x318c5e){if(_0x318c5e){return _0x318c5e['destroy']()[_0x0558('0x25')](function(){_0x1fd224['status'](0xcc)[_0x0558('0x1a')]();});}};}function handleEntityNotFound(_0xd84865,_0x3d8d56){return function(_0x5a0e73){if(!_0x5a0e73){_0xd84865[_0x0558('0x18')](0x194);}return _0x5a0e73;};}function handleError(_0x573f07,_0x2185a5){_0x2185a5=_0x2185a5||0x1f4;return function(_0x371d46){logger[_0x0558('0x26')](_0x371d46[_0x0558('0x27')]);if(_0x371d46[_0x0558('0x28')]){delete _0x371d46[_0x0558('0x28')];}_0x573f07['status'](_0x2185a5)[_0x0558('0x29')](_0x371d46);};}exports[_0x0558('0x2a')]=function(_0x2c96b2,_0x1a45d0){var _0x397abe={},_0x3da81a={},_0x29b014={'count':0x0,'rows':[]};var _0x27d277=_[_0x0558('0x2b')](db[_0x0558('0x2c')]['rawAttributes'],function(_0x4e057f){return{'name':_0x4e057f[_0x0558('0x2d')],'type':_0x4e057f[_0x0558('0x2e')][_0x0558('0x2f')]};});_0x3da81a[_0x0558('0x30')]=_[_0x0558('0x2b')](_0x27d277,'name');_0x3da81a[_0x0558('0x31')]=_[_0x0558('0x32')](_0x2c96b2[_0x0558('0x31')]);_0x3da81a[_0x0558('0x33')]=_[_0x0558('0x34')](_0x3da81a[_0x0558('0x30')],_0x3da81a[_0x0558('0x31')]);_0x397abe[_0x0558('0x35')]=_[_0x0558('0x34')](_0x3da81a['model'],qs[_0x0558('0x36')](_0x2c96b2[_0x0558('0x31')][_0x0558('0x36')]));_0x397abe[_0x0558('0x35')]=_0x397abe[_0x0558('0x35')][_0x0558('0x37')]?_0x397abe[_0x0558('0x35')]:_0x3da81a[_0x0558('0x30')];if(!_0x2c96b2[_0x0558('0x31')][_0x0558('0x38')](_0x0558('0x39'))){_0x397abe[_0x0558('0x1e')]=qs[_0x0558('0x1e')](_0x2c96b2[_0x0558('0x31')][_0x0558('0x1e')]);_0x397abe[_0x0558('0x1c')]=qs[_0x0558('0x1c')](_0x2c96b2[_0x0558('0x31')][_0x0558('0x1c')]);}_0x397abe[_0x0558('0x3a')]=qs['sort'](_0x2c96b2[_0x0558('0x31')][_0x0558('0x3b')]);_0x397abe[_0x0558('0x3c')]=qs[_0x0558('0x33')](_[_0x0558('0x3d')](_0x2c96b2[_0x0558('0x31')],_0x3da81a[_0x0558('0x33')]),_0x27d277);if(_0x2c96b2[_0x0558('0x31')][_0x0558('0x3e')]){_0x397abe['where']=_[_0x0558('0x3f')](_0x397abe[_0x0558('0x3c')],{'$or':_[_0x0558('0x2b')](_0x27d277,function(_0x1d9f0f){if(_0x1d9f0f[_0x0558('0x2e')]!==_0x0558('0x40')){var _0x76dd8={};_0x76dd8[_0x1d9f0f[_0x0558('0x28')]]={'$like':'%'+_0x2c96b2['query'][_0x0558('0x3e')]+'%'};return _0x76dd8;}})});}_0x397abe=_[_0x0558('0x3f')]({},_0x397abe,_0x2c96b2[_0x0558('0x41')]);var _0x944619={'where':_0x397abe[_0x0558('0x3c')]};return db[_0x0558('0x2c')][_0x0558('0x1f')](_0x944619)['then'](function(_0x305d1f){_0x29b014[_0x0558('0x1f')]=_0x305d1f;if(_0x2c96b2[_0x0558('0x31')][_0x0558('0x42')]){_0x397abe['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x0558('0x43')](_0x397abe);})[_0x0558('0x25')](function(_0x4c491d){_0x29b014[_0x0558('0x44')]=_0x4c491d;return _0x29b014;})[_0x0558('0x25')](respondWithFilteredResult(_0x1a45d0,_0x397abe))['catch'](handleError(_0x1a45d0,null));};exports[_0x0558('0x45')]=function(_0xc16629,_0x4d9a97){var _0x22b887={'raw':!![],'where':{'id':_0xc16629['params']['id']}},_0xe308bd={};_0xe308bd[_0x0558('0x30')]=_[_0x0558('0x32')](db[_0x0558('0x2c')]['rawAttributes']);_0xe308bd['query']=_[_0x0558('0x32')](_0xc16629['query']);_0xe308bd['filters']=_[_0x0558('0x34')](_0xe308bd['model'],_0xe308bd[_0x0558('0x31')]);_0x22b887[_0x0558('0x35')]=_['intersection'](_0xe308bd[_0x0558('0x30')],qs[_0x0558('0x36')](_0xc16629[_0x0558('0x31')][_0x0558('0x36')]));_0x22b887[_0x0558('0x35')]=_0x22b887['attributes'][_0x0558('0x37')]?_0x22b887['attributes']:_0xe308bd[_0x0558('0x30')];if(_0xc16629[_0x0558('0x31')]['includeAll']){_0x22b887[_0x0558('0x46')]=[{'all':!![]}];}_0x22b887=_[_0x0558('0x3f')]({},_0x22b887,_0xc16629[_0x0558('0x41')]);return db[_0x0558('0x2c')]['find'](_0x22b887)[_0x0558('0x25')](handleEntityNotFound(_0x4d9a97,null))[_0x0558('0x25')](respondWithResult(_0x4d9a97,null))[_0x0558('0x47')](handleError(_0x4d9a97,null));};exports['update']=function(_0x29e9cb,_0xa48e45){if(_0x29e9cb['body']['id']){delete _0x29e9cb[_0x0558('0x48')]['id'];}return db[_0x0558('0x2c')][_0x0558('0x49')]({'where':{'id':_0x29e9cb[_0x0558('0x4a')]['id']}})[_0x0558('0x25')](handleEntityNotFound(_0xa48e45,null))[_0x0558('0x25')](saveUpdates(_0x29e9cb['body'],null))[_0x0558('0x25')](respondWithResult(_0xa48e45,null))[_0x0558('0x47')](handleError(_0xa48e45,null));};exports[_0x0558('0x4b')]=function(_0x2fa11a,_0x51cf51){return db[_0x0558('0x2c')][_0x0558('0x49')]({'where':{'id':_0x2fa11a[_0x0558('0x4a')]['id']}})[_0x0558('0x25')](handleEntityNotFound(_0x51cf51,null))[_0x0558('0x25')](removeEntity(_0x51cf51,null))[_0x0558('0x47')](handleError(_0x51cf51,null));};exports[_0x0558('0x4c')]=function(_0x45c760,_0x153ba7){return db[_0x0558('0x2c')][_0x0558('0x4c')]()[_0x0558('0x25')](respondWithResult(_0x153ba7,null))[_0x0558('0x47')](handleError(_0x153ba7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e2d8657..f569dbf 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 _0xf435=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xf435,0xcc));var _0x5f43=function(_0x5d9362,_0x4112cb){_0x5d9362=_0x5d9362-0x0;var _0x505993=_0xf435[_0x5d9362];return _0x505993;};'use strict';var _=require(_0x5f43('0x0'));var util=require('util');var logger=require(_0x5f43('0x1'))(_0x5f43('0x2'));var moment=require(_0x5f43('0x3'));var BPromise=require(_0x5f43('0x4'));var rp=require(_0x5f43('0x5'));var fs=require('fs');var path=require(_0x5f43('0x6'));var rimraf=require(_0x5f43('0x7'));var config=require(_0x5f43('0x8'));var attributes=require(_0x5f43('0x9'));module['exports']=function(_0x31d5f6,_0x2e57a6){return _0x31d5f6[_0x5f43('0xa')](_0x5f43('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf685=['CmHopperBlack','cm_hopper_black','api','request-promise','rimraf','../../config/environment','define'];(function(_0x27b76d,_0x5a9a00){var _0x5e98a9=function(_0x3e8963){while(--_0x3e8963){_0x27b76d['push'](_0x27b76d['shift']());}};_0x5e98a9(++_0x5a9a00);}(_0xf685,0x175));var _0x5f68=function(_0x3da50d,_0xd88a77){_0x3da50d=_0x3da50d-0x0;var _0x932729=_0xf685[_0x3da50d];return _0x932729;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5f68('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5f68('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f68('0x2'));var config=require(_0x5f68('0x3'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x30cd86,_0x31c4e5){return _0x30cd86[_0x5f68('0x4')](_0x5f68('0x5'),attributes,{'tableName':_0x5f68('0x6'),'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 b4e942c..2ed9e85 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 _0xeaed=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map','model','update','body','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1c1cb0,_0xc347a0){var _0x55384f=function(_0x49def4){while(--_0x49def4){_0x1c1cb0['push'](_0x1c1cb0['shift']());}};_0x55384f(++_0xc347a0);}(_0xeaed,0x64));var _0xdeae=function(_0xfd4594,_0x286a80){_0xfd4594=_0xfd4594-0x0;var _0xb361d1=_0xeaed[_0xfd4594];return _0xb361d1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdeae('0x0'));var BPromise=require(_0xdeae('0x1'));var rs=require(_0xdeae('0x2'));var fs=require('fs');var Redis=require(_0xdeae('0x3'));var db=require(_0xdeae('0x4'))['db'];var utils=require(_0xdeae('0x5'));var logger=require(_0xdeae('0x6'))(_0xdeae('0x7'));var config=require(_0xdeae('0x8'));var jayson=require(_0xdeae('0x9'));var client=jayson[_0xdeae('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ddbb3,_0xaf01cb,_0x525cbb){return new BPromise(function(_0x1e0d5b,_0x41a8e6){return client[_0xdeae('0xb')](_0x3ddbb3,_0x525cbb)[_0xdeae('0xc')](function(_0x30b969){logger[_0xdeae('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0xaf01cb,_0xdeae('0xe'));logger[_0xdeae('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xaf01cb,_0xdeae('0xe'),JSON[_0xdeae('0x10')](_0x30b969));if(_0x30b969[_0xdeae('0x11')]){if(_0x30b969[_0xdeae('0x11')]['code']===0x1f4){logger[_0xdeae('0x11')](_0xdeae('0x12'),_0xaf01cb,_0x30b969['error']['message']);return _0x41a8e6(_0x30b969[_0xdeae('0x11')][_0xdeae('0x13')]);}logger[_0xdeae('0x11')](_0xdeae('0x12'),_0xaf01cb,_0x30b969[_0xdeae('0x11')][_0xdeae('0x13')]);return _0x1e0d5b(_0x30b969[_0xdeae('0x11')][_0xdeae('0x13')]);}else{logger[_0xdeae('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0xaf01cb,_0xdeae('0xe'));_0x1e0d5b(_0x30b969['result'][_0xdeae('0x13')]);}})[_0xdeae('0x14')](function(_0x4b89e1){logger[_0xdeae('0x11')](_0xdeae('0x12'),_0xaf01cb,_0x4b89e1);_0x41a8e6(_0x4b89e1);});});}exports[_0xdeae('0x15')]=function(_0x33a63f){var _0x4d68f2=this;return new Promise(function(_0x527f5c,_0x368354){return db[_0xdeae('0x16')]['findAll']({'raw':_0x33a63f['options']?_0x33a63f[_0xdeae('0x17')][_0xdeae('0x18')]===undefined?!![]:![]:!![],'where':_0x33a63f[_0xdeae('0x17')]?_0x33a63f[_0xdeae('0x17')][_0xdeae('0x19')]||null:null,'attributes':_0x33a63f[_0xdeae('0x17')]?_0x33a63f['options'][_0xdeae('0x1a')]||null:null,'limit':_0x33a63f[_0xdeae('0x17')]?_0x33a63f[_0xdeae('0x17')][_0xdeae('0x1b')]||null:null,'include':_0x33a63f['options']?_0x33a63f['options'][_0xdeae('0x1c')]?_[_0xdeae('0x1d')](_0x33a63f[_0xdeae('0x17')]['include'],function(_0x525f1a){return{'model':db[_0x525f1a[_0xdeae('0x1e')]],'as':_0x525f1a['as'],'attributes':_0x525f1a[_0xdeae('0x1a')],'include':_0x525f1a['include']?_[_0xdeae('0x1d')](_0x525f1a[_0xdeae('0x1c')],function(_0x427a63){return{'model':db[_0x427a63[_0xdeae('0x1e')]],'as':_0x427a63['as'],'attributes':_0x427a63[_0xdeae('0x1a')],'include':_0x427a63[_0xdeae('0x1c')]?_['map'](_0x427a63['include'],function(_0x2d3a1a){return{'model':db[_0x2d3a1a[_0xdeae('0x1e')]],'as':_0x2d3a1a['as'],'attributes':_0x2d3a1a[_0xdeae('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdeae('0xc')](function(_0x18f0d5){logger[_0xdeae('0xd')](_0xdeae('0x15'),_0x33a63f);logger[_0xdeae('0xf')](_0xdeae('0x15'),_0x33a63f,JSON[_0xdeae('0x10')](_0x18f0d5));_0x527f5c(_0x18f0d5);})[_0xdeae('0x14')](function(_0xdc77f0){logger['error']('GetCmHopperBlack',_0xdc77f0[_0xdeae('0x13')],_0x33a63f);_0x368354(_0x4d68f2[_0xdeae('0x11')](0x1f4,_0xdc77f0[_0xdeae('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x357c2f){var _0xad0395=this;return new Promise(function(_0x32facd,_0x1b719e){return db['CmHopperBlack'][_0xdeae('0x1f')](_0x357c2f[_0xdeae('0x20')],{'raw':_0x357c2f[_0xdeae('0x17')]?_0x357c2f[_0xdeae('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x357c2f[_0xdeae('0x17')]?_0x357c2f['options'][_0xdeae('0x19')]||null:null,'attributes':_0x357c2f[_0xdeae('0x17')]?_0x357c2f[_0xdeae('0x17')][_0xdeae('0x1a')]||null:null,'limit':_0x357c2f[_0xdeae('0x17')]?_0x357c2f[_0xdeae('0x17')]['limit']||null:null})['then'](function(_0x3844e2){logger['info'](_0xdeae('0x21'),_0x357c2f);logger['debug']('UpdateCmHopperBlack',_0x357c2f,JSON[_0xdeae('0x10')](_0x3844e2));_0x32facd(_0x3844e2);})[_0xdeae('0x14')](function(_0x3b6a56){logger[_0xdeae('0x11')](_0xdeae('0x21'),_0x3b6a56[_0xdeae('0x13')],_0x357c2f);_0x1b719e(_0xad0395[_0xdeae('0x11')](0x1f4,_0x3b6a56[_0xdeae('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x3b48e0){var _0x1a4794=this;return new Promise(function(_0x3692bb,_0x14ea82){return db[_0xdeae('0x16')][_0xdeae('0x22')]({'where':_0x3b48e0[_0xdeae('0x17')]?_0x3b48e0[_0xdeae('0x17')]['where']||null:null})[_0xdeae('0xc')](function(_0xbdb75f){logger[_0xdeae('0xd')](_0xdeae('0x23'),_0x3b48e0);logger['debug'](_0xdeae('0x23'),_0x3b48e0,JSON['stringify'](_0xbdb75f));_0x3692bb(_0xbdb75f);})[_0xdeae('0x14')](function(_0x3ac15a){logger[_0xdeae('0x11')]('DestroyCmHopperBlack',_0x3ac15a['message'],_0x3b48e0);_0x14ea82(_0x1a4794[_0xdeae('0x11')](0x1f4,_0x3ac15a[_0xdeae('0x13')]));});});}; \ No newline at end of file +var _0x35ac=['catch','UpdateCmHopperBlack','update','raw','where','DestroyCmHopperBlack','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','limit','map','model','include','attributes'];(function(_0x581b56,_0xea0f7a){var _0x5647c6=function(_0x431705){while(--_0x431705){_0x581b56['push'](_0x581b56['shift']());}};_0x5647c6(++_0xea0f7a);}(_0x35ac,0x109));var _0xc35a=function(_0x10720e,_0x325703){_0x10720e=_0x10720e-0x0;var _0x447e7a=_0x35ac[_0x10720e];return _0x447e7a;};'use strict';var _=require(_0xc35a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc35a('0x1'));var rs=require(_0xc35a('0x2'));var fs=require('fs');var Redis=require(_0xc35a('0x3'));var db=require(_0xc35a('0x4'))['db'];var utils=require(_0xc35a('0x5'));var logger=require(_0xc35a('0x6'))(_0xc35a('0x7'));var config=require(_0xc35a('0x8'));var jayson=require(_0xc35a('0x9'));var client=jayson['client'][_0xc35a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ba87,_0x1a4b26,_0x35356a){return new BPromise(function(_0x5f5c66,_0x49cf7b){return client[_0xc35a('0xb')](_0x5ba87,_0x35356a)[_0xc35a('0xc')](function(_0x129e48){logger[_0xc35a('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x1a4b26,'request\x20sent');logger[_0xc35a('0xe')](_0xc35a('0xf'),_0x1a4b26,_0xc35a('0x10'),JSON[_0xc35a('0x11')](_0x129e48));if(_0x129e48[_0xc35a('0x12')]){if(_0x129e48[_0xc35a('0x12')]['code']===0x1f4){logger['error'](_0xc35a('0x13'),_0x1a4b26,_0x129e48[_0xc35a('0x12')][_0xc35a('0x14')]);return _0x49cf7b(_0x129e48[_0xc35a('0x12')][_0xc35a('0x14')]);}logger[_0xc35a('0x12')](_0xc35a('0x13'),_0x1a4b26,_0x129e48[_0xc35a('0x12')]['message']);return _0x5f5c66(_0x129e48[_0xc35a('0x12')][_0xc35a('0x14')]);}else{logger['info'](_0xc35a('0x13'),_0x1a4b26,_0xc35a('0x10'));_0x5f5c66(_0x129e48[_0xc35a('0x15')][_0xc35a('0x14')]);}})['catch'](function(_0x27ff55){logger[_0xc35a('0x12')](_0xc35a('0x13'),_0x1a4b26,_0x27ff55);_0x49cf7b(_0x27ff55);});});}exports[_0xc35a('0x16')]=function(_0x1d03f7){var _0x521f7c=this;return new Promise(function(_0x2da213,_0x4bd32d){return db[_0xc35a('0x17')][_0xc35a('0x18')]({'raw':_0x1d03f7['options']?_0x1d03f7[_0xc35a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1d03f7['options']?_0x1d03f7[_0xc35a('0x19')]['where']||null:null,'attributes':_0x1d03f7['options']?_0x1d03f7['options']['attributes']||null:null,'limit':_0x1d03f7[_0xc35a('0x19')]?_0x1d03f7[_0xc35a('0x19')][_0xc35a('0x1a')]||null:null,'include':_0x1d03f7[_0xc35a('0x19')]?_0x1d03f7[_0xc35a('0x19')]['include']?_[_0xc35a('0x1b')](_0x1d03f7['options']['include'],function(_0x9ee13f){return{'model':db[_0x9ee13f[_0xc35a('0x1c')]],'as':_0x9ee13f['as'],'attributes':_0x9ee13f['attributes'],'include':_0x9ee13f[_0xc35a('0x1d')]?_[_0xc35a('0x1b')](_0x9ee13f['include'],function(_0x19a780){return{'model':db[_0x19a780[_0xc35a('0x1c')]],'as':_0x19a780['as'],'attributes':_0x19a780[_0xc35a('0x1e')],'include':_0x19a780[_0xc35a('0x1d')]?_[_0xc35a('0x1b')](_0x19a780[_0xc35a('0x1d')],function(_0xea4c0e){return{'model':db[_0xea4c0e[_0xc35a('0x1c')]],'as':_0xea4c0e['as'],'attributes':_0xea4c0e[_0xc35a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc35a('0xc')](function(_0x26f513){logger[_0xc35a('0xd')](_0xc35a('0x16'),_0x1d03f7);logger[_0xc35a('0xe')](_0xc35a('0x16'),_0x1d03f7,JSON[_0xc35a('0x11')](_0x26f513));_0x2da213(_0x26f513);})[_0xc35a('0x1f')](function(_0x54d3aa){logger[_0xc35a('0x12')](_0xc35a('0x16'),_0x54d3aa[_0xc35a('0x14')],_0x1d03f7);_0x4bd32d(_0x521f7c[_0xc35a('0x12')](0x1f4,_0x54d3aa[_0xc35a('0x14')]));});});};exports[_0xc35a('0x20')]=function(_0x2eaae1){var _0xb1a27b=this;return new Promise(function(_0x46d313,_0x493173){return db['CmHopperBlack'][_0xc35a('0x21')](_0x2eaae1['body'],{'raw':_0x2eaae1['options']?_0x2eaae1[_0xc35a('0x19')][_0xc35a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eaae1['options']?_0x2eaae1[_0xc35a('0x19')][_0xc35a('0x23')]||null:null,'attributes':_0x2eaae1['options']?_0x2eaae1[_0xc35a('0x19')][_0xc35a('0x1e')]||null:null,'limit':_0x2eaae1[_0xc35a('0x19')]?_0x2eaae1['options']['limit']||null:null})[_0xc35a('0xc')](function(_0x29e51c){logger[_0xc35a('0xd')](_0xc35a('0x20'),_0x2eaae1);logger['debug'](_0xc35a('0x20'),_0x2eaae1,JSON['stringify'](_0x29e51c));_0x46d313(_0x29e51c);})['catch'](function(_0x5c0f18){logger[_0xc35a('0x12')](_0xc35a('0x20'),_0x5c0f18[_0xc35a('0x14')],_0x2eaae1);_0x493173(_0xb1a27b[_0xc35a('0x12')](0x1f4,_0x5c0f18[_0xc35a('0x14')]));});});};exports[_0xc35a('0x24')]=function(_0x50f912){var _0x508918=this;return new Promise(function(_0x229596,_0x328be3){return db[_0xc35a('0x17')]['destroy']({'where':_0x50f912['options']?_0x50f912[_0xc35a('0x19')][_0xc35a('0x23')]||null:null})[_0xc35a('0xc')](function(_0x149a25){logger[_0xc35a('0xd')](_0xc35a('0x24'),_0x50f912);logger[_0xc35a('0xe')](_0xc35a('0x24'),_0x50f912,JSON[_0xc35a('0x11')](_0x149a25));_0x229596(_0x149a25);})[_0xc35a('0x1f')](function(_0x303050){logger[_0xc35a('0x12')]('DestroyCmHopperBlack',_0x303050[_0xc35a('0x14')],_0x50f912);_0x328be3(_0x508918[_0xc35a('0x12')](0x1f4,_0x303050[_0xc35a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 8022200..d2dbb70 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 _0x7ee1=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','isAuthenticated','/:id','delete','destroy','multer','express'];(function(_0x230412,_0x5bbfff){var _0x2096ee=function(_0x2508b0){while(--_0x2508b0){_0x230412['push'](_0x230412['shift']());}};_0x2096ee(++_0x5bbfff);}(_0x7ee1,0x8d));var _0x17ee=function(_0x23bf29,_0x5e8600){_0x23bf29=_0x23bf29-0x0;var _0x41094b=_0x7ee1[_0x23bf29];return _0x41094b;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var fs_extra=require(_0x17ee('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var controller=require(_0x17ee('0x6'));router[_0x17ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x17ee('0x8')]);router[_0x17ee('0x7')]('/describe',auth[_0x17ee('0x9')](),controller['describe']);router[_0x17ee('0x7')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller['show']);router['put']('/:id',auth[_0x17ee('0x9')](),controller['update']);router[_0x17ee('0xb')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xc')]);module['exports']=router; \ No newline at end of file +var _0x33af=['isAuthenticated','describe','show','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','index','/describe'];(function(_0x4ee261,_0x314cde){var _0x4b6722=function(_0x465e29){while(--_0x465e29){_0x4ee261['push'](_0x4ee261['shift']());}};_0x4b6722(++_0x314cde);}(_0x33af,0xec));var _0xf33a=function(_0x2fad8a,_0x26de69){_0x2fad8a=_0x2fad8a-0x0;var _0x494d7d=_0x33af[_0x2fad8a];return _0x494d7d;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0xe')](_0xf33a('0xf'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router['delete']('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0x11')]);module[_0xf33a('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index e975277..8b1dbe4 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 _0x839f=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x39cd5c,_0x29f33e){var _0x971df4=function(_0x56aa8e){while(--_0x56aa8e){_0x39cd5c['push'](_0x39cd5c['shift']());}};_0x971df4(++_0x29f33e);}(_0x839f,0x12a));var _0xf839=function(_0x4e67ce,_0x32c8c7){_0x4e67ce=_0x4e67ce-0x0;var _0x345a96=_0x839f[_0x4e67ce];return _0x345a96;};'use strict';var Sequelize=require(_0xf839('0x0'));var moment=require(_0xf839('0x1'));module['exports']={'state':{'type':Sequelize[_0xf839('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf839('0x3')]},'scheduledat':{'type':Sequelize[_0xf839('0x4')]},'countbusyretry':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf839('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xf839('0x3')]},'originatecalleridname':{'type':Sequelize[_0xf839('0x3')]},'calleridnum':{'type':Sequelize[_0xf839('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xf839('0x4')]},'answertime':{'type':Sequelize[_0xf839('0x4')]},'droptime':{'type':Sequelize[_0xf839('0x4')]},'endtime':{'type':Sequelize[_0xf839('0x4')]},'ringtime':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf839('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf839('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xf839('0x3')]},'disposition':{'type':Sequelize[_0xf839('0x3')]},'secondDisposition':{'type':Sequelize[_0xf839('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xf839('0x4')],'set':function(_0xba4d92){var _0x287b8e=this[_0xf839('0x5')](_0xf839('0x6'));if(_0x287b8e&&_0xba4d92){this[_0xf839('0x7')](_0xf839('0x8'),moment(_0xba4d92)[_0xf839('0x9')](moment(_0x287b8e),_0xf839('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xf839('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xf839('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xf839('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xf839('0x4')]},'callback':{'type':Sequelize[_0xf839('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf839('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xf839('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xf839('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2177=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','moment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2177,0xaf));var _0x7217=function(_0x234e1a,_0x500d79){_0x234e1a=_0x234e1a-0x0;var _0x55aad2=_0x2177[_0x234e1a];return _0x55aad2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7217('0x0'));module['exports']={'state':{'type':Sequelize[_0x7217('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7217('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7217('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x7217('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7217('0x2')]},'calleridname':{'type':Sequelize[_0x7217('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x7217('0x3')]},'answertime':{'type':Sequelize[_0x7217('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7217('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7217('0x2')]},'campaign':{'type':Sequelize[_0x7217('0x2')]},'campaigntype':{'type':Sequelize[_0x7217('0x2')]},'membername':{'type':Sequelize[_0x7217('0x2')]},'reason':{'type':Sequelize[_0x7217('0x2')]},'disposition':{'type':Sequelize[_0x7217('0x2')]},'secondDisposition':{'type':Sequelize[_0x7217('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7217('0x2')]},'dispositionat':{'type':Sequelize[_0x7217('0x3')],'set':function(_0x36b142){var _0x338931=this[_0x7217('0x4')](_0x7217('0x5'));if(_0x338931&&_0x36b142){this[_0x7217('0x6')](_0x7217('0x7'),moment(_0x36b142)[_0x7217('0x8')](moment(_0x338931),_0x7217('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x7217('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7217('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x7217('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7217('0x3')]},'callback':{'type':Sequelize[_0x7217('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7217('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7217('0x3')]},'deleted':{'type':Sequelize[_0x7217('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7217('0x3')]},'recallme':{'type':Sequelize[_0x7217('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x7217('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index b808176..89d9e9d 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 _0x4137=['squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','literal','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4137,0xf8));var _0x7413=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4137[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['CmHopperFinal'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['describe']=function(_0x513657,_0x3c1f1a){return db['CmHopperFinal']['describe']()[_0x7413('0x25')](respondWithResult(_0x3c1f1a,null))[_0x7413('0x47')](handleError(_0x3c1f1a,null));};exports['update']=function(_0x2aa12c,_0x586d25){if(_0x2aa12c['body'][_0x7413('0x48')]){delete _0x2aa12c['body'][_0x7413('0x48')];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'uniqueid':_0x2aa12c[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x586d25,null))[_0x7413('0x25')](saveUpdates(_0x2aa12c[_0x7413('0x49')],null))[_0x7413('0x25')](respondWithResult(_0x586d25,null))[_0x7413('0x47')](handleError(_0x586d25,null));};exports[_0x7413('0x4a')]=function(_0x50a27d,_0x369891,_0x501407){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x50a27d[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x4d')))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x51')))),_0x7413('0x52')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x55')))),'abandonedContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x369891,null))[_0x7413('0x25')](respondWithResult(_0x369891,null))[_0x7413('0x47')](handleError(_0x369891,null));};exports[_0x7413('0x5a')]=function(_0x28130e,_0x593571,_0x35f7e8){return db['CmHopperFinal'][_0x7413('0x41')]({'raw':![],'where':{'CampaignId':_0x28130e[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x5b')))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x51')))),'congestionContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7413('0x5c')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x593571,null))[_0x7413('0x25')](respondWithResult(_0x593571,null))[_0x7413('0x47')](handleError(_0x593571,null));};exports[_0x7413('0x5d')]=function(_0x2c504e,_0x50910a,_0x5988bd){return db[_0x7413('0x5e')]['find']({'where':{'id':_0x2c504e[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x50910a,null))['then'](function(_0x2be9b1){var _0x4b676a;if(_0x2be9b1){_0x4b676a=squel[_0x7413('0x5f')]()[_0x7413('0x60')]('cm_hopper')['fromQuery']([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),'ListId',_0x7413('0x64'),_0x7413('0x65'),_0x7413('0x66')],squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x69'),'phone')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x62'))['field'](_0x7413('0x6b'),_0x7413('0x63'))[_0x7413('0x68')](_0x7413('0x6c'),_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x6e'),_0x7413('0x64'))[_0x7413('0x68')]('NOW()',_0x7413('0x65'))[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x71'),_0x2c504e['params']['id']['toString']())[_0x7413('0x3b')](_0x7413('0x72'),_0x2c504e['body'][_0x7413('0x73')][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('phone')[_0x7413('0x6f')]('cm_hopper')[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x77'))[_0x7413('0x6f')](_0x7413('0x70'))[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]())[_0x7413('0x3b')]('state\x20=\x204'))['group']('ContactId'))[_0x7413('0x74')]();return db['sequelize'][_0x7413('0x32')](_0x4b676a);}return[];})[_0x7413('0x25')](respondWithResult(_0x50910a,null))[_0x7413('0x47')](handleError(_0x50910a,null));};exports[_0x7413('0x78')]=function(_0x470c21,_0x17c115,_0xbba3c7){return db[_0x7413('0x79')][_0x7413('0x46')]({'where':{'id':_0x470c21['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x17c115,null))[_0x7413('0x25')](function(_0x38bb4e){var _0x4ea60e;if(_0x38bb4e){_0x4ea60e=squel[_0x7413('0x5f')]()[_0x7413('0x60')](_0x7413('0x7a'))[_0x7413('0x7b')]([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),_0x7413('0x6d'),_0x7413('0x7c'),_0x7413('0x65'),'updatedAt'],squel[_0x7413('0x67')]()[_0x7413('0x68')]('ANY_VALUE(calleridnum)',_0x7413('0x61'))[_0x7413('0x68')]('NOW()',_0x7413('0x62'))[_0x7413('0x68')](_0x7413('0x6b'),'ContactId')[_0x7413('0x68')]('ANY_VALUE(ListId)',_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x7d'),_0x7413('0x7c'))[_0x7413('0x68')](_0x7413('0x6a'),'createdAt')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x72'),_0x470c21['body']['state'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x7413('0x68')](_0x7413('0x61'))[_0x7413('0x6f')]('cm_hopper')['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('calleridnum')['from'](_0x7413('0x70'))[_0x7413('0x3b')]('CampaignId\x20=\x20?',_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x7f')))[_0x7413('0x80')](_0x7413('0x63')))[_0x7413('0x74')]();return db[_0x7413('0x4b')][_0x7413('0x32')](_0x4ea60e);}return[];})['then'](respondWithResult(_0x17c115,null))[_0x7413('0x47')](handleError(_0x17c115,null));};exports[_0x7413('0x81')]=function(_0x59d665,_0x1f3e26,_0xccd480){return db[_0x7413('0x82')]['findOne']({'where':{'VoiceQueueId':_0x59d665['body']['VoiceQueueId'],'CampaignId':_0x59d665[_0x7413('0x49')][_0x7413('0x7c')],'ContactId':_0x59d665[_0x7413('0x49')][_0x7413('0x63')]}})[_0x7413('0x25')](handleEntityNotFound(_0x1f3e26,null))[_0x7413('0x25')](function(_0x207293){if(_0x207293){return _0x207293;}return null;})[_0x7413('0x25')](respondWithResult(_0x1f3e26,null))['catch'](handleError(_0x1f3e26,null));}; \ No newline at end of file +var _0x53ec=['ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','name','send','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','noSuchContacts','`state`\x20=\x203,\x201,\x20null','dropContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','ContactId','VoiceQueueId','updatedAt','select','ANY_VALUE(calleridnum)','scheduledAt','field','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(ContactId)'];(function(_0x5c8f47,_0x4fa861){var _0x53a878=function(_0x2b803c){while(--_0x2b803c){_0x5c8f47['push'](_0x5c8f47['shift']());}};_0x53a878(++_0x4fa861);}(_0x53ec,0x192));var _0xc53e=function(_0x16fa8d,_0x3a1ca5){_0x16fa8d=_0x16fa8d-0x0;var _0x1948d8=_0x53ec[_0x16fa8d];return _0x1948d8;};'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'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':!![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')]()['then'](respondWithResult(_0x15e744,null))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x39feea,_0x5a6e41){if(_0x39feea[_0xc53e('0x46')][_0xc53e('0x47')]){delete _0x39feea[_0xc53e('0x46')][_0xc53e('0x47')];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'uniqueid':_0x39feea[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x5a6e41,null))[_0xc53e('0x24')](saveUpdates(_0x39feea[_0xc53e('0x46')],null))['then'](respondWithResult(_0x5a6e41,null))[_0xc53e('0x43')](handleError(_0x5a6e41,null));};exports[_0xc53e('0x48')]=function(_0x38520c,_0x3d74ac,_0x136544){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x38520c[_0xc53e('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4c')))),'noSuchContacts'],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db['sequelize'][_0xc53e('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0xc53e('0x4d')],[db[_0xc53e('0x4a')]['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x4e')))),_0xc53e('0x4f')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x50')))),_0xc53e('0x51')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x52')))),'dropContacts'],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x53')))),_0xc53e('0x54')],[db['sequelize']['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db['sequelize']['literal'](_0xc53e('0x55')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db['sequelize'][_0xc53e('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0xc53e('0x56')]]})[_0xc53e('0x24')](handleEntityNotFound(_0x3d74ac,null))[_0xc53e('0x24')](respondWithResult(_0x3d74ac,null))[_0xc53e('0x43')](handleError(_0x3d74ac,null));};exports[_0xc53e('0x57')]=function(_0x4caf5f,_0x55e068,_0x4655b7){return db[_0xc53e('0x29')][_0xc53e('0x58')]({'raw':![],'where':{'CampaignId':_0x4caf5f[_0xc53e('0x40')]['id']},'attributes':[[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4c')))),_0xc53e('0x59')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x5a')))),_0xc53e('0x4d')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4e')))),'busyContacts'],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x50')))),_0xc53e('0x51')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xc53e('0x52')))),_0xc53e('0x5b')],[db['sequelize']['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x53')))),_0xc53e('0x54')],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x55')))),_0xc53e('0x5c')],[db[_0xc53e('0x4a')]['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x5d')))),'answeringMachine']]})[_0xc53e('0x24')](handleEntityNotFound(_0x55e068,null))[_0xc53e('0x24')](respondWithResult(_0x55e068,null))[_0xc53e('0x43')](handleError(_0x55e068,null));};exports[_0xc53e('0x5e')]=function(_0x32f954,_0x2d9803,_0x51638a){return db[_0xc53e('0x5f')][_0xc53e('0x42')]({'where':{'id':_0x32f954[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x2d9803,null))['then'](function(_0x5e1f4a){var _0x57edb;if(_0x5e1f4a){_0x57edb=squel[_0xc53e('0x60')]()[_0xc53e('0x61')](_0xc53e('0x62'))['fromQuery']([_0xc53e('0x63'),'scheduledAt',_0xc53e('0x64'),'ListId',_0xc53e('0x65'),'createdAt',_0xc53e('0x66')],squel[_0xc53e('0x67')]()['field'](_0xc53e('0x68'),_0xc53e('0x63'))['field']('NOW()',_0xc53e('0x69'))[_0xc53e('0x6a')]('ANY_VALUE(ContactId)','ContactId')[_0xc53e('0x6a')]('ANY_VALUE(ListId)',_0xc53e('0x6b'))['field'](_0xc53e('0x6c'),_0xc53e('0x65'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x6e'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x66'))[_0xc53e('0x6f')](_0xc53e('0x70'))['where'](_0xc53e('0x71'),_0x32f954['params']['id'][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x73'),_0x32f954[_0xc53e('0x46')][_0xc53e('0x74')][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x75'))[_0xc53e('0x39')](_0xc53e('0x76'),squel['select']()[_0xc53e('0x6a')]('phone')[_0xc53e('0x6f')](_0xc53e('0x62'))[_0xc53e('0x39')]('VoiceQueueId\x20=\x20?',_0x32f954[_0xc53e('0x40')]['id'][_0xc53e('0x72')]()))[_0xc53e('0x39')](_0xc53e('0x76'),squel[_0xc53e('0x67')]()['field'](_0xc53e('0x77'))[_0xc53e('0x6f')]('cm_hopper_final')[_0xc53e('0x39')](_0xc53e('0x71'),_0x32f954[_0xc53e('0x40')]['id']['toString']())[_0xc53e('0x39')](_0xc53e('0x78')))['group'](_0xc53e('0x64')))[_0xc53e('0x72')]();return db['sequelize']['query'](_0x57edb);}return[];})[_0xc53e('0x24')](respondWithResult(_0x2d9803,null))['catch'](handleError(_0x2d9803,null));};exports[_0xc53e('0x79')]=function(_0x3d2636,_0x263d97,_0x58684c){return db[_0xc53e('0x7a')][_0xc53e('0x42')]({'where':{'id':_0x3d2636[_0xc53e('0x40')]['id']}})['then'](handleEntityNotFound(_0x263d97,null))[_0xc53e('0x24')](function(_0x2e048a){var _0x1c24e6;if(_0x2e048a){_0x1c24e6=squel[_0xc53e('0x60')]()[_0xc53e('0x61')]('cm_hopper')[_0xc53e('0x7b')]([_0xc53e('0x63'),_0xc53e('0x69'),_0xc53e('0x64'),_0xc53e('0x6b'),_0xc53e('0x7c'),_0xc53e('0x6e'),_0xc53e('0x66')],squel[_0xc53e('0x67')]()['field'](_0xc53e('0x68'),_0xc53e('0x63'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x69'))[_0xc53e('0x6a')](_0xc53e('0x7d'),_0xc53e('0x64'))[_0xc53e('0x6a')]('ANY_VALUE(ListId)',_0xc53e('0x6b'))[_0xc53e('0x6a')](_0xc53e('0x7e'),_0xc53e('0x7c'))['field'](_0xc53e('0x6d'),_0xc53e('0x6e'))[_0xc53e('0x6a')](_0xc53e('0x6d'),'updatedAt')[_0xc53e('0x6f')](_0xc53e('0x70'))[_0xc53e('0x39')](_0xc53e('0x7f'),_0x3d2636[_0xc53e('0x40')]['id'][_0xc53e('0x72')]())[_0xc53e('0x39')]('state\x20=\x20?',_0x3d2636[_0xc53e('0x46')]['state'][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x75'))['where'](_0xc53e('0x76'),squel[_0xc53e('0x67')]()[_0xc53e('0x6a')]('phone')[_0xc53e('0x6f')](_0xc53e('0x62'))[_0xc53e('0x39')]('CampaignId\x20=\x20?',_0x3d2636[_0xc53e('0x40')]['id'][_0xc53e('0x72')]()))[_0xc53e('0x39')](_0xc53e('0x76'),squel[_0xc53e('0x67')]()['field']('calleridnum')['from'](_0xc53e('0x70'))[_0xc53e('0x39')](_0xc53e('0x7f'),_0x3d2636[_0xc53e('0x40')]['id']['toString']())[_0xc53e('0x39')]('state\x20=\x204'))[_0xc53e('0x80')](_0xc53e('0x64')))[_0xc53e('0x72')]();return db[_0xc53e('0x4a')]['query'](_0x1c24e6);}return[];})[_0xc53e('0x24')](respondWithResult(_0x263d97,null))[_0xc53e('0x43')](handleError(_0x263d97,null));};exports[_0xc53e('0x81')]=function(_0x352bc6,_0x67be18,_0x306343){return db[_0xc53e('0x82')][_0xc53e('0x83')]({'where':{'VoiceQueueId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x65')],'CampaignId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x7c')],'ContactId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x64')]}})[_0xc53e('0x24')](handleEntityNotFound(_0x67be18,null))[_0xc53e('0x24')](function(_0x3dc1be){if(_0x3dc1be){return _0x3dc1be;}return null;})[_0xc53e('0x24')](respondWithResult(_0x67be18,null))[_0xc53e('0x43')](handleError(_0x67be18,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d86c5a7..4910f1a 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 _0xda34=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./cmHopperFinal.attributes','define'];(function(_0x41df11,_0x5bed70){var _0x5d4050=function(_0x2322bb){while(--_0x2322bb){_0x41df11['push'](_0x41df11['shift']());}};_0x5d4050(++_0x5bed70);}(_0xda34,0xac));var _0x4da3=function(_0x37783e,_0x3fb3ff){_0x37783e=_0x37783e-0x0;var _0x51955f=_0xda34[_0x37783e];return _0x51955f;};'use strict';var _=require(_0x4da3('0x0'));var util=require(_0x4da3('0x1'));var logger=require(_0x4da3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4da3('0x3'));var rp=require(_0x4da3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4da3('0x5'));var config=require('../../config/environment');var attributes=require(_0x4da3('0x6'));module['exports']=function(_0x34d333,_0x41c536){return _0x34d333[_0x4da3('0x7')](_0x4da3('0x8'),attributes,{'tableName':_0x4da3('0x9'),'paranoid':![],'indexes':[{'name':_0x4da3('0xa'),'fields':[_0x4da3('0xa')]},{'name':'uniqueid','fields':[_0x4da3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14e2=['./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x590e58,_0x16ec53){var _0x2811e2=function(_0x32d1f9){while(--_0x32d1f9){_0x590e58['push'](_0x590e58['shift']());}};_0x2811e2(++_0x16ec53);}(_0x14e2,0x172));var _0x214e=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x14e2[_0x2af29a];return _0x5ef02f;};'use strict';var _=require(_0x214e('0x0'));var util=require(_0x214e('0x1'));var logger=require(_0x214e('0x2'))('api');var moment=require(_0x214e('0x3'));var BPromise=require(_0x214e('0x4'));var rp=require(_0x214e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x214e('0x6'));var config=require(_0x214e('0x7'));var attributes=require(_0x214e('0x8'));module['exports']=function(_0xb2d4ff,_0x1fd985){return _0xb2d4ff[_0x214e('0x9')](_0x214e('0xa'),attributes,{'tableName':_0x214e('0xb'),'paranoid':![],'indexes':[{'name':_0x214e('0xc'),'fields':[_0x214e('0xc')]},{'name':'uniqueid','fields':[_0x214e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index fc1dd7d..b7174ac 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x56c59e,_0x37998b){var _0x24a922=function(_0x3e7660){while(--_0x3e7660){_0x56c59e['push'](_0x56c59e['shift']());}};_0x24a922(++_0x37998b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5560f6,_0x225f9c){_0x5560f6=_0x5560f6-0x0;var _0x25d4ef=_0xb10b[_0x5560f6];return _0x25d4ef;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x71c47a,_0xf95fef){var _0x2933a9=function(_0xaf289e){while(--_0xaf289e){_0x71c47a['push'](_0x71c47a['shift']());}};_0x2933a9(++_0xf95fef);}(_0x7a54,0x106));var _0x47a5=function(_0x329b58,_0x110a7e){_0x329b58=_0x329b58-0x0;var _0x2c4c9a=_0x7a54[_0x329b58];return _0x2c4c9a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 23db25d..c129dd2 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 _0xcc6d=['moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','/voice/queue/moveContacts/:id'];(function(_0x1470cf,_0x5d471f){var _0x2482fb=function(_0x1747e3){while(--_0x1747e3){_0x1470cf['push'](_0x1470cf['shift']());}};_0x2482fb(++_0x5d471f);}(_0xcc6d,0x1a9));var _0xdcc6=function(_0x296dfc,_0x341e7d){_0x296dfc=_0x296dfc-0x0;var _0x3675c6=_0xcc6d[_0x296dfc];return _0x3675c6;};'use strict';var multer=require(_0xdcc6('0x0'));var util=require(_0xdcc6('0x1'));var path=require(_0xdcc6('0x2'));var timeout=require(_0xdcc6('0x3'));var express=require(_0xdcc6('0x4'));var router=express['Router']();var fs_extra=require(_0xdcc6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdcc6('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xdcc6('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xdcc6('0x8'),auth['isAuthenticated'](),controller[_0xdcc6('0x9')]);router[_0xdcc6('0x7')](_0xdcc6('0xa'),auth[_0xdcc6('0xb')](),controller[_0xdcc6('0xc')]);router['get'](_0xdcc6('0xd'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router['get']('/campaign/countAttributes/:id',auth[_0xdcc6('0xb')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xdcc6('0xe'),auth[_0xdcc6('0xb')](),controller[_0xdcc6('0xf')]);router[_0xdcc6('0x10')](_0xdcc6('0x11'),auth[_0xdcc6('0xb')](),controller[_0xdcc6('0x12')]);router[_0xdcc6('0x10')](_0xdcc6('0x13'),auth[_0xdcc6('0xb')](),controller['checkContactHopper']);router['put'](_0xdcc6('0xa'),auth['isAuthenticated'](),controller[_0xdcc6('0x14')]);module[_0xdcc6('0x15')]=router; \ No newline at end of file +var _0xaf79=['/checkContactHopper','checkContactHopper','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal'];(function(_0xe6a2ab,_0x55de20){var _0x5181a7=function(_0xe854e1){while(--_0xe854e1){_0xe6a2ab['push'](_0xe6a2ab['shift']());}};_0x5181a7(++_0x55de20);}(_0xaf79,0xe4));var _0x9af7=function(_0x11d544,_0x3947f2){_0x11d544=_0x11d544-0x0;var _0x2a2883=_0xaf79[_0x11d544];return _0x2a2883;};'use strict';var multer=require(_0x9af7('0x0'));var util=require(_0x9af7('0x1'));var path=require(_0x9af7('0x2'));var timeout=require(_0x9af7('0x3'));var express=require(_0x9af7('0x4'));var router=express[_0x9af7('0x5')]();var fs_extra=require(_0x9af7('0x6'));var auth=require(_0x9af7('0x7'));var interaction=require(_0x9af7('0x8'));var config=require(_0x9af7('0x9'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9af7('0xa')]);router[_0x9af7('0xb')](_0x9af7('0xc'),auth[_0x9af7('0xd')](),controller[_0x9af7('0xe')]);router[_0x9af7('0xb')](_0x9af7('0xf'),auth[_0x9af7('0xd')](),controller[_0x9af7('0x10')]);router['get']('/voice/queue/countAttributes/:id',auth[_0x9af7('0xd')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x9af7('0xb')](_0x9af7('0x11'),auth[_0x9af7('0xd')](),controller[_0x9af7('0x12')]);router[_0x9af7('0x13')](_0x9af7('0x14'),auth['isAuthenticated'](),controller[_0x9af7('0x15')]);router[_0x9af7('0x13')](_0x9af7('0x16'),auth[_0x9af7('0xd')](),controller[_0x9af7('0x17')]);router[_0x9af7('0x13')](_0x9af7('0x18'),auth[_0x9af7('0xd')](),controller[_0x9af7('0x19')]);router[_0x9af7('0x1a')](_0x9af7('0xf'),auth[_0x9af7('0xd')](),controller['update']);module[_0x9af7('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index d9962e0..8c9866f 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 _0xf6e6=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x441c12,_0x491e5a){var _0x312edf=function(_0x40605b){while(--_0x40605b){_0x441c12['push'](_0x441c12['shift']());}};_0x312edf(++_0x491e5a);}(_0xf6e6,0x1a8));var _0x6f6e=function(_0x137195,_0xb5c988){_0x137195=_0x137195-0x0;var _0x25245c=_0xf6e6[_0x137195];return _0x25245c;};'use strict';var Sequelize=require(_0x6f6e('0x0'));module[_0x6f6e('0x1')]={'state':{'type':Sequelize[_0x6f6e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6f6e('0x3')]},'scheduledat':{'type':Sequelize[_0x6f6e('0x4')]},'countbusyretry':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6f6e('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6f6e('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6f6e('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6f6e('0x4')]},'endtime':{'type':Sequelize[_0x6f6e('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x6f6e('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6f6e('0x3')]},'reason':{'type':Sequelize[_0x6f6e('0x3')]},'amd':{'type':Sequelize[_0x6f6e('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6f6e('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x6f6e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6f6e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6f6e('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x23c7=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x259a2e,_0x45bbba){var _0x395691=function(_0x460bbe){while(--_0x460bbe){_0x259a2e['push'](_0x259a2e['shift']());}};_0x395691(++_0x45bbba);}(_0x23c7,0x86));var _0x723c=function(_0x129807,_0x2c7aab){_0x129807=_0x129807-0x0;var _0x191330=_0x23c7[_0x129807];return _0x191330;};'use strict';var Sequelize=require(_0x723c('0x0'));module[_0x723c('0x1')]={'state':{'type':Sequelize[_0x723c('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x723c('0x3')]},'countbusyretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x723c('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x723c('0x4')]},'calleridnum':{'type':Sequelize[_0x723c('0x4')]},'calleridname':{'type':Sequelize[_0x723c('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x723c('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x723c('0x4')]},'campaign':{'type':Sequelize[_0x723c('0x4')]},'campaigntype':{'type':Sequelize[_0x723c('0x4')]},'membername':{'type':Sequelize[_0x723c('0x4')]},'reason':{'type':Sequelize[_0x723c('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x723c('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x723c('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x723c('0x3')]},'recallme':{'type':Sequelize[_0x723c('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x723c('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index c95a188..f3488ee 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 _0x52d8=['attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','end','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','keys','filters','query','intersection','fields'];(function(_0x25a136,_0x57320e){var _0x5b7159=function(_0x32c8f9){while(--_0x32c8f9){_0x25a136['push'](_0x25a136['shift']());}};_0x5b7159(++_0x57320e);}(_0x52d8,0x150));var _0x852d=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x52d8[_0x284bc3];return _0x41ac81;};'use strict';var emlformat=require(_0x852d('0x0'));var rimraf=require(_0x852d('0x1'));var zipdir=require(_0x852d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x852d('0x3'));var moment=require(_0x852d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x852d('0x5'));var util=require('util');var path=require(_0x852d('0x6'));var sox=require(_0x852d('0x7'));var csv=require(_0x852d('0x8'));var ejs=require(_0x852d('0x9'));var fs=require('fs');var fs_extra=require(_0x852d('0xa'));var _=require(_0x852d('0xb'));var squel=require(_0x852d('0xc'));var crypto=require(_0x852d('0xd'));var jsforce=require(_0x852d('0xe'));var deskjs=require(_0x852d('0xf'));var toCsv=require(_0x852d('0x8'));var querystring=require('querystring');var Papa=require(_0x852d('0x10'));var Redis=require(_0x852d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x852d('0x12'));var as=require(_0x852d('0x13'));var hardwareService=require(_0x852d('0x14'));var logger=require(_0x852d('0x15'))('api');var utils=require(_0x852d('0x16'));var config=require(_0x852d('0x17'));var licenseUtil=require(_0x852d('0x18'));var db=require(_0x852d('0x19'))['db'];function respondWithStatusCode(_0x4d3084,_0x5bb294){_0x5bb294=_0x5bb294||0xcc;return function(_0x5503a9){if(_0x5503a9){return _0x4d3084[_0x852d('0x1a')](_0x5bb294);}return _0x4d3084[_0x852d('0x1b')](_0x5bb294)['end']();};}function respondWithResult(_0x2a32cf,_0x13735a){_0x13735a=_0x13735a||0xc8;return function(_0x27d01f){if(_0x27d01f){return _0x2a32cf[_0x852d('0x1b')](_0x13735a)[_0x852d('0x1c')](_0x27d01f);}};}function respondWithFilteredResult(_0x5c6e12,_0x5e79d7){return function(_0x4c3ac4){if(_0x4c3ac4){var _0x41eafd=typeof _0x5e79d7[_0x852d('0x1d')]===_0x852d('0x1e')&&typeof _0x5e79d7[_0x852d('0x1f')]===_0x852d('0x1e');var _0x51ac4c=_0x4c3ac4[_0x852d('0x20')];var _0x3ffb8d=_0x41eafd?0x0:_0x5e79d7[_0x852d('0x1d')];var _0x22a0c0=_0x41eafd?_0x4c3ac4[_0x852d('0x20')]:_0x5e79d7[_0x852d('0x1d')]+_0x5e79d7[_0x852d('0x1f')];var _0x436ad0;if(_0x22a0c0>=_0x51ac4c){_0x22a0c0=_0x51ac4c;_0x436ad0=0xc8;}else{_0x436ad0=0xce;}_0x5c6e12[_0x852d('0x1b')](_0x436ad0);return _0x5c6e12[_0x852d('0x21')](_0x852d('0x22'),_0x3ffb8d+'-'+_0x22a0c0+'/'+_0x51ac4c)['json'](_0x4c3ac4);}return null;};}function patchUpdates(_0x4ee529){return function(_0x1429d1){try{jsonpatch['apply'](_0x1429d1,_0x4ee529,!![]);}catch(_0x1cfdca){return BPromise[_0x852d('0x23')](_0x1cfdca);}return _0x1429d1['save']();};}function saveUpdates(_0x3701c0,_0x1ae3e7){return function(_0x2a6e5d){if(_0x2a6e5d){return _0x2a6e5d['update'](_0x3701c0)[_0x852d('0x24')](function(_0x19cf08){return _0x19cf08;});}return null;};}function removeEntity(_0x189a9e,_0x476489){return function(_0x34ccf4){if(_0x34ccf4){return _0x34ccf4[_0x852d('0x25')]()['then'](function(){_0x189a9e[_0x852d('0x1b')](0xcc)[_0x852d('0x26')]();});}};}function handleEntityNotFound(_0x384ea5,_0x231330){return function(_0x1d4173){if(!_0x1d4173){_0x384ea5[_0x852d('0x1a')](0x194);}return _0x1d4173;};}function handleError(_0x25cc26,_0x56fcaf){_0x56fcaf=_0x56fcaf||0x1f4;return function(_0x491c93){logger['error'](_0x491c93[_0x852d('0x27')]);if(_0x491c93[_0x852d('0x28')]){delete _0x491c93['name'];}_0x25cc26[_0x852d('0x1b')](_0x56fcaf)[_0x852d('0x29')](_0x491c93);};}exports[_0x852d('0x2a')]=function(_0x203a26,_0x43f78){var _0x1423ad={},_0xe23ad8={},_0x1cad35={'count':0x0,'rows':[]};var _0x224430=_[_0x852d('0x2b')](db[_0x852d('0x2c')][_0x852d('0x2d')],function(_0x5126d9){return{'name':_0x5126d9['fieldName'],'type':_0x5126d9[_0x852d('0x2e')][_0x852d('0x2f')]};});_0xe23ad8[_0x852d('0x30')]=_[_0x852d('0x2b')](_0x224430,_0x852d('0x28'));_0xe23ad8['query']=_[_0x852d('0x31')](_0x203a26['query']);_0xe23ad8[_0x852d('0x32')]=_['intersection'](_0xe23ad8[_0x852d('0x30')],_0xe23ad8[_0x852d('0x33')]);_0x1423ad['attributes']=_[_0x852d('0x34')](_0xe23ad8[_0x852d('0x30')],qs['fields'](_0x203a26[_0x852d('0x33')][_0x852d('0x35')]));_0x1423ad['attributes']=_0x1423ad[_0x852d('0x36')][_0x852d('0x37')]?_0x1423ad[_0x852d('0x36')]:_0xe23ad8[_0x852d('0x30')];if(!_0x203a26[_0x852d('0x33')][_0x852d('0x38')](_0x852d('0x39'))){_0x1423ad[_0x852d('0x1f')]=qs[_0x852d('0x1f')](_0x203a26[_0x852d('0x33')][_0x852d('0x1f')]);_0x1423ad['offset']=qs[_0x852d('0x1d')](_0x203a26[_0x852d('0x33')][_0x852d('0x1d')]);}_0x1423ad['order']=qs['sort'](_0x203a26[_0x852d('0x33')][_0x852d('0x3a')]);_0x1423ad[_0x852d('0x3b')]=qs['filters'](_[_0x852d('0x3c')](_0x203a26[_0x852d('0x33')],_0xe23ad8[_0x852d('0x32')]),_0x224430);if(_0x203a26[_0x852d('0x33')][_0x852d('0x3d')]){_0x1423ad[_0x852d('0x3b')]=_[_0x852d('0x3e')](_0x1423ad['where'],{'$or':_[_0x852d('0x2b')](_0x224430,function(_0x3d1483){if(_0x3d1483[_0x852d('0x2e')]!==_0x852d('0x3f')){var _0x4387c3={};_0x4387c3[_0x3d1483[_0x852d('0x28')]]={'$like':'%'+_0x203a26[_0x852d('0x33')][_0x852d('0x3d')]+'%'};return _0x4387c3;}})});}_0x1423ad=_['merge']({},_0x1423ad,_0x203a26[_0x852d('0x40')]);var _0x293c54={'where':_0x1423ad['where']};return db[_0x852d('0x2c')][_0x852d('0x20')](_0x293c54)[_0x852d('0x24')](function(_0x7f2001){_0x1cad35['count']=_0x7f2001;if(_0x203a26['query'][_0x852d('0x41')]){_0x1423ad['include']=[{'all':!![]}];}return db[_0x852d('0x2c')][_0x852d('0x42')](_0x1423ad);})[_0x852d('0x24')](function(_0x3e8102){_0x1cad35[_0x852d('0x43')]=_0x3e8102;return _0x1cad35;})['then'](respondWithFilteredResult(_0x43f78,_0x1423ad))[_0x852d('0x44')](handleError(_0x43f78,null));};exports[_0x852d('0x45')]=function(_0xfc6211,_0x1c0030){var _0x4e604d={'raw':!![],'where':{'id':_0xfc6211[_0x852d('0x46')]['id']}},_0x16f0da={};_0x16f0da['model']=_['keys'](db[_0x852d('0x2c')]['rawAttributes']);_0x16f0da[_0x852d('0x33')]=_['keys'](_0xfc6211[_0x852d('0x33')]);_0x16f0da[_0x852d('0x32')]=_[_0x852d('0x34')](_0x16f0da[_0x852d('0x30')],_0x16f0da[_0x852d('0x33')]);_0x4e604d[_0x852d('0x36')]=_[_0x852d('0x34')](_0x16f0da[_0x852d('0x30')],qs[_0x852d('0x35')](_0xfc6211[_0x852d('0x33')][_0x852d('0x35')]));_0x4e604d['attributes']=_0x4e604d['attributes']['length']?_0x4e604d['attributes']:_0x16f0da[_0x852d('0x30')];if(_0xfc6211['query'][_0x852d('0x41')]){_0x4e604d[_0x852d('0x47')]=[{'all':!![]}];}_0x4e604d=_[_0x852d('0x3e')]({},_0x4e604d,_0xfc6211['options']);return db[_0x852d('0x2c')][_0x852d('0x48')](_0x4e604d)['then'](handleEntityNotFound(_0x1c0030,null))[_0x852d('0x24')](respondWithResult(_0x1c0030,null))[_0x852d('0x44')](handleError(_0x1c0030,null));};exports['create']=function(_0x304c3e,_0xd94089){return db['CmHopperHistory'][_0x852d('0x49')](_0x304c3e[_0x852d('0x4a')],{})[_0x852d('0x24')](respondWithResult(_0xd94089,0xc9))[_0x852d('0x44')](handleError(_0xd94089,null));};exports[_0x852d('0x4b')]=function(_0x127707,_0x4db282){return db[_0x852d('0x2c')]['describe']()[_0x852d('0x24')](respondWithResult(_0x4db282,null))['catch'](handleError(_0x4db282,null));};exports[_0x852d('0x4c')]=function(_0x38af4b,_0x5a68b2){if(_0x38af4b[_0x852d('0x4a')]['uniqueid']){delete _0x38af4b[_0x852d('0x4a')][_0x852d('0x4d')];}return db[_0x852d('0x2c')][_0x852d('0x48')]({'where':{'uniqueid':_0x38af4b[_0x852d('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a68b2,null))[_0x852d('0x24')](saveUpdates(_0x38af4b[_0x852d('0x4a')],null))['then'](respondWithResult(_0x5a68b2,null))[_0x852d('0x44')](handleError(_0x5a68b2,null));}; \ No newline at end of file +var _0x707e=['where','merge','filter','options','includeAll','include','rows','catch','params','find','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','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/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick'];(function(_0xff14fb,_0x1c31e8){var _0x266f08=function(_0x3ce2e0){while(--_0x3ce2e0){_0xff14fb['push'](_0xff14fb['shift']());}};_0x266f08(++_0x1c31e8);}(_0x707e,0x1e8));var _0xe707=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x707e[_0x4b4f24];return _0x1c13d4;};'use strict';var emlformat=require(_0xe707('0x0'));var rimraf=require(_0xe707('0x1'));var zipdir=require(_0xe707('0x2'));var jsonpatch=require(_0xe707('0x3'));var rp=require(_0xe707('0x4'));var moment=require(_0xe707('0x5'));var BPromise=require(_0xe707('0x6'));var Mustache=require('mustache');var util=require(_0xe707('0x7'));var path=require(_0xe707('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe707('0x9'));var fs=require('fs');var fs_extra=require(_0xe707('0xa'));var _=require(_0xe707('0xb'));var squel=require(_0xe707('0xc'));var crypto=require(_0xe707('0xd'));var jsforce=require(_0xe707('0xe'));var deskjs=require(_0xe707('0xf'));var toCsv=require(_0xe707('0x10'));var querystring=require('querystring');var Papa=require(_0xe707('0x11'));var Redis=require(_0xe707('0x12'));var authService=require(_0xe707('0x13'));var qs=require(_0xe707('0x14'));var as=require(_0xe707('0x15'));var hardwareService=require(_0xe707('0x16'));var logger=require(_0xe707('0x17'))(_0xe707('0x18'));var utils=require(_0xe707('0x19'));var config=require(_0xe707('0x1a'));var licenseUtil=require(_0xe707('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x712000,_0x3c676a){_0x3c676a=_0x3c676a||0xcc;return function(_0x50e202){if(_0x50e202){return _0x712000['sendStatus'](_0x3c676a);}return _0x712000[_0xe707('0x1c')](_0x3c676a)[_0xe707('0x1d')]();};}function respondWithResult(_0x1f08b3,_0x11fb76){_0x11fb76=_0x11fb76||0xc8;return function(_0x174ec7){if(_0x174ec7){return _0x1f08b3['status'](_0x11fb76)[_0xe707('0x1e')](_0x174ec7);}};}function respondWithFilteredResult(_0x3380c5,_0x1e3510){return function(_0x4b6025){if(_0x4b6025){var _0x2ccc0d=typeof _0x1e3510[_0xe707('0x1f')]===_0xe707('0x20')&&typeof _0x1e3510[_0xe707('0x21')]===_0xe707('0x20');var _0x1d49af=_0x4b6025[_0xe707('0x22')];var _0x56e6a4=_0x2ccc0d?0x0:_0x1e3510['offset'];var _0x46b52d=_0x2ccc0d?_0x4b6025['count']:_0x1e3510[_0xe707('0x1f')]+_0x1e3510[_0xe707('0x21')];var _0x887ca6;if(_0x46b52d>=_0x1d49af){_0x46b52d=_0x1d49af;_0x887ca6=0xc8;}else{_0x887ca6=0xce;}_0x3380c5[_0xe707('0x1c')](_0x887ca6);return _0x3380c5[_0xe707('0x23')](_0xe707('0x24'),_0x56e6a4+'-'+_0x46b52d+'/'+_0x1d49af)[_0xe707('0x1e')](_0x4b6025);}return null;};}function patchUpdates(_0x16349b){return function(_0xbb2f18){try{jsonpatch[_0xe707('0x25')](_0xbb2f18,_0x16349b,!![]);}catch(_0x7b86a3){return BPromise['reject'](_0x7b86a3);}return _0xbb2f18['save']();};}function saveUpdates(_0x307f19,_0x4c4183){return function(_0x220b65){if(_0x220b65){return _0x220b65[_0xe707('0x26')](_0x307f19)[_0xe707('0x27')](function(_0x45995d){return _0x45995d;});}return null;};}function removeEntity(_0x17673f,_0xb1abe6){return function(_0x44cf7e){if(_0x44cf7e){return _0x44cf7e[_0xe707('0x28')]()['then'](function(){_0x17673f[_0xe707('0x1c')](0xcc)[_0xe707('0x1d')]();});}};}function handleEntityNotFound(_0x1a0881,_0x3134ee){return function(_0x50e450){if(!_0x50e450){_0x1a0881[_0xe707('0x29')](0x194);}return _0x50e450;};}function handleError(_0x43b9bd,_0x2ab00c){_0x2ab00c=_0x2ab00c||0x1f4;return function(_0x2b1c2c){logger[_0xe707('0x2a')](_0x2b1c2c[_0xe707('0x2b')]);if(_0x2b1c2c[_0xe707('0x2c')]){delete _0x2b1c2c[_0xe707('0x2c')];}_0x43b9bd[_0xe707('0x1c')](_0x2ab00c)[_0xe707('0x2d')](_0x2b1c2c);};}exports[_0xe707('0x2e')]=function(_0x2263fd,_0x1aa50c){var _0x225e7d={},_0x395c4b={},_0x1e4dcb={'count':0x0,'rows':[]};var _0x3f8424=_[_0xe707('0x2f')](db[_0xe707('0x30')][_0xe707('0x31')],function(_0x27cffa){return{'name':_0x27cffa[_0xe707('0x32')],'type':_0x27cffa[_0xe707('0x33')]['key']};});_0x395c4b['model']=_[_0xe707('0x2f')](_0x3f8424,_0xe707('0x2c'));_0x395c4b[_0xe707('0x34')]=_[_0xe707('0x35')](_0x2263fd['query']);_0x395c4b['filters']=_[_0xe707('0x36')](_0x395c4b[_0xe707('0x37')],_0x395c4b[_0xe707('0x34')]);_0x225e7d['attributes']=_[_0xe707('0x36')](_0x395c4b[_0xe707('0x37')],qs[_0xe707('0x38')](_0x2263fd[_0xe707('0x34')]['fields']));_0x225e7d[_0xe707('0x39')]=_0x225e7d[_0xe707('0x39')][_0xe707('0x3a')]?_0x225e7d['attributes']:_0x395c4b['model'];if(!_0x2263fd[_0xe707('0x34')][_0xe707('0x3b')](_0xe707('0x3c'))){_0x225e7d[_0xe707('0x21')]=qs[_0xe707('0x21')](_0x2263fd[_0xe707('0x34')][_0xe707('0x21')]);_0x225e7d[_0xe707('0x1f')]=qs[_0xe707('0x1f')](_0x2263fd['query']['offset']);}_0x225e7d[_0xe707('0x3d')]=qs[_0xe707('0x3e')](_0x2263fd[_0xe707('0x34')][_0xe707('0x3e')]);_0x225e7d['where']=qs[_0xe707('0x3f')](_[_0xe707('0x40')](_0x2263fd[_0xe707('0x34')],_0x395c4b[_0xe707('0x3f')]),_0x3f8424);if(_0x2263fd['query']['filter']){_0x225e7d[_0xe707('0x41')]=_[_0xe707('0x42')](_0x225e7d[_0xe707('0x41')],{'$or':_[_0xe707('0x2f')](_0x3f8424,function(_0x304664){if(_0x304664[_0xe707('0x33')]!=='VIRTUAL'){var _0x109765={};_0x109765[_0x304664['name']]={'$like':'%'+_0x2263fd[_0xe707('0x34')][_0xe707('0x43')]+'%'};return _0x109765;}})});}_0x225e7d=_[_0xe707('0x42')]({},_0x225e7d,_0x2263fd[_0xe707('0x44')]);var _0x45f249={'where':_0x225e7d[_0xe707('0x41')]};return db['CmHopperHistory'][_0xe707('0x22')](_0x45f249)['then'](function(_0xf5db00){_0x1e4dcb[_0xe707('0x22')]=_0xf5db00;if(_0x2263fd[_0xe707('0x34')][_0xe707('0x45')]){_0x225e7d[_0xe707('0x46')]=[{'all':!![]}];}return db[_0xe707('0x30')]['findAll'](_0x225e7d);})['then'](function(_0x561dba){_0x1e4dcb[_0xe707('0x47')]=_0x561dba;return _0x1e4dcb;})['then'](respondWithFilteredResult(_0x1aa50c,_0x225e7d))[_0xe707('0x48')](handleError(_0x1aa50c,null));};exports['show']=function(_0x13851e,_0x46902d){var _0x30856e={'raw':!![],'where':{'id':_0x13851e[_0xe707('0x49')]['id']}},_0xb06378={};_0xb06378[_0xe707('0x37')]=_['keys'](db[_0xe707('0x30')][_0xe707('0x31')]);_0xb06378[_0xe707('0x34')]=_[_0xe707('0x35')](_0x13851e[_0xe707('0x34')]);_0xb06378['filters']=_[_0xe707('0x36')](_0xb06378[_0xe707('0x37')],_0xb06378[_0xe707('0x34')]);_0x30856e['attributes']=_[_0xe707('0x36')](_0xb06378[_0xe707('0x37')],qs['fields'](_0x13851e[_0xe707('0x34')]['fields']));_0x30856e[_0xe707('0x39')]=_0x30856e[_0xe707('0x39')][_0xe707('0x3a')]?_0x30856e[_0xe707('0x39')]:_0xb06378[_0xe707('0x37')];if(_0x13851e['query'][_0xe707('0x45')]){_0x30856e[_0xe707('0x46')]=[{'all':!![]}];}_0x30856e=_[_0xe707('0x42')]({},_0x30856e,_0x13851e[_0xe707('0x44')]);return db['CmHopperHistory'][_0xe707('0x4a')](_0x30856e)['then'](handleEntityNotFound(_0x46902d,null))[_0xe707('0x27')](respondWithResult(_0x46902d,null))[_0xe707('0x48')](handleError(_0x46902d,null));};exports[_0xe707('0x4b')]=function(_0x3a8701,_0x4ef9af){return db[_0xe707('0x30')][_0xe707('0x4b')](_0x3a8701['body'],{})[_0xe707('0x27')](respondWithResult(_0x4ef9af,0xc9))[_0xe707('0x48')](handleError(_0x4ef9af,null));};exports[_0xe707('0x4c')]=function(_0x56ff6f,_0x559715){return db['CmHopperHistory'][_0xe707('0x4c')]()[_0xe707('0x27')](respondWithResult(_0x559715,null))[_0xe707('0x48')](handleError(_0x559715,null));};exports[_0xe707('0x26')]=function(_0xb4a52c,_0x220614){if(_0xb4a52c[_0xe707('0x4d')]['uniqueid']){delete _0xb4a52c['body'][_0xe707('0x4e')];}return db[_0xe707('0x30')][_0xe707('0x4a')]({'where':{'uniqueid':_0xb4a52c['params']['id']}})[_0xe707('0x27')](handleEntityNotFound(_0x220614,null))[_0xe707('0x27')](saveUpdates(_0xb4a52c['body'],null))[_0xe707('0x27')](respondWithResult(_0x220614,null))[_0xe707('0x48')](handleError(_0x220614,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b604a0b..ee62c32 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 _0x4cb5=['rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4a310d,_0x33322d){var _0x5eaf36=function(_0x233014){while(--_0x233014){_0x4a310d['push'](_0x4a310d['shift']());}};_0x5eaf36(++_0x33322d);}(_0x4cb5,0x8f));var _0x54cb=function(_0x2230e2,_0x27393d){_0x2230e2=_0x2230e2-0x0;var _0x16ef4f=_0x4cb5[_0x2230e2];return _0x16ef4f;};'use strict';var _=require(_0x54cb('0x0'));var util=require(_0x54cb('0x1'));var logger=require(_0x54cb('0x2'))(_0x54cb('0x3'));var moment=require('moment');var BPromise=require(_0x54cb('0x4'));var rp=require(_0x54cb('0x5'));var fs=require('fs');var path=require(_0x54cb('0x6'));var rimraf=require(_0x54cb('0x7'));var config=require(_0x54cb('0x8'));var attributes=require(_0x54cb('0x9'));module[_0x54cb('0xa')]=function(_0x48aed1,_0x44f36d){return _0x48aed1[_0x54cb('0xb')]('CmHopperHistory',attributes,{'tableName':_0x54cb('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x54cb('0xd')]},{'name':_0x54cb('0xe'),'fields':[_0x54cb('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8cb=['moment','bluebird','request-promise','rimraf','../../config/environment','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x3800a2,_0x44c556){_0x3800a2=_0x3800a2-0x0;var _0x3e5e1f=_0xb8cb[_0x3800a2];return _0x3e5e1f;};'use strict';var _=require(_0xbb8c('0x0'));var util=require(_0xbb8c('0x1'));var logger=require(_0xbb8c('0x2'))(_0xbb8c('0x3'));var moment=require(_0xbb8c('0x4'));var BPromise=require(_0xbb8c('0x5'));var rp=require(_0xbb8c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb8c('0x7'));var config=require(_0xbb8c('0x8'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x3b2ad2,_0x27c59e){return _0x3b2ad2[_0xbb8c('0x9')]('CmHopperHistory',attributes,{'tableName':_0xbb8c('0xa'),'paranoid':![],'indexes':[{'name':_0xbb8c('0xb'),'fields':[_0xbb8c('0xb')]},{'name':_0xbb8c('0xc'),'fields':[_0xbb8c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 7b86473..3a56ece 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 _0x24fe=['col','ivrTotalCallsDays','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateCmHopperHistory','create','body','options','raw','stringify','where','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','COUNT','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','AvgHandleTime','CmHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name'];(function(_0x23b70b,_0x1b6e9e){var _0x546fb3=function(_0xb1bb7b){while(--_0xb1bb7b){_0x23b70b['push'](_0x23b70b['shift']());}};_0x546fb3(++_0x1b6e9e);}(_0x24fe,0x1b8));var _0xe24f=function(_0x431d4c,_0x19490a){_0x431d4c=_0x431d4c-0x0;var _0x411f02=_0x24fe[_0x431d4c];return _0x411f02;};'use strict';var _=require(_0xe24f('0x0'));var util=require('util');var moment=require(_0xe24f('0x1'));var BPromise=require(_0xe24f('0x2'));var rs=require(_0xe24f('0x3'));var fs=require('fs');var Redis=require(_0xe24f('0x4'));var db=require(_0xe24f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe24f('0x6'))(_0xe24f('0x7'));var config=require('../../config/environment');var jayson=require(_0xe24f('0x8'));var client=jayson[_0xe24f('0x9')][_0xe24f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dff78,_0x24627c,_0x27e3ad){return new BPromise(function(_0x39c377,_0x960ffa){return client[_0xe24f('0xb')](_0x1dff78,_0x27e3ad)[_0xe24f('0xc')](function(_0x1ca824){logger['info'](_0xe24f('0xd'),_0x24627c,_0xe24f('0xe'));logger['debug'](_0xe24f('0xf'),_0x24627c,_0xe24f('0xe'),JSON['stringify'](_0x1ca824));if(_0x1ca824['error']){if(_0x1ca824[_0xe24f('0x10')][_0xe24f('0x11')]===0x1f4){logger[_0xe24f('0x10')](_0xe24f('0xd'),_0x24627c,_0x1ca824[_0xe24f('0x10')][_0xe24f('0x12')]);return _0x960ffa(_0x1ca824[_0xe24f('0x10')][_0xe24f('0x12')]);}logger[_0xe24f('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x24627c,_0x1ca824['error'][_0xe24f('0x12')]);return _0x39c377(_0x1ca824[_0xe24f('0x10')]['message']);}else{logger[_0xe24f('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x24627c,_0xe24f('0xe'));_0x39c377(_0x1ca824[_0xe24f('0x14')][_0xe24f('0x12')]);}})[_0xe24f('0x15')](function(_0x5e3d3f){logger[_0xe24f('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x24627c,_0x5e3d3f);_0x960ffa(_0x5e3d3f);});});}exports[_0xe24f('0x16')]=function(_0x1f7273){var _0x1a7c6a=this;return new Promise(function(_0x562478,_0x2150c0){return db['CmHopperHistory'][_0xe24f('0x17')](_0x1f7273[_0xe24f('0x18')],{'raw':_0x1f7273[_0xe24f('0x19')]?_0x1f7273[_0xe24f('0x19')][_0xe24f('0x1a')]===undefined?!![]:![]:!![]})[_0xe24f('0xc')](function(_0x1baa45){logger['info'](_0xe24f('0x16'),_0x1f7273);logger['debug']('CreateCmHopperHistory',_0x1f7273,JSON[_0xe24f('0x1b')](_0x1baa45));_0x562478(_0x1baa45);})[_0xe24f('0x15')](function(_0x5c5f5c){logger[_0xe24f('0x10')](_0xe24f('0x16'),_0x5c5f5c[_0xe24f('0x12')],_0x1f7273);_0x2150c0(_0x1a7c6a[_0xe24f('0x10')](0x1f4,_0x5c5f5c[_0xe24f('0x12')]));});});};exports['AvgHandleTime']=function(_0x5d09e4){var _0x1e458b=this;return new Promise(function(_0x26c15e,_0x47e62e){return db['CmHopperHistory']['findAll']({'raw':_0x5d09e4['options']?_0x5d09e4['options'][_0xe24f('0x1a')]===undefined?!![]:![]:!![],'where':_0x5d09e4[_0xe24f('0x19')]?_0x5d09e4['options'][_0xe24f('0x1c')]||null:null,'attributes':[[db[_0xe24f('0x1d')]['fn']('COUNT',db[_0xe24f('0x1d')]['col']('id')),_0xe24f('0x1e')],[db[_0xe24f('0x1d')]['fn']('COUNT',db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x20')))),_0xe24f('0x21')],[db[_0xe24f('0x1d')]['fn']('COUNT',db[_0xe24f('0x1d')]['fn']('IF',db['sequelize'][_0xe24f('0x1f')](_0xe24f('0x22')))),_0xe24f('0x23')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db['sequelize']['fn']('IF',db[_0xe24f('0x1d')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xe24f('0x1d')]['fn']('AVG',db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')]['literal'](_0xe24f('0x25')))),_0xe24f('0x26')],[db[_0xe24f('0x1d')]['fn']('AVG',db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')]['literal'](_0xe24f('0x27')))),_0xe24f('0x28')]]})[_0xe24f('0xc')](function(_0xeb8d8b){logger[_0xe24f('0x13')]('AvgHandleTime',_0x5d09e4);logger[_0xe24f('0x29')](_0xe24f('0x2a'),_0x5d09e4,JSON[_0xe24f('0x1b')](_0xeb8d8b));_0x26c15e(_0xeb8d8b);})[_0xe24f('0x15')](function(_0x29911c){logger[_0xe24f('0x10')](_0xe24f('0x2a'),_0x29911c[_0xe24f('0x12')],_0x5d09e4);_0x47e62e(_0x1e458b[_0xe24f('0x10')](0x1f4,_0x29911c['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4c9e11){var _0x4c6d26=this;return new Promise(function(_0x2ad868,_0x2d39c3){return db[_0xe24f('0x2b')][_0xe24f('0x2c')]({'raw':_0x4c9e11[_0xe24f('0x19')]?_0x4c9e11['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c9e11[_0xe24f('0x19')]?_0x4c9e11[_0xe24f('0x19')][_0xe24f('0x1c')]||null:null,'attributes':[[_0xe24f('0x2d'),'name'],[db['sequelize']['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x2e')))),_0xe24f('0x2f')],[db['sequelize']['fn']('COUNT',db[_0xe24f('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xe24f('0x30')))),_0xe24f('0x31')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x20')))),_0xe24f('0x32')],[db[_0xe24f('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe24f('0x1d')]['literal'](_0xe24f('0x33')))),_0xe24f('0x34')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x35')))),_0xe24f('0x36')],[db['sequelize']['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xe24f('0x37')))),'outboundDropCallsDayTimeout'],[db[_0xe24f('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x38')))),_0xe24f('0x39')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db['sequelize']['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x3a')))),_0xe24f('0x3b')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x3c')))),_0xe24f('0x3d')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x3e')))),_0xe24f('0x3f')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')]('`state`\x20=\x2016,\x201,\x20null'))),_0xe24f('0x40')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db['sequelize']['fn']('IF',db[_0xe24f('0x1d')]['literal'](_0xe24f('0x41')))),'outboundRejectCallsDay'],[db[_0xe24f('0x1d')]['fn']('COUNT',db[_0xe24f('0x1d')]['fn']('IF',db['sequelize'][_0xe24f('0x1f')](_0xe24f('0x42')))),_0xe24f('0x43')]],'group':[_0xe24f('0x2d')]})['then'](function(_0x15c50e){logger[_0xe24f('0x13')](_0xe24f('0x44'),_0x4c9e11);logger[_0xe24f('0x29')]('GetVoiceQueueHopperHistory',_0x4c9e11,JSON[_0xe24f('0x1b')](_0x15c50e));_0x2ad868(_0x15c50e);})[_0xe24f('0x15')](function(_0x1e493a){logger[_0xe24f('0x10')](_0xe24f('0x44'),_0x1e493a['message'],_0x4c9e11);_0x2d39c3(_0x4c6d26['error'](0x1f4,_0x1e493a[_0xe24f('0x12')]));});});};exports[_0xe24f('0x45')]=function(_0x1e1f6a){var _0x44816e=this;return new Promise(function(_0x57b6bc,_0x325da2){return db['CmHopperHistory']['findAll']({'raw':_0x1e1f6a[_0xe24f('0x19')]?_0x1e1f6a[_0xe24f('0x19')][_0xe24f('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e1f6a['options']?_0x1e1f6a[_0xe24f('0x19')][_0xe24f('0x1c')]||null:null,'attributes':[[_0xe24f('0x2d'),_0xe24f('0x46')],[db['sequelize']['fn'](_0xe24f('0x24'),db['sequelize'][_0xe24f('0x47')]('id')),_0xe24f('0x48')],[db[_0xe24f('0x1d')]['fn']('COUNT',db[_0xe24f('0x1d')]['fn']('IF',db['sequelize'][_0xe24f('0x1f')](_0xe24f('0x20')))),'ivrAnswerCallsDay']],'group':[_0xe24f('0x2d')]})[_0xe24f('0xc')](function(_0x56911a){logger['info']('GetCampaignHopperHistory',_0x1e1f6a);logger['debug'](_0xe24f('0x45'),_0x1e1f6a,JSON['stringify'](_0x56911a));_0x57b6bc(_0x56911a);})['catch'](function(_0x3e6b80){logger[_0xe24f('0x10')](_0xe24f('0x45'),_0x3e6b80[_0xe24f('0x12')],_0x1e1f6a);_0x325da2(_0x44816e['error'](0x1f4,_0x3e6b80[_0xe24f('0x12')]));});});}; \ No newline at end of file +var _0xee11=['`state`\x20=\x2011,\x201,\x20null','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','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','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','debug','GetCampaignHopperHistory','campaign','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','CreateCmHopperHistory','CmHopperHistory','body','options','catch','AvgHandleTime','findAll','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout'];(function(_0x4e2fc9,_0x5e1f21){var _0x1c803b=function(_0xda0f05){while(--_0xda0f05){_0x4e2fc9['push'](_0x4e2fc9['shift']());}};_0x1c803b(++_0x5e1f21);}(_0xee11,0x146));var _0x1ee1=function(_0x92b4dc,_0x20f18a){_0x92b4dc=_0x92b4dc-0x0;var _0xe68d92=_0xee11[_0x92b4dc];return _0xe68d92;};'use strict';var _=require(_0x1ee1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1ee1('0x1'));var rs=require(_0x1ee1('0x2'));var fs=require('fs');var Redis=require(_0x1ee1('0x3'));var db=require(_0x1ee1('0x4'))['db'];var utils=require(_0x1ee1('0x5'));var logger=require(_0x1ee1('0x6'))(_0x1ee1('0x7'));var config=require(_0x1ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1ee1('0x9')][_0x1ee1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fdb3b,_0x289d4c,_0x356919){return new BPromise(function(_0x47f984,_0x48af4c){return client[_0x1ee1('0xb')](_0x3fdb3b,_0x356919)[_0x1ee1('0xc')](function(_0x5899ca){logger[_0x1ee1('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x289d4c,_0x1ee1('0xe'));logger['debug'](_0x1ee1('0xf'),_0x289d4c,_0x1ee1('0xe'),JSON[_0x1ee1('0x10')](_0x5899ca));if(_0x5899ca[_0x1ee1('0x11')]){if(_0x5899ca['error'][_0x1ee1('0x12')]===0x1f4){logger[_0x1ee1('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x289d4c,_0x5899ca[_0x1ee1('0x11')][_0x1ee1('0x13')]);return _0x48af4c(_0x5899ca[_0x1ee1('0x11')][_0x1ee1('0x13')]);}logger[_0x1ee1('0x11')](_0x1ee1('0x14'),_0x289d4c,_0x5899ca[_0x1ee1('0x11')][_0x1ee1('0x13')]);return _0x47f984(_0x5899ca[_0x1ee1('0x11')][_0x1ee1('0x13')]);}else{logger[_0x1ee1('0xd')](_0x1ee1('0x14'),_0x289d4c,_0x1ee1('0xe'));_0x47f984(_0x5899ca[_0x1ee1('0x15')]['message']);}})['catch'](function(_0x7ff856){logger[_0x1ee1('0x11')](_0x1ee1('0x14'),_0x289d4c,_0x7ff856);_0x48af4c(_0x7ff856);});});}exports[_0x1ee1('0x16')]=function(_0x1e18b9){var _0xff3d76=this;return new Promise(function(_0x55abff,_0x39229e){return db[_0x1ee1('0x17')]['create'](_0x1e18b9[_0x1ee1('0x18')],{'raw':_0x1e18b9[_0x1ee1('0x19')]?_0x1e18b9['options']['raw']===undefined?!![]:![]:!![]})[_0x1ee1('0xc')](function(_0x1b6cdf){logger[_0x1ee1('0xd')](_0x1ee1('0x16'),_0x1e18b9);logger['debug'](_0x1ee1('0x16'),_0x1e18b9,JSON[_0x1ee1('0x10')](_0x1b6cdf));_0x55abff(_0x1b6cdf);})[_0x1ee1('0x1a')](function(_0x5093ff){logger[_0x1ee1('0x11')](_0x1ee1('0x16'),_0x5093ff[_0x1ee1('0x13')],_0x1e18b9);_0x39229e(_0xff3d76[_0x1ee1('0x11')](0x1f4,_0x5093ff[_0x1ee1('0x13')]));});});};exports[_0x1ee1('0x1b')]=function(_0x55921f){var _0x1142fd=this;return new Promise(function(_0x5d1948,_0x4932cd){return db[_0x1ee1('0x17')][_0x1ee1('0x1c')]({'raw':_0x55921f['options']?_0x55921f[_0x1ee1('0x19')][_0x1ee1('0x1d')]===undefined?!![]:![]:!![],'where':_0x55921f[_0x1ee1('0x19')]?_0x55921f[_0x1ee1('0x19')][_0x1ee1('0x1e')]||null:null,'attributes':[[db[_0x1ee1('0x1f')]['fn']('COUNT',db[_0x1ee1('0x1f')][_0x1ee1('0x20')]('id')),_0x1ee1('0x21')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db['sequelize'][_0x1ee1('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x1ee1('0x24')],[db[_0x1ee1('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x25')))),_0x1ee1('0x26')],[db['sequelize']['fn']('COUNT',db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x1ee1('0x28'),db['sequelize']['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x1ee1('0x29')],[db['sequelize']['fn'](_0x1ee1('0x28'),db['sequelize']['fn']('IF',db[_0x1ee1('0x1f')]['literal'](_0x1ee1('0x2a')))),_0x1ee1('0x2b')]]})['then'](function(_0x4cc56e){logger[_0x1ee1('0xd')](_0x1ee1('0x1b'),_0x55921f);logger['debug'](_0x1ee1('0x1b'),_0x55921f,JSON[_0x1ee1('0x10')](_0x4cc56e));_0x5d1948(_0x4cc56e);})[_0x1ee1('0x1a')](function(_0x3d9e0a){logger[_0x1ee1('0x11')](_0x1ee1('0x1b'),_0x3d9e0a[_0x1ee1('0x13')],_0x55921f);_0x4932cd(_0x1142fd[_0x1ee1('0x11')](0x1f4,_0x3d9e0a[_0x1ee1('0x13')]));});});};exports[_0x1ee1('0x2c')]=function(_0x15232c){var _0x3a900c=this;return new Promise(function(_0x3f0449,_0x1e5775){return db[_0x1ee1('0x17')][_0x1ee1('0x1c')]({'raw':_0x15232c[_0x1ee1('0x19')]?_0x15232c[_0x1ee1('0x19')][_0x1ee1('0x1d')]===undefined?!![]:![]:!![],'where':_0x15232c[_0x1ee1('0x19')]?_0x15232c[_0x1ee1('0x19')][_0x1ee1('0x1e')]||null:null,'attributes':[['campaign',_0x1ee1('0x2d')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x2e')))),_0x1ee1('0x2f')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')]['literal'](_0x1ee1('0x30')))),_0x1ee1('0x31')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x1ee1('0x32')],[db[_0x1ee1('0x1f')]['fn']('COUNT',db[_0x1ee1('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1ee1('0x33')))),_0x1ee1('0x34')],[db['sequelize']['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x35')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x36')))),_0x1ee1('0x37')],[db[_0x1ee1('0x1f')]['fn']('COUNT',db[_0x1ee1('0x1f')]['fn']('IF',db['sequelize'][_0x1ee1('0x23')](_0x1ee1('0x38')))),_0x1ee1('0x39')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x3a')))),_0x1ee1('0x3b')],[db['sequelize']['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')]['literal'](_0x1ee1('0x3c')))),_0x1ee1('0x3d')],[db[_0x1ee1('0x1f')]['fn']('COUNT',db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x3e')))),'outboundOriginateFailureCallsDay'],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x1ee1('0x3f')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db['sequelize'][_0x1ee1('0x23')](_0x1ee1('0x40')))),'outboundAnswerAgiCallsDay'],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x41')))),'outboundRejectCallsDay'],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x42')))),'outboundReCallsDay']],'group':['campaign']})[_0x1ee1('0xc')](function(_0xe93945){logger['info']('GetVoiceQueueHopperHistory',_0x15232c);logger[_0x1ee1('0x43')](_0x1ee1('0x2c'),_0x15232c,JSON[_0x1ee1('0x10')](_0xe93945));_0x3f0449(_0xe93945);})['catch'](function(_0x3791de){logger[_0x1ee1('0x11')](_0x1ee1('0x2c'),_0x3791de[_0x1ee1('0x13')],_0x15232c);_0x1e5775(_0x3a900c[_0x1ee1('0x11')](0x1f4,_0x3791de[_0x1ee1('0x13')]));});});};exports[_0x1ee1('0x44')]=function(_0x37f960){var _0x51a643=this;return new Promise(function(_0x5855e9,_0x28dc90){return db['CmHopperHistory']['findAll']({'raw':_0x37f960[_0x1ee1('0x19')]?_0x37f960['options']['raw']===undefined?!![]:![]:!![],'where':_0x37f960[_0x1ee1('0x19')]?_0x37f960[_0x1ee1('0x19')]['where']||null:null,'attributes':[[_0x1ee1('0x45'),'name'],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db['sequelize'][_0x1ee1('0x20')]('id')),_0x1ee1('0x46')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x47')))),_0x1ee1('0x48')]],'group':[_0x1ee1('0x45')]})[_0x1ee1('0xc')](function(_0x3f5d6b){logger['info'](_0x1ee1('0x44'),_0x37f960);logger[_0x1ee1('0x43')]('GetCampaignHopperHistory',_0x37f960,JSON['stringify'](_0x3f5d6b));_0x5855e9(_0x3f5d6b);})[_0x1ee1('0x1a')](function(_0x2bde09){logger['error'](_0x1ee1('0x44'),_0x2bde09['message'],_0x37f960);_0x28dc90(_0x51a643[_0x1ee1('0x11')](0x1f4,_0x2bde09[_0x1ee1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index dc6b87e..33db07f 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 _0x3935=['express','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','create','update','multer','util','connect-timeout'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0x3935,0x66));var _0x5393=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0x3935[_0x539533];return _0x3942f3;};'use strict';var multer=require(_0x5393('0x0'));var util=require(_0x5393('0x1'));var path=require('path');var timeout=require(_0x5393('0x2'));var express=require(_0x5393('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5393('0x4'));var config=require(_0x5393('0x5'));var controller=require(_0x5393('0x6'));router[_0x5393('0x7')]('/',auth[_0x5393('0x8')](),controller['index']);router[_0x5393('0x7')](_0x5393('0x9'),auth['isAuthenticated'](),controller[_0x5393('0xa')]);router[_0x5393('0x7')](_0x5393('0xb'),auth['isAuthenticated'](),controller[_0x5393('0xc')]);router['post']('/',auth[_0x5393('0x8')](),controller[_0x5393('0xd')]);router['put'](_0x5393('0xb'),auth[_0x5393('0x8')](),controller[_0x5393('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd77a=['/describe','describe','/:id','show','post','create','put','update','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0x3b78e0,_0x57d297){var _0x4cdbac=function(_0x5236bc){while(--_0x5236bc){_0x3b78e0['push'](_0x3b78e0['shift']());}};_0x4cdbac(++_0x57d297);}(_0xd77a,0x10d));var _0xad77=function(_0x22f351,_0x13a411){_0x22f351=_0x22f351-0x0;var _0x29e7ae=_0xd77a[_0x22f351];return _0x29e7ae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xad77('0x0'));var timeout=require('connect-timeout');var express=require(_0xad77('0x1'));var router=express[_0xad77('0x2')]();var fs_extra=require(_0xad77('0x3'));var auth=require(_0xad77('0x4'));var interaction=require(_0xad77('0x5'));var config=require(_0xad77('0x6'));var controller=require(_0xad77('0x7'));router[_0xad77('0x8')]('/',auth[_0xad77('0x9')](),controller[_0xad77('0xa')]);router['get'](_0xad77('0xb'),auth[_0xad77('0x9')](),controller[_0xad77('0xc')]);router[_0xad77('0x8')](_0xad77('0xd'),auth[_0xad77('0x9')](),controller[_0xad77('0xe')]);router[_0xad77('0xf')]('/',auth[_0xad77('0x9')](),controller[_0xad77('0x10')]);router[_0xad77('0x11')](_0xad77('0xd'),auth[_0xad77('0x9')](),controller[_0xad77('0x12')]);module[_0xad77('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 9c634f1..1235148 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 _0xdefc=['sequelize','exports','STRING'];(function(_0x1b1f88,_0x3fe1cb){var _0x5045b9=function(_0x5c1367){while(--_0x5c1367){_0x1b1f88['push'](_0x1b1f88['shift']());}};_0x5045b9(++_0x3fe1cb);}(_0xdefc,0x1b3));var _0xcdef=function(_0x503699,_0x152145){_0x503699=_0x503699-0x0;var _0xd66c82=_0xdefc[_0x503699];return _0xd66c82;};'use strict';var Sequelize=require(_0xcdef('0x0'));module[_0xcdef('0x1')]={'name':{'type':Sequelize[_0xcdef('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xcdef('0x2')]}}; \ No newline at end of file +var _0x308a=['STRING','name','sequelize'];(function(_0x5e8993,_0xac2caf){var _0x25ba30=function(_0x471aeb){while(--_0x471aeb){_0x5e8993['push'](_0x5e8993['shift']());}};_0x25ba30(++_0xac2caf);}(_0x308a,0x71));var _0xa308=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x308a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa308('0x0'));module['exports']={'name':{'type':Sequelize[_0xa308('0x1')],'unique':_0xa308('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa308('0x1')]},'dialPrefix':{'type':Sequelize[_0xa308('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 584c208..6d034f9 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 _0x3399=['rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','Lists','UserProfileResource','end','error','stack','name','send','index','CmList','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addContacts','tags','isArray','push','CmContact','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','each','isEmpty','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','removeAgents','userCmList:remove','emit','getAgents','info','eml-format'];(function(_0x45bab4,_0x344a83){var _0xcf0db0=function(_0x554beb){while(--_0x554beb){_0x45bab4['push'](_0x45bab4['shift']());}};_0xcf0db0(++_0x344a83);}(_0x3399,0x13f));var _0x9339=function(_0x3253e3,_0x19d384){_0x3253e3=_0x3253e3-0x0;var _0x10ca3e=_0x3399[_0x3253e3];return _0x10ca3e;};'use strict';var emlformat=require(_0x9339('0x0'));var rimraf=require(_0x9339('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9339('0x2'));var rp=require('request-promise');var moment=require(_0x9339('0x3'));var BPromise=require(_0x9339('0x4'));var Mustache=require(_0x9339('0x5'));var util=require('util');var path=require(_0x9339('0x6'));var sox=require(_0x9339('0x7'));var csv=require(_0x9339('0x8'));var ejs=require(_0x9339('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9339('0xa'));var squel=require(_0x9339('0xb'));var crypto=require(_0x9339('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9339('0x8'));var querystring=require(_0x9339('0xd'));var Papa=require(_0x9339('0xe'));var Redis=require('ioredis');var authService=require(_0x9339('0xf'));var qs=require(_0x9339('0x10'));var as=require(_0x9339('0x11'));var hardwareService=require(_0x9339('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9339('0x13'));var config=require(_0x9339('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9339('0x15'))['db'];var csv_results;config[_0x9339('0x16')]=_[_0x9339('0x17')](config[_0x9339('0x16')],{'host':_0x9339('0x18'),'port':0x18eb});var socket=require(_0x9339('0x19'))(new Redis(config[_0x9339('0x16')]));require(_0x9339('0x1a'))[_0x9339('0x1b')](socket);function respondWithStatusCode(_0x4a10d9,_0x5a80cb){_0x5a80cb=_0x5a80cb||0xcc;return function(_0x118909){if(_0x118909){return _0x4a10d9[_0x9339('0x1c')](_0x5a80cb);}return _0x4a10d9['status'](_0x5a80cb)['end']();};}function respondWithResult(_0x39f5e2,_0x50817f){_0x50817f=_0x50817f||0xc8;return function(_0x1bda9f){if(_0x1bda9f){return _0x39f5e2[_0x9339('0x1d')](_0x50817f)[_0x9339('0x1e')](_0x1bda9f);}};}function respondWithFilteredResult(_0x1a7136,_0x27f3ac){return function(_0x4da6ee){if(_0x4da6ee){var _0x4911dc=typeof _0x27f3ac[_0x9339('0x1f')]===_0x9339('0x20')&&typeof _0x27f3ac[_0x9339('0x21')]===_0x9339('0x20');var _0x1b4dc3=_0x4da6ee[_0x9339('0x22')];var _0x4d4182=_0x4911dc?0x0:_0x27f3ac[_0x9339('0x1f')];var _0x20b180=_0x4911dc?_0x4da6ee[_0x9339('0x22')]:_0x27f3ac[_0x9339('0x1f')]+_0x27f3ac[_0x9339('0x21')];var _0x6997e1;if(_0x20b180>=_0x1b4dc3){_0x20b180=_0x1b4dc3;_0x6997e1=0xc8;}else{_0x6997e1=0xce;}_0x1a7136['status'](_0x6997e1);return _0x1a7136['set'](_0x9339('0x23'),_0x4d4182+'-'+_0x20b180+'/'+_0x1b4dc3)['json'](_0x4da6ee);}return null;};}function patchUpdates(_0x15a59b){return function(_0x3f5154){try{jsonpatch[_0x9339('0x24')](_0x3f5154,_0x15a59b,!![]);}catch(_0x190e22){return BPromise[_0x9339('0x25')](_0x190e22);}return _0x3f5154['save']();};}function saveUpdates(_0x4c8914,_0x1dfcac){return function(_0x13326b){if(_0x13326b){return _0x13326b[_0x9339('0x26')](_0x4c8914)[_0x9339('0x27')](function(_0x172771){return _0x172771;});}return null;};}function removeEntity(_0x36780d,_0x23aa65){return function(_0x169dda){if(_0x169dda){return _0x169dda[_0x9339('0x28')]()[_0x9339('0x27')](function(){var _0x552472=_0x169dda['get']({'plain':!![]});var _0x10dc94=_0x9339('0x29');return db[_0x9339('0x2a')][_0x9339('0x28')]({'where':{'type':_0x10dc94,'resourceId':_0x552472['id']}})['then'](function(){return _0x169dda;});})[_0x9339('0x27')](function(){_0x36780d[_0x9339('0x1d')](0xcc)[_0x9339('0x2b')]();});}};}function handleEntityNotFound(_0x26d9d9,_0x384110){return function(_0x4b2167){if(!_0x4b2167){_0x26d9d9[_0x9339('0x1c')](0x194);}return _0x4b2167;};}function handleError(_0x19d71d,_0x185372){_0x185372=_0x185372||0x1f4;return function(_0x372eb7){logger[_0x9339('0x2c')](_0x372eb7[_0x9339('0x2d')]);if(_0x372eb7[_0x9339('0x2e')]){delete _0x372eb7[_0x9339('0x2e')];}_0x19d71d['status'](_0x185372)[_0x9339('0x2f')](_0x372eb7);};}exports[_0x9339('0x30')]=function(_0x3a772d,_0x4459f4){var _0x309088={},_0x1ddab7={},_0x5f5624={'count':0x0,'rows':[]};var _0x3ad536=_['map'](db[_0x9339('0x31')][_0x9339('0x32')],function(_0xaff427){return{'name':_0xaff427['fieldName'],'type':_0xaff427['type'][_0x9339('0x33')]};});_0x1ddab7[_0x9339('0x34')]=_[_0x9339('0x35')](_0x3ad536,_0x9339('0x2e'));_0x1ddab7[_0x9339('0x36')]=_[_0x9339('0x37')](_0x3a772d[_0x9339('0x36')]);_0x1ddab7['filters']=_[_0x9339('0x38')](_0x1ddab7[_0x9339('0x34')],_0x1ddab7['query']);_0x309088[_0x9339('0x39')]=_['intersection'](_0x1ddab7[_0x9339('0x34')],qs[_0x9339('0x3a')](_0x3a772d[_0x9339('0x36')]['fields']));_0x309088[_0x9339('0x39')]=_0x309088['attributes'][_0x9339('0x3b')]?_0x309088['attributes']:_0x1ddab7[_0x9339('0x34')];if(!_0x3a772d[_0x9339('0x36')][_0x9339('0x3c')]('nolimit')){_0x309088[_0x9339('0x21')]=qs['limit'](_0x3a772d[_0x9339('0x36')][_0x9339('0x21')]);_0x309088[_0x9339('0x1f')]=qs[_0x9339('0x1f')](_0x3a772d[_0x9339('0x36')]['offset']);}_0x309088[_0x9339('0x3d')]=qs['sort'](_0x3a772d[_0x9339('0x36')][_0x9339('0x3e')]);_0x309088[_0x9339('0x3f')]=qs[_0x9339('0x40')](_['pick'](_0x3a772d['query'],_0x1ddab7[_0x9339('0x40')]),_0x3ad536);if(_0x3a772d[_0x9339('0x36')][_0x9339('0x41')]){_0x309088['where']=_[_0x9339('0x42')](_0x309088['where'],{'$or':_[_0x9339('0x35')](_0x3ad536,function(_0x216217){if(_0x216217[_0x9339('0x43')]!=='VIRTUAL'){var _0x4d369c={};_0x4d369c[_0x216217[_0x9339('0x2e')]]={'$like':'%'+_0x3a772d['query'][_0x9339('0x41')]+'%'};return _0x4d369c;}})});}_0x309088=_[_0x9339('0x42')]({},_0x309088,_0x3a772d[_0x9339('0x44')]);var _0x49bb65={'where':_0x309088[_0x9339('0x3f')]};return db[_0x9339('0x31')]['count'](_0x49bb65)[_0x9339('0x27')](function(_0x26b76d){_0x5f5624[_0x9339('0x22')]=_0x26b76d;if(_0x3a772d['query'][_0x9339('0x45')]){_0x309088[_0x9339('0x46')]=[{'all':!![]}];}return db[_0x9339('0x31')][_0x9339('0x47')](_0x309088);})[_0x9339('0x27')](function(_0x45f19f){_0x5f5624[_0x9339('0x48')]=_0x45f19f;return _0x5f5624;})[_0x9339('0x27')](respondWithFilteredResult(_0x4459f4,_0x309088))[_0x9339('0x49')](handleError(_0x4459f4,null));};exports[_0x9339('0x4a')]=function(_0x27c75f,_0x3294a9){var _0x482b32={'raw':![],'where':{'id':_0x27c75f[_0x9339('0x4b')]['id']}},_0x55e11b={};_0x55e11b[_0x9339('0x34')]=_[_0x9339('0x37')](db[_0x9339('0x31')][_0x9339('0x32')]);_0x55e11b[_0x9339('0x36')]=_[_0x9339('0x37')](_0x27c75f['query']);_0x55e11b[_0x9339('0x40')]=_[_0x9339('0x38')](_0x55e11b[_0x9339('0x34')],_0x55e11b[_0x9339('0x36')]);_0x482b32['attributes']=_['intersection'](_0x55e11b[_0x9339('0x34')],qs[_0x9339('0x3a')](_0x27c75f[_0x9339('0x36')]['fields']));_0x482b32[_0x9339('0x39')]=_0x482b32['attributes'][_0x9339('0x3b')]?_0x482b32[_0x9339('0x39')]:_0x55e11b[_0x9339('0x34')];if(_0x27c75f[_0x9339('0x36')]['includeAll']){_0x482b32[_0x9339('0x46')]=[{'all':!![]}];}_0x482b32=_['merge']({},_0x482b32,_0x27c75f[_0x9339('0x44')]);return db[_0x9339('0x31')]['find'](_0x482b32)[_0x9339('0x27')](handleEntityNotFound(_0x3294a9,null))[_0x9339('0x27')](respondWithResult(_0x3294a9,null))[_0x9339('0x49')](handleError(_0x3294a9,null));};exports[_0x9339('0x4c')]=function(_0x5ed621,_0x49fb83){return db[_0x9339('0x31')]['create'](_0x5ed621['body'],{})[_0x9339('0x27')](function(_0x3901ed){var _0x45194a=_0x5ed621[_0x9339('0x4d')][_0x9339('0x4e')]({'plain':!![]});if(!_0x45194a)throw new Error(_0x9339('0x4f'));if(_0x45194a[_0x9339('0x50')]===_0x9339('0x4d')){var _0x57d654=_0x3901ed['get']({'plain':!![]});var _0x2771f1=_0x9339('0x29');return db[_0x9339('0x51')][_0x9339('0x52')]({'where':{'name':_0x2771f1,'userProfileId':_0x45194a[_0x9339('0x53')]},'raw':!![]})[_0x9339('0x27')](function(_0x4c9737){if(_0x4c9737&&_0x4c9737['autoAssociation']===0x0){return db[_0x9339('0x2a')][_0x9339('0x4c')]({'name':_0x57d654[_0x9339('0x2e')],'resourceId':_0x57d654['id'],'type':_0x4c9737[_0x9339('0x2e')],'sectionId':_0x4c9737['id']},{})[_0x9339('0x27')](function(){return _0x3901ed;});}else{return _0x3901ed;}})[_0x9339('0x49')](function(_0x2afc6b){logger['error'](_0x9339('0x54'),_0x2afc6b);throw _0x2afc6b;});}return _0x3901ed;})[_0x9339('0x27')](respondWithResult(_0x49fb83,0xc9))['catch'](handleError(_0x49fb83,null));};exports[_0x9339('0x26')]=function(_0x154ea1,_0x300e3b){if(_0x154ea1[_0x9339('0x55')]['id']){delete _0x154ea1['body']['id'];}return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x154ea1[_0x9339('0x4b')]['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x300e3b,null))[_0x9339('0x27')](saveUpdates(_0x154ea1['body'],null))['then'](respondWithResult(_0x300e3b,null))[_0x9339('0x49')](handleError(_0x300e3b,null));};exports[_0x9339('0x28')]=function(_0x173730,_0x2ec90c){return db['CmList'][_0x9339('0x52')]({'where':{'id':_0x173730['params']['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x2ec90c,null))['then'](removeEntity(_0x2ec90c,null))['catch'](handleError(_0x2ec90c,null));};exports['describe']=function(_0x287b7a,_0x296f36){return db['CmList']['describe']()[_0x9339('0x27')](respondWithResult(_0x296f36,null))[_0x9339('0x49')](handleError(_0x296f36,null));};exports[_0x9339('0x56')]=function(_0x48f052,_0x5c3245,_0x4633da){if(_0x48f052[_0x9339('0x55')]['id']){delete _0x48f052[_0x9339('0x55')]['id'];}return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x48f052['params']['id']}})['then'](handleEntityNotFound(_0x5c3245,null))[_0x9339('0x27')](function(_0x4929bf){if(_0x4929bf){_0x48f052[_0x9339('0x55')][_0x9339('0x57')]=_0x4929bf['id'];return db[_0x9339('0x58')]['create'](_0x48f052['body']);}})[_0x9339('0x27')](respondWithResult(_0x5c3245,null))[_0x9339('0x49')](handleError(_0x5c3245,null));};exports[_0x9339('0x59')]=function(_0x207bbb,_0x5b18bd,_0x22a048){var _0x110e55={'raw':![],'where':{}};var _0x59d03c={};var _0x2a8c20={'count':0x0,'rows':[]};return db['CmList'][_0x9339('0x5a')]({'where':{'id':_0x207bbb[_0x9339('0x4b')]['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x5b18bd,null))['then'](function(_0x549e1b){if(_0x549e1b){_0x59d03c[_0x9339('0x34')]=_[_0x9339('0x37')](db[_0x9339('0x58')][_0x9339('0x32')]);_0x59d03c[_0x9339('0x36')]=_[_0x9339('0x37')](_0x207bbb[_0x9339('0x36')]);_0x59d03c[_0x9339('0x40')]=_[_0x9339('0x38')](_0x59d03c['model'],_0x59d03c[_0x9339('0x36')]);_0x110e55['attributes']=_['intersection'](_0x59d03c['model'],qs[_0x9339('0x3a')](_0x207bbb[_0x9339('0x36')][_0x9339('0x3a')]));_0x110e55[_0x9339('0x39')]=_0x110e55[_0x9339('0x39')][_0x9339('0x3b')]?_0x110e55[_0x9339('0x39')]:_0x59d03c[_0x9339('0x34')];if(!_0x207bbb[_0x9339('0x36')][_0x9339('0x3c')](_0x9339('0x5b'))){_0x110e55[_0x9339('0x21')]=qs[_0x9339('0x21')](_0x207bbb[_0x9339('0x36')][_0x9339('0x21')]);_0x110e55[_0x9339('0x1f')]=qs[_0x9339('0x1f')](_0x207bbb[_0x9339('0x36')]['offset']);}_0x110e55[_0x9339('0x3d')]=qs[_0x9339('0x3e')](_0x207bbb[_0x9339('0x36')][_0x9339('0x3e')]);_0x110e55['where']=qs[_0x9339('0x40')](_[_0x9339('0x5c')](_0x207bbb[_0x9339('0x36')],_0x59d03c['filters']));_0x110e55[_0x9339('0x3f')]['ListId']=_0x549e1b['id'];if(_0x207bbb[_0x9339('0x36')][_0x9339('0x41')]){_0x110e55[_0x9339('0x3f')]=_[_0x9339('0x42')](_0x110e55[_0x9339('0x3f')],{'$or':_[_0x9339('0x35')](_0x110e55[_0x9339('0x39')],function(_0x23632b){var _0x7d8066={};_0x7d8066[_0x23632b]={'$like':'%'+_0x207bbb[_0x9339('0x36')][_0x9339('0x41')]+'%'};return _0x7d8066;})});}_0x110e55=_['merge']({},_0x110e55,_0x207bbb[_0x9339('0x44')]);return db[_0x9339('0x58')][_0x9339('0x22')]({'where':_0x110e55[_0x9339('0x3f')]})[_0x9339('0x27')](function(_0x3b5bf5){_0x2a8c20[_0x9339('0x22')]=_0x3b5bf5;if(_0x207bbb[_0x9339('0x36')][_0x9339('0x45')]){_0x110e55[_0x9339('0x46')]=[{'all':!![]}];}return db[_0x9339('0x58')][_0x9339('0x47')](_0x110e55);})[_0x9339('0x27')](function(_0x45b232){_0x2a8c20[_0x9339('0x48')]=_0x45b232;return _0x2a8c20;});}})[_0x9339('0x27')](respondWithFilteredResult(_0x5b18bd,_0x110e55))['catch'](handleError(_0x5b18bd,null));};exports[_0x9339('0x5d')]=function(_0x3adee8,_0x3fdb6b,_0x1aca94){return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x3adee8[_0x9339('0x4b')]['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x3fdb6b,null))['then'](function(_0x2d68a1){if(_0x2d68a1){return _0x2d68a1[_0x9339('0x5d')](_0x3adee8[_0x9339('0x36')][_0x9339('0x5e')]);}})[_0x9339('0x27')](respondWithStatusCode(_0x3fdb6b,null))[_0x9339('0x49')](handleError(_0x3fdb6b,null));};exports[_0x9339('0x5f')]=function(_0x146ce6,_0x5de879,_0x58743c){return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x146ce6[_0x9339('0x4b')]['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x5de879,null))['then'](function(_0x3746bb){if(_0x3746bb){var _0x380db2=[];var _0x25ffab={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x9339('0x27')](function(_0x3ea1ab){if(_0x146ce6[_0x9339('0x55')][_0x9339('0x60')]&&_[_0x9339('0x61')](_0x146ce6[_0x9339('0x55')][_0x9339('0x60')])){if(_0x146ce6['body'][_0x9339('0x60')][_0x9339('0x3b')]){_0x146ce6[_0x9339('0x55')][_0x9339('0x60')]=_0x146ce6[_0x9339('0x55')][_0x9339('0x60')]['join'](';')+';';}else{_0x146ce6[_0x9339('0x55')]['tags']=null;}}else{_0x146ce6[_0x9339('0x55')][_0x9339('0x60')]=null;}if(_0x146ce6[_0x9339('0x55')]&&_[_0x9339('0x61')](_0x146ce6[_0x9339('0x55')])){for(var _0x80e455=0x0;_0x80e455<_0x146ce6[_0x9339('0x55')][_0x9339('0x3b')];_0x80e455+=0x1){_0x146ce6[_0x9339('0x55')][_0x80e455][_0x9339('0x57')]=_0x146ce6[_0x9339('0x4b')]['id'];_0x380db2[_0x9339('0x62')](_0x146ce6['body'][_0x80e455]);}return BPromise['each'](_0x380db2,function(_0xfe2e5d){return db[_0x9339('0x63')][_0x9339('0x4c')](_[_0x9339('0x64')](_0xfe2e5d,[_0x9339('0x5e'),'id'])||{},{'fields':_['keys'](_0x3ea1ab),'raw':!![]})[_0x9339('0x27')](function(_0x19a1f9){_0x25ffab[_0x9339('0x65')]['push'](_0x19a1f9[_0x9339('0x66')]);})['catch'](function(_0x4b1aba){_0x25ffab[_0x9339('0x67')]['push']({'data':_0xfe2e5d,'error':_0x4b1aba[_0x9339('0x68')]});});})['then'](function(_0x2b5584){return _0x25ffab;})[_0x9339('0x49')](function(_0x44059d){return _0x44059d;});}else{_0x5de879['status'](0x190)[_0x9339('0x1e')]({'message':_0x9339('0x69')});}});}})['then'](respondWithResult(_0x5de879,null))['catch'](handleError(_0x5de879,null));};exports[_0x9339('0x6a')]=function(_0x2e584b,_0x1a4ec3,_0xa8038e){var _0x3ef8e9;return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x2e584b[_0x9339('0x4b')]['id']},'include':[{'model':db[_0x9339('0x6b')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x1a4ec3,null))[_0x9339('0x27')](function(_0x4e12f2){if(_0x4e12f2){_0x3ef8e9=_0x4e12f2;return db[_0x9339('0x63')][_0x9339('0x32')];}})['then'](function(_0x47a12c){if(_0x47a12c){var _0x348f79={};var _0x575851={};_0x575851[_0x9339('0x34')]=_[_0x9339('0x6c')](_[_0x9339('0x37')](_0x47a12c),_[_0x9339('0x35')](_0x3ef8e9[_0x9339('0x6d')],function(_0x2a35b9){return util[_0x9339('0x6e')](_0x9339('0x6f'),_0x2a35b9['id']);}));_0x575851['query']=_[_0x9339('0x37')](_0x2e584b['query']);_0x575851[_0x9339('0x40')]=_[_0x9339('0x38')](_0x575851[_0x9339('0x34')],_0x575851[_0x9339('0x36')]);_0x348f79[_0x9339('0x39')]=_['intersection'](_0x575851[_0x9339('0x34')],qs[_0x9339('0x3a')](_0x2e584b[_0x9339('0x36')][_0x9339('0x3a')]));_0x348f79[_0x9339('0x39')]=_0x348f79[_0x9339('0x39')][_0x9339('0x3b')]?_0x348f79['attributes']:_0x575851[_0x9339('0x34')];if(!_0x2e584b['query'][_0x9339('0x3c')](_0x9339('0x5b'))){_0x348f79['limit']=qs['limit'](_0x2e584b[_0x9339('0x36')][_0x9339('0x21')]);_0x348f79[_0x9339('0x1f')]=qs['offset'](_0x2e584b[_0x9339('0x36')]['offset']);}_0x348f79[_0x9339('0x3d')]=qs[_0x9339('0x3e')](_0x2e584b[_0x9339('0x36')][_0x9339('0x3e')]);_0x348f79['where']=qs[_0x9339('0x40')](_[_0x9339('0x5c')](_0x2e584b['query'],_0x575851[_0x9339('0x40')]));_0x348f79[_0x9339('0x70')]=!![];if(_0x2e584b[_0x9339('0x36')][_0x9339('0x41')]){_0x348f79[_0x9339('0x3f')]=_[_0x9339('0x42')](_0x348f79[_0x9339('0x3f')],{'$or':_[_0x9339('0x35')](_0x348f79['attributes'],function(_0x3724d9){var _0x51d2e2={};_0x51d2e2[_0x3724d9]={'$like':'%'+_0x2e584b[_0x9339('0x36')]['filter']+'%'};return _0x51d2e2;})});}_0x348f79=_[_0x9339('0x42')]({},_0x348f79,_0x2e584b[_0x9339('0x44')]);return _0x3ef8e9[_0x9339('0x6a')](_0x348f79);}})[_0x9339('0x27')](respondWithResult(_0x1a4ec3,null))['catch'](handleError(_0x1a4ec3,null));};exports[_0x9339('0x71')]=function(_0xb6c22b,_0x2ab2c3,_0xa05abc){var _0x1278a5;var _0x3c40e9;var _0x27dfdb;var _0x442511=_0xb6c22b[_0x9339('0x4b')]['id'];csv_results=[];return db[_0x9339('0x72')]['findAll']({'attributes':['id',_0x9339('0x2e')],'raw':!![],'order':[_0x9339('0x73')]})[_0x9339('0x27')](function(_0x48687a){_0x1278a5=_0x48687a;var _0x28f77f=_['keys'](db['CmContact'][_0x9339('0x32')]);return db[_0x9339('0x6b')]['findAll']({'raw':!![],'attributes':['id',_0x9339('0x74')]})[_0x9339('0x27')](function(_0x3c3f64){_0x3c40e9=_0x3c3f64;var _0x5c341f=squel[_0x9339('0x75')]()[_0x9339('0x3a')](_0x28f77f)[_0x9339('0x76')](_0x9339('0x77'),'c')[_0x9339('0x3f')](_0x9339('0x78'),_0x442511)[_0x9339('0x3f')](_0x9339('0x79'))['distinct']();for(var _0x4bc2f3=0x0;_0x4bc2f3<_0x3c40e9[_0x9339('0x3b')];_0x4bc2f3++){_0x5c341f[_0x9339('0x7a')](_0x9339('0x7b')+_0x3c40e9[_0x4bc2f3]['id'],_0x9339('0x7c')+_0x3c40e9[_0x4bc2f3]['alias']);}for(var _0x4bc2f3=0x0;_0x4bc2f3<_0x1278a5[_0x9339('0x3b')];_0x4bc2f3++){_0x5c341f[_0x9339('0x7a')](squel[_0x9339('0x75')]()[_0x9339('0x7a')](_0x9339('0x7d'))[_0x9339('0x76')](_0x9339('0x7e'))[_0x9339('0x3f')](_0x9339('0x7f'),_0x1278a5[_0x4bc2f3]['id'])['where']('CmContactId\x20=\x20c.id'),_0x9339('0x80')+_0x1278a5[_0x4bc2f3]['name']);_0x5c341f[_0x9339('0x7a')](squel[_0x9339('0x75')]()[_0x9339('0x7a')](_0x9339('0x81'))[_0x9339('0x76')](_0x9339('0x7e'))['where'](_0x9339('0x7f'),_0x1278a5[_0x4bc2f3]['id'])[_0x9339('0x3f')](_0x9339('0x82')),'description_additionalPhone_'+_0x1278a5[_0x4bc2f3][_0x9339('0x2e')]);}var _0xe3c3e5=[];_0xe3c3e5[_0x9339('0x62')](_0x5c341f['toString']());BPromise[_0x9339('0x83')](_0xe3c3e5,handleQuery)['then'](function(_0x4da7ec){handleQuery(_0x5c341f['toString']());var _0x1dfea9=csv_results[0x0];if(!_[_0x9339('0x84')](_0x1dfea9)){var _0x168b89=toCsv(_0x1dfea9);var _0x9acb80=Date['now']();fs['writeFileSync'](util[_0x9339('0x6e')](_0x9339('0x85'),_0x442511,_0x9acb80),_0x168b89);_0x2ab2c3[_0x9339('0x86')]('Content-disposition',_0x9339('0x87')+util[_0x9339('0x6e')](_0x9339('0x88'),_0x442511,_0x9acb80));_0x2ab2c3[_0x9339('0x86')](_0x9339('0x89'),'text/csv');return _0x2ab2c3[_0x9339('0x8a')](util[_0x9339('0x6e')](_0x9339('0x85'),_0x442511,_0x9acb80));}else{return _0x2ab2c3[_0x9339('0x1c')](0xcc);}});});});};exports[_0x9339('0x8b')]=function(_0x366b06,_0x286373,_0x110374){var _0x133c53;delete _0x366b06['body']['id'];return db[_0x9339('0x31')]['findOne']({'where':{'id':_0x366b06[_0x9339('0x4b')]['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x286373,null))[_0x9339('0x27')](function(_0x487f44){if(_0x487f44){return db[_0x9339('0x8c')][_0x9339('0x8d')](function(_0x492fa0){return db[_0x9339('0x6b')][_0x9339('0x4c')](_0x366b06['body'],{'transaction':_0x492fa0})[_0x9339('0x27')](function(_0x30c9fc){_0x133c53=_0x30c9fc;return _0x487f44[_0x9339('0x8e')](_0x30c9fc,{'transaction':_0x492fa0});})[_0x9339('0x27')](function(){var _0x20087b={'type':db[_0x9339('0x8f')]['TEXT'],'transaction':_0x492fa0};switch(_0x366b06[_0x9339('0x55')][_0x9339('0x43')]){case _0x9339('0x90'):_0x20087b[_0x9339('0x43')]=db[_0x9339('0x8f')]['TEXT'];break;case'number':_0x20087b[_0x9339('0x43')]=db[_0x9339('0x8f')][_0x9339('0x91')];break;case _0x9339('0x92'):_0x20087b[_0x9339('0x43')]=db[_0x9339('0x8f')]['BOOLEAN'];_0x20087b[_0x9339('0x93')]=![];break;default:}return db['sequelize'][_0x9339('0x94')][_0x9339('0x95')](_0x9339('0x77'),util[_0x9339('0x6e')](_0x9339('0x96'),_0x133c53['id']),_0x20087b);})[_0x9339('0x27')](function(){return _0x133c53;});});}})['then'](respondWithResult(_0x286373,null))[_0x9339('0x49')](handleError(_0x286373,null));};exports[_0x9339('0x97')]=function(_0x50d3f6,_0x39954f,_0x35fc88){var _0x22272d={};var _0x126205={};var _0x2a2530;var _0x2a92db;return db[_0x9339('0x31')][_0x9339('0x5a')]({'where':{'id':_0x50d3f6['params']['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x39954f,null))['then'](function(_0x3b48a5){if(_0x3b48a5){_0x2a2530=_0x3b48a5;_0x126205[_0x9339('0x34')]=_['keys'](db['CmCustomField'][_0x9339('0x32')]);_0x126205[_0x9339('0x36')]=_['keys'](_0x50d3f6[_0x9339('0x36')]);_0x126205[_0x9339('0x40')]=_[_0x9339('0x38')](_0x126205[_0x9339('0x34')],_0x126205['query']);_0x22272d['attributes']=_[_0x9339('0x38')](_0x126205[_0x9339('0x34')],qs['fields'](_0x50d3f6[_0x9339('0x36')][_0x9339('0x3a')]));_0x22272d['attributes']=_0x22272d[_0x9339('0x39')][_0x9339('0x3b')]?_0x22272d[_0x9339('0x39')]:_0x126205[_0x9339('0x34')];_0x22272d['order']=qs[_0x9339('0x3e')](_0x50d3f6['query']['sort']);_0x22272d[_0x9339('0x3f')]=qs[_0x9339('0x40')](_[_0x9339('0x5c')](_0x50d3f6['query'],_0x126205[_0x9339('0x40')]));_0x22272d[_0x9339('0x3f')]=_[_0x9339('0x42')](_0x22272d[_0x9339('0x3f')],{'$or':[{'ListId':_0x3b48a5['id']},{'ListId':null}]});if(_0x50d3f6[_0x9339('0x36')][_0x9339('0x41')]){_0x22272d[_0x9339('0x3f')]=_[_0x9339('0x42')](_0x22272d[_0x9339('0x3f')],{'$or':_['map'](_0x22272d[_0x9339('0x39')],function(_0x4cc946){var _0x31fa73={};_0x31fa73[_0x4cc946]={'$like':'%'+_0x50d3f6[_0x9339('0x36')][_0x9339('0x41')]+'%'};return _0x31fa73;})});}_0x22272d=_[_0x9339('0x42')]({},_0x22272d,_0x50d3f6[_0x9339('0x44')]);return db[_0x9339('0x6b')][_0x9339('0x98')](_0x22272d);}})[_0x9339('0x27')](respondWithResult(_0x39954f,null))[_0x9339('0x49')](handleError(_0x39954f,null));};exports[_0x9339('0x99')]=function(_0x52588a,_0xcb3fbd){return db[_0x9339('0x6b')]['findAndCountAll']({'where':{'ListId':null}})[_0x9339('0x27')](handleEntityNotFound(_0xcb3fbd,null))[_0x9339('0x27')](function(_0x48dfbd){return _0x48dfbd;})['then'](respondWithResult(_0xcb3fbd,null))[_0x9339('0x49')](handleError(_0xcb3fbd,null));};exports[_0x9339('0x9a')]=function(_0x497717,_0x20d816,_0x154e19){return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x497717[_0x9339('0x4b')]['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x20d816,null))[_0x9339('0x27')](function(_0x4c460e){if(_0x4c460e){return _0x4c460e[_0x9339('0x9a')](_0x497717['body']['ids'],_['omit'](_0x497717[_0x9339('0x55')],[_0x9339('0x5e'),'id'])||{})['spread'](function(_0x5edc86){for(var _0x3de8d7=0x0;_0x3de8d7<_0x497717['body']['ids'][_0x9339('0x3b')];_0x3de8d7+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x497717[_0x9339('0x55')][_0x9339('0x5e')][_0x3de8d7]),'CmListId':Number(_0x497717['params']['id'])});}return _0x5edc86;});}})[_0x9339('0x27')](respondWithResult(_0x20d816,null))[_0x9339('0x49')](handleError(_0x20d816,null));};exports[_0x9339('0x9b')]=function(_0x2604b8,_0x1966d2,_0x42c198){return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x2604b8[_0x9339('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1966d2,null))[_0x9339('0x27')](function(_0x9f2579){if(_0x9f2579){return _0x9f2579[_0x9339('0x9b')](_0x2604b8['query'][_0x9339('0x5e')])[_0x9339('0x27')](function(){if(_['isArray'](_0x2604b8['query'][_0x9339('0x5e')])){for(var _0x2c5dba=0x0;_0x2c5dba<_0x2604b8[_0x9339('0x36')][_0x9339('0x5e')]['length'];_0x2c5dba+=0x1){socket['emit'](_0x9339('0x9c'),{'UserId':Number(_0x2604b8[_0x9339('0x36')][_0x9339('0x5e')][_0x2c5dba]),'CmListId':Number(_0x2604b8[_0x9339('0x4b')]['id'])});}}else{socket[_0x9339('0x9d')](_0x9339('0x9c'),{'UserId':Number(_0x2604b8[_0x9339('0x36')][_0x9339('0x5e')]),'CmListId':Number(_0x2604b8[_0x9339('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x1966d2,null))[_0x9339('0x49')](handleError(_0x1966d2,null));};exports[_0x9339('0x9e')]=function(_0x4d2c9e,_0x53dbfa,_0x27e9ab){var _0x37762e={};var _0x483b7e={};var _0x249252;var _0x630b6a;return db[_0x9339('0x31')][_0x9339('0x5a')]({'where':{'id':_0x4d2c9e['params']['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x53dbfa,null))[_0x9339('0x27')](function(_0x462836){if(_0x462836){_0x249252=_0x462836;_0x483b7e[_0x9339('0x34')]=_[_0x9339('0x37')](db['User'][_0x9339('0x32')]);_0x483b7e['query']=_[_0x9339('0x37')](_0x4d2c9e['query']);_0x483b7e['filters']=_[_0x9339('0x38')](_0x483b7e[_0x9339('0x34')],_0x483b7e[_0x9339('0x36')]);_0x37762e['attributes']=_[_0x9339('0x38')](_0x483b7e['model'],qs[_0x9339('0x3a')](_0x4d2c9e[_0x9339('0x36')]['fields']));_0x37762e[_0x9339('0x39')]=_0x37762e[_0x9339('0x39')]['length']?_0x37762e[_0x9339('0x39')]:_0x483b7e['model'];_0x37762e[_0x9339('0x3d')]=qs[_0x9339('0x3e')](_0x4d2c9e['query']['sort']);_0x37762e[_0x9339('0x3f')]=qs[_0x9339('0x40')](_[_0x9339('0x5c')](_0x4d2c9e[_0x9339('0x36')],_0x483b7e[_0x9339('0x40')]));if(_0x4d2c9e[_0x9339('0x36')][_0x9339('0x41')]){_0x37762e[_0x9339('0x3f')]=_[_0x9339('0x42')](_0x37762e[_0x9339('0x3f')],{'$or':_['map'](_0x37762e[_0x9339('0x39')],function(_0x47a7e1){var _0x1faffc={};_0x1faffc[_0x47a7e1]={'$like':'%'+_0x4d2c9e[_0x9339('0x36')][_0x9339('0x41')]+'%'};return _0x1faffc;})});}_0x37762e=_[_0x9339('0x42')]({},_0x37762e,_0x4d2c9e[_0x9339('0x44')]);return _0x249252['getAgents'](_0x37762e);}})[_0x9339('0x27')](function(_0x4ee982){if(_0x4ee982){_0x630b6a=_0x4ee982['length'];if(!_0x4d2c9e['query'][_0x9339('0x3c')](_0x9339('0x5b'))){_0x37762e[_0x9339('0x21')]=qs[_0x9339('0x21')](_0x4d2c9e[_0x9339('0x36')][_0x9339('0x21')]);_0x37762e[_0x9339('0x1f')]=qs['offset'](_0x4d2c9e[_0x9339('0x36')][_0x9339('0x1f')]);}return _0x249252[_0x9339('0x9e')](_0x37762e);}})[_0x9339('0x27')](function(_0xf3c567){if(_0xf3c567){return _0xf3c567?{'count':_0x630b6a,'rows':_0xf3c567}:null;}})['then'](respondWithResult(_0x53dbfa,null))[_0x9339('0x49')](handleError(_0x53dbfa,null));};function handleQuery(_0x5af19c){logger[_0x9339('0x9f')](_0x5af19c);return db[_0x9339('0x8c')][_0x9339('0x36')](_0x5af19c)['spread'](function(_0x1d3e19){csv_results['push'](_0x1d3e19);})[_0x9339('0x49')](function(_0x2c681e){logger[_0x9339('0x2c')](_0x2c681e['message']);});} \ No newline at end of file +var _0x122d=['hasOwnProperty','ListId','findAll','ids','addContacts','CmContact','tags','isArray','push','each','omit','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','ContactItemType','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','alias','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','spread','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','undefined','limit','count','offset','Content-Range','json','apply','reject','update','destroy','then','get','Lists','status','end','error','name','send','index','CmList','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','Disposition','getDispositions','findOne'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x122d,0x18e));var _0xd122=function(_0x131a70,_0x5f53b2){_0x131a70=_0x131a70-0x0;var _0x212967=_0x122d[_0x131a70];return _0x212967;};'use strict';var emlformat=require(_0xd122('0x0'));var rimraf=require(_0xd122('0x1'));var zipdir=require(_0xd122('0x2'));var jsonpatch=require(_0xd122('0x3'));var rp=require('request-promise');var moment=require(_0xd122('0x4'));var BPromise=require(_0xd122('0x5'));var Mustache=require('mustache');var util=require(_0xd122('0x6'));var path=require('path');var sox=require(_0xd122('0x7'));var csv=require(_0xd122('0x8'));var ejs=require(_0xd122('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd122('0xa'));var crypto=require(_0xd122('0xb'));var jsforce=require(_0xd122('0xc'));var deskjs=require(_0xd122('0xd'));var toCsv=require(_0xd122('0x8'));var querystring=require(_0xd122('0xe'));var Papa=require(_0xd122('0xf'));var Redis=require(_0xd122('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd122('0x11'));var hardwareService=require(_0xd122('0x12'));var logger=require(_0xd122('0x13'))(_0xd122('0x14'));var utils=require(_0xd122('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd122('0x16'));var db=require(_0xd122('0x17'))['db'];var csv_results;config[_0xd122('0x18')]=_[_0xd122('0x19')](config[_0xd122('0x18')],{'host':_0xd122('0x1a'),'port':0x18eb});var socket=require(_0xd122('0x1b'))(new Redis(config[_0xd122('0x18')]));require(_0xd122('0x1c'))[_0xd122('0x1d')](socket);function respondWithStatusCode(_0x4668bc,_0x1d35da){_0x1d35da=_0x1d35da||0xcc;return function(_0x2bc054){if(_0x2bc054){return _0x4668bc[_0xd122('0x1e')](_0x1d35da);}return _0x4668bc['status'](_0x1d35da)['end']();};}function respondWithResult(_0x1eb7fd,_0x40c921){_0x40c921=_0x40c921||0xc8;return function(_0x39ba6f){if(_0x39ba6f){return _0x1eb7fd['status'](_0x40c921)['json'](_0x39ba6f);}};}function respondWithFilteredResult(_0x1fe290,_0x14a1cf){return function(_0x14b69a){if(_0x14b69a){var _0x3b06c1=typeof _0x14a1cf['offset']===_0xd122('0x1f')&&typeof _0x14a1cf[_0xd122('0x20')]===_0xd122('0x1f');var _0x31c21d=_0x14b69a[_0xd122('0x21')];var _0x4df0cc=_0x3b06c1?0x0:_0x14a1cf['offset'];var _0x155212=_0x3b06c1?_0x14b69a[_0xd122('0x21')]:_0x14a1cf[_0xd122('0x22')]+_0x14a1cf['limit'];var _0x13675a;if(_0x155212>=_0x31c21d){_0x155212=_0x31c21d;_0x13675a=0xc8;}else{_0x13675a=0xce;}_0x1fe290['status'](_0x13675a);return _0x1fe290['set'](_0xd122('0x23'),_0x4df0cc+'-'+_0x155212+'/'+_0x31c21d)[_0xd122('0x24')](_0x14b69a);}return null;};}function patchUpdates(_0x55f593){return function(_0x1559d2){try{jsonpatch[_0xd122('0x25')](_0x1559d2,_0x55f593,!![]);}catch(_0x43097b){return BPromise[_0xd122('0x26')](_0x43097b);}return _0x1559d2['save']();};}function saveUpdates(_0x1b20a2,_0x3c388b){return function(_0x5d8b3c){if(_0x5d8b3c){return _0x5d8b3c[_0xd122('0x27')](_0x1b20a2)['then'](function(_0x3aa0af){return _0x3aa0af;});}return null;};}function removeEntity(_0x56a6e4,_0x164280){return function(_0x196b87){if(_0x196b87){return _0x196b87[_0xd122('0x28')]()[_0xd122('0x29')](function(){var _0x23ebfd=_0x196b87[_0xd122('0x2a')]({'plain':!![]});var _0x6529c4=_0xd122('0x2b');return db['UserProfileResource'][_0xd122('0x28')]({'where':{'type':_0x6529c4,'resourceId':_0x23ebfd['id']}})[_0xd122('0x29')](function(){return _0x196b87;});})[_0xd122('0x29')](function(){_0x56a6e4[_0xd122('0x2c')](0xcc)[_0xd122('0x2d')]();});}};}function handleEntityNotFound(_0x3c3c03,_0x294065){return function(_0x32312b){if(!_0x32312b){_0x3c3c03[_0xd122('0x1e')](0x194);}return _0x32312b;};}function handleError(_0xba5da7,_0x112845){_0x112845=_0x112845||0x1f4;return function(_0x317632){logger[_0xd122('0x2e')](_0x317632['stack']);if(_0x317632[_0xd122('0x2f')]){delete _0x317632[_0xd122('0x2f')];}_0xba5da7[_0xd122('0x2c')](_0x112845)[_0xd122('0x30')](_0x317632);};}exports[_0xd122('0x31')]=function(_0x4bf9c7,_0x12a143){var _0x5cbce9={},_0x5c3db4={},_0x20e132={'count':0x0,'rows':[]};var _0x331efa=_['map'](db[_0xd122('0x32')]['rawAttributes'],function(_0x4633dc){return{'name':_0x4633dc['fieldName'],'type':_0x4633dc[_0xd122('0x33')]['key']};});_0x5c3db4[_0xd122('0x34')]=_[_0xd122('0x35')](_0x331efa,_0xd122('0x2f'));_0x5c3db4[_0xd122('0x36')]=_['keys'](_0x4bf9c7['query']);_0x5c3db4[_0xd122('0x37')]=_[_0xd122('0x38')](_0x5c3db4[_0xd122('0x34')],_0x5c3db4['query']);_0x5cbce9[_0xd122('0x39')]=_[_0xd122('0x38')](_0x5c3db4[_0xd122('0x34')],qs[_0xd122('0x3a')](_0x4bf9c7[_0xd122('0x36')]['fields']));_0x5cbce9[_0xd122('0x39')]=_0x5cbce9[_0xd122('0x39')][_0xd122('0x3b')]?_0x5cbce9[_0xd122('0x39')]:_0x5c3db4[_0xd122('0x34')];if(!_0x4bf9c7['query']['hasOwnProperty'](_0xd122('0x3c'))){_0x5cbce9['limit']=qs['limit'](_0x4bf9c7[_0xd122('0x36')][_0xd122('0x20')]);_0x5cbce9[_0xd122('0x22')]=qs[_0xd122('0x22')](_0x4bf9c7['query'][_0xd122('0x22')]);}_0x5cbce9['order']=qs[_0xd122('0x3d')](_0x4bf9c7[_0xd122('0x36')][_0xd122('0x3d')]);_0x5cbce9['where']=qs['filters'](_[_0xd122('0x3e')](_0x4bf9c7['query'],_0x5c3db4['filters']),_0x331efa);if(_0x4bf9c7[_0xd122('0x36')][_0xd122('0x3f')]){_0x5cbce9[_0xd122('0x40')]=_[_0xd122('0x41')](_0x5cbce9[_0xd122('0x40')],{'$or':_[_0xd122('0x35')](_0x331efa,function(_0x50c9b8){if(_0x50c9b8[_0xd122('0x33')]!==_0xd122('0x42')){var _0xcc7db0={};_0xcc7db0[_0x50c9b8[_0xd122('0x2f')]]={'$like':'%'+_0x4bf9c7[_0xd122('0x36')][_0xd122('0x3f')]+'%'};return _0xcc7db0;}})});}_0x5cbce9=_['merge']({},_0x5cbce9,_0x4bf9c7[_0xd122('0x43')]);var _0x292397={'where':_0x5cbce9[_0xd122('0x40')]};return db[_0xd122('0x32')]['count'](_0x292397)[_0xd122('0x29')](function(_0xcab2c8){_0x20e132[_0xd122('0x21')]=_0xcab2c8;if(_0x4bf9c7[_0xd122('0x36')]['includeAll']){_0x5cbce9[_0xd122('0x44')]=[{'all':!![]}];}return db[_0xd122('0x32')]['findAll'](_0x5cbce9);})[_0xd122('0x29')](function(_0x40bcb1){_0x20e132[_0xd122('0x45')]=_0x40bcb1;return _0x20e132;})['then'](respondWithFilteredResult(_0x12a143,_0x5cbce9))[_0xd122('0x46')](handleError(_0x12a143,null));};exports[_0xd122('0x47')]=function(_0x51d408,_0x29a529){var _0x2b4be8={'raw':![],'where':{'id':_0x51d408[_0xd122('0x48')]['id']}},_0x3f013e={};_0x3f013e[_0xd122('0x34')]=_[_0xd122('0x49')](db[_0xd122('0x32')][_0xd122('0x4a')]);_0x3f013e['query']=_[_0xd122('0x49')](_0x51d408[_0xd122('0x36')]);_0x3f013e[_0xd122('0x37')]=_[_0xd122('0x38')](_0x3f013e[_0xd122('0x34')],_0x3f013e[_0xd122('0x36')]);_0x2b4be8['attributes']=_['intersection'](_0x3f013e[_0xd122('0x34')],qs[_0xd122('0x3a')](_0x51d408[_0xd122('0x36')][_0xd122('0x3a')]));_0x2b4be8['attributes']=_0x2b4be8[_0xd122('0x39')][_0xd122('0x3b')]?_0x2b4be8[_0xd122('0x39')]:_0x3f013e[_0xd122('0x34')];if(_0x51d408['query'][_0xd122('0x4b')]){_0x2b4be8[_0xd122('0x44')]=[{'all':!![]}];}_0x2b4be8=_['merge']({},_0x2b4be8,_0x51d408[_0xd122('0x43')]);return db[_0xd122('0x32')][_0xd122('0x4c')](_0x2b4be8)['then'](handleEntityNotFound(_0x29a529,null))[_0xd122('0x29')](respondWithResult(_0x29a529,null))[_0xd122('0x46')](handleError(_0x29a529,null));};exports[_0xd122('0x4d')]=function(_0x10aa02,_0x565c2f){return db[_0xd122('0x32')][_0xd122('0x4d')](_0x10aa02[_0xd122('0x4e')],{})['then'](function(_0x37aace){var _0x24f0fa=_0x10aa02[_0xd122('0x4f')][_0xd122('0x2a')]({'plain':!![]});if(!_0x24f0fa)throw new Error(_0xd122('0x50'));if(_0x24f0fa[_0xd122('0x51')]===_0xd122('0x4f')){var _0x52210f=_0x37aace[_0xd122('0x2a')]({'plain':!![]});var _0x39bab3=_0xd122('0x2b');return db[_0xd122('0x52')][_0xd122('0x4c')]({'where':{'name':_0x39bab3,'userProfileId':_0x24f0fa[_0xd122('0x53')]},'raw':!![]})[_0xd122('0x29')](function(_0x3d9f55){if(_0x3d9f55&&_0x3d9f55[_0xd122('0x54')]===0x0){return db[_0xd122('0x55')]['create']({'name':_0x52210f[_0xd122('0x2f')],'resourceId':_0x52210f['id'],'type':_0x3d9f55[_0xd122('0x2f')],'sectionId':_0x3d9f55['id']},{})[_0xd122('0x29')](function(){return _0x37aace;});}else{return _0x37aace;}})[_0xd122('0x46')](function(_0x4283a5){logger[_0xd122('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4283a5);throw _0x4283a5;});}return _0x37aace;})['then'](respondWithResult(_0x565c2f,0xc9))[_0xd122('0x46')](handleError(_0x565c2f,null));};exports[_0xd122('0x27')]=function(_0x52265e,_0x3796b8){if(_0x52265e['body']['id']){delete _0x52265e[_0xd122('0x4e')]['id'];}return db[_0xd122('0x32')][_0xd122('0x4c')]({'where':{'id':_0x52265e['params']['id']}})['then'](handleEntityNotFound(_0x3796b8,null))[_0xd122('0x29')](saveUpdates(_0x52265e[_0xd122('0x4e')],null))[_0xd122('0x29')](respondWithResult(_0x3796b8,null))[_0xd122('0x46')](handleError(_0x3796b8,null));};exports[_0xd122('0x28')]=function(_0x2286af,_0x4528a3){return db[_0xd122('0x32')][_0xd122('0x4c')]({'where':{'id':_0x2286af[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x4528a3,null))[_0xd122('0x29')](removeEntity(_0x4528a3,null))[_0xd122('0x46')](handleError(_0x4528a3,null));};exports[_0xd122('0x56')]=function(_0xf6c870,_0x49325a){return db[_0xd122('0x32')][_0xd122('0x56')]()['then'](respondWithResult(_0x49325a,null))[_0xd122('0x46')](handleError(_0x49325a,null));};exports[_0xd122('0x57')]=function(_0x171eba,_0x11c97a,_0x242cb8){if(_0x171eba[_0xd122('0x4e')]['id']){delete _0x171eba[_0xd122('0x4e')]['id'];}return db['CmList'][_0xd122('0x4c')]({'where':{'id':_0x171eba[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x11c97a,null))[_0xd122('0x29')](function(_0x5b52bd){if(_0x5b52bd){_0x171eba['body']['ListId']=_0x5b52bd['id'];return db[_0xd122('0x58')]['create'](_0x171eba[_0xd122('0x4e')]);}})[_0xd122('0x29')](respondWithResult(_0x11c97a,null))['catch'](handleError(_0x11c97a,null));};exports[_0xd122('0x59')]=function(_0x5169c5,_0x133efc,_0x3f4cff){var _0x480a42={'raw':![],'where':{}};var _0x55bd2c={};var _0x58e223={'count':0x0,'rows':[]};return db[_0xd122('0x32')][_0xd122('0x5a')]({'where':{'id':_0x5169c5[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x133efc,null))[_0xd122('0x29')](function(_0x52b07a){if(_0x52b07a){_0x55bd2c['model']=_[_0xd122('0x49')](db[_0xd122('0x58')]['rawAttributes']);_0x55bd2c[_0xd122('0x36')]=_[_0xd122('0x49')](_0x5169c5[_0xd122('0x36')]);_0x55bd2c[_0xd122('0x37')]=_['intersection'](_0x55bd2c[_0xd122('0x34')],_0x55bd2c[_0xd122('0x36')]);_0x480a42[_0xd122('0x39')]=_['intersection'](_0x55bd2c['model'],qs[_0xd122('0x3a')](_0x5169c5['query'][_0xd122('0x3a')]));_0x480a42[_0xd122('0x39')]=_0x480a42[_0xd122('0x39')][_0xd122('0x3b')]?_0x480a42[_0xd122('0x39')]:_0x55bd2c[_0xd122('0x34')];if(!_0x5169c5[_0xd122('0x36')][_0xd122('0x5b')](_0xd122('0x3c'))){_0x480a42[_0xd122('0x20')]=qs[_0xd122('0x20')](_0x5169c5[_0xd122('0x36')][_0xd122('0x20')]);_0x480a42[_0xd122('0x22')]=qs[_0xd122('0x22')](_0x5169c5[_0xd122('0x36')]['offset']);}_0x480a42['order']=qs[_0xd122('0x3d')](_0x5169c5[_0xd122('0x36')]['sort']);_0x480a42[_0xd122('0x40')]=qs['filters'](_[_0xd122('0x3e')](_0x5169c5[_0xd122('0x36')],_0x55bd2c['filters']));_0x480a42[_0xd122('0x40')][_0xd122('0x5c')]=_0x52b07a['id'];if(_0x5169c5[_0xd122('0x36')][_0xd122('0x3f')]){_0x480a42[_0xd122('0x40')]=_[_0xd122('0x41')](_0x480a42['where'],{'$or':_['map'](_0x480a42['attributes'],function(_0xa2e132){var _0x20d54a={};_0x20d54a[_0xa2e132]={'$like':'%'+_0x5169c5[_0xd122('0x36')][_0xd122('0x3f')]+'%'};return _0x20d54a;})});}_0x480a42=_[_0xd122('0x41')]({},_0x480a42,_0x5169c5[_0xd122('0x43')]);return db[_0xd122('0x58')][_0xd122('0x21')]({'where':_0x480a42[_0xd122('0x40')]})[_0xd122('0x29')](function(_0x357f4a){_0x58e223['count']=_0x357f4a;if(_0x5169c5[_0xd122('0x36')][_0xd122('0x4b')]){_0x480a42['include']=[{'all':!![]}];}return db[_0xd122('0x58')][_0xd122('0x5d')](_0x480a42);})[_0xd122('0x29')](function(_0x21ee1c){_0x58e223[_0xd122('0x45')]=_0x21ee1c;return _0x58e223;});}})[_0xd122('0x29')](respondWithFilteredResult(_0x133efc,_0x480a42))['catch'](handleError(_0x133efc,null));};exports['removeDispositions']=function(_0x1f0111,_0x561a3c,_0x2ba28c){return db[_0xd122('0x32')][_0xd122('0x4c')]({'where':{'id':_0x1f0111[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x561a3c,null))[_0xd122('0x29')](function(_0x2687c8){if(_0x2687c8){return _0x2687c8['removeDispositions'](_0x1f0111['query'][_0xd122('0x5e')]);}})[_0xd122('0x29')](respondWithStatusCode(_0x561a3c,null))[_0xd122('0x46')](handleError(_0x561a3c,null));};exports[_0xd122('0x5f')]=function(_0x33ba2f,_0x71ad9a,_0x5f1a65){return db[_0xd122('0x32')][_0xd122('0x4c')]({'where':{'id':_0x33ba2f[_0xd122('0x48')]['id']}})['then'](handleEntityNotFound(_0x71ad9a,null))['then'](function(_0x156d32){if(_0x156d32){var _0x19f604=[];var _0x41b887={'success':[],'errors':[]};return db[_0xd122('0x60')][_0xd122('0x56')]()[_0xd122('0x29')](function(_0x1b3a45){if(_0x33ba2f[_0xd122('0x4e')][_0xd122('0x61')]&&_[_0xd122('0x62')](_0x33ba2f[_0xd122('0x4e')]['tags'])){if(_0x33ba2f[_0xd122('0x4e')][_0xd122('0x61')][_0xd122('0x3b')]){_0x33ba2f['body'][_0xd122('0x61')]=_0x33ba2f[_0xd122('0x4e')][_0xd122('0x61')]['join'](';')+';';}else{_0x33ba2f[_0xd122('0x4e')]['tags']=null;}}else{_0x33ba2f[_0xd122('0x4e')][_0xd122('0x61')]=null;}if(_0x33ba2f['body']&&_[_0xd122('0x62')](_0x33ba2f[_0xd122('0x4e')])){for(var _0x344e91=0x0;_0x344e91<_0x33ba2f[_0xd122('0x4e')][_0xd122('0x3b')];_0x344e91+=0x1){_0x33ba2f[_0xd122('0x4e')][_0x344e91][_0xd122('0x5c')]=_0x33ba2f[_0xd122('0x48')]['id'];_0x19f604[_0xd122('0x63')](_0x33ba2f[_0xd122('0x4e')][_0x344e91]);}return BPromise[_0xd122('0x64')](_0x19f604,function(_0xad267){return db['CmContact'][_0xd122('0x4d')](_[_0xd122('0x65')](_0xad267,['ids','id'])||{},{'fields':_[_0xd122('0x49')](_0x1b3a45),'raw':!![]})[_0xd122('0x29')](function(_0x38b518){_0x41b887[_0xd122('0x66')][_0xd122('0x63')](_0x38b518[_0xd122('0x67')]);})[_0xd122('0x46')](function(_0x44a7ad){_0x41b887[_0xd122('0x68')][_0xd122('0x63')]({'data':_0xad267,'error':_0x44a7ad[_0xd122('0x69')]});});})[_0xd122('0x29')](function(_0x1a2777){return _0x41b887;})['catch'](function(_0x4e3178){return _0x4e3178;});}else{_0x71ad9a[_0xd122('0x2c')](0x190)[_0xd122('0x24')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xd122('0x29')](respondWithResult(_0x71ad9a,null))[_0xd122('0x46')](handleError(_0x71ad9a,null));};exports[_0xd122('0x6a')]=function(_0x1f00df,_0x3cd1d0,_0x4e359b){var _0x47712e;return db[_0xd122('0x32')][_0xd122('0x4c')]({'where':{'id':_0x1f00df['params']['id']},'include':[{'model':db[_0xd122('0x6b')],'as':_0xd122('0x6c')}]})[_0xd122('0x29')](handleEntityNotFound(_0x3cd1d0,null))[_0xd122('0x29')](function(_0x2c472d){if(_0x2c472d){_0x47712e=_0x2c472d;return db[_0xd122('0x60')][_0xd122('0x4a')];}})[_0xd122('0x29')](function(_0x43ccea){if(_0x43ccea){var _0x22f9aa={};var _0x2d513f={};_0x2d513f[_0xd122('0x34')]=_[_0xd122('0x6d')](_['keys'](_0x43ccea),_[_0xd122('0x35')](_0x47712e[_0xd122('0x6c')],function(_0x46dd83){return util[_0xd122('0x6e')]('cf_%d',_0x46dd83['id']);}));_0x2d513f[_0xd122('0x36')]=_[_0xd122('0x49')](_0x1f00df[_0xd122('0x36')]);_0x2d513f['filters']=_[_0xd122('0x38')](_0x2d513f[_0xd122('0x34')],_0x2d513f[_0xd122('0x36')]);_0x22f9aa['attributes']=_['intersection'](_0x2d513f['model'],qs[_0xd122('0x3a')](_0x1f00df[_0xd122('0x36')][_0xd122('0x3a')]));_0x22f9aa[_0xd122('0x39')]=_0x22f9aa[_0xd122('0x39')][_0xd122('0x3b')]?_0x22f9aa[_0xd122('0x39')]:_0x2d513f[_0xd122('0x34')];if(!_0x1f00df[_0xd122('0x36')][_0xd122('0x5b')]('nolimit')){_0x22f9aa[_0xd122('0x20')]=qs['limit'](_0x1f00df[_0xd122('0x36')]['limit']);_0x22f9aa[_0xd122('0x22')]=qs[_0xd122('0x22')](_0x1f00df['query']['offset']);}_0x22f9aa['order']=qs[_0xd122('0x3d')](_0x1f00df[_0xd122('0x36')][_0xd122('0x3d')]);_0x22f9aa[_0xd122('0x40')]=qs[_0xd122('0x37')](_[_0xd122('0x3e')](_0x1f00df[_0xd122('0x36')],_0x2d513f[_0xd122('0x37')]));_0x22f9aa[_0xd122('0x6f')]=!![];if(_0x1f00df['query'][_0xd122('0x3f')]){_0x22f9aa[_0xd122('0x40')]=_[_0xd122('0x41')](_0x22f9aa['where'],{'$or':_[_0xd122('0x35')](_0x22f9aa[_0xd122('0x39')],function(_0xb4c772){var _0x1f55c1={};_0x1f55c1[_0xb4c772]={'$like':'%'+_0x1f00df[_0xd122('0x36')][_0xd122('0x3f')]+'%'};return _0x1f55c1;})});}_0x22f9aa=_[_0xd122('0x41')]({},_0x22f9aa,_0x1f00df['options']);return _0x47712e[_0xd122('0x6a')](_0x22f9aa);}})[_0xd122('0x29')](respondWithResult(_0x3cd1d0,null))['catch'](handleError(_0x3cd1d0,null));};exports[_0xd122('0x70')]=function(_0x429d17,_0x20c7a0,_0x2c7d5f){var _0x76f234;var _0x2cd5c8;var _0xe8e0a;var _0x688de3=_0x429d17[_0xd122('0x48')]['id'];csv_results=[];return db[_0xd122('0x71')][_0xd122('0x5d')]({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})[_0xd122('0x29')](function(_0x39dde2){_0x76f234=_0x39dde2;var _0x2d7759=_[_0xd122('0x49')](db[_0xd122('0x60')][_0xd122('0x4a')]);return db['CmCustomField'][_0xd122('0x5d')]({'raw':!![],'attributes':['id','alias']})[_0xd122('0x29')](function(_0x32f0f5){_0x2cd5c8=_0x32f0f5;var _0x532894=squel['select']()[_0xd122('0x3a')](_0x2d7759)[_0xd122('0x72')](_0xd122('0x73'),'c')[_0xd122('0x40')](_0xd122('0x74'),_0x688de3)['where'](_0xd122('0x75'))[_0xd122('0x76')]();for(var _0x2a70a6=0x0;_0x2a70a6<_0x2cd5c8[_0xd122('0x3b')];_0x2a70a6++){_0x532894[_0xd122('0x77')]('c.cf_'+_0x2cd5c8[_0x2a70a6]['id'],'customField_'+_0x2cd5c8[_0x2a70a6][_0xd122('0x78')]);}for(var _0x2a70a6=0x0;_0x2a70a6<_0x76f234[_0xd122('0x3b')];_0x2a70a6++){_0x532894[_0xd122('0x77')](squel[_0xd122('0x79')]()[_0xd122('0x77')](_0xd122('0x7a'))[_0xd122('0x72')](_0xd122('0x7b'))[_0xd122('0x40')](_0xd122('0x7c'),_0x76f234[_0x2a70a6]['id'])[_0xd122('0x40')](_0xd122('0x7d')),_0xd122('0x7e')+_0x76f234[_0x2a70a6][_0xd122('0x2f')]);_0x532894[_0xd122('0x77')](squel[_0xd122('0x79')]()[_0xd122('0x77')](_0xd122('0x7f'))['from'](_0xd122('0x7b'))[_0xd122('0x40')](_0xd122('0x7c'),_0x76f234[_0x2a70a6]['id'])['where'](_0xd122('0x7d')),_0xd122('0x80')+_0x76f234[_0x2a70a6][_0xd122('0x2f')]);}var _0x280d21=[];_0x280d21[_0xd122('0x63')](_0x532894[_0xd122('0x81')]());BPromise['each'](_0x280d21,handleQuery)[_0xd122('0x29')](function(_0x3dd5e2){handleQuery(_0x532894[_0xd122('0x81')]());var _0x4e5dcc=csv_results[0x0];if(!_[_0xd122('0x82')](_0x4e5dcc)){var _0x1a893e=toCsv(_0x4e5dcc);var _0x44452a=Date[_0xd122('0x83')]();fs[_0xd122('0x84')](util[_0xd122('0x6e')](_0xd122('0x85'),_0x688de3,_0x44452a),_0x1a893e);_0x20c7a0[_0xd122('0x86')]('Content-disposition','attachment;\x20filename='+util[_0xd122('0x6e')](_0xd122('0x87'),_0x688de3,_0x44452a));_0x20c7a0['setHeader'](_0xd122('0x88'),_0xd122('0x89'));return _0x20c7a0['download'](util[_0xd122('0x6e')](_0xd122('0x85'),_0x688de3,_0x44452a));}else{return _0x20c7a0[_0xd122('0x1e')](0xcc);}});});});};exports[_0xd122('0x8a')]=function(_0xad17ca,_0x448ae0,_0x125112){var _0x15184a;delete _0xad17ca[_0xd122('0x4e')]['id'];return db[_0xd122('0x32')]['findOne']({'where':{'id':_0xad17ca['params']['id']}})['then'](handleEntityNotFound(_0x448ae0,null))[_0xd122('0x29')](function(_0xa826c4){if(_0xa826c4){return db[_0xd122('0x8b')][_0xd122('0x8c')](function(_0x47b1f5){return db['CmCustomField'][_0xd122('0x4d')](_0xad17ca[_0xd122('0x4e')],{'transaction':_0x47b1f5})[_0xd122('0x29')](function(_0x5371dd){_0x15184a=_0x5371dd;return _0xa826c4[_0xd122('0x8d')](_0x5371dd,{'transaction':_0x47b1f5});})[_0xd122('0x29')](function(){var _0x15b217={'type':db[_0xd122('0x8e')][_0xd122('0x8f')],'transaction':_0x47b1f5};switch(_0xad17ca[_0xd122('0x4e')][_0xd122('0x33')]){case _0xd122('0x90'):_0x15b217['type']=db['Sequelize'][_0xd122('0x8f')];break;case _0xd122('0x91'):_0x15b217[_0xd122('0x33')]=db['Sequelize'][_0xd122('0x92')];break;case _0xd122('0x93'):_0x15b217[_0xd122('0x33')]=db['Sequelize'][_0xd122('0x94')];_0x15b217[_0xd122('0x95')]=![];break;default:}return db[_0xd122('0x8b')][_0xd122('0x96')][_0xd122('0x97')](_0xd122('0x73'),util[_0xd122('0x6e')]('cf_%s',_0x15184a['id']),_0x15b217);})[_0xd122('0x29')](function(){return _0x15184a;});});}})['then'](respondWithResult(_0x448ae0,null))[_0xd122('0x46')](handleError(_0x448ae0,null));};exports[_0xd122('0x98')]=function(_0xa4a789,_0x159082,_0x1ccefd){var _0x30addc={};var _0x2ae8fb={};var _0x18102d;var _0x12c9b7;return db[_0xd122('0x32')][_0xd122('0x5a')]({'where':{'id':_0xa4a789[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x159082,null))['then'](function(_0x4f6666){if(_0x4f6666){_0x18102d=_0x4f6666;_0x2ae8fb[_0xd122('0x34')]=_[_0xd122('0x49')](db['CmCustomField'][_0xd122('0x4a')]);_0x2ae8fb[_0xd122('0x36')]=_[_0xd122('0x49')](_0xa4a789['query']);_0x2ae8fb[_0xd122('0x37')]=_['intersection'](_0x2ae8fb[_0xd122('0x34')],_0x2ae8fb['query']);_0x30addc[_0xd122('0x39')]=_[_0xd122('0x38')](_0x2ae8fb[_0xd122('0x34')],qs[_0xd122('0x3a')](_0xa4a789[_0xd122('0x36')][_0xd122('0x3a')]));_0x30addc[_0xd122('0x39')]=_0x30addc[_0xd122('0x39')][_0xd122('0x3b')]?_0x30addc[_0xd122('0x39')]:_0x2ae8fb[_0xd122('0x34')];_0x30addc['order']=qs[_0xd122('0x3d')](_0xa4a789['query'][_0xd122('0x3d')]);_0x30addc[_0xd122('0x40')]=qs['filters'](_[_0xd122('0x3e')](_0xa4a789['query'],_0x2ae8fb[_0xd122('0x37')]));_0x30addc[_0xd122('0x40')]=_['merge'](_0x30addc['where'],{'$or':[{'ListId':_0x4f6666['id']},{'ListId':null}]});if(_0xa4a789[_0xd122('0x36')][_0xd122('0x3f')]){_0x30addc[_0xd122('0x40')]=_[_0xd122('0x41')](_0x30addc['where'],{'$or':_[_0xd122('0x35')](_0x30addc[_0xd122('0x39')],function(_0x1f15a1){var _0xa8c146={};_0xa8c146[_0x1f15a1]={'$like':'%'+_0xa4a789['query']['filter']+'%'};return _0xa8c146;})});}_0x30addc=_[_0xd122('0x41')]({},_0x30addc,_0xa4a789[_0xd122('0x43')]);return db['CmCustomField'][_0xd122('0x99')](_0x30addc);}})[_0xd122('0x29')](respondWithResult(_0x159082,null))[_0xd122('0x46')](handleError(_0x159082,null));};exports[_0xd122('0x9a')]=function(_0x40a865,_0x291c78){return db['CmCustomField'][_0xd122('0x99')]({'where':{'ListId':null}})[_0xd122('0x29')](handleEntityNotFound(_0x291c78,null))['then'](function(_0x1d12d7){return _0x1d12d7;})[_0xd122('0x29')](respondWithResult(_0x291c78,null))[_0xd122('0x46')](handleError(_0x291c78,null));};exports[_0xd122('0x9b')]=function(_0x62deae,_0x404cfc,_0xef3ad8){return db[_0xd122('0x32')][_0xd122('0x4c')]({'where':{'id':_0x62deae[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x404cfc,null))[_0xd122('0x29')](function(_0x4074cd){if(_0x4074cd){return _0x4074cd['addAgents'](_0x62deae['body']['ids'],_[_0xd122('0x65')](_0x62deae[_0xd122('0x4e')],[_0xd122('0x5e'),'id'])||{})['spread'](function(_0x5708d3){for(var _0x26ccab=0x0;_0x26ccab<_0x62deae[_0xd122('0x4e')]['ids'][_0xd122('0x3b')];_0x26ccab+=0x1){socket['emit'](_0xd122('0x9c'),{'UserId':Number(_0x62deae[_0xd122('0x4e')]['ids'][_0x26ccab]),'CmListId':Number(_0x62deae[_0xd122('0x48')]['id'])});}return _0x5708d3;});}})[_0xd122('0x29')](respondWithResult(_0x404cfc,null))[_0xd122('0x46')](handleError(_0x404cfc,null));};exports[_0xd122('0x9d')]=function(_0x50f135,_0x7adbb0,_0x2d4cc2){return db[_0xd122('0x32')]['find']({'where':{'id':_0x50f135[_0xd122('0x48')]['id']}})['then'](handleEntityNotFound(_0x7adbb0,null))['then'](function(_0x42adaf){if(_0x42adaf){return _0x42adaf[_0xd122('0x9d')](_0x50f135[_0xd122('0x36')][_0xd122('0x5e')])['then'](function(){if(_[_0xd122('0x62')](_0x50f135[_0xd122('0x36')][_0xd122('0x5e')])){for(var _0x1ea44b=0x0;_0x1ea44b<_0x50f135[_0xd122('0x36')][_0xd122('0x5e')][_0xd122('0x3b')];_0x1ea44b+=0x1){socket[_0xd122('0x9e')](_0xd122('0x9f'),{'UserId':Number(_0x50f135[_0xd122('0x36')][_0xd122('0x5e')][_0x1ea44b]),'CmListId':Number(_0x50f135[_0xd122('0x48')]['id'])});}}else{socket[_0xd122('0x9e')](_0xd122('0x9f'),{'UserId':Number(_0x50f135['query'][_0xd122('0x5e')]),'CmListId':Number(_0x50f135['params']['id'])});}});}})[_0xd122('0x29')](respondWithStatusCode(_0x7adbb0,null))['catch'](handleError(_0x7adbb0,null));};exports[_0xd122('0xa0')]=function(_0x116290,_0x343891,_0x34a65e){var _0x2d9c2d={};var _0x25e724={};var _0x2f5580;var _0x16591c;return db[_0xd122('0x32')][_0xd122('0x5a')]({'where':{'id':_0x116290[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x343891,null))[_0xd122('0x29')](function(_0x2877ac){if(_0x2877ac){_0x2f5580=_0x2877ac;_0x25e724[_0xd122('0x34')]=_[_0xd122('0x49')](db[_0xd122('0xa1')][_0xd122('0x4a')]);_0x25e724[_0xd122('0x36')]=_['keys'](_0x116290[_0xd122('0x36')]);_0x25e724[_0xd122('0x37')]=_['intersection'](_0x25e724[_0xd122('0x34')],_0x25e724[_0xd122('0x36')]);_0x2d9c2d[_0xd122('0x39')]=_[_0xd122('0x38')](_0x25e724['model'],qs[_0xd122('0x3a')](_0x116290[_0xd122('0x36')][_0xd122('0x3a')]));_0x2d9c2d[_0xd122('0x39')]=_0x2d9c2d[_0xd122('0x39')][_0xd122('0x3b')]?_0x2d9c2d[_0xd122('0x39')]:_0x25e724[_0xd122('0x34')];_0x2d9c2d['order']=qs['sort'](_0x116290[_0xd122('0x36')]['sort']);_0x2d9c2d[_0xd122('0x40')]=qs[_0xd122('0x37')](_[_0xd122('0x3e')](_0x116290[_0xd122('0x36')],_0x25e724['filters']));if(_0x116290[_0xd122('0x36')][_0xd122('0x3f')]){_0x2d9c2d[_0xd122('0x40')]=_[_0xd122('0x41')](_0x2d9c2d[_0xd122('0x40')],{'$or':_['map'](_0x2d9c2d[_0xd122('0x39')],function(_0x16d2cb){var _0x5f37de={};_0x5f37de[_0x16d2cb]={'$like':'%'+_0x116290[_0xd122('0x36')]['filter']+'%'};return _0x5f37de;})});}_0x2d9c2d=_[_0xd122('0x41')]({},_0x2d9c2d,_0x116290[_0xd122('0x43')]);return _0x2f5580[_0xd122('0xa0')](_0x2d9c2d);}})[_0xd122('0x29')](function(_0x385171){if(_0x385171){_0x16591c=_0x385171[_0xd122('0x3b')];if(!_0x116290['query']['hasOwnProperty'](_0xd122('0x3c'))){_0x2d9c2d[_0xd122('0x20')]=qs[_0xd122('0x20')](_0x116290[_0xd122('0x36')][_0xd122('0x20')]);_0x2d9c2d[_0xd122('0x22')]=qs['offset'](_0x116290[_0xd122('0x36')]['offset']);}return _0x2f5580['getAgents'](_0x2d9c2d);}})[_0xd122('0x29')](function(_0x125fc7){if(_0x125fc7){return _0x125fc7?{'count':_0x16591c,'rows':_0x125fc7}:null;}})[_0xd122('0x29')](respondWithResult(_0x343891,null))[_0xd122('0x46')](handleError(_0x343891,null));};function handleQuery(_0x2fef6f){logger['info'](_0x2fef6f);return db['sequelize']['query'](_0x2fef6f)[_0xd122('0xa2')](function(_0x5e1418){csv_results[_0xd122('0x63')](_0x5e1418);})[_0xd122('0x46')](function(_0x515c0d){logger[_0xd122('0x2e')](_0x515c0d[_0xd122('0x69')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index bcc4a50..6cac523 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 _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x326f,0xd1));var _0xf326=function(_0x3d3a0e,_0x3aa8a0){_0x3d3a0e=_0x3d3a0e-0x0;var _0x97584b=_0x326f[_0x3d3a0e];return _0x97584b;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0x5fc3[_0x4f1da5];return _0xe972a8;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index bf8d6c9..f977227 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 _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./cmList.attributes','define','CmList'];(function(_0x2416f2,_0x183451){var _0x162fde=function(_0x4c32ae){while(--_0x4c32ae){_0x2416f2['push'](_0x2416f2['shift']());}};_0x162fde(++_0x183451);}(_0x99e9,0xb4));var _0x999e=function(_0x4c0155,_0x5b20db){_0x4c0155=_0x4c0155-0x0;var _0x1276db=_0x99e9[_0x4c0155];return _0x1276db;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./cmList.attributes','define','CmList'];(function(_0x58e358,_0x4cd732){var _0x34015f=function(_0x22cf00){while(--_0x22cf00){_0x58e358['push'](_0x58e358['shift']());}};_0x34015f(++_0x4cd732);}(_0x99e9,0xb4));var _0x999e=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x99e9[_0x4b7895];return _0x264180;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'cm_lists','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 ff55df0..d1c786b 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 _0x5f3b=['request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register'];(function(_0x48a96f,_0x530059){var _0x3ff3ef=function(_0x286059){while(--_0x286059){_0x48a96f['push'](_0x48a96f['shift']());}};_0x3ff3ef(++_0x530059);}(_0x5f3b,0x1a1));var _0xb5f3=function(_0x5c4937,_0x4bd800){_0x5c4937=_0x5c4937-0x0;var _0x1a0ad7=_0x5f3b[_0x5c4937];return _0x1a0ad7;};'use strict';var _=require(_0xb5f3('0x0'));var util=require(_0xb5f3('0x1'));var moment=require('moment');var BPromise=require(_0xb5f3('0x2'));var rs=require(_0xb5f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb5f3('0x4'));var logger=require(_0xb5f3('0x5'))(_0xb5f3('0x6'));var config=require('../../config/environment');var jayson=require(_0xb5f3('0x7'));var client=jayson[_0xb5f3('0x8')][_0xb5f3('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb5f3('0xa')],{'host':_0xb5f3('0xb'),'port':0x18eb});var socket=require(_0xb5f3('0xc'))(new Redis(config[_0xb5f3('0xa')]));require(_0xb5f3('0xd'))[_0xb5f3('0xe')](socket);function respondWithRpcPromise(_0x1dae6e,_0x11e20c,_0xfcc8d2){return new BPromise(function(_0x450928,_0x3bf28c){return client[_0xb5f3('0xf')](_0x1dae6e,_0xfcc8d2)['then'](function(_0x2b66cb){logger[_0xb5f3('0x10')](_0xb5f3('0x11'),_0x11e20c,_0xb5f3('0x12'));logger[_0xb5f3('0x13')](_0xb5f3('0x14'),_0x11e20c,'request\x20sent',JSON['stringify'](_0x2b66cb));if(_0x2b66cb[_0xb5f3('0x15')]){if(_0x2b66cb[_0xb5f3('0x15')][_0xb5f3('0x16')]===0x1f4){logger[_0xb5f3('0x15')](_0xb5f3('0x11'),_0x11e20c,_0x2b66cb[_0xb5f3('0x15')][_0xb5f3('0x17')]);return _0x3bf28c(_0x2b66cb['error'][_0xb5f3('0x17')]);}logger[_0xb5f3('0x15')]('CmList,\x20%s,\x20%s',_0x11e20c,_0x2b66cb[_0xb5f3('0x15')][_0xb5f3('0x17')]);return _0x450928(_0x2b66cb[_0xb5f3('0x15')][_0xb5f3('0x17')]);}else{logger[_0xb5f3('0x10')]('CmList,\x20%s,\x20%s',_0x11e20c,_0xb5f3('0x12'));_0x450928(_0x2b66cb['result']['message']);}})['catch'](function(_0x21e5db){logger['error'](_0xb5f3('0x11'),_0x11e20c,_0x21e5db);_0x3bf28c(_0x21e5db);});});} \ No newline at end of file +var _0x9b8d=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x9b8d,0x199));var _0xd9b8=function(_0x11908c,_0x547af6){_0x11908c=_0x11908c-0x0;var _0x10cd4e=_0x9b8d[_0x11908c];return _0x10cd4e;};'use strict';var _=require(_0xd9b8('0x0'));var util=require(_0xd9b8('0x1'));var moment=require(_0xd9b8('0x2'));var BPromise=require(_0xd9b8('0x3'));var rs=require(_0xd9b8('0x4'));var fs=require('fs');var Redis=require(_0xd9b8('0x5'));var db=require(_0xd9b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9b8('0x7'))(_0xd9b8('0x8'));var config=require(_0xd9b8('0x9'));var jayson=require(_0xd9b8('0xa'));var client=jayson['client'][_0xd9b8('0xb')]({'port':0x232a});config['redis']=_[_0xd9b8('0xc')](config[_0xd9b8('0xd')],{'host':_0xd9b8('0xe'),'port':0x18eb});var socket=require(_0xd9b8('0xf'))(new Redis(config['redis']));require(_0xd9b8('0x10'))['register'](socket);function respondWithRpcPromise(_0x16800a,_0x586797,_0x399ceb){return new BPromise(function(_0x20b4df,_0x4cf5d7){return client['request'](_0x16800a,_0x399ceb)[_0xd9b8('0x11')](function(_0x157df0){logger[_0xd9b8('0x12')]('CmList,\x20%s,\x20%s',_0x586797,_0xd9b8('0x13'));logger[_0xd9b8('0x14')](_0xd9b8('0x15'),_0x586797,'request\x20sent',JSON[_0xd9b8('0x16')](_0x157df0));if(_0x157df0[_0xd9b8('0x17')]){if(_0x157df0[_0xd9b8('0x17')][_0xd9b8('0x18')]===0x1f4){logger[_0xd9b8('0x17')](_0xd9b8('0x19'),_0x586797,_0x157df0[_0xd9b8('0x17')][_0xd9b8('0x1a')]);return _0x4cf5d7(_0x157df0[_0xd9b8('0x17')][_0xd9b8('0x1a')]);}logger[_0xd9b8('0x17')](_0xd9b8('0x19'),_0x586797,_0x157df0['error'][_0xd9b8('0x1a')]);return _0x20b4df(_0x157df0[_0xd9b8('0x17')]['message']);}else{logger[_0xd9b8('0x12')](_0xd9b8('0x19'),_0x586797,_0xd9b8('0x13'));_0x20b4df(_0x157df0[_0xd9b8('0x1b')][_0xd9b8('0x1a')]);}})[_0xd9b8('0x1c')](function(_0x1957c2){logger[_0xd9b8('0x17')]('CmList,\x20%s,\x20%s',_0x586797,_0x1957c2);_0x4cf5d7(_0x1957c2);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 5c33531..b485112 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 _0x1161=['cmList:','./cmList.events','save','remove','update','register','length'];(function(_0x1ac197,_0x534cad){var _0x3ae75f=function(_0x39e825){while(--_0x39e825){_0x1ac197['push'](_0x1ac197['shift']());}};_0x3ae75f(++_0x534cad);}(_0x1161,0x189));var _0x1116=function(_0x4dbb87,_0x2e238f){_0x4dbb87=_0x4dbb87-0x0;var _0x2f6e90=_0x1161[_0x4dbb87];return _0x2f6e90;};'use strict';var CmListEvents=require(_0x1116('0x0'));var events=[_0x1116('0x1'),_0x1116('0x2'),_0x1116('0x3')];function createListener(_0xba83e4,_0x5cc3cd){return function(_0x532c96){_0x5cc3cd['emit'](_0xba83e4,_0x532c96);};}function removeListener(_0x2038ba,_0x559160){return function(){CmListEvents['removeListener'](_0x2038ba,_0x559160);};}exports[_0x1116('0x4')]=function(_0x5703f8){for(var _0x1bb559=0x0,_0x88afd6=events[_0x1116('0x5')];_0x1bb559<_0x88afd6;_0x1bb559++){var _0x4cd3b8=events[_0x1bb559];var _0x27c76c=createListener(_0x1116('0x6')+_0x4cd3b8,_0x5703f8);CmListEvents['on'](_0x4cd3b8,_0x27c76c);}}; \ No newline at end of file +var _0x87c6=['update','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x12d6c6,_0x1d7ee2){var _0x270fd4=function(_0x2a401e){while(--_0x2a401e){_0x12d6c6['push'](_0x12d6c6['shift']());}};_0x270fd4(++_0x1d7ee2);}(_0x87c6,0x186));var _0x687c=function(_0x164f87,_0x283939){_0x164f87=_0x164f87-0x0;var _0x5f2259=_0x87c6[_0x164f87];return _0x5f2259;};'use strict';var CmListEvents=require(_0x687c('0x0'));var events=[_0x687c('0x1'),'remove',_0x687c('0x2')];function createListener(_0x50373c,_0x43f2a0){return function(_0x325c9d){_0x43f2a0[_0x687c('0x3')](_0x50373c,_0x325c9d);};}function removeListener(_0x262e0e,_0x5097e5){return function(){CmListEvents[_0x687c('0x4')](_0x262e0e,_0x5097e5);};}exports[_0x687c('0x5')]=function(_0x535c92){for(var _0x424306=0x0,_0x584d3a=events[_0x687c('0x6')];_0x424306<_0x584d3a;_0x424306++){var _0x365b5f=events[_0x424306];var _0x1f10fb=createListener(_0x687c('0x7')+_0x365b5f,_0x535c92);CmListEvents['on'](_0x365b5f,_0x1f10fb);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e20f671..1b74af3 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 _0xb5cd=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','/global_fields','isAuthenticated','/:id/dispositions','getDispositions','getCustomFields','/:id/users','getAgents','post','create','/:id/contacts','addContacts','/:id/fields','addAgents','/:id','update','delete','removeDispositions','removeAgents','multer','util'];(function(_0x46b7d3,_0x2bac87){var _0x4639b0=function(_0x4920c7){while(--_0x4920c7){_0x46b7d3['push'](_0x46b7d3['shift']());}};_0x4639b0(++_0x2bac87);}(_0xb5cd,0x134));var _0xdb5c=function(_0x4a85fa,_0x2752b8){_0x4a85fa=_0x4a85fa-0x0;var _0x5dd57a=_0xb5cd[_0x4a85fa];return _0x5dd57a;};'use strict';var multer=require(_0xdb5c('0x0'));var util=require(_0xdb5c('0x1'));var path=require(_0xdb5c('0x2'));var timeout=require(_0xdb5c('0x3'));var express=require(_0xdb5c('0x4'));var router=express['Router']();var fs_extra=require(_0xdb5c('0x5'));var auth=require(_0xdb5c('0x6'));var interaction=require(_0xdb5c('0x7'));var config=require(_0xdb5c('0x8'));var controller=require(_0xdb5c('0x9'));router[_0xdb5c('0xa')]('/',auth['isAuthenticated'](),controller[_0xdb5c('0xb')]);router[_0xdb5c('0xa')](_0xdb5c('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xdb5c('0xa')](_0xdb5c('0xd'),auth[_0xdb5c('0xe')](),controller['getGlobalCustomFields']);router[_0xdb5c('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdb5c('0xa')](_0xdb5c('0xf'),auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x10')]);router[_0xdb5c('0xa')]('/:id/contacts',auth[_0xdb5c('0xe')](),controller['getContacts']);router[_0xdb5c('0xa')]('/:id/contacts/csv',auth['isAuthenticated'](),controller['getContactsCsv']);router['get']('/:id/fields',auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x11')]);router['get'](_0xdb5c('0x12'),auth['isAuthenticated'](),controller[_0xdb5c('0x13')]);router[_0xdb5c('0x14')]('/',auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x15')]);router[_0xdb5c('0x14')]('/:id/dispositions',auth[_0xdb5c('0xe')](),controller['addDisposition']);router[_0xdb5c('0x14')](_0xdb5c('0x16'),auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x17')]);router[_0xdb5c('0x14')](_0xdb5c('0x18'),auth['isAuthenticated'](),controller['addCustomField']);router[_0xdb5c('0x14')](_0xdb5c('0x12'),auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x19')]);router['put'](_0xdb5c('0x1a'),auth['isAuthenticated'](),controller[_0xdb5c('0x1b')]);router[_0xdb5c('0x1c')](_0xdb5c('0x1a'),auth[_0xdb5c('0xe')](),controller['destroy']);router[_0xdb5c('0x1c')](_0xdb5c('0xf'),auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x1d')]);router[_0xdb5c('0x1c')](_0xdb5c('0x12'),auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x6efe=['isAuthenticated','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','addDisposition','update','delete','removeDispositions','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','/describe','describe','get','getGlobalCustomFields','/:id'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0x6efe,0x1a5));var _0xe6ef=function(_0x5e3683,_0x41bc90){_0x5e3683=_0x5e3683-0x0;var _0x5c4fc3=_0x6efe[_0x5e3683];return _0x5c4fc3;};'use strict';var multer=require('multer');var util=require(_0xe6ef('0x0'));var path=require('path');var timeout=require(_0xe6ef('0x1'));var express=require(_0xe6ef('0x2'));var router=express[_0xe6ef('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe6ef('0x4'));var config=require(_0xe6ef('0x5'));var controller=require('./cmList.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe6ef('0x6'),auth['isAuthenticated'](),controller[_0xe6ef('0x7')]);router[_0xe6ef('0x8')]('/global_fields',auth['isAuthenticated'](),controller[_0xe6ef('0x9')]);router[_0xe6ef('0x8')](_0xe6ef('0xa'),auth[_0xe6ef('0xb')](),controller['show']);router[_0xe6ef('0x8')](_0xe6ef('0xc'),auth[_0xe6ef('0xb')](),controller[_0xe6ef('0xd')]);router['get'](_0xe6ef('0xe'),auth[_0xe6ef('0xb')](),controller['getContacts']);router[_0xe6ef('0x8')](_0xe6ef('0xf'),auth[_0xe6ef('0xb')](),controller[_0xe6ef('0x10')]);router['get'](_0xe6ef('0x11'),auth['isAuthenticated'](),controller[_0xe6ef('0x12')]);router[_0xe6ef('0x8')](_0xe6ef('0x13'),auth[_0xe6ef('0xb')](),controller['getAgents']);router[_0xe6ef('0x14')]('/',auth[_0xe6ef('0xb')](),controller[_0xe6ef('0x15')]);router['post'](_0xe6ef('0xc'),auth[_0xe6ef('0xb')](),controller[_0xe6ef('0x16')]);router['post'](_0xe6ef('0xe'),auth[_0xe6ef('0xb')](),controller['addContacts']);router[_0xe6ef('0x14')](_0xe6ef('0x11'),auth[_0xe6ef('0xb')](),controller['addCustomField']);router[_0xe6ef('0x14')](_0xe6ef('0x13'),auth[_0xe6ef('0xb')](),controller['addAgents']);router['put'](_0xe6ef('0xa'),auth[_0xe6ef('0xb')](),controller[_0xe6ef('0x17')]);router[_0xe6ef('0x18')](_0xe6ef('0xa'),auth[_0xe6ef('0xb')](),controller['destroy']);router[_0xe6ef('0x18')](_0xe6ef('0xc'),auth[_0xe6ef('0xb')](),controller[_0xe6ef('0x19')]);router[_0xe6ef('0x18')](_0xe6ef('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xe6ef('0x1a')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index c9c5524..6654533 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 _0xc0ba=['sequelize','VIRTUAL','getDataValue','field','STRING'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0xc0ba,0x177));var _0xac0b=function(_0x193a6e,_0x45dd00){_0x193a6e=_0x193a6e-0x0;var _0x599a9b=_0xc0ba[_0x193a6e];return _0x599a9b;};'use strict';var Sequelize=require(_0xac0b('0x0'));module['exports']={'name':{'type':Sequelize[_0xac0b('0x1')],'get':function(_0x6b3dc3){return this[_0xac0b('0x2')](_0xac0b('0x3'));}},'field':{'type':Sequelize[_0xac0b('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xbe57=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x225306,_0x20d9de){var _0x10bd79=function(_0x5ee586){while(--_0x5ee586){_0x225306['push'](_0x225306['shift']());}};_0x10bd79(++_0x20d9de);}(_0xbe57,0x168));var _0x7be5=function(_0x438de6,_0x198556){_0x438de6=_0x438de6-0x0;var _0x43d857=_0xbe57[_0x438de6];return _0x43d857;};'use strict';var Sequelize=require(_0x7be5('0x0'));module[_0x7be5('0x1')]={'name':{'type':Sequelize[_0x7be5('0x2')],'get':function(_0x41676c){return this[_0x7be5('0x3')](_0x7be5('0x4'));}},'field':{'type':Sequelize[_0x7be5('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x7be5('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x7be5('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 7f0bae5..a0f9521 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(_0x374c10,_0xb65e4d){var _0x14a829=function(_0x1e41fe){while(--_0x1e41fe){_0x374c10['push'](_0x374c10['shift']());}};_0x14a829(++_0xb65e4d);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 _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(_0x3c211a,_0x167478){var _0x1281f3=function(_0x2fffcd){while(--_0x2fffcd){_0x3c211a['push'](_0x3c211a['shift']());}};_0x1281f3(++_0x167478);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index eb5de87..b50db8e 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 _0xdb22=['./condition.attributes','exports','tools_conditions','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x10986c,_0xc98154){var _0x344f39=function(_0x34b804){while(--_0x34b804){_0x10986c['push'](_0x10986c['shift']());}};_0x344f39(++_0xc98154);}(_0xdb22,0x1dc));var _0x2db2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdb22[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x2db2('0x0'));var logger=require(_0x2db2('0x1'))(_0x2db2('0x2'));var moment=require(_0x2db2('0x3'));var BPromise=require('bluebird');var rp=require(_0x2db2('0x4'));var fs=require('fs');var path=require(_0x2db2('0x5'));var rimraf=require(_0x2db2('0x6'));var config=require(_0x2db2('0x7'));var attributes=require(_0x2db2('0x8'));module[_0x2db2('0x9')]=function(_0x2ba3f3,_0x3db1f4){return _0x2ba3f3['define']('Condition',attributes,{'tableName':_0x2db2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5229=['bluebird','request-promise','path','rimraf','../../config/environment','define','Condition','tools_conditions','lodash','../../config/logger','api'];(function(_0x72dfb,_0x2f6be9){var _0x4d9bc9=function(_0x511d5f){while(--_0x511d5f){_0x72dfb['push'](_0x72dfb['shift']());}};_0x4d9bc9(++_0x2f6be9);}(_0x5229,0x194));var _0x9522=function(_0x471beb,_0x210026){_0x471beb=_0x471beb-0x0;var _0x3d4e0d=_0x5229[_0x471beb];return _0x3d4e0d;};'use strict';var _=require(_0x9522('0x0'));var util=require('util');var logger=require(_0x9522('0x1'))(_0x9522('0x2'));var moment=require('moment');var BPromise=require(_0x9522('0x3'));var rp=require(_0x9522('0x4'));var fs=require('fs');var path=require(_0x9522('0x5'));var rimraf=require(_0x9522('0x6'));var config=require(_0x9522('0x7'));var attributes=require('./condition.attributes');module['exports']=function(_0x116db9,_0x3524ed){return _0x116db9[_0x9522('0x8')](_0x9522('0x9'),attributes,{'tableName':_0x9522('0xa'),'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 269cb84..b9ad054 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 _0xdb46=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x40197b,_0x4e763f){var _0x3b9c2f=function(_0x41c34f){while(--_0x41c34f){_0x40197b['push'](_0x40197b['shift']());}};_0x3b9c2f(++_0x4e763f);}(_0xdb46,0x1f1));var _0x6db4=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0xdb46[_0x318840];return _0x223da4;};'use strict';var _=require(_0x6db4('0x0'));var util=require('util');var moment=require(_0x6db4('0x1'));var BPromise=require('bluebird');var rs=require(_0x6db4('0x2'));var fs=require('fs');var Redis=require(_0x6db4('0x3'));var db=require(_0x6db4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6db4('0x5'))(_0x6db4('0x6'));var config=require(_0x6db4('0x7'));var jayson=require(_0x6db4('0x8'));var client=jayson[_0x6db4('0x9')][_0x6db4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x245671,_0xefb0f3,_0x2586ed){return new BPromise(function(_0x4acc5d,_0x170019){return client[_0x6db4('0xb')](_0x245671,_0x2586ed)[_0x6db4('0xc')](function(_0x361b75){logger[_0x6db4('0xd')]('Condition,\x20%s,\x20%s',_0xefb0f3,_0x6db4('0xe'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0xefb0f3,_0x6db4('0xe'),JSON['stringify'](_0x361b75));if(_0x361b75[_0x6db4('0xf')]){if(_0x361b75[_0x6db4('0xf')][_0x6db4('0x10')]===0x1f4){logger[_0x6db4('0xf')](_0x6db4('0x11'),_0xefb0f3,_0x361b75[_0x6db4('0xf')][_0x6db4('0x12')]);return _0x170019(_0x361b75[_0x6db4('0xf')][_0x6db4('0x12')]);}logger['error'](_0x6db4('0x11'),_0xefb0f3,_0x361b75[_0x6db4('0xf')][_0x6db4('0x12')]);return _0x4acc5d(_0x361b75[_0x6db4('0xf')][_0x6db4('0x12')]);}else{logger['info'](_0x6db4('0x11'),_0xefb0f3,'request\x20sent');_0x4acc5d(_0x361b75[_0x6db4('0x13')]['message']);}})[_0x6db4('0x14')](function(_0x40e003){logger[_0x6db4('0xf')]('Condition,\x20%s,\x20%s',_0xefb0f3,_0x40e003);_0x170019(_0x40e003);});});} \ No newline at end of file +var _0xc4e3=['jayson/promise','client','Condition,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4e3,0x6e));var _0x3c4e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc4e3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3c4e('0x0'));var util=require(_0x3c4e('0x1'));var moment=require(_0x3c4e('0x2'));var BPromise=require('bluebird');var rs=require(_0x3c4e('0x3'));var fs=require('fs');var Redis=require(_0x3c4e('0x4'));var db=require(_0x3c4e('0x5'))['db'];var utils=require(_0x3c4e('0x6'));var logger=require(_0x3c4e('0x7'))(_0x3c4e('0x8'));var config=require(_0x3c4e('0x9'));var jayson=require(_0x3c4e('0xa'));var client=jayson[_0x3c4e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x330f28,_0x4a896b,_0x2b2427){return new BPromise(function(_0x26c617,_0x57ef43){return client['request'](_0x330f28,_0x2b2427)['then'](function(_0x58120e){logger['info'](_0x3c4e('0xc'),_0x4a896b,'request\x20sent');logger[_0x3c4e('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x4a896b,'request\x20sent',JSON[_0x3c4e('0xe')](_0x58120e));if(_0x58120e[_0x3c4e('0xf')]){if(_0x58120e[_0x3c4e('0xf')]['code']===0x1f4){logger['error'](_0x3c4e('0xc'),_0x4a896b,_0x58120e[_0x3c4e('0xf')][_0x3c4e('0x10')]);return _0x57ef43(_0x58120e['error']['message']);}logger[_0x3c4e('0xf')](_0x3c4e('0xc'),_0x4a896b,_0x58120e['error'][_0x3c4e('0x10')]);return _0x26c617(_0x58120e[_0x3c4e('0xf')][_0x3c4e('0x10')]);}else{logger[_0x3c4e('0x11')]('Condition,\x20%s,\x20%s',_0x4a896b,_0x3c4e('0x12'));_0x26c617(_0x58120e[_0x3c4e('0x13')][_0x3c4e('0x10')]);}})['catch'](function(_0x289729){logger[_0x3c4e('0xf')](_0x3c4e('0xc'),_0x4a896b,_0x289729);_0x57ef43(_0x289729);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index ed5b305..e68ea73 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 _0x30f9=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x4362a6,_0x5a8775){var _0x4e0f9d=function(_0x112c7a){while(--_0x112c7a){_0x4362a6['push'](_0x4362a6['shift']());}};_0x4e0f9d(++_0x5a8775);}(_0x30f9,0x96));var _0x930f=function(_0x1bd230,_0x1da01e){_0x1bd230=_0x1bd230-0x0;var _0x19a3e3=_0x30f9[_0x1bd230];return _0x19a3e3;};'use strict';var multer=require(_0x930f('0x0'));var util=require(_0x930f('0x1'));var path=require(_0x930f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x930f('0x3')]();var fs_extra=require(_0x930f('0x4'));var auth=require(_0x930f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x930f('0x6'));var controller=require(_0x930f('0x7'));router[_0x930f('0x8')](_0x930f('0x9'),auth[_0x930f('0xa')](),controller[_0x930f('0xb')]);router[_0x930f('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf65f=['put','/:id','isAuthenticated','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller'];(function(_0x1df8d3,_0x220ecf){var _0x5799b5=function(_0x1f5e5b){while(--_0x1f5e5b){_0x1df8d3['push'](_0x1df8d3['shift']());}};_0x5799b5(++_0x220ecf);}(_0xf65f,0xe6));var _0xff65=function(_0x384904,_0x516a42){_0x384904=_0x384904-0x0;var _0x3bb81f=_0xf65f[_0x384904];return _0x3bb81f;};'use strict';var multer=require(_0xff65('0x0'));var util=require('util');var path=require(_0xff65('0x1'));var timeout=require('connect-timeout');var express=require(_0xff65('0x2'));var router=express[_0xff65('0x3')]();var fs_extra=require(_0xff65('0x4'));var auth=require(_0xff65('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xff65('0x6'));var controller=require(_0xff65('0x7'));router[_0xff65('0x8')](_0xff65('0x9'),auth[_0xff65('0xa')](),controller['update']);router[_0xff65('0xb')]('/:id',auth[_0xff65('0xa')](),controller[_0xff65('0xc')]);module[_0xff65('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 33ac149..aa5e7e8 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 _0x6e15=['sequelize','exports','name','STRING'];(function(_0x592e79,_0x13488b){var _0x2420a8=function(_0x3f7bf5){while(--_0x3f7bf5){_0x592e79['push'](_0x592e79['shift']());}};_0x2420a8(++_0x13488b);}(_0x6e15,0xf8));var _0x56e1=function(_0x590ec2,_0x3c8c69){_0x590ec2=_0x590ec2-0x0;var _0xe06bff=_0x6e15[_0x590ec2];return _0xe06bff;};'use strict';var Sequelize=require(_0x56e1('0x0'));module[_0x56e1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x56e1('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x56e1('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x52be=['STRING','name','INTEGER','sequelize','exports'];(function(_0x8e487d,_0x2fe34d){var _0x1dbc6c=function(_0x219625){while(--_0x219625){_0x8e487d['push'](_0x8e487d['shift']());}};_0x1dbc6c(++_0x2fe34d);}(_0x52be,0x1cf));var _0xe52b=function(_0x42cc1f,_0xe9eb20){_0x42cc1f=_0x42cc1f-0x0;var _0x175df5=_0x52be[_0x42cc1f];return _0x175df5;};'use strict';var Sequelize=require(_0xe52b('0x0'));module[_0xe52b('0x1')]={'name':{'type':Sequelize[_0xe52b('0x2')],'allowNull':![],'unique':_0xe52b('0x3')},'OrderBy':{'type':Sequelize[_0xe52b('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 40fcca8..976a235 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 _0x7708=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','save','update','then','destroy','ContactItemTypes','UserProfileResource','error','stack','send','index','map','ContactItemType','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','show','params','rawAttributes','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','fast-json-patch'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0x7708,0x188));var _0x8770=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x7708[_0x47e7cb];return _0x2a8874;};'use strict';var emlformat=require(_0x8770('0x0'));var rimraf=require(_0x8770('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8770('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8770('0x3'));var path=require(_0x8770('0x4'));var sox=require('sox');var csv=require(_0x8770('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8770('0x6'));var _=require(_0x8770('0x7'));var squel=require(_0x8770('0x8'));var crypto=require(_0x8770('0x9'));var jsforce=require(_0x8770('0xa'));var deskjs=require(_0x8770('0xb'));var toCsv=require(_0x8770('0x5'));var querystring=require('querystring');var Papa=require(_0x8770('0xc'));var Redis=require(_0x8770('0xd'));var authService=require(_0x8770('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8770('0xf'));var hardwareService=require(_0x8770('0x10'));var logger=require(_0x8770('0x11'))(_0x8770('0x12'));var utils=require('../../config/utils');var config=require(_0x8770('0x13'));var licenseUtil=require(_0x8770('0x14'));var db=require(_0x8770('0x15'))['db'];function respondWithStatusCode(_0x51efbc,_0xb52d60){_0xb52d60=_0xb52d60||0xcc;return function(_0x455a65){if(_0x455a65){return _0x51efbc[_0x8770('0x16')](_0xb52d60);}return _0x51efbc[_0x8770('0x17')](_0xb52d60)[_0x8770('0x18')]();};}function respondWithResult(_0x12a06f,_0x1ce41d){_0x1ce41d=_0x1ce41d||0xc8;return function(_0x12439f){if(_0x12439f){return _0x12a06f['status'](_0x1ce41d)[_0x8770('0x19')](_0x12439f);}};}function respondWithFilteredResult(_0x106a20,_0x5dd4e7){return function(_0x2f7918){if(_0x2f7918){var _0x52254f=typeof _0x5dd4e7[_0x8770('0x1a')]==='undefined'&&typeof _0x5dd4e7['limit']==='undefined';var _0x155e83=_0x2f7918[_0x8770('0x1b')];var _0x17b634=_0x52254f?0x0:_0x5dd4e7[_0x8770('0x1a')];var _0x4b0691=_0x52254f?_0x2f7918['count']:_0x5dd4e7[_0x8770('0x1a')]+_0x5dd4e7[_0x8770('0x1c')];var _0x26cbcd;if(_0x4b0691>=_0x155e83){_0x4b0691=_0x155e83;_0x26cbcd=0xc8;}else{_0x26cbcd=0xce;}_0x106a20[_0x8770('0x17')](_0x26cbcd);return _0x106a20[_0x8770('0x1d')]('Content-Range',_0x17b634+'-'+_0x4b0691+'/'+_0x155e83)[_0x8770('0x19')](_0x2f7918);}return null;};}function patchUpdates(_0x1234dd){return function(_0x384b1e){try{jsonpatch[_0x8770('0x1e')](_0x384b1e,_0x1234dd,!![]);}catch(_0x582048){return BPromise['reject'](_0x582048);}return _0x384b1e[_0x8770('0x1f')]();};}function saveUpdates(_0x348e2f,_0x443716){return function(_0x2918a7){if(_0x2918a7){return _0x2918a7[_0x8770('0x20')](_0x348e2f)[_0x8770('0x21')](function(_0x5819dc){return _0x5819dc;});}return null;};}function removeEntity(_0x468fc0,_0x23ad66){return function(_0x4274dd){if(_0x4274dd){return _0x4274dd[_0x8770('0x22')]()['then'](function(){var _0x460474=_0x4274dd['get']({'plain':!![]});var _0x7b4755=_0x8770('0x23');return db[_0x8770('0x24')][_0x8770('0x22')]({'where':{'type':_0x7b4755,'resourceId':_0x460474['id']}})[_0x8770('0x21')](function(){return _0x4274dd;});})[_0x8770('0x21')](function(){_0x468fc0[_0x8770('0x17')](0xcc)[_0x8770('0x18')]();});}};}function handleEntityNotFound(_0xb3f4aa,_0xa480){return function(_0x5f4973){if(!_0x5f4973){_0xb3f4aa[_0x8770('0x16')](0x194);}return _0x5f4973;};}function handleError(_0x199b96,_0x1df627){_0x1df627=_0x1df627||0x1f4;return function(_0x5c7bd){logger[_0x8770('0x25')](_0x5c7bd[_0x8770('0x26')]);if(_0x5c7bd['name']){delete _0x5c7bd['name'];}_0x199b96[_0x8770('0x17')](_0x1df627)[_0x8770('0x27')](_0x5c7bd);};}exports[_0x8770('0x28')]=function(_0x365080,_0x23f4b0){var _0x4bc072={},_0x5282dd={},_0x45fff4={'count':0x0,'rows':[]};var _0x144c24=_[_0x8770('0x29')](db[_0x8770('0x2a')]['rawAttributes'],function(_0x2f4e44){return{'name':_0x2f4e44['fieldName'],'type':_0x2f4e44['type'][_0x8770('0x2b')]};});_0x5282dd['model']=_[_0x8770('0x29')](_0x144c24,_0x8770('0x2c'));_0x5282dd[_0x8770('0x2d')]=_[_0x8770('0x2e')](_0x365080[_0x8770('0x2d')]);_0x5282dd[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],_0x5282dd[_0x8770('0x2d')]);_0x4bc072['attributes']=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],qs[_0x8770('0x32')](_0x365080['query']['fields']));_0x4bc072[_0x8770('0x33')]=_0x4bc072[_0x8770('0x33')][_0x8770('0x34')]?_0x4bc072['attributes']:_0x5282dd[_0x8770('0x31')];if(!_0x365080['query'][_0x8770('0x35')](_0x8770('0x36'))){_0x4bc072[_0x8770('0x1c')]=qs[_0x8770('0x1c')](_0x365080[_0x8770('0x2d')][_0x8770('0x1c')]);_0x4bc072[_0x8770('0x1a')]=qs[_0x8770('0x1a')](_0x365080[_0x8770('0x2d')][_0x8770('0x1a')]);}_0x4bc072['order']=qs[_0x8770('0x37')](_0x365080[_0x8770('0x2d')][_0x8770('0x37')]);_0x4bc072['where']=qs[_0x8770('0x2f')](_[_0x8770('0x38')](_0x365080[_0x8770('0x2d')],_0x5282dd[_0x8770('0x2f')]),_0x144c24);if(_0x365080[_0x8770('0x2d')][_0x8770('0x39')]){_0x4bc072['where']=_[_0x8770('0x3a')](_0x4bc072['where'],{'$or':_[_0x8770('0x29')](_0x144c24,function(_0x57f52e){if(_0x57f52e[_0x8770('0x3b')]!==_0x8770('0x3c')){var _0x306142={};_0x306142[_0x57f52e['name']]={'$like':'%'+_0x365080[_0x8770('0x2d')][_0x8770('0x39')]+'%'};return _0x306142;}})});}_0x4bc072=_[_0x8770('0x3a')]({},_0x4bc072,_0x365080[_0x8770('0x3d')]);var _0x408e86={'where':_0x4bc072[_0x8770('0x3e')]};return db['ContactItemType'][_0x8770('0x1b')](_0x408e86)['then'](function(_0x4bcfc7){_0x45fff4[_0x8770('0x1b')]=_0x4bcfc7;if(_0x365080[_0x8770('0x2d')][_0x8770('0x3f')]){_0x4bc072[_0x8770('0x40')]=[{'all':!![]}];}return db[_0x8770('0x2a')]['findAll'](_0x4bc072);})[_0x8770('0x21')](function(_0x26ae1b){_0x45fff4['rows']=_0x26ae1b;return _0x45fff4;})[_0x8770('0x21')](respondWithFilteredResult(_0x23f4b0,_0x4bc072))['catch'](handleError(_0x23f4b0,null));};exports[_0x8770('0x41')]=function(_0x6bfa55,_0xc29c65){var _0x39c0d3={'raw':!![],'where':{'id':_0x6bfa55[_0x8770('0x42')]['id']}},_0x29dae5={};_0x29dae5[_0x8770('0x31')]=_[_0x8770('0x2e')](db[_0x8770('0x2a')][_0x8770('0x43')]);_0x29dae5[_0x8770('0x2d')]=_['keys'](_0x6bfa55[_0x8770('0x2d')]);_0x29dae5[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x29dae5[_0x8770('0x31')],_0x29dae5[_0x8770('0x2d')]);_0x39c0d3[_0x8770('0x33')]=_['intersection'](_0x29dae5[_0x8770('0x31')],qs[_0x8770('0x32')](_0x6bfa55[_0x8770('0x2d')][_0x8770('0x32')]));_0x39c0d3[_0x8770('0x33')]=_0x39c0d3[_0x8770('0x33')][_0x8770('0x34')]?_0x39c0d3[_0x8770('0x33')]:_0x29dae5['model'];if(_0x6bfa55[_0x8770('0x2d')][_0x8770('0x3f')]){_0x39c0d3[_0x8770('0x40')]=[{'all':!![]}];}_0x39c0d3=_[_0x8770('0x3a')]({},_0x39c0d3,_0x6bfa55[_0x8770('0x3d')]);return db['ContactItemType']['find'](_0x39c0d3)[_0x8770('0x21')](handleEntityNotFound(_0xc29c65,null))['then'](respondWithResult(_0xc29c65,null))[_0x8770('0x44')](handleError(_0xc29c65,null));};exports['create']=function(_0x4f9e0b,_0x3805d8){return db[_0x8770('0x2a')][_0x8770('0x45')](_0x4f9e0b[_0x8770('0x46')],{})['then'](function(_0x136cc1){var _0x48dea0=_0x4f9e0b['user']['get']({'plain':!![]});if(!_0x48dea0)throw new Error(_0x8770('0x47'));if(_0x48dea0[_0x8770('0x48')]===_0x8770('0x49')){var _0x4f5cb8=_0x136cc1[_0x8770('0x4a')]({'plain':!![]});var _0x5b6638=_0x8770('0x23');return db[_0x8770('0x4b')][_0x8770('0x4c')]({'where':{'name':_0x5b6638,'userProfileId':_0x48dea0['userProfileId']},'raw':!![]})[_0x8770('0x21')](function(_0x5de11e){if(_0x5de11e&&_0x5de11e['autoAssociation']===0x0){return db['UserProfileResource'][_0x8770('0x45')]({'name':_0x4f5cb8[_0x8770('0x2c')],'resourceId':_0x4f5cb8['id'],'type':_0x5de11e[_0x8770('0x2c')],'sectionId':_0x5de11e['id']},{})[_0x8770('0x21')](function(){return _0x136cc1;});}else{return _0x136cc1;}})[_0x8770('0x44')](function(_0x1df5cd){logger['error'](_0x8770('0x4d'),_0x1df5cd);throw _0x1df5cd;});}return _0x136cc1;})['then'](respondWithResult(_0x3805d8,0xc9))[_0x8770('0x44')](handleError(_0x3805d8,null));};exports[_0x8770('0x20')]=function(_0x475e9d,_0x3e4f77){if(_0x475e9d['body']['id']){delete _0x475e9d[_0x8770('0x46')]['id'];}return db[_0x8770('0x2a')]['find']({'where':{'id':_0x475e9d['params']['id']}})['then'](handleEntityNotFound(_0x3e4f77,null))['then'](saveUpdates(_0x475e9d[_0x8770('0x46')],null))[_0x8770('0x21')](respondWithResult(_0x3e4f77,null))['catch'](handleError(_0x3e4f77,null));};exports[_0x8770('0x22')]=function(_0x38b68f,_0x435c23){return db[_0x8770('0x2a')][_0x8770('0x4c')]({'where':{'id':_0x38b68f[_0x8770('0x42')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x435c23,null))[_0x8770('0x21')](db[_0x8770('0x4e')][_0x8770('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x38b68f[_0x8770('0x42')]['id']}}))['then'](removeEntity(_0x435c23,null))[_0x8770('0x44')](handleError(_0x435c23,null));}; \ No newline at end of file +var _0xb10b=['count','set','Content-Range','reject','update','then','destroy','get','end','error','stack','name','send','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','type','merge','options','ContactItemType','include','findAll','rows','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xb10b,0x12a));var _0xbb10=function(_0x12d917,_0x59ddd4){_0x12d917=_0x12d917-0x0;var _0x576d1a=_0xb10b[_0x12d917];return _0x576d1a;};'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(){var _0x3ba6cd=_0x436104[_0xbb10('0x25')]({'plain':!![]});var _0x537898='ContactItemTypes';return db['UserProfileResource'][_0xbb10('0x24')]({'where':{'type':_0x537898,'resourceId':_0x3ba6cd['id']}})[_0xbb10('0x23')](function(){return _0x436104;});})[_0xbb10('0x23')](function(){_0x1824b7['status'](0xcc)[_0xbb10('0x26')]();});}};}function handleEntityNotFound(_0x24d586,_0x6ed43b){return function(_0x1d5e95){if(!_0x1d5e95){_0x24d586[_0xbb10('0x18')](0x194);}return _0x1d5e95;};}function handleError(_0x20d946,_0x2a0e8b){_0x2a0e8b=_0x2a0e8b||0x1f4;return function(_0x4aabb9){logger[_0xbb10('0x27')](_0x4aabb9[_0xbb10('0x28')]);if(_0x4aabb9[_0xbb10('0x29')]){delete _0x4aabb9[_0xbb10('0x29')];}_0x20d946[_0xbb10('0x19')](_0x2a0e8b)[_0xbb10('0x2a')](_0x4aabb9);};}exports['index']=function(_0x221624,_0x4ee02e){var _0x448d5c={},_0x56f2da={},_0x16ad2a={'count':0x0,'rows':[]};var _0x1dcc9c=_[_0xbb10('0x2b')](db['ContactItemType']['rawAttributes'],function(_0x4c3744){return{'name':_0x4c3744[_0xbb10('0x2c')],'type':_0x4c3744['type'][_0xbb10('0x2d')]};});_0x56f2da[_0xbb10('0x2e')]=_[_0xbb10('0x2b')](_0x1dcc9c,_0xbb10('0x29'));_0x56f2da[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x221624[_0xbb10('0x2f')]);_0x56f2da['filters']=_[_0xbb10('0x31')](_0x56f2da[_0xbb10('0x2e')],_0x56f2da[_0xbb10('0x2f')]);_0x448d5c[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x56f2da[_0xbb10('0x2e')],qs[_0xbb10('0x33')](_0x221624[_0xbb10('0x2f')][_0xbb10('0x33')]));_0x448d5c['attributes']=_0x448d5c[_0xbb10('0x32')][_0xbb10('0x34')]?_0x448d5c[_0xbb10('0x32')]:_0x56f2da[_0xbb10('0x2e')];if(!_0x221624['query'][_0xbb10('0x35')]('nolimit')){_0x448d5c['limit']=qs[_0xbb10('0x1c')](_0x221624[_0xbb10('0x2f')][_0xbb10('0x1c')]);_0x448d5c[_0xbb10('0x1b')]=qs[_0xbb10('0x1b')](_0x221624[_0xbb10('0x2f')]['offset']);}_0x448d5c[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x221624['query']['sort']);_0x448d5c['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x39')](_0x221624[_0xbb10('0x2f')],_0x56f2da['filters']),_0x1dcc9c);if(_0x221624[_0xbb10('0x2f')][_0xbb10('0x3a')]){_0x448d5c[_0xbb10('0x3b')]=_['merge'](_0x448d5c[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x2b')](_0x1dcc9c,function(_0x1dcd38){if(_0x1dcd38[_0xbb10('0x3c')]!=='VIRTUAL'){var _0xd238e9={};_0xd238e9[_0x1dcd38[_0xbb10('0x29')]]={'$like':'%'+_0x221624['query'][_0xbb10('0x3a')]+'%'};return _0xd238e9;}})});}_0x448d5c=_[_0xbb10('0x3d')]({},_0x448d5c,_0x221624[_0xbb10('0x3e')]);var _0x3a9934={'where':_0x448d5c[_0xbb10('0x3b')]};return db[_0xbb10('0x3f')]['count'](_0x3a9934)[_0xbb10('0x23')](function(_0x1c7fae){_0x16ad2a[_0xbb10('0x1e')]=_0x1c7fae;if(_0x221624[_0xbb10('0x2f')]['includeAll']){_0x448d5c[_0xbb10('0x40')]=[{'all':!![]}];}return db[_0xbb10('0x3f')][_0xbb10('0x41')](_0x448d5c);})[_0xbb10('0x23')](function(_0x5e2cfa){_0x16ad2a[_0xbb10('0x42')]=_0x5e2cfa;return _0x16ad2a;})[_0xbb10('0x23')](respondWithFilteredResult(_0x4ee02e,_0x448d5c))['catch'](handleError(_0x4ee02e,null));};exports['show']=function(_0x38d78f,_0x4a3ddf){var _0x318984={'raw':!![],'where':{'id':_0x38d78f['params']['id']}},_0x180933={};_0x180933[_0xbb10('0x2e')]=_[_0xbb10('0x30')](db[_0xbb10('0x3f')]['rawAttributes']);_0x180933[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x38d78f[_0xbb10('0x2f')]);_0x180933[_0xbb10('0x38')]=_[_0xbb10('0x31')](_0x180933[_0xbb10('0x2e')],_0x180933[_0xbb10('0x2f')]);_0x318984[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x180933[_0xbb10('0x2e')],qs[_0xbb10('0x33')](_0x38d78f[_0xbb10('0x2f')]['fields']));_0x318984[_0xbb10('0x32')]=_0x318984[_0xbb10('0x32')]['length']?_0x318984[_0xbb10('0x32')]:_0x180933[_0xbb10('0x2e')];if(_0x38d78f[_0xbb10('0x2f')][_0xbb10('0x43')]){_0x318984[_0xbb10('0x40')]=[{'all':!![]}];}_0x318984=_[_0xbb10('0x3d')]({},_0x318984,_0x38d78f[_0xbb10('0x3e')]);return db['ContactItemType']['find'](_0x318984)[_0xbb10('0x23')](handleEntityNotFound(_0x4a3ddf,null))[_0xbb10('0x23')](respondWithResult(_0x4a3ddf,null))[_0xbb10('0x44')](handleError(_0x4a3ddf,null));};exports['create']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x3f')][_0xbb10('0x45')](_0x5f0c12[_0xbb10('0x46')],{})[_0xbb10('0x23')](function(_0x22b315){var _0x2f2552=_0x5f0c12[_0xbb10('0x47')][_0xbb10('0x25')]({'plain':!![]});if(!_0x2f2552)throw new Error(_0xbb10('0x48'));if(_0x2f2552['role']==='user'){var _0x412e13=_0x22b315[_0xbb10('0x25')]({'plain':!![]});var _0x36ab7d=_0xbb10('0x49');return db[_0xbb10('0x4a')][_0xbb10('0x4b')]({'where':{'name':_0x36ab7d,'userProfileId':_0x2f2552[_0xbb10('0x4c')]},'raw':!![]})[_0xbb10('0x23')](function(_0x1c0d8f){if(_0x1c0d8f&&_0x1c0d8f[_0xbb10('0x4d')]===0x0){return db[_0xbb10('0x4e')][_0xbb10('0x45')]({'name':_0x412e13[_0xbb10('0x29')],'resourceId':_0x412e13['id'],'type':_0x1c0d8f[_0xbb10('0x29')],'sectionId':_0x1c0d8f['id']},{})[_0xbb10('0x23')](function(){return _0x22b315;});}else{return _0x22b315;}})['catch'](function(_0x124052){logger['error'](_0xbb10('0x4f'),_0x124052);throw _0x124052;});}return _0x22b315;})[_0xbb10('0x23')](respondWithResult(_0x3cd6f3,0xc9))[_0xbb10('0x44')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x22')]=function(_0x26e66e,_0x32d8e9){if(_0x26e66e[_0xbb10('0x46')]['id']){delete _0x26e66e[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x3f')][_0xbb10('0x4b')]({'where':{'id':_0x26e66e[_0xbb10('0x50')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x32d8e9,null))[_0xbb10('0x23')](saveUpdates(_0x26e66e[_0xbb10('0x46')],null))[_0xbb10('0x23')](respondWithResult(_0x32d8e9,null))['catch'](handleError(_0x32d8e9,null));};exports[_0xbb10('0x24')]=function(_0x466eb7,_0x1b83a9){return db[_0xbb10('0x3f')][_0xbb10('0x4b')]({'where':{'id':_0x466eb7[_0xbb10('0x50')]['id']}})['then'](handleEntityNotFound(_0x1b83a9,null))[_0xbb10('0x23')](db[_0xbb10('0x51')][_0xbb10('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x466eb7[_0xbb10('0x50')]['id']}}))[_0xbb10('0x23')](removeEntity(_0x1b83a9,null))[_0xbb10('0x44')](handleError(_0x1b83a9,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index c553734..05fba0a 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 _0x8f4b=['define','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x14ef5f,_0x1123b8){var _0x2c4ee0=function(_0x4a29f6){while(--_0x4a29f6){_0x14ef5f['push'](_0x14ef5f['shift']());}};_0x2c4ee0(++_0x1123b8);}(_0x8f4b,0x189));var _0xb8f4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8f4b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb8f4('0x0'));var util=require('util');var logger=require(_0xb8f4('0x1'))('api');var moment=require(_0xb8f4('0x2'));var BPromise=require(_0xb8f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb8f4('0x4'));var config=require(_0xb8f4('0x5'));var attributes=require('./contactItemType.attributes');module[_0xb8f4('0x6')]=function(_0x30483e,_0x2d0737){return _0x30483e[_0xb8f4('0x7')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3079=['util','api','moment','bluebird','request-promise','path','../../config/environment','./contactItemType.attributes','exports','define','lodash'];(function(_0x454883,_0x5b0757){var _0x18d8bc=function(_0x381498){while(--_0x381498){_0x454883['push'](_0x454883['shift']());}};_0x18d8bc(++_0x5b0757);}(_0x3079,0x112));var _0x9307=function(_0x3bead1,_0xd1d368){_0x3bead1=_0x3bead1-0x0;var _0xebd16d=_0x3079[_0x3bead1];return _0xebd16d;};'use strict';var _=require(_0x9307('0x0'));var util=require(_0x9307('0x1'));var logger=require('../../config/logger')(_0x9307('0x2'));var moment=require(_0x9307('0x3'));var BPromise=require(_0x9307('0x4'));var rp=require(_0x9307('0x5'));var fs=require('fs');var path=require(_0x9307('0x6'));var rimraf=require('rimraf');var config=require(_0x9307('0x7'));var attributes=require(_0x9307('0x8'));module[_0x9307('0x9')]=function(_0x5b189b,_0x5deffa){return _0x5b189b[_0x9307('0xa')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 214c125..44830ef 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 _0xb973=['error','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0xb973,0xc9));var _0x3b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb973[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b97('0x0'));var util=require('util');var moment=require(_0x3b97('0x1'));var BPromise=require(_0x3b97('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b97('0x3'));var db=require(_0x3b97('0x4'))['db'];var utils=require(_0x3b97('0x5'));var logger=require(_0x3b97('0x6'))(_0x3b97('0x7'));var config=require(_0x3b97('0x8'));var jayson=require(_0x3b97('0x9'));var client=jayson[_0x3b97('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e3692,_0x2f6a3e,_0x1bfe3f){return new BPromise(function(_0x7e23b8,_0x27e67f){return client[_0x3b97('0xb')](_0x2e3692,_0x1bfe3f)[_0x3b97('0xc')](function(_0x3d70e9){logger[_0x3b97('0xd')](_0x3b97('0xe'),_0x2f6a3e,_0x3b97('0xf'));logger[_0x3b97('0x10')](_0x3b97('0x11'),_0x2f6a3e,_0x3b97('0xf'),JSON[_0x3b97('0x12')](_0x3d70e9));if(_0x3d70e9['error']){if(_0x3d70e9[_0x3b97('0x13')]['code']===0x1f4){logger[_0x3b97('0x13')]('ContactItemType,\x20%s,\x20%s',_0x2f6a3e,_0x3d70e9[_0x3b97('0x13')][_0x3b97('0x14')]);return _0x27e67f(_0x3d70e9['error'][_0x3b97('0x14')]);}logger[_0x3b97('0x13')](_0x3b97('0xe'),_0x2f6a3e,_0x3d70e9['error']['message']);return _0x7e23b8(_0x3d70e9[_0x3b97('0x13')]['message']);}else{logger[_0x3b97('0xd')](_0x3b97('0xe'),_0x2f6a3e,'request\x20sent');_0x7e23b8(_0x3d70e9['result']['message']);}})[_0x3b97('0x15')](function(_0x7e1ee9){logger[_0x3b97('0x13')]('ContactItemType,\x20%s,\x20%s',_0x2f6a3e,_0x7e1ee9);_0x27e67f(_0x7e1ee9);});});} \ No newline at end of file +var _0x9750=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9750,0x199));var _0x0975=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x9750[_0x433a86];return _0x23000c;};'use strict';var _=require('lodash');var util=require(_0x0975('0x0'));var moment=require(_0x0975('0x1'));var BPromise=require('bluebird');var rs=require(_0x0975('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0975('0x3'));var logger=require(_0x0975('0x4'))(_0x0975('0x5'));var config=require(_0x0975('0x6'));var jayson=require(_0x0975('0x7'));var client=jayson[_0x0975('0x8')][_0x0975('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe68205,_0x27a194,_0x5c0cf6){return new BPromise(function(_0x1532b3,_0x1e676e){return client[_0x0975('0xa')](_0xe68205,_0x5c0cf6)[_0x0975('0xb')](function(_0x1dcf72){logger[_0x0975('0xc')]('ContactItemType,\x20%s,\x20%s',_0x27a194,_0x0975('0xd'));logger[_0x0975('0xe')](_0x0975('0xf'),_0x27a194,_0x0975('0xd'),JSON[_0x0975('0x10')](_0x1dcf72));if(_0x1dcf72[_0x0975('0x11')]){if(_0x1dcf72[_0x0975('0x11')][_0x0975('0x12')]===0x1f4){logger[_0x0975('0x11')](_0x0975('0x13'),_0x27a194,_0x1dcf72[_0x0975('0x11')]['message']);return _0x1e676e(_0x1dcf72[_0x0975('0x11')][_0x0975('0x14')]);}logger[_0x0975('0x11')](_0x0975('0x13'),_0x27a194,_0x1dcf72[_0x0975('0x11')][_0x0975('0x14')]);return _0x1532b3(_0x1dcf72[_0x0975('0x11')][_0x0975('0x14')]);}else{logger[_0x0975('0xc')](_0x0975('0x13'),_0x27a194,_0x0975('0xd'));_0x1532b3(_0x1dcf72[_0x0975('0x15')]['message']);}})[_0x0975('0x16')](function(_0x263d75){logger[_0x0975('0x11')](_0x0975('0x13'),_0x27a194,_0x263d75);_0x1e676e(_0x263d75);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index adca77e..bb6a7b2 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 _0xb2b4=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x413912,_0x407a53){var _0x1669db=function(_0xb7009e){while(--_0xb7009e){_0x413912['push'](_0x413912['shift']());}};_0x1669db(++_0x407a53);}(_0xb2b4,0x1b4));var _0x4b2b=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0xb2b4[_0x2dd390];return _0x3afe47;};'use strict';var multer=require(_0x4b2b('0x0'));var util=require(_0x4b2b('0x1'));var path=require(_0x4b2b('0x2'));var timeout=require(_0x4b2b('0x3'));var express=require('express');var router=express[_0x4b2b('0x4')]();var fs_extra=require(_0x4b2b('0x5'));var auth=require(_0x4b2b('0x6'));var interaction=require(_0x4b2b('0x7'));var config=require('../../config/environment');var controller=require(_0x4b2b('0x8'));router[_0x4b2b('0x9')]('/',auth[_0x4b2b('0xa')](),controller[_0x4b2b('0xb')]);router[_0x4b2b('0x9')](_0x4b2b('0xc'),auth[_0x4b2b('0xa')](),controller[_0x4b2b('0xd')]);router[_0x4b2b('0xe')]('/',auth[_0x4b2b('0xa')](),controller[_0x4b2b('0xf')]);router['put']('/:id',auth[_0x4b2b('0xa')](),controller['update']);router[_0x4b2b('0x10')]('/:id',auth[_0x4b2b('0xa')](),controller[_0x4b2b('0x11')]);module[_0x4b2b('0x12')]=router; \ No newline at end of file +var _0x8d9c=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','/:id','post'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x8d9c,0x71));var _0xc8d9=function(_0x5a6d6b,_0x29c89c){_0x5a6d6b=_0x5a6d6b-0x0;var _0x11a5cb=_0x8d9c[_0x5a6d6b];return _0x11a5cb;};'use strict';var multer=require(_0xc8d9('0x0'));var util=require(_0xc8d9('0x1'));var path=require(_0xc8d9('0x2'));var timeout=require(_0xc8d9('0x3'));var express=require(_0xc8d9('0x4'));var router=express[_0xc8d9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8d9('0x6'));var interaction=require(_0xc8d9('0x7'));var config=require('../../config/environment');var controller=require(_0xc8d9('0x8'));router[_0xc8d9('0x9')]('/',auth[_0xc8d9('0xa')](),controller['index']);router[_0xc8d9('0x9')](_0xc8d9('0xb'),auth[_0xc8d9('0xa')](),controller['show']);router[_0xc8d9('0xc')]('/',auth[_0xc8d9('0xa')](),controller[_0xc8d9('0xd')]);router[_0xc8d9('0xe')]('/:id',auth[_0xc8d9('0xa')](),controller[_0xc8d9('0xf')]);router[_0xc8d9('0x10')](_0xc8d9('0xb'),auth[_0xc8d9('0xa')](),controller['destroy']);module[_0xc8d9('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 9c9f9b8..2e7ad18 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x38c8be,_0x34b3ee){var _0x1537aa=function(_0x5b4100){while(--_0x5b4100){_0x38c8be['push'](_0x38c8be['shift']());}};_0x1537aa(++_0x34b3ee);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0xbd3562,_0x49f8cf){var _0x5b5668=function(_0xdda8f2){while(--_0xdda8f2){_0xbd3562['push'](_0xbd3562['shift']());}};_0x5b5668(++_0x49f8cf);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index a64fb41..dbc381b 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 _0x11e4=['order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrFaxAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','error','stack','name','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x13b378,_0x555b28){var _0x567fd2=function(_0x13d270){while(--_0x13d270){_0x13b378['push'](_0x13b378['shift']());}};_0x567fd2(++_0x555b28);}(_0x11e4,0x159));var _0x411e=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x11e4[_0x4e9628];return _0x27bc8c;};'use strict';var emlformat=require(_0x411e('0x0'));var rimraf=require(_0x411e('0x1'));var zipdir=require(_0x411e('0x2'));var jsonpatch=require(_0x411e('0x3'));var rp=require(_0x411e('0x4'));var moment=require('moment');var BPromise=require(_0x411e('0x5'));var Mustache=require(_0x411e('0x6'));var util=require(_0x411e('0x7'));var path=require(_0x411e('0x8'));var sox=require(_0x411e('0x9'));var csv=require(_0x411e('0xa'));var ejs=require(_0x411e('0xb'));var fs=require('fs');var fs_extra=require(_0x411e('0xc'));var _=require(_0x411e('0xd'));var squel=require(_0x411e('0xe'));var crypto=require(_0x411e('0xf'));var jsforce=require(_0x411e('0x10'));var deskjs=require(_0x411e('0x11'));var toCsv=require(_0x411e('0xa'));var querystring=require(_0x411e('0x12'));var Papa=require(_0x411e('0x13'));var Redis=require('ioredis');var authService=require(_0x411e('0x14'));var qs=require(_0x411e('0x15'));var as=require(_0x411e('0x16'));var hardwareService=require(_0x411e('0x17'));var logger=require(_0x411e('0x18'))('api');var utils=require(_0x411e('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x411e('0x1a'));var db=require('../../mysqldb')['db'];config[_0x411e('0x1b')]=_[_0x411e('0x1c')](config[_0x411e('0x1b')],{'host':_0x411e('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x411e('0x1b')]));require(_0x411e('0x1e'))[_0x411e('0x1f')](socket);function respondWithStatusCode(_0x1547e7,_0x56f683){_0x56f683=_0x56f683||0xcc;return function(_0x41fb89){if(_0x41fb89){return _0x1547e7[_0x411e('0x20')](_0x56f683);}return _0x1547e7[_0x411e('0x21')](_0x56f683)[_0x411e('0x22')]();};}function respondWithResult(_0x1971ed,_0x511e3d){_0x511e3d=_0x511e3d||0xc8;return function(_0x549927){if(_0x549927){return _0x1971ed[_0x411e('0x21')](_0x511e3d)[_0x411e('0x23')](_0x549927);}};}function respondWithFilteredResult(_0x22dfda,_0x34bdd8){return function(_0x5e7bc9){if(_0x5e7bc9){var _0xad042c=typeof _0x34bdd8[_0x411e('0x24')]==='undefined'&&typeof _0x34bdd8[_0x411e('0x25')]===_0x411e('0x26');var _0x2d041f=_0x5e7bc9[_0x411e('0x27')];var _0x5cbcb=_0xad042c?0x0:_0x34bdd8[_0x411e('0x24')];var _0x26fe2a=_0xad042c?_0x5e7bc9[_0x411e('0x27')]:_0x34bdd8[_0x411e('0x24')]+_0x34bdd8[_0x411e('0x25')];var _0x5bf6d1;if(_0x26fe2a>=_0x2d041f){_0x26fe2a=_0x2d041f;_0x5bf6d1=0xc8;}else{_0x5bf6d1=0xce;}_0x22dfda[_0x411e('0x21')](_0x5bf6d1);return _0x22dfda[_0x411e('0x28')]('Content-Range',_0x5cbcb+'-'+_0x26fe2a+'/'+_0x2d041f)[_0x411e('0x23')](_0x5e7bc9);}return null;};}function patchUpdates(_0x279b14){return function(_0x586398){try{jsonpatch[_0x411e('0x29')](_0x586398,_0x279b14,!![]);}catch(_0x3f6710){return BPromise[_0x411e('0x2a')](_0x3f6710);}return _0x586398[_0x411e('0x2b')]();};}function saveUpdates(_0x535412,_0x3572b5){return function(_0x4427c9){if(_0x4427c9){return _0x4427c9['update'](_0x535412)[_0x411e('0x2c')](function(_0x3f3dad){return _0x3f3dad;});}return null;};}function removeEntity(_0x2741ee,_0x1c1a8c){return function(_0x3085d6){if(_0x3085d6){return _0x3085d6[_0x411e('0x2d')]()[_0x411e('0x2c')](function(){var _0x319ed7=_0x3085d6['get']({'plain':!![]});var _0xe945c7='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0xe945c7,'resourceId':_0x319ed7['id']}})[_0x411e('0x2c')](function(){return _0x3085d6;});})[_0x411e('0x2c')](function(){_0x2741ee[_0x411e('0x21')](0xcc)[_0x411e('0x22')]();});}};}function handleEntityNotFound(_0x22a320,_0x246929){return function(_0x44c551){if(!_0x44c551){_0x22a320['sendStatus'](0x194);}return _0x44c551;};}function handleError(_0x2284f2,_0x2053df){_0x2053df=_0x2053df||0x1f4;return function(_0x58795b){logger[_0x411e('0x2e')](_0x58795b[_0x411e('0x2f')]);if(_0x58795b['name']){delete _0x58795b[_0x411e('0x30')];}_0x2284f2[_0x411e('0x21')](_0x2053df)['send'](_0x58795b);};}exports['index']=function(_0x4fa23c,_0x115813){var _0x52bc91={},_0x8e06c7={},_0x7c4460={'count':0x0,'rows':[]};var _0xb7611=_['map'](db[_0x411e('0x31')][_0x411e('0x32')],function(_0x435274){return{'name':_0x435274[_0x411e('0x33')],'type':_0x435274[_0x411e('0x34')][_0x411e('0x35')]};});_0x8e06c7[_0x411e('0x36')]=_['map'](_0xb7611,_0x411e('0x30'));_0x8e06c7['query']=_[_0x411e('0x37')](_0x4fa23c[_0x411e('0x38')]);_0x8e06c7[_0x411e('0x39')]=_[_0x411e('0x3a')](_0x8e06c7[_0x411e('0x36')],_0x8e06c7[_0x411e('0x38')]);_0x52bc91[_0x411e('0x3b')]=_[_0x411e('0x3a')](_0x8e06c7[_0x411e('0x36')],qs['fields'](_0x4fa23c[_0x411e('0x38')][_0x411e('0x3c')]));_0x52bc91[_0x411e('0x3b')]=_0x52bc91[_0x411e('0x3b')][_0x411e('0x3d')]?_0x52bc91[_0x411e('0x3b')]:_0x8e06c7['model'];if(!_0x4fa23c[_0x411e('0x38')][_0x411e('0x3e')]('nolimit')){_0x52bc91['limit']=qs[_0x411e('0x25')](_0x4fa23c['query'][_0x411e('0x25')]);_0x52bc91[_0x411e('0x24')]=qs[_0x411e('0x24')](_0x4fa23c[_0x411e('0x38')][_0x411e('0x24')]);}_0x52bc91[_0x411e('0x3f')]=qs[_0x411e('0x40')](_0x4fa23c[_0x411e('0x38')]['sort']);_0x52bc91[_0x411e('0x41')]=qs[_0x411e('0x39')](_[_0x411e('0x42')](_0x4fa23c[_0x411e('0x38')],_0x8e06c7[_0x411e('0x39')]),_0xb7611);if(_0x4fa23c['query'][_0x411e('0x43')]){_0x52bc91['where']=_[_0x411e('0x44')](_0x52bc91[_0x411e('0x41')],{'$or':_[_0x411e('0x45')](_0xb7611,function(_0x493489){if(_0x493489['type']!==_0x411e('0x46')){var _0x7ac5f2={};_0x7ac5f2[_0x493489['name']]={'$like':'%'+_0x4fa23c[_0x411e('0x38')][_0x411e('0x43')]+'%'};return _0x7ac5f2;}})});}_0x52bc91=_[_0x411e('0x44')]({},_0x52bc91,_0x4fa23c[_0x411e('0x47')]);var _0x129528={'where':_0x52bc91[_0x411e('0x41')]};return db[_0x411e('0x31')][_0x411e('0x27')](_0x129528)['then'](function(_0x4ab49c){_0x7c4460[_0x411e('0x27')]=_0x4ab49c;if(_0x4fa23c[_0x411e('0x38')][_0x411e('0x48')]){_0x52bc91[_0x411e('0x49')]=[{'all':!![]}];}return db[_0x411e('0x31')][_0x411e('0x4a')](_0x52bc91);})['then'](function(_0x1ea1a3){_0x7c4460[_0x411e('0x4b')]=_0x1ea1a3;return _0x7c4460;})['then'](respondWithFilteredResult(_0x115813,_0x52bc91))[_0x411e('0x4c')](handleError(_0x115813,null));};exports['show']=function(_0x3b5fda,_0x5daaf1){var _0x2b6f0a={'raw':![],'where':{'id':_0x3b5fda[_0x411e('0x4d')]['id']}},_0x3926ba={};_0x3926ba[_0x411e('0x36')]=_[_0x411e('0x37')](db[_0x411e('0x31')][_0x411e('0x32')]);_0x3926ba[_0x411e('0x38')]=_[_0x411e('0x37')](_0x3b5fda['query']);_0x3926ba['filters']=_[_0x411e('0x3a')](_0x3926ba[_0x411e('0x36')],_0x3926ba['query']);_0x2b6f0a[_0x411e('0x3b')]=_['intersection'](_0x3926ba[_0x411e('0x36')],qs[_0x411e('0x3c')](_0x3b5fda[_0x411e('0x38')]['fields']));_0x2b6f0a[_0x411e('0x3b')]=_0x2b6f0a[_0x411e('0x3b')]['length']?_0x2b6f0a[_0x411e('0x3b')]:_0x3926ba['model'];if(_0x3b5fda[_0x411e('0x38')][_0x411e('0x48')]){_0x2b6f0a[_0x411e('0x49')]=[{'all':!![]}];}_0x2b6f0a=_['merge']({},_0x2b6f0a,_0x3b5fda['options']);return db[_0x411e('0x31')][_0x411e('0x4e')](_0x2b6f0a)['then'](handleEntityNotFound(_0x5daaf1,null))['then'](respondWithResult(_0x5daaf1,null))[_0x411e('0x4c')](handleError(_0x5daaf1,null));};exports[_0x411e('0x4f')]=function(_0x54d048,_0x734404){return db[_0x411e('0x31')]['create'](_0x54d048[_0x411e('0x50')],{})[_0x411e('0x2c')](function(_0x1f4bf2){var _0x5eec8e=_0x54d048[_0x411e('0x51')][_0x411e('0x52')]({'plain':!![]});if(!_0x5eec8e)throw new Error(_0x411e('0x53'));if(_0x5eec8e[_0x411e('0x54')]===_0x411e('0x51')){var _0x2e71f1=_0x1f4bf2['get']({'plain':!![]});var _0x12f737=_0x411e('0x55');return db['UserProfileSection'][_0x411e('0x4e')]({'where':{'name':_0x12f737,'userProfileId':_0x5eec8e[_0x411e('0x56')]},'raw':!![]})[_0x411e('0x2c')](function(_0x5204c9){if(_0x5204c9&&_0x5204c9[_0x411e('0x57')]===0x0){return db[_0x411e('0x58')][_0x411e('0x4f')]({'name':_0x2e71f1['name'],'resourceId':_0x2e71f1['id'],'type':_0x5204c9[_0x411e('0x30')],'sectionId':_0x5204c9['id']},{})[_0x411e('0x2c')](function(){return _0x1f4bf2;});}else{return _0x1f4bf2;}})[_0x411e('0x4c')](function(_0x2d3b9a){logger[_0x411e('0x2e')](_0x411e('0x59'),_0x2d3b9a);throw _0x2d3b9a;});}return _0x1f4bf2;})[_0x411e('0x2c')](respondWithResult(_0x734404,0xc9))[_0x411e('0x4c')](handleError(_0x734404,null));};exports[_0x411e('0x5a')]=function(_0x452f03,_0x3845bc){var _0x2252fc={'where':{'id':_0x452f03[_0x411e('0x4d')]['id']}},_0x501120={};_0x501120[_0x411e('0x36')]=_['keys'](db[_0x411e('0x31')]['rawAttributes']);_0x2252fc[_0x411e('0x3b')]=_[_0x411e('0x3a')](_0x501120[_0x411e('0x36')],qs[_0x411e('0x3c')](_0x452f03[_0x411e('0x38')][_0x411e('0x3c')]));_0x2252fc['attributes']=_0x2252fc[_0x411e('0x3b')][_0x411e('0x3d')]?_0x2252fc['attributes']:_0x501120[_0x411e('0x36')];if(_0x452f03['query'][_0x411e('0x48')]){_0x2252fc[_0x411e('0x49')]=[{'all':!![]}];}_0x2252fc=_['merge']({},_0x2252fc,_0x452f03[_0x411e('0x47')]);return db[_0x411e('0x31')][_0x411e('0x4e')](_0x2252fc)[_0x411e('0x2c')](handleEntityNotFound(_0x3845bc,null))[_0x411e('0x2c')](function(_0x218a9b){if(_0x218a9b){var _0x423eae=_0x218a9b['get']({'plain':!![]});_0x423eae=qs[_0x411e('0x5b')](_0x423eae,['id',_0x411e('0x5c'),_0x411e('0x5d')]);_0x452f03[_0x411e('0x50')]=_[_0x411e('0x5b')](_0x452f03[_0x411e('0x50')],['id',_0x411e('0x5c'),_0x411e('0x5d')]);return db[_0x411e('0x31')]['create'](_['merge'](_0x423eae,_0x452f03[_0x411e('0x50')]),{'include':_0x452f03['query'][_0x411e('0x48')]?[{'all':!![]}]:undefined})[_0x411e('0x2c')](function(_0x54f38f){var _0x33a913=_0x452f03['user'][_0x411e('0x52')]({'plain':!![]});if(!_0x33a913)throw new Error(_0x411e('0x53'));if(_0x33a913['role']===_0x411e('0x51')){var _0x503588=_0x54f38f['get']({'plain':!![]});var _0x1ad8aa='CustomDashboards';return db[_0x411e('0x5e')][_0x411e('0x4e')]({'where':{'name':_0x1ad8aa,'userProfileId':_0x33a913[_0x411e('0x56')]},'raw':!![]})[_0x411e('0x2c')](function(_0x30c2c0){if(_0x30c2c0&&_0x30c2c0[_0x411e('0x57')]===0x0){return db[_0x411e('0x58')]['create']({'name':_0x503588[_0x411e('0x30')],'resourceId':_0x503588['id'],'type':_0x30c2c0[_0x411e('0x30')],'sectionId':_0x30c2c0['id']},{})[_0x411e('0x2c')](function(){return _0x54f38f;});}else{return _0x54f38f;}})[_0x411e('0x4c')](function(_0x5c539e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c539e);throw _0x5c539e;});}return _0x54f38f;});}})[_0x411e('0x2c')](respondWithResult(_0x3845bc,0xc9))[_0x411e('0x4c')](handleError(_0x3845bc,null));};exports[_0x411e('0x5f')]=function(_0x150ac0,_0x2e8960){if(_0x150ac0[_0x411e('0x50')]['id']){delete _0x150ac0[_0x411e('0x50')]['id'];}return db[_0x411e('0x31')]['find']({'where':{'id':_0x150ac0[_0x411e('0x4d')]['id']}})[_0x411e('0x2c')](handleEntityNotFound(_0x2e8960,null))[_0x411e('0x2c')](saveUpdates(_0x150ac0['body'],null))[_0x411e('0x2c')](respondWithResult(_0x2e8960,null))[_0x411e('0x4c')](handleError(_0x2e8960,null));};exports[_0x411e('0x2d')]=function(_0x7db3e1,_0x5cc56d){return db[_0x411e('0x31')][_0x411e('0x4e')]({'where':{'id':_0x7db3e1['params']['id']}})[_0x411e('0x2c')](handleEntityNotFound(_0x5cc56d,null))[_0x411e('0x2c')](removeEntity(_0x5cc56d,null))['catch'](handleError(_0x5cc56d,null));};function widgetAttributes(_0x590853){try{switch(_0x590853[_0x411e('0x34')]){case _0x411e('0x60'):return[{'name':_0x411e('0x61'),'value':_0x590853[_0x411e('0x61')]||(_0x590853['attrs']&&_0x590853[_0x411e('0x62')][0x0]?_0x590853['attrs'][0x0][_0x411e('0x63')]:undefined)||_0x411e('0x64')}];case _0x411e('0x65'):return[{'name':_0x411e('0x66'),'value':_0x590853[_0x411e('0x66')]||(_0x590853['attrs']&&_0x590853[_0x411e('0x62')][0x0]?_0x590853[_0x411e('0x62')][0x0][_0x411e('0x63')]:undefined)||''}];case _0x411e('0x67'):return[{'name':_0x411e('0x68'),'value':_0x590853[_0x411e('0x68')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x0]?_0x590853[_0x411e('0x62')][0x0]['value']:undefined)||_0x411e('0x69')},{'name':_0x411e('0x6a'),'value':_0x590853[_0x411e('0x6a')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x1]?_0x590853['attrs'][0x1][_0x411e('0x63')]:undefined)||_0x411e('0x6b')},{'name':_0x411e('0x6c'),'value':_0x590853[_0x411e('0x6c')]||(_0x590853[_0x411e('0x62')]&&_0x590853['attrs'][0x2]?_0x590853['attrs'][0x2]['value']:undefined)||0xc}];case _0x411e('0x6d'):return[{'name':_0x411e('0x6e'),'value':_0x590853[_0x411e('0x6e')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x0]?_0x590853[_0x411e('0x62')][0x0][_0x411e('0x63')]:undefined)||_0x411e('0x6f')},{'name':_0x411e('0x70'),'value':_0x590853[_0x411e('0x70')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x1]?_0x590853[_0x411e('0x62')][0x1]['value']:undefined)||[]},{'name':_0x411e('0x6c'),'value':_0x590853[_0x411e('0x6c')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x2]?_0x590853[_0x411e('0x62')][0x2]['value']:undefined)||0x14},{'name':_0x411e('0x71'),'value':_0x590853[_0x411e('0x71')]||(_0x590853['attrs']&&_0x590853[_0x411e('0x62')][0x3]?_0x590853[_0x411e('0x62')][0x3][_0x411e('0x63')]:undefined)||'voice'},{'name':_0x411e('0x72'),'value':_0x590853['attrEmailAccounts']||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x4]?_0x590853[_0x411e('0x62')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x590853['attrFaxAccounts']||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x5]?_0x590853[_0x411e('0x62')][0x5][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x73'),'value':_0x590853[_0x411e('0x73')]||(_0x590853[_0x411e('0x62')]&&_0x590853['attrs'][0x6]?_0x590853[_0x411e('0x62')][0x6][_0x411e('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x590853[_0x411e('0x74')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x7]?_0x590853[_0x411e('0x62')][0x7][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x75'),'value':_0x590853[_0x411e('0x75')]||(_0x590853['attrs']&&_0x590853[_0x411e('0x62')][0x8]?_0x590853[_0x411e('0x62')][0x8][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x76'),'value':_0x590853[_0x411e('0x76')]||(_0x590853[_0x411e('0x62')]&&_0x590853['attrs'][0x9]?_0x590853[_0x411e('0x62')][0x9][_0x411e('0x63')]:undefined)||''}];case _0x411e('0x77'):case'pie-chart':return[{'name':_0x411e('0x78'),'value':_0x590853['attrSerie1']||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x0]?_0x590853['attrs'][0x0][_0x411e('0x63')]:undefined)||_0x411e('0x6f')},{'name':_0x411e('0x79'),'value':_0x590853[_0x411e('0x79')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x1]?_0x590853[_0x411e('0x62')][0x1][_0x411e('0x63')]:undefined)||null},{'name':_0x411e('0x7a'),'value':_0x590853['attrSerie3']||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x2]?_0x590853['attrs'][0x2][_0x411e('0x63')]:undefined)||null},{'name':_0x411e('0x70'),'value':_0x590853[_0x411e('0x70')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x3]?_0x590853['attrs'][0x3][_0x411e('0x63')]:undefined)||[]},{'name':_0x411e('0x71'),'value':_0x590853[_0x411e('0x71')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x4]?_0x590853[_0x411e('0x62')][0x4][_0x411e('0x63')]:undefined)||_0x411e('0x7b')},{'name':'attrEmailAccounts','value':_0x590853['attrEmailAccounts']||(_0x590853['attrs']&&_0x590853[_0x411e('0x62')][0x5]?_0x590853[_0x411e('0x62')][0x5][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x7c'),'value':_0x590853[_0x411e('0x7c')]||(_0x590853['attrs']&&_0x590853['attrs'][0x6]?_0x590853[_0x411e('0x62')][0x6][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x73'),'value':_0x590853[_0x411e('0x73')]||(_0x590853[_0x411e('0x62')]&&_0x590853['attrs'][0x7]?_0x590853[_0x411e('0x62')][0x7][_0x411e('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x590853['attrOpenchannelAccounts']||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x8]?_0x590853[_0x411e('0x62')][0x8][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x75'),'value':_0x590853[_0x411e('0x75')]||(_0x590853['attrs']&&_0x590853['attrs'][0x9]?_0x590853['attrs'][0x9][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x76'),'value':_0x590853[_0x411e('0x76')]||(_0x590853[_0x411e('0x62')]&&_0x590853['attrs'][0xa]?_0x590853['attrs'][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x411e('0x7d'),'type':_0x590853[_0x411e('0x7e')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x0]?_0x590853['attrs'][0x0][_0x411e('0x34')]:undefined)||null,'value':_0x590853[_0x411e('0x7d')]||(_0x590853[_0x411e('0x62')]&&_0x590853['attrs'][0x0]?_0x590853[_0x411e('0x62')][0x0][_0x411e('0x63')]:undefined)||null},{'name':_0x411e('0x7f'),'value':_0x590853[_0x411e('0x7f')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x1]?_0x590853[_0x411e('0x62')][0x1][_0x411e('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x5e61bd){logger[_0x411e('0x2e')](_0x411e('0x80'),JSON[_0x411e('0x81')](_0x5e61bd));return[];}}exports[_0x411e('0x82')]=function(_0x3857ab,_0x5d17ff,_0x3f3f8e){if(_0x3857ab[_0x411e('0x50')]['id']){delete _0x3857ab[_0x411e('0x50')]['id'];}return db[_0x411e('0x31')][_0x411e('0x4e')]({'where':{'id':_0x3857ab[_0x411e('0x4d')]['id']}})[_0x411e('0x2c')](handleEntityNotFound(_0x5d17ff,null))['then'](function(_0x57fdc9){if(_0x57fdc9){_0x3857ab[_0x411e('0x50')][_0x411e('0x83')]=_0x57fdc9['id'];_0x3857ab[_0x411e('0x50')][_0x411e('0x62')]=widgetAttributes(_0x3857ab['body']);return db['DashboardItem']['create'](_0x3857ab[_0x411e('0x50')]);}})['then'](respondWithResult(_0x5d17ff,null))[_0x411e('0x4c')](handleError(_0x5d17ff,null));};exports[_0x411e('0x84')]=function(_0x25423d,_0x1deab6,_0x46e58e){var _0xd0c9aa={};var _0x4e9784={};var _0x57770a;var _0x4a502d;return db[_0x411e('0x31')][_0x411e('0x85')]({'where':{'id':_0x25423d[_0x411e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1deab6,null))[_0x411e('0x2c')](function(_0x5b7a91){if(_0x5b7a91){_0x57770a=_0x5b7a91;_0x4e9784[_0x411e('0x36')]=_[_0x411e('0x37')](db[_0x411e('0x86')][_0x411e('0x32')]);_0x4e9784['query']=_[_0x411e('0x37')](_0x25423d[_0x411e('0x38')]);_0x4e9784[_0x411e('0x39')]=_[_0x411e('0x3a')](_0x4e9784['model'],_0x4e9784['query']);_0xd0c9aa['attributes']=_['intersection'](_0x4e9784['model'],qs[_0x411e('0x3c')](_0x25423d[_0x411e('0x38')][_0x411e('0x3c')]));_0xd0c9aa[_0x411e('0x3b')]=_0xd0c9aa[_0x411e('0x3b')][_0x411e('0x3d')]?_0xd0c9aa[_0x411e('0x3b')]:_0x4e9784[_0x411e('0x36')];_0xd0c9aa['order']=qs['sort'](_0x25423d[_0x411e('0x38')]['sort']);_0xd0c9aa['where']=qs['filters'](_[_0x411e('0x42')](_0x25423d['query'],_0x4e9784[_0x411e('0x39')]));if(_0x25423d[_0x411e('0x38')][_0x411e('0x43')]){_0xd0c9aa[_0x411e('0x41')]=_[_0x411e('0x44')](_0xd0c9aa[_0x411e('0x41')],{'$or':_[_0x411e('0x45')](_0xd0c9aa[_0x411e('0x3b')],function(_0x200730){var _0x4c2e97={};_0x4c2e97[_0x200730]={'$like':'%'+_0x25423d[_0x411e('0x38')][_0x411e('0x43')]+'%'};return _0x4c2e97;})});}_0xd0c9aa=_[_0x411e('0x44')]({},_0xd0c9aa,_0x25423d[_0x411e('0x47')]);return _0x57770a[_0x411e('0x84')](_0xd0c9aa);}})[_0x411e('0x2c')](function(_0x22a2d9){if(_0x22a2d9){_0x4a502d=_0x22a2d9[_0x411e('0x3d')];if(!_0x25423d[_0x411e('0x38')]['hasOwnProperty'](_0x411e('0x87'))){_0xd0c9aa['limit']=qs[_0x411e('0x25')](_0x25423d['query'][_0x411e('0x25')]);_0xd0c9aa[_0x411e('0x24')]=qs[_0x411e('0x24')](_0x25423d[_0x411e('0x38')][_0x411e('0x24')]);}return _0x57770a[_0x411e('0x84')](_0xd0c9aa);}})['then'](function(_0x4464de){if(_0x4464de){return _0x4464de?{'count':_0x4a502d,'rows':_0x4464de}:null;}})['then'](respondWithResult(_0x1deab6,null))[_0x411e('0x4c')](handleError(_0x1deab6,null));}; \ No newline at end of file +var _0xddd2=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','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','redis','defaults','localhost','register','status','end','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','UserProfileResource','sendStatus','error','stack','name','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','omit','updatedAt','createdAt','CustomDashboards','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','getItems','nolimit','eml-format','rimraf'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xddd2,0x181));var _0x2ddd=function(_0x97ec0e,_0x10eb67){_0x97ec0e=_0x97ec0e-0x0;var _0x1fd9dd=_0xddd2[_0x97ec0e];return _0x1fd9dd;};'use strict';var emlformat=require(_0x2ddd('0x0'));var rimraf=require(_0x2ddd('0x1'));var zipdir=require(_0x2ddd('0x2'));var jsonpatch=require(_0x2ddd('0x3'));var rp=require(_0x2ddd('0x4'));var moment=require('moment');var BPromise=require(_0x2ddd('0x5'));var Mustache=require(_0x2ddd('0x6'));var util=require(_0x2ddd('0x7'));var path=require('path');var sox=require(_0x2ddd('0x8'));var csv=require('to-csv');var ejs=require(_0x2ddd('0x9'));var fs=require('fs');var fs_extra=require(_0x2ddd('0xa'));var _=require(_0x2ddd('0xb'));var squel=require(_0x2ddd('0xc'));var crypto=require(_0x2ddd('0xd'));var jsforce=require(_0x2ddd('0xe'));var deskjs=require(_0x2ddd('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2ddd('0x10'));var Papa=require(_0x2ddd('0x11'));var Redis=require(_0x2ddd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2ddd('0x13'));var as=require(_0x2ddd('0x14'));var hardwareService=require(_0x2ddd('0x15'));var logger=require(_0x2ddd('0x16'))(_0x2ddd('0x17'));var utils=require(_0x2ddd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2ddd('0x19'));var db=require(_0x2ddd('0x1a'))['db'];config[_0x2ddd('0x1b')]=_[_0x2ddd('0x1c')](config[_0x2ddd('0x1b')],{'host':_0x2ddd('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ddd('0x1b')]));require('./dashboard.socket')[_0x2ddd('0x1e')](socket);function respondWithStatusCode(_0x199e1e,_0x12562c){_0x12562c=_0x12562c||0xcc;return function(_0x501f7b){if(_0x501f7b){return _0x199e1e['sendStatus'](_0x12562c);}return _0x199e1e[_0x2ddd('0x1f')](_0x12562c)[_0x2ddd('0x20')]();};}function respondWithResult(_0x12814c,_0x56f226){_0x56f226=_0x56f226||0xc8;return function(_0x3e3857){if(_0x3e3857){return _0x12814c[_0x2ddd('0x1f')](_0x56f226)[_0x2ddd('0x21')](_0x3e3857);}};}function respondWithFilteredResult(_0x435866,_0x21e06a){return function(_0x38a412){if(_0x38a412){var _0x3db759=typeof _0x21e06a[_0x2ddd('0x22')]==='undefined'&&typeof _0x21e06a['limit']===_0x2ddd('0x23');var _0x53a6c4=_0x38a412[_0x2ddd('0x24')];var _0x559116=_0x3db759?0x0:_0x21e06a['offset'];var _0x540852=_0x3db759?_0x38a412[_0x2ddd('0x24')]:_0x21e06a['offset']+_0x21e06a[_0x2ddd('0x25')];var _0x59905a;if(_0x540852>=_0x53a6c4){_0x540852=_0x53a6c4;_0x59905a=0xc8;}else{_0x59905a=0xce;}_0x435866[_0x2ddd('0x1f')](_0x59905a);return _0x435866[_0x2ddd('0x26')]('Content-Range',_0x559116+'-'+_0x540852+'/'+_0x53a6c4)[_0x2ddd('0x21')](_0x38a412);}return null;};}function patchUpdates(_0x5b66a1){return function(_0x1b8576){try{jsonpatch[_0x2ddd('0x27')](_0x1b8576,_0x5b66a1,!![]);}catch(_0x2e2f95){return BPromise['reject'](_0x2e2f95);}return _0x1b8576[_0x2ddd('0x28')]();};}function saveUpdates(_0x352aaa,_0x34179b){return function(_0x728dbe){if(_0x728dbe){return _0x728dbe[_0x2ddd('0x29')](_0x352aaa)['then'](function(_0xe8acc1){return _0xe8acc1;});}return null;};}function removeEntity(_0x181ccd,_0x250694){return function(_0x31c449){if(_0x31c449){return _0x31c449[_0x2ddd('0x2a')]()[_0x2ddd('0x2b')](function(){var _0x28f723=_0x31c449['get']({'plain':!![]});var _0x12ccf2='CustomDashboards';return db[_0x2ddd('0x2c')][_0x2ddd('0x2a')]({'where':{'type':_0x12ccf2,'resourceId':_0x28f723['id']}})['then'](function(){return _0x31c449;});})[_0x2ddd('0x2b')](function(){_0x181ccd[_0x2ddd('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x543349,_0x3067d0){return function(_0x3d4c33){if(!_0x3d4c33){_0x543349[_0x2ddd('0x2d')](0x194);}return _0x3d4c33;};}function handleError(_0xf531cc,_0x5d591c){_0x5d591c=_0x5d591c||0x1f4;return function(_0x529ffd){logger[_0x2ddd('0x2e')](_0x529ffd[_0x2ddd('0x2f')]);if(_0x529ffd['name']){delete _0x529ffd[_0x2ddd('0x30')];}_0xf531cc['status'](_0x5d591c)['send'](_0x529ffd);};}exports['index']=function(_0x286542,_0xd845d){var _0x48f963={},_0x9755c5={},_0x5d6725={'count':0x0,'rows':[]};var _0x5a582a=_[_0x2ddd('0x31')](db[_0x2ddd('0x32')][_0x2ddd('0x33')],function(_0x1d95d4){return{'name':_0x1d95d4[_0x2ddd('0x34')],'type':_0x1d95d4[_0x2ddd('0x35')][_0x2ddd('0x36')]};});_0x9755c5[_0x2ddd('0x37')]=_['map'](_0x5a582a,_0x2ddd('0x30'));_0x9755c5[_0x2ddd('0x38')]=_[_0x2ddd('0x39')](_0x286542[_0x2ddd('0x38')]);_0x9755c5[_0x2ddd('0x3a')]=_[_0x2ddd('0x3b')](_0x9755c5[_0x2ddd('0x37')],_0x9755c5[_0x2ddd('0x38')]);_0x48f963[_0x2ddd('0x3c')]=_[_0x2ddd('0x3b')](_0x9755c5[_0x2ddd('0x37')],qs[_0x2ddd('0x3d')](_0x286542['query']['fields']));_0x48f963[_0x2ddd('0x3c')]=_0x48f963['attributes'][_0x2ddd('0x3e')]?_0x48f963[_0x2ddd('0x3c')]:_0x9755c5['model'];if(!_0x286542[_0x2ddd('0x38')][_0x2ddd('0x3f')]('nolimit')){_0x48f963[_0x2ddd('0x25')]=qs[_0x2ddd('0x25')](_0x286542[_0x2ddd('0x38')][_0x2ddd('0x25')]);_0x48f963[_0x2ddd('0x22')]=qs[_0x2ddd('0x22')](_0x286542[_0x2ddd('0x38')][_0x2ddd('0x22')]);}_0x48f963[_0x2ddd('0x40')]=qs[_0x2ddd('0x41')](_0x286542['query'][_0x2ddd('0x41')]);_0x48f963[_0x2ddd('0x42')]=qs[_0x2ddd('0x3a')](_[_0x2ddd('0x43')](_0x286542[_0x2ddd('0x38')],_0x9755c5[_0x2ddd('0x3a')]),_0x5a582a);if(_0x286542[_0x2ddd('0x38')][_0x2ddd('0x44')]){_0x48f963[_0x2ddd('0x42')]=_['merge'](_0x48f963[_0x2ddd('0x42')],{'$or':_[_0x2ddd('0x31')](_0x5a582a,function(_0x3d1170){if(_0x3d1170[_0x2ddd('0x35')]!==_0x2ddd('0x45')){var _0x25e74f={};_0x25e74f[_0x3d1170[_0x2ddd('0x30')]]={'$like':'%'+_0x286542['query'][_0x2ddd('0x44')]+'%'};return _0x25e74f;}})});}_0x48f963=_[_0x2ddd('0x46')]({},_0x48f963,_0x286542[_0x2ddd('0x47')]);var _0x51c823={'where':_0x48f963[_0x2ddd('0x42')]};return db[_0x2ddd('0x32')][_0x2ddd('0x24')](_0x51c823)['then'](function(_0x4ecb00){_0x5d6725[_0x2ddd('0x24')]=_0x4ecb00;if(_0x286542[_0x2ddd('0x38')][_0x2ddd('0x48')]){_0x48f963[_0x2ddd('0x49')]=[{'all':!![]}];}return db[_0x2ddd('0x32')][_0x2ddd('0x4a')](_0x48f963);})[_0x2ddd('0x2b')](function(_0x4ca9c6){_0x5d6725['rows']=_0x4ca9c6;return _0x5d6725;})['then'](respondWithFilteredResult(_0xd845d,_0x48f963))[_0x2ddd('0x4b')](handleError(_0xd845d,null));};exports['show']=function(_0x10ee03,_0x56359f){var _0x40c23c={'raw':![],'where':{'id':_0x10ee03[_0x2ddd('0x4c')]['id']}},_0x1f32b6={};_0x1f32b6[_0x2ddd('0x37')]=_[_0x2ddd('0x39')](db[_0x2ddd('0x32')][_0x2ddd('0x33')]);_0x1f32b6['query']=_[_0x2ddd('0x39')](_0x10ee03[_0x2ddd('0x38')]);_0x1f32b6[_0x2ddd('0x3a')]=_['intersection'](_0x1f32b6[_0x2ddd('0x37')],_0x1f32b6['query']);_0x40c23c['attributes']=_[_0x2ddd('0x3b')](_0x1f32b6['model'],qs[_0x2ddd('0x3d')](_0x10ee03[_0x2ddd('0x38')][_0x2ddd('0x3d')]));_0x40c23c[_0x2ddd('0x3c')]=_0x40c23c[_0x2ddd('0x3c')][_0x2ddd('0x3e')]?_0x40c23c[_0x2ddd('0x3c')]:_0x1f32b6[_0x2ddd('0x37')];if(_0x10ee03[_0x2ddd('0x38')][_0x2ddd('0x48')]){_0x40c23c[_0x2ddd('0x49')]=[{'all':!![]}];}_0x40c23c=_['merge']({},_0x40c23c,_0x10ee03['options']);return db[_0x2ddd('0x32')][_0x2ddd('0x4d')](_0x40c23c)[_0x2ddd('0x2b')](handleEntityNotFound(_0x56359f,null))[_0x2ddd('0x2b')](respondWithResult(_0x56359f,null))['catch'](handleError(_0x56359f,null));};exports[_0x2ddd('0x4e')]=function(_0x5a6677,_0x43e05d){return db[_0x2ddd('0x32')][_0x2ddd('0x4e')](_0x5a6677[_0x2ddd('0x4f')],{})['then'](function(_0x30fff8){var _0x47a686=_0x5a6677[_0x2ddd('0x50')][_0x2ddd('0x51')]({'plain':!![]});if(!_0x47a686)throw new Error(_0x2ddd('0x52'));if(_0x47a686[_0x2ddd('0x53')]===_0x2ddd('0x50')){var _0x4724ee=_0x30fff8[_0x2ddd('0x51')]({'plain':!![]});var _0x32dd42='CustomDashboards';return db[_0x2ddd('0x54')][_0x2ddd('0x4d')]({'where':{'name':_0x32dd42,'userProfileId':_0x47a686['userProfileId']},'raw':!![]})[_0x2ddd('0x2b')](function(_0x363517){if(_0x363517&&_0x363517[_0x2ddd('0x55')]===0x0){return db[_0x2ddd('0x2c')]['create']({'name':_0x4724ee[_0x2ddd('0x30')],'resourceId':_0x4724ee['id'],'type':_0x363517[_0x2ddd('0x30')],'sectionId':_0x363517['id']},{})[_0x2ddd('0x2b')](function(){return _0x30fff8;});}else{return _0x30fff8;}})[_0x2ddd('0x4b')](function(_0x1bb5e2){logger[_0x2ddd('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bb5e2);throw _0x1bb5e2;});}return _0x30fff8;})['then'](respondWithResult(_0x43e05d,0xc9))[_0x2ddd('0x4b')](handleError(_0x43e05d,null));};exports['clone']=function(_0x1e1b1e,_0x5ab733){var _0x4cd58d={'where':{'id':_0x1e1b1e['params']['id']}},_0x4f4f41={};_0x4f4f41[_0x2ddd('0x37')]=_[_0x2ddd('0x39')](db['Dashboard']['rawAttributes']);_0x4cd58d['attributes']=_[_0x2ddd('0x3b')](_0x4f4f41['model'],qs[_0x2ddd('0x3d')](_0x1e1b1e[_0x2ddd('0x38')][_0x2ddd('0x3d')]));_0x4cd58d['attributes']=_0x4cd58d[_0x2ddd('0x3c')][_0x2ddd('0x3e')]?_0x4cd58d[_0x2ddd('0x3c')]:_0x4f4f41[_0x2ddd('0x37')];if(_0x1e1b1e['query'][_0x2ddd('0x48')]){_0x4cd58d[_0x2ddd('0x49')]=[{'all':!![]}];}_0x4cd58d=_[_0x2ddd('0x46')]({},_0x4cd58d,_0x1e1b1e['options']);return db['Dashboard'][_0x2ddd('0x4d')](_0x4cd58d)['then'](handleEntityNotFound(_0x5ab733,null))[_0x2ddd('0x2b')](function(_0x20d39a){if(_0x20d39a){var _0x123731=_0x20d39a[_0x2ddd('0x51')]({'plain':!![]});_0x123731=qs[_0x2ddd('0x56')](_0x123731,['id','createdAt',_0x2ddd('0x57')]);_0x1e1b1e['body']=_[_0x2ddd('0x56')](_0x1e1b1e[_0x2ddd('0x4f')],['id',_0x2ddd('0x58'),_0x2ddd('0x57')]);return db[_0x2ddd('0x32')][_0x2ddd('0x4e')](_[_0x2ddd('0x46')](_0x123731,_0x1e1b1e['body']),{'include':_0x1e1b1e[_0x2ddd('0x38')][_0x2ddd('0x48')]?[{'all':!![]}]:undefined})[_0x2ddd('0x2b')](function(_0x1bf05c){var _0x4acaeb=_0x1e1b1e[_0x2ddd('0x50')][_0x2ddd('0x51')]({'plain':!![]});if(!_0x4acaeb)throw new Error(_0x2ddd('0x52'));if(_0x4acaeb[_0x2ddd('0x53')]===_0x2ddd('0x50')){var _0x2bcba4=_0x1bf05c[_0x2ddd('0x51')]({'plain':!![]});var _0x4fe82a=_0x2ddd('0x59');return db[_0x2ddd('0x54')]['find']({'where':{'name':_0x4fe82a,'userProfileId':_0x4acaeb[_0x2ddd('0x5a')]},'raw':!![]})['then'](function(_0x1633cb){if(_0x1633cb&&_0x1633cb[_0x2ddd('0x55')]===0x0){return db[_0x2ddd('0x2c')][_0x2ddd('0x4e')]({'name':_0x2bcba4[_0x2ddd('0x30')],'resourceId':_0x2bcba4['id'],'type':_0x1633cb[_0x2ddd('0x30')],'sectionId':_0x1633cb['id']},{})[_0x2ddd('0x2b')](function(){return _0x1bf05c;});}else{return _0x1bf05c;}})[_0x2ddd('0x4b')](function(_0x1e228d){logger[_0x2ddd('0x2e')](_0x2ddd('0x5b'),_0x1e228d);throw _0x1e228d;});}return _0x1bf05c;});}})['then'](respondWithResult(_0x5ab733,0xc9))[_0x2ddd('0x4b')](handleError(_0x5ab733,null));};exports[_0x2ddd('0x29')]=function(_0x22d3f9,_0x41d406){if(_0x22d3f9['body']['id']){delete _0x22d3f9[_0x2ddd('0x4f')]['id'];}return db['Dashboard'][_0x2ddd('0x4d')]({'where':{'id':_0x22d3f9['params']['id']}})[_0x2ddd('0x2b')](handleEntityNotFound(_0x41d406,null))[_0x2ddd('0x2b')](saveUpdates(_0x22d3f9[_0x2ddd('0x4f')],null))[_0x2ddd('0x2b')](respondWithResult(_0x41d406,null))[_0x2ddd('0x4b')](handleError(_0x41d406,null));};exports[_0x2ddd('0x2a')]=function(_0x59ed9c,_0xafad4d){return db[_0x2ddd('0x32')][_0x2ddd('0x4d')]({'where':{'id':_0x59ed9c[_0x2ddd('0x4c')]['id']}})[_0x2ddd('0x2b')](handleEntityNotFound(_0xafad4d,null))[_0x2ddd('0x2b')](removeEntity(_0xafad4d,null))[_0x2ddd('0x4b')](handleError(_0xafad4d,null));};function widgetAttributes(_0x3913fa){try{switch(_0x3913fa[_0x2ddd('0x35')]){case _0x2ddd('0x5c'):return[{'name':_0x2ddd('0x5d'),'value':_0x3913fa[_0x2ddd('0x5d')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa[_0x2ddd('0x5e')][0x0][_0x2ddd('0x5f')]:undefined)||_0x2ddd('0x60')}];case _0x2ddd('0x61'):return[{'name':_0x2ddd('0x62'),'value':_0x3913fa[_0x2ddd('0x62')]||(_0x3913fa['attrs']&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa[_0x2ddd('0x5e')][0x0][_0x2ddd('0x5f')]:undefined)||''}];case _0x2ddd('0x63'):return[{'name':_0x2ddd('0x64'),'value':_0x3913fa[_0x2ddd('0x64')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa[_0x2ddd('0x5e')][0x0][_0x2ddd('0x5f')]:undefined)||_0x2ddd('0x65')},{'name':_0x2ddd('0x66'),'value':_0x3913fa['attrTimezone']||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x1]?_0x3913fa[_0x2ddd('0x5e')][0x1]['value']:undefined)||_0x2ddd('0x67')},{'name':_0x2ddd('0x68'),'value':_0x3913fa['attrFontSize']||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x2]?_0x3913fa[_0x2ddd('0x5e')][0x2][_0x2ddd('0x5f')]:undefined)||0xc}];case _0x2ddd('0x69'):return[{'name':_0x2ddd('0x6a'),'value':_0x3913fa[_0x2ddd('0x6a')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa['attrs'][0x0][_0x2ddd('0x5f')]:undefined)||_0x2ddd('0x6b')},{'name':_0x2ddd('0x6c'),'value':_0x3913fa['attrVoiceQueues']||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x1]?_0x3913fa[_0x2ddd('0x5e')][0x1][_0x2ddd('0x5f')]:undefined)||[]},{'name':_0x2ddd('0x68'),'value':_0x3913fa[_0x2ddd('0x68')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x2]?_0x3913fa[_0x2ddd('0x5e')][0x2][_0x2ddd('0x5f')]:undefined)||0x14},{'name':_0x2ddd('0x6d'),'value':_0x3913fa[_0x2ddd('0x6d')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x3]?_0x3913fa[_0x2ddd('0x5e')][0x3]['value']:undefined)||_0x2ddd('0x6e')},{'name':_0x2ddd('0x6f'),'value':_0x3913fa[_0x2ddd('0x6f')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x4]?_0x3913fa[_0x2ddd('0x5e')][0x4][_0x2ddd('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3913fa[_0x2ddd('0x70')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x5]?_0x3913fa[_0x2ddd('0x5e')][0x5][_0x2ddd('0x5f')]:undefined)||''},{'name':_0x2ddd('0x71'),'value':_0x3913fa[_0x2ddd('0x71')]||(_0x3913fa['attrs']&&_0x3913fa[_0x2ddd('0x5e')][0x6]?_0x3913fa[_0x2ddd('0x5e')][0x6][_0x2ddd('0x5f')]:undefined)||''},{'name':_0x2ddd('0x72'),'value':_0x3913fa[_0x2ddd('0x72')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x7]?_0x3913fa[_0x2ddd('0x5e')][0x7][_0x2ddd('0x5f')]:undefined)||''},{'name':_0x2ddd('0x73'),'value':_0x3913fa['attrWhatsappAccounts']||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x8]?_0x3913fa[_0x2ddd('0x5e')][0x8]['value']:undefined)||''},{'name':_0x2ddd('0x74'),'value':_0x3913fa[_0x2ddd('0x74')]||(_0x3913fa['attrs']&&_0x3913fa['attrs'][0x9]?_0x3913fa[_0x2ddd('0x5e')][0x9]['value']:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x3913fa['attrSerie1']||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa[_0x2ddd('0x5e')][0x0][_0x2ddd('0x5f')]:undefined)||_0x2ddd('0x6b')},{'name':'attrSerie2','value':_0x3913fa[_0x2ddd('0x75')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa['attrs'][0x1]?_0x3913fa['attrs'][0x1][_0x2ddd('0x5f')]:undefined)||null},{'name':_0x2ddd('0x76'),'value':_0x3913fa[_0x2ddd('0x76')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x2]?_0x3913fa[_0x2ddd('0x5e')][0x2][_0x2ddd('0x5f')]:undefined)||null},{'name':_0x2ddd('0x6c'),'value':_0x3913fa[_0x2ddd('0x6c')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x3]?_0x3913fa[_0x2ddd('0x5e')][0x3]['value']:undefined)||[]},{'name':_0x2ddd('0x6d'),'value':_0x3913fa[_0x2ddd('0x6d')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x4]?_0x3913fa[_0x2ddd('0x5e')][0x4][_0x2ddd('0x5f')]:undefined)||_0x2ddd('0x6e')},{'name':_0x2ddd('0x6f'),'value':_0x3913fa[_0x2ddd('0x6f')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa['attrs'][0x5]?_0x3913fa[_0x2ddd('0x5e')][0x5][_0x2ddd('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3913fa[_0x2ddd('0x70')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x6]?_0x3913fa[_0x2ddd('0x5e')][0x6][_0x2ddd('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3913fa[_0x2ddd('0x71')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x7]?_0x3913fa[_0x2ddd('0x5e')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3913fa[_0x2ddd('0x72')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x8]?_0x3913fa[_0x2ddd('0x5e')][0x8][_0x2ddd('0x5f')]:undefined)||''},{'name':_0x2ddd('0x73'),'value':_0x3913fa[_0x2ddd('0x73')]||(_0x3913fa['attrs']&&_0x3913fa['attrs'][0x9]?_0x3913fa[_0x2ddd('0x5e')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x3913fa[_0x2ddd('0x74')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0xa]?_0x3913fa['attrs'][0xa][_0x2ddd('0x5f')]:undefined)||''}];case'web-report':return[{'name':_0x2ddd('0x77'),'type':_0x3913fa[_0x2ddd('0x78')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa[_0x2ddd('0x5e')][0x0][_0x2ddd('0x35')]:undefined)||null,'value':_0x3913fa[_0x2ddd('0x77')]||(_0x3913fa['attrs']&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa[_0x2ddd('0x5e')][0x0][_0x2ddd('0x5f')]:undefined)||null},{'name':'attrRefresh','value':_0x3913fa[_0x2ddd('0x79')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa['attrs'][0x1]?_0x3913fa[_0x2ddd('0x5e')][0x1][_0x2ddd('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x56af79){logger[_0x2ddd('0x2e')](_0x2ddd('0x7a'),JSON[_0x2ddd('0x7b')](_0x56af79));return[];}}exports[_0x2ddd('0x7c')]=function(_0x43bda3,_0x2031c3,_0xea1bc1){if(_0x43bda3[_0x2ddd('0x4f')]['id']){delete _0x43bda3[_0x2ddd('0x4f')]['id'];}return db[_0x2ddd('0x32')][_0x2ddd('0x4d')]({'where':{'id':_0x43bda3[_0x2ddd('0x4c')]['id']}})[_0x2ddd('0x2b')](handleEntityNotFound(_0x2031c3,null))[_0x2ddd('0x2b')](function(_0x1d5339){if(_0x1d5339){_0x43bda3['body']['DashboardId']=_0x1d5339['id'];_0x43bda3[_0x2ddd('0x4f')][_0x2ddd('0x5e')]=widgetAttributes(_0x43bda3['body']);return db[_0x2ddd('0x7d')][_0x2ddd('0x4e')](_0x43bda3[_0x2ddd('0x4f')]);}})[_0x2ddd('0x2b')](respondWithResult(_0x2031c3,null))['catch'](handleError(_0x2031c3,null));};exports['getItems']=function(_0x1d6dea,_0x8f8b20,_0x83eac3){var _0xca2212={};var _0x5884d9={};var _0x3e5e8c;var _0x3e497f;return db['Dashboard'][_0x2ddd('0x7e')]({'where':{'id':_0x1d6dea[_0x2ddd('0x4c')]['id']}})[_0x2ddd('0x2b')](handleEntityNotFound(_0x8f8b20,null))['then'](function(_0x5a3636){if(_0x5a3636){_0x3e5e8c=_0x5a3636;_0x5884d9[_0x2ddd('0x37')]=_[_0x2ddd('0x39')](db[_0x2ddd('0x7d')][_0x2ddd('0x33')]);_0x5884d9[_0x2ddd('0x38')]=_[_0x2ddd('0x39')](_0x1d6dea['query']);_0x5884d9[_0x2ddd('0x3a')]=_[_0x2ddd('0x3b')](_0x5884d9['model'],_0x5884d9['query']);_0xca2212[_0x2ddd('0x3c')]=_[_0x2ddd('0x3b')](_0x5884d9['model'],qs[_0x2ddd('0x3d')](_0x1d6dea[_0x2ddd('0x38')][_0x2ddd('0x3d')]));_0xca2212['attributes']=_0xca2212[_0x2ddd('0x3c')][_0x2ddd('0x3e')]?_0xca2212[_0x2ddd('0x3c')]:_0x5884d9[_0x2ddd('0x37')];_0xca2212[_0x2ddd('0x40')]=qs['sort'](_0x1d6dea[_0x2ddd('0x38')][_0x2ddd('0x41')]);_0xca2212[_0x2ddd('0x42')]=qs[_0x2ddd('0x3a')](_[_0x2ddd('0x43')](_0x1d6dea[_0x2ddd('0x38')],_0x5884d9['filters']));if(_0x1d6dea[_0x2ddd('0x38')]['filter']){_0xca2212['where']=_['merge'](_0xca2212[_0x2ddd('0x42')],{'$or':_[_0x2ddd('0x31')](_0xca2212[_0x2ddd('0x3c')],function(_0x379242){var _0x316a5b={};_0x316a5b[_0x379242]={'$like':'%'+_0x1d6dea['query']['filter']+'%'};return _0x316a5b;})});}_0xca2212=_[_0x2ddd('0x46')]({},_0xca2212,_0x1d6dea[_0x2ddd('0x47')]);return _0x3e5e8c[_0x2ddd('0x7f')](_0xca2212);}})[_0x2ddd('0x2b')](function(_0x540544){if(_0x540544){_0x3e497f=_0x540544[_0x2ddd('0x3e')];if(!_0x1d6dea['query']['hasOwnProperty'](_0x2ddd('0x80'))){_0xca2212['limit']=qs[_0x2ddd('0x25')](_0x1d6dea[_0x2ddd('0x38')][_0x2ddd('0x25')]);_0xca2212['offset']=qs[_0x2ddd('0x22')](_0x1d6dea[_0x2ddd('0x38')]['offset']);}return _0x3e5e8c[_0x2ddd('0x7f')](_0xca2212);}})['then'](function(_0x150ad7){if(_0x150ad7){return _0x150ad7?{'count':_0x3e497f,'rows':_0x150ad7}:null;}})[_0x2ddd('0x2b')](respondWithResult(_0x8f8b20,null))[_0x2ddd('0x4b')](handleError(_0x8f8b20,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 8dff162..52c2f9c 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 _0x8868=['save','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x8868,0x1ac));var _0x8886=function(_0x5359db,_0xad0416){_0x5359db=_0x5359db-0x0;var _0x34bdda=_0x8868[_0x5359db];return _0x34bdda;};'use strict';var EventEmitter=require(_0x8886('0x0'));var Dashboard=require(_0x8886('0x1'))['db'][_0x8886('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8886('0x3')](0x0);var events={'afterCreate':_0x8886('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x547dca){return function(_0x293a07,_0x4e9564,_0x26d276){DashboardEvents[_0x8886('0x5')](_0x547dca+':'+_0x293a07['id'],_0x293a07);DashboardEvents[_0x8886('0x5')](_0x547dca,_0x293a07);_0x26d276(null);};}for(var e in events){if(events[_0x8886('0x6')](e)){var event=events[e];Dashboard[_0x8886('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x3788=['../../mysqldb','Dashboard','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0x3788,0x1a6));var _0x8378=function(_0x49ed89,_0x199179){_0x49ed89=_0x49ed89-0x0;var _0x7b4291=_0x3788[_0x49ed89];return _0x7b4291;};'use strict';var EventEmitter=require(_0x8378('0x0'));var Dashboard=require(_0x8378('0x1'))['db'][_0x8378('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8378('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8378('0x4')};function emitEvent(_0x53c195){return function(_0xf44f67,_0x1c2f51,_0x24fc98){DashboardEvents[_0x8378('0x5')](_0x53c195+':'+_0xf44f67['id'],_0xf44f67);DashboardEvents['emit'](_0x53c195,_0xf44f67);_0x24fc98(null);};}for(var e in events){if(events[_0x8378('0x6')](e)){var event=events[e];Dashboard[_0x8378('0x7')](e,emitEvent(event));}}module[_0x8378('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index b1e24c0..519e6bd 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 _0x438d=['dashboards','lodash','util','api','moment','bluebird','path','rimraf','./dashboard.attributes','exports','define'];(function(_0x4e7809,_0x3e36e6){var _0x1bdb02=function(_0x2dfe15){while(--_0x2dfe15){_0x4e7809['push'](_0x4e7809['shift']());}};_0x1bdb02(++_0x3e36e6);}(_0x438d,0x182));var _0xd438=function(_0x97ab47,_0x5cdab2){_0x97ab47=_0x97ab47-0x0;var _0x2d291f=_0x438d[_0x97ab47];return _0x2d291f;};'use strict';var _=require(_0xd438('0x0'));var util=require(_0xd438('0x1'));var logger=require('../../config/logger')(_0xd438('0x2'));var moment=require(_0xd438('0x3'));var BPromise=require(_0xd438('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd438('0x5'));var rimraf=require(_0xd438('0x6'));var config=require('../../config/environment');var attributes=require(_0xd438('0x7'));module[_0xd438('0x8')]=function(_0x85aa83,_0x564915){return _0x85aa83[_0xd438('0x9')]('Dashboard',attributes,{'tableName':_0xd438('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc00c=['dashboards','../../config/logger','api','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x2bc7d8,_0x2fbce6){var _0x37a718=function(_0x4a68da){while(--_0x4a68da){_0x2bc7d8['push'](_0x2bc7d8['shift']());}};_0x37a718(++_0x2fbce6);}(_0xc00c,0x97));var _0xcc00=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xc00c[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcc00('0x0'))(_0xcc00('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc00('0x2'));var rimraf=require(_0xcc00('0x3'));var config=require(_0xcc00('0x4'));var attributes=require(_0xcc00('0x5'));module[_0xcc00('0x6')]=function(_0x13df32,_0x482f73){return _0x13df32[_0xcc00('0x7')](_0xcc00('0x8'),attributes,{'tableName':_0xcc00('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index ca0ffaa..5bd9715 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 _0xfea5=['error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0xfea5,0x94));var _0x5fea=function(_0x367097,_0x583938){_0x367097=_0x367097-0x0;var _0xba3bc1=_0xfea5[_0x367097];return _0xba3bc1;};'use strict';var _=require('lodash');var util=require(_0x5fea('0x0'));var moment=require(_0x5fea('0x1'));var BPromise=require(_0x5fea('0x2'));var rs=require(_0x5fea('0x3'));var fs=require('fs');var Redis=require(_0x5fea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5fea('0x5'));var logger=require(_0x5fea('0x6'))(_0x5fea('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5fea('0x8')]({'port':0x232a});config[_0x5fea('0x9')]=_[_0x5fea('0xa')](config[_0x5fea('0x9')],{'host':_0x5fea('0xb'),'port':0x18eb});var socket=require(_0x5fea('0xc'))(new Redis(config[_0x5fea('0x9')]));require(_0x5fea('0xd'))[_0x5fea('0xe')](socket);function respondWithRpcPromise(_0x481c2f,_0xc21dca,_0x18926f){return new BPromise(function(_0x530852,_0x433d94){return client[_0x5fea('0xf')](_0x481c2f,_0x18926f)[_0x5fea('0x10')](function(_0x5831c9){logger['info'](_0x5fea('0x11'),_0xc21dca,_0x5fea('0x12'));logger[_0x5fea('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0xc21dca,'request\x20sent',JSON['stringify'](_0x5831c9));if(_0x5831c9[_0x5fea('0x14')]){if(_0x5831c9[_0x5fea('0x14')]['code']===0x1f4){logger[_0x5fea('0x14')](_0x5fea('0x11'),_0xc21dca,_0x5831c9[_0x5fea('0x14')]['message']);return _0x433d94(_0x5831c9[_0x5fea('0x14')][_0x5fea('0x15')]);}logger['error'](_0x5fea('0x11'),_0xc21dca,_0x5831c9[_0x5fea('0x14')][_0x5fea('0x15')]);return _0x530852(_0x5831c9[_0x5fea('0x14')][_0x5fea('0x15')]);}else{logger['info'](_0x5fea('0x11'),_0xc21dca,_0x5fea('0x12'));_0x530852(_0x5831c9[_0x5fea('0x16')][_0x5fea('0x15')]);}})[_0x5fea('0x17')](function(_0x53dc93){logger['error'](_0x5fea('0x11'),_0xc21dca,_0x53dc93);_0x433d94(_0x53dc93);});});} \ No newline at end of file +var _0x2a3f=['message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xfd4ffb,_0x3a3bf6){var _0x57e729=function(_0x5bb756){while(--_0x5bb756){_0xfd4ffb['push'](_0xfd4ffb['shift']());}};_0x57e729(++_0x3a3bf6);}(_0x2a3f,0x10a));var _0xf2a3=function(_0x3ae2b2,_0x2d936f){_0x3ae2b2=_0x3ae2b2-0x0;var _0x1dbf00=_0x2a3f[_0x3ae2b2];return _0x1dbf00;};'use strict';var _=require('lodash');var util=require(_0xf2a3('0x0'));var moment=require(_0xf2a3('0x1'));var BPromise=require(_0xf2a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2a3('0x3'))['db'];var utils=require(_0xf2a3('0x4'));var logger=require('../../config/logger')(_0xf2a3('0x5'));var config=require(_0xf2a3('0x6'));var jayson=require(_0xf2a3('0x7'));var client=jayson[_0xf2a3('0x8')][_0xf2a3('0x9')]({'port':0x232a});config[_0xf2a3('0xa')]=_['defaults'](config[_0xf2a3('0xa')],{'host':_0xf2a3('0xb'),'port':0x18eb});var socket=require(_0xf2a3('0xc'))(new Redis(config[_0xf2a3('0xa')]));require(_0xf2a3('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e5687,_0x5c0522,_0x52e279){return new BPromise(function(_0x3c4633,_0x3e8b9b){return client[_0xf2a3('0xe')](_0x2e5687,_0x52e279)[_0xf2a3('0xf')](function(_0x17039e){logger[_0xf2a3('0x10')](_0xf2a3('0x11'),_0x5c0522,'request\x20sent');logger['debug'](_0xf2a3('0x12'),_0x5c0522,_0xf2a3('0x13'),JSON[_0xf2a3('0x14')](_0x17039e));if(_0x17039e[_0xf2a3('0x15')]){if(_0x17039e[_0xf2a3('0x15')]['code']===0x1f4){logger['error'](_0xf2a3('0x11'),_0x5c0522,_0x17039e[_0xf2a3('0x15')][_0xf2a3('0x16')]);return _0x3e8b9b(_0x17039e['error'][_0xf2a3('0x16')]);}logger[_0xf2a3('0x15')](_0xf2a3('0x11'),_0x5c0522,_0x17039e[_0xf2a3('0x15')]['message']);return _0x3c4633(_0x17039e[_0xf2a3('0x15')][_0xf2a3('0x16')]);}else{logger[_0xf2a3('0x10')](_0xf2a3('0x11'),_0x5c0522,_0xf2a3('0x13'));_0x3c4633(_0x17039e['result']['message']);}})[_0xf2a3('0x17')](function(_0x349c47){logger[_0xf2a3('0x15')](_0xf2a3('0x11'),_0x5c0522,_0x349c47);_0x3e8b9b(_0x349c47);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8d66d28..4e3257d 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 _0x5dda=['length','dashboard:','save','remove','emit','register'];(function(_0x519a01,_0x39e9d0){var _0x368af3=function(_0x3e2d37){while(--_0x3e2d37){_0x519a01['push'](_0x519a01['shift']());}};_0x368af3(++_0x39e9d0);}(_0x5dda,0x164));var _0xa5dd=function(_0x23c150,_0xeab35){_0x23c150=_0x23c150-0x0;var _0x70336a=_0x5dda[_0x23c150];return _0x70336a;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xa5dd('0x0'),_0xa5dd('0x1'),'update'];function createListener(_0x3ae9cc,_0x30b2bc){return function(_0x1dd4a2){_0x30b2bc[_0xa5dd('0x2')](_0x3ae9cc,_0x1dd4a2);};}function removeListener(_0x115e70,_0x6c0a36){return function(){DashboardEvents['removeListener'](_0x115e70,_0x6c0a36);};}exports[_0xa5dd('0x3')]=function(_0x38f9b3){for(var _0x4a20a3=0x0,_0x36ef45=events[_0xa5dd('0x4')];_0x4a20a3<_0x36ef45;_0x4a20a3++){var _0x33fece=events[_0x4a20a3];var _0x29f766=createListener(_0xa5dd('0x5')+_0x33fece,_0x38f9b3);DashboardEvents['on'](_0x33fece,_0x29f766);}}; \ No newline at end of file +var _0x3e59=['save','remove','emit','register','length','dashboard:','./dashboard.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e59,0x6f));var _0x93e5=function(_0x3b5f66,_0x1dbfc5){_0x3b5f66=_0x3b5f66-0x0;var _0x4aa1a8=_0x3e59[_0x3b5f66];return _0x4aa1a8;};'use strict';var DashboardEvents=require(_0x93e5('0x0'));var events=[_0x93e5('0x1'),_0x93e5('0x2'),'update'];function createListener(_0x43ce46,_0x5a76a6){return function(_0x31f0c6){_0x5a76a6[_0x93e5('0x3')](_0x43ce46,_0x31f0c6);};}function removeListener(_0x220580,_0x45095d){return function(){DashboardEvents['removeListener'](_0x220580,_0x45095d);};}exports[_0x93e5('0x4')]=function(_0x334b17){for(var _0x4de58d=0x0,_0x598f72=events[_0x93e5('0x5')];_0x4de58d<_0x598f72;_0x4de58d++){var _0x248326=events[_0x4de58d];var _0x4de85e=createListener(_0x93e5('0x6')+_0x248326,_0x334b17);DashboardEvents['on'](_0x248326,_0x4de85e);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 811115c..5aa1bae 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 _0xd9b5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x2613f5,_0x34d0d2){var _0x4bff9b=function(_0x1d8948){while(--_0x1d8948){_0x2613f5['push'](_0x2613f5['shift']());}};_0x4bff9b(++_0x34d0d2);}(_0xd9b5,0x126));var _0x5d9b=function(_0x2625aa,_0x1bc020){_0x2625aa=_0x2625aa-0x0;var _0x3458fd=_0xd9b5[_0x2625aa];return _0x3458fd;};'use strict';var multer=require(_0x5d9b('0x0'));var util=require(_0x5d9b('0x1'));var path=require(_0x5d9b('0x2'));var timeout=require(_0x5d9b('0x3'));var express=require('express');var router=express[_0x5d9b('0x4')]();var fs_extra=require(_0x5d9b('0x5'));var auth=require(_0x5d9b('0x6'));var interaction=require(_0x5d9b('0x7'));var config=require(_0x5d9b('0x8'));var controller=require(_0x5d9b('0x9'));router[_0x5d9b('0xa')]('/',auth[_0x5d9b('0xb')](),controller[_0x5d9b('0xc')]);router[_0x5d9b('0xa')](_0x5d9b('0xd'),auth[_0x5d9b('0xb')](),controller[_0x5d9b('0xe')]);router[_0x5d9b('0xa')](_0x5d9b('0xf'),auth[_0x5d9b('0xb')](),controller[_0x5d9b('0x10')]);router[_0x5d9b('0x11')]('/',auth[_0x5d9b('0xb')](),controller['create']);router[_0x5d9b('0x11')](_0x5d9b('0x12'),auth[_0x5d9b('0xb')](),controller[_0x5d9b('0x13')]);router[_0x5d9b('0x11')](_0x5d9b('0xf'),auth[_0x5d9b('0xb')](),controller[_0x5d9b('0x14')]);router[_0x5d9b('0x15')](_0x5d9b('0xd'),auth['isAuthenticated'](),controller[_0x5d9b('0x16')]);router[_0x5d9b('0x17')](_0x5d9b('0xd'),auth[_0x5d9b('0xb')](),controller['destroy']);module[_0x5d9b('0x18')]=router; \ No newline at end of file +var _0x7a09=['/:id','isAuthenticated','show','/:id/items','getItems','post','create','/:id/clone','addItem','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index'];(function(_0x1498dd,_0x3155dd){var _0x46b1a7=function(_0x2bfa78){while(--_0x2bfa78){_0x1498dd['push'](_0x1498dd['shift']());}};_0x46b1a7(++_0x3155dd);}(_0x7a09,0x141));var _0x97a0=function(_0xe09d0,_0x1e55d0){_0xe09d0=_0xe09d0-0x0;var _0x44ad05=_0x7a09[_0xe09d0];return _0x44ad05;};'use strict';var multer=require(_0x97a0('0x0'));var util=require('util');var path=require(_0x97a0('0x1'));var timeout=require(_0x97a0('0x2'));var express=require(_0x97a0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x97a0('0x4'));var config=require(_0x97a0('0x5'));var controller=require(_0x97a0('0x6'));router[_0x97a0('0x7')]('/',auth['isAuthenticated'](),controller[_0x97a0('0x8')]);router['get'](_0x97a0('0x9'),auth[_0x97a0('0xa')](),controller[_0x97a0('0xb')]);router[_0x97a0('0x7')](_0x97a0('0xc'),auth[_0x97a0('0xa')](),controller[_0x97a0('0xd')]);router[_0x97a0('0xe')]('/',auth['isAuthenticated'](),controller[_0x97a0('0xf')]);router[_0x97a0('0xe')](_0x97a0('0x10'),auth['isAuthenticated'](),controller['clone']);router[_0x97a0('0xe')](_0x97a0('0xc'),auth['isAuthenticated'](),controller[_0x97a0('0x11')]);router['put'](_0x97a0('0x9'),auth[_0x97a0('0xa')](),controller[_0x97a0('0x12')]);router[_0x97a0('0x13')](_0x97a0('0x9'),auth[_0x97a0('0xa')](),controller[_0x97a0('0x14')]);module[_0x97a0('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index c1a29fb..8dd4a3b 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 _0x2542=['exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0x2542,0x169));var _0x2254=function(_0x4e222c,_0x4b76b8){_0x4e222c=_0x4e222c-0x0;var _0x519305=_0x2542[_0x4e222c];return _0x519305;};'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 +var _0xb4c7=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2ce073,_0x11a712){_0x2ce073=_0x2ce073-0x0;var _0x364337=_0xb4c7[_0x2ce073];return _0x364337;};'use strict';var Sequelize=require(_0x7b4c('0x0'));var squel=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));module[_0x7b4c('0x3')]={'title':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7b4c('0x5')](_0x7b4c('0x6')),'get':function(){try{return JSON[_0x7b4c('0x7')](this[_0x7b4c('0x8')](_0x7b4c('0x9')));}catch(_0x5adec9){return[];}},'set':function(_0x1b0f57){try{this[_0x7b4c('0xa')](_0x7b4c('0x9'),JSON['stringify'](_0x1b0f57));}catch(_0x2d7b7e){this[_0x7b4c('0xa')]('attrs',JSON[_0x7b4c('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7b4c('0xc')]},'col':{'type':Sequelize[_0x7b4c('0xc')]},'background':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7b4c('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 c9b5ef9..9909c7e 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 _0x1dcc=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','merge','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','body','create','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse'];(function(_0x1ff212,_0x2c3934){var _0x30d3f3=function(_0x348ec2){while(--_0x348ec2){_0x1ff212['push'](_0x1ff212['shift']());}};_0x30d3f3(++_0x2c3934);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x13ec50,_0x1f532f){_0x13ec50=_0x13ec50-0x0;var _0x736ee7=_0x1dcc[_0x13ec50];return _0x736ee7;};'use strict';var emlformat=require(_0xc1dc('0x0'));var rimraf=require(_0xc1dc('0x1'));var zipdir=require(_0xc1dc('0x2'));var jsonpatch=require(_0xc1dc('0x3'));var rp=require('request-promise');var moment=require(_0xc1dc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1dc('0x5'));var util=require(_0xc1dc('0x6'));var path=require(_0xc1dc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc1dc('0x8'));var fs=require('fs');var fs_extra=require(_0xc1dc('0x9'));var _=require(_0xc1dc('0xa'));var squel=require('squel');var crypto=require(_0xc1dc('0xb'));var jsforce=require(_0xc1dc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc1dc('0xd'));var querystring=require('querystring');var Papa=require(_0xc1dc('0xe'));var Redis=require('ioredis');var authService=require(_0xc1dc('0xf'));var qs=require(_0xc1dc('0x10'));var as=require(_0xc1dc('0x11'));var hardwareService=require(_0xc1dc('0x12'));var logger=require(_0xc1dc('0x13'))(_0xc1dc('0x14'));var utils=require(_0xc1dc('0x15'));var config=require(_0xc1dc('0x16'));var licenseUtil=require(_0xc1dc('0x17'));var db=require('../../mysqldb')['db'];config[_0xc1dc('0x18')]=_[_0xc1dc('0x19')](config[_0xc1dc('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc1dc('0x1a'))(new Redis(config[_0xc1dc('0x18')]));require(_0xc1dc('0x1b'))[_0xc1dc('0x1c')](socket);function respondWithStatusCode(_0x145708,_0x322868){_0x322868=_0x322868||0xcc;return function(_0x188182){if(_0x188182){return _0x145708[_0xc1dc('0x1d')](_0x322868);}return _0x145708[_0xc1dc('0x1e')](_0x322868)[_0xc1dc('0x1f')]();};}function respondWithResult(_0x1cbbfe,_0x5885b0){_0x5885b0=_0x5885b0||0xc8;return function(_0x16ec8b){if(_0x16ec8b){return _0x1cbbfe[_0xc1dc('0x1e')](_0x5885b0)[_0xc1dc('0x20')](_0x16ec8b);}};}function respondWithFilteredResult(_0x3d3315,_0x47c72e){return function(_0x332400){if(_0x332400){var _0xc01137=typeof _0x47c72e['offset']==='undefined'&&typeof _0x47c72e[_0xc1dc('0x21')]===_0xc1dc('0x22');var _0x197941=_0x332400[_0xc1dc('0x23')];var _0x1707dc=_0xc01137?0x0:_0x47c72e[_0xc1dc('0x24')];var _0xedc38f=_0xc01137?_0x332400[_0xc1dc('0x23')]:_0x47c72e['offset']+_0x47c72e['limit'];var _0x4efe0d;if(_0xedc38f>=_0x197941){_0xedc38f=_0x197941;_0x4efe0d=0xc8;}else{_0x4efe0d=0xce;}_0x3d3315[_0xc1dc('0x1e')](_0x4efe0d);return _0x3d3315[_0xc1dc('0x25')]('Content-Range',_0x1707dc+'-'+_0xedc38f+'/'+_0x197941)[_0xc1dc('0x20')](_0x332400);}return null;};}function patchUpdates(_0x19325f){return function(_0x3f6552){try{jsonpatch[_0xc1dc('0x26')](_0x3f6552,_0x19325f,!![]);}catch(_0x22b80d){return BPromise[_0xc1dc('0x27')](_0x22b80d);}return _0x3f6552[_0xc1dc('0x28')]();};}function saveUpdates(_0x18ba56,_0x3efff1){return function(_0x1a6d65){if(_0x1a6d65){return _0x1a6d65['update'](_0x18ba56)[_0xc1dc('0x29')](function(_0xfeb0b1){return _0xfeb0b1;});}return null;};}function removeEntity(_0x17ce2b,_0x52b0b9){return function(_0x4e3ab2){if(_0x4e3ab2){return _0x4e3ab2[_0xc1dc('0x2a')]()[_0xc1dc('0x29')](function(){_0x17ce2b[_0xc1dc('0x1e')](0xcc)[_0xc1dc('0x1f')]();});}};}function handleEntityNotFound(_0x354e71,_0x152a50){return function(_0xd67136){if(!_0xd67136){_0x354e71[_0xc1dc('0x1d')](0x194);}return _0xd67136;};}function handleError(_0x204b8a,_0x5dbd36){_0x5dbd36=_0x5dbd36||0x1f4;return function(_0x2d5a57){logger[_0xc1dc('0x2b')](_0x2d5a57[_0xc1dc('0x2c')]);if(_0x2d5a57[_0xc1dc('0x2d')]){delete _0x2d5a57[_0xc1dc('0x2d')];}_0x204b8a[_0xc1dc('0x1e')](_0x5dbd36)[_0xc1dc('0x2e')](_0x2d5a57);};}exports[_0xc1dc('0x2f')]=function(_0x336add,_0x1182a4){var _0x3b9dc9={'raw':![],'where':{'id':_0x336add[_0xc1dc('0x30')]['id']}},_0x5c380c={};_0x5c380c[_0xc1dc('0x31')]=_[_0xc1dc('0x32')](db[_0xc1dc('0x33')][_0xc1dc('0x34')]);_0x5c380c[_0xc1dc('0x35')]=_[_0xc1dc('0x32')](_0x336add[_0xc1dc('0x35')]);_0x5c380c[_0xc1dc('0x36')]=_['intersection'](_0x5c380c['model'],_0x5c380c[_0xc1dc('0x35')]);_0x3b9dc9[_0xc1dc('0x37')]=_[_0xc1dc('0x38')](_0x5c380c[_0xc1dc('0x31')],qs[_0xc1dc('0x39')](_0x336add[_0xc1dc('0x35')]['fields']));_0x3b9dc9[_0xc1dc('0x37')]=_0x3b9dc9[_0xc1dc('0x37')]['length']?_0x3b9dc9[_0xc1dc('0x37')]:_0x5c380c[_0xc1dc('0x31')];if(_0x336add['query'][_0xc1dc('0x3a')]){_0x3b9dc9[_0xc1dc('0x3b')]=[{'all':!![]}];}_0x3b9dc9=_[_0xc1dc('0x3c')]({},_0x3b9dc9,_0x336add['options']);return db[_0xc1dc('0x33')][_0xc1dc('0x3d')](_0x3b9dc9)[_0xc1dc('0x29')](handleEntityNotFound(_0x1182a4,null))[_0xc1dc('0x29')](respondWithResult(_0x1182a4,null))[_0xc1dc('0x3e')](handleError(_0x1182a4,null));};exports[_0xc1dc('0x2a')]=function(_0x2dcc63,_0x796d11){return db[_0xc1dc('0x33')]['find']({'where':{'id':_0x2dcc63[_0xc1dc('0x30')]['id']}})[_0xc1dc('0x29')](handleEntityNotFound(_0x796d11,null))[_0xc1dc('0x29')](removeEntity(_0x796d11,null))['catch'](handleError(_0x796d11,null));};function widgetAttributes(_0x19bde9){try{switch(_0x19bde9[_0xc1dc('0x3f')]){case _0xc1dc('0x40'):return[{'name':_0xc1dc('0x41'),'value':_0x19bde9[_0xc1dc('0x41')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x0]?_0x19bde9[_0xc1dc('0x42')][0x0]['value']:undefined)||_0xc1dc('0x43')}];case _0xc1dc('0x44'):return[{'name':_0xc1dc('0x45'),'value':_0x19bde9[_0xc1dc('0x45')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x0]?_0x19bde9['attrs'][0x0][_0xc1dc('0x46')]:undefined)||''}];case _0xc1dc('0x47'):return[{'name':_0xc1dc('0x48'),'value':_0x19bde9[_0xc1dc('0x48')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x0]?_0x19bde9['attrs'][0x0][_0xc1dc('0x46')]:undefined)||_0xc1dc('0x49')},{'name':_0xc1dc('0x4a'),'value':_0x19bde9[_0xc1dc('0x4a')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x1]?_0x19bde9[_0xc1dc('0x42')][0x1]['value']:undefined)||_0xc1dc('0x4b')},{'name':_0xc1dc('0x4c'),'value':_0x19bde9[_0xc1dc('0x4c')]||(_0x19bde9['attrs']&&_0x19bde9[_0xc1dc('0x42')][0x2]?_0x19bde9[_0xc1dc('0x42')][0x2][_0xc1dc('0x46')]:undefined)||0xc}];case _0xc1dc('0x4d'):return[{'name':'attrMetric','value':_0x19bde9['attrMetric']||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x0]?_0x19bde9['attrs'][0x0][_0xc1dc('0x46')]:undefined)||_0xc1dc('0x4e')},{'name':_0xc1dc('0x4f'),'value':_0x19bde9[_0xc1dc('0x4f')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x1]?_0x19bde9[_0xc1dc('0x42')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x19bde9[_0xc1dc('0x4c')]||(_0x19bde9['attrs']&&_0x19bde9[_0xc1dc('0x42')][0x2]?_0x19bde9[_0xc1dc('0x42')][0x2][_0xc1dc('0x46')]:undefined)||0x14},{'name':_0xc1dc('0x50'),'value':_0x19bde9[_0xc1dc('0x50')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x3]?_0x19bde9[_0xc1dc('0x42')][0x3]['value']:undefined)||_0xc1dc('0x51')},{'name':_0xc1dc('0x52'),'value':_0x19bde9[_0xc1dc('0x52')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x4]?_0x19bde9[_0xc1dc('0x42')][0x4][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x53'),'value':_0x19bde9[_0xc1dc('0x53')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x5]?_0x19bde9['attrs'][0x5]['value']:undefined)||''},{'name':_0xc1dc('0x54'),'value':_0x19bde9[_0xc1dc('0x54')]||(_0x19bde9['attrs']&&_0x19bde9[_0xc1dc('0x42')][0x6]?_0x19bde9[_0xc1dc('0x42')][0x6]['value']:undefined)||''},{'name':_0xc1dc('0x55'),'value':_0x19bde9['attrOpenchannelAccounts']||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x7]?_0x19bde9[_0xc1dc('0x42')][0x7][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x56'),'value':_0x19bde9[_0xc1dc('0x56')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x8]?_0x19bde9['attrs'][0x8][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x57'),'value':_0x19bde9[_0xc1dc('0x57')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x9]?_0x19bde9[_0xc1dc('0x42')][0x9][_0xc1dc('0x46')]:undefined)||''}];case _0xc1dc('0x58'):case _0xc1dc('0x59'):return[{'name':_0xc1dc('0x5a'),'value':_0x19bde9[_0xc1dc('0x5a')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x0]?_0x19bde9['attrs'][0x0][_0xc1dc('0x46')]:undefined)||_0xc1dc('0x4e')},{'name':_0xc1dc('0x5b'),'value':_0x19bde9[_0xc1dc('0x5b')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x1]?_0x19bde9[_0xc1dc('0x42')][0x1]['value']:undefined)||null},{'name':_0xc1dc('0x5c'),'value':_0x19bde9[_0xc1dc('0x5c')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x2]?_0x19bde9[_0xc1dc('0x42')][0x2][_0xc1dc('0x46')]:undefined)||null},{'name':_0xc1dc('0x4f'),'value':_0x19bde9[_0xc1dc('0x4f')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x3]?_0x19bde9[_0xc1dc('0x42')][0x3]['value']:undefined)||[]},{'name':_0xc1dc('0x50'),'value':_0x19bde9[_0xc1dc('0x50')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x4]?_0x19bde9[_0xc1dc('0x42')][0x4][_0xc1dc('0x46')]:undefined)||_0xc1dc('0x51')},{'name':'attrEmailAccounts','value':_0x19bde9[_0xc1dc('0x52')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x5]?_0x19bde9['attrs'][0x5][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x53'),'value':_0x19bde9[_0xc1dc('0x53')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x6]?_0x19bde9['attrs'][0x6][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x54'),'value':_0x19bde9[_0xc1dc('0x54')]||(_0x19bde9['attrs']&&_0x19bde9[_0xc1dc('0x42')][0x7]?_0x19bde9[_0xc1dc('0x42')][0x7][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x55'),'value':_0x19bde9[_0xc1dc('0x55')]||(_0x19bde9['attrs']&&_0x19bde9[_0xc1dc('0x42')][0x8]?_0x19bde9[_0xc1dc('0x42')][0x8][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x56'),'value':_0x19bde9[_0xc1dc('0x56')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x9]?_0x19bde9[_0xc1dc('0x42')][0x9][_0xc1dc('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0x19bde9['attrChatWebsites']||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0xa]?_0x19bde9[_0xc1dc('0x42')][0xa][_0xc1dc('0x46')]:undefined)||''}];case _0xc1dc('0x5d'):return[{'name':_0xc1dc('0x5e'),'type':_0x19bde9[_0xc1dc('0x5f')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x0]?_0x19bde9[_0xc1dc('0x42')][0x0][_0xc1dc('0x3f')]:undefined)||null,'value':_0x19bde9[_0xc1dc('0x5e')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x0]?_0x19bde9[_0xc1dc('0x42')][0x0][_0xc1dc('0x46')]:undefined)||null},{'name':_0xc1dc('0x60'),'value':_0x19bde9[_0xc1dc('0x60')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x1]?_0x19bde9[_0xc1dc('0x42')][0x1][_0xc1dc('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x260f68){logger['error']('widgetAttributes:\x20%s',JSON[_0xc1dc('0x61')](_0x260f68));return[];}}exports['create']=function(_0x1a9cc4,_0x1e0098){if(_0x1a9cc4[_0xc1dc('0x62')]){_0x1a9cc4[_0xc1dc('0x62')]['attrs']=widgetAttributes(_0x1a9cc4['body']);}return db[_0xc1dc('0x33')][_0xc1dc('0x63')](_0x1a9cc4[_0xc1dc('0x62')],{})[_0xc1dc('0x29')](respondWithResult(_0x1e0098,0xc9))[_0xc1dc('0x3e')](handleError(_0x1e0098,null));};exports[_0xc1dc('0x64')]=function(_0x439daa,_0x5e6625){if(_0x439daa[_0xc1dc('0x62')]['id']){delete _0x439daa['body']['id'];}_0x439daa[_0xc1dc('0x62')][_0xc1dc('0x42')]=widgetAttributes(_0x439daa['body']);return db[_0xc1dc('0x33')][_0xc1dc('0x3d')]({'where':{'id':_0x439daa['params']['id']}})[_0xc1dc('0x29')](handleEntityNotFound(_0x5e6625,null))[_0xc1dc('0x29')](saveUpdates(_0x439daa['body'],null))[_0xc1dc('0x29')](respondWithResult(_0x5e6625,null))[_0xc1dc('0x3e')](handleError(_0x5e6625,null));}; \ No newline at end of file +var _0xdbcd=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','end','undefined','count','offset','status','Content-Range','json','reject','save','destroy','then','sendStatus','stack','name','show','params','model','keys','DashboardItem','rawAttributes','filters','intersection','query','attributes','fields','includeAll','merge','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x367bfc,_0x278556){_0x367bfc=_0x367bfc-0x0;var _0x50f6d3=_0xdbcd[_0x367bfc];return _0x50f6d3;};'use strict';var emlformat=require(_0xddbc('0x0'));var rimraf=require(_0xddbc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xddbc('0x2'));var moment=require(_0xddbc('0x3'));var BPromise=require(_0xddbc('0x4'));var Mustache=require('mustache');var util=require(_0xddbc('0x5'));var path=require(_0xddbc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddbc('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xddbc('0x8'));var toCsv=require(_0xddbc('0x9'));var querystring=require(_0xddbc('0xa'));var Papa=require(_0xddbc('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xddbc('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddbc('0xd'));var logger=require('../../config/logger')(_0xddbc('0xe'));var utils=require(_0xddbc('0xf'));var config=require(_0xddbc('0x10'));var licenseUtil=require(_0xddbc('0x11'));var db=require(_0xddbc('0x12'))['db'];config[_0xddbc('0x13')]=_[_0xddbc('0x14')](config[_0xddbc('0x13')],{'host':_0xddbc('0x15'),'port':0x18eb});var socket=require(_0xddbc('0x16'))(new Redis(config[_0xddbc('0x13')]));require(_0xddbc('0x17'))['register'](socket);function respondWithStatusCode(_0x57c81f,_0x45d556){_0x45d556=_0x45d556||0xcc;return function(_0x4453bf){if(_0x4453bf){return _0x57c81f['sendStatus'](_0x45d556);}return _0x57c81f['status'](_0x45d556)[_0xddbc('0x18')]();};}function respondWithResult(_0x2d4a9b,_0x2d366d){_0x2d366d=_0x2d366d||0xc8;return function(_0x19f977){if(_0x19f977){return _0x2d4a9b['status'](_0x2d366d)['json'](_0x19f977);}};}function respondWithFilteredResult(_0x356afe,_0x193c84){return function(_0x5d0a34){if(_0x5d0a34){var _0x48efdb=typeof _0x193c84['offset']===_0xddbc('0x19')&&typeof _0x193c84['limit']===_0xddbc('0x19');var _0xedd271=_0x5d0a34[_0xddbc('0x1a')];var _0x118569=_0x48efdb?0x0:_0x193c84[_0xddbc('0x1b')];var _0x114fc7=_0x48efdb?_0x5d0a34['count']:_0x193c84[_0xddbc('0x1b')]+_0x193c84['limit'];var _0x52426a;if(_0x114fc7>=_0xedd271){_0x114fc7=_0xedd271;_0x52426a=0xc8;}else{_0x52426a=0xce;}_0x356afe[_0xddbc('0x1c')](_0x52426a);return _0x356afe['set'](_0xddbc('0x1d'),_0x118569+'-'+_0x114fc7+'/'+_0xedd271)[_0xddbc('0x1e')](_0x5d0a34);}return null;};}function patchUpdates(_0x1cac88){return function(_0xa5a3a0){try{jsonpatch['apply'](_0xa5a3a0,_0x1cac88,!![]);}catch(_0x1e677a){return BPromise[_0xddbc('0x1f')](_0x1e677a);}return _0xa5a3a0[_0xddbc('0x20')]();};}function saveUpdates(_0x1d44a7,_0x328316){return function(_0x57eb60){if(_0x57eb60){return _0x57eb60['update'](_0x1d44a7)['then'](function(_0x302120){return _0x302120;});}return null;};}function removeEntity(_0x2f58cd,_0x2db65f){return function(_0x37c6f5){if(_0x37c6f5){return _0x37c6f5[_0xddbc('0x21')]()[_0xddbc('0x22')](function(){_0x2f58cd[_0xddbc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a7e0b,_0x136f64){return function(_0x12bf5b){if(!_0x12bf5b){_0x2a7e0b[_0xddbc('0x23')](0x194);}return _0x12bf5b;};}function handleError(_0x3b1f06,_0xb4f6f5){_0xb4f6f5=_0xb4f6f5||0x1f4;return function(_0x16a720){logger['error'](_0x16a720[_0xddbc('0x24')]);if(_0x16a720[_0xddbc('0x25')]){delete _0x16a720[_0xddbc('0x25')];}_0x3b1f06[_0xddbc('0x1c')](_0xb4f6f5)['send'](_0x16a720);};}exports[_0xddbc('0x26')]=function(_0x56042c,_0x49cc11){var _0x95a9c6={'raw':![],'where':{'id':_0x56042c[_0xddbc('0x27')]['id']}},_0x4d6329={};_0x4d6329[_0xddbc('0x28')]=_[_0xddbc('0x29')](db[_0xddbc('0x2a')][_0xddbc('0x2b')]);_0x4d6329['query']=_[_0xddbc('0x29')](_0x56042c['query']);_0x4d6329[_0xddbc('0x2c')]=_[_0xddbc('0x2d')](_0x4d6329[_0xddbc('0x28')],_0x4d6329[_0xddbc('0x2e')]);_0x95a9c6[_0xddbc('0x2f')]=_[_0xddbc('0x2d')](_0x4d6329[_0xddbc('0x28')],qs[_0xddbc('0x30')](_0x56042c['query'][_0xddbc('0x30')]));_0x95a9c6[_0xddbc('0x2f')]=_0x95a9c6[_0xddbc('0x2f')]['length']?_0x95a9c6[_0xddbc('0x2f')]:_0x4d6329['model'];if(_0x56042c[_0xddbc('0x2e')][_0xddbc('0x31')]){_0x95a9c6['include']=[{'all':!![]}];}_0x95a9c6=_[_0xddbc('0x32')]({},_0x95a9c6,_0x56042c['options']);return db[_0xddbc('0x2a')]['find'](_0x95a9c6)['then'](handleEntityNotFound(_0x49cc11,null))[_0xddbc('0x22')](respondWithResult(_0x49cc11,null))['catch'](handleError(_0x49cc11,null));};exports['destroy']=function(_0x457fe8,_0x8d2fbd){return db[_0xddbc('0x2a')]['find']({'where':{'id':_0x457fe8['params']['id']}})[_0xddbc('0x22')](handleEntityNotFound(_0x8d2fbd,null))['then'](removeEntity(_0x8d2fbd,null))[_0xddbc('0x33')](handleError(_0x8d2fbd,null));};function widgetAttributes(_0x217c99){try{switch(_0x217c99[_0xddbc('0x34')]){case _0xddbc('0x35'):return[{'name':_0xddbc('0x36'),'value':_0x217c99[_0xddbc('0x36')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0][_0xddbc('0x38')]:undefined)||_0xddbc('0x39')}];case _0xddbc('0x3a'):return[{'name':_0xddbc('0x3b'),'value':_0x217c99[_0xddbc('0x3b')]||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0][_0xddbc('0x38')]:undefined)||''}];case _0xddbc('0x3c'):return[{'name':_0xddbc('0x3d'),'value':_0x217c99['attrHourFormat']||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0][_0xddbc('0x38')]:undefined)||_0xddbc('0x3e')},{'name':'attrTimezone','value':_0x217c99[_0xddbc('0x3f')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x1]?_0x217c99[_0xddbc('0x37')][0x1][_0xddbc('0x38')]:undefined)||_0xddbc('0x40')},{'name':_0xddbc('0x41'),'value':_0x217c99[_0xddbc('0x41')]||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x2]?_0x217c99[_0xddbc('0x37')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xddbc('0x42'),'value':_0x217c99[_0xddbc('0x42')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0]['value']:undefined)||_0xddbc('0x43')},{'name':'attrVoiceQueues','value':_0x217c99[_0xddbc('0x44')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x1]?_0x217c99[_0xddbc('0x37')][0x1][_0xddbc('0x38')]:undefined)||[]},{'name':_0xddbc('0x41'),'value':_0x217c99['attrFontSize']||(_0x217c99['attrs']&&_0x217c99['attrs'][0x2]?_0x217c99[_0xddbc('0x37')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x217c99['attrChannel']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x3]?_0x217c99[_0xddbc('0x37')][0x3][_0xddbc('0x38')]:undefined)||_0xddbc('0x45')},{'name':_0xddbc('0x46'),'value':_0x217c99[_0xddbc('0x46')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x4]?_0x217c99['attrs'][0x4][_0xddbc('0x38')]:undefined)||''},{'name':_0xddbc('0x47'),'value':_0x217c99[_0xddbc('0x47')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x5]?_0x217c99[_0xddbc('0x37')][0x5][_0xddbc('0x38')]:undefined)||''},{'name':_0xddbc('0x48'),'value':_0x217c99['attrSmsAccounts']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x6]?_0x217c99[_0xddbc('0x37')][0x6][_0xddbc('0x38')]:undefined)||''},{'name':_0xddbc('0x49'),'value':_0x217c99['attrOpenchannelAccounts']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x7]?_0x217c99[_0xddbc('0x37')][0x7]['value']:undefined)||''},{'name':_0xddbc('0x4a'),'value':_0x217c99[_0xddbc('0x4a')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x8]?_0x217c99[_0xddbc('0x37')][0x8][_0xddbc('0x38')]:undefined)||''},{'name':'attrChatWebsites','value':_0x217c99['attrChatWebsites']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x9]?_0x217c99[_0xddbc('0x37')][0x9][_0xddbc('0x38')]:undefined)||''}];case _0xddbc('0x4b'):case _0xddbc('0x4c'):return[{'name':'attrSerie1','value':_0x217c99[_0xddbc('0x4d')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0]['value']:undefined)||_0xddbc('0x43')},{'name':_0xddbc('0x4e'),'value':_0x217c99[_0xddbc('0x4e')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x1]?_0x217c99[_0xddbc('0x37')][0x1][_0xddbc('0x38')]:undefined)||null},{'name':'attrSerie3','value':_0x217c99[_0xddbc('0x4f')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x2]?_0x217c99[_0xddbc('0x37')][0x2]['value']:undefined)||null},{'name':_0xddbc('0x44'),'value':_0x217c99[_0xddbc('0x44')]||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x3]?_0x217c99[_0xddbc('0x37')][0x3][_0xddbc('0x38')]:undefined)||[]},{'name':_0xddbc('0x50'),'value':_0x217c99[_0xddbc('0x50')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x4]?_0x217c99[_0xddbc('0x37')][0x4][_0xddbc('0x38')]:undefined)||'voice'},{'name':_0xddbc('0x46'),'value':_0x217c99[_0xddbc('0x46')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x5]?_0x217c99[_0xddbc('0x37')][0x5]['value']:undefined)||''},{'name':_0xddbc('0x47'),'value':_0x217c99[_0xddbc('0x47')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x6]?_0x217c99[_0xddbc('0x37')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x217c99[_0xddbc('0x48')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x7]?_0x217c99[_0xddbc('0x37')][0x7]['value']:undefined)||''},{'name':_0xddbc('0x49'),'value':_0x217c99['attrOpenchannelAccounts']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x8]?_0x217c99['attrs'][0x8][_0xddbc('0x38')]:undefined)||''},{'name':_0xddbc('0x4a'),'value':_0x217c99[_0xddbc('0x4a')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x9]?_0x217c99[_0xddbc('0x37')][0x9]['value']:undefined)||''},{'name':_0xddbc('0x51'),'value':_0x217c99[_0xddbc('0x51')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0xa]?_0x217c99['attrs'][0xa]['value']:undefined)||''}];case _0xddbc('0x52'):return[{'name':_0xddbc('0x53'),'type':_0x217c99[_0xddbc('0x54')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x0]?_0x217c99[_0xddbc('0x37')][0x0][_0xddbc('0x34')]:undefined)||null,'value':_0x217c99[_0xddbc('0x53')]||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0]['value']:undefined)||null},{'name':_0xddbc('0x55'),'value':_0x217c99[_0xddbc('0x55')]||(_0x217c99['attrs']&&_0x217c99['attrs'][0x1]?_0x217c99['attrs'][0x1][_0xddbc('0x38')]:undefined)||0x0}];default:return[];}}catch(_0x1959e0){logger['error'](_0xddbc('0x56'),JSON[_0xddbc('0x57')](_0x1959e0));return[];}}exports[_0xddbc('0x58')]=function(_0x5e9a01,_0x2a1060){if(_0x5e9a01['body']){_0x5e9a01[_0xddbc('0x59')]['attrs']=widgetAttributes(_0x5e9a01[_0xddbc('0x59')]);}return db[_0xddbc('0x2a')][_0xddbc('0x58')](_0x5e9a01[_0xddbc('0x59')],{})['then'](respondWithResult(_0x2a1060,0xc9))[_0xddbc('0x33')](handleError(_0x2a1060,null));};exports[_0xddbc('0x5a')]=function(_0x294fda,_0xda1c23){if(_0x294fda[_0xddbc('0x59')]['id']){delete _0x294fda[_0xddbc('0x59')]['id'];}_0x294fda['body'][_0xddbc('0x37')]=widgetAttributes(_0x294fda['body']);return db['DashboardItem'][_0xddbc('0x5b')]({'where':{'id':_0x294fda[_0xddbc('0x27')]['id']}})[_0xddbc('0x22')](handleEntityNotFound(_0xda1c23,null))[_0xddbc('0x22')](saveUpdates(_0x294fda[_0xddbc('0x59')],null))[_0xddbc('0x22')](respondWithResult(_0xda1c23,null))[_0xddbc('0x33')](handleError(_0xda1c23,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 1289909..d6e0054 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 _0xff48=['save','remove','emit','exports','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x118793,_0x2618b2){var _0x527018=function(_0x47239c){while(--_0x47239c){_0x118793['push'](_0x118793['shift']());}};_0x527018(++_0x2618b2);}(_0xff48,0xf2));var _0x8ff4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xff48[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x8ff4('0x0'))['db'][_0x8ff4('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8ff4('0x2')](0x0);var events={'afterCreate':_0x8ff4('0x3'),'afterUpdate':'update','afterDestroy':_0x8ff4('0x4')};function emitEvent(_0x47785e){return function(_0x241fd0,_0x29abc4,_0x5bea34){DashboardItemEvents[_0x8ff4('0x5')](_0x47785e+':'+_0x241fd0['id'],_0x241fd0);DashboardItemEvents[_0x8ff4('0x5')](_0x47785e,_0x241fd0);_0x5bea34(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x8ff4('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x1e5e=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1e5e,0x88));var _0xe1e5=function(_0x4e85ec,_0x2913b6){_0x4e85ec=_0x4e85ec-0x0;var _0x1c1ab3=_0x1e5e[_0x4e85ec];return _0x1c1ab3;};'use strict';var EventEmitter=require(_0xe1e5('0x0'));var DashboardItem=require(_0xe1e5('0x1'))['db'][_0xe1e5('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe1e5('0x3')](0x0);var events={'afterCreate':_0xe1e5('0x4'),'afterUpdate':_0xe1e5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x512dc2){return function(_0x286815,_0x58a335,_0x510bb2){DashboardItemEvents[_0xe1e5('0x6')](_0x512dc2+':'+_0x286815['id'],_0x286815);DashboardItemEvents['emit'](_0x512dc2,_0x286815);_0x510bb2(null);};}for(var e in events){if(events[_0xe1e5('0x7')](e)){var event=events[e];DashboardItem[_0xe1e5('0x8')](e,emitEvent(event));}}module[_0xe1e5('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 625fb9e..b280119 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 _0x154e=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x149c82,_0x5521e9){var _0x1b032a=function(_0x3dd650){while(--_0x3dd650){_0x149c82['push'](_0x149c82['shift']());}};_0x1b032a(++_0x5521e9);}(_0x154e,0xd3));var _0xe154=function(_0x407bfc,_0x296d09){_0x407bfc=_0x407bfc-0x0;var _0x3a352d=_0x154e[_0x407bfc];return _0x3a352d;};'use strict';var _=require(_0xe154('0x0'));var util=require(_0xe154('0x1'));var logger=require(_0xe154('0x2'))('api');var moment=require(_0xe154('0x3'));var BPromise=require(_0xe154('0x4'));var rp=require(_0xe154('0x5'));var fs=require('fs');var path=require(_0xe154('0x6'));var rimraf=require(_0xe154('0x7'));var config=require(_0xe154('0x8'));var attributes=require(_0xe154('0x9'));module[_0xe154('0xa')]=function(_0x66f3ff,_0xe013a9){return _0x66f3ff[_0xe154('0xb')](_0xe154('0xc'),attributes,{'tableName':_0xe154('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4f2=['api','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','util','../../config/logger'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0xb4f2,0x1eb));var _0x2b4f=function(_0x513b20,_0x4b77e4){_0x513b20=_0x513b20-0x0;var _0x37da72=_0xb4f2[_0x513b20];return _0x37da72;};'use strict';var _=require(_0x2b4f('0x0'));var util=require(_0x2b4f('0x1'));var logger=require(_0x2b4f('0x2'))(_0x2b4f('0x3'));var moment=require(_0x2b4f('0x4'));var BPromise=require('bluebird');var rp=require(_0x2b4f('0x5'));var fs=require('fs');var path=require(_0x2b4f('0x6'));var rimraf=require(_0x2b4f('0x7'));var config=require(_0x2b4f('0x8'));var attributes=require(_0x2b4f('0x9'));module['exports']=function(_0xb3c554,_0x5613ca){return _0xb3c554[_0x2b4f('0xa')](_0x2b4f('0xb'),attributes,{'tableName':_0x2b4f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 701d46d..fdd1717 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 _0xddbc=['redis','./dashboardItem.socket','then','info','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','localhost','socket.io-emitter'];(function(_0x3af7c0,_0xae3ae0){var _0x23a789=function(_0x3bef73){while(--_0x3bef73){_0x3af7c0['push'](_0x3af7c0['shift']());}};_0x23a789(++_0xae3ae0);}(_0xddbc,0x1f3));var _0xcddb=function(_0x3b4458,_0x36be7c){_0x3b4458=_0x3b4458-0x0;var _0x104891=_0xddbc[_0x3b4458];return _0x104891;};'use strict';var _=require(_0xcddb('0x0'));var util=require(_0xcddb('0x1'));var moment=require(_0xcddb('0x2'));var BPromise=require(_0xcddb('0x3'));var rs=require(_0xcddb('0x4'));var fs=require('fs');var Redis=require(_0xcddb('0x5'));var db=require(_0xcddb('0x6'))['db'];var utils=require(_0xcddb('0x7'));var logger=require(_0xcddb('0x8'))('rpc');var config=require(_0xcddb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcddb('0xa')][_0xcddb('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xcddb('0xc'),'port':0x18eb});var socket=require(_0xcddb('0xd'))(new Redis(config[_0xcddb('0xe')]));require(_0xcddb('0xf'))['register'](socket);function respondWithRpcPromise(_0x44a177,_0x3893dd,_0x153914){return new BPromise(function(_0x2eaeff,_0xf539ff){return client['request'](_0x44a177,_0x153914)[_0xcddb('0x10')](function(_0x1af0b7){logger[_0xcddb('0x11')](_0xcddb('0x12'),_0x3893dd,'request\x20sent');logger['debug'](_0xcddb('0x13'),_0x3893dd,_0xcddb('0x14'),JSON[_0xcddb('0x15')](_0x1af0b7));if(_0x1af0b7[_0xcddb('0x16')]){if(_0x1af0b7[_0xcddb('0x16')][_0xcddb('0x17')]===0x1f4){logger[_0xcddb('0x16')](_0xcddb('0x12'),_0x3893dd,_0x1af0b7[_0xcddb('0x16')][_0xcddb('0x18')]);return _0xf539ff(_0x1af0b7[_0xcddb('0x16')]['message']);}logger[_0xcddb('0x16')](_0xcddb('0x12'),_0x3893dd,_0x1af0b7[_0xcddb('0x16')]['message']);return _0x2eaeff(_0x1af0b7[_0xcddb('0x16')]['message']);}else{logger[_0xcddb('0x11')](_0xcddb('0x12'),_0x3893dd,_0xcddb('0x14'));_0x2eaeff(_0x1af0b7[_0xcddb('0x19')]['message']);}})[_0xcddb('0x1a')](function(_0x2a2b75){logger[_0xcddb('0x16')](_0xcddb('0x12'),_0x3893dd,_0x2a2b75);_0xf539ff(_0x2a2b75);});});} \ No newline at end of file +var _0x2127=['message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2127,0xb9));var _0x7212=function(_0x15f4c5,_0x2e3e61){_0x15f4c5=_0x15f4c5-0x0;var _0x53b5ee=_0x2127[_0x15f4c5];return _0x53b5ee;};'use strict';var _=require(_0x7212('0x0'));var util=require(_0x7212('0x1'));var moment=require('moment');var BPromise=require(_0x7212('0x2'));var rs=require(_0x7212('0x3'));var fs=require('fs');var Redis=require(_0x7212('0x4'));var db=require(_0x7212('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7212('0x6'));var config=require(_0x7212('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7212('0x8')]({'port':0x232a});config[_0x7212('0x9')]=_[_0x7212('0xa')](config[_0x7212('0x9')],{'host':_0x7212('0xb'),'port':0x18eb});var socket=require(_0x7212('0xc'))(new Redis(config[_0x7212('0x9')]));require(_0x7212('0xd'))[_0x7212('0xe')](socket);function respondWithRpcPromise(_0x32ae24,_0x428a2f,_0x5cd7cf){return new BPromise(function(_0x3c7b02,_0xc047f3){return client[_0x7212('0xf')](_0x32ae24,_0x5cd7cf)['then'](function(_0x33e08b){logger['info']('DashboardItem,\x20%s,\x20%s',_0x428a2f,_0x7212('0x10'));logger[_0x7212('0x11')](_0x7212('0x12'),_0x428a2f,_0x7212('0x10'),JSON[_0x7212('0x13')](_0x33e08b));if(_0x33e08b[_0x7212('0x14')]){if(_0x33e08b['error'][_0x7212('0x15')]===0x1f4){logger[_0x7212('0x14')](_0x7212('0x16'),_0x428a2f,_0x33e08b[_0x7212('0x14')][_0x7212('0x17')]);return _0xc047f3(_0x33e08b[_0x7212('0x14')][_0x7212('0x17')]);}logger[_0x7212('0x14')](_0x7212('0x16'),_0x428a2f,_0x33e08b[_0x7212('0x14')][_0x7212('0x17')]);return _0x3c7b02(_0x33e08b[_0x7212('0x14')][_0x7212('0x17')]);}else{logger[_0x7212('0x18')]('DashboardItem,\x20%s,\x20%s',_0x428a2f,_0x7212('0x10'));_0x3c7b02(_0x33e08b[_0x7212('0x19')][_0x7212('0x17')]);}})['catch'](function(_0x13bc4a){logger[_0x7212('0x14')](_0x7212('0x16'),_0x428a2f,_0x13bc4a);_0xc047f3(_0x13bc4a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 8a0492e..7ec0ba3 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 _0x595c=['dashboardItem:','update','emit','removeListener','register','length'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x595c,0x1f3));var _0xc595=function(_0x469b0e,_0x43a3e4){_0x469b0e=_0x469b0e-0x0;var _0x5eaf17=_0x595c[_0x469b0e];return _0x5eaf17;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove',_0xc595('0x0')];function createListener(_0x1aa6a1,_0x333093){return function(_0x47f922){_0x333093[_0xc595('0x1')](_0x1aa6a1,_0x47f922);};}function removeListener(_0x38a8f2,_0x1eea5d){return function(){DashboardItemEvents[_0xc595('0x2')](_0x38a8f2,_0x1eea5d);};}exports[_0xc595('0x3')]=function(_0x268694){for(var _0x529278=0x0,_0x520147=events[_0xc595('0x4')];_0x529278<_0x520147;_0x529278++){var _0x30d971=events[_0x529278];var _0x4fe826=createListener(_0xc595('0x5')+_0x30d971,_0x268694);DashboardItemEvents['on'](_0x30d971,_0x4fe826);}}; \ No newline at end of file +var _0x8def=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x8def,0xfb));var _0xf8de=function(_0x144268,_0x1f17ee){_0x144268=_0x144268-0x0;var _0xd3d92d=_0x8def[_0x144268];return _0xd3d92d;};'use strict';var DashboardItemEvents=require(_0xf8de('0x0'));var events=['save','remove',_0xf8de('0x1')];function createListener(_0x19e43e,_0x520fb5){return function(_0x58c412){_0x520fb5[_0xf8de('0x2')](_0x19e43e,_0x58c412);};}function removeListener(_0x39018f,_0x501e62){return function(){DashboardItemEvents[_0xf8de('0x3')](_0x39018f,_0x501e62);};}exports[_0xf8de('0x4')]=function(_0x2f0c8a){for(var _0x49f159=0x0,_0x1e5cd3=events[_0xf8de('0x5')];_0x49f159<_0x1e5cd3;_0x49f159++){var _0xbe6a1b=events[_0x49f159];var _0x35029b=createListener(_0xf8de('0x6')+_0xbe6a1b,_0x2f0c8a);DashboardItemEvents['on'](_0xbe6a1b,_0x35029b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index d92b351..c27f60e 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 _0xe666=['post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0xf5c724,_0x41ea3e){var _0x3f6d0f=function(_0x1a0e76){while(--_0x1a0e76){_0xf5c724['push'](_0xf5c724['shift']());}};_0x3f6d0f(++_0x41ea3e);}(_0xe666,0x14a));var _0x6e66=function(_0x3185a1,_0x335b0c){_0x3185a1=_0x3185a1-0x0;var _0xacaa78=_0xe666[_0x3185a1];return _0xacaa78;};'use strict';var multer=require(_0x6e66('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6e66('0x1'));var express=require(_0x6e66('0x2'));var router=express[_0x6e66('0x3')]();var fs_extra=require(_0x6e66('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6e66('0x5'));var config=require(_0x6e66('0x6'));var controller=require(_0x6e66('0x7'));router[_0x6e66('0x8')](_0x6e66('0x9'),auth[_0x6e66('0xa')](),controller[_0x6e66('0xb')]);router[_0x6e66('0xc')]('/',auth[_0x6e66('0xa')](),controller[_0x6e66('0xd')]);router['put'](_0x6e66('0x9'),auth['isAuthenticated'](),controller[_0x6e66('0xe')]);router[_0x6e66('0xf')](_0x6e66('0x9'),auth[_0x6e66('0xa')](),controller[_0x6e66('0x10')]);module[_0x6e66('0x11')]=router; \ No newline at end of file +var _0xe742=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4cfd13,_0x1a0b90){var _0x4df1a1=function(_0xadf26d){while(--_0xadf26d){_0x4cfd13['push'](_0x4cfd13['shift']());}};_0x4df1a1(++_0x1a0b90);}(_0xe742,0x19e));var _0x2e74=function(_0x58143c,_0x5add3f){_0x58143c=_0x58143c-0x0;var _0x2bba42=_0xe742[_0x58143c];return _0x2bba42;};'use strict';var multer=require(_0x2e74('0x0'));var util=require(_0x2e74('0x1'));var path=require(_0x2e74('0x2'));var timeout=require(_0x2e74('0x3'));var express=require(_0x2e74('0x4'));var router=express[_0x2e74('0x5')]();var fs_extra=require(_0x2e74('0x6'));var auth=require(_0x2e74('0x7'));var interaction=require(_0x2e74('0x8'));var config=require(_0x2e74('0x9'));var controller=require('./dashboardItem.controller');router[_0x2e74('0xa')]('/:id',auth[_0x2e74('0xb')](),controller['show']);router[_0x2e74('0xc')]('/',auth['isAuthenticated'](),controller[_0x2e74('0xd')]);router[_0x2e74('0xe')](_0x2e74('0xf'),auth['isAuthenticated'](),controller[_0x2e74('0x10')]);router[_0x2e74('0x11')]('/:id',auth[_0x2e74('0xb')](),controller[_0x2e74('0x12')]);module[_0x2e74('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 918e534..18c83a7 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 _0x43af=['first','sequelize','exports','STRING','ENUM'];(function(_0x4fc7b3,_0x17e8eb){var _0xc6ca00=function(_0x2bdcc3){while(--_0x2bdcc3){_0x4fc7b3['push'](_0x4fc7b3['shift']());}};_0xc6ca00(++_0x17e8eb);}(_0x43af,0x18c));var _0xf43a=function(_0x15cce4,_0x1c32b2){_0x15cce4=_0x15cce4-0x0;var _0x5b2c23=_0x43af[_0x15cce4];return _0x5b2c23;};'use strict';var Sequelize=require(_0xf43a('0x0'));module[_0xf43a('0x1')]={'name':{'type':Sequelize[_0xf43a('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xf43a('0x3')](_0xf43a('0x4'),'second','third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xf43a('0x2')]}}; \ No newline at end of file +var _0xebe5=['ENUM','first','second','third','STRING','sequelize','exports'];(function(_0x4a3643,_0x28ccb2){var _0x345387=function(_0x224bd3){while(--_0x224bd3){_0x4a3643['push'](_0x4a3643['shift']());}};_0x345387(++_0x28ccb2);}(_0xebe5,0x16a));var _0x5ebe=function(_0x1ff528,_0x22ce2b){_0x1ff528=_0x1ff528-0x0;var _0x2094c2=_0xebe5[_0x1ff528];return _0x2094c2;};'use strict';var Sequelize=require(_0x5ebe('0x0'));module[_0x5ebe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x5ebe('0x2')](_0x5ebe('0x3'),_0x5ebe('0x4'),_0x5ebe('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x5ebe('0x6')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 01406a2..cba1e40 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 _0xc6f8=['params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','then','get','error','stack','name','send','index','map','Disposition','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x15fa6a,_0x20ae9d){var _0xae4565=function(_0x1930a8){while(--_0x1930a8){_0x15fa6a['push'](_0x15fa6a['shift']());}};_0xae4565(++_0x20ae9d);}(_0xc6f8,0x14c));var _0x8c6f=function(_0x4178c7,_0x6999b2){_0x4178c7=_0x4178c7-0x0;var _0x3b921a=_0xc6f8[_0x4178c7];return _0x3b921a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8c6f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c6f('0x1'));var moment=require(_0x8c6f('0x2'));var BPromise=require(_0x8c6f('0x3'));var Mustache=require(_0x8c6f('0x4'));var util=require(_0x8c6f('0x5'));var path=require('path');var sox=require(_0x8c6f('0x6'));var csv=require('to-csv');var ejs=require(_0x8c6f('0x7'));var fs=require('fs');var fs_extra=require(_0x8c6f('0x8'));var _=require('lodash');var squel=require(_0x8c6f('0x9'));var crypto=require('crypto');var jsforce=require(_0x8c6f('0xa'));var deskjs=require(_0x8c6f('0xb'));var toCsv=require(_0x8c6f('0xc'));var querystring=require('querystring');var Papa=require(_0x8c6f('0xd'));var Redis=require(_0x8c6f('0xe'));var authService=require(_0x8c6f('0xf'));var qs=require(_0x8c6f('0x10'));var as=require(_0x8c6f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8c6f('0x12'));var utils=require(_0x8c6f('0x13'));var config=require(_0x8c6f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c6f('0x15'))['db'];function respondWithStatusCode(_0x41e2a3,_0x372dc3){_0x372dc3=_0x372dc3||0xcc;return function(_0xdcb8bd){if(_0xdcb8bd){return _0x41e2a3[_0x8c6f('0x16')](_0x372dc3);}return _0x41e2a3[_0x8c6f('0x17')](_0x372dc3)[_0x8c6f('0x18')]();};}function respondWithResult(_0x3b1b26,_0xf9b0e3){_0xf9b0e3=_0xf9b0e3||0xc8;return function(_0x58f6ca){if(_0x58f6ca){return _0x3b1b26['status'](_0xf9b0e3)[_0x8c6f('0x19')](_0x58f6ca);}};}function respondWithFilteredResult(_0x1f20e9,_0x30d841){return function(_0x326cec){if(_0x326cec){var _0x469187=typeof _0x30d841[_0x8c6f('0x1a')]==='undefined'&&typeof _0x30d841[_0x8c6f('0x1b')]===_0x8c6f('0x1c');var _0x23e4a1=_0x326cec[_0x8c6f('0x1d')];var _0x57d008=_0x469187?0x0:_0x30d841[_0x8c6f('0x1a')];var _0x558ed5=_0x469187?_0x326cec[_0x8c6f('0x1d')]:_0x30d841['offset']+_0x30d841[_0x8c6f('0x1b')];var _0x173ca1;if(_0x558ed5>=_0x23e4a1){_0x558ed5=_0x23e4a1;_0x173ca1=0xc8;}else{_0x173ca1=0xce;}_0x1f20e9['status'](_0x173ca1);return _0x1f20e9[_0x8c6f('0x1e')](_0x8c6f('0x1f'),_0x57d008+'-'+_0x558ed5+'/'+_0x23e4a1)[_0x8c6f('0x19')](_0x326cec);}return null;};}function patchUpdates(_0xc256e1){return function(_0x53fe61){try{jsonpatch['apply'](_0x53fe61,_0xc256e1,!![]);}catch(_0x2033bc){return BPromise[_0x8c6f('0x20')](_0x2033bc);}return _0x53fe61['save']();};}function saveUpdates(_0x67dd2d,_0x59a65f){return function(_0x350768){if(_0x350768){return _0x350768[_0x8c6f('0x21')](_0x67dd2d)['then'](function(_0x5ce23d){return _0x5ce23d;});}return null;};}function removeEntity(_0x230863,_0x5c4fef){return function(_0x259f8a){if(_0x259f8a){return _0x259f8a[_0x8c6f('0x22')]()[_0x8c6f('0x23')](function(){var _0x1183da=_0x259f8a[_0x8c6f('0x24')]({'plain':!![]});var _0x437b64='Dispositions';return db['UserProfileResource']['destroy']({'where':{'type':_0x437b64,'resourceId':_0x1183da['id']}})[_0x8c6f('0x23')](function(){return _0x259f8a;});})[_0x8c6f('0x23')](function(){_0x230863[_0x8c6f('0x17')](0xcc)[_0x8c6f('0x18')]();});}};}function handleEntityNotFound(_0x4fe8e3,_0x4cf257){return function(_0x349585){if(!_0x349585){_0x4fe8e3[_0x8c6f('0x16')](0x194);}return _0x349585;};}function handleError(_0x5d09bc,_0x15e7a2){_0x15e7a2=_0x15e7a2||0x1f4;return function(_0x380d1d){logger[_0x8c6f('0x25')](_0x380d1d[_0x8c6f('0x26')]);if(_0x380d1d[_0x8c6f('0x27')]){delete _0x380d1d[_0x8c6f('0x27')];}_0x5d09bc[_0x8c6f('0x17')](_0x15e7a2)[_0x8c6f('0x28')](_0x380d1d);};}exports[_0x8c6f('0x29')]=function(_0x5aff44,_0x4f329b){var _0x5a3c8f={},_0xaa92fd={},_0x4dc2f1={'count':0x0,'rows':[]};var _0x31b865=_[_0x8c6f('0x2a')](db[_0x8c6f('0x2b')][_0x8c6f('0x2c')],function(_0x409fc4){return{'name':_0x409fc4['fieldName'],'type':_0x409fc4['type']['key']};});_0xaa92fd[_0x8c6f('0x2d')]=_[_0x8c6f('0x2a')](_0x31b865,_0x8c6f('0x27'));_0xaa92fd['query']=_[_0x8c6f('0x2e')](_0x5aff44[_0x8c6f('0x2f')]);_0xaa92fd[_0x8c6f('0x30')]=_[_0x8c6f('0x31')](_0xaa92fd[_0x8c6f('0x2d')],_0xaa92fd[_0x8c6f('0x2f')]);_0x5a3c8f[_0x8c6f('0x32')]=_[_0x8c6f('0x31')](_0xaa92fd['model'],qs['fields'](_0x5aff44[_0x8c6f('0x2f')][_0x8c6f('0x33')]));_0x5a3c8f['attributes']=_0x5a3c8f[_0x8c6f('0x32')][_0x8c6f('0x34')]?_0x5a3c8f[_0x8c6f('0x32')]:_0xaa92fd['model'];if(!_0x5aff44[_0x8c6f('0x2f')][_0x8c6f('0x35')]('nolimit')){_0x5a3c8f['limit']=qs[_0x8c6f('0x1b')](_0x5aff44[_0x8c6f('0x2f')]['limit']);_0x5a3c8f[_0x8c6f('0x1a')]=qs['offset'](_0x5aff44['query'][_0x8c6f('0x1a')]);}_0x5a3c8f[_0x8c6f('0x36')]=qs['sort'](_0x5aff44[_0x8c6f('0x2f')][_0x8c6f('0x37')]);_0x5a3c8f[_0x8c6f('0x38')]=qs['filters'](_['pick'](_0x5aff44[_0x8c6f('0x2f')],_0xaa92fd['filters']),_0x31b865);if(_0x5aff44[_0x8c6f('0x2f')][_0x8c6f('0x39')]){_0x5a3c8f[_0x8c6f('0x38')]=_[_0x8c6f('0x3a')](_0x5a3c8f[_0x8c6f('0x38')],{'$or':_[_0x8c6f('0x2a')](_0x31b865,function(_0x1cb7db){if(_0x1cb7db[_0x8c6f('0x3b')]!==_0x8c6f('0x3c')){var _0x5eb4ab={};_0x5eb4ab[_0x1cb7db[_0x8c6f('0x27')]]={'$like':'%'+_0x5aff44[_0x8c6f('0x2f')]['filter']+'%'};return _0x5eb4ab;}})});}_0x5a3c8f=_[_0x8c6f('0x3a')]({},_0x5a3c8f,_0x5aff44[_0x8c6f('0x3d')]);var _0x56f580={'where':_0x5a3c8f[_0x8c6f('0x38')]};return db[_0x8c6f('0x2b')][_0x8c6f('0x1d')](_0x56f580)[_0x8c6f('0x23')](function(_0x7330a8){_0x4dc2f1[_0x8c6f('0x1d')]=_0x7330a8;if(_0x5aff44['query'][_0x8c6f('0x3e')]){_0x5a3c8f[_0x8c6f('0x3f')]=[{'all':!![]}];}return db[_0x8c6f('0x2b')][_0x8c6f('0x40')](_0x5a3c8f);})['then'](function(_0x455a22){_0x4dc2f1[_0x8c6f('0x41')]=_0x455a22;return _0x4dc2f1;})[_0x8c6f('0x23')](respondWithFilteredResult(_0x4f329b,_0x5a3c8f))[_0x8c6f('0x42')](handleError(_0x4f329b,null));};exports[_0x8c6f('0x43')]=function(_0x5edf48,_0x1d3ce9){var _0xb2a21={'raw':!![],'where':{'id':_0x5edf48[_0x8c6f('0x44')]['id']}},_0x237c9f={};_0x237c9f[_0x8c6f('0x2d')]=_[_0x8c6f('0x2e')](db['Disposition'][_0x8c6f('0x2c')]);_0x237c9f[_0x8c6f('0x2f')]=_['keys'](_0x5edf48[_0x8c6f('0x2f')]);_0x237c9f[_0x8c6f('0x30')]=_[_0x8c6f('0x31')](_0x237c9f[_0x8c6f('0x2d')],_0x237c9f[_0x8c6f('0x2f')]);_0xb2a21[_0x8c6f('0x32')]=_[_0x8c6f('0x31')](_0x237c9f['model'],qs[_0x8c6f('0x33')](_0x5edf48[_0x8c6f('0x2f')][_0x8c6f('0x33')]));_0xb2a21['attributes']=_0xb2a21['attributes'][_0x8c6f('0x34')]?_0xb2a21[_0x8c6f('0x32')]:_0x237c9f['model'];if(_0x5edf48['query'][_0x8c6f('0x3e')]){_0xb2a21['include']=[{'all':!![]}];}_0xb2a21=_['merge']({},_0xb2a21,_0x5edf48['options']);return db[_0x8c6f('0x2b')][_0x8c6f('0x45')](_0xb2a21)['then'](handleEntityNotFound(_0x1d3ce9,null))['then'](respondWithResult(_0x1d3ce9,null))[_0x8c6f('0x42')](handleError(_0x1d3ce9,null));};exports[_0x8c6f('0x46')]=function(_0x5b8531,_0x39a943){return db[_0x8c6f('0x2b')][_0x8c6f('0x46')](_0x5b8531['body'],{})['then'](function(_0x21c090){var _0x3b5a75=_0x5b8531[_0x8c6f('0x47')][_0x8c6f('0x24')]({'plain':!![]});if(!_0x3b5a75)throw new Error(_0x8c6f('0x48'));if(_0x3b5a75[_0x8c6f('0x49')]==='user'){var _0x2d74cf=_0x21c090[_0x8c6f('0x24')]({'plain':!![]});var _0xebbd1a=_0x8c6f('0x4a');return db[_0x8c6f('0x4b')][_0x8c6f('0x45')]({'where':{'name':_0xebbd1a,'userProfileId':_0x3b5a75[_0x8c6f('0x4c')]},'raw':!![]})[_0x8c6f('0x23')](function(_0x1f8317){if(_0x1f8317&&_0x1f8317[_0x8c6f('0x4d')]===0x0){return db[_0x8c6f('0x4e')][_0x8c6f('0x46')]({'name':_0x2d74cf[_0x8c6f('0x27')],'resourceId':_0x2d74cf['id'],'type':_0x1f8317[_0x8c6f('0x27')],'sectionId':_0x1f8317['id']},{})['then'](function(){return _0x21c090;});}else{return _0x21c090;}})[_0x8c6f('0x42')](function(_0x3aa82f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3aa82f);throw _0x3aa82f;});}return _0x21c090;})[_0x8c6f('0x23')](respondWithResult(_0x39a943,0xc9))['catch'](handleError(_0x39a943,null));};exports['update']=function(_0x15349c,_0x48c381){if(_0x15349c[_0x8c6f('0x4f')]['id']){delete _0x15349c[_0x8c6f('0x4f')]['id'];}return db[_0x8c6f('0x2b')][_0x8c6f('0x45')]({'where':{'id':_0x15349c[_0x8c6f('0x44')]['id']}})[_0x8c6f('0x23')](handleEntityNotFound(_0x48c381,null))[_0x8c6f('0x23')](saveUpdates(_0x15349c[_0x8c6f('0x4f')],null))['then'](respondWithResult(_0x48c381,null))[_0x8c6f('0x42')](handleError(_0x48c381,null));};exports['destroy']=function(_0x54a52b,_0x1a8d97){return db[_0x8c6f('0x2b')][_0x8c6f('0x45')]({'where':{'id':_0x54a52b[_0x8c6f('0x44')]['id']}})[_0x8c6f('0x23')](handleEntityNotFound(_0x1a8d97,null))[_0x8c6f('0x23')](removeEntity(_0x1a8d97,null))['catch'](handleError(_0x1a8d97,null));}; \ No newline at end of file +var _0xe364=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','Dispositions','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','Disposition','includeAll','findAll','rows','catch','show','params','include','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xe364,0x1c3));var _0x4e36=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xe364[_0x344a3f];return _0x264712;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e36('0x0'));var zipdir=require(_0x4e36('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e36('0x2'));var moment=require('moment');var BPromise=require(_0x4e36('0x3'));var Mustache=require(_0x4e36('0x4'));var util=require(_0x4e36('0x5'));var path=require(_0x4e36('0x6'));var sox=require(_0x4e36('0x7'));var csv=require(_0x4e36('0x8'));var ejs=require(_0x4e36('0x9'));var fs=require('fs');var fs_extra=require(_0x4e36('0xa'));var _=require(_0x4e36('0xb'));var squel=require(_0x4e36('0xc'));var crypto=require(_0x4e36('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4e36('0xe'));var toCsv=require(_0x4e36('0x8'));var querystring=require('querystring');var Papa=require(_0x4e36('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e36('0x10'));var as=require(_0x4e36('0x11'));var hardwareService=require(_0x4e36('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4e36('0x13'));var licenseUtil=require(_0x4e36('0x14'));var db=require(_0x4e36('0x15'))['db'];function respondWithStatusCode(_0x15aef4,_0x207b36){_0x207b36=_0x207b36||0xcc;return function(_0x450389){if(_0x450389){return _0x15aef4['sendStatus'](_0x207b36);}return _0x15aef4['status'](_0x207b36)[_0x4e36('0x16')]();};}function respondWithResult(_0x4dea49,_0x3df804){_0x3df804=_0x3df804||0xc8;return function(_0xf8f048){if(_0xf8f048){return _0x4dea49[_0x4e36('0x17')](_0x3df804)['json'](_0xf8f048);}};}function respondWithFilteredResult(_0x5625a9,_0x35f9be){return function(_0x32f83c){if(_0x32f83c){var _0x11dcae=typeof _0x35f9be[_0x4e36('0x18')]===_0x4e36('0x19')&&typeof _0x35f9be[_0x4e36('0x1a')]===_0x4e36('0x19');var _0x20a00d=_0x32f83c[_0x4e36('0x1b')];var _0xe76500=_0x11dcae?0x0:_0x35f9be['offset'];var _0x26deb0=_0x11dcae?_0x32f83c[_0x4e36('0x1b')]:_0x35f9be['offset']+_0x35f9be[_0x4e36('0x1a')];var _0x133665;if(_0x26deb0>=_0x20a00d){_0x26deb0=_0x20a00d;_0x133665=0xc8;}else{_0x133665=0xce;}_0x5625a9[_0x4e36('0x17')](_0x133665);return _0x5625a9['set'](_0x4e36('0x1c'),_0xe76500+'-'+_0x26deb0+'/'+_0x20a00d)[_0x4e36('0x1d')](_0x32f83c);}return null;};}function patchUpdates(_0x349486){return function(_0xd95e41){try{jsonpatch[_0x4e36('0x1e')](_0xd95e41,_0x349486,!![]);}catch(_0x3bd4a9){return BPromise['reject'](_0x3bd4a9);}return _0xd95e41[_0x4e36('0x1f')]();};}function saveUpdates(_0x561618,_0x36a6f0){return function(_0xa6b337){if(_0xa6b337){return _0xa6b337[_0x4e36('0x20')](_0x561618)[_0x4e36('0x21')](function(_0x5d6bf6){return _0x5d6bf6;});}return null;};}function removeEntity(_0x4edcf8,_0x147cf7){return function(_0x2a1662){if(_0x2a1662){return _0x2a1662[_0x4e36('0x22')]()[_0x4e36('0x21')](function(){var _0x179084=_0x2a1662['get']({'plain':!![]});var _0x2076e3=_0x4e36('0x23');return db[_0x4e36('0x24')]['destroy']({'where':{'type':_0x2076e3,'resourceId':_0x179084['id']}})[_0x4e36('0x21')](function(){return _0x2a1662;});})[_0x4e36('0x21')](function(){_0x4edcf8[_0x4e36('0x17')](0xcc)[_0x4e36('0x16')]();});}};}function handleEntityNotFound(_0x86cbaa,_0x38e92b){return function(_0x4132ff){if(!_0x4132ff){_0x86cbaa[_0x4e36('0x25')](0x194);}return _0x4132ff;};}function handleError(_0x58ba65,_0x43d7e4){_0x43d7e4=_0x43d7e4||0x1f4;return function(_0x54e78e){logger['error'](_0x54e78e[_0x4e36('0x26')]);if(_0x54e78e['name']){delete _0x54e78e[_0x4e36('0x27')];}_0x58ba65[_0x4e36('0x17')](_0x43d7e4)[_0x4e36('0x28')](_0x54e78e);};}exports[_0x4e36('0x29')]=function(_0x4e2c35,_0x35a6e7){var _0x369974={},_0x5e635f={},_0x5d9148={'count':0x0,'rows':[]};var _0x59503c=_[_0x4e36('0x2a')](db['Disposition'][_0x4e36('0x2b')],function(_0x3ecb32){return{'name':_0x3ecb32['fieldName'],'type':_0x3ecb32[_0x4e36('0x2c')]['key']};});_0x5e635f[_0x4e36('0x2d')]=_['map'](_0x59503c,_0x4e36('0x27'));_0x5e635f[_0x4e36('0x2e')]=_[_0x4e36('0x2f')](_0x4e2c35[_0x4e36('0x2e')]);_0x5e635f[_0x4e36('0x30')]=_[_0x4e36('0x31')](_0x5e635f[_0x4e36('0x2d')],_0x5e635f[_0x4e36('0x2e')]);_0x369974[_0x4e36('0x32')]=_['intersection'](_0x5e635f[_0x4e36('0x2d')],qs['fields'](_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x33')]));_0x369974[_0x4e36('0x32')]=_0x369974[_0x4e36('0x32')][_0x4e36('0x34')]?_0x369974[_0x4e36('0x32')]:_0x5e635f[_0x4e36('0x2d')];if(!_0x4e2c35['query'][_0x4e36('0x35')]('nolimit')){_0x369974[_0x4e36('0x1a')]=qs[_0x4e36('0x1a')](_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x1a')]);_0x369974[_0x4e36('0x18')]=qs[_0x4e36('0x18')](_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x18')]);}_0x369974[_0x4e36('0x36')]=qs[_0x4e36('0x37')](_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x37')]);_0x369974['where']=qs[_0x4e36('0x30')](_[_0x4e36('0x38')](_0x4e2c35[_0x4e36('0x2e')],_0x5e635f[_0x4e36('0x30')]),_0x59503c);if(_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x39')]){_0x369974[_0x4e36('0x3a')]=_[_0x4e36('0x3b')](_0x369974[_0x4e36('0x3a')],{'$or':_[_0x4e36('0x2a')](_0x59503c,function(_0x27b640){if(_0x27b640['type']!==_0x4e36('0x3c')){var _0x2fc121={};_0x2fc121[_0x27b640[_0x4e36('0x27')]]={'$like':'%'+_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x39')]+'%'};return _0x2fc121;}})});}_0x369974=_[_0x4e36('0x3b')]({},_0x369974,_0x4e2c35[_0x4e36('0x3d')]);var _0x3e65db={'where':_0x369974[_0x4e36('0x3a')]};return db[_0x4e36('0x3e')]['count'](_0x3e65db)[_0x4e36('0x21')](function(_0x40f7ec){_0x5d9148[_0x4e36('0x1b')]=_0x40f7ec;if(_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x3f')]){_0x369974['include']=[{'all':!![]}];}return db[_0x4e36('0x3e')][_0x4e36('0x40')](_0x369974);})[_0x4e36('0x21')](function(_0x37c03e){_0x5d9148[_0x4e36('0x41')]=_0x37c03e;return _0x5d9148;})[_0x4e36('0x21')](respondWithFilteredResult(_0x35a6e7,_0x369974))[_0x4e36('0x42')](handleError(_0x35a6e7,null));};exports[_0x4e36('0x43')]=function(_0x18436c,_0xa6bae3){var _0x1d9dc0={'raw':!![],'where':{'id':_0x18436c[_0x4e36('0x44')]['id']}},_0x1a15e5={};_0x1a15e5[_0x4e36('0x2d')]=_[_0x4e36('0x2f')](db[_0x4e36('0x3e')][_0x4e36('0x2b')]);_0x1a15e5[_0x4e36('0x2e')]=_[_0x4e36('0x2f')](_0x18436c[_0x4e36('0x2e')]);_0x1a15e5[_0x4e36('0x30')]=_[_0x4e36('0x31')](_0x1a15e5['model'],_0x1a15e5[_0x4e36('0x2e')]);_0x1d9dc0['attributes']=_[_0x4e36('0x31')](_0x1a15e5['model'],qs[_0x4e36('0x33')](_0x18436c[_0x4e36('0x2e')][_0x4e36('0x33')]));_0x1d9dc0[_0x4e36('0x32')]=_0x1d9dc0['attributes'][_0x4e36('0x34')]?_0x1d9dc0[_0x4e36('0x32')]:_0x1a15e5[_0x4e36('0x2d')];if(_0x18436c[_0x4e36('0x2e')][_0x4e36('0x3f')]){_0x1d9dc0[_0x4e36('0x45')]=[{'all':!![]}];}_0x1d9dc0=_[_0x4e36('0x3b')]({},_0x1d9dc0,_0x18436c[_0x4e36('0x3d')]);return db['Disposition'][_0x4e36('0x46')](_0x1d9dc0)[_0x4e36('0x21')](handleEntityNotFound(_0xa6bae3,null))['then'](respondWithResult(_0xa6bae3,null))[_0x4e36('0x42')](handleError(_0xa6bae3,null));};exports[_0x4e36('0x47')]=function(_0x53f4d5,_0x4b090b){return db[_0x4e36('0x3e')][_0x4e36('0x47')](_0x53f4d5['body'],{})[_0x4e36('0x21')](function(_0x42b33e){var _0x327577=_0x53f4d5['user'][_0x4e36('0x48')]({'plain':!![]});if(!_0x327577)throw new Error(_0x4e36('0x49'));if(_0x327577['role']===_0x4e36('0x4a')){var _0x4b7f13=_0x42b33e[_0x4e36('0x48')]({'plain':!![]});var _0x5767f7=_0x4e36('0x23');return db['UserProfileSection'][_0x4e36('0x46')]({'where':{'name':_0x5767f7,'userProfileId':_0x327577['userProfileId']},'raw':!![]})['then'](function(_0x17dd7d){if(_0x17dd7d&&_0x17dd7d['autoAssociation']===0x0){return db[_0x4e36('0x24')]['create']({'name':_0x4b7f13['name'],'resourceId':_0x4b7f13['id'],'type':_0x17dd7d[_0x4e36('0x27')],'sectionId':_0x17dd7d['id']},{})['then'](function(){return _0x42b33e;});}else{return _0x42b33e;}})[_0x4e36('0x42')](function(_0x51e874){logger[_0x4e36('0x4b')](_0x4e36('0x4c'),_0x51e874);throw _0x51e874;});}return _0x42b33e;})['then'](respondWithResult(_0x4b090b,0xc9))[_0x4e36('0x42')](handleError(_0x4b090b,null));};exports[_0x4e36('0x20')]=function(_0x4bcb69,_0x5fb55c){if(_0x4bcb69['body']['id']){delete _0x4bcb69[_0x4e36('0x4d')]['id'];}return db[_0x4e36('0x3e')]['find']({'where':{'id':_0x4bcb69[_0x4e36('0x44')]['id']}})[_0x4e36('0x21')](handleEntityNotFound(_0x5fb55c,null))[_0x4e36('0x21')](saveUpdates(_0x4bcb69['body'],null))[_0x4e36('0x21')](respondWithResult(_0x5fb55c,null))[_0x4e36('0x42')](handleError(_0x5fb55c,null));};exports[_0x4e36('0x22')]=function(_0x19c0d,_0x21d5be){return db[_0x4e36('0x3e')]['find']({'where':{'id':_0x19c0d[_0x4e36('0x44')]['id']}})[_0x4e36('0x21')](handleEntityNotFound(_0x21d5be,null))[_0x4e36('0x21')](removeEntity(_0x21d5be,null))['catch'](handleError(_0x21d5be,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c701ff6..ed221af 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 _0xa807=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel'];(function(_0x5dca6a,_0x2ecaf4){var _0x3fe6c4=function(_0x3a696d){while(--_0x3a696d){_0x5dca6a['push'](_0x5dca6a['shift']());}};_0x3fe6c4(++_0x2ecaf4);}(_0xa807,0xfd));var _0x7a80=function(_0x2dcaf5,_0x56a960){_0x2dcaf5=_0x2dcaf5-0x0;var _0x4ed132=_0xa807[_0x2dcaf5];return _0x4ed132;};'use strict';var _=require(_0x7a80('0x0'));var util=require(_0x7a80('0x1'));var logger=require(_0x7a80('0x2'))(_0x7a80('0x3'));var moment=require(_0x7a80('0x4'));var BPromise=require(_0x7a80('0x5'));var rp=require(_0x7a80('0x6'));var fs=require('fs');var path=require(_0x7a80('0x7'));var rimraf=require('rimraf');var config=require(_0x7a80('0x8'));var attributes=require(_0x7a80('0x9'));module[_0x7a80('0xa')]=function(_0x2d94e2,_0x54b155){return _0x2d94e2[_0x7a80('0xb')](_0x7a80('0xc'),attributes,{'tableName':_0x7a80('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7a80('0xe'),'fields':[_0x7a80('0xf'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x7a80('0xf'),_0x7a80('0x10')]},{'unique':!![],'name':_0x7a80('0x11'),'fields':[_0x7a80('0xf'),_0x7a80('0x12')]},{'unique':!![],'name':_0x7a80('0x13'),'fields':[_0x7a80('0xf'),_0x7a80('0x14')]},{'unique':!![],'name':_0x7a80('0x15'),'fields':[_0x7a80('0xf'),'FaxAccountId']},{'unique':!![],'name':_0x7a80('0x16'),'fields':[_0x7a80('0xf'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x7a80('0xf'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf715=['api','moment','bluebird','request-promise','path','rimraf','exports','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf715,0xc5));var _0x5f71=function(_0x99d596,_0x31a253){_0x99d596=_0x99d596-0x0;var _0x274f6b=_0xf715[_0x99d596];return _0x274f6b;};'use strict';var _=require(_0x5f71('0x0'));var util=require(_0x5f71('0x1'));var logger=require(_0x5f71('0x2'))(_0x5f71('0x3'));var moment=require(_0x5f71('0x4'));var BPromise=require(_0x5f71('0x5'));var rp=require(_0x5f71('0x6'));var fs=require('fs');var path=require(_0x5f71('0x7'));var rimraf=require(_0x5f71('0x8'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x5f71('0x9')]=function(_0x120cdb,_0x50d3e6){return _0x120cdb['define'](_0x5f71('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x5f71('0xb'),'fields':[_0x5f71('0xc'),_0x5f71('0xd')]},{'unique':!![],'name':_0x5f71('0xe'),'fields':[_0x5f71('0xc'),_0x5f71('0xf')]},{'unique':!![],'name':_0x5f71('0x10'),'fields':['name',_0x5f71('0x11')]},{'unique':!![],'name':_0x5f71('0x12'),'fields':[_0x5f71('0xc'),_0x5f71('0x13')]},{'unique':!![],'name':'name_fax','fields':[_0x5f71('0xc'),_0x5f71('0x14')]},{'unique':!![],'name':_0x5f71('0x15'),'fields':['name',_0x5f71('0x16')]},{'unique':!![],'name':_0x5f71('0x17'),'fields':[_0x5f71('0xc'),_0x5f71('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index cd80472..9d7e1d5 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(_0x4ece24,_0x5b0acc){var _0x459b60=function(_0x470f51){while(--_0x470f51){_0x4ece24['push'](_0x4ece24['shift']());}};_0x459b60(++_0x5b0acc);}(_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 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(_0x23dc21,_0x17ab2e){var _0x390219=function(_0x4236e3){while(--_0x4236e3){_0x23dc21['push'](_0x23dc21['shift']());}};_0x390219(++_0x17ab2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 55e9756..ded92b4 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 _0x46c9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','path','connect-timeout','express','Router'];(function(_0xa3a0b5,_0x59e9a1){var _0x4257ca=function(_0x12eb43){while(--_0x12eb43){_0xa3a0b5['push'](_0xa3a0b5['shift']());}};_0x4257ca(++_0x59e9a1);}(_0x46c9,0x106));var _0x946c=function(_0x1554e6,_0x28607d){_0x1554e6=_0x1554e6-0x0;var _0x4cafbf=_0x46c9[_0x1554e6];return _0x4cafbf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x946c('0x0'));var timeout=require(_0x946c('0x1'));var express=require(_0x946c('0x2'));var router=express[_0x946c('0x3')]();var fs_extra=require(_0x946c('0x4'));var auth=require(_0x946c('0x5'));var interaction=require(_0x946c('0x6'));var config=require(_0x946c('0x7'));var controller=require(_0x946c('0x8'));router[_0x946c('0x9')]('/',auth[_0x946c('0xa')](),controller[_0x946c('0xb')]);router[_0x946c('0x9')](_0x946c('0xc'),auth[_0x946c('0xa')](),controller[_0x946c('0xd')]);router[_0x946c('0xe')]('/',auth[_0x946c('0xa')](),controller[_0x946c('0xf')]);router[_0x946c('0x10')]('/:id',auth[_0x946c('0xa')](),controller[_0x946c('0x11')]);router['delete'](_0x946c('0xc'),auth['isAuthenticated'](),controller[_0x946c('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa24e=['multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x20d93c,_0x39f389){var _0x8df8df=function(_0x43ccd4){while(--_0x43ccd4){_0x20d93c['push'](_0x20d93c['shift']());}};_0x8df8df(++_0x39f389);}(_0xa24e,0x7e));var _0xea24=function(_0x2ac32b,_0x134b81){_0x2ac32b=_0x2ac32b-0x0;var _0x298c2e=_0xa24e[_0x2ac32b];return _0x298c2e;};'use strict';var multer=require(_0xea24('0x0'));var util=require('util');var path=require(_0xea24('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xea24('0x2')]();var fs_extra=require(_0xea24('0x3'));var auth=require(_0xea24('0x4'));var interaction=require(_0xea24('0x5'));var config=require(_0xea24('0x6'));var controller=require(_0xea24('0x7'));router[_0xea24('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xea24('0x8')](_0xea24('0x9'),auth[_0xea24('0xa')](),controller[_0xea24('0xb')]);router[_0xea24('0xc')]('/',auth[_0xea24('0xa')](),controller[_0xea24('0xd')]);router[_0xea24('0xe')](_0xea24('0x9'),auth[_0xea24('0xa')](),controller[_0xea24('0xf')]);router[_0xea24('0x10')](_0xea24('0x9'),auth[_0xea24('0xa')](),controller[_0xea24('0x11')]);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 1966e49..0c49635 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 _0xdd55=['exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','7200','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x581bdf,_0x11d27f){var _0x44e862=function(_0x2f14f9){while(--_0x2f14f9){_0x581bdf['push'](_0x581bdf['shift']());}};_0x44e862(++_0x11d27f);}(_0xdd55,0x95));var _0x5dd5=function(_0x46c25c,_0x43f24b){_0x46c25c=_0x46c25c-0x0;var _0x477fca=_0xdd55[_0x46c25c];return _0x477fca;};'use strict';var Sequelize=require(_0x5dd5('0x0'));module[_0x5dd5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5dd5('0x2')]},'ecm':{'type':Sequelize[_0x5dd5('0x3')](_0x5dd5('0x4'),'no'),'defaultValue':_0x5dd5('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x5dd5('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x5dd5('0x6')},'minrate':{'type':Sequelize[_0x5dd5('0x3')](_0x5dd5('0x7'),_0x5dd5('0x8'),'7200',_0x5dd5('0x9'),_0x5dd5('0xa'),_0x5dd5('0xb')),'defaultValue':_0x5dd5('0x8')},'maxrate':{'type':Sequelize[_0x5dd5('0x3')](_0x5dd5('0x7'),_0x5dd5('0x8'),_0x5dd5('0xc'),_0x5dd5('0x9'),_0x5dd5('0xa'),_0x5dd5('0xb')),'defaultValue':_0x5dd5('0xb')},'modem':{'type':Sequelize[_0x5dd5('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x5dd5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5dd5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5dd5('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5dd5('0x3')](_0x5dd5('0xe'),_0x5dd5('0xf'),_0x5dd5('0x10'),_0x5dd5('0x11')),'defaultValue':_0x5dd5('0xe')},'key':{'type':Sequelize[_0x5dd5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5dd5('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5dd5('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5dd5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5dd5('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5dd5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5dd5('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5dd5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5dd5('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x5dd5('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5dd5('0x15'),'set':function(_0xbb2b48){if(!_0xbb2b48)this[_0x5dd5('0x16')](_0x5dd5('0x17'),null);this[_0x5dd5('0x16')](_0x5dd5('0x18'),_0xbb2b48);}}}; \ No newline at end of file +var _0x8ef7=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','9600','14400','2400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x8ef7,0xa4));var _0x78ef=function(_0x3de5e5,_0x3d3665){_0x3de5e5=_0x3de5e5-0x0;var _0x1c6f10=_0x8ef7[_0x3de5e5];return _0x1c6f10;};'use strict';var Sequelize=require('sequelize');module[_0x78ef('0x0')]={'name':{'type':Sequelize[_0x78ef('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x78ef('0x2')]('yes','no'),'defaultValue':_0x78ef('0x3')},'headerinfo':{'type':Sequelize[_0x78ef('0x1')],'defaultValue':_0x78ef('0x4')},'localstationid':{'type':Sequelize[_0x78ef('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM']('2400',_0x78ef('0x5'),'7200',_0x78ef('0x6'),'12000',_0x78ef('0x7')),'defaultValue':_0x78ef('0x5')},'maxrate':{'type':Sequelize['ENUM'](_0x78ef('0x8'),'4800','7200','9600',_0x78ef('0x9'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x78ef('0x1')],'defaultValue':_0x78ef('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x78ef('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x78ef('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x78ef('0x2')](_0x78ef('0xc'),_0x78ef('0xd'),_0x78ef('0xe'),_0x78ef('0xf')),'defaultValue':_0x78ef('0xc')},'key':{'type':Sequelize[_0x78ef('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x78ef('0x10')],'defaultValue':function(){return _0x78ef('0x11');}},'notificationSound':{'type':Sequelize[_0x78ef('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x78ef('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x78ef('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x78ef('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x78ef('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x78ef('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x78ef('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2323fc){if(!_0x2323fc)this[_0x78ef('0x14')](_0x78ef('0x15'),null);this[_0x78ef('0x14')](_0x78ef('0x16'),_0x2323fc);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 38bf3ef..7f4eb8a 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 _0xa60a=['basename','CheckAfterSend','isNil','\x22%s\x22\x20<%s>','List','ListId','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','name','send','index','mandatoryDispositionPause','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','FaxAccount','include','findAll','rows','show','params','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','FaxAccounts','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','FaxAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','stack','getApplications','context','localstationid','app','type','description','Fax\x20Extension','priority','appdata','Answer','push','ecm','gateway','faxdetect','headerinfo','minrate','Set','/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','VoiceExtension','updateAccountApplications','tech','createdAt','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','attachments','join','server/files/attachments'];(function(_0x47088e,_0x461de8){var _0x5468fa=function(_0x38d0e1){while(--_0x38d0e1){_0x47088e['push'](_0x47088e['shift']());}};_0x5468fa(++_0x461de8);}(_0xa60a,0xd8));var _0xaa60=function(_0x35c35e,_0x3115ec){_0x35c35e=_0x35c35e-0x0;var _0x3fa8e3=_0xa60a[_0x35c35e];return _0x3fa8e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa60('0x0'));var zipdir=require(_0xaa60('0x1'));var jsonpatch=require(_0xaa60('0x2'));var rp=require(_0xaa60('0x3'));var moment=require(_0xaa60('0x4'));var BPromise=require(_0xaa60('0x5'));var Mustache=require(_0xaa60('0x6'));var util=require(_0xaa60('0x7'));var path=require(_0xaa60('0x8'));var sox=require(_0xaa60('0x9'));var csv=require(_0xaa60('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa60('0xb'));var _=require(_0xaa60('0xc'));var squel=require(_0xaa60('0xd'));var crypto=require(_0xaa60('0xe'));var jsforce=require(_0xaa60('0xf'));var deskjs=require(_0xaa60('0x10'));var toCsv=require(_0xaa60('0xa'));var querystring=require(_0xaa60('0x11'));var Papa=require(_0xaa60('0x12'));var Redis=require('ioredis');var authService=require(_0xaa60('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaa60('0x14'));var hardwareService=require(_0xaa60('0x15'));var logger=require(_0xaa60('0x16'))('api');var utils=require(_0xaa60('0x17'));var config=require(_0xaa60('0x18'));var licenseUtil=require(_0xaa60('0x19'));var db=require(_0xaa60('0x1a'))['db'];config[_0xaa60('0x1b')]=_[_0xaa60('0x1c')](config[_0xaa60('0x1b')],{'host':_0xaa60('0x1d'),'port':0x18eb});var socket=require(_0xaa60('0x1e'))(new Redis(config[_0xaa60('0x1b')]));require(_0xaa60('0x1f'))[_0xaa60('0x20')](socket);var jayson=require(_0xaa60('0x21'));var client=jayson[_0xaa60('0x22')][_0xaa60('0x23')]({'port':0x232c});var client9002=jayson[_0xaa60('0x22')][_0xaa60('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x526ae8,_0x1f2264,_0xbe3a3e,_0x499fa0){return new BPromise(function(_0x1f2f56,_0x15413c){var _0x376fc9=_0x499fa0||client;return _0x376fc9[_0xaa60('0x24')](_0x526ae8,_0xbe3a3e)[_0xaa60('0x25')](function(_0x3ba0ff){logger[_0xaa60('0x26')](_0xaa60('0x27'),_0x1f2264,_0xaa60('0x28'));logger[_0xaa60('0x29')](_0xaa60('0x2a'),_0x1f2264,_0xaa60('0x28'),JSON[_0xaa60('0x2b')](_0x3ba0ff));if(_0x3ba0ff['error']){if(_0x3ba0ff[_0xaa60('0x2c')]['code']===0x1f4){logger[_0xaa60('0x2c')](_0xaa60('0x27'),_0x1f2264,_0x3ba0ff['error'][_0xaa60('0x2d')]);return _0x15413c(_0x3ba0ff[_0xaa60('0x2c')][_0xaa60('0x2d')]);}logger['error'](_0xaa60('0x27'),_0x1f2264,_0x3ba0ff[_0xaa60('0x2c')][_0xaa60('0x2d')]);return _0x1f2f56(_0x3ba0ff[_0xaa60('0x2c')][_0xaa60('0x2d')]);}else{logger[_0xaa60('0x26')](_0xaa60('0x27'),_0x1f2264,_0xaa60('0x28'));_0x1f2f56(_0x3ba0ff['result'][_0xaa60('0x2d')]);}})[_0xaa60('0x2e')](function(_0x41195e){logger[_0xaa60('0x2c')](_0xaa60('0x27'),_0x1f2264,_0x41195e);_0x15413c(_0x41195e);});});}function respondWithStatusCode(_0x53ccfc,_0x100a88){_0x100a88=_0x100a88||0xcc;return function(_0x260be5){if(_0x260be5){return _0x53ccfc[_0xaa60('0x2f')](_0x100a88);}return _0x53ccfc['status'](_0x100a88)[_0xaa60('0x30')]();};}function respondWithResult(_0xdeb465,_0x373e26){_0x373e26=_0x373e26||0xc8;return function(_0x5d3a71){if(_0x5d3a71){return _0xdeb465[_0xaa60('0x31')](_0x373e26)[_0xaa60('0x32')](_0x5d3a71);}};}function respondWithFilteredResult(_0x459e6e,_0x1d6c75){return function(_0x2bc006){if(_0x2bc006){var _0x3a3be7=typeof _0x1d6c75[_0xaa60('0x33')]===_0xaa60('0x34')&&typeof _0x1d6c75[_0xaa60('0x35')]==='undefined';var _0x24f272=_0x2bc006[_0xaa60('0x36')];var _0x150974=_0x3a3be7?0x0:_0x1d6c75[_0xaa60('0x33')];var _0x18bc8d=_0x3a3be7?_0x2bc006[_0xaa60('0x36')]:_0x1d6c75[_0xaa60('0x33')]+_0x1d6c75[_0xaa60('0x35')];var _0x17a131;if(_0x18bc8d>=_0x24f272){_0x18bc8d=_0x24f272;_0x17a131=0xc8;}else{_0x17a131=0xce;}_0x459e6e[_0xaa60('0x31')](_0x17a131);return _0x459e6e[_0xaa60('0x37')](_0xaa60('0x38'),_0x150974+'-'+_0x18bc8d+'/'+_0x24f272)['json'](_0x2bc006);}return null;};}function patchUpdates(_0x4da55e){return function(_0xf2d669){try{jsonpatch[_0xaa60('0x39')](_0xf2d669,_0x4da55e,!![]);}catch(_0x2c18ad){return BPromise[_0xaa60('0x3a')](_0x2c18ad);}return _0xf2d669[_0xaa60('0x3b')]();};}function saveUpdates(_0x4cc1f9,_0x1db9a6){return function(_0x5289e0){if(_0x5289e0){return _0x5289e0[_0xaa60('0x3c')](_0x4cc1f9)[_0xaa60('0x25')](function(_0x5da7ad){return _0x5da7ad;});}return null;};}function removeEntity(_0x331dde,_0x4966ab){return function(_0x352e1c){if(_0x352e1c){return _0x352e1c[_0xaa60('0x3d')]()[_0xaa60('0x25')](function(){var _0x2ffd9e=_0x352e1c[_0xaa60('0x3e')]({'plain':!![]});var _0x575dd6='FaxAccounts';return db['UserProfileResource'][_0xaa60('0x3d')]({'where':{'type':_0x575dd6,'resourceId':_0x2ffd9e['id']}})[_0xaa60('0x25')](function(){return _0x352e1c;});})[_0xaa60('0x25')](function(){_0x331dde['status'](0xcc)[_0xaa60('0x30')]();});}};}function handleEntityNotFound(_0x558806,_0x282e93){return function(_0x28bc6b){if(!_0x28bc6b){_0x558806[_0xaa60('0x2f')](0x194);}return _0x28bc6b;};}function handleError(_0x16b740,_0x509f1f){_0x509f1f=_0x509f1f||0x1f4;return function(_0x3c8743){logger[_0xaa60('0x2c')](_0x3c8743['stack']);if(_0x3c8743[_0xaa60('0x3f')]){delete _0x3c8743['name'];}_0x16b740[_0xaa60('0x31')](_0x509f1f)[_0xaa60('0x40')](_0x3c8743);};}exports[_0xaa60('0x41')]=function(_0x3991c0,_0x1795c0){var _0x461ebf={'include':[{'model':db['Pause'],'as':_0xaa60('0x42')}]},_0x37acf1={},_0x655d56={'count':0x0,'rows':[]};var _0x51d107=_['map'](db['FaxAccount'][_0xaa60('0x43')],function(_0x42b27b){return{'name':_0x42b27b[_0xaa60('0x44')],'type':_0x42b27b['type'][_0xaa60('0x45')]};});_0x37acf1[_0xaa60('0x46')]=_[_0xaa60('0x47')](_0x51d107,_0xaa60('0x3f'));_0x37acf1[_0xaa60('0x48')]=_[_0xaa60('0x49')](_0x3991c0['query']);_0x37acf1['filters']=_[_0xaa60('0x4a')](_0x37acf1[_0xaa60('0x46')],_0x37acf1[_0xaa60('0x48')]);_0x461ebf['attributes']=_[_0xaa60('0x4a')](_0x37acf1[_0xaa60('0x46')],qs['fields'](_0x3991c0[_0xaa60('0x48')][_0xaa60('0x4b')]));_0x461ebf[_0xaa60('0x4c')]=_0x461ebf[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x461ebf[_0xaa60('0x4c')]:_0x37acf1[_0xaa60('0x46')];if(!_0x3991c0['query'][_0xaa60('0x4e')]('nolimit')){_0x461ebf[_0xaa60('0x35')]=qs[_0xaa60('0x35')](_0x3991c0['query']['limit']);_0x461ebf[_0xaa60('0x33')]=qs[_0xaa60('0x33')](_0x3991c0[_0xaa60('0x48')][_0xaa60('0x33')]);}_0x461ebf[_0xaa60('0x4f')]=qs['sort'](_0x3991c0[_0xaa60('0x48')][_0xaa60('0x50')]);_0x461ebf['where']=qs[_0xaa60('0x51')](_[_0xaa60('0x52')](_0x3991c0[_0xaa60('0x48')],_0x37acf1[_0xaa60('0x51')]),_0x51d107);if(_0x3991c0[_0xaa60('0x48')][_0xaa60('0x53')]){_0x461ebf[_0xaa60('0x54')]=_[_0xaa60('0x55')](_0x461ebf[_0xaa60('0x54')],{'$or':_[_0xaa60('0x47')](_0x51d107,function(_0x3ddb53){if(_0x3ddb53['type']!=='VIRTUAL'){var _0x129265={};_0x129265[_0x3ddb53[_0xaa60('0x3f')]]={'$like':'%'+_0x3991c0[_0xaa60('0x48')][_0xaa60('0x53')]+'%'};return _0x129265;}})});}_0x461ebf=_[_0xaa60('0x55')]({},_0x461ebf,_0x3991c0['options']);var _0x4e87cd={'where':_0x461ebf[_0xaa60('0x54')]};return db[_0xaa60('0x56')][_0xaa60('0x36')](_0x4e87cd)[_0xaa60('0x25')](function(_0x3a27fb){_0x655d56[_0xaa60('0x36')]=_0x3a27fb;if(_0x3991c0[_0xaa60('0x48')]['includeAll']){_0x461ebf[_0xaa60('0x57')]=[{'all':!![]}];}return db[_0xaa60('0x56')][_0xaa60('0x58')](_0x461ebf);})[_0xaa60('0x25')](function(_0x5c6691){_0x655d56[_0xaa60('0x59')]=_0x5c6691;return _0x655d56;})[_0xaa60('0x25')](respondWithFilteredResult(_0x1795c0,_0x461ebf))['catch'](handleError(_0x1795c0,null));};exports[_0xaa60('0x5a')]=function(_0x50f05e,_0x10d43f){var _0x50f3a7={'raw':![],'where':{'id':_0x50f05e[_0xaa60('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xaa60('0x42')}]},_0x57df01={};_0x57df01[_0xaa60('0x46')]=_[_0xaa60('0x49')](db[_0xaa60('0x56')]['rawAttributes']);_0x57df01['query']=_[_0xaa60('0x49')](_0x50f05e[_0xaa60('0x48')]);_0x57df01[_0xaa60('0x51')]=_[_0xaa60('0x4a')](_0x57df01[_0xaa60('0x46')],_0x57df01[_0xaa60('0x48')]);_0x50f3a7['attributes']=_[_0xaa60('0x4a')](_0x57df01[_0xaa60('0x46')],qs[_0xaa60('0x4b')](_0x50f05e[_0xaa60('0x48')]['fields']));_0x50f3a7[_0xaa60('0x4c')]=_0x50f3a7[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x50f3a7[_0xaa60('0x4c')]:_0x57df01[_0xaa60('0x46')];if(_0x50f05e['query'][_0xaa60('0x5c')]){_0x50f3a7[_0xaa60('0x57')]=[{'all':!![]}];}_0x50f3a7=_['merge']({},_0x50f3a7,_0x50f05e[_0xaa60('0x5d')]);return db[_0xaa60('0x56')][_0xaa60('0x5e')](_0x50f3a7)[_0xaa60('0x25')](handleEntityNotFound(_0x10d43f,null))[_0xaa60('0x25')](respondWithResult(_0x10d43f,null))[_0xaa60('0x2e')](handleError(_0x10d43f,null));};exports[_0xaa60('0x5f')]=function(_0x3238b2,_0x3af593){return db['FaxAccount']['create'](_0x3238b2[_0xaa60('0x60')],{})[_0xaa60('0x25')](function(_0x46c785){var _0x43c035=_0x3238b2['user'][_0xaa60('0x3e')]({'plain':!![]});if(!_0x43c035)throw new Error(_0xaa60('0x61'));if(_0x43c035['role']===_0xaa60('0x62')){var _0x52be13=_0x46c785['get']({'plain':!![]});var _0x2a6b2a=_0xaa60('0x63');return db[_0xaa60('0x64')]['find']({'where':{'name':_0x2a6b2a,'userProfileId':_0x43c035[_0xaa60('0x65')]},'raw':!![]})[_0xaa60('0x25')](function(_0x308936){if(_0x308936&&_0x308936['autoAssociation']===0x0){return db[_0xaa60('0x66')][_0xaa60('0x5f')]({'name':_0x52be13[_0xaa60('0x3f')],'resourceId':_0x52be13['id'],'type':_0x308936[_0xaa60('0x3f')],'sectionId':_0x308936['id']},{})[_0xaa60('0x25')](function(){return _0x46c785;});}else{return _0x46c785;}})[_0xaa60('0x2e')](function(_0x4f9aaa){logger[_0xaa60('0x2c')](_0xaa60('0x67'),_0x4f9aaa);throw _0x4f9aaa;});}return _0x46c785;})[_0xaa60('0x25')](respondWithResult(_0x3af593,0xc9))[_0xaa60('0x2e')](handleError(_0x3af593,null));};exports[_0xaa60('0x3c')]=function(_0xff77c8,_0x3e76a7){if(_0xff77c8[_0xaa60('0x60')]['id']){delete _0xff77c8[_0xaa60('0x60')]['id'];}return db['FaxAccount'][_0xaa60('0x5e')]({'where':{'id':_0xff77c8[_0xaa60('0x5b')]['id']},'include':[{'model':db[_0xaa60('0x68')],'as':_0xaa60('0x42')}]})[_0xaa60('0x25')](handleEntityNotFound(_0x3e76a7,null))[_0xaa60('0x25')](saveUpdates(_0xff77c8[_0xaa60('0x60')],null))[_0xaa60('0x25')](respondWithResult(_0x3e76a7,null))[_0xaa60('0x2e')](handleError(_0x3e76a7,null));};exports[_0xaa60('0x3d')]=function(_0x2a231b,_0x18fc8c){return db[_0xaa60('0x56')][_0xaa60('0x5e')]({'where':{'id':_0x2a231b[_0xaa60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x18fc8c,null))[_0xaa60('0x25')](removeEntity(_0x18fc8c,null))[_0xaa60('0x2e')](handleError(_0x18fc8c,null));};exports[_0xaa60('0x69')]=function(_0x32febc,_0x49b95e){return db[_0xaa60('0x56')]['describe']()[_0xaa60('0x25')](respondWithResult(_0x49b95e,null))[_0xaa60('0x2e')](handleError(_0x49b95e,null));};exports['addDisposition']=function(_0x539bca,_0x59659a,_0x204446){if(_0x539bca[_0xaa60('0x60')]['id']){delete _0x539bca['body']['id'];}return db[_0xaa60('0x56')][_0xaa60('0x5e')]({'where':{'id':_0x539bca[_0xaa60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x59659a,null))[_0xaa60('0x25')](function(_0x178326){if(_0x178326){_0x539bca[_0xaa60('0x60')][_0xaa60('0x6a')]=_0x178326['id'];return db[_0xaa60('0x6b')]['create'](_0x539bca[_0xaa60('0x60')]);}})[_0xaa60('0x25')](respondWithResult(_0x59659a,null))[_0xaa60('0x2e')](handleError(_0x59659a,null));};exports[_0xaa60('0x6c')]=function(_0x87b964,_0x547010,_0x1dc06d){var _0x5e671f={'raw':![],'where':{}};var _0x2a03a0={};var _0x4b174d={'count':0x0,'rows':[]};return db['FaxAccount'][_0xaa60('0x6d')]({'where':{'id':_0x87b964[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x547010,null))[_0xaa60('0x25')](function(_0x2ed8e4){if(_0x2ed8e4){_0x2a03a0[_0xaa60('0x46')]=_[_0xaa60('0x49')](db[_0xaa60('0x6b')]['rawAttributes']);_0x2a03a0['query']=_['keys'](_0x87b964[_0xaa60('0x48')]);_0x2a03a0[_0xaa60('0x51')]=_[_0xaa60('0x4a')](_0x2a03a0['model'],_0x2a03a0[_0xaa60('0x48')]);_0x5e671f['attributes']=_['intersection'](_0x2a03a0[_0xaa60('0x46')],qs[_0xaa60('0x4b')](_0x87b964['query']['fields']));_0x5e671f[_0xaa60('0x4c')]=_0x5e671f[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x5e671f['attributes']:_0x2a03a0[_0xaa60('0x46')];if(!_0x87b964[_0xaa60('0x48')][_0xaa60('0x4e')](_0xaa60('0x6e'))){_0x5e671f[_0xaa60('0x35')]=qs[_0xaa60('0x35')](_0x87b964[_0xaa60('0x48')][_0xaa60('0x35')]);_0x5e671f['offset']=qs['offset'](_0x87b964[_0xaa60('0x48')][_0xaa60('0x33')]);}_0x5e671f['order']=qs['sort'](_0x87b964[_0xaa60('0x48')][_0xaa60('0x50')]);_0x5e671f[_0xaa60('0x54')]=qs['filters'](_[_0xaa60('0x52')](_0x87b964[_0xaa60('0x48')],_0x2a03a0[_0xaa60('0x51')]));_0x5e671f[_0xaa60('0x54')][_0xaa60('0x6a')]=_0x2ed8e4['id'];if(_0x87b964[_0xaa60('0x48')][_0xaa60('0x53')]){_0x5e671f[_0xaa60('0x54')]=_['merge'](_0x5e671f[_0xaa60('0x54')],{'$or':_[_0xaa60('0x47')](_0x5e671f[_0xaa60('0x4c')],function(_0x49a6e4){var _0x4aee9b={};_0x4aee9b[_0x49a6e4]={'$like':'%'+_0x87b964[_0xaa60('0x48')][_0xaa60('0x53')]+'%'};return _0x4aee9b;})});}_0x5e671f=_[_0xaa60('0x55')]({},_0x5e671f,_0x87b964['options']);return db['Disposition'][_0xaa60('0x36')]({'where':_0x5e671f['where']})[_0xaa60('0x25')](function(_0x8f0acb){_0x4b174d[_0xaa60('0x36')]=_0x8f0acb;if(_0x87b964[_0xaa60('0x48')]['includeAll']){_0x5e671f[_0xaa60('0x57')]=[{'all':!![]}];}return db['Disposition'][_0xaa60('0x58')](_0x5e671f);})[_0xaa60('0x25')](function(_0x391ca3){_0x4b174d[_0xaa60('0x59')]=_0x391ca3;return _0x4b174d;});}})[_0xaa60('0x25')](respondWithFilteredResult(_0x547010,_0x5e671f))[_0xaa60('0x2e')](handleError(_0x547010,null));};exports[_0xaa60('0x6f')]=function(_0x13ee9a,_0x1050fc,_0x4c1d99){return db[_0xaa60('0x56')][_0xaa60('0x5e')]({'where':{'id':_0x13ee9a['params']['id']}})['then'](handleEntityNotFound(_0x1050fc,null))[_0xaa60('0x25')](function(_0x8d263f){if(_0x8d263f){return _0x8d263f[_0xaa60('0x6f')](_0x13ee9a[_0xaa60('0x48')]['ids']);}})[_0xaa60('0x25')](respondWithStatusCode(_0x1050fc,null))[_0xaa60('0x2e')](handleError(_0x1050fc,null));};exports[_0xaa60('0x70')]=function(_0x3315ff,_0x3a740c,_0x24a1d8){if(_0x3315ff[_0xaa60('0x60')]['id']){delete _0x3315ff[_0xaa60('0x60')]['id'];}return db[_0xaa60('0x56')][_0xaa60('0x5e')]({'where':{'id':_0x3315ff[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x3a740c,null))[_0xaa60('0x25')](function(_0x98a729){if(_0x98a729){_0x3315ff[_0xaa60('0x60')]['FaxAccountId']=_0x98a729['id'];return db[_0xaa60('0x71')][_0xaa60('0x5f')](_0x3315ff[_0xaa60('0x60')]);}})['then'](respondWithResult(_0x3a740c,null))[_0xaa60('0x2e')](handleError(_0x3a740c,null));};exports[_0xaa60('0x72')]=function(_0x556cff,_0x177781,_0x1dbfba){var _0x5a1896={'raw':![],'where':{}};var _0x458117={};var _0x19cf4e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x556cff[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x177781,null))[_0xaa60('0x25')](function(_0x3beaff){if(_0x3beaff){_0x458117[_0xaa60('0x46')]=_['keys'](db['CannedAnswer'][_0xaa60('0x43')]);_0x458117[_0xaa60('0x48')]=_[_0xaa60('0x49')](_0x556cff[_0xaa60('0x48')]);_0x458117[_0xaa60('0x51')]=_['intersection'](_0x458117[_0xaa60('0x46')],_0x458117[_0xaa60('0x48')]);_0x5a1896['attributes']=_[_0xaa60('0x4a')](_0x458117['model'],qs[_0xaa60('0x4b')](_0x556cff[_0xaa60('0x48')][_0xaa60('0x4b')]));_0x5a1896[_0xaa60('0x4c')]=_0x5a1896[_0xaa60('0x4c')]['length']?_0x5a1896[_0xaa60('0x4c')]:_0x458117['model'];if(!_0x556cff[_0xaa60('0x48')][_0xaa60('0x4e')]('nolimit')){_0x5a1896[_0xaa60('0x35')]=qs['limit'](_0x556cff[_0xaa60('0x48')][_0xaa60('0x35')]);_0x5a1896['offset']=qs[_0xaa60('0x33')](_0x556cff[_0xaa60('0x48')][_0xaa60('0x33')]);}_0x5a1896[_0xaa60('0x4f')]=qs['sort'](_0x556cff[_0xaa60('0x48')]['sort']);_0x5a1896[_0xaa60('0x54')]=qs[_0xaa60('0x51')](_[_0xaa60('0x52')](_0x556cff[_0xaa60('0x48')],_0x458117['filters']));_0x5a1896[_0xaa60('0x54')][_0xaa60('0x6a')]=_0x3beaff['id'];if(_0x556cff[_0xaa60('0x48')][_0xaa60('0x53')]){_0x5a1896['where']=_[_0xaa60('0x55')](_0x5a1896['where'],{'$or':_[_0xaa60('0x47')](_0x5a1896['attributes'],function(_0x4a7e93){var _0x482b3d={};_0x482b3d[_0x4a7e93]={'$like':'%'+_0x556cff[_0xaa60('0x48')][_0xaa60('0x53')]+'%'};return _0x482b3d;})});}_0x5a1896=_[_0xaa60('0x55')]({},_0x5a1896,_0x556cff[_0xaa60('0x5d')]);return db['CannedAnswer'][_0xaa60('0x36')]({'where':_0x5a1896[_0xaa60('0x54')]})[_0xaa60('0x25')](function(_0x1bf47f){_0x19cf4e[_0xaa60('0x36')]=_0x1bf47f;if(_0x556cff[_0xaa60('0x48')][_0xaa60('0x5c')]){_0x5a1896['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xaa60('0x58')](_0x5a1896);})[_0xaa60('0x25')](function(_0xb954b2){_0x19cf4e[_0xaa60('0x59')]=_0xb954b2;return _0x19cf4e;});}})[_0xaa60('0x25')](respondWithFilteredResult(_0x177781,_0x5a1896))[_0xaa60('0x2e')](handleError(_0x177781,null));};exports[_0xaa60('0x73')]=function(_0x5ef512,_0x1882d7,_0x9d22ff){return db['FaxAccount'][_0xaa60('0x5e')]({'where':{'id':_0x5ef512[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x1882d7,null))[_0xaa60('0x25')](function(_0x503fb8){if(_0x503fb8){return _0x503fb8['removeAnswers'](_0x5ef512['query'][_0xaa60('0x74')]);}})[_0xaa60('0x25')](respondWithStatusCode(_0x1882d7,null))[_0xaa60('0x2e')](handleError(_0x1882d7,null));};exports[_0xaa60('0x75')]=function(_0x3dd718,_0x3830d9,_0x27768e){return db[_0xaa60('0x76')][_0xaa60('0x5e')]({'where':{'id':_0x3dd718[_0xaa60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3830d9,null))[_0xaa60('0x25')](function(_0x26ac09){if(_0x26ac09){return _0x26ac09[_0xaa60('0x75')](_0x3dd718[_0xaa60('0x60')][_0xaa60('0x74')],_[_0xaa60('0x77')](_0x3dd718[_0xaa60('0x60')],['ids','id'])||{});}})[_0xaa60('0x25')](respondWithResult(_0x3830d9,null))[_0xaa60('0x2e')](handleError(_0x3830d9,null));};exports[_0xaa60('0x78')]=function(_0x1a3db7,_0x483255,_0x11622a){var _0x50a5f3={'raw':![],'where':{}};var _0x42682={};var _0x53e9ab={'count':0x0,'rows':[]};return db[_0xaa60('0x56')]['findOne']({'where':{'id':_0x1a3db7[_0xaa60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x483255,null))[_0xaa60('0x25')](function(_0x389247){if(_0x389247){_0x42682[_0xaa60('0x46')]=_['keys'](db[_0xaa60('0x76')][_0xaa60('0x43')]);_0x42682[_0xaa60('0x48')]=_['keys'](_0x1a3db7['query']);_0x42682[_0xaa60('0x51')]=_[_0xaa60('0x4a')](_0x42682[_0xaa60('0x46')],_0x42682[_0xaa60('0x48')]);_0x50a5f3[_0xaa60('0x4c')]=_[_0xaa60('0x4a')](_0x42682[_0xaa60('0x46')],qs[_0xaa60('0x4b')](_0x1a3db7[_0xaa60('0x48')][_0xaa60('0x4b')]));_0x50a5f3[_0xaa60('0x4c')]=_0x50a5f3[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x50a5f3['attributes']:_0x42682[_0xaa60('0x46')];if(!_0x1a3db7['query']['hasOwnProperty']('nolimit')){_0x50a5f3['limit']=qs[_0xaa60('0x35')](_0x1a3db7['query']['limit']);_0x50a5f3[_0xaa60('0x33')]=qs[_0xaa60('0x33')](_0x1a3db7[_0xaa60('0x48')]['offset']);}_0x50a5f3[_0xaa60('0x4f')]=qs[_0xaa60('0x50')](_0x1a3db7['query'][_0xaa60('0x50')]);_0x50a5f3[_0xaa60('0x54')]=qs[_0xaa60('0x51')](_['pick'](_0x1a3db7[_0xaa60('0x48')],_0x42682[_0xaa60('0x51')]));_0x50a5f3[_0xaa60('0x54')][_0xaa60('0x6a')]=_0x389247['id'];if(_0x1a3db7[_0xaa60('0x48')][_0xaa60('0x53')]){_0x50a5f3[_0xaa60('0x54')]=_[_0xaa60('0x55')](_0x50a5f3[_0xaa60('0x54')],{'$or':_[_0xaa60('0x47')](_0x50a5f3[_0xaa60('0x4c')],function(_0x350b09){var _0x502820={};_0x502820[_0x350b09]={'$like':'%'+_0x1a3db7[_0xaa60('0x48')]['filter']+'%'};return _0x502820;})});}_0x50a5f3=_[_0xaa60('0x55')]({},_0x50a5f3,_0x1a3db7[_0xaa60('0x5d')]);return db[_0xaa60('0x76')][_0xaa60('0x36')]({'where':_0x50a5f3[_0xaa60('0x54')]})[_0xaa60('0x25')](function(_0x4c7899){_0x53e9ab[_0xaa60('0x36')]=_0x4c7899;if(_0x1a3db7['query'][_0xaa60('0x5c')]){_0x50a5f3[_0xaa60('0x57')]=[{'model':db[_0xaa60('0x79')],'as':_0xaa60('0x7a'),'required':![]},{'model':db[_0xaa60('0x7b')],'as':_0xaa60('0x7c'),'attributes':['name',_0xaa60('0x7d'),_0xaa60('0x7e')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xaa60('0x3f'),_0xaa60('0x7f')],'where':_0x1a3db7[_0xaa60('0x48')][_0xaa60('0x80')]?{'id':_0x1a3db7['query'][_0xaa60('0x80')]}:undefined,'required':_0x1a3db7[_0xaa60('0x48')][_0xaa60('0x80')]?!![]:![]}];}return db['FaxInteraction'][_0xaa60('0x58')](_0x50a5f3);})[_0xaa60('0x25')](function(_0x435a7a){_0x53e9ab['rows']=_0x435a7a;return _0x53e9ab;});}})[_0xaa60('0x25')](respondWithFilteredResult(_0x483255,_0x50a5f3))[_0xaa60('0x2e')](handleError(_0x483255,null));};exports[_0xaa60('0x81')]=function(_0x13d1c3,_0x346906){var _0x49c72f=_0x13d1c3[_0xaa60('0x5b')]['id'];var _0x45e01b=_0x13d1c3[_0xaa60('0x60')];var _0x266eae=0xc8;var _0x56f5c9=null;return db[_0xaa60('0x82')][_0xaa60('0x83')]({'isolationLevel':db[_0xaa60('0x82')][_0xaa60('0x84')][_0xaa60('0x85')][_0xaa60('0x86')]},function(_0x59e7c2){return db[_0xaa60('0x56')][_0xaa60('0x6d')]({'where':{'id':_0x49c72f},'transaction':_0x59e7c2})[_0xaa60('0x25')](function(_0x3fa223){if(_0x3fa223){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x49c72f},'transaction':_0x59e7c2})[_0xaa60('0x25')](function(){var _0x4ebb27=_[_0xaa60('0x47')](_0x45e01b,function(_0x219ace){_0x219ace['FaxAccountId']=_0x49c72f;return _0x219ace;});return db[_0xaa60('0x87')][_0xaa60('0x88')](_0x4ebb27,{'transaction':_0x59e7c2});});}else{_0x266eae=0x194;_0x56f5c9=[];}});})[_0xaa60('0x25')](function(){if(_0x266eae!==0x194){return db[_0xaa60('0x87')]['findAndCountAll']({'where':{'FaxAccountId':_0x49c72f},'order':'priority'})[_0xaa60('0x25')](function(_0x52da35){_0x56f5c9=_0x52da35;});}})['catch'](function(_0x208873){_0x266eae=0x1f4;logger[_0xaa60('0x2c')](_0x208873[_0xaa60('0x89')]);if(_0x208873[_0xaa60('0x3f')]){delete _0x208873[_0xaa60('0x3f')];}_0x56f5c9=_0x208873;})['finally'](function(){if(_0x56f5c9===null){_0x346906[_0xaa60('0x2f')](_0x266eae);}else{if(_0x266eae===0x1f4){_0x346906[_0xaa60('0x31')](_0x266eae)['send'](_0x56f5c9);}else{_0x346906['status'](_0x266eae)[_0xaa60('0x32')](_0x56f5c9);}}});};exports[_0xaa60('0x8a')]=function(_0x5ee017,_0x1fb198,_0x98e05){var _0x150552={};var _0xe0271={};var _0x54a4bb;var _0x5ed5f1;return db[_0xaa60('0x56')]['findOne']({'where':{'id':_0x5ee017[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x1fb198,null))['then'](function(_0x1efee5){if(_0x1efee5){_0x54a4bb=_0x1efee5;_0xe0271['model']=_['keys'](db[_0xaa60('0x87')][_0xaa60('0x43')]);_0xe0271['query']=_[_0xaa60('0x49')](_0x5ee017['query']);_0xe0271[_0xaa60('0x51')]=_[_0xaa60('0x4a')](_0xe0271[_0xaa60('0x46')],_0xe0271[_0xaa60('0x48')]);_0x150552[_0xaa60('0x4c')]=_[_0xaa60('0x4a')](_0xe0271[_0xaa60('0x46')],qs['fields'](_0x5ee017[_0xaa60('0x48')][_0xaa60('0x4b')]));_0x150552[_0xaa60('0x4c')]=_0x150552[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x150552[_0xaa60('0x4c')]:_0xe0271[_0xaa60('0x46')];_0x150552[_0xaa60('0x4f')]=qs['sort'](_0x5ee017[_0xaa60('0x48')]['sort']);_0x150552[_0xaa60('0x54')]=qs[_0xaa60('0x51')](_[_0xaa60('0x52')](_0x5ee017[_0xaa60('0x48')],_0xe0271[_0xaa60('0x51')]));if(_0x5ee017[_0xaa60('0x48')][_0xaa60('0x53')]){_0x150552[_0xaa60('0x54')]=_[_0xaa60('0x55')](_0x150552[_0xaa60('0x54')],{'$or':_[_0xaa60('0x47')](_0x150552[_0xaa60('0x4c')],function(_0x15ed7e){var _0x236ebc={};_0x236ebc[_0x15ed7e]={'$like':'%'+_0x5ee017[_0xaa60('0x48')][_0xaa60('0x53')]+'%'};return _0x236ebc;})});}_0x150552=_['merge']({},_0x150552,_0x5ee017[_0xaa60('0x5d')]);return _0x54a4bb['getApplications'](_0x150552);}})['then'](function(_0x4ce319){if(_0x4ce319){_0x5ed5f1=_0x4ce319[_0xaa60('0x4d')];if(!_0x5ee017['query'][_0xaa60('0x4e')](_0xaa60('0x6e'))){_0x150552[_0xaa60('0x35')]=qs[_0xaa60('0x35')](_0x5ee017[_0xaa60('0x48')][_0xaa60('0x35')]);_0x150552[_0xaa60('0x33')]=qs['offset'](_0x5ee017['query']['offset']);}return _0x54a4bb[_0xaa60('0x8a')](_0x150552);}})[_0xaa60('0x25')](function(_0x5258a7){if(_0x5258a7){return _0x5258a7?{'count':_0x5ed5f1,'rows':_0x5258a7}:null;}})[_0xaa60('0x25')](respondWithResult(_0x1fb198,null))[_0xaa60('0x2e')](handleError(_0x1fb198,null));};function Extension(_0x2270ec,_0x3637ea,_0x1244a0,_0x2368ca){this[_0xaa60('0x8b')]='from-voip-provider';this['exten']=_0x2270ec[_0xaa60('0x8c')];this[_0xaa60('0x8d')]=_0x2368ca;this[_0xaa60('0x8e')]='system';this[_0xaa60('0x8f')]=_0xaa60('0x90');this[_0xaa60('0x6a')]=_0x2270ec['id'];this[_0xaa60('0x91')]=_0x3637ea;this[_0xaa60('0x92')]=_0x1244a0;}function createExtensionsReciveFax(_0x58f752){var _0x22e7d0=0x1;var _0x1e774b=[];_0x1e774b['push'](new Extension(_0x58f752,_0x22e7d0,'',_0xaa60('0x93')));_0x22e7d0+=0x1;_0x1e774b[_0xaa60('0x94')](new Extension(_0x58f752,_0x22e7d0,'CDR(type)=inbound-fax','Set'));_0x22e7d0+=0x1;for(var _0x276445 in _0x58f752){if(_0x58f752[_0xaa60('0x4e')](_0x276445)&&(_0x276445===_0xaa60('0x95')||_0x276445==='localstationid'||_0x276445===_0xaa60('0x96')||_0x276445===_0xaa60('0x97')||_0x276445===_0xaa60('0x98')||_0x276445==='maxrate'||_0x276445===_0xaa60('0x99')||_0x276445==='modem'||_0x276445==='t38timeout')){_0x1e774b[_0xaa60('0x94')](new Extension(_0x58f752,_0x22e7d0,'FAXOPT('+_0x276445+')='+_0x58f752[_0x276445],_0xaa60('0x9a')));_0x22e7d0+=0x1;}}_0x1e774b['push'](new Extension(_0x58f752,_0x22e7d0,'6','Wait'));_0x22e7d0+=0x1;_0x1e774b[_0xaa60('0x94')](new Extension(_0x58f752,_0x22e7d0,_0xaa60('0x9b'),'ReceiveFax'));_0x22e7d0=0x0;return _0x1e774b;}exports[_0xaa60('0x9c')]=function(_0x76e75f,_0x410477,_0x36c107){var _0x8bf5fa;return db[_0xaa60('0x82')]['transaction'](function(_0x240c6a){return db[_0xaa60('0x56')][_0xaa60('0x5f')](_0x76e75f['body'],{'transaction':_0x240c6a})[_0xaa60('0x25')](function(_0xa059c){_0x8bf5fa=_0xa059c[_0xaa60('0x3e')]({'plain':!![]});return db[_0xaa60('0x9d')]['bulkCreate'](createExtensionsReciveFax(_0x8bf5fa),{'transaction':_0x240c6a});});})[_0xaa60('0x25')](function(){return _0x8bf5fa;})[_0xaa60('0x25')](respondWithResult(_0x410477,null))[_0xaa60('0x2e')](handleError(_0x410477,null));};exports[_0xaa60('0x9e')]=function(_0x40c6ef,_0x37f606,_0x46b191){var _0x5f1aa7;return db[_0xaa60('0x82')][_0xaa60('0x83')](function(_0x1af3ca){return db[_0xaa60('0x56')][_0xaa60('0x3c')](_0x40c6ef[_0xaa60('0x60')],{'where':{'id':_0x40c6ef[_0xaa60('0x60')]['id']},'transaction':_0x1af3ca})['then'](function(_0x3e4d30){return db[_0xaa60('0x9d')]['destroy']({'where':{'FaxAccountId':_0x40c6ef[_0xaa60('0x60')]['id']},'transaction':_0x1af3ca})['then'](function(_0x1880c6){return db[_0xaa60('0x9d')][_0xaa60('0x88')](createExtensionsReciveFax(_[_0xaa60('0x77')](_0x40c6ef[_0xaa60('0x60')],[_0xaa60('0x9f'),_0xaa60('0x45'),_0xaa60('0xa0'),'updatedAt','TrunkId','ListId'])),{'transaction':_0x1af3ca});});});})[_0xaa60('0x25')](function(){return db[_0xaa60('0x56')][_0xaa60('0xa1')](_0x40c6ef[_0xaa60('0x60')]['id']);})[_0xaa60('0x25')](respondWithResult(_0x37f606,null))[_0xaa60('0x2e')](handleError(_0x37f606,null));};exports['getMessages']=function(_0x1cd968,_0x4a0a39,_0x22f630){var _0x3f8d88={'raw':!![],'where':{}};var _0x569f2b={};var _0xbd639e={'count':0x0,'rows':[]};return db[_0xaa60('0x56')][_0xaa60('0x6d')]({'where':{'id':_0x1cd968[_0xaa60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4a0a39,null))[_0xaa60('0x25')](function(_0x4be3d1){if(_0x4be3d1){_0x569f2b['model']=_['keys'](db[_0xaa60('0xa2')][_0xaa60('0x43')]);_0x569f2b[_0xaa60('0x48')]=_[_0xaa60('0x49')](_0x1cd968[_0xaa60('0x48')]);_0x569f2b[_0xaa60('0x51')]=_[_0xaa60('0x4a')](_0x569f2b['model'],_0x569f2b[_0xaa60('0x48')]);_0x3f8d88['attributes']=_[_0xaa60('0x4a')](_0x569f2b[_0xaa60('0x46')],qs[_0xaa60('0x4b')](_0x1cd968[_0xaa60('0x48')][_0xaa60('0x4b')]));_0x3f8d88[_0xaa60('0x4c')]=_0x3f8d88[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x3f8d88['attributes']:_0x569f2b[_0xaa60('0x46')];if(!_0x1cd968[_0xaa60('0x48')][_0xaa60('0x4e')](_0xaa60('0x6e'))){_0x3f8d88[_0xaa60('0x35')]=qs[_0xaa60('0x35')](_0x1cd968[_0xaa60('0x48')][_0xaa60('0x35')]);_0x3f8d88[_0xaa60('0x33')]=qs[_0xaa60('0x33')](_0x1cd968[_0xaa60('0x48')][_0xaa60('0x33')]);}_0x3f8d88['order']=qs[_0xaa60('0x50')](_0x1cd968[_0xaa60('0x48')][_0xaa60('0x50')]);_0x3f8d88['where']=qs['filters'](_[_0xaa60('0x52')](_0x1cd968[_0xaa60('0x48')],_0x569f2b[_0xaa60('0x51')]));_0x3f8d88[_0xaa60('0x54')]['FaxAccountId']=_0x4be3d1['id'];if(_0x1cd968[_0xaa60('0x48')][_0xaa60('0x53')]){_0x3f8d88[_0xaa60('0x54')]=_[_0xaa60('0x55')](_0x3f8d88[_0xaa60('0x54')],{'$or':_[_0xaa60('0x47')](_0x3f8d88[_0xaa60('0x4c')],function(_0x413177){var _0x9ae993={};_0x9ae993[_0x413177]={'$like':'%'+_0x1cd968['query'][_0xaa60('0x53')]+'%'};return _0x9ae993;})});}if(_0x1cd968[_0xaa60('0x48')][_0xaa60('0xa3')]){var _0x136b2b=_0x1cd968[_0xaa60('0x48')][_0xaa60('0xa3')][_0xaa60('0xa4')](',');var _0x5e1b92={};_0x5e1b92[_0x136b2b[0x0]]={'$gte':moment(_0x136b2b[0x1])[_0xaa60('0xa5')](_0xaa60('0xa6'))};_0x3f8d88[_0xaa60('0x54')]=_[_0xaa60('0x55')](_0x3f8d88['where'],_0x5e1b92);}_0x3f8d88=_['merge']({},_0x3f8d88,_0x1cd968['options']);return db[_0xaa60('0xa2')][_0xaa60('0x36')]({'where':_0x3f8d88['where']})[_0xaa60('0x25')](function(_0x30747d){_0xbd639e[_0xaa60('0x36')]=_0x30747d;if(_0x1cd968['query'][_0xaa60('0x5c')]){_0x3f8d88[_0xaa60('0x57')]=[{'all':!![]}];}return db[_0xaa60('0xa2')]['findAll'](_0x3f8d88);})[_0xaa60('0x25')](function(_0x5da9be){_0xbd639e[_0xaa60('0x59')]=_0x5da9be;return _0xbd639e;});}})[_0xaa60('0x25')](respondWithFilteredResult(_0x4a0a39,_0x3f8d88))[_0xaa60('0x2e')](handleError(_0x4a0a39,null));};exports['send']=function(_0x25e695,_0x23ec0b,_0x56f61c){var _0x472cd0,_0x386b0c={},_0x42e1c2;if(_0x25e695[_0xaa60('0x60')]['to']){_0x42e1c2=_0x25e695[_0xaa60('0x60')]['to'][0x0];}return db['FaxAccount'][_0xaa60('0x5e')]({'where':{'id':_0x25e695['params']['id']},'include':[{'model':db[_0xaa60('0xa7')],'as':'List','include':[{'model':db[_0xaa60('0x79')],'as':_0xaa60('0xa8'),'where':{'fax':_0x42e1c2},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x23ec0b,null))[_0xaa60('0x25')](function(_0x24fff0){_0x472cd0=_0x24fff0;if(_0x25e695[_0xaa60('0x60')]['attachments']&&_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][_0xaa60('0x4d')]){for(var _0xbb25f8=0x0;_0xbb25f8<_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][_0xaa60('0x4d')];_0xbb25f8+=0x1){_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][_0xbb25f8]={'filename':_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][_0xbb25f8][_0xaa60('0x3f')],'id':_0x25e695[_0xaa60('0x60')]['attachments'][_0xbb25f8]['id'],'path':path[_0xaa60('0xaa')](config['root'],_0xaa60('0xab'),_0x25e695['body'][_0xaa60('0xa9')][_0xbb25f8][_0xaa60('0xac')])};}}return respondWithRpcPromise(_0xaa60('0xad'),_0xaa60('0xad'),{'FaxAccountId':_[_0xaa60('0xae')](_0x25e695[_0xaa60('0x5b')]['id'])?undefined:_0x25e695['params']['id'],'path':_[_0xaa60('0xae')](_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][0x0][_0xaa60('0x8')])?undefined:_0x25e695[_0xaa60('0x60')]['attachments'][0x0][_0xaa60('0x8')],'fax':_[_0xaa60('0xae')](_0x25e695[_0xaa60('0x60')]['to'][0x0])?undefined:_0x25e695[_0xaa60('0x60')]['to'][0x0]},client9002);})[_0xaa60('0x25')](function(){if(_0x472cd0){if(_['isNil'](_0x25e695[_0xaa60('0x60')]['from'])){_0x25e695[_0xaa60('0x60')]['from']=util[_0xaa60('0xa5')](_0xaa60('0xaf'),_0x472cd0[_0xaa60('0x3f')],_0x472cd0['fax']);}if(_0x472cd0[_0xaa60('0xb0')]){if(_0x472cd0[_0xaa60('0xb0')][_0xaa60('0xa8')][_0xaa60('0x4d')]){return _0x472cd0[_0xaa60('0xb0')]['Contacts'][0x0];}else{return db[_0xaa60('0x79')][_0xaa60('0x5f')](_[_0xaa60('0x1c')](_0x25e695[_0xaa60('0x60')],{'firstName':_0x25e695['body']['to'][0x0],'phone':_0x25e695[_0xaa60('0x60')]['to'][0x0],'fax':_0x25e695[_0xaa60('0x60')]['to'][0x0],'ListId':_0x472cd0[_0xaa60('0xb1')]}));}}else{throw new Error(_0xaa60('0xb2'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xaa60('0x25')](function(_0x64f6e2){if(_0x64f6e2){return db[_0xaa60('0x76')][_0xaa60('0x5e')]({'where':{'ContactId':_0x64f6e2['id'],'closed':![],'FaxAccountId':_0x472cd0['id']}})[_0xaa60('0x25')](function(_0x4131a9){if(_0x4131a9){return[_0x4131a9,![]];}return db[_0xaa60('0x76')][_0xaa60('0x5f')]({'UserId':_0x25e695[_0xaa60('0x62')]['id'],'ContactId':_0x64f6e2['id'],'FaxAccountId':_0x472cd0['id'],'fax':_0x25e695[_0xaa60('0x60')]['to'][0x0],'firstMsgDirection':_0xaa60('0xb3'),'Messages':[_[_0xaa60('0x55')](_0x25e695['body'],{'read':![],'body':_0x25e695['body']['attachments'][0x0][_0xaa60('0xb4')],'FaxAccountId':_0x472cd0['id'],'UserId':_0x25e695['user']['id'],'ContactId':_0x64f6e2['id'],'AttachmentId':_0x25e695[_0xaa60('0x60')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xaa60('0xb5')}]})[_0xaa60('0x25')](function(_0x212342){return[_0x212342,!![]];});});}else{throw new Error(_0xaa60('0xb6'));}})[_0xaa60('0xb7')](function(_0x3f9939,_0xe683b6){if(_0xe683b6){return _0x3f9939;}return db[_0xaa60('0xa2')][_0xaa60('0x5f')]({'direction':'out','read':![],'body':_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][0x0]['filename'],'FaxAccountId':_0x472cd0['id'],'FaxInteractionId':_0x3f9939['id'],'UserId':_0x25e695['user']['id'],'ContactId':_0x3f9939[_0xaa60('0xb8')],'AttachmentId':_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][0x0]['id']})[_0xaa60('0x25')](function(_0x1a995b){_0x3f9939[_0xaa60('0xb9')][_0xaa60('0xb5')]=[];_0x3f9939[_0xaa60('0xb9')]['Messages'][_0xaa60('0x94')](_0x1a995b[_0xaa60('0xb9')]);return _0x3f9939;});})[_0xaa60('0x25')](function(_0x116215){respondWithRpcPromise('SendFax',_0xaa60('0xba'),{'FaxAccountId':_['isNil'](_0x25e695['params']['id'])?undefined:_0x25e695[_0xaa60('0x5b')]['id'],'path':_[_0xaa60('0xae')](_0x25e695['body'][_0xaa60('0xa9')][0x0]['path'])?undefined:_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][0x0][_0xaa60('0x8')],'fax':_[_0xaa60('0xae')](_0x25e695['body']['to'][0x0])?undefined:_0x25e695[_0xaa60('0x60')]['to'][0x0],'AttachmentId':_0x25e695[_0xaa60('0x60')]['attachments'][0x0]['id']},client9002)[_0xaa60('0x25')](function(_0x2eb04e){logger['info'](_0xaa60('0xbb'),_0x2eb04e);})[_0xaa60('0x2e')](function(_0x2d09b0){logger[_0xaa60('0x26')]('SendFaxRpc,\x20%s',_0x2d09b0);});return _0x116215;})[_0xaa60('0x25')](respondWithResult(_0x23ec0b,null))[_0xaa60('0x2e')](handleError(_0x23ec0b,null));};exports[_0xaa60('0xbc')]=function(_0x2c624b,_0x2336ae,_0xfde4ef){return db['FaxAccount'][_0xaa60('0x5e')]({'where':{'id':_0x2c624b[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x2336ae,null))['then'](function(_0x1f89d0){if(_0x1f89d0){return _0x1f89d0[_0xaa60('0xbc')](_0x2c624b[_0xaa60('0x60')][_0xaa60('0x74')],_[_0xaa60('0x77')](_0x2c624b[_0xaa60('0x60')],[_0xaa60('0x74'),'id'])||{})[_0xaa60('0xb7')](function(_0x2c2b66){for(var _0x9c13d4=0x0;_0x9c13d4<_0x2c624b[_0xaa60('0x60')][_0xaa60('0x74')][_0xaa60('0x4d')];_0x9c13d4+=0x1){socket[_0xaa60('0xbd')](_0xaa60('0xbe'),{'UserId':Number(_0x2c624b[_0xaa60('0x60')]['ids'][_0x9c13d4]),'FaxAccountId':Number(_0x2c624b[_0xaa60('0x5b')]['id'])});}return _0x2c2b66;});}})['then'](respondWithResult(_0x2336ae,null))[_0xaa60('0x2e')](handleError(_0x2336ae,null));};exports[_0xaa60('0xbf')]=function(_0x3c8f2f,_0x195c18,_0x66cb01){return db[_0xaa60('0x56')][_0xaa60('0x5e')]({'where':{'id':_0x3c8f2f[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x195c18,null))[_0xaa60('0x25')](function(_0x2815c5){if(_0x2815c5){return _0x2815c5['removeAgents'](_0x3c8f2f[_0xaa60('0x48')][_0xaa60('0x74')])['then'](function(){if(_['isArray'](_0x3c8f2f['query'][_0xaa60('0x74')])){for(var _0x5173b2=0x0;_0x5173b2<_0x3c8f2f['query'][_0xaa60('0x74')][_0xaa60('0x4d')];_0x5173b2+=0x1){socket[_0xaa60('0xbd')](_0xaa60('0xc0'),{'UserId':Number(_0x3c8f2f['query'][_0xaa60('0x74')][_0x5173b2]),'FaxAccountId':Number(_0x3c8f2f[_0xaa60('0x5b')]['id'])});}}else{socket[_0xaa60('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x3c8f2f[_0xaa60('0x48')]['ids']),'FaxAccountId':Number(_0x3c8f2f[_0xaa60('0x5b')]['id'])});}});}})[_0xaa60('0x25')](respondWithStatusCode(_0x195c18,null))[_0xaa60('0x2e')](handleError(_0x195c18,null));};exports[_0xaa60('0xc1')]=function(_0x56bc39,_0x192aa7,_0x119738){var _0x206416={};var _0x419612={};var _0x1279df;var _0xbcc78b;return db[_0xaa60('0x56')][_0xaa60('0x6d')]({'where':{'id':_0x56bc39[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x192aa7,null))[_0xaa60('0x25')](function(_0x4eb2e3){if(_0x4eb2e3){_0x1279df=_0x4eb2e3;_0x419612['model']=_['keys'](db[_0xaa60('0x7b')]['rawAttributes']);_0x419612[_0xaa60('0x48')]=_[_0xaa60('0x49')](_0x56bc39[_0xaa60('0x48')]);_0x419612[_0xaa60('0x51')]=_[_0xaa60('0x4a')](_0x419612[_0xaa60('0x46')],_0x419612[_0xaa60('0x48')]);_0x206416[_0xaa60('0x4c')]=_[_0xaa60('0x4a')](_0x419612[_0xaa60('0x46')],qs['fields'](_0x56bc39['query']['fields']));_0x206416['attributes']=_0x206416[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x206416[_0xaa60('0x4c')]:_0x419612['model'];_0x206416[_0xaa60('0x4f')]=qs['sort'](_0x56bc39[_0xaa60('0x48')]['sort']);_0x206416[_0xaa60('0x54')]=qs[_0xaa60('0x51')](_[_0xaa60('0x52')](_0x56bc39[_0xaa60('0x48')],_0x419612[_0xaa60('0x51')]));if(_0x56bc39[_0xaa60('0x48')]['filter']){_0x206416[_0xaa60('0x54')]=_[_0xaa60('0x55')](_0x206416[_0xaa60('0x54')],{'$or':_[_0xaa60('0x47')](_0x206416[_0xaa60('0x4c')],function(_0x42e5f8){var _0x142ef9={};_0x142ef9[_0x42e5f8]={'$like':'%'+_0x56bc39[_0xaa60('0x48')][_0xaa60('0x53')]+'%'};return _0x142ef9;})});}_0x206416=_[_0xaa60('0x55')]({},_0x206416,_0x56bc39[_0xaa60('0x5d')]);return _0x1279df[_0xaa60('0xc1')](_0x206416);}})[_0xaa60('0x25')](function(_0x4304f0){if(_0x4304f0){_0xbcc78b=_0x4304f0[_0xaa60('0x4d')];if(!_0x56bc39[_0xaa60('0x48')][_0xaa60('0x4e')](_0xaa60('0x6e'))){_0x206416[_0xaa60('0x35')]=qs[_0xaa60('0x35')](_0x56bc39[_0xaa60('0x48')][_0xaa60('0x35')]);_0x206416[_0xaa60('0x33')]=qs[_0xaa60('0x33')](_0x56bc39[_0xaa60('0x48')]['offset']);}return _0x1279df['getAgents'](_0x206416);}})[_0xaa60('0x25')](function(_0x72096d){if(_0x72096d){return _0x72096d?{'count':_0xbcc78b,'rows':_0x72096d}:null;}})[_0xaa60('0x25')](respondWithResult(_0x192aa7,null))['catch'](handleError(_0x192aa7,null));}; \ No newline at end of file +var _0xafe0=['attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','mandatoryDispositionPause','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','FaxAccountId','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','tech','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','result','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','FaxAccounts','end','stack','name','send','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafe0,0x7b));var _0x0afe=function(_0x133e8d,_0x4648f1){_0x133e8d=_0x133e8d-0x0;var _0x10ce55=_0xafe0[_0x133e8d];return _0x10ce55;};'use strict';var emlformat=require(_0x0afe('0x0'));var rimraf=require(_0x0afe('0x1'));var zipdir=require(_0x0afe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0afe('0x3'));var moment=require(_0x0afe('0x4'));var BPromise=require(_0x0afe('0x5'));var Mustache=require('mustache');var util=require(_0x0afe('0x6'));var path=require(_0x0afe('0x7'));var sox=require(_0x0afe('0x8'));var csv=require(_0x0afe('0x9'));var ejs=require(_0x0afe('0xa'));var fs=require('fs');var fs_extra=require(_0x0afe('0xb'));var _=require(_0x0afe('0xc'));var squel=require(_0x0afe('0xd'));var crypto=require(_0x0afe('0xe'));var jsforce=require(_0x0afe('0xf'));var deskjs=require(_0x0afe('0x10'));var toCsv=require(_0x0afe('0x9'));var querystring=require(_0x0afe('0x11'));var Papa=require(_0x0afe('0x12'));var Redis=require(_0x0afe('0x13'));var authService=require(_0x0afe('0x14'));var qs=require(_0x0afe('0x15'));var as=require(_0x0afe('0x16'));var hardwareService=require(_0x0afe('0x17'));var logger=require('../../config/logger')(_0x0afe('0x18'));var utils=require(_0x0afe('0x19'));var config=require(_0x0afe('0x1a'));var licenseUtil=require(_0x0afe('0x1b'));var db=require('../../mysqldb')['db'];config[_0x0afe('0x1c')]=_['defaults'](config[_0x0afe('0x1c')],{'host':_0x0afe('0x1d'),'port':0x18eb});var socket=require(_0x0afe('0x1e'))(new Redis(config[_0x0afe('0x1c')]));require('./faxAccount.socket')[_0x0afe('0x1f')](socket);var jayson=require(_0x0afe('0x20'));var client=jayson[_0x0afe('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x0afe('0x21')][_0x0afe('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x1c43f9,_0x1ff928,_0x16b2bc,_0x8d09be){return new BPromise(function(_0x151374,_0x57f236){var _0x132df5=_0x8d09be||client;return _0x132df5[_0x0afe('0x23')](_0x1c43f9,_0x16b2bc)[_0x0afe('0x24')](function(_0x464438){logger[_0x0afe('0x25')]('FaxAccount,\x20%s,\x20%s',_0x1ff928,_0x0afe('0x26'));logger[_0x0afe('0x27')](_0x0afe('0x28'),_0x1ff928,_0x0afe('0x26'),JSON[_0x0afe('0x29')](_0x464438));if(_0x464438['error']){if(_0x464438[_0x0afe('0x2a')][_0x0afe('0x2b')]===0x1f4){logger[_0x0afe('0x2a')](_0x0afe('0x2c'),_0x1ff928,_0x464438[_0x0afe('0x2a')]['message']);return _0x57f236(_0x464438[_0x0afe('0x2a')]['message']);}logger[_0x0afe('0x2a')](_0x0afe('0x2c'),_0x1ff928,_0x464438['error']['message']);return _0x151374(_0x464438[_0x0afe('0x2a')]['message']);}else{logger['info'](_0x0afe('0x2c'),_0x1ff928,_0x0afe('0x26'));_0x151374(_0x464438[_0x0afe('0x2d')][_0x0afe('0x2e')]);}})[_0x0afe('0x2f')](function(_0x41c6a6){logger[_0x0afe('0x2a')](_0x0afe('0x2c'),_0x1ff928,_0x41c6a6);_0x57f236(_0x41c6a6);});});}function respondWithStatusCode(_0x1ff6b6,_0x51446b){_0x51446b=_0x51446b||0xcc;return function(_0x203a03){if(_0x203a03){return _0x1ff6b6[_0x0afe('0x30')](_0x51446b);}return _0x1ff6b6['status'](_0x51446b)['end']();};}function respondWithResult(_0xae2a2f,_0x5371fc){_0x5371fc=_0x5371fc||0xc8;return function(_0x296285){if(_0x296285){return _0xae2a2f[_0x0afe('0x31')](_0x5371fc)[_0x0afe('0x32')](_0x296285);}};}function respondWithFilteredResult(_0x151efa,_0x267b75){return function(_0x248207){if(_0x248207){var _0x5b49e2=typeof _0x267b75[_0x0afe('0x33')]===_0x0afe('0x34')&&typeof _0x267b75[_0x0afe('0x35')]==='undefined';var _0x338081=_0x248207[_0x0afe('0x36')];var _0x4f6705=_0x5b49e2?0x0:_0x267b75[_0x0afe('0x33')];var _0x181d0b=_0x5b49e2?_0x248207[_0x0afe('0x36')]:_0x267b75[_0x0afe('0x33')]+_0x267b75[_0x0afe('0x35')];var _0x44db89;if(_0x181d0b>=_0x338081){_0x181d0b=_0x338081;_0x44db89=0xc8;}else{_0x44db89=0xce;}_0x151efa['status'](_0x44db89);return _0x151efa[_0x0afe('0x37')]('Content-Range',_0x4f6705+'-'+_0x181d0b+'/'+_0x338081)[_0x0afe('0x32')](_0x248207);}return null;};}function patchUpdates(_0x9e7332){return function(_0x4948dc){try{jsonpatch[_0x0afe('0x38')](_0x4948dc,_0x9e7332,!![]);}catch(_0x3d5308){return BPromise[_0x0afe('0x39')](_0x3d5308);}return _0x4948dc['save']();};}function saveUpdates(_0x267566,_0x4e1873){return function(_0x3ca3f9){if(_0x3ca3f9){return _0x3ca3f9[_0x0afe('0x3a')](_0x267566)[_0x0afe('0x24')](function(_0x4c98cb){return _0x4c98cb;});}return null;};}function removeEntity(_0x10cd5f,_0x510a6f){return function(_0x5c32bf){if(_0x5c32bf){return _0x5c32bf[_0x0afe('0x3b')]()[_0x0afe('0x24')](function(){var _0x499fd4=_0x5c32bf[_0x0afe('0x3c')]({'plain':!![]});var _0x28f12b=_0x0afe('0x3d');return db['UserProfileResource'][_0x0afe('0x3b')]({'where':{'type':_0x28f12b,'resourceId':_0x499fd4['id']}})[_0x0afe('0x24')](function(){return _0x5c32bf;});})[_0x0afe('0x24')](function(){_0x10cd5f['status'](0xcc)[_0x0afe('0x3e')]();});}};}function handleEntityNotFound(_0xfd856b,_0x5a7baf){return function(_0x3724fd){if(!_0x3724fd){_0xfd856b['sendStatus'](0x194);}return _0x3724fd;};}function handleError(_0x24aa89,_0x174bba){_0x174bba=_0x174bba||0x1f4;return function(_0x19b5bc){logger[_0x0afe('0x2a')](_0x19b5bc[_0x0afe('0x3f')]);if(_0x19b5bc[_0x0afe('0x40')]){delete _0x19b5bc[_0x0afe('0x40')];}_0x24aa89[_0x0afe('0x31')](_0x174bba)[_0x0afe('0x41')](_0x19b5bc);};}exports['index']=function(_0x3a5d7,_0xcc991b){var _0x5a39dc={'include':[{'model':db[_0x0afe('0x42')],'as':'mandatoryDispositionPause'}]},_0x3a0514={},_0x51e6d7={'count':0x0,'rows':[]};var _0x8de65=_[_0x0afe('0x43')](db[_0x0afe('0x44')][_0x0afe('0x45')],function(_0x86cf71){return{'name':_0x86cf71[_0x0afe('0x46')],'type':_0x86cf71[_0x0afe('0x47')][_0x0afe('0x48')]};});_0x3a0514[_0x0afe('0x49')]=_[_0x0afe('0x43')](_0x8de65,_0x0afe('0x40'));_0x3a0514['query']=_[_0x0afe('0x4a')](_0x3a5d7['query']);_0x3a0514[_0x0afe('0x4b')]=_['intersection'](_0x3a0514[_0x0afe('0x49')],_0x3a0514['query']);_0x5a39dc['attributes']=_[_0x0afe('0x4c')](_0x3a0514['model'],qs[_0x0afe('0x4d')](_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x4d')]));_0x5a39dc['attributes']=_0x5a39dc[_0x0afe('0x4f')]['length']?_0x5a39dc['attributes']:_0x3a0514[_0x0afe('0x49')];if(!_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x50')](_0x0afe('0x51'))){_0x5a39dc[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x35')]);_0x5a39dc[_0x0afe('0x33')]=qs['offset'](_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x33')]);}_0x5a39dc[_0x0afe('0x52')]=qs[_0x0afe('0x53')](_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x53')]);_0x5a39dc[_0x0afe('0x54')]=qs[_0x0afe('0x4b')](_[_0x0afe('0x55')](_0x3a5d7[_0x0afe('0x4e')],_0x3a0514[_0x0afe('0x4b')]),_0x8de65);if(_0x3a5d7[_0x0afe('0x4e')]['filter']){_0x5a39dc[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x5a39dc[_0x0afe('0x54')],{'$or':_[_0x0afe('0x43')](_0x8de65,function(_0x3957a3){if(_0x3957a3[_0x0afe('0x47')]!==_0x0afe('0x57')){var _0x14f30d={};_0x14f30d[_0x3957a3['name']]={'$like':'%'+_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x58')]+'%'};return _0x14f30d;}})});}_0x5a39dc=_[_0x0afe('0x56')]({},_0x5a39dc,_0x3a5d7[_0x0afe('0x59')]);var _0x2bd9e2={'where':_0x5a39dc['where']};return db[_0x0afe('0x44')][_0x0afe('0x36')](_0x2bd9e2)[_0x0afe('0x24')](function(_0x4300ea){_0x51e6d7['count']=_0x4300ea;if(_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x5a')]){_0x5a39dc[_0x0afe('0x5b')]=[{'all':!![]}];}return db[_0x0afe('0x44')]['findAll'](_0x5a39dc);})[_0x0afe('0x24')](function(_0x40d85d){_0x51e6d7[_0x0afe('0x5c')]=_0x40d85d;return _0x51e6d7;})[_0x0afe('0x24')](respondWithFilteredResult(_0xcc991b,_0x5a39dc))['catch'](handleError(_0xcc991b,null));};exports[_0x0afe('0x5d')]=function(_0x48b6e2,_0x42a305){var _0x4ae7c5={'raw':![],'where':{'id':_0x48b6e2[_0x0afe('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x0afe('0x5f')}]},_0x2da340={};_0x2da340['model']=_['keys'](db[_0x0afe('0x44')][_0x0afe('0x45')]);_0x2da340[_0x0afe('0x4e')]=_['keys'](_0x48b6e2[_0x0afe('0x4e')]);_0x2da340[_0x0afe('0x4b')]=_[_0x0afe('0x4c')](_0x2da340[_0x0afe('0x49')],_0x2da340[_0x0afe('0x4e')]);_0x4ae7c5[_0x0afe('0x4f')]=_[_0x0afe('0x4c')](_0x2da340[_0x0afe('0x49')],qs[_0x0afe('0x4d')](_0x48b6e2[_0x0afe('0x4e')]['fields']));_0x4ae7c5['attributes']=_0x4ae7c5[_0x0afe('0x4f')][_0x0afe('0x60')]?_0x4ae7c5[_0x0afe('0x4f')]:_0x2da340[_0x0afe('0x49')];if(_0x48b6e2[_0x0afe('0x4e')][_0x0afe('0x5a')]){_0x4ae7c5[_0x0afe('0x5b')]=[{'all':!![]}];}_0x4ae7c5=_[_0x0afe('0x56')]({},_0x4ae7c5,_0x48b6e2[_0x0afe('0x59')]);return db[_0x0afe('0x44')][_0x0afe('0x61')](_0x4ae7c5)[_0x0afe('0x24')](handleEntityNotFound(_0x42a305,null))[_0x0afe('0x24')](respondWithResult(_0x42a305,null))[_0x0afe('0x2f')](handleError(_0x42a305,null));};exports['create']=function(_0x5c749e,_0x5b238f){return db[_0x0afe('0x44')][_0x0afe('0x62')](_0x5c749e['body'],{})[_0x0afe('0x24')](function(_0x328f29){var _0xb25f09=_0x5c749e[_0x0afe('0x63')][_0x0afe('0x3c')]({'plain':!![]});if(!_0xb25f09)throw new Error(_0x0afe('0x64'));if(_0xb25f09['role']===_0x0afe('0x63')){var _0x39fe9f=_0x328f29[_0x0afe('0x3c')]({'plain':!![]});var _0x159b3e='FaxAccounts';return db[_0x0afe('0x65')][_0x0afe('0x61')]({'where':{'name':_0x159b3e,'userProfileId':_0xb25f09[_0x0afe('0x66')]},'raw':!![]})[_0x0afe('0x24')](function(_0x1100f6){if(_0x1100f6&&_0x1100f6[_0x0afe('0x67')]===0x0){return db[_0x0afe('0x68')][_0x0afe('0x62')]({'name':_0x39fe9f['name'],'resourceId':_0x39fe9f['id'],'type':_0x1100f6[_0x0afe('0x40')],'sectionId':_0x1100f6['id']},{})[_0x0afe('0x24')](function(){return _0x328f29;});}else{return _0x328f29;}})['catch'](function(_0x75c5b1){logger['error'](_0x0afe('0x69'),_0x75c5b1);throw _0x75c5b1;});}return _0x328f29;})[_0x0afe('0x24')](respondWithResult(_0x5b238f,0xc9))['catch'](handleError(_0x5b238f,null));};exports['update']=function(_0x3db50f,_0x313364){if(_0x3db50f[_0x0afe('0x6a')]['id']){delete _0x3db50f[_0x0afe('0x6a')]['id'];}return db[_0x0afe('0x44')][_0x0afe('0x61')]({'where':{'id':_0x3db50f[_0x0afe('0x5e')]['id']},'include':[{'model':db[_0x0afe('0x42')],'as':_0x0afe('0x5f')}]})[_0x0afe('0x24')](handleEntityNotFound(_0x313364,null))[_0x0afe('0x24')](saveUpdates(_0x3db50f[_0x0afe('0x6a')],null))[_0x0afe('0x24')](respondWithResult(_0x313364,null))[_0x0afe('0x2f')](handleError(_0x313364,null));};exports[_0x0afe('0x3b')]=function(_0x1976f6,_0x1ed69d){return db[_0x0afe('0x44')][_0x0afe('0x61')]({'where':{'id':_0x1976f6[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x1ed69d,null))[_0x0afe('0x24')](removeEntity(_0x1ed69d,null))[_0x0afe('0x2f')](handleError(_0x1ed69d,null));};exports[_0x0afe('0x6b')]=function(_0x3bdcf3,_0x30bb36){return db[_0x0afe('0x44')][_0x0afe('0x6b')]()[_0x0afe('0x24')](respondWithResult(_0x30bb36,null))[_0x0afe('0x2f')](handleError(_0x30bb36,null));};exports[_0x0afe('0x6c')]=function(_0x403427,_0x4e7b5d,_0x291139){if(_0x403427[_0x0afe('0x6a')]['id']){delete _0x403427[_0x0afe('0x6a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x403427[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x4e7b5d,null))[_0x0afe('0x24')](function(_0x46350c){if(_0x46350c){_0x403427[_0x0afe('0x6a')]['FaxAccountId']=_0x46350c['id'];return db[_0x0afe('0x6d')][_0x0afe('0x62')](_0x403427[_0x0afe('0x6a')]);}})[_0x0afe('0x24')](respondWithResult(_0x4e7b5d,null))[_0x0afe('0x2f')](handleError(_0x4e7b5d,null));};exports[_0x0afe('0x6e')]=function(_0x11c3de,_0x45daa8,_0x567684){var _0x2aa440={'raw':![],'where':{}};var _0x2b9db3={};var _0x10bedd={'count':0x0,'rows':[]};return db[_0x0afe('0x44')]['findOne']({'where':{'id':_0x11c3de[_0x0afe('0x5e')]['id']}})['then'](handleEntityNotFound(_0x45daa8,null))[_0x0afe('0x24')](function(_0xdc29ba){if(_0xdc29ba){_0x2b9db3[_0x0afe('0x49')]=_['keys'](db[_0x0afe('0x6d')][_0x0afe('0x45')]);_0x2b9db3[_0x0afe('0x4e')]=_[_0x0afe('0x4a')](_0x11c3de[_0x0afe('0x4e')]);_0x2b9db3[_0x0afe('0x4b')]=_['intersection'](_0x2b9db3[_0x0afe('0x49')],_0x2b9db3['query']);_0x2aa440[_0x0afe('0x4f')]=_[_0x0afe('0x4c')](_0x2b9db3[_0x0afe('0x49')],qs[_0x0afe('0x4d')](_0x11c3de['query'][_0x0afe('0x4d')]));_0x2aa440['attributes']=_0x2aa440[_0x0afe('0x4f')][_0x0afe('0x60')]?_0x2aa440[_0x0afe('0x4f')]:_0x2b9db3[_0x0afe('0x49')];if(!_0x11c3de[_0x0afe('0x4e')][_0x0afe('0x50')](_0x0afe('0x51'))){_0x2aa440[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x11c3de[_0x0afe('0x4e')][_0x0afe('0x35')]);_0x2aa440[_0x0afe('0x33')]=qs[_0x0afe('0x33')](_0x11c3de[_0x0afe('0x4e')]['offset']);}_0x2aa440[_0x0afe('0x52')]=qs['sort'](_0x11c3de[_0x0afe('0x4e')][_0x0afe('0x53')]);_0x2aa440[_0x0afe('0x54')]=qs[_0x0afe('0x4b')](_[_0x0afe('0x55')](_0x11c3de['query'],_0x2b9db3[_0x0afe('0x4b')]));_0x2aa440['where'][_0x0afe('0x6f')]=_0xdc29ba['id'];if(_0x11c3de[_0x0afe('0x4e')]['filter']){_0x2aa440[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x2aa440['where'],{'$or':_[_0x0afe('0x43')](_0x2aa440[_0x0afe('0x4f')],function(_0xeea105){var _0x2715e5={};_0x2715e5[_0xeea105]={'$like':'%'+_0x11c3de[_0x0afe('0x4e')][_0x0afe('0x58')]+'%'};return _0x2715e5;})});}_0x2aa440=_[_0x0afe('0x56')]({},_0x2aa440,_0x11c3de[_0x0afe('0x59')]);return db[_0x0afe('0x6d')][_0x0afe('0x36')]({'where':_0x2aa440['where']})['then'](function(_0x560c55){_0x10bedd['count']=_0x560c55;if(_0x11c3de[_0x0afe('0x4e')][_0x0afe('0x5a')]){_0x2aa440[_0x0afe('0x5b')]=[{'all':!![]}];}return db[_0x0afe('0x6d')][_0x0afe('0x70')](_0x2aa440);})[_0x0afe('0x24')](function(_0x12f2f9){_0x10bedd[_0x0afe('0x5c')]=_0x12f2f9;return _0x10bedd;});}})[_0x0afe('0x24')](respondWithFilteredResult(_0x45daa8,_0x2aa440))[_0x0afe('0x2f')](handleError(_0x45daa8,null));};exports[_0x0afe('0x71')]=function(_0x515210,_0x145c14,_0x217169){return db[_0x0afe('0x44')][_0x0afe('0x61')]({'where':{'id':_0x515210[_0x0afe('0x5e')]['id']}})['then'](handleEntityNotFound(_0x145c14,null))[_0x0afe('0x24')](function(_0x233750){if(_0x233750){return _0x233750[_0x0afe('0x71')](_0x515210[_0x0afe('0x4e')][_0x0afe('0x72')]);}})[_0x0afe('0x24')](respondWithStatusCode(_0x145c14,null))[_0x0afe('0x2f')](handleError(_0x145c14,null));};exports['addAnswer']=function(_0x4f15df,_0x18539f,_0x4981f1){if(_0x4f15df[_0x0afe('0x6a')]['id']){delete _0x4f15df[_0x0afe('0x6a')]['id'];}return db['FaxAccount'][_0x0afe('0x61')]({'where':{'id':_0x4f15df[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x18539f,null))[_0x0afe('0x24')](function(_0x558938){if(_0x558938){_0x4f15df['body'][_0x0afe('0x6f')]=_0x558938['id'];return db[_0x0afe('0x73')][_0x0afe('0x62')](_0x4f15df[_0x0afe('0x6a')]);}})[_0x0afe('0x24')](respondWithResult(_0x18539f,null))[_0x0afe('0x2f')](handleError(_0x18539f,null));};exports[_0x0afe('0x74')]=function(_0x332c5,_0x1d8bb6,_0x3184d2){var _0x5d9268={'raw':![],'where':{}};var _0x562bad={};var _0x5d0f4c={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x332c5[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x1d8bb6,null))['then'](function(_0x15f5d1){if(_0x15f5d1){_0x562bad['model']=_[_0x0afe('0x4a')](db[_0x0afe('0x73')][_0x0afe('0x45')]);_0x562bad['query']=_[_0x0afe('0x4a')](_0x332c5[_0x0afe('0x4e')]);_0x562bad['filters']=_[_0x0afe('0x4c')](_0x562bad[_0x0afe('0x49')],_0x562bad['query']);_0x5d9268[_0x0afe('0x4f')]=_[_0x0afe('0x4c')](_0x562bad['model'],qs[_0x0afe('0x4d')](_0x332c5['query'][_0x0afe('0x4d')]));_0x5d9268[_0x0afe('0x4f')]=_0x5d9268['attributes'][_0x0afe('0x60')]?_0x5d9268[_0x0afe('0x4f')]:_0x562bad[_0x0afe('0x49')];if(!_0x332c5['query']['hasOwnProperty'](_0x0afe('0x51'))){_0x5d9268[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x332c5[_0x0afe('0x4e')][_0x0afe('0x35')]);_0x5d9268[_0x0afe('0x33')]=qs[_0x0afe('0x33')](_0x332c5[_0x0afe('0x4e')][_0x0afe('0x33')]);}_0x5d9268['order']=qs[_0x0afe('0x53')](_0x332c5[_0x0afe('0x4e')]['sort']);_0x5d9268[_0x0afe('0x54')]=qs['filters'](_[_0x0afe('0x55')](_0x332c5[_0x0afe('0x4e')],_0x562bad['filters']));_0x5d9268[_0x0afe('0x54')][_0x0afe('0x6f')]=_0x15f5d1['id'];if(_0x332c5['query'][_0x0afe('0x58')]){_0x5d9268[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x5d9268[_0x0afe('0x54')],{'$or':_[_0x0afe('0x43')](_0x5d9268[_0x0afe('0x4f')],function(_0x2d6f99){var _0x3c25c3={};_0x3c25c3[_0x2d6f99]={'$like':'%'+_0x332c5[_0x0afe('0x4e')][_0x0afe('0x58')]+'%'};return _0x3c25c3;})});}_0x5d9268=_[_0x0afe('0x56')]({},_0x5d9268,_0x332c5[_0x0afe('0x59')]);return db[_0x0afe('0x73')][_0x0afe('0x36')]({'where':_0x5d9268[_0x0afe('0x54')]})[_0x0afe('0x24')](function(_0x33b2b9){_0x5d0f4c[_0x0afe('0x36')]=_0x33b2b9;if(_0x332c5[_0x0afe('0x4e')][_0x0afe('0x5a')]){_0x5d9268[_0x0afe('0x5b')]=[{'all':!![]}];}return db[_0x0afe('0x73')][_0x0afe('0x70')](_0x5d9268);})[_0x0afe('0x24')](function(_0x2e90af){_0x5d0f4c[_0x0afe('0x5c')]=_0x2e90af;return _0x5d0f4c;});}})[_0x0afe('0x24')](respondWithFilteredResult(_0x1d8bb6,_0x5d9268))['catch'](handleError(_0x1d8bb6,null));};exports[_0x0afe('0x75')]=function(_0x4a27a7,_0x363b10,_0x2cb792){return db[_0x0afe('0x44')]['find']({'where':{'id':_0x4a27a7[_0x0afe('0x5e')]['id']}})['then'](handleEntityNotFound(_0x363b10,null))[_0x0afe('0x24')](function(_0x507cd6){if(_0x507cd6){return _0x507cd6['removeAnswers'](_0x4a27a7[_0x0afe('0x4e')][_0x0afe('0x72')]);}})[_0x0afe('0x24')](respondWithStatusCode(_0x363b10,null))[_0x0afe('0x2f')](handleError(_0x363b10,null));};exports[_0x0afe('0x76')]=function(_0x5c2c98,_0x47a0e3,_0x3992ab){return db[_0x0afe('0x77')][_0x0afe('0x61')]({'where':{'id':_0x5c2c98[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x47a0e3,null))['then'](function(_0x49c951){if(_0x49c951){return _0x49c951[_0x0afe('0x76')](_0x5c2c98['body'][_0x0afe('0x72')],_[_0x0afe('0x78')](_0x5c2c98[_0x0afe('0x6a')],['ids','id'])||{});}})['then'](respondWithResult(_0x47a0e3,null))[_0x0afe('0x2f')](handleError(_0x47a0e3,null));};exports['getInteractions']=function(_0x43a6c7,_0x292bc9,_0x535d97){var _0x2a71f6={'raw':![],'where':{}};var _0x3eeeb5={};var _0x3ee25e={'count':0x0,'rows':[]};return db[_0x0afe('0x44')]['findOne']({'where':{'id':_0x43a6c7[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x292bc9,null))[_0x0afe('0x24')](function(_0x4084e2){if(_0x4084e2){_0x3eeeb5[_0x0afe('0x49')]=_['keys'](db[_0x0afe('0x77')][_0x0afe('0x45')]);_0x3eeeb5['query']=_[_0x0afe('0x4a')](_0x43a6c7[_0x0afe('0x4e')]);_0x3eeeb5['filters']=_[_0x0afe('0x4c')](_0x3eeeb5[_0x0afe('0x49')],_0x3eeeb5[_0x0afe('0x4e')]);_0x2a71f6[_0x0afe('0x4f')]=_[_0x0afe('0x4c')](_0x3eeeb5[_0x0afe('0x49')],qs[_0x0afe('0x4d')](_0x43a6c7[_0x0afe('0x4e')]['fields']));_0x2a71f6[_0x0afe('0x4f')]=_0x2a71f6[_0x0afe('0x4f')][_0x0afe('0x60')]?_0x2a71f6[_0x0afe('0x4f')]:_0x3eeeb5[_0x0afe('0x49')];if(!_0x43a6c7[_0x0afe('0x4e')]['hasOwnProperty'](_0x0afe('0x51'))){_0x2a71f6[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x35')]);_0x2a71f6[_0x0afe('0x33')]=qs[_0x0afe('0x33')](_0x43a6c7[_0x0afe('0x4e')]['offset']);}_0x2a71f6[_0x0afe('0x52')]=qs[_0x0afe('0x53')](_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x53')]);_0x2a71f6['where']=qs[_0x0afe('0x4b')](_[_0x0afe('0x55')](_0x43a6c7[_0x0afe('0x4e')],_0x3eeeb5[_0x0afe('0x4b')]));_0x2a71f6[_0x0afe('0x54')][_0x0afe('0x6f')]=_0x4084e2['id'];if(_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x58')]){_0x2a71f6[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x2a71f6[_0x0afe('0x54')],{'$or':_[_0x0afe('0x43')](_0x2a71f6['attributes'],function(_0x3d7e03){var _0x113a2e={};_0x113a2e[_0x3d7e03]={'$like':'%'+_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x58')]+'%'};return _0x113a2e;})});}_0x2a71f6=_[_0x0afe('0x56')]({},_0x2a71f6,_0x43a6c7['options']);return db[_0x0afe('0x77')][_0x0afe('0x36')]({'where':_0x2a71f6[_0x0afe('0x54')]})[_0x0afe('0x24')](function(_0x36ffe5){_0x3ee25e[_0x0afe('0x36')]=_0x36ffe5;if(_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x5a')]){_0x2a71f6['include']=[{'model':db[_0x0afe('0x79')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x0afe('0x7a'),'attributes':[_0x0afe('0x40'),_0x0afe('0x7b'),_0x0afe('0x7c')],'required':![]},{'model':db['Tag'],'as':_0x0afe('0x7d'),'attributes':['id','name',_0x0afe('0x7e')],'where':_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x7f')]?{'id':_0x43a6c7['query']['tag']}:undefined,'required':_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x7f')]?!![]:![]}];}return db['FaxInteraction'][_0x0afe('0x70')](_0x2a71f6);})[_0x0afe('0x24')](function(_0x4c8057){_0x3ee25e[_0x0afe('0x5c')]=_0x4c8057;return _0x3ee25e;});}})[_0x0afe('0x24')](respondWithFilteredResult(_0x292bc9,_0x2a71f6))['catch'](handleError(_0x292bc9,null));};exports[_0x0afe('0x80')]=function(_0x2984ac,_0x3ff4d9){var _0x54ee00=_0x2984ac[_0x0afe('0x5e')]['id'];var _0x22b7ec=_0x2984ac['body'];var _0x25f3fc=0xc8;var _0x3d80a8=null;return db[_0x0afe('0x81')][_0x0afe('0x82')]({'isolationLevel':db['sequelize'][_0x0afe('0x83')][_0x0afe('0x84')][_0x0afe('0x85')]},function(_0x21bf92){return db['FaxAccount'][_0x0afe('0x86')]({'where':{'id':_0x54ee00},'transaction':_0x21bf92})[_0x0afe('0x24')](function(_0x48798c){if(_0x48798c){return db[_0x0afe('0x87')][_0x0afe('0x3b')]({'where':{'FaxAccountId':_0x54ee00},'transaction':_0x21bf92})[_0x0afe('0x24')](function(){var _0x3b4b05=_[_0x0afe('0x43')](_0x22b7ec,function(_0x28307e){_0x28307e[_0x0afe('0x6f')]=_0x54ee00;return _0x28307e;});return db[_0x0afe('0x87')][_0x0afe('0x88')](_0x3b4b05,{'transaction':_0x21bf92});});}else{_0x25f3fc=0x194;_0x3d80a8=[];}});})[_0x0afe('0x24')](function(){if(_0x25f3fc!==0x194){return db[_0x0afe('0x87')][_0x0afe('0x89')]({'where':{'FaxAccountId':_0x54ee00},'order':_0x0afe('0x8a')})[_0x0afe('0x24')](function(_0x4817e3){_0x3d80a8=_0x4817e3;});}})[_0x0afe('0x2f')](function(_0x226ab3){_0x25f3fc=0x1f4;logger['error'](_0x226ab3['stack']);if(_0x226ab3[_0x0afe('0x40')]){delete _0x226ab3[_0x0afe('0x40')];}_0x3d80a8=_0x226ab3;})[_0x0afe('0x8b')](function(){if(_0x3d80a8===null){_0x3ff4d9[_0x0afe('0x30')](_0x25f3fc);}else{if(_0x25f3fc===0x1f4){_0x3ff4d9['status'](_0x25f3fc)['send'](_0x3d80a8);}else{_0x3ff4d9[_0x0afe('0x31')](_0x25f3fc)[_0x0afe('0x32')](_0x3d80a8);}}});};exports[_0x0afe('0x8c')]=function(_0x5c928c,_0x5e49f7,_0x268a78){var _0x371017={};var _0x5538aa={};var _0x30fb20;var _0x5408da;return db[_0x0afe('0x44')][_0x0afe('0x86')]({'where':{'id':_0x5c928c[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x5e49f7,null))[_0x0afe('0x24')](function(_0x27495e){if(_0x27495e){_0x30fb20=_0x27495e;_0x5538aa[_0x0afe('0x49')]=_[_0x0afe('0x4a')](db['FaxApplication']['rawAttributes']);_0x5538aa[_0x0afe('0x4e')]=_[_0x0afe('0x4a')](_0x5c928c[_0x0afe('0x4e')]);_0x5538aa[_0x0afe('0x4b')]=_[_0x0afe('0x4c')](_0x5538aa[_0x0afe('0x49')],_0x5538aa[_0x0afe('0x4e')]);_0x371017[_0x0afe('0x4f')]=_[_0x0afe('0x4c')](_0x5538aa[_0x0afe('0x49')],qs['fields'](_0x5c928c['query'][_0x0afe('0x4d')]));_0x371017[_0x0afe('0x4f')]=_0x371017['attributes'][_0x0afe('0x60')]?_0x371017[_0x0afe('0x4f')]:_0x5538aa[_0x0afe('0x49')];_0x371017['order']=qs[_0x0afe('0x53')](_0x5c928c[_0x0afe('0x4e')][_0x0afe('0x53')]);_0x371017['where']=qs[_0x0afe('0x4b')](_['pick'](_0x5c928c[_0x0afe('0x4e')],_0x5538aa[_0x0afe('0x4b')]));if(_0x5c928c[_0x0afe('0x4e')][_0x0afe('0x58')]){_0x371017['where']=_[_0x0afe('0x56')](_0x371017[_0x0afe('0x54')],{'$or':_[_0x0afe('0x43')](_0x371017[_0x0afe('0x4f')],function(_0x8ff7){var _0x429754={};_0x429754[_0x8ff7]={'$like':'%'+_0x5c928c[_0x0afe('0x4e')][_0x0afe('0x58')]+'%'};return _0x429754;})});}_0x371017=_[_0x0afe('0x56')]({},_0x371017,_0x5c928c[_0x0afe('0x59')]);return _0x30fb20['getApplications'](_0x371017);}})[_0x0afe('0x24')](function(_0x3cfad0){if(_0x3cfad0){_0x5408da=_0x3cfad0[_0x0afe('0x60')];if(!_0x5c928c[_0x0afe('0x4e')][_0x0afe('0x50')](_0x0afe('0x51'))){_0x371017[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x5c928c[_0x0afe('0x4e')][_0x0afe('0x35')]);_0x371017[_0x0afe('0x33')]=qs['offset'](_0x5c928c['query'][_0x0afe('0x33')]);}return _0x30fb20[_0x0afe('0x8c')](_0x371017);}})['then'](function(_0x449c8f){if(_0x449c8f){return _0x449c8f?{'count':_0x5408da,'rows':_0x449c8f}:null;}})[_0x0afe('0x24')](respondWithResult(_0x5e49f7,null))[_0x0afe('0x2f')](handleError(_0x5e49f7,null));};function Extension(_0x2cb7ad,_0x4c745c,_0xbc4e18,_0x192afb){this[_0x0afe('0x8d')]=_0x0afe('0x8e');this[_0x0afe('0x8f')]=_0x2cb7ad[_0x0afe('0x90')];this['app']=_0x192afb;this[_0x0afe('0x47')]='system';this[_0x0afe('0x91')]=_0x0afe('0x92');this[_0x0afe('0x6f')]=_0x2cb7ad['id'];this[_0x0afe('0x8a')]=_0x4c745c;this[_0x0afe('0x93')]=_0xbc4e18;}function createExtensionsReciveFax(_0x3c4858){var _0x5d3e2d=0x1;var _0x6972e2=[];_0x6972e2['push'](new Extension(_0x3c4858,_0x5d3e2d,'',_0x0afe('0x94')));_0x5d3e2d+=0x1;_0x6972e2[_0x0afe('0x95')](new Extension(_0x3c4858,_0x5d3e2d,_0x0afe('0x96'),'Set'));_0x5d3e2d+=0x1;for(var _0x1d2ea6 in _0x3c4858){if(_0x3c4858[_0x0afe('0x50')](_0x1d2ea6)&&(_0x1d2ea6==='ecm'||_0x1d2ea6===_0x0afe('0x90')||_0x1d2ea6===_0x0afe('0x97')||_0x1d2ea6===_0x0afe('0x98')||_0x1d2ea6===_0x0afe('0x99')||_0x1d2ea6===_0x0afe('0x9a')||_0x1d2ea6===_0x0afe('0x9b')||_0x1d2ea6===_0x0afe('0x9c')||_0x1d2ea6===_0x0afe('0x9d'))){_0x6972e2[_0x0afe('0x95')](new Extension(_0x3c4858,_0x5d3e2d,_0x0afe('0x9e')+_0x1d2ea6+')='+_0x3c4858[_0x1d2ea6],_0x0afe('0x9f')));_0x5d3e2d+=0x1;}}_0x6972e2['push'](new Extension(_0x3c4858,_0x5d3e2d,'6',_0x0afe('0xa0')));_0x5d3e2d+=0x1;_0x6972e2[_0x0afe('0x95')](new Extension(_0x3c4858,_0x5d3e2d,_0x0afe('0xa1'),'ReceiveFax'));_0x5d3e2d=0x0;return _0x6972e2;}exports['addAccountApplications']=function(_0x46b805,_0x462d53,_0x373326){var _0x1f679b;return db['sequelize'][_0x0afe('0x82')](function(_0x249a32){return db[_0x0afe('0x44')]['create'](_0x46b805['body'],{'transaction':_0x249a32})[_0x0afe('0x24')](function(_0x154a75){_0x1f679b=_0x154a75[_0x0afe('0x3c')]({'plain':!![]});return db[_0x0afe('0xa2')]['bulkCreate'](createExtensionsReciveFax(_0x1f679b),{'transaction':_0x249a32});});})['then'](function(){return _0x1f679b;})[_0x0afe('0x24')](respondWithResult(_0x462d53,null))['catch'](handleError(_0x462d53,null));};exports[_0x0afe('0xa3')]=function(_0x1c4db7,_0x2ec82f,_0x5d5d3a){var _0x497481;return db[_0x0afe('0x81')][_0x0afe('0x82')](function(_0x363e85){return db[_0x0afe('0x44')]['update'](_0x1c4db7[_0x0afe('0x6a')],{'where':{'id':_0x1c4db7['body']['id']},'transaction':_0x363e85})[_0x0afe('0x24')](function(_0xa211d7){return db['VoiceExtension'][_0x0afe('0x3b')]({'where':{'FaxAccountId':_0x1c4db7[_0x0afe('0x6a')]['id']},'transaction':_0x363e85})[_0x0afe('0x24')](function(_0x5db90c){return db[_0x0afe('0xa2')][_0x0afe('0x88')](createExtensionsReciveFax(_[_0x0afe('0x78')](_0x1c4db7['body'],[_0x0afe('0xa4'),_0x0afe('0x48'),'createdAt','updatedAt','TrunkId','ListId'])),{'transaction':_0x363e85});});});})[_0x0afe('0x24')](function(){return db['FaxAccount']['findById'](_0x1c4db7[_0x0afe('0x6a')]['id']);})[_0x0afe('0x24')](respondWithResult(_0x2ec82f,null))['catch'](handleError(_0x2ec82f,null));};exports[_0x0afe('0xa5')]=function(_0x5234ba,_0x131b5f,_0x47c9ec){var _0x47e2fa={'raw':!![],'where':{}};var _0x2235c6={};var _0x58281e={'count':0x0,'rows':[]};return db[_0x0afe('0x44')][_0x0afe('0x86')]({'where':{'id':_0x5234ba[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x131b5f,null))[_0x0afe('0x24')](function(_0x4ed8af){if(_0x4ed8af){_0x2235c6[_0x0afe('0x49')]=_[_0x0afe('0x4a')](db[_0x0afe('0xa6')][_0x0afe('0x45')]);_0x2235c6['query']=_[_0x0afe('0x4a')](_0x5234ba[_0x0afe('0x4e')]);_0x2235c6[_0x0afe('0x4b')]=_[_0x0afe('0x4c')](_0x2235c6[_0x0afe('0x49')],_0x2235c6[_0x0afe('0x4e')]);_0x47e2fa['attributes']=_[_0x0afe('0x4c')](_0x2235c6[_0x0afe('0x49')],qs[_0x0afe('0x4d')](_0x5234ba['query'][_0x0afe('0x4d')]));_0x47e2fa[_0x0afe('0x4f')]=_0x47e2fa[_0x0afe('0x4f')][_0x0afe('0x60')]?_0x47e2fa[_0x0afe('0x4f')]:_0x2235c6[_0x0afe('0x49')];if(!_0x5234ba['query'][_0x0afe('0x50')](_0x0afe('0x51'))){_0x47e2fa[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x5234ba[_0x0afe('0x4e')][_0x0afe('0x35')]);_0x47e2fa[_0x0afe('0x33')]=qs[_0x0afe('0x33')](_0x5234ba[_0x0afe('0x4e')][_0x0afe('0x33')]);}_0x47e2fa[_0x0afe('0x52')]=qs[_0x0afe('0x53')](_0x5234ba[_0x0afe('0x4e')][_0x0afe('0x53')]);_0x47e2fa['where']=qs[_0x0afe('0x4b')](_[_0x0afe('0x55')](_0x5234ba['query'],_0x2235c6['filters']));_0x47e2fa[_0x0afe('0x54')][_0x0afe('0x6f')]=_0x4ed8af['id'];if(_0x5234ba[_0x0afe('0x4e')][_0x0afe('0x58')]){_0x47e2fa[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x47e2fa[_0x0afe('0x54')],{'$or':_['map'](_0x47e2fa[_0x0afe('0x4f')],function(_0x17f3f5){var _0x53c177={};_0x53c177[_0x17f3f5]={'$like':'%'+_0x5234ba[_0x0afe('0x4e')][_0x0afe('0x58')]+'%'};return _0x53c177;})});}if(_0x5234ba[_0x0afe('0x4e')]['$gte']){var _0x327193=_0x5234ba[_0x0afe('0x4e')][_0x0afe('0xa7')]['split'](',');var _0x819520={};_0x819520[_0x327193[0x0]]={'$gte':moment(_0x327193[0x1])[_0x0afe('0xa8')](_0x0afe('0xa9'))};_0x47e2fa[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x47e2fa[_0x0afe('0x54')],_0x819520);}_0x47e2fa=_[_0x0afe('0x56')]({},_0x47e2fa,_0x5234ba[_0x0afe('0x59')]);return db[_0x0afe('0xa6')]['count']({'where':_0x47e2fa[_0x0afe('0x54')]})[_0x0afe('0x24')](function(_0x1222b2){_0x58281e[_0x0afe('0x36')]=_0x1222b2;if(_0x5234ba[_0x0afe('0x4e')][_0x0afe('0x5a')]){_0x47e2fa[_0x0afe('0x5b')]=[{'all':!![]}];}return db['FaxMessage'][_0x0afe('0x70')](_0x47e2fa);})[_0x0afe('0x24')](function(_0x5f5200){_0x58281e['rows']=_0x5f5200;return _0x58281e;});}})[_0x0afe('0x24')](respondWithFilteredResult(_0x131b5f,_0x47e2fa))[_0x0afe('0x2f')](handleError(_0x131b5f,null));};exports['send']=function(_0x1c8dd1,_0x5c6eab,_0x301e3d){var _0x469d52,_0x523d5a={},_0x5ec724;if(_0x1c8dd1[_0x0afe('0x6a')]['to']){_0x5ec724=_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0];}return db[_0x0afe('0x44')][_0x0afe('0x61')]({'where':{'id':_0x1c8dd1[_0x0afe('0x5e')]['id']},'include':[{'model':db[_0x0afe('0xaa')],'as':_0x0afe('0xab'),'include':[{'model':db[_0x0afe('0x79')],'as':_0x0afe('0xac'),'where':{'fax':_0x5ec724},'limit':0x1,'order':[[_0x0afe('0xad'),_0x0afe('0xae')]]}]}]})[_0x0afe('0x24')](handleEntityNotFound(_0x5c6eab,null))['then'](function(_0x36afb9){_0x469d52=_0x36afb9;if(_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')]&&_0x1c8dd1['body'][_0x0afe('0xaf')][_0x0afe('0x60')]){for(var _0x51640d=0x0;_0x51640d<_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][_0x0afe('0x60')];_0x51640d+=0x1){_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][_0x51640d]={'filename':_0x1c8dd1[_0x0afe('0x6a')]['attachments'][_0x51640d][_0x0afe('0x40')],'id':_0x1c8dd1[_0x0afe('0x6a')]['attachments'][_0x51640d]['id'],'path':path[_0x0afe('0xb0')](config[_0x0afe('0xb1')],_0x0afe('0xb2'),_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][_0x51640d][_0x0afe('0xb3')])};}}return respondWithRpcPromise(_0x0afe('0xb4'),_0x0afe('0xb4'),{'FaxAccountId':_[_0x0afe('0xb5')](_0x1c8dd1['params']['id'])?undefined:_0x1c8dd1[_0x0afe('0x5e')]['id'],'path':_['isNil'](_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][0x0][_0x0afe('0x7')])?undefined:_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][0x0][_0x0afe('0x7')],'fax':_[_0x0afe('0xb5')](_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0])?undefined:_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0]},client9002);})[_0x0afe('0x24')](function(){if(_0x469d52){if(_['isNil'](_0x1c8dd1[_0x0afe('0x6a')]['from'])){_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xb6')]=util['format'](_0x0afe('0xb7'),_0x469d52[_0x0afe('0x40')],_0x469d52[_0x0afe('0xb8')]);}if(_0x469d52[_0x0afe('0xab')]){if(_0x469d52[_0x0afe('0xab')][_0x0afe('0xac')][_0x0afe('0x60')]){return _0x469d52[_0x0afe('0xab')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0x0afe('0xb9')](_0x1c8dd1['body'],{'firstName':_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0],'phone':_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0],'fax':_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0],'ListId':_0x469d52['ListId']}));}}else{throw new Error(_0x0afe('0xba'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x0afe('0x24')](function(_0x49f2db){if(_0x49f2db){return db[_0x0afe('0x77')][_0x0afe('0x61')]({'where':{'ContactId':_0x49f2db['id'],'closed':![],'FaxAccountId':_0x469d52['id']}})[_0x0afe('0x24')](function(_0xb9c230){if(_0xb9c230){return[_0xb9c230,![]];}return db[_0x0afe('0x77')][_0x0afe('0x62')]({'UserId':_0x1c8dd1[_0x0afe('0x63')]['id'],'ContactId':_0x49f2db['id'],'FaxAccountId':_0x469d52['id'],'fax':_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x0afe('0x56')](_0x1c8dd1[_0x0afe('0x6a')],{'read':![],'body':_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][0x0][_0x0afe('0xbb')],'FaxAccountId':_0x469d52['id'],'UserId':_0x1c8dd1[_0x0afe('0x63')]['id'],'ContactId':_0x49f2db['id'],'AttachmentId':_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][0x0]['id']})]},{'include':[{'model':db[_0x0afe('0xa6')],'as':_0x0afe('0xbc')}]})[_0x0afe('0x24')](function(_0x2e28c1){return[_0x2e28c1,!![]];});});}else{throw new Error(_0x0afe('0xbd'));}})['spread'](function(_0x2d30be,_0x30a42e){if(_0x30a42e){return _0x2d30be;}return db[_0x0afe('0xa6')][_0x0afe('0x62')]({'direction':_0x0afe('0xbe'),'read':![],'body':_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][0x0]['filename'],'FaxAccountId':_0x469d52['id'],'FaxInteractionId':_0x2d30be['id'],'UserId':_0x1c8dd1[_0x0afe('0x63')]['id'],'ContactId':_0x2d30be[_0x0afe('0xbf')],'AttachmentId':_0x1c8dd1['body']['attachments'][0x0]['id']})['then'](function(_0x35687f){_0x2d30be['dataValues'][_0x0afe('0xbc')]=[];_0x2d30be[_0x0afe('0xc0')][_0x0afe('0xbc')]['push'](_0x35687f[_0x0afe('0xc0')]);return _0x2d30be;});})['then'](function(_0x287273){respondWithRpcPromise(_0x0afe('0xc1'),_0x0afe('0xc1'),{'FaxAccountId':_[_0x0afe('0xb5')](_0x1c8dd1['params']['id'])?undefined:_0x1c8dd1['params']['id'],'path':_['isNil'](_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][0x0][_0x0afe('0x7')])?undefined:_0x1c8dd1[_0x0afe('0x6a')]['attachments'][0x0]['path'],'fax':_[_0x0afe('0xb5')](_0x1c8dd1['body']['to'][0x0])?undefined:_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0],'AttachmentId':_0x1c8dd1['body'][_0x0afe('0xaf')][0x0]['id']},client9002)[_0x0afe('0x24')](function(_0x46405c){logger[_0x0afe('0x25')](_0x0afe('0xc2'),_0x46405c);})[_0x0afe('0x2f')](function(_0x59ec8e){logger['info'](_0x0afe('0xc2'),_0x59ec8e);});return _0x287273;})[_0x0afe('0x24')](respondWithResult(_0x5c6eab,null))[_0x0afe('0x2f')](handleError(_0x5c6eab,null));};exports[_0x0afe('0xc3')]=function(_0x1a715f,_0xa5e398,_0xd4bbcd){return db[_0x0afe('0x44')]['find']({'where':{'id':_0x1a715f['params']['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0xa5e398,null))[_0x0afe('0x24')](function(_0x1e38c3){if(_0x1e38c3){return _0x1e38c3[_0x0afe('0xc3')](_0x1a715f[_0x0afe('0x6a')][_0x0afe('0x72')],_[_0x0afe('0x78')](_0x1a715f[_0x0afe('0x6a')],[_0x0afe('0x72'),'id'])||{})['spread'](function(_0x54b2a3){for(var _0x3e40e7=0x0;_0x3e40e7<_0x1a715f[_0x0afe('0x6a')][_0x0afe('0x72')]['length'];_0x3e40e7+=0x1){socket[_0x0afe('0xc4')](_0x0afe('0xc5'),{'UserId':Number(_0x1a715f['body'][_0x0afe('0x72')][_0x3e40e7]),'FaxAccountId':Number(_0x1a715f[_0x0afe('0x5e')]['id'])});}return _0x54b2a3;});}})['then'](respondWithResult(_0xa5e398,null))[_0x0afe('0x2f')](handleError(_0xa5e398,null));};exports[_0x0afe('0xc6')]=function(_0x2aea08,_0x74379a,_0x4924ed){return db[_0x0afe('0x44')][_0x0afe('0x61')]({'where':{'id':_0x2aea08['params']['id']}})['then'](handleEntityNotFound(_0x74379a,null))[_0x0afe('0x24')](function(_0x141193){if(_0x141193){return _0x141193['removeAgents'](_0x2aea08[_0x0afe('0x4e')][_0x0afe('0x72')])[_0x0afe('0x24')](function(){if(_['isArray'](_0x2aea08[_0x0afe('0x4e')][_0x0afe('0x72')])){for(var _0x132ad9=0x0;_0x132ad9<_0x2aea08[_0x0afe('0x4e')][_0x0afe('0x72')][_0x0afe('0x60')];_0x132ad9+=0x1){socket[_0x0afe('0xc4')](_0x0afe('0xc7'),{'UserId':Number(_0x2aea08['query'][_0x0afe('0x72')][_0x132ad9]),'FaxAccountId':Number(_0x2aea08['params']['id'])});}}else{socket[_0x0afe('0xc4')](_0x0afe('0xc7'),{'UserId':Number(_0x2aea08[_0x0afe('0x4e')][_0x0afe('0x72')]),'FaxAccountId':Number(_0x2aea08[_0x0afe('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x74379a,null))['catch'](handleError(_0x74379a,null));};exports[_0x0afe('0xc8')]=function(_0x55e99d,_0x222447,_0x2aa2ce){var _0x3ec753={};var _0x1384d6={};var _0x10ab77;var _0x44d971;return db[_0x0afe('0x44')][_0x0afe('0x86')]({'where':{'id':_0x55e99d[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x222447,null))[_0x0afe('0x24')](function(_0x8acbee){if(_0x8acbee){_0x10ab77=_0x8acbee;_0x1384d6[_0x0afe('0x49')]=_[_0x0afe('0x4a')](db[_0x0afe('0xc9')][_0x0afe('0x45')]);_0x1384d6['query']=_['keys'](_0x55e99d[_0x0afe('0x4e')]);_0x1384d6[_0x0afe('0x4b')]=_[_0x0afe('0x4c')](_0x1384d6['model'],_0x1384d6['query']);_0x3ec753['attributes']=_['intersection'](_0x1384d6['model'],qs[_0x0afe('0x4d')](_0x55e99d[_0x0afe('0x4e')]['fields']));_0x3ec753[_0x0afe('0x4f')]=_0x3ec753[_0x0afe('0x4f')][_0x0afe('0x60')]?_0x3ec753['attributes']:_0x1384d6[_0x0afe('0x49')];_0x3ec753[_0x0afe('0x52')]=qs['sort'](_0x55e99d['query'][_0x0afe('0x53')]);_0x3ec753[_0x0afe('0x54')]=qs[_0x0afe('0x4b')](_[_0x0afe('0x55')](_0x55e99d[_0x0afe('0x4e')],_0x1384d6[_0x0afe('0x4b')]));if(_0x55e99d[_0x0afe('0x4e')][_0x0afe('0x58')]){_0x3ec753[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x3ec753['where'],{'$or':_[_0x0afe('0x43')](_0x3ec753[_0x0afe('0x4f')],function(_0x333e6c){var _0x45f1e3={};_0x45f1e3[_0x333e6c]={'$like':'%'+_0x55e99d[_0x0afe('0x4e')]['filter']+'%'};return _0x45f1e3;})});}_0x3ec753=_[_0x0afe('0x56')]({},_0x3ec753,_0x55e99d[_0x0afe('0x59')]);return _0x10ab77['getAgents'](_0x3ec753);}})[_0x0afe('0x24')](function(_0x7927e3){if(_0x7927e3){_0x44d971=_0x7927e3['length'];if(!_0x55e99d[_0x0afe('0x4e')][_0x0afe('0x50')](_0x0afe('0x51'))){_0x3ec753[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x55e99d['query']['limit']);_0x3ec753[_0x0afe('0x33')]=qs[_0x0afe('0x33')](_0x55e99d['query'][_0x0afe('0x33')]);}return _0x10ab77[_0x0afe('0xc8')](_0x3ec753);}})[_0x0afe('0x24')](function(_0x123120){if(_0x123120){return _0x123120?{'count':_0x44d971,'rows':_0x123120}:null;}})[_0x0afe('0x24')](respondWithResult(_0x222447,null))[_0x0afe('0x2f')](handleError(_0x222447,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ea22267..3823399 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 _0x13a0=['setMaxListeners','save','remove','hook','exports','../../mysqldb','FaxAccount'];(function(_0x334a94,_0x26b6d1){var _0x1db170=function(_0x5ee6d8){while(--_0x5ee6d8){_0x334a94['push'](_0x334a94['shift']());}};_0x1db170(++_0x26b6d1);}(_0x13a0,0x1cc));var _0x013a=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x13a0[_0x4bb145];return _0x4db596;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x013a('0x0'))['db'][_0x013a('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x013a('0x2')](0x0);var events={'afterCreate':_0x013a('0x3'),'afterUpdate':'update','afterDestroy':_0x013a('0x4')};function emitEvent(_0x4f79c2){return function(_0x395416,_0x5025e3,_0x41c510){FaxAccountEvents['emit'](_0x4f79c2+':'+_0x395416['id'],_0x395416);FaxAccountEvents['emit'](_0x4f79c2,_0x395416);_0x41c510(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x013a('0x5')](e,emitEvent(event));}}module[_0x013a('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0xb09a=['../../mysqldb','FaxAccount','update','emit','hook','exports','events'];(function(_0x28253c,_0x1cf1b4){var _0xa357d8=function(_0x112da8){while(--_0x112da8){_0x28253c['push'](_0x28253c['shift']());}};_0xa357d8(++_0x1cf1b4);}(_0xb09a,0xe6));var _0xab09=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xb09a[_0x263a74];return _0x2aa86c;};'use strict';var EventEmitter=require(_0xab09('0x0'));var FaxAccount=require(_0xab09('0x1'))['db'][_0xab09('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xab09('0x3'),'afterDestroy':'remove'};function emitEvent(_0x418991){return function(_0x4dbb7f,_0xc186ca,_0x2fb92d){FaxAccountEvents[_0xab09('0x4')](_0x418991+':'+_0x4dbb7f['id'],_0x4dbb7f);FaxAccountEvents[_0xab09('0x4')](_0x418991,_0x4dbb7f);_0x2fb92d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xab09('0x5')](e,emitEvent(event));}}module[_0xab09('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 2aae5df..5bf29c5 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 _0xff20=['bluebird','request-promise','path','rimraf','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment'];(function(_0x38ee24,_0x56d030){var _0x2d3dc6=function(_0x64ec8a){while(--_0x64ec8a){_0x38ee24['push'](_0x38ee24['shift']());}};_0x2d3dc6(++_0x56d030);}(_0xff20,0xa4));var _0x0ff2=function(_0x25a281,_0x373839){_0x25a281=_0x25a281-0x0;var _0xc58b68=_0xff20[_0x25a281];return _0xc58b68;};'use strict';var _=require(_0x0ff2('0x0'));var util=require('util');var logger=require(_0x0ff2('0x1'))(_0x0ff2('0x2'));var moment=require(_0x0ff2('0x3'));var BPromise=require(_0x0ff2('0x4'));var rp=require(_0x0ff2('0x5'));var fs=require('fs');var path=require(_0x0ff2('0x6'));var rimraf=require(_0x0ff2('0x7'));var config=require('../../config/environment');var attributes=require(_0x0ff2('0x8'));module['exports']=function(_0xd1d2e3,_0x2a1e11){return _0xd1d2e3[_0x0ff2('0x9')](_0x0ff2('0xa'),attributes,{'tableName':_0x0ff2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde0c=['bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','util','../../config/logger','api','moment'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xde0c,0x1d0));var _0xcde0=function(_0x54b171,_0x3ba074){_0x54b171=_0x54b171-0x0;var _0x5cdb4d=_0xde0c[_0x54b171];return _0x5cdb4d;};'use strict';var _=require('lodash');var util=require(_0xcde0('0x0'));var logger=require(_0xcde0('0x1'))(_0xcde0('0x2'));var moment=require(_0xcde0('0x3'));var BPromise=require(_0xcde0('0x4'));var rp=require(_0xcde0('0x5'));var fs=require('fs');var path=require(_0xcde0('0x6'));var rimraf=require(_0xcde0('0x7'));var config=require(_0xcde0('0x8'));var attributes=require(_0xcde0('0x9'));module['exports']=function(_0x1b5b74,_0x359290){return _0x1b5b74[_0xcde0('0xa')](_0xcde0('0xb'),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 3fe2f0b..31a2c76 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 _0x0ea2=['CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','applications','list','orderBy','priority','length','create','FaxInteraction','get','autoclose','push','close','unmanaged','*,*,*,*','created','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','GetFaxAccount','FaxAccount','findAll','options','attributes','limit','map','include','model','then','NotifyFaxAccount','body','fax','describe','ValidationError','difference','keys','createdAt','updatedAt','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','from','find','account'];(function(_0x5990f8,_0x3dd2f7){var _0x1acc40=function(_0x434272){while(--_0x434272){_0x5990f8['push'](_0x5990f8['shift']());}};_0x1acc40(++_0x3dd2f7);}(_0x0ea2,0x1cd));var _0x20ea=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0x0ea2[_0x30f07a];return _0xb38461;};'use strict';var _=require(_0x20ea('0x0'));var util=require(_0x20ea('0x1'));var moment=require(_0x20ea('0x2'));var BPromise=require('bluebird');var rs=require(_0x20ea('0x3'));var fs=require('fs');var Redis=require(_0x20ea('0x4'));var db=require(_0x20ea('0x5'))['db'];var utils=require(_0x20ea('0x6'));var logger=require(_0x20ea('0x7'))('rpc');var config=require(_0x20ea('0x8'));var jayson=require(_0x20ea('0x9'));var client=jayson['client']['http']({'port':0x232c});config['redis']=_[_0x20ea('0xa')](config[_0x20ea('0xb')],{'host':_0x20ea('0xc'),'port':0x18eb});var socket=require(_0x20ea('0xd'))(new Redis(config[_0x20ea('0xb')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3b4b9e,_0x54ce09,_0xeb066c){return new BPromise(function(_0x4a361e,_0xddf264){return client['request'](_0x3b4b9e,_0xeb066c)['then'](function(_0x348079){logger['info'](_0x20ea('0xe'),_0x54ce09,'request\x20sent');logger[_0x20ea('0xf')](_0x20ea('0x10'),_0x54ce09,'request\x20sent',JSON[_0x20ea('0x11')](_0x348079));if(_0x348079[_0x20ea('0x12')]){if(_0x348079[_0x20ea('0x12')][_0x20ea('0x13')]===0x1f4){logger[_0x20ea('0x12')](_0x20ea('0xe'),_0x54ce09,_0x348079[_0x20ea('0x12')][_0x20ea('0x14')]);return _0xddf264(_0x348079[_0x20ea('0x12')][_0x20ea('0x14')]);}logger[_0x20ea('0x12')](_0x20ea('0xe'),_0x54ce09,_0x348079[_0x20ea('0x12')][_0x20ea('0x14')]);return _0x4a361e(_0x348079[_0x20ea('0x12')][_0x20ea('0x14')]);}else{logger[_0x20ea('0x15')](_0x20ea('0xe'),_0x54ce09,_0x20ea('0x16'));_0x4a361e(_0x348079[_0x20ea('0x17')][_0x20ea('0x14')]);}})[_0x20ea('0x18')](function(_0x15bd27){logger[_0x20ea('0x12')](_0x20ea('0xe'),_0x54ce09,_0x15bd27);_0xddf264(_0x15bd27);});});}exports[_0x20ea('0x19')]=function(_0x2cd496){var _0x173f73=this;return new Promise(function(_0x1f0a47,_0x22e976){return db[_0x20ea('0x1a')][_0x20ea('0x1b')]({'raw':_0x2cd496[_0x20ea('0x1c')]?_0x2cd496[_0x20ea('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2cd496[_0x20ea('0x1c')]?_0x2cd496[_0x20ea('0x1c')]['where']||null:null,'attributes':_0x2cd496[_0x20ea('0x1c')]?_0x2cd496[_0x20ea('0x1c')][_0x20ea('0x1d')]||null:null,'limit':_0x2cd496[_0x20ea('0x1c')]?_0x2cd496[_0x20ea('0x1c')][_0x20ea('0x1e')]||null:null,'include':_0x2cd496[_0x20ea('0x1c')]?_0x2cd496['options']['include']?_[_0x20ea('0x1f')](_0x2cd496[_0x20ea('0x1c')][_0x20ea('0x20')],function(_0x1d7343){return{'model':db[_0x1d7343['model']],'as':_0x1d7343['as'],'attributes':_0x1d7343[_0x20ea('0x1d')],'include':_0x1d7343[_0x20ea('0x20')]?_[_0x20ea('0x1f')](_0x1d7343[_0x20ea('0x20')],function(_0x1ad69a){return{'model':db[_0x1ad69a[_0x20ea('0x21')]],'as':_0x1ad69a['as'],'attributes':_0x1ad69a['attributes'],'include':_0x1ad69a[_0x20ea('0x20')]?_[_0x20ea('0x1f')](_0x1ad69a['include'],function(_0x2497f5){return{'model':db[_0x2497f5[_0x20ea('0x21')]],'as':_0x2497f5['as'],'attributes':_0x2497f5['attributes']};}):[]};}):[]};}):[]:[]})[_0x20ea('0x22')](function(_0x56575c){logger[_0x20ea('0x15')](_0x20ea('0x19'),_0x2cd496);logger[_0x20ea('0xf')](_0x20ea('0x19'),_0x2cd496,JSON[_0x20ea('0x11')](_0x56575c));_0x1f0a47(_0x56575c);})[_0x20ea('0x18')](function(_0x17982b){logger[_0x20ea('0x12')](_0x20ea('0x19'),_0x17982b[_0x20ea('0x14')],_0x2cd496);_0x22e976(_0x173f73[_0x20ea('0x12')](0x1f4,_0x17982b[_0x20ea('0x14')]));});});};exports[_0x20ea('0x23')]=function(_0x3b0fcf,_0x3c7743,_0x565a43){var _0x2c8296=this;return new Promise(function(_0x377569,_0x3b8c60){var _0x1619cf={'body':_0x3b0fcf[_0x20ea('0x24')],'channel':_0x20ea('0x25')};var _0x545078=[];var _0x4ea154=[];var _0x4bdced={};return db['CmContact'][_0x20ea('0x26')]()['then'](function(_0x3ff2f5){if(!_0x3ff2f5){throw new db['Sequelize'][(_0x20ea('0x27'))]('no\x20available\x20attributes');}_0x545078=_[_0x20ea('0x28')](_['keys'](_0x3ff2f5),['createdAt','updatedAt']);_0x4ea154=_[_0x20ea('0x28')](_[_0x20ea('0x29')](_0x3ff2f5),[_0x20ea('0x2a'),_0x20ea('0x2b'),'CompanyId',_0x20ea('0x2c')]);if(_0x3b0fcf['body']['id']){delete _0x3b0fcf['body']['id'];}if(_[_0x20ea('0x2d')](_0x3b0fcf[_0x20ea('0x24')]['from'])){throw new db[(_0x20ea('0x2e'))][(_0x20ea('0x27'))](_0x20ea('0x2f'));}if(_[_0x20ea('0x2d')](_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x24')])||_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x24')]===''){throw new db[(_0x20ea('0x2e'))][(_0x20ea('0x27'))](_0x20ea('0x30'));}if(_['isNil'](_0x3b0fcf[_0x20ea('0x24')]['mapKey'])){throw new db['Sequelize'][(_0x20ea('0x27'))](_0x20ea('0x31')+_0x4ea154);}if(!_[_0x20ea('0x32')](_0x4ea154,_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x33')])){throw new db[(_0x20ea('0x2e'))][(_0x20ea('0x27'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ea154);}_0x4bdced[_0x3b0fcf[_0x20ea('0x24')]['mapKey']]=_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x34')];})[_0x20ea('0x22')](function(){return db[_0x20ea('0x1a')][_0x20ea('0x35')]({'where':{'id':_0x3b0fcf[_0x20ea('0x36')]['id']},'include':[{'model':db[_0x20ea('0x37')],'as':_0x20ea('0x38'),'include':[{'model':db[_0x20ea('0x39')],'as':_0x20ea('0x3a'),'where':_0x4bdced,'limit':0x1,'order':[['updatedAt',_0x20ea('0x3b')]]}]},{'model':db[_0x20ea('0x3c')],'as':_0x20ea('0x3d')}]});})['then'](function(_0x790d83){if(_0x790d83&&_0x790d83[_0x20ea('0x38')]){var _0x2677a2=_0x790d83['get']({'plain':!![]});_0x1619cf[_0x20ea('0x36')]=_0x2677a2;_0x1619cf[_0x20ea('0x3e')]=_0x2677a2['Applications'];_0x1619cf[_0x20ea('0x3f')]=_0x2677a2[_0x20ea('0x38')];_0x1619cf[_0x20ea('0x3e')]=_[_0x20ea('0x40')](_0x1619cf[_0x20ea('0x3e')],[_0x20ea('0x41')],['asc']);if(_0x1619cf[_0x20ea('0x36')][_0x20ea('0x3d')]){delete _0x1619cf['account'][_0x20ea('0x3d')];}if(_0x1619cf[_0x20ea('0x36')]['List']&&_0x1619cf[_0x20ea('0x36')][_0x20ea('0x38')][_0x20ea('0x3a')][_0x20ea('0x42')]){return _0x1619cf['account'][_0x20ea('0x38')]['Contacts'][0x0];}var _0x592587=_['defaults'](_0x3b0fcf[_0x20ea('0x24')],{'firstName':_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x34')],'ListId':_0x2677a2[_0x20ea('0x2c')]});_0x592587[_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x33')]]=_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x34')];return db['CmContact'][_0x20ea('0x43')](_0x592587,{'fields':_0x545078,'raw':!![]});}})[_0x20ea('0x22')](function(_0x1bbab9){_0x1619cf['contact']=_0x1bbab9;if(_0x1bbab9){var _0x3775c1={'ContactId':_0x1bbab9['id'],'FaxAccountId':_0x3b0fcf['account']['id'],'fax':_0x1bbab9[_0x20ea('0x25')]};return db[_0x20ea('0x44')][_0x20ea('0x35')]({'where':{'ContactId':_0x1bbab9['id'],'closed':![],'FaxAccountId':_0x3b0fcf[_0x20ea('0x36')]['id']}})['then'](function(_0x3ab74e){if(_0x3ab74e){return[_0x3ab74e,![]];}return db['FaxInteraction'][_0x20ea('0x43')](_0x3775c1)[_0x20ea('0x22')](function(_0x47ae01){return[_0x47ae01,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x23c46f,_0xc4e593){var _0x397ebe=_0x23c46f[_0x20ea('0x45')]({'plain':!![]});if(_0xc4e593){if(_0x1619cf[_0x20ea('0x36')][_0x20ea('0x46')]){_0x1619cf[_0x20ea('0x3e')][_0x20ea('0x47')]({'id':0x0,'priority':_0x1619cf[_0x20ea('0x3e')][_0x20ea('0x42')]+0x1,'app':_0x20ea('0x48'),'appdata':_0x20ea('0x49'),'interval':_0x20ea('0x4a')});}_0x397ebe[_0x20ea('0x4b')]=!![];}else{_0x397ebe[_0x20ea('0x4b')]=![];}_0x1619cf['interaction']=_0x397ebe;return db['FaxMessage'][_0x20ea('0x43')]({'body':_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x24')],'FaxAccountId':_0x3b0fcf['account']['id'],'FaxInteractionId':_0x23c46f['id'],'direction':'in','ContactId':_0x23c46f['ContactId'],'AttachmentId':_0x3b0fcf['body'][_0x20ea('0x4c')]});})[_0x20ea('0x22')](function(_0x1cba5e){_0x1619cf[_0x20ea('0x14')]=_0x1cba5e;if(_0x1619cf[_0x20ea('0x4d')][_0x20ea('0x4e')]){return db[_0x20ea('0x4f')]['find']({'attributes':['id',_0x20ea('0x50')],'where':{'id':_0x1619cf[_0x20ea('0x4d')][_0x20ea('0x4e')]}})[_0x20ea('0x22')](function(_0x21280d){if(_0x21280d){_0x1619cf[_0x20ea('0x3e')][_0x20ea('0x51')]({'id':0x0,'priority':0x0,'app':_0x20ea('0x52'),'appdata':_0x21280d['name']+','+(_0x1619cf[_0x20ea('0x36')][_0x20ea('0x53')]||0xa),'interval':_0x20ea('0x4a')});}return respondWithRpcPromise('Start',_0x20ea('0x54'),_0x1619cf);});}return respondWithRpcPromise(_0x20ea('0x55'),_0x20ea('0x54'),_0x1619cf);})['then'](function(_0x1f6abb){_0x377569(_0x1f6abb);})[_0x20ea('0x18')](function(_0x21d199){_0x3b8c60(_0x2c8296[_0x20ea('0x12')](0x1f4,_0x21d199[_0x20ea('0x14')]));});});}; \ No newline at end of file +var _0x54ab=['http','redis','defaults','localhost','./faxAccount.socket','register','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','FaxAccount','findAll','options','raw','where','attributes','include','map','model','then','GetFaxAccount','stringify','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','DESC','FaxApplication','get','Applications','list','applications','orderBy','priority','Contacts','length','create','FaxInteraction','Contact\x20not\x20found','push','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x48f827,_0x269e8d){var _0xc763f7=function(_0x19769a){while(--_0x19769a){_0x48f827['push'](_0x48f827['shift']());}};_0xc763f7(++_0x269e8d);}(_0x54ab,0x100));var _0xb54a=function(_0x56e6bd,_0x50e7e0){_0x56e6bd=_0x56e6bd-0x0;var _0x38c4a9=_0x54ab[_0x56e6bd];return _0x38c4a9;};'use strict';var _=require('lodash');var util=require(_0xb54a('0x0'));var moment=require(_0xb54a('0x1'));var BPromise=require(_0xb54a('0x2'));var rs=require(_0xb54a('0x3'));var fs=require('fs');var Redis=require(_0xb54a('0x4'));var db=require(_0xb54a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb54a('0x6'))(_0xb54a('0x7'));var config=require(_0xb54a('0x8'));var jayson=require(_0xb54a('0x9'));var client=jayson[_0xb54a('0xa')][_0xb54a('0xb')]({'port':0x232c});config[_0xb54a('0xc')]=_[_0xb54a('0xd')](config[_0xb54a('0xc')],{'host':_0xb54a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb54a('0xf'))[_0xb54a('0x10')](socket);function respondWithRpcPromise(_0x3c4988,_0x5947c4,_0x5b55f8){return new BPromise(function(_0x5d2ea4,_0x208303){return client['request'](_0x3c4988,_0x5b55f8)['then'](function(_0x536cd8){logger[_0xb54a('0x11')](_0xb54a('0x12'),_0x5947c4,'request\x20sent');logger[_0xb54a('0x13')](_0xb54a('0x14'),_0x5947c4,_0xb54a('0x15'),JSON['stringify'](_0x536cd8));if(_0x536cd8[_0xb54a('0x16')]){if(_0x536cd8[_0xb54a('0x16')][_0xb54a('0x17')]===0x1f4){logger[_0xb54a('0x16')](_0xb54a('0x12'),_0x5947c4,_0x536cd8[_0xb54a('0x16')]['message']);return _0x208303(_0x536cd8['error']['message']);}logger[_0xb54a('0x16')]('FaxAccount,\x20%s,\x20%s',_0x5947c4,_0x536cd8[_0xb54a('0x16')]['message']);return _0x5d2ea4(_0x536cd8[_0xb54a('0x16')][_0xb54a('0x18')]);}else{logger[_0xb54a('0x11')](_0xb54a('0x12'),_0x5947c4,_0xb54a('0x15'));_0x5d2ea4(_0x536cd8['result'][_0xb54a('0x18')]);}})[_0xb54a('0x19')](function(_0x531ce3){logger['error'](_0xb54a('0x12'),_0x5947c4,_0x531ce3);_0x208303(_0x531ce3);});});}exports['GetFaxAccount']=function(_0x208c78){var _0x1f47ad=this;return new Promise(function(_0x1efb5d,_0xdf9065){return db[_0xb54a('0x1a')][_0xb54a('0x1b')]({'raw':_0x208c78['options']?_0x208c78[_0xb54a('0x1c')][_0xb54a('0x1d')]===undefined?!![]:![]:!![],'where':_0x208c78[_0xb54a('0x1c')]?_0x208c78[_0xb54a('0x1c')][_0xb54a('0x1e')]||null:null,'attributes':_0x208c78[_0xb54a('0x1c')]?_0x208c78['options'][_0xb54a('0x1f')]||null:null,'limit':_0x208c78[_0xb54a('0x1c')]?_0x208c78[_0xb54a('0x1c')]['limit']||null:null,'include':_0x208c78[_0xb54a('0x1c')]?_0x208c78[_0xb54a('0x1c')][_0xb54a('0x20')]?_[_0xb54a('0x21')](_0x208c78[_0xb54a('0x1c')][_0xb54a('0x20')],function(_0x4e46c0){return{'model':db[_0x4e46c0[_0xb54a('0x22')]],'as':_0x4e46c0['as'],'attributes':_0x4e46c0[_0xb54a('0x1f')],'include':_0x4e46c0[_0xb54a('0x20')]?_[_0xb54a('0x21')](_0x4e46c0[_0xb54a('0x20')],function(_0xfda701){return{'model':db[_0xfda701[_0xb54a('0x22')]],'as':_0xfda701['as'],'attributes':_0xfda701[_0xb54a('0x1f')],'include':_0xfda701[_0xb54a('0x20')]?_['map'](_0xfda701[_0xb54a('0x20')],function(_0xb752db){return{'model':db[_0xb752db[_0xb54a('0x22')]],'as':_0xb752db['as'],'attributes':_0xb752db[_0xb54a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb54a('0x23')](function(_0x515c87){logger[_0xb54a('0x11')](_0xb54a('0x24'),_0x208c78);logger[_0xb54a('0x13')](_0xb54a('0x24'),_0x208c78,JSON[_0xb54a('0x25')](_0x515c87));_0x1efb5d(_0x515c87);})[_0xb54a('0x19')](function(_0x2986fa){logger[_0xb54a('0x16')](_0xb54a('0x24'),_0x2986fa[_0xb54a('0x18')],_0x208c78);_0xdf9065(_0x1f47ad[_0xb54a('0x16')](0x1f4,_0x2986fa[_0xb54a('0x18')]));});});};exports[_0xb54a('0x26')]=function(_0x5a25f7,_0x10d326,_0x3e4485){var _0x2daae2=this;return new Promise(function(_0x199b1a,_0x15716c){var _0x5c876a={'body':_0x5a25f7['body'],'channel':_0xb54a('0x27')};var _0x1bdaf0=[];var _0x581d15=[];var _0x389daa={};return db[_0xb54a('0x28')][_0xb54a('0x29')]()[_0xb54a('0x23')](function(_0x2dec87){if(!_0x2dec87){throw new db[(_0xb54a('0x2a'))][(_0xb54a('0x2b'))]('no\x20available\x20attributes');}_0x1bdaf0=_[_0xb54a('0x2c')](_[_0xb54a('0x2d')](_0x2dec87),[_0xb54a('0x2e'),_0xb54a('0x2f')]);_0x581d15=_[_0xb54a('0x2c')](_[_0xb54a('0x2d')](_0x2dec87),[_0xb54a('0x2e'),_0xb54a('0x2f'),_0xb54a('0x30'),_0xb54a('0x31')]);if(_0x5a25f7[_0xb54a('0x32')]['id']){delete _0x5a25f7[_0xb54a('0x32')]['id'];}if(_[_0xb54a('0x33')](_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x34')])){throw new db['Sequelize'][(_0xb54a('0x2b'))](_0xb54a('0x35'));}if(_[_0xb54a('0x33')](_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x32')])||_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x32')]===''){throw new db[(_0xb54a('0x2a'))][(_0xb54a('0x2b'))](_0xb54a('0x36'));}if(_[_0xb54a('0x33')](_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x37')])){throw new db['Sequelize'][(_0xb54a('0x2b'))](_0xb54a('0x38')+_0x581d15);}if(!_[_0xb54a('0x39')](_0x581d15,_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x37')])){throw new db[(_0xb54a('0x2a'))]['ValidationError'](_0xb54a('0x3a')+_0x581d15);}_0x389daa[_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x37')]]=_0x5a25f7[_0xb54a('0x32')]['from'];})[_0xb54a('0x23')](function(){return db['FaxAccount'][_0xb54a('0x3b')]({'where':{'id':_0x5a25f7[_0xb54a('0x3c')]['id']},'include':[{'model':db['CmList'],'as':_0xb54a('0x3d'),'include':[{'model':db[_0xb54a('0x28')],'as':'Contacts','where':_0x389daa,'limit':0x1,'order':[[_0xb54a('0x2f'),_0xb54a('0x3e')]]}]},{'model':db[_0xb54a('0x3f')],'as':'Applications'}]});})[_0xb54a('0x23')](function(_0x283633){if(_0x283633&&_0x283633[_0xb54a('0x3d')]){var _0x559a3a=_0x283633[_0xb54a('0x40')]({'plain':!![]});_0x5c876a['account']=_0x559a3a;_0x5c876a['applications']=_0x559a3a[_0xb54a('0x41')];_0x5c876a[_0xb54a('0x42')]=_0x559a3a[_0xb54a('0x3d')];_0x5c876a[_0xb54a('0x43')]=_[_0xb54a('0x44')](_0x5c876a[_0xb54a('0x43')],[_0xb54a('0x45')],['asc']);if(_0x5c876a[_0xb54a('0x3c')][_0xb54a('0x41')]){delete _0x5c876a[_0xb54a('0x3c')][_0xb54a('0x41')];}if(_0x5c876a[_0xb54a('0x3c')][_0xb54a('0x3d')]&&_0x5c876a[_0xb54a('0x3c')][_0xb54a('0x3d')][_0xb54a('0x46')][_0xb54a('0x47')]){return _0x5c876a[_0xb54a('0x3c')][_0xb54a('0x3d')][_0xb54a('0x46')][0x0];}var _0x4139ce=_['defaults'](_0x5a25f7[_0xb54a('0x32')],{'firstName':_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x34')],'ListId':_0x559a3a['ListId']});_0x4139ce[_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x37')]]=_0x5a25f7[_0xb54a('0x32')]['from'];return db[_0xb54a('0x28')][_0xb54a('0x48')](_0x4139ce,{'fields':_0x1bdaf0,'raw':!![]});}})[_0xb54a('0x23')](function(_0x2b593a){_0x5c876a['contact']=_0x2b593a;if(_0x2b593a){var _0x3e9c94={'ContactId':_0x2b593a['id'],'FaxAccountId':_0x5a25f7[_0xb54a('0x3c')]['id'],'fax':_0x2b593a[_0xb54a('0x27')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x2b593a['id'],'closed':![],'FaxAccountId':_0x5a25f7['account']['id']}})[_0xb54a('0x23')](function(_0x2fa909){if(_0x2fa909){return[_0x2fa909,![]];}return db[_0xb54a('0x49')]['create'](_0x3e9c94)[_0xb54a('0x23')](function(_0x310ca6){return[_0x310ca6,!![]];});});}else{throw new Error(_0xb54a('0x4a'));}})['spread'](function(_0x586ccd,_0x52d2d3){var _0x75cec1=_0x586ccd['get']({'plain':!![]});if(_0x52d2d3){if(_0x5c876a[_0xb54a('0x3c')]['autoclose']){_0x5c876a[_0xb54a('0x43')][_0xb54a('0x4b')]({'id':0x0,'priority':_0x5c876a[_0xb54a('0x43')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0xb54a('0x4c')});}_0x75cec1['created']=!![];}else{_0x75cec1[_0xb54a('0x4d')]=![];}_0x5c876a[_0xb54a('0x4e')]=_0x75cec1;return db[_0xb54a('0x4f')]['create']({'body':_0x5a25f7[_0xb54a('0x32')]['body'],'FaxAccountId':_0x5a25f7[_0xb54a('0x3c')]['id'],'FaxInteractionId':_0x586ccd['id'],'direction':'in','ContactId':_0x586ccd['ContactId'],'AttachmentId':_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x50')]});})[_0xb54a('0x23')](function(_0x566bbe){_0x5c876a[_0xb54a('0x18')]=_0x566bbe;if(_0x5c876a[_0xb54a('0x4e')][_0xb54a('0x51')]){return db[_0xb54a('0x52')][_0xb54a('0x3b')]({'attributes':['id',_0xb54a('0x53')],'where':{'id':_0x5c876a[_0xb54a('0x4e')][_0xb54a('0x51')]}})[_0xb54a('0x23')](function(_0x46a9b4){if(_0x46a9b4){_0x5c876a[_0xb54a('0x43')][_0xb54a('0x54')]({'id':0x0,'priority':0x0,'app':_0xb54a('0x55'),'appdata':_0x46a9b4[_0xb54a('0x53')]+','+(_0x5c876a['account'][_0xb54a('0x56')]||0xa),'interval':_0xb54a('0x4c')});}return respondWithRpcPromise(_0xb54a('0x57'),_0xb54a('0x58'),_0x5c876a);});}return respondWithRpcPromise(_0xb54a('0x57'),_0xb54a('0x58'),_0x5c876a);})[_0xb54a('0x23')](function(_0x1a59ab){_0x199b1a(_0x1a59ab);})[_0xb54a('0x19')](function(_0x2da066){_0x15716c(_0x2daae2['error'](0x1f4,_0x2da066['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index beed556..a536077 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 _0x45de=['remove','removeListener','register','length','faxAccount:','save'];(function(_0x442b4a,_0x5a8588){var _0x45a995=function(_0x5bacf1){while(--_0x5bacf1){_0x442b4a['push'](_0x442b4a['shift']());}};_0x45a995(++_0x5a8588);}(_0x45de,0x1a3));var _0xe45d=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x45de[_0x1694f5];return _0x5b4321;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xe45d('0x0'),_0xe45d('0x1'),'update'];function createListener(_0x151061,_0x14305e){return function(_0x41c23a){_0x14305e['emit'](_0x151061,_0x41c23a);};}function removeListener(_0x12bc47,_0x3b65b9){return function(){FaxAccountEvents[_0xe45d('0x2')](_0x12bc47,_0x3b65b9);};}exports[_0xe45d('0x3')]=function(_0x5ba1a7){for(var _0x14179c=0x0,_0x2eb45e=events[_0xe45d('0x4')];_0x14179c<_0x2eb45e;_0x14179c++){var _0x4b1944=events[_0x14179c];var _0x29c029=createListener(_0xe45d('0x5')+_0x4b1944,_0x5ba1a7);FaxAccountEvents['on'](_0x4b1944,_0x29c029);}}; \ No newline at end of file +var _0x6710=['faxAccount:','remove','emit','removeListener','register','length'];(function(_0x45099a,_0x274cd8){var _0x339c5d=function(_0x3cbc00){while(--_0x3cbc00){_0x45099a['push'](_0x45099a['shift']());}};_0x339c5d(++_0x274cd8);}(_0x6710,0x11b));var _0x0671=function(_0x59a68f,_0x410d07){_0x59a68f=_0x59a68f-0x0;var _0x3aff41=_0x6710[_0x59a68f];return _0x3aff41;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0x0671('0x0'),'update'];function createListener(_0x290f68,_0x2796ae){return function(_0x1e938c){_0x2796ae[_0x0671('0x1')](_0x290f68,_0x1e938c);};}function removeListener(_0x1a9811,_0x2e1a23){return function(){FaxAccountEvents[_0x0671('0x2')](_0x1a9811,_0x2e1a23);};}exports[_0x0671('0x3')]=function(_0x32b3a7){for(var _0x2551cf=0x0,_0x2f697e=events[_0x0671('0x4')];_0x2551cf<_0x2f697e;_0x2551cf++){var _0x245695=events[_0x2551cf];var _0x3f3352=createListener(_0x0671('0x5')+_0x245695,_0x32b3a7);FaxAccountEvents['on'](_0x245695,_0x3f3352);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index ef4f4ed..6e68d9f 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x3b74d1,_0x478b4b){var _0xdf01d6=function(_0x8b09a0){while(--_0x8b09a0){_0x3b74d1['push'](_0x3b74d1['shift']());}};_0xdf01d6(++_0x478b4b);}(_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['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5d2157,_0x660c95){var _0x2a74da=function(_0x59501f){while(--_0x59501f){_0x5d2157['push'](_0x5d2157['shift']());}};_0x2a74da(++_0x660c95);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 24d157e..8f3a84d 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 _0x8257=['noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x3177d9,_0x557123){var _0xdc6884=function(_0x40ea5f){while(--_0x40ea5f){_0x3177d9['push'](_0x3177d9['shift']());}};_0xdc6884(++_0x557123);}(_0x8257,0xda));var _0x7825=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0x8257[_0x205e5a];return _0x10da58;};'use strict';var Sequelize=require(_0x7825('0x0'));module[_0x7825('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7825('0x2')},'appdata':{'type':Sequelize[_0x7825('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7825('0x4')}}; \ No newline at end of file +var _0x184e=['INTEGER','STRING','noop','sequelize','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x184e,0x16b));var _0xe184=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x184e[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0xe184('0x0'));module[_0xe184('0x1')]={'priority':{'type':Sequelize[_0xe184('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe184('0x3')],'allowNull':![],'defaultValue':_0xe184('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe184('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 0b02b27..dfeb30b 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 _0xab77=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','type','key','model','map','query'];(function(_0x31c042,_0x1db4d6){var _0x51f7ad=function(_0x4358d7){while(--_0x4358d7){_0x31c042['push'](_0x31c042['shift']());}};_0x51f7ad(++_0x1db4d6);}(_0xab77,0x18e));var _0x7ab7=function(_0x486338,_0x2ab3f9){_0x486338=_0x486338-0x0;var _0x4c8298=_0xab77[_0x486338];return _0x4c8298;};'use strict';var emlformat=require(_0x7ab7('0x0'));var rimraf=require(_0x7ab7('0x1'));var zipdir=require(_0x7ab7('0x2'));var jsonpatch=require(_0x7ab7('0x3'));var rp=require(_0x7ab7('0x4'));var moment=require(_0x7ab7('0x5'));var BPromise=require(_0x7ab7('0x6'));var Mustache=require(_0x7ab7('0x7'));var util=require(_0x7ab7('0x8'));var path=require(_0x7ab7('0x9'));var sox=require(_0x7ab7('0xa'));var csv=require('to-csv');var ejs=require(_0x7ab7('0xb'));var fs=require('fs');var fs_extra=require(_0x7ab7('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7ab7('0xd'));var jsforce=require(_0x7ab7('0xe'));var deskjs=require(_0x7ab7('0xf'));var toCsv=require(_0x7ab7('0x10'));var querystring=require('querystring');var Papa=require(_0x7ab7('0x11'));var Redis=require('ioredis');var authService=require(_0x7ab7('0x12'));var qs=require(_0x7ab7('0x13'));var as=require(_0x7ab7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7ab7('0x15'));var config=require(_0x7ab7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ab7('0x17'))['db'];function respondWithStatusCode(_0x1e1f4c,_0x5dab84){_0x5dab84=_0x5dab84||0xcc;return function(_0x579396){if(_0x579396){return _0x1e1f4c[_0x7ab7('0x18')](_0x5dab84);}return _0x1e1f4c[_0x7ab7('0x19')](_0x5dab84)[_0x7ab7('0x1a')]();};}function respondWithResult(_0x16e024,_0x32b07f){_0x32b07f=_0x32b07f||0xc8;return function(_0x3c1e23){if(_0x3c1e23){return _0x16e024[_0x7ab7('0x19')](_0x32b07f)['json'](_0x3c1e23);}};}function respondWithFilteredResult(_0x5d07fc,_0x5d55e5){return function(_0x1c1ee6){if(_0x1c1ee6){var _0x4f2c6c=typeof _0x5d55e5[_0x7ab7('0x1b')]===_0x7ab7('0x1c')&&typeof _0x5d55e5[_0x7ab7('0x1d')]===_0x7ab7('0x1c');var _0x306594=_0x1c1ee6['count'];var _0x4efa25=_0x4f2c6c?0x0:_0x5d55e5[_0x7ab7('0x1b')];var _0x1f52a0=_0x4f2c6c?_0x1c1ee6[_0x7ab7('0x1e')]:_0x5d55e5['offset']+_0x5d55e5['limit'];var _0x315586;if(_0x1f52a0>=_0x306594){_0x1f52a0=_0x306594;_0x315586=0xc8;}else{_0x315586=0xce;}_0x5d07fc[_0x7ab7('0x19')](_0x315586);return _0x5d07fc[_0x7ab7('0x1f')](_0x7ab7('0x20'),_0x4efa25+'-'+_0x1f52a0+'/'+_0x306594)[_0x7ab7('0x21')](_0x1c1ee6);}return null;};}function patchUpdates(_0x1faf11){return function(_0x4be921){try{jsonpatch[_0x7ab7('0x22')](_0x4be921,_0x1faf11,!![]);}catch(_0x5429a8){return BPromise[_0x7ab7('0x23')](_0x5429a8);}return _0x4be921[_0x7ab7('0x24')]();};}function saveUpdates(_0x543091,_0x23b1d9){return function(_0x5810c1){if(_0x5810c1){return _0x5810c1[_0x7ab7('0x25')](_0x543091)[_0x7ab7('0x26')](function(_0x6abfd1){return _0x6abfd1;});}return null;};}function removeEntity(_0xbe341b,_0x4b6be8){return function(_0x253a1d){if(_0x253a1d){return _0x253a1d[_0x7ab7('0x27')]()[_0x7ab7('0x26')](function(){_0xbe341b[_0x7ab7('0x19')](0xcc)[_0x7ab7('0x1a')]();});}};}function handleEntityNotFound(_0x15556b,_0x2f2d03){return function(_0x38a36b){if(!_0x38a36b){_0x15556b[_0x7ab7('0x18')](0x194);}return _0x38a36b;};}function handleError(_0x4db98f,_0x33b8d9){_0x33b8d9=_0x33b8d9||0x1f4;return function(_0x425116){logger[_0x7ab7('0x28')](_0x425116[_0x7ab7('0x29')]);if(_0x425116[_0x7ab7('0x2a')]){delete _0x425116['name'];}_0x4db98f['status'](_0x33b8d9)[_0x7ab7('0x2b')](_0x425116);};}exports[_0x7ab7('0x2c')]=function(_0x265934,_0x8a7aad){var _0xe12148={},_0x2aba6e={},_0x3d42b4={'count':0x0,'rows':[]};var _0x3c3d54=_['map'](db[_0x7ab7('0x2d')][_0x7ab7('0x2e')],function(_0x117b17){return{'name':_0x117b17['fieldName'],'type':_0x117b17[_0x7ab7('0x2f')][_0x7ab7('0x30')]};});_0x2aba6e[_0x7ab7('0x31')]=_[_0x7ab7('0x32')](_0x3c3d54,_0x7ab7('0x2a'));_0x2aba6e[_0x7ab7('0x33')]=_[_0x7ab7('0x34')](_0x265934[_0x7ab7('0x33')]);_0x2aba6e[_0x7ab7('0x35')]=_[_0x7ab7('0x36')](_0x2aba6e['model'],_0x2aba6e[_0x7ab7('0x33')]);_0xe12148[_0x7ab7('0x37')]=_[_0x7ab7('0x36')](_0x2aba6e[_0x7ab7('0x31')],qs[_0x7ab7('0x38')](_0x265934[_0x7ab7('0x33')][_0x7ab7('0x38')]));_0xe12148[_0x7ab7('0x37')]=_0xe12148['attributes'][_0x7ab7('0x39')]?_0xe12148[_0x7ab7('0x37')]:_0x2aba6e['model'];if(!_0x265934[_0x7ab7('0x33')][_0x7ab7('0x3a')]('nolimit')){_0xe12148['limit']=qs[_0x7ab7('0x1d')](_0x265934[_0x7ab7('0x33')]['limit']);_0xe12148['offset']=qs[_0x7ab7('0x1b')](_0x265934[_0x7ab7('0x33')][_0x7ab7('0x1b')]);}_0xe12148[_0x7ab7('0x3b')]=qs[_0x7ab7('0x3c')](_0x265934[_0x7ab7('0x33')][_0x7ab7('0x3c')]);_0xe12148[_0x7ab7('0x3d')]=qs[_0x7ab7('0x35')](_['pick'](_0x265934[_0x7ab7('0x33')],_0x2aba6e[_0x7ab7('0x35')]),_0x3c3d54);if(_0x265934[_0x7ab7('0x33')]['filter']){_0xe12148[_0x7ab7('0x3d')]=_[_0x7ab7('0x3e')](_0xe12148[_0x7ab7('0x3d')],{'$or':_['map'](_0x3c3d54,function(_0x51f14d){if(_0x51f14d['type']!=='VIRTUAL'){var _0x4ed123={};_0x4ed123[_0x51f14d['name']]={'$like':'%'+_0x265934[_0x7ab7('0x33')][_0x7ab7('0x3f')]+'%'};return _0x4ed123;}})});}_0xe12148=_[_0x7ab7('0x3e')]({},_0xe12148,_0x265934['options']);var _0x3bb0df={'where':_0xe12148[_0x7ab7('0x3d')]};return db[_0x7ab7('0x2d')][_0x7ab7('0x1e')](_0x3bb0df)[_0x7ab7('0x26')](function(_0x1227f1){_0x3d42b4[_0x7ab7('0x1e')]=_0x1227f1;if(_0x265934[_0x7ab7('0x33')]['includeAll']){_0xe12148[_0x7ab7('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0x7ab7('0x41')](_0xe12148);})['then'](function(_0x24550a){_0x3d42b4[_0x7ab7('0x42')]=_0x24550a;return _0x3d42b4;})[_0x7ab7('0x26')](respondWithFilteredResult(_0x8a7aad,_0xe12148))[_0x7ab7('0x43')](handleError(_0x8a7aad,null));};exports[_0x7ab7('0x44')]=function(_0x43d410,_0x6a07bc){var _0x43e876={'raw':!![],'where':{'id':_0x43d410[_0x7ab7('0x45')]['id']}},_0x1f47d7={};_0x1f47d7[_0x7ab7('0x31')]=_['keys'](db[_0x7ab7('0x2d')][_0x7ab7('0x2e')]);_0x1f47d7[_0x7ab7('0x33')]=_['keys'](_0x43d410[_0x7ab7('0x33')]);_0x1f47d7[_0x7ab7('0x35')]=_[_0x7ab7('0x36')](_0x1f47d7[_0x7ab7('0x31')],_0x1f47d7[_0x7ab7('0x33')]);_0x43e876[_0x7ab7('0x37')]=_['intersection'](_0x1f47d7[_0x7ab7('0x31')],qs[_0x7ab7('0x38')](_0x43d410['query'][_0x7ab7('0x38')]));_0x43e876[_0x7ab7('0x37')]=_0x43e876[_0x7ab7('0x37')][_0x7ab7('0x39')]?_0x43e876[_0x7ab7('0x37')]:_0x1f47d7[_0x7ab7('0x31')];if(_0x43d410[_0x7ab7('0x33')][_0x7ab7('0x46')]){_0x43e876[_0x7ab7('0x40')]=[{'all':!![]}];}_0x43e876=_[_0x7ab7('0x3e')]({},_0x43e876,_0x43d410[_0x7ab7('0x47')]);return db[_0x7ab7('0x2d')][_0x7ab7('0x48')](_0x43e876)[_0x7ab7('0x26')](handleEntityNotFound(_0x6a07bc,null))['then'](respondWithResult(_0x6a07bc,null))[_0x7ab7('0x43')](handleError(_0x6a07bc,null));};exports[_0x7ab7('0x49')]=function(_0x3a28f0,_0x57e706){return db['FaxApplication'][_0x7ab7('0x49')](_0x3a28f0[_0x7ab7('0x4a')],{})[_0x7ab7('0x26')](respondWithResult(_0x57e706,0xc9))['catch'](handleError(_0x57e706,null));};exports[_0x7ab7('0x25')]=function(_0x4fc7b7,_0x1e597d){if(_0x4fc7b7[_0x7ab7('0x4a')]['id']){delete _0x4fc7b7['body']['id'];}return db[_0x7ab7('0x2d')]['find']({'where':{'id':_0x4fc7b7[_0x7ab7('0x45')]['id']}})[_0x7ab7('0x26')](handleEntityNotFound(_0x1e597d,null))[_0x7ab7('0x26')](saveUpdates(_0x4fc7b7[_0x7ab7('0x4a')],null))[_0x7ab7('0x26')](respondWithResult(_0x1e597d,null))[_0x7ab7('0x43')](handleError(_0x1e597d,null));};exports[_0x7ab7('0x27')]=function(_0x5e84da,_0x234aba){return db[_0x7ab7('0x2d')][_0x7ab7('0x48')]({'where':{'id':_0x5e84da['params']['id']}})[_0x7ab7('0x26')](handleEntityNotFound(_0x234aba,null))[_0x7ab7('0x26')](removeEntity(_0x234aba,null))[_0x7ab7('0x43')](handleError(_0x234aba,null));}; \ No newline at end of file +var _0x3f38=['map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','show','find','catch','body','params','eml-format','zip-dir','fast-json-patch','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','destroy','name','send','index','FaxApplication','rawAttributes','type','model'];(function(_0x517b9c,_0x4b32ce){var _0x340fb5=function(_0x4dfedb){while(--_0x4dfedb){_0x517b9c['push'](_0x517b9c['shift']());}};_0x340fb5(++_0x4b32ce);}(_0x3f38,0x65));var _0x83f3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3f38[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x83f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x83f3('0x1'));var jsonpatch=require(_0x83f3('0x2'));var rp=require('request-promise');var moment=require(_0x83f3('0x3'));var BPromise=require(_0x83f3('0x4'));var Mustache=require(_0x83f3('0x5'));var util=require(_0x83f3('0x6'));var path=require(_0x83f3('0x7'));var sox=require(_0x83f3('0x8'));var csv=require(_0x83f3('0x9'));var ejs=require(_0x83f3('0xa'));var fs=require('fs');var fs_extra=require(_0x83f3('0xb'));var _=require(_0x83f3('0xc'));var squel=require(_0x83f3('0xd'));var crypto=require(_0x83f3('0xe'));var jsforce=require(_0x83f3('0xf'));var deskjs=require(_0x83f3('0x10'));var toCsv=require(_0x83f3('0x9'));var querystring=require('querystring');var Papa=require(_0x83f3('0x11'));var Redis=require(_0x83f3('0x12'));var authService=require(_0x83f3('0x13'));var qs=require(_0x83f3('0x14'));var as=require(_0x83f3('0x15'));var hardwareService=require(_0x83f3('0x16'));var logger=require(_0x83f3('0x17'))(_0x83f3('0x18'));var utils=require(_0x83f3('0x19'));var config=require(_0x83f3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x83f3('0x1b'))['db'];function respondWithStatusCode(_0x998e68,_0x1b0e9d){_0x1b0e9d=_0x1b0e9d||0xcc;return function(_0x3f327e){if(_0x3f327e){return _0x998e68[_0x83f3('0x1c')](_0x1b0e9d);}return _0x998e68[_0x83f3('0x1d')](_0x1b0e9d)[_0x83f3('0x1e')]();};}function respondWithResult(_0x5e7994,_0x5ad050){_0x5ad050=_0x5ad050||0xc8;return function(_0x3ca2df){if(_0x3ca2df){return _0x5e7994[_0x83f3('0x1d')](_0x5ad050)[_0x83f3('0x1f')](_0x3ca2df);}};}function respondWithFilteredResult(_0x1a1475,_0x502431){return function(_0x54361d){if(_0x54361d){var _0x5bcb5d=typeof _0x502431['offset']===_0x83f3('0x20')&&typeof _0x502431[_0x83f3('0x21')]===_0x83f3('0x20');var _0x57e52d=_0x54361d['count'];var _0x2499f0=_0x5bcb5d?0x0:_0x502431[_0x83f3('0x22')];var _0x24c42c=_0x5bcb5d?_0x54361d[_0x83f3('0x23')]:_0x502431['offset']+_0x502431[_0x83f3('0x21')];var _0x3080ae;if(_0x24c42c>=_0x57e52d){_0x24c42c=_0x57e52d;_0x3080ae=0xc8;}else{_0x3080ae=0xce;}_0x1a1475[_0x83f3('0x1d')](_0x3080ae);return _0x1a1475[_0x83f3('0x24')](_0x83f3('0x25'),_0x2499f0+'-'+_0x24c42c+'/'+_0x57e52d)[_0x83f3('0x1f')](_0x54361d);}return null;};}function patchUpdates(_0x55dfcd){return function(_0x17e9ea){try{jsonpatch['apply'](_0x17e9ea,_0x55dfcd,!![]);}catch(_0x14f5d3){return BPromise[_0x83f3('0x26')](_0x14f5d3);}return _0x17e9ea[_0x83f3('0x27')]();};}function saveUpdates(_0x3993a4,_0x19fb39){return function(_0x316a2c){if(_0x316a2c){return _0x316a2c['update'](_0x3993a4)[_0x83f3('0x28')](function(_0x1132bd){return _0x1132bd;});}return null;};}function removeEntity(_0x5b7603,_0x1cfeec){return function(_0x28f9a9){if(_0x28f9a9){return _0x28f9a9[_0x83f3('0x29')]()['then'](function(){_0x5b7603['status'](0xcc)[_0x83f3('0x1e')]();});}};}function handleEntityNotFound(_0xc1cc99,_0x380ca6){return function(_0x4c8057){if(!_0x4c8057){_0xc1cc99[_0x83f3('0x1c')](0x194);}return _0x4c8057;};}function handleError(_0x3d7e77,_0x5e85d6){_0x5e85d6=_0x5e85d6||0x1f4;return function(_0x48cd6a){logger['error'](_0x48cd6a['stack']);if(_0x48cd6a[_0x83f3('0x2a')]){delete _0x48cd6a[_0x83f3('0x2a')];}_0x3d7e77['status'](_0x5e85d6)[_0x83f3('0x2b')](_0x48cd6a);};}exports[_0x83f3('0x2c')]=function(_0x1449b4,_0x47b60b){var _0x1da7a5={},_0x426596={},_0x6c6fa5={'count':0x0,'rows':[]};var _0x4d927e=_['map'](db[_0x83f3('0x2d')][_0x83f3('0x2e')],function(_0x240dea){return{'name':_0x240dea['fieldName'],'type':_0x240dea[_0x83f3('0x2f')]['key']};});_0x426596[_0x83f3('0x30')]=_[_0x83f3('0x31')](_0x4d927e,'name');_0x426596['query']=_[_0x83f3('0x32')](_0x1449b4[_0x83f3('0x33')]);_0x426596['filters']=_[_0x83f3('0x34')](_0x426596[_0x83f3('0x30')],_0x426596[_0x83f3('0x33')]);_0x1da7a5[_0x83f3('0x35')]=_[_0x83f3('0x34')](_0x426596[_0x83f3('0x30')],qs[_0x83f3('0x36')](_0x1449b4[_0x83f3('0x33')][_0x83f3('0x36')]));_0x1da7a5[_0x83f3('0x35')]=_0x1da7a5[_0x83f3('0x35')][_0x83f3('0x37')]?_0x1da7a5[_0x83f3('0x35')]:_0x426596[_0x83f3('0x30')];if(!_0x1449b4['query'][_0x83f3('0x38')](_0x83f3('0x39'))){_0x1da7a5[_0x83f3('0x21')]=qs[_0x83f3('0x21')](_0x1449b4[_0x83f3('0x33')][_0x83f3('0x21')]);_0x1da7a5[_0x83f3('0x22')]=qs[_0x83f3('0x22')](_0x1449b4[_0x83f3('0x33')][_0x83f3('0x22')]);}_0x1da7a5['order']=qs[_0x83f3('0x3a')](_0x1449b4['query'][_0x83f3('0x3a')]);_0x1da7a5['where']=qs[_0x83f3('0x3b')](_[_0x83f3('0x3c')](_0x1449b4[_0x83f3('0x33')],_0x426596[_0x83f3('0x3b')]),_0x4d927e);if(_0x1449b4[_0x83f3('0x33')][_0x83f3('0x3d')]){_0x1da7a5['where']=_[_0x83f3('0x3e')](_0x1da7a5['where'],{'$or':_[_0x83f3('0x31')](_0x4d927e,function(_0xef1016){if(_0xef1016[_0x83f3('0x2f')]!==_0x83f3('0x3f')){var _0x2066b1={};_0x2066b1[_0xef1016[_0x83f3('0x2a')]]={'$like':'%'+_0x1449b4[_0x83f3('0x33')][_0x83f3('0x3d')]+'%'};return _0x2066b1;}})});}_0x1da7a5=_[_0x83f3('0x3e')]({},_0x1da7a5,_0x1449b4[_0x83f3('0x40')]);var _0x29ebdc={'where':_0x1da7a5[_0x83f3('0x41')]};return db[_0x83f3('0x2d')][_0x83f3('0x23')](_0x29ebdc)[_0x83f3('0x28')](function(_0x3b9827){_0x6c6fa5[_0x83f3('0x23')]=_0x3b9827;if(_0x1449b4['query'][_0x83f3('0x42')]){_0x1da7a5[_0x83f3('0x43')]=[{'all':!![]}];}return db[_0x83f3('0x2d')][_0x83f3('0x44')](_0x1da7a5);})[_0x83f3('0x28')](function(_0x556cff){_0x6c6fa5[_0x83f3('0x45')]=_0x556cff;return _0x6c6fa5;})[_0x83f3('0x28')](respondWithFilteredResult(_0x47b60b,_0x1da7a5))['catch'](handleError(_0x47b60b,null));};exports[_0x83f3('0x46')]=function(_0x27d962,_0x26ddf5){var _0x68bf08={'raw':!![],'where':{'id':_0x27d962['params']['id']}},_0x3b926b={};_0x3b926b[_0x83f3('0x30')]=_[_0x83f3('0x32')](db['FaxApplication'][_0x83f3('0x2e')]);_0x3b926b[_0x83f3('0x33')]=_['keys'](_0x27d962['query']);_0x3b926b[_0x83f3('0x3b')]=_['intersection'](_0x3b926b['model'],_0x3b926b[_0x83f3('0x33')]);_0x68bf08[_0x83f3('0x35')]=_['intersection'](_0x3b926b['model'],qs[_0x83f3('0x36')](_0x27d962[_0x83f3('0x33')][_0x83f3('0x36')]));_0x68bf08[_0x83f3('0x35')]=_0x68bf08['attributes'][_0x83f3('0x37')]?_0x68bf08['attributes']:_0x3b926b['model'];if(_0x27d962[_0x83f3('0x33')][_0x83f3('0x42')]){_0x68bf08[_0x83f3('0x43')]=[{'all':!![]}];}_0x68bf08=_[_0x83f3('0x3e')]({},_0x68bf08,_0x27d962[_0x83f3('0x40')]);return db[_0x83f3('0x2d')][_0x83f3('0x47')](_0x68bf08)['then'](handleEntityNotFound(_0x26ddf5,null))['then'](respondWithResult(_0x26ddf5,null))[_0x83f3('0x48')](handleError(_0x26ddf5,null));};exports['create']=function(_0x19ac48,_0x458b5c){return db[_0x83f3('0x2d')]['create'](_0x19ac48['body'],{})['then'](respondWithResult(_0x458b5c,0xc9))['catch'](handleError(_0x458b5c,null));};exports['update']=function(_0x5ef6a1,_0x144653){if(_0x5ef6a1[_0x83f3('0x49')]['id']){delete _0x5ef6a1[_0x83f3('0x49')]['id'];}return db[_0x83f3('0x2d')][_0x83f3('0x47')]({'where':{'id':_0x5ef6a1[_0x83f3('0x4a')]['id']}})[_0x83f3('0x28')](handleEntityNotFound(_0x144653,null))[_0x83f3('0x28')](saveUpdates(_0x5ef6a1['body'],null))['then'](respondWithResult(_0x144653,null))[_0x83f3('0x48')](handleError(_0x144653,null));};exports['destroy']=function(_0x276531,_0x1dac8f){return db[_0x83f3('0x2d')][_0x83f3('0x47')]({'where':{'id':_0x276531['params']['id']}})[_0x83f3('0x28')](handleEntityNotFound(_0x1dac8f,null))[_0x83f3('0x28')](removeEntity(_0x1dac8f,null))[_0x83f3('0x48')](handleError(_0x1dac8f,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 0c0cb21..4131ada 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 _0x5546=['fax_applications','utf8mb4','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxApplication'];(function(_0x5e0f76,_0x23bf31){var _0x35f07a=function(_0x55cd81){while(--_0x55cd81){_0x5e0f76['push'](_0x5e0f76['shift']());}};_0x35f07a(++_0x23bf31);}(_0x5546,0x9e));var _0x6554=function(_0x46672d,_0x359677){_0x46672d=_0x46672d-0x0;var _0x4294d5=_0x5546[_0x46672d];return _0x4294d5;};'use strict';var _=require(_0x6554('0x0'));var util=require(_0x6554('0x1'));var logger=require('../../config/logger')(_0x6554('0x2'));var moment=require('moment');var BPromise=require(_0x6554('0x3'));var rp=require(_0x6554('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6554('0x5'));var config=require(_0x6554('0x6'));var attributes=require('./faxApplication.attributes');module[_0x6554('0x7')]=function(_0x1b8ff1,_0xf59817){return _0x1b8ff1[_0x6554('0x8')](_0x6554('0x9'),attributes,{'tableName':_0x6554('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6554('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x32dd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xe9718,_0x477057){var _0xe19c0=function(_0x40de88){while(--_0x40de88){_0xe9718['push'](_0xe9718['shift']());}};_0xe19c0(++_0x477057);}(_0x32dd,0x1ed));var _0xd32d=function(_0x4131da,_0x124783){_0x4131da=_0x4131da-0x0;var _0x583242=_0x32dd[_0x4131da];return _0x583242;};'use strict';var _=require(_0xd32d('0x0'));var util=require(_0xd32d('0x1'));var logger=require(_0xd32d('0x2'))(_0xd32d('0x3'));var moment=require(_0xd32d('0x4'));var BPromise=require(_0xd32d('0x5'));var rp=require(_0xd32d('0x6'));var fs=require('fs');var path=require(_0xd32d('0x7'));var rimraf=require(_0xd32d('0x8'));var config=require(_0xd32d('0x9'));var attributes=require('./faxApplication.attributes');module[_0xd32d('0xa')]=function(_0x3b8dbb,_0x26ab4d){return _0x3b8dbb[_0xd32d('0xb')](_0xd32d('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd32d('0xd'),'collate':_0xd32d('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4135fe2..62ed102 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 _0x8251=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x8251,0x1cf));var _0x1825=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8251[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x1825('0x0'));var util=require(_0x1825('0x1'));var moment=require(_0x1825('0x2'));var BPromise=require(_0x1825('0x3'));var rs=require(_0x1825('0x4'));var fs=require('fs');var Redis=require(_0x1825('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1825('0x6'));var logger=require(_0x1825('0x7'))(_0x1825('0x8'));var config=require('../../config/environment');var jayson=require(_0x1825('0x9'));var client=jayson[_0x1825('0xa')][_0x1825('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f98a9,_0x5a2c53,_0x32943a){return new BPromise(function(_0x3804e9,_0x1d398a){return client[_0x1825('0xc')](_0x5f98a9,_0x32943a)[_0x1825('0xd')](function(_0x100793){logger['info'](_0x1825('0xe'),_0x5a2c53,_0x1825('0xf'));logger[_0x1825('0x10')](_0x1825('0x11'),_0x5a2c53,_0x1825('0xf'),JSON[_0x1825('0x12')](_0x100793));if(_0x100793[_0x1825('0x13')]){if(_0x100793[_0x1825('0x13')][_0x1825('0x14')]===0x1f4){logger[_0x1825('0x13')](_0x1825('0xe'),_0x5a2c53,_0x100793[_0x1825('0x13')]['message']);return _0x1d398a(_0x100793[_0x1825('0x13')][_0x1825('0x15')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x5a2c53,_0x100793[_0x1825('0x13')][_0x1825('0x15')]);return _0x3804e9(_0x100793[_0x1825('0x13')][_0x1825('0x15')]);}else{logger[_0x1825('0x16')](_0x1825('0xe'),_0x5a2c53,_0x1825('0xf'));_0x3804e9(_0x100793[_0x1825('0x17')][_0x1825('0x15')]);}})['catch'](function(_0x1ed3d6){logger['error'](_0x1825('0xe'),_0x5a2c53,_0x1ed3d6);_0x1d398a(_0x1ed3d6);});});}exports[_0x1825('0x18')]=function(_0x144eed){var _0x36c15c=this;return new Promise(function(_0x1837d1,_0x3cabae){return db[_0x1825('0x19')][_0x1825('0x1a')](_0x144eed[_0x1825('0x1b')],{'raw':_0x144eed[_0x1825('0x1c')]?_0x144eed[_0x1825('0x1c')][_0x1825('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x144eed[_0x1825('0x1c')]?_0x144eed[_0x1825('0x1c')][_0x1825('0x1e')]||null:null,'attributes':_0x144eed['options']?_0x144eed[_0x1825('0x1c')][_0x1825('0x1f')]||null:null,'limit':_0x144eed['options']?_0x144eed[_0x1825('0x1c')]['limit']||null:null})['then'](function(_0x519c54){logger[_0x1825('0x16')]('UpdateFaxApplication',_0x144eed);logger['debug']('UpdateFaxApplication',_0x144eed,JSON['stringify'](_0x519c54));_0x1837d1(_0x519c54);})[_0x1825('0x20')](function(_0x372f07){logger[_0x1825('0x13')]('UpdateFaxApplication',_0x372f07['message'],_0x144eed);_0x3cabae(_0x36c15c[_0x1825('0x13')](0x1f4,_0x372f07[_0x1825('0x15')]));});});}; \ No newline at end of file +var _0x3cd8=['then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','raw','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4a5290,_0x457f7d){var _0x5503ca=function(_0x247aba){while(--_0x247aba){_0x4a5290['push'](_0x4a5290['shift']());}};_0x5503ca(++_0x457f7d);}(_0x3cd8,0x150));var _0x83cd=function(_0x47a8c0,_0x4d5931){_0x47a8c0=_0x47a8c0-0x0;var _0x551fa1=_0x3cd8[_0x47a8c0];return _0x551fa1;};'use strict';var _=require(_0x83cd('0x0'));var util=require(_0x83cd('0x1'));var moment=require(_0x83cd('0x2'));var BPromise=require(_0x83cd('0x3'));var rs=require(_0x83cd('0x4'));var fs=require('fs');var Redis=require(_0x83cd('0x5'));var db=require(_0x83cd('0x6'))['db'];var utils=require(_0x83cd('0x7'));var logger=require('../../config/logger')(_0x83cd('0x8'));var config=require(_0x83cd('0x9'));var jayson=require(_0x83cd('0xa'));var client=jayson[_0x83cd('0xb')][_0x83cd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb6ca3a,_0x69187a,_0x309a7a){return new BPromise(function(_0x1bd528,_0x3e7b0c){return client[_0x83cd('0xd')](_0xb6ca3a,_0x309a7a)[_0x83cd('0xe')](function(_0x43b349){logger[_0x83cd('0xf')](_0x83cd('0x10'),_0x69187a,_0x83cd('0x11'));logger[_0x83cd('0x12')](_0x83cd('0x13'),_0x69187a,_0x83cd('0x11'),JSON[_0x83cd('0x14')](_0x43b349));if(_0x43b349['error']){if(_0x43b349[_0x83cd('0x15')][_0x83cd('0x16')]===0x1f4){logger[_0x83cd('0x15')](_0x83cd('0x10'),_0x69187a,_0x43b349[_0x83cd('0x15')][_0x83cd('0x17')]);return _0x3e7b0c(_0x43b349[_0x83cd('0x15')][_0x83cd('0x17')]);}logger['error'](_0x83cd('0x10'),_0x69187a,_0x43b349[_0x83cd('0x15')][_0x83cd('0x17')]);return _0x1bd528(_0x43b349[_0x83cd('0x15')][_0x83cd('0x17')]);}else{logger[_0x83cd('0xf')]('FaxApplication,\x20%s,\x20%s',_0x69187a,'request\x20sent');_0x1bd528(_0x43b349[_0x83cd('0x18')][_0x83cd('0x17')]);}})[_0x83cd('0x19')](function(_0x28d4c8){logger[_0x83cd('0x15')](_0x83cd('0x10'),_0x69187a,_0x28d4c8);_0x3e7b0c(_0x28d4c8);});});}exports[_0x83cd('0x1a')]=function(_0x1e136e){var _0x5e35e3=this;return new Promise(function(_0x1df488,_0x4ab232){return db[_0x83cd('0x1b')][_0x83cd('0x1c')](_0x1e136e[_0x83cd('0x1d')],{'raw':_0x1e136e['options']?_0x1e136e['options'][_0x83cd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e136e['options']?_0x1e136e[_0x83cd('0x1f')][_0x83cd('0x20')]||null:null,'attributes':_0x1e136e['options']?_0x1e136e[_0x83cd('0x1f')][_0x83cd('0x21')]||null:null,'limit':_0x1e136e[_0x83cd('0x1f')]?_0x1e136e[_0x83cd('0x1f')][_0x83cd('0x22')]||null:null})[_0x83cd('0xe')](function(_0x10b957){logger[_0x83cd('0xf')]('UpdateFaxApplication',_0x1e136e);logger['debug'](_0x83cd('0x1a'),_0x1e136e,JSON['stringify'](_0x10b957));_0x1df488(_0x10b957);})[_0x83cd('0x19')](function(_0x2a99aa){logger[_0x83cd('0x15')]('UpdateFaxApplication',_0x2a99aa[_0x83cd('0x17')],_0x1e136e);_0x4ab232(_0x5e35e3[_0x83cd('0x15')](0x1f4,_0x2a99aa[_0x83cd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 7ccd0cc..069533c 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 _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x2f19c0,_0x5e1c3a){var _0x88fc50=function(_0x919f5a){while(--_0x919f5a){_0x2f19c0['push'](_0x2f19c0['shift']());}};_0x88fc50(++_0x5e1c3a);}(_0xa571,0x107));var _0x1a57=function(_0x124ef4,_0x1b39f5){_0x124ef4=_0x124ef4-0x0;var _0x23a8a7=_0xa571[_0x124ef4];return _0x23a8a7;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('0x10')]=router; \ No newline at end of file +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(_0x56e077,_0x389aeb){var _0x458520=function(_0x5d9609){while(--_0x5d9609){_0x56e077['push'](_0x56e077['shift']());}};_0x458520(++_0x389aeb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xb7e7[_0x369151];return _0x4292d5;};'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 diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index a8e58ba..b62d053 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 _0xf4d9=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0xf4d9,0x156));var _0x9f4d=function(_0xca7efa,_0x2a2f46){_0xca7efa=_0xca7efa-0x0;var _0x1936ca=_0xf4d9[_0xca7efa];return _0x1936ca;};'use strict';var Sequelize=require(_0x9f4d('0x0'));module[_0x9f4d('0x1')]={'closed':{'type':Sequelize[_0x9f4d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9f4d('0x3')]},'disposition':{'type':Sequelize[_0x9f4d('0x4')]},'secondDisposition':{'type':Sequelize[_0x9f4d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9f4d('0x4')]},'note':{'type':Sequelize[_0x9f4d('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x9f4d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9f4d('0x5')]('in',_0x9f4d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9f4d('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9f4d('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x04a6=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x206090,_0x407c97){var _0x31a12e=function(_0x1b6376){while(--_0x1b6376){_0x206090['push'](_0x206090['shift']());}};_0x31a12e(++_0x407c97);}(_0x04a6,0x8c));var _0x604a=function(_0x28d9c5,_0x17c03c){_0x28d9c5=_0x28d9c5-0x0;var _0x5d5a0c=_0x04a6[_0x28d9c5];return _0x5d5a0c;};'use strict';var Sequelize=require('sequelize');module[_0x604a('0x0')]={'closed':{'type':Sequelize[_0x604a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x604a('0x2')]},'disposition':{'type':Sequelize[_0x604a('0x3')]},'secondDisposition':{'type':Sequelize[_0x604a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x604a('0x3')]},'note':{'type':Sequelize[_0x604a('0x3')]},'read1stAt':{'type':Sequelize[_0x604a('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x604a('0x4')]('in',_0x604a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x604a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x604a('0x4')]('in',_0x604a('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index f5e8607..1df6c09 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 _0x4d04=['intersection','nolimit','sort','where','pick','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','color','emit','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','log','err','unlinkSync','rimraf','moment','bluebird','util','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','then','end','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','keys','filters','model','fields','attributes','length','includeAll','include','options','find','create','update','body','destroy','describe','FaxMessage','addMessage','ids','omit','findOne'];(function(_0x457dda,_0xb45bfc){var _0x1bc9ca=function(_0x342e99){while(--_0x342e99){_0x457dda['push'](_0x457dda['shift']());}};_0x1bc9ca(++_0xb45bfc);}(_0x4d04,0x8b));var _0x44d0=function(_0x163b1f,_0xbe94a2){_0x163b1f=_0x163b1f-0x0;var _0x34f140=_0x4d04[_0x163b1f];return _0x34f140;};'use strict';var rimraf=require(_0x44d0('0x0'));var zipdir=require('zip-dir');var moment=require(_0x44d0('0x1'));var BPromise=require(_0x44d0('0x2'));var util=require(_0x44d0('0x3'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x44d0('0x4'));var qs=require(_0x44d0('0x5'));var logger=require('../../config/logger')(_0x44d0('0x6'));var config=require(_0x44d0('0x7'));var db=require('../../mysqldb')['db'];config[_0x44d0('0x8')]=_['defaults'](config['redis'],{'host':_0x44d0('0x9'),'port':0x18eb});var socket=require(_0x44d0('0xa'))(new Redis(config[_0x44d0('0x8')]));require(_0x44d0('0xb'))[_0x44d0('0xc')](socket);function respondWithStatusCode(_0x30eb64,_0x14bc7e){_0x14bc7e=_0x14bc7e||0xcc;return function(_0x4f49de){if(_0x4f49de){return _0x30eb64[_0x44d0('0xd')](_0x14bc7e);}return _0x30eb64[_0x44d0('0xe')](_0x14bc7e)['end']();};}function respondWithResult(_0x10fc7d,_0x2e0e44){_0x2e0e44=_0x2e0e44||0xc8;return function(_0x31f74d){if(_0x31f74d){return _0x10fc7d['status'](_0x2e0e44)[_0x44d0('0xf')](_0x31f74d);}};}function respondWithFilteredResult(_0x762770,_0x3991e7){return function(_0x536d00){if(_0x536d00){var _0x7ee913=typeof _0x3991e7['offset']===_0x44d0('0x10')&&typeof _0x3991e7[_0x44d0('0x11')]===_0x44d0('0x10');var _0x2a3a7e=_0x536d00[_0x44d0('0x12')];var _0x28f765=_0x7ee913?0x0:_0x3991e7[_0x44d0('0x13')];var _0x4d0e29=_0x7ee913?_0x536d00[_0x44d0('0x12')]:_0x3991e7['offset']+_0x3991e7['limit'];var _0x125fef;if(_0x4d0e29>=_0x2a3a7e){_0x4d0e29=_0x2a3a7e;_0x125fef=0xc8;}else{_0x125fef=0xce;}_0x762770[_0x44d0('0xe')](_0x125fef);return _0x762770[_0x44d0('0x14')](_0x44d0('0x15'),_0x28f765+'-'+_0x4d0e29+'/'+_0x2a3a7e)['json'](_0x536d00);}return null;};}function saveUpdates(_0x1075c1){return function(_0x5baaf4){if(_0x5baaf4){return _0x5baaf4['update'](_0x1075c1)[_0x44d0('0x16')](function(_0x51877d){return _0x51877d;});}return null;};}function removeEntity(_0x5dbaf3){return function(_0xf7b406){if(_0xf7b406){return _0xf7b406['destroy']()[_0x44d0('0x16')](function(){_0x5dbaf3['status'](0xcc)[_0x44d0('0x17')]();});}};}function handleEntityNotFound(_0x24cada){return function(_0x5067bf){if(!_0x5067bf){_0x24cada[_0x44d0('0xd')](0x194);}return _0x5067bf;};}function handleError(_0x2c2df1,_0x3b6e91){_0x3b6e91=_0x3b6e91||0x1f4;return function(_0x174926){logger[_0x44d0('0x18')](_0x174926[_0x44d0('0x19')]);if(_0x174926[_0x44d0('0x1a')]){delete _0x174926[_0x44d0('0x1a')];}_0x2c2df1['status'](_0x3b6e91)[_0x44d0('0x1b')](_0x174926);};}exports[_0x44d0('0x1c')]=function(_0xeeaa40,_0x17c136){var _0x10a513={};var _0x1f6f48=_[_0x44d0('0x1d')](db[_0x44d0('0x1e')][_0x44d0('0x1f')],function(_0x51aa7a){return{'name':_0x51aa7a[_0x44d0('0x20')],'type':_0x51aa7a[_0x44d0('0x21')][_0x44d0('0x22')]};});_0x10a513=qs[_0x44d0('0x23')](_0x1f6f48,_0xeeaa40);return interaction[_0x44d0('0x24')](_0x44d0('0x25'),_0xeeaa40[_0x44d0('0x26')],_0xeeaa40[_0x44d0('0x27')],_0x10a513,_0x1f6f48)[_0x44d0('0x16')](respondWithFilteredResult(_0x17c136,_0x10a513))[_0x44d0('0x28')](handleError(_0x17c136,null));};exports[_0x44d0('0x29')]=function(_0x1639f0,_0x183972){var _0xaca527={'raw':![],'where':{'id':_0x1639f0[_0x44d0('0x2a')]['id']}},_0x298321={};_0x298321['model']=_[_0x44d0('0x2b')](db['FaxInteraction'][_0x44d0('0x1f')]);_0x298321[_0x44d0('0x26')]=_[_0x44d0('0x2b')](_0x1639f0['query']);_0x298321[_0x44d0('0x2c')]=_['intersection'](_0x298321[_0x44d0('0x2d')],_0x298321[_0x44d0('0x26')]);_0xaca527['attributes']=_['intersection'](_0x298321['model'],qs[_0x44d0('0x2e')](_0x1639f0[_0x44d0('0x26')]['fields']));_0xaca527[_0x44d0('0x2f')]=_0xaca527[_0x44d0('0x2f')][_0x44d0('0x30')]?_0xaca527[_0x44d0('0x2f')]:_0x298321[_0x44d0('0x2d')];if(_0x1639f0[_0x44d0('0x26')][_0x44d0('0x31')]){_0xaca527[_0x44d0('0x32')]=[{'all':!![]}];}_0xaca527=_['merge']({},_0xaca527,_0x1639f0[_0x44d0('0x33')]);return db[_0x44d0('0x1e')][_0x44d0('0x34')](_0xaca527)[_0x44d0('0x16')](handleEntityNotFound(_0x183972,null))[_0x44d0('0x16')](respondWithResult(_0x183972,null))[_0x44d0('0x28')](handleError(_0x183972,null));};exports[_0x44d0('0x35')]=function(_0x5818d7,_0x1384b3){return db[_0x44d0('0x1e')][_0x44d0('0x35')](_0x5818d7['body'],{})[_0x44d0('0x16')](respondWithResult(_0x1384b3,0xc9))[_0x44d0('0x28')](handleError(_0x1384b3,null));};exports[_0x44d0('0x36')]=function(_0x3074bc,_0x5021ba){if(_0x3074bc['body']['id']){delete _0x3074bc[_0x44d0('0x37')]['id'];}return db[_0x44d0('0x1e')][_0x44d0('0x34')]({'where':{'id':_0x3074bc[_0x44d0('0x2a')]['id']}})[_0x44d0('0x16')](handleEntityNotFound(_0x5021ba,null))[_0x44d0('0x16')](saveUpdates(_0x3074bc[_0x44d0('0x37')],null))['then'](respondWithResult(_0x5021ba,null))[_0x44d0('0x28')](handleError(_0x5021ba,null));};exports[_0x44d0('0x38')]=function(_0x4f57d7,_0x3afbf0){return db['FaxInteraction'][_0x44d0('0x34')]({'where':{'id':_0x4f57d7['params']['id']}})[_0x44d0('0x16')](handleEntityNotFound(_0x3afbf0,null))[_0x44d0('0x16')](removeEntity(_0x3afbf0,null))[_0x44d0('0x28')](handleError(_0x3afbf0,null));};exports[_0x44d0('0x39')]=function(_0x34fe7b,_0x3ce242){return db[_0x44d0('0x1e')]['describe']()[_0x44d0('0x16')](respondWithResult(_0x3ce242,null))['catch'](handleError(_0x3ce242,null));};exports['addMessage']=function(_0x1efdc9,_0xf58d65){return db[_0x44d0('0x3a')]['find']({'where':{'id':_0x1efdc9[_0x44d0('0x2a')]['id']}})['then'](handleEntityNotFound(_0xf58d65,null))[_0x44d0('0x16')](function(_0x921bcd){if(_0x921bcd){return _0x921bcd[_0x44d0('0x3b')](_0x1efdc9[_0x44d0('0x37')][_0x44d0('0x3c')],_[_0x44d0('0x3d')](_0x1efdc9['body'],[_0x44d0('0x3c'),'id'])||{});}})[_0x44d0('0x16')](respondWithResult(_0xf58d65,null))['catch'](handleError(_0xf58d65,null));};exports['getMessages']=function(_0x4185a2,_0x1e846f){var _0x463451={'raw':![],'where':{}};var _0x1e1e37={};var _0x532e1d={'count':0x0,'rows':[]};return db[_0x44d0('0x1e')][_0x44d0('0x3e')]({'where':{'id':_0x4185a2[_0x44d0('0x2a')]['id']}})[_0x44d0('0x16')](handleEntityNotFound(_0x1e846f,null))[_0x44d0('0x16')](function(_0x4fd2c4){if(_0x4fd2c4){_0x1e1e37['model']=_[_0x44d0('0x2b')](db[_0x44d0('0x3a')][_0x44d0('0x1f')]);_0x1e1e37['query']=_[_0x44d0('0x2b')](_0x4185a2[_0x44d0('0x26')]);_0x1e1e37['filters']=_[_0x44d0('0x3f')](_0x1e1e37[_0x44d0('0x2d')],_0x1e1e37[_0x44d0('0x26')]);_0x463451[_0x44d0('0x2f')]=_['intersection'](_0x1e1e37[_0x44d0('0x2d')],qs[_0x44d0('0x2e')](_0x4185a2['query']['fields']));_0x463451[_0x44d0('0x2f')]=_0x463451[_0x44d0('0x2f')][_0x44d0('0x30')]?_0x463451[_0x44d0('0x2f')]:_0x1e1e37['model'];if(!_0x4185a2[_0x44d0('0x26')]['hasOwnProperty'](_0x44d0('0x40'))){_0x463451[_0x44d0('0x11')]=qs[_0x44d0('0x11')](_0x4185a2[_0x44d0('0x26')][_0x44d0('0x11')]);_0x463451[_0x44d0('0x13')]=qs[_0x44d0('0x13')](_0x4185a2[_0x44d0('0x26')][_0x44d0('0x13')]);}_0x463451['order']=qs[_0x44d0('0x41')](_0x4185a2[_0x44d0('0x26')][_0x44d0('0x41')]);_0x463451[_0x44d0('0x42')]=qs[_0x44d0('0x2c')](_[_0x44d0('0x43')](_0x4185a2['query'],_0x1e1e37[_0x44d0('0x2c')]));_0x463451[_0x44d0('0x42')]['FaxInteractionId']=_0x4fd2c4['id'];if(_0x4185a2[_0x44d0('0x26')]['filter']){_0x463451[_0x44d0('0x42')]=_[_0x44d0('0x44')](_0x463451['where'],{'$or':_[_0x44d0('0x1d')](_0x463451[_0x44d0('0x2f')],function(_0x5be3ef){var _0x15d411={};_0x15d411[_0x5be3ef]={'$like':'%'+_0x4185a2['query'][_0x44d0('0x45')]+'%'};return _0x15d411;})});}if(_0x4185a2['query'][_0x44d0('0x46')]){var _0x56f4e9=_0x4185a2[_0x44d0('0x26')][_0x44d0('0x46')][_0x44d0('0x47')](',');var _0x2d2ce7={};_0x2d2ce7[_0x56f4e9[0x0]]={'$gte':moment(_0x56f4e9[0x1])[_0x44d0('0x48')](_0x44d0('0x49'))};_0x463451['where']=_['merge'](_0x463451[_0x44d0('0x42')],_0x2d2ce7);}_0x463451=_[_0x44d0('0x44')]({},_0x463451,_0x4185a2['options']);return db['FaxMessage'][_0x44d0('0x12')]({'where':_0x463451[_0x44d0('0x42')]})[_0x44d0('0x16')](function(_0xe75fbd){_0x532e1d[_0x44d0('0x12')]=_0xe75fbd;if(_0x4185a2[_0x44d0('0x26')][_0x44d0('0x31')]){_0x463451[_0x44d0('0x32')]=[{'all':!![]}];}return db[_0x44d0('0x3a')][_0x44d0('0x24')](_0x463451);})[_0x44d0('0x16')](function(_0x5b24ea){_0x532e1d['rows']=_0x5b24ea;return _0x532e1d;});}})[_0x44d0('0x16')](respondWithFilteredResult(_0x1e846f,_0x463451))[_0x44d0('0x28')](handleError(_0x1e846f,null));};exports[_0x44d0('0x4a')]=function(_0x58d93c,_0x4cb14d){return db['FaxInteraction'][_0x44d0('0x34')]({'where':{'id':_0x58d93c['params']['id']}})[_0x44d0('0x16')](handleEntityNotFound(_0x4cb14d,null))[_0x44d0('0x16')](function(_0x41132e){if(_0x41132e){return _0x41132e[_0x44d0('0x4b')](_0x58d93c[_0x44d0('0x37')][_0x44d0('0x3c')],_[_0x44d0('0x3d')](_0x58d93c[_0x44d0('0x37')],[_0x44d0('0x3c'),'id'])||{})[_0x44d0('0x4c')](function(){return db['Tag'][_0x44d0('0x24')]({'attributes':['id',_0x44d0('0x1a'),_0x44d0('0x4d')],'where':{'id':_0x58d93c['body']['ids']}});})['then'](function(_0x2cd212){socket[_0x44d0('0x4e')]('faxInteractionTags:save',{'id':Number(_0x58d93c['params']['id']),'tags':_0x2cd212||[]});return{'id':Number(_0x58d93c[_0x44d0('0x2a')]['id']),'tags':_0x2cd212||[]};});}})[_0x44d0('0x16')](respondWithResult(_0x4cb14d,null))[_0x44d0('0x28')](handleError(_0x4cb14d,null));};exports[_0x44d0('0x4f')]=function(_0x106cd0,_0x1e2995){return db[_0x44d0('0x1e')][_0x44d0('0x34')]({'where':{'id':_0x106cd0[_0x44d0('0x2a')]['id']}})[_0x44d0('0x16')](handleEntityNotFound(_0x1e2995,null))[_0x44d0('0x16')](function(_0x3624bd){if(_0x3624bd){return _0x3624bd['removeTags'](_0x106cd0[_0x44d0('0x26')]['ids']);}})[_0x44d0('0x16')](respondWithStatusCode(_0x1e2995,null))['catch'](handleError(_0x1e2995,null));};exports[_0x44d0('0x50')]=function(_0x2a2dad,_0x3e3a4f){var _0x281032=moment()[_0x44d0('0x51')]()['toString']();var _0x2f4053=path[_0x44d0('0x52')](config[_0x44d0('0x53')],'server',_0x44d0('0x54'),_0x44d0('0x55'));var _0x57373d=path[_0x44d0('0x52')](config['root'],_0x44d0('0x56'),'files',_0x44d0('0x57'));var _0x242ed7=path['join'](_0x2f4053,_0x281032);var _0xe0f5c1=util[_0x44d0('0x48')](_0x44d0('0x58'),_0x2a2dad[_0x44d0('0x2a')]['id'],_0x281032);var _0x212283=path[_0x44d0('0x52')](_0x2f4053,_0xe0f5c1);var _0x46d812=[];_0x46d812[_0x44d0('0x59')]({'model':db['Attachment'],'as':_0x44d0('0x5a'),'raw':!![]});var _0x3f634d=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id','body','createdAt'],'include':_0x46d812}];return db[_0x44d0('0x1e')][_0x44d0('0x34')]({'where':{'id':_0x2a2dad[_0x44d0('0x2a')]['id']},'include':_0x3f634d})[_0x44d0('0x16')](handleEntityNotFound(_0x3e3a4f,null))['then'](function(_0x10d4a6){if(_0x10d4a6&&_0x10d4a6[_0x44d0('0x5b')]){var _0x2fad9c=_0x10d4a6[_0x44d0('0x5c')]({'plain':!![]});fs[_0x44d0('0x5d')](_0x242ed7);for(var _0x518cb9=0x0;_0x518cb9<_0x2fad9c[_0x44d0('0x5b')]['length'];_0x518cb9++){var _0x37f78f=_0x2fad9c[_0x44d0('0x5b')][_0x518cb9][_0x44d0('0x5a')];if(_0x37f78f){var _0x577d43=path[_0x44d0('0x52')](_0x57373d,_0x37f78f[_0x44d0('0x5e')]);if(fs['existsSync'](_0x577d43)){fs[_0x44d0('0x5f')](_0x577d43)[_0x44d0('0x60')](fs[_0x44d0('0x61')](path[_0x44d0('0x52')](_0x242ed7,_0x37f78f['basename'])));}}}return BPromise['resolve']()[_0x44d0('0x16')](function(){return new BPromise(function(_0x47a832,_0x1abdd0){zipdir(_0x242ed7,{'saveTo':_0x212283},function(_0x45219e,_0x1706fd){if(_0x45219e)return _0x1abdd0(_0x45219e);return _0x47a832(_0x1706fd);});})[_0x44d0('0x16')](function(){return new BPromise(function(_0x5dd193,_0x514c96){rimraf(_0x242ed7,function(_0x17c09d){if(_0x17c09d)_0x514c96(_0x17c09d);return _0x5dd193();});});})['then'](function(){return _0x3e3a4f[_0x44d0('0x50')](_0x212283,_0xe0f5c1,function(_0xd9954b){if(_0xd9954b){console[_0x44d0('0x62')](_0x44d0('0x63'),_0xd9954b);}else{fs[_0x44d0('0x64')](_0x212283);}});});});}else{return _0x3e3a4f[_0x44d0('0xd')](0xc8);}})['catch'](handleError(_0x3e3a4f,null));}; \ No newline at end of file +var _0xe2c7=['create','body','find','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','push','Attachment','Messages','createdAt','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','zip-dir','moment','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','end','name','send','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','user','catch','params','query','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options'];(function(_0x5b3a3c,_0x4f5d7e){var _0x5b8add=function(_0x93362d){while(--_0x93362d){_0x5b3a3c['push'](_0x5b3a3c['shift']());}};_0x5b8add(++_0x4f5d7e);}(_0xe2c7,0x104));var _0x7e2c=function(_0x4a4d88,_0x2be95a){_0x4a4d88=_0x4a4d88-0x0;var _0x479329=_0xe2c7[_0x4a4d88];return _0x479329;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x7e2c('0x0'));var moment=require(_0x7e2c('0x1'));var BPromise=require('bluebird');var util=require(_0x7e2c('0x2'));var path=require(_0x7e2c('0x3'));var fs=require('fs');var _=require(_0x7e2c('0x4'));var Redis=require(_0x7e2c('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x7e2c('0x6'));var logger=require('../../config/logger')(_0x7e2c('0x7'));var config=require(_0x7e2c('0x8'));var db=require(_0x7e2c('0x9'))['db'];config[_0x7e2c('0xa')]=_[_0x7e2c('0xb')](config[_0x7e2c('0xa')],{'host':_0x7e2c('0xc'),'port':0x18eb});var socket=require(_0x7e2c('0xd'))(new Redis(config[_0x7e2c('0xa')]));require('./faxInteraction.socket')[_0x7e2c('0xe')](socket);function respondWithStatusCode(_0x4df7fb,_0x405f3b){_0x405f3b=_0x405f3b||0xcc;return function(_0x33c843){if(_0x33c843){return _0x4df7fb[_0x7e2c('0xf')](_0x405f3b);}return _0x4df7fb['status'](_0x405f3b)['end']();};}function respondWithResult(_0x1361e2,_0x3406cb){_0x3406cb=_0x3406cb||0xc8;return function(_0x1808e1){if(_0x1808e1){return _0x1361e2[_0x7e2c('0x10')](_0x3406cb)[_0x7e2c('0x11')](_0x1808e1);}};}function respondWithFilteredResult(_0x113a6b,_0xf72a33){return function(_0x27fadf){if(_0x27fadf){var _0x174ecc=typeof _0xf72a33[_0x7e2c('0x12')]==='undefined'&&typeof _0xf72a33['limit']===_0x7e2c('0x13');var _0x3e693a=_0x27fadf['count'];var _0x12fde4=_0x174ecc?0x0:_0xf72a33[_0x7e2c('0x12')];var _0x33d783=_0x174ecc?_0x27fadf[_0x7e2c('0x14')]:_0xf72a33[_0x7e2c('0x12')]+_0xf72a33[_0x7e2c('0x15')];var _0x3d58f3;if(_0x33d783>=_0x3e693a){_0x33d783=_0x3e693a;_0x3d58f3=0xc8;}else{_0x3d58f3=0xce;}_0x113a6b[_0x7e2c('0x10')](_0x3d58f3);return _0x113a6b[_0x7e2c('0x16')](_0x7e2c('0x17'),_0x12fde4+'-'+_0x33d783+'/'+_0x3e693a)[_0x7e2c('0x11')](_0x27fadf);}return null;};}function saveUpdates(_0x3534bc){return function(_0x3c9571){if(_0x3c9571){return _0x3c9571['update'](_0x3534bc)['then'](function(_0xdaec80){return _0xdaec80;});}return null;};}function removeEntity(_0x71c92c){return function(_0x42ef1d){if(_0x42ef1d){return _0x42ef1d[_0x7e2c('0x18')]()[_0x7e2c('0x19')](function(){_0x71c92c[_0x7e2c('0x10')](0xcc)[_0x7e2c('0x1a')]();});}};}function handleEntityNotFound(_0x29860a){return function(_0x1cb3d9){if(!_0x1cb3d9){_0x29860a[_0x7e2c('0xf')](0x194);}return _0x1cb3d9;};}function handleError(_0xd55b48,_0xf210d6){_0xf210d6=_0xf210d6||0x1f4;return function(_0x30822c){logger['error'](_0x30822c['stack']);if(_0x30822c[_0x7e2c('0x1b')]){delete _0x30822c[_0x7e2c('0x1b')];}_0xd55b48[_0x7e2c('0x10')](_0xf210d6)[_0x7e2c('0x1c')](_0x30822c);};}exports['index']=function(_0x285c83,_0x239bbd){var _0x18e9d6={};var _0x3058c5=_['map'](db[_0x7e2c('0x1d')][_0x7e2c('0x1e')],function(_0xb58977){return{'name':_0xb58977[_0x7e2c('0x1f')],'type':_0xb58977[_0x7e2c('0x20')][_0x7e2c('0x21')]};});_0x18e9d6=qs[_0x7e2c('0x22')](_0x3058c5,_0x285c83);return interaction[_0x7e2c('0x23')](_0x7e2c('0x24'),_0x285c83['query'],_0x285c83[_0x7e2c('0x25')],_0x18e9d6,_0x3058c5)['then'](respondWithFilteredResult(_0x239bbd,_0x18e9d6))[_0x7e2c('0x26')](handleError(_0x239bbd,null));};exports['show']=function(_0xa08b99,_0x42225c){var _0x1a828f={'raw':![],'where':{'id':_0xa08b99[_0x7e2c('0x27')]['id']}},_0x53ff12={};_0x53ff12['model']=_['keys'](db[_0x7e2c('0x1d')]['rawAttributes']);_0x53ff12[_0x7e2c('0x28')]=_[_0x7e2c('0x29')](_0xa08b99[_0x7e2c('0x28')]);_0x53ff12[_0x7e2c('0x2a')]=_[_0x7e2c('0x2b')](_0x53ff12[_0x7e2c('0x2c')],_0x53ff12['query']);_0x1a828f[_0x7e2c('0x2d')]=_[_0x7e2c('0x2b')](_0x53ff12[_0x7e2c('0x2c')],qs[_0x7e2c('0x2e')](_0xa08b99[_0x7e2c('0x28')][_0x7e2c('0x2e')]));_0x1a828f['attributes']=_0x1a828f[_0x7e2c('0x2d')][_0x7e2c('0x2f')]?_0x1a828f[_0x7e2c('0x2d')]:_0x53ff12[_0x7e2c('0x2c')];if(_0xa08b99[_0x7e2c('0x28')][_0x7e2c('0x30')]){_0x1a828f[_0x7e2c('0x31')]=[{'all':!![]}];}_0x1a828f=_[_0x7e2c('0x32')]({},_0x1a828f,_0xa08b99[_0x7e2c('0x33')]);return db['FaxInteraction']['find'](_0x1a828f)[_0x7e2c('0x19')](handleEntityNotFound(_0x42225c,null))[_0x7e2c('0x19')](respondWithResult(_0x42225c,null))[_0x7e2c('0x26')](handleError(_0x42225c,null));};exports[_0x7e2c('0x34')]=function(_0x45eb9e,_0x4a3eee){return db[_0x7e2c('0x1d')][_0x7e2c('0x34')](_0x45eb9e['body'],{})['then'](respondWithResult(_0x4a3eee,0xc9))[_0x7e2c('0x26')](handleError(_0x4a3eee,null));};exports['update']=function(_0x29cd23,_0x4742c5){if(_0x29cd23['body']['id']){delete _0x29cd23[_0x7e2c('0x35')]['id'];}return db['FaxInteraction'][_0x7e2c('0x36')]({'where':{'id':_0x29cd23[_0x7e2c('0x27')]['id']}})['then'](handleEntityNotFound(_0x4742c5,null))[_0x7e2c('0x19')](saveUpdates(_0x29cd23[_0x7e2c('0x35')],null))['then'](respondWithResult(_0x4742c5,null))['catch'](handleError(_0x4742c5,null));};exports[_0x7e2c('0x18')]=function(_0xba0438,_0x263a14){return db['FaxInteraction'][_0x7e2c('0x36')]({'where':{'id':_0xba0438[_0x7e2c('0x27')]['id']}})[_0x7e2c('0x19')](handleEntityNotFound(_0x263a14,null))[_0x7e2c('0x19')](removeEntity(_0x263a14,null))['catch'](handleError(_0x263a14,null));};exports[_0x7e2c('0x37')]=function(_0x5f5c18,_0x387409){return db[_0x7e2c('0x1d')]['describe']()[_0x7e2c('0x19')](respondWithResult(_0x387409,null))[_0x7e2c('0x26')](handleError(_0x387409,null));};exports[_0x7e2c('0x38')]=function(_0x138855,_0x244099){return db[_0x7e2c('0x39')]['find']({'where':{'id':_0x138855[_0x7e2c('0x27')]['id']}})[_0x7e2c('0x19')](handleEntityNotFound(_0x244099,null))['then'](function(_0x416d49){if(_0x416d49){return _0x416d49[_0x7e2c('0x38')](_0x138855[_0x7e2c('0x35')][_0x7e2c('0x3a')],_[_0x7e2c('0x3b')](_0x138855[_0x7e2c('0x35')],[_0x7e2c('0x3a'),'id'])||{});}})[_0x7e2c('0x19')](respondWithResult(_0x244099,null))['catch'](handleError(_0x244099,null));};exports[_0x7e2c('0x3c')]=function(_0x40f1a5,_0x62eade){var _0x483135={'raw':![],'where':{}};var _0xc80b2b={};var _0x3a8030={'count':0x0,'rows':[]};return db[_0x7e2c('0x1d')][_0x7e2c('0x3d')]({'where':{'id':_0x40f1a5['params']['id']}})[_0x7e2c('0x19')](handleEntityNotFound(_0x62eade,null))['then'](function(_0x7a2ad){if(_0x7a2ad){_0xc80b2b['model']=_[_0x7e2c('0x29')](db[_0x7e2c('0x39')][_0x7e2c('0x1e')]);_0xc80b2b[_0x7e2c('0x28')]=_[_0x7e2c('0x29')](_0x40f1a5[_0x7e2c('0x28')]);_0xc80b2b[_0x7e2c('0x2a')]=_[_0x7e2c('0x2b')](_0xc80b2b[_0x7e2c('0x2c')],_0xc80b2b[_0x7e2c('0x28')]);_0x483135[_0x7e2c('0x2d')]=_[_0x7e2c('0x2b')](_0xc80b2b[_0x7e2c('0x2c')],qs[_0x7e2c('0x2e')](_0x40f1a5[_0x7e2c('0x28')]['fields']));_0x483135[_0x7e2c('0x2d')]=_0x483135['attributes'][_0x7e2c('0x2f')]?_0x483135[_0x7e2c('0x2d')]:_0xc80b2b['model'];if(!_0x40f1a5['query'][_0x7e2c('0x3e')](_0x7e2c('0x3f'))){_0x483135[_0x7e2c('0x15')]=qs[_0x7e2c('0x15')](_0x40f1a5['query'][_0x7e2c('0x15')]);_0x483135['offset']=qs[_0x7e2c('0x12')](_0x40f1a5[_0x7e2c('0x28')][_0x7e2c('0x12')]);}_0x483135[_0x7e2c('0x40')]=qs[_0x7e2c('0x41')](_0x40f1a5[_0x7e2c('0x28')]['sort']);_0x483135[_0x7e2c('0x42')]=qs[_0x7e2c('0x2a')](_[_0x7e2c('0x43')](_0x40f1a5['query'],_0xc80b2b['filters']));_0x483135['where'][_0x7e2c('0x44')]=_0x7a2ad['id'];if(_0x40f1a5[_0x7e2c('0x28')][_0x7e2c('0x45')]){_0x483135[_0x7e2c('0x42')]=_[_0x7e2c('0x32')](_0x483135[_0x7e2c('0x42')],{'$or':_[_0x7e2c('0x46')](_0x483135['attributes'],function(_0x1f6e92){var _0x3df5ef={};_0x3df5ef[_0x1f6e92]={'$like':'%'+_0x40f1a5['query'][_0x7e2c('0x45')]+'%'};return _0x3df5ef;})});}if(_0x40f1a5[_0x7e2c('0x28')][_0x7e2c('0x47')]){var _0x1bc9a6=_0x40f1a5[_0x7e2c('0x28')][_0x7e2c('0x47')][_0x7e2c('0x48')](',');var _0x2f6072={};_0x2f6072[_0x1bc9a6[0x0]]={'$gte':moment(_0x1bc9a6[0x1])[_0x7e2c('0x49')](_0x7e2c('0x4a'))};_0x483135[_0x7e2c('0x42')]=_['merge'](_0x483135[_0x7e2c('0x42')],_0x2f6072);}_0x483135=_[_0x7e2c('0x32')]({},_0x483135,_0x40f1a5['options']);return db[_0x7e2c('0x39')][_0x7e2c('0x14')]({'where':_0x483135[_0x7e2c('0x42')]})[_0x7e2c('0x19')](function(_0x81f35c){_0x3a8030[_0x7e2c('0x14')]=_0x81f35c;if(_0x40f1a5[_0x7e2c('0x28')]['includeAll']){_0x483135[_0x7e2c('0x31')]=[{'all':!![]}];}return db[_0x7e2c('0x39')][_0x7e2c('0x23')](_0x483135);})[_0x7e2c('0x19')](function(_0x7f2c3d){_0x3a8030[_0x7e2c('0x4b')]=_0x7f2c3d;return _0x3a8030;});}})[_0x7e2c('0x19')](respondWithFilteredResult(_0x62eade,_0x483135))['catch'](handleError(_0x62eade,null));};exports[_0x7e2c('0x4c')]=function(_0x28f0bd,_0x846239){return db[_0x7e2c('0x1d')][_0x7e2c('0x36')]({'where':{'id':_0x28f0bd[_0x7e2c('0x27')]['id']}})['then'](handleEntityNotFound(_0x846239,null))['then'](function(_0x1d8065){if(_0x1d8065){return _0x1d8065[_0x7e2c('0x4d')](_0x28f0bd[_0x7e2c('0x35')][_0x7e2c('0x3a')],_[_0x7e2c('0x3b')](_0x28f0bd[_0x7e2c('0x35')],[_0x7e2c('0x3a'),'id'])||{})[_0x7e2c('0x4e')](function(){return db[_0x7e2c('0x4f')]['findAll']({'attributes':['id','name',_0x7e2c('0x50')],'where':{'id':_0x28f0bd[_0x7e2c('0x35')]['ids']}});})[_0x7e2c('0x19')](function(_0x211e24){socket['emit'](_0x7e2c('0x51'),{'id':Number(_0x28f0bd['params']['id']),'tags':_0x211e24||[]});return{'id':Number(_0x28f0bd['params']['id']),'tags':_0x211e24||[]};});}})[_0x7e2c('0x19')](respondWithResult(_0x846239,null))[_0x7e2c('0x26')](handleError(_0x846239,null));};exports['removeTags']=function(_0xedda8b,_0x3864ad){return db['FaxInteraction'][_0x7e2c('0x36')]({'where':{'id':_0xedda8b[_0x7e2c('0x27')]['id']}})[_0x7e2c('0x19')](handleEntityNotFound(_0x3864ad,null))['then'](function(_0x3ffe8a){if(_0x3ffe8a){return _0x3ffe8a[_0x7e2c('0x52')](_0xedda8b[_0x7e2c('0x28')][_0x7e2c('0x3a')]);}})[_0x7e2c('0x19')](respondWithStatusCode(_0x3864ad,null))['catch'](handleError(_0x3864ad,null));};exports[_0x7e2c('0x53')]=function(_0x17c2da,_0x4d129f){var _0x40ce1c=moment()[_0x7e2c('0x54')]()[_0x7e2c('0x55')]();var _0x189e29=path[_0x7e2c('0x56')](config[_0x7e2c('0x57')],_0x7e2c('0x58'),_0x7e2c('0x59'),'tmp');var _0x85da5d=path[_0x7e2c('0x56')](config[_0x7e2c('0x57')],_0x7e2c('0x58'),_0x7e2c('0x59'),_0x7e2c('0x5a'));var _0x3a0941=path[_0x7e2c('0x56')](_0x189e29,_0x40ce1c);var _0xb8026=util[_0x7e2c('0x49')]('transcript-%d-%s.zip',_0x17c2da[_0x7e2c('0x27')]['id'],_0x40ce1c);var _0x503996=path['join'](_0x189e29,_0xb8026);var _0x4d5f45=[];_0x4d5f45[_0x7e2c('0x5b')]({'model':db['Attachment'],'as':_0x7e2c('0x5c'),'raw':!![]});var _0x151bb5=[{'model':db[_0x7e2c('0x39')],'as':_0x7e2c('0x5d'),'attributes':['id',_0x7e2c('0x35'),_0x7e2c('0x5e')],'include':_0x4d5f45}];return db[_0x7e2c('0x1d')][_0x7e2c('0x36')]({'where':{'id':_0x17c2da['params']['id']},'include':_0x151bb5})[_0x7e2c('0x19')](handleEntityNotFound(_0x4d129f,null))[_0x7e2c('0x19')](function(_0x52e598){if(_0x52e598&&_0x52e598[_0x7e2c('0x5d')]){var _0x18df2d=_0x52e598['get']({'plain':!![]});fs[_0x7e2c('0x5f')](_0x3a0941);for(var _0x15bc79=0x0;_0x15bc79<_0x18df2d[_0x7e2c('0x5d')][_0x7e2c('0x2f')];_0x15bc79++){var _0x48370a=_0x18df2d[_0x7e2c('0x5d')][_0x15bc79][_0x7e2c('0x5c')];if(_0x48370a){var _0x2335ff=path[_0x7e2c('0x56')](_0x85da5d,_0x48370a['basename']);if(fs[_0x7e2c('0x60')](_0x2335ff)){fs[_0x7e2c('0x61')](_0x2335ff)[_0x7e2c('0x62')](fs[_0x7e2c('0x63')](path[_0x7e2c('0x56')](_0x3a0941,_0x48370a[_0x7e2c('0x64')])));}}}return BPromise['resolve']()[_0x7e2c('0x19')](function(){return new BPromise(function(_0x63cc07,_0x2aa94c){zipdir(_0x3a0941,{'saveTo':_0x503996},function(_0x479df8,_0x427b89){if(_0x479df8)return _0x2aa94c(_0x479df8);return _0x63cc07(_0x427b89);});})[_0x7e2c('0x19')](function(){return new BPromise(function(_0x9767b4,_0x5b2893){rimraf(_0x3a0941,function(_0x52c85a){if(_0x52c85a)_0x5b2893(_0x52c85a);return _0x9767b4();});});})[_0x7e2c('0x19')](function(){return _0x4d129f[_0x7e2c('0x53')](_0x503996,_0xb8026,function(_0x485250){if(_0x485250){console[_0x7e2c('0x65')](_0x7e2c('0x66'),_0x485250);}else{fs[_0x7e2c('0x67')](_0x503996);}});});});}else{return _0x4d129f[_0x7e2c('0xf')](0xc8);}})[_0x7e2c('0x26')](handleError(_0x4d129f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index b865b46..d2afca8 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 _0xc351=['FaxMessage','setMaxListeners','update','remove','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','../../mysqldb','FaxInteraction'];(function(_0xf5f608,_0x460a7a){var _0x26fd58=function(_0x471c75){while(--_0x471c75){_0xf5f608['push'](_0xf5f608['shift']());}};_0x26fd58(++_0x460a7a);}(_0xc351,0x19e));var _0x1c35=function(_0xc2634d,_0x3bed70){_0xc2634d=_0xc2634d-0x0;var _0x52afab=_0xc351[_0xc2634d];return _0x52afab;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1c35('0x0'))['db'][_0x1c35('0x1')];var FaxMessage=require(_0x1c35('0x0'))['db'][_0x1c35('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1c35('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1c35('0x4'),'afterDestroy':_0x1c35('0x5')};function emitEvent(_0x602a5f){return function(_0x2589cf,_0x6e7ba2,_0x37560e){_0x2589cf['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5d8fc4){_0x2589cf[_0x1c35('0x6')](_0x1c35('0x7'),_0x5d8fc4[_0x1c35('0x8')](function(_0x424a50){return{'id':_0x424a50['id']};}));return FaxMessage[_0x1c35('0x9')]({'where':{'FaxInteractionId':_0x2589cf['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x464809){_0x2589cf['setDataValue']('unreadMessages',_0x464809['length']);FaxInteractionEvents['emit'](_0x602a5f+':'+_0x2589cf['id'],_0x2589cf);FaxInteractionEvents[_0x1c35('0xa')](_0x602a5f,_0x2589cf);_0x37560e(null);})[_0x1c35('0xb')](_0x37560e(null));};}for(var e in events){if(events[_0x1c35('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xcd4a=['update','remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save'];(function(_0x34baf0,_0x3367fa){var _0x52a5f4=function(_0x382182){while(--_0x382182){_0x34baf0['push'](_0x34baf0['shift']());}};_0x52a5f4(++_0x3367fa);}(_0xcd4a,0x117));var _0xacd4=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xcd4a[_0x4ed4d2];return _0x15ae2e;};'use strict';var EventEmitter=require(_0xacd4('0x0'));var FaxInteraction=require(_0xacd4('0x1'))['db'][_0xacd4('0x2')];var FaxMessage=require(_0xacd4('0x1'))['db'][_0xacd4('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xacd4('0x4')](0x0);var events={'afterCreate':_0xacd4('0x5'),'afterUpdate':_0xacd4('0x6'),'afterDestroy':_0xacd4('0x7')};function emitEvent(_0x35bc16){return function(_0x1b41aa,_0x5c3be9,_0x3ff1ab){_0x1b41aa['getUsers']({'attributes':['id'],'raw':!![]})[_0xacd4('0x8')](function(_0x28d9c0){_0x1b41aa[_0xacd4('0x9')](_0xacd4('0xa'),_0x28d9c0[_0xacd4('0xb')](function(_0x1d3674){return{'id':_0x1d3674['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1b41aa['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x41b29b){_0x1b41aa[_0xacd4('0x9')](_0xacd4('0xc'),_0x41b29b[_0xacd4('0xd')]);FaxInteractionEvents[_0xacd4('0xe')](_0x35bc16+':'+_0x1b41aa['id'],_0x1b41aa);FaxInteractionEvents[_0xacd4('0xe')](_0x35bc16,_0x1b41aa);_0x3ff1ab(null);})[_0xacd4('0xf')](_0x3ff1ab(null));};}for(var e in events){if(events[_0xacd4('0x10')](e)){var event=events[e];FaxInteraction[_0xacd4('0x11')](e,emitEvent(event));}}module[_0xacd4('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index a066e4d..9d79089 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 _0xb486=['FaxInteraction','fax_interactions','changed','closed','closedAt','format','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x29dfa5,_0xd3078e){var _0x41c15a=function(_0x10802b){while(--_0x10802b){_0x29dfa5['push'](_0x29dfa5['shift']());}};_0x41c15a(++_0xd3078e);}(_0xb486,0x138));var _0x6b48=function(_0x4eabdf,_0xe159f6){_0x4eabdf=_0x4eabdf-0x0;var _0x29f266=_0xb486[_0x4eabdf];return _0x29f266;};'use strict';var _=require(_0x6b48('0x0'));var util=require(_0x6b48('0x1'));var logger=require('../../config/logger')(_0x6b48('0x2'));var moment=require(_0x6b48('0x3'));var BPromise=require(_0x6b48('0x4'));var rp=require(_0x6b48('0x5'));var fs=require('fs');var path=require(_0x6b48('0x6'));var rimraf=require(_0x6b48('0x7'));var config=require(_0x6b48('0x8'));var attributes=require(_0x6b48('0x9'));module[_0x6b48('0xa')]=function(_0x27a2ed,_0x40ae92){return _0x27a2ed[_0x6b48('0xb')](_0x6b48('0xc'),attributes,{'tableName':_0x6b48('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x468a1c,_0x5318f3,_0x187d78){if(_0x468a1c[_0x6b48('0xe')](_0x6b48('0xf'))){_0x468a1c[_0x6b48('0x10')]=moment()[_0x6b48('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x187d78(null,_0x468a1c);}}});}; \ No newline at end of file +var _0xacf4=['define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports'];(function(_0x20520f,_0x4bf423){var _0xf893fd=function(_0x35f8dc){while(--_0x35f8dc){_0x20520f['push'](_0x20520f['shift']());}};_0xf893fd(++_0x4bf423);}(_0xacf4,0xe7));var _0x4acf=function(_0x4a20b1,_0xeedabf){_0x4a20b1=_0x4a20b1-0x0;var _0x5afe3a=_0xacf4[_0x4a20b1];return _0x5afe3a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25d345,_0x50f5f4,_0x55f61d){if(_0x25d345[_0x4acf('0xc')]('closed')){_0x25d345[_0x4acf('0xd')]=moment()[_0x4acf('0xe')](_0x4acf('0xf'));}_0x55f61d(null,_0x25d345);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 15b2ebe..310c1ca 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 _0xb11c=['code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToFaxInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x295317,_0x46aebf){var _0x458246=function(_0x46f6ee){while(--_0x46f6ee){_0x295317['push'](_0x295317['shift']());}};_0x458246(++_0x46aebf);}(_0xb11c,0xc0));var _0xcb11=function(_0x5aa046,_0x73d090){_0x5aa046=_0x5aa046-0x0;var _0x31a7c7=_0xb11c[_0x5aa046];return _0x31a7c7;};'use strict';var _=require(_0xcb11('0x0'));var util=require(_0xcb11('0x1'));var moment=require(_0xcb11('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb11('0x3'));var fs=require('fs');var Redis=require(_0xcb11('0x4'));var db=require(_0xcb11('0x5'))['db'];var utils=require(_0xcb11('0x6'));var logger=require(_0xcb11('0x7'))('rpc');var config=require(_0xcb11('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcb11('0x9')]({'port':0x232a});config[_0xcb11('0xa')]=_[_0xcb11('0xb')](config[_0xcb11('0xa')],{'host':_0xcb11('0xc'),'port':0x18eb});var socket=require(_0xcb11('0xd'))(new Redis(config['redis']));require(_0xcb11('0xe'))[_0xcb11('0xf')](socket);function respondWithRpcPromise(_0x4b94ab,_0x675308,_0x38b69b){return new BPromise(function(_0x29d532,_0x14e847){return client[_0xcb11('0x10')](_0x4b94ab,_0x38b69b)['then'](function(_0x403659){logger[_0xcb11('0x11')](_0xcb11('0x12'),_0x675308,_0xcb11('0x13'));logger[_0xcb11('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x675308,_0xcb11('0x13'),JSON[_0xcb11('0x15')](_0x403659));if(_0x403659['error']){if(_0x403659[_0xcb11('0x16')][_0xcb11('0x17')]===0x1f4){logger[_0xcb11('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x675308,_0x403659['error'][_0xcb11('0x18')]);return _0x14e847(_0x403659[_0xcb11('0x16')][_0xcb11('0x18')]);}logger[_0xcb11('0x16')](_0xcb11('0x12'),_0x675308,_0x403659[_0xcb11('0x16')][_0xcb11('0x18')]);return _0x29d532(_0x403659[_0xcb11('0x16')][_0xcb11('0x18')]);}else{logger[_0xcb11('0x11')](_0xcb11('0x12'),_0x675308,_0xcb11('0x13'));_0x29d532(_0x403659[_0xcb11('0x19')]['message']);}})[_0xcb11('0x1a')](function(_0x21a0cd){logger[_0xcb11('0x16')](_0xcb11('0x12'),_0x675308,_0x21a0cd);_0x14e847(_0x21a0cd);});});}exports[_0xcb11('0x1b')]=function(_0x2cb5fa){var _0x33278e=this;return new Promise(function(_0x144fa4,_0x2fc9d0){return db[_0xcb11('0x1c')][_0xcb11('0x1d')](_0x2cb5fa[_0xcb11('0x1e')],{'raw':_0x2cb5fa[_0xcb11('0x1f')]?_0x2cb5fa[_0xcb11('0x1f')][_0xcb11('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cb5fa[_0xcb11('0x1f')]?_0x2cb5fa[_0xcb11('0x1f')][_0xcb11('0x21')]||null:null,'attributes':_0x2cb5fa[_0xcb11('0x1f')]?_0x2cb5fa[_0xcb11('0x1f')][_0xcb11('0x22')]||null:null,'limit':_0x2cb5fa[_0xcb11('0x1f')]?_0x2cb5fa[_0xcb11('0x1f')][_0xcb11('0x23')]||null:null})[_0xcb11('0x24')](function(_0x2cb393){logger[_0xcb11('0x11')](_0xcb11('0x1b'),_0x2cb5fa);logger[_0xcb11('0x14')](_0xcb11('0x1b'),_0x2cb5fa,JSON[_0xcb11('0x15')](_0x2cb393));_0x144fa4(_0x2cb393);})[_0xcb11('0x1a')](function(_0x2fc8f9){logger['error'](_0xcb11('0x1b'),_0x2fc8f9[_0xcb11('0x18')],_0x2cb5fa);_0x2fc9d0(_0x33278e['error'](0x1f4,_0x2fc8f9[_0xcb11('0x18')]));});});};exports[_0xcb11('0x25')]=function(_0xa8a548){return new Promise(function(_0x2f419c,_0x13521f){return db[_0xcb11('0x1c')][_0xcb11('0x26')]({'where':_0xa8a548['options']?_0xa8a548[_0xcb11('0x1f')][_0xcb11('0x21')]||null:null})['then'](function(_0x3f1274){if(_0x3f1274){return _0x3f1274[_0xcb11('0x27')](_0xa8a548[_0xcb11('0x1e')][_0xcb11('0x28')],_[_0xcb11('0x29')](_0xa8a548['body'],[_0xcb11('0x28'),'id'])||{});}})['spread'](function(_0x46805c){logger[_0xcb11('0x11')](_0xcb11('0x2a'),_0xa8a548);logger[_0xcb11('0x14')](_0xcb11('0x2a'),_0xa8a548,JSON['stringify'](_0x46805c));_0x2f419c(_0x46805c);})['catch'](function(_0x1ad9e2){logger['error'](_0xcb11('0x2a'),_0x1ad9e2[_0xcb11('0x18')],_0xa8a548);_0x13521f(_this['error'](0x1f4,_0x1ad9e2[_0xcb11('0x18')]));});});}; \ No newline at end of file +var _0x0294=['localhost','socket.io-emitter','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','limit','stringify','AddTagsToFaxInteraction','find','ids','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','redis'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x0294,0x89));var _0x4029=function(_0x5d275e,_0x3c595b){_0x5d275e=_0x5d275e-0x0;var _0x3462e1=_0x0294[_0x5d275e];return _0x3462e1;};'use strict';var _=require(_0x4029('0x0'));var util=require(_0x4029('0x1'));var moment=require('moment');var BPromise=require(_0x4029('0x2'));var rs=require(_0x4029('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4029('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4029('0x5'))(_0x4029('0x6'));var config=require('../../config/environment');var jayson=require(_0x4029('0x7'));var client=jayson['client'][_0x4029('0x8')]({'port':0x232a});config['redis']=_[_0x4029('0x9')](config[_0x4029('0xa')],{'host':_0x4029('0xb'),'port':0x18eb});var socket=require(_0x4029('0xc'))(new Redis(config[_0x4029('0xa')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5ea907,_0xb3f923,_0xa0121c){return new BPromise(function(_0x98e2b7,_0x4efdb5){return client['request'](_0x5ea907,_0xa0121c)[_0x4029('0xd')](function(_0x3fed7a){logger[_0x4029('0xe')](_0x4029('0xf'),_0xb3f923,_0x4029('0x10'));logger[_0x4029('0x11')](_0x4029('0x12'),_0xb3f923,'request\x20sent',JSON['stringify'](_0x3fed7a));if(_0x3fed7a['error']){if(_0x3fed7a[_0x4029('0x13')][_0x4029('0x14')]===0x1f4){logger[_0x4029('0x13')]('FaxInteraction,\x20%s,\x20%s',_0xb3f923,_0x3fed7a[_0x4029('0x13')][_0x4029('0x15')]);return _0x4efdb5(_0x3fed7a['error'][_0x4029('0x15')]);}logger[_0x4029('0x13')](_0x4029('0xf'),_0xb3f923,_0x3fed7a['error'][_0x4029('0x15')]);return _0x98e2b7(_0x3fed7a[_0x4029('0x13')]['message']);}else{logger[_0x4029('0xe')](_0x4029('0xf'),_0xb3f923,_0x4029('0x10'));_0x98e2b7(_0x3fed7a[_0x4029('0x16')]['message']);}})[_0x4029('0x17')](function(_0x2f9e7b){logger[_0x4029('0x13')](_0x4029('0xf'),_0xb3f923,_0x2f9e7b);_0x4efdb5(_0x2f9e7b);});});}exports[_0x4029('0x18')]=function(_0x7265d7){var _0x579176=this;return new Promise(function(_0x56ba8a,_0x51a4f6){return db[_0x4029('0x19')][_0x4029('0x1a')](_0x7265d7[_0x4029('0x1b')],{'raw':_0x7265d7[_0x4029('0x1c')]?_0x7265d7[_0x4029('0x1c')][_0x4029('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7265d7[_0x4029('0x1c')]?_0x7265d7[_0x4029('0x1c')][_0x4029('0x1e')]||null:null,'attributes':_0x7265d7[_0x4029('0x1c')]?_0x7265d7[_0x4029('0x1c')]['attributes']||null:null,'limit':_0x7265d7[_0x4029('0x1c')]?_0x7265d7[_0x4029('0x1c')][_0x4029('0x1f')]||null:null})[_0x4029('0xd')](function(_0x5226e9){logger[_0x4029('0xe')](_0x4029('0x18'),_0x7265d7);logger[_0x4029('0x11')](_0x4029('0x18'),_0x7265d7,JSON[_0x4029('0x20')](_0x5226e9));_0x56ba8a(_0x5226e9);})['catch'](function(_0x708d46){logger[_0x4029('0x13')](_0x4029('0x18'),_0x708d46[_0x4029('0x15')],_0x7265d7);_0x51a4f6(_0x579176['error'](0x1f4,_0x708d46['message']));});});};exports[_0x4029('0x21')]=function(_0x23dad0){return new Promise(function(_0x38ac49,_0x2fac26){return db[_0x4029('0x19')][_0x4029('0x22')]({'where':_0x23dad0['options']?_0x23dad0['options'][_0x4029('0x1e')]||null:null})[_0x4029('0xd')](function(_0x12aa8d){if(_0x12aa8d){return _0x12aa8d['addTags'](_0x23dad0[_0x4029('0x1b')][_0x4029('0x23')],_['omit'](_0x23dad0['body'],[_0x4029('0x23'),'id'])||{});}})['spread'](function(_0x316d37){logger[_0x4029('0xe')](_0x4029('0x24'),_0x23dad0);logger['debug'](_0x4029('0x24'),_0x23dad0,JSON['stringify'](_0x316d37));_0x38ac49(_0x316d37);})[_0x4029('0x17')](function(_0x32e014){logger[_0x4029('0x13')](_0x4029('0x24'),_0x32e014[_0x4029('0x15')],_0x23dad0);_0x2fac26(_this[_0x4029('0x13')](0x1f4,_0x32e014['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 1c02fcd..323ee44 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 _0x3b5f=['remove','update','emit','removeListener','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x5efc4c,_0x1c3244){var _0x2445b2=function(_0x277b47){while(--_0x277b47){_0x5efc4c['push'](_0x5efc4c['shift']());}};_0x2445b2(++_0x1c3244);}(_0x3b5f,0xa6));var _0xf3b5=function(_0x181164,_0x4cba0d){_0x181164=_0x181164-0x0;var _0x5be4f8=_0x3b5f[_0x181164];return _0x5be4f8;};'use strict';var FaxInteractionEvents=require(_0xf3b5('0x0'));var events=[_0xf3b5('0x1'),_0xf3b5('0x2'),_0xf3b5('0x3')];function createListener(_0xb477cb,_0x4460cd){return function(_0x5f13c3){_0x4460cd[_0xf3b5('0x4')](_0xb477cb,_0x5f13c3);};}function removeListener(_0x1372d1,_0x481265){return function(){FaxInteractionEvents[_0xf3b5('0x5')](_0x1372d1,_0x481265);};}exports['register']=function(_0x5600ce){for(var _0x523ebe=0x0,_0x454450=events[_0xf3b5('0x6')];_0x523ebe<_0x454450;_0x523ebe++){var _0x59b85d=events[_0x523ebe];var _0x10e402=createListener(_0xf3b5('0x7')+_0x59b85d,_0x5600ce);FaxInteractionEvents['on'](_0x59b85d,_0x10e402);}}; \ No newline at end of file +var _0x4574=['faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2eb9a6,_0x5f3991){var _0xe8b656=function(_0x1410b6){while(--_0x1410b6){_0x2eb9a6['push'](_0x2eb9a6['shift']());}};_0xe8b656(++_0x5f3991);}(_0x4574,0x91));var _0x4457=function(_0xd9bf93,_0x43cb74){_0xd9bf93=_0xd9bf93-0x0;var _0x532cfc=_0x4574[_0xd9bf93];return _0x532cfc;};'use strict';var FaxInteractionEvents=require(_0x4457('0x0'));var events=[_0x4457('0x1'),_0x4457('0x2'),_0x4457('0x3')];function createListener(_0x562803,_0x94d803){return function(_0x3de66e){_0x94d803[_0x4457('0x4')](_0x562803,_0x3de66e);};}function removeListener(_0x4b59f5,_0x330a59){return function(){FaxInteractionEvents[_0x4457('0x5')](_0x4b59f5,_0x330a59);};}exports[_0x4457('0x6')]=function(_0x2090eb){for(var _0x15a57c=0x0,_0x463033=events[_0x4457('0x7')];_0x15a57c<_0x463033;_0x15a57c++){var _0x36b4d7=events[_0x15a57c];var _0x438083=createListener(_0x4457('0x8')+_0x36b4d7,_0x2090eb);FaxInteractionEvents['on'](_0x36b4d7,_0x438083);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index e6b5573..b3208fb 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 _0x09d8=['faxinteraction:update','faxinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','tracked'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x09d8,0x1d5));var _0x809d=function(_0x3cf053,_0x7a9947){_0x3cf053=_0x3cf053-0x0;var _0x3b55a0=_0x09d8[_0x3cf053];return _0x3b55a0;};'use strict';var multer=require('multer');var util=require(_0x809d('0x0'));var path=require('path');var timeout=require(_0x809d('0x1'));var express=require(_0x809d('0x2'));var router=express[_0x809d('0x3')]();var fs_extra=require(_0x809d('0x4'));var auth=require(_0x809d('0x5'));var interaction=require(_0x809d('0x6'));var config=require(_0x809d('0x7'));var controller=require('./faxInteraction.controller');router[_0x809d('0x8')]('/',auth[_0x809d('0x9')](),controller['index']);router[_0x809d('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x809d('0xa'),auth['isAuthenticated'](),controller[_0x809d('0xb')]);router['get'](_0x809d('0xc'),auth['isAuthenticated'](),controller[_0x809d('0xd')]);router['get'](_0x809d('0xe'),auth[_0x809d('0x9')](),controller[_0x809d('0xf')]);router['post']('/',auth[_0x809d('0x9')](),controller[_0x809d('0x10')]);router[_0x809d('0x11')](_0x809d('0xc'),auth[_0x809d('0x9')](),controller[_0x809d('0x12')]);router[_0x809d('0x11')](_0x809d('0x13'),auth[_0x809d('0x9')](),interaction['tracked'](_0x809d('0x14'),_0x809d('0x15')),controller[_0x809d('0x16')]);router['put'](_0x809d('0xa'),auth[_0x809d('0x9')](),interaction[_0x809d('0x17')](_0x809d('0x14'),_0x809d('0x18')),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x809d('0x14'),_0x809d('0x19')),controller[_0x809d('0x1a')]);router['delete']('/:id/tags',auth[_0x809d('0x9')](),controller[_0x809d('0x1b')]);module[_0x809d('0x1c')]=router; \ No newline at end of file +var _0x42c8=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','fax','addTags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x42c8,0x12c));var _0x842c=function(_0x128d68,_0x555a32){_0x128d68=_0x128d68-0x0;var _0x24ad4d=_0x42c8[_0x128d68];return _0x24ad4d;};'use strict';var multer=require(_0x842c('0x0'));var util=require(_0x842c('0x1'));var path=require('path');var timeout=require(_0x842c('0x2'));var express=require(_0x842c('0x3'));var router=express['Router']();var fs_extra=require(_0x842c('0x4'));var auth=require(_0x842c('0x5'));var interaction=require(_0x842c('0x6'));var config=require(_0x842c('0x7'));var controller=require(_0x842c('0x8'));router[_0x842c('0x9')]('/',auth['isAuthenticated'](),controller[_0x842c('0xa')]);router[_0x842c('0x9')](_0x842c('0xb'),auth[_0x842c('0xc')](),controller[_0x842c('0xd')]);router['get'](_0x842c('0xe'),auth[_0x842c('0xc')](),controller[_0x842c('0xf')]);router[_0x842c('0x9')](_0x842c('0x10'),auth[_0x842c('0xc')](),controller[_0x842c('0x11')]);router['get'](_0x842c('0x12'),auth[_0x842c('0xc')](),controller[_0x842c('0x13')]);router[_0x842c('0x14')]('/',auth[_0x842c('0xc')](),controller[_0x842c('0x15')]);router[_0x842c('0x14')]('/:id/messages',auth[_0x842c('0xc')](),controller[_0x842c('0x16')]);router[_0x842c('0x14')](_0x842c('0x17'),auth['isAuthenticated'](),interaction['tracked'](_0x842c('0x18'),'faxinteraction:addtags'),controller[_0x842c('0x19')]);router[_0x842c('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x842c('0x1b')](_0x842c('0x18'),_0x842c('0x1c')),controller[_0x842c('0x1d')]);router[_0x842c('0x1e')]('/:id',auth[_0x842c('0xc')](),interaction[_0x842c('0x1b')]('fax',_0x842c('0x1f')),controller[_0x842c('0x20')]);router[_0x842c('0x1e')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x842c('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 0853459..eabdd3a 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 _0xa7b4=['DATE','exports','TEXT','BOOLEAN','ENUM'];(function(_0x1196b0,_0x36c47a){var _0x111c52=function(_0x5604c7){while(--_0x5604c7){_0x1196b0['push'](_0x1196b0['shift']());}};_0x111c52(++_0x36c47a);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x5612cf,_0x36d8b9){_0x5612cf=_0x5612cf-0x0;var _0x8b92bd=_0xa7b4[_0x5612cf];return _0x8b92bd;};'use strict';var Sequelize=require('sequelize');module[_0x4a7b('0x0')]={'body':{'type':Sequelize[_0x4a7b('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4a7b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4a7b('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x4a7b('0x4')]}}; \ No newline at end of file +var _0x2dae=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x5ec528,_0xe07bc5){var _0x4e6e60=function(_0x596c12){while(--_0x596c12){_0x5ec528['push'](_0x5ec528['shift']());}};_0x4e6e60(++_0xe07bc5);}(_0x2dae,0xc3));var _0xe2da=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x2dae[_0x142ec2];return _0x45ef4e;};'use strict';var Sequelize=require(_0xe2da('0x0'));module['exports']={'body':{'type':Sequelize[_0xe2da('0x1')](_0xe2da('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe2da('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe2da('0x4')]('in',_0xe2da('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xe2da('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe2da('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b440b42..38e022e 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 _0x8ae5=['Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','end','stack','name','send','FaxMessage','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','length','body','find','destroy','params','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','stringify','null','AcceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','interface','rejectmessage','CmContact','isNil'];(function(_0x2181dc,_0x6a8b82){var _0x2fe9a6=function(_0x56a028){while(--_0x56a028){_0x2181dc['push'](_0x2181dc['shift']());}};_0x2fe9a6(++_0x6a8b82);}(_0x8ae5,0x1ac));var _0x58ae=function(_0x52a133,_0x53f647){_0x52a133=_0x52a133-0x0;var _0x2157ab=_0x8ae5[_0x52a133];return _0x2157ab;};'use strict';var emlformat=require(_0x58ae('0x0'));var rimraf=require(_0x58ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58ae('0x2'));var rp=require(_0x58ae('0x3'));var moment=require('moment');var BPromise=require(_0x58ae('0x4'));var Mustache=require('mustache');var util=require(_0x58ae('0x5'));var path=require(_0x58ae('0x6'));var sox=require(_0x58ae('0x7'));var csv=require('to-csv');var ejs=require(_0x58ae('0x8'));var fs=require('fs');var fs_extra=require(_0x58ae('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x58ae('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x58ae('0xb'));var querystring=require(_0x58ae('0xc'));var Papa=require(_0x58ae('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x58ae('0xe'));var as=require(_0x58ae('0xf'));var hardwareService=require(_0x58ae('0x10'));var logger=require(_0x58ae('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x58ae('0x12'));var licenseUtil=require(_0x58ae('0x13'));var db=require(_0x58ae('0x14'))['db'];config[_0x58ae('0x15')]=_[_0x58ae('0x16')](config[_0x58ae('0x15')],{'host':_0x58ae('0x17'),'port':0x18eb});var socket=require(_0x58ae('0x18'))(new Redis(config[_0x58ae('0x15')]));require('./faxMessage.socket')[_0x58ae('0x19')](socket);var jayson=require(_0x58ae('0x1a'));var client=jayson[_0x58ae('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0x58ae('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x420387,_0x38c711,_0x3b9109,_0x56bb3b){return new BPromise(function(_0x30d23e,_0x59bd57){var _0x348c9c=_0x56bb3b||client;return _0x348c9c['request'](_0x420387,_0x3b9109)[_0x58ae('0x1d')](function(_0x22efd9){logger[_0x58ae('0x1e')](_0x58ae('0x1f'),_0x38c711,'request\x20sent');logger[_0x58ae('0x20')](_0x58ae('0x21'),_0x38c711,_0x58ae('0x22'),JSON['stringify'](_0x22efd9));if(_0x22efd9[_0x58ae('0x23')]){if(_0x22efd9['error'][_0x58ae('0x24')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x38c711,_0x22efd9[_0x58ae('0x23')][_0x58ae('0x25')]);return _0x59bd57(_0x22efd9['error'][_0x58ae('0x25')]);}logger['error'](_0x58ae('0x1f'),_0x38c711,_0x22efd9[_0x58ae('0x23')][_0x58ae('0x25')]);return _0x30d23e(_0x22efd9['error']['message']);}else{logger['info'](_0x58ae('0x1f'),_0x38c711,'request\x20sent');_0x30d23e(_0x22efd9[_0x58ae('0x26')][_0x58ae('0x25')]);}})[_0x58ae('0x27')](function(_0x15a0fc){logger['error'](_0x58ae('0x1f'),_0x38c711,_0x15a0fc);_0x59bd57(_0x15a0fc);});});}function respondWithStatusCode(_0xbc4d26,_0x3e6937){_0x3e6937=_0x3e6937||0xcc;return function(_0x1215a2){if(_0x1215a2){return _0xbc4d26[_0x58ae('0x28')](_0x3e6937);}return _0xbc4d26['status'](_0x3e6937)['end']();};}function respondWithResult(_0xf75b4e,_0x46a564){_0x46a564=_0x46a564||0xc8;return function(_0xc5252c){if(_0xc5252c){return _0xf75b4e[_0x58ae('0x29')](_0x46a564)['json'](_0xc5252c);}};}function respondWithFilteredResult(_0x138c89,_0x42abd4){return function(_0x50b027){if(_0x50b027){var _0x15faeb=typeof _0x42abd4[_0x58ae('0x2a')]===_0x58ae('0x2b')&&typeof _0x42abd4[_0x58ae('0x2c')]===_0x58ae('0x2b');var _0x458b8d=_0x50b027[_0x58ae('0x2d')];var _0x32c028=_0x15faeb?0x0:_0x42abd4[_0x58ae('0x2a')];var _0xe76a63=_0x15faeb?_0x50b027[_0x58ae('0x2d')]:_0x42abd4[_0x58ae('0x2a')]+_0x42abd4[_0x58ae('0x2c')];var _0x3545c7;if(_0xe76a63>=_0x458b8d){_0xe76a63=_0x458b8d;_0x3545c7=0xc8;}else{_0x3545c7=0xce;}_0x138c89['status'](_0x3545c7);return _0x138c89[_0x58ae('0x2e')]('Content-Range',_0x32c028+'-'+_0xe76a63+'/'+_0x458b8d)[_0x58ae('0x2f')](_0x50b027);}return null;};}function patchUpdates(_0x2fa158){return function(_0x2ed9f1){try{jsonpatch[_0x58ae('0x30')](_0x2ed9f1,_0x2fa158,!![]);}catch(_0x45bae2){return BPromise[_0x58ae('0x31')](_0x45bae2);}return _0x2ed9f1[_0x58ae('0x32')]();};}function saveUpdates(_0x475288,_0x44620e){return function(_0x45f590){if(_0x45f590){return _0x45f590[_0x58ae('0x33')](_0x475288)['then'](function(_0x111459){return _0x111459;});}return null;};}function removeEntity(_0x10aace,_0x5ddaab){return function(_0x1ed73b){if(_0x1ed73b){return _0x1ed73b['destroy']()[_0x58ae('0x1d')](function(){_0x10aace[_0x58ae('0x29')](0xcc)[_0x58ae('0x34')]();});}};}function handleEntityNotFound(_0x37d67d,_0x1979f1){return function(_0x498937){if(!_0x498937){_0x37d67d[_0x58ae('0x28')](0x194);}return _0x498937;};}function handleError(_0xd7061,_0xa4aa90){_0xa4aa90=_0xa4aa90||0x1f4;return function(_0x50c307){logger[_0x58ae('0x23')](_0x50c307[_0x58ae('0x35')]);if(_0x50c307[_0x58ae('0x36')]){delete _0x50c307[_0x58ae('0x36')];}_0xd7061[_0x58ae('0x29')](_0xa4aa90)[_0x58ae('0x37')](_0x50c307);};}exports['index']=function(_0x19015c,_0x2bded0){var _0x4088db={},_0x31679b={},_0x15e4e7={'count':0x0,'rows':[]};var _0x16da6b=_['map'](db[_0x58ae('0x38')]['rawAttributes'],function(_0x16b245){return{'name':_0x16b245[_0x58ae('0x39')],'type':_0x16b245[_0x58ae('0x3a')]['key']};});_0x31679b['model']=_['map'](_0x16da6b,'name');_0x31679b[_0x58ae('0x3b')]=_[_0x58ae('0x3c')](_0x19015c[_0x58ae('0x3b')]);_0x31679b[_0x58ae('0x3d')]=_[_0x58ae('0x3e')](_0x31679b[_0x58ae('0x3f')],_0x31679b[_0x58ae('0x3b')]);_0x4088db['attributes']=_[_0x58ae('0x3e')](_0x31679b[_0x58ae('0x3f')],qs['fields'](_0x19015c['query'][_0x58ae('0x40')]));_0x4088db['attributes']=_0x4088db[_0x58ae('0x41')]['length']?_0x4088db[_0x58ae('0x41')]:_0x31679b[_0x58ae('0x3f')];if(!_0x19015c[_0x58ae('0x3b')][_0x58ae('0x42')](_0x58ae('0x43'))){_0x4088db[_0x58ae('0x2c')]=qs[_0x58ae('0x2c')](_0x19015c['query']['limit']);_0x4088db[_0x58ae('0x2a')]=qs['offset'](_0x19015c['query'][_0x58ae('0x2a')]);}_0x4088db[_0x58ae('0x44')]=qs[_0x58ae('0x45')](_0x19015c[_0x58ae('0x3b')][_0x58ae('0x45')]);_0x4088db[_0x58ae('0x46')]=qs[_0x58ae('0x3d')](_[_0x58ae('0x47')](_0x19015c[_0x58ae('0x3b')],_0x31679b[_0x58ae('0x3d')]),_0x16da6b);if(_0x19015c[_0x58ae('0x3b')]['filter']){_0x4088db[_0x58ae('0x46')]=_['merge'](_0x4088db[_0x58ae('0x46')],{'$or':_['map'](_0x16da6b,function(_0x4d1cda){if(_0x4d1cda['type']!==_0x58ae('0x48')){var _0x5bde1c={};_0x5bde1c[_0x4d1cda[_0x58ae('0x36')]]={'$like':'%'+_0x19015c['query'][_0x58ae('0x49')]+'%'};return _0x5bde1c;}})});}_0x4088db=_[_0x58ae('0x4a')]({},_0x4088db,_0x19015c[_0x58ae('0x4b')]);var _0x320b8b={'where':_0x4088db[_0x58ae('0x46')]};return db[_0x58ae('0x38')]['count'](_0x320b8b)[_0x58ae('0x1d')](function(_0x1f7f9a){_0x15e4e7['count']=_0x1f7f9a;if(_0x19015c[_0x58ae('0x3b')][_0x58ae('0x4c')]){_0x4088db[_0x58ae('0x4d')]=[{'all':!![]}];}return db[_0x58ae('0x38')][_0x58ae('0x4e')](_0x4088db);})[_0x58ae('0x1d')](function(_0xaf7064){_0x15e4e7[_0x58ae('0x4f')]=_0xaf7064;return _0x15e4e7;})[_0x58ae('0x1d')](respondWithFilteredResult(_0x2bded0,_0x4088db))[_0x58ae('0x27')](handleError(_0x2bded0,null));};exports[_0x58ae('0x50')]=function(_0x4125b3,_0x5d24de){var _0x1ea8d6={'raw':!![],'where':{'id':_0x4125b3['params']['id']}},_0x3c6e7d={};_0x3c6e7d[_0x58ae('0x3f')]=_['keys'](db['FaxMessage'][_0x58ae('0x51')]);_0x3c6e7d['query']=_[_0x58ae('0x3c')](_0x4125b3[_0x58ae('0x3b')]);_0x3c6e7d[_0x58ae('0x3d')]=_[_0x58ae('0x3e')](_0x3c6e7d['model'],_0x3c6e7d[_0x58ae('0x3b')]);_0x1ea8d6[_0x58ae('0x41')]=_[_0x58ae('0x3e')](_0x3c6e7d[_0x58ae('0x3f')],qs[_0x58ae('0x40')](_0x4125b3[_0x58ae('0x3b')]['fields']));_0x1ea8d6[_0x58ae('0x41')]=_0x1ea8d6[_0x58ae('0x41')][_0x58ae('0x52')]?_0x1ea8d6[_0x58ae('0x41')]:_0x3c6e7d[_0x58ae('0x3f')];if(_0x4125b3[_0x58ae('0x3b')][_0x58ae('0x4c')]){_0x1ea8d6[_0x58ae('0x4d')]=[{'all':!![]}];}_0x1ea8d6=_[_0x58ae('0x4a')]({},_0x1ea8d6,_0x4125b3[_0x58ae('0x4b')]);return db[_0x58ae('0x38')]['find'](_0x1ea8d6)[_0x58ae('0x1d')](handleEntityNotFound(_0x5d24de,null))[_0x58ae('0x1d')](respondWithResult(_0x5d24de,null))[_0x58ae('0x27')](handleError(_0x5d24de,null));};exports[_0x58ae('0x33')]=function(_0x2cd30b,_0x59d1ad){if(_0x2cd30b[_0x58ae('0x53')]['id']){delete _0x2cd30b[_0x58ae('0x53')]['id'];}return db[_0x58ae('0x38')][_0x58ae('0x54')]({'where':{'id':_0x2cd30b['params']['id']}})[_0x58ae('0x1d')](handleEntityNotFound(_0x59d1ad,null))[_0x58ae('0x1d')](saveUpdates(_0x2cd30b[_0x58ae('0x53')],null))[_0x58ae('0x1d')](respondWithResult(_0x59d1ad,null))[_0x58ae('0x27')](handleError(_0x59d1ad,null));};exports[_0x58ae('0x55')]=function(_0x32c770,_0x5a26e6){return db[_0x58ae('0x38')][_0x58ae('0x54')]({'where':{'id':_0x32c770[_0x58ae('0x56')]['id']}})[_0x58ae('0x1d')](handleEntityNotFound(_0x5a26e6,null))[_0x58ae('0x1d')](removeEntity(_0x5a26e6,null))[_0x58ae('0x27')](handleError(_0x5a26e6,null));};exports[_0x58ae('0x57')]=function(_0x45f749,_0x335fc5){return db[_0x58ae('0x38')][_0x58ae('0x57')]()[_0x58ae('0x1d')](respondWithResult(_0x335fc5,null))[_0x58ae('0x27')](handleError(_0x335fc5,null));};var interaction_log=require(_0x58ae('0x11'))(_0x58ae('0x58'));exports[_0x58ae('0x59')]=function(_0x2ed43f,_0x385464,_0x49ebb1){var _0x72a06b={'agent':{},'channel':_0x58ae('0x5a')};if(_0x2ed43f[_0x58ae('0x53')]['id']){delete _0x2ed43f[_0x58ae('0x53')]['id'];}_0x2ed43f[_0x58ae('0x53')][_0x58ae('0x5b')]=!![];_0x2ed43f[_0x58ae('0x53')][_0x58ae('0x5c')]=moment()[_0x58ae('0x5d')](_0x58ae('0x5e'));_0x2ed43f['body'][_0x58ae('0x5f')]=_0x2ed43f[_0x58ae('0x53')]['UserId']||_0x2ed43f[_0x58ae('0x60')]['id'];_0x72a06b[_0x58ae('0x61')]['id']=_0x2ed43f[_0x58ae('0x53')]['UserId'];return db[_0x58ae('0x38')][_0x58ae('0x54')]({'where':{'id':_0x2ed43f[_0x58ae('0x56')]['id'],'UserId':null}})[_0x58ae('0x1d')](handleEntityNotFound(_0x385464,null))[_0x58ae('0x1d')](saveUpdates(_0x2ed43f['body'],null))[_0x58ae('0x1d')](function(_0x4ab848){if(_0x4ab848){_0x72a06b['message']=_0x4ab848[_0x58ae('0x62')]({'plain':!![]});return db[_0x58ae('0x63')][_0x58ae('0x54')]({'where':{'id':_0x4ab848[_0x58ae('0x64')]}});}return null;})[_0x58ae('0x1d')](handleEntityNotFound(_0x385464,null))['then'](function(_0x3a37a7){if(_0x3a37a7){return _0x3a37a7[_0x58ae('0x33')]({'UserId':_0x2ed43f[_0x58ae('0x53')][_0x58ae('0x5f')],'read1stAt':_['isNil'](_0x3a37a7[_0x58ae('0x65')])?moment()['format'](_0x58ae('0x5e')):undefined});}return null;})[_0x58ae('0x1d')](function(_0x34b3df){if(_0x34b3df){_0x72a06b['interaction']=_0x34b3df[_0x58ae('0x62')]({'plain':!![]});interaction_log[_0x58ae('0x1e')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ed43f['user']['id'],_0x2ed43f[_0x58ae('0x60')]['name'],_0x2ed43f[_0x58ae('0x60')]['role'],_0x72a06b[_0x58ae('0x66')]['id'],_0x2ed43f['body']?JSON[_0x58ae('0x67')](_0x2ed43f[_0x58ae('0x53')]):_0x58ae('0x68'));return respondWithRpcPromise(_0x58ae('0x69'),'acceptMessage',_0x72a06b);}return null;})[_0x58ae('0x1d')](function(_0x3f4c84){var _0x41657c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3f4c84[_0x58ae('0x25')][_0x58ae('0x6a')];return db[_0x58ae('0x6b')][_0x58ae('0x3b')](_0x41657c,{'type':db[_0x58ae('0x6c')]['QueryTypes'][_0x58ae('0x6d')],'raw':!![]})['then'](function(_0x33648d){return _0x33648d;});})[_0x58ae('0x1d')](function(_0x35224b){if(_0x35224b){_0x72a06b[_0x58ae('0x25')][_0x58ae('0x6e')]=_0x35224b[0x0];if(!_0x2ed43f[_0x58ae('0x53')][_0x58ae('0x5f')])return;return db[_0x58ae('0x6f')]['find']({'where':{'id':_0x2ed43f['body']['UserId'],'role':_0x58ae('0x61')},'attributes':['id',_0x58ae('0x36'),_0x58ae('0x70'),'email',_0x58ae('0x71')],'raw':!![]});}return null;})[_0x58ae('0x1d')](function(_0x5577a3){if(!_0x5577a3)return null;_0x72a06b[_0x58ae('0x25')][_0x58ae('0x61')]=_0x5577a3;return _0x72a06b;})[_0x58ae('0x1d')](function(_0x5c34af){if(_0x5c34af){if(_0x2ed43f[_0x58ae('0x53')][_0x58ae('0x72')]){_0x72a06b[_0x58ae('0x25')]['interface']=util['format'](_0x58ae('0x73'),_0x2ed43f[_0x58ae('0x60')][_0x58ae('0x36')]);_0x72a06b[_0x58ae('0x25')][_0x58ae('0x74')]=_0x72a06b[_0x58ae('0x74')];_0x72a06b[_0x58ae('0x25')][_0x58ae('0x75')]=_0x72a06b[_0x58ae('0x74')];_0x72a06b[_0x58ae('0x25')][_0x58ae('0x76')]=_0x58ae('0x59');return respondWithRpcPromise(_0x58ae('0x77'),'EventManager',{'event':'acceptmessage','message':_0x72a06b[_0x58ae('0x25')]},client9002)[_0x58ae('0x1d')](function(){return _0x72a06b;});}return _0x72a06b;}return null;})[_0x58ae('0x1d')](respondWithResult(_0x385464,null))[_0x58ae('0x27')](handleError(_0x385464,null));};var interaction_log=require(_0x58ae('0x11'))('fax-interactions');exports['reject']=function(_0x2150ad,_0x42db8e,_0x4449a4){var _0x5711d7={'agent':{},'channel':'fax'};if(_0x2150ad[_0x58ae('0x53')]['id']){delete _0x2150ad['body']['id'];}_0x2150ad[_0x58ae('0x53')]['UserId']=_0x2150ad[_0x58ae('0x53')][_0x58ae('0x5f')]||_0x2150ad[_0x58ae('0x60')]['id'];_0x5711d7[_0x58ae('0x61')]['id']=_0x2150ad[_0x58ae('0x53')][_0x58ae('0x5f')];return db['FaxMessage'][_0x58ae('0x54')]({'where':{'id':_0x2150ad[_0x58ae('0x56')]['id'],'UserId':null}})[_0x58ae('0x1d')](handleEntityNotFound(_0x42db8e,null))['then'](function(_0x4d6012){if(_0x4d6012){_0x5711d7[_0x58ae('0x25')]=_0x4d6012['get']({'plain':!![]});return db[_0x58ae('0x63')]['find']({'where':{'id':_0x4d6012['FaxInteractionId']}});}return null;})[_0x58ae('0x1d')](handleEntityNotFound(_0x42db8e,null))['then'](function(_0x481bea){if(_0x481bea){_0x5711d7[_0x58ae('0x66')]=_0x481bea[_0x58ae('0x62')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2150ad[_0x58ae('0x60')]['id'],_0x2150ad[_0x58ae('0x60')][_0x58ae('0x36')],_0x2150ad[_0x58ae('0x60')][_0x58ae('0x78')],_0x5711d7[_0x58ae('0x66')]['id'],_0x2150ad[_0x58ae('0x53')]?JSON[_0x58ae('0x67')](_0x2150ad['body']):'null');return respondWithRpcPromise('RejectMessage',_0x58ae('0x79'),_0x5711d7);}return null;})[_0x58ae('0x1d')](function(_0x33447d){var _0x14c5a2=_0x58ae('0x7a')+_0x33447d[_0x58ae('0x25')][_0x58ae('0x6a')];return db['sequelize'][_0x58ae('0x3b')](_0x14c5a2,{'type':db[_0x58ae('0x6c')]['QueryTypes']['SELECT'],'raw':!![]})[_0x58ae('0x1d')](function(_0x254c4c){return _0x254c4c;});})[_0x58ae('0x1d')](function(_0x17b9f2){if(_0x17b9f2){_0x5711d7['message'][_0x58ae('0x6e')]=_0x17b9f2[0x0];if(!_0x2150ad[_0x58ae('0x53')][_0x58ae('0x5f')])return;return db[_0x58ae('0x6f')]['find']({'where':{'id':_0x2150ad[_0x58ae('0x53')][_0x58ae('0x5f')],'role':_0x58ae('0x61')},'attributes':['id',_0x58ae('0x36'),'fullname',_0x58ae('0x7b'),_0x58ae('0x71')],'raw':!![]});}return null;})[_0x58ae('0x1d')](function(_0x14daf5){if(!_0x14daf5)return null;_0x5711d7[_0x58ae('0x25')][_0x58ae('0x61')]=_0x14daf5;return _0x5711d7;})[_0x58ae('0x1d')](function(_0x161610){if(_0x161610){_0x161610[_0x58ae('0x25')][_0x58ae('0x7c')]=util['format'](_0x58ae('0x73'),_0x2150ad['user'][_0x58ae('0x36')]);_0x161610['message'][_0x58ae('0x74')]=_0x5711d7[_0x58ae('0x74')];_0x161610[_0x58ae('0x25')][_0x58ae('0x75')]=_0x5711d7['channel'];_0x161610['message'][_0x58ae('0x76')]='reject';respondWithRpcPromise(_0x58ae('0x77'),'EventManager',{'event':_0x58ae('0x7d'),'message':_0x161610[_0x58ae('0x25')]},client9002);return _0x5711d7;}return null;})[_0x58ae('0x1d')](respondWithResult(_0x42db8e,null))[_0x58ae('0x27')](handleError(_0x42db8e,null));};exports['create']=function(_0x4ffcd5,_0x745d6){var _0x260a30;return db[_0x58ae('0x38')]['create'](_0x4ffcd5[_0x58ae('0x53')],{})[_0x58ae('0x1d')](function(_0x40602c){_0x260a30=_0x40602c;return db[_0x58ae('0x7e')]['findOne']({'where':{'id':_0x260a30[_0x58ae('0x6a')]}});})[_0x58ae('0x1d')](function(_0x4339eb){if(_[_0x58ae('0x7f')](_0x4339eb)){return;}else{_0x260a30[_0x58ae('0x5a')]=_0x4339eb[_0x58ae('0x5a')];return db[_0x58ae('0x80')]['findOne']({'where':{'id':_0x260a30[_0x58ae('0x81')]}});}})[_0x58ae('0x1d')](function(_0x16a157){return respondWithRpcPromise('SendFax',_0x58ae('0x82'),{'FaxAccountId':_[_0x58ae('0x7f')](_0x4ffcd5[_0x58ae('0x53')])?undefined:_0x4ffcd5[_0x58ae('0x53')][_0x58ae('0x83')],'path':_[_0x58ae('0x7f')](_0x16a157)?undefined:util[_0x58ae('0x5d')](_0x58ae('0x84'),_0x16a157[_0x58ae('0x85')]),'fax':_[_0x58ae('0x7f')](_0x260a30[_0x58ae('0x5a')])?undefined:_0x260a30[_0x58ae('0x5a')],'AttachmentId':_0x260a30[_0x58ae('0x81')]},client9002);})['then'](respondWithResult(_0x745d6,0xc9))[_0x58ae('0x27')](handleError(_0x745d6,null));};exports[_0x58ae('0x86')]=function(_0x4200a3,_0x252df8){var _0xaf161e=path[_0x58ae('0x87')](config[_0x58ae('0x88')],_0x58ae('0x89'),'files',_0x58ae('0x8a'));return db[_0x58ae('0x38')][_0x58ae('0x54')]({'where':{'id':_0x4200a3['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x252df8,null))[_0x58ae('0x1d')](function(_0x2e55f9){if(_0x2e55f9){return _0x252df8[_0x58ae('0x86')](path[_0x58ae('0x87')](_0xaf161e,_0x2e55f9['Attachment']['basename']));}})['catch'](handleError(_0x252df8,null));}; \ No newline at end of file +var _0x221d=['SendFax','FaxAccountId','basename','download','join','root','files','attachments','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','params','length','find','body','describe','fax-interactions','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','EventManager','acceptmessage','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','QueryTypes','User','agent','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId'];(function(_0x52b5a7,_0x36c83a){var _0x1b490f=function(_0x49ef48){while(--_0x49ef48){_0x52b5a7['push'](_0x52b5a7['shift']());}};_0x1b490f(++_0x36c83a);}(_0x221d,0x128));var _0xd221=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x221d[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0xd221('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd221('0x1'));var jsonpatch=require(_0xd221('0x2'));var rp=require(_0xd221('0x3'));var moment=require(_0xd221('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd221('0x5'));var util=require(_0xd221('0x6'));var path=require('path');var sox=require(_0xd221('0x7'));var csv=require(_0xd221('0x8'));var ejs=require(_0xd221('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd221('0xa'));var jsforce=require(_0xd221('0xb'));var deskjs=require(_0xd221('0xc'));var toCsv=require(_0xd221('0x8'));var querystring=require(_0xd221('0xd'));var Papa=require(_0xd221('0xe'));var Redis=require(_0xd221('0xf'));var authService=require(_0xd221('0x10'));var qs=require(_0xd221('0x11'));var as=require(_0xd221('0x12'));var hardwareService=require(_0xd221('0x13'));var logger=require(_0xd221('0x14'))(_0xd221('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd221('0x16'));var db=require(_0xd221('0x17'))['db'];config[_0xd221('0x18')]=_[_0xd221('0x19')](config[_0xd221('0x18')],{'host':_0xd221('0x1a'),'port':0x18eb});var socket=require(_0xd221('0x1b'))(new Redis(config['redis']));require(_0xd221('0x1c'))['register'](socket);var jayson=require(_0xd221('0x1d'));var client=jayson[_0xd221('0x1e')][_0xd221('0x1f')]({'port':0x232c});var client9002=jayson[_0xd221('0x1e')][_0xd221('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x51824c,_0x3eeada,_0x47f0c1,_0xf2586e){return new BPromise(function(_0x1bbd48,_0x3be2c3){var _0x4de972=_0xf2586e||client;return _0x4de972[_0xd221('0x20')](_0x51824c,_0x47f0c1)[_0xd221('0x21')](function(_0x427acc){logger[_0xd221('0x22')](_0xd221('0x23'),_0x3eeada,_0xd221('0x24'));logger[_0xd221('0x25')](_0xd221('0x26'),_0x3eeada,_0xd221('0x24'),JSON[_0xd221('0x27')](_0x427acc));if(_0x427acc[_0xd221('0x28')]){if(_0x427acc[_0xd221('0x28')][_0xd221('0x29')]===0x1f4){logger[_0xd221('0x28')](_0xd221('0x23'),_0x3eeada,_0x427acc[_0xd221('0x28')][_0xd221('0x2a')]);return _0x3be2c3(_0x427acc[_0xd221('0x28')]['message']);}logger[_0xd221('0x28')]('FaxMessage,\x20%s,\x20%s',_0x3eeada,_0x427acc[_0xd221('0x28')][_0xd221('0x2a')]);return _0x1bbd48(_0x427acc[_0xd221('0x28')][_0xd221('0x2a')]);}else{logger['info'](_0xd221('0x23'),_0x3eeada,_0xd221('0x24'));_0x1bbd48(_0x427acc[_0xd221('0x2b')]['message']);}})[_0xd221('0x2c')](function(_0x2c8dbe){logger[_0xd221('0x28')]('FaxMessage,\x20%s,\x20%s',_0x3eeada,_0x2c8dbe);_0x3be2c3(_0x2c8dbe);});});}function respondWithStatusCode(_0x4d3704,_0x134c33){_0x134c33=_0x134c33||0xcc;return function(_0xaa4750){if(_0xaa4750){return _0x4d3704[_0xd221('0x2d')](_0x134c33);}return _0x4d3704[_0xd221('0x2e')](_0x134c33)[_0xd221('0x2f')]();};}function respondWithResult(_0x174be8,_0x5963a2){_0x5963a2=_0x5963a2||0xc8;return function(_0x4761da){if(_0x4761da){return _0x174be8[_0xd221('0x2e')](_0x5963a2)[_0xd221('0x30')](_0x4761da);}};}function respondWithFilteredResult(_0x545814,_0x5b52e7){return function(_0x62ee65){if(_0x62ee65){var _0x2ab023=typeof _0x5b52e7[_0xd221('0x31')]==='undefined'&&typeof _0x5b52e7[_0xd221('0x32')]===_0xd221('0x33');var _0xdd1d59=_0x62ee65[_0xd221('0x34')];var _0x152ee0=_0x2ab023?0x0:_0x5b52e7[_0xd221('0x31')];var _0x224d3e=_0x2ab023?_0x62ee65[_0xd221('0x34')]:_0x5b52e7['offset']+_0x5b52e7[_0xd221('0x32')];var _0x357681;if(_0x224d3e>=_0xdd1d59){_0x224d3e=_0xdd1d59;_0x357681=0xc8;}else{_0x357681=0xce;}_0x545814['status'](_0x357681);return _0x545814['set'](_0xd221('0x35'),_0x152ee0+'-'+_0x224d3e+'/'+_0xdd1d59)['json'](_0x62ee65);}return null;};}function patchUpdates(_0x33b676){return function(_0x1190c0){try{jsonpatch[_0xd221('0x36')](_0x1190c0,_0x33b676,!![]);}catch(_0x2d9ff7){return BPromise[_0xd221('0x37')](_0x2d9ff7);}return _0x1190c0[_0xd221('0x38')]();};}function saveUpdates(_0x33d025,_0x33e4ec){return function(_0x2a953e){if(_0x2a953e){return _0x2a953e[_0xd221('0x39')](_0x33d025)[_0xd221('0x21')](function(_0x24f1f8){return _0x24f1f8;});}return null;};}function removeEntity(_0x5339ca,_0x38710a){return function(_0x31c35d){if(_0x31c35d){return _0x31c35d[_0xd221('0x3a')]()[_0xd221('0x21')](function(){_0x5339ca[_0xd221('0x2e')](0xcc)[_0xd221('0x2f')]();});}};}function handleEntityNotFound(_0x255c5d,_0x5b47f2){return function(_0x4591cd){if(!_0x4591cd){_0x255c5d['sendStatus'](0x194);}return _0x4591cd;};}function handleError(_0x271954,_0x80aa85){_0x80aa85=_0x80aa85||0x1f4;return function(_0x27c10e){logger[_0xd221('0x28')](_0x27c10e[_0xd221('0x3b')]);if(_0x27c10e[_0xd221('0x3c')]){delete _0x27c10e[_0xd221('0x3c')];}_0x271954['status'](_0x80aa85)['send'](_0x27c10e);};}exports[_0xd221('0x3d')]=function(_0x6c96b1,_0x2a7d9e){var _0x12228f={},_0xf8c18e={},_0x21086b={'count':0x0,'rows':[]};var _0x5605b5=_[_0xd221('0x3e')](db[_0xd221('0x3f')][_0xd221('0x40')],function(_0x23f776){return{'name':_0x23f776[_0xd221('0x41')],'type':_0x23f776[_0xd221('0x42')][_0xd221('0x43')]};});_0xf8c18e[_0xd221('0x44')]=_[_0xd221('0x3e')](_0x5605b5,_0xd221('0x3c'));_0xf8c18e['query']=_[_0xd221('0x45')](_0x6c96b1[_0xd221('0x46')]);_0xf8c18e[_0xd221('0x47')]=_['intersection'](_0xf8c18e[_0xd221('0x44')],_0xf8c18e['query']);_0x12228f[_0xd221('0x48')]=_[_0xd221('0x49')](_0xf8c18e[_0xd221('0x44')],qs[_0xd221('0x4a')](_0x6c96b1['query'][_0xd221('0x4a')]));_0x12228f[_0xd221('0x48')]=_0x12228f[_0xd221('0x48')]['length']?_0x12228f['attributes']:_0xf8c18e['model'];if(!_0x6c96b1[_0xd221('0x46')][_0xd221('0x4b')]('nolimit')){_0x12228f[_0xd221('0x32')]=qs[_0xd221('0x32')](_0x6c96b1[_0xd221('0x46')][_0xd221('0x32')]);_0x12228f['offset']=qs[_0xd221('0x31')](_0x6c96b1[_0xd221('0x46')][_0xd221('0x31')]);}_0x12228f[_0xd221('0x4c')]=qs['sort'](_0x6c96b1[_0xd221('0x46')][_0xd221('0x4d')]);_0x12228f['where']=qs[_0xd221('0x47')](_['pick'](_0x6c96b1[_0xd221('0x46')],_0xf8c18e[_0xd221('0x47')]),_0x5605b5);if(_0x6c96b1[_0xd221('0x46')][_0xd221('0x4e')]){_0x12228f[_0xd221('0x4f')]=_['merge'](_0x12228f[_0xd221('0x4f')],{'$or':_['map'](_0x5605b5,function(_0x5c8fd9){if(_0x5c8fd9[_0xd221('0x42')]!==_0xd221('0x50')){var _0x516310={};_0x516310[_0x5c8fd9[_0xd221('0x3c')]]={'$like':'%'+_0x6c96b1[_0xd221('0x46')][_0xd221('0x4e')]+'%'};return _0x516310;}})});}_0x12228f=_[_0xd221('0x51')]({},_0x12228f,_0x6c96b1[_0xd221('0x52')]);var _0x3ec1a9={'where':_0x12228f[_0xd221('0x4f')]};return db[_0xd221('0x3f')][_0xd221('0x34')](_0x3ec1a9)['then'](function(_0x35d215){_0x21086b['count']=_0x35d215;if(_0x6c96b1['query'][_0xd221('0x53')]){_0x12228f[_0xd221('0x54')]=[{'all':!![]}];}return db[_0xd221('0x3f')]['findAll'](_0x12228f);})[_0xd221('0x21')](function(_0x2f3e92){_0x21086b[_0xd221('0x55')]=_0x2f3e92;return _0x21086b;})[_0xd221('0x21')](respondWithFilteredResult(_0x2a7d9e,_0x12228f))['catch'](handleError(_0x2a7d9e,null));};exports[_0xd221('0x56')]=function(_0x3764ef,_0x17b516){var _0x352ee1={'raw':!![],'where':{'id':_0x3764ef[_0xd221('0x57')]['id']}},_0x48de35={};_0x48de35[_0xd221('0x44')]=_[_0xd221('0x45')](db['FaxMessage']['rawAttributes']);_0x48de35[_0xd221('0x46')]=_[_0xd221('0x45')](_0x3764ef[_0xd221('0x46')]);_0x48de35[_0xd221('0x47')]=_[_0xd221('0x49')](_0x48de35[_0xd221('0x44')],_0x48de35['query']);_0x352ee1[_0xd221('0x48')]=_[_0xd221('0x49')](_0x48de35[_0xd221('0x44')],qs[_0xd221('0x4a')](_0x3764ef['query'][_0xd221('0x4a')]));_0x352ee1[_0xd221('0x48')]=_0x352ee1[_0xd221('0x48')][_0xd221('0x58')]?_0x352ee1[_0xd221('0x48')]:_0x48de35['model'];if(_0x3764ef[_0xd221('0x46')][_0xd221('0x53')]){_0x352ee1[_0xd221('0x54')]=[{'all':!![]}];}_0x352ee1=_['merge']({},_0x352ee1,_0x3764ef['options']);return db[_0xd221('0x3f')][_0xd221('0x59')](_0x352ee1)[_0xd221('0x21')](handleEntityNotFound(_0x17b516,null))['then'](respondWithResult(_0x17b516,null))[_0xd221('0x2c')](handleError(_0x17b516,null));};exports[_0xd221('0x39')]=function(_0x36ccad,_0xec675){if(_0x36ccad['body']['id']){delete _0x36ccad[_0xd221('0x5a')]['id'];}return db[_0xd221('0x3f')][_0xd221('0x59')]({'where':{'id':_0x36ccad[_0xd221('0x57')]['id']}})[_0xd221('0x21')](handleEntityNotFound(_0xec675,null))['then'](saveUpdates(_0x36ccad[_0xd221('0x5a')],null))[_0xd221('0x21')](respondWithResult(_0xec675,null))[_0xd221('0x2c')](handleError(_0xec675,null));};exports['destroy']=function(_0x4c3395,_0x5610ac){return db[_0xd221('0x3f')][_0xd221('0x59')]({'where':{'id':_0x4c3395[_0xd221('0x57')]['id']}})[_0xd221('0x21')](handleEntityNotFound(_0x5610ac,null))['then'](removeEntity(_0x5610ac,null))[_0xd221('0x2c')](handleError(_0x5610ac,null));};exports[_0xd221('0x5b')]=function(_0x11881c,_0x3333af){return db[_0xd221('0x3f')][_0xd221('0x5b')]()['then'](respondWithResult(_0x3333af,null))[_0xd221('0x2c')](handleError(_0x3333af,null));};var interaction_log=require(_0xd221('0x14'))(_0xd221('0x5c'));exports[_0xd221('0x5d')]=function(_0x433615,_0x823ef,_0x178c7a){var _0x61dc54={'agent':{},'channel':'fax'};if(_0x433615['body']['id']){delete _0x433615['body']['id'];}_0x433615['body'][_0xd221('0x5e')]=!![];_0x433615['body']['readAt']=moment()['format'](_0xd221('0x5f'));_0x433615[_0xd221('0x5a')][_0xd221('0x60')]=_0x433615['body'][_0xd221('0x60')]||_0x433615[_0xd221('0x61')]['id'];_0x61dc54['agent']['id']=_0x433615[_0xd221('0x5a')]['UserId'];return db[_0xd221('0x3f')][_0xd221('0x59')]({'where':{'id':_0x433615['params']['id'],'UserId':null}})[_0xd221('0x21')](handleEntityNotFound(_0x823ef,null))[_0xd221('0x21')](saveUpdates(_0x433615[_0xd221('0x5a')],null))[_0xd221('0x21')](function(_0x20fd26){if(_0x20fd26){_0x61dc54[_0xd221('0x2a')]=_0x20fd26[_0xd221('0x62')]({'plain':!![]});return db[_0xd221('0x63')][_0xd221('0x59')]({'where':{'id':_0x20fd26[_0xd221('0x64')]}});}return null;})[_0xd221('0x21')](handleEntityNotFound(_0x823ef,null))[_0xd221('0x21')](function(_0x482598){if(_0x482598){return _0x482598[_0xd221('0x39')]({'UserId':_0x433615[_0xd221('0x5a')]['UserId'],'read1stAt':_[_0xd221('0x65')](_0x482598[_0xd221('0x66')])?moment()['format'](_0xd221('0x5f')):undefined});}return null;})['then'](function(_0x53c9a3){if(_0x53c9a3){_0x61dc54['interaction']=_0x53c9a3[_0xd221('0x62')]({'plain':!![]});interaction_log[_0xd221('0x22')](_0xd221('0x67'),_0x433615['user']['id'],_0x433615[_0xd221('0x61')]['name'],_0x433615[_0xd221('0x61')][_0xd221('0x68')],_0x61dc54[_0xd221('0x69')]['id'],_0x433615['body']?JSON[_0xd221('0x27')](_0x433615[_0xd221('0x5a')]):_0xd221('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xd221('0x6b'),_0x61dc54);}return null;})[_0xd221('0x21')](function(_0x2b92f2){var _0x280dc3=_0xd221('0x6c')+_0x2b92f2[_0xd221('0x2a')][_0xd221('0x6d')];return db[_0xd221('0x6e')]['query'](_0x280dc3,{'type':db[_0xd221('0x6f')]['QueryTypes'][_0xd221('0x70')],'raw':!![]})[_0xd221('0x21')](function(_0x17af03){return _0x17af03;});})[_0xd221('0x21')](function(_0x530880){if(_0x530880){_0x61dc54['message'][_0xd221('0x71')]=_0x530880[0x0];if(!_0x433615['body'][_0xd221('0x60')])return;return db['User'][_0xd221('0x59')]({'where':{'id':_0x433615[_0xd221('0x5a')][_0xd221('0x60')],'role':'agent'},'attributes':['id',_0xd221('0x3c'),_0xd221('0x72'),_0xd221('0x73'),_0xd221('0x74')],'raw':!![]});}return null;})[_0xd221('0x21')](function(_0x54f20e){if(!_0x54f20e)return null;_0x61dc54[_0xd221('0x2a')]['agent']=_0x54f20e;return _0x61dc54;})[_0xd221('0x21')](function(_0x2bf420){if(_0x2bf420){if(_0x433615[_0xd221('0x5a')]['manual']){_0x61dc54['message'][_0xd221('0x75')]=util[_0xd221('0x76')](_0xd221('0x77'),_0x433615[_0xd221('0x61')]['name']);_0x61dc54['message'][_0xd221('0x78')]=_0x61dc54['channel'];_0x61dc54[_0xd221('0x2a')][_0xd221('0x79')]=_0x61dc54[_0xd221('0x78')];_0x61dc54[_0xd221('0x2a')]['event']=_0xd221('0x5d');return respondWithRpcPromise(_0xd221('0x7a'),'EventManager',{'event':_0xd221('0x7b'),'message':_0x61dc54[_0xd221('0x2a')]},client9002)[_0xd221('0x21')](function(){return _0x61dc54;});}return _0x61dc54;}return null;})[_0xd221('0x21')](respondWithResult(_0x823ef,null))['catch'](handleError(_0x823ef,null));};var interaction_log=require(_0xd221('0x14'))(_0xd221('0x5c'));exports[_0xd221('0x37')]=function(_0x235ea1,_0x560a7d,_0xb10ffd){var _0x262448={'agent':{},'channel':_0xd221('0x7c')};if(_0x235ea1[_0xd221('0x5a')]['id']){delete _0x235ea1[_0xd221('0x5a')]['id'];}_0x235ea1[_0xd221('0x5a')][_0xd221('0x60')]=_0x235ea1['body'][_0xd221('0x60')]||_0x235ea1[_0xd221('0x61')]['id'];_0x262448['agent']['id']=_0x235ea1[_0xd221('0x5a')][_0xd221('0x60')];return db[_0xd221('0x3f')][_0xd221('0x59')]({'where':{'id':_0x235ea1['params']['id'],'UserId':null}})[_0xd221('0x21')](handleEntityNotFound(_0x560a7d,null))[_0xd221('0x21')](function(_0x43e30a){if(_0x43e30a){_0x262448['message']=_0x43e30a['get']({'plain':!![]});return db[_0xd221('0x63')]['find']({'where':{'id':_0x43e30a['FaxInteractionId']}});}return null;})[_0xd221('0x21')](handleEntityNotFound(_0x560a7d,null))[_0xd221('0x21')](function(_0x2aba2f){if(_0x2aba2f){_0x262448['interaction']=_0x2aba2f[_0xd221('0x62')]({'plain':!![]});interaction_log['info'](_0xd221('0x7d'),_0x235ea1['user']['id'],_0x235ea1[_0xd221('0x61')][_0xd221('0x3c')],_0x235ea1['user']['role'],_0x262448[_0xd221('0x69')]['id'],_0x235ea1[_0xd221('0x5a')]?JSON[_0xd221('0x27')](_0x235ea1[_0xd221('0x5a')]):_0xd221('0x6a'));return respondWithRpcPromise('RejectMessage',_0xd221('0x7e'),_0x262448);}return null;})['then'](function(_0x2d1739){var _0x6a51a2=_0xd221('0x6c')+_0x2d1739[_0xd221('0x2a')][_0xd221('0x6d')];return db[_0xd221('0x6e')][_0xd221('0x46')](_0x6a51a2,{'type':db[_0xd221('0x6f')][_0xd221('0x7f')]['SELECT'],'raw':!![]})[_0xd221('0x21')](function(_0x241587){return _0x241587;});})[_0xd221('0x21')](function(_0x508a93){if(_0x508a93){_0x262448[_0xd221('0x2a')][_0xd221('0x71')]=_0x508a93[0x0];if(!_0x235ea1['body'][_0xd221('0x60')])return;return db[_0xd221('0x80')][_0xd221('0x59')]({'where':{'id':_0x235ea1[_0xd221('0x5a')][_0xd221('0x60')],'role':_0xd221('0x81')},'attributes':['id','name','fullname',_0xd221('0x73'),_0xd221('0x74')],'raw':!![]});}return null;})[_0xd221('0x21')](function(_0x356dc8){if(!_0x356dc8)return null;_0x262448[_0xd221('0x2a')][_0xd221('0x81')]=_0x356dc8;return _0x262448;})[_0xd221('0x21')](function(_0x50cab3){if(_0x50cab3){_0x50cab3[_0xd221('0x2a')]['interface']=util['format'](_0xd221('0x77'),_0x235ea1['user']['name']);_0x50cab3[_0xd221('0x2a')][_0xd221('0x78')]=_0x262448[_0xd221('0x78')];_0x50cab3['message'][_0xd221('0x79')]=_0x262448[_0xd221('0x78')];_0x50cab3[_0xd221('0x2a')]['event']=_0xd221('0x37');respondWithRpcPromise(_0xd221('0x7a'),_0xd221('0x7a'),{'event':_0xd221('0x82'),'message':_0x50cab3['message']},client9002);return _0x262448;}return null;})['then'](respondWithResult(_0x560a7d,null))[_0xd221('0x2c')](handleError(_0x560a7d,null));};exports[_0xd221('0x83')]=function(_0x1e8ba2,_0x3c6faa){var _0x15f5ef;return db[_0xd221('0x3f')][_0xd221('0x83')](_0x1e8ba2[_0xd221('0x5a')],{})[_0xd221('0x21')](function(_0x1f250d){_0x15f5ef=_0x1f250d;return db[_0xd221('0x84')][_0xd221('0x85')]({'where':{'id':_0x15f5ef['ContactId']}});})[_0xd221('0x21')](function(_0xcf4439){if(_[_0xd221('0x65')](_0xcf4439)){return;}else{_0x15f5ef[_0xd221('0x7c')]=_0xcf4439['fax'];return db[_0xd221('0x86')][_0xd221('0x85')]({'where':{'id':_0x15f5ef[_0xd221('0x87')]}});}})[_0xd221('0x21')](function(_0x3711ca){return respondWithRpcPromise(_0xd221('0x88'),_0xd221('0x88'),{'FaxAccountId':_[_0xd221('0x65')](_0x1e8ba2[_0xd221('0x5a')])?undefined:_0x1e8ba2['body'][_0xd221('0x89')],'path':_[_0xd221('0x65')](_0x3711ca)?undefined:util[_0xd221('0x76')]('/var/opt/motion2/server/files/attachments/%s',_0x3711ca[_0xd221('0x8a')]),'fax':_[_0xd221('0x65')](_0x15f5ef[_0xd221('0x7c')])?undefined:_0x15f5ef[_0xd221('0x7c')],'AttachmentId':_0x15f5ef[_0xd221('0x87')]},client9002);})[_0xd221('0x21')](respondWithResult(_0x3c6faa,0xc9))[_0xd221('0x2c')](handleError(_0x3c6faa,null));};exports[_0xd221('0x8b')]=function(_0x23f9ce,_0x2da7d5){var _0x50bbf9=path[_0xd221('0x8c')](config[_0xd221('0x8d')],'server',_0xd221('0x8e'),_0xd221('0x8f'));return db[_0xd221('0x3f')][_0xd221('0x59')]({'where':{'id':_0x23f9ce[_0xd221('0x57')]['id']},'include':[{'model':db[_0xd221('0x86')],'as':_0xd221('0x86')}]})['then'](handleEntityNotFound(_0x2da7d5,null))['then'](function(_0x15199b){if(_0x15199b){return _0x2da7d5['download'](path['join'](_0x50bbf9,_0x15199b['Attachment'][_0xd221('0x8a')]));}})['catch'](handleError(_0x2da7d5,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c280280..47c9efa 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 _0x1ab1=['events','setMaxListeners','emit','hook','exports'];(function(_0x19a7d3,_0x487155){var _0x569a8e=function(_0x456e99){while(--_0x456e99){_0x19a7d3['push'](_0x19a7d3['shift']());}};_0x569a8e(++_0x487155);}(_0x1ab1,0x12c));var _0x11ab=function(_0x1c8985,_0x3ef0b3){_0x1c8985=_0x1c8985-0x0;var _0x466eab=_0x1ab1[_0x1c8985];return _0x466eab;};'use strict';var EventEmitter=require(_0x11ab('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x11ab('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x28a19c){return function(_0x4a6492,_0x1fc2bd,_0x363103){FaxMessageEvents[_0x11ab('0x2')](_0x28a19c+':'+_0x4a6492['id'],_0x4a6492);FaxMessageEvents[_0x11ab('0x2')](_0x28a19c,_0x4a6492);_0x363103(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x11ab('0x3')](e,emitEvent(event));}}module[_0x11ab('0x4')]=FaxMessageEvents; \ No newline at end of file +var _0xacc6=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','remove'];(function(_0x5e5c4c,_0x21abba){var _0x176148=function(_0x59522a){while(--_0x59522a){_0x5e5c4c['push'](_0x5e5c4c['shift']());}};_0x176148(++_0x21abba);}(_0xacc6,0x150));var _0x6acc=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0xacc6[_0x162780];return _0x1ea2dc;};'use strict';var EventEmitter=require(_0x6acc('0x0'));var FaxMessage=require(_0x6acc('0x1'))['db'][_0x6acc('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x6acc('0x3')](0x0);var events={'afterCreate':_0x6acc('0x4'),'afterUpdate':'update','afterDestroy':_0x6acc('0x5')};function emitEvent(_0x14a0d1){return function(_0x2ff2ff,_0x53dcdb,_0x148455){FaxMessageEvents['emit'](_0x14a0d1+':'+_0x2ff2ff['id'],_0x2ff2ff);FaxMessageEvents[_0x6acc('0x6')](_0x14a0d1,_0x2ff2ff);_0x148455(null);};}for(var e in events){if(events[_0x6acc('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x6acc('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index f4c8007..fbde1e6 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 _0x8b91=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error'];(function(_0x3f4416,_0x312741){var _0x5400d7=function(_0x505c3c){while(--_0x505c3c){_0x3f4416['push'](_0x3f4416['shift']());}};_0x5400d7(++_0x312741);}(_0x8b91,0x71));var _0x18b9=function(_0x59e60b,_0x15a05e){_0x59e60b=_0x59e60b-0x0;var _0x3d1f95=_0x8b91[_0x59e60b];return _0x3d1f95;};'use strict';var _=require(_0x18b9('0x0'));var util=require(_0x18b9('0x1'));var logger=require('../../config/logger')(_0x18b9('0x2'));var moment=require(_0x18b9('0x3'));var BPromise=require(_0x18b9('0x4'));var rp=require(_0x18b9('0x5'));var fs=require('fs');var path=require(_0x18b9('0x6'));var rimraf=require('rimraf');var config=require(_0x18b9('0x7'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x1bce28,_0x966e1e){return _0x1bce28[_0x18b9('0x8')](_0x18b9('0x9'),attributes,{'tableName':_0x18b9('0xa'),'paranoid':![],'indexes':[{'name':_0x18b9('0xb'),'fields':[_0x18b9('0xc')],'type':_0x18b9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28cd4a,_0x3c64d4,_0x3d417a){var _0x28d942=_0x1bce28[_0x18b9('0xe')];var _0xb4f7f6=_0x28cd4a['get']({'plain':!![]});if(_0xb4f7f6[_0x18b9('0xf')][_0x18b9('0x10')]()==='in'||_0xb4f7f6[_0x18b9('0xf')][_0x18b9('0x10')]()===_0x18b9('0x11')&&!_0xb4f7f6['secret']&&!_[_0x18b9('0x12')](_0xb4f7f6[_0x18b9('0x13')])){_0x28d942[_0x18b9('0x14')][_0x18b9('0x15')]({'where':{'id':_0xb4f7f6[_0x18b9('0x16')]}})[_0x18b9('0x17')](function(_0x17fada){if(_0x17fada){_0x17fada[_0x18b9('0x18')]({'lastMsgAt':_0xb4f7f6['createdAt'],'lastMsgDirection':_0xb4f7f6[_0x18b9('0xf')]['toLowerCase']()});}})[_0x18b9('0x19')](function(_0x5a9f29){console[_0x18b9('0x1a')](_0x5a9f29);});}_0x3d417a();}},'charset':'utf8mb4','collate':_0x18b9('0x1b')});}; \ No newline at end of file +var _0xef39=['UserId','findOne','then','update','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x5a843d,_0x43aa9f){var _0x2227bc=function(_0x221c7a){while(--_0x221c7a){_0x5a843d['push'](_0x5a843d['shift']());}};_0x2227bc(++_0x43aa9f);}(_0xef39,0x1ba));var _0x9ef3=function(_0x1f7f8e,_0x1e2df2){_0x1f7f8e=_0x1f7f8e-0x0;var _0x2ea3ae=_0xef39[_0x1f7f8e];return _0x2ea3ae;};'use strict';var _=require(_0x9ef3('0x0'));var util=require(_0x9ef3('0x1'));var logger=require('../../config/logger')(_0x9ef3('0x2'));var moment=require(_0x9ef3('0x3'));var BPromise=require(_0x9ef3('0x4'));var rp=require(_0x9ef3('0x5'));var fs=require('fs');var path=require(_0x9ef3('0x6'));var rimraf=require(_0x9ef3('0x7'));var config=require('../../config/environment');var attributes=require(_0x9ef3('0x8'));module[_0x9ef3('0x9')]=function(_0x266b2a,_0x10df48){return _0x266b2a[_0x9ef3('0xa')](_0x9ef3('0xb'),attributes,{'tableName':_0x9ef3('0xc'),'paranoid':![],'indexes':[{'name':_0x9ef3('0xd'),'fields':[_0x9ef3('0xe')],'type':_0x9ef3('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x341183,_0x24e183,_0x221540){var _0x22c05f=_0x266b2a[_0x9ef3('0x10')];var _0x48cf51=_0x341183[_0x9ef3('0x11')]({'plain':!![]});if(_0x48cf51[_0x9ef3('0x12')][_0x9ef3('0x13')]()==='in'||_0x48cf51['direction']['toLowerCase']()===_0x9ef3('0x14')&&!_0x48cf51[_0x9ef3('0x15')]&&!_['isNil'](_0x48cf51[_0x9ef3('0x16')])){_0x22c05f['FaxInteraction'][_0x9ef3('0x17')]({'where':{'id':_0x48cf51['FaxInteractionId']}})[_0x9ef3('0x18')](function(_0x3ef4b1){if(_0x3ef4b1){_0x3ef4b1[_0x9ef3('0x19')]({'lastMsgAt':_0x48cf51['createdAt'],'lastMsgDirection':_0x48cf51[_0x9ef3('0x12')][_0x9ef3('0x13')]()});}})[_0x9ef3('0x1a')](function(_0x10e9dd){console[_0x9ef3('0x1b')](_0x10e9dd);});}_0x221540();}},'charset':'utf8mb4','collate':_0x9ef3('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 1e2e6d0..0fd1a6c 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 _0xedd9=['create','body','raw','CreateFaxMessage','catch','FaxMessage','update','options','where','attributes','limit','UpdateFaxMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3b7dd0,_0xaefa1b){var _0x14802e=function(_0x46e9aa){while(--_0x46e9aa){_0x3b7dd0['push'](_0x3b7dd0['shift']());}};_0x14802e(++_0xaefa1b);}(_0xedd9,0xfc));var _0x9edd=function(_0x23f491,_0x44ecbd){_0x23f491=_0x23f491-0x0;var _0xef2c35=_0xedd9[_0x23f491];return _0xef2c35;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});config['redis']=_[_0x9edd('0xc')](config['redis'],{'host':_0x9edd('0xd'),'port':0x18eb});var socket=require(_0x9edd('0xe'))(new Redis(config[_0x9edd('0xf')]));require(_0x9edd('0x10'))['register'](socket);function respondWithRpcPromise(_0x494a24,_0x5d2f90,_0x2076fc){return new BPromise(function(_0x138767,_0x523026){return client[_0x9edd('0x11')](_0x494a24,_0x2076fc)[_0x9edd('0x12')](function(_0x5b6c00){logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x5d2f90,_0x9edd('0x15'));logger[_0x9edd('0x16')](_0x9edd('0x17'),_0x5d2f90,_0x9edd('0x15'),JSON[_0x9edd('0x18')](_0x5b6c00));if(_0x5b6c00[_0x9edd('0x19')]){if(_0x5b6c00['error'][_0x9edd('0x1a')]===0x1f4){logger[_0x9edd('0x19')](_0x9edd('0x14'),_0x5d2f90,_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x523026(_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);}logger[_0x9edd('0x19')]('FaxMessage,\x20%s,\x20%s',_0x5d2f90,_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x138767(_0x5b6c00[_0x9edd('0x19')]['message']);}else{logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x5d2f90,_0x9edd('0x15'));_0x138767(_0x5b6c00['result'][_0x9edd('0x1b')]);}})['catch'](function(_0x2cdcef){logger[_0x9edd('0x19')]('FaxMessage,\x20%s,\x20%s',_0x5d2f90,_0x2cdcef);_0x523026(_0x2cdcef);});});}exports['CreateFaxMessage']=function(_0x45c3ab){var _0x50338f=this;return new Promise(function(_0x27a95a,_0x54a03f){return db['FaxMessage'][_0x9edd('0x1c')](_0x45c3ab[_0x9edd('0x1d')],{'raw':_0x45c3ab['options']?_0x45c3ab['options'][_0x9edd('0x1e')]===undefined?!![]:![]:!![]})[_0x9edd('0x12')](function(_0x477878){logger['info'](_0x9edd('0x1f'),_0x45c3ab);logger[_0x9edd('0x16')](_0x9edd('0x1f'),_0x45c3ab,JSON[_0x9edd('0x18')](_0x477878));_0x27a95a(_0x477878);})[_0x9edd('0x20')](function(_0x4c75d2){logger[_0x9edd('0x19')](_0x9edd('0x1f'),_0x4c75d2[_0x9edd('0x1b')],_0x45c3ab);_0x54a03f(_0x50338f[_0x9edd('0x19')](0x1f4,_0x4c75d2[_0x9edd('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0x4b3d1b){var _0x3276ee=this;return new Promise(function(_0xfeca7b,_0x8d67aa){return db[_0x9edd('0x21')][_0x9edd('0x22')](_0x4b3d1b['body'],{'raw':_0x4b3d1b['options']?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b3d1b[_0x9edd('0x23')]?_0x4b3d1b['options'][_0x9edd('0x24')]||null:null,'attributes':_0x4b3d1b[_0x9edd('0x23')]?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x25')]||null:null,'limit':_0x4b3d1b['options']?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x26')]||null:null})[_0x9edd('0x12')](function(_0x12c1bc){logger[_0x9edd('0x13')](_0x9edd('0x27'),_0x4b3d1b);logger[_0x9edd('0x16')](_0x9edd('0x27'),_0x4b3d1b,JSON[_0x9edd('0x18')](_0x12c1bc));_0xfeca7b(_0x12c1bc);})[_0x9edd('0x20')](function(_0x4fd03f){logger[_0x9edd('0x19')](_0x9edd('0x27'),_0x4fd03f[_0x9edd('0x1b')],_0x4b3d1b);_0x8d67aa(_0x3276ee[_0x9edd('0x19')](0x1f4,_0x4fd03f['message']));});});}; \ No newline at end of file +var _0x9957=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','body','options','raw','CreateFaxMessage','catch','UpdateFaxMessage','FaxMessage','where','attributes','lodash'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_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 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});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('FaxMessage,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['CreateFaxMessage']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['FaxMessage']['create'](_0x3ec178[_0x7995('0x1c')],{'raw':_0x3ec178[_0x7995('0x1d')]?_0x3ec178[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![]})[_0x7995('0x12')](function(_0x1c278a){logger['info'](_0x7995('0x1f'),_0x3ec178);logger[_0x7995('0x15')](_0x7995('0x1f'),_0x3ec178,JSON[_0x7995('0x17')](_0x1c278a));_0x4cbe10(_0x1c278a);})[_0x7995('0x20')](function(_0x13bc35){logger[_0x7995('0x18')](_0x7995('0x1f'),_0x13bc35['message'],_0x3ec178);_0x3a9b54(_0x3d463e[_0x7995('0x18')](0x1f4,_0x13bc35[_0x7995('0x19')]));});});};exports[_0x7995('0x21')]=function(_0x268ce7){var _0x3a3fcf=this;return new Promise(function(_0x2a307e,_0x56691a){return db[_0x7995('0x22')]['update'](_0x268ce7[_0x7995('0x1c')],{'raw':_0x268ce7[_0x7995('0x1d')]?_0x268ce7[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options'][_0x7995('0x23')]||null:null,'attributes':_0x268ce7['options']?_0x268ce7[_0x7995('0x1d')][_0x7995('0x24')]||null:null,'limit':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options']['limit']||null:null})['then'](function(_0x3573be){logger[_0x7995('0x1a')](_0x7995('0x21'),_0x268ce7);logger[_0x7995('0x15')](_0x7995('0x21'),_0x268ce7,JSON[_0x7995('0x17')](_0x3573be));_0x2a307e(_0x3573be);})['catch'](function(_0x481c74){logger[_0x7995('0x18')]('UpdateFaxMessage',_0x481c74[_0x7995('0x19')],_0x268ce7);_0x56691a(_0x3a3fcf[_0x7995('0x18')](0x1f4,_0x481c74[_0x7995('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 900d39e..c4d4e59 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 _0xbd00=['./faxMessage.events','save','remove','update','emit','removeListener','register','length','faxMessage:'];(function(_0x312804,_0x5eb700){var _0x4550fe=function(_0x49f939){while(--_0x49f939){_0x312804['push'](_0x312804['shift']());}};_0x4550fe(++_0x5eb700);}(_0xbd00,0xea));var _0x0bd0=function(_0x3185ad,_0x5e5ca2){_0x3185ad=_0x3185ad-0x0;var _0x4f77fb=_0xbd00[_0x3185ad];return _0x4f77fb;};'use strict';var FaxMessageEvents=require(_0x0bd0('0x0'));var events=[_0x0bd0('0x1'),_0x0bd0('0x2'),_0x0bd0('0x3')];function createListener(_0x36b816,_0x1a1f0f){return function(_0xb2a253){_0x1a1f0f[_0x0bd0('0x4')](_0x36b816,_0xb2a253);};}function removeListener(_0x19eee0,_0x47b3c9){return function(){FaxMessageEvents[_0x0bd0('0x5')](_0x19eee0,_0x47b3c9);};}exports[_0x0bd0('0x6')]=function(_0x8464f5){for(var _0x182d60=0x0,_0x931b5a=events[_0x0bd0('0x7')];_0x182d60<_0x931b5a;_0x182d60++){var _0x404592=events[_0x182d60];var _0x1ad209=createListener(_0x0bd0('0x8')+_0x404592,_0x8464f5);FaxMessageEvents['on'](_0x404592,_0x1ad209);}}; \ No newline at end of file +var _0xbd38=['./faxMessage.events','save','remove','update','emit','removeListener','register','faxMessage:'];(function(_0x5149b8,_0x594385){var _0x4cf856=function(_0x261131){while(--_0x261131){_0x5149b8['push'](_0x5149b8['shift']());}};_0x4cf856(++_0x594385);}(_0xbd38,0x180));var _0x8bd3=function(_0x46ba75,_0x209d1f){_0x46ba75=_0x46ba75-0x0;var _0x20daaa=_0xbd38[_0x46ba75];return _0x20daaa;};'use strict';var FaxMessageEvents=require(_0x8bd3('0x0'));var events=[_0x8bd3('0x1'),_0x8bd3('0x2'),_0x8bd3('0x3')];function createListener(_0x5d3a11,_0x1a99e3){return function(_0x22c246){_0x1a99e3[_0x8bd3('0x4')](_0x5d3a11,_0x22c246);};}function removeListener(_0x151912,_0x457b67){return function(){FaxMessageEvents[_0x8bd3('0x5')](_0x151912,_0x457b67);};}exports[_0x8bd3('0x6')]=function(_0x4b0e53){for(var _0x110d83=0x0,_0x1e1932=events['length'];_0x110d83<_0x1e1932;_0x110d83++){var _0x4e6cf4=events[_0x110d83];var _0x49dcd7=createListener(_0x8bd3('0x7')+_0x4e6cf4,_0x4b0e53);FaxMessageEvents['on'](_0x4e6cf4,_0x49dcd7);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index b40d3e5..6b2fab2 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 _0x3667=['/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index'];(function(_0xe3c2de,_0x450b01){var _0x1a73d4=function(_0x382736){while(--_0x382736){_0xe3c2de['push'](_0xe3c2de['shift']());}};_0x1a73d4(++_0x450b01);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express['Router']();var fs_extra=require(_0x7366('0x5'));var auth=require(_0x7366('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7366('0x7'));var controller=require(_0x7366('0x8'));router[_0x7366('0x9')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xb')]);router['get'](_0x7366('0xc'),auth[_0x7366('0xa')](),controller[_0x7366('0xd')]);router[_0x7366('0x9')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0xf')]);router[_0x7366('0x9')](_0x7366('0x10'),auth[_0x7366('0xa')](),controller[_0x7366('0x11')]);router[_0x7366('0x12')]('/',auth[_0x7366('0xa')](),interaction[_0x7366('0x13')](_0x7366('0x14'),_0x7366('0x15')),controller[_0x7366('0x16')]);router[_0x7366('0x17')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0x18')]);router[_0x7366('0x17')](_0x7366('0x19'),auth[_0x7366('0xa')](),controller[_0x7366('0x1a')]);router[_0x7366('0x17')](_0x7366('0x1b'),auth[_0x7366('0xa')](),controller['reject']);router[_0x7366('0x1c')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0x1d')]);module[_0x7366('0x1e')]=router; \ No newline at end of file +var _0x39cb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','express'];(function(_0x485abd,_0x32c7c1){var _0x3379f1=function(_0x36b528){while(--_0x36b528){_0x485abd['push'](_0x485abd['shift']());}};_0x3379f1(++_0x32c7c1);}(_0x39cb,0x1bd));var _0xb39c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x39cb[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0xb39c('0x0'));var path=require(_0xb39c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb39c('0x2'));var router=express[_0xb39c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb39c('0x4'));var interaction=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var controller=require(_0xb39c('0x7'));router[_0xb39c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb39c('0x9')]);router[_0xb39c('0x8')](_0xb39c('0xa'),auth[_0xb39c('0xb')](),controller['describe']);router['get'](_0xb39c('0xc'),auth[_0xb39c('0xb')](),controller[_0xb39c('0xd')]);router[_0xb39c('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xb39c('0xe')]('/',auth[_0xb39c('0xb')](),interaction[_0xb39c('0xf')](_0xb39c('0x10'),_0xb39c('0x11')),controller[_0xb39c('0x12')]);router[_0xb39c('0x13')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x14')]);router[_0xb39c('0x13')](_0xb39c('0x15'),auth['isAuthenticated'](),controller[_0xb39c('0x16')]);router[_0xb39c('0x13')](_0xb39c('0x17'),auth[_0xb39c('0xb')](),controller[_0xb39c('0x18')]);router[_0xb39c('0x19')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x1a')]);module[_0xb39c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 9936693..3ea5651 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 _0xd535=['INTEGER','beepall','roundrobin','sequelize','exports'];(function(_0x156432,_0x55bc5a){var _0x7147bd=function(_0x332f54){while(--_0x332f54){_0x156432['push'](_0x156432['shift']());}};_0x7147bd(++_0x55bc5a);}(_0xd535,0x161));var _0x5d53=function(_0x307e60,_0x1eaaed){_0x307e60=_0x307e60-0x0;var _0x2759ce=_0xd535[_0x307e60];return _0x2759ce;};'use strict';var Sequelize=require(_0x5d53('0x0'));module[_0x5d53('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5d53('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x5d53('0x3'),_0x5d53('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x5d53('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa0f4=['exports','INTEGER','ENUM','rrmemory'];(function(_0x188ba5,_0x5b6ef1){var _0x221598=function(_0x4d006e){while(--_0x4d006e){_0x188ba5['push'](_0x188ba5['shift']());}};_0x221598(++_0x5b6ef1);}(_0xa0f4,0x1b4));var _0x4a0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0f4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x4a0f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4a0f('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4a0f('0x2')](_0x4a0f('0x3'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 0f8aacc..a3a7151 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 _0x397f=['isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','isArray','getAgents','options','eml-format','rimraf','moment','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','FaxQueues','error','stack','name','index','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','where','pick','filter','merge','map','VIRTUAL','include','findAll','catch','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','params','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','order','sort','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','format','getTeams','addTeams','ids','Team','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value'];(function(_0x154d09,_0x431816){var _0x51208d=function(_0x5841d3){while(--_0x5841d3){_0x154d09['push'](_0x154d09['shift']());}};_0x51208d(++_0x431816);}(_0x397f,0x119));var _0xf397=function(_0x5f5206,_0x3a06b9){_0x5f5206=_0x5f5206-0x0;var _0x26fdf7=_0x397f[_0x5f5206];return _0x26fdf7;};'use strict';var emlformat=require(_0xf397('0x0'));var rimraf=require(_0xf397('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf397('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf397('0x3'));var path=require(_0xf397('0x4'));var sox=require(_0xf397('0x5'));var csv=require('to-csv');var ejs=require(_0xf397('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf397('0x7'));var squel=require(_0xf397('0x8'));var crypto=require('crypto');var jsforce=require(_0xf397('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf397('0xa'));var querystring=require(_0xf397('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf397('0xc'));var qs=require(_0xf397('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf397('0xe'));var logger=require(_0xf397('0xf'))(_0xf397('0x10'));var utils=require(_0xf397('0x11'));var config=require(_0xf397('0x12'));var licenseUtil=require(_0xf397('0x13'));var db=require(_0xf397('0x14'))['db'];config[_0xf397('0x15')]=_[_0xf397('0x16')](config[_0xf397('0x15')],{'host':_0xf397('0x17'),'port':0x18eb});var socket=require(_0xf397('0x18'))(new Redis(config[_0xf397('0x15')]));require(_0xf397('0x19'))['register'](socket);function respondWithStatusCode(_0x342034,_0x3e862d){_0x3e862d=_0x3e862d||0xcc;return function(_0x11169c){if(_0x11169c){return _0x342034[_0xf397('0x1a')](_0x3e862d);}return _0x342034[_0xf397('0x1b')](_0x3e862d)[_0xf397('0x1c')]();};}function respondWithResult(_0x4ea3df,_0x5a4c42){_0x5a4c42=_0x5a4c42||0xc8;return function(_0x8c1d42){if(_0x8c1d42){return _0x4ea3df[_0xf397('0x1b')](_0x5a4c42)['json'](_0x8c1d42);}};}function respondWithFilteredResult(_0x2a6fb8,_0x45d765){return function(_0x14e3a9){if(_0x14e3a9){var _0x5eb6c6=typeof _0x45d765[_0xf397('0x1d')]===_0xf397('0x1e')&&typeof _0x45d765['limit']==='undefined';var _0x396fcb=_0x14e3a9[_0xf397('0x1f')];var _0xc88f06=_0x5eb6c6?0x0:_0x45d765[_0xf397('0x1d')];var _0x3e0f28=_0x5eb6c6?_0x14e3a9[_0xf397('0x1f')]:_0x45d765[_0xf397('0x1d')]+_0x45d765[_0xf397('0x20')];var _0x5530e4;if(_0x3e0f28>=_0x396fcb){_0x3e0f28=_0x396fcb;_0x5530e4=0xc8;}else{_0x5530e4=0xce;}_0x2a6fb8['status'](_0x5530e4);return _0x2a6fb8[_0xf397('0x21')](_0xf397('0x22'),_0xc88f06+'-'+_0x3e0f28+'/'+_0x396fcb)['json'](_0x14e3a9);}return null;};}function patchUpdates(_0x206a16){return function(_0x3eff42){try{jsonpatch['apply'](_0x3eff42,_0x206a16,!![]);}catch(_0x22d7d9){return BPromise[_0xf397('0x23')](_0x22d7d9);}return _0x3eff42[_0xf397('0x24')]();};}function saveUpdates(_0x1500df,_0x45222c){return function(_0x412fcf){if(_0x412fcf){return _0x412fcf[_0xf397('0x25')](_0x1500df)[_0xf397('0x26')](function(_0xbd22d){return _0xbd22d;});}return null;};}function removeEntity(_0x456616,_0xef5769){return function(_0x33665c){if(_0x33665c){return _0x33665c[_0xf397('0x27')]()[_0xf397('0x26')](function(){var _0x7470a3=_0x33665c[_0xf397('0x28')]({'plain':!![]});var _0x4133f8=_0xf397('0x29');return db['UserProfileResource'][_0xf397('0x27')]({'where':{'type':_0x4133f8,'resourceId':_0x7470a3['id']}})[_0xf397('0x26')](function(){return _0x33665c;});})[_0xf397('0x26')](function(){_0x456616[_0xf397('0x1b')](0xcc)[_0xf397('0x1c')]();});}};}function handleEntityNotFound(_0x601f23,_0x590678){return function(_0x5d10b8){if(!_0x5d10b8){_0x601f23[_0xf397('0x1a')](0x194);}return _0x5d10b8;};}function handleError(_0x502f00,_0x1496fb){_0x1496fb=_0x1496fb||0x1f4;return function(_0x4e5441){logger[_0xf397('0x2a')](_0x4e5441[_0xf397('0x2b')]);if(_0x4e5441['name']){delete _0x4e5441[_0xf397('0x2c')];}_0x502f00[_0xf397('0x1b')](_0x1496fb)['send'](_0x4e5441);};}exports[_0xf397('0x2d')]=function(_0x33356b,_0x557514){var _0x274a5b={},_0x4f9f03={},_0x401701={'count':0x0,'rows':[]};var _0x50da50=_['map'](db[_0xf397('0x2e')][_0xf397('0x2f')],function(_0x56c24e){return{'name':_0x56c24e[_0xf397('0x30')],'type':_0x56c24e[_0xf397('0x31')][_0xf397('0x32')]};});_0x4f9f03[_0xf397('0x33')]=_['map'](_0x50da50,_0xf397('0x2c'));_0x4f9f03[_0xf397('0x34')]=_[_0xf397('0x35')](_0x33356b[_0xf397('0x34')]);_0x4f9f03[_0xf397('0x36')]=_[_0xf397('0x37')](_0x4f9f03[_0xf397('0x33')],_0x4f9f03[_0xf397('0x34')]);_0x274a5b[_0xf397('0x38')]=_['intersection'](_0x4f9f03[_0xf397('0x33')],qs['fields'](_0x33356b[_0xf397('0x34')]['fields']));_0x274a5b['attributes']=_0x274a5b[_0xf397('0x38')][_0xf397('0x39')]?_0x274a5b[_0xf397('0x38')]:_0x4f9f03['model'];if(!_0x33356b[_0xf397('0x34')]['hasOwnProperty'](_0xf397('0x3a'))){_0x274a5b[_0xf397('0x20')]=qs['limit'](_0x33356b[_0xf397('0x34')][_0xf397('0x20')]);_0x274a5b[_0xf397('0x1d')]=qs[_0xf397('0x1d')](_0x33356b['query'][_0xf397('0x1d')]);}_0x274a5b['order']=qs['sort'](_0x33356b[_0xf397('0x34')]['sort']);_0x274a5b[_0xf397('0x3b')]=qs['filters'](_[_0xf397('0x3c')](_0x33356b[_0xf397('0x34')],_0x4f9f03[_0xf397('0x36')]),_0x50da50);if(_0x33356b[_0xf397('0x34')][_0xf397('0x3d')]){_0x274a5b[_0xf397('0x3b')]=_[_0xf397('0x3e')](_0x274a5b[_0xf397('0x3b')],{'$or':_[_0xf397('0x3f')](_0x50da50,function(_0x3da4d8){if(_0x3da4d8[_0xf397('0x31')]!==_0xf397('0x40')){var _0xca34e4={};_0xca34e4[_0x3da4d8[_0xf397('0x2c')]]={'$like':'%'+_0x33356b[_0xf397('0x34')][_0xf397('0x3d')]+'%'};return _0xca34e4;}})});}_0x274a5b=_['merge']({},_0x274a5b,_0x33356b['options']);var _0x4d3610={'where':_0x274a5b[_0xf397('0x3b')]};return db[_0xf397('0x2e')][_0xf397('0x1f')](_0x4d3610)[_0xf397('0x26')](function(_0x340f68){_0x401701['count']=_0x340f68;if(_0x33356b[_0xf397('0x34')]['includeAll']){_0x274a5b[_0xf397('0x41')]=[{'all':!![]}];}return db[_0xf397('0x2e')][_0xf397('0x42')](_0x274a5b);})[_0xf397('0x26')](function(_0x434f24){_0x401701['rows']=_0x434f24;return _0x401701;})[_0xf397('0x26')](respondWithFilteredResult(_0x557514,_0x274a5b))[_0xf397('0x43')](handleError(_0x557514,null));};exports['show']=function(_0x26a3e5,_0x57aaa7){var _0x50e54d={'raw':!![],'where':{'id':_0x26a3e5['params']['id']}},_0x4fd9ad={};_0x4fd9ad[_0xf397('0x33')]=_[_0xf397('0x35')](db[_0xf397('0x2e')][_0xf397('0x2f')]);_0x4fd9ad[_0xf397('0x34')]=_[_0xf397('0x35')](_0x26a3e5[_0xf397('0x34')]);_0x4fd9ad[_0xf397('0x36')]=_['intersection'](_0x4fd9ad['model'],_0x4fd9ad[_0xf397('0x34')]);_0x50e54d[_0xf397('0x38')]=_[_0xf397('0x37')](_0x4fd9ad[_0xf397('0x33')],qs[_0xf397('0x44')](_0x26a3e5[_0xf397('0x34')][_0xf397('0x44')]));_0x50e54d[_0xf397('0x38')]=_0x50e54d[_0xf397('0x38')][_0xf397('0x39')]?_0x50e54d['attributes']:_0x4fd9ad[_0xf397('0x33')];if(_0x26a3e5[_0xf397('0x34')][_0xf397('0x45')]){_0x50e54d[_0xf397('0x41')]=[{'all':!![]}];}_0x50e54d=_[_0xf397('0x3e')]({},_0x50e54d,_0x26a3e5['options']);return db[_0xf397('0x2e')][_0xf397('0x46')](_0x50e54d)[_0xf397('0x26')](handleEntityNotFound(_0x57aaa7,null))[_0xf397('0x26')](respondWithResult(_0x57aaa7,null))[_0xf397('0x43')](handleError(_0x57aaa7,null));};exports[_0xf397('0x47')]=function(_0x931c,_0x39e627){return db[_0xf397('0x2e')]['create'](_0x931c[_0xf397('0x48')],{})[_0xf397('0x26')](function(_0x5ecc6f){var _0x5239ef=_0x931c[_0xf397('0x49')][_0xf397('0x28')]({'plain':!![]});if(!_0x5239ef)throw new Error(_0xf397('0x4a'));if(_0x5239ef['role']===_0xf397('0x49')){var _0x4288ca=_0x5ecc6f[_0xf397('0x28')]({'plain':!![]});var _0x34f5d6=_0xf397('0x29');return db['UserProfileSection'][_0xf397('0x46')]({'where':{'name':_0x34f5d6,'userProfileId':_0x5239ef['userProfileId']},'raw':!![]})[_0xf397('0x26')](function(_0xadde0e){if(_0xadde0e&&_0xadde0e[_0xf397('0x4b')]===0x0){return db[_0xf397('0x4c')][_0xf397('0x47')]({'name':_0x4288ca[_0xf397('0x2c')],'resourceId':_0x4288ca['id'],'type':_0xadde0e[_0xf397('0x2c')],'sectionId':_0xadde0e['id']},{})[_0xf397('0x26')](function(){return _0x5ecc6f;});}else{return _0x5ecc6f;}})[_0xf397('0x43')](function(_0x4b8302){logger[_0xf397('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b8302);throw _0x4b8302;});}return _0x5ecc6f;})[_0xf397('0x26')](respondWithResult(_0x39e627,0xc9))[_0xf397('0x43')](handleError(_0x39e627,null));};exports['update']=function(_0x54c528,_0x1d4c9a){if(_0x54c528['body']['id']){delete _0x54c528[_0xf397('0x48')]['id'];}return db[_0xf397('0x2e')][_0xf397('0x46')]({'where':{'id':_0x54c528[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x1d4c9a,null))[_0xf397('0x26')](saveUpdates(_0x54c528['body'],null))[_0xf397('0x26')](respondWithResult(_0x1d4c9a,null))['catch'](handleError(_0x1d4c9a,null));};exports[_0xf397('0x27')]=function(_0x281a4d,_0x25e1ac){return db['FaxQueue']['find']({'where':{'id':_0x281a4d[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x25e1ac,null))[_0xf397('0x26')](removeEntity(_0x25e1ac,null))[_0xf397('0x43')](handleError(_0x25e1ac,null));};exports[_0xf397('0x4e')]=function(_0x34e843,_0x6983de){return db[_0xf397('0x2e')][_0xf397('0x4e')]()[_0xf397('0x26')](respondWithResult(_0x6983de,null))[_0xf397('0x43')](handleError(_0x6983de,null));};exports[_0xf397('0x4f')]=function(_0x17ebb8,_0x575b18,_0x3fbfe2){var _0x50c757={'raw':!![],'where':{}},_0x2decb3={},_0x19be40;return db['FaxQueue'][_0xf397('0x50')]({'where':{'id':_0x17ebb8['params']['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x575b18,null))[_0xf397('0x26')](function(_0x2c43f9){if(_0x2c43f9){_0x19be40=_0x2c43f9[_0xf397('0x28')]({'plain':!![]});_0x2decb3[_0xf397('0x33')]=_[_0xf397('0x35')](db[_0xf397('0x51')][_0xf397('0x2f')]);_0x2decb3[_0xf397('0x34')]=_[_0xf397('0x35')](_0x17ebb8[_0xf397('0x34')]);_0x2decb3[_0xf397('0x36')]=_[_0xf397('0x37')](_0x2decb3[_0xf397('0x33')],_0x2decb3['query']);_0x50c757[_0xf397('0x38')]=_['intersection'](_0x2decb3['model'],qs['fields'](_0x17ebb8['query'][_0xf397('0x44')]));_0x50c757[_0xf397('0x38')]=_0x50c757[_0xf397('0x38')][_0xf397('0x39')]?_0x50c757[_0xf397('0x38')]:_0x2decb3[_0xf397('0x33')];if(!_0x17ebb8[_0xf397('0x34')][_0xf397('0x52')](_0xf397('0x3a'))){_0x50c757['limit']=qs[_0xf397('0x20')](_0x17ebb8[_0xf397('0x34')][_0xf397('0x20')]);_0x50c757[_0xf397('0x1d')]=qs[_0xf397('0x1d')](_0x17ebb8['query'][_0xf397('0x1d')]);}_0x50c757[_0xf397('0x53')]=qs[_0xf397('0x54')](_0x17ebb8['query'][_0xf397('0x54')]);_0x50c757[_0xf397('0x3b')]=qs[_0xf397('0x36')](_[_0xf397('0x3c')](_0x17ebb8[_0xf397('0x34')],_0x2decb3[_0xf397('0x36')]));_0x50c757[_0xf397('0x3b')][_0xf397('0x55')]=_0x2c43f9['id'];if(_0x17ebb8['query']['filter']){_0x50c757[_0xf397('0x3b')]=_['merge'](_0x50c757['where'],{'$or':_[_0xf397('0x3f')](_0x50c757['attributes'],function(_0x4f4df3){var _0x431506={};_0x431506[_0x4f4df3]={'$like':'%'+_0x17ebb8['query'][_0xf397('0x3d')]+'%'};return _0x431506;})});}_0x50c757=_[_0xf397('0x3e')]({},_0x50c757,_0x17ebb8['options']);return db['UserFaxQueue']['findAll'](_0x50c757);}})[_0xf397('0x26')](function(_0x43ecf4){if(_0x43ecf4){return db[_0xf397('0x56')][_0xf397('0x57')]({'where':{'id':_[_0xf397('0x3f')](_0x43ecf4,_0xf397('0x58')),'role':_0xf397('0x59')},'attributes':['id',_0xf397('0x2c'),_0xf397('0x5a'),_0xf397('0x5b'),_0xf397('0x5c')]});}})[_0xf397('0x26')](function(_0x79419f){if(_0x79419f){return{'count':_0x79419f[_0xf397('0x1f')],'rows':_[_0xf397('0x3f')](_0x79419f[_0xf397('0x5d')],function(_0x4a202a){return{'membername':_0x4a202a[_0xf397('0x2c')],'UserId':_0x4a202a['id'],'queue_name':_0x19be40[_0xf397('0x2c')],'FaxQueueId':_0x19be40['id'],'interface':util[_0xf397('0x5e')]('%s/%s','SIP',_0x4a202a[_0xf397('0x2c')]),'penalty':0x0,'paused':_0x4a202a['faxPause'],'createdAt':_0x4a202a['createdAt'],'updatedAt':_0x4a202a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x575b18,_0x50c757))[_0xf397('0x43')](handleError(_0x575b18,null));};exports['getTeams']=function(_0x4cbfee,_0x252ff4,_0x4f64c9){var _0x169839={};var _0x3729d7={};var _0x57fa2c;var _0x23302e;return db[_0xf397('0x2e')][_0xf397('0x50')]({'where':{'id':_0x4cbfee[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x252ff4,null))[_0xf397('0x26')](function(_0x68859d){if(_0x68859d){_0x57fa2c=_0x68859d;_0x3729d7[_0xf397('0x33')]=_[_0xf397('0x35')](db['Team'][_0xf397('0x2f')]);_0x3729d7[_0xf397('0x34')]=_[_0xf397('0x35')](_0x4cbfee[_0xf397('0x34')]);_0x3729d7['filters']=_[_0xf397('0x37')](_0x3729d7[_0xf397('0x33')],_0x3729d7[_0xf397('0x34')]);_0x169839[_0xf397('0x38')]=_[_0xf397('0x37')](_0x3729d7[_0xf397('0x33')],qs[_0xf397('0x44')](_0x4cbfee[_0xf397('0x34')][_0xf397('0x44')]));_0x169839['attributes']=_0x169839[_0xf397('0x38')]['length']?_0x169839[_0xf397('0x38')]:_0x3729d7['model'];_0x169839[_0xf397('0x53')]=qs[_0xf397('0x54')](_0x4cbfee[_0xf397('0x34')][_0xf397('0x54')]);_0x169839[_0xf397('0x3b')]=qs[_0xf397('0x36')](_[_0xf397('0x3c')](_0x4cbfee[_0xf397('0x34')],_0x3729d7['filters']));if(_0x4cbfee['query'][_0xf397('0x3d')]){_0x169839[_0xf397('0x3b')]=_[_0xf397('0x3e')](_0x169839[_0xf397('0x3b')],{'$or':_[_0xf397('0x3f')](_0x169839[_0xf397('0x38')],function(_0x256e15){var _0x52a3f3={};_0x52a3f3[_0x256e15]={'$like':'%'+_0x4cbfee[_0xf397('0x34')]['filter']+'%'};return _0x52a3f3;})});}_0x169839=_[_0xf397('0x3e')]({},_0x169839,_0x4cbfee['options']);return _0x57fa2c[_0xf397('0x5f')](_0x169839);}})[_0xf397('0x26')](function(_0x8916ab){if(_0x8916ab){_0x23302e=_0x8916ab[_0xf397('0x39')];if(!_0x4cbfee[_0xf397('0x34')][_0xf397('0x52')](_0xf397('0x3a'))){_0x169839['limit']=qs['limit'](_0x4cbfee[_0xf397('0x34')][_0xf397('0x20')]);_0x169839[_0xf397('0x1d')]=qs['offset'](_0x4cbfee[_0xf397('0x34')]['offset']);}return _0x57fa2c[_0xf397('0x5f')](_0x169839);}})[_0xf397('0x26')](function(_0x2a404e){if(_0x2a404e){return _0x2a404e?{'count':_0x23302e,'rows':_0x2a404e}:null;}})['then'](respondWithResult(_0x252ff4,null))[_0xf397('0x43')](handleError(_0x252ff4,null));};exports[_0xf397('0x60')]=function(_0x36d672,_0x4b5456,_0x1b8741){var _0x3aa74d=_0x36d672[_0xf397('0x48')][_0xf397('0x61')];return db[_0xf397('0x62')]['findAll']({'where':{'id':_0x3aa74d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xf397('0x2c'),'online',_0xf397('0x63'),_0xf397('0x64')],'raw':!![]}]})[_0xf397('0x26')](function(_0x56ab66){if(_0x56ab66){var _0x4f5cd5=_[_0xf397('0x65')](_0x56ab66,function(_0x3553c7){var _0x3cc2aa=_0x3553c7['get']({'plain':!![]});return _0x3cc2aa[_0xf397('0x66')];});return db[_0xf397('0x2e')][_0xf397('0x46')]({'where':{'id':_0x36d672[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](function(_0x32f560){return db[_0xf397('0x67')][_0xf397('0x68')](function(_0x3a0b3b){return _0x32f560[_0xf397('0x60')](_0x3aa74d,{'transaction':_0x3a0b3b})['then'](function(){return BPromise[_0xf397('0x69')](_0x4f5cd5,function(_0x3161ab){return db[_0xf397('0x51')][_0xf397('0x6a')]({'where':{'UserId':_0x3161ab['id'],'FaxQueueId':_0x36d672[_0xf397('0x4d')]['id']},'transaction':_0x3a0b3b});});})[_0xf397('0x26')](function(){_0x4f5cd5[_0xf397('0x6b')](function(_0x144045){socket['emit'](_0xf397('0x6c'),{'UserId':_0x144045['id'],'FaxQueueId':_0x32f560['id']});});});});});}})[_0xf397('0x26')](respondWithStatusCode(_0x4b5456,null))[_0xf397('0x43')](handleError(_0x4b5456,null));};exports[_0xf397('0x6d')]=function(_0x44fca0,_0x5cd1be,_0x4c6e91){return db[_0xf397('0x62')][_0xf397('0x42')]({'where':{'id':_0x44fca0[_0xf397('0x34')][_0xf397('0x61')]},'attributes':['id'],'include':[{'model':db[_0xf397('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf397('0x26')](handleEntityNotFound(_0x5cd1be,null))[_0xf397('0x26')](function(_0x39e8c3){var _0x45b612=_[_0xf397('0x3f')](_0x39e8c3,'id');var _0x3ceee0=[];var _0x55da1d=[];var _0xe9dec0=squel[_0xf397('0x6e')]();_0xe9dec0['field']('tq.TeamId')[_0xf397('0x6f')](_0xf397('0x70'),'tq')[_0xf397('0x71')](_0xf397('0x72'),'ut',_0xf397('0x73'))[_0xf397('0x3b')](_0xf397('0x74'),_0x44fca0[_0xf397('0x4d')]['id']);for(var _0x2019a2=0x0;_0x2019a2<_0x39e8c3['length'];_0x2019a2+=0x1){let _0x33e5ad=_0x39e8c3[_0x2019a2];for(var _0x577843=0x0;_0x577843<_0x33e5ad[_0xf397('0x66')][_0xf397('0x39')];_0x577843+=0x1){let _0x901efa=_0x33e5ad['Agents'][_0x577843];var _0x4f1779=_0xe9dec0['clone']();_0x4f1779[_0xf397('0x3b')]('ut.UserId\x20=\x20?',_0x901efa['id']);_0x55da1d[_0xf397('0x75')](db[_0xf397('0x67')][_0xf397('0x34')](_0x4f1779['toString'](),{'type':db[_0xf397('0x67')][_0xf397('0x76')][_0xf397('0x77')]})[_0xf397('0x26')](function(_0x5e0bd5){if(_0x5e0bd5['length']===0x1){return _0x901efa['id'];}else{var _0x546f39=_[_0xf397('0x78')](_[_0xf397('0x3f')](_0x5e0bd5,_0xf397('0x79')),function(_0x4c2abe){return _[_0xf397('0x7a')](_0x45b612,_0x4c2abe);});if(_0x546f39){return _0x901efa['id'];}}}));}}return BPromise[_0xf397('0x7b')](_0x55da1d)['then'](function(_0x2cba42){_0x3ceee0=_(_0x3ceee0)[_0xf397('0x7c')](_0x2cba42)[_0xf397('0x7d')]()[_0xf397('0x7e')]();return db['FaxQueue'][_0xf397('0x46')]({'where':{'id':_0x44fca0[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](function(_0x28e499){return db[_0xf397('0x67')]['transaction'](function(_0x33a4d5){return _0x28e499[_0xf397('0x6d')](_0x44fca0[_0xf397('0x34')]['ids'],{'transaction':_0x33a4d5})[_0xf397('0x26')](function(){if(!_[_0xf397('0x7f')](_0x3ceee0)){return _0x28e499[_0xf397('0x80')](_0x3ceee0,{'transaction':_0x33a4d5});}})[_0xf397('0x26')](function(){_0x3ceee0[_0xf397('0x6b')](function(_0x562cee){socket[_0xf397('0x81')](_0xf397('0x82'),{'UserId':_0x562cee,'FaxQueueId':_0x28e499['id']});});});});});});})['then'](respondWithStatusCode(_0x5cd1be,null))[_0xf397('0x43')](handleError(_0x5cd1be,null));};exports[_0xf397('0x83')]=function(_0x32e1c8,_0x12588c,_0x2603d7){return db[_0xf397('0x2e')][_0xf397('0x46')]({'where':{'id':_0x32e1c8[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x12588c,null))[_0xf397('0x26')](function(_0x43a700){if(_0x43a700){return _0x43a700['addAgents'](_0x32e1c8['body'][_0xf397('0x61')],_[_0xf397('0x84')](_0x32e1c8[_0xf397('0x48')],['ids','id'])||{})['spread'](function(_0x406833){for(var _0x24b5f1=0x0;_0x24b5f1<_0x32e1c8[_0xf397('0x48')][_0xf397('0x61')][_0xf397('0x39')];_0x24b5f1+=0x1){socket[_0xf397('0x81')](_0xf397('0x6c'),{'UserId':Number(_0x32e1c8[_0xf397('0x48')][_0xf397('0x61')][_0x24b5f1]),'FaxQueueId':Number(_0x32e1c8[_0xf397('0x4d')]['id'])});}return _0x406833;});}})['then'](respondWithResult(_0x12588c,null))['catch'](handleError(_0x12588c,null));};exports[_0xf397('0x80')]=function(_0x3dd900,_0x9c3e4f,_0x5dcece){return db[_0xf397('0x2e')][_0xf397('0x46')]({'where':{'id':_0x3dd900[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x9c3e4f,null))[_0xf397('0x26')](function(_0x190229){if(_0x190229){return _0x190229[_0xf397('0x80')](_0x3dd900['query']['ids'])['then'](function(){if(_[_0xf397('0x85')](_0x3dd900[_0xf397('0x34')][_0xf397('0x61')])){for(var _0x1fa2ae=0x0;_0x1fa2ae<_0x3dd900[_0xf397('0x34')][_0xf397('0x61')][_0xf397('0x39')];_0x1fa2ae+=0x1){socket[_0xf397('0x81')]('userFaxQueue:remove',{'UserId':Number(_0x3dd900[_0xf397('0x34')]['ids'][_0x1fa2ae]),'FaxQueueId':Number(_0x3dd900['params']['id'])});}}else{socket['emit'](_0xf397('0x82'),{'UserId':Number(_0x3dd900['query']['ids']),'FaxQueueId':Number(_0x3dd900[_0xf397('0x4d')]['id'])});}});}})[_0xf397('0x26')](respondWithStatusCode(_0x9c3e4f,null))[_0xf397('0x43')](handleError(_0x9c3e4f,null));};exports[_0xf397('0x86')]=function(_0x4383cb,_0x2c8b05,_0x5e55b0){var _0x405124={};var _0x52c9a3={};var _0x22884c;var _0x13b334;return db['FaxQueue'][_0xf397('0x50')]({'where':{'id':_0x4383cb[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x2c8b05,null))[_0xf397('0x26')](function(_0x29f8e2){if(_0x29f8e2){_0x22884c=_0x29f8e2;_0x52c9a3[_0xf397('0x33')]=_['keys'](db[_0xf397('0x56')][_0xf397('0x2f')]);_0x52c9a3[_0xf397('0x34')]=_[_0xf397('0x35')](_0x4383cb[_0xf397('0x34')]);_0x52c9a3[_0xf397('0x36')]=_[_0xf397('0x37')](_0x52c9a3[_0xf397('0x33')],_0x52c9a3['query']);_0x405124[_0xf397('0x38')]=_['intersection'](_0x52c9a3['model'],qs[_0xf397('0x44')](_0x4383cb[_0xf397('0x34')][_0xf397('0x44')]));_0x405124[_0xf397('0x38')]=_0x405124[_0xf397('0x38')][_0xf397('0x39')]?_0x405124[_0xf397('0x38')]:_0x52c9a3[_0xf397('0x33')];_0x405124[_0xf397('0x53')]=qs[_0xf397('0x54')](_0x4383cb['query']['sort']);_0x405124[_0xf397('0x3b')]=qs[_0xf397('0x36')](_[_0xf397('0x3c')](_0x4383cb[_0xf397('0x34')],_0x52c9a3[_0xf397('0x36')]));if(_0x4383cb['query'][_0xf397('0x3d')]){_0x405124['where']=_['merge'](_0x405124[_0xf397('0x3b')],{'$or':_['map'](_0x405124[_0xf397('0x38')],function(_0x15644c){var _0x505df6={};_0x505df6[_0x15644c]={'$like':'%'+_0x4383cb[_0xf397('0x34')][_0xf397('0x3d')]+'%'};return _0x505df6;})});}_0x405124=_[_0xf397('0x3e')]({},_0x405124,_0x4383cb[_0xf397('0x87')]);return _0x22884c[_0xf397('0x86')](_0x405124);}})['then'](function(_0x33fb69){if(_0x33fb69){_0x13b334=_0x33fb69[_0xf397('0x39')];if(!_0x4383cb[_0xf397('0x34')][_0xf397('0x52')](_0xf397('0x3a'))){_0x405124[_0xf397('0x20')]=qs[_0xf397('0x20')](_0x4383cb['query']['limit']);_0x405124['offset']=qs[_0xf397('0x1d')](_0x4383cb[_0xf397('0x34')][_0xf397('0x1d')]);}return _0x22884c[_0xf397('0x86')](_0x405124);}})[_0xf397('0x26')](function(_0x459cdf){if(_0x459cdf){return _0x459cdf?{'count':_0x13b334,'rows':_0x459cdf}:null;}})[_0xf397('0x26')](respondWithResult(_0x2c8b05,null))[_0xf397('0x43')](handleError(_0x2c8b05,null));}; \ No newline at end of file +var _0x2b7d=['omit','spread','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','redis','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','get','FaxQueues','UserProfileResource','destroy','then','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','FaxQueue','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','UserId','agent','createdAt','format','%s/%s','SIP','faxPause','getTeams','Team','ids','Agents','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeAgents','userFaxQueue:remove','addAgents'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x2b7d,0x1b6));var _0xd2b7=function(_0x6f65ae,_0x797e){_0x6f65ae=_0x6f65ae-0x0;var _0x3f635e=_0x2b7d[_0x6f65ae];return _0x3f635e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd2b7('0x0'));var zipdir=require(_0xd2b7('0x1'));var jsonpatch=require(_0xd2b7('0x2'));var rp=require(_0xd2b7('0x3'));var moment=require(_0xd2b7('0x4'));var BPromise=require(_0xd2b7('0x5'));var Mustache=require(_0xd2b7('0x6'));var util=require(_0xd2b7('0x7'));var path=require('path');var sox=require(_0xd2b7('0x8'));var csv=require(_0xd2b7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd2b7('0xa'));var _=require(_0xd2b7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd2b7('0xc'));var deskjs=require(_0xd2b7('0xd'));var toCsv=require(_0xd2b7('0x9'));var querystring=require('querystring');var Papa=require(_0xd2b7('0xe'));var Redis=require('ioredis');var authService=require(_0xd2b7('0xf'));var qs=require(_0xd2b7('0x10'));var as=require(_0xd2b7('0x11'));var hardwareService=require(_0xd2b7('0x12'));var logger=require(_0xd2b7('0x13'))(_0xd2b7('0x14'));var utils=require(_0xd2b7('0x15'));var config=require(_0xd2b7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd2b7('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd2b7('0x18'))(new Redis(config[_0xd2b7('0x19')]));require(_0xd2b7('0x1a'))[_0xd2b7('0x1b')](socket);function respondWithStatusCode(_0x24d515,_0x4cfb93){_0x4cfb93=_0x4cfb93||0xcc;return function(_0x361894){if(_0x361894){return _0x24d515[_0xd2b7('0x1c')](_0x4cfb93);}return _0x24d515[_0xd2b7('0x1d')](_0x4cfb93)[_0xd2b7('0x1e')]();};}function respondWithResult(_0xf528ff,_0x327bd8){_0x327bd8=_0x327bd8||0xc8;return function(_0x5104b2){if(_0x5104b2){return _0xf528ff[_0xd2b7('0x1d')](_0x327bd8)[_0xd2b7('0x1f')](_0x5104b2);}};}function respondWithFilteredResult(_0x58a3fc,_0x44acdf){return function(_0x42ee40){if(_0x42ee40){var _0x3e21da=typeof _0x44acdf[_0xd2b7('0x20')]===_0xd2b7('0x21')&&typeof _0x44acdf['limit']===_0xd2b7('0x21');var _0x3d733b=_0x42ee40['count'];var _0x46f8c3=_0x3e21da?0x0:_0x44acdf[_0xd2b7('0x20')];var _0x50c54f=_0x3e21da?_0x42ee40[_0xd2b7('0x22')]:_0x44acdf[_0xd2b7('0x20')]+_0x44acdf['limit'];var _0x5b7c43;if(_0x50c54f>=_0x3d733b){_0x50c54f=_0x3d733b;_0x5b7c43=0xc8;}else{_0x5b7c43=0xce;}_0x58a3fc[_0xd2b7('0x1d')](_0x5b7c43);return _0x58a3fc[_0xd2b7('0x23')](_0xd2b7('0x24'),_0x46f8c3+'-'+_0x50c54f+'/'+_0x3d733b)[_0xd2b7('0x1f')](_0x42ee40);}return null;};}function patchUpdates(_0x3afaa0){return function(_0xdb4921){try{jsonpatch[_0xd2b7('0x25')](_0xdb4921,_0x3afaa0,!![]);}catch(_0x5a63c9){return BPromise[_0xd2b7('0x26')](_0x5a63c9);}return _0xdb4921[_0xd2b7('0x27')]();};}function saveUpdates(_0x4f8aee,_0x1601d0){return function(_0x2d6b54){if(_0x2d6b54){return _0x2d6b54[_0xd2b7('0x28')](_0x4f8aee)['then'](function(_0x5e97c1){return _0x5e97c1;});}return null;};}function removeEntity(_0x262785,_0x43506f){return function(_0x301250){if(_0x301250){return _0x301250['destroy']()['then'](function(){var _0x5dafb0=_0x301250[_0xd2b7('0x29')]({'plain':!![]});var _0x5b0737=_0xd2b7('0x2a');return db[_0xd2b7('0x2b')][_0xd2b7('0x2c')]({'where':{'type':_0x5b0737,'resourceId':_0x5dafb0['id']}})[_0xd2b7('0x2d')](function(){return _0x301250;});})[_0xd2b7('0x2d')](function(){_0x262785[_0xd2b7('0x1d')](0xcc)[_0xd2b7('0x1e')]();});}};}function handleEntityNotFound(_0x1cd0da,_0x5160d1){return function(_0x2ec798){if(!_0x2ec798){_0x1cd0da[_0xd2b7('0x1c')](0x194);}return _0x2ec798;};}function handleError(_0x3516c8,_0x54c240){_0x54c240=_0x54c240||0x1f4;return function(_0x3d9ec1){logger[_0xd2b7('0x2e')](_0x3d9ec1[_0xd2b7('0x2f')]);if(_0x3d9ec1[_0xd2b7('0x30')]){delete _0x3d9ec1[_0xd2b7('0x30')];}_0x3516c8[_0xd2b7('0x1d')](_0x54c240)['send'](_0x3d9ec1);};}exports[_0xd2b7('0x31')]=function(_0x2af9a8,_0x52b608){var _0x14a254={},_0x1e4676={},_0x507b54={'count':0x0,'rows':[]};var _0x4c7f9e=_[_0xd2b7('0x32')](db['FaxQueue']['rawAttributes'],function(_0x5fbdae){return{'name':_0x5fbdae[_0xd2b7('0x33')],'type':_0x5fbdae[_0xd2b7('0x34')][_0xd2b7('0x35')]};});_0x1e4676[_0xd2b7('0x36')]=_[_0xd2b7('0x32')](_0x4c7f9e,_0xd2b7('0x30'));_0x1e4676[_0xd2b7('0x37')]=_[_0xd2b7('0x38')](_0x2af9a8['query']);_0x1e4676[_0xd2b7('0x39')]=_['intersection'](_0x1e4676[_0xd2b7('0x36')],_0x1e4676[_0xd2b7('0x37')]);_0x14a254['attributes']=_[_0xd2b7('0x3a')](_0x1e4676[_0xd2b7('0x36')],qs[_0xd2b7('0x3b')](_0x2af9a8[_0xd2b7('0x37')][_0xd2b7('0x3b')]));_0x14a254['attributes']=_0x14a254['attributes'][_0xd2b7('0x3c')]?_0x14a254[_0xd2b7('0x3d')]:_0x1e4676[_0xd2b7('0x36')];if(!_0x2af9a8[_0xd2b7('0x37')][_0xd2b7('0x3e')](_0xd2b7('0x3f'))){_0x14a254[_0xd2b7('0x40')]=qs[_0xd2b7('0x40')](_0x2af9a8['query'][_0xd2b7('0x40')]);_0x14a254['offset']=qs[_0xd2b7('0x20')](_0x2af9a8['query'][_0xd2b7('0x20')]);}_0x14a254[_0xd2b7('0x41')]=qs[_0xd2b7('0x42')](_0x2af9a8['query'][_0xd2b7('0x42')]);_0x14a254[_0xd2b7('0x43')]=qs[_0xd2b7('0x39')](_[_0xd2b7('0x44')](_0x2af9a8[_0xd2b7('0x37')],_0x1e4676['filters']),_0x4c7f9e);if(_0x2af9a8[_0xd2b7('0x37')][_0xd2b7('0x45')]){_0x14a254['where']=_[_0xd2b7('0x46')](_0x14a254[_0xd2b7('0x43')],{'$or':_[_0xd2b7('0x32')](_0x4c7f9e,function(_0x379cf3){if(_0x379cf3[_0xd2b7('0x34')]!==_0xd2b7('0x47')){var _0x1a41b9={};_0x1a41b9[_0x379cf3[_0xd2b7('0x30')]]={'$like':'%'+_0x2af9a8[_0xd2b7('0x37')]['filter']+'%'};return _0x1a41b9;}})});}_0x14a254=_[_0xd2b7('0x46')]({},_0x14a254,_0x2af9a8['options']);var _0xd75af7={'where':_0x14a254[_0xd2b7('0x43')]};return db[_0xd2b7('0x48')]['count'](_0xd75af7)[_0xd2b7('0x2d')](function(_0x369eb1){_0x507b54[_0xd2b7('0x22')]=_0x369eb1;if(_0x2af9a8[_0xd2b7('0x37')][_0xd2b7('0x49')]){_0x14a254[_0xd2b7('0x4a')]=[{'all':!![]}];}return db['FaxQueue'][_0xd2b7('0x4b')](_0x14a254);})[_0xd2b7('0x2d')](function(_0x3084a6){_0x507b54[_0xd2b7('0x4c')]=_0x3084a6;return _0x507b54;})['then'](respondWithFilteredResult(_0x52b608,_0x14a254))[_0xd2b7('0x4d')](handleError(_0x52b608,null));};exports[_0xd2b7('0x4e')]=function(_0x4ef632,_0x49dd5d){var _0xfec270={'raw':!![],'where':{'id':_0x4ef632[_0xd2b7('0x4f')]['id']}},_0x8a970f={};_0x8a970f[_0xd2b7('0x36')]=_[_0xd2b7('0x38')](db[_0xd2b7('0x48')][_0xd2b7('0x50')]);_0x8a970f[_0xd2b7('0x37')]=_[_0xd2b7('0x38')](_0x4ef632[_0xd2b7('0x37')]);_0x8a970f[_0xd2b7('0x39')]=_[_0xd2b7('0x3a')](_0x8a970f['model'],_0x8a970f[_0xd2b7('0x37')]);_0xfec270[_0xd2b7('0x3d')]=_[_0xd2b7('0x3a')](_0x8a970f[_0xd2b7('0x36')],qs[_0xd2b7('0x3b')](_0x4ef632[_0xd2b7('0x37')]['fields']));_0xfec270[_0xd2b7('0x3d')]=_0xfec270[_0xd2b7('0x3d')][_0xd2b7('0x3c')]?_0xfec270[_0xd2b7('0x3d')]:_0x8a970f[_0xd2b7('0x36')];if(_0x4ef632[_0xd2b7('0x37')][_0xd2b7('0x49')]){_0xfec270[_0xd2b7('0x4a')]=[{'all':!![]}];}_0xfec270=_[_0xd2b7('0x46')]({},_0xfec270,_0x4ef632[_0xd2b7('0x51')]);return db['FaxQueue']['find'](_0xfec270)['then'](handleEntityNotFound(_0x49dd5d,null))['then'](respondWithResult(_0x49dd5d,null))['catch'](handleError(_0x49dd5d,null));};exports[_0xd2b7('0x52')]=function(_0x10ab50,_0x499f9d){return db[_0xd2b7('0x48')][_0xd2b7('0x52')](_0x10ab50[_0xd2b7('0x53')],{})[_0xd2b7('0x2d')](function(_0x364da5){var _0x2ffa9a=_0x10ab50[_0xd2b7('0x54')][_0xd2b7('0x29')]({'plain':!![]});if(!_0x2ffa9a)throw new Error(_0xd2b7('0x55'));if(_0x2ffa9a[_0xd2b7('0x56')]==='user'){var _0x4ba244=_0x364da5['get']({'plain':!![]});var _0x3f85bf='FaxQueues';return db[_0xd2b7('0x57')][_0xd2b7('0x58')]({'where':{'name':_0x3f85bf,'userProfileId':_0x2ffa9a[_0xd2b7('0x59')]},'raw':!![]})['then'](function(_0x183af3){if(_0x183af3&&_0x183af3[_0xd2b7('0x5a')]===0x0){return db[_0xd2b7('0x2b')][_0xd2b7('0x52')]({'name':_0x4ba244['name'],'resourceId':_0x4ba244['id'],'type':_0x183af3[_0xd2b7('0x30')],'sectionId':_0x183af3['id']},{})['then'](function(){return _0x364da5;});}else{return _0x364da5;}})[_0xd2b7('0x4d')](function(_0x372b08){logger[_0xd2b7('0x2e')](_0xd2b7('0x5b'),_0x372b08);throw _0x372b08;});}return _0x364da5;})[_0xd2b7('0x2d')](respondWithResult(_0x499f9d,0xc9))[_0xd2b7('0x4d')](handleError(_0x499f9d,null));};exports[_0xd2b7('0x28')]=function(_0x4f8d15,_0x72bf8b){if(_0x4f8d15[_0xd2b7('0x53')]['id']){delete _0x4f8d15[_0xd2b7('0x53')]['id'];}return db[_0xd2b7('0x48')]['find']({'where':{'id':_0x4f8d15['params']['id']}})[_0xd2b7('0x2d')](handleEntityNotFound(_0x72bf8b,null))[_0xd2b7('0x2d')](saveUpdates(_0x4f8d15[_0xd2b7('0x53')],null))[_0xd2b7('0x2d')](respondWithResult(_0x72bf8b,null))['catch'](handleError(_0x72bf8b,null));};exports['destroy']=function(_0x2a8840,_0x109e04){return db[_0xd2b7('0x48')][_0xd2b7('0x58')]({'where':{'id':_0x2a8840[_0xd2b7('0x4f')]['id']}})[_0xd2b7('0x2d')](handleEntityNotFound(_0x109e04,null))[_0xd2b7('0x2d')](removeEntity(_0x109e04,null))['catch'](handleError(_0x109e04,null));};exports[_0xd2b7('0x5c')]=function(_0x59321c,_0x351133){return db[_0xd2b7('0x48')][_0xd2b7('0x5c')]()[_0xd2b7('0x2d')](respondWithResult(_0x351133,null))[_0xd2b7('0x4d')](handleError(_0x351133,null));};exports[_0xd2b7('0x5d')]=function(_0x820dbb,_0x5dd2b2,_0x271d62){var _0x35cf45={'raw':!![],'where':{}},_0x538a26={},_0x1cec07;return db[_0xd2b7('0x48')][_0xd2b7('0x5e')]({'where':{'id':_0x820dbb[_0xd2b7('0x4f')]['id']}})[_0xd2b7('0x2d')](handleEntityNotFound(_0x5dd2b2,null))[_0xd2b7('0x2d')](function(_0x3ef682){if(_0x3ef682){_0x1cec07=_0x3ef682[_0xd2b7('0x29')]({'plain':!![]});_0x538a26[_0xd2b7('0x36')]=_[_0xd2b7('0x38')](db[_0xd2b7('0x5f')][_0xd2b7('0x50')]);_0x538a26[_0xd2b7('0x37')]=_[_0xd2b7('0x38')](_0x820dbb['query']);_0x538a26[_0xd2b7('0x39')]=_['intersection'](_0x538a26[_0xd2b7('0x36')],_0x538a26[_0xd2b7('0x37')]);_0x35cf45[_0xd2b7('0x3d')]=_[_0xd2b7('0x3a')](_0x538a26['model'],qs[_0xd2b7('0x3b')](_0x820dbb[_0xd2b7('0x37')][_0xd2b7('0x3b')]));_0x35cf45['attributes']=_0x35cf45[_0xd2b7('0x3d')]['length']?_0x35cf45[_0xd2b7('0x3d')]:_0x538a26[_0xd2b7('0x36')];if(!_0x820dbb['query']['hasOwnProperty'](_0xd2b7('0x3f'))){_0x35cf45[_0xd2b7('0x40')]=qs['limit'](_0x820dbb[_0xd2b7('0x37')][_0xd2b7('0x40')]);_0x35cf45[_0xd2b7('0x20')]=qs['offset'](_0x820dbb[_0xd2b7('0x37')]['offset']);}_0x35cf45[_0xd2b7('0x41')]=qs[_0xd2b7('0x42')](_0x820dbb[_0xd2b7('0x37')][_0xd2b7('0x42')]);_0x35cf45[_0xd2b7('0x43')]=qs[_0xd2b7('0x39')](_[_0xd2b7('0x44')](_0x820dbb[_0xd2b7('0x37')],_0x538a26['filters']));_0x35cf45['where'][_0xd2b7('0x60')]=_0x3ef682['id'];if(_0x820dbb[_0xd2b7('0x37')][_0xd2b7('0x45')]){_0x35cf45[_0xd2b7('0x43')]=_[_0xd2b7('0x46')](_0x35cf45[_0xd2b7('0x43')],{'$or':_['map'](_0x35cf45[_0xd2b7('0x3d')],function(_0x33731d){var _0x8641be={};_0x8641be[_0x33731d]={'$like':'%'+_0x820dbb['query']['filter']+'%'};return _0x8641be;})});}_0x35cf45=_[_0xd2b7('0x46')]({},_0x35cf45,_0x820dbb[_0xd2b7('0x51')]);return db[_0xd2b7('0x5f')][_0xd2b7('0x4b')](_0x35cf45);}})[_0xd2b7('0x2d')](function(_0xddcd86){if(_0xddcd86){return db[_0xd2b7('0x61')]['findAndCountAll']({'where':{'id':_[_0xd2b7('0x32')](_0xddcd86,_0xd2b7('0x62')),'role':_0xd2b7('0x63')},'attributes':['id',_0xd2b7('0x30'),'faxPause','updatedAt',_0xd2b7('0x64')]});}})['then'](function(_0x1d176a){if(_0x1d176a){return{'count':_0x1d176a[_0xd2b7('0x22')],'rows':_['map'](_0x1d176a['rows'],function(_0x148a38){return{'membername':_0x148a38[_0xd2b7('0x30')],'UserId':_0x148a38['id'],'queue_name':_0x1cec07[_0xd2b7('0x30')],'FaxQueueId':_0x1cec07['id'],'interface':util[_0xd2b7('0x65')](_0xd2b7('0x66'),_0xd2b7('0x67'),_0x148a38[_0xd2b7('0x30')]),'penalty':0x0,'paused':_0x148a38[_0xd2b7('0x68')],'createdAt':_0x148a38['createdAt'],'updatedAt':_0x148a38['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd2b7('0x2d')](respondWithFilteredResult(_0x5dd2b2,_0x35cf45))[_0xd2b7('0x4d')](handleError(_0x5dd2b2,null));};exports[_0xd2b7('0x69')]=function(_0xb0796b,_0x573802,_0x2ef539){var _0x261513={};var _0x589974={};var _0x86d386;var _0x12f2fb;return db['FaxQueue'][_0xd2b7('0x5e')]({'where':{'id':_0xb0796b[_0xd2b7('0x4f')]['id']}})['then'](handleEntityNotFound(_0x573802,null))['then'](function(_0x5d4d5e){if(_0x5d4d5e){_0x86d386=_0x5d4d5e;_0x589974[_0xd2b7('0x36')]=_[_0xd2b7('0x38')](db[_0xd2b7('0x6a')][_0xd2b7('0x50')]);_0x589974['query']=_[_0xd2b7('0x38')](_0xb0796b[_0xd2b7('0x37')]);_0x589974['filters']=_[_0xd2b7('0x3a')](_0x589974[_0xd2b7('0x36')],_0x589974['query']);_0x261513[_0xd2b7('0x3d')]=_[_0xd2b7('0x3a')](_0x589974[_0xd2b7('0x36')],qs[_0xd2b7('0x3b')](_0xb0796b['query'][_0xd2b7('0x3b')]));_0x261513[_0xd2b7('0x3d')]=_0x261513[_0xd2b7('0x3d')][_0xd2b7('0x3c')]?_0x261513[_0xd2b7('0x3d')]:_0x589974[_0xd2b7('0x36')];_0x261513[_0xd2b7('0x41')]=qs['sort'](_0xb0796b[_0xd2b7('0x37')][_0xd2b7('0x42')]);_0x261513['where']=qs['filters'](_[_0xd2b7('0x44')](_0xb0796b[_0xd2b7('0x37')],_0x589974[_0xd2b7('0x39')]));if(_0xb0796b[_0xd2b7('0x37')]['filter']){_0x261513['where']=_['merge'](_0x261513[_0xd2b7('0x43')],{'$or':_[_0xd2b7('0x32')](_0x261513[_0xd2b7('0x3d')],function(_0x1e23dc){var _0x1f441d={};_0x1f441d[_0x1e23dc]={'$like':'%'+_0xb0796b[_0xd2b7('0x37')]['filter']+'%'};return _0x1f441d;})});}_0x261513=_['merge']({},_0x261513,_0xb0796b[_0xd2b7('0x51')]);return _0x86d386[_0xd2b7('0x69')](_0x261513);}})[_0xd2b7('0x2d')](function(_0x3fa28c){if(_0x3fa28c){_0x12f2fb=_0x3fa28c[_0xd2b7('0x3c')];if(!_0xb0796b[_0xd2b7('0x37')][_0xd2b7('0x3e')](_0xd2b7('0x3f'))){_0x261513['limit']=qs[_0xd2b7('0x40')](_0xb0796b['query'][_0xd2b7('0x40')]);_0x261513[_0xd2b7('0x20')]=qs[_0xd2b7('0x20')](_0xb0796b[_0xd2b7('0x37')]['offset']);}return _0x86d386[_0xd2b7('0x69')](_0x261513);}})[_0xd2b7('0x2d')](function(_0x48efbe){if(_0x48efbe){return _0x48efbe?{'count':_0x12f2fb,'rows':_0x48efbe}:null;}})[_0xd2b7('0x2d')](respondWithResult(_0x573802,null))[_0xd2b7('0x4d')](handleError(_0x573802,null));};exports['addTeams']=function(_0x18b5fd,_0x37131f,_0x268bfe){var _0xa42ba5=_0x18b5fd['body'][_0xd2b7('0x6b')];return db['Team'][_0xd2b7('0x4b')]({'where':{'id':_0xa42ba5},'attributes':['id'],'include':[{'model':db[_0xd2b7('0x61')],'as':_0xd2b7('0x6c'),'attributes':['id',_0xd2b7('0x30'),'online','voicePause',_0xd2b7('0x6d')],'raw':!![]}]})[_0xd2b7('0x2d')](function(_0x5077c6){if(_0x5077c6){var _0x32d5f6=_[_0xd2b7('0x6e')](_0x5077c6,function(_0x132d2a){var _0x4849a2=_0x132d2a[_0xd2b7('0x29')]({'plain':!![]});return _0x4849a2[_0xd2b7('0x6c')];});return db[_0xd2b7('0x48')][_0xd2b7('0x58')]({'where':{'id':_0x18b5fd[_0xd2b7('0x4f')]['id']}})[_0xd2b7('0x2d')](function(_0x1711d4){return db[_0xd2b7('0x6f')][_0xd2b7('0x70')](function(_0x22579d){return _0x1711d4[_0xd2b7('0x71')](_0xa42ba5,{'transaction':_0x22579d})['then'](function(){return BPromise[_0xd2b7('0x72')](_0x32d5f6,function(_0x56d64f){return db[_0xd2b7('0x5f')][_0xd2b7('0x73')]({'where':{'UserId':_0x56d64f['id'],'FaxQueueId':_0x18b5fd[_0xd2b7('0x4f')]['id']},'transaction':_0x22579d});});})[_0xd2b7('0x2d')](function(){_0x32d5f6[_0xd2b7('0x74')](function(_0x3c5f80){socket[_0xd2b7('0x75')]('userFaxQueue:save',{'UserId':_0x3c5f80['id'],'FaxQueueId':_0x1711d4['id']});});});});});}})[_0xd2b7('0x2d')](respondWithStatusCode(_0x37131f,null))[_0xd2b7('0x4d')](handleError(_0x37131f,null));};exports[_0xd2b7('0x76')]=function(_0x26b1bf,_0x1cdc35,_0x37061b){return db['Team'][_0xd2b7('0x4b')]({'where':{'id':_0x26b1bf[_0xd2b7('0x37')][_0xd2b7('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xd2b7('0x61')],'as':_0xd2b7('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xd2b7('0x2d')](handleEntityNotFound(_0x1cdc35,null))[_0xd2b7('0x2d')](function(_0x471d7e){var _0x33e1a0=_['map'](_0x471d7e,'id');var _0x3d08dd=[];var _0x382998=[];var _0x2d84da=squel[_0xd2b7('0x77')]();_0x2d84da[_0xd2b7('0x78')](_0xd2b7('0x79'))['from'](_0xd2b7('0x7a'),'tq')[_0xd2b7('0x7b')](_0xd2b7('0x7c'),'ut',_0xd2b7('0x7d'))[_0xd2b7('0x43')](_0xd2b7('0x7e'),_0x26b1bf[_0xd2b7('0x4f')]['id']);for(var _0x30180c=0x0;_0x30180c<_0x471d7e[_0xd2b7('0x3c')];_0x30180c+=0x1){let _0x15695b=_0x471d7e[_0x30180c];for(var _0x9473c9=0x0;_0x9473c9<_0x15695b['Agents'][_0xd2b7('0x3c')];_0x9473c9+=0x1){let _0x2309a4=_0x15695b['Agents'][_0x9473c9];var _0x50e8bf=_0x2d84da[_0xd2b7('0x7f')]();_0x50e8bf[_0xd2b7('0x43')](_0xd2b7('0x80'),_0x2309a4['id']);_0x382998[_0xd2b7('0x81')](db[_0xd2b7('0x6f')][_0xd2b7('0x37')](_0x50e8bf[_0xd2b7('0x82')](),{'type':db['sequelize'][_0xd2b7('0x83')][_0xd2b7('0x84')]})['then'](function(_0x1ce536){if(_0x1ce536['length']===0x1){return _0x2309a4['id'];}else{var _0x45f94d=_[_0xd2b7('0x85')](_['map'](_0x1ce536,_0xd2b7('0x86')),function(_0x3b3120){return _[_0xd2b7('0x87')](_0x33e1a0,_0x3b3120);});if(_0x45f94d){return _0x2309a4['id'];}}}));}}return BPromise[_0xd2b7('0x88')](_0x382998)['then'](function(_0x244308){_0x3d08dd=_(_0x3d08dd)[_0xd2b7('0x89')](_0x244308)['compact']()[_0xd2b7('0x8a')]();return db[_0xd2b7('0x48')][_0xd2b7('0x58')]({'where':{'id':_0x26b1bf[_0xd2b7('0x4f')]['id']}})[_0xd2b7('0x2d')](function(_0x771b5f){return db['sequelize'][_0xd2b7('0x70')](function(_0x4a0066){return _0x771b5f[_0xd2b7('0x76')](_0x26b1bf[_0xd2b7('0x37')][_0xd2b7('0x6b')],{'transaction':_0x4a0066})[_0xd2b7('0x2d')](function(){if(!_['isEmpty'](_0x3d08dd)){return _0x771b5f[_0xd2b7('0x8b')](_0x3d08dd,{'transaction':_0x4a0066});}})[_0xd2b7('0x2d')](function(){_0x3d08dd['forEach'](function(_0x57a8f3){socket[_0xd2b7('0x75')](_0xd2b7('0x8c'),{'UserId':_0x57a8f3,'FaxQueueId':_0x771b5f['id']});});});});});});})[_0xd2b7('0x2d')](respondWithStatusCode(_0x1cdc35,null))['catch'](handleError(_0x1cdc35,null));};exports[_0xd2b7('0x8d')]=function(_0x9e3981,_0x3a7815,_0x5dd746){return db[_0xd2b7('0x48')]['find']({'where':{'id':_0x9e3981['params']['id']}})[_0xd2b7('0x2d')](handleEntityNotFound(_0x3a7815,null))['then'](function(_0x1c07fc){if(_0x1c07fc){return _0x1c07fc[_0xd2b7('0x8d')](_0x9e3981['body'][_0xd2b7('0x6b')],_[_0xd2b7('0x8e')](_0x9e3981[_0xd2b7('0x53')],[_0xd2b7('0x6b'),'id'])||{})[_0xd2b7('0x8f')](function(_0x5c9a72){for(var _0x190eab=0x0;_0x190eab<_0x9e3981['body'][_0xd2b7('0x6b')]['length'];_0x190eab+=0x1){socket[_0xd2b7('0x75')]('userFaxQueue:save',{'UserId':Number(_0x9e3981[_0xd2b7('0x53')][_0xd2b7('0x6b')][_0x190eab]),'FaxQueueId':Number(_0x9e3981[_0xd2b7('0x4f')]['id'])});}return _0x5c9a72;});}})[_0xd2b7('0x2d')](respondWithResult(_0x3a7815,null))[_0xd2b7('0x4d')](handleError(_0x3a7815,null));};exports['removeAgents']=function(_0x155b09,_0x1d800b,_0x1a7c26){return db[_0xd2b7('0x48')][_0xd2b7('0x58')]({'where':{'id':_0x155b09[_0xd2b7('0x4f')]['id']}})[_0xd2b7('0x2d')](handleEntityNotFound(_0x1d800b,null))[_0xd2b7('0x2d')](function(_0x2e4c97){if(_0x2e4c97){return _0x2e4c97[_0xd2b7('0x8b')](_0x155b09['query'][_0xd2b7('0x6b')])[_0xd2b7('0x2d')](function(){if(_['isArray'](_0x155b09[_0xd2b7('0x37')][_0xd2b7('0x6b')])){for(var _0x33b99e=0x0;_0x33b99e<_0x155b09['query'][_0xd2b7('0x6b')][_0xd2b7('0x3c')];_0x33b99e+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x155b09[_0xd2b7('0x37')]['ids'][_0x33b99e]),'FaxQueueId':Number(_0x155b09[_0xd2b7('0x4f')]['id'])});}}else{socket[_0xd2b7('0x75')](_0xd2b7('0x8c'),{'UserId':Number(_0x155b09[_0xd2b7('0x37')][_0xd2b7('0x6b')]),'FaxQueueId':Number(_0x155b09['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1d800b,null))['catch'](handleError(_0x1d800b,null));};exports['getAgents']=function(_0x4f4885,_0x491314,_0x5be227){var _0xd6adbd={};var _0x5773ed={};var _0xbcc26b;var _0x3e6dbb;return db[_0xd2b7('0x48')]['findOne']({'where':{'id':_0x4f4885[_0xd2b7('0x4f')]['id']}})[_0xd2b7('0x2d')](handleEntityNotFound(_0x491314,null))[_0xd2b7('0x2d')](function(_0x22527a){if(_0x22527a){_0xbcc26b=_0x22527a;_0x5773ed[_0xd2b7('0x36')]=_[_0xd2b7('0x38')](db['User'][_0xd2b7('0x50')]);_0x5773ed[_0xd2b7('0x37')]=_[_0xd2b7('0x38')](_0x4f4885['query']);_0x5773ed[_0xd2b7('0x39')]=_[_0xd2b7('0x3a')](_0x5773ed[_0xd2b7('0x36')],_0x5773ed['query']);_0xd6adbd[_0xd2b7('0x3d')]=_[_0xd2b7('0x3a')](_0x5773ed[_0xd2b7('0x36')],qs['fields'](_0x4f4885[_0xd2b7('0x37')][_0xd2b7('0x3b')]));_0xd6adbd[_0xd2b7('0x3d')]=_0xd6adbd[_0xd2b7('0x3d')][_0xd2b7('0x3c')]?_0xd6adbd[_0xd2b7('0x3d')]:_0x5773ed[_0xd2b7('0x36')];_0xd6adbd[_0xd2b7('0x41')]=qs[_0xd2b7('0x42')](_0x4f4885[_0xd2b7('0x37')][_0xd2b7('0x42')]);_0xd6adbd[_0xd2b7('0x43')]=qs[_0xd2b7('0x39')](_[_0xd2b7('0x44')](_0x4f4885['query'],_0x5773ed[_0xd2b7('0x39')]));if(_0x4f4885[_0xd2b7('0x37')][_0xd2b7('0x45')]){_0xd6adbd[_0xd2b7('0x43')]=_['merge'](_0xd6adbd[_0xd2b7('0x43')],{'$or':_[_0xd2b7('0x32')](_0xd6adbd[_0xd2b7('0x3d')],function(_0x3ed667){var _0x11b375={};_0x11b375[_0x3ed667]={'$like':'%'+_0x4f4885[_0xd2b7('0x37')]['filter']+'%'};return _0x11b375;})});}_0xd6adbd=_['merge']({},_0xd6adbd,_0x4f4885[_0xd2b7('0x51')]);return _0xbcc26b['getAgents'](_0xd6adbd);}})[_0xd2b7('0x2d')](function(_0x26df9d){if(_0x26df9d){_0x3e6dbb=_0x26df9d['length'];if(!_0x4f4885[_0xd2b7('0x37')][_0xd2b7('0x3e')]('nolimit')){_0xd6adbd[_0xd2b7('0x40')]=qs[_0xd2b7('0x40')](_0x4f4885[_0xd2b7('0x37')][_0xd2b7('0x40')]);_0xd6adbd[_0xd2b7('0x20')]=qs[_0xd2b7('0x20')](_0x4f4885[_0xd2b7('0x37')][_0xd2b7('0x20')]);}return _0xbcc26b[_0xd2b7('0x90')](_0xd6adbd);}})[_0xd2b7('0x2d')](function(_0x4a7399){if(_0x4a7399){return _0x4a7399?{'count':_0x3e6dbb,'rows':_0x4a7399}:null;}})['then'](respondWithResult(_0x491314,null))[_0xd2b7('0x4d')](handleError(_0x491314,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 19cb3d0..87898d3 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 _0x62e3=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hook'];(function(_0x4d62cf,_0x44a4ec){var _0x4bb78d=function(_0x33f666){while(--_0x33f666){_0x4d62cf['push'](_0x4d62cf['shift']());}};_0x4bb78d(++_0x44a4ec);}(_0x62e3,0xf9));var _0x362e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62e3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x362e('0x0'));var FaxQueue=require(_0x362e('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x362e('0x2')](0x0);var events={'afterCreate':_0x362e('0x3'),'afterUpdate':_0x362e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21f800){return function(_0x2996bc,_0xf8150a,_0x4b2148){FaxQueueEvents['emit'](_0x21f800+':'+_0x2996bc['id'],_0x2996bc);FaxQueueEvents[_0x362e('0x5')](_0x21f800,_0x2996bc);_0x4b2148(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x362e('0x6')](e,emitEvent(event));}}module[_0x362e('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x0c09=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x0c09,0xc9));var _0x90c0=function(_0x2ac5ca,_0x52c5eb){_0x2ac5ca=_0x2ac5ca-0x0;var _0x39c4ab=_0x0c09[_0x2ac5ca];return _0x39c4ab;};'use strict';var EventEmitter=require(_0x90c0('0x0'));var FaxQueue=require(_0x90c0('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x90c0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x90c0('0x3'),'afterDestroy':_0x90c0('0x4')};function emitEvent(_0x3dfecc){return function(_0x540460,_0x1c5642,_0xf89b17){FaxQueueEvents[_0x90c0('0x5')](_0x3dfecc+':'+_0x540460['id'],_0x540460);FaxQueueEvents['emit'](_0x3dfecc,_0x540460);_0xf89b17(null);};}for(var e in events){if(events[_0x90c0('0x6')](e)){var event=events[e];FaxQueue[_0x90c0('0x7')](e,emitEvent(event));}}module[_0x90c0('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 864e106..238c219 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 _0x5612=['rimraf','../../config/environment','exports','FaxQueue','fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3b9277,_0x463f10){var _0x16fa13=function(_0x5ae96b){while(--_0x5ae96b){_0x3b9277['push'](_0x3b9277['shift']());}};_0x16fa13(++_0x463f10);}(_0x5612,0x19d));var _0x2561=function(_0x36c626,_0xebdde4){_0x36c626=_0x36c626-0x0;var _0x582d10=_0x5612[_0x36c626];return _0x582d10;};'use strict';var _=require(_0x2561('0x0'));var util=require('util');var logger=require(_0x2561('0x1'))(_0x2561('0x2'));var moment=require(_0x2561('0x3'));var BPromise=require(_0x2561('0x4'));var rp=require(_0x2561('0x5'));var fs=require('fs');var path=require(_0x2561('0x6'));var rimraf=require(_0x2561('0x7'));var config=require(_0x2561('0x8'));var attributes=require('./faxQueue.attributes');module[_0x2561('0x9')]=function(_0x26dcf3,_0x2e50e0){return _0x26dcf3['define'](_0x2561('0xa'),attributes,{'tableName':_0x2561('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdd1=['FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports'];(function(_0x131018,_0xbb3d89){var _0x4ddb99=function(_0x2a8732){while(--_0x2a8732){_0x131018['push'](_0x131018['shift']());}};_0x4ddb99(++_0xbb3d89);}(_0xbdd1,0xb6));var _0x1bdd=function(_0x378380,_0x31dba0){_0x378380=_0x378380-0x0;var _0x2a4744=_0xbdd1[_0x378380];return _0x2a4744;};'use strict';var _=require(_0x1bdd('0x0'));var util=require(_0x1bdd('0x1'));var logger=require(_0x1bdd('0x2'))(_0x1bdd('0x3'));var moment=require('moment');var BPromise=require(_0x1bdd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1bdd('0x5'));var rimraf=require(_0x1bdd('0x6'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x1bdd('0x7')]=function(_0x2cc4c8,_0x361d26){return _0x2cc4c8['define'](_0x1bdd('0x8'),attributes,{'tableName':_0x1bdd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index b031409..b941a73 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 _0xc706=['then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','stringify','catch','ShowFaxQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0xc706,0x1c4));var _0x6c70=function(_0x4d942e,_0x46316b){_0x4d942e=_0x4d942e-0x0;var _0x1e84a4=_0xc706[_0x4d942e];return _0x1e84a4;};'use strict';var _=require(_0x6c70('0x0'));var util=require(_0x6c70('0x1'));var moment=require(_0x6c70('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c70('0x3'));var db=require(_0x6c70('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c70('0x5'))(_0x6c70('0x6'));var config=require(_0x6c70('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6c70('0x8')][_0x6c70('0x9')]({'port':0x232a});config[_0x6c70('0xa')]=_[_0x6c70('0xb')](config[_0x6c70('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c70('0xc'))(new Redis(config['redis']));require(_0x6c70('0xd'))[_0x6c70('0xe')](socket);function respondWithRpcPromise(_0x440576,_0x1352a6,_0x41da4a){return new BPromise(function(_0x1997d5,_0x314d11){return client[_0x6c70('0xf')](_0x440576,_0x41da4a)[_0x6c70('0x10')](function(_0x19a8b6){logger[_0x6c70('0x11')](_0x6c70('0x12'),_0x1352a6,_0x6c70('0x13'));logger[_0x6c70('0x14')](_0x6c70('0x15'),_0x1352a6,_0x6c70('0x13'),JSON['stringify'](_0x19a8b6));if(_0x19a8b6[_0x6c70('0x16')]){if(_0x19a8b6['error'][_0x6c70('0x17')]===0x1f4){logger[_0x6c70('0x16')](_0x6c70('0x12'),_0x1352a6,_0x19a8b6['error']['message']);return _0x314d11(_0x19a8b6[_0x6c70('0x16')][_0x6c70('0x18')]);}logger['error'](_0x6c70('0x12'),_0x1352a6,_0x19a8b6[_0x6c70('0x16')][_0x6c70('0x18')]);return _0x1997d5(_0x19a8b6[_0x6c70('0x16')]['message']);}else{logger[_0x6c70('0x11')]('FaxQueue,\x20%s,\x20%s',_0x1352a6,_0x6c70('0x13'));_0x1997d5(_0x19a8b6[_0x6c70('0x19')][_0x6c70('0x18')]);}})['catch'](function(_0x129188){logger[_0x6c70('0x16')](_0x6c70('0x12'),_0x1352a6,_0x129188);_0x314d11(_0x129188);});});}exports[_0x6c70('0x1a')]=function(_0x1807c9){var _0xe6fc7d=this;return new Promise(function(_0x24561a,_0x4fdb27){return db[_0x6c70('0x1b')][_0x6c70('0x1c')]({'raw':_0x1807c9[_0x6c70('0x1d')]?_0x1807c9[_0x6c70('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1807c9[_0x6c70('0x1d')]?_0x1807c9[_0x6c70('0x1d')][_0x6c70('0x1e')]||null:null,'attributes':_0x1807c9[_0x6c70('0x1d')]?_0x1807c9[_0x6c70('0x1d')][_0x6c70('0x1f')]||null:null,'limit':_0x1807c9[_0x6c70('0x1d')]?_0x1807c9[_0x6c70('0x1d')][_0x6c70('0x20')]||null:null,'include':_0x1807c9[_0x6c70('0x1d')]?_0x1807c9['options'][_0x6c70('0x21')]?_[_0x6c70('0x22')](_0x1807c9[_0x6c70('0x1d')][_0x6c70('0x21')],function(_0x7d34e1){return{'model':db[_0x7d34e1[_0x6c70('0x23')]],'as':_0x7d34e1['as'],'attributes':_0x7d34e1['attributes'],'include':_0x7d34e1['include']?_[_0x6c70('0x22')](_0x7d34e1[_0x6c70('0x21')],function(_0x3de19b){return{'model':db[_0x3de19b[_0x6c70('0x23')]],'as':_0x3de19b['as'],'attributes':_0x3de19b[_0x6c70('0x1f')],'include':_0x3de19b[_0x6c70('0x21')]?_[_0x6c70('0x22')](_0x3de19b[_0x6c70('0x21')],function(_0x2fd452){return{'model':db[_0x2fd452[_0x6c70('0x23')]],'as':_0x2fd452['as'],'attributes':_0x2fd452[_0x6c70('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6c70('0x10')](function(_0x2b954a){logger[_0x6c70('0x11')](_0x6c70('0x1a'),_0x1807c9);logger['debug'](_0x6c70('0x1a'),_0x1807c9,JSON[_0x6c70('0x24')](_0x2b954a));_0x24561a(_0x2b954a);})[_0x6c70('0x25')](function(_0x3d9a27){logger[_0x6c70('0x16')](_0x6c70('0x1a'),_0x3d9a27[_0x6c70('0x18')],_0x1807c9);_0x4fdb27(_0xe6fc7d['error'](0x1f4,_0x3d9a27[_0x6c70('0x18')]));});});};exports[_0x6c70('0x26')]=function(_0x276d4d){var _0x409b9a=this;return new Promise(function(_0x26c96b,_0xdef9db){return db[_0x6c70('0x1b')]['find']({'raw':_0x276d4d[_0x6c70('0x1d')]?_0x276d4d[_0x6c70('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x276d4d[_0x6c70('0x1d')]?_0x276d4d[_0x6c70('0x1d')][_0x6c70('0x1e')]||null:null,'attributes':_0x276d4d[_0x6c70('0x1d')]?_0x276d4d[_0x6c70('0x1d')][_0x6c70('0x1f')]||null:null,'include':_0x276d4d[_0x6c70('0x1d')]?_0x276d4d[_0x6c70('0x1d')][_0x6c70('0x21')]?_[_0x6c70('0x22')](_0x276d4d[_0x6c70('0x1d')][_0x6c70('0x21')],function(_0x260c61){return{'model':db[_0x260c61[_0x6c70('0x23')]],'as':_0x260c61['as'],'attributes':_0x260c61[_0x6c70('0x1f')],'include':_0x260c61[_0x6c70('0x21')]?_[_0x6c70('0x22')](_0x260c61[_0x6c70('0x21')],function(_0x264cb1){return{'model':db[_0x264cb1[_0x6c70('0x23')]],'as':_0x264cb1['as'],'attributes':_0x264cb1['attributes'],'include':_0x264cb1[_0x6c70('0x21')]?_[_0x6c70('0x22')](_0x264cb1[_0x6c70('0x21')],function(_0x222ebf){return{'model':db[_0x222ebf['model']],'as':_0x222ebf['as'],'attributes':_0x222ebf[_0x6c70('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6c70('0x10')](function(_0x37fbb6){logger[_0x6c70('0x11')](_0x6c70('0x26'),_0x276d4d);logger[_0x6c70('0x14')](_0x6c70('0x26'),_0x276d4d,JSON[_0x6c70('0x24')](_0x37fbb6));_0x26c96b(_0x37fbb6);})[_0x6c70('0x25')](function(_0x563a9d){logger['error'](_0x6c70('0x26'),_0x563a9d[_0x6c70('0x18')],_0x276d4d);_0xdef9db(_0x409b9a[_0x6c70('0x16')](0x1f4,_0x563a9d[_0x6c70('0x18')]));});});}; \ No newline at end of file +var _0xc0be=['raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','FaxQueue','findAll','options','where','limit','include','model','attributes','map','GetFaxQueue','ShowFaxQueue','find'];(function(_0x1f1211,_0xc87eff){var _0x29da0f=function(_0x11f1ef){while(--_0x11f1ef){_0x1f1211['push'](_0x1f1211['shift']());}};_0x29da0f(++_0xc87eff);}(_0xc0be,0x109));var _0xec0b=function(_0x37069a,_0x1fff43){_0x37069a=_0x37069a-0x0;var _0x1c050a=_0xc0be[_0x37069a];return _0x1c050a;};'use strict';var _=require('lodash');var util=require(_0xec0b('0x0'));var moment=require(_0xec0b('0x1'));var BPromise=require(_0xec0b('0x2'));var rs=require(_0xec0b('0x3'));var fs=require('fs');var Redis=require(_0xec0b('0x4'));var db=require(_0xec0b('0x5'))['db'];var utils=require(_0xec0b('0x6'));var logger=require(_0xec0b('0x7'))(_0xec0b('0x8'));var config=require(_0xec0b('0x9'));var jayson=require(_0xec0b('0xa'));var client=jayson[_0xec0b('0xb')][_0xec0b('0xc')]({'port':0x232a});config['redis']=_[_0xec0b('0xd')](config[_0xec0b('0xe')],{'host':_0xec0b('0xf'),'port':0x18eb});var socket=require(_0xec0b('0x10'))(new Redis(config[_0xec0b('0xe')]));require(_0xec0b('0x11'))[_0xec0b('0x12')](socket);function respondWithRpcPromise(_0x3ded84,_0x246795,_0x441995){return new BPromise(function(_0x4b5d0b,_0x32ab23){return client[_0xec0b('0x13')](_0x3ded84,_0x441995)[_0xec0b('0x14')](function(_0x4e6309){logger[_0xec0b('0x15')](_0xec0b('0x16'),_0x246795,'request\x20sent');logger[_0xec0b('0x17')](_0xec0b('0x18'),_0x246795,_0xec0b('0x19'),JSON[_0xec0b('0x1a')](_0x4e6309));if(_0x4e6309[_0xec0b('0x1b')]){if(_0x4e6309[_0xec0b('0x1b')][_0xec0b('0x1c')]===0x1f4){logger[_0xec0b('0x1b')]('FaxQueue,\x20%s,\x20%s',_0x246795,_0x4e6309['error'][_0xec0b('0x1d')]);return _0x32ab23(_0x4e6309[_0xec0b('0x1b')][_0xec0b('0x1d')]);}logger['error'](_0xec0b('0x16'),_0x246795,_0x4e6309[_0xec0b('0x1b')][_0xec0b('0x1d')]);return _0x4b5d0b(_0x4e6309[_0xec0b('0x1b')]['message']);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x246795,_0xec0b('0x19'));_0x4b5d0b(_0x4e6309['result'][_0xec0b('0x1d')]);}})[_0xec0b('0x1e')](function(_0x5b131e){logger[_0xec0b('0x1b')]('FaxQueue,\x20%s,\x20%s',_0x246795,_0x5b131e);_0x32ab23(_0x5b131e);});});}exports['GetFaxQueue']=function(_0x43b305){var _0x106ced=this;return new Promise(function(_0x47cf3b,_0x17d6ce){return db[_0xec0b('0x1f')][_0xec0b('0x20')]({'raw':_0x43b305[_0xec0b('0x21')]?_0x43b305['options']['raw']===undefined?!![]:![]:!![],'where':_0x43b305[_0xec0b('0x21')]?_0x43b305[_0xec0b('0x21')][_0xec0b('0x22')]||null:null,'attributes':_0x43b305[_0xec0b('0x21')]?_0x43b305['options']['attributes']||null:null,'limit':_0x43b305[_0xec0b('0x21')]?_0x43b305[_0xec0b('0x21')][_0xec0b('0x23')]||null:null,'include':_0x43b305['options']?_0x43b305[_0xec0b('0x21')][_0xec0b('0x24')]?_['map'](_0x43b305[_0xec0b('0x21')][_0xec0b('0x24')],function(_0xf1a757){return{'model':db[_0xf1a757[_0xec0b('0x25')]],'as':_0xf1a757['as'],'attributes':_0xf1a757[_0xec0b('0x26')],'include':_0xf1a757[_0xec0b('0x24')]?_[_0xec0b('0x27')](_0xf1a757[_0xec0b('0x24')],function(_0xc04bc9){return{'model':db[_0xc04bc9[_0xec0b('0x25')]],'as':_0xc04bc9['as'],'attributes':_0xc04bc9[_0xec0b('0x26')],'include':_0xc04bc9[_0xec0b('0x24')]?_['map'](_0xc04bc9['include'],function(_0x28022a){return{'model':db[_0x28022a['model']],'as':_0x28022a['as'],'attributes':_0x28022a[_0xec0b('0x26')]};}):[]};}):[]};}):[]:[]})[_0xec0b('0x14')](function(_0x170d7b){logger['info']('GetFaxQueue',_0x43b305);logger[_0xec0b('0x17')](_0xec0b('0x28'),_0x43b305,JSON[_0xec0b('0x1a')](_0x170d7b));_0x47cf3b(_0x170d7b);})[_0xec0b('0x1e')](function(_0x512d6f){logger['error']('GetFaxQueue',_0x512d6f['message'],_0x43b305);_0x17d6ce(_0x106ced[_0xec0b('0x1b')](0x1f4,_0x512d6f['message']));});});};exports[_0xec0b('0x29')]=function(_0x30d183){var _0x37589e=this;return new Promise(function(_0x414a0d,_0x59fb88){return db[_0xec0b('0x1f')][_0xec0b('0x2a')]({'raw':_0x30d183[_0xec0b('0x21')]?_0x30d183[_0xec0b('0x21')][_0xec0b('0x2b')]===undefined?!![]:![]:!![],'where':_0x30d183[_0xec0b('0x21')]?_0x30d183[_0xec0b('0x21')][_0xec0b('0x22')]||null:null,'attributes':_0x30d183[_0xec0b('0x21')]?_0x30d183['options'][_0xec0b('0x26')]||null:null,'include':_0x30d183['options']?_0x30d183[_0xec0b('0x21')][_0xec0b('0x24')]?_[_0xec0b('0x27')](_0x30d183[_0xec0b('0x21')][_0xec0b('0x24')],function(_0x11c52f){return{'model':db[_0x11c52f[_0xec0b('0x25')]],'as':_0x11c52f['as'],'attributes':_0x11c52f[_0xec0b('0x26')],'include':_0x11c52f[_0xec0b('0x24')]?_[_0xec0b('0x27')](_0x11c52f['include'],function(_0x244e5d){return{'model':db[_0x244e5d[_0xec0b('0x25')]],'as':_0x244e5d['as'],'attributes':_0x244e5d[_0xec0b('0x26')],'include':_0x244e5d[_0xec0b('0x24')]?_[_0xec0b('0x27')](_0x244e5d['include'],function(_0x4ce7e0){return{'model':db[_0x4ce7e0[_0xec0b('0x25')]],'as':_0x4ce7e0['as'],'attributes':_0x4ce7e0[_0xec0b('0x26')]};}):[]};}):[]};}):[]:[]})[_0xec0b('0x14')](function(_0x31a209){logger[_0xec0b('0x15')](_0xec0b('0x29'),_0x30d183);logger['debug'](_0xec0b('0x29'),_0x30d183,JSON['stringify'](_0x31a209));_0x414a0d(_0x31a209);})[_0xec0b('0x1e')](function(_0x53b714){logger[_0xec0b('0x1b')]('ShowFaxQueue',_0x53b714[_0xec0b('0x1d')],_0x30d183);_0x59fb88(_0x37589e[_0xec0b('0x1b')](0x1f4,_0x53b714[_0xec0b('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 160571e..6a51918 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 _0x2f15=['update','register','faxQueue:','save'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x2f15,0x6f));var _0x52f1=function(_0x4c9eb3,_0x39d57c){_0x4c9eb3=_0x4c9eb3-0x0;var _0x545688=_0x2f15[_0x4c9eb3];return _0x545688;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x52f1('0x0'),'remove',_0x52f1('0x1')];function createListener(_0x3548a8,_0xdc883e){return function(_0x1fe2d3){_0xdc883e['emit'](_0x3548a8,_0x1fe2d3);};}function removeListener(_0x3a0ce3,_0x3f2390){return function(){FaxQueueEvents['removeListener'](_0x3a0ce3,_0x3f2390);};}exports[_0x52f1('0x2')]=function(_0x218476){for(var _0x405430=0x0,_0x542cfa=events['length'];_0x405430<_0x542cfa;_0x405430++){var _0x5c1265=events[_0x405430];var _0x334792=createListener(_0x52f1('0x3')+_0x5c1265,_0x218476);FaxQueueEvents['on'](_0x5c1265,_0x334792);}}; \ No newline at end of file +var _0x5d7d=['update','emit','register','./faxQueue.events','save'];(function(_0x3f24bd,_0x4c8a74){var _0x24f64d=function(_0x159469){while(--_0x159469){_0x3f24bd['push'](_0x3f24bd['shift']());}};_0x24f64d(++_0x4c8a74);}(_0x5d7d,0xc6));var _0xd5d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d7d[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0xd5d7('0x0'));var events=[_0xd5d7('0x1'),'remove',_0xd5d7('0x2')];function createListener(_0x26eadd,_0x3cf0e6){return function(_0x15456e){_0x3cf0e6[_0xd5d7('0x3')](_0x26eadd,_0x15456e);};}function removeListener(_0x4f02a1,_0x11f7f7){return function(){FaxQueueEvents['removeListener'](_0x4f02a1,_0x11f7f7);};}exports[_0xd5d7('0x4')]=function(_0x29c89a){for(var _0x14ce0f=0x0,_0x551fc6=events['length'];_0x14ce0f<_0x551fc6;_0x14ce0f++){var _0x10c1cb=events[_0x14ce0f];var _0x356e2b=createListener('faxQueue:'+_0x10c1cb,_0x29c89a);FaxQueueEvents['on'](_0x10c1cb,_0x356e2b);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 3ec7474..76749f8 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 _0xf562=['destroy','removeTeams','/:id/users','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','getMembers','/:id/teams','post','create','addTeams','addAgents','put','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf562,0x100));var _0x2f56=function(_0x1fdd56,_0x273762){_0x1fdd56=_0x1fdd56-0x0;var _0x5dcbe3=_0xf562[_0x1fdd56];return _0x5dcbe3;};'use strict';var multer=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var path=require(_0x2f56('0x2'));var timeout=require(_0x2f56('0x3'));var express=require(_0x2f56('0x4'));var router=express[_0x2f56('0x5')]();var fs_extra=require(_0x2f56('0x6'));var auth=require(_0x2f56('0x7'));var interaction=require(_0x2f56('0x8'));var config=require('../../config/environment');var controller=require(_0x2f56('0x9'));router['get']('/',auth[_0x2f56('0xa')](),controller['index']);router[_0x2f56('0xb')](_0x2f56('0xc'),auth[_0x2f56('0xa')](),controller[_0x2f56('0xd')]);router[_0x2f56('0xb')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller[_0x2f56('0xf')]);router[_0x2f56('0xb')]('/:id/members',auth[_0x2f56('0xa')](),controller[_0x2f56('0x10')]);router['get'](_0x2f56('0x11'),auth[_0x2f56('0xa')](),controller['getTeams']);router[_0x2f56('0xb')]('/:id/users',auth[_0x2f56('0xa')](),controller['getAgents']);router[_0x2f56('0x12')]('/',auth[_0x2f56('0xa')](),controller[_0x2f56('0x13')]);router[_0x2f56('0x12')](_0x2f56('0x11'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x14')]);router[_0x2f56('0x12')]('/:id/users',auth[_0x2f56('0xa')](),controller[_0x2f56('0x15')]);router[_0x2f56('0x16')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller['update']);router[_0x2f56('0x17')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x18')]);router[_0x2f56('0x17')]('/:id/teams',auth[_0x2f56('0xa')](),controller[_0x2f56('0x19')]);router[_0x2f56('0x17')](_0x2f56('0x1a'),auth[_0x2f56('0xa')](),controller['removeAgents']);module[_0x2f56('0x1b')]=router; \ No newline at end of file +var _0xee3c=['./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','put','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xee3c,0x14a));var _0xcee3=function(_0x390b59,_0x5d9b29){_0x390b59=_0x390b59-0x0;var _0x44d2b0=_0xee3c[_0x390b59];return _0x44d2b0;};'use strict';var multer=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var path=require(_0xcee3('0x2'));var timeout=require(_0xcee3('0x3'));var express=require(_0xcee3('0x4'));var router=express[_0xcee3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcee3('0x6'));var config=require(_0xcee3('0x7'));var controller=require(_0xcee3('0x8'));router[_0xcee3('0x9')]('/',auth[_0xcee3('0xa')](),controller[_0xcee3('0xb')]);router[_0xcee3('0x9')](_0xcee3('0xc'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xd')]);router[_0xcee3('0x9')](_0xcee3('0xe'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xf')]);router[_0xcee3('0x9')]('/:id/members',auth[_0xcee3('0xa')](),controller[_0xcee3('0x10')]);router[_0xcee3('0x9')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x12')]);router['get'](_0xcee3('0x13'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x14')]);router[_0xcee3('0x15')]('/',auth[_0xcee3('0xa')](),controller['create']);router[_0xcee3('0x15')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xcee3('0x15')](_0xcee3('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xcee3('0x16')]('/:id',auth[_0xcee3('0xa')](),controller['update']);router[_0xcee3('0x17')](_0xcee3('0xe'),auth['isAuthenticated'](),controller[_0xcee3('0x18')]);router[_0xcee3('0x17')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller['removeTeams']);router[_0xcee3('0x17')](_0xcee3('0x13'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index de9f82b..912e698 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 _0x1539=['DATE','sequelize','exports','STRING'];(function(_0xc48ca6,_0x1cb9cc){var _0x42342f=function(_0x455bef){while(--_0x455bef){_0xc48ca6['push'](_0xc48ca6['shift']());}};_0x42342f(++_0x1cb9cc);}(_0x1539,0x139));var _0x9153=function(_0x2bbc44,_0x3725ed){_0x2bbc44=_0x2bbc44-0x0;var _0x316148=_0x1539[_0x2bbc44];return _0x316148;};'use strict';var moment=require('moment');var Sequelize=require(_0x9153('0x0'));module[_0x9153('0x1')]={'uniqueid':{'type':Sequelize[_0x9153('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9153('0x3')]},'leaveAt':{'type':Sequelize[_0x9153('0x3')]},'acceptAt':{'type':Sequelize[_0x9153('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9153('0x2')]}}; \ No newline at end of file +var _0x03dc=['DATE','moment','sequelize','STRING'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x03dc,0x85));var _0xc03d=function(_0x469d4d,_0x5892c6){_0x469d4d=_0x469d4d-0x0;var _0x158e96=_0x03dc[_0x469d4d];return _0x158e96;};'use strict';var moment=require(_0xc03d('0x0'));var Sequelize=require(_0xc03d('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc03d('0x2')]},'joinAt':{'type':Sequelize[_0xc03d('0x3')]},'leaveAt':{'type':Sequelize[_0xc03d('0x3')]},'acceptAt':{'type':Sequelize[_0xc03d('0x3')]},'exitAt':{'type':Sequelize[_0xc03d('0x3')]},'reason':{'type':Sequelize[_0xc03d('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index cad4821..4be790d 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 _0x9755=['rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','error','stack','name','send','index','FaxQueueReport','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','then','includeAll','include'];(function(_0x3b2806,_0x329a73){var _0x3c10bb=function(_0x4464f4){while(--_0x4464f4){_0x3b2806['push'](_0x3b2806['shift']());}};_0x3c10bb(++_0x329a73);}(_0x9755,0x1c6));var _0x5975=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x9755[_0x158da6];return _0x429c30;};'use strict';var emlformat=require(_0x5975('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5975('0x1'));var jsonpatch=require(_0x5975('0x2'));var rp=require(_0x5975('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5975('0x4'));var path=require(_0x5975('0x5'));var sox=require(_0x5975('0x6'));var csv=require(_0x5975('0x7'));var ejs=require(_0x5975('0x8'));var fs=require('fs');var fs_extra=require(_0x5975('0x9'));var _=require(_0x5975('0xa'));var squel=require('squel');var crypto=require(_0x5975('0xb'));var jsforce=require(_0x5975('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5975('0x7'));var querystring=require(_0x5975('0xd'));var Papa=require(_0x5975('0xe'));var Redis=require('ioredis');var authService=require(_0x5975('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5975('0x10'));var logger=require(_0x5975('0x11'))(_0x5975('0x12'));var utils=require('../../config/utils');var config=require(_0x5975('0x13'));var licenseUtil=require(_0x5975('0x14'));var db=require(_0x5975('0x15'))['db'];function respondWithStatusCode(_0x52bdaa,_0x119571){_0x119571=_0x119571||0xcc;return function(_0x2ad3ed){if(_0x2ad3ed){return _0x52bdaa[_0x5975('0x16')](_0x119571);}return _0x52bdaa[_0x5975('0x17')](_0x119571)['end']();};}function respondWithResult(_0x5e355a,_0x331385){_0x331385=_0x331385||0xc8;return function(_0x1543c5){if(_0x1543c5){return _0x5e355a[_0x5975('0x17')](_0x331385)['json'](_0x1543c5);}};}function respondWithFilteredResult(_0x1a3299,_0x4de825){return function(_0x145f39){if(_0x145f39){var _0x58da02=typeof _0x4de825[_0x5975('0x18')]===_0x5975('0x19')&&typeof _0x4de825[_0x5975('0x1a')]===_0x5975('0x19');var _0x25f2a0=_0x145f39[_0x5975('0x1b')];var _0x203829=_0x58da02?0x0:_0x4de825['offset'];var _0x4e6806=_0x58da02?_0x145f39['count']:_0x4de825['offset']+_0x4de825['limit'];var _0x296185;if(_0x4e6806>=_0x25f2a0){_0x4e6806=_0x25f2a0;_0x296185=0xc8;}else{_0x296185=0xce;}_0x1a3299['status'](_0x296185);return _0x1a3299[_0x5975('0x1c')](_0x5975('0x1d'),_0x203829+'-'+_0x4e6806+'/'+_0x25f2a0)[_0x5975('0x1e')](_0x145f39);}return null;};}function patchUpdates(_0x1977bb){return function(_0x5a9df3){try{jsonpatch[_0x5975('0x1f')](_0x5a9df3,_0x1977bb,!![]);}catch(_0x133e32){return BPromise[_0x5975('0x20')](_0x133e32);}return _0x5a9df3['save']();};}function saveUpdates(_0x34b195,_0xc916a8){return function(_0x1689e2){if(_0x1689e2){return _0x1689e2[_0x5975('0x21')](_0x34b195)['then'](function(_0x48d708){return _0x48d708;});}return null;};}function removeEntity(_0x1cef80,_0x2da6c8){return function(_0x504892){if(_0x504892){return _0x504892[_0x5975('0x22')]()['then'](function(){_0x1cef80[_0x5975('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8b5a,_0x28c52f){return function(_0x4a1c85){if(!_0x4a1c85){_0x5e8b5a[_0x5975('0x16')](0x194);}return _0x4a1c85;};}function handleError(_0x763302,_0x57efee){_0x57efee=_0x57efee||0x1f4;return function(_0x54f304){logger[_0x5975('0x23')](_0x54f304[_0x5975('0x24')]);if(_0x54f304[_0x5975('0x25')]){delete _0x54f304[_0x5975('0x25')];}_0x763302[_0x5975('0x17')](_0x57efee)[_0x5975('0x26')](_0x54f304);};}exports[_0x5975('0x27')]=function(_0x24ee17,_0x406e65){var _0x52c4d8={},_0x37db84={},_0xd65354={'count':0x0,'rows':[]};var _0x2920b0=_['map'](db[_0x5975('0x28')]['rawAttributes'],function(_0x4bfd10){return{'name':_0x4bfd10[_0x5975('0x29')],'type':_0x4bfd10[_0x5975('0x2a')][_0x5975('0x2b')]};});_0x37db84[_0x5975('0x2c')]=_[_0x5975('0x2d')](_0x2920b0,'name');_0x37db84[_0x5975('0x2e')]=_[_0x5975('0x2f')](_0x24ee17['query']);_0x37db84['filters']=_['intersection'](_0x37db84[_0x5975('0x2c')],_0x37db84[_0x5975('0x2e')]);_0x52c4d8[_0x5975('0x30')]=_[_0x5975('0x31')](_0x37db84[_0x5975('0x2c')],qs[_0x5975('0x32')](_0x24ee17[_0x5975('0x2e')][_0x5975('0x32')]));_0x52c4d8[_0x5975('0x30')]=_0x52c4d8[_0x5975('0x30')][_0x5975('0x33')]?_0x52c4d8[_0x5975('0x30')]:_0x37db84[_0x5975('0x2c')];if(!_0x24ee17[_0x5975('0x2e')][_0x5975('0x34')](_0x5975('0x35'))){_0x52c4d8[_0x5975('0x1a')]=qs[_0x5975('0x1a')](_0x24ee17[_0x5975('0x2e')][_0x5975('0x1a')]);_0x52c4d8['offset']=qs[_0x5975('0x18')](_0x24ee17[_0x5975('0x2e')]['offset']);}_0x52c4d8[_0x5975('0x36')]=qs[_0x5975('0x37')](_0x24ee17[_0x5975('0x2e')]['sort']);_0x52c4d8[_0x5975('0x38')]=qs[_0x5975('0x39')](_[_0x5975('0x3a')](_0x24ee17['query'],_0x37db84[_0x5975('0x39')]),_0x2920b0);if(_0x24ee17[_0x5975('0x2e')][_0x5975('0x3b')]){_0x52c4d8['where']=_['merge'](_0x52c4d8[_0x5975('0x38')],{'$or':_[_0x5975('0x2d')](_0x2920b0,function(_0x4dca2f){if(_0x4dca2f['type']!=='VIRTUAL'){var _0x3d9ff6={};_0x3d9ff6[_0x4dca2f[_0x5975('0x25')]]={'$like':'%'+_0x24ee17[_0x5975('0x2e')][_0x5975('0x3b')]+'%'};return _0x3d9ff6;}})});}_0x52c4d8=_[_0x5975('0x3c')]({},_0x52c4d8,_0x24ee17['options']);var _0x464473={'where':_0x52c4d8[_0x5975('0x38')]};return db[_0x5975('0x28')][_0x5975('0x1b')](_0x464473)[_0x5975('0x3d')](function(_0x559ade){_0xd65354['count']=_0x559ade;if(_0x24ee17['query'][_0x5975('0x3e')]){_0x52c4d8[_0x5975('0x3f')]=[{'all':!![]}];}return db[_0x5975('0x28')]['findAll'](_0x52c4d8);})[_0x5975('0x3d')](function(_0x1cff9f){_0xd65354[_0x5975('0x40')]=_0x1cff9f;return _0xd65354;})['then'](respondWithFilteredResult(_0x406e65,_0x52c4d8))[_0x5975('0x41')](handleError(_0x406e65,null));};exports[_0x5975('0x42')]=function(_0x1251ab,_0x17b2c6){var _0x5ed816={'raw':!![],'where':{'id':_0x1251ab[_0x5975('0x43')]['id']}},_0x3cfb3a={};_0x3cfb3a[_0x5975('0x2c')]=_[_0x5975('0x2f')](db[_0x5975('0x28')][_0x5975('0x44')]);_0x3cfb3a[_0x5975('0x2e')]=_['keys'](_0x1251ab[_0x5975('0x2e')]);_0x3cfb3a[_0x5975('0x39')]=_['intersection'](_0x3cfb3a['model'],_0x3cfb3a[_0x5975('0x2e')]);_0x5ed816[_0x5975('0x30')]=_[_0x5975('0x31')](_0x3cfb3a['model'],qs[_0x5975('0x32')](_0x1251ab['query'][_0x5975('0x32')]));_0x5ed816[_0x5975('0x30')]=_0x5ed816[_0x5975('0x30')][_0x5975('0x33')]?_0x5ed816[_0x5975('0x30')]:_0x3cfb3a[_0x5975('0x2c')];if(_0x1251ab[_0x5975('0x2e')][_0x5975('0x3e')]){_0x5ed816[_0x5975('0x3f')]=[{'all':!![]}];}_0x5ed816=_[_0x5975('0x3c')]({},_0x5ed816,_0x1251ab[_0x5975('0x45')]);return db[_0x5975('0x28')][_0x5975('0x46')](_0x5ed816)['then'](handleEntityNotFound(_0x17b2c6,null))[_0x5975('0x3d')](respondWithResult(_0x17b2c6,null))[_0x5975('0x41')](handleError(_0x17b2c6,null));};exports[_0x5975('0x47')]=function(_0x664cd8,_0x350077){return db['FaxQueueReport'][_0x5975('0x47')](_0x664cd8[_0x5975('0x48')],{})['then'](respondWithResult(_0x350077,0xc9))[_0x5975('0x41')](handleError(_0x350077,null));};exports[_0x5975('0x21')]=function(_0x5045b1,_0x4214e8){if(_0x5045b1['body']['id']){delete _0x5045b1[_0x5975('0x48')]['id'];}return db[_0x5975('0x28')][_0x5975('0x46')]({'where':{'id':_0x5045b1[_0x5975('0x43')]['id']}})['then'](handleEntityNotFound(_0x4214e8,null))[_0x5975('0x3d')](saveUpdates(_0x5045b1['body'],null))[_0x5975('0x3d')](respondWithResult(_0x4214e8,null))['catch'](handleError(_0x4214e8,null));};exports[_0x5975('0x22')]=function(_0x135060,_0x4b1c7a){return db[_0x5975('0x28')][_0x5975('0x46')]({'where':{'id':_0x135060[_0x5975('0x43')]['id']}})[_0x5975('0x3d')](handleEntityNotFound(_0x4b1c7a,null))[_0x5975('0x3d')](removeEntity(_0x4b1c7a,null))['catch'](handleError(_0x4b1c7a,null));};exports[_0x5975('0x49')]=function(_0x4c095d,_0x334402){return db['FaxQueueReport'][_0x5975('0x49')]()['then'](respondWithResult(_0x334402,null))[_0x5975('0x41')](handleError(_0x334402,null));}; \ No newline at end of file +var _0x4bc3=['catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','destroy','then','sendStatus','stack','name','send','FaxQueueReport','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x4bc3,0x16e));var _0x34bc=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4bc3[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0x34bc('0x0'));var rimraf=require(_0x34bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34bc('0x2'));var rp=require(_0x34bc('0x3'));var moment=require('moment');var BPromise=require(_0x34bc('0x4'));var Mustache=require(_0x34bc('0x5'));var util=require(_0x34bc('0x6'));var path=require(_0x34bc('0x7'));var sox=require(_0x34bc('0x8'));var csv=require(_0x34bc('0x9'));var ejs=require(_0x34bc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34bc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x34bc('0xc'));var deskjs=require(_0x34bc('0xd'));var toCsv=require(_0x34bc('0x9'));var querystring=require(_0x34bc('0xe'));var Papa=require(_0x34bc('0xf'));var Redis=require(_0x34bc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x34bc('0x11'));var hardwareService=require(_0x34bc('0x12'));var logger=require(_0x34bc('0x13'))('api');var utils=require(_0x34bc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x34bc('0x15'));var db=require(_0x34bc('0x16'))['db'];function respondWithStatusCode(_0x164fb2,_0x536ebd){_0x536ebd=_0x536ebd||0xcc;return function(_0x3f8852){if(_0x3f8852){return _0x164fb2['sendStatus'](_0x536ebd);}return _0x164fb2[_0x34bc('0x17')](_0x536ebd)[_0x34bc('0x18')]();};}function respondWithResult(_0xc77013,_0x5a22a3){_0x5a22a3=_0x5a22a3||0xc8;return function(_0x4c365a){if(_0x4c365a){return _0xc77013[_0x34bc('0x17')](_0x5a22a3)['json'](_0x4c365a);}};}function respondWithFilteredResult(_0x3e93bf,_0x217605){return function(_0x1da8eb){if(_0x1da8eb){var _0x25da29=typeof _0x217605[_0x34bc('0x19')]===_0x34bc('0x1a')&&typeof _0x217605['limit']==='undefined';var _0x5a5895=_0x1da8eb[_0x34bc('0x1b')];var _0x3eaedf=_0x25da29?0x0:_0x217605[_0x34bc('0x19')];var _0x239e6c=_0x25da29?_0x1da8eb['count']:_0x217605[_0x34bc('0x19')]+_0x217605[_0x34bc('0x1c')];var _0x50106a;if(_0x239e6c>=_0x5a5895){_0x239e6c=_0x5a5895;_0x50106a=0xc8;}else{_0x50106a=0xce;}_0x3e93bf[_0x34bc('0x17')](_0x50106a);return _0x3e93bf[_0x34bc('0x1d')]('Content-Range',_0x3eaedf+'-'+_0x239e6c+'/'+_0x5a5895)[_0x34bc('0x1e')](_0x1da8eb);}return null;};}function patchUpdates(_0x26cdec){return function(_0x2d18ea){try{jsonpatch[_0x34bc('0x1f')](_0x2d18ea,_0x26cdec,!![]);}catch(_0x1f993b){return BPromise[_0x34bc('0x20')](_0x1f993b);}return _0x2d18ea['save']();};}function saveUpdates(_0x40e128,_0x3c9939){return function(_0x38882c){if(_0x38882c){return _0x38882c['update'](_0x40e128)['then'](function(_0x358d51){return _0x358d51;});}return null;};}function removeEntity(_0x1b820a,_0x4263de){return function(_0x410800){if(_0x410800){return _0x410800[_0x34bc('0x21')]()[_0x34bc('0x22')](function(){_0x1b820a[_0x34bc('0x17')](0xcc)[_0x34bc('0x18')]();});}};}function handleEntityNotFound(_0x19472e,_0x25d6fe){return function(_0x2de017){if(!_0x2de017){_0x19472e[_0x34bc('0x23')](0x194);}return _0x2de017;};}function handleError(_0x4fd589,_0x43e527){_0x43e527=_0x43e527||0x1f4;return function(_0x48ec13){logger['error'](_0x48ec13[_0x34bc('0x24')]);if(_0x48ec13['name']){delete _0x48ec13[_0x34bc('0x25')];}_0x4fd589[_0x34bc('0x17')](_0x43e527)[_0x34bc('0x26')](_0x48ec13);};}exports['index']=function(_0x2e6d96,_0x351ed8){var _0x384fd7={},_0x1a83f7={},_0x2bb874={'count':0x0,'rows':[]};var _0x33bf46=_['map'](db[_0x34bc('0x27')][_0x34bc('0x28')],function(_0x22aacc){return{'name':_0x22aacc[_0x34bc('0x29')],'type':_0x22aacc[_0x34bc('0x2a')][_0x34bc('0x2b')]};});_0x1a83f7['model']=_[_0x34bc('0x2c')](_0x33bf46,'name');_0x1a83f7['query']=_[_0x34bc('0x2d')](_0x2e6d96['query']);_0x1a83f7[_0x34bc('0x2e')]=_[_0x34bc('0x2f')](_0x1a83f7[_0x34bc('0x30')],_0x1a83f7[_0x34bc('0x31')]);_0x384fd7[_0x34bc('0x32')]=_[_0x34bc('0x2f')](_0x1a83f7[_0x34bc('0x30')],qs['fields'](_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x33')]));_0x384fd7[_0x34bc('0x32')]=_0x384fd7[_0x34bc('0x32')][_0x34bc('0x34')]?_0x384fd7['attributes']:_0x1a83f7[_0x34bc('0x30')];if(!_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x35')](_0x34bc('0x36'))){_0x384fd7[_0x34bc('0x1c')]=qs['limit'](_0x2e6d96['query'][_0x34bc('0x1c')]);_0x384fd7[_0x34bc('0x19')]=qs[_0x34bc('0x19')](_0x2e6d96[_0x34bc('0x31')]['offset']);}_0x384fd7[_0x34bc('0x37')]=qs[_0x34bc('0x38')](_0x2e6d96[_0x34bc('0x31')]['sort']);_0x384fd7[_0x34bc('0x39')]=qs[_0x34bc('0x2e')](_[_0x34bc('0x3a')](_0x2e6d96[_0x34bc('0x31')],_0x1a83f7['filters']),_0x33bf46);if(_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x3b')]){_0x384fd7[_0x34bc('0x39')]=_['merge'](_0x384fd7[_0x34bc('0x39')],{'$or':_[_0x34bc('0x2c')](_0x33bf46,function(_0x71d6bb){if(_0x71d6bb[_0x34bc('0x2a')]!==_0x34bc('0x3c')){var _0x4fc2dc={};_0x4fc2dc[_0x71d6bb[_0x34bc('0x25')]]={'$like':'%'+_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x3b')]+'%'};return _0x4fc2dc;}})});}_0x384fd7=_[_0x34bc('0x3d')]({},_0x384fd7,_0x2e6d96[_0x34bc('0x3e')]);var _0x4bf331={'where':_0x384fd7[_0x34bc('0x39')]};return db['FaxQueueReport'][_0x34bc('0x1b')](_0x4bf331)[_0x34bc('0x22')](function(_0xfaa92d){_0x2bb874[_0x34bc('0x1b')]=_0xfaa92d;if(_0x2e6d96['query'][_0x34bc('0x3f')]){_0x384fd7[_0x34bc('0x40')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x34bc('0x41')](_0x384fd7);})[_0x34bc('0x22')](function(_0xa2cbd0){_0x2bb874['rows']=_0xa2cbd0;return _0x2bb874;})[_0x34bc('0x22')](respondWithFilteredResult(_0x351ed8,_0x384fd7))[_0x34bc('0x42')](handleError(_0x351ed8,null));};exports[_0x34bc('0x43')]=function(_0x3444ea,_0xacada7){var _0x20debf={'raw':!![],'where':{'id':_0x3444ea[_0x34bc('0x44')]['id']}},_0x428326={};_0x428326[_0x34bc('0x30')]=_[_0x34bc('0x2d')](db[_0x34bc('0x27')]['rawAttributes']);_0x428326['query']=_[_0x34bc('0x2d')](_0x3444ea[_0x34bc('0x31')]);_0x428326[_0x34bc('0x2e')]=_[_0x34bc('0x2f')](_0x428326[_0x34bc('0x30')],_0x428326[_0x34bc('0x31')]);_0x20debf['attributes']=_[_0x34bc('0x2f')](_0x428326['model'],qs[_0x34bc('0x33')](_0x3444ea[_0x34bc('0x31')][_0x34bc('0x33')]));_0x20debf['attributes']=_0x20debf[_0x34bc('0x32')][_0x34bc('0x34')]?_0x20debf[_0x34bc('0x32')]:_0x428326[_0x34bc('0x30')];if(_0x3444ea[_0x34bc('0x31')][_0x34bc('0x3f')]){_0x20debf[_0x34bc('0x40')]=[{'all':!![]}];}_0x20debf=_[_0x34bc('0x3d')]({},_0x20debf,_0x3444ea[_0x34bc('0x3e')]);return db[_0x34bc('0x27')][_0x34bc('0x45')](_0x20debf)[_0x34bc('0x22')](handleEntityNotFound(_0xacada7,null))['then'](respondWithResult(_0xacada7,null))['catch'](handleError(_0xacada7,null));};exports[_0x34bc('0x46')]=function(_0x14bda4,_0x180a51){return db['FaxQueueReport']['create'](_0x14bda4[_0x34bc('0x47')],{})[_0x34bc('0x22')](respondWithResult(_0x180a51,0xc9))[_0x34bc('0x42')](handleError(_0x180a51,null));};exports['update']=function(_0x43bfb7,_0x25b02e){if(_0x43bfb7['body']['id']){delete _0x43bfb7[_0x34bc('0x47')]['id'];}return db['FaxQueueReport'][_0x34bc('0x45')]({'where':{'id':_0x43bfb7['params']['id']}})[_0x34bc('0x22')](handleEntityNotFound(_0x25b02e,null))[_0x34bc('0x22')](saveUpdates(_0x43bfb7[_0x34bc('0x47')],null))[_0x34bc('0x22')](respondWithResult(_0x25b02e,null))['catch'](handleError(_0x25b02e,null));};exports[_0x34bc('0x21')]=function(_0x2bbd0b,_0x103bd1){return db[_0x34bc('0x27')][_0x34bc('0x45')]({'where':{'id':_0x2bbd0b[_0x34bc('0x44')]['id']}})[_0x34bc('0x22')](handleEntityNotFound(_0x103bd1,null))[_0x34bc('0x22')](removeEntity(_0x103bd1,null))['catch'](handleError(_0x103bd1,null));};exports['describe']=function(_0x561ee8,_0x3a66b4){return db[_0x34bc('0x27')]['describe']()[_0x34bc('0x22')](respondWithResult(_0x3a66b4,null))[_0x34bc('0x42')](handleError(_0x3a66b4,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 5487e73..87025c3 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 _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x5f0f78,_0x12b8e6){var _0x14a3bc=function(_0x1018a7){while(--_0x1018a7){_0x5f0f78['push'](_0x5f0f78['shift']());}};_0x14a3bc(++_0x12b8e6);}(_0x5fab,0x177));var _0xb5fa=function(_0x2f7d18,_0x44bea6){_0x2f7d18=_0x2f7d18-0x0;var _0x425175=_0x5fab[_0x2f7d18];return _0x425175;};'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':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x3b93bb,_0x3807e0){var _0x276727=function(_0x2ea1cf){while(--_0x2ea1cf){_0x3b93bb['push'](_0x3b93bb['shift']());}};_0x276727(++_0x3807e0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'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/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index b570608..74fba73 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 _0x318a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','update','lodash','moment'];(function(_0x1f8e66,_0x2a3d83){var _0x59f195=function(_0x594f54){while(--_0x594f54){_0x1f8e66['push'](_0x1f8e66['shift']());}};_0x59f195(++_0x2a3d83);}(_0x318a,0x1de));var _0xa318=function(_0x15568f,_0x1f4581){_0x15568f=_0x15568f-0x0;var _0x1b8e3a=_0x318a[_0x15568f];return _0x1b8e3a;};'use strict';var _=require(_0xa318('0x0'));var util=require('util');var moment=require(_0xa318('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa318('0x2'));var db=require(_0xa318('0x3'))['db'];var utils=require(_0xa318('0x4'));var logger=require(_0xa318('0x5'))(_0xa318('0x6'));var config=require(_0xa318('0x7'));var jayson=require(_0xa318('0x8'));var client=jayson['client'][_0xa318('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x445a6a,_0x1b4e62,_0x4c8961){return new BPromise(function(_0x53aab8,_0x6a81e3){return client[_0xa318('0xa')](_0x445a6a,_0x4c8961)['then'](function(_0x563dbb){logger['info'](_0xa318('0xb'),_0x1b4e62,_0xa318('0xc'));logger[_0xa318('0xd')](_0xa318('0xe'),_0x1b4e62,_0xa318('0xc'),JSON[_0xa318('0xf')](_0x563dbb));if(_0x563dbb[_0xa318('0x10')]){if(_0x563dbb[_0xa318('0x10')]['code']===0x1f4){logger[_0xa318('0x10')](_0xa318('0xb'),_0x1b4e62,_0x563dbb[_0xa318('0x10')][_0xa318('0x11')]);return _0x6a81e3(_0x563dbb['error']['message']);}logger[_0xa318('0x10')](_0xa318('0xb'),_0x1b4e62,_0x563dbb[_0xa318('0x10')]['message']);return _0x53aab8(_0x563dbb['error'][_0xa318('0x11')]);}else{logger[_0xa318('0x12')](_0xa318('0xb'),_0x1b4e62,_0xa318('0xc'));_0x53aab8(_0x563dbb[_0xa318('0x13')][_0xa318('0x11')]);}})[_0xa318('0x14')](function(_0x4d78dc){logger[_0xa318('0x10')](_0xa318('0xb'),_0x1b4e62,_0x4d78dc);_0x6a81e3(_0x4d78dc);});});}exports[_0xa318('0x15')]=function(_0x517e2c){var _0x184f37=this;return new Promise(function(_0x21c350,_0x359656){return db[_0xa318('0x16')][_0xa318('0x17')](_0x517e2c[_0xa318('0x18')],{'raw':_0x517e2c[_0xa318('0x19')]?_0x517e2c[_0xa318('0x19')][_0xa318('0x1a')]===undefined?!![]:![]:!![]})[_0xa318('0x1b')](function(_0x708d15){logger[_0xa318('0x12')](_0xa318('0x15'),_0x517e2c);logger[_0xa318('0xd')]('CreateFaxQueueReport',_0x517e2c,JSON[_0xa318('0xf')](_0x708d15));_0x21c350(_0x708d15);})[_0xa318('0x14')](function(_0x3f64a7){logger['error'](_0xa318('0x15'),_0x3f64a7[_0xa318('0x11')],_0x517e2c);_0x359656(_0x184f37['error'](0x1f4,_0x3f64a7[_0xa318('0x11')]));});});};exports[_0xa318('0x1c')]=function(_0x30cb6f){var _0xe25c65=this;return new Promise(function(_0x6854bb,_0x43ebfa){return db[_0xa318('0x16')][_0xa318('0x1d')](_0x30cb6f[_0xa318('0x18')],{'raw':_0x30cb6f[_0xa318('0x19')]?_0x30cb6f['options'][_0xa318('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30cb6f[_0xa318('0x19')]?_0x30cb6f['options']['where']||null:null,'attributes':_0x30cb6f[_0xa318('0x19')]?_0x30cb6f[_0xa318('0x19')]['attributes']||null:null,'limit':_0x30cb6f[_0xa318('0x19')]?_0x30cb6f['options']['limit']||null:null})[_0xa318('0x1b')](function(_0xc95637){logger[_0xa318('0x12')](_0xa318('0x1c'),_0x30cb6f);logger['debug'](_0xa318('0x1c'),_0x30cb6f,JSON[_0xa318('0xf')](_0xc95637));_0x6854bb(_0xc95637);})['catch'](function(_0x4bde3f){logger[_0xa318('0x10')](_0xa318('0x1c'),_0x4bde3f[_0xa318('0x11')],_0x30cb6f);_0x43ebfa(_0xe25c65[_0xa318('0x10')](0x1f4,_0x4bde3f['message']));});});}; \ No newline at end of file +var _0x2d83=['raw','UpdateFaxQueueReport','FaxQueueReport','update','limit','then','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxQueueReport','body','options'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x2d83,0x92));var _0x32d8=function(_0x1ce35c,_0x19f4a5){_0x1ce35c=_0x1ce35c-0x0;var _0x4e4bcf=_0x2d83[_0x1ce35c];return _0x4e4bcf;};'use strict';var _=require(_0x32d8('0x0'));var util=require('util');var moment=require(_0x32d8('0x1'));var BPromise=require(_0x32d8('0x2'));var rs=require(_0x32d8('0x3'));var fs=require('fs');var Redis=require(_0x32d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x32d8('0x5'))(_0x32d8('0x6'));var config=require('../../config/environment');var jayson=require(_0x32d8('0x7'));var client=jayson[_0x32d8('0x8')][_0x32d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17ed9c,_0x1d2255,_0x26da47){return new BPromise(function(_0x1783f5,_0x2a8f96){return client['request'](_0x17ed9c,_0x26da47)['then'](function(_0x386aeb){logger[_0x32d8('0xa')](_0x32d8('0xb'),_0x1d2255,_0x32d8('0xc'));logger['debug'](_0x32d8('0xd'),_0x1d2255,'request\x20sent',JSON[_0x32d8('0xe')](_0x386aeb));if(_0x386aeb[_0x32d8('0xf')]){if(_0x386aeb[_0x32d8('0xf')][_0x32d8('0x10')]===0x1f4){logger[_0x32d8('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x1d2255,_0x386aeb[_0x32d8('0xf')][_0x32d8('0x11')]);return _0x2a8f96(_0x386aeb[_0x32d8('0xf')][_0x32d8('0x11')]);}logger[_0x32d8('0xf')](_0x32d8('0xb'),_0x1d2255,_0x386aeb[_0x32d8('0xf')][_0x32d8('0x11')]);return _0x1783f5(_0x386aeb['error'][_0x32d8('0x11')]);}else{logger[_0x32d8('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x1d2255,_0x32d8('0xc'));_0x1783f5(_0x386aeb['result'][_0x32d8('0x11')]);}})[_0x32d8('0x12')](function(_0x4d811d){logger[_0x32d8('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x1d2255,_0x4d811d);_0x2a8f96(_0x4d811d);});});}exports[_0x32d8('0x13')]=function(_0x4844c3){var _0x64f598=this;return new Promise(function(_0x2f4b8a,_0x2cd24b){return db['FaxQueueReport']['create'](_0x4844c3[_0x32d8('0x14')],{'raw':_0x4844c3['options']?_0x4844c3[_0x32d8('0x15')][_0x32d8('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xf4a770){logger[_0x32d8('0xa')]('CreateFaxQueueReport',_0x4844c3);logger['debug'](_0x32d8('0x13'),_0x4844c3,JSON[_0x32d8('0xe')](_0xf4a770));_0x2f4b8a(_0xf4a770);})['catch'](function(_0x3dbaab){logger[_0x32d8('0xf')](_0x32d8('0x13'),_0x3dbaab[_0x32d8('0x11')],_0x4844c3);_0x2cd24b(_0x64f598[_0x32d8('0xf')](0x1f4,_0x3dbaab[_0x32d8('0x11')]));});});};exports[_0x32d8('0x17')]=function(_0x59de7c){var _0xaae6df=this;return new Promise(function(_0xb5461,_0x16514c){return db[_0x32d8('0x18')][_0x32d8('0x19')](_0x59de7c['body'],{'raw':_0x59de7c[_0x32d8('0x15')]?_0x59de7c[_0x32d8('0x15')][_0x32d8('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59de7c[_0x32d8('0x15')]?_0x59de7c['options']['where']||null:null,'attributes':_0x59de7c[_0x32d8('0x15')]?_0x59de7c['options']['attributes']||null:null,'limit':_0x59de7c[_0x32d8('0x15')]?_0x59de7c[_0x32d8('0x15')][_0x32d8('0x1a')]||null:null})[_0x32d8('0x1b')](function(_0x536fa1){logger[_0x32d8('0xa')](_0x32d8('0x17'),_0x59de7c);logger['debug'](_0x32d8('0x17'),_0x59de7c,JSON[_0x32d8('0xe')](_0x536fa1));_0xb5461(_0x536fa1);})[_0x32d8('0x12')](function(_0x4cd228){logger[_0x32d8('0xf')](_0x32d8('0x17'),_0x4cd228[_0x32d8('0x11')],_0x59de7c);_0x16514c(_0xaae6df[_0x32d8('0xf')](0x1f4,_0x4cd228[_0x32d8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 41d215f..9e6b87e 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 _0x23d4=['index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get'];(function(_0x43b88c,_0x46fb04){var _0x407299=function(_0x16dcd3){while(--_0x16dcd3){_0x43b88c['push'](_0x43b88c['shift']());}};_0x407299(++_0x46fb04);}(_0x23d4,0x1d9));var _0x423d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x23d4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x423d('0x0'));var path=require(_0x423d('0x1'));var timeout=require(_0x423d('0x2'));var express=require(_0x423d('0x3'));var router=express[_0x423d('0x4')]();var fs_extra=require(_0x423d('0x5'));var auth=require(_0x423d('0x6'));var interaction=require(_0x423d('0x7'));var config=require(_0x423d('0x8'));var controller=require(_0x423d('0x9'));router[_0x423d('0xa')]('/',auth['isAuthenticated'](),controller[_0x423d('0xb')]);router[_0x423d('0xa')]('/describe',auth[_0x423d('0xc')](),controller[_0x423d('0xd')]);router['get'](_0x423d('0xe'),auth['isAuthenticated'](),controller[_0x423d('0xf')]);router[_0x423d('0x10')]('/',auth['isAuthenticated'](),controller[_0x423d('0x11')]);router[_0x423d('0x12')]('/:id',auth[_0x423d('0xc')](),controller[_0x423d('0x13')]);router[_0x423d('0x14')](_0x423d('0xe'),auth[_0x423d('0xc')](),controller['destroy']);module[_0x423d('0x15')]=router; \ No newline at end of file +var _0xb39a=['/:id','create','put','update','delete','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x209ba4,_0x11aee){var _0x336e86=function(_0x46b455){while(--_0x46b455){_0x209ba4['push'](_0x209ba4['shift']());}};_0x336e86(++_0x11aee);}(_0xb39a,0xa7));var _0xab39=function(_0x109e1d,_0x4474f0){_0x109e1d=_0x109e1d-0x0;var _0x549e93=_0xb39a[_0x109e1d];return _0x549e93;};'use strict';var multer=require(_0xab39('0x0'));var util=require(_0xab39('0x1'));var path=require('path');var timeout=require(_0xab39('0x2'));var express=require('express');var router=express[_0xab39('0x3')]();var fs_extra=require(_0xab39('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xab39('0x5'));var config=require(_0xab39('0x6'));var controller=require(_0xab39('0x7'));router[_0xab39('0x8')]('/',auth[_0xab39('0x9')](),controller[_0xab39('0xa')]);router[_0xab39('0x8')](_0xab39('0xb'),auth['isAuthenticated'](),controller[_0xab39('0xc')]);router[_0xab39('0x8')](_0xab39('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xab39('0x9')](),controller[_0xab39('0xe')]);router[_0xab39('0xf')]('/:id',auth[_0xab39('0x9')](),controller[_0xab39('0x10')]);router[_0xab39('0x11')](_0xab39('0xd'),auth[_0xab39('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 37882a5..5e7a56c 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3a36dc,_0x3a06b0){var _0x5bff8e=function(_0x39734b){while(--_0x39734b){_0x3a36dc['push'](_0x3a36dc['shift']());}};_0x5bff8e(++_0x3a06b0);}(_0xaa88,0x137));var _0x8aa8=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xaa88[_0x55abd9];return _0x3e5669;};'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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xfb675c,_0x2cfb12){var _0x56179a=function(_0x4d7e34){while(--_0x4d7e34){_0xfb675c['push'](_0xfb675c['shift']());}};_0x56179a(++_0x2cfb12);}(_0x34e8,0x12c));var _0x834e=function(_0x59a508,_0x586f9f){_0x59a508=_0x59a508-0x0;var _0x39825a=_0x34e8[_0x59a508];return _0x39825a;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 9de24a2..55a3c3b 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 _0xd065=['../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','sendStatus','error','stack','index','map','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','name','options','FaxTransferReport','includeAll','include','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x2fc8cb,_0x556d1d){var _0x2362c5=function(_0x27e69a){while(--_0x27e69a){_0x2fc8cb['push'](_0x2fc8cb['shift']());}};_0x2362c5(++_0x556d1d);}(_0xd065,0x158));var _0x5d06=function(_0x1819da,_0x369fe0){_0x1819da=_0x1819da-0x0;var _0x4394a8=_0xd065[_0x1819da];return _0x4394a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d06('0x0'));var zipdir=require(_0x5d06('0x1'));var jsonpatch=require(_0x5d06('0x2'));var rp=require(_0x5d06('0x3'));var moment=require('moment');var BPromise=require(_0x5d06('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5d06('0x5'));var csv=require('to-csv');var ejs=require(_0x5d06('0x6'));var fs=require('fs');var fs_extra=require(_0x5d06('0x7'));var _=require(_0x5d06('0x8'));var squel=require(_0x5d06('0x9'));var crypto=require(_0x5d06('0xa'));var jsforce=require(_0x5d06('0xb'));var deskjs=require(_0x5d06('0xc'));var toCsv=require(_0x5d06('0xd'));var querystring=require(_0x5d06('0xe'));var Papa=require(_0x5d06('0xf'));var Redis=require(_0x5d06('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5d06('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d06('0x12'));var logger=require(_0x5d06('0x13'))(_0x5d06('0x14'));var utils=require('../../config/utils');var config=require(_0x5d06('0x15'));var licenseUtil=require(_0x5d06('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bc152,_0xecad66){_0xecad66=_0xecad66||0xcc;return function(_0x329ee6){if(_0x329ee6){return _0x3bc152['sendStatus'](_0xecad66);}return _0x3bc152[_0x5d06('0x17')](_0xecad66)[_0x5d06('0x18')]();};}function respondWithResult(_0x420be2,_0x1851a9){_0x1851a9=_0x1851a9||0xc8;return function(_0x5cc9be){if(_0x5cc9be){return _0x420be2[_0x5d06('0x17')](_0x1851a9)[_0x5d06('0x19')](_0x5cc9be);}};}function respondWithFilteredResult(_0x6cc909,_0x420bd9){return function(_0x77fc62){if(_0x77fc62){var _0xa12242=typeof _0x420bd9[_0x5d06('0x1a')]===_0x5d06('0x1b')&&typeof _0x420bd9['limit']===_0x5d06('0x1b');var _0x1a1bb0=_0x77fc62['count'];var _0x2c1551=_0xa12242?0x0:_0x420bd9['offset'];var _0x5ee977=_0xa12242?_0x77fc62[_0x5d06('0x1c')]:_0x420bd9[_0x5d06('0x1a')]+_0x420bd9[_0x5d06('0x1d')];var _0xc321dd;if(_0x5ee977>=_0x1a1bb0){_0x5ee977=_0x1a1bb0;_0xc321dd=0xc8;}else{_0xc321dd=0xce;}_0x6cc909[_0x5d06('0x17')](_0xc321dd);return _0x6cc909['set'](_0x5d06('0x1e'),_0x2c1551+'-'+_0x5ee977+'/'+_0x1a1bb0)['json'](_0x77fc62);}return null;};}function patchUpdates(_0x1bdbe2){return function(_0x41b064){try{jsonpatch[_0x5d06('0x1f')](_0x41b064,_0x1bdbe2,!![]);}catch(_0x4c5abb){return BPromise['reject'](_0x4c5abb);}return _0x41b064['save']();};}function saveUpdates(_0x811fdc,_0x41094e){return function(_0x21f5cf){if(_0x21f5cf){return _0x21f5cf[_0x5d06('0x20')](_0x811fdc)[_0x5d06('0x21')](function(_0x58abc6){return _0x58abc6;});}return null;};}function removeEntity(_0x4f1c8f,_0x4f4d4f){return function(_0x3272bc){if(_0x3272bc){return _0x3272bc[_0x5d06('0x22')]()[_0x5d06('0x21')](function(){_0x4f1c8f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36166b,_0x59b1b7){return function(_0x189a4e){if(!_0x189a4e){_0x36166b[_0x5d06('0x23')](0x194);}return _0x189a4e;};}function handleError(_0x13a170,_0x5bbdb4){_0x5bbdb4=_0x5bbdb4||0x1f4;return function(_0x4e33b1){logger[_0x5d06('0x24')](_0x4e33b1[_0x5d06('0x25')]);if(_0x4e33b1['name']){delete _0x4e33b1['name'];}_0x13a170[_0x5d06('0x17')](_0x5bbdb4)['send'](_0x4e33b1);};}exports[_0x5d06('0x26')]=function(_0x7e27f6,_0x69578){var _0x294ef0={},_0x2ca49b={},_0x4f6e63={'count':0x0,'rows':[]};var _0x5267b8=_[_0x5d06('0x27')](db['FaxTransferReport'][_0x5d06('0x28')],function(_0x11a317){return{'name':_0x11a317[_0x5d06('0x29')],'type':_0x11a317['type']['key']};});_0x2ca49b[_0x5d06('0x2a')]=_[_0x5d06('0x27')](_0x5267b8,'name');_0x2ca49b[_0x5d06('0x2b')]=_[_0x5d06('0x2c')](_0x7e27f6[_0x5d06('0x2b')]);_0x2ca49b['filters']=_['intersection'](_0x2ca49b[_0x5d06('0x2a')],_0x2ca49b[_0x5d06('0x2b')]);_0x294ef0[_0x5d06('0x2d')]=_[_0x5d06('0x2e')](_0x2ca49b[_0x5d06('0x2a')],qs[_0x5d06('0x2f')](_0x7e27f6[_0x5d06('0x2b')]['fields']));_0x294ef0[_0x5d06('0x2d')]=_0x294ef0[_0x5d06('0x2d')][_0x5d06('0x30')]?_0x294ef0['attributes']:_0x2ca49b[_0x5d06('0x2a')];if(!_0x7e27f6[_0x5d06('0x2b')][_0x5d06('0x31')](_0x5d06('0x32'))){_0x294ef0['limit']=qs[_0x5d06('0x1d')](_0x7e27f6['query'][_0x5d06('0x1d')]);_0x294ef0[_0x5d06('0x1a')]=qs['offset'](_0x7e27f6['query'][_0x5d06('0x1a')]);}_0x294ef0[_0x5d06('0x33')]=qs[_0x5d06('0x34')](_0x7e27f6['query'][_0x5d06('0x34')]);_0x294ef0[_0x5d06('0x35')]=qs[_0x5d06('0x36')](_[_0x5d06('0x37')](_0x7e27f6['query'],_0x2ca49b[_0x5d06('0x36')]),_0x5267b8);if(_0x7e27f6[_0x5d06('0x2b')][_0x5d06('0x38')]){_0x294ef0['where']=_[_0x5d06('0x39')](_0x294ef0[_0x5d06('0x35')],{'$or':_[_0x5d06('0x27')](_0x5267b8,function(_0x4266d){if(_0x4266d[_0x5d06('0x3a')]!==_0x5d06('0x3b')){var _0x551332={};_0x551332[_0x4266d[_0x5d06('0x3c')]]={'$like':'%'+_0x7e27f6[_0x5d06('0x2b')][_0x5d06('0x38')]+'%'};return _0x551332;}})});}_0x294ef0=_['merge']({},_0x294ef0,_0x7e27f6[_0x5d06('0x3d')]);var _0x1ce59a={'where':_0x294ef0[_0x5d06('0x35')]};return db[_0x5d06('0x3e')][_0x5d06('0x1c')](_0x1ce59a)[_0x5d06('0x21')](function(_0x76d191){_0x4f6e63[_0x5d06('0x1c')]=_0x76d191;if(_0x7e27f6[_0x5d06('0x2b')][_0x5d06('0x3f')]){_0x294ef0[_0x5d06('0x40')]=[{'all':!![]}];}return db[_0x5d06('0x3e')]['findAll'](_0x294ef0);})[_0x5d06('0x21')](function(_0x516386){_0x4f6e63[_0x5d06('0x41')]=_0x516386;return _0x4f6e63;})[_0x5d06('0x21')](respondWithFilteredResult(_0x69578,_0x294ef0))[_0x5d06('0x42')](handleError(_0x69578,null));};exports[_0x5d06('0x43')]=function(_0x5ec07b,_0x4f9bcc){var _0x56e3c0={'raw':!![],'where':{'id':_0x5ec07b[_0x5d06('0x44')]['id']}},_0x359044={};_0x359044['model']=_['keys'](db[_0x5d06('0x3e')][_0x5d06('0x28')]);_0x359044[_0x5d06('0x2b')]=_['keys'](_0x5ec07b['query']);_0x359044[_0x5d06('0x36')]=_[_0x5d06('0x2e')](_0x359044[_0x5d06('0x2a')],_0x359044['query']);_0x56e3c0['attributes']=_[_0x5d06('0x2e')](_0x359044[_0x5d06('0x2a')],qs['fields'](_0x5ec07b[_0x5d06('0x2b')][_0x5d06('0x2f')]));_0x56e3c0['attributes']=_0x56e3c0[_0x5d06('0x2d')]['length']?_0x56e3c0[_0x5d06('0x2d')]:_0x359044[_0x5d06('0x2a')];if(_0x5ec07b[_0x5d06('0x2b')][_0x5d06('0x3f')]){_0x56e3c0['include']=[{'all':!![]}];}_0x56e3c0=_['merge']({},_0x56e3c0,_0x5ec07b[_0x5d06('0x3d')]);return db[_0x5d06('0x3e')][_0x5d06('0x45')](_0x56e3c0)[_0x5d06('0x21')](handleEntityNotFound(_0x4f9bcc,null))[_0x5d06('0x21')](respondWithResult(_0x4f9bcc,null))[_0x5d06('0x42')](handleError(_0x4f9bcc,null));};exports[_0x5d06('0x46')]=function(_0x1d47b0,_0x400cdf){return db[_0x5d06('0x3e')][_0x5d06('0x46')](_0x1d47b0[_0x5d06('0x47')],{})[_0x5d06('0x21')](respondWithResult(_0x400cdf,0xc9))[_0x5d06('0x42')](handleError(_0x400cdf,null));};exports[_0x5d06('0x20')]=function(_0x27939c,_0x43d342){if(_0x27939c[_0x5d06('0x47')]['id']){delete _0x27939c[_0x5d06('0x47')]['id'];}return db[_0x5d06('0x3e')][_0x5d06('0x45')]({'where':{'id':_0x27939c[_0x5d06('0x44')]['id']}})[_0x5d06('0x21')](handleEntityNotFound(_0x43d342,null))[_0x5d06('0x21')](saveUpdates(_0x27939c[_0x5d06('0x47')],null))[_0x5d06('0x21')](respondWithResult(_0x43d342,null))[_0x5d06('0x42')](handleError(_0x43d342,null));};exports[_0x5d06('0x22')]=function(_0x4ac727,_0x360269){return db[_0x5d06('0x3e')][_0x5d06('0x45')]({'where':{'id':_0x4ac727[_0x5d06('0x44')]['id']}})[_0x5d06('0x21')](handleEntityNotFound(_0x360269,null))[_0x5d06('0x21')](removeEntity(_0x360269,null))[_0x5d06('0x42')](handleError(_0x360269,null));};exports['describe']=function(_0x5eac1f,_0x5684a1){return db[_0x5d06('0x3e')][_0x5d06('0x48')]()[_0x5d06('0x21')](respondWithResult(_0x5684a1,null))[_0x5d06('0x42')](handleError(_0x5684a1,null));}; \ No newline at end of file +var _0xd470=['order','where','pick','filter','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd470,0xf7));var _0x0d47=function(_0x5eff7f,_0x41eb27){_0x5eff7f=_0x5eff7f-0x0;var _0x302866=_0xd470[_0x5eff7f];return _0x302866;};'use strict';var emlformat=require(_0x0d47('0x0'));var rimraf=require(_0x0d47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d47('0x2'));var rp=require('request-promise');var moment=require(_0x0d47('0x3'));var BPromise=require(_0x0d47('0x4'));var Mustache=require(_0x0d47('0x5'));var util=require(_0x0d47('0x6'));var path=require(_0x0d47('0x7'));var sox=require(_0x0d47('0x8'));var csv=require(_0x0d47('0x9'));var ejs=require(_0x0d47('0xa'));var fs=require('fs');var fs_extra=require(_0x0d47('0xb'));var _=require(_0x0d47('0xc'));var squel=require(_0x0d47('0xd'));var crypto=require(_0x0d47('0xe'));var jsforce=require(_0x0d47('0xf'));var deskjs=require(_0x0d47('0x10'));var toCsv=require(_0x0d47('0x9'));var querystring=require(_0x0d47('0x11'));var Papa=require(_0x0d47('0x12'));var Redis=require('ioredis');var authService=require(_0x0d47('0x13'));var qs=require(_0x0d47('0x14'));var as=require(_0x0d47('0x15'));var hardwareService=require(_0x0d47('0x16'));var logger=require(_0x0d47('0x17'))('api');var utils=require(_0x0d47('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0d47('0x19'))['db'];function respondWithStatusCode(_0x55db24,_0x52c187){_0x52c187=_0x52c187||0xcc;return function(_0x269b68){if(_0x269b68){return _0x55db24[_0x0d47('0x1a')](_0x52c187);}return _0x55db24['status'](_0x52c187)[_0x0d47('0x1b')]();};}function respondWithResult(_0x552e76,_0x129a12){_0x129a12=_0x129a12||0xc8;return function(_0x46a919){if(_0x46a919){return _0x552e76[_0x0d47('0x1c')](_0x129a12)[_0x0d47('0x1d')](_0x46a919);}};}function respondWithFilteredResult(_0x592654,_0x563d0f){return function(_0x58819f){if(_0x58819f){var _0x1b134f=typeof _0x563d0f[_0x0d47('0x1e')]==='undefined'&&typeof _0x563d0f['limit']===_0x0d47('0x1f');var _0x33b9cc=_0x58819f[_0x0d47('0x20')];var _0x46725b=_0x1b134f?0x0:_0x563d0f[_0x0d47('0x1e')];var _0x59db61=_0x1b134f?_0x58819f[_0x0d47('0x20')]:_0x563d0f[_0x0d47('0x1e')]+_0x563d0f['limit'];var _0x5c5f1f;if(_0x59db61>=_0x33b9cc){_0x59db61=_0x33b9cc;_0x5c5f1f=0xc8;}else{_0x5c5f1f=0xce;}_0x592654[_0x0d47('0x1c')](_0x5c5f1f);return _0x592654['set'](_0x0d47('0x21'),_0x46725b+'-'+_0x59db61+'/'+_0x33b9cc)[_0x0d47('0x1d')](_0x58819f);}return null;};}function patchUpdates(_0x5927e0){return function(_0x1e4650){try{jsonpatch[_0x0d47('0x22')](_0x1e4650,_0x5927e0,!![]);}catch(_0x156da5){return BPromise[_0x0d47('0x23')](_0x156da5);}return _0x1e4650['save']();};}function saveUpdates(_0x34083b,_0x1169a9){return function(_0x34912e){if(_0x34912e){return _0x34912e['update'](_0x34083b)[_0x0d47('0x24')](function(_0x2533b4){return _0x2533b4;});}return null;};}function removeEntity(_0x334210,_0x94c781){return function(_0x4c6e59){if(_0x4c6e59){return _0x4c6e59[_0x0d47('0x25')]()[_0x0d47('0x24')](function(){_0x334210[_0x0d47('0x1c')](0xcc)[_0x0d47('0x1b')]();});}};}function handleEntityNotFound(_0x3ecd8d,_0x9e0600){return function(_0x29b870){if(!_0x29b870){_0x3ecd8d['sendStatus'](0x194);}return _0x29b870;};}function handleError(_0x3b7555,_0x4f814b){_0x4f814b=_0x4f814b||0x1f4;return function(_0xabfdc0){logger[_0x0d47('0x26')](_0xabfdc0[_0x0d47('0x27')]);if(_0xabfdc0[_0x0d47('0x28')]){delete _0xabfdc0[_0x0d47('0x28')];}_0x3b7555[_0x0d47('0x1c')](_0x4f814b)[_0x0d47('0x29')](_0xabfdc0);};}exports[_0x0d47('0x2a')]=function(_0x164463,_0x5ab31b){var _0x3950d4={},_0x276b0c={},_0x91d7f8={'count':0x0,'rows':[]};var _0xa00106=_[_0x0d47('0x2b')](db[_0x0d47('0x2c')][_0x0d47('0x2d')],function(_0x2e825d){return{'name':_0x2e825d[_0x0d47('0x2e')],'type':_0x2e825d['type'][_0x0d47('0x2f')]};});_0x276b0c[_0x0d47('0x30')]=_['map'](_0xa00106,_0x0d47('0x28'));_0x276b0c[_0x0d47('0x31')]=_['keys'](_0x164463[_0x0d47('0x31')]);_0x276b0c[_0x0d47('0x32')]=_['intersection'](_0x276b0c[_0x0d47('0x30')],_0x276b0c['query']);_0x3950d4[_0x0d47('0x33')]=_[_0x0d47('0x34')](_0x276b0c[_0x0d47('0x30')],qs['fields'](_0x164463[_0x0d47('0x31')][_0x0d47('0x35')]));_0x3950d4[_0x0d47('0x33')]=_0x3950d4[_0x0d47('0x33')][_0x0d47('0x36')]?_0x3950d4['attributes']:_0x276b0c['model'];if(!_0x164463['query'][_0x0d47('0x37')]('nolimit')){_0x3950d4[_0x0d47('0x38')]=qs[_0x0d47('0x38')](_0x164463['query'][_0x0d47('0x38')]);_0x3950d4[_0x0d47('0x1e')]=qs[_0x0d47('0x1e')](_0x164463[_0x0d47('0x31')]['offset']);}_0x3950d4[_0x0d47('0x39')]=qs['sort'](_0x164463[_0x0d47('0x31')]['sort']);_0x3950d4[_0x0d47('0x3a')]=qs['filters'](_[_0x0d47('0x3b')](_0x164463['query'],_0x276b0c[_0x0d47('0x32')]),_0xa00106);if(_0x164463[_0x0d47('0x31')][_0x0d47('0x3c')]){_0x3950d4['where']=_['merge'](_0x3950d4[_0x0d47('0x3a')],{'$or':_[_0x0d47('0x2b')](_0xa00106,function(_0x228375){if(_0x228375[_0x0d47('0x3d')]!==_0x0d47('0x3e')){var _0x4252f5={};_0x4252f5[_0x228375[_0x0d47('0x28')]]={'$like':'%'+_0x164463[_0x0d47('0x31')][_0x0d47('0x3c')]+'%'};return _0x4252f5;}})});}_0x3950d4=_['merge']({},_0x3950d4,_0x164463[_0x0d47('0x3f')]);var _0x5e5b21={'where':_0x3950d4[_0x0d47('0x3a')]};return db[_0x0d47('0x2c')]['count'](_0x5e5b21)[_0x0d47('0x24')](function(_0x3dfb7d){_0x91d7f8[_0x0d47('0x20')]=_0x3dfb7d;if(_0x164463['query'][_0x0d47('0x40')]){_0x3950d4[_0x0d47('0x41')]=[{'all':!![]}];}return db[_0x0d47('0x2c')]['findAll'](_0x3950d4);})[_0x0d47('0x24')](function(_0x187dc5){_0x91d7f8[_0x0d47('0x42')]=_0x187dc5;return _0x91d7f8;})[_0x0d47('0x24')](respondWithFilteredResult(_0x5ab31b,_0x3950d4))[_0x0d47('0x43')](handleError(_0x5ab31b,null));};exports[_0x0d47('0x44')]=function(_0x14d111,_0x1ceaf6){var _0x4e8654={'raw':!![],'where':{'id':_0x14d111[_0x0d47('0x45')]['id']}},_0x5cc164={};_0x5cc164[_0x0d47('0x30')]=_['keys'](db[_0x0d47('0x2c')]['rawAttributes']);_0x5cc164[_0x0d47('0x31')]=_['keys'](_0x14d111[_0x0d47('0x31')]);_0x5cc164[_0x0d47('0x32')]=_[_0x0d47('0x34')](_0x5cc164[_0x0d47('0x30')],_0x5cc164[_0x0d47('0x31')]);_0x4e8654[_0x0d47('0x33')]=_[_0x0d47('0x34')](_0x5cc164[_0x0d47('0x30')],qs[_0x0d47('0x35')](_0x14d111[_0x0d47('0x31')][_0x0d47('0x35')]));_0x4e8654[_0x0d47('0x33')]=_0x4e8654[_0x0d47('0x33')]['length']?_0x4e8654[_0x0d47('0x33')]:_0x5cc164[_0x0d47('0x30')];if(_0x14d111['query'][_0x0d47('0x40')]){_0x4e8654['include']=[{'all':!![]}];}_0x4e8654=_[_0x0d47('0x46')]({},_0x4e8654,_0x14d111['options']);return db[_0x0d47('0x2c')][_0x0d47('0x47')](_0x4e8654)[_0x0d47('0x24')](handleEntityNotFound(_0x1ceaf6,null))['then'](respondWithResult(_0x1ceaf6,null))[_0x0d47('0x43')](handleError(_0x1ceaf6,null));};exports[_0x0d47('0x48')]=function(_0x18c51b,_0x5082da){return db[_0x0d47('0x2c')][_0x0d47('0x48')](_0x18c51b[_0x0d47('0x49')],{})[_0x0d47('0x24')](respondWithResult(_0x5082da,0xc9))[_0x0d47('0x43')](handleError(_0x5082da,null));};exports[_0x0d47('0x4a')]=function(_0x4c1a90,_0x39e535){if(_0x4c1a90[_0x0d47('0x49')]['id']){delete _0x4c1a90[_0x0d47('0x49')]['id'];}return db[_0x0d47('0x2c')][_0x0d47('0x47')]({'where':{'id':_0x4c1a90['params']['id']}})[_0x0d47('0x24')](handleEntityNotFound(_0x39e535,null))[_0x0d47('0x24')](saveUpdates(_0x4c1a90[_0x0d47('0x49')],null))['then'](respondWithResult(_0x39e535,null))[_0x0d47('0x43')](handleError(_0x39e535,null));};exports[_0x0d47('0x25')]=function(_0xbfdde2,_0x1c8355){return db['FaxTransferReport']['find']({'where':{'id':_0xbfdde2[_0x0d47('0x45')]['id']}})[_0x0d47('0x24')](handleEntityNotFound(_0x1c8355,null))[_0x0d47('0x24')](removeEntity(_0x1c8355,null))[_0x0d47('0x43')](handleError(_0x1c8355,null));};exports[_0x0d47('0x4b')]=function(_0x39d125,_0x4313e1){return db[_0x0d47('0x2c')][_0x0d47('0x4b')]()['then'](respondWithResult(_0x4313e1,null))[_0x0d47('0x43')](handleError(_0x4313e1,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 0ddb9b6..e12c1ee 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 _0xf4af=['uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','report_fax_transfer'];(function(_0x2c80a8,_0x466a8a){var _0x397528=function(_0x38b344){while(--_0x38b344){_0x2c80a8['push'](_0x2c80a8['shift']());}};_0x397528(++_0x466a8a);}(_0xf4af,0x7a));var _0xff4a=function(_0x3690de,_0xaad404){_0x3690de=_0x3690de-0x0;var _0x9737de=_0xf4af[_0x3690de];return _0x9737de;};'use strict';var _=require('lodash');var util=require(_0xff4a('0x0'));var logger=require(_0xff4a('0x1'))(_0xff4a('0x2'));var moment=require(_0xff4a('0x3'));var BPromise=require('bluebird');var rp=require(_0xff4a('0x4'));var fs=require('fs');var path=require(_0xff4a('0x5'));var rimraf=require(_0xff4a('0x6'));var config=require(_0xff4a('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0xff4a('0x8')]=function(_0x2a9718,_0x83349f){return _0x2a9718['define']('FaxTransferReport',attributes,{'tableName':_0xff4a('0x9'),'paranoid':![],'indexes':[{'name':_0xff4a('0xa'),'fields':[_0xff4a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc67b=['moment','bluebird','path','rimraf','../../config/environment','exports','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x498396,_0x395c9a){var _0x1b0fbd=function(_0x1c511e){while(--_0x1c511e){_0x498396['push'](_0x498396['shift']());}};_0x1b0fbd(++_0x395c9a);}(_0xc67b,0x104));var _0xbc67=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc67b[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xbc67('0x0'));var util=require(_0xbc67('0x1'));var logger=require(_0xbc67('0x2'))(_0xbc67('0x3'));var moment=require(_0xbc67('0x4'));var BPromise=require(_0xbc67('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc67('0x6'));var rimraf=require(_0xbc67('0x7'));var config=require(_0xbc67('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0xbc67('0x9')]=function(_0x20ad01,_0x5f0619){return _0x20ad01['define']('FaxTransferReport',attributes,{'tableName':_0xbc67('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbc67('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 555d8e2..2a33443 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 _0x0bdd=['message','result','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','FaxTransferReport,\x20%s,\x20%s'];(function(_0x4e2d6d,_0x15cff4){var _0x473db7=function(_0x2c6ca0){while(--_0x2c6ca0){_0x4e2d6d['push'](_0x4e2d6d['shift']());}};_0x473db7(++_0x15cff4);}(_0x0bdd,0x1ca));var _0xd0bd=function(_0x8ae747,_0x135483){_0x8ae747=_0x8ae747-0x0;var _0x16d68b=_0x0bdd[_0x8ae747];return _0x16d68b;};'use strict';var _=require('lodash');var util=require(_0xd0bd('0x0'));var moment=require(_0xd0bd('0x1'));var BPromise=require(_0xd0bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd0bd('0x4'))(_0xd0bd('0x5'));var config=require('../../config/environment');var jayson=require(_0xd0bd('0x6'));var client=jayson[_0xd0bd('0x7')][_0xd0bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe35411,_0x21f80d,_0x1d45b5){return new BPromise(function(_0x1fc5f4,_0x3d692d){return client[_0xd0bd('0x9')](_0xe35411,_0x1d45b5)[_0xd0bd('0xa')](function(_0x137418){logger[_0xd0bd('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x21f80d,_0xd0bd('0xc'));logger[_0xd0bd('0xd')](_0xd0bd('0xe'),_0x21f80d,'request\x20sent',JSON['stringify'](_0x137418));if(_0x137418[_0xd0bd('0xf')]){if(_0x137418[_0xd0bd('0xf')]['code']===0x1f4){logger[_0xd0bd('0xf')](_0xd0bd('0x10'),_0x21f80d,_0x137418['error'][_0xd0bd('0x11')]);return _0x3d692d(_0x137418[_0xd0bd('0xf')]['message']);}logger[_0xd0bd('0xf')](_0xd0bd('0x10'),_0x21f80d,_0x137418[_0xd0bd('0xf')][_0xd0bd('0x11')]);return _0x1fc5f4(_0x137418[_0xd0bd('0xf')][_0xd0bd('0x11')]);}else{logger[_0xd0bd('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x21f80d,_0xd0bd('0xc'));_0x1fc5f4(_0x137418[_0xd0bd('0x12')][_0xd0bd('0x11')]);}})['catch'](function(_0x301b0d){logger[_0xd0bd('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x21f80d,_0x301b0d);_0x3d692d(_0x301b0d);});});} \ No newline at end of file +var _0xd459=['rpc','jayson/promise','client','http','request','then','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x502da7,_0x42bcc2){var _0x246e4b=function(_0x4898b0){while(--_0x4898b0){_0x502da7['push'](_0x502da7['shift']());}};_0x246e4b(++_0x42bcc2);}(_0xd459,0x1bf));var _0x9d45=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xd459[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x9d45('0x0'));var util=require(_0x9d45('0x1'));var moment=require(_0x9d45('0x2'));var BPromise=require(_0x9d45('0x3'));var rs=require(_0x9d45('0x4'));var fs=require('fs');var Redis=require(_0x9d45('0x5'));var db=require(_0x9d45('0x6'))['db'];var utils=require(_0x9d45('0x7'));var logger=require(_0x9d45('0x8'))(_0x9d45('0x9'));var config=require('../../config/environment');var jayson=require(_0x9d45('0xa'));var client=jayson[_0x9d45('0xb')][_0x9d45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cf684,_0x508501,_0x26aacd){return new BPromise(function(_0x1278eb,_0xeae6fc){return client[_0x9d45('0xd')](_0x2cf684,_0x26aacd)[_0x9d45('0xe')](function(_0x4c7f45){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x508501,_0x9d45('0xf'));logger[_0x9d45('0x10')](_0x9d45('0x11'),_0x508501,_0x9d45('0xf'),JSON[_0x9d45('0x12')](_0x4c7f45));if(_0x4c7f45[_0x9d45('0x13')]){if(_0x4c7f45[_0x9d45('0x13')][_0x9d45('0x14')]===0x1f4){logger[_0x9d45('0x13')](_0x9d45('0x15'),_0x508501,_0x4c7f45[_0x9d45('0x13')][_0x9d45('0x16')]);return _0xeae6fc(_0x4c7f45[_0x9d45('0x13')][_0x9d45('0x16')]);}logger['error'](_0x9d45('0x15'),_0x508501,_0x4c7f45['error'][_0x9d45('0x16')]);return _0x1278eb(_0x4c7f45[_0x9d45('0x13')][_0x9d45('0x16')]);}else{logger[_0x9d45('0x17')](_0x9d45('0x15'),_0x508501,'request\x20sent');_0x1278eb(_0x4c7f45['result'][_0x9d45('0x16')]);}})['catch'](function(_0x3ec452){logger[_0x9d45('0x13')](_0x9d45('0x15'),_0x508501,_0x3ec452);_0xeae6fc(_0x3ec452);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index ced5eab..92d4b2f 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 _0xdd76=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','isAuthenticated','/:id','show','create','put','delete','destroy'];(function(_0x9ff1c0,_0x207afc){var _0x3e6c23=function(_0x11ad15){while(--_0x11ad15){_0x9ff1c0['push'](_0x9ff1c0['shift']());}};_0x3e6c23(++_0x207afc);}(_0xdd76,0x110));var _0x6dd7=function(_0x18f754,_0x393612){_0x18f754=_0x18f754-0x0;var _0xf675dd=_0xdd76[_0x18f754];return _0xf675dd;};'use strict';var multer=require('multer');var util=require(_0x6dd7('0x0'));var path=require(_0x6dd7('0x1'));var timeout=require(_0x6dd7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6dd7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6dd7('0x4'));var config=require(_0x6dd7('0x5'));var controller=require(_0x6dd7('0x6'));router[_0x6dd7('0x7')]('/',auth['isAuthenticated'](),controller[_0x6dd7('0x8')]);router[_0x6dd7('0x7')]('/describe',auth[_0x6dd7('0x9')](),controller['describe']);router['get'](_0x6dd7('0xa'),auth[_0x6dd7('0x9')](),controller[_0x6dd7('0xb')]);router['post']('/',auth[_0x6dd7('0x9')](),controller[_0x6dd7('0xc')]);router[_0x6dd7('0xd')](_0x6dd7('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6dd7('0xe')](_0x6dd7('0xa'),auth[_0x6dd7('0x9')](),controller[_0x6dd7('0xf')]);module['exports']=router; \ No newline at end of file +var _0xeb9d=['./faxTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x23bb8b,_0x170e51){var _0x4e0105=function(_0x50e0f1){while(--_0x50e0f1){_0x23bb8b['push'](_0x23bb8b['shift']());}};_0x4e0105(++_0x170e51);}(_0xeb9d,0x1e7));var _0xdeb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb9d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdeb9('0x0'));var util=require(_0xdeb9('0x1'));var path=require(_0xdeb9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdeb9('0x3')]();var fs_extra=require(_0xdeb9('0x4'));var auth=require(_0xdeb9('0x5'));var interaction=require(_0xdeb9('0x6'));var config=require('../../config/environment');var controller=require(_0xdeb9('0x7'));router['get']('/',auth[_0xdeb9('0x8')](),controller['index']);router[_0xdeb9('0x9')](_0xdeb9('0xa'),auth[_0xdeb9('0x8')](),controller[_0xdeb9('0xb')]);router['get'](_0xdeb9('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xdeb9('0x8')](),controller[_0xdeb9('0xd')]);router[_0xdeb9('0xe')](_0xdeb9('0xc'),auth['isAuthenticated'](),controller[_0xdeb9('0xf')]);router[_0xdeb9('0x10')](_0xdeb9('0xc'),auth['isAuthenticated'](),controller[_0xdeb9('0x11')]);module[_0xdeb9('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 1f7e1f8..238f71e 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 _0xd15f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','/:id','show','get','/:id/fields','create','post','/:id/configurations','addConfiguration','put','delete','util','connect-timeout','express'];(function(_0x195fb9,_0x5ab5cc){var _0x2bf1c4=function(_0x55c2ca){while(--_0x55c2ca){_0x195fb9['push'](_0x195fb9['shift']());}};_0x2bf1c4(++_0x5ab5cc);}(_0xd15f,0x1a1));var _0xfd15=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0xd15f[_0x1a87b3];return _0x37e84d;};'use strict';var multer=require('multer');var util=require(_0xfd15('0x0'));var path=require('path');var timeout=require(_0xfd15('0x1'));var express=require(_0xfd15('0x2'));var router=express[_0xfd15('0x3')]();var fs_extra=require(_0xfd15('0x4'));var auth=require(_0xfd15('0x5'));var interaction=require(_0xfd15('0x6'));var config=require(_0xfd15('0x7'));var controller=require(_0xfd15('0x8'));router['get']('/',auth[_0xfd15('0x9')](),controller[_0xfd15('0xa')]);router['get'](_0xfd15('0xb'),auth[_0xfd15('0x9')](),controller[_0xfd15('0xc')]);router['get']('/:id/configurations',auth[_0xfd15('0x9')](),controller['getConfigurations']);router[_0xfd15('0xd')](_0xfd15('0xe'),auth[_0xfd15('0x9')](),controller['getFields']);router['post']('/',auth[_0xfd15('0x9')](),controller[_0xfd15('0xf')]);router[_0xfd15('0x10')](_0xfd15('0x11'),auth['isAuthenticated'](),controller[_0xfd15('0x12')]);router[_0xfd15('0x13')]('/:id',auth[_0xfd15('0x9')](),controller['update']);router[_0xfd15('0x14')](_0xfd15('0xb'),auth[_0xfd15('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc67a=['index','/:id','get','/:id/configurations','getConfigurations','create','post','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated'];(function(_0x2d0ec6,_0xd8f44c){var _0x16fff5=function(_0x4f36d1){while(--_0x4f36d1){_0x2d0ec6['push'](_0x2d0ec6['shift']());}};_0x16fff5(++_0xd8f44c);}(_0xc67a,0x108));var _0xac67=function(_0x144daf,_0x234135){_0x144daf=_0x144daf-0x0;var _0x4e75a7=_0xc67a[_0x144daf];return _0x4e75a7;};'use strict';var multer=require(_0xac67('0x0'));var util=require(_0xac67('0x1'));var path=require('path');var timeout=require(_0xac67('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xac67('0x3'));var auth=require(_0xac67('0x4'));var interaction=require(_0xac67('0x5'));var config=require(_0xac67('0x6'));var controller=require(_0xac67('0x7'));router['get']('/',auth[_0xac67('0x8')](),controller[_0xac67('0x9')]);router['get'](_0xac67('0xa'),auth[_0xac67('0x8')](),controller['show']);router[_0xac67('0xb')](_0xac67('0xc'),auth[_0xac67('0x8')](),controller[_0xac67('0xd')]);router[_0xac67('0xb')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xac67('0xe')]);router[_0xac67('0xf')](_0xac67('0xc'),auth[_0xac67('0x8')](),controller[_0xac67('0x10')]);router[_0xac67('0x11')](_0xac67('0xa'),auth[_0xac67('0x8')](),controller[_0xac67('0x12')]);router[_0xac67('0x13')](_0xac67('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xac67('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 706d9a4..5874784 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 _0x407f=['sequelize','exports','STRING','basic','ENUM','integrationTab','newTab'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x407f,0xee));var _0xf407=function(_0x2221cf,_0x3fd538){_0x2221cf=_0x2221cf-0x0;var _0x5f0269=_0x407f[_0x2221cf];return _0x5f0269;};'use strict';var Sequelize=require(_0xf407('0x0'));module[_0xf407('0x1')]={'name':{'type':Sequelize[_0xf407('0x2')]},'description':{'type':Sequelize[_0xf407('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf407('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xf407('0x3')),'defaultValue':_0xf407('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xf407('0x2')]},'consumerSecret':{'type':Sequelize[_0xf407('0x2')]},'token':{'type':Sequelize[_0xf407('0x2')]},'tokenSecret':{'type':Sequelize[_0xf407('0x2')]},'serverUrl':{'type':Sequelize[_0xf407('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf407('0x4')](_0xf407('0x5'),_0xf407('0x6')),'defaultValue':_0xf407('0x5')}}; \ No newline at end of file +var _0xb179=['newTab','sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xb179,0x181));var _0x9b17=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb179[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x9b17('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b17('0x1')]},'description':{'type':Sequelize[_0x9b17('0x1')]},'username':{'type':Sequelize[_0x9b17('0x1')]},'remoteUri':{'type':Sequelize[_0x9b17('0x1')]},'authType':{'type':Sequelize[_0x9b17('0x2')](_0x9b17('0x3')),'defaultValue':_0x9b17('0x3')},'password':{'type':Sequelize[_0x9b17('0x1')]},'consumerKey':{'type':Sequelize[_0x9b17('0x1')]},'consumerSecret':{'type':Sequelize[_0x9b17('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x9b17('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9b17('0x4'),_0x9b17('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index a9d70e0..6d5a39d 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 _0x3519=['DeskConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','remoteUri','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','%s/custom_fields','application/json','authType','basic','headers','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','update','then','end','sendStatus','error','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','getConfigurations','findOne'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x3519,0x10f));var _0x9351=function(_0x3adad8,_0x5aef55){_0x3adad8=_0x3adad8-0x0;var _0x177095=_0x3519[_0x3adad8];return _0x177095;};'use strict';var emlformat=require(_0x9351('0x0'));var rimraf=require(_0x9351('0x1'));var zipdir=require(_0x9351('0x2'));var jsonpatch=require(_0x9351('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9351('0x4'));var Mustache=require(_0x9351('0x5'));var util=require(_0x9351('0x6'));var path=require('path');var sox=require(_0x9351('0x7'));var csv=require(_0x9351('0x8'));var ejs=require(_0x9351('0x9'));var fs=require('fs');var fs_extra=require(_0x9351('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9351('0xb'));var jsforce=require(_0x9351('0xc'));var deskjs=require(_0x9351('0xd'));var toCsv=require(_0x9351('0x8'));var querystring=require(_0x9351('0xe'));var Papa=require(_0x9351('0xf'));var Redis=require(_0x9351('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9351('0x11'));var hardwareService=require(_0x9351('0x12'));var logger=require(_0x9351('0x13'))(_0x9351('0x14'));var utils=require(_0x9351('0x15'));var config=require(_0x9351('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9351('0x17'))['db'];var integrations=require(_0x9351('0x18'));function respondWithStatusCode(_0x4f3430,_0xf62f0c){_0xf62f0c=_0xf62f0c||0xcc;return function(_0x237e1a){if(_0x237e1a){return _0x4f3430['sendStatus'](_0xf62f0c);}return _0x4f3430['status'](_0xf62f0c)['end']();};}function respondWithResult(_0x377ecf,_0x190c01){_0x190c01=_0x190c01||0xc8;return function(_0x419c63){if(_0x419c63){return _0x377ecf[_0x9351('0x19')](_0x190c01)[_0x9351('0x1a')](_0x419c63);}};}function respondWithFilteredResult(_0x518d0e,_0x104a4f){return function(_0x4cbfca){if(_0x4cbfca){var _0x31aaf3=typeof _0x104a4f[_0x9351('0x1b')]===_0x9351('0x1c')&&typeof _0x104a4f[_0x9351('0x1d')]===_0x9351('0x1c');var _0x2c8b4f=_0x4cbfca[_0x9351('0x1e')];var _0x2d4fbc=_0x31aaf3?0x0:_0x104a4f[_0x9351('0x1b')];var _0xe479f2=_0x31aaf3?_0x4cbfca[_0x9351('0x1e')]:_0x104a4f['offset']+_0x104a4f['limit'];var _0x3fc35e;if(_0xe479f2>=_0x2c8b4f){_0xe479f2=_0x2c8b4f;_0x3fc35e=0xc8;}else{_0x3fc35e=0xce;}_0x518d0e[_0x9351('0x19')](_0x3fc35e);return _0x518d0e[_0x9351('0x1f')]('Content-Range',_0x2d4fbc+'-'+_0xe479f2+'/'+_0x2c8b4f)[_0x9351('0x1a')](_0x4cbfca);}return null;};}function patchUpdates(_0x4dc541){return function(_0x55133f){try{jsonpatch[_0x9351('0x20')](_0x55133f,_0x4dc541,!![]);}catch(_0x3bfa48){return BPromise['reject'](_0x3bfa48);}return _0x55133f['save']();};}function saveUpdates(_0x252da8,_0x4453e5){return function(_0x368f39){if(_0x368f39){return _0x368f39[_0x9351('0x21')](_0x252da8)['then'](function(_0x49e9ec){return _0x49e9ec;});}return null;};}function removeEntity(_0x55af89,_0x4f1b2e){return function(_0x2b4b98){if(_0x2b4b98){return _0x2b4b98['destroy']()[_0x9351('0x22')](function(){_0x55af89[_0x9351('0x19')](0xcc)[_0x9351('0x23')]();});}};}function handleEntityNotFound(_0x38e40e,_0x30ee6c){return function(_0x24a3d9){if(!_0x24a3d9){_0x38e40e[_0x9351('0x24')](0x194);}return _0x24a3d9;};}function handleError(_0x48d888,_0x31448b){_0x31448b=_0x31448b||0x1f4;return function(_0x72bee3){logger[_0x9351('0x25')](_0x72bee3['stack']);if(_0x72bee3[_0x9351('0x26')]){delete _0x72bee3['name'];}_0x48d888[_0x9351('0x19')](_0x31448b)[_0x9351('0x27')](_0x72bee3);};}exports[_0x9351('0x28')]=function(_0x4ddb11,_0x1a1d20){var _0x318d4a={},_0x153ac2={},_0x29f651={'count':0x0,'rows':[]};var _0x149f7a=_[_0x9351('0x29')](db[_0x9351('0x2a')][_0x9351('0x2b')],function(_0x28d533){return{'name':_0x28d533[_0x9351('0x2c')],'type':_0x28d533[_0x9351('0x2d')][_0x9351('0x2e')]};});_0x153ac2[_0x9351('0x2f')]=_[_0x9351('0x29')](_0x149f7a,_0x9351('0x26'));_0x153ac2[_0x9351('0x30')]=_[_0x9351('0x31')](_0x4ddb11[_0x9351('0x30')]);_0x153ac2[_0x9351('0x32')]=_[_0x9351('0x33')](_0x153ac2[_0x9351('0x2f')],_0x153ac2[_0x9351('0x30')]);_0x318d4a[_0x9351('0x34')]=_[_0x9351('0x33')](_0x153ac2['model'],qs[_0x9351('0x35')](_0x4ddb11[_0x9351('0x30')][_0x9351('0x35')]));_0x318d4a[_0x9351('0x34')]=_0x318d4a['attributes'][_0x9351('0x36')]?_0x318d4a['attributes']:_0x153ac2[_0x9351('0x2f')];if(!_0x4ddb11[_0x9351('0x30')][_0x9351('0x37')]('nolimit')){_0x318d4a[_0x9351('0x1d')]=qs['limit'](_0x4ddb11['query']['limit']);_0x318d4a[_0x9351('0x1b')]=qs[_0x9351('0x1b')](_0x4ddb11[_0x9351('0x30')][_0x9351('0x1b')]);}_0x318d4a[_0x9351('0x38')]=qs['sort'](_0x4ddb11['query'][_0x9351('0x39')]);_0x318d4a[_0x9351('0x3a')]=qs[_0x9351('0x32')](_[_0x9351('0x3b')](_0x4ddb11[_0x9351('0x30')],_0x153ac2['filters']),_0x149f7a);if(_0x4ddb11['query'][_0x9351('0x3c')]){_0x318d4a['where']=_[_0x9351('0x3d')](_0x318d4a['where'],{'$or':_['map'](_0x149f7a,function(_0x52de44){if(_0x52de44['type']!==_0x9351('0x3e')){var _0x178dc9={};_0x178dc9[_0x52de44[_0x9351('0x26')]]={'$like':'%'+_0x4ddb11[_0x9351('0x30')][_0x9351('0x3c')]+'%'};return _0x178dc9;}})});}_0x318d4a=_[_0x9351('0x3d')]({},_0x318d4a,_0x4ddb11[_0x9351('0x3f')]);var _0x1badbb={'where':_0x318d4a['where']};return db['DeskAccount'][_0x9351('0x1e')](_0x1badbb)['then'](function(_0x3bfb17){_0x29f651[_0x9351('0x1e')]=_0x3bfb17;if(_0x4ddb11['query'][_0x9351('0x40')]){_0x318d4a[_0x9351('0x41')]=[{'all':!![]}];}return db[_0x9351('0x2a')][_0x9351('0x42')](_0x318d4a);})[_0x9351('0x22')](function(_0x29cb0e){_0x29f651[_0x9351('0x43')]=_0x29cb0e;return _0x29f651;})[_0x9351('0x22')](respondWithFilteredResult(_0x1a1d20,_0x318d4a))['catch'](handleError(_0x1a1d20,null));};exports[_0x9351('0x44')]=function(_0x19cd2a,_0x502fec){var _0x5ccaef={'raw':![],'where':{'id':_0x19cd2a[_0x9351('0x45')]['id']}},_0xe1ec49={};_0xe1ec49[_0x9351('0x2f')]=_['keys'](db[_0x9351('0x2a')][_0x9351('0x2b')]);_0xe1ec49['query']=_[_0x9351('0x31')](_0x19cd2a[_0x9351('0x30')]);_0xe1ec49[_0x9351('0x32')]=_['intersection'](_0xe1ec49[_0x9351('0x2f')],_0xe1ec49[_0x9351('0x30')]);_0x5ccaef[_0x9351('0x34')]=_[_0x9351('0x33')](_0xe1ec49[_0x9351('0x2f')],qs[_0x9351('0x35')](_0x19cd2a['query'][_0x9351('0x35')]));_0x5ccaef['attributes']=_0x5ccaef[_0x9351('0x34')][_0x9351('0x36')]?_0x5ccaef['attributes']:_0xe1ec49[_0x9351('0x2f')];if(_0x19cd2a[_0x9351('0x30')][_0x9351('0x40')]){_0x5ccaef[_0x9351('0x41')]=[{'all':!![]}];}_0x5ccaef=_[_0x9351('0x3d')]({},_0x5ccaef,_0x19cd2a[_0x9351('0x3f')]);return db[_0x9351('0x2a')][_0x9351('0x46')](_0x5ccaef)['then'](handleEntityNotFound(_0x502fec,null))[_0x9351('0x22')](respondWithResult(_0x502fec,null))[_0x9351('0x47')](handleError(_0x502fec,null));};exports[_0x9351('0x48')]=function(_0xf25d08,_0x3b13ee){return db[_0x9351('0x2a')][_0x9351('0x48')](_0xf25d08[_0x9351('0x49')],{})[_0x9351('0x22')](respondWithResult(_0x3b13ee,0xc9))[_0x9351('0x47')](handleError(_0x3b13ee,null));};exports[_0x9351('0x21')]=function(_0x250f06,_0x231eb3){if(_0x250f06[_0x9351('0x49')]['id']){delete _0x250f06[_0x9351('0x49')]['id'];}return db[_0x9351('0x2a')][_0x9351('0x46')]({'where':{'id':_0x250f06[_0x9351('0x45')]['id']}})[_0x9351('0x22')](handleEntityNotFound(_0x231eb3,null))[_0x9351('0x22')](saveUpdates(_0x250f06['body'],null))[_0x9351('0x22')](respondWithResult(_0x231eb3,null))[_0x9351('0x47')](handleError(_0x231eb3,null));};exports[_0x9351('0x4a')]=function(_0x2d0a70,_0x4a564e){return db[_0x9351('0x2a')][_0x9351('0x46')]({'where':{'id':_0x2d0a70[_0x9351('0x45')]['id']}})[_0x9351('0x22')](handleEntityNotFound(_0x4a564e,null))['then'](removeEntity(_0x4a564e,null))[_0x9351('0x47')](handleError(_0x4a564e,null));};exports[_0x9351('0x4b')]=function(_0x4fb48d,_0x52f09b,_0x77f1e7){var _0x96fe9a={};var _0x115b8e={};var _0x47a284;var _0x340135;return db[_0x9351('0x2a')][_0x9351('0x4c')]({'where':{'id':_0x4fb48d[_0x9351('0x45')]['id']}})[_0x9351('0x22')](handleEntityNotFound(_0x52f09b,null))[_0x9351('0x22')](function(_0x42784e){if(_0x42784e){_0x47a284=_0x42784e;_0x115b8e[_0x9351('0x2f')]=_[_0x9351('0x31')](db[_0x9351('0x4d')][_0x9351('0x2b')]);_0x115b8e[_0x9351('0x30')]=_[_0x9351('0x31')](_0x4fb48d[_0x9351('0x30')]);_0x115b8e[_0x9351('0x32')]=_[_0x9351('0x33')](_0x115b8e[_0x9351('0x2f')],_0x115b8e['query']);_0x96fe9a['attributes']=_[_0x9351('0x33')](_0x115b8e[_0x9351('0x2f')],qs[_0x9351('0x35')](_0x4fb48d[_0x9351('0x30')]['fields']));_0x96fe9a['attributes']=_0x96fe9a['attributes'][_0x9351('0x36')]?_0x96fe9a[_0x9351('0x34')]:_0x115b8e[_0x9351('0x2f')];_0x96fe9a[_0x9351('0x38')]=qs[_0x9351('0x39')](_0x4fb48d[_0x9351('0x30')][_0x9351('0x39')]);_0x96fe9a[_0x9351('0x3a')]=qs['filters'](_[_0x9351('0x3b')](_0x4fb48d[_0x9351('0x30')],_0x115b8e[_0x9351('0x32')]));if(_0x4fb48d[_0x9351('0x30')][_0x9351('0x3c')]){_0x96fe9a[_0x9351('0x3a')]=_[_0x9351('0x3d')](_0x96fe9a[_0x9351('0x3a')],{'$or':_[_0x9351('0x29')](_0x96fe9a[_0x9351('0x34')],function(_0x2a8354){var _0x4ad9f8={};_0x4ad9f8[_0x2a8354]={'$like':'%'+_0x4fb48d[_0x9351('0x30')][_0x9351('0x3c')]+'%'};return _0x4ad9f8;})});}_0x96fe9a=_[_0x9351('0x3d')]({},_0x96fe9a,_0x4fb48d[_0x9351('0x3f')]);return _0x47a284[_0x9351('0x4b')](_0x96fe9a);}})['then'](function(_0x35b773){if(_0x35b773){_0x340135=_0x35b773['length'];if(!_0x4fb48d[_0x9351('0x30')][_0x9351('0x37')](_0x9351('0x4e'))){_0x96fe9a[_0x9351('0x1d')]=qs[_0x9351('0x1d')](_0x4fb48d['query']['limit']);_0x96fe9a[_0x9351('0x1b')]=qs[_0x9351('0x1b')](_0x4fb48d['query'][_0x9351('0x1b')]);}return _0x47a284['getConfigurations'](_0x96fe9a);}})[_0x9351('0x22')](function(_0x552989){if(_0x552989){return _0x552989?{'count':_0x340135,'rows':_0x552989}:null;}})[_0x9351('0x22')](respondWithResult(_0x52f09b,null))['catch'](handleError(_0x52f09b,null));};exports[_0x9351('0x4f')]=function(_0x7bb411,_0xe54bd5,_0x1911d2){if(_0x7bb411[_0x9351('0x49')]['id']){delete _0x7bb411[_0x9351('0x49')]['id'];}return db[_0x9351('0x2a')][_0x9351('0x4c')]({'where':{'id':_0x7bb411[_0x9351('0x45')]['id']}})[_0x9351('0x22')](handleEntityNotFound(_0xe54bd5,null))[_0x9351('0x22')](function(_0x433ade){if(_0x433ade){_0x7bb411[_0x9351('0x49')][_0x9351('0x50')]=_0x433ade['id'];_0x7bb411['body'][_0x9351('0x51')]=integrations[_0x9351('0x52')](_0x7bb411[_0x9351('0x49')][_0x9351('0x53')],_0x7bb411[_0x9351('0x49')][_0x9351('0x2d')]);_0x7bb411[_0x9351('0x49')][_0x9351('0x54')]=integrations[_0x9351('0x55')](_0x7bb411['body'][_0x9351('0x53')],_0x7bb411[_0x9351('0x49')][_0x9351('0x2d')]);return db[_0x9351('0x4d')]['create'](_0x7bb411[_0x9351('0x49')],{'include':[{'model':db[_0x9351('0x56')],'as':_0x9351('0x51')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x9351('0x22')](respondWithResult(_0xe54bd5,null))[_0x9351('0x47')](handleError(_0xe54bd5,null));};exports[_0x9351('0x57')]=function(_0x3fe9a5,_0x34cc5d,_0x77ab1a){var _0x2f8678=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3d63b4='';return db['DeskAccount'][_0x9351('0x4c')]({'where':{'id':_0x3fe9a5[_0x9351('0x45')]['id']},'attributes':['id',_0x9351('0x58'),'authType',_0x9351('0x59'),_0x9351('0x5a'),_0x9351('0x5b'),_0x9351('0x5c'),_0x9351('0x5d'),_0x9351('0x5e')]})[_0x9351('0x22')](handleEntityNotFound(_0x34cc5d,null))['then'](function(_0x321b13){if(_0x321b13){_0x3d63b4=_0x321b13['remoteUri'];var _0x395d27=_0x3d63b4['slice'](-0x1);if(_0x395d27==='/'){_0x3d63b4=_0x3d63b4[_0x9351('0x5f')](0x0,_0x3d63b4[_0x9351('0x60')](_0x395d27));}var _0x52104c={'method':'GET','uri':util['format'](_0x9351('0x61'),_0x3d63b4),'headers':{'Content-Type':_0x9351('0x62'),'Accept':_0x9351('0x62')},'json':!![]};if(_0x321b13[_0x9351('0x63')]===_0x9351('0x64')){_0x52104c[_0x9351('0x65')][_0x9351('0x66')]=util[_0x9351('0x67')](_0x9351('0x68'),new Buffer(util['format'](_0x9351('0x69'),_0x321b13['username'],_0x321b13[_0x9351('0x5a')]))[_0x9351('0x6a')](_0x9351('0x6b')));}return rp(_0x52104c)['then'](function(_0xa006b3){return _0x2f8678[_0x9351('0x6c')](_[_0x9351('0x29')](_0xa006b3[_0x9351('0x6d')][_0x9351('0x6e')],function(_0x1892e4){return{'id':_0x1892e4[_0x9351('0x26')],'name':_0x1892e4[_0x9351('0x26')],'type':_0x1892e4[_0x9351('0x2d')],'active':_0x1892e4[_0x9351('0x6f')],'label':_0x1892e4[_0x9351('0x70')],'custom':!![]};}));});}})[_0x9351('0x22')](function(_0x48186d){return{'count':_0x48186d[_0x9351('0x36')],'rows':_0x48186d};})[_0x9351('0x22')](respondWithResult(_0x34cc5d,null))[_0x9351('0x47')](function(_0x2a7388){var _0x2f03b9=_0x3fe9a5[_0x9351('0x30')][_0x9351('0x71')]?0x1f4:_0x2a7388[_0x9351('0x72')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x9351('0x57'),_0x2f03b9,JSON['stringify'](_0x2a7388));delete _0x2a7388[_0x9351('0x26')];if(_0x2f03b9===0x191){_0x2f03b9=0x190;}_0x34cc5d[_0x9351('0x19')](_0x2f03b9)['send'](_0x3fe9a5[_0x9351('0x30')]['test']?{'message':_0x9351('0x73'),'statusCode':_0x2a7388[_0x9351('0x72')]}:_0x2a7388);});}; \ No newline at end of file +var _0x02d1=['base64','concat','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','error','stack','name','index','DeskAccount','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','findOne','order','getConfigurations','AccountId','getSubjects','getDescriptions','channel','Subjects','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','format','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString'];(function(_0x4136d8,_0x2e300f){var _0xe2b951=function(_0x6480ef){while(--_0x6480ef){_0x4136d8['push'](_0x4136d8['shift']());}};_0xe2b951(++_0x2e300f);}(_0x02d1,0x1e5));var _0x102d=function(_0x49206a,_0xd7d9a9){_0x49206a=_0x49206a-0x0;var _0xd893da=_0x02d1[_0x49206a];return _0xd893da;};'use strict';var emlformat=require(_0x102d('0x0'));var rimraf=require(_0x102d('0x1'));var zipdir=require(_0x102d('0x2'));var jsonpatch=require(_0x102d('0x3'));var rp=require(_0x102d('0x4'));var moment=require(_0x102d('0x5'));var BPromise=require(_0x102d('0x6'));var Mustache=require(_0x102d('0x7'));var util=require(_0x102d('0x8'));var path=require('path');var sox=require(_0x102d('0x9'));var csv=require(_0x102d('0xa'));var ejs=require(_0x102d('0xb'));var fs=require('fs');var fs_extra=require(_0x102d('0xc'));var _=require(_0x102d('0xd'));var squel=require(_0x102d('0xe'));var crypto=require(_0x102d('0xf'));var jsforce=require(_0x102d('0x10'));var deskjs=require(_0x102d('0x11'));var toCsv=require('to-csv');var querystring=require(_0x102d('0x12'));var Papa=require(_0x102d('0x13'));var Redis=require(_0x102d('0x14'));var authService=require(_0x102d('0x15'));var qs=require(_0x102d('0x16'));var as=require(_0x102d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x102d('0x18'))(_0x102d('0x19'));var utils=require(_0x102d('0x1a'));var config=require(_0x102d('0x1b'));var licenseUtil=require(_0x102d('0x1c'));var db=require(_0x102d('0x1d'))['db'];var integrations=require(_0x102d('0x1e'));function respondWithStatusCode(_0x5744a3,_0x346be0){_0x346be0=_0x346be0||0xcc;return function(_0x2df6f0){if(_0x2df6f0){return _0x5744a3[_0x102d('0x1f')](_0x346be0);}return _0x5744a3[_0x102d('0x20')](_0x346be0)[_0x102d('0x21')]();};}function respondWithResult(_0x30d6af,_0x1ba042){_0x1ba042=_0x1ba042||0xc8;return function(_0x1a8686){if(_0x1a8686){return _0x30d6af[_0x102d('0x20')](_0x1ba042)[_0x102d('0x22')](_0x1a8686);}};}function respondWithFilteredResult(_0x428614,_0x3451e4){return function(_0x13f773){if(_0x13f773){var _0x3be3dd=typeof _0x3451e4[_0x102d('0x23')]===_0x102d('0x24')&&typeof _0x3451e4[_0x102d('0x25')]===_0x102d('0x24');var _0x516ec7=_0x13f773['count'];var _0x16c4ca=_0x3be3dd?0x0:_0x3451e4[_0x102d('0x23')];var _0x180d1b=_0x3be3dd?_0x13f773[_0x102d('0x26')]:_0x3451e4[_0x102d('0x23')]+_0x3451e4[_0x102d('0x25')];var _0x343df1;if(_0x180d1b>=_0x516ec7){_0x180d1b=_0x516ec7;_0x343df1=0xc8;}else{_0x343df1=0xce;}_0x428614[_0x102d('0x20')](_0x343df1);return _0x428614[_0x102d('0x27')]('Content-Range',_0x16c4ca+'-'+_0x180d1b+'/'+_0x516ec7)[_0x102d('0x22')](_0x13f773);}return null;};}function patchUpdates(_0x4c6f60){return function(_0x1ea94c){try{jsonpatch[_0x102d('0x28')](_0x1ea94c,_0x4c6f60,!![]);}catch(_0x4b0dee){return BPromise[_0x102d('0x29')](_0x4b0dee);}return _0x1ea94c['save']();};}function saveUpdates(_0x454975,_0x476cf8){return function(_0x471363){if(_0x471363){return _0x471363[_0x102d('0x2a')](_0x454975)['then'](function(_0x221302){return _0x221302;});}return null;};}function removeEntity(_0x4c2e14,_0x35ac35){return function(_0x2e19ea){if(_0x2e19ea){return _0x2e19ea[_0x102d('0x2b')]()['then'](function(){_0x4c2e14[_0x102d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa326,_0x132547){return function(_0x1ab49a){if(!_0x1ab49a){_0x3aa326[_0x102d('0x1f')](0x194);}return _0x1ab49a;};}function handleError(_0x3b1d81,_0x2e5f24){_0x2e5f24=_0x2e5f24||0x1f4;return function(_0x5f5b8d){logger[_0x102d('0x2c')](_0x5f5b8d[_0x102d('0x2d')]);if(_0x5f5b8d[_0x102d('0x2e')]){delete _0x5f5b8d[_0x102d('0x2e')];}_0x3b1d81[_0x102d('0x20')](_0x2e5f24)['send'](_0x5f5b8d);};}exports[_0x102d('0x2f')]=function(_0x5d3661,_0x280c9f){var _0x46710c={},_0x398b37={},_0x2a2af8={'count':0x0,'rows':[]};var _0x4b033b=_['map'](db[_0x102d('0x30')]['rawAttributes'],function(_0x496443){return{'name':_0x496443['fieldName'],'type':_0x496443['type'][_0x102d('0x31')]};});_0x398b37['model']=_[_0x102d('0x32')](_0x4b033b,'name');_0x398b37[_0x102d('0x33')]=_[_0x102d('0x34')](_0x5d3661[_0x102d('0x33')]);_0x398b37['filters']=_[_0x102d('0x35')](_0x398b37['model'],_0x398b37[_0x102d('0x33')]);_0x46710c[_0x102d('0x36')]=_['intersection'](_0x398b37[_0x102d('0x37')],qs[_0x102d('0x38')](_0x5d3661[_0x102d('0x33')]['fields']));_0x46710c['attributes']=_0x46710c['attributes'][_0x102d('0x39')]?_0x46710c[_0x102d('0x36')]:_0x398b37[_0x102d('0x37')];if(!_0x5d3661[_0x102d('0x33')][_0x102d('0x3a')](_0x102d('0x3b'))){_0x46710c[_0x102d('0x25')]=qs['limit'](_0x5d3661[_0x102d('0x33')][_0x102d('0x25')]);_0x46710c[_0x102d('0x23')]=qs[_0x102d('0x23')](_0x5d3661[_0x102d('0x33')][_0x102d('0x23')]);}_0x46710c['order']=qs[_0x102d('0x3c')](_0x5d3661[_0x102d('0x33')][_0x102d('0x3c')]);_0x46710c['where']=qs['filters'](_['pick'](_0x5d3661[_0x102d('0x33')],_0x398b37[_0x102d('0x3d')]),_0x4b033b);if(_0x5d3661['query'][_0x102d('0x3e')]){_0x46710c[_0x102d('0x3f')]=_[_0x102d('0x40')](_0x46710c[_0x102d('0x3f')],{'$or':_[_0x102d('0x32')](_0x4b033b,function(_0x1248b8){if(_0x1248b8[_0x102d('0x41')]!==_0x102d('0x42')){var _0x209b02={};_0x209b02[_0x1248b8['name']]={'$like':'%'+_0x5d3661[_0x102d('0x33')]['filter']+'%'};return _0x209b02;}})});}_0x46710c=_[_0x102d('0x40')]({},_0x46710c,_0x5d3661[_0x102d('0x43')]);var _0x46976c={'where':_0x46710c['where']};return db[_0x102d('0x30')][_0x102d('0x26')](_0x46976c)[_0x102d('0x44')](function(_0x215a57){_0x2a2af8[_0x102d('0x26')]=_0x215a57;if(_0x5d3661[_0x102d('0x33')][_0x102d('0x45')]){_0x46710c[_0x102d('0x46')]=[{'all':!![]}];}return db['DeskAccount'][_0x102d('0x47')](_0x46710c);})[_0x102d('0x44')](function(_0x24bda3){_0x2a2af8[_0x102d('0x48')]=_0x24bda3;return _0x2a2af8;})[_0x102d('0x44')](respondWithFilteredResult(_0x280c9f,_0x46710c))[_0x102d('0x49')](handleError(_0x280c9f,null));};exports[_0x102d('0x4a')]=function(_0x232c00,_0x2dc543){var _0x4acad8={'raw':![],'where':{'id':_0x232c00[_0x102d('0x4b')]['id']}},_0x47e986={};_0x47e986[_0x102d('0x37')]=_['keys'](db[_0x102d('0x30')][_0x102d('0x4c')]);_0x47e986[_0x102d('0x33')]=_[_0x102d('0x34')](_0x232c00[_0x102d('0x33')]);_0x47e986[_0x102d('0x3d')]=_['intersection'](_0x47e986[_0x102d('0x37')],_0x47e986[_0x102d('0x33')]);_0x4acad8[_0x102d('0x36')]=_['intersection'](_0x47e986[_0x102d('0x37')],qs[_0x102d('0x38')](_0x232c00[_0x102d('0x33')][_0x102d('0x38')]));_0x4acad8['attributes']=_0x4acad8[_0x102d('0x36')][_0x102d('0x39')]?_0x4acad8[_0x102d('0x36')]:_0x47e986[_0x102d('0x37')];if(_0x232c00[_0x102d('0x33')][_0x102d('0x45')]){_0x4acad8[_0x102d('0x46')]=[{'all':!![]}];}_0x4acad8=_[_0x102d('0x40')]({},_0x4acad8,_0x232c00[_0x102d('0x43')]);return db[_0x102d('0x30')][_0x102d('0x4d')](_0x4acad8)[_0x102d('0x44')](handleEntityNotFound(_0x2dc543,null))[_0x102d('0x44')](respondWithResult(_0x2dc543,null))[_0x102d('0x49')](handleError(_0x2dc543,null));};exports[_0x102d('0x4e')]=function(_0x373a88,_0x28e768){return db[_0x102d('0x30')][_0x102d('0x4e')](_0x373a88[_0x102d('0x4f')],{})[_0x102d('0x44')](respondWithResult(_0x28e768,0xc9))['catch'](handleError(_0x28e768,null));};exports[_0x102d('0x2a')]=function(_0x55a07e,_0xe57186){if(_0x55a07e[_0x102d('0x4f')]['id']){delete _0x55a07e[_0x102d('0x4f')]['id'];}return db[_0x102d('0x30')][_0x102d('0x4d')]({'where':{'id':_0x55a07e[_0x102d('0x4b')]['id']}})[_0x102d('0x44')](handleEntityNotFound(_0xe57186,null))[_0x102d('0x44')](saveUpdates(_0x55a07e[_0x102d('0x4f')],null))[_0x102d('0x44')](respondWithResult(_0xe57186,null))[_0x102d('0x49')](handleError(_0xe57186,null));};exports[_0x102d('0x2b')]=function(_0x409d30,_0x42a6f2){return db[_0x102d('0x30')][_0x102d('0x4d')]({'where':{'id':_0x409d30[_0x102d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x42a6f2,null))[_0x102d('0x44')](removeEntity(_0x42a6f2,null))['catch'](handleError(_0x42a6f2,null));};exports['getConfigurations']=function(_0x2c40ec,_0x5ced2d,_0x3efa2b){var _0x532be9={};var _0x20235e={};var _0xe700af;var _0x28e14f;return db[_0x102d('0x30')][_0x102d('0x50')]({'where':{'id':_0x2c40ec[_0x102d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5ced2d,null))[_0x102d('0x44')](function(_0x32a494){if(_0x32a494){_0xe700af=_0x32a494;_0x20235e[_0x102d('0x37')]=_[_0x102d('0x34')](db['DeskConfiguration'][_0x102d('0x4c')]);_0x20235e[_0x102d('0x33')]=_[_0x102d('0x34')](_0x2c40ec[_0x102d('0x33')]);_0x20235e[_0x102d('0x3d')]=_[_0x102d('0x35')](_0x20235e[_0x102d('0x37')],_0x20235e[_0x102d('0x33')]);_0x532be9[_0x102d('0x36')]=_[_0x102d('0x35')](_0x20235e[_0x102d('0x37')],qs[_0x102d('0x38')](_0x2c40ec['query'][_0x102d('0x38')]));_0x532be9[_0x102d('0x36')]=_0x532be9[_0x102d('0x36')]['length']?_0x532be9['attributes']:_0x20235e[_0x102d('0x37')];_0x532be9[_0x102d('0x51')]=qs[_0x102d('0x3c')](_0x2c40ec[_0x102d('0x33')][_0x102d('0x3c')]);_0x532be9[_0x102d('0x3f')]=qs[_0x102d('0x3d')](_['pick'](_0x2c40ec[_0x102d('0x33')],_0x20235e[_0x102d('0x3d')]));if(_0x2c40ec[_0x102d('0x33')][_0x102d('0x3e')]){_0x532be9['where']=_['merge'](_0x532be9[_0x102d('0x3f')],{'$or':_[_0x102d('0x32')](_0x532be9[_0x102d('0x36')],function(_0x5d709f){var _0x39a1a4={};_0x39a1a4[_0x5d709f]={'$like':'%'+_0x2c40ec['query']['filter']+'%'};return _0x39a1a4;})});}_0x532be9=_['merge']({},_0x532be9,_0x2c40ec[_0x102d('0x43')]);return _0xe700af[_0x102d('0x52')](_0x532be9);}})[_0x102d('0x44')](function(_0x20bcc8){if(_0x20bcc8){_0x28e14f=_0x20bcc8['length'];if(!_0x2c40ec[_0x102d('0x33')][_0x102d('0x3a')](_0x102d('0x3b'))){_0x532be9['limit']=qs[_0x102d('0x25')](_0x2c40ec['query']['limit']);_0x532be9[_0x102d('0x23')]=qs['offset'](_0x2c40ec[_0x102d('0x33')][_0x102d('0x23')]);}return _0xe700af[_0x102d('0x52')](_0x532be9);}})[_0x102d('0x44')](function(_0x4025ca){if(_0x4025ca){return _0x4025ca?{'count':_0x28e14f,'rows':_0x4025ca}:null;}})[_0x102d('0x44')](respondWithResult(_0x5ced2d,null))[_0x102d('0x49')](handleError(_0x5ced2d,null));};exports['addConfiguration']=function(_0x387068,_0x1c072d,_0x3936d5){if(_0x387068['body']['id']){delete _0x387068[_0x102d('0x4f')]['id'];}return db[_0x102d('0x30')][_0x102d('0x50')]({'where':{'id':_0x387068[_0x102d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1c072d,null))[_0x102d('0x44')](function(_0x4b064d){if(_0x4b064d){_0x387068[_0x102d('0x4f')][_0x102d('0x53')]=_0x4b064d['id'];_0x387068[_0x102d('0x4f')]['Subjects']=integrations[_0x102d('0x54')](_0x387068['body']['channel'],_0x387068[_0x102d('0x4f')][_0x102d('0x41')]);_0x387068[_0x102d('0x4f')]['Descriptions']=integrations[_0x102d('0x55')](_0x387068[_0x102d('0x4f')][_0x102d('0x56')],_0x387068[_0x102d('0x4f')][_0x102d('0x41')]);return db['DeskConfiguration'][_0x102d('0x4e')](_0x387068[_0x102d('0x4f')],{'include':[{'model':db['DeskField'],'as':_0x102d('0x57')},{'model':db[_0x102d('0x58')],'as':_0x102d('0x59')}]});}return null;})[_0x102d('0x44')](respondWithResult(_0x1c072d,null))['catch'](handleError(_0x1c072d,null));};exports[_0x102d('0x5a')]=function(_0x5e1de5,_0x2bb8d4,_0x37b397){var _0x292e59=[{'name':_0x102d('0x5b'),'label':_0x102d('0x5b'),'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 _0x3b9754='';return db[_0x102d('0x30')][_0x102d('0x50')]({'where':{'id':_0x5e1de5[_0x102d('0x4b')]['id']},'attributes':['id',_0x102d('0x5c'),_0x102d('0x5d'),_0x102d('0x5e'),_0x102d('0x5f'),_0x102d('0x60'),_0x102d('0x61'),_0x102d('0x62'),_0x102d('0x63')]})['then'](handleEntityNotFound(_0x2bb8d4,null))[_0x102d('0x44')](function(_0x4af07e){if(_0x4af07e){_0x3b9754=_0x4af07e[_0x102d('0x5c')];var _0x5d3f00=_0x3b9754[_0x102d('0x64')](-0x1);if(_0x5d3f00==='/'){_0x3b9754=_0x3b9754[_0x102d('0x65')](0x0,_0x3b9754['lastIndexOf'](_0x5d3f00));}var _0x43aab7={'method':_0x102d('0x66'),'uri':util[_0x102d('0x67')]('%s/custom_fields',_0x3b9754),'headers':{'Content-Type':_0x102d('0x68'),'Accept':'application/json'},'json':!![]};if(_0x4af07e['authType']==='basic'){_0x43aab7[_0x102d('0x69')][_0x102d('0x6a')]=util['format'](_0x102d('0x6b'),new Buffer(util[_0x102d('0x67')](_0x102d('0x6c'),_0x4af07e[_0x102d('0x5e')],_0x4af07e[_0x102d('0x5f')]))[_0x102d('0x6d')](_0x102d('0x6e')));}return rp(_0x43aab7)[_0x102d('0x44')](function(_0x581e8b){return _0x292e59[_0x102d('0x6f')](_[_0x102d('0x32')](_0x581e8b['_embedded'][_0x102d('0x70')],function(_0x1bc8d5){return{'id':_0x1bc8d5[_0x102d('0x2e')],'name':_0x1bc8d5[_0x102d('0x2e')],'type':_0x1bc8d5['type'],'active':_0x1bc8d5['active'],'label':_0x1bc8d5[_0x102d('0x71')],'custom':!![]};}));});}})[_0x102d('0x44')](function(_0x2ee74b){return{'count':_0x2ee74b[_0x102d('0x39')],'rows':_0x2ee74b};})['then'](respondWithResult(_0x2bb8d4,null))[_0x102d('0x49')](function(_0x153a7b){var _0x624770=_0x5e1de5[_0x102d('0x33')][_0x102d('0x72')]?0x1f4:_0x153a7b[_0x102d('0x73')]||0x1f4;logger['error'](_0x102d('0x74'),_0x102d('0x5a'),_0x624770,JSON[_0x102d('0x75')](_0x153a7b));delete _0x153a7b[_0x102d('0x2e')];if(_0x624770===0x191){_0x624770=0x190;}_0x2bb8d4['status'](_0x624770)[_0x102d('0x76')](_0x5e1de5[_0x102d('0x33')][_0x102d('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x153a7b[_0x102d('0x73')]}:_0x153a7b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 00ea836..154dc79 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 _0xe2c0=['../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0x386187,_0x1ad2ac){var _0x4abeaa=function(_0x251f63){while(--_0x251f63){_0x386187['push'](_0x386187['shift']());}};_0x4abeaa(++_0x1ad2ac);}(_0xe2c0,0x1c7));var _0x0e2c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe2c0[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x0e2c('0x0'));var util=require(_0x0e2c('0x1'));var logger=require(_0x0e2c('0x2'))(_0x0e2c('0x3'));var moment=require(_0x0e2c('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e2c('0x5'));var fs=require('fs');var path=require(_0x0e2c('0x6'));var rimraf=require(_0x0e2c('0x7'));var config=require(_0x0e2c('0x8'));var attributes=require(_0x0e2c('0x9'));var integrations=require(_0x0e2c('0xa'));module[_0x0e2c('0xb')]=function(_0x1391f5,_0x5757d0){return _0x1391f5[_0x0e2c('0xc')](_0x0e2c('0xd'),attributes,{'tableName':_0x0e2c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b8b=['api','moment','bluebird','request-promise','path','./intDeskAccount.attributes','DeskAccount','int_desk_accounts','util','../../config/logger'];(function(_0xbb8027,_0x2a601e){var _0x348bbc=function(_0x2c138d){while(--_0x2c138d){_0xbb8027['push'](_0xbb8027['shift']());}};_0x348bbc(++_0x2a601e);}(_0x8b8b,0xa8));var _0xb8b8=function(_0x24e01b,_0x4ad77e){_0x24e01b=_0x24e01b-0x0;var _0x7ab785=_0x8b8b[_0x24e01b];return _0x7ab785;};'use strict';var _=require('lodash');var util=require(_0xb8b8('0x0'));var logger=require(_0xb8b8('0x1'))(_0xb8b8('0x2'));var moment=require(_0xb8b8('0x3'));var BPromise=require(_0xb8b8('0x4'));var rp=require(_0xb8b8('0x5'));var fs=require('fs');var path=require(_0xb8b8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb8b8('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4e1212,_0x2fe606){return _0x4e1212['define'](_0xb8b8('0x8'),attributes,{'tableName':_0xb8b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index b9f2178..f403d7b 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 _0x1b24=['rpc','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowDeskAccount','find','info','lodash','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x91ed64,_0x21b822){var _0x39dbb7=function(_0x3bfd23){while(--_0x3bfd23){_0x91ed64['push'](_0x91ed64['shift']());}};_0x39dbb7(++_0x21b822);}(_0x1b24,0x1c8));var _0x41b2=function(_0x2b97bc,_0xace6d0){_0x2b97bc=_0x2b97bc-0x0;var _0x1e784d=_0x1b24[_0x2b97bc];return _0x1e784d;};'use strict';var _=require(_0x41b2('0x0'));var util=require(_0x41b2('0x1'));var moment=require(_0x41b2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41b2('0x3'));var db=require(_0x41b2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x41b2('0x5'))(_0x41b2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x41b2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x483afa,_0x13954d,_0x3d62ff){return new BPromise(function(_0x6d733d,_0x1cec96){return client[_0x41b2('0x8')](_0x483afa,_0x3d62ff)[_0x41b2('0x9')](function(_0x165389){logger['info'](_0x41b2('0xa'),_0x13954d,_0x41b2('0xb'));logger[_0x41b2('0xc')](_0x41b2('0xd'),_0x13954d,'request\x20sent',JSON[_0x41b2('0xe')](_0x165389));if(_0x165389[_0x41b2('0xf')]){if(_0x165389['error']['code']===0x1f4){logger[_0x41b2('0xf')]('DeskAccount,\x20%s,\x20%s',_0x13954d,_0x165389['error']['message']);return _0x1cec96(_0x165389['error'][_0x41b2('0x10')]);}logger[_0x41b2('0xf')](_0x41b2('0xa'),_0x13954d,_0x165389[_0x41b2('0xf')]['message']);return _0x6d733d(_0x165389['error']['message']);}else{logger['info'](_0x41b2('0xa'),_0x13954d,'request\x20sent');_0x6d733d(_0x165389[_0x41b2('0x11')][_0x41b2('0x10')]);}})[_0x41b2('0x12')](function(_0x2e4c04){logger[_0x41b2('0xf')]('DeskAccount,\x20%s,\x20%s',_0x13954d,_0x2e4c04);_0x1cec96(_0x2e4c04);});});}exports[_0x41b2('0x13')]=function(_0x2e982a){var _0x12fc34=this;return new Promise(function(_0x437e89,_0x3c2c1f){return db[_0x41b2('0x14')][_0x41b2('0x15')]({'raw':_0x2e982a[_0x41b2('0x16')]?_0x2e982a['options'][_0x41b2('0x17')]===undefined?!![]:![]:!![],'where':_0x2e982a[_0x41b2('0x16')]?_0x2e982a[_0x41b2('0x16')][_0x41b2('0x18')]||null:null,'attributes':_0x2e982a[_0x41b2('0x16')]?_0x2e982a['options'][_0x41b2('0x19')]||null:null,'limit':_0x2e982a[_0x41b2('0x16')]?_0x2e982a[_0x41b2('0x16')][_0x41b2('0x1a')]||null:null,'include':_0x2e982a[_0x41b2('0x16')]?_0x2e982a[_0x41b2('0x16')]['include']?_[_0x41b2('0x1b')](_0x2e982a[_0x41b2('0x16')]['include'],function(_0x163004){return{'model':db[_0x163004['model']],'as':_0x163004['as'],'attributes':_0x163004[_0x41b2('0x19')],'include':_0x163004['include']?_[_0x41b2('0x1b')](_0x163004[_0x41b2('0x1c')],function(_0x174985){return{'model':db[_0x174985[_0x41b2('0x1d')]],'as':_0x174985['as'],'attributes':_0x174985[_0x41b2('0x19')],'include':_0x174985[_0x41b2('0x1c')]?_[_0x41b2('0x1b')](_0x174985['include'],function(_0xff5732){return{'model':db[_0xff5732[_0x41b2('0x1d')]],'as':_0xff5732['as'],'attributes':_0xff5732['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x36f76b){logger['info'](_0x41b2('0x13'),_0x2e982a);logger[_0x41b2('0xc')](_0x41b2('0x13'),_0x2e982a,JSON[_0x41b2('0xe')](_0x36f76b));_0x437e89(_0x36f76b);})['catch'](function(_0x3ea0d7){logger[_0x41b2('0xf')](_0x41b2('0x13'),_0x3ea0d7[_0x41b2('0x10')],_0x2e982a);_0x3c2c1f(_0x12fc34[_0x41b2('0xf')](0x1f4,_0x3ea0d7[_0x41b2('0x10')]));});});};exports[_0x41b2('0x1e')]=function(_0x22e3fe){var _0x4834a4=this;return new Promise(function(_0x3641b4,_0x4cda8c){return db['DeskAccount'][_0x41b2('0x1f')]({'raw':_0x22e3fe[_0x41b2('0x16')]?_0x22e3fe[_0x41b2('0x16')][_0x41b2('0x17')]===undefined?!![]:![]:!![],'where':_0x22e3fe['options']?_0x22e3fe[_0x41b2('0x16')]['where']||null:null,'attributes':_0x22e3fe[_0x41b2('0x16')]?_0x22e3fe[_0x41b2('0x16')]['attributes']||null:null,'include':_0x22e3fe['options']?_0x22e3fe['options']['include']?_[_0x41b2('0x1b')](_0x22e3fe[_0x41b2('0x16')]['include'],function(_0x483aa7){return{'model':db[_0x483aa7[_0x41b2('0x1d')]],'as':_0x483aa7['as'],'attributes':_0x483aa7[_0x41b2('0x19')],'include':_0x483aa7[_0x41b2('0x1c')]?_[_0x41b2('0x1b')](_0x483aa7[_0x41b2('0x1c')],function(_0x29c438){return{'model':db[_0x29c438[_0x41b2('0x1d')]],'as':_0x29c438['as'],'attributes':_0x29c438[_0x41b2('0x19')],'include':_0x29c438[_0x41b2('0x1c')]?_['map'](_0x29c438[_0x41b2('0x1c')],function(_0x3e3b29){return{'model':db[_0x3e3b29[_0x41b2('0x1d')]],'as':_0x3e3b29['as'],'attributes':_0x3e3b29[_0x41b2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x41b2('0x9')](function(_0x3d5358){logger[_0x41b2('0x20')](_0x41b2('0x1e'),_0x22e3fe);logger['debug'](_0x41b2('0x1e'),_0x22e3fe,JSON[_0x41b2('0xe')](_0x3d5358));_0x3641b4(_0x3d5358);})[_0x41b2('0x12')](function(_0x182664){logger[_0x41b2('0xf')](_0x41b2('0x1e'),_0x182664[_0x41b2('0x10')],_0x22e3fe);_0x4cda8c(_0x4834a4[_0x41b2('0xf')](0x1f4,_0x182664[_0x41b2('0x10')]));});});}; \ No newline at end of file +var _0x0845=['attributes','GetDeskAccount','debug','stringify','DeskAccount','find','ShowDeskAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','findAll','options','raw','where','limit','include','map','model'];(function(_0xad6ad6,_0x2d5164){var _0x299b03=function(_0x27d6c0){while(--_0x27d6c0){_0xad6ad6['push'](_0xad6ad6['shift']());}};_0x299b03(++_0x2d5164);}(_0x0845,0xd9));var _0x5084=function(_0x25a9f1,_0x1d857d){_0x25a9f1=_0x25a9f1-0x0;var _0x9bf1e=_0x0845[_0x25a9f1];return _0x9bf1e;};'use strict';var _=require(_0x5084('0x0'));var util=require('util');var moment=require(_0x5084('0x1'));var BPromise=require('bluebird');var rs=require(_0x5084('0x2'));var fs=require('fs');var Redis=require(_0x5084('0x3'));var db=require(_0x5084('0x4'))['db'];var utils=require(_0x5084('0x5'));var logger=require(_0x5084('0x6'))(_0x5084('0x7'));var config=require(_0x5084('0x8'));var jayson=require(_0x5084('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf77eda,_0x7f1a03,_0x5dc5ab){return new BPromise(function(_0x53bb5d,_0x38882b){return client[_0x5084('0xa')](_0xf77eda,_0x5dc5ab)[_0x5084('0xb')](function(_0xf61dee){logger[_0x5084('0xc')](_0x5084('0xd'),_0x7f1a03,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x7f1a03,_0x5084('0xe'),JSON['stringify'](_0xf61dee));if(_0xf61dee['error']){if(_0xf61dee['error'][_0x5084('0xf')]===0x1f4){logger[_0x5084('0x10')](_0x5084('0xd'),_0x7f1a03,_0xf61dee[_0x5084('0x10')]['message']);return _0x38882b(_0xf61dee[_0x5084('0x10')][_0x5084('0x11')]);}logger[_0x5084('0x10')]('DeskAccount,\x20%s,\x20%s',_0x7f1a03,_0xf61dee[_0x5084('0x10')][_0x5084('0x11')]);return _0x53bb5d(_0xf61dee[_0x5084('0x10')][_0x5084('0x11')]);}else{logger[_0x5084('0xc')]('DeskAccount,\x20%s,\x20%s',_0x7f1a03,_0x5084('0xe'));_0x53bb5d(_0xf61dee[_0x5084('0x12')][_0x5084('0x11')]);}})[_0x5084('0x13')](function(_0x360975){logger['error'](_0x5084('0xd'),_0x7f1a03,_0x360975);_0x38882b(_0x360975);});});}exports['GetDeskAccount']=function(_0x158720){var _0x25865e=this;return new Promise(function(_0x390c8f,_0x4167e6){return db['DeskAccount'][_0x5084('0x14')]({'raw':_0x158720[_0x5084('0x15')]?_0x158720[_0x5084('0x15')][_0x5084('0x16')]===undefined?!![]:![]:!![],'where':_0x158720['options']?_0x158720[_0x5084('0x15')][_0x5084('0x17')]||null:null,'attributes':_0x158720[_0x5084('0x15')]?_0x158720['options']['attributes']||null:null,'limit':_0x158720[_0x5084('0x15')]?_0x158720[_0x5084('0x15')][_0x5084('0x18')]||null:null,'include':_0x158720['options']?_0x158720[_0x5084('0x15')][_0x5084('0x19')]?_[_0x5084('0x1a')](_0x158720['options'][_0x5084('0x19')],function(_0x19ce7a){return{'model':db[_0x19ce7a[_0x5084('0x1b')]],'as':_0x19ce7a['as'],'attributes':_0x19ce7a['attributes'],'include':_0x19ce7a[_0x5084('0x19')]?_[_0x5084('0x1a')](_0x19ce7a[_0x5084('0x19')],function(_0x40bfe2){return{'model':db[_0x40bfe2[_0x5084('0x1b')]],'as':_0x40bfe2['as'],'attributes':_0x40bfe2[_0x5084('0x1c')],'include':_0x40bfe2[_0x5084('0x19')]?_[_0x5084('0x1a')](_0x40bfe2[_0x5084('0x19')],function(_0x1d078e){return{'model':db[_0x1d078e[_0x5084('0x1b')]],'as':_0x1d078e['as'],'attributes':_0x1d078e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5084('0xb')](function(_0x42dddf){logger[_0x5084('0xc')](_0x5084('0x1d'),_0x158720);logger[_0x5084('0x1e')]('GetDeskAccount',_0x158720,JSON[_0x5084('0x1f')](_0x42dddf));_0x390c8f(_0x42dddf);})['catch'](function(_0x5f2015){logger[_0x5084('0x10')]('GetDeskAccount',_0x5f2015[_0x5084('0x11')],_0x158720);_0x4167e6(_0x25865e['error'](0x1f4,_0x5f2015[_0x5084('0x11')]));});});};exports['ShowDeskAccount']=function(_0x24e6fe){var _0x55894e=this;return new Promise(function(_0x4aff5b,_0x7c62c1){return db[_0x5084('0x20')][_0x5084('0x21')]({'raw':_0x24e6fe['options']?_0x24e6fe[_0x5084('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x24e6fe[_0x5084('0x15')]?_0x24e6fe[_0x5084('0x15')]['where']||null:null,'attributes':_0x24e6fe['options']?_0x24e6fe['options'][_0x5084('0x1c')]||null:null,'include':_0x24e6fe['options']?_0x24e6fe[_0x5084('0x15')][_0x5084('0x19')]?_['map'](_0x24e6fe[_0x5084('0x15')][_0x5084('0x19')],function(_0x31b343){return{'model':db[_0x31b343['model']],'as':_0x31b343['as'],'attributes':_0x31b343['attributes'],'include':_0x31b343[_0x5084('0x19')]?_[_0x5084('0x1a')](_0x31b343['include'],function(_0x9898fe){return{'model':db[_0x9898fe[_0x5084('0x1b')]],'as':_0x9898fe['as'],'attributes':_0x9898fe[_0x5084('0x1c')],'include':_0x9898fe['include']?_[_0x5084('0x1a')](_0x9898fe['include'],function(_0x18c98c){return{'model':db[_0x18c98c['model']],'as':_0x18c98c['as'],'attributes':_0x18c98c[_0x5084('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5084('0xb')](function(_0x522ae9){logger['info'](_0x5084('0x22'),_0x24e6fe);logger[_0x5084('0x1e')]('ShowDeskAccount',_0x24e6fe,JSON[_0x5084('0x1f')](_0x522ae9));_0x4aff5b(_0x522ae9);})[_0x5084('0x13')](function(_0x5dd310){logger[_0x5084('0x10')](_0x5084('0x22'),_0x5dd310[_0x5084('0x11')],_0x24e6fe);_0x7c62c1(_0x55894e[_0x5084('0x10')](0x1f4,_0x5dd310[_0x5084('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c3319a4..db634ba 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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x13cdaa,_0x4cca8f){var _0x5066ff=function(_0x51c771){while(--_0x51c771){_0x13cdaa['push'](_0x13cdaa['shift']());}};_0x5066ff(++_0x4cca8f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x254bb9,_0x494838){var _0x223fcc=function(_0x9307c7){while(--_0x9307c7){_0x254bb9['push'](_0x254bb9['shift']());}};_0x223fcc(++_0x494838);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 11f274a..937aedf 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 _0x05ef=['STRING','sequelize','exports'];(function(_0x1387ce,_0x48ef84){var _0x5afa82=function(_0x244706){while(--_0x244706){_0x1387ce['push'](_0x1387ce['shift']());}};_0x5afa82(++_0x48ef84);}(_0x05ef,0x1c0));var _0xf05e=function(_0x6faf9a,_0x17d9e6){_0x6faf9a=_0x6faf9a-0x0;var _0x25f7cb=_0x05ef[_0x6faf9a];return _0x25f7cb;};'use strict';var Sequelize=require(_0xf05e('0x0'));module[_0xf05e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf05e('0x2')]}}; \ No newline at end of file +var _0x2948=['exports','STRING','sequelize'];(function(_0x2b7e52,_0x2a4b8f){var _0x4c55d7=function(_0x127660){while(--_0x127660){_0x2b7e52['push'](_0x2b7e52['shift']());}};_0x4c55d7(++_0x2a4b8f);}(_0x2948,0xef));var _0x8294=function(_0x2dcbe2,_0xd779f3){_0x2dcbe2=_0x2dcbe2-0x0;var _0x372f90=_0x2948[_0x2dcbe2];return _0x372f90;};'use strict';var Sequelize=require(_0x8294('0x0'));module[_0x8294('0x1')]={'name':{'type':Sequelize[_0x8294('0x2')]},'description':{'type':Sequelize[_0x8294('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index ca087ff..8b21391 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 _0xaba4=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','length','create','body','find','destroy','params','catch','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','apply','reject','save','then','sendStatus','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x306863,_0x26f3cf){var _0x20161e=function(_0x3af666){while(--_0x3af666){_0x306863['push'](_0x306863['shift']());}};_0x20161e(++_0x26f3cf);}(_0xaba4,0x105));var _0x4aba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaba4[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x4aba('0x0'));var rimraf=require(_0x4aba('0x1'));var zipdir=require(_0x4aba('0x2'));var jsonpatch=require(_0x4aba('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4aba('0x4'));var Mustache=require(_0x4aba('0x5'));var util=require(_0x4aba('0x6'));var path=require(_0x4aba('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4aba('0x8'));var fs=require('fs');var fs_extra=require(_0x4aba('0x9'));var _=require('lodash');var squel=require(_0x4aba('0xa'));var crypto=require(_0x4aba('0xb'));var jsforce=require(_0x4aba('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4aba('0xd'));var querystring=require(_0x4aba('0xe'));var Papa=require(_0x4aba('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4aba('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4aba('0x11'));var logger=require(_0x4aba('0x12'))('api');var utils=require(_0x4aba('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4aba('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e72b1,_0xb120ea){_0xb120ea=_0xb120ea||0xcc;return function(_0x24198e){if(_0x24198e){return _0x4e72b1['sendStatus'](_0xb120ea);}return _0x4e72b1[_0x4aba('0x15')](_0xb120ea)[_0x4aba('0x16')]();};}function respondWithResult(_0x3eb58b,_0x26cfd2){_0x26cfd2=_0x26cfd2||0xc8;return function(_0x1f952){if(_0x1f952){return _0x3eb58b[_0x4aba('0x15')](_0x26cfd2)['json'](_0x1f952);}};}function respondWithFilteredResult(_0x2ebce5,_0x4ace80){return function(_0x5064ca){if(_0x5064ca){var _0x55e0c2=typeof _0x4ace80[_0x4aba('0x17')]===_0x4aba('0x18')&&typeof _0x4ace80[_0x4aba('0x19')]==='undefined';var _0x29b4a7=_0x5064ca[_0x4aba('0x1a')];var _0x53aa35=_0x55e0c2?0x0:_0x4ace80[_0x4aba('0x17')];var _0x2c3b12=_0x55e0c2?_0x5064ca[_0x4aba('0x1a')]:_0x4ace80[_0x4aba('0x17')]+_0x4ace80['limit'];var _0x2cf50;if(_0x2c3b12>=_0x29b4a7){_0x2c3b12=_0x29b4a7;_0x2cf50=0xc8;}else{_0x2cf50=0xce;}_0x2ebce5['status'](_0x2cf50);return _0x2ebce5['set']('Content-Range',_0x53aa35+'-'+_0x2c3b12+'/'+_0x29b4a7)['json'](_0x5064ca);}return null;};}function patchUpdates(_0x36ec4c){return function(_0x125587){try{jsonpatch[_0x4aba('0x1b')](_0x125587,_0x36ec4c,!![]);}catch(_0x5d70ba){return BPromise[_0x4aba('0x1c')](_0x5d70ba);}return _0x125587[_0x4aba('0x1d')]();};}function saveUpdates(_0x41731a,_0x1ebc06){return function(_0x5c07f1){if(_0x5c07f1){return _0x5c07f1['update'](_0x41731a)[_0x4aba('0x1e')](function(_0x2d7f6d){return _0x2d7f6d;});}return null;};}function removeEntity(_0x1fbd11,_0x122ce2){return function(_0x120f82){if(_0x120f82){return _0x120f82['destroy']()['then'](function(){_0x1fbd11[_0x4aba('0x15')](0xcc)[_0x4aba('0x16')]();});}};}function handleEntityNotFound(_0x30ba99,_0x1dfa70){return function(_0x3f3394){if(!_0x3f3394){_0x30ba99[_0x4aba('0x1f')](0x194);}return _0x3f3394;};}function handleError(_0x3fd720,_0x1be57b){_0x1be57b=_0x1be57b||0x1f4;return function(_0x5200b7){logger[_0x4aba('0x20')](_0x5200b7[_0x4aba('0x21')]);if(_0x5200b7[_0x4aba('0x22')]){delete _0x5200b7[_0x4aba('0x22')];}_0x3fd720['status'](_0x1be57b)[_0x4aba('0x23')](_0x5200b7);};}exports[_0x4aba('0x24')]=function(_0x13e413,_0x48277d){var _0x471fda={},_0x183e90={},_0x557a9a={'count':0x0,'rows':[]};var _0x52e75e=_['map'](db[_0x4aba('0x25')][_0x4aba('0x26')],function(_0x437190){return{'name':_0x437190[_0x4aba('0x27')],'type':_0x437190[_0x4aba('0x28')][_0x4aba('0x29')]};});_0x183e90[_0x4aba('0x2a')]=_[_0x4aba('0x2b')](_0x52e75e,_0x4aba('0x22'));_0x183e90[_0x4aba('0x2c')]=_[_0x4aba('0x2d')](_0x13e413[_0x4aba('0x2c')]);_0x183e90[_0x4aba('0x2e')]=_[_0x4aba('0x2f')](_0x183e90['model'],_0x183e90['query']);_0x471fda[_0x4aba('0x30')]=_[_0x4aba('0x2f')](_0x183e90['model'],qs[_0x4aba('0x31')](_0x13e413[_0x4aba('0x2c')][_0x4aba('0x31')]));_0x471fda['attributes']=_0x471fda[_0x4aba('0x30')]['length']?_0x471fda[_0x4aba('0x30')]:_0x183e90[_0x4aba('0x2a')];if(!_0x13e413['query'][_0x4aba('0x32')](_0x4aba('0x33'))){_0x471fda[_0x4aba('0x19')]=qs[_0x4aba('0x19')](_0x13e413[_0x4aba('0x2c')]['limit']);_0x471fda[_0x4aba('0x17')]=qs[_0x4aba('0x17')](_0x13e413[_0x4aba('0x2c')][_0x4aba('0x17')]);}_0x471fda[_0x4aba('0x34')]=qs[_0x4aba('0x35')](_0x13e413[_0x4aba('0x2c')]['sort']);_0x471fda[_0x4aba('0x36')]=qs[_0x4aba('0x2e')](_[_0x4aba('0x37')](_0x13e413[_0x4aba('0x2c')],_0x183e90[_0x4aba('0x2e')]),_0x52e75e);if(_0x13e413[_0x4aba('0x2c')][_0x4aba('0x38')]){_0x471fda[_0x4aba('0x36')]=_[_0x4aba('0x39')](_0x471fda[_0x4aba('0x36')],{'$or':_[_0x4aba('0x2b')](_0x52e75e,function(_0x21873c){if(_0x21873c[_0x4aba('0x28')]!==_0x4aba('0x3a')){var _0x23ca20={};_0x23ca20[_0x21873c[_0x4aba('0x22')]]={'$like':'%'+_0x13e413[_0x4aba('0x2c')][_0x4aba('0x38')]+'%'};return _0x23ca20;}})});}_0x471fda=_['merge']({},_0x471fda,_0x13e413[_0x4aba('0x3b')]);var _0x3d5f4b={'where':_0x471fda['where']};return db[_0x4aba('0x25')][_0x4aba('0x1a')](_0x3d5f4b)[_0x4aba('0x1e')](function(_0x1c1de5){_0x557a9a['count']=_0x1c1de5;if(_0x13e413[_0x4aba('0x2c')][_0x4aba('0x3c')]){_0x471fda[_0x4aba('0x3d')]=[{'all':!![]}];}return db[_0x4aba('0x25')][_0x4aba('0x3e')](_0x471fda);})[_0x4aba('0x1e')](function(_0x30a02d){_0x557a9a[_0x4aba('0x3f')]=_0x30a02d;return _0x557a9a;})[_0x4aba('0x1e')](respondWithFilteredResult(_0x48277d,_0x471fda))['catch'](handleError(_0x48277d,null));};exports['show']=function(_0x45c450,_0x283328){var _0x5e1fb7={'raw':![],'where':{'id':_0x45c450['params']['id']}},_0x773de2={};_0x773de2[_0x4aba('0x2a')]=_['keys'](db[_0x4aba('0x25')]['rawAttributes']);_0x773de2[_0x4aba('0x2c')]=_[_0x4aba('0x2d')](_0x45c450[_0x4aba('0x2c')]);_0x773de2[_0x4aba('0x2e')]=_[_0x4aba('0x2f')](_0x773de2[_0x4aba('0x2a')],_0x773de2[_0x4aba('0x2c')]);_0x5e1fb7[_0x4aba('0x30')]=_[_0x4aba('0x2f')](_0x773de2[_0x4aba('0x2a')],qs['fields'](_0x45c450['query']['fields']));_0x5e1fb7[_0x4aba('0x30')]=_0x5e1fb7[_0x4aba('0x30')][_0x4aba('0x40')]?_0x5e1fb7['attributes']:_0x773de2[_0x4aba('0x2a')];if(_0x45c450[_0x4aba('0x2c')][_0x4aba('0x3c')]){_0x5e1fb7['include']=[{'all':!![]}];}_0x5e1fb7=_[_0x4aba('0x39')]({},_0x5e1fb7,_0x45c450[_0x4aba('0x3b')]);return db[_0x4aba('0x25')]['find'](_0x5e1fb7)[_0x4aba('0x1e')](handleEntityNotFound(_0x283328,null))[_0x4aba('0x1e')](respondWithResult(_0x283328,null))['catch'](handleError(_0x283328,null));};exports[_0x4aba('0x41')]=function(_0x4f6d9d,_0x48d82e){return db[_0x4aba('0x25')][_0x4aba('0x41')](_0x4f6d9d[_0x4aba('0x42')],{})[_0x4aba('0x1e')](respondWithResult(_0x48d82e,0xc9))['catch'](handleError(_0x48d82e,null));};exports['update']=function(_0x2dd886,_0x32b60d){if(_0x2dd886['body']['id']){delete _0x2dd886['body']['id'];}return db[_0x4aba('0x25')][_0x4aba('0x43')]({'where':{'id':_0x2dd886['params']['id']}})[_0x4aba('0x1e')](handleEntityNotFound(_0x32b60d,null))['then'](saveUpdates(_0x2dd886['body'],null))[_0x4aba('0x1e')](respondWithResult(_0x32b60d,null))['catch'](handleError(_0x32b60d,null));};exports[_0x4aba('0x44')]=function(_0x3a7b4e,_0x201c9b){return db[_0x4aba('0x25')]['find']({'where':{'id':_0x3a7b4e[_0x4aba('0x45')]['id']}})[_0x4aba('0x1e')](handleEntityNotFound(_0x201c9b,null))[_0x4aba('0x1e')](removeEntity(_0x201c9b,null))[_0x4aba('0x46')](handleError(_0x201c9b,null));};exports[_0x4aba('0x47')]=function(_0x28d851,_0x1c37d9,_0x35c340){var _0x297e86={};var _0x3e0921={};var _0x8bb9f6;var _0x2b36f4;return db[_0x4aba('0x25')][_0x4aba('0x48')]({'where':{'id':_0x28d851[_0x4aba('0x45')]['id']}})[_0x4aba('0x1e')](handleEntityNotFound(_0x1c37d9,null))[_0x4aba('0x1e')](function(_0x195c5a){if(_0x195c5a){_0x8bb9f6=_0x195c5a;_0x3e0921[_0x4aba('0x2a')]=_['keys'](db[_0x4aba('0x49')][_0x4aba('0x26')]);_0x3e0921[_0x4aba('0x2c')]=_[_0x4aba('0x2d')](_0x28d851[_0x4aba('0x2c')]);_0x3e0921['filters']=_[_0x4aba('0x2f')](_0x3e0921[_0x4aba('0x2a')],_0x3e0921['query']);_0x297e86[_0x4aba('0x30')]=_[_0x4aba('0x2f')](_0x3e0921[_0x4aba('0x2a')],qs[_0x4aba('0x31')](_0x28d851[_0x4aba('0x2c')]['fields']));_0x297e86[_0x4aba('0x30')]=_0x297e86[_0x4aba('0x30')][_0x4aba('0x40')]?_0x297e86[_0x4aba('0x30')]:_0x3e0921[_0x4aba('0x2a')];_0x297e86[_0x4aba('0x34')]=qs[_0x4aba('0x35')](_0x28d851[_0x4aba('0x2c')][_0x4aba('0x35')]);_0x297e86[_0x4aba('0x36')]=qs['filters'](_[_0x4aba('0x37')](_0x28d851['query'],_0x3e0921[_0x4aba('0x2e')]));if(_0x28d851['query'][_0x4aba('0x38')]){_0x297e86[_0x4aba('0x36')]=_[_0x4aba('0x39')](_0x297e86['where'],{'$or':_[_0x4aba('0x2b')](_0x297e86[_0x4aba('0x30')],function(_0x1c0504){var _0x188bd5={};_0x188bd5[_0x1c0504]={'$like':'%'+_0x28d851[_0x4aba('0x2c')][_0x4aba('0x38')]+'%'};return _0x188bd5;})});}_0x297e86=_[_0x4aba('0x39')]({},_0x297e86,_0x28d851[_0x4aba('0x3b')]);return _0x8bb9f6[_0x4aba('0x47')](_0x297e86);}})[_0x4aba('0x1e')](function(_0x441deb){if(_0x441deb){_0x2b36f4=_0x441deb[_0x4aba('0x40')];if(!_0x28d851[_0x4aba('0x2c')][_0x4aba('0x32')](_0x4aba('0x33'))){_0x297e86['limit']=qs[_0x4aba('0x19')](_0x28d851[_0x4aba('0x2c')][_0x4aba('0x19')]);_0x297e86[_0x4aba('0x17')]=qs[_0x4aba('0x17')](_0x28d851[_0x4aba('0x2c')][_0x4aba('0x17')]);}return _0x8bb9f6['getFields'](_0x297e86);}})['then'](function(_0x241d53){if(_0x241d53){return _0x241d53?{'count':_0x2b36f4,'rows':_0x241d53}:null;}})[_0x4aba('0x1e')](respondWithResult(_0x1c37d9,null))[_0x4aba('0x46')](handleError(_0x1c37d9,null));};exports[_0x4aba('0x4a')]=function(_0x52fa7b,_0x1a306c,_0xcaa8a){var _0x2218d1={};var _0x3c4e72={};var _0x26a8fb;var _0x6d9775;return db['DeskConfiguration'][_0x4aba('0x48')]({'where':{'id':_0x52fa7b[_0x4aba('0x45')]['id']}})[_0x4aba('0x1e')](handleEntityNotFound(_0x1a306c,null))[_0x4aba('0x1e')](function(_0x2f3ea9){if(_0x2f3ea9){_0x26a8fb=_0x2f3ea9;_0x3c4e72[_0x4aba('0x2a')]=_[_0x4aba('0x2d')](db['DeskField']['rawAttributes']);_0x3c4e72[_0x4aba('0x2c')]=_[_0x4aba('0x2d')](_0x52fa7b[_0x4aba('0x2c')]);_0x3c4e72['filters']=_[_0x4aba('0x2f')](_0x3c4e72[_0x4aba('0x2a')],_0x3c4e72[_0x4aba('0x2c')]);_0x2218d1[_0x4aba('0x30')]=_[_0x4aba('0x2f')](_0x3c4e72[_0x4aba('0x2a')],qs['fields'](_0x52fa7b['query'][_0x4aba('0x31')]));_0x2218d1[_0x4aba('0x30')]=_0x2218d1['attributes'][_0x4aba('0x40')]?_0x2218d1[_0x4aba('0x30')]:_0x3c4e72[_0x4aba('0x2a')];_0x2218d1[_0x4aba('0x34')]=qs[_0x4aba('0x35')](_0x52fa7b[_0x4aba('0x2c')]['sort']);_0x2218d1[_0x4aba('0x36')]=qs['filters'](_[_0x4aba('0x37')](_0x52fa7b[_0x4aba('0x2c')],_0x3c4e72[_0x4aba('0x2e')]));if(_0x52fa7b[_0x4aba('0x2c')]['filter']){_0x2218d1['where']=_[_0x4aba('0x39')](_0x2218d1[_0x4aba('0x36')],{'$or':_['map'](_0x2218d1[_0x4aba('0x30')],function(_0x1ee4eb){var _0x2cb485={};_0x2cb485[_0x1ee4eb]={'$like':'%'+_0x52fa7b['query'][_0x4aba('0x38')]+'%'};return _0x2cb485;})});}_0x2218d1=_[_0x4aba('0x39')]({},_0x2218d1,_0x52fa7b['options']);return _0x26a8fb[_0x4aba('0x4a')](_0x2218d1);}})[_0x4aba('0x1e')](function(_0x104ee8){if(_0x104ee8){_0x6d9775=_0x104ee8['length'];if(!_0x52fa7b[_0x4aba('0x2c')][_0x4aba('0x32')](_0x4aba('0x33'))){_0x2218d1[_0x4aba('0x19')]=qs[_0x4aba('0x19')](_0x52fa7b[_0x4aba('0x2c')][_0x4aba('0x19')]);_0x2218d1['offset']=qs[_0x4aba('0x17')](_0x52fa7b[_0x4aba('0x2c')][_0x4aba('0x17')]);}return _0x26a8fb[_0x4aba('0x4a')](_0x2218d1);}})[_0x4aba('0x1e')](function(_0x4c9453){if(_0x4c9453){return _0x4c9453?{'count':_0x6d9775,'rows':_0x4c9453}:null;}})[_0x4aba('0x1e')](respondWithResult(_0x1a306c,null))['catch'](handleError(_0x1a306c,null));};exports[_0x4aba('0x4b')]=function(_0x3103f0,_0x5f52f9,_0x1bf6d6){var _0x2ee611={};var _0x3e0022={};var _0x1bd70e;var _0x4840b6;return db[_0x4aba('0x25')][_0x4aba('0x48')]({'where':{'id':_0x3103f0['params']['id']}})['then'](handleEntityNotFound(_0x5f52f9,null))[_0x4aba('0x1e')](function(_0x1e489){if(_0x1e489){_0x1bd70e=_0x1e489;_0x3e0022[_0x4aba('0x2a')]=_['keys'](db['DeskField'][_0x4aba('0x26')]);_0x3e0022[_0x4aba('0x2c')]=_['keys'](_0x3103f0['query']);_0x3e0022[_0x4aba('0x2e')]=_[_0x4aba('0x2f')](_0x3e0022[_0x4aba('0x2a')],_0x3e0022[_0x4aba('0x2c')]);_0x2ee611[_0x4aba('0x30')]=_[_0x4aba('0x2f')](_0x3e0022['model'],qs[_0x4aba('0x31')](_0x3103f0[_0x4aba('0x2c')][_0x4aba('0x31')]));_0x2ee611['attributes']=_0x2ee611[_0x4aba('0x30')][_0x4aba('0x40')]?_0x2ee611['attributes']:_0x3e0022['model'];_0x2ee611[_0x4aba('0x34')]=qs[_0x4aba('0x35')](_0x3103f0[_0x4aba('0x2c')]['sort']);_0x2ee611[_0x4aba('0x36')]=qs[_0x4aba('0x2e')](_['pick'](_0x3103f0[_0x4aba('0x2c')],_0x3e0022[_0x4aba('0x2e')]));if(_0x3103f0['query'][_0x4aba('0x38')]){_0x2ee611[_0x4aba('0x36')]=_[_0x4aba('0x39')](_0x2ee611['where'],{'$or':_[_0x4aba('0x2b')](_0x2ee611['attributes'],function(_0x31e5f4){var _0x3a22ad={};_0x3a22ad[_0x31e5f4]={'$like':'%'+_0x3103f0[_0x4aba('0x2c')][_0x4aba('0x38')]+'%'};return _0x3a22ad;})});}_0x2ee611=_[_0x4aba('0x39')]({},_0x2ee611,_0x3103f0[_0x4aba('0x3b')]);return _0x1bd70e[_0x4aba('0x4b')](_0x2ee611);}})[_0x4aba('0x1e')](function(_0x121d9b){if(_0x121d9b){_0x4840b6=_0x121d9b[_0x4aba('0x40')];if(!_0x3103f0['query'][_0x4aba('0x32')]('nolimit')){_0x2ee611['limit']=qs[_0x4aba('0x19')](_0x3103f0[_0x4aba('0x2c')][_0x4aba('0x19')]);_0x2ee611[_0x4aba('0x17')]=qs[_0x4aba('0x17')](_0x3103f0['query'][_0x4aba('0x17')]);}return _0x1bd70e['getDescriptions'](_0x2ee611);}})[_0x4aba('0x1e')](function(_0x3da9f7){if(_0x3da9f7){return _0x3da9f7?{'count':_0x4840b6,'rows':_0x3da9f7}:null;}})[_0x4aba('0x1e')](respondWithResult(_0x5f52f9,null))[_0x4aba('0x46')](handleError(_0x5f52f9,null));};exports[_0x4aba('0x4c')]=function(_0x337839,_0x525445,_0x3964d8){var _0x2a206c={};var _0x214a52={};var _0x3eb692;var _0x25a129;return db['DeskConfiguration'][_0x4aba('0x48')]({'where':{'id':_0x337839[_0x4aba('0x45')]['id']}})[_0x4aba('0x1e')](handleEntityNotFound(_0x525445,null))['then'](function(_0x3010e0){if(_0x3010e0){_0x3eb692=_0x3010e0;_0x214a52[_0x4aba('0x2a')]=_['keys'](db['Tag'][_0x4aba('0x26')]);_0x214a52[_0x4aba('0x2c')]=_[_0x4aba('0x2d')](_0x337839['query']);_0x214a52[_0x4aba('0x2e')]=_[_0x4aba('0x2f')](_0x214a52[_0x4aba('0x2a')],_0x214a52[_0x4aba('0x2c')]);_0x2a206c[_0x4aba('0x30')]=_[_0x4aba('0x2f')](_0x214a52[_0x4aba('0x2a')],qs[_0x4aba('0x31')](_0x337839[_0x4aba('0x2c')][_0x4aba('0x31')]));_0x2a206c[_0x4aba('0x30')]=_0x2a206c[_0x4aba('0x30')][_0x4aba('0x40')]?_0x2a206c['attributes']:_0x214a52[_0x4aba('0x2a')];_0x2a206c[_0x4aba('0x34')]=qs[_0x4aba('0x35')](_0x337839['query'][_0x4aba('0x35')]);_0x2a206c['where']=qs[_0x4aba('0x2e')](_[_0x4aba('0x37')](_0x337839[_0x4aba('0x2c')],_0x214a52['filters']));if(_0x337839[_0x4aba('0x2c')][_0x4aba('0x38')]){_0x2a206c[_0x4aba('0x36')]=_[_0x4aba('0x39')](_0x2a206c[_0x4aba('0x36')],{'$or':_['map'](_0x2a206c[_0x4aba('0x30')],function(_0x4084df){var _0x38b217={};_0x38b217[_0x4084df]={'$like':'%'+_0x337839[_0x4aba('0x2c')][_0x4aba('0x38')]+'%'};return _0x38b217;})});}_0x2a206c=_['merge']({},_0x2a206c,_0x337839[_0x4aba('0x3b')]);return _0x3eb692[_0x4aba('0x4c')](_0x2a206c);}})['then'](function(_0x29bd8d){if(_0x29bd8d){_0x25a129=_0x29bd8d[_0x4aba('0x40')];if(!_0x337839[_0x4aba('0x2c')][_0x4aba('0x32')]('nolimit')){_0x2a206c[_0x4aba('0x19')]=qs['limit'](_0x337839['query'][_0x4aba('0x19')]);_0x2a206c[_0x4aba('0x17')]=qs[_0x4aba('0x17')](_0x337839[_0x4aba('0x2c')][_0x4aba('0x17')]);}return _0x3eb692[_0x4aba('0x4c')](_0x2a206c);}})[_0x4aba('0x1e')](function(_0x2ca465){if(_0x2ca465){return _0x2ca465?{'count':_0x25a129,'rows':_0x2ca465}:null;}})[_0x4aba('0x1e')](respondWithResult(_0x525445,null))[_0x4aba('0x46')](handleError(_0x525445,null));};exports[_0x4aba('0x4d')]=function(_0x31d2b1,_0x1a35d3,_0x5cac8e){if(_0x31d2b1[_0x4aba('0x42')]['id']){delete _0x31d2b1[_0x4aba('0x42')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x31d2b1[_0x4aba('0x45')]['id']}})[_0x4aba('0x1e')](handleEntityNotFound(_0x1a35d3,null))[_0x4aba('0x1e')](function(_0x3eb4e3){if(_0x3eb4e3){return _0x3eb4e3['setTags'](_0x31d2b1['body'][_0x4aba('0x4e')]||[]);}return null;})['then'](respondWithResult(_0x1a35d3,null))[_0x4aba('0x46')](handleError(_0x1a35d3,null));}; \ No newline at end of file +var _0x0289=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','DeskConfiguration','includeAll','rows','catch','show','include','find','create','body','params','getFields','DeskField','rawAttributes','order','filter','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0x12807b,_0x7c0dfb){var _0x5a676e=function(_0x2cb9d9){while(--_0x2cb9d9){_0x12807b['push'](_0x12807b['shift']());}};_0x5a676e(++_0x7c0dfb);}(_0x0289,0x9a));var _0x9028=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0x0289[_0x421263];return _0x34e4b5;};'use strict';var emlformat=require(_0x9028('0x0'));var rimraf=require(_0x9028('0x1'));var zipdir=require(_0x9028('0x2'));var jsonpatch=require(_0x9028('0x3'));var rp=require(_0x9028('0x4'));var moment=require('moment');var BPromise=require(_0x9028('0x5'));var Mustache=require(_0x9028('0x6'));var util=require('util');var path=require(_0x9028('0x7'));var sox=require(_0x9028('0x8'));var csv=require(_0x9028('0x9'));var ejs=require(_0x9028('0xa'));var fs=require('fs');var fs_extra=require(_0x9028('0xb'));var _=require(_0x9028('0xc'));var squel=require(_0x9028('0xd'));var crypto=require('crypto');var jsforce=require(_0x9028('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9028('0x9'));var querystring=require(_0x9028('0xf'));var Papa=require('papaparse');var Redis=require(_0x9028('0x10'));var authService=require(_0x9028('0x11'));var qs=require(_0x9028('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9028('0x13'));var logger=require('../../config/logger')(_0x9028('0x14'));var utils=require('../../config/utils');var config=require(_0x9028('0x15'));var licenseUtil=require(_0x9028('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dd089,_0x5d4908){_0x5d4908=_0x5d4908||0xcc;return function(_0x15cd0d){if(_0x15cd0d){return _0x5dd089[_0x9028('0x17')](_0x5d4908);}return _0x5dd089[_0x9028('0x18')](_0x5d4908)[_0x9028('0x19')]();};}function respondWithResult(_0x42dbec,_0xa15821){_0xa15821=_0xa15821||0xc8;return function(_0x449750){if(_0x449750){return _0x42dbec[_0x9028('0x18')](_0xa15821)[_0x9028('0x1a')](_0x449750);}};}function respondWithFilteredResult(_0x3f27e0,_0x7210a4){return function(_0x486db7){if(_0x486db7){var _0x34f7df=typeof _0x7210a4[_0x9028('0x1b')]===_0x9028('0x1c')&&typeof _0x7210a4[_0x9028('0x1d')]===_0x9028('0x1c');var _0x377b98=_0x486db7[_0x9028('0x1e')];var _0x510a5b=_0x34f7df?0x0:_0x7210a4['offset'];var _0x4ec5a0=_0x34f7df?_0x486db7[_0x9028('0x1e')]:_0x7210a4[_0x9028('0x1b')]+_0x7210a4['limit'];var _0x22c8ef;if(_0x4ec5a0>=_0x377b98){_0x4ec5a0=_0x377b98;_0x22c8ef=0xc8;}else{_0x22c8ef=0xce;}_0x3f27e0[_0x9028('0x18')](_0x22c8ef);return _0x3f27e0['set'](_0x9028('0x1f'),_0x510a5b+'-'+_0x4ec5a0+'/'+_0x377b98)[_0x9028('0x1a')](_0x486db7);}return null;};}function patchUpdates(_0x4c1f76){return function(_0x114712){try{jsonpatch[_0x9028('0x20')](_0x114712,_0x4c1f76,!![]);}catch(_0x77ad8d){return BPromise['reject'](_0x77ad8d);}return _0x114712[_0x9028('0x21')]();};}function saveUpdates(_0x45f461,_0x5e7f24){return function(_0x4b1df5){if(_0x4b1df5){return _0x4b1df5[_0x9028('0x22')](_0x45f461)['then'](function(_0x45dec3){return _0x45dec3;});}return null;};}function removeEntity(_0x3df4b3,_0x47808b){return function(_0x5713c0){if(_0x5713c0){return _0x5713c0['destroy']()[_0x9028('0x23')](function(){_0x3df4b3[_0x9028('0x18')](0xcc)[_0x9028('0x19')]();});}};}function handleEntityNotFound(_0x291b3a,_0x291ffe){return function(_0x462132){if(!_0x462132){_0x291b3a[_0x9028('0x17')](0x194);}return _0x462132;};}function handleError(_0x5aca24,_0x1d159c){_0x1d159c=_0x1d159c||0x1f4;return function(_0x4eef49){logger['error'](_0x4eef49[_0x9028('0x24')]);if(_0x4eef49[_0x9028('0x25')]){delete _0x4eef49[_0x9028('0x25')];}_0x5aca24[_0x9028('0x18')](_0x1d159c)[_0x9028('0x26')](_0x4eef49);};}exports[_0x9028('0x27')]=function(_0x319706,_0x4de46b){var _0x1ff25b={},_0x179de2={},_0x52aec7={'count':0x0,'rows':[]};var _0x393f60=_[_0x9028('0x28')](db['DeskConfiguration']['rawAttributes'],function(_0x3843d2){return{'name':_0x3843d2[_0x9028('0x29')],'type':_0x3843d2[_0x9028('0x2a')]['key']};});_0x179de2[_0x9028('0x2b')]=_[_0x9028('0x28')](_0x393f60,_0x9028('0x25'));_0x179de2[_0x9028('0x2c')]=_[_0x9028('0x2d')](_0x319706[_0x9028('0x2c')]);_0x179de2['filters']=_[_0x9028('0x2e')](_0x179de2[_0x9028('0x2b')],_0x179de2[_0x9028('0x2c')]);_0x1ff25b[_0x9028('0x2f')]=_['intersection'](_0x179de2['model'],qs['fields'](_0x319706[_0x9028('0x2c')][_0x9028('0x30')]));_0x1ff25b[_0x9028('0x2f')]=_0x1ff25b['attributes'][_0x9028('0x31')]?_0x1ff25b[_0x9028('0x2f')]:_0x179de2['model'];if(!_0x319706[_0x9028('0x2c')]['hasOwnProperty'](_0x9028('0x32'))){_0x1ff25b[_0x9028('0x1d')]=qs[_0x9028('0x1d')](_0x319706[_0x9028('0x2c')][_0x9028('0x1d')]);_0x1ff25b['offset']=qs[_0x9028('0x1b')](_0x319706['query']['offset']);}_0x1ff25b['order']=qs[_0x9028('0x33')](_0x319706[_0x9028('0x2c')]['sort']);_0x1ff25b[_0x9028('0x34')]=qs[_0x9028('0x35')](_[_0x9028('0x36')](_0x319706[_0x9028('0x2c')],_0x179de2[_0x9028('0x35')]),_0x393f60);if(_0x319706[_0x9028('0x2c')]['filter']){_0x1ff25b['where']=_['merge'](_0x1ff25b[_0x9028('0x34')],{'$or':_[_0x9028('0x28')](_0x393f60,function(_0x1f3b5e){if(_0x1f3b5e['type']!==_0x9028('0x37')){var _0x55630c={};_0x55630c[_0x1f3b5e[_0x9028('0x25')]]={'$like':'%'+_0x319706['query']['filter']+'%'};return _0x55630c;}})});}_0x1ff25b=_[_0x9028('0x38')]({},_0x1ff25b,_0x319706[_0x9028('0x39')]);var _0x51ad0b={'where':_0x1ff25b[_0x9028('0x34')]};return db[_0x9028('0x3a')][_0x9028('0x1e')](_0x51ad0b)[_0x9028('0x23')](function(_0x510e27){_0x52aec7[_0x9028('0x1e')]=_0x510e27;if(_0x319706[_0x9028('0x2c')][_0x9028('0x3b')]){_0x1ff25b['include']=[{'all':!![]}];}return db[_0x9028('0x3a')]['findAll'](_0x1ff25b);})[_0x9028('0x23')](function(_0x19ad06){_0x52aec7[_0x9028('0x3c')]=_0x19ad06;return _0x52aec7;})[_0x9028('0x23')](respondWithFilteredResult(_0x4de46b,_0x1ff25b))[_0x9028('0x3d')](handleError(_0x4de46b,null));};exports[_0x9028('0x3e')]=function(_0x101aae,_0x1acaee){var _0x4443ef={'raw':![],'where':{'id':_0x101aae['params']['id']}},_0x29d7b7={};_0x29d7b7[_0x9028('0x2b')]=_['keys'](db[_0x9028('0x3a')]['rawAttributes']);_0x29d7b7[_0x9028('0x2c')]=_[_0x9028('0x2d')](_0x101aae[_0x9028('0x2c')]);_0x29d7b7['filters']=_[_0x9028('0x2e')](_0x29d7b7[_0x9028('0x2b')],_0x29d7b7[_0x9028('0x2c')]);_0x4443ef['attributes']=_['intersection'](_0x29d7b7['model'],qs['fields'](_0x101aae[_0x9028('0x2c')][_0x9028('0x30')]));_0x4443ef[_0x9028('0x2f')]=_0x4443ef[_0x9028('0x2f')]['length']?_0x4443ef[_0x9028('0x2f')]:_0x29d7b7[_0x9028('0x2b')];if(_0x101aae[_0x9028('0x2c')][_0x9028('0x3b')]){_0x4443ef[_0x9028('0x3f')]=[{'all':!![]}];}_0x4443ef=_[_0x9028('0x38')]({},_0x4443ef,_0x101aae[_0x9028('0x39')]);return db['DeskConfiguration'][_0x9028('0x40')](_0x4443ef)[_0x9028('0x23')](handleEntityNotFound(_0x1acaee,null))[_0x9028('0x23')](respondWithResult(_0x1acaee,null))[_0x9028('0x3d')](handleError(_0x1acaee,null));};exports['create']=function(_0x19837a,_0x45dce5){return db['DeskConfiguration'][_0x9028('0x41')](_0x19837a[_0x9028('0x42')],{})[_0x9028('0x23')](respondWithResult(_0x45dce5,0xc9))['catch'](handleError(_0x45dce5,null));};exports[_0x9028('0x22')]=function(_0x5d28b3,_0x1448bc){if(_0x5d28b3[_0x9028('0x42')]['id']){delete _0x5d28b3[_0x9028('0x42')]['id'];}return db[_0x9028('0x3a')][_0x9028('0x40')]({'where':{'id':_0x5d28b3[_0x9028('0x43')]['id']}})['then'](handleEntityNotFound(_0x1448bc,null))[_0x9028('0x23')](saveUpdates(_0x5d28b3[_0x9028('0x42')],null))['then'](respondWithResult(_0x1448bc,null))[_0x9028('0x3d')](handleError(_0x1448bc,null));};exports['destroy']=function(_0x3bd9eb,_0x7adfd7){return db[_0x9028('0x3a')][_0x9028('0x40')]({'where':{'id':_0x3bd9eb[_0x9028('0x43')]['id']}})[_0x9028('0x23')](handleEntityNotFound(_0x7adfd7,null))[_0x9028('0x23')](removeEntity(_0x7adfd7,null))[_0x9028('0x3d')](handleError(_0x7adfd7,null));};exports[_0x9028('0x44')]=function(_0x27b441,_0x4a07c7,_0x277de1){var _0x3c591b={};var _0x2a52b2={};var _0x3957e4;var _0x3d2219;return db[_0x9028('0x3a')]['findOne']({'where':{'id':_0x27b441[_0x9028('0x43')]['id']}})[_0x9028('0x23')](handleEntityNotFound(_0x4a07c7,null))[_0x9028('0x23')](function(_0x158e7a){if(_0x158e7a){_0x3957e4=_0x158e7a;_0x2a52b2[_0x9028('0x2b')]=_[_0x9028('0x2d')](db[_0x9028('0x45')][_0x9028('0x46')]);_0x2a52b2[_0x9028('0x2c')]=_['keys'](_0x27b441[_0x9028('0x2c')]);_0x2a52b2[_0x9028('0x35')]=_['intersection'](_0x2a52b2['model'],_0x2a52b2[_0x9028('0x2c')]);_0x3c591b[_0x9028('0x2f')]=_[_0x9028('0x2e')](_0x2a52b2[_0x9028('0x2b')],qs[_0x9028('0x30')](_0x27b441['query'][_0x9028('0x30')]));_0x3c591b[_0x9028('0x2f')]=_0x3c591b[_0x9028('0x2f')][_0x9028('0x31')]?_0x3c591b[_0x9028('0x2f')]:_0x2a52b2[_0x9028('0x2b')];_0x3c591b[_0x9028('0x47')]=qs[_0x9028('0x33')](_0x27b441['query']['sort']);_0x3c591b[_0x9028('0x34')]=qs[_0x9028('0x35')](_[_0x9028('0x36')](_0x27b441[_0x9028('0x2c')],_0x2a52b2[_0x9028('0x35')]));if(_0x27b441['query'][_0x9028('0x48')]){_0x3c591b[_0x9028('0x34')]=_[_0x9028('0x38')](_0x3c591b[_0x9028('0x34')],{'$or':_[_0x9028('0x28')](_0x3c591b[_0x9028('0x2f')],function(_0x26afcd){var _0x566202={};_0x566202[_0x26afcd]={'$like':'%'+_0x27b441[_0x9028('0x2c')][_0x9028('0x48')]+'%'};return _0x566202;})});}_0x3c591b=_[_0x9028('0x38')]({},_0x3c591b,_0x27b441[_0x9028('0x39')]);return _0x3957e4[_0x9028('0x44')](_0x3c591b);}})['then'](function(_0x3977bc){if(_0x3977bc){_0x3d2219=_0x3977bc[_0x9028('0x31')];if(!_0x27b441[_0x9028('0x2c')][_0x9028('0x49')](_0x9028('0x32'))){_0x3c591b[_0x9028('0x1d')]=qs[_0x9028('0x1d')](_0x27b441[_0x9028('0x2c')][_0x9028('0x1d')]);_0x3c591b['offset']=qs['offset'](_0x27b441[_0x9028('0x2c')][_0x9028('0x1b')]);}return _0x3957e4[_0x9028('0x44')](_0x3c591b);}})[_0x9028('0x23')](function(_0x3dc247){if(_0x3dc247){return _0x3dc247?{'count':_0x3d2219,'rows':_0x3dc247}:null;}})[_0x9028('0x23')](respondWithResult(_0x4a07c7,null))[_0x9028('0x3d')](handleError(_0x4a07c7,null));};exports[_0x9028('0x4a')]=function(_0x2b8ab4,_0x5755a1,_0x17ab5b){var _0x3dee00={};var _0x119436={};var _0x3db9b1;var _0x54342b;return db[_0x9028('0x3a')][_0x9028('0x4b')]({'where':{'id':_0x2b8ab4[_0x9028('0x43')]['id']}})[_0x9028('0x23')](handleEntityNotFound(_0x5755a1,null))[_0x9028('0x23')](function(_0x50b604){if(_0x50b604){_0x3db9b1=_0x50b604;_0x119436['model']=_[_0x9028('0x2d')](db[_0x9028('0x45')]['rawAttributes']);_0x119436[_0x9028('0x2c')]=_[_0x9028('0x2d')](_0x2b8ab4[_0x9028('0x2c')]);_0x119436['filters']=_[_0x9028('0x2e')](_0x119436[_0x9028('0x2b')],_0x119436[_0x9028('0x2c')]);_0x3dee00['attributes']=_[_0x9028('0x2e')](_0x119436[_0x9028('0x2b')],qs['fields'](_0x2b8ab4[_0x9028('0x2c')][_0x9028('0x30')]));_0x3dee00[_0x9028('0x2f')]=_0x3dee00[_0x9028('0x2f')][_0x9028('0x31')]?_0x3dee00['attributes']:_0x119436[_0x9028('0x2b')];_0x3dee00['order']=qs[_0x9028('0x33')](_0x2b8ab4['query']['sort']);_0x3dee00['where']=qs[_0x9028('0x35')](_[_0x9028('0x36')](_0x2b8ab4[_0x9028('0x2c')],_0x119436['filters']));if(_0x2b8ab4[_0x9028('0x2c')]['filter']){_0x3dee00['where']=_['merge'](_0x3dee00[_0x9028('0x34')],{'$or':_[_0x9028('0x28')](_0x3dee00[_0x9028('0x2f')],function(_0x45cdcb){var _0x33ac2b={};_0x33ac2b[_0x45cdcb]={'$like':'%'+_0x2b8ab4[_0x9028('0x2c')]['filter']+'%'};return _0x33ac2b;})});}_0x3dee00=_['merge']({},_0x3dee00,_0x2b8ab4['options']);return _0x3db9b1['getSubjects'](_0x3dee00);}})[_0x9028('0x23')](function(_0x568825){if(_0x568825){_0x54342b=_0x568825['length'];if(!_0x2b8ab4[_0x9028('0x2c')][_0x9028('0x49')](_0x9028('0x32'))){_0x3dee00[_0x9028('0x1d')]=qs[_0x9028('0x1d')](_0x2b8ab4[_0x9028('0x2c')][_0x9028('0x1d')]);_0x3dee00[_0x9028('0x1b')]=qs['offset'](_0x2b8ab4['query'][_0x9028('0x1b')]);}return _0x3db9b1['getSubjects'](_0x3dee00);}})[_0x9028('0x23')](function(_0x8dcc25){if(_0x8dcc25){return _0x8dcc25?{'count':_0x54342b,'rows':_0x8dcc25}:null;}})[_0x9028('0x23')](respondWithResult(_0x5755a1,null))[_0x9028('0x3d')](handleError(_0x5755a1,null));};exports[_0x9028('0x4c')]=function(_0x335749,_0x538365,_0x1c5210){var _0x338cbc={};var _0x29e382={};var _0xe23c94;var _0x3b30c8;return db[_0x9028('0x3a')]['findOne']({'where':{'id':_0x335749[_0x9028('0x43')]['id']}})[_0x9028('0x23')](handleEntityNotFound(_0x538365,null))[_0x9028('0x23')](function(_0x20201a){if(_0x20201a){_0xe23c94=_0x20201a;_0x29e382[_0x9028('0x2b')]=_[_0x9028('0x2d')](db[_0x9028('0x45')]['rawAttributes']);_0x29e382['query']=_[_0x9028('0x2d')](_0x335749[_0x9028('0x2c')]);_0x29e382[_0x9028('0x35')]=_[_0x9028('0x2e')](_0x29e382[_0x9028('0x2b')],_0x29e382['query']);_0x338cbc[_0x9028('0x2f')]=_[_0x9028('0x2e')](_0x29e382['model'],qs[_0x9028('0x30')](_0x335749[_0x9028('0x2c')][_0x9028('0x30')]));_0x338cbc[_0x9028('0x2f')]=_0x338cbc[_0x9028('0x2f')][_0x9028('0x31')]?_0x338cbc[_0x9028('0x2f')]:_0x29e382[_0x9028('0x2b')];_0x338cbc[_0x9028('0x47')]=qs[_0x9028('0x33')](_0x335749[_0x9028('0x2c')][_0x9028('0x33')]);_0x338cbc[_0x9028('0x34')]=qs['filters'](_[_0x9028('0x36')](_0x335749[_0x9028('0x2c')],_0x29e382['filters']));if(_0x335749['query'][_0x9028('0x48')]){_0x338cbc['where']=_[_0x9028('0x38')](_0x338cbc[_0x9028('0x34')],{'$or':_['map'](_0x338cbc[_0x9028('0x2f')],function(_0x5baa8c){var _0x3d120c={};_0x3d120c[_0x5baa8c]={'$like':'%'+_0x335749[_0x9028('0x2c')][_0x9028('0x48')]+'%'};return _0x3d120c;})});}_0x338cbc=_[_0x9028('0x38')]({},_0x338cbc,_0x335749['options']);return _0xe23c94[_0x9028('0x4c')](_0x338cbc);}})[_0x9028('0x23')](function(_0x41169c){if(_0x41169c){_0x3b30c8=_0x41169c['length'];if(!_0x335749[_0x9028('0x2c')]['hasOwnProperty']('nolimit')){_0x338cbc[_0x9028('0x1d')]=qs[_0x9028('0x1d')](_0x335749[_0x9028('0x2c')]['limit']);_0x338cbc[_0x9028('0x1b')]=qs[_0x9028('0x1b')](_0x335749['query'][_0x9028('0x1b')]);}return _0xe23c94[_0x9028('0x4c')](_0x338cbc);}})['then'](function(_0x3d6953){if(_0x3d6953){return _0x3d6953?{'count':_0x3b30c8,'rows':_0x3d6953}:null;}})['then'](respondWithResult(_0x538365,null))[_0x9028('0x3d')](handleError(_0x538365,null));};exports[_0x9028('0x4d')]=function(_0x36950b,_0x278e87,_0x161f84){var _0x2256ce={};var _0x4601e4={};var _0x54fe8a;var _0x1cc626;return db[_0x9028('0x3a')][_0x9028('0x4b')]({'where':{'id':_0x36950b[_0x9028('0x43')]['id']}})[_0x9028('0x23')](handleEntityNotFound(_0x278e87,null))['then'](function(_0x491757){if(_0x491757){_0x54fe8a=_0x491757;_0x4601e4['model']=_[_0x9028('0x2d')](db[_0x9028('0x4e')]['rawAttributes']);_0x4601e4[_0x9028('0x2c')]=_[_0x9028('0x2d')](_0x36950b[_0x9028('0x2c')]);_0x4601e4[_0x9028('0x35')]=_[_0x9028('0x2e')](_0x4601e4[_0x9028('0x2b')],_0x4601e4[_0x9028('0x2c')]);_0x2256ce[_0x9028('0x2f')]=_['intersection'](_0x4601e4[_0x9028('0x2b')],qs['fields'](_0x36950b[_0x9028('0x2c')][_0x9028('0x30')]));_0x2256ce[_0x9028('0x2f')]=_0x2256ce[_0x9028('0x2f')][_0x9028('0x31')]?_0x2256ce[_0x9028('0x2f')]:_0x4601e4[_0x9028('0x2b')];_0x2256ce[_0x9028('0x47')]=qs[_0x9028('0x33')](_0x36950b[_0x9028('0x2c')][_0x9028('0x33')]);_0x2256ce[_0x9028('0x34')]=qs[_0x9028('0x35')](_[_0x9028('0x36')](_0x36950b[_0x9028('0x2c')],_0x4601e4['filters']));if(_0x36950b[_0x9028('0x2c')]['filter']){_0x2256ce[_0x9028('0x34')]=_[_0x9028('0x38')](_0x2256ce[_0x9028('0x34')],{'$or':_[_0x9028('0x28')](_0x2256ce[_0x9028('0x2f')],function(_0x5129f6){var _0x49f57f={};_0x49f57f[_0x5129f6]={'$like':'%'+_0x36950b[_0x9028('0x2c')]['filter']+'%'};return _0x49f57f;})});}_0x2256ce=_[_0x9028('0x38')]({},_0x2256ce,_0x36950b[_0x9028('0x39')]);return _0x54fe8a[_0x9028('0x4d')](_0x2256ce);}})['then'](function(_0x47f917){if(_0x47f917){_0x1cc626=_0x47f917[_0x9028('0x31')];if(!_0x36950b['query']['hasOwnProperty'](_0x9028('0x32'))){_0x2256ce[_0x9028('0x1d')]=qs[_0x9028('0x1d')](_0x36950b[_0x9028('0x2c')][_0x9028('0x1d')]);_0x2256ce['offset']=qs[_0x9028('0x1b')](_0x36950b[_0x9028('0x2c')][_0x9028('0x1b')]);}return _0x54fe8a[_0x9028('0x4d')](_0x2256ce);}})[_0x9028('0x23')](function(_0x5eb67a){if(_0x5eb67a){return _0x5eb67a?{'count':_0x1cc626,'rows':_0x5eb67a}:null;}})[_0x9028('0x23')](respondWithResult(_0x278e87,null))[_0x9028('0x3d')](handleError(_0x278e87,null));};exports[_0x9028('0x4f')]=function(_0x3dfd9f,_0xfd2e1d,_0x527719){if(_0x3dfd9f[_0x9028('0x42')]['id']){delete _0x3dfd9f[_0x9028('0x42')]['id'];}return db[_0x9028('0x3a')]['findOne']({'where':{'id':_0x3dfd9f[_0x9028('0x43')]['id']}})['then'](handleEntityNotFound(_0xfd2e1d,null))[_0x9028('0x23')](function(_0x329a11){if(_0x329a11){return _0x329a11[_0x9028('0x4f')](_0x3dfd9f[_0x9028('0x42')][_0x9028('0x50')]||[]);}return null;})[_0x9028('0x23')](respondWithResult(_0xfd2e1d,null))[_0x9028('0x3d')](handleError(_0xfd2e1d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 9fa5d91..cbbdeb9 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 _0x85d9=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','lodash','util'];(function(_0x57d28b,_0x3cddbd){var _0x43cac1=function(_0xfbcc68){while(--_0xfbcc68){_0x57d28b['push'](_0x57d28b['shift']());}};_0x43cac1(++_0x3cddbd);}(_0x85d9,0x8d));var _0x985d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x85d9[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x985d('0x0'));var util=require(_0x985d('0x1'));var logger=require('../../config/logger')(_0x985d('0x2'));var moment=require('moment');var BPromise=require(_0x985d('0x3'));var rp=require(_0x985d('0x4'));var fs=require('fs');var path=require(_0x985d('0x5'));var rimraf=require(_0x985d('0x6'));var config=require(_0x985d('0x7'));var attributes=require(_0x985d('0x8'));module['exports']=function(_0x4a6dd6,_0x5a3bbe){return _0x4a6dd6[_0x985d('0x9')](_0x985d('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f44=['request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x55e8f9,_0x40da22){var _0x4c2d41=function(_0x528e20){while(--_0x528e20){_0x55e8f9['push'](_0x55e8f9['shift']());}};_0x4c2d41(++_0x40da22);}(_0x9f44,0x113));var _0x49f4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9f44[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x49f4('0x0'));var util=require('util');var logger=require(_0x49f4('0x1'))(_0x49f4('0x2'));var moment=require(_0x49f4('0x3'));var BPromise=require(_0x49f4('0x4'));var rp=require(_0x49f4('0x5'));var fs=require('fs');var path=require(_0x49f4('0x6'));var rimraf=require(_0x49f4('0x7'));var config=require(_0x49f4('0x8'));var attributes=require(_0x49f4('0x9'));module[_0x49f4('0xa')]=function(_0x1187be,_0x9ee846){return _0x1187be[_0x49f4('0xb')](_0x49f4('0xc'),attributes,{'tableName':_0x49f4('0xd'),'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 b8f0f21..b87d68d 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 _0x0120=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x120612,_0x363085){var _0x309a2a=function(_0x308091){while(--_0x308091){_0x120612['push'](_0x120612['shift']());}};_0x309a2a(++_0x363085);}(_0x0120,0x6f));var _0x0012=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x0120[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59980a,_0x95d441,_0x436af8){return new BPromise(function(_0x3d4c64,_0x30176d){return client[_0x0012('0xc')](_0x59980a,_0x436af8)['then'](function(_0x14991f){logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));logger['debug'](_0x0012('0x10'),_0x95d441,'request\x20sent',JSON[_0x0012('0x11')](_0x14991f));if(_0x14991f[_0x0012('0x12')]){if(_0x14991f[_0x0012('0x12')][_0x0012('0x13')]===0x1f4){logger[_0x0012('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x95d441,_0x14991f[_0x0012('0x12')]['message']);return _0x30176d(_0x14991f['error']['message']);}logger['error'](_0x0012('0xe'),_0x95d441,_0x14991f['error'][_0x0012('0x14')]);return _0x3d4c64(_0x14991f[_0x0012('0x12')]['message']);}else{logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));_0x3d4c64(_0x14991f[_0x0012('0x15')]['message']);}})['catch'](function(_0x1e7fbe){logger[_0x0012('0x12')](_0x0012('0xe'),_0x95d441,_0x1e7fbe);_0x30176d(_0x1e7fbe);});});} \ No newline at end of file +var _0x1d21=['../../config/environment','jayson/promise','client','http','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x30bef2,_0x3d4186){var _0x567d67=function(_0x1acf17){while(--_0x1acf17){_0x30bef2['push'](_0x30bef2['shift']());}};_0x567d67(++_0x3d4186);}(_0x1d21,0x158));var _0x11d2=function(_0x25f797,_0x449916){_0x25f797=_0x25f797-0x0;var _0x157fdd=_0x1d21[_0x25f797];return _0x157fdd;};'use strict';var _=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var moment=require(_0x11d2('0x2'));var BPromise=require(_0x11d2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11d2('0x4'));var db=require(_0x11d2('0x5'))['db'];var utils=require(_0x11d2('0x6'));var logger=require(_0x11d2('0x7'))('rpc');var config=require(_0x11d2('0x8'));var jayson=require(_0x11d2('0x9'));var client=jayson[_0x11d2('0xa')][_0x11d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1eb6ca,_0x185dc4,_0x3a3713){return new BPromise(function(_0x4d8792,_0xd6d34c){return client[_0x11d2('0xc')](_0x1eb6ca,_0x3a3713)['then'](function(_0x3109ab){logger['info'](_0x11d2('0xd'),_0x185dc4,_0x11d2('0xe'));logger['debug'](_0x11d2('0xf'),_0x185dc4,_0x11d2('0xe'),JSON[_0x11d2('0x10')](_0x3109ab));if(_0x3109ab[_0x11d2('0x11')]){if(_0x3109ab['error']['code']===0x1f4){logger[_0x11d2('0x11')](_0x11d2('0xd'),_0x185dc4,_0x3109ab[_0x11d2('0x11')]['message']);return _0xd6d34c(_0x3109ab[_0x11d2('0x11')][_0x11d2('0x12')]);}logger[_0x11d2('0x11')](_0x11d2('0xd'),_0x185dc4,_0x3109ab['error'][_0x11d2('0x12')]);return _0x4d8792(_0x3109ab[_0x11d2('0x11')]['message']);}else{logger[_0x11d2('0x13')](_0x11d2('0xd'),_0x185dc4,_0x11d2('0xe'));_0x4d8792(_0x3109ab[_0x11d2('0x14')][_0x11d2('0x12')]);}})[_0x11d2('0x15')](function(_0x3e75f4){logger[_0x11d2('0x11')](_0x11d2('0xd'),_0x185dc4,_0x3e75f4);_0xd6d34c(_0x3e75f4);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 35a81d7..8e7e828 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 _0x3a29=['index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0x3a29,0x199));var _0x93a2=function(_0x376f12,_0x5ee53e){_0x376f12=_0x376f12-0x0;var _0x24549e=_0x3a29[_0x376f12];return _0x24549e;};'use strict';var multer=require(_0x93a2('0x0'));var util=require(_0x93a2('0x1'));var path=require(_0x93a2('0x2'));var timeout=require(_0x93a2('0x3'));var express=require('express');var router=express[_0x93a2('0x4')]();var fs_extra=require(_0x93a2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x93a2('0x6'));var config=require(_0x93a2('0x7'));var controller=require(_0x93a2('0x8'));router[_0x93a2('0x9')]('/',auth[_0x93a2('0xa')](),controller[_0x93a2('0xb')]);router[_0x93a2('0x9')](_0x93a2('0xc'),auth[_0x93a2('0xa')](),controller[_0x93a2('0xd')]);router[_0x93a2('0xe')]('/',auth[_0x93a2('0xa')](),controller[_0x93a2('0xf')]);router[_0x93a2('0x10')](_0x93a2('0xc'),auth[_0x93a2('0xa')](),controller['update']);router[_0x93a2('0x11')](_0x93a2('0xc'),auth['isAuthenticated'](),controller[_0x93a2('0x12')]);module[_0x93a2('0x13')]=router; \ No newline at end of file +var _0x9123=['multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x2f090b,_0x134600){var _0x5df1d8=function(_0x59055f){while(--_0x59055f){_0x2f090b['push'](_0x2f090b['shift']());}};_0x5df1d8(++_0x134600);}(_0x9123,0x140));var _0x3912=function(_0x175602,_0x2300d7){_0x175602=_0x175602-0x0;var _0x4a0c2f=_0x9123[_0x175602];return _0x4a0c2f;};'use strict';var multer=require(_0x3912('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3912('0x1'));var router=express['Router']();var fs_extra=require(_0x3912('0x2'));var auth=require(_0x3912('0x3'));var interaction=require(_0x3912('0x4'));var config=require(_0x3912('0x5'));var controller=require('./intDeskField.controller');router[_0x3912('0x6')]('/',auth[_0x3912('0x7')](),controller['index']);router['get'](_0x3912('0x8'),auth[_0x3912('0x7')](),controller[_0x3912('0x9')]);router['post']('/',auth[_0x3912('0x7')](),controller[_0x3912('0xa')]);router[_0x3912('0xb')](_0x3912('0x8'),auth['isAuthenticated'](),controller[_0x3912('0xc')]);router[_0x3912('0xd')]('/:id',auth[_0x3912('0x7')](),controller[_0x3912('0xe')]);module[_0x3912('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 0b07949..f002282 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 _0xab13=['STRING','string','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x3727a9,_0x1c2edb){var _0xa16806=function(_0x3ac27c){while(--_0x3ac27c){_0x3727a9['push'](_0x3727a9['shift']());}};_0xa16806(++_0x1c2edb);}(_0xab13,0x1c2));var _0x3ab1=function(_0xefd3e6,_0x10d71e){_0xefd3e6=_0xefd3e6-0x0;var _0x52a204=_0xab13[_0xefd3e6];return _0x52a204;};'use strict';var Sequelize=require('sequelize');module[_0x3ab1('0x0')]={'type':{'type':Sequelize[_0x3ab1('0x1')]('string',_0x3ab1('0x2'),_0x3ab1('0x3'),_0x3ab1('0x4'),_0x3ab1('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3ab1('0x6')]},'key':{'type':Sequelize[_0x3ab1('0x6')]},'keyType':{'type':Sequelize[_0x3ab1('0x1')](_0x3ab1('0x7'),'variable',_0x3ab1('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3ab1('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3ab1('0x6')]}}; \ No newline at end of file +var _0x77d4=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports'];(function(_0x3b870e,_0x29b811){var _0x2b4300=function(_0x2ecc42){while(--_0x2ecc42){_0x3b870e['push'](_0x3b870e['shift']());}};_0x2b4300(++_0x29b811);}(_0x77d4,0xa1));var _0x477d=function(_0x541a78,_0x219591){_0x541a78=_0x541a78-0x0;var _0x3107f3=_0x77d4[_0x541a78];return _0x3107f3;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'type':{'type':Sequelize[_0x477d('0x1')](_0x477d('0x2'),_0x477d('0x3'),_0x477d('0x4'),_0x477d('0x5'),_0x477d('0x6')),'defaultValue':_0x477d('0x2')},'content':{'type':Sequelize[_0x477d('0x7')]},'key':{'type':Sequelize[_0x477d('0x7')]},'keyType':{'type':Sequelize[_0x477d('0x1')]('string',_0x477d('0x3'),_0x477d('0x4'))},'keyContent':{'type':Sequelize[_0x477d('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x477d('0x7')]},'customField':{'type':Sequelize[_0x477d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x477d('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 2733c99..2937697 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 _0x1b20=['DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','params','includeAll','merge','find','create','body','rimraf','zip-dir','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/license/util','sendStatus','end','status','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','index','map'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0x1b20,0x66));var _0x01b2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b20[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01b2('0x0'));var zipdir=require(_0x01b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x01b2('0x2'));var BPromise=require(_0x01b2('0x3'));var Mustache=require(_0x01b2('0x4'));var util=require(_0x01b2('0x5'));var path=require(_0x01b2('0x6'));var sox=require(_0x01b2('0x7'));var csv=require(_0x01b2('0x8'));var ejs=require(_0x01b2('0x9'));var fs=require('fs');var fs_extra=require(_0x01b2('0xa'));var _=require(_0x01b2('0xb'));var squel=require(_0x01b2('0xc'));var crypto=require(_0x01b2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x01b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x01b2('0xf'));var Papa=require(_0x01b2('0x10'));var Redis=require(_0x01b2('0x11'));var authService=require(_0x01b2('0x12'));var qs=require(_0x01b2('0x13'));var as=require(_0x01b2('0x14'));var hardwareService=require(_0x01b2('0x15'));var logger=require(_0x01b2('0x16'))('api');var utils=require(_0x01b2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x01b2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41a618,_0x8ac569){_0x8ac569=_0x8ac569||0xcc;return function(_0x2c6d4d){if(_0x2c6d4d){return _0x41a618[_0x01b2('0x19')](_0x8ac569);}return _0x41a618['status'](_0x8ac569)[_0x01b2('0x1a')]();};}function respondWithResult(_0x2e7b31,_0x4f1c15){_0x4f1c15=_0x4f1c15||0xc8;return function(_0x1626ba){if(_0x1626ba){return _0x2e7b31[_0x01b2('0x1b')](_0x4f1c15)['json'](_0x1626ba);}};}function respondWithFilteredResult(_0x299d0c,_0x3d5833){return function(_0x1a9734){if(_0x1a9734){var _0x3f68a8=typeof _0x3d5833['offset']==='undefined'&&typeof _0x3d5833[_0x01b2('0x1c')]===_0x01b2('0x1d');var _0x588dbe=_0x1a9734[_0x01b2('0x1e')];var _0x444236=_0x3f68a8?0x0:_0x3d5833[_0x01b2('0x1f')];var _0x5986f5=_0x3f68a8?_0x1a9734[_0x01b2('0x1e')]:_0x3d5833[_0x01b2('0x1f')]+_0x3d5833[_0x01b2('0x1c')];var _0xd2acbb;if(_0x5986f5>=_0x588dbe){_0x5986f5=_0x588dbe;_0xd2acbb=0xc8;}else{_0xd2acbb=0xce;}_0x299d0c[_0x01b2('0x1b')](_0xd2acbb);return _0x299d0c['set'](_0x01b2('0x20'),_0x444236+'-'+_0x5986f5+'/'+_0x588dbe)['json'](_0x1a9734);}return null;};}function patchUpdates(_0x7464e5){return function(_0x4c0008){try{jsonpatch[_0x01b2('0x21')](_0x4c0008,_0x7464e5,!![]);}catch(_0x266264){return BPromise[_0x01b2('0x22')](_0x266264);}return _0x4c0008['save']();};}function saveUpdates(_0x269b54,_0x2f01b0){return function(_0xc3027){if(_0xc3027){return _0xc3027[_0x01b2('0x23')](_0x269b54)[_0x01b2('0x24')](function(_0x479e94){return _0x479e94;});}return null;};}function removeEntity(_0x1874b9,_0x539db1){return function(_0x54e866){if(_0x54e866){return _0x54e866[_0x01b2('0x25')]()[_0x01b2('0x24')](function(){_0x1874b9[_0x01b2('0x1b')](0xcc)[_0x01b2('0x1a')]();});}};}function handleEntityNotFound(_0x2e32c1,_0x307229){return function(_0x4920f7){if(!_0x4920f7){_0x2e32c1[_0x01b2('0x19')](0x194);}return _0x4920f7;};}function handleError(_0x239543,_0x424cfd){_0x424cfd=_0x424cfd||0x1f4;return function(_0x17274f){logger['error'](_0x17274f[_0x01b2('0x26')]);if(_0x17274f['name']){delete _0x17274f[_0x01b2('0x27')];}_0x239543[_0x01b2('0x1b')](_0x424cfd)['send'](_0x17274f);};}exports[_0x01b2('0x28')]=function(_0x5efdda,_0x487c49){var _0x291d56={},_0x4363ec={},_0x5befbf={'count':0x0,'rows':[]};var _0x24ed7d=_[_0x01b2('0x29')](db[_0x01b2('0x2a')][_0x01b2('0x2b')],function(_0x3009a6){return{'name':_0x3009a6[_0x01b2('0x2c')],'type':_0x3009a6[_0x01b2('0x2d')][_0x01b2('0x2e')]};});_0x4363ec[_0x01b2('0x2f')]=_[_0x01b2('0x29')](_0x24ed7d,_0x01b2('0x27'));_0x4363ec['query']=_[_0x01b2('0x30')](_0x5efdda[_0x01b2('0x31')]);_0x4363ec[_0x01b2('0x32')]=_[_0x01b2('0x33')](_0x4363ec[_0x01b2('0x2f')],_0x4363ec[_0x01b2('0x31')]);_0x291d56['attributes']=_['intersection'](_0x4363ec[_0x01b2('0x2f')],qs['fields'](_0x5efdda['query'][_0x01b2('0x34')]));_0x291d56[_0x01b2('0x35')]=_0x291d56[_0x01b2('0x35')][_0x01b2('0x36')]?_0x291d56['attributes']:_0x4363ec[_0x01b2('0x2f')];if(!_0x5efdda['query'][_0x01b2('0x37')]('nolimit')){_0x291d56['limit']=qs['limit'](_0x5efdda[_0x01b2('0x31')][_0x01b2('0x1c')]);_0x291d56[_0x01b2('0x1f')]=qs[_0x01b2('0x1f')](_0x5efdda['query'][_0x01b2('0x1f')]);}_0x291d56[_0x01b2('0x38')]=qs['sort'](_0x5efdda[_0x01b2('0x31')][_0x01b2('0x39')]);_0x291d56[_0x01b2('0x3a')]=qs[_0x01b2('0x32')](_[_0x01b2('0x3b')](_0x5efdda[_0x01b2('0x31')],_0x4363ec['filters']),_0x24ed7d);if(_0x5efdda[_0x01b2('0x31')][_0x01b2('0x3c')]){_0x291d56['where']=_['merge'](_0x291d56[_0x01b2('0x3a')],{'$or':_[_0x01b2('0x29')](_0x24ed7d,function(_0x4555c8){if(_0x4555c8[_0x01b2('0x2d')]!==_0x01b2('0x3d')){var _0x3b0cc7={};_0x3b0cc7[_0x4555c8['name']]={'$like':'%'+_0x5efdda['query'][_0x01b2('0x3c')]+'%'};return _0x3b0cc7;}})});}_0x291d56=_['merge']({},_0x291d56,_0x5efdda[_0x01b2('0x3e')]);var _0x31878={'where':_0x291d56[_0x01b2('0x3a')]};return db[_0x01b2('0x2a')][_0x01b2('0x1e')](_0x31878)['then'](function(_0x279ce0){_0x5befbf[_0x01b2('0x1e')]=_0x279ce0;if(_0x5efdda[_0x01b2('0x31')]['includeAll']){_0x291d56[_0x01b2('0x3f')]=[{'all':!![]}];}return db[_0x01b2('0x2a')][_0x01b2('0x40')](_0x291d56);})['then'](function(_0x34f646){_0x5befbf['rows']=_0x34f646;return _0x5befbf;})[_0x01b2('0x24')](respondWithFilteredResult(_0x487c49,_0x291d56))[_0x01b2('0x41')](handleError(_0x487c49,null));};exports['show']=function(_0x2b5214,_0x3a36fc){var _0x4da4aa={'raw':!![],'where':{'id':_0x2b5214[_0x01b2('0x42')]['id']}},_0x2df2b6={};_0x2df2b6[_0x01b2('0x2f')]=_[_0x01b2('0x30')](db[_0x01b2('0x2a')]['rawAttributes']);_0x2df2b6[_0x01b2('0x31')]=_[_0x01b2('0x30')](_0x2b5214[_0x01b2('0x31')]);_0x2df2b6['filters']=_[_0x01b2('0x33')](_0x2df2b6[_0x01b2('0x2f')],_0x2df2b6[_0x01b2('0x31')]);_0x4da4aa[_0x01b2('0x35')]=_[_0x01b2('0x33')](_0x2df2b6[_0x01b2('0x2f')],qs[_0x01b2('0x34')](_0x2b5214[_0x01b2('0x31')]['fields']));_0x4da4aa[_0x01b2('0x35')]=_0x4da4aa[_0x01b2('0x35')][_0x01b2('0x36')]?_0x4da4aa[_0x01b2('0x35')]:_0x2df2b6[_0x01b2('0x2f')];if(_0x2b5214[_0x01b2('0x31')][_0x01b2('0x43')]){_0x4da4aa['include']=[{'all':!![]}];}_0x4da4aa=_[_0x01b2('0x44')]({},_0x4da4aa,_0x2b5214[_0x01b2('0x3e')]);return db[_0x01b2('0x2a')][_0x01b2('0x45')](_0x4da4aa)['then'](handleEntityNotFound(_0x3a36fc,null))['then'](respondWithResult(_0x3a36fc,null))[_0x01b2('0x41')](handleError(_0x3a36fc,null));};exports[_0x01b2('0x46')]=function(_0x404a65,_0x49370d){return db[_0x01b2('0x2a')][_0x01b2('0x46')](_0x404a65[_0x01b2('0x47')],{})[_0x01b2('0x24')](respondWithResult(_0x49370d,0xc9))[_0x01b2('0x41')](handleError(_0x49370d,null));};exports[_0x01b2('0x23')]=function(_0x5b54c5,_0x2a8b8d){if(_0x5b54c5['body']['id']){delete _0x5b54c5[_0x01b2('0x47')]['id'];}return db['DeskField']['find']({'where':{'id':_0x5b54c5[_0x01b2('0x42')]['id']}})[_0x01b2('0x24')](handleEntityNotFound(_0x2a8b8d,null))[_0x01b2('0x24')](saveUpdates(_0x5b54c5[_0x01b2('0x47')],null))[_0x01b2('0x24')](respondWithResult(_0x2a8b8d,null))['catch'](handleError(_0x2a8b8d,null));};exports['destroy']=function(_0x387954,_0x115557){return db[_0x01b2('0x2a')][_0x01b2('0x45')]({'where':{'id':_0x387954[_0x01b2('0x42')]['id']}})[_0x01b2('0x24')](handleEntityNotFound(_0x115557,null))['then'](removeEntity(_0x115557,null))[_0x01b2('0x41')](handleError(_0x115557,null));}; \ No newline at end of file +var _0x9aac=['set','save','then','name','send','index','map','DeskField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x9d9343,_0x494c83){var _0x2abcd2=function(_0x101a63){while(--_0x101a63){_0x9d9343['push'](_0x9d9343['shift']());}};_0x2abcd2(++_0x494c83);}(_0x9aac,0x135));var _0xc9aa=function(_0x5f42fc,_0x2f8d08){_0x5f42fc=_0x5f42fc-0x0;var _0x22c2b8=_0x9aac[_0x5f42fc];return _0x22c2b8;};'use strict';var emlformat=require(_0xc9aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc9aa('0x1'));var jsonpatch=require(_0xc9aa('0x2'));var rp=require('request-promise');var moment=require(_0xc9aa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc9aa('0x4'));var util=require('util');var path=require(_0xc9aa('0x5'));var sox=require(_0xc9aa('0x6'));var csv=require('to-csv');var ejs=require(_0xc9aa('0x7'));var fs=require('fs');var fs_extra=require(_0xc9aa('0x8'));var _=require(_0xc9aa('0x9'));var squel=require('squel');var crypto=require(_0xc9aa('0xa'));var jsforce=require(_0xc9aa('0xb'));var deskjs=require(_0xc9aa('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc9aa('0xd'));var Papa=require(_0xc9aa('0xe'));var Redis=require(_0xc9aa('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc9aa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9aa('0x11'))(_0xc9aa('0x12'));var utils=require(_0xc9aa('0x13'));var config=require(_0xc9aa('0x14'));var licenseUtil=require(_0xc9aa('0x15'));var db=require(_0xc9aa('0x16'))['db'];function respondWithStatusCode(_0x21e9c3,_0x2b38da){_0x2b38da=_0x2b38da||0xcc;return function(_0xfc9acd){if(_0xfc9acd){return _0x21e9c3[_0xc9aa('0x17')](_0x2b38da);}return _0x21e9c3[_0xc9aa('0x18')](_0x2b38da)[_0xc9aa('0x19')]();};}function respondWithResult(_0x39331d,_0x406422){_0x406422=_0x406422||0xc8;return function(_0x2b5708){if(_0x2b5708){return _0x39331d[_0xc9aa('0x18')](_0x406422)[_0xc9aa('0x1a')](_0x2b5708);}};}function respondWithFilteredResult(_0x53834b,_0x129cc1){return function(_0x4ed0c1){if(_0x4ed0c1){var _0x5b351f=typeof _0x129cc1[_0xc9aa('0x1b')]===_0xc9aa('0x1c')&&typeof _0x129cc1[_0xc9aa('0x1d')]===_0xc9aa('0x1c');var _0x4b42a4=_0x4ed0c1[_0xc9aa('0x1e')];var _0x28a1a0=_0x5b351f?0x0:_0x129cc1[_0xc9aa('0x1b')];var _0x4bacb3=_0x5b351f?_0x4ed0c1[_0xc9aa('0x1e')]:_0x129cc1[_0xc9aa('0x1b')]+_0x129cc1[_0xc9aa('0x1d')];var _0x22ad7f;if(_0x4bacb3>=_0x4b42a4){_0x4bacb3=_0x4b42a4;_0x22ad7f=0xc8;}else{_0x22ad7f=0xce;}_0x53834b[_0xc9aa('0x18')](_0x22ad7f);return _0x53834b[_0xc9aa('0x1f')]('Content-Range',_0x28a1a0+'-'+_0x4bacb3+'/'+_0x4b42a4)[_0xc9aa('0x1a')](_0x4ed0c1);}return null;};}function patchUpdates(_0x55037f){return function(_0x2c634a){try{jsonpatch['apply'](_0x2c634a,_0x55037f,!![]);}catch(_0x7c837f){return BPromise['reject'](_0x7c837f);}return _0x2c634a[_0xc9aa('0x20')]();};}function saveUpdates(_0x3f8bfd,_0x214c09){return function(_0x465f52){if(_0x465f52){return _0x465f52['update'](_0x3f8bfd)[_0xc9aa('0x21')](function(_0x122d0c){return _0x122d0c;});}return null;};}function removeEntity(_0xbb6dc1,_0x1b4246){return function(_0x3f5347){if(_0x3f5347){return _0x3f5347['destroy']()[_0xc9aa('0x21')](function(){_0xbb6dc1[_0xc9aa('0x18')](0xcc)[_0xc9aa('0x19')]();});}};}function handleEntityNotFound(_0x59dcfe,_0x1f6646){return function(_0x13cb3f){if(!_0x13cb3f){_0x59dcfe[_0xc9aa('0x17')](0x194);}return _0x13cb3f;};}function handleError(_0x4dab46,_0x44108f){_0x44108f=_0x44108f||0x1f4;return function(_0x40e628){logger['error'](_0x40e628['stack']);if(_0x40e628[_0xc9aa('0x22')]){delete _0x40e628[_0xc9aa('0x22')];}_0x4dab46[_0xc9aa('0x18')](_0x44108f)[_0xc9aa('0x23')](_0x40e628);};}exports[_0xc9aa('0x24')]=function(_0x12e908,_0x1251e1){var _0x5865b5={},_0x1d1215={},_0x3446aa={'count':0x0,'rows':[]};var _0x25d3e5=_[_0xc9aa('0x25')](db[_0xc9aa('0x26')][_0xc9aa('0x27')],function(_0x363394){return{'name':_0x363394['fieldName'],'type':_0x363394[_0xc9aa('0x28')][_0xc9aa('0x29')]};});_0x1d1215[_0xc9aa('0x2a')]=_[_0xc9aa('0x25')](_0x25d3e5,_0xc9aa('0x22'));_0x1d1215[_0xc9aa('0x2b')]=_[_0xc9aa('0x2c')](_0x12e908[_0xc9aa('0x2b')]);_0x1d1215[_0xc9aa('0x2d')]=_[_0xc9aa('0x2e')](_0x1d1215[_0xc9aa('0x2a')],_0x1d1215['query']);_0x5865b5['attributes']=_[_0xc9aa('0x2e')](_0x1d1215['model'],qs[_0xc9aa('0x2f')](_0x12e908[_0xc9aa('0x2b')][_0xc9aa('0x2f')]));_0x5865b5['attributes']=_0x5865b5[_0xc9aa('0x30')][_0xc9aa('0x31')]?_0x5865b5['attributes']:_0x1d1215[_0xc9aa('0x2a')];if(!_0x12e908[_0xc9aa('0x2b')]['hasOwnProperty'](_0xc9aa('0x32'))){_0x5865b5[_0xc9aa('0x1d')]=qs[_0xc9aa('0x1d')](_0x12e908[_0xc9aa('0x2b')]['limit']);_0x5865b5[_0xc9aa('0x1b')]=qs[_0xc9aa('0x1b')](_0x12e908['query'][_0xc9aa('0x1b')]);}_0x5865b5[_0xc9aa('0x33')]=qs[_0xc9aa('0x34')](_0x12e908[_0xc9aa('0x2b')][_0xc9aa('0x34')]);_0x5865b5[_0xc9aa('0x35')]=qs['filters'](_['pick'](_0x12e908[_0xc9aa('0x2b')],_0x1d1215[_0xc9aa('0x2d')]),_0x25d3e5);if(_0x12e908[_0xc9aa('0x2b')][_0xc9aa('0x36')]){_0x5865b5[_0xc9aa('0x35')]=_[_0xc9aa('0x37')](_0x5865b5[_0xc9aa('0x35')],{'$or':_['map'](_0x25d3e5,function(_0x3631ef){if(_0x3631ef[_0xc9aa('0x28')]!==_0xc9aa('0x38')){var _0x2c680b={};_0x2c680b[_0x3631ef['name']]={'$like':'%'+_0x12e908['query']['filter']+'%'};return _0x2c680b;}})});}_0x5865b5=_[_0xc9aa('0x37')]({},_0x5865b5,_0x12e908[_0xc9aa('0x39')]);var _0x311a2c={'where':_0x5865b5[_0xc9aa('0x35')]};return db[_0xc9aa('0x26')][_0xc9aa('0x1e')](_0x311a2c)[_0xc9aa('0x21')](function(_0x55bd4f){_0x3446aa[_0xc9aa('0x1e')]=_0x55bd4f;if(_0x12e908[_0xc9aa('0x2b')][_0xc9aa('0x3a')]){_0x5865b5[_0xc9aa('0x3b')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x5865b5);})[_0xc9aa('0x21')](function(_0x5699c3){_0x3446aa[_0xc9aa('0x3c')]=_0x5699c3;return _0x3446aa;})[_0xc9aa('0x21')](respondWithFilteredResult(_0x1251e1,_0x5865b5))[_0xc9aa('0x3d')](handleError(_0x1251e1,null));};exports[_0xc9aa('0x3e')]=function(_0x51c85e,_0x6cf2dd){var _0x59006b={'raw':!![],'where':{'id':_0x51c85e[_0xc9aa('0x3f')]['id']}},_0x2990f0={};_0x2990f0[_0xc9aa('0x2a')]=_[_0xc9aa('0x2c')](db[_0xc9aa('0x26')]['rawAttributes']);_0x2990f0[_0xc9aa('0x2b')]=_['keys'](_0x51c85e[_0xc9aa('0x2b')]);_0x2990f0[_0xc9aa('0x2d')]=_[_0xc9aa('0x2e')](_0x2990f0[_0xc9aa('0x2a')],_0x2990f0[_0xc9aa('0x2b')]);_0x59006b[_0xc9aa('0x30')]=_[_0xc9aa('0x2e')](_0x2990f0['model'],qs['fields'](_0x51c85e[_0xc9aa('0x2b')]['fields']));_0x59006b[_0xc9aa('0x30')]=_0x59006b['attributes'][_0xc9aa('0x31')]?_0x59006b[_0xc9aa('0x30')]:_0x2990f0[_0xc9aa('0x2a')];if(_0x51c85e[_0xc9aa('0x2b')][_0xc9aa('0x3a')]){_0x59006b[_0xc9aa('0x3b')]=[{'all':!![]}];}_0x59006b=_[_0xc9aa('0x37')]({},_0x59006b,_0x51c85e[_0xc9aa('0x39')]);return db[_0xc9aa('0x26')][_0xc9aa('0x40')](_0x59006b)[_0xc9aa('0x21')](handleEntityNotFound(_0x6cf2dd,null))[_0xc9aa('0x21')](respondWithResult(_0x6cf2dd,null))['catch'](handleError(_0x6cf2dd,null));};exports[_0xc9aa('0x41')]=function(_0x16851c,_0x575c7b){return db['DeskField']['create'](_0x16851c['body'],{})['then'](respondWithResult(_0x575c7b,0xc9))['catch'](handleError(_0x575c7b,null));};exports['update']=function(_0x53f5f1,_0x44c5db){if(_0x53f5f1[_0xc9aa('0x42')]['id']){delete _0x53f5f1[_0xc9aa('0x42')]['id'];}return db[_0xc9aa('0x26')][_0xc9aa('0x40')]({'where':{'id':_0x53f5f1[_0xc9aa('0x3f')]['id']}})[_0xc9aa('0x21')](handleEntityNotFound(_0x44c5db,null))[_0xc9aa('0x21')](saveUpdates(_0x53f5f1['body'],null))[_0xc9aa('0x21')](respondWithResult(_0x44c5db,null))[_0xc9aa('0x3d')](handleError(_0x44c5db,null));};exports[_0xc9aa('0x43')]=function(_0x5e99e0,_0x1855d5){return db[_0xc9aa('0x26')][_0xc9aa('0x40')]({'where':{'id':_0x5e99e0[_0xc9aa('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1855d5,null))['then'](removeEntity(_0x1855d5,null))[_0xc9aa('0x3d')](handleError(_0x1855d5,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f10f01e..e701095 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 _0xe866=['path','rimraf','../../config/environment','./intDeskField.attributes','define','int_desk_fields','desk_unique_index','idField','lodash','../../config/logger','moment','bluebird'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xe866,0x1e8));var _0x6e86=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe866[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6e86('0x0'));var util=require('util');var logger=require(_0x6e86('0x1'))('api');var moment=require(_0x6e86('0x2'));var BPromise=require(_0x6e86('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e86('0x4'));var rimraf=require(_0x6e86('0x5'));var config=require(_0x6e86('0x6'));var attributes=require(_0x6e86('0x7'));module['exports']=function(_0x1b1c2e,_0x12e3ee){return _0x1b1c2e[_0x6e86('0x8')]('DeskField',attributes,{'tableName':_0x6e86('0x9'),'paranoid':![],'indexes':[{'name':_0x6e86('0xa'),'fields':[_0x6e86('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2293=['exports','define','desk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x184277,_0x4f0d0e){var _0x37d740=function(_0x3d6c58){while(--_0x3d6c58){_0x184277['push'](_0x184277['shift']());}};_0x37d740(++_0x4f0d0e);}(_0x2293,0xa0));var _0x3229=function(_0x3c62d7,_0x3d65e5){_0x3c62d7=_0x3c62d7-0x0;var _0xde5a0b=_0x2293[_0x3c62d7];return _0xde5a0b;};'use strict';var _=require(_0x3229('0x0'));var util=require(_0x3229('0x1'));var logger=require(_0x3229('0x2'))(_0x3229('0x3'));var moment=require(_0x3229('0x4'));var BPromise=require(_0x3229('0x5'));var rp=require(_0x3229('0x6'));var fs=require('fs');var path=require(_0x3229('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x3229('0x8')]=function(_0x20a724,_0x3f0ddc){return _0x20a724[_0x3229('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x3229('0xa'),'fields':[_0x3229('0xb'),'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 827dee9..0080cd7 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 _0x079b=['randomstring','../../mysqldb','../../config/utils','client','http','request','info','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0xa1b8e,_0x6c59d3){var _0x121982=function(_0x4234e9){while(--_0x4234e9){_0xa1b8e['push'](_0xa1b8e['shift']());}};_0x121982(++_0x6c59d3);}(_0x079b,0xb1));var _0xb079=function(_0x2b92ec,_0x18e0e3){_0x2b92ec=_0x2b92ec-0x0;var _0x12be46=_0x079b[_0x2b92ec];return _0x12be46;};'use strict';var _=require(_0xb079('0x0'));var util=require(_0xb079('0x1'));var moment=require('moment');var BPromise=require(_0xb079('0x2'));var rs=require(_0xb079('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb079('0x4'))['db'];var utils=require(_0xb079('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb079('0x6')][_0xb079('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e127e,_0x3ddd65,_0x9d2caf){return new BPromise(function(_0x5f117d,_0x3e8667){return client[_0xb079('0x8')](_0x4e127e,_0x9d2caf)['then'](function(_0xb256f0){logger[_0xb079('0x9')]('DeskField,\x20%s,\x20%s',_0x3ddd65,'request\x20sent');logger[_0xb079('0xa')](_0xb079('0xb'),_0x3ddd65,_0xb079('0xc'),JSON[_0xb079('0xd')](_0xb256f0));if(_0xb256f0['error']){if(_0xb256f0[_0xb079('0xe')][_0xb079('0xf')]===0x1f4){logger['error'](_0xb079('0x10'),_0x3ddd65,_0xb256f0[_0xb079('0xe')]['message']);return _0x3e8667(_0xb256f0[_0xb079('0xe')][_0xb079('0x11')]);}logger[_0xb079('0xe')](_0xb079('0x10'),_0x3ddd65,_0xb256f0[_0xb079('0xe')]['message']);return _0x5f117d(_0xb256f0[_0xb079('0xe')]['message']);}else{logger['info'](_0xb079('0x10'),_0x3ddd65,_0xb079('0xc'));_0x5f117d(_0xb256f0[_0xb079('0x12')][_0xb079('0x11')]);}})[_0xb079('0x13')](function(_0x22b1fa){logger[_0xb079('0xe')](_0xb079('0x10'),_0x3ddd65,_0x22b1fa);_0x3e8667(_0x22b1fa);});});} \ No newline at end of file +var _0x5764=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x24bbd7,_0x1ac456){var _0x43584d=function(_0x412b7d){while(--_0x412b7d){_0x24bbd7['push'](_0x24bbd7['shift']());}};_0x43584d(++_0x1ac456);}(_0x5764,0x137));var _0x4576=function(_0x3433c2,_0x461727){_0x3433c2=_0x3433c2-0x0;var _0x276947=_0x5764[_0x3433c2];return _0x276947;};'use strict';var _=require(_0x4576('0x0'));var util=require(_0x4576('0x1'));var moment=require('moment');var BPromise=require(_0x4576('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4576('0x3'));var db=require(_0x4576('0x4'))['db'];var utils=require(_0x4576('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4576('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4576('0x7')][_0x4576('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb94f5b,_0x17e955,_0x427fac){return new BPromise(function(_0x513c99,_0x4cba43){return client[_0x4576('0x9')](_0xb94f5b,_0x427fac)[_0x4576('0xa')](function(_0x40940b){logger[_0x4576('0xb')](_0x4576('0xc'),_0x17e955,'request\x20sent');logger[_0x4576('0xd')](_0x4576('0xe'),_0x17e955,_0x4576('0xf'),JSON[_0x4576('0x10')](_0x40940b));if(_0x40940b[_0x4576('0x11')]){if(_0x40940b[_0x4576('0x11')]['code']===0x1f4){logger[_0x4576('0x11')](_0x4576('0xc'),_0x17e955,_0x40940b[_0x4576('0x11')]['message']);return _0x4cba43(_0x40940b[_0x4576('0x11')][_0x4576('0x12')]);}logger[_0x4576('0x11')](_0x4576('0xc'),_0x17e955,_0x40940b[_0x4576('0x11')][_0x4576('0x12')]);return _0x513c99(_0x40940b[_0x4576('0x11')][_0x4576('0x12')]);}else{logger[_0x4576('0xb')](_0x4576('0xc'),_0x17e955,_0x4576('0xf'));_0x513c99(_0x40940b[_0x4576('0x13')][_0x4576('0x12')]);}})[_0x4576('0x14')](function(_0x2e0840){logger[_0x4576('0x11')]('DeskField,\x20%s,\x20%s',_0x17e955,_0x2e0840);_0x4cba43(_0x2e0840);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index aaf928e..d0fd5e2 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 _0x51fc=['../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','create','post','/:id/configurations','addConfiguration','put','delete','exports','multer','path','fs-extra','../../components/auth/service'];(function(_0x33f2ea,_0x2fc54e){var _0x5ade35=function(_0x26c8f8){while(--_0x26c8f8){_0x33f2ea['push'](_0x33f2ea['shift']());}};_0x5ade35(++_0x2fc54e);}(_0x51fc,0x1ea));var _0xc51f=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x51fc[_0x5ee3d3];return _0x4b272f;};'use strict';var multer=require(_0xc51f('0x0'));var util=require('util');var path=require(_0xc51f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc51f('0x2'));var auth=require(_0xc51f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc51f('0x4'));var controller=require(_0xc51f('0x5'));router[_0xc51f('0x6')]('/',auth[_0xc51f('0x7')](),controller['index']);router[_0xc51f('0x6')](_0xc51f('0x8'),auth[_0xc51f('0x7')](),controller[_0xc51f('0x9')]);router['get']('/:id/configurations',auth[_0xc51f('0x7')](),controller[_0xc51f('0xa')]);router[_0xc51f('0x6')](_0xc51f('0xb'),auth[_0xc51f('0x7')](),controller['getFields']);router['post']('/',auth[_0xc51f('0x7')](),controller[_0xc51f('0xc')]);router[_0xc51f('0xd')](_0xc51f('0xe'),auth[_0xc51f('0x7')](),controller[_0xc51f('0xf')]);router[_0xc51f('0x10')](_0xc51f('0x8'),auth[_0xc51f('0x7')](),controller['update']);router[_0xc51f('0x11')]('/:id',auth[_0xc51f('0x7')](),controller['destroy']);module[_0xc51f('0x12')]=router; \ No newline at end of file +var _0x5fe9=['put','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration'];(function(_0x4af0fc,_0x19fb80){var _0x591640=function(_0x4c585e){while(--_0x4c585e){_0x4af0fc['push'](_0x4af0fc['shift']());}};_0x591640(++_0x19fb80);}(_0x5fe9,0x1a8));var _0x95fe=function(_0xfe6fcb,_0x1a534e){_0xfe6fcb=_0xfe6fcb-0x0;var _0x4eba5e=_0x5fe9[_0xfe6fcb];return _0x4eba5e;};'use strict';var multer=require(_0x95fe('0x0'));var util=require('util');var path=require(_0x95fe('0x1'));var timeout=require(_0x95fe('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x95fe('0x3'));var auth=require(_0x95fe('0x4'));var interaction=require(_0x95fe('0x5'));var config=require('../../config/environment');var controller=require(_0x95fe('0x6'));router[_0x95fe('0x7')]('/',auth[_0x95fe('0x8')](),controller[_0x95fe('0x9')]);router['get'](_0x95fe('0xa'),auth['isAuthenticated'](),controller[_0x95fe('0xb')]);router['get'](_0x95fe('0xc'),auth[_0x95fe('0x8')](),controller['getConfigurations']);router[_0x95fe('0x7')](_0x95fe('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x95fe('0xe')]('/',auth[_0x95fe('0x8')](),controller[_0x95fe('0xf')]);router['post']('/:id/configurations',auth[_0x95fe('0x8')](),controller[_0x95fe('0x10')]);router[_0x95fe('0x11')](_0x95fe('0xa'),auth['isAuthenticated'](),controller[_0x95fe('0x12')]);router[_0x95fe('0x13')]('/:id',auth[_0x95fe('0x8')](),controller[_0x95fe('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 27b1a6a..17a3d0f 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 _0xdcf6=['exports','STRING'];(function(_0x4482ab,_0x5ea184){var _0x1ab274=function(_0x271674){while(--_0x271674){_0x4482ab['push'](_0x4482ab['shift']());}};_0x1ab274(++_0x5ea184);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x25a972,_0x5d2fcd){_0x25a972=_0x25a972-0x0;var _0x24ad56=_0xdcf6[_0x25a972];return _0x24ad56;};'use strict';var Sequelize=require('sequelize');module[_0x6dcf('0x0')]={'name':{'type':Sequelize[_0x6dcf('0x1')]},'username':{'type':Sequelize[_0x6dcf('0x1')]},'password':{'type':Sequelize[_0x6dcf('0x1')]},'remoteUri':{'type':Sequelize[_0x6dcf('0x1')]},'tenantId':{'type':Sequelize[_0x6dcf('0x1')]},'clientId':{'type':Sequelize[_0x6dcf('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6dcf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6dcf('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x88d5=['STRING','BOOLEAN','sequelize','exports'];(function(_0x481063,_0x5a7a3c){var _0x5ef52e=function(_0x405861){while(--_0x405861){_0x481063['push'](_0x481063['shift']());}};_0x5ef52e(++_0x5a7a3c);}(_0x88d5,0x76));var _0x588d=function(_0x7ed9e9,_0x35fb5d){_0x7ed9e9=_0x7ed9e9-0x0;var _0x383437=_0x88d5[_0x7ed9e9];return _0x383437;};'use strict';var Sequelize=require(_0x588d('0x0'));module[_0x588d('0x1')]={'name':{'type':Sequelize[_0x588d('0x2')]},'username':{'type':Sequelize[_0x588d('0x2')]},'password':{'type':Sequelize[_0x588d('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x588d('0x2')]},'clientId':{'type':Sequelize[_0x588d('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x588d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x588d('0x2')]},'modernAuthentication':{'type':Sequelize[_0x588d('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 07409fb..fbec308 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 _0x91d1=['send',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','EntityDefinitions(','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','status','json','count','offset','limit','set','update','then','sendStatus','stack','name','map','Dynamics365Account','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','title','description','customerid','subject','phonenumber','regardingobjectid','phonecall_activity_parties','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','MetadataId','lastIndexOf','BooleanAttributeMetadata','forEach','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','all','concat','test','statusCode','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x91d1,0x17a));var _0x191d=function(_0x3be650,_0x3e75f6){_0x3be650=_0x3be650-0x0;var _0x440588=_0x91d1[_0x3be650];return _0x440588;};'use strict';var rp=require('request-promise');var util=require(_0x191d('0x0'));var _=require(_0x191d('0x1'));var qs=require(_0x191d('0x2'));var logger=require(_0x191d('0x3'))('api');var db=require(_0x191d('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x421929,_0x3ebcfa){_0x3ebcfa=_0x3ebcfa||0xc8;return function(_0x5bbe66){if(_0x5bbe66){return _0x421929[_0x191d('0x5')](_0x3ebcfa)[_0x191d('0x6')](_0x5bbe66);}};}function respondWithFilteredResult(_0x5a45db,_0x2111f1){return function(_0x1e8c00){if(_0x1e8c00){var _0x57b0ee=typeof _0x2111f1['offset']==='undefined'&&typeof _0x2111f1['limit']==='undefined';var _0x400e8d=_0x1e8c00[_0x191d('0x7')];var _0x2329ea=_0x57b0ee?0x0:_0x2111f1[_0x191d('0x8')];var _0x16a645=_0x57b0ee?_0x1e8c00['count']:_0x2111f1['offset']+_0x2111f1[_0x191d('0x9')];var _0x428d8c;if(_0x16a645>=_0x400e8d){_0x16a645=_0x400e8d;_0x428d8c=0xc8;}else{_0x428d8c=0xce;}_0x5a45db[_0x191d('0x5')](_0x428d8c);return _0x5a45db[_0x191d('0xa')]('Content-Range',_0x2329ea+'-'+_0x16a645+'/'+_0x400e8d)['json'](_0x1e8c00);}return null;};}function saveUpdates(_0x3acace){return function(_0x410ad2){if(_0x410ad2){return _0x410ad2[_0x191d('0xb')](_0x3acace)[_0x191d('0xc')](function(_0x2ac241){return _0x2ac241;});}return null;};}function removeEntity(_0xe0b844){return function(_0x141d78){if(_0x141d78){return _0x141d78['destroy']()[_0x191d('0xc')](function(){_0xe0b844[_0x191d('0x5')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e836){return function(_0x4dd6cf){if(!_0x4dd6cf){_0x58e836[_0x191d('0xd')](0x194);}return _0x4dd6cf;};}function handleError(_0x457eb3,_0x312b1b){_0x312b1b=_0x312b1b||0x1f4;return function(_0x4eb5b8){logger['error'](_0x4eb5b8[_0x191d('0xe')]);if(_0x4eb5b8[_0x191d('0xf')]){delete _0x4eb5b8[_0x191d('0xf')];}_0x457eb3[_0x191d('0x5')](_0x312b1b)['send'](_0x4eb5b8);};}exports['index']=function(_0x3bbe4a,_0x3b2737){var _0x3fce41={},_0x347351={},_0x21bf53={'count':0x0,'rows':[]};var _0x1ab948=_[_0x191d('0x10')](db[_0x191d('0x11')][_0x191d('0x12')],function(_0x113a5a){return{'name':_0x113a5a[_0x191d('0x13')],'type':_0x113a5a['type'][_0x191d('0x14')]};});_0x347351['model']=_['map'](_0x1ab948,_0x191d('0xf'));_0x347351[_0x191d('0x15')]=_[_0x191d('0x16')](_0x3bbe4a[_0x191d('0x15')]);_0x347351[_0x191d('0x17')]=_[_0x191d('0x18')](_0x347351[_0x191d('0x19')],_0x347351['query']);_0x3fce41[_0x191d('0x1a')]=_[_0x191d('0x18')](_0x347351[_0x191d('0x19')],qs[_0x191d('0x1b')](_0x3bbe4a['query'][_0x191d('0x1b')]));_0x3fce41[_0x191d('0x1a')]=_0x3fce41['attributes'][_0x191d('0x1c')]?_0x3fce41[_0x191d('0x1a')]:_0x347351[_0x191d('0x19')];if(!_0x3bbe4a[_0x191d('0x15')][_0x191d('0x1d')](_0x191d('0x1e'))){_0x3fce41[_0x191d('0x9')]=qs[_0x191d('0x9')](_0x3bbe4a['query']['limit']);_0x3fce41[_0x191d('0x8')]=qs[_0x191d('0x8')](_0x3bbe4a[_0x191d('0x15')]['offset']);}_0x3fce41[_0x191d('0x1f')]=qs[_0x191d('0x20')](_0x3bbe4a[_0x191d('0x15')][_0x191d('0x20')]);_0x3fce41[_0x191d('0x21')]=qs[_0x191d('0x17')](_['pick'](_0x3bbe4a['query'],_0x347351[_0x191d('0x17')]),_0x1ab948);if(_0x3bbe4a[_0x191d('0x15')]['filter']){_0x3fce41[_0x191d('0x21')]=_[_0x191d('0x22')](_0x3fce41[_0x191d('0x21')],{'$or':_['map'](_0x1ab948,function(_0x4a4bfa){if(_0x4a4bfa[_0x191d('0x23')]!=='VIRTUAL'){var _0x32a1bf={};_0x32a1bf[_0x4a4bfa[_0x191d('0xf')]]={'$like':'%'+_0x3bbe4a[_0x191d('0x15')][_0x191d('0x24')]+'%'};return _0x32a1bf;}})});}_0x3fce41=_[_0x191d('0x22')]({},_0x3fce41,_0x3bbe4a[_0x191d('0x25')]);var _0x344d96={'where':_0x3fce41[_0x191d('0x21')]};return db[_0x191d('0x11')][_0x191d('0x7')](_0x344d96)[_0x191d('0xc')](function(_0x1967ab){_0x21bf53[_0x191d('0x7')]=_0x1967ab;if(_0x3bbe4a[_0x191d('0x15')][_0x191d('0x26')]){_0x3fce41[_0x191d('0x27')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x3fce41);})[_0x191d('0xc')](function(_0x446dd7){_0x21bf53[_0x191d('0x28')]=_0x446dd7;return _0x21bf53;})[_0x191d('0xc')](respondWithFilteredResult(_0x3b2737,_0x3fce41))[_0x191d('0x29')](handleError(_0x3b2737,null));};exports[_0x191d('0x2a')]=function(_0x15a2e6,_0x5bf8ca){var _0x2ef95b={'raw':![],'where':{'id':_0x15a2e6[_0x191d('0x2b')]['id']}},_0x58ac59={};_0x58ac59['model']=_[_0x191d('0x16')](db[_0x191d('0x11')][_0x191d('0x12')]);_0x58ac59[_0x191d('0x15')]=_[_0x191d('0x16')](_0x15a2e6[_0x191d('0x15')]);_0x58ac59['filters']=_[_0x191d('0x18')](_0x58ac59[_0x191d('0x19')],_0x58ac59['query']);_0x2ef95b['attributes']=_['intersection'](_0x58ac59[_0x191d('0x19')],qs[_0x191d('0x1b')](_0x15a2e6[_0x191d('0x15')][_0x191d('0x1b')]));_0x2ef95b[_0x191d('0x1a')]=_0x2ef95b[_0x191d('0x1a')][_0x191d('0x1c')]?_0x2ef95b[_0x191d('0x1a')]:_0x58ac59['model'];if(_0x15a2e6[_0x191d('0x15')][_0x191d('0x26')]){_0x2ef95b[_0x191d('0x27')]=[{'all':!![]}];}_0x2ef95b=_[_0x191d('0x22')]({},_0x2ef95b,_0x15a2e6['options']);return db[_0x191d('0x11')][_0x191d('0x2c')](_0x2ef95b)[_0x191d('0xc')](handleEntityNotFound(_0x5bf8ca,null))['then'](respondWithResult(_0x5bf8ca,null))[_0x191d('0x29')](handleError(_0x5bf8ca,null));};exports[_0x191d('0x2d')]=function(_0x137633,_0x40416d){return db[_0x191d('0x11')][_0x191d('0x2d')](_0x137633[_0x191d('0x2e')],{})[_0x191d('0xc')](respondWithResult(_0x40416d,0xc9))[_0x191d('0x29')](handleError(_0x40416d,null));};exports[_0x191d('0xb')]=function(_0x269e55,_0x20159b){if(_0x269e55[_0x191d('0x2e')]['id']){delete _0x269e55[_0x191d('0x2e')]['id'];}return db[_0x191d('0x11')][_0x191d('0x2c')]({'where':{'id':_0x269e55['params']['id']}})['then'](handleEntityNotFound(_0x20159b,null))[_0x191d('0xc')](saveUpdates(_0x269e55['body'],null))[_0x191d('0xc')](respondWithResult(_0x20159b,null))[_0x191d('0x29')](handleError(_0x20159b,null));};exports[_0x191d('0x2f')]=function(_0x252545,_0x2e1ceb){return db[_0x191d('0x11')][_0x191d('0x2c')]({'where':{'id':_0x252545['params']['id']}})[_0x191d('0xc')](handleEntityNotFound(_0x2e1ceb,null))['then'](removeEntity(_0x2e1ceb,null))[_0x191d('0x29')](handleError(_0x2e1ceb,null));};exports[_0x191d('0x30')]=function(_0x5e4248,_0x42cfe2){var _0x500081={};var _0x312f51={};var _0x5608b8;var _0x40b87f;return db[_0x191d('0x11')][_0x191d('0x31')]({'where':{'id':_0x5e4248['params']['id']}})['then'](handleEntityNotFound(_0x42cfe2,null))['then'](function(_0x10a5f6){if(_0x10a5f6){_0x5608b8=_0x10a5f6;_0x312f51[_0x191d('0x19')]=_['keys'](db[_0x191d('0x32')][_0x191d('0x12')]);_0x312f51['query']=_['keys'](_0x5e4248[_0x191d('0x15')]);_0x312f51['filters']=_[_0x191d('0x18')](_0x312f51['model'],_0x312f51[_0x191d('0x15')]);_0x500081['attributes']=_[_0x191d('0x18')](_0x312f51['model'],qs[_0x191d('0x1b')](_0x5e4248[_0x191d('0x15')][_0x191d('0x1b')]));_0x500081[_0x191d('0x1a')]=_0x500081[_0x191d('0x1a')][_0x191d('0x1c')]?_0x500081[_0x191d('0x1a')]:_0x312f51[_0x191d('0x19')];_0x500081['order']=qs[_0x191d('0x20')](_0x5e4248[_0x191d('0x15')][_0x191d('0x20')]);_0x500081[_0x191d('0x21')]=qs[_0x191d('0x17')](_[_0x191d('0x33')](_0x5e4248[_0x191d('0x15')],_0x312f51[_0x191d('0x17')]));if(_0x5e4248['query'][_0x191d('0x24')]){_0x500081[_0x191d('0x21')]=_[_0x191d('0x22')](_0x500081[_0x191d('0x21')],{'$or':_['map'](_0x500081[_0x191d('0x1a')],function(_0x2696ca){var _0x33ff35={};_0x33ff35[_0x2696ca]={'$like':'%'+_0x5e4248[_0x191d('0x15')]['filter']+'%'};return _0x33ff35;})});}_0x500081=_[_0x191d('0x22')]({},_0x500081,_0x5e4248[_0x191d('0x25')]);return _0x5608b8[_0x191d('0x30')](_0x500081);}})[_0x191d('0xc')](function(_0x13aa01){if(_0x13aa01){_0x40b87f=_0x13aa01[_0x191d('0x1c')];if(!_0x5e4248[_0x191d('0x15')][_0x191d('0x1d')](_0x191d('0x1e'))){_0x500081[_0x191d('0x9')]=qs[_0x191d('0x9')](_0x5e4248[_0x191d('0x15')][_0x191d('0x9')]);_0x500081[_0x191d('0x8')]=qs[_0x191d('0x8')](_0x5e4248['query'][_0x191d('0x8')]);}return _0x5608b8['getConfigurations'](_0x500081);}})[_0x191d('0xc')](function(_0x575080){if(_0x575080){return _0x575080?{'count':_0x40b87f,'rows':_0x575080}:null;}})[_0x191d('0xc')](respondWithResult(_0x42cfe2,null))[_0x191d('0x29')](handleError(_0x42cfe2,null));};exports[_0x191d('0x34')]=function(_0x1bdc6d,_0xa12e25){if(_0x1bdc6d[_0x191d('0x2e')]['id']){delete _0x1bdc6d['body']['id'];}return db[_0x191d('0x11')][_0x191d('0x31')]({'where':{'id':_0x1bdc6d[_0x191d('0x2b')]['id']}})[_0x191d('0xc')](handleEntityNotFound(_0xa12e25,null))[_0x191d('0xc')](function(_0x534e93){if(_0x534e93){_0x1bdc6d[_0x191d('0x2e')]['AccountId']=_0x534e93['id'];_0x1bdc6d[_0x191d('0x2e')][_0x191d('0x35')]=integrations[_0x191d('0x36')](_0x1bdc6d[_0x191d('0x2e')][_0x191d('0x37')],_0x1bdc6d['body']['type']);_0x1bdc6d[_0x191d('0x2e')][_0x191d('0x38')]=integrations[_0x191d('0x39')](_0x1bdc6d[_0x191d('0x2e')]['channel'],_0x1bdc6d[_0x191d('0x2e')]['type']);return db[_0x191d('0x32')][_0x191d('0x2d')](_0x1bdc6d[_0x191d('0x2e')],{'include':[{'model':db[_0x191d('0x3a')],'as':_0x191d('0x35')},{'model':db[_0x191d('0x3a')],'as':_0x191d('0x38')}]});}return null;})[_0x191d('0xc')](respondWithResult(_0xa12e25,null))['catch'](handleError(_0xa12e25,null));};function sanitizeRemoteUri(_0x4d9f73){var _0x54df18=_0x4d9f73[_0x191d('0x3b')](-0x1);if(_0x54df18==='/')return _0x4d9f73[_0x191d('0x3c')](0x0,_0x4d9f73['lastIndexOf'](_0x54df18));return _0x4d9f73;}function getWebApiUrl(_0x11ce63){return util[_0x191d('0x3d')](_0x191d('0x3e'),_0x11ce63);}exports[_0x191d('0x3f')]=function(_0x5a884f,_0x1e2d7f){var _0x46a1b9=_0x5a884f[_0x191d('0x15')][_0x191d('0x40')];var _0x286309=_0x46a1b9===_0x191d('0x41')?_0x191d('0x42'):'PhoneCall';var _0x162551='';var _0x7d13ac='';var _0x42e700='';var _0x22aec9='';var _0x4d7837='';var _0xc39009='';var _0x3bddf9='';var _0x179df4='';var _0x20edbd=[_0x191d('0x43'),_0x191d('0x44'),_0x191d('0x45'),'ownerid','caseorigincode',_0x191d('0x46'),_0x191d('0x47'),_0x191d('0x48'),'directioncode',_0x191d('0x49')];var _0x549b06=['accountidname','accountidyominame',_0x191d('0x4a'),_0x191d('0x4b'),_0x191d('0x4c'),'contactidyominame',_0x191d('0x4d'),_0x191d('0x4e'),_0x191d('0x4f'),_0x191d('0x50'),'createdbyname','createdbyyominame','createdon',_0x191d('0x51'),_0x191d('0x52'),_0x191d('0x53'),'customeridtype',_0x191d('0x54'),'emailaddress','entitlementidname',_0x191d('0x55'),_0x191d('0x56'),_0x191d('0x57'),_0x191d('0x58'),_0x191d('0x59'),_0x191d('0x5a'),_0x191d('0x5b'),_0x191d('0x5c'),_0x191d('0x5d'),_0x191d('0x5e'),'masteridname',_0x191d('0x5f'),_0x191d('0x60'),_0x191d('0x61'),'modifiedbyyominame',_0x191d('0x62'),_0x191d('0x63'),_0x191d('0x64'),'msdyn_incidenttypename',_0x191d('0x65'),_0x191d('0x66'),'onholdtime',_0x191d('0x67'),_0x191d('0x68'),_0x191d('0x69'),_0x191d('0x6a'),_0x191d('0x6b'),'primarycontactidname','primarycontactidyominame',_0x191d('0x6c'),_0x191d('0x6d'),_0x191d('0x6e'),_0x191d('0x6f'),_0x191d('0x70'),'responseby',_0x191d('0x71'),'responsiblecontactidyominame',_0x191d('0x72'),'slainvokedidname',_0x191d('0x73'),_0x191d('0x74'),_0x191d('0x75'),_0x191d('0x76'),_0x191d('0x77'),_0x191d('0x78'),_0x191d('0x79'),_0x191d('0x7a'),_0x191d('0x7b'),_0x191d('0x7c'),_0x191d('0x7d')];var _0x2da8c7=_0x20edbd['concat'](_0x549b06);return db[_0x191d('0x11')][_0x191d('0x31')]({'where':{'id':_0x5a884f[_0x191d('0x2b')]['id']},'attributes':['id',_0x191d('0x7e'),_0x191d('0x7f'),_0x191d('0x80'),_0x191d('0x81'),_0x191d('0x82'),_0x191d('0x83'),_0x191d('0x84')],'include':[{'model':db[_0x191d('0x85')],'as':_0x191d('0x85'),'attributes':['id',_0x191d('0x86'),_0x191d('0x87')]}]})[_0x191d('0xc')](handleEntityNotFound(_0x1e2d7f,null))['then'](function(_0x138503){if(_0x138503){if(_0x138503[_0x191d('0x84')]){_0x138503[_0x191d('0x88')]=_0x138503[_0x191d('0x85')][_0x191d('0x86')];_0x179df4=sanitizeRemoteUri(_0x138503[_0x191d('0x85')][_0x191d('0x87')]);_0x3bddf9=getWebApiUrl(_0x179df4);return _0x138503;}_0x179df4=sanitizeRemoteUri(_0x138503[_0x191d('0x80')]);_0x3bddf9=getWebApiUrl(_0x179df4);var _0x53a684={'method':_0x191d('0x89'),'uri':'https://login.microsoftonline.com/'+_0x138503['tenantId']+_0x191d('0x8a'),'form':{'client_id':_0x138503['clientId'],'resource':_0x179df4,'username':_0x138503[_0x191d('0x7e')],'password':_0x138503[_0x191d('0x7f')],'grant_type':_0x191d('0x7f'),'client_secret':_0x138503[_0x191d('0x83')]},'json':!![]};return rp(_0x53a684);}})[_0x191d('0xc')](function(_0xe811ee){_0xc39009=_0xe811ee[_0x191d('0x88')];var _0x44b9b8={'method':_0x191d('0x8b'),'uri':encodeURI(_0x3bddf9+_0x191d('0x8c')+_0x286309+'\x27'),'headers':{'Authorization':_0x191d('0x8d')+_0xc39009,'If-None-Match':null,'OData-Version':_0x191d('0x8e')},'json':!![]};return rp(_0x44b9b8);})[_0x191d('0xc')](function(_0x660d2c){var _0x115a44=_0x660d2c['value'][0x0];var _0x4a75eb=_0x115a44['MetadataId'];var _0x3adbcb={'method':_0x191d('0x8b'),'uri':_0x3bddf9+'EntityDefinitions('+_0x4a75eb+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0xc39009,'If-None-Match':null,'OData-Version':_0x191d('0x8e')},'json':!![]};return rp(_0x3adbcb);})[_0x191d('0xc')](function(_0x29c254){_0x162551=_0x29c254;_0x7d13ac=_0x162551[_0x191d('0x8f')];_0x7d13ac=_[_0x191d('0x90')](_0x7d13ac,function(_0x230c9c){return!_0x2da8c7[_0x191d('0x91')](_0x230c9c[_0x191d('0x92')]);});var _0x80be18=[];var _0x183833=[];_0x7d13ac['forEach'](function(_0x348f85){if(_0x348f85[_0x191d('0x93')]){var _0x5b131f=_0x348f85[_0x191d('0x93')][_0x191d('0x3c')](_0x348f85[_0x191d('0x93')]['lastIndexOf']('.')+0x1);if(_0x5b131f===_0x191d('0x94')){_0x80be18[_0x191d('0x95')](getSelectList(_0x3bddf9,_0x46a1b9,_0x183833,_0x162551[_0x191d('0x96')],_0x348f85['MetadataId'],_0xc39009));}}});return Promise['all'](_0x80be18);})[_0x191d('0xc')](function(_0x475ad6){_0x42e700=_0x475ad6[0x0];var _0x5a1111=[];var _0x38f2a5=[];_0x7d13ac['forEach'](function(_0x5ba723){if(!_['isNil'](_0x5ba723[_0x191d('0x93')])){var _0x17bfcf=_0x5ba723[_0x191d('0x93')][_0x191d('0x3c')](_0x5ba723[_0x191d('0x93')][_0x191d('0x97')]('.')+0x1);if(_0x17bfcf===_0x191d('0x98')){_0x5a1111['push'](getBooleanList(_0x3bddf9,_0x46a1b9,_0x38f2a5,_0x162551[_0x191d('0x96')],_0x5ba723['MetadataId'],_0xc39009));}}});return Promise['all'](_0x5a1111);})[_0x191d('0xc')](function(_0x44b6ee){_0x22aec9=_0x44b6ee[0x0];var _0x4007c7=[];var _0x553755=[];_0x7d13ac[_0x191d('0x99')](function(_0x481bfa){if(_0x481bfa[_0x191d('0x93')]){var _0x52a76f=_0x481bfa['@odata.type'][_0x191d('0x3c')](_0x481bfa[_0x191d('0x93')]['lastIndexOf']('.')+0x1);if(_0x52a76f==='StringAttributeMetadata'||_0x52a76f===_0x191d('0x9a')||_0x52a76f===_0x191d('0x9b')||_0x52a76f==='IntegerAttributeMetadata'||_0x52a76f==='MemoAttributeMetadata'||_0x52a76f===_0x191d('0x9c')||_0x52a76f===_0x191d('0x9d')||_0x52a76f===_0x191d('0x9e')||_0x52a76f===_0x191d('0x9f')||_0x52a76f==='DecimalAttributeMetadata'){_0x4007c7[_0x191d('0x95')](getInputList(_0x3bddf9,_0x46a1b9,_0x52a76f,_0x553755,_0x162551[_0x191d('0x96')],_0x481bfa[_0x191d('0x96')],_0xc39009));}}});return Promise[_0x191d('0xa0')](_0x4007c7);})['then'](function(_0x2fc299){_0x4d7837=_0x2fc299[0x0];var _0x3897b9=_0x42e700[_0x191d('0xa1')](_0x22aec9)['concat'](_0x4d7837);var _0x434741={'count':_0x3897b9[_0x191d('0x1c')],'rows':_0x3897b9};return _0x434741;})[_0x191d('0xc')](respondWithResult(_0x1e2d7f,null))[_0x191d('0x29')](function(_0x363fc1){var _0x22196c=_0x5a884f[_0x191d('0x15')][_0x191d('0xa2')]?0x1f4:_0x363fc1[_0x191d('0xa3')]||0x1f4;logger[_0x191d('0xa4')](_0x363fc1[_0x191d('0xe')]);delete _0x363fc1[_0x191d('0xf')];if(_0x22196c===0x191){_0x22196c=0x190;}_0x1e2d7f[_0x191d('0x5')](_0x22196c)[_0x191d('0xa5')](_0x5a884f[_0x191d('0x15')][_0x191d('0xa2')]?{'message':'Wrong\x20credentials','statusCode':_0x363fc1[_0x191d('0xa3')]}:_0x363fc1);});};function getSelectList(_0x36bda0,_0x35b56a,_0x50e142,_0x51c96d,_0x14a17c,_0x476cb4){var _0x5da812={'method':_0x191d('0x8b'),'uri':_0x36bda0+'EntityDefinitions('+_0x51c96d+_0x191d('0xa6')+_0x14a17c+_0x191d('0xa7')+_0x191d('0xa8'),'headers':{'Authorization':'Bearer\x20'+_0x476cb4,'If-None-Match':null,'OData-Version':_0x191d('0x8e')},'json':!![]};return rp(_0x5da812)[_0x191d('0xc')](function(_0x1a32ca){var _0x30018f=[];var _0x1ee3f2=_0x1a32ca[_0x191d('0xa9')][_0x191d('0xaa')];_0x1ee3f2['forEach'](function(_0x1b5b18){_0x30018f[_0x191d('0x95')]({'name':_0x1b5b18[_0x191d('0xab')][_0x191d('0xac')][_0x191d('0xab')],'value':String(_0x1b5b18[_0x191d('0xad')])});});var _0x11553b={'id':_0x35b56a+'_'+_0x1a32ca[_0x191d('0x92')],'name':_0x1a32ca[_0x191d('0xae')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x30018f};_0x50e142[_0x191d('0x95')](_0x11553b);return _0x50e142;});}function getBooleanList(_0x201c16,_0x3289f0,_0x3d9748,_0x3a1b02,_0xb3d94d,_0x5d0128){var _0x33c754={'method':_0x191d('0x8b'),'uri':_0x201c16+_0x191d('0xaf')+_0x3a1b02+_0x191d('0xa6')+_0xb3d94d+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x5d0128,'If-None-Match':null,'OData-Version':_0x191d('0x8e')},'json':!![]};return rp(_0x33c754)[_0x191d('0xc')](function(_0x11534c){var _0x352bf3=[];_0x352bf3['push']({'name':_0x11534c['OptionSet'][_0x191d('0xb0')][_0x191d('0xab')][_0x191d('0xac')][_0x191d('0xab')],'value':_0x191d('0xb1')},{'name':_0x11534c['OptionSet'][_0x191d('0xb2')][_0x191d('0xab')][_0x191d('0xac')][_0x191d('0xab')],'value':'false'});var _0x40ae24={'id':_0x3289f0+'_'+_0x11534c['LogicalName'],'name':_0x11534c[_0x191d('0xae')]['UserLocalizedLabel'][_0x191d('0xab')],'custom':![],'options':_0x352bf3};_0x3d9748[_0x191d('0x95')](_0x40ae24);return _0x3d9748;});}function getInputList(_0x11be47,_0x53612b,_0x4a1442,_0xe06d34,_0x2e3095,_0x29c6de,_0x339465){var _0x22a184={'method':_0x191d('0x8b'),'uri':_0x11be47+_0x191d('0xaf')+_0x2e3095+_0x191d('0xa6')+_0x29c6de+_0x191d('0xb3')+_0x4a1442+_0x191d('0xb4'),'headers':{'Authorization':_0x191d('0x8d')+_0x339465,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x22a184)['then'](function(_0x30c059){var _0x2602ed={'id':_0x53612b+'_'+_0x30c059['LogicalName'],'name':_0x30c059[_0x191d('0xae')]['UserLocalizedLabel']?_0x30c059[_0x191d('0xae')][_0x191d('0xac')][_0x191d('0xab')]:_0x30c059['LogicalName'],'custom':![],'options':[]};_0xe06d34['push'](_0x2602ed);return _0xe06d34;});} \ No newline at end of file +var _0x7e0b=['filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','channel','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','PhoneCall','description','customerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','followupby','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','versionnumber','username','password','remoteUri','clientSecret','modernAuthentication','data7','CloudProvider','data5','POST','tenantId','/oauth2/token','clientId','access_token','GET','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','error','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','stack','name','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x4d7f19,_0x510f6e){var _0x589642=function(_0xa7013e){while(--_0xa7013e){_0x4d7f19['push'](_0x4d7f19['shift']());}};_0x589642(++_0x510f6e);}(_0x7e0b,0x8f));var _0xb7e0=function(_0x4c1339,_0x1e7e1e){_0x4c1339=_0x4c1339-0x0;var _0x5137ca=_0x7e0b[_0x4c1339];return _0x5137ca;};'use strict';var rp=require('request-promise');var util=require(_0xb7e0('0x0'));var _=require(_0xb7e0('0x1'));var qs=require(_0xb7e0('0x2'));var logger=require(_0xb7e0('0x3'))(_0xb7e0('0x4'));var db=require(_0xb7e0('0x5'))['db'];var integrations=require(_0xb7e0('0x6'));function respondWithResult(_0x213ea4,_0x55ea9e){_0x55ea9e=_0x55ea9e||0xc8;return function(_0x1931a3){if(_0x1931a3){return _0x213ea4[_0xb7e0('0x7')](_0x55ea9e)[_0xb7e0('0x8')](_0x1931a3);}};}function respondWithFilteredResult(_0x17c1f0,_0x12e167){return function(_0x2e9746){if(_0x2e9746){var _0x318605=typeof _0x12e167[_0xb7e0('0x9')]===_0xb7e0('0xa')&&typeof _0x12e167[_0xb7e0('0xb')]==='undefined';var _0x1b9f88=_0x2e9746[_0xb7e0('0xc')];var _0x4d5c92=_0x318605?0x0:_0x12e167[_0xb7e0('0x9')];var _0x1e3fdc=_0x318605?_0x2e9746[_0xb7e0('0xc')]:_0x12e167[_0xb7e0('0x9')]+_0x12e167['limit'];var _0xc266a7;if(_0x1e3fdc>=_0x1b9f88){_0x1e3fdc=_0x1b9f88;_0xc266a7=0xc8;}else{_0xc266a7=0xce;}_0x17c1f0['status'](_0xc266a7);return _0x17c1f0[_0xb7e0('0xd')](_0xb7e0('0xe'),_0x4d5c92+'-'+_0x1e3fdc+'/'+_0x1b9f88)[_0xb7e0('0x8')](_0x2e9746);}return null;};}function saveUpdates(_0x46ce9c){return function(_0x53c4c2){if(_0x53c4c2){return _0x53c4c2[_0xb7e0('0xf')](_0x46ce9c)[_0xb7e0('0x10')](function(_0x3133f7){return _0x3133f7;});}return null;};}function removeEntity(_0x3b1c9a){return function(_0x44f9c7){if(_0x44f9c7){return _0x44f9c7['destroy']()[_0xb7e0('0x10')](function(){_0x3b1c9a[_0xb7e0('0x7')](0xcc)[_0xb7e0('0x11')]();});}};}function handleEntityNotFound(_0x124558){return function(_0xd49d75){if(!_0xd49d75){_0x124558['sendStatus'](0x194);}return _0xd49d75;};}function handleError(_0x3b1aa2,_0x1156a){_0x1156a=_0x1156a||0x1f4;return function(_0x4d5f18){logger['error'](_0x4d5f18[_0xb7e0('0x12')]);if(_0x4d5f18[_0xb7e0('0x13')]){delete _0x4d5f18[_0xb7e0('0x13')];}_0x3b1aa2[_0xb7e0('0x7')](_0x1156a)['send'](_0x4d5f18);};}exports[_0xb7e0('0x14')]=function(_0x61354b,_0x1a5247){var _0x95e623={},_0x106e94={},_0xa04419={'count':0x0,'rows':[]};var _0x2a519b=_[_0xb7e0('0x15')](db[_0xb7e0('0x16')][_0xb7e0('0x17')],function(_0x5cd616){return{'name':_0x5cd616['fieldName'],'type':_0x5cd616[_0xb7e0('0x18')][_0xb7e0('0x19')]};});_0x106e94[_0xb7e0('0x1a')]=_[_0xb7e0('0x15')](_0x2a519b,_0xb7e0('0x13'));_0x106e94[_0xb7e0('0x1b')]=_[_0xb7e0('0x1c')](_0x61354b['query']);_0x106e94['filters']=_[_0xb7e0('0x1d')](_0x106e94[_0xb7e0('0x1a')],_0x106e94[_0xb7e0('0x1b')]);_0x95e623[_0xb7e0('0x1e')]=_[_0xb7e0('0x1d')](_0x106e94['model'],qs['fields'](_0x61354b[_0xb7e0('0x1b')]['fields']));_0x95e623[_0xb7e0('0x1e')]=_0x95e623[_0xb7e0('0x1e')][_0xb7e0('0x1f')]?_0x95e623[_0xb7e0('0x1e')]:_0x106e94[_0xb7e0('0x1a')];if(!_0x61354b[_0xb7e0('0x1b')][_0xb7e0('0x20')](_0xb7e0('0x21'))){_0x95e623[_0xb7e0('0xb')]=qs['limit'](_0x61354b['query'][_0xb7e0('0xb')]);_0x95e623[_0xb7e0('0x9')]=qs['offset'](_0x61354b[_0xb7e0('0x1b')]['offset']);}_0x95e623[_0xb7e0('0x22')]=qs[_0xb7e0('0x23')](_0x61354b[_0xb7e0('0x1b')][_0xb7e0('0x23')]);_0x95e623[_0xb7e0('0x24')]=qs[_0xb7e0('0x25')](_[_0xb7e0('0x26')](_0x61354b['query'],_0x106e94[_0xb7e0('0x25')]),_0x2a519b);if(_0x61354b[_0xb7e0('0x1b')][_0xb7e0('0x27')]){_0x95e623[_0xb7e0('0x24')]=_[_0xb7e0('0x28')](_0x95e623[_0xb7e0('0x24')],{'$or':_[_0xb7e0('0x15')](_0x2a519b,function(_0x5ca1c5){if(_0x5ca1c5[_0xb7e0('0x18')]!=='VIRTUAL'){var _0x17a9eb={};_0x17a9eb[_0x5ca1c5[_0xb7e0('0x13')]]={'$like':'%'+_0x61354b[_0xb7e0('0x1b')][_0xb7e0('0x27')]+'%'};return _0x17a9eb;}})});}_0x95e623=_[_0xb7e0('0x28')]({},_0x95e623,_0x61354b[_0xb7e0('0x29')]);var _0x6d4b74={'where':_0x95e623[_0xb7e0('0x24')]};return db[_0xb7e0('0x16')][_0xb7e0('0xc')](_0x6d4b74)[_0xb7e0('0x10')](function(_0x46670b){_0xa04419[_0xb7e0('0xc')]=_0x46670b;if(_0x61354b[_0xb7e0('0x1b')][_0xb7e0('0x2a')]){_0x95e623[_0xb7e0('0x2b')]=[{'all':!![]}];}return db[_0xb7e0('0x16')][_0xb7e0('0x2c')](_0x95e623);})[_0xb7e0('0x10')](function(_0x2f1053){_0xa04419[_0xb7e0('0x2d')]=_0x2f1053;return _0xa04419;})[_0xb7e0('0x10')](respondWithFilteredResult(_0x1a5247,_0x95e623))[_0xb7e0('0x2e')](handleError(_0x1a5247,null));};exports[_0xb7e0('0x2f')]=function(_0x5005f9,_0x1eed7c){var _0x2bf641={'raw':![],'where':{'id':_0x5005f9[_0xb7e0('0x30')]['id']}},_0x48a1ab={};_0x48a1ab[_0xb7e0('0x1a')]=_[_0xb7e0('0x1c')](db[_0xb7e0('0x16')][_0xb7e0('0x17')]);_0x48a1ab[_0xb7e0('0x1b')]=_['keys'](_0x5005f9[_0xb7e0('0x1b')]);_0x48a1ab[_0xb7e0('0x25')]=_['intersection'](_0x48a1ab[_0xb7e0('0x1a')],_0x48a1ab[_0xb7e0('0x1b')]);_0x2bf641['attributes']=_[_0xb7e0('0x1d')](_0x48a1ab[_0xb7e0('0x1a')],qs[_0xb7e0('0x31')](_0x5005f9[_0xb7e0('0x1b')][_0xb7e0('0x31')]));_0x2bf641[_0xb7e0('0x1e')]=_0x2bf641[_0xb7e0('0x1e')][_0xb7e0('0x1f')]?_0x2bf641[_0xb7e0('0x1e')]:_0x48a1ab[_0xb7e0('0x1a')];if(_0x5005f9[_0xb7e0('0x1b')]['includeAll']){_0x2bf641['include']=[{'all':!![]}];}_0x2bf641=_[_0xb7e0('0x28')]({},_0x2bf641,_0x5005f9['options']);return db['Dynamics365Account'][_0xb7e0('0x32')](_0x2bf641)[_0xb7e0('0x10')](handleEntityNotFound(_0x1eed7c,null))[_0xb7e0('0x10')](respondWithResult(_0x1eed7c,null))[_0xb7e0('0x2e')](handleError(_0x1eed7c,null));};exports[_0xb7e0('0x33')]=function(_0x1ca259,_0xd80f8d){return db[_0xb7e0('0x16')][_0xb7e0('0x33')](_0x1ca259[_0xb7e0('0x34')],{})[_0xb7e0('0x10')](respondWithResult(_0xd80f8d,0xc9))[_0xb7e0('0x2e')](handleError(_0xd80f8d,null));};exports[_0xb7e0('0xf')]=function(_0x4ba15e,_0x2b492d){if(_0x4ba15e['body']['id']){delete _0x4ba15e[_0xb7e0('0x34')]['id'];}return db[_0xb7e0('0x16')]['find']({'where':{'id':_0x4ba15e['params']['id']}})['then'](handleEntityNotFound(_0x2b492d,null))['then'](saveUpdates(_0x4ba15e[_0xb7e0('0x34')],null))[_0xb7e0('0x10')](respondWithResult(_0x2b492d,null))[_0xb7e0('0x2e')](handleError(_0x2b492d,null));};exports['destroy']=function(_0x34c5b9,_0x30e134){return db[_0xb7e0('0x16')]['find']({'where':{'id':_0x34c5b9[_0xb7e0('0x30')]['id']}})[_0xb7e0('0x10')](handleEntityNotFound(_0x30e134,null))[_0xb7e0('0x10')](removeEntity(_0x30e134,null))['catch'](handleError(_0x30e134,null));};exports[_0xb7e0('0x35')]=function(_0xbe4130,_0x5b5e86){var _0x2869c3={};var _0x32e838={};var _0x39e527;var _0x3b62f8;return db[_0xb7e0('0x16')]['findOne']({'where':{'id':_0xbe4130['params']['id']}})[_0xb7e0('0x10')](handleEntityNotFound(_0x5b5e86,null))[_0xb7e0('0x10')](function(_0x17d500){if(_0x17d500){_0x39e527=_0x17d500;_0x32e838['model']=_[_0xb7e0('0x1c')](db['Dynamics365Configuration']['rawAttributes']);_0x32e838[_0xb7e0('0x1b')]=_[_0xb7e0('0x1c')](_0xbe4130['query']);_0x32e838[_0xb7e0('0x25')]=_[_0xb7e0('0x1d')](_0x32e838[_0xb7e0('0x1a')],_0x32e838['query']);_0x2869c3['attributes']=_[_0xb7e0('0x1d')](_0x32e838['model'],qs[_0xb7e0('0x31')](_0xbe4130['query'][_0xb7e0('0x31')]));_0x2869c3[_0xb7e0('0x1e')]=_0x2869c3[_0xb7e0('0x1e')][_0xb7e0('0x1f')]?_0x2869c3[_0xb7e0('0x1e')]:_0x32e838[_0xb7e0('0x1a')];_0x2869c3[_0xb7e0('0x22')]=qs['sort'](_0xbe4130[_0xb7e0('0x1b')][_0xb7e0('0x23')]);_0x2869c3['where']=qs[_0xb7e0('0x25')](_[_0xb7e0('0x26')](_0xbe4130[_0xb7e0('0x1b')],_0x32e838[_0xb7e0('0x25')]));if(_0xbe4130[_0xb7e0('0x1b')][_0xb7e0('0x27')]){_0x2869c3[_0xb7e0('0x24')]=_['merge'](_0x2869c3['where'],{'$or':_[_0xb7e0('0x15')](_0x2869c3[_0xb7e0('0x1e')],function(_0x25543c){var _0x1182c9={};_0x1182c9[_0x25543c]={'$like':'%'+_0xbe4130[_0xb7e0('0x1b')][_0xb7e0('0x27')]+'%'};return _0x1182c9;})});}_0x2869c3=_[_0xb7e0('0x28')]({},_0x2869c3,_0xbe4130['options']);return _0x39e527[_0xb7e0('0x35')](_0x2869c3);}})[_0xb7e0('0x10')](function(_0x5b39c9){if(_0x5b39c9){_0x3b62f8=_0x5b39c9['length'];if(!_0xbe4130[_0xb7e0('0x1b')][_0xb7e0('0x20')](_0xb7e0('0x21'))){_0x2869c3[_0xb7e0('0xb')]=qs['limit'](_0xbe4130[_0xb7e0('0x1b')][_0xb7e0('0xb')]);_0x2869c3[_0xb7e0('0x9')]=qs[_0xb7e0('0x9')](_0xbe4130[_0xb7e0('0x1b')][_0xb7e0('0x9')]);}return _0x39e527[_0xb7e0('0x35')](_0x2869c3);}})['then'](function(_0x226192){if(_0x226192){return _0x226192?{'count':_0x3b62f8,'rows':_0x226192}:null;}})[_0xb7e0('0x10')](respondWithResult(_0x5b5e86,null))['catch'](handleError(_0x5b5e86,null));};exports[_0xb7e0('0x36')]=function(_0xe73872,_0x326432){if(_0xe73872[_0xb7e0('0x34')]['id']){delete _0xe73872[_0xb7e0('0x34')]['id'];}return db[_0xb7e0('0x16')][_0xb7e0('0x37')]({'where':{'id':_0xe73872[_0xb7e0('0x30')]['id']}})[_0xb7e0('0x10')](handleEntityNotFound(_0x326432,null))[_0xb7e0('0x10')](function(_0x3dadd8){if(_0x3dadd8){_0xe73872[_0xb7e0('0x34')][_0xb7e0('0x38')]=_0x3dadd8['id'];_0xe73872[_0xb7e0('0x34')][_0xb7e0('0x39')]=integrations[_0xb7e0('0x3a')](_0xe73872[_0xb7e0('0x34')]['channel'],_0xe73872[_0xb7e0('0x34')][_0xb7e0('0x18')]);_0xe73872['body'][_0xb7e0('0x3b')]=integrations['getDescriptions'](_0xe73872[_0xb7e0('0x34')][_0xb7e0('0x3c')],_0xe73872[_0xb7e0('0x34')][_0xb7e0('0x18')]);return db['Dynamics365Configuration'][_0xb7e0('0x33')](_0xe73872[_0xb7e0('0x34')],{'include':[{'model':db[_0xb7e0('0x3d')],'as':_0xb7e0('0x39')},{'model':db[_0xb7e0('0x3d')],'as':'Descriptions'}]});}return null;})[_0xb7e0('0x10')](respondWithResult(_0x326432,null))[_0xb7e0('0x2e')](handleError(_0x326432,null));};function sanitizeRemoteUri(_0x5135a6){var _0x25babd=_0x5135a6[_0xb7e0('0x3e')](-0x1);if(_0x25babd==='/')return _0x5135a6[_0xb7e0('0x3f')](0x0,_0x5135a6[_0xb7e0('0x40')](_0x25babd));return _0x5135a6;}function getWebApiUrl(_0x2b124f){return util[_0xb7e0('0x41')](_0xb7e0('0x42'),_0x2b124f);}exports[_0xb7e0('0x43')]=function(_0x48f81b,_0x133b4d){var _0x988a39=_0x48f81b[_0xb7e0('0x1b')][_0xb7e0('0x44')];var _0x49284e=_0x988a39===_0xb7e0('0x45')?'Incident':_0xb7e0('0x46');var _0x464f36='';var _0x1a6d59='';var _0x2539a2='';var _0x16396e='';var _0x318b3c='';var _0x26e041='';var _0x3d95e7='';var _0x1cde89='';var _0x49d38c=['title',_0xb7e0('0x47'),_0xb7e0('0x48'),'ownerid',_0xb7e0('0x49'),_0xb7e0('0x4a'),'phonenumber','regardingobjectid',_0xb7e0('0x4b'),_0xb7e0('0x4c')];var _0x105769=[_0xb7e0('0x4d'),_0xb7e0('0x4e'),_0xb7e0('0x4f'),_0xb7e0('0x50'),_0xb7e0('0x51'),'contactidyominame','contractdetailidname',_0xb7e0('0x52'),_0xb7e0('0x53'),'createdbyexternalpartyyominame',_0xb7e0('0x54'),_0xb7e0('0x55'),_0xb7e0('0x56'),_0xb7e0('0x57'),_0xb7e0('0x58'),_0xb7e0('0x59'),_0xb7e0('0x5a'),_0xb7e0('0x5b'),_0xb7e0('0x5c'),_0xb7e0('0x5d'),_0xb7e0('0x5e'),_0xb7e0('0x5f'),'escalatedon','exchangerate','firstresponsebykpiidname',_0xb7e0('0x60'),_0xb7e0('0x61'),_0xb7e0('0x62'),_0xb7e0('0x63'),'lastonholdtime','masteridname',_0xb7e0('0x64'),_0xb7e0('0x65'),'modifiedbyname','modifiedbyyominame','modifiedon',_0xb7e0('0x66'),_0xb7e0('0x67'),'msdyn_incidenttypename',_0xb7e0('0x68'),_0xb7e0('0x69'),_0xb7e0('0x6a'),'overriddencreatedon','owneridname',_0xb7e0('0x6b'),'owneridyominame',_0xb7e0('0x6c'),_0xb7e0('0x6d'),_0xb7e0('0x6e'),'prioritycodename',_0xb7e0('0x6f'),_0xb7e0('0x70'),_0xb7e0('0x71'),_0xb7e0('0x72'),'responseby',_0xb7e0('0x73'),_0xb7e0('0x74'),_0xb7e0('0x75'),_0xb7e0('0x76'),_0xb7e0('0x77'),'socialprofileidname',_0xb7e0('0x78'),_0xb7e0('0x79'),_0xb7e0('0x7a'),_0xb7e0('0x7b'),_0xb7e0('0x7c'),'transactioncurrencyidname','traversedpath','utcconversiontimezonecode',_0xb7e0('0x7d')];var _0x367b6f=_0x49d38c['concat'](_0x105769);return db[_0xb7e0('0x16')][_0xb7e0('0x37')]({'where':{'id':_0x48f81b[_0xb7e0('0x30')]['id']},'attributes':['id',_0xb7e0('0x7e'),_0xb7e0('0x7f'),_0xb7e0('0x80'),'tenantId','clientId',_0xb7e0('0x81'),_0xb7e0('0x82')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id','data5',_0xb7e0('0x83')]}]})[_0xb7e0('0x10')](handleEntityNotFound(_0x133b4d,null))[_0xb7e0('0x10')](function(_0x195a16){if(_0x195a16){if(_0x195a16[_0xb7e0('0x82')]){_0x195a16['access_token']=_0x195a16[_0xb7e0('0x84')][_0xb7e0('0x85')];_0x1cde89=sanitizeRemoteUri(_0x195a16['CloudProvider'][_0xb7e0('0x83')]);_0x3d95e7=getWebApiUrl(_0x1cde89);return _0x195a16;}_0x1cde89=sanitizeRemoteUri(_0x195a16[_0xb7e0('0x80')]);_0x3d95e7=getWebApiUrl(_0x1cde89);var _0x1007aa={'method':_0xb7e0('0x86'),'uri':'https://login.microsoftonline.com/'+_0x195a16[_0xb7e0('0x87')]+_0xb7e0('0x88'),'form':{'client_id':_0x195a16[_0xb7e0('0x89')],'resource':_0x1cde89,'username':_0x195a16['username'],'password':_0x195a16[_0xb7e0('0x7f')],'grant_type':_0xb7e0('0x7f'),'client_secret':_0x195a16[_0xb7e0('0x81')]},'json':!![]};return rp(_0x1007aa);}})[_0xb7e0('0x10')](function(_0x1685b7){_0x26e041=_0x1685b7[_0xb7e0('0x8a')];var _0x4f9626={'method':_0xb7e0('0x8b'),'uri':encodeURI(_0x3d95e7+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x49284e+'\x27'),'headers':{'Authorization':_0xb7e0('0x8c')+_0x26e041,'If-None-Match':null,'OData-Version':_0xb7e0('0x8d')},'json':!![]};return rp(_0x4f9626);})[_0xb7e0('0x10')](function(_0x2aca47){var _0x536a10=_0x2aca47['value'][0x0];var _0x388274=_0x536a10[_0xb7e0('0x8e')];var _0x46c47b={'method':'GET','uri':_0x3d95e7+_0xb7e0('0x8f')+_0x388274+_0xb7e0('0x90'),'headers':{'Authorization':_0xb7e0('0x8c')+_0x26e041,'If-None-Match':null,'OData-Version':_0xb7e0('0x8d')},'json':!![]};return rp(_0x46c47b);})[_0xb7e0('0x10')](function(_0x19f979){_0x464f36=_0x19f979;_0x1a6d59=_0x464f36[_0xb7e0('0x91')];_0x1a6d59=_['remove'](_0x1a6d59,function(_0x35d9e7){return!_0x367b6f[_0xb7e0('0x92')](_0x35d9e7[_0xb7e0('0x93')]);});var _0x503e53=[];var _0x492ac6=[];_0x1a6d59[_0xb7e0('0x94')](function(_0x242967){if(_0x242967[_0xb7e0('0x95')]){var _0x4a4694=_0x242967[_0xb7e0('0x95')]['substring'](_0x242967[_0xb7e0('0x95')][_0xb7e0('0x40')]('.')+0x1);if(_0x4a4694===_0xb7e0('0x96')){_0x503e53[_0xb7e0('0x97')](getSelectList(_0x3d95e7,_0x988a39,_0x492ac6,_0x464f36[_0xb7e0('0x8e')],_0x242967[_0xb7e0('0x8e')],_0x26e041));}}});return Promise[_0xb7e0('0x98')](_0x503e53);})['then'](function(_0x4da385){_0x2539a2=_0x4da385[0x0];var _0x36d483=[];var _0x54d58b=[];_0x1a6d59[_0xb7e0('0x94')](function(_0x2b8a1d){if(!_['isNil'](_0x2b8a1d[_0xb7e0('0x95')])){var _0x5a438a=_0x2b8a1d[_0xb7e0('0x95')]['substring'](_0x2b8a1d['@odata.type']['lastIndexOf']('.')+0x1);if(_0x5a438a===_0xb7e0('0x99')){_0x36d483['push'](getBooleanList(_0x3d95e7,_0x988a39,_0x54d58b,_0x464f36[_0xb7e0('0x8e')],_0x2b8a1d[_0xb7e0('0x8e')],_0x26e041));}}});return Promise[_0xb7e0('0x98')](_0x36d483);})[_0xb7e0('0x10')](function(_0x5e1a45){_0x16396e=_0x5e1a45[0x0];var _0x2a5b96=[];var _0xcc6b9f=[];_0x1a6d59[_0xb7e0('0x94')](function(_0x58ee0f){if(_0x58ee0f[_0xb7e0('0x95')]){var _0x65b31e=_0x58ee0f[_0xb7e0('0x95')]['substring'](_0x58ee0f['@odata.type']['lastIndexOf']('.')+0x1);if(_0x65b31e===_0xb7e0('0x9a')||_0x65b31e===_0xb7e0('0x9b')||_0x65b31e===_0xb7e0('0x9c')||_0x65b31e===_0xb7e0('0x9d')||_0x65b31e==='MemoAttributeMetadata'||_0x65b31e===_0xb7e0('0x9e')||_0x65b31e===_0xb7e0('0x9f')||_0x65b31e===_0xb7e0('0xa0')||_0x65b31e===_0xb7e0('0xa1')||_0x65b31e===_0xb7e0('0xa2')){_0x2a5b96[_0xb7e0('0x97')](getInputList(_0x3d95e7,_0x988a39,_0x65b31e,_0xcc6b9f,_0x464f36['MetadataId'],_0x58ee0f[_0xb7e0('0x8e')],_0x26e041));}}});return Promise[_0xb7e0('0x98')](_0x2a5b96);})[_0xb7e0('0x10')](function(_0x12eb19){_0x318b3c=_0x12eb19[0x0];var _0x183447=_0x2539a2[_0xb7e0('0xa3')](_0x16396e)[_0xb7e0('0xa3')](_0x318b3c);var _0x3ccd14={'count':_0x183447[_0xb7e0('0x1f')],'rows':_0x183447};return _0x3ccd14;})[_0xb7e0('0x10')](respondWithResult(_0x133b4d,null))[_0xb7e0('0x2e')](function(_0x573918){var _0x486e90=_0x48f81b[_0xb7e0('0x1b')][_0xb7e0('0xa4')]?0x1f4:_0x573918['statusCode']||0x1f4;logger[_0xb7e0('0xa5')](_0x573918['stack']);delete _0x573918['name'];if(_0x486e90===0x191){_0x486e90=0x190;}_0x133b4d[_0xb7e0('0x7')](_0x486e90)[_0xb7e0('0xa6')](_0x48f81b[_0xb7e0('0x1b')]['test']?{'message':_0xb7e0('0xa7'),'statusCode':_0x573918['statusCode']}:_0x573918);});};function getSelectList(_0x131f2f,_0xd08f33,_0x5ca88e,_0x201e3d,_0xfb2ac2,_0x55ee4b){var _0xb40f2b={'method':_0xb7e0('0x8b'),'uri':_0x131f2f+_0xb7e0('0x8f')+_0x201e3d+_0xb7e0('0xa8')+_0xfb2ac2+_0xb7e0('0xa9')+_0xb7e0('0xaa'),'headers':{'Authorization':_0xb7e0('0x8c')+_0x55ee4b,'If-None-Match':null,'OData-Version':_0xb7e0('0x8d')},'json':!![]};return rp(_0xb40f2b)[_0xb7e0('0x10')](function(_0x41025a){var _0x6bf3d2=[];var _0xdba82d=_0x41025a[_0xb7e0('0xab')][_0xb7e0('0xac')];_0xdba82d[_0xb7e0('0x94')](function(_0x4775bc){_0x6bf3d2[_0xb7e0('0x97')]({'name':_0x4775bc[_0xb7e0('0xad')]['UserLocalizedLabel'][_0xb7e0('0xad')],'value':String(_0x4775bc[_0xb7e0('0xae')])});});var _0x3ab7b1={'id':_0xd08f33+'_'+_0x41025a[_0xb7e0('0x93')],'name':_0x41025a[_0xb7e0('0xaf')][_0xb7e0('0xb0')][_0xb7e0('0xad')],'custom':![],'options':_0x6bf3d2};_0x5ca88e['push'](_0x3ab7b1);return _0x5ca88e;});}function getBooleanList(_0x38616c,_0x362040,_0x23cdfe,_0x44723f,_0x393074,_0x47044c){var _0x52c6fe={'method':_0xb7e0('0x8b'),'uri':_0x38616c+'EntityDefinitions('+_0x44723f+_0xb7e0('0xa8')+_0x393074+_0xb7e0('0xb1'),'headers':{'Authorization':_0xb7e0('0x8c')+_0x47044c,'If-None-Match':null,'OData-Version':_0xb7e0('0x8d')},'json':!![]};return rp(_0x52c6fe)[_0xb7e0('0x10')](function(_0x15303b){var _0x1ab793=[];_0x1ab793[_0xb7e0('0x97')]({'name':_0x15303b['OptionSet'][_0xb7e0('0xb2')][_0xb7e0('0xad')][_0xb7e0('0xb0')][_0xb7e0('0xad')],'value':_0xb7e0('0xb3')},{'name':_0x15303b[_0xb7e0('0xab')]['FalseOption'][_0xb7e0('0xad')][_0xb7e0('0xb0')]['Label'],'value':'false'});var _0x3ff273={'id':_0x362040+'_'+_0x15303b[_0xb7e0('0x93')],'name':_0x15303b[_0xb7e0('0xaf')][_0xb7e0('0xb0')][_0xb7e0('0xad')],'custom':![],'options':_0x1ab793};_0x23cdfe[_0xb7e0('0x97')](_0x3ff273);return _0x23cdfe;});}function getInputList(_0x50da41,_0x26941a,_0x567ceb,_0x3788dc,_0x1593d5,_0x560345,_0x18559e){var _0x313c14={'method':_0xb7e0('0x8b'),'uri':_0x50da41+_0xb7e0('0x8f')+_0x1593d5+')/Attributes('+_0x560345+_0xb7e0('0xb4')+_0x567ceb+_0xb7e0('0xb5'),'headers':{'Authorization':'Bearer\x20'+_0x18559e,'If-None-Match':null,'OData-Version':_0xb7e0('0x8d')},'json':!![]};return rp(_0x313c14)[_0xb7e0('0x10')](function(_0x274cea){var _0xf6f995={'id':_0x26941a+'_'+_0x274cea['LogicalName'],'name':_0x274cea[_0xb7e0('0xaf')][_0xb7e0('0xb0')]?_0x274cea['DisplayName'][_0xb7e0('0xb0')][_0xb7e0('0xad')]:_0x274cea[_0xb7e0('0x93')],'custom':![],'options':[]};_0x3788dc['push'](_0xf6f995);return _0x3788dc;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 8e1893e..595262e 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x688348,_0x1e65a1){var _0x4da52c=function(_0x20d945){while(--_0x20d945){_0x688348['push'](_0x688348['shift']());}};_0x4da52c(++_0x1e65a1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1cf868,_0x127879){var _0x6862d1=function(_0x1cfffb){while(--_0x1cfffb){_0x1cf868['push'](_0x1cf868['shift']());}};_0x6862d1(++_0x127879);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 2d3e394..8f7f702 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 _0x8e0f=['catch','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetDynamics365Account','options','where','attributes','limit','include','map','model'];(function(_0x21238c,_0x46e9e1){var _0x1cdd7b=function(_0x1d7c52){while(--_0x1d7c52){_0x21238c['push'](_0x21238c['shift']());}};_0x1cdd7b(++_0x46e9e1);}(_0x8e0f,0xad));var _0xf8e0=function(_0x352bff,_0x4b2145){_0x352bff=_0x352bff-0x0;var _0x109e5c=_0x8e0f[_0x352bff];return _0x109e5c;};'use strict';var _=require(_0xf8e0('0x0'));var util=require(_0xf8e0('0x1'));var moment=require('moment');var BPromise=require(_0xf8e0('0x2'));var rs=require(_0xf8e0('0x3'));var fs=require('fs');var Redis=require(_0xf8e0('0x4'));var db=require(_0xf8e0('0x5'))['db'];var utils=require(_0xf8e0('0x6'));var logger=require(_0xf8e0('0x7'))(_0xf8e0('0x8'));var config=require('../../config/environment');var jayson=require(_0xf8e0('0x9'));var client=jayson[_0xf8e0('0xa')][_0xf8e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa3144d,_0x4ee27c,_0x48bbe2){return new BPromise(function(_0x12a43d,_0x2d2e48){return client[_0xf8e0('0xc')](_0xa3144d,_0x48bbe2)[_0xf8e0('0xd')](function(_0xaae8c7){logger[_0xf8e0('0xe')](_0xf8e0('0xf'),_0x4ee27c,'request\x20sent');logger[_0xf8e0('0x10')](_0xf8e0('0x11'),_0x4ee27c,_0xf8e0('0x12'),JSON[_0xf8e0('0x13')](_0xaae8c7));if(_0xaae8c7[_0xf8e0('0x14')]){if(_0xaae8c7['error'][_0xf8e0('0x15')]===0x1f4){logger[_0xf8e0('0x14')](_0xf8e0('0xf'),_0x4ee27c,_0xaae8c7['error'][_0xf8e0('0x16')]);return _0x2d2e48(_0xaae8c7['error'][_0xf8e0('0x16')]);}logger[_0xf8e0('0x14')](_0xf8e0('0xf'),_0x4ee27c,_0xaae8c7[_0xf8e0('0x14')][_0xf8e0('0x16')]);return _0x12a43d(_0xaae8c7[_0xf8e0('0x14')][_0xf8e0('0x16')]);}else{logger[_0xf8e0('0xe')](_0xf8e0('0xf'),_0x4ee27c,_0xf8e0('0x12'));_0x12a43d(_0xaae8c7['result'][_0xf8e0('0x16')]);}})['catch'](function(_0x5980e6){logger[_0xf8e0('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x4ee27c,_0x5980e6);_0x2d2e48(_0x5980e6);});});}exports[_0xf8e0('0x17')]=function(_0x163da0){var _0x32fd82=this;return new Promise(function(_0x13992f,_0x72ac14){return db['Dynamics365Account']['findAll']({'raw':_0x163da0['options']?_0x163da0[_0xf8e0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x163da0[_0xf8e0('0x18')]?_0x163da0[_0xf8e0('0x18')][_0xf8e0('0x19')]||null:null,'attributes':_0x163da0[_0xf8e0('0x18')]?_0x163da0[_0xf8e0('0x18')][_0xf8e0('0x1a')]||null:null,'limit':_0x163da0[_0xf8e0('0x18')]?_0x163da0[_0xf8e0('0x18')][_0xf8e0('0x1b')]||null:null,'include':_0x163da0[_0xf8e0('0x18')]?_0x163da0[_0xf8e0('0x18')][_0xf8e0('0x1c')]?_[_0xf8e0('0x1d')](_0x163da0[_0xf8e0('0x18')][_0xf8e0('0x1c')],function(_0x1b6a10){return{'model':db[_0x1b6a10[_0xf8e0('0x1e')]],'as':_0x1b6a10['as'],'attributes':_0x1b6a10[_0xf8e0('0x1a')],'include':_0x1b6a10[_0xf8e0('0x1c')]?_['map'](_0x1b6a10[_0xf8e0('0x1c')],function(_0x80437){return{'model':db[_0x80437[_0xf8e0('0x1e')]],'as':_0x80437['as'],'attributes':_0x80437['attributes'],'include':_0x80437['include']?_[_0xf8e0('0x1d')](_0x80437[_0xf8e0('0x1c')],function(_0x24c7ae){return{'model':db[_0x24c7ae['model']],'as':_0x24c7ae['as'],'attributes':_0x24c7ae[_0xf8e0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf8e0('0xd')](function(_0x1d4035){logger[_0xf8e0('0xe')]('GetDynamics365Account',_0x163da0);logger[_0xf8e0('0x10')](_0xf8e0('0x17'),_0x163da0,JSON[_0xf8e0('0x13')](_0x1d4035));_0x13992f(_0x1d4035);})[_0xf8e0('0x1f')](function(_0x403b8e){logger['error'](_0xf8e0('0x17'),_0x403b8e[_0xf8e0('0x16')],_0x163da0);_0x72ac14(_0x32fd82['error'](0x1f4,_0x403b8e[_0xf8e0('0x16')]));});});};exports[_0xf8e0('0x20')]=function(_0x208a08){var _0x461e4e=this;return new Promise(function(_0x575243,_0x45c966){return db['Dynamics365Account'][_0xf8e0('0x21')]({'raw':_0x208a08[_0xf8e0('0x18')]?_0x208a08[_0xf8e0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x208a08[_0xf8e0('0x18')]?_0x208a08[_0xf8e0('0x18')][_0xf8e0('0x19')]||null:null,'attributes':_0x208a08[_0xf8e0('0x18')]?_0x208a08[_0xf8e0('0x18')][_0xf8e0('0x1a')]||null:null,'include':_0x208a08[_0xf8e0('0x18')]?_0x208a08[_0xf8e0('0x18')][_0xf8e0('0x1c')]?_[_0xf8e0('0x1d')](_0x208a08[_0xf8e0('0x18')][_0xf8e0('0x1c')],function(_0x5c0904){return{'model':db[_0x5c0904[_0xf8e0('0x1e')]],'as':_0x5c0904['as'],'attributes':_0x5c0904[_0xf8e0('0x1a')],'include':_0x5c0904[_0xf8e0('0x1c')]?_['map'](_0x5c0904[_0xf8e0('0x1c')],function(_0x30cabd){return{'model':db[_0x30cabd[_0xf8e0('0x1e')]],'as':_0x30cabd['as'],'attributes':_0x30cabd[_0xf8e0('0x1a')],'include':_0x30cabd['include']?_[_0xf8e0('0x1d')](_0x30cabd[_0xf8e0('0x1c')],function(_0x1d41e2){return{'model':db[_0x1d41e2[_0xf8e0('0x1e')]],'as':_0x1d41e2['as'],'attributes':_0x1d41e2[_0xf8e0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf8e0('0xd')](function(_0x2070a5){logger[_0xf8e0('0xe')](_0xf8e0('0x20'),_0x208a08);logger['debug'](_0xf8e0('0x20'),_0x208a08,JSON[_0xf8e0('0x13')](_0x2070a5));_0x575243(_0x2070a5);})[_0xf8e0('0x1f')](function(_0x4221e5){logger['error'](_0xf8e0('0x20'),_0x4221e5[_0xf8e0('0x16')],_0x208a08);_0x45c966(_0x461e4e['error'](0x1f4,_0x4221e5[_0xf8e0('0x16')]));});});}; \ No newline at end of file +var _0x28cc=['result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','catch','ShowDynamics365Account','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x894c0b,_0xb5ce86){var _0x1f27a9=function(_0x25237f){while(--_0x25237f){_0x894c0b['push'](_0x894c0b['shift']());}};_0x1f27a9(++_0xb5ce86);}(_0x28cc,0x1d4));var _0xc28c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28cc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc28c('0x0'));var util=require('util');var moment=require(_0xc28c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc28c('0x2'));var fs=require('fs');var Redis=require(_0xc28c('0x3'));var db=require(_0xc28c('0x4'))['db'];var utils=require(_0xc28c('0x5'));var logger=require(_0xc28c('0x6'))(_0xc28c('0x7'));var config=require(_0xc28c('0x8'));var jayson=require(_0xc28c('0x9'));var client=jayson[_0xc28c('0xa')][_0xc28c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dd6d3,_0x10b8cd,_0x25c89c){return new BPromise(function(_0x2b3b13,_0x44d2ed){return client[_0xc28c('0xc')](_0x5dd6d3,_0x25c89c)[_0xc28c('0xd')](function(_0x5bf2da){logger[_0xc28c('0xe')](_0xc28c('0xf'),_0x10b8cd,'request\x20sent');logger[_0xc28c('0x10')](_0xc28c('0x11'),_0x10b8cd,_0xc28c('0x12'),JSON[_0xc28c('0x13')](_0x5bf2da));if(_0x5bf2da['error']){if(_0x5bf2da[_0xc28c('0x14')]['code']===0x1f4){logger[_0xc28c('0x14')](_0xc28c('0xf'),_0x10b8cd,_0x5bf2da[_0xc28c('0x14')][_0xc28c('0x15')]);return _0x44d2ed(_0x5bf2da[_0xc28c('0x14')]['message']);}logger[_0xc28c('0x14')](_0xc28c('0xf'),_0x10b8cd,_0x5bf2da['error'][_0xc28c('0x15')]);return _0x2b3b13(_0x5bf2da['error'][_0xc28c('0x15')]);}else{logger[_0xc28c('0xe')](_0xc28c('0xf'),_0x10b8cd,'request\x20sent');_0x2b3b13(_0x5bf2da[_0xc28c('0x16')][_0xc28c('0x15')]);}})['catch'](function(_0x3e3b73){logger[_0xc28c('0x14')](_0xc28c('0xf'),_0x10b8cd,_0x3e3b73);_0x44d2ed(_0x3e3b73);});});}exports[_0xc28c('0x17')]=function(_0x151716){var _0x1beca0=this;return new Promise(function(_0x46bfed,_0x54d1a1){return db[_0xc28c('0x18')][_0xc28c('0x19')]({'raw':_0x151716[_0xc28c('0x1a')]?_0x151716[_0xc28c('0x1a')][_0xc28c('0x1b')]===undefined?!![]:![]:!![],'where':_0x151716[_0xc28c('0x1a')]?_0x151716['options'][_0xc28c('0x1c')]||null:null,'attributes':_0x151716[_0xc28c('0x1a')]?_0x151716['options'][_0xc28c('0x1d')]||null:null,'limit':_0x151716[_0xc28c('0x1a')]?_0x151716[_0xc28c('0x1a')]['limit']||null:null,'include':_0x151716['options']?_0x151716[_0xc28c('0x1a')][_0xc28c('0x1e')]?_[_0xc28c('0x1f')](_0x151716[_0xc28c('0x1a')][_0xc28c('0x1e')],function(_0x1e00c8){return{'model':db[_0x1e00c8[_0xc28c('0x20')]],'as':_0x1e00c8['as'],'attributes':_0x1e00c8[_0xc28c('0x1d')],'include':_0x1e00c8[_0xc28c('0x1e')]?_[_0xc28c('0x1f')](_0x1e00c8['include'],function(_0x53b06a){return{'model':db[_0x53b06a[_0xc28c('0x20')]],'as':_0x53b06a['as'],'attributes':_0x53b06a['attributes'],'include':_0x53b06a['include']?_['map'](_0x53b06a['include'],function(_0x26f5a4){return{'model':db[_0x26f5a4['model']],'as':_0x26f5a4['as'],'attributes':_0x26f5a4[_0xc28c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc28c('0xd')](function(_0x2e0077){logger[_0xc28c('0xe')]('GetDynamics365Account',_0x151716);logger[_0xc28c('0x10')](_0xc28c('0x17'),_0x151716,JSON[_0xc28c('0x13')](_0x2e0077));_0x46bfed(_0x2e0077);})[_0xc28c('0x21')](function(_0xc8f60a){logger[_0xc28c('0x14')]('GetDynamics365Account',_0xc8f60a[_0xc28c('0x15')],_0x151716);_0x54d1a1(_0x1beca0[_0xc28c('0x14')](0x1f4,_0xc8f60a[_0xc28c('0x15')]));});});};exports[_0xc28c('0x22')]=function(_0x1ff570){var _0x4ce8f5=this;return new Promise(function(_0x36c1a3,_0xd2b658){return db['Dynamics365Account']['find']({'raw':_0x1ff570[_0xc28c('0x1a')]?_0x1ff570[_0xc28c('0x1a')][_0xc28c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ff570['options']?_0x1ff570['options'][_0xc28c('0x1c')]||null:null,'attributes':_0x1ff570['options']?_0x1ff570['options']['attributes']||null:null,'include':_0x1ff570['options']?_0x1ff570[_0xc28c('0x1a')]['include']?_['map'](_0x1ff570[_0xc28c('0x1a')]['include'],function(_0x254b0e){return{'model':db[_0x254b0e[_0xc28c('0x20')]],'as':_0x254b0e['as'],'attributes':_0x254b0e['attributes'],'include':_0x254b0e[_0xc28c('0x1e')]?_[_0xc28c('0x1f')](_0x254b0e[_0xc28c('0x1e')],function(_0x427908){return{'model':db[_0x427908[_0xc28c('0x20')]],'as':_0x427908['as'],'attributes':_0x427908['attributes'],'include':_0x427908['include']?_[_0xc28c('0x1f')](_0x427908['include'],function(_0x57cacf){return{'model':db[_0x57cacf['model']],'as':_0x57cacf['as'],'attributes':_0x57cacf[_0xc28c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc28c('0xd')](function(_0x424d40){logger[_0xc28c('0xe')](_0xc28c('0x22'),_0x1ff570);logger[_0xc28c('0x10')](_0xc28c('0x22'),_0x1ff570,JSON[_0xc28c('0x13')](_0x424d40));_0x36c1a3(_0x424d40);})[_0xc28c('0x21')](function(_0x4cda3c){logger[_0xc28c('0x14')](_0xc28c('0x22'),_0x4cda3c[_0xc28c('0x15')],_0x1ff570);_0xd2b658(_0x4ce8f5[_0xc28c('0x14')](0x1f4,_0x4cda3c[_0xc28c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index e7c76de..cc40afe 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 _0x72a1=['getDescriptions','post','create','put','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/subjects','/:id/descriptions'];(function(_0x3cbdb0,_0x5d5212){var _0x4d6fd7=function(_0x31bad4){while(--_0x31bad4){_0x3cbdb0['push'](_0x3cbdb0['shift']());}};_0x4d6fd7(++_0x5d5212);}(_0x72a1,0x1ce));var _0x172a=function(_0x550b6b,_0x4d7eec){_0x550b6b=_0x550b6b-0x0;var _0x3dfafa=_0x72a1[_0x550b6b];return _0x3dfafa;};'use strict';var multer=require('multer');var util=require(_0x172a('0x0'));var path=require('path');var timeout=require(_0x172a('0x1'));var express=require('express');var router=express[_0x172a('0x2')]();var fs_extra=require(_0x172a('0x3'));var auth=require(_0x172a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x172a('0x5'));var controller=require('./intDynamics365Configuration.controller');router[_0x172a('0x6')]('/',auth['isAuthenticated'](),controller[_0x172a('0x7')]);router['get'](_0x172a('0x8'),auth[_0x172a('0x9')](),controller[_0x172a('0xa')]);router[_0x172a('0x6')]('/:id/fields',auth[_0x172a('0x9')](),controller['getFields']);router[_0x172a('0x6')](_0x172a('0xb'),auth[_0x172a('0x9')](),controller['getSubjects']);router[_0x172a('0x6')](_0x172a('0xc'),auth[_0x172a('0x9')](),controller[_0x172a('0xd')]);router[_0x172a('0xe')]('/',auth['isAuthenticated'](),controller[_0x172a('0xf')]);router[_0x172a('0x10')](_0x172a('0x8'),auth[_0x172a('0x9')](),controller['update']);router[_0x172a('0x11')](_0x172a('0x8'),auth[_0x172a('0x9')](),controller['destroy']);module[_0x172a('0x12')]=router; \ No newline at end of file +var _0xd5eb=['update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put'];(function(_0x12309b,_0x59dd8c){var _0x482e4d=function(_0x308407){while(--_0x308407){_0x12309b['push'](_0x12309b['shift']());}};_0x482e4d(++_0x59dd8c);}(_0xd5eb,0x183));var _0xbd5e=function(_0x56247f,_0x14328c){_0x56247f=_0x56247f-0x0;var _0x366b52=_0xd5eb[_0x56247f];return _0x366b52;};'use strict';var multer=require(_0xbd5e('0x0'));var util=require(_0xbd5e('0x1'));var path=require('path');var timeout=require(_0xbd5e('0x2'));var express=require(_0xbd5e('0x3'));var router=express[_0xbd5e('0x4')]();var fs_extra=require(_0xbd5e('0x5'));var auth=require(_0xbd5e('0x6'));var interaction=require(_0xbd5e('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0xbd5e('0x8')](),controller[_0xbd5e('0x9')]);router['get'](_0xbd5e('0xa'),auth[_0xbd5e('0x8')](),controller[_0xbd5e('0xb')]);router[_0xbd5e('0xc')](_0xbd5e('0xd'),auth[_0xbd5e('0x8')](),controller[_0xbd5e('0xe')]);router['get'](_0xbd5e('0xf'),auth['isAuthenticated'](),controller[_0xbd5e('0x10')]);router['get'](_0xbd5e('0x11'),auth[_0xbd5e('0x8')](),controller[_0xbd5e('0x12')]);router['post']('/',auth[_0xbd5e('0x8')](),controller[_0xbd5e('0x13')]);router[_0xbd5e('0x14')](_0xbd5e('0xa'),auth[_0xbd5e('0x8')](),controller[_0xbd5e('0x15')]);router[_0xbd5e('0x16')](_0xbd5e('0xa'),auth[_0xbd5e('0x8')](),controller[_0xbd5e('0x17')]);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 61820ad..1c67051 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 _0x9960=['STRING','ENUM','incident','phonecall','contact','nothing','BOOLEAN','exports'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0x9960,0xd7));var _0x0996=function(_0x5e4c8a,_0x39abf4){_0x5e4c8a=_0x5e4c8a-0x0;var _0x79c628=_0x9960[_0x5e4c8a];return _0x79c628;};'use strict';var Sequelize=require('sequelize');module[_0x0996('0x0')]={'name':{'type':Sequelize[_0x0996('0x1')]},'description':{'type':Sequelize[_0x0996('0x1')]},'ticketType':{'type':Sequelize[_0x0996('0x2')](_0x0996('0x3'),_0x0996('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x0996('0x5'),_0x0996('0x6')),'defaultValue':_0x0996('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x0996('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x0996('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xacb7=['phonecall','ENUM','contact','BOOLEAN','sequelize','exports','STRING','incident'];(function(_0x4e9df2,_0x36818e){var _0x9fe790=function(_0x126eb5){while(--_0x126eb5){_0x4e9df2['push'](_0x4e9df2['shift']());}};_0x9fe790(++_0x36818e);}(_0xacb7,0xe4));var _0x7acb=function(_0x28a6f5,_0x285201){_0x28a6f5=_0x28a6f5-0x0;var _0x28dca3=_0xacb7[_0x28a6f5];return _0x28dca3;};'use strict';var Sequelize=require(_0x7acb('0x0'));module[_0x7acb('0x1')]={'name':{'type':Sequelize[_0x7acb('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x7acb('0x3'),_0x7acb('0x4')),'defaultValue':_0x7acb('0x3')},'moduleCreate':{'type':Sequelize[_0x7acb('0x5')](_0x7acb('0x6'),'nothing'),'defaultValue':_0x7acb('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7acb('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x7acb('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index a8b31ec..bb88fbb 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 _0xc478=['update','destroy','then','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','find','create','body','params','Dynamics365Field','options','getFields','nolimit','findOne','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range'];(function(_0x5a4bae,_0x152671){var _0x19f22e=function(_0x3413d7){while(--_0x3413d7){_0x5a4bae['push'](_0x5a4bae['shift']());}};_0x19f22e(++_0x152671);}(_0xc478,0x1ad));var _0x8c47=function(_0x247eed,_0x24aeee){_0x247eed=_0x247eed-0x0;var _0x1548d9=_0xc478[_0x247eed];return _0x1548d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c47('0x0'));var zipdir=require(_0x8c47('0x1'));var jsonpatch=require(_0x8c47('0x2'));var rp=require(_0x8c47('0x3'));var moment=require(_0x8c47('0x4'));var BPromise=require(_0x8c47('0x5'));var Mustache=require(_0x8c47('0x6'));var util=require('util');var path=require(_0x8c47('0x7'));var sox=require(_0x8c47('0x8'));var csv=require(_0x8c47('0x9'));var ejs=require(_0x8c47('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c47('0xb'));var squel=require(_0x8c47('0xc'));var crypto=require(_0x8c47('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8c47('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8c47('0xf'));var Redis=require(_0x8c47('0x10'));var authService=require(_0x8c47('0x11'));var qs=require(_0x8c47('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c47('0x13'));var logger=require(_0x8c47('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8c47('0x15'));var licenseUtil=require(_0x8c47('0x16'));var db=require(_0x8c47('0x17'))['db'];function respondWithStatusCode(_0x7266fa,_0x2af035){_0x2af035=_0x2af035||0xcc;return function(_0x59b7d4){if(_0x59b7d4){return _0x7266fa[_0x8c47('0x18')](_0x2af035);}return _0x7266fa[_0x8c47('0x19')](_0x2af035)[_0x8c47('0x1a')]();};}function respondWithResult(_0x2b8f8b,_0x4de723){_0x4de723=_0x4de723||0xc8;return function(_0x5294a6){if(_0x5294a6){return _0x2b8f8b['status'](_0x4de723)[_0x8c47('0x1b')](_0x5294a6);}};}function respondWithFilteredResult(_0x8d75d0,_0x4d6f75){return function(_0x1c01e){if(_0x1c01e){var _0x2fdecf=typeof _0x4d6f75['offset']==='undefined'&&typeof _0x4d6f75[_0x8c47('0x1c')]===_0x8c47('0x1d');var _0x10675b=_0x1c01e[_0x8c47('0x1e')];var _0x8b904b=_0x2fdecf?0x0:_0x4d6f75[_0x8c47('0x1f')];var _0x3276fe=_0x2fdecf?_0x1c01e['count']:_0x4d6f75[_0x8c47('0x1f')]+_0x4d6f75[_0x8c47('0x1c')];var _0x20a6a0;if(_0x3276fe>=_0x10675b){_0x3276fe=_0x10675b;_0x20a6a0=0xc8;}else{_0x20a6a0=0xce;}_0x8d75d0['status'](_0x20a6a0);return _0x8d75d0['set'](_0x8c47('0x20'),_0x8b904b+'-'+_0x3276fe+'/'+_0x10675b)[_0x8c47('0x1b')](_0x1c01e);}return null;};}function patchUpdates(_0x321cd4){return function(_0x538805){try{jsonpatch['apply'](_0x538805,_0x321cd4,!![]);}catch(_0x2d3621){return BPromise['reject'](_0x2d3621);}return _0x538805['save']();};}function saveUpdates(_0x3e0c0a,_0x2b46f5){return function(_0x398313){if(_0x398313){return _0x398313[_0x8c47('0x21')](_0x3e0c0a)['then'](function(_0x59686c){return _0x59686c;});}return null;};}function removeEntity(_0x564e91,_0x4c7811){return function(_0xfeaecb){if(_0xfeaecb){return _0xfeaecb[_0x8c47('0x22')]()[_0x8c47('0x23')](function(){_0x564e91[_0x8c47('0x19')](0xcc)[_0x8c47('0x1a')]();});}};}function handleEntityNotFound(_0x4de4b5,_0x4c40ab){return function(_0x1c90a6){if(!_0x1c90a6){_0x4de4b5['sendStatus'](0x194);}return _0x1c90a6;};}function handleError(_0x56663c,_0x42f78c){_0x42f78c=_0x42f78c||0x1f4;return function(_0x173731){logger[_0x8c47('0x24')](_0x173731[_0x8c47('0x25')]);if(_0x173731[_0x8c47('0x26')]){delete _0x173731[_0x8c47('0x26')];}_0x56663c[_0x8c47('0x19')](_0x42f78c)[_0x8c47('0x27')](_0x173731);};}exports[_0x8c47('0x28')]=function(_0x435671,_0xdeaa47){var _0x1ef501={},_0x166ffb={},_0x2ef0ea={'count':0x0,'rows':[]};var _0x3c45be=_['map'](db[_0x8c47('0x29')][_0x8c47('0x2a')],function(_0x3b9078){return{'name':_0x3b9078['fieldName'],'type':_0x3b9078[_0x8c47('0x2b')][_0x8c47('0x2c')]};});_0x166ffb[_0x8c47('0x2d')]=_[_0x8c47('0x2e')](_0x3c45be,_0x8c47('0x26'));_0x166ffb[_0x8c47('0x2f')]=_[_0x8c47('0x30')](_0x435671[_0x8c47('0x2f')]);_0x166ffb['filters']=_[_0x8c47('0x31')](_0x166ffb[_0x8c47('0x2d')],_0x166ffb[_0x8c47('0x2f')]);_0x1ef501['attributes']=_[_0x8c47('0x31')](_0x166ffb[_0x8c47('0x2d')],qs[_0x8c47('0x32')](_0x435671['query'][_0x8c47('0x32')]));_0x1ef501[_0x8c47('0x33')]=_0x1ef501[_0x8c47('0x33')][_0x8c47('0x34')]?_0x1ef501[_0x8c47('0x33')]:_0x166ffb[_0x8c47('0x2d')];if(!_0x435671[_0x8c47('0x2f')][_0x8c47('0x35')]('nolimit')){_0x1ef501['limit']=qs['limit'](_0x435671[_0x8c47('0x2f')]['limit']);_0x1ef501[_0x8c47('0x1f')]=qs[_0x8c47('0x1f')](_0x435671[_0x8c47('0x2f')]['offset']);}_0x1ef501[_0x8c47('0x36')]=qs['sort'](_0x435671[_0x8c47('0x2f')][_0x8c47('0x37')]);_0x1ef501[_0x8c47('0x38')]=qs[_0x8c47('0x39')](_[_0x8c47('0x3a')](_0x435671['query'],_0x166ffb[_0x8c47('0x39')]),_0x3c45be);if(_0x435671[_0x8c47('0x2f')][_0x8c47('0x3b')]){_0x1ef501[_0x8c47('0x38')]=_[_0x8c47('0x3c')](_0x1ef501['where'],{'$or':_[_0x8c47('0x2e')](_0x3c45be,function(_0x137eac){if(_0x137eac[_0x8c47('0x2b')]!==_0x8c47('0x3d')){var _0x4eeb02={};_0x4eeb02[_0x137eac[_0x8c47('0x26')]]={'$like':'%'+_0x435671[_0x8c47('0x2f')]['filter']+'%'};return _0x4eeb02;}})});}_0x1ef501=_['merge']({},_0x1ef501,_0x435671['options']);var _0x5ac72d={'where':_0x1ef501[_0x8c47('0x38')]};return db[_0x8c47('0x29')][_0x8c47('0x1e')](_0x5ac72d)[_0x8c47('0x23')](function(_0x1204ba){_0x2ef0ea[_0x8c47('0x1e')]=_0x1204ba;if(_0x435671['query'][_0x8c47('0x3e')]){_0x1ef501[_0x8c47('0x3f')]=[{'all':!![]}];}return db[_0x8c47('0x29')]['findAll'](_0x1ef501);})[_0x8c47('0x23')](function(_0x577202){_0x2ef0ea['rows']=_0x577202;return _0x2ef0ea;})[_0x8c47('0x23')](respondWithFilteredResult(_0xdeaa47,_0x1ef501))[_0x8c47('0x40')](handleError(_0xdeaa47,null));};exports[_0x8c47('0x41')]=function(_0x1b5e24,_0x207f14){var _0x6f0e25={'raw':![],'where':{'id':_0x1b5e24['params']['id']}},_0x46f8cb={};_0x46f8cb[_0x8c47('0x2d')]=_[_0x8c47('0x30')](db[_0x8c47('0x29')][_0x8c47('0x2a')]);_0x46f8cb['query']=_[_0x8c47('0x30')](_0x1b5e24[_0x8c47('0x2f')]);_0x46f8cb[_0x8c47('0x39')]=_[_0x8c47('0x31')](_0x46f8cb[_0x8c47('0x2d')],_0x46f8cb[_0x8c47('0x2f')]);_0x6f0e25[_0x8c47('0x33')]=_['intersection'](_0x46f8cb[_0x8c47('0x2d')],qs[_0x8c47('0x32')](_0x1b5e24['query'][_0x8c47('0x32')]));_0x6f0e25['attributes']=_0x6f0e25['attributes']['length']?_0x6f0e25['attributes']:_0x46f8cb['model'];if(_0x1b5e24[_0x8c47('0x2f')][_0x8c47('0x3e')]){_0x6f0e25['include']=[{'all':!![]}];}_0x6f0e25=_[_0x8c47('0x3c')]({},_0x6f0e25,_0x1b5e24['options']);return db[_0x8c47('0x29')][_0x8c47('0x42')](_0x6f0e25)['then'](handleEntityNotFound(_0x207f14,null))[_0x8c47('0x23')](respondWithResult(_0x207f14,null))[_0x8c47('0x40')](handleError(_0x207f14,null));};exports[_0x8c47('0x43')]=function(_0x44f0c4,_0x1f4d19){return db[_0x8c47('0x29')][_0x8c47('0x43')](_0x44f0c4[_0x8c47('0x44')],{})['then'](respondWithResult(_0x1f4d19,0xc9))[_0x8c47('0x40')](handleError(_0x1f4d19,null));};exports[_0x8c47('0x21')]=function(_0x3003fe,_0x2751fe){if(_0x3003fe['body']['id']){delete _0x3003fe[_0x8c47('0x44')]['id'];}return db['Dynamics365Configuration'][_0x8c47('0x42')]({'where':{'id':_0x3003fe[_0x8c47('0x45')]['id']}})[_0x8c47('0x23')](handleEntityNotFound(_0x2751fe,null))[_0x8c47('0x23')](saveUpdates(_0x3003fe[_0x8c47('0x44')],null))[_0x8c47('0x23')](respondWithResult(_0x2751fe,null))[_0x8c47('0x40')](handleError(_0x2751fe,null));};exports[_0x8c47('0x22')]=function(_0x23381c,_0xce2c3){return db[_0x8c47('0x29')]['find']({'where':{'id':_0x23381c[_0x8c47('0x45')]['id']}})[_0x8c47('0x23')](handleEntityNotFound(_0xce2c3,null))[_0x8c47('0x23')](removeEntity(_0xce2c3,null))[_0x8c47('0x40')](handleError(_0xce2c3,null));};exports['getFields']=function(_0x3e769a,_0x473b90,_0x49c4cf){var _0x28bbe5={};var _0x1a64ed={};var _0x22de7a;var _0x4767e2;return db[_0x8c47('0x29')]['findOne']({'where':{'id':_0x3e769a[_0x8c47('0x45')]['id']}})[_0x8c47('0x23')](handleEntityNotFound(_0x473b90,null))[_0x8c47('0x23')](function(_0x4f9fc1){if(_0x4f9fc1){_0x22de7a=_0x4f9fc1;_0x1a64ed[_0x8c47('0x2d')]=_[_0x8c47('0x30')](db[_0x8c47('0x46')][_0x8c47('0x2a')]);_0x1a64ed[_0x8c47('0x2f')]=_[_0x8c47('0x30')](_0x3e769a['query']);_0x1a64ed[_0x8c47('0x39')]=_['intersection'](_0x1a64ed[_0x8c47('0x2d')],_0x1a64ed[_0x8c47('0x2f')]);_0x28bbe5['attributes']=_[_0x8c47('0x31')](_0x1a64ed[_0x8c47('0x2d')],qs['fields'](_0x3e769a[_0x8c47('0x2f')][_0x8c47('0x32')]));_0x28bbe5[_0x8c47('0x33')]=_0x28bbe5[_0x8c47('0x33')][_0x8c47('0x34')]?_0x28bbe5[_0x8c47('0x33')]:_0x1a64ed[_0x8c47('0x2d')];_0x28bbe5[_0x8c47('0x36')]=qs[_0x8c47('0x37')](_0x3e769a[_0x8c47('0x2f')][_0x8c47('0x37')]);_0x28bbe5[_0x8c47('0x38')]=qs[_0x8c47('0x39')](_[_0x8c47('0x3a')](_0x3e769a[_0x8c47('0x2f')],_0x1a64ed[_0x8c47('0x39')]));if(_0x3e769a['query'][_0x8c47('0x3b')]){_0x28bbe5[_0x8c47('0x38')]=_[_0x8c47('0x3c')](_0x28bbe5[_0x8c47('0x38')],{'$or':_[_0x8c47('0x2e')](_0x28bbe5[_0x8c47('0x33')],function(_0x48a33a){var _0xfc91a={};_0xfc91a[_0x48a33a]={'$like':'%'+_0x3e769a[_0x8c47('0x2f')][_0x8c47('0x3b')]+'%'};return _0xfc91a;})});}_0x28bbe5=_[_0x8c47('0x3c')]({},_0x28bbe5,_0x3e769a[_0x8c47('0x47')]);return _0x22de7a[_0x8c47('0x48')](_0x28bbe5);}})[_0x8c47('0x23')](function(_0x3c3d89){if(_0x3c3d89){_0x4767e2=_0x3c3d89[_0x8c47('0x34')];if(!_0x3e769a[_0x8c47('0x2f')][_0x8c47('0x35')](_0x8c47('0x49'))){_0x28bbe5[_0x8c47('0x1c')]=qs[_0x8c47('0x1c')](_0x3e769a[_0x8c47('0x2f')][_0x8c47('0x1c')]);_0x28bbe5[_0x8c47('0x1f')]=qs[_0x8c47('0x1f')](_0x3e769a['query'][_0x8c47('0x1f')]);}return _0x22de7a['getFields'](_0x28bbe5);}})[_0x8c47('0x23')](function(_0x1d8dad){if(_0x1d8dad){return _0x1d8dad?{'count':_0x4767e2,'rows':_0x1d8dad}:null;}})['then'](respondWithResult(_0x473b90,null))[_0x8c47('0x40')](handleError(_0x473b90,null));};exports['getSubjects']=function(_0x3342f3,_0x33e879,_0x136943){var _0x444806={};var _0x4a7cab={};var _0x15ac76;var _0x4bbd71;return db[_0x8c47('0x29')][_0x8c47('0x4a')]({'where':{'id':_0x3342f3['params']['id']}})[_0x8c47('0x23')](handleEntityNotFound(_0x33e879,null))['then'](function(_0x42482a){if(_0x42482a){_0x15ac76=_0x42482a;_0x4a7cab[_0x8c47('0x2d')]=_[_0x8c47('0x30')](db['Dynamics365Field']['rawAttributes']);_0x4a7cab['query']=_['keys'](_0x3342f3[_0x8c47('0x2f')]);_0x4a7cab['filters']=_[_0x8c47('0x31')](_0x4a7cab[_0x8c47('0x2d')],_0x4a7cab[_0x8c47('0x2f')]);_0x444806[_0x8c47('0x33')]=_[_0x8c47('0x31')](_0x4a7cab[_0x8c47('0x2d')],qs[_0x8c47('0x32')](_0x3342f3[_0x8c47('0x2f')][_0x8c47('0x32')]));_0x444806[_0x8c47('0x33')]=_0x444806[_0x8c47('0x33')][_0x8c47('0x34')]?_0x444806[_0x8c47('0x33')]:_0x4a7cab[_0x8c47('0x2d')];_0x444806[_0x8c47('0x36')]=qs[_0x8c47('0x37')](_0x3342f3[_0x8c47('0x2f')][_0x8c47('0x37')]);_0x444806['where']=qs['filters'](_[_0x8c47('0x3a')](_0x3342f3[_0x8c47('0x2f')],_0x4a7cab[_0x8c47('0x39')]));if(_0x3342f3[_0x8c47('0x2f')][_0x8c47('0x3b')]){_0x444806[_0x8c47('0x38')]=_[_0x8c47('0x3c')](_0x444806[_0x8c47('0x38')],{'$or':_['map'](_0x444806[_0x8c47('0x33')],function(_0x35091e){var _0x3967d5={};_0x3967d5[_0x35091e]={'$like':'%'+_0x3342f3[_0x8c47('0x2f')][_0x8c47('0x3b')]+'%'};return _0x3967d5;})});}_0x444806=_[_0x8c47('0x3c')]({},_0x444806,_0x3342f3[_0x8c47('0x47')]);return _0x15ac76[_0x8c47('0x4b')](_0x444806);}})[_0x8c47('0x23')](function(_0x5ac41e){if(_0x5ac41e){_0x4bbd71=_0x5ac41e['length'];if(!_0x3342f3[_0x8c47('0x2f')][_0x8c47('0x35')](_0x8c47('0x49'))){_0x444806[_0x8c47('0x1c')]=qs['limit'](_0x3342f3['query']['limit']);_0x444806[_0x8c47('0x1f')]=qs[_0x8c47('0x1f')](_0x3342f3[_0x8c47('0x2f')][_0x8c47('0x1f')]);}return _0x15ac76[_0x8c47('0x4b')](_0x444806);}})[_0x8c47('0x23')](function(_0x5d5384){if(_0x5d5384){return _0x5d5384?{'count':_0x4bbd71,'rows':_0x5d5384}:null;}})['then'](respondWithResult(_0x33e879,null))['catch'](handleError(_0x33e879,null));};exports[_0x8c47('0x4c')]=function(_0xf9baff,_0x2de2ae,_0x3b4031){var _0xbd2318={};var _0x1900b1={};var _0x5f5cc9;var _0x4bd74f;return db[_0x8c47('0x29')][_0x8c47('0x4a')]({'where':{'id':_0xf9baff['params']['id']}})['then'](handleEntityNotFound(_0x2de2ae,null))['then'](function(_0x11416d){if(_0x11416d){_0x5f5cc9=_0x11416d;_0x1900b1['model']=_[_0x8c47('0x30')](db[_0x8c47('0x46')]['rawAttributes']);_0x1900b1[_0x8c47('0x2f')]=_[_0x8c47('0x30')](_0xf9baff[_0x8c47('0x2f')]);_0x1900b1[_0x8c47('0x39')]=_[_0x8c47('0x31')](_0x1900b1['model'],_0x1900b1[_0x8c47('0x2f')]);_0xbd2318[_0x8c47('0x33')]=_[_0x8c47('0x31')](_0x1900b1[_0x8c47('0x2d')],qs[_0x8c47('0x32')](_0xf9baff['query'][_0x8c47('0x32')]));_0xbd2318[_0x8c47('0x33')]=_0xbd2318[_0x8c47('0x33')][_0x8c47('0x34')]?_0xbd2318[_0x8c47('0x33')]:_0x1900b1['model'];_0xbd2318[_0x8c47('0x36')]=qs[_0x8c47('0x37')](_0xf9baff[_0x8c47('0x2f')][_0x8c47('0x37')]);_0xbd2318[_0x8c47('0x38')]=qs[_0x8c47('0x39')](_[_0x8c47('0x3a')](_0xf9baff[_0x8c47('0x2f')],_0x1900b1['filters']));if(_0xf9baff[_0x8c47('0x2f')][_0x8c47('0x3b')]){_0xbd2318[_0x8c47('0x38')]=_[_0x8c47('0x3c')](_0xbd2318[_0x8c47('0x38')],{'$or':_[_0x8c47('0x2e')](_0xbd2318[_0x8c47('0x33')],function(_0x2499c5){var _0x437f56={};_0x437f56[_0x2499c5]={'$like':'%'+_0xf9baff[_0x8c47('0x2f')][_0x8c47('0x3b')]+'%'};return _0x437f56;})});}_0xbd2318=_['merge']({},_0xbd2318,_0xf9baff[_0x8c47('0x47')]);return _0x5f5cc9['getDescriptions'](_0xbd2318);}})[_0x8c47('0x23')](function(_0x153801){if(_0x153801){_0x4bd74f=_0x153801[_0x8c47('0x34')];if(!_0xf9baff['query']['hasOwnProperty'](_0x8c47('0x49'))){_0xbd2318['limit']=qs[_0x8c47('0x1c')](_0xf9baff['query'][_0x8c47('0x1c')]);_0xbd2318['offset']=qs['offset'](_0xf9baff['query']['offset']);}return _0x5f5cc9[_0x8c47('0x4c')](_0xbd2318);}})[_0x8c47('0x23')](function(_0x43026f){if(_0x43026f){return _0x43026f?{'count':_0x4bd74f,'rows':_0x43026f}:null;}})[_0x8c47('0x23')](respondWithResult(_0x2de2ae,null))[_0x8c47('0x40')](handleError(_0x2de2ae,null));}; \ No newline at end of file +var _0xdbb0=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','reject','save','update','then','destroy','error','stack','name','map','Dynamics365Configuration'];(function(_0x27dae9,_0xb8e12f){var _0x1e6fe3=function(_0x352a25){while(--_0x352a25){_0x27dae9['push'](_0x27dae9['shift']());}};_0x1e6fe3(++_0xb8e12f);}(_0xdbb0,0x107));var _0x0dbb=function(_0x1453e3,_0x132953){_0x1453e3=_0x1453e3-0x0;var _0x236f5b=_0xdbb0[_0x1453e3];return _0x236f5b;};'use strict';var emlformat=require(_0x0dbb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0dbb('0x1'));var rp=require(_0x0dbb('0x2'));var moment=require(_0x0dbb('0x3'));var BPromise=require(_0x0dbb('0x4'));var Mustache=require(_0x0dbb('0x5'));var util=require(_0x0dbb('0x6'));var path=require(_0x0dbb('0x7'));var sox=require(_0x0dbb('0x8'));var csv=require(_0x0dbb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0dbb('0xa'));var squel=require('squel');var crypto=require(_0x0dbb('0xb'));var jsforce=require(_0x0dbb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0dbb('0x9'));var querystring=require('querystring');var Papa=require(_0x0dbb('0xd'));var Redis=require(_0x0dbb('0xe'));var authService=require(_0x0dbb('0xf'));var qs=require(_0x0dbb('0x10'));var as=require(_0x0dbb('0x11'));var hardwareService=require(_0x0dbb('0x12'));var logger=require('../../config/logger')(_0x0dbb('0x13'));var utils=require(_0x0dbb('0x14'));var config=require(_0x0dbb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dbb('0x16'))['db'];function respondWithStatusCode(_0x52c3d2,_0x7ae461){_0x7ae461=_0x7ae461||0xcc;return function(_0x1958b8){if(_0x1958b8){return _0x52c3d2[_0x0dbb('0x17')](_0x7ae461);}return _0x52c3d2[_0x0dbb('0x18')](_0x7ae461)[_0x0dbb('0x19')]();};}function respondWithResult(_0x44f326,_0x5eaf34){_0x5eaf34=_0x5eaf34||0xc8;return function(_0x58721d){if(_0x58721d){return _0x44f326[_0x0dbb('0x18')](_0x5eaf34)[_0x0dbb('0x1a')](_0x58721d);}};}function respondWithFilteredResult(_0x21c009,_0x2b9b22){return function(_0x3098b0){if(_0x3098b0){var _0x51479f=typeof _0x2b9b22['offset']===_0x0dbb('0x1b')&&typeof _0x2b9b22[_0x0dbb('0x1c')]===_0x0dbb('0x1b');var _0xa3f938=_0x3098b0[_0x0dbb('0x1d')];var _0x53d286=_0x51479f?0x0:_0x2b9b22['offset'];var _0x31ee5a=_0x51479f?_0x3098b0[_0x0dbb('0x1d')]:_0x2b9b22[_0x0dbb('0x1e')]+_0x2b9b22[_0x0dbb('0x1c')];var _0x5ef5db;if(_0x31ee5a>=_0xa3f938){_0x31ee5a=_0xa3f938;_0x5ef5db=0xc8;}else{_0x5ef5db=0xce;}_0x21c009[_0x0dbb('0x18')](_0x5ef5db);return _0x21c009['set']('Content-Range',_0x53d286+'-'+_0x31ee5a+'/'+_0xa3f938)[_0x0dbb('0x1a')](_0x3098b0);}return null;};}function patchUpdates(_0x32c04b){return function(_0x3d04b9){try{jsonpatch['apply'](_0x3d04b9,_0x32c04b,!![]);}catch(_0x164237){return BPromise[_0x0dbb('0x1f')](_0x164237);}return _0x3d04b9[_0x0dbb('0x20')]();};}function saveUpdates(_0x135004,_0x2ce9a7){return function(_0x4a5f19){if(_0x4a5f19){return _0x4a5f19[_0x0dbb('0x21')](_0x135004)[_0x0dbb('0x22')](function(_0x4be94a){return _0x4be94a;});}return null;};}function removeEntity(_0x3c19b0,_0x2df886){return function(_0x380214){if(_0x380214){return _0x380214[_0x0dbb('0x23')]()[_0x0dbb('0x22')](function(){_0x3c19b0[_0x0dbb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28e0d6,_0x3e4a93){return function(_0x108136){if(!_0x108136){_0x28e0d6[_0x0dbb('0x17')](0x194);}return _0x108136;};}function handleError(_0x4548ff,_0x4fc952){_0x4fc952=_0x4fc952||0x1f4;return function(_0x199791){logger[_0x0dbb('0x24')](_0x199791[_0x0dbb('0x25')]);if(_0x199791[_0x0dbb('0x26')]){delete _0x199791[_0x0dbb('0x26')];}_0x4548ff[_0x0dbb('0x18')](_0x4fc952)['send'](_0x199791);};}exports['index']=function(_0x3bf471,_0x34f81b){var _0x565616={},_0x1e6c61={},_0x49ad66={'count':0x0,'rows':[]};var _0x220487=_[_0x0dbb('0x27')](db[_0x0dbb('0x28')][_0x0dbb('0x29')],function(_0x3fae2c){return{'name':_0x3fae2c[_0x0dbb('0x2a')],'type':_0x3fae2c[_0x0dbb('0x2b')][_0x0dbb('0x2c')]};});_0x1e6c61[_0x0dbb('0x2d')]=_[_0x0dbb('0x27')](_0x220487,_0x0dbb('0x26'));_0x1e6c61[_0x0dbb('0x2e')]=_['keys'](_0x3bf471[_0x0dbb('0x2e')]);_0x1e6c61[_0x0dbb('0x2f')]=_[_0x0dbb('0x30')](_0x1e6c61[_0x0dbb('0x2d')],_0x1e6c61[_0x0dbb('0x2e')]);_0x565616[_0x0dbb('0x31')]=_[_0x0dbb('0x30')](_0x1e6c61['model'],qs[_0x0dbb('0x32')](_0x3bf471['query'][_0x0dbb('0x32')]));_0x565616[_0x0dbb('0x31')]=_0x565616[_0x0dbb('0x31')][_0x0dbb('0x33')]?_0x565616[_0x0dbb('0x31')]:_0x1e6c61[_0x0dbb('0x2d')];if(!_0x3bf471[_0x0dbb('0x2e')][_0x0dbb('0x34')](_0x0dbb('0x35'))){_0x565616[_0x0dbb('0x1c')]=qs[_0x0dbb('0x1c')](_0x3bf471[_0x0dbb('0x2e')]['limit']);_0x565616[_0x0dbb('0x1e')]=qs[_0x0dbb('0x1e')](_0x3bf471[_0x0dbb('0x2e')][_0x0dbb('0x1e')]);}_0x565616[_0x0dbb('0x36')]=qs[_0x0dbb('0x37')](_0x3bf471['query'][_0x0dbb('0x37')]);_0x565616[_0x0dbb('0x38')]=qs[_0x0dbb('0x2f')](_[_0x0dbb('0x39')](_0x3bf471[_0x0dbb('0x2e')],_0x1e6c61['filters']),_0x220487);if(_0x3bf471[_0x0dbb('0x2e')][_0x0dbb('0x3a')]){_0x565616[_0x0dbb('0x38')]=_[_0x0dbb('0x3b')](_0x565616[_0x0dbb('0x38')],{'$or':_['map'](_0x220487,function(_0x5818f0){if(_0x5818f0[_0x0dbb('0x2b')]!=='VIRTUAL'){var _0xde0ff6={};_0xde0ff6[_0x5818f0['name']]={'$like':'%'+_0x3bf471['query'][_0x0dbb('0x3a')]+'%'};return _0xde0ff6;}})});}_0x565616=_[_0x0dbb('0x3b')]({},_0x565616,_0x3bf471[_0x0dbb('0x3c')]);var _0x444736={'where':_0x565616[_0x0dbb('0x38')]};return db['Dynamics365Configuration'][_0x0dbb('0x1d')](_0x444736)[_0x0dbb('0x22')](function(_0x150516){_0x49ad66[_0x0dbb('0x1d')]=_0x150516;if(_0x3bf471[_0x0dbb('0x2e')][_0x0dbb('0x3d')]){_0x565616[_0x0dbb('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x565616);})[_0x0dbb('0x22')](function(_0x31511d){_0x49ad66[_0x0dbb('0x3f')]=_0x31511d;return _0x49ad66;})[_0x0dbb('0x22')](respondWithFilteredResult(_0x34f81b,_0x565616))[_0x0dbb('0x40')](handleError(_0x34f81b,null));};exports[_0x0dbb('0x41')]=function(_0x380274,_0x570eee){var _0xc5a236={'raw':![],'where':{'id':_0x380274[_0x0dbb('0x42')]['id']}},_0x350883={};_0x350883[_0x0dbb('0x2d')]=_['keys'](db[_0x0dbb('0x28')][_0x0dbb('0x29')]);_0x350883[_0x0dbb('0x2e')]=_[_0x0dbb('0x43')](_0x380274['query']);_0x350883[_0x0dbb('0x2f')]=_['intersection'](_0x350883[_0x0dbb('0x2d')],_0x350883[_0x0dbb('0x2e')]);_0xc5a236[_0x0dbb('0x31')]=_[_0x0dbb('0x30')](_0x350883[_0x0dbb('0x2d')],qs[_0x0dbb('0x32')](_0x380274[_0x0dbb('0x2e')][_0x0dbb('0x32')]));_0xc5a236[_0x0dbb('0x31')]=_0xc5a236[_0x0dbb('0x31')]['length']?_0xc5a236['attributes']:_0x350883[_0x0dbb('0x2d')];if(_0x380274[_0x0dbb('0x2e')]['includeAll']){_0xc5a236[_0x0dbb('0x3e')]=[{'all':!![]}];}_0xc5a236=_['merge']({},_0xc5a236,_0x380274[_0x0dbb('0x3c')]);return db['Dynamics365Configuration'][_0x0dbb('0x44')](_0xc5a236)[_0x0dbb('0x22')](handleEntityNotFound(_0x570eee,null))[_0x0dbb('0x22')](respondWithResult(_0x570eee,null))[_0x0dbb('0x40')](handleError(_0x570eee,null));};exports[_0x0dbb('0x45')]=function(_0x2acb25,_0x4dcc0b){return db[_0x0dbb('0x28')][_0x0dbb('0x45')](_0x2acb25[_0x0dbb('0x46')],{})[_0x0dbb('0x22')](respondWithResult(_0x4dcc0b,0xc9))[_0x0dbb('0x40')](handleError(_0x4dcc0b,null));};exports[_0x0dbb('0x21')]=function(_0x1f8c5e,_0x20821f){if(_0x1f8c5e[_0x0dbb('0x46')]['id']){delete _0x1f8c5e[_0x0dbb('0x46')]['id'];}return db['Dynamics365Configuration'][_0x0dbb('0x44')]({'where':{'id':_0x1f8c5e[_0x0dbb('0x42')]['id']}})['then'](handleEntityNotFound(_0x20821f,null))[_0x0dbb('0x22')](saveUpdates(_0x1f8c5e[_0x0dbb('0x46')],null))[_0x0dbb('0x22')](respondWithResult(_0x20821f,null))[_0x0dbb('0x40')](handleError(_0x20821f,null));};exports[_0x0dbb('0x23')]=function(_0x27d05f,_0x3a752a){return db['Dynamics365Configuration']['find']({'where':{'id':_0x27d05f[_0x0dbb('0x42')]['id']}})[_0x0dbb('0x22')](handleEntityNotFound(_0x3a752a,null))['then'](removeEntity(_0x3a752a,null))[_0x0dbb('0x40')](handleError(_0x3a752a,null));};exports[_0x0dbb('0x47')]=function(_0x4ef1b5,_0xf771c9,_0x1fc9c9){var _0x455a0a={};var _0x324615={};var _0x3df1ee;var _0x2115d0;return db['Dynamics365Configuration'][_0x0dbb('0x48')]({'where':{'id':_0x4ef1b5[_0x0dbb('0x42')]['id']}})[_0x0dbb('0x22')](handleEntityNotFound(_0xf771c9,null))[_0x0dbb('0x22')](function(_0x502af7){if(_0x502af7){_0x3df1ee=_0x502af7;_0x324615[_0x0dbb('0x2d')]=_[_0x0dbb('0x43')](db[_0x0dbb('0x49')][_0x0dbb('0x29')]);_0x324615[_0x0dbb('0x2e')]=_[_0x0dbb('0x43')](_0x4ef1b5[_0x0dbb('0x2e')]);_0x324615[_0x0dbb('0x2f')]=_[_0x0dbb('0x30')](_0x324615['model'],_0x324615[_0x0dbb('0x2e')]);_0x455a0a['attributes']=_[_0x0dbb('0x30')](_0x324615[_0x0dbb('0x2d')],qs['fields'](_0x4ef1b5[_0x0dbb('0x2e')][_0x0dbb('0x32')]));_0x455a0a[_0x0dbb('0x31')]=_0x455a0a[_0x0dbb('0x31')][_0x0dbb('0x33')]?_0x455a0a[_0x0dbb('0x31')]:_0x324615[_0x0dbb('0x2d')];_0x455a0a['order']=qs['sort'](_0x4ef1b5[_0x0dbb('0x2e')]['sort']);_0x455a0a[_0x0dbb('0x38')]=qs['filters'](_['pick'](_0x4ef1b5[_0x0dbb('0x2e')],_0x324615['filters']));if(_0x4ef1b5[_0x0dbb('0x2e')][_0x0dbb('0x3a')]){_0x455a0a[_0x0dbb('0x38')]=_[_0x0dbb('0x3b')](_0x455a0a[_0x0dbb('0x38')],{'$or':_['map'](_0x455a0a[_0x0dbb('0x31')],function(_0x12f97a){var _0xff23a7={};_0xff23a7[_0x12f97a]={'$like':'%'+_0x4ef1b5[_0x0dbb('0x2e')][_0x0dbb('0x3a')]+'%'};return _0xff23a7;})});}_0x455a0a=_[_0x0dbb('0x3b')]({},_0x455a0a,_0x4ef1b5[_0x0dbb('0x3c')]);return _0x3df1ee['getFields'](_0x455a0a);}})[_0x0dbb('0x22')](function(_0x300a2e){if(_0x300a2e){_0x2115d0=_0x300a2e['length'];if(!_0x4ef1b5[_0x0dbb('0x2e')]['hasOwnProperty'](_0x0dbb('0x35'))){_0x455a0a[_0x0dbb('0x1c')]=qs[_0x0dbb('0x1c')](_0x4ef1b5[_0x0dbb('0x2e')][_0x0dbb('0x1c')]);_0x455a0a[_0x0dbb('0x1e')]=qs['offset'](_0x4ef1b5['query'][_0x0dbb('0x1e')]);}return _0x3df1ee[_0x0dbb('0x47')](_0x455a0a);}})[_0x0dbb('0x22')](function(_0x5d2999){if(_0x5d2999){return _0x5d2999?{'count':_0x2115d0,'rows':_0x5d2999}:null;}})['then'](respondWithResult(_0xf771c9,null))[_0x0dbb('0x40')](handleError(_0xf771c9,null));};exports[_0x0dbb('0x4a')]=function(_0x2e96e5,_0x1f6d0a,_0x2321c8){var _0x333ebf={};var _0x5f49fe={};var _0x896f94;var _0x3b7cf3;return db[_0x0dbb('0x28')]['findOne']({'where':{'id':_0x2e96e5[_0x0dbb('0x42')]['id']}})[_0x0dbb('0x22')](handleEntityNotFound(_0x1f6d0a,null))[_0x0dbb('0x22')](function(_0x11d70d){if(_0x11d70d){_0x896f94=_0x11d70d;_0x5f49fe[_0x0dbb('0x2d')]=_[_0x0dbb('0x43')](db[_0x0dbb('0x49')]['rawAttributes']);_0x5f49fe[_0x0dbb('0x2e')]=_[_0x0dbb('0x43')](_0x2e96e5[_0x0dbb('0x2e')]);_0x5f49fe[_0x0dbb('0x2f')]=_[_0x0dbb('0x30')](_0x5f49fe[_0x0dbb('0x2d')],_0x5f49fe[_0x0dbb('0x2e')]);_0x333ebf[_0x0dbb('0x31')]=_[_0x0dbb('0x30')](_0x5f49fe[_0x0dbb('0x2d')],qs[_0x0dbb('0x32')](_0x2e96e5[_0x0dbb('0x2e')][_0x0dbb('0x32')]));_0x333ebf[_0x0dbb('0x31')]=_0x333ebf[_0x0dbb('0x31')]['length']?_0x333ebf[_0x0dbb('0x31')]:_0x5f49fe[_0x0dbb('0x2d')];_0x333ebf[_0x0dbb('0x36')]=qs[_0x0dbb('0x37')](_0x2e96e5[_0x0dbb('0x2e')]['sort']);_0x333ebf[_0x0dbb('0x38')]=qs[_0x0dbb('0x2f')](_[_0x0dbb('0x39')](_0x2e96e5[_0x0dbb('0x2e')],_0x5f49fe[_0x0dbb('0x2f')]));if(_0x2e96e5[_0x0dbb('0x2e')]['filter']){_0x333ebf[_0x0dbb('0x38')]=_[_0x0dbb('0x3b')](_0x333ebf[_0x0dbb('0x38')],{'$or':_[_0x0dbb('0x27')](_0x333ebf[_0x0dbb('0x31')],function(_0x26d790){var _0xc1547d={};_0xc1547d[_0x26d790]={'$like':'%'+_0x2e96e5[_0x0dbb('0x2e')][_0x0dbb('0x3a')]+'%'};return _0xc1547d;})});}_0x333ebf=_[_0x0dbb('0x3b')]({},_0x333ebf,_0x2e96e5['options']);return _0x896f94[_0x0dbb('0x4a')](_0x333ebf);}})[_0x0dbb('0x22')](function(_0x20b72f){if(_0x20b72f){_0x3b7cf3=_0x20b72f[_0x0dbb('0x33')];if(!_0x2e96e5['query'][_0x0dbb('0x34')](_0x0dbb('0x35'))){_0x333ebf[_0x0dbb('0x1c')]=qs[_0x0dbb('0x1c')](_0x2e96e5[_0x0dbb('0x2e')][_0x0dbb('0x1c')]);_0x333ebf['offset']=qs['offset'](_0x2e96e5[_0x0dbb('0x2e')][_0x0dbb('0x1e')]);}return _0x896f94[_0x0dbb('0x4a')](_0x333ebf);}})[_0x0dbb('0x22')](function(_0xa9d6c8){if(_0xa9d6c8){return _0xa9d6c8?{'count':_0x3b7cf3,'rows':_0xa9d6c8}:null;}})[_0x0dbb('0x22')](respondWithResult(_0x1f6d0a,null))[_0x0dbb('0x40')](handleError(_0x1f6d0a,null));};exports[_0x0dbb('0x4b')]=function(_0x57f865,_0x4fefe2,_0x46c89a){var _0x3a6da5={};var _0x458c14={};var _0x41e771;var _0x57978b;return db['Dynamics365Configuration'][_0x0dbb('0x48')]({'where':{'id':_0x57f865['params']['id']}})['then'](handleEntityNotFound(_0x4fefe2,null))[_0x0dbb('0x22')](function(_0x5f4b62){if(_0x5f4b62){_0x41e771=_0x5f4b62;_0x458c14[_0x0dbb('0x2d')]=_[_0x0dbb('0x43')](db[_0x0dbb('0x49')][_0x0dbb('0x29')]);_0x458c14[_0x0dbb('0x2e')]=_[_0x0dbb('0x43')](_0x57f865[_0x0dbb('0x2e')]);_0x458c14[_0x0dbb('0x2f')]=_[_0x0dbb('0x30')](_0x458c14[_0x0dbb('0x2d')],_0x458c14[_0x0dbb('0x2e')]);_0x3a6da5[_0x0dbb('0x31')]=_[_0x0dbb('0x30')](_0x458c14[_0x0dbb('0x2d')],qs[_0x0dbb('0x32')](_0x57f865[_0x0dbb('0x2e')][_0x0dbb('0x32')]));_0x3a6da5['attributes']=_0x3a6da5['attributes'][_0x0dbb('0x33')]?_0x3a6da5['attributes']:_0x458c14[_0x0dbb('0x2d')];_0x3a6da5[_0x0dbb('0x36')]=qs[_0x0dbb('0x37')](_0x57f865['query']['sort']);_0x3a6da5[_0x0dbb('0x38')]=qs['filters'](_[_0x0dbb('0x39')](_0x57f865[_0x0dbb('0x2e')],_0x458c14['filters']));if(_0x57f865['query']['filter']){_0x3a6da5[_0x0dbb('0x38')]=_[_0x0dbb('0x3b')](_0x3a6da5[_0x0dbb('0x38')],{'$or':_[_0x0dbb('0x27')](_0x3a6da5['attributes'],function(_0x2cbb77){var _0x2539df={};_0x2539df[_0x2cbb77]={'$like':'%'+_0x57f865['query'][_0x0dbb('0x3a')]+'%'};return _0x2539df;})});}_0x3a6da5=_[_0x0dbb('0x3b')]({},_0x3a6da5,_0x57f865[_0x0dbb('0x3c')]);return _0x41e771[_0x0dbb('0x4b')](_0x3a6da5);}})['then'](function(_0x5c29aa){if(_0x5c29aa){_0x57978b=_0x5c29aa[_0x0dbb('0x33')];if(!_0x57f865[_0x0dbb('0x2e')]['hasOwnProperty'](_0x0dbb('0x35'))){_0x3a6da5['limit']=qs[_0x0dbb('0x1c')](_0x57f865[_0x0dbb('0x2e')]['limit']);_0x3a6da5[_0x0dbb('0x1e')]=qs[_0x0dbb('0x1e')](_0x57f865[_0x0dbb('0x2e')][_0x0dbb('0x1e')]);}return _0x41e771['getDescriptions'](_0x3a6da5);}})[_0x0dbb('0x22')](function(_0x440556){if(_0x440556){return _0x440556?{'count':_0x57978b,'rows':_0x440556}:null;}})[_0x0dbb('0x22')](respondWithResult(_0x4fefe2,null))[_0x0dbb('0x40')](handleError(_0x4fefe2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index befd236..e38d1d0 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 _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xb842c5,_0xc01101){var _0x348f91=function(_0x1ab5b4){while(--_0x1ab5b4){_0xb842c5['push'](_0xb842c5['shift']());}};_0x348f91(++_0xc01101);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x4bd67a,_0x4f9725){_0x4bd67a=_0x4bd67a-0x0;var _0x2be5fb=_0xb4e6[_0x4bd67a];return _0x2be5fb;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf109=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x4f3262,_0x5d46a0){var _0x16bd21=function(_0xe9e282){while(--_0xe9e282){_0x4f3262['push'](_0x4f3262['shift']());}};_0x16bd21(++_0x5d46a0);}(_0xf109,0xce));var _0x9f10=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xf109[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index b678564..d7b9b5b 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 _0xf858=['Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xf858,0x11c));var _0x8f85=function(_0xc54a60,_0x4b0d42){_0xc54a60=_0xc54a60-0x0;var _0x5939de=_0xf858[_0xc54a60];return _0x5939de;};'use strict';var _=require(_0x8f85('0x0'));var util=require(_0x8f85('0x1'));var moment=require(_0x8f85('0x2'));var BPromise=require(_0x8f85('0x3'));var rs=require(_0x8f85('0x4'));var fs=require('fs');var Redis=require(_0x8f85('0x5'));var db=require(_0x8f85('0x6'))['db'];var utils=require(_0x8f85('0x7'));var logger=require(_0x8f85('0x8'))(_0x8f85('0x9'));var config=require(_0x8f85('0xa'));var jayson=require(_0x8f85('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x132fba,_0x38a05b,_0x5b1177){return new BPromise(function(_0x264c9a,_0x2d4fe6){return client[_0x8f85('0xc')](_0x132fba,_0x5b1177)[_0x8f85('0xd')](function(_0x369837){logger[_0x8f85('0xe')](_0x8f85('0xf'),_0x38a05b,'request\x20sent');logger['debug'](_0x8f85('0x10'),_0x38a05b,_0x8f85('0x11'),JSON[_0x8f85('0x12')](_0x369837));if(_0x369837[_0x8f85('0x13')]){if(_0x369837['error'][_0x8f85('0x14')]===0x1f4){logger[_0x8f85('0x13')](_0x8f85('0xf'),_0x38a05b,_0x369837['error'][_0x8f85('0x15')]);return _0x2d4fe6(_0x369837[_0x8f85('0x13')][_0x8f85('0x15')]);}logger['error'](_0x8f85('0xf'),_0x38a05b,_0x369837[_0x8f85('0x13')][_0x8f85('0x15')]);return _0x264c9a(_0x369837[_0x8f85('0x13')][_0x8f85('0x15')]);}else{logger[_0x8f85('0xe')](_0x8f85('0xf'),_0x38a05b,_0x8f85('0x11'));_0x264c9a(_0x369837[_0x8f85('0x16')][_0x8f85('0x15')]);}})['catch'](function(_0x182812){logger[_0x8f85('0x13')](_0x8f85('0xf'),_0x38a05b,_0x182812);_0x2d4fe6(_0x182812);});});} \ No newline at end of file +var _0x3609=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3a4a59,_0x10c41e){var _0x57b27d=function(_0x25bd50){while(--_0x25bd50){_0x3a4a59['push'](_0x3a4a59['shift']());}};_0x57b27d(++_0x10c41e);}(_0x3609,0x15c));var _0x9360=function(_0x22f162,_0x4ba754){_0x22f162=_0x22f162-0x0;var _0x203407=_0x3609[_0x22f162];return _0x203407;};'use strict';var _=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var moment=require(_0x9360('0x2'));var BPromise=require(_0x9360('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9360('0x4'));var db=require(_0x9360('0x5'))['db'];var utils=require(_0x9360('0x6'));var logger=require(_0x9360('0x7'))(_0x9360('0x8'));var config=require(_0x9360('0x9'));var jayson=require(_0x9360('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21942c,_0x3b0086,_0x10d12a){return new BPromise(function(_0x2f0cb6,_0xb3aa43){return client[_0x9360('0xb')](_0x21942c,_0x10d12a)[_0x9360('0xc')](function(_0xcc420d){logger[_0x9360('0xd')](_0x9360('0xe'),_0x3b0086,'request\x20sent');logger['debug'](_0x9360('0xf'),_0x3b0086,_0x9360('0x10'),JSON['stringify'](_0xcc420d));if(_0xcc420d['error']){if(_0xcc420d[_0x9360('0x11')][_0x9360('0x12')]===0x1f4){logger[_0x9360('0x11')](_0x9360('0xe'),_0x3b0086,_0xcc420d[_0x9360('0x11')][_0x9360('0x13')]);return _0xb3aa43(_0xcc420d[_0x9360('0x11')][_0x9360('0x13')]);}logger[_0x9360('0x11')](_0x9360('0xe'),_0x3b0086,_0xcc420d[_0x9360('0x11')]['message']);return _0x2f0cb6(_0xcc420d['error'][_0x9360('0x13')]);}else{logger[_0x9360('0xd')](_0x9360('0xe'),_0x3b0086,_0x9360('0x10'));_0x2f0cb6(_0xcc420d[_0x9360('0x14')][_0x9360('0x13')]);}})[_0x9360('0x15')](function(_0x3bbca2){logger[_0x9360('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3b0086,_0x3bbca2);_0xb3aa43(_0x3bbca2);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 94b58bd..172d608 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 _0x394f=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','post'];(function(_0x586885,_0x393c14){var _0x4f9133=function(_0x2d3c80){while(--_0x2d3c80){_0x586885['push'](_0x586885['shift']());}};_0x4f9133(++_0x393c14);}(_0x394f,0x181));var _0xf394=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x394f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf394('0x0'));var util=require(_0xf394('0x1'));var path=require('path');var timeout=require(_0xf394('0x2'));var express=require(_0xf394('0x3'));var router=express[_0xf394('0x4')]();var fs_extra=require(_0xf394('0x5'));var auth=require(_0xf394('0x6'));var interaction=require(_0xf394('0x7'));var config=require(_0xf394('0x8'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xf394('0x9')](),controller[_0xf394('0xa')]);router['get'](_0xf394('0xb'),auth[_0xf394('0x9')](),controller[_0xf394('0xc')]);router[_0xf394('0xd')]('/',auth[_0xf394('0x9')](),controller['create']);router[_0xf394('0xe')](_0xf394('0xb'),auth['isAuthenticated'](),controller[_0xf394('0xf')]);router[_0xf394('0x10')](_0xf394('0xb'),auth[_0xf394('0x9')](),controller[_0xf394('0x11')]);module[_0xf394('0x12')]=router; \ No newline at end of file +var _0x4037=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util'];(function(_0x2a2c4b,_0xb4f6d){var _0x82dbd9=function(_0x22c6cc){while(--_0x22c6cc){_0x2a2c4b['push'](_0x2a2c4b['shift']());}};_0x82dbd9(++_0xb4f6d);}(_0x4037,0x168));var _0x7403=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4037[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x7403('0x0'));var path=require(_0x7403('0x1'));var timeout=require(_0x7403('0x2'));var express=require('express');var router=express[_0x7403('0x3')]();var fs_extra=require(_0x7403('0x4'));var auth=require(_0x7403('0x5'));var interaction=require(_0x7403('0x6'));var config=require(_0x7403('0x7'));var controller=require(_0x7403('0x8'));router[_0x7403('0x9')]('/',auth[_0x7403('0xa')](),controller['index']);router[_0x7403('0x9')](_0x7403('0xb'),auth[_0x7403('0xa')](),controller[_0x7403('0xc')]);router[_0x7403('0xd')]('/',auth[_0x7403('0xa')](),controller[_0x7403('0xe')]);router[_0x7403('0xf')]('/:id',auth[_0x7403('0xa')](),controller[_0x7403('0x10')]);router[_0x7403('0x11')]('/:id',auth[_0x7403('0xa')](),controller['destroy']);module[_0x7403('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 919324e..8aee38d 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 _0x220d=['exports','string','keyValue','picklist','ENUM','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x3c3e72,_0x3e1858){var _0x48a7e5=function(_0x3d1c72){while(--_0x3d1c72){_0x3c3e72['push'](_0x3c3e72['shift']());}};_0x48a7e5(++_0x3e1858);}(_0x220d,0x15d));var _0xd220=function(_0x4768dc,_0x2f5014){_0x4768dc=_0x4768dc-0x0;var _0x1c75cc=_0x220d[_0x4768dc];return _0x1c75cc;};'use strict';var Sequelize=require(_0xd220('0x0'));module[_0xd220('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd220('0x2'),'variable','customVariable',_0xd220('0x3'),_0xd220('0x4')),'defaultValue':_0xd220('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd220('0x5')](_0xd220('0x2'),_0xd220('0x6'),_0xd220('0x7'))},'keyContent':{'type':Sequelize[_0xd220('0x8')]},'idField':{'type':Sequelize[_0xd220('0x8')]},'nameField':{'type':Sequelize[_0xd220('0x8')]},'customField':{'type':Sequelize[_0xd220('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd220('0x8')]}}; \ No newline at end of file +var _0xfc08=['variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','ENUM'];(function(_0x1bb7a1,_0x194bfc){var _0x17abcd=function(_0x108d8b){while(--_0x108d8b){_0x1bb7a1['push'](_0x1bb7a1['shift']());}};_0x17abcd(++_0x194bfc);}(_0xfc08,0x6f));var _0x8fc0=function(_0x17aa6e,_0x95b5df){_0x17aa6e=_0x17aa6e-0x0;var _0x305f54=_0xfc08[_0x17aa6e];return _0x305f54;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x8fc0('0x0')]('string',_0x8fc0('0x1'),_0x8fc0('0x2'),_0x8fc0('0x3'),_0x8fc0('0x4')),'defaultValue':_0x8fc0('0x5')},'content':{'type':Sequelize[_0x8fc0('0x6')]},'key':{'type':Sequelize[_0x8fc0('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x8fc0('0x1'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8fc0('0x6')]},'customField':{'type':Sequelize[_0x8fc0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8fc0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 683a03b..3dd2b56 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 _0x08cc=['Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x08cc,0x156));var _0xc08c=function(_0x4c4f1c,_0x273f15){_0x4c4f1c=_0x4c4f1c-0x0;var _0x253df0=_0x08cc[_0x4c4f1c];return _0x253df0;};'use strict';var emlformat=require(_0xc08c('0x0'));var rimraf=require(_0xc08c('0x1'));var zipdir=require(_0xc08c('0x2'));var jsonpatch=require(_0xc08c('0x3'));var rp=require(_0xc08c('0x4'));var moment=require(_0xc08c('0x5'));var BPromise=require(_0xc08c('0x6'));var Mustache=require(_0xc08c('0x7'));var util=require(_0xc08c('0x8'));var path=require('path');var sox=require(_0xc08c('0x9'));var csv=require(_0xc08c('0xa'));var ejs=require(_0xc08c('0xb'));var fs=require('fs');var fs_extra=require(_0xc08c('0xc'));var _=require(_0xc08c('0xd'));var squel=require(_0xc08c('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc08c('0xf'));var toCsv=require(_0xc08c('0xa'));var querystring=require(_0xc08c('0x10'));var Papa=require(_0xc08c('0x11'));var Redis=require(_0xc08c('0x12'));var authService=require(_0xc08c('0x13'));var qs=require(_0xc08c('0x14'));var as=require(_0xc08c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc08c('0x16'))(_0xc08c('0x17'));var utils=require(_0xc08c('0x18'));var config=require(_0xc08c('0x19'));var licenseUtil=require(_0xc08c('0x1a'));var db=require(_0xc08c('0x1b'))['db'];function respondWithStatusCode(_0x2f5108,_0x375e2d){_0x375e2d=_0x375e2d||0xcc;return function(_0x5ec839){if(_0x5ec839){return _0x2f5108['sendStatus'](_0x375e2d);}return _0x2f5108[_0xc08c('0x1c')](_0x375e2d)[_0xc08c('0x1d')]();};}function respondWithResult(_0x54ddac,_0x32f4a0){_0x32f4a0=_0x32f4a0||0xc8;return function(_0x55566a){if(_0x55566a){return _0x54ddac[_0xc08c('0x1c')](_0x32f4a0)['json'](_0x55566a);}};}function respondWithFilteredResult(_0x3aa18b,_0xbcfd0a){return function(_0x17cb57){if(_0x17cb57){var _0x3cb6bc=typeof _0xbcfd0a['offset']===_0xc08c('0x1e')&&typeof _0xbcfd0a[_0xc08c('0x1f')]===_0xc08c('0x1e');var _0x496c03=_0x17cb57[_0xc08c('0x20')];var _0x47e3b8=_0x3cb6bc?0x0:_0xbcfd0a['offset'];var _0x15cb30=_0x3cb6bc?_0x17cb57[_0xc08c('0x20')]:_0xbcfd0a[_0xc08c('0x21')]+_0xbcfd0a[_0xc08c('0x1f')];var _0x42ea97;if(_0x15cb30>=_0x496c03){_0x15cb30=_0x496c03;_0x42ea97=0xc8;}else{_0x42ea97=0xce;}_0x3aa18b[_0xc08c('0x1c')](_0x42ea97);return _0x3aa18b[_0xc08c('0x22')](_0xc08c('0x23'),_0x47e3b8+'-'+_0x15cb30+'/'+_0x496c03)[_0xc08c('0x24')](_0x17cb57);}return null;};}function patchUpdates(_0x3a397e){return function(_0x46499b){try{jsonpatch[_0xc08c('0x25')](_0x46499b,_0x3a397e,!![]);}catch(_0x261ad4){return BPromise['reject'](_0x261ad4);}return _0x46499b[_0xc08c('0x26')]();};}function saveUpdates(_0x4f1399,_0x3655a6){return function(_0x3b055b){if(_0x3b055b){return _0x3b055b[_0xc08c('0x27')](_0x4f1399)[_0xc08c('0x28')](function(_0x2df903){return _0x2df903;});}return null;};}function removeEntity(_0x411bab,_0x4cdf13){return function(_0x572e6e){if(_0x572e6e){return _0x572e6e[_0xc08c('0x29')]()[_0xc08c('0x28')](function(){_0x411bab[_0xc08c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b858,_0x1b85a7){return function(_0x4d08c4){if(!_0x4d08c4){_0x41b858[_0xc08c('0x2a')](0x194);}return _0x4d08c4;};}function handleError(_0x58c853,_0x41b951){_0x41b951=_0x41b951||0x1f4;return function(_0x511631){logger[_0xc08c('0x2b')](_0x511631[_0xc08c('0x2c')]);if(_0x511631[_0xc08c('0x2d')]){delete _0x511631[_0xc08c('0x2d')];}_0x58c853[_0xc08c('0x1c')](_0x41b951)['send'](_0x511631);};}exports[_0xc08c('0x2e')]=function(_0x4a2a67,_0x374a7d){var _0x4166ee={},_0x398d34={},_0x8ebdb6={'count':0x0,'rows':[]};var _0x12d2cf=_[_0xc08c('0x2f')](db[_0xc08c('0x30')][_0xc08c('0x31')],function(_0x388599){return{'name':_0x388599[_0xc08c('0x32')],'type':_0x388599[_0xc08c('0x33')][_0xc08c('0x34')]};});_0x398d34[_0xc08c('0x35')]=_[_0xc08c('0x2f')](_0x12d2cf,_0xc08c('0x2d'));_0x398d34[_0xc08c('0x36')]=_['keys'](_0x4a2a67[_0xc08c('0x36')]);_0x398d34[_0xc08c('0x37')]=_[_0xc08c('0x38')](_0x398d34[_0xc08c('0x35')],_0x398d34[_0xc08c('0x36')]);_0x4166ee[_0xc08c('0x39')]=_[_0xc08c('0x38')](_0x398d34[_0xc08c('0x35')],qs[_0xc08c('0x3a')](_0x4a2a67[_0xc08c('0x36')][_0xc08c('0x3a')]));_0x4166ee[_0xc08c('0x39')]=_0x4166ee['attributes'][_0xc08c('0x3b')]?_0x4166ee[_0xc08c('0x39')]:_0x398d34[_0xc08c('0x35')];if(!_0x4a2a67['query'][_0xc08c('0x3c')](_0xc08c('0x3d'))){_0x4166ee[_0xc08c('0x1f')]=qs['limit'](_0x4a2a67[_0xc08c('0x36')]['limit']);_0x4166ee[_0xc08c('0x21')]=qs['offset'](_0x4a2a67['query'][_0xc08c('0x21')]);}_0x4166ee[_0xc08c('0x3e')]=qs[_0xc08c('0x3f')](_0x4a2a67[_0xc08c('0x36')]['sort']);_0x4166ee[_0xc08c('0x40')]=qs[_0xc08c('0x37')](_['pick'](_0x4a2a67[_0xc08c('0x36')],_0x398d34[_0xc08c('0x37')]),_0x12d2cf);if(_0x4a2a67[_0xc08c('0x36')]['filter']){_0x4166ee['where']=_[_0xc08c('0x41')](_0x4166ee[_0xc08c('0x40')],{'$or':_[_0xc08c('0x2f')](_0x12d2cf,function(_0x4aaf13){if(_0x4aaf13[_0xc08c('0x33')]!=='VIRTUAL'){var _0x4fb4f9={};_0x4fb4f9[_0x4aaf13[_0xc08c('0x2d')]]={'$like':'%'+_0x4a2a67[_0xc08c('0x36')][_0xc08c('0x42')]+'%'};return _0x4fb4f9;}})});}_0x4166ee=_[_0xc08c('0x41')]({},_0x4166ee,_0x4a2a67[_0xc08c('0x43')]);var _0x404703={'where':_0x4166ee[_0xc08c('0x40')]};return db[_0xc08c('0x30')]['count'](_0x404703)[_0xc08c('0x28')](function(_0x2d5b4d){_0x8ebdb6[_0xc08c('0x20')]=_0x2d5b4d;if(_0x4a2a67[_0xc08c('0x36')]['includeAll']){_0x4166ee[_0xc08c('0x44')]=[{'all':!![]}];}return db[_0xc08c('0x30')][_0xc08c('0x45')](_0x4166ee);})[_0xc08c('0x28')](function(_0xba66f2){_0x8ebdb6['rows']=_0xba66f2;return _0x8ebdb6;})[_0xc08c('0x28')](respondWithFilteredResult(_0x374a7d,_0x4166ee))[_0xc08c('0x46')](handleError(_0x374a7d,null));};exports[_0xc08c('0x47')]=function(_0x1c248a,_0x47d6a4){var _0x5bb5f6={'raw':!![],'where':{'id':_0x1c248a[_0xc08c('0x48')]['id']}},_0x22932f={};_0x22932f[_0xc08c('0x35')]=_[_0xc08c('0x49')](db[_0xc08c('0x30')][_0xc08c('0x31')]);_0x22932f[_0xc08c('0x36')]=_[_0xc08c('0x49')](_0x1c248a['query']);_0x22932f[_0xc08c('0x37')]=_[_0xc08c('0x38')](_0x22932f['model'],_0x22932f['query']);_0x5bb5f6[_0xc08c('0x39')]=_[_0xc08c('0x38')](_0x22932f[_0xc08c('0x35')],qs[_0xc08c('0x3a')](_0x1c248a['query']['fields']));_0x5bb5f6[_0xc08c('0x39')]=_0x5bb5f6[_0xc08c('0x39')][_0xc08c('0x3b')]?_0x5bb5f6[_0xc08c('0x39')]:_0x22932f[_0xc08c('0x35')];if(_0x1c248a['query'][_0xc08c('0x4a')]){_0x5bb5f6['include']=[{'all':!![]}];}_0x5bb5f6=_['merge']({},_0x5bb5f6,_0x1c248a['options']);return db[_0xc08c('0x30')][_0xc08c('0x4b')](_0x5bb5f6)['then'](handleEntityNotFound(_0x47d6a4,null))['then'](respondWithResult(_0x47d6a4,null))[_0xc08c('0x46')](handleError(_0x47d6a4,null));};exports[_0xc08c('0x4c')]=function(_0x4646e8,_0x4f52b8){return db[_0xc08c('0x30')]['create'](_0x4646e8['body'],{})[_0xc08c('0x28')](respondWithResult(_0x4f52b8,0xc9))[_0xc08c('0x46')](handleError(_0x4f52b8,null));};exports[_0xc08c('0x27')]=function(_0x2061f6,_0x5e038e){if(_0x2061f6[_0xc08c('0x4d')]['id']){delete _0x2061f6[_0xc08c('0x4d')]['id'];}return db['Dynamics365Field'][_0xc08c('0x4b')]({'where':{'id':_0x2061f6[_0xc08c('0x48')]['id']}})[_0xc08c('0x28')](handleEntityNotFound(_0x5e038e,null))[_0xc08c('0x28')](saveUpdates(_0x2061f6['body'],null))[_0xc08c('0x28')](respondWithResult(_0x5e038e,null))['catch'](handleError(_0x5e038e,null));};exports[_0xc08c('0x29')]=function(_0x38a72c,_0x44ba49){return db[_0xc08c('0x30')]['find']({'where':{'id':_0x38a72c[_0xc08c('0x48')]['id']}})['then'](handleEntityNotFound(_0x44ba49,null))[_0xc08c('0x28')](removeEntity(_0x44ba49,null))[_0xc08c('0x46')](handleError(_0x44ba49,null));}; \ No newline at end of file +var _0x647a=['../../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','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x332d6d,_0xdf0025){var _0x55c3ff=function(_0x4cd60d){while(--_0x4cd60d){_0x332d6d['push'](_0x332d6d['shift']());}};_0x55c3ff(++_0xdf0025);}(_0x647a,0x1c6));var _0xa647=function(_0x140752,_0x3cc756){_0x140752=_0x140752-0x0;var _0x24de5b=_0x647a[_0x140752];return _0x24de5b;};'use strict';var emlformat=require(_0xa647('0x0'));var rimraf=require(_0xa647('0x1'));var zipdir=require(_0xa647('0x2'));var jsonpatch=require(_0xa647('0x3'));var rp=require(_0xa647('0x4'));var moment=require(_0xa647('0x5'));var BPromise=require(_0xa647('0x6'));var Mustache=require(_0xa647('0x7'));var util=require(_0xa647('0x8'));var path=require(_0xa647('0x9'));var sox=require(_0xa647('0xa'));var csv=require(_0xa647('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa647('0xc'));var crypto=require(_0xa647('0xd'));var jsforce=require(_0xa647('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa647('0xb'));var querystring=require(_0xa647('0xf'));var Papa=require(_0xa647('0x10'));var Redis=require(_0xa647('0x11'));var authService=require(_0xa647('0x12'));var qs=require(_0xa647('0x13'));var as=require(_0xa647('0x14'));var hardwareService=require(_0xa647('0x15'));var logger=require(_0xa647('0x16'))(_0xa647('0x17'));var utils=require(_0xa647('0x18'));var config=require(_0xa647('0x19'));var licenseUtil=require(_0xa647('0x1a'));var db=require(_0xa647('0x1b'))['db'];function respondWithStatusCode(_0x249a51,_0x316a31){_0x316a31=_0x316a31||0xcc;return function(_0x4b09ec){if(_0x4b09ec){return _0x249a51['sendStatus'](_0x316a31);}return _0x249a51[_0xa647('0x1c')](_0x316a31)[_0xa647('0x1d')]();};}function respondWithResult(_0x52755c,_0x3fa971){_0x3fa971=_0x3fa971||0xc8;return function(_0x2305e5){if(_0x2305e5){return _0x52755c[_0xa647('0x1c')](_0x3fa971)[_0xa647('0x1e')](_0x2305e5);}};}function respondWithFilteredResult(_0x5845e4,_0x317abe){return function(_0x388ea6){if(_0x388ea6){var _0x2fae3b=typeof _0x317abe[_0xa647('0x1f')]===_0xa647('0x20')&&typeof _0x317abe[_0xa647('0x21')]===_0xa647('0x20');var _0x321b30=_0x388ea6[_0xa647('0x22')];var _0x102fe8=_0x2fae3b?0x0:_0x317abe['offset'];var _0x1afaae=_0x2fae3b?_0x388ea6[_0xa647('0x22')]:_0x317abe['offset']+_0x317abe[_0xa647('0x21')];var _0x522a0b;if(_0x1afaae>=_0x321b30){_0x1afaae=_0x321b30;_0x522a0b=0xc8;}else{_0x522a0b=0xce;}_0x5845e4[_0xa647('0x1c')](_0x522a0b);return _0x5845e4[_0xa647('0x23')](_0xa647('0x24'),_0x102fe8+'-'+_0x1afaae+'/'+_0x321b30)[_0xa647('0x1e')](_0x388ea6);}return null;};}function patchUpdates(_0x415d6c){return function(_0x7a496b){try{jsonpatch[_0xa647('0x25')](_0x7a496b,_0x415d6c,!![]);}catch(_0x178d58){return BPromise[_0xa647('0x26')](_0x178d58);}return _0x7a496b[_0xa647('0x27')]();};}function saveUpdates(_0x1f2002,_0x4af712){return function(_0x33037c){if(_0x33037c){return _0x33037c[_0xa647('0x28')](_0x1f2002)[_0xa647('0x29')](function(_0x26e94d){return _0x26e94d;});}return null;};}function removeEntity(_0x4d696b,_0x5eab1d){return function(_0x171cde){if(_0x171cde){return _0x171cde[_0xa647('0x2a')]()['then'](function(){_0x4d696b['status'](0xcc)[_0xa647('0x1d')]();});}};}function handleEntityNotFound(_0x2e76d6,_0xa25d03){return function(_0x5a52df){if(!_0x5a52df){_0x2e76d6[_0xa647('0x2b')](0x194);}return _0x5a52df;};}function handleError(_0x28bcd9,_0x426053){_0x426053=_0x426053||0x1f4;return function(_0x1197a9){logger[_0xa647('0x2c')](_0x1197a9['stack']);if(_0x1197a9[_0xa647('0x2d')]){delete _0x1197a9[_0xa647('0x2d')];}_0x28bcd9['status'](_0x426053)['send'](_0x1197a9);};}exports['index']=function(_0x334f9d,_0x49ce73){var _0xd4b05a={},_0x4041e7={},_0x52520a={'count':0x0,'rows':[]};var _0x2117cc=_['map'](db[_0xa647('0x2e')][_0xa647('0x2f')],function(_0x510d34){return{'name':_0x510d34[_0xa647('0x30')],'type':_0x510d34[_0xa647('0x31')][_0xa647('0x32')]};});_0x4041e7[_0xa647('0x33')]=_[_0xa647('0x34')](_0x2117cc,_0xa647('0x2d'));_0x4041e7['query']=_[_0xa647('0x35')](_0x334f9d[_0xa647('0x36')]);_0x4041e7[_0xa647('0x37')]=_[_0xa647('0x38')](_0x4041e7[_0xa647('0x33')],_0x4041e7[_0xa647('0x36')]);_0xd4b05a[_0xa647('0x39')]=_[_0xa647('0x38')](_0x4041e7['model'],qs['fields'](_0x334f9d['query'][_0xa647('0x3a')]));_0xd4b05a[_0xa647('0x39')]=_0xd4b05a[_0xa647('0x39')][_0xa647('0x3b')]?_0xd4b05a[_0xa647('0x39')]:_0x4041e7[_0xa647('0x33')];if(!_0x334f9d['query']['hasOwnProperty'](_0xa647('0x3c'))){_0xd4b05a['limit']=qs['limit'](_0x334f9d[_0xa647('0x36')]['limit']);_0xd4b05a[_0xa647('0x1f')]=qs[_0xa647('0x1f')](_0x334f9d['query'][_0xa647('0x1f')]);}_0xd4b05a[_0xa647('0x3d')]=qs[_0xa647('0x3e')](_0x334f9d[_0xa647('0x36')][_0xa647('0x3e')]);_0xd4b05a['where']=qs['filters'](_[_0xa647('0x3f')](_0x334f9d['query'],_0x4041e7[_0xa647('0x37')]),_0x2117cc);if(_0x334f9d[_0xa647('0x36')][_0xa647('0x40')]){_0xd4b05a[_0xa647('0x41')]=_[_0xa647('0x42')](_0xd4b05a[_0xa647('0x41')],{'$or':_[_0xa647('0x34')](_0x2117cc,function(_0x1cbd8b){if(_0x1cbd8b[_0xa647('0x31')]!==_0xa647('0x43')){var _0x37cdc0={};_0x37cdc0[_0x1cbd8b[_0xa647('0x2d')]]={'$like':'%'+_0x334f9d['query'][_0xa647('0x40')]+'%'};return _0x37cdc0;}})});}_0xd4b05a=_[_0xa647('0x42')]({},_0xd4b05a,_0x334f9d[_0xa647('0x44')]);var _0x2079cb={'where':_0xd4b05a[_0xa647('0x41')]};return db[_0xa647('0x2e')][_0xa647('0x22')](_0x2079cb)[_0xa647('0x29')](function(_0x3faeea){_0x52520a[_0xa647('0x22')]=_0x3faeea;if(_0x334f9d[_0xa647('0x36')][_0xa647('0x45')]){_0xd4b05a[_0xa647('0x46')]=[{'all':!![]}];}return db[_0xa647('0x2e')][_0xa647('0x47')](_0xd4b05a);})[_0xa647('0x29')](function(_0x559740){_0x52520a[_0xa647('0x48')]=_0x559740;return _0x52520a;})['then'](respondWithFilteredResult(_0x49ce73,_0xd4b05a))[_0xa647('0x49')](handleError(_0x49ce73,null));};exports[_0xa647('0x4a')]=function(_0x3162ae,_0x2dd1ac){var _0x5908f9={'raw':!![],'where':{'id':_0x3162ae[_0xa647('0x4b')]['id']}},_0x3c343c={};_0x3c343c['model']=_[_0xa647('0x35')](db['Dynamics365Field']['rawAttributes']);_0x3c343c[_0xa647('0x36')]=_[_0xa647('0x35')](_0x3162ae['query']);_0x3c343c['filters']=_[_0xa647('0x38')](_0x3c343c['model'],_0x3c343c[_0xa647('0x36')]);_0x5908f9[_0xa647('0x39')]=_[_0xa647('0x38')](_0x3c343c[_0xa647('0x33')],qs[_0xa647('0x3a')](_0x3162ae[_0xa647('0x36')][_0xa647('0x3a')]));_0x5908f9[_0xa647('0x39')]=_0x5908f9[_0xa647('0x39')]['length']?_0x5908f9['attributes']:_0x3c343c[_0xa647('0x33')];if(_0x3162ae[_0xa647('0x36')][_0xa647('0x45')]){_0x5908f9[_0xa647('0x46')]=[{'all':!![]}];}_0x5908f9=_[_0xa647('0x42')]({},_0x5908f9,_0x3162ae[_0xa647('0x44')]);return db[_0xa647('0x2e')][_0xa647('0x4c')](_0x5908f9)[_0xa647('0x29')](handleEntityNotFound(_0x2dd1ac,null))['then'](respondWithResult(_0x2dd1ac,null))[_0xa647('0x49')](handleError(_0x2dd1ac,null));};exports['create']=function(_0x47df03,_0x4bb456){return db['Dynamics365Field'][_0xa647('0x4d')](_0x47df03['body'],{})[_0xa647('0x29')](respondWithResult(_0x4bb456,0xc9))['catch'](handleError(_0x4bb456,null));};exports[_0xa647('0x28')]=function(_0x417b37,_0x1dee2d){if(_0x417b37[_0xa647('0x4e')]['id']){delete _0x417b37[_0xa647('0x4e')]['id'];}return db[_0xa647('0x2e')][_0xa647('0x4c')]({'where':{'id':_0x417b37[_0xa647('0x4b')]['id']}})[_0xa647('0x29')](handleEntityNotFound(_0x1dee2d,null))[_0xa647('0x29')](saveUpdates(_0x417b37['body'],null))['then'](respondWithResult(_0x1dee2d,null))[_0xa647('0x49')](handleError(_0x1dee2d,null));};exports[_0xa647('0x2a')]=function(_0x26eb6c,_0x10b310){return db[_0xa647('0x2e')]['find']({'where':{'id':_0x26eb6c['params']['id']}})[_0xa647('0x29')](handleEntityNotFound(_0x10b310,null))[_0xa647('0x29')](removeEntity(_0x10b310,null))['catch'](handleError(_0x10b310,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 72774d8..796eaa9 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 _0xe9a9=['lodash','util','moment','bluebird','request-promise','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9a9,0x18c));var _0x9e9a=function(_0x3988e0,_0x1aea8e){_0x3988e0=_0x3988e0-0x0;var _0x5badee=_0xe9a9[_0x3988e0];return _0x5badee;};'use strict';var _=require(_0x9e9a('0x0'));var util=require(_0x9e9a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9e9a('0x2'));var BPromise=require(_0x9e9a('0x3'));var rp=require(_0x9e9a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e9a('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e9a('0x6'));module[_0x9e9a('0x7')]=function(_0x5abc48,_0x58bed0){return _0x5abc48['define'](_0x9e9a('0x8'),attributes,{'tableName':_0x9e9a('0x9'),'paranoid':![],'indexes':[{'name':_0x9e9a('0xa'),'fields':[_0x9e9a('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb913=['util','../../config/logger','moment','bluebird','path','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x168b2a,_0x56bc6b){var _0x1a95cd=function(_0x28737b){while(--_0x28737b){_0x168b2a['push'](_0x168b2a['shift']());}};_0x1a95cd(++_0x56bc6b);}(_0xb913,0x99));var _0x3b91=function(_0x391991,_0x191092){_0x391991=_0x391991-0x0;var _0x5f010d=_0xb913[_0x391991];return _0x5f010d;};'use strict';var _=require(_0x3b91('0x0'));var util=require(_0x3b91('0x1'));var logger=require(_0x3b91('0x2'))('api');var moment=require(_0x3b91('0x3'));var BPromise=require(_0x3b91('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b91('0x5'));var rimraf=require('rimraf');var config=require(_0x3b91('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0x3b91('0x7')]=function(_0x41625a,_0x577644){return _0x41625a[_0x3b91('0x8')](_0x3b91('0x9'),attributes,{'tableName':_0x3b91('0xa'),'paranoid':![],'indexes':[{'name':_0x3b91('0xb'),'fields':[_0x3b91('0xc'),_0x3b91('0xd')],'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 334ea5d..b9560f4 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 _0x445f=['rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x35d2b4,_0x37be04){var _0x36b0c1=function(_0x2245d8){while(--_0x2245d8){_0x35d2b4['push'](_0x35d2b4['shift']());}};_0x36b0c1(++_0x37be04);}(_0x445f,0x102));var _0xf445=function(_0x489187,_0x3f382b){_0x489187=_0x489187-0x0;var _0x4a332e=_0x445f[_0x489187];return _0x4a332e;};'use strict';var _=require(_0xf445('0x0'));var util=require(_0xf445('0x1'));var moment=require(_0xf445('0x2'));var BPromise=require('bluebird');var rs=require(_0xf445('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf445('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf445('0x5'))(_0xf445('0x6'));var config=require(_0xf445('0x7'));var jayson=require(_0xf445('0x8'));var client=jayson['client'][_0xf445('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17d321,_0x5e4e13,_0xd9f7b7){return new BPromise(function(_0x3e4899,_0x2936f8){return client[_0xf445('0xa')](_0x17d321,_0xd9f7b7)[_0xf445('0xb')](function(_0x551440){logger[_0xf445('0xc')](_0xf445('0xd'),_0x5e4e13,_0xf445('0xe'));logger[_0xf445('0xf')](_0xf445('0x10'),_0x5e4e13,'request\x20sent',JSON[_0xf445('0x11')](_0x551440));if(_0x551440[_0xf445('0x12')]){if(_0x551440[_0xf445('0x12')][_0xf445('0x13')]===0x1f4){logger[_0xf445('0x12')](_0xf445('0xd'),_0x5e4e13,_0x551440[_0xf445('0x12')][_0xf445('0x14')]);return _0x2936f8(_0x551440[_0xf445('0x12')]['message']);}logger[_0xf445('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x5e4e13,_0x551440[_0xf445('0x12')]['message']);return _0x3e4899(_0x551440[_0xf445('0x12')]['message']);}else{logger['info'](_0xf445('0xd'),_0x5e4e13,_0xf445('0xe'));_0x3e4899(_0x551440[_0xf445('0x15')][_0xf445('0x14')]);}})['catch'](function(_0x324453){logger['error'](_0xf445('0xd'),_0x5e4e13,_0x324453);_0x2936f8(_0x324453);});});} \ No newline at end of file +var _0x37b2=['request\x20sent','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x22ee0f,_0x22e6d2){var _0x204696=function(_0x4cab38){while(--_0x4cab38){_0x22ee0f['push'](_0x22ee0f['shift']());}};_0x204696(++_0x22e6d2);}(_0x37b2,0xd3));var _0x237b=function(_0x5da875,_0x475a8b){_0x5da875=_0x5da875-0x0;var _0x25d687=_0x37b2[_0x5da875];return _0x25d687;};'use strict';var _=require(_0x237b('0x0'));var util=require(_0x237b('0x1'));var moment=require(_0x237b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x237b('0x3'));var db=require(_0x237b('0x4'))['db'];var utils=require(_0x237b('0x5'));var logger=require(_0x237b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x237b('0x7'));var client=jayson[_0x237b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1be08a,_0x340cbd,_0x360c16){return new BPromise(function(_0x16bddb,_0x2c47da){return client['request'](_0x1be08a,_0x360c16)['then'](function(_0x1aebc9){logger['info'](_0x237b('0x9'),_0x340cbd,'request\x20sent');logger[_0x237b('0xa')](_0x237b('0xb'),_0x340cbd,'request\x20sent',JSON[_0x237b('0xc')](_0x1aebc9));if(_0x1aebc9[_0x237b('0xd')]){if(_0x1aebc9[_0x237b('0xd')][_0x237b('0xe')]===0x1f4){logger[_0x237b('0xd')](_0x237b('0x9'),_0x340cbd,_0x1aebc9[_0x237b('0xd')]['message']);return _0x2c47da(_0x1aebc9[_0x237b('0xd')][_0x237b('0xf')]);}logger['error'](_0x237b('0x9'),_0x340cbd,_0x1aebc9[_0x237b('0xd')][_0x237b('0xf')]);return _0x16bddb(_0x1aebc9[_0x237b('0xd')][_0x237b('0xf')]);}else{logger[_0x237b('0x10')](_0x237b('0x9'),_0x340cbd,_0x237b('0x11'));_0x16bddb(_0x1aebc9[_0x237b('0x12')]['message']);}})['catch'](function(_0x1db79c){logger[_0x237b('0xd')](_0x237b('0x9'),_0x340cbd,_0x1db79c);_0x2c47da(_0x1db79c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index d5c72c4..fd29963 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 _0xda24=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3e5e83,_0xd68bd0){var _0x17b414=function(_0x288d9f){while(--_0x288d9f){_0x3e5e83['push'](_0x3e5e83['shift']());}};_0x17b414(++_0xd68bd0);}(_0xda24,0x182));var _0x4da2=function(_0x11de69,_0x46c7c6){_0x11de69=_0x11de69-0x0;var _0x211379=_0xda24[_0x11de69];return _0x211379;};'use strict';var multer=require(_0x4da2('0x0'));var util=require(_0x4da2('0x1'));var path=require(_0x4da2('0x2'));var timeout=require(_0x4da2('0x3'));var express=require(_0x4da2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4da2('0x5'));var interaction=require(_0x4da2('0x6'));var config=require(_0x4da2('0x7'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x4da2('0x8')](),controller[_0x4da2('0x9')]);router[_0x4da2('0xa')](_0x4da2('0xb'),auth[_0x4da2('0x8')](),controller['show']);router[_0x4da2('0xa')](_0x4da2('0xc'),auth['isAuthenticated'](),controller[_0x4da2('0xd')]);router['get'](_0x4da2('0xe'),auth[_0x4da2('0x8')](),controller[_0x4da2('0xf')]);router[_0x4da2('0x10')]('/',auth[_0x4da2('0x8')](),controller['create']);router[_0x4da2('0x10')]('/:id/configurations',auth[_0x4da2('0x8')](),controller[_0x4da2('0x11')]);router[_0x4da2('0x12')](_0x4da2('0xb'),auth['isAuthenticated'](),controller[_0x4da2('0x13')]);router[_0x4da2('0x14')](_0x4da2('0xb'),auth[_0x4da2('0x8')](),controller[_0x4da2('0x15')]);module[_0x4da2('0x16')]=router; \ No newline at end of file +var _0x0b54=['addConfiguration','put','/:id','update','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations'];(function(_0x5224b4,_0x355198){var _0x4cd0ae=function(_0x1d1d1c){while(--_0x1d1d1c){_0x5224b4['push'](_0x5224b4['shift']());}};_0x4cd0ae(++_0x355198);}(_0x0b54,0x176));var _0x40b5=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x0b54[_0x38b14f];return _0x22a324;};'use strict';var multer=require('multer');var util=require(_0x40b5('0x0'));var path=require(_0x40b5('0x1'));var timeout=require('connect-timeout');var express=require(_0x40b5('0x2'));var router=express[_0x40b5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x40b5('0x4'));var interaction=require(_0x40b5('0x5'));var config=require(_0x40b5('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0x40b5('0x7')]('/',auth[_0x40b5('0x8')](),controller[_0x40b5('0x9')]);router[_0x40b5('0x7')]('/:id',auth[_0x40b5('0x8')](),controller[_0x40b5('0xa')]);router['get']('/:id/configurations',auth[_0x40b5('0x8')](),controller[_0x40b5('0xb')]);router[_0x40b5('0x7')](_0x40b5('0xc'),auth['isAuthenticated'](),controller[_0x40b5('0xd')]);router[_0x40b5('0xe')]('/',auth[_0x40b5('0x8')](),controller[_0x40b5('0xf')]);router[_0x40b5('0xe')](_0x40b5('0x10'),auth[_0x40b5('0x8')](),controller[_0x40b5('0x11')]);router[_0x40b5('0x12')](_0x40b5('0x13'),auth[_0x40b5('0x8')](),controller[_0x40b5('0x14')]);router[_0x40b5('0x15')](_0x40b5('0x13'),auth[_0x40b5('0x8')](),controller[_0x40b5('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 99c6273..eeea703 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 _0x7b84=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x7b84,0x17c));var _0x47b8=function(_0x5c6bdc,_0x3e4b2a){_0x5c6bdc=_0x5c6bdc-0x0;var _0x55b244=_0x7b84[_0x5c6bdc];return _0x55b244;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'apiKey':{'type':Sequelize[_0x47b8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47b8('0x4')},'serverUrl':{'type':Sequelize[_0x47b8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x524e=['username','remoteUri','STRING'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x524e,0x15e));var _0xe524=function(_0x1f310a,_0x50a29c){_0x1f310a=_0x1f310a-0x0;var _0x233e49=_0x524e[_0x1f310a];return _0x233e49;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')]},'description':{'type':Sequelize[_0xe524('0x0')]},'username':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x1')},'apiKey':{'type':Sequelize[_0xe524('0x0')]},'remoteUri':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x2')},'serverUrl':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 8dec84c..59a0627 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 _0x4d6e=['stringify','send','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','index','map','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','type','options','FreshdeskAccount','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','destroy','params','getConfigurations','FreshdeskConfiguration','sort','addConfiguration','findOne','AccountId','channel','getDescriptions','Subjects','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','agent','priority','group','ticket_type','company','remove','includes','default','custom_text','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x105a8a,_0x15a3a2){var _0x105a0e=function(_0x3beeb1){while(--_0x3beeb1){_0x105a8a['push'](_0x105a8a['shift']());}};_0x105a0e(++_0x15a3a2);}(_0x4d6e,0x77));var _0xe4d6=function(_0x48fd24,_0x13fa0b){_0x48fd24=_0x48fd24-0x0;var _0x2edb3a=_0x4d6e[_0x48fd24];return _0x2edb3a;};'use strict';var emlformat=require(_0xe4d6('0x0'));var rimraf=require(_0xe4d6('0x1'));var zipdir=require(_0xe4d6('0x2'));var jsonpatch=require(_0xe4d6('0x3'));var rp=require(_0xe4d6('0x4'));var moment=require('moment');var BPromise=require(_0xe4d6('0x5'));var Mustache=require(_0xe4d6('0x6'));var util=require(_0xe4d6('0x7'));var path=require(_0xe4d6('0x8'));var sox=require(_0xe4d6('0x9'));var csv=require(_0xe4d6('0xa'));var ejs=require(_0xe4d6('0xb'));var fs=require('fs');var fs_extra=require(_0xe4d6('0xc'));var _=require(_0xe4d6('0xd'));var squel=require(_0xe4d6('0xe'));var crypto=require(_0xe4d6('0xf'));var jsforce=require(_0xe4d6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe4d6('0xa'));var querystring=require(_0xe4d6('0x11'));var Papa=require('papaparse');var Redis=require(_0xe4d6('0x12'));var authService=require(_0xe4d6('0x13'));var qs=require(_0xe4d6('0x14'));var as=require(_0xe4d6('0x15'));var hardwareService=require(_0xe4d6('0x16'));var logger=require(_0xe4d6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe4d6('0x18'));var licenseUtil=require(_0xe4d6('0x19'));var db=require(_0xe4d6('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1a80eb,_0x3f7441){_0x3f7441=_0x3f7441||0xcc;return function(_0x53eac7){if(_0x53eac7){return _0x1a80eb[_0xe4d6('0x1b')](_0x3f7441);}return _0x1a80eb[_0xe4d6('0x1c')](_0x3f7441)['end']();};}function respondWithResult(_0xdc7f40,_0x780caa){_0x780caa=_0x780caa||0xc8;return function(_0x178f59){if(_0x178f59){return _0xdc7f40[_0xe4d6('0x1c')](_0x780caa)['json'](_0x178f59);}};}function respondWithFilteredResult(_0x2e04a9,_0x28e001){return function(_0x3dbe31){if(_0x3dbe31){var _0x1ca3fb=typeof _0x28e001['offset']===_0xe4d6('0x1d')&&typeof _0x28e001['limit']==='undefined';var _0x24e9cb=_0x3dbe31[_0xe4d6('0x1e')];var _0x68b15f=_0x1ca3fb?0x0:_0x28e001[_0xe4d6('0x1f')];var _0xe99d00=_0x1ca3fb?_0x3dbe31['count']:_0x28e001[_0xe4d6('0x1f')]+_0x28e001[_0xe4d6('0x20')];var _0xab15c8;if(_0xe99d00>=_0x24e9cb){_0xe99d00=_0x24e9cb;_0xab15c8=0xc8;}else{_0xab15c8=0xce;}_0x2e04a9[_0xe4d6('0x1c')](_0xab15c8);return _0x2e04a9[_0xe4d6('0x21')](_0xe4d6('0x22'),_0x68b15f+'-'+_0xe99d00+'/'+_0x24e9cb)[_0xe4d6('0x23')](_0x3dbe31);}return null;};}function patchUpdates(_0x27e824){return function(_0x52d88d){try{jsonpatch[_0xe4d6('0x24')](_0x52d88d,_0x27e824,!![]);}catch(_0x48a404){return BPromise[_0xe4d6('0x25')](_0x48a404);}return _0x52d88d[_0xe4d6('0x26')]();};}function saveUpdates(_0x31f569,_0x162b57){return function(_0x185b9e){if(_0x185b9e){return _0x185b9e[_0xe4d6('0x27')](_0x31f569)[_0xe4d6('0x28')](function(_0x202f67){return _0x202f67;});}return null;};}function removeEntity(_0x59233f,_0x404fe1){return function(_0x12b159){if(_0x12b159){return _0x12b159['destroy']()[_0xe4d6('0x28')](function(){_0x59233f[_0xe4d6('0x1c')](0xcc)[_0xe4d6('0x29')]();});}};}function handleEntityNotFound(_0x3e8f41,_0x13aeec){return function(_0x2f467f){if(!_0x2f467f){_0x3e8f41[_0xe4d6('0x1b')](0x194);}return _0x2f467f;};}function handleError(_0xb4fe6a,_0x53110a){_0x53110a=_0x53110a||0x1f4;return function(_0x16d492){logger[_0xe4d6('0x2a')](_0x16d492['stack']);if(_0x16d492['name']){delete _0x16d492['name'];}_0xb4fe6a[_0xe4d6('0x1c')](_0x53110a)['send'](_0x16d492);};}exports[_0xe4d6('0x2b')]=function(_0x4b83fa,_0x4f0485){var _0x39f7d5={},_0x4e45f0={},_0x54ae70={'count':0x0,'rows':[]};var _0x112cbd=_[_0xe4d6('0x2c')](db['FreshdeskAccount']['rawAttributes'],function(_0x3fd34f){return{'name':_0x3fd34f[_0xe4d6('0x2d')],'type':_0x3fd34f['type'][_0xe4d6('0x2e')]};});_0x4e45f0[_0xe4d6('0x2f')]=_[_0xe4d6('0x2c')](_0x112cbd,_0xe4d6('0x30'));_0x4e45f0[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x4b83fa['query']);_0x4e45f0['filters']=_[_0xe4d6('0x33')](_0x4e45f0[_0xe4d6('0x2f')],_0x4e45f0['query']);_0x39f7d5[_0xe4d6('0x34')]=_['intersection'](_0x4e45f0[_0xe4d6('0x2f')],qs['fields'](_0x4b83fa['query'][_0xe4d6('0x35')]));_0x39f7d5['attributes']=_0x39f7d5['attributes'][_0xe4d6('0x36')]?_0x39f7d5[_0xe4d6('0x34')]:_0x4e45f0[_0xe4d6('0x2f')];if(!_0x4b83fa[_0xe4d6('0x31')]['hasOwnProperty'](_0xe4d6('0x37'))){_0x39f7d5[_0xe4d6('0x20')]=qs[_0xe4d6('0x20')](_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x20')]);_0x39f7d5[_0xe4d6('0x1f')]=qs[_0xe4d6('0x1f')](_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x1f')]);}_0x39f7d5[_0xe4d6('0x38')]=qs['sort'](_0x4b83fa[_0xe4d6('0x31')]['sort']);_0x39f7d5[_0xe4d6('0x39')]=qs[_0xe4d6('0x3a')](_[_0xe4d6('0x3b')](_0x4b83fa[_0xe4d6('0x31')],_0x4e45f0['filters']),_0x112cbd);if(_0x4b83fa['query'][_0xe4d6('0x3c')]){_0x39f7d5[_0xe4d6('0x39')]=_[_0xe4d6('0x3d')](_0x39f7d5[_0xe4d6('0x39')],{'$or':_[_0xe4d6('0x2c')](_0x112cbd,function(_0x20c286){if(_0x20c286[_0xe4d6('0x3e')]!=='VIRTUAL'){var _0x252dfd={};_0x252dfd[_0x20c286[_0xe4d6('0x30')]]={'$like':'%'+_0x4b83fa['query']['filter']+'%'};return _0x252dfd;}})});}_0x39f7d5=_[_0xe4d6('0x3d')]({},_0x39f7d5,_0x4b83fa[_0xe4d6('0x3f')]);var _0x4950cf={'where':_0x39f7d5[_0xe4d6('0x39')]};return db[_0xe4d6('0x40')][_0xe4d6('0x1e')](_0x4950cf)[_0xe4d6('0x28')](function(_0x48207b){_0x54ae70[_0xe4d6('0x1e')]=_0x48207b;if(_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x41')]){_0x39f7d5[_0xe4d6('0x42')]=[{'all':!![]}];}return db[_0xe4d6('0x40')][_0xe4d6('0x43')](_0x39f7d5);})['then'](function(_0x5002dc){_0x54ae70['rows']=_0x5002dc;return _0x54ae70;})[_0xe4d6('0x28')](respondWithFilteredResult(_0x4f0485,_0x39f7d5))[_0xe4d6('0x44')](handleError(_0x4f0485,null));};exports[_0xe4d6('0x45')]=function(_0x314ad6,_0x4bc768){var _0x3d2516={'raw':![],'where':{'id':_0x314ad6['params']['id']}},_0x526593={};_0x526593[_0xe4d6('0x2f')]=_[_0xe4d6('0x32')](db[_0xe4d6('0x40')][_0xe4d6('0x46')]);_0x526593[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x314ad6['query']);_0x526593[_0xe4d6('0x3a')]=_[_0xe4d6('0x33')](_0x526593[_0xe4d6('0x2f')],_0x526593[_0xe4d6('0x31')]);_0x3d2516[_0xe4d6('0x34')]=_[_0xe4d6('0x33')](_0x526593[_0xe4d6('0x2f')],qs[_0xe4d6('0x35')](_0x314ad6['query'][_0xe4d6('0x35')]));_0x3d2516[_0xe4d6('0x34')]=_0x3d2516[_0xe4d6('0x34')]['length']?_0x3d2516['attributes']:_0x526593[_0xe4d6('0x2f')];if(_0x314ad6[_0xe4d6('0x31')][_0xe4d6('0x41')]){_0x3d2516[_0xe4d6('0x42')]=[{'all':!![]}];}_0x3d2516=_[_0xe4d6('0x3d')]({},_0x3d2516,_0x314ad6[_0xe4d6('0x3f')]);return db[_0xe4d6('0x40')][_0xe4d6('0x47')](_0x3d2516)[_0xe4d6('0x28')](handleEntityNotFound(_0x4bc768,null))[_0xe4d6('0x28')](respondWithResult(_0x4bc768,null))[_0xe4d6('0x44')](handleError(_0x4bc768,null));};exports[_0xe4d6('0x48')]=function(_0xe6fb2c,_0x194307){return db[_0xe4d6('0x40')][_0xe4d6('0x48')](_0xe6fb2c['body'],{})[_0xe4d6('0x28')](respondWithResult(_0x194307,0xc9))[_0xe4d6('0x44')](handleError(_0x194307,null));};exports['update']=function(_0x2bea52,_0x538e25){if(_0x2bea52[_0xe4d6('0x49')]['id']){delete _0x2bea52[_0xe4d6('0x49')]['id'];}return db['FreshdeskAccount'][_0xe4d6('0x47')]({'where':{'id':_0x2bea52['params']['id']}})['then'](handleEntityNotFound(_0x538e25,null))[_0xe4d6('0x28')](saveUpdates(_0x2bea52[_0xe4d6('0x49')],null))['then'](respondWithResult(_0x538e25,null))[_0xe4d6('0x44')](handleError(_0x538e25,null));};exports[_0xe4d6('0x4a')]=function(_0x24ed6b,_0x278c96){return db[_0xe4d6('0x40')]['find']({'where':{'id':_0x24ed6b[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x278c96,null))['then'](removeEntity(_0x278c96,null))['catch'](handleError(_0x278c96,null));};exports[_0xe4d6('0x4c')]=function(_0x12ecaf,_0x30612c,_0x478827){var _0x14f615={};var _0xc55241={};var _0x1da5e9;var _0x427575;return db[_0xe4d6('0x40')]['findOne']({'where':{'id':_0x12ecaf[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x30612c,null))[_0xe4d6('0x28')](function(_0x1b22c2){if(_0x1b22c2){_0x1da5e9=_0x1b22c2;_0xc55241[_0xe4d6('0x2f')]=_['keys'](db[_0xe4d6('0x4d')][_0xe4d6('0x46')]);_0xc55241[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x12ecaf[_0xe4d6('0x31')]);_0xc55241[_0xe4d6('0x3a')]=_['intersection'](_0xc55241[_0xe4d6('0x2f')],_0xc55241[_0xe4d6('0x31')]);_0x14f615[_0xe4d6('0x34')]=_[_0xe4d6('0x33')](_0xc55241[_0xe4d6('0x2f')],qs[_0xe4d6('0x35')](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x35')]));_0x14f615[_0xe4d6('0x34')]=_0x14f615[_0xe4d6('0x34')][_0xe4d6('0x36')]?_0x14f615['attributes']:_0xc55241[_0xe4d6('0x2f')];_0x14f615[_0xe4d6('0x38')]=qs[_0xe4d6('0x4e')](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x4e')]);_0x14f615[_0xe4d6('0x39')]=qs['filters'](_['pick'](_0x12ecaf[_0xe4d6('0x31')],_0xc55241[_0xe4d6('0x3a')]));if(_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x3c')]){_0x14f615['where']=_['merge'](_0x14f615[_0xe4d6('0x39')],{'$or':_[_0xe4d6('0x2c')](_0x14f615[_0xe4d6('0x34')],function(_0x2b6451){var _0x4b8047={};_0x4b8047[_0x2b6451]={'$like':'%'+_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x3c')]+'%'};return _0x4b8047;})});}_0x14f615=_['merge']({},_0x14f615,_0x12ecaf[_0xe4d6('0x3f')]);return _0x1da5e9['getConfigurations'](_0x14f615);}})[_0xe4d6('0x28')](function(_0x3b155b){if(_0x3b155b){_0x427575=_0x3b155b['length'];if(!_0x12ecaf[_0xe4d6('0x31')]['hasOwnProperty'](_0xe4d6('0x37'))){_0x14f615[_0xe4d6('0x20')]=qs['limit'](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x20')]);_0x14f615[_0xe4d6('0x1f')]=qs['offset'](_0x12ecaf['query']['offset']);}return _0x1da5e9[_0xe4d6('0x4c')](_0x14f615);}})[_0xe4d6('0x28')](function(_0x2ae27f){if(_0x2ae27f){return _0x2ae27f?{'count':_0x427575,'rows':_0x2ae27f}:null;}})[_0xe4d6('0x28')](respondWithResult(_0x30612c,null))[_0xe4d6('0x44')](handleError(_0x30612c,null));};exports[_0xe4d6('0x4f')]=function(_0x520608,_0x2d780d,_0x17d129){if(_0x520608[_0xe4d6('0x49')]['id']){delete _0x520608[_0xe4d6('0x49')]['id'];}return db[_0xe4d6('0x40')][_0xe4d6('0x50')]({'where':{'id':_0x520608[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x2d780d,null))[_0xe4d6('0x28')](function(_0x4fde5e){if(_0x4fde5e){_0x520608['body'][_0xe4d6('0x51')]=_0x4fde5e['id'];_0x520608[_0xe4d6('0x49')]['Subjects']=integrations['getSubjects'](_0x520608[_0xe4d6('0x49')][_0xe4d6('0x52')],_0x520608[_0xe4d6('0x49')][_0xe4d6('0x3e')]);_0x520608[_0xe4d6('0x49')]['Descriptions']=integrations[_0xe4d6('0x53')](_0x520608[_0xe4d6('0x49')][_0xe4d6('0x52')],_0x520608[_0xe4d6('0x49')][_0xe4d6('0x3e')]);return db[_0xe4d6('0x4d')]['create'](_0x520608[_0xe4d6('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0xe4d6('0x54')},{'model':db[_0xe4d6('0x55')],'as':_0xe4d6('0x56')}]});}return null;})[_0xe4d6('0x28')](respondWithResult(_0x2d780d,null))['catch'](handleError(_0x2d780d,null));};exports[_0xe4d6('0x57')]=function(_0xea686f,_0x3da67a,_0x309421){var _0x5e10ca='';return db[_0xe4d6('0x40')][_0xe4d6('0x50')]({'where':{'id':_0xea686f[_0xe4d6('0x4b')]['id']},'attributes':['id',_0xe4d6('0x58'),_0xe4d6('0x59')]})[_0xe4d6('0x28')](handleEntityNotFound(_0x3da67a,null))[_0xe4d6('0x28')](function(_0xc91476){if(_0xc91476){_0x5e10ca=_0xc91476[_0xe4d6('0x58')];var _0xeaa39=_0x5e10ca[_0xe4d6('0x5a')](-0x1);if(_0xeaa39==='/'){_0x5e10ca=_0x5e10ca[_0xe4d6('0x5b')](0x0,_0x5e10ca[_0xe4d6('0x5c')](_0xeaa39));}return rp({'method':_0xe4d6('0x5d'),'uri':util[_0xe4d6('0x5e')](_0xe4d6('0x5f'),_0x5e10ca,_0xe4d6('0x60')),'headers':{'Authorization':util[_0xe4d6('0x5e')]('Basic\x20%s',new Buffer(util[_0xe4d6('0x5e')](_0xe4d6('0x61'),_0xc91476[_0xe4d6('0x59')]))[_0xe4d6('0x62')]('base64'))},'json':!![]});}})[_0xe4d6('0x28')](function(_0x36a77f){if(_0x36a77f){var _0x256541=['requester','subject',_0xe4d6('0x63'),'description',_0xe4d6('0x1c'),_0xe4d6('0x64'),_0xe4d6('0x65'),'source',_0xe4d6('0x66'),_0xe4d6('0x65'),_0xe4d6('0x67')];_[_0xe4d6('0x68')](_0x36a77f,function(_0x2b2bdc){return _0x256541[_0xe4d6('0x69')](_0x2b2bdc[_0xe4d6('0x30')])||!_0x2b2bdc[_0xe4d6('0x6a')]&&_0x2b2bdc[_0xe4d6('0x3e')]!==_0xe4d6('0x6b')&&_0x2b2bdc[_0xe4d6('0x3e')]!=='custom_dropdown';});return{'count':_0x36a77f[_0xe4d6('0x36')],'rows':_['map'](_0x36a77f,function(_0x1ea6b7){return{'id':_0x1ea6b7['name'],'name':_0x1ea6b7[_0xe4d6('0x6c')],'custom':!_0x1ea6b7[_0xe4d6('0x6a')],'options':_0x1ea6b7[_0xe4d6('0x6d')]?_[_0xe4d6('0x2c')](_0x1ea6b7[_0xe4d6('0x6d')],function(_0x258f2d){return{'name':_[_0xe4d6('0x6e')](_0x258f2d),'value':_0x258f2d};}):[]};})};}})[_0xe4d6('0x28')](respondWithResult(_0x3da67a,null))[_0xe4d6('0x44')](function(_0x55e95c){var _0x87d700=_0xea686f[_0xe4d6('0x31')]['test']?0x1f4:_0x55e95c[_0xe4d6('0x6f')]||0x1f4;logger[_0xe4d6('0x2a')](_0xe4d6('0x70'),'getFields',_0x87d700,JSON[_0xe4d6('0x71')](_0x55e95c));delete _0x55e95c['name'];if(_0x87d700===0x191){_0x87d700=0x190;}_0x3da67a[_0xe4d6('0x1c')](_0x87d700)[_0xe4d6('0x72')](_0xea686f[_0xe4d6('0x31')][_0xe4d6('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x55e95c[_0xe4d6('0x6f')]}:_0x55e95c);});}; \ No newline at end of file +var _0x4899=['getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshdeskAccount','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','FreshdeskConfiguration','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','agent','priority','group','source','ticket_type','company','remove','default','choices','capitalize','test','statusCode'];(function(_0x138b49,_0x2a7216){var _0x56aa6e=function(_0x37a10b){while(--_0x37a10b){_0x138b49['push'](_0x138b49['shift']());}};_0x56aa6e(++_0x2a7216);}(_0x4899,0x74));var _0x9489=function(_0x2c9591,_0x5f49d7){_0x2c9591=_0x2c9591-0x0;var _0x496131=_0x4899[_0x2c9591];return _0x496131;};'use strict';var emlformat=require(_0x9489('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9489('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9489('0x2'));var moment=require('moment');var BPromise=require(_0x9489('0x3'));var Mustache=require(_0x9489('0x4'));var util=require(_0x9489('0x5'));var path=require(_0x9489('0x6'));var sox=require(_0x9489('0x7'));var csv=require('to-csv');var ejs=require(_0x9489('0x8'));var fs=require('fs');var fs_extra=require(_0x9489('0x9'));var _=require(_0x9489('0xa'));var squel=require(_0x9489('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9489('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9489('0xd'));var Papa=require(_0x9489('0xe'));var Redis=require('ioredis');var authService=require(_0x9489('0xf'));var qs=require(_0x9489('0x10'));var as=require(_0x9489('0x11'));var hardwareService=require(_0x9489('0x12'));var logger=require(_0x9489('0x13'))(_0x9489('0x14'));var utils=require(_0x9489('0x15'));var config=require(_0x9489('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9489('0x17'))['db'];var integrations=require(_0x9489('0x18'));function respondWithStatusCode(_0x7368e2,_0x5de484){_0x5de484=_0x5de484||0xcc;return function(_0x532b72){if(_0x532b72){return _0x7368e2[_0x9489('0x19')](_0x5de484);}return _0x7368e2[_0x9489('0x1a')](_0x5de484)[_0x9489('0x1b')]();};}function respondWithResult(_0x4c3003,_0x402022){_0x402022=_0x402022||0xc8;return function(_0x51ecea){if(_0x51ecea){return _0x4c3003[_0x9489('0x1a')](_0x402022)['json'](_0x51ecea);}};}function respondWithFilteredResult(_0x98390b,_0x18a0aa){return function(_0x1cb631){if(_0x1cb631){var _0x33c217=typeof _0x18a0aa[_0x9489('0x1c')]==='undefined'&&typeof _0x18a0aa[_0x9489('0x1d')]==='undefined';var _0x5b939f=_0x1cb631[_0x9489('0x1e')];var _0x1f0a5d=_0x33c217?0x0:_0x18a0aa[_0x9489('0x1c')];var _0x50b7da=_0x33c217?_0x1cb631[_0x9489('0x1e')]:_0x18a0aa[_0x9489('0x1c')]+_0x18a0aa['limit'];var _0x5347b2;if(_0x50b7da>=_0x5b939f){_0x50b7da=_0x5b939f;_0x5347b2=0xc8;}else{_0x5347b2=0xce;}_0x98390b[_0x9489('0x1a')](_0x5347b2);return _0x98390b[_0x9489('0x1f')](_0x9489('0x20'),_0x1f0a5d+'-'+_0x50b7da+'/'+_0x5b939f)[_0x9489('0x21')](_0x1cb631);}return null;};}function patchUpdates(_0x208bad){return function(_0x1e505a){try{jsonpatch[_0x9489('0x22')](_0x1e505a,_0x208bad,!![]);}catch(_0x4c58ec){return BPromise[_0x9489('0x23')](_0x4c58ec);}return _0x1e505a[_0x9489('0x24')]();};}function saveUpdates(_0x1cf61d,_0x5da0e9){return function(_0x1d248a){if(_0x1d248a){return _0x1d248a[_0x9489('0x25')](_0x1cf61d)[_0x9489('0x26')](function(_0x2f604a){return _0x2f604a;});}return null;};}function removeEntity(_0x1d6aa2,_0x37cea1){return function(_0x551b93){if(_0x551b93){return _0x551b93[_0x9489('0x27')]()[_0x9489('0x26')](function(){_0x1d6aa2[_0x9489('0x1a')](0xcc)[_0x9489('0x1b')]();});}};}function handleEntityNotFound(_0x2daed4,_0x1ede2f){return function(_0x21ea0a){if(!_0x21ea0a){_0x2daed4[_0x9489('0x19')](0x194);}return _0x21ea0a;};}function handleError(_0xd92a57,_0x1d9cdf){_0x1d9cdf=_0x1d9cdf||0x1f4;return function(_0x464ea6){logger[_0x9489('0x28')](_0x464ea6[_0x9489('0x29')]);if(_0x464ea6[_0x9489('0x2a')]){delete _0x464ea6[_0x9489('0x2a')];}_0xd92a57[_0x9489('0x1a')](_0x1d9cdf)['send'](_0x464ea6);};}exports[_0x9489('0x2b')]=function(_0x59b968,_0x4a640e){var _0x4bc3ce={},_0x42ff88={},_0x13fc88={'count':0x0,'rows':[]};var _0x5515a9=_[_0x9489('0x2c')](db[_0x9489('0x2d')][_0x9489('0x2e')],function(_0x4f1bad){return{'name':_0x4f1bad['fieldName'],'type':_0x4f1bad[_0x9489('0x2f')]['key']};});_0x42ff88[_0x9489('0x30')]=_[_0x9489('0x2c')](_0x5515a9,_0x9489('0x2a'));_0x42ff88[_0x9489('0x31')]=_[_0x9489('0x32')](_0x59b968['query']);_0x42ff88['filters']=_[_0x9489('0x33')](_0x42ff88[_0x9489('0x30')],_0x42ff88[_0x9489('0x31')]);_0x4bc3ce['attributes']=_[_0x9489('0x33')](_0x42ff88['model'],qs[_0x9489('0x34')](_0x59b968[_0x9489('0x31')][_0x9489('0x34')]));_0x4bc3ce[_0x9489('0x35')]=_0x4bc3ce['attributes'][_0x9489('0x36')]?_0x4bc3ce[_0x9489('0x35')]:_0x42ff88[_0x9489('0x30')];if(!_0x59b968['query'][_0x9489('0x37')]('nolimit')){_0x4bc3ce[_0x9489('0x1d')]=qs[_0x9489('0x1d')](_0x59b968['query'][_0x9489('0x1d')]);_0x4bc3ce[_0x9489('0x1c')]=qs[_0x9489('0x1c')](_0x59b968['query'][_0x9489('0x1c')]);}_0x4bc3ce[_0x9489('0x38')]=qs[_0x9489('0x39')](_0x59b968[_0x9489('0x31')][_0x9489('0x39')]);_0x4bc3ce[_0x9489('0x3a')]=qs[_0x9489('0x3b')](_[_0x9489('0x3c')](_0x59b968[_0x9489('0x31')],_0x42ff88[_0x9489('0x3b')]),_0x5515a9);if(_0x59b968[_0x9489('0x31')][_0x9489('0x3d')]){_0x4bc3ce[_0x9489('0x3a')]=_[_0x9489('0x3e')](_0x4bc3ce[_0x9489('0x3a')],{'$or':_[_0x9489('0x2c')](_0x5515a9,function(_0x253a32){if(_0x253a32[_0x9489('0x2f')]!==_0x9489('0x3f')){var _0x367a54={};_0x367a54[_0x253a32[_0x9489('0x2a')]]={'$like':'%'+_0x59b968[_0x9489('0x31')]['filter']+'%'};return _0x367a54;}})});}_0x4bc3ce=_['merge']({},_0x4bc3ce,_0x59b968['options']);var _0x453cd2={'where':_0x4bc3ce[_0x9489('0x3a')]};return db[_0x9489('0x2d')][_0x9489('0x1e')](_0x453cd2)[_0x9489('0x26')](function(_0x2ff936){_0x13fc88[_0x9489('0x1e')]=_0x2ff936;if(_0x59b968[_0x9489('0x31')][_0x9489('0x40')]){_0x4bc3ce[_0x9489('0x41')]=[{'all':!![]}];}return db[_0x9489('0x2d')]['findAll'](_0x4bc3ce);})[_0x9489('0x26')](function(_0x33e00d){_0x13fc88[_0x9489('0x42')]=_0x33e00d;return _0x13fc88;})[_0x9489('0x26')](respondWithFilteredResult(_0x4a640e,_0x4bc3ce))[_0x9489('0x43')](handleError(_0x4a640e,null));};exports[_0x9489('0x44')]=function(_0xe0714d,_0x26b316){var _0x1aaeb6={'raw':![],'where':{'id':_0xe0714d[_0x9489('0x45')]['id']}},_0x5d7549={};_0x5d7549[_0x9489('0x30')]=_[_0x9489('0x32')](db[_0x9489('0x2d')][_0x9489('0x2e')]);_0x5d7549[_0x9489('0x31')]=_[_0x9489('0x32')](_0xe0714d['query']);_0x5d7549[_0x9489('0x3b')]=_[_0x9489('0x33')](_0x5d7549[_0x9489('0x30')],_0x5d7549[_0x9489('0x31')]);_0x1aaeb6[_0x9489('0x35')]=_[_0x9489('0x33')](_0x5d7549['model'],qs['fields'](_0xe0714d['query'][_0x9489('0x34')]));_0x1aaeb6[_0x9489('0x35')]=_0x1aaeb6[_0x9489('0x35')][_0x9489('0x36')]?_0x1aaeb6[_0x9489('0x35')]:_0x5d7549[_0x9489('0x30')];if(_0xe0714d[_0x9489('0x31')][_0x9489('0x40')]){_0x1aaeb6[_0x9489('0x41')]=[{'all':!![]}];}_0x1aaeb6=_[_0x9489('0x3e')]({},_0x1aaeb6,_0xe0714d[_0x9489('0x46')]);return db[_0x9489('0x2d')][_0x9489('0x47')](_0x1aaeb6)['then'](handleEntityNotFound(_0x26b316,null))[_0x9489('0x26')](respondWithResult(_0x26b316,null))[_0x9489('0x43')](handleError(_0x26b316,null));};exports[_0x9489('0x48')]=function(_0xd63998,_0x289ea7){return db['FreshdeskAccount']['create'](_0xd63998[_0x9489('0x49')],{})[_0x9489('0x26')](respondWithResult(_0x289ea7,0xc9))[_0x9489('0x43')](handleError(_0x289ea7,null));};exports[_0x9489('0x25')]=function(_0x35abcb,_0x3dbebe){if(_0x35abcb[_0x9489('0x49')]['id']){delete _0x35abcb[_0x9489('0x49')]['id'];}return db[_0x9489('0x2d')][_0x9489('0x47')]({'where':{'id':_0x35abcb[_0x9489('0x45')]['id']}})[_0x9489('0x26')](handleEntityNotFound(_0x3dbebe,null))[_0x9489('0x26')](saveUpdates(_0x35abcb[_0x9489('0x49')],null))[_0x9489('0x26')](respondWithResult(_0x3dbebe,null))[_0x9489('0x43')](handleError(_0x3dbebe,null));};exports[_0x9489('0x27')]=function(_0x2c9ce7,_0x3be848){return db[_0x9489('0x2d')][_0x9489('0x47')]({'where':{'id':_0x2c9ce7[_0x9489('0x45')]['id']}})[_0x9489('0x26')](handleEntityNotFound(_0x3be848,null))[_0x9489('0x26')](removeEntity(_0x3be848,null))[_0x9489('0x43')](handleError(_0x3be848,null));};exports['getConfigurations']=function(_0x24a965,_0x1a36ef,_0x20847b){var _0x3b7023={};var _0x4e91c3={};var _0x41331a;var _0x1edcc1;return db[_0x9489('0x2d')]['findOne']({'where':{'id':_0x24a965['params']['id']}})[_0x9489('0x26')](handleEntityNotFound(_0x1a36ef,null))['then'](function(_0x466bee){if(_0x466bee){_0x41331a=_0x466bee;_0x4e91c3['model']=_[_0x9489('0x32')](db[_0x9489('0x4a')][_0x9489('0x2e')]);_0x4e91c3[_0x9489('0x31')]=_[_0x9489('0x32')](_0x24a965['query']);_0x4e91c3['filters']=_['intersection'](_0x4e91c3['model'],_0x4e91c3['query']);_0x3b7023[_0x9489('0x35')]=_['intersection'](_0x4e91c3[_0x9489('0x30')],qs[_0x9489('0x34')](_0x24a965[_0x9489('0x31')][_0x9489('0x34')]));_0x3b7023[_0x9489('0x35')]=_0x3b7023[_0x9489('0x35')][_0x9489('0x36')]?_0x3b7023[_0x9489('0x35')]:_0x4e91c3['model'];_0x3b7023[_0x9489('0x38')]=qs['sort'](_0x24a965[_0x9489('0x31')]['sort']);_0x3b7023['where']=qs[_0x9489('0x3b')](_[_0x9489('0x3c')](_0x24a965[_0x9489('0x31')],_0x4e91c3[_0x9489('0x3b')]));if(_0x24a965[_0x9489('0x31')][_0x9489('0x3d')]){_0x3b7023[_0x9489('0x3a')]=_[_0x9489('0x3e')](_0x3b7023[_0x9489('0x3a')],{'$or':_[_0x9489('0x2c')](_0x3b7023[_0x9489('0x35')],function(_0x2164d8){var _0x2ae177={};_0x2ae177[_0x2164d8]={'$like':'%'+_0x24a965['query'][_0x9489('0x3d')]+'%'};return _0x2ae177;})});}_0x3b7023=_['merge']({},_0x3b7023,_0x24a965['options']);return _0x41331a[_0x9489('0x4b')](_0x3b7023);}})[_0x9489('0x26')](function(_0xf3ab37){if(_0xf3ab37){_0x1edcc1=_0xf3ab37[_0x9489('0x36')];if(!_0x24a965[_0x9489('0x31')][_0x9489('0x37')](_0x9489('0x4c'))){_0x3b7023[_0x9489('0x1d')]=qs[_0x9489('0x1d')](_0x24a965[_0x9489('0x31')][_0x9489('0x1d')]);_0x3b7023['offset']=qs[_0x9489('0x1c')](_0x24a965[_0x9489('0x31')][_0x9489('0x1c')]);}return _0x41331a['getConfigurations'](_0x3b7023);}})[_0x9489('0x26')](function(_0x186608){if(_0x186608){return _0x186608?{'count':_0x1edcc1,'rows':_0x186608}:null;}})[_0x9489('0x26')](respondWithResult(_0x1a36ef,null))[_0x9489('0x43')](handleError(_0x1a36ef,null));};exports[_0x9489('0x4d')]=function(_0x16f995,_0x203818,_0x19ee5c){if(_0x16f995['body']['id']){delete _0x16f995['body']['id'];}return db[_0x9489('0x2d')][_0x9489('0x4e')]({'where':{'id':_0x16f995[_0x9489('0x45')]['id']}})[_0x9489('0x26')](handleEntityNotFound(_0x203818,null))['then'](function(_0xfdd005){if(_0xfdd005){_0x16f995[_0x9489('0x49')][_0x9489('0x4f')]=_0xfdd005['id'];_0x16f995[_0x9489('0x49')][_0x9489('0x50')]=integrations[_0x9489('0x51')](_0x16f995['body'][_0x9489('0x52')],_0x16f995[_0x9489('0x49')][_0x9489('0x2f')]);_0x16f995[_0x9489('0x49')][_0x9489('0x53')]=integrations[_0x9489('0x54')](_0x16f995[_0x9489('0x49')][_0x9489('0x52')],_0x16f995['body']['type']);return db[_0x9489('0x4a')][_0x9489('0x48')](_0x16f995['body'],{'include':[{'model':db[_0x9489('0x55')],'as':_0x9489('0x50')},{'model':db[_0x9489('0x55')],'as':_0x9489('0x53')}]});}return null;})[_0x9489('0x26')](respondWithResult(_0x203818,null))[_0x9489('0x43')](handleError(_0x203818,null));};exports[_0x9489('0x56')]=function(_0x451bad,_0x1cafdb,_0x2b06ef){var _0x5bc1e7='';return db[_0x9489('0x2d')][_0x9489('0x4e')]({'where':{'id':_0x451bad[_0x9489('0x45')]['id']},'attributes':['id',_0x9489('0x57'),_0x9489('0x58')]})['then'](handleEntityNotFound(_0x1cafdb,null))[_0x9489('0x26')](function(_0x5dacf5){if(_0x5dacf5){_0x5bc1e7=_0x5dacf5[_0x9489('0x57')];var _0x911c40=_0x5bc1e7['slice'](-0x1);if(_0x911c40==='/'){_0x5bc1e7=_0x5bc1e7[_0x9489('0x59')](0x0,_0x5bc1e7['lastIndexOf'](_0x911c40));}return rp({'method':_0x9489('0x5a'),'uri':util[_0x9489('0x5b')]('%s/%s',_0x5bc1e7,_0x9489('0x5c')),'headers':{'Authorization':util[_0x9489('0x5b')](_0x9489('0x5d'),new Buffer(util['format'](_0x9489('0x5e'),_0x5dacf5[_0x9489('0x58')]))[_0x9489('0x5f')]('base64'))},'json':!![]});}})[_0x9489('0x26')](function(_0x58f106){if(_0x58f106){var _0x233632=[_0x9489('0x60'),_0x9489('0x61'),_0x9489('0x62'),'description',_0x9489('0x1a'),_0x9489('0x63'),_0x9489('0x64'),_0x9489('0x65'),_0x9489('0x66'),_0x9489('0x64'),_0x9489('0x67')];_[_0x9489('0x68')](_0x58f106,function(_0x4707bf){return _0x233632['includes'](_0x4707bf[_0x9489('0x2a')])||!_0x4707bf[_0x9489('0x69')]&&_0x4707bf[_0x9489('0x2f')]!=='custom_text'&&_0x4707bf[_0x9489('0x2f')]!=='custom_dropdown';});return{'count':_0x58f106['length'],'rows':_[_0x9489('0x2c')](_0x58f106,function(_0x1f7ca4){return{'id':_0x1f7ca4[_0x9489('0x2a')],'name':_0x1f7ca4['label'],'custom':!_0x1f7ca4[_0x9489('0x69')],'options':_0x1f7ca4['choices']?_[_0x9489('0x2c')](_0x1f7ca4[_0x9489('0x6a')],function(_0x367eed){return{'name':_[_0x9489('0x6b')](_0x367eed),'value':_0x367eed};}):[]};})};}})[_0x9489('0x26')](respondWithResult(_0x1cafdb,null))[_0x9489('0x43')](function(_0x100ca6){var _0x504071=_0x451bad[_0x9489('0x31')][_0x9489('0x6c')]?0x1f4:_0x100ca6[_0x9489('0x6d')]||0x1f4;logger[_0x9489('0x28')](_0x9489('0x6e'),_0x9489('0x56'),_0x504071,JSON[_0x9489('0x6f')](_0x100ca6));delete _0x100ca6[_0x9489('0x2a')];if(_0x504071===0x191){_0x504071=0x190;}_0x1cafdb['status'](_0x504071)['send'](_0x451bad[_0x9489('0x31')][_0x9489('0x6c')]?{'message':_0x9489('0x70'),'statusCode':_0x100ca6[_0x9489('0x6d')]}:_0x100ca6);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index dd40de5..72fecf4 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 _0x6cb8=['exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x38923b,_0x1003fb){var _0x17f099=function(_0x9a4ff0){while(--_0x9a4ff0){_0x38923b['push'](_0x38923b['shift']());}};_0x17f099(++_0x1003fb);}(_0x6cb8,0x1ba));var _0x86cb=function(_0x23a642,_0x266032){_0x23a642=_0x23a642-0x0;var _0x2c63be=_0x6cb8[_0x23a642];return _0x2c63be;};'use strict';var _=require(_0x86cb('0x0'));var util=require('util');var logger=require(_0x86cb('0x1'))(_0x86cb('0x2'));var moment=require(_0x86cb('0x3'));var BPromise=require(_0x86cb('0x4'));var rp=require(_0x86cb('0x5'));var fs=require('fs');var path=require(_0x86cb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x86cb('0x7'));var integrations=require(_0x86cb('0x8'));module[_0x86cb('0x9')]=function(_0x5acc66,_0x18ead4){return _0x5acc66[_0x86cb('0xa')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfa7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_freshdesk_accounts','lodash','util'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xdfa7,0x172));var _0x7dfa=function(_0x479623,_0x789c1d){_0x479623=_0x479623-0x0;var _0x778767=_0xdfa7[_0x479623];return _0x778767;};'use strict';var _=require(_0x7dfa('0x0'));var util=require(_0x7dfa('0x1'));var logger=require('../../config/logger')(_0x7dfa('0x2'));var moment=require(_0x7dfa('0x3'));var BPromise=require(_0x7dfa('0x4'));var rp=require(_0x7dfa('0x5'));var fs=require('fs');var path=require(_0x7dfa('0x6'));var rimraf=require(_0x7dfa('0x7'));var config=require(_0x7dfa('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x7dfa('0x9')]=function(_0x486935,_0x3bb86e){return _0x486935[_0x7dfa('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x7dfa('0xb'),'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 b0c0ad2..3ccf8e3 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 _0xee22=['jayson/promise','client','http','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetFreshdeskAccount','debug','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5b7f31,_0x1cdfb5){var _0x1b9152=function(_0x25d863){while(--_0x25d863){_0x5b7f31['push'](_0x5b7f31['shift']());}};_0x1b9152(++_0x1cdfb5);}(_0xee22,0x8a));var _0x2ee2=function(_0x5d7eda,_0x5f737b){_0x5d7eda=_0x5d7eda-0x0;var _0x527626=_0xee22[_0x5d7eda];return _0x527626;};'use strict';var _=require(_0x2ee2('0x0'));var util=require(_0x2ee2('0x1'));var moment=require(_0x2ee2('0x2'));var BPromise=require(_0x2ee2('0x3'));var rs=require(_0x2ee2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ee2('0x5'))['db'];var utils=require(_0x2ee2('0x6'));var logger=require(_0x2ee2('0x7'))(_0x2ee2('0x8'));var config=require(_0x2ee2('0x9'));var jayson=require(_0x2ee2('0xa'));var client=jayson[_0x2ee2('0xb')][_0x2ee2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1655f0,_0x25f5f2,_0x1dea50){return new BPromise(function(_0x15912a,_0xa153f2){return client['request'](_0x1655f0,_0x1dea50)[_0x2ee2('0xd')](function(_0x482d94){logger[_0x2ee2('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x25f5f2,_0x2ee2('0xf'));logger['debug'](_0x2ee2('0x10'),_0x25f5f2,_0x2ee2('0xf'),JSON[_0x2ee2('0x11')](_0x482d94));if(_0x482d94[_0x2ee2('0x12')]){if(_0x482d94[_0x2ee2('0x12')][_0x2ee2('0x13')]===0x1f4){logger[_0x2ee2('0x12')](_0x2ee2('0x14'),_0x25f5f2,_0x482d94[_0x2ee2('0x12')][_0x2ee2('0x15')]);return _0xa153f2(_0x482d94['error'][_0x2ee2('0x15')]);}logger[_0x2ee2('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x25f5f2,_0x482d94[_0x2ee2('0x12')][_0x2ee2('0x15')]);return _0x15912a(_0x482d94[_0x2ee2('0x12')][_0x2ee2('0x15')]);}else{logger[_0x2ee2('0xe')](_0x2ee2('0x14'),_0x25f5f2,_0x2ee2('0xf'));_0x15912a(_0x482d94[_0x2ee2('0x16')][_0x2ee2('0x15')]);}})[_0x2ee2('0x17')](function(_0x562eae){logger[_0x2ee2('0x12')](_0x2ee2('0x14'),_0x25f5f2,_0x562eae);_0xa153f2(_0x562eae);});});}exports['GetFreshdeskAccount']=function(_0x2c5de1){var _0x4d01c2=this;return new Promise(function(_0x20dca2,_0x3d09f1){return db[_0x2ee2('0x18')][_0x2ee2('0x19')]({'raw':_0x2c5de1[_0x2ee2('0x1a')]?_0x2c5de1['options'][_0x2ee2('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c5de1[_0x2ee2('0x1a')]?_0x2c5de1[_0x2ee2('0x1a')][_0x2ee2('0x1c')]||null:null,'attributes':_0x2c5de1['options']?_0x2c5de1[_0x2ee2('0x1a')]['attributes']||null:null,'limit':_0x2c5de1[_0x2ee2('0x1a')]?_0x2c5de1['options'][_0x2ee2('0x1d')]||null:null,'include':_0x2c5de1['options']?_0x2c5de1[_0x2ee2('0x1a')][_0x2ee2('0x1e')]?_[_0x2ee2('0x1f')](_0x2c5de1[_0x2ee2('0x1a')][_0x2ee2('0x1e')],function(_0x388aea){return{'model':db[_0x388aea['model']],'as':_0x388aea['as'],'attributes':_0x388aea['attributes'],'include':_0x388aea['include']?_[_0x2ee2('0x1f')](_0x388aea[_0x2ee2('0x1e')],function(_0xa684f3){return{'model':db[_0xa684f3[_0x2ee2('0x20')]],'as':_0xa684f3['as'],'attributes':_0xa684f3[_0x2ee2('0x21')],'include':_0xa684f3[_0x2ee2('0x1e')]?_[_0x2ee2('0x1f')](_0xa684f3[_0x2ee2('0x1e')],function(_0x412a83){return{'model':db[_0x412a83[_0x2ee2('0x20')]],'as':_0x412a83['as'],'attributes':_0x412a83[_0x2ee2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2ee2('0xd')](function(_0x5a0db6){logger[_0x2ee2('0xe')](_0x2ee2('0x22'),_0x2c5de1);logger[_0x2ee2('0x23')](_0x2ee2('0x22'),_0x2c5de1,JSON[_0x2ee2('0x11')](_0x5a0db6));_0x20dca2(_0x5a0db6);})[_0x2ee2('0x17')](function(_0x21ac10){logger[_0x2ee2('0x12')](_0x2ee2('0x22'),_0x21ac10[_0x2ee2('0x15')],_0x2c5de1);_0x3d09f1(_0x4d01c2[_0x2ee2('0x12')](0x1f4,_0x21ac10[_0x2ee2('0x15')]));});});};exports['ShowFreshdeskAccount']=function(_0x1db4e6){var _0xedb707=this;return new Promise(function(_0x172d59,_0x361fc7){return db[_0x2ee2('0x18')]['find']({'raw':_0x1db4e6['options']?_0x1db4e6[_0x2ee2('0x1a')][_0x2ee2('0x1b')]===undefined?!![]:![]:!![],'where':_0x1db4e6[_0x2ee2('0x1a')]?_0x1db4e6[_0x2ee2('0x1a')]['where']||null:null,'attributes':_0x1db4e6[_0x2ee2('0x1a')]?_0x1db4e6[_0x2ee2('0x1a')]['attributes']||null:null,'include':_0x1db4e6['options']?_0x1db4e6[_0x2ee2('0x1a')][_0x2ee2('0x1e')]?_[_0x2ee2('0x1f')](_0x1db4e6[_0x2ee2('0x1a')][_0x2ee2('0x1e')],function(_0x500181){return{'model':db[_0x500181[_0x2ee2('0x20')]],'as':_0x500181['as'],'attributes':_0x500181['attributes'],'include':_0x500181['include']?_[_0x2ee2('0x1f')](_0x500181['include'],function(_0x21e05d){return{'model':db[_0x21e05d[_0x2ee2('0x20')]],'as':_0x21e05d['as'],'attributes':_0x21e05d[_0x2ee2('0x21')],'include':_0x21e05d['include']?_[_0x2ee2('0x1f')](_0x21e05d[_0x2ee2('0x1e')],function(_0x17e56b){return{'model':db[_0x17e56b['model']],'as':_0x17e56b['as'],'attributes':_0x17e56b[_0x2ee2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2ee2('0xd')](function(_0x3ae807){logger[_0x2ee2('0xe')](_0x2ee2('0x24'),_0x1db4e6);logger[_0x2ee2('0x23')](_0x2ee2('0x24'),_0x1db4e6,JSON['stringify'](_0x3ae807));_0x172d59(_0x3ae807);})[_0x2ee2('0x17')](function(_0x2cba2c){logger[_0x2ee2('0x12')](_0x2ee2('0x24'),_0x2cba2c[_0x2ee2('0x15')],_0x1db4e6);_0x361fc7(_0xedb707[_0x2ee2('0x12')](0x1f4,_0x2cba2c['message']));});});}; \ No newline at end of file +var _0x9964=['stringify','ShowFreshdeskAccount','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFreshdeskAccount','debug'];(function(_0x3ca503,_0x12521a){var _0x4d0ac6=function(_0x2443b4){while(--_0x2443b4){_0x3ca503['push'](_0x3ca503['shift']());}};_0x4d0ac6(++_0x12521a);}(_0x9964,0x1d7));var _0x4996=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0x9964[_0x3df871];return _0x570f7b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4996('0x0'));var BPromise=require('bluebird');var rs=require(_0x4996('0x1'));var fs=require('fs');var Redis=require(_0x4996('0x2'));var db=require(_0x4996('0x3'))['db'];var utils=require(_0x4996('0x4'));var logger=require(_0x4996('0x5'))(_0x4996('0x6'));var config=require('../../config/environment');var jayson=require(_0x4996('0x7'));var client=jayson[_0x4996('0x8')][_0x4996('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x277c0f,_0x2f39a8,_0xa70ad5){return new BPromise(function(_0x10dba3,_0x3be4a6){return client[_0x4996('0xa')](_0x277c0f,_0xa70ad5)[_0x4996('0xb')](function(_0x5cbdfd){logger[_0x4996('0xc')](_0x4996('0xd'),_0x2f39a8,_0x4996('0xe'));logger['debug'](_0x4996('0xf'),_0x2f39a8,_0x4996('0xe'),JSON['stringify'](_0x5cbdfd));if(_0x5cbdfd[_0x4996('0x10')]){if(_0x5cbdfd['error'][_0x4996('0x11')]===0x1f4){logger['error'](_0x4996('0xd'),_0x2f39a8,_0x5cbdfd[_0x4996('0x10')]['message']);return _0x3be4a6(_0x5cbdfd['error'][_0x4996('0x12')]);}logger[_0x4996('0x10')](_0x4996('0xd'),_0x2f39a8,_0x5cbdfd[_0x4996('0x10')][_0x4996('0x12')]);return _0x10dba3(_0x5cbdfd[_0x4996('0x10')][_0x4996('0x12')]);}else{logger['info'](_0x4996('0xd'),_0x2f39a8,_0x4996('0xe'));_0x10dba3(_0x5cbdfd[_0x4996('0x13')][_0x4996('0x12')]);}})[_0x4996('0x14')](function(_0x8a7f99){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x2f39a8,_0x8a7f99);_0x3be4a6(_0x8a7f99);});});}exports['GetFreshdeskAccount']=function(_0xc92b95){var _0x452b61=this;return new Promise(function(_0x45e169,_0x473dcf){return db[_0x4996('0x15')][_0x4996('0x16')]({'raw':_0xc92b95[_0x4996('0x17')]?_0xc92b95[_0x4996('0x17')][_0x4996('0x18')]===undefined?!![]:![]:!![],'where':_0xc92b95[_0x4996('0x17')]?_0xc92b95[_0x4996('0x17')][_0x4996('0x19')]||null:null,'attributes':_0xc92b95[_0x4996('0x17')]?_0xc92b95['options'][_0x4996('0x1a')]||null:null,'limit':_0xc92b95[_0x4996('0x17')]?_0xc92b95[_0x4996('0x17')][_0x4996('0x1b')]||null:null,'include':_0xc92b95[_0x4996('0x17')]?_0xc92b95[_0x4996('0x17')][_0x4996('0x1c')]?_['map'](_0xc92b95[_0x4996('0x17')][_0x4996('0x1c')],function(_0x417311){return{'model':db[_0x417311[_0x4996('0x1d')]],'as':_0x417311['as'],'attributes':_0x417311['attributes'],'include':_0x417311[_0x4996('0x1c')]?_['map'](_0x417311[_0x4996('0x1c')],function(_0x4f0d46){return{'model':db[_0x4f0d46[_0x4996('0x1d')]],'as':_0x4f0d46['as'],'attributes':_0x4f0d46[_0x4996('0x1a')],'include':_0x4f0d46[_0x4996('0x1c')]?_[_0x4996('0x1e')](_0x4f0d46[_0x4996('0x1c')],function(_0x3d0555){return{'model':db[_0x3d0555[_0x4996('0x1d')]],'as':_0x3d0555['as'],'attributes':_0x3d0555[_0x4996('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1def9e){logger['info'](_0x4996('0x1f'),_0xc92b95);logger[_0x4996('0x20')](_0x4996('0x1f'),_0xc92b95,JSON[_0x4996('0x21')](_0x1def9e));_0x45e169(_0x1def9e);})[_0x4996('0x14')](function(_0x1e9a3f){logger['error'](_0x4996('0x1f'),_0x1e9a3f[_0x4996('0x12')],_0xc92b95);_0x473dcf(_0x452b61['error'](0x1f4,_0x1e9a3f[_0x4996('0x12')]));});});};exports[_0x4996('0x22')]=function(_0x1e8256){var _0x38e7ce=this;return new Promise(function(_0xf02a3e,_0x4cb9c4){return db[_0x4996('0x15')][_0x4996('0x23')]({'raw':_0x1e8256[_0x4996('0x17')]?_0x1e8256[_0x4996('0x17')][_0x4996('0x18')]===undefined?!![]:![]:!![],'where':_0x1e8256[_0x4996('0x17')]?_0x1e8256[_0x4996('0x17')][_0x4996('0x19')]||null:null,'attributes':_0x1e8256['options']?_0x1e8256[_0x4996('0x17')][_0x4996('0x1a')]||null:null,'include':_0x1e8256[_0x4996('0x17')]?_0x1e8256[_0x4996('0x17')][_0x4996('0x1c')]?_[_0x4996('0x1e')](_0x1e8256[_0x4996('0x17')][_0x4996('0x1c')],function(_0x58ec62){return{'model':db[_0x58ec62[_0x4996('0x1d')]],'as':_0x58ec62['as'],'attributes':_0x58ec62[_0x4996('0x1a')],'include':_0x58ec62[_0x4996('0x1c')]?_[_0x4996('0x1e')](_0x58ec62[_0x4996('0x1c')],function(_0x5cb5dc){return{'model':db[_0x5cb5dc[_0x4996('0x1d')]],'as':_0x5cb5dc['as'],'attributes':_0x5cb5dc[_0x4996('0x1a')],'include':_0x5cb5dc['include']?_[_0x4996('0x1e')](_0x5cb5dc['include'],function(_0x28ceb2){return{'model':db[_0x28ceb2[_0x4996('0x1d')]],'as':_0x28ceb2['as'],'attributes':_0x28ceb2['attributes']};}):[]};}):[]};}):[]:[]})[_0x4996('0xb')](function(_0x597613){logger[_0x4996('0xc')](_0x4996('0x22'),_0x1e8256);logger[_0x4996('0x20')](_0x4996('0x22'),_0x1e8256,JSON[_0x4996('0x21')](_0x597613));_0xf02a3e(_0x597613);})[_0x4996('0x14')](function(_0x242279){logger[_0x4996('0x10')](_0x4996('0x22'),_0x242279['message'],_0x1e8256);_0x4cb9c4(_0x38e7ce['error'](0x1f4,_0x242279[_0x4996('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ebbbdf2..f85a085 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 _0x1fd7=['post','create','setTags','put','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','getSubjects','getDescriptions','/:id/tags','getTags'];(function(_0x5397f4,_0x3f2c05){var _0x4cba07=function(_0x20b72d){while(--_0x20b72d){_0x5397f4['push'](_0x5397f4['shift']());}};_0x4cba07(++_0x3f2c05);}(_0x1fd7,0x1bb));var _0x71fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1fd7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x71fd('0x0'));var util=require('util');var path=require(_0x71fd('0x1'));var timeout=require(_0x71fd('0x2'));var express=require(_0x71fd('0x3'));var router=express['Router']();var fs_extra=require(_0x71fd('0x4'));var auth=require(_0x71fd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x71fd('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x71fd('0x7')]('/',auth[_0x71fd('0x8')](),controller[_0x71fd('0x9')]);router[_0x71fd('0x7')](_0x71fd('0xa'),auth[_0x71fd('0x8')](),controller[_0x71fd('0xb')]);router['get']('/:id/fields',auth[_0x71fd('0x8')](),controller[_0x71fd('0xc')]);router['get']('/:id/subjects',auth[_0x71fd('0x8')](),controller[_0x71fd('0xd')]);router[_0x71fd('0x7')]('/:id/descriptions',auth[_0x71fd('0x8')](),controller[_0x71fd('0xe')]);router['get'](_0x71fd('0xf'),auth['isAuthenticated'](),controller[_0x71fd('0x10')]);router[_0x71fd('0x11')]('/',auth[_0x71fd('0x8')](),controller[_0x71fd('0x12')]);router[_0x71fd('0x11')]('/:id/tags',auth[_0x71fd('0x8')](),controller[_0x71fd('0x13')]);router[_0x71fd('0x14')](_0x71fd('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x71fd('0xa'),auth[_0x71fd('0x8')](),controller[_0x71fd('0x15')]);module[_0x71fd('0x16')]=router; \ No newline at end of file +var _0x3840=['post','/:id/tags','setTags','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3840,0x155));var _0x0384=function(_0xffc72b,_0x8ed570){_0xffc72b=_0xffc72b-0x0;var _0x25d195=_0x3840[_0xffc72b];return _0x25d195;};'use strict';var multer=require(_0x0384('0x0'));var util=require(_0x0384('0x1'));var path=require(_0x0384('0x2'));var timeout=require(_0x0384('0x3'));var express=require(_0x0384('0x4'));var router=express[_0x0384('0x5')]();var fs_extra=require(_0x0384('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0384('0x7'));var config=require(_0x0384('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x0384('0x9')]('/',auth[_0x0384('0xa')](),controller['index']);router[_0x0384('0x9')](_0x0384('0xb'),auth[_0x0384('0xa')](),controller['show']);router['get'](_0x0384('0xc'),auth[_0x0384('0xa')](),controller['getFields']);router['get'](_0x0384('0xd'),auth['isAuthenticated'](),controller[_0x0384('0xe')]);router[_0x0384('0x9')](_0x0384('0xf'),auth[_0x0384('0xa')](),controller[_0x0384('0x10')]);router[_0x0384('0x9')]('/:id/tags',auth[_0x0384('0xa')](),controller[_0x0384('0x11')]);router['post']('/',auth[_0x0384('0xa')](),controller[_0x0384('0x12')]);router[_0x0384('0x13')](_0x0384('0x14'),auth[_0x0384('0xa')](),controller[_0x0384('0x15')]);router[_0x0384('0x16')](_0x0384('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0384('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index e28adf2..f5d8851 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 _0xa195=['sequelize','exports','STRING'];(function(_0x5c82a1,_0x11a05c){var _0xf9dcac=function(_0x53479f){while(--_0x53479f){_0x5c82a1['push'](_0x5c82a1['shift']());}};_0xf9dcac(++_0x11a05c);}(_0xa195,0x1cb));var _0x5a19=function(_0x225165,_0x4176c0){_0x225165=_0x225165-0x0;var _0xd08243=_0xa195[_0x225165];return _0xd08243;};'use strict';var Sequelize=require(_0x5a19('0x0'));module[_0x5a19('0x1')]={'name':{'type':Sequelize[_0x5a19('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6479=['exports','STRING','sequelize'];(function(_0x9e31e0,_0x51a678){var _0x46a76d=function(_0x363db8){while(--_0x363db8){_0x9e31e0['push'](_0x9e31e0['shift']());}};_0x46a76d(++_0x51a678);}(_0x6479,0x71));var _0x9647=function(_0x4b19e3,_0x2b63c3){_0x4b19e3=_0x4b19e3-0x0;var _0x2ce22a=_0x6479[_0x4b19e3];return _0x2ce22a;};'use strict';var Sequelize=require(_0x9647('0x0'));module[_0x9647('0x1')]={'name':{'type':Sequelize[_0x9647('0x2')]},'description':{'type':Sequelize[_0x9647('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index d5ea432..bc4c6f9 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 _0x7b69=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','FreshdeskConfiguration','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','catch','create','body','find','getFields','findOne','FreshdeskField','length','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x5a4515,_0x401ff9){var _0x5e4a11=function(_0x1b03fa){while(--_0x1b03fa){_0x5a4515['push'](_0x5a4515['shift']());}};_0x5e4a11(++_0x401ff9);}(_0x7b69,0x92));var _0x97b6=function(_0x564c99,_0x19c936){_0x564c99=_0x564c99-0x0;var _0x56bd25=_0x7b69[_0x564c99];return _0x56bd25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97b6('0x0'));var zipdir=require(_0x97b6('0x1'));var jsonpatch=require(_0x97b6('0x2'));var rp=require(_0x97b6('0x3'));var moment=require(_0x97b6('0x4'));var BPromise=require(_0x97b6('0x5'));var Mustache=require(_0x97b6('0x6'));var util=require(_0x97b6('0x7'));var path=require(_0x97b6('0x8'));var sox=require(_0x97b6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97b6('0xa'));var squel=require(_0x97b6('0xb'));var crypto=require('crypto');var jsforce=require(_0x97b6('0xc'));var deskjs=require(_0x97b6('0xd'));var toCsv=require(_0x97b6('0xe'));var querystring=require('querystring');var Papa=require(_0x97b6('0xf'));var Redis=require(_0x97b6('0x10'));var authService=require(_0x97b6('0x11'));var qs=require(_0x97b6('0x12'));var as=require(_0x97b6('0x13'));var hardwareService=require(_0x97b6('0x14'));var logger=require(_0x97b6('0x15'))(_0x97b6('0x16'));var utils=require(_0x97b6('0x17'));var config=require(_0x97b6('0x18'));var licenseUtil=require(_0x97b6('0x19'));var db=require(_0x97b6('0x1a'))['db'];function respondWithStatusCode(_0x48a77b,_0x36f133){_0x36f133=_0x36f133||0xcc;return function(_0x31af0f){if(_0x31af0f){return _0x48a77b[_0x97b6('0x1b')](_0x36f133);}return _0x48a77b[_0x97b6('0x1c')](_0x36f133)[_0x97b6('0x1d')]();};}function respondWithResult(_0xa270ae,_0x48710b){_0x48710b=_0x48710b||0xc8;return function(_0x5ad24e){if(_0x5ad24e){return _0xa270ae[_0x97b6('0x1c')](_0x48710b)[_0x97b6('0x1e')](_0x5ad24e);}};}function respondWithFilteredResult(_0x250860,_0x232f2a){return function(_0x3d594f){if(_0x3d594f){var _0x537ee1=typeof _0x232f2a[_0x97b6('0x1f')]==='undefined'&&typeof _0x232f2a[_0x97b6('0x20')]===_0x97b6('0x21');var _0x51ec15=_0x3d594f['count'];var _0x60e883=_0x537ee1?0x0:_0x232f2a[_0x97b6('0x1f')];var _0x12f0b1=_0x537ee1?_0x3d594f[_0x97b6('0x22')]:_0x232f2a[_0x97b6('0x1f')]+_0x232f2a[_0x97b6('0x20')];var _0x3b2109;if(_0x12f0b1>=_0x51ec15){_0x12f0b1=_0x51ec15;_0x3b2109=0xc8;}else{_0x3b2109=0xce;}_0x250860['status'](_0x3b2109);return _0x250860[_0x97b6('0x23')](_0x97b6('0x24'),_0x60e883+'-'+_0x12f0b1+'/'+_0x51ec15)['json'](_0x3d594f);}return null;};}function patchUpdates(_0x1bd448){return function(_0x4c2034){try{jsonpatch[_0x97b6('0x25')](_0x4c2034,_0x1bd448,!![]);}catch(_0x36a008){return BPromise[_0x97b6('0x26')](_0x36a008);}return _0x4c2034[_0x97b6('0x27')]();};}function saveUpdates(_0x7a4669,_0xc210ed){return function(_0x5ab8fe){if(_0x5ab8fe){return _0x5ab8fe[_0x97b6('0x28')](_0x7a4669)[_0x97b6('0x29')](function(_0x4f563d){return _0x4f563d;});}return null;};}function removeEntity(_0x3d3ca3,_0x3d5623){return function(_0x1f5da1){if(_0x1f5da1){return _0x1f5da1[_0x97b6('0x2a')]()[_0x97b6('0x29')](function(){_0x3d3ca3[_0x97b6('0x1c')](0xcc)[_0x97b6('0x1d')]();});}};}function handleEntityNotFound(_0x52da1b,_0x140646){return function(_0x3c8485){if(!_0x3c8485){_0x52da1b['sendStatus'](0x194);}return _0x3c8485;};}function handleError(_0x528b7b,_0x4b7210){_0x4b7210=_0x4b7210||0x1f4;return function(_0x1e666e){logger['error'](_0x1e666e['stack']);if(_0x1e666e[_0x97b6('0x2b')]){delete _0x1e666e[_0x97b6('0x2b')];}_0x528b7b[_0x97b6('0x1c')](_0x4b7210)[_0x97b6('0x2c')](_0x1e666e);};}exports[_0x97b6('0x2d')]=function(_0x3053e5,_0x395b4e){var _0x5906e1={},_0x3cd28d={},_0x5aa706={'count':0x0,'rows':[]};var _0x3aba69=_['map'](db[_0x97b6('0x2e')]['rawAttributes'],function(_0x647768){return{'name':_0x647768[_0x97b6('0x2f')],'type':_0x647768[_0x97b6('0x30')]['key']};});_0x3cd28d[_0x97b6('0x31')]=_[_0x97b6('0x32')](_0x3aba69,'name');_0x3cd28d[_0x97b6('0x33')]=_[_0x97b6('0x34')](_0x3053e5['query']);_0x3cd28d[_0x97b6('0x35')]=_[_0x97b6('0x36')](_0x3cd28d[_0x97b6('0x31')],_0x3cd28d[_0x97b6('0x33')]);_0x5906e1[_0x97b6('0x37')]=_[_0x97b6('0x36')](_0x3cd28d[_0x97b6('0x31')],qs[_0x97b6('0x38')](_0x3053e5[_0x97b6('0x33')][_0x97b6('0x38')]));_0x5906e1[_0x97b6('0x37')]=_0x5906e1[_0x97b6('0x37')]['length']?_0x5906e1[_0x97b6('0x37')]:_0x3cd28d[_0x97b6('0x31')];if(!_0x3053e5['query'][_0x97b6('0x39')](_0x97b6('0x3a'))){_0x5906e1[_0x97b6('0x20')]=qs[_0x97b6('0x20')](_0x3053e5[_0x97b6('0x33')][_0x97b6('0x20')]);_0x5906e1[_0x97b6('0x1f')]=qs['offset'](_0x3053e5[_0x97b6('0x33')]['offset']);}_0x5906e1[_0x97b6('0x3b')]=qs[_0x97b6('0x3c')](_0x3053e5['query'][_0x97b6('0x3c')]);_0x5906e1[_0x97b6('0x3d')]=qs[_0x97b6('0x35')](_[_0x97b6('0x3e')](_0x3053e5['query'],_0x3cd28d[_0x97b6('0x35')]),_0x3aba69);if(_0x3053e5[_0x97b6('0x33')][_0x97b6('0x3f')]){_0x5906e1[_0x97b6('0x3d')]=_[_0x97b6('0x40')](_0x5906e1[_0x97b6('0x3d')],{'$or':_[_0x97b6('0x32')](_0x3aba69,function(_0x5bc912){if(_0x5bc912[_0x97b6('0x30')]!==_0x97b6('0x41')){var _0x2415cb={};_0x2415cb[_0x5bc912[_0x97b6('0x2b')]]={'$like':'%'+_0x3053e5['query'][_0x97b6('0x3f')]+'%'};return _0x2415cb;}})});}_0x5906e1=_[_0x97b6('0x40')]({},_0x5906e1,_0x3053e5['options']);var _0x1a7e84={'where':_0x5906e1[_0x97b6('0x3d')]};return db[_0x97b6('0x2e')][_0x97b6('0x22')](_0x1a7e84)[_0x97b6('0x29')](function(_0x2b289b){_0x5aa706[_0x97b6('0x22')]=_0x2b289b;if(_0x3053e5[_0x97b6('0x33')][_0x97b6('0x42')]){_0x5906e1[_0x97b6('0x43')]=[{'all':!![]}];}return db[_0x97b6('0x2e')][_0x97b6('0x44')](_0x5906e1);})[_0x97b6('0x29')](function(_0x44e3f8){_0x5aa706[_0x97b6('0x45')]=_0x44e3f8;return _0x5aa706;})[_0x97b6('0x29')](respondWithFilteredResult(_0x395b4e,_0x5906e1))['catch'](handleError(_0x395b4e,null));};exports[_0x97b6('0x46')]=function(_0x163aba,_0x2744fb){var _0x55038e={'raw':![],'where':{'id':_0x163aba[_0x97b6('0x47')]['id']}},_0x398699={};_0x398699[_0x97b6('0x31')]=_['keys'](db[_0x97b6('0x2e')][_0x97b6('0x48')]);_0x398699['query']=_[_0x97b6('0x34')](_0x163aba['query']);_0x398699[_0x97b6('0x35')]=_[_0x97b6('0x36')](_0x398699[_0x97b6('0x31')],_0x398699['query']);_0x55038e[_0x97b6('0x37')]=_[_0x97b6('0x36')](_0x398699[_0x97b6('0x31')],qs[_0x97b6('0x38')](_0x163aba[_0x97b6('0x33')][_0x97b6('0x38')]));_0x55038e['attributes']=_0x55038e[_0x97b6('0x37')]['length']?_0x55038e[_0x97b6('0x37')]:_0x398699[_0x97b6('0x31')];if(_0x163aba[_0x97b6('0x33')][_0x97b6('0x42')]){_0x55038e[_0x97b6('0x43')]=[{'all':!![]}];}_0x55038e=_[_0x97b6('0x40')]({},_0x55038e,_0x163aba[_0x97b6('0x49')]);return db[_0x97b6('0x2e')]['find'](_0x55038e)['then'](handleEntityNotFound(_0x2744fb,null))['then'](respondWithResult(_0x2744fb,null))[_0x97b6('0x4a')](handleError(_0x2744fb,null));};exports['create']=function(_0x815296,_0x44e011){return db[_0x97b6('0x2e')][_0x97b6('0x4b')](_0x815296['body'],{})[_0x97b6('0x29')](respondWithResult(_0x44e011,0xc9))[_0x97b6('0x4a')](handleError(_0x44e011,null));};exports['update']=function(_0x558cdf,_0x2deadf){if(_0x558cdf[_0x97b6('0x4c')]['id']){delete _0x558cdf[_0x97b6('0x4c')]['id'];}return db[_0x97b6('0x2e')][_0x97b6('0x4d')]({'where':{'id':_0x558cdf['params']['id']}})[_0x97b6('0x29')](handleEntityNotFound(_0x2deadf,null))['then'](saveUpdates(_0x558cdf[_0x97b6('0x4c')],null))['then'](respondWithResult(_0x2deadf,null))['catch'](handleError(_0x2deadf,null));};exports[_0x97b6('0x2a')]=function(_0x25d8c1,_0x1d3293){return db[_0x97b6('0x2e')][_0x97b6('0x4d')]({'where':{'id':_0x25d8c1[_0x97b6('0x47')]['id']}})[_0x97b6('0x29')](handleEntityNotFound(_0x1d3293,null))[_0x97b6('0x29')](removeEntity(_0x1d3293,null))[_0x97b6('0x4a')](handleError(_0x1d3293,null));};exports[_0x97b6('0x4e')]=function(_0x45888c,_0x224ead,_0xa2c022){var _0x52364a={};var _0x275491={};var _0x4e1d86;var _0x205a3b;return db[_0x97b6('0x2e')][_0x97b6('0x4f')]({'where':{'id':_0x45888c['params']['id']}})['then'](handleEntityNotFound(_0x224ead,null))[_0x97b6('0x29')](function(_0x3b825f){if(_0x3b825f){_0x4e1d86=_0x3b825f;_0x275491['model']=_['keys'](db[_0x97b6('0x50')][_0x97b6('0x48')]);_0x275491[_0x97b6('0x33')]=_[_0x97b6('0x34')](_0x45888c[_0x97b6('0x33')]);_0x275491['filters']=_[_0x97b6('0x36')](_0x275491['model'],_0x275491[_0x97b6('0x33')]);_0x52364a[_0x97b6('0x37')]=_[_0x97b6('0x36')](_0x275491[_0x97b6('0x31')],qs[_0x97b6('0x38')](_0x45888c['query']['fields']));_0x52364a['attributes']=_0x52364a[_0x97b6('0x37')][_0x97b6('0x51')]?_0x52364a['attributes']:_0x275491[_0x97b6('0x31')];_0x52364a['order']=qs[_0x97b6('0x3c')](_0x45888c[_0x97b6('0x33')][_0x97b6('0x3c')]);_0x52364a[_0x97b6('0x3d')]=qs[_0x97b6('0x35')](_[_0x97b6('0x3e')](_0x45888c[_0x97b6('0x33')],_0x275491[_0x97b6('0x35')]));if(_0x45888c['query'][_0x97b6('0x3f')]){_0x52364a[_0x97b6('0x3d')]=_['merge'](_0x52364a[_0x97b6('0x3d')],{'$or':_[_0x97b6('0x32')](_0x52364a[_0x97b6('0x37')],function(_0x76472c){var _0x466b39={};_0x466b39[_0x76472c]={'$like':'%'+_0x45888c[_0x97b6('0x33')][_0x97b6('0x3f')]+'%'};return _0x466b39;})});}_0x52364a=_[_0x97b6('0x40')]({},_0x52364a,_0x45888c[_0x97b6('0x49')]);return _0x4e1d86[_0x97b6('0x4e')](_0x52364a);}})[_0x97b6('0x29')](function(_0x2a58fe){if(_0x2a58fe){_0x205a3b=_0x2a58fe[_0x97b6('0x51')];if(!_0x45888c[_0x97b6('0x33')][_0x97b6('0x39')](_0x97b6('0x3a'))){_0x52364a['limit']=qs[_0x97b6('0x20')](_0x45888c[_0x97b6('0x33')][_0x97b6('0x20')]);_0x52364a[_0x97b6('0x1f')]=qs[_0x97b6('0x1f')](_0x45888c[_0x97b6('0x33')]['offset']);}return _0x4e1d86[_0x97b6('0x4e')](_0x52364a);}})[_0x97b6('0x29')](function(_0x12c22e){if(_0x12c22e){return _0x12c22e?{'count':_0x205a3b,'rows':_0x12c22e}:null;}})[_0x97b6('0x29')](respondWithResult(_0x224ead,null))[_0x97b6('0x4a')](handleError(_0x224ead,null));};exports['getSubjects']=function(_0x7f56b2,_0x4e35fc,_0x52c5c4){var _0x21216a={};var _0x4eb03c={};var _0x3841bc;var _0x7ff360;return db[_0x97b6('0x2e')][_0x97b6('0x4f')]({'where':{'id':_0x7f56b2[_0x97b6('0x47')]['id']}})[_0x97b6('0x29')](handleEntityNotFound(_0x4e35fc,null))[_0x97b6('0x29')](function(_0x319155){if(_0x319155){_0x3841bc=_0x319155;_0x4eb03c[_0x97b6('0x31')]=_[_0x97b6('0x34')](db[_0x97b6('0x50')][_0x97b6('0x48')]);_0x4eb03c[_0x97b6('0x33')]=_[_0x97b6('0x34')](_0x7f56b2[_0x97b6('0x33')]);_0x4eb03c['filters']=_[_0x97b6('0x36')](_0x4eb03c[_0x97b6('0x31')],_0x4eb03c['query']);_0x21216a[_0x97b6('0x37')]=_[_0x97b6('0x36')](_0x4eb03c[_0x97b6('0x31')],qs['fields'](_0x7f56b2[_0x97b6('0x33')][_0x97b6('0x38')]));_0x21216a[_0x97b6('0x37')]=_0x21216a['attributes']['length']?_0x21216a['attributes']:_0x4eb03c['model'];_0x21216a[_0x97b6('0x3b')]=qs[_0x97b6('0x3c')](_0x7f56b2['query']['sort']);_0x21216a[_0x97b6('0x3d')]=qs['filters'](_[_0x97b6('0x3e')](_0x7f56b2['query'],_0x4eb03c['filters']));if(_0x7f56b2[_0x97b6('0x33')][_0x97b6('0x3f')]){_0x21216a[_0x97b6('0x3d')]=_[_0x97b6('0x40')](_0x21216a[_0x97b6('0x3d')],{'$or':_[_0x97b6('0x32')](_0x21216a[_0x97b6('0x37')],function(_0x52709b){var _0xaeafd1={};_0xaeafd1[_0x52709b]={'$like':'%'+_0x7f56b2[_0x97b6('0x33')]['filter']+'%'};return _0xaeafd1;})});}_0x21216a=_[_0x97b6('0x40')]({},_0x21216a,_0x7f56b2[_0x97b6('0x49')]);return _0x3841bc['getSubjects'](_0x21216a);}})[_0x97b6('0x29')](function(_0x249393){if(_0x249393){_0x7ff360=_0x249393[_0x97b6('0x51')];if(!_0x7f56b2[_0x97b6('0x33')]['hasOwnProperty'](_0x97b6('0x3a'))){_0x21216a[_0x97b6('0x20')]=qs['limit'](_0x7f56b2[_0x97b6('0x33')][_0x97b6('0x20')]);_0x21216a[_0x97b6('0x1f')]=qs['offset'](_0x7f56b2[_0x97b6('0x33')]['offset']);}return _0x3841bc[_0x97b6('0x52')](_0x21216a);}})[_0x97b6('0x29')](function(_0x490d51){if(_0x490d51){return _0x490d51?{'count':_0x7ff360,'rows':_0x490d51}:null;}})['then'](respondWithResult(_0x4e35fc,null))['catch'](handleError(_0x4e35fc,null));};exports['getDescriptions']=function(_0x154265,_0x279a5a,_0x366dd1){var _0x51066c={};var _0x562fb1={};var _0x1d3347;var _0x2d8d5f;return db[_0x97b6('0x2e')][_0x97b6('0x4f')]({'where':{'id':_0x154265[_0x97b6('0x47')]['id']}})[_0x97b6('0x29')](handleEntityNotFound(_0x279a5a,null))['then'](function(_0x5959a7){if(_0x5959a7){_0x1d3347=_0x5959a7;_0x562fb1[_0x97b6('0x31')]=_[_0x97b6('0x34')](db['FreshdeskField']['rawAttributes']);_0x562fb1['query']=_[_0x97b6('0x34')](_0x154265[_0x97b6('0x33')]);_0x562fb1[_0x97b6('0x35')]=_[_0x97b6('0x36')](_0x562fb1[_0x97b6('0x31')],_0x562fb1[_0x97b6('0x33')]);_0x51066c[_0x97b6('0x37')]=_['intersection'](_0x562fb1['model'],qs[_0x97b6('0x38')](_0x154265[_0x97b6('0x33')][_0x97b6('0x38')]));_0x51066c[_0x97b6('0x37')]=_0x51066c['attributes'][_0x97b6('0x51')]?_0x51066c[_0x97b6('0x37')]:_0x562fb1[_0x97b6('0x31')];_0x51066c[_0x97b6('0x3b')]=qs[_0x97b6('0x3c')](_0x154265[_0x97b6('0x33')][_0x97b6('0x3c')]);_0x51066c[_0x97b6('0x3d')]=qs[_0x97b6('0x35')](_[_0x97b6('0x3e')](_0x154265[_0x97b6('0x33')],_0x562fb1['filters']));if(_0x154265['query']['filter']){_0x51066c[_0x97b6('0x3d')]=_['merge'](_0x51066c[_0x97b6('0x3d')],{'$or':_[_0x97b6('0x32')](_0x51066c[_0x97b6('0x37')],function(_0xb45f3a){var _0x21f8c5={};_0x21f8c5[_0xb45f3a]={'$like':'%'+_0x154265[_0x97b6('0x33')][_0x97b6('0x3f')]+'%'};return _0x21f8c5;})});}_0x51066c=_[_0x97b6('0x40')]({},_0x51066c,_0x154265[_0x97b6('0x49')]);return _0x1d3347[_0x97b6('0x53')](_0x51066c);}})[_0x97b6('0x29')](function(_0x157495){if(_0x157495){_0x2d8d5f=_0x157495[_0x97b6('0x51')];if(!_0x154265[_0x97b6('0x33')][_0x97b6('0x39')](_0x97b6('0x3a'))){_0x51066c['limit']=qs[_0x97b6('0x20')](_0x154265[_0x97b6('0x33')][_0x97b6('0x20')]);_0x51066c[_0x97b6('0x1f')]=qs[_0x97b6('0x1f')](_0x154265[_0x97b6('0x33')][_0x97b6('0x1f')]);}return _0x1d3347['getDescriptions'](_0x51066c);}})[_0x97b6('0x29')](function(_0x1b9ecf){if(_0x1b9ecf){return _0x1b9ecf?{'count':_0x2d8d5f,'rows':_0x1b9ecf}:null;}})[_0x97b6('0x29')](respondWithResult(_0x279a5a,null))[_0x97b6('0x4a')](handleError(_0x279a5a,null));};exports[_0x97b6('0x54')]=function(_0x3cc886,_0x25a0af,_0x1bc17f){var _0x116bd0={};var _0x5b1989={};var _0x13627a;var _0x4b46f6;return db[_0x97b6('0x2e')]['findOne']({'where':{'id':_0x3cc886[_0x97b6('0x47')]['id']}})[_0x97b6('0x29')](handleEntityNotFound(_0x25a0af,null))[_0x97b6('0x29')](function(_0x2bee4c){if(_0x2bee4c){_0x13627a=_0x2bee4c;_0x5b1989[_0x97b6('0x31')]=_['keys'](db[_0x97b6('0x55')][_0x97b6('0x48')]);_0x5b1989['query']=_[_0x97b6('0x34')](_0x3cc886[_0x97b6('0x33')]);_0x5b1989['filters']=_[_0x97b6('0x36')](_0x5b1989['model'],_0x5b1989[_0x97b6('0x33')]);_0x116bd0[_0x97b6('0x37')]=_[_0x97b6('0x36')](_0x5b1989['model'],qs[_0x97b6('0x38')](_0x3cc886[_0x97b6('0x33')][_0x97b6('0x38')]));_0x116bd0['attributes']=_0x116bd0[_0x97b6('0x37')][_0x97b6('0x51')]?_0x116bd0[_0x97b6('0x37')]:_0x5b1989[_0x97b6('0x31')];_0x116bd0[_0x97b6('0x3b')]=qs[_0x97b6('0x3c')](_0x3cc886[_0x97b6('0x33')][_0x97b6('0x3c')]);_0x116bd0[_0x97b6('0x3d')]=qs['filters'](_[_0x97b6('0x3e')](_0x3cc886[_0x97b6('0x33')],_0x5b1989[_0x97b6('0x35')]));if(_0x3cc886[_0x97b6('0x33')][_0x97b6('0x3f')]){_0x116bd0[_0x97b6('0x3d')]=_[_0x97b6('0x40')](_0x116bd0[_0x97b6('0x3d')],{'$or':_[_0x97b6('0x32')](_0x116bd0[_0x97b6('0x37')],function(_0x1b3275){var _0x55b968={};_0x55b968[_0x1b3275]={'$like':'%'+_0x3cc886[_0x97b6('0x33')][_0x97b6('0x3f')]+'%'};return _0x55b968;})});}_0x116bd0=_[_0x97b6('0x40')]({},_0x116bd0,_0x3cc886[_0x97b6('0x49')]);return _0x13627a['getTags'](_0x116bd0);}})[_0x97b6('0x29')](function(_0x268fca){if(_0x268fca){_0x4b46f6=_0x268fca[_0x97b6('0x51')];if(!_0x3cc886[_0x97b6('0x33')][_0x97b6('0x39')](_0x97b6('0x3a'))){_0x116bd0[_0x97b6('0x20')]=qs[_0x97b6('0x20')](_0x3cc886[_0x97b6('0x33')][_0x97b6('0x20')]);_0x116bd0[_0x97b6('0x1f')]=qs[_0x97b6('0x1f')](_0x3cc886[_0x97b6('0x33')][_0x97b6('0x1f')]);}return _0x13627a['getTags'](_0x116bd0);}})['then'](function(_0x56e88b){if(_0x56e88b){return _0x56e88b?{'count':_0x4b46f6,'rows':_0x56e88b}:null;}})['then'](respondWithResult(_0x25a0af,null))[_0x97b6('0x4a')](handleError(_0x25a0af,null));};exports[_0x97b6('0x56')]=function(_0x48812b,_0x5c7ca5,_0x56a139){if(_0x48812b[_0x97b6('0x4c')]['id']){delete _0x48812b[_0x97b6('0x4c')]['id'];}return db[_0x97b6('0x2e')][_0x97b6('0x4f')]({'where':{'id':_0x48812b[_0x97b6('0x47')]['id']}})[_0x97b6('0x29')](handleEntityNotFound(_0x5c7ca5,null))[_0x97b6('0x29')](function(_0x60faf){if(_0x60faf){return _0x60faf[_0x97b6('0x56')](_0x48812b[_0x97b6('0x4c')][_0x97b6('0x57')]||[]);}return null;})[_0x97b6('0x29')](respondWithResult(_0x5c7ca5,null))[_0x97b6('0x4a')](handleError(_0x5c7ca5,null));}; \ No newline at end of file +var _0xb1be=['path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','sendStatus','status','end','json','limit','undefined','count','Content-Range','reject','save','update','then','error','stack','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','where','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','destroy','getFields','findOne','FreshdeskField','rawAttributes','filter','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x407de4,_0x39b031){var _0x49b3a5=function(_0x10ea52){while(--_0x10ea52){_0x407de4['push'](_0x407de4['shift']());}};_0x49b3a5(++_0x39b031);}(_0xb1be,0x139));var _0xeb1b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb1be[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xeb1b('0x0'));var rimraf=require(_0xeb1b('0x1'));var zipdir=require(_0xeb1b('0x2'));var jsonpatch=require(_0xeb1b('0x3'));var rp=require(_0xeb1b('0x4'));var moment=require(_0xeb1b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeb1b('0x6'));var util=require('util');var path=require(_0xeb1b('0x7'));var sox=require(_0xeb1b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb1b('0x9'));var _=require(_0xeb1b('0xa'));var squel=require(_0xeb1b('0xb'));var crypto=require(_0xeb1b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeb1b('0xd'));var toCsv=require(_0xeb1b('0xe'));var querystring=require(_0xeb1b('0xf'));var Papa=require(_0xeb1b('0x10'));var Redis=require(_0xeb1b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xeb1b('0x12'));var as=require(_0xeb1b('0x13'));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('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x368980,_0x410934){_0x410934=_0x410934||0xcc;return function(_0x15d72d){if(_0x15d72d){return _0x368980[_0xeb1b('0x14')](_0x410934);}return _0x368980[_0xeb1b('0x15')](_0x410934)[_0xeb1b('0x16')]();};}function respondWithResult(_0x5619e4,_0x3043c6){_0x3043c6=_0x3043c6||0xc8;return function(_0x4c6d35){if(_0x4c6d35){return _0x5619e4['status'](_0x3043c6)[_0xeb1b('0x17')](_0x4c6d35);}};}function respondWithFilteredResult(_0x162bae,_0xae4ee0){return function(_0x20b827){if(_0x20b827){var _0x1a4606=typeof _0xae4ee0['offset']==='undefined'&&typeof _0xae4ee0[_0xeb1b('0x18')]===_0xeb1b('0x19');var _0x451159=_0x20b827[_0xeb1b('0x1a')];var _0x2da777=_0x1a4606?0x0:_0xae4ee0['offset'];var _0xaa721=_0x1a4606?_0x20b827['count']:_0xae4ee0['offset']+_0xae4ee0[_0xeb1b('0x18')];var _0x316af4;if(_0xaa721>=_0x451159){_0xaa721=_0x451159;_0x316af4=0xc8;}else{_0x316af4=0xce;}_0x162bae[_0xeb1b('0x15')](_0x316af4);return _0x162bae['set'](_0xeb1b('0x1b'),_0x2da777+'-'+_0xaa721+'/'+_0x451159)[_0xeb1b('0x17')](_0x20b827);}return null;};}function patchUpdates(_0x26f312){return function(_0x432c1a){try{jsonpatch['apply'](_0x432c1a,_0x26f312,!![]);}catch(_0x1ec6b7){return BPromise[_0xeb1b('0x1c')](_0x1ec6b7);}return _0x432c1a[_0xeb1b('0x1d')]();};}function saveUpdates(_0x391c80,_0x1d33c6){return function(_0x3bb13e){if(_0x3bb13e){return _0x3bb13e[_0xeb1b('0x1e')](_0x391c80)[_0xeb1b('0x1f')](function(_0x3ea891){return _0x3ea891;});}return null;};}function removeEntity(_0x22a017,_0xf2d959){return function(_0x25e858){if(_0x25e858){return _0x25e858['destroy']()['then'](function(){_0x22a017['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37eda7,_0xa0fb79){return function(_0x572eb8){if(!_0x572eb8){_0x37eda7[_0xeb1b('0x14')](0x194);}return _0x572eb8;};}function handleError(_0x2719ec,_0x56b8e4){_0x56b8e4=_0x56b8e4||0x1f4;return function(_0x2f664b){logger[_0xeb1b('0x20')](_0x2f664b[_0xeb1b('0x21')]);if(_0x2f664b['name']){delete _0x2f664b['name'];}_0x2719ec[_0xeb1b('0x15')](_0x56b8e4)['send'](_0x2f664b);};}exports[_0xeb1b('0x22')]=function(_0x59001b,_0x1653d2){var _0x195a5b={},_0x437b5f={},_0x596fb1={'count':0x0,'rows':[]};var _0x324bb4=_[_0xeb1b('0x23')](db[_0xeb1b('0x24')]['rawAttributes'],function(_0x18714f){return{'name':_0x18714f[_0xeb1b('0x25')],'type':_0x18714f[_0xeb1b('0x26')][_0xeb1b('0x27')]};});_0x437b5f[_0xeb1b('0x28')]=_['map'](_0x324bb4,'name');_0x437b5f[_0xeb1b('0x29')]=_[_0xeb1b('0x2a')](_0x59001b[_0xeb1b('0x29')]);_0x437b5f[_0xeb1b('0x2b')]=_[_0xeb1b('0x2c')](_0x437b5f[_0xeb1b('0x28')],_0x437b5f[_0xeb1b('0x29')]);_0x195a5b[_0xeb1b('0x2d')]=_[_0xeb1b('0x2c')](_0x437b5f['model'],qs[_0xeb1b('0x2e')](_0x59001b['query'][_0xeb1b('0x2e')]));_0x195a5b[_0xeb1b('0x2d')]=_0x195a5b[_0xeb1b('0x2d')][_0xeb1b('0x2f')]?_0x195a5b[_0xeb1b('0x2d')]:_0x437b5f[_0xeb1b('0x28')];if(!_0x59001b[_0xeb1b('0x29')][_0xeb1b('0x30')]('nolimit')){_0x195a5b[_0xeb1b('0x18')]=qs[_0xeb1b('0x18')](_0x59001b[_0xeb1b('0x29')][_0xeb1b('0x18')]);_0x195a5b[_0xeb1b('0x31')]=qs[_0xeb1b('0x31')](_0x59001b[_0xeb1b('0x29')]['offset']);}_0x195a5b[_0xeb1b('0x32')]=qs[_0xeb1b('0x33')](_0x59001b['query'][_0xeb1b('0x33')]);_0x195a5b['where']=qs['filters'](_[_0xeb1b('0x34')](_0x59001b[_0xeb1b('0x29')],_0x437b5f[_0xeb1b('0x2b')]),_0x324bb4);if(_0x59001b[_0xeb1b('0x29')]['filter']){_0x195a5b[_0xeb1b('0x35')]=_['merge'](_0x195a5b[_0xeb1b('0x35')],{'$or':_['map'](_0x324bb4,function(_0x506945){if(_0x506945['type']!==_0xeb1b('0x36')){var _0x5bc629={};_0x5bc629[_0x506945[_0xeb1b('0x37')]]={'$like':'%'+_0x59001b[_0xeb1b('0x29')]['filter']+'%'};return _0x5bc629;}})});}_0x195a5b=_[_0xeb1b('0x38')]({},_0x195a5b,_0x59001b[_0xeb1b('0x39')]);var _0x576547={'where':_0x195a5b['where']};return db[_0xeb1b('0x24')][_0xeb1b('0x1a')](_0x576547)[_0xeb1b('0x1f')](function(_0x398705){_0x596fb1[_0xeb1b('0x1a')]=_0x398705;if(_0x59001b['query'][_0xeb1b('0x3a')]){_0x195a5b[_0xeb1b('0x3b')]=[{'all':!![]}];}return db[_0xeb1b('0x24')][_0xeb1b('0x3c')](_0x195a5b);})[_0xeb1b('0x1f')](function(_0x3c09cb){_0x596fb1[_0xeb1b('0x3d')]=_0x3c09cb;return _0x596fb1;})[_0xeb1b('0x1f')](respondWithFilteredResult(_0x1653d2,_0x195a5b))['catch'](handleError(_0x1653d2,null));};exports['show']=function(_0x34e26f,_0x576a97){var _0x53166e={'raw':![],'where':{'id':_0x34e26f[_0xeb1b('0x3e')]['id']}},_0x1e5e13={};_0x1e5e13[_0xeb1b('0x28')]=_['keys'](db[_0xeb1b('0x24')]['rawAttributes']);_0x1e5e13[_0xeb1b('0x29')]=_[_0xeb1b('0x2a')](_0x34e26f[_0xeb1b('0x29')]);_0x1e5e13[_0xeb1b('0x2b')]=_[_0xeb1b('0x2c')](_0x1e5e13[_0xeb1b('0x28')],_0x1e5e13['query']);_0x53166e[_0xeb1b('0x2d')]=_[_0xeb1b('0x2c')](_0x1e5e13[_0xeb1b('0x28')],qs[_0xeb1b('0x2e')](_0x34e26f[_0xeb1b('0x29')][_0xeb1b('0x2e')]));_0x53166e['attributes']=_0x53166e[_0xeb1b('0x2d')][_0xeb1b('0x2f')]?_0x53166e[_0xeb1b('0x2d')]:_0x1e5e13[_0xeb1b('0x28')];if(_0x34e26f[_0xeb1b('0x29')][_0xeb1b('0x3a')]){_0x53166e[_0xeb1b('0x3b')]=[{'all':!![]}];}_0x53166e=_[_0xeb1b('0x38')]({},_0x53166e,_0x34e26f[_0xeb1b('0x39')]);return db[_0xeb1b('0x24')][_0xeb1b('0x3f')](_0x53166e)[_0xeb1b('0x1f')](handleEntityNotFound(_0x576a97,null))[_0xeb1b('0x1f')](respondWithResult(_0x576a97,null))[_0xeb1b('0x40')](handleError(_0x576a97,null));};exports[_0xeb1b('0x41')]=function(_0x1eb900,_0x3bd09b){return db[_0xeb1b('0x24')][_0xeb1b('0x41')](_0x1eb900[_0xeb1b('0x42')],{})[_0xeb1b('0x1f')](respondWithResult(_0x3bd09b,0xc9))[_0xeb1b('0x40')](handleError(_0x3bd09b,null));};exports['update']=function(_0x4fe562,_0x586635){if(_0x4fe562[_0xeb1b('0x42')]['id']){delete _0x4fe562[_0xeb1b('0x42')]['id'];}return db[_0xeb1b('0x24')][_0xeb1b('0x3f')]({'where':{'id':_0x4fe562[_0xeb1b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x586635,null))[_0xeb1b('0x1f')](saveUpdates(_0x4fe562[_0xeb1b('0x42')],null))[_0xeb1b('0x1f')](respondWithResult(_0x586635,null))[_0xeb1b('0x40')](handleError(_0x586635,null));};exports[_0xeb1b('0x43')]=function(_0x34b492,_0x4db56e){return db[_0xeb1b('0x24')][_0xeb1b('0x3f')]({'where':{'id':_0x34b492['params']['id']}})[_0xeb1b('0x1f')](handleEntityNotFound(_0x4db56e,null))[_0xeb1b('0x1f')](removeEntity(_0x4db56e,null))['catch'](handleError(_0x4db56e,null));};exports[_0xeb1b('0x44')]=function(_0x10fbb3,_0xdd9b9e,_0x4e6215){var _0x3f892b={};var _0x11b2dd={};var _0xfd9943;var _0x1e0778;return db['FreshdeskConfiguration'][_0xeb1b('0x45')]({'where':{'id':_0x10fbb3[_0xeb1b('0x3e')]['id']}})[_0xeb1b('0x1f')](handleEntityNotFound(_0xdd9b9e,null))[_0xeb1b('0x1f')](function(_0x341fc6){if(_0x341fc6){_0xfd9943=_0x341fc6;_0x11b2dd[_0xeb1b('0x28')]=_[_0xeb1b('0x2a')](db[_0xeb1b('0x46')][_0xeb1b('0x47')]);_0x11b2dd[_0xeb1b('0x29')]=_['keys'](_0x10fbb3[_0xeb1b('0x29')]);_0x11b2dd[_0xeb1b('0x2b')]=_[_0xeb1b('0x2c')](_0x11b2dd[_0xeb1b('0x28')],_0x11b2dd[_0xeb1b('0x29')]);_0x3f892b[_0xeb1b('0x2d')]=_[_0xeb1b('0x2c')](_0x11b2dd[_0xeb1b('0x28')],qs[_0xeb1b('0x2e')](_0x10fbb3[_0xeb1b('0x29')][_0xeb1b('0x2e')]));_0x3f892b[_0xeb1b('0x2d')]=_0x3f892b[_0xeb1b('0x2d')][_0xeb1b('0x2f')]?_0x3f892b[_0xeb1b('0x2d')]:_0x11b2dd['model'];_0x3f892b[_0xeb1b('0x32')]=qs[_0xeb1b('0x33')](_0x10fbb3['query'][_0xeb1b('0x33')]);_0x3f892b['where']=qs['filters'](_['pick'](_0x10fbb3[_0xeb1b('0x29')],_0x11b2dd[_0xeb1b('0x2b')]));if(_0x10fbb3['query'][_0xeb1b('0x48')]){_0x3f892b[_0xeb1b('0x35')]=_['merge'](_0x3f892b[_0xeb1b('0x35')],{'$or':_[_0xeb1b('0x23')](_0x3f892b['attributes'],function(_0x28f240){var _0x15907e={};_0x15907e[_0x28f240]={'$like':'%'+_0x10fbb3[_0xeb1b('0x29')]['filter']+'%'};return _0x15907e;})});}_0x3f892b=_[_0xeb1b('0x38')]({},_0x3f892b,_0x10fbb3[_0xeb1b('0x39')]);return _0xfd9943[_0xeb1b('0x44')](_0x3f892b);}})['then'](function(_0x33805a){if(_0x33805a){_0x1e0778=_0x33805a['length'];if(!_0x10fbb3[_0xeb1b('0x29')][_0xeb1b('0x30')](_0xeb1b('0x49'))){_0x3f892b[_0xeb1b('0x18')]=qs[_0xeb1b('0x18')](_0x10fbb3[_0xeb1b('0x29')]['limit']);_0x3f892b[_0xeb1b('0x31')]=qs['offset'](_0x10fbb3[_0xeb1b('0x29')][_0xeb1b('0x31')]);}return _0xfd9943['getFields'](_0x3f892b);}})[_0xeb1b('0x1f')](function(_0x2ec47c){if(_0x2ec47c){return _0x2ec47c?{'count':_0x1e0778,'rows':_0x2ec47c}:null;}})[_0xeb1b('0x1f')](respondWithResult(_0xdd9b9e,null))[_0xeb1b('0x40')](handleError(_0xdd9b9e,null));};exports[_0xeb1b('0x4a')]=function(_0x4641d1,_0xb723c9,_0x3e64ce){var _0x16beb9={};var _0x2b0b41={};var _0x8c8075;var _0x213d03;return db[_0xeb1b('0x24')][_0xeb1b('0x45')]({'where':{'id':_0x4641d1['params']['id']}})[_0xeb1b('0x1f')](handleEntityNotFound(_0xb723c9,null))[_0xeb1b('0x1f')](function(_0x1002d4){if(_0x1002d4){_0x8c8075=_0x1002d4;_0x2b0b41[_0xeb1b('0x28')]=_[_0xeb1b('0x2a')](db[_0xeb1b('0x46')][_0xeb1b('0x47')]);_0x2b0b41['query']=_[_0xeb1b('0x2a')](_0x4641d1[_0xeb1b('0x29')]);_0x2b0b41[_0xeb1b('0x2b')]=_['intersection'](_0x2b0b41[_0xeb1b('0x28')],_0x2b0b41[_0xeb1b('0x29')]);_0x16beb9[_0xeb1b('0x2d')]=_[_0xeb1b('0x2c')](_0x2b0b41[_0xeb1b('0x28')],qs[_0xeb1b('0x2e')](_0x4641d1[_0xeb1b('0x29')][_0xeb1b('0x2e')]));_0x16beb9[_0xeb1b('0x2d')]=_0x16beb9[_0xeb1b('0x2d')]['length']?_0x16beb9['attributes']:_0x2b0b41[_0xeb1b('0x28')];_0x16beb9[_0xeb1b('0x32')]=qs[_0xeb1b('0x33')](_0x4641d1[_0xeb1b('0x29')]['sort']);_0x16beb9[_0xeb1b('0x35')]=qs[_0xeb1b('0x2b')](_['pick'](_0x4641d1[_0xeb1b('0x29')],_0x2b0b41['filters']));if(_0x4641d1[_0xeb1b('0x29')]['filter']){_0x16beb9['where']=_[_0xeb1b('0x38')](_0x16beb9[_0xeb1b('0x35')],{'$or':_[_0xeb1b('0x23')](_0x16beb9[_0xeb1b('0x2d')],function(_0x1c2e27){var _0xa8bed7={};_0xa8bed7[_0x1c2e27]={'$like':'%'+_0x4641d1['query']['filter']+'%'};return _0xa8bed7;})});}_0x16beb9=_[_0xeb1b('0x38')]({},_0x16beb9,_0x4641d1[_0xeb1b('0x39')]);return _0x8c8075['getSubjects'](_0x16beb9);}})[_0xeb1b('0x1f')](function(_0x561ee9){if(_0x561ee9){_0x213d03=_0x561ee9['length'];if(!_0x4641d1[_0xeb1b('0x29')]['hasOwnProperty']('nolimit')){_0x16beb9[_0xeb1b('0x18')]=qs[_0xeb1b('0x18')](_0x4641d1[_0xeb1b('0x29')][_0xeb1b('0x18')]);_0x16beb9[_0xeb1b('0x31')]=qs[_0xeb1b('0x31')](_0x4641d1[_0xeb1b('0x29')][_0xeb1b('0x31')]);}return _0x8c8075[_0xeb1b('0x4a')](_0x16beb9);}})[_0xeb1b('0x1f')](function(_0x204473){if(_0x204473){return _0x204473?{'count':_0x213d03,'rows':_0x204473}:null;}})[_0xeb1b('0x1f')](respondWithResult(_0xb723c9,null))[_0xeb1b('0x40')](handleError(_0xb723c9,null));};exports[_0xeb1b('0x4b')]=function(_0x3ce9c5,_0x4de5ac,_0x458589){var _0x2b4126={};var _0x42d8b9={};var _0x30f83e;var _0x1cffd0;return db[_0xeb1b('0x24')][_0xeb1b('0x45')]({'where':{'id':_0x3ce9c5[_0xeb1b('0x3e')]['id']}})[_0xeb1b('0x1f')](handleEntityNotFound(_0x4de5ac,null))['then'](function(_0x4db2bd){if(_0x4db2bd){_0x30f83e=_0x4db2bd;_0x42d8b9['model']=_[_0xeb1b('0x2a')](db[_0xeb1b('0x46')]['rawAttributes']);_0x42d8b9[_0xeb1b('0x29')]=_[_0xeb1b('0x2a')](_0x3ce9c5[_0xeb1b('0x29')]);_0x42d8b9[_0xeb1b('0x2b')]=_[_0xeb1b('0x2c')](_0x42d8b9[_0xeb1b('0x28')],_0x42d8b9[_0xeb1b('0x29')]);_0x2b4126[_0xeb1b('0x2d')]=_[_0xeb1b('0x2c')](_0x42d8b9['model'],qs[_0xeb1b('0x2e')](_0x3ce9c5[_0xeb1b('0x29')][_0xeb1b('0x2e')]));_0x2b4126[_0xeb1b('0x2d')]=_0x2b4126['attributes'][_0xeb1b('0x2f')]?_0x2b4126[_0xeb1b('0x2d')]:_0x42d8b9[_0xeb1b('0x28')];_0x2b4126['order']=qs[_0xeb1b('0x33')](_0x3ce9c5[_0xeb1b('0x29')]['sort']);_0x2b4126[_0xeb1b('0x35')]=qs[_0xeb1b('0x2b')](_['pick'](_0x3ce9c5[_0xeb1b('0x29')],_0x42d8b9['filters']));if(_0x3ce9c5[_0xeb1b('0x29')][_0xeb1b('0x48')]){_0x2b4126['where']=_[_0xeb1b('0x38')](_0x2b4126[_0xeb1b('0x35')],{'$or':_[_0xeb1b('0x23')](_0x2b4126[_0xeb1b('0x2d')],function(_0x46aaf2){var _0x4b6ba4={};_0x4b6ba4[_0x46aaf2]={'$like':'%'+_0x3ce9c5[_0xeb1b('0x29')][_0xeb1b('0x48')]+'%'};return _0x4b6ba4;})});}_0x2b4126=_['merge']({},_0x2b4126,_0x3ce9c5[_0xeb1b('0x39')]);return _0x30f83e[_0xeb1b('0x4b')](_0x2b4126);}})[_0xeb1b('0x1f')](function(_0x226e70){if(_0x226e70){_0x1cffd0=_0x226e70[_0xeb1b('0x2f')];if(!_0x3ce9c5['query'][_0xeb1b('0x30')](_0xeb1b('0x49'))){_0x2b4126['limit']=qs[_0xeb1b('0x18')](_0x3ce9c5[_0xeb1b('0x29')][_0xeb1b('0x18')]);_0x2b4126['offset']=qs[_0xeb1b('0x31')](_0x3ce9c5[_0xeb1b('0x29')]['offset']);}return _0x30f83e[_0xeb1b('0x4b')](_0x2b4126);}})[_0xeb1b('0x1f')](function(_0x18effa){if(_0x18effa){return _0x18effa?{'count':_0x1cffd0,'rows':_0x18effa}:null;}})[_0xeb1b('0x1f')](respondWithResult(_0x4de5ac,null))[_0xeb1b('0x40')](handleError(_0x4de5ac,null));};exports[_0xeb1b('0x4c')]=function(_0x599ae2,_0x4ef39d,_0x58eb22){var _0x3484bf={};var _0x3d4fa5={};var _0x2d2d2b;var _0x3d3e4a;return db['FreshdeskConfiguration'][_0xeb1b('0x45')]({'where':{'id':_0x599ae2[_0xeb1b('0x3e')]['id']}})[_0xeb1b('0x1f')](handleEntityNotFound(_0x4ef39d,null))[_0xeb1b('0x1f')](function(_0x41d2d4){if(_0x41d2d4){_0x2d2d2b=_0x41d2d4;_0x3d4fa5[_0xeb1b('0x28')]=_['keys'](db[_0xeb1b('0x4d')][_0xeb1b('0x47')]);_0x3d4fa5['query']=_[_0xeb1b('0x2a')](_0x599ae2[_0xeb1b('0x29')]);_0x3d4fa5[_0xeb1b('0x2b')]=_['intersection'](_0x3d4fa5['model'],_0x3d4fa5[_0xeb1b('0x29')]);_0x3484bf[_0xeb1b('0x2d')]=_[_0xeb1b('0x2c')](_0x3d4fa5[_0xeb1b('0x28')],qs['fields'](_0x599ae2[_0xeb1b('0x29')]['fields']));_0x3484bf[_0xeb1b('0x2d')]=_0x3484bf[_0xeb1b('0x2d')][_0xeb1b('0x2f')]?_0x3484bf['attributes']:_0x3d4fa5['model'];_0x3484bf[_0xeb1b('0x32')]=qs[_0xeb1b('0x33')](_0x599ae2[_0xeb1b('0x29')][_0xeb1b('0x33')]);_0x3484bf[_0xeb1b('0x35')]=qs[_0xeb1b('0x2b')](_[_0xeb1b('0x34')](_0x599ae2[_0xeb1b('0x29')],_0x3d4fa5[_0xeb1b('0x2b')]));if(_0x599ae2[_0xeb1b('0x29')][_0xeb1b('0x48')]){_0x3484bf[_0xeb1b('0x35')]=_[_0xeb1b('0x38')](_0x3484bf[_0xeb1b('0x35')],{'$or':_[_0xeb1b('0x23')](_0x3484bf[_0xeb1b('0x2d')],function(_0x3a304a){var _0x1d3973={};_0x1d3973[_0x3a304a]={'$like':'%'+_0x599ae2[_0xeb1b('0x29')][_0xeb1b('0x48')]+'%'};return _0x1d3973;})});}_0x3484bf=_['merge']({},_0x3484bf,_0x599ae2[_0xeb1b('0x39')]);return _0x2d2d2b[_0xeb1b('0x4c')](_0x3484bf);}})[_0xeb1b('0x1f')](function(_0x3da5d9){if(_0x3da5d9){_0x3d3e4a=_0x3da5d9[_0xeb1b('0x2f')];if(!_0x599ae2[_0xeb1b('0x29')][_0xeb1b('0x30')](_0xeb1b('0x49'))){_0x3484bf[_0xeb1b('0x18')]=qs[_0xeb1b('0x18')](_0x599ae2[_0xeb1b('0x29')][_0xeb1b('0x18')]);_0x3484bf['offset']=qs[_0xeb1b('0x31')](_0x599ae2[_0xeb1b('0x29')][_0xeb1b('0x31')]);}return _0x2d2d2b[_0xeb1b('0x4c')](_0x3484bf);}})[_0xeb1b('0x1f')](function(_0xa155a0){if(_0xa155a0){return _0xa155a0?{'count':_0x3d3e4a,'rows':_0xa155a0}:null;}})[_0xeb1b('0x1f')](respondWithResult(_0x4ef39d,null))[_0xeb1b('0x40')](handleError(_0x4ef39d,null));};exports[_0xeb1b('0x4e')]=function(_0x41a471,_0x17c358,_0x59a055){if(_0x41a471[_0xeb1b('0x42')]['id']){delete _0x41a471['body']['id'];}return db[_0xeb1b('0x24')]['findOne']({'where':{'id':_0x41a471[_0xeb1b('0x3e')]['id']}})[_0xeb1b('0x1f')](handleEntityNotFound(_0x17c358,null))[_0xeb1b('0x1f')](function(_0x532507){if(_0x532507){return _0x532507[_0xeb1b('0x4e')](_0x41a471[_0xeb1b('0x42')][_0xeb1b('0x4f')]||[]);}return null;})[_0xeb1b('0x1f')](respondWithResult(_0x17c358,null))[_0xeb1b('0x40')](handleError(_0x17c358,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index ce44842..a08a34c 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 _0xa17f=['bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xa17f,0x80));var _0xfa17=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xa17f[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0xfa17('0x0'));var util=require(_0xfa17('0x1'));var logger=require('../../config/logger')(_0xfa17('0x2'));var moment=require(_0xfa17('0x3'));var BPromise=require(_0xfa17('0x4'));var rp=require(_0xfa17('0x5'));var fs=require('fs');var path=require(_0xfa17('0x6'));var rimraf=require(_0xfa17('0x7'));var config=require('../../config/environment');var attributes=require(_0xfa17('0x8'));module[_0xfa17('0x9')]=function(_0x1e9408,_0x50e7d2){return _0x1e9408['define'](_0xfa17('0xa'),attributes,{'tableName':_0xfa17('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x407b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskConfiguration'];(function(_0x2f7696,_0x1e9085){var _0x13d6f1=function(_0x1dc25a){while(--_0x1dc25a){_0x2f7696['push'](_0x2f7696['shift']());}};_0x13d6f1(++_0x1e9085);}(_0x407b,0x78));var _0xb407=function(_0xc94ef9,_0x38dc30){_0xc94ef9=_0xc94ef9-0x0;var _0x25af61=_0x407b[_0xc94ef9];return _0x25af61;};'use strict';var _=require('lodash');var util=require(_0xb407('0x0'));var logger=require(_0xb407('0x1'))(_0xb407('0x2'));var moment=require(_0xb407('0x3'));var BPromise=require(_0xb407('0x4'));var rp=require(_0xb407('0x5'));var fs=require('fs');var path=require(_0xb407('0x6'));var rimraf=require(_0xb407('0x7'));var config=require(_0xb407('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xb407('0x9')]=function(_0x226ce8,_0x2cef53){return _0x226ce8[_0xb407('0xa')](_0xb407('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 27eab0f..ef6214e 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 _0x9ccd=['rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2e5e73,_0x30d4d9){var _0x4cf641=function(_0x26b1b6){while(--_0x26b1b6){_0x2e5e73['push'](_0x2e5e73['shift']());}};_0x4cf641(++_0x30d4d9);}(_0x9ccd,0xdf));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd9cc('0x0'));var util=require(_0xd9cc('0x1'));var moment=require(_0xd9cc('0x2'));var BPromise=require(_0xd9cc('0x3'));var rs=require(_0xd9cc('0x4'));var fs=require('fs');var Redis=require(_0xd9cc('0x5'));var db=require(_0xd9cc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9cc('0x7'))(_0xd9cc('0x8'));var config=require(_0xd9cc('0x9'));var jayson=require(_0xd9cc('0xa'));var client=jayson[_0xd9cc('0xb')][_0xd9cc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1eda17,_0x3f8483,_0x1af94d){return new BPromise(function(_0x28f915,_0x53bd7d){return client['request'](_0x1eda17,_0x1af94d)[_0xd9cc('0xd')](function(_0x569fb7){logger['info'](_0xd9cc('0xe'),_0x3f8483,_0xd9cc('0xf'));logger[_0xd9cc('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3f8483,_0xd9cc('0xf'),JSON[_0xd9cc('0x11')](_0x569fb7));if(_0x569fb7['error']){if(_0x569fb7[_0xd9cc('0x12')]['code']===0x1f4){logger[_0xd9cc('0x12')](_0xd9cc('0xe'),_0x3f8483,_0x569fb7[_0xd9cc('0x12')][_0xd9cc('0x13')]);return _0x53bd7d(_0x569fb7[_0xd9cc('0x12')][_0xd9cc('0x13')]);}logger[_0xd9cc('0x12')](_0xd9cc('0xe'),_0x3f8483,_0x569fb7[_0xd9cc('0x12')]['message']);return _0x28f915(_0x569fb7[_0xd9cc('0x12')][_0xd9cc('0x13')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f8483,_0xd9cc('0xf'));_0x28f915(_0x569fb7[_0xd9cc('0x14')][_0xd9cc('0x13')]);}})['catch'](function(_0x7f8142){logger[_0xd9cc('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f8483,_0x7f8142);_0x53bd7d(_0x7f8142);});});} \ No newline at end of file +var _0xd14e=['../../config/logger','rpc','../../config/environment','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd14e,0x197));var _0xed14=function(_0x5427c6,_0x1240a1){_0x5427c6=_0x5427c6-0x0;var _0x5144ff=_0xd14e[_0x5427c6];return _0x5144ff;};'use strict';var _=require(_0xed14('0x0'));var util=require(_0xed14('0x1'));var moment=require(_0xed14('0x2'));var BPromise=require(_0xed14('0x3'));var rs=require(_0xed14('0x4'));var fs=require('fs');var Redis=require(_0xed14('0x5'));var db=require(_0xed14('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xed14('0x7'))(_0xed14('0x8'));var config=require(_0xed14('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xed14('0xa')][_0xed14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36722a,_0x17f6a7,_0x3ef4e7){return new BPromise(function(_0x3a7a9d,_0x4786e5){return client[_0xed14('0xc')](_0x36722a,_0x3ef4e7)['then'](function(_0xa6d622){logger[_0xed14('0xd')](_0xed14('0xe'),_0x17f6a7,_0xed14('0xf'));logger[_0xed14('0x10')](_0xed14('0x11'),_0x17f6a7,_0xed14('0xf'),JSON['stringify'](_0xa6d622));if(_0xa6d622[_0xed14('0x12')]){if(_0xa6d622[_0xed14('0x12')][_0xed14('0x13')]===0x1f4){logger[_0xed14('0x12')](_0xed14('0xe'),_0x17f6a7,_0xa6d622[_0xed14('0x12')][_0xed14('0x14')]);return _0x4786e5(_0xa6d622['error'][_0xed14('0x14')]);}logger['error'](_0xed14('0xe'),_0x17f6a7,_0xa6d622[_0xed14('0x12')][_0xed14('0x14')]);return _0x3a7a9d(_0xa6d622[_0xed14('0x12')][_0xed14('0x14')]);}else{logger[_0xed14('0xd')](_0xed14('0xe'),_0x17f6a7,_0xed14('0xf'));_0x3a7a9d(_0xa6d622[_0xed14('0x15')][_0xed14('0x14')]);}})[_0xed14('0x16')](function(_0x4e56d3){logger['error'](_0xed14('0xe'),_0x17f6a7,_0x4e56d3);_0x4786e5(_0x4e56d3);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index a210f7a..bf32a24 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 _0x2648=['/:id','show','post','isAuthenticated','create','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','get'];(function(_0x449bb5,_0x4f08f2){var _0x414ce7=function(_0x75030e){while(--_0x75030e){_0x449bb5['push'](_0x449bb5['shift']());}};_0x414ce7(++_0x4f08f2);}(_0x2648,0x76));var _0x8264=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2648[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8264('0x0'));var util=require(_0x8264('0x1'));var path=require(_0x8264('0x2'));var timeout=require(_0x8264('0x3'));var express=require(_0x8264('0x4'));var router=express['Router']();var fs_extra=require(_0x8264('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8264('0x6'));var config=require(_0x8264('0x7'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8264('0x8')]);router[_0x8264('0x9')](_0x8264('0xa'),auth['isAuthenticated'](),controller[_0x8264('0xb')]);router[_0x8264('0xc')]('/',auth[_0x8264('0xd')](),controller[_0x8264('0xe')]);router['put'](_0x8264('0xa'),auth[_0x8264('0xd')](),controller['update']);router[_0x8264('0xf')](_0x8264('0xa'),auth[_0x8264('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd4d9=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','index','show','post','isAuthenticated','create','/:id'];(function(_0x879aba,_0x22bbe1){var _0x2dff0b=function(_0x21da3e){while(--_0x21da3e){_0x879aba['push'](_0x879aba['shift']());}};_0x2dff0b(++_0x22bbe1);}(_0xd4d9,0x157));var _0x9d4d=function(_0x81480d,_0x44cb9a){_0x81480d=_0x81480d-0x0;var _0x26d57f=_0xd4d9[_0x81480d];return _0x26d57f;};'use strict';var multer=require(_0x9d4d('0x0'));var util=require(_0x9d4d('0x1'));var path=require(_0x9d4d('0x2'));var timeout=require(_0x9d4d('0x3'));var express=require('express');var router=express[_0x9d4d('0x4')]();var fs_extra=require(_0x9d4d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9d4d('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x9d4d('0x7')]('/',auth['isAuthenticated'](),controller[_0x9d4d('0x8')]);router[_0x9d4d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9d4d('0x9')]);router[_0x9d4d('0xa')]('/',auth[_0x9d4d('0xb')](),controller[_0x9d4d('0xc')]);router['put'](_0x9d4d('0xd'),auth['isAuthenticated'](),controller[_0x9d4d('0xe')]);router['delete'](_0x9d4d('0xd'),auth[_0x9d4d('0xb')](),controller[_0x9d4d('0xf')]);module[_0x9d4d('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index aa77435..1108c88 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 _0x1b3c=['variable','customVariable','picklist','STRING','string','sequelize','exports','ENUM'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0x1b3c,0x155));var _0xc1b3=function(_0x19c55c,_0x1323fe){_0x19c55c=_0x19c55c-0x0;var _0x140dc4=_0x1b3c[_0x19c55c];return _0x140dc4;};'use strict';var Sequelize=require(_0xc1b3('0x0'));module[_0xc1b3('0x1')]={'type':{'type':Sequelize[_0xc1b3('0x2')]('string',_0xc1b3('0x3'),_0xc1b3('0x4'),'keyValue',_0xc1b3('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc1b3('0x6')]},'key':{'type':Sequelize[_0xc1b3('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc1b3('0x7'),_0xc1b3('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc1b3('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc1b3('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc1b3('0x6')]}}; \ No newline at end of file +var _0xa841=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x431c26,_0x4b8f47){var _0x3092fd=function(_0x4dca59){while(--_0x4dca59){_0x431c26['push'](_0x431c26['shift']());}};_0x3092fd(++_0x4b8f47);}(_0xa841,0xb0));var _0x1a84=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa841[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x1a84('0x0'));module[_0x1a84('0x1')]={'type':{'type':Sequelize[_0x1a84('0x2')](_0x1a84('0x3'),_0x1a84('0x4'),'customVariable',_0x1a84('0x5'),_0x1a84('0x6')),'defaultValue':_0x1a84('0x3')},'content':{'type':Sequelize[_0x1a84('0x7')]},'key':{'type':Sequelize[_0x1a84('0x7')]},'keyType':{'type':Sequelize[_0x1a84('0x2')](_0x1a84('0x3'),_0x1a84('0x4'),_0x1a84('0x8'))},'keyContent':{'type':Sequelize[_0x1a84('0x7')]},'idField':{'type':Sequelize[_0x1a84('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1a84('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1a84('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 605f0c5..b95d6e3 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 _0x9c5e=['body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','keys','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x28edf8,_0x3ab79f){_0x28edf8=_0x28edf8-0x0;var _0xb0bbba=_0x9c5e[_0x28edf8];return _0xb0bbba;};'use strict';var emlformat=require(_0xe9c5('0x0'));var rimraf=require(_0xe9c5('0x1'));var zipdir=require(_0xe9c5('0x2'));var jsonpatch=require(_0xe9c5('0x3'));var rp=require(_0xe9c5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9c5('0x5'));var path=require(_0xe9c5('0x6'));var sox=require('sox');var csv=require(_0xe9c5('0x7'));var ejs=require(_0xe9c5('0x8'));var fs=require('fs');var fs_extra=require(_0xe9c5('0x9'));var _=require(_0xe9c5('0xa'));var squel=require('squel');var crypto=require(_0xe9c5('0xb'));var jsforce=require(_0xe9c5('0xc'));var deskjs=require(_0xe9c5('0xd'));var toCsv=require(_0xe9c5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9c5('0xe'));var authService=require(_0xe9c5('0xf'));var qs=require(_0xe9c5('0x10'));var as=require(_0xe9c5('0x11'));var hardwareService=require(_0xe9c5('0x12'));var logger=require(_0xe9c5('0x13'))(_0xe9c5('0x14'));var utils=require(_0xe9c5('0x15'));var config=require(_0xe9c5('0x16'));var licenseUtil=require(_0xe9c5('0x17'));var db=require(_0xe9c5('0x18'))['db'];function respondWithStatusCode(_0x27f3e1,_0x471401){_0x471401=_0x471401||0xcc;return function(_0x25ff11){if(_0x25ff11){return _0x27f3e1[_0xe9c5('0x19')](_0x471401);}return _0x27f3e1[_0xe9c5('0x1a')](_0x471401)['end']();};}function respondWithResult(_0x3cce36,_0xe98b11){_0xe98b11=_0xe98b11||0xc8;return function(_0x5eb474){if(_0x5eb474){return _0x3cce36[_0xe9c5('0x1a')](_0xe98b11)[_0xe9c5('0x1b')](_0x5eb474);}};}function respondWithFilteredResult(_0x232584,_0x5d8236){return function(_0x163253){if(_0x163253){var _0x14eb41=typeof _0x5d8236['offset']===_0xe9c5('0x1c')&&typeof _0x5d8236[_0xe9c5('0x1d')]===_0xe9c5('0x1c');var _0x154390=_0x163253[_0xe9c5('0x1e')];var _0x4d9c7d=_0x14eb41?0x0:_0x5d8236[_0xe9c5('0x1f')];var _0x1cecae=_0x14eb41?_0x163253[_0xe9c5('0x1e')]:_0x5d8236[_0xe9c5('0x1f')]+_0x5d8236['limit'];var _0x26492a;if(_0x1cecae>=_0x154390){_0x1cecae=_0x154390;_0x26492a=0xc8;}else{_0x26492a=0xce;}_0x232584[_0xe9c5('0x1a')](_0x26492a);return _0x232584[_0xe9c5('0x20')](_0xe9c5('0x21'),_0x4d9c7d+'-'+_0x1cecae+'/'+_0x154390)[_0xe9c5('0x1b')](_0x163253);}return null;};}function patchUpdates(_0x58fbad){return function(_0x51e860){try{jsonpatch[_0xe9c5('0x22')](_0x51e860,_0x58fbad,!![]);}catch(_0x57818d){return BPromise[_0xe9c5('0x23')](_0x57818d);}return _0x51e860[_0xe9c5('0x24')]();};}function saveUpdates(_0x21b02a,_0x4d16bc){return function(_0x5750ff){if(_0x5750ff){return _0x5750ff[_0xe9c5('0x25')](_0x21b02a)[_0xe9c5('0x26')](function(_0x37fb90){return _0x37fb90;});}return null;};}function removeEntity(_0x189a13,_0x34a7c8){return function(_0x245161){if(_0x245161){return _0x245161[_0xe9c5('0x27')]()[_0xe9c5('0x26')](function(){_0x189a13[_0xe9c5('0x1a')](0xcc)[_0xe9c5('0x28')]();});}};}function handleEntityNotFound(_0x5a3caa,_0x5c8bb7){return function(_0x250e1c){if(!_0x250e1c){_0x5a3caa[_0xe9c5('0x19')](0x194);}return _0x250e1c;};}function handleError(_0x298dca,_0x3bf679){_0x3bf679=_0x3bf679||0x1f4;return function(_0x33fe71){logger[_0xe9c5('0x29')](_0x33fe71['stack']);if(_0x33fe71[_0xe9c5('0x2a')]){delete _0x33fe71['name'];}_0x298dca[_0xe9c5('0x1a')](_0x3bf679)['send'](_0x33fe71);};}exports[_0xe9c5('0x2b')]=function(_0x2112a6,_0x52d008){var _0x36d145={},_0x46d253={},_0x334f5a={'count':0x0,'rows':[]};var _0x37cfa5=_[_0xe9c5('0x2c')](db['FreshdeskField'][_0xe9c5('0x2d')],function(_0x4fcabd){return{'name':_0x4fcabd[_0xe9c5('0x2e')],'type':_0x4fcabd['type'][_0xe9c5('0x2f')]};});_0x46d253[_0xe9c5('0x30')]=_[_0xe9c5('0x2c')](_0x37cfa5,_0xe9c5('0x2a'));_0x46d253[_0xe9c5('0x31')]=_['keys'](_0x2112a6[_0xe9c5('0x31')]);_0x46d253[_0xe9c5('0x32')]=_[_0xe9c5('0x33')](_0x46d253[_0xe9c5('0x30')],_0x46d253[_0xe9c5('0x31')]);_0x36d145['attributes']=_['intersection'](_0x46d253[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x36d145[_0xe9c5('0x35')]=_0x36d145[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x36d145[_0xe9c5('0x35')]:_0x46d253['model'];if(!_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x37')]('nolimit')){_0x36d145[_0xe9c5('0x1d')]=qs['limit'](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1d')]);_0x36d145[_0xe9c5('0x1f')]=qs[_0xe9c5('0x1f')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1f')]);}_0x36d145[_0xe9c5('0x38')]=qs[_0xe9c5('0x39')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x39')]);_0x36d145[_0xe9c5('0x3a')]=qs[_0xe9c5('0x32')](_[_0xe9c5('0x3b')](_0x2112a6[_0xe9c5('0x31')],_0x46d253[_0xe9c5('0x32')]),_0x37cfa5);if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x3c')]){_0x36d145[_0xe9c5('0x3a')]=_[_0xe9c5('0x3d')](_0x36d145['where'],{'$or':_[_0xe9c5('0x2c')](_0x37cfa5,function(_0x2e3f15){if(_0x2e3f15[_0xe9c5('0x3e')]!==_0xe9c5('0x3f')){var _0x204b53={};_0x204b53[_0x2e3f15[_0xe9c5('0x2a')]]={'$like':'%'+_0x2112a6['query'][_0xe9c5('0x3c')]+'%'};return _0x204b53;}})});}_0x36d145=_[_0xe9c5('0x3d')]({},_0x36d145,_0x2112a6[_0xe9c5('0x40')]);var _0x480b83={'where':_0x36d145[_0xe9c5('0x3a')]};return db[_0xe9c5('0x41')][_0xe9c5('0x1e')](_0x480b83)[_0xe9c5('0x26')](function(_0x2c1615){_0x334f5a[_0xe9c5('0x1e')]=_0x2c1615;if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x36d145[_0xe9c5('0x43')]=[{'all':!![]}];}return db[_0xe9c5('0x41')][_0xe9c5('0x44')](_0x36d145);})['then'](function(_0x51dd18){_0x334f5a[_0xe9c5('0x45')]=_0x51dd18;return _0x334f5a;})[_0xe9c5('0x26')](respondWithFilteredResult(_0x52d008,_0x36d145))[_0xe9c5('0x46')](handleError(_0x52d008,null));};exports[_0xe9c5('0x47')]=function(_0x4ca4b0,_0x4a3fc5){var _0x382405={'raw':!![],'where':{'id':_0x4ca4b0['params']['id']}},_0x144e85={};_0x144e85[_0xe9c5('0x30')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x144e85[_0xe9c5('0x31')]=_[_0xe9c5('0x48')](_0x4ca4b0[_0xe9c5('0x31')]);_0x144e85[_0xe9c5('0x32')]=_['intersection'](_0x144e85[_0xe9c5('0x30')],_0x144e85[_0xe9c5('0x31')]);_0x382405[_0xe9c5('0x35')]=_[_0xe9c5('0x33')](_0x144e85[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x382405['attributes']=_0x382405[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x382405[_0xe9c5('0x35')]:_0x144e85[_0xe9c5('0x30')];if(_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x382405['include']=[{'all':!![]}];}_0x382405=_['merge']({},_0x382405,_0x4ca4b0['options']);return db['FreshdeskField'][_0xe9c5('0x49')](_0x382405)[_0xe9c5('0x26')](handleEntityNotFound(_0x4a3fc5,null))[_0xe9c5('0x26')](respondWithResult(_0x4a3fc5,null))['catch'](handleError(_0x4a3fc5,null));};exports[_0xe9c5('0x4a')]=function(_0x520248,_0x1ed99e){return db[_0xe9c5('0x41')][_0xe9c5('0x4a')](_0x520248[_0xe9c5('0x4b')],{})['then'](respondWithResult(_0x1ed99e,0xc9))[_0xe9c5('0x46')](handleError(_0x1ed99e,null));};exports[_0xe9c5('0x25')]=function(_0x1da6a3,_0x249940){if(_0x1da6a3['body']['id']){delete _0x1da6a3[_0xe9c5('0x4b')]['id'];}return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x1da6a3[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x249940,null))[_0xe9c5('0x26')](saveUpdates(_0x1da6a3['body'],null))[_0xe9c5('0x26')](respondWithResult(_0x249940,null))[_0xe9c5('0x46')](handleError(_0x249940,null));};exports[_0xe9c5('0x27')]=function(_0x9d0154,_0x5e7c24){return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x9d0154[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x5e7c24,null))[_0xe9c5('0x26')](removeEntity(_0x5e7c24,null))[_0xe9c5('0x46')](handleError(_0x5e7c24,null));}; \ No newline at end of file +var _0xb9a7=['merge','VIRTUAL','name','options','includeAll','include','rows','catch','show','params','rawAttributes','intersection','create','body','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','stack','map','FreshdeskField','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xb9a7,0x112));var _0x7b9a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb9a7[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)[_0x7b9a('0x15')]();});}};}function handleEntityNotFound(_0x23219e,_0x5809f5){return function(_0x39b7ec){if(!_0x39b7ec){_0x23219e['sendStatus'](0x194);}return _0x39b7ec;};}function handleError(_0x31eb67,_0x3091ab){_0x3091ab=_0x3091ab||0x1f4;return function(_0x4c2271){logger['error'](_0x4c2271[_0x7b9a('0x20')]);if(_0x4c2271['name']){delete _0x4c2271['name'];}_0x31eb67[_0x7b9a('0x14')](_0x3091ab)['send'](_0x4c2271);};}exports['index']=function(_0x3847b4,_0x4d5880){var _0x5c89b6={},_0x314b6d={},_0x4fee38={'count':0x0,'rows':[]};var _0x1553ae=_[_0x7b9a('0x21')](db[_0x7b9a('0x22')]['rawAttributes'],function(_0x45ccf5){return{'name':_0x45ccf5[_0x7b9a('0x23')],'type':_0x45ccf5[_0x7b9a('0x24')][_0x7b9a('0x25')]};});_0x314b6d[_0x7b9a('0x26')]=_[_0x7b9a('0x21')](_0x1553ae,'name');_0x314b6d['query']=_[_0x7b9a('0x27')](_0x3847b4[_0x7b9a('0x28')]);_0x314b6d[_0x7b9a('0x29')]=_['intersection'](_0x314b6d[_0x7b9a('0x26')],_0x314b6d[_0x7b9a('0x28')]);_0x5c89b6['attributes']=_['intersection'](_0x314b6d[_0x7b9a('0x26')],qs[_0x7b9a('0x2a')](_0x3847b4['query'][_0x7b9a('0x2a')]));_0x5c89b6[_0x7b9a('0x2b')]=_0x5c89b6[_0x7b9a('0x2b')][_0x7b9a('0x2c')]?_0x5c89b6[_0x7b9a('0x2b')]:_0x314b6d['model'];if(!_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x2d')](_0x7b9a('0x2e'))){_0x5c89b6[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x3847b4[_0x7b9a('0x28')]['limit']);_0x5c89b6['offset']=qs[_0x7b9a('0x17')](_0x3847b4[_0x7b9a('0x28')]['offset']);}_0x5c89b6[_0x7b9a('0x2f')]=qs[_0x7b9a('0x30')](_0x3847b4[_0x7b9a('0x28')]['sort']);_0x5c89b6[_0x7b9a('0x31')]=qs[_0x7b9a('0x29')](_['pick'](_0x3847b4['query'],_0x314b6d[_0x7b9a('0x29')]),_0x1553ae);if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]){_0x5c89b6[_0x7b9a('0x31')]=_[_0x7b9a('0x33')](_0x5c89b6[_0x7b9a('0x31')],{'$or':_[_0x7b9a('0x21')](_0x1553ae,function(_0x380f4b){if(_0x380f4b['type']!==_0x7b9a('0x34')){var _0x5ac175={};_0x5ac175[_0x380f4b[_0x7b9a('0x35')]]={'$like':'%'+_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]+'%'};return _0x5ac175;}})});}_0x5c89b6=_[_0x7b9a('0x33')]({},_0x5c89b6,_0x3847b4[_0x7b9a('0x36')]);var _0x89951b={'where':_0x5c89b6['where']};return db[_0x7b9a('0x22')][_0x7b9a('0x19')](_0x89951b)[_0x7b9a('0x1e')](function(_0x1bc1f0){_0x4fee38['count']=_0x1bc1f0;if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x5c89b6[_0x7b9a('0x38')]=[{'all':!![]}];}return db[_0x7b9a('0x22')]['findAll'](_0x5c89b6);})[_0x7b9a('0x1e')](function(_0x53d89a){_0x4fee38[_0x7b9a('0x39')]=_0x53d89a;return _0x4fee38;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x4d5880,_0x5c89b6))[_0x7b9a('0x3a')](handleError(_0x4d5880,null));};exports[_0x7b9a('0x3b')]=function(_0x43fad0,_0x41f541){var _0x56e274={'raw':!![],'where':{'id':_0x43fad0[_0x7b9a('0x3c')]['id']}},_0x33edc6={};_0x33edc6[_0x7b9a('0x26')]=_['keys'](db['FreshdeskField'][_0x7b9a('0x3d')]);_0x33edc6[_0x7b9a('0x28')]=_[_0x7b9a('0x27')](_0x43fad0[_0x7b9a('0x28')]);_0x33edc6[_0x7b9a('0x29')]=_[_0x7b9a('0x3e')](_0x33edc6['model'],_0x33edc6['query']);_0x56e274['attributes']=_[_0x7b9a('0x3e')](_0x33edc6[_0x7b9a('0x26')],qs['fields'](_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x2a')]));_0x56e274[_0x7b9a('0x2b')]=_0x56e274['attributes'][_0x7b9a('0x2c')]?_0x56e274['attributes']:_0x33edc6[_0x7b9a('0x26')];if(_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x56e274[_0x7b9a('0x38')]=[{'all':!![]}];}_0x56e274=_[_0x7b9a('0x33')]({},_0x56e274,_0x43fad0['options']);return db[_0x7b9a('0x22')]['find'](_0x56e274)[_0x7b9a('0x1e')](handleEntityNotFound(_0x41f541,null))['then'](respondWithResult(_0x41f541,null))['catch'](handleError(_0x41f541,null));};exports[_0x7b9a('0x3f')]=function(_0x3727ef,_0x717d08){return db[_0x7b9a('0x22')][_0x7b9a('0x3f')](_0x3727ef[_0x7b9a('0x40')],{})[_0x7b9a('0x1e')](respondWithResult(_0x717d08,0xc9))[_0x7b9a('0x3a')](handleError(_0x717d08,null));};exports[_0x7b9a('0x1d')]=function(_0x5088c7,_0x1d7957){if(_0x5088c7[_0x7b9a('0x40')]['id']){delete _0x5088c7['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x5088c7[_0x7b9a('0x3c')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1d7957,null))[_0x7b9a('0x1e')](saveUpdates(_0x5088c7[_0x7b9a('0x40')],null))['then'](respondWithResult(_0x1d7957,null))[_0x7b9a('0x3a')](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1f')]=function(_0x287dea,_0x33b200){return db[_0x7b9a('0x22')]['find']({'where':{'id':_0x287dea[_0x7b9a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x33b200,null))[_0x7b9a('0x1e')](removeEntity(_0x33b200,null))[_0x7b9a('0x3a')](handleError(_0x33b200,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5cb1dcd..6c44df5 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 _0x9bc7=['moment','bluebird','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','util','../../config/logger','api'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0x9bc7,0x177));var _0x79bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bc7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x79bc('0x0'));var logger=require(_0x79bc('0x1'))(_0x79bc('0x2'));var moment=require(_0x79bc('0x3'));var BPromise=require(_0x79bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x79bc('0x5'));var config=require(_0x79bc('0x6'));var attributes=require(_0x79bc('0x7'));module[_0x79bc('0x8')]=function(_0x57c80d,_0x101b5a){return _0x57c80d[_0x79bc('0x9')](_0x79bc('0xa'),attributes,{'tableName':_0x79bc('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x79bc('0xc'),_0x79bc('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc199=['idField','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0xc199,0xa9));var _0x9c19=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xc199[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0x9c19('0x0'));var util=require('util');var logger=require(_0x9c19('0x1'))('api');var moment=require(_0x9c19('0x2'));var BPromise=require(_0x9c19('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c19('0x4'));var rimraf=require(_0x9c19('0x5'));var config=require(_0x9c19('0x6'));var attributes=require(_0x9c19('0x7'));module[_0x9c19('0x8')]=function(_0x19c193,_0x334d04){return _0x19c193['define'](_0x9c19('0x9'),attributes,{'tableName':_0x9c19('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x9c19('0xb'),'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 1c283b1..a6656c4 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 _0xb8ac=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','FreshdeskField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0x105ee6,_0x2473cf){var _0x3a8333=function(_0x78adab){while(--_0x78adab){_0x105ee6['push'](_0x105ee6['shift']());}};_0x3a8333(++_0x2473cf);}(_0xb8ac,0xb1));var _0xcb8a=function(_0xa635b6,_0x1674c4){_0xa635b6=_0xa635b6-0x0;var _0x3ef961=_0xb8ac[_0xa635b6];return _0x3ef961;};'use strict';var _=require(_0xcb8a('0x0'));var util=require(_0xcb8a('0x1'));var moment=require(_0xcb8a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb8a('0x3'));var db=require(_0xcb8a('0x4'))['db'];var utils=require(_0xcb8a('0x5'));var logger=require(_0xcb8a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcb8a('0x7'));var client=jayson['client'][_0xcb8a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x589bd9,_0x377b37,_0x422d3e){return new BPromise(function(_0x1f37fd,_0xb03693){return client[_0xcb8a('0x9')](_0x589bd9,_0x422d3e)[_0xcb8a('0xa')](function(_0x1ba639){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x377b37,'request\x20sent');logger[_0xcb8a('0xb')](_0xcb8a('0xc'),_0x377b37,_0xcb8a('0xd'),JSON['stringify'](_0x1ba639));if(_0x1ba639[_0xcb8a('0xe')]){if(_0x1ba639[_0xcb8a('0xe')]['code']===0x1f4){logger[_0xcb8a('0xe')](_0xcb8a('0xf'),_0x377b37,_0x1ba639[_0xcb8a('0xe')][_0xcb8a('0x10')]);return _0xb03693(_0x1ba639[_0xcb8a('0xe')][_0xcb8a('0x10')]);}logger['error'](_0xcb8a('0xf'),_0x377b37,_0x1ba639[_0xcb8a('0xe')][_0xcb8a('0x10')]);return _0x1f37fd(_0x1ba639[_0xcb8a('0xe')][_0xcb8a('0x10')]);}else{logger[_0xcb8a('0x11')](_0xcb8a('0xf'),_0x377b37,'request\x20sent');_0x1f37fd(_0x1ba639[_0xcb8a('0x12')][_0xcb8a('0x10')]);}})[_0xcb8a('0x13')](function(_0x41a357){logger[_0xcb8a('0xe')](_0xcb8a('0xf'),_0x377b37,_0x41a357);_0xb03693(_0x41a357);});});} \ No newline at end of file +var _0x8121=['request','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8121,0xf2));var _0x1812=function(_0x2cc4b9,_0x26b99d){_0x2cc4b9=_0x2cc4b9-0x0;var _0x49b85d=_0x8121[_0x2cc4b9];return _0x49b85d;};'use strict';var _=require(_0x1812('0x0'));var util=require(_0x1812('0x1'));var moment=require(_0x1812('0x2'));var BPromise=require(_0x1812('0x3'));var rs=require(_0x1812('0x4'));var fs=require('fs');var Redis=require(_0x1812('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1812('0x6'));var logger=require('../../config/logger')(_0x1812('0x7'));var config=require(_0x1812('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1812('0x9')][_0x1812('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f551e,_0xb81bcc,_0x56f396){return new BPromise(function(_0x16e02d,_0x5e86d3){return client[_0x1812('0xb')](_0x1f551e,_0x56f396)[_0x1812('0xc')](function(_0x5e41bb){logger[_0x1812('0xd')](_0x1812('0xe'),_0xb81bcc,'request\x20sent');logger[_0x1812('0xf')](_0x1812('0x10'),_0xb81bcc,'request\x20sent',JSON[_0x1812('0x11')](_0x5e41bb));if(_0x5e41bb[_0x1812('0x12')]){if(_0x5e41bb[_0x1812('0x12')][_0x1812('0x13')]===0x1f4){logger[_0x1812('0x12')](_0x1812('0xe'),_0xb81bcc,_0x5e41bb[_0x1812('0x12')][_0x1812('0x14')]);return _0x5e86d3(_0x5e41bb[_0x1812('0x12')][_0x1812('0x14')]);}logger['error'](_0x1812('0xe'),_0xb81bcc,_0x5e41bb['error']['message']);return _0x16e02d(_0x5e41bb[_0x1812('0x12')][_0x1812('0x14')]);}else{logger[_0x1812('0xd')](_0x1812('0xe'),_0xb81bcc,_0x1812('0x15'));_0x16e02d(_0x5e41bb[_0x1812('0x16')][_0x1812('0x14')]);}})['catch'](function(_0x24e5ab){logger[_0x1812('0x12')](_0x1812('0xe'),_0xb81bcc,_0x24e5ab);_0x5e86d3(_0x24e5ab);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index ef37203..e2ec850 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 _0xc900=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1c8d61,_0x47b090){var _0x47f60a=function(_0x1c1dff){while(--_0x1c1dff){_0x1c8d61['push'](_0x1c8d61['shift']());}};_0x47f60a(++_0x47b090);}(_0xc900,0xb3));var _0x0c90=function(_0x5c0427,_0x199e82){_0x5c0427=_0x5c0427-0x0;var _0x50e44a=_0xc900[_0x5c0427];return _0x50e44a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0x7')](_0x0c90('0xd'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xf')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x10')]);router['post'](_0x0c90('0xb'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['put'](_0x0c90('0x12'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x13')]);router[_0x0c90('0x14')](_0x0c90('0x12'),auth['isAuthenticated'](),controller[_0x0c90('0x15')]);module[_0x0c90('0x16')]=router; \ No newline at end of file +var _0x0fd9=['../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x2971e6,_0x4a962e){var _0x5e6392=function(_0x16e6cf){while(--_0x16e6cf){_0x2971e6['push'](_0x2971e6['shift']());}};_0x5e6392(++_0x4a962e);}(_0x0fd9,0xa3));var _0x90fd=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0x0fd9[_0x272638];return _0x19d027;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),controller[_0x90fd('0x10')]);router[_0x90fd('0xf')]('/:id/configurations',auth[_0x90fd('0x9')](),controller[_0x90fd('0x11')]);router['put'](_0x90fd('0xa'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x12')]);router['delete'](_0x90fd('0xa'),auth['isAuthenticated'](),controller[_0x90fd('0x13')]);module[_0x90fd('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 8923997..e21ef17 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 _0xa30a=['sequelize','exports','STRING','username','remoteUri'];(function(_0x242637,_0x1c90c8){var _0x580002=function(_0x4ae875){while(--_0x4ae875){_0x242637['push'](_0x242637['shift']());}};_0x580002(++_0x1c90c8);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'name':{'type':Sequelize[_0xaa30('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xaa30('0x2')],'unique':_0xaa30('0x3')},'apiKey':{'type':Sequelize[_0xaa30('0x2')]},'remoteUri':{'type':Sequelize[_0xaa30('0x2')],'unique':_0xaa30('0x4')},'serverUrl':{'type':Sequelize[_0xaa30('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x32f4=['sequelize','exports','STRING','username','remoteUri'];(function(_0x78db5e,_0x3b9804){var _0x250b88=function(_0x20a40f){while(--_0x20a40f){_0x78db5e['push'](_0x78db5e['shift']());}};_0x250b88(++_0x3b9804);}(_0x32f4,0x154));var _0x432f=function(_0x503bd9,_0x53a90f){_0x503bd9=_0x503bd9-0x0;var _0x5bcb7c=_0x32f4[_0x503bd9];return _0x5bcb7c;};'use strict';var Sequelize=require(_0x432f('0x0'));module[_0x432f('0x1')]={'name':{'type':Sequelize[_0x432f('0x2')]},'description':{'type':Sequelize[_0x432f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x432f('0x3')},'apiKey':{'type':Sequelize[_0x432f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x432f('0x4')},'serverUrl':{'type':Sequelize[_0x432f('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 53e56c4..65bb0d6 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 _0x80ce=['end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','find','create','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','addConfiguration','body','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','/api/selector/owners','apiKey','users','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus'];(function(_0x463abd,_0x1e7eaf){var _0x8f2a37=function(_0xf60e4b){while(--_0xf60e4b){_0x463abd['push'](_0x463abd['shift']());}};_0x8f2a37(++_0x1e7eaf);}(_0x80ce,0x184));var _0xe80c=function(_0x394f76,_0x570ddd){_0x394f76=_0x394f76-0x0;var _0x3af6f3=_0x80ce[_0x394f76];return _0x3af6f3;};'use strict';var emlformat=require(_0xe80c('0x0'));var rimraf=require(_0xe80c('0x1'));var zipdir=require(_0xe80c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe80c('0x3'));var moment=require(_0xe80c('0x4'));var BPromise=require(_0xe80c('0x5'));var Mustache=require(_0xe80c('0x6'));var util=require('util');var path=require(_0xe80c('0x7'));var sox=require(_0xe80c('0x8'));var csv=require('to-csv');var ejs=require(_0xe80c('0x9'));var fs=require('fs');var fs_extra=require(_0xe80c('0xa'));var _=require(_0xe80c('0xb'));var squel=require(_0xe80c('0xc'));var crypto=require('crypto');var jsforce=require(_0xe80c('0xd'));var deskjs=require(_0xe80c('0xe'));var toCsv=require(_0xe80c('0xf'));var querystring=require(_0xe80c('0x10'));var Papa=require('papaparse');var Redis=require(_0xe80c('0x11'));var authService=require(_0xe80c('0x12'));var qs=require(_0xe80c('0x13'));var as=require(_0xe80c('0x14'));var hardwareService=require(_0xe80c('0x15'));var logger=require(_0xe80c('0x16'))('api');var utils=require(_0xe80c('0x17'));var config=require(_0xe80c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe80c('0x19'))['db'];var integrations=require(_0xe80c('0x1a'));function respondWithStatusCode(_0x1483ae,_0x271fbb){_0x271fbb=_0x271fbb||0xcc;return function(_0x4ce038){if(_0x4ce038){return _0x1483ae[_0xe80c('0x1b')](_0x271fbb);}return _0x1483ae['status'](_0x271fbb)[_0xe80c('0x1c')]();};}function respondWithResult(_0xfa2e43,_0x425d1a){_0x425d1a=_0x425d1a||0xc8;return function(_0x46b972){if(_0x46b972){return _0xfa2e43['status'](_0x425d1a)[_0xe80c('0x1d')](_0x46b972);}};}function respondWithFilteredResult(_0x2e9087,_0x28a7ab){return function(_0x3cf414){if(_0x3cf414){var _0x4f6fe2=typeof _0x28a7ab[_0xe80c('0x1e')]===_0xe80c('0x1f')&&typeof _0x28a7ab[_0xe80c('0x20')]==='undefined';var _0x5acae7=_0x3cf414[_0xe80c('0x21')];var _0x26ee10=_0x4f6fe2?0x0:_0x28a7ab[_0xe80c('0x1e')];var _0x436525=_0x4f6fe2?_0x3cf414[_0xe80c('0x21')]:_0x28a7ab[_0xe80c('0x1e')]+_0x28a7ab['limit'];var _0x2ec198;if(_0x436525>=_0x5acae7){_0x436525=_0x5acae7;_0x2ec198=0xc8;}else{_0x2ec198=0xce;}_0x2e9087[_0xe80c('0x22')](_0x2ec198);return _0x2e9087[_0xe80c('0x23')](_0xe80c('0x24'),_0x26ee10+'-'+_0x436525+'/'+_0x5acae7)['json'](_0x3cf414);}return null;};}function patchUpdates(_0xe96e96){return function(_0x2d886e){try{jsonpatch[_0xe80c('0x25')](_0x2d886e,_0xe96e96,!![]);}catch(_0x4c3525){return BPromise['reject'](_0x4c3525);}return _0x2d886e[_0xe80c('0x26')]();};}function saveUpdates(_0x134e01,_0x1aaf57){return function(_0x30aea5){if(_0x30aea5){return _0x30aea5[_0xe80c('0x27')](_0x134e01)[_0xe80c('0x28')](function(_0x5194ea){return _0x5194ea;});}return null;};}function removeEntity(_0x191f72,_0x452397){return function(_0x31f365){if(_0x31f365){return _0x31f365[_0xe80c('0x29')]()[_0xe80c('0x28')](function(){_0x191f72[_0xe80c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x427455,_0x24ea13){return function(_0x1266e2){if(!_0x1266e2){_0x427455[_0xe80c('0x1b')](0x194);}return _0x1266e2;};}function handleError(_0x271a12,_0x536573){_0x536573=_0x536573||0x1f4;return function(_0xeb4c96){logger[_0xe80c('0x2a')](_0xeb4c96[_0xe80c('0x2b')]);if(_0xeb4c96['name']){delete _0xeb4c96['name'];}_0x271a12[_0xe80c('0x22')](_0x536573)[_0xe80c('0x2c')](_0xeb4c96);};}exports[_0xe80c('0x2d')]=function(_0x5436cb,_0x1b058f){var _0x12c996={},_0x5013a1={},_0x56858e={'count':0x0,'rows':[]};var _0x51e24f=_[_0xe80c('0x2e')](db[_0xe80c('0x2f')][_0xe80c('0x30')],function(_0x42101b){return{'name':_0x42101b[_0xe80c('0x31')],'type':_0x42101b[_0xe80c('0x32')][_0xe80c('0x33')]};});_0x5013a1[_0xe80c('0x34')]=_['map'](_0x51e24f,'name');_0x5013a1[_0xe80c('0x35')]=_[_0xe80c('0x36')](_0x5436cb[_0xe80c('0x35')]);_0x5013a1[_0xe80c('0x37')]=_[_0xe80c('0x38')](_0x5013a1['model'],_0x5013a1[_0xe80c('0x35')]);_0x12c996['attributes']=_[_0xe80c('0x38')](_0x5013a1[_0xe80c('0x34')],qs[_0xe80c('0x39')](_0x5436cb['query'][_0xe80c('0x39')]));_0x12c996[_0xe80c('0x3a')]=_0x12c996[_0xe80c('0x3a')][_0xe80c('0x3b')]?_0x12c996[_0xe80c('0x3a')]:_0x5013a1[_0xe80c('0x34')];if(!_0x5436cb[_0xe80c('0x35')]['hasOwnProperty'](_0xe80c('0x3c'))){_0x12c996[_0xe80c('0x20')]=qs[_0xe80c('0x20')](_0x5436cb['query']['limit']);_0x12c996[_0xe80c('0x1e')]=qs['offset'](_0x5436cb[_0xe80c('0x35')][_0xe80c('0x1e')]);}_0x12c996[_0xe80c('0x3d')]=qs[_0xe80c('0x3e')](_0x5436cb[_0xe80c('0x35')][_0xe80c('0x3e')]);_0x12c996[_0xe80c('0x3f')]=qs[_0xe80c('0x37')](_[_0xe80c('0x40')](_0x5436cb[_0xe80c('0x35')],_0x5013a1[_0xe80c('0x37')]),_0x51e24f);if(_0x5436cb[_0xe80c('0x35')]['filter']){_0x12c996['where']=_[_0xe80c('0x41')](_0x12c996[_0xe80c('0x3f')],{'$or':_[_0xe80c('0x2e')](_0x51e24f,function(_0x100737){if(_0x100737[_0xe80c('0x32')]!==_0xe80c('0x42')){var _0x8ca465={};_0x8ca465[_0x100737['name']]={'$like':'%'+_0x5436cb[_0xe80c('0x35')][_0xe80c('0x43')]+'%'};return _0x8ca465;}})});}_0x12c996=_[_0xe80c('0x41')]({},_0x12c996,_0x5436cb[_0xe80c('0x44')]);var _0x358f9f={'where':_0x12c996[_0xe80c('0x3f')]};return db[_0xe80c('0x2f')][_0xe80c('0x21')](_0x358f9f)[_0xe80c('0x28')](function(_0x1b5bea){_0x56858e[_0xe80c('0x21')]=_0x1b5bea;if(_0x5436cb['query'][_0xe80c('0x45')]){_0x12c996['include']=[{'all':!![]}];}return db[_0xe80c('0x2f')][_0xe80c('0x46')](_0x12c996);})[_0xe80c('0x28')](function(_0x48d9ee){_0x56858e[_0xe80c('0x47')]=_0x48d9ee;return _0x56858e;})[_0xe80c('0x28')](respondWithFilteredResult(_0x1b058f,_0x12c996))[_0xe80c('0x48')](handleError(_0x1b058f,null));};exports['show']=function(_0x45ab5e,_0x994fa1){var _0x44033c={'raw':![],'where':{'id':_0x45ab5e[_0xe80c('0x49')]['id']}},_0x2e5ef8={};_0x2e5ef8[_0xe80c('0x34')]=_['keys'](db['FreshsalesAccount']['rawAttributes']);_0x2e5ef8[_0xe80c('0x35')]=_[_0xe80c('0x36')](_0x45ab5e[_0xe80c('0x35')]);_0x2e5ef8[_0xe80c('0x37')]=_[_0xe80c('0x38')](_0x2e5ef8[_0xe80c('0x34')],_0x2e5ef8[_0xe80c('0x35')]);_0x44033c[_0xe80c('0x3a')]=_[_0xe80c('0x38')](_0x2e5ef8[_0xe80c('0x34')],qs['fields'](_0x45ab5e[_0xe80c('0x35')][_0xe80c('0x39')]));_0x44033c['attributes']=_0x44033c['attributes'][_0xe80c('0x3b')]?_0x44033c[_0xe80c('0x3a')]:_0x2e5ef8[_0xe80c('0x34')];if(_0x45ab5e[_0xe80c('0x35')][_0xe80c('0x45')]){_0x44033c['include']=[{'all':!![]}];}_0x44033c=_[_0xe80c('0x41')]({},_0x44033c,_0x45ab5e[_0xe80c('0x44')]);return db[_0xe80c('0x2f')][_0xe80c('0x4a')](_0x44033c)[_0xe80c('0x28')](handleEntityNotFound(_0x994fa1,null))[_0xe80c('0x28')](respondWithResult(_0x994fa1,null))['catch'](handleError(_0x994fa1,null));};exports['create']=function(_0x378d28,_0x4cd692){return db[_0xe80c('0x2f')][_0xe80c('0x4b')](_0x378d28['body'],{})['then'](respondWithResult(_0x4cd692,0xc9))[_0xe80c('0x48')](handleError(_0x4cd692,null));};exports[_0xe80c('0x27')]=function(_0x132894,_0x406082){if(_0x132894['body']['id']){delete _0x132894['body']['id'];}return db[_0xe80c('0x2f')][_0xe80c('0x4a')]({'where':{'id':_0x132894[_0xe80c('0x49')]['id']}})[_0xe80c('0x28')](handleEntityNotFound(_0x406082,null))['then'](saveUpdates(_0x132894['body'],null))[_0xe80c('0x28')](respondWithResult(_0x406082,null))[_0xe80c('0x48')](handleError(_0x406082,null));};exports[_0xe80c('0x29')]=function(_0xa33dbf,_0x4b94c0){return db[_0xe80c('0x2f')][_0xe80c('0x4a')]({'where':{'id':_0xa33dbf[_0xe80c('0x49')]['id']}})[_0xe80c('0x28')](handleEntityNotFound(_0x4b94c0,null))[_0xe80c('0x28')](removeEntity(_0x4b94c0,null))[_0xe80c('0x48')](handleError(_0x4b94c0,null));};exports[_0xe80c('0x4c')]=function(_0x5ca55f,_0x3cb11f,_0x229f5c){var _0x21a951={};var _0x288994={};var _0x16a4c8;var _0x230320;return db[_0xe80c('0x2f')][_0xe80c('0x4d')]({'where':{'id':_0x5ca55f[_0xe80c('0x49')]['id']}})['then'](handleEntityNotFound(_0x3cb11f,null))['then'](function(_0xae1eb2){if(_0xae1eb2){_0x16a4c8=_0xae1eb2;_0x288994['model']=_[_0xe80c('0x36')](db[_0xe80c('0x4e')][_0xe80c('0x30')]);_0x288994['query']=_[_0xe80c('0x36')](_0x5ca55f[_0xe80c('0x35')]);_0x288994['filters']=_[_0xe80c('0x38')](_0x288994[_0xe80c('0x34')],_0x288994['query']);_0x21a951[_0xe80c('0x3a')]=_[_0xe80c('0x38')](_0x288994[_0xe80c('0x34')],qs[_0xe80c('0x39')](_0x5ca55f[_0xe80c('0x35')]['fields']));_0x21a951[_0xe80c('0x3a')]=_0x21a951[_0xe80c('0x3a')][_0xe80c('0x3b')]?_0x21a951['attributes']:_0x288994[_0xe80c('0x34')];_0x21a951['order']=qs['sort'](_0x5ca55f[_0xe80c('0x35')][_0xe80c('0x3e')]);_0x21a951['where']=qs[_0xe80c('0x37')](_[_0xe80c('0x40')](_0x5ca55f[_0xe80c('0x35')],_0x288994['filters']));if(_0x5ca55f[_0xe80c('0x35')][_0xe80c('0x43')]){_0x21a951[_0xe80c('0x3f')]=_['merge'](_0x21a951['where'],{'$or':_[_0xe80c('0x2e')](_0x21a951[_0xe80c('0x3a')],function(_0x274c83){var _0x29e6bf={};_0x29e6bf[_0x274c83]={'$like':'%'+_0x5ca55f[_0xe80c('0x35')][_0xe80c('0x43')]+'%'};return _0x29e6bf;})});}_0x21a951=_[_0xe80c('0x41')]({},_0x21a951,_0x5ca55f['options']);return _0x16a4c8[_0xe80c('0x4c')](_0x21a951);}})[_0xe80c('0x28')](function(_0x2ce3ef){if(_0x2ce3ef){_0x230320=_0x2ce3ef[_0xe80c('0x3b')];if(!_0x5ca55f[_0xe80c('0x35')][_0xe80c('0x4f')]('nolimit')){_0x21a951[_0xe80c('0x20')]=qs[_0xe80c('0x20')](_0x5ca55f[_0xe80c('0x35')]['limit']);_0x21a951[_0xe80c('0x1e')]=qs[_0xe80c('0x1e')](_0x5ca55f['query']['offset']);}return _0x16a4c8[_0xe80c('0x4c')](_0x21a951);}})['then'](function(_0x103657){if(_0x103657){return _0x103657?{'count':_0x230320,'rows':_0x103657}:null;}})[_0xe80c('0x28')](respondWithResult(_0x3cb11f,null))[_0xe80c('0x48')](handleError(_0x3cb11f,null));};exports[_0xe80c('0x50')]=function(_0x246890,_0x302c96,_0x2ae47b){if(_0x246890[_0xe80c('0x51')]['id']){delete _0x246890[_0xe80c('0x51')]['id'];}return db['FreshsalesAccount'][_0xe80c('0x4d')]({'where':{'id':_0x246890[_0xe80c('0x49')]['id']}})[_0xe80c('0x28')](handleEntityNotFound(_0x302c96,null))['then'](function(_0x457635){if(_0x457635){_0x246890[_0xe80c('0x51')][_0xe80c('0x52')]=_0x457635['id'];_0x246890['body'][_0xe80c('0x53')]=integrations[_0xe80c('0x54')](_0x246890[_0xe80c('0x51')][_0xe80c('0x55')],_0x246890[_0xe80c('0x51')]['type']);_0x246890[_0xe80c('0x51')][_0xe80c('0x56')]=integrations[_0xe80c('0x57')](_0x246890[_0xe80c('0x51')][_0xe80c('0x55')],_0x246890[_0xe80c('0x51')][_0xe80c('0x32')]);return db['FreshsalesConfiguration'][_0xe80c('0x4b')](_0x246890[_0xe80c('0x51')],{'include':[{'model':db[_0xe80c('0x58')],'as':'Subjects'},{'model':db[_0xe80c('0x58')],'as':_0xe80c('0x56')}]});}return null;})[_0xe80c('0x28')](respondWithResult(_0x302c96,null))[_0xe80c('0x48')](handleError(_0x302c96,null));};exports[_0xe80c('0x59')]=function(_0x3c5587,_0x12bd74,_0x11a74e){var _0xbb64d9='';var _0x5397dd='';return db[_0xe80c('0x2f')]['findOne']({'where':{'id':_0x3c5587['params']['id']},'attributes':['id',_0xe80c('0x5a'),_0xe80c('0x5b'),'apiKey']})[_0xe80c('0x28')](handleEntityNotFound(_0x12bd74,null))[_0xe80c('0x28')](function(_0x380176){if(_0x380176){_0x5397dd=_0x380176[_0xe80c('0x5a')];_0xbb64d9=_0x380176['remoteUri'];var _0x15064b=_0x380176[_0xe80c('0x5b')][_0xe80c('0x5c')](-0x1);if(_0x15064b==='/'){_0xbb64d9=_0xbb64d9[_0xe80c('0x5d')](0x0,_0xbb64d9[_0xe80c('0x5e')](_0x15064b));}return rp({'method':_0xe80c('0x5f'),'uri':util[_0xe80c('0x60')]('%s%s',_0xbb64d9,_0xe80c('0x61')),'headers':{'Authorization':'Token\x20token='+_0x380176[_0xe80c('0x62')]},'json':!![]});}})[_0xe80c('0x28')](function(_0x260ae5){if(_0x260ae5){var _0x50003f=_0x260ae5[_0xe80c('0x63')];var _0x2b1d09=![];var _0x985de1=null;for(_0x985de1=0x0;_0x985de1<_0x50003f[_0xe80c('0x3b')];_0x985de1++){if(_0x50003f[_0x985de1]['email']===_0x5397dd){_0x2b1d09=!![];}}if(_0x2b1d09){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xe80c('0x28')](respondWithResult(_0x12bd74,null))[_0xe80c('0x48')](function(_0x4653da){var _0x3a4421=_0x3c5587[_0xe80c('0x35')][_0xe80c('0x64')]?0x1f4:_0x4653da[_0xe80c('0x65')]||0x1f4;logger[_0xe80c('0x2a')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3a4421,JSON[_0xe80c('0x66')](_0x4653da));delete _0x4653da['name'];if(_0x3a4421===0x191){_0x3a4421=0x190;}_0x12bd74['status'](_0x3a4421)['send'](_0x3c5587['query']['test']?{'message':_0xe80c('0x67'),'statusCode':_0x4653da[_0xe80c('0x65')]}:_0x4653da);});}; \ No newline at end of file +var _0x90f6=['set','Content-Range','apply','reject','destroy','then','stack','name','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','FreshsalesAccount','includeAll','findAll','catch','show','include','merge','find','create','body','update','params','getConfigurations','FreshsalesConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','findOne','username','apiKey','remoteUri','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','lodash','squel','crypto','jsforce','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','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x29cb36,_0x5f1049){var _0x11c1a6=function(_0x37a894){while(--_0x37a894){_0x29cb36['push'](_0x29cb36['shift']());}};_0x11c1a6(++_0x5f1049);}(_0x90f6,0x114));var _0x690f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90f6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x690f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x690f('0x1'));var jsonpatch=require(_0x690f('0x2'));var rp=require(_0x690f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x690f('0x4'));var path=require(_0x690f('0x5'));var sox=require(_0x690f('0x6'));var csv=require('to-csv');var ejs=require(_0x690f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x690f('0x8'));var squel=require(_0x690f('0x9'));var crypto=require(_0x690f('0xa'));var jsforce=require(_0x690f('0xb'));var deskjs=require(_0x690f('0xc'));var toCsv=require(_0x690f('0xd'));var querystring=require(_0x690f('0xe'));var Papa=require(_0x690f('0xf'));var Redis=require(_0x690f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x690f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x690f('0x12'));var logger=require(_0x690f('0x13'))(_0x690f('0x14'));var utils=require('../../config/utils');var config=require(_0x690f('0x15'));var licenseUtil=require(_0x690f('0x16'));var db=require(_0x690f('0x17'))['db'];var integrations=require(_0x690f('0x18'));function respondWithStatusCode(_0x245940,_0x3001de){_0x3001de=_0x3001de||0xcc;return function(_0x40dc20){if(_0x40dc20){return _0x245940[_0x690f('0x19')](_0x3001de);}return _0x245940[_0x690f('0x1a')](_0x3001de)[_0x690f('0x1b')]();};}function respondWithResult(_0x44b227,_0x32d37b){_0x32d37b=_0x32d37b||0xc8;return function(_0x4ba16f){if(_0x4ba16f){return _0x44b227[_0x690f('0x1a')](_0x32d37b)[_0x690f('0x1c')](_0x4ba16f);}};}function respondWithFilteredResult(_0x55ca0d,_0x3afed4){return function(_0x14c4cf){if(_0x14c4cf){var _0x1e7f3f=typeof _0x3afed4[_0x690f('0x1d')]===_0x690f('0x1e')&&typeof _0x3afed4[_0x690f('0x1f')]==='undefined';var _0x3b3018=_0x14c4cf['count'];var _0x370a24=_0x1e7f3f?0x0:_0x3afed4['offset'];var _0x4a5c10=_0x1e7f3f?_0x14c4cf[_0x690f('0x20')]:_0x3afed4['offset']+_0x3afed4[_0x690f('0x1f')];var _0x435666;if(_0x4a5c10>=_0x3b3018){_0x4a5c10=_0x3b3018;_0x435666=0xc8;}else{_0x435666=0xce;}_0x55ca0d[_0x690f('0x1a')](_0x435666);return _0x55ca0d[_0x690f('0x21')](_0x690f('0x22'),_0x370a24+'-'+_0x4a5c10+'/'+_0x3b3018)[_0x690f('0x1c')](_0x14c4cf);}return null;};}function patchUpdates(_0x27a308){return function(_0x10ab5c){try{jsonpatch[_0x690f('0x23')](_0x10ab5c,_0x27a308,!![]);}catch(_0x121ca7){return BPromise[_0x690f('0x24')](_0x121ca7);}return _0x10ab5c['save']();};}function saveUpdates(_0x25ffbd,_0x1cb0fc){return function(_0x3ce07f){if(_0x3ce07f){return _0x3ce07f['update'](_0x25ffbd)['then'](function(_0x2ae741){return _0x2ae741;});}return null;};}function removeEntity(_0x55bb3d,_0x179331){return function(_0x541ccb){if(_0x541ccb){return _0x541ccb[_0x690f('0x25')]()[_0x690f('0x26')](function(){_0x55bb3d[_0x690f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x279e24,_0x5c8e50){return function(_0x1fa8e6){if(!_0x1fa8e6){_0x279e24[_0x690f('0x19')](0x194);}return _0x1fa8e6;};}function handleError(_0x36419,_0x279f53){_0x279f53=_0x279f53||0x1f4;return function(_0x299c65){logger['error'](_0x299c65[_0x690f('0x27')]);if(_0x299c65[_0x690f('0x28')]){delete _0x299c65[_0x690f('0x28')];}_0x36419[_0x690f('0x1a')](_0x279f53)['send'](_0x299c65);};}exports['index']=function(_0xb2e728,_0x4d5cdf){var _0x38fb10={},_0x31262d={},_0x10c588={'count':0x0,'rows':[]};var _0xa3d0ac=_['map'](db['FreshsalesAccount'][_0x690f('0x29')],function(_0x195418){return{'name':_0x195418[_0x690f('0x2a')],'type':_0x195418[_0x690f('0x2b')][_0x690f('0x2c')]};});_0x31262d['model']=_[_0x690f('0x2d')](_0xa3d0ac,_0x690f('0x28'));_0x31262d['query']=_[_0x690f('0x2e')](_0xb2e728[_0x690f('0x2f')]);_0x31262d[_0x690f('0x30')]=_[_0x690f('0x31')](_0x31262d[_0x690f('0x32')],_0x31262d[_0x690f('0x2f')]);_0x38fb10[_0x690f('0x33')]=_[_0x690f('0x31')](_0x31262d[_0x690f('0x32')],qs[_0x690f('0x34')](_0xb2e728[_0x690f('0x2f')][_0x690f('0x34')]));_0x38fb10[_0x690f('0x33')]=_0x38fb10[_0x690f('0x33')][_0x690f('0x35')]?_0x38fb10[_0x690f('0x33')]:_0x31262d['model'];if(!_0xb2e728['query'][_0x690f('0x36')]('nolimit')){_0x38fb10[_0x690f('0x1f')]=qs[_0x690f('0x1f')](_0xb2e728[_0x690f('0x2f')]['limit']);_0x38fb10['offset']=qs[_0x690f('0x1d')](_0xb2e728[_0x690f('0x2f')][_0x690f('0x1d')]);}_0x38fb10[_0x690f('0x37')]=qs[_0x690f('0x38')](_0xb2e728[_0x690f('0x2f')][_0x690f('0x38')]);_0x38fb10[_0x690f('0x39')]=qs[_0x690f('0x30')](_['pick'](_0xb2e728['query'],_0x31262d[_0x690f('0x30')]),_0xa3d0ac);if(_0xb2e728[_0x690f('0x2f')][_0x690f('0x3a')]){_0x38fb10['where']=_['merge'](_0x38fb10[_0x690f('0x39')],{'$or':_['map'](_0xa3d0ac,function(_0x40c18f){if(_0x40c18f[_0x690f('0x2b')]!==_0x690f('0x3b')){var _0xc525dc={};_0xc525dc[_0x40c18f[_0x690f('0x28')]]={'$like':'%'+_0xb2e728[_0x690f('0x2f')][_0x690f('0x3a')]+'%'};return _0xc525dc;}})});}_0x38fb10=_['merge']({},_0x38fb10,_0xb2e728[_0x690f('0x3c')]);var _0x51bc18={'where':_0x38fb10[_0x690f('0x39')]};return db[_0x690f('0x3d')][_0x690f('0x20')](_0x51bc18)[_0x690f('0x26')](function(_0xf32209){_0x10c588['count']=_0xf32209;if(_0xb2e728[_0x690f('0x2f')][_0x690f('0x3e')]){_0x38fb10['include']=[{'all':!![]}];}return db[_0x690f('0x3d')][_0x690f('0x3f')](_0x38fb10);})['then'](function(_0x209ef5){_0x10c588['rows']=_0x209ef5;return _0x10c588;})['then'](respondWithFilteredResult(_0x4d5cdf,_0x38fb10))[_0x690f('0x40')](handleError(_0x4d5cdf,null));};exports[_0x690f('0x41')]=function(_0x4a1284,_0x212a1f){var _0x40734f={'raw':![],'where':{'id':_0x4a1284['params']['id']}},_0x12f624={};_0x12f624[_0x690f('0x32')]=_[_0x690f('0x2e')](db[_0x690f('0x3d')]['rawAttributes']);_0x12f624[_0x690f('0x2f')]=_[_0x690f('0x2e')](_0x4a1284['query']);_0x12f624[_0x690f('0x30')]=_[_0x690f('0x31')](_0x12f624[_0x690f('0x32')],_0x12f624[_0x690f('0x2f')]);_0x40734f['attributes']=_[_0x690f('0x31')](_0x12f624[_0x690f('0x32')],qs['fields'](_0x4a1284[_0x690f('0x2f')]['fields']));_0x40734f['attributes']=_0x40734f['attributes'][_0x690f('0x35')]?_0x40734f[_0x690f('0x33')]:_0x12f624[_0x690f('0x32')];if(_0x4a1284[_0x690f('0x2f')]['includeAll']){_0x40734f[_0x690f('0x42')]=[{'all':!![]}];}_0x40734f=_[_0x690f('0x43')]({},_0x40734f,_0x4a1284[_0x690f('0x3c')]);return db[_0x690f('0x3d')][_0x690f('0x44')](_0x40734f)[_0x690f('0x26')](handleEntityNotFound(_0x212a1f,null))[_0x690f('0x26')](respondWithResult(_0x212a1f,null))['catch'](handleError(_0x212a1f,null));};exports['create']=function(_0x1bc806,_0x127fe9){return db[_0x690f('0x3d')][_0x690f('0x45')](_0x1bc806[_0x690f('0x46')],{})[_0x690f('0x26')](respondWithResult(_0x127fe9,0xc9))[_0x690f('0x40')](handleError(_0x127fe9,null));};exports[_0x690f('0x47')]=function(_0x286454,_0xbe9dfe){if(_0x286454[_0x690f('0x46')]['id']){delete _0x286454[_0x690f('0x46')]['id'];}return db[_0x690f('0x3d')]['find']({'where':{'id':_0x286454[_0x690f('0x48')]['id']}})[_0x690f('0x26')](handleEntityNotFound(_0xbe9dfe,null))[_0x690f('0x26')](saveUpdates(_0x286454[_0x690f('0x46')],null))[_0x690f('0x26')](respondWithResult(_0xbe9dfe,null))[_0x690f('0x40')](handleError(_0xbe9dfe,null));};exports[_0x690f('0x25')]=function(_0x49495c,_0x325da1){return db[_0x690f('0x3d')][_0x690f('0x44')]({'where':{'id':_0x49495c[_0x690f('0x48')]['id']}})[_0x690f('0x26')](handleEntityNotFound(_0x325da1,null))[_0x690f('0x26')](removeEntity(_0x325da1,null))[_0x690f('0x40')](handleError(_0x325da1,null));};exports[_0x690f('0x49')]=function(_0x4a3135,_0x46ec35,_0x93d93a){var _0x18b1b3={};var _0xda0c92={};var _0x5562ca;var _0x39463d;return db[_0x690f('0x3d')]['findOne']({'where':{'id':_0x4a3135['params']['id']}})[_0x690f('0x26')](handleEntityNotFound(_0x46ec35,null))['then'](function(_0x2c9d35){if(_0x2c9d35){_0x5562ca=_0x2c9d35;_0xda0c92[_0x690f('0x32')]=_['keys'](db[_0x690f('0x4a')]['rawAttributes']);_0xda0c92[_0x690f('0x2f')]=_[_0x690f('0x2e')](_0x4a3135[_0x690f('0x2f')]);_0xda0c92[_0x690f('0x30')]=_[_0x690f('0x31')](_0xda0c92[_0x690f('0x32')],_0xda0c92[_0x690f('0x2f')]);_0x18b1b3['attributes']=_[_0x690f('0x31')](_0xda0c92['model'],qs[_0x690f('0x34')](_0x4a3135[_0x690f('0x2f')][_0x690f('0x34')]));_0x18b1b3[_0x690f('0x33')]=_0x18b1b3[_0x690f('0x33')][_0x690f('0x35')]?_0x18b1b3['attributes']:_0xda0c92[_0x690f('0x32')];_0x18b1b3[_0x690f('0x37')]=qs['sort'](_0x4a3135['query'][_0x690f('0x38')]);_0x18b1b3['where']=qs['filters'](_[_0x690f('0x4b')](_0x4a3135[_0x690f('0x2f')],_0xda0c92[_0x690f('0x30')]));if(_0x4a3135[_0x690f('0x2f')][_0x690f('0x3a')]){_0x18b1b3[_0x690f('0x39')]=_[_0x690f('0x43')](_0x18b1b3[_0x690f('0x39')],{'$or':_['map'](_0x18b1b3[_0x690f('0x33')],function(_0x4f4642){var _0x41ce34={};_0x41ce34[_0x4f4642]={'$like':'%'+_0x4a3135[_0x690f('0x2f')][_0x690f('0x3a')]+'%'};return _0x41ce34;})});}_0x18b1b3=_[_0x690f('0x43')]({},_0x18b1b3,_0x4a3135[_0x690f('0x3c')]);return _0x5562ca[_0x690f('0x49')](_0x18b1b3);}})[_0x690f('0x26')](function(_0x4940da){if(_0x4940da){_0x39463d=_0x4940da[_0x690f('0x35')];if(!_0x4a3135[_0x690f('0x2f')][_0x690f('0x36')](_0x690f('0x4c'))){_0x18b1b3[_0x690f('0x1f')]=qs[_0x690f('0x1f')](_0x4a3135['query'][_0x690f('0x1f')]);_0x18b1b3['offset']=qs[_0x690f('0x1d')](_0x4a3135[_0x690f('0x2f')]['offset']);}return _0x5562ca['getConfigurations'](_0x18b1b3);}})[_0x690f('0x26')](function(_0x281952){if(_0x281952){return _0x281952?{'count':_0x39463d,'rows':_0x281952}:null;}})[_0x690f('0x26')](respondWithResult(_0x46ec35,null))[_0x690f('0x40')](handleError(_0x46ec35,null));};exports[_0x690f('0x4d')]=function(_0x3831fa,_0x26d8b1,_0x1ce860){if(_0x3831fa[_0x690f('0x46')]['id']){delete _0x3831fa[_0x690f('0x46')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3831fa[_0x690f('0x48')]['id']}})[_0x690f('0x26')](handleEntityNotFound(_0x26d8b1,null))[_0x690f('0x26')](function(_0xa05ddb){if(_0xa05ddb){_0x3831fa[_0x690f('0x46')][_0x690f('0x4e')]=_0xa05ddb['id'];_0x3831fa[_0x690f('0x46')][_0x690f('0x4f')]=integrations[_0x690f('0x50')](_0x3831fa['body'][_0x690f('0x51')],_0x3831fa[_0x690f('0x46')][_0x690f('0x2b')]);_0x3831fa[_0x690f('0x46')][_0x690f('0x52')]=integrations[_0x690f('0x53')](_0x3831fa[_0x690f('0x46')][_0x690f('0x51')],_0x3831fa[_0x690f('0x46')][_0x690f('0x2b')]);return db[_0x690f('0x4a')][_0x690f('0x45')](_0x3831fa[_0x690f('0x46')],{'include':[{'model':db['FreshsalesField'],'as':_0x690f('0x4f')},{'model':db['FreshsalesField'],'as':_0x690f('0x52')}]});}return null;})['then'](respondWithResult(_0x26d8b1,null))[_0x690f('0x40')](handleError(_0x26d8b1,null));};exports[_0x690f('0x54')]=function(_0x1ebebb,_0x10865f,_0x51be75){var _0x350b29='';var _0x5a53fd='';return db['FreshsalesAccount'][_0x690f('0x55')]({'where':{'id':_0x1ebebb[_0x690f('0x48')]['id']},'attributes':['id',_0x690f('0x56'),'remoteUri',_0x690f('0x57')]})[_0x690f('0x26')](handleEntityNotFound(_0x10865f,null))[_0x690f('0x26')](function(_0x5aa602){if(_0x5aa602){_0x5a53fd=_0x5aa602[_0x690f('0x56')];_0x350b29=_0x5aa602['remoteUri'];var _0x4d48d5=_0x5aa602[_0x690f('0x58')][_0x690f('0x59')](-0x1);if(_0x4d48d5==='/'){_0x350b29=_0x350b29['substring'](0x0,_0x350b29['lastIndexOf'](_0x4d48d5));}return rp({'method':_0x690f('0x5a'),'uri':util[_0x690f('0x5b')](_0x690f('0x5c'),_0x350b29,_0x690f('0x5d')),'headers':{'Authorization':_0x690f('0x5e')+_0x5aa602[_0x690f('0x57')]},'json':!![]});}})[_0x690f('0x26')](function(_0x4c81e6){if(_0x4c81e6){var _0x1d6f95=_0x4c81e6[_0x690f('0x5f')];var _0x54ac17=![];var _0x26226e=null;for(_0x26226e=0x0;_0x26226e<_0x1d6f95[_0x690f('0x35')];_0x26226e++){if(_0x1d6f95[_0x26226e][_0x690f('0x60')]===_0x5a53fd){_0x54ac17=!![];}}if(_0x54ac17){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x690f('0x61')});}}})[_0x690f('0x26')](respondWithResult(_0x10865f,null))['catch'](function(_0x2e4ef6){var _0x3b741d=_0x1ebebb[_0x690f('0x2f')][_0x690f('0x62')]?0x1f4:_0x2e4ef6[_0x690f('0x63')]||0x1f4;logger[_0x690f('0x64')](_0x690f('0x65'),_0x690f('0x54'),_0x3b741d,JSON[_0x690f('0x66')](_0x2e4ef6));delete _0x2e4ef6[_0x690f('0x28')];if(_0x3b741d===0x191){_0x3b741d=0x190;}_0x10865f['status'](_0x3b741d)['send'](_0x1ebebb[_0x690f('0x2f')][_0x690f('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x2e4ef6[_0x690f('0x63')]}:_0x2e4ef6);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 9289214..47f92bd 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 _0x57ca=['exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x57ca,0x108));var _0xa57c=function(_0x346dff,_0x517b06){_0x346dff=_0x346dff-0x0;var _0x4b43c9=_0x57ca[_0x346dff];return _0x4b43c9;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));var integrations=require(_0xa57c('0x8'));module[_0xa57c('0x9')]=function(_0x19473f,_0xbdfffb){return _0x19473f[_0xa57c('0xa')](_0xa57c('0xb'),attributes,{'tableName':_0xa57c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb016=['../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x23f668,_0x132974){var _0x30a6c7=function(_0x12ec0b){while(--_0x12ec0b){_0x23f668['push'](_0x23f668['shift']());}};_0x30a6c7(++_0x132974);}(_0xb016,0x159));var _0x6b01=function(_0x2c39a4,_0x4d4c91){_0x2c39a4=_0x2c39a4-0x0;var _0x4fc6df=_0xb016[_0x2c39a4];return _0x4fc6df;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b01('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b01('0x3'));var fs=require('fs');var path=require(_0x6b01('0x4'));var rimraf=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x6b01('0x7'));module[_0x6b01('0x8')]=function(_0x192b2d,_0x5759a1){return _0x192b2d['define'](_0x6b01('0x9'),attributes,{'tableName':_0x6b01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 80a2b3e..a72a7b4 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 _0x1623=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowFreshsalesAccount','lodash','bluebird','randomstring','ioredis'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x1623,0xab));var _0x3162=function(_0x34f29e,_0x366ca3){_0x34f29e=_0x34f29e-0x0;var _0x95fc75=_0x1623[_0x34f29e];return _0x95fc75;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});}exports[_0x3162('0x16')]=function(_0x1eed46){var _0x391d97=this;return new Promise(function(_0x4b2bf3,_0x42f283){return db[_0x3162('0x17')][_0x3162('0x18')]({'raw':_0x1eed46[_0x3162('0x19')]?_0x1eed46['options'][_0x3162('0x1a')]===undefined?!![]:![]:!![],'where':_0x1eed46['options']?_0x1eed46['options'][_0x3162('0x1b')]||null:null,'attributes':_0x1eed46[_0x3162('0x19')]?_0x1eed46[_0x3162('0x19')]['attributes']||null:null,'limit':_0x1eed46['options']?_0x1eed46[_0x3162('0x19')][_0x3162('0x1c')]||null:null,'include':_0x1eed46[_0x3162('0x19')]?_0x1eed46[_0x3162('0x19')][_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x1eed46[_0x3162('0x19')][_0x3162('0x1d')],function(_0x5a4994){return{'model':db[_0x5a4994[_0x3162('0x1f')]],'as':_0x5a4994['as'],'attributes':_0x5a4994[_0x3162('0x20')],'include':_0x5a4994[_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x5a4994[_0x3162('0x1d')],function(_0x3c543e){return{'model':db[_0x3c543e[_0x3162('0x1f')]],'as':_0x3c543e['as'],'attributes':_0x3c543e[_0x3162('0x20')],'include':_0x3c543e[_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x3c543e[_0x3162('0x1d')],function(_0x2f62d7){return{'model':db[_0x2f62d7[_0x3162('0x1f')]],'as':_0x2f62d7['as'],'attributes':_0x2f62d7['attributes']};}):[]};}):[]};}):[]:[]})[_0x3162('0xa')](function(_0x552469){logger[_0x3162('0xb')](_0x3162('0x16'),_0x1eed46);logger[_0x3162('0xc')]('GetFreshsalesAccount',_0x1eed46,JSON['stringify'](_0x552469));_0x4b2bf3(_0x552469);})[_0x3162('0x15')](function(_0xaa1f35){logger[_0x3162('0x10')](_0x3162('0x16'),_0xaa1f35[_0x3162('0x13')],_0x1eed46);_0x42f283(_0x391d97['error'](0x1f4,_0xaa1f35[_0x3162('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0xf11765){var _0x3a188e=this;return new Promise(function(_0x41e933,_0x221b38){return db[_0x3162('0x17')][_0x3162('0x21')]({'raw':_0xf11765[_0x3162('0x19')]?_0xf11765[_0x3162('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xf11765[_0x3162('0x19')]?_0xf11765[_0x3162('0x19')]['where']||null:null,'attributes':_0xf11765[_0x3162('0x19')]?_0xf11765[_0x3162('0x19')]['attributes']||null:null,'include':_0xf11765['options']?_0xf11765[_0x3162('0x19')]['include']?_[_0x3162('0x1e')](_0xf11765[_0x3162('0x19')][_0x3162('0x1d')],function(_0x551442){return{'model':db[_0x551442['model']],'as':_0x551442['as'],'attributes':_0x551442[_0x3162('0x20')],'include':_0x551442[_0x3162('0x1d')]?_['map'](_0x551442[_0x3162('0x1d')],function(_0x4d4f74){return{'model':db[_0x4d4f74[_0x3162('0x1f')]],'as':_0x4d4f74['as'],'attributes':_0x4d4f74[_0x3162('0x20')],'include':_0x4d4f74[_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x4d4f74[_0x3162('0x1d')],function(_0x3b6c91){return{'model':db[_0x3b6c91[_0x3162('0x1f')]],'as':_0x3b6c91['as'],'attributes':_0x3b6c91[_0x3162('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3162('0xa')](function(_0x16c5d6){logger[_0x3162('0xb')]('ShowFreshsalesAccount',_0xf11765);logger[_0x3162('0xc')](_0x3162('0x22'),_0xf11765,JSON[_0x3162('0xf')](_0x16c5d6));_0x41e933(_0x16c5d6);})['catch'](function(_0x59759d){logger[_0x3162('0x10')](_0x3162('0x22'),_0x59759d[_0x3162('0x13')],_0xf11765);_0x221b38(_0x3a188e[_0x3162('0x10')](0x1f4,_0x59759d['message']));});});}; \ No newline at end of file +var _0xa6b0=['http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','attributes','limit','include','map','then','GetFreshsalesAccount','ShowFreshsalesAccount','FreshsalesAccount','find','where','model','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0xa6b0,0xaf));var _0x0a6b=function(_0xb65e2e,_0x2d9de3){_0xb65e2e=_0xb65e2e-0x0;var _0x5b1753=_0xa6b0[_0xb65e2e];return _0x5b1753;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a6b('0x2'));var fs=require('fs');var Redis=require(_0x0a6b('0x3'));var db=require(_0x0a6b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a6b('0x5'))(_0x0a6b('0x6'));var config=require(_0x0a6b('0x7'));var jayson=require(_0x0a6b('0x8'));var client=jayson[_0x0a6b('0x9')][_0x0a6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5fb5,_0xa908dd,_0x26f761){return new BPromise(function(_0x340a33,_0x8e89f){return client[_0x0a6b('0xb')](_0x1b5fb5,_0x26f761)['then'](function(_0x493948){logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));logger[_0x0a6b('0xf')](_0x0a6b('0x10'),_0xa908dd,_0x0a6b('0xe'),JSON[_0x0a6b('0x11')](_0x493948));if(_0x493948[_0x0a6b('0x12')]){if(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x13')]===0x1f4){logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x8e89f(_0x493948['error']['message']);}logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x340a33(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);}else{logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));_0x340a33(_0x493948[_0x0a6b('0x15')]['message']);}})[_0x0a6b('0x16')](function(_0x1538f4){logger['error'](_0x0a6b('0xd'),_0xa908dd,_0x1538f4);_0x8e89f(_0x1538f4);});});}exports['GetFreshsalesAccount']=function(_0xcb412){var _0x31f347=this;return new Promise(function(_0x2cb10b,_0x1ad45d){return db['FreshsalesAccount'][_0x0a6b('0x17')]({'raw':_0xcb412[_0x0a6b('0x18')]?_0xcb412['options'][_0x0a6b('0x19')]===undefined?!![]:![]:!![],'where':_0xcb412[_0x0a6b('0x18')]?_0xcb412[_0x0a6b('0x18')]['where']||null:null,'attributes':_0xcb412[_0x0a6b('0x18')]?_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1a')]||null:null,'limit':_0xcb412['options']?_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1b')]||null:null,'include':_0xcb412[_0x0a6b('0x18')]?_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1c')]?_['map'](_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1c')],function(_0x3d153f){return{'model':db[_0x3d153f['model']],'as':_0x3d153f['as'],'attributes':_0x3d153f[_0x0a6b('0x1a')],'include':_0x3d153f[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x3d153f[_0x0a6b('0x1c')],function(_0x3b12a2){return{'model':db[_0x3b12a2['model']],'as':_0x3b12a2['as'],'attributes':_0x3b12a2[_0x0a6b('0x1a')],'include':_0x3b12a2[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x3b12a2['include'],function(_0x3a9092){return{'model':db[_0x3a9092['model']],'as':_0x3a9092['as'],'attributes':_0x3a9092[_0x0a6b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0a6b('0x1e')](function(_0x45ae97){logger['info']('GetFreshsalesAccount',_0xcb412);logger[_0x0a6b('0xf')](_0x0a6b('0x1f'),_0xcb412,JSON[_0x0a6b('0x11')](_0x45ae97));_0x2cb10b(_0x45ae97);})[_0x0a6b('0x16')](function(_0x1935a3){logger[_0x0a6b('0x12')]('GetFreshsalesAccount',_0x1935a3[_0x0a6b('0x14')],_0xcb412);_0x1ad45d(_0x31f347[_0x0a6b('0x12')](0x1f4,_0x1935a3['message']));});});};exports[_0x0a6b('0x20')]=function(_0x554145){var _0x4eb516=this;return new Promise(function(_0xbf2f1a,_0x24e96a){return db[_0x0a6b('0x21')][_0x0a6b('0x22')]({'raw':_0x554145[_0x0a6b('0x18')]?_0x554145['options']['raw']===undefined?!![]:![]:!![],'where':_0x554145[_0x0a6b('0x18')]?_0x554145[_0x0a6b('0x18')][_0x0a6b('0x23')]||null:null,'attributes':_0x554145[_0x0a6b('0x18')]?_0x554145['options'][_0x0a6b('0x1a')]||null:null,'include':_0x554145[_0x0a6b('0x18')]?_0x554145['options']['include']?_[_0x0a6b('0x1d')](_0x554145[_0x0a6b('0x18')]['include'],function(_0x3c3c23){return{'model':db[_0x3c3c23[_0x0a6b('0x24')]],'as':_0x3c3c23['as'],'attributes':_0x3c3c23[_0x0a6b('0x1a')],'include':_0x3c3c23[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x3c3c23[_0x0a6b('0x1c')],function(_0x1f6f82){return{'model':db[_0x1f6f82[_0x0a6b('0x24')]],'as':_0x1f6f82['as'],'attributes':_0x1f6f82[_0x0a6b('0x1a')],'include':_0x1f6f82[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x1f6f82[_0x0a6b('0x1c')],function(_0x49fa53){return{'model':db[_0x49fa53[_0x0a6b('0x24')]],'as':_0x49fa53['as'],'attributes':_0x49fa53[_0x0a6b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x390d62){logger[_0x0a6b('0xc')](_0x0a6b('0x20'),_0x554145);logger[_0x0a6b('0xf')](_0x0a6b('0x20'),_0x554145,JSON[_0x0a6b('0x11')](_0x390d62));_0xbf2f1a(_0x390d62);})[_0x0a6b('0x16')](function(_0x3f1be6){logger[_0x0a6b('0x12')]('ShowFreshsalesAccount',_0x3f1be6[_0x0a6b('0x14')],_0x554145);_0x24e96a(_0x4eb516[_0x0a6b('0x12')](0x1f4,_0x3f1be6[_0x0a6b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 69983df..031a347 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 _0x4258=['destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','update','delete'];(function(_0x444a70,_0x95d3d1){var _0x583249=function(_0x4cc306){while(--_0x4cc306){_0x444a70['push'](_0x444a70['shift']());}};_0x583249(++_0x95d3d1);}(_0x4258,0xfc));var _0x8425=function(_0x1bc0ce,_0x4dc2da){_0x1bc0ce=_0x1bc0ce-0x0;var _0x5bdac3=_0x4258[_0x1bc0ce];return _0x5bdac3;};'use strict';var multer=require(_0x8425('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8425('0x1'));var express=require(_0x8425('0x2'));var router=express[_0x8425('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8425('0x4'));var interaction=require(_0x8425('0x5'));var config=require(_0x8425('0x6'));var controller=require(_0x8425('0x7'));router[_0x8425('0x8')]('/',auth[_0x8425('0x9')](),controller[_0x8425('0xa')]);router[_0x8425('0x8')](_0x8425('0xb'),auth[_0x8425('0x9')](),controller[_0x8425('0xc')]);router[_0x8425('0x8')](_0x8425('0xd'),auth[_0x8425('0x9')](),controller[_0x8425('0xe')]);router[_0x8425('0x8')](_0x8425('0xf'),auth['isAuthenticated'](),controller[_0x8425('0x10')]);router['get'](_0x8425('0x11'),auth[_0x8425('0x9')](),controller[_0x8425('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8425('0x13')]);router[_0x8425('0x14')]('/:id',auth[_0x8425('0x9')](),controller[_0x8425('0x15')]);router[_0x8425('0x16')]('/:id',auth[_0x8425('0x9')](),controller[_0x8425('0x17')]);module[_0x8425('0x18')]=router; \ No newline at end of file +var _0xe5eb=['show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','create','update','delete','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated'];(function(_0xf32a17,_0x230e17){var _0x3131a6=function(_0x3eb6b6){while(--_0x3eb6b6){_0xf32a17['push'](_0xf32a17['shift']());}};_0x3131a6(++_0x230e17);}(_0xe5eb,0x9e));var _0xbe5e=function(_0x5dce97,_0x56ffaa){_0x5dce97=_0x5dce97-0x0;var _0x1f317f=_0xe5eb[_0x5dce97];return _0x1f317f;};'use strict';var multer=require(_0xbe5e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbe5e('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xbe5e('0x2'));var interaction=require(_0xbe5e('0x3'));var config=require(_0xbe5e('0x4'));var controller=require(_0xbe5e('0x5'));router[_0xbe5e('0x6')]('/',auth['isAuthenticated'](),controller[_0xbe5e('0x7')]);router[_0xbe5e('0x6')](_0xbe5e('0x8'),auth[_0xbe5e('0x9')](),controller[_0xbe5e('0xa')]);router['get'](_0xbe5e('0xb'),auth['isAuthenticated'](),controller[_0xbe5e('0xc')]);router[_0xbe5e('0x6')]('/:id/descriptions',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0xd')]);router['get'](_0xbe5e('0xe'),auth[_0xbe5e('0x9')](),controller[_0xbe5e('0xf')]);router['post']('/',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0x10')]);router['put']('/:id',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0x11')]);router[_0xbe5e('0x12')](_0xbe5e('0x8'),auth[_0xbe5e('0x9')](),controller[_0xbe5e('0x13')]);module[_0xbe5e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 93d66cf..74b2b89 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 _0x3fa6=['exports','STRING','sequelize'];(function(_0x19dc2d,_0x2b4a8b){var _0x145a78=function(_0x3385db){while(--_0x3385db){_0x19dc2d['push'](_0x19dc2d['shift']());}};_0x145a78(++_0x2b4a8b);}(_0x3fa6,0x1be));var _0x63fa=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x3fa6[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x63fa('0x0'));module[_0x63fa('0x1')]={'name':{'type':Sequelize[_0x63fa('0x2')]},'description':{'type':Sequelize[_0x63fa('0x2')]}}; \ No newline at end of file +var _0x79bb=['STRING','exports'];(function(_0x9157,_0x157ebd){var _0x5d2b99=function(_0x2e2812){while(--_0x2e2812){_0x9157['push'](_0x9157['shift']());}};_0x5d2b99(++_0x157ebd);}(_0x79bb,0x14f));var _0xb79b=function(_0x5cdad2,_0x129d32){_0x5cdad2=_0x5cdad2-0x0;var _0x508c9b=_0x79bb[_0x5cdad2];return _0x508c9b;};'use strict';var Sequelize=require('sequelize');module[_0xb79b('0x0')]={'name':{'type':Sequelize[_0xb79b('0x1')]},'description':{'type':Sequelize[_0xb79b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b5106b6..1ab28c1 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 _0xc43f=['sort','where','pick','filter','includeAll','include','show','params','keys','merge','options','create','body','catch','update','find','findOne','getSubjects','hasOwnProperty','nolimit','FreshsalesField','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','stack','name','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','order'];(function(_0x94ad71,_0x2bbe40){var _0x1b869e=function(_0x199f22){while(--_0x199f22){_0x94ad71['push'](_0x94ad71['shift']());}};_0x1b869e(++_0x2bbe40);}(_0xc43f,0x147));var _0xfc43=function(_0x225b71,_0x44be24){_0x225b71=_0x225b71-0x0;var _0x3bdbf7=_0xc43f[_0x225b71];return _0x3bdbf7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc43('0x0'));var zipdir=require(_0xfc43('0x1'));var jsonpatch=require(_0xfc43('0x2'));var rp=require(_0xfc43('0x3'));var moment=require(_0xfc43('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfc43('0x5'));var sox=require('sox');var csv=require(_0xfc43('0x6'));var ejs=require(_0xfc43('0x7'));var fs=require('fs');var fs_extra=require(_0xfc43('0x8'));var _=require(_0xfc43('0x9'));var squel=require(_0xfc43('0xa'));var crypto=require(_0xfc43('0xb'));var jsforce=require(_0xfc43('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfc43('0x6'));var querystring=require(_0xfc43('0xd'));var Papa=require(_0xfc43('0xe'));var Redis=require(_0xfc43('0xf'));var authService=require(_0xfc43('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfc43('0x11'));var hardwareService=require(_0xfc43('0x12'));var logger=require(_0xfc43('0x13'))(_0xfc43('0x14'));var utils=require('../../config/utils');var config=require(_0xfc43('0x15'));var licenseUtil=require(_0xfc43('0x16'));var db=require(_0xfc43('0x17'))['db'];function respondWithStatusCode(_0x80d6de,_0x1e18a4){_0x1e18a4=_0x1e18a4||0xcc;return function(_0x311459){if(_0x311459){return _0x80d6de[_0xfc43('0x18')](_0x1e18a4);}return _0x80d6de[_0xfc43('0x19')](_0x1e18a4)[_0xfc43('0x1a')]();};}function respondWithResult(_0x475eb8,_0x59ca1e){_0x59ca1e=_0x59ca1e||0xc8;return function(_0x261095){if(_0x261095){return _0x475eb8['status'](_0x59ca1e)[_0xfc43('0x1b')](_0x261095);}};}function respondWithFilteredResult(_0x2eb695,_0x1df31f){return function(_0x11093e){if(_0x11093e){var _0x5bdb94=typeof _0x1df31f[_0xfc43('0x1c')]==='undefined'&&typeof _0x1df31f[_0xfc43('0x1d')]===_0xfc43('0x1e');var _0x519b02=_0x11093e[_0xfc43('0x1f')];var _0x23b554=_0x5bdb94?0x0:_0x1df31f['offset'];var _0x18490a=_0x5bdb94?_0x11093e[_0xfc43('0x1f')]:_0x1df31f[_0xfc43('0x1c')]+_0x1df31f[_0xfc43('0x1d')];var _0x35562a;if(_0x18490a>=_0x519b02){_0x18490a=_0x519b02;_0x35562a=0xc8;}else{_0x35562a=0xce;}_0x2eb695['status'](_0x35562a);return _0x2eb695[_0xfc43('0x20')]('Content-Range',_0x23b554+'-'+_0x18490a+'/'+_0x519b02)[_0xfc43('0x1b')](_0x11093e);}return null;};}function patchUpdates(_0x3d3dd8){return function(_0x256e03){try{jsonpatch[_0xfc43('0x21')](_0x256e03,_0x3d3dd8,!![]);}catch(_0x15b470){return BPromise[_0xfc43('0x22')](_0x15b470);}return _0x256e03[_0xfc43('0x23')]();};}function saveUpdates(_0x2ed359,_0x3e2188){return function(_0x3f25ca){if(_0x3f25ca){return _0x3f25ca['update'](_0x2ed359)[_0xfc43('0x24')](function(_0x4efa1f){return _0x4efa1f;});}return null;};}function removeEntity(_0x4cfc90,_0x314eaf){return function(_0x284773){if(_0x284773){return _0x284773[_0xfc43('0x25')]()[_0xfc43('0x24')](function(){_0x4cfc90[_0xfc43('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d6b0,_0x494a12){return function(_0x2712a6){if(!_0x2712a6){_0x51d6b0[_0xfc43('0x18')](0x194);}return _0x2712a6;};}function handleError(_0x3d5827,_0x5e6acc){_0x5e6acc=_0x5e6acc||0x1f4;return function(_0x255409){logger['error'](_0x255409[_0xfc43('0x26')]);if(_0x255409['name']){delete _0x255409[_0xfc43('0x27')];}_0x3d5827[_0xfc43('0x19')](_0x5e6acc)['send'](_0x255409);};}exports['index']=function(_0x11cc39,_0x1be80d){var _0x5b2f42={},_0x5d1424={},_0x592e1c={'count':0x0,'rows':[]};var _0x5399f8=_[_0xfc43('0x28')](db[_0xfc43('0x29')][_0xfc43('0x2a')],function(_0x500846){return{'name':_0x500846[_0xfc43('0x2b')],'type':_0x500846['type'][_0xfc43('0x2c')]};});_0x5d1424[_0xfc43('0x2d')]=_[_0xfc43('0x28')](_0x5399f8,'name');_0x5d1424[_0xfc43('0x2e')]=_['keys'](_0x11cc39[_0xfc43('0x2e')]);_0x5d1424[_0xfc43('0x2f')]=_[_0xfc43('0x30')](_0x5d1424[_0xfc43('0x2d')],_0x5d1424['query']);_0x5b2f42[_0xfc43('0x31')]=_[_0xfc43('0x30')](_0x5d1424[_0xfc43('0x2d')],qs[_0xfc43('0x32')](_0x11cc39[_0xfc43('0x2e')][_0xfc43('0x32')]));_0x5b2f42[_0xfc43('0x31')]=_0x5b2f42[_0xfc43('0x31')][_0xfc43('0x33')]?_0x5b2f42['attributes']:_0x5d1424['model'];if(!_0x11cc39[_0xfc43('0x2e')]['hasOwnProperty']('nolimit')){_0x5b2f42['limit']=qs[_0xfc43('0x1d')](_0x11cc39[_0xfc43('0x2e')][_0xfc43('0x1d')]);_0x5b2f42[_0xfc43('0x1c')]=qs[_0xfc43('0x1c')](_0x11cc39[_0xfc43('0x2e')][_0xfc43('0x1c')]);}_0x5b2f42[_0xfc43('0x34')]=qs[_0xfc43('0x35')](_0x11cc39[_0xfc43('0x2e')][_0xfc43('0x35')]);_0x5b2f42[_0xfc43('0x36')]=qs[_0xfc43('0x2f')](_[_0xfc43('0x37')](_0x11cc39[_0xfc43('0x2e')],_0x5d1424[_0xfc43('0x2f')]),_0x5399f8);if(_0x11cc39[_0xfc43('0x2e')][_0xfc43('0x38')]){_0x5b2f42[_0xfc43('0x36')]=_['merge'](_0x5b2f42[_0xfc43('0x36')],{'$or':_[_0xfc43('0x28')](_0x5399f8,function(_0x2088b9){if(_0x2088b9['type']!=='VIRTUAL'){var _0x5ecaf0={};_0x5ecaf0[_0x2088b9[_0xfc43('0x27')]]={'$like':'%'+_0x11cc39['query']['filter']+'%'};return _0x5ecaf0;}})});}_0x5b2f42=_['merge']({},_0x5b2f42,_0x11cc39['options']);var _0x4f74f0={'where':_0x5b2f42[_0xfc43('0x36')]};return db[_0xfc43('0x29')][_0xfc43('0x1f')](_0x4f74f0)[_0xfc43('0x24')](function(_0x1c4369){_0x592e1c['count']=_0x1c4369;if(_0x11cc39[_0xfc43('0x2e')][_0xfc43('0x39')]){_0x5b2f42[_0xfc43('0x3a')]=[{'all':!![]}];}return db[_0xfc43('0x29')]['findAll'](_0x5b2f42);})[_0xfc43('0x24')](function(_0x17669e){_0x592e1c['rows']=_0x17669e;return _0x592e1c;})['then'](respondWithFilteredResult(_0x1be80d,_0x5b2f42))['catch'](handleError(_0x1be80d,null));};exports[_0xfc43('0x3b')]=function(_0x24acd4,_0x3c0ec3){var _0x124802={'raw':![],'where':{'id':_0x24acd4[_0xfc43('0x3c')]['id']}},_0x4035de={};_0x4035de[_0xfc43('0x2d')]=_[_0xfc43('0x3d')](db[_0xfc43('0x29')]['rawAttributes']);_0x4035de[_0xfc43('0x2e')]=_[_0xfc43('0x3d')](_0x24acd4[_0xfc43('0x2e')]);_0x4035de['filters']=_[_0xfc43('0x30')](_0x4035de[_0xfc43('0x2d')],_0x4035de[_0xfc43('0x2e')]);_0x124802[_0xfc43('0x31')]=_[_0xfc43('0x30')](_0x4035de[_0xfc43('0x2d')],qs['fields'](_0x24acd4[_0xfc43('0x2e')][_0xfc43('0x32')]));_0x124802['attributes']=_0x124802['attributes'][_0xfc43('0x33')]?_0x124802[_0xfc43('0x31')]:_0x4035de[_0xfc43('0x2d')];if(_0x24acd4[_0xfc43('0x2e')]['includeAll']){_0x124802[_0xfc43('0x3a')]=[{'all':!![]}];}_0x124802=_[_0xfc43('0x3e')]({},_0x124802,_0x24acd4[_0xfc43('0x3f')]);return db['FreshsalesConfiguration']['find'](_0x124802)[_0xfc43('0x24')](handleEntityNotFound(_0x3c0ec3,null))[_0xfc43('0x24')](respondWithResult(_0x3c0ec3,null))['catch'](handleError(_0x3c0ec3,null));};exports[_0xfc43('0x40')]=function(_0xd283d6,_0x13a9eb){return db[_0xfc43('0x29')][_0xfc43('0x40')](_0xd283d6[_0xfc43('0x41')],{})['then'](respondWithResult(_0x13a9eb,0xc9))[_0xfc43('0x42')](handleError(_0x13a9eb,null));};exports[_0xfc43('0x43')]=function(_0x511614,_0x1139c0){if(_0x511614[_0xfc43('0x41')]['id']){delete _0x511614[_0xfc43('0x41')]['id'];}return db['FreshsalesConfiguration'][_0xfc43('0x44')]({'where':{'id':_0x511614[_0xfc43('0x3c')]['id']}})[_0xfc43('0x24')](handleEntityNotFound(_0x1139c0,null))[_0xfc43('0x24')](saveUpdates(_0x511614[_0xfc43('0x41')],null))[_0xfc43('0x24')](respondWithResult(_0x1139c0,null))[_0xfc43('0x42')](handleError(_0x1139c0,null));};exports[_0xfc43('0x25')]=function(_0x20868d,_0x3524a8){return db['FreshsalesConfiguration'][_0xfc43('0x44')]({'where':{'id':_0x20868d[_0xfc43('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3524a8,null))['then'](removeEntity(_0x3524a8,null))[_0xfc43('0x42')](handleError(_0x3524a8,null));};exports['getSubjects']=function(_0x4d68ba,_0x24d541,_0x1a86f8){var _0x44491e={};var _0x57fc0d={};var _0x1f0767;var _0x58bda0;return db[_0xfc43('0x29')][_0xfc43('0x45')]({'where':{'id':_0x4d68ba[_0xfc43('0x3c')]['id']}})[_0xfc43('0x24')](handleEntityNotFound(_0x24d541,null))[_0xfc43('0x24')](function(_0x1ab35b){if(_0x1ab35b){_0x1f0767=_0x1ab35b;_0x57fc0d['model']=_[_0xfc43('0x3d')](db['FreshsalesField'][_0xfc43('0x2a')]);_0x57fc0d[_0xfc43('0x2e')]=_[_0xfc43('0x3d')](_0x4d68ba[_0xfc43('0x2e')]);_0x57fc0d['filters']=_[_0xfc43('0x30')](_0x57fc0d['model'],_0x57fc0d['query']);_0x44491e[_0xfc43('0x31')]=_[_0xfc43('0x30')](_0x57fc0d['model'],qs['fields'](_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x32')]));_0x44491e[_0xfc43('0x31')]=_0x44491e['attributes'][_0xfc43('0x33')]?_0x44491e[_0xfc43('0x31')]:_0x57fc0d['model'];_0x44491e[_0xfc43('0x34')]=qs[_0xfc43('0x35')](_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x35')]);_0x44491e[_0xfc43('0x36')]=qs[_0xfc43('0x2f')](_[_0xfc43('0x37')](_0x4d68ba[_0xfc43('0x2e')],_0x57fc0d[_0xfc43('0x2f')]));if(_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x38')]){_0x44491e[_0xfc43('0x36')]=_[_0xfc43('0x3e')](_0x44491e['where'],{'$or':_[_0xfc43('0x28')](_0x44491e[_0xfc43('0x31')],function(_0x51a0c3){var _0x22bd52={};_0x22bd52[_0x51a0c3]={'$like':'%'+_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x38')]+'%'};return _0x22bd52;})});}_0x44491e=_[_0xfc43('0x3e')]({},_0x44491e,_0x4d68ba[_0xfc43('0x3f')]);return _0x1f0767[_0xfc43('0x46')](_0x44491e);}})[_0xfc43('0x24')](function(_0x5e5f03){if(_0x5e5f03){_0x58bda0=_0x5e5f03['length'];if(!_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x47')](_0xfc43('0x48'))){_0x44491e[_0xfc43('0x1d')]=qs['limit'](_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x1d')]);_0x44491e[_0xfc43('0x1c')]=qs[_0xfc43('0x1c')](_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x1c')]);}return _0x1f0767[_0xfc43('0x46')](_0x44491e);}})[_0xfc43('0x24')](function(_0x57e045){if(_0x57e045){return _0x57e045?{'count':_0x58bda0,'rows':_0x57e045}:null;}})['then'](respondWithResult(_0x24d541,null))[_0xfc43('0x42')](handleError(_0x24d541,null));};exports['getDescriptions']=function(_0x38ad60,_0x540bdb,_0x55f8ad){var _0x4e3d28={};var _0x59f41d={};var _0x5a7f5;var _0x47f0b4;return db['FreshsalesConfiguration'][_0xfc43('0x45')]({'where':{'id':_0x38ad60[_0xfc43('0x3c')]['id']}})[_0xfc43('0x24')](handleEntityNotFound(_0x540bdb,null))[_0xfc43('0x24')](function(_0x2fda2b){if(_0x2fda2b){_0x5a7f5=_0x2fda2b;_0x59f41d[_0xfc43('0x2d')]=_[_0xfc43('0x3d')](db[_0xfc43('0x49')]['rawAttributes']);_0x59f41d['query']=_[_0xfc43('0x3d')](_0x38ad60[_0xfc43('0x2e')]);_0x59f41d[_0xfc43('0x2f')]=_[_0xfc43('0x30')](_0x59f41d[_0xfc43('0x2d')],_0x59f41d['query']);_0x4e3d28[_0xfc43('0x31')]=_['intersection'](_0x59f41d['model'],qs[_0xfc43('0x32')](_0x38ad60['query'][_0xfc43('0x32')]));_0x4e3d28['attributes']=_0x4e3d28['attributes'][_0xfc43('0x33')]?_0x4e3d28[_0xfc43('0x31')]:_0x59f41d[_0xfc43('0x2d')];_0x4e3d28[_0xfc43('0x34')]=qs[_0xfc43('0x35')](_0x38ad60['query'][_0xfc43('0x35')]);_0x4e3d28[_0xfc43('0x36')]=qs['filters'](_[_0xfc43('0x37')](_0x38ad60[_0xfc43('0x2e')],_0x59f41d[_0xfc43('0x2f')]));if(_0x38ad60[_0xfc43('0x2e')][_0xfc43('0x38')]){_0x4e3d28[_0xfc43('0x36')]=_[_0xfc43('0x3e')](_0x4e3d28[_0xfc43('0x36')],{'$or':_[_0xfc43('0x28')](_0x4e3d28[_0xfc43('0x31')],function(_0x236318){var _0x579e48={};_0x579e48[_0x236318]={'$like':'%'+_0x38ad60[_0xfc43('0x2e')][_0xfc43('0x38')]+'%'};return _0x579e48;})});}_0x4e3d28=_['merge']({},_0x4e3d28,_0x38ad60[_0xfc43('0x3f')]);return _0x5a7f5[_0xfc43('0x4a')](_0x4e3d28);}})['then'](function(_0x55af2d){if(_0x55af2d){_0x47f0b4=_0x55af2d[_0xfc43('0x33')];if(!_0x38ad60['query']['hasOwnProperty'](_0xfc43('0x48'))){_0x4e3d28[_0xfc43('0x1d')]=qs[_0xfc43('0x1d')](_0x38ad60[_0xfc43('0x2e')][_0xfc43('0x1d')]);_0x4e3d28[_0xfc43('0x1c')]=qs[_0xfc43('0x1c')](_0x38ad60['query'][_0xfc43('0x1c')]);}return _0x5a7f5['getDescriptions'](_0x4e3d28);}})[_0xfc43('0x24')](function(_0x3272d3){if(_0x3272d3){return _0x3272d3?{'count':_0x47f0b4,'rows':_0x3272d3}:null;}})[_0xfc43('0x24')](respondWithResult(_0x540bdb,null))[_0xfc43('0x42')](handleError(_0x540bdb,null));};exports['getFields']=function(_0x5ba2ad,_0x237d6f,_0xe910f9){var _0x28519d={};var _0x105099={};var _0x23e230;var _0x154951;return db[_0xfc43('0x29')][_0xfc43('0x45')]({'where':{'id':_0x5ba2ad['params']['id']}})[_0xfc43('0x24')](handleEntityNotFound(_0x237d6f,null))[_0xfc43('0x24')](function(_0x2abdf7){if(_0x2abdf7){_0x23e230=_0x2abdf7;_0x105099[_0xfc43('0x2d')]=_[_0xfc43('0x3d')](db[_0xfc43('0x49')]['rawAttributes']);_0x105099[_0xfc43('0x2e')]=_[_0xfc43('0x3d')](_0x5ba2ad[_0xfc43('0x2e')]);_0x105099[_0xfc43('0x2f')]=_['intersection'](_0x105099[_0xfc43('0x2d')],_0x105099[_0xfc43('0x2e')]);_0x28519d[_0xfc43('0x31')]=_['intersection'](_0x105099[_0xfc43('0x2d')],qs[_0xfc43('0x32')](_0x5ba2ad[_0xfc43('0x2e')][_0xfc43('0x32')]));_0x28519d[_0xfc43('0x31')]=_0x28519d['attributes'][_0xfc43('0x33')]?_0x28519d[_0xfc43('0x31')]:_0x105099[_0xfc43('0x2d')];_0x28519d[_0xfc43('0x34')]=qs['sort'](_0x5ba2ad[_0xfc43('0x2e')][_0xfc43('0x35')]);_0x28519d[_0xfc43('0x36')]=qs[_0xfc43('0x2f')](_['pick'](_0x5ba2ad['query'],_0x105099[_0xfc43('0x2f')]));if(_0x5ba2ad[_0xfc43('0x2e')]['filter']){_0x28519d[_0xfc43('0x36')]=_[_0xfc43('0x3e')](_0x28519d[_0xfc43('0x36')],{'$or':_['map'](_0x28519d[_0xfc43('0x31')],function(_0x45c795){var _0x28e151={};_0x28e151[_0x45c795]={'$like':'%'+_0x5ba2ad[_0xfc43('0x2e')][_0xfc43('0x38')]+'%'};return _0x28e151;})});}_0x28519d=_['merge']({},_0x28519d,_0x5ba2ad[_0xfc43('0x3f')]);return _0x23e230[_0xfc43('0x4b')](_0x28519d);}})[_0xfc43('0x24')](function(_0xfe7e72){if(_0xfe7e72){_0x154951=_0xfe7e72[_0xfc43('0x33')];if(!_0x5ba2ad[_0xfc43('0x2e')]['hasOwnProperty'](_0xfc43('0x48'))){_0x28519d[_0xfc43('0x1d')]=qs['limit'](_0x5ba2ad[_0xfc43('0x2e')][_0xfc43('0x1d')]);_0x28519d['offset']=qs['offset'](_0x5ba2ad[_0xfc43('0x2e')][_0xfc43('0x1c')]);}return _0x23e230[_0xfc43('0x4b')](_0x28519d);}})[_0xfc43('0x24')](function(_0x2c416b){if(_0x2c416b){return _0x2c416b?{'count':_0x154951,'rows':_0x2c416b}:null;}})[_0xfc43('0x24')](respondWithResult(_0x237d6f,null))[_0xfc43('0x42')](handleError(_0x237d6f,null));}; \ No newline at end of file +var _0x677b=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','destroy','getSubjects','findOne','FreshsalesField','order','getDescriptions','getFields','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x4ba626,_0x1fc9c9){var _0x771827=function(_0x35973d){while(--_0x35973d){_0x4ba626['push'](_0x4ba626['shift']());}};_0x771827(++_0x1fc9c9);}(_0x677b,0x8e));var _0xb677=function(_0x9c8b4a,_0x2387ff){_0x9c8b4a=_0x9c8b4a-0x0;var _0x198bef=_0x677b[_0x9c8b4a];return _0x198bef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb677('0x0'));var BPromise=require('bluebird');var Mustache=require(_0xb677('0x1'));var util=require(_0xb677('0x2'));var path=require(_0xb677('0x3'));var sox=require(_0xb677('0x4'));var csv=require(_0xb677('0x5'));var ejs=require(_0xb677('0x6'));var fs=require('fs');var fs_extra=require(_0xb677('0x7'));var _=require(_0xb677('0x8'));var squel=require(_0xb677('0x9'));var crypto=require(_0xb677('0xa'));var jsforce=require(_0xb677('0xb'));var deskjs=require(_0xb677('0xc'));var toCsv=require(_0xb677('0x5'));var querystring=require('querystring');var Papa=require(_0xb677('0xd'));var Redis=require(_0xb677('0xe'));var authService=require(_0xb677('0xf'));var qs=require(_0xb677('0x10'));var as=require(_0xb677('0x11'));var hardwareService=require(_0xb677('0x12'));var logger=require(_0xb677('0x13'))(_0xb677('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb677('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3066a0,_0x2e542b){_0x2e542b=_0x2e542b||0xcc;return function(_0x5515c5){if(_0x5515c5){return _0x3066a0[_0xb677('0x16')](_0x2e542b);}return _0x3066a0[_0xb677('0x17')](_0x2e542b)[_0xb677('0x18')]();};}function respondWithResult(_0x59373c,_0x17f688){_0x17f688=_0x17f688||0xc8;return function(_0xb41030){if(_0xb41030){return _0x59373c[_0xb677('0x17')](_0x17f688)['json'](_0xb41030);}};}function respondWithFilteredResult(_0x4eca0f,_0x3e43c0){return function(_0x468333){if(_0x468333){var _0x83353=typeof _0x3e43c0['offset']===_0xb677('0x19')&&typeof _0x3e43c0[_0xb677('0x1a')]==='undefined';var _0x3fe7d7=_0x468333[_0xb677('0x1b')];var _0x3b7afc=_0x83353?0x0:_0x3e43c0[_0xb677('0x1c')];var _0x2f1584=_0x83353?_0x468333[_0xb677('0x1b')]:_0x3e43c0[_0xb677('0x1c')]+_0x3e43c0[_0xb677('0x1a')];var _0x35d380;if(_0x2f1584>=_0x3fe7d7){_0x2f1584=_0x3fe7d7;_0x35d380=0xc8;}else{_0x35d380=0xce;}_0x4eca0f[_0xb677('0x17')](_0x35d380);return _0x4eca0f['set'](_0xb677('0x1d'),_0x3b7afc+'-'+_0x2f1584+'/'+_0x3fe7d7)['json'](_0x468333);}return null;};}function patchUpdates(_0x4b6fa8){return function(_0x55503f){try{jsonpatch[_0xb677('0x1e')](_0x55503f,_0x4b6fa8,!![]);}catch(_0x1fd219){return BPromise[_0xb677('0x1f')](_0x1fd219);}return _0x55503f['save']();};}function saveUpdates(_0x1d8ba7,_0x1fdc93){return function(_0x1b17fc){if(_0x1b17fc){return _0x1b17fc[_0xb677('0x20')](_0x1d8ba7)[_0xb677('0x21')](function(_0x211697){return _0x211697;});}return null;};}function removeEntity(_0x108e03,_0x4f1412){return function(_0x504220){if(_0x504220){return _0x504220['destroy']()[_0xb677('0x21')](function(){_0x108e03['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56a7eb,_0x5030d1){return function(_0x2d3562){if(!_0x2d3562){_0x56a7eb[_0xb677('0x16')](0x194);}return _0x2d3562;};}function handleError(_0x3ee5c7,_0x523c7d){_0x523c7d=_0x523c7d||0x1f4;return function(_0x27ada4){logger[_0xb677('0x22')](_0x27ada4[_0xb677('0x23')]);if(_0x27ada4[_0xb677('0x24')]){delete _0x27ada4[_0xb677('0x24')];}_0x3ee5c7[_0xb677('0x17')](_0x523c7d)[_0xb677('0x25')](_0x27ada4);};}exports[_0xb677('0x26')]=function(_0x5ee1ae,_0x553919){var _0x37397d={},_0x4c4045={},_0x56b29d={'count':0x0,'rows':[]};var _0x2a0e54=_[_0xb677('0x27')](db[_0xb677('0x28')]['rawAttributes'],function(_0x283f59){return{'name':_0x283f59[_0xb677('0x29')],'type':_0x283f59['type'][_0xb677('0x2a')]};});_0x4c4045[_0xb677('0x2b')]=_[_0xb677('0x27')](_0x2a0e54,_0xb677('0x24'));_0x4c4045['query']=_[_0xb677('0x2c')](_0x5ee1ae[_0xb677('0x2d')]);_0x4c4045['filters']=_['intersection'](_0x4c4045[_0xb677('0x2b')],_0x4c4045[_0xb677('0x2d')]);_0x37397d[_0xb677('0x2e')]=_[_0xb677('0x2f')](_0x4c4045[_0xb677('0x2b')],qs['fields'](_0x5ee1ae['query'][_0xb677('0x30')]));_0x37397d['attributes']=_0x37397d[_0xb677('0x2e')][_0xb677('0x31')]?_0x37397d[_0xb677('0x2e')]:_0x4c4045[_0xb677('0x2b')];if(!_0x5ee1ae[_0xb677('0x2d')][_0xb677('0x32')](_0xb677('0x33'))){_0x37397d['limit']=qs['limit'](_0x5ee1ae['query']['limit']);_0x37397d[_0xb677('0x1c')]=qs[_0xb677('0x1c')](_0x5ee1ae['query'][_0xb677('0x1c')]);}_0x37397d['order']=qs[_0xb677('0x34')](_0x5ee1ae['query'][_0xb677('0x34')]);_0x37397d['where']=qs[_0xb677('0x35')](_[_0xb677('0x36')](_0x5ee1ae['query'],_0x4c4045[_0xb677('0x35')]),_0x2a0e54);if(_0x5ee1ae[_0xb677('0x2d')][_0xb677('0x37')]){_0x37397d[_0xb677('0x38')]=_[_0xb677('0x39')](_0x37397d['where'],{'$or':_[_0xb677('0x27')](_0x2a0e54,function(_0x3deca3){if(_0x3deca3['type']!==_0xb677('0x3a')){var _0x5710dd={};_0x5710dd[_0x3deca3['name']]={'$like':'%'+_0x5ee1ae['query'][_0xb677('0x37')]+'%'};return _0x5710dd;}})});}_0x37397d=_['merge']({},_0x37397d,_0x5ee1ae[_0xb677('0x3b')]);var _0x41d670={'where':_0x37397d['where']};return db[_0xb677('0x28')][_0xb677('0x1b')](_0x41d670)[_0xb677('0x21')](function(_0x47fe58){_0x56b29d['count']=_0x47fe58;if(_0x5ee1ae[_0xb677('0x2d')][_0xb677('0x3c')]){_0x37397d[_0xb677('0x3d')]=[{'all':!![]}];}return db[_0xb677('0x28')][_0xb677('0x3e')](_0x37397d);})['then'](function(_0x2c5efa){_0x56b29d[_0xb677('0x3f')]=_0x2c5efa;return _0x56b29d;})['then'](respondWithFilteredResult(_0x553919,_0x37397d))[_0xb677('0x40')](handleError(_0x553919,null));};exports['show']=function(_0xd91ec9,_0x3d81d4){var _0x36ecdd={'raw':![],'where':{'id':_0xd91ec9[_0xb677('0x41')]['id']}},_0x20992b={};_0x20992b[_0xb677('0x2b')]=_[_0xb677('0x2c')](db[_0xb677('0x28')][_0xb677('0x42')]);_0x20992b['query']=_[_0xb677('0x2c')](_0xd91ec9[_0xb677('0x2d')]);_0x20992b[_0xb677('0x35')]=_[_0xb677('0x2f')](_0x20992b[_0xb677('0x2b')],_0x20992b[_0xb677('0x2d')]);_0x36ecdd[_0xb677('0x2e')]=_[_0xb677('0x2f')](_0x20992b[_0xb677('0x2b')],qs[_0xb677('0x30')](_0xd91ec9['query'][_0xb677('0x30')]));_0x36ecdd[_0xb677('0x2e')]=_0x36ecdd[_0xb677('0x2e')][_0xb677('0x31')]?_0x36ecdd['attributes']:_0x20992b[_0xb677('0x2b')];if(_0xd91ec9[_0xb677('0x2d')]['includeAll']){_0x36ecdd[_0xb677('0x3d')]=[{'all':!![]}];}_0x36ecdd=_[_0xb677('0x39')]({},_0x36ecdd,_0xd91ec9[_0xb677('0x3b')]);return db[_0xb677('0x28')][_0xb677('0x43')](_0x36ecdd)[_0xb677('0x21')](handleEntityNotFound(_0x3d81d4,null))[_0xb677('0x21')](respondWithResult(_0x3d81d4,null))['catch'](handleError(_0x3d81d4,null));};exports[_0xb677('0x44')]=function(_0x57e6fa,_0x57df63){return db['FreshsalesConfiguration'][_0xb677('0x44')](_0x57e6fa[_0xb677('0x45')],{})[_0xb677('0x21')](respondWithResult(_0x57df63,0xc9))[_0xb677('0x40')](handleError(_0x57df63,null));};exports['update']=function(_0x379341,_0x1830a8){if(_0x379341[_0xb677('0x45')]['id']){delete _0x379341[_0xb677('0x45')]['id'];}return db[_0xb677('0x28')][_0xb677('0x43')]({'where':{'id':_0x379341[_0xb677('0x41')]['id']}})['then'](handleEntityNotFound(_0x1830a8,null))[_0xb677('0x21')](saveUpdates(_0x379341['body'],null))[_0xb677('0x21')](respondWithResult(_0x1830a8,null))[_0xb677('0x40')](handleError(_0x1830a8,null));};exports[_0xb677('0x46')]=function(_0x39abb2,_0x77e46b){return db[_0xb677('0x28')][_0xb677('0x43')]({'where':{'id':_0x39abb2[_0xb677('0x41')]['id']}})[_0xb677('0x21')](handleEntityNotFound(_0x77e46b,null))['then'](removeEntity(_0x77e46b,null))['catch'](handleError(_0x77e46b,null));};exports[_0xb677('0x47')]=function(_0x4c57f7,_0x241497,_0x23e6bf){var _0x4bfd6d={};var _0x4f4c8d={};var _0x176888;var _0x4c87b9;return db[_0xb677('0x28')][_0xb677('0x48')]({'where':{'id':_0x4c57f7['params']['id']}})['then'](handleEntityNotFound(_0x241497,null))[_0xb677('0x21')](function(_0x2f14eb){if(_0x2f14eb){_0x176888=_0x2f14eb;_0x4f4c8d[_0xb677('0x2b')]=_[_0xb677('0x2c')](db[_0xb677('0x49')][_0xb677('0x42')]);_0x4f4c8d[_0xb677('0x2d')]=_['keys'](_0x4c57f7[_0xb677('0x2d')]);_0x4f4c8d['filters']=_[_0xb677('0x2f')](_0x4f4c8d[_0xb677('0x2b')],_0x4f4c8d[_0xb677('0x2d')]);_0x4bfd6d[_0xb677('0x2e')]=_['intersection'](_0x4f4c8d[_0xb677('0x2b')],qs['fields'](_0x4c57f7[_0xb677('0x2d')][_0xb677('0x30')]));_0x4bfd6d[_0xb677('0x2e')]=_0x4bfd6d[_0xb677('0x2e')]['length']?_0x4bfd6d['attributes']:_0x4f4c8d[_0xb677('0x2b')];_0x4bfd6d['order']=qs[_0xb677('0x34')](_0x4c57f7[_0xb677('0x2d')]['sort']);_0x4bfd6d[_0xb677('0x38')]=qs['filters'](_[_0xb677('0x36')](_0x4c57f7['query'],_0x4f4c8d[_0xb677('0x35')]));if(_0x4c57f7[_0xb677('0x2d')][_0xb677('0x37')]){_0x4bfd6d['where']=_[_0xb677('0x39')](_0x4bfd6d[_0xb677('0x38')],{'$or':_[_0xb677('0x27')](_0x4bfd6d['attributes'],function(_0x22d7e6){var _0x4eefc0={};_0x4eefc0[_0x22d7e6]={'$like':'%'+_0x4c57f7['query'][_0xb677('0x37')]+'%'};return _0x4eefc0;})});}_0x4bfd6d=_[_0xb677('0x39')]({},_0x4bfd6d,_0x4c57f7[_0xb677('0x3b')]);return _0x176888[_0xb677('0x47')](_0x4bfd6d);}})[_0xb677('0x21')](function(_0x256140){if(_0x256140){_0x4c87b9=_0x256140['length'];if(!_0x4c57f7[_0xb677('0x2d')][_0xb677('0x32')](_0xb677('0x33'))){_0x4bfd6d[_0xb677('0x1a')]=qs['limit'](_0x4c57f7[_0xb677('0x2d')][_0xb677('0x1a')]);_0x4bfd6d[_0xb677('0x1c')]=qs[_0xb677('0x1c')](_0x4c57f7[_0xb677('0x2d')][_0xb677('0x1c')]);}return _0x176888[_0xb677('0x47')](_0x4bfd6d);}})[_0xb677('0x21')](function(_0x531907){if(_0x531907){return _0x531907?{'count':_0x4c87b9,'rows':_0x531907}:null;}})[_0xb677('0x21')](respondWithResult(_0x241497,null))[_0xb677('0x40')](handleError(_0x241497,null));};exports['getDescriptions']=function(_0x49038a,_0x504d49,_0x4958ac){var _0x3a7922={};var _0x3124e7={};var _0x493182;var _0x297b97;return db[_0xb677('0x28')][_0xb677('0x48')]({'where':{'id':_0x49038a[_0xb677('0x41')]['id']}})[_0xb677('0x21')](handleEntityNotFound(_0x504d49,null))[_0xb677('0x21')](function(_0xbafca8){if(_0xbafca8){_0x493182=_0xbafca8;_0x3124e7[_0xb677('0x2b')]=_['keys'](db[_0xb677('0x49')][_0xb677('0x42')]);_0x3124e7[_0xb677('0x2d')]=_[_0xb677('0x2c')](_0x49038a['query']);_0x3124e7['filters']=_[_0xb677('0x2f')](_0x3124e7[_0xb677('0x2b')],_0x3124e7[_0xb677('0x2d')]);_0x3a7922['attributes']=_[_0xb677('0x2f')](_0x3124e7[_0xb677('0x2b')],qs[_0xb677('0x30')](_0x49038a[_0xb677('0x2d')][_0xb677('0x30')]));_0x3a7922[_0xb677('0x2e')]=_0x3a7922[_0xb677('0x2e')]['length']?_0x3a7922[_0xb677('0x2e')]:_0x3124e7['model'];_0x3a7922[_0xb677('0x4a')]=qs[_0xb677('0x34')](_0x49038a[_0xb677('0x2d')]['sort']);_0x3a7922[_0xb677('0x38')]=qs[_0xb677('0x35')](_[_0xb677('0x36')](_0x49038a[_0xb677('0x2d')],_0x3124e7[_0xb677('0x35')]));if(_0x49038a[_0xb677('0x2d')]['filter']){_0x3a7922['where']=_['merge'](_0x3a7922[_0xb677('0x38')],{'$or':_[_0xb677('0x27')](_0x3a7922[_0xb677('0x2e')],function(_0x20ccc9){var _0x5150e3={};_0x5150e3[_0x20ccc9]={'$like':'%'+_0x49038a[_0xb677('0x2d')][_0xb677('0x37')]+'%'};return _0x5150e3;})});}_0x3a7922=_[_0xb677('0x39')]({},_0x3a7922,_0x49038a[_0xb677('0x3b')]);return _0x493182[_0xb677('0x4b')](_0x3a7922);}})['then'](function(_0x2f387b){if(_0x2f387b){_0x297b97=_0x2f387b['length'];if(!_0x49038a[_0xb677('0x2d')][_0xb677('0x32')]('nolimit')){_0x3a7922[_0xb677('0x1a')]=qs['limit'](_0x49038a[_0xb677('0x2d')]['limit']);_0x3a7922[_0xb677('0x1c')]=qs[_0xb677('0x1c')](_0x49038a[_0xb677('0x2d')][_0xb677('0x1c')]);}return _0x493182['getDescriptions'](_0x3a7922);}})[_0xb677('0x21')](function(_0x4b0963){if(_0x4b0963){return _0x4b0963?{'count':_0x297b97,'rows':_0x4b0963}:null;}})[_0xb677('0x21')](respondWithResult(_0x504d49,null))[_0xb677('0x40')](handleError(_0x504d49,null));};exports['getFields']=function(_0x4ac5a4,_0x1ccdd6,_0x3b777c){var _0x16a98a={};var _0x442431={};var _0x1d045f;var _0x454c3b;return db[_0xb677('0x28')]['findOne']({'where':{'id':_0x4ac5a4[_0xb677('0x41')]['id']}})['then'](handleEntityNotFound(_0x1ccdd6,null))[_0xb677('0x21')](function(_0x299221){if(_0x299221){_0x1d045f=_0x299221;_0x442431[_0xb677('0x2b')]=_[_0xb677('0x2c')](db['FreshsalesField'][_0xb677('0x42')]);_0x442431[_0xb677('0x2d')]=_[_0xb677('0x2c')](_0x4ac5a4[_0xb677('0x2d')]);_0x442431[_0xb677('0x35')]=_['intersection'](_0x442431[_0xb677('0x2b')],_0x442431[_0xb677('0x2d')]);_0x16a98a[_0xb677('0x2e')]=_[_0xb677('0x2f')](_0x442431[_0xb677('0x2b')],qs[_0xb677('0x30')](_0x4ac5a4['query'][_0xb677('0x30')]));_0x16a98a[_0xb677('0x2e')]=_0x16a98a[_0xb677('0x2e')][_0xb677('0x31')]?_0x16a98a[_0xb677('0x2e')]:_0x442431[_0xb677('0x2b')];_0x16a98a[_0xb677('0x4a')]=qs['sort'](_0x4ac5a4[_0xb677('0x2d')][_0xb677('0x34')]);_0x16a98a[_0xb677('0x38')]=qs[_0xb677('0x35')](_['pick'](_0x4ac5a4['query'],_0x442431[_0xb677('0x35')]));if(_0x4ac5a4['query'][_0xb677('0x37')]){_0x16a98a[_0xb677('0x38')]=_[_0xb677('0x39')](_0x16a98a[_0xb677('0x38')],{'$or':_['map'](_0x16a98a['attributes'],function(_0x1bc587){var _0x5655a2={};_0x5655a2[_0x1bc587]={'$like':'%'+_0x4ac5a4[_0xb677('0x2d')][_0xb677('0x37')]+'%'};return _0x5655a2;})});}_0x16a98a=_['merge']({},_0x16a98a,_0x4ac5a4[_0xb677('0x3b')]);return _0x1d045f[_0xb677('0x4c')](_0x16a98a);}})[_0xb677('0x21')](function(_0x57e312){if(_0x57e312){_0x454c3b=_0x57e312['length'];if(!_0x4ac5a4[_0xb677('0x2d')][_0xb677('0x32')](_0xb677('0x33'))){_0x16a98a[_0xb677('0x1a')]=qs[_0xb677('0x1a')](_0x4ac5a4[_0xb677('0x2d')][_0xb677('0x1a')]);_0x16a98a[_0xb677('0x1c')]=qs['offset'](_0x4ac5a4['query'][_0xb677('0x1c')]);}return _0x1d045f[_0xb677('0x4c')](_0x16a98a);}})[_0xb677('0x21')](function(_0x3970ec){if(_0x3970ec){return _0x3970ec?{'count':_0x454c3b,'rows':_0x3970ec}:null;}})[_0xb677('0x21')](respondWithResult(_0x1ccdd6,null))['catch'](handleError(_0x1ccdd6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 871ac23..31cd02d 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 _0x43a6=['bluebird','path','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','lodash','util','api','moment'];(function(_0x40c7f7,_0x42bc78){var _0x479755=function(_0x502b1e){while(--_0x502b1e){_0x40c7f7['push'](_0x40c7f7['shift']());}};_0x479755(++_0x42bc78);}(_0x43a6,0x132));var _0x643a=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x43a6[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x643a('0x0'));var util=require(_0x643a('0x1'));var logger=require('../../config/logger')(_0x643a('0x2'));var moment=require(_0x643a('0x3'));var BPromise=require(_0x643a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x643a('0x5'));var rimraf=require('rimraf');var config=require(_0x643a('0x6'));var attributes=require(_0x643a('0x7'));module['exports']=function(_0x23dbb6,_0x5d0801){return _0x23dbb6[_0x643a('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0x643a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5aa=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xc5aa,0x1e0));var _0xac5a=function(_0x20440d,_0x28466f){_0x20440d=_0x20440d-0x0;var _0x22b52d=_0xc5aa[_0x20440d];return _0x22b52d;};'use strict';var _=require('lodash');var util=require(_0xac5a('0x0'));var logger=require(_0xac5a('0x1'))(_0xac5a('0x2'));var moment=require(_0xac5a('0x3'));var BPromise=require(_0xac5a('0x4'));var rp=require(_0xac5a('0x5'));var fs=require('fs');var path=require(_0xac5a('0x6'));var rimraf=require(_0xac5a('0x7'));var config=require(_0xac5a('0x8'));var attributes=require(_0xac5a('0x9'));module['exports']=function(_0x5e7912,_0x3debdc){return _0x5e7912[_0xac5a('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0xac5a('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 4583b1d..4c70968 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 _0xebef=['message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x481e13,_0x1d5dee){var _0x5ae38b=function(_0x33bdfb){while(--_0x33bdfb){_0x481e13['push'](_0x481e13['shift']());}};_0x5ae38b(++_0x1d5dee);}(_0xebef,0xe9));var _0xfebe=function(_0xb7688b,_0x40d3f3){_0xb7688b=_0xb7688b-0x0;var _0x24d841=_0xebef[_0xb7688b];return _0x24d841;};'use strict';var _=require(_0xfebe('0x0'));var util=require('util');var moment=require(_0xfebe('0x1'));var BPromise=require('bluebird');var rs=require(_0xfebe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfebe('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfebe('0x4'))(_0xfebe('0x5'));var config=require(_0xfebe('0x6'));var jayson=require(_0xfebe('0x7'));var client=jayson[_0xfebe('0x8')][_0xfebe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6a56d6,_0x48dd1b,_0x27a6c2){return new BPromise(function(_0x356374,_0xb9eec8){return client[_0xfebe('0xa')](_0x6a56d6,_0x27a6c2)[_0xfebe('0xb')](function(_0x29b175){logger[_0xfebe('0xc')](_0xfebe('0xd'),_0x48dd1b,_0xfebe('0xe'));logger[_0xfebe('0xf')](_0xfebe('0x10'),_0x48dd1b,_0xfebe('0xe'),JSON[_0xfebe('0x11')](_0x29b175));if(_0x29b175[_0xfebe('0x12')]){if(_0x29b175[_0xfebe('0x12')][_0xfebe('0x13')]===0x1f4){logger['error'](_0xfebe('0xd'),_0x48dd1b,_0x29b175[_0xfebe('0x12')][_0xfebe('0x14')]);return _0xb9eec8(_0x29b175['error'][_0xfebe('0x14')]);}logger[_0xfebe('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x48dd1b,_0x29b175[_0xfebe('0x12')]['message']);return _0x356374(_0x29b175[_0xfebe('0x12')][_0xfebe('0x14')]);}else{logger['info'](_0xfebe('0xd'),_0x48dd1b,'request\x20sent');_0x356374(_0x29b175[_0xfebe('0x15')]['message']);}})[_0xfebe('0x16')](function(_0x4ca839){logger['error'](_0xfebe('0xd'),_0x48dd1b,_0x4ca839);_0xb9eec8(_0x4ca839);});});} \ No newline at end of file +var _0xec7a=['request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x3d8a41,_0x2b0fbe){var _0x28675e=function(_0x222859){while(--_0x222859){_0x3d8a41['push'](_0x3d8a41['shift']());}};_0x28675e(++_0x2b0fbe);}(_0xec7a,0x1cf));var _0xaec7=function(_0x343b56,_0x27ebbf){_0x343b56=_0x343b56-0x0;var _0x4bdc57=_0xec7a[_0x343b56];return _0x4bdc57;};'use strict';var _=require('lodash');var util=require(_0xaec7('0x0'));var moment=require(_0xaec7('0x1'));var BPromise=require(_0xaec7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaec7('0x3'));var db=require(_0xaec7('0x4'))['db'];var utils=require(_0xaec7('0x5'));var logger=require(_0xaec7('0x6'))(_0xaec7('0x7'));var config=require(_0xaec7('0x8'));var jayson=require(_0xaec7('0x9'));var client=jayson[_0xaec7('0xa')][_0xaec7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x386f2a,_0x56f072,_0x5601d3){return new BPromise(function(_0x28bb57,_0x380e67){return client['request'](_0x386f2a,_0x5601d3)[_0xaec7('0xc')](function(_0x546e16){logger[_0xaec7('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x56f072,'request\x20sent');logger[_0xaec7('0xe')](_0xaec7('0xf'),_0x56f072,'request\x20sent',JSON[_0xaec7('0x10')](_0x546e16));if(_0x546e16[_0xaec7('0x11')]){if(_0x546e16[_0xaec7('0x11')]['code']===0x1f4){logger[_0xaec7('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x56f072,_0x546e16[_0xaec7('0x11')]['message']);return _0x380e67(_0x546e16[_0xaec7('0x11')][_0xaec7('0x12')]);}logger[_0xaec7('0x11')](_0xaec7('0x13'),_0x56f072,_0x546e16[_0xaec7('0x11')][_0xaec7('0x12')]);return _0x28bb57(_0x546e16['error'][_0xaec7('0x12')]);}else{logger[_0xaec7('0xd')](_0xaec7('0x13'),_0x56f072,_0xaec7('0x14'));_0x28bb57(_0x546e16[_0xaec7('0x15')]['message']);}})[_0xaec7('0x16')](function(_0x552d1b){logger[_0xaec7('0x11')](_0xaec7('0x13'),_0x56f072,_0x552d1b);_0x380e67(_0x552d1b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 22a64a7..0ff242c 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 _0xb07f=['show','post','create','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','/:id'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xb07f,0x109));var _0xfb07=function(_0x505d7c,_0x20b160){_0x505d7c=_0x505d7c-0x0;var _0x566b61=_0xb07f[_0x505d7c];return _0x566b61;};'use strict';var multer=require(_0xfb07('0x0'));var util=require(_0xfb07('0x1'));var path=require(_0xfb07('0x2'));var timeout=require(_0xfb07('0x3'));var express=require(_0xfb07('0x4'));var router=express[_0xfb07('0x5')]();var fs_extra=require(_0xfb07('0x6'));var auth=require(_0xfb07('0x7'));var interaction=require(_0xfb07('0x8'));var config=require(_0xfb07('0x9'));var controller=require(_0xfb07('0xa'));router['get']('/',auth[_0xfb07('0xb')](),controller[_0xfb07('0xc')]);router[_0xfb07('0xd')](_0xfb07('0xe'),auth[_0xfb07('0xb')](),controller[_0xfb07('0xf')]);router[_0xfb07('0x10')]('/',auth[_0xfb07('0xb')](),controller[_0xfb07('0x11')]);router[_0xfb07('0x12')](_0xfb07('0xe'),auth[_0xfb07('0xb')](),controller['update']);router['delete']('/:id',auth[_0xfb07('0xb')](),controller[_0xfb07('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3098=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','/:id','update','delete','destroy'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0x3098,0x86));var _0x8309=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0x3098[_0x3e6b2f];return _0x323215;};'use strict';var multer=require(_0x8309('0x0'));var util=require(_0x8309('0x1'));var path=require(_0x8309('0x2'));var timeout=require(_0x8309('0x3'));var express=require('express');var router=express[_0x8309('0x4')]();var fs_extra=require(_0x8309('0x5'));var auth=require(_0x8309('0x6'));var interaction=require(_0x8309('0x7'));var config=require(_0x8309('0x8'));var controller=require(_0x8309('0x9'));router[_0x8309('0xa')]('/',auth[_0x8309('0xb')](),controller[_0x8309('0xc')]);router[_0x8309('0xa')]('/:id',auth[_0x8309('0xb')](),controller['show']);router[_0x8309('0xd')]('/',auth[_0x8309('0xb')](),controller['create']);router['put'](_0x8309('0xe'),auth[_0x8309('0xb')](),controller[_0x8309('0xf')]);router[_0x8309('0x10')](_0x8309('0xe'),auth['isAuthenticated'](),controller[_0x8309('0x11')]);module[_0x8309('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index aff3491..0aa41e2 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 _0xf86d=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0xf86d,0x6c));var _0xdf86=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0xf86d[_0x100e36];return _0x1df0c9;};'use strict';var Sequelize=require(_0xdf86('0x0'));module[_0xdf86('0x1')]={'type':{'type':Sequelize[_0xdf86('0x2')](_0xdf86('0x3'),_0xdf86('0x4'),'customVariable',_0xdf86('0x5'),_0xdf86('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdf86('0x7')]},'key':{'type':Sequelize[_0xdf86('0x7')]},'keyType':{'type':Sequelize[_0xdf86('0x2')](_0xdf86('0x3'),'variable',_0xdf86('0x8'))},'keyContent':{'type':Sequelize[_0xdf86('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdf86('0x7')]},'customField':{'type':Sequelize[_0xdf86('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdf86('0x7')]}}; \ No newline at end of file +var _0x91e2=['string','STRING','ENUM','BOOLEAN','sequelize','variable','customVariable'];(function(_0x4d6830,_0x54e1f5){var _0xaa7ea=function(_0x545a49){while(--_0x545a49){_0x4d6830['push'](_0x4d6830['shift']());}};_0xaa7ea(++_0x54e1f5);}(_0x91e2,0x1d2));var _0x291e=function(_0x2462c7,_0x51b09d){_0x2462c7=_0x2462c7-0x0;var _0x1afbf7=_0x91e2[_0x2462c7];return _0x1afbf7;};'use strict';var Sequelize=require(_0x291e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x291e('0x1'),_0x291e('0x2'),'keyValue','picklist'),'defaultValue':_0x291e('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x291e('0x4')]},'keyType':{'type':Sequelize[_0x291e('0x5')](_0x291e('0x3'),'variable',_0x291e('0x2'))},'keyContent':{'type':Sequelize[_0x291e('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x291e('0x4')]},'customField':{'type':Sequelize[_0x291e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x291e('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 6771892..1a0a1b0 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 _0x2fd6=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','FreshsalesField','rawAttributes','fieldName','key','model','map','query','keys'];(function(_0x52a1be,_0x49f576){var _0x598cff=function(_0x12fa8e){while(--_0x12fa8e){_0x52a1be['push'](_0x52a1be['shift']());}};_0x598cff(++_0x49f576);}(_0x2fd6,0xf7));var _0x62fd=function(_0x1e0097,_0x836d2b){_0x1e0097=_0x1e0097-0x0;var _0x4a3d65=_0x2fd6[_0x1e0097];return _0x4a3d65;};'use strict';var emlformat=require(_0x62fd('0x0'));var rimraf=require(_0x62fd('0x1'));var zipdir=require(_0x62fd('0x2'));var jsonpatch=require(_0x62fd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x62fd('0x4'));var Mustache=require(_0x62fd('0x5'));var util=require(_0x62fd('0x6'));var path=require(_0x62fd('0x7'));var sox=require(_0x62fd('0x8'));var csv=require(_0x62fd('0x9'));var ejs=require(_0x62fd('0xa'));var fs=require('fs');var fs_extra=require(_0x62fd('0xb'));var _=require(_0x62fd('0xc'));var squel=require(_0x62fd('0xd'));var crypto=require(_0x62fd('0xe'));var jsforce=require(_0x62fd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x62fd('0x9'));var querystring=require(_0x62fd('0x10'));var Papa=require(_0x62fd('0x11'));var Redis=require(_0x62fd('0x12'));var authService=require(_0x62fd('0x13'));var qs=require(_0x62fd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62fd('0x15'));var logger=require(_0x62fd('0x16'))(_0x62fd('0x17'));var utils=require(_0x62fd('0x18'));var config=require(_0x62fd('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b6df2,_0x1d8372){_0x1d8372=_0x1d8372||0xcc;return function(_0x302e15){if(_0x302e15){return _0x2b6df2[_0x62fd('0x1a')](_0x1d8372);}return _0x2b6df2[_0x62fd('0x1b')](_0x1d8372)[_0x62fd('0x1c')]();};}function respondWithResult(_0x8f9ac9,_0x3aff72){_0x3aff72=_0x3aff72||0xc8;return function(_0x4ecc3a){if(_0x4ecc3a){return _0x8f9ac9[_0x62fd('0x1b')](_0x3aff72)[_0x62fd('0x1d')](_0x4ecc3a);}};}function respondWithFilteredResult(_0x3f79c5,_0x29577f){return function(_0x2032bd){if(_0x2032bd){var _0x5e5797=typeof _0x29577f[_0x62fd('0x1e')]===_0x62fd('0x1f')&&typeof _0x29577f[_0x62fd('0x20')]==='undefined';var _0xea92f6=_0x2032bd['count'];var _0x40f302=_0x5e5797?0x0:_0x29577f[_0x62fd('0x1e')];var _0x15d189=_0x5e5797?_0x2032bd[_0x62fd('0x21')]:_0x29577f['offset']+_0x29577f[_0x62fd('0x20')];var _0x170a2e;if(_0x15d189>=_0xea92f6){_0x15d189=_0xea92f6;_0x170a2e=0xc8;}else{_0x170a2e=0xce;}_0x3f79c5[_0x62fd('0x1b')](_0x170a2e);return _0x3f79c5[_0x62fd('0x22')](_0x62fd('0x23'),_0x40f302+'-'+_0x15d189+'/'+_0xea92f6)['json'](_0x2032bd);}return null;};}function patchUpdates(_0x400621){return function(_0x54ce77){try{jsonpatch[_0x62fd('0x24')](_0x54ce77,_0x400621,!![]);}catch(_0x257f67){return BPromise[_0x62fd('0x25')](_0x257f67);}return _0x54ce77[_0x62fd('0x26')]();};}function saveUpdates(_0x2f89f5,_0x3e16f9){return function(_0x17f859){if(_0x17f859){return _0x17f859[_0x62fd('0x27')](_0x2f89f5)[_0x62fd('0x28')](function(_0x1fccb3){return _0x1fccb3;});}return null;};}function removeEntity(_0x38eafb,_0x255bf7){return function(_0xc7956e){if(_0xc7956e){return _0xc7956e[_0x62fd('0x29')]()[_0x62fd('0x28')](function(){_0x38eafb[_0x62fd('0x1b')](0xcc)[_0x62fd('0x1c')]();});}};}function handleEntityNotFound(_0x2eba2c,_0x22e703){return function(_0x2149dc){if(!_0x2149dc){_0x2eba2c['sendStatus'](0x194);}return _0x2149dc;};}function handleError(_0xbf91df,_0x1f59ae){_0x1f59ae=_0x1f59ae||0x1f4;return function(_0x5a8849){logger[_0x62fd('0x2a')](_0x5a8849['stack']);if(_0x5a8849[_0x62fd('0x2b')]){delete _0x5a8849[_0x62fd('0x2b')];}_0xbf91df[_0x62fd('0x1b')](_0x1f59ae)[_0x62fd('0x2c')](_0x5a8849);};}exports['index']=function(_0x48eb7e,_0x30e219){var _0x3a97da={},_0xaa93c5={},_0x59eea7={'count':0x0,'rows':[]};var _0x5ae0a2=_['map'](db[_0x62fd('0x2d')][_0x62fd('0x2e')],function(_0x3e722b){return{'name':_0x3e722b[_0x62fd('0x2f')],'type':_0x3e722b['type'][_0x62fd('0x30')]};});_0xaa93c5[_0x62fd('0x31')]=_[_0x62fd('0x32')](_0x5ae0a2,_0x62fd('0x2b'));_0xaa93c5[_0x62fd('0x33')]=_[_0x62fd('0x34')](_0x48eb7e[_0x62fd('0x33')]);_0xaa93c5[_0x62fd('0x35')]=_[_0x62fd('0x36')](_0xaa93c5[_0x62fd('0x31')],_0xaa93c5[_0x62fd('0x33')]);_0x3a97da[_0x62fd('0x37')]=_[_0x62fd('0x36')](_0xaa93c5[_0x62fd('0x31')],qs[_0x62fd('0x38')](_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x38')]));_0x3a97da[_0x62fd('0x37')]=_0x3a97da[_0x62fd('0x37')][_0x62fd('0x39')]?_0x3a97da['attributes']:_0xaa93c5[_0x62fd('0x31')];if(!_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x3a')](_0x62fd('0x3b'))){_0x3a97da[_0x62fd('0x20')]=qs[_0x62fd('0x20')](_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x20')]);_0x3a97da[_0x62fd('0x1e')]=qs[_0x62fd('0x1e')](_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x1e')]);}_0x3a97da[_0x62fd('0x3c')]=qs[_0x62fd('0x3d')](_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x3d')]);_0x3a97da[_0x62fd('0x3e')]=qs[_0x62fd('0x35')](_['pick'](_0x48eb7e['query'],_0xaa93c5[_0x62fd('0x35')]),_0x5ae0a2);if(_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x3f')]){_0x3a97da[_0x62fd('0x3e')]=_['merge'](_0x3a97da['where'],{'$or':_[_0x62fd('0x32')](_0x5ae0a2,function(_0x4153c2){if(_0x4153c2[_0x62fd('0x40')]!=='VIRTUAL'){var _0x50f488={};_0x50f488[_0x4153c2[_0x62fd('0x2b')]]={'$like':'%'+_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x3f')]+'%'};return _0x50f488;}})});}_0x3a97da=_[_0x62fd('0x41')]({},_0x3a97da,_0x48eb7e[_0x62fd('0x42')]);var _0x59f8a8={'where':_0x3a97da[_0x62fd('0x3e')]};return db[_0x62fd('0x2d')][_0x62fd('0x21')](_0x59f8a8)[_0x62fd('0x28')](function(_0x48f8c8){_0x59eea7[_0x62fd('0x21')]=_0x48f8c8;if(_0x48eb7e['query']['includeAll']){_0x3a97da['include']=[{'all':!![]}];}return db[_0x62fd('0x2d')]['findAll'](_0x3a97da);})[_0x62fd('0x28')](function(_0x49f208){_0x59eea7[_0x62fd('0x43')]=_0x49f208;return _0x59eea7;})['then'](respondWithFilteredResult(_0x30e219,_0x3a97da))[_0x62fd('0x44')](handleError(_0x30e219,null));};exports[_0x62fd('0x45')]=function(_0xf6c00b,_0x1ffe19){var _0x563b16={'raw':!![],'where':{'id':_0xf6c00b[_0x62fd('0x46')]['id']}},_0x212549={};_0x212549[_0x62fd('0x31')]=_['keys'](db[_0x62fd('0x2d')]['rawAttributes']);_0x212549[_0x62fd('0x33')]=_['keys'](_0xf6c00b['query']);_0x212549['filters']=_[_0x62fd('0x36')](_0x212549[_0x62fd('0x31')],_0x212549[_0x62fd('0x33')]);_0x563b16[_0x62fd('0x37')]=_['intersection'](_0x212549[_0x62fd('0x31')],qs[_0x62fd('0x38')](_0xf6c00b[_0x62fd('0x33')][_0x62fd('0x38')]));_0x563b16[_0x62fd('0x37')]=_0x563b16[_0x62fd('0x37')][_0x62fd('0x39')]?_0x563b16[_0x62fd('0x37')]:_0x212549['model'];if(_0xf6c00b[_0x62fd('0x33')]['includeAll']){_0x563b16[_0x62fd('0x47')]=[{'all':!![]}];}_0x563b16=_[_0x62fd('0x41')]({},_0x563b16,_0xf6c00b[_0x62fd('0x42')]);return db['FreshsalesField'][_0x62fd('0x48')](_0x563b16)[_0x62fd('0x28')](handleEntityNotFound(_0x1ffe19,null))['then'](respondWithResult(_0x1ffe19,null))[_0x62fd('0x44')](handleError(_0x1ffe19,null));};exports[_0x62fd('0x49')]=function(_0x712a98,_0x91660b){return db[_0x62fd('0x2d')][_0x62fd('0x49')](_0x712a98[_0x62fd('0x4a')],{})[_0x62fd('0x28')](respondWithResult(_0x91660b,0xc9))[_0x62fd('0x44')](handleError(_0x91660b,null));};exports[_0x62fd('0x27')]=function(_0x5e9f99,_0x160e82){if(_0x5e9f99[_0x62fd('0x4a')]['id']){delete _0x5e9f99[_0x62fd('0x4a')]['id'];}return db[_0x62fd('0x2d')][_0x62fd('0x48')]({'where':{'id':_0x5e9f99[_0x62fd('0x46')]['id']}})['then'](handleEntityNotFound(_0x160e82,null))[_0x62fd('0x28')](saveUpdates(_0x5e9f99[_0x62fd('0x4a')],null))['then'](respondWithResult(_0x160e82,null))[_0x62fd('0x44')](handleError(_0x160e82,null));};exports['destroy']=function(_0x470925,_0x187289){return db[_0x62fd('0x2d')][_0x62fd('0x48')]({'where':{'id':_0x470925[_0x62fd('0x46')]['id']}})[_0x62fd('0x28')](handleEntityNotFound(_0x187289,null))[_0x62fd('0x28')](removeEntity(_0x187289,null))[_0x62fd('0x44')](handleError(_0x187289,null));}; \ No newline at end of file +var _0x38c9=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','merge','options','includeAll','include','rows','catch','show','params','create','body','find','eml-format','rimraf'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0x38c9,0x122));var _0x938c=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x38c9[_0x2f1114];return _0x2fe856;};'use strict';var emlformat=require(_0x938c('0x0'));var rimraf=require(_0x938c('0x1'));var zipdir=require(_0x938c('0x2'));var jsonpatch=require(_0x938c('0x3'));var rp=require(_0x938c('0x4'));var moment=require('moment');var BPromise=require(_0x938c('0x5'));var Mustache=require(_0x938c('0x6'));var util=require(_0x938c('0x7'));var path=require(_0x938c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x938c('0x9'));var fs=require('fs');var fs_extra=require(_0x938c('0xa'));var _=require(_0x938c('0xb'));var squel=require('squel');var crypto=require(_0x938c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x938c('0xd'));var toCsv=require(_0x938c('0xe'));var querystring=require(_0x938c('0xf'));var Papa=require(_0x938c('0x10'));var Redis=require(_0x938c('0x11'));var authService=require(_0x938c('0x12'));var qs=require(_0x938c('0x13'));var as=require(_0x938c('0x14'));var hardwareService=require(_0x938c('0x15'));var logger=require(_0x938c('0x16'))(_0x938c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x938c('0x18'));var db=require(_0x938c('0x19'))['db'];function respondWithStatusCode(_0x476906,_0x269aff){_0x269aff=_0x269aff||0xcc;return function(_0x14c517){if(_0x14c517){return _0x476906['sendStatus'](_0x269aff);}return _0x476906['status'](_0x269aff)[_0x938c('0x1a')]();};}function respondWithResult(_0x27d3ff,_0x2beab2){_0x2beab2=_0x2beab2||0xc8;return function(_0x468d2c){if(_0x468d2c){return _0x27d3ff['status'](_0x2beab2)[_0x938c('0x1b')](_0x468d2c);}};}function respondWithFilteredResult(_0x3cef52,_0x22ff23){return function(_0x1fbb34){if(_0x1fbb34){var _0x38666c=typeof _0x22ff23['offset']===_0x938c('0x1c')&&typeof _0x22ff23[_0x938c('0x1d')]===_0x938c('0x1c');var _0x560872=_0x1fbb34['count'];var _0x548905=_0x38666c?0x0:_0x22ff23[_0x938c('0x1e')];var _0x468362=_0x38666c?_0x1fbb34[_0x938c('0x1f')]:_0x22ff23[_0x938c('0x1e')]+_0x22ff23['limit'];var _0x514d21;if(_0x468362>=_0x560872){_0x468362=_0x560872;_0x514d21=0xc8;}else{_0x514d21=0xce;}_0x3cef52[_0x938c('0x20')](_0x514d21);return _0x3cef52[_0x938c('0x21')](_0x938c('0x22'),_0x548905+'-'+_0x468362+'/'+_0x560872)[_0x938c('0x1b')](_0x1fbb34);}return null;};}function patchUpdates(_0x5272ac){return function(_0x460e80){try{jsonpatch[_0x938c('0x23')](_0x460e80,_0x5272ac,!![]);}catch(_0x260b29){return BPromise['reject'](_0x260b29);}return _0x460e80[_0x938c('0x24')]();};}function saveUpdates(_0x2202ba,_0x138365){return function(_0x52c1da){if(_0x52c1da){return _0x52c1da[_0x938c('0x25')](_0x2202ba)[_0x938c('0x26')](function(_0x441b61){return _0x441b61;});}return null;};}function removeEntity(_0x4592e0,_0x3080f0){return function(_0x27d2a8){if(_0x27d2a8){return _0x27d2a8[_0x938c('0x27')]()['then'](function(){_0x4592e0[_0x938c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x119ddc,_0x227736){return function(_0x12e002){if(!_0x12e002){_0x119ddc[_0x938c('0x28')](0x194);}return _0x12e002;};}function handleError(_0x4c5377,_0x338ab4){_0x338ab4=_0x338ab4||0x1f4;return function(_0x36549d){logger['error'](_0x36549d['stack']);if(_0x36549d[_0x938c('0x29')]){delete _0x36549d[_0x938c('0x29')];}_0x4c5377[_0x938c('0x20')](_0x338ab4)[_0x938c('0x2a')](_0x36549d);};}exports[_0x938c('0x2b')]=function(_0x128462,_0x20cf4e){var _0x2ab87c={},_0x39d0fe={},_0x6e4e6b={'count':0x0,'rows':[]};var _0x5f6f30=_[_0x938c('0x2c')](db[_0x938c('0x2d')][_0x938c('0x2e')],function(_0x1b119c){return{'name':_0x1b119c[_0x938c('0x2f')],'type':_0x1b119c[_0x938c('0x30')][_0x938c('0x31')]};});_0x39d0fe[_0x938c('0x32')]=_[_0x938c('0x2c')](_0x5f6f30,_0x938c('0x29'));_0x39d0fe[_0x938c('0x33')]=_[_0x938c('0x34')](_0x128462['query']);_0x39d0fe['filters']=_['intersection'](_0x39d0fe[_0x938c('0x32')],_0x39d0fe[_0x938c('0x33')]);_0x2ab87c[_0x938c('0x35')]=_[_0x938c('0x36')](_0x39d0fe[_0x938c('0x32')],qs[_0x938c('0x37')](_0x128462['query'][_0x938c('0x37')]));_0x2ab87c['attributes']=_0x2ab87c[_0x938c('0x35')][_0x938c('0x38')]?_0x2ab87c[_0x938c('0x35')]:_0x39d0fe[_0x938c('0x32')];if(!_0x128462[_0x938c('0x33')]['hasOwnProperty'](_0x938c('0x39'))){_0x2ab87c[_0x938c('0x1d')]=qs[_0x938c('0x1d')](_0x128462[_0x938c('0x33')][_0x938c('0x1d')]);_0x2ab87c[_0x938c('0x1e')]=qs[_0x938c('0x1e')](_0x128462[_0x938c('0x33')][_0x938c('0x1e')]);}_0x2ab87c['order']=qs[_0x938c('0x3a')](_0x128462['query'][_0x938c('0x3a')]);_0x2ab87c[_0x938c('0x3b')]=qs[_0x938c('0x3c')](_[_0x938c('0x3d')](_0x128462[_0x938c('0x33')],_0x39d0fe['filters']),_0x5f6f30);if(_0x128462[_0x938c('0x33')]['filter']){_0x2ab87c[_0x938c('0x3b')]=_['merge'](_0x2ab87c[_0x938c('0x3b')],{'$or':_['map'](_0x5f6f30,function(_0x42feb8){if(_0x42feb8[_0x938c('0x30')]!=='VIRTUAL'){var _0x1e200e={};_0x1e200e[_0x42feb8[_0x938c('0x29')]]={'$like':'%'+_0x128462[_0x938c('0x33')]['filter']+'%'};return _0x1e200e;}})});}_0x2ab87c=_[_0x938c('0x3e')]({},_0x2ab87c,_0x128462[_0x938c('0x3f')]);var _0x135110={'where':_0x2ab87c['where']};return db[_0x938c('0x2d')][_0x938c('0x1f')](_0x135110)[_0x938c('0x26')](function(_0x4792e3){_0x6e4e6b['count']=_0x4792e3;if(_0x128462[_0x938c('0x33')][_0x938c('0x40')]){_0x2ab87c[_0x938c('0x41')]=[{'all':!![]}];}return db[_0x938c('0x2d')]['findAll'](_0x2ab87c);})['then'](function(_0x352bc1){_0x6e4e6b[_0x938c('0x42')]=_0x352bc1;return _0x6e4e6b;})[_0x938c('0x26')](respondWithFilteredResult(_0x20cf4e,_0x2ab87c))[_0x938c('0x43')](handleError(_0x20cf4e,null));};exports[_0x938c('0x44')]=function(_0x5fbd64,_0x4d6fd2){var _0x515a15={'raw':!![],'where':{'id':_0x5fbd64[_0x938c('0x45')]['id']}},_0x1b5016={};_0x1b5016['model']=_[_0x938c('0x34')](db['FreshsalesField'][_0x938c('0x2e')]);_0x1b5016[_0x938c('0x33')]=_[_0x938c('0x34')](_0x5fbd64[_0x938c('0x33')]);_0x1b5016['filters']=_[_0x938c('0x36')](_0x1b5016[_0x938c('0x32')],_0x1b5016[_0x938c('0x33')]);_0x515a15[_0x938c('0x35')]=_['intersection'](_0x1b5016['model'],qs[_0x938c('0x37')](_0x5fbd64[_0x938c('0x33')][_0x938c('0x37')]));_0x515a15[_0x938c('0x35')]=_0x515a15[_0x938c('0x35')][_0x938c('0x38')]?_0x515a15[_0x938c('0x35')]:_0x1b5016[_0x938c('0x32')];if(_0x5fbd64[_0x938c('0x33')][_0x938c('0x40')]){_0x515a15['include']=[{'all':!![]}];}_0x515a15=_['merge']({},_0x515a15,_0x5fbd64[_0x938c('0x3f')]);return db[_0x938c('0x2d')]['find'](_0x515a15)['then'](handleEntityNotFound(_0x4d6fd2,null))[_0x938c('0x26')](respondWithResult(_0x4d6fd2,null))[_0x938c('0x43')](handleError(_0x4d6fd2,null));};exports[_0x938c('0x46')]=function(_0x2cc951,_0x37cfb5){return db[_0x938c('0x2d')][_0x938c('0x46')](_0x2cc951[_0x938c('0x47')],{})[_0x938c('0x26')](respondWithResult(_0x37cfb5,0xc9))['catch'](handleError(_0x37cfb5,null));};exports[_0x938c('0x25')]=function(_0xd227a3,_0x15e5ca){if(_0xd227a3['body']['id']){delete _0xd227a3['body']['id'];}return db[_0x938c('0x2d')]['find']({'where':{'id':_0xd227a3[_0x938c('0x45')]['id']}})['then'](handleEntityNotFound(_0x15e5ca,null))[_0x938c('0x26')](saveUpdates(_0xd227a3[_0x938c('0x47')],null))[_0x938c('0x26')](respondWithResult(_0x15e5ca,null))[_0x938c('0x43')](handleError(_0x15e5ca,null));};exports[_0x938c('0x27')]=function(_0x519c5d,_0x277263){return db[_0x938c('0x2d')][_0x938c('0x48')]({'where':{'id':_0x519c5d[_0x938c('0x45')]['id']}})[_0x938c('0x26')](handleEntityNotFound(_0x277263,null))[_0x938c('0x26')](removeEntity(_0x277263,null))['catch'](handleError(_0x277263,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index ae76051..e36d592 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 _0x88c3=['idField','FieldId','lodash','../../config/logger','bluebird','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x35507b,_0x247cbe){var _0x4ff363=function(_0x52e8b5){while(--_0x52e8b5){_0x35507b['push'](_0x35507b['shift']());}};_0x4ff363(++_0x247cbe);}(_0x88c3,0x1ee));var _0x388c=function(_0x3aff62,_0x1c55cf){_0x3aff62=_0x3aff62-0x0;var _0x135909=_0x88c3[_0x3aff62];return _0x135909;};'use strict';var _=require(_0x388c('0x0'));var util=require('util');var logger=require(_0x388c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x388c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x388c('0x3'));var config=require(_0x388c('0x4'));var attributes=require(_0x388c('0x5'));module[_0x388c('0x6')]=function(_0x28ed4d,_0x23199c){return _0x28ed4d['define'](_0x388c('0x7'),attributes,{'tableName':_0x388c('0x8'),'paranoid':![],'indexes':[{'name':_0x388c('0x9'),'fields':[_0x388c('0xa'),_0x388c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7497=['../../config/logger','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util'];(function(_0x38725d,_0x3f5001){var _0x51a6c8=function(_0x5bad4e){while(--_0x5bad4e){_0x38725d['push'](_0x38725d['shift']());}};_0x51a6c8(++_0x3f5001);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var logger=require(_0x7749('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7749('0x3'));var fs=require('fs');var path=require(_0x7749('0x4'));var rimraf=require('rimraf');var config=require(_0x7749('0x5'));var attributes=require(_0x7749('0x6'));module[_0x7749('0x7')]=function(_0x455d05,_0x289268){return _0x455d05[_0x7749('0x8')](_0x7749('0x9'),attributes,{'tableName':_0x7749('0xa'),'paranoid':![],'indexes':[{'name':_0x7749('0xb'),'fields':[_0x7749('0xc'),_0x7749('0xd')],'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 9ff1a84..f1bd76d 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 _0x9536=['request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesField,\x20%s,\x20%s'];(function(_0x281a04,_0x21f405){var _0x548f71=function(_0x9f8e7c){while(--_0x9f8e7c){_0x281a04['push'](_0x281a04['shift']());}};_0x548f71(++_0x21f405);}(_0x9536,0x179));var _0x6953=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0x9536[_0x212bf5];return _0xfcad21;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4dd4b2,_0x3387aa){var _0x11fd69=function(_0xf5cde){while(--_0xf5cde){_0x4dd4b2['push'](_0x4dd4b2['shift']());}};_0x11fd69(++_0x3387aa);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'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')]('FreshsalesField,\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/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c96ff3c..43e7cfe 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(_0x3d8b9a,_0x50d768){var _0x4ab686=function(_0x4369c2){while(--_0x4369c2){_0x3d8b9a['push'](_0x3d8b9a['shift']());}};_0x4ab686(++_0x50d768);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0xb96537,_0x1ba0df){var _0x38f1b4=function(_0xf54922){while(--_0xf54922){_0xb96537['push'](_0xb96537['shift']());}};_0x38f1b4(++_0x1ba0df);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 5d76ec3..b3c6fb3 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 _0xdf55=['exports','STRING','ENUM','integrationTab','newTab','sequelize'];(function(_0x10f2f8,_0x4ec90c){var _0x75ddf=function(_0x333acc){while(--_0x333acc){_0x10f2f8['push'](_0x10f2f8['shift']());}};_0x75ddf(++_0x4ec90c);}(_0xdf55,0x83));var _0x5df5=function(_0x34190e,_0x50ecc7){_0x34190e=_0x34190e-0x0;var _0x41a4e6=_0xdf55[_0x34190e];return _0x41a4e6;};'use strict';var Sequelize=require(_0x5df5('0x0'));module[_0x5df5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5df5('0x2')]},'username':{'type':Sequelize[_0x5df5('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x5df5('0x2')]},'password':{'type':Sequelize[_0x5df5('0x2')]},'clientId':{'type':Sequelize[_0x5df5('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x5df5('0x2')]},'serverUrl':{'type':Sequelize[_0x5df5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5df5('0x3')](_0x5df5('0x4'),_0x5df5('0x5')),'defaultValue':_0x5df5('0x4')}}; \ No newline at end of file +var _0x1967=['STRING','username','ENUM','integrationTab','newTab','exports'];(function(_0x47bab5,_0x67fdf3){var _0x47be91=function(_0x268dc1){while(--_0x268dc1){_0x47bab5['push'](_0x47bab5['shift']());}};_0x47be91(++_0x67fdf3);}(_0x1967,0x173));var _0x7196=function(_0x1111b5,_0x19d2bb){_0x1111b5=_0x1111b5-0x0;var _0x13e790=_0x1967[_0x1111b5];return _0x13e790;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'name':{'type':Sequelize[_0x7196('0x1')]},'description':{'type':Sequelize[_0x7196('0x1')]},'username':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x2')},'remoteUri':{'type':Sequelize[_0x7196('0x1')]},'password':{'type':Sequelize[_0x7196('0x1')]},'clientId':{'type':Sequelize[_0x7196('0x1')]},'clientSecret':{'type':Sequelize[_0x7196('0x1')]},'securityToken':{'type':Sequelize[_0x7196('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7196('0x3')](_0x7196('0x4'),_0x7196('0x5')),'defaultValue':_0x7196('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 82a0c9d..3366e40 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 _0xd4c9=['clientId','securityToken','slice','substring','lastIndexOf','clientSecret','login','username','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','Subjects','channel','SalesforceField','getFields','Task','remoteUri'];(function(_0x1b9213,_0x4a939f){var _0x5eae1e=function(_0x17566d){while(--_0x17566d){_0x1b9213['push'](_0x1b9213['shift']());}};_0x5eae1e(++_0x4a939f);}(_0xd4c9,0x190));var _0x9d4c=function(_0x468a77,_0x1382be){_0x468a77=_0x468a77-0x0;var _0x2d1c33=_0xd4c9[_0x468a77];return _0x2d1c33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d4c('0x0'));var zipdir=require(_0x9d4c('0x1'));var jsonpatch=require(_0x9d4c('0x2'));var rp=require(_0x9d4c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9d4c('0x4'));var util=require(_0x9d4c('0x5'));var path=require(_0x9d4c('0x6'));var sox=require(_0x9d4c('0x7'));var csv=require(_0x9d4c('0x8'));var ejs=require(_0x9d4c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d4c('0xa'));var squel=require(_0x9d4c('0xb'));var crypto=require(_0x9d4c('0xc'));var jsforce=require(_0x9d4c('0xd'));var deskjs=require(_0x9d4c('0xe'));var toCsv=require(_0x9d4c('0x8'));var querystring=require(_0x9d4c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9d4c('0x10'));var qs=require(_0x9d4c('0x11'));var as=require(_0x9d4c('0x12'));var hardwareService=require(_0x9d4c('0x13'));var logger=require(_0x9d4c('0x14'))(_0x9d4c('0x15'));var utils=require(_0x9d4c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9d4c('0x17'))['db'];var integrations=require(_0x9d4c('0x18'));function respondWithStatusCode(_0x378c82,_0x1078aa){_0x1078aa=_0x1078aa||0xcc;return function(_0x408cb3){if(_0x408cb3){return _0x378c82['sendStatus'](_0x1078aa);}return _0x378c82[_0x9d4c('0x19')](_0x1078aa)[_0x9d4c('0x1a')]();};}function respondWithResult(_0x34703d,_0x3364f5){_0x3364f5=_0x3364f5||0xc8;return function(_0x5e9448){if(_0x5e9448){return _0x34703d['status'](_0x3364f5)[_0x9d4c('0x1b')](_0x5e9448);}};}function respondWithFilteredResult(_0x5341e3,_0x218c92){return function(_0x43abc1){if(_0x43abc1){var _0x7cb1c4=typeof _0x218c92[_0x9d4c('0x1c')]==='undefined'&&typeof _0x218c92[_0x9d4c('0x1d')]==='undefined';var _0x169e95=_0x43abc1[_0x9d4c('0x1e')];var _0x2c2699=_0x7cb1c4?0x0:_0x218c92['offset'];var _0x4d6686=_0x7cb1c4?_0x43abc1[_0x9d4c('0x1e')]:_0x218c92[_0x9d4c('0x1c')]+_0x218c92[_0x9d4c('0x1d')];var _0x41a567;if(_0x4d6686>=_0x169e95){_0x4d6686=_0x169e95;_0x41a567=0xc8;}else{_0x41a567=0xce;}_0x5341e3[_0x9d4c('0x19')](_0x41a567);return _0x5341e3['set'](_0x9d4c('0x1f'),_0x2c2699+'-'+_0x4d6686+'/'+_0x169e95)['json'](_0x43abc1);}return null;};}function patchUpdates(_0x3e0dcd){return function(_0x1c477f){try{jsonpatch[_0x9d4c('0x20')](_0x1c477f,_0x3e0dcd,!![]);}catch(_0x5b7f00){return BPromise[_0x9d4c('0x21')](_0x5b7f00);}return _0x1c477f['save']();};}function saveUpdates(_0x3be1ea,_0x596f46){return function(_0x44bc5e){if(_0x44bc5e){return _0x44bc5e[_0x9d4c('0x22')](_0x3be1ea)[_0x9d4c('0x23')](function(_0x16d092){return _0x16d092;});}return null;};}function removeEntity(_0x5009df,_0x3f9487){return function(_0x33205a){if(_0x33205a){return _0x33205a[_0x9d4c('0x24')]()[_0x9d4c('0x23')](function(){_0x5009df[_0x9d4c('0x19')](0xcc)[_0x9d4c('0x1a')]();});}};}function handleEntityNotFound(_0x45bf0a,_0x49444b){return function(_0x224d06){if(!_0x224d06){_0x45bf0a[_0x9d4c('0x25')](0x194);}return _0x224d06;};}function handleError(_0x30ce56,_0x1c71b8){_0x1c71b8=_0x1c71b8||0x1f4;return function(_0x5a0ccc){logger['error'](_0x5a0ccc[_0x9d4c('0x26')]);if(_0x5a0ccc[_0x9d4c('0x27')]){delete _0x5a0ccc[_0x9d4c('0x27')];}_0x30ce56[_0x9d4c('0x19')](_0x1c71b8)[_0x9d4c('0x28')](_0x5a0ccc);};}exports[_0x9d4c('0x29')]=function(_0x106f89,_0x3086ef){var _0x12d2b2={},_0x5e5be5={},_0x1b1081={'count':0x0,'rows':[]};var _0x1fcc5a=_['map'](db[_0x9d4c('0x2a')][_0x9d4c('0x2b')],function(_0x47fb69){return{'name':_0x47fb69[_0x9d4c('0x2c')],'type':_0x47fb69['type'][_0x9d4c('0x2d')]};});_0x5e5be5[_0x9d4c('0x2e')]=_[_0x9d4c('0x2f')](_0x1fcc5a,_0x9d4c('0x27'));_0x5e5be5[_0x9d4c('0x30')]=_[_0x9d4c('0x31')](_0x106f89[_0x9d4c('0x30')]);_0x5e5be5[_0x9d4c('0x32')]=_[_0x9d4c('0x33')](_0x5e5be5[_0x9d4c('0x2e')],_0x5e5be5['query']);_0x12d2b2[_0x9d4c('0x34')]=_[_0x9d4c('0x33')](_0x5e5be5[_0x9d4c('0x2e')],qs[_0x9d4c('0x35')](_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x35')]));_0x12d2b2[_0x9d4c('0x34')]=_0x12d2b2['attributes']['length']?_0x12d2b2[_0x9d4c('0x34')]:_0x5e5be5[_0x9d4c('0x2e')];if(!_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x36')](_0x9d4c('0x37'))){_0x12d2b2['limit']=qs[_0x9d4c('0x1d')](_0x106f89[_0x9d4c('0x30')]['limit']);_0x12d2b2[_0x9d4c('0x1c')]=qs['offset'](_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x1c')]);}_0x12d2b2[_0x9d4c('0x38')]=qs[_0x9d4c('0x39')](_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x39')]);_0x12d2b2[_0x9d4c('0x3a')]=qs[_0x9d4c('0x32')](_['pick'](_0x106f89[_0x9d4c('0x30')],_0x5e5be5[_0x9d4c('0x32')]),_0x1fcc5a);if(_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x3b')]){_0x12d2b2[_0x9d4c('0x3a')]=_[_0x9d4c('0x3c')](_0x12d2b2[_0x9d4c('0x3a')],{'$or':_['map'](_0x1fcc5a,function(_0x267607){if(_0x267607[_0x9d4c('0x3d')]!==_0x9d4c('0x3e')){var _0x417beb={};_0x417beb[_0x267607[_0x9d4c('0x27')]]={'$like':'%'+_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x3b')]+'%'};return _0x417beb;}})});}_0x12d2b2=_[_0x9d4c('0x3c')]({},_0x12d2b2,_0x106f89[_0x9d4c('0x3f')]);var _0x49f7a5={'where':_0x12d2b2[_0x9d4c('0x3a')]};return db['SalesforceAccount']['count'](_0x49f7a5)[_0x9d4c('0x23')](function(_0x23f516){_0x1b1081[_0x9d4c('0x1e')]=_0x23f516;if(_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x40')]){_0x12d2b2[_0x9d4c('0x41')]=[{'all':!![]}];}return db[_0x9d4c('0x2a')]['findAll'](_0x12d2b2);})[_0x9d4c('0x23')](function(_0x57e7b2){_0x1b1081[_0x9d4c('0x42')]=_0x57e7b2;return _0x1b1081;})['then'](respondWithFilteredResult(_0x3086ef,_0x12d2b2))[_0x9d4c('0x43')](handleError(_0x3086ef,null));};exports[_0x9d4c('0x44')]=function(_0x592da7,_0x387ed4){var _0x466987={'raw':![],'where':{'id':_0x592da7[_0x9d4c('0x45')]['id']}},_0x4fd688={};_0x4fd688[_0x9d4c('0x2e')]=_[_0x9d4c('0x31')](db[_0x9d4c('0x2a')][_0x9d4c('0x2b')]);_0x4fd688[_0x9d4c('0x30')]=_[_0x9d4c('0x31')](_0x592da7['query']);_0x4fd688[_0x9d4c('0x32')]=_[_0x9d4c('0x33')](_0x4fd688[_0x9d4c('0x2e')],_0x4fd688[_0x9d4c('0x30')]);_0x466987[_0x9d4c('0x34')]=_[_0x9d4c('0x33')](_0x4fd688[_0x9d4c('0x2e')],qs['fields'](_0x592da7[_0x9d4c('0x30')][_0x9d4c('0x35')]));_0x466987[_0x9d4c('0x34')]=_0x466987['attributes'][_0x9d4c('0x46')]?_0x466987[_0x9d4c('0x34')]:_0x4fd688['model'];if(_0x592da7['query'][_0x9d4c('0x40')]){_0x466987[_0x9d4c('0x41')]=[{'all':!![]}];}_0x466987=_['merge']({},_0x466987,_0x592da7['options']);return db['SalesforceAccount'][_0x9d4c('0x47')](_0x466987)[_0x9d4c('0x23')](handleEntityNotFound(_0x387ed4,null))[_0x9d4c('0x23')](respondWithResult(_0x387ed4,null))['catch'](handleError(_0x387ed4,null));};exports['create']=function(_0x129eb7,_0x1b5918){return db[_0x9d4c('0x2a')][_0x9d4c('0x48')](_0x129eb7[_0x9d4c('0x49')],{})[_0x9d4c('0x23')](respondWithResult(_0x1b5918,0xc9))['catch'](handleError(_0x1b5918,null));};exports[_0x9d4c('0x22')]=function(_0x3a617a,_0x2cbc35){if(_0x3a617a[_0x9d4c('0x49')]['id']){delete _0x3a617a[_0x9d4c('0x49')]['id'];}return db['SalesforceAccount'][_0x9d4c('0x47')]({'where':{'id':_0x3a617a[_0x9d4c('0x45')]['id']}})[_0x9d4c('0x23')](handleEntityNotFound(_0x2cbc35,null))[_0x9d4c('0x23')](saveUpdates(_0x3a617a[_0x9d4c('0x49')],null))[_0x9d4c('0x23')](respondWithResult(_0x2cbc35,null))['catch'](handleError(_0x2cbc35,null));};exports[_0x9d4c('0x24')]=function(_0x30871e,_0x140da5){return db[_0x9d4c('0x2a')]['find']({'where':{'id':_0x30871e[_0x9d4c('0x45')]['id']}})[_0x9d4c('0x23')](handleEntityNotFound(_0x140da5,null))['then'](removeEntity(_0x140da5,null))[_0x9d4c('0x43')](handleError(_0x140da5,null));};exports[_0x9d4c('0x4a')]=function(_0x281a01,_0x383b8b,_0x2ace08){var _0x3a2760={};var _0x5aca14={};var _0x3978ad;var _0x19d99a;return db[_0x9d4c('0x2a')][_0x9d4c('0x4b')]({'where':{'id':_0x281a01['params']['id']}})['then'](handleEntityNotFound(_0x383b8b,null))[_0x9d4c('0x23')](function(_0x1374cf){if(_0x1374cf){_0x3978ad=_0x1374cf;_0x5aca14[_0x9d4c('0x2e')]=_[_0x9d4c('0x31')](db[_0x9d4c('0x4c')][_0x9d4c('0x2b')]);_0x5aca14[_0x9d4c('0x30')]=_['keys'](_0x281a01[_0x9d4c('0x30')]);_0x5aca14['filters']=_[_0x9d4c('0x33')](_0x5aca14[_0x9d4c('0x2e')],_0x5aca14['query']);_0x3a2760['attributes']=_[_0x9d4c('0x33')](_0x5aca14[_0x9d4c('0x2e')],qs[_0x9d4c('0x35')](_0x281a01['query'][_0x9d4c('0x35')]));_0x3a2760['attributes']=_0x3a2760['attributes'][_0x9d4c('0x46')]?_0x3a2760[_0x9d4c('0x34')]:_0x5aca14[_0x9d4c('0x2e')];_0x3a2760['order']=qs[_0x9d4c('0x39')](_0x281a01[_0x9d4c('0x30')][_0x9d4c('0x39')]);_0x3a2760['where']=qs[_0x9d4c('0x32')](_[_0x9d4c('0x4d')](_0x281a01[_0x9d4c('0x30')],_0x5aca14[_0x9d4c('0x32')]));if(_0x281a01[_0x9d4c('0x30')][_0x9d4c('0x3b')]){_0x3a2760['where']=_[_0x9d4c('0x3c')](_0x3a2760[_0x9d4c('0x3a')],{'$or':_[_0x9d4c('0x2f')](_0x3a2760[_0x9d4c('0x34')],function(_0x161e99){var _0x5bbd61={};_0x5bbd61[_0x161e99]={'$like':'%'+_0x281a01[_0x9d4c('0x30')][_0x9d4c('0x3b')]+'%'};return _0x5bbd61;})});}_0x3a2760=_[_0x9d4c('0x3c')]({},_0x3a2760,_0x281a01[_0x9d4c('0x3f')]);return _0x3978ad[_0x9d4c('0x4a')](_0x3a2760);}})['then'](function(_0x341026){if(_0x341026){_0x19d99a=_0x341026[_0x9d4c('0x46')];if(!_0x281a01[_0x9d4c('0x30')][_0x9d4c('0x36')]('nolimit')){_0x3a2760[_0x9d4c('0x1d')]=qs[_0x9d4c('0x1d')](_0x281a01[_0x9d4c('0x30')][_0x9d4c('0x1d')]);_0x3a2760[_0x9d4c('0x1c')]=qs['offset'](_0x281a01[_0x9d4c('0x30')][_0x9d4c('0x1c')]);}return _0x3978ad[_0x9d4c('0x4a')](_0x3a2760);}})[_0x9d4c('0x23')](function(_0x4121a3){if(_0x4121a3){return _0x4121a3?{'count':_0x19d99a,'rows':_0x4121a3}:null;}})['then'](respondWithResult(_0x383b8b,null))[_0x9d4c('0x43')](handleError(_0x383b8b,null));};exports['addConfiguration']=function(_0x5cfddd,_0x3ea2ad,_0x3e663d){if(_0x5cfddd[_0x9d4c('0x49')]['id']){delete _0x5cfddd[_0x9d4c('0x49')]['id'];}return db[_0x9d4c('0x2a')][_0x9d4c('0x4b')]({'where':{'id':_0x5cfddd[_0x9d4c('0x45')]['id']}})[_0x9d4c('0x23')](handleEntityNotFound(_0x3ea2ad,null))[_0x9d4c('0x23')](function(_0x7d7c6a){if(_0x7d7c6a){_0x5cfddd[_0x9d4c('0x49')]['AccountId']=_0x7d7c6a['id'];_0x5cfddd[_0x9d4c('0x49')][_0x9d4c('0x4e')]=integrations['getSubjects'](_0x5cfddd['body'][_0x9d4c('0x4f')],_0x5cfddd[_0x9d4c('0x49')][_0x9d4c('0x3d')]);_0x5cfddd[_0x9d4c('0x49')]['Descriptions']=integrations['getDescriptions'](_0x5cfddd[_0x9d4c('0x49')][_0x9d4c('0x4f')],_0x5cfddd[_0x9d4c('0x49')]['type']);return db[_0x9d4c('0x4c')][_0x9d4c('0x48')](_0x5cfddd[_0x9d4c('0x49')],{'include':[{'model':db[_0x9d4c('0x50')],'as':_0x9d4c('0x4e')},{'model':db[_0x9d4c('0x50')],'as':'Descriptions'}]});}return null;})[_0x9d4c('0x23')](respondWithResult(_0x3ea2ad,null))[_0x9d4c('0x43')](handleError(_0x3ea2ad,null));};exports[_0x9d4c('0x51')]=function(_0x44f782,_0x4c3b31,_0x66f6){var _0x3dd4f9;var _0x5e5876='';var _0x1d1a85=_0x9d4c('0x52');return db['SalesforceAccount'][_0x9d4c('0x4b')]({'where':{'id':_0x44f782['params']['id']},'attributes':['id',_0x9d4c('0x53'),_0x9d4c('0x54'),'clientSecret','username','password',_0x9d4c('0x55')]})[_0x9d4c('0x23')](handleEntityNotFound(_0x4c3b31,null))[_0x9d4c('0x23')](function(_0x2bb843){if(_0x2bb843){_0x5e5876=_0x2bb843['remoteUri'];var _0x511de8=_0x5e5876[_0x9d4c('0x56')](-0x1);if(_0x511de8==='/'){_0x5e5876=_0x5e5876[_0x9d4c('0x57')](0x0,_0x5e5876[_0x9d4c('0x58')](_0x511de8));}_0x3dd4f9=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5e5876,'clientId':_0x2bb843[_0x9d4c('0x54')],'clientSecret':_0x2bb843[_0x9d4c('0x59')]}});return _0x3dd4f9[_0x9d4c('0x5a')](_0x2bb843[_0x9d4c('0x5b')],_0x2bb843['password'][_0x9d4c('0x5c')](_0x2bb843['securityToken']));}})[_0x9d4c('0x23')](function(_0x2efff6){if(_0x2efff6){if(!_[_0x9d4c('0x5d')](_0x44f782[_0x9d4c('0x30')][_0x9d4c('0x5e')])){_0x1d1a85=_0x44f782[_0x9d4c('0x30')][_0x9d4c('0x5e')];}return _0x3dd4f9[_0x9d4c('0x5f')](_0x1d1a85)[_0x9d4c('0x60')]();}})[_0x9d4c('0x23')](function(_0x26c469){var _0x43280d=[_0x9d4c('0x61'),_0x9d4c('0x62'),_0x9d4c('0x63'),_0x9d4c('0x64'),_0x9d4c('0x65'),'Description'];var _0x575d57=[_0x9d4c('0x66'),'int',_0x9d4c('0x67'),_0x9d4c('0x68'),_0x9d4c('0x69'),_0x9d4c('0x6a'),_0x9d4c('0x6b')];if(_0x26c469){_[_0x9d4c('0x6c')](_0x26c469[_0x9d4c('0x35')],function(_0x4ee236){return _0x43280d[_0x9d4c('0x6d')](_0x4ee236[_0x9d4c('0x27')])||!_0x575d57[_0x9d4c('0x6d')](_0x4ee236[_0x9d4c('0x3d')]);});return{'count':_0x26c469[_0x9d4c('0x35')][_0x9d4c('0x46')],'rows':_['map'](_0x26c469[_0x9d4c('0x35')],function(_0x4e2138){return{'id':_0x4e2138[_0x9d4c('0x27')],'name':_0x4e2138[_0x9d4c('0x6e')],'custom':_0x4e2138[_0x9d4c('0x6f')],'options':_0x4e2138[_0x9d4c('0x70')][_0x9d4c('0x46')]>0x0?_[_0x9d4c('0x2f')](_0x4e2138[_0x9d4c('0x70')],function(_0x70c479){return{'name':_0x70c479[_0x9d4c('0x6e')],'value':_0x70c479[_0x9d4c('0x71')]};}):_0x4e2138['type']=='boolean'?[{'name':'True','value':_0x9d4c('0x72')},{'name':_0x9d4c('0x73'),'value':'false'}]:[]};})};}})[_0x9d4c('0x23')](respondWithResult(_0x4c3b31,null))[_0x9d4c('0x43')](function(_0x901677){var _0xe918ad=_0x44f782[_0x9d4c('0x30')][_0x9d4c('0x74')]?0x1f4:_0x901677[_0x9d4c('0x75')]||0x1f4;logger['error'](_0x9d4c('0x76'),_0x9d4c('0x51'),_0xe918ad,JSON[_0x9d4c('0x77')](_0x901677));delete _0x901677[_0x9d4c('0x27')];if(_0xe918ad===0x191){_0xe918ad=0x190;}_0x4c3b31[_0x9d4c('0x19')](_0xe918ad)[_0x9d4c('0x28')](_0x44f782[_0x9d4c('0x30')][_0x9d4c('0x74')]?{'message':_0x9d4c('0x78'),'statusCode':_0x901677[_0x9d4c('0x75')]}:_0x901677);});}; \ No newline at end of file +var _0xb2fe=['keys','rawAttributes','includeAll','create','body','findOne','order','pick','nolimit','getConfigurations','addConfiguration','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','password','securityToken','slice','substring','Connection','clientSecret','login','username','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','Description','int','picklist','boolean','textarea','remove','includes','label','custom','picklistValues','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','SalesforceAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params'];(function(_0x146d8c,_0x2dae71){var _0x4970c6=function(_0x29e848){while(--_0x29e848){_0x146d8c['push'](_0x146d8c['shift']());}};_0x4970c6(++_0x2dae71);}(_0xb2fe,0xaf));var _0xeb2f=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xb2fe[_0xa990b7];return _0x52c99c;};'use strict';var emlformat=require(_0xeb2f('0x0'));var rimraf=require(_0xeb2f('0x1'));var zipdir=require(_0xeb2f('0x2'));var jsonpatch=require(_0xeb2f('0x3'));var rp=require('request-promise');var moment=require(_0xeb2f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeb2f('0x5'));var path=require(_0xeb2f('0x6'));var sox=require(_0xeb2f('0x7'));var csv=require(_0xeb2f('0x8'));var ejs=require(_0xeb2f('0x9'));var fs=require('fs');var fs_extra=require(_0xeb2f('0xa'));var _=require('lodash');var squel=require(_0xeb2f('0xb'));var crypto=require(_0xeb2f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeb2f('0xd'));var toCsv=require(_0xeb2f('0x8'));var querystring=require(_0xeb2f('0xe'));var Papa=require('papaparse');var Redis=require(_0xeb2f('0xf'));var authService=require(_0xeb2f('0x10'));var qs=require(_0xeb2f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb2f('0x12'));var logger=require(_0xeb2f('0x13'))(_0xeb2f('0x14'));var utils=require(_0xeb2f('0x15'));var config=require(_0xeb2f('0x16'));var licenseUtil=require(_0xeb2f('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb2f('0x18'));function respondWithStatusCode(_0x753847,_0xd576f1){_0xd576f1=_0xd576f1||0xcc;return function(_0x334300){if(_0x334300){return _0x753847['sendStatus'](_0xd576f1);}return _0x753847[_0xeb2f('0x19')](_0xd576f1)[_0xeb2f('0x1a')]();};}function respondWithResult(_0x4d076b,_0x424aea){_0x424aea=_0x424aea||0xc8;return function(_0x4d1a5f){if(_0x4d1a5f){return _0x4d076b['status'](_0x424aea)['json'](_0x4d1a5f);}};}function respondWithFilteredResult(_0x539221,_0x27689b){return function(_0x338a66){if(_0x338a66){var _0x53f2f6=typeof _0x27689b[_0xeb2f('0x1b')]===_0xeb2f('0x1c')&&typeof _0x27689b['limit']===_0xeb2f('0x1c');var _0x59e959=_0x338a66[_0xeb2f('0x1d')];var _0xc4aef2=_0x53f2f6?0x0:_0x27689b['offset'];var _0x4b9d25=_0x53f2f6?_0x338a66['count']:_0x27689b[_0xeb2f('0x1b')]+_0x27689b['limit'];var _0xcebaeb;if(_0x4b9d25>=_0x59e959){_0x4b9d25=_0x59e959;_0xcebaeb=0xc8;}else{_0xcebaeb=0xce;}_0x539221[_0xeb2f('0x19')](_0xcebaeb);return _0x539221[_0xeb2f('0x1e')](_0xeb2f('0x1f'),_0xc4aef2+'-'+_0x4b9d25+'/'+_0x59e959)[_0xeb2f('0x20')](_0x338a66);}return null;};}function patchUpdates(_0x4acd37){return function(_0x9aaa5){try{jsonpatch[_0xeb2f('0x21')](_0x9aaa5,_0x4acd37,!![]);}catch(_0x2001a8){return BPromise[_0xeb2f('0x22')](_0x2001a8);}return _0x9aaa5['save']();};}function saveUpdates(_0x2edf2b,_0x3c8737){return function(_0xc6ed8f){if(_0xc6ed8f){return _0xc6ed8f[_0xeb2f('0x23')](_0x2edf2b)[_0xeb2f('0x24')](function(_0x23a12f){return _0x23a12f;});}return null;};}function removeEntity(_0x263956,_0x210ffd){return function(_0xa5928f){if(_0xa5928f){return _0xa5928f[_0xeb2f('0x25')]()['then'](function(){_0x263956[_0xeb2f('0x19')](0xcc)[_0xeb2f('0x1a')]();});}};}function handleEntityNotFound(_0x32ec9d,_0xfef247){return function(_0x494076){if(!_0x494076){_0x32ec9d[_0xeb2f('0x26')](0x194);}return _0x494076;};}function handleError(_0x584997,_0x9671d2){_0x9671d2=_0x9671d2||0x1f4;return function(_0x23c1a6){logger[_0xeb2f('0x27')](_0x23c1a6[_0xeb2f('0x28')]);if(_0x23c1a6[_0xeb2f('0x29')]){delete _0x23c1a6[_0xeb2f('0x29')];}_0x584997[_0xeb2f('0x19')](_0x9671d2)['send'](_0x23c1a6);};}exports[_0xeb2f('0x2a')]=function(_0x5121ed,_0x52dea0){var _0x612413={},_0x2f4016={},_0x5e2461={'count':0x0,'rows':[]};var _0x41db7f=_[_0xeb2f('0x2b')](db[_0xeb2f('0x2c')]['rawAttributes'],function(_0x1e883b){return{'name':_0x1e883b[_0xeb2f('0x2d')],'type':_0x1e883b[_0xeb2f('0x2e')][_0xeb2f('0x2f')]};});_0x2f4016[_0xeb2f('0x30')]=_[_0xeb2f('0x2b')](_0x41db7f,_0xeb2f('0x29'));_0x2f4016[_0xeb2f('0x31')]=_['keys'](_0x5121ed[_0xeb2f('0x31')]);_0x2f4016['filters']=_[_0xeb2f('0x32')](_0x2f4016[_0xeb2f('0x30')],_0x2f4016[_0xeb2f('0x31')]);_0x612413[_0xeb2f('0x33')]=_[_0xeb2f('0x32')](_0x2f4016['model'],qs[_0xeb2f('0x34')](_0x5121ed[_0xeb2f('0x31')][_0xeb2f('0x34')]));_0x612413[_0xeb2f('0x33')]=_0x612413['attributes'][_0xeb2f('0x35')]?_0x612413[_0xeb2f('0x33')]:_0x2f4016[_0xeb2f('0x30')];if(!_0x5121ed[_0xeb2f('0x31')][_0xeb2f('0x36')]('nolimit')){_0x612413[_0xeb2f('0x37')]=qs['limit'](_0x5121ed[_0xeb2f('0x31')][_0xeb2f('0x37')]);_0x612413[_0xeb2f('0x1b')]=qs[_0xeb2f('0x1b')](_0x5121ed['query'][_0xeb2f('0x1b')]);}_0x612413['order']=qs[_0xeb2f('0x38')](_0x5121ed['query']['sort']);_0x612413[_0xeb2f('0x39')]=qs[_0xeb2f('0x3a')](_['pick'](_0x5121ed['query'],_0x2f4016[_0xeb2f('0x3a')]),_0x41db7f);if(_0x5121ed[_0xeb2f('0x31')][_0xeb2f('0x3b')]){_0x612413[_0xeb2f('0x39')]=_['merge'](_0x612413[_0xeb2f('0x39')],{'$or':_[_0xeb2f('0x2b')](_0x41db7f,function(_0x2433c0){if(_0x2433c0[_0xeb2f('0x2e')]!==_0xeb2f('0x3c')){var _0x33d58d={};_0x33d58d[_0x2433c0[_0xeb2f('0x29')]]={'$like':'%'+_0x5121ed[_0xeb2f('0x31')][_0xeb2f('0x3b')]+'%'};return _0x33d58d;}})});}_0x612413=_[_0xeb2f('0x3d')]({},_0x612413,_0x5121ed[_0xeb2f('0x3e')]);var _0x2e40dd={'where':_0x612413[_0xeb2f('0x39')]};return db[_0xeb2f('0x2c')][_0xeb2f('0x1d')](_0x2e40dd)[_0xeb2f('0x24')](function(_0xb9e4f7){_0x5e2461[_0xeb2f('0x1d')]=_0xb9e4f7;if(_0x5121ed[_0xeb2f('0x31')]['includeAll']){_0x612413[_0xeb2f('0x3f')]=[{'all':!![]}];}return db[_0xeb2f('0x2c')][_0xeb2f('0x40')](_0x612413);})['then'](function(_0x5c9403){_0x5e2461[_0xeb2f('0x41')]=_0x5c9403;return _0x5e2461;})[_0xeb2f('0x24')](respondWithFilteredResult(_0x52dea0,_0x612413))[_0xeb2f('0x42')](handleError(_0x52dea0,null));};exports[_0xeb2f('0x43')]=function(_0x464dc7,_0x3cb2d2){var _0x174e33={'raw':![],'where':{'id':_0x464dc7[_0xeb2f('0x44')]['id']}},_0x37cebf={};_0x37cebf[_0xeb2f('0x30')]=_[_0xeb2f('0x45')](db[_0xeb2f('0x2c')][_0xeb2f('0x46')]);_0x37cebf[_0xeb2f('0x31')]=_[_0xeb2f('0x45')](_0x464dc7[_0xeb2f('0x31')]);_0x37cebf[_0xeb2f('0x3a')]=_['intersection'](_0x37cebf[_0xeb2f('0x30')],_0x37cebf[_0xeb2f('0x31')]);_0x174e33[_0xeb2f('0x33')]=_['intersection'](_0x37cebf[_0xeb2f('0x30')],qs[_0xeb2f('0x34')](_0x464dc7['query'][_0xeb2f('0x34')]));_0x174e33[_0xeb2f('0x33')]=_0x174e33[_0xeb2f('0x33')][_0xeb2f('0x35')]?_0x174e33[_0xeb2f('0x33')]:_0x37cebf[_0xeb2f('0x30')];if(_0x464dc7[_0xeb2f('0x31')][_0xeb2f('0x47')]){_0x174e33['include']=[{'all':!![]}];}_0x174e33=_[_0xeb2f('0x3d')]({},_0x174e33,_0x464dc7[_0xeb2f('0x3e')]);return db[_0xeb2f('0x2c')]['find'](_0x174e33)[_0xeb2f('0x24')](handleEntityNotFound(_0x3cb2d2,null))[_0xeb2f('0x24')](respondWithResult(_0x3cb2d2,null))[_0xeb2f('0x42')](handleError(_0x3cb2d2,null));};exports[_0xeb2f('0x48')]=function(_0x8c603c,_0x90d834){return db[_0xeb2f('0x2c')][_0xeb2f('0x48')](_0x8c603c['body'],{})['then'](respondWithResult(_0x90d834,0xc9))[_0xeb2f('0x42')](handleError(_0x90d834,null));};exports['update']=function(_0x24447f,_0x51c74f){if(_0x24447f[_0xeb2f('0x49')]['id']){delete _0x24447f[_0xeb2f('0x49')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x24447f[_0xeb2f('0x44')]['id']}})[_0xeb2f('0x24')](handleEntityNotFound(_0x51c74f,null))[_0xeb2f('0x24')](saveUpdates(_0x24447f[_0xeb2f('0x49')],null))[_0xeb2f('0x24')](respondWithResult(_0x51c74f,null))[_0xeb2f('0x42')](handleError(_0x51c74f,null));};exports[_0xeb2f('0x25')]=function(_0x381d85,_0x4a960c){return db[_0xeb2f('0x2c')]['find']({'where':{'id':_0x381d85[_0xeb2f('0x44')]['id']}})[_0xeb2f('0x24')](handleEntityNotFound(_0x4a960c,null))[_0xeb2f('0x24')](removeEntity(_0x4a960c,null))['catch'](handleError(_0x4a960c,null));};exports['getConfigurations']=function(_0x31c380,_0x19aa36,_0x547b56){var _0x2b5641={};var _0x4c076e={};var _0x42740f;var _0x233ec0;return db[_0xeb2f('0x2c')][_0xeb2f('0x4a')]({'where':{'id':_0x31c380['params']['id']}})['then'](handleEntityNotFound(_0x19aa36,null))[_0xeb2f('0x24')](function(_0x56d506){if(_0x56d506){_0x42740f=_0x56d506;_0x4c076e[_0xeb2f('0x30')]=_['keys'](db['SalesforceConfiguration']['rawAttributes']);_0x4c076e[_0xeb2f('0x31')]=_[_0xeb2f('0x45')](_0x31c380[_0xeb2f('0x31')]);_0x4c076e[_0xeb2f('0x3a')]=_[_0xeb2f('0x32')](_0x4c076e[_0xeb2f('0x30')],_0x4c076e['query']);_0x2b5641[_0xeb2f('0x33')]=_[_0xeb2f('0x32')](_0x4c076e[_0xeb2f('0x30')],qs[_0xeb2f('0x34')](_0x31c380[_0xeb2f('0x31')]['fields']));_0x2b5641['attributes']=_0x2b5641[_0xeb2f('0x33')]['length']?_0x2b5641[_0xeb2f('0x33')]:_0x4c076e['model'];_0x2b5641[_0xeb2f('0x4b')]=qs[_0xeb2f('0x38')](_0x31c380['query'][_0xeb2f('0x38')]);_0x2b5641['where']=qs['filters'](_[_0xeb2f('0x4c')](_0x31c380[_0xeb2f('0x31')],_0x4c076e['filters']));if(_0x31c380[_0xeb2f('0x31')][_0xeb2f('0x3b')]){_0x2b5641[_0xeb2f('0x39')]=_[_0xeb2f('0x3d')](_0x2b5641[_0xeb2f('0x39')],{'$or':_[_0xeb2f('0x2b')](_0x2b5641['attributes'],function(_0xe1c1eb){var _0x5354c6={};_0x5354c6[_0xe1c1eb]={'$like':'%'+_0x31c380[_0xeb2f('0x31')][_0xeb2f('0x3b')]+'%'};return _0x5354c6;})});}_0x2b5641=_[_0xeb2f('0x3d')]({},_0x2b5641,_0x31c380['options']);return _0x42740f['getConfigurations'](_0x2b5641);}})[_0xeb2f('0x24')](function(_0x2d7d27){if(_0x2d7d27){_0x233ec0=_0x2d7d27[_0xeb2f('0x35')];if(!_0x31c380[_0xeb2f('0x31')]['hasOwnProperty'](_0xeb2f('0x4d'))){_0x2b5641[_0xeb2f('0x37')]=qs[_0xeb2f('0x37')](_0x31c380[_0xeb2f('0x31')][_0xeb2f('0x37')]);_0x2b5641[_0xeb2f('0x1b')]=qs['offset'](_0x31c380[_0xeb2f('0x31')][_0xeb2f('0x1b')]);}return _0x42740f[_0xeb2f('0x4e')](_0x2b5641);}})['then'](function(_0x2a794d){if(_0x2a794d){return _0x2a794d?{'count':_0x233ec0,'rows':_0x2a794d}:null;}})['then'](respondWithResult(_0x19aa36,null))[_0xeb2f('0x42')](handleError(_0x19aa36,null));};exports[_0xeb2f('0x4f')]=function(_0x362c30,_0x3ec188,_0x4267e3){if(_0x362c30[_0xeb2f('0x49')]['id']){delete _0x362c30[_0xeb2f('0x49')]['id'];}return db[_0xeb2f('0x2c')]['findOne']({'where':{'id':_0x362c30[_0xeb2f('0x44')]['id']}})[_0xeb2f('0x24')](handleEntityNotFound(_0x3ec188,null))[_0xeb2f('0x24')](function(_0x41e786){if(_0x41e786){_0x362c30['body']['AccountId']=_0x41e786['id'];_0x362c30[_0xeb2f('0x49')][_0xeb2f('0x50')]=integrations[_0xeb2f('0x51')](_0x362c30['body'][_0xeb2f('0x52')],_0x362c30[_0xeb2f('0x49')][_0xeb2f('0x2e')]);_0x362c30[_0xeb2f('0x49')]['Descriptions']=integrations['getDescriptions'](_0x362c30[_0xeb2f('0x49')][_0xeb2f('0x52')],_0x362c30['body'][_0xeb2f('0x2e')]);return db['SalesforceConfiguration'][_0xeb2f('0x48')](_0x362c30[_0xeb2f('0x49')],{'include':[{'model':db['SalesforceField'],'as':_0xeb2f('0x50')},{'model':db[_0xeb2f('0x53')],'as':_0xeb2f('0x54')}]});}return null;})[_0xeb2f('0x24')](respondWithResult(_0x3ec188,null))['catch'](handleError(_0x3ec188,null));};exports[_0xeb2f('0x55')]=function(_0x2e5ac5,_0x16de3b,_0x266742){var _0x5db8d9;var _0x44c6c9='';var _0x10f510=_0xeb2f('0x56');return db[_0xeb2f('0x2c')][_0xeb2f('0x4a')]({'where':{'id':_0x2e5ac5['params']['id']},'attributes':['id',_0xeb2f('0x57'),_0xeb2f('0x58'),'clientSecret','username',_0xeb2f('0x59'),_0xeb2f('0x5a')]})[_0xeb2f('0x24')](handleEntityNotFound(_0x16de3b,null))[_0xeb2f('0x24')](function(_0x1d5bbf){if(_0x1d5bbf){_0x44c6c9=_0x1d5bbf[_0xeb2f('0x57')];var _0x5bb9ab=_0x44c6c9[_0xeb2f('0x5b')](-0x1);if(_0x5bb9ab==='/'){_0x44c6c9=_0x44c6c9[_0xeb2f('0x5c')](0x0,_0x44c6c9['lastIndexOf'](_0x5bb9ab));}_0x5db8d9=new jsforce[(_0xeb2f('0x5d'))]({'oauth2':{'loginUrl':_0x44c6c9,'clientId':_0x1d5bbf[_0xeb2f('0x58')],'clientSecret':_0x1d5bbf[_0xeb2f('0x5e')]}});return _0x5db8d9[_0xeb2f('0x5f')](_0x1d5bbf[_0xeb2f('0x60')],_0x1d5bbf[_0xeb2f('0x59')][_0xeb2f('0x61')](_0x1d5bbf[_0xeb2f('0x5a')]));}})['then'](function(_0x4a87bd){if(_0x4a87bd){if(!_[_0xeb2f('0x62')](_0x2e5ac5['query'][_0xeb2f('0x63')])){_0x10f510=_0x2e5ac5[_0xeb2f('0x31')][_0xeb2f('0x63')];}return _0x5db8d9[_0xeb2f('0x64')](_0x10f510)[_0xeb2f('0x65')]();}})[_0xeb2f('0x24')](function(_0x5170c5){var _0x21acdf=['OwnerId',_0xeb2f('0x66'),_0xeb2f('0x67'),'IsRecurrence','Subject',_0xeb2f('0x68')];var _0x59f419=['string',_0xeb2f('0x69'),_0xeb2f('0x6a'),_0xeb2f('0x6b'),'email',_0xeb2f('0x6c'),'phone'];if(_0x5170c5){_[_0xeb2f('0x6d')](_0x5170c5[_0xeb2f('0x34')],function(_0x46d9b7){return _0x21acdf[_0xeb2f('0x6e')](_0x46d9b7[_0xeb2f('0x29')])||!_0x59f419[_0xeb2f('0x6e')](_0x46d9b7[_0xeb2f('0x2e')]);});return{'count':_0x5170c5[_0xeb2f('0x34')][_0xeb2f('0x35')],'rows':_['map'](_0x5170c5[_0xeb2f('0x34')],function(_0x19f29d){return{'id':_0x19f29d[_0xeb2f('0x29')],'name':_0x19f29d[_0xeb2f('0x6f')],'custom':_0x19f29d[_0xeb2f('0x70')],'options':_0x19f29d[_0xeb2f('0x71')][_0xeb2f('0x35')]>0x0?_['map'](_0x19f29d[_0xeb2f('0x71')],function(_0x456e87){return{'name':_0x456e87['label'],'value':_0x456e87['value']};}):_0x19f29d[_0xeb2f('0x2e')]=='boolean'?[{'name':'True','value':_0xeb2f('0x72')},{'name':_0xeb2f('0x73'),'value':'false'}]:[]};})};}})[_0xeb2f('0x24')](respondWithResult(_0x16de3b,null))[_0xeb2f('0x42')](function(_0x801840){var _0x2953d6=_0x2e5ac5[_0xeb2f('0x31')][_0xeb2f('0x74')]?0x1f4:_0x801840[_0xeb2f('0x75')]||0x1f4;logger[_0xeb2f('0x27')](_0xeb2f('0x76'),_0xeb2f('0x55'),_0x2953d6,JSON[_0xeb2f('0x77')](_0x801840));delete _0x801840[_0xeb2f('0x29')];if(_0x2953d6===0x191){_0x2953d6=0x190;}_0x16de3b[_0xeb2f('0x19')](_0x2953d6)[_0xeb2f('0x78')](_0x2e5ac5['query']['test']?{'message':_0xeb2f('0x79'),'statusCode':_0x801840[_0xeb2f('0x75')]}:_0x801840);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index a914069..eef8ab9 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 _0x2d32=['../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util'];(function(_0x256f06,_0x6a4413){var _0x1c00fb=function(_0x115ce5){while(--_0x115ce5){_0x256f06['push'](_0x256f06['shift']());}};_0x1c00fb(++_0x6a4413);}(_0x2d32,0xf5));var _0x22d3=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2d32[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x22d3('0x0'));var util=require(_0x22d3('0x1'));var logger=require(_0x22d3('0x2'))(_0x22d3('0x3'));var moment=require(_0x22d3('0x4'));var BPromise=require(_0x22d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22d3('0x6'));var rimraf=require(_0x22d3('0x7'));var config=require('../../config/environment');var attributes=require(_0x22d3('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x22d3('0x9')]=function(_0x31da8f,_0x20d7d1){return _0x31da8f[_0x22d3('0xa')](_0x22d3('0xb'),attributes,{'tableName':_0x22d3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x803f=['../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x212f4c,_0x44292e){var _0x47cbe1=function(_0xde8ab7){while(--_0xde8ab7){_0x212f4c['push'](_0x212f4c['shift']());}};_0x47cbe1(++_0x44292e);}(_0x803f,0x64));var _0xf803=function(_0x21b2b7,_0x10b70f){_0x21b2b7=_0x21b2b7-0x0;var _0x5f2f84=_0x803f[_0x21b2b7];return _0x5f2f84;};'use strict';var _=require(_0xf803('0x0'));var util=require('util');var logger=require(_0xf803('0x1'))(_0xf803('0x2'));var moment=require('moment');var BPromise=require(_0xf803('0x3'));var rp=require(_0xf803('0x4'));var fs=require('fs');var path=require(_0xf803('0x5'));var rimraf=require(_0xf803('0x6'));var config=require(_0xf803('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xf803('0x8'));module[_0xf803('0x9')]=function(_0x1d3a79,_0x584b2d){return _0x1d3a79[_0xf803('0xa')](_0xf803('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 555a375..d8bbc80 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 _0xcd8d=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowSalesforceAccount','find','lodash','util','moment','bluebird','../../mysqldb','rpc'];(function(_0x2c8c72,_0x1b071b){var _0x136642=function(_0x368e0b){while(--_0x368e0b){_0x2c8c72['push'](_0x2c8c72['shift']());}};_0x136642(++_0x1b071b);}(_0xcd8d,0x13e));var _0xdcd8=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xcd8d[_0x13b7fd];return _0x32a74a;};'use strict';var _=require(_0xdcd8('0x0'));var util=require(_0xdcd8('0x1'));var moment=require(_0xdcd8('0x2'));var BPromise=require(_0xdcd8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcd8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdcd8('0x5'));var config=require(_0xdcd8('0x6'));var jayson=require(_0xdcd8('0x7'));var client=jayson[_0xdcd8('0x8')][_0xdcd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e3281,_0x2d42c8,_0x162ec0){return new BPromise(function(_0x2fe28f,_0x1d45d7){return client[_0xdcd8('0xa')](_0x2e3281,_0x162ec0)[_0xdcd8('0xb')](function(_0x3d4205){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x2d42c8,_0xdcd8('0xc'));logger['debug'](_0xdcd8('0xd'),_0x2d42c8,_0xdcd8('0xc'),JSON[_0xdcd8('0xe')](_0x3d4205));if(_0x3d4205['error']){if(_0x3d4205[_0xdcd8('0xf')][_0xdcd8('0x10')]===0x1f4){logger[_0xdcd8('0xf')](_0xdcd8('0x11'),_0x2d42c8,_0x3d4205[_0xdcd8('0xf')][_0xdcd8('0x12')]);return _0x1d45d7(_0x3d4205['error'][_0xdcd8('0x12')]);}logger[_0xdcd8('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x2d42c8,_0x3d4205[_0xdcd8('0xf')]['message']);return _0x2fe28f(_0x3d4205[_0xdcd8('0xf')][_0xdcd8('0x12')]);}else{logger[_0xdcd8('0x13')](_0xdcd8('0x11'),_0x2d42c8,_0xdcd8('0xc'));_0x2fe28f(_0x3d4205[_0xdcd8('0x14')]['message']);}})[_0xdcd8('0x15')](function(_0x5946c3){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x2d42c8,_0x5946c3);_0x1d45d7(_0x5946c3);});});}exports[_0xdcd8('0x16')]=function(_0x193d03){var _0x425cc2=this;return new Promise(function(_0x56d1aa,_0x593070){return db[_0xdcd8('0x17')][_0xdcd8('0x18')]({'raw':_0x193d03['options']?_0x193d03[_0xdcd8('0x19')][_0xdcd8('0x1a')]===undefined?!![]:![]:!![],'where':_0x193d03['options']?_0x193d03[_0xdcd8('0x19')][_0xdcd8('0x1b')]||null:null,'attributes':_0x193d03['options']?_0x193d03[_0xdcd8('0x19')][_0xdcd8('0x1c')]||null:null,'limit':_0x193d03['options']?_0x193d03[_0xdcd8('0x19')][_0xdcd8('0x1d')]||null:null,'include':_0x193d03[_0xdcd8('0x19')]?_0x193d03['options'][_0xdcd8('0x1e')]?_[_0xdcd8('0x1f')](_0x193d03[_0xdcd8('0x19')][_0xdcd8('0x1e')],function(_0x5422d2){return{'model':db[_0x5422d2[_0xdcd8('0x20')]],'as':_0x5422d2['as'],'attributes':_0x5422d2['attributes'],'include':_0x5422d2[_0xdcd8('0x1e')]?_[_0xdcd8('0x1f')](_0x5422d2[_0xdcd8('0x1e')],function(_0x1703ac){return{'model':db[_0x1703ac[_0xdcd8('0x20')]],'as':_0x1703ac['as'],'attributes':_0x1703ac[_0xdcd8('0x1c')],'include':_0x1703ac[_0xdcd8('0x1e')]?_['map'](_0x1703ac['include'],function(_0xbee263){return{'model':db[_0xbee263[_0xdcd8('0x20')]],'as':_0xbee263['as'],'attributes':_0xbee263[_0xdcd8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdcd8('0xb')](function(_0x1e3581){logger[_0xdcd8('0x13')]('GetSalesforceAccount',_0x193d03);logger[_0xdcd8('0x21')]('GetSalesforceAccount',_0x193d03,JSON[_0xdcd8('0xe')](_0x1e3581));_0x56d1aa(_0x1e3581);})[_0xdcd8('0x15')](function(_0x3341ce){logger['error'](_0xdcd8('0x16'),_0x3341ce[_0xdcd8('0x12')],_0x193d03);_0x593070(_0x425cc2[_0xdcd8('0xf')](0x1f4,_0x3341ce['message']));});});};exports[_0xdcd8('0x22')]=function(_0x2d5778){var _0x23d501=this;return new Promise(function(_0x505abe,_0x4ff48a){return db[_0xdcd8('0x17')][_0xdcd8('0x23')]({'raw':_0x2d5778['options']?_0x2d5778[_0xdcd8('0x19')][_0xdcd8('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d5778[_0xdcd8('0x19')]?_0x2d5778[_0xdcd8('0x19')]['where']||null:null,'attributes':_0x2d5778['options']?_0x2d5778['options'][_0xdcd8('0x1c')]||null:null,'include':_0x2d5778[_0xdcd8('0x19')]?_0x2d5778[_0xdcd8('0x19')][_0xdcd8('0x1e')]?_[_0xdcd8('0x1f')](_0x2d5778[_0xdcd8('0x19')][_0xdcd8('0x1e')],function(_0x271eb6){return{'model':db[_0x271eb6[_0xdcd8('0x20')]],'as':_0x271eb6['as'],'attributes':_0x271eb6['attributes'],'include':_0x271eb6['include']?_['map'](_0x271eb6[_0xdcd8('0x1e')],function(_0x68ebe){return{'model':db[_0x68ebe[_0xdcd8('0x20')]],'as':_0x68ebe['as'],'attributes':_0x68ebe['attributes'],'include':_0x68ebe[_0xdcd8('0x1e')]?_['map'](_0x68ebe[_0xdcd8('0x1e')],function(_0x25ea12){return{'model':db[_0x25ea12[_0xdcd8('0x20')]],'as':_0x25ea12['as'],'attributes':_0x25ea12['attributes']};}):[]};}):[]};}):[]:[]})[_0xdcd8('0xb')](function(_0x44d8ee){logger[_0xdcd8('0x13')](_0xdcd8('0x22'),_0x2d5778);logger[_0xdcd8('0x21')](_0xdcd8('0x22'),_0x2d5778,JSON[_0xdcd8('0xe')](_0x44d8ee));_0x505abe(_0x44d8ee);})[_0xdcd8('0x15')](function(_0x2eb7a4){logger['error'](_0xdcd8('0x22'),_0x2eb7a4[_0xdcd8('0x12')],_0x2d5778);_0x4ff48a(_0x23d501['error'](0x1f4,_0x2eb7a4[_0xdcd8('0x12')]));});});}; \ No newline at end of file +var _0x5a43=['randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit','include','model','map','attributes','debug','stringify','ShowSalesforceAccount','find','lodash','util','moment','bluebird'];(function(_0x4db8a8,_0x879b1e){var _0x247ae1=function(_0x4d43bb){while(--_0x4d43bb){_0x4db8a8['push'](_0x4db8a8['shift']());}};_0x247ae1(++_0x879b1e);}(_0x5a43,0xf1));var _0x35a4=function(_0x1a0ea8,_0x2b0d25){_0x1a0ea8=_0x1a0ea8-0x0;var _0x343be1=_0x5a43[_0x1a0ea8];return _0x343be1;};'use strict';var _=require(_0x35a4('0x0'));var util=require(_0x35a4('0x1'));var moment=require(_0x35a4('0x2'));var BPromise=require(_0x35a4('0x3'));var rs=require(_0x35a4('0x4'));var fs=require('fs');var Redis=require(_0x35a4('0x5'));var db=require(_0x35a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x35a4('0x7'));var client=jayson[_0x35a4('0x8')][_0x35a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b2bf2,_0x384a3e,_0xa4665e){return new BPromise(function(_0x4cc7a3,_0x38e68f){return client[_0x35a4('0xa')](_0x1b2bf2,_0xa4665e)[_0x35a4('0xb')](function(_0x3e23d6){logger[_0x35a4('0xc')](_0x35a4('0xd'),_0x384a3e,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x384a3e,_0x35a4('0xe'),JSON['stringify'](_0x3e23d6));if(_0x3e23d6[_0x35a4('0xf')]){if(_0x3e23d6[_0x35a4('0xf')][_0x35a4('0x10')]===0x1f4){logger['error'](_0x35a4('0xd'),_0x384a3e,_0x3e23d6[_0x35a4('0xf')][_0x35a4('0x11')]);return _0x38e68f(_0x3e23d6[_0x35a4('0xf')]['message']);}logger[_0x35a4('0xf')](_0x35a4('0xd'),_0x384a3e,_0x3e23d6['error'][_0x35a4('0x11')]);return _0x4cc7a3(_0x3e23d6['error'][_0x35a4('0x11')]);}else{logger[_0x35a4('0xc')](_0x35a4('0xd'),_0x384a3e,_0x35a4('0xe'));_0x4cc7a3(_0x3e23d6[_0x35a4('0x12')][_0x35a4('0x11')]);}})[_0x35a4('0x13')](function(_0x26a97e){logger[_0x35a4('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x384a3e,_0x26a97e);_0x38e68f(_0x26a97e);});});}exports[_0x35a4('0x14')]=function(_0x41b56c){var _0x199ef3=this;return new Promise(function(_0x61f568,_0x46cc80){return db[_0x35a4('0x15')][_0x35a4('0x16')]({'raw':_0x41b56c[_0x35a4('0x17')]?_0x41b56c['options'][_0x35a4('0x18')]===undefined?!![]:![]:!![],'where':_0x41b56c['options']?_0x41b56c['options'][_0x35a4('0x19')]||null:null,'attributes':_0x41b56c[_0x35a4('0x17')]?_0x41b56c[_0x35a4('0x17')]['attributes']||null:null,'limit':_0x41b56c[_0x35a4('0x17')]?_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1a')]||null:null,'include':_0x41b56c['options']?_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1b')]?_['map'](_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1b')],function(_0x34fc8d){return{'model':db[_0x34fc8d[_0x35a4('0x1c')]],'as':_0x34fc8d['as'],'attributes':_0x34fc8d['attributes'],'include':_0x34fc8d['include']?_[_0x35a4('0x1d')](_0x34fc8d['include'],function(_0x469728){return{'model':db[_0x469728[_0x35a4('0x1c')]],'as':_0x469728['as'],'attributes':_0x469728[_0x35a4('0x1e')],'include':_0x469728[_0x35a4('0x1b')]?_[_0x35a4('0x1d')](_0x469728[_0x35a4('0x1b')],function(_0x503719){return{'model':db[_0x503719['model']],'as':_0x503719['as'],'attributes':_0x503719['attributes']};}):[]};}):[]};}):[]:[]})[_0x35a4('0xb')](function(_0x69b73e){logger['info']('GetSalesforceAccount',_0x41b56c);logger[_0x35a4('0x1f')](_0x35a4('0x14'),_0x41b56c,JSON[_0x35a4('0x20')](_0x69b73e));_0x61f568(_0x69b73e);})[_0x35a4('0x13')](function(_0x5d3313){logger['error']('GetSalesforceAccount',_0x5d3313['message'],_0x41b56c);_0x46cc80(_0x199ef3[_0x35a4('0xf')](0x1f4,_0x5d3313[_0x35a4('0x11')]));});});};exports[_0x35a4('0x21')]=function(_0x1da508){var _0x2e1985=this;return new Promise(function(_0x160bb5,_0x2e6d5d){return db[_0x35a4('0x15')][_0x35a4('0x22')]({'raw':_0x1da508[_0x35a4('0x17')]?_0x1da508[_0x35a4('0x17')][_0x35a4('0x18')]===undefined?!![]:![]:!![],'where':_0x1da508[_0x35a4('0x17')]?_0x1da508[_0x35a4('0x17')][_0x35a4('0x19')]||null:null,'attributes':_0x1da508[_0x35a4('0x17')]?_0x1da508['options'][_0x35a4('0x1e')]||null:null,'include':_0x1da508[_0x35a4('0x17')]?_0x1da508[_0x35a4('0x17')]['include']?_[_0x35a4('0x1d')](_0x1da508[_0x35a4('0x17')][_0x35a4('0x1b')],function(_0x48245c){return{'model':db[_0x48245c['model']],'as':_0x48245c['as'],'attributes':_0x48245c[_0x35a4('0x1e')],'include':_0x48245c['include']?_[_0x35a4('0x1d')](_0x48245c[_0x35a4('0x1b')],function(_0x274237){return{'model':db[_0x274237['model']],'as':_0x274237['as'],'attributes':_0x274237['attributes'],'include':_0x274237[_0x35a4('0x1b')]?_[_0x35a4('0x1d')](_0x274237[_0x35a4('0x1b')],function(_0x55510a){return{'model':db[_0x55510a[_0x35a4('0x1c')]],'as':_0x55510a['as'],'attributes':_0x55510a[_0x35a4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x35a4('0xb')](function(_0x368330){logger['info']('ShowSalesforceAccount',_0x1da508);logger[_0x35a4('0x1f')](_0x35a4('0x21'),_0x1da508,JSON[_0x35a4('0x20')](_0x368330));_0x160bb5(_0x368330);})[_0x35a4('0x13')](function(_0xba030a){logger['error'](_0x35a4('0x21'),_0xba030a['message'],_0x1da508);_0x2e6d5d(_0x2e1985[_0x35a4('0xf')](0x1f4,_0xba030a['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 3aec27d..9465167 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xdb28,0x106));var _0x8db2=function(_0x5c597b,_0x5f0832){_0x5c597b=_0x5c597b-0x0;var _0x3f6d7a=_0xdb28[_0x5c597b];return _0x3f6d7a;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0x0b0e[_0x215dc8];return _0x583ea3;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 2f9fa31..334fde9 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 _0x737e=['sequelize','exports','STRING','Task','contact','lead','account_contact_lead','account','contact_lead','nothing'];(function(_0x2f42e6,_0x492225){var _0x23345f=function(_0x3ea50a){while(--_0x3ea50a){_0x2f42e6['push'](_0x2f42e6['shift']());}};_0x23345f(++_0x492225);}(_0x737e,0x1cc));var _0xe737=function(_0x332f72,_0x4f2e5e){_0x332f72=_0x332f72-0x0;var _0xba5607=_0x737e[_0x332f72];return _0xba5607;};'use strict';var Sequelize=require(_0xe737('0x0'));module[_0xe737('0x1')]={'name':{'type':Sequelize[_0xe737('0x2')]},'description':{'type':Sequelize[_0xe737('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xe737('0x3'),'Case'),'defaultValue':_0xe737('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xe737('0x4'),_0xe737('0x5'),_0xe737('0x6'),_0xe737('0x7')),'defaultValue':_0xe737('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0xe737('0x9'),'contact',_0xe737('0x5'),_0xe737('0x7')),'defaultValue':_0xe737('0x5')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xe737('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xe737('0x2')]}}; \ No newline at end of file +var _0x6ca1=['sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing'];(function(_0x1a6ae1,_0x5643a1){var _0x2ed02f=function(_0x4f9b5f){while(--_0x4f9b5f){_0x1a6ae1['push'](_0x1a6ae1['shift']());}};_0x2ed02f(++_0x5643a1);}(_0x6ca1,0x108));var _0x16ca=function(_0x432feb,_0x430eb9){_0x432feb=_0x432feb-0x0;var _0x3ef64b=_0x6ca1[_0x432feb];return _0x3ef64b;};'use strict';var Sequelize=require(_0x16ca('0x0'));module[_0x16ca('0x1')]={'name':{'type':Sequelize[_0x16ca('0x2')]},'description':{'type':Sequelize[_0x16ca('0x2')]},'ticketType':{'type':Sequelize[_0x16ca('0x3')](_0x16ca('0x4'),_0x16ca('0x5')),'defaultValue':_0x16ca('0x4')},'moduleSearch':{'type':Sequelize[_0x16ca('0x3')](_0x16ca('0x6'),_0x16ca('0x7'),_0x16ca('0x8'),_0x16ca('0x9'),_0x16ca('0xa')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x16ca('0xb'),'contact',_0x16ca('0x8'),_0x16ca('0xa')),'defaultValue':_0x16ca('0x8')},'leadId':{'type':Sequelize[_0x16ca('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x16ca('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x16ca('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x16ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index f625fea..180fcc3 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 _0xc519=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','create','find','params','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','zip-dir','request-promise','moment','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xc519,0x11b));var _0x9c51=function(_0x87987e,_0x24f91e){_0x87987e=_0x87987e-0x0;var _0x80f7bd=_0xc519[_0x87987e];return _0x80f7bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9c51('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c51('0x1'));var moment=require(_0x9c51('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c51('0x3'));var path=require(_0x9c51('0x4'));var sox=require('sox');var csv=require(_0x9c51('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c51('0x6'));var _=require(_0x9c51('0x7'));var squel=require('squel');var crypto=require(_0x9c51('0x8'));var jsforce=require(_0x9c51('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x9c51('0x5'));var querystring=require(_0x9c51('0xa'));var Papa=require(_0x9c51('0xb'));var Redis=require(_0x9c51('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9c51('0xd'));var as=require(_0x9c51('0xe'));var hardwareService=require(_0x9c51('0xf'));var logger=require(_0x9c51('0x10'))(_0x9c51('0x11'));var utils=require(_0x9c51('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9c51('0x13'))['db'];function respondWithStatusCode(_0x5cbed0,_0x3e6bd4){_0x3e6bd4=_0x3e6bd4||0xcc;return function(_0xd78aea){if(_0xd78aea){return _0x5cbed0[_0x9c51('0x14')](_0x3e6bd4);}return _0x5cbed0[_0x9c51('0x15')](_0x3e6bd4)[_0x9c51('0x16')]();};}function respondWithResult(_0x39bfc2,_0x44487c){_0x44487c=_0x44487c||0xc8;return function(_0x58375e){if(_0x58375e){return _0x39bfc2[_0x9c51('0x15')](_0x44487c)[_0x9c51('0x17')](_0x58375e);}};}function respondWithFilteredResult(_0x25a640,_0x4598ac){return function(_0x3064c4){if(_0x3064c4){var _0x11c33f=typeof _0x4598ac[_0x9c51('0x18')]==='undefined'&&typeof _0x4598ac[_0x9c51('0x19')]==='undefined';var _0x52d8b7=_0x3064c4[_0x9c51('0x1a')];var _0x5d9daf=_0x11c33f?0x0:_0x4598ac['offset'];var _0x691273=_0x11c33f?_0x3064c4[_0x9c51('0x1a')]:_0x4598ac[_0x9c51('0x18')]+_0x4598ac[_0x9c51('0x19')];var _0x3f0ad7;if(_0x691273>=_0x52d8b7){_0x691273=_0x52d8b7;_0x3f0ad7=0xc8;}else{_0x3f0ad7=0xce;}_0x25a640[_0x9c51('0x15')](_0x3f0ad7);return _0x25a640[_0x9c51('0x1b')](_0x9c51('0x1c'),_0x5d9daf+'-'+_0x691273+'/'+_0x52d8b7)[_0x9c51('0x17')](_0x3064c4);}return null;};}function patchUpdates(_0x483b37){return function(_0x432f16){try{jsonpatch[_0x9c51('0x1d')](_0x432f16,_0x483b37,!![]);}catch(_0x58a047){return BPromise[_0x9c51('0x1e')](_0x58a047);}return _0x432f16[_0x9c51('0x1f')]();};}function saveUpdates(_0x26a2b2,_0x16be2e){return function(_0x3a8693){if(_0x3a8693){return _0x3a8693[_0x9c51('0x20')](_0x26a2b2)[_0x9c51('0x21')](function(_0x104b30){return _0x104b30;});}return null;};}function removeEntity(_0x51ae02,_0x3c4253){return function(_0x3d8283){if(_0x3d8283){return _0x3d8283[_0x9c51('0x22')]()[_0x9c51('0x21')](function(){_0x51ae02[_0x9c51('0x15')](0xcc)[_0x9c51('0x16')]();});}};}function handleEntityNotFound(_0x574b68,_0x40a786){return function(_0x73dc43){if(!_0x73dc43){_0x574b68['sendStatus'](0x194);}return _0x73dc43;};}function handleError(_0x51863a,_0x4eb9d7){_0x4eb9d7=_0x4eb9d7||0x1f4;return function(_0x5e9c41){logger[_0x9c51('0x23')](_0x5e9c41[_0x9c51('0x24')]);if(_0x5e9c41[_0x9c51('0x25')]){delete _0x5e9c41[_0x9c51('0x25')];}_0x51863a[_0x9c51('0x15')](_0x4eb9d7)[_0x9c51('0x26')](_0x5e9c41);};}exports[_0x9c51('0x27')]=function(_0x48db4a,_0xe70cd6){var _0x394bc9={},_0x9a5705={},_0x9183f={'count':0x0,'rows':[]};var _0x57c998=_['map'](db[_0x9c51('0x28')][_0x9c51('0x29')],function(_0x5182b0){return{'name':_0x5182b0[_0x9c51('0x2a')],'type':_0x5182b0[_0x9c51('0x2b')][_0x9c51('0x2c')]};});_0x9a5705[_0x9c51('0x2d')]=_[_0x9c51('0x2e')](_0x57c998,_0x9c51('0x25'));_0x9a5705['query']=_['keys'](_0x48db4a[_0x9c51('0x2f')]);_0x9a5705[_0x9c51('0x30')]=_[_0x9c51('0x31')](_0x9a5705[_0x9c51('0x2d')],_0x9a5705[_0x9c51('0x2f')]);_0x394bc9[_0x9c51('0x32')]=_[_0x9c51('0x31')](_0x9a5705[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0x48db4a['query']['fields']));_0x394bc9[_0x9c51('0x32')]=_0x394bc9[_0x9c51('0x32')][_0x9c51('0x34')]?_0x394bc9[_0x9c51('0x32')]:_0x9a5705[_0x9c51('0x2d')];if(!_0x48db4a[_0x9c51('0x2f')][_0x9c51('0x35')](_0x9c51('0x36'))){_0x394bc9['limit']=qs['limit'](_0x48db4a[_0x9c51('0x2f')]['limit']);_0x394bc9[_0x9c51('0x18')]=qs['offset'](_0x48db4a[_0x9c51('0x2f')][_0x9c51('0x18')]);}_0x394bc9[_0x9c51('0x37')]=qs[_0x9c51('0x38')](_0x48db4a[_0x9c51('0x2f')]['sort']);_0x394bc9[_0x9c51('0x39')]=qs[_0x9c51('0x30')](_['pick'](_0x48db4a[_0x9c51('0x2f')],_0x9a5705[_0x9c51('0x30')]),_0x57c998);if(_0x48db4a[_0x9c51('0x2f')][_0x9c51('0x3a')]){_0x394bc9[_0x9c51('0x39')]=_[_0x9c51('0x3b')](_0x394bc9['where'],{'$or':_[_0x9c51('0x2e')](_0x57c998,function(_0x1e5282){if(_0x1e5282[_0x9c51('0x2b')]!==_0x9c51('0x3c')){var _0x30a629={};_0x30a629[_0x1e5282[_0x9c51('0x25')]]={'$like':'%'+_0x48db4a[_0x9c51('0x2f')]['filter']+'%'};return _0x30a629;}})});}_0x394bc9=_[_0x9c51('0x3b')]({},_0x394bc9,_0x48db4a[_0x9c51('0x3d')]);var _0x34de73={'where':_0x394bc9[_0x9c51('0x39')]};return db['SalesforceConfiguration'][_0x9c51('0x1a')](_0x34de73)[_0x9c51('0x21')](function(_0x2170dd){_0x9183f[_0x9c51('0x1a')]=_0x2170dd;if(_0x48db4a['query'][_0x9c51('0x3e')]){_0x394bc9[_0x9c51('0x3f')]=[{'all':!![]}];}return db[_0x9c51('0x28')]['findAll'](_0x394bc9);})[_0x9c51('0x21')](function(_0x1a2f16){_0x9183f[_0x9c51('0x40')]=_0x1a2f16;return _0x9183f;})[_0x9c51('0x21')](respondWithFilteredResult(_0xe70cd6,_0x394bc9))[_0x9c51('0x41')](handleError(_0xe70cd6,null));};exports[_0x9c51('0x42')]=function(_0xaeda82,_0xe74e89){var _0x5c2c2e={'raw':![],'where':{'id':_0xaeda82['params']['id']}},_0x34a6d1={};_0x34a6d1[_0x9c51('0x2d')]=_[_0x9c51('0x43')](db['SalesforceConfiguration'][_0x9c51('0x29')]);_0x34a6d1[_0x9c51('0x2f')]=_[_0x9c51('0x43')](_0xaeda82['query']);_0x34a6d1['filters']=_[_0x9c51('0x31')](_0x34a6d1[_0x9c51('0x2d')],_0x34a6d1['query']);_0x5c2c2e[_0x9c51('0x32')]=_['intersection'](_0x34a6d1[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0xaeda82['query']['fields']));_0x5c2c2e[_0x9c51('0x32')]=_0x5c2c2e[_0x9c51('0x32')][_0x9c51('0x34')]?_0x5c2c2e['attributes']:_0x34a6d1[_0x9c51('0x2d')];if(_0xaeda82[_0x9c51('0x2f')][_0x9c51('0x3e')]){_0x5c2c2e[_0x9c51('0x3f')]=[{'all':!![]}];}_0x5c2c2e=_['merge']({},_0x5c2c2e,_0xaeda82[_0x9c51('0x3d')]);return db[_0x9c51('0x28')]['find'](_0x5c2c2e)['then'](handleEntityNotFound(_0xe74e89,null))[_0x9c51('0x21')](respondWithResult(_0xe74e89,null))[_0x9c51('0x41')](handleError(_0xe74e89,null));};exports[_0x9c51('0x44')]=function(_0x2d2d0e,_0x5382a1){return db[_0x9c51('0x28')][_0x9c51('0x44')](_0x2d2d0e['body'],{})[_0x9c51('0x21')](respondWithResult(_0x5382a1,0xc9))['catch'](handleError(_0x5382a1,null));};exports['update']=function(_0x558b02,_0x5e40b4){if(_0x558b02['body']['id']){delete _0x558b02['body']['id'];}return db[_0x9c51('0x28')][_0x9c51('0x45')]({'where':{'id':_0x558b02[_0x9c51('0x46')]['id']}})[_0x9c51('0x21')](handleEntityNotFound(_0x5e40b4,null))['then'](saveUpdates(_0x558b02['body'],null))[_0x9c51('0x21')](respondWithResult(_0x5e40b4,null))['catch'](handleError(_0x5e40b4,null));};exports[_0x9c51('0x22')]=function(_0x5e0a99,_0x4c057b){return db[_0x9c51('0x28')][_0x9c51('0x45')]({'where':{'id':_0x5e0a99['params']['id']}})[_0x9c51('0x21')](handleEntityNotFound(_0x4c057b,null))[_0x9c51('0x21')](removeEntity(_0x4c057b,null))[_0x9c51('0x41')](handleError(_0x4c057b,null));};exports[_0x9c51('0x47')]=function(_0x1f1b6e,_0x2f80a8,_0x129523){var _0x12d3aa={};var _0x21f79b={};var _0x328a53;var _0x4d78f8;return db[_0x9c51('0x28')][_0x9c51('0x48')]({'where':{'id':_0x1f1b6e[_0x9c51('0x46')]['id']}})[_0x9c51('0x21')](handleEntityNotFound(_0x2f80a8,null))[_0x9c51('0x21')](function(_0x53ae7c){if(_0x53ae7c){_0x328a53=_0x53ae7c;_0x21f79b[_0x9c51('0x2d')]=_[_0x9c51('0x43')](db[_0x9c51('0x49')]['rawAttributes']);_0x21f79b['query']=_['keys'](_0x1f1b6e['query']);_0x21f79b[_0x9c51('0x30')]=_[_0x9c51('0x31')](_0x21f79b[_0x9c51('0x2d')],_0x21f79b[_0x9c51('0x2f')]);_0x12d3aa['attributes']=_[_0x9c51('0x31')](_0x21f79b[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0x1f1b6e[_0x9c51('0x2f')]['fields']));_0x12d3aa['attributes']=_0x12d3aa[_0x9c51('0x32')][_0x9c51('0x34')]?_0x12d3aa[_0x9c51('0x32')]:_0x21f79b[_0x9c51('0x2d')];_0x12d3aa[_0x9c51('0x37')]=qs[_0x9c51('0x38')](_0x1f1b6e[_0x9c51('0x2f')]['sort']);_0x12d3aa[_0x9c51('0x39')]=qs['filters'](_[_0x9c51('0x4a')](_0x1f1b6e[_0x9c51('0x2f')],_0x21f79b['filters']));if(_0x1f1b6e[_0x9c51('0x2f')]['filter']){_0x12d3aa[_0x9c51('0x39')]=_[_0x9c51('0x3b')](_0x12d3aa[_0x9c51('0x39')],{'$or':_[_0x9c51('0x2e')](_0x12d3aa[_0x9c51('0x32')],function(_0x545947){var _0x6d801={};_0x6d801[_0x545947]={'$like':'%'+_0x1f1b6e[_0x9c51('0x2f')][_0x9c51('0x3a')]+'%'};return _0x6d801;})});}_0x12d3aa=_[_0x9c51('0x3b')]({},_0x12d3aa,_0x1f1b6e['options']);return _0x328a53[_0x9c51('0x47')](_0x12d3aa);}})[_0x9c51('0x21')](function(_0x1296a8){if(_0x1296a8){_0x4d78f8=_0x1296a8[_0x9c51('0x34')];if(!_0x1f1b6e['query'][_0x9c51('0x35')]('nolimit')){_0x12d3aa[_0x9c51('0x19')]=qs[_0x9c51('0x19')](_0x1f1b6e[_0x9c51('0x2f')][_0x9c51('0x19')]);_0x12d3aa[_0x9c51('0x18')]=qs[_0x9c51('0x18')](_0x1f1b6e['query'][_0x9c51('0x18')]);}return _0x328a53[_0x9c51('0x47')](_0x12d3aa);}})['then'](function(_0x15d406){if(_0x15d406){return _0x15d406?{'count':_0x4d78f8,'rows':_0x15d406}:null;}})[_0x9c51('0x21')](respondWithResult(_0x2f80a8,null))['catch'](handleError(_0x2f80a8,null));};exports[_0x9c51('0x4b')]=function(_0x1949d6,_0x10ad68,_0x29238f){var _0x4fe1c9={};var _0x48173e={};var _0x236d58;var _0x263f43;return db['SalesforceConfiguration'][_0x9c51('0x48')]({'where':{'id':_0x1949d6[_0x9c51('0x46')]['id']}})[_0x9c51('0x21')](handleEntityNotFound(_0x10ad68,null))[_0x9c51('0x21')](function(_0x101b24){if(_0x101b24){_0x236d58=_0x101b24;_0x48173e['model']=_[_0x9c51('0x43')](db['SalesforceField'][_0x9c51('0x29')]);_0x48173e['query']=_['keys'](_0x1949d6[_0x9c51('0x2f')]);_0x48173e['filters']=_['intersection'](_0x48173e[_0x9c51('0x2d')],_0x48173e['query']);_0x4fe1c9[_0x9c51('0x32')]=_[_0x9c51('0x31')](_0x48173e[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x33')]));_0x4fe1c9[_0x9c51('0x32')]=_0x4fe1c9[_0x9c51('0x32')][_0x9c51('0x34')]?_0x4fe1c9[_0x9c51('0x32')]:_0x48173e[_0x9c51('0x2d')];_0x4fe1c9[_0x9c51('0x37')]=qs[_0x9c51('0x38')](_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x38')]);_0x4fe1c9[_0x9c51('0x39')]=qs[_0x9c51('0x30')](_['pick'](_0x1949d6[_0x9c51('0x2f')],_0x48173e[_0x9c51('0x30')]));if(_0x1949d6['query'][_0x9c51('0x3a')]){_0x4fe1c9[_0x9c51('0x39')]=_[_0x9c51('0x3b')](_0x4fe1c9['where'],{'$or':_[_0x9c51('0x2e')](_0x4fe1c9[_0x9c51('0x32')],function(_0x185fb9){var _0x458b70={};_0x458b70[_0x185fb9]={'$like':'%'+_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x3a')]+'%'};return _0x458b70;})});}_0x4fe1c9=_[_0x9c51('0x3b')]({},_0x4fe1c9,_0x1949d6[_0x9c51('0x3d')]);return _0x236d58['getSubjects'](_0x4fe1c9);}})[_0x9c51('0x21')](function(_0x376882){if(_0x376882){_0x263f43=_0x376882[_0x9c51('0x34')];if(!_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x35')](_0x9c51('0x36'))){_0x4fe1c9[_0x9c51('0x19')]=qs[_0x9c51('0x19')](_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x19')]);_0x4fe1c9[_0x9c51('0x18')]=qs['offset'](_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x18')]);}return _0x236d58['getSubjects'](_0x4fe1c9);}})[_0x9c51('0x21')](function(_0x4ee03b){if(_0x4ee03b){return _0x4ee03b?{'count':_0x263f43,'rows':_0x4ee03b}:null;}})[_0x9c51('0x21')](respondWithResult(_0x10ad68,null))['catch'](handleError(_0x10ad68,null));};exports[_0x9c51('0x4c')]=function(_0x2da1c2,_0x8dcca4,_0x2c0c4b){var _0x4adec2={};var _0x144c4f={};var _0x4a20b9;var _0xcb0ac2;return db[_0x9c51('0x28')][_0x9c51('0x48')]({'where':{'id':_0x2da1c2[_0x9c51('0x46')]['id']}})['then'](handleEntityNotFound(_0x8dcca4,null))[_0x9c51('0x21')](function(_0xf4be83){if(_0xf4be83){_0x4a20b9=_0xf4be83;_0x144c4f[_0x9c51('0x2d')]=_[_0x9c51('0x43')](db[_0x9c51('0x49')][_0x9c51('0x29')]);_0x144c4f['query']=_['keys'](_0x2da1c2[_0x9c51('0x2f')]);_0x144c4f[_0x9c51('0x30')]=_[_0x9c51('0x31')](_0x144c4f[_0x9c51('0x2d')],_0x144c4f[_0x9c51('0x2f')]);_0x4adec2[_0x9c51('0x32')]=_['intersection'](_0x144c4f[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0x2da1c2[_0x9c51('0x2f')][_0x9c51('0x33')]));_0x4adec2[_0x9c51('0x32')]=_0x4adec2[_0x9c51('0x32')]['length']?_0x4adec2['attributes']:_0x144c4f[_0x9c51('0x2d')];_0x4adec2['order']=qs[_0x9c51('0x38')](_0x2da1c2['query'][_0x9c51('0x38')]);_0x4adec2[_0x9c51('0x39')]=qs['filters'](_[_0x9c51('0x4a')](_0x2da1c2[_0x9c51('0x2f')],_0x144c4f[_0x9c51('0x30')]));if(_0x2da1c2['query']['filter']){_0x4adec2[_0x9c51('0x39')]=_[_0x9c51('0x3b')](_0x4adec2[_0x9c51('0x39')],{'$or':_[_0x9c51('0x2e')](_0x4adec2[_0x9c51('0x32')],function(_0x1524de){var _0x158ab0={};_0x158ab0[_0x1524de]={'$like':'%'+_0x2da1c2[_0x9c51('0x2f')]['filter']+'%'};return _0x158ab0;})});}_0x4adec2=_['merge']({},_0x4adec2,_0x2da1c2[_0x9c51('0x3d')]);return _0x4a20b9[_0x9c51('0x4c')](_0x4adec2);}})[_0x9c51('0x21')](function(_0x30304a){if(_0x30304a){_0xcb0ac2=_0x30304a['length'];if(!_0x2da1c2[_0x9c51('0x2f')][_0x9c51('0x35')](_0x9c51('0x36'))){_0x4adec2[_0x9c51('0x19')]=qs['limit'](_0x2da1c2[_0x9c51('0x2f')][_0x9c51('0x19')]);_0x4adec2[_0x9c51('0x18')]=qs['offset'](_0x2da1c2[_0x9c51('0x2f')][_0x9c51('0x18')]);}return _0x4a20b9['getDescriptions'](_0x4adec2);}})[_0x9c51('0x21')](function(_0x358a37){if(_0x358a37){return _0x358a37?{'count':_0xcb0ac2,'rows':_0x358a37}:null;}})[_0x9c51('0x21')](respondWithResult(_0x8dcca4,null))[_0x9c51('0x41')](handleError(_0x8dcca4,null));}; \ No newline at end of file +var _0x3fec=['include','findAll','params','options','find','create','body','catch','getFields','findOne','hasOwnProperty','getSubjects','SalesforceField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','includeAll'];(function(_0x3dc8e2,_0x447e46){var _0x421970=function(_0x443e5b){while(--_0x443e5b){_0x3dc8e2['push'](_0x3dc8e2['shift']());}};_0x421970(++_0x447e46);}(_0x3fec,0x14d));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xc3fe('0x0'));var rimraf=require(_0xc3fe('0x1'));var zipdir=require(_0xc3fe('0x2'));var jsonpatch=require(_0xc3fe('0x3'));var rp=require(_0xc3fe('0x4'));var moment=require(_0xc3fe('0x5'));var BPromise=require(_0xc3fe('0x6'));var Mustache=require('mustache');var util=require(_0xc3fe('0x7'));var path=require('path');var sox=require(_0xc3fe('0x8'));var csv=require(_0xc3fe('0x9'));var ejs=require(_0xc3fe('0xa'));var fs=require('fs');var fs_extra=require(_0xc3fe('0xb'));var _=require(_0xc3fe('0xc'));var squel=require(_0xc3fe('0xd'));var crypto=require(_0xc3fe('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3fe('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc3fe('0x10'));var Papa=require(_0xc3fe('0x11'));var Redis=require('ioredis');var authService=require(_0xc3fe('0x12'));var qs=require(_0xc3fe('0x13'));var as=require(_0xc3fe('0x14'));var hardwareService=require(_0xc3fe('0x15'));var logger=require(_0xc3fe('0x16'))(_0xc3fe('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc3fe('0x18'))['db'];function respondWithStatusCode(_0x4d7696,_0x42eae8){_0x42eae8=_0x42eae8||0xcc;return function(_0xf25c6){if(_0xf25c6){return _0x4d7696[_0xc3fe('0x19')](_0x42eae8);}return _0x4d7696['status'](_0x42eae8)['end']();};}function respondWithResult(_0x27d1b1,_0x486393){_0x486393=_0x486393||0xc8;return function(_0x474812){if(_0x474812){return _0x27d1b1[_0xc3fe('0x1a')](_0x486393)[_0xc3fe('0x1b')](_0x474812);}};}function respondWithFilteredResult(_0x31bf3f,_0x947985){return function(_0x52c881){if(_0x52c881){var _0x34d6bb=typeof _0x947985[_0xc3fe('0x1c')]===_0xc3fe('0x1d')&&typeof _0x947985[_0xc3fe('0x1e')]===_0xc3fe('0x1d');var _0x548a14=_0x52c881[_0xc3fe('0x1f')];var _0x270f6d=_0x34d6bb?0x0:_0x947985['offset'];var _0x5a5f9a=_0x34d6bb?_0x52c881[_0xc3fe('0x1f')]:_0x947985['offset']+_0x947985['limit'];var _0x123065;if(_0x5a5f9a>=_0x548a14){_0x5a5f9a=_0x548a14;_0x123065=0xc8;}else{_0x123065=0xce;}_0x31bf3f[_0xc3fe('0x1a')](_0x123065);return _0x31bf3f[_0xc3fe('0x20')](_0xc3fe('0x21'),_0x270f6d+'-'+_0x5a5f9a+'/'+_0x548a14)[_0xc3fe('0x1b')](_0x52c881);}return null;};}function patchUpdates(_0x56a27b){return function(_0x30bca7){try{jsonpatch[_0xc3fe('0x22')](_0x30bca7,_0x56a27b,!![]);}catch(_0x10c478){return BPromise[_0xc3fe('0x23')](_0x10c478);}return _0x30bca7[_0xc3fe('0x24')]();};}function saveUpdates(_0x409873,_0x5fb20c){return function(_0x4144a7){if(_0x4144a7){return _0x4144a7[_0xc3fe('0x25')](_0x409873)[_0xc3fe('0x26')](function(_0x5683cb){return _0x5683cb;});}return null;};}function removeEntity(_0xb10c0b,_0x3d3f02){return function(_0x13ede2){if(_0x13ede2){return _0x13ede2['destroy']()['then'](function(){_0xb10c0b['status'](0xcc)[_0xc3fe('0x27')]();});}};}function handleEntityNotFound(_0x38ac0f,_0x2cce08){return function(_0x5b8b94){if(!_0x5b8b94){_0x38ac0f[_0xc3fe('0x19')](0x194);}return _0x5b8b94;};}function handleError(_0x408461,_0x3012a0){_0x3012a0=_0x3012a0||0x1f4;return function(_0xcdb6a9){logger[_0xc3fe('0x28')](_0xcdb6a9[_0xc3fe('0x29')]);if(_0xcdb6a9[_0xc3fe('0x2a')]){delete _0xcdb6a9[_0xc3fe('0x2a')];}_0x408461[_0xc3fe('0x1a')](_0x3012a0)[_0xc3fe('0x2b')](_0xcdb6a9);};}exports['index']=function(_0x18ddd2,_0x493b85){var _0x359c36={},_0x122633={},_0x1b5168={'count':0x0,'rows':[]};var _0x1eb592=_[_0xc3fe('0x2c')](db[_0xc3fe('0x2d')][_0xc3fe('0x2e')],function(_0x823cc7){return{'name':_0x823cc7[_0xc3fe('0x2f')],'type':_0x823cc7[_0xc3fe('0x30')][_0xc3fe('0x31')]};});_0x122633[_0xc3fe('0x32')]=_[_0xc3fe('0x2c')](_0x1eb592,_0xc3fe('0x2a'));_0x122633[_0xc3fe('0x33')]=_[_0xc3fe('0x34')](_0x18ddd2[_0xc3fe('0x33')]);_0x122633[_0xc3fe('0x35')]=_[_0xc3fe('0x36')](_0x122633[_0xc3fe('0x32')],_0x122633[_0xc3fe('0x33')]);_0x359c36['attributes']=_['intersection'](_0x122633['model'],qs['fields'](_0x18ddd2[_0xc3fe('0x33')][_0xc3fe('0x37')]));_0x359c36[_0xc3fe('0x38')]=_0x359c36['attributes'][_0xc3fe('0x39')]?_0x359c36[_0xc3fe('0x38')]:_0x122633[_0xc3fe('0x32')];if(!_0x18ddd2[_0xc3fe('0x33')]['hasOwnProperty'](_0xc3fe('0x3a'))){_0x359c36[_0xc3fe('0x1e')]=qs[_0xc3fe('0x1e')](_0x18ddd2[_0xc3fe('0x33')][_0xc3fe('0x1e')]);_0x359c36[_0xc3fe('0x1c')]=qs['offset'](_0x18ddd2[_0xc3fe('0x33')][_0xc3fe('0x1c')]);}_0x359c36[_0xc3fe('0x3b')]=qs[_0xc3fe('0x3c')](_0x18ddd2[_0xc3fe('0x33')][_0xc3fe('0x3c')]);_0x359c36['where']=qs[_0xc3fe('0x35')](_[_0xc3fe('0x3d')](_0x18ddd2['query'],_0x122633[_0xc3fe('0x35')]),_0x1eb592);if(_0x18ddd2[_0xc3fe('0x33')]['filter']){_0x359c36['where']=_[_0xc3fe('0x3e')](_0x359c36[_0xc3fe('0x3f')],{'$or':_[_0xc3fe('0x2c')](_0x1eb592,function(_0x5cb6b9){if(_0x5cb6b9[_0xc3fe('0x30')]!==_0xc3fe('0x40')){var _0x5157f9={};_0x5157f9[_0x5cb6b9['name']]={'$like':'%'+_0x18ddd2['query'][_0xc3fe('0x41')]+'%'};return _0x5157f9;}})});}_0x359c36=_[_0xc3fe('0x3e')]({},_0x359c36,_0x18ddd2['options']);var _0xec6df8={'where':_0x359c36[_0xc3fe('0x3f')]};return db[_0xc3fe('0x2d')][_0xc3fe('0x1f')](_0xec6df8)[_0xc3fe('0x26')](function(_0x1a1479){_0x1b5168[_0xc3fe('0x1f')]=_0x1a1479;if(_0x18ddd2[_0xc3fe('0x33')][_0xc3fe('0x42')]){_0x359c36[_0xc3fe('0x43')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xc3fe('0x44')](_0x359c36);})['then'](function(_0x5431f1){_0x1b5168['rows']=_0x5431f1;return _0x1b5168;})[_0xc3fe('0x26')](respondWithFilteredResult(_0x493b85,_0x359c36))['catch'](handleError(_0x493b85,null));};exports['show']=function(_0x18535d,_0xf3621c){var _0xf1df50={'raw':![],'where':{'id':_0x18535d[_0xc3fe('0x45')]['id']}},_0x506d43={};_0x506d43[_0xc3fe('0x32')]=_[_0xc3fe('0x34')](db[_0xc3fe('0x2d')][_0xc3fe('0x2e')]);_0x506d43[_0xc3fe('0x33')]=_[_0xc3fe('0x34')](_0x18535d[_0xc3fe('0x33')]);_0x506d43[_0xc3fe('0x35')]=_[_0xc3fe('0x36')](_0x506d43[_0xc3fe('0x32')],_0x506d43[_0xc3fe('0x33')]);_0xf1df50['attributes']=_[_0xc3fe('0x36')](_0x506d43[_0xc3fe('0x32')],qs[_0xc3fe('0x37')](_0x18535d[_0xc3fe('0x33')][_0xc3fe('0x37')]));_0xf1df50[_0xc3fe('0x38')]=_0xf1df50[_0xc3fe('0x38')][_0xc3fe('0x39')]?_0xf1df50[_0xc3fe('0x38')]:_0x506d43['model'];if(_0x18535d['query']['includeAll']){_0xf1df50['include']=[{'all':!![]}];}_0xf1df50=_[_0xc3fe('0x3e')]({},_0xf1df50,_0x18535d[_0xc3fe('0x46')]);return db['SalesforceConfiguration'][_0xc3fe('0x47')](_0xf1df50)[_0xc3fe('0x26')](handleEntityNotFound(_0xf3621c,null))[_0xc3fe('0x26')](respondWithResult(_0xf3621c,null))['catch'](handleError(_0xf3621c,null));};exports[_0xc3fe('0x48')]=function(_0x158e7d,_0x46d9ac){return db[_0xc3fe('0x2d')]['create'](_0x158e7d[_0xc3fe('0x49')],{})['then'](respondWithResult(_0x46d9ac,0xc9))[_0xc3fe('0x4a')](handleError(_0x46d9ac,null));};exports[_0xc3fe('0x25')]=function(_0x38f670,_0x3b75d9){if(_0x38f670[_0xc3fe('0x49')]['id']){delete _0x38f670['body']['id'];}return db[_0xc3fe('0x2d')][_0xc3fe('0x47')]({'where':{'id':_0x38f670[_0xc3fe('0x45')]['id']}})[_0xc3fe('0x26')](handleEntityNotFound(_0x3b75d9,null))[_0xc3fe('0x26')](saveUpdates(_0x38f670['body'],null))[_0xc3fe('0x26')](respondWithResult(_0x3b75d9,null))[_0xc3fe('0x4a')](handleError(_0x3b75d9,null));};exports['destroy']=function(_0x3e6826,_0x479777){return db[_0xc3fe('0x2d')][_0xc3fe('0x47')]({'where':{'id':_0x3e6826[_0xc3fe('0x45')]['id']}})[_0xc3fe('0x26')](handleEntityNotFound(_0x479777,null))['then'](removeEntity(_0x479777,null))[_0xc3fe('0x4a')](handleError(_0x479777,null));};exports[_0xc3fe('0x4b')]=function(_0x527798,_0x4e7002,_0x41fc94){var _0xf9028d={};var _0xd4c0cd={};var _0x1937f8;var _0x3df525;return db[_0xc3fe('0x2d')][_0xc3fe('0x4c')]({'where':{'id':_0x527798[_0xc3fe('0x45')]['id']}})[_0xc3fe('0x26')](handleEntityNotFound(_0x4e7002,null))['then'](function(_0x3bfa13){if(_0x3bfa13){_0x1937f8=_0x3bfa13;_0xd4c0cd[_0xc3fe('0x32')]=_[_0xc3fe('0x34')](db['SalesforceField'][_0xc3fe('0x2e')]);_0xd4c0cd[_0xc3fe('0x33')]=_['keys'](_0x527798['query']);_0xd4c0cd[_0xc3fe('0x35')]=_[_0xc3fe('0x36')](_0xd4c0cd[_0xc3fe('0x32')],_0xd4c0cd[_0xc3fe('0x33')]);_0xf9028d[_0xc3fe('0x38')]=_[_0xc3fe('0x36')](_0xd4c0cd['model'],qs[_0xc3fe('0x37')](_0x527798[_0xc3fe('0x33')][_0xc3fe('0x37')]));_0xf9028d[_0xc3fe('0x38')]=_0xf9028d[_0xc3fe('0x38')][_0xc3fe('0x39')]?_0xf9028d[_0xc3fe('0x38')]:_0xd4c0cd[_0xc3fe('0x32')];_0xf9028d[_0xc3fe('0x3b')]=qs[_0xc3fe('0x3c')](_0x527798['query'][_0xc3fe('0x3c')]);_0xf9028d[_0xc3fe('0x3f')]=qs['filters'](_['pick'](_0x527798[_0xc3fe('0x33')],_0xd4c0cd[_0xc3fe('0x35')]));if(_0x527798['query']['filter']){_0xf9028d[_0xc3fe('0x3f')]=_[_0xc3fe('0x3e')](_0xf9028d[_0xc3fe('0x3f')],{'$or':_[_0xc3fe('0x2c')](_0xf9028d[_0xc3fe('0x38')],function(_0x58be6e){var _0x480706={};_0x480706[_0x58be6e]={'$like':'%'+_0x527798[_0xc3fe('0x33')][_0xc3fe('0x41')]+'%'};return _0x480706;})});}_0xf9028d=_[_0xc3fe('0x3e')]({},_0xf9028d,_0x527798['options']);return _0x1937f8[_0xc3fe('0x4b')](_0xf9028d);}})[_0xc3fe('0x26')](function(_0x57423e){if(_0x57423e){_0x3df525=_0x57423e[_0xc3fe('0x39')];if(!_0x527798[_0xc3fe('0x33')][_0xc3fe('0x4d')](_0xc3fe('0x3a'))){_0xf9028d[_0xc3fe('0x1e')]=qs[_0xc3fe('0x1e')](_0x527798[_0xc3fe('0x33')][_0xc3fe('0x1e')]);_0xf9028d[_0xc3fe('0x1c')]=qs[_0xc3fe('0x1c')](_0x527798[_0xc3fe('0x33')][_0xc3fe('0x1c')]);}return _0x1937f8[_0xc3fe('0x4b')](_0xf9028d);}})[_0xc3fe('0x26')](function(_0x4f0606){if(_0x4f0606){return _0x4f0606?{'count':_0x3df525,'rows':_0x4f0606}:null;}})[_0xc3fe('0x26')](respondWithResult(_0x4e7002,null))[_0xc3fe('0x4a')](handleError(_0x4e7002,null));};exports[_0xc3fe('0x4e')]=function(_0xeb4f1d,_0x265acf,_0x52f68e){var _0x256811={};var _0x54ce9c={};var _0x2c2a24;var _0x8b0ef5;return db[_0xc3fe('0x2d')][_0xc3fe('0x4c')]({'where':{'id':_0xeb4f1d['params']['id']}})[_0xc3fe('0x26')](handleEntityNotFound(_0x265acf,null))[_0xc3fe('0x26')](function(_0x1c8feb){if(_0x1c8feb){_0x2c2a24=_0x1c8feb;_0x54ce9c[_0xc3fe('0x32')]=_[_0xc3fe('0x34')](db[_0xc3fe('0x4f')][_0xc3fe('0x2e')]);_0x54ce9c['query']=_['keys'](_0xeb4f1d[_0xc3fe('0x33')]);_0x54ce9c[_0xc3fe('0x35')]=_[_0xc3fe('0x36')](_0x54ce9c[_0xc3fe('0x32')],_0x54ce9c[_0xc3fe('0x33')]);_0x256811[_0xc3fe('0x38')]=_['intersection'](_0x54ce9c[_0xc3fe('0x32')],qs[_0xc3fe('0x37')](_0xeb4f1d[_0xc3fe('0x33')][_0xc3fe('0x37')]));_0x256811[_0xc3fe('0x38')]=_0x256811[_0xc3fe('0x38')]['length']?_0x256811[_0xc3fe('0x38')]:_0x54ce9c[_0xc3fe('0x32')];_0x256811['order']=qs[_0xc3fe('0x3c')](_0xeb4f1d[_0xc3fe('0x33')]['sort']);_0x256811[_0xc3fe('0x3f')]=qs[_0xc3fe('0x35')](_['pick'](_0xeb4f1d[_0xc3fe('0x33')],_0x54ce9c[_0xc3fe('0x35')]));if(_0xeb4f1d[_0xc3fe('0x33')]['filter']){_0x256811[_0xc3fe('0x3f')]=_[_0xc3fe('0x3e')](_0x256811[_0xc3fe('0x3f')],{'$or':_[_0xc3fe('0x2c')](_0x256811[_0xc3fe('0x38')],function(_0x4baade){var _0x262797={};_0x262797[_0x4baade]={'$like':'%'+_0xeb4f1d['query']['filter']+'%'};return _0x262797;})});}_0x256811=_[_0xc3fe('0x3e')]({},_0x256811,_0xeb4f1d[_0xc3fe('0x46')]);return _0x2c2a24[_0xc3fe('0x4e')](_0x256811);}})[_0xc3fe('0x26')](function(_0x3e7518){if(_0x3e7518){_0x8b0ef5=_0x3e7518[_0xc3fe('0x39')];if(!_0xeb4f1d['query'][_0xc3fe('0x4d')]('nolimit')){_0x256811[_0xc3fe('0x1e')]=qs[_0xc3fe('0x1e')](_0xeb4f1d[_0xc3fe('0x33')]['limit']);_0x256811[_0xc3fe('0x1c')]=qs[_0xc3fe('0x1c')](_0xeb4f1d['query'][_0xc3fe('0x1c')]);}return _0x2c2a24['getSubjects'](_0x256811);}})['then'](function(_0xe0a9c3){if(_0xe0a9c3){return _0xe0a9c3?{'count':_0x8b0ef5,'rows':_0xe0a9c3}:null;}})[_0xc3fe('0x26')](respondWithResult(_0x265acf,null))[_0xc3fe('0x4a')](handleError(_0x265acf,null));};exports['getDescriptions']=function(_0x1b1160,_0x5ae76c,_0x43471d){var _0x4c9871={};var _0xd09a88={};var _0x295be9;var _0x33df34;return db['SalesforceConfiguration'][_0xc3fe('0x4c')]({'where':{'id':_0x1b1160[_0xc3fe('0x45')]['id']}})[_0xc3fe('0x26')](handleEntityNotFound(_0x5ae76c,null))[_0xc3fe('0x26')](function(_0x295350){if(_0x295350){_0x295be9=_0x295350;_0xd09a88[_0xc3fe('0x32')]=_[_0xc3fe('0x34')](db['SalesforceField']['rawAttributes']);_0xd09a88['query']=_[_0xc3fe('0x34')](_0x1b1160[_0xc3fe('0x33')]);_0xd09a88[_0xc3fe('0x35')]=_[_0xc3fe('0x36')](_0xd09a88[_0xc3fe('0x32')],_0xd09a88['query']);_0x4c9871[_0xc3fe('0x38')]=_[_0xc3fe('0x36')](_0xd09a88[_0xc3fe('0x32')],qs[_0xc3fe('0x37')](_0x1b1160[_0xc3fe('0x33')][_0xc3fe('0x37')]));_0x4c9871[_0xc3fe('0x38')]=_0x4c9871[_0xc3fe('0x38')][_0xc3fe('0x39')]?_0x4c9871[_0xc3fe('0x38')]:_0xd09a88[_0xc3fe('0x32')];_0x4c9871[_0xc3fe('0x3b')]=qs[_0xc3fe('0x3c')](_0x1b1160[_0xc3fe('0x33')][_0xc3fe('0x3c')]);_0x4c9871[_0xc3fe('0x3f')]=qs[_0xc3fe('0x35')](_[_0xc3fe('0x3d')](_0x1b1160[_0xc3fe('0x33')],_0xd09a88[_0xc3fe('0x35')]));if(_0x1b1160[_0xc3fe('0x33')][_0xc3fe('0x41')]){_0x4c9871[_0xc3fe('0x3f')]=_['merge'](_0x4c9871[_0xc3fe('0x3f')],{'$or':_[_0xc3fe('0x2c')](_0x4c9871[_0xc3fe('0x38')],function(_0x39dd90){var _0x2e1a2e={};_0x2e1a2e[_0x39dd90]={'$like':'%'+_0x1b1160['query'][_0xc3fe('0x41')]+'%'};return _0x2e1a2e;})});}_0x4c9871=_[_0xc3fe('0x3e')]({},_0x4c9871,_0x1b1160[_0xc3fe('0x46')]);return _0x295be9['getDescriptions'](_0x4c9871);}})[_0xc3fe('0x26')](function(_0x54dc11){if(_0x54dc11){_0x33df34=_0x54dc11[_0xc3fe('0x39')];if(!_0x1b1160['query'][_0xc3fe('0x4d')]('nolimit')){_0x4c9871[_0xc3fe('0x1e')]=qs[_0xc3fe('0x1e')](_0x1b1160[_0xc3fe('0x33')][_0xc3fe('0x1e')]);_0x4c9871[_0xc3fe('0x1c')]=qs[_0xc3fe('0x1c')](_0x1b1160[_0xc3fe('0x33')]['offset']);}return _0x295be9['getDescriptions'](_0x4c9871);}})[_0xc3fe('0x26')](function(_0x525d94){if(_0x525d94){return _0x525d94?{'count':_0x33df34,'rows':_0x525d94}:null;}})['then'](respondWithResult(_0x5ae76c,null))[_0xc3fe('0x4a')](handleError(_0x5ae76c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 8a96874..39b83c2 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 _0x304c=['define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','moment','request-promise','path','../../config/environment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x304c,0xb7));var _0xc304=function(_0x5dfd6d,_0x4d5431){_0x5dfd6d=_0x5dfd6d-0x0;var _0x3a7ce8=_0x304c[_0x5dfd6d];return _0x3a7ce8;};'use strict';var _=require('lodash');var util=require(_0xc304('0x0'));var logger=require(_0xc304('0x1'))('api');var moment=require(_0xc304('0x2'));var BPromise=require('bluebird');var rp=require(_0xc304('0x3'));var fs=require('fs');var path=require(_0xc304('0x4'));var rimraf=require('rimraf');var config=require(_0xc304('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xc304('0x6')]=function(_0x3f91f7,_0x1a8d49){return _0x3f91f7[_0xc304('0x7')](_0xc304('0x8'),attributes,{'tableName':_0xc304('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1541=['../../config/environment','exports','define','SalesforceConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x136e5e,_0x2d5726){var _0x3427c1=function(_0x437cef){while(--_0x437cef){_0x136e5e['push'](_0x136e5e['shift']());}};_0x3427c1(++_0x2d5726);}(_0x1541,0x138));var _0x1154=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0x1541[_0x1406ae];return _0x23a076;};'use strict';var _=require(_0x1154('0x0'));var util=require(_0x1154('0x1'));var logger=require(_0x1154('0x2'))(_0x1154('0x3'));var moment=require(_0x1154('0x4'));var BPromise=require(_0x1154('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1154('0x6'));var rimraf=require('rimraf');var config=require(_0x1154('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x1154('0x8')]=function(_0x1e45d4,_0x553b20){return _0x1e45d4[_0x1154('0x9')](_0x1154('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 6c78856..fcc7178 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 _0x7000=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7000,0x159));var _0x0700=function(_0xef7b42,_0xf9ab01){_0xef7b42=_0xef7b42-0x0;var _0x5c3893=_0x7000[_0xef7b42];return _0x5c3893;};'use strict';var _=require(_0x0700('0x0'));var util=require(_0x0700('0x1'));var moment=require(_0x0700('0x2'));var BPromise=require(_0x0700('0x3'));var rs=require(_0x0700('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0700('0x5'))['db'];var utils=require(_0x0700('0x6'));var logger=require(_0x0700('0x7'))(_0x0700('0x8'));var config=require(_0x0700('0x9'));var jayson=require(_0x0700('0xa'));var client=jayson['client'][_0x0700('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9021,_0x54ac31,_0x377a2a){return new BPromise(function(_0x3518ca,_0x1e6976){return client['request'](_0x3f9021,_0x377a2a)[_0x0700('0xc')](function(_0x1a435c){logger[_0x0700('0xd')](_0x0700('0xe'),_0x54ac31,'request\x20sent');logger[_0x0700('0xf')](_0x0700('0x10'),_0x54ac31,_0x0700('0x11'),JSON['stringify'](_0x1a435c));if(_0x1a435c[_0x0700('0x12')]){if(_0x1a435c[_0x0700('0x12')][_0x0700('0x13')]===0x1f4){logger[_0x0700('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x54ac31,_0x1a435c[_0x0700('0x12')]['message']);return _0x1e6976(_0x1a435c['error'][_0x0700('0x14')]);}logger['error'](_0x0700('0xe'),_0x54ac31,_0x1a435c['error']['message']);return _0x3518ca(_0x1a435c['error'][_0x0700('0x14')]);}else{logger[_0x0700('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x54ac31,_0x0700('0x11'));_0x3518ca(_0x1a435c[_0x0700('0x15')][_0x0700('0x14')]);}})[_0x0700('0x16')](function(_0x3d021e){logger[_0x0700('0x12')](_0x0700('0xe'),_0x54ac31,_0x3d021e);_0x1e6976(_0x3d021e);});});} \ No newline at end of file +var _0x5150=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x562bb5,_0x34fdd4){var _0x34bb21=function(_0x243d79){while(--_0x243d79){_0x562bb5['push'](_0x562bb5['shift']());}};_0x34bb21(++_0x34fdd4);}(_0x5150,0x18e));var _0x0515=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x5150[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require(_0x0515('0x0'));var moment=require(_0x0515('0x1'));var BPromise=require(_0x0515('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0515('0x3'));var db=require(_0x0515('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0515('0x5')][_0x0515('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4516d5,_0x416018,_0xa4ba55){return new BPromise(function(_0xd8999d,_0x31964e){return client['request'](_0x4516d5,_0xa4ba55)['then'](function(_0x54a10b){logger[_0x0515('0x7')](_0x0515('0x8'),_0x416018,_0x0515('0x9'));logger['debug'](_0x0515('0xa'),_0x416018,'request\x20sent',JSON[_0x0515('0xb')](_0x54a10b));if(_0x54a10b[_0x0515('0xc')]){if(_0x54a10b[_0x0515('0xc')][_0x0515('0xd')]===0x1f4){logger[_0x0515('0xc')](_0x0515('0x8'),_0x416018,_0x54a10b[_0x0515('0xc')][_0x0515('0xe')]);return _0x31964e(_0x54a10b[_0x0515('0xc')][_0x0515('0xe')]);}logger[_0x0515('0xc')](_0x0515('0x8'),_0x416018,_0x54a10b[_0x0515('0xc')][_0x0515('0xe')]);return _0xd8999d(_0x54a10b[_0x0515('0xc')][_0x0515('0xe')]);}else{logger[_0x0515('0x7')]('SalesforceConfiguration,\x20%s,\x20%s',_0x416018,'request\x20sent');_0xd8999d(_0x54a10b[_0x0515('0xf')][_0x0515('0xe')]);}})[_0x0515('0x10')](function(_0x2022c5){logger[_0x0515('0xc')](_0x0515('0x8'),_0x416018,_0x2022c5);_0x31964e(_0x2022c5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index e10bad7..afc7cc0 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 _0x244c=['/:id','show','post','create','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x244c,0xe0));var _0xc244=function(_0x23ab55,_0x399df5){_0x23ab55=_0x23ab55-0x0;var _0x4507c1=_0x244c[_0x23ab55];return _0x4507c1;};'use strict';var multer=require(_0xc244('0x0'));var util=require(_0xc244('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc244('0x2'));var router=express[_0xc244('0x3')]();var fs_extra=require(_0xc244('0x4'));var auth=require(_0xc244('0x5'));var interaction=require(_0xc244('0x6'));var config=require(_0xc244('0x7'));var controller=require(_0xc244('0x8'));router['get']('/',auth[_0xc244('0x9')](),controller['index']);router['get'](_0xc244('0xa'),auth['isAuthenticated'](),controller[_0xc244('0xb')]);router[_0xc244('0xc')]('/',auth[_0xc244('0x9')](),controller[_0xc244('0xd')]);router[_0xc244('0xe')](_0xc244('0xa'),auth[_0xc244('0x9')](),controller['update']);router[_0xc244('0xf')](_0xc244('0xa'),auth[_0xc244('0x9')](),controller[_0xc244('0x10')]);module[_0xc244('0x11')]=router; \ No newline at end of file +var _0x40ae=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','create','update'];(function(_0x23445d,_0x371efe){var _0x928037=function(_0x373920){while(--_0x373920){_0x23445d['push'](_0x23445d['shift']());}};_0x928037(++_0x371efe);}(_0x40ae,0xc7));var _0xe40a=function(_0x501851,_0x10a9ee){_0x501851=_0x501851-0x0;var _0x15d0e7=_0x40ae[_0x501851];return _0x15d0e7;};'use strict';var multer=require(_0xe40a('0x0'));var util=require(_0xe40a('0x1'));var path=require(_0xe40a('0x2'));var timeout=require(_0xe40a('0x3'));var express=require(_0xe40a('0x4'));var router=express[_0xe40a('0x5')]();var fs_extra=require(_0xe40a('0x6'));var auth=require(_0xe40a('0x7'));var interaction=require(_0xe40a('0x8'));var config=require(_0xe40a('0x9'));var controller=require(_0xe40a('0xa'));router[_0xe40a('0xb')]('/',auth[_0xe40a('0xc')](),controller[_0xe40a('0xd')]);router['get'](_0xe40a('0xe'),auth[_0xe40a('0xc')](),controller['show']);router['post']('/',auth[_0xe40a('0xc')](),controller[_0xe40a('0xf')]);router['put'](_0xe40a('0xe'),auth[_0xe40a('0xc')](),controller[_0xe40a('0x10')]);router['delete'](_0xe40a('0xe'),auth[_0xe40a('0xc')](),controller[_0xe40a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index fe30b90..fbf7fd5 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 _0xf37f=['STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x6489f6,_0xde8e10){var _0xa566db=function(_0x4ec70a){while(--_0x4ec70a){_0x6489f6['push'](_0x6489f6['shift']());}};_0xa566db(++_0xde8e10);}(_0xf37f,0x1f1));var _0xff37=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0xf37f[_0xa9a245];return _0x2d0eaa;};'use strict';var Sequelize=require(_0xff37('0x0'));module[_0xff37('0x1')]={'type':{'type':Sequelize['ENUM'](_0xff37('0x2'),_0xff37('0x3'),_0xff37('0x4'),_0xff37('0x5'),_0xff37('0x6')),'defaultValue':_0xff37('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xff37('0x7')]},'keyType':{'type':Sequelize[_0xff37('0x8')](_0xff37('0x2'),_0xff37('0x3'),_0xff37('0x4'))},'keyContent':{'type':Sequelize[_0xff37('0x7')]},'idField':{'type':Sequelize[_0xff37('0x7')]},'variableName':{'type':Sequelize[_0xff37('0x7')]}}; \ No newline at end of file +var _0x5f67=['ENUM','string','keyValue','STRING','variable','customVariable'];(function(_0x139f5c,_0x56814f){var _0x24b9c2=function(_0x5eb0bd){while(--_0x5eb0bd){_0x139f5c['push'](_0x139f5c['shift']());}};_0x24b9c2(++_0x56814f);}(_0x5f67,0xae));var _0x75f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f67[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x75f6('0x0')](_0x75f6('0x1'),'variable','customVariable',_0x75f6('0x2'),'picklist'),'defaultValue':_0x75f6('0x1')},'content':{'type':Sequelize[_0x75f6('0x3')]},'key':{'type':Sequelize[_0x75f6('0x3')]},'keyType':{'type':Sequelize[_0x75f6('0x0')](_0x75f6('0x1'),_0x75f6('0x4'),_0x75f6('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x75f6('0x3')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index d42e61c..2fe5bab 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 _0x2eaf=['moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','request-promise'];(function(_0x3be715,_0x54cb1f){var _0x10406b=function(_0x40f083){while(--_0x40f083){_0x3be715['push'](_0x3be715['shift']());}};_0x10406b(++_0x54cb1f);}(_0x2eaf,0x11d));var _0xf2ea=function(_0x39b249,_0x572bb7){_0x39b249=_0x39b249-0x0;var _0x3ea44a=_0x2eaf[_0x39b249];return _0x3ea44a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2ea('0x0'));var zipdir=require(_0xf2ea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2ea('0x2'));var moment=require(_0xf2ea('0x3'));var BPromise=require(_0xf2ea('0x4'));var Mustache=require(_0xf2ea('0x5'));var util=require(_0xf2ea('0x6'));var path=require(_0xf2ea('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf2ea('0x8'));var fs=require('fs');var fs_extra=require(_0xf2ea('0x9'));var _=require('lodash');var squel=require(_0xf2ea('0xa'));var crypto=require('crypto');var jsforce=require(_0xf2ea('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf2ea('0xc'));var querystring=require(_0xf2ea('0xd'));var Papa=require(_0xf2ea('0xe'));var Redis=require(_0xf2ea('0xf'));var authService=require(_0xf2ea('0x10'));var qs=require(_0xf2ea('0x11'));var as=require(_0xf2ea('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2ea('0x13'))(_0xf2ea('0x14'));var utils=require(_0xf2ea('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf72e0b,_0x55abb5){_0x55abb5=_0x55abb5||0xcc;return function(_0x3b4c5c){if(_0x3b4c5c){return _0xf72e0b[_0xf2ea('0x16')](_0x55abb5);}return _0xf72e0b[_0xf2ea('0x17')](_0x55abb5)[_0xf2ea('0x18')]();};}function respondWithResult(_0x150c2b,_0x1d91e2){_0x1d91e2=_0x1d91e2||0xc8;return function(_0x5f2e71){if(_0x5f2e71){return _0x150c2b['status'](_0x1d91e2)[_0xf2ea('0x19')](_0x5f2e71);}};}function respondWithFilteredResult(_0x153dce,_0x2c6c4d){return function(_0x2133ac){if(_0x2133ac){var _0x938689=typeof _0x2c6c4d[_0xf2ea('0x1a')]==='undefined'&&typeof _0x2c6c4d[_0xf2ea('0x1b')]===_0xf2ea('0x1c');var _0x869fd1=_0x2133ac[_0xf2ea('0x1d')];var _0xbe3a53=_0x938689?0x0:_0x2c6c4d[_0xf2ea('0x1a')];var _0x1fc92e=_0x938689?_0x2133ac['count']:_0x2c6c4d['offset']+_0x2c6c4d[_0xf2ea('0x1b')];var _0x5f2f5e;if(_0x1fc92e>=_0x869fd1){_0x1fc92e=_0x869fd1;_0x5f2f5e=0xc8;}else{_0x5f2f5e=0xce;}_0x153dce['status'](_0x5f2f5e);return _0x153dce['set'](_0xf2ea('0x1e'),_0xbe3a53+'-'+_0x1fc92e+'/'+_0x869fd1)[_0xf2ea('0x19')](_0x2133ac);}return null;};}function patchUpdates(_0x56830f){return function(_0x5a7b31){try{jsonpatch[_0xf2ea('0x1f')](_0x5a7b31,_0x56830f,!![]);}catch(_0x2fc429){return BPromise[_0xf2ea('0x20')](_0x2fc429);}return _0x5a7b31[_0xf2ea('0x21')]();};}function saveUpdates(_0x2ab888,_0x17b011){return function(_0x4615b0){if(_0x4615b0){return _0x4615b0[_0xf2ea('0x22')](_0x2ab888)[_0xf2ea('0x23')](function(_0x321527){return _0x321527;});}return null;};}function removeEntity(_0x10c15d,_0x5849e1){return function(_0x159f66){if(_0x159f66){return _0x159f66[_0xf2ea('0x24')]()[_0xf2ea('0x23')](function(){_0x10c15d[_0xf2ea('0x17')](0xcc)[_0xf2ea('0x18')]();});}};}function handleEntityNotFound(_0x383406,_0xf0d055){return function(_0x3f1f28){if(!_0x3f1f28){_0x383406[_0xf2ea('0x16')](0x194);}return _0x3f1f28;};}function handleError(_0x1c83fa,_0x3b414a){_0x3b414a=_0x3b414a||0x1f4;return function(_0x59a6ac){logger[_0xf2ea('0x25')](_0x59a6ac['stack']);if(_0x59a6ac[_0xf2ea('0x26')]){delete _0x59a6ac['name'];}_0x1c83fa[_0xf2ea('0x17')](_0x3b414a)[_0xf2ea('0x27')](_0x59a6ac);};}exports[_0xf2ea('0x28')]=function(_0x19bb1a,_0x1847b6){var _0x4cfc25={},_0x1e3e5b={},_0x353370={'count':0x0,'rows':[]};var _0x3546b3=_[_0xf2ea('0x29')](db[_0xf2ea('0x2a')][_0xf2ea('0x2b')],function(_0x49c67f){return{'name':_0x49c67f[_0xf2ea('0x2c')],'type':_0x49c67f[_0xf2ea('0x2d')][_0xf2ea('0x2e')]};});_0x1e3e5b[_0xf2ea('0x2f')]=_[_0xf2ea('0x29')](_0x3546b3,'name');_0x1e3e5b[_0xf2ea('0x30')]=_[_0xf2ea('0x31')](_0x19bb1a[_0xf2ea('0x30')]);_0x1e3e5b[_0xf2ea('0x32')]=_[_0xf2ea('0x33')](_0x1e3e5b[_0xf2ea('0x2f')],_0x1e3e5b[_0xf2ea('0x30')]);_0x4cfc25[_0xf2ea('0x34')]=_['intersection'](_0x1e3e5b[_0xf2ea('0x2f')],qs[_0xf2ea('0x35')](_0x19bb1a[_0xf2ea('0x30')][_0xf2ea('0x35')]));_0x4cfc25[_0xf2ea('0x34')]=_0x4cfc25['attributes']['length']?_0x4cfc25[_0xf2ea('0x34')]:_0x1e3e5b[_0xf2ea('0x2f')];if(!_0x19bb1a[_0xf2ea('0x30')]['hasOwnProperty'](_0xf2ea('0x36'))){_0x4cfc25[_0xf2ea('0x1b')]=qs[_0xf2ea('0x1b')](_0x19bb1a['query'][_0xf2ea('0x1b')]);_0x4cfc25[_0xf2ea('0x1a')]=qs[_0xf2ea('0x1a')](_0x19bb1a[_0xf2ea('0x30')][_0xf2ea('0x1a')]);}_0x4cfc25['order']=qs[_0xf2ea('0x37')](_0x19bb1a[_0xf2ea('0x30')][_0xf2ea('0x37')]);_0x4cfc25['where']=qs[_0xf2ea('0x32')](_[_0xf2ea('0x38')](_0x19bb1a[_0xf2ea('0x30')],_0x1e3e5b[_0xf2ea('0x32')]),_0x3546b3);if(_0x19bb1a['query'][_0xf2ea('0x39')]){_0x4cfc25['where']=_[_0xf2ea('0x3a')](_0x4cfc25[_0xf2ea('0x3b')],{'$or':_[_0xf2ea('0x29')](_0x3546b3,function(_0x191cf6){if(_0x191cf6['type']!==_0xf2ea('0x3c')){var _0x34b9c7={};_0x34b9c7[_0x191cf6[_0xf2ea('0x26')]]={'$like':'%'+_0x19bb1a[_0xf2ea('0x30')][_0xf2ea('0x39')]+'%'};return _0x34b9c7;}})});}_0x4cfc25=_[_0xf2ea('0x3a')]({},_0x4cfc25,_0x19bb1a[_0xf2ea('0x3d')]);var _0x5f3d9f={'where':_0x4cfc25[_0xf2ea('0x3b')]};return db[_0xf2ea('0x2a')][_0xf2ea('0x1d')](_0x5f3d9f)[_0xf2ea('0x23')](function(_0x4e39d3){_0x353370[_0xf2ea('0x1d')]=_0x4e39d3;if(_0x19bb1a[_0xf2ea('0x30')][_0xf2ea('0x3e')]){_0x4cfc25['include']=[{'all':!![]}];}return db[_0xf2ea('0x2a')][_0xf2ea('0x3f')](_0x4cfc25);})[_0xf2ea('0x23')](function(_0x1ef8d5){_0x353370[_0xf2ea('0x40')]=_0x1ef8d5;return _0x353370;})[_0xf2ea('0x23')](respondWithFilteredResult(_0x1847b6,_0x4cfc25))[_0xf2ea('0x41')](handleError(_0x1847b6,null));};exports[_0xf2ea('0x42')]=function(_0x1d49b5,_0xc4705c){var _0x1af06a={'raw':!![],'where':{'id':_0x1d49b5[_0xf2ea('0x43')]['id']}},_0x426346={};_0x426346[_0xf2ea('0x2f')]=_[_0xf2ea('0x31')](db['SalesforceField'][_0xf2ea('0x2b')]);_0x426346[_0xf2ea('0x30')]=_['keys'](_0x1d49b5[_0xf2ea('0x30')]);_0x426346['filters']=_[_0xf2ea('0x33')](_0x426346[_0xf2ea('0x2f')],_0x426346[_0xf2ea('0x30')]);_0x1af06a[_0xf2ea('0x34')]=_[_0xf2ea('0x33')](_0x426346[_0xf2ea('0x2f')],qs[_0xf2ea('0x35')](_0x1d49b5[_0xf2ea('0x30')][_0xf2ea('0x35')]));_0x1af06a['attributes']=_0x1af06a[_0xf2ea('0x34')]['length']?_0x1af06a[_0xf2ea('0x34')]:_0x426346['model'];if(_0x1d49b5[_0xf2ea('0x30')][_0xf2ea('0x3e')]){_0x1af06a[_0xf2ea('0x44')]=[{'all':!![]}];}_0x1af06a=_[_0xf2ea('0x3a')]({},_0x1af06a,_0x1d49b5[_0xf2ea('0x3d')]);return db[_0xf2ea('0x2a')][_0xf2ea('0x45')](_0x1af06a)[_0xf2ea('0x23')](handleEntityNotFound(_0xc4705c,null))['then'](respondWithResult(_0xc4705c,null))[_0xf2ea('0x41')](handleError(_0xc4705c,null));};exports['create']=function(_0xecb81d,_0x2941a7){return db[_0xf2ea('0x2a')][_0xf2ea('0x46')](_0xecb81d['body'],{})['then'](respondWithResult(_0x2941a7,0xc9))[_0xf2ea('0x41')](handleError(_0x2941a7,null));};exports[_0xf2ea('0x22')]=function(_0x502305,_0x5700a9){if(_0x502305[_0xf2ea('0x47')]['id']){delete _0x502305[_0xf2ea('0x47')]['id'];}return db[_0xf2ea('0x2a')]['find']({'where':{'id':_0x502305[_0xf2ea('0x43')]['id']}})['then'](handleEntityNotFound(_0x5700a9,null))[_0xf2ea('0x23')](saveUpdates(_0x502305[_0xf2ea('0x47')],null))[_0xf2ea('0x23')](respondWithResult(_0x5700a9,null))[_0xf2ea('0x41')](handleError(_0x5700a9,null));};exports[_0xf2ea('0x24')]=function(_0x121862,_0x55dde8){return db['SalesforceField'][_0xf2ea('0x45')]({'where':{'id':_0x121862[_0xf2ea('0x43')]['id']}})[_0xf2ea('0x23')](handleEntityNotFound(_0x55dde8,null))[_0xf2ea('0x23')](removeEntity(_0x55dde8,null))[_0xf2ea('0x41')](handleError(_0x55dde8,null));}; \ No newline at end of file +var _0xd96f=['sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','find','create','body','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','SalesforceField','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x218bcd,_0xd62bb7){var _0x318e06=function(_0xc011b1){while(--_0xc011b1){_0x218bcd['push'](_0x218bcd['shift']());}};_0x318e06(++_0xd62bb7);}(_0xd96f,0xfd));var _0xfd96=function(_0x31adc3,_0x1015d0){_0x31adc3=_0x31adc3-0x0;var _0x4cee80=_0xd96f[_0x31adc3];return _0x4cee80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd96('0x0'));var zipdir=require(_0xfd96('0x1'));var jsonpatch=require(_0xfd96('0x2'));var rp=require(_0xfd96('0x3'));var moment=require(_0xfd96('0x4'));var BPromise=require(_0xfd96('0x5'));var Mustache=require(_0xfd96('0x6'));var util=require(_0xfd96('0x7'));var path=require(_0xfd96('0x8'));var sox=require(_0xfd96('0x9'));var csv=require(_0xfd96('0xa'));var ejs=require(_0xfd96('0xb'));var fs=require('fs');var fs_extra=require(_0xfd96('0xc'));var _=require(_0xfd96('0xd'));var squel=require(_0xfd96('0xe'));var crypto=require(_0xfd96('0xf'));var jsforce=require(_0xfd96('0x10'));var deskjs=require(_0xfd96('0x11'));var toCsv=require(_0xfd96('0xa'));var querystring=require(_0xfd96('0x12'));var Papa=require(_0xfd96('0x13'));var Redis=require(_0xfd96('0x14'));var authService=require(_0xfd96('0x15'));var qs=require(_0xfd96('0x16'));var as=require(_0xfd96('0x17'));var hardwareService=require(_0xfd96('0x18'));var logger=require(_0xfd96('0x19'))(_0xfd96('0x1a'));var utils=require(_0xfd96('0x1b'));var config=require(_0xfd96('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd96('0x1d'))['db'];function respondWithStatusCode(_0x368435,_0x4ad3c2){_0x4ad3c2=_0x4ad3c2||0xcc;return function(_0x4d07fb){if(_0x4d07fb){return _0x368435[_0xfd96('0x1e')](_0x4ad3c2);}return _0x368435[_0xfd96('0x1f')](_0x4ad3c2)[_0xfd96('0x20')]();};}function respondWithResult(_0x1b6646,_0x2d5c11){_0x2d5c11=_0x2d5c11||0xc8;return function(_0x1ea0fd){if(_0x1ea0fd){return _0x1b6646[_0xfd96('0x1f')](_0x2d5c11)[_0xfd96('0x21')](_0x1ea0fd);}};}function respondWithFilteredResult(_0x2fb400,_0x302b33){return function(_0x1395e5){if(_0x1395e5){var _0xedbff4=typeof _0x302b33[_0xfd96('0x22')]==='undefined'&&typeof _0x302b33[_0xfd96('0x23')]===_0xfd96('0x24');var _0x4e8795=_0x1395e5[_0xfd96('0x25')];var _0x1d7dca=_0xedbff4?0x0:_0x302b33[_0xfd96('0x22')];var _0x252ef5=_0xedbff4?_0x1395e5['count']:_0x302b33[_0xfd96('0x22')]+_0x302b33[_0xfd96('0x23')];var _0x415e05;if(_0x252ef5>=_0x4e8795){_0x252ef5=_0x4e8795;_0x415e05=0xc8;}else{_0x415e05=0xce;}_0x2fb400['status'](_0x415e05);return _0x2fb400[_0xfd96('0x26')](_0xfd96('0x27'),_0x1d7dca+'-'+_0x252ef5+'/'+_0x4e8795)[_0xfd96('0x21')](_0x1395e5);}return null;};}function patchUpdates(_0x4997e5){return function(_0x3a2618){try{jsonpatch[_0xfd96('0x28')](_0x3a2618,_0x4997e5,!![]);}catch(_0x23a565){return BPromise['reject'](_0x23a565);}return _0x3a2618[_0xfd96('0x29')]();};}function saveUpdates(_0x54598f,_0x88cf1c){return function(_0x3e8344){if(_0x3e8344){return _0x3e8344[_0xfd96('0x2a')](_0x54598f)[_0xfd96('0x2b')](function(_0x554dd1){return _0x554dd1;});}return null;};}function removeEntity(_0x3c62a2,_0x156a72){return function(_0x3c747e){if(_0x3c747e){return _0x3c747e[_0xfd96('0x2c')]()['then'](function(){_0x3c62a2['status'](0xcc)[_0xfd96('0x20')]();});}};}function handleEntityNotFound(_0x5f09c1,_0x459537){return function(_0x16ad25){if(!_0x16ad25){_0x5f09c1['sendStatus'](0x194);}return _0x16ad25;};}function handleError(_0x304386,_0x4176a2){_0x4176a2=_0x4176a2||0x1f4;return function(_0x58ef26){logger[_0xfd96('0x2d')](_0x58ef26['stack']);if(_0x58ef26[_0xfd96('0x2e')]){delete _0x58ef26['name'];}_0x304386['status'](_0x4176a2)[_0xfd96('0x2f')](_0x58ef26);};}exports[_0xfd96('0x30')]=function(_0x253d3d,_0x24b4bd){var _0x501c86={},_0x9c57b1={},_0x470837={'count':0x0,'rows':[]};var _0x348875=_[_0xfd96('0x31')](db[_0xfd96('0x32')]['rawAttributes'],function(_0x3727f4){return{'name':_0x3727f4[_0xfd96('0x33')],'type':_0x3727f4[_0xfd96('0x34')][_0xfd96('0x35')]};});_0x9c57b1[_0xfd96('0x36')]=_[_0xfd96('0x31')](_0x348875,_0xfd96('0x2e'));_0x9c57b1[_0xfd96('0x37')]=_['keys'](_0x253d3d['query']);_0x9c57b1[_0xfd96('0x38')]=_[_0xfd96('0x39')](_0x9c57b1[_0xfd96('0x36')],_0x9c57b1['query']);_0x501c86[_0xfd96('0x3a')]=_[_0xfd96('0x39')](_0x9c57b1['model'],qs[_0xfd96('0x3b')](_0x253d3d['query']['fields']));_0x501c86[_0xfd96('0x3a')]=_0x501c86['attributes']['length']?_0x501c86[_0xfd96('0x3a')]:_0x9c57b1['model'];if(!_0x253d3d['query'][_0xfd96('0x3c')](_0xfd96('0x3d'))){_0x501c86[_0xfd96('0x23')]=qs[_0xfd96('0x23')](_0x253d3d[_0xfd96('0x37')][_0xfd96('0x23')]);_0x501c86['offset']=qs['offset'](_0x253d3d[_0xfd96('0x37')][_0xfd96('0x22')]);}_0x501c86[_0xfd96('0x3e')]=qs['sort'](_0x253d3d[_0xfd96('0x37')][_0xfd96('0x3f')]);_0x501c86[_0xfd96('0x40')]=qs['filters'](_['pick'](_0x253d3d['query'],_0x9c57b1[_0xfd96('0x38')]),_0x348875);if(_0x253d3d[_0xfd96('0x37')][_0xfd96('0x41')]){_0x501c86['where']=_[_0xfd96('0x42')](_0x501c86[_0xfd96('0x40')],{'$or':_[_0xfd96('0x31')](_0x348875,function(_0x4748c2){if(_0x4748c2[_0xfd96('0x34')]!==_0xfd96('0x43')){var _0x14a08f={};_0x14a08f[_0x4748c2[_0xfd96('0x2e')]]={'$like':'%'+_0x253d3d[_0xfd96('0x37')][_0xfd96('0x41')]+'%'};return _0x14a08f;}})});}_0x501c86=_[_0xfd96('0x42')]({},_0x501c86,_0x253d3d[_0xfd96('0x44')]);var _0x3e81ae={'where':_0x501c86['where']};return db['SalesforceField']['count'](_0x3e81ae)[_0xfd96('0x2b')](function(_0x5bfc9b){_0x470837['count']=_0x5bfc9b;if(_0x253d3d[_0xfd96('0x37')]['includeAll']){_0x501c86['include']=[{'all':!![]}];}return db[_0xfd96('0x32')][_0xfd96('0x45')](_0x501c86);})[_0xfd96('0x2b')](function(_0x436d39){_0x470837[_0xfd96('0x46')]=_0x436d39;return _0x470837;})[_0xfd96('0x2b')](respondWithFilteredResult(_0x24b4bd,_0x501c86))[_0xfd96('0x47')](handleError(_0x24b4bd,null));};exports[_0xfd96('0x48')]=function(_0x26110b,_0x29acf0){var _0x31c2c4={'raw':!![],'where':{'id':_0x26110b[_0xfd96('0x49')]['id']}},_0x5c24d4={};_0x5c24d4[_0xfd96('0x36')]=_[_0xfd96('0x4a')](db['SalesforceField']['rawAttributes']);_0x5c24d4[_0xfd96('0x37')]=_['keys'](_0x26110b['query']);_0x5c24d4[_0xfd96('0x38')]=_[_0xfd96('0x39')](_0x5c24d4[_0xfd96('0x36')],_0x5c24d4[_0xfd96('0x37')]);_0x31c2c4[_0xfd96('0x3a')]=_[_0xfd96('0x39')](_0x5c24d4['model'],qs[_0xfd96('0x3b')](_0x26110b[_0xfd96('0x37')][_0xfd96('0x3b')]));_0x31c2c4[_0xfd96('0x3a')]=_0x31c2c4[_0xfd96('0x3a')]['length']?_0x31c2c4[_0xfd96('0x3a')]:_0x5c24d4[_0xfd96('0x36')];if(_0x26110b[_0xfd96('0x37')][_0xfd96('0x4b')]){_0x31c2c4['include']=[{'all':!![]}];}_0x31c2c4=_['merge']({},_0x31c2c4,_0x26110b[_0xfd96('0x44')]);return db['SalesforceField'][_0xfd96('0x4c')](_0x31c2c4)['then'](handleEntityNotFound(_0x29acf0,null))[_0xfd96('0x2b')](respondWithResult(_0x29acf0,null))[_0xfd96('0x47')](handleError(_0x29acf0,null));};exports[_0xfd96('0x4d')]=function(_0x6557af,_0x1b3746){return db[_0xfd96('0x32')][_0xfd96('0x4d')](_0x6557af[_0xfd96('0x4e')],{})[_0xfd96('0x2b')](respondWithResult(_0x1b3746,0xc9))[_0xfd96('0x47')](handleError(_0x1b3746,null));};exports['update']=function(_0x160477,_0x2ad8a8){if(_0x160477['body']['id']){delete _0x160477[_0xfd96('0x4e')]['id'];}return db[_0xfd96('0x32')][_0xfd96('0x4c')]({'where':{'id':_0x160477[_0xfd96('0x49')]['id']}})[_0xfd96('0x2b')](handleEntityNotFound(_0x2ad8a8,null))[_0xfd96('0x2b')](saveUpdates(_0x160477[_0xfd96('0x4e')],null))[_0xfd96('0x2b')](respondWithResult(_0x2ad8a8,null))[_0xfd96('0x47')](handleError(_0x2ad8a8,null));};exports[_0xfd96('0x2c')]=function(_0xd9d7c6,_0x165a88){return db[_0xfd96('0x32')][_0xfd96('0x4c')]({'where':{'id':_0xd9d7c6[_0xfd96('0x49')]['id']}})['then'](handleEntityNotFound(_0x165a88,null))[_0xfd96('0x2b')](removeEntity(_0x165a88,null))[_0xfd96('0x47')](handleError(_0x165a88,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 84a6b8b..18f87d2 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 _0x2432=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x2432,0x18f));var _0x2243=function(_0x2ab02b,_0x44a225){_0x2ab02b=_0x2ab02b-0x0;var _0x1750ae=_0x2432[_0x2ab02b];return _0x1750ae;};'use strict';var _=require(_0x2243('0x0'));var util=require(_0x2243('0x1'));var logger=require(_0x2243('0x2'))(_0x2243('0x3'));var moment=require(_0x2243('0x4'));var BPromise=require(_0x2243('0x5'));var rp=require(_0x2243('0x6'));var fs=require('fs');var path=require(_0x2243('0x7'));var rimraf=require(_0x2243('0x8'));var config=require(_0x2243('0x9'));var attributes=require(_0x2243('0xa'));module[_0x2243('0xb')]=function(_0x47a1a8,_0x1bd703){return _0x47a1a8[_0x2243('0xc')](_0x2243('0xd'),attributes,{'tableName':_0x2243('0xe'),'paranoid':![],'indexes':[{'name':_0x2243('0xf'),'fields':['idField',_0x2243('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc536=['bluebird','request-promise','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x12291d,_0x5031f4){var _0x10eeb9=function(_0x1df29b){while(--_0x1df29b){_0x12291d['push'](_0x12291d['shift']());}};_0x10eeb9(++_0x5031f4);}(_0xc536,0x174));var _0x6c53=function(_0x5560ba,_0x4ea14b){_0x5560ba=_0x5560ba-0x0;var _0x3f9d6e=_0xc536[_0x5560ba];return _0x3f9d6e;};'use strict';var _=require(_0x6c53('0x0'));var util=require(_0x6c53('0x1'));var logger=require(_0x6c53('0x2'))(_0x6c53('0x3'));var moment=require(_0x6c53('0x4'));var BPromise=require(_0x6c53('0x5'));var rp=require(_0x6c53('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6c53('0x7'));module['exports']=function(_0x2c556c,_0x19fd0c){return _0x2c556c[_0x6c53('0x8')](_0x6c53('0x9'),attributes,{'tableName':_0x6c53('0xa'),'paranoid':![],'indexes':[{'name':_0x6c53('0xb'),'fields':['idField',_0x6c53('0xc')],'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 2b6d18b..07b0bed 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 _0x1ff1=['SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x31f22e,_0x434db1){var _0x16e1b0=function(_0x4f5355){while(--_0x4f5355){_0x31f22e['push'](_0x31f22e['shift']());}};_0x16e1b0(++_0x434db1);}(_0x1ff1,0x15b));var _0x11ff=function(_0x262f1c,_0x404724){_0x262f1c=_0x262f1c-0x0;var _0x1c3e3c=_0x1ff1[_0x262f1c];return _0x1c3e3c;};'use strict';var _=require('lodash');var util=require(_0x11ff('0x0'));var moment=require(_0x11ff('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11ff('0x2'));var db=require(_0x11ff('0x3'))['db'];var utils=require(_0x11ff('0x4'));var logger=require(_0x11ff('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x11ff('0x6')][_0x11ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e0576,_0x300576,_0x5a7d57){return new BPromise(function(_0x2441fe,_0x56dccf){return client[_0x11ff('0x8')](_0x4e0576,_0x5a7d57)[_0x11ff('0x9')](function(_0x15a0a6){logger[_0x11ff('0xa')](_0x11ff('0xb'),_0x300576,_0x11ff('0xc'));logger[_0x11ff('0xd')](_0x11ff('0xe'),_0x300576,'request\x20sent',JSON['stringify'](_0x15a0a6));if(_0x15a0a6[_0x11ff('0xf')]){if(_0x15a0a6[_0x11ff('0xf')][_0x11ff('0x10')]===0x1f4){logger[_0x11ff('0xf')](_0x11ff('0xb'),_0x300576,_0x15a0a6[_0x11ff('0xf')]['message']);return _0x56dccf(_0x15a0a6[_0x11ff('0xf')][_0x11ff('0x11')]);}logger[_0x11ff('0xf')]('SalesforceField,\x20%s,\x20%s',_0x300576,_0x15a0a6[_0x11ff('0xf')][_0x11ff('0x11')]);return _0x2441fe(_0x15a0a6[_0x11ff('0xf')][_0x11ff('0x11')]);}else{logger[_0x11ff('0xa')](_0x11ff('0xb'),_0x300576,_0x11ff('0xc'));_0x2441fe(_0x15a0a6[_0x11ff('0x12')]['message']);}})['catch'](function(_0x905bf9){logger['error'](_0x11ff('0xb'),_0x300576,_0x905bf9);_0x56dccf(_0x905bf9);});});} \ No newline at end of file +var _0xb969=['request','request\x20sent','debug','stringify','error','code','message','info','SalesforceField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4cb9d1,_0xedd594){var _0x158fb5=function(_0x4b7b3a){while(--_0x4b7b3a){_0x4cb9d1['push'](_0x4cb9d1['shift']());}};_0x158fb5(++_0xedd594);}(_0xb969,0x6f));var _0x9b96=function(_0x50cb59,_0x168c92){_0x50cb59=_0x50cb59-0x0;var _0x14c732=_0xb969[_0x50cb59];return _0x14c732;};'use strict';var _=require(_0x9b96('0x0'));var util=require(_0x9b96('0x1'));var moment=require(_0x9b96('0x2'));var BPromise=require(_0x9b96('0x3'));var rs=require(_0x9b96('0x4'));var fs=require('fs');var Redis=require(_0x9b96('0x5'));var db=require(_0x9b96('0x6'))['db'];var utils=require(_0x9b96('0x7'));var logger=require(_0x9b96('0x8'))(_0x9b96('0x9'));var config=require(_0x9b96('0xa'));var jayson=require(_0x9b96('0xb'));var client=jayson[_0x9b96('0xc')][_0x9b96('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2a9c61,_0x17531b,_0x156966){return new BPromise(function(_0x2d6eb7,_0x57592e){return client[_0x9b96('0xe')](_0x2a9c61,_0x156966)['then'](function(_0x5d899f){logger['info']('SalesforceField,\x20%s,\x20%s',_0x17531b,_0x9b96('0xf'));logger[_0x9b96('0x10')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x17531b,_0x9b96('0xf'),JSON[_0x9b96('0x11')](_0x5d899f));if(_0x5d899f[_0x9b96('0x12')]){if(_0x5d899f[_0x9b96('0x12')][_0x9b96('0x13')]===0x1f4){logger[_0x9b96('0x12')]('SalesforceField,\x20%s,\x20%s',_0x17531b,_0x5d899f[_0x9b96('0x12')][_0x9b96('0x14')]);return _0x57592e(_0x5d899f[_0x9b96('0x12')][_0x9b96('0x14')]);}logger[_0x9b96('0x12')]('SalesforceField,\x20%s,\x20%s',_0x17531b,_0x5d899f['error'][_0x9b96('0x14')]);return _0x2d6eb7(_0x5d899f[_0x9b96('0x12')][_0x9b96('0x14')]);}else{logger[_0x9b96('0x15')](_0x9b96('0x16'),_0x17531b,'request\x20sent');_0x2d6eb7(_0x5d899f[_0x9b96('0x17')]['message']);}})[_0x9b96('0x18')](function(_0x4c566f){logger[_0x9b96('0x12')]('SalesforceField,\x20%s,\x20%s',_0x17531b,_0x4c566f);_0x57592e(_0x4c566f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index cfd82a1..c7fa2ff 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 _0xce1e=['update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','/:id','isAuthenticated','/:id/configurations','get','/:id/fields','getFields','post','addConfiguration','put'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xce1e,0x97));var _0xece1=function(_0x126464,_0x9d627f){_0x126464=_0x126464-0x0;var _0x5c06cf=_0xce1e[_0x126464];return _0x5c06cf;};'use strict';var multer=require(_0xece1('0x0'));var util=require(_0xece1('0x1'));var path=require('path');var timeout=require(_0xece1('0x2'));var express=require('express');var router=express[_0xece1('0x3')]();var fs_extra=require(_0xece1('0x4'));var auth=require(_0xece1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xece1('0x6'));var controller=require(_0xece1('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xece1('0x8'),auth[_0xece1('0x9')](),controller['show']);router['get'](_0xece1('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xece1('0xb')](_0xece1('0xc'),auth['isAuthenticated'](),controller[_0xece1('0xd')]);router[_0xece1('0xe')]('/',auth[_0xece1('0x9')](),controller['create']);router[_0xece1('0xe')](_0xece1('0xa'),auth[_0xece1('0x9')](),controller[_0xece1('0xf')]);router[_0xece1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xece1('0x11')]);router[_0xece1('0x12')](_0xece1('0x8'),auth[_0xece1('0x9')](),controller[_0xece1('0x13')]);module[_0xece1('0x14')]=router; \ No newline at end of file +var _0xc7ea=['../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3d0193,_0x122288){var _0x3bdef0=function(_0x3dd164){while(--_0x3dd164){_0x3d0193['push'](_0x3d0193['shift']());}};_0x3bdef0(++_0x122288);}(_0xc7ea,0x171));var _0xac7e=function(_0x369458,_0x1d7188){_0x369458=_0x369458-0x0;var _0x5266f9=_0xc7ea[_0x369458];return _0x5266f9;};'use strict';var multer=require(_0xac7e('0x0'));var util=require(_0xac7e('0x1'));var path=require('path');var timeout=require(_0xac7e('0x2'));var express=require(_0xac7e('0x3'));var router=express[_0xac7e('0x4')]();var fs_extra=require(_0xac7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xac7e('0x6'));var config=require(_0xac7e('0x7'));var controller=require(_0xac7e('0x8'));router[_0xac7e('0x9')]('/',auth[_0xac7e('0xa')](),controller[_0xac7e('0xb')]);router[_0xac7e('0x9')](_0xac7e('0xc'),auth[_0xac7e('0xa')](),controller[_0xac7e('0xd')]);router['get'](_0xac7e('0xe'),auth[_0xac7e('0xa')](),controller[_0xac7e('0xf')]);router[_0xac7e('0x9')](_0xac7e('0x10'),auth[_0xac7e('0xa')](),controller[_0xac7e('0x11')]);router[_0xac7e('0x12')]('/',auth[_0xac7e('0xa')](),controller[_0xac7e('0x13')]);router[_0xac7e('0x12')](_0xac7e('0xe'),auth['isAuthenticated'](),controller[_0xac7e('0x14')]);router[_0xac7e('0x15')]('/:id',auth[_0xac7e('0xa')](),controller[_0xac7e('0x16')]);router[_0xac7e('0x17')](_0xac7e('0xc'),auth[_0xac7e('0xa')](),controller['destroy']);module[_0xac7e('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index aa1c323..5474321 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 _0xb0cf=['sequelize','exports','STRING','username'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb0cf,0xec));var _0xfb0c=function(_0x2724f7,_0xdab58f){_0x2724f7=_0x2724f7-0x0;var _0x3b930f=_0xb0cf[_0x2724f7];return _0x3b930f;};'use strict';var Sequelize=require(_0xfb0c('0x0'));module[_0xfb0c('0x1')]={'name':{'type':Sequelize[_0xfb0c('0x2')]},'description':{'type':Sequelize[_0xfb0c('0x2')]},'username':{'type':Sequelize[_0xfb0c('0x2')],'unique':_0xfb0c('0x3')},'password':{'type':Sequelize[_0xfb0c('0x2')]},'email':{'type':Sequelize[_0xfb0c('0x2')]},'remoteUri':{'type':Sequelize[_0xfb0c('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8d97=['STRING','username','remoteUri','sequelize','exports'];(function(_0x5b5517,_0x4782e0){var _0xd6cae5=function(_0x1421c5){while(--_0x1421c5){_0x5b5517['push'](_0x5b5517['shift']());}};_0xd6cae5(++_0x4782e0);}(_0x8d97,0x17a));var _0x78d9=function(_0x596954,_0x4ccc92){_0x596954=_0x596954-0x0;var _0xebee58=_0x8d97[_0x596954];return _0xebee58;};'use strict';var Sequelize=require(_0x78d9('0x0'));module[_0x78d9('0x1')]={'name':{'type':Sequelize[_0x78d9('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x78d9('0x2')],'unique':_0x78d9('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x78d9('0x2')]},'remoteUri':{'type':Sequelize[_0x78d9('0x2')],'unique':_0x78d9('0x4')},'serverUrl':{'type':Sequelize[_0x78d9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 8313564..71dce64 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 _0x9baf=['work_start','assignment_group','business_stc','additional_assignee_list','description','close_notes','closed_by','parent_incident','contact_type','reopened_by','urgency','company','activity_due','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','upon_approval','password','email','remoteUri','serverUrl','substring','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','statusCode','send','test','boolean','true','False','inactive','false','label','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','options','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x9baf,0x1a9));var _0xf9ba=function(_0x5a5ffc,_0x453a3d){_0x5a5ffc=_0x5a5ffc-0x0;var _0x4ed327=_0x9baf[_0x5a5ffc];return _0x4ed327;};'use strict';var emlformat=require(_0xf9ba('0x0'));var rimraf=require(_0xf9ba('0x1'));var zipdir=require(_0xf9ba('0x2'));var jsonpatch=require(_0xf9ba('0x3'));var rp=require('request-promise');var moment=require(_0xf9ba('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf9ba('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xf9ba('0x6'));var ejs=require(_0xf9ba('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf9ba('0x8'));var squel=require(_0xf9ba('0x9'));var crypto=require(_0xf9ba('0xa'));var jsforce=require(_0xf9ba('0xb'));var deskjs=require(_0xf9ba('0xc'));var toCsv=require(_0xf9ba('0x6'));var querystring=require('querystring');var Papa=require(_0xf9ba('0xd'));var Redis=require('ioredis');var authService=require(_0xf9ba('0xe'));var qs=require(_0xf9ba('0xf'));var as=require(_0xf9ba('0x10'));var hardwareService=require(_0xf9ba('0x11'));var logger=require(_0xf9ba('0x12'))(_0xf9ba('0x13'));var utils=require('../../config/utils');var config=require(_0xf9ba('0x14'));var licenseUtil=require(_0xf9ba('0x15'));var db=require(_0xf9ba('0x16'))['db'];var integrations=require(_0xf9ba('0x17'));function respondWithStatusCode(_0x1e985f,_0x337c0f){_0x337c0f=_0x337c0f||0xcc;return function(_0x3e78c4){if(_0x3e78c4){return _0x1e985f['sendStatus'](_0x337c0f);}return _0x1e985f['status'](_0x337c0f)[_0xf9ba('0x18')]();};}function respondWithResult(_0x408ac0,_0x241273){_0x241273=_0x241273||0xc8;return function(_0x21c564){if(_0x21c564){return _0x408ac0[_0xf9ba('0x19')](_0x241273)['json'](_0x21c564);}};}function respondWithFilteredResult(_0x47ca92,_0x1c6d4f){return function(_0x4d7118){if(_0x4d7118){var _0x24abba=typeof _0x1c6d4f['offset']===_0xf9ba('0x1a')&&typeof _0x1c6d4f[_0xf9ba('0x1b')]==='undefined';var _0x18077d=_0x4d7118['count'];var _0x2ebb11=_0x24abba?0x0:_0x1c6d4f[_0xf9ba('0x1c')];var _0x45c07f=_0x24abba?_0x4d7118[_0xf9ba('0x1d')]:_0x1c6d4f[_0xf9ba('0x1c')]+_0x1c6d4f[_0xf9ba('0x1b')];var _0x13ad71;if(_0x45c07f>=_0x18077d){_0x45c07f=_0x18077d;_0x13ad71=0xc8;}else{_0x13ad71=0xce;}_0x47ca92[_0xf9ba('0x19')](_0x13ad71);return _0x47ca92[_0xf9ba('0x1e')](_0xf9ba('0x1f'),_0x2ebb11+'-'+_0x45c07f+'/'+_0x18077d)[_0xf9ba('0x20')](_0x4d7118);}return null;};}function patchUpdates(_0x276e29){return function(_0x7ab8fb){try{jsonpatch[_0xf9ba('0x21')](_0x7ab8fb,_0x276e29,!![]);}catch(_0x19ea65){return BPromise[_0xf9ba('0x22')](_0x19ea65);}return _0x7ab8fb[_0xf9ba('0x23')]();};}function saveUpdates(_0x1ebff8,_0x1e6778){return function(_0x4582db){if(_0x4582db){return _0x4582db[_0xf9ba('0x24')](_0x1ebff8)[_0xf9ba('0x25')](function(_0x75dab9){return _0x75dab9;});}return null;};}function removeEntity(_0x4c8b3d,_0x264454){return function(_0x1c744f){if(_0x1c744f){return _0x1c744f[_0xf9ba('0x26')]()[_0xf9ba('0x25')](function(){_0x4c8b3d[_0xf9ba('0x19')](0xcc)[_0xf9ba('0x18')]();});}};}function handleEntityNotFound(_0x50b864,_0x1e0951){return function(_0x50c9ef){if(!_0x50c9ef){_0x50b864[_0xf9ba('0x27')](0x194);}return _0x50c9ef;};}function handleError(_0x426f4d,_0x468fbe){_0x468fbe=_0x468fbe||0x1f4;return function(_0x19d6a5){logger[_0xf9ba('0x28')](_0x19d6a5[_0xf9ba('0x29')]);if(_0x19d6a5[_0xf9ba('0x2a')]){delete _0x19d6a5[_0xf9ba('0x2a')];}_0x426f4d['status'](_0x468fbe)['send'](_0x19d6a5);};}exports[_0xf9ba('0x2b')]=function(_0x2c1fe7,_0x47788b){var _0x36fbc7={},_0x21ad26={},_0x5d2cd6={'count':0x0,'rows':[]};var _0x3a0a4d=_[_0xf9ba('0x2c')](db[_0xf9ba('0x2d')][_0xf9ba('0x2e')],function(_0x4c0967){return{'name':_0x4c0967[_0xf9ba('0x2f')],'type':_0x4c0967[_0xf9ba('0x30')][_0xf9ba('0x31')]};});_0x21ad26[_0xf9ba('0x32')]=_['map'](_0x3a0a4d,_0xf9ba('0x2a'));_0x21ad26[_0xf9ba('0x33')]=_[_0xf9ba('0x34')](_0x2c1fe7[_0xf9ba('0x33')]);_0x21ad26[_0xf9ba('0x35')]=_[_0xf9ba('0x36')](_0x21ad26[_0xf9ba('0x32')],_0x21ad26[_0xf9ba('0x33')]);_0x36fbc7[_0xf9ba('0x37')]=_['intersection'](_0x21ad26[_0xf9ba('0x32')],qs[_0xf9ba('0x38')](_0x2c1fe7['query']['fields']));_0x36fbc7[_0xf9ba('0x37')]=_0x36fbc7[_0xf9ba('0x37')]['length']?_0x36fbc7[_0xf9ba('0x37')]:_0x21ad26[_0xf9ba('0x32')];if(!_0x2c1fe7[_0xf9ba('0x33')]['hasOwnProperty']('nolimit')){_0x36fbc7[_0xf9ba('0x1b')]=qs[_0xf9ba('0x1b')](_0x2c1fe7[_0xf9ba('0x33')][_0xf9ba('0x1b')]);_0x36fbc7['offset']=qs[_0xf9ba('0x1c')](_0x2c1fe7['query'][_0xf9ba('0x1c')]);}_0x36fbc7['order']=qs[_0xf9ba('0x39')](_0x2c1fe7[_0xf9ba('0x33')][_0xf9ba('0x39')]);_0x36fbc7['where']=qs['filters'](_[_0xf9ba('0x3a')](_0x2c1fe7['query'],_0x21ad26[_0xf9ba('0x35')]),_0x3a0a4d);if(_0x2c1fe7[_0xf9ba('0x33')][_0xf9ba('0x3b')]){_0x36fbc7[_0xf9ba('0x3c')]=_[_0xf9ba('0x3d')](_0x36fbc7[_0xf9ba('0x3c')],{'$or':_[_0xf9ba('0x2c')](_0x3a0a4d,function(_0x5986e6){if(_0x5986e6[_0xf9ba('0x30')]!==_0xf9ba('0x3e')){var _0x578c16={};_0x578c16[_0x5986e6['name']]={'$like':'%'+_0x2c1fe7[_0xf9ba('0x33')][_0xf9ba('0x3b')]+'%'};return _0x578c16;}})});}_0x36fbc7=_[_0xf9ba('0x3d')]({},_0x36fbc7,_0x2c1fe7['options']);var _0x517e18={'where':_0x36fbc7['where']};return db[_0xf9ba('0x2d')]['count'](_0x517e18)[_0xf9ba('0x25')](function(_0x53a9e3){_0x5d2cd6[_0xf9ba('0x1d')]=_0x53a9e3;if(_0x2c1fe7[_0xf9ba('0x33')][_0xf9ba('0x3f')]){_0x36fbc7[_0xf9ba('0x40')]=[{'all':!![]}];}return db[_0xf9ba('0x2d')][_0xf9ba('0x41')](_0x36fbc7);})[_0xf9ba('0x25')](function(_0x153e73){_0x5d2cd6[_0xf9ba('0x42')]=_0x153e73;return _0x5d2cd6;})[_0xf9ba('0x25')](respondWithFilteredResult(_0x47788b,_0x36fbc7))[_0xf9ba('0x43')](handleError(_0x47788b,null));};exports[_0xf9ba('0x44')]=function(_0x4bf1db,_0x339c54){var _0xa0bab9={'raw':![],'where':{'id':_0x4bf1db['params']['id']}},_0xc98a83={};_0xc98a83['model']=_[_0xf9ba('0x34')](db[_0xf9ba('0x2d')]['rawAttributes']);_0xc98a83['query']=_[_0xf9ba('0x34')](_0x4bf1db[_0xf9ba('0x33')]);_0xc98a83[_0xf9ba('0x35')]=_[_0xf9ba('0x36')](_0xc98a83[_0xf9ba('0x32')],_0xc98a83[_0xf9ba('0x33')]);_0xa0bab9['attributes']=_[_0xf9ba('0x36')](_0xc98a83[_0xf9ba('0x32')],qs[_0xf9ba('0x38')](_0x4bf1db[_0xf9ba('0x33')]['fields']));_0xa0bab9['attributes']=_0xa0bab9['attributes'][_0xf9ba('0x45')]?_0xa0bab9['attributes']:_0xc98a83[_0xf9ba('0x32')];if(_0x4bf1db[_0xf9ba('0x33')][_0xf9ba('0x3f')]){_0xa0bab9['include']=[{'all':!![]}];}_0xa0bab9=_[_0xf9ba('0x3d')]({},_0xa0bab9,_0x4bf1db['options']);return db[_0xf9ba('0x2d')][_0xf9ba('0x46')](_0xa0bab9)[_0xf9ba('0x25')](handleEntityNotFound(_0x339c54,null))[_0xf9ba('0x25')](respondWithResult(_0x339c54,null))[_0xf9ba('0x43')](handleError(_0x339c54,null));};exports[_0xf9ba('0x47')]=function(_0x25651e,_0x3e4480){return db[_0xf9ba('0x2d')]['create'](_0x25651e[_0xf9ba('0x48')],{})[_0xf9ba('0x25')](respondWithResult(_0x3e4480,0xc9))['catch'](handleError(_0x3e4480,null));};exports[_0xf9ba('0x24')]=function(_0x56ce80,_0x95e658){if(_0x56ce80[_0xf9ba('0x48')]['id']){delete _0x56ce80[_0xf9ba('0x48')]['id'];}return db[_0xf9ba('0x2d')][_0xf9ba('0x46')]({'where':{'id':_0x56ce80['params']['id']}})[_0xf9ba('0x25')](handleEntityNotFound(_0x95e658,null))[_0xf9ba('0x25')](saveUpdates(_0x56ce80[_0xf9ba('0x48')],null))[_0xf9ba('0x25')](respondWithResult(_0x95e658,null))[_0xf9ba('0x43')](handleError(_0x95e658,null));};exports[_0xf9ba('0x26')]=function(_0x516b47,_0x3c9b26){return db[_0xf9ba('0x2d')][_0xf9ba('0x46')]({'where':{'id':_0x516b47[_0xf9ba('0x49')]['id']}})[_0xf9ba('0x25')](handleEntityNotFound(_0x3c9b26,null))[_0xf9ba('0x25')](removeEntity(_0x3c9b26,null))[_0xf9ba('0x43')](handleError(_0x3c9b26,null));};exports[_0xf9ba('0x4a')]=function(_0xf8c5c6,_0x1835b8,_0x7792e2){var _0xe5bd94={};var _0x2a8bcc={};var _0x1bfda1;var _0x5da342;return db[_0xf9ba('0x2d')][_0xf9ba('0x4b')]({'where':{'id':_0xf8c5c6['params']['id']}})[_0xf9ba('0x25')](handleEntityNotFound(_0x1835b8,null))[_0xf9ba('0x25')](function(_0xcad62c){if(_0xcad62c){_0x1bfda1=_0xcad62c;_0x2a8bcc[_0xf9ba('0x32')]=_[_0xf9ba('0x34')](db[_0xf9ba('0x4c')][_0xf9ba('0x2e')]);_0x2a8bcc[_0xf9ba('0x33')]=_[_0xf9ba('0x34')](_0xf8c5c6[_0xf9ba('0x33')]);_0x2a8bcc['filters']=_[_0xf9ba('0x36')](_0x2a8bcc[_0xf9ba('0x32')],_0x2a8bcc['query']);_0xe5bd94['attributes']=_[_0xf9ba('0x36')](_0x2a8bcc[_0xf9ba('0x32')],qs[_0xf9ba('0x38')](_0xf8c5c6[_0xf9ba('0x33')][_0xf9ba('0x38')]));_0xe5bd94[_0xf9ba('0x37')]=_0xe5bd94[_0xf9ba('0x37')]['length']?_0xe5bd94[_0xf9ba('0x37')]:_0x2a8bcc[_0xf9ba('0x32')];_0xe5bd94['order']=qs[_0xf9ba('0x39')](_0xf8c5c6[_0xf9ba('0x33')]['sort']);_0xe5bd94[_0xf9ba('0x3c')]=qs[_0xf9ba('0x35')](_[_0xf9ba('0x3a')](_0xf8c5c6[_0xf9ba('0x33')],_0x2a8bcc['filters']));if(_0xf8c5c6['query']['filter']){_0xe5bd94[_0xf9ba('0x3c')]=_[_0xf9ba('0x3d')](_0xe5bd94[_0xf9ba('0x3c')],{'$or':_[_0xf9ba('0x2c')](_0xe5bd94[_0xf9ba('0x37')],function(_0x4bd665){var _0x2e550e={};_0x2e550e[_0x4bd665]={'$like':'%'+_0xf8c5c6[_0xf9ba('0x33')][_0xf9ba('0x3b')]+'%'};return _0x2e550e;})});}_0xe5bd94=_['merge']({},_0xe5bd94,_0xf8c5c6[_0xf9ba('0x4d')]);return _0x1bfda1[_0xf9ba('0x4a')](_0xe5bd94);}})[_0xf9ba('0x25')](function(_0x2462d7){if(_0x2462d7){_0x5da342=_0x2462d7['length'];if(!_0xf8c5c6['query'][_0xf9ba('0x4e')](_0xf9ba('0x4f'))){_0xe5bd94['limit']=qs[_0xf9ba('0x1b')](_0xf8c5c6['query'][_0xf9ba('0x1b')]);_0xe5bd94[_0xf9ba('0x1c')]=qs[_0xf9ba('0x1c')](_0xf8c5c6[_0xf9ba('0x33')][_0xf9ba('0x1c')]);}return _0x1bfda1[_0xf9ba('0x4a')](_0xe5bd94);}})[_0xf9ba('0x25')](function(_0xbaddc8){if(_0xbaddc8){return _0xbaddc8?{'count':_0x5da342,'rows':_0xbaddc8}:null;}})[_0xf9ba('0x25')](respondWithResult(_0x1835b8,null))['catch'](handleError(_0x1835b8,null));};exports['addConfiguration']=function(_0x5ba0bd,_0x11e802,_0xc3fa8d){if(_0x5ba0bd[_0xf9ba('0x48')]['id']){delete _0x5ba0bd[_0xf9ba('0x48')]['id'];}return db[_0xf9ba('0x2d')]['findOne']({'where':{'id':_0x5ba0bd[_0xf9ba('0x49')]['id']}})[_0xf9ba('0x25')](handleEntityNotFound(_0x11e802,null))['then'](function(_0x4da3c2){if(_0x4da3c2){_0x5ba0bd['body'][_0xf9ba('0x50')]=_0x4da3c2['id'];_0x5ba0bd[_0xf9ba('0x48')][_0xf9ba('0x51')]=integrations[_0xf9ba('0x52')](_0x5ba0bd[_0xf9ba('0x48')]['channel'],_0x5ba0bd[_0xf9ba('0x48')][_0xf9ba('0x30')]);_0x5ba0bd['body'][_0xf9ba('0x53')]=integrations[_0xf9ba('0x54')](_0x5ba0bd[_0xf9ba('0x48')][_0xf9ba('0x55')],_0x5ba0bd['body'][_0xf9ba('0x30')]);return db[_0xf9ba('0x4c')][_0xf9ba('0x47')](_0x5ba0bd[_0xf9ba('0x48')],{'include':[{'model':db[_0xf9ba('0x56')],'as':_0xf9ba('0x51')},{'model':db[_0xf9ba('0x56')],'as':_0xf9ba('0x53')}]});}return null;})[_0xf9ba('0x25')](respondWithResult(_0x11e802,null))['catch'](handleError(_0x11e802,null));};exports[_0xf9ba('0x57')]=function(_0x4d07fa,_0x1b85a6,_0x54bf38){var _0xa2de0b=[_0xf9ba('0x58'),_0xf9ba('0x59'),_0xf9ba('0x5a'),_0xf9ba('0x5b'),_0xf9ba('0x5c'),_0xf9ba('0x5d'),_0xf9ba('0x5e'),_0xf9ba('0x5f'),_0xf9ba('0x60')];var _0x1f14cb=['parent',_0xf9ba('0x58'),_0xf9ba('0x61'),_0xf9ba('0x62'),_0xf9ba('0x63'),_0xf9ba('0x64'),_0xf9ba('0x65'),_0xf9ba('0x59'),_0xf9ba('0x66'),_0xf9ba('0x67'),_0xf9ba('0x68'),_0xf9ba('0x69'),'opened_by','user_input',_0xf9ba('0x6a'),_0xf9ba('0x6b'),_0xf9ba('0x6c'),_0xf9ba('0x6d'),'knowledge','order',_0xf9ba('0x6e'),_0xf9ba('0x6f'),_0xf9ba('0x70'),_0xf9ba('0x71'),_0xf9ba('0x72'),'active',_0xf9ba('0x73'),_0xf9ba('0x74'),_0xf9ba('0x75'),_0xf9ba('0x76'),_0xf9ba('0x77'),_0xf9ba('0x78'),_0xf9ba('0x79'),_0xf9ba('0x7a'),_0xf9ba('0x7b'),'group_list',_0xf9ba('0x7c'),_0xf9ba('0x7d'),_0xf9ba('0x7e'),_0xf9ba('0x7f'),_0xf9ba('0x80'),_0xf9ba('0x5b'),_0xf9ba('0x81'),_0xf9ba('0x82'),'close_code',_0xf9ba('0x83'),_0xf9ba('0x84'),_0xf9ba('0x85'),_0xf9ba('0x86'),_0xf9ba('0x87'),_0xf9ba('0x88'),_0xf9ba('0x89'),'calendar_duration','notify','sys_class_name',_0xf9ba('0x8a'),_0xf9ba('0x8b'),'follow_up',_0xf9ba('0x8c'),'sys_id',_0xf9ba('0x8d'),_0xf9ba('0x8e'),'incident_state',_0xf9ba('0x8f'),'problem_id',_0xf9ba('0x90'),'reassignment_count',_0xf9ba('0x91'),'assigned_to',_0xf9ba('0x5f'),'comments',_0xf9ba('0x92'),_0xf9ba('0x93'),_0xf9ba('0x94'),_0xf9ba('0x95'),'sys_mod_count',_0xf9ba('0x96'),_0xf9ba('0x97'),'escalation',_0xf9ba('0x98'),'correlation_id','location',_0xf9ba('0x60')];var _0x491e86='';var _0x40bcaf='';var _0x70ed36=[];var _0x15f8b7='';var _0x10650c='';var _0x33a3a6=[];var _0x309e3a='';var _0x5cc173='';var _0x27c717={};var _0x3dfdbe='';return db['ServicenowAccount'][_0xf9ba('0x4b')]({'where':{'id':_0x4d07fa[_0xf9ba('0x49')]['id']},'attributes':['id','username',_0xf9ba('0x99'),_0xf9ba('0x9a'),_0xf9ba('0x9b'),_0xf9ba('0x9c')]})[_0xf9ba('0x25')](handleEntityNotFound(_0x1b85a6,null))[_0xf9ba('0x25')](function(_0x80d263){if(_0x80d263){_0x3dfdbe=_0x80d263[_0xf9ba('0x9b')];var _0x25d262=_0x3dfdbe['slice'](-0x1);if(_0x25d262==='/'){_0x3dfdbe=_0x3dfdbe[_0xf9ba('0x9d')](0x0,_0x3dfdbe['lastIndexOf'](_0x25d262));}_0x5cc173=util['format']('%s/api/now/doc/table/schema/',_0x3dfdbe);_0x309e3a=util[_0xf9ba('0x9e')](_0xf9ba('0x9f'),_0x3dfdbe);_0x27c717={'user':_0x80d263[_0xf9ba('0xa0')],'pass':_0x80d263[_0xf9ba('0x99')]};var _0x1419b1={'method':_0xf9ba('0xa1'),'uri':_0x5cc173+_0xf9ba('0xa2'),'auth':_0x27c717,'json':!![]};return rp(_0x1419b1);}})['then'](function(_0x22411f){if(_0x22411f['result'][_0xf9ba('0x45')]>0x0){_0x491e86=_0x22411f[_0xf9ba('0xa3')];}console[_0xf9ba('0xa4')](_0xf9ba('0xa5'),_0x491e86);_0x33a3a6=[];_0x40bcaf=Object[_0xf9ba('0xa6')]([],_0x491e86);_[_0xf9ba('0xa7')](_0x40bcaf,function(_0x5f010d){return!_0xa2de0b[_0xf9ba('0xa8')](_0x5f010d[_0xf9ba('0x2a')]);});_0x40bcaf[_0xf9ba('0xa9')](function(_0x14bdc7){var _0x4c0742=createFieldObject(_0x309e3a,_0x27c717,_0x14bdc7['internalType'],_0x14bdc7[_0xf9ba('0x2a')],_0x14bdc7['label'],![]);_0x33a3a6[_0xf9ba('0xaa')](_0x4c0742);});return Promise['all'](_0x33a3a6);})[_0xf9ba('0x25')](function(_0x4a504d){_0x70ed36=_0x4a504d;_0x15f8b7=Object['assign']([],_0x491e86);console['log'](_0xf9ba('0xab'),_0x491e86);_[_0xf9ba('0xa7')](_0x15f8b7,function(_0x534c65){return _0x1f14cb[_0xf9ba('0xa8')](_0x534c65['name']);});console[_0xf9ba('0xa4')](_0xf9ba('0xac'),_0x15f8b7);_0x33a3a6=[];_0x15f8b7[_0xf9ba('0xa9')](function(_0x8fbef7){var _0x1bc916=createFieldObject(_0x309e3a,_0x27c717,_0x8fbef7[_0xf9ba('0xad')],_0x8fbef7[_0xf9ba('0x2a')],_0x8fbef7['label'],!![]);_0x33a3a6[_0xf9ba('0xaa')](_0x1bc916);});return Promise['all'](_0x33a3a6);})[_0xf9ba('0x25')](function(_0x4b9a85){_0x10650c=_0x4b9a85;var _0x3670c5=_0x70ed36[_0xf9ba('0xae')](_0x10650c);return{'count':_0x3670c5[_0xf9ba('0x45')],'rows':_0x3670c5};})[_0xf9ba('0x25')](respondWithResult(_0x1b85a6,null))[_0xf9ba('0x43')](function(_0x332026){console[_0xf9ba('0xa4')](_0xf9ba('0xaf')+_0x332026);var _0x329d51=_0x4d07fa[_0xf9ba('0x33')]['test']?0x1f4:_0x332026[_0xf9ba('0xb0')]||0x1f4;logger['error'](_0x332026[_0xf9ba('0x29')]);delete _0x332026[_0xf9ba('0x2a')];if(_0x329d51===0x191){_0x329d51=0x190;}_0x1b85a6['status'](_0x329d51)[_0xf9ba('0xb1')](_0x4d07fa['query'][_0xf9ba('0xb2')]?{'message':'Wrong\x20credentials','statusCode':_0x332026[_0xf9ba('0xb0')]}:_0x332026);});};function createFieldObject(_0x515383,_0x3c37d2,_0xd7404,_0x362e49,_0x244c43,_0x31848d){return new Promise(function(_0x16098d,_0x3545c2){var _0x552c79={'id':_0x362e49,'name':_0x244c43,'custom':_0x31848d};if(_0xd7404===_0xf9ba('0xb3')){_0x552c79['options']=[{'name':'True','value':_0xf9ba('0xb4')},{'name':_0xf9ba('0xb5'),'value':'false'}];_0x16098d(_0x552c79);}else{var _0x39860a={'method':_0xf9ba('0xa1'),'uri':_0x515383+'sys_choice?sysparm_query=name=incident^element='+_0x362e49,'auth':_0x3c37d2,'json':!![]};return rp(_0x39860a)[_0xf9ba('0x25')](function(_0x23613a){var _0x4b460a=[];if(_0x23613a[_0xf9ba('0xa3')][_0xf9ba('0x45')]>0x0){_0x23613a['result'][_0xf9ba('0xa9')](function(_0x5d63ae){if(_0x5d63ae[_0xf9ba('0xb6')]===_0xf9ba('0xb7')){var _0x3fbbc1={'name':_0x5d63ae[_0xf9ba('0xb8')],'value':_0x5d63ae[_0xf9ba('0xb9')]};_0x4b460a[_0xf9ba('0xaa')](_0x3fbbc1);}});}_0x552c79[_0xf9ba('0x4d')]=_0x4b460a;if(_0x552c79[_0xf9ba('0x4d')][_0xf9ba('0x45')]>0x0){_0x16098d(_0x552c79);}else{if(_0x31848d==![]){_0x16098d();}else{_0x16098d(_0x552c79);}}});}});} \ No newline at end of file +var _0x245e=['contact_type','urgency','reassignment_count','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','statusCode','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','ServicenowAccount','includeAll','include','findAll','rows','show','params','length','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','subcategory','close_code','notify','severity','category','watch_list','sys_updated_on','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','approval_set','short_description','delivery_task','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','follow_up','parent_incident','sys_id'];(function(_0x2aeb09,_0x3f9309){var _0x1146ef=function(_0x34a3c0){while(--_0x34a3c0){_0x2aeb09['push'](_0x2aeb09['shift']());}};_0x1146ef(++_0x3f9309);}(_0x245e,0x191));var _0xe245=function(_0x21ee4f,_0x2a5d70){_0x21ee4f=_0x21ee4f-0x0;var _0x240c1b=_0x245e[_0x21ee4f];return _0x240c1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe245('0x0'));var zipdir=require(_0xe245('0x1'));var jsonpatch=require(_0xe245('0x2'));var rp=require('request-promise');var moment=require(_0xe245('0x3'));var BPromise=require(_0xe245('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe245('0x5'));var csv=require(_0xe245('0x6'));var ejs=require(_0xe245('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe245('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe245('0x9'));var deskjs=require(_0xe245('0xa'));var toCsv=require(_0xe245('0x6'));var querystring=require(_0xe245('0xb'));var Papa=require(_0xe245('0xc'));var Redis=require(_0xe245('0xd'));var authService=require(_0xe245('0xe'));var qs=require(_0xe245('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe245('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe245('0x11'));var db=require(_0xe245('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x23e8e7,_0x1611fd){_0x1611fd=_0x1611fd||0xcc;return function(_0x24d530){if(_0x24d530){return _0x23e8e7[_0xe245('0x13')](_0x1611fd);}return _0x23e8e7[_0xe245('0x14')](_0x1611fd)[_0xe245('0x15')]();};}function respondWithResult(_0x2fe4f1,_0x30f967){_0x30f967=_0x30f967||0xc8;return function(_0x5a5551){if(_0x5a5551){return _0x2fe4f1['status'](_0x30f967)[_0xe245('0x16')](_0x5a5551);}};}function respondWithFilteredResult(_0x21f7ff,_0x3f6388){return function(_0x136480){if(_0x136480){var _0x473458=typeof _0x3f6388['offset']==='undefined'&&typeof _0x3f6388[_0xe245('0x17')]===_0xe245('0x18');var _0x55fbe6=_0x136480[_0xe245('0x19')];var _0x556504=_0x473458?0x0:_0x3f6388[_0xe245('0x1a')];var _0x2854f9=_0x473458?_0x136480[_0xe245('0x19')]:_0x3f6388[_0xe245('0x1a')]+_0x3f6388[_0xe245('0x17')];var _0x3b3101;if(_0x2854f9>=_0x55fbe6){_0x2854f9=_0x55fbe6;_0x3b3101=0xc8;}else{_0x3b3101=0xce;}_0x21f7ff[_0xe245('0x14')](_0x3b3101);return _0x21f7ff[_0xe245('0x1b')](_0xe245('0x1c'),_0x556504+'-'+_0x2854f9+'/'+_0x55fbe6)['json'](_0x136480);}return null;};}function patchUpdates(_0x442a60){return function(_0x12bd98){try{jsonpatch[_0xe245('0x1d')](_0x12bd98,_0x442a60,!![]);}catch(_0xc4fdeb){return BPromise[_0xe245('0x1e')](_0xc4fdeb);}return _0x12bd98[_0xe245('0x1f')]();};}function saveUpdates(_0x14bdeb,_0x4b18df){return function(_0x269fb1){if(_0x269fb1){return _0x269fb1[_0xe245('0x20')](_0x14bdeb)[_0xe245('0x21')](function(_0x2071a2){return _0x2071a2;});}return null;};}function removeEntity(_0x5bb738,_0x1596bf){return function(_0x3f52a2){if(_0x3f52a2){return _0x3f52a2[_0xe245('0x22')]()['then'](function(){_0x5bb738[_0xe245('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x160f3d,_0x3166a2){return function(_0x5af630){if(!_0x5af630){_0x160f3d['sendStatus'](0x194);}return _0x5af630;};}function handleError(_0x114742,_0x3ba13d){_0x3ba13d=_0x3ba13d||0x1f4;return function(_0x9b1e31){logger[_0xe245('0x23')](_0x9b1e31[_0xe245('0x24')]);if(_0x9b1e31[_0xe245('0x25')]){delete _0x9b1e31['name'];}_0x114742['status'](_0x3ba13d)[_0xe245('0x26')](_0x9b1e31);};}exports[_0xe245('0x27')]=function(_0xb34328,_0x5b55d3){var _0x5427d8={},_0x9fd9db={},_0x27b209={'count':0x0,'rows':[]};var _0x3c3b30=_[_0xe245('0x28')](db['ServicenowAccount']['rawAttributes'],function(_0x2078d8){return{'name':_0x2078d8[_0xe245('0x29')],'type':_0x2078d8['type'][_0xe245('0x2a')]};});_0x9fd9db[_0xe245('0x2b')]=_['map'](_0x3c3b30,_0xe245('0x25'));_0x9fd9db[_0xe245('0x2c')]=_[_0xe245('0x2d')](_0xb34328[_0xe245('0x2c')]);_0x9fd9db[_0xe245('0x2e')]=_[_0xe245('0x2f')](_0x9fd9db[_0xe245('0x2b')],_0x9fd9db[_0xe245('0x2c')]);_0x5427d8[_0xe245('0x30')]=_[_0xe245('0x2f')](_0x9fd9db[_0xe245('0x2b')],qs[_0xe245('0x31')](_0xb34328[_0xe245('0x2c')][_0xe245('0x31')]));_0x5427d8[_0xe245('0x30')]=_0x5427d8['attributes']['length']?_0x5427d8[_0xe245('0x30')]:_0x9fd9db[_0xe245('0x2b')];if(!_0xb34328['query'][_0xe245('0x32')](_0xe245('0x33'))){_0x5427d8['limit']=qs['limit'](_0xb34328['query'][_0xe245('0x17')]);_0x5427d8['offset']=qs[_0xe245('0x1a')](_0xb34328[_0xe245('0x2c')]['offset']);}_0x5427d8[_0xe245('0x34')]=qs[_0xe245('0x35')](_0xb34328[_0xe245('0x2c')]['sort']);_0x5427d8['where']=qs[_0xe245('0x2e')](_[_0xe245('0x36')](_0xb34328[_0xe245('0x2c')],_0x9fd9db[_0xe245('0x2e')]),_0x3c3b30);if(_0xb34328[_0xe245('0x2c')][_0xe245('0x37')]){_0x5427d8[_0xe245('0x38')]=_['merge'](_0x5427d8[_0xe245('0x38')],{'$or':_['map'](_0x3c3b30,function(_0x5879df){if(_0x5879df[_0xe245('0x39')]!==_0xe245('0x3a')){var _0x209455={};_0x209455[_0x5879df['name']]={'$like':'%'+_0xb34328[_0xe245('0x2c')][_0xe245('0x37')]+'%'};return _0x209455;}})});}_0x5427d8=_[_0xe245('0x3b')]({},_0x5427d8,_0xb34328[_0xe245('0x3c')]);var _0x396371={'where':_0x5427d8['where']};return db[_0xe245('0x3d')][_0xe245('0x19')](_0x396371)[_0xe245('0x21')](function(_0x53c173){_0x27b209['count']=_0x53c173;if(_0xb34328[_0xe245('0x2c')][_0xe245('0x3e')]){_0x5427d8[_0xe245('0x3f')]=[{'all':!![]}];}return db[_0xe245('0x3d')][_0xe245('0x40')](_0x5427d8);})[_0xe245('0x21')](function(_0x207434){_0x27b209[_0xe245('0x41')]=_0x207434;return _0x27b209;})['then'](respondWithFilteredResult(_0x5b55d3,_0x5427d8))['catch'](handleError(_0x5b55d3,null));};exports[_0xe245('0x42')]=function(_0x1902b2,_0x4c5dcd){var _0x7cc78b={'raw':![],'where':{'id':_0x1902b2[_0xe245('0x43')]['id']}},_0x3978d={};_0x3978d[_0xe245('0x2b')]=_['keys'](db[_0xe245('0x3d')]['rawAttributes']);_0x3978d['query']=_[_0xe245('0x2d')](_0x1902b2['query']);_0x3978d[_0xe245('0x2e')]=_['intersection'](_0x3978d[_0xe245('0x2b')],_0x3978d['query']);_0x7cc78b['attributes']=_['intersection'](_0x3978d[_0xe245('0x2b')],qs[_0xe245('0x31')](_0x1902b2[_0xe245('0x2c')][_0xe245('0x31')]));_0x7cc78b[_0xe245('0x30')]=_0x7cc78b[_0xe245('0x30')][_0xe245('0x44')]?_0x7cc78b[_0xe245('0x30')]:_0x3978d[_0xe245('0x2b')];if(_0x1902b2[_0xe245('0x2c')][_0xe245('0x3e')]){_0x7cc78b[_0xe245('0x3f')]=[{'all':!![]}];}_0x7cc78b=_[_0xe245('0x3b')]({},_0x7cc78b,_0x1902b2[_0xe245('0x3c')]);return db[_0xe245('0x3d')]['find'](_0x7cc78b)[_0xe245('0x21')](handleEntityNotFound(_0x4c5dcd,null))[_0xe245('0x21')](respondWithResult(_0x4c5dcd,null))[_0xe245('0x45')](handleError(_0x4c5dcd,null));};exports[_0xe245('0x46')]=function(_0x2d3cac,_0x1894ac){return db[_0xe245('0x3d')][_0xe245('0x46')](_0x2d3cac[_0xe245('0x47')],{})['then'](respondWithResult(_0x1894ac,0xc9))[_0xe245('0x45')](handleError(_0x1894ac,null));};exports[_0xe245('0x20')]=function(_0xa4dd22,_0x5eb158){if(_0xa4dd22[_0xe245('0x47')]['id']){delete _0xa4dd22[_0xe245('0x47')]['id'];}return db[_0xe245('0x3d')]['find']({'where':{'id':_0xa4dd22['params']['id']}})[_0xe245('0x21')](handleEntityNotFound(_0x5eb158,null))[_0xe245('0x21')](saveUpdates(_0xa4dd22[_0xe245('0x47')],null))[_0xe245('0x21')](respondWithResult(_0x5eb158,null))[_0xe245('0x45')](handleError(_0x5eb158,null));};exports['destroy']=function(_0x5f5d1d,_0x32b727){return db[_0xe245('0x3d')]['find']({'where':{'id':_0x5f5d1d['params']['id']}})['then'](handleEntityNotFound(_0x32b727,null))['then'](removeEntity(_0x32b727,null))['catch'](handleError(_0x32b727,null));};exports[_0xe245('0x48')]=function(_0x32b459,_0x293348,_0x262ef0){var _0x149f26={};var _0x539a82={};var _0x27327e;var _0x4420d7;return db[_0xe245('0x3d')][_0xe245('0x49')]({'where':{'id':_0x32b459[_0xe245('0x43')]['id']}})[_0xe245('0x21')](handleEntityNotFound(_0x293348,null))[_0xe245('0x21')](function(_0x12af1e){if(_0x12af1e){_0x27327e=_0x12af1e;_0x539a82[_0xe245('0x2b')]=_[_0xe245('0x2d')](db[_0xe245('0x4a')][_0xe245('0x4b')]);_0x539a82[_0xe245('0x2c')]=_['keys'](_0x32b459[_0xe245('0x2c')]);_0x539a82['filters']=_[_0xe245('0x2f')](_0x539a82['model'],_0x539a82[_0xe245('0x2c')]);_0x149f26[_0xe245('0x30')]=_['intersection'](_0x539a82[_0xe245('0x2b')],qs[_0xe245('0x31')](_0x32b459['query'][_0xe245('0x31')]));_0x149f26[_0xe245('0x30')]=_0x149f26[_0xe245('0x30')][_0xe245('0x44')]?_0x149f26[_0xe245('0x30')]:_0x539a82['model'];_0x149f26[_0xe245('0x34')]=qs['sort'](_0x32b459[_0xe245('0x2c')][_0xe245('0x35')]);_0x149f26['where']=qs[_0xe245('0x2e')](_[_0xe245('0x36')](_0x32b459['query'],_0x539a82['filters']));if(_0x32b459['query']['filter']){_0x149f26['where']=_[_0xe245('0x3b')](_0x149f26[_0xe245('0x38')],{'$or':_[_0xe245('0x28')](_0x149f26[_0xe245('0x30')],function(_0x28abc2){var _0x1514f0={};_0x1514f0[_0x28abc2]={'$like':'%'+_0x32b459[_0xe245('0x2c')]['filter']+'%'};return _0x1514f0;})});}_0x149f26=_[_0xe245('0x3b')]({},_0x149f26,_0x32b459[_0xe245('0x3c')]);return _0x27327e[_0xe245('0x48')](_0x149f26);}})[_0xe245('0x21')](function(_0x145f23){if(_0x145f23){_0x4420d7=_0x145f23['length'];if(!_0x32b459[_0xe245('0x2c')]['hasOwnProperty'](_0xe245('0x33'))){_0x149f26[_0xe245('0x17')]=qs[_0xe245('0x17')](_0x32b459[_0xe245('0x2c')][_0xe245('0x17')]);_0x149f26[_0xe245('0x1a')]=qs['offset'](_0x32b459['query'][_0xe245('0x1a')]);}return _0x27327e[_0xe245('0x48')](_0x149f26);}})[_0xe245('0x21')](function(_0x1dc350){if(_0x1dc350){return _0x1dc350?{'count':_0x4420d7,'rows':_0x1dc350}:null;}})[_0xe245('0x21')](respondWithResult(_0x293348,null))[_0xe245('0x45')](handleError(_0x293348,null));};exports[_0xe245('0x4c')]=function(_0x28f8ca,_0x18895a,_0xd86019){if(_0x28f8ca[_0xe245('0x47')]['id']){delete _0x28f8ca['body']['id'];}return db['ServicenowAccount'][_0xe245('0x49')]({'where':{'id':_0x28f8ca[_0xe245('0x43')]['id']}})[_0xe245('0x21')](handleEntityNotFound(_0x18895a,null))['then'](function(_0x5021b1){if(_0x5021b1){_0x28f8ca[_0xe245('0x47')][_0xe245('0x4d')]=_0x5021b1['id'];_0x28f8ca[_0xe245('0x47')][_0xe245('0x4e')]=integrations[_0xe245('0x4f')](_0x28f8ca['body']['channel'],_0x28f8ca[_0xe245('0x47')][_0xe245('0x39')]);_0x28f8ca[_0xe245('0x47')][_0xe245('0x50')]=integrations[_0xe245('0x51')](_0x28f8ca['body'][_0xe245('0x52')],_0x28f8ca[_0xe245('0x47')][_0xe245('0x39')]);return db[_0xe245('0x4a')][_0xe245('0x46')](_0x28f8ca['body'],{'include':[{'model':db[_0xe245('0x53')],'as':_0xe245('0x4e')},{'model':db[_0xe245('0x53')],'as':_0xe245('0x50')}]});}return null;})[_0xe245('0x21')](respondWithResult(_0x18895a,null))[_0xe245('0x45')](handleError(_0x18895a,null));};exports[_0xe245('0x54')]=function(_0x170438,_0x4a34d6,_0x1498e9){var _0x34ec3f=[_0xe245('0x55'),'hold_reason','knowledge',_0xe245('0x56'),_0xe245('0x57'),_0xe245('0x58'),'incident_state',_0xe245('0x59'),_0xe245('0x5a')];var _0x318ae2=['parent',_0xe245('0x55'),'caused_by',_0xe245('0x5b'),'upon_reject',_0xe245('0x5c'),'child_incidents',_0xe245('0x5d'),_0xe245('0x5e'),_0xe245('0x5f'),_0xe245('0x60'),_0xe245('0x61'),_0xe245('0x62'),_0xe245('0x63'),_0xe245('0x64'),_0xe245('0x65'),_0xe245('0x66'),_0xe245('0x67'),_0xe245('0x68'),_0xe245('0x34'),_0xe245('0x69'),_0xe245('0x6a'),_0xe245('0x6b'),_0xe245('0x6c'),_0xe245('0x6d'),'active',_0xe245('0x6e'),_0xe245('0x6f'),_0xe245('0x70'),_0xe245('0x71'),_0xe245('0x72'),_0xe245('0x73'),_0xe245('0x74'),_0xe245('0x75'),_0xe245('0x76'),_0xe245('0x77'),_0xe245('0x78'),'reopened_time',_0xe245('0x79'),'caller_id',_0xe245('0x7a'),_0xe245('0x56'),'work_notes',_0xe245('0x7b'),_0xe245('0x57'),'correlation_display',_0xe245('0x7c'),'work_start',_0xe245('0x7d'),_0xe245('0x7e'),_0xe245('0x7f'),_0xe245('0x80'),'calendar_duration','notify',_0xe245('0x81'),'close_notes','closed_by',_0xe245('0x82'),_0xe245('0x83'),_0xe245('0x84'),_0xe245('0x85'),'reopened_by','incident_state',_0xe245('0x86'),'problem_id','company',_0xe245('0x87'),'activity_due','assigned_to',_0xe245('0x59'),_0xe245('0x88'),'sla_due','approval',_0xe245('0x89'),_0xe245('0x8a'),_0xe245('0x8b'),_0xe245('0x8c'),_0xe245('0x8d'),'escalation',_0xe245('0x8e'),_0xe245('0x8f'),_0xe245('0x90'),_0xe245('0x5a')];var _0x2dac18='';var _0x5e3c9c='';var _0x1e6a62=[];var _0x38ff15='';var _0x16fea7='';var _0x6c03c6=[];var _0x204516='';var _0x27f53d='';var _0x3f1432={};var _0x358cf0='';return db[_0xe245('0x3d')][_0xe245('0x49')]({'where':{'id':_0x170438[_0xe245('0x43')]['id']},'attributes':['id',_0xe245('0x91'),_0xe245('0x92'),'email',_0xe245('0x93'),_0xe245('0x94')]})[_0xe245('0x21')](handleEntityNotFound(_0x4a34d6,null))['then'](function(_0x5a5e51){if(_0x5a5e51){_0x358cf0=_0x5a5e51[_0xe245('0x93')];var _0x1870b3=_0x358cf0[_0xe245('0x95')](-0x1);if(_0x1870b3==='/'){_0x358cf0=_0x358cf0[_0xe245('0x96')](0x0,_0x358cf0['lastIndexOf'](_0x1870b3));}_0x27f53d=util[_0xe245('0x97')](_0xe245('0x98'),_0x358cf0);_0x204516=util[_0xe245('0x97')](_0xe245('0x99'),_0x358cf0);_0x3f1432={'user':_0x5a5e51['username'],'pass':_0x5a5e51['password']};var _0x15d2e9={'method':_0xe245('0x9a'),'uri':_0x27f53d+_0xe245('0x9b'),'auth':_0x3f1432,'json':!![]};return rp(_0x15d2e9);}})[_0xe245('0x21')](function(_0x307c89){if(_0x307c89[_0xe245('0x9c')]['length']>0x0){_0x2dac18=_0x307c89['result'];}console[_0xe245('0x9d')](_0xe245('0x9e'),_0x2dac18);_0x6c03c6=[];_0x5e3c9c=Object[_0xe245('0x9f')]([],_0x2dac18);_['remove'](_0x5e3c9c,function(_0x1e7580){return!_0x34ec3f[_0xe245('0xa0')](_0x1e7580[_0xe245('0x25')]);});_0x5e3c9c[_0xe245('0xa1')](function(_0x397202){var _0x537220=createFieldObject(_0x204516,_0x3f1432,_0x397202[_0xe245('0xa2')],_0x397202[_0xe245('0x25')],_0x397202[_0xe245('0xa3')],![]);_0x6c03c6[_0xe245('0xa4')](_0x537220);});return Promise[_0xe245('0xa5')](_0x6c03c6);})['then'](function(_0x3f3164){_0x1e6a62=_0x3f3164;_0x38ff15=Object[_0xe245('0x9f')]([],_0x2dac18);console[_0xe245('0x9d')]('TCL:\x20_object',_0x2dac18);_[_0xe245('0xa6')](_0x38ff15,function(_0x4487d2){return _0x318ae2[_0xe245('0xa0')](_0x4487d2[_0xe245('0x25')]);});console[_0xe245('0x9d')](_0xe245('0xa7'),_0x38ff15);_0x6c03c6=[];_0x38ff15[_0xe245('0xa1')](function(_0x48e2f9){var _0x232683=createFieldObject(_0x204516,_0x3f1432,_0x48e2f9[_0xe245('0xa2')],_0x48e2f9[_0xe245('0x25')],_0x48e2f9[_0xe245('0xa3')],!![]);_0x6c03c6[_0xe245('0xa4')](_0x232683);});return Promise[_0xe245('0xa5')](_0x6c03c6);})[_0xe245('0x21')](function(_0x1b5940){_0x16fea7=_0x1b5940;var _0x340c70=_0x1e6a62[_0xe245('0xa8')](_0x16fea7);return{'count':_0x340c70[_0xe245('0x44')],'rows':_0x340c70};})[_0xe245('0x21')](respondWithResult(_0x4a34d6,null))[_0xe245('0x45')](function(_0x8d985a){console[_0xe245('0x9d')]('ServiceNow\x20error:\x20'+_0x8d985a);var _0x5bce81=_0x170438[_0xe245('0x2c')][_0xe245('0xa9')]?0x1f4:_0x8d985a[_0xe245('0xaa')]||0x1f4;logger[_0xe245('0x23')](_0x8d985a['stack']);delete _0x8d985a[_0xe245('0x25')];if(_0x5bce81===0x191){_0x5bce81=0x190;}_0x4a34d6[_0xe245('0x14')](_0x5bce81)[_0xe245('0x26')](_0x170438['query'][_0xe245('0xa9')]?{'message':_0xe245('0xab'),'statusCode':_0x8d985a['statusCode']}:_0x8d985a);});};function createFieldObject(_0x598aa8,_0x233c3a,_0x4d7466,_0x44a3ad,_0xa7e378,_0x4cf6da){return new Promise(function(_0x4d2e05,_0x33e5ef){var _0x5d9db={'id':_0x44a3ad,'name':_0xa7e378,'custom':_0x4cf6da};if(_0x4d7466===_0xe245('0xac')){_0x5d9db[_0xe245('0x3c')]=[{'name':'True','value':_0xe245('0xad')},{'name':_0xe245('0xae'),'value':_0xe245('0xaf')}];_0x4d2e05(_0x5d9db);}else{var _0x21445e={'method':_0xe245('0x9a'),'uri':_0x598aa8+_0xe245('0xb0')+_0x44a3ad,'auth':_0x233c3a,'json':!![]};return rp(_0x21445e)['then'](function(_0x531bec){var _0x289569=[];if(_0x531bec['result'][_0xe245('0x44')]>0x0){_0x531bec[_0xe245('0x9c')][_0xe245('0xa1')](function(_0x4b3ba8){if(_0x4b3ba8[_0xe245('0xb1')]==='false'){var _0x47abe7={'name':_0x4b3ba8[_0xe245('0xa3')],'value':_0x4b3ba8['value']};_0x289569[_0xe245('0xa4')](_0x47abe7);}});}_0x5d9db['options']=_0x289569;if(_0x5d9db['options'][_0xe245('0x44')]>0x0){_0x4d2e05(_0x5d9db);}else{if(_0x4cf6da==![]){_0x4d2e05();}else{_0x4d2e05(_0x5d9db);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index e7f0870..e07d751 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 _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x42ddba,_0x433562){var _0x372297=function(_0x3a10e3){while(--_0x3a10e3){_0x42ddba['push'](_0x42ddba['shift']());}};_0x372297(++_0x433562);}(_0x687b,0x14a));var _0xb687=function(_0x20e6c4,_0x573880){_0x20e6c4=_0x20e6c4-0x0;var _0x61fc99=_0x687b[_0x20e6c4];return _0x61fc99;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('ServicenowAccount',attributes,{'tableName':_0xb687('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','api','bluebird','request-promise'];(function(_0x47d17a,_0x24ae87){var _0x5d801a=function(_0x20e48b){while(--_0x20e48b){_0x47d17a['push'](_0x47d17a['shift']());}};_0x5d801a(++_0x24ae87);}(_0x71ab,0x64));var _0xb71a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x71ab[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));var integrations=require(_0xb71a('0x8'));module[_0xb71a('0x9')]=function(_0x22c072,_0x35a84e){return _0x22c072[_0xb71a('0xa')](_0xb71a('0xb'),attributes,{'tableName':_0xb71a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 6b0420d..1d48cd0 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 _0xdcf6=['model','include','map','stringify','ShowServicenowAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit'];(function(_0x4000fd,_0x2fcca3){var _0x16922f=function(_0x278055){while(--_0x278055){_0x4000fd['push'](_0x4000fd['shift']());}};_0x16922f(++_0x2fcca3);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x4f192e,_0x4d1756){_0x4f192e=_0x4f192e-0x0;var _0x49294d=_0xdcf6[_0x4f192e];return _0x49294d;};'use strict';var _=require('lodash');var util=require(_0x6dcf('0x0'));var moment=require(_0x6dcf('0x1'));var BPromise=require(_0x6dcf('0x2'));var rs=require(_0x6dcf('0x3'));var fs=require('fs');var Redis=require(_0x6dcf('0x4'));var db=require(_0x6dcf('0x5'))['db'];var utils=require(_0x6dcf('0x6'));var logger=require('../../config/logger')(_0x6dcf('0x7'));var config=require(_0x6dcf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6dcf('0x9')][_0x6dcf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5abd79,_0x56fdb2,_0x5766db){return new BPromise(function(_0x34517a,_0x4e2877){return client[_0x6dcf('0xb')](_0x5abd79,_0x5766db)[_0x6dcf('0xc')](function(_0x304a75){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x56fdb2,'request\x20sent');logger[_0x6dcf('0xd')](_0x6dcf('0xe'),_0x56fdb2,_0x6dcf('0xf'),JSON['stringify'](_0x304a75));if(_0x304a75[_0x6dcf('0x10')]){if(_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x11')]===0x1f4){logger[_0x6dcf('0x10')](_0x6dcf('0x12'),_0x56fdb2,_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);return _0x4e2877(_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);}logger[_0x6dcf('0x10')](_0x6dcf('0x12'),_0x56fdb2,_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);return _0x34517a(_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);}else{logger[_0x6dcf('0x14')](_0x6dcf('0x12'),_0x56fdb2,'request\x20sent');_0x34517a(_0x304a75[_0x6dcf('0x15')][_0x6dcf('0x13')]);}})[_0x6dcf('0x16')](function(_0x4874ff){logger[_0x6dcf('0x10')](_0x6dcf('0x12'),_0x56fdb2,_0x4874ff);_0x4e2877(_0x4874ff);});});}exports[_0x6dcf('0x17')]=function(_0x40b6ac){var _0x821c86=this;return new Promise(function(_0x83da87,_0x1bed56){return db[_0x6dcf('0x18')]['findAll']({'raw':_0x40b6ac[_0x6dcf('0x19')]?_0x40b6ac[_0x6dcf('0x19')][_0x6dcf('0x1a')]===undefined?!![]:![]:!![],'where':_0x40b6ac[_0x6dcf('0x19')]?_0x40b6ac[_0x6dcf('0x19')][_0x6dcf('0x1b')]||null:null,'attributes':_0x40b6ac[_0x6dcf('0x19')]?_0x40b6ac['options'][_0x6dcf('0x1c')]||null:null,'limit':_0x40b6ac['options']?_0x40b6ac[_0x6dcf('0x19')][_0x6dcf('0x1d')]||null:null,'include':_0x40b6ac[_0x6dcf('0x19')]?_0x40b6ac[_0x6dcf('0x19')]['include']?_['map'](_0x40b6ac[_0x6dcf('0x19')]['include'],function(_0x1df874){return{'model':db[_0x1df874[_0x6dcf('0x1e')]],'as':_0x1df874['as'],'attributes':_0x1df874[_0x6dcf('0x1c')],'include':_0x1df874[_0x6dcf('0x1f')]?_['map'](_0x1df874[_0x6dcf('0x1f')],function(_0x2b6dbe){return{'model':db[_0x2b6dbe[_0x6dcf('0x1e')]],'as':_0x2b6dbe['as'],'attributes':_0x2b6dbe[_0x6dcf('0x1c')],'include':_0x2b6dbe['include']?_[_0x6dcf('0x20')](_0x2b6dbe[_0x6dcf('0x1f')],function(_0x2dc909){return{'model':db[_0x2dc909[_0x6dcf('0x1e')]],'as':_0x2dc909['as'],'attributes':_0x2dc909[_0x6dcf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6dcf('0xc')](function(_0x3fad7e){logger[_0x6dcf('0x14')](_0x6dcf('0x17'),_0x40b6ac);logger[_0x6dcf('0xd')](_0x6dcf('0x17'),_0x40b6ac,JSON[_0x6dcf('0x21')](_0x3fad7e));_0x83da87(_0x3fad7e);})['catch'](function(_0x3a4356){logger[_0x6dcf('0x10')]('GetServicenowAccount',_0x3a4356['message'],_0x40b6ac);_0x1bed56(_0x821c86['error'](0x1f4,_0x3a4356['message']));});});};exports[_0x6dcf('0x22')]=function(_0x356ad1){var _0x4c106c=this;return new Promise(function(_0x3d4615,_0x271c8e){return db[_0x6dcf('0x18')][_0x6dcf('0x23')]({'raw':_0x356ad1['options']?_0x356ad1[_0x6dcf('0x19')][_0x6dcf('0x1a')]===undefined?!![]:![]:!![],'where':_0x356ad1[_0x6dcf('0x19')]?_0x356ad1[_0x6dcf('0x19')][_0x6dcf('0x1b')]||null:null,'attributes':_0x356ad1[_0x6dcf('0x19')]?_0x356ad1[_0x6dcf('0x19')][_0x6dcf('0x1c')]||null:null,'include':_0x356ad1[_0x6dcf('0x19')]?_0x356ad1[_0x6dcf('0x19')][_0x6dcf('0x1f')]?_[_0x6dcf('0x20')](_0x356ad1[_0x6dcf('0x19')]['include'],function(_0x3cfd7e){return{'model':db[_0x3cfd7e[_0x6dcf('0x1e')]],'as':_0x3cfd7e['as'],'attributes':_0x3cfd7e['attributes'],'include':_0x3cfd7e[_0x6dcf('0x1f')]?_[_0x6dcf('0x20')](_0x3cfd7e[_0x6dcf('0x1f')],function(_0x9ed57e){return{'model':db[_0x9ed57e[_0x6dcf('0x1e')]],'as':_0x9ed57e['as'],'attributes':_0x9ed57e[_0x6dcf('0x1c')],'include':_0x9ed57e[_0x6dcf('0x1f')]?_[_0x6dcf('0x20')](_0x9ed57e['include'],function(_0x2eb30f){return{'model':db[_0x2eb30f['model']],'as':_0x2eb30f['as'],'attributes':_0x2eb30f[_0x6dcf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6dcf('0xc')](function(_0x38dfa4){logger[_0x6dcf('0x14')](_0x6dcf('0x22'),_0x356ad1);logger[_0x6dcf('0xd')]('ShowServicenowAccount',_0x356ad1,JSON[_0x6dcf('0x21')](_0x38dfa4));_0x3d4615(_0x38dfa4);})['catch'](function(_0x441fc0){logger['error'](_0x6dcf('0x22'),_0x441fc0[_0x6dcf('0x13')],_0x356ad1);_0x271c8e(_0x4c106c[_0x6dcf('0x10')](0x1f4,_0x441fc0['message']));});});}; \ No newline at end of file +var _0x4eb9=['debug','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','ShowServicenowAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x26fd1e,_0x1113aa){var _0x4ce19a=function(_0x7f2303){while(--_0x7f2303){_0x26fd1e['push'](_0x26fd1e['shift']());}};_0x4ce19a(++_0x1113aa);}(_0x4eb9,0x1da));var _0x94eb=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x4eb9[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require('lodash');var util=require(_0x94eb('0x0'));var moment=require(_0x94eb('0x1'));var BPromise=require(_0x94eb('0x2'));var rs=require(_0x94eb('0x3'));var fs=require('fs');var Redis=require(_0x94eb('0x4'));var db=require(_0x94eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x94eb('0x6'))(_0x94eb('0x7'));var config=require(_0x94eb('0x8'));var jayson=require(_0x94eb('0x9'));var client=jayson['client'][_0x94eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x87fe61,_0xde5a63,_0x29932e){return new BPromise(function(_0x5285d7,_0xeb26c6){return client[_0x94eb('0xb')](_0x87fe61,_0x29932e)[_0x94eb('0xc')](function(_0x5cd651){logger[_0x94eb('0xd')](_0x94eb('0xe'),_0xde5a63,_0x94eb('0xf'));logger[_0x94eb('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0xde5a63,_0x94eb('0xf'),JSON[_0x94eb('0x11')](_0x5cd651));if(_0x5cd651[_0x94eb('0x12')]){if(_0x5cd651[_0x94eb('0x12')][_0x94eb('0x13')]===0x1f4){logger[_0x94eb('0x12')](_0x94eb('0xe'),_0xde5a63,_0x5cd651[_0x94eb('0x12')]['message']);return _0xeb26c6(_0x5cd651['error']['message']);}logger[_0x94eb('0x12')](_0x94eb('0xe'),_0xde5a63,_0x5cd651[_0x94eb('0x12')][_0x94eb('0x14')]);return _0x5285d7(_0x5cd651[_0x94eb('0x12')]['message']);}else{logger['info'](_0x94eb('0xe'),_0xde5a63,'request\x20sent');_0x5285d7(_0x5cd651[_0x94eb('0x15')][_0x94eb('0x14')]);}})[_0x94eb('0x16')](function(_0x13c2ae){logger[_0x94eb('0x12')](_0x94eb('0xe'),_0xde5a63,_0x13c2ae);_0xeb26c6(_0x13c2ae);});});}exports[_0x94eb('0x17')]=function(_0xe5aa54){var _0x524e95=this;return new Promise(function(_0x11bc98,_0x3d87aa){return db[_0x94eb('0x18')][_0x94eb('0x19')]({'raw':_0xe5aa54[_0x94eb('0x1a')]?_0xe5aa54[_0x94eb('0x1a')][_0x94eb('0x1b')]===undefined?!![]:![]:!![],'where':_0xe5aa54['options']?_0xe5aa54[_0x94eb('0x1a')]['where']||null:null,'attributes':_0xe5aa54[_0x94eb('0x1a')]?_0xe5aa54[_0x94eb('0x1a')][_0x94eb('0x1c')]||null:null,'limit':_0xe5aa54[_0x94eb('0x1a')]?_0xe5aa54['options'][_0x94eb('0x1d')]||null:null,'include':_0xe5aa54['options']?_0xe5aa54[_0x94eb('0x1a')][_0x94eb('0x1e')]?_[_0x94eb('0x1f')](_0xe5aa54[_0x94eb('0x1a')][_0x94eb('0x1e')],function(_0x4580aa){return{'model':db[_0x4580aa[_0x94eb('0x20')]],'as':_0x4580aa['as'],'attributes':_0x4580aa[_0x94eb('0x1c')],'include':_0x4580aa[_0x94eb('0x1e')]?_[_0x94eb('0x1f')](_0x4580aa[_0x94eb('0x1e')],function(_0x261b02){return{'model':db[_0x261b02[_0x94eb('0x20')]],'as':_0x261b02['as'],'attributes':_0x261b02[_0x94eb('0x1c')],'include':_0x261b02[_0x94eb('0x1e')]?_[_0x94eb('0x1f')](_0x261b02[_0x94eb('0x1e')],function(_0x647317){return{'model':db[_0x647317[_0x94eb('0x20')]],'as':_0x647317['as'],'attributes':_0x647317['attributes']};}):[]};}):[]};}):[]:[]})[_0x94eb('0xc')](function(_0x31f342){logger[_0x94eb('0xd')](_0x94eb('0x17'),_0xe5aa54);logger[_0x94eb('0x10')](_0x94eb('0x17'),_0xe5aa54,JSON[_0x94eb('0x11')](_0x31f342));_0x11bc98(_0x31f342);})[_0x94eb('0x16')](function(_0x532160){logger[_0x94eb('0x12')](_0x94eb('0x17'),_0x532160[_0x94eb('0x14')],_0xe5aa54);_0x3d87aa(_0x524e95[_0x94eb('0x12')](0x1f4,_0x532160['message']));});});};exports[_0x94eb('0x21')]=function(_0x1d025f){var _0x5dda44=this;return new Promise(function(_0x3a1778,_0x3b4881){return db['ServicenowAccount'][_0x94eb('0x22')]({'raw':_0x1d025f[_0x94eb('0x1a')]?_0x1d025f[_0x94eb('0x1a')][_0x94eb('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d025f['options']?_0x1d025f['options']['where']||null:null,'attributes':_0x1d025f[_0x94eb('0x1a')]?_0x1d025f['options']['attributes']||null:null,'include':_0x1d025f[_0x94eb('0x1a')]?_0x1d025f[_0x94eb('0x1a')][_0x94eb('0x1e')]?_[_0x94eb('0x1f')](_0x1d025f['options'][_0x94eb('0x1e')],function(_0x20aefa){return{'model':db[_0x20aefa[_0x94eb('0x20')]],'as':_0x20aefa['as'],'attributes':_0x20aefa['attributes'],'include':_0x20aefa[_0x94eb('0x1e')]?_[_0x94eb('0x1f')](_0x20aefa[_0x94eb('0x1e')],function(_0x6da481){return{'model':db[_0x6da481[_0x94eb('0x20')]],'as':_0x6da481['as'],'attributes':_0x6da481['attributes'],'include':_0x6da481[_0x94eb('0x1e')]?_[_0x94eb('0x1f')](_0x6da481[_0x94eb('0x1e')],function(_0x1a1974){return{'model':db[_0x1a1974[_0x94eb('0x20')]],'as':_0x1a1974['as'],'attributes':_0x1a1974[_0x94eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x94eb('0xc')](function(_0x3d6962){logger[_0x94eb('0xd')](_0x94eb('0x21'),_0x1d025f);logger[_0x94eb('0x10')](_0x94eb('0x21'),_0x1d025f,JSON['stringify'](_0x3d6962));_0x3a1778(_0x3d6962);})[_0x94eb('0x16')](function(_0x5078fa){logger[_0x94eb('0x12')](_0x94eb('0x21'),_0x5078fa[_0x94eb('0x14')],_0x1d025f);_0x3b4881(_0x5dda44['error'](0x1f4,_0x5078fa[_0x94eb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ee7fad6..0ccb8fc 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 _0x96a9=['get','/:id','/:id/fields','getFields','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x96a9,0x100));var _0x996a=function(_0x386e94,_0x2ded59){_0x386e94=_0x386e94-0x0;var _0xbf521b=_0x96a9[_0x386e94];return _0xbf521b;};'use strict';var multer=require(_0x996a('0x0'));var util=require(_0x996a('0x1'));var path=require('path');var timeout=require(_0x996a('0x2'));var express=require('express');var router=express[_0x996a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x996a('0x4'));var interaction=require(_0x996a('0x5'));var config=require(_0x996a('0x6'));var controller=require(_0x996a('0x7'));router[_0x996a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x996a('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x996a('0x8')](_0x996a('0xa'),auth['isAuthenticated'](),controller[_0x996a('0xb')]);router[_0x996a('0x8')](_0x996a('0xc'),auth[_0x996a('0xd')](),controller['getSubjects']);router['get'](_0x996a('0xe'),auth[_0x996a('0xd')](),controller[_0x996a('0xf')]);router[_0x996a('0x10')]('/',auth[_0x996a('0xd')](),controller[_0x996a('0x11')]);router['put'](_0x996a('0x9'),auth[_0x996a('0xd')](),controller[_0x996a('0x12')]);router[_0x996a('0x13')](_0x996a('0x9'),auth[_0x996a('0xd')](),controller[_0x996a('0x14')]);module[_0x996a('0x15')]=router; \ No newline at end of file +var _0x8fea=['express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x27c2ff,_0x5891ed){var _0xd80b7a=function(_0x398a){while(--_0x398a){_0x27c2ff['push'](_0x27c2ff['shift']());}};_0xd80b7a(++_0x5891ed);}(_0x8fea,0x1c4));var _0xa8fe=function(_0x1d14a4,_0x3d0375){_0x1d14a4=_0x1d14a4-0x0;var _0x5cae92=_0x8fea[_0x1d14a4];return _0x5cae92;};'use strict';var multer=require(_0xa8fe('0x0'));var util=require(_0xa8fe('0x1'));var path=require(_0xa8fe('0x2'));var timeout=require(_0xa8fe('0x3'));var express=require(_0xa8fe('0x4'));var router=express[_0xa8fe('0x5')]();var fs_extra=require(_0xa8fe('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa8fe('0x7'));var controller=require(_0xa8fe('0x8'));router['get']('/',auth[_0xa8fe('0x9')](),controller['index']);router[_0xa8fe('0xa')](_0xa8fe('0xb'),auth[_0xa8fe('0x9')](),controller[_0xa8fe('0xc')]);router[_0xa8fe('0xa')](_0xa8fe('0xd'),auth['isAuthenticated'](),controller[_0xa8fe('0xe')]);router[_0xa8fe('0xa')](_0xa8fe('0xf'),auth['isAuthenticated'](),controller[_0xa8fe('0x10')]);router[_0xa8fe('0xa')](_0xa8fe('0x11'),auth[_0xa8fe('0x9')](),controller[_0xa8fe('0x12')]);router[_0xa8fe('0x13')]('/',auth['isAuthenticated'](),controller[_0xa8fe('0x14')]);router[_0xa8fe('0x15')](_0xa8fe('0xb'),auth[_0xa8fe('0x9')](),controller[_0xa8fe('0x16')]);router[_0xa8fe('0x17')](_0xa8fe('0xb'),auth[_0xa8fe('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 0146e0f..aac4657 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 _0x8032=['exports','STRING','sequelize'];(function(_0x5bc69d,_0x4bd734){var _0x497694=function(_0x24bd1d){while(--_0x24bd1d){_0x5bc69d['push'](_0x5bc69d['shift']());}};_0x497694(++_0x4bd734);}(_0x8032,0x1ac));var _0x2803=function(_0x3a1256,_0x1fe2db){_0x3a1256=_0x3a1256-0x0;var _0x1bd352=_0x8032[_0x3a1256];return _0x1bd352;};'use strict';var Sequelize=require(_0x2803('0x0'));module[_0x2803('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2803('0x2')]}}; \ No newline at end of file +var _0xfcb2=['STRING','exports'];(function(_0x210da8,_0x170339){var _0x4673d6=function(_0x1e2e17){while(--_0x1e2e17){_0x210da8['push'](_0x210da8['shift']());}};_0x4673d6(++_0x170339);}(_0xfcb2,0xcd));var _0x2fcb=function(_0x2beca6,_0x28a43c){_0x2beca6=_0x2beca6-0x0;var _0x15c61e=_0xfcb2[_0x2beca6];return _0x15c61e;};'use strict';var Sequelize=require('sequelize');module[_0x2fcb('0x0')]={'name':{'type':Sequelize[_0x2fcb('0x1')]},'description':{'type':Sequelize[_0x2fcb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 58c609e..86d709f 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 _0xf641=['status','json','offset','limit','undefined','count','apply','reject','then','destroy','error','stack','name','index','ServicenowConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','getFields','findOne','getSubjects','ServicenowField','rawAttributes','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x459399,_0x4caf0d){var _0xeb0378=function(_0x4361e7){while(--_0x4361e7){_0x459399['push'](_0x459399['shift']());}};_0xeb0378(++_0x4caf0d);}(_0xf641,0x88));var _0x1f64=function(_0x109333,_0x5ce132){_0x109333=_0x109333-0x0;var _0x7eb389=_0xf641[_0x109333];return _0x7eb389;};'use strict';var emlformat=require(_0x1f64('0x0'));var rimraf=require(_0x1f64('0x1'));var zipdir=require(_0x1f64('0x2'));var jsonpatch=require(_0x1f64('0x3'));var rp=require(_0x1f64('0x4'));var moment=require(_0x1f64('0x5'));var BPromise=require(_0x1f64('0x6'));var Mustache=require(_0x1f64('0x7'));var util=require(_0x1f64('0x8'));var path=require(_0x1f64('0x9'));var sox=require(_0x1f64('0xa'));var csv=require(_0x1f64('0xb'));var ejs=require(_0x1f64('0xc'));var fs=require('fs');var fs_extra=require(_0x1f64('0xd'));var _=require(_0x1f64('0xe'));var squel=require(_0x1f64('0xf'));var crypto=require(_0x1f64('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1f64('0xb'));var querystring=require('querystring');var Papa=require(_0x1f64('0x11'));var Redis=require(_0x1f64('0x12'));var authService=require(_0x1f64('0x13'));var qs=require(_0x1f64('0x14'));var as=require(_0x1f64('0x15'));var hardwareService=require(_0x1f64('0x16'));var logger=require('../../config/logger')(_0x1f64('0x17'));var utils=require('../../config/utils');var config=require(_0x1f64('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f64('0x19'))['db'];function respondWithStatusCode(_0x1ad2fa,_0x24ffac){_0x24ffac=_0x24ffac||0xcc;return function(_0x399eb3){if(_0x399eb3){return _0x1ad2fa[_0x1f64('0x1a')](_0x24ffac);}return _0x1ad2fa['status'](_0x24ffac)[_0x1f64('0x1b')]();};}function respondWithResult(_0xb3ca17,_0x347ae5){_0x347ae5=_0x347ae5||0xc8;return function(_0xfb5c05){if(_0xfb5c05){return _0xb3ca17[_0x1f64('0x1c')](_0x347ae5)[_0x1f64('0x1d')](_0xfb5c05);}};}function respondWithFilteredResult(_0x3588a2,_0x3dfe84){return function(_0x44f25d){if(_0x44f25d){var _0x3213a6=typeof _0x3dfe84[_0x1f64('0x1e')]==='undefined'&&typeof _0x3dfe84[_0x1f64('0x1f')]===_0x1f64('0x20');var _0x38ba62=_0x44f25d[_0x1f64('0x21')];var _0x3483b3=_0x3213a6?0x0:_0x3dfe84['offset'];var _0x3ef85b=_0x3213a6?_0x44f25d['count']:_0x3dfe84['offset']+_0x3dfe84['limit'];var _0x29b193;if(_0x3ef85b>=_0x38ba62){_0x3ef85b=_0x38ba62;_0x29b193=0xc8;}else{_0x29b193=0xce;}_0x3588a2[_0x1f64('0x1c')](_0x29b193);return _0x3588a2['set']('Content-Range',_0x3483b3+'-'+_0x3ef85b+'/'+_0x38ba62)[_0x1f64('0x1d')](_0x44f25d);}return null;};}function patchUpdates(_0x5d56b2){return function(_0x1654a3){try{jsonpatch[_0x1f64('0x22')](_0x1654a3,_0x5d56b2,!![]);}catch(_0x21c7a4){return BPromise[_0x1f64('0x23')](_0x21c7a4);}return _0x1654a3['save']();};}function saveUpdates(_0x52da7d,_0x503c84){return function(_0x50f61e){if(_0x50f61e){return _0x50f61e['update'](_0x52da7d)[_0x1f64('0x24')](function(_0x355bb7){return _0x355bb7;});}return null;};}function removeEntity(_0xec9a97,_0x738586){return function(_0x4a7536){if(_0x4a7536){return _0x4a7536[_0x1f64('0x25')]()[_0x1f64('0x24')](function(){_0xec9a97['status'](0xcc)[_0x1f64('0x1b')]();});}};}function handleEntityNotFound(_0x58eeeb,_0x51578d){return function(_0x31f30a){if(!_0x31f30a){_0x58eeeb[_0x1f64('0x1a')](0x194);}return _0x31f30a;};}function handleError(_0x4ceee6,_0x370855){_0x370855=_0x370855||0x1f4;return function(_0x183a52){logger[_0x1f64('0x26')](_0x183a52[_0x1f64('0x27')]);if(_0x183a52['name']){delete _0x183a52[_0x1f64('0x28')];}_0x4ceee6[_0x1f64('0x1c')](_0x370855)['send'](_0x183a52);};}exports[_0x1f64('0x29')]=function(_0x340c0a,_0x4b8e4a){var _0x2d3531={},_0x2be483={},_0x431933={'count':0x0,'rows':[]};var _0x1d1228=_['map'](db[_0x1f64('0x2a')]['rawAttributes'],function(_0x527194){return{'name':_0x527194[_0x1f64('0x2b')],'type':_0x527194[_0x1f64('0x2c')][_0x1f64('0x2d')]};});_0x2be483['model']=_['map'](_0x1d1228,_0x1f64('0x28'));_0x2be483[_0x1f64('0x2e')]=_[_0x1f64('0x2f')](_0x340c0a[_0x1f64('0x2e')]);_0x2be483[_0x1f64('0x30')]=_[_0x1f64('0x31')](_0x2be483[_0x1f64('0x32')],_0x2be483[_0x1f64('0x2e')]);_0x2d3531[_0x1f64('0x33')]=_[_0x1f64('0x31')](_0x2be483[_0x1f64('0x32')],qs['fields'](_0x340c0a[_0x1f64('0x2e')][_0x1f64('0x34')]));_0x2d3531[_0x1f64('0x33')]=_0x2d3531['attributes'][_0x1f64('0x35')]?_0x2d3531['attributes']:_0x2be483['model'];if(!_0x340c0a[_0x1f64('0x2e')][_0x1f64('0x36')](_0x1f64('0x37'))){_0x2d3531[_0x1f64('0x1f')]=qs['limit'](_0x340c0a[_0x1f64('0x2e')][_0x1f64('0x1f')]);_0x2d3531['offset']=qs[_0x1f64('0x1e')](_0x340c0a[_0x1f64('0x2e')][_0x1f64('0x1e')]);}_0x2d3531[_0x1f64('0x38')]=qs[_0x1f64('0x39')](_0x340c0a['query'][_0x1f64('0x39')]);_0x2d3531[_0x1f64('0x3a')]=qs[_0x1f64('0x30')](_[_0x1f64('0x3b')](_0x340c0a[_0x1f64('0x2e')],_0x2be483['filters']),_0x1d1228);if(_0x340c0a['query'][_0x1f64('0x3c')]){_0x2d3531[_0x1f64('0x3a')]=_[_0x1f64('0x3d')](_0x2d3531[_0x1f64('0x3a')],{'$or':_[_0x1f64('0x3e')](_0x1d1228,function(_0x3d2a6e){if(_0x3d2a6e[_0x1f64('0x2c')]!==_0x1f64('0x3f')){var _0x5a0ec0={};_0x5a0ec0[_0x3d2a6e['name']]={'$like':'%'+_0x340c0a[_0x1f64('0x2e')][_0x1f64('0x3c')]+'%'};return _0x5a0ec0;}})});}_0x2d3531=_[_0x1f64('0x3d')]({},_0x2d3531,_0x340c0a[_0x1f64('0x40')]);var _0x4a7858={'where':_0x2d3531[_0x1f64('0x3a')]};return db[_0x1f64('0x2a')]['count'](_0x4a7858)[_0x1f64('0x24')](function(_0x17e613){_0x431933[_0x1f64('0x21')]=_0x17e613;if(_0x340c0a['query']['includeAll']){_0x2d3531[_0x1f64('0x41')]=[{'all':!![]}];}return db[_0x1f64('0x2a')][_0x1f64('0x42')](_0x2d3531);})['then'](function(_0x12e736){_0x431933[_0x1f64('0x43')]=_0x12e736;return _0x431933;})['then'](respondWithFilteredResult(_0x4b8e4a,_0x2d3531))[_0x1f64('0x44')](handleError(_0x4b8e4a,null));};exports[_0x1f64('0x45')]=function(_0x1a2a6d,_0x19d330){var _0x439160={'raw':![],'where':{'id':_0x1a2a6d[_0x1f64('0x46')]['id']}},_0x59a637={};_0x59a637[_0x1f64('0x32')]=_[_0x1f64('0x2f')](db['ServicenowConfiguration']['rawAttributes']);_0x59a637[_0x1f64('0x2e')]=_[_0x1f64('0x2f')](_0x1a2a6d['query']);_0x59a637[_0x1f64('0x30')]=_['intersection'](_0x59a637[_0x1f64('0x32')],_0x59a637[_0x1f64('0x2e')]);_0x439160['attributes']=_[_0x1f64('0x31')](_0x59a637['model'],qs['fields'](_0x1a2a6d[_0x1f64('0x2e')]['fields']));_0x439160[_0x1f64('0x33')]=_0x439160[_0x1f64('0x33')][_0x1f64('0x35')]?_0x439160[_0x1f64('0x33')]:_0x59a637['model'];if(_0x1a2a6d[_0x1f64('0x2e')][_0x1f64('0x47')]){_0x439160[_0x1f64('0x41')]=[{'all':!![]}];}_0x439160=_['merge']({},_0x439160,_0x1a2a6d[_0x1f64('0x40')]);return db[_0x1f64('0x2a')][_0x1f64('0x48')](_0x439160)[_0x1f64('0x24')](handleEntityNotFound(_0x19d330,null))[_0x1f64('0x24')](respondWithResult(_0x19d330,null))[_0x1f64('0x44')](handleError(_0x19d330,null));};exports[_0x1f64('0x49')]=function(_0x1b9b63,_0x59944e){return db[_0x1f64('0x2a')][_0x1f64('0x49')](_0x1b9b63[_0x1f64('0x4a')],{})[_0x1f64('0x24')](respondWithResult(_0x59944e,0xc9))[_0x1f64('0x44')](handleError(_0x59944e,null));};exports[_0x1f64('0x4b')]=function(_0x47a862,_0x80b4fc){if(_0x47a862[_0x1f64('0x4a')]['id']){delete _0x47a862['body']['id'];}return db[_0x1f64('0x2a')][_0x1f64('0x48')]({'where':{'id':_0x47a862[_0x1f64('0x46')]['id']}})[_0x1f64('0x24')](handleEntityNotFound(_0x80b4fc,null))[_0x1f64('0x24')](saveUpdates(_0x47a862['body'],null))[_0x1f64('0x24')](respondWithResult(_0x80b4fc,null))[_0x1f64('0x44')](handleError(_0x80b4fc,null));};exports['destroy']=function(_0x2a9304,_0x2ec42c){return db['ServicenowConfiguration'][_0x1f64('0x48')]({'where':{'id':_0x2a9304[_0x1f64('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ec42c,null))[_0x1f64('0x24')](removeEntity(_0x2ec42c,null))[_0x1f64('0x44')](handleError(_0x2ec42c,null));};exports[_0x1f64('0x4c')]=function(_0x2de3b6,_0xe926f,_0x328f8f){var _0x369551={};var _0x4b9742={};var _0x9e769c;var _0x276a96;return db[_0x1f64('0x2a')][_0x1f64('0x4d')]({'where':{'id':_0x2de3b6[_0x1f64('0x46')]['id']}})[_0x1f64('0x24')](handleEntityNotFound(_0xe926f,null))[_0x1f64('0x24')](function(_0x3c9b43){if(_0x3c9b43){_0x9e769c=_0x3c9b43;_0x4b9742[_0x1f64('0x32')]=_[_0x1f64('0x2f')](db['ServicenowField']['rawAttributes']);_0x4b9742[_0x1f64('0x2e')]=_[_0x1f64('0x2f')](_0x2de3b6[_0x1f64('0x2e')]);_0x4b9742['filters']=_[_0x1f64('0x31')](_0x4b9742[_0x1f64('0x32')],_0x4b9742[_0x1f64('0x2e')]);_0x369551[_0x1f64('0x33')]=_[_0x1f64('0x31')](_0x4b9742[_0x1f64('0x32')],qs[_0x1f64('0x34')](_0x2de3b6[_0x1f64('0x2e')][_0x1f64('0x34')]));_0x369551[_0x1f64('0x33')]=_0x369551[_0x1f64('0x33')][_0x1f64('0x35')]?_0x369551[_0x1f64('0x33')]:_0x4b9742['model'];_0x369551[_0x1f64('0x38')]=qs[_0x1f64('0x39')](_0x2de3b6[_0x1f64('0x2e')]['sort']);_0x369551[_0x1f64('0x3a')]=qs['filters'](_['pick'](_0x2de3b6[_0x1f64('0x2e')],_0x4b9742['filters']));if(_0x2de3b6[_0x1f64('0x2e')][_0x1f64('0x3c')]){_0x369551[_0x1f64('0x3a')]=_[_0x1f64('0x3d')](_0x369551[_0x1f64('0x3a')],{'$or':_[_0x1f64('0x3e')](_0x369551[_0x1f64('0x33')],function(_0x1c6d39){var _0x230b1e={};_0x230b1e[_0x1c6d39]={'$like':'%'+_0x2de3b6[_0x1f64('0x2e')][_0x1f64('0x3c')]+'%'};return _0x230b1e;})});}_0x369551=_[_0x1f64('0x3d')]({},_0x369551,_0x2de3b6[_0x1f64('0x40')]);return _0x9e769c[_0x1f64('0x4c')](_0x369551);}})[_0x1f64('0x24')](function(_0x3dc299){if(_0x3dc299){_0x276a96=_0x3dc299[_0x1f64('0x35')];if(!_0x2de3b6[_0x1f64('0x2e')][_0x1f64('0x36')](_0x1f64('0x37'))){_0x369551[_0x1f64('0x1f')]=qs[_0x1f64('0x1f')](_0x2de3b6['query'][_0x1f64('0x1f')]);_0x369551[_0x1f64('0x1e')]=qs[_0x1f64('0x1e')](_0x2de3b6[_0x1f64('0x2e')][_0x1f64('0x1e')]);}return _0x9e769c['getFields'](_0x369551);}})[_0x1f64('0x24')](function(_0x2183ec){if(_0x2183ec){return _0x2183ec?{'count':_0x276a96,'rows':_0x2183ec}:null;}})['then'](respondWithResult(_0xe926f,null))[_0x1f64('0x44')](handleError(_0xe926f,null));};exports[_0x1f64('0x4e')]=function(_0x4f8a46,_0x416ed9,_0x4fa9f0){var _0x787949={};var _0x2db55e={};var _0x35fdb4;var _0x5d5f8a;return db[_0x1f64('0x2a')]['findOne']({'where':{'id':_0x4f8a46[_0x1f64('0x46')]['id']}})[_0x1f64('0x24')](handleEntityNotFound(_0x416ed9,null))['then'](function(_0x306536){if(_0x306536){_0x35fdb4=_0x306536;_0x2db55e[_0x1f64('0x32')]=_[_0x1f64('0x2f')](db[_0x1f64('0x4f')][_0x1f64('0x50')]);_0x2db55e[_0x1f64('0x2e')]=_[_0x1f64('0x2f')](_0x4f8a46[_0x1f64('0x2e')]);_0x2db55e[_0x1f64('0x30')]=_['intersection'](_0x2db55e[_0x1f64('0x32')],_0x2db55e[_0x1f64('0x2e')]);_0x787949[_0x1f64('0x33')]=_[_0x1f64('0x31')](_0x2db55e[_0x1f64('0x32')],qs['fields'](_0x4f8a46[_0x1f64('0x2e')]['fields']));_0x787949['attributes']=_0x787949[_0x1f64('0x33')][_0x1f64('0x35')]?_0x787949[_0x1f64('0x33')]:_0x2db55e[_0x1f64('0x32')];_0x787949[_0x1f64('0x38')]=qs['sort'](_0x4f8a46[_0x1f64('0x2e')][_0x1f64('0x39')]);_0x787949[_0x1f64('0x3a')]=qs[_0x1f64('0x30')](_['pick'](_0x4f8a46[_0x1f64('0x2e')],_0x2db55e['filters']));if(_0x4f8a46[_0x1f64('0x2e')][_0x1f64('0x3c')]){_0x787949[_0x1f64('0x3a')]=_[_0x1f64('0x3d')](_0x787949[_0x1f64('0x3a')],{'$or':_[_0x1f64('0x3e')](_0x787949[_0x1f64('0x33')],function(_0x450c62){var _0xb57e33={};_0xb57e33[_0x450c62]={'$like':'%'+_0x4f8a46[_0x1f64('0x2e')]['filter']+'%'};return _0xb57e33;})});}_0x787949=_[_0x1f64('0x3d')]({},_0x787949,_0x4f8a46[_0x1f64('0x40')]);return _0x35fdb4[_0x1f64('0x4e')](_0x787949);}})[_0x1f64('0x24')](function(_0x442720){if(_0x442720){_0x5d5f8a=_0x442720[_0x1f64('0x35')];if(!_0x4f8a46[_0x1f64('0x2e')][_0x1f64('0x36')](_0x1f64('0x37'))){_0x787949['limit']=qs[_0x1f64('0x1f')](_0x4f8a46['query']['limit']);_0x787949['offset']=qs[_0x1f64('0x1e')](_0x4f8a46[_0x1f64('0x2e')][_0x1f64('0x1e')]);}return _0x35fdb4[_0x1f64('0x4e')](_0x787949);}})[_0x1f64('0x24')](function(_0x581c92){if(_0x581c92){return _0x581c92?{'count':_0x5d5f8a,'rows':_0x581c92}:null;}})[_0x1f64('0x24')](respondWithResult(_0x416ed9,null))[_0x1f64('0x44')](handleError(_0x416ed9,null));};exports[_0x1f64('0x51')]=function(_0x517ad4,_0x420047,_0x5b0d7b){var _0x22561c={};var _0x2fc16b={};var _0x5a2d1a;var _0x49cdfc;return db[_0x1f64('0x2a')]['findOne']({'where':{'id':_0x517ad4[_0x1f64('0x46')]['id']}})[_0x1f64('0x24')](handleEntityNotFound(_0x420047,null))[_0x1f64('0x24')](function(_0x85cbe6){if(_0x85cbe6){_0x5a2d1a=_0x85cbe6;_0x2fc16b[_0x1f64('0x32')]=_[_0x1f64('0x2f')](db[_0x1f64('0x4f')][_0x1f64('0x50')]);_0x2fc16b[_0x1f64('0x2e')]=_[_0x1f64('0x2f')](_0x517ad4[_0x1f64('0x2e')]);_0x2fc16b[_0x1f64('0x30')]=_[_0x1f64('0x31')](_0x2fc16b['model'],_0x2fc16b[_0x1f64('0x2e')]);_0x22561c[_0x1f64('0x33')]=_[_0x1f64('0x31')](_0x2fc16b[_0x1f64('0x32')],qs[_0x1f64('0x34')](_0x517ad4[_0x1f64('0x2e')][_0x1f64('0x34')]));_0x22561c['attributes']=_0x22561c[_0x1f64('0x33')][_0x1f64('0x35')]?_0x22561c['attributes']:_0x2fc16b[_0x1f64('0x32')];_0x22561c[_0x1f64('0x38')]=qs[_0x1f64('0x39')](_0x517ad4['query']['sort']);_0x22561c['where']=qs[_0x1f64('0x30')](_[_0x1f64('0x3b')](_0x517ad4[_0x1f64('0x2e')],_0x2fc16b[_0x1f64('0x30')]));if(_0x517ad4['query'][_0x1f64('0x3c')]){_0x22561c[_0x1f64('0x3a')]=_[_0x1f64('0x3d')](_0x22561c[_0x1f64('0x3a')],{'$or':_['map'](_0x22561c[_0x1f64('0x33')],function(_0xc84577){var _0x3b96e4={};_0x3b96e4[_0xc84577]={'$like':'%'+_0x517ad4[_0x1f64('0x2e')]['filter']+'%'};return _0x3b96e4;})});}_0x22561c=_['merge']({},_0x22561c,_0x517ad4['options']);return _0x5a2d1a[_0x1f64('0x51')](_0x22561c);}})[_0x1f64('0x24')](function(_0x2c48c8){if(_0x2c48c8){_0x49cdfc=_0x2c48c8[_0x1f64('0x35')];if(!_0x517ad4['query'][_0x1f64('0x36')](_0x1f64('0x37'))){_0x22561c[_0x1f64('0x1f')]=qs[_0x1f64('0x1f')](_0x517ad4[_0x1f64('0x2e')][_0x1f64('0x1f')]);_0x22561c['offset']=qs[_0x1f64('0x1e')](_0x517ad4['query']['offset']);}return _0x5a2d1a['getDescriptions'](_0x22561c);}})['then'](function(_0x28f6b8){if(_0x28f6b8){return _0x28f6b8?{'count':_0x49cdfc,'rows':_0x28f6b8}:null;}})[_0x1f64('0x24')](respondWithResult(_0x420047,null))[_0x1f64('0x44')](handleError(_0x420047,null));}; \ No newline at end of file +var _0xe6ec=['keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','show','length','find','create','catch','update','body','params','getFields','ServicenowField','order','pick','getSubjects','nolimit','getDescriptions','findOne','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','then','destroy','stack','name','send','ServicenowConfiguration','rawAttributes','fieldName','model','query'];(function(_0x427c9b,_0x39bd68){var _0x1eed73=function(_0x5a2298){while(--_0x5a2298){_0x427c9b['push'](_0x427c9b['shift']());}};_0x1eed73(++_0x39bd68);}(_0xe6ec,0xfd));var _0xce6e=function(_0x55c918,_0x1db786){_0x55c918=_0x55c918-0x0;var _0x24583d=_0xe6ec[_0x55c918];return _0x24583d;};'use strict';var emlformat=require(_0xce6e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce6e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce6e('0x2'));var moment=require(_0xce6e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xce6e('0x4'));var util=require('util');var path=require(_0xce6e('0x5'));var sox=require(_0xce6e('0x6'));var csv=require(_0xce6e('0x7'));var ejs=require(_0xce6e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce6e('0x9'));var squel=require(_0xce6e('0xa'));var crypto=require(_0xce6e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xce6e('0xc'));var toCsv=require(_0xce6e('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xce6e('0xd'));var authService=require(_0xce6e('0xe'));var qs=require(_0xce6e('0xf'));var as=require(_0xce6e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce6e('0x11'))(_0xce6e('0x12'));var utils=require(_0xce6e('0x13'));var config=require(_0xce6e('0x14'));var licenseUtil=require(_0xce6e('0x15'));var db=require(_0xce6e('0x16'))['db'];function respondWithStatusCode(_0x5091df,_0xcec1cf){_0xcec1cf=_0xcec1cf||0xcc;return function(_0x3fb710){if(_0x3fb710){return _0x5091df[_0xce6e('0x17')](_0xcec1cf);}return _0x5091df['status'](_0xcec1cf)[_0xce6e('0x18')]();};}function respondWithResult(_0x5e8b4a,_0x3e889e){_0x3e889e=_0x3e889e||0xc8;return function(_0x5e012e){if(_0x5e012e){return _0x5e8b4a[_0xce6e('0x19')](_0x3e889e)[_0xce6e('0x1a')](_0x5e012e);}};}function respondWithFilteredResult(_0x44b068,_0x31cef8){return function(_0x2ab2e0){if(_0x2ab2e0){var _0x3b338d=typeof _0x31cef8[_0xce6e('0x1b')]===_0xce6e('0x1c')&&typeof _0x31cef8[_0xce6e('0x1d')]===_0xce6e('0x1c');var _0x5804ff=_0x2ab2e0[_0xce6e('0x1e')];var _0x4e196c=_0x3b338d?0x0:_0x31cef8[_0xce6e('0x1b')];var _0x4c3adb=_0x3b338d?_0x2ab2e0[_0xce6e('0x1e')]:_0x31cef8['offset']+_0x31cef8[_0xce6e('0x1d')];var _0xdcae7f;if(_0x4c3adb>=_0x5804ff){_0x4c3adb=_0x5804ff;_0xdcae7f=0xc8;}else{_0xdcae7f=0xce;}_0x44b068['status'](_0xdcae7f);return _0x44b068[_0xce6e('0x1f')]('Content-Range',_0x4e196c+'-'+_0x4c3adb+'/'+_0x5804ff)['json'](_0x2ab2e0);}return null;};}function patchUpdates(_0x3a1e37){return function(_0x420b2b){try{jsonpatch[_0xce6e('0x20')](_0x420b2b,_0x3a1e37,!![]);}catch(_0x172acd){return BPromise['reject'](_0x172acd);}return _0x420b2b['save']();};}function saveUpdates(_0x2728d0,_0x183c24){return function(_0x59325c){if(_0x59325c){return _0x59325c['update'](_0x2728d0)[_0xce6e('0x21')](function(_0x10960c){return _0x10960c;});}return null;};}function removeEntity(_0x23c820,_0x24a40b){return function(_0x347292){if(_0x347292){return _0x347292[_0xce6e('0x22')]()[_0xce6e('0x21')](function(){_0x23c820[_0xce6e('0x19')](0xcc)[_0xce6e('0x18')]();});}};}function handleEntityNotFound(_0x557671,_0x4a8dd4){return function(_0x56e2c2){if(!_0x56e2c2){_0x557671[_0xce6e('0x17')](0x194);}return _0x56e2c2;};}function handleError(_0x72d47e,_0x419dee){_0x419dee=_0x419dee||0x1f4;return function(_0x18787c){logger['error'](_0x18787c[_0xce6e('0x23')]);if(_0x18787c[_0xce6e('0x24')]){delete _0x18787c[_0xce6e('0x24')];}_0x72d47e[_0xce6e('0x19')](_0x419dee)[_0xce6e('0x25')](_0x18787c);};}exports['index']=function(_0x6e8566,_0x164ee0){var _0x3d5343={},_0x3b7c5a={},_0x52b4d6={'count':0x0,'rows':[]};var _0x46a70b=_['map'](db[_0xce6e('0x26')][_0xce6e('0x27')],function(_0x34772f){return{'name':_0x34772f[_0xce6e('0x28')],'type':_0x34772f['type']['key']};});_0x3b7c5a[_0xce6e('0x29')]=_['map'](_0x46a70b,_0xce6e('0x24'));_0x3b7c5a[_0xce6e('0x2a')]=_[_0xce6e('0x2b')](_0x6e8566[_0xce6e('0x2a')]);_0x3b7c5a[_0xce6e('0x2c')]=_[_0xce6e('0x2d')](_0x3b7c5a['model'],_0x3b7c5a['query']);_0x3d5343['attributes']=_[_0xce6e('0x2d')](_0x3b7c5a[_0xce6e('0x29')],qs[_0xce6e('0x2e')](_0x6e8566['query'][_0xce6e('0x2e')]));_0x3d5343[_0xce6e('0x2f')]=_0x3d5343['attributes']['length']?_0x3d5343[_0xce6e('0x2f')]:_0x3b7c5a[_0xce6e('0x29')];if(!_0x6e8566[_0xce6e('0x2a')][_0xce6e('0x30')]('nolimit')){_0x3d5343[_0xce6e('0x1d')]=qs[_0xce6e('0x1d')](_0x6e8566[_0xce6e('0x2a')][_0xce6e('0x1d')]);_0x3d5343['offset']=qs[_0xce6e('0x1b')](_0x6e8566['query'][_0xce6e('0x1b')]);}_0x3d5343['order']=qs[_0xce6e('0x31')](_0x6e8566['query'][_0xce6e('0x31')]);_0x3d5343[_0xce6e('0x32')]=qs[_0xce6e('0x2c')](_['pick'](_0x6e8566[_0xce6e('0x2a')],_0x3b7c5a[_0xce6e('0x2c')]),_0x46a70b);if(_0x6e8566[_0xce6e('0x2a')][_0xce6e('0x33')]){_0x3d5343[_0xce6e('0x32')]=_[_0xce6e('0x34')](_0x3d5343[_0xce6e('0x32')],{'$or':_[_0xce6e('0x35')](_0x46a70b,function(_0x51c364){if(_0x51c364['type']!==_0xce6e('0x36')){var _0x274ab9={};_0x274ab9[_0x51c364[_0xce6e('0x24')]]={'$like':'%'+_0x6e8566['query'][_0xce6e('0x33')]+'%'};return _0x274ab9;}})});}_0x3d5343=_[_0xce6e('0x34')]({},_0x3d5343,_0x6e8566[_0xce6e('0x37')]);var _0x30229d={'where':_0x3d5343[_0xce6e('0x32')]};return db[_0xce6e('0x26')]['count'](_0x30229d)[_0xce6e('0x21')](function(_0x4c6da6){_0x52b4d6[_0xce6e('0x1e')]=_0x4c6da6;if(_0x6e8566['query'][_0xce6e('0x38')]){_0x3d5343[_0xce6e('0x39')]=[{'all':!![]}];}return db[_0xce6e('0x26')]['findAll'](_0x3d5343);})['then'](function(_0x5f097e){_0x52b4d6['rows']=_0x5f097e;return _0x52b4d6;})['then'](respondWithFilteredResult(_0x164ee0,_0x3d5343))['catch'](handleError(_0x164ee0,null));};exports[_0xce6e('0x3a')]=function(_0x2bcddd,_0x30b8d2){var _0xafc6d8={'raw':![],'where':{'id':_0x2bcddd['params']['id']}},_0x30723a={};_0x30723a['model']=_[_0xce6e('0x2b')](db[_0xce6e('0x26')][_0xce6e('0x27')]);_0x30723a[_0xce6e('0x2a')]=_[_0xce6e('0x2b')](_0x2bcddd[_0xce6e('0x2a')]);_0x30723a['filters']=_[_0xce6e('0x2d')](_0x30723a['model'],_0x30723a[_0xce6e('0x2a')]);_0xafc6d8['attributes']=_[_0xce6e('0x2d')](_0x30723a[_0xce6e('0x29')],qs[_0xce6e('0x2e')](_0x2bcddd[_0xce6e('0x2a')][_0xce6e('0x2e')]));_0xafc6d8[_0xce6e('0x2f')]=_0xafc6d8[_0xce6e('0x2f')][_0xce6e('0x3b')]?_0xafc6d8[_0xce6e('0x2f')]:_0x30723a[_0xce6e('0x29')];if(_0x2bcddd[_0xce6e('0x2a')][_0xce6e('0x38')]){_0xafc6d8[_0xce6e('0x39')]=[{'all':!![]}];}_0xafc6d8=_['merge']({},_0xafc6d8,_0x2bcddd[_0xce6e('0x37')]);return db['ServicenowConfiguration'][_0xce6e('0x3c')](_0xafc6d8)[_0xce6e('0x21')](handleEntityNotFound(_0x30b8d2,null))['then'](respondWithResult(_0x30b8d2,null))['catch'](handleError(_0x30b8d2,null));};exports[_0xce6e('0x3d')]=function(_0x30f764,_0x2c71aa){return db[_0xce6e('0x26')][_0xce6e('0x3d')](_0x30f764['body'],{})['then'](respondWithResult(_0x2c71aa,0xc9))[_0xce6e('0x3e')](handleError(_0x2c71aa,null));};exports[_0xce6e('0x3f')]=function(_0x236f42,_0xc756c9){if(_0x236f42['body']['id']){delete _0x236f42[_0xce6e('0x40')]['id'];}return db['ServicenowConfiguration'][_0xce6e('0x3c')]({'where':{'id':_0x236f42[_0xce6e('0x41')]['id']}})[_0xce6e('0x21')](handleEntityNotFound(_0xc756c9,null))['then'](saveUpdates(_0x236f42[_0xce6e('0x40')],null))[_0xce6e('0x21')](respondWithResult(_0xc756c9,null))['catch'](handleError(_0xc756c9,null));};exports['destroy']=function(_0x417c29,_0x491d8d){return db[_0xce6e('0x26')]['find']({'where':{'id':_0x417c29[_0xce6e('0x41')]['id']}})['then'](handleEntityNotFound(_0x491d8d,null))[_0xce6e('0x21')](removeEntity(_0x491d8d,null))[_0xce6e('0x3e')](handleError(_0x491d8d,null));};exports[_0xce6e('0x42')]=function(_0x377e64,_0x93139a,_0x259743){var _0x5b4671={};var _0x4e4472={};var _0x57ff99;var _0x590564;return db[_0xce6e('0x26')]['findOne']({'where':{'id':_0x377e64[_0xce6e('0x41')]['id']}})['then'](handleEntityNotFound(_0x93139a,null))[_0xce6e('0x21')](function(_0x41ff60){if(_0x41ff60){_0x57ff99=_0x41ff60;_0x4e4472[_0xce6e('0x29')]=_[_0xce6e('0x2b')](db[_0xce6e('0x43')][_0xce6e('0x27')]);_0x4e4472[_0xce6e('0x2a')]=_[_0xce6e('0x2b')](_0x377e64[_0xce6e('0x2a')]);_0x4e4472['filters']=_[_0xce6e('0x2d')](_0x4e4472[_0xce6e('0x29')],_0x4e4472[_0xce6e('0x2a')]);_0x5b4671[_0xce6e('0x2f')]=_[_0xce6e('0x2d')](_0x4e4472[_0xce6e('0x29')],qs['fields'](_0x377e64['query'][_0xce6e('0x2e')]));_0x5b4671[_0xce6e('0x2f')]=_0x5b4671[_0xce6e('0x2f')][_0xce6e('0x3b')]?_0x5b4671[_0xce6e('0x2f')]:_0x4e4472[_0xce6e('0x29')];_0x5b4671[_0xce6e('0x44')]=qs[_0xce6e('0x31')](_0x377e64['query'][_0xce6e('0x31')]);_0x5b4671[_0xce6e('0x32')]=qs['filters'](_[_0xce6e('0x45')](_0x377e64['query'],_0x4e4472[_0xce6e('0x2c')]));if(_0x377e64['query'][_0xce6e('0x33')]){_0x5b4671[_0xce6e('0x32')]=_[_0xce6e('0x34')](_0x5b4671['where'],{'$or':_['map'](_0x5b4671[_0xce6e('0x2f')],function(_0x5253bb){var _0x4d9e9c={};_0x4d9e9c[_0x5253bb]={'$like':'%'+_0x377e64[_0xce6e('0x2a')][_0xce6e('0x33')]+'%'};return _0x4d9e9c;})});}_0x5b4671=_[_0xce6e('0x34')]({},_0x5b4671,_0x377e64[_0xce6e('0x37')]);return _0x57ff99[_0xce6e('0x42')](_0x5b4671);}})[_0xce6e('0x21')](function(_0x507759){if(_0x507759){_0x590564=_0x507759[_0xce6e('0x3b')];if(!_0x377e64[_0xce6e('0x2a')][_0xce6e('0x30')]('nolimit')){_0x5b4671[_0xce6e('0x1d')]=qs[_0xce6e('0x1d')](_0x377e64[_0xce6e('0x2a')][_0xce6e('0x1d')]);_0x5b4671['offset']=qs[_0xce6e('0x1b')](_0x377e64[_0xce6e('0x2a')][_0xce6e('0x1b')]);}return _0x57ff99['getFields'](_0x5b4671);}})[_0xce6e('0x21')](function(_0x3f0946){if(_0x3f0946){return _0x3f0946?{'count':_0x590564,'rows':_0x3f0946}:null;}})[_0xce6e('0x21')](respondWithResult(_0x93139a,null))['catch'](handleError(_0x93139a,null));};exports['getSubjects']=function(_0x145d56,_0x4ba65,_0x4a6b45){var _0x29dbae={};var _0x159121={};var _0x4ded22;var _0x5b4aef;return db[_0xce6e('0x26')]['findOne']({'where':{'id':_0x145d56[_0xce6e('0x41')]['id']}})[_0xce6e('0x21')](handleEntityNotFound(_0x4ba65,null))['then'](function(_0x26089a){if(_0x26089a){_0x4ded22=_0x26089a;_0x159121[_0xce6e('0x29')]=_[_0xce6e('0x2b')](db[_0xce6e('0x43')][_0xce6e('0x27')]);_0x159121[_0xce6e('0x2a')]=_['keys'](_0x145d56['query']);_0x159121[_0xce6e('0x2c')]=_[_0xce6e('0x2d')](_0x159121['model'],_0x159121[_0xce6e('0x2a')]);_0x29dbae[_0xce6e('0x2f')]=_[_0xce6e('0x2d')](_0x159121[_0xce6e('0x29')],qs[_0xce6e('0x2e')](_0x145d56['query'][_0xce6e('0x2e')]));_0x29dbae[_0xce6e('0x2f')]=_0x29dbae[_0xce6e('0x2f')]['length']?_0x29dbae[_0xce6e('0x2f')]:_0x159121['model'];_0x29dbae[_0xce6e('0x44')]=qs[_0xce6e('0x31')](_0x145d56[_0xce6e('0x2a')][_0xce6e('0x31')]);_0x29dbae[_0xce6e('0x32')]=qs[_0xce6e('0x2c')](_[_0xce6e('0x45')](_0x145d56[_0xce6e('0x2a')],_0x159121['filters']));if(_0x145d56['query'][_0xce6e('0x33')]){_0x29dbae[_0xce6e('0x32')]=_[_0xce6e('0x34')](_0x29dbae[_0xce6e('0x32')],{'$or':_['map'](_0x29dbae[_0xce6e('0x2f')],function(_0x8cc10d){var _0x58c6b0={};_0x58c6b0[_0x8cc10d]={'$like':'%'+_0x145d56[_0xce6e('0x2a')]['filter']+'%'};return _0x58c6b0;})});}_0x29dbae=_[_0xce6e('0x34')]({},_0x29dbae,_0x145d56[_0xce6e('0x37')]);return _0x4ded22[_0xce6e('0x46')](_0x29dbae);}})['then'](function(_0x2ba2e8){if(_0x2ba2e8){_0x5b4aef=_0x2ba2e8[_0xce6e('0x3b')];if(!_0x145d56[_0xce6e('0x2a')][_0xce6e('0x30')](_0xce6e('0x47'))){_0x29dbae['limit']=qs['limit'](_0x145d56[_0xce6e('0x2a')][_0xce6e('0x1d')]);_0x29dbae[_0xce6e('0x1b')]=qs['offset'](_0x145d56['query'][_0xce6e('0x1b')]);}return _0x4ded22['getSubjects'](_0x29dbae);}})[_0xce6e('0x21')](function(_0x4e9912){if(_0x4e9912){return _0x4e9912?{'count':_0x5b4aef,'rows':_0x4e9912}:null;}})[_0xce6e('0x21')](respondWithResult(_0x4ba65,null))[_0xce6e('0x3e')](handleError(_0x4ba65,null));};exports[_0xce6e('0x48')]=function(_0x4dce28,_0x93e0be,_0x553f65){var _0x283c5f={};var _0x3ae5f5={};var _0x3a68c9;var _0x29c81c;return db[_0xce6e('0x26')][_0xce6e('0x49')]({'where':{'id':_0x4dce28[_0xce6e('0x41')]['id']}})[_0xce6e('0x21')](handleEntityNotFound(_0x93e0be,null))['then'](function(_0x52e08a){if(_0x52e08a){_0x3a68c9=_0x52e08a;_0x3ae5f5['model']=_[_0xce6e('0x2b')](db['ServicenowField'][_0xce6e('0x27')]);_0x3ae5f5['query']=_[_0xce6e('0x2b')](_0x4dce28['query']);_0x3ae5f5['filters']=_[_0xce6e('0x2d')](_0x3ae5f5[_0xce6e('0x29')],_0x3ae5f5[_0xce6e('0x2a')]);_0x283c5f[_0xce6e('0x2f')]=_[_0xce6e('0x2d')](_0x3ae5f5[_0xce6e('0x29')],qs['fields'](_0x4dce28[_0xce6e('0x2a')][_0xce6e('0x2e')]));_0x283c5f[_0xce6e('0x2f')]=_0x283c5f['attributes'][_0xce6e('0x3b')]?_0x283c5f['attributes']:_0x3ae5f5[_0xce6e('0x29')];_0x283c5f[_0xce6e('0x44')]=qs['sort'](_0x4dce28[_0xce6e('0x2a')][_0xce6e('0x31')]);_0x283c5f[_0xce6e('0x32')]=qs[_0xce6e('0x2c')](_['pick'](_0x4dce28['query'],_0x3ae5f5['filters']));if(_0x4dce28['query'][_0xce6e('0x33')]){_0x283c5f[_0xce6e('0x32')]=_[_0xce6e('0x34')](_0x283c5f[_0xce6e('0x32')],{'$or':_['map'](_0x283c5f[_0xce6e('0x2f')],function(_0x42f969){var _0x56e8cd={};_0x56e8cd[_0x42f969]={'$like':'%'+_0x4dce28[_0xce6e('0x2a')]['filter']+'%'};return _0x56e8cd;})});}_0x283c5f=_[_0xce6e('0x34')]({},_0x283c5f,_0x4dce28[_0xce6e('0x37')]);return _0x3a68c9['getDescriptions'](_0x283c5f);}})[_0xce6e('0x21')](function(_0x28af5e){if(_0x28af5e){_0x29c81c=_0x28af5e[_0xce6e('0x3b')];if(!_0x4dce28[_0xce6e('0x2a')][_0xce6e('0x30')](_0xce6e('0x47'))){_0x283c5f[_0xce6e('0x1d')]=qs[_0xce6e('0x1d')](_0x4dce28[_0xce6e('0x2a')][_0xce6e('0x1d')]);_0x283c5f[_0xce6e('0x1b')]=qs[_0xce6e('0x1b')](_0x4dce28[_0xce6e('0x2a')]['offset']);}return _0x3a68c9['getDescriptions'](_0x283c5f);}})[_0xce6e('0x21')](function(_0x5d966f){if(_0x5d966f){return _0x5d966f?{'count':_0x29c81c,'rows':_0x5d966f}:null;}})[_0xce6e('0x21')](respondWithResult(_0x93e0be,null))['catch'](handleError(_0x93e0be,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0e67bba..6073967 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 _0x9a86=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9a86,0x1ed));var _0x69a8=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x9a86[_0x1558ab];return _0x53b64a;};'use strict';var _=require(_0x69a8('0x0'));var util=require(_0x69a8('0x1'));var logger=require('../../config/logger')(_0x69a8('0x2'));var moment=require(_0x69a8('0x3'));var BPromise=require(_0x69a8('0x4'));var rp=require(_0x69a8('0x5'));var fs=require('fs');var path=require(_0x69a8('0x6'));var rimraf=require(_0x69a8('0x7'));var config=require(_0x69a8('0x8'));var attributes=require(_0x69a8('0x9'));module[_0x69a8('0xa')]=function(_0x36c9ac,_0x3ed1d5){return _0x36c9ac[_0x69a8('0xb')](_0x69a8('0xc'),attributes,{'tableName':_0x69a8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dd3=['rimraf','../../config/environment','exports','define','ServicenowConfiguration','lodash','util','../../config/logger','bluebird','path'];(function(_0x5cb15c,_0x31bb89){var _0x334c01=function(_0x4a7eac){while(--_0x4a7eac){_0x5cb15c['push'](_0x5cb15c['shift']());}};_0x334c01(++_0x31bb89);}(_0x4dd3,0xf5));var _0x34dd=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0x4dd3[_0x2d994d];return _0xd54be4;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var logger=require(_0x34dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x34dd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34dd('0x4'));var rimraf=require(_0x34dd('0x5'));var config=require(_0x34dd('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x34dd('0x7')]=function(_0x704165,_0x37ce1d){return _0x704165[_0x34dd('0x8')](_0x34dd('0x9'),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 c230d2b..6ec00aa 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 _0xffbd=['request','then','info','ServicenowConfiguration,\x20%s,\x20%s','error','message','request\x20sent','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x84d12c,_0x3de265){var _0xb87252=function(_0x4788b5){while(--_0x4788b5){_0x84d12c['push'](_0x84d12c['shift']());}};_0xb87252(++_0x3de265);}(_0xffbd,0x170));var _0xdffb=function(_0x5df2ff,_0x48300e){_0x5df2ff=_0x5df2ff-0x0;var _0x594f25=_0xffbd[_0x5df2ff];return _0x594f25;};'use strict';var _=require('lodash');var util=require(_0xdffb('0x0'));var moment=require(_0xdffb('0x1'));var BPromise=require(_0xdffb('0x2'));var rs=require(_0xdffb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdffb('0x4'))['db'];var utils=require(_0xdffb('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdffb('0x6'));var jayson=require(_0xdffb('0x7'));var client=jayson[_0xdffb('0x8')][_0xdffb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b6dd4,_0x4ae2ad,_0x301699){return new BPromise(function(_0x406ade,_0x21c22e){return client[_0xdffb('0xa')](_0x3b6dd4,_0x301699)[_0xdffb('0xb')](function(_0x2c5b23){logger[_0xdffb('0xc')](_0xdffb('0xd'),_0x4ae2ad,'request\x20sent');logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4ae2ad,'request\x20sent',JSON['stringify'](_0x2c5b23));if(_0x2c5b23[_0xdffb('0xe')]){if(_0x2c5b23[_0xdffb('0xe')]['code']===0x1f4){logger[_0xdffb('0xe')](_0xdffb('0xd'),_0x4ae2ad,_0x2c5b23[_0xdffb('0xe')][_0xdffb('0xf')]);return _0x21c22e(_0x2c5b23[_0xdffb('0xe')][_0xdffb('0xf')]);}logger['error'](_0xdffb('0xd'),_0x4ae2ad,_0x2c5b23[_0xdffb('0xe')]['message']);return _0x406ade(_0x2c5b23[_0xdffb('0xe')][_0xdffb('0xf')]);}else{logger[_0xdffb('0xc')](_0xdffb('0xd'),_0x4ae2ad,_0xdffb('0x10'));_0x406ade(_0x2c5b23[_0xdffb('0x11')]['message']);}})['catch'](function(_0x490924){logger[_0xdffb('0xe')](_0xdffb('0xd'),_0x4ae2ad,_0x490924);_0x21c22e(_0x490924);});});} \ No newline at end of file +var _0xbd5b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','code','error','message','info','catch','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x4bb97d,_0x582088){var _0x4d54a4=function(_0x3c7320){while(--_0x3c7320){_0x4bb97d['push'](_0x4bb97d['shift']());}};_0x4d54a4(++_0x582088);}(_0xbd5b,0x1b8));var _0xbbd5=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xbd5b[_0xe73080];return _0x12cbc4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbbd5('0x0'));var BPromise=require(_0xbbd5('0x1'));var rs=require(_0xbbd5('0x2'));var fs=require('fs');var Redis=require(_0xbbd5('0x3'));var db=require(_0xbbd5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbd5('0x5'))(_0xbbd5('0x6'));var config=require(_0xbbd5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbbd5('0x8')][_0xbbd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3890b0,_0x3a0526,_0x5ef2c4){return new BPromise(function(_0x3ca3c3,_0x1b091b){return client[_0xbbd5('0xa')](_0x3890b0,_0x5ef2c4)[_0xbbd5('0xb')](function(_0x501fda){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x3a0526,_0xbbd5('0xc'));logger[_0xbbd5('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3a0526,_0xbbd5('0xc'),JSON['stringify'](_0x501fda));if(_0x501fda['error']){if(_0x501fda['error'][_0xbbd5('0xe')]===0x1f4){logger[_0xbbd5('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a0526,_0x501fda[_0xbbd5('0xf')]['message']);return _0x1b091b(_0x501fda['error']['message']);}logger[_0xbbd5('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a0526,_0x501fda['error'][_0xbbd5('0x10')]);return _0x3ca3c3(_0x501fda['error']['message']);}else{logger[_0xbbd5('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a0526,_0xbbd5('0xc'));_0x3ca3c3(_0x501fda['result']['message']);}})[_0xbbd5('0x12')](function(_0x58d31a){logger['error'](_0xbbd5('0x13'),_0x3a0526,_0x58d31a);_0x1b091b(_0x58d31a);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 0d7fea1..b46b678 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 _0xab3c=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports'];(function(_0x3b584a,_0x1e9367){var _0x34d5ce=function(_0x55fb72){while(--_0x55fb72){_0x3b584a['push'](_0x3b584a['shift']());}};_0x34d5ce(++_0x1e9367);}(_0xab3c,0x78));var _0xcab3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab3c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xcab3('0x0'));var util=require('util');var path=require(_0xcab3('0x1'));var timeout=require('connect-timeout');var express=require(_0xcab3('0x2'));var router=express[_0xcab3('0x3')]();var fs_extra=require(_0xcab3('0x4'));var auth=require(_0xcab3('0x5'));var interaction=require(_0xcab3('0x6'));var config=require(_0xcab3('0x7'));var controller=require(_0xcab3('0x8'));router[_0xcab3('0x9')]('/',auth['isAuthenticated'](),controller[_0xcab3('0xa')]);router[_0xcab3('0x9')](_0xcab3('0xb'),auth['isAuthenticated'](),controller[_0xcab3('0xc')]);router[_0xcab3('0xd')]('/',auth[_0xcab3('0xe')](),controller[_0xcab3('0xf')]);router['put'](_0xcab3('0xb'),auth['isAuthenticated'](),controller[_0xcab3('0x10')]);router[_0xcab3('0x11')]('/:id',auth[_0xcab3('0xe')](),controller[_0xcab3('0x12')]);module[_0xcab3('0x13')]=router; \ No newline at end of file +var _0x0fb6=['express','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x27f5de,_0x577080){var _0x484149=function(_0x7e9adb){while(--_0x7e9adb){_0x27f5de['push'](_0x27f5de['shift']());}};_0x484149(++_0x577080);}(_0x0fb6,0x19d));var _0x60fb=function(_0x477744,_0x3f7bcb){_0x477744=_0x477744-0x0;var _0x2c838c=_0x0fb6[_0x477744];return _0x2c838c;};'use strict';var multer=require('multer');var util=require(_0x60fb('0x0'));var path=require(_0x60fb('0x1'));var timeout=require(_0x60fb('0x2'));var express=require(_0x60fb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x60fb('0x4'));var interaction=require(_0x60fb('0x5'));var config=require('../../config/environment');var controller=require(_0x60fb('0x6'));router['get']('/',auth[_0x60fb('0x7')](),controller[_0x60fb('0x8')]);router[_0x60fb('0x9')](_0x60fb('0xa'),auth[_0x60fb('0x7')](),controller['show']);router[_0x60fb('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x60fb('0xa'),auth['isAuthenticated'](),controller[_0x60fb('0xc')]);router[_0x60fb('0xd')]('/:id',auth[_0x60fb('0x7')](),controller[_0x60fb('0xe')]);module[_0x60fb('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 4870969..85a70cf 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 _0x37e5=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37e5,0x108));var _0x537e=function(_0x492a1f,_0x57a0f0){_0x492a1f=_0x492a1f-0x0;var _0x468f9e=_0x37e5[_0x492a1f];return _0x468f9e;};'use strict';var Sequelize=require(_0x537e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x537e('0x1'),_0x537e('0x2'),_0x537e('0x3'),'keyValue',_0x537e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x537e('0x5')]},'key':{'type':Sequelize[_0x537e('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x537e('0x1'),_0x537e('0x2'),_0x537e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x537e('0x5')]},'nameField':{'type':Sequelize[_0x537e('0x5')]},'customField':{'type':Sequelize[_0x537e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x537e('0x5')]}}; \ No newline at end of file +var _0x7825=['variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x3221e0,_0x230885){var _0x30a500=function(_0x532ebb){while(--_0x532ebb){_0x3221e0['push'](_0x3221e0['shift']());}};_0x30a500(++_0x230885);}(_0x7825,0x1e2));var _0x5782=function(_0x492f45,_0x4bbf55){_0x492f45=_0x492f45-0x0;var _0x297b67=_0x7825[_0x492f45];return _0x297b67;};'use strict';var Sequelize=require(_0x5782('0x0'));module[_0x5782('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5782('0x2'),'variable',_0x5782('0x3'),_0x5782('0x4'),_0x5782('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5782('0x6')]},'key':{'type':Sequelize[_0x5782('0x6')]},'keyType':{'type':Sequelize[_0x5782('0x7')](_0x5782('0x2'),_0x5782('0x8'),_0x5782('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5782('0x6')]},'nameField':{'type':Sequelize[_0x5782('0x6')]},'customField':{'type':Sequelize[_0x5782('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5782('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 48134f1..f89ae05 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 _0x7875=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','ServicenowField','rawAttributes','fieldName','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x46f5d2,_0x14ea88){var _0x5afb9c=function(_0x3c2cfb){while(--_0x3c2cfb){_0x46f5d2['push'](_0x46f5d2['shift']());}};_0x5afb9c(++_0x14ea88);}(_0x7875,0xd9));var _0x5787=function(_0x564c18,_0x114836){_0x564c18=_0x564c18-0x0;var _0x165ac8=_0x7875[_0x564c18];return _0x165ac8;};'use strict';var emlformat=require(_0x5787('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5787('0x1'));var jsonpatch=require(_0x5787('0x2'));var rp=require(_0x5787('0x3'));var moment=require('moment');var BPromise=require(_0x5787('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5787('0x5'));var sox=require(_0x5787('0x6'));var csv=require(_0x5787('0x7'));var ejs=require(_0x5787('0x8'));var fs=require('fs');var fs_extra=require(_0x5787('0x9'));var _=require(_0x5787('0xa'));var squel=require('squel');var crypto=require(_0x5787('0xb'));var jsforce=require(_0x5787('0xc'));var deskjs=require(_0x5787('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5787('0xe'));var Papa=require(_0x5787('0xf'));var Redis=require(_0x5787('0x10'));var authService=require(_0x5787('0x11'));var qs=require(_0x5787('0x12'));var as=require(_0x5787('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5787('0x14'))(_0x5787('0x15'));var utils=require(_0x5787('0x16'));var config=require(_0x5787('0x17'));var licenseUtil=require(_0x5787('0x18'));var db=require(_0x5787('0x19'))['db'];function respondWithStatusCode(_0x6fcd28,_0x2592e4){_0x2592e4=_0x2592e4||0xcc;return function(_0x2a8b1f){if(_0x2a8b1f){return _0x6fcd28[_0x5787('0x1a')](_0x2592e4);}return _0x6fcd28['status'](_0x2592e4)['end']();};}function respondWithResult(_0x203b1e,_0x58e25e){_0x58e25e=_0x58e25e||0xc8;return function(_0x4ef313){if(_0x4ef313){return _0x203b1e[_0x5787('0x1b')](_0x58e25e)[_0x5787('0x1c')](_0x4ef313);}};}function respondWithFilteredResult(_0x56db90,_0x4852c2){return function(_0x4a2bc8){if(_0x4a2bc8){var _0x509666=typeof _0x4852c2[_0x5787('0x1d')]===_0x5787('0x1e')&&typeof _0x4852c2[_0x5787('0x1f')]===_0x5787('0x1e');var _0x561ff9=_0x4a2bc8[_0x5787('0x20')];var _0x188477=_0x509666?0x0:_0x4852c2['offset'];var _0x64ec7a=_0x509666?_0x4a2bc8[_0x5787('0x20')]:_0x4852c2[_0x5787('0x1d')]+_0x4852c2[_0x5787('0x1f')];var _0x40bd12;if(_0x64ec7a>=_0x561ff9){_0x64ec7a=_0x561ff9;_0x40bd12=0xc8;}else{_0x40bd12=0xce;}_0x56db90[_0x5787('0x1b')](_0x40bd12);return _0x56db90['set'](_0x5787('0x21'),_0x188477+'-'+_0x64ec7a+'/'+_0x561ff9)['json'](_0x4a2bc8);}return null;};}function patchUpdates(_0x3d5204){return function(_0x45c3ca){try{jsonpatch['apply'](_0x45c3ca,_0x3d5204,!![]);}catch(_0x4666b7){return BPromise[_0x5787('0x22')](_0x4666b7);}return _0x45c3ca[_0x5787('0x23')]();};}function saveUpdates(_0x235fca,_0x12125e){return function(_0xb2ee08){if(_0xb2ee08){return _0xb2ee08[_0x5787('0x24')](_0x235fca)['then'](function(_0x52fb1a){return _0x52fb1a;});}return null;};}function removeEntity(_0x27e9d5,_0x117f2f){return function(_0x3f273c){if(_0x3f273c){return _0x3f273c[_0x5787('0x25')]()[_0x5787('0x26')](function(){_0x27e9d5[_0x5787('0x1b')](0xcc)[_0x5787('0x27')]();});}};}function handleEntityNotFound(_0x160714,_0x423610){return function(_0x5af666){if(!_0x5af666){_0x160714[_0x5787('0x1a')](0x194);}return _0x5af666;};}function handleError(_0x3d8be7,_0x1683d3){_0x1683d3=_0x1683d3||0x1f4;return function(_0x1c7184){logger[_0x5787('0x28')](_0x1c7184[_0x5787('0x29')]);if(_0x1c7184[_0x5787('0x2a')]){delete _0x1c7184['name'];}_0x3d8be7[_0x5787('0x1b')](_0x1683d3)[_0x5787('0x2b')](_0x1c7184);};}exports[_0x5787('0x2c')]=function(_0x392f08,_0x53e42c){var _0x92426d={},_0x4a9350={},_0xbe8fb4={'count':0x0,'rows':[]};var _0x274b21=_['map'](db[_0x5787('0x2d')][_0x5787('0x2e')],function(_0x3c4fb2){return{'name':_0x3c4fb2[_0x5787('0x2f')],'type':_0x3c4fb2['type'][_0x5787('0x30')]};});_0x4a9350[_0x5787('0x31')]=_[_0x5787('0x32')](_0x274b21,_0x5787('0x2a'));_0x4a9350[_0x5787('0x33')]=_[_0x5787('0x34')](_0x392f08[_0x5787('0x33')]);_0x4a9350['filters']=_['intersection'](_0x4a9350[_0x5787('0x31')],_0x4a9350[_0x5787('0x33')]);_0x92426d[_0x5787('0x35')]=_['intersection'](_0x4a9350['model'],qs['fields'](_0x392f08['query'][_0x5787('0x36')]));_0x92426d[_0x5787('0x35')]=_0x92426d[_0x5787('0x35')][_0x5787('0x37')]?_0x92426d[_0x5787('0x35')]:_0x4a9350[_0x5787('0x31')];if(!_0x392f08['query'][_0x5787('0x38')](_0x5787('0x39'))){_0x92426d[_0x5787('0x1f')]=qs['limit'](_0x392f08['query'][_0x5787('0x1f')]);_0x92426d[_0x5787('0x1d')]=qs[_0x5787('0x1d')](_0x392f08['query']['offset']);}_0x92426d[_0x5787('0x3a')]=qs[_0x5787('0x3b')](_0x392f08[_0x5787('0x33')]['sort']);_0x92426d[_0x5787('0x3c')]=qs['filters'](_[_0x5787('0x3d')](_0x392f08['query'],_0x4a9350[_0x5787('0x3e')]),_0x274b21);if(_0x392f08[_0x5787('0x33')][_0x5787('0x3f')]){_0x92426d[_0x5787('0x3c')]=_[_0x5787('0x40')](_0x92426d[_0x5787('0x3c')],{'$or':_['map'](_0x274b21,function(_0x5a6999){if(_0x5a6999[_0x5787('0x41')]!==_0x5787('0x42')){var _0x4c5fae={};_0x4c5fae[_0x5a6999[_0x5787('0x2a')]]={'$like':'%'+_0x392f08[_0x5787('0x33')]['filter']+'%'};return _0x4c5fae;}})});}_0x92426d=_['merge']({},_0x92426d,_0x392f08['options']);var _0x10de50={'where':_0x92426d['where']};return db[_0x5787('0x2d')][_0x5787('0x20')](_0x10de50)[_0x5787('0x26')](function(_0x413e0f){_0xbe8fb4[_0x5787('0x20')]=_0x413e0f;if(_0x392f08[_0x5787('0x33')][_0x5787('0x43')]){_0x92426d[_0x5787('0x44')]=[{'all':!![]}];}return db[_0x5787('0x2d')][_0x5787('0x45')](_0x92426d);})[_0x5787('0x26')](function(_0x2d66c5){_0xbe8fb4[_0x5787('0x46')]=_0x2d66c5;return _0xbe8fb4;})[_0x5787('0x26')](respondWithFilteredResult(_0x53e42c,_0x92426d))[_0x5787('0x47')](handleError(_0x53e42c,null));};exports[_0x5787('0x48')]=function(_0x1b34ed,_0x4284de){var _0xb85dfc={'raw':!![],'where':{'id':_0x1b34ed[_0x5787('0x49')]['id']}},_0x6d6014={};_0x6d6014['model']=_[_0x5787('0x34')](db['ServicenowField'][_0x5787('0x2e')]);_0x6d6014[_0x5787('0x33')]=_[_0x5787('0x34')](_0x1b34ed[_0x5787('0x33')]);_0x6d6014['filters']=_[_0x5787('0x4a')](_0x6d6014[_0x5787('0x31')],_0x6d6014['query']);_0xb85dfc[_0x5787('0x35')]=_['intersection'](_0x6d6014['model'],qs[_0x5787('0x36')](_0x1b34ed[_0x5787('0x33')]['fields']));_0xb85dfc[_0x5787('0x35')]=_0xb85dfc[_0x5787('0x35')][_0x5787('0x37')]?_0xb85dfc[_0x5787('0x35')]:_0x6d6014[_0x5787('0x31')];if(_0x1b34ed[_0x5787('0x33')][_0x5787('0x43')]){_0xb85dfc[_0x5787('0x44')]=[{'all':!![]}];}_0xb85dfc=_['merge']({},_0xb85dfc,_0x1b34ed['options']);return db[_0x5787('0x2d')][_0x5787('0x4b')](_0xb85dfc)[_0x5787('0x26')](handleEntityNotFound(_0x4284de,null))[_0x5787('0x26')](respondWithResult(_0x4284de,null))[_0x5787('0x47')](handleError(_0x4284de,null));};exports[_0x5787('0x4c')]=function(_0x528116,_0x224790){return db[_0x5787('0x2d')][_0x5787('0x4c')](_0x528116[_0x5787('0x4d')],{})[_0x5787('0x26')](respondWithResult(_0x224790,0xc9))[_0x5787('0x47')](handleError(_0x224790,null));};exports[_0x5787('0x24')]=function(_0x22f3e4,_0x17db98){if(_0x22f3e4[_0x5787('0x4d')]['id']){delete _0x22f3e4[_0x5787('0x4d')]['id'];}return db[_0x5787('0x2d')][_0x5787('0x4b')]({'where':{'id':_0x22f3e4[_0x5787('0x49')]['id']}})[_0x5787('0x26')](handleEntityNotFound(_0x17db98,null))[_0x5787('0x26')](saveUpdates(_0x22f3e4['body'],null))[_0x5787('0x26')](respondWithResult(_0x17db98,null))[_0x5787('0x47')](handleError(_0x17db98,null));};exports[_0x5787('0x25')]=function(_0x36cf29,_0x266803){return db['ServicenowField'][_0x5787('0x4b')]({'where':{'id':_0x36cf29['params']['id']}})[_0x5787('0x26')](handleEntityNotFound(_0x266803,null))['then'](removeEntity(_0x266803,null))[_0x5787('0x47')](handleError(_0x266803,null));}; \ No newline at end of file +var _0x4aa5=['type','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x1e58a9,_0x39ce5a){var _0x278bb0=function(_0x22a479){while(--_0x22a479){_0x1e58a9['push'](_0x1e58a9['shift']());}};_0x278bb0(++_0x39ce5a);}(_0x4aa5,0x141));var _0x54aa=function(_0x517da2,_0x3be777){_0x517da2=_0x517da2-0x0;var _0x2c1acc=_0x4aa5[_0x517da2];return _0x2c1acc;};'use strict';var emlformat=require(_0x54aa('0x0'));var rimraf=require(_0x54aa('0x1'));var zipdir=require(_0x54aa('0x2'));var jsonpatch=require(_0x54aa('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x54aa('0x4'));var Mustache=require('mustache');var util=require(_0x54aa('0x5'));var path=require(_0x54aa('0x6'));var sox=require('sox');var csv=require(_0x54aa('0x7'));var ejs=require(_0x54aa('0x8'));var fs=require('fs');var fs_extra=require(_0x54aa('0x9'));var _=require(_0x54aa('0xa'));var squel=require(_0x54aa('0xb'));var crypto=require(_0x54aa('0xc'));var jsforce=require(_0x54aa('0xd'));var deskjs=require(_0x54aa('0xe'));var toCsv=require(_0x54aa('0x7'));var querystring=require(_0x54aa('0xf'));var Papa=require('papaparse');var Redis=require(_0x54aa('0x10'));var authService=require(_0x54aa('0x11'));var qs=require(_0x54aa('0x12'));var as=require(_0x54aa('0x13'));var hardwareService=require(_0x54aa('0x14'));var logger=require(_0x54aa('0x15'))(_0x54aa('0x16'));var utils=require(_0x54aa('0x17'));var config=require(_0x54aa('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x54aa('0x19'))['db'];function respondWithStatusCode(_0x432074,_0x25b0f2){_0x25b0f2=_0x25b0f2||0xcc;return function(_0x1f9537){if(_0x1f9537){return _0x432074[_0x54aa('0x1a')](_0x25b0f2);}return _0x432074[_0x54aa('0x1b')](_0x25b0f2)['end']();};}function respondWithResult(_0x4f17d4,_0x5ee54e){_0x5ee54e=_0x5ee54e||0xc8;return function(_0x28675e){if(_0x28675e){return _0x4f17d4['status'](_0x5ee54e)['json'](_0x28675e);}};}function respondWithFilteredResult(_0x141357,_0x23fa67){return function(_0x55c53b){if(_0x55c53b){var _0x1cf6c7=typeof _0x23fa67[_0x54aa('0x1c')]===_0x54aa('0x1d')&&typeof _0x23fa67[_0x54aa('0x1e')]===_0x54aa('0x1d');var _0x2bf0d1=_0x55c53b[_0x54aa('0x1f')];var _0x10b43d=_0x1cf6c7?0x0:_0x23fa67[_0x54aa('0x1c')];var _0x1da582=_0x1cf6c7?_0x55c53b[_0x54aa('0x1f')]:_0x23fa67[_0x54aa('0x1c')]+_0x23fa67[_0x54aa('0x1e')];var _0x4276f5;if(_0x1da582>=_0x2bf0d1){_0x1da582=_0x2bf0d1;_0x4276f5=0xc8;}else{_0x4276f5=0xce;}_0x141357[_0x54aa('0x1b')](_0x4276f5);return _0x141357[_0x54aa('0x20')](_0x54aa('0x21'),_0x10b43d+'-'+_0x1da582+'/'+_0x2bf0d1)[_0x54aa('0x22')](_0x55c53b);}return null;};}function patchUpdates(_0x364666){return function(_0x3a067b){try{jsonpatch[_0x54aa('0x23')](_0x3a067b,_0x364666,!![]);}catch(_0x208ebe){return BPromise[_0x54aa('0x24')](_0x208ebe);}return _0x3a067b['save']();};}function saveUpdates(_0x30ba84,_0x4326ac){return function(_0x12b2c9){if(_0x12b2c9){return _0x12b2c9[_0x54aa('0x25')](_0x30ba84)[_0x54aa('0x26')](function(_0x260769){return _0x260769;});}return null;};}function removeEntity(_0xd638d1,_0x2f880a){return function(_0x1e1716){if(_0x1e1716){return _0x1e1716[_0x54aa('0x27')]()[_0x54aa('0x26')](function(){_0xd638d1[_0x54aa('0x1b')](0xcc)[_0x54aa('0x28')]();});}};}function handleEntityNotFound(_0xa56f3f,_0x388af5){return function(_0x2fb403){if(!_0x2fb403){_0xa56f3f['sendStatus'](0x194);}return _0x2fb403;};}function handleError(_0x2d37f8,_0x32acb6){_0x32acb6=_0x32acb6||0x1f4;return function(_0x15a244){logger[_0x54aa('0x29')](_0x15a244[_0x54aa('0x2a')]);if(_0x15a244['name']){delete _0x15a244[_0x54aa('0x2b')];}_0x2d37f8[_0x54aa('0x1b')](_0x32acb6)['send'](_0x15a244);};}exports['index']=function(_0x1f7969,_0x4a5934){var _0x5f43e4={},_0x2fbda6={},_0x47cb8f={'count':0x0,'rows':[]};var _0x358f13=_[_0x54aa('0x2c')](db[_0x54aa('0x2d')][_0x54aa('0x2e')],function(_0x5904ac){return{'name':_0x5904ac[_0x54aa('0x2f')],'type':_0x5904ac['type'][_0x54aa('0x30')]};});_0x2fbda6[_0x54aa('0x31')]=_['map'](_0x358f13,_0x54aa('0x2b'));_0x2fbda6[_0x54aa('0x32')]=_[_0x54aa('0x33')](_0x1f7969[_0x54aa('0x32')]);_0x2fbda6[_0x54aa('0x34')]=_[_0x54aa('0x35')](_0x2fbda6[_0x54aa('0x31')],_0x2fbda6[_0x54aa('0x32')]);_0x5f43e4[_0x54aa('0x36')]=_['intersection'](_0x2fbda6['model'],qs[_0x54aa('0x37')](_0x1f7969[_0x54aa('0x32')][_0x54aa('0x37')]));_0x5f43e4['attributes']=_0x5f43e4[_0x54aa('0x36')]['length']?_0x5f43e4[_0x54aa('0x36')]:_0x2fbda6[_0x54aa('0x31')];if(!_0x1f7969[_0x54aa('0x32')][_0x54aa('0x38')](_0x54aa('0x39'))){_0x5f43e4[_0x54aa('0x1e')]=qs[_0x54aa('0x1e')](_0x1f7969[_0x54aa('0x32')][_0x54aa('0x1e')]);_0x5f43e4[_0x54aa('0x1c')]=qs['offset'](_0x1f7969[_0x54aa('0x32')][_0x54aa('0x1c')]);}_0x5f43e4[_0x54aa('0x3a')]=qs['sort'](_0x1f7969['query'][_0x54aa('0x3b')]);_0x5f43e4[_0x54aa('0x3c')]=qs[_0x54aa('0x34')](_[_0x54aa('0x3d')](_0x1f7969[_0x54aa('0x32')],_0x2fbda6['filters']),_0x358f13);if(_0x1f7969[_0x54aa('0x32')][_0x54aa('0x3e')]){_0x5f43e4[_0x54aa('0x3c')]=_[_0x54aa('0x3f')](_0x5f43e4[_0x54aa('0x3c')],{'$or':_[_0x54aa('0x2c')](_0x358f13,function(_0x60e4c6){if(_0x60e4c6[_0x54aa('0x40')]!==_0x54aa('0x41')){var _0x418e2f={};_0x418e2f[_0x60e4c6[_0x54aa('0x2b')]]={'$like':'%'+_0x1f7969[_0x54aa('0x32')]['filter']+'%'};return _0x418e2f;}})});}_0x5f43e4=_['merge']({},_0x5f43e4,_0x1f7969['options']);var _0xfb835={'where':_0x5f43e4[_0x54aa('0x3c')]};return db['ServicenowField'][_0x54aa('0x1f')](_0xfb835)[_0x54aa('0x26')](function(_0x35890f){_0x47cb8f[_0x54aa('0x1f')]=_0x35890f;if(_0x1f7969[_0x54aa('0x32')]['includeAll']){_0x5f43e4[_0x54aa('0x42')]=[{'all':!![]}];}return db[_0x54aa('0x2d')][_0x54aa('0x43')](_0x5f43e4);})['then'](function(_0x32e936){_0x47cb8f[_0x54aa('0x44')]=_0x32e936;return _0x47cb8f;})[_0x54aa('0x26')](respondWithFilteredResult(_0x4a5934,_0x5f43e4))['catch'](handleError(_0x4a5934,null));};exports[_0x54aa('0x45')]=function(_0x3ee3df,_0x5f443e){var _0xce4968={'raw':!![],'where':{'id':_0x3ee3df[_0x54aa('0x46')]['id']}},_0x45515c={};_0x45515c[_0x54aa('0x31')]=_[_0x54aa('0x33')](db[_0x54aa('0x2d')][_0x54aa('0x2e')]);_0x45515c[_0x54aa('0x32')]=_['keys'](_0x3ee3df['query']);_0x45515c[_0x54aa('0x34')]=_['intersection'](_0x45515c[_0x54aa('0x31')],_0x45515c['query']);_0xce4968[_0x54aa('0x36')]=_[_0x54aa('0x35')](_0x45515c[_0x54aa('0x31')],qs[_0x54aa('0x37')](_0x3ee3df[_0x54aa('0x32')][_0x54aa('0x37')]));_0xce4968[_0x54aa('0x36')]=_0xce4968[_0x54aa('0x36')]['length']?_0xce4968[_0x54aa('0x36')]:_0x45515c['model'];if(_0x3ee3df[_0x54aa('0x32')][_0x54aa('0x47')]){_0xce4968[_0x54aa('0x42')]=[{'all':!![]}];}_0xce4968=_[_0x54aa('0x3f')]({},_0xce4968,_0x3ee3df[_0x54aa('0x48')]);return db[_0x54aa('0x2d')][_0x54aa('0x49')](_0xce4968)[_0x54aa('0x26')](handleEntityNotFound(_0x5f443e,null))[_0x54aa('0x26')](respondWithResult(_0x5f443e,null))[_0x54aa('0x4a')](handleError(_0x5f443e,null));};exports[_0x54aa('0x4b')]=function(_0xf15608,_0x52e81f){return db[_0x54aa('0x2d')][_0x54aa('0x4b')](_0xf15608[_0x54aa('0x4c')],{})[_0x54aa('0x26')](respondWithResult(_0x52e81f,0xc9))['catch'](handleError(_0x52e81f,null));};exports[_0x54aa('0x25')]=function(_0x57265c,_0x28bfd5){if(_0x57265c[_0x54aa('0x4c')]['id']){delete _0x57265c[_0x54aa('0x4c')]['id'];}return db[_0x54aa('0x2d')][_0x54aa('0x49')]({'where':{'id':_0x57265c[_0x54aa('0x46')]['id']}})[_0x54aa('0x26')](handleEntityNotFound(_0x28bfd5,null))['then'](saveUpdates(_0x57265c[_0x54aa('0x4c')],null))[_0x54aa('0x26')](respondWithResult(_0x28bfd5,null))[_0x54aa('0x4a')](handleError(_0x28bfd5,null));};exports['destroy']=function(_0x1c7237,_0x2a7f32){return db[_0x54aa('0x2d')][_0x54aa('0x49')]({'where':{'id':_0x1c7237[_0x54aa('0x46')]['id']}})[_0x54aa('0x26')](handleEntityNotFound(_0x2a7f32,null))[_0x54aa('0x26')](removeEntity(_0x2a7f32,null))[_0x54aa('0x4a')](handleError(_0x2a7f32,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c59f257..a35dc2b 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 _0xa4b2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x4b3c89,_0x2b1c97){var _0x321580=function(_0x9088b6){while(--_0x9088b6){_0x4b3c89['push'](_0x4b3c89['shift']());}};_0x321580(++_0x2b1c97);}(_0xa4b2,0x195));var _0x2a4b=function(_0x39f5c2,_0xbe28ce){_0x39f5c2=_0x39f5c2-0x0;var _0x2c9f70=_0xa4b2[_0x39f5c2];return _0x2c9f70;};'use strict';var _=require(_0x2a4b('0x0'));var util=require(_0x2a4b('0x1'));var logger=require(_0x2a4b('0x2'))(_0x2a4b('0x3'));var moment=require(_0x2a4b('0x4'));var BPromise=require(_0x2a4b('0x5'));var rp=require(_0x2a4b('0x6'));var fs=require('fs');var path=require(_0x2a4b('0x7'));var rimraf=require('rimraf');var config=require(_0x2a4b('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x2a4b('0x9')]=function(_0x26fba0,_0x51f9f1){return _0x26fba0[_0x2a4b('0xa')](_0x2a4b('0xb'),attributes,{'tableName':_0x2a4b('0xc'),'paranoid':![],'indexes':[{'name':_0x2a4b('0xd'),'fields':[_0x2a4b('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2a1=['../../config/environment','./intServicenowField.attributes','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','rimraf'];(function(_0x4a1fdf,_0xb55e84){var _0x36c819=function(_0x24f505){while(--_0x24f505){_0x4a1fdf['push'](_0x4a1fdf['shift']());}};_0x36c819(++_0xb55e84);}(_0xe2a1,0xeb));var _0x1e2a=function(_0x537d10,_0x11ea5b){_0x537d10=_0x537d10-0x0;var _0x385f90=_0xe2a1[_0x537d10];return _0x385f90;};'use strict';var _=require(_0x1e2a('0x0'));var util=require(_0x1e2a('0x1'));var logger=require(_0x1e2a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1e2a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1e2a('0x4'));var config=require(_0x1e2a('0x5'));var attributes=require(_0x1e2a('0x6'));module['exports']=function(_0x592ee4,_0x3852d8){return _0x592ee4['define'](_0x1e2a('0x7'),attributes,{'tableName':_0x1e2a('0x8'),'paranoid':![],'indexes':[{'name':_0x1e2a('0x9'),'fields':[_0x1e2a('0xa'),_0x1e2a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index ab8d4fa..1c5f1a8 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(_0x239b31,_0x44a64d){var _0x41c8be=function(_0x27f031){while(--_0x27f031){_0x239b31['push'](_0x239b31['shift']());}};_0x41c8be(++_0x44a64d);}(_0xda3f,0xec));var _0xfda3=function(_0x102180,_0xb9a3fa){_0x102180=_0x102180-0x0;var _0x1b3aa0=_0xda3f[_0x102180];return _0x1b3aa0;};'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 _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x170765,_0xf278c3){var _0x390740=function(_0x219a2e){while(--_0x219a2e){_0x170765['push'](_0x170765['shift']());}};_0x390740(++_0xf278c3);}(_0xe706,0xa3));var _0x6e70=function(_0x52ba3d,_0x3ce09c){_0x52ba3d=_0x52ba3d-0x0;var _0x968ee9=_0xe706[_0x52ba3d];return _0x968ee9;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index deb0d61..05efe0e 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(_0x16bf01,_0x5ccd90){var _0x6acd09=function(_0x202bc0){while(--_0x202bc0){_0x16bf01['push'](_0x16bf01['shift']());}};_0x6acd09(++_0x5ccd90);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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(_0x15f4b8,_0x3a44b3){var _0x573527=function(_0x373d20){while(--_0x373d20){_0x15f4b8['push'](_0x15f4b8['shift']());}};_0x573527(++_0x3a44b3);}(_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['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 33974fe..4cd2986 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(_0x287eae,_0x598896){var _0x48d4db=function(_0x5608ab){while(--_0x5608ab){_0x287eae['push'](_0x287eae['shift']());}};_0x48d4db(++_0x598896);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0xee6ec8,_0x417498){var _0x47b444=function(_0x5733d9){while(--_0x5733d9){_0xee6ec8['push'](_0xee6ec8['shift']());}};_0x47b444(++_0x417498);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 ea4765c..b3f63fd 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 _0x0524=['body','find','params','getConfigurations','findOne','SugarcrmConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','format','%s%s','login','JSON','stringify','PLAIN','Invalid\x20Login','POST','Calls','values','module_fields','remove','label','endsWith','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','options','create'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x0524,0xa3));var _0x4052=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x0524[_0x146a85];return _0x1b59bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4052('0x0'));var zipdir=require(_0x4052('0x1'));var jsonpatch=require(_0x4052('0x2'));var rp=require(_0x4052('0x3'));var moment=require(_0x4052('0x4'));var BPromise=require(_0x4052('0x5'));var Mustache=require(_0x4052('0x6'));var util=require('util');var path=require(_0x4052('0x7'));var sox=require(_0x4052('0x8'));var csv=require(_0x4052('0x9'));var ejs=require(_0x4052('0xa'));var fs=require('fs');var fs_extra=require(_0x4052('0xb'));var _=require(_0x4052('0xc'));var squel=require(_0x4052('0xd'));var crypto=require(_0x4052('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4052('0xf'));var qs=require(_0x4052('0x10'));var as=require(_0x4052('0x11'));var hardwareService=require(_0x4052('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x4052('0x13'));var config=require(_0x4052('0x14'));var licenseUtil=require(_0x4052('0x15'));var db=require(_0x4052('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x166f05,_0x2927fa){_0x2927fa=_0x2927fa||0xcc;return function(_0x5f1d9f){if(_0x5f1d9f){return _0x166f05[_0x4052('0x17')](_0x2927fa);}return _0x166f05[_0x4052('0x18')](_0x2927fa)['end']();};}function respondWithResult(_0x5a648c,_0x50b074){_0x50b074=_0x50b074||0xc8;return function(_0x5cc9d6){if(_0x5cc9d6){return _0x5a648c[_0x4052('0x18')](_0x50b074)['json'](_0x5cc9d6);}};}function respondWithFilteredResult(_0x8ac78d,_0x4cde77){return function(_0x2d61a2){if(_0x2d61a2){var _0x571ef0=typeof _0x4cde77['offset']==='undefined'&&typeof _0x4cde77[_0x4052('0x19')]===_0x4052('0x1a');var _0x11ceb6=_0x2d61a2['count'];var _0x86b7ef=_0x571ef0?0x0:_0x4cde77[_0x4052('0x1b')];var _0x1fec6f=_0x571ef0?_0x2d61a2[_0x4052('0x1c')]:_0x4cde77[_0x4052('0x1b')]+_0x4cde77[_0x4052('0x19')];var _0x59c544;if(_0x1fec6f>=_0x11ceb6){_0x1fec6f=_0x11ceb6;_0x59c544=0xc8;}else{_0x59c544=0xce;}_0x8ac78d[_0x4052('0x18')](_0x59c544);return _0x8ac78d[_0x4052('0x1d')](_0x4052('0x1e'),_0x86b7ef+'-'+_0x1fec6f+'/'+_0x11ceb6)[_0x4052('0x1f')](_0x2d61a2);}return null;};}function patchUpdates(_0x3829d5){return function(_0x44a765){try{jsonpatch[_0x4052('0x20')](_0x44a765,_0x3829d5,!![]);}catch(_0x44c4ef){return BPromise[_0x4052('0x21')](_0x44c4ef);}return _0x44a765['save']();};}function saveUpdates(_0x389b29,_0x53c5d7){return function(_0xf8fe61){if(_0xf8fe61){return _0xf8fe61[_0x4052('0x22')](_0x389b29)[_0x4052('0x23')](function(_0x32f5ae){return _0x32f5ae;});}return null;};}function removeEntity(_0x2bb3b5,_0x546a90){return function(_0x5dea6c){if(_0x5dea6c){return _0x5dea6c[_0x4052('0x24')]()[_0x4052('0x23')](function(){_0x2bb3b5[_0x4052('0x18')](0xcc)[_0x4052('0x25')]();});}};}function handleEntityNotFound(_0x4725b1,_0x5ab0c3){return function(_0x45fd4d){if(!_0x45fd4d){_0x4725b1[_0x4052('0x17')](0x194);}return _0x45fd4d;};}function handleError(_0x784903,_0x128dff){_0x128dff=_0x128dff||0x1f4;return function(_0x5a78b9){logger[_0x4052('0x26')](_0x5a78b9['stack']);if(_0x5a78b9[_0x4052('0x27')]){delete _0x5a78b9[_0x4052('0x27')];}_0x784903[_0x4052('0x18')](_0x128dff)[_0x4052('0x28')](_0x5a78b9);};}exports[_0x4052('0x29')]=function(_0x33331a,_0x3646e0){var _0x194353={},_0x3c60e4={},_0x422ca4={'count':0x0,'rows':[]};var _0x4a7cca=_[_0x4052('0x2a')](db[_0x4052('0x2b')][_0x4052('0x2c')],function(_0xe404ef){return{'name':_0xe404ef['fieldName'],'type':_0xe404ef[_0x4052('0x2d')][_0x4052('0x2e')]};});_0x3c60e4['model']=_[_0x4052('0x2a')](_0x4a7cca,_0x4052('0x27'));_0x3c60e4[_0x4052('0x2f')]=_[_0x4052('0x30')](_0x33331a[_0x4052('0x2f')]);_0x3c60e4[_0x4052('0x31')]=_[_0x4052('0x32')](_0x3c60e4['model'],_0x3c60e4[_0x4052('0x2f')]);_0x194353[_0x4052('0x33')]=_[_0x4052('0x32')](_0x3c60e4[_0x4052('0x34')],qs[_0x4052('0x35')](_0x33331a[_0x4052('0x2f')][_0x4052('0x35')]));_0x194353[_0x4052('0x33')]=_0x194353[_0x4052('0x33')][_0x4052('0x36')]?_0x194353['attributes']:_0x3c60e4[_0x4052('0x34')];if(!_0x33331a['query']['hasOwnProperty'](_0x4052('0x37'))){_0x194353[_0x4052('0x19')]=qs[_0x4052('0x19')](_0x33331a[_0x4052('0x2f')][_0x4052('0x19')]);_0x194353[_0x4052('0x1b')]=qs[_0x4052('0x1b')](_0x33331a['query'][_0x4052('0x1b')]);}_0x194353['order']=qs[_0x4052('0x38')](_0x33331a['query'][_0x4052('0x38')]);_0x194353[_0x4052('0x39')]=qs[_0x4052('0x31')](_[_0x4052('0x3a')](_0x33331a[_0x4052('0x2f')],_0x3c60e4[_0x4052('0x31')]),_0x4a7cca);if(_0x33331a[_0x4052('0x2f')][_0x4052('0x3b')]){_0x194353['where']=_[_0x4052('0x3c')](_0x194353[_0x4052('0x39')],{'$or':_['map'](_0x4a7cca,function(_0x2b58c6){if(_0x2b58c6[_0x4052('0x2d')]!==_0x4052('0x3d')){var _0x5d068d={};_0x5d068d[_0x2b58c6[_0x4052('0x27')]]={'$like':'%'+_0x33331a['query'][_0x4052('0x3b')]+'%'};return _0x5d068d;}})});}_0x194353=_[_0x4052('0x3c')]({},_0x194353,_0x33331a['options']);var _0x2be3e4={'where':_0x194353['where']};return db[_0x4052('0x2b')]['count'](_0x2be3e4)['then'](function(_0x4c35c3){_0x422ca4[_0x4052('0x1c')]=_0x4c35c3;if(_0x33331a[_0x4052('0x2f')][_0x4052('0x3e')]){_0x194353[_0x4052('0x3f')]=[{'all':!![]}];}return db[_0x4052('0x2b')][_0x4052('0x40')](_0x194353);})[_0x4052('0x23')](function(_0x3671fd){_0x422ca4[_0x4052('0x41')]=_0x3671fd;return _0x422ca4;})[_0x4052('0x23')](respondWithFilteredResult(_0x3646e0,_0x194353))[_0x4052('0x42')](handleError(_0x3646e0,null));};exports['show']=function(_0x39d307,_0x62c6de){var _0x386b5b={'raw':![],'where':{'id':_0x39d307['params']['id']}},_0x3c7a31={};_0x3c7a31[_0x4052('0x34')]=_[_0x4052('0x30')](db[_0x4052('0x2b')][_0x4052('0x2c')]);_0x3c7a31['query']=_[_0x4052('0x30')](_0x39d307[_0x4052('0x2f')]);_0x3c7a31[_0x4052('0x31')]=_['intersection'](_0x3c7a31['model'],_0x3c7a31[_0x4052('0x2f')]);_0x386b5b[_0x4052('0x33')]=_[_0x4052('0x32')](_0x3c7a31['model'],qs[_0x4052('0x35')](_0x39d307[_0x4052('0x2f')][_0x4052('0x35')]));_0x386b5b[_0x4052('0x33')]=_0x386b5b[_0x4052('0x33')]['length']?_0x386b5b['attributes']:_0x3c7a31[_0x4052('0x34')];if(_0x39d307['query'][_0x4052('0x3e')]){_0x386b5b['include']=[{'all':!![]}];}_0x386b5b=_['merge']({},_0x386b5b,_0x39d307[_0x4052('0x43')]);return db[_0x4052('0x2b')]['find'](_0x386b5b)['then'](handleEntityNotFound(_0x62c6de,null))[_0x4052('0x23')](respondWithResult(_0x62c6de,null))[_0x4052('0x42')](handleError(_0x62c6de,null));};exports[_0x4052('0x44')]=function(_0x441c61,_0x4fda9b){return db[_0x4052('0x2b')][_0x4052('0x44')](_0x441c61['body'],{})[_0x4052('0x23')](respondWithResult(_0x4fda9b,0xc9))['catch'](handleError(_0x4fda9b,null));};exports[_0x4052('0x22')]=function(_0x154345,_0x42a2f1){if(_0x154345[_0x4052('0x45')]['id']){delete _0x154345[_0x4052('0x45')]['id'];}return db[_0x4052('0x2b')][_0x4052('0x46')]({'where':{'id':_0x154345[_0x4052('0x47')]['id']}})[_0x4052('0x23')](handleEntityNotFound(_0x42a2f1,null))['then'](saveUpdates(_0x154345['body'],null))[_0x4052('0x23')](respondWithResult(_0x42a2f1,null))[_0x4052('0x42')](handleError(_0x42a2f1,null));};exports['destroy']=function(_0x112730,_0x21a0eb){return db[_0x4052('0x2b')]['find']({'where':{'id':_0x112730[_0x4052('0x47')]['id']}})['then'](handleEntityNotFound(_0x21a0eb,null))[_0x4052('0x23')](removeEntity(_0x21a0eb,null))['catch'](handleError(_0x21a0eb,null));};exports[_0x4052('0x48')]=function(_0x3715fe,_0x4bf2e4,_0xf24a45){var _0x3b29e4={};var _0x1ac6bd={};var _0x5b5c80;var _0x391755;return db['SugarcrmAccount'][_0x4052('0x49')]({'where':{'id':_0x3715fe[_0x4052('0x47')]['id']}})[_0x4052('0x23')](handleEntityNotFound(_0x4bf2e4,null))[_0x4052('0x23')](function(_0x529d85){if(_0x529d85){_0x5b5c80=_0x529d85;_0x1ac6bd[_0x4052('0x34')]=_[_0x4052('0x30')](db[_0x4052('0x4a')]['rawAttributes']);_0x1ac6bd['query']=_[_0x4052('0x30')](_0x3715fe[_0x4052('0x2f')]);_0x1ac6bd[_0x4052('0x31')]=_[_0x4052('0x32')](_0x1ac6bd[_0x4052('0x34')],_0x1ac6bd[_0x4052('0x2f')]);_0x3b29e4[_0x4052('0x33')]=_[_0x4052('0x32')](_0x1ac6bd[_0x4052('0x34')],qs[_0x4052('0x35')](_0x3715fe[_0x4052('0x2f')][_0x4052('0x35')]));_0x3b29e4[_0x4052('0x33')]=_0x3b29e4[_0x4052('0x33')]['length']?_0x3b29e4['attributes']:_0x1ac6bd[_0x4052('0x34')];_0x3b29e4[_0x4052('0x4b')]=qs[_0x4052('0x38')](_0x3715fe[_0x4052('0x2f')][_0x4052('0x38')]);_0x3b29e4[_0x4052('0x39')]=qs[_0x4052('0x31')](_[_0x4052('0x3a')](_0x3715fe[_0x4052('0x2f')],_0x1ac6bd['filters']));if(_0x3715fe[_0x4052('0x2f')][_0x4052('0x3b')]){_0x3b29e4[_0x4052('0x39')]=_['merge'](_0x3b29e4[_0x4052('0x39')],{'$or':_[_0x4052('0x2a')](_0x3b29e4[_0x4052('0x33')],function(_0x3cc93f){var _0x230f0c={};_0x230f0c[_0x3cc93f]={'$like':'%'+_0x3715fe[_0x4052('0x2f')][_0x4052('0x3b')]+'%'};return _0x230f0c;})});}_0x3b29e4=_['merge']({},_0x3b29e4,_0x3715fe[_0x4052('0x43')]);return _0x5b5c80[_0x4052('0x48')](_0x3b29e4);}})[_0x4052('0x23')](function(_0x3d3588){if(_0x3d3588){_0x391755=_0x3d3588[_0x4052('0x36')];if(!_0x3715fe[_0x4052('0x2f')][_0x4052('0x4c')](_0x4052('0x37'))){_0x3b29e4[_0x4052('0x19')]=qs['limit'](_0x3715fe[_0x4052('0x2f')][_0x4052('0x19')]);_0x3b29e4[_0x4052('0x1b')]=qs['offset'](_0x3715fe[_0x4052('0x2f')][_0x4052('0x1b')]);}return _0x5b5c80['getConfigurations'](_0x3b29e4);}})[_0x4052('0x23')](function(_0x5e9f53){if(_0x5e9f53){return _0x5e9f53?{'count':_0x391755,'rows':_0x5e9f53}:null;}})[_0x4052('0x23')](respondWithResult(_0x4bf2e4,null))[_0x4052('0x42')](handleError(_0x4bf2e4,null));};exports[_0x4052('0x4d')]=function(_0x3ce041,_0x5af14b,_0x2d748f){if(_0x3ce041['body']['id']){delete _0x3ce041[_0x4052('0x45')]['id'];}return db['SugarcrmAccount'][_0x4052('0x49')]({'where':{'id':_0x3ce041[_0x4052('0x47')]['id']}})['then'](handleEntityNotFound(_0x5af14b,null))[_0x4052('0x23')](function(_0x5f2616){if(_0x5f2616){_0x3ce041['body'][_0x4052('0x4e')]=_0x5f2616['id'];_0x3ce041[_0x4052('0x45')][_0x4052('0x4f')]=integrations[_0x4052('0x50')](_0x3ce041[_0x4052('0x45')][_0x4052('0x51')],_0x3ce041['body'][_0x4052('0x2d')]);_0x3ce041['body']['Descriptions']=integrations['getDescriptions'](_0x3ce041[_0x4052('0x45')][_0x4052('0x51')],_0x3ce041[_0x4052('0x45')][_0x4052('0x2d')]);return db['SugarcrmConfiguration'][_0x4052('0x44')](_0x3ce041['body'],{'include':[{'model':db[_0x4052('0x52')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x4052('0x53')}]});}return null;})[_0x4052('0x23')](respondWithResult(_0x5af14b,null))[_0x4052('0x42')](handleError(_0x5af14b,null));};exports[_0x4052('0x54')]=function(_0x40e9d7,_0xec5ab5,_0x17f7f6){var _0x27354a='';var _0x32a3ca=['id',_0x4052('0x27'),_0x4052('0x55'),_0x4052('0x56'),_0x4052('0x57'),_0x4052('0x58'),_0x4052('0x59'),_0x4052('0x5a'),_0x4052('0x5b'),'parent_type',_0x4052('0x5c'),_0x4052('0x5d')];return db['SugarcrmAccount'][_0x4052('0x49')]({'where':{'id':_0x40e9d7[_0x4052('0x47')]['id']},'attributes':['id',_0x4052('0x5e'),_0x4052('0x5f'),_0x4052('0x60')]})[_0x4052('0x23')](handleEntityNotFound(_0xec5ab5,null))[_0x4052('0x23')](function(_0x1ea8c1){if(_0x1ea8c1){_0x27354a=_0x1ea8c1[_0x4052('0x60')];var _0x407e2c=_0x27354a['slice'](-0x1);if(_0x407e2c==='/'){_0x27354a=_0x27354a[_0x4052('0x61')](0x0,_0x27354a[_0x4052('0x62')](_0x407e2c));}return rp({'method':'POST','uri':util[_0x4052('0x63')](_0x4052('0x64'),_0x27354a,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x4052('0x65'),'input_type':_0x4052('0x66'),'response_type':'JSON','rest_data':JSON[_0x4052('0x67')]({'user_auth':{'user_name':_0x1ea8c1[_0x4052('0x5e')],'password':_0x1ea8c1[_0x4052('0x5f')],'encryption':_0x4052('0x68')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x431fca){if(_0x431fca&&_0x431fca[_0x4052('0x27')]!==_0x4052('0x69')&&_0x431fca['name']!=='Password\x20Expired'){return rp({'method':_0x4052('0x6a'),'uri':util[_0x4052('0x63')](_0x4052('0x64'),_0x27354a,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x4052('0x66'),'rest_data':JSON[_0x4052('0x67')]({'session':_0x431fca['id'],'module_name':_0x4052('0x6b')})}})[_0x4052('0x23')](function(_0xcd1a7a){if(_0xcd1a7a){var _0x16e4bf=_[_0x4052('0x6c')](_0xcd1a7a[_0x4052('0x6d')]);_[_0x4052('0x6e')](_0x16e4bf,function(_0x212473){return _0x32a3ca['includes'](_0x212473['name']);});return{'count':_0x16e4bf['length'],'rows':_['map'](_0x16e4bf,function(_0x1e7c9d){return{'id':_0x1e7c9d['name'],'name':_0x1e7c9d[_0x4052('0x6f')],'custom':_[_0x4052('0x70')](_0x1e7c9d[_0x4052('0x27')],'_c')?!![]:![],'options':_0x1e7c9d[_0x4052('0x43')]?_[_0x4052('0x2a')](_['values'](_0x1e7c9d[_0x4052('0x43')]),function(_0x36a19d){return{'name':_0x36a19d['value'],'value':_0x36a19d['name']};}):[]};})};}})[_0x4052('0x23')](respondWithResult(_0xec5ab5,null))['catch'](function(_0x3f4a9d){var _0x9b7975=_0x40e9d7[_0x4052('0x2f')][_0x4052('0x71')]?0x1f4:_0x3f4a9d['statusCode']||0x1f4;logger['error'](_0x4052('0x72'),_0x4052('0x54'),_0x9b7975,JSON[_0x4052('0x67')](_0x3f4a9d));delete _0x3f4a9d[_0x4052('0x27')];if(_0x9b7975===0x191){_0x9b7975=0x190;}_0xec5ab5[_0x4052('0x18')](_0x9b7975)[_0x4052('0x28')](_0x40e9d7[_0x4052('0x2f')][_0x4052('0x71')]?{'message':_0x4052('0x73'),'statusCode':_0x3f4a9d['statusCode']}:_0x3f4a9d);});}else{var _0x21c166=0x1f4;_0xec5ab5[_0x4052('0x18')](_0x21c166)[_0x4052('0x28')]({'message':_0x4052('0x73'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x9ec9=['Wrong\x20credentials','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','then','destroy','error','name','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','rows','show','find','catch','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','POST','format','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test'];(function(_0x1c2384,_0xea7610){var _0x4d6a77=function(_0x40e6fe){while(--_0x40e6fe){_0x1c2384['push'](_0x1c2384['shift']());}};_0x4d6a77(++_0xea7610);}(_0x9ec9,0x15a));var _0x99ec=function(_0x1d8b31,_0xef220e){_0x1d8b31=_0x1d8b31-0x0;var _0x2548ce=_0x9ec9[_0x1d8b31];return _0x2548ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99ec('0x0'));var zipdir=require(_0x99ec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99ec('0x2'));var moment=require('moment');var BPromise=require(_0x99ec('0x3'));var Mustache=require(_0x99ec('0x4'));var util=require(_0x99ec('0x5'));var path=require(_0x99ec('0x6'));var sox=require(_0x99ec('0x7'));var csv=require('to-csv');var ejs=require(_0x99ec('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x99ec('0x9'));var deskjs=require(_0x99ec('0xa'));var toCsv=require(_0x99ec('0xb'));var querystring=require(_0x99ec('0xc'));var Papa=require(_0x99ec('0xd'));var Redis=require(_0x99ec('0xe'));var authService=require(_0x99ec('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x99ec('0x10'));var hardwareService=require(_0x99ec('0x11'));var logger=require(_0x99ec('0x12'))(_0x99ec('0x13'));var utils=require(_0x99ec('0x14'));var config=require(_0x99ec('0x15'));var licenseUtil=require(_0x99ec('0x16'));var db=require(_0x99ec('0x17'))['db'];var integrations=require(_0x99ec('0x18'));function respondWithStatusCode(_0x51622c,_0x469db2){_0x469db2=_0x469db2||0xcc;return function(_0x51ad31){if(_0x51ad31){return _0x51622c[_0x99ec('0x19')](_0x469db2);}return _0x51622c[_0x99ec('0x1a')](_0x469db2)[_0x99ec('0x1b')]();};}function respondWithResult(_0x35da5a,_0x488454){_0x488454=_0x488454||0xc8;return function(_0x4dd296){if(_0x4dd296){return _0x35da5a['status'](_0x488454)[_0x99ec('0x1c')](_0x4dd296);}};}function respondWithFilteredResult(_0x504e0c,_0x2d3dd6){return function(_0x54a0b8){if(_0x54a0b8){var _0x3e3c08=typeof _0x2d3dd6[_0x99ec('0x1d')]===_0x99ec('0x1e')&&typeof _0x2d3dd6[_0x99ec('0x1f')]==='undefined';var _0x111d30=_0x54a0b8['count'];var _0x413f00=_0x3e3c08?0x0:_0x2d3dd6[_0x99ec('0x1d')];var _0x3c288f=_0x3e3c08?_0x54a0b8[_0x99ec('0x20')]:_0x2d3dd6[_0x99ec('0x1d')]+_0x2d3dd6[_0x99ec('0x1f')];var _0x3bee1c;if(_0x3c288f>=_0x111d30){_0x3c288f=_0x111d30;_0x3bee1c=0xc8;}else{_0x3bee1c=0xce;}_0x504e0c[_0x99ec('0x1a')](_0x3bee1c);return _0x504e0c['set'](_0x99ec('0x21'),_0x413f00+'-'+_0x3c288f+'/'+_0x111d30)[_0x99ec('0x1c')](_0x54a0b8);}return null;};}function patchUpdates(_0x44e7fb){return function(_0x48ff58){try{jsonpatch['apply'](_0x48ff58,_0x44e7fb,!![]);}catch(_0x2e7131){return BPromise['reject'](_0x2e7131);}return _0x48ff58[_0x99ec('0x22')]();};}function saveUpdates(_0x5f5907,_0x421f28){return function(_0x451dbe){if(_0x451dbe){return _0x451dbe['update'](_0x5f5907)[_0x99ec('0x23')](function(_0x23d773){return _0x23d773;});}return null;};}function removeEntity(_0x3e2baf,_0x5ec25c){return function(_0x140e10){if(_0x140e10){return _0x140e10[_0x99ec('0x24')]()[_0x99ec('0x23')](function(){_0x3e2baf[_0x99ec('0x1a')](0xcc)[_0x99ec('0x1b')]();});}};}function handleEntityNotFound(_0x2d3e59,_0x15e917){return function(_0x39ad1f){if(!_0x39ad1f){_0x2d3e59[_0x99ec('0x19')](0x194);}return _0x39ad1f;};}function handleError(_0x43ccb6,_0x3e9647){_0x3e9647=_0x3e9647||0x1f4;return function(_0x243f4f){logger[_0x99ec('0x25')](_0x243f4f['stack']);if(_0x243f4f[_0x99ec('0x26')]){delete _0x243f4f['name'];}_0x43ccb6[_0x99ec('0x1a')](_0x3e9647)['send'](_0x243f4f);};}exports['index']=function(_0x5634bb,_0x55f511){var _0x15e903={},_0x1604f1={},_0x1edb3d={'count':0x0,'rows':[]};var _0x103bea=_['map'](db['SugarcrmAccount'][_0x99ec('0x27')],function(_0x3649a2){return{'name':_0x3649a2[_0x99ec('0x28')],'type':_0x3649a2[_0x99ec('0x29')][_0x99ec('0x2a')]};});_0x1604f1['model']=_['map'](_0x103bea,_0x99ec('0x26'));_0x1604f1['query']=_[_0x99ec('0x2b')](_0x5634bb[_0x99ec('0x2c')]);_0x1604f1[_0x99ec('0x2d')]=_[_0x99ec('0x2e')](_0x1604f1[_0x99ec('0x2f')],_0x1604f1[_0x99ec('0x2c')]);_0x15e903[_0x99ec('0x30')]=_[_0x99ec('0x2e')](_0x1604f1[_0x99ec('0x2f')],qs[_0x99ec('0x31')](_0x5634bb[_0x99ec('0x2c')][_0x99ec('0x31')]));_0x15e903[_0x99ec('0x30')]=_0x15e903['attributes'][_0x99ec('0x32')]?_0x15e903[_0x99ec('0x30')]:_0x1604f1[_0x99ec('0x2f')];if(!_0x5634bb[_0x99ec('0x2c')][_0x99ec('0x33')]('nolimit')){_0x15e903[_0x99ec('0x1f')]=qs[_0x99ec('0x1f')](_0x5634bb[_0x99ec('0x2c')][_0x99ec('0x1f')]);_0x15e903[_0x99ec('0x1d')]=qs[_0x99ec('0x1d')](_0x5634bb[_0x99ec('0x2c')][_0x99ec('0x1d')]);}_0x15e903[_0x99ec('0x34')]=qs[_0x99ec('0x35')](_0x5634bb[_0x99ec('0x2c')]['sort']);_0x15e903['where']=qs[_0x99ec('0x2d')](_[_0x99ec('0x36')](_0x5634bb[_0x99ec('0x2c')],_0x1604f1[_0x99ec('0x2d')]),_0x103bea);if(_0x5634bb['query'][_0x99ec('0x37')]){_0x15e903[_0x99ec('0x38')]=_[_0x99ec('0x39')](_0x15e903[_0x99ec('0x38')],{'$or':_[_0x99ec('0x3a')](_0x103bea,function(_0x3a3840){if(_0x3a3840[_0x99ec('0x29')]!==_0x99ec('0x3b')){var _0x11ed33={};_0x11ed33[_0x3a3840[_0x99ec('0x26')]]={'$like':'%'+_0x5634bb[_0x99ec('0x2c')][_0x99ec('0x37')]+'%'};return _0x11ed33;}})});}_0x15e903=_[_0x99ec('0x39')]({},_0x15e903,_0x5634bb[_0x99ec('0x3c')]);var _0x548ee7={'where':_0x15e903['where']};return db[_0x99ec('0x3d')]['count'](_0x548ee7)['then'](function(_0x47ffd6){_0x1edb3d[_0x99ec('0x20')]=_0x47ffd6;if(_0x5634bb[_0x99ec('0x2c')][_0x99ec('0x3e')]){_0x15e903[_0x99ec('0x3f')]=[{'all':!![]}];}return db[_0x99ec('0x3d')][_0x99ec('0x40')](_0x15e903);})[_0x99ec('0x23')](function(_0x466826){_0x1edb3d[_0x99ec('0x41')]=_0x466826;return _0x1edb3d;})[_0x99ec('0x23')](respondWithFilteredResult(_0x55f511,_0x15e903))['catch'](handleError(_0x55f511,null));};exports[_0x99ec('0x42')]=function(_0x200615,_0x2263d7){var _0x310513={'raw':![],'where':{'id':_0x200615['params']['id']}},_0x5da786={};_0x5da786['model']=_[_0x99ec('0x2b')](db[_0x99ec('0x3d')][_0x99ec('0x27')]);_0x5da786[_0x99ec('0x2c')]=_[_0x99ec('0x2b')](_0x200615[_0x99ec('0x2c')]);_0x5da786['filters']=_['intersection'](_0x5da786[_0x99ec('0x2f')],_0x5da786['query']);_0x310513[_0x99ec('0x30')]=_[_0x99ec('0x2e')](_0x5da786['model'],qs[_0x99ec('0x31')](_0x200615[_0x99ec('0x2c')][_0x99ec('0x31')]));_0x310513['attributes']=_0x310513[_0x99ec('0x30')][_0x99ec('0x32')]?_0x310513[_0x99ec('0x30')]:_0x5da786['model'];if(_0x200615[_0x99ec('0x2c')]['includeAll']){_0x310513[_0x99ec('0x3f')]=[{'all':!![]}];}_0x310513=_['merge']({},_0x310513,_0x200615[_0x99ec('0x3c')]);return db['SugarcrmAccount'][_0x99ec('0x43')](_0x310513)[_0x99ec('0x23')](handleEntityNotFound(_0x2263d7,null))[_0x99ec('0x23')](respondWithResult(_0x2263d7,null))[_0x99ec('0x44')](handleError(_0x2263d7,null));};exports[_0x99ec('0x45')]=function(_0x364365,_0x38e914){return db[_0x99ec('0x3d')][_0x99ec('0x45')](_0x364365[_0x99ec('0x46')],{})[_0x99ec('0x23')](respondWithResult(_0x38e914,0xc9))[_0x99ec('0x44')](handleError(_0x38e914,null));};exports['update']=function(_0x263cad,_0x1e3fdb){if(_0x263cad[_0x99ec('0x46')]['id']){delete _0x263cad[_0x99ec('0x46')]['id'];}return db[_0x99ec('0x3d')][_0x99ec('0x43')]({'where':{'id':_0x263cad[_0x99ec('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e3fdb,null))[_0x99ec('0x23')](saveUpdates(_0x263cad[_0x99ec('0x46')],null))[_0x99ec('0x23')](respondWithResult(_0x1e3fdb,null))[_0x99ec('0x44')](handleError(_0x1e3fdb,null));};exports[_0x99ec('0x24')]=function(_0x7d7b16,_0xff6d3f){return db[_0x99ec('0x3d')][_0x99ec('0x43')]({'where':{'id':_0x7d7b16[_0x99ec('0x47')]['id']}})[_0x99ec('0x23')](handleEntityNotFound(_0xff6d3f,null))[_0x99ec('0x23')](removeEntity(_0xff6d3f,null))['catch'](handleError(_0xff6d3f,null));};exports[_0x99ec('0x48')]=function(_0x3e92a7,_0x2b4ccd,_0x154b3a){var _0x48c65f={};var _0x19aeaa={};var _0x2a05bb;var _0x39b16f;return db[_0x99ec('0x3d')][_0x99ec('0x49')]({'where':{'id':_0x3e92a7[_0x99ec('0x47')]['id']}})[_0x99ec('0x23')](handleEntityNotFound(_0x2b4ccd,null))[_0x99ec('0x23')](function(_0x41f5c3){if(_0x41f5c3){_0x2a05bb=_0x41f5c3;_0x19aeaa[_0x99ec('0x2f')]=_[_0x99ec('0x2b')](db[_0x99ec('0x4a')][_0x99ec('0x27')]);_0x19aeaa['query']=_[_0x99ec('0x2b')](_0x3e92a7[_0x99ec('0x2c')]);_0x19aeaa['filters']=_[_0x99ec('0x2e')](_0x19aeaa[_0x99ec('0x2f')],_0x19aeaa['query']);_0x48c65f[_0x99ec('0x30')]=_[_0x99ec('0x2e')](_0x19aeaa[_0x99ec('0x2f')],qs[_0x99ec('0x31')](_0x3e92a7[_0x99ec('0x2c')][_0x99ec('0x31')]));_0x48c65f['attributes']=_0x48c65f[_0x99ec('0x30')]['length']?_0x48c65f[_0x99ec('0x30')]:_0x19aeaa[_0x99ec('0x2f')];_0x48c65f[_0x99ec('0x34')]=qs['sort'](_0x3e92a7[_0x99ec('0x2c')][_0x99ec('0x35')]);_0x48c65f['where']=qs[_0x99ec('0x2d')](_[_0x99ec('0x36')](_0x3e92a7[_0x99ec('0x2c')],_0x19aeaa[_0x99ec('0x2d')]));if(_0x3e92a7[_0x99ec('0x2c')][_0x99ec('0x37')]){_0x48c65f[_0x99ec('0x38')]=_[_0x99ec('0x39')](_0x48c65f['where'],{'$or':_[_0x99ec('0x3a')](_0x48c65f[_0x99ec('0x30')],function(_0x2d87fb){var _0x2104c8={};_0x2104c8[_0x2d87fb]={'$like':'%'+_0x3e92a7['query'][_0x99ec('0x37')]+'%'};return _0x2104c8;})});}_0x48c65f=_['merge']({},_0x48c65f,_0x3e92a7[_0x99ec('0x3c')]);return _0x2a05bb[_0x99ec('0x48')](_0x48c65f);}})[_0x99ec('0x23')](function(_0x5784e9){if(_0x5784e9){_0x39b16f=_0x5784e9[_0x99ec('0x32')];if(!_0x3e92a7['query'][_0x99ec('0x33')]('nolimit')){_0x48c65f[_0x99ec('0x1f')]=qs[_0x99ec('0x1f')](_0x3e92a7[_0x99ec('0x2c')][_0x99ec('0x1f')]);_0x48c65f['offset']=qs[_0x99ec('0x1d')](_0x3e92a7[_0x99ec('0x2c')][_0x99ec('0x1d')]);}return _0x2a05bb['getConfigurations'](_0x48c65f);}})[_0x99ec('0x23')](function(_0x9f22dd){if(_0x9f22dd){return _0x9f22dd?{'count':_0x39b16f,'rows':_0x9f22dd}:null;}})[_0x99ec('0x23')](respondWithResult(_0x2b4ccd,null))[_0x99ec('0x44')](handleError(_0x2b4ccd,null));};exports['addConfiguration']=function(_0x3d0ae9,_0x4d6af3,_0x2bb2d4){if(_0x3d0ae9[_0x99ec('0x46')]['id']){delete _0x3d0ae9['body']['id'];}return db[_0x99ec('0x3d')][_0x99ec('0x49')]({'where':{'id':_0x3d0ae9[_0x99ec('0x47')]['id']}})[_0x99ec('0x23')](handleEntityNotFound(_0x4d6af3,null))[_0x99ec('0x23')](function(_0x5c78ac){if(_0x5c78ac){_0x3d0ae9[_0x99ec('0x46')][_0x99ec('0x4b')]=_0x5c78ac['id'];_0x3d0ae9[_0x99ec('0x46')][_0x99ec('0x4c')]=integrations[_0x99ec('0x4d')](_0x3d0ae9[_0x99ec('0x46')][_0x99ec('0x4e')],_0x3d0ae9['body']['type']);_0x3d0ae9[_0x99ec('0x46')][_0x99ec('0x4f')]=integrations[_0x99ec('0x50')](_0x3d0ae9[_0x99ec('0x46')]['channel'],_0x3d0ae9[_0x99ec('0x46')][_0x99ec('0x29')]);return db['SugarcrmConfiguration'][_0x99ec('0x45')](_0x3d0ae9['body'],{'include':[{'model':db[_0x99ec('0x51')],'as':_0x99ec('0x4c')},{'model':db[_0x99ec('0x51')],'as':_0x99ec('0x4f')}]});}return null;})[_0x99ec('0x23')](respondWithResult(_0x4d6af3,null))['catch'](handleError(_0x4d6af3,null));};exports[_0x99ec('0x52')]=function(_0x4b4fbc,_0x16b05d,_0x5046f3){var _0x3a864c='';var _0x44c8d9=['id',_0x99ec('0x26'),_0x99ec('0x53'),_0x99ec('0x54'),_0x99ec('0x55'),_0x99ec('0x56'),_0x99ec('0x57'),_0x99ec('0x58'),_0x99ec('0x59'),_0x99ec('0x5a'),_0x99ec('0x5b'),'direction'];return db[_0x99ec('0x3d')][_0x99ec('0x49')]({'where':{'id':_0x4b4fbc['params']['id']},'attributes':['id','username',_0x99ec('0x5c'),_0x99ec('0x5d')]})['then'](handleEntityNotFound(_0x16b05d,null))[_0x99ec('0x23')](function(_0x44f191){if(_0x44f191){_0x3a864c=_0x44f191[_0x99ec('0x5d')];var _0x584116=_0x3a864c['slice'](-0x1);if(_0x584116==='/'){_0x3a864c=_0x3a864c['substring'](0x0,_0x3a864c['lastIndexOf'](_0x584116));}return rp({'method':_0x99ec('0x5e'),'uri':util[_0x99ec('0x5f')]('%s%s',_0x3a864c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x99ec('0x60'),'input_type':_0x99ec('0x61'),'response_type':_0x99ec('0x61'),'rest_data':JSON[_0x99ec('0x62')]({'user_auth':{'user_name':_0x44f191[_0x99ec('0x63')],'password':_0x44f191[_0x99ec('0x5c')],'encryption':_0x99ec('0x64')},'application':_0x99ec('0x65')})}});}})['then'](function(_0x18794){if(_0x18794&&_0x18794[_0x99ec('0x26')]!==_0x99ec('0x66')&&_0x18794[_0x99ec('0x26')]!=='Password\x20Expired'){return rp({'method':_0x99ec('0x5e'),'uri':util['format']('%s%s',_0x3a864c,_0x99ec('0x67')),'json':!![],'form':{'method':_0x99ec('0x68'),'input_type':_0x99ec('0x61'),'response_type':_0x99ec('0x61'),'rest_data':JSON['stringify']({'session':_0x18794['id'],'module_name':'Calls'})}})[_0x99ec('0x23')](function(_0x364212){if(_0x364212){var _0x17f143=_[_0x99ec('0x69')](_0x364212[_0x99ec('0x6a')]);_[_0x99ec('0x6b')](_0x17f143,function(_0x2186a8){return _0x44c8d9['includes'](_0x2186a8[_0x99ec('0x26')]);});return{'count':_0x17f143[_0x99ec('0x32')],'rows':_['map'](_0x17f143,function(_0x4633bf){return{'id':_0x4633bf['name'],'name':_0x4633bf['label'],'custom':_[_0x99ec('0x6c')](_0x4633bf[_0x99ec('0x26')],'_c')?!![]:![],'options':_0x4633bf[_0x99ec('0x3c')]?_[_0x99ec('0x3a')](_[_0x99ec('0x69')](_0x4633bf['options']),function(_0x725ff6){return{'name':_0x725ff6[_0x99ec('0x6d')],'value':_0x725ff6['name']};}):[]};})};}})[_0x99ec('0x23')](respondWithResult(_0x16b05d,null))[_0x99ec('0x44')](function(_0x2e436a){var _0x2b683c=_0x4b4fbc[_0x99ec('0x2c')]['test']?0x1f4:_0x2e436a[_0x99ec('0x6e')]||0x1f4;logger[_0x99ec('0x25')](_0x99ec('0x6f'),'getFields',_0x2b683c,JSON['stringify'](_0x2e436a));delete _0x2e436a[_0x99ec('0x26')];if(_0x2b683c===0x191){_0x2b683c=0x190;}_0x16b05d[_0x99ec('0x1a')](_0x2b683c)[_0x99ec('0x70')](_0x4b4fbc[_0x99ec('0x2c')][_0x99ec('0x71')]?{'message':_0x99ec('0x72'),'statusCode':_0x2e436a['statusCode']}:_0x2e436a);});}else{var _0x14782b=0x1f4;_0x16b05d[_0x99ec('0x1a')](_0x14782b)['send']({'message':_0x99ec('0x72'),'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 4dcb8a6..43b6140 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 _0xdadc=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdadc,0x75));var _0xcdad=function(_0x357c38,_0x11ef6){_0x357c38=_0x357c38-0x0;var _0x5ef17e=_0xdadc[_0x357c38];return _0x5ef17e;};'use strict';var _=require(_0xcdad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcdad('0x1'));var moment=require(_0xcdad('0x2'));var BPromise=require(_0xcdad('0x3'));var rp=require(_0xcdad('0x4'));var fs=require('fs');var path=require(_0xcdad('0x5'));var rimraf=require(_0xcdad('0x6'));var config=require(_0xcdad('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xcdad('0x8'));module[_0xcdad('0x9')]=function(_0x84e574,_0x595c95){return _0x84e574['define'](_0xcdad('0xa'),attributes,{'tableName':_0xcdad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c5e=['bluebird','request-promise','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','util','../../config/logger','api'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0x2c5e,0x165));var _0xe2c5=function(_0xb4d2a2,_0x2187c9){_0xb4d2a2=_0xb4d2a2-0x0;var _0x8e6eb9=_0x2c5e[_0xb4d2a2];return _0x8e6eb9;};'use strict';var _=require('lodash');var util=require(_0xe2c5('0x0'));var logger=require(_0xe2c5('0x1'))(_0xe2c5('0x2'));var moment=require('moment');var BPromise=require(_0xe2c5('0x3'));var rp=require(_0xe2c5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe2c5('0x5'));var integrations=require(_0xe2c5('0x6'));module[_0xe2c5('0x7')]=function(_0x146d4b,_0x370889){return _0x146d4b[_0xe2c5('0x8')](_0xe2c5('0x9'),attributes,{'tableName':'int_sugarcrm_accounts','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 9982cb0..45a67b2 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 _0x32c5=['request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','model','map','catch','ShowSugarcrmAccount','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http'];(function(_0x482a12,_0x38e1d2){var _0xcd464e=function(_0x4c82c9){while(--_0x4c82c9){_0x482a12['push'](_0x482a12['shift']());}};_0xcd464e(++_0x38e1d2);}(_0x32c5,0x1e7));var _0x532c=function(_0x448bbb,_0x180ab4){_0x448bbb=_0x448bbb-0x0;var _0x43d731=_0x32c5[_0x448bbb];return _0x43d731;};'use strict';var _=require('lodash');var util=require(_0x532c('0x0'));var moment=require('moment');var BPromise=require(_0x532c('0x1'));var rs=require(_0x532c('0x2'));var fs=require('fs');var Redis=require(_0x532c('0x3'));var db=require(_0x532c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x532c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x532c('0x6')][_0x532c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21cf26,_0x3075df,_0x1b47cd){return new BPromise(function(_0x3eac1c,_0x216a36){return client[_0x532c('0x8')](_0x21cf26,_0x1b47cd)[_0x532c('0x9')](function(_0x14f29c){logger[_0x532c('0xa')](_0x532c('0xb'),_0x3075df,'request\x20sent');logger[_0x532c('0xc')](_0x532c('0xd'),_0x3075df,_0x532c('0xe'),JSON[_0x532c('0xf')](_0x14f29c));if(_0x14f29c['error']){if(_0x14f29c[_0x532c('0x10')][_0x532c('0x11')]===0x1f4){logger[_0x532c('0x10')](_0x532c('0xb'),_0x3075df,_0x14f29c[_0x532c('0x10')][_0x532c('0x12')]);return _0x216a36(_0x14f29c[_0x532c('0x10')]['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x3075df,_0x14f29c[_0x532c('0x10')][_0x532c('0x12')]);return _0x3eac1c(_0x14f29c[_0x532c('0x10')][_0x532c('0x12')]);}else{logger[_0x532c('0xa')](_0x532c('0xb'),_0x3075df,_0x532c('0xe'));_0x3eac1c(_0x14f29c[_0x532c('0x13')][_0x532c('0x12')]);}})['catch'](function(_0x5eec0d){logger['error'](_0x532c('0xb'),_0x3075df,_0x5eec0d);_0x216a36(_0x5eec0d);});});}exports[_0x532c('0x14')]=function(_0x4a056d){var _0x54f51d=this;return new Promise(function(_0x57deed,_0x2ea30b){return db[_0x532c('0x15')][_0x532c('0x16')]({'raw':_0x4a056d[_0x532c('0x17')]?_0x4a056d['options'][_0x532c('0x18')]===undefined?!![]:![]:!![],'where':_0x4a056d[_0x532c('0x17')]?_0x4a056d[_0x532c('0x17')]['where']||null:null,'attributes':_0x4a056d[_0x532c('0x17')]?_0x4a056d[_0x532c('0x17')][_0x532c('0x19')]||null:null,'limit':_0x4a056d[_0x532c('0x17')]?_0x4a056d['options'][_0x532c('0x1a')]||null:null,'include':_0x4a056d['options']?_0x4a056d['options']['include']?_['map'](_0x4a056d[_0x532c('0x17')][_0x532c('0x1b')],function(_0x40fb14){return{'model':db[_0x40fb14[_0x532c('0x1c')]],'as':_0x40fb14['as'],'attributes':_0x40fb14['attributes'],'include':_0x40fb14[_0x532c('0x1b')]?_['map'](_0x40fb14[_0x532c('0x1b')],function(_0x404c08){return{'model':db[_0x404c08[_0x532c('0x1c')]],'as':_0x404c08['as'],'attributes':_0x404c08['attributes'],'include':_0x404c08['include']?_[_0x532c('0x1d')](_0x404c08[_0x532c('0x1b')],function(_0x1d4f40){return{'model':db[_0x1d4f40[_0x532c('0x1c')]],'as':_0x1d4f40['as'],'attributes':_0x1d4f40[_0x532c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x532c('0x9')](function(_0x177c7f){logger['info']('GetSugarcrmAccount',_0x4a056d);logger[_0x532c('0xc')](_0x532c('0x14'),_0x4a056d,JSON[_0x532c('0xf')](_0x177c7f));_0x57deed(_0x177c7f);})[_0x532c('0x1e')](function(_0x3cbd28){logger[_0x532c('0x10')]('GetSugarcrmAccount',_0x3cbd28['message'],_0x4a056d);_0x2ea30b(_0x54f51d[_0x532c('0x10')](0x1f4,_0x3cbd28[_0x532c('0x12')]));});});};exports[_0x532c('0x1f')]=function(_0x35dff9){var _0x46734b=this;return new Promise(function(_0x1c0ff2,_0x31dd9b){return db[_0x532c('0x15')]['find']({'raw':_0x35dff9[_0x532c('0x17')]?_0x35dff9['options'][_0x532c('0x18')]===undefined?!![]:![]:!![],'where':_0x35dff9[_0x532c('0x17')]?_0x35dff9[_0x532c('0x17')][_0x532c('0x20')]||null:null,'attributes':_0x35dff9[_0x532c('0x17')]?_0x35dff9[_0x532c('0x17')]['attributes']||null:null,'include':_0x35dff9['options']?_0x35dff9[_0x532c('0x17')][_0x532c('0x1b')]?_[_0x532c('0x1d')](_0x35dff9['options'][_0x532c('0x1b')],function(_0x5f3f4b){return{'model':db[_0x5f3f4b[_0x532c('0x1c')]],'as':_0x5f3f4b['as'],'attributes':_0x5f3f4b[_0x532c('0x19')],'include':_0x5f3f4b[_0x532c('0x1b')]?_[_0x532c('0x1d')](_0x5f3f4b['include'],function(_0x41ce06){return{'model':db[_0x41ce06[_0x532c('0x1c')]],'as':_0x41ce06['as'],'attributes':_0x41ce06[_0x532c('0x19')],'include':_0x41ce06[_0x532c('0x1b')]?_['map'](_0x41ce06['include'],function(_0x51c297){return{'model':db[_0x51c297[_0x532c('0x1c')]],'as':_0x51c297['as'],'attributes':_0x51c297[_0x532c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x532c('0x9')](function(_0x1eb674){logger['info']('ShowSugarcrmAccount',_0x35dff9);logger[_0x532c('0xc')]('ShowSugarcrmAccount',_0x35dff9,JSON[_0x532c('0xf')](_0x1eb674));_0x1c0ff2(_0x1eb674);})['catch'](function(_0x46c016){logger['error'](_0x532c('0x1f'),_0x46c016[_0x532c('0x12')],_0x35dff9);_0x31dd9b(_0x46734b['error'](0x1f4,_0x46c016[_0x532c('0x12')]));});});}; \ No newline at end of file +var _0xa3a4=['code','message','info','request\x20sent','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','find','ShowSugarcrmAccount','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x3fccde,_0x5bda14){var _0x5e9cd7=function(_0x25014d){while(--_0x25014d){_0x3fccde['push'](_0x3fccde['shift']());}};_0x5e9cd7(++_0x5bda14);}(_0xa3a4,0x193));var _0x4a3a=function(_0x3c40af,_0x5ddde5){_0x3c40af=_0x3c40af-0x0;var _0x11e889=_0xa3a4[_0x3c40af];return _0x11e889;};'use strict';var _=require(_0x4a3a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4a3a('0x1'));var fs=require('fs');var Redis=require(_0x4a3a('0x2'));var db=require(_0x4a3a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a3a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4a3a('0x5'));var client=jayson['client'][_0x4a3a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x37af47,_0x38bbbf,_0x1dae20){return new BPromise(function(_0x3a421e,_0x585b03){return client[_0x4a3a('0x7')](_0x37af47,_0x1dae20)[_0x4a3a('0x8')](function(_0x4583a3){logger['info'](_0x4a3a('0x9'),_0x38bbbf,'request\x20sent');logger[_0x4a3a('0xa')](_0x4a3a('0xb'),_0x38bbbf,'request\x20sent',JSON['stringify'](_0x4583a3));if(_0x4583a3['error']){if(_0x4583a3[_0x4a3a('0xc')][_0x4a3a('0xd')]===0x1f4){logger[_0x4a3a('0xc')](_0x4a3a('0x9'),_0x38bbbf,_0x4583a3[_0x4a3a('0xc')]['message']);return _0x585b03(_0x4583a3['error'][_0x4a3a('0xe')]);}logger[_0x4a3a('0xc')](_0x4a3a('0x9'),_0x38bbbf,_0x4583a3[_0x4a3a('0xc')]['message']);return _0x3a421e(_0x4583a3[_0x4a3a('0xc')][_0x4a3a('0xe')]);}else{logger[_0x4a3a('0xf')](_0x4a3a('0x9'),_0x38bbbf,_0x4a3a('0x10'));_0x3a421e(_0x4583a3['result']['message']);}})[_0x4a3a('0x11')](function(_0x1ddcd6){logger[_0x4a3a('0xc')](_0x4a3a('0x9'),_0x38bbbf,_0x1ddcd6);_0x585b03(_0x1ddcd6);});});}exports[_0x4a3a('0x12')]=function(_0x5eb39f){var _0xec2c08=this;return new Promise(function(_0x4d2dd1,_0x13e04c){return db[_0x4a3a('0x13')][_0x4a3a('0x14')]({'raw':_0x5eb39f['options']?_0x5eb39f[_0x4a3a('0x15')][_0x4a3a('0x16')]===undefined?!![]:![]:!![],'where':_0x5eb39f['options']?_0x5eb39f['options'][_0x4a3a('0x17')]||null:null,'attributes':_0x5eb39f[_0x4a3a('0x15')]?_0x5eb39f[_0x4a3a('0x15')]['attributes']||null:null,'limit':_0x5eb39f[_0x4a3a('0x15')]?_0x5eb39f[_0x4a3a('0x15')][_0x4a3a('0x18')]||null:null,'include':_0x5eb39f[_0x4a3a('0x15')]?_0x5eb39f[_0x4a3a('0x15')][_0x4a3a('0x19')]?_[_0x4a3a('0x1a')](_0x5eb39f[_0x4a3a('0x15')][_0x4a3a('0x19')],function(_0x5db337){return{'model':db[_0x5db337[_0x4a3a('0x1b')]],'as':_0x5db337['as'],'attributes':_0x5db337[_0x4a3a('0x1c')],'include':_0x5db337[_0x4a3a('0x19')]?_[_0x4a3a('0x1a')](_0x5db337[_0x4a3a('0x19')],function(_0x2f6d63){return{'model':db[_0x2f6d63['model']],'as':_0x2f6d63['as'],'attributes':_0x2f6d63[_0x4a3a('0x1c')],'include':_0x2f6d63[_0x4a3a('0x19')]?_[_0x4a3a('0x1a')](_0x2f6d63['include'],function(_0x4bb5d1){return{'model':db[_0x4bb5d1['model']],'as':_0x4bb5d1['as'],'attributes':_0x4bb5d1[_0x4a3a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4a3a('0x8')](function(_0x8fd2cc){logger[_0x4a3a('0xf')](_0x4a3a('0x12'),_0x5eb39f);logger[_0x4a3a('0xa')](_0x4a3a('0x12'),_0x5eb39f,JSON[_0x4a3a('0x1d')](_0x8fd2cc));_0x4d2dd1(_0x8fd2cc);})[_0x4a3a('0x11')](function(_0x1fa18f){logger[_0x4a3a('0xc')](_0x4a3a('0x12'),_0x1fa18f['message'],_0x5eb39f);_0x13e04c(_0xec2c08[_0x4a3a('0xc')](0x1f4,_0x1fa18f[_0x4a3a('0xe')]));});});};exports['ShowSugarcrmAccount']=function(_0x2a9e89){var _0x3805c5=this;return new Promise(function(_0x14b89b,_0x4f77aa){return db['SugarcrmAccount'][_0x4a3a('0x1e')]({'raw':_0x2a9e89[_0x4a3a('0x15')]?_0x2a9e89[_0x4a3a('0x15')][_0x4a3a('0x16')]===undefined?!![]:![]:!![],'where':_0x2a9e89[_0x4a3a('0x15')]?_0x2a9e89[_0x4a3a('0x15')][_0x4a3a('0x17')]||null:null,'attributes':_0x2a9e89[_0x4a3a('0x15')]?_0x2a9e89[_0x4a3a('0x15')][_0x4a3a('0x1c')]||null:null,'include':_0x2a9e89[_0x4a3a('0x15')]?_0x2a9e89[_0x4a3a('0x15')][_0x4a3a('0x19')]?_['map'](_0x2a9e89[_0x4a3a('0x15')]['include'],function(_0x439a2d){return{'model':db[_0x439a2d[_0x4a3a('0x1b')]],'as':_0x439a2d['as'],'attributes':_0x439a2d['attributes'],'include':_0x439a2d[_0x4a3a('0x19')]?_[_0x4a3a('0x1a')](_0x439a2d[_0x4a3a('0x19')],function(_0x10a5c4){return{'model':db[_0x10a5c4[_0x4a3a('0x1b')]],'as':_0x10a5c4['as'],'attributes':_0x10a5c4[_0x4a3a('0x1c')],'include':_0x10a5c4[_0x4a3a('0x19')]?_['map'](_0x10a5c4['include'],function(_0x4d5a91){return{'model':db[_0x4d5a91[_0x4a3a('0x1b')]],'as':_0x4d5a91['as'],'attributes':_0x4d5a91['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a3a('0x8')](function(_0x5b2c01){logger[_0x4a3a('0xf')](_0x4a3a('0x1f'),_0x2a9e89);logger['debug']('ShowSugarcrmAccount',_0x2a9e89,JSON[_0x4a3a('0x1d')](_0x5b2c01));_0x14b89b(_0x5b2c01);})['catch'](function(_0x2d0304){logger['error'](_0x4a3a('0x1f'),_0x2d0304[_0x4a3a('0xe')],_0x2a9e89);_0x4f77aa(_0x3805c5[_0x4a3a('0xc')](0x1f4,_0x2d0304[_0x4a3a('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 77b1837..8eaa35b 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 _0x0c9b=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','/:id','delete','destroy','exports'];(function(_0x1b4600,_0x21ef7d){var _0x2b64cf=function(_0x4c8cd6){while(--_0x4c8cd6){_0x1b4600['push'](_0x1b4600['shift']());}};_0x2b64cf(++_0x21ef7d);}(_0x0c9b,0x1e3));var _0xb0c9=function(_0x8220a2,_0x41c4d3){_0x8220a2=_0x8220a2-0x0;var _0x257eea=_0x0c9b[_0x8220a2];return _0x257eea;};'use strict';var multer=require(_0xb0c9('0x0'));var util=require(_0xb0c9('0x1'));var path=require(_0xb0c9('0x2'));var timeout=require(_0xb0c9('0x3'));var express=require(_0xb0c9('0x4'));var router=express[_0xb0c9('0x5')]();var fs_extra=require(_0xb0c9('0x6'));var auth=require(_0xb0c9('0x7'));var interaction=require(_0xb0c9('0x8'));var config=require(_0xb0c9('0x9'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xb0c9('0xa')]('/',auth[_0xb0c9('0xb')](),controller[_0xb0c9('0xc')]);router['get']('/:id',auth[_0xb0c9('0xb')](),controller['show']);router[_0xb0c9('0xa')]('/:id/fields',auth[_0xb0c9('0xb')](),controller[_0xb0c9('0xd')]);router[_0xb0c9('0xa')](_0xb0c9('0xe'),auth[_0xb0c9('0xb')](),controller[_0xb0c9('0xf')]);router[_0xb0c9('0xa')](_0xb0c9('0x10'),auth[_0xb0c9('0xb')](),controller[_0xb0c9('0x11')]);router[_0xb0c9('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb0c9('0x13'),auth[_0xb0c9('0xb')](),controller['update']);router[_0xb0c9('0x14')](_0xb0c9('0x13'),auth[_0xb0c9('0xb')](),controller[_0xb0c9('0x15')]);module[_0xb0c9('0x16')]=router; \ No newline at end of file +var _0xc07c=['/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields'];(function(_0x3549b2,_0x2865a4){var _0x12840a=function(_0x19ca2e){while(--_0x19ca2e){_0x3549b2['push'](_0x3549b2['shift']());}};_0x12840a(++_0x2865a4);}(_0xc07c,0xe2));var _0xcc07=function(_0x3b62f6,_0x3c7767){_0x3b62f6=_0x3b62f6-0x0;var _0x9f60d2=_0xc07c[_0x3b62f6];return _0x9f60d2;};'use strict';var multer=require(_0xcc07('0x0'));var util=require(_0xcc07('0x1'));var path=require(_0xcc07('0x2'));var timeout=require(_0xcc07('0x3'));var express=require(_0xcc07('0x4'));var router=express[_0xcc07('0x5')]();var fs_extra=require(_0xcc07('0x6'));var auth=require(_0xcc07('0x7'));var interaction=require(_0xcc07('0x8'));var config=require(_0xcc07('0x9'));var controller=require(_0xcc07('0xa'));router[_0xcc07('0xb')]('/',auth[_0xcc07('0xc')](),controller[_0xcc07('0xd')]);router[_0xcc07('0xb')]('/:id',auth[_0xcc07('0xc')](),controller[_0xcc07('0xe')]);router[_0xcc07('0xb')](_0xcc07('0xf'),auth['isAuthenticated'](),controller[_0xcc07('0x10')]);router[_0xcc07('0xb')](_0xcc07('0x11'),auth[_0xcc07('0xc')](),controller['getSubjects']);router[_0xcc07('0xb')](_0xcc07('0x12'),auth[_0xcc07('0xc')](),controller[_0xcc07('0x13')]);router[_0xcc07('0x14')]('/',auth[_0xcc07('0xc')](),controller[_0xcc07('0x15')]);router[_0xcc07('0x16')](_0xcc07('0x17'),auth[_0xcc07('0xc')](),controller[_0xcc07('0x18')]);router[_0xcc07('0x19')]('/:id',auth[_0xcc07('0xc')](),controller['destroy']);module[_0xcc07('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 398c377..bfc00fb 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 _0x2b7e=['exports','STRING'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x2b7e,0x120));var _0xe2b7=function(_0x5da678,_0x29634b){_0x5da678=_0x5da678-0x0;var _0x2e1fa3=_0x2b7e[_0x5da678];return _0x2e1fa3;};'use strict';var Sequelize=require('sequelize');module[_0xe2b7('0x0')]={'name':{'type':Sequelize[_0xe2b7('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3f56=['exports','sequelize'];(function(_0x353033,_0x425e11){var _0x33b6c3=function(_0x467f82){while(--_0x467f82){_0x353033['push'](_0x353033['shift']());}};_0x33b6c3(++_0x425e11);}(_0x3f56,0x1cf));var _0x63f5=function(_0x294d78,_0xb25f1a){_0x294d78=_0x294d78-0x0;var _0x413feb=_0x3f56[_0x294d78];return _0x413feb;};'use strict';var Sequelize=require(_0x63f5('0x0'));module[_0x63f5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index dcd71a7..d6f420d 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 _0x0536=['sort','where','pick','filter','VIRTUAL','merge','SugarcrmConfiguration','findAll','rows','catch','show','include','options','create','body','find','params','getFields','findOne','hasOwnProperty','getSubjects','getDescriptions','SugarcrmField','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x2b2cce,_0x582b1c){var _0x2b78b3=function(_0x557d61){while(--_0x557d61){_0x2b2cce['push'](_0x2b2cce['shift']());}};_0x2b78b3(++_0x582b1c);}(_0x0536,0x157));var _0x6053=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0536[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x6053('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6053('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6053('0x2'));var moment=require(_0x6053('0x3'));var BPromise=require(_0x6053('0x4'));var Mustache=require(_0x6053('0x5'));var util=require(_0x6053('0x6'));var path=require('path');var sox=require(_0x6053('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6053('0x8'));var squel=require('squel');var crypto=require(_0x6053('0x9'));var jsforce=require(_0x6053('0xa'));var deskjs=require(_0x6053('0xb'));var toCsv=require(_0x6053('0xc'));var querystring=require(_0x6053('0xd'));var Papa=require('papaparse');var Redis=require(_0x6053('0xe'));var authService=require(_0x6053('0xf'));var qs=require(_0x6053('0x10'));var as=require(_0x6053('0x11'));var hardwareService=require(_0x6053('0x12'));var logger=require(_0x6053('0x13'))(_0x6053('0x14'));var utils=require(_0x6053('0x15'));var config=require(_0x6053('0x16'));var licenseUtil=require(_0x6053('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4de82f,_0x314206){_0x314206=_0x314206||0xcc;return function(_0x36417b){if(_0x36417b){return _0x4de82f[_0x6053('0x18')](_0x314206);}return _0x4de82f[_0x6053('0x19')](_0x314206)[_0x6053('0x1a')]();};}function respondWithResult(_0x37cf80,_0x14c0f){_0x14c0f=_0x14c0f||0xc8;return function(_0x23a91d){if(_0x23a91d){return _0x37cf80['status'](_0x14c0f)[_0x6053('0x1b')](_0x23a91d);}};}function respondWithFilteredResult(_0xe6b09,_0x56c2ce){return function(_0x3ad18b){if(_0x3ad18b){var _0x4a804c=typeof _0x56c2ce[_0x6053('0x1c')]===_0x6053('0x1d')&&typeof _0x56c2ce[_0x6053('0x1e')]===_0x6053('0x1d');var _0xad0e81=_0x3ad18b[_0x6053('0x1f')];var _0xf63914=_0x4a804c?0x0:_0x56c2ce['offset'];var _0xb4f771=_0x4a804c?_0x3ad18b[_0x6053('0x1f')]:_0x56c2ce[_0x6053('0x1c')]+_0x56c2ce[_0x6053('0x1e')];var _0xf5662a;if(_0xb4f771>=_0xad0e81){_0xb4f771=_0xad0e81;_0xf5662a=0xc8;}else{_0xf5662a=0xce;}_0xe6b09[_0x6053('0x19')](_0xf5662a);return _0xe6b09['set']('Content-Range',_0xf63914+'-'+_0xb4f771+'/'+_0xad0e81)[_0x6053('0x1b')](_0x3ad18b);}return null;};}function patchUpdates(_0xee4df9){return function(_0x43d474){try{jsonpatch[_0x6053('0x20')](_0x43d474,_0xee4df9,!![]);}catch(_0x4fa38b){return BPromise[_0x6053('0x21')](_0x4fa38b);}return _0x43d474[_0x6053('0x22')]();};}function saveUpdates(_0xc13624,_0xadb8dc){return function(_0x44d0a0){if(_0x44d0a0){return _0x44d0a0[_0x6053('0x23')](_0xc13624)[_0x6053('0x24')](function(_0x4ce81f){return _0x4ce81f;});}return null;};}function removeEntity(_0x57e2c7,_0x3f8ae7){return function(_0x4e9f88){if(_0x4e9f88){return _0x4e9f88[_0x6053('0x25')]()[_0x6053('0x24')](function(){_0x57e2c7[_0x6053('0x19')](0xcc)[_0x6053('0x1a')]();});}};}function handleEntityNotFound(_0x3f57fc,_0xfe13fe){return function(_0x397824){if(!_0x397824){_0x3f57fc[_0x6053('0x18')](0x194);}return _0x397824;};}function handleError(_0x2cb426,_0x46f25d){_0x46f25d=_0x46f25d||0x1f4;return function(_0xa0ca48){logger[_0x6053('0x26')](_0xa0ca48[_0x6053('0x27')]);if(_0xa0ca48[_0x6053('0x28')]){delete _0xa0ca48[_0x6053('0x28')];}_0x2cb426['status'](_0x46f25d)['send'](_0xa0ca48);};}exports[_0x6053('0x29')]=function(_0xc0845f,_0x7c3afa){var _0x14dc8a={},_0x47a969={},_0x4ac070={'count':0x0,'rows':[]};var _0x1fb39c=_[_0x6053('0x2a')](db['SugarcrmConfiguration'][_0x6053('0x2b')],function(_0x366f85){return{'name':_0x366f85[_0x6053('0x2c')],'type':_0x366f85[_0x6053('0x2d')][_0x6053('0x2e')]};});_0x47a969[_0x6053('0x2f')]=_[_0x6053('0x2a')](_0x1fb39c,_0x6053('0x28'));_0x47a969['query']=_[_0x6053('0x30')](_0xc0845f[_0x6053('0x31')]);_0x47a969[_0x6053('0x32')]=_[_0x6053('0x33')](_0x47a969[_0x6053('0x2f')],_0x47a969['query']);_0x14dc8a[_0x6053('0x34')]=_[_0x6053('0x33')](_0x47a969[_0x6053('0x2f')],qs[_0x6053('0x35')](_0xc0845f[_0x6053('0x31')][_0x6053('0x35')]));_0x14dc8a[_0x6053('0x34')]=_0x14dc8a[_0x6053('0x34')][_0x6053('0x36')]?_0x14dc8a[_0x6053('0x34')]:_0x47a969['model'];if(!_0xc0845f[_0x6053('0x31')]['hasOwnProperty'](_0x6053('0x37'))){_0x14dc8a[_0x6053('0x1e')]=qs[_0x6053('0x1e')](_0xc0845f['query']['limit']);_0x14dc8a[_0x6053('0x1c')]=qs[_0x6053('0x1c')](_0xc0845f[_0x6053('0x31')][_0x6053('0x1c')]);}_0x14dc8a[_0x6053('0x38')]=qs[_0x6053('0x39')](_0xc0845f[_0x6053('0x31')][_0x6053('0x39')]);_0x14dc8a[_0x6053('0x3a')]=qs[_0x6053('0x32')](_[_0x6053('0x3b')](_0xc0845f[_0x6053('0x31')],_0x47a969['filters']),_0x1fb39c);if(_0xc0845f[_0x6053('0x31')][_0x6053('0x3c')]){_0x14dc8a[_0x6053('0x3a')]=_['merge'](_0x14dc8a[_0x6053('0x3a')],{'$or':_[_0x6053('0x2a')](_0x1fb39c,function(_0x274ebe){if(_0x274ebe[_0x6053('0x2d')]!==_0x6053('0x3d')){var _0x49c0c0={};_0x49c0c0[_0x274ebe['name']]={'$like':'%'+_0xc0845f[_0x6053('0x31')][_0x6053('0x3c')]+'%'};return _0x49c0c0;}})});}_0x14dc8a=_[_0x6053('0x3e')]({},_0x14dc8a,_0xc0845f['options']);var _0x464356={'where':_0x14dc8a[_0x6053('0x3a')]};return db['SugarcrmConfiguration']['count'](_0x464356)[_0x6053('0x24')](function(_0x40b475){_0x4ac070['count']=_0x40b475;if(_0xc0845f[_0x6053('0x31')]['includeAll']){_0x14dc8a['include']=[{'all':!![]}];}return db[_0x6053('0x3f')][_0x6053('0x40')](_0x14dc8a);})['then'](function(_0x334f3b){_0x4ac070[_0x6053('0x41')]=_0x334f3b;return _0x4ac070;})[_0x6053('0x24')](respondWithFilteredResult(_0x7c3afa,_0x14dc8a))[_0x6053('0x42')](handleError(_0x7c3afa,null));};exports[_0x6053('0x43')]=function(_0x51f05b,_0x169d6d){var _0xadd190={'raw':![],'where':{'id':_0x51f05b['params']['id']}},_0x20ebc4={};_0x20ebc4[_0x6053('0x2f')]=_[_0x6053('0x30')](db['SugarcrmConfiguration']['rawAttributes']);_0x20ebc4[_0x6053('0x31')]=_['keys'](_0x51f05b['query']);_0x20ebc4[_0x6053('0x32')]=_[_0x6053('0x33')](_0x20ebc4[_0x6053('0x2f')],_0x20ebc4[_0x6053('0x31')]);_0xadd190[_0x6053('0x34')]=_[_0x6053('0x33')](_0x20ebc4[_0x6053('0x2f')],qs['fields'](_0x51f05b['query'][_0x6053('0x35')]));_0xadd190['attributes']=_0xadd190[_0x6053('0x34')]['length']?_0xadd190[_0x6053('0x34')]:_0x20ebc4[_0x6053('0x2f')];if(_0x51f05b[_0x6053('0x31')]['includeAll']){_0xadd190[_0x6053('0x44')]=[{'all':!![]}];}_0xadd190=_[_0x6053('0x3e')]({},_0xadd190,_0x51f05b[_0x6053('0x45')]);return db[_0x6053('0x3f')]['find'](_0xadd190)['then'](handleEntityNotFound(_0x169d6d,null))[_0x6053('0x24')](respondWithResult(_0x169d6d,null))['catch'](handleError(_0x169d6d,null));};exports[_0x6053('0x46')]=function(_0x2d6b12,_0x64cb56){return db['SugarcrmConfiguration'][_0x6053('0x46')](_0x2d6b12['body'],{})[_0x6053('0x24')](respondWithResult(_0x64cb56,0xc9))[_0x6053('0x42')](handleError(_0x64cb56,null));};exports['update']=function(_0x141b2a,_0x3c6ad2){if(_0x141b2a[_0x6053('0x47')]['id']){delete _0x141b2a['body']['id'];}return db[_0x6053('0x3f')][_0x6053('0x48')]({'where':{'id':_0x141b2a[_0x6053('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c6ad2,null))[_0x6053('0x24')](saveUpdates(_0x141b2a[_0x6053('0x47')],null))['then'](respondWithResult(_0x3c6ad2,null))[_0x6053('0x42')](handleError(_0x3c6ad2,null));};exports[_0x6053('0x25')]=function(_0x36c58a,_0x53e21f){return db[_0x6053('0x3f')][_0x6053('0x48')]({'where':{'id':_0x36c58a['params']['id']}})[_0x6053('0x24')](handleEntityNotFound(_0x53e21f,null))[_0x6053('0x24')](removeEntity(_0x53e21f,null))[_0x6053('0x42')](handleError(_0x53e21f,null));};exports[_0x6053('0x4a')]=function(_0x1e4a1f,_0x5131c9,_0x275031){var _0x4a5d57={};var _0x277cbf={};var _0x23f36b;var _0x230b41;return db[_0x6053('0x3f')][_0x6053('0x4b')]({'where':{'id':_0x1e4a1f[_0x6053('0x49')]['id']}})[_0x6053('0x24')](handleEntityNotFound(_0x5131c9,null))[_0x6053('0x24')](function(_0x13282c){if(_0x13282c){_0x23f36b=_0x13282c;_0x277cbf[_0x6053('0x2f')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x277cbf[_0x6053('0x31')]=_[_0x6053('0x30')](_0x1e4a1f[_0x6053('0x31')]);_0x277cbf[_0x6053('0x32')]=_['intersection'](_0x277cbf['model'],_0x277cbf['query']);_0x4a5d57[_0x6053('0x34')]=_['intersection'](_0x277cbf[_0x6053('0x2f')],qs['fields'](_0x1e4a1f['query'][_0x6053('0x35')]));_0x4a5d57[_0x6053('0x34')]=_0x4a5d57['attributes'][_0x6053('0x36')]?_0x4a5d57['attributes']:_0x277cbf[_0x6053('0x2f')];_0x4a5d57[_0x6053('0x38')]=qs[_0x6053('0x39')](_0x1e4a1f[_0x6053('0x31')]['sort']);_0x4a5d57[_0x6053('0x3a')]=qs[_0x6053('0x32')](_[_0x6053('0x3b')](_0x1e4a1f[_0x6053('0x31')],_0x277cbf['filters']));if(_0x1e4a1f[_0x6053('0x31')]['filter']){_0x4a5d57[_0x6053('0x3a')]=_['merge'](_0x4a5d57[_0x6053('0x3a')],{'$or':_[_0x6053('0x2a')](_0x4a5d57[_0x6053('0x34')],function(_0x441103){var _0x4399cb={};_0x4399cb[_0x441103]={'$like':'%'+_0x1e4a1f['query'][_0x6053('0x3c')]+'%'};return _0x4399cb;})});}_0x4a5d57=_[_0x6053('0x3e')]({},_0x4a5d57,_0x1e4a1f[_0x6053('0x45')]);return _0x23f36b[_0x6053('0x4a')](_0x4a5d57);}})[_0x6053('0x24')](function(_0x53c241){if(_0x53c241){_0x230b41=_0x53c241[_0x6053('0x36')];if(!_0x1e4a1f[_0x6053('0x31')][_0x6053('0x4c')]('nolimit')){_0x4a5d57[_0x6053('0x1e')]=qs['limit'](_0x1e4a1f[_0x6053('0x31')][_0x6053('0x1e')]);_0x4a5d57[_0x6053('0x1c')]=qs['offset'](_0x1e4a1f[_0x6053('0x31')]['offset']);}return _0x23f36b[_0x6053('0x4a')](_0x4a5d57);}})[_0x6053('0x24')](function(_0x31719a){if(_0x31719a){return _0x31719a?{'count':_0x230b41,'rows':_0x31719a}:null;}})[_0x6053('0x24')](respondWithResult(_0x5131c9,null))[_0x6053('0x42')](handleError(_0x5131c9,null));};exports['getSubjects']=function(_0x40e76f,_0xc68aa4,_0x26dde7){var _0x48e867={};var _0x9456eb={};var _0x185655;var _0x3f13ab;return db[_0x6053('0x3f')][_0x6053('0x4b')]({'where':{'id':_0x40e76f[_0x6053('0x49')]['id']}})['then'](handleEntityNotFound(_0xc68aa4,null))['then'](function(_0x4ade03){if(_0x4ade03){_0x185655=_0x4ade03;_0x9456eb['model']=_[_0x6053('0x30')](db['SugarcrmField'][_0x6053('0x2b')]);_0x9456eb[_0x6053('0x31')]=_[_0x6053('0x30')](_0x40e76f['query']);_0x9456eb['filters']=_[_0x6053('0x33')](_0x9456eb[_0x6053('0x2f')],_0x9456eb[_0x6053('0x31')]);_0x48e867['attributes']=_[_0x6053('0x33')](_0x9456eb[_0x6053('0x2f')],qs['fields'](_0x40e76f['query'][_0x6053('0x35')]));_0x48e867[_0x6053('0x34')]=_0x48e867[_0x6053('0x34')][_0x6053('0x36')]?_0x48e867[_0x6053('0x34')]:_0x9456eb[_0x6053('0x2f')];_0x48e867[_0x6053('0x38')]=qs[_0x6053('0x39')](_0x40e76f['query'][_0x6053('0x39')]);_0x48e867[_0x6053('0x3a')]=qs[_0x6053('0x32')](_[_0x6053('0x3b')](_0x40e76f[_0x6053('0x31')],_0x9456eb['filters']));if(_0x40e76f[_0x6053('0x31')][_0x6053('0x3c')]){_0x48e867[_0x6053('0x3a')]=_[_0x6053('0x3e')](_0x48e867[_0x6053('0x3a')],{'$or':_[_0x6053('0x2a')](_0x48e867['attributes'],function(_0x3fe338){var _0x5f10b2={};_0x5f10b2[_0x3fe338]={'$like':'%'+_0x40e76f['query']['filter']+'%'};return _0x5f10b2;})});}_0x48e867=_[_0x6053('0x3e')]({},_0x48e867,_0x40e76f[_0x6053('0x45')]);return _0x185655[_0x6053('0x4d')](_0x48e867);}})[_0x6053('0x24')](function(_0x4cd30a){if(_0x4cd30a){_0x3f13ab=_0x4cd30a['length'];if(!_0x40e76f[_0x6053('0x31')][_0x6053('0x4c')](_0x6053('0x37'))){_0x48e867[_0x6053('0x1e')]=qs[_0x6053('0x1e')](_0x40e76f[_0x6053('0x31')][_0x6053('0x1e')]);_0x48e867['offset']=qs[_0x6053('0x1c')](_0x40e76f[_0x6053('0x31')][_0x6053('0x1c')]);}return _0x185655[_0x6053('0x4d')](_0x48e867);}})['then'](function(_0x233cc5){if(_0x233cc5){return _0x233cc5?{'count':_0x3f13ab,'rows':_0x233cc5}:null;}})['then'](respondWithResult(_0xc68aa4,null))['catch'](handleError(_0xc68aa4,null));};exports[_0x6053('0x4e')]=function(_0x563c42,_0xb73603,_0xa6ea1){var _0x40eee7={};var _0x2e4548={};var _0x395bbd;var _0x3f9e04;return db[_0x6053('0x3f')][_0x6053('0x4b')]({'where':{'id':_0x563c42['params']['id']}})[_0x6053('0x24')](handleEntityNotFound(_0xb73603,null))[_0x6053('0x24')](function(_0x1b07e9){if(_0x1b07e9){_0x395bbd=_0x1b07e9;_0x2e4548[_0x6053('0x2f')]=_[_0x6053('0x30')](db[_0x6053('0x4f')][_0x6053('0x2b')]);_0x2e4548[_0x6053('0x31')]=_[_0x6053('0x30')](_0x563c42[_0x6053('0x31')]);_0x2e4548[_0x6053('0x32')]=_[_0x6053('0x33')](_0x2e4548[_0x6053('0x2f')],_0x2e4548[_0x6053('0x31')]);_0x40eee7[_0x6053('0x34')]=_[_0x6053('0x33')](_0x2e4548[_0x6053('0x2f')],qs[_0x6053('0x35')](_0x563c42['query'][_0x6053('0x35')]));_0x40eee7[_0x6053('0x34')]=_0x40eee7[_0x6053('0x34')]['length']?_0x40eee7[_0x6053('0x34')]:_0x2e4548[_0x6053('0x2f')];_0x40eee7[_0x6053('0x38')]=qs['sort'](_0x563c42[_0x6053('0x31')][_0x6053('0x39')]);_0x40eee7[_0x6053('0x3a')]=qs[_0x6053('0x32')](_[_0x6053('0x3b')](_0x563c42[_0x6053('0x31')],_0x2e4548['filters']));if(_0x563c42['query'][_0x6053('0x3c')]){_0x40eee7['where']=_[_0x6053('0x3e')](_0x40eee7['where'],{'$or':_['map'](_0x40eee7[_0x6053('0x34')],function(_0x195d40){var _0x1be956={};_0x1be956[_0x195d40]={'$like':'%'+_0x563c42['query']['filter']+'%'};return _0x1be956;})});}_0x40eee7=_[_0x6053('0x3e')]({},_0x40eee7,_0x563c42[_0x6053('0x45')]);return _0x395bbd[_0x6053('0x4e')](_0x40eee7);}})[_0x6053('0x24')](function(_0x2b0db4){if(_0x2b0db4){_0x3f9e04=_0x2b0db4[_0x6053('0x36')];if(!_0x563c42[_0x6053('0x31')][_0x6053('0x4c')](_0x6053('0x37'))){_0x40eee7['limit']=qs[_0x6053('0x1e')](_0x563c42[_0x6053('0x31')][_0x6053('0x1e')]);_0x40eee7['offset']=qs[_0x6053('0x1c')](_0x563c42['query'][_0x6053('0x1c')]);}return _0x395bbd['getDescriptions'](_0x40eee7);}})[_0x6053('0x24')](function(_0x459277){if(_0x459277){return _0x459277?{'count':_0x3f9e04,'rows':_0x459277}:null;}})['then'](respondWithResult(_0xb73603,null))[_0x6053('0x42')](handleError(_0xb73603,null));}; \ No newline at end of file +var _0x60e8=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','end','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','map','getSubjects','findOne','SugarcrmField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x1cae51,_0x1747d6){var _0x2c2e81=function(_0x58888f){while(--_0x58888f){_0x1cae51['push'](_0x1cae51['shift']());}};_0x2c2e81(++_0x1747d6);}(_0x60e8,0x12b));var _0x860e=function(_0x3574f8,_0x3e7196){_0x3574f8=_0x3574f8-0x0;var _0x4e7d29=_0x60e8[_0x3574f8];return _0x4e7d29;};'use strict';var emlformat=require(_0x860e('0x0'));var rimraf=require(_0x860e('0x1'));var zipdir=require(_0x860e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x860e('0x3'));var moment=require(_0x860e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x860e('0x5'));var util=require('util');var path=require(_0x860e('0x6'));var sox=require(_0x860e('0x7'));var csv=require('to-csv');var ejs=require(_0x860e('0x8'));var fs=require('fs');var fs_extra=require(_0x860e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x860e('0xa'));var jsforce=require(_0x860e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x860e('0xc'));var querystring=require(_0x860e('0xd'));var Papa=require(_0x860e('0xe'));var Redis=require(_0x860e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x860e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x860e('0x11'));var logger=require(_0x860e('0x12'))(_0x860e('0x13'));var utils=require('../../config/utils');var config=require(_0x860e('0x14'));var licenseUtil=require(_0x860e('0x15'));var db=require(_0x860e('0x16'))['db'];function respondWithStatusCode(_0x3ce956,_0x1525ae){_0x1525ae=_0x1525ae||0xcc;return function(_0x56b8e3){if(_0x56b8e3){return _0x3ce956[_0x860e('0x17')](_0x1525ae);}return _0x3ce956['status'](_0x1525ae)['end']();};}function respondWithResult(_0x402307,_0x4d30c9){_0x4d30c9=_0x4d30c9||0xc8;return function(_0x55bf3c){if(_0x55bf3c){return _0x402307[_0x860e('0x18')](_0x4d30c9)[_0x860e('0x19')](_0x55bf3c);}};}function respondWithFilteredResult(_0x5800e4,_0x10620e){return function(_0x3490ae){if(_0x3490ae){var _0xb00bc6=typeof _0x10620e[_0x860e('0x1a')]===_0x860e('0x1b')&&typeof _0x10620e[_0x860e('0x1c')]===_0x860e('0x1b');var _0x1b8378=_0x3490ae[_0x860e('0x1d')];var _0x33e457=_0xb00bc6?0x0:_0x10620e['offset'];var _0x58b80f=_0xb00bc6?_0x3490ae[_0x860e('0x1d')]:_0x10620e['offset']+_0x10620e[_0x860e('0x1c')];var _0x261409;if(_0x58b80f>=_0x1b8378){_0x58b80f=_0x1b8378;_0x261409=0xc8;}else{_0x261409=0xce;}_0x5800e4['status'](_0x261409);return _0x5800e4['set']('Content-Range',_0x33e457+'-'+_0x58b80f+'/'+_0x1b8378)[_0x860e('0x19')](_0x3490ae);}return null;};}function patchUpdates(_0x4ca978){return function(_0x76392d){try{jsonpatch[_0x860e('0x1e')](_0x76392d,_0x4ca978,!![]);}catch(_0xd7ed72){return BPromise[_0x860e('0x1f')](_0xd7ed72);}return _0x76392d[_0x860e('0x20')]();};}function saveUpdates(_0x354db5,_0x42a381){return function(_0xfc7569){if(_0xfc7569){return _0xfc7569[_0x860e('0x21')](_0x354db5)[_0x860e('0x22')](function(_0x2eda76){return _0x2eda76;});}return null;};}function removeEntity(_0x2b8bc7,_0x1c2ac3){return function(_0x469369){if(_0x469369){return _0x469369[_0x860e('0x23')]()['then'](function(){_0x2b8bc7[_0x860e('0x18')](0xcc)[_0x860e('0x24')]();});}};}function handleEntityNotFound(_0x20ce47,_0x57464c){return function(_0xec27c7){if(!_0xec27c7){_0x20ce47[_0x860e('0x17')](0x194);}return _0xec27c7;};}function handleError(_0x386fee,_0x223e07){_0x223e07=_0x223e07||0x1f4;return function(_0x235f64){logger['error'](_0x235f64[_0x860e('0x25')]);if(_0x235f64[_0x860e('0x26')]){delete _0x235f64[_0x860e('0x26')];}_0x386fee[_0x860e('0x18')](_0x223e07)['send'](_0x235f64);};}exports[_0x860e('0x27')]=function(_0x1e7d66,_0x119d9c){var _0x192d5a={},_0x15f098={},_0x14631f={'count':0x0,'rows':[]};var _0x55ccff=_['map'](db['SugarcrmConfiguration'][_0x860e('0x28')],function(_0x254087){return{'name':_0x254087[_0x860e('0x29')],'type':_0x254087[_0x860e('0x2a')][_0x860e('0x2b')]};});_0x15f098[_0x860e('0x2c')]=_['map'](_0x55ccff,_0x860e('0x26'));_0x15f098[_0x860e('0x2d')]=_[_0x860e('0x2e')](_0x1e7d66[_0x860e('0x2d')]);_0x15f098[_0x860e('0x2f')]=_[_0x860e('0x30')](_0x15f098[_0x860e('0x2c')],_0x15f098['query']);_0x192d5a['attributes']=_[_0x860e('0x30')](_0x15f098[_0x860e('0x2c')],qs[_0x860e('0x31')](_0x1e7d66['query']['fields']));_0x192d5a[_0x860e('0x32')]=_0x192d5a[_0x860e('0x32')][_0x860e('0x33')]?_0x192d5a[_0x860e('0x32')]:_0x15f098['model'];if(!_0x1e7d66['query'][_0x860e('0x34')](_0x860e('0x35'))){_0x192d5a[_0x860e('0x1c')]=qs['limit'](_0x1e7d66[_0x860e('0x2d')][_0x860e('0x1c')]);_0x192d5a['offset']=qs[_0x860e('0x1a')](_0x1e7d66[_0x860e('0x2d')][_0x860e('0x1a')]);}_0x192d5a[_0x860e('0x36')]=qs[_0x860e('0x37')](_0x1e7d66['query'][_0x860e('0x37')]);_0x192d5a[_0x860e('0x38')]=qs['filters'](_[_0x860e('0x39')](_0x1e7d66[_0x860e('0x2d')],_0x15f098[_0x860e('0x2f')]),_0x55ccff);if(_0x1e7d66[_0x860e('0x2d')][_0x860e('0x3a')]){_0x192d5a[_0x860e('0x38')]=_[_0x860e('0x3b')](_0x192d5a['where'],{'$or':_['map'](_0x55ccff,function(_0x9389b3){if(_0x9389b3[_0x860e('0x2a')]!==_0x860e('0x3c')){var _0x103369={};_0x103369[_0x9389b3[_0x860e('0x26')]]={'$like':'%'+_0x1e7d66[_0x860e('0x2d')][_0x860e('0x3a')]+'%'};return _0x103369;}})});}_0x192d5a=_['merge']({},_0x192d5a,_0x1e7d66[_0x860e('0x3d')]);var _0x32a794={'where':_0x192d5a['where']};return db[_0x860e('0x3e')][_0x860e('0x1d')](_0x32a794)[_0x860e('0x22')](function(_0x2bf5f4){_0x14631f[_0x860e('0x1d')]=_0x2bf5f4;if(_0x1e7d66[_0x860e('0x2d')][_0x860e('0x3f')]){_0x192d5a[_0x860e('0x40')]=[{'all':!![]}];}return db[_0x860e('0x3e')][_0x860e('0x41')](_0x192d5a);})[_0x860e('0x22')](function(_0x3e1372){_0x14631f[_0x860e('0x42')]=_0x3e1372;return _0x14631f;})[_0x860e('0x22')](respondWithFilteredResult(_0x119d9c,_0x192d5a))[_0x860e('0x43')](handleError(_0x119d9c,null));};exports[_0x860e('0x44')]=function(_0x5b68fa,_0x1c46c1){var _0x43ccb4={'raw':![],'where':{'id':_0x5b68fa[_0x860e('0x45')]['id']}},_0x2b0407={};_0x2b0407[_0x860e('0x2c')]=_['keys'](db[_0x860e('0x3e')][_0x860e('0x28')]);_0x2b0407[_0x860e('0x2d')]=_['keys'](_0x5b68fa[_0x860e('0x2d')]);_0x2b0407['filters']=_[_0x860e('0x30')](_0x2b0407['model'],_0x2b0407[_0x860e('0x2d')]);_0x43ccb4[_0x860e('0x32')]=_[_0x860e('0x30')](_0x2b0407[_0x860e('0x2c')],qs[_0x860e('0x31')](_0x5b68fa[_0x860e('0x2d')]['fields']));_0x43ccb4[_0x860e('0x32')]=_0x43ccb4[_0x860e('0x32')][_0x860e('0x33')]?_0x43ccb4[_0x860e('0x32')]:_0x2b0407['model'];if(_0x5b68fa[_0x860e('0x2d')]['includeAll']){_0x43ccb4[_0x860e('0x40')]=[{'all':!![]}];}_0x43ccb4=_[_0x860e('0x3b')]({},_0x43ccb4,_0x5b68fa[_0x860e('0x3d')]);return db[_0x860e('0x3e')][_0x860e('0x46')](_0x43ccb4)[_0x860e('0x22')](handleEntityNotFound(_0x1c46c1,null))[_0x860e('0x22')](respondWithResult(_0x1c46c1,null))['catch'](handleError(_0x1c46c1,null));};exports[_0x860e('0x47')]=function(_0x2328d3,_0x50779d){return db['SugarcrmConfiguration'][_0x860e('0x47')](_0x2328d3['body'],{})[_0x860e('0x22')](respondWithResult(_0x50779d,0xc9))[_0x860e('0x43')](handleError(_0x50779d,null));};exports['update']=function(_0x411c91,_0x157c34){if(_0x411c91[_0x860e('0x48')]['id']){delete _0x411c91[_0x860e('0x48')]['id'];}return db[_0x860e('0x3e')][_0x860e('0x46')]({'where':{'id':_0x411c91[_0x860e('0x45')]['id']}})[_0x860e('0x22')](handleEntityNotFound(_0x157c34,null))['then'](saveUpdates(_0x411c91[_0x860e('0x48')],null))[_0x860e('0x22')](respondWithResult(_0x157c34,null))[_0x860e('0x43')](handleError(_0x157c34,null));};exports[_0x860e('0x23')]=function(_0x20ed9f,_0x28c358){return db[_0x860e('0x3e')]['find']({'where':{'id':_0x20ed9f[_0x860e('0x45')]['id']}})[_0x860e('0x22')](handleEntityNotFound(_0x28c358,null))[_0x860e('0x22')](removeEntity(_0x28c358,null))[_0x860e('0x43')](handleError(_0x28c358,null));};exports[_0x860e('0x49')]=function(_0x526f79,_0x570f05,_0x5b00df){var _0x5934b0={};var _0x588b4d={};var _0xd4849f;var _0x4bb4bf;return db[_0x860e('0x3e')]['findOne']({'where':{'id':_0x526f79[_0x860e('0x45')]['id']}})[_0x860e('0x22')](handleEntityNotFound(_0x570f05,null))['then'](function(_0x163c2c){if(_0x163c2c){_0xd4849f=_0x163c2c;_0x588b4d[_0x860e('0x2c')]=_['keys'](db['SugarcrmField'][_0x860e('0x28')]);_0x588b4d[_0x860e('0x2d')]=_['keys'](_0x526f79[_0x860e('0x2d')]);_0x588b4d[_0x860e('0x2f')]=_[_0x860e('0x30')](_0x588b4d[_0x860e('0x2c')],_0x588b4d['query']);_0x5934b0[_0x860e('0x32')]=_['intersection'](_0x588b4d[_0x860e('0x2c')],qs[_0x860e('0x31')](_0x526f79['query'][_0x860e('0x31')]));_0x5934b0[_0x860e('0x32')]=_0x5934b0[_0x860e('0x32')][_0x860e('0x33')]?_0x5934b0[_0x860e('0x32')]:_0x588b4d['model'];_0x5934b0[_0x860e('0x36')]=qs[_0x860e('0x37')](_0x526f79[_0x860e('0x2d')][_0x860e('0x37')]);_0x5934b0['where']=qs[_0x860e('0x2f')](_['pick'](_0x526f79[_0x860e('0x2d')],_0x588b4d['filters']));if(_0x526f79[_0x860e('0x2d')][_0x860e('0x3a')]){_0x5934b0['where']=_[_0x860e('0x3b')](_0x5934b0[_0x860e('0x38')],{'$or':_[_0x860e('0x4a')](_0x5934b0['attributes'],function(_0x19a879){var _0x45fa16={};_0x45fa16[_0x19a879]={'$like':'%'+_0x526f79[_0x860e('0x2d')][_0x860e('0x3a')]+'%'};return _0x45fa16;})});}_0x5934b0=_[_0x860e('0x3b')]({},_0x5934b0,_0x526f79[_0x860e('0x3d')]);return _0xd4849f[_0x860e('0x49')](_0x5934b0);}})[_0x860e('0x22')](function(_0x58647c){if(_0x58647c){_0x4bb4bf=_0x58647c[_0x860e('0x33')];if(!_0x526f79[_0x860e('0x2d')][_0x860e('0x34')](_0x860e('0x35'))){_0x5934b0[_0x860e('0x1c')]=qs[_0x860e('0x1c')](_0x526f79[_0x860e('0x2d')][_0x860e('0x1c')]);_0x5934b0['offset']=qs[_0x860e('0x1a')](_0x526f79[_0x860e('0x2d')]['offset']);}return _0xd4849f[_0x860e('0x49')](_0x5934b0);}})[_0x860e('0x22')](function(_0x2c0a71){if(_0x2c0a71){return _0x2c0a71?{'count':_0x4bb4bf,'rows':_0x2c0a71}:null;}})[_0x860e('0x22')](respondWithResult(_0x570f05,null))[_0x860e('0x43')](handleError(_0x570f05,null));};exports[_0x860e('0x4b')]=function(_0x1705df,_0x29a007,_0x547654){var _0x1187e0={};var _0x3e35af={};var _0x32dcef;var _0x3ca91c;return db[_0x860e('0x3e')][_0x860e('0x4c')]({'where':{'id':_0x1705df[_0x860e('0x45')]['id']}})[_0x860e('0x22')](handleEntityNotFound(_0x29a007,null))[_0x860e('0x22')](function(_0x38ddf3){if(_0x38ddf3){_0x32dcef=_0x38ddf3;_0x3e35af[_0x860e('0x2c')]=_['keys'](db[_0x860e('0x4d')]['rawAttributes']);_0x3e35af['query']=_['keys'](_0x1705df[_0x860e('0x2d')]);_0x3e35af['filters']=_[_0x860e('0x30')](_0x3e35af[_0x860e('0x2c')],_0x3e35af[_0x860e('0x2d')]);_0x1187e0[_0x860e('0x32')]=_[_0x860e('0x30')](_0x3e35af[_0x860e('0x2c')],qs[_0x860e('0x31')](_0x1705df['query'][_0x860e('0x31')]));_0x1187e0[_0x860e('0x32')]=_0x1187e0[_0x860e('0x32')][_0x860e('0x33')]?_0x1187e0[_0x860e('0x32')]:_0x3e35af[_0x860e('0x2c')];_0x1187e0[_0x860e('0x36')]=qs[_0x860e('0x37')](_0x1705df[_0x860e('0x2d')][_0x860e('0x37')]);_0x1187e0[_0x860e('0x38')]=qs['filters'](_['pick'](_0x1705df['query'],_0x3e35af[_0x860e('0x2f')]));if(_0x1705df[_0x860e('0x2d')][_0x860e('0x3a')]){_0x1187e0[_0x860e('0x38')]=_[_0x860e('0x3b')](_0x1187e0['where'],{'$or':_[_0x860e('0x4a')](_0x1187e0[_0x860e('0x32')],function(_0x3aad7a){var _0x2f0bcf={};_0x2f0bcf[_0x3aad7a]={'$like':'%'+_0x1705df[_0x860e('0x2d')][_0x860e('0x3a')]+'%'};return _0x2f0bcf;})});}_0x1187e0=_[_0x860e('0x3b')]({},_0x1187e0,_0x1705df[_0x860e('0x3d')]);return _0x32dcef[_0x860e('0x4b')](_0x1187e0);}})[_0x860e('0x22')](function(_0x4dba92){if(_0x4dba92){_0x3ca91c=_0x4dba92[_0x860e('0x33')];if(!_0x1705df[_0x860e('0x2d')][_0x860e('0x34')](_0x860e('0x35'))){_0x1187e0['limit']=qs[_0x860e('0x1c')](_0x1705df[_0x860e('0x2d')]['limit']);_0x1187e0[_0x860e('0x1a')]=qs[_0x860e('0x1a')](_0x1705df[_0x860e('0x2d')]['offset']);}return _0x32dcef[_0x860e('0x4b')](_0x1187e0);}})['then'](function(_0x2b6f71){if(_0x2b6f71){return _0x2b6f71?{'count':_0x3ca91c,'rows':_0x2b6f71}:null;}})[_0x860e('0x22')](respondWithResult(_0x29a007,null))[_0x860e('0x43')](handleError(_0x29a007,null));};exports[_0x860e('0x4e')]=function(_0x15ded8,_0xff7c2e,_0x81a9aa){var _0x18432b={};var _0x14740e={};var _0xc65e4e;var _0x5d184a;return db[_0x860e('0x3e')][_0x860e('0x4c')]({'where':{'id':_0x15ded8['params']['id']}})['then'](handleEntityNotFound(_0xff7c2e,null))['then'](function(_0x42469f){if(_0x42469f){_0xc65e4e=_0x42469f;_0x14740e[_0x860e('0x2c')]=_['keys'](db[_0x860e('0x4d')][_0x860e('0x28')]);_0x14740e[_0x860e('0x2d')]=_['keys'](_0x15ded8[_0x860e('0x2d')]);_0x14740e[_0x860e('0x2f')]=_[_0x860e('0x30')](_0x14740e[_0x860e('0x2c')],_0x14740e[_0x860e('0x2d')]);_0x18432b[_0x860e('0x32')]=_[_0x860e('0x30')](_0x14740e[_0x860e('0x2c')],qs[_0x860e('0x31')](_0x15ded8[_0x860e('0x2d')][_0x860e('0x31')]));_0x18432b[_0x860e('0x32')]=_0x18432b[_0x860e('0x32')][_0x860e('0x33')]?_0x18432b[_0x860e('0x32')]:_0x14740e[_0x860e('0x2c')];_0x18432b[_0x860e('0x36')]=qs[_0x860e('0x37')](_0x15ded8[_0x860e('0x2d')][_0x860e('0x37')]);_0x18432b[_0x860e('0x38')]=qs[_0x860e('0x2f')](_[_0x860e('0x39')](_0x15ded8[_0x860e('0x2d')],_0x14740e['filters']));if(_0x15ded8[_0x860e('0x2d')]['filter']){_0x18432b[_0x860e('0x38')]=_[_0x860e('0x3b')](_0x18432b[_0x860e('0x38')],{'$or':_[_0x860e('0x4a')](_0x18432b[_0x860e('0x32')],function(_0x20dd82){var _0x4d13f1={};_0x4d13f1[_0x20dd82]={'$like':'%'+_0x15ded8[_0x860e('0x2d')][_0x860e('0x3a')]+'%'};return _0x4d13f1;})});}_0x18432b=_['merge']({},_0x18432b,_0x15ded8[_0x860e('0x3d')]);return _0xc65e4e[_0x860e('0x4e')](_0x18432b);}})['then'](function(_0x32a303){if(_0x32a303){_0x5d184a=_0x32a303[_0x860e('0x33')];if(!_0x15ded8['query'][_0x860e('0x34')](_0x860e('0x35'))){_0x18432b[_0x860e('0x1c')]=qs[_0x860e('0x1c')](_0x15ded8[_0x860e('0x2d')][_0x860e('0x1c')]);_0x18432b[_0x860e('0x1a')]=qs['offset'](_0x15ded8['query'][_0x860e('0x1a')]);}return _0xc65e4e['getDescriptions'](_0x18432b);}})[_0x860e('0x22')](function(_0x30d244){if(_0x30d244){return _0x30d244?{'count':_0x5d184a,'rows':_0x30d244}:null;}})['then'](respondWithResult(_0xff7c2e,null))[_0x860e('0x43')](handleError(_0xff7c2e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index d7d96d3..b3bd4ea 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 _0x183f=['int_sugarcrm_configurations','lodash','util','api','moment','bluebird','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x183f,0x1ed));var _0xf183=function(_0x2d2a48,_0x24e6ac){_0x2d2a48=_0x2d2a48-0x0;var _0x41836e=_0x183f[_0x2d2a48];return _0x41836e;};'use strict';var _=require(_0xf183('0x0'));var util=require(_0xf183('0x1'));var logger=require('../../config/logger')(_0xf183('0x2'));var moment=require(_0xf183('0x3'));var BPromise=require(_0xf183('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf183('0x5'));var rimraf=require('rimraf');var config=require(_0xf183('0x6'));var attributes=require(_0xf183('0x7'));module[_0xf183('0x8')]=function(_0x288ee5,_0x49f21c){return _0x288ee5[_0xf183('0x9')](_0xf183('0xa'),attributes,{'tableName':_0xf183('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf10c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x4fee0b,_0x3f7bba){var _0x2dffe8=function(_0x23002d){while(--_0x23002d){_0x4fee0b['push'](_0x4fee0b['shift']());}};_0x2dffe8(++_0x3f7bba);}(_0xf10c,0x1a3));var _0xcf10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf10c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf10('0x0'));var util=require(_0xcf10('0x1'));var logger=require(_0xcf10('0x2'))(_0xcf10('0x3'));var moment=require(_0xcf10('0x4'));var BPromise=require(_0xcf10('0x5'));var rp=require(_0xcf10('0x6'));var fs=require('fs');var path=require(_0xcf10('0x7'));var rimraf=require(_0xcf10('0x8'));var config=require('../../config/environment');var attributes=require(_0xcf10('0x9'));module[_0xcf10('0xa')]=function(_0x1b6c74,_0x229862){return _0x1b6c74[_0xcf10('0xb')](_0xcf10('0xc'),attributes,{'tableName':_0xcf10('0xd'),'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 8322a54..27a0d2c 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 _0xfdd1=['stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x1bcfff,_0x3ccb9b){var _0x5e74f5=function(_0x289945){while(--_0x289945){_0x1bcfff['push'](_0x1bcfff['shift']());}};_0x5e74f5(++_0x3ccb9b);}(_0xfdd1,0x1cf));var _0x1fdd=function(_0x595c4e,_0x444249){_0x595c4e=_0x595c4e-0x0;var _0x1e224c=_0xfdd1[_0x595c4e];return _0x1e224c;};'use strict';var _=require(_0x1fdd('0x0'));var util=require(_0x1fdd('0x1'));var moment=require('moment');var BPromise=require(_0x1fdd('0x2'));var rs=require(_0x1fdd('0x3'));var fs=require('fs');var Redis=require(_0x1fdd('0x4'));var db=require(_0x1fdd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fdd('0x6'))(_0x1fdd('0x7'));var config=require(_0x1fdd('0x8'));var jayson=require(_0x1fdd('0x9'));var client=jayson[_0x1fdd('0xa')][_0x1fdd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf1a200,_0x580438,_0x35bb59){return new BPromise(function(_0x364352,_0x5c58f3){return client[_0x1fdd('0xc')](_0xf1a200,_0x35bb59)['then'](function(_0x1ddda4){logger[_0x1fdd('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x580438,_0x1fdd('0xe'));logger[_0x1fdd('0xf')](_0x1fdd('0x10'),_0x580438,_0x1fdd('0xe'),JSON[_0x1fdd('0x11')](_0x1ddda4));if(_0x1ddda4[_0x1fdd('0x12')]){if(_0x1ddda4[_0x1fdd('0x12')][_0x1fdd('0x13')]===0x1f4){logger['error'](_0x1fdd('0x14'),_0x580438,_0x1ddda4[_0x1fdd('0x12')][_0x1fdd('0x15')]);return _0x5c58f3(_0x1ddda4[_0x1fdd('0x12')][_0x1fdd('0x15')]);}logger[_0x1fdd('0x12')](_0x1fdd('0x14'),_0x580438,_0x1ddda4[_0x1fdd('0x12')][_0x1fdd('0x15')]);return _0x364352(_0x1ddda4[_0x1fdd('0x12')][_0x1fdd('0x15')]);}else{logger[_0x1fdd('0xd')](_0x1fdd('0x14'),_0x580438,_0x1fdd('0xe'));_0x364352(_0x1ddda4[_0x1fdd('0x16')]['message']);}})[_0x1fdd('0x17')](function(_0x4cf43a){logger[_0x1fdd('0x12')](_0x1fdd('0x14'),_0x580438,_0x4cf43a);_0x5c58f3(_0x4cf43a);});});} \ No newline at end of file +var _0xb763=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb763,0xcf));var _0x3b76=function(_0x34efe0,_0x152723){_0x34efe0=_0x34efe0-0x0;var _0x30e933=_0xb763[_0x34efe0];return _0x30e933;};'use strict';var _=require(_0x3b76('0x0'));var util=require(_0x3b76('0x1'));var moment=require('moment');var BPromise=require(_0x3b76('0x2'));var rs=require(_0x3b76('0x3'));var fs=require('fs');var Redis=require(_0x3b76('0x4'));var db=require(_0x3b76('0x5'))['db'];var utils=require(_0x3b76('0x6'));var logger=require(_0x3b76('0x7'))(_0x3b76('0x8'));var config=require(_0x3b76('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3b76('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a306a,_0x3bd71d,_0x42fa28){return new BPromise(function(_0x513e38,_0x5107ed){return client[_0x3b76('0xb')](_0x2a306a,_0x42fa28)[_0x3b76('0xc')](function(_0x2d2897){logger[_0x3b76('0xd')](_0x3b76('0xe'),_0x3bd71d,_0x3b76('0xf'));logger[_0x3b76('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3bd71d,'request\x20sent',JSON[_0x3b76('0x11')](_0x2d2897));if(_0x2d2897['error']){if(_0x2d2897[_0x3b76('0x12')][_0x3b76('0x13')]===0x1f4){logger['error'](_0x3b76('0xe'),_0x3bd71d,_0x2d2897[_0x3b76('0x12')][_0x3b76('0x14')]);return _0x5107ed(_0x2d2897[_0x3b76('0x12')][_0x3b76('0x14')]);}logger[_0x3b76('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3bd71d,_0x2d2897['error'][_0x3b76('0x14')]);return _0x513e38(_0x2d2897['error'][_0x3b76('0x14')]);}else{logger[_0x3b76('0xd')](_0x3b76('0xe'),_0x3bd71d,_0x3b76('0xf'));_0x513e38(_0x2d2897[_0x3b76('0x15')][_0x3b76('0x14')]);}})[_0x3b76('0x16')](function(_0x59c33d){logger[_0x3b76('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3bd71d,_0x59c33d);_0x5107ed(_0x59c33d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index b1d0e11..d2f8152 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 _0x5bbd=['post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x17ec07,_0xe3ca90){var _0x5a6c45=function(_0x59b715){while(--_0x59b715){_0x17ec07['push'](_0x17ec07['shift']());}};_0x5a6c45(++_0xe3ca90);}(_0x5bbd,0x6b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd5bb('0x0'));var util=require(_0xd5bb('0x1'));var path=require(_0xd5bb('0x2'));var timeout=require('connect-timeout');var express=require(_0xd5bb('0x3'));var router=express[_0xd5bb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd5bb('0x5'));var interaction=require(_0xd5bb('0x6'));var config=require('../../config/environment');var controller=require(_0xd5bb('0x7'));router[_0xd5bb('0x8')]('/',auth[_0xd5bb('0x9')](),controller[_0xd5bb('0xa')]);router[_0xd5bb('0x8')](_0xd5bb('0xb'),auth['isAuthenticated'](),controller[_0xd5bb('0xc')]);router[_0xd5bb('0xd')]('/',auth['isAuthenticated'](),controller[_0xd5bb('0xe')]);router[_0xd5bb('0xf')](_0xd5bb('0xb'),auth['isAuthenticated'](),controller[_0xd5bb('0x10')]);router[_0xd5bb('0x11')]('/:id',auth[_0xd5bb('0x9')](),controller[_0xd5bb('0x12')]);module[_0xd5bb('0x13')]=router; \ No newline at end of file +var _0xbba0=['index','get','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbba0,0x104));var _0x0bba=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xbba0[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x0bba('0x0'));var util=require(_0x0bba('0x1'));var path=require(_0x0bba('0x2'));var timeout=require(_0x0bba('0x3'));var express=require(_0x0bba('0x4'));var router=express[_0x0bba('0x5')]();var fs_extra=require(_0x0bba('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0bba('0x7'));var config=require('../../config/environment');var controller=require(_0x0bba('0x8'));router['get']('/',auth[_0x0bba('0x9')](),controller[_0x0bba('0xa')]);router[_0x0bba('0xb')](_0x0bba('0xc'),auth[_0x0bba('0x9')](),controller[_0x0bba('0xd')]);router[_0x0bba('0xe')]('/',auth[_0x0bba('0x9')](),controller['create']);router[_0x0bba('0xf')](_0x0bba('0xc'),auth[_0x0bba('0x9')](),controller[_0x0bba('0x10')]);router['delete'](_0x0bba('0xc'),auth[_0x0bba('0x9')](),controller[_0x0bba('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 674eca4..3378ce3 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 _0xa1ab=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x13f05d,_0x18e8a3){var _0x1383b4=function(_0x175fd4){while(--_0x175fd4){_0x13f05d['push'](_0x13f05d['shift']());}};_0x1383b4(++_0x18e8a3);}(_0xa1ab,0xb2));var _0xba1a=function(_0x1e3211,_0x3d6096){_0x1e3211=_0x1e3211-0x0;var _0x7da801=_0xa1ab[_0x1e3211];return _0x7da801;};'use strict';var Sequelize=require('sequelize');module[_0xba1a('0x0')]={'type':{'type':Sequelize[_0xba1a('0x1')](_0xba1a('0x2'),_0xba1a('0x3'),_0xba1a('0x4'),_0xba1a('0x5'),_0xba1a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xba1a('0x7')]},'key':{'type':Sequelize[_0xba1a('0x7')]},'keyType':{'type':Sequelize[_0xba1a('0x1')](_0xba1a('0x2'),_0xba1a('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xba1a('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xba1a('0x7')]},'customField':{'type':Sequelize[_0xba1a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba1a('0x7')]}}; \ No newline at end of file +var _0x9b05=['STRING','sequelize','ENUM','variable','keyValue','string','customVariable'];(function(_0xeae324,_0x464ee2){var _0x5c98e4=function(_0x5b05b2){while(--_0x5b05b2){_0xeae324['push'](_0xeae324['shift']());}};_0x5c98e4(++_0x464ee2);}(_0x9b05,0x13c));var _0x59b0=function(_0x2d3d18,_0x475f4c){_0x2d3d18=_0x2d3d18-0x0;var _0x202f49=_0x9b05[_0x2d3d18];return _0x202f49;};'use strict';var Sequelize=require(_0x59b0('0x0'));module['exports']={'type':{'type':Sequelize[_0x59b0('0x1')]('string',_0x59b0('0x2'),'customVariable',_0x59b0('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x59b0('0x4'),_0x59b0('0x2'),_0x59b0('0x5'))},'keyContent':{'type':Sequelize[_0x59b0('0x6')]},'idField':{'type':Sequelize[_0x59b0('0x6')]},'nameField':{'type':Sequelize[_0x59b0('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 0cdd64b..f0e2ea3 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 _0x6419=['options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','keys','filters','intersection','model','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','params','include'];(function(_0x171fb2,_0x3a16c1){var _0x1ff082=function(_0xa8ad13){while(--_0xa8ad13){_0x171fb2['push'](_0x171fb2['shift']());}};_0x1ff082(++_0x3a16c1);}(_0x6419,0x99));var _0x9641=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6419[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9641('0x0'));var zipdir=require(_0x9641('0x1'));var jsonpatch=require(_0x9641('0x2'));var rp=require('request-promise');var moment=require(_0x9641('0x3'));var BPromise=require(_0x9641('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9641('0x5'));var sox=require(_0x9641('0x6'));var csv=require(_0x9641('0x7'));var ejs=require(_0x9641('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9641('0x9'));var squel=require(_0x9641('0xa'));var crypto=require(_0x9641('0xb'));var jsforce=require(_0x9641('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9641('0xd'));var Papa=require(_0x9641('0xe'));var Redis=require('ioredis');var authService=require(_0x9641('0xf'));var qs=require(_0x9641('0x10'));var as=require(_0x9641('0x11'));var hardwareService=require(_0x9641('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9641('0x13'));var config=require(_0x9641('0x14'));var licenseUtil=require(_0x9641('0x15'));var db=require(_0x9641('0x16'))['db'];function respondWithStatusCode(_0x2ed355,_0x39bfeb){_0x39bfeb=_0x39bfeb||0xcc;return function(_0x1e3fb1){if(_0x1e3fb1){return _0x2ed355[_0x9641('0x17')](_0x39bfeb);}return _0x2ed355[_0x9641('0x18')](_0x39bfeb)[_0x9641('0x19')]();};}function respondWithResult(_0x22f0a5,_0x2a7bbd){_0x2a7bbd=_0x2a7bbd||0xc8;return function(_0x45b7e){if(_0x45b7e){return _0x22f0a5['status'](_0x2a7bbd)[_0x9641('0x1a')](_0x45b7e);}};}function respondWithFilteredResult(_0x51e51e,_0x5e3c94){return function(_0x51cbcd){if(_0x51cbcd){var _0x5b93a8=typeof _0x5e3c94['offset']===_0x9641('0x1b')&&typeof _0x5e3c94[_0x9641('0x1c')]===_0x9641('0x1b');var _0x2a1275=_0x51cbcd[_0x9641('0x1d')];var _0x3a91fa=_0x5b93a8?0x0:_0x5e3c94[_0x9641('0x1e')];var _0x2277e8=_0x5b93a8?_0x51cbcd[_0x9641('0x1d')]:_0x5e3c94['offset']+_0x5e3c94[_0x9641('0x1c')];var _0x3dcd82;if(_0x2277e8>=_0x2a1275){_0x2277e8=_0x2a1275;_0x3dcd82=0xc8;}else{_0x3dcd82=0xce;}_0x51e51e[_0x9641('0x18')](_0x3dcd82);return _0x51e51e[_0x9641('0x1f')]('Content-Range',_0x3a91fa+'-'+_0x2277e8+'/'+_0x2a1275)[_0x9641('0x1a')](_0x51cbcd);}return null;};}function patchUpdates(_0x3b41e5){return function(_0x41af93){try{jsonpatch[_0x9641('0x20')](_0x41af93,_0x3b41e5,!![]);}catch(_0x32b970){return BPromise[_0x9641('0x21')](_0x32b970);}return _0x41af93['save']();};}function saveUpdates(_0x51374f,_0x125391){return function(_0xd53e58){if(_0xd53e58){return _0xd53e58[_0x9641('0x22')](_0x51374f)[_0x9641('0x23')](function(_0x2926f3){return _0x2926f3;});}return null;};}function removeEntity(_0x24734e,_0x5af277){return function(_0x2774fb){if(_0x2774fb){return _0x2774fb[_0x9641('0x24')]()[_0x9641('0x23')](function(){_0x24734e[_0x9641('0x18')](0xcc)[_0x9641('0x19')]();});}};}function handleEntityNotFound(_0xa20c1c,_0x5427e5){return function(_0x2d39a6){if(!_0x2d39a6){_0xa20c1c[_0x9641('0x17')](0x194);}return _0x2d39a6;};}function handleError(_0x3f6587,_0x2bc31a){_0x2bc31a=_0x2bc31a||0x1f4;return function(_0x6c6156){logger[_0x9641('0x25')](_0x6c6156[_0x9641('0x26')]);if(_0x6c6156[_0x9641('0x27')]){delete _0x6c6156[_0x9641('0x27')];}_0x3f6587[_0x9641('0x18')](_0x2bc31a)[_0x9641('0x28')](_0x6c6156);};}exports['index']=function(_0x4a6d33,_0x5c60ef){var _0x4bc7b8={},_0xc50a5d={},_0x4a8166={'count':0x0,'rows':[]};var _0x31d709=_[_0x9641('0x29')](db[_0x9641('0x2a')][_0x9641('0x2b')],function(_0x31e710){return{'name':_0x31e710[_0x9641('0x2c')],'type':_0x31e710[_0x9641('0x2d')][_0x9641('0x2e')]};});_0xc50a5d['model']=_[_0x9641('0x29')](_0x31d709,_0x9641('0x27'));_0xc50a5d['query']=_[_0x9641('0x2f')](_0x4a6d33['query']);_0xc50a5d[_0x9641('0x30')]=_[_0x9641('0x31')](_0xc50a5d[_0x9641('0x32')],_0xc50a5d['query']);_0x4bc7b8['attributes']=_[_0x9641('0x31')](_0xc50a5d[_0x9641('0x32')],qs[_0x9641('0x33')](_0x4a6d33[_0x9641('0x34')][_0x9641('0x33')]));_0x4bc7b8[_0x9641('0x35')]=_0x4bc7b8['attributes'][_0x9641('0x36')]?_0x4bc7b8[_0x9641('0x35')]:_0xc50a5d['model'];if(!_0x4a6d33['query'][_0x9641('0x37')](_0x9641('0x38'))){_0x4bc7b8[_0x9641('0x1c')]=qs['limit'](_0x4a6d33[_0x9641('0x34')][_0x9641('0x1c')]);_0x4bc7b8[_0x9641('0x1e')]=qs[_0x9641('0x1e')](_0x4a6d33[_0x9641('0x34')]['offset']);}_0x4bc7b8[_0x9641('0x39')]=qs[_0x9641('0x3a')](_0x4a6d33[_0x9641('0x34')][_0x9641('0x3a')]);_0x4bc7b8[_0x9641('0x3b')]=qs['filters'](_[_0x9641('0x3c')](_0x4a6d33[_0x9641('0x34')],_0xc50a5d[_0x9641('0x30')]),_0x31d709);if(_0x4a6d33[_0x9641('0x34')][_0x9641('0x3d')]){_0x4bc7b8[_0x9641('0x3b')]=_['merge'](_0x4bc7b8[_0x9641('0x3b')],{'$or':_[_0x9641('0x29')](_0x31d709,function(_0x9769b7){if(_0x9769b7[_0x9641('0x2d')]!==_0x9641('0x3e')){var _0x35cf63={};_0x35cf63[_0x9769b7[_0x9641('0x27')]]={'$like':'%'+_0x4a6d33[_0x9641('0x34')][_0x9641('0x3d')]+'%'};return _0x35cf63;}})});}_0x4bc7b8=_[_0x9641('0x3f')]({},_0x4bc7b8,_0x4a6d33['options']);var _0x2d837f={'where':_0x4bc7b8[_0x9641('0x3b')]};return db['SugarcrmField'][_0x9641('0x1d')](_0x2d837f)[_0x9641('0x23')](function(_0x501bf4){_0x4a8166[_0x9641('0x1d')]=_0x501bf4;if(_0x4a6d33[_0x9641('0x34')][_0x9641('0x40')]){_0x4bc7b8['include']=[{'all':!![]}];}return db[_0x9641('0x2a')][_0x9641('0x41')](_0x4bc7b8);})['then'](function(_0x2052c8){_0x4a8166[_0x9641('0x42')]=_0x2052c8;return _0x4a8166;})['then'](respondWithFilteredResult(_0x5c60ef,_0x4bc7b8))['catch'](handleError(_0x5c60ef,null));};exports['show']=function(_0xf227d9,_0x1ace82){var _0x21ca7c={'raw':!![],'where':{'id':_0xf227d9[_0x9641('0x43')]['id']}},_0x278bab={};_0x278bab['model']=_['keys'](db[_0x9641('0x2a')][_0x9641('0x2b')]);_0x278bab[_0x9641('0x34')]=_['keys'](_0xf227d9[_0x9641('0x34')]);_0x278bab[_0x9641('0x30')]=_[_0x9641('0x31')](_0x278bab[_0x9641('0x32')],_0x278bab[_0x9641('0x34')]);_0x21ca7c[_0x9641('0x35')]=_[_0x9641('0x31')](_0x278bab['model'],qs['fields'](_0xf227d9[_0x9641('0x34')][_0x9641('0x33')]));_0x21ca7c[_0x9641('0x35')]=_0x21ca7c[_0x9641('0x35')]['length']?_0x21ca7c[_0x9641('0x35')]:_0x278bab[_0x9641('0x32')];if(_0xf227d9[_0x9641('0x34')][_0x9641('0x40')]){_0x21ca7c[_0x9641('0x44')]=[{'all':!![]}];}_0x21ca7c=_['merge']({},_0x21ca7c,_0xf227d9[_0x9641('0x45')]);return db[_0x9641('0x2a')][_0x9641('0x46')](_0x21ca7c)['then'](handleEntityNotFound(_0x1ace82,null))[_0x9641('0x23')](respondWithResult(_0x1ace82,null))[_0x9641('0x47')](handleError(_0x1ace82,null));};exports[_0x9641('0x48')]=function(_0x2ac20f,_0x5860ac){return db[_0x9641('0x2a')][_0x9641('0x48')](_0x2ac20f[_0x9641('0x49')],{})['then'](respondWithResult(_0x5860ac,0xc9))['catch'](handleError(_0x5860ac,null));};exports[_0x9641('0x22')]=function(_0x42a120,_0x32a7bd){if(_0x42a120['body']['id']){delete _0x42a120[_0x9641('0x49')]['id'];}return db[_0x9641('0x2a')][_0x9641('0x46')]({'where':{'id':_0x42a120[_0x9641('0x43')]['id']}})[_0x9641('0x23')](handleEntityNotFound(_0x32a7bd,null))['then'](saveUpdates(_0x42a120['body'],null))['then'](respondWithResult(_0x32a7bd,null))[_0x9641('0x47')](handleError(_0x32a7bd,null));};exports[_0x9641('0x24')]=function(_0x49fee5,_0x49cd0d){return db[_0x9641('0x2a')][_0x9641('0x46')]({'where':{'id':_0x49fee5['params']['id']}})[_0x9641('0x23')](handleEntityNotFound(_0x49cd0d,null))['then'](removeEntity(_0x49cd0d,null))[_0x9641('0x47')](handleError(_0x49cd0d,null));}; \ No newline at end of file +var _0xf38c=['util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1c80d3,_0x4e00ab){var _0x3d4ad8=function(_0x13fb7e){while(--_0x13fb7e){_0x1c80d3['push'](_0x1c80d3['shift']());}};_0x3d4ad8(++_0x4e00ab);}(_0xf38c,0x17e));var _0xcf38=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf38c[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xcf38('0x0'));var rimraf=require(_0xcf38('0x1'));var zipdir=require(_0xcf38('0x2'));var jsonpatch=require(_0xcf38('0x3'));var rp=require(_0xcf38('0x4'));var moment=require(_0xcf38('0x5'));var BPromise=require(_0xcf38('0x6'));var Mustache=require(_0xcf38('0x7'));var util=require(_0xcf38('0x8'));var path=require(_0xcf38('0x9'));var sox=require(_0xcf38('0xa'));var csv=require('to-csv');var ejs=require(_0xcf38('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf38('0xc'));var squel=require(_0xcf38('0xd'));var crypto=require(_0xcf38('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcf38('0xf'));var toCsv=require(_0xcf38('0x10'));var querystring=require('querystring');var Papa=require(_0xcf38('0x11'));var Redis=require(_0xcf38('0x12'));var authService=require(_0xcf38('0x13'));var qs=require(_0xcf38('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf38('0x15'));var logger=require(_0xcf38('0x16'))(_0xcf38('0x17'));var utils=require(_0xcf38('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcf38('0x19'));var db=require(_0xcf38('0x1a'))['db'];function respondWithStatusCode(_0x4afc66,_0x27d81f){_0x27d81f=_0x27d81f||0xcc;return function(_0x1d4d58){if(_0x1d4d58){return _0x4afc66[_0xcf38('0x1b')](_0x27d81f);}return _0x4afc66[_0xcf38('0x1c')](_0x27d81f)[_0xcf38('0x1d')]();};}function respondWithResult(_0x3d6782,_0x1c580c){_0x1c580c=_0x1c580c||0xc8;return function(_0xa3275a){if(_0xa3275a){return _0x3d6782['status'](_0x1c580c)[_0xcf38('0x1e')](_0xa3275a);}};}function respondWithFilteredResult(_0x3ff42c,_0x703a9a){return function(_0x174399){if(_0x174399){var _0x119f51=typeof _0x703a9a[_0xcf38('0x1f')]===_0xcf38('0x20')&&typeof _0x703a9a['limit']==='undefined';var _0x4c9718=_0x174399[_0xcf38('0x21')];var _0x39d278=_0x119f51?0x0:_0x703a9a['offset'];var _0x2b16a3=_0x119f51?_0x174399[_0xcf38('0x21')]:_0x703a9a[_0xcf38('0x1f')]+_0x703a9a['limit'];var _0x32b08d;if(_0x2b16a3>=_0x4c9718){_0x2b16a3=_0x4c9718;_0x32b08d=0xc8;}else{_0x32b08d=0xce;}_0x3ff42c['status'](_0x32b08d);return _0x3ff42c[_0xcf38('0x22')](_0xcf38('0x23'),_0x39d278+'-'+_0x2b16a3+'/'+_0x4c9718)[_0xcf38('0x1e')](_0x174399);}return null;};}function patchUpdates(_0x1d1893){return function(_0x2cbfa4){try{jsonpatch['apply'](_0x2cbfa4,_0x1d1893,!![]);}catch(_0x2613ff){return BPromise[_0xcf38('0x24')](_0x2613ff);}return _0x2cbfa4[_0xcf38('0x25')]();};}function saveUpdates(_0x19e81f,_0x2e03f9){return function(_0x4a35a7){if(_0x4a35a7){return _0x4a35a7[_0xcf38('0x26')](_0x19e81f)[_0xcf38('0x27')](function(_0x4ea92e){return _0x4ea92e;});}return null;};}function removeEntity(_0x3455be,_0x3bc8e5){return function(_0x2e7b66){if(_0x2e7b66){return _0x2e7b66[_0xcf38('0x28')]()['then'](function(){_0x3455be['status'](0xcc)[_0xcf38('0x1d')]();});}};}function handleEntityNotFound(_0x4314fe,_0x2760f3){return function(_0x37286c){if(!_0x37286c){_0x4314fe[_0xcf38('0x1b')](0x194);}return _0x37286c;};}function handleError(_0x5d7e3f,_0x49077b){_0x49077b=_0x49077b||0x1f4;return function(_0x189f2b){logger[_0xcf38('0x29')](_0x189f2b[_0xcf38('0x2a')]);if(_0x189f2b[_0xcf38('0x2b')]){delete _0x189f2b[_0xcf38('0x2b')];}_0x5d7e3f['status'](_0x49077b)[_0xcf38('0x2c')](_0x189f2b);};}exports[_0xcf38('0x2d')]=function(_0x4790f2,_0x7e5549){var _0x4b0160={},_0x9fef83={},_0x2f3a9e={'count':0x0,'rows':[]};var _0x21a80e=_[_0xcf38('0x2e')](db[_0xcf38('0x2f')][_0xcf38('0x30')],function(_0x49ef24){return{'name':_0x49ef24['fieldName'],'type':_0x49ef24[_0xcf38('0x31')][_0xcf38('0x32')]};});_0x9fef83[_0xcf38('0x33')]=_[_0xcf38('0x2e')](_0x21a80e,_0xcf38('0x2b'));_0x9fef83['query']=_[_0xcf38('0x34')](_0x4790f2[_0xcf38('0x35')]);_0x9fef83[_0xcf38('0x36')]=_['intersection'](_0x9fef83[_0xcf38('0x33')],_0x9fef83[_0xcf38('0x35')]);_0x4b0160[_0xcf38('0x37')]=_[_0xcf38('0x38')](_0x9fef83['model'],qs[_0xcf38('0x39')](_0x4790f2['query']['fields']));_0x4b0160[_0xcf38('0x37')]=_0x4b0160[_0xcf38('0x37')][_0xcf38('0x3a')]?_0x4b0160['attributes']:_0x9fef83[_0xcf38('0x33')];if(!_0x4790f2['query'][_0xcf38('0x3b')]('nolimit')){_0x4b0160[_0xcf38('0x3c')]=qs[_0xcf38('0x3c')](_0x4790f2['query'][_0xcf38('0x3c')]);_0x4b0160[_0xcf38('0x1f')]=qs[_0xcf38('0x1f')](_0x4790f2[_0xcf38('0x35')][_0xcf38('0x1f')]);}_0x4b0160['order']=qs['sort'](_0x4790f2['query'][_0xcf38('0x3d')]);_0x4b0160[_0xcf38('0x3e')]=qs['filters'](_[_0xcf38('0x3f')](_0x4790f2['query'],_0x9fef83[_0xcf38('0x36')]),_0x21a80e);if(_0x4790f2[_0xcf38('0x35')][_0xcf38('0x40')]){_0x4b0160['where']=_[_0xcf38('0x41')](_0x4b0160[_0xcf38('0x3e')],{'$or':_[_0xcf38('0x2e')](_0x21a80e,function(_0x348d51){if(_0x348d51[_0xcf38('0x31')]!==_0xcf38('0x42')){var _0x44901e={};_0x44901e[_0x348d51[_0xcf38('0x2b')]]={'$like':'%'+_0x4790f2[_0xcf38('0x35')][_0xcf38('0x40')]+'%'};return _0x44901e;}})});}_0x4b0160=_[_0xcf38('0x41')]({},_0x4b0160,_0x4790f2[_0xcf38('0x43')]);var _0x57125a={'where':_0x4b0160['where']};return db[_0xcf38('0x2f')]['count'](_0x57125a)[_0xcf38('0x27')](function(_0x44c9a0){_0x2f3a9e[_0xcf38('0x21')]=_0x44c9a0;if(_0x4790f2['query'][_0xcf38('0x44')]){_0x4b0160[_0xcf38('0x45')]=[{'all':!![]}];}return db[_0xcf38('0x2f')][_0xcf38('0x46')](_0x4b0160);})[_0xcf38('0x27')](function(_0x5bbd1c){_0x2f3a9e[_0xcf38('0x47')]=_0x5bbd1c;return _0x2f3a9e;})['then'](respondWithFilteredResult(_0x7e5549,_0x4b0160))[_0xcf38('0x48')](handleError(_0x7e5549,null));};exports[_0xcf38('0x49')]=function(_0x5d86b3,_0x5e451a){var _0xba3078={'raw':!![],'where':{'id':_0x5d86b3[_0xcf38('0x4a')]['id']}},_0x3f91fd={};_0x3f91fd[_0xcf38('0x33')]=_['keys'](db[_0xcf38('0x2f')][_0xcf38('0x30')]);_0x3f91fd[_0xcf38('0x35')]=_[_0xcf38('0x34')](_0x5d86b3[_0xcf38('0x35')]);_0x3f91fd[_0xcf38('0x36')]=_[_0xcf38('0x38')](_0x3f91fd[_0xcf38('0x33')],_0x3f91fd['query']);_0xba3078[_0xcf38('0x37')]=_[_0xcf38('0x38')](_0x3f91fd[_0xcf38('0x33')],qs[_0xcf38('0x39')](_0x5d86b3[_0xcf38('0x35')][_0xcf38('0x39')]));_0xba3078[_0xcf38('0x37')]=_0xba3078[_0xcf38('0x37')][_0xcf38('0x3a')]?_0xba3078[_0xcf38('0x37')]:_0x3f91fd[_0xcf38('0x33')];if(_0x5d86b3[_0xcf38('0x35')][_0xcf38('0x44')]){_0xba3078[_0xcf38('0x45')]=[{'all':!![]}];}_0xba3078=_[_0xcf38('0x41')]({},_0xba3078,_0x5d86b3[_0xcf38('0x43')]);return db[_0xcf38('0x2f')][_0xcf38('0x4b')](_0xba3078)['then'](handleEntityNotFound(_0x5e451a,null))[_0xcf38('0x27')](respondWithResult(_0x5e451a,null))[_0xcf38('0x48')](handleError(_0x5e451a,null));};exports[_0xcf38('0x4c')]=function(_0x441ceb,_0x5e0480){return db[_0xcf38('0x2f')][_0xcf38('0x4c')](_0x441ceb[_0xcf38('0x4d')],{})[_0xcf38('0x27')](respondWithResult(_0x5e0480,0xc9))[_0xcf38('0x48')](handleError(_0x5e0480,null));};exports[_0xcf38('0x26')]=function(_0x1c672b,_0x22546c){if(_0x1c672b[_0xcf38('0x4d')]['id']){delete _0x1c672b['body']['id'];}return db[_0xcf38('0x2f')][_0xcf38('0x4b')]({'where':{'id':_0x1c672b[_0xcf38('0x4a')]['id']}})['then'](handleEntityNotFound(_0x22546c,null))[_0xcf38('0x27')](saveUpdates(_0x1c672b[_0xcf38('0x4d')],null))[_0xcf38('0x27')](respondWithResult(_0x22546c,null))['catch'](handleError(_0x22546c,null));};exports['destroy']=function(_0x4d24c4,_0x2ee4cd){return db[_0xcf38('0x2f')]['find']({'where':{'id':_0x4d24c4['params']['id']}})[_0xcf38('0x27')](handleEntityNotFound(_0x2ee4cd,null))[_0xcf38('0x27')](removeEntity(_0x2ee4cd,null))[_0xcf38('0x48')](handleError(_0x2ee4cd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index bc38b4b..932c63c 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 _0x9662=['../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x29f5b4,_0x6bc829){var _0x14ac53=function(_0x55abf4){while(--_0x55abf4){_0x29f5b4['push'](_0x29f5b4['shift']());}};_0x14ac53(++_0x6bc829);}(_0x9662,0x156));var _0x2966=function(_0x57d7d5,_0x12070e){_0x57d7d5=_0x57d7d5-0x0;var _0x5e4795=_0x9662[_0x57d7d5];return _0x5e4795;};'use strict';var _=require(_0x2966('0x0'));var util=require(_0x2966('0x1'));var logger=require(_0x2966('0x2'))(_0x2966('0x3'));var moment=require(_0x2966('0x4'));var BPromise=require(_0x2966('0x5'));var rp=require(_0x2966('0x6'));var fs=require('fs');var path=require(_0x2966('0x7'));var rimraf=require('rimraf');var config=require(_0x2966('0x8'));var attributes=require(_0x2966('0x9'));module[_0x2966('0xa')]=function(_0x1638e8,_0x3ad9d4){return _0x1638e8['define'](_0x2966('0xb'),attributes,{'tableName':_0x2966('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x2966('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d6d=['api','request-promise','rimraf','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util'];(function(_0x3da942,_0x3c971e){var _0x114520=function(_0x540a0c){while(--_0x540a0c){_0x3da942['push'](_0x3da942['shift']());}};_0x114520(++_0x3c971e);}(_0x4d6d,0x1ac));var _0xd4d6=function(_0x4f1b4b,_0xce0ec4){_0x4f1b4b=_0x4f1b4b-0x0;var _0x582d34=_0x4d6d[_0x4f1b4b];return _0x582d34;};'use strict';var _=require('lodash');var util=require(_0xd4d6('0x0'));var logger=require('../../config/logger')(_0xd4d6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd4d6('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd4d6('0x3'));var config=require('../../config/environment');var attributes=require(_0xd4d6('0x4'));module['exports']=function(_0x1d05a0,_0xd17ddb){return _0x1d05a0[_0xd4d6('0x5')](_0xd4d6('0x6'),attributes,{'tableName':_0xd4d6('0x7'),'paranoid':![],'indexes':[{'name':_0xd4d6('0x8'),'fields':[_0xd4d6('0x9'),_0xd4d6('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 115f745..7e0a828 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 _0xc9a9=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s','message','lodash','util','moment'];(function(_0x5532d7,_0x55873a){var _0x56acae=function(_0x12d7b1){while(--_0x12d7b1){_0x5532d7['push'](_0x5532d7['shift']());}};_0x56acae(++_0x55873a);}(_0xc9a9,0x18d));var _0x9c9a=function(_0x4789a9,_0x48168a){_0x4789a9=_0x4789a9-0x0;var _0x132ff4=_0xc9a9[_0x4789a9];return _0x132ff4;};'use strict';var _=require(_0x9c9a('0x0'));var util=require(_0x9c9a('0x1'));var moment=require(_0x9c9a('0x2'));var BPromise=require(_0x9c9a('0x3'));var rs=require(_0x9c9a('0x4'));var fs=require('fs');var Redis=require(_0x9c9a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c9a('0x6'));var logger=require(_0x9c9a('0x7'))(_0x9c9a('0x8'));var config=require(_0x9c9a('0x9'));var jayson=require(_0x9c9a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4bee0f,_0xa976c0,_0x557c15){return new BPromise(function(_0x1c7c86,_0x103b58){return client[_0x9c9a('0xb')](_0x4bee0f,_0x557c15)[_0x9c9a('0xc')](function(_0x53fcb8){logger[_0x9c9a('0xd')]('SugarcrmField,\x20%s,\x20%s',_0xa976c0,_0x9c9a('0xe'));logger['debug'](_0x9c9a('0xf'),_0xa976c0,'request\x20sent',JSON['stringify'](_0x53fcb8));if(_0x53fcb8[_0x9c9a('0x10')]){if(_0x53fcb8[_0x9c9a('0x10')][_0x9c9a('0x11')]===0x1f4){logger[_0x9c9a('0x10')](_0x9c9a('0x12'),_0xa976c0,_0x53fcb8['error'][_0x9c9a('0x13')]);return _0x103b58(_0x53fcb8['error']['message']);}logger[_0x9c9a('0x10')]('SugarcrmField,\x20%s,\x20%s',_0xa976c0,_0x53fcb8[_0x9c9a('0x10')][_0x9c9a('0x13')]);return _0x1c7c86(_0x53fcb8[_0x9c9a('0x10')]['message']);}else{logger[_0x9c9a('0xd')](_0x9c9a('0x12'),_0xa976c0,_0x9c9a('0xe'));_0x1c7c86(_0x53fcb8['result'][_0x9c9a('0x13')]);}})['catch'](function(_0x534449){logger[_0x9c9a('0x10')](_0x9c9a('0x12'),_0xa976c0,_0x534449);_0x103b58(_0x534449);});});} \ No newline at end of file +var _0x51dd=['../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','code','error','message','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x441db3,_0x10f359){var _0x16c05d=function(_0x4c0d4e){while(--_0x4c0d4e){_0x441db3['push'](_0x441db3['shift']());}};_0x16c05d(++_0x10f359);}(_0x51dd,0xaf));var _0xd51d=function(_0x354e9d,_0x297682){_0x354e9d=_0x354e9d-0x0;var _0x56711d=_0x51dd[_0x354e9d];return _0x56711d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd51d('0x0'));var BPromise=require('bluebird');var rs=require(_0xd51d('0x1'));var fs=require('fs');var Redis=require(_0xd51d('0x2'));var db=require(_0xd51d('0x3'))['db'];var utils=require(_0xd51d('0x4'));var logger=require(_0xd51d('0x5'))('rpc');var config=require(_0xd51d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd51d('0x7')][_0xd51d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7dc4f9,_0x5f0c5c,_0x3282f5){return new BPromise(function(_0x86a2c4,_0xb6d4f){return client[_0xd51d('0x9')](_0x7dc4f9,_0x3282f5)[_0xd51d('0xa')](function(_0x554d42){logger[_0xd51d('0xb')](_0xd51d('0xc'),_0x5f0c5c,_0xd51d('0xd'));logger['debug'](_0xd51d('0xe'),_0x5f0c5c,_0xd51d('0xd'),JSON['stringify'](_0x554d42));if(_0x554d42['error']){if(_0x554d42['error'][_0xd51d('0xf')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x5f0c5c,_0x554d42[_0xd51d('0x10')][_0xd51d('0x11')]);return _0xb6d4f(_0x554d42['error'][_0xd51d('0x11')]);}logger['error'](_0xd51d('0xc'),_0x5f0c5c,_0x554d42[_0xd51d('0x10')][_0xd51d('0x11')]);return _0x86a2c4(_0x554d42[_0xd51d('0x10')][_0xd51d('0x11')]);}else{logger[_0xd51d('0xb')](_0xd51d('0xc'),_0x5f0c5c,_0xd51d('0xd'));_0x86a2c4(_0x554d42['result'][_0xd51d('0x11')]);}})['catch'](function(_0x1ac261){logger[_0xd51d('0x10')](_0xd51d('0xc'),_0x5f0c5c,_0x1ac261);_0xb6d4f(_0x1ac261);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 8b55ada..2b91702 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 _0x21d1=['Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x1d93c6,_0x581245){var _0x1eca3c=function(_0x12fa36){while(--_0x12fa36){_0x1d93c6['push'](_0x1d93c6['shift']());}};_0x1eca3c(++_0x581245);}(_0x21d1,0x1c9));var _0x121d=function(_0x5e62af,_0x643a15){_0x5e62af=_0x5e62af-0x0;var _0x1ce5bb=_0x21d1[_0x5e62af];return _0x1ce5bb;};'use strict';var multer=require(_0x121d('0x0'));var util=require(_0x121d('0x1'));var path=require(_0x121d('0x2'));var timeout=require(_0x121d('0x3'));var express=require(_0x121d('0x4'));var router=express[_0x121d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x121d('0x6'));var config=require(_0x121d('0x7'));var controller=require(_0x121d('0x8'));router[_0x121d('0x9')]('/',auth[_0x121d('0xa')](),controller['index']);router[_0x121d('0x9')](_0x121d('0xb'),auth[_0x121d('0xa')](),controller[_0x121d('0xc')]);router[_0x121d('0x9')](_0x121d('0xd'),auth[_0x121d('0xa')](),controller[_0x121d('0xe')]);router[_0x121d('0x9')](_0x121d('0xf'),auth['isAuthenticated'](),controller[_0x121d('0x10')]);router[_0x121d('0x11')]('/',auth[_0x121d('0xa')](),controller['create']);router['post'](_0x121d('0xd'),auth[_0x121d('0xa')](),controller[_0x121d('0x12')]);router['put']('/:id',auth[_0x121d('0xa')](),controller['update']);router[_0x121d('0x13')](_0x121d('0xb'),auth[_0x121d('0xa')](),controller['destroy']);module[_0x121d('0x14')]=router; \ No newline at end of file +var _0x44d5=['show','/:id/configurations','getConfigurations','post','addConfiguration','put','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x31168a,_0x8cc769){var _0x369be2=function(_0x495f3a){while(--_0x495f3a){_0x31168a['push'](_0x31168a['shift']());}};_0x369be2(++_0x8cc769);}(_0x44d5,0x1a5));var _0x544d=function(_0x551bc1,_0x47cff3){_0x551bc1=_0x551bc1-0x0;var _0x12ea5e=_0x44d5[_0x551bc1];return _0x12ea5e;};'use strict';var multer=require(_0x544d('0x0'));var util=require(_0x544d('0x1'));var path=require('path');var timeout=require(_0x544d('0x2'));var express=require('express');var router=express[_0x544d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x544d('0x4'));var interaction=require(_0x544d('0x5'));var config=require(_0x544d('0x6'));var controller=require('./intVtigerAccount.controller');router[_0x544d('0x7')]('/',auth['isAuthenticated'](),controller[_0x544d('0x8')]);router[_0x544d('0x7')](_0x544d('0x9'),auth[_0x544d('0xa')](),controller[_0x544d('0xb')]);router[_0x544d('0x7')](_0x544d('0xc'),auth[_0x544d('0xa')](),controller[_0x544d('0xd')]);router[_0x544d('0x7')]('/:id/fields',auth[_0x544d('0xa')](),controller['getFields']);router[_0x544d('0xe')]('/',auth[_0x544d('0xa')](),controller['create']);router['post']('/:id/configurations',auth[_0x544d('0xa')](),controller[_0x544d('0xf')]);router[_0x544d('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x544d('0x11')](_0x544d('0x9'),auth[_0x544d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index dd8a72d..073c77d 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 _0x1404=['STRING','HelpDesk','sequelize'];(function(_0x46a814,_0x254aab){var _0x558714=function(_0x21d470){while(--_0x21d470){_0x46a814['push'](_0x46a814['shift']());}};_0x558714(++_0x254aab);}(_0x1404,0xec));var _0x4140=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x1404[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x4140('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4140('0x1')]},'username':{'type':Sequelize[_0x4140('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4140('0x1')],'allowNull':![],'defaultValue':_0x4140('0x2')},'remoteUri':{'type':Sequelize[_0x4140('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4140('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4140('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x251c=['HelpDesk','sequelize','exports','STRING'];(function(_0xf8f92c,_0x125b89){var _0x2df5a5=function(_0xfadc97){while(--_0xfadc97){_0xf8f92c['push'](_0xf8f92c['shift']());}};_0x2df5a5(++_0x125b89);}(_0x251c,0x101));var _0xc251=function(_0x25fe7d,_0x4208b3){_0x25fe7d=_0x25fe7d-0x0;var _0x3b9a12=_0x251c[_0x25fe7d];return _0x3b9a12;};'use strict';var Sequelize=require(_0xc251('0x0'));module[_0xc251('0x1')]={'name':{'type':Sequelize[_0xc251('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc251('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc251('0x2')],'allowNull':![],'defaultValue':_0xc251('0x3')},'remoteUri':{'type':Sequelize[_0xc251('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc251('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc251('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 7b86339..dce7234 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 _0x1c55=['startsWith','cf_','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','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','end','error','stack','name','send','index','map','VtigerAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','getConfigurations','findOne','nolimit','addConfiguration','channel','Descriptions','VtigerConfiguration','VtigerField','getFields','username','description','remoteUri','serverUrl','accessKey','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','autogenerated','owner','remove','editable','label'];(function(_0x49bca7,_0x1b5e3d){var _0x44ba48=function(_0x336e6e){while(--_0x336e6e){_0x49bca7['push'](_0x49bca7['shift']());}};_0x44ba48(++_0x1b5e3d);}(_0x1c55,0x164));var _0x51c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1c55[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x51c5('0x0'));var rimraf=require(_0x51c5('0x1'));var zipdir=require(_0x51c5('0x2'));var jsonpatch=require(_0x51c5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x51c5('0x4'));var Mustache=require(_0x51c5('0x5'));var util=require('util');var path=require(_0x51c5('0x6'));var sox=require(_0x51c5('0x7'));var csv=require('to-csv');var ejs=require(_0x51c5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x51c5('0x9'));var squel=require('squel');var crypto=require(_0x51c5('0xa'));var jsforce=require(_0x51c5('0xb'));var deskjs=require(_0x51c5('0xc'));var toCsv=require(_0x51c5('0xd'));var querystring=require(_0x51c5('0xe'));var Papa=require(_0x51c5('0xf'));var Redis=require(_0x51c5('0x10'));var authService=require(_0x51c5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x51c5('0x12'));var hardwareService=require(_0x51c5('0x13'));var logger=require(_0x51c5('0x14'))(_0x51c5('0x15'));var utils=require('../../config/utils');var config=require(_0x51c5('0x16'));var licenseUtil=require(_0x51c5('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x51c5('0x18'));function respondWithStatusCode(_0x331e3e,_0x4b0dfe){_0x4b0dfe=_0x4b0dfe||0xcc;return function(_0x1eae2c){if(_0x1eae2c){return _0x331e3e[_0x51c5('0x19')](_0x4b0dfe);}return _0x331e3e[_0x51c5('0x1a')](_0x4b0dfe)['end']();};}function respondWithResult(_0x5b9421,_0x327e3e){_0x327e3e=_0x327e3e||0xc8;return function(_0x1b891c){if(_0x1b891c){return _0x5b9421[_0x51c5('0x1a')](_0x327e3e)[_0x51c5('0x1b')](_0x1b891c);}};}function respondWithFilteredResult(_0x2f7f4d,_0x588f69){return function(_0x3b096c){if(_0x3b096c){var _0x2b5f9c=typeof _0x588f69[_0x51c5('0x1c')]===_0x51c5('0x1d')&&typeof _0x588f69[_0x51c5('0x1e')]===_0x51c5('0x1d');var _0x2b59e0=_0x3b096c[_0x51c5('0x1f')];var _0x1d2fa7=_0x2b5f9c?0x0:_0x588f69['offset'];var _0x3a47f7=_0x2b5f9c?_0x3b096c[_0x51c5('0x1f')]:_0x588f69[_0x51c5('0x1c')]+_0x588f69['limit'];var _0x30d516;if(_0x3a47f7>=_0x2b59e0){_0x3a47f7=_0x2b59e0;_0x30d516=0xc8;}else{_0x30d516=0xce;}_0x2f7f4d[_0x51c5('0x1a')](_0x30d516);return _0x2f7f4d[_0x51c5('0x20')](_0x51c5('0x21'),_0x1d2fa7+'-'+_0x3a47f7+'/'+_0x2b59e0)[_0x51c5('0x1b')](_0x3b096c);}return null;};}function patchUpdates(_0x7bd6b1){return function(_0x54410c){try{jsonpatch[_0x51c5('0x22')](_0x54410c,_0x7bd6b1,!![]);}catch(_0x1b332d){return BPromise['reject'](_0x1b332d);}return _0x54410c[_0x51c5('0x23')]();};}function saveUpdates(_0x184d37,_0x3398e6){return function(_0x5c833f){if(_0x5c833f){return _0x5c833f['update'](_0x184d37)[_0x51c5('0x24')](function(_0x458346){return _0x458346;});}return null;};}function removeEntity(_0x1abde0,_0x5dca41){return function(_0x567f1){if(_0x567f1){return _0x567f1['destroy']()['then'](function(){_0x1abde0[_0x51c5('0x1a')](0xcc)[_0x51c5('0x25')]();});}};}function handleEntityNotFound(_0x2f324e,_0x2d2205){return function(_0x33f0ae){if(!_0x33f0ae){_0x2f324e[_0x51c5('0x19')](0x194);}return _0x33f0ae;};}function handleError(_0x24ecef,_0x689ed2){_0x689ed2=_0x689ed2||0x1f4;return function(_0xbc8ad5){logger[_0x51c5('0x26')](_0xbc8ad5[_0x51c5('0x27')]);if(_0xbc8ad5[_0x51c5('0x28')]){delete _0xbc8ad5[_0x51c5('0x28')];}_0x24ecef['status'](_0x689ed2)[_0x51c5('0x29')](_0xbc8ad5);};}exports[_0x51c5('0x2a')]=function(_0x482cb4,_0x4219bd){var _0x83420c={},_0x2eecf7={},_0x9cefab={'count':0x0,'rows':[]};var _0x3cbac8=_[_0x51c5('0x2b')](db[_0x51c5('0x2c')]['rawAttributes'],function(_0x1e47ca){return{'name':_0x1e47ca[_0x51c5('0x2d')],'type':_0x1e47ca[_0x51c5('0x2e')]['key']};});_0x2eecf7[_0x51c5('0x2f')]=_[_0x51c5('0x2b')](_0x3cbac8,_0x51c5('0x28'));_0x2eecf7[_0x51c5('0x30')]=_[_0x51c5('0x31')](_0x482cb4[_0x51c5('0x30')]);_0x2eecf7[_0x51c5('0x32')]=_[_0x51c5('0x33')](_0x2eecf7[_0x51c5('0x2f')],_0x2eecf7[_0x51c5('0x30')]);_0x83420c[_0x51c5('0x34')]=_[_0x51c5('0x33')](_0x2eecf7[_0x51c5('0x2f')],qs['fields'](_0x482cb4[_0x51c5('0x30')][_0x51c5('0x35')]));_0x83420c[_0x51c5('0x34')]=_0x83420c[_0x51c5('0x34')]['length']?_0x83420c[_0x51c5('0x34')]:_0x2eecf7[_0x51c5('0x2f')];if(!_0x482cb4[_0x51c5('0x30')][_0x51c5('0x36')]('nolimit')){_0x83420c[_0x51c5('0x1e')]=qs[_0x51c5('0x1e')](_0x482cb4['query'][_0x51c5('0x1e')]);_0x83420c[_0x51c5('0x1c')]=qs['offset'](_0x482cb4[_0x51c5('0x30')]['offset']);}_0x83420c[_0x51c5('0x37')]=qs['sort'](_0x482cb4[_0x51c5('0x30')][_0x51c5('0x38')]);_0x83420c[_0x51c5('0x39')]=qs[_0x51c5('0x32')](_[_0x51c5('0x3a')](_0x482cb4['query'],_0x2eecf7[_0x51c5('0x32')]),_0x3cbac8);if(_0x482cb4[_0x51c5('0x30')][_0x51c5('0x3b')]){_0x83420c[_0x51c5('0x39')]=_[_0x51c5('0x3c')](_0x83420c[_0x51c5('0x39')],{'$or':_[_0x51c5('0x2b')](_0x3cbac8,function(_0x9af33d){if(_0x9af33d[_0x51c5('0x2e')]!==_0x51c5('0x3d')){var _0x27bf58={};_0x27bf58[_0x9af33d[_0x51c5('0x28')]]={'$like':'%'+_0x482cb4[_0x51c5('0x30')][_0x51c5('0x3b')]+'%'};return _0x27bf58;}})});}_0x83420c=_[_0x51c5('0x3c')]({},_0x83420c,_0x482cb4[_0x51c5('0x3e')]);var _0x4af1e5={'where':_0x83420c[_0x51c5('0x39')]};return db[_0x51c5('0x2c')][_0x51c5('0x1f')](_0x4af1e5)[_0x51c5('0x24')](function(_0x581b21){_0x9cefab['count']=_0x581b21;if(_0x482cb4[_0x51c5('0x30')][_0x51c5('0x3f')]){_0x83420c[_0x51c5('0x40')]=[{'all':!![]}];}return db[_0x51c5('0x2c')][_0x51c5('0x41')](_0x83420c);})['then'](function(_0x492814){_0x9cefab[_0x51c5('0x42')]=_0x492814;return _0x9cefab;})['then'](respondWithFilteredResult(_0x4219bd,_0x83420c))[_0x51c5('0x43')](handleError(_0x4219bd,null));};exports[_0x51c5('0x44')]=function(_0x317c27,_0x19a562){var _0x660e92={'raw':![],'where':{'id':_0x317c27[_0x51c5('0x45')]['id']}},_0x262215={};_0x262215['model']=_[_0x51c5('0x31')](db['VtigerAccount'][_0x51c5('0x46')]);_0x262215[_0x51c5('0x30')]=_[_0x51c5('0x31')](_0x317c27['query']);_0x262215[_0x51c5('0x32')]=_[_0x51c5('0x33')](_0x262215['model'],_0x262215[_0x51c5('0x30')]);_0x660e92[_0x51c5('0x34')]=_[_0x51c5('0x33')](_0x262215[_0x51c5('0x2f')],qs[_0x51c5('0x35')](_0x317c27[_0x51c5('0x30')][_0x51c5('0x35')]));_0x660e92['attributes']=_0x660e92['attributes'][_0x51c5('0x47')]?_0x660e92['attributes']:_0x262215['model'];if(_0x317c27['query'][_0x51c5('0x3f')]){_0x660e92['include']=[{'all':!![]}];}_0x660e92=_[_0x51c5('0x3c')]({},_0x660e92,_0x317c27[_0x51c5('0x3e')]);return db[_0x51c5('0x2c')][_0x51c5('0x48')](_0x660e92)[_0x51c5('0x24')](handleEntityNotFound(_0x19a562,null))[_0x51c5('0x24')](respondWithResult(_0x19a562,null))['catch'](handleError(_0x19a562,null));};exports[_0x51c5('0x49')]=function(_0x17e2ef,_0x58a89c){return db[_0x51c5('0x2c')][_0x51c5('0x49')](_0x17e2ef['body'],{})['then'](respondWithResult(_0x58a89c,0xc9))[_0x51c5('0x43')](handleError(_0x58a89c,null));};exports['update']=function(_0x40bd6d,_0x2ac76b){if(_0x40bd6d['body']['id']){delete _0x40bd6d[_0x51c5('0x4a')]['id'];}return db[_0x51c5('0x2c')][_0x51c5('0x48')]({'where':{'id':_0x40bd6d[_0x51c5('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ac76b,null))['then'](saveUpdates(_0x40bd6d[_0x51c5('0x4a')],null))[_0x51c5('0x24')](respondWithResult(_0x2ac76b,null))['catch'](handleError(_0x2ac76b,null));};exports['destroy']=function(_0x5a1508,_0x11cad3){return db['VtigerAccount']['find']({'where':{'id':_0x5a1508[_0x51c5('0x45')]['id']}})[_0x51c5('0x24')](handleEntityNotFound(_0x11cad3,null))[_0x51c5('0x24')](removeEntity(_0x11cad3,null))[_0x51c5('0x43')](handleError(_0x11cad3,null));};exports[_0x51c5('0x4b')]=function(_0x39f594,_0x23be3f,_0x98133e){var _0x21c06b={};var _0x2be05c={};var _0x25bccb;var _0xfc2706;return db[_0x51c5('0x2c')][_0x51c5('0x4c')]({'where':{'id':_0x39f594[_0x51c5('0x45')]['id']}})[_0x51c5('0x24')](handleEntityNotFound(_0x23be3f,null))[_0x51c5('0x24')](function(_0x164599){if(_0x164599){_0x25bccb=_0x164599;_0x2be05c[_0x51c5('0x2f')]=_['keys'](db['VtigerConfiguration'][_0x51c5('0x46')]);_0x2be05c[_0x51c5('0x30')]=_[_0x51c5('0x31')](_0x39f594['query']);_0x2be05c[_0x51c5('0x32')]=_['intersection'](_0x2be05c['model'],_0x2be05c[_0x51c5('0x30')]);_0x21c06b[_0x51c5('0x34')]=_['intersection'](_0x2be05c[_0x51c5('0x2f')],qs['fields'](_0x39f594[_0x51c5('0x30')][_0x51c5('0x35')]));_0x21c06b[_0x51c5('0x34')]=_0x21c06b[_0x51c5('0x34')][_0x51c5('0x47')]?_0x21c06b[_0x51c5('0x34')]:_0x2be05c[_0x51c5('0x2f')];_0x21c06b[_0x51c5('0x37')]=qs[_0x51c5('0x38')](_0x39f594['query'][_0x51c5('0x38')]);_0x21c06b['where']=qs[_0x51c5('0x32')](_[_0x51c5('0x3a')](_0x39f594[_0x51c5('0x30')],_0x2be05c['filters']));if(_0x39f594[_0x51c5('0x30')][_0x51c5('0x3b')]){_0x21c06b[_0x51c5('0x39')]=_[_0x51c5('0x3c')](_0x21c06b[_0x51c5('0x39')],{'$or':_['map'](_0x21c06b[_0x51c5('0x34')],function(_0x55609c){var _0x19fa28={};_0x19fa28[_0x55609c]={'$like':'%'+_0x39f594[_0x51c5('0x30')]['filter']+'%'};return _0x19fa28;})});}_0x21c06b=_[_0x51c5('0x3c')]({},_0x21c06b,_0x39f594[_0x51c5('0x3e')]);return _0x25bccb['getConfigurations'](_0x21c06b);}})[_0x51c5('0x24')](function(_0x3200a5){if(_0x3200a5){_0xfc2706=_0x3200a5[_0x51c5('0x47')];if(!_0x39f594[_0x51c5('0x30')][_0x51c5('0x36')](_0x51c5('0x4d'))){_0x21c06b[_0x51c5('0x1e')]=qs[_0x51c5('0x1e')](_0x39f594['query']['limit']);_0x21c06b['offset']=qs['offset'](_0x39f594[_0x51c5('0x30')][_0x51c5('0x1c')]);}return _0x25bccb[_0x51c5('0x4b')](_0x21c06b);}})['then'](function(_0x36b028){if(_0x36b028){return _0x36b028?{'count':_0xfc2706,'rows':_0x36b028}:null;}})[_0x51c5('0x24')](respondWithResult(_0x23be3f,null))['catch'](handleError(_0x23be3f,null));};exports[_0x51c5('0x4e')]=function(_0x71c35a,_0x4d4096,_0x412eba){if(_0x71c35a[_0x51c5('0x4a')]['id']){delete _0x71c35a[_0x51c5('0x4a')]['id'];}return db[_0x51c5('0x2c')][_0x51c5('0x4c')]({'where':{'id':_0x71c35a[_0x51c5('0x45')]['id']}})[_0x51c5('0x24')](handleEntityNotFound(_0x4d4096,null))[_0x51c5('0x24')](function(_0x287fa1){if(_0x287fa1){_0x71c35a['body']['AccountId']=_0x287fa1['id'];_0x71c35a[_0x51c5('0x4a')]['Subjects']=integrations['getSubjects'](_0x71c35a['body'][_0x51c5('0x4f')],_0x71c35a[_0x51c5('0x4a')][_0x51c5('0x2e')]);_0x71c35a['body'][_0x51c5('0x50')]=integrations['getDescriptions'](_0x71c35a[_0x51c5('0x4a')]['channel'],_0x71c35a[_0x51c5('0x4a')][_0x51c5('0x2e')]);return db[_0x51c5('0x51')][_0x51c5('0x49')](_0x71c35a[_0x51c5('0x4a')],{'include':[{'model':db[_0x51c5('0x52')],'as':'Subjects'},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x51c5('0x24')](respondWithResult(_0x4d4096,null))[_0x51c5('0x43')](handleError(_0x4d4096,null));};var md5=require('md5');exports[_0x51c5('0x53')]=function(_0x59d570,_0x37f6a7,_0x3839cd){var _0x435700=null;var _0x1250e4=null;var _0x230acd=null;var _0x1c1677=null;var _0x219dd0='';return db['VtigerAccount'][_0x51c5('0x4c')]({'where':{'id':_0x59d570['params']['id']},'attributes':['id',_0x51c5('0x28'),_0x51c5('0x54'),_0x51c5('0x55'),'moduleName',_0x51c5('0x56'),_0x51c5('0x57'),_0x51c5('0x58')]})['then'](handleEntityNotFound(_0x37f6a7,null))[_0x51c5('0x24')](function(_0xc0253e){if(_0xc0253e){_0x435700=_0xc0253e[_0x51c5('0x54')];_0x1250e4=_0xc0253e[_0x51c5('0x58')];_0x230acd=_0xc0253e['moduleName'];_0x219dd0=_0xc0253e[_0x51c5('0x56')];var _0x51e660=_0x219dd0['slice'](-0x1);if(_0x51e660==='/'){_0x219dd0=_0x219dd0['substring'](0x0,_0x219dd0['lastIndexOf'](_0x51e660));}_0x1c1677=util[_0x51c5('0x59')](_0x51c5('0x5a'),_0x219dd0);var _0xca165d={'method':_0x51c5('0x5b'),'uri':_0x1c1677,'qs':{'operation':_0x51c5('0x5c'),'username':_0xc0253e[_0x51c5('0x54')]},'json':!![]};return rp(_0xca165d);}})[_0x51c5('0x24')](function(_0x4d8641){if(_0x4d8641[_0x51c5('0x5d')]){var _0x31ddcf={'method':_0x51c5('0x5e'),'uri':_0x1c1677,'form':{'operation':_0x51c5('0x5f'),'username':_0x435700,'accessKey':md5(_0x4d8641[_0x51c5('0x60')][_0x51c5('0x61')]+_0x1250e4)},'json':!![]};return rp(_0x31ddcf);}})[_0x51c5('0x24')](function(_0x4466bf){if(_0x4466bf[_0x51c5('0x5d')]){var _0x212c45={'method':_0x51c5('0x5b'),'uri':_0x1c1677,'qs':{'operation':_0x51c5('0x62'),'username':_0x435700,'sessionName':_0x4466bf[_0x51c5('0x60')]['sessionName'],'elementType':_0x230acd},'json':!![]};return rp(_0x212c45);}})['then'](function(_0x43e954){if(_0x43e954[_0x51c5('0x5d')]){var _0x2a882e=[_0x51c5('0x63'),'reference',_0x51c5('0x64')];_[_0x51c5('0x65')](_0x43e954[_0x51c5('0x60')]['fields'],function(_0x7b39d9){return _0x2a882e['includes'](_0x7b39d9[_0x51c5('0x2e')]['name']);});_[_0x51c5('0x65')](_0x43e954[_0x51c5('0x60')][_0x51c5('0x35')],function(_0xb8659b){return _0xb8659b[_0x51c5('0x66')]==='false';});return{'count':_0x43e954[_0x51c5('0x60')][_0x51c5('0x35')]['length'],'rows':_[_0x51c5('0x2b')](_0x43e954['result'][_0x51c5('0x35')],function(_0x3c1ce2){return{'id':_0x3c1ce2['name'],'name':_0x3c1ce2[_0x51c5('0x67')],'custom':_[_0x51c5('0x68')](_0x3c1ce2['name'],_0x51c5('0x69'))?!![]:![],'options':_0x3c1ce2['type']['name']===_0x51c5('0x6a')&&_0x3c1ce2[_0x51c5('0x2e')][_0x51c5('0x6b')][_0x51c5('0x47')]>0x0?_[_0x51c5('0x2b')](_0x3c1ce2[_0x51c5('0x2e')][_0x51c5('0x6b')],function(_0x6d89dd){return{'name':_0x6d89dd['label'],'value':_0x6d89dd[_0x51c5('0x6c')]};}):[]};})};}})[_0x51c5('0x24')](respondWithResult(_0x37f6a7,null))[_0x51c5('0x43')](function(_0x4ea9aa){console[_0x51c5('0x6d')](_0x51c5('0x6e')+_0x4ea9aa);var _0x49935f=_0x59d570[_0x51c5('0x30')][_0x51c5('0x6f')]?0x1f4:_0x4ea9aa[_0x51c5('0x70')]||0x1f4;logger['error'](_0x51c5('0x71'),'getFields',_0x49935f,JSON[_0x51c5('0x72')](_0x4ea9aa));delete _0x4ea9aa['name'];if(_0x49935f===0x191){_0x49935f=0x190;}_0x37f6a7[_0x51c5('0x1a')](_0x49935f)[_0x51c5('0x29')](_0x59d570[_0x51c5('0x30')][_0x51c5('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x4ea9aa['statusCode']}:_0x4ea9aa);});}; \ No newline at end of file +var _0x345c=['serverUrl','username','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','describe','sessionName','reference','owner','remove','false','startsWith','cf_','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','name','send','index','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','count','includeAll','include','findAll','rows','params','find','catch','create','body','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','md5','getFields','description','remoteUri'];(function(_0x322a46,_0x4ac56d){var _0xf1913f=function(_0x54879d){while(--_0x54879d){_0x322a46['push'](_0x322a46['shift']());}};_0xf1913f(++_0x4ac56d);}(_0x345c,0x10d));var _0xc345=function(_0x142e72,_0x2dc0b8){_0x142e72=_0x142e72-0x0;var _0x90e075=_0x345c[_0x142e72];return _0x90e075;};'use strict';var emlformat=require(_0xc345('0x0'));var rimraf=require(_0xc345('0x1'));var zipdir=require(_0xc345('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc345('0x3'));var moment=require(_0xc345('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc345('0x5'));var util=require(_0xc345('0x6'));var path=require(_0xc345('0x7'));var sox=require('sox');var csv=require(_0xc345('0x8'));var ejs=require(_0xc345('0x9'));var fs=require('fs');var fs_extra=require(_0xc345('0xa'));var _=require(_0xc345('0xb'));var squel=require(_0xc345('0xc'));var crypto=require(_0xc345('0xd'));var jsforce=require(_0xc345('0xe'));var deskjs=require(_0xc345('0xf'));var toCsv=require(_0xc345('0x8'));var querystring=require('querystring');var Papa=require(_0xc345('0x10'));var Redis=require(_0xc345('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc345('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc345('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xc345('0x14'));function respondWithStatusCode(_0x43a038,_0xd5fc5a){_0xd5fc5a=_0xd5fc5a||0xcc;return function(_0x33677d){if(_0x33677d){return _0x43a038[_0xc345('0x15')](_0xd5fc5a);}return _0x43a038[_0xc345('0x16')](_0xd5fc5a)[_0xc345('0x17')]();};}function respondWithResult(_0x5657b2,_0x48e2a4){_0x48e2a4=_0x48e2a4||0xc8;return function(_0x29f25e){if(_0x29f25e){return _0x5657b2[_0xc345('0x16')](_0x48e2a4)[_0xc345('0x18')](_0x29f25e);}};}function respondWithFilteredResult(_0x32d638,_0x462b07){return function(_0x3b8006){if(_0x3b8006){var _0x3a3c80=typeof _0x462b07[_0xc345('0x19')]===_0xc345('0x1a')&&typeof _0x462b07['limit']===_0xc345('0x1a');var _0x37d0a8=_0x3b8006['count'];var _0xf47cd6=_0x3a3c80?0x0:_0x462b07['offset'];var _0x4734d7=_0x3a3c80?_0x3b8006['count']:_0x462b07[_0xc345('0x19')]+_0x462b07[_0xc345('0x1b')];var _0x4f5956;if(_0x4734d7>=_0x37d0a8){_0x4734d7=_0x37d0a8;_0x4f5956=0xc8;}else{_0x4f5956=0xce;}_0x32d638[_0xc345('0x16')](_0x4f5956);return _0x32d638[_0xc345('0x1c')]('Content-Range',_0xf47cd6+'-'+_0x4734d7+'/'+_0x37d0a8)[_0xc345('0x18')](_0x3b8006);}return null;};}function patchUpdates(_0x4207d8){return function(_0x3b3429){try{jsonpatch[_0xc345('0x1d')](_0x3b3429,_0x4207d8,!![]);}catch(_0x27c04d){return BPromise[_0xc345('0x1e')](_0x27c04d);}return _0x3b3429[_0xc345('0x1f')]();};}function saveUpdates(_0x15b699,_0x17c9d2){return function(_0x498f2e){if(_0x498f2e){return _0x498f2e[_0xc345('0x20')](_0x15b699)[_0xc345('0x21')](function(_0x57bd39){return _0x57bd39;});}return null;};}function removeEntity(_0x3ca6fa,_0x2d8cbb){return function(_0x209200){if(_0x209200){return _0x209200[_0xc345('0x22')]()[_0xc345('0x21')](function(){_0x3ca6fa[_0xc345('0x16')](0xcc)[_0xc345('0x17')]();});}};}function handleEntityNotFound(_0x37af19,_0x135189){return function(_0x5c082e){if(!_0x5c082e){_0x37af19[_0xc345('0x15')](0x194);}return _0x5c082e;};}function handleError(_0x307c11,_0x474934){_0x474934=_0x474934||0x1f4;return function(_0x225167){logger['error'](_0x225167['stack']);if(_0x225167[_0xc345('0x23')]){delete _0x225167[_0xc345('0x23')];}_0x307c11[_0xc345('0x16')](_0x474934)[_0xc345('0x24')](_0x225167);};}exports[_0xc345('0x25')]=function(_0x157821,_0x303703){var _0x3cd91f={},_0x51d2e8={},_0x33332a={'count':0x0,'rows':[]};var _0x337115=_['map'](db[_0xc345('0x26')][_0xc345('0x27')],function(_0x55621f){return{'name':_0x55621f[_0xc345('0x28')],'type':_0x55621f['type'][_0xc345('0x29')]};});_0x51d2e8[_0xc345('0x2a')]=_['map'](_0x337115,'name');_0x51d2e8[_0xc345('0x2b')]=_[_0xc345('0x2c')](_0x157821[_0xc345('0x2b')]);_0x51d2e8['filters']=_[_0xc345('0x2d')](_0x51d2e8[_0xc345('0x2a')],_0x51d2e8[_0xc345('0x2b')]);_0x3cd91f[_0xc345('0x2e')]=_[_0xc345('0x2d')](_0x51d2e8[_0xc345('0x2a')],qs[_0xc345('0x2f')](_0x157821[_0xc345('0x2b')]['fields']));_0x3cd91f['attributes']=_0x3cd91f[_0xc345('0x2e')][_0xc345('0x30')]?_0x3cd91f[_0xc345('0x2e')]:_0x51d2e8['model'];if(!_0x157821[_0xc345('0x2b')][_0xc345('0x31')](_0xc345('0x32'))){_0x3cd91f[_0xc345('0x1b')]=qs[_0xc345('0x1b')](_0x157821['query'][_0xc345('0x1b')]);_0x3cd91f[_0xc345('0x19')]=qs['offset'](_0x157821[_0xc345('0x2b')]['offset']);}_0x3cd91f['order']=qs[_0xc345('0x33')](_0x157821[_0xc345('0x2b')][_0xc345('0x33')]);_0x3cd91f[_0xc345('0x34')]=qs[_0xc345('0x35')](_[_0xc345('0x36')](_0x157821[_0xc345('0x2b')],_0x51d2e8[_0xc345('0x35')]),_0x337115);if(_0x157821[_0xc345('0x2b')][_0xc345('0x37')]){_0x3cd91f[_0xc345('0x34')]=_[_0xc345('0x38')](_0x3cd91f['where'],{'$or':_[_0xc345('0x39')](_0x337115,function(_0x1eb008){if(_0x1eb008[_0xc345('0x3a')]!==_0xc345('0x3b')){var _0x149d6d={};_0x149d6d[_0x1eb008[_0xc345('0x23')]]={'$like':'%'+_0x157821[_0xc345('0x2b')][_0xc345('0x37')]+'%'};return _0x149d6d;}})});}_0x3cd91f=_[_0xc345('0x38')]({},_0x3cd91f,_0x157821[_0xc345('0x3c')]);var _0x189500={'where':_0x3cd91f[_0xc345('0x34')]};return db[_0xc345('0x26')][_0xc345('0x3d')](_0x189500)[_0xc345('0x21')](function(_0xd4ca1a){_0x33332a['count']=_0xd4ca1a;if(_0x157821[_0xc345('0x2b')][_0xc345('0x3e')]){_0x3cd91f[_0xc345('0x3f')]=[{'all':!![]}];}return db[_0xc345('0x26')][_0xc345('0x40')](_0x3cd91f);})[_0xc345('0x21')](function(_0x4351f3){_0x33332a[_0xc345('0x41')]=_0x4351f3;return _0x33332a;})[_0xc345('0x21')](respondWithFilteredResult(_0x303703,_0x3cd91f))['catch'](handleError(_0x303703,null));};exports['show']=function(_0x1951a8,_0x51f08b){var _0x1b74e9={'raw':![],'where':{'id':_0x1951a8[_0xc345('0x42')]['id']}},_0x19f9e9={};_0x19f9e9[_0xc345('0x2a')]=_['keys'](db[_0xc345('0x26')][_0xc345('0x27')]);_0x19f9e9[_0xc345('0x2b')]=_['keys'](_0x1951a8[_0xc345('0x2b')]);_0x19f9e9[_0xc345('0x35')]=_[_0xc345('0x2d')](_0x19f9e9[_0xc345('0x2a')],_0x19f9e9[_0xc345('0x2b')]);_0x1b74e9[_0xc345('0x2e')]=_['intersection'](_0x19f9e9[_0xc345('0x2a')],qs[_0xc345('0x2f')](_0x1951a8['query'][_0xc345('0x2f')]));_0x1b74e9['attributes']=_0x1b74e9[_0xc345('0x2e')][_0xc345('0x30')]?_0x1b74e9[_0xc345('0x2e')]:_0x19f9e9[_0xc345('0x2a')];if(_0x1951a8[_0xc345('0x2b')][_0xc345('0x3e')]){_0x1b74e9[_0xc345('0x3f')]=[{'all':!![]}];}_0x1b74e9=_[_0xc345('0x38')]({},_0x1b74e9,_0x1951a8[_0xc345('0x3c')]);return db[_0xc345('0x26')][_0xc345('0x43')](_0x1b74e9)[_0xc345('0x21')](handleEntityNotFound(_0x51f08b,null))['then'](respondWithResult(_0x51f08b,null))[_0xc345('0x44')](handleError(_0x51f08b,null));};exports[_0xc345('0x45')]=function(_0x32d7b,_0x358a32){return db[_0xc345('0x26')][_0xc345('0x45')](_0x32d7b[_0xc345('0x46')],{})[_0xc345('0x21')](respondWithResult(_0x358a32,0xc9))[_0xc345('0x44')](handleError(_0x358a32,null));};exports[_0xc345('0x20')]=function(_0x40cdcc,_0x4f5d18){if(_0x40cdcc[_0xc345('0x46')]['id']){delete _0x40cdcc[_0xc345('0x46')]['id'];}return db[_0xc345('0x26')][_0xc345('0x43')]({'where':{'id':_0x40cdcc[_0xc345('0x42')]['id']}})[_0xc345('0x21')](handleEntityNotFound(_0x4f5d18,null))[_0xc345('0x21')](saveUpdates(_0x40cdcc['body'],null))['then'](respondWithResult(_0x4f5d18,null))['catch'](handleError(_0x4f5d18,null));};exports[_0xc345('0x22')]=function(_0x4e2dca,_0x51d0a5){return db[_0xc345('0x26')][_0xc345('0x43')]({'where':{'id':_0x4e2dca[_0xc345('0x42')]['id']}})[_0xc345('0x21')](handleEntityNotFound(_0x51d0a5,null))[_0xc345('0x21')](removeEntity(_0x51d0a5,null))[_0xc345('0x44')](handleError(_0x51d0a5,null));};exports['getConfigurations']=function(_0x16deb7,_0x2eb7cb,_0x429bc5){var _0x283edd={};var _0x4c76ca={};var _0x436578;var _0x490458;return db[_0xc345('0x26')]['findOne']({'where':{'id':_0x16deb7[_0xc345('0x42')]['id']}})[_0xc345('0x21')](handleEntityNotFound(_0x2eb7cb,null))[_0xc345('0x21')](function(_0x1fc2eb){if(_0x1fc2eb){_0x436578=_0x1fc2eb;_0x4c76ca[_0xc345('0x2a')]=_[_0xc345('0x2c')](db['VtigerConfiguration'][_0xc345('0x27')]);_0x4c76ca[_0xc345('0x2b')]=_[_0xc345('0x2c')](_0x16deb7[_0xc345('0x2b')]);_0x4c76ca['filters']=_[_0xc345('0x2d')](_0x4c76ca[_0xc345('0x2a')],_0x4c76ca[_0xc345('0x2b')]);_0x283edd['attributes']=_[_0xc345('0x2d')](_0x4c76ca[_0xc345('0x2a')],qs[_0xc345('0x2f')](_0x16deb7[_0xc345('0x2b')][_0xc345('0x2f')]));_0x283edd[_0xc345('0x2e')]=_0x283edd['attributes'][_0xc345('0x30')]?_0x283edd[_0xc345('0x2e')]:_0x4c76ca[_0xc345('0x2a')];_0x283edd[_0xc345('0x47')]=qs[_0xc345('0x33')](_0x16deb7[_0xc345('0x2b')][_0xc345('0x33')]);_0x283edd['where']=qs[_0xc345('0x35')](_[_0xc345('0x36')](_0x16deb7['query'],_0x4c76ca[_0xc345('0x35')]));if(_0x16deb7['query']['filter']){_0x283edd['where']=_[_0xc345('0x38')](_0x283edd[_0xc345('0x34')],{'$or':_['map'](_0x283edd[_0xc345('0x2e')],function(_0x350430){var _0x4d49e8={};_0x4d49e8[_0x350430]={'$like':'%'+_0x16deb7[_0xc345('0x2b')]['filter']+'%'};return _0x4d49e8;})});}_0x283edd=_[_0xc345('0x38')]({},_0x283edd,_0x16deb7['options']);return _0x436578['getConfigurations'](_0x283edd);}})[_0xc345('0x21')](function(_0x49539e){if(_0x49539e){_0x490458=_0x49539e[_0xc345('0x30')];if(!_0x16deb7[_0xc345('0x2b')][_0xc345('0x31')](_0xc345('0x32'))){_0x283edd['limit']=qs[_0xc345('0x1b')](_0x16deb7[_0xc345('0x2b')][_0xc345('0x1b')]);_0x283edd[_0xc345('0x19')]=qs[_0xc345('0x19')](_0x16deb7['query'][_0xc345('0x19')]);}return _0x436578['getConfigurations'](_0x283edd);}})[_0xc345('0x21')](function(_0x1ea599){if(_0x1ea599){return _0x1ea599?{'count':_0x490458,'rows':_0x1ea599}:null;}})[_0xc345('0x21')](respondWithResult(_0x2eb7cb,null))[_0xc345('0x44')](handleError(_0x2eb7cb,null));};exports[_0xc345('0x48')]=function(_0x50fd28,_0x2e35e7,_0xb0521f){if(_0x50fd28[_0xc345('0x46')]['id']){delete _0x50fd28[_0xc345('0x46')]['id'];}return db[_0xc345('0x26')][_0xc345('0x49')]({'where':{'id':_0x50fd28[_0xc345('0x42')]['id']}})[_0xc345('0x21')](handleEntityNotFound(_0x2e35e7,null))['then'](function(_0x1d7041){if(_0x1d7041){_0x50fd28[_0xc345('0x46')][_0xc345('0x4a')]=_0x1d7041['id'];_0x50fd28[_0xc345('0x46')][_0xc345('0x4b')]=integrations[_0xc345('0x4c')](_0x50fd28[_0xc345('0x46')][_0xc345('0x4d')],_0x50fd28[_0xc345('0x46')][_0xc345('0x3a')]);_0x50fd28[_0xc345('0x46')][_0xc345('0x4e')]=integrations[_0xc345('0x4f')](_0x50fd28[_0xc345('0x46')][_0xc345('0x4d')],_0x50fd28[_0xc345('0x46')][_0xc345('0x3a')]);return db[_0xc345('0x50')][_0xc345('0x45')](_0x50fd28[_0xc345('0x46')],{'include':[{'model':db['VtigerField'],'as':_0xc345('0x4b')},{'model':db['VtigerField'],'as':_0xc345('0x4e')}]});}return null;})[_0xc345('0x21')](respondWithResult(_0x2e35e7,null))[_0xc345('0x44')](handleError(_0x2e35e7,null));};var md5=require(_0xc345('0x51'));exports[_0xc345('0x52')]=function(_0x34dc1b,_0x5ce822,_0x5000b3){var _0x3efbf1=null;var _0x10555d=null;var _0xf1dcad=null;var _0xd075c4=null;var _0x5b178a='';return db[_0xc345('0x26')][_0xc345('0x49')]({'where':{'id':_0x34dc1b[_0xc345('0x42')]['id']},'attributes':['id',_0xc345('0x23'),'username',_0xc345('0x53'),'moduleName',_0xc345('0x54'),_0xc345('0x55'),'accessKey']})['then'](handleEntityNotFound(_0x5ce822,null))[_0xc345('0x21')](function(_0x2ab792){if(_0x2ab792){_0x3efbf1=_0x2ab792[_0xc345('0x56')];_0x10555d=_0x2ab792[_0xc345('0x57')];_0xf1dcad=_0x2ab792[_0xc345('0x58')];_0x5b178a=_0x2ab792[_0xc345('0x54')];var _0x4834b4=_0x5b178a[_0xc345('0x59')](-0x1);if(_0x4834b4==='/'){_0x5b178a=_0x5b178a[_0xc345('0x5a')](0x0,_0x5b178a[_0xc345('0x5b')](_0x4834b4));}_0xd075c4=util[_0xc345('0x5c')](_0xc345('0x5d'),_0x5b178a);var _0x5503cf={'method':_0xc345('0x5e'),'uri':_0xd075c4,'qs':{'operation':_0xc345('0x5f'),'username':_0x2ab792[_0xc345('0x56')]},'json':!![]};return rp(_0x5503cf);}})[_0xc345('0x21')](function(_0x1d8809){if(_0x1d8809[_0xc345('0x60')]){var _0x325b31={'method':_0xc345('0x61'),'uri':_0xd075c4,'form':{'operation':_0xc345('0x62'),'username':_0x3efbf1,'accessKey':md5(_0x1d8809[_0xc345('0x63')]['token']+_0x10555d)},'json':!![]};return rp(_0x325b31);}})[_0xc345('0x21')](function(_0x620b40){if(_0x620b40[_0xc345('0x60')]){var _0x5ae1e7={'method':_0xc345('0x5e'),'uri':_0xd075c4,'qs':{'operation':_0xc345('0x64'),'username':_0x3efbf1,'sessionName':_0x620b40[_0xc345('0x63')][_0xc345('0x65')],'elementType':_0xf1dcad},'json':!![]};return rp(_0x5ae1e7);}})['then'](function(_0x42c43a){if(_0x42c43a[_0xc345('0x60')]){var _0x5570ee=['autogenerated',_0xc345('0x66'),_0xc345('0x67')];_[_0xc345('0x68')](_0x42c43a['result'][_0xc345('0x2f')],function(_0x42190d){return _0x5570ee['includes'](_0x42190d[_0xc345('0x3a')]['name']);});_[_0xc345('0x68')](_0x42c43a[_0xc345('0x63')][_0xc345('0x2f')],function(_0x283a82){return _0x283a82['editable']===_0xc345('0x69');});return{'count':_0x42c43a[_0xc345('0x63')][_0xc345('0x2f')][_0xc345('0x30')],'rows':_[_0xc345('0x39')](_0x42c43a[_0xc345('0x63')][_0xc345('0x2f')],function(_0x58b8e9){return{'id':_0x58b8e9[_0xc345('0x23')],'name':_0x58b8e9['label'],'custom':_[_0xc345('0x6a')](_0x58b8e9[_0xc345('0x23')],_0xc345('0x6b'))?!![]:![],'options':_0x58b8e9[_0xc345('0x3a')]['name']==='picklist'&&_0x58b8e9[_0xc345('0x3a')][_0xc345('0x6c')][_0xc345('0x30')]>0x0?_['map'](_0x58b8e9[_0xc345('0x3a')][_0xc345('0x6c')],function(_0x1cbcc8){return{'name':_0x1cbcc8[_0xc345('0x6d')],'value':_0x1cbcc8[_0xc345('0x6e')]};}):[]};})};}})[_0xc345('0x21')](respondWithResult(_0x5ce822,null))[_0xc345('0x44')](function(_0x27abb6){console[_0xc345('0x6f')](_0xc345('0x70')+_0x27abb6);var _0x2b025e=_0x34dc1b[_0xc345('0x2b')][_0xc345('0x71')]?0x1f4:_0x27abb6[_0xc345('0x72')]||0x1f4;logger[_0xc345('0x73')](_0xc345('0x74'),'getFields',_0x2b025e,JSON['stringify'](_0x27abb6));delete _0x27abb6[_0xc345('0x23')];if(_0x2b025e===0x191){_0x2b025e=0x190;}_0x5ce822[_0xc345('0x16')](_0x2b025e)[_0xc345('0x24')](_0x34dc1b[_0xc345('0x2b')][_0xc345('0x71')]?{'message':_0xc345('0x75'),'statusCode':_0x27abb6[_0xc345('0x72')]}:_0x27abb6);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index d2c7039..3e4a6e1 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 _0xb429=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','api','moment','bluebird'];(function(_0x26a08c,_0x58de7f){var _0x12e4e4=function(_0x1d20d6){while(--_0x1d20d6){_0x26a08c['push'](_0x26a08c['shift']());}};_0x12e4e4(++_0x58de7f);}(_0xb429,0x13e));var _0x9b42=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xb429[_0x43d11d];return _0x38cd08;};'use strict';var _=require('lodash');var util=require(_0x9b42('0x0'));var logger=require('../../config/logger')(_0x9b42('0x1'));var moment=require(_0x9b42('0x2'));var BPromise=require(_0x9b42('0x3'));var rp=require(_0x9b42('0x4'));var fs=require('fs');var path=require(_0x9b42('0x5'));var rimraf=require(_0x9b42('0x6'));var config=require(_0x9b42('0x7'));var attributes=require(_0x9b42('0x8'));var integrations=require(_0x9b42('0x9'));module[_0x9b42('0xa')]=function(_0x1dd1d6,_0x39d7f4){return _0x1dd1d6[_0x9b42('0xb')](_0x9b42('0xc'),attributes,{'tableName':_0x9b42('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3782=['lodash','../../config/logger','api','bluebird','path','../../config/environment','exports','define','VtigerAccount'];(function(_0x335a4b,_0x1b8f1f){var _0x4d5319=function(_0xd91544){while(--_0xd91544){_0x335a4b['push'](_0x335a4b['shift']());}};_0x4d5319(++_0x1b8f1f);}(_0x3782,0x90));var _0x2378=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3782[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2378('0x0'));var util=require('util');var logger=require(_0x2378('0x1'))(_0x2378('0x2'));var moment=require('moment');var BPromise=require(_0x2378('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2378('0x4'));var rimraf=require('rimraf');var config=require(_0x2378('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x2378('0x6')]=function(_0x3733e0,_0x23e6a7){return _0x3733e0[_0x2378('0x7')](_0x2378('0x8'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index b2668ac..5f94603 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 _0xbaf0=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x6c0b0a,_0x496391){var _0x5f456a=function(_0x5ae918){while(--_0x5ae918){_0x6c0b0a['push'](_0x6c0b0a['shift']());}};_0x5f456a(++_0x496391);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetVtigerAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowVtigerAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0xbdb7=['model','map','ShowVtigerAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','attributes','limit','include'];(function(_0x239dc7,_0x10df14){var _0x1ee670=function(_0x58a16b){while(--_0x58a16b){_0x239dc7['push'](_0x239dc7['shift']());}};_0x1ee670(++_0x10df14);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5bc4ca,_0x21f738){_0x5bc4ca=_0x5bc4ca-0x0;var _0x12bf3b=_0xbdb7[_0x5bc4ca];return _0x12bf3b;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}exports[_0x7bdb('0x15')]=function(_0x5723f4){var _0x2aff6a=this;return new Promise(function(_0x4ffd4b,_0x41f540){return db[_0x7bdb('0x16')]['findAll']({'raw':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')]['where']||null:null,'attributes':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x19')]||null:null,'limit':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1a')]||null:null,'include':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_['map'](_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')],function(_0x40c447){return{'model':db[_0x40c447[_0x7bdb('0x1c')]],'as':_0x40c447['as'],'attributes':_0x40c447['attributes'],'include':_0x40c447['include']?_[_0x7bdb('0x1d')](_0x40c447['include'],function(_0x47abaf){return{'model':db[_0x47abaf['model']],'as':_0x47abaf['as'],'attributes':_0x47abaf[_0x7bdb('0x19')],'include':_0x47abaf['include']?_[_0x7bdb('0x1d')](_0x47abaf[_0x7bdb('0x1b')],function(_0x3ec129){return{'model':db[_0x3ec129[_0x7bdb('0x1c')]],'as':_0x3ec129['as'],'attributes':_0x3ec129[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10e818){logger[_0x7bdb('0xb')](_0x7bdb('0x15'),_0x5723f4);logger[_0x7bdb('0xe')](_0x7bdb('0x15'),_0x5723f4,JSON[_0x7bdb('0x10')](_0x10e818));_0x4ffd4b(_0x10e818);})[_0x7bdb('0x14')](function(_0xd2d7be){logger[_0x7bdb('0x11')](_0x7bdb('0x15'),_0xd2d7be[_0x7bdb('0x12')],_0x5723f4);_0x41f540(_0x2aff6a[_0x7bdb('0x11')](0x1f4,_0xd2d7be['message']));});});};exports[_0x7bdb('0x1e')]=function(_0x23fc3a){var _0x8f7672=this;return new Promise(function(_0x9f5c1,_0x29eac5){return db['VtigerAccount'][_0x7bdb('0x1f')]({'raw':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x23fc3a['options']?_0x23fc3a['options']['where']||null:null,'attributes':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a['options'][_0x7bdb('0x19')]||null:null,'include':_0x23fc3a['options']?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x23fc3a['options'][_0x7bdb('0x1b')],function(_0x514713){return{'model':db[_0x514713['model']],'as':_0x514713['as'],'attributes':_0x514713[_0x7bdb('0x19')],'include':_0x514713['include']?_[_0x7bdb('0x1d')](_0x514713['include'],function(_0x5ee47d){return{'model':db[_0x5ee47d[_0x7bdb('0x1c')]],'as':_0x5ee47d['as'],'attributes':_0x5ee47d[_0x7bdb('0x19')],'include':_0x5ee47d[_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x5ee47d[_0x7bdb('0x1b')],function(_0x2bb28a){return{'model':db[_0x2bb28a['model']],'as':_0x2bb28a['as'],'attributes':_0x2bb28a[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7bdb('0x20')](function(_0x329ecf){logger[_0x7bdb('0xb')](_0x7bdb('0x1e'),_0x23fc3a);logger[_0x7bdb('0xe')](_0x7bdb('0x1e'),_0x23fc3a,JSON[_0x7bdb('0x10')](_0x329ecf));_0x9f5c1(_0x329ecf);})[_0x7bdb('0x14')](function(_0x4e1c97){logger['error'](_0x7bdb('0x1e'),_0x4e1c97[_0x7bdb('0x12')],_0x23fc3a);_0x29eac5(_0x8f7672[_0x7bdb('0x11')](0x1f4,_0x4e1c97[_0x7bdb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 851b5ce..75562ed 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 _0xe825=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','getDescriptions','create','put','update','delete','destroy'];(function(_0x23ec37,_0x4d02b8){var _0x3a4470=function(_0x4d6aac){while(--_0x4d6aac){_0x23ec37['push'](_0x23ec37['shift']());}};_0x3a4470(++_0x4d02b8);}(_0xe825,0x105));var _0x5e82=function(_0x3bce42,_0x5caf64){_0x3bce42=_0x3bce42-0x0;var _0x2ce0a2=_0xe825[_0x3bce42];return _0x2ce0a2;};'use strict';var multer=require(_0x5e82('0x0'));var util=require(_0x5e82('0x1'));var path=require(_0x5e82('0x2'));var timeout=require(_0x5e82('0x3'));var express=require(_0x5e82('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5e82('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5e82('0x6'));var controller=require(_0x5e82('0x7'));router[_0x5e82('0x8')]('/',auth[_0x5e82('0x9')](),controller[_0x5e82('0xa')]);router['get'](_0x5e82('0xb'),auth[_0x5e82('0x9')](),controller[_0x5e82('0xc')]);router[_0x5e82('0x8')]('/:id/fields',auth[_0x5e82('0x9')](),controller['getFields']);router[_0x5e82('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5e82('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5e82('0xe')]);router[_0x5e82('0xf')](_0x5e82('0xb'),auth['isAuthenticated'](),controller[_0x5e82('0x10')]);router[_0x5e82('0x11')](_0x5e82('0xb'),auth[_0x5e82('0x9')](),controller[_0x5e82('0x12')]);module[_0x5e82('0x13')]=router; \ No newline at end of file +var _0x79f9=['delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/subjects','getDescriptions','post','create','put','update'];(function(_0x4390cb,_0x198df3){var _0x1df844=function(_0x588ca6){while(--_0x588ca6){_0x4390cb['push'](_0x4390cb['shift']());}};_0x1df844(++_0x198df3);}(_0x79f9,0x1ca));var _0x979f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x79f9[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x979f('0x0'));var timeout=require(_0x979f('0x1'));var express=require(_0x979f('0x2'));var router=express[_0x979f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x979f('0x4'));var interaction=require(_0x979f('0x5'));var config=require(_0x979f('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x979f('0x7')]('/',auth[_0x979f('0x8')](),controller['index']);router['get'](_0x979f('0x9'),auth[_0x979f('0x8')](),controller[_0x979f('0xa')]);router[_0x979f('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0x979f('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x979f('0x7')]('/:id/descriptions',auth[_0x979f('0x8')](),controller[_0x979f('0xc')]);router[_0x979f('0xd')]('/',auth[_0x979f('0x8')](),controller[_0x979f('0xe')]);router[_0x979f('0xf')](_0x979f('0x9'),auth[_0x979f('0x8')](),controller[_0x979f('0x10')]);router[_0x979f('0x11')](_0x979f('0x9'),auth['isAuthenticated'](),controller[_0x979f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 0f2138f..61ce0ea 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 _0x5adc=['exports','STRING'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x5adc,0x184));var _0xc5ad=function(_0x4eee76,_0x2780c9){_0x4eee76=_0x4eee76-0x0;var _0x47fb6b=_0x5adc[_0x4eee76];return _0x47fb6b;};'use strict';var Sequelize=require('sequelize');module[_0xc5ad('0x0')]={'name':{'type':Sequelize[_0xc5ad('0x1')]},'description':{'type':Sequelize[_0xc5ad('0x1')]}}; \ No newline at end of file +var _0x2791=['exports','STRING'];(function(_0x33314d,_0x499628){var _0x4ffe8e=function(_0xb1ec35){while(--_0xb1ec35){_0x33314d['push'](_0x33314d['shift']());}};_0x4ffe8e(++_0x499628);}(_0x2791,0x1c6));var _0x1279=function(_0x3459a9,_0x245ed1){_0x3459a9=_0x3459a9-0x0;var _0xa93e60=_0x2791[_0x3459a9];return _0xa93e60;};'use strict';var Sequelize=require('sequelize');module[_0x1279('0x0')]={'name':{'type':Sequelize[_0x1279('0x1')]},'description':{'type':Sequelize[_0x1279('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 7955614..4781234 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 _0x8801=['hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','getFields','findOne','VtigerField','intersection','pick','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','filters','query','attributes','fields','length'];(function(_0x1889e8,_0x30b3df){var _0x3a8bac=function(_0x1f2e64){while(--_0x1f2e64){_0x1889e8['push'](_0x1889e8['shift']());}};_0x3a8bac(++_0x30b3df);}(_0x8801,0x116));var _0x1880=function(_0xc1245f,_0x931ed1){_0xc1245f=_0xc1245f-0x0;var _0x1085cf=_0x8801[_0xc1245f];return _0x1085cf;};'use strict';var emlformat=require(_0x1880('0x0'));var rimraf=require(_0x1880('0x1'));var zipdir=require(_0x1880('0x2'));var jsonpatch=require(_0x1880('0x3'));var rp=require(_0x1880('0x4'));var moment=require(_0x1880('0x5'));var BPromise=require(_0x1880('0x6'));var Mustache=require(_0x1880('0x7'));var util=require(_0x1880('0x8'));var path=require(_0x1880('0x9'));var sox=require(_0x1880('0xa'));var csv=require(_0x1880('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1880('0xc'));var _=require('lodash');var squel=require(_0x1880('0xd'));var crypto=require(_0x1880('0xe'));var jsforce=require(_0x1880('0xf'));var deskjs=require(_0x1880('0x10'));var toCsv=require(_0x1880('0xb'));var querystring=require(_0x1880('0x11'));var Papa=require(_0x1880('0x12'));var Redis=require(_0x1880('0x13'));var authService=require(_0x1880('0x14'));var qs=require(_0x1880('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1880('0x16'));var logger=require(_0x1880('0x17'))(_0x1880('0x18'));var utils=require('../../config/utils');var config=require(_0x1880('0x19'));var licenseUtil=require(_0x1880('0x1a'));var db=require(_0x1880('0x1b'))['db'];function respondWithStatusCode(_0x6ba8ec,_0x187119){_0x187119=_0x187119||0xcc;return function(_0x2ae070){if(_0x2ae070){return _0x6ba8ec['sendStatus'](_0x187119);}return _0x6ba8ec[_0x1880('0x1c')](_0x187119)['end']();};}function respondWithResult(_0x31c5a5,_0xcf3c10){_0xcf3c10=_0xcf3c10||0xc8;return function(_0x18f695){if(_0x18f695){return _0x31c5a5['status'](_0xcf3c10)[_0x1880('0x1d')](_0x18f695);}};}function respondWithFilteredResult(_0x483037,_0x1738c9){return function(_0x3894d2){if(_0x3894d2){var _0x33f22f=typeof _0x1738c9[_0x1880('0x1e')]===_0x1880('0x1f')&&typeof _0x1738c9[_0x1880('0x20')]==='undefined';var _0x44779=_0x3894d2['count'];var _0x1d5b22=_0x33f22f?0x0:_0x1738c9['offset'];var _0x21e338=_0x33f22f?_0x3894d2[_0x1880('0x21')]:_0x1738c9[_0x1880('0x1e')]+_0x1738c9[_0x1880('0x20')];var _0x157fde;if(_0x21e338>=_0x44779){_0x21e338=_0x44779;_0x157fde=0xc8;}else{_0x157fde=0xce;}_0x483037['status'](_0x157fde);return _0x483037['set'](_0x1880('0x22'),_0x1d5b22+'-'+_0x21e338+'/'+_0x44779)['json'](_0x3894d2);}return null;};}function patchUpdates(_0x48f87d){return function(_0x3ef800){try{jsonpatch[_0x1880('0x23')](_0x3ef800,_0x48f87d,!![]);}catch(_0x4a6656){return BPromise[_0x1880('0x24')](_0x4a6656);}return _0x3ef800[_0x1880('0x25')]();};}function saveUpdates(_0x51c231,_0x1bf2ba){return function(_0x3a553e){if(_0x3a553e){return _0x3a553e[_0x1880('0x26')](_0x51c231)[_0x1880('0x27')](function(_0x547b88){return _0x547b88;});}return null;};}function removeEntity(_0x1a03cf,_0x296e74){return function(_0x291b60){if(_0x291b60){return _0x291b60['destroy']()[_0x1880('0x27')](function(){_0x1a03cf[_0x1880('0x1c')](0xcc)[_0x1880('0x28')]();});}};}function handleEntityNotFound(_0x27d693,_0x26f0a3){return function(_0x20a706){if(!_0x20a706){_0x27d693[_0x1880('0x29')](0x194);}return _0x20a706;};}function handleError(_0xaa6cbb,_0x37f70e){_0x37f70e=_0x37f70e||0x1f4;return function(_0x1f6fb4){logger[_0x1880('0x2a')](_0x1f6fb4[_0x1880('0x2b')]);if(_0x1f6fb4[_0x1880('0x2c')]){delete _0x1f6fb4['name'];}_0xaa6cbb[_0x1880('0x1c')](_0x37f70e)[_0x1880('0x2d')](_0x1f6fb4);};}exports[_0x1880('0x2e')]=function(_0x11ca44,_0x323f23){var _0x11f2d5={},_0x159a9d={},_0x1f56c0={'count':0x0,'rows':[]};var _0xbadce3=_[_0x1880('0x2f')](db[_0x1880('0x30')][_0x1880('0x31')],function(_0x9a1a64){return{'name':_0x9a1a64['fieldName'],'type':_0x9a1a64[_0x1880('0x32')][_0x1880('0x33')]};});_0x159a9d[_0x1880('0x34')]=_['map'](_0xbadce3,_0x1880('0x2c'));_0x159a9d['query']=_['keys'](_0x11ca44['query']);_0x159a9d[_0x1880('0x35')]=_['intersection'](_0x159a9d[_0x1880('0x34')],_0x159a9d[_0x1880('0x36')]);_0x11f2d5[_0x1880('0x37')]=_['intersection'](_0x159a9d[_0x1880('0x34')],qs[_0x1880('0x38')](_0x11ca44[_0x1880('0x36')][_0x1880('0x38')]));_0x11f2d5[_0x1880('0x37')]=_0x11f2d5[_0x1880('0x37')][_0x1880('0x39')]?_0x11f2d5['attributes']:_0x159a9d[_0x1880('0x34')];if(!_0x11ca44[_0x1880('0x36')][_0x1880('0x3a')]('nolimit')){_0x11f2d5['limit']=qs[_0x1880('0x20')](_0x11ca44[_0x1880('0x36')][_0x1880('0x20')]);_0x11f2d5[_0x1880('0x1e')]=qs[_0x1880('0x1e')](_0x11ca44['query'][_0x1880('0x1e')]);}_0x11f2d5[_0x1880('0x3b')]=qs[_0x1880('0x3c')](_0x11ca44[_0x1880('0x36')][_0x1880('0x3c')]);_0x11f2d5[_0x1880('0x3d')]=qs['filters'](_['pick'](_0x11ca44['query'],_0x159a9d[_0x1880('0x35')]),_0xbadce3);if(_0x11ca44['query'][_0x1880('0x3e')]){_0x11f2d5[_0x1880('0x3d')]=_['merge'](_0x11f2d5[_0x1880('0x3d')],{'$or':_['map'](_0xbadce3,function(_0x6b54aa){if(_0x6b54aa['type']!==_0x1880('0x3f')){var _0x102f11={};_0x102f11[_0x6b54aa[_0x1880('0x2c')]]={'$like':'%'+_0x11ca44[_0x1880('0x36')]['filter']+'%'};return _0x102f11;}})});}_0x11f2d5=_[_0x1880('0x40')]({},_0x11f2d5,_0x11ca44[_0x1880('0x41')]);var _0x38c544={'where':_0x11f2d5[_0x1880('0x3d')]};return db[_0x1880('0x30')]['count'](_0x38c544)['then'](function(_0x3107a3){_0x1f56c0[_0x1880('0x21')]=_0x3107a3;if(_0x11ca44[_0x1880('0x36')][_0x1880('0x42')]){_0x11f2d5[_0x1880('0x43')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x1880('0x44')](_0x11f2d5);})[_0x1880('0x27')](function(_0x422cf8){_0x1f56c0['rows']=_0x422cf8;return _0x1f56c0;})[_0x1880('0x27')](respondWithFilteredResult(_0x323f23,_0x11f2d5))[_0x1880('0x45')](handleError(_0x323f23,null));};exports[_0x1880('0x46')]=function(_0xb894ba,_0x3713f2){var _0x44e57f={'raw':![],'where':{'id':_0xb894ba[_0x1880('0x47')]['id']}},_0x434dd4={};_0x434dd4[_0x1880('0x34')]=_[_0x1880('0x48')](db[_0x1880('0x30')][_0x1880('0x31')]);_0x434dd4[_0x1880('0x36')]=_[_0x1880('0x48')](_0xb894ba[_0x1880('0x36')]);_0x434dd4[_0x1880('0x35')]=_['intersection'](_0x434dd4[_0x1880('0x34')],_0x434dd4[_0x1880('0x36')]);_0x44e57f[_0x1880('0x37')]=_['intersection'](_0x434dd4[_0x1880('0x34')],qs[_0x1880('0x38')](_0xb894ba[_0x1880('0x36')][_0x1880('0x38')]));_0x44e57f[_0x1880('0x37')]=_0x44e57f['attributes'][_0x1880('0x39')]?_0x44e57f[_0x1880('0x37')]:_0x434dd4[_0x1880('0x34')];if(_0xb894ba[_0x1880('0x36')][_0x1880('0x42')]){_0x44e57f[_0x1880('0x43')]=[{'all':!![]}];}_0x44e57f=_[_0x1880('0x40')]({},_0x44e57f,_0xb894ba[_0x1880('0x41')]);return db[_0x1880('0x30')][_0x1880('0x49')](_0x44e57f)[_0x1880('0x27')](handleEntityNotFound(_0x3713f2,null))['then'](respondWithResult(_0x3713f2,null))[_0x1880('0x45')](handleError(_0x3713f2,null));};exports[_0x1880('0x4a')]=function(_0xf48c9b,_0x42d874){return db[_0x1880('0x30')]['create'](_0xf48c9b[_0x1880('0x4b')],{})[_0x1880('0x27')](respondWithResult(_0x42d874,0xc9))[_0x1880('0x45')](handleError(_0x42d874,null));};exports[_0x1880('0x26')]=function(_0x1c15a8,_0x9983a9){if(_0x1c15a8[_0x1880('0x4b')]['id']){delete _0x1c15a8[_0x1880('0x4b')]['id'];}return db[_0x1880('0x30')][_0x1880('0x49')]({'where':{'id':_0x1c15a8[_0x1880('0x47')]['id']}})[_0x1880('0x27')](handleEntityNotFound(_0x9983a9,null))['then'](saveUpdates(_0x1c15a8[_0x1880('0x4b')],null))['then'](respondWithResult(_0x9983a9,null))[_0x1880('0x45')](handleError(_0x9983a9,null));};exports[_0x1880('0x4c')]=function(_0x4585d0,_0x335922){return db[_0x1880('0x30')][_0x1880('0x49')]({'where':{'id':_0x4585d0[_0x1880('0x47')]['id']}})[_0x1880('0x27')](handleEntityNotFound(_0x335922,null))[_0x1880('0x27')](removeEntity(_0x335922,null))[_0x1880('0x45')](handleError(_0x335922,null));};exports[_0x1880('0x4d')]=function(_0x321d11,_0x13e7e6,_0x549d11){var _0x5cae6f={};var _0x5281cf={};var _0x15544e;var _0x16668d;return db[_0x1880('0x30')][_0x1880('0x4e')]({'where':{'id':_0x321d11['params']['id']}})[_0x1880('0x27')](handleEntityNotFound(_0x13e7e6,null))[_0x1880('0x27')](function(_0x40b228){if(_0x40b228){_0x15544e=_0x40b228;_0x5281cf[_0x1880('0x34')]=_['keys'](db[_0x1880('0x4f')]['rawAttributes']);_0x5281cf[_0x1880('0x36')]=_[_0x1880('0x48')](_0x321d11[_0x1880('0x36')]);_0x5281cf[_0x1880('0x35')]=_[_0x1880('0x50')](_0x5281cf[_0x1880('0x34')],_0x5281cf[_0x1880('0x36')]);_0x5cae6f[_0x1880('0x37')]=_[_0x1880('0x50')](_0x5281cf[_0x1880('0x34')],qs[_0x1880('0x38')](_0x321d11['query'][_0x1880('0x38')]));_0x5cae6f[_0x1880('0x37')]=_0x5cae6f[_0x1880('0x37')][_0x1880('0x39')]?_0x5cae6f[_0x1880('0x37')]:_0x5281cf['model'];_0x5cae6f[_0x1880('0x3b')]=qs[_0x1880('0x3c')](_0x321d11[_0x1880('0x36')][_0x1880('0x3c')]);_0x5cae6f[_0x1880('0x3d')]=qs[_0x1880('0x35')](_[_0x1880('0x51')](_0x321d11[_0x1880('0x36')],_0x5281cf[_0x1880('0x35')]));if(_0x321d11[_0x1880('0x36')][_0x1880('0x3e')]){_0x5cae6f['where']=_['merge'](_0x5cae6f['where'],{'$or':_[_0x1880('0x2f')](_0x5cae6f[_0x1880('0x37')],function(_0x42a48d){var _0x2b2634={};_0x2b2634[_0x42a48d]={'$like':'%'+_0x321d11[_0x1880('0x36')][_0x1880('0x3e')]+'%'};return _0x2b2634;})});}_0x5cae6f=_[_0x1880('0x40')]({},_0x5cae6f,_0x321d11['options']);return _0x15544e['getFields'](_0x5cae6f);}})['then'](function(_0x71086e){if(_0x71086e){_0x16668d=_0x71086e[_0x1880('0x39')];if(!_0x321d11['query']['hasOwnProperty'](_0x1880('0x52'))){_0x5cae6f[_0x1880('0x20')]=qs[_0x1880('0x20')](_0x321d11[_0x1880('0x36')][_0x1880('0x20')]);_0x5cae6f[_0x1880('0x1e')]=qs['offset'](_0x321d11['query'][_0x1880('0x1e')]);}return _0x15544e['getFields'](_0x5cae6f);}})[_0x1880('0x27')](function(_0x457581){if(_0x457581){return _0x457581?{'count':_0x16668d,'rows':_0x457581}:null;}})['then'](respondWithResult(_0x13e7e6,null))[_0x1880('0x45')](handleError(_0x13e7e6,null));};exports['getSubjects']=function(_0x391a70,_0xd6e352,_0x244673){var _0x4b5ebf={};var _0x18320c={};var _0x193782;var _0x4d83dc;return db[_0x1880('0x30')][_0x1880('0x4e')]({'where':{'id':_0x391a70[_0x1880('0x47')]['id']}})[_0x1880('0x27')](handleEntityNotFound(_0xd6e352,null))[_0x1880('0x27')](function(_0x4bc05e){if(_0x4bc05e){_0x193782=_0x4bc05e;_0x18320c[_0x1880('0x34')]=_['keys'](db[_0x1880('0x4f')][_0x1880('0x31')]);_0x18320c[_0x1880('0x36')]=_[_0x1880('0x48')](_0x391a70[_0x1880('0x36')]);_0x18320c[_0x1880('0x35')]=_['intersection'](_0x18320c[_0x1880('0x34')],_0x18320c['query']);_0x4b5ebf['attributes']=_[_0x1880('0x50')](_0x18320c[_0x1880('0x34')],qs[_0x1880('0x38')](_0x391a70[_0x1880('0x36')][_0x1880('0x38')]));_0x4b5ebf['attributes']=_0x4b5ebf[_0x1880('0x37')][_0x1880('0x39')]?_0x4b5ebf[_0x1880('0x37')]:_0x18320c[_0x1880('0x34')];_0x4b5ebf[_0x1880('0x3b')]=qs[_0x1880('0x3c')](_0x391a70['query'][_0x1880('0x3c')]);_0x4b5ebf[_0x1880('0x3d')]=qs[_0x1880('0x35')](_[_0x1880('0x51')](_0x391a70['query'],_0x18320c[_0x1880('0x35')]));if(_0x391a70[_0x1880('0x36')]['filter']){_0x4b5ebf[_0x1880('0x3d')]=_[_0x1880('0x40')](_0x4b5ebf[_0x1880('0x3d')],{'$or':_[_0x1880('0x2f')](_0x4b5ebf[_0x1880('0x37')],function(_0x38dbbc){var _0x269c3e={};_0x269c3e[_0x38dbbc]={'$like':'%'+_0x391a70['query'][_0x1880('0x3e')]+'%'};return _0x269c3e;})});}_0x4b5ebf=_['merge']({},_0x4b5ebf,_0x391a70[_0x1880('0x41')]);return _0x193782['getSubjects'](_0x4b5ebf);}})[_0x1880('0x27')](function(_0x5664dc){if(_0x5664dc){_0x4d83dc=_0x5664dc[_0x1880('0x39')];if(!_0x391a70['query']['hasOwnProperty'](_0x1880('0x52'))){_0x4b5ebf[_0x1880('0x20')]=qs['limit'](_0x391a70[_0x1880('0x36')][_0x1880('0x20')]);_0x4b5ebf[_0x1880('0x1e')]=qs[_0x1880('0x1e')](_0x391a70['query'][_0x1880('0x1e')]);}return _0x193782['getSubjects'](_0x4b5ebf);}})[_0x1880('0x27')](function(_0x20f1df){if(_0x20f1df){return _0x20f1df?{'count':_0x4d83dc,'rows':_0x20f1df}:null;}})[_0x1880('0x27')](respondWithResult(_0xd6e352,null))[_0x1880('0x45')](handleError(_0xd6e352,null));};exports[_0x1880('0x53')]=function(_0x3a5041,_0x490e83,_0x536460){var _0xc24739={};var _0x4f2a61={};var _0x1c91c3;var _0x1c0309;return db[_0x1880('0x30')]['findOne']({'where':{'id':_0x3a5041[_0x1880('0x47')]['id']}})[_0x1880('0x27')](handleEntityNotFound(_0x490e83,null))['then'](function(_0x42e491){if(_0x42e491){_0x1c91c3=_0x42e491;_0x4f2a61['model']=_['keys'](db[_0x1880('0x4f')][_0x1880('0x31')]);_0x4f2a61[_0x1880('0x36')]=_[_0x1880('0x48')](_0x3a5041['query']);_0x4f2a61['filters']=_[_0x1880('0x50')](_0x4f2a61[_0x1880('0x34')],_0x4f2a61['query']);_0xc24739[_0x1880('0x37')]=_[_0x1880('0x50')](_0x4f2a61[_0x1880('0x34')],qs[_0x1880('0x38')](_0x3a5041[_0x1880('0x36')][_0x1880('0x38')]));_0xc24739[_0x1880('0x37')]=_0xc24739['attributes'][_0x1880('0x39')]?_0xc24739['attributes']:_0x4f2a61[_0x1880('0x34')];_0xc24739[_0x1880('0x3b')]=qs[_0x1880('0x3c')](_0x3a5041[_0x1880('0x36')][_0x1880('0x3c')]);_0xc24739[_0x1880('0x3d')]=qs[_0x1880('0x35')](_['pick'](_0x3a5041[_0x1880('0x36')],_0x4f2a61[_0x1880('0x35')]));if(_0x3a5041[_0x1880('0x36')]['filter']){_0xc24739[_0x1880('0x3d')]=_[_0x1880('0x40')](_0xc24739[_0x1880('0x3d')],{'$or':_['map'](_0xc24739[_0x1880('0x37')],function(_0x59e363){var _0x34f744={};_0x34f744[_0x59e363]={'$like':'%'+_0x3a5041[_0x1880('0x36')][_0x1880('0x3e')]+'%'};return _0x34f744;})});}_0xc24739=_[_0x1880('0x40')]({},_0xc24739,_0x3a5041[_0x1880('0x41')]);return _0x1c91c3[_0x1880('0x53')](_0xc24739);}})[_0x1880('0x27')](function(_0x422ad8){if(_0x422ad8){_0x1c0309=_0x422ad8[_0x1880('0x39')];if(!_0x3a5041['query'][_0x1880('0x3a')](_0x1880('0x52'))){_0xc24739['limit']=qs['limit'](_0x3a5041[_0x1880('0x36')][_0x1880('0x20')]);_0xc24739[_0x1880('0x1e')]=qs[_0x1880('0x1e')](_0x3a5041[_0x1880('0x36')][_0x1880('0x1e')]);}return _0x1c91c3[_0x1880('0x53')](_0xc24739);}})['then'](function(_0x151c79){if(_0x151c79){return _0x151c79?{'count':_0x1c0309,'rows':_0x151c79}:null;}})[_0x1880('0x27')](respondWithResult(_0x490e83,null))[_0x1880('0x45')](handleError(_0x490e83,null));}; \ No newline at end of file +var _0x5d21=['then','destroy','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','findAll','rows','catch','show','keys','length','includeAll','include','create','body','find','params','getFields','findOne','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update'];(function(_0x5d3313,_0x39c46e){var _0x40b46c=function(_0x37e32a){while(--_0x37e32a){_0x5d3313['push'](_0x5d3313['shift']());}};_0x40b46c(++_0x39c46e);}(_0x5d21,0x178));var _0x15d2=function(_0x1c09e8,_0x30cac4){_0x1c09e8=_0x1c09e8-0x0;var _0x431e42=_0x5d21[_0x1c09e8];return _0x431e42;};'use strict';var emlformat=require(_0x15d2('0x0'));var rimraf=require(_0x15d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15d2('0x2'));var rp=require(_0x15d2('0x3'));var moment=require(_0x15d2('0x4'));var BPromise=require(_0x15d2('0x5'));var Mustache=require(_0x15d2('0x6'));var util=require(_0x15d2('0x7'));var path=require('path');var sox=require(_0x15d2('0x8'));var csv=require(_0x15d2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15d2('0xa'));var _=require(_0x15d2('0xb'));var squel=require(_0x15d2('0xc'));var crypto=require(_0x15d2('0xd'));var jsforce=require(_0x15d2('0xe'));var deskjs=require(_0x15d2('0xf'));var toCsv=require(_0x15d2('0x9'));var querystring=require(_0x15d2('0x10'));var Papa=require(_0x15d2('0x11'));var Redis=require(_0x15d2('0x12'));var authService=require(_0x15d2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x15d2('0x14'));var hardwareService=require(_0x15d2('0x15'));var logger=require(_0x15d2('0x16'))(_0x15d2('0x17'));var utils=require('../../config/utils');var config=require(_0x15d2('0x18'));var licenseUtil=require(_0x15d2('0x19'));var db=require(_0x15d2('0x1a'))['db'];function respondWithStatusCode(_0x1461ec,_0x5ec2ff){_0x5ec2ff=_0x5ec2ff||0xcc;return function(_0x4c33d4){if(_0x4c33d4){return _0x1461ec[_0x15d2('0x1b')](_0x5ec2ff);}return _0x1461ec['status'](_0x5ec2ff)[_0x15d2('0x1c')]();};}function respondWithResult(_0x53c8ae,_0x1cbc48){_0x1cbc48=_0x1cbc48||0xc8;return function(_0x24e817){if(_0x24e817){return _0x53c8ae['status'](_0x1cbc48)[_0x15d2('0x1d')](_0x24e817);}};}function respondWithFilteredResult(_0x4d2fe9,_0x5362e4){return function(_0x580335){if(_0x580335){var _0x274c5e=typeof _0x5362e4[_0x15d2('0x1e')]===_0x15d2('0x1f')&&typeof _0x5362e4[_0x15d2('0x20')]===_0x15d2('0x1f');var _0x29846f=_0x580335[_0x15d2('0x21')];var _0x1201d8=_0x274c5e?0x0:_0x5362e4[_0x15d2('0x1e')];var _0x41b590=_0x274c5e?_0x580335[_0x15d2('0x21')]:_0x5362e4[_0x15d2('0x1e')]+_0x5362e4['limit'];var _0x368c63;if(_0x41b590>=_0x29846f){_0x41b590=_0x29846f;_0x368c63=0xc8;}else{_0x368c63=0xce;}_0x4d2fe9[_0x15d2('0x22')](_0x368c63);return _0x4d2fe9['set']('Content-Range',_0x1201d8+'-'+_0x41b590+'/'+_0x29846f)[_0x15d2('0x1d')](_0x580335);}return null;};}function patchUpdates(_0x363321){return function(_0x28387c){try{jsonpatch[_0x15d2('0x23')](_0x28387c,_0x363321,!![]);}catch(_0x197eee){return BPromise[_0x15d2('0x24')](_0x197eee);}return _0x28387c[_0x15d2('0x25')]();};}function saveUpdates(_0x131da3,_0x184b48){return function(_0xd6d54c){if(_0xd6d54c){return _0xd6d54c[_0x15d2('0x26')](_0x131da3)[_0x15d2('0x27')](function(_0x4c0434){return _0x4c0434;});}return null;};}function removeEntity(_0x5544e7,_0x3e67e7){return function(_0x558601){if(_0x558601){return _0x558601[_0x15d2('0x28')]()[_0x15d2('0x27')](function(){_0x5544e7[_0x15d2('0x22')](0xcc)[_0x15d2('0x1c')]();});}};}function handleEntityNotFound(_0xdd608c,_0x4d678d){return function(_0x353cc7){if(!_0x353cc7){_0xdd608c[_0x15d2('0x1b')](0x194);}return _0x353cc7;};}function handleError(_0x256c77,_0x340e6e){_0x340e6e=_0x340e6e||0x1f4;return function(_0x27fb16){logger[_0x15d2('0x29')](_0x27fb16[_0x15d2('0x2a')]);if(_0x27fb16['name']){delete _0x27fb16[_0x15d2('0x2b')];}_0x256c77[_0x15d2('0x22')](_0x340e6e)[_0x15d2('0x2c')](_0x27fb16);};}exports[_0x15d2('0x2d')]=function(_0x551e24,_0x38643e){var _0x5e65d4={},_0x40b5a8={},_0x3c1734={'count':0x0,'rows':[]};var _0x3441ce=_[_0x15d2('0x2e')](db[_0x15d2('0x2f')][_0x15d2('0x30')],function(_0x1ca1fc){return{'name':_0x1ca1fc['fieldName'],'type':_0x1ca1fc[_0x15d2('0x31')][_0x15d2('0x32')]};});_0x40b5a8['model']=_['map'](_0x3441ce,_0x15d2('0x2b'));_0x40b5a8[_0x15d2('0x33')]=_['keys'](_0x551e24[_0x15d2('0x33')]);_0x40b5a8[_0x15d2('0x34')]=_['intersection'](_0x40b5a8[_0x15d2('0x35')],_0x40b5a8[_0x15d2('0x33')]);_0x5e65d4['attributes']=_[_0x15d2('0x36')](_0x40b5a8[_0x15d2('0x35')],qs[_0x15d2('0x37')](_0x551e24[_0x15d2('0x33')]['fields']));_0x5e65d4[_0x15d2('0x38')]=_0x5e65d4[_0x15d2('0x38')]['length']?_0x5e65d4[_0x15d2('0x38')]:_0x40b5a8[_0x15d2('0x35')];if(!_0x551e24[_0x15d2('0x33')][_0x15d2('0x39')]('nolimit')){_0x5e65d4[_0x15d2('0x20')]=qs[_0x15d2('0x20')](_0x551e24[_0x15d2('0x33')][_0x15d2('0x20')]);_0x5e65d4[_0x15d2('0x1e')]=qs[_0x15d2('0x1e')](_0x551e24[_0x15d2('0x33')][_0x15d2('0x1e')]);}_0x5e65d4[_0x15d2('0x3a')]=qs['sort'](_0x551e24[_0x15d2('0x33')][_0x15d2('0x3b')]);_0x5e65d4[_0x15d2('0x3c')]=qs['filters'](_[_0x15d2('0x3d')](_0x551e24['query'],_0x40b5a8['filters']),_0x3441ce);if(_0x551e24['query']['filter']){_0x5e65d4['where']=_['merge'](_0x5e65d4[_0x15d2('0x3c')],{'$or':_[_0x15d2('0x2e')](_0x3441ce,function(_0x4180bb){if(_0x4180bb[_0x15d2('0x31')]!==_0x15d2('0x3e')){var _0x2f6ece={};_0x2f6ece[_0x4180bb[_0x15d2('0x2b')]]={'$like':'%'+_0x551e24['query'][_0x15d2('0x3f')]+'%'};return _0x2f6ece;}})});}_0x5e65d4=_[_0x15d2('0x40')]({},_0x5e65d4,_0x551e24[_0x15d2('0x41')]);var _0xcd059e={'where':_0x5e65d4[_0x15d2('0x3c')]};return db['VtigerConfiguration']['count'](_0xcd059e)[_0x15d2('0x27')](function(_0x34d3f2){_0x3c1734['count']=_0x34d3f2;if(_0x551e24[_0x15d2('0x33')]['includeAll']){_0x5e65d4['include']=[{'all':!![]}];}return db[_0x15d2('0x2f')][_0x15d2('0x42')](_0x5e65d4);})[_0x15d2('0x27')](function(_0x38e226){_0x3c1734[_0x15d2('0x43')]=_0x38e226;return _0x3c1734;})[_0x15d2('0x27')](respondWithFilteredResult(_0x38643e,_0x5e65d4))[_0x15d2('0x44')](handleError(_0x38643e,null));};exports[_0x15d2('0x45')]=function(_0xb83007,_0x63ceb1){var _0x4df938={'raw':![],'where':{'id':_0xb83007['params']['id']}},_0x217e51={};_0x217e51[_0x15d2('0x35')]=_[_0x15d2('0x46')](db[_0x15d2('0x2f')]['rawAttributes']);_0x217e51[_0x15d2('0x33')]=_[_0x15d2('0x46')](_0xb83007[_0x15d2('0x33')]);_0x217e51['filters']=_['intersection'](_0x217e51['model'],_0x217e51[_0x15d2('0x33')]);_0x4df938[_0x15d2('0x38')]=_[_0x15d2('0x36')](_0x217e51['model'],qs[_0x15d2('0x37')](_0xb83007[_0x15d2('0x33')][_0x15d2('0x37')]));_0x4df938['attributes']=_0x4df938['attributes'][_0x15d2('0x47')]?_0x4df938['attributes']:_0x217e51['model'];if(_0xb83007[_0x15d2('0x33')][_0x15d2('0x48')]){_0x4df938[_0x15d2('0x49')]=[{'all':!![]}];}_0x4df938=_[_0x15d2('0x40')]({},_0x4df938,_0xb83007[_0x15d2('0x41')]);return db[_0x15d2('0x2f')]['find'](_0x4df938)['then'](handleEntityNotFound(_0x63ceb1,null))[_0x15d2('0x27')](respondWithResult(_0x63ceb1,null))[_0x15d2('0x44')](handleError(_0x63ceb1,null));};exports[_0x15d2('0x4a')]=function(_0x6e40eb,_0xf3edc0){return db[_0x15d2('0x2f')][_0x15d2('0x4a')](_0x6e40eb[_0x15d2('0x4b')],{})[_0x15d2('0x27')](respondWithResult(_0xf3edc0,0xc9))[_0x15d2('0x44')](handleError(_0xf3edc0,null));};exports[_0x15d2('0x26')]=function(_0x14844d,_0x59e4e8){if(_0x14844d[_0x15d2('0x4b')]['id']){delete _0x14844d[_0x15d2('0x4b')]['id'];}return db[_0x15d2('0x2f')][_0x15d2('0x4c')]({'where':{'id':_0x14844d[_0x15d2('0x4d')]['id']}})[_0x15d2('0x27')](handleEntityNotFound(_0x59e4e8,null))[_0x15d2('0x27')](saveUpdates(_0x14844d[_0x15d2('0x4b')],null))[_0x15d2('0x27')](respondWithResult(_0x59e4e8,null))['catch'](handleError(_0x59e4e8,null));};exports[_0x15d2('0x28')]=function(_0xb7613f,_0x27abc7){return db[_0x15d2('0x2f')][_0x15d2('0x4c')]({'where':{'id':_0xb7613f[_0x15d2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x27abc7,null))['then'](removeEntity(_0x27abc7,null))[_0x15d2('0x44')](handleError(_0x27abc7,null));};exports[_0x15d2('0x4e')]=function(_0x16b941,_0x2815b9,_0x3edbbf){var _0x515168={};var _0x59621b={};var _0x2c7091;var _0x200986;return db['VtigerConfiguration'][_0x15d2('0x4f')]({'where':{'id':_0x16b941['params']['id']}})[_0x15d2('0x27')](handleEntityNotFound(_0x2815b9,null))[_0x15d2('0x27')](function(_0x39dcc9){if(_0x39dcc9){_0x2c7091=_0x39dcc9;_0x59621b[_0x15d2('0x35')]=_[_0x15d2('0x46')](db['VtigerField'][_0x15d2('0x30')]);_0x59621b[_0x15d2('0x33')]=_[_0x15d2('0x46')](_0x16b941[_0x15d2('0x33')]);_0x59621b[_0x15d2('0x34')]=_[_0x15d2('0x36')](_0x59621b[_0x15d2('0x35')],_0x59621b[_0x15d2('0x33')]);_0x515168[_0x15d2('0x38')]=_[_0x15d2('0x36')](_0x59621b['model'],qs[_0x15d2('0x37')](_0x16b941[_0x15d2('0x33')]['fields']));_0x515168[_0x15d2('0x38')]=_0x515168[_0x15d2('0x38')][_0x15d2('0x47')]?_0x515168[_0x15d2('0x38')]:_0x59621b['model'];_0x515168[_0x15d2('0x3a')]=qs[_0x15d2('0x3b')](_0x16b941[_0x15d2('0x33')]['sort']);_0x515168[_0x15d2('0x3c')]=qs[_0x15d2('0x34')](_['pick'](_0x16b941[_0x15d2('0x33')],_0x59621b[_0x15d2('0x34')]));if(_0x16b941[_0x15d2('0x33')]['filter']){_0x515168[_0x15d2('0x3c')]=_[_0x15d2('0x40')](_0x515168[_0x15d2('0x3c')],{'$or':_[_0x15d2('0x2e')](_0x515168['attributes'],function(_0x56c125){var _0x5433c8={};_0x5433c8[_0x56c125]={'$like':'%'+_0x16b941[_0x15d2('0x33')][_0x15d2('0x3f')]+'%'};return _0x5433c8;})});}_0x515168=_[_0x15d2('0x40')]({},_0x515168,_0x16b941[_0x15d2('0x41')]);return _0x2c7091[_0x15d2('0x4e')](_0x515168);}})[_0x15d2('0x27')](function(_0x54d7fe){if(_0x54d7fe){_0x200986=_0x54d7fe[_0x15d2('0x47')];if(!_0x16b941[_0x15d2('0x33')][_0x15d2('0x39')](_0x15d2('0x50'))){_0x515168['limit']=qs['limit'](_0x16b941[_0x15d2('0x33')][_0x15d2('0x20')]);_0x515168[_0x15d2('0x1e')]=qs[_0x15d2('0x1e')](_0x16b941[_0x15d2('0x33')][_0x15d2('0x1e')]);}return _0x2c7091['getFields'](_0x515168);}})[_0x15d2('0x27')](function(_0x39cea6){if(_0x39cea6){return _0x39cea6?{'count':_0x200986,'rows':_0x39cea6}:null;}})['then'](respondWithResult(_0x2815b9,null))['catch'](handleError(_0x2815b9,null));};exports[_0x15d2('0x51')]=function(_0xbb8be5,_0x20f583,_0x24f30a){var _0x4443aa={};var _0x23d07e={};var _0x476341;var _0x3ad1a4;return db[_0x15d2('0x2f')][_0x15d2('0x4f')]({'where':{'id':_0xbb8be5[_0x15d2('0x4d')]['id']}})[_0x15d2('0x27')](handleEntityNotFound(_0x20f583,null))['then'](function(_0x251dab){if(_0x251dab){_0x476341=_0x251dab;_0x23d07e[_0x15d2('0x35')]=_[_0x15d2('0x46')](db['VtigerField'][_0x15d2('0x30')]);_0x23d07e['query']=_[_0x15d2('0x46')](_0xbb8be5[_0x15d2('0x33')]);_0x23d07e['filters']=_['intersection'](_0x23d07e[_0x15d2('0x35')],_0x23d07e['query']);_0x4443aa[_0x15d2('0x38')]=_['intersection'](_0x23d07e[_0x15d2('0x35')],qs[_0x15d2('0x37')](_0xbb8be5['query'][_0x15d2('0x37')]));_0x4443aa['attributes']=_0x4443aa[_0x15d2('0x38')][_0x15d2('0x47')]?_0x4443aa[_0x15d2('0x38')]:_0x23d07e[_0x15d2('0x35')];_0x4443aa[_0x15d2('0x3a')]=qs['sort'](_0xbb8be5[_0x15d2('0x33')][_0x15d2('0x3b')]);_0x4443aa['where']=qs['filters'](_['pick'](_0xbb8be5[_0x15d2('0x33')],_0x23d07e['filters']));if(_0xbb8be5['query'][_0x15d2('0x3f')]){_0x4443aa['where']=_[_0x15d2('0x40')](_0x4443aa[_0x15d2('0x3c')],{'$or':_[_0x15d2('0x2e')](_0x4443aa[_0x15d2('0x38')],function(_0x56e645){var _0x4ff317={};_0x4ff317[_0x56e645]={'$like':'%'+_0xbb8be5[_0x15d2('0x33')]['filter']+'%'};return _0x4ff317;})});}_0x4443aa=_['merge']({},_0x4443aa,_0xbb8be5['options']);return _0x476341[_0x15d2('0x51')](_0x4443aa);}})[_0x15d2('0x27')](function(_0x5d76d9){if(_0x5d76d9){_0x3ad1a4=_0x5d76d9['length'];if(!_0xbb8be5[_0x15d2('0x33')][_0x15d2('0x39')](_0x15d2('0x50'))){_0x4443aa[_0x15d2('0x20')]=qs[_0x15d2('0x20')](_0xbb8be5[_0x15d2('0x33')][_0x15d2('0x20')]);_0x4443aa[_0x15d2('0x1e')]=qs[_0x15d2('0x1e')](_0xbb8be5[_0x15d2('0x33')][_0x15d2('0x1e')]);}return _0x476341['getSubjects'](_0x4443aa);}})[_0x15d2('0x27')](function(_0x4f4428){if(_0x4f4428){return _0x4f4428?{'count':_0x3ad1a4,'rows':_0x4f4428}:null;}})[_0x15d2('0x27')](respondWithResult(_0x20f583,null))['catch'](handleError(_0x20f583,null));};exports['getDescriptions']=function(_0x2c47a4,_0x2b3228,_0x4bfd06){var _0x33c7eb={};var _0x14e88a={};var _0x588a3f;var _0x44c354;return db[_0x15d2('0x2f')][_0x15d2('0x4f')]({'where':{'id':_0x2c47a4['params']['id']}})[_0x15d2('0x27')](handleEntityNotFound(_0x2b3228,null))[_0x15d2('0x27')](function(_0x48fcfe){if(_0x48fcfe){_0x588a3f=_0x48fcfe;_0x14e88a['model']=_[_0x15d2('0x46')](db['VtigerField'][_0x15d2('0x30')]);_0x14e88a['query']=_[_0x15d2('0x46')](_0x2c47a4['query']);_0x14e88a[_0x15d2('0x34')]=_[_0x15d2('0x36')](_0x14e88a[_0x15d2('0x35')],_0x14e88a[_0x15d2('0x33')]);_0x33c7eb[_0x15d2('0x38')]=_['intersection'](_0x14e88a[_0x15d2('0x35')],qs[_0x15d2('0x37')](_0x2c47a4[_0x15d2('0x33')][_0x15d2('0x37')]));_0x33c7eb[_0x15d2('0x38')]=_0x33c7eb[_0x15d2('0x38')][_0x15d2('0x47')]?_0x33c7eb[_0x15d2('0x38')]:_0x14e88a['model'];_0x33c7eb[_0x15d2('0x3a')]=qs[_0x15d2('0x3b')](_0x2c47a4[_0x15d2('0x33')][_0x15d2('0x3b')]);_0x33c7eb['where']=qs['filters'](_[_0x15d2('0x3d')](_0x2c47a4[_0x15d2('0x33')],_0x14e88a[_0x15d2('0x34')]));if(_0x2c47a4['query'][_0x15d2('0x3f')]){_0x33c7eb['where']=_[_0x15d2('0x40')](_0x33c7eb[_0x15d2('0x3c')],{'$or':_[_0x15d2('0x2e')](_0x33c7eb[_0x15d2('0x38')],function(_0xece5d0){var _0x4b46da={};_0x4b46da[_0xece5d0]={'$like':'%'+_0x2c47a4[_0x15d2('0x33')][_0x15d2('0x3f')]+'%'};return _0x4b46da;})});}_0x33c7eb=_[_0x15d2('0x40')]({},_0x33c7eb,_0x2c47a4[_0x15d2('0x41')]);return _0x588a3f['getDescriptions'](_0x33c7eb);}})[_0x15d2('0x27')](function(_0x4855ad){if(_0x4855ad){_0x44c354=_0x4855ad['length'];if(!_0x2c47a4[_0x15d2('0x33')]['hasOwnProperty'](_0x15d2('0x50'))){_0x33c7eb['limit']=qs[_0x15d2('0x20')](_0x2c47a4['query'][_0x15d2('0x20')]);_0x33c7eb[_0x15d2('0x1e')]=qs[_0x15d2('0x1e')](_0x2c47a4['query'][_0x15d2('0x1e')]);}return _0x588a3f[_0x15d2('0x52')](_0x33c7eb);}})[_0x15d2('0x27')](function(_0x47e0ff){if(_0x47e0ff){return _0x47e0ff?{'count':_0x44c354,'rows':_0x47e0ff}:null;}})[_0x15d2('0x27')](respondWithResult(_0x2b3228,null))[_0x15d2('0x44')](handleError(_0x2b3228,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index dd72c5d..506f4fd 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 _0x8288=['define','VtigerConfiguration','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2861b4,_0x17bc7d){var _0x5814d6=function(_0x594c87){while(--_0x594c87){_0x2861b4['push'](_0x2861b4['shift']());}};_0x5814d6(++_0x17bc7d);}(_0x8288,0x70));var _0x8828=function(_0x2f5392,_0x5c074f){_0x2f5392=_0x2f5392-0x0;var _0x13fd19=_0x8288[_0x2f5392];return _0x13fd19;};'use strict';var _=require(_0x8828('0x0'));var util=require(_0x8828('0x1'));var logger=require('../../config/logger')(_0x8828('0x2'));var moment=require(_0x8828('0x3'));var BPromise=require(_0x8828('0x4'));var rp=require(_0x8828('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8828('0x6'));var config=require(_0x8828('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x8828('0x8')]=function(_0x3e2d68,_0x576018){return _0x3e2d68[_0x8828('0x9')](_0x8828('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2358=['../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x257268,_0x1d0221){var _0x4812bf=function(_0x4d7ea6){while(--_0x4d7ea6){_0x257268['push'](_0x257268['shift']());}};_0x4812bf(++_0x1d0221);}(_0x2358,0x147));var _0x8235=function(_0x4d682b,_0x2080b5){_0x4d682b=_0x4d682b-0x0;var _0x417378=_0x2358[_0x4d682b];return _0x417378;};'use strict';var _=require(_0x8235('0x0'));var util=require(_0x8235('0x1'));var logger=require(_0x8235('0x2'))(_0x8235('0x3'));var moment=require(_0x8235('0x4'));var BPromise=require(_0x8235('0x5'));var rp=require(_0x8235('0x6'));var fs=require('fs');var path=require(_0x8235('0x7'));var rimraf=require(_0x8235('0x8'));var config=require(_0x8235('0x9'));var attributes=require(_0x8235('0xa'));module[_0x8235('0xb')]=function(_0x459f94,_0x197c01){return _0x459f94['define'](_0x8235('0xc'),attributes,{'tableName':_0x8235('0xd'),'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 34e36b2..1f06758 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 _0xb277=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4038d3,_0x11ba20){var _0x3f4551=function(_0x54ad00){while(--_0x54ad00){_0x4038d3['push'](_0x4038d3['shift']());}};_0x3f4551(++_0x11ba20);}(_0xb277,0x119));var _0x7b27=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xb277[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x7b27('0x0'));var util=require(_0x7b27('0x1'));var moment=require(_0x7b27('0x2'));var BPromise=require(_0x7b27('0x3'));var rs=require(_0x7b27('0x4'));var fs=require('fs');var Redis=require(_0x7b27('0x5'));var db=require(_0x7b27('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b27('0x7'))('rpc');var config=require(_0x7b27('0x8'));var jayson=require(_0x7b27('0x9'));var client=jayson[_0x7b27('0xa')][_0x7b27('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ec408,_0x47af5a,_0x2c125e){return new BPromise(function(_0xa3246,_0x426fb9){return client[_0x7b27('0xc')](_0x3ec408,_0x2c125e)[_0x7b27('0xd')](function(_0x173284){logger[_0x7b27('0xe')](_0x7b27('0xf'),_0x47af5a,_0x7b27('0x10'));logger[_0x7b27('0x11')](_0x7b27('0x12'),_0x47af5a,'request\x20sent',JSON[_0x7b27('0x13')](_0x173284));if(_0x173284[_0x7b27('0x14')]){if(_0x173284[_0x7b27('0x14')]['code']===0x1f4){logger['error'](_0x7b27('0xf'),_0x47af5a,_0x173284[_0x7b27('0x14')][_0x7b27('0x15')]);return _0x426fb9(_0x173284['error'][_0x7b27('0x15')]);}logger['error'](_0x7b27('0xf'),_0x47af5a,_0x173284[_0x7b27('0x14')]['message']);return _0xa3246(_0x173284[_0x7b27('0x14')][_0x7b27('0x15')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x47af5a,_0x7b27('0x10'));_0xa3246(_0x173284['result'][_0x7b27('0x15')]);}})[_0x7b27('0x16')](function(_0x5c15a9){logger[_0x7b27('0x14')](_0x7b27('0xf'),_0x47af5a,_0x5c15a9);_0x426fb9(_0x5c15a9);});});} \ No newline at end of file +var _0x42cc=['request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x42cc,0x1d4));var _0xc42c=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x42cc[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0xc42c('0x0'));var util=require(_0xc42c('0x1'));var moment=require(_0xc42c('0x2'));var BPromise=require(_0xc42c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc42c('0x4'));var db=require(_0xc42c('0x5'))['db'];var utils=require(_0xc42c('0x6'));var logger=require(_0xc42c('0x7'))(_0xc42c('0x8'));var config=require(_0xc42c('0x9'));var jayson=require(_0xc42c('0xa'));var client=jayson[_0xc42c('0xb')][_0xc42c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3bc7eb,_0x51c376,_0x1d2297){return new BPromise(function(_0x4e468b,_0x4481f1){return client['request'](_0x3bc7eb,_0x1d2297)['then'](function(_0x5659d1){logger[_0xc42c('0xd')](_0xc42c('0xe'),_0x51c376,_0xc42c('0xf'));logger[_0xc42c('0x10')](_0xc42c('0x11'),_0x51c376,'request\x20sent',JSON['stringify'](_0x5659d1));if(_0x5659d1[_0xc42c('0x12')]){if(_0x5659d1[_0xc42c('0x12')][_0xc42c('0x13')]===0x1f4){logger[_0xc42c('0x12')](_0xc42c('0xe'),_0x51c376,_0x5659d1[_0xc42c('0x12')][_0xc42c('0x14')]);return _0x4481f1(_0x5659d1[_0xc42c('0x12')][_0xc42c('0x14')]);}logger[_0xc42c('0x12')](_0xc42c('0xe'),_0x51c376,_0x5659d1['error'][_0xc42c('0x14')]);return _0x4e468b(_0x5659d1[_0xc42c('0x12')][_0xc42c('0x14')]);}else{logger[_0xc42c('0xd')](_0xc42c('0xe'),_0x51c376,'request\x20sent');_0x4e468b(_0x5659d1[_0xc42c('0x15')][_0xc42c('0x14')]);}})[_0xc42c('0x16')](function(_0x83cc64){logger['error'](_0xc42c('0xe'),_0x51c376,_0x83cc64);_0x4481f1(_0x83cc64);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 160b8c7..be69fd3 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 _0x2f9e=['./intVtigerField.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f9e,0xe8));var _0xe2f9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2f9e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xe2f9('0x0'));var path=require(_0xe2f9('0x1'));var timeout=require(_0xe2f9('0x2'));var express=require(_0xe2f9('0x3'));var router=express['Router']();var fs_extra=require(_0xe2f9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe2f9('0x5'));var controller=require(_0xe2f9('0x6'));router[_0xe2f9('0x7')]('/',auth[_0xe2f9('0x8')](),controller[_0xe2f9('0x9')]);router[_0xe2f9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe2f9('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe2f9('0xb')]);router[_0xe2f9('0xc')](_0xe2f9('0xd'),auth[_0xe2f9('0x8')](),controller[_0xe2f9('0xe')]);router[_0xe2f9('0xf')](_0xe2f9('0xd'),auth[_0xe2f9('0x8')](),controller[_0xe2f9('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa202=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2558b5,_0x4b99e9){var _0xe8e9fa=function(_0x2580b8){while(--_0x2580b8){_0x2558b5['push'](_0x2558b5['shift']());}};_0xe8e9fa(++_0x4b99e9);}(_0xa202,0x90));var _0x2a20=function(_0x33e307,_0x11c495){_0x33e307=_0x33e307-0x0;var _0x2b3ea9=_0xa202[_0x33e307];return _0x2b3ea9;};'use strict';var multer=require(_0x2a20('0x0'));var util=require(_0x2a20('0x1'));var path=require(_0x2a20('0x2'));var timeout=require(_0x2a20('0x3'));var express=require(_0x2a20('0x4'));var router=express[_0x2a20('0x5')]();var fs_extra=require(_0x2a20('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2a20('0x7'));var config=require('../../config/environment');var controller=require(_0x2a20('0x8'));router[_0x2a20('0x9')]('/',auth[_0x2a20('0xa')](),controller[_0x2a20('0xb')]);router[_0x2a20('0x9')](_0x2a20('0xc'),auth[_0x2a20('0xa')](),controller[_0x2a20('0xd')]);router[_0x2a20('0xe')]('/',auth['isAuthenticated'](),controller[_0x2a20('0xf')]);router[_0x2a20('0x10')](_0x2a20('0xc'),auth[_0x2a20('0xa')](),controller['update']);router[_0x2a20('0x11')](_0x2a20('0xc'),auth[_0x2a20('0xa')](),controller[_0x2a20('0x12')]);module[_0x2a20('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 2dc17e4..73647e2 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 _0x00af=['variable','ENUM','string','customVariable','picklist','STRING'];(function(_0x4cf3d0,_0x6f7dc0){var _0x346e9a=function(_0x4ccfb1){while(--_0x4ccfb1){_0x4cf3d0['push'](_0x4cf3d0['shift']());}};_0x346e9a(++_0x6f7dc0);}(_0x00af,0x11b));var _0xf00a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00af[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xf00a('0x0')](_0xf00a('0x1'),'variable',_0xf00a('0x2'),'keyValue',_0xf00a('0x3')),'defaultValue':_0xf00a('0x1')},'content':{'type':Sequelize[_0xf00a('0x4')]},'key':{'type':Sequelize[_0xf00a('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0xf00a('0x5'),_0xf00a('0x2'))},'keyContent':{'type':Sequelize[_0xf00a('0x4')]},'idField':{'type':Sequelize[_0xf00a('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf00a('0x4')]}}; \ No newline at end of file +var _0x1884=['string','customVariable','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x491389,_0x1d769f){var _0x1adb39=function(_0x50b4b2){while(--_0x50b4b2){_0x491389['push'](_0x491389['shift']());}};_0x1adb39(++_0x1d769f);}(_0x1884,0x165));var _0x4188=function(_0x435e61,_0x1cccef){_0x435e61=_0x435e61-0x0;var _0x1cfb71=_0x1884[_0x435e61];return _0x1cfb71;};'use strict';var Sequelize=require(_0x4188('0x0'));module[_0x4188('0x1')]={'type':{'type':Sequelize[_0x4188('0x2')](_0x4188('0x3'),'variable',_0x4188('0x4'),'keyValue','picklist'),'defaultValue':_0x4188('0x3')},'content':{'type':Sequelize[_0x4188('0x5')]},'key':{'type':Sequelize[_0x4188('0x5')]},'keyType':{'type':Sequelize[_0x4188('0x2')](_0x4188('0x3'),_0x4188('0x6'),_0x4188('0x4'))},'keyContent':{'type':Sequelize[_0x4188('0x5')]},'idField':{'type':Sequelize[_0x4188('0x5')]},'nameField':{'type':Sequelize[_0x4188('0x5')]},'customField':{'type':Sequelize[_0x4188('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 4afc303..24570ff 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 _0x5ed8=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','end','error','name','send','index','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','merge','options','VtigerField','includeAll','include','findAll','params','keys','rawAttributes','find','catch','create','body'];(function(_0x1b0467,_0x47cffd){var _0x96b657=function(_0x493c46){while(--_0x493c46){_0x1b0467['push'](_0x1b0467['shift']());}};_0x96b657(++_0x47cffd);}(_0x5ed8,0x1b6));var _0x85ed=function(_0x1db7fb,_0x54396b){_0x1db7fb=_0x1db7fb-0x0;var _0x5dd4c7=_0x5ed8[_0x1db7fb];return _0x5dd4c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85ed('0x0'));var zipdir=require(_0x85ed('0x1'));var jsonpatch=require(_0x85ed('0x2'));var rp=require(_0x85ed('0x3'));var moment=require(_0x85ed('0x4'));var BPromise=require(_0x85ed('0x5'));var Mustache=require('mustache');var util=require(_0x85ed('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x85ed('0x7'));var ejs=require(_0x85ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85ed('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x85ed('0xa'));var deskjs=require(_0x85ed('0xb'));var toCsv=require(_0x85ed('0x7'));var querystring=require(_0x85ed('0xc'));var Papa=require(_0x85ed('0xd'));var Redis=require(_0x85ed('0xe'));var authService=require(_0x85ed('0xf'));var qs=require(_0x85ed('0x10'));var as=require(_0x85ed('0x11'));var hardwareService=require(_0x85ed('0x12'));var logger=require(_0x85ed('0x13'))(_0x85ed('0x14'));var utils=require(_0x85ed('0x15'));var config=require(_0x85ed('0x16'));var licenseUtil=require(_0x85ed('0x17'));var db=require(_0x85ed('0x18'))['db'];function respondWithStatusCode(_0x1a0002,_0x23d29f){_0x23d29f=_0x23d29f||0xcc;return function(_0x251997){if(_0x251997){return _0x1a0002[_0x85ed('0x19')](_0x23d29f);}return _0x1a0002[_0x85ed('0x1a')](_0x23d29f)['end']();};}function respondWithResult(_0x3043ba,_0x5575a4){_0x5575a4=_0x5575a4||0xc8;return function(_0x52f763){if(_0x52f763){return _0x3043ba[_0x85ed('0x1a')](_0x5575a4)[_0x85ed('0x1b')](_0x52f763);}};}function respondWithFilteredResult(_0x265879,_0x9639c3){return function(_0x371d4b){if(_0x371d4b){var _0x3fd797=typeof _0x9639c3[_0x85ed('0x1c')]===_0x85ed('0x1d')&&typeof _0x9639c3['limit']===_0x85ed('0x1d');var _0x3cacdf=_0x371d4b[_0x85ed('0x1e')];var _0x4533c6=_0x3fd797?0x0:_0x9639c3[_0x85ed('0x1c')];var _0x20fffe=_0x3fd797?_0x371d4b[_0x85ed('0x1e')]:_0x9639c3[_0x85ed('0x1c')]+_0x9639c3[_0x85ed('0x1f')];var _0x54f4ee;if(_0x20fffe>=_0x3cacdf){_0x20fffe=_0x3cacdf;_0x54f4ee=0xc8;}else{_0x54f4ee=0xce;}_0x265879[_0x85ed('0x1a')](_0x54f4ee);return _0x265879[_0x85ed('0x20')]('Content-Range',_0x4533c6+'-'+_0x20fffe+'/'+_0x3cacdf)['json'](_0x371d4b);}return null;};}function patchUpdates(_0x2fabb4){return function(_0x38e1ac){try{jsonpatch['apply'](_0x38e1ac,_0x2fabb4,!![]);}catch(_0x4306dc){return BPromise[_0x85ed('0x21')](_0x4306dc);}return _0x38e1ac[_0x85ed('0x22')]();};}function saveUpdates(_0x4b1e2b,_0x196d15){return function(_0x585cc8){if(_0x585cc8){return _0x585cc8[_0x85ed('0x23')](_0x4b1e2b)['then'](function(_0x3aed92){return _0x3aed92;});}return null;};}function removeEntity(_0xf9599e,_0x59d941){return function(_0x278695){if(_0x278695){return _0x278695[_0x85ed('0x24')]()[_0x85ed('0x25')](function(){_0xf9599e[_0x85ed('0x1a')](0xcc)[_0x85ed('0x26')]();});}};}function handleEntityNotFound(_0x75f3fb,_0x504403){return function(_0x5ca4ce){if(!_0x5ca4ce){_0x75f3fb['sendStatus'](0x194);}return _0x5ca4ce;};}function handleError(_0x49158e,_0x37e45e){_0x37e45e=_0x37e45e||0x1f4;return function(_0x1cf663){logger[_0x85ed('0x27')](_0x1cf663['stack']);if(_0x1cf663['name']){delete _0x1cf663[_0x85ed('0x28')];}_0x49158e[_0x85ed('0x1a')](_0x37e45e)[_0x85ed('0x29')](_0x1cf663);};}exports[_0x85ed('0x2a')]=function(_0x4b0213,_0x9e52b5){var _0x55fd38={},_0x41c64a={},_0x5d50ee={'count':0x0,'rows':[]};var _0x4e3c23=_['map'](db['VtigerField']['rawAttributes'],function(_0x55f04a){return{'name':_0x55f04a[_0x85ed('0x2b')],'type':_0x55f04a[_0x85ed('0x2c')][_0x85ed('0x2d')]};});_0x41c64a[_0x85ed('0x2e')]=_['map'](_0x4e3c23,_0x85ed('0x28'));_0x41c64a[_0x85ed('0x2f')]=_['keys'](_0x4b0213[_0x85ed('0x2f')]);_0x41c64a[_0x85ed('0x30')]=_[_0x85ed('0x31')](_0x41c64a[_0x85ed('0x2e')],_0x41c64a[_0x85ed('0x2f')]);_0x55fd38[_0x85ed('0x32')]=_[_0x85ed('0x31')](_0x41c64a[_0x85ed('0x2e')],qs['fields'](_0x4b0213[_0x85ed('0x2f')][_0x85ed('0x33')]));_0x55fd38['attributes']=_0x55fd38[_0x85ed('0x32')][_0x85ed('0x34')]?_0x55fd38[_0x85ed('0x32')]:_0x41c64a['model'];if(!_0x4b0213[_0x85ed('0x2f')]['hasOwnProperty'](_0x85ed('0x35'))){_0x55fd38[_0x85ed('0x1f')]=qs[_0x85ed('0x1f')](_0x4b0213['query'][_0x85ed('0x1f')]);_0x55fd38['offset']=qs[_0x85ed('0x1c')](_0x4b0213[_0x85ed('0x2f')]['offset']);}_0x55fd38[_0x85ed('0x36')]=qs[_0x85ed('0x37')](_0x4b0213[_0x85ed('0x2f')][_0x85ed('0x37')]);_0x55fd38['where']=qs['filters'](_[_0x85ed('0x38')](_0x4b0213[_0x85ed('0x2f')],_0x41c64a[_0x85ed('0x30')]),_0x4e3c23);if(_0x4b0213['query'][_0x85ed('0x39')]){_0x55fd38[_0x85ed('0x3a')]=_['merge'](_0x55fd38[_0x85ed('0x3a')],{'$or':_[_0x85ed('0x3b')](_0x4e3c23,function(_0x383f4a){if(_0x383f4a[_0x85ed('0x2c')]!=='VIRTUAL'){var _0x29feb4={};_0x29feb4[_0x383f4a[_0x85ed('0x28')]]={'$like':'%'+_0x4b0213['query'][_0x85ed('0x39')]+'%'};return _0x29feb4;}})});}_0x55fd38=_[_0x85ed('0x3c')]({},_0x55fd38,_0x4b0213[_0x85ed('0x3d')]);var _0x11262a={'where':_0x55fd38[_0x85ed('0x3a')]};return db[_0x85ed('0x3e')][_0x85ed('0x1e')](_0x11262a)[_0x85ed('0x25')](function(_0xffcc7e){_0x5d50ee[_0x85ed('0x1e')]=_0xffcc7e;if(_0x4b0213[_0x85ed('0x2f')][_0x85ed('0x3f')]){_0x55fd38[_0x85ed('0x40')]=[{'all':!![]}];}return db['VtigerField'][_0x85ed('0x41')](_0x55fd38);})['then'](function(_0x349800){_0x5d50ee['rows']=_0x349800;return _0x5d50ee;})[_0x85ed('0x25')](respondWithFilteredResult(_0x9e52b5,_0x55fd38))['catch'](handleError(_0x9e52b5,null));};exports['show']=function(_0x199f82,_0x34ba3d){var _0x56523d={'raw':!![],'where':{'id':_0x199f82[_0x85ed('0x42')]['id']}},_0x15dde3={};_0x15dde3[_0x85ed('0x2e')]=_[_0x85ed('0x43')](db[_0x85ed('0x3e')][_0x85ed('0x44')]);_0x15dde3[_0x85ed('0x2f')]=_[_0x85ed('0x43')](_0x199f82[_0x85ed('0x2f')]);_0x15dde3[_0x85ed('0x30')]=_[_0x85ed('0x31')](_0x15dde3['model'],_0x15dde3['query']);_0x56523d[_0x85ed('0x32')]=_[_0x85ed('0x31')](_0x15dde3[_0x85ed('0x2e')],qs['fields'](_0x199f82[_0x85ed('0x2f')][_0x85ed('0x33')]));_0x56523d[_0x85ed('0x32')]=_0x56523d['attributes']['length']?_0x56523d[_0x85ed('0x32')]:_0x15dde3[_0x85ed('0x2e')];if(_0x199f82[_0x85ed('0x2f')]['includeAll']){_0x56523d[_0x85ed('0x40')]=[{'all':!![]}];}_0x56523d=_['merge']({},_0x56523d,_0x199f82[_0x85ed('0x3d')]);return db[_0x85ed('0x3e')][_0x85ed('0x45')](_0x56523d)[_0x85ed('0x25')](handleEntityNotFound(_0x34ba3d,null))[_0x85ed('0x25')](respondWithResult(_0x34ba3d,null))[_0x85ed('0x46')](handleError(_0x34ba3d,null));};exports[_0x85ed('0x47')]=function(_0x3b9250,_0x370cd0){return db['VtigerField'][_0x85ed('0x47')](_0x3b9250[_0x85ed('0x48')],{})['then'](respondWithResult(_0x370cd0,0xc9))[_0x85ed('0x46')](handleError(_0x370cd0,null));};exports[_0x85ed('0x23')]=function(_0x2ab3d8,_0x4a4555){if(_0x2ab3d8[_0x85ed('0x48')]['id']){delete _0x2ab3d8['body']['id'];}return db[_0x85ed('0x3e')][_0x85ed('0x45')]({'where':{'id':_0x2ab3d8['params']['id']}})[_0x85ed('0x25')](handleEntityNotFound(_0x4a4555,null))[_0x85ed('0x25')](saveUpdates(_0x2ab3d8['body'],null))['then'](respondWithResult(_0x4a4555,null))[_0x85ed('0x46')](handleError(_0x4a4555,null));};exports[_0x85ed('0x24')]=function(_0x293245,_0x272dc9){return db['VtigerField'][_0x85ed('0x45')]({'where':{'id':_0x293245[_0x85ed('0x42')]['id']}})['then'](handleEntityNotFound(_0x272dc9,null))['then'](removeEntity(_0x272dc9,null))[_0x85ed('0x46')](handleError(_0x272dc9,null));}; \ No newline at end of file +var _0xddaa=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','name','options','VtigerField','includeAll','include','rows','catch','show','find','create','body','params','eml-format'];(function(_0x90b03b,_0xf9194f){var _0x391bff=function(_0xcdc247){while(--_0xcdc247){_0x90b03b['push'](_0x90b03b['shift']());}};_0x391bff(++_0xf9194f);}(_0xddaa,0x1bb));var _0xadda=function(_0x12bff9,_0x1cdf47){_0x12bff9=_0x12bff9-0x0;var _0x3f31ba=_0xddaa[_0x12bff9];return _0x3f31ba;};'use strict';var emlformat=require(_0xadda('0x0'));var rimraf=require(_0xadda('0x1'));var zipdir=require(_0xadda('0x2'));var jsonpatch=require(_0xadda('0x3'));var rp=require('request-promise');var moment=require(_0xadda('0x4'));var BPromise=require(_0xadda('0x5'));var Mustache=require(_0xadda('0x6'));var util=require(_0xadda('0x7'));var path=require(_0xadda('0x8'));var sox=require('sox');var csv=require(_0xadda('0x9'));var ejs=require(_0xadda('0xa'));var fs=require('fs');var fs_extra=require(_0xadda('0xb'));var _=require(_0xadda('0xc'));var squel=require(_0xadda('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xadda('0xe'));var toCsv=require(_0xadda('0x9'));var querystring=require(_0xadda('0xf'));var Papa=require('papaparse');var Redis=require(_0xadda('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xadda('0x11'));var as=require(_0xadda('0x12'));var hardwareService=require(_0xadda('0x13'));var logger=require(_0xadda('0x14'))(_0xadda('0x15'));var utils=require(_0xadda('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xadda('0x17'));var db=require(_0xadda('0x18'))['db'];function respondWithStatusCode(_0x15a26d,_0x1a6de5){_0x1a6de5=_0x1a6de5||0xcc;return function(_0x34d7ad){if(_0x34d7ad){return _0x15a26d[_0xadda('0x19')](_0x1a6de5);}return _0x15a26d[_0xadda('0x1a')](_0x1a6de5)[_0xadda('0x1b')]();};}function respondWithResult(_0xfb4e75,_0x1cfe6c){_0x1cfe6c=_0x1cfe6c||0xc8;return function(_0xdbe2c7){if(_0xdbe2c7){return _0xfb4e75[_0xadda('0x1a')](_0x1cfe6c)['json'](_0xdbe2c7);}};}function respondWithFilteredResult(_0x341bb2,_0x4f1278){return function(_0x301da4){if(_0x301da4){var _0x27f210=typeof _0x4f1278[_0xadda('0x1c')]==='undefined'&&typeof _0x4f1278[_0xadda('0x1d')]===_0xadda('0x1e');var _0x5b49c9=_0x301da4[_0xadda('0x1f')];var _0x562c21=_0x27f210?0x0:_0x4f1278[_0xadda('0x1c')];var _0x93cc86=_0x27f210?_0x301da4['count']:_0x4f1278[_0xadda('0x1c')]+_0x4f1278[_0xadda('0x1d')];var _0x3d4421;if(_0x93cc86>=_0x5b49c9){_0x93cc86=_0x5b49c9;_0x3d4421=0xc8;}else{_0x3d4421=0xce;}_0x341bb2[_0xadda('0x1a')](_0x3d4421);return _0x341bb2[_0xadda('0x20')](_0xadda('0x21'),_0x562c21+'-'+_0x93cc86+'/'+_0x5b49c9)[_0xadda('0x22')](_0x301da4);}return null;};}function patchUpdates(_0x38cf6c){return function(_0x412a0e){try{jsonpatch[_0xadda('0x23')](_0x412a0e,_0x38cf6c,!![]);}catch(_0x542eae){return BPromise['reject'](_0x542eae);}return _0x412a0e[_0xadda('0x24')]();};}function saveUpdates(_0x243c8c,_0x87a209){return function(_0x28ca0f){if(_0x28ca0f){return _0x28ca0f[_0xadda('0x25')](_0x243c8c)[_0xadda('0x26')](function(_0x521053){return _0x521053;});}return null;};}function removeEntity(_0x5b08f7,_0x467cec){return function(_0x53aa9e){if(_0x53aa9e){return _0x53aa9e[_0xadda('0x27')]()[_0xadda('0x26')](function(){_0x5b08f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x293106,_0x555fd2){return function(_0x26a500){if(!_0x26a500){_0x293106['sendStatus'](0x194);}return _0x26a500;};}function handleError(_0x235b5e,_0x5cc8b9){_0x5cc8b9=_0x5cc8b9||0x1f4;return function(_0x52b4cf){logger['error'](_0x52b4cf['stack']);if(_0x52b4cf['name']){delete _0x52b4cf['name'];}_0x235b5e[_0xadda('0x1a')](_0x5cc8b9)[_0xadda('0x28')](_0x52b4cf);};}exports[_0xadda('0x29')]=function(_0x1be811,_0x329c26){var _0x46e90f={},_0x5a0747={},_0x6fee12={'count':0x0,'rows':[]};var _0x5f4673=_[_0xadda('0x2a')](db['VtigerField'][_0xadda('0x2b')],function(_0x1004a1){return{'name':_0x1004a1[_0xadda('0x2c')],'type':_0x1004a1[_0xadda('0x2d')][_0xadda('0x2e')]};});_0x5a0747['model']=_['map'](_0x5f4673,'name');_0x5a0747[_0xadda('0x2f')]=_[_0xadda('0x30')](_0x1be811[_0xadda('0x2f')]);_0x5a0747['filters']=_[_0xadda('0x31')](_0x5a0747['model'],_0x5a0747[_0xadda('0x2f')]);_0x46e90f[_0xadda('0x32')]=_[_0xadda('0x31')](_0x5a0747[_0xadda('0x33')],qs[_0xadda('0x34')](_0x1be811[_0xadda('0x2f')][_0xadda('0x34')]));_0x46e90f[_0xadda('0x32')]=_0x46e90f[_0xadda('0x32')][_0xadda('0x35')]?_0x46e90f[_0xadda('0x32')]:_0x5a0747[_0xadda('0x33')];if(!_0x1be811[_0xadda('0x2f')]['hasOwnProperty'](_0xadda('0x36'))){_0x46e90f['limit']=qs[_0xadda('0x1d')](_0x1be811[_0xadda('0x2f')]['limit']);_0x46e90f[_0xadda('0x1c')]=qs[_0xadda('0x1c')](_0x1be811[_0xadda('0x2f')][_0xadda('0x1c')]);}_0x46e90f[_0xadda('0x37')]=qs['sort'](_0x1be811[_0xadda('0x2f')]['sort']);_0x46e90f[_0xadda('0x38')]=qs['filters'](_[_0xadda('0x39')](_0x1be811[_0xadda('0x2f')],_0x5a0747[_0xadda('0x3a')]),_0x5f4673);if(_0x1be811[_0xadda('0x2f')][_0xadda('0x3b')]){_0x46e90f[_0xadda('0x38')]=_[_0xadda('0x3c')](_0x46e90f[_0xadda('0x38')],{'$or':_[_0xadda('0x2a')](_0x5f4673,function(_0x2d17e6){if(_0x2d17e6['type']!==_0xadda('0x3d')){var _0x23035f={};_0x23035f[_0x2d17e6[_0xadda('0x3e')]]={'$like':'%'+_0x1be811[_0xadda('0x2f')][_0xadda('0x3b')]+'%'};return _0x23035f;}})});}_0x46e90f=_[_0xadda('0x3c')]({},_0x46e90f,_0x1be811[_0xadda('0x3f')]);var _0x1437be={'where':_0x46e90f[_0xadda('0x38')]};return db[_0xadda('0x40')][_0xadda('0x1f')](_0x1437be)[_0xadda('0x26')](function(_0x4cd604){_0x6fee12[_0xadda('0x1f')]=_0x4cd604;if(_0x1be811['query'][_0xadda('0x41')]){_0x46e90f[_0xadda('0x42')]=[{'all':!![]}];}return db[_0xadda('0x40')]['findAll'](_0x46e90f);})[_0xadda('0x26')](function(_0xc2f1f2){_0x6fee12[_0xadda('0x43')]=_0xc2f1f2;return _0x6fee12;})[_0xadda('0x26')](respondWithFilteredResult(_0x329c26,_0x46e90f))[_0xadda('0x44')](handleError(_0x329c26,null));};exports[_0xadda('0x45')]=function(_0x1171ad,_0x131279){var _0x2fe876={'raw':!![],'where':{'id':_0x1171ad['params']['id']}},_0x24574c={};_0x24574c['model']=_[_0xadda('0x30')](db[_0xadda('0x40')][_0xadda('0x2b')]);_0x24574c[_0xadda('0x2f')]=_['keys'](_0x1171ad[_0xadda('0x2f')]);_0x24574c['filters']=_[_0xadda('0x31')](_0x24574c[_0xadda('0x33')],_0x24574c[_0xadda('0x2f')]);_0x2fe876['attributes']=_[_0xadda('0x31')](_0x24574c[_0xadda('0x33')],qs[_0xadda('0x34')](_0x1171ad[_0xadda('0x2f')][_0xadda('0x34')]));_0x2fe876[_0xadda('0x32')]=_0x2fe876[_0xadda('0x32')]['length']?_0x2fe876[_0xadda('0x32')]:_0x24574c[_0xadda('0x33')];if(_0x1171ad[_0xadda('0x2f')][_0xadda('0x41')]){_0x2fe876[_0xadda('0x42')]=[{'all':!![]}];}_0x2fe876=_[_0xadda('0x3c')]({},_0x2fe876,_0x1171ad['options']);return db[_0xadda('0x40')][_0xadda('0x46')](_0x2fe876)[_0xadda('0x26')](handleEntityNotFound(_0x131279,null))[_0xadda('0x26')](respondWithResult(_0x131279,null))[_0xadda('0x44')](handleError(_0x131279,null));};exports[_0xadda('0x47')]=function(_0x411236,_0x32457b){return db[_0xadda('0x40')][_0xadda('0x47')](_0x411236[_0xadda('0x48')],{})[_0xadda('0x26')](respondWithResult(_0x32457b,0xc9))[_0xadda('0x44')](handleError(_0x32457b,null));};exports['update']=function(_0x23a660,_0xd7d152){if(_0x23a660[_0xadda('0x48')]['id']){delete _0x23a660['body']['id'];}return db[_0xadda('0x40')][_0xadda('0x46')]({'where':{'id':_0x23a660[_0xadda('0x49')]['id']}})[_0xadda('0x26')](handleEntityNotFound(_0xd7d152,null))['then'](saveUpdates(_0x23a660[_0xadda('0x48')],null))[_0xadda('0x26')](respondWithResult(_0xd7d152,null))['catch'](handleError(_0xd7d152,null));};exports['destroy']=function(_0x30dd67,_0x4d7545){return db[_0xadda('0x40')][_0xadda('0x46')]({'where':{'id':_0x30dd67['params']['id']}})[_0xadda('0x26')](handleEntityNotFound(_0x4d7545,null))['then'](removeEntity(_0x4d7545,null))[_0xadda('0x44')](handleError(_0x4d7545,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 910e617..170ac5e 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 _0x0254=['../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x59ddb0,_0x2081c3){var _0x1dba64=function(_0x54b409){while(--_0x54b409){_0x59ddb0['push'](_0x59ddb0['shift']());}};_0x1dba64(++_0x2081c3);}(_0x0254,0x116));var _0x4025=function(_0x9ddcc6,_0x1c9c78){_0x9ddcc6=_0x9ddcc6-0x0;var _0x3a8ac8=_0x0254[_0x9ddcc6];return _0x3a8ac8;};'use strict';var _=require(_0x4025('0x0'));var util=require('util');var logger=require(_0x4025('0x1'))(_0x4025('0x2'));var moment=require(_0x4025('0x3'));var BPromise=require('bluebird');var rp=require(_0x4025('0x4'));var fs=require('fs');var path=require(_0x4025('0x5'));var rimraf=require(_0x4025('0x6'));var config=require(_0x4025('0x7'));var attributes=require(_0x4025('0x8'));module[_0x4025('0x9')]=function(_0x1ea9b6,_0x1415db){return _0x1ea9b6[_0x4025('0xa')](_0x4025('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x4025('0xc'),'fields':[_0x4025('0xd'),_0x4025('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a0e=['request-promise','path','rimraf','./intVtigerField.attributes','exports','define','vtiger_unique_index','idField','util','../../config/logger','bluebird'];(function(_0x34e819,_0x54d493){var _0x5c7b51=function(_0x2c858d){while(--_0x2c858d){_0x34e819['push'](_0x34e819['shift']());}};_0x5c7b51(++_0x54d493);}(_0x4a0e,0x1aa));var _0xe4a0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4a0e[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xe4a0('0x0'));var logger=require(_0xe4a0('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe4a0('0x2'));var rp=require(_0xe4a0('0x3'));var fs=require('fs');var path=require(_0xe4a0('0x4'));var rimraf=require(_0xe4a0('0x5'));var config=require('../../config/environment');var attributes=require(_0xe4a0('0x6'));module[_0xe4a0('0x7')]=function(_0x589384,_0x6a89c6){return _0x589384[_0xe4a0('0x8')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xe4a0('0x9'),'fields':[_0xe4a0('0xa'),'FieldId'],'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 375e231..6e970a6 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 _0x6d04=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','../../config/utils'];(function(_0x9cb3a8,_0x42950d){var _0x24a5f6=function(_0x4d0083){while(--_0x4d0083){_0x9cb3a8['push'](_0x9cb3a8['shift']());}};_0x24a5f6(++_0x42950d);}(_0x6d04,0x74));var _0x46d0=function(_0x5b952e,_0x26158d){_0x5b952e=_0x5b952e-0x0;var _0x34d8f1=_0x6d04[_0x5b952e];return _0x34d8f1;};'use strict';var _=require(_0x46d0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x46d0('0x1'));var rs=require(_0x46d0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x46d0('0x3'));var logger=require(_0x46d0('0x4'))(_0x46d0('0x5'));var config=require(_0x46d0('0x6'));var jayson=require(_0x46d0('0x7'));var client=jayson[_0x46d0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d66b4,_0x5e0a1e,_0x5a621b){return new BPromise(function(_0x52bd79,_0x39c99a){return client[_0x46d0('0x9')](_0x4d66b4,_0x5a621b)[_0x46d0('0xa')](function(_0x419912){logger[_0x46d0('0xb')](_0x46d0('0xc'),_0x5e0a1e,_0x46d0('0xd'));logger['debug'](_0x46d0('0xe'),_0x5e0a1e,_0x46d0('0xd'),JSON[_0x46d0('0xf')](_0x419912));if(_0x419912[_0x46d0('0x10')]){if(_0x419912[_0x46d0('0x10')][_0x46d0('0x11')]===0x1f4){logger[_0x46d0('0x10')](_0x46d0('0xc'),_0x5e0a1e,_0x419912[_0x46d0('0x10')]['message']);return _0x39c99a(_0x419912[_0x46d0('0x10')][_0x46d0('0x12')]);}logger[_0x46d0('0x10')](_0x46d0('0xc'),_0x5e0a1e,_0x419912[_0x46d0('0x10')][_0x46d0('0x12')]);return _0x52bd79(_0x419912['error'][_0x46d0('0x12')]);}else{logger[_0x46d0('0xb')](_0x46d0('0xc'),_0x5e0a1e,_0x46d0('0xd'));_0x52bd79(_0x419912['result']['message']);}})[_0x46d0('0x13')](function(_0xc6d5ae){logger['error'](_0x46d0('0xc'),_0x5e0a1e,_0xc6d5ae);_0x39c99a(_0xc6d5ae);});});} \ No newline at end of file +var _0xc3a9=['http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2f5590,_0x4720f9){var _0x458ef0=function(_0x73fab6){while(--_0x73fab6){_0x2f5590['push'](_0x2f5590['shift']());}};_0x458ef0(++_0x4720f9);}(_0xc3a9,0x6f));var _0x9c3a=function(_0x98e330,_0x77da3f){_0x98e330=_0x98e330-0x0;var _0x4ec0e6=_0xc3a9[_0x98e330];return _0x4ec0e6;};'use strict';var _=require('lodash');var util=require(_0x9c3a('0x0'));var moment=require('moment');var BPromise=require(_0x9c3a('0x1'));var rs=require(_0x9c3a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c3a('0x3'))['db'];var utils=require(_0x9c3a('0x4'));var logger=require(_0x9c3a('0x5'))('rpc');var config=require(_0x9c3a('0x6'));var jayson=require(_0x9c3a('0x7'));var client=jayson[_0x9c3a('0x8')][_0x9c3a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53c1b,_0x3909c8,_0x4d5da5){return new BPromise(function(_0x38215a,_0x298f4d){return client[_0x9c3a('0xa')](_0x53c1b,_0x4d5da5)['then'](function(_0x17bd36){logger[_0x9c3a('0xb')](_0x9c3a('0xc'),_0x3909c8,_0x9c3a('0xd'));logger['debug'](_0x9c3a('0xe'),_0x3909c8,_0x9c3a('0xd'),JSON[_0x9c3a('0xf')](_0x17bd36));if(_0x17bd36[_0x9c3a('0x10')]){if(_0x17bd36[_0x9c3a('0x10')][_0x9c3a('0x11')]===0x1f4){logger[_0x9c3a('0x10')](_0x9c3a('0xc'),_0x3909c8,_0x17bd36[_0x9c3a('0x10')][_0x9c3a('0x12')]);return _0x298f4d(_0x17bd36[_0x9c3a('0x10')][_0x9c3a('0x12')]);}logger[_0x9c3a('0x10')](_0x9c3a('0xc'),_0x3909c8,_0x17bd36[_0x9c3a('0x10')][_0x9c3a('0x12')]);return _0x38215a(_0x17bd36[_0x9c3a('0x10')][_0x9c3a('0x12')]);}else{logger[_0x9c3a('0xb')](_0x9c3a('0xc'),_0x3909c8,_0x9c3a('0xd'));_0x38215a(_0x17bd36[_0x9c3a('0x13')]['message']);}})['catch'](function(_0x12f590){logger[_0x9c3a('0x10')](_0x9c3a('0xc'),_0x3909c8,_0x12f590);_0x298f4d(_0x12f590);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 6b30e62..9b07407 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 _0x0e33=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x56a469,_0x3b6292){var _0x5f0ca6=function(_0xcae04d){while(--_0xcae04d){_0x56a469['push'](_0x56a469['shift']());}};_0x5f0ca6(++_0x3b6292);}(_0x0e33,0xf8));var _0x30e3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0e33[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x30e3('0x0'));var util=require(_0x30e3('0x1'));var path=require('path');var timeout=require(_0x30e3('0x2'));var express=require(_0x30e3('0x3'));var router=express[_0x30e3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x30e3('0x5'));var interaction=require(_0x30e3('0x6'));var config=require(_0x30e3('0x7'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x30e3('0x8')](),controller[_0x30e3('0x9')]);router[_0x30e3('0xa')](_0x30e3('0xb'),auth['isAuthenticated'](),controller[_0x30e3('0xc')]);router[_0x30e3('0xa')](_0x30e3('0xd'),auth[_0x30e3('0x8')](),controller[_0x30e3('0xe')]);router['get'](_0x30e3('0xf'),auth[_0x30e3('0x8')](),controller[_0x30e3('0x10')]);router[_0x30e3('0x11')]('/',auth[_0x30e3('0x8')](),controller[_0x30e3('0x12')]);router['post'](_0x30e3('0xd'),auth[_0x30e3('0x8')](),controller['addConfiguration']);router[_0x30e3('0x13')](_0x30e3('0xb'),auth[_0x30e3('0x8')](),controller['update']);router[_0x30e3('0x14')](_0x30e3('0xb'),auth['isAuthenticated'](),controller[_0x30e3('0x15')]);module[_0x30e3('0x16')]=router; \ No newline at end of file +var _0x543c=['../../config/environment','./intZendeskAccount.controller','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','get','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x52d8cc,_0x1ebea4){var _0x282858=function(_0x42a9fb){while(--_0x42a9fb){_0x52d8cc['push'](_0x52d8cc['shift']());}};_0x282858(++_0x1ebea4);}(_0x543c,0x10f));var _0xc543=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0x543c[_0x4828b1];return _0x1fec1b;};'use strict';var multer=require(_0xc543('0x0'));var util=require(_0xc543('0x1'));var path=require('path');var timeout=require(_0xc543('0x2'));var express=require(_0xc543('0x3'));var router=express['Router']();var fs_extra=require(_0xc543('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc543('0x5'));var controller=require(_0xc543('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc543('0x7')]);router['get'](_0xc543('0x8'),auth[_0xc543('0x9')](),controller['show']);router['get'](_0xc543('0xa'),auth[_0xc543('0x9')](),controller[_0xc543('0xb')]);router[_0xc543('0xc')](_0xc543('0xd'),auth[_0xc543('0x9')](),controller[_0xc543('0xe')]);router[_0xc543('0xf')]('/',auth[_0xc543('0x9')](),controller[_0xc543('0x10')]);router['post'](_0xc543('0xa'),auth[_0xc543('0x9')](),controller[_0xc543('0x11')]);router[_0xc543('0x12')]('/:id',auth[_0xc543('0x9')](),controller[_0xc543('0x13')]);router[_0xc543('0x14')]('/:id',auth[_0xc543('0x9')](),controller[_0xc543('0x15')]);module[_0xc543('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index afcdc66..7b57a5e 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 _0x2ace=['password','token','integrationTab','newTab','exports','STRING','username','remoteUri','ENUM'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x2ace,0x17e));var _0xe2ac=function(_0x4fd82a,_0x29d9d5){_0x4fd82a=_0x4fd82a-0x0;var _0x21d2a8=_0x2ace[_0x4fd82a];return _0x21d2a8;};'use strict';var Sequelize=require('sequelize');module[_0xe2ac('0x0')]={'name':{'type':Sequelize[_0xe2ac('0x1')]},'description':{'type':Sequelize[_0xe2ac('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xe2ac('0x2')},'password':{'type':Sequelize[_0xe2ac('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe2ac('0x1')],'unique':_0xe2ac('0x3')},'authType':{'type':Sequelize[_0xe2ac('0x4')](_0xe2ac('0x5'),_0xe2ac('0x6')),'defaultValue':_0xe2ac('0x5')},'serverUrl':{'type':Sequelize[_0xe2ac('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe2ac('0x4')](_0xe2ac('0x7'),_0xe2ac('0x8')),'defaultValue':_0xe2ac('0x7')}}; \ No newline at end of file +var _0x8579=['password','token','ENUM','integrationTab','sequelize','exports','STRING','username'];(function(_0x28d524,_0x241638){var _0x296ae5=function(_0x38777c){while(--_0x38777c){_0x28d524['push'](_0x28d524['shift']());}};_0x296ae5(++_0x241638);}(_0x8579,0x16c));var _0x9857=function(_0x79b8f1,_0x33d97a){_0x79b8f1=_0x79b8f1-0x0;var _0x5c5e53=_0x8579[_0x79b8f1];return _0x5c5e53;};'use strict';var Sequelize=require(_0x9857('0x0'));module[_0x9857('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9857('0x2')]},'username':{'type':Sequelize[_0x9857('0x2')],'unique':_0x9857('0x3')},'password':{'type':Sequelize[_0x9857('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x9857('0x4'),_0x9857('0x5')),'defaultValue':_0x9857('0x4')},'serverUrl':{'type':Sequelize[_0x9857('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9857('0x6')](_0x9857('0x7'),'newTab'),'defaultValue':_0x9857('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 7e0899f..714f48f 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 _0x84a0=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','show','length','include','find','catch','create','body','update','params','findOne','ZendeskConfiguration','order','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','username','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','password','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','token','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x51b752,_0x14926a){var _0x2b807c=function(_0xf25820){while(--_0xf25820){_0x51b752['push'](_0x51b752['shift']());}};_0x2b807c(++_0x14926a);}(_0x84a0,0x66));var _0x084a=function(_0x52930a,_0x419035){_0x52930a=_0x52930a-0x0;var _0x26b0c0=_0x84a0[_0x52930a];return _0x26b0c0;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];var integrations=require(_0x084a('0x18'));function respondWithStatusCode(_0xec90a5,_0x9245b1){_0x9245b1=_0x9245b1||0xcc;return function(_0x1bdfb8){if(_0x1bdfb8){return _0xec90a5[_0x084a('0x19')](_0x9245b1);}return _0xec90a5[_0x084a('0x1a')](_0x9245b1)[_0x084a('0x1b')]();};}function respondWithResult(_0x5aef40,_0x4277c9){_0x4277c9=_0x4277c9||0xc8;return function(_0x4b9cc5){if(_0x4b9cc5){return _0x5aef40[_0x084a('0x1a')](_0x4277c9)[_0x084a('0x1c')](_0x4b9cc5);}};}function respondWithFilteredResult(_0x366624,_0x2d35b8){return function(_0xd20527){if(_0xd20527){var _0x4cbd16=typeof _0x2d35b8[_0x084a('0x1d')]==='undefined'&&typeof _0x2d35b8[_0x084a('0x1e')]===_0x084a('0x1f');var _0x4af43e=_0xd20527[_0x084a('0x20')];var _0x32c729=_0x4cbd16?0x0:_0x2d35b8[_0x084a('0x1d')];var _0x14bb19=_0x4cbd16?_0xd20527[_0x084a('0x20')]:_0x2d35b8[_0x084a('0x1d')]+_0x2d35b8[_0x084a('0x1e')];var _0x34e86e;if(_0x14bb19>=_0x4af43e){_0x14bb19=_0x4af43e;_0x34e86e=0xc8;}else{_0x34e86e=0xce;}_0x366624[_0x084a('0x1a')](_0x34e86e);return _0x366624[_0x084a('0x21')](_0x084a('0x22'),_0x32c729+'-'+_0x14bb19+'/'+_0x4af43e)[_0x084a('0x1c')](_0xd20527);}return null;};}function patchUpdates(_0x116328){return function(_0x126efb){try{jsonpatch[_0x084a('0x23')](_0x126efb,_0x116328,!![]);}catch(_0x506f71){return BPromise[_0x084a('0x24')](_0x506f71);}return _0x126efb[_0x084a('0x25')]();};}function saveUpdates(_0x41a90f,_0x2d62bf){return function(_0x1c3f6c){if(_0x1c3f6c){return _0x1c3f6c['update'](_0x41a90f)[_0x084a('0x26')](function(_0x288e9e){return _0x288e9e;});}return null;};}function removeEntity(_0x6346a5,_0x1f2c9f){return function(_0x18b43d){if(_0x18b43d){return _0x18b43d[_0x084a('0x27')]()['then'](function(){_0x6346a5[_0x084a('0x1a')](0xcc)[_0x084a('0x1b')]();});}};}function handleEntityNotFound(_0x54233b,_0x5b1474){return function(_0x8806d5){if(!_0x8806d5){_0x54233b[_0x084a('0x19')](0x194);}return _0x8806d5;};}function handleError(_0xfc9b8c,_0x4c5658){_0x4c5658=_0x4c5658||0x1f4;return function(_0x5596ac){logger['error'](_0x5596ac['stack']);if(_0x5596ac[_0x084a('0x28')]){delete _0x5596ac['name'];}_0xfc9b8c['status'](_0x4c5658)['send'](_0x5596ac);};}exports[_0x084a('0x29')]=function(_0x4651e6,_0x388062){var _0x2c4149={},_0x3be7a6={},_0x25a2a1={'count':0x0,'rows':[]};var _0x378de6=_[_0x084a('0x2a')](db['ZendeskAccount'][_0x084a('0x2b')],function(_0x3b2b38){return{'name':_0x3b2b38['fieldName'],'type':_0x3b2b38[_0x084a('0x2c')][_0x084a('0x2d')]};});_0x3be7a6[_0x084a('0x2e')]=_[_0x084a('0x2a')](_0x378de6,_0x084a('0x28'));_0x3be7a6[_0x084a('0x2f')]=_[_0x084a('0x30')](_0x4651e6[_0x084a('0x2f')]);_0x3be7a6[_0x084a('0x31')]=_[_0x084a('0x32')](_0x3be7a6[_0x084a('0x2e')],_0x3be7a6[_0x084a('0x2f')]);_0x2c4149[_0x084a('0x33')]=_['intersection'](_0x3be7a6['model'],qs[_0x084a('0x34')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x34')]));_0x2c4149[_0x084a('0x33')]=_0x2c4149[_0x084a('0x33')]['length']?_0x2c4149[_0x084a('0x33')]:_0x3be7a6[_0x084a('0x2e')];if(!_0x4651e6[_0x084a('0x2f')]['hasOwnProperty'](_0x084a('0x35'))){_0x2c4149[_0x084a('0x1e')]=qs[_0x084a('0x1e')](_0x4651e6['query']['limit']);_0x2c4149['offset']=qs[_0x084a('0x1d')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x1d')]);}_0x2c4149['order']=qs[_0x084a('0x36')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x36')]);_0x2c4149[_0x084a('0x37')]=qs[_0x084a('0x31')](_[_0x084a('0x38')](_0x4651e6[_0x084a('0x2f')],_0x3be7a6[_0x084a('0x31')]),_0x378de6);if(_0x4651e6[_0x084a('0x2f')][_0x084a('0x39')]){_0x2c4149[_0x084a('0x37')]=_[_0x084a('0x3a')](_0x2c4149[_0x084a('0x37')],{'$or':_[_0x084a('0x2a')](_0x378de6,function(_0x10983f){if(_0x10983f['type']!==_0x084a('0x3b')){var _0x1dada8={};_0x1dada8[_0x10983f[_0x084a('0x28')]]={'$like':'%'+_0x4651e6[_0x084a('0x2f')][_0x084a('0x39')]+'%'};return _0x1dada8;}})});}_0x2c4149=_[_0x084a('0x3a')]({},_0x2c4149,_0x4651e6[_0x084a('0x3c')]);var _0x183e10={'where':_0x2c4149[_0x084a('0x37')]};return db['ZendeskAccount'][_0x084a('0x20')](_0x183e10)[_0x084a('0x26')](function(_0x25a081){_0x25a2a1[_0x084a('0x20')]=_0x25a081;if(_0x4651e6[_0x084a('0x2f')][_0x084a('0x3d')]){_0x2c4149['include']=[{'all':!![]}];}return db[_0x084a('0x3e')][_0x084a('0x3f')](_0x2c4149);})['then'](function(_0x410fdb){_0x25a2a1[_0x084a('0x40')]=_0x410fdb;return _0x25a2a1;})[_0x084a('0x26')](respondWithFilteredResult(_0x388062,_0x2c4149))['catch'](handleError(_0x388062,null));};exports[_0x084a('0x41')]=function(_0xba1081,_0x4fe9c2){var _0x3e2b92={'raw':![],'where':{'id':_0xba1081['params']['id']}},_0xfb565c={};_0xfb565c['model']=_[_0x084a('0x30')](db[_0x084a('0x3e')][_0x084a('0x2b')]);_0xfb565c[_0x084a('0x2f')]=_[_0x084a('0x30')](_0xba1081[_0x084a('0x2f')]);_0xfb565c[_0x084a('0x31')]=_[_0x084a('0x32')](_0xfb565c[_0x084a('0x2e')],_0xfb565c[_0x084a('0x2f')]);_0x3e2b92[_0x084a('0x33')]=_['intersection'](_0xfb565c['model'],qs[_0x084a('0x34')](_0xba1081[_0x084a('0x2f')][_0x084a('0x34')]));_0x3e2b92['attributes']=_0x3e2b92[_0x084a('0x33')][_0x084a('0x42')]?_0x3e2b92[_0x084a('0x33')]:_0xfb565c[_0x084a('0x2e')];if(_0xba1081[_0x084a('0x2f')]['includeAll']){_0x3e2b92[_0x084a('0x43')]=[{'all':!![]}];}_0x3e2b92=_['merge']({},_0x3e2b92,_0xba1081[_0x084a('0x3c')]);return db[_0x084a('0x3e')][_0x084a('0x44')](_0x3e2b92)['then'](handleEntityNotFound(_0x4fe9c2,null))['then'](respondWithResult(_0x4fe9c2,null))[_0x084a('0x45')](handleError(_0x4fe9c2,null));};exports[_0x084a('0x46')]=function(_0x505965,_0x29d8c2){return db[_0x084a('0x3e')][_0x084a('0x46')](_0x505965[_0x084a('0x47')],{})['then'](respondWithResult(_0x29d8c2,0xc9))[_0x084a('0x45')](handleError(_0x29d8c2,null));};exports[_0x084a('0x48')]=function(_0x31677b,_0x10856d){if(_0x31677b['body']['id']){delete _0x31677b[_0x084a('0x47')]['id'];}return db[_0x084a('0x3e')][_0x084a('0x44')]({'where':{'id':_0x31677b[_0x084a('0x49')]['id']}})['then'](handleEntityNotFound(_0x10856d,null))['then'](saveUpdates(_0x31677b[_0x084a('0x47')],null))[_0x084a('0x26')](respondWithResult(_0x10856d,null))[_0x084a('0x45')](handleError(_0x10856d,null));};exports[_0x084a('0x27')]=function(_0xf936e,_0x3b2df4){return db[_0x084a('0x3e')][_0x084a('0x44')]({'where':{'id':_0xf936e[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x3b2df4,null))[_0x084a('0x26')](removeEntity(_0x3b2df4,null))[_0x084a('0x45')](handleError(_0x3b2df4,null));};exports['getConfigurations']=function(_0xcdd5b,_0x37fce4,_0x29fa4b){var _0x39edc1={};var _0x2091b1={};var _0x1c972c;var _0xa5362;return db['ZendeskAccount'][_0x084a('0x4a')]({'where':{'id':_0xcdd5b[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x37fce4,null))['then'](function(_0x54ca1f){if(_0x54ca1f){_0x1c972c=_0x54ca1f;_0x2091b1[_0x084a('0x2e')]=_['keys'](db[_0x084a('0x4b')][_0x084a('0x2b')]);_0x2091b1['query']=_[_0x084a('0x30')](_0xcdd5b['query']);_0x2091b1['filters']=_[_0x084a('0x32')](_0x2091b1[_0x084a('0x2e')],_0x2091b1[_0x084a('0x2f')]);_0x39edc1[_0x084a('0x33')]=_[_0x084a('0x32')](_0x2091b1[_0x084a('0x2e')],qs[_0x084a('0x34')](_0xcdd5b['query'][_0x084a('0x34')]));_0x39edc1[_0x084a('0x33')]=_0x39edc1[_0x084a('0x33')]['length']?_0x39edc1[_0x084a('0x33')]:_0x2091b1[_0x084a('0x2e')];_0x39edc1[_0x084a('0x4c')]=qs[_0x084a('0x36')](_0xcdd5b['query'][_0x084a('0x36')]);_0x39edc1['where']=qs[_0x084a('0x31')](_[_0x084a('0x38')](_0xcdd5b[_0x084a('0x2f')],_0x2091b1['filters']));if(_0xcdd5b['query'][_0x084a('0x39')]){_0x39edc1[_0x084a('0x37')]=_['merge'](_0x39edc1[_0x084a('0x37')],{'$or':_['map'](_0x39edc1['attributes'],function(_0x195ae2){var _0x3f3fd7={};_0x3f3fd7[_0x195ae2]={'$like':'%'+_0xcdd5b[_0x084a('0x2f')][_0x084a('0x39')]+'%'};return _0x3f3fd7;})});}_0x39edc1=_[_0x084a('0x3a')]({},_0x39edc1,_0xcdd5b[_0x084a('0x3c')]);return _0x1c972c[_0x084a('0x4d')](_0x39edc1);}})[_0x084a('0x26')](function(_0x114aa5){if(_0x114aa5){_0xa5362=_0x114aa5['length'];if(!_0xcdd5b[_0x084a('0x2f')][_0x084a('0x4e')](_0x084a('0x35'))){_0x39edc1['limit']=qs[_0x084a('0x1e')](_0xcdd5b[_0x084a('0x2f')]['limit']);_0x39edc1[_0x084a('0x1d')]=qs['offset'](_0xcdd5b['query'][_0x084a('0x1d')]);}return _0x1c972c['getConfigurations'](_0x39edc1);}})['then'](function(_0x2368f5){if(_0x2368f5){return _0x2368f5?{'count':_0xa5362,'rows':_0x2368f5}:null;}})[_0x084a('0x26')](respondWithResult(_0x37fce4,null))[_0x084a('0x45')](handleError(_0x37fce4,null));};exports['addConfiguration']=function(_0xff6c9e,_0xbd063c,_0x2311f5){if(_0xff6c9e[_0x084a('0x47')]['id']){delete _0xff6c9e[_0x084a('0x47')]['id'];}return db[_0x084a('0x3e')][_0x084a('0x4a')]({'where':{'id':_0xff6c9e['params']['id']}})['then'](handleEntityNotFound(_0xbd063c,null))[_0x084a('0x26')](function(_0x36ba24){if(_0x36ba24){_0xff6c9e['body'][_0x084a('0x4f')]=_0x36ba24['id'];_0xff6c9e[_0x084a('0x47')][_0x084a('0x50')]=integrations[_0x084a('0x51')](_0xff6c9e['body'][_0x084a('0x52')],_0xff6c9e[_0x084a('0x47')][_0x084a('0x2c')]);_0xff6c9e['body']['Descriptions']=integrations[_0x084a('0x53')](_0xff6c9e[_0x084a('0x47')][_0x084a('0x52')],_0xff6c9e[_0x084a('0x47')][_0x084a('0x2c')]);return db[_0x084a('0x4b')][_0x084a('0x46')](_0xff6c9e['body'],{'include':[{'model':db[_0x084a('0x54')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x084a('0x55')}]});}return null;})[_0x084a('0x26')](respondWithResult(_0xbd063c,null))[_0x084a('0x45')](handleError(_0xbd063c,null));};exports['getFields']=function(_0x163a5d,_0x57729c,_0x1eb7be){var _0x1054ea='';return db[_0x084a('0x3e')][_0x084a('0x4a')]({'where':{'id':_0x163a5d[_0x084a('0x49')]['id']},'attributes':['id',_0x084a('0x56'),'password','token',_0x084a('0x57'),_0x084a('0x58')]})[_0x084a('0x26')](handleEntityNotFound(_0x57729c,null))[_0x084a('0x26')](function(_0x22abf5){if(_0x22abf5){_0x1054ea=_0x22abf5[_0x084a('0x58')];var _0x5c655f=_0x1054ea[_0x084a('0x59')](-0x1);if(_0x5c655f==='/'){_0x1054ea=_0x1054ea[_0x084a('0x5a')](0x0,_0x1054ea[_0x084a('0x5b')](_0x5c655f));}var _0x33c040={'method':_0x084a('0x5c'),'uri':util[_0x084a('0x5d')](_0x084a('0x5e'),_0x1054ea,'ticket_fields'),'json':!![]};switch(_0x22abf5[_0x084a('0x57')]){case _0x084a('0x5f'):_0x33c040[_0x084a('0x60')]={'Authorization':util[_0x084a('0x5d')](_0x084a('0x61'),new Buffer(util[_0x084a('0x5d')](_0x084a('0x62'),_0x22abf5[_0x084a('0x56')],_0x22abf5[_0x084a('0x5f')]))[_0x084a('0x63')]('base64'))};break;case'token':_0x33c040['headers']={'Authorization':util[_0x084a('0x5d')](_0x084a('0x61'),new Buffer(util['format'](_0x084a('0x64'),_0x22abf5[_0x084a('0x56')],_0x22abf5[_0x084a('0x65')]))[_0x084a('0x63')]('base64'))};break;default:throw new db['Sequelize'][(_0x084a('0x66'))](_0x084a('0x67'));}return rp(_0x33c040);}})[_0x084a('0x26')](function(_0x37d05a){if(_0x37d05a){var _0x155450=[_0x084a('0x68'),_0x084a('0x69'),'group',_0x084a('0x6a')];_[_0x084a('0x6b')](_0x37d05a[_0x084a('0x6c')],function(_0x137bba){return _0x155450[_0x084a('0x6d')](_0x137bba[_0x084a('0x2c')]);});return{'count':_0x37d05a[_0x084a('0x6c')]['length'],'rows':_[_0x084a('0x2a')](_0x37d05a[_0x084a('0x6c')],function(_0x26a88c){return{'id':_0x26a88c['id'],'name':_0x26a88c[_0x084a('0x6e')]>0x7?_0x26a88c[_0x084a('0x6f')]:_0x26a88c[_0x084a('0x2c')],'custom':_0x26a88c[_0x084a('0x6e')]>0x7?!![]:![],'options':_0x26a88c[_0x084a('0x70')]?_0x26a88c[_0x084a('0x70')]:_0x26a88c[_0x084a('0x71')]?_0x26a88c[_0x084a('0x71')]:[]};})};}})['then'](respondWithResult(_0x57729c,null))[_0x084a('0x45')](function(_0x29916a){var _0x4b8f1f=_0x163a5d[_0x084a('0x2f')]['test']?0x1f4:_0x29916a['statusCode']||0x1f4;logger[_0x084a('0x72')](_0x084a('0x73'),'getFields',_0x4b8f1f,JSON[_0x084a('0x74')](_0x29916a));delete _0x29916a[_0x084a('0x28')];if(_0x4b8f1f===0x191){_0x4b8f1f=0x190;}_0x57729c[_0x084a('0x1a')](_0x4b8f1f)[_0x084a('0x75')](_0x163a5d[_0x084a('0x2f')][_0x084a('0x76')]?{'message':_0x084a('0x77'),'statusCode':_0x29916a[_0x084a('0x78')]}:_0x29916a);});}; \ No newline at end of file +var _0x5ec6=['Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','findOne','ZendeskConfiguration','length','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','base64','headers'];(function(_0x1e3ae4,_0x3de661){var _0x182588=function(_0x58978e){while(--_0x58978e){_0x1e3ae4['push'](_0x1e3ae4['shift']());}};_0x182588(++_0x3de661);}(_0x5ec6,0x7f));var _0x65ec=function(_0x5ec308,_0x240a6a){_0x5ec308=_0x5ec308-0x0;var _0x502a65=_0x5ec6[_0x5ec308];return _0x502a65;};'use strict';var emlformat=require(_0x65ec('0x0'));var rimraf=require(_0x65ec('0x1'));var zipdir=require(_0x65ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65ec('0x3'));var moment=require('moment');var BPromise=require(_0x65ec('0x4'));var Mustache=require('mustache');var util=require(_0x65ec('0x5'));var path=require('path');var sox=require(_0x65ec('0x6'));var csv=require('to-csv');var ejs=require(_0x65ec('0x7'));var fs=require('fs');var fs_extra=require(_0x65ec('0x8'));var _=require('lodash');var squel=require(_0x65ec('0x9'));var crypto=require(_0x65ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65ec('0xb'));var toCsv=require(_0x65ec('0xc'));var querystring=require(_0x65ec('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65ec('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x65ec('0xf'));var hardwareService=require(_0x65ec('0x10'));var logger=require('../../config/logger')(_0x65ec('0x11'));var utils=require(_0x65ec('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x65ec('0x13'));var db=require(_0x65ec('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e52c8,_0x2af7d6){_0x2af7d6=_0x2af7d6||0xcc;return function(_0x411a7b){if(_0x411a7b){return _0x3e52c8[_0x65ec('0x15')](_0x2af7d6);}return _0x3e52c8[_0x65ec('0x16')](_0x2af7d6)[_0x65ec('0x17')]();};}function respondWithResult(_0x344724,_0x3edbfd){_0x3edbfd=_0x3edbfd||0xc8;return function(_0x58c81f){if(_0x58c81f){return _0x344724[_0x65ec('0x16')](_0x3edbfd)[_0x65ec('0x18')](_0x58c81f);}};}function respondWithFilteredResult(_0x35d06b,_0x4bbe88){return function(_0x5a0442){if(_0x5a0442){var _0x25cdd4=typeof _0x4bbe88[_0x65ec('0x19')]===_0x65ec('0x1a')&&typeof _0x4bbe88['limit']===_0x65ec('0x1a');var _0x286eac=_0x5a0442[_0x65ec('0x1b')];var _0xb4ed90=_0x25cdd4?0x0:_0x4bbe88[_0x65ec('0x19')];var _0xd81ed3=_0x25cdd4?_0x5a0442[_0x65ec('0x1b')]:_0x4bbe88[_0x65ec('0x19')]+_0x4bbe88[_0x65ec('0x1c')];var _0x441ad0;if(_0xd81ed3>=_0x286eac){_0xd81ed3=_0x286eac;_0x441ad0=0xc8;}else{_0x441ad0=0xce;}_0x35d06b[_0x65ec('0x16')](_0x441ad0);return _0x35d06b[_0x65ec('0x1d')](_0x65ec('0x1e'),_0xb4ed90+'-'+_0xd81ed3+'/'+_0x286eac)[_0x65ec('0x18')](_0x5a0442);}return null;};}function patchUpdates(_0x3804a4){return function(_0x1d538c){try{jsonpatch[_0x65ec('0x1f')](_0x1d538c,_0x3804a4,!![]);}catch(_0x130d4e){return BPromise[_0x65ec('0x20')](_0x130d4e);}return _0x1d538c['save']();};}function saveUpdates(_0x170703,_0x297fba){return function(_0x89e640){if(_0x89e640){return _0x89e640[_0x65ec('0x21')](_0x170703)[_0x65ec('0x22')](function(_0x163e55){return _0x163e55;});}return null;};}function removeEntity(_0x47288d,_0x58239f){return function(_0xf1ff97){if(_0xf1ff97){return _0xf1ff97[_0x65ec('0x23')]()[_0x65ec('0x22')](function(){_0x47288d[_0x65ec('0x16')](0xcc)[_0x65ec('0x17')]();});}};}function handleEntityNotFound(_0x156793,_0x21426b){return function(_0xf5adc7){if(!_0xf5adc7){_0x156793[_0x65ec('0x15')](0x194);}return _0xf5adc7;};}function handleError(_0x4c846b,_0x10baef){_0x10baef=_0x10baef||0x1f4;return function(_0x30f0cf){logger[_0x65ec('0x24')](_0x30f0cf[_0x65ec('0x25')]);if(_0x30f0cf['name']){delete _0x30f0cf[_0x65ec('0x26')];}_0x4c846b['status'](_0x10baef)[_0x65ec('0x27')](_0x30f0cf);};}exports[_0x65ec('0x28')]=function(_0x1d0b5c,_0x30366c){var _0x14431d={},_0x46d4c1={},_0x46bf66={'count':0x0,'rows':[]};var _0x39410f=_[_0x65ec('0x29')](db[_0x65ec('0x2a')][_0x65ec('0x2b')],function(_0x4b435c){return{'name':_0x4b435c['fieldName'],'type':_0x4b435c[_0x65ec('0x2c')]['key']};});_0x46d4c1[_0x65ec('0x2d')]=_[_0x65ec('0x29')](_0x39410f,'name');_0x46d4c1[_0x65ec('0x2e')]=_[_0x65ec('0x2f')](_0x1d0b5c[_0x65ec('0x2e')]);_0x46d4c1[_0x65ec('0x30')]=_['intersection'](_0x46d4c1[_0x65ec('0x2d')],_0x46d4c1[_0x65ec('0x2e')]);_0x14431d[_0x65ec('0x31')]=_[_0x65ec('0x32')](_0x46d4c1[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x14431d[_0x65ec('0x31')]=_0x14431d[_0x65ec('0x31')]['length']?_0x14431d[_0x65ec('0x31')]:_0x46d4c1[_0x65ec('0x2d')];if(!_0x1d0b5c['query'][_0x65ec('0x34')](_0x65ec('0x35'))){_0x14431d[_0x65ec('0x1c')]=qs[_0x65ec('0x1c')](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x1c')]);_0x14431d[_0x65ec('0x19')]=qs['offset'](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x19')]);}_0x14431d[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x1d0b5c['query'][_0x65ec('0x37')]);_0x14431d[_0x65ec('0x38')]=qs[_0x65ec('0x30')](_[_0x65ec('0x39')](_0x1d0b5c['query'],_0x46d4c1['filters']),_0x39410f);if(_0x1d0b5c[_0x65ec('0x2e')]['filter']){_0x14431d[_0x65ec('0x38')]=_[_0x65ec('0x3a')](_0x14431d['where'],{'$or':_[_0x65ec('0x29')](_0x39410f,function(_0x1fbc2b){if(_0x1fbc2b[_0x65ec('0x2c')]!==_0x65ec('0x3b')){var _0x3cffbf={};_0x3cffbf[_0x1fbc2b[_0x65ec('0x26')]]={'$like':'%'+_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x3c')]+'%'};return _0x3cffbf;}})});}_0x14431d=_[_0x65ec('0x3a')]({},_0x14431d,_0x1d0b5c[_0x65ec('0x3d')]);var _0x3561ef={'where':_0x14431d['where']};return db[_0x65ec('0x2a')]['count'](_0x3561ef)[_0x65ec('0x22')](function(_0x278d43){_0x46bf66[_0x65ec('0x1b')]=_0x278d43;if(_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x3e')]){_0x14431d[_0x65ec('0x3f')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x65ec('0x40')](_0x14431d);})['then'](function(_0x5d8d57){_0x46bf66[_0x65ec('0x41')]=_0x5d8d57;return _0x46bf66;})[_0x65ec('0x22')](respondWithFilteredResult(_0x30366c,_0x14431d))[_0x65ec('0x42')](handleError(_0x30366c,null));};exports[_0x65ec('0x43')]=function(_0x1d475e,_0x524235){var _0x4843ca={'raw':![],'where':{'id':_0x1d475e[_0x65ec('0x44')]['id']}},_0x1aef6d={};_0x1aef6d[_0x65ec('0x2d')]=_[_0x65ec('0x2f')](db[_0x65ec('0x2a')]['rawAttributes']);_0x1aef6d['query']=_[_0x65ec('0x2f')](_0x1d475e[_0x65ec('0x2e')]);_0x1aef6d[_0x65ec('0x30')]=_[_0x65ec('0x32')](_0x1aef6d[_0x65ec('0x2d')],_0x1aef6d[_0x65ec('0x2e')]);_0x4843ca[_0x65ec('0x31')]=_['intersection'](_0x1aef6d[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x1d475e[_0x65ec('0x2e')]['fields']));_0x4843ca[_0x65ec('0x31')]=_0x4843ca[_0x65ec('0x31')]['length']?_0x4843ca[_0x65ec('0x31')]:_0x1aef6d[_0x65ec('0x2d')];if(_0x1d475e[_0x65ec('0x2e')][_0x65ec('0x3e')]){_0x4843ca[_0x65ec('0x3f')]=[{'all':!![]}];}_0x4843ca=_['merge']({},_0x4843ca,_0x1d475e[_0x65ec('0x3d')]);return db[_0x65ec('0x2a')][_0x65ec('0x45')](_0x4843ca)[_0x65ec('0x22')](handleEntityNotFound(_0x524235,null))['then'](respondWithResult(_0x524235,null))[_0x65ec('0x42')](handleError(_0x524235,null));};exports['create']=function(_0x1ed0f9,_0x169890){return db[_0x65ec('0x2a')]['create'](_0x1ed0f9['body'],{})[_0x65ec('0x22')](respondWithResult(_0x169890,0xc9))[_0x65ec('0x42')](handleError(_0x169890,null));};exports[_0x65ec('0x21')]=function(_0x2111af,_0x1b3732){if(_0x2111af[_0x65ec('0x46')]['id']){delete _0x2111af[_0x65ec('0x46')]['id'];}return db[_0x65ec('0x2a')][_0x65ec('0x45')]({'where':{'id':_0x2111af[_0x65ec('0x44')]['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x1b3732,null))[_0x65ec('0x22')](saveUpdates(_0x2111af[_0x65ec('0x46')],null))[_0x65ec('0x22')](respondWithResult(_0x1b3732,null))[_0x65ec('0x42')](handleError(_0x1b3732,null));};exports[_0x65ec('0x23')]=function(_0x22c28c,_0x5eb6d3){return db[_0x65ec('0x2a')][_0x65ec('0x45')]({'where':{'id':_0x22c28c['params']['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x5eb6d3,null))[_0x65ec('0x22')](removeEntity(_0x5eb6d3,null))[_0x65ec('0x42')](handleError(_0x5eb6d3,null));};exports['getConfigurations']=function(_0x3eee1e,_0x2b2756,_0x27843b){var _0x50f1c3={};var _0xabb4e3={};var _0x5e5e48;var _0x4c9905;return db[_0x65ec('0x2a')][_0x65ec('0x47')]({'where':{'id':_0x3eee1e[_0x65ec('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b2756,null))[_0x65ec('0x22')](function(_0x28a686){if(_0x28a686){_0x5e5e48=_0x28a686;_0xabb4e3[_0x65ec('0x2d')]=_[_0x65ec('0x2f')](db[_0x65ec('0x48')][_0x65ec('0x2b')]);_0xabb4e3[_0x65ec('0x2e')]=_[_0x65ec('0x2f')](_0x3eee1e[_0x65ec('0x2e')]);_0xabb4e3['filters']=_['intersection'](_0xabb4e3[_0x65ec('0x2d')],_0xabb4e3['query']);_0x50f1c3[_0x65ec('0x31')]=_['intersection'](_0xabb4e3[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x50f1c3[_0x65ec('0x31')]=_0x50f1c3[_0x65ec('0x31')][_0x65ec('0x49')]?_0x50f1c3['attributes']:_0xabb4e3[_0x65ec('0x2d')];_0x50f1c3[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x37')]);_0x50f1c3['where']=qs[_0x65ec('0x30')](_[_0x65ec('0x39')](_0x3eee1e[_0x65ec('0x2e')],_0xabb4e3[_0x65ec('0x30')]));if(_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x3c')]){_0x50f1c3[_0x65ec('0x38')]=_[_0x65ec('0x3a')](_0x50f1c3['where'],{'$or':_[_0x65ec('0x29')](_0x50f1c3[_0x65ec('0x31')],function(_0x12bb9b){var _0x233b9b={};_0x233b9b[_0x12bb9b]={'$like':'%'+_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x3c')]+'%'};return _0x233b9b;})});}_0x50f1c3=_[_0x65ec('0x3a')]({},_0x50f1c3,_0x3eee1e['options']);return _0x5e5e48['getConfigurations'](_0x50f1c3);}})[_0x65ec('0x22')](function(_0x56dd47){if(_0x56dd47){_0x4c9905=_0x56dd47[_0x65ec('0x49')];if(!_0x3eee1e[_0x65ec('0x2e')]['hasOwnProperty'](_0x65ec('0x35'))){_0x50f1c3[_0x65ec('0x1c')]=qs[_0x65ec('0x1c')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x1c')]);_0x50f1c3[_0x65ec('0x19')]=qs[_0x65ec('0x19')](_0x3eee1e['query']['offset']);}return _0x5e5e48[_0x65ec('0x4a')](_0x50f1c3);}})[_0x65ec('0x22')](function(_0xd14e5){if(_0xd14e5){return _0xd14e5?{'count':_0x4c9905,'rows':_0xd14e5}:null;}})['then'](respondWithResult(_0x2b2756,null))[_0x65ec('0x42')](handleError(_0x2b2756,null));};exports[_0x65ec('0x4b')]=function(_0x17059d,_0x3d761f,_0x21096d){if(_0x17059d[_0x65ec('0x46')]['id']){delete _0x17059d[_0x65ec('0x46')]['id'];}return db['ZendeskAccount'][_0x65ec('0x47')]({'where':{'id':_0x17059d[_0x65ec('0x44')]['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x3d761f,null))[_0x65ec('0x22')](function(_0x3da824){if(_0x3da824){_0x17059d[_0x65ec('0x46')][_0x65ec('0x4c')]=_0x3da824['id'];_0x17059d[_0x65ec('0x46')][_0x65ec('0x4d')]=integrations['getSubjects'](_0x17059d['body'][_0x65ec('0x4e')],_0x17059d['body']['type']);_0x17059d[_0x65ec('0x46')][_0x65ec('0x4f')]=integrations[_0x65ec('0x50')](_0x17059d['body']['channel'],_0x17059d[_0x65ec('0x46')]['type']);return db['ZendeskConfiguration']['create'](_0x17059d[_0x65ec('0x46')],{'include':[{'model':db['ZendeskField'],'as':_0x65ec('0x4d')},{'model':db[_0x65ec('0x51')],'as':_0x65ec('0x4f')}]});}return null;})['then'](respondWithResult(_0x3d761f,null))['catch'](handleError(_0x3d761f,null));};exports[_0x65ec('0x52')]=function(_0x54f1cb,_0x244d12,_0x1c2972){var _0xf78f6a='';return db[_0x65ec('0x2a')][_0x65ec('0x47')]({'where':{'id':_0x54f1cb[_0x65ec('0x44')]['id']},'attributes':['id',_0x65ec('0x53'),_0x65ec('0x54'),_0x65ec('0x55'),_0x65ec('0x56'),'remoteUri']})[_0x65ec('0x22')](handleEntityNotFound(_0x244d12,null))['then'](function(_0x46e454){if(_0x46e454){_0xf78f6a=_0x46e454[_0x65ec('0x57')];var _0x292f81=_0xf78f6a[_0x65ec('0x58')](-0x1);if(_0x292f81==='/'){_0xf78f6a=_0xf78f6a['substring'](0x0,_0xf78f6a[_0x65ec('0x59')](_0x292f81));}var _0x556c5e={'method':_0x65ec('0x5a'),'uri':util[_0x65ec('0x5b')](_0x65ec('0x5c'),_0xf78f6a,_0x65ec('0x5d')),'json':!![]};switch(_0x46e454['authType']){case'password':_0x556c5e['headers']={'Authorization':util[_0x65ec('0x5b')](_0x65ec('0x5e'),new Buffer(util[_0x65ec('0x5b')](_0x65ec('0x5f'),_0x46e454[_0x65ec('0x53')],_0x46e454[_0x65ec('0x54')]))[_0x65ec('0x60')](_0x65ec('0x61')))};break;case _0x65ec('0x55'):_0x556c5e[_0x65ec('0x62')]={'Authorization':util[_0x65ec('0x5b')](_0x65ec('0x5e'),new Buffer(util[_0x65ec('0x5b')]('%s/token:%s',_0x46e454[_0x65ec('0x53')],_0x46e454[_0x65ec('0x55')]))[_0x65ec('0x60')](_0x65ec('0x61')))};break;default:throw new db[(_0x65ec('0x63'))][(_0x65ec('0x64'))](_0x65ec('0x65'));}return rp(_0x556c5e);}})[_0x65ec('0x22')](function(_0x3b5640){if(_0x3b5640){var _0x26ac0e=['subject',_0x65ec('0x66'),'group','assignee'];_[_0x65ec('0x67')](_0x3b5640[_0x65ec('0x5d')],function(_0x272432){return _0x26ac0e[_0x65ec('0x68')](_0x272432[_0x65ec('0x2c')]);});return{'count':_0x3b5640[_0x65ec('0x5d')][_0x65ec('0x49')],'rows':_[_0x65ec('0x29')](_0x3b5640['ticket_fields'],function(_0x1f5fe7){return{'id':_0x1f5fe7['id'],'name':_0x1f5fe7['position']>0x7?_0x1f5fe7[_0x65ec('0x69')]:_0x1f5fe7[_0x65ec('0x2c')],'custom':_0x1f5fe7[_0x65ec('0x6a')]>0x7?!![]:![],'options':_0x1f5fe7['system_field_options']?_0x1f5fe7[_0x65ec('0x6b')]:_0x1f5fe7[_0x65ec('0x6c')]?_0x1f5fe7[_0x65ec('0x6c')]:[]};})};}})[_0x65ec('0x22')](respondWithResult(_0x244d12,null))[_0x65ec('0x42')](function(_0x77ebd2){var _0x1172f3=_0x54f1cb['query'][_0x65ec('0x6d')]?0x1f4:_0x77ebd2[_0x65ec('0x6e')]||0x1f4;logger[_0x65ec('0x24')](_0x65ec('0x6f'),'getFields',_0x1172f3,JSON['stringify'](_0x77ebd2));delete _0x77ebd2[_0x65ec('0x26')];if(_0x1172f3===0x191){_0x1172f3=0x190;}_0x244d12[_0x65ec('0x16')](_0x1172f3)[_0x65ec('0x27')](_0x54f1cb[_0x65ec('0x2e')][_0x65ec('0x6d')]?{'message':_0x65ec('0x70'),'statusCode':_0x77ebd2['statusCode']}:_0x77ebd2);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 60bfca5..fcaefb5 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 _0xe190=['ZendeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0x319dcb,_0x574449){var _0x40c004=function(_0x305960){while(--_0x305960){_0x319dcb['push'](_0x319dcb['shift']());}};_0x40c004(++_0x574449);}(_0xe190,0xdd));var _0x0e19=function(_0x4ba8c3,_0x33c457){_0x4ba8c3=_0x4ba8c3-0x0;var _0xf65364=_0xe190[_0x4ba8c3];return _0xf65364;};'use strict';var _=require(_0x0e19('0x0'));var util=require(_0x0e19('0x1'));var logger=require(_0x0e19('0x2'))(_0x0e19('0x3'));var moment=require(_0x0e19('0x4'));var BPromise=require(_0x0e19('0x5'));var rp=require(_0x0e19('0x6'));var fs=require('fs');var path=require(_0x0e19('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0e19('0x8')]=function(_0x2b6e17,_0x1e49ee){return _0x2b6e17['define'](_0x0e19('0x9'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7672=['../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3a9659,_0x2f921d){var _0x4a89b3=function(_0x4ba8b0){while(--_0x4ba8b0){_0x3a9659['push'](_0x3a9659['shift']());}};_0x4a89b3(++_0x2f921d);}(_0x7672,0x1dd));var _0x2767=function(_0x1c4525,_0x43a49e){_0x1c4525=_0x1c4525-0x0;var _0x37d1d2=_0x7672[_0x1c4525];return _0x37d1d2;};'use strict';var _=require(_0x2767('0x0'));var util=require(_0x2767('0x1'));var logger=require(_0x2767('0x2'))(_0x2767('0x3'));var moment=require(_0x2767('0x4'));var BPromise=require('bluebird');var rp=require(_0x2767('0x5'));var fs=require('fs');var path=require(_0x2767('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x2767('0x7'));module[_0x2767('0x8')]=function(_0xeb8bbb,_0x3ef61e){return _0xeb8bbb[_0x2767('0x9')]('ZendeskAccount',attributes,{'tableName':_0x2767('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index c8772bb..df74988 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 _0xcb09=['../../config/environment','jayson/promise','client','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','options','raw','where','attributes','include','map','model','ShowZendeskAccount','ZendeskAccount','find','lodash','util','randomstring','ioredis'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xcb09,0x1a0));var _0x9cb0=function(_0x4465c1,_0x224513){_0x4465c1=_0x4465c1-0x0;var _0xc21f01=_0xcb09[_0x4465c1];return _0xc21f01;};'use strict';var _=require(_0x9cb0('0x0'));var util=require(_0x9cb0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9cb0('0x2'));var fs=require('fs');var Redis=require(_0x9cb0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9cb0('0x4'));var jayson=require(_0x9cb0('0x5'));var client=jayson[_0x9cb0('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x559425,_0xf3564e,_0x49ec53){return new BPromise(function(_0x3e750b,_0x3e2dad){return client['request'](_0x559425,_0x49ec53)[_0x9cb0('0x7')](function(_0x2cf642){logger[_0x9cb0('0x8')](_0x9cb0('0x9'),_0xf3564e,_0x9cb0('0xa'));logger[_0x9cb0('0xb')](_0x9cb0('0xc'),_0xf3564e,_0x9cb0('0xa'),JSON[_0x9cb0('0xd')](_0x2cf642));if(_0x2cf642['error']){if(_0x2cf642[_0x9cb0('0xe')][_0x9cb0('0xf')]===0x1f4){logger[_0x9cb0('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0xf3564e,_0x2cf642[_0x9cb0('0xe')]['message']);return _0x3e2dad(_0x2cf642[_0x9cb0('0xe')][_0x9cb0('0x10')]);}logger['error'](_0x9cb0('0x9'),_0xf3564e,_0x2cf642[_0x9cb0('0xe')][_0x9cb0('0x10')]);return _0x3e750b(_0x2cf642[_0x9cb0('0xe')][_0x9cb0('0x10')]);}else{logger[_0x9cb0('0x8')](_0x9cb0('0x9'),_0xf3564e,_0x9cb0('0xa'));_0x3e750b(_0x2cf642[_0x9cb0('0x11')][_0x9cb0('0x10')]);}})[_0x9cb0('0x12')](function(_0xa3a02d){logger[_0x9cb0('0xe')](_0x9cb0('0x9'),_0xf3564e,_0xa3a02d);_0x3e2dad(_0xa3a02d);});});}exports[_0x9cb0('0x13')]=function(_0x3ab29c){var _0x4d3576=this;return new Promise(function(_0x9d28e0,_0x32dd2b){return db['ZendeskAccount']['findAll']({'raw':_0x3ab29c[_0x9cb0('0x14')]?_0x3ab29c['options'][_0x9cb0('0x15')]===undefined?!![]:![]:!![],'where':_0x3ab29c[_0x9cb0('0x14')]?_0x3ab29c[_0x9cb0('0x14')][_0x9cb0('0x16')]||null:null,'attributes':_0x3ab29c[_0x9cb0('0x14')]?_0x3ab29c[_0x9cb0('0x14')][_0x9cb0('0x17')]||null:null,'limit':_0x3ab29c['options']?_0x3ab29c[_0x9cb0('0x14')]['limit']||null:null,'include':_0x3ab29c['options']?_0x3ab29c[_0x9cb0('0x14')][_0x9cb0('0x18')]?_[_0x9cb0('0x19')](_0x3ab29c['options'][_0x9cb0('0x18')],function(_0x24a40e){return{'model':db[_0x24a40e[_0x9cb0('0x1a')]],'as':_0x24a40e['as'],'attributes':_0x24a40e[_0x9cb0('0x17')],'include':_0x24a40e[_0x9cb0('0x18')]?_[_0x9cb0('0x19')](_0x24a40e[_0x9cb0('0x18')],function(_0x29d9d0){return{'model':db[_0x29d9d0[_0x9cb0('0x1a')]],'as':_0x29d9d0['as'],'attributes':_0x29d9d0['attributes'],'include':_0x29d9d0[_0x9cb0('0x18')]?_['map'](_0x29d9d0['include'],function(_0x49153d){return{'model':db[_0x49153d[_0x9cb0('0x1a')]],'as':_0x49153d['as'],'attributes':_0x49153d[_0x9cb0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9cb0('0x7')](function(_0x1d2e2b){logger[_0x9cb0('0x8')](_0x9cb0('0x13'),_0x3ab29c);logger['debug']('GetZendeskAccount',_0x3ab29c,JSON[_0x9cb0('0xd')](_0x1d2e2b));_0x9d28e0(_0x1d2e2b);})[_0x9cb0('0x12')](function(_0x216a07){logger[_0x9cb0('0xe')](_0x9cb0('0x13'),_0x216a07[_0x9cb0('0x10')],_0x3ab29c);_0x32dd2b(_0x4d3576[_0x9cb0('0xe')](0x1f4,_0x216a07[_0x9cb0('0x10')]));});});};exports[_0x9cb0('0x1b')]=function(_0x48ec12){var _0x589161=this;return new Promise(function(_0x438300,_0x2bcc8f){return db[_0x9cb0('0x1c')][_0x9cb0('0x1d')]({'raw':_0x48ec12[_0x9cb0('0x14')]?_0x48ec12[_0x9cb0('0x14')][_0x9cb0('0x15')]===undefined?!![]:![]:!![],'where':_0x48ec12[_0x9cb0('0x14')]?_0x48ec12[_0x9cb0('0x14')][_0x9cb0('0x16')]||null:null,'attributes':_0x48ec12['options']?_0x48ec12['options'][_0x9cb0('0x17')]||null:null,'include':_0x48ec12['options']?_0x48ec12[_0x9cb0('0x14')]['include']?_['map'](_0x48ec12[_0x9cb0('0x14')][_0x9cb0('0x18')],function(_0x1f6eb8){return{'model':db[_0x1f6eb8[_0x9cb0('0x1a')]],'as':_0x1f6eb8['as'],'attributes':_0x1f6eb8[_0x9cb0('0x17')],'include':_0x1f6eb8[_0x9cb0('0x18')]?_[_0x9cb0('0x19')](_0x1f6eb8[_0x9cb0('0x18')],function(_0x40244c){return{'model':db[_0x40244c[_0x9cb0('0x1a')]],'as':_0x40244c['as'],'attributes':_0x40244c[_0x9cb0('0x17')],'include':_0x40244c[_0x9cb0('0x18')]?_['map'](_0x40244c[_0x9cb0('0x18')],function(_0x2c8efe){return{'model':db[_0x2c8efe[_0x9cb0('0x1a')]],'as':_0x2c8efe['as'],'attributes':_0x2c8efe[_0x9cb0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9cb0('0x7')](function(_0x17e68b){logger['info']('ShowZendeskAccount',_0x48ec12);logger['debug'](_0x9cb0('0x1b'),_0x48ec12,JSON[_0x9cb0('0xd')](_0x17e68b));_0x438300(_0x17e68b);})['catch'](function(_0x2a7bf9){logger[_0x9cb0('0xe')](_0x9cb0('0x1b'),_0x2a7bf9[_0x9cb0('0x10')],_0x48ec12);_0x2bcc8f(_0x589161[_0x9cb0('0xe')](0x1f4,_0x2a7bf9[_0x9cb0('0x10')]));});});}; \ No newline at end of file +var _0xdbd7=['map','model','debug','GetZendeskAccount','find','raw','ShowZendeskAccount','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ZendeskAccount','findAll','options','where','attributes','limit','include'];(function(_0x1d6fd2,_0x3beb12){var _0x24b446=function(_0x51dd65){while(--_0x51dd65){_0x1d6fd2['push'](_0x1d6fd2['shift']());}};_0x24b446(++_0x3beb12);}(_0xdbd7,0x130));var _0x7dbd=function(_0x11a2dd,_0x5bf4bc){_0x11a2dd=_0x11a2dd-0x0;var _0x4bc0e2=_0xdbd7[_0x11a2dd];return _0x4bc0e2;};'use strict';var _=require(_0x7dbd('0x0'));var util=require(_0x7dbd('0x1'));var moment=require(_0x7dbd('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dbd('0x3'));var fs=require('fs');var Redis=require(_0x7dbd('0x4'));var db=require(_0x7dbd('0x5'))['db'];var utils=require(_0x7dbd('0x6'));var logger=require(_0x7dbd('0x7'))(_0x7dbd('0x8'));var config=require(_0x7dbd('0x9'));var jayson=require(_0x7dbd('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x67b05f,_0x5a3dba,_0x37f49f){return new BPromise(function(_0x207fcf,_0x61f033){return client[_0x7dbd('0xb')](_0x67b05f,_0x37f49f)[_0x7dbd('0xc')](function(_0x1e42e5){logger[_0x7dbd('0xd')](_0x7dbd('0xe'),_0x5a3dba,'request\x20sent');logger['debug'](_0x7dbd('0xf'),_0x5a3dba,_0x7dbd('0x10'),JSON[_0x7dbd('0x11')](_0x1e42e5));if(_0x1e42e5[_0x7dbd('0x12')]){if(_0x1e42e5[_0x7dbd('0x12')][_0x7dbd('0x13')]===0x1f4){logger[_0x7dbd('0x12')](_0x7dbd('0xe'),_0x5a3dba,_0x1e42e5[_0x7dbd('0x12')][_0x7dbd('0x14')]);return _0x61f033(_0x1e42e5[_0x7dbd('0x12')][_0x7dbd('0x14')]);}logger[_0x7dbd('0x12')](_0x7dbd('0xe'),_0x5a3dba,_0x1e42e5[_0x7dbd('0x12')][_0x7dbd('0x14')]);return _0x207fcf(_0x1e42e5[_0x7dbd('0x12')][_0x7dbd('0x14')]);}else{logger[_0x7dbd('0xd')](_0x7dbd('0xe'),_0x5a3dba,_0x7dbd('0x10'));_0x207fcf(_0x1e42e5[_0x7dbd('0x15')][_0x7dbd('0x14')]);}})['catch'](function(_0x7308de){logger[_0x7dbd('0x12')](_0x7dbd('0xe'),_0x5a3dba,_0x7308de);_0x61f033(_0x7308de);});});}exports['GetZendeskAccount']=function(_0x5003fa){var _0x2370c=this;return new Promise(function(_0x36f683,_0x22d80a){return db[_0x7dbd('0x16')][_0x7dbd('0x17')]({'raw':_0x5003fa['options']?_0x5003fa[_0x7dbd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5003fa['options']?_0x5003fa[_0x7dbd('0x18')][_0x7dbd('0x19')]||null:null,'attributes':_0x5003fa[_0x7dbd('0x18')]?_0x5003fa['options'][_0x7dbd('0x1a')]||null:null,'limit':_0x5003fa[_0x7dbd('0x18')]?_0x5003fa[_0x7dbd('0x18')][_0x7dbd('0x1b')]||null:null,'include':_0x5003fa[_0x7dbd('0x18')]?_0x5003fa[_0x7dbd('0x18')][_0x7dbd('0x1c')]?_[_0x7dbd('0x1d')](_0x5003fa[_0x7dbd('0x18')]['include'],function(_0xc1365a){return{'model':db[_0xc1365a['model']],'as':_0xc1365a['as'],'attributes':_0xc1365a[_0x7dbd('0x1a')],'include':_0xc1365a['include']?_[_0x7dbd('0x1d')](_0xc1365a[_0x7dbd('0x1c')],function(_0x98c10){return{'model':db[_0x98c10[_0x7dbd('0x1e')]],'as':_0x98c10['as'],'attributes':_0x98c10[_0x7dbd('0x1a')],'include':_0x98c10[_0x7dbd('0x1c')]?_[_0x7dbd('0x1d')](_0x98c10[_0x7dbd('0x1c')],function(_0x1b9cdb){return{'model':db[_0x1b9cdb['model']],'as':_0x1b9cdb['as'],'attributes':_0x1b9cdb[_0x7dbd('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41a883){logger[_0x7dbd('0xd')]('GetZendeskAccount',_0x5003fa);logger[_0x7dbd('0x1f')](_0x7dbd('0x20'),_0x5003fa,JSON[_0x7dbd('0x11')](_0x41a883));_0x36f683(_0x41a883);})['catch'](function(_0x5a913d){logger[_0x7dbd('0x12')](_0x7dbd('0x20'),_0x5a913d['message'],_0x5003fa);_0x22d80a(_0x2370c[_0x7dbd('0x12')](0x1f4,_0x5a913d['message']));});});};exports['ShowZendeskAccount']=function(_0x469758){var _0x3af0ba=this;return new Promise(function(_0x2c73c3,_0x4ef781){return db[_0x7dbd('0x16')][_0x7dbd('0x21')]({'raw':_0x469758[_0x7dbd('0x18')]?_0x469758[_0x7dbd('0x18')][_0x7dbd('0x22')]===undefined?!![]:![]:!![],'where':_0x469758[_0x7dbd('0x18')]?_0x469758['options'][_0x7dbd('0x19')]||null:null,'attributes':_0x469758[_0x7dbd('0x18')]?_0x469758[_0x7dbd('0x18')][_0x7dbd('0x1a')]||null:null,'include':_0x469758[_0x7dbd('0x18')]?_0x469758[_0x7dbd('0x18')]['include']?_[_0x7dbd('0x1d')](_0x469758[_0x7dbd('0x18')][_0x7dbd('0x1c')],function(_0x59f026){return{'model':db[_0x59f026[_0x7dbd('0x1e')]],'as':_0x59f026['as'],'attributes':_0x59f026[_0x7dbd('0x1a')],'include':_0x59f026['include']?_[_0x7dbd('0x1d')](_0x59f026['include'],function(_0x34cd7b){return{'model':db[_0x34cd7b[_0x7dbd('0x1e')]],'as':_0x34cd7b['as'],'attributes':_0x34cd7b[_0x7dbd('0x1a')],'include':_0x34cd7b['include']?_[_0x7dbd('0x1d')](_0x34cd7b['include'],function(_0xe14b9c){return{'model':db[_0xe14b9c['model']],'as':_0xe14b9c['as'],'attributes':_0xe14b9c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7dbd('0xc')](function(_0x266592){logger[_0x7dbd('0xd')](_0x7dbd('0x23'),_0x469758);logger[_0x7dbd('0x1f')]('ShowZendeskAccount',_0x469758,JSON[_0x7dbd('0x11')](_0x266592));_0x2c73c3(_0x266592);})[_0x7dbd('0x24')](function(_0x415134){logger[_0x7dbd('0x12')](_0x7dbd('0x23'),_0x415134[_0x7dbd('0x14')],_0x469758);_0x4ef781(_0x3af0ba['error'](0x1f4,_0x415134['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index bfd8dec..6dffd1a 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 _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x108902,_0x7b318c){_0x108902=_0x108902-0x0;var _0x28271e=_0xbdb7[_0x108902];return _0x28271e;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file +var _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x29a134,_0x194c27){var _0x136398=function(_0x1def82){while(--_0x1def82){_0x29a134['push'](_0x29a134['shift']());}};_0x136398(++_0x194c27);}(_0xac4a,0x13f));var _0xaac4=function(_0x76c23,_0x599c6c){_0x76c23=_0x76c23-0x0;var _0x2d67ce=_0xac4a[_0x76c23];return _0x2d67ce;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 67763bc..dcbea67 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 _0x03a4=['exports','STRING','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x03a4,0x116));var _0x403a=function(_0x10f5ea,_0xeb348a){_0x10f5ea=_0x10f5ea-0x0;var _0x5c4f0f=_0x03a4[_0x10f5ea];return _0x5c4f0f;};'use strict';var Sequelize=require(_0x403a('0x0'));module[_0x403a('0x1')]={'name':{'type':Sequelize[_0x403a('0x2')]},'description':{'type':Sequelize[_0x403a('0x2')]}}; \ No newline at end of file +var _0x82cd=['sequelize','exports','STRING'];(function(_0x50fedc,_0x479e4f){var _0x1b0386=function(_0x270a7e){while(--_0x270a7e){_0x50fedc['push'](_0x50fedc['shift']());}};_0x1b0386(++_0x479e4f);}(_0x82cd,0x1a4));var _0xd82c=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x82cd[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0xd82c('0x0'));module[_0xd82c('0x1')]={'name':{'type':Sequelize[_0xd82c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 32773e8..61884fd 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 _0x1453=['../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','save','update','then','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','length','find','create','body','destroy','getFields','findOne','ZendeskField','getSubjects','nolimit','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1453,0x8e));var _0x3145=function(_0x4b8b21,_0x1a910b){_0x4b8b21=_0x4b8b21-0x0;var _0xeb8cc1=_0x1453[_0x4b8b21];return _0xeb8cc1;};'use strict';var emlformat=require(_0x3145('0x0'));var rimraf=require(_0x3145('0x1'));var zipdir=require(_0x3145('0x2'));var jsonpatch=require(_0x3145('0x3'));var rp=require('request-promise');var moment=require(_0x3145('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3145('0x5'));var util=require('util');var path=require(_0x3145('0x6'));var sox=require(_0x3145('0x7'));var csv=require(_0x3145('0x8'));var ejs=require(_0x3145('0x9'));var fs=require('fs');var fs_extra=require(_0x3145('0xa'));var _=require(_0x3145('0xb'));var squel=require(_0x3145('0xc'));var crypto=require(_0x3145('0xd'));var jsforce=require(_0x3145('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3145('0x8'));var querystring=require(_0x3145('0xf'));var Papa=require('papaparse');var Redis=require(_0x3145('0x10'));var authService=require(_0x3145('0x11'));var qs=require(_0x3145('0x12'));var as=require(_0x3145('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3145('0x14'))(_0x3145('0x15'));var utils=require('../../config/utils');var config=require(_0x3145('0x16'));var licenseUtil=require(_0x3145('0x17'));var db=require(_0x3145('0x18'))['db'];function respondWithStatusCode(_0x20b2aa,_0x2c4091){_0x2c4091=_0x2c4091||0xcc;return function(_0x2c69b7){if(_0x2c69b7){return _0x20b2aa[_0x3145('0x19')](_0x2c4091);}return _0x20b2aa['status'](_0x2c4091)[_0x3145('0x1a')]();};}function respondWithResult(_0xabefb9,_0x4f517e){_0x4f517e=_0x4f517e||0xc8;return function(_0x4053fb){if(_0x4053fb){return _0xabefb9['status'](_0x4f517e)[_0x3145('0x1b')](_0x4053fb);}};}function respondWithFilteredResult(_0xcdfc84,_0x193a68){return function(_0xb93135){if(_0xb93135){var _0x4492cf=typeof _0x193a68[_0x3145('0x1c')]===_0x3145('0x1d')&&typeof _0x193a68['limit']===_0x3145('0x1d');var _0x23adf4=_0xb93135[_0x3145('0x1e')];var _0x608e5a=_0x4492cf?0x0:_0x193a68['offset'];var _0x3e100b=_0x4492cf?_0xb93135[_0x3145('0x1e')]:_0x193a68[_0x3145('0x1c')]+_0x193a68[_0x3145('0x1f')];var _0x395158;if(_0x3e100b>=_0x23adf4){_0x3e100b=_0x23adf4;_0x395158=0xc8;}else{_0x395158=0xce;}_0xcdfc84[_0x3145('0x20')](_0x395158);return _0xcdfc84[_0x3145('0x21')](_0x3145('0x22'),_0x608e5a+'-'+_0x3e100b+'/'+_0x23adf4)[_0x3145('0x1b')](_0xb93135);}return null;};}function patchUpdates(_0x370ab8){return function(_0x2ce2bb){try{jsonpatch['apply'](_0x2ce2bb,_0x370ab8,!![]);}catch(_0x4d5ea1){return BPromise['reject'](_0x4d5ea1);}return _0x2ce2bb[_0x3145('0x23')]();};}function saveUpdates(_0x15e5f8,_0x1d29eb){return function(_0x3a1d92){if(_0x3a1d92){return _0x3a1d92[_0x3145('0x24')](_0x15e5f8)[_0x3145('0x25')](function(_0x4b011d){return _0x4b011d;});}return null;};}function removeEntity(_0x47c7b5,_0x1f8cc1){return function(_0x186256){if(_0x186256){return _0x186256['destroy']()['then'](function(){_0x47c7b5[_0x3145('0x20')](0xcc)[_0x3145('0x1a')]();});}};}function handleEntityNotFound(_0x42fece,_0x3b8d56){return function(_0x1f919d){if(!_0x1f919d){_0x42fece[_0x3145('0x19')](0x194);}return _0x1f919d;};}function handleError(_0x408a66,_0x171200){_0x171200=_0x171200||0x1f4;return function(_0x301197){logger[_0x3145('0x26')](_0x301197[_0x3145('0x27')]);if(_0x301197[_0x3145('0x28')]){delete _0x301197[_0x3145('0x28')];}_0x408a66['status'](_0x171200)[_0x3145('0x29')](_0x301197);};}exports[_0x3145('0x2a')]=function(_0x1c6c6d,_0x1de41c){var _0x171975={},_0x49f12b={},_0x3dc168={'count':0x0,'rows':[]};var _0x48eeca=_['map'](db[_0x3145('0x2b')][_0x3145('0x2c')],function(_0x3dbe74){return{'name':_0x3dbe74[_0x3145('0x2d')],'type':_0x3dbe74[_0x3145('0x2e')][_0x3145('0x2f')]};});_0x49f12b['model']=_[_0x3145('0x30')](_0x48eeca,_0x3145('0x28'));_0x49f12b['query']=_['keys'](_0x1c6c6d[_0x3145('0x31')]);_0x49f12b['filters']=_[_0x3145('0x32')](_0x49f12b[_0x3145('0x33')],_0x49f12b[_0x3145('0x31')]);_0x171975[_0x3145('0x34')]=_[_0x3145('0x32')](_0x49f12b[_0x3145('0x33')],qs[_0x3145('0x35')](_0x1c6c6d[_0x3145('0x31')]['fields']));_0x171975[_0x3145('0x34')]=_0x171975[_0x3145('0x34')]['length']?_0x171975[_0x3145('0x34')]:_0x49f12b[_0x3145('0x33')];if(!_0x1c6c6d[_0x3145('0x31')][_0x3145('0x36')]('nolimit')){_0x171975[_0x3145('0x1f')]=qs[_0x3145('0x1f')](_0x1c6c6d[_0x3145('0x31')][_0x3145('0x1f')]);_0x171975[_0x3145('0x1c')]=qs[_0x3145('0x1c')](_0x1c6c6d[_0x3145('0x31')][_0x3145('0x1c')]);}_0x171975[_0x3145('0x37')]=qs[_0x3145('0x38')](_0x1c6c6d[_0x3145('0x31')][_0x3145('0x38')]);_0x171975['where']=qs[_0x3145('0x39')](_[_0x3145('0x3a')](_0x1c6c6d[_0x3145('0x31')],_0x49f12b[_0x3145('0x39')]),_0x48eeca);if(_0x1c6c6d[_0x3145('0x31')]['filter']){_0x171975[_0x3145('0x3b')]=_[_0x3145('0x3c')](_0x171975[_0x3145('0x3b')],{'$or':_[_0x3145('0x30')](_0x48eeca,function(_0x438ba1){if(_0x438ba1[_0x3145('0x2e')]!==_0x3145('0x3d')){var _0x30737c={};_0x30737c[_0x438ba1[_0x3145('0x28')]]={'$like':'%'+_0x1c6c6d[_0x3145('0x31')][_0x3145('0x3e')]+'%'};return _0x30737c;}})});}_0x171975=_[_0x3145('0x3c')]({},_0x171975,_0x1c6c6d[_0x3145('0x3f')]);var _0x362a3e={'where':_0x171975[_0x3145('0x3b')]};return db['ZendeskConfiguration']['count'](_0x362a3e)[_0x3145('0x25')](function(_0x145023){_0x3dc168['count']=_0x145023;if(_0x1c6c6d[_0x3145('0x31')]['includeAll']){_0x171975['include']=[{'all':!![]}];}return db[_0x3145('0x2b')][_0x3145('0x40')](_0x171975);})[_0x3145('0x25')](function(_0xce0835){_0x3dc168[_0x3145('0x41')]=_0xce0835;return _0x3dc168;})[_0x3145('0x25')](respondWithFilteredResult(_0x1de41c,_0x171975))[_0x3145('0x42')](handleError(_0x1de41c,null));};exports['show']=function(_0x2c6746,_0x2fa9cb){var _0x3082f3={'raw':![],'where':{'id':_0x2c6746[_0x3145('0x43')]['id']}},_0xd4752a={};_0xd4752a[_0x3145('0x33')]=_[_0x3145('0x44')](db[_0x3145('0x2b')][_0x3145('0x2c')]);_0xd4752a[_0x3145('0x31')]=_[_0x3145('0x44')](_0x2c6746[_0x3145('0x31')]);_0xd4752a[_0x3145('0x39')]=_[_0x3145('0x32')](_0xd4752a['model'],_0xd4752a['query']);_0x3082f3['attributes']=_[_0x3145('0x32')](_0xd4752a['model'],qs['fields'](_0x2c6746[_0x3145('0x31')][_0x3145('0x35')]));_0x3082f3['attributes']=_0x3082f3['attributes'][_0x3145('0x45')]?_0x3082f3[_0x3145('0x34')]:_0xd4752a[_0x3145('0x33')];if(_0x2c6746[_0x3145('0x31')]['includeAll']){_0x3082f3['include']=[{'all':!![]}];}_0x3082f3=_[_0x3145('0x3c')]({},_0x3082f3,_0x2c6746[_0x3145('0x3f')]);return db[_0x3145('0x2b')][_0x3145('0x46')](_0x3082f3)[_0x3145('0x25')](handleEntityNotFound(_0x2fa9cb,null))[_0x3145('0x25')](respondWithResult(_0x2fa9cb,null))[_0x3145('0x42')](handleError(_0x2fa9cb,null));};exports[_0x3145('0x47')]=function(_0x10ef0b,_0x425813){return db['ZendeskConfiguration']['create'](_0x10ef0b[_0x3145('0x48')],{})['then'](respondWithResult(_0x425813,0xc9))[_0x3145('0x42')](handleError(_0x425813,null));};exports[_0x3145('0x24')]=function(_0x7a90eb,_0xb52aa4){if(_0x7a90eb[_0x3145('0x48')]['id']){delete _0x7a90eb[_0x3145('0x48')]['id'];}return db[_0x3145('0x2b')][_0x3145('0x46')]({'where':{'id':_0x7a90eb[_0x3145('0x43')]['id']}})[_0x3145('0x25')](handleEntityNotFound(_0xb52aa4,null))['then'](saveUpdates(_0x7a90eb['body'],null))[_0x3145('0x25')](respondWithResult(_0xb52aa4,null))[_0x3145('0x42')](handleError(_0xb52aa4,null));};exports[_0x3145('0x49')]=function(_0x357dbd,_0x559208){return db[_0x3145('0x2b')][_0x3145('0x46')]({'where':{'id':_0x357dbd[_0x3145('0x43')]['id']}})[_0x3145('0x25')](handleEntityNotFound(_0x559208,null))[_0x3145('0x25')](removeEntity(_0x559208,null))['catch'](handleError(_0x559208,null));};exports[_0x3145('0x4a')]=function(_0x40f677,_0xa0b095,_0x3727af){var _0x3083eb={};var _0x2308c0={};var _0x283fce;var _0x2d8ef0;return db[_0x3145('0x2b')][_0x3145('0x4b')]({'where':{'id':_0x40f677[_0x3145('0x43')]['id']}})[_0x3145('0x25')](handleEntityNotFound(_0xa0b095,null))[_0x3145('0x25')](function(_0x2bef59){if(_0x2bef59){_0x283fce=_0x2bef59;_0x2308c0['model']=_[_0x3145('0x44')](db[_0x3145('0x4c')][_0x3145('0x2c')]);_0x2308c0[_0x3145('0x31')]=_['keys'](_0x40f677[_0x3145('0x31')]);_0x2308c0[_0x3145('0x39')]=_['intersection'](_0x2308c0[_0x3145('0x33')],_0x2308c0['query']);_0x3083eb[_0x3145('0x34')]=_[_0x3145('0x32')](_0x2308c0[_0x3145('0x33')],qs['fields'](_0x40f677['query'][_0x3145('0x35')]));_0x3083eb[_0x3145('0x34')]=_0x3083eb[_0x3145('0x34')]['length']?_0x3083eb[_0x3145('0x34')]:_0x2308c0[_0x3145('0x33')];_0x3083eb['order']=qs[_0x3145('0x38')](_0x40f677['query'][_0x3145('0x38')]);_0x3083eb[_0x3145('0x3b')]=qs['filters'](_['pick'](_0x40f677[_0x3145('0x31')],_0x2308c0['filters']));if(_0x40f677[_0x3145('0x31')][_0x3145('0x3e')]){_0x3083eb['where']=_[_0x3145('0x3c')](_0x3083eb[_0x3145('0x3b')],{'$or':_[_0x3145('0x30')](_0x3083eb['attributes'],function(_0x1889e3){var _0xb063ca={};_0xb063ca[_0x1889e3]={'$like':'%'+_0x40f677[_0x3145('0x31')]['filter']+'%'};return _0xb063ca;})});}_0x3083eb=_[_0x3145('0x3c')]({},_0x3083eb,_0x40f677['options']);return _0x283fce['getFields'](_0x3083eb);}})[_0x3145('0x25')](function(_0xcb4719){if(_0xcb4719){_0x2d8ef0=_0xcb4719['length'];if(!_0x40f677[_0x3145('0x31')][_0x3145('0x36')]('nolimit')){_0x3083eb[_0x3145('0x1f')]=qs[_0x3145('0x1f')](_0x40f677[_0x3145('0x31')][_0x3145('0x1f')]);_0x3083eb[_0x3145('0x1c')]=qs[_0x3145('0x1c')](_0x40f677['query']['offset']);}return _0x283fce[_0x3145('0x4a')](_0x3083eb);}})[_0x3145('0x25')](function(_0x1dae4e){if(_0x1dae4e){return _0x1dae4e?{'count':_0x2d8ef0,'rows':_0x1dae4e}:null;}})[_0x3145('0x25')](respondWithResult(_0xa0b095,null))['catch'](handleError(_0xa0b095,null));};exports[_0x3145('0x4d')]=function(_0x360614,_0x18c4b4,_0x268342){var _0x4b3f21={};var _0x51315f={};var _0x1c5087;var _0x1c371b;return db['ZendeskConfiguration'][_0x3145('0x4b')]({'where':{'id':_0x360614[_0x3145('0x43')]['id']}})['then'](handleEntityNotFound(_0x18c4b4,null))[_0x3145('0x25')](function(_0x419305){if(_0x419305){_0x1c5087=_0x419305;_0x51315f[_0x3145('0x33')]=_[_0x3145('0x44')](db[_0x3145('0x4c')][_0x3145('0x2c')]);_0x51315f[_0x3145('0x31')]=_[_0x3145('0x44')](_0x360614[_0x3145('0x31')]);_0x51315f[_0x3145('0x39')]=_['intersection'](_0x51315f[_0x3145('0x33')],_0x51315f['query']);_0x4b3f21['attributes']=_[_0x3145('0x32')](_0x51315f['model'],qs[_0x3145('0x35')](_0x360614[_0x3145('0x31')][_0x3145('0x35')]));_0x4b3f21[_0x3145('0x34')]=_0x4b3f21['attributes'][_0x3145('0x45')]?_0x4b3f21['attributes']:_0x51315f[_0x3145('0x33')];_0x4b3f21[_0x3145('0x37')]=qs[_0x3145('0x38')](_0x360614['query'][_0x3145('0x38')]);_0x4b3f21[_0x3145('0x3b')]=qs[_0x3145('0x39')](_[_0x3145('0x3a')](_0x360614[_0x3145('0x31')],_0x51315f['filters']));if(_0x360614[_0x3145('0x31')][_0x3145('0x3e')]){_0x4b3f21['where']=_[_0x3145('0x3c')](_0x4b3f21[_0x3145('0x3b')],{'$or':_[_0x3145('0x30')](_0x4b3f21['attributes'],function(_0x4879f6){var _0xfae379={};_0xfae379[_0x4879f6]={'$like':'%'+_0x360614[_0x3145('0x31')][_0x3145('0x3e')]+'%'};return _0xfae379;})});}_0x4b3f21=_[_0x3145('0x3c')]({},_0x4b3f21,_0x360614[_0x3145('0x3f')]);return _0x1c5087[_0x3145('0x4d')](_0x4b3f21);}})['then'](function(_0x42e557){if(_0x42e557){_0x1c371b=_0x42e557[_0x3145('0x45')];if(!_0x360614['query'][_0x3145('0x36')](_0x3145('0x4e'))){_0x4b3f21[_0x3145('0x1f')]=qs[_0x3145('0x1f')](_0x360614['query'][_0x3145('0x1f')]);_0x4b3f21[_0x3145('0x1c')]=qs[_0x3145('0x1c')](_0x360614[_0x3145('0x31')]['offset']);}return _0x1c5087[_0x3145('0x4d')](_0x4b3f21);}})[_0x3145('0x25')](function(_0x25522c){if(_0x25522c){return _0x25522c?{'count':_0x1c371b,'rows':_0x25522c}:null;}})[_0x3145('0x25')](respondWithResult(_0x18c4b4,null))[_0x3145('0x42')](handleError(_0x18c4b4,null));};exports['getDescriptions']=function(_0x98ab5a,_0x5befe9,_0x3d90dc){var _0x266217={};var _0x4abc08={};var _0x366409;var _0x1c6ee7;return db[_0x3145('0x2b')][_0x3145('0x4b')]({'where':{'id':_0x98ab5a[_0x3145('0x43')]['id']}})[_0x3145('0x25')](handleEntityNotFound(_0x5befe9,null))[_0x3145('0x25')](function(_0x1b149a){if(_0x1b149a){_0x366409=_0x1b149a;_0x4abc08[_0x3145('0x33')]=_[_0x3145('0x44')](db[_0x3145('0x4c')][_0x3145('0x2c')]);_0x4abc08[_0x3145('0x31')]=_[_0x3145('0x44')](_0x98ab5a[_0x3145('0x31')]);_0x4abc08[_0x3145('0x39')]=_['intersection'](_0x4abc08[_0x3145('0x33')],_0x4abc08[_0x3145('0x31')]);_0x266217[_0x3145('0x34')]=_[_0x3145('0x32')](_0x4abc08[_0x3145('0x33')],qs[_0x3145('0x35')](_0x98ab5a[_0x3145('0x31')]['fields']));_0x266217[_0x3145('0x34')]=_0x266217[_0x3145('0x34')][_0x3145('0x45')]?_0x266217['attributes']:_0x4abc08['model'];_0x266217[_0x3145('0x37')]=qs[_0x3145('0x38')](_0x98ab5a[_0x3145('0x31')][_0x3145('0x38')]);_0x266217[_0x3145('0x3b')]=qs[_0x3145('0x39')](_[_0x3145('0x3a')](_0x98ab5a['query'],_0x4abc08['filters']));if(_0x98ab5a[_0x3145('0x31')]['filter']){_0x266217[_0x3145('0x3b')]=_[_0x3145('0x3c')](_0x266217[_0x3145('0x3b')],{'$or':_[_0x3145('0x30')](_0x266217['attributes'],function(_0xe91aec){var _0x1b5979={};_0x1b5979[_0xe91aec]={'$like':'%'+_0x98ab5a[_0x3145('0x31')][_0x3145('0x3e')]+'%'};return _0x1b5979;})});}_0x266217=_[_0x3145('0x3c')]({},_0x266217,_0x98ab5a[_0x3145('0x3f')]);return _0x366409['getDescriptions'](_0x266217);}})['then'](function(_0x59455d){if(_0x59455d){_0x1c6ee7=_0x59455d['length'];if(!_0x98ab5a['query'][_0x3145('0x36')](_0x3145('0x4e'))){_0x266217[_0x3145('0x1f')]=qs[_0x3145('0x1f')](_0x98ab5a[_0x3145('0x31')][_0x3145('0x1f')]);_0x266217['offset']=qs['offset'](_0x98ab5a[_0x3145('0x31')][_0x3145('0x1c')]);}return _0x366409['getDescriptions'](_0x266217);}})[_0x3145('0x25')](function(_0x2a3310){if(_0x2a3310){return _0x2a3310?{'count':_0x1c6ee7,'rows':_0x2a3310}:null;}})[_0x3145('0x25')](respondWithResult(_0x5befe9,null))[_0x3145('0x42')](handleError(_0x5befe9,null));};exports[_0x3145('0x4f')]=function(_0x498448,_0xb9a461,_0x2ebc4b){var _0x4c71a3={};var _0x5c55d5={};var _0x5124bc;var _0xfee21a;return db[_0x3145('0x2b')][_0x3145('0x4b')]({'where':{'id':_0x498448[_0x3145('0x43')]['id']}})[_0x3145('0x25')](handleEntityNotFound(_0xb9a461,null))[_0x3145('0x25')](function(_0x7fdbce){if(_0x7fdbce){_0x5124bc=_0x7fdbce;_0x5c55d5['model']=_[_0x3145('0x44')](db[_0x3145('0x50')]['rawAttributes']);_0x5c55d5[_0x3145('0x31')]=_[_0x3145('0x44')](_0x498448['query']);_0x5c55d5['filters']=_[_0x3145('0x32')](_0x5c55d5[_0x3145('0x33')],_0x5c55d5['query']);_0x4c71a3['attributes']=_[_0x3145('0x32')](_0x5c55d5[_0x3145('0x33')],qs['fields'](_0x498448['query'][_0x3145('0x35')]));_0x4c71a3[_0x3145('0x34')]=_0x4c71a3['attributes']['length']?_0x4c71a3['attributes']:_0x5c55d5['model'];_0x4c71a3['order']=qs['sort'](_0x498448[_0x3145('0x31')][_0x3145('0x38')]);_0x4c71a3[_0x3145('0x3b')]=qs['filters'](_[_0x3145('0x3a')](_0x498448[_0x3145('0x31')],_0x5c55d5[_0x3145('0x39')]));if(_0x498448[_0x3145('0x31')][_0x3145('0x3e')]){_0x4c71a3[_0x3145('0x3b')]=_[_0x3145('0x3c')](_0x4c71a3[_0x3145('0x3b')],{'$or':_[_0x3145('0x30')](_0x4c71a3['attributes'],function(_0x37e247){var _0x5dd192={};_0x5dd192[_0x37e247]={'$like':'%'+_0x498448[_0x3145('0x31')][_0x3145('0x3e')]+'%'};return _0x5dd192;})});}_0x4c71a3=_[_0x3145('0x3c')]({},_0x4c71a3,_0x498448[_0x3145('0x3f')]);return _0x5124bc[_0x3145('0x4f')](_0x4c71a3);}})[_0x3145('0x25')](function(_0x2e67d5){if(_0x2e67d5){_0xfee21a=_0x2e67d5['length'];if(!_0x498448[_0x3145('0x31')][_0x3145('0x36')](_0x3145('0x4e'))){_0x4c71a3['limit']=qs[_0x3145('0x1f')](_0x498448[_0x3145('0x31')][_0x3145('0x1f')]);_0x4c71a3[_0x3145('0x1c')]=qs[_0x3145('0x1c')](_0x498448[_0x3145('0x31')][_0x3145('0x1c')]);}return _0x5124bc[_0x3145('0x4f')](_0x4c71a3);}})[_0x3145('0x25')](function(_0x2eceb8){if(_0x2eceb8){return _0x2eceb8?{'count':_0xfee21a,'rows':_0x2eceb8}:null;}})['then'](respondWithResult(_0xb9a461,null))['catch'](handleError(_0xb9a461,null));};exports[_0x3145('0x51')]=function(_0x480e62,_0x3489a0,_0x1cce4c){if(_0x480e62[_0x3145('0x48')]['id']){delete _0x480e62[_0x3145('0x48')]['id'];}return db[_0x3145('0x2b')][_0x3145('0x4b')]({'where':{'id':_0x480e62[_0x3145('0x43')]['id']}})['then'](handleEntityNotFound(_0x3489a0,null))['then'](function(_0x53f945){if(_0x53f945){return _0x53f945[_0x3145('0x51')](_0x480e62[_0x3145('0x48')][_0x3145('0x52')]||[]);}return null;})[_0x3145('0x25')](respondWithResult(_0x3489a0,null))[_0x3145('0x42')](handleError(_0x3489a0,null));}; \ No newline at end of file +var _0x3bb6=['length','nolimit','order','sort','filter','merge','where','map','then','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','getFields','findOne','ZendeskField','pick','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','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','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields'];(function(_0x1a5109,_0x3b8698){var _0x4d57fa=function(_0x3b8f34){while(--_0x3b8f34){_0x1a5109['push'](_0x1a5109['shift']());}};_0x4d57fa(++_0x3b8698);}(_0x3bb6,0x16e));var _0x63bb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3bb6[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63bb('0x0'));var zipdir=require(_0x63bb('0x1'));var jsonpatch=require(_0x63bb('0x2'));var rp=require('request-promise');var moment=require(_0x63bb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x63bb('0x4'));var util=require(_0x63bb('0x5'));var path=require(_0x63bb('0x6'));var sox=require('sox');var csv=require(_0x63bb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63bb('0x8'));var _=require(_0x63bb('0x9'));var squel=require(_0x63bb('0xa'));var crypto=require(_0x63bb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x63bb('0xc'));var toCsv=require(_0x63bb('0x7'));var querystring=require(_0x63bb('0xd'));var Papa=require(_0x63bb('0xe'));var Redis=require('ioredis');var authService=require(_0x63bb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x63bb('0x10'));var hardwareService=require(_0x63bb('0x11'));var logger=require(_0x63bb('0x12'))(_0x63bb('0x13'));var utils=require(_0x63bb('0x14'));var config=require(_0x63bb('0x15'));var licenseUtil=require(_0x63bb('0x16'));var db=require(_0x63bb('0x17'))['db'];function respondWithStatusCode(_0x3799ce,_0x43d9b3){_0x43d9b3=_0x43d9b3||0xcc;return function(_0x145177){if(_0x145177){return _0x3799ce[_0x63bb('0x18')](_0x43d9b3);}return _0x3799ce[_0x63bb('0x19')](_0x43d9b3)[_0x63bb('0x1a')]();};}function respondWithResult(_0x4103d8,_0x1562dd){_0x1562dd=_0x1562dd||0xc8;return function(_0xc33ac){if(_0xc33ac){return _0x4103d8[_0x63bb('0x19')](_0x1562dd)['json'](_0xc33ac);}};}function respondWithFilteredResult(_0x1d8fba,_0x451f0f){return function(_0x46a324){if(_0x46a324){var _0x2bb085=typeof _0x451f0f[_0x63bb('0x1b')]==='undefined'&&typeof _0x451f0f[_0x63bb('0x1c')]==='undefined';var _0x1f3cce=_0x46a324[_0x63bb('0x1d')];var _0xd3b85e=_0x2bb085?0x0:_0x451f0f[_0x63bb('0x1b')];var _0x12b732=_0x2bb085?_0x46a324['count']:_0x451f0f['offset']+_0x451f0f[_0x63bb('0x1c')];var _0xa7b2ee;if(_0x12b732>=_0x1f3cce){_0x12b732=_0x1f3cce;_0xa7b2ee=0xc8;}else{_0xa7b2ee=0xce;}_0x1d8fba[_0x63bb('0x19')](_0xa7b2ee);return _0x1d8fba[_0x63bb('0x1e')](_0x63bb('0x1f'),_0xd3b85e+'-'+_0x12b732+'/'+_0x1f3cce)[_0x63bb('0x20')](_0x46a324);}return null;};}function patchUpdates(_0x4f6989){return function(_0x6f555a){try{jsonpatch[_0x63bb('0x21')](_0x6f555a,_0x4f6989,!![]);}catch(_0xd4d12b){return BPromise[_0x63bb('0x22')](_0xd4d12b);}return _0x6f555a[_0x63bb('0x23')]();};}function saveUpdates(_0x4ff883,_0x5e126c){return function(_0x560a81){if(_0x560a81){return _0x560a81[_0x63bb('0x24')](_0x4ff883)['then'](function(_0x57bba2){return _0x57bba2;});}return null;};}function removeEntity(_0x4d276c,_0x66c3ea){return function(_0x254754){if(_0x254754){return _0x254754[_0x63bb('0x25')]()['then'](function(){_0x4d276c[_0x63bb('0x19')](0xcc)[_0x63bb('0x1a')]();});}};}function handleEntityNotFound(_0x365071,_0x3ac89a){return function(_0x639711){if(!_0x639711){_0x365071['sendStatus'](0x194);}return _0x639711;};}function handleError(_0x1115b8,_0x5c9a66){_0x5c9a66=_0x5c9a66||0x1f4;return function(_0x28cc63){logger[_0x63bb('0x26')](_0x28cc63[_0x63bb('0x27')]);if(_0x28cc63[_0x63bb('0x28')]){delete _0x28cc63[_0x63bb('0x28')];}_0x1115b8[_0x63bb('0x19')](_0x5c9a66)[_0x63bb('0x29')](_0x28cc63);};}exports[_0x63bb('0x2a')]=function(_0x4d207f,_0x1d93e7){var _0x77d4a4={},_0xe7f3e7={},_0x30e1a7={'count':0x0,'rows':[]};var _0x5a33e5=_['map'](db[_0x63bb('0x2b')][_0x63bb('0x2c')],function(_0x67a2ec){return{'name':_0x67a2ec[_0x63bb('0x2d')],'type':_0x67a2ec[_0x63bb('0x2e')]['key']};});_0xe7f3e7['model']=_['map'](_0x5a33e5,_0x63bb('0x28'));_0xe7f3e7[_0x63bb('0x2f')]=_[_0x63bb('0x30')](_0x4d207f[_0x63bb('0x2f')]);_0xe7f3e7[_0x63bb('0x31')]=_[_0x63bb('0x32')](_0xe7f3e7[_0x63bb('0x33')],_0xe7f3e7[_0x63bb('0x2f')]);_0x77d4a4[_0x63bb('0x34')]=_[_0x63bb('0x32')](_0xe7f3e7['model'],qs[_0x63bb('0x35')](_0x4d207f[_0x63bb('0x2f')][_0x63bb('0x35')]));_0x77d4a4[_0x63bb('0x34')]=_0x77d4a4[_0x63bb('0x34')][_0x63bb('0x36')]?_0x77d4a4[_0x63bb('0x34')]:_0xe7f3e7[_0x63bb('0x33')];if(!_0x4d207f[_0x63bb('0x2f')]['hasOwnProperty'](_0x63bb('0x37'))){_0x77d4a4['limit']=qs[_0x63bb('0x1c')](_0x4d207f[_0x63bb('0x2f')][_0x63bb('0x1c')]);_0x77d4a4[_0x63bb('0x1b')]=qs[_0x63bb('0x1b')](_0x4d207f[_0x63bb('0x2f')]['offset']);}_0x77d4a4[_0x63bb('0x38')]=qs[_0x63bb('0x39')](_0x4d207f[_0x63bb('0x2f')][_0x63bb('0x39')]);_0x77d4a4['where']=qs[_0x63bb('0x31')](_['pick'](_0x4d207f[_0x63bb('0x2f')],_0xe7f3e7['filters']),_0x5a33e5);if(_0x4d207f[_0x63bb('0x2f')][_0x63bb('0x3a')]){_0x77d4a4['where']=_[_0x63bb('0x3b')](_0x77d4a4[_0x63bb('0x3c')],{'$or':_[_0x63bb('0x3d')](_0x5a33e5,function(_0x4dc965){if(_0x4dc965[_0x63bb('0x2e')]!=='VIRTUAL'){var _0x3303e1={};_0x3303e1[_0x4dc965[_0x63bb('0x28')]]={'$like':'%'+_0x4d207f[_0x63bb('0x2f')]['filter']+'%'};return _0x3303e1;}})});}_0x77d4a4=_['merge']({},_0x77d4a4,_0x4d207f['options']);var _0x296b0a={'where':_0x77d4a4[_0x63bb('0x3c')]};return db['ZendeskConfiguration'][_0x63bb('0x1d')](_0x296b0a)[_0x63bb('0x3e')](function(_0x4f39fe){_0x30e1a7[_0x63bb('0x1d')]=_0x4f39fe;if(_0x4d207f[_0x63bb('0x2f')][_0x63bb('0x3f')]){_0x77d4a4['include']=[{'all':!![]}];}return db[_0x63bb('0x2b')][_0x63bb('0x40')](_0x77d4a4);})[_0x63bb('0x3e')](function(_0x3257f6){_0x30e1a7[_0x63bb('0x41')]=_0x3257f6;return _0x30e1a7;})[_0x63bb('0x3e')](respondWithFilteredResult(_0x1d93e7,_0x77d4a4))[_0x63bb('0x42')](handleError(_0x1d93e7,null));};exports[_0x63bb('0x43')]=function(_0xd95bc,_0xeea950){var _0x3fce31={'raw':![],'where':{'id':_0xd95bc['params']['id']}},_0xdf0e93={};_0xdf0e93['model']=_[_0x63bb('0x30')](db[_0x63bb('0x2b')]['rawAttributes']);_0xdf0e93[_0x63bb('0x2f')]=_[_0x63bb('0x30')](_0xd95bc[_0x63bb('0x2f')]);_0xdf0e93[_0x63bb('0x31')]=_[_0x63bb('0x32')](_0xdf0e93[_0x63bb('0x33')],_0xdf0e93[_0x63bb('0x2f')]);_0x3fce31[_0x63bb('0x34')]=_[_0x63bb('0x32')](_0xdf0e93[_0x63bb('0x33')],qs['fields'](_0xd95bc[_0x63bb('0x2f')][_0x63bb('0x35')]));_0x3fce31[_0x63bb('0x34')]=_0x3fce31[_0x63bb('0x34')][_0x63bb('0x36')]?_0x3fce31[_0x63bb('0x34')]:_0xdf0e93[_0x63bb('0x33')];if(_0xd95bc[_0x63bb('0x2f')]['includeAll']){_0x3fce31[_0x63bb('0x44')]=[{'all':!![]}];}_0x3fce31=_[_0x63bb('0x3b')]({},_0x3fce31,_0xd95bc[_0x63bb('0x45')]);return db[_0x63bb('0x2b')][_0x63bb('0x46')](_0x3fce31)[_0x63bb('0x3e')](handleEntityNotFound(_0xeea950,null))[_0x63bb('0x3e')](respondWithResult(_0xeea950,null))['catch'](handleError(_0xeea950,null));};exports[_0x63bb('0x47')]=function(_0x1cd883,_0xea903b){return db[_0x63bb('0x2b')][_0x63bb('0x47')](_0x1cd883['body'],{})[_0x63bb('0x3e')](respondWithResult(_0xea903b,0xc9))['catch'](handleError(_0xea903b,null));};exports[_0x63bb('0x24')]=function(_0x3e768e,_0x50117c){if(_0x3e768e[_0x63bb('0x48')]['id']){delete _0x3e768e[_0x63bb('0x48')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x3e768e['params']['id']}})['then'](handleEntityNotFound(_0x50117c,null))[_0x63bb('0x3e')](saveUpdates(_0x3e768e[_0x63bb('0x48')],null))[_0x63bb('0x3e')](respondWithResult(_0x50117c,null))[_0x63bb('0x42')](handleError(_0x50117c,null));};exports[_0x63bb('0x25')]=function(_0x5f4eb7,_0x237341){return db[_0x63bb('0x2b')][_0x63bb('0x46')]({'where':{'id':_0x5f4eb7[_0x63bb('0x49')]['id']}})['then'](handleEntityNotFound(_0x237341,null))[_0x63bb('0x3e')](removeEntity(_0x237341,null))['catch'](handleError(_0x237341,null));};exports[_0x63bb('0x4a')]=function(_0x367872,_0x2e9c15,_0x53b4de){var _0x532d14={};var _0x4d7aab={};var _0x2dfbcf;var _0x411c32;return db[_0x63bb('0x2b')][_0x63bb('0x4b')]({'where':{'id':_0x367872[_0x63bb('0x49')]['id']}})[_0x63bb('0x3e')](handleEntityNotFound(_0x2e9c15,null))[_0x63bb('0x3e')](function(_0x57a7be){if(_0x57a7be){_0x2dfbcf=_0x57a7be;_0x4d7aab['model']=_[_0x63bb('0x30')](db[_0x63bb('0x4c')][_0x63bb('0x2c')]);_0x4d7aab['query']=_[_0x63bb('0x30')](_0x367872[_0x63bb('0x2f')]);_0x4d7aab['filters']=_[_0x63bb('0x32')](_0x4d7aab[_0x63bb('0x33')],_0x4d7aab[_0x63bb('0x2f')]);_0x532d14[_0x63bb('0x34')]=_['intersection'](_0x4d7aab[_0x63bb('0x33')],qs[_0x63bb('0x35')](_0x367872[_0x63bb('0x2f')][_0x63bb('0x35')]));_0x532d14['attributes']=_0x532d14[_0x63bb('0x34')][_0x63bb('0x36')]?_0x532d14[_0x63bb('0x34')]:_0x4d7aab[_0x63bb('0x33')];_0x532d14[_0x63bb('0x38')]=qs[_0x63bb('0x39')](_0x367872['query'][_0x63bb('0x39')]);_0x532d14['where']=qs[_0x63bb('0x31')](_[_0x63bb('0x4d')](_0x367872[_0x63bb('0x2f')],_0x4d7aab['filters']));if(_0x367872['query'][_0x63bb('0x3a')]){_0x532d14[_0x63bb('0x3c')]=_['merge'](_0x532d14[_0x63bb('0x3c')],{'$or':_['map'](_0x532d14['attributes'],function(_0x518bc9){var _0x3da4c4={};_0x3da4c4[_0x518bc9]={'$like':'%'+_0x367872[_0x63bb('0x2f')][_0x63bb('0x3a')]+'%'};return _0x3da4c4;})});}_0x532d14=_[_0x63bb('0x3b')]({},_0x532d14,_0x367872['options']);return _0x2dfbcf['getFields'](_0x532d14);}})['then'](function(_0x191443){if(_0x191443){_0x411c32=_0x191443[_0x63bb('0x36')];if(!_0x367872[_0x63bb('0x2f')][_0x63bb('0x4e')](_0x63bb('0x37'))){_0x532d14[_0x63bb('0x1c')]=qs[_0x63bb('0x1c')](_0x367872[_0x63bb('0x2f')][_0x63bb('0x1c')]);_0x532d14[_0x63bb('0x1b')]=qs[_0x63bb('0x1b')](_0x367872[_0x63bb('0x2f')][_0x63bb('0x1b')]);}return _0x2dfbcf['getFields'](_0x532d14);}})[_0x63bb('0x3e')](function(_0x3ebb8f){if(_0x3ebb8f){return _0x3ebb8f?{'count':_0x411c32,'rows':_0x3ebb8f}:null;}})[_0x63bb('0x3e')](respondWithResult(_0x2e9c15,null))['catch'](handleError(_0x2e9c15,null));};exports['getSubjects']=function(_0x263953,_0x449e80,_0x1d57a0){var _0x303123={};var _0x4fa58d={};var _0x2ec4e0;var _0x436e94;return db[_0x63bb('0x2b')][_0x63bb('0x4b')]({'where':{'id':_0x263953[_0x63bb('0x49')]['id']}})[_0x63bb('0x3e')](handleEntityNotFound(_0x449e80,null))[_0x63bb('0x3e')](function(_0x112018){if(_0x112018){_0x2ec4e0=_0x112018;_0x4fa58d['model']=_['keys'](db[_0x63bb('0x4c')][_0x63bb('0x2c')]);_0x4fa58d[_0x63bb('0x2f')]=_[_0x63bb('0x30')](_0x263953['query']);_0x4fa58d[_0x63bb('0x31')]=_[_0x63bb('0x32')](_0x4fa58d[_0x63bb('0x33')],_0x4fa58d[_0x63bb('0x2f')]);_0x303123[_0x63bb('0x34')]=_[_0x63bb('0x32')](_0x4fa58d[_0x63bb('0x33')],qs[_0x63bb('0x35')](_0x263953[_0x63bb('0x2f')][_0x63bb('0x35')]));_0x303123[_0x63bb('0x34')]=_0x303123[_0x63bb('0x34')][_0x63bb('0x36')]?_0x303123[_0x63bb('0x34')]:_0x4fa58d[_0x63bb('0x33')];_0x303123[_0x63bb('0x38')]=qs[_0x63bb('0x39')](_0x263953[_0x63bb('0x2f')]['sort']);_0x303123[_0x63bb('0x3c')]=qs[_0x63bb('0x31')](_[_0x63bb('0x4d')](_0x263953['query'],_0x4fa58d[_0x63bb('0x31')]));if(_0x263953['query']['filter']){_0x303123[_0x63bb('0x3c')]=_[_0x63bb('0x3b')](_0x303123[_0x63bb('0x3c')],{'$or':_[_0x63bb('0x3d')](_0x303123[_0x63bb('0x34')],function(_0x56092f){var _0x3b4b38={};_0x3b4b38[_0x56092f]={'$like':'%'+_0x263953[_0x63bb('0x2f')][_0x63bb('0x3a')]+'%'};return _0x3b4b38;})});}_0x303123=_[_0x63bb('0x3b')]({},_0x303123,_0x263953[_0x63bb('0x45')]);return _0x2ec4e0['getSubjects'](_0x303123);}})[_0x63bb('0x3e')](function(_0x4ef351){if(_0x4ef351){_0x436e94=_0x4ef351[_0x63bb('0x36')];if(!_0x263953[_0x63bb('0x2f')][_0x63bb('0x4e')](_0x63bb('0x37'))){_0x303123[_0x63bb('0x1c')]=qs[_0x63bb('0x1c')](_0x263953[_0x63bb('0x2f')][_0x63bb('0x1c')]);_0x303123[_0x63bb('0x1b')]=qs[_0x63bb('0x1b')](_0x263953[_0x63bb('0x2f')]['offset']);}return _0x2ec4e0[_0x63bb('0x4f')](_0x303123);}})[_0x63bb('0x3e')](function(_0x1daa25){if(_0x1daa25){return _0x1daa25?{'count':_0x436e94,'rows':_0x1daa25}:null;}})[_0x63bb('0x3e')](respondWithResult(_0x449e80,null))[_0x63bb('0x42')](handleError(_0x449e80,null));};exports[_0x63bb('0x50')]=function(_0x21804b,_0x520261,_0x470d7d){var _0x39522e={};var _0x1619af={};var _0x4fdbde;var _0x15745c;return db[_0x63bb('0x2b')][_0x63bb('0x4b')]({'where':{'id':_0x21804b['params']['id']}})[_0x63bb('0x3e')](handleEntityNotFound(_0x520261,null))['then'](function(_0x3a6bd4){if(_0x3a6bd4){_0x4fdbde=_0x3a6bd4;_0x1619af[_0x63bb('0x33')]=_[_0x63bb('0x30')](db['ZendeskField'][_0x63bb('0x2c')]);_0x1619af[_0x63bb('0x2f')]=_[_0x63bb('0x30')](_0x21804b['query']);_0x1619af[_0x63bb('0x31')]=_[_0x63bb('0x32')](_0x1619af[_0x63bb('0x33')],_0x1619af[_0x63bb('0x2f')]);_0x39522e[_0x63bb('0x34')]=_['intersection'](_0x1619af[_0x63bb('0x33')],qs['fields'](_0x21804b[_0x63bb('0x2f')]['fields']));_0x39522e[_0x63bb('0x34')]=_0x39522e[_0x63bb('0x34')]['length']?_0x39522e[_0x63bb('0x34')]:_0x1619af[_0x63bb('0x33')];_0x39522e['order']=qs['sort'](_0x21804b[_0x63bb('0x2f')]['sort']);_0x39522e[_0x63bb('0x3c')]=qs[_0x63bb('0x31')](_['pick'](_0x21804b[_0x63bb('0x2f')],_0x1619af['filters']));if(_0x21804b['query']['filter']){_0x39522e['where']=_['merge'](_0x39522e['where'],{'$or':_[_0x63bb('0x3d')](_0x39522e[_0x63bb('0x34')],function(_0x3d7052){var _0x411db7={};_0x411db7[_0x3d7052]={'$like':'%'+_0x21804b[_0x63bb('0x2f')][_0x63bb('0x3a')]+'%'};return _0x411db7;})});}_0x39522e=_[_0x63bb('0x3b')]({},_0x39522e,_0x21804b[_0x63bb('0x45')]);return _0x4fdbde['getDescriptions'](_0x39522e);}})[_0x63bb('0x3e')](function(_0x29cafb){if(_0x29cafb){_0x15745c=_0x29cafb['length'];if(!_0x21804b[_0x63bb('0x2f')][_0x63bb('0x4e')](_0x63bb('0x37'))){_0x39522e[_0x63bb('0x1c')]=qs['limit'](_0x21804b[_0x63bb('0x2f')][_0x63bb('0x1c')]);_0x39522e[_0x63bb('0x1b')]=qs[_0x63bb('0x1b')](_0x21804b[_0x63bb('0x2f')][_0x63bb('0x1b')]);}return _0x4fdbde[_0x63bb('0x50')](_0x39522e);}})[_0x63bb('0x3e')](function(_0x8e4d72){if(_0x8e4d72){return _0x8e4d72?{'count':_0x15745c,'rows':_0x8e4d72}:null;}})[_0x63bb('0x3e')](respondWithResult(_0x520261,null))[_0x63bb('0x42')](handleError(_0x520261,null));};exports[_0x63bb('0x51')]=function(_0x4f55a4,_0x4c0223,_0x116b9c){var _0x240678={};var _0x1d7e67={};var _0x2b8fe5;var _0x26d262;return db[_0x63bb('0x2b')][_0x63bb('0x4b')]({'where':{'id':_0x4f55a4[_0x63bb('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c0223,null))[_0x63bb('0x3e')](function(_0x228f2a){if(_0x228f2a){_0x2b8fe5=_0x228f2a;_0x1d7e67[_0x63bb('0x33')]=_[_0x63bb('0x30')](db['Tag']['rawAttributes']);_0x1d7e67[_0x63bb('0x2f')]=_[_0x63bb('0x30')](_0x4f55a4[_0x63bb('0x2f')]);_0x1d7e67[_0x63bb('0x31')]=_[_0x63bb('0x32')](_0x1d7e67[_0x63bb('0x33')],_0x1d7e67[_0x63bb('0x2f')]);_0x240678[_0x63bb('0x34')]=_['intersection'](_0x1d7e67['model'],qs[_0x63bb('0x35')](_0x4f55a4[_0x63bb('0x2f')]['fields']));_0x240678[_0x63bb('0x34')]=_0x240678[_0x63bb('0x34')][_0x63bb('0x36')]?_0x240678[_0x63bb('0x34')]:_0x1d7e67['model'];_0x240678[_0x63bb('0x38')]=qs['sort'](_0x4f55a4[_0x63bb('0x2f')]['sort']);_0x240678[_0x63bb('0x3c')]=qs['filters'](_[_0x63bb('0x4d')](_0x4f55a4['query'],_0x1d7e67[_0x63bb('0x31')]));if(_0x4f55a4['query'][_0x63bb('0x3a')]){_0x240678[_0x63bb('0x3c')]=_[_0x63bb('0x3b')](_0x240678[_0x63bb('0x3c')],{'$or':_['map'](_0x240678[_0x63bb('0x34')],function(_0x329a64){var _0x43d5e7={};_0x43d5e7[_0x329a64]={'$like':'%'+_0x4f55a4[_0x63bb('0x2f')][_0x63bb('0x3a')]+'%'};return _0x43d5e7;})});}_0x240678=_[_0x63bb('0x3b')]({},_0x240678,_0x4f55a4[_0x63bb('0x45')]);return _0x2b8fe5[_0x63bb('0x51')](_0x240678);}})['then'](function(_0x1a8067){if(_0x1a8067){_0x26d262=_0x1a8067['length'];if(!_0x4f55a4['query'][_0x63bb('0x4e')](_0x63bb('0x37'))){_0x240678['limit']=qs[_0x63bb('0x1c')](_0x4f55a4[_0x63bb('0x2f')]['limit']);_0x240678[_0x63bb('0x1b')]=qs[_0x63bb('0x1b')](_0x4f55a4[_0x63bb('0x2f')][_0x63bb('0x1b')]);}return _0x2b8fe5[_0x63bb('0x51')](_0x240678);}})[_0x63bb('0x3e')](function(_0x249edd){if(_0x249edd){return _0x249edd?{'count':_0x26d262,'rows':_0x249edd}:null;}})[_0x63bb('0x3e')](respondWithResult(_0x4c0223,null))[_0x63bb('0x42')](handleError(_0x4c0223,null));};exports[_0x63bb('0x52')]=function(_0x3361fd,_0x348566,_0x1b3425){if(_0x3361fd[_0x63bb('0x48')]['id']){delete _0x3361fd['body']['id'];}return db[_0x63bb('0x2b')][_0x63bb('0x4b')]({'where':{'id':_0x3361fd['params']['id']}})['then'](handleEntityNotFound(_0x348566,null))['then'](function(_0x5f0ae3){if(_0x5f0ae3){return _0x5f0ae3['setTags'](_0x3361fd[_0x63bb('0x48')][_0x63bb('0x53')]||[]);}return null;})[_0x63bb('0x3e')](respondWithResult(_0x348566,null))['catch'](handleError(_0x348566,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 408555a..350c4a2 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 _0xab40=['rimraf','../../config/environment','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','bluebird','request-promise','path'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0xab40,0xcd));var _0x0ab4=function(_0x1ac361,_0x25b199){_0x1ac361=_0x1ac361-0x0;var _0x4a1ca3=_0xab40[_0x1ac361];return _0x4a1ca3;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0ab4('0x2'));var rp=require(_0x0ab4('0x3'));var fs=require('fs');var path=require(_0x0ab4('0x4'));var rimraf=require(_0x0ab4('0x5'));var config=require(_0x0ab4('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x28b17a,_0x4ba9d2){return _0x28b17a[_0x0ab4('0x7')](_0x0ab4('0x8'),attributes,{'tableName':_0x0ab4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3266=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash','util'];(function(_0x10e8ea,_0x8c8d4f){var _0x29d7d8=function(_0x3e124a){while(--_0x3e124a){_0x10e8ea['push'](_0x10e8ea['shift']());}};_0x29d7d8(++_0x8c8d4f);}(_0x3266,0x6a));var _0x6326=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x3266[_0x59d0cc];return _0x2ae79f;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0x6326('0xb'),'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 40bfe43..043b97e 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 _0x1788=['code','ZendeskConfiguration,\x20%s,\x20%s','message','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','error'];(function(_0x25813b,_0x5716c0){var _0x887fa=function(_0x344370){while(--_0x344370){_0x25813b['push'](_0x25813b['shift']());}};_0x887fa(++_0x5716c0);}(_0x1788,0x1c4));var _0x8178=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x1788[_0x45d55e];return _0x29812a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8178('0x0'));var rs=require(_0x8178('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8178('0x2'))['db'];var utils=require(_0x8178('0x3'));var logger=require(_0x8178('0x4'))('rpc');var config=require(_0x8178('0x5'));var jayson=require(_0x8178('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41c717,_0x3aa0e4,_0x364278){return new BPromise(function(_0x4368b2,_0x3796c0){return client[_0x8178('0x7')](_0x41c717,_0x364278)[_0x8178('0x8')](function(_0x267d98){logger[_0x8178('0x9')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3aa0e4,_0x8178('0xa'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3aa0e4,'request\x20sent',JSON['stringify'](_0x267d98));if(_0x267d98['error']){if(_0x267d98[_0x8178('0xb')][_0x8178('0xc')]===0x1f4){logger[_0x8178('0xb')](_0x8178('0xd'),_0x3aa0e4,_0x267d98[_0x8178('0xb')]['message']);return _0x3796c0(_0x267d98['error'][_0x8178('0xe')]);}logger[_0x8178('0xb')](_0x8178('0xd'),_0x3aa0e4,_0x267d98[_0x8178('0xb')][_0x8178('0xe')]);return _0x4368b2(_0x267d98[_0x8178('0xb')][_0x8178('0xe')]);}else{logger[_0x8178('0x9')](_0x8178('0xd'),_0x3aa0e4,_0x8178('0xa'));_0x4368b2(_0x267d98['result']['message']);}})[_0x8178('0xf')](function(_0x58ecf2){logger[_0x8178('0xb')](_0x8178('0xd'),_0x3aa0e4,_0x58ecf2);_0x3796c0(_0x58ecf2);});});} \ No newline at end of file +var _0x2e9d=['message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3cb43a,_0x7b8d1d){var _0x1a3d90=function(_0x3d50c6){while(--_0x3d50c6){_0x3cb43a['push'](_0x3cb43a['shift']());}};_0x1a3d90(++_0x7b8d1d);}(_0x2e9d,0x194));var _0xd2e9=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x2e9d[_0x1b4b23];return _0x2a325b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd2e9('0x0'));var BPromise=require('bluebird');var rs=require(_0xd2e9('0x1'));var fs=require('fs');var Redis=require(_0xd2e9('0x2'));var db=require(_0xd2e9('0x3'))['db'];var utils=require(_0xd2e9('0x4'));var logger=require('../../config/logger')(_0xd2e9('0x5'));var config=require(_0xd2e9('0x6'));var jayson=require(_0xd2e9('0x7'));var client=jayson[_0xd2e9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x168ce8,_0x44b422,_0x255b8f){return new BPromise(function(_0x571246,_0x33c712){return client['request'](_0x168ce8,_0x255b8f)[_0xd2e9('0x9')](function(_0x43d525){logger['info'](_0xd2e9('0xa'),_0x44b422,_0xd2e9('0xb'));logger[_0xd2e9('0xc')](_0xd2e9('0xd'),_0x44b422,_0xd2e9('0xb'),JSON['stringify'](_0x43d525));if(_0x43d525[_0xd2e9('0xe')]){if(_0x43d525[_0xd2e9('0xe')][_0xd2e9('0xf')]===0x1f4){logger[_0xd2e9('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x44b422,_0x43d525[_0xd2e9('0xe')][_0xd2e9('0x10')]);return _0x33c712(_0x43d525[_0xd2e9('0xe')][_0xd2e9('0x10')]);}logger[_0xd2e9('0xe')](_0xd2e9('0xa'),_0x44b422,_0x43d525[_0xd2e9('0xe')]['message']);return _0x571246(_0x43d525[_0xd2e9('0xe')][_0xd2e9('0x10')]);}else{logger[_0xd2e9('0x11')](_0xd2e9('0xa'),_0x44b422,_0xd2e9('0xb'));_0x571246(_0x43d525[_0xd2e9('0x12')]['message']);}})[_0xd2e9('0x13')](function(_0x14df8b){logger[_0xd2e9('0xe')](_0xd2e9('0xa'),_0x44b422,_0x14df8b);_0x33c712(_0x14df8b);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 9be5e41..142edac 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 _0x49ce=['../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x54f8b6,_0x5e675f){var _0x2ff157=function(_0x37828b){while(--_0x37828b){_0x54f8b6['push'](_0x54f8b6['shift']());}};_0x2ff157(++_0x5e675f);}(_0x49ce,0xe4));var _0xe49c=function(_0x597834,_0x159bb6){_0x597834=_0x597834-0x0;var _0x12da6c=_0x49ce[_0x597834];return _0x12da6c;};'use strict';var multer=require(_0xe49c('0x0'));var util=require(_0xe49c('0x1'));var path=require(_0xe49c('0x2'));var timeout=require(_0xe49c('0x3'));var express=require('express');var router=express[_0xe49c('0x4')]();var fs_extra=require(_0xe49c('0x5'));var auth=require(_0xe49c('0x6'));var interaction=require(_0xe49c('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xe49c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe49c('0x8')](_0xe49c('0x9'),auth[_0xe49c('0xa')](),controller[_0xe49c('0xb')]);router['post']('/',auth[_0xe49c('0xa')](),controller[_0xe49c('0xc')]);router[_0xe49c('0xd')](_0xe49c('0x9'),auth['isAuthenticated'](),controller[_0xe49c('0xe')]);router[_0xe49c('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe49c('0x10')]);module[_0xe49c('0x11')]=router; \ No newline at end of file +var _0x6c28=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x323050,_0x2c4a3a){var _0xe62f56=function(_0x2963b4){while(--_0x2963b4){_0x323050['push'](_0x323050['shift']());}};_0xe62f56(++_0x2c4a3a);}(_0x6c28,0x14b));var _0x86c2=function(_0x3171ae,_0x22d127){_0x3171ae=_0x3171ae-0x0;var _0x1b0f0f=_0x6c28[_0x3171ae];return _0x1b0f0f;};'use strict';var multer=require(_0x86c2('0x0'));var util=require(_0x86c2('0x1'));var path=require(_0x86c2('0x2'));var timeout=require(_0x86c2('0x3'));var express=require(_0x86c2('0x4'));var router=express[_0x86c2('0x5')]();var fs_extra=require(_0x86c2('0x6'));var auth=require(_0x86c2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x86c2('0x8'));var controller=require(_0x86c2('0x9'));router['get']('/',auth[_0x86c2('0xa')](),controller[_0x86c2('0xb')]);router[_0x86c2('0xc')](_0x86c2('0xd'),auth[_0x86c2('0xa')](),controller[_0x86c2('0xe')]);router[_0x86c2('0xf')]('/',auth[_0x86c2('0xa')](),controller[_0x86c2('0x10')]);router[_0x86c2('0x11')](_0x86c2('0xd'),auth[_0x86c2('0xa')](),controller[_0x86c2('0x12')]);router[_0x86c2('0x13')](_0x86c2('0xd'),auth[_0x86c2('0xa')](),controller['destroy']);module[_0x86c2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index e4fbda5..a737317 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 _0x51ae=['exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN'];(function(_0x5472b2,_0x40c0b9){var _0x1c0886=function(_0x1b9ea5){while(--_0x1b9ea5){_0x5472b2['push'](_0x5472b2['shift']());}};_0x1c0886(++_0x40c0b9);}(_0x51ae,0x70));var _0xe51a=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x51ae[_0xc67528];return _0x38e26d;};'use strict';var Sequelize=require('sequelize');module[_0xe51a('0x0')]={'type':{'type':Sequelize[_0xe51a('0x1')]('string',_0xe51a('0x2'),_0xe51a('0x3'),_0xe51a('0x4'),'picklist'),'defaultValue':_0xe51a('0x5')},'content':{'type':Sequelize[_0xe51a('0x6')]},'key':{'type':Sequelize[_0xe51a('0x6')]},'keyType':{'type':Sequelize[_0xe51a('0x1')](_0xe51a('0x5'),_0xe51a('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xe51a('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe51a('0x6')]},'customField':{'type':Sequelize[_0xe51a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x56bb=['picklist','STRING','variable','BOOLEAN','ENUM','string','keyValue'];(function(_0x971c6e,_0x5860f9){var _0x19e2a6=function(_0x75f958){while(--_0x75f958){_0x971c6e['push'](_0x971c6e['shift']());}};_0x19e2a6(++_0x5860f9);}(_0x56bb,0xa5));var _0xb56b=function(_0x1871a5,_0x2eab89){_0x1871a5=_0x1871a5-0x0;var _0x10509e=_0x56bb[_0x1871a5];return _0x10509e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb56b('0x0')](_0xb56b('0x1'),'variable','customVariable',_0xb56b('0x2'),_0xb56b('0x3')),'defaultValue':_0xb56b('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb56b('0x4')]},'keyType':{'type':Sequelize[_0xb56b('0x0')]('string',_0xb56b('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0xb56b('0x4')]},'idField':{'type':Sequelize[_0xb56b('0x4')]},'nameField':{'type':Sequelize[_0xb56b('0x4')]},'customField':{'type':Sequelize[_0xb56b('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb56b('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 3af4aa0..1c71716 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 _0x17e5=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','type','VIRTUAL','merge','findAll','rows','catch','show','params','options'];(function(_0x1c1b32,_0x43e565){var _0x35252d=function(_0x3aa9b1){while(--_0x3aa9b1){_0x1c1b32['push'](_0x1c1b32['shift']());}};_0x35252d(++_0x43e565);}(_0x17e5,0xdb));var _0x517e=function(_0x4498c3,_0x947819){_0x4498c3=_0x4498c3-0x0;var _0x158542=_0x17e5[_0x4498c3];return _0x158542;};'use strict';var emlformat=require(_0x517e('0x0'));var rimraf=require(_0x517e('0x1'));var zipdir=require(_0x517e('0x2'));var jsonpatch=require(_0x517e('0x3'));var rp=require(_0x517e('0x4'));var moment=require('moment');var BPromise=require(_0x517e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x517e('0x6'));var sox=require(_0x517e('0x7'));var csv=require(_0x517e('0x8'));var ejs=require(_0x517e('0x9'));var fs=require('fs');var fs_extra=require(_0x517e('0xa'));var _=require(_0x517e('0xb'));var squel=require(_0x517e('0xc'));var crypto=require(_0x517e('0xd'));var jsforce=require(_0x517e('0xe'));var deskjs=require(_0x517e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x517e('0x10'));var Papa=require('papaparse');var Redis=require(_0x517e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x517e('0x12'));var hardwareService=require(_0x517e('0x13'));var logger=require(_0x517e('0x14'))(_0x517e('0x15'));var utils=require(_0x517e('0x16'));var config=require(_0x517e('0x17'));var licenseUtil=require(_0x517e('0x18'));var db=require(_0x517e('0x19'))['db'];function respondWithStatusCode(_0x4951f8,_0x5a4265){_0x5a4265=_0x5a4265||0xcc;return function(_0x46627a){if(_0x46627a){return _0x4951f8[_0x517e('0x1a')](_0x5a4265);}return _0x4951f8[_0x517e('0x1b')](_0x5a4265)[_0x517e('0x1c')]();};}function respondWithResult(_0x4784d9,_0x2012d5){_0x2012d5=_0x2012d5||0xc8;return function(_0x942d3d){if(_0x942d3d){return _0x4784d9[_0x517e('0x1b')](_0x2012d5)[_0x517e('0x1d')](_0x942d3d);}};}function respondWithFilteredResult(_0x47d49c,_0x601027){return function(_0x47d8ca){if(_0x47d8ca){var _0x20640b=typeof _0x601027[_0x517e('0x1e')]==='undefined'&&typeof _0x601027[_0x517e('0x1f')]==='undefined';var _0x1e8ff1=_0x47d8ca['count'];var _0x20a023=_0x20640b?0x0:_0x601027['offset'];var _0x290909=_0x20640b?_0x47d8ca[_0x517e('0x20')]:_0x601027[_0x517e('0x1e')]+_0x601027[_0x517e('0x1f')];var _0x49ebc4;if(_0x290909>=_0x1e8ff1){_0x290909=_0x1e8ff1;_0x49ebc4=0xc8;}else{_0x49ebc4=0xce;}_0x47d49c['status'](_0x49ebc4);return _0x47d49c['set'](_0x517e('0x21'),_0x20a023+'-'+_0x290909+'/'+_0x1e8ff1)['json'](_0x47d8ca);}return null;};}function patchUpdates(_0x34125f){return function(_0x38eeb4){try{jsonpatch[_0x517e('0x22')](_0x38eeb4,_0x34125f,!![]);}catch(_0x1e1dc7){return BPromise['reject'](_0x1e1dc7);}return _0x38eeb4['save']();};}function saveUpdates(_0x1972f8,_0x1d89d7){return function(_0x5c1326){if(_0x5c1326){return _0x5c1326[_0x517e('0x23')](_0x1972f8)[_0x517e('0x24')](function(_0x1fb54c){return _0x1fb54c;});}return null;};}function removeEntity(_0x22f8a6,_0x1c5f2e){return function(_0x27d4e2){if(_0x27d4e2){return _0x27d4e2[_0x517e('0x25')]()[_0x517e('0x24')](function(){_0x22f8a6[_0x517e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x575bcc,_0x5c4957){return function(_0x364467){if(!_0x364467){_0x575bcc[_0x517e('0x1a')](0x194);}return _0x364467;};}function handleError(_0x5aa46b,_0x2e068a){_0x2e068a=_0x2e068a||0x1f4;return function(_0x38ef34){logger[_0x517e('0x26')](_0x38ef34[_0x517e('0x27')]);if(_0x38ef34[_0x517e('0x28')]){delete _0x38ef34[_0x517e('0x28')];}_0x5aa46b[_0x517e('0x1b')](_0x2e068a)[_0x517e('0x29')](_0x38ef34);};}exports[_0x517e('0x2a')]=function(_0x453941,_0x342ee3){var _0x3a512b={},_0x1d27a5={},_0x37c98f={'count':0x0,'rows':[]};var _0x3b3143=_[_0x517e('0x2b')](db[_0x517e('0x2c')][_0x517e('0x2d')],function(_0x4764df){return{'name':_0x4764df[_0x517e('0x2e')],'type':_0x4764df['type'][_0x517e('0x2f')]};});_0x1d27a5[_0x517e('0x30')]=_[_0x517e('0x2b')](_0x3b3143,_0x517e('0x28'));_0x1d27a5['query']=_[_0x517e('0x31')](_0x453941[_0x517e('0x32')]);_0x1d27a5[_0x517e('0x33')]=_[_0x517e('0x34')](_0x1d27a5['model'],_0x1d27a5[_0x517e('0x32')]);_0x3a512b[_0x517e('0x35')]=_['intersection'](_0x1d27a5[_0x517e('0x30')],qs[_0x517e('0x36')](_0x453941[_0x517e('0x32')][_0x517e('0x36')]));_0x3a512b['attributes']=_0x3a512b[_0x517e('0x35')]['length']?_0x3a512b[_0x517e('0x35')]:_0x1d27a5[_0x517e('0x30')];if(!_0x453941[_0x517e('0x32')]['hasOwnProperty'](_0x517e('0x37'))){_0x3a512b['limit']=qs[_0x517e('0x1f')](_0x453941[_0x517e('0x32')][_0x517e('0x1f')]);_0x3a512b[_0x517e('0x1e')]=qs[_0x517e('0x1e')](_0x453941[_0x517e('0x32')]['offset']);}_0x3a512b[_0x517e('0x38')]=qs[_0x517e('0x39')](_0x453941['query']['sort']);_0x3a512b['where']=qs[_0x517e('0x33')](_['pick'](_0x453941[_0x517e('0x32')],_0x1d27a5[_0x517e('0x33')]),_0x3b3143);if(_0x453941[_0x517e('0x32')][_0x517e('0x3a')]){_0x3a512b[_0x517e('0x3b')]=_['merge'](_0x3a512b[_0x517e('0x3b')],{'$or':_[_0x517e('0x2b')](_0x3b3143,function(_0x5c3c4a){if(_0x5c3c4a[_0x517e('0x3c')]!==_0x517e('0x3d')){var _0x5b47dd={};_0x5b47dd[_0x5c3c4a['name']]={'$like':'%'+_0x453941['query'][_0x517e('0x3a')]+'%'};return _0x5b47dd;}})});}_0x3a512b=_[_0x517e('0x3e')]({},_0x3a512b,_0x453941['options']);var _0x8b874f={'where':_0x3a512b['where']};return db[_0x517e('0x2c')][_0x517e('0x20')](_0x8b874f)[_0x517e('0x24')](function(_0x4699a2){_0x37c98f['count']=_0x4699a2;if(_0x453941['query']['includeAll']){_0x3a512b['include']=[{'all':!![]}];}return db[_0x517e('0x2c')][_0x517e('0x3f')](_0x3a512b);})[_0x517e('0x24')](function(_0xb2e066){_0x37c98f[_0x517e('0x40')]=_0xb2e066;return _0x37c98f;})[_0x517e('0x24')](respondWithFilteredResult(_0x342ee3,_0x3a512b))[_0x517e('0x41')](handleError(_0x342ee3,null));};exports[_0x517e('0x42')]=function(_0x25cad8,_0x139d98){var _0x123fea={'raw':!![],'where':{'id':_0x25cad8[_0x517e('0x43')]['id']}},_0x44802c={};_0x44802c[_0x517e('0x30')]=_[_0x517e('0x31')](db['ZendeskField'][_0x517e('0x2d')]);_0x44802c[_0x517e('0x32')]=_[_0x517e('0x31')](_0x25cad8[_0x517e('0x32')]);_0x44802c[_0x517e('0x33')]=_[_0x517e('0x34')](_0x44802c[_0x517e('0x30')],_0x44802c[_0x517e('0x32')]);_0x123fea['attributes']=_[_0x517e('0x34')](_0x44802c[_0x517e('0x30')],qs[_0x517e('0x36')](_0x25cad8['query'][_0x517e('0x36')]));_0x123fea['attributes']=_0x123fea['attributes']['length']?_0x123fea[_0x517e('0x35')]:_0x44802c['model'];if(_0x25cad8['query']['includeAll']){_0x123fea['include']=[{'all':!![]}];}_0x123fea=_[_0x517e('0x3e')]({},_0x123fea,_0x25cad8[_0x517e('0x44')]);return db[_0x517e('0x2c')][_0x517e('0x45')](_0x123fea)[_0x517e('0x24')](handleEntityNotFound(_0x139d98,null))['then'](respondWithResult(_0x139d98,null))[_0x517e('0x41')](handleError(_0x139d98,null));};exports[_0x517e('0x46')]=function(_0x4f810b,_0x1e1b6e){return db['ZendeskField'][_0x517e('0x46')](_0x4f810b[_0x517e('0x47')],{})['then'](respondWithResult(_0x1e1b6e,0xc9))['catch'](handleError(_0x1e1b6e,null));};exports['update']=function(_0x5426e0,_0x2e8dec){if(_0x5426e0[_0x517e('0x47')]['id']){delete _0x5426e0[_0x517e('0x47')]['id'];}return db[_0x517e('0x2c')][_0x517e('0x45')]({'where':{'id':_0x5426e0['params']['id']}})[_0x517e('0x24')](handleEntityNotFound(_0x2e8dec,null))[_0x517e('0x24')](saveUpdates(_0x5426e0[_0x517e('0x47')],null))[_0x517e('0x24')](respondWithResult(_0x2e8dec,null))[_0x517e('0x41')](handleError(_0x2e8dec,null));};exports[_0x517e('0x25')]=function(_0x55e432,_0x48279f){return db[_0x517e('0x2c')][_0x517e('0x45')]({'where':{'id':_0x55e432[_0x517e('0x43')]['id']}})[_0x517e('0x24')](handleEntityNotFound(_0x48279f,null))[_0x517e('0x24')](removeEntity(_0x48279f,null))['catch'](handleError(_0x48279f,null));}; \ No newline at end of file +var _0x3306=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','includeAll','include','findAll','rows','catch','show','options','create','body','update','params','eml-format','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x25953b,_0x48121a){var _0x340562=function(_0x39dcad){while(--_0x39dcad){_0x25953b['push'](_0x25953b['shift']());}};_0x340562(++_0x48121a);}(_0x3306,0x1ec));var _0x6330=function(_0x4a5101,_0x22e9e3){_0x4a5101=_0x4a5101-0x0;var _0x33ea5b=_0x3306[_0x4a5101];return _0x33ea5b;};'use strict';var emlformat=require(_0x6330('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6330('0x1'));var rp=require('request-promise');var moment=require(_0x6330('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6330('0x3'));var util=require(_0x6330('0x4'));var path=require('path');var sox=require(_0x6330('0x5'));var csv=require(_0x6330('0x6'));var ejs=require(_0x6330('0x7'));var fs=require('fs');var fs_extra=require(_0x6330('0x8'));var _=require(_0x6330('0x9'));var squel=require(_0x6330('0xa'));var crypto=require(_0x6330('0xb'));var jsforce=require(_0x6330('0xc'));var deskjs=require(_0x6330('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6330('0xe'));var Papa=require('papaparse');var Redis=require(_0x6330('0xf'));var authService=require(_0x6330('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6330('0x11'));var hardwareService=require(_0x6330('0x12'));var logger=require(_0x6330('0x13'))(_0x6330('0x14'));var utils=require(_0x6330('0x15'));var config=require(_0x6330('0x16'));var licenseUtil=require(_0x6330('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1962c9,_0x47f0a5){_0x47f0a5=_0x47f0a5||0xcc;return function(_0x55a31c){if(_0x55a31c){return _0x1962c9[_0x6330('0x18')](_0x47f0a5);}return _0x1962c9[_0x6330('0x19')](_0x47f0a5)['end']();};}function respondWithResult(_0x1788a7,_0x16f5ee){_0x16f5ee=_0x16f5ee||0xc8;return function(_0x4fb14e){if(_0x4fb14e){return _0x1788a7[_0x6330('0x19')](_0x16f5ee)[_0x6330('0x1a')](_0x4fb14e);}};}function respondWithFilteredResult(_0x3b4964,_0x1173c1){return function(_0x52ae91){if(_0x52ae91){var _0x35f02a=typeof _0x1173c1[_0x6330('0x1b')]===_0x6330('0x1c')&&typeof _0x1173c1[_0x6330('0x1d')]===_0x6330('0x1c');var _0x2934ec=_0x52ae91[_0x6330('0x1e')];var _0x3c4c48=_0x35f02a?0x0:_0x1173c1[_0x6330('0x1b')];var _0x32a3ca=_0x35f02a?_0x52ae91['count']:_0x1173c1[_0x6330('0x1b')]+_0x1173c1[_0x6330('0x1d')];var _0x4802c1;if(_0x32a3ca>=_0x2934ec){_0x32a3ca=_0x2934ec;_0x4802c1=0xc8;}else{_0x4802c1=0xce;}_0x3b4964[_0x6330('0x19')](_0x4802c1);return _0x3b4964[_0x6330('0x1f')](_0x6330('0x20'),_0x3c4c48+'-'+_0x32a3ca+'/'+_0x2934ec)['json'](_0x52ae91);}return null;};}function patchUpdates(_0x1bf579){return function(_0x37c8c4){try{jsonpatch[_0x6330('0x21')](_0x37c8c4,_0x1bf579,!![]);}catch(_0x2d02df){return BPromise['reject'](_0x2d02df);}return _0x37c8c4['save']();};}function saveUpdates(_0x53cda1,_0x3f2615){return function(_0x25ecac){if(_0x25ecac){return _0x25ecac['update'](_0x53cda1)[_0x6330('0x22')](function(_0x5553df){return _0x5553df;});}return null;};}function removeEntity(_0x41a355,_0x51a2ce){return function(_0x3fb4ef){if(_0x3fb4ef){return _0x3fb4ef[_0x6330('0x23')]()[_0x6330('0x22')](function(){_0x41a355['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x68096a,_0x368871){return function(_0x5bcd2c){if(!_0x5bcd2c){_0x68096a[_0x6330('0x18')](0x194);}return _0x5bcd2c;};}function handleError(_0x508e41,_0x414e8d){_0x414e8d=_0x414e8d||0x1f4;return function(_0x7e600c){logger[_0x6330('0x24')](_0x7e600c[_0x6330('0x25')]);if(_0x7e600c[_0x6330('0x26')]){delete _0x7e600c['name'];}_0x508e41[_0x6330('0x19')](_0x414e8d)[_0x6330('0x27')](_0x7e600c);};}exports[_0x6330('0x28')]=function(_0x207bf5,_0x2e9201){var _0x45d56b={},_0x388830={},_0x39c205={'count':0x0,'rows':[]};var _0x5841e5=_[_0x6330('0x29')](db[_0x6330('0x2a')][_0x6330('0x2b')],function(_0x16c076){return{'name':_0x16c076[_0x6330('0x2c')],'type':_0x16c076['type'][_0x6330('0x2d')]};});_0x388830['model']=_['map'](_0x5841e5,_0x6330('0x26'));_0x388830[_0x6330('0x2e')]=_[_0x6330('0x2f')](_0x207bf5[_0x6330('0x2e')]);_0x388830[_0x6330('0x30')]=_[_0x6330('0x31')](_0x388830[_0x6330('0x32')],_0x388830['query']);_0x45d56b[_0x6330('0x33')]=_[_0x6330('0x31')](_0x388830[_0x6330('0x32')],qs['fields'](_0x207bf5[_0x6330('0x2e')][_0x6330('0x34')]));_0x45d56b[_0x6330('0x33')]=_0x45d56b[_0x6330('0x33')]['length']?_0x45d56b[_0x6330('0x33')]:_0x388830[_0x6330('0x32')];if(!_0x207bf5[_0x6330('0x2e')][_0x6330('0x35')](_0x6330('0x36'))){_0x45d56b[_0x6330('0x1d')]=qs[_0x6330('0x1d')](_0x207bf5[_0x6330('0x2e')][_0x6330('0x1d')]);_0x45d56b[_0x6330('0x1b')]=qs['offset'](_0x207bf5[_0x6330('0x2e')][_0x6330('0x1b')]);}_0x45d56b[_0x6330('0x37')]=qs[_0x6330('0x38')](_0x207bf5['query'][_0x6330('0x38')]);_0x45d56b[_0x6330('0x39')]=qs['filters'](_['pick'](_0x207bf5[_0x6330('0x2e')],_0x388830[_0x6330('0x30')]),_0x5841e5);if(_0x207bf5[_0x6330('0x2e')][_0x6330('0x3a')]){_0x45d56b[_0x6330('0x39')]=_['merge'](_0x45d56b[_0x6330('0x39')],{'$or':_['map'](_0x5841e5,function(_0x6846d){if(_0x6846d[_0x6330('0x3b')]!=='VIRTUAL'){var _0x30d60e={};_0x30d60e[_0x6846d[_0x6330('0x26')]]={'$like':'%'+_0x207bf5['query']['filter']+'%'};return _0x30d60e;}})});}_0x45d56b=_[_0x6330('0x3c')]({},_0x45d56b,_0x207bf5['options']);var _0x59bb9b={'where':_0x45d56b[_0x6330('0x39')]};return db[_0x6330('0x2a')]['count'](_0x59bb9b)[_0x6330('0x22')](function(_0x388dbf){_0x39c205[_0x6330('0x1e')]=_0x388dbf;if(_0x207bf5[_0x6330('0x2e')][_0x6330('0x3d')]){_0x45d56b[_0x6330('0x3e')]=[{'all':!![]}];}return db[_0x6330('0x2a')][_0x6330('0x3f')](_0x45d56b);})[_0x6330('0x22')](function(_0x45cc6f){_0x39c205[_0x6330('0x40')]=_0x45cc6f;return _0x39c205;})[_0x6330('0x22')](respondWithFilteredResult(_0x2e9201,_0x45d56b))[_0x6330('0x41')](handleError(_0x2e9201,null));};exports[_0x6330('0x42')]=function(_0x418e56,_0x2f8125){var _0x408f79={'raw':!![],'where':{'id':_0x418e56['params']['id']}},_0x324f75={};_0x324f75['model']=_[_0x6330('0x2f')](db[_0x6330('0x2a')]['rawAttributes']);_0x324f75[_0x6330('0x2e')]=_[_0x6330('0x2f')](_0x418e56['query']);_0x324f75[_0x6330('0x30')]=_['intersection'](_0x324f75[_0x6330('0x32')],_0x324f75[_0x6330('0x2e')]);_0x408f79['attributes']=_['intersection'](_0x324f75[_0x6330('0x32')],qs[_0x6330('0x34')](_0x418e56[_0x6330('0x2e')][_0x6330('0x34')]));_0x408f79[_0x6330('0x33')]=_0x408f79[_0x6330('0x33')]['length']?_0x408f79[_0x6330('0x33')]:_0x324f75[_0x6330('0x32')];if(_0x418e56[_0x6330('0x2e')]['includeAll']){_0x408f79['include']=[{'all':!![]}];}_0x408f79=_[_0x6330('0x3c')]({},_0x408f79,_0x418e56[_0x6330('0x43')]);return db[_0x6330('0x2a')]['find'](_0x408f79)['then'](handleEntityNotFound(_0x2f8125,null))['then'](respondWithResult(_0x2f8125,null))['catch'](handleError(_0x2f8125,null));};exports['create']=function(_0x29b7a0,_0x880f7e){return db[_0x6330('0x2a')][_0x6330('0x44')](_0x29b7a0[_0x6330('0x45')],{})['then'](respondWithResult(_0x880f7e,0xc9))['catch'](handleError(_0x880f7e,null));};exports[_0x6330('0x46')]=function(_0x58e119,_0x3f66ef){if(_0x58e119[_0x6330('0x45')]['id']){delete _0x58e119['body']['id'];}return db[_0x6330('0x2a')]['find']({'where':{'id':_0x58e119[_0x6330('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f66ef,null))['then'](saveUpdates(_0x58e119[_0x6330('0x45')],null))[_0x6330('0x22')](respondWithResult(_0x3f66ef,null))[_0x6330('0x41')](handleError(_0x3f66ef,null));};exports[_0x6330('0x23')]=function(_0x28bba4,_0x575f37){return db[_0x6330('0x2a')]['find']({'where':{'id':_0x28bba4[_0x6330('0x47')]['id']}})[_0x6330('0x22')](handleEntityNotFound(_0x575f37,null))[_0x6330('0x22')](removeEntity(_0x575f37,null))['catch'](handleError(_0x575f37,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index f8b290a..0357da1 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 _0x41f9=['path','rimraf','../../config/environment','exports','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x42997d,_0xa0b875){var _0x42a209=function(_0x4af94c){while(--_0x4af94c){_0x42997d['push'](_0x42997d['shift']());}};_0x42a209(++_0xa0b875);}(_0x41f9,0x1ce));var _0x941f=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x41f9[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x941f('0x0'));var util=require(_0x941f('0x1'));var logger=require(_0x941f('0x2'))(_0x941f('0x3'));var moment=require(_0x941f('0x4'));var BPromise=require('bluebird');var rp=require(_0x941f('0x5'));var fs=require('fs');var path=require(_0x941f('0x6'));var rimraf=require(_0x941f('0x7'));var config=require(_0x941f('0x8'));var attributes=require('./intZendeskField.attributes');module[_0x941f('0x9')]=function(_0x7d6c03,_0x427079){return _0x7d6c03['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x941f('0xa'),_0x941f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf44a=['idField','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xf44a,0xaa));var _0xaf44=function(_0x16c17e,_0x4afd4f){_0x16c17e=_0x16c17e-0x0;var _0x447c4f=_0xf44a[_0x16c17e];return _0x447c4f;};'use strict';var _=require(_0xaf44('0x0'));var util=require(_0xaf44('0x1'));var logger=require(_0xaf44('0x2'))('api');var moment=require(_0xaf44('0x3'));var BPromise=require('bluebird');var rp=require(_0xaf44('0x4'));var fs=require('fs');var path=require(_0xaf44('0x5'));var rimraf=require('rimraf');var config=require(_0xaf44('0x6'));var attributes=require('./intZendeskField.attributes');module[_0xaf44('0x7')]=function(_0x22212b,_0x33e048){return _0x22212b[_0xaf44('0x8')](_0xaf44('0x9'),attributes,{'tableName':_0xaf44('0xa'),'paranoid':![],'indexes':[{'name':_0xaf44('0xb'),'fields':[_0xaf44('0xc'),'FieldId'],'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 c42ec07..f2b6f27 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 _0x4a58=['randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x4a58,0x146));var _0x84a5=function(_0x261b08,_0x563d91){_0x261b08=_0x261b08-0x0;var _0xeeaf84=_0x4a58[_0x261b08];return _0xeeaf84;};'use strict';var _=require(_0x84a5('0x0'));var util=require(_0x84a5('0x1'));var moment=require(_0x84a5('0x2'));var BPromise=require(_0x84a5('0x3'));var rs=require(_0x84a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84a5('0x5'))['db'];var utils=require(_0x84a5('0x6'));var logger=require(_0x84a5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x84a5('0x8'));var client=jayson[_0x84a5('0x9')][_0x84a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc17412,_0x1db705,_0x5179e2){return new BPromise(function(_0x2c9fd6,_0x5a327e){return client['request'](_0xc17412,_0x5179e2)[_0x84a5('0xb')](function(_0x4f680a){logger['info'](_0x84a5('0xc'),_0x1db705,'request\x20sent');logger[_0x84a5('0xd')](_0x84a5('0xe'),_0x1db705,_0x84a5('0xf'),JSON[_0x84a5('0x10')](_0x4f680a));if(_0x4f680a['error']){if(_0x4f680a[_0x84a5('0x11')][_0x84a5('0x12')]===0x1f4){logger[_0x84a5('0x11')](_0x84a5('0xc'),_0x1db705,_0x4f680a['error'][_0x84a5('0x13')]);return _0x5a327e(_0x4f680a[_0x84a5('0x11')][_0x84a5('0x13')]);}logger[_0x84a5('0x11')](_0x84a5('0xc'),_0x1db705,_0x4f680a[_0x84a5('0x11')][_0x84a5('0x13')]);return _0x2c9fd6(_0x4f680a['error'][_0x84a5('0x13')]);}else{logger[_0x84a5('0x14')]('ZendeskField,\x20%s,\x20%s',_0x1db705,'request\x20sent');_0x2c9fd6(_0x4f680a['result'][_0x84a5('0x13')]);}})[_0x84a5('0x15')](function(_0x393a8f){logger[_0x84a5('0x11')](_0x84a5('0xc'),_0x1db705,_0x393a8f);_0x5a327e(_0x393a8f);});});} \ No newline at end of file +var _0xcb1d=['info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcb1d,0x157));var _0xdcb1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb1d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xdcb1('0x0'));var util=require(_0xdcb1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdcb1('0x2'));var fs=require('fs');var Redis=require(_0xdcb1('0x3'));var db=require(_0xdcb1('0x4'))['db'];var utils=require(_0xdcb1('0x5'));var logger=require('../../config/logger')(_0xdcb1('0x6'));var config=require(_0xdcb1('0x7'));var jayson=require(_0xdcb1('0x8'));var client=jayson['client'][_0xdcb1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x179a0b,_0x5bf2ae,_0x4bea57){return new BPromise(function(_0x414be8,_0x4e209d){return client[_0xdcb1('0xa')](_0x179a0b,_0x4bea57)[_0xdcb1('0xb')](function(_0x385e8a){logger['info'](_0xdcb1('0xc'),_0x5bf2ae,'request\x20sent');logger[_0xdcb1('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x5bf2ae,_0xdcb1('0xe'),JSON['stringify'](_0x385e8a));if(_0x385e8a[_0xdcb1('0xf')]){if(_0x385e8a[_0xdcb1('0xf')]['code']===0x1f4){logger[_0xdcb1('0xf')](_0xdcb1('0xc'),_0x5bf2ae,_0x385e8a[_0xdcb1('0xf')][_0xdcb1('0x10')]);return _0x4e209d(_0x385e8a[_0xdcb1('0xf')][_0xdcb1('0x10')]);}logger['error'](_0xdcb1('0xc'),_0x5bf2ae,_0x385e8a['error'][_0xdcb1('0x10')]);return _0x414be8(_0x385e8a[_0xdcb1('0xf')][_0xdcb1('0x10')]);}else{logger[_0xdcb1('0x11')](_0xdcb1('0xc'),_0x5bf2ae,_0xdcb1('0xe'));_0x414be8(_0x385e8a[_0xdcb1('0x12')][_0xdcb1('0x10')]);}})[_0xdcb1('0x13')](function(_0x10d285){logger['error'](_0xdcb1('0xc'),_0x5bf2ae,_0x10d285);_0x4e209d(_0x10d285);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 4c03df1..e6cd252 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 _0x1964=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','getConfigurations','/:id/fields','create','post','/:id/configurations','/:id','update','exports','multer','util','path','connect-timeout','express'];(function(_0x1ec9af,_0x4eef08){var _0xb4a880=function(_0x57192a){while(--_0x57192a){_0x1ec9af['push'](_0x1ec9af['shift']());}};_0xb4a880(++_0x4eef08);}(_0x1964,0xe1));var _0x4196=function(_0x160be6,_0x38b648){_0x160be6=_0x160be6-0x0;var _0x36de35=_0x1964[_0x160be6];return _0x36de35;};'use strict';var multer=require(_0x4196('0x0'));var util=require(_0x4196('0x1'));var path=require(_0x4196('0x2'));var timeout=require(_0x4196('0x3'));var express=require(_0x4196('0x4'));var router=express[_0x4196('0x5')]();var fs_extra=require(_0x4196('0x6'));var auth=require(_0x4196('0x7'));var interaction=require(_0x4196('0x8'));var config=require(_0x4196('0x9'));var controller=require(_0x4196('0xa'));router['get']('/',auth[_0x4196('0xb')](),controller[_0x4196('0xc')]);router[_0x4196('0xd')]('/:id',auth[_0x4196('0xb')](),controller[_0x4196('0xe')]);router[_0x4196('0xd')]('/:id/configurations',auth[_0x4196('0xb')](),controller[_0x4196('0xf')]);router[_0x4196('0xd')](_0x4196('0x10'),auth[_0x4196('0xb')](),controller['getFields']);router['post']('/',auth[_0x4196('0xb')](),controller[_0x4196('0x11')]);router[_0x4196('0x12')](_0x4196('0x13'),auth[_0x4196('0xb')](),controller['addConfiguration']);router['put'](_0x4196('0x14'),auth[_0x4196('0xb')](),controller[_0x4196('0x15')]);router['delete'](_0x4196('0x14'),auth[_0x4196('0xb')](),controller['destroy']);module[_0x4196('0x16')]=router; \ No newline at end of file +var _0xf2ca=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x2cae70,_0x572fac){var _0x520939=function(_0x51023d){while(--_0x51023d){_0x2cae70['push'](_0x2cae70['shift']());}};_0x520939(++_0x572fac);}(_0xf2ca,0x16a));var _0xaf2c=function(_0xb37185,_0x3ec508){_0xb37185=_0xb37185-0x0;var _0x575b45=_0xf2ca[_0xb37185];return _0x575b45;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var fs_extra=require(_0xaf2c('0x5'));var auth=require(_0xaf2c('0x6'));var interaction=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var controller=require('./intZohoAccount.controller');router[_0xaf2c('0x9')]('/',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0x9')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xc')]);router['get'](_0xaf2c('0xd'),auth['isAuthenticated'](),controller[_0xaf2c('0xe')]);router['get'](_0xaf2c('0xf'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x10')]);router[_0xaf2c('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaf2c('0x11')](_0xaf2c('0xd'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x12')]);router[_0xaf2c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xaf2c('0x14')]);router[_0xaf2c('0x15')](_0xaf2c('0x16'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x17')]);module[_0xaf2c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 94b8a1a..dc6aeda 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 _0xaa88=['exports','STRING','sequelize'];(function(_0x541886,_0x12d2b0){var _0x599f78=function(_0x4a68c7){while(--_0x4a68c7){_0x541886['push'](_0x541886['shift']());}};_0x599f78(++_0x12d2b0);}(_0xaa88,0x137));var _0x8aa8=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0xaa88[_0x2e7f96];return _0x315277;};'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 +var _0x99e9=['exports','STRING'];(function(_0x20af0c,_0x21b792){var _0xd86003=function(_0xe8529f){while(--_0xe8529f){_0x20af0c['push'](_0x20af0c['shift']());}};_0xd86003(++_0x21b792);}(_0x99e9,0xb4));var _0x999e=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0x99e9[_0x558e45];return _0x3e9075;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 0bd4647..ffaa3fe 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 _0x3d0d=['catch','params','intersection','create','body','find','getConfigurations','findOne','ZohoConfiguration','rawAttributes','pick','addConfiguration','AccountId','getSubjects','channel','ZohoField','zone','https://accounts.zoho.com.au','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','serverUrl','code','zoho.eu','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','limit','count','offset','Content-Range','json','reject','save','update','then','error','name','send','index','map','ZohoAccount','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3d0d,0x1ab));var _0xd3d0=function(_0x3cda00,_0x561897){_0x3cda00=_0x3cda00-0x0;var _0x59ba22=_0x3d0d[_0x3cda00];return _0x59ba22;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3d0('0x0'));var zipdir=require(_0xd3d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3d0('0x2'));var moment=require('moment');var BPromise=require(_0xd3d0('0x3'));var Mustache=require(_0xd3d0('0x4'));var util=require(_0xd3d0('0x5'));var path=require(_0xd3d0('0x6'));var sox=require(_0xd3d0('0x7'));var csv=require(_0xd3d0('0x8'));var ejs=require(_0xd3d0('0x9'));var fs=require('fs');var fs_extra=require(_0xd3d0('0xa'));var _=require(_0xd3d0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd3d0('0xc'));var deskjs=require(_0xd3d0('0xd'));var toCsv=require(_0xd3d0('0x8'));var querystring=require(_0xd3d0('0xe'));var Papa=require(_0xd3d0('0xf'));var Redis=require(_0xd3d0('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd3d0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3d0('0x12'))(_0xd3d0('0x13'));var utils=require(_0xd3d0('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd3d0('0x15'));function respondWithStatusCode(_0x9efe3b,_0x2122a0){_0x2122a0=_0x2122a0||0xcc;return function(_0x34e30c){if(_0x34e30c){return _0x9efe3b[_0xd3d0('0x16')](_0x2122a0);}return _0x9efe3b[_0xd3d0('0x17')](_0x2122a0)[_0xd3d0('0x18')]();};}function respondWithResult(_0x4ec3e2,_0x300aef){_0x300aef=_0x300aef||0xc8;return function(_0x3ad5cf){if(_0x3ad5cf){return _0x4ec3e2[_0xd3d0('0x17')](_0x300aef)['json'](_0x3ad5cf);}};}function respondWithFilteredResult(_0x17b8ca,_0x24b37c){return function(_0x4642e9){if(_0x4642e9){var _0x280e79=typeof _0x24b37c['offset']==='undefined'&&typeof _0x24b37c[_0xd3d0('0x19')]==='undefined';var _0xb0cffe=_0x4642e9[_0xd3d0('0x1a')];var _0x2706c2=_0x280e79?0x0:_0x24b37c[_0xd3d0('0x1b')];var _0x2eba9f=_0x280e79?_0x4642e9[_0xd3d0('0x1a')]:_0x24b37c['offset']+_0x24b37c[_0xd3d0('0x19')];var _0x55e488;if(_0x2eba9f>=_0xb0cffe){_0x2eba9f=_0xb0cffe;_0x55e488=0xc8;}else{_0x55e488=0xce;}_0x17b8ca[_0xd3d0('0x17')](_0x55e488);return _0x17b8ca['set'](_0xd3d0('0x1c'),_0x2706c2+'-'+_0x2eba9f+'/'+_0xb0cffe)[_0xd3d0('0x1d')](_0x4642e9);}return null;};}function patchUpdates(_0x22dcad){return function(_0x3d7254){try{jsonpatch['apply'](_0x3d7254,_0x22dcad,!![]);}catch(_0x501b75){return BPromise[_0xd3d0('0x1e')](_0x501b75);}return _0x3d7254[_0xd3d0('0x1f')]();};}function saveUpdates(_0x295a72,_0x302d53){return function(_0x8fd06e){if(_0x8fd06e){return _0x8fd06e[_0xd3d0('0x20')](_0x295a72)[_0xd3d0('0x21')](function(_0x30ed4d){return _0x30ed4d;});}return null;};}function removeEntity(_0x507533,_0x5e2661){return function(_0x59774d){if(_0x59774d){return _0x59774d['destroy']()[_0xd3d0('0x21')](function(){_0x507533[_0xd3d0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ad5fb,_0x2eb9fc){return function(_0x1779b9){if(!_0x1779b9){_0x2ad5fb['sendStatus'](0x194);}return _0x1779b9;};}function handleError(_0x25a5a9,_0x1150be){_0x1150be=_0x1150be||0x1f4;return function(_0x6729d5){logger[_0xd3d0('0x22')](_0x6729d5['stack']);if(_0x6729d5['name']){delete _0x6729d5[_0xd3d0('0x23')];}_0x25a5a9[_0xd3d0('0x17')](_0x1150be)[_0xd3d0('0x24')](_0x6729d5);};}exports[_0xd3d0('0x25')]=function(_0x1e9fc7,_0x7330c8){var _0x3cfb3c={},_0x50c9f3={},_0xfb85a4={'count':0x0,'rows':[]};var _0x4dee1f=_[_0xd3d0('0x26')](db[_0xd3d0('0x27')]['rawAttributes'],function(_0x54b9a0){return{'name':_0x54b9a0[_0xd3d0('0x28')],'type':_0x54b9a0['type'][_0xd3d0('0x29')]};});_0x50c9f3[_0xd3d0('0x2a')]=_[_0xd3d0('0x26')](_0x4dee1f,'name');_0x50c9f3[_0xd3d0('0x2b')]=_[_0xd3d0('0x2c')](_0x1e9fc7[_0xd3d0('0x2b')]);_0x50c9f3[_0xd3d0('0x2d')]=_['intersection'](_0x50c9f3[_0xd3d0('0x2a')],_0x50c9f3['query']);_0x3cfb3c['attributes']=_['intersection'](_0x50c9f3['model'],qs['fields'](_0x1e9fc7['query'][_0xd3d0('0x2e')]));_0x3cfb3c[_0xd3d0('0x2f')]=_0x3cfb3c['attributes'][_0xd3d0('0x30')]?_0x3cfb3c[_0xd3d0('0x2f')]:_0x50c9f3['model'];if(!_0x1e9fc7[_0xd3d0('0x2b')][_0xd3d0('0x31')](_0xd3d0('0x32'))){_0x3cfb3c[_0xd3d0('0x19')]=qs[_0xd3d0('0x19')](_0x1e9fc7['query'][_0xd3d0('0x19')]);_0x3cfb3c[_0xd3d0('0x1b')]=qs['offset'](_0x1e9fc7[_0xd3d0('0x2b')][_0xd3d0('0x1b')]);}_0x3cfb3c[_0xd3d0('0x33')]=qs[_0xd3d0('0x34')](_0x1e9fc7[_0xd3d0('0x2b')][_0xd3d0('0x34')]);_0x3cfb3c[_0xd3d0('0x35')]=qs[_0xd3d0('0x2d')](_['pick'](_0x1e9fc7[_0xd3d0('0x2b')],_0x50c9f3[_0xd3d0('0x2d')]),_0x4dee1f);if(_0x1e9fc7[_0xd3d0('0x2b')][_0xd3d0('0x36')]){_0x3cfb3c['where']=_[_0xd3d0('0x37')](_0x3cfb3c[_0xd3d0('0x35')],{'$or':_[_0xd3d0('0x26')](_0x4dee1f,function(_0x481e1d){if(_0x481e1d[_0xd3d0('0x38')]!==_0xd3d0('0x39')){var _0x318c55={};_0x318c55[_0x481e1d['name']]={'$like':'%'+_0x1e9fc7[_0xd3d0('0x2b')][_0xd3d0('0x36')]+'%'};return _0x318c55;}})});}_0x3cfb3c=_[_0xd3d0('0x37')]({},_0x3cfb3c,_0x1e9fc7[_0xd3d0('0x3a')]);var _0x3332da={'where':_0x3cfb3c[_0xd3d0('0x35')]};return db[_0xd3d0('0x27')][_0xd3d0('0x1a')](_0x3332da)[_0xd3d0('0x21')](function(_0x4ef380){_0xfb85a4[_0xd3d0('0x1a')]=_0x4ef380;if(_0x1e9fc7['query'][_0xd3d0('0x3b')]){_0x3cfb3c[_0xd3d0('0x3c')]=[{'all':!![]}];}return db[_0xd3d0('0x27')]['findAll'](_0x3cfb3c);})[_0xd3d0('0x21')](function(_0x596862){_0xfb85a4['rows']=_0x596862;return _0xfb85a4;})[_0xd3d0('0x21')](respondWithFilteredResult(_0x7330c8,_0x3cfb3c))[_0xd3d0('0x3d')](handleError(_0x7330c8,null));};exports['show']=function(_0x40f069,_0x46e52a){var _0x19b972={'raw':![],'where':{'id':_0x40f069[_0xd3d0('0x3e')]['id']}},_0x219ec1={};_0x219ec1[_0xd3d0('0x2a')]=_[_0xd3d0('0x2c')](db[_0xd3d0('0x27')]['rawAttributes']);_0x219ec1[_0xd3d0('0x2b')]=_[_0xd3d0('0x2c')](_0x40f069[_0xd3d0('0x2b')]);_0x219ec1[_0xd3d0('0x2d')]=_['intersection'](_0x219ec1[_0xd3d0('0x2a')],_0x219ec1[_0xd3d0('0x2b')]);_0x19b972[_0xd3d0('0x2f')]=_[_0xd3d0('0x3f')](_0x219ec1[_0xd3d0('0x2a')],qs[_0xd3d0('0x2e')](_0x40f069[_0xd3d0('0x2b')][_0xd3d0('0x2e')]));_0x19b972[_0xd3d0('0x2f')]=_0x19b972[_0xd3d0('0x2f')][_0xd3d0('0x30')]?_0x19b972[_0xd3d0('0x2f')]:_0x219ec1['model'];if(_0x40f069[_0xd3d0('0x2b')][_0xd3d0('0x3b')]){_0x19b972[_0xd3d0('0x3c')]=[{'all':!![]}];}_0x19b972=_[_0xd3d0('0x37')]({},_0x19b972,_0x40f069['options']);return db[_0xd3d0('0x27')]['find'](_0x19b972)[_0xd3d0('0x21')](handleEntityNotFound(_0x46e52a,null))['then'](respondWithResult(_0x46e52a,null))[_0xd3d0('0x3d')](handleError(_0x46e52a,null));};exports[_0xd3d0('0x40')]=function(_0x587f0a,_0x15fdf0){return db[_0xd3d0('0x27')][_0xd3d0('0x40')](_0x587f0a[_0xd3d0('0x41')],{})[_0xd3d0('0x21')](respondWithResult(_0x15fdf0,0xc9))['catch'](handleError(_0x15fdf0,null));};exports['update']=function(_0x92ee3c,_0x25e897){if(_0x92ee3c[_0xd3d0('0x41')]['id']){delete _0x92ee3c[_0xd3d0('0x41')]['id'];}return db['ZohoAccount'][_0xd3d0('0x42')]({'where':{'id':_0x92ee3c[_0xd3d0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x25e897,null))['then'](saveUpdates(_0x92ee3c[_0xd3d0('0x41')],null))[_0xd3d0('0x21')](respondWithResult(_0x25e897,null))[_0xd3d0('0x3d')](handleError(_0x25e897,null));};exports['destroy']=function(_0x35f7ab,_0x25f3c6){return db[_0xd3d0('0x27')][_0xd3d0('0x42')]({'where':{'id':_0x35f7ab[_0xd3d0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x25f3c6,null))[_0xd3d0('0x21')](removeEntity(_0x25f3c6,null))['catch'](handleError(_0x25f3c6,null));};exports[_0xd3d0('0x43')]=function(_0x4983c3,_0xa3757d,_0x3cdcff){var _0x2ce968={};var _0x24bf33={};var _0x5301f2;var _0x15a0de;return db[_0xd3d0('0x27')][_0xd3d0('0x44')]({'where':{'id':_0x4983c3[_0xd3d0('0x3e')]['id']}})[_0xd3d0('0x21')](handleEntityNotFound(_0xa3757d,null))[_0xd3d0('0x21')](function(_0x2a4bdb){if(_0x2a4bdb){_0x5301f2=_0x2a4bdb;_0x24bf33['model']=_[_0xd3d0('0x2c')](db[_0xd3d0('0x45')][_0xd3d0('0x46')]);_0x24bf33[_0xd3d0('0x2b')]=_[_0xd3d0('0x2c')](_0x4983c3[_0xd3d0('0x2b')]);_0x24bf33[_0xd3d0('0x2d')]=_[_0xd3d0('0x3f')](_0x24bf33['model'],_0x24bf33[_0xd3d0('0x2b')]);_0x2ce968[_0xd3d0('0x2f')]=_[_0xd3d0('0x3f')](_0x24bf33['model'],qs[_0xd3d0('0x2e')](_0x4983c3[_0xd3d0('0x2b')][_0xd3d0('0x2e')]));_0x2ce968[_0xd3d0('0x2f')]=_0x2ce968[_0xd3d0('0x2f')]['length']?_0x2ce968[_0xd3d0('0x2f')]:_0x24bf33[_0xd3d0('0x2a')];_0x2ce968[_0xd3d0('0x33')]=qs[_0xd3d0('0x34')](_0x4983c3[_0xd3d0('0x2b')]['sort']);_0x2ce968[_0xd3d0('0x35')]=qs[_0xd3d0('0x2d')](_[_0xd3d0('0x47')](_0x4983c3['query'],_0x24bf33[_0xd3d0('0x2d')]));if(_0x4983c3['query']['filter']){_0x2ce968['where']=_[_0xd3d0('0x37')](_0x2ce968[_0xd3d0('0x35')],{'$or':_[_0xd3d0('0x26')](_0x2ce968[_0xd3d0('0x2f')],function(_0x4e50ba){var _0x160bfe={};_0x160bfe[_0x4e50ba]={'$like':'%'+_0x4983c3['query'][_0xd3d0('0x36')]+'%'};return _0x160bfe;})});}_0x2ce968=_[_0xd3d0('0x37')]({},_0x2ce968,_0x4983c3['options']);return _0x5301f2[_0xd3d0('0x43')](_0x2ce968);}})['then'](function(_0x369927){if(_0x369927){_0x15a0de=_0x369927['length'];if(!_0x4983c3['query'][_0xd3d0('0x31')](_0xd3d0('0x32'))){_0x2ce968[_0xd3d0('0x19')]=qs[_0xd3d0('0x19')](_0x4983c3['query'][_0xd3d0('0x19')]);_0x2ce968[_0xd3d0('0x1b')]=qs['offset'](_0x4983c3[_0xd3d0('0x2b')][_0xd3d0('0x1b')]);}return _0x5301f2[_0xd3d0('0x43')](_0x2ce968);}})[_0xd3d0('0x21')](function(_0x34fb95){if(_0x34fb95){return _0x34fb95?{'count':_0x15a0de,'rows':_0x34fb95}:null;}})[_0xd3d0('0x21')](respondWithResult(_0xa3757d,null))['catch'](handleError(_0xa3757d,null));};exports[_0xd3d0('0x48')]=function(_0x1774a0,_0x9fabc1,_0x1d0d3f){if(_0x1774a0['body']['id']){delete _0x1774a0[_0xd3d0('0x41')]['id'];}return db[_0xd3d0('0x27')][_0xd3d0('0x44')]({'where':{'id':_0x1774a0[_0xd3d0('0x3e')]['id']}})[_0xd3d0('0x21')](handleEntityNotFound(_0x9fabc1,null))[_0xd3d0('0x21')](function(_0x451574){if(_0x451574){_0x1774a0[_0xd3d0('0x41')][_0xd3d0('0x49')]=_0x451574['id'];_0x1774a0[_0xd3d0('0x41')]['Subjects']=integrations[_0xd3d0('0x4a')](_0x1774a0[_0xd3d0('0x41')][_0xd3d0('0x4b')],_0x1774a0[_0xd3d0('0x41')][_0xd3d0('0x38')]);_0x1774a0['body']['Descriptions']=integrations['getDescriptions'](_0x1774a0[_0xd3d0('0x41')][_0xd3d0('0x4b')],_0x1774a0[_0xd3d0('0x41')]['type']);return db['ZohoConfiguration'][_0xd3d0('0x40')](_0x1774a0[_0xd3d0('0x41')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xd3d0('0x4c')],'as':'Descriptions'}]});}return null;})[_0xd3d0('0x21')](respondWithResult(_0x9fabc1,null))[_0xd3d0('0x3d')](handleError(_0x9fabc1,null));};function getAccessToken(_0x4de71d){return new Promise(function(_0x5b79ed,_0x536870){var _0x521ae3;switch(_0x4de71d[_0xd3d0('0x4d')]){case'US':_0x521ae3='https://accounts.zoho.com';break;case'AU':_0x521ae3=_0xd3d0('0x4e');break;case'EU':_0x521ae3='https://accounts.zoho.eu';break;case'IN':_0x521ae3='https://accounts.zoho.in';break;case'CN':_0x521ae3=_0xd3d0('0x4f');break;default:_0x521ae3=_0xd3d0('0x50');break;}var _0x4b83e2={'method':_0xd3d0('0x51'),'uri':_0x521ae3+_0xd3d0('0x52'),'qs':{'refresh_token':_0x4de71d[_0xd3d0('0x53')],'client_id':_0x4de71d[_0xd3d0('0x54')],'client_secret':_0x4de71d[_0xd3d0('0x55')],'grant_type':_0xd3d0('0x56')},'json':!![]};return rp(_0x4b83e2)[_0xd3d0('0x21')](function(_0x4c1619){if(_0x4c1619[_0xd3d0('0x57')]){_0x5b79ed(_0x4c1619[_0xd3d0('0x57')]);}else{_0x536870(_0xd3d0('0x58'));}})[_0xd3d0('0x3d')](function(_0x15e066){_0x536870(_0x15e066);});});}exports[_0xd3d0('0x59')]=function(_0x115f77,_0x31a4d2,_0xb897c2){var _0x544055,_0x3217ee,_0xe24d0d,_0x478c3,_0x2ac2b0;return db[_0xd3d0('0x27')]['findOne']({'where':{'id':_0x115f77[_0xd3d0('0x3e')]['id']},'attributes':['id',_0xd3d0('0x5a'),'zone',_0xd3d0('0x54'),_0xd3d0('0x55'),_0xd3d0('0x5b'),_0xd3d0('0x5c'),_0xd3d0('0x53')]})[_0xd3d0('0x21')](handleEntityNotFound(_0x31a4d2,null))[_0xd3d0('0x21')](function(_0x59b992){_0x2ac2b0=_0x59b992;_0x544055=_0x2ac2b0[_0xd3d0('0x5a')];_0x3217ee=_0x544055===_0xd3d0('0x5d')?'eu':'com';_0xe24d0d=_0x2ac2b0[_0xd3d0('0x5b')];var _0x5eee35=_0xe24d0d[_0xd3d0('0x5e')](-0x1);if(_0x5eee35==='/'||_0x5eee35==='\x5c'||_0x5eee35===':'){_0xe24d0d=_0xe24d0d[_0xd3d0('0x5f')](0x0,_0xe24d0d['lastIndexOf'](_0x5eee35));}if(!_0x2ac2b0[_0xd3d0('0x53')]){throw new Error(_0xd3d0('0x60'));}return getAccessToken(_0x2ac2b0);})[_0xd3d0('0x21')](function(_0x443eef){if(_0x443eef){return rp({'method':_0xd3d0('0x61'),'uri':util['format'](_0xd3d0('0x62'),_0x3217ee),'qs':{'module':_0xd3d0('0x63')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x443eef},'json':!![]});}})[_0xd3d0('0x21')](function(_0x55c67f){if(_0x55c67f){if(_0x55c67f[_0xd3d0('0x64')]&&_0x55c67f[_0xd3d0('0x64')]['error']){throw new Error(_0x55c67f[_0xd3d0('0x64')][_0xd3d0('0x22')][_0xd3d0('0x65')]);}var _0x4c970e=[];var _0x5a3286=[];var _0x579350=[_0xd3d0('0x66'),_0xd3d0('0x67'),_0xd3d0('0x68'),_0xd3d0('0x69'),_0xd3d0('0x6a'),_0xd3d0('0x6b'),_0xd3d0('0x6c'),_0xd3d0('0x6d')];_0x5a3286=_['remove'](_0x55c67f[_0xd3d0('0x2e')],function(_0x486369){return _0x579350[_0xd3d0('0x6e')](_0x486369[_0xd3d0('0x6f')]);});for(var _0xa02d24=0x0;_0xa02d24<_0x5a3286[_0xd3d0('0x30')];_0xa02d24++){if(_0x5a3286[_0xa02d24][_0xd3d0('0x70')]===![]){_0x4c970e[_0xd3d0('0x71')]({'id':_0x5a3286[_0xa02d24]['id'],'name':_0x5a3286[_0xa02d24][_0xd3d0('0x72')],'custom':_0x5a3286[_0xa02d24]['custom_field'],'options':_0x5a3286[_0xa02d24]['data_type']===_0xd3d0('0x73')&&_0x5a3286[_0xa02d24][_0xd3d0('0x74')][_0xd3d0('0x30')]>-0x1?_[_0xd3d0('0x26')](_0x5a3286[_0xa02d24]['pick_list_values'],function(_0x597eeb){return{'name':_0x597eeb,'value':_0x597eeb};}):[]});}}return{'count':_0x4c970e[_0xd3d0('0x30')],'rows':_0x4c970e};}else{return{'count':0x0,'rows':[]};}})[_0xd3d0('0x21')](respondWithResult(_0x31a4d2,null))['catch'](function(_0x563f08){var _0x5b9b48=_0x115f77[_0xd3d0('0x2b')][_0xd3d0('0x75')]?0x1f4:_0x563f08['statusCode']||0x1f4;logger[_0xd3d0('0x22')](_0xd3d0('0x76'),'getFields',_0x5b9b48,JSON[_0xd3d0('0x77')](_0x563f08));delete _0x563f08[_0xd3d0('0x23')];if(_0x5b9b48===0x191){_0x5b9b48=0x190;}_0x31a4d2['status'](_0x5b9b48)[_0xd3d0('0x24')](_0x115f77[_0xd3d0('0x2b')][_0xd3d0('0x75')]?{'message':_0xd3d0('0x78'),'statusCode':_0x563f08[_0xd3d0('0x79')]}:_0x563f08);});}; \ No newline at end of file +var _0x454d=['mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','apply','reject','update','then','destroy','error','name','send','index','map','ZohoAccount','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','include','findAll','catch','rawAttributes','length','includeAll','merge','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','options','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','serverUrl','code','host','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','picklist','pick_list_values','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1a983d,_0xa72c7b){var _0x58e9a3=function(_0x4b5c45){while(--_0x4b5c45){_0x1a983d['push'](_0x1a983d['shift']());}};_0x58e9a3(++_0xa72c7b);}(_0x454d,0x1e2));var _0xd454=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x454d[_0x175a55];return _0x167adf;};'use strict';var emlformat=require(_0xd454('0x0'));var rimraf=require(_0xd454('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd454('0x2'));var rp=require(_0xd454('0x3'));var moment=require(_0xd454('0x4'));var BPromise=require(_0xd454('0x5'));var Mustache=require(_0xd454('0x6'));var util=require(_0xd454('0x7'));var path=require(_0xd454('0x8'));var sox=require(_0xd454('0x9'));var csv=require(_0xd454('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd454('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd454('0xc'));var deskjs=require(_0xd454('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd454('0xe'));var Papa=require(_0xd454('0xf'));var Redis=require(_0xd454('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd454('0x11'));var as=require(_0xd454('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd454('0x13'));var utils=require(_0xd454('0x14'));var config=require(_0xd454('0x15'));var licenseUtil=require(_0xd454('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x13e85a,_0x28800b){_0x28800b=_0x28800b||0xcc;return function(_0x5d24fa){if(_0x5d24fa){return _0x13e85a[_0xd454('0x17')](_0x28800b);}return _0x13e85a[_0xd454('0x18')](_0x28800b)[_0xd454('0x19')]();};}function respondWithResult(_0x2f2894,_0x151dae){_0x151dae=_0x151dae||0xc8;return function(_0x9467a9){if(_0x9467a9){return _0x2f2894[_0xd454('0x18')](_0x151dae)[_0xd454('0x1a')](_0x9467a9);}};}function respondWithFilteredResult(_0x28c137,_0xb67dcf){return function(_0x386ccd){if(_0x386ccd){var _0x2c7361=typeof _0xb67dcf[_0xd454('0x1b')]==='undefined'&&typeof _0xb67dcf['limit']===_0xd454('0x1c');var _0x5f1562=_0x386ccd[_0xd454('0x1d')];var _0x77bccc=_0x2c7361?0x0:_0xb67dcf[_0xd454('0x1b')];var _0x5a4b9f=_0x2c7361?_0x386ccd['count']:_0xb67dcf['offset']+_0xb67dcf['limit'];var _0x188920;if(_0x5a4b9f>=_0x5f1562){_0x5a4b9f=_0x5f1562;_0x188920=0xc8;}else{_0x188920=0xce;}_0x28c137[_0xd454('0x18')](_0x188920);return _0x28c137['set']('Content-Range',_0x77bccc+'-'+_0x5a4b9f+'/'+_0x5f1562)[_0xd454('0x1a')](_0x386ccd);}return null;};}function patchUpdates(_0x66b0fa){return function(_0x344d21){try{jsonpatch[_0xd454('0x1e')](_0x344d21,_0x66b0fa,!![]);}catch(_0x42e9ed){return BPromise[_0xd454('0x1f')](_0x42e9ed);}return _0x344d21['save']();};}function saveUpdates(_0x4e1876,_0x3005c9){return function(_0x308958){if(_0x308958){return _0x308958[_0xd454('0x20')](_0x4e1876)[_0xd454('0x21')](function(_0x18c31b){return _0x18c31b;});}return null;};}function removeEntity(_0x21442a,_0x2ebc42){return function(_0x5a9f92){if(_0x5a9f92){return _0x5a9f92[_0xd454('0x22')]()['then'](function(){_0x21442a[_0xd454('0x18')](0xcc)[_0xd454('0x19')]();});}};}function handleEntityNotFound(_0x594b6d,_0x182d51){return function(_0x4d98ea){if(!_0x4d98ea){_0x594b6d[_0xd454('0x17')](0x194);}return _0x4d98ea;};}function handleError(_0x459f49,_0x1d4321){_0x1d4321=_0x1d4321||0x1f4;return function(_0x370481){logger[_0xd454('0x23')](_0x370481['stack']);if(_0x370481[_0xd454('0x24')]){delete _0x370481[_0xd454('0x24')];}_0x459f49['status'](_0x1d4321)[_0xd454('0x25')](_0x370481);};}exports[_0xd454('0x26')]=function(_0x25f49c,_0x400d54){var _0x42de0c={},_0x2eb53d={},_0x560ec7={'count':0x0,'rows':[]};var _0x5a5bad=_[_0xd454('0x27')](db[_0xd454('0x28')]['rawAttributes'],function(_0x341d33){return{'name':_0x341d33['fieldName'],'type':_0x341d33[_0xd454('0x29')][_0xd454('0x2a')]};});_0x2eb53d[_0xd454('0x2b')]=_['map'](_0x5a5bad,_0xd454('0x24'));_0x2eb53d['query']=_[_0xd454('0x2c')](_0x25f49c['query']);_0x2eb53d[_0xd454('0x2d')]=_[_0xd454('0x2e')](_0x2eb53d[_0xd454('0x2b')],_0x2eb53d[_0xd454('0x2f')]);_0x42de0c[_0xd454('0x30')]=_[_0xd454('0x2e')](_0x2eb53d['model'],qs[_0xd454('0x31')](_0x25f49c[_0xd454('0x2f')][_0xd454('0x31')]));_0x42de0c[_0xd454('0x30')]=_0x42de0c['attributes']['length']?_0x42de0c[_0xd454('0x30')]:_0x2eb53d['model'];if(!_0x25f49c[_0xd454('0x2f')]['hasOwnProperty'](_0xd454('0x32'))){_0x42de0c['limit']=qs[_0xd454('0x33')](_0x25f49c['query']['limit']);_0x42de0c[_0xd454('0x1b')]=qs['offset'](_0x25f49c[_0xd454('0x2f')]['offset']);}_0x42de0c[_0xd454('0x34')]=qs[_0xd454('0x35')](_0x25f49c['query']['sort']);_0x42de0c[_0xd454('0x36')]=qs[_0xd454('0x2d')](_[_0xd454('0x37')](_0x25f49c[_0xd454('0x2f')],_0x2eb53d[_0xd454('0x2d')]),_0x5a5bad);if(_0x25f49c[_0xd454('0x2f')][_0xd454('0x38')]){_0x42de0c[_0xd454('0x36')]=_['merge'](_0x42de0c[_0xd454('0x36')],{'$or':_[_0xd454('0x27')](_0x5a5bad,function(_0x1b11ef){if(_0x1b11ef[_0xd454('0x29')]!==_0xd454('0x39')){var _0x30380f={};_0x30380f[_0x1b11ef[_0xd454('0x24')]]={'$like':'%'+_0x25f49c[_0xd454('0x2f')][_0xd454('0x38')]+'%'};return _0x30380f;}})});}_0x42de0c=_['merge']({},_0x42de0c,_0x25f49c['options']);var _0xc881b3={'where':_0x42de0c[_0xd454('0x36')]};return db['ZohoAccount']['count'](_0xc881b3)[_0xd454('0x21')](function(_0x3167bd){_0x560ec7['count']=_0x3167bd;if(_0x25f49c[_0xd454('0x2f')]['includeAll']){_0x42de0c[_0xd454('0x3a')]=[{'all':!![]}];}return db[_0xd454('0x28')][_0xd454('0x3b')](_0x42de0c);})[_0xd454('0x21')](function(_0x45b733){_0x560ec7['rows']=_0x45b733;return _0x560ec7;})[_0xd454('0x21')](respondWithFilteredResult(_0x400d54,_0x42de0c))[_0xd454('0x3c')](handleError(_0x400d54,null));};exports['show']=function(_0x5dd5b9,_0x1811c7){var _0x289ab0={'raw':![],'where':{'id':_0x5dd5b9['params']['id']}},_0x2ef11a={};_0x2ef11a[_0xd454('0x2b')]=_[_0xd454('0x2c')](db['ZohoAccount'][_0xd454('0x3d')]);_0x2ef11a['query']=_[_0xd454('0x2c')](_0x5dd5b9['query']);_0x2ef11a['filters']=_['intersection'](_0x2ef11a[_0xd454('0x2b')],_0x2ef11a[_0xd454('0x2f')]);_0x289ab0['attributes']=_[_0xd454('0x2e')](_0x2ef11a[_0xd454('0x2b')],qs[_0xd454('0x31')](_0x5dd5b9[_0xd454('0x2f')][_0xd454('0x31')]));_0x289ab0['attributes']=_0x289ab0[_0xd454('0x30')][_0xd454('0x3e')]?_0x289ab0[_0xd454('0x30')]:_0x2ef11a['model'];if(_0x5dd5b9['query'][_0xd454('0x3f')]){_0x289ab0[_0xd454('0x3a')]=[{'all':!![]}];}_0x289ab0=_[_0xd454('0x40')]({},_0x289ab0,_0x5dd5b9['options']);return db['ZohoAccount'][_0xd454('0x41')](_0x289ab0)[_0xd454('0x21')](handleEntityNotFound(_0x1811c7,null))['then'](respondWithResult(_0x1811c7,null))[_0xd454('0x3c')](handleError(_0x1811c7,null));};exports[_0xd454('0x42')]=function(_0x52e21a,_0x592087){return db[_0xd454('0x28')][_0xd454('0x42')](_0x52e21a['body'],{})['then'](respondWithResult(_0x592087,0xc9))[_0xd454('0x3c')](handleError(_0x592087,null));};exports[_0xd454('0x20')]=function(_0x1154d8,_0x1fac36){if(_0x1154d8[_0xd454('0x43')]['id']){delete _0x1154d8[_0xd454('0x43')]['id'];}return db[_0xd454('0x28')][_0xd454('0x41')]({'where':{'id':_0x1154d8[_0xd454('0x44')]['id']}})['then'](handleEntityNotFound(_0x1fac36,null))[_0xd454('0x21')](saveUpdates(_0x1154d8[_0xd454('0x43')],null))[_0xd454('0x21')](respondWithResult(_0x1fac36,null))[_0xd454('0x3c')](handleError(_0x1fac36,null));};exports['destroy']=function(_0x33cbca,_0x250422){return db[_0xd454('0x28')][_0xd454('0x41')]({'where':{'id':_0x33cbca[_0xd454('0x44')]['id']}})[_0xd454('0x21')](handleEntityNotFound(_0x250422,null))[_0xd454('0x21')](removeEntity(_0x250422,null))[_0xd454('0x3c')](handleError(_0x250422,null));};exports[_0xd454('0x45')]=function(_0x1932b2,_0x1a03d9,_0x346cde){var _0x1ffce1={};var _0x25d851={};var _0x562c88;var _0x17d9c8;return db[_0xd454('0x28')][_0xd454('0x46')]({'where':{'id':_0x1932b2[_0xd454('0x44')]['id']}})[_0xd454('0x21')](handleEntityNotFound(_0x1a03d9,null))[_0xd454('0x21')](function(_0x46d027){if(_0x46d027){_0x562c88=_0x46d027;_0x25d851['model']=_['keys'](db[_0xd454('0x47')][_0xd454('0x3d')]);_0x25d851[_0xd454('0x2f')]=_[_0xd454('0x2c')](_0x1932b2['query']);_0x25d851['filters']=_['intersection'](_0x25d851[_0xd454('0x2b')],_0x25d851['query']);_0x1ffce1['attributes']=_[_0xd454('0x2e')](_0x25d851[_0xd454('0x2b')],qs[_0xd454('0x31')](_0x1932b2[_0xd454('0x2f')][_0xd454('0x31')]));_0x1ffce1['attributes']=_0x1ffce1[_0xd454('0x30')][_0xd454('0x3e')]?_0x1ffce1[_0xd454('0x30')]:_0x25d851[_0xd454('0x2b')];_0x1ffce1[_0xd454('0x34')]=qs[_0xd454('0x35')](_0x1932b2[_0xd454('0x2f')][_0xd454('0x35')]);_0x1ffce1['where']=qs[_0xd454('0x2d')](_['pick'](_0x1932b2[_0xd454('0x2f')],_0x25d851['filters']));if(_0x1932b2[_0xd454('0x2f')][_0xd454('0x38')]){_0x1ffce1[_0xd454('0x36')]=_[_0xd454('0x40')](_0x1ffce1[_0xd454('0x36')],{'$or':_[_0xd454('0x27')](_0x1ffce1[_0xd454('0x30')],function(_0x3d2351){var _0xb7ecd3={};_0xb7ecd3[_0x3d2351]={'$like':'%'+_0x1932b2[_0xd454('0x2f')][_0xd454('0x38')]+'%'};return _0xb7ecd3;})});}_0x1ffce1=_['merge']({},_0x1ffce1,_0x1932b2[_0xd454('0x48')]);return _0x562c88[_0xd454('0x45')](_0x1ffce1);}})[_0xd454('0x21')](function(_0x3e16be){if(_0x3e16be){_0x17d9c8=_0x3e16be[_0xd454('0x3e')];if(!_0x1932b2[_0xd454('0x2f')][_0xd454('0x49')]('nolimit')){_0x1ffce1[_0xd454('0x33')]=qs[_0xd454('0x33')](_0x1932b2[_0xd454('0x2f')][_0xd454('0x33')]);_0x1ffce1[_0xd454('0x1b')]=qs[_0xd454('0x1b')](_0x1932b2[_0xd454('0x2f')][_0xd454('0x1b')]);}return _0x562c88[_0xd454('0x45')](_0x1ffce1);}})[_0xd454('0x21')](function(_0x367196){if(_0x367196){return _0x367196?{'count':_0x17d9c8,'rows':_0x367196}:null;}})[_0xd454('0x21')](respondWithResult(_0x1a03d9,null))[_0xd454('0x3c')](handleError(_0x1a03d9,null));};exports[_0xd454('0x4a')]=function(_0x191c80,_0x1a567d,_0x441a68){if(_0x191c80[_0xd454('0x43')]['id']){delete _0x191c80[_0xd454('0x43')]['id'];}return db[_0xd454('0x28')][_0xd454('0x46')]({'where':{'id':_0x191c80['params']['id']}})[_0xd454('0x21')](handleEntityNotFound(_0x1a567d,null))[_0xd454('0x21')](function(_0x1ba8ee){if(_0x1ba8ee){_0x191c80['body'][_0xd454('0x4b')]=_0x1ba8ee['id'];_0x191c80[_0xd454('0x43')]['Subjects']=integrations['getSubjects'](_0x191c80[_0xd454('0x43')][_0xd454('0x4c')],_0x191c80[_0xd454('0x43')][_0xd454('0x29')]);_0x191c80['body'][_0xd454('0x4d')]=integrations[_0xd454('0x4e')](_0x191c80[_0xd454('0x43')]['channel'],_0x191c80[_0xd454('0x43')][_0xd454('0x29')]);return db[_0xd454('0x47')][_0xd454('0x42')](_0x191c80[_0xd454('0x43')],{'include':[{'model':db[_0xd454('0x4f')],'as':_0xd454('0x50')},{'model':db['ZohoField'],'as':_0xd454('0x4d')}]});}return null;})[_0xd454('0x21')](respondWithResult(_0x1a567d,null))[_0xd454('0x3c')](handleError(_0x1a567d,null));};function getAccessToken(_0x491e73){return new Promise(function(_0x199576,_0x490cee){var _0x307b1e;switch(_0x491e73['zone']){case'US':_0x307b1e=_0xd454('0x51');break;case'AU':_0x307b1e='https://accounts.zoho.com.au';break;case'EU':_0x307b1e=_0xd454('0x52');break;case'IN':_0x307b1e=_0xd454('0x53');break;case'CN':_0x307b1e=_0xd454('0x54');break;default:_0x307b1e=_0xd454('0x52');break;}var _0x513986={'method':_0xd454('0x55'),'uri':_0x307b1e+_0xd454('0x56'),'qs':{'refresh_token':_0x491e73[_0xd454('0x57')],'client_id':_0x491e73[_0xd454('0x58')],'client_secret':_0x491e73[_0xd454('0x59')],'grant_type':_0xd454('0x5a')},'json':!![]};return rp(_0x513986)['then'](function(_0x3ed268){if(_0x3ed268['access_token']){_0x199576(_0x3ed268[_0xd454('0x5b')]);}else{_0x490cee(_0xd454('0x5c'));}})['catch'](function(_0x4eb124){_0x490cee(_0x4eb124);});});}exports['getFields']=function(_0x2008bb,_0x865678,_0x589959){var _0x100c00,_0x239cd5,_0x4317ea,_0x56120e,_0x1f9f3b;return db[_0xd454('0x28')][_0xd454('0x46')]({'where':{'id':_0x2008bb[_0xd454('0x44')]['id']},'attributes':['id','host','zone',_0xd454('0x58'),_0xd454('0x59'),_0xd454('0x5d'),_0xd454('0x5e'),'refreshToken']})[_0xd454('0x21')](handleEntityNotFound(_0x865678,null))[_0xd454('0x21')](function(_0x36d2e5){_0x1f9f3b=_0x36d2e5;_0x100c00=_0x1f9f3b[_0xd454('0x5f')];_0x239cd5=_0x100c00==='zoho.eu'?'eu':_0xd454('0x60');_0x4317ea=_0x1f9f3b[_0xd454('0x5d')];var _0x34fd5e=_0x4317ea[_0xd454('0x61')](-0x1);if(_0x34fd5e==='/'||_0x34fd5e==='\x5c'||_0x34fd5e===':'){_0x4317ea=_0x4317ea[_0xd454('0x62')](0x0,_0x4317ea[_0xd454('0x63')](_0x34fd5e));}if(!_0x1f9f3b['refreshToken']){throw new Error(_0xd454('0x64'));}return getAccessToken(_0x1f9f3b);})[_0xd454('0x21')](function(_0x3e5aac){if(_0x3e5aac){return rp({'method':'GET','uri':util[_0xd454('0x65')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x239cd5),'qs':{'module':_0xd454('0x66')},'headers':{'Authorization':_0xd454('0x67')+_0x3e5aac},'json':!![]});}})[_0xd454('0x21')](function(_0x5e2dd6){if(_0x5e2dd6){if(_0x5e2dd6[_0xd454('0x68')]&&_0x5e2dd6['response'][_0xd454('0x23')]){throw new Error(_0x5e2dd6[_0xd454('0x68')][_0xd454('0x23')]['message']);}var _0x45d567=[];var _0x2ea747=[];var _0x4cecb0=[_0xd454('0x69'),_0xd454('0x6a'),'Description',_0xd454('0x6b'),_0xd454('0x6c'),_0xd454('0x6d'),_0xd454('0x6e'),_0xd454('0x6f')];_0x2ea747=_[_0xd454('0x70')](_0x5e2dd6[_0xd454('0x31')],function(_0x148131){return _0x4cecb0[_0xd454('0x71')](_0x148131[_0xd454('0x72')]);});for(var _0x4ab3de=0x0;_0x4ab3de<_0x2ea747[_0xd454('0x3e')];_0x4ab3de++){if(_0x2ea747[_0x4ab3de][_0xd454('0x73')]===![]){_0x45d567['push']({'id':_0x2ea747[_0x4ab3de]['id'],'name':_0x2ea747[_0x4ab3de]['display_label'],'custom':_0x2ea747[_0x4ab3de]['custom_field'],'options':_0x2ea747[_0x4ab3de]['data_type']===_0xd454('0x74')&&_0x2ea747[_0x4ab3de][_0xd454('0x75')][_0xd454('0x3e')]>-0x1?_[_0xd454('0x27')](_0x2ea747[_0x4ab3de][_0xd454('0x75')],function(_0xfecbec){return{'name':_0xfecbec,'value':_0xfecbec};}):[]});}}return{'count':_0x45d567[_0xd454('0x3e')],'rows':_0x45d567};}else{return{'count':0x0,'rows':[]};}})[_0xd454('0x21')](respondWithResult(_0x865678,null))[_0xd454('0x3c')](function(_0x191af7){var _0x3cdb71=_0x2008bb['query']['test']?0x1f4:_0x191af7['statusCode']||0x1f4;logger[_0xd454('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xd454('0x76'),_0x3cdb71,JSON[_0xd454('0x77')](_0x191af7));delete _0x191af7[_0xd454('0x24')];if(_0x3cdb71===0x191){_0x3cdb71=0x190;}_0x865678['status'](_0x3cdb71)[_0xd454('0x25')](_0x2008bb['query'][_0xd454('0x78')]?{'message':_0xd454('0x79'),'statusCode':_0x191af7['statusCode']}:_0x191af7);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index b1d9de6..2074c7f 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 _0x6efc=['then','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','substring','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','info','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','clientSecret','code','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','/oauth/v2/token','clientId','serverUrl','application/x-www-form-urlencoded'];(function(_0x21253b,_0x2dab16){var _0x1302f9=function(_0x339722){while(--_0x339722){_0x21253b['push'](_0x21253b['shift']());}};_0x1302f9(++_0x2dab16);}(_0x6efc,0x14c));var _0xc6ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6efc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xc6ef('0x0'));var logger=require(_0xc6ef('0x1'))(_0xc6ef('0x2'));var moment=require(_0xc6ef('0x3'));var BPromise=require(_0xc6ef('0x4'));var rp=require(_0xc6ef('0x5'));var fs=require('fs');var path=require(_0xc6ef('0x6'));var rimraf=require(_0xc6ef('0x7'));var config=require(_0xc6ef('0x8'));var attributes=require(_0xc6ef('0x9'));var integrations=require(_0xc6ef('0xa'));module[_0xc6ef('0xb')]=function(_0x21ea7b,_0x5181dd){return _0x21ea7b[_0xc6ef('0xc')](_0xc6ef('0xd'),attributes,{'tableName':_0xc6ef('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x7e8f8e,_0x38ed47,_0x210cdc){if(_0x7e8f8e['changed'](_0xc6ef('0xf'))||_0x7e8f8e[_0xc6ef('0x10')]('serverUrl')||_0x7e8f8e[_0xc6ef('0x10')]('clientId')||_0x7e8f8e[_0xc6ef('0x10')](_0xc6ef('0x11'))||_0x7e8f8e[_0xc6ef('0x10')](_0xc6ef('0x12'))||_0x7e8f8e[_0xc6ef('0x10')]('host')){var _0x5968a4,_0x191a6d;_0x5968a4=_0x7e8f8e['serverUrl'];var _0x16f6cb=_0x5968a4[_0xc6ef('0x13')](-0x1);if(_0x16f6cb==='/'||_0x16f6cb==='\x5c'||_0x16f6cb===':'){_0x5968a4=_0x5968a4['substring'](0x0,_0x5968a4[_0xc6ef('0x14')](_0x16f6cb));}switch(_0x7e8f8e[_0xc6ef('0xf')]){case'US':_0x191a6d=_0xc6ef('0x15');break;case'AU':_0x191a6d=_0xc6ef('0x16');break;case'IN':_0x191a6d=_0xc6ef('0x17');break;case'CN':_0x191a6d='https://accounts.zoho.com.cn';break;default:_0x191a6d='https://accounts.zoho.eu';break;}var _0x3c5b13={'method':'POST','uri':_0x191a6d+_0xc6ef('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x7e8f8e[_0xc6ef('0x19')],'client_secret':_0x7e8f8e[_0xc6ef('0x11')],'redirect_uri':_0x7e8f8e[_0xc6ef('0x1a')],'code':_0x7e8f8e['code']},'headers':{'Content-Type':_0xc6ef('0x1b')}};return rp(_0x3c5b13)[_0xc6ef('0x1c')](function(_0x505235){var _0x4b0970=JSON[_0xc6ef('0x1d')](_0x505235);if(_0x4b0970[_0xc6ef('0x1e')]){_0x7e8f8e[_0xc6ef('0x1f')]=_0x4b0970[_0xc6ef('0x1e')];logger['info'](util[_0xc6ef('0x20')](_0xc6ef('0x21'),_0x7e8f8e[_0xc6ef('0x22')],_0x7e8f8e['id']));}else{logger[_0xc6ef('0x23')](util[_0xc6ef('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x7e8f8e['name'],_0x7e8f8e['id']),util[_0xc6ef('0x24')](_0x4b0970,{'showHidden':![],'depth':null}));}return _0x210cdc(null,_0x38ed47);})[_0xc6ef('0x25')](function(_0x3cdc28){logger[_0xc6ef('0x23')](util[_0xc6ef('0x20')](_0xc6ef('0x26'),_0x7e8f8e[_0xc6ef('0x22')],_0x7e8f8e['id']),util[_0xc6ef('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x210cdc(_0x3cdc28);});}else{return _0x210cdc(null,_0x38ed47);}},'beforeUpdate':function(_0x70b158,_0x572969,_0x399780){if(_0x70b158[_0xc6ef('0x10')]('zone')||_0x70b158[_0xc6ef('0x10')](_0xc6ef('0x1a'))||_0x70b158['changed'](_0xc6ef('0x19'))||_0x70b158['changed']('clientSecret')||_0x70b158[_0xc6ef('0x10')](_0xc6ef('0x12'))||_0x70b158['changed'](_0xc6ef('0x27'))){var _0x529d9b,_0x34b145;_0x529d9b=_0x70b158[_0xc6ef('0x1a')];var _0x2f6f80=_0x529d9b[_0xc6ef('0x13')](-0x1);if(_0x2f6f80==='/'||_0x2f6f80==='\x5c'||_0x2f6f80===':'){_0x529d9b=_0x529d9b[_0xc6ef('0x28')](0x0,_0x529d9b[_0xc6ef('0x14')](_0x2f6f80));}switch(_0x70b158[_0xc6ef('0xf')]){case'US':_0x34b145=_0xc6ef('0x15');break;case'AU':_0x34b145=_0xc6ef('0x16');break;case'IN':_0x34b145=_0xc6ef('0x17');break;case'CN':_0x34b145=_0xc6ef('0x29');break;default:_0x34b145=_0xc6ef('0x2a');break;}var _0x45b9cc={'method':_0xc6ef('0x2b'),'uri':_0x34b145+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x70b158[_0xc6ef('0x19')],'client_secret':_0x70b158[_0xc6ef('0x11')],'redirect_uri':_0x70b158[_0xc6ef('0x1a')],'code':_0x70b158[_0xc6ef('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x45b9cc)[_0xc6ef('0x1c')](function(_0x28ccef){var _0x4af188=JSON[_0xc6ef('0x1d')](_0x28ccef);if(_0x4af188[_0xc6ef('0x1e')]){_0x70b158['refreshToken']=_0x4af188[_0xc6ef('0x1e')];logger[_0xc6ef('0x2c')](util[_0xc6ef('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x70b158[_0xc6ef('0x22')],_0x70b158['id']));}else{logger[_0xc6ef('0x23')](util[_0xc6ef('0x20')](_0xc6ef('0x26'),_0x70b158[_0xc6ef('0x22')],_0x70b158['id']),util[_0xc6ef('0x24')](_0x4af188,{'showHidden':![],'depth':null}));}return _0x399780(null,_0x572969);})['catch'](function(_0x54c81f){logger['error'](util[_0xc6ef('0x20')](_0xc6ef('0x26'),_0x70b158[_0xc6ef('0x22')],_0x70b158['id']),util[_0xc6ef('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x399780(_0x54c81f);});}else{return _0x399780(null,_0x572969);}}}});}; \ No newline at end of file +var _0xf988=['inspect','slice','substring','https://accounts.zoho.com','POST','parse','catch','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','host','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientSecret','code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','error'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0xf988,0x193));var _0x8f98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf988[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8f98('0x0'));var util=require(_0x8f98('0x1'));var logger=require('../../config/logger')(_0x8f98('0x2'));var moment=require(_0x8f98('0x3'));var BPromise=require(_0x8f98('0x4'));var rp=require(_0x8f98('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f98('0x6'));var config=require(_0x8f98('0x7'));var attributes=require(_0x8f98('0x8'));var integrations=require(_0x8f98('0x9'));module[_0x8f98('0xa')]=function(_0x4a3706,_0x99fcfa){return _0x4a3706[_0x8f98('0xb')]('ZohoAccount',attributes,{'tableName':_0x8f98('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1f64c7,_0x34bc97,_0x3cc858){if(_0x1f64c7[_0x8f98('0xd')](_0x8f98('0xe'))||_0x1f64c7['changed'](_0x8f98('0xf'))||_0x1f64c7['changed'](_0x8f98('0x10'))||_0x1f64c7[_0x8f98('0xd')]('clientSecret')||_0x1f64c7[_0x8f98('0xd')]('code')||_0x1f64c7[_0x8f98('0xd')](_0x8f98('0x11'))){var _0x2e1534,_0x4ff150;_0x2e1534=_0x1f64c7[_0x8f98('0xf')];var _0x34eb78=_0x2e1534['slice'](-0x1);if(_0x34eb78==='/'||_0x34eb78==='\x5c'||_0x34eb78===':'){_0x2e1534=_0x2e1534['substring'](0x0,_0x2e1534[_0x8f98('0x12')](_0x34eb78));}switch(_0x1f64c7[_0x8f98('0xe')]){case'US':_0x4ff150='https://accounts.zoho.com';break;case'AU':_0x4ff150=_0x8f98('0x13');break;case'IN':_0x4ff150=_0x8f98('0x14');break;case'CN':_0x4ff150=_0x8f98('0x15');break;default:_0x4ff150=_0x8f98('0x16');break;}var _0x2d619a={'method':'POST','uri':_0x4ff150+_0x8f98('0x17'),'form':{'grant_type':_0x8f98('0x18'),'client_id':_0x1f64c7[_0x8f98('0x10')],'client_secret':_0x1f64c7[_0x8f98('0x19')],'redirect_uri':_0x1f64c7['serverUrl'],'code':_0x1f64c7[_0x8f98('0x1a')]},'headers':{'Content-Type':_0x8f98('0x1b')}};return rp(_0x2d619a)[_0x8f98('0x1c')](function(_0xe23a90){var _0x1d7cd6=JSON['parse'](_0xe23a90);if(_0x1d7cd6[_0x8f98('0x1d')]){_0x1f64c7[_0x8f98('0x1e')]=_0x1d7cd6['refresh_token'];logger[_0x8f98('0x1f')](util[_0x8f98('0x20')](_0x8f98('0x21'),_0x1f64c7[_0x8f98('0x22')],_0x1f64c7['id']));}else{logger['error'](util[_0x8f98('0x20')](_0x8f98('0x23'),_0x1f64c7[_0x8f98('0x22')],_0x1f64c7['id']),util['inspect'](_0x1d7cd6,{'showHidden':![],'depth':null}));}return _0x3cc858(null,_0x34bc97);})['catch'](function(_0x332364){logger[_0x8f98('0x24')](util['format'](_0x8f98('0x23'),_0x1f64c7[_0x8f98('0x22')],_0x1f64c7['id']),util[_0x8f98('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3cc858(_0x332364);});}else{return _0x3cc858(null,_0x34bc97);}},'beforeUpdate':function(_0x4a8b51,_0x8ecc94,_0x4fc370){if(_0x4a8b51[_0x8f98('0xd')]('zone')||_0x4a8b51[_0x8f98('0xd')](_0x8f98('0xf'))||_0x4a8b51[_0x8f98('0xd')]('clientId')||_0x4a8b51[_0x8f98('0xd')](_0x8f98('0x19'))||_0x4a8b51[_0x8f98('0xd')]('code')||_0x4a8b51['changed'](_0x8f98('0x11'))){var _0x37b071,_0x542eaa;_0x37b071=_0x4a8b51[_0x8f98('0xf')];var _0x265cd9=_0x37b071[_0x8f98('0x26')](-0x1);if(_0x265cd9==='/'||_0x265cd9==='\x5c'||_0x265cd9===':'){_0x37b071=_0x37b071[_0x8f98('0x27')](0x0,_0x37b071[_0x8f98('0x12')](_0x265cd9));}switch(_0x4a8b51['zone']){case'US':_0x542eaa=_0x8f98('0x28');break;case'AU':_0x542eaa='https://accounts.zoho.com.au';break;case'IN':_0x542eaa=_0x8f98('0x14');break;case'CN':_0x542eaa=_0x8f98('0x15');break;default:_0x542eaa=_0x8f98('0x16');break;}var _0x42c00d={'method':_0x8f98('0x29'),'uri':_0x542eaa+'/oauth/v2/token','form':{'grant_type':_0x8f98('0x18'),'client_id':_0x4a8b51[_0x8f98('0x10')],'client_secret':_0x4a8b51[_0x8f98('0x19')],'redirect_uri':_0x4a8b51['serverUrl'],'code':_0x4a8b51['code']},'headers':{'Content-Type':_0x8f98('0x1b')}};return rp(_0x42c00d)[_0x8f98('0x1c')](function(_0x1c961a){var _0x3f07ee=JSON[_0x8f98('0x2a')](_0x1c961a);if(_0x3f07ee['refresh_token']){_0x4a8b51[_0x8f98('0x1e')]=_0x3f07ee[_0x8f98('0x1d')];logger[_0x8f98('0x1f')](util[_0x8f98('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4a8b51[_0x8f98('0x22')],_0x4a8b51['id']));}else{logger[_0x8f98('0x24')](util[_0x8f98('0x20')](_0x8f98('0x23'),_0x4a8b51[_0x8f98('0x22')],_0x4a8b51['id']),util[_0x8f98('0x25')](_0x3f07ee,{'showHidden':![],'depth':null}));}return _0x4fc370(null,_0x8ecc94);})[_0x8f98('0x2b')](function(_0xeae1d9){logger[_0x8f98('0x24')](util['format'](_0x8f98('0x23'),_0x4a8b51[_0x8f98('0x22')],_0x4a8b51['id']),util[_0x8f98('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x4fc370(_0xeae1d9);});}else{return _0x4fc370(null,_0x8ecc94);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index f8a5293..be78d20 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 _0x505d=['limit','include','map','model','then','GetZohoAccount','debug','ShowZohoAccount','find','raw','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount,\x20%s,\x20%s','catch','ZohoAccount','findAll','options','attributes'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x505d,0x93));var _0xd505=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x505d[_0x11ca63];return _0x41f1f6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd505('0x0'));var BPromise=require(_0xd505('0x1'));var rs=require(_0xd505('0x2'));var fs=require('fs');var Redis=require(_0xd505('0x3'));var db=require(_0xd505('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd505('0x5'))(_0xd505('0x6'));var config=require(_0xd505('0x7'));var jayson=require(_0xd505('0x8'));var client=jayson['client'][_0xd505('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d4f8d,_0x2bc4e7,_0x162ee2){return new BPromise(function(_0x543c42,_0x2abf26){return client[_0xd505('0xa')](_0x5d4f8d,_0x162ee2)['then'](function(_0x47b37a){logger[_0xd505('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x2bc4e7,_0xd505('0xc'));logger['debug'](_0xd505('0xd'),_0x2bc4e7,'request\x20sent',JSON[_0xd505('0xe')](_0x47b37a));if(_0x47b37a['error']){if(_0x47b37a['error']['code']===0x1f4){logger[_0xd505('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x2abf26(_0x47b37a['error']['message']);}logger[_0xd505('0xf')](_0xd505('0x11'),_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x543c42(_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);}else{logger[_0xd505('0xb')](_0xd505('0x11'),_0x2bc4e7,_0xd505('0xc'));_0x543c42(_0x47b37a['result'][_0xd505('0x10')]);}})[_0xd505('0x12')](function(_0x8013f2){logger['error'](_0xd505('0x11'),_0x2bc4e7,_0x8013f2);_0x2abf26(_0x8013f2);});});}exports['GetZohoAccount']=function(_0x561c71){var _0x3b03cb=this;return new Promise(function(_0x52401f,_0x33f5f4){return db[_0xd505('0x13')][_0xd505('0x14')]({'raw':_0x561c71[_0xd505('0x15')]?_0x561c71[_0xd505('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x561c71[_0xd505('0x15')]?_0x561c71[_0xd505('0x15')]['where']||null:null,'attributes':_0x561c71['options']?_0x561c71['options'][_0xd505('0x16')]||null:null,'limit':_0x561c71[_0xd505('0x15')]?_0x561c71['options'][_0xd505('0x17')]||null:null,'include':_0x561c71['options']?_0x561c71['options'][_0xd505('0x18')]?_[_0xd505('0x19')](_0x561c71['options'][_0xd505('0x18')],function(_0x50ebfa){return{'model':db[_0x50ebfa['model']],'as':_0x50ebfa['as'],'attributes':_0x50ebfa[_0xd505('0x16')],'include':_0x50ebfa[_0xd505('0x18')]?_[_0xd505('0x19')](_0x50ebfa['include'],function(_0x4f1839){return{'model':db[_0x4f1839[_0xd505('0x1a')]],'as':_0x4f1839['as'],'attributes':_0x4f1839['attributes'],'include':_0x4f1839['include']?_[_0xd505('0x19')](_0x4f1839[_0xd505('0x18')],function(_0xeb2af1){return{'model':db[_0xeb2af1[_0xd505('0x1a')]],'as':_0xeb2af1['as'],'attributes':_0xeb2af1[_0xd505('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd505('0x1b')](function(_0x3c01f0){logger['info'](_0xd505('0x1c'),_0x561c71);logger[_0xd505('0x1d')](_0xd505('0x1c'),_0x561c71,JSON[_0xd505('0xe')](_0x3c01f0));_0x52401f(_0x3c01f0);})['catch'](function(_0x2d8d67){logger[_0xd505('0xf')]('GetZohoAccount',_0x2d8d67['message'],_0x561c71);_0x33f5f4(_0x3b03cb['error'](0x1f4,_0x2d8d67[_0xd505('0x10')]));});});};exports[_0xd505('0x1e')]=function(_0x2425c0){var _0x4e5c2e=this;return new Promise(function(_0x548934,_0x4fb8fa){return db[_0xd505('0x13')][_0xd505('0x1f')]({'raw':_0x2425c0[_0xd505('0x15')]?_0x2425c0['options'][_0xd505('0x20')]===undefined?!![]:![]:!![],'where':_0x2425c0[_0xd505('0x15')]?_0x2425c0['options'][_0xd505('0x21')]||null:null,'attributes':_0x2425c0[_0xd505('0x15')]?_0x2425c0[_0xd505('0x15')][_0xd505('0x16')]||null:null,'include':_0x2425c0['options']?_0x2425c0['options'][_0xd505('0x18')]?_[_0xd505('0x19')](_0x2425c0[_0xd505('0x15')][_0xd505('0x18')],function(_0x2d8abd){return{'model':db[_0x2d8abd[_0xd505('0x1a')]],'as':_0x2d8abd['as'],'attributes':_0x2d8abd['attributes'],'include':_0x2d8abd[_0xd505('0x18')]?_['map'](_0x2d8abd[_0xd505('0x18')],function(_0x592898){return{'model':db[_0x592898[_0xd505('0x1a')]],'as':_0x592898['as'],'attributes':_0x592898[_0xd505('0x16')],'include':_0x592898[_0xd505('0x18')]?_[_0xd505('0x19')](_0x592898[_0xd505('0x18')],function(_0x81120b){return{'model':db[_0x81120b[_0xd505('0x1a')]],'as':_0x81120b['as'],'attributes':_0x81120b[_0xd505('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b53b2){logger[_0xd505('0xb')](_0xd505('0x1e'),_0x2425c0);logger[_0xd505('0x1d')]('ShowZohoAccount',_0x2425c0,JSON[_0xd505('0xe')](_0x4b53b2));_0x548934(_0x4b53b2);})[_0xd505('0x12')](function(_0x290f53){logger[_0xd505('0xf')](_0xd505('0x1e'),_0x290f53[_0xd505('0x10')],_0x2425c0);_0x4fb8fa(_0x4e5c2e[_0xd505('0xf')](0x1f4,_0x290f53[_0xd505('0x10')]));});});}; \ No newline at end of file +var _0x2eba=['where','attributes','limit','map','include','model','ShowZohoAccount','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2eba,0xc7));var _0xa2eb=function(_0x46ff12,_0x1797a1){_0x46ff12=_0x46ff12-0x0;var _0x1d13d0=_0x2eba[_0x46ff12];return _0x1d13d0;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var moment=require(_0xa2eb('0x1'));var BPromise=require(_0xa2eb('0x2'));var rs=require(_0xa2eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa2eb('0x4'));var logger=require('../../config/logger')(_0xa2eb('0x5'));var config=require(_0xa2eb('0x6'));var jayson=require(_0xa2eb('0x7'));var client=jayson[_0xa2eb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545db3,_0x56b33a,_0x4ed534){return new BPromise(function(_0x550a3c,_0x56408f){return client[_0xa2eb('0x9')](_0x545db3,_0x4ed534)[_0xa2eb('0xa')](function(_0x5480a1){logger['info'](_0xa2eb('0xb'),_0x56b33a,_0xa2eb('0xc'));logger[_0xa2eb('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x56b33a,_0xa2eb('0xc'),JSON[_0xa2eb('0xe')](_0x5480a1));if(_0x5480a1['error']){if(_0x5480a1[_0xa2eb('0xf')]['code']===0x1f4){logger[_0xa2eb('0xf')](_0xa2eb('0xb'),_0x56b33a,_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);return _0x56408f(_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);}logger['error'](_0xa2eb('0xb'),_0x56b33a,_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);return _0x550a3c(_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);}else{logger[_0xa2eb('0x11')](_0xa2eb('0xb'),_0x56b33a,_0xa2eb('0xc'));_0x550a3c(_0x5480a1[_0xa2eb('0x12')][_0xa2eb('0x10')]);}})[_0xa2eb('0x13')](function(_0x3a02d5){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x56b33a,_0x3a02d5);_0x56408f(_0x3a02d5);});});}exports[_0xa2eb('0x14')]=function(_0xa74836){var _0x18ce2e=this;return new Promise(function(_0xe1c088,_0x273da2){return db[_0xa2eb('0x15')][_0xa2eb('0x16')]({'raw':_0xa74836['options']?_0xa74836[_0xa2eb('0x17')][_0xa2eb('0x18')]===undefined?!![]:![]:!![],'where':_0xa74836[_0xa2eb('0x17')]?_0xa74836[_0xa2eb('0x17')][_0xa2eb('0x19')]||null:null,'attributes':_0xa74836['options']?_0xa74836['options'][_0xa2eb('0x1a')]||null:null,'limit':_0xa74836[_0xa2eb('0x17')]?_0xa74836['options'][_0xa2eb('0x1b')]||null:null,'include':_0xa74836[_0xa2eb('0x17')]?_0xa74836['options']['include']?_[_0xa2eb('0x1c')](_0xa74836[_0xa2eb('0x17')][_0xa2eb('0x1d')],function(_0x1a95f6){return{'model':db[_0x1a95f6[_0xa2eb('0x1e')]],'as':_0x1a95f6['as'],'attributes':_0x1a95f6['attributes'],'include':_0x1a95f6[_0xa2eb('0x1d')]?_[_0xa2eb('0x1c')](_0x1a95f6[_0xa2eb('0x1d')],function(_0x15ca14){return{'model':db[_0x15ca14[_0xa2eb('0x1e')]],'as':_0x15ca14['as'],'attributes':_0x15ca14[_0xa2eb('0x1a')],'include':_0x15ca14['include']?_[_0xa2eb('0x1c')](_0x15ca14['include'],function(_0x16ef8c){return{'model':db[_0x16ef8c[_0xa2eb('0x1e')]],'as':_0x16ef8c['as'],'attributes':_0x16ef8c[_0xa2eb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa2eb('0xa')](function(_0x1890ce){logger['info'](_0xa2eb('0x14'),_0xa74836);logger[_0xa2eb('0xd')](_0xa2eb('0x14'),_0xa74836,JSON[_0xa2eb('0xe')](_0x1890ce));_0xe1c088(_0x1890ce);})[_0xa2eb('0x13')](function(_0x245658){logger[_0xa2eb('0xf')]('GetZohoAccount',_0x245658['message'],_0xa74836);_0x273da2(_0x18ce2e['error'](0x1f4,_0x245658[_0xa2eb('0x10')]));});});};exports[_0xa2eb('0x1f')]=function(_0x51b1e7){var _0x2a28b7=this;return new Promise(function(_0x353b28,_0x56ddc4){return db[_0xa2eb('0x15')]['find']({'raw':_0x51b1e7['options']?_0x51b1e7[_0xa2eb('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x51b1e7[_0xa2eb('0x17')]?_0x51b1e7['options']['where']||null:null,'attributes':_0x51b1e7[_0xa2eb('0x17')]?_0x51b1e7[_0xa2eb('0x17')][_0xa2eb('0x1a')]||null:null,'include':_0x51b1e7[_0xa2eb('0x17')]?_0x51b1e7[_0xa2eb('0x17')][_0xa2eb('0x1d')]?_[_0xa2eb('0x1c')](_0x51b1e7[_0xa2eb('0x17')][_0xa2eb('0x1d')],function(_0x563b17){return{'model':db[_0x563b17[_0xa2eb('0x1e')]],'as':_0x563b17['as'],'attributes':_0x563b17[_0xa2eb('0x1a')],'include':_0x563b17[_0xa2eb('0x1d')]?_[_0xa2eb('0x1c')](_0x563b17[_0xa2eb('0x1d')],function(_0x1d2686){return{'model':db[_0x1d2686[_0xa2eb('0x1e')]],'as':_0x1d2686['as'],'attributes':_0x1d2686[_0xa2eb('0x1a')],'include':_0x1d2686[_0xa2eb('0x1d')]?_['map'](_0x1d2686[_0xa2eb('0x1d')],function(_0x29179f){return{'model':db[_0x29179f['model']],'as':_0x29179f['as'],'attributes':_0x29179f[_0xa2eb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa2eb('0xa')](function(_0x1f87e7){logger[_0xa2eb('0x11')]('ShowZohoAccount',_0x51b1e7);logger[_0xa2eb('0xd')](_0xa2eb('0x1f'),_0x51b1e7,JSON[_0xa2eb('0xe')](_0x1f87e7));_0x353b28(_0x1f87e7);})[_0xa2eb('0x13')](function(_0x322c1b){logger[_0xa2eb('0xf')](_0xa2eb('0x1f'),_0x322c1b[_0xa2eb('0x10')],_0x51b1e7);_0x56ddc4(_0x2a28b7[_0xa2eb('0xf')](0x1f4,_0x322c1b[_0xa2eb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 111e80d..dc66b8c 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 _0xe670=['/:id/descriptions','getDescriptions','post','update','delete','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/fields','getFields','/:id/subjects','getSubjects'];(function(_0x414e48,_0x272c86){var _0x120139=function(_0x33ace1){while(--_0x33ace1){_0x414e48['push'](_0x414e48['shift']());}};_0x120139(++_0x272c86);}(_0xe670,0x1c1));var _0x0e67=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xe670[_0x710815];return _0x5b3b89;};'use strict';var multer=require(_0x0e67('0x0'));var util=require(_0x0e67('0x1'));var path=require(_0x0e67('0x2'));var timeout=require(_0x0e67('0x3'));var express=require(_0x0e67('0x4'));var router=express[_0x0e67('0x5')]();var fs_extra=require(_0x0e67('0x6'));var auth=require(_0x0e67('0x7'));var interaction=require(_0x0e67('0x8'));var config=require(_0x0e67('0x9'));var controller=require('./intZohoConfiguration.controller');router[_0x0e67('0xa')]('/',auth[_0x0e67('0xb')](),controller[_0x0e67('0xc')]);router[_0x0e67('0xa')](_0x0e67('0xd'),auth[_0x0e67('0xb')](),controller[_0x0e67('0xe')]);router[_0x0e67('0xa')](_0x0e67('0xf'),auth['isAuthenticated'](),controller[_0x0e67('0x10')]);router[_0x0e67('0xa')](_0x0e67('0x11'),auth[_0x0e67('0xb')](),controller[_0x0e67('0x12')]);router[_0x0e67('0xa')](_0x0e67('0x13'),auth[_0x0e67('0xb')](),controller[_0x0e67('0x14')]);router[_0x0e67('0x15')]('/',auth[_0x0e67('0xb')](),controller['create']);router['put']('/:id',auth[_0x0e67('0xb')](),controller[_0x0e67('0x16')]);router[_0x0e67('0x17')]('/:id',auth[_0x0e67('0xb')](),controller[_0x0e67('0x18')]);module[_0x0e67('0x19')]=router; \ No newline at end of file +var _0xf026=['../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5b7662,_0x5d4c1c){var _0x2d3f4e=function(_0x50a393){while(--_0x50a393){_0x5b7662['push'](_0x5b7662['shift']());}};_0x2d3f4e(++_0x5d4c1c);}(_0xf026,0xc1));var _0x6f02=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0xf026[_0x6e1239];return _0x418150;};'use strict';var multer=require(_0x6f02('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6f02('0x1'));var express=require('express');var router=express[_0x6f02('0x2')]();var fs_extra=require(_0x6f02('0x3'));var auth=require(_0x6f02('0x4'));var interaction=require(_0x6f02('0x5'));var config=require(_0x6f02('0x6'));var controller=require(_0x6f02('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6f02('0x8')](_0x6f02('0x9'),auth[_0x6f02('0xa')](),controller[_0x6f02('0xb')]);router['get'](_0x6f02('0xc'),auth[_0x6f02('0xa')](),controller['getFields']);router[_0x6f02('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x6f02('0xd')]);router[_0x6f02('0x8')](_0x6f02('0xe'),auth[_0x6f02('0xa')](),controller[_0x6f02('0xf')]);router[_0x6f02('0x10')]('/',auth['isAuthenticated'](),controller[_0x6f02('0x11')]);router[_0x6f02('0x12')](_0x6f02('0x9'),auth[_0x6f02('0xa')](),controller[_0x6f02('0x13')]);router[_0x6f02('0x14')](_0x6f02('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x6f02('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index aff504a..3e66613 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 _0x1217=['contact','lead','contact_lead','sequelize','exports','ENUM'];(function(_0x16be20,_0x3f7898){var _0x38f195=function(_0x2bdad1){while(--_0x2bdad1){_0x16be20['push'](_0x16be20['shift']());}};_0x38f195(++_0x3f7898);}(_0x1217,0xb1));var _0x7121=function(_0x46fa6a,_0x51681c){_0x46fa6a=_0x46fa6a-0x0;var _0x7bd379=_0x1217[_0x46fa6a];return _0x7bd379;};'use strict';var Sequelize=require(_0x7121('0x0'));module[_0x7121('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x7121('0x2')]('lead',_0x7121('0x3'),'nothing'),'defaultValue':_0x7121('0x4')},'moduleSearch':{'type':Sequelize[_0x7121('0x2')](_0x7121('0x5'),_0x7121('0x3'),_0x7121('0x4')),'defaultValue':_0x7121('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9579=['sequelize','STRING','ENUM','contact','lead','contact_lead'];(function(_0x187959,_0x5e56bd){var _0x29cef4=function(_0x55abfa){while(--_0x55abfa){_0x187959['push'](_0x187959['shift']());}};_0x29cef4(++_0x5e56bd);}(_0x9579,0x16e));var _0x9957=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9579[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x9957('0x0'));module['exports']={'name':{'type':Sequelize[_0x9957('0x1')]},'moduleCreate':{'type':Sequelize[_0x9957('0x2')]('lead',_0x9957('0x3'),'nothing'),'defaultValue':_0x9957('0x4')},'moduleSearch':{'type':Sequelize[_0x9957('0x2')](_0x9957('0x5'),_0x9957('0x3'),_0x9957('0x4')),'defaultValue':_0x9957('0x5')},'description':{'type':Sequelize[_0x9957('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index ebca61b..fa10e77 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 _0x993a=['keys','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','limit','offset','count','status','Content-Range','reject','save','update','then','destroy','error','stack','name','index','ZohoConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','map','filter','options','where','includeAll','findAll','rows','catch','show','params','length','include','merge','create','body','find','getFields','findOne'];(function(_0x57b971,_0x5e5d73){var _0xdbb32e=function(_0x55c16d){while(--_0x55c16d){_0x57b971['push'](_0x57b971['shift']());}};_0xdbb32e(++_0x5e5d73);}(_0x993a,0x18f));var _0xa993=function(_0x1bc2ce,_0x422e96){_0x1bc2ce=_0x1bc2ce-0x0;var _0xd8aadb=_0x993a[_0x1bc2ce];return _0xd8aadb;};'use strict';var emlformat=require(_0xa993('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa993('0x1'));var jsonpatch=require(_0xa993('0x2'));var rp=require(_0xa993('0x3'));var moment=require(_0xa993('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa993('0x5'));var util=require(_0xa993('0x6'));var path=require(_0xa993('0x7'));var sox=require(_0xa993('0x8'));var csv=require(_0xa993('0x9'));var ejs=require(_0xa993('0xa'));var fs=require('fs');var fs_extra=require(_0xa993('0xb'));var _=require(_0xa993('0xc'));var squel=require(_0xa993('0xd'));var crypto=require('crypto');var jsforce=require(_0xa993('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa993('0xf'));var Papa=require(_0xa993('0x10'));var Redis=require(_0xa993('0x11'));var authService=require(_0xa993('0x12'));var qs=require(_0xa993('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa993('0x14'));var logger=require('../../config/logger')(_0xa993('0x15'));var utils=require(_0xa993('0x16'));var config=require(_0xa993('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa993('0x18'))['db'];function respondWithStatusCode(_0x1a0c11,_0x3d0bd4){_0x3d0bd4=_0x3d0bd4||0xcc;return function(_0x73fc80){if(_0x73fc80){return _0x1a0c11[_0xa993('0x19')](_0x3d0bd4);}return _0x1a0c11['status'](_0x3d0bd4)[_0xa993('0x1a')]();};}function respondWithResult(_0x404217,_0x3c4016){_0x3c4016=_0x3c4016||0xc8;return function(_0x54a628){if(_0x54a628){return _0x404217['status'](_0x3c4016)[_0xa993('0x1b')](_0x54a628);}};}function respondWithFilteredResult(_0x2f94e5,_0x57ecf9){return function(_0x5a96af){if(_0x5a96af){var _0x15ed36=typeof _0x57ecf9['offset']==='undefined'&&typeof _0x57ecf9[_0xa993('0x1c')]==='undefined';var _0x4ab2b8=_0x5a96af['count'];var _0x2b5bb6=_0x15ed36?0x0:_0x57ecf9[_0xa993('0x1d')];var _0x38858b=_0x15ed36?_0x5a96af[_0xa993('0x1e')]:_0x57ecf9[_0xa993('0x1d')]+_0x57ecf9[_0xa993('0x1c')];var _0x5c2569;if(_0x38858b>=_0x4ab2b8){_0x38858b=_0x4ab2b8;_0x5c2569=0xc8;}else{_0x5c2569=0xce;}_0x2f94e5[_0xa993('0x1f')](_0x5c2569);return _0x2f94e5['set'](_0xa993('0x20'),_0x2b5bb6+'-'+_0x38858b+'/'+_0x4ab2b8)[_0xa993('0x1b')](_0x5a96af);}return null;};}function patchUpdates(_0x283dd4){return function(_0x2c8989){try{jsonpatch['apply'](_0x2c8989,_0x283dd4,!![]);}catch(_0x16a0c3){return BPromise[_0xa993('0x21')](_0x16a0c3);}return _0x2c8989[_0xa993('0x22')]();};}function saveUpdates(_0xf6788,_0xcae8a1){return function(_0x279a88){if(_0x279a88){return _0x279a88[_0xa993('0x23')](_0xf6788)[_0xa993('0x24')](function(_0x3f5902){return _0x3f5902;});}return null;};}function removeEntity(_0x342852,_0x168a13){return function(_0x1a9454){if(_0x1a9454){return _0x1a9454[_0xa993('0x25')]()[_0xa993('0x24')](function(){_0x342852['status'](0xcc)[_0xa993('0x1a')]();});}};}function handleEntityNotFound(_0x57de73,_0x2ef3d6){return function(_0x3fc14e){if(!_0x3fc14e){_0x57de73['sendStatus'](0x194);}return _0x3fc14e;};}function handleError(_0x107d3f,_0xb5a89c){_0xb5a89c=_0xb5a89c||0x1f4;return function(_0x2569a8){logger[_0xa993('0x26')](_0x2569a8[_0xa993('0x27')]);if(_0x2569a8['name']){delete _0x2569a8[_0xa993('0x28')];}_0x107d3f[_0xa993('0x1f')](_0xb5a89c)['send'](_0x2569a8);};}exports[_0xa993('0x29')]=function(_0x3b9c17,_0x46f4a7){var _0x4d6401={},_0x58f4cf={},_0x47af35={'count':0x0,'rows':[]};var _0x3eddf0=_['map'](db[_0xa993('0x2a')][_0xa993('0x2b')],function(_0x5df4d5){return{'name':_0x5df4d5[_0xa993('0x2c')],'type':_0x5df4d5['type'][_0xa993('0x2d')]};});_0x58f4cf[_0xa993('0x2e')]=_['map'](_0x3eddf0,'name');_0x58f4cf[_0xa993('0x2f')]=_['keys'](_0x3b9c17['query']);_0x58f4cf[_0xa993('0x30')]=_[_0xa993('0x31')](_0x58f4cf['model'],_0x58f4cf['query']);_0x4d6401['attributes']=_[_0xa993('0x31')](_0x58f4cf[_0xa993('0x2e')],qs[_0xa993('0x32')](_0x3b9c17['query'][_0xa993('0x32')]));_0x4d6401[_0xa993('0x33')]=_0x4d6401[_0xa993('0x33')]['length']?_0x4d6401[_0xa993('0x33')]:_0x58f4cf['model'];if(!_0x3b9c17[_0xa993('0x2f')][_0xa993('0x34')](_0xa993('0x35'))){_0x4d6401[_0xa993('0x1c')]=qs[_0xa993('0x1c')](_0x3b9c17[_0xa993('0x2f')][_0xa993('0x1c')]);_0x4d6401[_0xa993('0x1d')]=qs[_0xa993('0x1d')](_0x3b9c17[_0xa993('0x2f')][_0xa993('0x1d')]);}_0x4d6401[_0xa993('0x36')]=qs[_0xa993('0x37')](_0x3b9c17['query'][_0xa993('0x37')]);_0x4d6401['where']=qs['filters'](_[_0xa993('0x38')](_0x3b9c17[_0xa993('0x2f')],_0x58f4cf[_0xa993('0x30')]),_0x3eddf0);if(_0x3b9c17['query']['filter']){_0x4d6401['where']=_['merge'](_0x4d6401['where'],{'$or':_[_0xa993('0x39')](_0x3eddf0,function(_0x3ea220){if(_0x3ea220['type']!=='VIRTUAL'){var _0x720c67={};_0x720c67[_0x3ea220[_0xa993('0x28')]]={'$like':'%'+_0x3b9c17[_0xa993('0x2f')][_0xa993('0x3a')]+'%'};return _0x720c67;}})});}_0x4d6401=_['merge']({},_0x4d6401,_0x3b9c17[_0xa993('0x3b')]);var _0x4566a7={'where':_0x4d6401[_0xa993('0x3c')]};return db[_0xa993('0x2a')][_0xa993('0x1e')](_0x4566a7)[_0xa993('0x24')](function(_0x4041d0){_0x47af35['count']=_0x4041d0;if(_0x3b9c17[_0xa993('0x2f')][_0xa993('0x3d')]){_0x4d6401['include']=[{'all':!![]}];}return db[_0xa993('0x2a')][_0xa993('0x3e')](_0x4d6401);})[_0xa993('0x24')](function(_0x3d30c9){_0x47af35[_0xa993('0x3f')]=_0x3d30c9;return _0x47af35;})['then'](respondWithFilteredResult(_0x46f4a7,_0x4d6401))[_0xa993('0x40')](handleError(_0x46f4a7,null));};exports[_0xa993('0x41')]=function(_0x17b8cb,_0x227813){var _0x3b1225={'raw':![],'where':{'id':_0x17b8cb[_0xa993('0x42')]['id']}},_0x1c4d60={};_0x1c4d60['model']=_['keys'](db['ZohoConfiguration'][_0xa993('0x2b')]);_0x1c4d60[_0xa993('0x2f')]=_['keys'](_0x17b8cb[_0xa993('0x2f')]);_0x1c4d60[_0xa993('0x30')]=_[_0xa993('0x31')](_0x1c4d60[_0xa993('0x2e')],_0x1c4d60[_0xa993('0x2f')]);_0x3b1225[_0xa993('0x33')]=_[_0xa993('0x31')](_0x1c4d60[_0xa993('0x2e')],qs[_0xa993('0x32')](_0x17b8cb[_0xa993('0x2f')][_0xa993('0x32')]));_0x3b1225[_0xa993('0x33')]=_0x3b1225[_0xa993('0x33')][_0xa993('0x43')]?_0x3b1225['attributes']:_0x1c4d60[_0xa993('0x2e')];if(_0x17b8cb[_0xa993('0x2f')]['includeAll']){_0x3b1225[_0xa993('0x44')]=[{'all':!![]}];}_0x3b1225=_[_0xa993('0x45')]({},_0x3b1225,_0x17b8cb[_0xa993('0x3b')]);return db[_0xa993('0x2a')]['find'](_0x3b1225)[_0xa993('0x24')](handleEntityNotFound(_0x227813,null))[_0xa993('0x24')](respondWithResult(_0x227813,null))['catch'](handleError(_0x227813,null));};exports[_0xa993('0x46')]=function(_0x268ff1,_0x49ecbb){return db[_0xa993('0x2a')][_0xa993('0x46')](_0x268ff1[_0xa993('0x47')],{})[_0xa993('0x24')](respondWithResult(_0x49ecbb,0xc9))[_0xa993('0x40')](handleError(_0x49ecbb,null));};exports[_0xa993('0x23')]=function(_0x5bd8f3,_0x4398e6){if(_0x5bd8f3['body']['id']){delete _0x5bd8f3['body']['id'];}return db[_0xa993('0x2a')][_0xa993('0x48')]({'where':{'id':_0x5bd8f3['params']['id']}})['then'](handleEntityNotFound(_0x4398e6,null))[_0xa993('0x24')](saveUpdates(_0x5bd8f3[_0xa993('0x47')],null))[_0xa993('0x24')](respondWithResult(_0x4398e6,null))['catch'](handleError(_0x4398e6,null));};exports[_0xa993('0x25')]=function(_0x53c565,_0x21908b){return db[_0xa993('0x2a')][_0xa993('0x48')]({'where':{'id':_0x53c565[_0xa993('0x42')]['id']}})[_0xa993('0x24')](handleEntityNotFound(_0x21908b,null))[_0xa993('0x24')](removeEntity(_0x21908b,null))['catch'](handleError(_0x21908b,null));};exports[_0xa993('0x49')]=function(_0x25b7ad,_0x57fee7,_0x35928d){var _0x54613f={};var _0x154dae={};var _0xf372c8;var _0xf9cd52;return db[_0xa993('0x2a')][_0xa993('0x4a')]({'where':{'id':_0x25b7ad[_0xa993('0x42')]['id']}})[_0xa993('0x24')](handleEntityNotFound(_0x57fee7,null))[_0xa993('0x24')](function(_0x49427e){if(_0x49427e){_0xf372c8=_0x49427e;_0x154dae[_0xa993('0x2e')]=_[_0xa993('0x4b')](db[_0xa993('0x4c')][_0xa993('0x2b')]);_0x154dae[_0xa993('0x2f')]=_[_0xa993('0x4b')](_0x25b7ad[_0xa993('0x2f')]);_0x154dae[_0xa993('0x30')]=_[_0xa993('0x31')](_0x154dae[_0xa993('0x2e')],_0x154dae[_0xa993('0x2f')]);_0x54613f[_0xa993('0x33')]=_[_0xa993('0x31')](_0x154dae[_0xa993('0x2e')],qs[_0xa993('0x32')](_0x25b7ad[_0xa993('0x2f')][_0xa993('0x32')]));_0x54613f['attributes']=_0x54613f[_0xa993('0x33')][_0xa993('0x43')]?_0x54613f[_0xa993('0x33')]:_0x154dae[_0xa993('0x2e')];_0x54613f['order']=qs[_0xa993('0x37')](_0x25b7ad[_0xa993('0x2f')][_0xa993('0x37')]);_0x54613f[_0xa993('0x3c')]=qs[_0xa993('0x30')](_[_0xa993('0x38')](_0x25b7ad[_0xa993('0x2f')],_0x154dae['filters']));if(_0x25b7ad[_0xa993('0x2f')]['filter']){_0x54613f[_0xa993('0x3c')]=_['merge'](_0x54613f['where'],{'$or':_[_0xa993('0x39')](_0x54613f['attributes'],function(_0x39e96f){var _0x354cfb={};_0x354cfb[_0x39e96f]={'$like':'%'+_0x25b7ad[_0xa993('0x2f')]['filter']+'%'};return _0x354cfb;})});}_0x54613f=_[_0xa993('0x45')]({},_0x54613f,_0x25b7ad['options']);return _0xf372c8['getFields'](_0x54613f);}})['then'](function(_0x349c34){if(_0x349c34){_0xf9cd52=_0x349c34['length'];if(!_0x25b7ad[_0xa993('0x2f')][_0xa993('0x34')](_0xa993('0x35'))){_0x54613f[_0xa993('0x1c')]=qs[_0xa993('0x1c')](_0x25b7ad['query'][_0xa993('0x1c')]);_0x54613f[_0xa993('0x1d')]=qs[_0xa993('0x1d')](_0x25b7ad['query'][_0xa993('0x1d')]);}return _0xf372c8[_0xa993('0x49')](_0x54613f);}})['then'](function(_0x3b668d){if(_0x3b668d){return _0x3b668d?{'count':_0xf9cd52,'rows':_0x3b668d}:null;}})[_0xa993('0x24')](respondWithResult(_0x57fee7,null))[_0xa993('0x40')](handleError(_0x57fee7,null));};exports[_0xa993('0x4d')]=function(_0x47adc7,_0x36b9fc,_0x5d4f10){var _0x2d5fb={};var _0x349a82={};var _0x3ddbcc;var _0x3f8109;return db[_0xa993('0x2a')][_0xa993('0x4a')]({'where':{'id':_0x47adc7[_0xa993('0x42')]['id']}})[_0xa993('0x24')](handleEntityNotFound(_0x36b9fc,null))[_0xa993('0x24')](function(_0x507489){if(_0x507489){_0x3ddbcc=_0x507489;_0x349a82[_0xa993('0x2e')]=_[_0xa993('0x4b')](db[_0xa993('0x4c')][_0xa993('0x2b')]);_0x349a82['query']=_[_0xa993('0x4b')](_0x47adc7[_0xa993('0x2f')]);_0x349a82['filters']=_[_0xa993('0x31')](_0x349a82[_0xa993('0x2e')],_0x349a82[_0xa993('0x2f')]);_0x2d5fb[_0xa993('0x33')]=_['intersection'](_0x349a82[_0xa993('0x2e')],qs[_0xa993('0x32')](_0x47adc7[_0xa993('0x2f')]['fields']));_0x2d5fb[_0xa993('0x33')]=_0x2d5fb['attributes'][_0xa993('0x43')]?_0x2d5fb['attributes']:_0x349a82['model'];_0x2d5fb['order']=qs['sort'](_0x47adc7[_0xa993('0x2f')][_0xa993('0x37')]);_0x2d5fb['where']=qs[_0xa993('0x30')](_['pick'](_0x47adc7[_0xa993('0x2f')],_0x349a82[_0xa993('0x30')]));if(_0x47adc7[_0xa993('0x2f')][_0xa993('0x3a')]){_0x2d5fb[_0xa993('0x3c')]=_['merge'](_0x2d5fb[_0xa993('0x3c')],{'$or':_[_0xa993('0x39')](_0x2d5fb[_0xa993('0x33')],function(_0x270928){var _0x265042={};_0x265042[_0x270928]={'$like':'%'+_0x47adc7[_0xa993('0x2f')][_0xa993('0x3a')]+'%'};return _0x265042;})});}_0x2d5fb=_[_0xa993('0x45')]({},_0x2d5fb,_0x47adc7['options']);return _0x3ddbcc[_0xa993('0x4d')](_0x2d5fb);}})['then'](function(_0x327aae){if(_0x327aae){_0x3f8109=_0x327aae['length'];if(!_0x47adc7[_0xa993('0x2f')][_0xa993('0x34')](_0xa993('0x35'))){_0x2d5fb[_0xa993('0x1c')]=qs[_0xa993('0x1c')](_0x47adc7[_0xa993('0x2f')]['limit']);_0x2d5fb[_0xa993('0x1d')]=qs[_0xa993('0x1d')](_0x47adc7['query'][_0xa993('0x1d')]);}return _0x3ddbcc[_0xa993('0x4d')](_0x2d5fb);}})['then'](function(_0x282312){if(_0x282312){return _0x282312?{'count':_0x3f8109,'rows':_0x282312}:null;}})['then'](respondWithResult(_0x36b9fc,null))[_0xa993('0x40')](handleError(_0x36b9fc,null));};exports[_0xa993('0x4e')]=function(_0x1aa73e,_0x14fa2f,_0x53867c){var _0x1abd32={};var _0x136134={};var _0x202476;var _0x1085a5;return db[_0xa993('0x2a')][_0xa993('0x4a')]({'where':{'id':_0x1aa73e[_0xa993('0x42')]['id']}})[_0xa993('0x24')](handleEntityNotFound(_0x14fa2f,null))[_0xa993('0x24')](function(_0x4d8515){if(_0x4d8515){_0x202476=_0x4d8515;_0x136134[_0xa993('0x2e')]=_[_0xa993('0x4b')](db[_0xa993('0x4c')][_0xa993('0x2b')]);_0x136134[_0xa993('0x2f')]=_[_0xa993('0x4b')](_0x1aa73e[_0xa993('0x2f')]);_0x136134[_0xa993('0x30')]=_['intersection'](_0x136134[_0xa993('0x2e')],_0x136134['query']);_0x1abd32[_0xa993('0x33')]=_[_0xa993('0x31')](_0x136134[_0xa993('0x2e')],qs[_0xa993('0x32')](_0x1aa73e['query'][_0xa993('0x32')]));_0x1abd32['attributes']=_0x1abd32[_0xa993('0x33')][_0xa993('0x43')]?_0x1abd32[_0xa993('0x33')]:_0x136134[_0xa993('0x2e')];_0x1abd32[_0xa993('0x36')]=qs['sort'](_0x1aa73e['query']['sort']);_0x1abd32[_0xa993('0x3c')]=qs[_0xa993('0x30')](_[_0xa993('0x38')](_0x1aa73e[_0xa993('0x2f')],_0x136134[_0xa993('0x30')]));if(_0x1aa73e[_0xa993('0x2f')][_0xa993('0x3a')]){_0x1abd32[_0xa993('0x3c')]=_[_0xa993('0x45')](_0x1abd32[_0xa993('0x3c')],{'$or':_['map'](_0x1abd32['attributes'],function(_0x383477){var _0x1a9065={};_0x1a9065[_0x383477]={'$like':'%'+_0x1aa73e['query'][_0xa993('0x3a')]+'%'};return _0x1a9065;})});}_0x1abd32=_[_0xa993('0x45')]({},_0x1abd32,_0x1aa73e[_0xa993('0x3b')]);return _0x202476[_0xa993('0x4e')](_0x1abd32);}})[_0xa993('0x24')](function(_0x18ee4f){if(_0x18ee4f){_0x1085a5=_0x18ee4f[_0xa993('0x43')];if(!_0x1aa73e['query'][_0xa993('0x34')](_0xa993('0x35'))){_0x1abd32[_0xa993('0x1c')]=qs['limit'](_0x1aa73e[_0xa993('0x2f')][_0xa993('0x1c')]);_0x1abd32[_0xa993('0x1d')]=qs[_0xa993('0x1d')](_0x1aa73e[_0xa993('0x2f')][_0xa993('0x1d')]);}return _0x202476[_0xa993('0x4e')](_0x1abd32);}})[_0xa993('0x24')](function(_0x331c84){if(_0x331c84){return _0x331c84?{'count':_0x1085a5,'rows':_0x331c84}:null;}})[_0xa993('0x24')](respondWithResult(_0x14fa2f,null))[_0xa993('0x40')](handleError(_0x14fa2f,null));}; \ No newline at end of file +var _0x359d=['pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','ZohoField','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x359d,0x1f3));var _0xd359=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0x359d[_0x3a0863];return _0x85c557;};'use strict';var emlformat=require(_0xd359('0x0'));var rimraf=require(_0xd359('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd359('0x2'));var rp=require(_0xd359('0x3'));var moment=require(_0xd359('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd359('0x5'));var util=require(_0xd359('0x6'));var path=require(_0xd359('0x7'));var sox=require(_0xd359('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd359('0x9'));var _=require('lodash');var squel=require(_0xd359('0xa'));var crypto=require('crypto');var jsforce=require(_0xd359('0xb'));var deskjs=require(_0xd359('0xc'));var toCsv=require(_0xd359('0xd'));var querystring=require(_0xd359('0xe'));var Papa=require(_0xd359('0xf'));var Redis=require(_0xd359('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd359('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd359('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd359('0x13'));var licenseUtil=require(_0xd359('0x14'));var db=require(_0xd359('0x15'))['db'];function respondWithStatusCode(_0x294784,_0x3b0ebc){_0x3b0ebc=_0x3b0ebc||0xcc;return function(_0x4b3b9f){if(_0x4b3b9f){return _0x294784['sendStatus'](_0x3b0ebc);}return _0x294784['status'](_0x3b0ebc)[_0xd359('0x16')]();};}function respondWithResult(_0x7d81b7,_0x3e1cb8){_0x3e1cb8=_0x3e1cb8||0xc8;return function(_0x4f1dd0){if(_0x4f1dd0){return _0x7d81b7[_0xd359('0x17')](_0x3e1cb8)[_0xd359('0x18')](_0x4f1dd0);}};}function respondWithFilteredResult(_0x534770,_0x55bbb5){return function(_0x557632){if(_0x557632){var _0x3f69f6=typeof _0x55bbb5[_0xd359('0x19')]===_0xd359('0x1a')&&typeof _0x55bbb5[_0xd359('0x1b')]===_0xd359('0x1a');var _0x2f5019=_0x557632[_0xd359('0x1c')];var _0x3f83d4=_0x3f69f6?0x0:_0x55bbb5[_0xd359('0x19')];var _0x39d46f=_0x3f69f6?_0x557632[_0xd359('0x1c')]:_0x55bbb5[_0xd359('0x19')]+_0x55bbb5[_0xd359('0x1b')];var _0x2dcd8a;if(_0x39d46f>=_0x2f5019){_0x39d46f=_0x2f5019;_0x2dcd8a=0xc8;}else{_0x2dcd8a=0xce;}_0x534770[_0xd359('0x17')](_0x2dcd8a);return _0x534770[_0xd359('0x1d')](_0xd359('0x1e'),_0x3f83d4+'-'+_0x39d46f+'/'+_0x2f5019)[_0xd359('0x18')](_0x557632);}return null;};}function patchUpdates(_0x3c317b){return function(_0x4590f7){try{jsonpatch[_0xd359('0x1f')](_0x4590f7,_0x3c317b,!![]);}catch(_0x14fc27){return BPromise[_0xd359('0x20')](_0x14fc27);}return _0x4590f7[_0xd359('0x21')]();};}function saveUpdates(_0x137f5f,_0xb93d28){return function(_0x45e154){if(_0x45e154){return _0x45e154[_0xd359('0x22')](_0x137f5f)[_0xd359('0x23')](function(_0x22e953){return _0x22e953;});}return null;};}function removeEntity(_0x268a00,_0x3fc043){return function(_0x377a30){if(_0x377a30){return _0x377a30[_0xd359('0x24')]()[_0xd359('0x23')](function(){_0x268a00[_0xd359('0x17')](0xcc)[_0xd359('0x16')]();});}};}function handleEntityNotFound(_0x18f7cb,_0x45ff74){return function(_0x19d439){if(!_0x19d439){_0x18f7cb[_0xd359('0x25')](0x194);}return _0x19d439;};}function handleError(_0x1ba8bf,_0x5e1b1c){_0x5e1b1c=_0x5e1b1c||0x1f4;return function(_0x1afe16){logger[_0xd359('0x26')](_0x1afe16[_0xd359('0x27')]);if(_0x1afe16['name']){delete _0x1afe16[_0xd359('0x28')];}_0x1ba8bf[_0xd359('0x17')](_0x5e1b1c)[_0xd359('0x29')](_0x1afe16);};}exports[_0xd359('0x2a')]=function(_0x3d49ae,_0x56e71a){var _0x7a7365={},_0x2a295d={},_0x1d5b36={'count':0x0,'rows':[]};var _0x2c3cf5=_[_0xd359('0x2b')](db[_0xd359('0x2c')][_0xd359('0x2d')],function(_0x48e4f1){return{'name':_0x48e4f1['fieldName'],'type':_0x48e4f1[_0xd359('0x2e')][_0xd359('0x2f')]};});_0x2a295d[_0xd359('0x30')]=_[_0xd359('0x2b')](_0x2c3cf5,_0xd359('0x28'));_0x2a295d[_0xd359('0x31')]=_[_0xd359('0x32')](_0x3d49ae['query']);_0x2a295d[_0xd359('0x33')]=_['intersection'](_0x2a295d[_0xd359('0x30')],_0x2a295d[_0xd359('0x31')]);_0x7a7365['attributes']=_[_0xd359('0x34')](_0x2a295d[_0xd359('0x30')],qs[_0xd359('0x35')](_0x3d49ae['query']['fields']));_0x7a7365['attributes']=_0x7a7365[_0xd359('0x36')][_0xd359('0x37')]?_0x7a7365['attributes']:_0x2a295d['model'];if(!_0x3d49ae[_0xd359('0x31')][_0xd359('0x38')](_0xd359('0x39'))){_0x7a7365[_0xd359('0x1b')]=qs[_0xd359('0x1b')](_0x3d49ae[_0xd359('0x31')][_0xd359('0x1b')]);_0x7a7365[_0xd359('0x19')]=qs[_0xd359('0x19')](_0x3d49ae['query'][_0xd359('0x19')]);}_0x7a7365[_0xd359('0x3a')]=qs[_0xd359('0x3b')](_0x3d49ae[_0xd359('0x31')]['sort']);_0x7a7365[_0xd359('0x3c')]=qs['filters'](_[_0xd359('0x3d')](_0x3d49ae[_0xd359('0x31')],_0x2a295d[_0xd359('0x33')]),_0x2c3cf5);if(_0x3d49ae[_0xd359('0x31')][_0xd359('0x3e')]){_0x7a7365['where']=_[_0xd359('0x3f')](_0x7a7365['where'],{'$or':_[_0xd359('0x2b')](_0x2c3cf5,function(_0x526627){if(_0x526627[_0xd359('0x2e')]!==_0xd359('0x40')){var _0x441273={};_0x441273[_0x526627[_0xd359('0x28')]]={'$like':'%'+_0x3d49ae[_0xd359('0x31')]['filter']+'%'};return _0x441273;}})});}_0x7a7365=_['merge']({},_0x7a7365,_0x3d49ae[_0xd359('0x41')]);var _0x48a9b4={'where':_0x7a7365[_0xd359('0x3c')]};return db[_0xd359('0x2c')][_0xd359('0x1c')](_0x48a9b4)['then'](function(_0x2e2fa9){_0x1d5b36[_0xd359('0x1c')]=_0x2e2fa9;if(_0x3d49ae[_0xd359('0x31')]['includeAll']){_0x7a7365['include']=[{'all':!![]}];}return db[_0xd359('0x2c')][_0xd359('0x42')](_0x7a7365);})[_0xd359('0x23')](function(_0x5ea4cd){_0x1d5b36[_0xd359('0x43')]=_0x5ea4cd;return _0x1d5b36;})[_0xd359('0x23')](respondWithFilteredResult(_0x56e71a,_0x7a7365))[_0xd359('0x44')](handleError(_0x56e71a,null));};exports[_0xd359('0x45')]=function(_0x603964,_0x20a0fb){var _0x1d215d={'raw':![],'where':{'id':_0x603964[_0xd359('0x46')]['id']}},_0x3bc2c3={};_0x3bc2c3[_0xd359('0x30')]=_[_0xd359('0x32')](db[_0xd359('0x2c')]['rawAttributes']);_0x3bc2c3[_0xd359('0x31')]=_['keys'](_0x603964[_0xd359('0x31')]);_0x3bc2c3[_0xd359('0x33')]=_[_0xd359('0x34')](_0x3bc2c3[_0xd359('0x30')],_0x3bc2c3['query']);_0x1d215d[_0xd359('0x36')]=_[_0xd359('0x34')](_0x3bc2c3[_0xd359('0x30')],qs[_0xd359('0x35')](_0x603964[_0xd359('0x31')][_0xd359('0x35')]));_0x1d215d['attributes']=_0x1d215d[_0xd359('0x36')][_0xd359('0x37')]?_0x1d215d[_0xd359('0x36')]:_0x3bc2c3[_0xd359('0x30')];if(_0x603964['query'][_0xd359('0x47')]){_0x1d215d[_0xd359('0x48')]=[{'all':!![]}];}_0x1d215d=_[_0xd359('0x3f')]({},_0x1d215d,_0x603964[_0xd359('0x41')]);return db[_0xd359('0x2c')][_0xd359('0x49')](_0x1d215d)[_0xd359('0x23')](handleEntityNotFound(_0x20a0fb,null))[_0xd359('0x23')](respondWithResult(_0x20a0fb,null))[_0xd359('0x44')](handleError(_0x20a0fb,null));};exports[_0xd359('0x4a')]=function(_0x536ea0,_0x234a23){return db['ZohoConfiguration'][_0xd359('0x4a')](_0x536ea0[_0xd359('0x4b')],{})[_0xd359('0x23')](respondWithResult(_0x234a23,0xc9))['catch'](handleError(_0x234a23,null));};exports[_0xd359('0x22')]=function(_0x2c081a,_0x3c34e7){if(_0x2c081a['body']['id']){delete _0x2c081a[_0xd359('0x4b')]['id'];}return db[_0xd359('0x2c')][_0xd359('0x49')]({'where':{'id':_0x2c081a['params']['id']}})['then'](handleEntityNotFound(_0x3c34e7,null))[_0xd359('0x23')](saveUpdates(_0x2c081a['body'],null))[_0xd359('0x23')](respondWithResult(_0x3c34e7,null))[_0xd359('0x44')](handleError(_0x3c34e7,null));};exports['destroy']=function(_0x3b9bcd,_0x358a42){return db['ZohoConfiguration'][_0xd359('0x49')]({'where':{'id':_0x3b9bcd[_0xd359('0x46')]['id']}})[_0xd359('0x23')](handleEntityNotFound(_0x358a42,null))[_0xd359('0x23')](removeEntity(_0x358a42,null))[_0xd359('0x44')](handleError(_0x358a42,null));};exports['getFields']=function(_0x1bfd56,_0x235a9e,_0x1c9756){var _0x102d55={};var _0xa2d757={};var _0x32ba7f;var _0x199fa6;return db[_0xd359('0x2c')]['findOne']({'where':{'id':_0x1bfd56[_0xd359('0x46')]['id']}})[_0xd359('0x23')](handleEntityNotFound(_0x235a9e,null))[_0xd359('0x23')](function(_0x28ae83){if(_0x28ae83){_0x32ba7f=_0x28ae83;_0xa2d757[_0xd359('0x30')]=_['keys'](db[_0xd359('0x4c')][_0xd359('0x2d')]);_0xa2d757[_0xd359('0x31')]=_['keys'](_0x1bfd56[_0xd359('0x31')]);_0xa2d757[_0xd359('0x33')]=_[_0xd359('0x34')](_0xa2d757[_0xd359('0x30')],_0xa2d757[_0xd359('0x31')]);_0x102d55['attributes']=_[_0xd359('0x34')](_0xa2d757['model'],qs[_0xd359('0x35')](_0x1bfd56[_0xd359('0x31')][_0xd359('0x35')]));_0x102d55[_0xd359('0x36')]=_0x102d55[_0xd359('0x36')][_0xd359('0x37')]?_0x102d55[_0xd359('0x36')]:_0xa2d757[_0xd359('0x30')];_0x102d55[_0xd359('0x3a')]=qs['sort'](_0x1bfd56[_0xd359('0x31')][_0xd359('0x3b')]);_0x102d55[_0xd359('0x3c')]=qs[_0xd359('0x33')](_[_0xd359('0x3d')](_0x1bfd56[_0xd359('0x31')],_0xa2d757[_0xd359('0x33')]));if(_0x1bfd56[_0xd359('0x31')][_0xd359('0x3e')]){_0x102d55[_0xd359('0x3c')]=_['merge'](_0x102d55[_0xd359('0x3c')],{'$or':_['map'](_0x102d55[_0xd359('0x36')],function(_0x5d2ae2){var _0x241238={};_0x241238[_0x5d2ae2]={'$like':'%'+_0x1bfd56['query'][_0xd359('0x3e')]+'%'};return _0x241238;})});}_0x102d55=_[_0xd359('0x3f')]({},_0x102d55,_0x1bfd56[_0xd359('0x41')]);return _0x32ba7f['getFields'](_0x102d55);}})[_0xd359('0x23')](function(_0x1b3238){if(_0x1b3238){_0x199fa6=_0x1b3238[_0xd359('0x37')];if(!_0x1bfd56[_0xd359('0x31')]['hasOwnProperty'](_0xd359('0x39'))){_0x102d55['limit']=qs['limit'](_0x1bfd56['query'][_0xd359('0x1b')]);_0x102d55['offset']=qs[_0xd359('0x19')](_0x1bfd56[_0xd359('0x31')][_0xd359('0x19')]);}return _0x32ba7f['getFields'](_0x102d55);}})[_0xd359('0x23')](function(_0x386d52){if(_0x386d52){return _0x386d52?{'count':_0x199fa6,'rows':_0x386d52}:null;}})[_0xd359('0x23')](respondWithResult(_0x235a9e,null))['catch'](handleError(_0x235a9e,null));};exports[_0xd359('0x4d')]=function(_0x5a3577,_0x451483,_0x528c16){var _0x4e46df={};var _0xb20016={};var _0x40555f;var _0x545705;return db[_0xd359('0x2c')][_0xd359('0x4e')]({'where':{'id':_0x5a3577[_0xd359('0x46')]['id']}})[_0xd359('0x23')](handleEntityNotFound(_0x451483,null))[_0xd359('0x23')](function(_0x1ffacb){if(_0x1ffacb){_0x40555f=_0x1ffacb;_0xb20016['model']=_[_0xd359('0x32')](db[_0xd359('0x4c')][_0xd359('0x2d')]);_0xb20016[_0xd359('0x31')]=_[_0xd359('0x32')](_0x5a3577[_0xd359('0x31')]);_0xb20016[_0xd359('0x33')]=_['intersection'](_0xb20016[_0xd359('0x30')],_0xb20016['query']);_0x4e46df['attributes']=_[_0xd359('0x34')](_0xb20016[_0xd359('0x30')],qs[_0xd359('0x35')](_0x5a3577['query'][_0xd359('0x35')]));_0x4e46df['attributes']=_0x4e46df[_0xd359('0x36')]['length']?_0x4e46df[_0xd359('0x36')]:_0xb20016[_0xd359('0x30')];_0x4e46df['order']=qs['sort'](_0x5a3577[_0xd359('0x31')][_0xd359('0x3b')]);_0x4e46df[_0xd359('0x3c')]=qs[_0xd359('0x33')](_['pick'](_0x5a3577['query'],_0xb20016[_0xd359('0x33')]));if(_0x5a3577[_0xd359('0x31')][_0xd359('0x3e')]){_0x4e46df[_0xd359('0x3c')]=_[_0xd359('0x3f')](_0x4e46df[_0xd359('0x3c')],{'$or':_[_0xd359('0x2b')](_0x4e46df[_0xd359('0x36')],function(_0x165979){var _0x33ad49={};_0x33ad49[_0x165979]={'$like':'%'+_0x5a3577['query']['filter']+'%'};return _0x33ad49;})});}_0x4e46df=_[_0xd359('0x3f')]({},_0x4e46df,_0x5a3577['options']);return _0x40555f[_0xd359('0x4d')](_0x4e46df);}})[_0xd359('0x23')](function(_0x249cef){if(_0x249cef){_0x545705=_0x249cef[_0xd359('0x37')];if(!_0x5a3577[_0xd359('0x31')][_0xd359('0x38')](_0xd359('0x39'))){_0x4e46df[_0xd359('0x1b')]=qs['limit'](_0x5a3577[_0xd359('0x31')][_0xd359('0x1b')]);_0x4e46df['offset']=qs['offset'](_0x5a3577['query'][_0xd359('0x19')]);}return _0x40555f[_0xd359('0x4d')](_0x4e46df);}})['then'](function(_0x5b0c1b){if(_0x5b0c1b){return _0x5b0c1b?{'count':_0x545705,'rows':_0x5b0c1b}:null;}})['then'](respondWithResult(_0x451483,null))[_0xd359('0x44')](handleError(_0x451483,null));};exports[_0xd359('0x4f')]=function(_0x497e1c,_0x2f881d,_0x172f0d){var _0x4ab921={};var _0x4116a5={};var _0xec4171;var _0x12f0d6;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x497e1c[_0xd359('0x46')]['id']}})[_0xd359('0x23')](handleEntityNotFound(_0x2f881d,null))[_0xd359('0x23')](function(_0x906d46){if(_0x906d46){_0xec4171=_0x906d46;_0x4116a5[_0xd359('0x30')]=_[_0xd359('0x32')](db[_0xd359('0x4c')][_0xd359('0x2d')]);_0x4116a5[_0xd359('0x31')]=_[_0xd359('0x32')](_0x497e1c[_0xd359('0x31')]);_0x4116a5[_0xd359('0x33')]=_[_0xd359('0x34')](_0x4116a5[_0xd359('0x30')],_0x4116a5[_0xd359('0x31')]);_0x4ab921[_0xd359('0x36')]=_[_0xd359('0x34')](_0x4116a5[_0xd359('0x30')],qs['fields'](_0x497e1c[_0xd359('0x31')][_0xd359('0x35')]));_0x4ab921[_0xd359('0x36')]=_0x4ab921[_0xd359('0x36')]['length']?_0x4ab921[_0xd359('0x36')]:_0x4116a5[_0xd359('0x30')];_0x4ab921[_0xd359('0x3a')]=qs['sort'](_0x497e1c[_0xd359('0x31')]['sort']);_0x4ab921['where']=qs[_0xd359('0x33')](_[_0xd359('0x3d')](_0x497e1c[_0xd359('0x31')],_0x4116a5[_0xd359('0x33')]));if(_0x497e1c[_0xd359('0x31')][_0xd359('0x3e')]){_0x4ab921['where']=_[_0xd359('0x3f')](_0x4ab921[_0xd359('0x3c')],{'$or':_[_0xd359('0x2b')](_0x4ab921['attributes'],function(_0x3dc243){var _0x5280f6={};_0x5280f6[_0x3dc243]={'$like':'%'+_0x497e1c[_0xd359('0x31')][_0xd359('0x3e')]+'%'};return _0x5280f6;})});}_0x4ab921=_[_0xd359('0x3f')]({},_0x4ab921,_0x497e1c[_0xd359('0x41')]);return _0xec4171[_0xd359('0x4f')](_0x4ab921);}})[_0xd359('0x23')](function(_0x44aab3){if(_0x44aab3){_0x12f0d6=_0x44aab3[_0xd359('0x37')];if(!_0x497e1c['query'][_0xd359('0x38')](_0xd359('0x39'))){_0x4ab921[_0xd359('0x1b')]=qs[_0xd359('0x1b')](_0x497e1c[_0xd359('0x31')][_0xd359('0x1b')]);_0x4ab921[_0xd359('0x19')]=qs[_0xd359('0x19')](_0x497e1c['query'][_0xd359('0x19')]);}return _0xec4171['getDescriptions'](_0x4ab921);}})[_0xd359('0x23')](function(_0x13d7e8){if(_0x13d7e8){return _0x13d7e8?{'count':_0x12f0d6,'rows':_0x13d7e8}:null;}})[_0xd359('0x23')](respondWithResult(_0x2f881d,null))[_0xd359('0x44')](handleError(_0x2f881d,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c51fe45..b8415ec 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 _0x8321=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','ZohoConfiguration','int_zoho_configurations'];(function(_0x553bf7,_0x4acdaa){var _0x24437f=function(_0x499e83){while(--_0x499e83){_0x553bf7['push'](_0x553bf7['shift']());}};_0x24437f(++_0x4acdaa);}(_0x8321,0x78));var _0x1832=function(_0x4996cc,_0x368ea3){_0x4996cc=_0x4996cc-0x0;var _0x37df6c=_0x8321[_0x4996cc];return _0x37df6c;};'use strict';var _=require(_0x1832('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1832('0x1'));var moment=require(_0x1832('0x2'));var BPromise=require(_0x1832('0x3'));var rp=require(_0x1832('0x4'));var fs=require('fs');var path=require(_0x1832('0x5'));var rimraf=require(_0x1832('0x6'));var config=require(_0x1832('0x7'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x26a9a2,_0x1397ec){return _0x26a9a2['define'](_0x1832('0x8'),attributes,{'tableName':_0x1832('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb3a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x1837da,_0x4a12f6){var _0xad5e3f=function(_0x4add85){while(--_0x4add85){_0x1837da['push'](_0x1837da['shift']());}};_0xad5e3f(++_0x4a12f6);}(_0xfb3a,0x70));var _0xafb3=function(_0x26fd5d,_0x42357d){_0x26fd5d=_0x26fd5d-0x0;var _0x2079be=_0xfb3a[_0x26fd5d];return _0x2079be;};'use strict';var _=require(_0xafb3('0x0'));var util=require(_0xafb3('0x1'));var logger=require(_0xafb3('0x2'))(_0xafb3('0x3'));var moment=require(_0xafb3('0x4'));var BPromise=require(_0xafb3('0x5'));var rp=require(_0xafb3('0x6'));var fs=require('fs');var path=require(_0xafb3('0x7'));var rimraf=require(_0xafb3('0x8'));var config=require(_0xafb3('0x9'));var attributes=require('./intZohoConfiguration.attributes');module[_0xafb3('0xa')]=function(_0x94f45,_0x497c27){return _0x94f45[_0xafb3('0xb')](_0xafb3('0xc'),attributes,{'tableName':_0xafb3('0xd'),'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 5b8639c..7cbaaa1 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 _0x1171=['info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x1171,0x153));var _0x1117=function(_0x1bb0b6,_0x1734b7){_0x1bb0b6=_0x1bb0b6-0x0;var _0x45f16b=_0x1171[_0x1bb0b6];return _0x45f16b;};'use strict';var _=require(_0x1117('0x0'));var util=require(_0x1117('0x1'));var moment=require(_0x1117('0x2'));var BPromise=require('bluebird');var rs=require(_0x1117('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1117('0x4'))['db'];var utils=require(_0x1117('0x5'));var logger=require(_0x1117('0x6'))(_0x1117('0x7'));var config=require(_0x1117('0x8'));var jayson=require(_0x1117('0x9'));var client=jayson[_0x1117('0xa')][_0x1117('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x508d5c,_0x4439af,_0x275d79){return new BPromise(function(_0x1c0dd7,_0x3ce174){return client[_0x1117('0xc')](_0x508d5c,_0x275d79)[_0x1117('0xd')](function(_0x2fb9c7){logger['info'](_0x1117('0xe'),_0x4439af,_0x1117('0xf'));logger[_0x1117('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4439af,_0x1117('0xf'),JSON[_0x1117('0x11')](_0x2fb9c7));if(_0x2fb9c7[_0x1117('0x12')]){if(_0x2fb9c7[_0x1117('0x12')][_0x1117('0x13')]===0x1f4){logger['error'](_0x1117('0xe'),_0x4439af,_0x2fb9c7[_0x1117('0x12')][_0x1117('0x14')]);return _0x3ce174(_0x2fb9c7[_0x1117('0x12')]['message']);}logger[_0x1117('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x4439af,_0x2fb9c7[_0x1117('0x12')][_0x1117('0x14')]);return _0x1c0dd7(_0x2fb9c7['error'][_0x1117('0x14')]);}else{logger[_0x1117('0x15')]('ZohoConfiguration,\x20%s,\x20%s',_0x4439af,_0x1117('0xf'));_0x1c0dd7(_0x2fb9c7[_0x1117('0x16')][_0x1117('0x14')]);}})[_0x1117('0x17')](function(_0x2537e1){logger[_0x1117('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x4439af,_0x2537e1);_0x3ce174(_0x2537e1);});});} \ No newline at end of file +var _0xc750=['error','code','message','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xc750,0x8d));var _0x0c75=function(_0x35763d,_0x5f3a33){_0x35763d=_0x35763d-0x0;var _0xda9fcc=_0xc750[_0x35763d];return _0xda9fcc;};'use strict';var _=require(_0x0c75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0c75('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c75('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c75('0x3'));var logger=require(_0x0c75('0x4'))(_0x0c75('0x5'));var config=require(_0x0c75('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0c75('0x7')][_0x0c75('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5148a4,_0x21e580,_0x203aaf){return new BPromise(function(_0x526862,_0x1c40e8){return client[_0x0c75('0x9')](_0x5148a4,_0x203aaf)['then'](function(_0xdf823d){logger['info'](_0x0c75('0xa'),_0x21e580,_0x0c75('0xb'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x21e580,'request\x20sent',JSON['stringify'](_0xdf823d));if(_0xdf823d[_0x0c75('0xc')]){if(_0xdf823d[_0x0c75('0xc')][_0x0c75('0xd')]===0x1f4){logger[_0x0c75('0xc')](_0x0c75('0xa'),_0x21e580,_0xdf823d[_0x0c75('0xc')]['message']);return _0x1c40e8(_0xdf823d[_0x0c75('0xc')]['message']);}logger[_0x0c75('0xc')](_0x0c75('0xa'),_0x21e580,_0xdf823d[_0x0c75('0xc')][_0x0c75('0xe')]);return _0x526862(_0xdf823d['error']['message']);}else{logger['info'](_0x0c75('0xa'),_0x21e580,_0x0c75('0xb'));_0x526862(_0xdf823d[_0x0c75('0xf')][_0x0c75('0xe')]);}})[_0x0c75('0x10')](function(_0x203038){logger[_0x0c75('0xc')](_0x0c75('0xa'),_0x21e580,_0x203038);_0x1c40e8(_0x203038);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c07ffec..2997670 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 _0x76e4=['../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x1bd893,_0x45bf29){var _0x4e6e46=function(_0x3d0424){while(--_0x3d0424){_0x1bd893['push'](_0x1bd893['shift']());}};_0x4e6e46(++_0x45bf29);}(_0x76e4,0xb8));var _0x476e=function(_0xe2d6a0,_0x5d4ee2){_0xe2d6a0=_0xe2d6a0-0x0;var _0x17b9c3=_0x76e4[_0xe2d6a0];return _0x17b9c3;};'use strict';var multer=require(_0x476e('0x0'));var util=require(_0x476e('0x1'));var path=require(_0x476e('0x2'));var timeout=require(_0x476e('0x3'));var express=require('express');var router=express[_0x476e('0x4')]();var fs_extra=require(_0x476e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x476e('0x6'));var config=require('../../config/environment');var controller=require(_0x476e('0x7'));router[_0x476e('0x8')]('/',auth[_0x476e('0x9')](),controller[_0x476e('0xa')]);router[_0x476e('0x8')](_0x476e('0xb'),auth[_0x476e('0x9')](),controller[_0x476e('0xc')]);router[_0x476e('0xd')]('/',auth[_0x476e('0x9')](),controller[_0x476e('0xe')]);router[_0x476e('0xf')](_0x476e('0xb'),auth['isAuthenticated'](),controller[_0x476e('0x10')]);router[_0x476e('0x11')]('/:id',auth[_0x476e('0x9')](),controller['destroy']);module[_0x476e('0x12')]=router; \ No newline at end of file +var _0xaf93=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path'];(function(_0x1a2d7e,_0x9a8e1f){var _0x47939a=function(_0x3aa8ce){while(--_0x3aa8ce){_0x1a2d7e['push'](_0x1a2d7e['shift']());}};_0x47939a(++_0x9a8e1f);}(_0xaf93,0x1e3));var _0x3af9=function(_0x307746,_0x3c5f24){_0x307746=_0x307746-0x0;var _0x2cdccb=_0xaf93[_0x307746];return _0x2cdccb;};'use strict';var multer=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var path=require(_0x3af9('0x2'));var timeout=require('connect-timeout');var express=require(_0x3af9('0x3'));var router=express[_0x3af9('0x4')]();var fs_extra=require(_0x3af9('0x5'));var auth=require(_0x3af9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3af9('0x7'));var controller=require('./intZohoField.controller');router[_0x3af9('0x8')]('/',auth[_0x3af9('0x9')](),controller[_0x3af9('0xa')]);router[_0x3af9('0x8')](_0x3af9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3af9('0xc')]('/',auth['isAuthenticated'](),controller[_0x3af9('0xd')]);router[_0x3af9('0xe')](_0x3af9('0xb'),auth[_0x3af9('0x9')](),controller[_0x3af9('0xf')]);router[_0x3af9('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3af9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 1c802bf..464ec27 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 _0x773f=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2d4c2d,_0x3a7895){var _0x25f284=function(_0x38c119){while(--_0x38c119){_0x2d4c2d['push'](_0x2d4c2d['shift']());}};_0x25f284(++_0x3a7895);}(_0x773f,0x15e));var _0xf773=function(_0x1ce236,_0xca922e){_0x1ce236=_0x1ce236-0x0;var _0x241819=_0x773f[_0x1ce236];return _0x241819;};'use strict';var Sequelize=require(_0xf773('0x0'));module[_0xf773('0x1')]={'type':{'type':Sequelize[_0xf773('0x2')](_0xf773('0x3'),_0xf773('0x4'),_0xf773('0x5'),_0xf773('0x6'),_0xf773('0x7')),'defaultValue':_0xf773('0x3')},'content':{'type':Sequelize[_0xf773('0x8')]},'key':{'type':Sequelize[_0xf773('0x8')]},'keyType':{'type':Sequelize[_0xf773('0x2')](_0xf773('0x3'),_0xf773('0x4'),_0xf773('0x5'))},'keyContent':{'type':Sequelize[_0xf773('0x8')]},'idField':{'type':Sequelize[_0xf773('0x8')]},'nameField':{'type':Sequelize[_0xf773('0x8')]},'customField':{'type':Sequelize[_0xf773('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf773('0x8')]}}; \ No newline at end of file +var _0x4dbc=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x387279,_0x20fc9c){var _0x57fa3b=function(_0xfcabe8){while(--_0xfcabe8){_0x387279['push'](_0x387279['shift']());}};_0x57fa3b(++_0x20fc9c);}(_0x4dbc,0x13b));var _0xc4db=function(_0x552b4e,_0x219578){_0x552b4e=_0x552b4e-0x0;var _0x48575c=_0x4dbc[_0x552b4e];return _0x48575c;};'use strict';var Sequelize=require(_0xc4db('0x0'));module[_0xc4db('0x1')]={'type':{'type':Sequelize[_0xc4db('0x2')](_0xc4db('0x3'),_0xc4db('0x4'),'customVariable',_0xc4db('0x5'),_0xc4db('0x6')),'defaultValue':_0xc4db('0x3')},'content':{'type':Sequelize[_0xc4db('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc4db('0x2')](_0xc4db('0x3'),_0xc4db('0x4'),_0xc4db('0x8'))},'keyContent':{'type':Sequelize[_0xc4db('0x7')]},'idField':{'type':Sequelize[_0xc4db('0x7')]},'nameField':{'type':Sequelize[_0xc4db('0x7')]},'customField':{'type':Sequelize[_0xc4db('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc4db('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 2fe8832..a9c8b5a 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 _0xe667=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','ZohoField','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x47a54c,_0x22229c){var _0x33abad=function(_0x1b7816){while(--_0x1b7816){_0x47a54c['push'](_0x47a54c['shift']());}};_0x33abad(++_0x22229c);}(_0xe667,0x10c));var _0x7e66=function(_0x466a2f,_0x1ff91d){_0x466a2f=_0x466a2f-0x0;var _0x16be9c=_0xe667[_0x466a2f];return _0x16be9c;};'use strict';var emlformat=require(_0x7e66('0x0'));var rimraf=require(_0x7e66('0x1'));var zipdir=require(_0x7e66('0x2'));var jsonpatch=require(_0x7e66('0x3'));var rp=require('request-promise');var moment=require(_0x7e66('0x4'));var BPromise=require(_0x7e66('0x5'));var Mustache=require(_0x7e66('0x6'));var util=require(_0x7e66('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7e66('0x8'));var fs=require('fs');var fs_extra=require(_0x7e66('0x9'));var _=require('lodash');var squel=require(_0x7e66('0xa'));var crypto=require(_0x7e66('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e66('0xc'));var querystring=require('querystring');var Papa=require(_0x7e66('0xd'));var Redis=require('ioredis');var authService=require(_0x7e66('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7e66('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e66('0x10'))(_0x7e66('0x11'));var utils=require(_0x7e66('0x12'));var config=require(_0x7e66('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e66('0x14'))['db'];function respondWithStatusCode(_0x58660c,_0x5d6824){_0x5d6824=_0x5d6824||0xcc;return function(_0x3b0895){if(_0x3b0895){return _0x58660c[_0x7e66('0x15')](_0x5d6824);}return _0x58660c['status'](_0x5d6824)[_0x7e66('0x16')]();};}function respondWithResult(_0x35e0ce,_0x3468b9){_0x3468b9=_0x3468b9||0xc8;return function(_0x3315db){if(_0x3315db){return _0x35e0ce['status'](_0x3468b9)['json'](_0x3315db);}};}function respondWithFilteredResult(_0x33fb7b,_0x48d320){return function(_0x581693){if(_0x581693){var _0x540131=typeof _0x48d320[_0x7e66('0x17')]===_0x7e66('0x18')&&typeof _0x48d320[_0x7e66('0x19')]===_0x7e66('0x18');var _0x1ab2e8=_0x581693[_0x7e66('0x1a')];var _0x3d8f44=_0x540131?0x0:_0x48d320[_0x7e66('0x17')];var _0x1b1b3d=_0x540131?_0x581693[_0x7e66('0x1a')]:_0x48d320['offset']+_0x48d320[_0x7e66('0x19')];var _0x1864d7;if(_0x1b1b3d>=_0x1ab2e8){_0x1b1b3d=_0x1ab2e8;_0x1864d7=0xc8;}else{_0x1864d7=0xce;}_0x33fb7b[_0x7e66('0x1b')](_0x1864d7);return _0x33fb7b['set'](_0x7e66('0x1c'),_0x3d8f44+'-'+_0x1b1b3d+'/'+_0x1ab2e8)[_0x7e66('0x1d')](_0x581693);}return null;};}function patchUpdates(_0x175e6d){return function(_0xeb4ea0){try{jsonpatch[_0x7e66('0x1e')](_0xeb4ea0,_0x175e6d,!![]);}catch(_0x4e03cc){return BPromise['reject'](_0x4e03cc);}return _0xeb4ea0[_0x7e66('0x1f')]();};}function saveUpdates(_0x3e3db3,_0x112a26){return function(_0x1b774e){if(_0x1b774e){return _0x1b774e[_0x7e66('0x20')](_0x3e3db3)[_0x7e66('0x21')](function(_0x365c34){return _0x365c34;});}return null;};}function removeEntity(_0x275d0d,_0x1c4e13){return function(_0x2433c1){if(_0x2433c1){return _0x2433c1[_0x7e66('0x22')]()[_0x7e66('0x21')](function(){_0x275d0d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4db287,_0x46d755){return function(_0x113b5f){if(!_0x113b5f){_0x4db287['sendStatus'](0x194);}return _0x113b5f;};}function handleError(_0xda4008,_0x3696a1){_0x3696a1=_0x3696a1||0x1f4;return function(_0x2cef06){logger[_0x7e66('0x23')](_0x2cef06[_0x7e66('0x24')]);if(_0x2cef06[_0x7e66('0x25')]){delete _0x2cef06[_0x7e66('0x25')];}_0xda4008[_0x7e66('0x1b')](_0x3696a1)[_0x7e66('0x26')](_0x2cef06);};}exports[_0x7e66('0x27')]=function(_0xb5880b,_0x42f8ed){var _0x2e6042={},_0x1afd74={},_0x1ad945={'count':0x0,'rows':[]};var _0x211683=_['map'](db[_0x7e66('0x28')]['rawAttributes'],function(_0x59f8d2){return{'name':_0x59f8d2[_0x7e66('0x29')],'type':_0x59f8d2[_0x7e66('0x2a')][_0x7e66('0x2b')]};});_0x1afd74[_0x7e66('0x2c')]=_[_0x7e66('0x2d')](_0x211683,_0x7e66('0x25'));_0x1afd74[_0x7e66('0x2e')]=_['keys'](_0xb5880b[_0x7e66('0x2e')]);_0x1afd74[_0x7e66('0x2f')]=_['intersection'](_0x1afd74[_0x7e66('0x2c')],_0x1afd74['query']);_0x2e6042['attributes']=_[_0x7e66('0x30')](_0x1afd74['model'],qs[_0x7e66('0x31')](_0xb5880b[_0x7e66('0x2e')][_0x7e66('0x31')]));_0x2e6042[_0x7e66('0x32')]=_0x2e6042[_0x7e66('0x32')][_0x7e66('0x33')]?_0x2e6042[_0x7e66('0x32')]:_0x1afd74[_0x7e66('0x2c')];if(!_0xb5880b['query'][_0x7e66('0x34')](_0x7e66('0x35'))){_0x2e6042[_0x7e66('0x19')]=qs['limit'](_0xb5880b[_0x7e66('0x2e')]['limit']);_0x2e6042[_0x7e66('0x17')]=qs['offset'](_0xb5880b[_0x7e66('0x2e')][_0x7e66('0x17')]);}_0x2e6042[_0x7e66('0x36')]=qs[_0x7e66('0x37')](_0xb5880b[_0x7e66('0x2e')][_0x7e66('0x37')]);_0x2e6042[_0x7e66('0x38')]=qs[_0x7e66('0x2f')](_['pick'](_0xb5880b[_0x7e66('0x2e')],_0x1afd74[_0x7e66('0x2f')]),_0x211683);if(_0xb5880b[_0x7e66('0x2e')][_0x7e66('0x39')]){_0x2e6042[_0x7e66('0x38')]=_[_0x7e66('0x3a')](_0x2e6042[_0x7e66('0x38')],{'$or':_[_0x7e66('0x2d')](_0x211683,function(_0x270516){if(_0x270516['type']!==_0x7e66('0x3b')){var _0x2b87a2={};_0x2b87a2[_0x270516[_0x7e66('0x25')]]={'$like':'%'+_0xb5880b[_0x7e66('0x2e')]['filter']+'%'};return _0x2b87a2;}})});}_0x2e6042=_[_0x7e66('0x3a')]({},_0x2e6042,_0xb5880b[_0x7e66('0x3c')]);var _0x2f140e={'where':_0x2e6042[_0x7e66('0x38')]};return db[_0x7e66('0x28')][_0x7e66('0x1a')](_0x2f140e)[_0x7e66('0x21')](function(_0x3a292a){_0x1ad945[_0x7e66('0x1a')]=_0x3a292a;if(_0xb5880b[_0x7e66('0x2e')][_0x7e66('0x3d')]){_0x2e6042[_0x7e66('0x3e')]=[{'all':!![]}];}return db[_0x7e66('0x28')][_0x7e66('0x3f')](_0x2e6042);})[_0x7e66('0x21')](function(_0x7d3b34){_0x1ad945['rows']=_0x7d3b34;return _0x1ad945;})[_0x7e66('0x21')](respondWithFilteredResult(_0x42f8ed,_0x2e6042))[_0x7e66('0x40')](handleError(_0x42f8ed,null));};exports['show']=function(_0x217a35,_0x1c3af9){var _0xb447ab={'raw':!![],'where':{'id':_0x217a35[_0x7e66('0x41')]['id']}},_0xafa651={};_0xafa651[_0x7e66('0x2c')]=_[_0x7e66('0x42')](db['ZohoField'][_0x7e66('0x43')]);_0xafa651['query']=_[_0x7e66('0x42')](_0x217a35[_0x7e66('0x2e')]);_0xafa651[_0x7e66('0x2f')]=_[_0x7e66('0x30')](_0xafa651[_0x7e66('0x2c')],_0xafa651[_0x7e66('0x2e')]);_0xb447ab[_0x7e66('0x32')]=_[_0x7e66('0x30')](_0xafa651[_0x7e66('0x2c')],qs[_0x7e66('0x31')](_0x217a35[_0x7e66('0x2e')]['fields']));_0xb447ab[_0x7e66('0x32')]=_0xb447ab[_0x7e66('0x32')][_0x7e66('0x33')]?_0xb447ab[_0x7e66('0x32')]:_0xafa651[_0x7e66('0x2c')];if(_0x217a35[_0x7e66('0x2e')][_0x7e66('0x3d')]){_0xb447ab['include']=[{'all':!![]}];}_0xb447ab=_['merge']({},_0xb447ab,_0x217a35[_0x7e66('0x3c')]);return db[_0x7e66('0x28')][_0x7e66('0x44')](_0xb447ab)['then'](handleEntityNotFound(_0x1c3af9,null))['then'](respondWithResult(_0x1c3af9,null))[_0x7e66('0x40')](handleError(_0x1c3af9,null));};exports['create']=function(_0x5f2727,_0x324594){return db[_0x7e66('0x28')][_0x7e66('0x45')](_0x5f2727[_0x7e66('0x46')],{})[_0x7e66('0x21')](respondWithResult(_0x324594,0xc9))[_0x7e66('0x40')](handleError(_0x324594,null));};exports[_0x7e66('0x20')]=function(_0x2911c6,_0x412340){if(_0x2911c6[_0x7e66('0x46')]['id']){delete _0x2911c6[_0x7e66('0x46')]['id'];}return db['ZohoField'][_0x7e66('0x44')]({'where':{'id':_0x2911c6['params']['id']}})[_0x7e66('0x21')](handleEntityNotFound(_0x412340,null))[_0x7e66('0x21')](saveUpdates(_0x2911c6['body'],null))[_0x7e66('0x21')](respondWithResult(_0x412340,null))['catch'](handleError(_0x412340,null));};exports[_0x7e66('0x22')]=function(_0x12248a,_0x3b8f5a){return db[_0x7e66('0x28')][_0x7e66('0x44')]({'where':{'id':_0x12248a['params']['id']}})[_0x7e66('0x21')](handleEntityNotFound(_0x3b8f5a,null))[_0x7e66('0x21')](removeEntity(_0x3b8f5a,null))[_0x7e66('0x40')](handleError(_0x3b8f5a,null));}; \ No newline at end of file +var _0x4108=['query','keys','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','ZohoField','includeAll','rows','show','length','include','find','catch','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model'];(function(_0x5892ba,_0x22a993){var _0x49b1b4=function(_0x36b143){while(--_0x36b143){_0x5892ba['push'](_0x5892ba['shift']());}};_0x49b1b4(++_0x22a993);}(_0x4108,0x69));var _0x8410=function(_0x272923,_0x40a0ea){_0x272923=_0x272923-0x0;var _0x23e643=_0x4108[_0x272923];return _0x23e643;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8410('0x0'));var zipdir=require(_0x8410('0x1'));var jsonpatch=require(_0x8410('0x2'));var rp=require(_0x8410('0x3'));var moment=require(_0x8410('0x4'));var BPromise=require(_0x8410('0x5'));var Mustache=require(_0x8410('0x6'));var util=require('util');var path=require(_0x8410('0x7'));var sox=require(_0x8410('0x8'));var csv=require('to-csv');var ejs=require(_0x8410('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8410('0xa'));var squel=require(_0x8410('0xb'));var crypto=require(_0x8410('0xc'));var jsforce=require(_0x8410('0xd'));var deskjs=require(_0x8410('0xe'));var toCsv=require(_0x8410('0xf'));var querystring=require(_0x8410('0x10'));var Papa=require(_0x8410('0x11'));var Redis=require(_0x8410('0x12'));var authService=require(_0x8410('0x13'));var qs=require(_0x8410('0x14'));var as=require(_0x8410('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8410('0x16'))(_0x8410('0x17'));var utils=require(_0x8410('0x18'));var config=require(_0x8410('0x19'));var licenseUtil=require(_0x8410('0x1a'));var db=require(_0x8410('0x1b'))['db'];function respondWithStatusCode(_0x4e9018,_0x27e215){_0x27e215=_0x27e215||0xcc;return function(_0x51d049){if(_0x51d049){return _0x4e9018[_0x8410('0x1c')](_0x27e215);}return _0x4e9018[_0x8410('0x1d')](_0x27e215)[_0x8410('0x1e')]();};}function respondWithResult(_0x35d66f,_0x20e3f2){_0x20e3f2=_0x20e3f2||0xc8;return function(_0x37fee9){if(_0x37fee9){return _0x35d66f[_0x8410('0x1d')](_0x20e3f2)[_0x8410('0x1f')](_0x37fee9);}};}function respondWithFilteredResult(_0x22bd82,_0x573608){return function(_0x46a6c7){if(_0x46a6c7){var _0x314ac1=typeof _0x573608[_0x8410('0x20')]==='undefined'&&typeof _0x573608[_0x8410('0x21')]==='undefined';var _0x58bbdb=_0x46a6c7['count'];var _0x7e9652=_0x314ac1?0x0:_0x573608[_0x8410('0x20')];var _0x3f44c6=_0x314ac1?_0x46a6c7[_0x8410('0x22')]:_0x573608[_0x8410('0x20')]+_0x573608[_0x8410('0x21')];var _0x217d4b;if(_0x3f44c6>=_0x58bbdb){_0x3f44c6=_0x58bbdb;_0x217d4b=0xc8;}else{_0x217d4b=0xce;}_0x22bd82[_0x8410('0x1d')](_0x217d4b);return _0x22bd82[_0x8410('0x23')](_0x8410('0x24'),_0x7e9652+'-'+_0x3f44c6+'/'+_0x58bbdb)[_0x8410('0x1f')](_0x46a6c7);}return null;};}function patchUpdates(_0x40957a){return function(_0x34abe0){try{jsonpatch['apply'](_0x34abe0,_0x40957a,!![]);}catch(_0x5c54a9){return BPromise[_0x8410('0x25')](_0x5c54a9);}return _0x34abe0[_0x8410('0x26')]();};}function saveUpdates(_0x43dbeb,_0x1bb44c){return function(_0x2a2123){if(_0x2a2123){return _0x2a2123[_0x8410('0x27')](_0x43dbeb)[_0x8410('0x28')](function(_0x300026){return _0x300026;});}return null;};}function removeEntity(_0x315c0a,_0x2a48e9){return function(_0x169843){if(_0x169843){return _0x169843[_0x8410('0x29')]()[_0x8410('0x28')](function(){_0x315c0a['status'](0xcc)[_0x8410('0x1e')]();});}};}function handleEntityNotFound(_0x517a93,_0x1c9855){return function(_0x1a4334){if(!_0x1a4334){_0x517a93[_0x8410('0x1c')](0x194);}return _0x1a4334;};}function handleError(_0xd16e50,_0x828b6b){_0x828b6b=_0x828b6b||0x1f4;return function(_0x63f8d9){logger[_0x8410('0x2a')](_0x63f8d9[_0x8410('0x2b')]);if(_0x63f8d9[_0x8410('0x2c')]){delete _0x63f8d9['name'];}_0xd16e50['status'](_0x828b6b)[_0x8410('0x2d')](_0x63f8d9);};}exports['index']=function(_0x336416,_0x5ee350){var _0x2900c6={},_0x3bb723={},_0x578c21={'count':0x0,'rows':[]};var _0x4723cf=_[_0x8410('0x2e')](db['ZohoField'][_0x8410('0x2f')],function(_0x5e4725){return{'name':_0x5e4725[_0x8410('0x30')],'type':_0x5e4725['type'][_0x8410('0x31')]};});_0x3bb723[_0x8410('0x32')]=_[_0x8410('0x2e')](_0x4723cf,'name');_0x3bb723[_0x8410('0x33')]=_[_0x8410('0x34')](_0x336416[_0x8410('0x33')]);_0x3bb723['filters']=_['intersection'](_0x3bb723[_0x8410('0x32')],_0x3bb723[_0x8410('0x33')]);_0x2900c6[_0x8410('0x35')]=_[_0x8410('0x36')](_0x3bb723[_0x8410('0x32')],qs[_0x8410('0x37')](_0x336416[_0x8410('0x33')]['fields']));_0x2900c6[_0x8410('0x35')]=_0x2900c6[_0x8410('0x35')]['length']?_0x2900c6[_0x8410('0x35')]:_0x3bb723['model'];if(!_0x336416['query']['hasOwnProperty'](_0x8410('0x38'))){_0x2900c6['limit']=qs[_0x8410('0x21')](_0x336416[_0x8410('0x33')][_0x8410('0x21')]);_0x2900c6['offset']=qs[_0x8410('0x20')](_0x336416['query']['offset']);}_0x2900c6[_0x8410('0x39')]=qs[_0x8410('0x3a')](_0x336416[_0x8410('0x33')][_0x8410('0x3a')]);_0x2900c6[_0x8410('0x3b')]=qs[_0x8410('0x3c')](_[_0x8410('0x3d')](_0x336416['query'],_0x3bb723['filters']),_0x4723cf);if(_0x336416[_0x8410('0x33')]['filter']){_0x2900c6[_0x8410('0x3b')]=_[_0x8410('0x3e')](_0x2900c6[_0x8410('0x3b')],{'$or':_[_0x8410('0x2e')](_0x4723cf,function(_0x2ff14e){if(_0x2ff14e[_0x8410('0x3f')]!==_0x8410('0x40')){var _0x7567f5={};_0x7567f5[_0x2ff14e['name']]={'$like':'%'+_0x336416[_0x8410('0x33')][_0x8410('0x41')]+'%'};return _0x7567f5;}})});}_0x2900c6=_['merge']({},_0x2900c6,_0x336416[_0x8410('0x42')]);var _0x4e63d0={'where':_0x2900c6[_0x8410('0x3b')]};return db[_0x8410('0x43')][_0x8410('0x22')](_0x4e63d0)[_0x8410('0x28')](function(_0x31b862){_0x578c21[_0x8410('0x22')]=_0x31b862;if(_0x336416[_0x8410('0x33')][_0x8410('0x44')]){_0x2900c6['include']=[{'all':!![]}];}return db[_0x8410('0x43')]['findAll'](_0x2900c6);})[_0x8410('0x28')](function(_0x18c999){_0x578c21[_0x8410('0x45')]=_0x18c999;return _0x578c21;})[_0x8410('0x28')](respondWithFilteredResult(_0x5ee350,_0x2900c6))['catch'](handleError(_0x5ee350,null));};exports[_0x8410('0x46')]=function(_0x40c6bc,_0x3fdeb8){var _0x3fa7dd={'raw':!![],'where':{'id':_0x40c6bc['params']['id']}},_0x3012f5={};_0x3012f5[_0x8410('0x32')]=_['keys'](db[_0x8410('0x43')][_0x8410('0x2f')]);_0x3012f5[_0x8410('0x33')]=_[_0x8410('0x34')](_0x40c6bc['query']);_0x3012f5[_0x8410('0x3c')]=_[_0x8410('0x36')](_0x3012f5[_0x8410('0x32')],_0x3012f5[_0x8410('0x33')]);_0x3fa7dd['attributes']=_[_0x8410('0x36')](_0x3012f5[_0x8410('0x32')],qs[_0x8410('0x37')](_0x40c6bc[_0x8410('0x33')]['fields']));_0x3fa7dd[_0x8410('0x35')]=_0x3fa7dd[_0x8410('0x35')][_0x8410('0x47')]?_0x3fa7dd[_0x8410('0x35')]:_0x3012f5[_0x8410('0x32')];if(_0x40c6bc[_0x8410('0x33')]['includeAll']){_0x3fa7dd[_0x8410('0x48')]=[{'all':!![]}];}_0x3fa7dd=_[_0x8410('0x3e')]({},_0x3fa7dd,_0x40c6bc[_0x8410('0x42')]);return db[_0x8410('0x43')][_0x8410('0x49')](_0x3fa7dd)[_0x8410('0x28')](handleEntityNotFound(_0x3fdeb8,null))[_0x8410('0x28')](respondWithResult(_0x3fdeb8,null))[_0x8410('0x4a')](handleError(_0x3fdeb8,null));};exports[_0x8410('0x4b')]=function(_0x33f347,_0x364359){return db['ZohoField'][_0x8410('0x4b')](_0x33f347['body'],{})[_0x8410('0x28')](respondWithResult(_0x364359,0xc9))[_0x8410('0x4a')](handleError(_0x364359,null));};exports[_0x8410('0x27')]=function(_0x5714b4,_0x1146f2){if(_0x5714b4[_0x8410('0x4c')]['id']){delete _0x5714b4[_0x8410('0x4c')]['id'];}return db['ZohoField'][_0x8410('0x49')]({'where':{'id':_0x5714b4[_0x8410('0x4d')]['id']}})[_0x8410('0x28')](handleEntityNotFound(_0x1146f2,null))['then'](saveUpdates(_0x5714b4[_0x8410('0x4c')],null))[_0x8410('0x28')](respondWithResult(_0x1146f2,null))[_0x8410('0x4a')](handleError(_0x1146f2,null));};exports[_0x8410('0x29')]=function(_0x27e374,_0x1bf8dd){return db[_0x8410('0x43')][_0x8410('0x49')]({'where':{'id':_0x27e374[_0x8410('0x4d')]['id']}})[_0x8410('0x28')](handleEntityNotFound(_0x1bf8dd,null))[_0x8410('0x28')](removeEntity(_0x1bf8dd,null))[_0x8410('0x4a')](handleError(_0x1bf8dd,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 5c4dab6..911a2f0 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 _0x32b6=['int_zoho_fields','idField','FieldId','lodash','util','api','moment','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField'];(function(_0x15b1cd,_0x2db0c5){var _0x73f160=function(_0x23dd5c){while(--_0x23dd5c){_0x15b1cd['push'](_0x15b1cd['shift']());}};_0x73f160(++_0x2db0c5);}(_0x32b6,0x1d1));var _0x632b=function(_0x479d81,_0x401ddb){_0x479d81=_0x479d81-0x0;var _0x1edf66=_0x32b6[_0x479d81];return _0x1edf66;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require('../../config/logger')(_0x632b('0x2'));var moment=require(_0x632b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var attributes=require(_0x632b('0x7'));module[_0x632b('0x8')]=function(_0x122768,_0x24ceab){return _0x122768[_0x632b('0x9')](_0x632b('0xa'),attributes,{'tableName':_0x632b('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x632b('0xc'),_0x632b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','idField','FieldId'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6d38[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x86d3('0x9'),_0x86d3('0xa')],'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 d033801..80cdb3c 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 _0x37bd=['message','info','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x322410,_0x1bce3a){var _0x4f31cd=function(_0x565777){while(--_0x565777){_0x322410['push'](_0x322410['shift']());}};_0x4f31cd(++_0x1bce3a);}(_0x37bd,0x1a0));var _0xd37b=function(_0x52ff7d,_0x8d1675){_0x52ff7d=_0x52ff7d-0x0;var _0x5142a4=_0x37bd[_0x52ff7d];return _0x5142a4;};'use strict';var _=require(_0xd37b('0x0'));var util=require(_0xd37b('0x1'));var moment=require(_0xd37b('0x2'));var BPromise=require(_0xd37b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd37b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd37b('0x5'));var logger=require(_0xd37b('0x6'))(_0xd37b('0x7'));var config=require(_0xd37b('0x8'));var jayson=require(_0xd37b('0x9'));var client=jayson[_0xd37b('0xa')][_0xd37b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4906c7,_0x3743be,_0x3b2677){return new BPromise(function(_0x24fedd,_0x42ed9a){return client[_0xd37b('0xc')](_0x4906c7,_0x3b2677)[_0xd37b('0xd')](function(_0x2a5048){logger['info'](_0xd37b('0xe'),_0x3743be,_0xd37b('0xf'));logger[_0xd37b('0x10')](_0xd37b('0x11'),_0x3743be,_0xd37b('0xf'),JSON[_0xd37b('0x12')](_0x2a5048));if(_0x2a5048[_0xd37b('0x13')]){if(_0x2a5048['error'][_0xd37b('0x14')]===0x1f4){logger[_0xd37b('0x13')]('ZohoField,\x20%s,\x20%s',_0x3743be,_0x2a5048['error'][_0xd37b('0x15')]);return _0x42ed9a(_0x2a5048[_0xd37b('0x13')][_0xd37b('0x15')]);}logger[_0xd37b('0x13')](_0xd37b('0xe'),_0x3743be,_0x2a5048[_0xd37b('0x13')][_0xd37b('0x15')]);return _0x24fedd(_0x2a5048[_0xd37b('0x13')][_0xd37b('0x15')]);}else{logger[_0xd37b('0x16')](_0xd37b('0xe'),_0x3743be,'request\x20sent');_0x24fedd(_0x2a5048['result'][_0xd37b('0x15')]);}})['catch'](function(_0x20096a){logger[_0xd37b('0x13')]('ZohoField,\x20%s,\x20%s',_0x3743be,_0x20096a);_0x42ed9a(_0x20096a);});});} \ No newline at end of file +var _0x3266=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4387a6,_0x514cbc){var _0x51aecd=function(_0x35475b){while(--_0x35475b){_0x4387a6['push'](_0x4387a6['shift']());}};_0x51aecd(++_0x514cbc);}(_0x3266,0x185));var _0x6326=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x3266[_0x4063a4];return _0x17908d;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));var BPromise=require(_0x6326('0x3'));var rs=require(_0x6326('0x4'));var fs=require('fs');var Redis=require(_0x6326('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6326('0x6'));var logger=require(_0x6326('0x7'))(_0x6326('0x8'));var config=require(_0x6326('0x9'));var jayson=require(_0x6326('0xa'));var client=jayson[_0x6326('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e530a,_0x42d7eb,_0x3f7a75){return new BPromise(function(_0x34a13d,_0x14af63){return client['request'](_0x5e530a,_0x3f7a75)['then'](function(_0x7ef052){logger[_0x6326('0xc')](_0x6326('0xd'),_0x42d7eb,_0x6326('0xe'));logger[_0x6326('0xf')](_0x6326('0x10'),_0x42d7eb,_0x6326('0xe'),JSON[_0x6326('0x11')](_0x7ef052));if(_0x7ef052[_0x6326('0x12')]){if(_0x7ef052[_0x6326('0x12')][_0x6326('0x13')]===0x1f4){logger[_0x6326('0x12')](_0x6326('0xd'),_0x42d7eb,_0x7ef052[_0x6326('0x12')][_0x6326('0x14')]);return _0x14af63(_0x7ef052[_0x6326('0x12')][_0x6326('0x14')]);}logger[_0x6326('0x12')](_0x6326('0xd'),_0x42d7eb,_0x7ef052['error'][_0x6326('0x14')]);return _0x34a13d(_0x7ef052[_0x6326('0x12')][_0x6326('0x14')]);}else{logger[_0x6326('0xc')](_0x6326('0xd'),_0x42d7eb,_0x6326('0xe'));_0x34a13d(_0x7ef052[_0x6326('0x15')][_0x6326('0x14')]);}})[_0x6326('0x16')](function(_0x117156){logger[_0x6326('0x12')](_0x6326('0xd'),_0x42d7eb,_0x117156);_0x14af63(_0x117156);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 27b3ca2..8b28fd7 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4b4340,_0x295fc0){var _0x4cdb42=function(_0x1a7231){while(--_0x1a7231){_0x4b4340['push'](_0x4b4340['shift']());}};_0x4cdb42(++_0x295fc0);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x470496,_0x273336){var _0x28b598=function(_0x463c71){while(--_0x463c71){_0x470496['push'](_0x470496['shift']());}};_0x28b598(++_0x273336);}(_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 2c1d506..8918283 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 _0xb49a=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x58c147,_0x1b3535){var _0x404af6=function(_0x33d2c9){while(--_0x33d2c9){_0x58c147['push'](_0x58c147['shift']());}};_0x404af6(++_0x1b3535);}(_0xb49a,0xfb));var _0xab49=function(_0x531a94,_0xbf2864){_0x531a94=_0x531a94-0x0;var _0x4ad3e1=_0xb49a[_0x531a94];return _0x4ad3e1;};'use strict';var Sequelize=require(_0xab49('0x0'));module[_0xab49('0x1')]={'name':{'type':Sequelize[_0xab49('0x2')],'allowNull':![],'unique':_0xab49('0x3')},'version':{'type':Sequelize[_0xab49('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xab49('0x2')],'defaultValue':_0xab49('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xab49('0x2')]},'size':{'type':Sequelize[_0xab49('0x5')]},'active':{'type':Sequelize[_0xab49('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xab49('0x2')]},'logo':{'type':Sequelize[_0xab49('0x2')]},'state':{'type':Sequelize[_0xab49('0x2')],'unique':_0xab49('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xab49('0x2')]},'remoteUri':{'type':Sequelize[_0xab49('0x2')]},'link':{'type':Sequelize[_0xab49('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x9354=['INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version','app.js'];(function(_0x1b63e4,_0x5544b9){var _0x2f5ed0=function(_0x40a172){while(--_0x40a172){_0x1b63e4['push'](_0x1b63e4['shift']());}};_0x2f5ed0(++_0x5544b9);}(_0x9354,0x96));var _0x4935=function(_0x3108d9,_0xf08d6){_0x3108d9=_0x3108d9-0x0;var _0x1455e6=_0x9354[_0x3108d9];return _0x1455e6;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'name':{'type':Sequelize[_0x4935('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x4935('0x1')],'allowNull':![],'unique':_0x4935('0x2')},'main':{'type':Sequelize[_0x4935('0x1')],'defaultValue':_0x4935('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x4935('0x1')]},'type':{'type':Sequelize[_0x4935('0x1')]},'size':{'type':Sequelize[_0x4935('0x4')]},'active':{'type':Sequelize[_0x4935('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x4935('0x1')]},'logo':{'type':Sequelize[_0x4935('0x1')]},'state':{'type':Sequelize[_0x4935('0x1')],'unique':_0x4935('0x6')},'description':{'type':Sequelize[_0x4935('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4935('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 1d13ab4..670f1c9 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 _0xc2c7=['nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','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','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2c7,0x134));var _0x7c2c=function(_0x55ba98,_0x366c41){_0x55ba98=_0x55ba98-0x0;var _0x5d0af9=_0xc2c7[_0x55ba98];return _0x5d0af9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['Integration'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['Integration'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));}; \ No newline at end of file +var _0x7096=['offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','Integration','find','catch','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x40132e,_0x395945){var _0xbcaf53=function(_0x81b47e){while(--_0x81b47e){_0x40132e['push'](_0x40132e['shift']());}};_0xbcaf53(++_0x395945);}(_0x7096,0x10c));var _0x6709=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x7096[_0x28947d];return _0x12d2ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['Integration'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['Integration'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['Integration'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['Integration']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['Integration'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 9e29b44..30642c3 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 _0x215f=['./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x3066ef,_0x4f25a1){var _0x569e9d=function(_0x5ad49a){while(--_0x5ad49a){_0x3066ef['push'](_0x3066ef['shift']());}};_0x569e9d(++_0x4f25a1);}(_0x215f,0xa1));var _0xf215=function(_0x465f20,_0x5f4e24){_0x465f20=_0x465f20-0x0;var _0x445402=_0x215f[_0x465f20];return _0x445402;};'use strict';var _=require(_0xf215('0x0'));var util=require(_0xf215('0x1'));var logger=require(_0xf215('0x2'))(_0xf215('0x3'));var moment=require(_0xf215('0x4'));var BPromise=require(_0xf215('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf215('0x6'));var config=require(_0xf215('0x7'));var attributes=require(_0xf215('0x8'));module[_0xf215('0x9')]=function(_0xe52db8,_0xf9dd86){return _0xe52db8[_0xf215('0xa')](_0xf215('0xb'),attributes,{'tableName':_0xf215('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0036=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define'];(function(_0x150c65,_0x303f38){var _0x4ca489=function(_0x2c2e26){while(--_0x2c2e26){_0x150c65['push'](_0x150c65['shift']());}};_0x4ca489(++_0x303f38);}(_0x0036,0x78));var _0x6003=function(_0xc496b9,_0x493da6){_0xc496b9=_0xc496b9-0x0;var _0x1a0044=_0x0036[_0xc496b9];return _0x1a0044;};'use strict';var _=require('lodash');var util=require(_0x6003('0x0'));var logger=require(_0x6003('0x1'))(_0x6003('0x2'));var moment=require(_0x6003('0x3'));var BPromise=require(_0x6003('0x4'));var rp=require(_0x6003('0x5'));var fs=require('fs');var path=require(_0x6003('0x6'));var rimraf=require(_0x6003('0x7'));var config=require(_0x6003('0x8'));var attributes=require(_0x6003('0x9'));module[_0x6003('0xa')]=function(_0x1a0430,_0x210f15){return _0x1a0430[_0x6003('0xb')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 8d1a6ba..5a19c9b 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'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')]('Integration,\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 _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2217bd,_0x5aef9b){var _0x4cb89f=function(_0x1412d9){while(--_0x1412d9){_0x2217bd['push'](_0x2217bd['shift']());}};_0x4cb89f(++_0x5aef9b);}(_0x7880,0x1f4));var _0x0788=function(_0x3de6c1,_0x4cb097){_0x3de6c1=_0x3de6c1-0x0;var _0x4453c8=_0x7880[_0x3de6c1];return _0x4453c8;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));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(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 91124bc..84a333c 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x4137,0xf8));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file +var _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0xc0174b,_0x5282cd){var _0x28ab53=function(_0x1ca2cb){while(--_0x1ca2cb){_0xc0174b['push'](_0xc0174b['shift']());}};_0x28ab53(++_0x5282cd);}(_0x57ca,0x108));var _0xa57c=function(_0x21930d,_0x4127f8){_0x21930d=_0x21930d-0x0;var _0x5667db=_0x57ca[_0x21930d];return _0x5667db;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 8cd440e..deb4ee3 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 _0xeb07=['ENUM','SENT','RECEIVED','FAILED','sequelize','STRING','DATE','INTEGER','BOOLEAN','TEXT'];(function(_0x58761b,_0x138b99){var _0xd29b0a=function(_0x4c3e52){while(--_0x4c3e52){_0x58761b['push'](_0x58761b['shift']());}};_0xd29b0a(++_0x138b99);}(_0xeb07,0x68));var _0x7eb0=function(_0x5e4a52,_0x28b093){_0x5e4a52=_0x5e4a52-0x0;var _0x310550=_0xeb07[_0x5e4a52];return _0x310550;};'use strict';var Sequelize=require(_0x7eb0('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x7eb0('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x7eb0('0x1')]},'uniqueid':{'type':Sequelize[_0x7eb0('0x1')]},'calleridnum':{'type':Sequelize[_0x7eb0('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7eb0('0x1')]},'interface':{'type':Sequelize[_0x7eb0('0x1')]},'membername':{'type':Sequelize[_0x7eb0('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7eb0('0x2')]},'agentconnectAt':{'type':Sequelize[_0x7eb0('0x2')]},'holdtime':{'type':Sequelize[_0x7eb0('0x3')]},'agentcomplete':{'type':Sequelize[_0x7eb0('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x7eb0('0x3')]},'agentacw':{'type':Sequelize[_0x7eb0('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x7eb0('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x7eb0('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7eb0('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7eb0('0x2')]},'lastevent':{'type':Sequelize[_0x7eb0('0x1')]},'channel':{'type':Sequelize[_0x7eb0('0x1')]},'channelstate':{'type':Sequelize[_0x7eb0('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7eb0('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7eb0('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7eb0('0x1')]},'accountcode':{'type':Sequelize[_0x7eb0('0x1')]},'context':{'type':Sequelize[_0x7eb0('0x1')]},'exten':{'type':Sequelize[_0x7eb0('0x1')]},'priority':{'type':Sequelize[_0x7eb0('0x1')]},'destchannel':{'type':Sequelize[_0x7eb0('0x1')]},'destchannelstate':{'type':Sequelize[_0x7eb0('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7eb0('0x1')]},'destcalleridname':{'type':Sequelize[_0x7eb0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7eb0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7eb0('0x1')]},'destlanguage':{'type':Sequelize[_0x7eb0('0x1')]},'destaccountcode':{'type':Sequelize[_0x7eb0('0x1')]},'destcontext':{'type':Sequelize[_0x7eb0('0x1')]},'destexten':{'type':Sequelize[_0x7eb0('0x1')]},'destpriority':{'type':Sequelize[_0x7eb0('0x1')]},'destuniqueid':{'type':Sequelize[_0x7eb0('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x7eb0('0x1')]},'subject':{'type':Sequelize[_0x7eb0('0x1')]},'from':{'type':Sequelize[_0x7eb0('0x1')]},'to':{'type':Sequelize[_0x7eb0('0x1')]},'cc':{'type':Sequelize[_0x7eb0('0x1')]},'attachment':{'type':Sequelize[_0x7eb0('0x5')]},'html':{'type':Sequelize[_0x7eb0('0x5')]},'text':{'type':Sequelize[_0x7eb0('0x5')]},'status':{'type':Sequelize[_0x7eb0('0x6')](_0x7eb0('0x7'),'SENDING',_0x7eb0('0x8'),_0x7eb0('0x9'))},'url':{'type':Sequelize[_0x7eb0('0x1')]},'app':{'type':Sequelize[_0x7eb0('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x7eb0('0x3')]}}; \ No newline at end of file +var _0x81ec=['RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING'];(function(_0x51a8ab,_0x18b605){var _0x531fad=function(_0x88f796){while(--_0x88f796){_0x51a8ab['push'](_0x51a8ab['shift']());}};_0x531fad(++_0x18b605);}(_0x81ec,0x1ba));var _0xc81e=function(_0x23b8b8,_0x178355){_0x23b8b8=_0x23b8b8-0x0;var _0x809b82=_0x81ec[_0x23b8b8];return _0x809b82;};'use strict';var Sequelize=require(_0xc81e('0x0'));module['exports']={'integration':{'type':Sequelize[_0xc81e('0x1')]},'eventChannel':{'type':Sequelize[_0xc81e('0x1')]},'exitStatus':{'type':Sequelize[_0xc81e('0x1')]},'ticketId':{'type':Sequelize[_0xc81e('0x1')]},'integrationId':{'type':Sequelize[_0xc81e('0x2')]},'contacts':{'type':Sequelize[_0xc81e('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc81e('0x1')]},'calleridname':{'type':Sequelize[_0xc81e('0x1')]},'queue':{'type':Sequelize[_0xc81e('0x1')]},'interface':{'type':Sequelize[_0xc81e('0x1')]},'membername':{'type':Sequelize[_0xc81e('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xc81e('0x3')]},'holdtime':{'type':Sequelize[_0xc81e('0x2')]},'agentcomplete':{'type':Sequelize[_0xc81e('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc81e('0x3')]},'talktime':{'type':Sequelize[_0xc81e('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc81e('0x2')]},'reason':{'type':Sequelize[_0xc81e('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc81e('0x3')]},'agentdump':{'type':Sequelize[_0xc81e('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc81e('0x3')]},'lastevent':{'type':Sequelize[_0xc81e('0x1')]},'channel':{'type':Sequelize[_0xc81e('0x1')]},'channelstate':{'type':Sequelize[_0xc81e('0x2')]},'channelstatedesc':{'type':Sequelize[_0xc81e('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc81e('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc81e('0x1')]},'accountcode':{'type':Sequelize[_0xc81e('0x1')]},'context':{'type':Sequelize[_0xc81e('0x1')]},'exten':{'type':Sequelize[_0xc81e('0x1')]},'priority':{'type':Sequelize[_0xc81e('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc81e('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xc81e('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc81e('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xc81e('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc81e('0x1')]},'destaccountcode':{'type':Sequelize[_0xc81e('0x1')]},'destcontext':{'type':Sequelize[_0xc81e('0x1')]},'destexten':{'type':Sequelize[_0xc81e('0x1')]},'destpriority':{'type':Sequelize[_0xc81e('0x1')]},'destuniqueid':{'type':Sequelize[_0xc81e('0x1')]},'messageId':{'type':Sequelize[_0xc81e('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xc81e('0x1')]},'from':{'type':Sequelize[_0xc81e('0x1')]},'to':{'type':Sequelize[_0xc81e('0x1')]},'cc':{'type':Sequelize[_0xc81e('0x1')]},'attachment':{'type':Sequelize[_0xc81e('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xc81e('0x5')]},'status':{'type':Sequelize[_0xc81e('0x6')]('SENT',_0xc81e('0x7'),_0xc81e('0x8'),_0xc81e('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xc81e('0x1')]},'appdata':{'type':Sequelize[_0xc81e('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d6307b6..b402deb 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 _0x7954=['nolimit','order','sort','where','filters','pick','merge','map','type','VIRTUAL','IntegrationReport','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','error','stack','name','index','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x401611,_0xb9a501){var _0x26c75e=function(_0x474e4b){while(--_0x474e4b){_0x401611['push'](_0x401611['shift']());}};_0x26c75e(++_0xb9a501);}(_0x7954,0x148));var _0x4795=function(_0x3f7111,_0x3c0988){_0x3f7111=_0x3f7111-0x0;var _0x216d7d=_0x7954[_0x3f7111];return _0x216d7d;};'use strict';var emlformat=require(_0x4795('0x0'));var rimraf=require(_0x4795('0x1'));var zipdir=require(_0x4795('0x2'));var jsonpatch=require(_0x4795('0x3'));var rp=require(_0x4795('0x4'));var moment=require(_0x4795('0x5'));var BPromise=require(_0x4795('0x6'));var Mustache=require('mustache');var util=require(_0x4795('0x7'));var path=require('path');var sox=require(_0x4795('0x8'));var csv=require(_0x4795('0x9'));var ejs=require(_0x4795('0xa'));var fs=require('fs');var fs_extra=require(_0x4795('0xb'));var _=require(_0x4795('0xc'));var squel=require(_0x4795('0xd'));var crypto=require('crypto');var jsforce=require(_0x4795('0xe'));var deskjs=require(_0x4795('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4795('0x10'));var Papa=require(_0x4795('0x11'));var Redis=require(_0x4795('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4795('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4795('0x14'))(_0x4795('0x15'));var utils=require(_0x4795('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4795('0x17'))['db'];function respondWithStatusCode(_0x45ecd1,_0x3cfbe3){_0x3cfbe3=_0x3cfbe3||0xcc;return function(_0x5b6c10){if(_0x5b6c10){return _0x45ecd1[_0x4795('0x18')](_0x3cfbe3);}return _0x45ecd1[_0x4795('0x19')](_0x3cfbe3)[_0x4795('0x1a')]();};}function respondWithResult(_0x2de6eb,_0x4b7350){_0x4b7350=_0x4b7350||0xc8;return function(_0x47cfde){if(_0x47cfde){return _0x2de6eb['status'](_0x4b7350)['json'](_0x47cfde);}};}function respondWithFilteredResult(_0x37b372,_0x3e58d4){return function(_0x5ea782){if(_0x5ea782){var _0x19bbbf=typeof _0x3e58d4[_0x4795('0x1b')]==='undefined'&&typeof _0x3e58d4[_0x4795('0x1c')]===_0x4795('0x1d');var _0x24aef9=_0x5ea782[_0x4795('0x1e')];var _0x41a644=_0x19bbbf?0x0:_0x3e58d4[_0x4795('0x1b')];var _0x2f137c=_0x19bbbf?_0x5ea782['count']:_0x3e58d4[_0x4795('0x1b')]+_0x3e58d4[_0x4795('0x1c')];var _0x439d21;if(_0x2f137c>=_0x24aef9){_0x2f137c=_0x24aef9;_0x439d21=0xc8;}else{_0x439d21=0xce;}_0x37b372[_0x4795('0x19')](_0x439d21);return _0x37b372[_0x4795('0x1f')](_0x4795('0x20'),_0x41a644+'-'+_0x2f137c+'/'+_0x24aef9)[_0x4795('0x21')](_0x5ea782);}return null;};}function patchUpdates(_0xc1e253){return function(_0x4d0f1e){try{jsonpatch[_0x4795('0x22')](_0x4d0f1e,_0xc1e253,!![]);}catch(_0x1d6575){return BPromise['reject'](_0x1d6575);}return _0x4d0f1e[_0x4795('0x23')]();};}function saveUpdates(_0x516ffa,_0xe66259){return function(_0x1d1409){if(_0x1d1409){return _0x1d1409[_0x4795('0x24')](_0x516ffa)[_0x4795('0x25')](function(_0x184161){return _0x184161;});}return null;};}function removeEntity(_0x1c0503,_0x38d152){return function(_0x2ab44d){if(_0x2ab44d){return _0x2ab44d['destroy']()[_0x4795('0x25')](function(){_0x1c0503[_0x4795('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x73e321,_0x41bcee){return function(_0x2a3815){if(!_0x2a3815){_0x73e321[_0x4795('0x18')](0x194);}return _0x2a3815;};}function handleError(_0x4ef9b7,_0x328d0d){_0x328d0d=_0x328d0d||0x1f4;return function(_0x528766){logger[_0x4795('0x26')](_0x528766[_0x4795('0x27')]);if(_0x528766[_0x4795('0x28')]){delete _0x528766[_0x4795('0x28')];}_0x4ef9b7[_0x4795('0x19')](_0x328d0d)['send'](_0x528766);};}exports[_0x4795('0x29')]=function(_0x15849c,_0x2588c7){var _0x429024={},_0x39b610={},_0x35ea66={'count':0x0,'rows':[]};var _0xb218e0=_['map'](db['IntegrationReport'][_0x4795('0x2a')],function(_0x4c3e83){return{'name':_0x4c3e83[_0x4795('0x2b')],'type':_0x4c3e83['type'][_0x4795('0x2c')]};});_0x39b610['model']=_['map'](_0xb218e0,_0x4795('0x28'));_0x39b610[_0x4795('0x2d')]=_['keys'](_0x15849c[_0x4795('0x2d')]);_0x39b610['filters']=_[_0x4795('0x2e')](_0x39b610[_0x4795('0x2f')],_0x39b610[_0x4795('0x2d')]);_0x429024[_0x4795('0x30')]=_[_0x4795('0x2e')](_0x39b610[_0x4795('0x2f')],qs[_0x4795('0x31')](_0x15849c[_0x4795('0x2d')][_0x4795('0x31')]));_0x429024[_0x4795('0x30')]=_0x429024[_0x4795('0x30')][_0x4795('0x32')]?_0x429024['attributes']:_0x39b610[_0x4795('0x2f')];if(!_0x15849c[_0x4795('0x2d')][_0x4795('0x33')](_0x4795('0x34'))){_0x429024[_0x4795('0x1c')]=qs[_0x4795('0x1c')](_0x15849c[_0x4795('0x2d')][_0x4795('0x1c')]);_0x429024['offset']=qs[_0x4795('0x1b')](_0x15849c['query'][_0x4795('0x1b')]);}_0x429024[_0x4795('0x35')]=qs[_0x4795('0x36')](_0x15849c[_0x4795('0x2d')][_0x4795('0x36')]);_0x429024[_0x4795('0x37')]=qs[_0x4795('0x38')](_[_0x4795('0x39')](_0x15849c[_0x4795('0x2d')],_0x39b610[_0x4795('0x38')]),_0xb218e0);if(_0x15849c[_0x4795('0x2d')]['filter']){_0x429024[_0x4795('0x37')]=_[_0x4795('0x3a')](_0x429024[_0x4795('0x37')],{'$or':_[_0x4795('0x3b')](_0xb218e0,function(_0x5a0058){if(_0x5a0058[_0x4795('0x3c')]!==_0x4795('0x3d')){var _0x53adce={};_0x53adce[_0x5a0058[_0x4795('0x28')]]={'$like':'%'+_0x15849c['query']['filter']+'%'};return _0x53adce;}})});}_0x429024=_['merge']({},_0x429024,_0x15849c['options']);var _0x2f0e08={'where':_0x429024[_0x4795('0x37')]};return db[_0x4795('0x3e')][_0x4795('0x1e')](_0x2f0e08)['then'](function(_0x1e8138){_0x35ea66[_0x4795('0x1e')]=_0x1e8138;if(_0x15849c[_0x4795('0x2d')][_0x4795('0x3f')]){_0x429024[_0x4795('0x40')]=[{'all':!![]}];}return db[_0x4795('0x3e')][_0x4795('0x41')](_0x429024);})['then'](function(_0x44152f){_0x35ea66[_0x4795('0x42')]=_0x44152f;return _0x35ea66;})[_0x4795('0x25')](respondWithFilteredResult(_0x2588c7,_0x429024))[_0x4795('0x43')](handleError(_0x2588c7,null));};exports[_0x4795('0x44')]=function(_0x2cc2e6,_0x4efa8b){var _0x2fb11e={'raw':![],'where':{'id':_0x2cc2e6[_0x4795('0x45')]['id']}},_0x5de596={};_0x5de596[_0x4795('0x2f')]=_[_0x4795('0x46')](db[_0x4795('0x3e')][_0x4795('0x2a')]);_0x5de596[_0x4795('0x2d')]=_[_0x4795('0x46')](_0x2cc2e6[_0x4795('0x2d')]);_0x5de596[_0x4795('0x38')]=_[_0x4795('0x2e')](_0x5de596[_0x4795('0x2f')],_0x5de596['query']);_0x2fb11e[_0x4795('0x30')]=_[_0x4795('0x2e')](_0x5de596[_0x4795('0x2f')],qs[_0x4795('0x31')](_0x2cc2e6['query'][_0x4795('0x31')]));_0x2fb11e[_0x4795('0x30')]=_0x2fb11e[_0x4795('0x30')]['length']?_0x2fb11e[_0x4795('0x30')]:_0x5de596[_0x4795('0x2f')];if(_0x2cc2e6[_0x4795('0x2d')][_0x4795('0x3f')]){_0x2fb11e['include']=[{'all':!![]}];}_0x2fb11e=_[_0x4795('0x3a')]({},_0x2fb11e,_0x2cc2e6[_0x4795('0x47')]);return db[_0x4795('0x3e')][_0x4795('0x48')](_0x2fb11e)['then'](handleEntityNotFound(_0x4efa8b,null))[_0x4795('0x25')](respondWithResult(_0x4efa8b,null))['catch'](handleError(_0x4efa8b,null));};exports[_0x4795('0x49')]=function(_0x3d506a,_0x267322){return db[_0x4795('0x3e')][_0x4795('0x49')](_0x3d506a[_0x4795('0x4a')],{})['then'](respondWithResult(_0x267322,0xc9))[_0x4795('0x43')](handleError(_0x267322,null));};exports[_0x4795('0x24')]=function(_0x51cadb,_0x5dae27){if(_0x51cadb[_0x4795('0x4a')]['id']){delete _0x51cadb[_0x4795('0x4a')]['id'];}return db[_0x4795('0x3e')][_0x4795('0x48')]({'where':{'id':_0x51cadb[_0x4795('0x45')]['id']}})[_0x4795('0x25')](handleEntityNotFound(_0x5dae27,null))[_0x4795('0x25')](saveUpdates(_0x51cadb[_0x4795('0x4a')],null))[_0x4795('0x25')](respondWithResult(_0x5dae27,null))[_0x4795('0x43')](handleError(_0x5dae27,null));};exports['destroy']=function(_0x46d221,_0x4daf19){return db[_0x4795('0x3e')]['find']({'where':{'id':_0x46d221[_0x4795('0x45')]['id']}})[_0x4795('0x25')](handleEntityNotFound(_0x4daf19,null))[_0x4795('0x25')](removeEntity(_0x4daf19,null))[_0x4795('0x43')](handleError(_0x4daf19,null));};exports[_0x4795('0x4b')]=function(_0x4eb8cd,_0x1292b1){return db[_0x4795('0x3e')][_0x4795('0x4b')]()[_0x4795('0x25')](respondWithResult(_0x1292b1,null))[_0x4795('0x43')](handleError(_0x1292b1,null));}; \ No newline at end of file +var _0xe996=['find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','name','send','index','map','IntegrationReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','params','includeAll','include'];(function(_0x108e00,_0x3b11f7){var _0x2c6b1d=function(_0x21cf9c){while(--_0x21cf9c){_0x108e00['push'](_0x108e00['shift']());}};_0x2c6b1d(++_0x3b11f7);}(_0xe996,0x96));var _0x6e99=function(_0x4c4674,_0x76c920){_0x4c4674=_0x4c4674-0x0;var _0x48dd75=_0xe996[_0x4c4674];return _0x48dd75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e99('0x0'));var zipdir=require(_0x6e99('0x1'));var jsonpatch=require(_0x6e99('0x2'));var rp=require(_0x6e99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6e99('0x4'));var util=require(_0x6e99('0x5'));var path=require(_0x6e99('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6e99('0x7'));var fs=require('fs');var fs_extra=require(_0x6e99('0x8'));var _=require(_0x6e99('0x9'));var squel=require(_0x6e99('0xa'));var crypto=require(_0x6e99('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6e99('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6e99('0xd'));var Redis=require(_0x6e99('0xe'));var authService=require(_0x6e99('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6e99('0x10'));var hardwareService=require(_0x6e99('0x11'));var logger=require(_0x6e99('0x12'))(_0x6e99('0x13'));var utils=require('../../config/utils');var config=require(_0x6e99('0x14'));var licenseUtil=require(_0x6e99('0x15'));var db=require(_0x6e99('0x16'))['db'];function respondWithStatusCode(_0x53d18f,_0x244343){_0x244343=_0x244343||0xcc;return function(_0x198d8c){if(_0x198d8c){return _0x53d18f[_0x6e99('0x17')](_0x244343);}return _0x53d18f[_0x6e99('0x18')](_0x244343)[_0x6e99('0x19')]();};}function respondWithResult(_0x32f0a8,_0x449fb8){_0x449fb8=_0x449fb8||0xc8;return function(_0x398ae2){if(_0x398ae2){return _0x32f0a8[_0x6e99('0x18')](_0x449fb8)[_0x6e99('0x1a')](_0x398ae2);}};}function respondWithFilteredResult(_0x4d9472,_0x4d2d6a){return function(_0x6fa637){if(_0x6fa637){var _0x4ed014=typeof _0x4d2d6a[_0x6e99('0x1b')]===_0x6e99('0x1c')&&typeof _0x4d2d6a[_0x6e99('0x1d')]===_0x6e99('0x1c');var _0x28ce14=_0x6fa637[_0x6e99('0x1e')];var _0x36af2a=_0x4ed014?0x0:_0x4d2d6a['offset'];var _0x42f65d=_0x4ed014?_0x6fa637['count']:_0x4d2d6a[_0x6e99('0x1b')]+_0x4d2d6a[_0x6e99('0x1d')];var _0x367843;if(_0x42f65d>=_0x28ce14){_0x42f65d=_0x28ce14;_0x367843=0xc8;}else{_0x367843=0xce;}_0x4d9472['status'](_0x367843);return _0x4d9472[_0x6e99('0x1f')]('Content-Range',_0x36af2a+'-'+_0x42f65d+'/'+_0x28ce14)[_0x6e99('0x1a')](_0x6fa637);}return null;};}function patchUpdates(_0x16be1f){return function(_0x4d7879){try{jsonpatch[_0x6e99('0x20')](_0x4d7879,_0x16be1f,!![]);}catch(_0x593a04){return BPromise[_0x6e99('0x21')](_0x593a04);}return _0x4d7879[_0x6e99('0x22')]();};}function saveUpdates(_0x1186bf,_0x5ad3ef){return function(_0x46a3ef){if(_0x46a3ef){return _0x46a3ef[_0x6e99('0x23')](_0x1186bf)['then'](function(_0x51680e){return _0x51680e;});}return null;};}function removeEntity(_0x534cf8,_0x462742){return function(_0x37c464){if(_0x37c464){return _0x37c464[_0x6e99('0x24')]()[_0x6e99('0x25')](function(){_0x534cf8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1694fe,_0x32afde){return function(_0x40ec37){if(!_0x40ec37){_0x1694fe[_0x6e99('0x17')](0x194);}return _0x40ec37;};}function handleError(_0x39f44a,_0x300609){_0x300609=_0x300609||0x1f4;return function(_0x416685){logger[_0x6e99('0x26')](_0x416685['stack']);if(_0x416685['name']){delete _0x416685[_0x6e99('0x27')];}_0x39f44a[_0x6e99('0x18')](_0x300609)[_0x6e99('0x28')](_0x416685);};}exports[_0x6e99('0x29')]=function(_0x126376,_0x324694){var _0x1379ac={},_0x1798e1={},_0x1918f5={'count':0x0,'rows':[]};var _0x154853=_[_0x6e99('0x2a')](db[_0x6e99('0x2b')]['rawAttributes'],function(_0xf139f1){return{'name':_0xf139f1[_0x6e99('0x2c')],'type':_0xf139f1[_0x6e99('0x2d')][_0x6e99('0x2e')]};});_0x1798e1['model']=_[_0x6e99('0x2a')](_0x154853,_0x6e99('0x27'));_0x1798e1[_0x6e99('0x2f')]=_[_0x6e99('0x30')](_0x126376[_0x6e99('0x2f')]);_0x1798e1[_0x6e99('0x31')]=_[_0x6e99('0x32')](_0x1798e1[_0x6e99('0x33')],_0x1798e1[_0x6e99('0x2f')]);_0x1379ac['attributes']=_[_0x6e99('0x32')](_0x1798e1['model'],qs['fields'](_0x126376[_0x6e99('0x2f')][_0x6e99('0x34')]));_0x1379ac[_0x6e99('0x35')]=_0x1379ac[_0x6e99('0x35')]['length']?_0x1379ac[_0x6e99('0x35')]:_0x1798e1['model'];if(!_0x126376[_0x6e99('0x2f')][_0x6e99('0x36')](_0x6e99('0x37'))){_0x1379ac[_0x6e99('0x1d')]=qs[_0x6e99('0x1d')](_0x126376[_0x6e99('0x2f')][_0x6e99('0x1d')]);_0x1379ac[_0x6e99('0x1b')]=qs[_0x6e99('0x1b')](_0x126376[_0x6e99('0x2f')][_0x6e99('0x1b')]);}_0x1379ac[_0x6e99('0x38')]=qs[_0x6e99('0x39')](_0x126376[_0x6e99('0x2f')][_0x6e99('0x39')]);_0x1379ac[_0x6e99('0x3a')]=qs[_0x6e99('0x31')](_[_0x6e99('0x3b')](_0x126376[_0x6e99('0x2f')],_0x1798e1[_0x6e99('0x31')]),_0x154853);if(_0x126376[_0x6e99('0x2f')][_0x6e99('0x3c')]){_0x1379ac[_0x6e99('0x3a')]=_[_0x6e99('0x3d')](_0x1379ac[_0x6e99('0x3a')],{'$or':_[_0x6e99('0x2a')](_0x154853,function(_0x1da377){if(_0x1da377['type']!==_0x6e99('0x3e')){var _0x425ac1={};_0x425ac1[_0x1da377[_0x6e99('0x27')]]={'$like':'%'+_0x126376[_0x6e99('0x2f')][_0x6e99('0x3c')]+'%'};return _0x425ac1;}})});}_0x1379ac=_[_0x6e99('0x3d')]({},_0x1379ac,_0x126376[_0x6e99('0x3f')]);var _0x2d16fd={'where':_0x1379ac[_0x6e99('0x3a')]};return db['IntegrationReport'][_0x6e99('0x1e')](_0x2d16fd)[_0x6e99('0x25')](function(_0xc65a4b){_0x1918f5[_0x6e99('0x1e')]=_0xc65a4b;if(_0x126376[_0x6e99('0x2f')]['includeAll']){_0x1379ac['include']=[{'all':!![]}];}return db['IntegrationReport'][_0x6e99('0x40')](_0x1379ac);})['then'](function(_0x1a78f2){_0x1918f5['rows']=_0x1a78f2;return _0x1918f5;})[_0x6e99('0x25')](respondWithFilteredResult(_0x324694,_0x1379ac))[_0x6e99('0x41')](handleError(_0x324694,null));};exports['show']=function(_0x38a5b4,_0x42c7e4){var _0x158e2d={'raw':![],'where':{'id':_0x38a5b4[_0x6e99('0x42')]['id']}},_0x1382d7={};_0x1382d7['model']=_[_0x6e99('0x30')](db[_0x6e99('0x2b')]['rawAttributes']);_0x1382d7['query']=_[_0x6e99('0x30')](_0x38a5b4['query']);_0x1382d7[_0x6e99('0x31')]=_[_0x6e99('0x32')](_0x1382d7[_0x6e99('0x33')],_0x1382d7[_0x6e99('0x2f')]);_0x158e2d[_0x6e99('0x35')]=_[_0x6e99('0x32')](_0x1382d7[_0x6e99('0x33')],qs[_0x6e99('0x34')](_0x38a5b4[_0x6e99('0x2f')][_0x6e99('0x34')]));_0x158e2d[_0x6e99('0x35')]=_0x158e2d['attributes']['length']?_0x158e2d[_0x6e99('0x35')]:_0x1382d7[_0x6e99('0x33')];if(_0x38a5b4[_0x6e99('0x2f')][_0x6e99('0x43')]){_0x158e2d[_0x6e99('0x44')]=[{'all':!![]}];}_0x158e2d=_[_0x6e99('0x3d')]({},_0x158e2d,_0x38a5b4[_0x6e99('0x3f')]);return db[_0x6e99('0x2b')][_0x6e99('0x45')](_0x158e2d)[_0x6e99('0x25')](handleEntityNotFound(_0x42c7e4,null))[_0x6e99('0x25')](respondWithResult(_0x42c7e4,null))[_0x6e99('0x41')](handleError(_0x42c7e4,null));};exports[_0x6e99('0x46')]=function(_0x4ba5de,_0x10d0b0){return db[_0x6e99('0x2b')][_0x6e99('0x46')](_0x4ba5de[_0x6e99('0x47')],{})['then'](respondWithResult(_0x10d0b0,0xc9))['catch'](handleError(_0x10d0b0,null));};exports[_0x6e99('0x23')]=function(_0x59cdd3,_0xc6bc33){if(_0x59cdd3['body']['id']){delete _0x59cdd3[_0x6e99('0x47')]['id'];}return db['IntegrationReport'][_0x6e99('0x45')]({'where':{'id':_0x59cdd3[_0x6e99('0x42')]['id']}})[_0x6e99('0x25')](handleEntityNotFound(_0xc6bc33,null))[_0x6e99('0x25')](saveUpdates(_0x59cdd3[_0x6e99('0x47')],null))[_0x6e99('0x25')](respondWithResult(_0xc6bc33,null))[_0x6e99('0x41')](handleError(_0xc6bc33,null));};exports[_0x6e99('0x24')]=function(_0x4629be,_0x28a3d4){return db[_0x6e99('0x2b')][_0x6e99('0x45')]({'where':{'id':_0x4629be[_0x6e99('0x42')]['id']}})['then'](handleEntityNotFound(_0x28a3d4,null))[_0x6e99('0x25')](removeEntity(_0x28a3d4,null))[_0x6e99('0x41')](handleError(_0x28a3d4,null));};exports[_0x6e99('0x48')]=function(_0x5068e3,_0x364162){return db['IntegrationReport'][_0x6e99('0x48')]()[_0x6e99('0x25')](respondWithResult(_0x364162,null))[_0x6e99('0x41')](handleError(_0x364162,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 427a71d..97b322d 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 _0x3a39=['report_integration','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x3ab928,_0x2b990b){var _0xf47692=function(_0x311b8e){while(--_0x311b8e){_0x3ab928['push'](_0x3ab928['shift']());}};_0xf47692(++_0x2b990b);}(_0x3a39,0x139));var _0x93a3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3a39[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x93a3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x93a3('0x1'));var BPromise=require(_0x93a3('0x2'));var rp=require(_0x93a3('0x3'));var fs=require('fs');var path=require(_0x93a3('0x4'));var rimraf=require(_0x93a3('0x5'));var config=require(_0x93a3('0x6'));var attributes=require(_0x93a3('0x7'));module[_0x93a3('0x8')]=function(_0x134723,_0x2766f1){return _0x134723[_0x93a3('0x9')](_0x93a3('0xa'),attributes,{'tableName':_0x93a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd64=['define','report_integration','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0xc2a47b,_0x396652){var _0x1e23b2=function(_0x2934ee){while(--_0x2934ee){_0xc2a47b['push'](_0xc2a47b['shift']());}};_0x1e23b2(++_0x396652);}(_0xfd64,0x19a));var _0x4fd6=function(_0x257d31,_0x3323e3){_0x257d31=_0x257d31-0x0;var _0x1ed1a7=_0xfd64[_0x257d31];return _0x1ed1a7;};'use strict';var _=require(_0x4fd6('0x0'));var util=require(_0x4fd6('0x1'));var logger=require('../../config/logger')(_0x4fd6('0x2'));var moment=require('moment');var BPromise=require(_0x4fd6('0x3'));var rp=require(_0x4fd6('0x4'));var fs=require('fs');var path=require(_0x4fd6('0x5'));var rimraf=require(_0x4fd6('0x6'));var config=require(_0x4fd6('0x7'));var attributes=require(_0x4fd6('0x8'));module[_0x4fd6('0x9')]=function(_0x2dc600,_0x4f92c5){return _0x2dc600[_0x4fd6('0xa')]('IntegrationReport',attributes,{'tableName':_0x4fd6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 06e5f36..6a2f4ef 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x4975,0x86));var _0x5497=function(_0x32aeb9,_0x1caccb){_0x32aeb9=_0x32aeb9-0x0;var _0x1f3ca0=_0x4975[_0x32aeb9];return _0x1f3ca0;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1d75c7,_0x44cfc6){var _0x52c160=function(_0x324e67){while(--_0x324e67){_0x1d75c7['push'](_0x1d75c7['shift']());}};_0x52c160(++_0x44cfc6);}(_0xdb28,0x106));var _0x8db2=function(_0x431e9f,_0x281c60){_0x431e9f=_0x431e9f-0x0;var _0x48fbcc=_0xdb28[_0x431e9f];return _0x48fbcc;};'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')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index efef01b..d497252 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 _0xc69b=['express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','multer','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc69b,0xcf));var _0xbc69=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0xc69b[_0x5cc8];return _0x450661;};'use strict';var multer=require(_0xbc69('0x0'));var util=require('util');var path=require(_0xbc69('0x1'));var timeout=require('connect-timeout');var express=require(_0xbc69('0x2'));var router=express[_0xbc69('0x3')]();var fs_extra=require(_0xbc69('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbc69('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0xbc69('0x6')]('/',auth[_0xbc69('0x7')](),controller['index']);router[_0xbc69('0x6')](_0xbc69('0x8'),auth[_0xbc69('0x7')](),controller['show']);router[_0xbc69('0x6')](_0xbc69('0x9'),auth[_0xbc69('0x7')](),controller[_0xbc69('0xa')]);router[_0xbc69('0xb')]('/',auth['isAuthenticated'](),controller[_0xbc69('0xc')]);router[_0xbc69('0xb')](_0xbc69('0x9'),auth[_0xbc69('0x7')](),controller[_0xbc69('0xd')]);router['post'](_0xbc69('0xe'),auth[_0xbc69('0x7')](),controller[_0xbc69('0xf')]);router[_0xbc69('0x10')]('/:id',auth[_0xbc69('0x7')](),controller['update']);router[_0xbc69('0x11')]('/:id',auth[_0xbc69('0x7')](),controller[_0xbc69('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4317=['addIntervals','put','update','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','index','get','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many'];(function(_0x365c7f,_0xa99915){var _0x4a697e=function(_0x3ad4ce){while(--_0x3ad4ce){_0x365c7f['push'](_0x365c7f['shift']());}};_0x4a697e(++_0xa99915);}(_0x4317,0x7c));var _0x7431=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4317[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x7431('0x0'));var path=require(_0x7431('0x1'));var timeout=require(_0x7431('0x2'));var express=require('express');var router=express[_0x7431('0x3')]();var fs_extra=require(_0x7431('0x4'));var auth=require(_0x7431('0x5'));var interaction=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var controller=require(_0x7431('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7431('0x9')]);router[_0x7431('0xa')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0xd')]);router[_0x7431('0xa')](_0x7431('0xe'),auth[_0x7431('0xc')](),controller[_0x7431('0xf')]);router[_0x7431('0x10')]('/',auth[_0x7431('0xc')](),controller[_0x7431('0x11')]);router[_0x7431('0x10')](_0x7431('0xe'),auth[_0x7431('0xc')](),controller[_0x7431('0x12')]);router[_0x7431('0x10')](_0x7431('0x13'),auth[_0x7431('0xc')](),controller[_0x7431('0x14')]);router[_0x7431('0x15')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0x16')]);router['delete'](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0x17')]);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 a738289..81fa93c 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 _0xaa0e=['STRING','sequelize','exports'];(function(_0x1153f7,_0x564f8b){var _0x49380f=function(_0x52fd92){while(--_0x52fd92){_0x1153f7['push'](_0x1153f7['shift']());}};_0x49380f(++_0x564f8b);}(_0xaa0e,0x1a2));var _0xeaa0=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0xaa0e[_0x5311e8];return _0x582ad8;};'use strict';var Sequelize=require(_0xeaa0('0x0'));module[_0xeaa0('0x1')]={'name':{'type':Sequelize[_0xeaa0('0x2')]},'description':{'type':Sequelize[_0xeaa0('0x2')]},'interval':{'type':Sequelize[_0xeaa0('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xcc06=['STRING'];(function(_0x1ad295,_0x4d6f48){var _0x2ea33b=function(_0x12bae7){while(--_0x12bae7){_0x1ad295['push'](_0x1ad295['shift']());}};_0x2ea33b(++_0x4d6f48);}(_0xcc06,0x98));var _0x6cc0=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xcc06[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6cc0('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 4a5c821..7fb4d81 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 _0xaf96=['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/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','Interval','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','user','role','Intervals','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','IntervalId','getIntervals','findOne','order','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','moment','bluebird','mustache'];(function(_0x437ec0,_0x309ee7){var _0x344a18=function(_0x8ef23){while(--_0x8ef23){_0x437ec0['push'](_0x437ec0['shift']());}};_0x344a18(++_0x309ee7);}(_0xaf96,0x16b));var _0x6af9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf96[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6af9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6af9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6af9('0x2'));var BPromise=require(_0x6af9('0x3'));var Mustache=require(_0x6af9('0x4'));var util=require('util');var path=require(_0x6af9('0x5'));var sox=require(_0x6af9('0x6'));var csv=require(_0x6af9('0x7'));var ejs=require(_0x6af9('0x8'));var fs=require('fs');var fs_extra=require(_0x6af9('0x9'));var _=require(_0x6af9('0xa'));var squel=require(_0x6af9('0xb'));var crypto=require(_0x6af9('0xc'));var jsforce=require(_0x6af9('0xd'));var deskjs=require(_0x6af9('0xe'));var toCsv=require(_0x6af9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6af9('0xf'));var authService=require(_0x6af9('0x10'));var qs=require(_0x6af9('0x11'));var as=require(_0x6af9('0x12'));var hardwareService=require(_0x6af9('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6af9('0x14'));var licenseUtil=require(_0x6af9('0x15'));var db=require('../../mysqldb')['db'];var extensions=require(_0x6af9('0x16'));function respondWithStatusCode(_0x552fbc,_0x405b86){_0x405b86=_0x405b86||0xcc;return function(_0x4359b4){if(_0x4359b4){return _0x552fbc[_0x6af9('0x17')](_0x405b86);}return _0x552fbc[_0x6af9('0x18')](_0x405b86)[_0x6af9('0x19')]();};}function respondWithResult(_0xfabf92,_0x3ec3df){_0x3ec3df=_0x3ec3df||0xc8;return function(_0x5d39c0){if(_0x5d39c0){return _0xfabf92[_0x6af9('0x18')](_0x3ec3df)[_0x6af9('0x1a')](_0x5d39c0);}};}function respondWithFilteredResult(_0x25d018,_0x190b0a){return function(_0x256669){if(_0x256669){var _0x498362=typeof _0x190b0a[_0x6af9('0x1b')]===_0x6af9('0x1c')&&typeof _0x190b0a['limit']===_0x6af9('0x1c');var _0x3bad7d=_0x256669[_0x6af9('0x1d')];var _0xa55b89=_0x498362?0x0:_0x190b0a[_0x6af9('0x1b')];var _0x4c9c15=_0x498362?_0x256669[_0x6af9('0x1d')]:_0x190b0a[_0x6af9('0x1b')]+_0x190b0a[_0x6af9('0x1e')];var _0x215a02;if(_0x4c9c15>=_0x3bad7d){_0x4c9c15=_0x3bad7d;_0x215a02=0xc8;}else{_0x215a02=0xce;}_0x25d018[_0x6af9('0x18')](_0x215a02);return _0x25d018[_0x6af9('0x1f')](_0x6af9('0x20'),_0xa55b89+'-'+_0x4c9c15+'/'+_0x3bad7d)['json'](_0x256669);}return null;};}function patchUpdates(_0x7d851e){return function(_0x48cae8){try{jsonpatch[_0x6af9('0x21')](_0x48cae8,_0x7d851e,!![]);}catch(_0x1438db){return BPromise[_0x6af9('0x22')](_0x1438db);}return _0x48cae8[_0x6af9('0x23')]();};}function saveUpdates(_0x51a80f,_0x2443a4){return function(_0x3dbacc){if(_0x3dbacc){return _0x3dbacc['update'](_0x51a80f)[_0x6af9('0x24')](function(_0x1fdd9f){return _0x1fdd9f;});}return null;};}function removeEntity(_0x4fcb5c,_0x2e96ce){return function(_0x108b4b){if(_0x108b4b){return _0x108b4b[_0x6af9('0x25')]()[_0x6af9('0x24')](function(){var _0x24a677=_0x108b4b[_0x6af9('0x26')]({'plain':!![]});var _0x20d133='Intervals';return db[_0x6af9('0x27')]['destroy']({'where':{'type':_0x20d133,'resourceId':_0x24a677['id']}})[_0x6af9('0x24')](function(){return _0x108b4b;});})[_0x6af9('0x24')](function(){_0x4fcb5c[_0x6af9('0x18')](0xcc)[_0x6af9('0x19')]();});}};}function handleEntityNotFound(_0x551d39,_0x21e6d8){return function(_0xe68ef3){if(!_0xe68ef3){_0x551d39[_0x6af9('0x17')](0x194);}return _0xe68ef3;};}function handleError(_0x21a65a,_0x3b93d9){_0x3b93d9=_0x3b93d9||0x1f4;return function(_0x343071){logger[_0x6af9('0x28')](_0x343071[_0x6af9('0x29')]);if(_0x343071[_0x6af9('0x2a')]){delete _0x343071[_0x6af9('0x2a')];}_0x21a65a[_0x6af9('0x18')](_0x3b93d9)[_0x6af9('0x2b')](_0x343071);};}exports[_0x6af9('0x2c')]=function(_0x343fd3,_0x4776e8){var _0x3704ef={},_0x42e53c={},_0x3191ef={'count':0x0,'rows':[]};var _0x3a3854=_['map'](db['Interval'][_0x6af9('0x2d')],function(_0x186679){return{'name':_0x186679[_0x6af9('0x2e')],'type':_0x186679[_0x6af9('0x2f')][_0x6af9('0x30')]};});_0x42e53c[_0x6af9('0x31')]=_['map'](_0x3a3854,_0x6af9('0x2a'));_0x42e53c[_0x6af9('0x32')]=_[_0x6af9('0x33')](_0x343fd3[_0x6af9('0x32')]);_0x42e53c[_0x6af9('0x34')]=_[_0x6af9('0x35')](_0x42e53c[_0x6af9('0x31')],_0x42e53c[_0x6af9('0x32')]);_0x3704ef[_0x6af9('0x36')]=_['intersection'](_0x42e53c['model'],qs[_0x6af9('0x37')](_0x343fd3['query'][_0x6af9('0x37')]));_0x3704ef[_0x6af9('0x36')]=_0x3704ef[_0x6af9('0x36')]['length']?_0x3704ef[_0x6af9('0x36')]:_0x42e53c['model'];if(!_0x343fd3['query'][_0x6af9('0x38')](_0x6af9('0x39'))){_0x3704ef['limit']=qs['limit'](_0x343fd3[_0x6af9('0x32')][_0x6af9('0x1e')]);_0x3704ef[_0x6af9('0x1b')]=qs[_0x6af9('0x1b')](_0x343fd3[_0x6af9('0x32')]['offset']);}_0x3704ef['order']=qs[_0x6af9('0x3a')](_0x343fd3[_0x6af9('0x32')]['sort']);_0x3704ef['where']=qs[_0x6af9('0x34')](_[_0x6af9('0x3b')](_0x343fd3[_0x6af9('0x32')],_0x42e53c[_0x6af9('0x34')]),_0x3a3854);if(_0x343fd3[_0x6af9('0x32')][_0x6af9('0x3c')]){_0x3704ef[_0x6af9('0x3d')]=_[_0x6af9('0x3e')](_0x3704ef[_0x6af9('0x3d')],{'$or':_[_0x6af9('0x3f')](_0x3a3854,function(_0xf85a94){if(_0xf85a94['type']!=='VIRTUAL'){var _0x201d7b={};_0x201d7b[_0xf85a94[_0x6af9('0x2a')]]={'$like':'%'+_0x343fd3[_0x6af9('0x32')][_0x6af9('0x3c')]+'%'};return _0x201d7b;}})});}_0x3704ef=_[_0x6af9('0x3e')]({},_0x3704ef,_0x343fd3['options']);var _0x54513f={'where':_0x3704ef[_0x6af9('0x3d')]};return db[_0x6af9('0x40')][_0x6af9('0x1d')](_0x54513f)['then'](function(_0x1ecbbd){_0x3191ef[_0x6af9('0x1d')]=_0x1ecbbd;if(_0x343fd3[_0x6af9('0x32')][_0x6af9('0x41')]){_0x3704ef[_0x6af9('0x42')]=[{'all':!![]}];}return db[_0x6af9('0x40')][_0x6af9('0x43')](_0x3704ef);})[_0x6af9('0x24')](function(_0x191018){_0x3191ef[_0x6af9('0x44')]=_0x191018;return _0x3191ef;})[_0x6af9('0x24')](respondWithFilteredResult(_0x4776e8,_0x3704ef))[_0x6af9('0x45')](handleError(_0x4776e8,null));};exports[_0x6af9('0x46')]=function(_0x10f213,_0x83664d){var _0x31603a={'raw':!![],'where':{'id':_0x10f213[_0x6af9('0x47')]['id']}},_0xdc14a7={};_0xdc14a7[_0x6af9('0x31')]=_['keys'](db['Interval'][_0x6af9('0x2d')]);_0xdc14a7[_0x6af9('0x32')]=_[_0x6af9('0x33')](_0x10f213[_0x6af9('0x32')]);_0xdc14a7[_0x6af9('0x34')]=_[_0x6af9('0x35')](_0xdc14a7[_0x6af9('0x31')],_0xdc14a7[_0x6af9('0x32')]);_0x31603a['attributes']=_[_0x6af9('0x35')](_0xdc14a7[_0x6af9('0x31')],qs[_0x6af9('0x37')](_0x10f213[_0x6af9('0x32')][_0x6af9('0x37')]));_0x31603a[_0x6af9('0x36')]=_0x31603a[_0x6af9('0x36')][_0x6af9('0x48')]?_0x31603a[_0x6af9('0x36')]:_0xdc14a7[_0x6af9('0x31')];if(_0x10f213[_0x6af9('0x32')][_0x6af9('0x41')]){_0x31603a[_0x6af9('0x42')]=[{'all':!![]}];}_0x31603a=_[_0x6af9('0x3e')]({},_0x31603a,_0x10f213[_0x6af9('0x49')]);return db[_0x6af9('0x40')][_0x6af9('0x4a')](_0x31603a)[_0x6af9('0x24')](handleEntityNotFound(_0x83664d,null))['then'](respondWithResult(_0x83664d,null))[_0x6af9('0x45')](handleError(_0x83664d,null));};exports[_0x6af9('0x4b')]=function(_0x436692,_0xf81096){return db[_0x6af9('0x40')]['create'](_0x436692[_0x6af9('0x4c')],{})[_0x6af9('0x24')](function(_0x58fb00){var _0x17c8ed=_0x436692[_0x6af9('0x4d')]['get']({'plain':!![]});if(!_0x17c8ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17c8ed[_0x6af9('0x4e')]===_0x6af9('0x4d')){var _0x8bd5b0=_0x58fb00['get']({'plain':!![]});var _0x4d7abe=_0x6af9('0x4f');return db[_0x6af9('0x50')][_0x6af9('0x4a')]({'where':{'name':_0x4d7abe,'userProfileId':_0x17c8ed['userProfileId']},'raw':!![]})[_0x6af9('0x24')](function(_0x2d1dbe){if(_0x2d1dbe&&_0x2d1dbe[_0x6af9('0x51')]===0x0){return db['UserProfileResource'][_0x6af9('0x4b')]({'name':_0x8bd5b0[_0x6af9('0x2a')],'resourceId':_0x8bd5b0['id'],'type':_0x2d1dbe[_0x6af9('0x2a')],'sectionId':_0x2d1dbe['id']},{})['then'](function(){return _0x58fb00;});}else{return _0x58fb00;}})[_0x6af9('0x45')](function(_0x282025){logger[_0x6af9('0x28')](_0x6af9('0x52'),_0x282025);throw _0x282025;});}return _0x58fb00;})['then'](respondWithResult(_0xf81096,0xc9))[_0x6af9('0x45')](handleError(_0xf81096,null));};exports[_0x6af9('0x53')]=function(_0x25c97e,_0x1effa2){if(_0x25c97e[_0x6af9('0x4c')]['id']){delete _0x25c97e['body']['id'];}return db[_0x6af9('0x40')]['find']({'where':{'id':_0x25c97e[_0x6af9('0x47')]['id']}})[_0x6af9('0x24')](handleEntityNotFound(_0x1effa2,null))['then'](saveUpdates(_0x25c97e['body'],null))[_0x6af9('0x24')](respondWithResult(_0x1effa2,null))[_0x6af9('0x45')](handleError(_0x1effa2,null));};exports[_0x6af9('0x25')]=function(_0x36f244,_0x1099b0){return db[_0x6af9('0x40')]['find']({'where':{'id':_0x36f244[_0x6af9('0x47')]['id']}})['then'](handleEntityNotFound(_0x1099b0,null))['then'](removeEntity(_0x1099b0,null))[_0x6af9('0x45')](handleError(_0x1099b0,null));};exports['addInterval']=function(_0x253cc3,_0x2e150b,_0x536e8d){if(_0x253cc3[_0x6af9('0x4c')]['id']){delete _0x253cc3[_0x6af9('0x4c')]['id'];}return db[_0x6af9('0x40')]['find']({'where':{'id':_0x253cc3[_0x6af9('0x47')]['id']}})[_0x6af9('0x24')](handleEntityNotFound(_0x2e150b,null))['then'](function(_0x66acb6){if(_0x66acb6){_0x253cc3[_0x6af9('0x4c')][_0x6af9('0x54')]=_0x66acb6['id'];return db[_0x6af9('0x40')]['create'](_0x253cc3[_0x6af9('0x4c')]);}})[_0x6af9('0x24')](respondWithResult(_0x2e150b,null))[_0x6af9('0x45')](handleError(_0x2e150b,null));};exports[_0x6af9('0x55')]=function(_0x3146e5,_0xa1e317,_0xc4ebc9){var _0x4f7219={};var _0x19d1a2={};var _0x8a5792;var _0x15c00f;return db[_0x6af9('0x40')][_0x6af9('0x56')]({'where':{'id':_0x3146e5['params']['id']}})[_0x6af9('0x24')](handleEntityNotFound(_0xa1e317,null))[_0x6af9('0x24')](function(_0x59fb2e){if(_0x59fb2e){_0x8a5792=_0x59fb2e;_0x19d1a2['model']=_[_0x6af9('0x33')](db[_0x6af9('0x40')][_0x6af9('0x2d')]);_0x19d1a2[_0x6af9('0x32')]=_[_0x6af9('0x33')](_0x3146e5[_0x6af9('0x32')]);_0x19d1a2[_0x6af9('0x34')]=_[_0x6af9('0x35')](_0x19d1a2['model'],_0x19d1a2[_0x6af9('0x32')]);_0x4f7219['attributes']=_[_0x6af9('0x35')](_0x19d1a2[_0x6af9('0x31')],qs['fields'](_0x3146e5[_0x6af9('0x32')]['fields']));_0x4f7219[_0x6af9('0x36')]=_0x4f7219['attributes'][_0x6af9('0x48')]?_0x4f7219[_0x6af9('0x36')]:_0x19d1a2['model'];_0x4f7219[_0x6af9('0x57')]=qs[_0x6af9('0x3a')](_0x3146e5[_0x6af9('0x32')][_0x6af9('0x3a')]);_0x4f7219[_0x6af9('0x3d')]=qs['filters'](_[_0x6af9('0x3b')](_0x3146e5[_0x6af9('0x32')],_0x19d1a2['filters']));if(_0x3146e5[_0x6af9('0x32')][_0x6af9('0x3c')]){_0x4f7219['where']=_['merge'](_0x4f7219['where'],{'$or':_[_0x6af9('0x3f')](_0x4f7219[_0x6af9('0x36')],function(_0x4f4869){var _0x4a2043={};_0x4a2043[_0x4f4869]={'$like':'%'+_0x3146e5[_0x6af9('0x32')][_0x6af9('0x3c')]+'%'};return _0x4a2043;})});}_0x4f7219=_[_0x6af9('0x3e')]({},_0x4f7219,_0x3146e5['options']);return _0x8a5792['getIntervals'](_0x4f7219);}})[_0x6af9('0x24')](function(_0x1c213b){if(_0x1c213b){_0x15c00f=_0x1c213b[_0x6af9('0x48')];if(!_0x3146e5[_0x6af9('0x32')][_0x6af9('0x38')]('nolimit')){_0x4f7219[_0x6af9('0x1e')]=qs[_0x6af9('0x1e')](_0x3146e5[_0x6af9('0x32')][_0x6af9('0x1e')]);_0x4f7219[_0x6af9('0x1b')]=qs[_0x6af9('0x1b')](_0x3146e5['query'][_0x6af9('0x1b')]);}return _0x8a5792['getIntervals'](_0x4f7219);}})[_0x6af9('0x24')](function(_0x40e294){if(_0x40e294){return _0x40e294?{'count':_0x15c00f,'rows':_0x40e294}:null;}})['then'](respondWithResult(_0xa1e317,null))[_0x6af9('0x45')](handleError(_0xa1e317,null));};exports[_0x6af9('0x58')]=function(_0x4dc248,_0x43fa06,_0x30643a){return db[_0x6af9('0x40')][_0x6af9('0x56')]({'where':{'id':_0x4dc248[_0x6af9('0x47')]['id']}})[_0x6af9('0x24')](handleEntityNotFound(_0x43fa06,null))[_0x6af9('0x24')](function(_0x3f3201){if(_0x3f3201){return db[_0x6af9('0x59')][_0x6af9('0x5a')](function(_0x25f59a){return db[_0x6af9('0x40')][_0x6af9('0x25')]({'where':{'IntervalId':_0x4dc248[_0x6af9('0x47')]['id']},'transaction':_0x25f59a})[_0x6af9('0x24')](function(_0x1637bc){var _0x30767a=_[_0x6af9('0x3f')](_0x4dc248[_0x6af9('0x4c')],function(_0x3cdd28){delete _0x3cdd28['id'];_0x3cdd28[_0x6af9('0x54')]=_0x4dc248[_0x6af9('0x47')]['id'];return _0x3cdd28;});return db[_0x6af9('0x40')][_0x6af9('0x5b')](_0x30767a,{'transaction':_0x25f59a});});})['then'](function(){return db['Interval'][_0x6af9('0x43')]({'where':{'IntervalId':_0x4dc248[_0x6af9('0x47')]['id']}});});}})[_0x6af9('0x24')](respondWithResult(_0x43fa06,null))[_0x6af9('0x45')](handleError(_0x43fa06,null));}; \ No newline at end of file +var _0x4ebb=['findOne','sort','hasOwnProperty','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','UserProfileResource','end','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals'];(function(_0x9d5a92,_0x34875d){var _0x3d84f2=function(_0x4bde89){while(--_0x4bde89){_0x9d5a92['push'](_0x9d5a92['shift']());}};_0x3d84f2(++_0x34875d);}(_0x4ebb,0x177));var _0xb4eb=function(_0x1f3f5b,_0x2346c8){_0x1f3f5b=_0x1f3f5b-0x0;var _0x5b0fce=_0x4ebb[_0x1f3f5b];return _0x5b0fce;};'use strict';var emlformat=require(_0xb4eb('0x0'));var rimraf=require(_0xb4eb('0x1'));var zipdir=require(_0xb4eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb4eb('0x3'));var moment=require(_0xb4eb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb4eb('0x5'));var ejs=require(_0xb4eb('0x6'));var fs=require('fs');var fs_extra=require(_0xb4eb('0x7'));var _=require(_0xb4eb('0x8'));var squel=require(_0xb4eb('0x9'));var crypto=require('crypto');var jsforce=require(_0xb4eb('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb4eb('0x5'));var querystring=require(_0xb4eb('0xb'));var Papa=require(_0xb4eb('0xc'));var Redis=require('ioredis');var authService=require(_0xb4eb('0xd'));var qs=require(_0xb4eb('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4eb('0xf'));var logger=require(_0xb4eb('0x10'))(_0xb4eb('0x11'));var utils=require(_0xb4eb('0x12'));var config=require(_0xb4eb('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4eb('0x14'))['db'];var extensions=require(_0xb4eb('0x15'));function respondWithStatusCode(_0x4ed17a,_0x5de743){_0x5de743=_0x5de743||0xcc;return function(_0x59edc5){if(_0x59edc5){return _0x4ed17a[_0xb4eb('0x16')](_0x5de743);}return _0x4ed17a['status'](_0x5de743)['end']();};}function respondWithResult(_0x5d09df,_0x33254c){_0x33254c=_0x33254c||0xc8;return function(_0x1f71f6){if(_0x1f71f6){return _0x5d09df[_0xb4eb('0x17')](_0x33254c)[_0xb4eb('0x18')](_0x1f71f6);}};}function respondWithFilteredResult(_0x386ac8,_0x4194ae){return function(_0x18e3e4){if(_0x18e3e4){var _0x1a20c1=typeof _0x4194ae[_0xb4eb('0x19')]===_0xb4eb('0x1a')&&typeof _0x4194ae[_0xb4eb('0x1b')]===_0xb4eb('0x1a');var _0x3b5690=_0x18e3e4[_0xb4eb('0x1c')];var _0x5163e8=_0x1a20c1?0x0:_0x4194ae[_0xb4eb('0x19')];var _0x101cea=_0x1a20c1?_0x18e3e4['count']:_0x4194ae[_0xb4eb('0x19')]+_0x4194ae[_0xb4eb('0x1b')];var _0x5f0735;if(_0x101cea>=_0x3b5690){_0x101cea=_0x3b5690;_0x5f0735=0xc8;}else{_0x5f0735=0xce;}_0x386ac8[_0xb4eb('0x17')](_0x5f0735);return _0x386ac8[_0xb4eb('0x1d')](_0xb4eb('0x1e'),_0x5163e8+'-'+_0x101cea+'/'+_0x3b5690)['json'](_0x18e3e4);}return null;};}function patchUpdates(_0x1498e4){return function(_0x1ee5a2){try{jsonpatch[_0xb4eb('0x1f')](_0x1ee5a2,_0x1498e4,!![]);}catch(_0x1a99bd){return BPromise[_0xb4eb('0x20')](_0x1a99bd);}return _0x1ee5a2['save']();};}function saveUpdates(_0x1573c1,_0x566ee4){return function(_0x252f14){if(_0x252f14){return _0x252f14[_0xb4eb('0x21')](_0x1573c1)['then'](function(_0x3e4e81){return _0x3e4e81;});}return null;};}function removeEntity(_0x13a830,_0x2edcaa){return function(_0x7219cc){if(_0x7219cc){return _0x7219cc[_0xb4eb('0x22')]()[_0xb4eb('0x23')](function(){var _0xc431aa=_0x7219cc['get']({'plain':!![]});var _0x446f51='Intervals';return db[_0xb4eb('0x24')]['destroy']({'where':{'type':_0x446f51,'resourceId':_0xc431aa['id']}})[_0xb4eb('0x23')](function(){return _0x7219cc;});})[_0xb4eb('0x23')](function(){_0x13a830[_0xb4eb('0x17')](0xcc)[_0xb4eb('0x25')]();});}};}function handleEntityNotFound(_0x4dd997,_0x1242b4){return function(_0xce4285){if(!_0xce4285){_0x4dd997[_0xb4eb('0x16')](0x194);}return _0xce4285;};}function handleError(_0x3a65d4,_0x2e2a3b){_0x2e2a3b=_0x2e2a3b||0x1f4;return function(_0x3ddd90){logger[_0xb4eb('0x26')](_0x3ddd90[_0xb4eb('0x27')]);if(_0x3ddd90['name']){delete _0x3ddd90[_0xb4eb('0x28')];}_0x3a65d4[_0xb4eb('0x17')](_0x2e2a3b)[_0xb4eb('0x29')](_0x3ddd90);};}exports[_0xb4eb('0x2a')]=function(_0x115ebb,_0x47a336){var _0x3e9874={},_0x56f588={},_0x3e2713={'count':0x0,'rows':[]};var _0x4b3fa9=_[_0xb4eb('0x2b')](db[_0xb4eb('0x2c')][_0xb4eb('0x2d')],function(_0x56609f){return{'name':_0x56609f[_0xb4eb('0x2e')],'type':_0x56609f[_0xb4eb('0x2f')][_0xb4eb('0x30')]};});_0x56f588[_0xb4eb('0x31')]=_[_0xb4eb('0x2b')](_0x4b3fa9,_0xb4eb('0x28'));_0x56f588[_0xb4eb('0x32')]=_[_0xb4eb('0x33')](_0x115ebb['query']);_0x56f588[_0xb4eb('0x34')]=_[_0xb4eb('0x35')](_0x56f588[_0xb4eb('0x31')],_0x56f588[_0xb4eb('0x32')]);_0x3e9874[_0xb4eb('0x36')]=_[_0xb4eb('0x35')](_0x56f588[_0xb4eb('0x31')],qs[_0xb4eb('0x37')](_0x115ebb['query']['fields']));_0x3e9874['attributes']=_0x3e9874[_0xb4eb('0x36')][_0xb4eb('0x38')]?_0x3e9874['attributes']:_0x56f588[_0xb4eb('0x31')];if(!_0x115ebb['query']['hasOwnProperty'](_0xb4eb('0x39'))){_0x3e9874[_0xb4eb('0x1b')]=qs[_0xb4eb('0x1b')](_0x115ebb[_0xb4eb('0x32')][_0xb4eb('0x1b')]);_0x3e9874[_0xb4eb('0x19')]=qs[_0xb4eb('0x19')](_0x115ebb[_0xb4eb('0x32')]['offset']);}_0x3e9874[_0xb4eb('0x3a')]=qs['sort'](_0x115ebb[_0xb4eb('0x32')]['sort']);_0x3e9874['where']=qs['filters'](_[_0xb4eb('0x3b')](_0x115ebb[_0xb4eb('0x32')],_0x56f588[_0xb4eb('0x34')]),_0x4b3fa9);if(_0x115ebb[_0xb4eb('0x32')][_0xb4eb('0x3c')]){_0x3e9874[_0xb4eb('0x3d')]=_[_0xb4eb('0x3e')](_0x3e9874['where'],{'$or':_[_0xb4eb('0x2b')](_0x4b3fa9,function(_0x230930){if(_0x230930[_0xb4eb('0x2f')]!==_0xb4eb('0x3f')){var _0x31b5a7={};_0x31b5a7[_0x230930[_0xb4eb('0x28')]]={'$like':'%'+_0x115ebb[_0xb4eb('0x32')]['filter']+'%'};return _0x31b5a7;}})});}_0x3e9874=_[_0xb4eb('0x3e')]({},_0x3e9874,_0x115ebb[_0xb4eb('0x40')]);var _0x13bd88={'where':_0x3e9874[_0xb4eb('0x3d')]};return db[_0xb4eb('0x2c')][_0xb4eb('0x1c')](_0x13bd88)['then'](function(_0x434f2c){_0x3e2713[_0xb4eb('0x1c')]=_0x434f2c;if(_0x115ebb[_0xb4eb('0x32')][_0xb4eb('0x41')]){_0x3e9874['include']=[{'all':!![]}];}return db[_0xb4eb('0x2c')]['findAll'](_0x3e9874);})[_0xb4eb('0x23')](function(_0x5ead4e){_0x3e2713[_0xb4eb('0x42')]=_0x5ead4e;return _0x3e2713;})[_0xb4eb('0x23')](respondWithFilteredResult(_0x47a336,_0x3e9874))[_0xb4eb('0x43')](handleError(_0x47a336,null));};exports[_0xb4eb('0x44')]=function(_0x4d0b12,_0x2ccf1d){var _0x2b3b8f={'raw':!![],'where':{'id':_0x4d0b12[_0xb4eb('0x45')]['id']}},_0x3a1d7d={};_0x3a1d7d[_0xb4eb('0x31')]=_[_0xb4eb('0x33')](db[_0xb4eb('0x2c')][_0xb4eb('0x2d')]);_0x3a1d7d[_0xb4eb('0x32')]=_[_0xb4eb('0x33')](_0x4d0b12[_0xb4eb('0x32')]);_0x3a1d7d['filters']=_[_0xb4eb('0x35')](_0x3a1d7d[_0xb4eb('0x31')],_0x3a1d7d[_0xb4eb('0x32')]);_0x2b3b8f['attributes']=_[_0xb4eb('0x35')](_0x3a1d7d['model'],qs[_0xb4eb('0x37')](_0x4d0b12[_0xb4eb('0x32')][_0xb4eb('0x37')]));_0x2b3b8f['attributes']=_0x2b3b8f[_0xb4eb('0x36')][_0xb4eb('0x38')]?_0x2b3b8f['attributes']:_0x3a1d7d[_0xb4eb('0x31')];if(_0x4d0b12[_0xb4eb('0x32')][_0xb4eb('0x41')]){_0x2b3b8f['include']=[{'all':!![]}];}_0x2b3b8f=_[_0xb4eb('0x3e')]({},_0x2b3b8f,_0x4d0b12['options']);return db[_0xb4eb('0x2c')][_0xb4eb('0x46')](_0x2b3b8f)['then'](handleEntityNotFound(_0x2ccf1d,null))[_0xb4eb('0x23')](respondWithResult(_0x2ccf1d,null))[_0xb4eb('0x43')](handleError(_0x2ccf1d,null));};exports[_0xb4eb('0x47')]=function(_0x1edb36,_0x322630){return db[_0xb4eb('0x2c')][_0xb4eb('0x47')](_0x1edb36[_0xb4eb('0x48')],{})['then'](function(_0x17d758){var _0x4f1e0c=_0x1edb36['user']['get']({'plain':!![]});if(!_0x4f1e0c)throw new Error(_0xb4eb('0x49'));if(_0x4f1e0c[_0xb4eb('0x4a')]===_0xb4eb('0x4b')){var _0x47ddc7=_0x17d758[_0xb4eb('0x4c')]({'plain':!![]});var _0x281b0f=_0xb4eb('0x4d');return db[_0xb4eb('0x4e')]['find']({'where':{'name':_0x281b0f,'userProfileId':_0x4f1e0c[_0xb4eb('0x4f')]},'raw':!![]})[_0xb4eb('0x23')](function(_0x2f7b8d){if(_0x2f7b8d&&_0x2f7b8d[_0xb4eb('0x50')]===0x0){return db[_0xb4eb('0x24')]['create']({'name':_0x47ddc7[_0xb4eb('0x28')],'resourceId':_0x47ddc7['id'],'type':_0x2f7b8d[_0xb4eb('0x28')],'sectionId':_0x2f7b8d['id']},{})['then'](function(){return _0x17d758;});}else{return _0x17d758;}})[_0xb4eb('0x43')](function(_0x1593eb){logger[_0xb4eb('0x26')](_0xb4eb('0x51'),_0x1593eb);throw _0x1593eb;});}return _0x17d758;})[_0xb4eb('0x23')](respondWithResult(_0x322630,0xc9))[_0xb4eb('0x43')](handleError(_0x322630,null));};exports[_0xb4eb('0x21')]=function(_0x1e8f7a,_0x5231a5){if(_0x1e8f7a['body']['id']){delete _0x1e8f7a[_0xb4eb('0x48')]['id'];}return db[_0xb4eb('0x2c')][_0xb4eb('0x46')]({'where':{'id':_0x1e8f7a[_0xb4eb('0x45')]['id']}})[_0xb4eb('0x23')](handleEntityNotFound(_0x5231a5,null))[_0xb4eb('0x23')](saveUpdates(_0x1e8f7a['body'],null))[_0xb4eb('0x23')](respondWithResult(_0x5231a5,null))[_0xb4eb('0x43')](handleError(_0x5231a5,null));};exports[_0xb4eb('0x22')]=function(_0x1e2563,_0xa5cff6){return db['Interval'][_0xb4eb('0x46')]({'where':{'id':_0x1e2563['params']['id']}})['then'](handleEntityNotFound(_0xa5cff6,null))[_0xb4eb('0x23')](removeEntity(_0xa5cff6,null))[_0xb4eb('0x43')](handleError(_0xa5cff6,null));};exports[_0xb4eb('0x52')]=function(_0x55f580,_0x545b7f,_0x45c831){if(_0x55f580[_0xb4eb('0x48')]['id']){delete _0x55f580[_0xb4eb('0x48')]['id'];}return db['Interval'][_0xb4eb('0x46')]({'where':{'id':_0x55f580[_0xb4eb('0x45')]['id']}})[_0xb4eb('0x23')](handleEntityNotFound(_0x545b7f,null))[_0xb4eb('0x23')](function(_0x5cf26a){if(_0x5cf26a){_0x55f580['body'][_0xb4eb('0x53')]=_0x5cf26a['id'];return db[_0xb4eb('0x2c')][_0xb4eb('0x47')](_0x55f580[_0xb4eb('0x48')]);}})[_0xb4eb('0x23')](respondWithResult(_0x545b7f,null))[_0xb4eb('0x43')](handleError(_0x545b7f,null));};exports[_0xb4eb('0x54')]=function(_0x4a87dd,_0x36c080,_0x50d2b9){var _0x2032fb={};var _0x58077c={};var _0x35a2d7;var _0x50a3c0;return db[_0xb4eb('0x2c')][_0xb4eb('0x55')]({'where':{'id':_0x4a87dd['params']['id']}})[_0xb4eb('0x23')](handleEntityNotFound(_0x36c080,null))['then'](function(_0x192a3c){if(_0x192a3c){_0x35a2d7=_0x192a3c;_0x58077c[_0xb4eb('0x31')]=_['keys'](db['Interval']['rawAttributes']);_0x58077c['query']=_[_0xb4eb('0x33')](_0x4a87dd[_0xb4eb('0x32')]);_0x58077c['filters']=_[_0xb4eb('0x35')](_0x58077c['model'],_0x58077c[_0xb4eb('0x32')]);_0x2032fb[_0xb4eb('0x36')]=_[_0xb4eb('0x35')](_0x58077c[_0xb4eb('0x31')],qs[_0xb4eb('0x37')](_0x4a87dd[_0xb4eb('0x32')][_0xb4eb('0x37')]));_0x2032fb[_0xb4eb('0x36')]=_0x2032fb[_0xb4eb('0x36')][_0xb4eb('0x38')]?_0x2032fb[_0xb4eb('0x36')]:_0x58077c[_0xb4eb('0x31')];_0x2032fb[_0xb4eb('0x3a')]=qs[_0xb4eb('0x56')](_0x4a87dd[_0xb4eb('0x32')][_0xb4eb('0x56')]);_0x2032fb['where']=qs[_0xb4eb('0x34')](_['pick'](_0x4a87dd[_0xb4eb('0x32')],_0x58077c[_0xb4eb('0x34')]));if(_0x4a87dd[_0xb4eb('0x32')][_0xb4eb('0x3c')]){_0x2032fb[_0xb4eb('0x3d')]=_['merge'](_0x2032fb[_0xb4eb('0x3d')],{'$or':_[_0xb4eb('0x2b')](_0x2032fb[_0xb4eb('0x36')],function(_0x401ddf){var _0x521a22={};_0x521a22[_0x401ddf]={'$like':'%'+_0x4a87dd[_0xb4eb('0x32')]['filter']+'%'};return _0x521a22;})});}_0x2032fb=_[_0xb4eb('0x3e')]({},_0x2032fb,_0x4a87dd[_0xb4eb('0x40')]);return _0x35a2d7['getIntervals'](_0x2032fb);}})[_0xb4eb('0x23')](function(_0x59ceda){if(_0x59ceda){_0x50a3c0=_0x59ceda[_0xb4eb('0x38')];if(!_0x4a87dd['query'][_0xb4eb('0x57')](_0xb4eb('0x39'))){_0x2032fb[_0xb4eb('0x1b')]=qs[_0xb4eb('0x1b')](_0x4a87dd['query']['limit']);_0x2032fb[_0xb4eb('0x19')]=qs[_0xb4eb('0x19')](_0x4a87dd[_0xb4eb('0x32')][_0xb4eb('0x19')]);}return _0x35a2d7['getIntervals'](_0x2032fb);}})[_0xb4eb('0x23')](function(_0x57267b){if(_0x57267b){return _0x57267b?{'count':_0x50a3c0,'rows':_0x57267b}:null;}})['then'](respondWithResult(_0x36c080,null))['catch'](handleError(_0x36c080,null));};exports['addIntervals']=function(_0x2d4682,_0x524e5,_0x218fc5){return db['Interval'][_0xb4eb('0x55')]({'where':{'id':_0x2d4682['params']['id']}})[_0xb4eb('0x23')](handleEntityNotFound(_0x524e5,null))['then'](function(_0x2d80de){if(_0x2d80de){return db[_0xb4eb('0x58')][_0xb4eb('0x59')](function(_0x21f1ea){return db[_0xb4eb('0x2c')][_0xb4eb('0x22')]({'where':{'IntervalId':_0x2d4682[_0xb4eb('0x45')]['id']},'transaction':_0x21f1ea})[_0xb4eb('0x23')](function(_0x5536e1){var _0x62e235=_['map'](_0x2d4682[_0xb4eb('0x48')],function(_0x44a620){delete _0x44a620['id'];_0x44a620[_0xb4eb('0x53')]=_0x2d4682[_0xb4eb('0x45')]['id'];return _0x44a620;});return db[_0xb4eb('0x2c')][_0xb4eb('0x5a')](_0x62e235,{'transaction':_0x21f1ea});});})['then'](function(){return db['Interval'][_0xb4eb('0x5b')]({'where':{'IntervalId':_0x2d4682[_0xb4eb('0x45')]['id']}});});}})[_0xb4eb('0x23')](respondWithResult(_0x524e5,null))[_0xb4eb('0x43')](handleError(_0x524e5,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ca32d01..208c6ff 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 _0x2304=['api','request-promise','../../config/environment','../../components/extensions/rewrite','tools_intervals','rewrite','lodash','util','../../config/logger'];(function(_0x4d6db7,_0x31d090){var _0x4ed49d=function(_0x2335de){while(--_0x2335de){_0x4d6db7['push'](_0x4d6db7['shift']());}};_0x4ed49d(++_0x31d090);}(_0x2304,0x192));var _0x4230=function(_0x5940b8,_0xdb8f8c){_0x5940b8=_0x5940b8-0x0;var _0x32a185=_0x2304[_0x5940b8];return _0x32a185;};'use strict';var _=require(_0x4230('0x0'));var util=require(_0x4230('0x1'));var logger=require(_0x4230('0x2'))(_0x4230('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4230('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4230('0x5'));var attributes=require('./interval.attributes');var extensions=require(_0x4230('0x6'));module['exports']=function(_0x4ac158,_0x3c32dd){return _0x4ac158['define']('Interval',attributes,{'tableName':_0x4230('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d8c93,_0xc4fcc){extensions['rewrite'](_0x4ac158,_0x5d8c93);},'afterBulkCreate':function(_0x2e63e2,_0x59c96f,_0x18b8f6){_0x18b8f6();extensions[_0x4230('0x8')](_0x4ac158,_0x2e63e2[0x0]);},'afterUpdate':function(_0x262a37,_0x89fc3b){extensions['rewrite'](_0x4ac158,_0x262a37);},'afterDestroy':function(_0xdc2729,_0x56164b){extensions[_0x4230('0x8')](_0x4ac158,_0xdc2729);}}});}; \ No newline at end of file +var _0xe2db=['../../components/extensions/rewrite','exports','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./interval.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2db,0x149));var _0xbe2d=function(_0x4fc8f1,_0x38256c){_0x4fc8f1=_0x4fc8f1-0x0;var _0x3f9bb8=_0xe2db[_0x4fc8f1];return _0x3f9bb8;};'use strict';var _=require(_0xbe2d('0x0'));var util=require(_0xbe2d('0x1'));var logger=require(_0xbe2d('0x2'))(_0xbe2d('0x3'));var moment=require(_0xbe2d('0x4'));var BPromise=require(_0xbe2d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbe2d('0x6'));var config=require(_0xbe2d('0x7'));var attributes=require(_0xbe2d('0x8'));var extensions=require(_0xbe2d('0x9'));module[_0xbe2d('0xa')]=function(_0x45bc1a,_0x189f5a){return _0x45bc1a['define']('Interval',attributes,{'tableName':_0xbe2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d7ffb,_0xc9315){extensions[_0xbe2d('0xc')](_0x45bc1a,_0x5d7ffb);},'afterBulkCreate':function(_0x36aa22,_0x218203,_0x42e36c){_0x42e36c();extensions[_0xbe2d('0xc')](_0x45bc1a,_0x36aa22[0x0]);},'afterUpdate':function(_0xb04b66,_0x2f8667){extensions['rewrite'](_0x45bc1a,_0xb04b66);},'afterDestroy':function(_0x1e121c,_0x15742e){extensions[_0xbe2d('0xc')](_0x45bc1a,_0x1e121c);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 0e159f1..a3fc17f 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index bda84ba..1f56d28 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x59dc64,_0xd7dbdf){var _0xdcbf81=function(_0x4f8b55){while(--_0x4f8b55){_0x59dc64['push'](_0x59dc64['shift']());}};_0xdcbf81(++_0xd7dbdf);}(_0xadb5,0xad));var _0x5adb=function(_0x285d60,_0x3d6c2f){_0x285d60=_0x285d60-0x0;var _0x31440f=_0xadb5[_0x285d60];return _0x31440f;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x41f5dc,_0xc7b5e2){var _0x307419=function(_0x4aca9d){while(--_0x4aca9d){_0x41f5dc['push'](_0x41f5dc['shift']());}};_0x307419(++_0xc7b5e2);}(_0xdb28,0x106));var _0x8db2=function(_0x4cf84a,_0x646ff4){_0x4cf84a=_0x4cf84a-0x0;var _0x2b66cd=_0xdb28[_0x4cf84a];return _0x2b66cd;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index c0aa043..8965f99 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 _0xfa65=['track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','fields','customfield_11500','email','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102'];(function(_0x408746,_0x2e34b8){var _0xd5158b=function(_0x3d39b0){while(--_0x3d39b0){_0x408746['push'](_0x408746['shift']());}};_0xd5158b(++_0x2e34b8);}(_0xfa65,0xa2));var _0x5fa6=function(_0x9164da,_0x1aaffe){_0x9164da=_0x9164da-0x0;var _0x52247d=_0xfa65[_0x9164da];return _0x52247d;};'use strict';var BPromise=require(_0x5fa6('0x0'));var https=require(_0x5fa6('0x1'));var logger=require('../../config/logger')(_0x5fa6('0x2'));var USERNAME=_0x5fa6('0x3');var PASSWORD=_0x5fa6('0x4');function openIssue(_0x317ac3,_0x15ad10){var _0x23eee0={'fields':{'project':{'key':_0x317ac3['key']||_0x5fa6('0x5')},'summary':(_0x317ac3[_0x5fa6('0x6')]||'Report')+_0x5fa6('0x7')+_0x317ac3['ip'],'description':_0x317ac3['description']||JSON['stringify'](_0x317ac3),'issuetype':{'name':_0x317ac3['issuetype']||'Bug'}}};_0x23eee0[_0x5fa6('0x8')][_0x5fa6('0x9')]=_0x317ac3[_0x5fa6('0xa')];_0x23eee0['fields']['customfield_11501']=_0x317ac3[_0x5fa6('0xb')];_0x23eee0[_0x5fa6('0x8')][_0x5fa6('0xc')]=_0x317ac3['newToken'];_0x23eee0[_0x5fa6('0x8')][_0x5fa6('0xd')]=_0x317ac3[_0x5fa6('0xe')];_0x23eee0[_0x5fa6('0x8')][_0x5fa6('0xf')]=_0x317ac3[_0x5fa6('0x10')];_0x23eee0[_0x5fa6('0x8')][_0x5fa6('0x11')]=_0x317ac3['ip'];var _0x54af0d={'host':_0x5fa6('0x12'),'port':0x1bb,'path':_0x5fa6('0x13'),'method':_0x5fa6('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x5fa6('0x15'),'Authorization':_0x5fa6('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x5fa6('0x17')](_0x5fa6('0x18'))}};var _0x3b9a56=JSON[_0x5fa6('0x19')](_0x23eee0);var _0x2864e2=https[_0x5fa6('0x1a')](_0x54af0d,function(_0x51f59d){_0x51f59d[_0x5fa6('0x1b')](_0x5fa6('0x1c'));var _0x191f5f='';_0x51f59d['on'](_0x5fa6('0x1d'),function(_0x52fa45){_0x191f5f+=_0x52fa45;});_0x51f59d['on'](_0x5fa6('0x1e'),function(){if(_0x15ad10){return _0x15ad10[_0x5fa6('0x1f')](_0x51f59d[_0x5fa6('0x20')])[_0x5fa6('0x21')](JSON['parse'](_0x191f5f));}});});_0x2864e2['on'](_0x5fa6('0x22'),function(_0x4afcd6){if(_0x15ad10){return _0x15ad10[_0x5fa6('0x1f')](0x1f4)[_0x5fa6('0x21')]({'errors':[{'message':_0x5fa6('0x23'),'type':_0x5fa6('0x24')}]});}});_0x2864e2[_0x5fa6('0x25')](_0x3b9a56);_0x2864e2[_0x5fa6('0x1e')]();}exports[_0x5fa6('0x26')]=openIssue;exports['send']=function(_0x4b695e,_0x5ce333){_0x4b695e[_0x5fa6('0x27')]['ip']=_0x4b695e[_0x5fa6('0x28')][_0x5fa6('0x29')]||_0x4b695e[_0x5fa6('0x2a')][_0x5fa6('0x2b')]||_0x4b695e['socket']['remoteAddress']||_0x4b695e[_0x5fa6('0x2a')][_0x5fa6('0x2c')][_0x5fa6('0x2b')];return openIssue(_0x4b695e[_0x5fa6('0x27')],_0x5ce333);}; \ No newline at end of file +var _0xebe9=['utf8','data','end','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','body','headers','x-forwarded-for','connection','remoteAddress','bluebird','https','api','support','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','request'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0xebe9,0xdc));var _0x9ebe=function(_0x290eef,_0x4635a3){_0x290eef=_0x290eef-0x0;var _0x21c635=_0xebe9[_0x290eef];return _0x21c635;};'use strict';var BPromise=require(_0x9ebe('0x0'));var https=require(_0x9ebe('0x1'));var logger=require('../../config/logger')(_0x9ebe('0x2'));var USERNAME=_0x9ebe('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4b8737,_0x1bbef8){var _0x4e95f4={'fields':{'project':{'key':_0x4b8737['key']||_0x9ebe('0x4')},'summary':(_0x4b8737[_0x9ebe('0x5')]||_0x9ebe('0x6'))+'\x20from\x20'+_0x4b8737['ip'],'description':_0x4b8737[_0x9ebe('0x7')]||JSON[_0x9ebe('0x8')](_0x4b8737),'issuetype':{'name':_0x4b8737[_0x9ebe('0x9')]||_0x9ebe('0xa')}}};_0x4e95f4[_0x9ebe('0xb')][_0x9ebe('0xc')]=_0x4b8737[_0x9ebe('0xd')];_0x4e95f4[_0x9ebe('0xb')][_0x9ebe('0xe')]=_0x4b8737[_0x9ebe('0xf')];_0x4e95f4['fields']['customfield_11502']=_0x4b8737[_0x9ebe('0x10')];_0x4e95f4[_0x9ebe('0xb')][_0x9ebe('0x11')]=_0x4b8737['name'];_0x4e95f4[_0x9ebe('0xb')][_0x9ebe('0x12')]=_0x4b8737[_0x9ebe('0x13')];_0x4e95f4[_0x9ebe('0xb')][_0x9ebe('0x14')]=_0x4b8737['ip'];var _0x383e92={'host':_0x9ebe('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x9ebe('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x9ebe('0x17'),'Authorization':_0x9ebe('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x2d3c3e=JSON[_0x9ebe('0x8')](_0x4e95f4);var _0x2d211e=https[_0x9ebe('0x19')](_0x383e92,function(_0x51a2de){_0x51a2de['setEncoding'](_0x9ebe('0x1a'));var _0x20189f='';_0x51a2de['on'](_0x9ebe('0x1b'),function(_0x59f463){_0x20189f+=_0x59f463;});_0x51a2de['on'](_0x9ebe('0x1c'),function(){if(_0x1bbef8){return _0x1bbef8['status'](_0x51a2de[_0x9ebe('0x1d')])[_0x9ebe('0x1e')](JSON[_0x9ebe('0x1f')](_0x20189f));}});});_0x2d211e['on'](_0x9ebe('0x20'),function(_0x530174){if(_0x1bbef8){return _0x1bbef8['status'](0x1f4)['json']({'errors':[{'message':_0x9ebe('0x21'),'type':_0x9ebe('0x22')}]});}});_0x2d211e[_0x9ebe('0x23')](_0x2d3c3e);_0x2d211e[_0x9ebe('0x1c')]();}exports['openIssue']=openIssue;exports['send']=function(_0x2f6c2a,_0x19cbcc){_0x2f6c2a[_0x9ebe('0x24')]['ip']=_0x2f6c2a[_0x9ebe('0x25')][_0x9ebe('0x26')]||_0x2f6c2a[_0x9ebe('0x27')][_0x9ebe('0x28')]||_0x2f6c2a['socket']['remoteAddress']||_0x2f6c2a['connection']['socket'][_0x9ebe('0x28')];return openIssue(_0x2f6c2a[_0x9ebe('0x24')],_0x19cbcc);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e2dca8b..c95330b 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 _0xb821=['../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','Router','../../components/interaction/service'];(function(_0x3ea84a,_0x312fdf){var _0x8dbea6=function(_0x384066){while(--_0x384066){_0x3ea84a['push'](_0x3ea84a['shift']());}};_0x8dbea6(++_0x312fdf);}(_0xb821,0xa7));var _0x1b82=function(_0x46279d,_0x42576c){_0x46279d=_0x46279d-0x0;var _0x2f4b7b=_0xb821[_0x46279d];return _0x2f4b7b;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x6')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xc')]);router['post']('/',auth[_0x1b82('0x9')](),controller[_0x1b82('0xd')]);router[_0x1b82('0xe')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xf')]);router[_0x1b82('0x10')](_0x1b82('0xb'),auth['isAuthenticated'](),controller[_0x1b82('0x11')]);module[_0x1b82('0x12')]=router; \ No newline at end of file +var _0x41bb=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x11ac8f,_0x1a010d){var _0x17f138=function(_0x69ec14){while(--_0x69ec14){_0x11ac8f['push'](_0x11ac8f['shift']());}};_0x17f138(++_0x1a010d);}(_0x41bb,0xc5));var _0xb41b=function(_0x3390c4,_0x4a23ca){_0x3390c4=_0x3390c4-0x0;var _0x214582=_0x41bb[_0x3390c4];return _0x214582;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0xd')]('/',auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router[_0xb41b('0xf')]('/:id',auth[_0xb41b('0x9')](),controller['update']);router[_0xb41b('0x10')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x11')]);module[_0xb41b('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 2819d84..98d4fc9 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(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7a54,0x106));var _0x47a5=function(_0x2b048f,_0x46241a){_0x2b048f=_0x2b048f-0x0;var _0x282127=_0x7a54[_0x2b048f];return _0x282127;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x1a1225,_0x3333b4){_0x1a1225=_0x1a1225-0x0;var _0x388cbd=_0x7a54[_0x1a1225];return _0x388cbd;};'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 ee25bfc..418a4ef 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 _0x34aa=['apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','show','params','rawAttributes','length','include','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range'];(function(_0x3b534c,_0x2c614f){var _0x449ef9=function(_0x285279){while(--_0x285279){_0x3b534c['push'](_0x3b534c['shift']());}};_0x449ef9(++_0x2c614f);}(_0x34aa,0x171));var _0xa34a=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x34aa[_0x456a4b];return _0x42957c;};'use strict';var emlformat=require(_0xa34a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa34a('0x1'));var jsonpatch=require(_0xa34a('0x2'));var rp=require(_0xa34a('0x3'));var moment=require(_0xa34a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa34a('0x5'));var util=require(_0xa34a('0x6'));var path=require(_0xa34a('0x7'));var sox=require(_0xa34a('0x8'));var csv=require(_0xa34a('0x9'));var ejs=require(_0xa34a('0xa'));var fs=require('fs');var fs_extra=require(_0xa34a('0xb'));var _=require(_0xa34a('0xc'));var squel=require(_0xa34a('0xd'));var crypto=require(_0xa34a('0xe'));var jsforce=require(_0xa34a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa34a('0x9'));var querystring=require(_0xa34a('0x10'));var Papa=require(_0xa34a('0x11'));var Redis=require(_0xa34a('0x12'));var authService=require(_0xa34a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa34a('0x14'));var hardwareService=require(_0xa34a('0x15'));var logger=require(_0xa34a('0x16'))(_0xa34a('0x17'));var utils=require(_0xa34a('0x18'));var config=require(_0xa34a('0x19'));var licenseUtil=require(_0xa34a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3145e9,_0x33e150){_0x33e150=_0x33e150||0xcc;return function(_0x1c2972){if(_0x1c2972){return _0x3145e9['sendStatus'](_0x33e150);}return _0x3145e9[_0xa34a('0x1b')](_0x33e150)[_0xa34a('0x1c')]();};}function respondWithResult(_0x525eff,_0x2f5ded){_0x2f5ded=_0x2f5ded||0xc8;return function(_0x3d5926){if(_0x3d5926){return _0x525eff['status'](_0x2f5ded)[_0xa34a('0x1d')](_0x3d5926);}};}function respondWithFilteredResult(_0x7ac9a2,_0x19580a){return function(_0xfd0d79){if(_0xfd0d79){var _0x41b9bb=typeof _0x19580a['offset']===_0xa34a('0x1e')&&typeof _0x19580a['limit']===_0xa34a('0x1e');var _0x14837d=_0xfd0d79[_0xa34a('0x1f')];var _0x181dcc=_0x41b9bb?0x0:_0x19580a['offset'];var _0x27ad19=_0x41b9bb?_0xfd0d79[_0xa34a('0x1f')]:_0x19580a[_0xa34a('0x20')]+_0x19580a[_0xa34a('0x21')];var _0xaa360e;if(_0x27ad19>=_0x14837d){_0x27ad19=_0x14837d;_0xaa360e=0xc8;}else{_0xaa360e=0xce;}_0x7ac9a2['status'](_0xaa360e);return _0x7ac9a2[_0xa34a('0x22')](_0xa34a('0x23'),_0x181dcc+'-'+_0x27ad19+'/'+_0x14837d)[_0xa34a('0x1d')](_0xfd0d79);}return null;};}function patchUpdates(_0x5a641c){return function(_0x14a18b){try{jsonpatch[_0xa34a('0x24')](_0x14a18b,_0x5a641c,!![]);}catch(_0x36749d){return BPromise[_0xa34a('0x25')](_0x36749d);}return _0x14a18b[_0xa34a('0x26')]();};}function saveUpdates(_0x14e24c,_0x4f9342){return function(_0x28249a){if(_0x28249a){return _0x28249a[_0xa34a('0x27')](_0x14e24c)['then'](function(_0x13135a){return _0x13135a;});}return null;};}function removeEntity(_0x377c4a,_0x746078){return function(_0x254b75){if(_0x254b75){return _0x254b75[_0xa34a('0x28')]()[_0xa34a('0x29')](function(){_0x377c4a[_0xa34a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x351b9e,_0xb314d2){return function(_0x473c15){if(!_0x473c15){_0x351b9e[_0xa34a('0x2a')](0x194);}return _0x473c15;};}function handleError(_0x502b4d,_0x1ab30a){_0x1ab30a=_0x1ab30a||0x1f4;return function(_0x7ecf44){logger[_0xa34a('0x2b')](_0x7ecf44[_0xa34a('0x2c')]);if(_0x7ecf44['name']){delete _0x7ecf44[_0xa34a('0x2d')];}_0x502b4d[_0xa34a('0x1b')](_0x1ab30a)[_0xa34a('0x2e')](_0x7ecf44);};}exports[_0xa34a('0x2f')]=function(_0x48e428,_0x2b03a7){var _0x82350e={},_0x196681={},_0x3d351a={'count':0x0,'rows':[]};var _0x4e08e6=_[_0xa34a('0x30')](db[_0xa34a('0x31')]['rawAttributes'],function(_0x163190){return{'name':_0x163190[_0xa34a('0x32')],'type':_0x163190['type']['key']};});_0x196681[_0xa34a('0x33')]=_[_0xa34a('0x30')](_0x4e08e6,_0xa34a('0x2d'));_0x196681[_0xa34a('0x34')]=_[_0xa34a('0x35')](_0x48e428[_0xa34a('0x34')]);_0x196681['filters']=_[_0xa34a('0x36')](_0x196681[_0xa34a('0x33')],_0x196681['query']);_0x82350e[_0xa34a('0x37')]=_[_0xa34a('0x36')](_0x196681[_0xa34a('0x33')],qs[_0xa34a('0x38')](_0x48e428['query'][_0xa34a('0x38')]));_0x82350e[_0xa34a('0x37')]=_0x82350e[_0xa34a('0x37')]['length']?_0x82350e[_0xa34a('0x37')]:_0x196681[_0xa34a('0x33')];if(!_0x48e428[_0xa34a('0x34')][_0xa34a('0x39')](_0xa34a('0x3a'))){_0x82350e[_0xa34a('0x21')]=qs['limit'](_0x48e428['query']['limit']);_0x82350e[_0xa34a('0x20')]=qs[_0xa34a('0x20')](_0x48e428[_0xa34a('0x34')][_0xa34a('0x20')]);}_0x82350e[_0xa34a('0x3b')]=qs[_0xa34a('0x3c')](_0x48e428['query'][_0xa34a('0x3c')]);_0x82350e[_0xa34a('0x3d')]=qs[_0xa34a('0x3e')](_[_0xa34a('0x3f')](_0x48e428[_0xa34a('0x34')],_0x196681[_0xa34a('0x3e')]),_0x4e08e6);if(_0x48e428['query'][_0xa34a('0x40')]){_0x82350e[_0xa34a('0x3d')]=_['merge'](_0x82350e[_0xa34a('0x3d')],{'$or':_['map'](_0x4e08e6,function(_0x41a4d5){if(_0x41a4d5[_0xa34a('0x41')]!==_0xa34a('0x42')){var _0x3cc290={};_0x3cc290[_0x41a4d5[_0xa34a('0x2d')]]={'$like':'%'+_0x48e428[_0xa34a('0x34')][_0xa34a('0x40')]+'%'};return _0x3cc290;}})});}_0x82350e=_[_0xa34a('0x43')]({},_0x82350e,_0x48e428[_0xa34a('0x44')]);var _0x4a055e={'where':_0x82350e['where']};return db[_0xa34a('0x31')][_0xa34a('0x1f')](_0x4a055e)['then'](function(_0x47766b){_0x3d351a[_0xa34a('0x1f')]=_0x47766b;if(_0x48e428[_0xa34a('0x34')][_0xa34a('0x45')]){_0x82350e['include']=[{'all':!![]}];}return db[_0xa34a('0x31')][_0xa34a('0x46')](_0x82350e);})[_0xa34a('0x29')](function(_0x10960b){_0x3d351a['rows']=_0x10960b;return _0x3d351a;})['then'](respondWithFilteredResult(_0x2b03a7,_0x82350e))['catch'](handleError(_0x2b03a7,null));};exports[_0xa34a('0x47')]=function(_0x54b5ec,_0x6722d5){var _0xa17285={'raw':!![],'where':{'id':_0x54b5ec[_0xa34a('0x48')]['id']}},_0x1be7e4={};_0x1be7e4[_0xa34a('0x33')]=_['keys'](db[_0xa34a('0x31')][_0xa34a('0x49')]);_0x1be7e4[_0xa34a('0x34')]=_[_0xa34a('0x35')](_0x54b5ec[_0xa34a('0x34')]);_0x1be7e4[_0xa34a('0x3e')]=_['intersection'](_0x1be7e4[_0xa34a('0x33')],_0x1be7e4[_0xa34a('0x34')]);_0xa17285[_0xa34a('0x37')]=_[_0xa34a('0x36')](_0x1be7e4[_0xa34a('0x33')],qs[_0xa34a('0x38')](_0x54b5ec['query'][_0xa34a('0x38')]));_0xa17285['attributes']=_0xa17285[_0xa34a('0x37')][_0xa34a('0x4a')]?_0xa17285[_0xa34a('0x37')]:_0x1be7e4['model'];if(_0x54b5ec[_0xa34a('0x34')]['includeAll']){_0xa17285[_0xa34a('0x4b')]=[{'all':!![]}];}_0xa17285=_['merge']({},_0xa17285,_0x54b5ec[_0xa34a('0x44')]);return db[_0xa34a('0x31')][_0xa34a('0x4c')](_0xa17285)[_0xa34a('0x29')](handleEntityNotFound(_0x6722d5,null))[_0xa34a('0x29')](respondWithResult(_0x6722d5,null))['catch'](handleError(_0x6722d5,null));};exports[_0xa34a('0x4d')]=function(_0x50b05a,_0x87b76d){return db[_0xa34a('0x31')][_0xa34a('0x4d')](_0x50b05a[_0xa34a('0x4e')],{})[_0xa34a('0x29')](respondWithResult(_0x87b76d,0xc9))[_0xa34a('0x4f')](handleError(_0x87b76d,null));};exports[_0xa34a('0x27')]=function(_0xde8a7,_0x4be0d0){if(_0xde8a7[_0xa34a('0x4e')]['id']){delete _0xde8a7['body']['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0xde8a7[_0xa34a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4be0d0,null))[_0xa34a('0x29')](saveUpdates(_0xde8a7[_0xa34a('0x4e')],null))['then'](respondWithResult(_0x4be0d0,null))[_0xa34a('0x4f')](handleError(_0x4be0d0,null));};exports['destroy']=function(_0x262803,_0xa7cbc4){return db[_0xa34a('0x31')][_0xa34a('0x4c')]({'where':{'id':_0x262803['params']['id']}})['then'](handleEntityNotFound(_0xa7cbc4,null))[_0xa34a('0x29')](removeEntity(_0xa7cbc4,null))[_0xa34a('0x4f')](handleError(_0xa7cbc4,null));};exports[_0xa34a('0x50')]=function(_0x1a9468,_0x44ab8){return db[_0xa34a('0x31')][_0xa34a('0x50')]()[_0xa34a('0x29')](respondWithResult(_0x44ab8,null))[_0xa34a('0x4f')](handleError(_0x44ab8,null));}; \ No newline at end of file +var _0x7a08=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x321ae5,_0x470a4a){var _0x3140df=function(_0x44052e){while(--_0x44052e){_0x321ae5['push'](_0x321ae5['shift']());}};_0x3140df(++_0x470a4a);}(_0x7a08,0x11e));var _0x87a0=function(_0x14d382,_0x54b6bd){_0x14d382=_0x14d382-0x0;var _0x31c6a7=_0x7a08[_0x14d382];return _0x31c6a7;};'use strict';var emlformat=require(_0x87a0('0x0'));var rimraf=require(_0x87a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x87a0('0x2'));var moment=require(_0x87a0('0x3'));var BPromise=require(_0x87a0('0x4'));var Mustache=require(_0x87a0('0x5'));var util=require(_0x87a0('0x6'));var path=require(_0x87a0('0x7'));var sox=require(_0x87a0('0x8'));var csv=require(_0x87a0('0x9'));var ejs=require(_0x87a0('0xa'));var fs=require('fs');var fs_extra=require(_0x87a0('0xb'));var _=require(_0x87a0('0xc'));var squel=require('squel');var crypto=require(_0x87a0('0xd'));var jsforce=require(_0x87a0('0xe'));var deskjs=require(_0x87a0('0xf'));var toCsv=require(_0x87a0('0x9'));var querystring=require(_0x87a0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x87a0('0x11'));var qs=require(_0x87a0('0x12'));var as=require(_0x87a0('0x13'));var hardwareService=require(_0x87a0('0x14'));var logger=require(_0x87a0('0x15'))('api');var utils=require(_0x87a0('0x16'));var config=require(_0x87a0('0x17'));var licenseUtil=require(_0x87a0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54cdf,_0x2bd845){_0x2bd845=_0x2bd845||0xcc;return function(_0x12e8c7){if(_0x12e8c7){return _0x54cdf[_0x87a0('0x19')](_0x2bd845);}return _0x54cdf['status'](_0x2bd845)[_0x87a0('0x1a')]();};}function respondWithResult(_0x288747,_0x290a29){_0x290a29=_0x290a29||0xc8;return function(_0x583bdd){if(_0x583bdd){return _0x288747[_0x87a0('0x1b')](_0x290a29)[_0x87a0('0x1c')](_0x583bdd);}};}function respondWithFilteredResult(_0x3f69f3,_0x35f9a8){return function(_0x4acba8){if(_0x4acba8){var _0x394291=typeof _0x35f9a8['offset']===_0x87a0('0x1d')&&typeof _0x35f9a8[_0x87a0('0x1e')]===_0x87a0('0x1d');var _0x26a72e=_0x4acba8[_0x87a0('0x1f')];var _0x4f695b=_0x394291?0x0:_0x35f9a8[_0x87a0('0x20')];var _0x57bf72=_0x394291?_0x4acba8['count']:_0x35f9a8[_0x87a0('0x20')]+_0x35f9a8[_0x87a0('0x1e')];var _0x2a42ea;if(_0x57bf72>=_0x26a72e){_0x57bf72=_0x26a72e;_0x2a42ea=0xc8;}else{_0x2a42ea=0xce;}_0x3f69f3['status'](_0x2a42ea);return _0x3f69f3[_0x87a0('0x21')]('Content-Range',_0x4f695b+'-'+_0x57bf72+'/'+_0x26a72e)['json'](_0x4acba8);}return null;};}function patchUpdates(_0x1c3b20){return function(_0x237192){try{jsonpatch[_0x87a0('0x22')](_0x237192,_0x1c3b20,!![]);}catch(_0x390bb2){return BPromise[_0x87a0('0x23')](_0x390bb2);}return _0x237192[_0x87a0('0x24')]();};}function saveUpdates(_0x59e839,_0x25ed19){return function(_0x1f59f7){if(_0x1f59f7){return _0x1f59f7['update'](_0x59e839)[_0x87a0('0x25')](function(_0x1cd50c){return _0x1cd50c;});}return null;};}function removeEntity(_0x48dfe2,_0x373507){return function(_0x4fb8d8){if(_0x4fb8d8){return _0x4fb8d8[_0x87a0('0x26')]()[_0x87a0('0x25')](function(){_0x48dfe2[_0x87a0('0x1b')](0xcc)[_0x87a0('0x1a')]();});}};}function handleEntityNotFound(_0x3bb9c0,_0x3f282d){return function(_0x3ae0c0){if(!_0x3ae0c0){_0x3bb9c0[_0x87a0('0x19')](0x194);}return _0x3ae0c0;};}function handleError(_0xae4ee9,_0x3c0a46){_0x3c0a46=_0x3c0a46||0x1f4;return function(_0x51313f){logger[_0x87a0('0x27')](_0x51313f[_0x87a0('0x28')]);if(_0x51313f[_0x87a0('0x29')]){delete _0x51313f[_0x87a0('0x29')];}_0xae4ee9[_0x87a0('0x1b')](_0x3c0a46)[_0x87a0('0x2a')](_0x51313f);};}exports[_0x87a0('0x2b')]=function(_0x55dbf7,_0x27ce99){var _0x24f8c0={},_0x712a00={},_0x380587={'count':0x0,'rows':[]};var _0x482f6b=_[_0x87a0('0x2c')](db[_0x87a0('0x2d')]['rawAttributes'],function(_0x23f59e){return{'name':_0x23f59e[_0x87a0('0x2e')],'type':_0x23f59e[_0x87a0('0x2f')]['key']};});_0x712a00[_0x87a0('0x30')]=_[_0x87a0('0x2c')](_0x482f6b,_0x87a0('0x29'));_0x712a00[_0x87a0('0x31')]=_[_0x87a0('0x32')](_0x55dbf7['query']);_0x712a00[_0x87a0('0x33')]=_[_0x87a0('0x34')](_0x712a00[_0x87a0('0x30')],_0x712a00[_0x87a0('0x31')]);_0x24f8c0[_0x87a0('0x35')]=_[_0x87a0('0x34')](_0x712a00[_0x87a0('0x30')],qs[_0x87a0('0x36')](_0x55dbf7['query'][_0x87a0('0x36')]));_0x24f8c0[_0x87a0('0x35')]=_0x24f8c0['attributes']['length']?_0x24f8c0['attributes']:_0x712a00[_0x87a0('0x30')];if(!_0x55dbf7[_0x87a0('0x31')]['hasOwnProperty'](_0x87a0('0x37'))){_0x24f8c0[_0x87a0('0x1e')]=qs[_0x87a0('0x1e')](_0x55dbf7[_0x87a0('0x31')][_0x87a0('0x1e')]);_0x24f8c0[_0x87a0('0x20')]=qs[_0x87a0('0x20')](_0x55dbf7[_0x87a0('0x31')][_0x87a0('0x20')]);}_0x24f8c0[_0x87a0('0x38')]=qs[_0x87a0('0x39')](_0x55dbf7['query'][_0x87a0('0x39')]);_0x24f8c0[_0x87a0('0x3a')]=qs[_0x87a0('0x33')](_[_0x87a0('0x3b')](_0x55dbf7[_0x87a0('0x31')],_0x712a00[_0x87a0('0x33')]),_0x482f6b);if(_0x55dbf7[_0x87a0('0x31')][_0x87a0('0x3c')]){_0x24f8c0[_0x87a0('0x3a')]=_[_0x87a0('0x3d')](_0x24f8c0[_0x87a0('0x3a')],{'$or':_[_0x87a0('0x2c')](_0x482f6b,function(_0x1f11d1){if(_0x1f11d1['type']!==_0x87a0('0x3e')){var _0x164e92={};_0x164e92[_0x1f11d1[_0x87a0('0x29')]]={'$like':'%'+_0x55dbf7[_0x87a0('0x31')]['filter']+'%'};return _0x164e92;}})});}_0x24f8c0=_[_0x87a0('0x3d')]({},_0x24f8c0,_0x55dbf7['options']);var _0x2ce7aa={'where':_0x24f8c0['where']};return db['JscriptyAnswerReport'][_0x87a0('0x1f')](_0x2ce7aa)[_0x87a0('0x25')](function(_0x109eb3){_0x380587[_0x87a0('0x1f')]=_0x109eb3;if(_0x55dbf7[_0x87a0('0x31')][_0x87a0('0x3f')]){_0x24f8c0[_0x87a0('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x87a0('0x41')](_0x24f8c0);})[_0x87a0('0x25')](function(_0x4319bd){_0x380587[_0x87a0('0x42')]=_0x4319bd;return _0x380587;})['then'](respondWithFilteredResult(_0x27ce99,_0x24f8c0))[_0x87a0('0x43')](handleError(_0x27ce99,null));};exports[_0x87a0('0x44')]=function(_0x2c280d,_0x1c73ac){var _0x5a942a={'raw':!![],'where':{'id':_0x2c280d[_0x87a0('0x45')]['id']}},_0xbac9={};_0xbac9[_0x87a0('0x30')]=_[_0x87a0('0x32')](db[_0x87a0('0x2d')][_0x87a0('0x46')]);_0xbac9['query']=_[_0x87a0('0x32')](_0x2c280d[_0x87a0('0x31')]);_0xbac9[_0x87a0('0x33')]=_[_0x87a0('0x34')](_0xbac9['model'],_0xbac9[_0x87a0('0x31')]);_0x5a942a['attributes']=_[_0x87a0('0x34')](_0xbac9['model'],qs['fields'](_0x2c280d[_0x87a0('0x31')]['fields']));_0x5a942a[_0x87a0('0x35')]=_0x5a942a[_0x87a0('0x35')][_0x87a0('0x47')]?_0x5a942a['attributes']:_0xbac9['model'];if(_0x2c280d[_0x87a0('0x31')][_0x87a0('0x3f')]){_0x5a942a[_0x87a0('0x40')]=[{'all':!![]}];}_0x5a942a=_['merge']({},_0x5a942a,_0x2c280d['options']);return db['JscriptyAnswerReport'][_0x87a0('0x48')](_0x5a942a)[_0x87a0('0x25')](handleEntityNotFound(_0x1c73ac,null))[_0x87a0('0x25')](respondWithResult(_0x1c73ac,null))[_0x87a0('0x43')](handleError(_0x1c73ac,null));};exports[_0x87a0('0x49')]=function(_0x232c00,_0x26c0b8){return db[_0x87a0('0x2d')][_0x87a0('0x49')](_0x232c00[_0x87a0('0x4a')],{})[_0x87a0('0x25')](respondWithResult(_0x26c0b8,0xc9))[_0x87a0('0x43')](handleError(_0x26c0b8,null));};exports['update']=function(_0x3e5c65,_0x1f236e){if(_0x3e5c65[_0x87a0('0x4a')]['id']){delete _0x3e5c65['body']['id'];}return db[_0x87a0('0x2d')][_0x87a0('0x48')]({'where':{'id':_0x3e5c65[_0x87a0('0x45')]['id']}})[_0x87a0('0x25')](handleEntityNotFound(_0x1f236e,null))[_0x87a0('0x25')](saveUpdates(_0x3e5c65['body'],null))[_0x87a0('0x25')](respondWithResult(_0x1f236e,null))[_0x87a0('0x43')](handleError(_0x1f236e,null));};exports['destroy']=function(_0x4a144f,_0xa90662){return db[_0x87a0('0x2d')][_0x87a0('0x48')]({'where':{'id':_0x4a144f['params']['id']}})[_0x87a0('0x25')](handleEntityNotFound(_0xa90662,null))[_0x87a0('0x25')](removeEntity(_0xa90662,null))[_0x87a0('0x43')](handleError(_0xa90662,null));};exports[_0x87a0('0x4b')]=function(_0x3ad13b,_0x13bfdb){return db[_0x87a0('0x2d')][_0x87a0('0x4b')]()[_0x87a0('0x25')](respondWithResult(_0x13bfdb,null))['catch'](handleError(_0x13bfdb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a383f05..51b17fa 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 _0x1ba3=['./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x41d7e3,_0x556db9){var _0x7d83ae=function(_0x447ee6){while(--_0x447ee6){_0x41d7e3['push'](_0x41d7e3['shift']());}};_0x7d83ae(++_0x556db9);}(_0x1ba3,0xe3));var _0x31ba=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x1ba3[_0x4226d6];return _0x19655b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x31ba('0x0'));var moment=require(_0x31ba('0x1'));var BPromise=require('bluebird');var rp=require(_0x31ba('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31ba('0x3'));var config=require(_0x31ba('0x4'));var attributes=require(_0x31ba('0x5'));module[_0x31ba('0x6')]=function(_0x48bfdf,_0x560a65){return _0x48bfdf['define'](_0x31ba('0x7'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb773=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0xab7bfa,_0x4c7410){var _0x3af2d5=function(_0x5da84a){while(--_0x5da84a){_0xab7bfa['push'](_0xab7bfa['shift']());}};_0x3af2d5(++_0x4c7410);}(_0xb773,0x186));var _0x3b77=function(_0x4d4a74,_0x344a11){_0x4d4a74=_0x4d4a74-0x0;var _0x5491d8=_0xb773[_0x4d4a74];return _0x5491d8;};'use strict';var _=require(_0x3b77('0x0'));var util=require(_0x3b77('0x1'));var logger=require(_0x3b77('0x2'))('api');var moment=require(_0x3b77('0x3'));var BPromise=require(_0x3b77('0x4'));var rp=require(_0x3b77('0x5'));var fs=require('fs');var path=require(_0x3b77('0x6'));var rimraf=require(_0x3b77('0x7'));var config=require(_0x3b77('0x8'));var attributes=require(_0x3b77('0x9'));module[_0x3b77('0xa')]=function(_0xe4ae7b,_0x168283){return _0xe4ae7b[_0x3b77('0xb')](_0x3b77('0xc'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index f754e28..f3df4dc 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 _0x6f41=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x36e066,_0x1ef6a0){var _0x5a1e44=function(_0x33382e){while(--_0x33382e){_0x36e066['push'](_0x36e066['shift']());}};_0x5a1e44(++_0x1ef6a0);}(_0x6f41,0xea));var _0x16f4=function(_0x3f5f64,_0x4ed60a){_0x3f5f64=_0x3f5f64-0x0;var _0x539d68=_0x6f41[_0x3f5f64];return _0x539d68;};'use strict';var _=require(_0x16f4('0x0'));var util=require(_0x16f4('0x1'));var moment=require('moment');var BPromise=require(_0x16f4('0x2'));var rs=require(_0x16f4('0x3'));var fs=require('fs');var Redis=require(_0x16f4('0x4'));var db=require(_0x16f4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x16f4('0x6'))(_0x16f4('0x7'));var config=require(_0x16f4('0x8'));var jayson=require(_0x16f4('0x9'));var client=jayson['client'][_0x16f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4619fe,_0x5bb798,_0x3b5417){return new BPromise(function(_0x5ba581,_0x5311a2){return client['request'](_0x4619fe,_0x3b5417)[_0x16f4('0xb')](function(_0x32d87f){logger[_0x16f4('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5bb798,_0x16f4('0xd'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5bb798,_0x16f4('0xd'),JSON[_0x16f4('0xe')](_0x32d87f));if(_0x32d87f[_0x16f4('0xf')]){if(_0x32d87f[_0x16f4('0xf')][_0x16f4('0x10')]===0x1f4){logger[_0x16f4('0xf')](_0x16f4('0x11'),_0x5bb798,_0x32d87f['error'][_0x16f4('0x12')]);return _0x5311a2(_0x32d87f[_0x16f4('0xf')][_0x16f4('0x12')]);}logger[_0x16f4('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5bb798,_0x32d87f[_0x16f4('0xf')]['message']);return _0x5ba581(_0x32d87f[_0x16f4('0xf')][_0x16f4('0x12')]);}else{logger['info'](_0x16f4('0x11'),_0x5bb798,_0x16f4('0xd'));_0x5ba581(_0x32d87f['result'][_0x16f4('0x12')]);}})[_0x16f4('0x13')](function(_0x5e6772){logger[_0x16f4('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5bb798,_0x5e6772);_0x5311a2(_0x5e6772);});});} \ No newline at end of file +var _0x8f96=['code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','then','info','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x53814c,_0x25a944){var _0x1be846=function(_0x357c9f){while(--_0x357c9f){_0x53814c['push'](_0x53814c['shift']());}};_0x1be846(++_0x25a944);}(_0x8f96,0x1a3));var _0x68f9=function(_0x56f0e0,_0x22803a){_0x56f0e0=_0x56f0e0-0x0;var _0x4ef3e1=_0x8f96[_0x56f0e0];return _0x4ef3e1;};'use strict';var _=require(_0x68f9('0x0'));var util=require(_0x68f9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x68f9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68f9('0x3'))['db'];var utils=require(_0x68f9('0x4'));var logger=require('../../config/logger')(_0x68f9('0x5'));var config=require('../../config/environment');var jayson=require(_0x68f9('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49c280,_0x1e0b31,_0x139021){return new BPromise(function(_0x3fc26c,_0x558ae4){return client['request'](_0x49c280,_0x139021)[_0x68f9('0x7')](function(_0x1e566f){logger[_0x68f9('0x8')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1e0b31,'request\x20sent');logger['debug'](_0x68f9('0x9'),_0x1e0b31,_0x68f9('0xa'),JSON[_0x68f9('0xb')](_0x1e566f));if(_0x1e566f[_0x68f9('0xc')]){if(_0x1e566f[_0x68f9('0xc')][_0x68f9('0xd')]===0x1f4){logger['error'](_0x68f9('0xe'),_0x1e0b31,_0x1e566f[_0x68f9('0xc')][_0x68f9('0xf')]);return _0x558ae4(_0x1e566f[_0x68f9('0xc')][_0x68f9('0xf')]);}logger[_0x68f9('0xc')](_0x68f9('0xe'),_0x1e0b31,_0x1e566f[_0x68f9('0xc')][_0x68f9('0xf')]);return _0x3fc26c(_0x1e566f[_0x68f9('0xc')][_0x68f9('0xf')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1e0b31,_0x68f9('0xa'));_0x3fc26c(_0x1e566f[_0x68f9('0x10')][_0x68f9('0xf')]);}})[_0x68f9('0x11')](function(_0x8553ed){logger['error'](_0x68f9('0xe'),_0x1e0b31,_0x8553ed);_0x558ae4(_0x8553ed);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 2b62786..ccdf63b 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 _0x9f01=['create','/:id/clone','clone','put','/:id','update','delete','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post'];(function(_0x7d8ac,_0x564b51){var _0x12ae51=function(_0x308777){while(--_0x308777){_0x7d8ac['push'](_0x7d8ac['shift']());}};_0x12ae51(++_0x564b51);}(_0x9f01,0x1a0));var _0x19f0=function(_0x4003b1,_0x20d42b){_0x4003b1=_0x4003b1-0x0;var _0x4bf25e=_0x9f01[_0x4003b1];return _0x4bf25e;};'use strict';var multer=require('multer');var util=require(_0x19f0('0x0'));var path=require(_0x19f0('0x1'));var timeout=require(_0x19f0('0x2'));var express=require('express');var router=express[_0x19f0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x19f0('0x4'));var config=require(_0x19f0('0x5'));var controller=require('./jscriptyProject.controller');router[_0x19f0('0x6')]('/',auth[_0x19f0('0x7')](),controller['index']);router[_0x19f0('0x6')]('/:id',auth[_0x19f0('0x7')](),controller[_0x19f0('0x8')]);router[_0x19f0('0x6')](_0x19f0('0x9'),auth[_0x19f0('0x7')](),controller[_0x19f0('0xa')]);router['get'](_0x19f0('0xb'),auth['isAuthenticated'](),controller[_0x19f0('0xc')]);router[_0x19f0('0x6')](_0x19f0('0xd'),auth[_0x19f0('0x7')](),timeout('30s'),controller[_0x19f0('0xe')]);router[_0x19f0('0xf')]('/',auth[_0x19f0('0x7')](),controller[_0x19f0('0x10')]);router[_0x19f0('0xf')](_0x19f0('0x11'),auth[_0x19f0('0x7')](),controller[_0x19f0('0x12')]);router[_0x19f0('0x13')](_0x19f0('0x14'),auth['isAuthenticated'](),controller[_0x19f0('0x15')]);router[_0x19f0('0x16')](_0x19f0('0x14'),auth[_0x19f0('0x7')](),controller['destroy']);module[_0x19f0('0x17')]=router; \ No newline at end of file +var _0xe089=['isAuthenticated','index','getSessions','/:id/answers','getAnswers','getSummary','post','/:id/clone','clone','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get'];(function(_0x42f9ef,_0x52c879){var _0x39d5d9=function(_0x34a1f9){while(--_0x34a1f9){_0x42f9ef['push'](_0x42f9ef['shift']());}};_0x39d5d9(++_0x52c879);}(_0xe089,0xae));var _0x9e08=function(_0x33d12f,_0x10183e){_0x33d12f=_0x33d12f-0x0;var _0x251ee0=_0xe089[_0x33d12f];return _0x251ee0;};'use strict';var multer=require(_0x9e08('0x0'));var util=require(_0x9e08('0x1'));var path=require(_0x9e08('0x2'));var timeout=require(_0x9e08('0x3'));var express=require('express');var router=express[_0x9e08('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9e08('0x5'));var interaction=require(_0x9e08('0x6'));var config=require(_0x9e08('0x7'));var controller=require(_0x9e08('0x8'));router[_0x9e08('0x9')]('/',auth[_0x9e08('0xa')](),controller[_0x9e08('0xb')]);router[_0x9e08('0x9')]('/:id',auth[_0x9e08('0xa')](),controller['show']);router['get']('/:id/sessions',auth[_0x9e08('0xa')](),controller[_0x9e08('0xc')]);router['get'](_0x9e08('0xd'),auth['isAuthenticated'](),controller[_0x9e08('0xe')]);router[_0x9e08('0x9')]('/:id/summary',auth[_0x9e08('0xa')](),timeout('30s'),controller[_0x9e08('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9e08('0x10')](_0x9e08('0x11'),auth[_0x9e08('0xa')](),controller[_0x9e08('0x12')]);router[_0x9e08('0x13')]('/:id',auth[_0x9e08('0xa')](),controller['update']);router[_0x9e08('0x14')]('/:id',auth[_0x9e08('0xa')](),controller[_0x9e08('0x15')]);module[_0x9e08('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index defd6f7..78f83ad 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 _0x49bd=['formData','stringify','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','lodash','util','exports','STRING','name','TEXT','long'];(function(_0xd76586,_0x2bf0b1){var _0xfc594e=function(_0x4a27a1){while(--_0x4a27a1){_0xd76586['push'](_0xd76586['shift']());}};_0xfc594e(++_0x2bf0b1);}(_0x49bd,0x69));var _0xd49b=function(_0x4d3605,_0x344ab3){_0x4d3605=_0x4d3605-0x0;var _0x273784=_0x49bd[_0x4d3605];return _0x273784;};'use strict';var Sequelize=require('sequelize');var _=require(_0xd49b('0x0'));var util=require(_0xd49b('0x1'));module[_0xd49b('0x2')]={'name':{'type':Sequelize[_0xd49b('0x3')],'unique':_0xd49b('0x4')},'description':{'type':Sequelize[_0xd49b('0x3')]},'formData':{'type':Sequelize[_0xd49b('0x5')](_0xd49b('0x6')),'set':function(_0x216672){if(_['isObjectLike'](_0x216672)){this['setDataValue'](_0xd49b('0x7'),JSON[_0xd49b('0x8')](_0x216672));}else if(_['isString'](_0x216672)){this['setDataValue']('formData',_0x216672);}else{this[_0xd49b('0x9')]('formData',util[_0xd49b('0xa')](_0xd49b('0xb'),this[_0xd49b('0xc')](_0xd49b('0x4'))||'',this['getDataValue'](_0xd49b('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0ae7=['isObjectLike','formData','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN','sequelize','lodash','exports','STRING','TEXT'];(function(_0x2cbadc,_0x84c74f){var _0x544ef6=function(_0x8deed1){while(--_0x8deed1){_0x2cbadc['push'](_0x2cbadc['shift']());}};_0x544ef6(++_0x84c74f);}(_0x0ae7,0xbf));var _0x70ae=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x0ae7[_0x4bb66f];return _0xf2772f;};'use strict';var Sequelize=require(_0x70ae('0x0'));var _=require(_0x70ae('0x1'));var util=require('util');module[_0x70ae('0x2')]={'name':{'type':Sequelize[_0x70ae('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x70ae('0x3')]},'formData':{'type':Sequelize[_0x70ae('0x4')]('long'),'set':function(_0x29b880){if(_[_0x70ae('0x5')](_0x29b880)){this['setDataValue'](_0x70ae('0x6'),JSON['stringify'](_0x29b880));}else if(_[_0x70ae('0x7')](_0x29b880)){this[_0x70ae('0x8')]('formData',_0x29b880);}else{this[_0x70ae('0x8')](_0x70ae('0x6'),util[_0x70ae('0x9')](_0x70ae('0xa'),this[_0x70ae('0xb')](_0x70ae('0xc'))||'',this[_0x70ae('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x70ae('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x70ae('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 68c7c6c..9685a60 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 _0xbbdd=['reject','save','update','then','get','Projects','UserProfileResource','destroy','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','omit','createdAt','updatedAt','UserProfileSection','userProfileId','pick','JscriptySessionReport','getAnswers','findOne','ProjectId','JscriptyAnswerReport','findAll','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','fast-json-patch','request-promise','util','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','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply'];(function(_0x5c9f10,_0x2d6fac){var _0x55ed6a=function(_0xa1f353){while(--_0xa1f353){_0x5c9f10['push'](_0x5c9f10['shift']());}};_0x55ed6a(++_0x2d6fac);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xbbdd[_0x1762b4];return _0x29beda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbbd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbbd('0x1'));var rp=require(_0xdbbd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbbd('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xdbbd('0x4'));var ejs=require(_0xdbbd('0x5'));var fs=require('fs');var fs_extra=require(_0xdbbd('0x6'));var _=require(_0xdbbd('0x7'));var squel=require('squel');var crypto=require(_0xdbbd('0x8'));var jsforce=require(_0xdbbd('0x9'));var deskjs=require(_0xdbbd('0xa'));var toCsv=require(_0xdbbd('0x4'));var querystring=require(_0xdbbd('0xb'));var Papa=require(_0xdbbd('0xc'));var Redis=require(_0xdbbd('0xd'));var authService=require(_0xdbbd('0xe'));var qs=require(_0xdbbd('0xf'));var as=require(_0xdbbd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbbd('0x11'))(_0xdbbd('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x452ca8,_0xac66ed){_0xac66ed=_0xac66ed||0xcc;return function(_0x408ca9){if(_0x408ca9){return _0x452ca8[_0xdbbd('0x13')](_0xac66ed);}return _0x452ca8[_0xdbbd('0x14')](_0xac66ed)[_0xdbbd('0x15')]();};}function respondWithResult(_0x3f4907,_0x56e1b4){_0x56e1b4=_0x56e1b4||0xc8;return function(_0x2e231d){if(_0x2e231d){return _0x3f4907[_0xdbbd('0x14')](_0x56e1b4)['json'](_0x2e231d);}};}function respondWithFilteredResult(_0x38dc82,_0x1a64d9){return function(_0x2c76ad){if(_0x2c76ad){var _0x31a654=typeof _0x1a64d9['offset']===_0xdbbd('0x16')&&typeof _0x1a64d9[_0xdbbd('0x17')]==='undefined';var _0x87438c=_0x2c76ad[_0xdbbd('0x18')];var _0x26eb4c=_0x31a654?0x0:_0x1a64d9[_0xdbbd('0x19')];var _0x322ffc=_0x31a654?_0x2c76ad['count']:_0x1a64d9['offset']+_0x1a64d9['limit'];var _0x397210;if(_0x322ffc>=_0x87438c){_0x322ffc=_0x87438c;_0x397210=0xc8;}else{_0x397210=0xce;}_0x38dc82[_0xdbbd('0x14')](_0x397210);return _0x38dc82[_0xdbbd('0x1a')](_0xdbbd('0x1b'),_0x26eb4c+'-'+_0x322ffc+'/'+_0x87438c)[_0xdbbd('0x1c')](_0x2c76ad);}return null;};}function patchUpdates(_0x5bdddc){return function(_0x20c59b){try{jsonpatch[_0xdbbd('0x1d')](_0x20c59b,_0x5bdddc,!![]);}catch(_0x388209){return BPromise[_0xdbbd('0x1e')](_0x388209);}return _0x20c59b[_0xdbbd('0x1f')]();};}function saveUpdates(_0x3302ac,_0x492cb8){return function(_0x4a8899){if(_0x4a8899){return _0x4a8899[_0xdbbd('0x20')](_0x3302ac)['then'](function(_0x2ec3c2){return _0x2ec3c2;});}return null;};}function removeEntity(_0x1a6759,_0x14eccf){return function(_0x3d1c91){if(_0x3d1c91){return _0x3d1c91['destroy']()[_0xdbbd('0x21')](function(){var _0xef52b4=_0x3d1c91[_0xdbbd('0x22')]({'plain':!![]});var _0x5f3f4d=_0xdbbd('0x23');return db[_0xdbbd('0x24')][_0xdbbd('0x25')]({'where':{'type':_0x5f3f4d,'resourceId':_0xef52b4['id']}})[_0xdbbd('0x21')](function(){return _0x3d1c91;});})[_0xdbbd('0x21')](function(){_0x1a6759[_0xdbbd('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeaa316,_0x44062a){return function(_0xb11f5d){if(!_0xb11f5d){_0xeaa316[_0xdbbd('0x13')](0x194);}return _0xb11f5d;};}function handleError(_0x2772c8,_0x457e54){_0x457e54=_0x457e54||0x1f4;return function(_0x22d6cc){logger['error'](_0x22d6cc[_0xdbbd('0x26')]);if(_0x22d6cc['name']){delete _0x22d6cc[_0xdbbd('0x27')];}_0x2772c8['status'](_0x457e54)[_0xdbbd('0x28')](_0x22d6cc);};}exports[_0xdbbd('0x29')]=function(_0x49aeab,_0x24da65){var _0x2ce1eb={},_0x107c08={},_0x369540={'count':0x0,'rows':[]};var _0x40df71=_[_0xdbbd('0x2a')](db[_0xdbbd('0x2b')][_0xdbbd('0x2c')],function(_0x25e7e4){return{'name':_0x25e7e4[_0xdbbd('0x2d')],'type':_0x25e7e4['type'][_0xdbbd('0x2e')]};});_0x107c08[_0xdbbd('0x2f')]=_[_0xdbbd('0x2a')](_0x40df71,_0xdbbd('0x27'));_0x107c08[_0xdbbd('0x30')]=_['keys'](_0x49aeab[_0xdbbd('0x30')]);_0x107c08[_0xdbbd('0x31')]=_[_0xdbbd('0x32')](_0x107c08[_0xdbbd('0x2f')],_0x107c08[_0xdbbd('0x30')]);_0x2ce1eb['attributes']=_[_0xdbbd('0x32')](_0x107c08[_0xdbbd('0x2f')],qs[_0xdbbd('0x33')](_0x49aeab[_0xdbbd('0x30')][_0xdbbd('0x33')]));_0x2ce1eb['attributes']=_0x2ce1eb[_0xdbbd('0x34')]['length']?_0x2ce1eb[_0xdbbd('0x34')]:_0x107c08[_0xdbbd('0x2f')];if(!_0x49aeab['query'][_0xdbbd('0x35')](_0xdbbd('0x36'))){_0x2ce1eb[_0xdbbd('0x17')]=qs[_0xdbbd('0x17')](_0x49aeab['query']['limit']);_0x2ce1eb[_0xdbbd('0x19')]=qs[_0xdbbd('0x19')](_0x49aeab[_0xdbbd('0x30')][_0xdbbd('0x19')]);}_0x2ce1eb[_0xdbbd('0x37')]=qs[_0xdbbd('0x38')](_0x49aeab['query']['sort']);_0x2ce1eb[_0xdbbd('0x39')]=qs[_0xdbbd('0x31')](_['pick'](_0x49aeab[_0xdbbd('0x30')],_0x107c08[_0xdbbd('0x31')]),_0x40df71);if(_0x49aeab['query'][_0xdbbd('0x3a')]){_0x2ce1eb[_0xdbbd('0x39')]=_[_0xdbbd('0x3b')](_0x2ce1eb['where'],{'$or':_[_0xdbbd('0x2a')](_0x40df71,function(_0x15840f){if(_0x15840f['type']!=='VIRTUAL'){var _0xc61d6f={};_0xc61d6f[_0x15840f[_0xdbbd('0x27')]]={'$like':'%'+_0x49aeab[_0xdbbd('0x30')][_0xdbbd('0x3a')]+'%'};return _0xc61d6f;}})});}_0x2ce1eb=_[_0xdbbd('0x3b')]({},_0x2ce1eb,_0x49aeab[_0xdbbd('0x3c')]);var _0x1eb27f={'where':_0x2ce1eb[_0xdbbd('0x39')]};return db[_0xdbbd('0x2b')][_0xdbbd('0x18')](_0x1eb27f)[_0xdbbd('0x21')](function(_0x1bf934){_0x369540[_0xdbbd('0x18')]=_0x1bf934;if(_0x49aeab[_0xdbbd('0x30')][_0xdbbd('0x3d')]){_0x2ce1eb[_0xdbbd('0x3e')]=[{'all':!![]}];}return db[_0xdbbd('0x2b')]['findAll'](_0x2ce1eb);})[_0xdbbd('0x21')](function(_0x5df96c){_0x369540[_0xdbbd('0x3f')]=_0x5df96c;return _0x369540;})['then'](respondWithFilteredResult(_0x24da65,_0x2ce1eb))[_0xdbbd('0x40')](handleError(_0x24da65,null));};exports['show']=function(_0x1f2839,_0x17735f){var _0x58fda1={'raw':![],'where':{'id':_0x1f2839[_0xdbbd('0x41')]['id']}},_0x340324={};_0x340324[_0xdbbd('0x2f')]=_['keys'](db[_0xdbbd('0x2b')][_0xdbbd('0x2c')]);_0x340324[_0xdbbd('0x30')]=_['keys'](_0x1f2839['query']);_0x340324[_0xdbbd('0x31')]=_[_0xdbbd('0x32')](_0x340324[_0xdbbd('0x2f')],_0x340324[_0xdbbd('0x30')]);_0x58fda1[_0xdbbd('0x34')]=_[_0xdbbd('0x32')](_0x340324['model'],qs[_0xdbbd('0x33')](_0x1f2839[_0xdbbd('0x30')][_0xdbbd('0x33')]));_0x58fda1[_0xdbbd('0x34')]=_0x58fda1['attributes'][_0xdbbd('0x42')]?_0x58fda1['attributes']:_0x340324[_0xdbbd('0x2f')];if(_0x1f2839[_0xdbbd('0x30')]['includeAll']){_0x58fda1[_0xdbbd('0x3e')]=[{'all':!![]}];}_0x58fda1=_[_0xdbbd('0x3b')]({},_0x58fda1,_0x1f2839[_0xdbbd('0x3c')]);return db[_0xdbbd('0x2b')][_0xdbbd('0x43')](_0x58fda1)['then'](handleEntityNotFound(_0x17735f,null))[_0xdbbd('0x21')](respondWithResult(_0x17735f,null))[_0xdbbd('0x40')](handleError(_0x17735f,null));};exports[_0xdbbd('0x44')]=function(_0x54f75d,_0x23183e){return db[_0xdbbd('0x2b')][_0xdbbd('0x44')](_0x54f75d[_0xdbbd('0x45')],{})[_0xdbbd('0x21')](function(_0x13f4a1){var _0x2c9bda=_0x54f75d['user'][_0xdbbd('0x22')]({'plain':!![]});if(!_0x2c9bda)throw new Error(_0xdbbd('0x46'));if(_0x2c9bda[_0xdbbd('0x47')]===_0xdbbd('0x48')){var _0x52a0d2=_0x13f4a1['get']({'plain':!![]});var _0x214cb6='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x214cb6,'userProfileId':_0x2c9bda['userProfileId']},'raw':!![]})[_0xdbbd('0x21')](function(_0x54c1ae){if(_0x54c1ae&&_0x54c1ae[_0xdbbd('0x49')]===0x0){return db[_0xdbbd('0x24')][_0xdbbd('0x44')]({'name':_0x52a0d2[_0xdbbd('0x27')],'resourceId':_0x52a0d2['id'],'type':_0x54c1ae[_0xdbbd('0x27')],'sectionId':_0x54c1ae['id']},{})[_0xdbbd('0x21')](function(){return _0x13f4a1;});}else{return _0x13f4a1;}})['catch'](function(_0x32329){logger[_0xdbbd('0x4a')](_0xdbbd('0x4b'),_0x32329);throw _0x32329;});}return _0x13f4a1;})[_0xdbbd('0x21')](respondWithResult(_0x23183e,0xc9))['catch'](handleError(_0x23183e,null));};exports[_0xdbbd('0x4c')]=function(_0x190a14,_0x184a62){var _0xbf6a8e={'where':{'id':_0x190a14[_0xdbbd('0x41')]['id']}},_0x4bd45e={};_0x4bd45e['model']=_[_0xdbbd('0x4d')](db[_0xdbbd('0x2b')]['rawAttributes']);_0xbf6a8e[_0xdbbd('0x34')]=_['intersection'](_0x4bd45e[_0xdbbd('0x2f')],qs[_0xdbbd('0x33')](_0x190a14[_0xdbbd('0x30')]['fields']));_0xbf6a8e[_0xdbbd('0x34')]=_0xbf6a8e[_0xdbbd('0x34')][_0xdbbd('0x42')]?_0xbf6a8e['attributes']:_0x4bd45e[_0xdbbd('0x2f')];if(_0x190a14[_0xdbbd('0x30')]['includeAll']){_0xbf6a8e[_0xdbbd('0x3e')]=[{'all':!![]}];}_0xbf6a8e=_['merge']({},_0xbf6a8e,_0x190a14[_0xdbbd('0x3c')]);return db[_0xdbbd('0x2b')][_0xdbbd('0x43')](_0xbf6a8e)[_0xdbbd('0x21')](handleEntityNotFound(_0x184a62,null))['then'](function(_0x462eb7){if(_0x462eb7){var _0x1abc46=_0x462eb7['get']({'plain':!![]});_0x1abc46=qs[_0xdbbd('0x4e')](_0x1abc46,['id',_0xdbbd('0x4f'),_0xdbbd('0x50')]);_0x190a14[_0xdbbd('0x45')]=_[_0xdbbd('0x4e')](_0x190a14[_0xdbbd('0x45')],['id','createdAt',_0xdbbd('0x50')]);return db[_0xdbbd('0x2b')]['create'](_[_0xdbbd('0x3b')](_0x1abc46,_0x190a14[_0xdbbd('0x45')]),{'include':_0x190a14['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x1a44ec){var _0x92d532=_0x190a14[_0xdbbd('0x48')][_0xdbbd('0x22')]({'plain':!![]});if(!_0x92d532)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x92d532[_0xdbbd('0x47')]===_0xdbbd('0x48')){var _0x56a2ed=_0x1a44ec[_0xdbbd('0x22')]({'plain':!![]});var _0xf46f6f=_0xdbbd('0x23');return db[_0xdbbd('0x51')][_0xdbbd('0x43')]({'where':{'name':_0xf46f6f,'userProfileId':_0x92d532[_0xdbbd('0x52')]},'raw':!![]})[_0xdbbd('0x21')](function(_0x2401fe){if(_0x2401fe&&_0x2401fe[_0xdbbd('0x49')]===0x0){return db[_0xdbbd('0x24')][_0xdbbd('0x44')]({'name':_0x56a2ed[_0xdbbd('0x27')],'resourceId':_0x56a2ed['id'],'type':_0x2401fe['name'],'sectionId':_0x2401fe['id']},{})['then'](function(){return _0x1a44ec;});}else{return _0x1a44ec;}})[_0xdbbd('0x40')](function(_0x3456bd){logger[_0xdbbd('0x4a')](_0xdbbd('0x4b'),_0x3456bd);throw _0x3456bd;});}return _0x1a44ec;});}})[_0xdbbd('0x21')](respondWithResult(_0x184a62,0xc9))[_0xdbbd('0x40')](handleError(_0x184a62,null));};exports['update']=function(_0x3e89c2,_0x37b295){if(_0x3e89c2[_0xdbbd('0x45')]['id']){delete _0x3e89c2[_0xdbbd('0x45')]['id'];}return db[_0xdbbd('0x2b')]['find']({'where':{'id':_0x3e89c2['params']['id']}})[_0xdbbd('0x21')](handleEntityNotFound(_0x37b295,null))[_0xdbbd('0x21')](saveUpdates(_0x3e89c2[_0xdbbd('0x45')],null))[_0xdbbd('0x21')](respondWithResult(_0x37b295,null))[_0xdbbd('0x40')](handleError(_0x37b295,null));};exports[_0xdbbd('0x25')]=function(_0x1c86fc,_0x2fb938){return db[_0xdbbd('0x2b')]['find']({'where':{'id':_0x1c86fc['params']['id']}})['then'](handleEntityNotFound(_0x2fb938,null))[_0xdbbd('0x21')](removeEntity(_0x2fb938,null))[_0xdbbd('0x40')](handleError(_0x2fb938,null));};exports['getSessions']=function(_0x348744,_0x3a2d6a,_0x555def){var _0x5cff66={'raw':!![],'where':{}};var _0x2e4344={};var _0x59c60f={'count':0x0,'rows':[]};return db[_0xdbbd('0x2b')]['findOne']({'where':{'id':_0x348744['params']['id']}})[_0xdbbd('0x21')](handleEntityNotFound(_0x3a2d6a,null))['then'](function(_0x33d5f3){if(_0x33d5f3){_0x2e4344[_0xdbbd('0x2f')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x2e4344[_0xdbbd('0x30')]=_[_0xdbbd('0x4d')](_0x348744[_0xdbbd('0x30')]);_0x2e4344['filters']=_['intersection'](_0x2e4344[_0xdbbd('0x2f')],_0x2e4344[_0xdbbd('0x30')]);_0x5cff66[_0xdbbd('0x34')]=_[_0xdbbd('0x32')](_0x2e4344[_0xdbbd('0x2f')],qs[_0xdbbd('0x33')](_0x348744[_0xdbbd('0x30')][_0xdbbd('0x33')]));_0x5cff66[_0xdbbd('0x34')]=_0x5cff66[_0xdbbd('0x34')][_0xdbbd('0x42')]?_0x5cff66[_0xdbbd('0x34')]:_0x2e4344['model'];if(!_0x348744[_0xdbbd('0x30')][_0xdbbd('0x35')]('nolimit')){_0x5cff66['limit']=qs[_0xdbbd('0x17')](_0x348744[_0xdbbd('0x30')][_0xdbbd('0x17')]);_0x5cff66[_0xdbbd('0x19')]=qs['offset'](_0x348744['query'][_0xdbbd('0x19')]);}_0x5cff66[_0xdbbd('0x37')]=qs[_0xdbbd('0x38')](_0x348744['query'][_0xdbbd('0x38')]);_0x5cff66[_0xdbbd('0x39')]=qs['filters'](_[_0xdbbd('0x53')](_0x348744[_0xdbbd('0x30')],_0x2e4344[_0xdbbd('0x31')]));_0x5cff66['where']['ProjectId']=_0x33d5f3['id'];if(_0x348744['query'][_0xdbbd('0x3a')]){_0x5cff66[_0xdbbd('0x39')]=_[_0xdbbd('0x3b')](_0x5cff66[_0xdbbd('0x39')],{'$or':_['map'](_0x5cff66[_0xdbbd('0x34')],function(_0x23be6b){var _0x28c212={};_0x28c212[_0x23be6b]={'$like':'%'+_0x348744[_0xdbbd('0x30')][_0xdbbd('0x3a')]+'%'};return _0x28c212;})});}_0x5cff66=_['merge']({},_0x5cff66,_0x348744[_0xdbbd('0x3c')]);return db[_0xdbbd('0x54')][_0xdbbd('0x18')]({'where':_0x5cff66['where']})['then'](function(_0x3242d9){_0x59c60f['count']=_0x3242d9;if(_0x348744[_0xdbbd('0x30')][_0xdbbd('0x3d')]){_0x5cff66[_0xdbbd('0x3e')]=[{'all':!![]}];}return db[_0xdbbd('0x54')]['findAll'](_0x5cff66);})[_0xdbbd('0x21')](function(_0x578186){_0x59c60f[_0xdbbd('0x3f')]=_0x578186;return _0x59c60f;});}})[_0xdbbd('0x21')](respondWithFilteredResult(_0x3a2d6a,_0x5cff66))[_0xdbbd('0x40')](handleError(_0x3a2d6a,null));};exports[_0xdbbd('0x55')]=function(_0x16e665,_0x58c506,_0x53aa21){var _0x52dfba={'raw':!![],'where':{}};var _0x50a3af={};var _0x209fd8={'count':0x0,'rows':[]};return db[_0xdbbd('0x2b')][_0xdbbd('0x56')]({'where':{'id':_0x16e665['params']['id']}})['then'](handleEntityNotFound(_0x58c506,null))[_0xdbbd('0x21')](function(_0x128d26){if(_0x128d26){_0x50a3af[_0xdbbd('0x2f')]=_['keys'](db['JscriptyAnswerReport'][_0xdbbd('0x2c')]);_0x50a3af[_0xdbbd('0x30')]=_['keys'](_0x16e665['query']);_0x50a3af[_0xdbbd('0x31')]=_['intersection'](_0x50a3af['model'],_0x50a3af[_0xdbbd('0x30')]);_0x52dfba[_0xdbbd('0x34')]=_[_0xdbbd('0x32')](_0x50a3af['model'],qs[_0xdbbd('0x33')](_0x16e665['query'][_0xdbbd('0x33')]));_0x52dfba[_0xdbbd('0x34')]=_0x52dfba[_0xdbbd('0x34')][_0xdbbd('0x42')]?_0x52dfba['attributes']:_0x50a3af[_0xdbbd('0x2f')];if(!_0x16e665['query'][_0xdbbd('0x35')]('nolimit')){_0x52dfba[_0xdbbd('0x17')]=qs[_0xdbbd('0x17')](_0x16e665[_0xdbbd('0x30')][_0xdbbd('0x17')]);_0x52dfba[_0xdbbd('0x19')]=qs['offset'](_0x16e665[_0xdbbd('0x30')]['offset']);}_0x52dfba[_0xdbbd('0x37')]=qs[_0xdbbd('0x38')](_0x16e665[_0xdbbd('0x30')][_0xdbbd('0x38')]);_0x52dfba[_0xdbbd('0x39')]=qs[_0xdbbd('0x31')](_[_0xdbbd('0x53')](_0x16e665[_0xdbbd('0x30')],_0x50a3af[_0xdbbd('0x31')]));_0x52dfba[_0xdbbd('0x39')][_0xdbbd('0x57')]=_0x128d26['id'];if(_0x16e665[_0xdbbd('0x30')][_0xdbbd('0x3a')]){_0x52dfba['where']=_[_0xdbbd('0x3b')](_0x52dfba['where'],{'$or':_[_0xdbbd('0x2a')](_0x52dfba[_0xdbbd('0x34')],function(_0x47127c){var _0x3e6591={};_0x3e6591[_0x47127c]={'$like':'%'+_0x16e665[_0xdbbd('0x30')][_0xdbbd('0x3a')]+'%'};return _0x3e6591;})});}_0x52dfba=_[_0xdbbd('0x3b')]({},_0x52dfba,_0x16e665[_0xdbbd('0x3c')]);return db[_0xdbbd('0x58')]['count']({'where':_0x52dfba[_0xdbbd('0x39')]})[_0xdbbd('0x21')](function(_0x17f25e){_0x209fd8[_0xdbbd('0x18')]=_0x17f25e;if(_0x16e665[_0xdbbd('0x30')][_0xdbbd('0x3d')]){_0x52dfba['include']=[{'all':!![]}];}return db[_0xdbbd('0x58')][_0xdbbd('0x59')](_0x52dfba);})[_0xdbbd('0x21')](function(_0x542f96){_0x209fd8[_0xdbbd('0x3f')]=_0x542f96;return _0x209fd8;});}})[_0xdbbd('0x21')](respondWithFilteredResult(_0x58c506,_0x52dfba))[_0xdbbd('0x40')](handleError(_0x58c506,null));};function char(_0x4b7391){return _0xdbbd('0x5a')===typeof _0x4b7391?String[_0xdbbd('0x5b')]['apply'](null,arguments):_0x4b7391;}function needsEncapsulation(_0x2c95af){return!!_0x2c95af&&(_0x2c95af[_0xdbbd('0x5c')]()[_0xdbbd('0x5d')](char(0xd))>=0x0||_0x2c95af[_0xdbbd('0x5c')]()['indexOf'](char(0xa))>=0x0||_0x2c95af['toString']()[_0xdbbd('0x5d')](char(0x2c))>=0x0||_0x2c95af[_0xdbbd('0x5c')]()[_0xdbbd('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x22485c){var _0x1d1471=char(0x22),_0xefdb93='\x5c'+char(0x22),_0x5ee9eb=_0x22485c['toString']()[_0xdbbd('0x5e')](new RegExp(_0x1d1471,'g'),_0xefdb93);return _0x1d1471+_0x5ee9eb+_0x1d1471;}exports[_0xdbbd('0x5f')]=function(_0xbe141,_0x2b2631,_0x590d20){var _0xc8570,_0x547fed;var _0x2af1b3={'where':{'ProjectId':_0xbe141[_0xdbbd('0x41')]['id']}};if(_0xbe141[_0xdbbd('0x30')]['startTime']){_0x2af1b3['where'][_0xdbbd('0x60')]=JSON[_0xdbbd('0x61')](_0xbe141[_0xdbbd('0x30')][_0xdbbd('0x62')]);}return db['JscriptySessionReport']['findAll'](_0x2af1b3)[_0xdbbd('0x21')](handleEntityNotFound(_0x2b2631,null))[_0xdbbd('0x21')](function(_0x2e02d2){if(_0x2e02d2){_0xc8570=_0x2e02d2;return db[_0xdbbd('0x63')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0xc8570,'id')},'ProjectId':_0xbe141['params']['id']},'order':'-createdAt'});}})[_0xdbbd('0x21')](handleEntityNotFound(_0x2b2631,null))['then'](function(_0x1ef01b){if(_0x1ef01b){_0x547fed=_0x1ef01b;var _0x340fe0={};for(var _0x5af96e=0x0,_0x1523d8=_0x547fed['length'];_0x5af96e<_0x1523d8;_0x5af96e++){if(!_0x340fe0[_0xdbbd('0x35')](_0x547fed[_0x5af96e]['questionId'])){_0x340fe0[_0x547fed[_0x5af96e][_0xdbbd('0x64')]]=needsEncapsulation(_0x547fed[_0x5af96e][_0xdbbd('0x65')])?encapsulate(_0x547fed[_0x5af96e][_0xdbbd('0x65')]):_0x547fed[_0x5af96e]['question'];}}var _0x5ec7b3=[],_0x41ea03={};for(var _0x173dab=0x0,_0x4e946d=_0xc8570[_0xdbbd('0x42')];_0x173dab<_0x4e946d;_0x173dab++){_0x41ea03={'ProjectId':_0xbe141[_0xdbbd('0x41')]['id'],'SessionId':_0xc8570[_0x173dab]['id'],'StartTime':moment(_0xc8570[_0x173dab][_0xdbbd('0x60')])[_0xdbbd('0x66')](_0xdbbd('0x67'))};for(var _0x4813ce=0x0,_0x3b765e=_0x547fed['length'];_0x4813ce<_0x3b765e;_0x4813ce++){if(_0x547fed[_0x4813ce][_0xdbbd('0x68')]==_0xc8570[_0x173dab]['id']&&_0x340fe0[_0xdbbd('0x35')](_0x547fed[_0x4813ce][_0xdbbd('0x64')])){_0x41ea03[_0x340fe0[_0x547fed[_0x4813ce][_0xdbbd('0x64')]]]=_0x547fed[_0x4813ce][_0xdbbd('0x69')];}}for(var _0x590079 in _0x340fe0){if(!_0x41ea03[_0xdbbd('0x35')](_0x340fe0[_0x590079])){_0x41ea03[_0x340fe0[_0x590079]]=null;}}_0x5ec7b3[_0xdbbd('0x6a')](_0x41ea03);}return _0x5ec7b3;}})[_0xdbbd('0x21')](function(_0x1aeb1c){if(!_[_0xdbbd('0x6b')](_0x1aeb1c)){var _0x1c1820=toCsv(_0x1aeb1c);var _0xfabd7c=Date[_0xdbbd('0x6c')]();fs[_0xdbbd('0x6d')](util[_0xdbbd('0x66')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xbe141[_0xdbbd('0x41')]['id'],_0xfabd7c),_0x1c1820);_0x2b2631[_0xdbbd('0x6e')](_0xdbbd('0x6f'),_0xdbbd('0x70')+util[_0xdbbd('0x66')](_0xdbbd('0x71'),_0xbe141[_0xdbbd('0x41')]['id'],_0xfabd7c));_0x2b2631[_0xdbbd('0x6e')](_0xdbbd('0x72'),_0xdbbd('0x73'));return _0x2b2631[_0xdbbd('0x74')](util[_0xdbbd('0x66')](_0xdbbd('0x75'),_0xbe141['params']['id'],_0xfabd7c));}else{return _0x2b2631[_0xdbbd('0x13')](0xcc);}})[_0xdbbd('0x40')](handleError(_0x2b2631,null));}; \ No newline at end of file +var _0x3166=['length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','JscriptyProject','catch','show','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','include','createdAt','body','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','JscriptySessionReport','ProjectId','getAnswers','findOne','JscriptyAnswerReport','findAll','rows','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x3166,0xbb));var _0x6316=function(_0x3f4f15,_0x48b3c1){_0x3f4f15=_0x3f4f15-0x0;var _0xc83967=_0x3166[_0x3f4f15];return _0xc83967;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6316('0x0'));var zipdir=require(_0x6316('0x1'));var jsonpatch=require(_0x6316('0x2'));var rp=require('request-promise');var moment=require(_0x6316('0x3'));var BPromise=require(_0x6316('0x4'));var Mustache=require('mustache');var util=require(_0x6316('0x5'));var path=require(_0x6316('0x6'));var sox=require('sox');var csv=require(_0x6316('0x7'));var ejs=require(_0x6316('0x8'));var fs=require('fs');var fs_extra=require(_0x6316('0x9'));var _=require(_0x6316('0xa'));var squel=require('squel');var crypto=require(_0x6316('0xb'));var jsforce=require(_0x6316('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6316('0x7'));var querystring=require(_0x6316('0xd'));var Papa=require(_0x6316('0xe'));var Redis=require(_0x6316('0xf'));var authService=require(_0x6316('0x10'));var qs=require(_0x6316('0x11'));var as=require(_0x6316('0x12'));var hardwareService=require(_0x6316('0x13'));var logger=require(_0x6316('0x14'))(_0x6316('0x15'));var utils=require(_0x6316('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6316('0x17'));var db=require(_0x6316('0x18'))['db'];function respondWithStatusCode(_0x1a1c46,_0x34898b){_0x34898b=_0x34898b||0xcc;return function(_0x468c19){if(_0x468c19){return _0x1a1c46[_0x6316('0x19')](_0x34898b);}return _0x1a1c46['status'](_0x34898b)[_0x6316('0x1a')]();};}function respondWithResult(_0x6261d5,_0x15b8bb){_0x15b8bb=_0x15b8bb||0xc8;return function(_0xcba5ff){if(_0xcba5ff){return _0x6261d5['status'](_0x15b8bb)[_0x6316('0x1b')](_0xcba5ff);}};}function respondWithFilteredResult(_0x46022e,_0x2e1d48){return function(_0x493139){if(_0x493139){var _0x22348f=typeof _0x2e1d48[_0x6316('0x1c')]==='undefined'&&typeof _0x2e1d48[_0x6316('0x1d')]===_0x6316('0x1e');var _0x3f9e07=_0x493139[_0x6316('0x1f')];var _0x569db2=_0x22348f?0x0:_0x2e1d48['offset'];var _0x2eecb9=_0x22348f?_0x493139[_0x6316('0x1f')]:_0x2e1d48[_0x6316('0x1c')]+_0x2e1d48[_0x6316('0x1d')];var _0x22cd6e;if(_0x2eecb9>=_0x3f9e07){_0x2eecb9=_0x3f9e07;_0x22cd6e=0xc8;}else{_0x22cd6e=0xce;}_0x46022e[_0x6316('0x20')](_0x22cd6e);return _0x46022e[_0x6316('0x21')](_0x6316('0x22'),_0x569db2+'-'+_0x2eecb9+'/'+_0x3f9e07)[_0x6316('0x1b')](_0x493139);}return null;};}function patchUpdates(_0x3e4543){return function(_0x36db62){try{jsonpatch['apply'](_0x36db62,_0x3e4543,!![]);}catch(_0x1ed2d2){return BPromise[_0x6316('0x23')](_0x1ed2d2);}return _0x36db62[_0x6316('0x24')]();};}function saveUpdates(_0x156065,_0x3cfc43){return function(_0x236256){if(_0x236256){return _0x236256[_0x6316('0x25')](_0x156065)[_0x6316('0x26')](function(_0x59000b){return _0x59000b;});}return null;};}function removeEntity(_0x4063e3,_0x46e2c1){return function(_0x3206ef){if(_0x3206ef){return _0x3206ef[_0x6316('0x27')]()['then'](function(){var _0x434706=_0x3206ef[_0x6316('0x28')]({'plain':!![]});var _0x11a2b1='Projects';return db[_0x6316('0x29')][_0x6316('0x27')]({'where':{'type':_0x11a2b1,'resourceId':_0x434706['id']}})[_0x6316('0x26')](function(){return _0x3206ef;});})[_0x6316('0x26')](function(){_0x4063e3[_0x6316('0x20')](0xcc)[_0x6316('0x1a')]();});}};}function handleEntityNotFound(_0x39dd2d,_0x40b04f){return function(_0xed60e){if(!_0xed60e){_0x39dd2d['sendStatus'](0x194);}return _0xed60e;};}function handleError(_0x7315dc,_0x6fc86a){_0x6fc86a=_0x6fc86a||0x1f4;return function(_0x546eae){logger[_0x6316('0x2a')](_0x546eae['stack']);if(_0x546eae[_0x6316('0x2b')]){delete _0x546eae[_0x6316('0x2b')];}_0x7315dc['status'](_0x6fc86a)['send'](_0x546eae);};}exports[_0x6316('0x2c')]=function(_0x4f97fc,_0x528f8d){var _0x48d6f6={},_0x5616e2={},_0x14f449={'count':0x0,'rows':[]};var _0x1adbce=_[_0x6316('0x2d')](db['JscriptyProject'][_0x6316('0x2e')],function(_0x459c66){return{'name':_0x459c66[_0x6316('0x2f')],'type':_0x459c66[_0x6316('0x30')][_0x6316('0x31')]};});_0x5616e2[_0x6316('0x32')]=_[_0x6316('0x2d')](_0x1adbce,_0x6316('0x2b'));_0x5616e2['query']=_[_0x6316('0x33')](_0x4f97fc[_0x6316('0x34')]);_0x5616e2[_0x6316('0x35')]=_[_0x6316('0x36')](_0x5616e2[_0x6316('0x32')],_0x5616e2['query']);_0x48d6f6[_0x6316('0x37')]=_[_0x6316('0x36')](_0x5616e2['model'],qs[_0x6316('0x38')](_0x4f97fc[_0x6316('0x34')][_0x6316('0x38')]));_0x48d6f6[_0x6316('0x37')]=_0x48d6f6['attributes'][_0x6316('0x39')]?_0x48d6f6[_0x6316('0x37')]:_0x5616e2['model'];if(!_0x4f97fc[_0x6316('0x34')][_0x6316('0x3a')](_0x6316('0x3b'))){_0x48d6f6[_0x6316('0x1d')]=qs[_0x6316('0x1d')](_0x4f97fc[_0x6316('0x34')][_0x6316('0x1d')]);_0x48d6f6['offset']=qs[_0x6316('0x1c')](_0x4f97fc[_0x6316('0x34')][_0x6316('0x1c')]);}_0x48d6f6[_0x6316('0x3c')]=qs[_0x6316('0x3d')](_0x4f97fc['query'][_0x6316('0x3d')]);_0x48d6f6[_0x6316('0x3e')]=qs[_0x6316('0x35')](_[_0x6316('0x3f')](_0x4f97fc[_0x6316('0x34')],_0x5616e2['filters']),_0x1adbce);if(_0x4f97fc[_0x6316('0x34')]['filter']){_0x48d6f6['where']=_['merge'](_0x48d6f6[_0x6316('0x3e')],{'$or':_['map'](_0x1adbce,function(_0x5d7115){if(_0x5d7115[_0x6316('0x30')]!==_0x6316('0x40')){var _0x16f4b4={};_0x16f4b4[_0x5d7115['name']]={'$like':'%'+_0x4f97fc[_0x6316('0x34')][_0x6316('0x41')]+'%'};return _0x16f4b4;}})});}_0x48d6f6=_[_0x6316('0x42')]({},_0x48d6f6,_0x4f97fc[_0x6316('0x43')]);var _0xab5550={'where':_0x48d6f6[_0x6316('0x3e')]};return db['JscriptyProject'][_0x6316('0x1f')](_0xab5550)['then'](function(_0x446a1f){_0x14f449[_0x6316('0x1f')]=_0x446a1f;if(_0x4f97fc[_0x6316('0x34')]['includeAll']){_0x48d6f6['include']=[{'all':!![]}];}return db[_0x6316('0x44')]['findAll'](_0x48d6f6);})[_0x6316('0x26')](function(_0x4ed79c){_0x14f449['rows']=_0x4ed79c;return _0x14f449;})['then'](respondWithFilteredResult(_0x528f8d,_0x48d6f6))[_0x6316('0x45')](handleError(_0x528f8d,null));};exports[_0x6316('0x46')]=function(_0x560b2e,_0x384e65){var _0x34b69e={'raw':![],'where':{'id':_0x560b2e[_0x6316('0x47')]['id']}},_0x2f594b={};_0x2f594b[_0x6316('0x32')]=_[_0x6316('0x33')](db['JscriptyProject']['rawAttributes']);_0x2f594b[_0x6316('0x34')]=_[_0x6316('0x33')](_0x560b2e[_0x6316('0x34')]);_0x2f594b[_0x6316('0x35')]=_[_0x6316('0x36')](_0x2f594b[_0x6316('0x32')],_0x2f594b[_0x6316('0x34')]);_0x34b69e[_0x6316('0x37')]=_[_0x6316('0x36')](_0x2f594b[_0x6316('0x32')],qs[_0x6316('0x38')](_0x560b2e['query']['fields']));_0x34b69e[_0x6316('0x37')]=_0x34b69e[_0x6316('0x37')][_0x6316('0x39')]?_0x34b69e['attributes']:_0x2f594b['model'];if(_0x560b2e[_0x6316('0x34')]['includeAll']){_0x34b69e['include']=[{'all':!![]}];}_0x34b69e=_[_0x6316('0x42')]({},_0x34b69e,_0x560b2e['options']);return db[_0x6316('0x44')][_0x6316('0x48')](_0x34b69e)[_0x6316('0x26')](handleEntityNotFound(_0x384e65,null))[_0x6316('0x26')](respondWithResult(_0x384e65,null))['catch'](handleError(_0x384e65,null));};exports[_0x6316('0x49')]=function(_0x73cf7b,_0x253ded){return db[_0x6316('0x44')][_0x6316('0x49')](_0x73cf7b['body'],{})['then'](function(_0x32bf74){var _0x3d1ae2=_0x73cf7b[_0x6316('0x4a')][_0x6316('0x28')]({'plain':!![]});if(!_0x3d1ae2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d1ae2[_0x6316('0x4b')]===_0x6316('0x4a')){var _0x81538d=_0x32bf74['get']({'plain':!![]});var _0x3a2579='Projects';return db[_0x6316('0x4c')][_0x6316('0x48')]({'where':{'name':_0x3a2579,'userProfileId':_0x3d1ae2[_0x6316('0x4d')]},'raw':!![]})['then'](function(_0x3c51df){if(_0x3c51df&&_0x3c51df[_0x6316('0x4e')]===0x0){return db['UserProfileResource'][_0x6316('0x49')]({'name':_0x81538d[_0x6316('0x2b')],'resourceId':_0x81538d['id'],'type':_0x3c51df[_0x6316('0x2b')],'sectionId':_0x3c51df['id']},{})[_0x6316('0x26')](function(){return _0x32bf74;});}else{return _0x32bf74;}})['catch'](function(_0x596c14){logger[_0x6316('0x2a')](_0x6316('0x4f'),_0x596c14);throw _0x596c14;});}return _0x32bf74;})[_0x6316('0x26')](respondWithResult(_0x253ded,0xc9))[_0x6316('0x45')](handleError(_0x253ded,null));};exports[_0x6316('0x50')]=function(_0x179e50,_0x28f2c7){var _0x5723ff={'where':{'id':_0x179e50['params']['id']}},_0x3250d8={};_0x3250d8[_0x6316('0x32')]=_[_0x6316('0x33')](db[_0x6316('0x44')][_0x6316('0x2e')]);_0x5723ff[_0x6316('0x37')]=_['intersection'](_0x3250d8[_0x6316('0x32')],qs['fields'](_0x179e50[_0x6316('0x34')][_0x6316('0x38')]));_0x5723ff[_0x6316('0x37')]=_0x5723ff[_0x6316('0x37')]['length']?_0x5723ff[_0x6316('0x37')]:_0x3250d8[_0x6316('0x32')];if(_0x179e50['query'][_0x6316('0x51')]){_0x5723ff[_0x6316('0x52')]=[{'all':!![]}];}_0x5723ff=_[_0x6316('0x42')]({},_0x5723ff,_0x179e50[_0x6316('0x43')]);return db[_0x6316('0x44')][_0x6316('0x48')](_0x5723ff)[_0x6316('0x26')](handleEntityNotFound(_0x28f2c7,null))['then'](function(_0x54e536){if(_0x54e536){var _0x2eef96=_0x54e536[_0x6316('0x28')]({'plain':!![]});_0x2eef96=qs['omit'](_0x2eef96,['id',_0x6316('0x53'),'updatedAt']);_0x179e50[_0x6316('0x54')]=_[_0x6316('0x55')](_0x179e50[_0x6316('0x54')],['id','createdAt',_0x6316('0x56')]);return db[_0x6316('0x44')][_0x6316('0x49')](_[_0x6316('0x42')](_0x2eef96,_0x179e50['body']),{'include':_0x179e50[_0x6316('0x34')][_0x6316('0x51')]?[{'all':!![]}]:undefined})['then'](function(_0x566ba1){var _0x34edb5=_0x179e50[_0x6316('0x4a')][_0x6316('0x28')]({'plain':!![]});if(!_0x34edb5)throw new Error(_0x6316('0x57'));if(_0x34edb5[_0x6316('0x4b')]==='user'){var _0xb95aa9=_0x566ba1[_0x6316('0x28')]({'plain':!![]});var _0x1125b7=_0x6316('0x58');return db[_0x6316('0x4c')][_0x6316('0x48')]({'where':{'name':_0x1125b7,'userProfileId':_0x34edb5[_0x6316('0x4d')]},'raw':!![]})['then'](function(_0x1cb112){if(_0x1cb112&&_0x1cb112[_0x6316('0x4e')]===0x0){return db[_0x6316('0x29')][_0x6316('0x49')]({'name':_0xb95aa9[_0x6316('0x2b')],'resourceId':_0xb95aa9['id'],'type':_0x1cb112[_0x6316('0x2b')],'sectionId':_0x1cb112['id']},{})['then'](function(){return _0x566ba1;});}else{return _0x566ba1;}})[_0x6316('0x45')](function(_0x21ee71){logger[_0x6316('0x2a')](_0x6316('0x4f'),_0x21ee71);throw _0x21ee71;});}return _0x566ba1;});}})[_0x6316('0x26')](respondWithResult(_0x28f2c7,0xc9))['catch'](handleError(_0x28f2c7,null));};exports[_0x6316('0x25')]=function(_0x4a9b5e,_0x3b2cfb){if(_0x4a9b5e['body']['id']){delete _0x4a9b5e['body']['id'];}return db[_0x6316('0x44')][_0x6316('0x48')]({'where':{'id':_0x4a9b5e[_0x6316('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b2cfb,null))[_0x6316('0x26')](saveUpdates(_0x4a9b5e['body'],null))[_0x6316('0x26')](respondWithResult(_0x3b2cfb,null))[_0x6316('0x45')](handleError(_0x3b2cfb,null));};exports[_0x6316('0x27')]=function(_0x4bf592,_0x71f8af){return db[_0x6316('0x44')][_0x6316('0x48')]({'where':{'id':_0x4bf592['params']['id']}})[_0x6316('0x26')](handleEntityNotFound(_0x71f8af,null))[_0x6316('0x26')](removeEntity(_0x71f8af,null))[_0x6316('0x45')](handleError(_0x71f8af,null));};exports['getSessions']=function(_0x41850a,_0x255cd3,_0x5c8f5c){var _0x201b83={'raw':!![],'where':{}};var _0x337cb4={};var _0x246024={'count':0x0,'rows':[]};return db[_0x6316('0x44')]['findOne']({'where':{'id':_0x41850a[_0x6316('0x47')]['id']}})[_0x6316('0x26')](handleEntityNotFound(_0x255cd3,null))[_0x6316('0x26')](function(_0x3ec534){if(_0x3ec534){_0x337cb4[_0x6316('0x32')]=_[_0x6316('0x33')](db[_0x6316('0x59')][_0x6316('0x2e')]);_0x337cb4['query']=_[_0x6316('0x33')](_0x41850a[_0x6316('0x34')]);_0x337cb4[_0x6316('0x35')]=_[_0x6316('0x36')](_0x337cb4[_0x6316('0x32')],_0x337cb4[_0x6316('0x34')]);_0x201b83['attributes']=_[_0x6316('0x36')](_0x337cb4['model'],qs[_0x6316('0x38')](_0x41850a[_0x6316('0x34')]['fields']));_0x201b83['attributes']=_0x201b83[_0x6316('0x37')][_0x6316('0x39')]?_0x201b83['attributes']:_0x337cb4['model'];if(!_0x41850a[_0x6316('0x34')]['hasOwnProperty'](_0x6316('0x3b'))){_0x201b83[_0x6316('0x1d')]=qs['limit'](_0x41850a['query'][_0x6316('0x1d')]);_0x201b83[_0x6316('0x1c')]=qs[_0x6316('0x1c')](_0x41850a[_0x6316('0x34')]['offset']);}_0x201b83[_0x6316('0x3c')]=qs[_0x6316('0x3d')](_0x41850a['query'][_0x6316('0x3d')]);_0x201b83['where']=qs['filters'](_[_0x6316('0x3f')](_0x41850a[_0x6316('0x34')],_0x337cb4['filters']));_0x201b83[_0x6316('0x3e')][_0x6316('0x5a')]=_0x3ec534['id'];if(_0x41850a[_0x6316('0x34')][_0x6316('0x41')]){_0x201b83[_0x6316('0x3e')]=_['merge'](_0x201b83['where'],{'$or':_['map'](_0x201b83[_0x6316('0x37')],function(_0x1792a9){var _0x24c45f={};_0x24c45f[_0x1792a9]={'$like':'%'+_0x41850a[_0x6316('0x34')][_0x6316('0x41')]+'%'};return _0x24c45f;})});}_0x201b83=_[_0x6316('0x42')]({},_0x201b83,_0x41850a[_0x6316('0x43')]);return db[_0x6316('0x59')]['count']({'where':_0x201b83[_0x6316('0x3e')]})[_0x6316('0x26')](function(_0xd8154d){_0x246024[_0x6316('0x1f')]=_0xd8154d;if(_0x41850a[_0x6316('0x34')][_0x6316('0x51')]){_0x201b83[_0x6316('0x52')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x201b83);})['then'](function(_0x44715e){_0x246024['rows']=_0x44715e;return _0x246024;});}})[_0x6316('0x26')](respondWithFilteredResult(_0x255cd3,_0x201b83))['catch'](handleError(_0x255cd3,null));};exports[_0x6316('0x5b')]=function(_0x5aee31,_0x1ccfef,_0x2c8461){var _0x59d39f={'raw':!![],'where':{}};var _0x3f84f6={};var _0x3e6464={'count':0x0,'rows':[]};return db[_0x6316('0x44')][_0x6316('0x5c')]({'where':{'id':_0x5aee31[_0x6316('0x47')]['id']}})[_0x6316('0x26')](handleEntityNotFound(_0x1ccfef,null))[_0x6316('0x26')](function(_0x44345a){if(_0x44345a){_0x3f84f6[_0x6316('0x32')]=_[_0x6316('0x33')](db[_0x6316('0x5d')][_0x6316('0x2e')]);_0x3f84f6[_0x6316('0x34')]=_[_0x6316('0x33')](_0x5aee31[_0x6316('0x34')]);_0x3f84f6['filters']=_[_0x6316('0x36')](_0x3f84f6['model'],_0x3f84f6[_0x6316('0x34')]);_0x59d39f['attributes']=_[_0x6316('0x36')](_0x3f84f6['model'],qs[_0x6316('0x38')](_0x5aee31[_0x6316('0x34')][_0x6316('0x38')]));_0x59d39f['attributes']=_0x59d39f['attributes']['length']?_0x59d39f[_0x6316('0x37')]:_0x3f84f6[_0x6316('0x32')];if(!_0x5aee31[_0x6316('0x34')][_0x6316('0x3a')](_0x6316('0x3b'))){_0x59d39f[_0x6316('0x1d')]=qs[_0x6316('0x1d')](_0x5aee31['query'][_0x6316('0x1d')]);_0x59d39f[_0x6316('0x1c')]=qs[_0x6316('0x1c')](_0x5aee31[_0x6316('0x34')][_0x6316('0x1c')]);}_0x59d39f['order']=qs[_0x6316('0x3d')](_0x5aee31[_0x6316('0x34')][_0x6316('0x3d')]);_0x59d39f[_0x6316('0x3e')]=qs[_0x6316('0x35')](_['pick'](_0x5aee31['query'],_0x3f84f6[_0x6316('0x35')]));_0x59d39f[_0x6316('0x3e')][_0x6316('0x5a')]=_0x44345a['id'];if(_0x5aee31[_0x6316('0x34')][_0x6316('0x41')]){_0x59d39f[_0x6316('0x3e')]=_[_0x6316('0x42')](_0x59d39f[_0x6316('0x3e')],{'$or':_[_0x6316('0x2d')](_0x59d39f['attributes'],function(_0x6b3b11){var _0x288327={};_0x288327[_0x6b3b11]={'$like':'%'+_0x5aee31[_0x6316('0x34')][_0x6316('0x41')]+'%'};return _0x288327;})});}_0x59d39f=_[_0x6316('0x42')]({},_0x59d39f,_0x5aee31[_0x6316('0x43')]);return db[_0x6316('0x5d')][_0x6316('0x1f')]({'where':_0x59d39f['where']})[_0x6316('0x26')](function(_0x490422){_0x3e6464[_0x6316('0x1f')]=_0x490422;if(_0x5aee31[_0x6316('0x34')]['includeAll']){_0x59d39f[_0x6316('0x52')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x6316('0x5e')](_0x59d39f);})['then'](function(_0x45e291){_0x3e6464[_0x6316('0x5f')]=_0x45e291;return _0x3e6464;});}})[_0x6316('0x26')](respondWithFilteredResult(_0x1ccfef,_0x59d39f))[_0x6316('0x45')](handleError(_0x1ccfef,null));};function char(_0x424718){return _0x6316('0x60')===typeof _0x424718?String[_0x6316('0x61')][_0x6316('0x62')](null,arguments):_0x424718;}function needsEncapsulation(_0x2ec830){return!!_0x2ec830&&(_0x2ec830[_0x6316('0x63')]()[_0x6316('0x64')](char(0xd))>=0x0||_0x2ec830[_0x6316('0x63')]()[_0x6316('0x64')](char(0xa))>=0x0||_0x2ec830[_0x6316('0x63')]()[_0x6316('0x64')](char(0x2c))>=0x0||_0x2ec830[_0x6316('0x63')]()[_0x6316('0x64')](char(0x22))>=0x0);}function encapsulate(_0x53721c){var _0x4ed949=char(0x22),_0x5e57ad='\x5c'+char(0x22),_0x308b17=_0x53721c[_0x6316('0x63')]()[_0x6316('0x65')](new RegExp(_0x4ed949,'g'),_0x5e57ad);return _0x4ed949+_0x308b17+_0x4ed949;}exports[_0x6316('0x66')]=function(_0x550822,_0x28f200,_0x2d9eef){var _0x4174af,_0x142f07;var _0x6e64ce={'where':{'ProjectId':_0x550822[_0x6316('0x47')]['id']}};if(_0x550822['query'][_0x6316('0x67')]){_0x6e64ce['where'][_0x6316('0x68')]=JSON[_0x6316('0x69')](_0x550822[_0x6316('0x34')]['startTime']);}return db[_0x6316('0x59')][_0x6316('0x5e')](_0x6e64ce)[_0x6316('0x26')](handleEntityNotFound(_0x28f200,null))['then'](function(_0x320c34){if(_0x320c34){_0x4174af=_0x320c34;return db[_0x6316('0x6a')][_0x6316('0x5e')]({'where':{'SessionId':{'$in':_[_0x6316('0x2d')](_0x4174af,'id')},'ProjectId':_0x550822[_0x6316('0x47')]['id']},'order':'-createdAt'});}})[_0x6316('0x26')](handleEntityNotFound(_0x28f200,null))[_0x6316('0x26')](function(_0x2636a9){if(_0x2636a9){_0x142f07=_0x2636a9;var _0x1e6a38={};for(var _0x30692e=0x0,_0x8c599e=_0x142f07[_0x6316('0x39')];_0x30692e<_0x8c599e;_0x30692e++){if(!_0x1e6a38[_0x6316('0x3a')](_0x142f07[_0x30692e][_0x6316('0x6b')])){_0x1e6a38[_0x142f07[_0x30692e]['questionId']]=needsEncapsulation(_0x142f07[_0x30692e]['question'])?encapsulate(_0x142f07[_0x30692e][_0x6316('0x6c')]):_0x142f07[_0x30692e][_0x6316('0x6c')];}}var _0x348155=[],_0x13cfe6={};for(var _0x4c5e5b=0x0,_0x5cd73b=_0x4174af['length'];_0x4c5e5b<_0x5cd73b;_0x4c5e5b++){_0x13cfe6={'ProjectId':_0x550822[_0x6316('0x47')]['id'],'SessionId':_0x4174af[_0x4c5e5b]['id'],'StartTime':moment(_0x4174af[_0x4c5e5b][_0x6316('0x68')])[_0x6316('0x6d')](_0x6316('0x6e'))};for(var _0x265706=0x0,_0x2af6ce=_0x142f07[_0x6316('0x39')];_0x265706<_0x2af6ce;_0x265706++){if(_0x142f07[_0x265706][_0x6316('0x6f')]==_0x4174af[_0x4c5e5b]['id']&&_0x1e6a38[_0x6316('0x3a')](_0x142f07[_0x265706][_0x6316('0x6b')])){_0x13cfe6[_0x1e6a38[_0x142f07[_0x265706]['questionId']]]=_0x142f07[_0x265706][_0x6316('0x70')];}}for(var _0x3e2714 in _0x1e6a38){if(!_0x13cfe6[_0x6316('0x3a')](_0x1e6a38[_0x3e2714])){_0x13cfe6[_0x1e6a38[_0x3e2714]]=null;}}_0x348155[_0x6316('0x71')](_0x13cfe6);}return _0x348155;}})[_0x6316('0x26')](function(_0x49cdb6){if(!_[_0x6316('0x72')](_0x49cdb6)){var _0x54c393=toCsv(_0x49cdb6);var _0x3c485f=Date['now']();fs[_0x6316('0x73')](util['format'](_0x6316('0x74'),_0x550822['params']['id'],_0x3c485f),_0x54c393);_0x28f200[_0x6316('0x75')]('Content-disposition',_0x6316('0x76')+util[_0x6316('0x6d')](_0x6316('0x77'),_0x550822[_0x6316('0x47')]['id'],_0x3c485f));_0x28f200['setHeader'](_0x6316('0x78'),_0x6316('0x79'));return _0x28f200['download'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x550822['params']['id'],_0x3c485f));}else{return _0x28f200['sendStatus'](0xcc);}})['catch'](handleError(_0x28f200,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index d8ed791..4a06e8b 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 _0xfa2b=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x28ee06,_0x418a08){_0x28ee06=_0x28ee06-0x0;var _0x124567=_0xfa2b[_0x28ee06];return _0x124567;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var logger=require(_0xbfa2('0x2'))(_0xbfa2('0x3'));var moment=require(_0xbfa2('0x4'));var BPromise=require(_0xbfa2('0x5'));var rp=require(_0xbfa2('0x6'));var fs=require('fs');var path=require(_0xbfa2('0x7'));var rimraf=require(_0xbfa2('0x8'));var config=require(_0xbfa2('0x9'));var attributes=require(_0xbfa2('0xa'));module[_0xbfa2('0xb')]=function(_0x12d71e,_0x237a99){return _0x12d71e[_0xbfa2('0xc')](_0xbfa2('0xd'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c7b=['../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment'];(function(_0x375eb8,_0x47bb77){var _0x452d7c=function(_0xe70e6b){while(--_0xe70e6b){_0x375eb8['push'](_0x375eb8['shift']());}};_0x452d7c(++_0x47bb77);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x96d72d,_0x1a3ea0){_0x96d72d=_0x96d72d-0x0;var _0x5c9230=_0x3c7b[_0x96d72d];return _0x5c9230;};'use strict';var _=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var logger=require(_0xb3c7('0x2'))(_0xb3c7('0x3'));var moment=require(_0xb3c7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3c7('0x5'));var attributes=require(_0xb3c7('0x6'));module['exports']=function(_0x396a46,_0x5b810b){return _0x396a46[_0xb3c7('0x7')](_0xb3c7('0x8'),attributes,{'tableName':_0xb3c7('0x9'),'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 b504d24..1c481fb 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x7373f4,_0x1b3715){var _0xa2dc37=function(_0x2e49a1){while(--_0x2e49a1){_0x7373f4['push'](_0x7373f4['shift']());}};_0xa2dc37(++_0x1b3715);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2048cb,_0x27b130){_0x2048cb=_0x2048cb-0x0;var _0x1626bd=_0xf4eb[_0x2048cb];return _0x1626bd;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56fb1a,_0x38167a){var _0x2f78c0=function(_0x435fd6){while(--_0x435fd6){_0x56fb1a['push'](_0x56fb1a['shift']());}};_0x2f78c0(++_0x38167a);}(_0xe706,0xa3));var _0x6e70=function(_0x470d13,_0x3f22fa){_0x470d13=_0x470d13-0x0;var _0x18cc32=_0xe706[_0x470d13];return _0x18cc32;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index fc1c380..b69af36 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 _0xe613=['./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','/:id','show','update','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3126e0,_0x15cf3d){var _0x5750ec=function(_0xc9e556){while(--_0xc9e556){_0x3126e0['push'](_0x3126e0['shift']());}};_0x5750ec(++_0x15cf3d);}(_0xe613,0xcb));var _0x3e61=function(_0x1738ca,_0x452c3c){_0x1738ca=_0x1738ca-0x0;var _0xbd1db1=_0xe613[_0x1738ca];return _0xbd1db1;};'use strict';var multer=require('multer');var util=require(_0x3e61('0x0'));var path=require(_0x3e61('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e61('0x2'));var router=express[_0x3e61('0x3')]();var fs_extra=require(_0x3e61('0x4'));var auth=require(_0x3e61('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3e61('0x6'));var controller=require(_0x3e61('0x7'));router[_0x3e61('0x8')]('/',auth[_0x3e61('0x9')](),controller['index']);router[_0x3e61('0x8')](_0x3e61('0xa'),auth[_0x3e61('0x9')](),controller['describe']);router[_0x3e61('0x8')](_0x3e61('0xb'),auth['isAuthenticated'](),controller[_0x3e61('0xc')]);router['post']('/',auth[_0x3e61('0x9')](),controller['create']);router['put']('/:id',auth[_0x3e61('0x9')](),controller[_0x3e61('0xd')]);router['delete'](_0x3e61('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x3e61('0xe')]=router; \ No newline at end of file +var _0x1ba4=['isAuthenticated','index','describe','/:id','create','put','delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x19baaa,_0x17a509){var _0x550579=function(_0x5c1a84){while(--_0x5c1a84){_0x19baaa['push'](_0x19baaa['shift']());}};_0x550579(++_0x17a509);}(_0x1ba4,0x171));var _0x41ba=function(_0x27dfb2,_0x59b146){_0x27dfb2=_0x27dfb2-0x0;var _0x52c5be=_0x1ba4[_0x27dfb2];return _0x52c5be;};'use strict';var multer=require(_0x41ba('0x0'));var util=require('util');var path=require(_0x41ba('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x41ba('0x2'));var auth=require(_0x41ba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x41ba('0x4'));var controller=require('./jscriptyQuestionReport.controller');router[_0x41ba('0x5')]('/',auth[_0x41ba('0x6')](),controller[_0x41ba('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x41ba('0x8')]);router[_0x41ba('0x5')](_0x41ba('0x9'),auth[_0x41ba('0x6')](),controller['show']);router['post']('/',auth[_0x41ba('0x6')](),controller[_0x41ba('0xa')]);router[_0x41ba('0xb')](_0x41ba('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x41ba('0xc')](_0x41ba('0x9'),auth[_0x41ba('0x6')](),controller[_0x41ba('0xd')]);module[_0x41ba('0xe')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index b55c37d..5155120 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x1ddf19,_0x3afb4a){_0x1ddf19=_0x1ddf19-0x0;var _0x3bbc41=_0x7a54[_0x1ddf19];return _0x3bbc41;};'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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x1a78a0,_0x3e5f10){_0x1a78a0=_0x1a78a0-0x0;var _0x2abda9=_0x7a54[_0x1a78a0];return _0x2abda9;};'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 dbee938..2584800 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 _0xc457=['sendStatus','error','stack','name','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','JscriptyQuestionReport','includeAll','include','rows','catch','show','params','intersection','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end'];(function(_0x31627d,_0xb25b20){var _0x432628=function(_0xc90ebf){while(--_0xc90ebf){_0x31627d['push'](_0x31627d['shift']());}};_0x432628(++_0xb25b20);}(_0xc457,0xbb));var _0x7c45=function(_0x569bc6,_0x22c305){_0x569bc6=_0x569bc6-0x0;var _0x115107=_0xc457[_0x569bc6];return _0x115107;};'use strict';var emlformat=require(_0x7c45('0x0'));var rimraf=require(_0x7c45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c45('0x2'));var rp=require(_0x7c45('0x3'));var moment=require(_0x7c45('0x4'));var BPromise=require(_0x7c45('0x5'));var Mustache=require(_0x7c45('0x6'));var util=require(_0x7c45('0x7'));var path=require(_0x7c45('0x8'));var sox=require(_0x7c45('0x9'));var csv=require('to-csv');var ejs=require(_0x7c45('0xa'));var fs=require('fs');var fs_extra=require(_0x7c45('0xb'));var _=require(_0x7c45('0xc'));var squel=require(_0x7c45('0xd'));var crypto=require(_0x7c45('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7c45('0xf'));var Papa=require(_0x7c45('0x10'));var Redis=require(_0x7c45('0x11'));var authService=require(_0x7c45('0x12'));var qs=require(_0x7c45('0x13'));var as=require(_0x7c45('0x14'));var hardwareService=require(_0x7c45('0x15'));var logger=require(_0x7c45('0x16'))(_0x7c45('0x17'));var utils=require(_0x7c45('0x18'));var config=require(_0x7c45('0x19'));var licenseUtil=require(_0x7c45('0x1a'));var db=require(_0x7c45('0x1b'))['db'];function respondWithStatusCode(_0x2aee27,_0x308a94){_0x308a94=_0x308a94||0xcc;return function(_0x393dc3){if(_0x393dc3){return _0x2aee27['sendStatus'](_0x308a94);}return _0x2aee27['status'](_0x308a94)['end']();};}function respondWithResult(_0x25bdcf,_0x3313d2){_0x3313d2=_0x3313d2||0xc8;return function(_0xe8ceb3){if(_0xe8ceb3){return _0x25bdcf[_0x7c45('0x1c')](_0x3313d2)[_0x7c45('0x1d')](_0xe8ceb3);}};}function respondWithFilteredResult(_0x4814f7,_0x35a015){return function(_0x29bde8){if(_0x29bde8){var _0x445254=typeof _0x35a015[_0x7c45('0x1e')]===_0x7c45('0x1f')&&typeof _0x35a015[_0x7c45('0x20')]===_0x7c45('0x1f');var _0x374096=_0x29bde8[_0x7c45('0x21')];var _0x54c5ce=_0x445254?0x0:_0x35a015['offset'];var _0x3a39f8=_0x445254?_0x29bde8[_0x7c45('0x21')]:_0x35a015[_0x7c45('0x1e')]+_0x35a015[_0x7c45('0x20')];var _0xde9a78;if(_0x3a39f8>=_0x374096){_0x3a39f8=_0x374096;_0xde9a78=0xc8;}else{_0xde9a78=0xce;}_0x4814f7[_0x7c45('0x1c')](_0xde9a78);return _0x4814f7[_0x7c45('0x22')]('Content-Range',_0x54c5ce+'-'+_0x3a39f8+'/'+_0x374096)[_0x7c45('0x1d')](_0x29bde8);}return null;};}function patchUpdates(_0x3970fc){return function(_0x5082c5){try{jsonpatch[_0x7c45('0x23')](_0x5082c5,_0x3970fc,!![]);}catch(_0x2e5a5b){return BPromise[_0x7c45('0x24')](_0x2e5a5b);}return _0x5082c5[_0x7c45('0x25')]();};}function saveUpdates(_0x46ebe4,_0x4c6cf2){return function(_0x5b1219){if(_0x5b1219){return _0x5b1219['update'](_0x46ebe4)[_0x7c45('0x26')](function(_0xd9047c){return _0xd9047c;});}return null;};}function removeEntity(_0x1a09e0,_0x45e5ca){return function(_0x4d4542){if(_0x4d4542){return _0x4d4542[_0x7c45('0x27')]()[_0x7c45('0x26')](function(){_0x1a09e0[_0x7c45('0x1c')](0xcc)[_0x7c45('0x28')]();});}};}function handleEntityNotFound(_0x174b13,_0x5d0146){return function(_0x43d2c7){if(!_0x43d2c7){_0x174b13[_0x7c45('0x29')](0x194);}return _0x43d2c7;};}function handleError(_0xf99b44,_0x11a2ee){_0x11a2ee=_0x11a2ee||0x1f4;return function(_0x449331){logger[_0x7c45('0x2a')](_0x449331[_0x7c45('0x2b')]);if(_0x449331[_0x7c45('0x2c')]){delete _0x449331[_0x7c45('0x2c')];}_0xf99b44['status'](_0x11a2ee)['send'](_0x449331);};}exports['index']=function(_0xbe484c,_0x4daf14){var _0x450c85={},_0x4a98b9={},_0x76bba9={'count':0x0,'rows':[]};var _0x2cf627=_[_0x7c45('0x2d')](db['JscriptyQuestionReport'][_0x7c45('0x2e')],function(_0x19d552){return{'name':_0x19d552['fieldName'],'type':_0x19d552[_0x7c45('0x2f')][_0x7c45('0x30')]};});_0x4a98b9[_0x7c45('0x31')]=_['map'](_0x2cf627,_0x7c45('0x2c'));_0x4a98b9[_0x7c45('0x32')]=_[_0x7c45('0x33')](_0xbe484c[_0x7c45('0x32')]);_0x4a98b9[_0x7c45('0x34')]=_['intersection'](_0x4a98b9[_0x7c45('0x31')],_0x4a98b9[_0x7c45('0x32')]);_0x450c85[_0x7c45('0x35')]=_['intersection'](_0x4a98b9[_0x7c45('0x31')],qs[_0x7c45('0x36')](_0xbe484c['query'][_0x7c45('0x36')]));_0x450c85['attributes']=_0x450c85['attributes'][_0x7c45('0x37')]?_0x450c85[_0x7c45('0x35')]:_0x4a98b9[_0x7c45('0x31')];if(!_0xbe484c['query'][_0x7c45('0x38')](_0x7c45('0x39'))){_0x450c85['limit']=qs[_0x7c45('0x20')](_0xbe484c[_0x7c45('0x32')][_0x7c45('0x20')]);_0x450c85[_0x7c45('0x1e')]=qs['offset'](_0xbe484c[_0x7c45('0x32')]['offset']);}_0x450c85['order']=qs[_0x7c45('0x3a')](_0xbe484c[_0x7c45('0x32')][_0x7c45('0x3a')]);_0x450c85[_0x7c45('0x3b')]=qs[_0x7c45('0x34')](_['pick'](_0xbe484c[_0x7c45('0x32')],_0x4a98b9['filters']),_0x2cf627);if(_0xbe484c[_0x7c45('0x32')][_0x7c45('0x3c')]){_0x450c85[_0x7c45('0x3b')]=_['merge'](_0x450c85['where'],{'$or':_[_0x7c45('0x2d')](_0x2cf627,function(_0x4317cb){if(_0x4317cb[_0x7c45('0x2f')]!==_0x7c45('0x3d')){var _0x306e0a={};_0x306e0a[_0x4317cb[_0x7c45('0x2c')]]={'$like':'%'+_0xbe484c[_0x7c45('0x32')]['filter']+'%'};return _0x306e0a;}})});}_0x450c85=_[_0x7c45('0x3e')]({},_0x450c85,_0xbe484c['options']);var _0x58dd83={'where':_0x450c85[_0x7c45('0x3b')]};return db[_0x7c45('0x3f')]['count'](_0x58dd83)[_0x7c45('0x26')](function(_0x43224a){_0x76bba9['count']=_0x43224a;if(_0xbe484c[_0x7c45('0x32')][_0x7c45('0x40')]){_0x450c85[_0x7c45('0x41')]=[{'all':!![]}];}return db[_0x7c45('0x3f')]['findAll'](_0x450c85);})[_0x7c45('0x26')](function(_0x4b340c){_0x76bba9[_0x7c45('0x42')]=_0x4b340c;return _0x76bba9;})[_0x7c45('0x26')](respondWithFilteredResult(_0x4daf14,_0x450c85))[_0x7c45('0x43')](handleError(_0x4daf14,null));};exports[_0x7c45('0x44')]=function(_0x566ace,_0x495ce1){var _0x36714a={'raw':!![],'where':{'id':_0x566ace[_0x7c45('0x45')]['id']}},_0x3dea36={};_0x3dea36[_0x7c45('0x31')]=_[_0x7c45('0x33')](db[_0x7c45('0x3f')]['rawAttributes']);_0x3dea36[_0x7c45('0x32')]=_[_0x7c45('0x33')](_0x566ace['query']);_0x3dea36[_0x7c45('0x34')]=_[_0x7c45('0x46')](_0x3dea36[_0x7c45('0x31')],_0x3dea36[_0x7c45('0x32')]);_0x36714a[_0x7c45('0x35')]=_['intersection'](_0x3dea36[_0x7c45('0x31')],qs[_0x7c45('0x36')](_0x566ace['query'][_0x7c45('0x36')]));_0x36714a['attributes']=_0x36714a[_0x7c45('0x35')][_0x7c45('0x37')]?_0x36714a[_0x7c45('0x35')]:_0x3dea36[_0x7c45('0x31')];if(_0x566ace['query']['includeAll']){_0x36714a[_0x7c45('0x41')]=[{'all':!![]}];}_0x36714a=_['merge']({},_0x36714a,_0x566ace[_0x7c45('0x47')]);return db[_0x7c45('0x3f')][_0x7c45('0x48')](_0x36714a)[_0x7c45('0x26')](handleEntityNotFound(_0x495ce1,null))['then'](respondWithResult(_0x495ce1,null))[_0x7c45('0x43')](handleError(_0x495ce1,null));};exports[_0x7c45('0x49')]=function(_0x15e9ff,_0x257dab){return db[_0x7c45('0x3f')]['create'](_0x15e9ff[_0x7c45('0x4a')],{})['then'](respondWithResult(_0x257dab,0xc9))[_0x7c45('0x43')](handleError(_0x257dab,null));};exports['update']=function(_0x179200,_0x59ff92){if(_0x179200[_0x7c45('0x4a')]['id']){delete _0x179200[_0x7c45('0x4a')]['id'];}return db[_0x7c45('0x3f')][_0x7c45('0x48')]({'where':{'id':_0x179200[_0x7c45('0x45')]['id']}})[_0x7c45('0x26')](handleEntityNotFound(_0x59ff92,null))[_0x7c45('0x26')](saveUpdates(_0x179200['body'],null))[_0x7c45('0x26')](respondWithResult(_0x59ff92,null))['catch'](handleError(_0x59ff92,null));};exports[_0x7c45('0x27')]=function(_0x13f296,_0x58ad90){return db['JscriptyQuestionReport'][_0x7c45('0x48')]({'where':{'id':_0x13f296[_0x7c45('0x45')]['id']}})[_0x7c45('0x26')](handleEntityNotFound(_0x58ad90,null))[_0x7c45('0x26')](removeEntity(_0x58ad90,null))[_0x7c45('0x43')](handleError(_0x58ad90,null));};exports[_0x7c45('0x4b')]=function(_0x559e5d,_0x59d5c6){return db['JscriptyQuestionReport']['describe']()[_0x7c45('0x26')](respondWithResult(_0x59d5c6,null))[_0x7c45('0x43')](handleError(_0x59d5c6,null));}; \ No newline at end of file +var _0x771c=['name','send','index','map','JscriptyQuestionReport','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','update','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack'];(function(_0x1d90f5,_0xd7cd8d){var _0x57f943=function(_0x293768){while(--_0x293768){_0x1d90f5['push'](_0x1d90f5['shift']());}};_0x57f943(++_0xd7cd8d);}(_0x771c,0xbb));var _0xc771=function(_0x540157,_0x41a0a3){_0x540157=_0x540157-0x0;var _0x4e70dc=_0x771c[_0x540157];return _0x4e70dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc771('0x0'));var zipdir=require(_0xc771('0x1'));var jsonpatch=require(_0xc771('0x2'));var rp=require(_0xc771('0x3'));var moment=require(_0xc771('0x4'));var BPromise=require(_0xc771('0x5'));var Mustache=require(_0xc771('0x6'));var util=require(_0xc771('0x7'));var path=require(_0xc771('0x8'));var sox=require(_0xc771('0x9'));var csv=require(_0xc771('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc771('0xb'));var crypto=require(_0xc771('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc771('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc771('0xe'));var Papa=require('papaparse');var Redis=require(_0xc771('0xf'));var authService=require(_0xc771('0x10'));var qs=require(_0xc771('0x11'));var as=require(_0xc771('0x12'));var hardwareService=require(_0xc771('0x13'));var logger=require(_0xc771('0x14'))(_0xc771('0x15'));var utils=require(_0xc771('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc771('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30fd82,_0xdb2ac3){_0xdb2ac3=_0xdb2ac3||0xcc;return function(_0x3049d4){if(_0x3049d4){return _0x30fd82[_0xc771('0x18')](_0xdb2ac3);}return _0x30fd82[_0xc771('0x19')](_0xdb2ac3)[_0xc771('0x1a')]();};}function respondWithResult(_0x204219,_0x3ba320){_0x3ba320=_0x3ba320||0xc8;return function(_0x58b803){if(_0x58b803){return _0x204219['status'](_0x3ba320)[_0xc771('0x1b')](_0x58b803);}};}function respondWithFilteredResult(_0x5569d8,_0x5a813c){return function(_0x52ff91){if(_0x52ff91){var _0x4b642d=typeof _0x5a813c[_0xc771('0x1c')]===_0xc771('0x1d')&&typeof _0x5a813c[_0xc771('0x1e')]===_0xc771('0x1d');var _0x497cf8=_0x52ff91[_0xc771('0x1f')];var _0x3fe34a=_0x4b642d?0x0:_0x5a813c[_0xc771('0x1c')];var _0xb80dab=_0x4b642d?_0x52ff91[_0xc771('0x1f')]:_0x5a813c[_0xc771('0x1c')]+_0x5a813c[_0xc771('0x1e')];var _0x460fca;if(_0xb80dab>=_0x497cf8){_0xb80dab=_0x497cf8;_0x460fca=0xc8;}else{_0x460fca=0xce;}_0x5569d8['status'](_0x460fca);return _0x5569d8[_0xc771('0x20')](_0xc771('0x21'),_0x3fe34a+'-'+_0xb80dab+'/'+_0x497cf8)['json'](_0x52ff91);}return null;};}function patchUpdates(_0x4e3c46){return function(_0x13cc22){try{jsonpatch[_0xc771('0x22')](_0x13cc22,_0x4e3c46,!![]);}catch(_0x3d1f90){return BPromise[_0xc771('0x23')](_0x3d1f90);}return _0x13cc22[_0xc771('0x24')]();};}function saveUpdates(_0x21d822,_0x26e036){return function(_0x2aca51){if(_0x2aca51){return _0x2aca51['update'](_0x21d822)['then'](function(_0x29bc1d){return _0x29bc1d;});}return null;};}function removeEntity(_0x10d5be,_0x16af81){return function(_0xa03888){if(_0xa03888){return _0xa03888[_0xc771('0x25')]()[_0xc771('0x26')](function(){_0x10d5be[_0xc771('0x19')](0xcc)[_0xc771('0x1a')]();});}};}function handleEntityNotFound(_0x1f08aa,_0x53d3d8){return function(_0x57d571){if(!_0x57d571){_0x1f08aa[_0xc771('0x18')](0x194);}return _0x57d571;};}function handleError(_0x4a1630,_0x3b8c75){_0x3b8c75=_0x3b8c75||0x1f4;return function(_0xef87c9){logger[_0xc771('0x27')](_0xef87c9[_0xc771('0x28')]);if(_0xef87c9[_0xc771('0x29')]){delete _0xef87c9['name'];}_0x4a1630[_0xc771('0x19')](_0x3b8c75)[_0xc771('0x2a')](_0xef87c9);};}exports[_0xc771('0x2b')]=function(_0x546bbc,_0x15d1c6){var _0x3a4510={},_0x2a63f5={},_0x18475e={'count':0x0,'rows':[]};var _0x13ea80=_[_0xc771('0x2c')](db[_0xc771('0x2d')][_0xc771('0x2e')],function(_0x20ba6c){return{'name':_0x20ba6c['fieldName'],'type':_0x20ba6c['type'][_0xc771('0x2f')]};});_0x2a63f5[_0xc771('0x30')]=_['map'](_0x13ea80,_0xc771('0x29'));_0x2a63f5[_0xc771('0x31')]=_[_0xc771('0x32')](_0x546bbc[_0xc771('0x31')]);_0x2a63f5['filters']=_[_0xc771('0x33')](_0x2a63f5[_0xc771('0x30')],_0x2a63f5[_0xc771('0x31')]);_0x3a4510['attributes']=_[_0xc771('0x33')](_0x2a63f5[_0xc771('0x30')],qs[_0xc771('0x34')](_0x546bbc[_0xc771('0x31')]['fields']));_0x3a4510[_0xc771('0x35')]=_0x3a4510[_0xc771('0x35')][_0xc771('0x36')]?_0x3a4510[_0xc771('0x35')]:_0x2a63f5[_0xc771('0x30')];if(!_0x546bbc[_0xc771('0x31')]['hasOwnProperty'](_0xc771('0x37'))){_0x3a4510['limit']=qs[_0xc771('0x1e')](_0x546bbc[_0xc771('0x31')][_0xc771('0x1e')]);_0x3a4510['offset']=qs['offset'](_0x546bbc[_0xc771('0x31')][_0xc771('0x1c')]);}_0x3a4510[_0xc771('0x38')]=qs['sort'](_0x546bbc[_0xc771('0x31')][_0xc771('0x39')]);_0x3a4510['where']=qs[_0xc771('0x3a')](_['pick'](_0x546bbc[_0xc771('0x31')],_0x2a63f5['filters']),_0x13ea80);if(_0x546bbc['query'][_0xc771('0x3b')]){_0x3a4510[_0xc771('0x3c')]=_[_0xc771('0x3d')](_0x3a4510[_0xc771('0x3c')],{'$or':_[_0xc771('0x2c')](_0x13ea80,function(_0x24c67f){if(_0x24c67f[_0xc771('0x3e')]!==_0xc771('0x3f')){var _0x39b457={};_0x39b457[_0x24c67f[_0xc771('0x29')]]={'$like':'%'+_0x546bbc[_0xc771('0x31')][_0xc771('0x3b')]+'%'};return _0x39b457;}})});}_0x3a4510=_[_0xc771('0x3d')]({},_0x3a4510,_0x546bbc[_0xc771('0x40')]);var _0x29ba8f={'where':_0x3a4510[_0xc771('0x3c')]};return db[_0xc771('0x2d')][_0xc771('0x1f')](_0x29ba8f)['then'](function(_0x12a205){_0x18475e['count']=_0x12a205;if(_0x546bbc[_0xc771('0x31')][_0xc771('0x41')]){_0x3a4510[_0xc771('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xc771('0x43')](_0x3a4510);})[_0xc771('0x26')](function(_0x1baf4b){_0x18475e[_0xc771('0x44')]=_0x1baf4b;return _0x18475e;})['then'](respondWithFilteredResult(_0x15d1c6,_0x3a4510))['catch'](handleError(_0x15d1c6,null));};exports['show']=function(_0x176c62,_0x1cf143){var _0x23b36c={'raw':!![],'where':{'id':_0x176c62['params']['id']}},_0x17feae={};_0x17feae['model']=_['keys'](db[_0xc771('0x2d')][_0xc771('0x2e')]);_0x17feae[_0xc771('0x31')]=_[_0xc771('0x32')](_0x176c62['query']);_0x17feae[_0xc771('0x3a')]=_['intersection'](_0x17feae[_0xc771('0x30')],_0x17feae[_0xc771('0x31')]);_0x23b36c['attributes']=_[_0xc771('0x33')](_0x17feae['model'],qs['fields'](_0x176c62['query'][_0xc771('0x34')]));_0x23b36c[_0xc771('0x35')]=_0x23b36c[_0xc771('0x35')]['length']?_0x23b36c['attributes']:_0x17feae['model'];if(_0x176c62[_0xc771('0x31')]['includeAll']){_0x23b36c['include']=[{'all':!![]}];}_0x23b36c=_[_0xc771('0x3d')]({},_0x23b36c,_0x176c62['options']);return db[_0xc771('0x2d')][_0xc771('0x45')](_0x23b36c)[_0xc771('0x26')](handleEntityNotFound(_0x1cf143,null))['then'](respondWithResult(_0x1cf143,null))[_0xc771('0x46')](handleError(_0x1cf143,null));};exports[_0xc771('0x47')]=function(_0xc1ade5,_0x575664){return db['JscriptyQuestionReport'][_0xc771('0x47')](_0xc1ade5['body'],{})[_0xc771('0x26')](respondWithResult(_0x575664,0xc9))[_0xc771('0x46')](handleError(_0x575664,null));};exports[_0xc771('0x48')]=function(_0x46f8ed,_0x233281){if(_0x46f8ed[_0xc771('0x49')]['id']){delete _0x46f8ed[_0xc771('0x49')]['id'];}return db[_0xc771('0x2d')]['find']({'where':{'id':_0x46f8ed[_0xc771('0x4a')]['id']}})[_0xc771('0x26')](handleEntityNotFound(_0x233281,null))[_0xc771('0x26')](saveUpdates(_0x46f8ed[_0xc771('0x49')],null))['then'](respondWithResult(_0x233281,null))[_0xc771('0x46')](handleError(_0x233281,null));};exports[_0xc771('0x25')]=function(_0x6e6b75,_0x5643ce){return db['JscriptyQuestionReport'][_0xc771('0x45')]({'where':{'id':_0x6e6b75[_0xc771('0x4a')]['id']}})[_0xc771('0x26')](handleEntityNotFound(_0x5643ce,null))[_0xc771('0x26')](removeEntity(_0x5643ce,null))['catch'](handleError(_0x5643ce,null));};exports['describe']=function(_0x2472e9,_0x251fa7){return db[_0xc771('0x2d')][_0xc771('0x4b')]()[_0xc771('0x26')](respondWithResult(_0x251fa7,null))[_0xc771('0x46')](handleError(_0x251fa7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 852d0e6..fb6c404 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 _0xde64=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','./jscriptyQuestionReport.attributes'];(function(_0x89b9ae,_0x1bf879){var _0x2ca3ed=function(_0x146104){while(--_0x146104){_0x89b9ae['push'](_0x89b9ae['shift']());}};_0x2ca3ed(++_0x1bf879);}(_0xde64,0x192));var _0x4de6=function(_0x5b9f0d,_0x9aac59){_0x5b9f0d=_0x5b9f0d-0x0;var _0x847ae8=_0xde64[_0x5b9f0d];return _0x847ae8;};'use strict';var _=require(_0x4de6('0x0'));var util=require(_0x4de6('0x1'));var logger=require(_0x4de6('0x2'))(_0x4de6('0x3'));var moment=require(_0x4de6('0x4'));var BPromise=require(_0x4de6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4de6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4de6('0x7'));module[_0x4de6('0x8')]=function(_0x2991db,_0x3bde0f){return _0x2991db[_0x4de6('0x9')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd609=['report_jscripty_questions','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x43b2aa,_0x38c827){var _0x1765da=function(_0x29e14c){while(--_0x29e14c){_0x43b2aa['push'](_0x43b2aa['shift']());}};_0x1765da(++_0x38c827);}(_0xd609,0x1c9));var _0x9d60=function(_0x53dbb4,_0x148a94){_0x53dbb4=_0x53dbb4-0x0;var _0x588358=_0xd609[_0x53dbb4];return _0x588358;};'use strict';var _=require('lodash');var util=require(_0x9d60('0x0'));var logger=require(_0x9d60('0x1'))(_0x9d60('0x2'));var moment=require('moment');var BPromise=require(_0x9d60('0x3'));var rp=require(_0x9d60('0x4'));var fs=require('fs');var path=require(_0x9d60('0x5'));var rimraf=require('rimraf');var config=require(_0x9d60('0x6'));var attributes=require(_0x9d60('0x7'));module[_0x9d60('0x8')]=function(_0x101325,_0xe313dd){return _0x101325[_0x9d60('0x9')](_0x9d60('0xa'),attributes,{'tableName':_0x9d60('0xb'),'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 e0fd63a..c4ab427 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 _0x4b1b=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b1b,0xd8));var _0xb4b1=function(_0x640cc5,_0x3535e7){_0x640cc5=_0x640cc5-0x0;var _0x3eede9=_0x4b1b[_0x640cc5];return _0x3eede9;};'use strict';var _=require(_0xb4b1('0x0'));var util=require(_0xb4b1('0x1'));var moment=require(_0xb4b1('0x2'));var BPromise=require(_0xb4b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4b1('0x5'));var logger=require(_0xb4b1('0x6'))(_0xb4b1('0x7'));var config=require(_0xb4b1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb4b1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe84dc8,_0x2ccbc1,_0x1e0a90){return new BPromise(function(_0x16598c,_0x5234d1){return client[_0xb4b1('0xa')](_0xe84dc8,_0x1e0a90)['then'](function(_0x8d66cf){logger[_0xb4b1('0xb')](_0xb4b1('0xc'),_0x2ccbc1,_0xb4b1('0xd'));logger[_0xb4b1('0xe')](_0xb4b1('0xf'),_0x2ccbc1,_0xb4b1('0xd'),JSON['stringify'](_0x8d66cf));if(_0x8d66cf[_0xb4b1('0x10')]){if(_0x8d66cf['error'][_0xb4b1('0x11')]===0x1f4){logger[_0xb4b1('0x10')](_0xb4b1('0xc'),_0x2ccbc1,_0x8d66cf[_0xb4b1('0x10')]['message']);return _0x5234d1(_0x8d66cf['error'][_0xb4b1('0x12')]);}logger[_0xb4b1('0x10')](_0xb4b1('0xc'),_0x2ccbc1,_0x8d66cf['error'][_0xb4b1('0x12')]);return _0x16598c(_0x8d66cf[_0xb4b1('0x10')][_0xb4b1('0x12')]);}else{logger['info'](_0xb4b1('0xc'),_0x2ccbc1,_0xb4b1('0xd'));_0x16598c(_0x8d66cf[_0xb4b1('0x13')][_0xb4b1('0x12')]);}})[_0xb4b1('0x14')](function(_0x283700){logger[_0xb4b1('0x10')](_0xb4b1('0xc'),_0x2ccbc1,_0x283700);_0x5234d1(_0x283700);});});} \ No newline at end of file +var _0x26f5=['jayson/promise','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3221be,_0x3ae273){var _0x1d68c6=function(_0x4136af){while(--_0x4136af){_0x3221be['push'](_0x3221be['shift']());}};_0x1d68c6(++_0x3ae273);}(_0x26f5,0xdf));var _0x526f=function(_0x1f4746,_0x42f608){_0x1f4746=_0x1f4746-0x0;var _0xe263d2=_0x26f5[_0x1f4746];return _0xe263d2;};'use strict';var _=require(_0x526f('0x0'));var util=require(_0x526f('0x1'));var moment=require('moment');var BPromise=require(_0x526f('0x2'));var rs=require(_0x526f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x526f('0x4'))['db'];var utils=require(_0x526f('0x5'));var logger=require('../../config/logger')(_0x526f('0x6'));var config=require(_0x526f('0x7'));var jayson=require(_0x526f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32c741,_0x240c9e,_0x274960){return new BPromise(function(_0x5e3678,_0x1d6585){return client[_0x526f('0x9')](_0x32c741,_0x274960)['then'](function(_0x7fcb9a){logger[_0x526f('0xa')](_0x526f('0xb'),_0x240c9e,'request\x20sent');logger[_0x526f('0xc')](_0x526f('0xd'),_0x240c9e,_0x526f('0xe'),JSON[_0x526f('0xf')](_0x7fcb9a));if(_0x7fcb9a['error']){if(_0x7fcb9a[_0x526f('0x10')][_0x526f('0x11')]===0x1f4){logger[_0x526f('0x10')](_0x526f('0xb'),_0x240c9e,_0x7fcb9a[_0x526f('0x10')][_0x526f('0x12')]);return _0x1d6585(_0x7fcb9a[_0x526f('0x10')]['message']);}logger[_0x526f('0x10')](_0x526f('0xb'),_0x240c9e,_0x7fcb9a[_0x526f('0x10')][_0x526f('0x12')]);return _0x5e3678(_0x7fcb9a[_0x526f('0x10')][_0x526f('0x12')]);}else{logger['info'](_0x526f('0xb'),_0x240c9e,_0x526f('0xe'));_0x5e3678(_0x7fcb9a[_0x526f('0x13')][_0x526f('0x12')]);}})[_0x526f('0x14')](function(_0x23243d){logger[_0x526f('0x10')](_0x526f('0xb'),_0x240c9e,_0x23243d);_0x1d6585(_0x23243d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 575a5ac..fea2937 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 _0x1ac8=['index','/describe','describe','/:id','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated'];(function(_0x4cbca6,_0x49ee64){var _0x2ef994=function(_0x125609){while(--_0x125609){_0x4cbca6['push'](_0x4cbca6['shift']());}};_0x2ef994(++_0x49ee64);}(_0x1ac8,0xa3));var _0x81ac=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1ac8[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x81ac('0x0'));var util=require(_0x81ac('0x1'));var path=require(_0x81ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x81ac('0x3'));var router=express[_0x81ac('0x4')]();var fs_extra=require(_0x81ac('0x5'));var auth=require(_0x81ac('0x6'));var interaction=require(_0x81ac('0x7'));var config=require(_0x81ac('0x8'));var controller=require(_0x81ac('0x9'));router[_0x81ac('0xa')]('/',auth[_0x81ac('0xb')](),controller[_0x81ac('0xc')]);router[_0x81ac('0xa')](_0x81ac('0xd'),auth[_0x81ac('0xb')](),controller[_0x81ac('0xe')]);router[_0x81ac('0xa')](_0x81ac('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0x81ac('0x10'),auth[_0x81ac('0xb')](),controller[_0x81ac('0x11')]);router[_0x81ac('0x12')]('/',auth[_0x81ac('0xb')](),controller[_0x81ac('0x13')]);router[_0x81ac('0x14')](_0x81ac('0xf'),auth[_0x81ac('0xb')](),controller[_0x81ac('0x15')]);router[_0x81ac('0x16')](_0x81ac('0xf'),auth[_0x81ac('0xb')](),controller[_0x81ac('0x17')]);module[_0x81ac('0x18')]=router; \ No newline at end of file +var _0xa311=['put','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','/describe','describe','/:id','show','get','/:id/questions','getQuestions','post'];(function(_0x558eb1,_0x502908){var _0x2f0b9e=function(_0x1e01f1){while(--_0x1e01f1){_0x558eb1['push'](_0x558eb1['shift']());}};_0x2f0b9e(++_0x502908);}(_0xa311,0x1be));var _0x1a31=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0xa311[_0x24fa1a];return _0xc5621f;};'use strict';var multer=require(_0x1a31('0x0'));var util=require('util');var path=require(_0x1a31('0x1'));var timeout=require('connect-timeout');var express=require(_0x1a31('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1a31('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1a31('0x4'));var controller=require(_0x1a31('0x5'));router['get']('/',auth[_0x1a31('0x6')](),controller[_0x1a31('0x7')]);router['get'](_0x1a31('0x8'),auth[_0x1a31('0x6')](),controller[_0x1a31('0x9')]);router['get'](_0x1a31('0xa'),auth[_0x1a31('0x6')](),controller[_0x1a31('0xb')]);router[_0x1a31('0xc')](_0x1a31('0xd'),auth[_0x1a31('0x6')](),controller[_0x1a31('0xe')]);router[_0x1a31('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a31('0x10')](_0x1a31('0xa'),auth[_0x1a31('0x6')](),controller[_0x1a31('0x11')]);router[_0x1a31('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1a31('0x13')]);module[_0x1a31('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 3fcf9b7..86301f2 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 _0x0348=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','DATE','starttime','setDataValue','endtime','format'];(function(_0x2f8bc6,_0x4dc869){var _0x2d008a=function(_0x276072){while(--_0x276072){_0x2f8bc6['push'](_0x2f8bc6['shift']());}};_0x2d008a(++_0x4dc869);}(_0x0348,0x1e9));var _0x8034=function(_0x49a982,_0x129a07){_0x49a982=_0x49a982-0x0;var _0x2a0bc9=_0x0348[_0x49a982];return _0x2a0bc9;};'use strict';var moment=require('moment');var Sequelize=require(_0x8034('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x8034('0x1')],'set':function(_0x3a60bd){this['setDataValue'](_0x8034('0x2'),_0x3a60bd);this[_0x8034('0x3')](_0x8034('0x4'),moment()[_0x8034('0x5')](_0x8034('0x6')));}},'endtime':{'type':Sequelize[_0x8034('0x1')]},'membername':{'type':Sequelize[_0x8034('0x7')]},'projectname':{'type':Sequelize[_0x8034('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8034('0x7')]},'calleridname':{'type':Sequelize[_0x8034('0x7')]},'calleridnum':{'type':Sequelize[_0x8034('0x7')]},'completed':{'type':Sequelize[_0x8034('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x2272=['moment','sequelize','exports','DATE','starttime','setDataValue','endtime','STRING','BOOLEAN'];(function(_0x3ea24d,_0x42821a){var _0x5098ef=function(_0x12564c){while(--_0x12564c){_0x3ea24d['push'](_0x3ea24d['shift']());}};_0x5098ef(++_0x42821a);}(_0x2272,0xd8));var _0x2227=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2272[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x2227('0x0'));var Sequelize=require(_0x2227('0x1'));module[_0x2227('0x2')]={'starttime':{'type':Sequelize[_0x2227('0x3')],'set':function(_0x42152f){this['setDataValue'](_0x2227('0x4'),_0x42152f);this[_0x2227('0x5')](_0x2227('0x6'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x2227('0x3')]},'membername':{'type':Sequelize[_0x2227('0x7')]},'projectname':{'type':Sequelize[_0x2227('0x7')]},'queue':{'type':Sequelize[_0x2227('0x7')]},'uniqueid':{'type':Sequelize[_0x2227('0x7')]},'calleridname':{'type':Sequelize[_0x2227('0x7')]},'calleridnum':{'type':Sequelize[_0x2227('0x7')]},'completed':{'type':Sequelize[_0x2227('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index d16974d..896f0cf 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 _0x6bca=['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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','show','catch','create','body','find','params','destroy','describe','findOne','JscriptyQuestionReport','pick','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','crypto'];(function(_0x36c493,_0x58dc21){var _0x445d9f=function(_0x59e01b){while(--_0x59e01b){_0x36c493['push'](_0x36c493['shift']());}};_0x445d9f(++_0x58dc21);}(_0x6bca,0x1da));var _0xa6bc=function(_0x27e52a,_0x45ac63){_0x27e52a=_0x27e52a-0x0;var _0x3f1c9c=_0x6bca[_0x27e52a];return _0x3f1c9c;};'use strict';var emlformat=require(_0xa6bc('0x0'));var rimraf=require(_0xa6bc('0x1'));var zipdir=require(_0xa6bc('0x2'));var jsonpatch=require(_0xa6bc('0x3'));var rp=require('request-promise');var moment=require(_0xa6bc('0x4'));var BPromise=require(_0xa6bc('0x5'));var Mustache=require('mustache');var util=require(_0xa6bc('0x6'));var path=require('path');var sox=require(_0xa6bc('0x7'));var csv=require(_0xa6bc('0x8'));var ejs=require(_0xa6bc('0x9'));var fs=require('fs');var fs_extra=require(_0xa6bc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa6bc('0xb'));var jsforce=require(_0xa6bc('0xc'));var deskjs=require(_0xa6bc('0xd'));var toCsv=require(_0xa6bc('0x8'));var querystring=require(_0xa6bc('0xe'));var Papa=require(_0xa6bc('0xf'));var Redis=require(_0xa6bc('0x10'));var authService=require(_0xa6bc('0x11'));var qs=require(_0xa6bc('0x12'));var as=require(_0xa6bc('0x13'));var hardwareService=require(_0xa6bc('0x14'));var logger=require(_0xa6bc('0x15'))(_0xa6bc('0x16'));var utils=require('../../config/utils');var config=require(_0xa6bc('0x17'));var licenseUtil=require(_0xa6bc('0x18'));var db=require(_0xa6bc('0x19'))['db'];function respondWithStatusCode(_0x35e346,_0xc15676){_0xc15676=_0xc15676||0xcc;return function(_0x4e0052){if(_0x4e0052){return _0x35e346[_0xa6bc('0x1a')](_0xc15676);}return _0x35e346['status'](_0xc15676)[_0xa6bc('0x1b')]();};}function respondWithResult(_0x425553,_0x8429b1){_0x8429b1=_0x8429b1||0xc8;return function(_0x37f25b){if(_0x37f25b){return _0x425553[_0xa6bc('0x1c')](_0x8429b1)[_0xa6bc('0x1d')](_0x37f25b);}};}function respondWithFilteredResult(_0xad9a80,_0xc65bd1){return function(_0x4011c7){if(_0x4011c7){var _0x20cffa=typeof _0xc65bd1[_0xa6bc('0x1e')]===_0xa6bc('0x1f')&&typeof _0xc65bd1[_0xa6bc('0x20')]===_0xa6bc('0x1f');var _0x4209b9=_0x4011c7[_0xa6bc('0x21')];var _0x5380f1=_0x20cffa?0x0:_0xc65bd1[_0xa6bc('0x1e')];var _0xec8d79=_0x20cffa?_0x4011c7[_0xa6bc('0x21')]:_0xc65bd1[_0xa6bc('0x1e')]+_0xc65bd1[_0xa6bc('0x20')];var _0x1880ea;if(_0xec8d79>=_0x4209b9){_0xec8d79=_0x4209b9;_0x1880ea=0xc8;}else{_0x1880ea=0xce;}_0xad9a80[_0xa6bc('0x1c')](_0x1880ea);return _0xad9a80[_0xa6bc('0x22')](_0xa6bc('0x23'),_0x5380f1+'-'+_0xec8d79+'/'+_0x4209b9)[_0xa6bc('0x1d')](_0x4011c7);}return null;};}function patchUpdates(_0x4051b1){return function(_0x32b797){try{jsonpatch[_0xa6bc('0x24')](_0x32b797,_0x4051b1,!![]);}catch(_0x3302de){return BPromise[_0xa6bc('0x25')](_0x3302de);}return _0x32b797['save']();};}function saveUpdates(_0x64b52d,_0x1c52de){return function(_0xd3f4ff){if(_0xd3f4ff){return _0xd3f4ff[_0xa6bc('0x26')](_0x64b52d)[_0xa6bc('0x27')](function(_0x17ed92){return _0x17ed92;});}return null;};}function removeEntity(_0x2d2402,_0x58bf56){return function(_0x10ff0b){if(_0x10ff0b){return _0x10ff0b['destroy']()[_0xa6bc('0x27')](function(){_0x2d2402[_0xa6bc('0x1c')](0xcc)[_0xa6bc('0x1b')]();});}};}function handleEntityNotFound(_0x49c6e9,_0x2f2c86){return function(_0x13fa80){if(!_0x13fa80){_0x49c6e9[_0xa6bc('0x1a')](0x194);}return _0x13fa80;};}function handleError(_0x347272,_0x3e036f){_0x3e036f=_0x3e036f||0x1f4;return function(_0x1e2124){logger[_0xa6bc('0x28')](_0x1e2124[_0xa6bc('0x29')]);if(_0x1e2124[_0xa6bc('0x2a')]){delete _0x1e2124['name'];}_0x347272[_0xa6bc('0x1c')](_0x3e036f)[_0xa6bc('0x2b')](_0x1e2124);};}exports['index']=function(_0x5821bc,_0x4b4e1a){var _0x57ff1e={},_0x59f6d5={},_0x18628e={'count':0x0,'rows':[]};var _0x5b8ecc=_[_0xa6bc('0x2c')](db['JscriptySessionReport'][_0xa6bc('0x2d')],function(_0x252b82){return{'name':_0x252b82[_0xa6bc('0x2e')],'type':_0x252b82[_0xa6bc('0x2f')][_0xa6bc('0x30')]};});_0x59f6d5[_0xa6bc('0x31')]=_[_0xa6bc('0x2c')](_0x5b8ecc,'name');_0x59f6d5[_0xa6bc('0x32')]=_[_0xa6bc('0x33')](_0x5821bc['query']);_0x59f6d5[_0xa6bc('0x34')]=_['intersection'](_0x59f6d5[_0xa6bc('0x31')],_0x59f6d5['query']);_0x57ff1e[_0xa6bc('0x35')]=_[_0xa6bc('0x36')](_0x59f6d5['model'],qs[_0xa6bc('0x37')](_0x5821bc['query']['fields']));_0x57ff1e[_0xa6bc('0x35')]=_0x57ff1e[_0xa6bc('0x35')][_0xa6bc('0x38')]?_0x57ff1e[_0xa6bc('0x35')]:_0x59f6d5[_0xa6bc('0x31')];if(!_0x5821bc['query'][_0xa6bc('0x39')](_0xa6bc('0x3a'))){_0x57ff1e[_0xa6bc('0x20')]=qs[_0xa6bc('0x20')](_0x5821bc['query'][_0xa6bc('0x20')]);_0x57ff1e[_0xa6bc('0x1e')]=qs[_0xa6bc('0x1e')](_0x5821bc[_0xa6bc('0x32')]['offset']);}_0x57ff1e['order']=qs['sort'](_0x5821bc[_0xa6bc('0x32')][_0xa6bc('0x3b')]);_0x57ff1e[_0xa6bc('0x3c')]=qs[_0xa6bc('0x34')](_['pick'](_0x5821bc[_0xa6bc('0x32')],_0x59f6d5[_0xa6bc('0x34')]),_0x5b8ecc);if(_0x5821bc['query'][_0xa6bc('0x3d')]){_0x57ff1e[_0xa6bc('0x3c')]=_[_0xa6bc('0x3e')](_0x57ff1e[_0xa6bc('0x3c')],{'$or':_[_0xa6bc('0x2c')](_0x5b8ecc,function(_0x18b88c){if(_0x18b88c['type']!=='VIRTUAL'){var _0x23594e={};_0x23594e[_0x18b88c[_0xa6bc('0x2a')]]={'$like':'%'+_0x5821bc[_0xa6bc('0x32')][_0xa6bc('0x3d')]+'%'};return _0x23594e;}})});}_0x57ff1e=_[_0xa6bc('0x3e')]({},_0x57ff1e,_0x5821bc[_0xa6bc('0x3f')]);var _0x47982c={'where':_0x57ff1e[_0xa6bc('0x3c')]};return db[_0xa6bc('0x40')][_0xa6bc('0x21')](_0x47982c)['then'](function(_0x4caeae){_0x18628e['count']=_0x4caeae;if(_0x5821bc[_0xa6bc('0x32')][_0xa6bc('0x41')]){_0x57ff1e[_0xa6bc('0x42')]=[{'all':!![]}];}return db[_0xa6bc('0x40')][_0xa6bc('0x43')](_0x57ff1e);})[_0xa6bc('0x27')](function(_0x4eb814){_0x18628e[_0xa6bc('0x44')]=_0x4eb814;return _0x18628e;})[_0xa6bc('0x27')](respondWithFilteredResult(_0x4b4e1a,_0x57ff1e))['catch'](handleError(_0x4b4e1a,null));};exports[_0xa6bc('0x45')]=function(_0x3a83fd,_0x1fa0fb){var _0x49eea1={'raw':!![],'where':{'id':_0x3a83fd['params']['id']}},_0x3a3601={};_0x3a3601[_0xa6bc('0x31')]=_[_0xa6bc('0x33')](db['JscriptySessionReport']['rawAttributes']);_0x3a3601['query']=_[_0xa6bc('0x33')](_0x3a83fd[_0xa6bc('0x32')]);_0x3a3601[_0xa6bc('0x34')]=_[_0xa6bc('0x36')](_0x3a3601[_0xa6bc('0x31')],_0x3a3601[_0xa6bc('0x32')]);_0x49eea1['attributes']=_[_0xa6bc('0x36')](_0x3a3601[_0xa6bc('0x31')],qs[_0xa6bc('0x37')](_0x3a83fd[_0xa6bc('0x32')][_0xa6bc('0x37')]));_0x49eea1[_0xa6bc('0x35')]=_0x49eea1[_0xa6bc('0x35')]['length']?_0x49eea1[_0xa6bc('0x35')]:_0x3a3601[_0xa6bc('0x31')];if(_0x3a83fd[_0xa6bc('0x32')][_0xa6bc('0x41')]){_0x49eea1['include']=[{'all':!![]}];}_0x49eea1=_[_0xa6bc('0x3e')]({},_0x49eea1,_0x3a83fd[_0xa6bc('0x3f')]);return db['JscriptySessionReport']['find'](_0x49eea1)[_0xa6bc('0x27')](handleEntityNotFound(_0x1fa0fb,null))[_0xa6bc('0x27')](respondWithResult(_0x1fa0fb,null))[_0xa6bc('0x46')](handleError(_0x1fa0fb,null));};exports['create']=function(_0x5a5b99,_0x338301){return db['JscriptySessionReport'][_0xa6bc('0x47')](_0x5a5b99['body'],{})[_0xa6bc('0x27')](respondWithResult(_0x338301,0xc9))['catch'](handleError(_0x338301,null));};exports['update']=function(_0x2e11e5,_0x119693){if(_0x2e11e5[_0xa6bc('0x48')]['id']){delete _0x2e11e5[_0xa6bc('0x48')]['id'];}return db['JscriptySessionReport'][_0xa6bc('0x49')]({'where':{'id':_0x2e11e5[_0xa6bc('0x4a')]['id']}})[_0xa6bc('0x27')](handleEntityNotFound(_0x119693,null))[_0xa6bc('0x27')](saveUpdates(_0x2e11e5[_0xa6bc('0x48')],null))['then'](respondWithResult(_0x119693,null))[_0xa6bc('0x46')](handleError(_0x119693,null));};exports[_0xa6bc('0x4b')]=function(_0x2d996f,_0x5dcb43){return db[_0xa6bc('0x40')][_0xa6bc('0x49')]({'where':{'id':_0x2d996f[_0xa6bc('0x4a')]['id']}})[_0xa6bc('0x27')](handleEntityNotFound(_0x5dcb43,null))[_0xa6bc('0x27')](removeEntity(_0x5dcb43,null))[_0xa6bc('0x46')](handleError(_0x5dcb43,null));};exports['describe']=function(_0x9c4764,_0x39b263){return db[_0xa6bc('0x40')][_0xa6bc('0x4c')]()['then'](respondWithResult(_0x39b263,null))[_0xa6bc('0x46')](handleError(_0x39b263,null));};exports['getQuestions']=function(_0x1177db,_0x3b5210,_0x128622){var _0x56fc82={'raw':!![],'where':{}};var _0x1de654={};var _0x2d7960={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xa6bc('0x4d')]({'where':{'id':_0x1177db[_0xa6bc('0x4a')]['id']}})[_0xa6bc('0x27')](handleEntityNotFound(_0x3b5210,null))['then'](function(_0xc7851c){if(_0xc7851c){_0x1de654[_0xa6bc('0x31')]=_['keys'](db[_0xa6bc('0x4e')][_0xa6bc('0x2d')]);_0x1de654[_0xa6bc('0x32')]=_[_0xa6bc('0x33')](_0x1177db[_0xa6bc('0x32')]);_0x1de654['filters']=_['intersection'](_0x1de654[_0xa6bc('0x31')],_0x1de654[_0xa6bc('0x32')]);_0x56fc82[_0xa6bc('0x35')]=_[_0xa6bc('0x36')](_0x1de654['model'],qs[_0xa6bc('0x37')](_0x1177db[_0xa6bc('0x32')][_0xa6bc('0x37')]));_0x56fc82[_0xa6bc('0x35')]=_0x56fc82[_0xa6bc('0x35')][_0xa6bc('0x38')]?_0x56fc82[_0xa6bc('0x35')]:_0x1de654[_0xa6bc('0x31')];if(!_0x1177db[_0xa6bc('0x32')]['hasOwnProperty'](_0xa6bc('0x3a'))){_0x56fc82[_0xa6bc('0x20')]=qs[_0xa6bc('0x20')](_0x1177db['query'][_0xa6bc('0x20')]);_0x56fc82[_0xa6bc('0x1e')]=qs[_0xa6bc('0x1e')](_0x1177db[_0xa6bc('0x32')][_0xa6bc('0x1e')]);}_0x56fc82['order']=qs['sort'](_0x1177db[_0xa6bc('0x32')][_0xa6bc('0x3b')]);_0x56fc82[_0xa6bc('0x3c')]=qs['filters'](_[_0xa6bc('0x4f')](_0x1177db[_0xa6bc('0x32')],_0x1de654[_0xa6bc('0x34')]));_0x56fc82[_0xa6bc('0x3c')][_0xa6bc('0x50')]=_0xc7851c['id'];if(_0x1177db[_0xa6bc('0x32')][_0xa6bc('0x3d')]){_0x56fc82['where']=_['merge'](_0x56fc82['where'],{'$or':_['map'](_0x56fc82[_0xa6bc('0x35')],function(_0x4533a5){var _0x47cc50={};_0x47cc50[_0x4533a5]={'$like':'%'+_0x1177db[_0xa6bc('0x32')][_0xa6bc('0x3d')]+'%'};return _0x47cc50;})});}_0x56fc82=_[_0xa6bc('0x3e')]({},_0x56fc82,_0x1177db['options']);return db[_0xa6bc('0x4e')][_0xa6bc('0x21')]({'where':_0x56fc82[_0xa6bc('0x3c')]})[_0xa6bc('0x27')](function(_0x3c7879){_0x2d7960[_0xa6bc('0x21')]=_0x3c7879;if(_0x1177db[_0xa6bc('0x32')][_0xa6bc('0x41')]){_0x56fc82[_0xa6bc('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x56fc82);})[_0xa6bc('0x27')](function(_0x23f0fa){_0x2d7960[_0xa6bc('0x44')]=_0x23f0fa;return _0x2d7960;});}})['then'](respondWithFilteredResult(_0x3b5210,_0x56fc82))[_0xa6bc('0x46')](handleError(_0x3b5210,null));}; \ No newline at end of file +var _0x49e0=['query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','JscriptySessionReport','includeAll','include','rows','catch','show','length','find','create','body','update','params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x2cbc53,_0x3237ea){var _0x262f5c=function(_0x1046c0){while(--_0x1046c0){_0x2cbc53['push'](_0x2cbc53['shift']());}};_0x262f5c(++_0x3237ea);}(_0x49e0,0xca));var _0x049e=function(_0x3900d1,_0x82a7ac){_0x3900d1=_0x3900d1-0x0;var _0x229de2=_0x49e0[_0x3900d1];return _0x229de2;};'use strict';var emlformat=require(_0x049e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x049e('0x1'));var jsonpatch=require(_0x049e('0x2'));var rp=require(_0x049e('0x3'));var moment=require(_0x049e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x049e('0x5'));var util=require(_0x049e('0x6'));var path=require(_0x049e('0x7'));var sox=require(_0x049e('0x8'));var csv=require(_0x049e('0x9'));var ejs=require(_0x049e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x049e('0xb'));var squel=require(_0x049e('0xc'));var crypto=require(_0x049e('0xd'));var jsforce=require(_0x049e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x049e('0x9'));var querystring=require('querystring');var Papa=require(_0x049e('0xf'));var Redis=require(_0x049e('0x10'));var authService=require(_0x049e('0x11'));var qs=require(_0x049e('0x12'));var as=require(_0x049e('0x13'));var hardwareService=require(_0x049e('0x14'));var logger=require(_0x049e('0x15'))(_0x049e('0x16'));var utils=require(_0x049e('0x17'));var config=require(_0x049e('0x18'));var licenseUtil=require(_0x049e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f48b,_0x263994){_0x263994=_0x263994||0xcc;return function(_0x1eb402){if(_0x1eb402){return _0x43f48b[_0x049e('0x1a')](_0x263994);}return _0x43f48b['status'](_0x263994)[_0x049e('0x1b')]();};}function respondWithResult(_0xa20537,_0x30994c){_0x30994c=_0x30994c||0xc8;return function(_0x2f123f){if(_0x2f123f){return _0xa20537[_0x049e('0x1c')](_0x30994c)[_0x049e('0x1d')](_0x2f123f);}};}function respondWithFilteredResult(_0x48f93c,_0x209db3){return function(_0x473241){if(_0x473241){var _0x3ddd89=typeof _0x209db3[_0x049e('0x1e')]===_0x049e('0x1f')&&typeof _0x209db3['limit']===_0x049e('0x1f');var _0x4691dc=_0x473241[_0x049e('0x20')];var _0x459cc9=_0x3ddd89?0x0:_0x209db3[_0x049e('0x1e')];var _0x42d052=_0x3ddd89?_0x473241[_0x049e('0x20')]:_0x209db3[_0x049e('0x1e')]+_0x209db3[_0x049e('0x21')];var _0x5c90c4;if(_0x42d052>=_0x4691dc){_0x42d052=_0x4691dc;_0x5c90c4=0xc8;}else{_0x5c90c4=0xce;}_0x48f93c[_0x049e('0x1c')](_0x5c90c4);return _0x48f93c[_0x049e('0x22')](_0x049e('0x23'),_0x459cc9+'-'+_0x42d052+'/'+_0x4691dc)[_0x049e('0x1d')](_0x473241);}return null;};}function patchUpdates(_0x83c428){return function(_0x145d5c){try{jsonpatch[_0x049e('0x24')](_0x145d5c,_0x83c428,!![]);}catch(_0x4a3542){return BPromise[_0x049e('0x25')](_0x4a3542);}return _0x145d5c[_0x049e('0x26')]();};}function saveUpdates(_0x20af71,_0x5279a4){return function(_0x5e7f73){if(_0x5e7f73){return _0x5e7f73['update'](_0x20af71)[_0x049e('0x27')](function(_0x150ac7){return _0x150ac7;});}return null;};}function removeEntity(_0x27b213,_0x46089d){return function(_0x28aa9d){if(_0x28aa9d){return _0x28aa9d[_0x049e('0x28')]()[_0x049e('0x27')](function(){_0x27b213[_0x049e('0x1c')](0xcc)[_0x049e('0x1b')]();});}};}function handleEntityNotFound(_0x273897,_0x477299){return function(_0x1e8489){if(!_0x1e8489){_0x273897[_0x049e('0x1a')](0x194);}return _0x1e8489;};}function handleError(_0x2fa79d,_0x26d2a1){_0x26d2a1=_0x26d2a1||0x1f4;return function(_0xcdc93e){logger['error'](_0xcdc93e[_0x049e('0x29')]);if(_0xcdc93e[_0x049e('0x2a')]){delete _0xcdc93e[_0x049e('0x2a')];}_0x2fa79d[_0x049e('0x1c')](_0x26d2a1)[_0x049e('0x2b')](_0xcdc93e);};}exports[_0x049e('0x2c')]=function(_0xc35dd1,_0x579606){var _0x1c0ef4={},_0x1f0487={},_0x51c46a={'count':0x0,'rows':[]};var _0x28c366=_[_0x049e('0x2d')](db['JscriptySessionReport'][_0x049e('0x2e')],function(_0x4b94f0){return{'name':_0x4b94f0[_0x049e('0x2f')],'type':_0x4b94f0[_0x049e('0x30')][_0x049e('0x31')]};});_0x1f0487['model']=_['map'](_0x28c366,'name');_0x1f0487[_0x049e('0x32')]=_[_0x049e('0x33')](_0xc35dd1[_0x049e('0x32')]);_0x1f0487['filters']=_[_0x049e('0x34')](_0x1f0487[_0x049e('0x35')],_0x1f0487[_0x049e('0x32')]);_0x1c0ef4[_0x049e('0x36')]=_[_0x049e('0x34')](_0x1f0487['model'],qs[_0x049e('0x37')](_0xc35dd1[_0x049e('0x32')][_0x049e('0x37')]));_0x1c0ef4[_0x049e('0x36')]=_0x1c0ef4['attributes']['length']?_0x1c0ef4[_0x049e('0x36')]:_0x1f0487[_0x049e('0x35')];if(!_0xc35dd1[_0x049e('0x32')][_0x049e('0x38')](_0x049e('0x39'))){_0x1c0ef4[_0x049e('0x21')]=qs['limit'](_0xc35dd1[_0x049e('0x32')][_0x049e('0x21')]);_0x1c0ef4[_0x049e('0x1e')]=qs[_0x049e('0x1e')](_0xc35dd1[_0x049e('0x32')]['offset']);}_0x1c0ef4[_0x049e('0x3a')]=qs[_0x049e('0x3b')](_0xc35dd1['query'][_0x049e('0x3b')]);_0x1c0ef4[_0x049e('0x3c')]=qs[_0x049e('0x3d')](_[_0x049e('0x3e')](_0xc35dd1[_0x049e('0x32')],_0x1f0487[_0x049e('0x3d')]),_0x28c366);if(_0xc35dd1['query']['filter']){_0x1c0ef4[_0x049e('0x3c')]=_[_0x049e('0x3f')](_0x1c0ef4[_0x049e('0x3c')],{'$or':_['map'](_0x28c366,function(_0x5b9ce7){if(_0x5b9ce7['type']!==_0x049e('0x40')){var _0x5b4e25={};_0x5b4e25[_0x5b9ce7['name']]={'$like':'%'+_0xc35dd1[_0x049e('0x32')][_0x049e('0x41')]+'%'};return _0x5b4e25;}})});}_0x1c0ef4=_['merge']({},_0x1c0ef4,_0xc35dd1[_0x049e('0x42')]);var _0x4a05e0={'where':_0x1c0ef4['where']};return db[_0x049e('0x43')][_0x049e('0x20')](_0x4a05e0)['then'](function(_0x3b324b){_0x51c46a[_0x049e('0x20')]=_0x3b324b;if(_0xc35dd1[_0x049e('0x32')][_0x049e('0x44')]){_0x1c0ef4[_0x049e('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1c0ef4);})[_0x049e('0x27')](function(_0x9d34b8){_0x51c46a[_0x049e('0x46')]=_0x9d34b8;return _0x51c46a;})[_0x049e('0x27')](respondWithFilteredResult(_0x579606,_0x1c0ef4))[_0x049e('0x47')](handleError(_0x579606,null));};exports[_0x049e('0x48')]=function(_0x3d9261,_0x8d9a72){var _0x1915f8={'raw':!![],'where':{'id':_0x3d9261['params']['id']}},_0x5e885b={};_0x5e885b[_0x049e('0x35')]=_[_0x049e('0x33')](db[_0x049e('0x43')]['rawAttributes']);_0x5e885b[_0x049e('0x32')]=_['keys'](_0x3d9261[_0x049e('0x32')]);_0x5e885b[_0x049e('0x3d')]=_['intersection'](_0x5e885b[_0x049e('0x35')],_0x5e885b['query']);_0x1915f8[_0x049e('0x36')]=_['intersection'](_0x5e885b[_0x049e('0x35')],qs[_0x049e('0x37')](_0x3d9261['query'][_0x049e('0x37')]));_0x1915f8['attributes']=_0x1915f8['attributes'][_0x049e('0x49')]?_0x1915f8[_0x049e('0x36')]:_0x5e885b['model'];if(_0x3d9261[_0x049e('0x32')][_0x049e('0x44')]){_0x1915f8[_0x049e('0x45')]=[{'all':!![]}];}_0x1915f8=_[_0x049e('0x3f')]({},_0x1915f8,_0x3d9261[_0x049e('0x42')]);return db[_0x049e('0x43')][_0x049e('0x4a')](_0x1915f8)[_0x049e('0x27')](handleEntityNotFound(_0x8d9a72,null))[_0x049e('0x27')](respondWithResult(_0x8d9a72,null))[_0x049e('0x47')](handleError(_0x8d9a72,null));};exports[_0x049e('0x4b')]=function(_0x244b7c,_0x534550){return db[_0x049e('0x43')][_0x049e('0x4b')](_0x244b7c[_0x049e('0x4c')],{})[_0x049e('0x27')](respondWithResult(_0x534550,0xc9))[_0x049e('0x47')](handleError(_0x534550,null));};exports[_0x049e('0x4d')]=function(_0x1a96c4,_0x5c4f72){if(_0x1a96c4[_0x049e('0x4c')]['id']){delete _0x1a96c4[_0x049e('0x4c')]['id'];}return db[_0x049e('0x43')][_0x049e('0x4a')]({'where':{'id':_0x1a96c4[_0x049e('0x4e')]['id']}})[_0x049e('0x27')](handleEntityNotFound(_0x5c4f72,null))[_0x049e('0x27')](saveUpdates(_0x1a96c4[_0x049e('0x4c')],null))[_0x049e('0x27')](respondWithResult(_0x5c4f72,null))[_0x049e('0x47')](handleError(_0x5c4f72,null));};exports[_0x049e('0x28')]=function(_0x12c615,_0x5bc74f){return db[_0x049e('0x43')][_0x049e('0x4a')]({'where':{'id':_0x12c615[_0x049e('0x4e')]['id']}})[_0x049e('0x27')](handleEntityNotFound(_0x5bc74f,null))['then'](removeEntity(_0x5bc74f,null))[_0x049e('0x47')](handleError(_0x5bc74f,null));};exports[_0x049e('0x4f')]=function(_0x5e68e7,_0xc3ece6){return db[_0x049e('0x43')]['describe']()[_0x049e('0x27')](respondWithResult(_0xc3ece6,null))['catch'](handleError(_0xc3ece6,null));};exports[_0x049e('0x50')]=function(_0x4cbb83,_0x2ca46c,_0x3c8472){var _0x3e9a47={'raw':!![],'where':{}};var _0x1543dc={};var _0xaebdfa={'count':0x0,'rows':[]};return db[_0x049e('0x43')][_0x049e('0x51')]({'where':{'id':_0x4cbb83[_0x049e('0x4e')]['id']}})[_0x049e('0x27')](handleEntityNotFound(_0x2ca46c,null))['then'](function(_0x1691d0){if(_0x1691d0){_0x1543dc[_0x049e('0x35')]=_[_0x049e('0x33')](db[_0x049e('0x52')][_0x049e('0x2e')]);_0x1543dc['query']=_[_0x049e('0x33')](_0x4cbb83[_0x049e('0x32')]);_0x1543dc[_0x049e('0x3d')]=_['intersection'](_0x1543dc['model'],_0x1543dc['query']);_0x3e9a47[_0x049e('0x36')]=_['intersection'](_0x1543dc[_0x049e('0x35')],qs['fields'](_0x4cbb83['query'][_0x049e('0x37')]));_0x3e9a47[_0x049e('0x36')]=_0x3e9a47['attributes'][_0x049e('0x49')]?_0x3e9a47['attributes']:_0x1543dc[_0x049e('0x35')];if(!_0x4cbb83[_0x049e('0x32')][_0x049e('0x38')](_0x049e('0x39'))){_0x3e9a47[_0x049e('0x21')]=qs[_0x049e('0x21')](_0x4cbb83[_0x049e('0x32')][_0x049e('0x21')]);_0x3e9a47[_0x049e('0x1e')]=qs[_0x049e('0x1e')](_0x4cbb83['query'][_0x049e('0x1e')]);}_0x3e9a47[_0x049e('0x3a')]=qs['sort'](_0x4cbb83[_0x049e('0x32')][_0x049e('0x3b')]);_0x3e9a47[_0x049e('0x3c')]=qs['filters'](_[_0x049e('0x3e')](_0x4cbb83[_0x049e('0x32')],_0x1543dc[_0x049e('0x3d')]));_0x3e9a47[_0x049e('0x3c')][_0x049e('0x53')]=_0x1691d0['id'];if(_0x4cbb83[_0x049e('0x32')][_0x049e('0x41')]){_0x3e9a47[_0x049e('0x3c')]=_[_0x049e('0x3f')](_0x3e9a47['where'],{'$or':_[_0x049e('0x2d')](_0x3e9a47[_0x049e('0x36')],function(_0x518b57){var _0x35804e={};_0x35804e[_0x518b57]={'$like':'%'+_0x4cbb83['query'][_0x049e('0x41')]+'%'};return _0x35804e;})});}_0x3e9a47=_[_0x049e('0x3f')]({},_0x3e9a47,_0x4cbb83[_0x049e('0x42')]);return db[_0x049e('0x52')]['count']({'where':_0x3e9a47[_0x049e('0x3c')]})[_0x049e('0x27')](function(_0x56fa52){_0xaebdfa[_0x049e('0x20')]=_0x56fa52;if(_0x4cbb83[_0x049e('0x32')][_0x049e('0x44')]){_0x3e9a47[_0x049e('0x45')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x3e9a47);})[_0x049e('0x27')](function(_0x373f2d){_0xaebdfa[_0x049e('0x46')]=_0x373f2d;return _0xaebdfa;});}})[_0x049e('0x27')](respondWithFilteredResult(_0x2ca46c,_0x3e9a47))[_0x049e('0x47')](handleError(_0x2ca46c,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 5c04629..5740785 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 _0x31f0=['./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x297205,_0x1c75bf){var _0xc4e891=function(_0x39e918){while(--_0x39e918){_0x297205['push'](_0x297205['shift']());}};_0xc4e891(++_0x1c75bf);}(_0x31f0,0xb7));var _0x031f=function(_0x45ad4f,_0x11bbfe){_0x45ad4f=_0x45ad4f-0x0;var _0x166d01=_0x31f0[_0x45ad4f];return _0x166d01;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe015=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','report_jscripty_sessions'];(function(_0x2297f6,_0x586cd6){var _0x2925f2=function(_0x514605){while(--_0x514605){_0x2297f6['push'](_0x2297f6['shift']());}};_0x2925f2(++_0x586cd6);}(_0xe015,0x13b));var _0x5e01=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe015[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('JscriptySessionReport',attributes,{'tableName':_0x5e01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 06a6e23..84ea52e 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 _0x7b84=['jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x44d664,_0x393ed8){var _0x5e6b3e=function(_0x418e5f){while(--_0x418e5f){_0x44d664['push'](_0x44d664['shift']());}};_0x5e6b3e(++_0x393ed8);}(_0x7b84,0x17c));var _0x47b8=function(_0x21e09c,_0x3e49a1){_0x21e09c=_0x21e09c-0x0;var _0xd893eb=_0x7b84[_0x21e09c];return _0xd893eb;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('JscriptySessionReport,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});} \ No newline at end of file +var _0x4888=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x201042,_0x50bd0a){var _0x17f363=function(_0x4d7519){while(--_0x4d7519){_0x201042['push'](_0x201042['shift']());}};_0x17f363(++_0x50bd0a);}(_0x4888,0x198));var _0x8488=function(_0xcdfdb2,_0x151157){_0xcdfdb2=_0xcdfdb2-0x0;var _0x21f715=_0x4888[_0xcdfdb2];return _0x21f715;};'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});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index bcbf747..c961b76 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 _0x3003=['get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','multer','path','connect-timeout','express','fs-extra','./license.controller'];(function(_0x388f1b,_0x1b6254){var _0x36ac35=function(_0x18a203){while(--_0x18a203){_0x388f1b['push'](_0x388f1b['shift']());}};_0x36ac35(++_0x1b6254);}(_0x3003,0x14a));var _0x3300=function(_0x1b5460,_0x5eb83f){_0x1b5460=_0x1b5460-0x0;var _0x498418=_0x3003[_0x1b5460];return _0x498418;};'use strict';var multer=require(_0x3300('0x0'));var util=require('util');var path=require(_0x3300('0x1'));var timeout=require(_0x3300('0x2'));var express=require(_0x3300('0x3'));var router=express['Router']();var fs_extra=require(_0x3300('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3300('0x5'));router[_0x3300('0x6')]('/',controller[_0x3300('0x7')]);router[_0x3300('0x8')](_0x3300('0x9'),auth[_0x3300('0xa')](),controller[_0x3300('0xb')]);router['get'](_0x3300('0xc'),auth[_0x3300('0xa')](),controller[_0x3300('0xd')]);module['exports']=router; \ No newline at end of file +var _0x2ae9=['../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x40c778,_0x471c5d){var _0x42127f=function(_0x414ec7){while(--_0x414ec7){_0x40c778['push'](_0x40c778['shift']());}};_0x42127f(++_0x471c5d);}(_0x2ae9,0x13e));var _0x92ae=function(_0x2f2d88,_0x32815c){_0x2f2d88=_0x2f2d88-0x0;var _0x4742ee=_0x2ae9[_0x2f2d88];return _0x4742ee;};'use strict';var multer=require(_0x92ae('0x0'));var util=require('util');var path=require(_0x92ae('0x1'));var timeout=require(_0x92ae('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x92ae('0x3'));var auth=require(_0x92ae('0x4'));var interaction=require(_0x92ae('0x5'));var config=require(_0x92ae('0x6'));var controller=require(_0x92ae('0x7'));router[_0x92ae('0x8')]('/',controller[_0x92ae('0x9')]);router[_0x92ae('0xa')](_0x92ae('0xb'),auth['isAuthenticated'](),controller[_0x92ae('0xc')]);router[_0x92ae('0x8')](_0x92ae('0xd'),auth[_0x92ae('0xe')](),controller[_0x92ae('0xf')]);module[_0x92ae('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 590c658..1fd75db 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 _0xcdc3=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x168aef,_0x20d38e){var _0x1d88d6=function(_0xc9d623){while(--_0xc9d623){_0x168aef['push'](_0x168aef['shift']());}};_0x1d88d6(++_0x20d38e);}(_0xcdc3,0x1db));var _0x3cdc=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xcdc3[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0x3cdc('0x0'));module[_0x3cdc('0x1')]={'license':{'type':Sequelize[_0x3cdc('0x2')]},'data1':{'type':Sequelize[_0x3cdc('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x3cdc('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x855e=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x5cb475,_0x234940){var _0xe9706b=function(_0x297895){while(--_0x297895){_0x5cb475['push'](_0x5cb475['shift']());}};_0xe9706b(++_0x234940);}(_0x855e,0xd7));var _0xe855=function(_0x15794e,_0x23524f){_0x15794e=_0x15794e-0x0;var _0x7e22d6=_0x855e[_0x15794e];return _0x7e22d6;};'use strict';var Sequelize=require(_0xe855('0x0'));module[_0xe855('0x1')]={'license':{'type':Sequelize[_0xe855('0x2')]},'data1':{'type':Sequelize[_0xe855('0x3')]},'data2':{'type':Sequelize[_0xe855('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xe855('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 3bb3fb7..19b0ffe 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 _0x6890=['fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','name','send','index','model','keys','License','query','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','get','checkLicense','demo','downloadLogFile','license-info.log','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir'];(function(_0x1ca7c2,_0x135593){var _0x5a5152=function(_0x4acb60){while(--_0x4acb60){_0x1ca7c2['push'](_0x1ca7c2['shift']());}};_0x5a5152(++_0x135593);}(_0x6890,0xc0));var _0x0689=function(_0x2ec9ac,_0x3a02c6){_0x2ec9ac=_0x2ec9ac-0x0;var _0x3bd406=_0x6890[_0x2ec9ac];return _0x3bd406;};'use strict';var emlformat=require(_0x0689('0x0'));var rimraf=require(_0x0689('0x1'));var zipdir=require(_0x0689('0x2'));var jsonpatch=require(_0x0689('0x3'));var rp=require(_0x0689('0x4'));var moment=require('moment');var BPromise=require(_0x0689('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0689('0x6'));var sox=require(_0x0689('0x7'));var csv=require(_0x0689('0x8'));var ejs=require(_0x0689('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0689('0xa'));var jsforce=require(_0x0689('0xb'));var deskjs=require(_0x0689('0xc'));var toCsv=require(_0x0689('0x8'));var querystring=require('querystring');var Papa=require(_0x0689('0xd'));var Redis=require(_0x0689('0xe'));var authService=require(_0x0689('0xf'));var qs=require(_0x0689('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0689('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x0689('0x12'));var config=require(_0x0689('0x13'));var licenseUtil=require(_0x0689('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45e0cf,_0x39e478){_0x39e478=_0x39e478||0xcc;return function(_0x590f07){if(_0x590f07){return _0x45e0cf[_0x0689('0x15')](_0x39e478);}return _0x45e0cf[_0x0689('0x16')](_0x39e478)[_0x0689('0x17')]();};}function respondWithResult(_0xcb5215,_0x1fe860){_0x1fe860=_0x1fe860||0xc8;return function(_0x534f50){if(_0x534f50){return _0xcb5215[_0x0689('0x16')](_0x1fe860)[_0x0689('0x18')](_0x534f50);}};}function respondWithFilteredResult(_0xa29c61,_0x2782b2){return function(_0x56b4ed){if(_0x56b4ed){var _0x128d13=typeof _0x2782b2[_0x0689('0x19')]===_0x0689('0x1a')&&typeof _0x2782b2[_0x0689('0x1b')]===_0x0689('0x1a');var _0x2166cb=_0x56b4ed[_0x0689('0x1c')];var _0x4eaf71=_0x128d13?0x0:_0x2782b2[_0x0689('0x19')];var _0x8ef317=_0x128d13?_0x56b4ed['count']:_0x2782b2[_0x0689('0x19')]+_0x2782b2[_0x0689('0x1b')];var _0x3dfaa9;if(_0x8ef317>=_0x2166cb){_0x8ef317=_0x2166cb;_0x3dfaa9=0xc8;}else{_0x3dfaa9=0xce;}_0xa29c61[_0x0689('0x16')](_0x3dfaa9);return _0xa29c61[_0x0689('0x1d')](_0x0689('0x1e'),_0x4eaf71+'-'+_0x8ef317+'/'+_0x2166cb)[_0x0689('0x18')](_0x56b4ed);}return null;};}function patchUpdates(_0x5f2470){return function(_0x18d076){try{jsonpatch['apply'](_0x18d076,_0x5f2470,!![]);}catch(_0x188948){return BPromise['reject'](_0x188948);}return _0x18d076[_0x0689('0x1f')]();};}function saveUpdates(_0x1636ae,_0x4d4a9e){return function(_0x31303d){if(_0x31303d){return _0x31303d[_0x0689('0x20')](_0x1636ae)['then'](function(_0x3d657){return _0x3d657;});}return null;};}function removeEntity(_0x980aa0,_0x3cb973){return function(_0x304304){if(_0x304304){return _0x304304['destroy']()[_0x0689('0x21')](function(){_0x980aa0[_0x0689('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41020e,_0x524345){return function(_0xb77b9){if(!_0xb77b9){_0x41020e[_0x0689('0x15')](0x194);}return _0xb77b9;};}function handleError(_0x443f57,_0x45e1c3){_0x45e1c3=_0x45e1c3||0x1f4;return function(_0x1053c7){logger[_0x0689('0x22')](_0x1053c7['stack']);if(_0x1053c7['name']){delete _0x1053c7[_0x0689('0x23')];}_0x443f57[_0x0689('0x16')](_0x45e1c3)[_0x0689('0x24')](_0x1053c7);};}var utilLicense=require(_0x0689('0x14'));exports[_0x0689('0x25')]=function(_0x5019a7,_0x37318d){var _0x2f6c35={'raw':!![],'where':{'id':0x1}},_0x313cec={};_0x313cec[_0x0689('0x26')]=_[_0x0689('0x27')](db[_0x0689('0x28')]['rawAttributes']);_0x313cec[_0x0689('0x29')]=_[_0x0689('0x27')](_0x5019a7['query']);_0x313cec['filters']=_[_0x0689('0x2a')](_0x313cec['model'],_0x313cec[_0x0689('0x29')]);_0x2f6c35[_0x0689('0x2b')]=_['intersection'](_0x313cec[_0x0689('0x26')],qs['fields'](_0x5019a7[_0x0689('0x29')][_0x0689('0x2c')]));_0x2f6c35[_0x0689('0x2b')]=_0x2f6c35[_0x0689('0x2b')][_0x0689('0x2d')]?_0x2f6c35[_0x0689('0x2b')]:_0x313cec['model'];_0x2f6c35=_[_0x0689('0x2e')]({},_0x2f6c35,_0x5019a7[_0x0689('0x2f')]);return utilLicense[_0x0689('0x30')](_0x2f6c35)['then'](respondWithResult(_0x37318d,null))[_0x0689('0x31')](handleError(_0x37318d,null));};exports[_0x0689('0x20')]=function(_0xf5c5d4,_0x124704){if(_0xf5c5d4[_0x0689('0x32')]['id']){delete _0xf5c5d4[_0x0689('0x32')]['id'];}return db[_0x0689('0x28')][_0x0689('0x33')]({'where':{'id':_0xf5c5d4['params']['id']}})['then'](handleEntityNotFound(_0x124704,null))[_0x0689('0x21')](function(_0xc53d8f){var _0x4734fb=_0xc53d8f[_0x0689('0x34')]({'plain':!![]});return utilLicense[_0x0689('0x35')](_0x4734fb,_0xf5c5d4[_0x0689('0x32')]['key']);})[_0x0689('0x21')](function(_0x373194){if(!_0x373194[_0x0689('0x36')]){return saveUpdates(_0xf5c5d4['body'],null);}return _0x373194;})['then'](respondWithResult(_0x124704,null))['catch'](handleError(_0x124704,null));};exports[_0x0689('0x37')]=function(_0x10b2fe,_0x4ec89f){var _0x15a5d9=_0x0689('0x38');var _0x3342ce=path['join']('/var',_0x0689('0x39'),_0x0689('0x3a'),_0x15a5d9);_0x4ec89f[_0x0689('0x3b')](_0x0689('0x3c'),_0x0689('0x3d')+_0x15a5d9);_0x4ec89f[_0x0689('0x1d')](_0x0689('0x3e'),_0x0689('0x3f'));_0x4ec89f[_0x0689('0x40')](_0x3342ce);}; \ No newline at end of file +var _0xf9d0=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','model','License','rawAttributes','keys','filters','query','attributes','intersection','fields','length','merge','options','getLicense','catch','body','get','checkLicense','demo','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','Content-Type','download','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x90e97b,_0x1377f6){var _0x518984=function(_0x2b7202){while(--_0x2b7202){_0x90e97b['push'](_0x90e97b['shift']());}};_0x518984(++_0x1377f6);}(_0xf9d0,0x192));var _0x0f9d=function(_0x3a17ec,_0x29fbd9){_0x3a17ec=_0x3a17ec-0x0;var _0x4ea7dc=_0xf9d0[_0x3a17ec];return _0x4ea7dc;};'use strict';var emlformat=require(_0x0f9d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f9d('0x1'));var jsonpatch=require(_0x0f9d('0x2'));var rp=require('request-promise');var moment=require(_0x0f9d('0x3'));var BPromise=require(_0x0f9d('0x4'));var Mustache=require(_0x0f9d('0x5'));var util=require(_0x0f9d('0x6'));var path=require('path');var sox=require(_0x0f9d('0x7'));var csv=require(_0x0f9d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f9d('0x9'));var _=require('lodash');var squel=require(_0x0f9d('0xa'));var crypto=require(_0x0f9d('0xb'));var jsforce=require(_0x0f9d('0xc'));var deskjs=require(_0x0f9d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0f9d('0xe'));var Papa=require(_0x0f9d('0xf'));var Redis=require('ioredis');var authService=require(_0x0f9d('0x10'));var qs=require(_0x0f9d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f9d('0x12'));var logger=require('../../config/logger')(_0x0f9d('0x13'));var utils=require(_0x0f9d('0x14'));var config=require(_0x0f9d('0x15'));var licenseUtil=require(_0x0f9d('0x16'));var db=require(_0x0f9d('0x17'))['db'];function respondWithStatusCode(_0x31957b,_0x16ee7a){_0x16ee7a=_0x16ee7a||0xcc;return function(_0x246aff){if(_0x246aff){return _0x31957b['sendStatus'](_0x16ee7a);}return _0x31957b[_0x0f9d('0x18')](_0x16ee7a)[_0x0f9d('0x19')]();};}function respondWithResult(_0x37d73f,_0x45140b){_0x45140b=_0x45140b||0xc8;return function(_0x29aa65){if(_0x29aa65){return _0x37d73f[_0x0f9d('0x18')](_0x45140b)['json'](_0x29aa65);}};}function respondWithFilteredResult(_0x45ea79,_0x554a85){return function(_0x5d4762){if(_0x5d4762){var _0x381f80=typeof _0x554a85['offset']===_0x0f9d('0x1a')&&typeof _0x554a85['limit']===_0x0f9d('0x1a');var _0x3d43e2=_0x5d4762['count'];var _0x541ecf=_0x381f80?0x0:_0x554a85['offset'];var _0x1770bb=_0x381f80?_0x5d4762[_0x0f9d('0x1b')]:_0x554a85[_0x0f9d('0x1c')]+_0x554a85[_0x0f9d('0x1d')];var _0x47abea;if(_0x1770bb>=_0x3d43e2){_0x1770bb=_0x3d43e2;_0x47abea=0xc8;}else{_0x47abea=0xce;}_0x45ea79['status'](_0x47abea);return _0x45ea79[_0x0f9d('0x1e')]('Content-Range',_0x541ecf+'-'+_0x1770bb+'/'+_0x3d43e2)['json'](_0x5d4762);}return null;};}function patchUpdates(_0x356b7e){return function(_0x30c916){try{jsonpatch[_0x0f9d('0x1f')](_0x30c916,_0x356b7e,!![]);}catch(_0x5701a7){return BPromise[_0x0f9d('0x20')](_0x5701a7);}return _0x30c916[_0x0f9d('0x21')]();};}function saveUpdates(_0x5da77b,_0x3b51d6){return function(_0x25c981){if(_0x25c981){return _0x25c981[_0x0f9d('0x22')](_0x5da77b)[_0x0f9d('0x23')](function(_0x4b343e){return _0x4b343e;});}return null;};}function removeEntity(_0x5b1d08,_0x2ceba6){return function(_0x21f087){if(_0x21f087){return _0x21f087[_0x0f9d('0x24')]()[_0x0f9d('0x23')](function(){_0x5b1d08['status'](0xcc)[_0x0f9d('0x19')]();});}};}function handleEntityNotFound(_0x1fe464,_0x18a853){return function(_0x32c160){if(!_0x32c160){_0x1fe464[_0x0f9d('0x25')](0x194);}return _0x32c160;};}function handleError(_0x4d5441,_0x45a8dc){_0x45a8dc=_0x45a8dc||0x1f4;return function(_0x20c2ed){logger[_0x0f9d('0x26')](_0x20c2ed[_0x0f9d('0x27')]);if(_0x20c2ed[_0x0f9d('0x28')]){delete _0x20c2ed[_0x0f9d('0x28')];}_0x4d5441['status'](_0x45a8dc)[_0x0f9d('0x29')](_0x20c2ed);};}var utilLicense=require(_0x0f9d('0x16'));exports[_0x0f9d('0x2a')]=function(_0x1552eb,_0x2b045f){var _0x5a0d06={'raw':!![],'where':{'id':0x1}},_0x5bcb38={};_0x5bcb38[_0x0f9d('0x2b')]=_['keys'](db[_0x0f9d('0x2c')][_0x0f9d('0x2d')]);_0x5bcb38['query']=_[_0x0f9d('0x2e')](_0x1552eb['query']);_0x5bcb38[_0x0f9d('0x2f')]=_['intersection'](_0x5bcb38['model'],_0x5bcb38[_0x0f9d('0x30')]);_0x5a0d06[_0x0f9d('0x31')]=_[_0x0f9d('0x32')](_0x5bcb38['model'],qs['fields'](_0x1552eb['query'][_0x0f9d('0x33')]));_0x5a0d06[_0x0f9d('0x31')]=_0x5a0d06[_0x0f9d('0x31')][_0x0f9d('0x34')]?_0x5a0d06[_0x0f9d('0x31')]:_0x5bcb38[_0x0f9d('0x2b')];_0x5a0d06=_[_0x0f9d('0x35')]({},_0x5a0d06,_0x1552eb[_0x0f9d('0x36')]);return utilLicense[_0x0f9d('0x37')](_0x5a0d06)[_0x0f9d('0x23')](respondWithResult(_0x2b045f,null))[_0x0f9d('0x38')](handleError(_0x2b045f,null));};exports['update']=function(_0x581412,_0x5ecd4c){if(_0x581412['body']['id']){delete _0x581412[_0x0f9d('0x39')]['id'];}return db[_0x0f9d('0x2c')]['find']({'where':{'id':_0x581412['params']['id']}})['then'](handleEntityNotFound(_0x5ecd4c,null))['then'](function(_0x53935a){var _0x25139a=_0x53935a[_0x0f9d('0x3a')]({'plain':!![]});return utilLicense[_0x0f9d('0x3b')](_0x25139a,_0x581412[_0x0f9d('0x39')]['key']);})[_0x0f9d('0x23')](function(_0x309920){if(!_0x309920[_0x0f9d('0x3c')]){return saveUpdates(_0x581412[_0x0f9d('0x39')],null);}return _0x309920;})[_0x0f9d('0x23')](respondWithResult(_0x5ecd4c,null))[_0x0f9d('0x38')](handleError(_0x5ecd4c,null));};exports[_0x0f9d('0x3d')]=function(_0x5b3bae,_0x3c115b){var _0x4841d8=_0x0f9d('0x3e');var _0x4140b3=path['join'](_0x0f9d('0x3f'),_0x0f9d('0x40'),_0x0f9d('0x41'),_0x4841d8);_0x3c115b[_0x0f9d('0x42')](_0x0f9d('0x43'),'attachment;\x20filename='+_0x4841d8);_0x3c115b[_0x0f9d('0x1e')](_0x0f9d('0x44'),'text/plain');_0x3c115b[_0x0f9d('0x45')](_0x4140b3);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 22ef79a..180bfe2 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 _0x9650=['lodash','util','api','moment','request-promise','path','../../config/environment','exports','define','License','license'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9650,0x1ce));var _0x0965=function(_0x108d68,_0x9b39de){_0x108d68=_0x108d68-0x0;var _0x11476a=_0x9650[_0x108d68];return _0x11476a;};'use strict';var _=require(_0x0965('0x0'));var util=require(_0x0965('0x1'));var logger=require('../../config/logger')(_0x0965('0x2'));var moment=require(_0x0965('0x3'));var BPromise=require('bluebird');var rp=require(_0x0965('0x4'));var fs=require('fs');var path=require(_0x0965('0x5'));var rimraf=require('rimraf');var config=require(_0x0965('0x6'));var attributes=require('./license.attributes');module[_0x0965('0x7')]=function(_0x5c0f53,_0x207f24){return _0x5c0f53[_0x0965('0x8')](_0x0965('0x9'),attributes,{'tableName':_0x0965('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa37c=['moment','bluebird','path','rimraf','../../config/environment','License','license','util','../../config/logger','api'];(function(_0x163285,_0x20656e){var _0x495c2f=function(_0x16b423){while(--_0x16b423){_0x163285['push'](_0x163285['shift']());}};_0x495c2f(++_0x20656e);}(_0xa37c,0x101));var _0xca37=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xa37c[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require(_0xca37('0x0'));var logger=require(_0xca37('0x1'))(_0xca37('0x2'));var moment=require(_0xca37('0x3'));var BPromise=require(_0xca37('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca37('0x5'));var rimraf=require(_0xca37('0x6'));var config=require(_0xca37('0x7'));var attributes=require('./license.attributes');module['exports']=function(_0x405280,_0x32e700){return _0x405280['define'](_0xca37('0x8'),attributes,{'tableName':_0xca37('0x9'),'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 04a4909..040eae1 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 _0x463f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','code','error','message','License,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b35af,_0x58b687){var _0x551a1e=function(_0x255034){while(--_0x255034){_0x3b35af['push'](_0x3b35af['shift']());}};_0x551a1e(++_0x58b687);}(_0x463f,0xf4));var _0xf463=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x463f[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xf463('0x0'));var util=require(_0xf463('0x1'));var moment=require('moment');var BPromise=require(_0xf463('0x2'));var rs=require(_0xf463('0x3'));var fs=require('fs');var Redis=require(_0xf463('0x4'));var db=require(_0xf463('0x5'))['db'];var utils=require(_0xf463('0x6'));var logger=require(_0xf463('0x7'))(_0xf463('0x8'));var config=require(_0xf463('0x9'));var jayson=require(_0xf463('0xa'));var client=jayson[_0xf463('0xb')][_0xf463('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1724db,_0x192e1c,_0xe555fc){return new BPromise(function(_0x108d31,_0x2ca62b){return client[_0xf463('0xd')](_0x1724db,_0xe555fc)[_0xf463('0xe')](function(_0x3c538b){logger[_0xf463('0xf')]('License,\x20%s,\x20%s',_0x192e1c,_0xf463('0x10'));logger[_0xf463('0x11')](_0xf463('0x12'),_0x192e1c,_0xf463('0x10'),JSON['stringify'](_0x3c538b));if(_0x3c538b['error']){if(_0x3c538b['error'][_0xf463('0x13')]===0x1f4){logger[_0xf463('0x14')]('License,\x20%s,\x20%s',_0x192e1c,_0x3c538b[_0xf463('0x14')][_0xf463('0x15')]);return _0x2ca62b(_0x3c538b[_0xf463('0x14')][_0xf463('0x15')]);}logger[_0xf463('0x14')](_0xf463('0x16'),_0x192e1c,_0x3c538b[_0xf463('0x14')][_0xf463('0x15')]);return _0x108d31(_0x3c538b[_0xf463('0x14')][_0xf463('0x15')]);}else{logger['info'](_0xf463('0x16'),_0x192e1c,_0xf463('0x10'));_0x108d31(_0x3c538b[_0xf463('0x17')][_0xf463('0x15')]);}})[_0xf463('0x18')](function(_0x58046c){logger['error'](_0xf463('0x16'),_0x192e1c,_0x58046c);_0x2ca62b(_0x58046c);});});} \ No newline at end of file +var _0xb22b=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird'];(function(_0x1b6b77,_0x5d13fc){var _0x5d4582=function(_0x7006db){while(--_0x7006db){_0x1b6b77['push'](_0x1b6b77['shift']());}};_0x5d4582(++_0x5d13fc);}(_0xb22b,0xd9));var _0xbb22=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb22b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xbb22('0x0'));var moment=require(_0xbb22('0x1'));var BPromise=require(_0xbb22('0x2'));var rs=require(_0xbb22('0x3'));var fs=require('fs');var Redis=require(_0xbb22('0x4'));var db=require(_0xbb22('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb22('0x6'))(_0xbb22('0x7'));var config=require(_0xbb22('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbb22('0x9')][_0xbb22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d2180,_0x5b5395,_0x47c440){return new BPromise(function(_0x583174,_0x140042){return client[_0xbb22('0xb')](_0x4d2180,_0x47c440)[_0xbb22('0xc')](function(_0x3998df){logger['info'](_0xbb22('0xd'),_0x5b5395,'request\x20sent');logger[_0xbb22('0xe')](_0xbb22('0xf'),_0x5b5395,'request\x20sent',JSON[_0xbb22('0x10')](_0x3998df));if(_0x3998df[_0xbb22('0x11')]){if(_0x3998df[_0xbb22('0x11')][_0xbb22('0x12')]===0x1f4){logger[_0xbb22('0x11')](_0xbb22('0xd'),_0x5b5395,_0x3998df[_0xbb22('0x11')]['message']);return _0x140042(_0x3998df[_0xbb22('0x11')][_0xbb22('0x13')]);}logger[_0xbb22('0x11')]('License,\x20%s,\x20%s',_0x5b5395,_0x3998df[_0xbb22('0x11')]['message']);return _0x583174(_0x3998df[_0xbb22('0x11')][_0xbb22('0x13')]);}else{logger[_0xbb22('0x14')](_0xbb22('0xd'),_0x5b5395,'request\x20sent');_0x583174(_0x3998df['result'][_0xbb22('0x13')]);}})[_0xbb22('0x15')](function(_0x2d969c){logger[_0xbb22('0x11')](_0xbb22('0xd'),_0x5b5395,_0x2d969c);_0x140042(_0x2d969c);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 7ed3645..61bc5a8 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 _0xd16b=['addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','post','addAnswer','create','addImap','addSmtp','/:id/interactions'];(function(_0x2730c9,_0x4b9f79){var _0x2f1cf5=function(_0x4bf349){while(--_0x4bf349){_0x2730c9['push'](_0x2730c9['shift']());}};_0x2f1cf5(++_0x4b9f79);}(_0xd16b,0x1b6));var _0xbd16=function(_0x1912fd,_0x2ec304){_0x1912fd=_0x1912fd-0x0;var _0x573fc4=_0xd16b[_0x1912fd];return _0x573fc4;};'use strict';var multer=require(_0xbd16('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd16('0x1'));var express=require(_0xbd16('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd16('0x3'));var interaction=require(_0xbd16('0x4'));var config=require(_0xbd16('0x5'));var controller=require('./mailAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbd16('0x6')]);router[_0xbd16('0x7')](_0xbd16('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xbd16('0x7')](_0xbd16('0x9'),auth[_0xbd16('0xa')](),controller[_0xbd16('0xb')]);router[_0xbd16('0x7')](_0xbd16('0xc'),auth[_0xbd16('0xa')](),controller[_0xbd16('0xd')]);router['get'](_0xbd16('0xe'),auth[_0xbd16('0xa')](),controller['getAnswers']);router['get'](_0xbd16('0xf'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x10')]);router[_0xbd16('0x7')](_0xbd16('0x11'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x12')]);router[_0xbd16('0x7')]('/:id/interactions',auth[_0xbd16('0xa')](),controller[_0xbd16('0x13')]);router[_0xbd16('0x7')](_0xbd16('0x14'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x15')]);router[_0xbd16('0x7')](_0xbd16('0x16'),auth['isAuthenticated'](),controller[_0xbd16('0x17')]);router[_0xbd16('0x7')]('/:id/verify',auth[_0xbd16('0xa')](),controller[_0xbd16('0x18')]);router['get']('/:id/users',auth[_0xbd16('0xa')](),controller[_0xbd16('0x19')]);router[_0xbd16('0x1a')](_0xbd16('0xc'),auth[_0xbd16('0xa')](),controller['addDisposition']);router[_0xbd16('0x1a')](_0xbd16('0xe'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x1b')]);router[_0xbd16('0x1a')]('/',auth[_0xbd16('0xa')](),controller[_0xbd16('0x1c')]);router[_0xbd16('0x1a')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xbd16('0x1d')]);router[_0xbd16('0x1a')](_0xbd16('0x11'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x1e')]);router[_0xbd16('0x1a')](_0xbd16('0x1f'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x20')]);router[_0xbd16('0x1a')]('/:id/applications',auth[_0xbd16('0xa')](),controller[_0xbd16('0x21')]);router[_0xbd16('0x1a')](_0xbd16('0x22'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x23')]);router[_0xbd16('0x1a')](_0xbd16('0x24'),auth['isAuthenticated'](),controller[_0xbd16('0x25')]);router['put'](_0xbd16('0x9'),auth['isAuthenticated'](),controller[_0xbd16('0x26')]);router[_0xbd16('0x27')](_0xbd16('0xc'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x28')]);router[_0xbd16('0x27')](_0xbd16('0xe'),auth['isAuthenticated'](),controller[_0xbd16('0x29')]);router[_0xbd16('0x27')](_0xbd16('0xf'),auth['isAuthenticated'](),controller[_0xbd16('0x2a')]);router['delete']('/:id/out_servers',auth[_0xbd16('0xa')](),controller[_0xbd16('0x2b')]);router[_0xbd16('0x27')]('/:id',auth['isAuthenticated'](),controller[_0xbd16('0x2c')]);router[_0xbd16('0x27')](_0xbd16('0x24'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x2d')]);module[_0xbd16('0x2e')]=router; \ No newline at end of file +var _0x262e=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers','addInteraction','addApplications','/:id/send','addAgents','update','delete','removeDispositions','removeImap','removeSmtp','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x262e,0xd9));var _0xe262=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x262e[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xe262('0x0'));var util=require(_0xe262('0x1'));var path=require('path');var timeout=require(_0xe262('0x2'));var express=require(_0xe262('0x3'));var router=express['Router']();var fs_extra=require(_0xe262('0x4'));var auth=require(_0xe262('0x5'));var interaction=require(_0xe262('0x6'));var config=require(_0xe262('0x7'));var controller=require('./mailAccount.controller');router[_0xe262('0x8')]('/',auth[_0xe262('0x9')](),controller[_0xe262('0xa')]);router[_0xe262('0x8')](_0xe262('0xb'),auth[_0xe262('0x9')](),controller[_0xe262('0xc')]);router[_0xe262('0x8')](_0xe262('0xd'),auth[_0xe262('0x9')](),controller[_0xe262('0xe')]);router[_0xe262('0x8')](_0xe262('0xf'),auth[_0xe262('0x9')](),controller['getDispositions']);router[_0xe262('0x8')](_0xe262('0x10'),auth[_0xe262('0x9')](),controller[_0xe262('0x11')]);router[_0xe262('0x8')]('/:id/in_servers',auth[_0xe262('0x9')](),controller[_0xe262('0x12')]);router[_0xe262('0x8')](_0xe262('0x13'),auth['isAuthenticated'](),controller[_0xe262('0x14')]);router[_0xe262('0x8')](_0xe262('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xe262('0x8')](_0xe262('0x16'),auth[_0xe262('0x9')](),controller[_0xe262('0x17')]);router['get']('/:id/messages',auth[_0xe262('0x9')](),controller[_0xe262('0x18')]);router[_0xe262('0x8')](_0xe262('0x19'),auth[_0xe262('0x9')](),controller[_0xe262('0x1a')]);router[_0xe262('0x8')](_0xe262('0x1b'),auth[_0xe262('0x9')](),controller[_0xe262('0x1c')]);router[_0xe262('0x1d')](_0xe262('0xf'),auth['isAuthenticated'](),controller[_0xe262('0x1e')]);router['post'](_0xe262('0x10'),auth[_0xe262('0x9')](),controller[_0xe262('0x1f')]);router[_0xe262('0x1d')]('/',auth['isAuthenticated'](),controller[_0xe262('0x20')]);router[_0xe262('0x1d')](_0xe262('0x21'),auth[_0xe262('0x9')](),controller['addImap']);router[_0xe262('0x1d')]('/:id/out_servers',auth[_0xe262('0x9')](),controller['addSmtp']);router[_0xe262('0x1d')](_0xe262('0x15'),auth[_0xe262('0x9')](),controller[_0xe262('0x22')]);router['post'](_0xe262('0x16'),auth[_0xe262('0x9')](),controller[_0xe262('0x23')]);router[_0xe262('0x1d')](_0xe262('0x24'),auth[_0xe262('0x9')](),controller['send']);router[_0xe262('0x1d')]('/:id/users',auth[_0xe262('0x9')](),controller[_0xe262('0x25')]);router['put'](_0xe262('0xd'),auth['isAuthenticated'](),controller[_0xe262('0x26')]);router[_0xe262('0x27')]('/:id/dispositions',auth[_0xe262('0x9')](),controller[_0xe262('0x28')]);router[_0xe262('0x27')]('/:id/canned_answers',auth[_0xe262('0x9')](),controller['removeAnswers']);router[_0xe262('0x27')]('/:id/in_servers',auth[_0xe262('0x9')](),controller[_0xe262('0x29')]);router[_0xe262('0x27')](_0xe262('0x13'),auth['isAuthenticated'](),controller[_0xe262('0x2a')]);router[_0xe262('0x27')](_0xe262('0xd'),auth[_0xe262('0x9')](),controller[_0xe262('0x2b')]);router['delete']('/:id/users',auth[_0xe262('0x9')](),controller['removeAgents']);module[_0xe262('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4db5297..e82cc94 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 _0x93f4=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','hotmail','outlook365','provider','custom','getDataValue','sequelize','exports','BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0x93f4,0x139));var _0x493f=function(_0x3a30e4,_0x3bfe03){_0x3a30e4=_0x3a30e4-0x0;var _0x290642=_0x93f4[_0x3a30e4];return _0x290642;};'use strict';var Sequelize=require(_0x493f('0x0'));module[_0x493f('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x493f('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x493f('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x493f('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x493f('0x3')],'allowNull':![]},'template':{'type':Sequelize[_0x493f('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x493f('0x3')],'allowNull':![],'defaultValue':_0x493f('0x5')},'fontSize':{'type':Sequelize[_0x493f('0x6')](0x2)[_0x493f('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x493f('0x8');}},'notificationSound':{'type':Sequelize[_0x493f('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x493f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x493f('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x493f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x493f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x493f('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x493f('0xa'),'set':function(_0xd9cbf4){if(!_0xd9cbf4)this[_0x493f('0xb')]('mandatoryDispositionPauseId',null);this[_0x493f('0xb')](_0x493f('0xc'),_0xd9cbf4);}},'provider':{'type':Sequelize[_0x493f('0xd')]('gmail',_0x493f('0xe'),'yahoo',_0x493f('0xf')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x493f('0x10')))return _0x493f('0x11');return this[_0x493f('0x12')](_0x493f('0x10'));},'set':function(_0x191b08){if(_0x191b08===_0x493f('0x11'))_0x191b08=null;return this['setDataValue']('provider',_0x191b08);}}}; \ No newline at end of file +var _0x2a25=['mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x2e1e0a,_0x3a4581){var _0x504f9e=function(_0x412979){while(--_0x412979){_0x2e1e0a['push'](_0x2e1e0a['shift']());}};_0x504f9e(++_0x3a4581);}(_0x2a25,0x1ea));var _0x52a2=function(_0x47408c,_0x14fd3a){_0x47408c=_0x47408c-0x0;var _0x420293=_0x2a25[_0x47408c];return _0x420293;};'use strict';var Sequelize=require(_0x52a2('0x0'));module['exports']={'description':{'type':Sequelize[_0x52a2('0x1')]},'name':{'type':Sequelize[_0x52a2('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x52a2('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x52a2('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x52a2('0x3')]},'markAsUnread':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x52a2('0x1')],'allowNull':![],'defaultValue':_0x52a2('0x4')},'fontSize':{'type':Sequelize[_0x52a2('0x5')](0x2)[_0x52a2('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x52a2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x52a2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x52a2('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x52a2('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':![],'comment':_0x52a2('0x8'),'set':function(_0x3033df){if(!_0x3033df)this[_0x52a2('0x9')](_0x52a2('0xa'),null);this[_0x52a2('0x9')](_0x52a2('0xb'),_0x3033df);}},'provider':{'type':Sequelize[_0x52a2('0xc')](_0x52a2('0xd'),_0x52a2('0xe'),_0x52a2('0xf'),_0x52a2('0x10')),'defaultValue':null,'get':function(){if(!this[_0x52a2('0x11')](_0x52a2('0x12')))return _0x52a2('0x13');return this[_0x52a2('0x11')](_0x52a2('0x12'));},'set':function(_0x2e2c65){if(_0x2e2c65==='custom')_0x2e2c65=null;return this[_0x52a2('0x9')](_0x52a2('0x12'),_0x2e2c65);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 256af55..74c90ed 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 _0x6826=['MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','CmList','Contacts','updatedAt','DESC','CloudProvider','from','format','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','SendMail','List','ListId','messageId','subject','out','Interaction','Messages','verifySmtp','getSmtpOptions','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./mailAccount.socket','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','get','destroy','sendStatus','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','pass','port','secure','service','authentication','host','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','key','map','query','keys','filters','attributes','intersection','fields','length','model','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','options','body','provider','custom','describe','find','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','create','pick','include','removeAnswers','isNil','active','description','UserProfileSection','MailAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','removeSmtp','addInteraction'];(function(_0x2ddd52,_0x4e3b17){var _0x4bb4ec=function(_0x41905f){while(--_0x41905f){_0x2ddd52['push'](_0x2ddd52['shift']());}};_0x4bb4ec(++_0x4e3b17);}(_0x6826,0x1c1));var _0x6682=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0x6826[_0x2c6810];return _0x213881;};'use strict';var moment=require(_0x6682('0x0'));var BPromise=require(_0x6682('0x1'));var util=require('util');var path=require(_0x6682('0x2'));var _=require(_0x6682('0x3'));var juice=require(_0x6682('0x4'));var Redis=require(_0x6682('0x5'));var qs=require(_0x6682('0x6'));var logger=require(_0x6682('0x7'))(_0x6682('0x8'));var config=require(_0x6682('0x9'));var db=require(_0x6682('0xa'))['db'];config[_0x6682('0xb')]=_[_0x6682('0xc')](config[_0x6682('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6682('0xd'))['register'](socket);var jayson=require(_0x6682('0xe'));var client=jayson[_0x6682('0xf')][_0x6682('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x3d6df1,_0x2e690b,_0x351148,_0x4ba97e){return new BPromise(function(_0x542421,_0x16589b){var _0x577dc2=_0x4ba97e||client;return _0x577dc2['request'](_0x3d6df1,_0x351148)[_0x6682('0x11')](function(_0x27ed35){logger[_0x6682('0x12')](_0x6682('0x13'),_0x2e690b,'request\x20sent');logger[_0x6682('0x14')](_0x6682('0x15'),_0x2e690b,_0x6682('0x16'),JSON[_0x6682('0x17')](_0x27ed35));if(_0x27ed35[_0x6682('0x18')]){if(_0x27ed35[_0x6682('0x18')][_0x6682('0x19')]===0x1f4){logger[_0x6682('0x18')]('MailAccount,\x20%s,\x20%s',_0x2e690b,_0x27ed35['error']['message']);return _0x16589b(_0x27ed35[_0x6682('0x18')]['message']);}logger[_0x6682('0x18')](_0x6682('0x13'),_0x2e690b,_0x27ed35['error'][_0x6682('0x1a')]);return _0x542421(_0x27ed35[_0x6682('0x18')]['message']);}else{logger['info'](_0x6682('0x13'),_0x2e690b,_0x6682('0x16'));_0x542421(_0x27ed35[_0x6682('0x1b')][_0x6682('0x1a')]);}})[_0x6682('0x1c')](function(_0x453f46){logger[_0x6682('0x18')]('MailAccount,\x20%s,\x20%s',_0x2e690b,_0x453f46);_0x16589b(_0x453f46);});});}function respondWithStatusCode(_0x5c055a,_0x5196b4){_0x5196b4=_0x5196b4||0xcc;return function(_0x3d46f3){if(_0x3d46f3){return _0x5c055a['sendStatus'](_0x5196b4);}return _0x5c055a[_0x6682('0x1d')](_0x5196b4)[_0x6682('0x1e')]();};}function respondWithResult(_0x2d547c,_0x27a503){_0x27a503=_0x27a503||0xc8;return function(_0x16fe4a){if(_0x16fe4a){return _0x2d547c['status'](_0x27a503)[_0x6682('0x1f')](_0x16fe4a);}};}function respondWithFilteredResult(_0xe40aa2,_0x48b269){return function(_0x5c82dd){if(_0x5c82dd){var _0x14be9c=typeof _0x48b269[_0x6682('0x20')]===_0x6682('0x21')&&typeof _0x48b269[_0x6682('0x22')]===_0x6682('0x21');var _0x2701c1=_0x5c82dd[_0x6682('0x23')];var _0x4e3a6b=_0x14be9c?0x0:_0x48b269['offset'];var _0x6c5e=_0x14be9c?_0x5c82dd['count']:_0x48b269[_0x6682('0x20')]+_0x48b269[_0x6682('0x22')];var _0x2bf8e7;if(_0x6c5e>=_0x2701c1){_0x6c5e=_0x2701c1;_0x2bf8e7=0xc8;}else{_0x2bf8e7=0xce;}_0xe40aa2[_0x6682('0x1d')](_0x2bf8e7);return _0xe40aa2[_0x6682('0x24')](_0x6682('0x25'),_0x4e3a6b+'-'+_0x6c5e+'/'+_0x2701c1)[_0x6682('0x1f')](_0x5c82dd);}return null;};}function saveUpdates(_0x43daf9){return function(_0x46fc04){if(_0x46fc04){return _0x46fc04[_0x6682('0x26')](_0x43daf9)[_0x6682('0x11')](function(_0x18f63f){return _0x18f63f;});}return null;};}function removeEntity(_0x1b8d38){return function(_0xacccfa){if(_0xacccfa){return _0xacccfa['destroy']()['then'](function(){var _0x128162=_0xacccfa[_0x6682('0x27')]({'plain':!![]});var _0x585c5f='MailAccounts';return db['UserProfileResource'][_0x6682('0x28')]({'where':{'type':_0x585c5f,'resourceId':_0x128162['id']}})[_0x6682('0x11')](function(){return _0xacccfa;});})['then'](function(){_0x1b8d38[_0x6682('0x1d')](0xcc)[_0x6682('0x1e')]();});}};}function handleEntityNotFound(_0xf3d2ae){return function(_0x59536f){if(!_0x59536f){_0xf3d2ae[_0x6682('0x29')](0x194);}return _0x59536f;};}function handleError(_0x2e0cc6,_0x28564e){_0x28564e=_0x28564e||0x1f4;return function(_0x56211b){logger['error'](_0x56211b['stack']);if(_0x56211b[_0x6682('0x2a')]){delete _0x56211b[_0x6682('0x2a')];}_0x2e0cc6[_0x6682('0x1d')](_0x28564e)[_0x6682('0x2b')](_0x56211b);};}function getImapHost(_0x35e640){switch(_0x35e640){case _0x6682('0x2c'):return _0x6682('0x2d');case _0x6682('0x2e'):return _0x6682('0x2f');case _0x6682('0x30'):return _0x6682('0x31');case _0x6682('0x32'):return'outlook.office365.com';}throw new Error(_0x6682('0x33'),_0x35e640);}function getSmtpHost(_0x562c7b){switch(_0x562c7b){case _0x6682('0x2c'):return _0x6682('0x34');case _0x6682('0x2e'):return _0x6682('0x35');case _0x6682('0x30'):return'smtp-mail.outlook.com';case _0x6682('0x32'):return _0x6682('0x36');}throw new Error(_0x6682('0x33'),_0x562c7b);}function getAuthenticationOptions(_0x16be04,_0x39c188){var _0x19e015={};var _0x19afb9={};if(_0x16be04){_0x19e015[_0x6682('0x37')]=_0x19afb9['user']=_0x39c188['username'];_0x19e015[_0x6682('0x38')]=_0x19afb9['pass']=_0x39c188[_0x6682('0x38')];if(_0x39c188[_0x6682('0x39')]){_0x19e015[_0x6682('0x39')]=_0x19afb9[_0x6682('0x39')]=!![];_0x19e015['CloudProviderId']=_0x19afb9[_0x6682('0x3a')]=_0x39c188['CloudProviderId'];_0x19e015[_0x6682('0x38')]=_0x19afb9[_0x6682('0x3b')]=null;}else{_0x19e015['CloudProviderId']=_0x19afb9[_0x6682('0x3a')]=null;}_0x19e015['host']=getImapHost(_0x16be04);_0x19e015[_0x6682('0x3c')]=0x3e1;_0x19afb9['host']=getSmtpHost(_0x16be04);_0x19afb9[_0x6682('0x3c')]=0x24b;_0x19afb9[_0x6682('0x3d')]=![];_0x19e015['service']=_0x19afb9[_0x6682('0x3e')]=null;}else{if(_0x39c188['authentication']){_0x19e015[_0x6682('0x37')]=_0x19afb9[_0x6682('0x37')]=_0x39c188['username'];_0x19e015['password']=_0x19afb9['pass']=_0x39c188['password'];}else{_0x19e015[_0x6682('0x3f')]=_0x19afb9['authentication']=![];_0x19e015['user']=_0x19afb9[_0x6682('0x37')]=null;_0x19e015[_0x6682('0x38')]=_0x19afb9[_0x6682('0x3b')]=null;}_0x19e015[_0x6682('0x40')]=_0x39c188[_0x6682('0x41')][_0x6682('0x40')];_0x19e015[_0x6682('0x3c')]=_0x39c188[_0x6682('0x41')][_0x6682('0x3c')];_0x19afb9['host']=_0x39c188[_0x6682('0x42')][_0x6682('0x40')];_0x19afb9[_0x6682('0x3c')]=_0x39c188[_0x6682('0x42')]['port'];}return{'Imap':_0x19e015,'Smtp':_0x19afb9};}exports[_0x6682('0x43')]=function(_0x4088cb,_0xc218b8){var _0x557966={'include':[{'model':db[_0x6682('0x44')],'as':_0x6682('0x41')},{'model':db[_0x6682('0x45')],'as':'Smtp'},{'model':db[_0x6682('0x46')],'as':_0x6682('0x47')}]},_0x30f2aa={},_0x5ed81b={'count':0x0,'rows':[]};var _0x7f3c02=_['map'](db[_0x6682('0x48')][_0x6682('0x49')],function(_0xf1a36a){return{'name':_0xf1a36a[_0x6682('0x4a')],'type':_0xf1a36a['type'][_0x6682('0x4b')]};});_0x30f2aa['model']=_[_0x6682('0x4c')](_0x7f3c02,'name');_0x30f2aa[_0x6682('0x4d')]=_[_0x6682('0x4e')](_0x4088cb[_0x6682('0x4d')]);_0x30f2aa[_0x6682('0x4f')]=_['intersection'](_0x30f2aa['model'],_0x30f2aa['query']);_0x557966[_0x6682('0x50')]=_[_0x6682('0x51')](_0x30f2aa['model'],qs[_0x6682('0x52')](_0x4088cb['query'][_0x6682('0x52')]));_0x557966[_0x6682('0x50')]=_0x557966[_0x6682('0x50')][_0x6682('0x53')]?_0x557966[_0x6682('0x50')]:_0x30f2aa[_0x6682('0x54')];if(!_0x4088cb[_0x6682('0x4d')]['hasOwnProperty']('nolimit')){_0x557966[_0x6682('0x22')]=qs[_0x6682('0x22')](_0x4088cb[_0x6682('0x4d')][_0x6682('0x22')]);_0x557966[_0x6682('0x20')]=qs[_0x6682('0x20')](_0x4088cb['query'][_0x6682('0x20')]);}_0x557966[_0x6682('0x55')]=qs[_0x6682('0x56')](_0x4088cb['query'][_0x6682('0x56')]);_0x557966[_0x6682('0x57')]=qs[_0x6682('0x4f')](_['pick'](_0x4088cb[_0x6682('0x4d')],_0x30f2aa[_0x6682('0x4f')]),_0x7f3c02);if(_0x4088cb[_0x6682('0x4d')][_0x6682('0x58')]){_0x557966[_0x6682('0x57')]=_[_0x6682('0x59')](_0x557966[_0x6682('0x57')],{'$or':_['map'](_0x7f3c02,function(_0x4cbec7){if(_0x4cbec7[_0x6682('0x5a')]!==_0x6682('0x5b')){var _0x236a7e={};_0x236a7e[_0x4cbec7[_0x6682('0x2a')]]={'$like':'%'+_0x4088cb[_0x6682('0x4d')][_0x6682('0x58')]+'%'};return _0x236a7e;}})});}_0x557966=_[_0x6682('0x59')]({},_0x557966,_0x4088cb['options']);var _0xe3ece4={'where':_0x557966['where']};return db[_0x6682('0x48')][_0x6682('0x23')](_0xe3ece4)[_0x6682('0x11')](function(_0x34e698){_0x5ed81b[_0x6682('0x23')]=_0x34e698;if(_0x4088cb[_0x6682('0x4d')][_0x6682('0x5c')]){_0x557966['include']=[{'all':!![]}];}return db[_0x6682('0x48')][_0x6682('0x5d')](_0x557966);})[_0x6682('0x11')](function(_0x266e2f){_0x5ed81b[_0x6682('0x5e')]=_0x266e2f;return _0x5ed81b;})[_0x6682('0x11')](respondWithFilteredResult(_0xc218b8,_0x557966))[_0x6682('0x1c')](handleError(_0xc218b8,null));};exports[_0x6682('0x5f')]=function(_0x75ca37,_0x331822){var _0x5aac46={'raw':![],'where':{'id':_0x75ca37[_0x6682('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x6682('0x41')},{'model':db['MailServerOut'],'as':_0x6682('0x42')},{'model':db[_0x6682('0x46')],'as':_0x6682('0x47')}]},_0x2e9579={};_0x2e9579['model']=_[_0x6682('0x4e')](db['MailAccount'][_0x6682('0x49')]);_0x2e9579[_0x6682('0x4d')]=_[_0x6682('0x4e')](_0x75ca37['query']);_0x2e9579[_0x6682('0x4f')]=_['intersection'](_0x2e9579['model'],_0x2e9579['query']);_0x5aac46['attributes']=_['intersection'](_0x2e9579[_0x6682('0x54')],qs['fields'](_0x75ca37[_0x6682('0x4d')][_0x6682('0x52')]));_0x5aac46['attributes']=_0x5aac46[_0x6682('0x50')][_0x6682('0x53')]?_0x5aac46[_0x6682('0x50')]:_0x2e9579[_0x6682('0x54')];if(_0x75ca37[_0x6682('0x4d')]['includeAll']){_0x5aac46['include']=[{'all':!![]}];}_0x5aac46=_[_0x6682('0x59')]({},_0x5aac46,_0x75ca37[_0x6682('0x61')]);return db[_0x6682('0x48')]['find'](_0x5aac46)[_0x6682('0x11')](handleEntityNotFound(_0x331822,null))['then'](respondWithResult(_0x331822,null))['catch'](handleError(_0x331822,null));};exports[_0x6682('0x26')]=function(_0x560e84,_0x567b7b){if(_0x560e84[_0x6682('0x62')]['id']){delete _0x560e84['body']['id'];}var _0x38ec6c=_0x560e84[_0x6682('0x62')][_0x6682('0x63')]===_0x6682('0x64')?null:_0x560e84['body'][_0x6682('0x63')];var _0xee2bef=_0x560e84[_0x6682('0x62')]['Imap']||{};var _0x66ac1d=_0x560e84[_0x6682('0x62')][_0x6682('0x42')]||{};if(_0x38ec6c){_0xee2bef['host']=getImapHost(_0x38ec6c);_0xee2bef[_0x6682('0x3c')]=0x3e1;_0x66ac1d['host']=getSmtpHost(_0x38ec6c);_0x66ac1d['port']=0x24b;_0x66ac1d[_0x6682('0x3d')]=![];}if(_0x66ac1d[_0x6682('0x39')]){_0x66ac1d['secure']=![];}else{_0x66ac1d[_0x6682('0x3a')]=null;}if(!_0xee2bef[_0x6682('0x39')])_0xee2bef[_0x6682('0x3a')]=null;_0x560e84[_0x6682('0x62')][_0x6682('0x41')]=_0xee2bef;_0x560e84['body'][_0x6682('0x42')]=_0x66ac1d;return db[_0x6682('0x48')]['find']({'where':{'id':_0x560e84[_0x6682('0x60')]['id']},'include':[{'model':db[_0x6682('0x44')],'as':_0x6682('0x41')},{'model':db[_0x6682('0x45')],'as':_0x6682('0x42')},{'model':db[_0x6682('0x46')],'as':_0x6682('0x47')}]})[_0x6682('0x11')](handleEntityNotFound(_0x567b7b,null))[_0x6682('0x11')](function(_0x54c54b){if(!_0x54c54b)throw new Error('Mail\x20Account\x20not\x20found');if(_0x54c54b['service'])delete _0x560e84[_0x6682('0x62')][_0x6682('0x41')];return _0x54c54b;})[_0x6682('0x11')](saveUpdates(_0x560e84['body'],null))[_0x6682('0x11')](function(_0x3839d7){if(!_0x560e84[_0x6682('0x62')][_0x6682('0x41')])return _0x3839d7;return db[_0x6682('0x44')]['update'](_0x560e84['body']['Imap'],{'where':{'MailAccountId':_0x3839d7['id']}})['then'](function(){return _0x3839d7;});})[_0x6682('0x11')](function(_0x5393ea){if(!_0x560e84[_0x6682('0x62')][_0x6682('0x42')])return _0x5393ea;return db['MailServerOut']['update'](_0x560e84['body']['Smtp'],{'where':{'MailAccountId':_0x5393ea['id']}})[_0x6682('0x11')](function(){return _0x5393ea;});})[_0x6682('0x11')](respondWithResult(_0x567b7b,null))['catch'](handleError(_0x567b7b,null));};exports[_0x6682('0x65')]=function(_0x3073f3,_0x13c83a){return db[_0x6682('0x48')]['describe']()[_0x6682('0x11')](respondWithResult(_0x13c83a,null))[_0x6682('0x1c')](handleError(_0x13c83a,null));};exports['addDisposition']=function(_0x39aebb,_0x3d444d){if(_0x39aebb[_0x6682('0x62')]['id']){delete _0x39aebb[_0x6682('0x62')]['id'];}return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x39aebb[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x3d444d,null))[_0x6682('0x11')](function(_0x4ce7a){if(_0x4ce7a){_0x39aebb['body']['MailAccountId']=_0x4ce7a['id'];return db[_0x6682('0x67')]['create'](_0x39aebb['body']);}})[_0x6682('0x11')](respondWithResult(_0x3d444d,null))['catch'](handleError(_0x3d444d,null));};exports[_0x6682('0x68')]=function(_0x308ed6,_0x44752b){var _0x1d94e7={'raw':![],'where':{}};var _0x543774={};var _0x48cfed={'count':0x0,'rows':[]};return db[_0x6682('0x48')][_0x6682('0x69')]({'where':{'id':_0x308ed6['params']['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x44752b,null))['then'](function(_0x2fa01f){if(_0x2fa01f){_0x543774[_0x6682('0x54')]=_[_0x6682('0x4e')](db['Disposition'][_0x6682('0x49')]);_0x543774['query']=_[_0x6682('0x4e')](_0x308ed6[_0x6682('0x4d')]);_0x543774[_0x6682('0x4f')]=_[_0x6682('0x51')](_0x543774[_0x6682('0x54')],_0x543774[_0x6682('0x4d')]);_0x1d94e7[_0x6682('0x50')]=_['intersection'](_0x543774[_0x6682('0x54')],qs[_0x6682('0x52')](_0x308ed6[_0x6682('0x4d')][_0x6682('0x52')]));_0x1d94e7[_0x6682('0x50')]=_0x1d94e7['attributes'][_0x6682('0x53')]?_0x1d94e7[_0x6682('0x50')]:_0x543774['model'];if(!_0x308ed6['query'][_0x6682('0x6a')](_0x6682('0x6b'))){_0x1d94e7['limit']=qs['limit'](_0x308ed6['query'][_0x6682('0x22')]);_0x1d94e7['offset']=qs[_0x6682('0x20')](_0x308ed6[_0x6682('0x4d')][_0x6682('0x20')]);}_0x1d94e7[_0x6682('0x55')]=qs[_0x6682('0x56')](_0x308ed6[_0x6682('0x4d')]['sort']);_0x1d94e7[_0x6682('0x57')]=qs[_0x6682('0x4f')](_['pick'](_0x308ed6[_0x6682('0x4d')],_0x543774['filters']));_0x1d94e7[_0x6682('0x57')][_0x6682('0x6c')]=_0x2fa01f['id'];if(_0x308ed6[_0x6682('0x4d')][_0x6682('0x58')]){_0x1d94e7[_0x6682('0x57')]=_['merge'](_0x1d94e7['where'],{'$or':_[_0x6682('0x4c')](_0x1d94e7[_0x6682('0x50')],function(_0x4e214f){var _0x140b58={};_0x140b58[_0x4e214f]={'$like':'%'+_0x308ed6[_0x6682('0x4d')][_0x6682('0x58')]+'%'};return _0x140b58;})});}_0x1d94e7=_['merge']({},_0x1d94e7,_0x308ed6[_0x6682('0x61')]);return db[_0x6682('0x67')][_0x6682('0x23')]({'where':_0x1d94e7[_0x6682('0x57')]})[_0x6682('0x11')](function(_0x21737c){_0x48cfed[_0x6682('0x23')]=_0x21737c;if(_0x308ed6[_0x6682('0x4d')][_0x6682('0x5c')]){_0x1d94e7['include']=[{'all':!![]}];}return db[_0x6682('0x67')][_0x6682('0x5d')](_0x1d94e7);})['then'](function(_0x5d05fc){_0x48cfed[_0x6682('0x5e')]=_0x5d05fc;return _0x48cfed;});}})['then'](respondWithFilteredResult(_0x44752b,_0x1d94e7))['catch'](handleError(_0x44752b,null));};exports[_0x6682('0x6d')]=function(_0x2a427d,_0x1ce4fc){return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x2a427d['params']['id']}})['then'](handleEntityNotFound(_0x1ce4fc,null))[_0x6682('0x11')](function(_0x45f566){if(_0x45f566){return _0x45f566[_0x6682('0x6d')](_0x2a427d[_0x6682('0x4d')][_0x6682('0x6e')]);}})['then'](respondWithStatusCode(_0x1ce4fc,null))['catch'](handleError(_0x1ce4fc,null));};exports[_0x6682('0x6f')]=function(_0xecdbe4,_0x43622f){if(_0xecdbe4['body']['id']){delete _0xecdbe4[_0x6682('0x62')]['id'];}return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0xecdbe4['params']['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x43622f,null))[_0x6682('0x11')](function(_0x3fcbf7){if(_0x3fcbf7){_0xecdbe4[_0x6682('0x62')]['MailAccountId']=_0x3fcbf7['id'];return db[_0x6682('0x70')][_0x6682('0x71')](_0xecdbe4[_0x6682('0x62')]);}})['then'](respondWithResult(_0x43622f,null))[_0x6682('0x1c')](handleError(_0x43622f,null));};exports['getAnswers']=function(_0x21a544,_0x4f609f){var _0x47694d={'raw':![],'where':{}};var _0x5d540a={};var _0x150074={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x21a544[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x4f609f,null))[_0x6682('0x11')](function(_0xc09433){if(_0xc09433){_0x5d540a[_0x6682('0x54')]=_[_0x6682('0x4e')](db[_0x6682('0x70')]['rawAttributes']);_0x5d540a['query']=_['keys'](_0x21a544[_0x6682('0x4d')]);_0x5d540a[_0x6682('0x4f')]=_['intersection'](_0x5d540a[_0x6682('0x54')],_0x5d540a[_0x6682('0x4d')]);_0x47694d[_0x6682('0x50')]=_['intersection'](_0x5d540a['model'],qs['fields'](_0x21a544[_0x6682('0x4d')][_0x6682('0x52')]));_0x47694d[_0x6682('0x50')]=_0x47694d['attributes'][_0x6682('0x53')]?_0x47694d[_0x6682('0x50')]:_0x5d540a[_0x6682('0x54')];if(!_0x21a544[_0x6682('0x4d')][_0x6682('0x6a')]('nolimit')){_0x47694d[_0x6682('0x22')]=qs[_0x6682('0x22')](_0x21a544[_0x6682('0x4d')][_0x6682('0x22')]);_0x47694d[_0x6682('0x20')]=qs[_0x6682('0x20')](_0x21a544[_0x6682('0x4d')][_0x6682('0x20')]);}_0x47694d[_0x6682('0x55')]=qs['sort'](_0x21a544[_0x6682('0x4d')][_0x6682('0x56')]);_0x47694d[_0x6682('0x57')]=qs[_0x6682('0x4f')](_[_0x6682('0x72')](_0x21a544[_0x6682('0x4d')],_0x5d540a[_0x6682('0x4f')]));_0x47694d['where']['MailAccountId']=_0xc09433['id'];if(_0x21a544[_0x6682('0x4d')][_0x6682('0x58')]){_0x47694d[_0x6682('0x57')]=_['merge'](_0x47694d[_0x6682('0x57')],{'$or':_['map'](_0x47694d['attributes'],function(_0x55342e){var _0x35828e={};_0x35828e[_0x55342e]={'$like':'%'+_0x21a544['query'][_0x6682('0x58')]+'%'};return _0x35828e;})});}_0x47694d=_[_0x6682('0x59')]({},_0x47694d,_0x21a544['options']);return db[_0x6682('0x70')][_0x6682('0x23')]({'where':_0x47694d[_0x6682('0x57')]})[_0x6682('0x11')](function(_0x22bdd3){_0x150074[_0x6682('0x23')]=_0x22bdd3;if(_0x21a544[_0x6682('0x4d')][_0x6682('0x5c')]){_0x47694d[_0x6682('0x73')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6682('0x5d')](_0x47694d);})['then'](function(_0x4ebc6f){_0x150074['rows']=_0x4ebc6f;return _0x150074;});}})['then'](respondWithFilteredResult(_0x4f609f,_0x47694d))[_0x6682('0x1c')](handleError(_0x4f609f,null));};exports[_0x6682('0x74')]=function(_0x372a3b,_0x34b30b){return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x372a3b[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x34b30b,null))[_0x6682('0x11')](function(_0x5d093a){if(_0x5d093a){return _0x5d093a[_0x6682('0x74')](_0x372a3b[_0x6682('0x4d')]['ids']);}})[_0x6682('0x11')](respondWithStatusCode(_0x34b30b,null))[_0x6682('0x1c')](handleError(_0x34b30b,null));};exports[_0x6682('0x71')]=function(_0x59c211,_0x30d554){var _0xd67f0a={'name':_0x59c211[_0x6682('0x62')][_0x6682('0x2a')],'key':_0x59c211[_0x6682('0x62')][_0x6682('0x4b')],'provider':_0x59c211[_0x6682('0x62')][_0x6682('0x63')]===_0x6682('0x64')?null:_0x59c211['body']['provider'],'email':_0x59c211[_0x6682('0x62')]['email'],'ListId':_0x59c211[_0x6682('0x62')]['ListId'],'active':!_[_0x6682('0x75')](_0x59c211[_0x6682('0x62')][_0x6682('0x76')])?_0x59c211[_0x6682('0x62')]['active']:!![],'description':_0x59c211['body'][_0x6682('0x77')]||null};var _0x4fda0f=getAuthenticationOptions(_0xd67f0a[_0x6682('0x63')],_0x59c211[_0x6682('0x62')]);_0xd67f0a['Imap']=_0x4fda0f[_0x6682('0x41')];_0xd67f0a[_0x6682('0x42')]=_0x4fda0f['Smtp'];return db[_0x6682('0x48')][_0x6682('0x71')](_0xd67f0a,{'include':[{'model':db[_0x6682('0x45')],'as':'Smtp'},{'model':db[_0x6682('0x44')],'as':_0x6682('0x41')}]})[_0x6682('0x11')](function(_0x403548){var _0x2c3489=_0x59c211[_0x6682('0x37')][_0x6682('0x27')]({'plain':!![]});if(!_0x2c3489)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c3489['role']===_0x6682('0x37')){var _0x55b579=_0x403548[_0x6682('0x27')]({'plain':!![]});return db[_0x6682('0x78')][_0x6682('0x66')]({'where':{'name':_0x6682('0x79'),'userProfileId':_0x2c3489['userProfileId']},'raw':!![]})[_0x6682('0x11')](function(_0x298cdd){if(_0x298cdd&&_0x298cdd[_0x6682('0x7a')]===0x0){return db['UserProfileResource']['create']({'name':_0x55b579[_0x6682('0x2a')],'resourceId':_0x55b579['id'],'type':_0x298cdd[_0x6682('0x2a')],'sectionId':_0x298cdd['id']},{})[_0x6682('0x11')](function(){return _0x403548;});}else{return _0x403548;}})[_0x6682('0x1c')](function(_0x33cfe4){logger['error'](_0x6682('0x7b'),_0x33cfe4);throw _0x33cfe4;});}return _0x403548;})[_0x6682('0x11')](respondWithResult(_0x30d554,0xc9))['catch'](handleError(_0x30d554,null));};exports[_0x6682('0x7c')]=function(_0x55928c,_0x4c67a6){return db[_0x6682('0x48')][_0x6682('0x69')]({'where':{'id':_0x55928c[_0x6682('0x60')]['id']}})['then'](handleEntityNotFound(_0x4c67a6,null))[_0x6682('0x11')](function(_0x32939c){if(_0x32939c){return _0x32939c[_0x6682('0x7c')]();}return null;})[_0x6682('0x11')](respondWithResult(_0x4c67a6,null))[_0x6682('0x1c')](handleError(_0x4c67a6,null));};exports[_0x6682('0x7d')]=function(_0xebaa89,_0x5b4caf){if(_0xebaa89[_0x6682('0x62')]['id']){delete _0xebaa89[_0x6682('0x62')]['id'];}return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0xebaa89[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x5b4caf,null))[_0x6682('0x11')](function(_0x511be9){if(_0x511be9){_0xebaa89[_0x6682('0x62')][_0x6682('0x6c')]=_0x511be9['id'];return db[_0x6682('0x44')][_0x6682('0x71')](_0xebaa89[_0x6682('0x62')]);}})['then'](respondWithResult(_0x5b4caf,null))[_0x6682('0x1c')](handleError(_0x5b4caf,null));};exports['removeImap']=function(_0x239359,_0x4a5667){return db['MailAccount'][_0x6682('0x69')]({'where':{'id':_0x239359[_0x6682('0x60')]['id']}})['then'](handleEntityNotFound(_0x4a5667,null))[_0x6682('0x11')](function(_0x30b5a0){if(_0x30b5a0){return _0x30b5a0['setImap'](null);}return null;})[_0x6682('0x11')](respondWithStatusCode(_0x4a5667,null))[_0x6682('0x1c')](handleError(_0x4a5667,null));};exports[_0x6682('0x7e')]=function(_0x4e0f0e,_0x2bbfb5){return db[_0x6682('0x48')]['findOne']({'where':{'id':_0x4e0f0e[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x2bbfb5,null))['then'](function(_0x21ab20){if(_0x21ab20){return _0x21ab20[_0x6682('0x7e')]();}return null;})[_0x6682('0x11')](respondWithResult(_0x2bbfb5,null))['catch'](handleError(_0x2bbfb5,null));};exports[_0x6682('0x7f')]=function(_0x350885,_0x169940){if(_0x350885['body']['id']){delete _0x350885[_0x6682('0x62')]['id'];}return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x350885[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x169940,null))[_0x6682('0x11')](function(_0x18cd3b){if(_0x18cd3b){_0x350885[_0x6682('0x62')][_0x6682('0x6c')]=_0x18cd3b['id'];return db['MailServerOut'][_0x6682('0x71')](_0x350885[_0x6682('0x62')]);}})['then'](respondWithResult(_0x169940,null))[_0x6682('0x1c')](handleError(_0x169940,null));};exports[_0x6682('0x80')]=function(_0x3f8f52,_0x1425c4){return db['MailAccount'][_0x6682('0x69')]({'where':{'id':_0x3f8f52[_0x6682('0x60')]['id']}})['then'](handleEntityNotFound(_0x1425c4,null))[_0x6682('0x11')](function(_0x102f01){if(_0x102f01){return _0x102f01['setSmtp'](null);}return null;})[_0x6682('0x11')](respondWithStatusCode(_0x1425c4,null))[_0x6682('0x1c')](handleError(_0x1425c4,null));};exports[_0x6682('0x81')]=function(_0xcddb57,_0x2df4f1){return db[_0x6682('0x82')][_0x6682('0x66')]({'where':{'id':_0xcddb57['params']['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x2df4f1,null))[_0x6682('0x11')](function(_0x3a3264){if(_0x3a3264){return _0x3a3264[_0x6682('0x81')](_0xcddb57['body'][_0x6682('0x6e')],_[_0x6682('0x83')](_0xcddb57['body'],[_0x6682('0x6e'),'id'])||{});}})[_0x6682('0x11')](respondWithResult(_0x2df4f1,null))[_0x6682('0x1c')](handleError(_0x2df4f1,null));};exports[_0x6682('0x84')]=function(_0x12d36c,_0x59e9c2){var _0x310846={'raw':![],'where':{}};var _0x202dec={};var _0x1cc647={'count':0x0,'rows':[]};return db[_0x6682('0x48')]['findOne']({'where':{'id':_0x12d36c[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x59e9c2,null))[_0x6682('0x11')](function(_0x3d5914){if(_0x3d5914){_0x202dec[_0x6682('0x54')]=_['keys'](db['MailInteraction'][_0x6682('0x49')]);_0x202dec[_0x6682('0x4d')]=_[_0x6682('0x4e')](_0x12d36c[_0x6682('0x4d')]);_0x202dec['filters']=_[_0x6682('0x51')](_0x202dec[_0x6682('0x54')],_0x202dec['query']);_0x310846[_0x6682('0x50')]=_[_0x6682('0x51')](_0x202dec[_0x6682('0x54')],qs['fields'](_0x12d36c[_0x6682('0x4d')][_0x6682('0x52')]));_0x310846[_0x6682('0x50')]=_0x310846[_0x6682('0x50')][_0x6682('0x53')]?_0x310846['attributes']:_0x202dec[_0x6682('0x54')];if(!_0x12d36c[_0x6682('0x4d')][_0x6682('0x6a')](_0x6682('0x6b'))){_0x310846[_0x6682('0x22')]=qs[_0x6682('0x22')](_0x12d36c[_0x6682('0x4d')][_0x6682('0x22')]);_0x310846[_0x6682('0x20')]=qs['offset'](_0x12d36c['query'][_0x6682('0x20')]);}_0x310846[_0x6682('0x55')]=qs[_0x6682('0x56')](_0x12d36c['query'][_0x6682('0x56')]);_0x310846['where']=qs[_0x6682('0x4f')](_['pick'](_0x12d36c['query'],_0x202dec[_0x6682('0x4f')]));_0x310846[_0x6682('0x57')][_0x6682('0x6c')]=_0x3d5914['id'];if(_0x12d36c[_0x6682('0x4d')][_0x6682('0x58')]){_0x310846[_0x6682('0x57')]=_[_0x6682('0x59')](_0x310846[_0x6682('0x57')],{'$or':_[_0x6682('0x4c')](_0x310846[_0x6682('0x50')],function(_0x5162bb){var _0x3cdc4c={};_0x3cdc4c[_0x5162bb]={'$like':'%'+_0x12d36c[_0x6682('0x4d')][_0x6682('0x58')]+'%'};return _0x3cdc4c;})});}_0x310846=_[_0x6682('0x59')]({},_0x310846,_0x12d36c[_0x6682('0x61')]);return db['MailInteraction'][_0x6682('0x23')]({'where':_0x310846[_0x6682('0x57')]})[_0x6682('0x11')](function(_0x579cdc){_0x1cc647[_0x6682('0x23')]=_0x579cdc;if(_0x12d36c[_0x6682('0x4d')][_0x6682('0x5c')]){_0x310846[_0x6682('0x73')]=[{'model':db[_0x6682('0x85')],'as':_0x6682('0x86'),'required':![]},{'model':db[_0x6682('0x87')],'as':_0x6682('0x88'),'attributes':[_0x6682('0x2a'),_0x6682('0x89'),_0x6682('0x8a')],'required':![]},{'model':db[_0x6682('0x8b')],'as':'Tags','attributes':['id',_0x6682('0x2a'),_0x6682('0x8c')],'where':_0x12d36c[_0x6682('0x4d')]['tag']?{'id':_0x12d36c[_0x6682('0x4d')]['tag']}:undefined,'required':_0x12d36c['query'][_0x6682('0x8d')]?!![]:![]}];}return db['MailInteraction'][_0x6682('0x5d')](_0x310846);})[_0x6682('0x11')](function(_0x338da4){_0x1cc647[_0x6682('0x5e')]=_0x338da4;return _0x1cc647;});}})[_0x6682('0x11')](respondWithFilteredResult(_0x59e9c2,_0x310846))[_0x6682('0x1c')](handleError(_0x59e9c2,null));};exports[_0x6682('0x8e')]=function addApplications(_0x51a4b9,_0x5a3b76){var _0x206a12=_0x51a4b9['params']['id'];var _0x46568e=_0x51a4b9['body'];var _0x422711=0xc8;var _0x5f5811=null;return db[_0x6682('0x8f')][_0x6682('0x90')]({'isolationLevel':db[_0x6682('0x8f')][_0x6682('0x91')][_0x6682('0x92')][_0x6682('0x93')]},function(_0x460a37){return db[_0x6682('0x48')]['findOne']({'where':{'id':_0x206a12},'transaction':_0x460a37})[_0x6682('0x11')](function(_0xc6117b){if(_0xc6117b){return db[_0x6682('0x94')][_0x6682('0x28')]({'where':{'MailAccountId':_0x206a12},'transaction':_0x460a37})[_0x6682('0x11')](function(){var _0x54df20=_[_0x6682('0x4c')](_0x46568e,function(_0x25f2d2){_0x25f2d2[_0x6682('0x6c')]=_0x206a12;return _0x25f2d2;});return db[_0x6682('0x94')][_0x6682('0x95')](_0x54df20,{'transaction':_0x460a37});});}else{_0x422711=0x194;_0x5f5811=[];}});})[_0x6682('0x11')](function(){if(_0x422711!==0x194){return db[_0x6682('0x94')]['findAndCountAll']({'where':{'MailAccountId':_0x206a12},'order':_0x6682('0x96')})[_0x6682('0x11')](function(_0x3b4970){_0x5f5811=_0x3b4970;});}})['catch'](function(_0xa78f7d){_0x422711=0x1f4;logger[_0x6682('0x18')](_0xa78f7d[_0x6682('0x97')]);if(_0xa78f7d[_0x6682('0x2a')]){delete _0xa78f7d[_0x6682('0x2a')];}_0x5f5811=_0xa78f7d;})[_0x6682('0x98')](function(){if(_0x5f5811===null){_0x5a3b76[_0x6682('0x29')](_0x422711);}else{if(_0x422711===0x1f4){_0x5a3b76['status'](_0x422711)[_0x6682('0x2b')](_0x5f5811);}else{_0x5a3b76[_0x6682('0x1d')](_0x422711)[_0x6682('0x1f')](_0x5f5811);}}});};exports[_0x6682('0x99')]=function(_0x226d1c,_0xce4a00){var _0x43fbfe={};var _0x1dc397={};var _0x2ae39a;var _0x119c38;return db['MailAccount'][_0x6682('0x69')]({'where':{'id':_0x226d1c[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0xce4a00,null))[_0x6682('0x11')](function(_0x594f73){if(_0x594f73){_0x2ae39a=_0x594f73;_0x1dc397[_0x6682('0x54')]=_[_0x6682('0x4e')](db['MailApplication']['rawAttributes']);_0x1dc397[_0x6682('0x4d')]=_['keys'](_0x226d1c['query']);_0x1dc397[_0x6682('0x4f')]=_[_0x6682('0x51')](_0x1dc397[_0x6682('0x54')],_0x1dc397[_0x6682('0x4d')]);_0x43fbfe[_0x6682('0x50')]=_[_0x6682('0x51')](_0x1dc397[_0x6682('0x54')],qs['fields'](_0x226d1c['query'][_0x6682('0x52')]));_0x43fbfe[_0x6682('0x50')]=_0x43fbfe[_0x6682('0x50')][_0x6682('0x53')]?_0x43fbfe[_0x6682('0x50')]:_0x1dc397[_0x6682('0x54')];_0x43fbfe[_0x6682('0x55')]=qs[_0x6682('0x56')](_0x226d1c[_0x6682('0x4d')][_0x6682('0x56')]);_0x43fbfe[_0x6682('0x57')]=qs['filters'](_[_0x6682('0x72')](_0x226d1c[_0x6682('0x4d')],_0x1dc397['filters']));if(_0x226d1c[_0x6682('0x4d')][_0x6682('0x58')]){_0x43fbfe[_0x6682('0x57')]=_[_0x6682('0x59')](_0x43fbfe[_0x6682('0x57')],{'$or':_['map'](_0x43fbfe[_0x6682('0x50')],function(_0x3cefaf){var _0x146c65={};_0x146c65[_0x3cefaf]={'$like':'%'+_0x226d1c[_0x6682('0x4d')][_0x6682('0x58')]+'%'};return _0x146c65;})});}_0x43fbfe=_['merge']({},_0x43fbfe,_0x226d1c[_0x6682('0x61')]);return _0x2ae39a[_0x6682('0x99')](_0x43fbfe);}})[_0x6682('0x11')](function(_0x941caf){if(_0x941caf){_0x119c38=_0x941caf['length'];if(!_0x226d1c[_0x6682('0x4d')]['hasOwnProperty'](_0x6682('0x6b'))){_0x43fbfe[_0x6682('0x22')]=qs[_0x6682('0x22')](_0x226d1c[_0x6682('0x4d')][_0x6682('0x22')]);_0x43fbfe[_0x6682('0x20')]=qs[_0x6682('0x20')](_0x226d1c[_0x6682('0x4d')][_0x6682('0x20')]);}return _0x2ae39a[_0x6682('0x99')](_0x43fbfe);}})[_0x6682('0x11')](function(_0x36bb50){if(_0x36bb50){return _0x36bb50?{'count':_0x119c38,'rows':_0x36bb50}:null;}})['then'](respondWithResult(_0xce4a00,null))[_0x6682('0x1c')](handleError(_0xce4a00,null));};exports[_0x6682('0x9a')]=function(_0x1140dc,_0x1290c0){var _0x5b4127={'raw':!![],'where':{}};var _0x1b0772={};var _0x59f087={'count':0x0,'rows':[]};return db['MailAccount'][_0x6682('0x69')]({'where':{'id':_0x1140dc[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x1290c0,null))['then'](function(_0x3feae8){if(_0x3feae8){_0x1b0772['model']=_[_0x6682('0x4e')](db[_0x6682('0x9b')][_0x6682('0x49')]);_0x1b0772['query']=_[_0x6682('0x4e')](_0x1140dc['query']);_0x1b0772[_0x6682('0x4f')]=_[_0x6682('0x51')](_0x1b0772['model'],_0x1b0772[_0x6682('0x4d')]);_0x5b4127['attributes']=_[_0x6682('0x51')](_0x1b0772['model'],qs[_0x6682('0x52')](_0x1140dc[_0x6682('0x4d')]['fields']));_0x5b4127[_0x6682('0x50')]=_0x5b4127[_0x6682('0x50')][_0x6682('0x53')]?_0x5b4127['attributes']:_0x1b0772['model'];if(!_0x1140dc['query'][_0x6682('0x6a')](_0x6682('0x6b'))){_0x5b4127[_0x6682('0x22')]=qs['limit'](_0x1140dc['query'][_0x6682('0x22')]);_0x5b4127['offset']=qs[_0x6682('0x20')](_0x1140dc[_0x6682('0x4d')][_0x6682('0x20')]);}_0x5b4127[_0x6682('0x55')]=qs[_0x6682('0x56')](_0x1140dc[_0x6682('0x4d')][_0x6682('0x56')]);_0x5b4127['where']=qs[_0x6682('0x4f')](_[_0x6682('0x72')](_0x1140dc[_0x6682('0x4d')],_0x1b0772['filters']));_0x5b4127[_0x6682('0x57')][_0x6682('0x6c')]=_0x3feae8['id'];if(_0x1140dc[_0x6682('0x4d')]['filter']){_0x5b4127[_0x6682('0x57')]=_[_0x6682('0x59')](_0x5b4127['where'],{'$or':_[_0x6682('0x4c')](_0x5b4127['attributes'],function(_0x146271){var _0x413175={};_0x413175[_0x146271]={'$like':'%'+_0x1140dc[_0x6682('0x4d')][_0x6682('0x58')]+'%'};return _0x413175;})});}if(_0x1140dc[_0x6682('0x4d')][_0x6682('0x9c')]){var _0x256979=_0x1140dc[_0x6682('0x4d')][_0x6682('0x9c')][_0x6682('0x9d')](',');var _0x2dce45={};_0x2dce45[_0x256979[0x0]]={'$gte':moment(_0x256979[0x1])['format'](_0x6682('0x9e'))};_0x5b4127[_0x6682('0x57')]=_['merge'](_0x5b4127['where'],_0x2dce45);}_0x5b4127=_['merge']({},_0x5b4127,_0x1140dc['options']);return db['MailMessage']['count']({'where':_0x5b4127[_0x6682('0x57')]})[_0x6682('0x11')](function(_0x3871c5){_0x59f087['count']=_0x3871c5;if(_0x1140dc[_0x6682('0x4d')]['includeAll']){_0x5b4127[_0x6682('0x73')]=[{'all':!![]}];}return db[_0x6682('0x9b')][_0x6682('0x5d')](_0x5b4127);})['then'](function(_0x25aa3f){if(_0x1140dc[_0x6682('0x4d')]['inlineCss']===_0x6682('0x9f')){for(var _0x4b2783=0x0;_0x4b2783<_0x25aa3f[_0x6682('0x53')];_0x4b2783++){_0x25aa3f[_0x4b2783][_0x6682('0x62')]=juice(_0x25aa3f[_0x4b2783][_0x6682('0x62')]);}}_0x59f087[_0x6682('0x5e')]=_0x25aa3f;return _0x59f087;});}})['then'](respondWithFilteredResult(_0x1290c0,_0x5b4127))[_0x6682('0x1c')](handleError(_0x1290c0,null));};exports[_0x6682('0x2b')]=function(_0x1bfd8d,_0x5e017a){var _0x2d0831,_0x492b2e={},_0x4e0f33;if(_0x1bfd8d[_0x6682('0x62')]['to']){_0x4e0f33=_0x1bfd8d[_0x6682('0x62')]['to'][_0x6682('0x9d')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x1bfd8d['params']['id']},'include':[{'model':db[_0x6682('0xa0')],'as':'List','include':[{'model':db[_0x6682('0x85')],'as':_0x6682('0xa1'),'where':{'email':_0x4e0f33},'limit':0x1,'order':[[_0x6682('0xa2'),_0x6682('0xa3')]]}]},{'model':db[_0x6682('0x45')],'as':_0x6682('0x42'),'raw':!![],'include':[{'model':db[_0x6682('0xa4')],'as':_0x6682('0xa4'),'raw':!![]}]}]})[_0x6682('0x11')](handleEntityNotFound(_0x5e017a,null))[_0x6682('0x11')](function(_0x5abf23){if(!_0x5abf23)return;_0x2d0831=_0x5abf23;if(!_0x5abf23[_0x6682('0x42')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x6682('0x75')](_0x1bfd8d[_0x6682('0x62')][_0x6682('0xa5')])){_0x1bfd8d['body'][_0x6682('0xa5')]=util[_0x6682('0xa6')](_0x6682('0xa7'),_0x5abf23[_0x6682('0x2a')],_0x5abf23[_0x6682('0xa8')]||_0x5abf23[_0x6682('0x42')][_0x6682('0x37')]);}if(_0x1bfd8d[_0x6682('0x62')][_0x6682('0xa9')]&&_0x1bfd8d[_0x6682('0x62')]['attachments']['length']){for(var _0x406057=0x0;_0x406057<_0x1bfd8d[_0x6682('0x62')][_0x6682('0xa9')]['length'];_0x406057+=0x1){_0x1bfd8d[_0x6682('0x62')][_0x6682('0xa9')][_0x406057]={'filename':_0x1bfd8d['body'][_0x6682('0xa9')][_0x406057][_0x6682('0x2a')],'path':path[_0x6682('0xaa')](config[_0x6682('0xab')],_0x6682('0xac'),_0x1bfd8d[_0x6682('0x62')][_0x6682('0xa9')][_0x406057][_0x6682('0xad')])};}}var _0x2f8408=_0x5abf23['getSmtpOptions']();return respondWithRpcPromise(_0x6682('0xae'),'sendMail',{'account':_0x2f8408,'message':_0x1bfd8d[_0x6682('0x62')]});})['then'](function(_0x418d9a){if(!_0x418d9a)return;_0x492b2e=_0x418d9a;if(!_0x2d0831[_0x6682('0xaf')])throw new Error('List\x20not\x20found');if(_0x2d0831[_0x6682('0xaf')][_0x6682('0xa1')]['length'])return _0x2d0831[_0x6682('0xaf')][_0x6682('0xa1')][0x0];return db['CmContact'][_0x6682('0x71')](_[_0x6682('0xc')](_0x1bfd8d[_0x6682('0x62')],{'firstName':_0x1bfd8d[_0x6682('0x62')]['to'],'email':_0x1bfd8d[_0x6682('0x62')]['to'],'phone':_0x1bfd8d[_0x6682('0x62')]['to'],'ListId':_0x2d0831[_0x6682('0xb0')]}));})[_0x6682('0x11')](function(_0x5db7b3){if(!_0x5db7b3)return;var _0x4a621a={'UserId':_0x1bfd8d[_0x6682('0x37')]['id'],'ContactId':_0x5db7b3['id'],'MailAccountId':_0x2d0831['id'],'inReplyTo':_0x492b2e[_0x6682('0xb1')],'to':_0x1bfd8d[_0x6682('0x62')][_0x6682('0xa5')],'cc':_0x1bfd8d[_0x6682('0x62')]['cc'],'subject':_0x1bfd8d[_0x6682('0x62')][_0x6682('0xb2')],'attach':_0x1bfd8d[_0x6682('0x62')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x6682('0xa6')](_0x6682('0x9e')),'lastMsgDirection':_0x6682('0xb3'),'Messages':[_[_0x6682('0x59')](_0x1bfd8d[_0x6682('0x62')],{'messageId':_0x492b2e[_0x6682('0xb1')],'sentAt':moment()[_0x6682('0xa6')](_0x6682('0x9e')),'read':!![],'MailAccountId':_0x2d0831['id'],'UserId':_0x1bfd8d[_0x6682('0x37')]['id'],'ContactId':_0x5db7b3['id']})]};if(_0x1bfd8d[_0x6682('0x62')][_0x6682('0xb4')]){_0x4a621a=_[_0x6682('0x59')](_0x4a621a,_0x1bfd8d[_0x6682('0x62')][_0x6682('0xb4')]);}return db[_0x6682('0x82')]['create'](_0x4a621a,{'include':[{'model':db[_0x6682('0x9b')],'as':_0x6682('0xb5')}]});})[_0x6682('0x11')](respondWithResult(_0x5e017a,null))['catch'](handleError(_0x5e017a,null));};exports[_0x6682('0xb6')]=function(_0x105ce0,_0x1c0e9b){return db['MailAccount']['find']({'where':{'id':_0x105ce0['params']['id']},'include':[{'model':db[_0x6682('0x45')],'as':_0x6682('0x42'),'raw':!![],'include':[{'model':db[_0x6682('0xa4')],'as':_0x6682('0xa4'),'raw':!![]}]}]})[_0x6682('0x11')](handleEntityNotFound(_0x1c0e9b,null))[_0x6682('0x11')](function(_0x23e9ea){if(!_0x23e9ea['Smtp'])return;var _0x2af136=_0x23e9ea[_0x6682('0xb7')]();return respondWithRpcPromise('VerifySmtp',_0x6682('0xb6'),{'account':_0x2af136});})['then'](respondWithResult(_0x1c0e9b,null))[_0x6682('0x1c')](handleError(_0x1c0e9b,null));};exports[_0x6682('0x28')]=function(_0x268b82,_0x2b8fec){return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x268b82[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x2b8fec,null))[_0x6682('0x11')](function(_0x51f39e){if(_0x51f39e&&_0x51f39e[_0x6682('0x3e')]){throw new db['Sequelize'][(_0x6682('0xb8'))](_0x6682('0xb9'));}return _0x51f39e;})[_0x6682('0x11')](removeEntity(_0x2b8fec,null))['catch'](handleError(_0x2b8fec,null));};exports['addAgents']=function(_0x56a61d,_0x341e53){return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x56a61d['params']['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x341e53,null))[_0x6682('0x11')](function(_0x435158){if(_0x435158){return _0x435158['addAgents'](_0x56a61d[_0x6682('0x62')][_0x6682('0x6e')],_[_0x6682('0x83')](_0x56a61d[_0x6682('0x62')],[_0x6682('0x6e'),'id'])||{})[_0x6682('0xba')](function(_0x207801){for(var _0x372170=0x0;_0x372170<_0x56a61d[_0x6682('0x62')][_0x6682('0x6e')][_0x6682('0x53')];_0x372170+=0x1){socket[_0x6682('0xbb')](_0x6682('0xbc'),{'UserId':Number(_0x56a61d['body'][_0x6682('0x6e')][_0x372170]),'MailAccountId':Number(_0x56a61d['params']['id'])});}return _0x207801;});}})[_0x6682('0x11')](respondWithResult(_0x341e53,null))['catch'](handleError(_0x341e53,null));};exports[_0x6682('0xbd')]=function(_0x14380e,_0x3842a8){return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x14380e['params']['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x3842a8,null))['then'](function(_0x5430d5){if(_0x5430d5){return _0x5430d5[_0x6682('0xbd')](_0x14380e['query'][_0x6682('0x6e')])[_0x6682('0x11')](function(){if(_[_0x6682('0xbe')](_0x14380e['query'][_0x6682('0x6e')])){for(var _0x282130=0x0;_0x282130<_0x14380e[_0x6682('0x4d')][_0x6682('0x6e')]['length'];_0x282130+=0x1){socket[_0x6682('0xbb')](_0x6682('0xbf'),{'UserId':Number(_0x14380e[_0x6682('0x4d')][_0x6682('0x6e')][_0x282130]),'MailAccountId':Number(_0x14380e[_0x6682('0x60')]['id'])});}}else{socket[_0x6682('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x14380e[_0x6682('0x4d')][_0x6682('0x6e')]),'MailAccountId':Number(_0x14380e['params']['id'])});}});}})[_0x6682('0x11')](respondWithStatusCode(_0x3842a8,null))[_0x6682('0x1c')](handleError(_0x3842a8,null));};exports[_0x6682('0xc0')]=function(_0x2febec,_0x24af56){var _0x1e6cfe={};var _0x3341be={};var _0x30d5f0;var _0xc800cf;return db[_0x6682('0x48')][_0x6682('0x69')]({'where':{'id':_0x2febec[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x24af56,null))['then'](function(_0x407cf7){if(_0x407cf7){_0x30d5f0=_0x407cf7;_0x3341be['model']=_['keys'](db[_0x6682('0x87')][_0x6682('0x49')]);_0x3341be[_0x6682('0x4d')]=_['keys'](_0x2febec[_0x6682('0x4d')]);_0x3341be[_0x6682('0x4f')]=_[_0x6682('0x51')](_0x3341be[_0x6682('0x54')],_0x3341be['query']);_0x1e6cfe[_0x6682('0x50')]=_[_0x6682('0x51')](_0x3341be['model'],qs[_0x6682('0x52')](_0x2febec['query'][_0x6682('0x52')]));_0x1e6cfe[_0x6682('0x50')]=_0x1e6cfe[_0x6682('0x50')][_0x6682('0x53')]?_0x1e6cfe[_0x6682('0x50')]:_0x3341be[_0x6682('0x54')];_0x1e6cfe[_0x6682('0x55')]=qs[_0x6682('0x56')](_0x2febec['query']['sort']);_0x1e6cfe[_0x6682('0x57')]=qs[_0x6682('0x4f')](_['pick'](_0x2febec[_0x6682('0x4d')],_0x3341be[_0x6682('0x4f')]));if(_0x2febec[_0x6682('0x4d')][_0x6682('0x58')]){_0x1e6cfe[_0x6682('0x57')]=_[_0x6682('0x59')](_0x1e6cfe['where'],{'$or':_[_0x6682('0x4c')](_0x1e6cfe['attributes'],function(_0x1966e6){var _0x5d44af={};_0x5d44af[_0x1966e6]={'$like':'%'+_0x2febec[_0x6682('0x4d')][_0x6682('0x58')]+'%'};return _0x5d44af;})});}_0x1e6cfe=_[_0x6682('0x59')]({},_0x1e6cfe,_0x2febec['options']);return _0x30d5f0['getAgents'](_0x1e6cfe);}})['then'](function(_0x5215ce){if(_0x5215ce){_0xc800cf=_0x5215ce[_0x6682('0x53')];if(!_0x2febec[_0x6682('0x4d')][_0x6682('0x6a')](_0x6682('0x6b'))){_0x1e6cfe[_0x6682('0x22')]=qs[_0x6682('0x22')](_0x2febec[_0x6682('0x4d')][_0x6682('0x22')]);_0x1e6cfe[_0x6682('0x20')]=qs[_0x6682('0x20')](_0x2febec[_0x6682('0x4d')][_0x6682('0x20')]);}return _0x30d5f0['getAgents'](_0x1e6cfe);}})[_0x6682('0x11')](function(_0x3d963){if(_0x3d963){return _0x3d963?{'count':_0xc800cf,'rows':_0x3d963}:null;}})['then'](respondWithResult(_0x24af56,null))[_0x6682('0x1c')](handleError(_0x24af56,null));}; \ No newline at end of file +var _0x2c92=['Unknown\x20email\x20service\x20provider','smtp.gmail.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','port','host','secure','service','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','MailAccount','findAll','rows','show','find','body','custom','provider','params','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','ids','addAnswer','CannedAnswer','removeAnswers','email','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','fullname','internal','Tag','Tags','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','MailMessage','$gte','split','format','inlineCss','true','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','emit','userMailAccount:remove','getAgents','User','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','sendStatus','stack','name','send','gmail','imap.gmail.com','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com'];(function(_0x5b1b34,_0x164d41){var _0x4254bc=function(_0x4fce4b){while(--_0x4fce4b){_0x5b1b34['push'](_0x5b1b34['shift']());}};_0x4254bc(++_0x164d41);}(_0x2c92,0x93));var _0x22c9=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x2c92[_0x373dee];return _0x46798f;};'use strict';var moment=require('moment');var BPromise=require(_0x22c9('0x0'));var util=require(_0x22c9('0x1'));var path=require(_0x22c9('0x2'));var _=require(_0x22c9('0x3'));var juice=require(_0x22c9('0x4'));var Redis=require(_0x22c9('0x5'));var qs=require(_0x22c9('0x6'));var logger=require('../../config/logger')(_0x22c9('0x7'));var config=require(_0x22c9('0x8'));var db=require(_0x22c9('0x9'))['db'];config[_0x22c9('0xa')]=_[_0x22c9('0xb')](config[_0x22c9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x22c9('0xc'))(new Redis(config[_0x22c9('0xa')]));require(_0x22c9('0xd'))[_0x22c9('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x22c9('0xf')][_0x22c9('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x386100,_0x4dc0a9,_0x2784fd,_0x4e30c5){return new BPromise(function(_0x476ccd,_0x245e32){var _0x23ead0=_0x4e30c5||client;return _0x23ead0[_0x22c9('0x11')](_0x386100,_0x2784fd)[_0x22c9('0x12')](function(_0x55e548){logger[_0x22c9('0x13')](_0x22c9('0x14'),_0x4dc0a9,'request\x20sent');logger[_0x22c9('0x15')](_0x22c9('0x16'),_0x4dc0a9,_0x22c9('0x17'),JSON[_0x22c9('0x18')](_0x55e548));if(_0x55e548[_0x22c9('0x19')]){if(_0x55e548[_0x22c9('0x19')]['code']===0x1f4){logger['error'](_0x22c9('0x14'),_0x4dc0a9,_0x55e548[_0x22c9('0x19')][_0x22c9('0x1a')]);return _0x245e32(_0x55e548[_0x22c9('0x19')][_0x22c9('0x1a')]);}logger[_0x22c9('0x19')](_0x22c9('0x14'),_0x4dc0a9,_0x55e548[_0x22c9('0x19')]['message']);return _0x476ccd(_0x55e548[_0x22c9('0x19')][_0x22c9('0x1a')]);}else{logger[_0x22c9('0x13')]('MailAccount,\x20%s,\x20%s',_0x4dc0a9,_0x22c9('0x17'));_0x476ccd(_0x55e548[_0x22c9('0x1b')][_0x22c9('0x1a')]);}})[_0x22c9('0x1c')](function(_0x362a62){logger[_0x22c9('0x19')](_0x22c9('0x14'),_0x4dc0a9,_0x362a62);_0x245e32(_0x362a62);});});}function respondWithStatusCode(_0x39db09,_0x3262fe){_0x3262fe=_0x3262fe||0xcc;return function(_0x437875){if(_0x437875){return _0x39db09['sendStatus'](_0x3262fe);}return _0x39db09[_0x22c9('0x1d')](_0x3262fe)[_0x22c9('0x1e')]();};}function respondWithResult(_0x59a65b,_0x21681a){_0x21681a=_0x21681a||0xc8;return function(_0x53f82c){if(_0x53f82c){return _0x59a65b['status'](_0x21681a)[_0x22c9('0x1f')](_0x53f82c);}};}function respondWithFilteredResult(_0x43f686,_0x3f4209){return function(_0xd9eb42){if(_0xd9eb42){var _0x360e58=typeof _0x3f4209[_0x22c9('0x20')]==='undefined'&&typeof _0x3f4209[_0x22c9('0x21')]===_0x22c9('0x22');var _0x4b8cb8=_0xd9eb42[_0x22c9('0x23')];var _0x3a38bb=_0x360e58?0x0:_0x3f4209[_0x22c9('0x20')];var _0x355c25=_0x360e58?_0xd9eb42[_0x22c9('0x23')]:_0x3f4209[_0x22c9('0x20')]+_0x3f4209[_0x22c9('0x21')];var _0x52029c;if(_0x355c25>=_0x4b8cb8){_0x355c25=_0x4b8cb8;_0x52029c=0xc8;}else{_0x52029c=0xce;}_0x43f686[_0x22c9('0x1d')](_0x52029c);return _0x43f686[_0x22c9('0x24')](_0x22c9('0x25'),_0x3a38bb+'-'+_0x355c25+'/'+_0x4b8cb8)[_0x22c9('0x1f')](_0xd9eb42);}return null;};}function saveUpdates(_0x5e171d){return function(_0x47313e){if(_0x47313e){return _0x47313e[_0x22c9('0x26')](_0x5e171d)['then'](function(_0x56c0b2){return _0x56c0b2;});}return null;};}function removeEntity(_0xda0dba){return function(_0x397cae){if(_0x397cae){return _0x397cae[_0x22c9('0x27')]()[_0x22c9('0x12')](function(){var _0xa654ae=_0x397cae['get']({'plain':!![]});var _0x31f037='MailAccounts';return db['UserProfileResource'][_0x22c9('0x27')]({'where':{'type':_0x31f037,'resourceId':_0xa654ae['id']}})[_0x22c9('0x12')](function(){return _0x397cae;});})['then'](function(){_0xda0dba[_0x22c9('0x1d')](0xcc)[_0x22c9('0x1e')]();});}};}function handleEntityNotFound(_0x4ffea9){return function(_0x53431e){if(!_0x53431e){_0x4ffea9[_0x22c9('0x28')](0x194);}return _0x53431e;};}function handleError(_0x12be8f,_0x5b1c52){_0x5b1c52=_0x5b1c52||0x1f4;return function(_0x4b1dc6){logger[_0x22c9('0x19')](_0x4b1dc6[_0x22c9('0x29')]);if(_0x4b1dc6['name']){delete _0x4b1dc6[_0x22c9('0x2a')];}_0x12be8f[_0x22c9('0x1d')](_0x5b1c52)[_0x22c9('0x2b')](_0x4b1dc6);};}function getImapHost(_0x55ae5e){switch(_0x55ae5e){case _0x22c9('0x2c'):return _0x22c9('0x2d');case _0x22c9('0x2e'):return'imap.mail.yahoo.com';case'hotmail':return _0x22c9('0x2f');case _0x22c9('0x30'):return _0x22c9('0x31');}throw new Error(_0x22c9('0x32'),_0x55ae5e);}function getSmtpHost(_0x4f6d7e){switch(_0x4f6d7e){case _0x22c9('0x2c'):return _0x22c9('0x33');case _0x22c9('0x2e'):return'smtp.mail.yahoo.com';case _0x22c9('0x34'):return _0x22c9('0x35');case _0x22c9('0x30'):return _0x22c9('0x36');}throw new Error(_0x22c9('0x32'),_0x4f6d7e);}function getAuthenticationOptions(_0x1d9fe7,_0x540c1a){var _0x2f552d={};var _0x46522d={};if(_0x1d9fe7){_0x2f552d[_0x22c9('0x37')]=_0x46522d['user']=_0x540c1a[_0x22c9('0x38')];_0x2f552d['password']=_0x46522d[_0x22c9('0x39')]=_0x540c1a[_0x22c9('0x3a')];if(_0x540c1a[_0x22c9('0x3b')]){_0x2f552d['modernAuthentication']=_0x46522d[_0x22c9('0x3b')]=!![];_0x2f552d['CloudProviderId']=_0x46522d['CloudProviderId']=_0x540c1a[_0x22c9('0x3c')];_0x2f552d[_0x22c9('0x3a')]=_0x46522d['pass']=null;}else{_0x2f552d['CloudProviderId']=_0x46522d['CloudProviderId']=null;}_0x2f552d['host']=getImapHost(_0x1d9fe7);_0x2f552d[_0x22c9('0x3d')]=0x3e1;_0x46522d[_0x22c9('0x3e')]=getSmtpHost(_0x1d9fe7);_0x46522d[_0x22c9('0x3d')]=0x24b;_0x46522d[_0x22c9('0x3f')]=![];_0x2f552d[_0x22c9('0x40')]=_0x46522d[_0x22c9('0x40')]=null;}else{if(_0x540c1a['authentication']){_0x2f552d[_0x22c9('0x37')]=_0x46522d[_0x22c9('0x37')]=_0x540c1a['username'];_0x2f552d['password']=_0x46522d[_0x22c9('0x39')]=_0x540c1a[_0x22c9('0x3a')];}else{_0x2f552d['authentication']=_0x46522d['authentication']=![];_0x2f552d['user']=_0x46522d[_0x22c9('0x37')]=null;_0x2f552d[_0x22c9('0x3a')]=_0x46522d['pass']=null;}_0x2f552d[_0x22c9('0x3e')]=_0x540c1a[_0x22c9('0x41')][_0x22c9('0x3e')];_0x2f552d[_0x22c9('0x3d')]=_0x540c1a[_0x22c9('0x41')]['port'];_0x46522d[_0x22c9('0x3e')]=_0x540c1a[_0x22c9('0x42')]['host'];_0x46522d[_0x22c9('0x3d')]=_0x540c1a['Smtp'][_0x22c9('0x3d')];}return{'Imap':_0x2f552d,'Smtp':_0x46522d};}exports[_0x22c9('0x43')]=function(_0x3edaf8,_0x123a09){var _0x5c6c8c={'include':[{'model':db[_0x22c9('0x44')],'as':_0x22c9('0x41')},{'model':db[_0x22c9('0x45')],'as':_0x22c9('0x42')},{'model':db[_0x22c9('0x46')],'as':_0x22c9('0x47')}]},_0x291fc7={},_0x14f7c4={'count':0x0,'rows':[]};var _0x3003ab=_[_0x22c9('0x48')](db['MailAccount'][_0x22c9('0x49')],function(_0x320d5b){return{'name':_0x320d5b[_0x22c9('0x4a')],'type':_0x320d5b[_0x22c9('0x4b')][_0x22c9('0x4c')]};});_0x291fc7[_0x22c9('0x4d')]=_[_0x22c9('0x48')](_0x3003ab,'name');_0x291fc7[_0x22c9('0x4e')]=_[_0x22c9('0x4f')](_0x3edaf8[_0x22c9('0x4e')]);_0x291fc7[_0x22c9('0x50')]=_[_0x22c9('0x51')](_0x291fc7['model'],_0x291fc7[_0x22c9('0x4e')]);_0x5c6c8c[_0x22c9('0x52')]=_['intersection'](_0x291fc7[_0x22c9('0x4d')],qs[_0x22c9('0x53')](_0x3edaf8[_0x22c9('0x4e')]['fields']));_0x5c6c8c[_0x22c9('0x52')]=_0x5c6c8c[_0x22c9('0x52')][_0x22c9('0x54')]?_0x5c6c8c['attributes']:_0x291fc7[_0x22c9('0x4d')];if(!_0x3edaf8[_0x22c9('0x4e')][_0x22c9('0x55')](_0x22c9('0x56'))){_0x5c6c8c[_0x22c9('0x21')]=qs[_0x22c9('0x21')](_0x3edaf8['query'][_0x22c9('0x21')]);_0x5c6c8c[_0x22c9('0x20')]=qs[_0x22c9('0x20')](_0x3edaf8[_0x22c9('0x4e')][_0x22c9('0x20')]);}_0x5c6c8c[_0x22c9('0x57')]=qs[_0x22c9('0x58')](_0x3edaf8['query']['sort']);_0x5c6c8c[_0x22c9('0x59')]=qs[_0x22c9('0x50')](_[_0x22c9('0x5a')](_0x3edaf8[_0x22c9('0x4e')],_0x291fc7[_0x22c9('0x50')]),_0x3003ab);if(_0x3edaf8[_0x22c9('0x4e')][_0x22c9('0x5b')]){_0x5c6c8c['where']=_[_0x22c9('0x5c')](_0x5c6c8c[_0x22c9('0x59')],{'$or':_[_0x22c9('0x48')](_0x3003ab,function(_0x8c6266){if(_0x8c6266[_0x22c9('0x4b')]!=='VIRTUAL'){var _0x318c19={};_0x318c19[_0x8c6266['name']]={'$like':'%'+_0x3edaf8['query']['filter']+'%'};return _0x318c19;}})});}_0x5c6c8c=_[_0x22c9('0x5c')]({},_0x5c6c8c,_0x3edaf8[_0x22c9('0x5d')]);var _0xe0d614={'where':_0x5c6c8c[_0x22c9('0x59')]};return db['MailAccount'][_0x22c9('0x23')](_0xe0d614)[_0x22c9('0x12')](function(_0x1d5711){_0x14f7c4[_0x22c9('0x23')]=_0x1d5711;if(_0x3edaf8['query'][_0x22c9('0x5e')]){_0x5c6c8c[_0x22c9('0x5f')]=[{'all':!![]}];}return db[_0x22c9('0x60')][_0x22c9('0x61')](_0x5c6c8c);})[_0x22c9('0x12')](function(_0x31b4d1){_0x14f7c4[_0x22c9('0x62')]=_0x31b4d1;return _0x14f7c4;})['then'](respondWithFilteredResult(_0x123a09,_0x5c6c8c))[_0x22c9('0x1c')](handleError(_0x123a09,null));};exports[_0x22c9('0x63')]=function(_0x2c3a79,_0x2fed24){var _0x15462d={'raw':![],'where':{'id':_0x2c3a79['params']['id']},'include':[{'model':db[_0x22c9('0x44')],'as':_0x22c9('0x41')},{'model':db[_0x22c9('0x45')],'as':_0x22c9('0x42')},{'model':db[_0x22c9('0x46')],'as':_0x22c9('0x47')}]},_0x415761={};_0x415761['model']=_[_0x22c9('0x4f')](db[_0x22c9('0x60')]['rawAttributes']);_0x415761['query']=_[_0x22c9('0x4f')](_0x2c3a79[_0x22c9('0x4e')]);_0x415761['filters']=_[_0x22c9('0x51')](_0x415761[_0x22c9('0x4d')],_0x415761[_0x22c9('0x4e')]);_0x15462d[_0x22c9('0x52')]=_[_0x22c9('0x51')](_0x415761['model'],qs[_0x22c9('0x53')](_0x2c3a79[_0x22c9('0x4e')]['fields']));_0x15462d['attributes']=_0x15462d[_0x22c9('0x52')][_0x22c9('0x54')]?_0x15462d[_0x22c9('0x52')]:_0x415761[_0x22c9('0x4d')];if(_0x2c3a79[_0x22c9('0x4e')][_0x22c9('0x5e')]){_0x15462d[_0x22c9('0x5f')]=[{'all':!![]}];}_0x15462d=_[_0x22c9('0x5c')]({},_0x15462d,_0x2c3a79['options']);return db['MailAccount'][_0x22c9('0x64')](_0x15462d)['then'](handleEntityNotFound(_0x2fed24,null))['then'](respondWithResult(_0x2fed24,null))[_0x22c9('0x1c')](handleError(_0x2fed24,null));};exports[_0x22c9('0x26')]=function(_0x2888a5,_0x537222){if(_0x2888a5[_0x22c9('0x65')]['id']){delete _0x2888a5[_0x22c9('0x65')]['id'];}var _0x5583ef=_0x2888a5[_0x22c9('0x65')]['provider']===_0x22c9('0x66')?null:_0x2888a5[_0x22c9('0x65')][_0x22c9('0x67')];var _0x18b667=_0x2888a5[_0x22c9('0x65')][_0x22c9('0x41')]||{};var _0x2e60a7=_0x2888a5['body'][_0x22c9('0x42')]||{};if(_0x5583ef){_0x18b667[_0x22c9('0x3e')]=getImapHost(_0x5583ef);_0x18b667[_0x22c9('0x3d')]=0x3e1;_0x2e60a7['host']=getSmtpHost(_0x5583ef);_0x2e60a7[_0x22c9('0x3d')]=0x24b;_0x2e60a7[_0x22c9('0x3f')]=![];}if(_0x2e60a7['modernAuthentication']){_0x2e60a7['secure']=![];}else{_0x2e60a7[_0x22c9('0x3c')]=null;}if(!_0x18b667['modernAuthentication'])_0x18b667[_0x22c9('0x3c')]=null;_0x2888a5[_0x22c9('0x65')][_0x22c9('0x41')]=_0x18b667;_0x2888a5[_0x22c9('0x65')]['Smtp']=_0x2e60a7;return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x2888a5[_0x22c9('0x68')]['id']},'include':[{'model':db[_0x22c9('0x44')],'as':_0x22c9('0x41')},{'model':db[_0x22c9('0x45')],'as':_0x22c9('0x42')},{'model':db[_0x22c9('0x46')],'as':_0x22c9('0x47')}]})['then'](handleEntityNotFound(_0x537222,null))[_0x22c9('0x12')](function(_0x350b0f){if(!_0x350b0f)throw new Error(_0x22c9('0x69'));if(_0x350b0f[_0x22c9('0x40')])delete _0x2888a5[_0x22c9('0x65')][_0x22c9('0x41')];return _0x350b0f;})[_0x22c9('0x12')](saveUpdates(_0x2888a5[_0x22c9('0x65')],null))[_0x22c9('0x12')](function(_0x2b8446){if(!_0x2888a5[_0x22c9('0x65')][_0x22c9('0x41')])return _0x2b8446;return db[_0x22c9('0x44')][_0x22c9('0x26')](_0x2888a5['body'][_0x22c9('0x41')],{'where':{'MailAccountId':_0x2b8446['id']}})[_0x22c9('0x12')](function(){return _0x2b8446;});})[_0x22c9('0x12')](function(_0x1a8a97){if(!_0x2888a5[_0x22c9('0x65')][_0x22c9('0x42')])return _0x1a8a97;return db[_0x22c9('0x45')]['update'](_0x2888a5[_0x22c9('0x65')][_0x22c9('0x42')],{'where':{'MailAccountId':_0x1a8a97['id']}})[_0x22c9('0x12')](function(){return _0x1a8a97;});})[_0x22c9('0x12')](respondWithResult(_0x537222,null))[_0x22c9('0x1c')](handleError(_0x537222,null));};exports['describe']=function(_0x3f1eed,_0xf7b528){return db[_0x22c9('0x60')][_0x22c9('0x6a')]()['then'](respondWithResult(_0xf7b528,null))[_0x22c9('0x1c')](handleError(_0xf7b528,null));};exports[_0x22c9('0x6b')]=function(_0x4058f0,_0x16f311){if(_0x4058f0['body']['id']){delete _0x4058f0[_0x22c9('0x65')]['id'];}return db['MailAccount'][_0x22c9('0x64')]({'where':{'id':_0x4058f0['params']['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x16f311,null))[_0x22c9('0x12')](function(_0x264605){if(_0x264605){_0x4058f0[_0x22c9('0x65')][_0x22c9('0x6c')]=_0x264605['id'];return db['Disposition'][_0x22c9('0x6d')](_0x4058f0[_0x22c9('0x65')]);}})[_0x22c9('0x12')](respondWithResult(_0x16f311,null))[_0x22c9('0x1c')](handleError(_0x16f311,null));};exports[_0x22c9('0x6e')]=function(_0x5d8b56,_0x5c1c81){var _0x1ab266={'raw':![],'where':{}};var _0xda8f37={};var _0x551762={'count':0x0,'rows':[]};return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x5d8b56['params']['id']}})['then'](handleEntityNotFound(_0x5c1c81,null))[_0x22c9('0x12')](function(_0x122993){if(_0x122993){_0xda8f37[_0x22c9('0x4d')]=_['keys'](db[_0x22c9('0x70')][_0x22c9('0x49')]);_0xda8f37[_0x22c9('0x4e')]=_['keys'](_0x5d8b56[_0x22c9('0x4e')]);_0xda8f37['filters']=_[_0x22c9('0x51')](_0xda8f37[_0x22c9('0x4d')],_0xda8f37['query']);_0x1ab266['attributes']=_[_0x22c9('0x51')](_0xda8f37['model'],qs[_0x22c9('0x53')](_0x5d8b56[_0x22c9('0x4e')][_0x22c9('0x53')]));_0x1ab266[_0x22c9('0x52')]=_0x1ab266[_0x22c9('0x52')][_0x22c9('0x54')]?_0x1ab266[_0x22c9('0x52')]:_0xda8f37[_0x22c9('0x4d')];if(!_0x5d8b56[_0x22c9('0x4e')][_0x22c9('0x55')](_0x22c9('0x56'))){_0x1ab266[_0x22c9('0x21')]=qs[_0x22c9('0x21')](_0x5d8b56[_0x22c9('0x4e')][_0x22c9('0x21')]);_0x1ab266[_0x22c9('0x20')]=qs[_0x22c9('0x20')](_0x5d8b56[_0x22c9('0x4e')][_0x22c9('0x20')]);}_0x1ab266[_0x22c9('0x57')]=qs[_0x22c9('0x58')](_0x5d8b56['query']['sort']);_0x1ab266[_0x22c9('0x59')]=qs['filters'](_['pick'](_0x5d8b56['query'],_0xda8f37[_0x22c9('0x50')]));_0x1ab266['where'][_0x22c9('0x6c')]=_0x122993['id'];if(_0x5d8b56[_0x22c9('0x4e')][_0x22c9('0x5b')]){_0x1ab266['where']=_['merge'](_0x1ab266[_0x22c9('0x59')],{'$or':_[_0x22c9('0x48')](_0x1ab266[_0x22c9('0x52')],function(_0x5f417e){var _0x4d569a={};_0x4d569a[_0x5f417e]={'$like':'%'+_0x5d8b56['query'][_0x22c9('0x5b')]+'%'};return _0x4d569a;})});}_0x1ab266=_[_0x22c9('0x5c')]({},_0x1ab266,_0x5d8b56[_0x22c9('0x5d')]);return db['Disposition'][_0x22c9('0x23')]({'where':_0x1ab266['where']})['then'](function(_0x211cc8){_0x551762[_0x22c9('0x23')]=_0x211cc8;if(_0x5d8b56[_0x22c9('0x4e')][_0x22c9('0x5e')]){_0x1ab266[_0x22c9('0x5f')]=[{'all':!![]}];}return db[_0x22c9('0x70')][_0x22c9('0x61')](_0x1ab266);})[_0x22c9('0x12')](function(_0x28b838){_0x551762['rows']=_0x28b838;return _0x551762;});}})[_0x22c9('0x12')](respondWithFilteredResult(_0x5c1c81,_0x1ab266))[_0x22c9('0x1c')](handleError(_0x5c1c81,null));};exports['removeDispositions']=function(_0x473c25,_0x2ccf30){return db['MailAccount'][_0x22c9('0x64')]({'where':{'id':_0x473c25[_0x22c9('0x68')]['id']}})['then'](handleEntityNotFound(_0x2ccf30,null))[_0x22c9('0x12')](function(_0x380b43){if(_0x380b43){return _0x380b43['removeDispositions'](_0x473c25['query'][_0x22c9('0x71')]);}})[_0x22c9('0x12')](respondWithStatusCode(_0x2ccf30,null))[_0x22c9('0x1c')](handleError(_0x2ccf30,null));};exports[_0x22c9('0x72')]=function(_0x28fc96,_0x2509d7){if(_0x28fc96['body']['id']){delete _0x28fc96[_0x22c9('0x65')]['id'];}return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x28fc96['params']['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x2509d7,null))['then'](function(_0x40f771){if(_0x40f771){_0x28fc96[_0x22c9('0x65')]['MailAccountId']=_0x40f771['id'];return db[_0x22c9('0x73')][_0x22c9('0x6d')](_0x28fc96[_0x22c9('0x65')]);}})[_0x22c9('0x12')](respondWithResult(_0x2509d7,null))[_0x22c9('0x1c')](handleError(_0x2509d7,null));};exports['getAnswers']=function(_0x20b1b1,_0xa79515){var _0x560d5d={'raw':![],'where':{}};var _0x35c69c={};var _0x4c08f={'count':0x0,'rows':[]};return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x20b1b1['params']['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0xa79515,null))[_0x22c9('0x12')](function(_0x23b705){if(_0x23b705){_0x35c69c[_0x22c9('0x4d')]=_[_0x22c9('0x4f')](db['CannedAnswer'][_0x22c9('0x49')]);_0x35c69c[_0x22c9('0x4e')]=_[_0x22c9('0x4f')](_0x20b1b1[_0x22c9('0x4e')]);_0x35c69c[_0x22c9('0x50')]=_['intersection'](_0x35c69c[_0x22c9('0x4d')],_0x35c69c['query']);_0x560d5d[_0x22c9('0x52')]=_[_0x22c9('0x51')](_0x35c69c[_0x22c9('0x4d')],qs[_0x22c9('0x53')](_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x53')]));_0x560d5d[_0x22c9('0x52')]=_0x560d5d[_0x22c9('0x52')]['length']?_0x560d5d[_0x22c9('0x52')]:_0x35c69c['model'];if(!_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x55')](_0x22c9('0x56'))){_0x560d5d[_0x22c9('0x21')]=qs['limit'](_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x21')]);_0x560d5d[_0x22c9('0x20')]=qs[_0x22c9('0x20')](_0x20b1b1['query'][_0x22c9('0x20')]);}_0x560d5d[_0x22c9('0x57')]=qs[_0x22c9('0x58')](_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x58')]);_0x560d5d[_0x22c9('0x59')]=qs[_0x22c9('0x50')](_[_0x22c9('0x5a')](_0x20b1b1[_0x22c9('0x4e')],_0x35c69c['filters']));_0x560d5d['where'][_0x22c9('0x6c')]=_0x23b705['id'];if(_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x5b')]){_0x560d5d[_0x22c9('0x59')]=_[_0x22c9('0x5c')](_0x560d5d[_0x22c9('0x59')],{'$or':_['map'](_0x560d5d[_0x22c9('0x52')],function(_0xe733b0){var _0xa1ce4={};_0xa1ce4[_0xe733b0]={'$like':'%'+_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x5b')]+'%'};return _0xa1ce4;})});}_0x560d5d=_[_0x22c9('0x5c')]({},_0x560d5d,_0x20b1b1['options']);return db[_0x22c9('0x73')][_0x22c9('0x23')]({'where':_0x560d5d['where']})[_0x22c9('0x12')](function(_0x1538c9){_0x4c08f['count']=_0x1538c9;if(_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x5e')]){_0x560d5d['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x22c9('0x61')](_0x560d5d);})['then'](function(_0x1827ff){_0x4c08f[_0x22c9('0x62')]=_0x1827ff;return _0x4c08f;});}})[_0x22c9('0x12')](respondWithFilteredResult(_0xa79515,_0x560d5d))[_0x22c9('0x1c')](handleError(_0xa79515,null));};exports[_0x22c9('0x74')]=function(_0x41f985,_0x2a1300){return db['MailAccount']['find']({'where':{'id':_0x41f985[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x2a1300,null))[_0x22c9('0x12')](function(_0x135838){if(_0x135838){return _0x135838[_0x22c9('0x74')](_0x41f985['query'][_0x22c9('0x71')]);}})[_0x22c9('0x12')](respondWithStatusCode(_0x2a1300,null))[_0x22c9('0x1c')](handleError(_0x2a1300,null));};exports[_0x22c9('0x6d')]=function(_0x40022c,_0x1a2ab8){var _0x967e53={'name':_0x40022c['body']['name'],'key':_0x40022c[_0x22c9('0x65')][_0x22c9('0x4c')],'provider':_0x40022c['body'][_0x22c9('0x67')]===_0x22c9('0x66')?null:_0x40022c[_0x22c9('0x65')]['provider'],'email':_0x40022c[_0x22c9('0x65')][_0x22c9('0x75')],'ListId':_0x40022c[_0x22c9('0x65')][_0x22c9('0x76')],'active':!_['isNil'](_0x40022c[_0x22c9('0x65')][_0x22c9('0x77')])?_0x40022c['body'][_0x22c9('0x77')]:!![],'description':_0x40022c[_0x22c9('0x65')][_0x22c9('0x78')]||null};var _0x31d72c=getAuthenticationOptions(_0x967e53[_0x22c9('0x67')],_0x40022c[_0x22c9('0x65')]);_0x967e53['Imap']=_0x31d72c[_0x22c9('0x41')];_0x967e53[_0x22c9('0x42')]=_0x31d72c[_0x22c9('0x42')];return db[_0x22c9('0x60')][_0x22c9('0x6d')](_0x967e53,{'include':[{'model':db[_0x22c9('0x45')],'as':'Smtp'},{'model':db[_0x22c9('0x44')],'as':_0x22c9('0x41')}]})[_0x22c9('0x12')](function(_0x32ed26){var _0x527959=_0x40022c[_0x22c9('0x37')]['get']({'plain':!![]});if(!_0x527959)throw new Error(_0x22c9('0x79'));if(_0x527959[_0x22c9('0x7a')]===_0x22c9('0x37')){var _0x8da1af=_0x32ed26[_0x22c9('0x7b')]({'plain':!![]});return db[_0x22c9('0x7c')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x527959[_0x22c9('0x7d')]},'raw':!![]})['then'](function(_0x4684ab){if(_0x4684ab&&_0x4684ab[_0x22c9('0x7e')]===0x0){return db[_0x22c9('0x7f')]['create']({'name':_0x8da1af[_0x22c9('0x2a')],'resourceId':_0x8da1af['id'],'type':_0x4684ab[_0x22c9('0x2a')],'sectionId':_0x4684ab['id']},{})['then'](function(){return _0x32ed26;});}else{return _0x32ed26;}})[_0x22c9('0x1c')](function(_0x4069ca){logger[_0x22c9('0x19')](_0x22c9('0x80'),_0x4069ca);throw _0x4069ca;});}return _0x32ed26;})['then'](respondWithResult(_0x1a2ab8,0xc9))[_0x22c9('0x1c')](handleError(_0x1a2ab8,null));};exports[_0x22c9('0x81')]=function(_0x19b84d,_0x117f85){return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x19b84d[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x117f85,null))['then'](function(_0x42e857){if(_0x42e857){return _0x42e857['getImap']();}return null;})[_0x22c9('0x12')](respondWithResult(_0x117f85,null))[_0x22c9('0x1c')](handleError(_0x117f85,null));};exports[_0x22c9('0x82')]=function(_0x198293,_0x59ffc9){if(_0x198293['body']['id']){delete _0x198293[_0x22c9('0x65')]['id'];}return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x198293['params']['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x59ffc9,null))[_0x22c9('0x12')](function(_0x363727){if(_0x363727){_0x198293[_0x22c9('0x65')][_0x22c9('0x6c')]=_0x363727['id'];return db[_0x22c9('0x44')][_0x22c9('0x6d')](_0x198293[_0x22c9('0x65')]);}})['then'](respondWithResult(_0x59ffc9,null))[_0x22c9('0x1c')](handleError(_0x59ffc9,null));};exports[_0x22c9('0x83')]=function(_0x41cb86,_0x45b7b5){return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x41cb86['params']['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x45b7b5,null))[_0x22c9('0x12')](function(_0x6ce906){if(_0x6ce906){return _0x6ce906[_0x22c9('0x84')](null);}return null;})[_0x22c9('0x12')](respondWithStatusCode(_0x45b7b5,null))['catch'](handleError(_0x45b7b5,null));};exports['getSmtp']=function(_0x42e61c,_0x47360a){return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x42e61c[_0x22c9('0x68')]['id']}})['then'](handleEntityNotFound(_0x47360a,null))[_0x22c9('0x12')](function(_0x5de493){if(_0x5de493){return _0x5de493[_0x22c9('0x85')]();}return null;})['then'](respondWithResult(_0x47360a,null))[_0x22c9('0x1c')](handleError(_0x47360a,null));};exports[_0x22c9('0x86')]=function(_0x3cd2f4,_0x454127){if(_0x3cd2f4['body']['id']){delete _0x3cd2f4[_0x22c9('0x65')]['id'];}return db[_0x22c9('0x60')]['find']({'where':{'id':_0x3cd2f4[_0x22c9('0x68')]['id']}})['then'](handleEntityNotFound(_0x454127,null))[_0x22c9('0x12')](function(_0xa84f83){if(_0xa84f83){_0x3cd2f4[_0x22c9('0x65')][_0x22c9('0x6c')]=_0xa84f83['id'];return db[_0x22c9('0x45')]['create'](_0x3cd2f4['body']);}})[_0x22c9('0x12')](respondWithResult(_0x454127,null))['catch'](handleError(_0x454127,null));};exports[_0x22c9('0x87')]=function(_0xafdacc,_0x4093bb){return db[_0x22c9('0x60')]['findOne']({'where':{'id':_0xafdacc[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x4093bb,null))[_0x22c9('0x12')](function(_0x2f676b){if(_0x2f676b){return _0x2f676b[_0x22c9('0x88')](null);}return null;})[_0x22c9('0x12')](respondWithStatusCode(_0x4093bb,null))[_0x22c9('0x1c')](handleError(_0x4093bb,null));};exports[_0x22c9('0x89')]=function(_0xf15a1f,_0x26a812){return db[_0x22c9('0x8a')][_0x22c9('0x64')]({'where':{'id':_0xf15a1f[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x26a812,null))[_0x22c9('0x12')](function(_0x20cf1e){if(_0x20cf1e){return _0x20cf1e[_0x22c9('0x89')](_0xf15a1f[_0x22c9('0x65')]['ids'],_[_0x22c9('0x8b')](_0xf15a1f[_0x22c9('0x65')],[_0x22c9('0x71'),'id'])||{});}})['then'](respondWithResult(_0x26a812,null))[_0x22c9('0x1c')](handleError(_0x26a812,null));};exports[_0x22c9('0x8c')]=function(_0x1c0026,_0x3e6457){var _0x817667={'raw':![],'where':{}};var _0x3cbfc3={};var _0x690cd0={'count':0x0,'rows':[]};return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x1c0026[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x3e6457,null))[_0x22c9('0x12')](function(_0xa7258f){if(_0xa7258f){_0x3cbfc3[_0x22c9('0x4d')]=_[_0x22c9('0x4f')](db[_0x22c9('0x8a')][_0x22c9('0x49')]);_0x3cbfc3[_0x22c9('0x4e')]=_[_0x22c9('0x4f')](_0x1c0026[_0x22c9('0x4e')]);_0x3cbfc3[_0x22c9('0x50')]=_['intersection'](_0x3cbfc3[_0x22c9('0x4d')],_0x3cbfc3[_0x22c9('0x4e')]);_0x817667[_0x22c9('0x52')]=_[_0x22c9('0x51')](_0x3cbfc3[_0x22c9('0x4d')],qs[_0x22c9('0x53')](_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x53')]));_0x817667['attributes']=_0x817667['attributes'][_0x22c9('0x54')]?_0x817667['attributes']:_0x3cbfc3['model'];if(!_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x55')](_0x22c9('0x56'))){_0x817667[_0x22c9('0x21')]=qs['limit'](_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x21')]);_0x817667[_0x22c9('0x20')]=qs[_0x22c9('0x20')](_0x1c0026['query']['offset']);}_0x817667['order']=qs[_0x22c9('0x58')](_0x1c0026[_0x22c9('0x4e')]['sort']);_0x817667[_0x22c9('0x59')]=qs[_0x22c9('0x50')](_[_0x22c9('0x5a')](_0x1c0026[_0x22c9('0x4e')],_0x3cbfc3[_0x22c9('0x50')]));_0x817667[_0x22c9('0x59')][_0x22c9('0x6c')]=_0xa7258f['id'];if(_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x5b')]){_0x817667[_0x22c9('0x59')]=_[_0x22c9('0x5c')](_0x817667['where'],{'$or':_[_0x22c9('0x48')](_0x817667[_0x22c9('0x52')],function(_0x39e22e){var _0x1f799c={};_0x1f799c[_0x39e22e]={'$like':'%'+_0x1c0026['query'][_0x22c9('0x5b')]+'%'};return _0x1f799c;})});}_0x817667=_['merge']({},_0x817667,_0x1c0026[_0x22c9('0x5d')]);return db[_0x22c9('0x8a')][_0x22c9('0x23')]({'where':_0x817667[_0x22c9('0x59')]})[_0x22c9('0x12')](function(_0x32da2a){_0x690cd0[_0x22c9('0x23')]=_0x32da2a;if(_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x5e')]){_0x817667['include']=[{'model':db[_0x22c9('0x8d')],'as':_0x22c9('0x8e'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x22c9('0x2a'),_0x22c9('0x8f'),_0x22c9('0x90')],'required':![]},{'model':db[_0x22c9('0x91')],'as':_0x22c9('0x92'),'attributes':['id',_0x22c9('0x2a'),'color'],'where':_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x93')]?{'id':_0x1c0026[_0x22c9('0x4e')]['tag']}:undefined,'required':_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x93')]?!![]:![]}];}return db[_0x22c9('0x8a')][_0x22c9('0x61')](_0x817667);})[_0x22c9('0x12')](function(_0x27f946){_0x690cd0['rows']=_0x27f946;return _0x690cd0;});}})[_0x22c9('0x12')](respondWithFilteredResult(_0x3e6457,_0x817667))[_0x22c9('0x1c')](handleError(_0x3e6457,null));};exports[_0x22c9('0x94')]=function addApplications(_0x221a45,_0xeaf766){var _0x46ff96=_0x221a45[_0x22c9('0x68')]['id'];var _0x214059=_0x221a45[_0x22c9('0x65')];var _0x23c229=0xc8;var _0xe14ce0=null;return db[_0x22c9('0x95')]['transaction']({'isolationLevel':db[_0x22c9('0x95')][_0x22c9('0x96')][_0x22c9('0x97')][_0x22c9('0x98')]},function(_0x26a2f7){return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x46ff96},'transaction':_0x26a2f7})[_0x22c9('0x12')](function(_0x5c310f){if(_0x5c310f){return db[_0x22c9('0x99')][_0x22c9('0x27')]({'where':{'MailAccountId':_0x46ff96},'transaction':_0x26a2f7})[_0x22c9('0x12')](function(){var _0x2485c2=_['map'](_0x214059,function(_0x4fa0ee){_0x4fa0ee[_0x22c9('0x6c')]=_0x46ff96;return _0x4fa0ee;});return db[_0x22c9('0x99')][_0x22c9('0x9a')](_0x2485c2,{'transaction':_0x26a2f7});});}else{_0x23c229=0x194;_0xe14ce0=[];}});})['then'](function(){if(_0x23c229!==0x194){return db[_0x22c9('0x99')][_0x22c9('0x9b')]({'where':{'MailAccountId':_0x46ff96},'order':'priority'})[_0x22c9('0x12')](function(_0x399900){_0xe14ce0=_0x399900;});}})['catch'](function(_0x3edf3f){_0x23c229=0x1f4;logger[_0x22c9('0x19')](_0x3edf3f['stack']);if(_0x3edf3f[_0x22c9('0x2a')]){delete _0x3edf3f[_0x22c9('0x2a')];}_0xe14ce0=_0x3edf3f;})[_0x22c9('0x9c')](function(){if(_0xe14ce0===null){_0xeaf766[_0x22c9('0x28')](_0x23c229);}else{if(_0x23c229===0x1f4){_0xeaf766[_0x22c9('0x1d')](_0x23c229)[_0x22c9('0x2b')](_0xe14ce0);}else{_0xeaf766[_0x22c9('0x1d')](_0x23c229)['json'](_0xe14ce0);}}});};exports[_0x22c9('0x9d')]=function(_0x13fe9f,_0x1475a2){var _0x2e68d8={};var _0x2de164={};var _0x29d9c7;var _0x28c0b7;return db[_0x22c9('0x60')]['findOne']({'where':{'id':_0x13fe9f[_0x22c9('0x68')]['id']}})['then'](handleEntityNotFound(_0x1475a2,null))['then'](function(_0x403d29){if(_0x403d29){_0x29d9c7=_0x403d29;_0x2de164[_0x22c9('0x4d')]=_[_0x22c9('0x4f')](db['MailApplication']['rawAttributes']);_0x2de164[_0x22c9('0x4e')]=_[_0x22c9('0x4f')](_0x13fe9f[_0x22c9('0x4e')]);_0x2de164[_0x22c9('0x50')]=_[_0x22c9('0x51')](_0x2de164[_0x22c9('0x4d')],_0x2de164[_0x22c9('0x4e')]);_0x2e68d8['attributes']=_[_0x22c9('0x51')](_0x2de164[_0x22c9('0x4d')],qs[_0x22c9('0x53')](_0x13fe9f[_0x22c9('0x4e')]['fields']));_0x2e68d8[_0x22c9('0x52')]=_0x2e68d8['attributes'][_0x22c9('0x54')]?_0x2e68d8['attributes']:_0x2de164[_0x22c9('0x4d')];_0x2e68d8['order']=qs['sort'](_0x13fe9f[_0x22c9('0x4e')][_0x22c9('0x58')]);_0x2e68d8[_0x22c9('0x59')]=qs[_0x22c9('0x50')](_[_0x22c9('0x5a')](_0x13fe9f[_0x22c9('0x4e')],_0x2de164['filters']));if(_0x13fe9f[_0x22c9('0x4e')][_0x22c9('0x5b')]){_0x2e68d8[_0x22c9('0x59')]=_['merge'](_0x2e68d8[_0x22c9('0x59')],{'$or':_[_0x22c9('0x48')](_0x2e68d8[_0x22c9('0x52')],function(_0x4cd355){var _0x431163={};_0x431163[_0x4cd355]={'$like':'%'+_0x13fe9f[_0x22c9('0x4e')][_0x22c9('0x5b')]+'%'};return _0x431163;})});}_0x2e68d8=_[_0x22c9('0x5c')]({},_0x2e68d8,_0x13fe9f['options']);return _0x29d9c7[_0x22c9('0x9d')](_0x2e68d8);}})[_0x22c9('0x12')](function(_0xac2dba){if(_0xac2dba){_0x28c0b7=_0xac2dba[_0x22c9('0x54')];if(!_0x13fe9f[_0x22c9('0x4e')]['hasOwnProperty'](_0x22c9('0x56'))){_0x2e68d8[_0x22c9('0x21')]=qs['limit'](_0x13fe9f[_0x22c9('0x4e')][_0x22c9('0x21')]);_0x2e68d8[_0x22c9('0x20')]=qs['offset'](_0x13fe9f[_0x22c9('0x4e')][_0x22c9('0x20')]);}return _0x29d9c7[_0x22c9('0x9d')](_0x2e68d8);}})[_0x22c9('0x12')](function(_0x3be156){if(_0x3be156){return _0x3be156?{'count':_0x28c0b7,'rows':_0x3be156}:null;}})[_0x22c9('0x12')](respondWithResult(_0x1475a2,null))[_0x22c9('0x1c')](handleError(_0x1475a2,null));};exports['getMessages']=function(_0x2e0a54,_0x5f2b30){var _0xc0f296={'raw':!![],'where':{}};var _0x1b912b={};var _0x5bf827={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2e0a54['params']['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x5f2b30,null))[_0x22c9('0x12')](function(_0x35cf06){if(_0x35cf06){_0x1b912b[_0x22c9('0x4d')]=_['keys'](db[_0x22c9('0x9e')][_0x22c9('0x49')]);_0x1b912b['query']=_['keys'](_0x2e0a54[_0x22c9('0x4e')]);_0x1b912b['filters']=_[_0x22c9('0x51')](_0x1b912b['model'],_0x1b912b[_0x22c9('0x4e')]);_0xc0f296['attributes']=_['intersection'](_0x1b912b[_0x22c9('0x4d')],qs['fields'](_0x2e0a54[_0x22c9('0x4e')]['fields']));_0xc0f296[_0x22c9('0x52')]=_0xc0f296['attributes'][_0x22c9('0x54')]?_0xc0f296[_0x22c9('0x52')]:_0x1b912b[_0x22c9('0x4d')];if(!_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x55')](_0x22c9('0x56'))){_0xc0f296[_0x22c9('0x21')]=qs[_0x22c9('0x21')](_0x2e0a54[_0x22c9('0x4e')]['limit']);_0xc0f296[_0x22c9('0x20')]=qs[_0x22c9('0x20')](_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x20')]);}_0xc0f296[_0x22c9('0x57')]=qs['sort'](_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x58')]);_0xc0f296[_0x22c9('0x59')]=qs[_0x22c9('0x50')](_['pick'](_0x2e0a54[_0x22c9('0x4e')],_0x1b912b['filters']));_0xc0f296[_0x22c9('0x59')][_0x22c9('0x6c')]=_0x35cf06['id'];if(_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x5b')]){_0xc0f296['where']=_['merge'](_0xc0f296[_0x22c9('0x59')],{'$or':_[_0x22c9('0x48')](_0xc0f296[_0x22c9('0x52')],function(_0x30c856){var _0x5dd407={};_0x5dd407[_0x30c856]={'$like':'%'+_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x5b')]+'%'};return _0x5dd407;})});}if(_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x9f')]){var _0x4f0b29=_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x9f')][_0x22c9('0xa0')](',');var _0x2f9c85={};_0x2f9c85[_0x4f0b29[0x0]]={'$gte':moment(_0x4f0b29[0x1])[_0x22c9('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0xc0f296[_0x22c9('0x59')]=_[_0x22c9('0x5c')](_0xc0f296[_0x22c9('0x59')],_0x2f9c85);}_0xc0f296=_[_0x22c9('0x5c')]({},_0xc0f296,_0x2e0a54[_0x22c9('0x5d')]);return db[_0x22c9('0x9e')]['count']({'where':_0xc0f296[_0x22c9('0x59')]})['then'](function(_0x4f72e6){_0x5bf827[_0x22c9('0x23')]=_0x4f72e6;if(_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x5e')]){_0xc0f296[_0x22c9('0x5f')]=[{'all':!![]}];}return db[_0x22c9('0x9e')][_0x22c9('0x61')](_0xc0f296);})[_0x22c9('0x12')](function(_0x5f3e78){if(_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0xa2')]===_0x22c9('0xa3')){for(var _0x3b890d=0x0;_0x3b890d<_0x5f3e78[_0x22c9('0x54')];_0x3b890d++){_0x5f3e78[_0x3b890d][_0x22c9('0x65')]=juice(_0x5f3e78[_0x3b890d][_0x22c9('0x65')]);}}_0x5bf827[_0x22c9('0x62')]=_0x5f3e78;return _0x5bf827;});}})[_0x22c9('0x12')](respondWithFilteredResult(_0x5f2b30,_0xc0f296))[_0x22c9('0x1c')](handleError(_0x5f2b30,null));};exports[_0x22c9('0x2b')]=function(_0x42e937,_0x5ecf58){var _0x3c259a,_0x49806b={},_0x3b81ac;if(_0x42e937[_0x22c9('0x65')]['to']){_0x3b81ac=_0x42e937[_0x22c9('0x65')]['to'][_0x22c9('0xa0')](',')[0x0];}return db['MailAccount'][_0x22c9('0x64')]({'where':{'id':_0x42e937[_0x22c9('0x68')]['id']},'include':[{'model':db['CmList'],'as':_0x22c9('0xa4'),'include':[{'model':db[_0x22c9('0x8d')],'as':_0x22c9('0xa5'),'where':{'email':_0x3b81ac},'limit':0x1,'order':[[_0x22c9('0xa6'),_0x22c9('0xa7')]]}]},{'model':db[_0x22c9('0x45')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x22c9('0xa8'),'raw':!![]}]}]})[_0x22c9('0x12')](handleEntityNotFound(_0x5ecf58,null))[_0x22c9('0x12')](function(_0x59ebca){if(!_0x59ebca)return;_0x3c259a=_0x59ebca;if(!_0x59ebca['Smtp'])throw new Error(_0x22c9('0xa9'));if(_[_0x22c9('0xaa')](_0x42e937[_0x22c9('0x65')][_0x22c9('0xab')])){_0x42e937[_0x22c9('0x65')][_0x22c9('0xab')]=util[_0x22c9('0xa1')]('%s\x20<%s>',_0x59ebca[_0x22c9('0x2a')],_0x59ebca['email']||_0x59ebca[_0x22c9('0x42')][_0x22c9('0x37')]);}if(_0x42e937[_0x22c9('0x65')]['attachments']&&_0x42e937[_0x22c9('0x65')][_0x22c9('0xac')][_0x22c9('0x54')]){for(var _0x2aa3ca=0x0;_0x2aa3ca<_0x42e937['body'][_0x22c9('0xac')][_0x22c9('0x54')];_0x2aa3ca+=0x1){_0x42e937[_0x22c9('0x65')][_0x22c9('0xac')][_0x2aa3ca]={'filename':_0x42e937[_0x22c9('0x65')][_0x22c9('0xac')][_0x2aa3ca][_0x22c9('0x2a')],'path':path[_0x22c9('0xad')](config[_0x22c9('0xae')],_0x22c9('0xaf'),_0x42e937[_0x22c9('0x65')][_0x22c9('0xac')][_0x2aa3ca][_0x22c9('0xb0')])};}}var _0x41608b=_0x59ebca[_0x22c9('0xb1')]();return respondWithRpcPromise(_0x22c9('0xb2'),'sendMail',{'account':_0x41608b,'message':_0x42e937['body']});})[_0x22c9('0x12')](function(_0x58a607){if(!_0x58a607)return;_0x49806b=_0x58a607;if(!_0x3c259a[_0x22c9('0xa4')])throw new Error(_0x22c9('0xb3'));if(_0x3c259a[_0x22c9('0xa4')][_0x22c9('0xa5')][_0x22c9('0x54')])return _0x3c259a[_0x22c9('0xa4')][_0x22c9('0xa5')][0x0];return db['CmContact']['create'](_['defaults'](_0x42e937[_0x22c9('0x65')],{'firstName':_0x42e937[_0x22c9('0x65')]['to'],'email':_0x42e937[_0x22c9('0x65')]['to'],'phone':_0x42e937[_0x22c9('0x65')]['to'],'ListId':_0x3c259a[_0x22c9('0x76')]}));})['then'](function(_0x587e88){if(!_0x587e88)return;var _0x1db98c={'UserId':_0x42e937['user']['id'],'ContactId':_0x587e88['id'],'MailAccountId':_0x3c259a['id'],'inReplyTo':_0x49806b[_0x22c9('0xb4')],'to':_0x42e937[_0x22c9('0x65')][_0x22c9('0xab')],'cc':_0x42e937['body']['cc'],'subject':_0x42e937[_0x22c9('0x65')][_0x22c9('0xb5')],'attach':_0x42e937['body'][_0x22c9('0xb6')],'firstMsgDirection':_0x22c9('0xb7'),'lastMsgAt':moment()[_0x22c9('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x22c9('0xb7'),'Messages':[_[_0x22c9('0x5c')](_0x42e937[_0x22c9('0x65')],{'messageId':_0x49806b[_0x22c9('0xb4')],'sentAt':moment()[_0x22c9('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3c259a['id'],'UserId':_0x42e937[_0x22c9('0x37')]['id'],'ContactId':_0x587e88['id']})]};if(_0x42e937['body']['Interaction']){_0x1db98c=_[_0x22c9('0x5c')](_0x1db98c,_0x42e937[_0x22c9('0x65')][_0x22c9('0xb8')]);}return db[_0x22c9('0x8a')]['create'](_0x1db98c,{'include':[{'model':db[_0x22c9('0x9e')],'as':_0x22c9('0xb9')}]});})[_0x22c9('0x12')](respondWithResult(_0x5ecf58,null))[_0x22c9('0x1c')](handleError(_0x5ecf58,null));};exports[_0x22c9('0xba')]=function(_0x1bec44,_0x2539dc){return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x1bec44[_0x22c9('0x68')]['id']},'include':[{'model':db[_0x22c9('0x45')],'as':_0x22c9('0x42'),'raw':!![],'include':[{'model':db[_0x22c9('0xa8')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x2539dc,null))['then'](function(_0xb69aaf){if(!_0xb69aaf['Smtp'])return;var _0x515d55=_0xb69aaf['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x515d55});})[_0x22c9('0x12')](respondWithResult(_0x2539dc,null))[_0x22c9('0x1c')](handleError(_0x2539dc,null));};exports['destroy']=function(_0x3de68d,_0x426ede){return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x3de68d[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x426ede,null))[_0x22c9('0x12')](function(_0x3d59b4){if(_0x3d59b4&&_0x3d59b4[_0x22c9('0x40')]){throw new db[(_0x22c9('0xbb'))][(_0x22c9('0xbc'))](_0x22c9('0xbd'));}return _0x3d59b4;})[_0x22c9('0x12')](removeEntity(_0x426ede,null))[_0x22c9('0x1c')](handleError(_0x426ede,null));};exports[_0x22c9('0xbe')]=function(_0x102fb6,_0x4a9148){return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x102fb6[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x4a9148,null))['then'](function(_0x433ee1){if(_0x433ee1){return _0x433ee1[_0x22c9('0xbe')](_0x102fb6[_0x22c9('0x65')][_0x22c9('0x71')],_[_0x22c9('0x8b')](_0x102fb6[_0x22c9('0x65')],[_0x22c9('0x71'),'id'])||{})[_0x22c9('0xbf')](function(_0x27feed){for(var _0x28dc3b=0x0;_0x28dc3b<_0x102fb6['body']['ids'][_0x22c9('0x54')];_0x28dc3b+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x102fb6[_0x22c9('0x65')]['ids'][_0x28dc3b]),'MailAccountId':Number(_0x102fb6[_0x22c9('0x68')]['id'])});}return _0x27feed;});}})[_0x22c9('0x12')](respondWithResult(_0x4a9148,null))[_0x22c9('0x1c')](handleError(_0x4a9148,null));};exports[_0x22c9('0xc0')]=function(_0x102a8b,_0x328882){return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x102a8b[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x328882,null))[_0x22c9('0x12')](function(_0x53598e){if(_0x53598e){return _0x53598e[_0x22c9('0xc0')](_0x102a8b[_0x22c9('0x4e')][_0x22c9('0x71')])['then'](function(){if(_['isArray'](_0x102a8b[_0x22c9('0x4e')][_0x22c9('0x71')])){for(var _0x4a4648=0x0;_0x4a4648<_0x102a8b[_0x22c9('0x4e')][_0x22c9('0x71')][_0x22c9('0x54')];_0x4a4648+=0x1){socket[_0x22c9('0xc1')]('userMailAccount:remove',{'UserId':Number(_0x102a8b[_0x22c9('0x4e')][_0x22c9('0x71')][_0x4a4648]),'MailAccountId':Number(_0x102a8b[_0x22c9('0x68')]['id'])});}}else{socket[_0x22c9('0xc1')](_0x22c9('0xc2'),{'UserId':Number(_0x102a8b[_0x22c9('0x4e')][_0x22c9('0x71')]),'MailAccountId':Number(_0x102a8b[_0x22c9('0x68')]['id'])});}});}})[_0x22c9('0x12')](respondWithStatusCode(_0x328882,null))[_0x22c9('0x1c')](handleError(_0x328882,null));};exports[_0x22c9('0xc3')]=function(_0x1a8314,_0x102e3f){var _0x41698a={};var _0x47ec82={};var _0xd5a75c;var _0x233dfc;return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x1a8314[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x102e3f,null))[_0x22c9('0x12')](function(_0x4f45d4){if(_0x4f45d4){_0xd5a75c=_0x4f45d4;_0x47ec82[_0x22c9('0x4d')]=_['keys'](db[_0x22c9('0xc4')][_0x22c9('0x49')]);_0x47ec82[_0x22c9('0x4e')]=_[_0x22c9('0x4f')](_0x1a8314[_0x22c9('0x4e')]);_0x47ec82[_0x22c9('0x50')]=_[_0x22c9('0x51')](_0x47ec82[_0x22c9('0x4d')],_0x47ec82['query']);_0x41698a[_0x22c9('0x52')]=_[_0x22c9('0x51')](_0x47ec82[_0x22c9('0x4d')],qs[_0x22c9('0x53')](_0x1a8314[_0x22c9('0x4e')][_0x22c9('0x53')]));_0x41698a[_0x22c9('0x52')]=_0x41698a[_0x22c9('0x52')][_0x22c9('0x54')]?_0x41698a[_0x22c9('0x52')]:_0x47ec82[_0x22c9('0x4d')];_0x41698a[_0x22c9('0x57')]=qs['sort'](_0x1a8314[_0x22c9('0x4e')]['sort']);_0x41698a['where']=qs[_0x22c9('0x50')](_['pick'](_0x1a8314[_0x22c9('0x4e')],_0x47ec82[_0x22c9('0x50')]));if(_0x1a8314['query'][_0x22c9('0x5b')]){_0x41698a['where']=_[_0x22c9('0x5c')](_0x41698a[_0x22c9('0x59')],{'$or':_[_0x22c9('0x48')](_0x41698a['attributes'],function(_0xd738d5){var _0x8da21={};_0x8da21[_0xd738d5]={'$like':'%'+_0x1a8314['query']['filter']+'%'};return _0x8da21;})});}_0x41698a=_[_0x22c9('0x5c')]({},_0x41698a,_0x1a8314[_0x22c9('0x5d')]);return _0xd5a75c[_0x22c9('0xc3')](_0x41698a);}})[_0x22c9('0x12')](function(_0x4e3cdc){if(_0x4e3cdc){_0x233dfc=_0x4e3cdc[_0x22c9('0x54')];if(!_0x1a8314[_0x22c9('0x4e')][_0x22c9('0x55')](_0x22c9('0x56'))){_0x41698a[_0x22c9('0x21')]=qs['limit'](_0x1a8314[_0x22c9('0x4e')][_0x22c9('0x21')]);_0x41698a['offset']=qs[_0x22c9('0x20')](_0x1a8314[_0x22c9('0x4e')]['offset']);}return _0xd5a75c[_0x22c9('0xc3')](_0x41698a);}})['then'](function(_0x1e7d93){if(_0x1e7d93){return _0x1e7d93?{'count':_0x233dfc,'rows':_0x1e7d93}:null;}})[_0x22c9('0x12')](respondWithResult(_0x102e3f,null))[_0x22c9('0x1c')](handleError(_0x102e3f,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 8753604..d6e72f3 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 _0xda2d=['remove','emit','hook','exports','../../mysqldb','MailAccount','save'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0xda2d,0xb3));var _0xdda2=function(_0x159229,_0x57af10){_0x159229=_0x159229-0x0;var _0x21b019=_0xda2d[_0x159229];return _0x21b019;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xdda2('0x0'))['db'][_0xdda2('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdda2('0x2'),'afterUpdate':'update','afterDestroy':_0xdda2('0x3')};function emitEvent(_0x5f2940){return function(_0x6f07af,_0x30f5e0,_0x12e325){MailAccountEvents[_0xdda2('0x4')](_0x5f2940+':'+_0x6f07af['id'],_0x6f07af);MailAccountEvents[_0xdda2('0x4')](_0x5f2940,_0x6f07af);_0x12e325(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xdda2('0x5')](e,emitEvent(event));}}module[_0xdda2('0x6')]=MailAccountEvents; \ No newline at end of file +var _0xa49e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update'];(function(_0x815012,_0xcdd478){var _0x500529=function(_0x202751){while(--_0x202751){_0x815012['push'](_0x815012['shift']());}};_0x500529(++_0xcdd478);}(_0xa49e,0x1de));var _0xea49=function(_0x1f8057,_0x29937c){_0x1f8057=_0x1f8057-0x0;var _0x530ae5=_0xa49e[_0x1f8057];return _0x530ae5;};'use strict';var EventEmitter=require(_0xea49('0x0'));var MailAccount=require(_0xea49('0x1'))['db'][_0xea49('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xea49('0x3')](0x0);var events={'afterCreate':_0xea49('0x4'),'afterUpdate':_0xea49('0x5'),'afterDestroy':_0xea49('0x6')};function emitEvent(_0x228052){return function(_0x5e12d0,_0x2ef1ec,_0x439b3d){MailAccountEvents[_0xea49('0x7')](_0x228052+':'+_0x5e12d0['id'],_0x5e12d0);MailAccountEvents['emit'](_0x228052,_0x5e12d0);_0x439b3d(null);};}for(var e in events){if(events[_0xea49('0x8')](e)){var event=events[e];MailAccount[_0xea49('0x9')](e,emitEvent(event));}}module[_0xea49('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 7014a4b..b8bb483 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 _0x5bea=['Smtp','port','authentication','modernAuthentication','CloudProvider','auth','OAuth2','exports','mail_accounts','provider','custom','service','host'];(function(_0x5ef061,_0x11915f){var _0x44ec9c=function(_0x26d044){while(--_0x26d044){_0x5ef061['push'](_0x5ef061['shift']());}};_0x44ec9c(++_0x11915f);}(_0x5bea,0x166));var _0xa5be=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5bea[_0x1cc8fe];return _0x230054;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xa5be('0x0')]=function(_0x40e8f7){return _0x40e8f7['define']('MailAccount',attributes,{'tableName':_0xa5be('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x39fc62=this;var _0x4da3ca={'id':_0x39fc62['id'],'tls':{'rejectUnauthorized':![]}};if(_0x39fc62[_0xa5be('0x2')]!==_0xa5be('0x3')){_0x4da3ca[_0xa5be('0x4')]=_0x39fc62['provider'];}else{_0x4da3ca[_0xa5be('0x5')]=_0x39fc62[_0xa5be('0x6')][_0xa5be('0x5')];_0x4da3ca[_0xa5be('0x7')]=_0x39fc62[_0xa5be('0x6')][_0xa5be('0x7')];_0x4da3ca['secure']=_0x39fc62[_0xa5be('0x6')]['secure'];}if(_0x39fc62[_0xa5be('0x6')][_0xa5be('0x8')]){if(_0x39fc62[_0xa5be('0x6')][_0xa5be('0x9')]){if(!_0x39fc62['Smtp'][_0xa5be('0xa')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x4da3ca[_0xa5be('0xb')]={'type':_0xa5be('0xc'),'user':_0x39fc62[_0xa5be('0x6')]['user'],'accessToken':_0x39fc62['Smtp'][_0xa5be('0xa')]['data5']};}else{_0x4da3ca['auth']={'user':_0x39fc62[_0xa5be('0x6')]['user'],'pass':_0x39fc62[_0xa5be('0x6')]['pass']};}}return _0x4da3ca;}}});}; \ No newline at end of file +var _0x59c4=['provider','custom','service','host','port','Smtp','secure','authentication','modernAuthentication','auth','OAuth2','user','CloudProvider','data5','pass','./mailAccount.attributes','exports','mail_accounts'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x59c4,0x9f));var _0x459c=function(_0xeb45bf,_0xb9e836){_0xeb45bf=_0xeb45bf-0x0;var _0x17f563=_0x59c4[_0xeb45bf];return _0x17f563;};'use strict';var attributes=require(_0x459c('0x0'));module[_0x459c('0x1')]=function(_0x1e3a77){return _0x1e3a77['define']('MailAccount',attributes,{'tableName':_0x459c('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5bfa3b=this;var _0x2b7d0c={'id':_0x5bfa3b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5bfa3b[_0x459c('0x3')]!==_0x459c('0x4')){_0x2b7d0c[_0x459c('0x5')]=_0x5bfa3b[_0x459c('0x3')];}else{_0x2b7d0c[_0x459c('0x6')]=_0x5bfa3b['Smtp'][_0x459c('0x6')];_0x2b7d0c[_0x459c('0x7')]=_0x5bfa3b[_0x459c('0x8')][_0x459c('0x7')];_0x2b7d0c[_0x459c('0x9')]=_0x5bfa3b[_0x459c('0x8')]['secure'];}if(_0x5bfa3b[_0x459c('0x8')][_0x459c('0xa')]){if(_0x5bfa3b[_0x459c('0x8')][_0x459c('0xb')]){if(!_0x5bfa3b['Smtp']['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x2b7d0c[_0x459c('0xc')]={'type':_0x459c('0xd'),'user':_0x5bfa3b[_0x459c('0x8')][_0x459c('0xe')],'accessToken':_0x5bfa3b['Smtp'][_0x459c('0xf')][_0x459c('0x10')]};}else{_0x2b7d0c[_0x459c('0xc')]={'user':_0x5bfa3b[_0x459c('0x8')][_0x459c('0xe')],'pass':_0x5bfa3b[_0x459c('0x8')][_0x459c('0x11')]};}}return _0x2b7d0c;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 975e459..1be7af8 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 _0x5f66=['../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','request\x20sent','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','where','limit','include','map','model','attributes','stringify','find','smtp','smtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','omit','getSmtpOptions','list','applications','orderBy','priority','autoclose','push','close','defaults','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','YYYY-MM-DD\x20HH:mm:ss','interaction','MailMessage','create','attachments','originTo','originCc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','UserId','name','unshift','agent','*,*,*,*','startRouting','Start','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var BPromise=require('bluebird');var rs=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var db=require(_0x65f6('0x3'))['db'];var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x6'));var client=jayson['client'][_0x65f6('0x7')]({'port':0x232c});config[_0x65f6('0x8')]=_['defaults'](config['redis'],{'host':_0x65f6('0x9'),'port':0x18eb});var socket=require(_0x65f6('0xa'))(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0xb'))[_0x65f6('0xc')](socket);function respondWithRpcPromise(_0x14f4c7,_0x48d85c,_0x5123ee){return new BPromise(function(_0x18fea1,_0x2f6d5b){return client[_0x65f6('0xd')](_0x14f4c7,_0x5123ee)[_0x65f6('0xe')](function(_0x50d26d){logger[_0x65f6('0xf')]('MailAccount,\x20%s,\x20%s',_0x48d85c,'request\x20sent');logger[_0x65f6('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x48d85c,_0x65f6('0x11'),JSON['stringify'](_0x50d26d));if(_0x50d26d[_0x65f6('0x12')]){if(_0x50d26d[_0x65f6('0x12')][_0x65f6('0x13')]===0x1f4){logger[_0x65f6('0x12')](_0x65f6('0x14'),_0x48d85c,_0x50d26d[_0x65f6('0x12')][_0x65f6('0x15')]);return _0x2f6d5b(_0x50d26d[_0x65f6('0x12')][_0x65f6('0x15')]);}logger[_0x65f6('0x12')]('MailAccount,\x20%s,\x20%s',_0x48d85c,_0x50d26d[_0x65f6('0x12')]['message']);return _0x18fea1(_0x50d26d['error'][_0x65f6('0x15')]);}else{logger[_0x65f6('0xf')](_0x65f6('0x14'),_0x48d85c,_0x65f6('0x11'));_0x18fea1(_0x50d26d[_0x65f6('0x16')][_0x65f6('0x15')]);}})[_0x65f6('0x17')](function(_0x18380e){logger['error']('MailAccount,\x20%s,\x20%s',_0x48d85c,_0x18380e);_0x2f6d5b(_0x18380e);});});}exports[_0x65f6('0x18')]=function(_0x5b4055){var _0x4c81f3=this;return new Promise(function(_0x5c5b91,_0x365159){return db[_0x65f6('0x19')]['findAll']({'raw':_0x5b4055[_0x65f6('0x1a')]?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b4055[_0x65f6('0x1a')]?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1c')]||null:null,'attributes':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')]['attributes']||null:null,'limit':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1d')]||null:null,'include':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x5b4055[_0x65f6('0x1a')]['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x20')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x21')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x20')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes'],'include':_0x29abdb[_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x29abdb['include'],function(_0x325cb4){return{'model':db[_0x325cb4[_0x65f6('0x20')]],'as':_0x325cb4['as'],'attributes':_0x325cb4[_0x65f6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ac04b){logger['info'](_0x65f6('0x18'),_0x5b4055);logger[_0x65f6('0x10')](_0x65f6('0x18'),_0x5b4055,JSON[_0x65f6('0x22')](_0x4ac04b));_0x5c5b91(_0x4ac04b);})[_0x65f6('0x17')](function(_0x14a387){logger[_0x65f6('0x12')]('GetMailAccount',_0x14a387['message'],_0x5b4055);_0x365159(_0x4c81f3[_0x65f6('0x12')](0x1f4,_0x14a387[_0x65f6('0x15')]));});});};exports['ShowMailAccount']=function(_0x4e50c0){var _0x10b368=this;return new Promise(function(_0x1ce43c,_0x11fe3b){return db[_0x65f6('0x19')][_0x65f6('0x23')]({'raw':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0['options'][_0x65f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')]['where']||null:null,'attributes':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x21')]||null:null,'include':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x1e')]?_['map'](_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x1e')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x20')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1e')]?_['map'](_0x4f3e22[_0x65f6('0x1e')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x21')],'include':_0x24f7fd[_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x24f7fd['include'],function(_0x582c7e){return{'model':db[_0x582c7e[_0x65f6('0x20')]],'as':_0x582c7e['as'],'attributes':_0x582c7e['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xe')](function(_0x4e6653){if(_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x24')]===!![])_0x4e6653['setDataValue'](_0x65f6('0x25'),_0x4e6653['getSmtpOptions']());logger['info'](_0x65f6('0x26'),_0x4e50c0);logger[_0x65f6('0x10')](_0x65f6('0x26'),_0x4e50c0,JSON[_0x65f6('0x22')](_0x4e6653));_0x1ce43c(_0x4e6653);})[_0x65f6('0x17')](function(_0x28845a){logger[_0x65f6('0x12')](_0x65f6('0x26'),_0x28845a['message'],_0x4e50c0);_0x11fe3b(_0x10b368[_0x65f6('0x12')](0x1f4,_0x28845a['message']));});});};exports[_0x65f6('0x27')]=function(_0xa4394a){var _0x4ba7db=this;return new Promise(function(_0x2ea7f7,_0x5ef5c2){var _0x32148f={'body':_0xa4394a[_0x65f6('0x28')],'channel':_0x65f6('0x29')};var _0x3fb1c6=_[_0x65f6('0x2a')](_[_0x65f6('0x2b')](db[_0x65f6('0x2c')][_0x65f6('0x2d')]),[_0x65f6('0x2e'),'updatedAt',_0x65f6('0x2f'),_0x65f6('0x30')]);var _0x377ae5=![];if(_0xa4394a[_0x65f6('0x28')]['id']){delete _0xa4394a[_0x65f6('0x28')]['id'];}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')])){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,_0x65f6('0x33')));}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')])||_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')]===''){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')])){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3fb1c6));}if(!_[_0x65f6('0x35')](_0x3fb1c6,_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')])){return _0x5ef5c2(_0x4ba7db['error'](0x1f4,_0x65f6('0x36')+_0x3fb1c6));}var _0x3386a2={};_0x3386a2[_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')]]=_0xa4394a['body'][_0x65f6('0x32')];return db['MailAccount'][_0x65f6('0x23')]({'where':{'id':_0xa4394a[_0x65f6('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x65f6('0x38'),'include':[{'model':db['CmContact'],'as':_0x65f6('0x39'),'where':_0x3386a2,'limit':0x1,'order':[[_0x65f6('0x3a'),_0x65f6('0x3b')]]}]},{'model':db[_0x65f6('0x3c')],'as':_0x65f6('0x3d')},{'model':db[_0x65f6('0x3e')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x65f6('0x3f')}]}]})[_0x65f6('0xe')](function(_0x3b647a){if(_0x3b647a&&_0x3b647a[_0x65f6('0x38')]){var _0x3b907c=_0x3b647a[_0x65f6('0x40')]({'plain':!![]});_0x32148f[_0x65f6('0x37')]=_[_0x65f6('0x41')](_0x3b907c,[_0x65f6('0x3d'),'List']);_0x32148f[_0x65f6('0x37')][_0x65f6('0x25')]=_0x3b647a[_0x65f6('0x42')]();_0x32148f['applications']=_0x3b907c[_0x65f6('0x3d')];_0x32148f[_0x65f6('0x43')]=_0x3b907c['List'];_0x32148f[_0x65f6('0x44')]=_[_0x65f6('0x45')](_0x32148f['applications'],[_0x65f6('0x46')],['asc']);if(_0x32148f[_0x65f6('0x37')]&&_0x32148f[_0x65f6('0x37')][_0x65f6('0x47')]){_0x32148f['applications'][_0x65f6('0x48')]({'id':0x0,'priority':_0x32148f[_0x65f6('0x44')]['length']+0x1,'app':_0x65f6('0x49'),'appdata':_0x65f6('0x47'),'interval':'*,*,*,*'});}if(_0x32148f[_0x65f6('0x37')][_0x65f6('0x3d')]){delete _0x32148f[_0x65f6('0x37')][_0x65f6('0x3d')];}if(_0x32148f[_0x65f6('0x37')][_0x65f6('0x38')]){delete _0x32148f[_0x65f6('0x37')][_0x65f6('0x38')];}if(_0x3b907c['List']['Contacts']['length']){return _0x3b907c[_0x65f6('0x38')][_0x65f6('0x39')][0x0];}var _0x111a8a=_[_0x65f6('0x4a')](_0xa4394a['body'],{'firstName':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')],'ListId':_0x3b907c[_0x65f6('0x30')]});_0x111a8a[_0xa4394a['body'][_0x65f6('0x34')]]=_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')];return db['CmContact']['create'](_0x111a8a);}else{throw new Error(_0x65f6('0x4b'));}})[_0x65f6('0xe')](function(_0x4125cb){_0x32148f[_0x65f6('0x4c')]=_0x4125cb;if(_0x4125cb){if(!_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')]){_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')]=rs[_0x65f6('0x4e')]()+'\x20'+_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')];}var _0x5ba9c6={'ContactId':_0x4125cb['id'],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id'],'inReplyTo':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['messageId'],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')],'cc':_0xa4394a[_0x65f6('0x28')]['message']['cc'],'subject':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4f')],'attach':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x50')],'lastMsgAt':moment()[_0x65f6('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x65f6('0x52')][_0x65f6('0x23')]({'where':{'closed':![],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id']},'include':[{'model':db['MailMessage'],'as':_0x65f6('0x53'),'attributes':[_0x65f6('0x4d')],'where':{'messageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x54')]}}]})[_0x65f6('0xe')](function(_0x5e4759){if(_0x5e4759){return[_0x5e4759,![]];}return db['MailInteraction']['create'](_0x5ba9c6)[_0x65f6('0xe')](function(_0x367d95){return[_0x367d95,!![]];});});}else{throw new Error(_0x65f6('0x55'));}})[_0x65f6('0x56')](function(_0xab6f0,_0x304cf9){if(_0xab6f0){_0x377ae5=_0x304cf9;if(!_0x304cf9){return _0xab6f0['update']({'inReplyTo':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['messageId'],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')],'cc':_0xa4394a['body'][_0x65f6('0x15')]['cc'],'subject':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x4f')],'attach':_0xab6f0[_0x65f6('0x50')]?_0xab6f0[_0x65f6('0x50')]:_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x50')],'substatus':null,'substatusAt':moment()[_0x65f6('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x65f6('0x57')),'lastMsgDirection':'in'});}else{return _0xab6f0;}}})[_0x65f6('0xe')](function(_0x4a9524){_0x32148f[_0x65f6('0x58')]=_0x4a9524['get']({'plain':!![]});_0x32148f[_0x65f6('0x58')]['created']=_0x377ae5;return db[_0x65f6('0x59')][_0x65f6('0x5a')]({'body':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id'],'MailInteractionId':_0x4a9524['id'],'direction':'in','ContactId':_0x32148f[_0x65f6('0x4c')]['id'],'messageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')],'from':_0xa4394a['body']['message'][_0x65f6('0x32')],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['to'],'cc':_0xa4394a['body']['message']['cc'],'subject':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4f')],'attach':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x50')],'Attachments':_0xa4394a['body']['message'][_0x65f6('0x5b')],'originTo':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x5c')],'originCc':_0xa4394a['body'][_0x65f6('0x15')][_0x65f6('0x5d')],'bcc':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['bcc'],'ChatWebsiteId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x5e')]||null,'originChannel':_0xa4394a['body']['message'][_0x65f6('0x5f')]||'Email','ChatOfflineMessageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x60')]||null},{'include':[{'model':db[_0x65f6('0x61')],'as':'Attachments'}]});})['then'](function(_0x56f7f1){_0x32148f[_0x65f6('0x15')]=_0x56f7f1;if(_0x32148f[_0x65f6('0x58')][_0x65f6('0x62')]){return db['User'][_0x65f6('0x23')]({'attributes':['id',_0x65f6('0x63')],'where':{'id':_0x32148f[_0x65f6('0x58')]['UserId']}})[_0x65f6('0xe')](function(_0x15809e){if(_0x15809e){_0x32148f['applications'][_0x65f6('0x64')]({'id':0x0,'priority':0x0,'app':_0x65f6('0x65'),'appdata':_0x15809e['name']+','+(_0x32148f[_0x65f6('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x65f6('0x66')});}return respondWithRpcPromise('Start',_0x65f6('0x67'),_0x32148f);});}return respondWithRpcPromise(_0x65f6('0x68'),'startRouting',_0x32148f);})[_0x65f6('0xe')](function(_0x442e25){_0x2ea7f7(_0x442e25);})[_0x65f6('0x17')](function(_0x299b85){_0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,_0x299b85[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x2542=['MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','asc','push','length','*,*,*,*','Contacts','contact','messageId','generate','attach','format','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originCc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','map','include','model','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','Applications'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x2542,0x169));var _0x2254=function(_0x3a29b4,_0x2f9cc5){_0x3a29b4=_0x3a29b4-0x0;var _0x5f538b=_0x2542[_0x3a29b4];return _0x5f538b;};'use strict';var _=require(_0x2254('0x0'));var moment=require(_0x2254('0x1'));var BPromise=require(_0x2254('0x2'));var rs=require(_0x2254('0x3'));var Redis=require('ioredis');var db=require(_0x2254('0x4'))['db'];var logger=require('../../config/logger')(_0x2254('0x5'));var config=require(_0x2254('0x6'));var jayson=require(_0x2254('0x7'));var client=jayson[_0x2254('0x8')][_0x2254('0x9')]({'port':0x232c});config['redis']=_[_0x2254('0xa')](config[_0x2254('0xb')],{'host':_0x2254('0xc'),'port':0x18eb});var socket=require(_0x2254('0xd'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xe'))[_0x2254('0xf')](socket);function respondWithRpcPromise(_0xbf1c18,_0xb395da,_0x1ae415){return new BPromise(function(_0x38fb2b,_0x5b1ab9){return client[_0x2254('0x10')](_0xbf1c18,_0x1ae415)[_0x2254('0x11')](function(_0x506abe){logger[_0x2254('0x12')]('MailAccount,\x20%s,\x20%s',_0xb395da,'request\x20sent');logger[_0x2254('0x13')](_0x2254('0x14'),_0xb395da,_0x2254('0x15'),JSON[_0x2254('0x16')](_0x506abe));if(_0x506abe[_0x2254('0x17')]){if(_0x506abe[_0x2254('0x17')]['code']===0x1f4){logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe['error'][_0x2254('0x19')]);return _0x5b1ab9(_0x506abe[_0x2254('0x17')][_0x2254('0x19')]);}logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe[_0x2254('0x17')]['message']);return _0x38fb2b(_0x506abe[_0x2254('0x17')]['message']);}else{logger[_0x2254('0x12')](_0x2254('0x18'),_0xb395da,_0x2254('0x15'));_0x38fb2b(_0x506abe[_0x2254('0x1a')][_0x2254('0x19')]);}})[_0x2254('0x1b')](function(_0x497724){logger['error']('MailAccount,\x20%s,\x20%s',_0xb395da,_0x497724);_0x5b1ab9(_0x497724);});});}exports[_0x2254('0x1c')]=function(_0x3a79f8){var _0x3c3a98=this;return new Promise(function(_0x1f1163,_0x2801d9){return db[_0x2254('0x1d')]['findAll']({'raw':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a79f8['options']?_0x3a79f8['options']['where']||null:null,'attributes':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'limit':_0x3a79f8['options']?_0x3a79f8['options']['limit']||null:null,'include':_0x3a79f8['options']?_0x3a79f8['options']['include']?_[_0x2254('0x21')](_0x3a79f8[_0x2254('0x1e')][_0x2254('0x22')],function(_0x265467){return{'model':db[_0x265467[_0x2254('0x23')]],'as':_0x265467['as'],'attributes':_0x265467[_0x2254('0x20')],'include':_0x265467['include']?_['map'](_0x265467[_0x2254('0x22')],function(_0x4f6877){return{'model':db[_0x4f6877[_0x2254('0x23')]],'as':_0x4f6877['as'],'attributes':_0x4f6877[_0x2254('0x20')],'include':_0x4f6877[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4f6877[_0x2254('0x22')],function(_0x482688){return{'model':db[_0x482688[_0x2254('0x23')]],'as':_0x482688['as'],'attributes':_0x482688[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x37af8b){logger[_0x2254('0x12')](_0x2254('0x1c'),_0x3a79f8);logger[_0x2254('0x13')](_0x2254('0x1c'),_0x3a79f8,JSON[_0x2254('0x16')](_0x37af8b));_0x1f1163(_0x37af8b);})[_0x2254('0x1b')](function(_0x21c641){logger[_0x2254('0x17')](_0x2254('0x1c'),_0x21c641[_0x2254('0x19')],_0x3a79f8);_0x2801d9(_0x3c3a98[_0x2254('0x17')](0x1f4,_0x21c641[_0x2254('0x19')]));});});};exports[_0x2254('0x24')]=function(_0x291894){var _0x2f32f8=this;return new Promise(function(_0x4e3658,_0xe29526){return db[_0x2254('0x1d')][_0x2254('0x25')]({'raw':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x26')]||null:null,'attributes':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'include':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x22')]?_[_0x2254('0x21')](_0x291894[_0x2254('0x1e')]['include'],function(_0x4a2df0){return{'model':db[_0x4a2df0[_0x2254('0x23')]],'as':_0x4a2df0['as'],'attributes':_0x4a2df0['attributes'],'include':_0x4a2df0[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4a2df0[_0x2254('0x22')],function(_0x141ddc){return{'model':db[_0x141ddc[_0x2254('0x23')]],'as':_0x141ddc['as'],'attributes':_0x141ddc[_0x2254('0x20')],'include':_0x141ddc[_0x2254('0x22')]?_['map'](_0x141ddc[_0x2254('0x22')],function(_0x192e9f){return{'model':db[_0x192e9f[_0x2254('0x23')]],'as':_0x192e9f['as'],'attributes':_0x192e9f[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x3f6007){if(_0x291894[_0x2254('0x1e')][_0x2254('0x27')]===!![])_0x3f6007[_0x2254('0x28')](_0x2254('0x29'),_0x3f6007['getSmtpOptions']());logger[_0x2254('0x12')](_0x2254('0x24'),_0x291894);logger[_0x2254('0x13')](_0x2254('0x24'),_0x291894,JSON['stringify'](_0x3f6007));_0x4e3658(_0x3f6007);})[_0x2254('0x1b')](function(_0x160fec){logger[_0x2254('0x17')](_0x2254('0x24'),_0x160fec[_0x2254('0x19')],_0x291894);_0xe29526(_0x2f32f8[_0x2254('0x17')](0x1f4,_0x160fec[_0x2254('0x19')]));});});};exports[_0x2254('0x2a')]=function(_0x4db9a8){var _0x362ad1=this;return new Promise(function(_0x5c15d7,_0x1df9c3){var _0x19b580={'body':_0x4db9a8[_0x2254('0x2b')],'channel':_0x2254('0x2c')};var _0x460bb3=_[_0x2254('0x2d')](_[_0x2254('0x2e')](db['CmContact'][_0x2254('0x2f')]),[_0x2254('0x30'),_0x2254('0x31'),_0x2254('0x32'),_0x2254('0x33')]);var _0x57cda2=![];if(_0x4db9a8[_0x2254('0x2b')]['id']){delete _0x4db9a8[_0x2254('0x2b')]['id'];}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')])){return _0x1df9c3(_0x362ad1['error'](0x1f4,_0x2254('0x36')));}if(_['isNil'](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')])||_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')]===''){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x37')));}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x39')+_0x460bb3));}if(!_[_0x2254('0x3a')](_0x460bb3,_0x4db9a8[_0x2254('0x2b')]['mapKey'])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x3b')+_0x460bb3));}var _0x2c5609={};_0x2c5609[_0x4db9a8['body'][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x1d')][_0x2254('0x25')]({'where':{'id':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x3d')],'as':_0x2254('0x3e'),'include':[{'model':db[_0x2254('0x3f')],'as':'Contacts','where':_0x2c5609,'limit':0x1,'order':[[_0x2254('0x31'),_0x2254('0x40')]]}]},{'model':db[_0x2254('0x41')],'as':_0x2254('0x42')},{'model':db[_0x2254('0x43')],'as':_0x2254('0x44'),'include':[{'model':db[_0x2254('0x45')],'as':_0x2254('0x45')}]}]})[_0x2254('0x11')](function(_0xa103ea){if(_0xa103ea&&_0xa103ea['List']){var _0x36b977=_0xa103ea[_0x2254('0x46')]({'plain':!![]});_0x19b580['account']=_[_0x2254('0x47')](_0x36b977,[_0x2254('0x42'),_0x2254('0x3e')]);_0x19b580[_0x2254('0x3c')]['smtpOptions']=_0xa103ea[_0x2254('0x48')]();_0x19b580[_0x2254('0x49')]=_0x36b977['Applications'];_0x19b580[_0x2254('0x4a')]=_0x36b977[_0x2254('0x3e')];_0x19b580[_0x2254('0x49')]=_[_0x2254('0x4b')](_0x19b580['applications'],[_0x2254('0x4c')],[_0x2254('0x4d')]);if(_0x19b580[_0x2254('0x3c')]&&_0x19b580['account']['autoclose']){_0x19b580[_0x2254('0x49')][_0x2254('0x4e')]({'id':0x0,'priority':_0x19b580['applications'][_0x2254('0x4f')]+0x1,'app':'close','appdata':'autoclose','interval':_0x2254('0x50')});}if(_0x19b580[_0x2254('0x3c')][_0x2254('0x42')]){delete _0x19b580[_0x2254('0x3c')][_0x2254('0x42')];}if(_0x19b580['account']['List']){delete _0x19b580[_0x2254('0x3c')]['List'];}if(_0x36b977[_0x2254('0x3e')][_0x2254('0x51')][_0x2254('0x4f')]){return _0x36b977[_0x2254('0x3e')]['Contacts'][0x0];}var _0xd5fb20=_[_0x2254('0xa')](_0x4db9a8['body'],{'firstName':_0x4db9a8['body'][_0x2254('0x35')],'ListId':_0x36b977['ListId']});_0xd5fb20[_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x3f')]['create'](_0xd5fb20);}else{throw new Error('List\x20not\x20found');}})[_0x2254('0x11')](function(_0x5b1bd8){_0x19b580[_0x2254('0x52')]=_0x5b1bd8;if(_0x5b1bd8){if(!_0x4db9a8['body']['message']['messageId']){_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')]=rs[_0x2254('0x54')]()+'\x20'+_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')];}var _0x25137c={'ContactId':_0x5b1bd8['id'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')],'to':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'lastMsgAt':moment()[_0x2254('0x56')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x2254('0x25')]({'where':{'closed':![],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x57')],'as':_0x2254('0x58'),'attributes':[_0x2254('0x53')],'where':{'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x59')]}}]})[_0x2254('0x11')](function(_0x4a7d36){if(_0x4a7d36){return[_0x4a7d36,![]];}return db['MailInteraction'][_0x2254('0x5a')](_0x25137c)['then'](function(_0x294931){return[_0x294931,!![]];});});}else{throw new Error(_0x2254('0x5b'));}})['spread'](function(_0x3c091e,_0x1b154f){if(_0x3c091e){_0x57cda2=_0x1b154f;if(!_0x1b154f){return _0x3c091e['update']({'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['messageId'],'to':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8['body']['message']['cc'],'subject':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x5c')],'attach':_0x3c091e['attach']?_0x3c091e[_0x2254('0x55')]:_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'substatus':null,'substatusAt':moment()['format'](_0x2254('0x5d')),'lastMsgAt':moment()['format'](_0x2254('0x5d')),'lastMsgDirection':'in'});}else{return _0x3c091e;}}})[_0x2254('0x11')](function(_0x5ed07f){_0x19b580[_0x2254('0x5e')]=_0x5ed07f[_0x2254('0x46')]({'plain':!![]});_0x19b580['interaction'][_0x2254('0x5f')]=_0x57cda2;return db[_0x2254('0x57')][_0x2254('0x5a')]({'body':_0x4db9a8[_0x2254('0x2b')]['body'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'MailInteractionId':_0x5ed07f['id'],'direction':'in','ContactId':_0x19b580[_0x2254('0x52')]['id'],'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x53')],'from':_0x4db9a8['body'][_0x2254('0x19')]['from'],'to':_0x4db9a8[_0x2254('0x2b')]['message']['to'],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8['body'][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'Attachments':_0x4db9a8['body'][_0x2254('0x19')]['attachments'],'originTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['originTo'],'originCc':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x60')],'bcc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['bcc'],'ChatWebsiteId':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x61')]||null,'originChannel':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x62')]||_0x2254('0x63'),'ChatOfflineMessageId':_0x4db9a8['body'][_0x2254('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x2254('0x64')],'as':'Attachments'}]});})['then'](function(_0x4efb07){_0x19b580[_0x2254('0x19')]=_0x4efb07;if(_0x19b580['interaction'][_0x2254('0x65')]){return db[_0x2254('0x66')]['find']({'attributes':['id',_0x2254('0x67')],'where':{'id':_0x19b580[_0x2254('0x5e')][_0x2254('0x65')]}})[_0x2254('0x11')](function(_0x259e10){if(_0x259e10){_0x19b580[_0x2254('0x49')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x259e10[_0x2254('0x67')]+','+(_0x19b580[_0x2254('0x3c')][_0x2254('0x68')]||0xa),'interval':_0x2254('0x50')});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);})[_0x2254('0x11')](function(_0x39b95b){_0x5c15d7(_0x39b95b);})['catch'](function(_0x25eb17){_0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x25eb17['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a70a68d..1c98b8a 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 _0x1ab2=['register','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x1b85d3,_0x30e03d){var _0x5a5d80=function(_0x481275){while(--_0x481275){_0x1b85d3['push'](_0x1b85d3['shift']());}};_0x5a5d80(++_0x30e03d);}(_0x1ab2,0x198));var _0x21ab=function(_0x167d7a,_0x171205){_0x167d7a=_0x167d7a-0x0;var _0x40b744=_0x1ab2[_0x167d7a];return _0x40b744;};'use strict';var MailAccountEvents=require(_0x21ab('0x0'));var events=[_0x21ab('0x1'),_0x21ab('0x2'),_0x21ab('0x3')];function createListener(_0x3bbe68,_0x4e1889){return function(_0x23361e){_0x4e1889[_0x21ab('0x4')](_0x3bbe68,_0x23361e);};}function removeListener(_0x3ec3cb,_0x11613e){return function(){MailAccountEvents['removeListener'](_0x3ec3cb,_0x11613e);};}exports[_0x21ab('0x5')]=function(_0x26d8fa){for(var _0x2a6592=0x0,_0x506332=events['length'];_0x2a6592<_0x506332;_0x2a6592++){var _0x5ab675=events[_0x2a6592];var _0x3251c4=createListener(_0x21ab('0x6')+_0x5ab675,_0x26d8fa);MailAccountEvents['on'](_0x5ab675,_0x3251c4);}}; \ No newline at end of file +var _0x7551=['save','remove','update','emit','removeListener','register','./mailAccount.events'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7551,0x1a3));var _0x1755=function(_0x3e31e4,_0x1c6ae7){_0x3e31e4=_0x3e31e4-0x0;var _0x252fd5=_0x7551[_0x3e31e4];return _0x252fd5;};'use strict';var MailAccountEvents=require(_0x1755('0x0'));var events=[_0x1755('0x1'),_0x1755('0x2'),_0x1755('0x3')];function createListener(_0x231c83,_0x49d52d){return function(_0x279ef1){_0x49d52d[_0x1755('0x4')](_0x231c83,_0x279ef1);};}function removeListener(_0x46b0a1,_0x4d343d){return function(){MailAccountEvents[_0x1755('0x5')](_0x46b0a1,_0x4d343d);};}exports[_0x1755('0x6')]=function(_0x256e45){for(var _0x36aa5e=0x0,_0x21a4f0=events['length'];_0x36aa5e<_0x21a4f0;_0x36aa5e++){var _0x49015d=events[_0x36aa5e];var _0x44cebf=createListener('mailAccount:'+_0x49015d,_0x256e45);MailAccountEvents['on'](_0x49015d,_0x44cebf);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 687a401..ba0f9b7 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 _0xd36e=['fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd36e,0x1a3));var _0xed36=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd36e[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xed36('0x0'));var util=require(_0xed36('0x1'));var path=require(_0xed36('0x2'));var timeout=require(_0xed36('0x3'));var express=require(_0xed36('0x4'));var router=express[_0xed36('0x5')]();var fs_extra=require(_0xed36('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xed36('0x7'));var config=require(_0xed36('0x8'));var controller=require(_0xed36('0x9'));router[_0xed36('0xa')](_0xed36('0xb'),auth[_0xed36('0xc')](),controller[_0xed36('0xd')]);router[_0xed36('0xe')](_0xed36('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xed36('0xb'),auth[_0xed36('0xc')](),controller[_0xed36('0xf')]);module[_0xed36('0x10')]=router; \ No newline at end of file +var _0x678d=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','show'];(function(_0x46ab1c,_0x46e561){var _0x3fb929=function(_0xa5f65e){while(--_0xa5f65e){_0x46ab1c['push'](_0x46ab1c['shift']());}};_0x3fb929(++_0x46e561);}(_0x678d,0xe5));var _0xd678=function(_0x126967,_0x5fb1b4){_0x126967=_0x126967-0x0;var _0x2410ca=_0x678d[_0x126967];return _0x2410ca;};'use strict';var multer=require(_0xd678('0x0'));var util=require(_0xd678('0x1'));var path=require(_0xd678('0x2'));var timeout=require(_0xd678('0x3'));var express=require(_0xd678('0x4'));var router=express['Router']();var fs_extra=require(_0xd678('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd678('0x6'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0xd678('0x7')](_0xd678('0x8'),auth[_0xd678('0x9')](),controller[_0xd678('0xa')]);router[_0xd678('0xb')](_0xd678('0x8'),auth['isAuthenticated'](),controller[_0xd678('0xc')]);router[_0xd678('0xd')](_0xd678('0x8'),auth[_0xd678('0x9')](),controller[_0xd678('0xe')]);module[_0xd678('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 4aef458..17a5373 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 _0x1e96=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2918eb,_0x3f0e4e){var _0x1502e0=function(_0x16409f){while(--_0x16409f){_0x2918eb['push'](_0x2918eb['shift']());}};_0x1502e0(++_0x3f0e4e);}(_0x1e96,0x106));var _0x61e9=function(_0x271582,_0x1476e4){_0x271582=_0x271582-0x0;var _0x32d488=_0x1e96[_0x271582];return _0x32d488;};'use strict';var Sequelize=require(_0x61e9('0x0'));module[_0x61e9('0x1')]={'priority':{'type':Sequelize[_0x61e9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x61e9('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x61e9('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x61e9('0x3')],'defaultValue':_0x61e9('0x5')}}; \ No newline at end of file +var _0x3107=['*,*,*,*','INTEGER','STRING','noop'];(function(_0x54ce38,_0x97bbb0){var _0x133572=function(_0x416951){while(--_0x416951){_0x54ce38['push'](_0x54ce38['shift']());}};_0x133572(++_0x97bbb0);}(_0x3107,0x115));var _0x7310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3107[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x7310('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x7310('0x1')],'allowNull':![],'defaultValue':_0x7310('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7310('0x1')]},'interval':{'type':Sequelize[_0x7310('0x1')],'defaultValue':_0x7310('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index e883ed5..1f236ea 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x5ccd41,_0x520533){var _0x4133d6=function(_0x485cd5){while(--_0x485cd5){_0x5ccd41['push'](_0x5ccd41['shift']());}};_0x4133d6(++_0x520533);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x2eda7d,_0x162382){var _0x2fd21d=function(_0x3bf4d0){while(--_0x3bf4d0){_0x2eda7d['push'](_0x2eda7d['shift']());}};_0x2fd21d(++_0x162382);}(_0x70e0,0x17b));var _0x070e=function(_0x47d6a9,_0x32de4b){_0x47d6a9=_0x47d6a9-0x0;var _0x11c430=_0x70e0[_0x47d6a9];return _0x11c430;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a21463c..e73429b 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 _0x73fb=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x2dfde6,_0x34742c){var _0x553edd=function(_0x3836b4){while(--_0x3836b4){_0x2dfde6['push'](_0x2dfde6['shift']());}};_0x553edd(++_0x34742c);}(_0x73fb,0xd0));var _0xb73f=function(_0x3d21e1,_0x50f53e){_0x3d21e1=_0x3d21e1-0x0;var _0x73df13=_0x73fb[_0x3d21e1];return _0x73df13;};'use strict';var _=require(_0xb73f('0x0'));var util=require('util');var logger=require(_0xb73f('0x1'))(_0xb73f('0x2'));var moment=require(_0xb73f('0x3'));var BPromise=require(_0xb73f('0x4'));var rp=require(_0xb73f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb73f('0x6'));var config=require(_0xb73f('0x7'));var attributes=require(_0xb73f('0x8'));module[_0xb73f('0x9')]=function(_0x579f40,_0xadf0fb){return _0x579f40[_0xb73f('0xa')](_0xb73f('0xb'),attributes,{'tableName':_0xb73f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb73f('0xd'),'collate':_0xb73f('0xe')});}; \ No newline at end of file +var _0x2ba1=['bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0x2ba1,0x128));var _0x12ba=function(_0x1b0f2b,_0x7c3048){_0x1b0f2b=_0x1b0f2b-0x0;var _0x50ad9d=_0x2ba1[_0x1b0f2b];return _0x50ad9d;};'use strict';var _=require(_0x12ba('0x0'));var util=require('util');var logger=require(_0x12ba('0x1'))('api');var moment=require(_0x12ba('0x2'));var BPromise=require(_0x12ba('0x3'));var rp=require(_0x12ba('0x4'));var fs=require('fs');var path=require(_0x12ba('0x5'));var rimraf=require('rimraf');var config=require(_0x12ba('0x6'));var attributes=require(_0x12ba('0x7'));module[_0x12ba('0x8')]=function(_0x22277f,_0x1aff7f){return _0x22277f[_0x12ba('0x9')](_0x12ba('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x12ba('0xb'),'collate':_0x12ba('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9aaa2cf..23620a4 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 _0x8595=['stringify','error','code','message','info','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','MailApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x493759,_0x154e45){var _0x2f3a77=function(_0x1a5506){while(--_0x1a5506){_0x493759['push'](_0x493759['shift']());}};_0x2f3a77(++_0x154e45);}(_0x8595,0xc9));var _0x5859=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x8595[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0x5859('0x0'));var util=require(_0x5859('0x1'));var moment=require(_0x5859('0x2'));var BPromise=require(_0x5859('0x3'));var rs=require(_0x5859('0x4'));var fs=require('fs');var Redis=require(_0x5859('0x5'));var db=require(_0x5859('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5859('0x7'))('rpc');var config=require(_0x5859('0x8'));var jayson=require(_0x5859('0x9'));var client=jayson[_0x5859('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ee885,_0x546411,_0x573a73){return new BPromise(function(_0x685aa8,_0x2f8fad){return client[_0x5859('0xb')](_0x4ee885,_0x573a73)[_0x5859('0xc')](function(_0x39aa29){logger['info'](_0x5859('0xd'),_0x546411,'request\x20sent');logger[_0x5859('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x546411,_0x5859('0xf'),JSON[_0x5859('0x10')](_0x39aa29));if(_0x39aa29[_0x5859('0x11')]){if(_0x39aa29[_0x5859('0x11')][_0x5859('0x12')]===0x1f4){logger[_0x5859('0x11')]('MailApplication,\x20%s,\x20%s',_0x546411,_0x39aa29['error'][_0x5859('0x13')]);return _0x2f8fad(_0x39aa29[_0x5859('0x11')][_0x5859('0x13')]);}logger[_0x5859('0x11')](_0x5859('0xd'),_0x546411,_0x39aa29[_0x5859('0x11')]['message']);return _0x685aa8(_0x39aa29[_0x5859('0x11')]['message']);}else{logger[_0x5859('0x14')](_0x5859('0xd'),_0x546411,_0x5859('0xf'));_0x685aa8(_0x39aa29[_0x5859('0x15')][_0x5859('0x13')]);}})[_0x5859('0x16')](function(_0x1e17bd){logger[_0x5859('0x11')]('MailApplication,\x20%s,\x20%s',_0x546411,_0x1e17bd);_0x2f8fad(_0x1e17bd);});});}exports[_0x5859('0x17')]=function(_0x5da1eb){var _0x42c43c=this;return new Promise(function(_0x16c229,_0x1d5db8){return db['MailApplication'][_0x5859('0x18')](_0x5da1eb[_0x5859('0x19')],{'raw':_0x5da1eb[_0x5859('0x1a')]?_0x5da1eb[_0x5859('0x1a')][_0x5859('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5da1eb[_0x5859('0x1a')]?_0x5da1eb[_0x5859('0x1a')][_0x5859('0x1c')]||null:null,'attributes':_0x5da1eb[_0x5859('0x1a')]?_0x5da1eb[_0x5859('0x1a')][_0x5859('0x1d')]||null:null,'limit':_0x5da1eb['options']?_0x5da1eb[_0x5859('0x1a')][_0x5859('0x1e')]||null:null})[_0x5859('0xc')](function(_0x348683){logger[_0x5859('0x14')](_0x5859('0x17'),_0x5da1eb);logger['debug'](_0x5859('0x17'),_0x5da1eb,JSON[_0x5859('0x10')](_0x348683));_0x16c229(_0x348683);})[_0x5859('0x16')](function(_0x52307d){logger[_0x5859('0x11')]('UpdateMailApplication',_0x52307d[_0x5859('0x13')],_0x5da1eb);_0x1d5db8(_0x42c43c[_0x5859('0x11')](0x1f4,_0x52307d[_0x5859('0x13')]));});});}; \ No newline at end of file +var _0x7505=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','attributes','limit','lodash','util','moment','randomstring'];(function(_0x202f66,_0x3ee5aa){var _0x58448d=function(_0x45f67d){while(--_0x45f67d){_0x202f66['push'](_0x202f66['shift']());}};_0x58448d(++_0x3ee5aa);}(_0x7505,0x1cc));var _0x5750=function(_0x3f904f,_0x26ad0c){_0x3f904f=_0x3f904f-0x0;var _0x35058b=_0x7505[_0x3f904f];return _0x35058b;};'use strict';var _=require(_0x5750('0x0'));var util=require(_0x5750('0x1'));var moment=require(_0x5750('0x2'));var BPromise=require('bluebird');var rs=require(_0x5750('0x3'));var fs=require('fs');var Redis=require(_0x5750('0x4'));var db=require(_0x5750('0x5'))['db'];var utils=require(_0x5750('0x6'));var logger=require(_0x5750('0x7'))('rpc');var config=require(_0x5750('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5750('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34bfe1,_0x4ebbf4,_0x53bbaf){return new BPromise(function(_0x1301e0,_0x1a80e7){return client['request'](_0x34bfe1,_0x53bbaf)[_0x5750('0xa')](function(_0x135344){logger[_0x5750('0xb')](_0x5750('0xc'),_0x4ebbf4,_0x5750('0xd'));logger[_0x5750('0xe')](_0x5750('0xf'),_0x4ebbf4,'request\x20sent',JSON[_0x5750('0x10')](_0x135344));if(_0x135344['error']){if(_0x135344['error'][_0x5750('0x11')]===0x1f4){logger['error'](_0x5750('0xc'),_0x4ebbf4,_0x135344[_0x5750('0x12')]['message']);return _0x1a80e7(_0x135344[_0x5750('0x12')][_0x5750('0x13')]);}logger[_0x5750('0x12')]('MailApplication,\x20%s,\x20%s',_0x4ebbf4,_0x135344[_0x5750('0x12')][_0x5750('0x13')]);return _0x1301e0(_0x135344['error'][_0x5750('0x13')]);}else{logger['info'](_0x5750('0xc'),_0x4ebbf4,'request\x20sent');_0x1301e0(_0x135344[_0x5750('0x14')][_0x5750('0x13')]);}})[_0x5750('0x15')](function(_0x43edc4){logger[_0x5750('0x12')](_0x5750('0xc'),_0x4ebbf4,_0x43edc4);_0x1a80e7(_0x43edc4);});});}exports[_0x5750('0x16')]=function(_0x95a8ca){var _0x1b0e24=this;return new Promise(function(_0x265f12,_0x5d909c){return db[_0x5750('0x17')][_0x5750('0x18')](_0x95a8ca['body'],{'raw':_0x95a8ca['options']?_0x95a8ca[_0x5750('0x19')][_0x5750('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x95a8ca[_0x5750('0x19')]?_0x95a8ca['options']['where']||null:null,'attributes':_0x95a8ca[_0x5750('0x19')]?_0x95a8ca[_0x5750('0x19')][_0x5750('0x1b')]||null:null,'limit':_0x95a8ca['options']?_0x95a8ca[_0x5750('0x19')][_0x5750('0x1c')]||null:null})[_0x5750('0xa')](function(_0x63fd5f){logger[_0x5750('0xb')]('UpdateMailApplication',_0x95a8ca);logger[_0x5750('0xe')]('UpdateMailApplication',_0x95a8ca,JSON[_0x5750('0x10')](_0x63fd5f));_0x265f12(_0x63fd5f);})[_0x5750('0x15')](function(_0x4f6a8b){logger[_0x5750('0x12')](_0x5750('0x16'),_0x4f6a8b['message'],_0x95a8ca);_0x5d909c(_0x1b0e24[_0x5750('0x12')](0x1f4,_0x4f6a8b[_0x5750('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 6446b86..8b4da8f 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 _0x2f88=['exports','express','Router','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','/:id','update','mailinteraction:destroy'];(function(_0x434e80,_0x3f4bd0){var _0x5014f7=function(_0x3263df){while(--_0x3263df){_0x434e80['push'](_0x434e80['shift']());}};_0x5014f7(++_0x3f4bd0);}(_0x2f88,0x15a));var _0x82f8=function(_0x4af643,_0x37bcc1){_0x4af643=_0x4af643-0x0;var _0x27beba=_0x2f88[_0x4af643];return _0x27beba;};'use strict';var express=require(_0x82f8('0x0'));var router=express[_0x82f8('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x82f8('0x2'));var controller=require(_0x82f8('0x3'));router['get']('/',auth[_0x82f8('0x4')](),controller['index']);router[_0x82f8('0x5')](_0x82f8('0x6'),auth['isAuthenticated'](),controller[_0x82f8('0x7')]);router[_0x82f8('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x82f8('0x8')]);router[_0x82f8('0x5')](_0x82f8('0x9'),auth[_0x82f8('0x4')](),controller[_0x82f8('0xa')]);router['get'](_0x82f8('0xb'),auth[_0x82f8('0x4')](),controller['download']);router[_0x82f8('0xc')]('/',auth[_0x82f8('0x4')](),controller['create']);router['post'](_0x82f8('0x9'),auth[_0x82f8('0x4')](),controller[_0x82f8('0xd')]);router[_0x82f8('0xc')](_0x82f8('0xe'),auth[_0x82f8('0x4')](),interaction[_0x82f8('0xf')](_0x82f8('0x10'),_0x82f8('0x11')),controller[_0x82f8('0x12')]);router['put'](_0x82f8('0x13'),auth[_0x82f8('0x4')](),interaction[_0x82f8('0xf')](_0x82f8('0x10'),'mailinteraction:update'),controller[_0x82f8('0x14')]);router['delete']('/:id',auth[_0x82f8('0x4')](),interaction[_0x82f8('0xf')](_0x82f8('0x10'),_0x82f8('0x15')),controller['destroy']);router['delete'](_0x82f8('0xe'),auth[_0x82f8('0x4')](),controller['removeTags']);module[_0x82f8('0x16')]=router; \ No newline at end of file +var _0x05bf=['/:id','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','mailinteraction:update','update','delete','mail','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x1275e,_0x2191d4){var _0x5f345f=function(_0x3245b1){while(--_0x3245b1){_0x1275e['push'](_0x1275e['shift']());}};_0x5f345f(++_0x2191d4);}(_0x05bf,0xe0));var _0xf05b=function(_0x580127,_0x370644){_0x580127=_0x580127-0x0;var _0x1384d2=_0x05bf[_0x580127];return _0x1384d2;};'use strict';var express=require(_0xf05b('0x0'));var router=express[_0xf05b('0x1')]();var auth=require(_0xf05b('0x2'));var interaction=require(_0xf05b('0x3'));var controller=require(_0xf05b('0x4'));router['get']('/',auth[_0xf05b('0x5')](),controller[_0xf05b('0x6')]);router[_0xf05b('0x7')](_0xf05b('0x8'),auth['isAuthenticated'](),controller[_0xf05b('0x9')]);router[_0xf05b('0x7')](_0xf05b('0xa'),auth[_0xf05b('0x5')](),controller['show']);router['get'](_0xf05b('0xb'),auth[_0xf05b('0x5')](),controller['getMessages']);router['get'](_0xf05b('0xc'),auth['isAuthenticated'](),controller[_0xf05b('0xd')]);router[_0xf05b('0xe')]('/',auth[_0xf05b('0x5')](),controller['create']);router['post'](_0xf05b('0xb'),auth[_0xf05b('0x5')](),controller[_0xf05b('0xf')]);router[_0xf05b('0xe')](_0xf05b('0x10'),auth[_0xf05b('0x5')](),interaction[_0xf05b('0x11')]('mail',_0xf05b('0x12')),controller['addTags']);router['put'](_0xf05b('0xa'),auth[_0xf05b('0x5')](),interaction[_0xf05b('0x11')]('mail',_0xf05b('0x13')),controller[_0xf05b('0x14')]);router[_0xf05b('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0xf05b('0x11')](_0xf05b('0x16'),_0xf05b('0x17')),controller['destroy']);router[_0xf05b('0x15')](_0xf05b('0x10'),auth[_0xf05b('0x5')](),controller[_0xf05b('0x18')]);module[_0xf05b('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 2b01640..9305036 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 _0x8511=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x3aab9a,_0x4ce012){var _0x58dbc9=function(_0x5b9bc5){while(--_0x5b9bc5){_0x3aab9a['push'](_0x3aab9a['shift']());}};_0x58dbc9(++_0x4ce012);}(_0x8511,0xf0));var _0x1851=function(_0x1213c0,_0x21ad41){_0x1213c0=_0x1213c0-0x0;var _0x8ac347=_0x8511[_0x1213c0];return _0x8ac347;};'use strict';var Sequelize=require(_0x1851('0x0'));var iconv=require(_0x1851('0x1'));module[_0x1851('0x2')]={'closed':{'type':Sequelize[_0x1851('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1851('0x4')]},'disposition':{'type':Sequelize[_0x1851('0x5')]},'secondDisposition':{'type':Sequelize[_0x1851('0x5')]},'thirdDisposition':{'type':Sequelize[_0x1851('0x5')]},'note':{'type':Sequelize[_0x1851('0x5')]},'inReplyTo':{'type':Sequelize[_0x1851('0x5')](0x1fe)},'to':{'type':Sequelize[_0x1851('0x5')]},'cc':{'type':Sequelize[_0x1851('0x6')](_0x1851('0x7'))},'subject':{'type':Sequelize[_0x1851('0x6')]()},'attach':{'type':Sequelize[_0x1851('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1851('0x4')]},'substatus':{'type':Sequelize[_0x1851('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x1851('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1851('0x8')]('in',_0x1851('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1851('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1851('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe105=['STRING','TEXT','DATE','ENUM','out','sequelize'];(function(_0x34ed72,_0x57c63f){var _0x3312c5=function(_0x44c5c5){while(--_0x44c5c5){_0x34ed72['push'](_0x34ed72['shift']());}};_0x3312c5(++_0x57c63f);}(_0xe105,0xef));var _0x5e10=function(_0x2f4317,_0x2be0f8){_0x2f4317=_0x2f4317-0x0;var _0x4aad6a=_0xe105[_0x2f4317];return _0x4aad6a;};'use strict';var Sequelize=require(_0x5e10('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5e10('0x1')]},'secondDisposition':{'type':Sequelize[_0x5e10('0x1')]},'thirdDisposition':{'type':Sequelize[_0x5e10('0x1')]},'note':{'type':Sequelize[_0x5e10('0x1')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x5e10('0x1')]},'cc':{'type':Sequelize[_0x5e10('0x2')]('long')},'subject':{'type':Sequelize[_0x5e10('0x2')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x5e10('0x1')](0x3c)},'substatusAt':{'type':Sequelize[_0x5e10('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5e10('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5e10('0x4')]('in',_0x5e10('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 06f3813..53721bc 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 _0x289c=['where','MailInteractionId','filter','$gte','split','includeAll','inlineCss','true','rows','addTags','setTags','ids','spread','Tag','emit','removeTags','download','toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','Messages','subject','createdAt','get','mkdirSync','each','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','format','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path','juice','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','error','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','getOptions','findAll','mail','query','catch','params','model','keys','intersection','attributes','fields','length','include','merge','options','find','create','body','describe','addMessage','MailMessage','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x5a9898,_0x308478){var _0x2bac37=function(_0x5c76af){while(--_0x5c76af){_0x5a9898['push'](_0x5a9898['shift']());}};_0x2bac37(++_0x308478);}(_0x289c,0x110));var _0xc289=function(_0xa713b0,_0x2af37a){_0xa713b0=_0xa713b0-0x0;var _0x40d7f5=_0x289c[_0xa713b0];return _0x40d7f5;};'use strict';var emlformat=require(_0xc289('0x0'));var rimraf=require(_0xc289('0x1'));var zipdir=require(_0xc289('0x2'));var moment=require(_0xc289('0x3'));var BPromise=require('bluebird');var util=require(_0xc289('0x4'));var path=require(_0xc289('0x5'));var fs=require('fs');var _=require('lodash');var juice=require(_0xc289('0x6'));var Redis=require(_0xc289('0x7'));var interaction=require(_0xc289('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xc289('0x9'))(_0xc289('0xa'));var config=require(_0xc289('0xb'));var db=require(_0xc289('0xc'))['db'];var htmlEntities=require(_0xc289('0xd'));config[_0xc289('0xe')]=_[_0xc289('0xf')](config[_0xc289('0xe')],{'host':_0xc289('0x10'),'port':0x18eb});var socket=require(_0xc289('0x11'))(new Redis(config['redis']));require(_0xc289('0x12'))['register'](socket);function respondWithStatusCode(_0x194aa4,_0x50de8e){_0x50de8e=_0x50de8e||0xcc;return function(_0x407a2d){if(_0x407a2d){return _0x194aa4[_0xc289('0x13')](_0x50de8e);}return _0x194aa4[_0xc289('0x14')](_0x50de8e)['end']();};}function respondWithResult(_0x240e62,_0x5321a9){_0x5321a9=_0x5321a9||0xc8;return function(_0x3e9a6f){if(_0x3e9a6f){return _0x240e62['status'](_0x5321a9)[_0xc289('0x15')](_0x3e9a6f);}};}function respondWithFilteredResult(_0x1c3c0f,_0x4a3fdf){return function(_0x3eb520){if(_0x3eb520){var _0x55da56=typeof _0x4a3fdf[_0xc289('0x16')]===_0xc289('0x17')&&typeof _0x4a3fdf['limit']===_0xc289('0x17');var _0x2eb8d2=_0x3eb520[_0xc289('0x18')];var _0x4e1643=_0x55da56?0x0:_0x4a3fdf['offset'];var _0x36dc90=_0x55da56?_0x3eb520['count']:_0x4a3fdf[_0xc289('0x16')]+_0x4a3fdf[_0xc289('0x19')];var _0x3ec4bc;if(_0x36dc90>=_0x2eb8d2){_0x36dc90=_0x2eb8d2;_0x3ec4bc=0xc8;}else{_0x3ec4bc=0xce;}_0x1c3c0f['status'](_0x3ec4bc);return _0x1c3c0f[_0xc289('0x1a')](_0xc289('0x1b'),_0x4e1643+'-'+_0x36dc90+'/'+_0x2eb8d2)[_0xc289('0x15')](_0x3eb520);}return null;};}function saveUpdates(_0xf5f3b){return function(_0x27d064){if(_0x27d064){return _0x27d064[_0xc289('0x1c')](_0xf5f3b)[_0xc289('0x1d')](function(_0x3506a2){return _0x3506a2;});}return null;};}function removeEntity(_0x38f5f1){return function(_0x13063c){if(_0x13063c){return _0x13063c[_0xc289('0x1e')]()[_0xc289('0x1d')](function(){_0x38f5f1['status'](0xcc)[_0xc289('0x1f')]();});}};}function handleEntityNotFound(_0x1f9772){return function(_0x57b1ad){if(!_0x57b1ad){_0x1f9772[_0xc289('0x13')](0x194);}return _0x57b1ad;};}function handleError(_0x5c77de,_0x4491fb){_0x4491fb=_0x4491fb||0x1f4;return function(_0x413f30){logger[_0xc289('0x20')](_0x413f30['stack']);if(_0x413f30['name']){delete _0x413f30[_0xc289('0x21')];}_0x5c77de[_0xc289('0x14')](_0x4491fb)[_0xc289('0x22')](_0x413f30);};}exports[_0xc289('0x23')]=function(_0x5b4869,_0x3e487d){var _0x4d4869={};var _0x58425a=_[_0xc289('0x24')](db[_0xc289('0x25')][_0xc289('0x26')],function(_0x477f55){return{'name':_0x477f55[_0xc289('0x27')],'type':_0x477f55[_0xc289('0x28')]['key']};});_0x4d4869=qs[_0xc289('0x29')](_0x58425a,_0x5b4869);return interaction[_0xc289('0x2a')](_0xc289('0x2b'),_0x5b4869[_0xc289('0x2c')],_0x5b4869['user'],_0x4d4869,_0x58425a)[_0xc289('0x1d')](respondWithFilteredResult(_0x3e487d,_0x4d4869))[_0xc289('0x2d')](handleError(_0x3e487d,null));};exports['show']=function(_0x313a90,_0x525665){var _0x106030={'raw':![],'where':{'id':_0x313a90[_0xc289('0x2e')]['id']}},_0x3d762d={};_0x3d762d[_0xc289('0x2f')]=_['keys'](db[_0xc289('0x25')][_0xc289('0x26')]);_0x3d762d[_0xc289('0x2c')]=_[_0xc289('0x30')](_0x313a90['query']);_0x3d762d['filters']=_[_0xc289('0x31')](_0x3d762d[_0xc289('0x2f')],_0x3d762d[_0xc289('0x2c')]);_0x106030[_0xc289('0x32')]=_[_0xc289('0x31')](_0x3d762d[_0xc289('0x2f')],qs[_0xc289('0x33')](_0x313a90[_0xc289('0x2c')][_0xc289('0x33')]));_0x106030[_0xc289('0x32')]=_0x106030[_0xc289('0x32')][_0xc289('0x34')]?_0x106030[_0xc289('0x32')]:_0x3d762d['model'];if(_0x313a90[_0xc289('0x2c')]['includeAll']){_0x106030[_0xc289('0x35')]=[{'all':!![]}];}_0x106030=_[_0xc289('0x36')]({},_0x106030,_0x313a90[_0xc289('0x37')]);return db['MailInteraction'][_0xc289('0x38')](_0x106030)[_0xc289('0x1d')](handleEntityNotFound(_0x525665,null))['then'](respondWithResult(_0x525665,null))[_0xc289('0x2d')](handleError(_0x525665,null));};exports[_0xc289('0x39')]=function(_0x50f029,_0x47ffc3){return db['MailInteraction'][_0xc289('0x39')](_0x50f029[_0xc289('0x3a')],{})[_0xc289('0x1d')](respondWithResult(_0x47ffc3,0xc9))[_0xc289('0x2d')](handleError(_0x47ffc3,null));};exports[_0xc289('0x1c')]=function(_0x59d274,_0x491259){if(_0x59d274[_0xc289('0x3a')]['id']){delete _0x59d274[_0xc289('0x3a')]['id'];}return db[_0xc289('0x25')][_0xc289('0x38')]({'where':{'id':_0x59d274[_0xc289('0x2e')]['id']}})['then'](handleEntityNotFound(_0x491259,null))[_0xc289('0x1d')](saveUpdates(_0x59d274[_0xc289('0x3a')],null))[_0xc289('0x1d')](respondWithResult(_0x491259,null))[_0xc289('0x2d')](handleError(_0x491259,null));};exports[_0xc289('0x1e')]=function(_0x13de67,_0xde6c15){return db[_0xc289('0x25')][_0xc289('0x38')]({'where':{'id':_0x13de67[_0xc289('0x2e')]['id']}})['then'](handleEntityNotFound(_0xde6c15,null))[_0xc289('0x1d')](removeEntity(_0xde6c15,null))['catch'](handleError(_0xde6c15,null));};exports[_0xc289('0x3b')]=function(_0x47e1c2,_0x145266){return db[_0xc289('0x25')][_0xc289('0x3b')]()[_0xc289('0x1d')](respondWithResult(_0x145266,null))['catch'](handleError(_0x145266,null));};exports[_0xc289('0x3c')]=function(_0x5d7fe5,_0x19462b){return db[_0xc289('0x3d')][_0xc289('0x38')]({'where':{'id':_0x5d7fe5['params']['id']}})[_0xc289('0x1d')](handleEntityNotFound(_0x19462b,null))[_0xc289('0x1d')](function(_0x2e13aa){if(_0x2e13aa){return _0x2e13aa[_0xc289('0x3c')](_0x5d7fe5[_0xc289('0x3a')]['ids'],_[_0xc289('0x3e')](_0x5d7fe5[_0xc289('0x3a')],['ids','id'])||{});}})[_0xc289('0x1d')](respondWithResult(_0x19462b,null))[_0xc289('0x2d')](handleError(_0x19462b,null));};exports[_0xc289('0x3f')]=function(_0x15243b,_0x130445){var _0x30eb75={'raw':![],'where':{}};var _0x311b89={};var _0xfa4672={'count':0x0,'rows':[]};return db[_0xc289('0x25')]['findOne']({'where':{'id':_0x15243b[_0xc289('0x2e')]['id']}})[_0xc289('0x1d')](handleEntityNotFound(_0x130445,null))['then'](function(_0xcf5ab7){if(_0xcf5ab7){_0x311b89['model']=_['keys'](db[_0xc289('0x3d')][_0xc289('0x26')]);_0x311b89[_0xc289('0x2c')]=_[_0xc289('0x30')](_0x15243b[_0xc289('0x2c')]);_0x311b89[_0xc289('0x40')]=_[_0xc289('0x31')](_0x311b89[_0xc289('0x2f')],_0x311b89[_0xc289('0x2c')]);_0x30eb75['attributes']=_[_0xc289('0x31')](_0x311b89[_0xc289('0x2f')],qs['fields'](_0x15243b[_0xc289('0x2c')][_0xc289('0x33')]));_0x30eb75[_0xc289('0x32')]=_0x30eb75[_0xc289('0x32')][_0xc289('0x34')]?_0x30eb75[_0xc289('0x32')]:_0x311b89[_0xc289('0x2f')];if(!_0x15243b[_0xc289('0x2c')][_0xc289('0x41')](_0xc289('0x42'))){_0x30eb75[_0xc289('0x19')]=qs[_0xc289('0x19')](_0x15243b[_0xc289('0x2c')][_0xc289('0x19')]);_0x30eb75['offset']=qs['offset'](_0x15243b[_0xc289('0x2c')][_0xc289('0x16')]);}_0x30eb75[_0xc289('0x43')]=qs[_0xc289('0x44')](_0x15243b[_0xc289('0x2c')]['sort']);_0x30eb75['where']=qs[_0xc289('0x40')](_[_0xc289('0x45')](_0x15243b[_0xc289('0x2c')],_0x311b89[_0xc289('0x40')]));_0x30eb75[_0xc289('0x46')][_0xc289('0x47')]=_0xcf5ab7['id'];if(_0x15243b['query'][_0xc289('0x48')]){_0x30eb75[_0xc289('0x46')]=_[_0xc289('0x36')](_0x30eb75[_0xc289('0x46')],{'$or':_['map'](_0x30eb75['attributes'],function(_0x4cd811){var _0x2bc47d={};_0x2bc47d[_0x4cd811]={'$like':'%'+_0x15243b[_0xc289('0x2c')][_0xc289('0x48')]+'%'};return _0x2bc47d;})});}if(_0x15243b[_0xc289('0x2c')][_0xc289('0x49')]){var _0x12433b=_0x15243b[_0xc289('0x2c')][_0xc289('0x49')][_0xc289('0x4a')](',');var _0x4df324={};_0x4df324[_0x12433b[0x0]]={'$gte':moment(_0x12433b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x30eb75[_0xc289('0x46')]=_[_0xc289('0x36')](_0x30eb75[_0xc289('0x46')],_0x4df324);}_0x30eb75=_[_0xc289('0x36')]({},_0x30eb75,_0x15243b[_0xc289('0x37')]);return db[_0xc289('0x3d')][_0xc289('0x18')]({'where':_0x30eb75[_0xc289('0x46')]})[_0xc289('0x1d')](function(_0x1e3185){_0xfa4672['count']=_0x1e3185;if(_0x15243b[_0xc289('0x2c')][_0xc289('0x4b')]){_0x30eb75[_0xc289('0x35')]=[{'all':!![]}];}return db[_0xc289('0x3d')]['findAll'](_0x30eb75);})[_0xc289('0x1d')](function(_0x2a2711){if(_0x15243b[_0xc289('0x2c')][_0xc289('0x4c')]===_0xc289('0x4d')){for(var _0x37a8bc=0x0;_0x37a8bc<_0x2a2711[_0xc289('0x34')];_0x37a8bc++){_0x2a2711[_0x37a8bc][_0xc289('0x3a')]=juice(_0x2a2711[_0x37a8bc][_0xc289('0x3a')]);}}_0xfa4672[_0xc289('0x4e')]=_0x2a2711;return _0xfa4672;});}})['then'](respondWithFilteredResult(_0x130445,_0x30eb75))[_0xc289('0x2d')](handleError(_0x130445,null));};exports[_0xc289('0x4f')]=function(_0x78e7de,_0x4d16c0){return db[_0xc289('0x25')][_0xc289('0x38')]({'where':{'id':_0x78e7de[_0xc289('0x2e')]['id']}})[_0xc289('0x1d')](handleEntityNotFound(_0x4d16c0,null))[_0xc289('0x1d')](function(_0x24707d){if(_0x24707d){return _0x24707d[_0xc289('0x50')](_0x78e7de[_0xc289('0x3a')]['ids'],_[_0xc289('0x3e')](_0x78e7de[_0xc289('0x3a')],[_0xc289('0x51'),'id'])||{})[_0xc289('0x52')](function(){return db[_0xc289('0x53')][_0xc289('0x2a')]({'attributes':['id','name','color'],'where':{'id':_0x78e7de[_0xc289('0x3a')][_0xc289('0x51')]}});})[_0xc289('0x1d')](function(_0x48cffe){socket[_0xc289('0x54')]('mailInteractionTags:save',{'id':Number(_0x78e7de[_0xc289('0x2e')]['id']),'tags':_0x48cffe||[]});return{'id':Number(_0x78e7de[_0xc289('0x2e')]['id']),'tags':_0x48cffe||[]};});}})['then'](respondWithResult(_0x4d16c0,null))[_0xc289('0x2d')](handleError(_0x4d16c0,null));};exports['removeTags']=function(_0x476d8c,_0x1d2371){return db['MailInteraction'][_0xc289('0x38')]({'where':{'id':_0x476d8c['params']['id']}})[_0xc289('0x1d')](handleEntityNotFound(_0x1d2371,null))[_0xc289('0x1d')](function(_0x33ce31){if(_0x33ce31){return _0x33ce31[_0xc289('0x55')](_0x476d8c[_0xc289('0x2c')]['ids']);}})[_0xc289('0x1d')](respondWithStatusCode(_0x1d2371,null))['catch'](handleError(_0x1d2371,null));};exports[_0xc289('0x56')]=function(_0x4aec86,_0x59574a){var _0x44951a=moment()['unix']()[_0xc289('0x57')]();var _0x51aa51=path[_0xc289('0x58')](config[_0xc289('0x59')],_0xc289('0x5a'),'files',_0xc289('0x5b'));var _0x404e03=path[_0xc289('0x58')](config[_0xc289('0x59')],_0xc289('0x5a'),_0xc289('0x5c'),_0xc289('0x5d'));var _0x4e2fdf=path[_0xc289('0x58')](_0x51aa51,_0x44951a);var _0x491be0=util['format'](_0xc289('0x5e'),_0x4aec86['params']['id'],_0x44951a);var _0xef6051=path[_0xc289('0x58')](_0x51aa51,_0x491be0);var _0x4ce86f=[];if(_0x4aec86['query'][_0xc289('0x5d')]){_0x4ce86f[_0xc289('0x5f')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x515d29=[{'model':db[_0xc289('0x3d')],'as':_0xc289('0x60'),'attributes':['id',_0xc289('0x3a'),'from','to','cc','bcc',_0xc289('0x61'),_0xc289('0x62')],'where':{'secret':![]},'order':qs[_0xc289('0x44')]('id'),'include':_0x4ce86f}];return db[_0xc289('0x25')][_0xc289('0x38')]({'where':{'id':_0x4aec86['params']['id']},'include':_0x515d29})[_0xc289('0x1d')](handleEntityNotFound(_0x59574a,null))[_0xc289('0x1d')](function(_0x43e0f7){if(_0x43e0f7&&_0x43e0f7['Messages']){var _0x5bf3e6=_0x43e0f7[_0xc289('0x63')]({'plain':!![]});fs[_0xc289('0x64')](_0x4e2fdf);return BPromise[_0xc289('0x65')](_0x5bf3e6[_0xc289('0x60')],function(_0x18b0fc,_0x3d5058){var _0x12dc81={'from':_0x18b0fc[_0xc289('0x66')],'to':_0x18b0fc['to'],'subject':_0x18b0fc[_0xc289('0x61')],'html':htmlEntities[_0xc289('0x67')](_0x18b0fc[_0xc289('0x3a')]),'headers':{'Date':moment(_0x18b0fc[_0xc289('0x62')])['format'](_0xc289('0x68'))},'attachments':[]};if(_0x18b0fc['cc']){_0x12dc81[_0xc289('0x69')]['Cc']=_0x18b0fc['cc'];}if(_0x18b0fc['bcc']){_0x12dc81[_0xc289('0x69')][_0xc289('0x6a')]=_0x18b0fc['bcc'];}return new BPromise(function(_0x209e01,_0x599ce0){if(_0x18b0fc[_0xc289('0x6b')]){for(var _0x2418fd=0x0;_0x2418fd<_0x18b0fc[_0xc289('0x6b')]['length'];_0x2418fd++){var _0x2431f0=_0x18b0fc['Attachments'][_0x2418fd];var _0x589d61=path['join'](_0x404e03,_0x2431f0[_0xc289('0x6c')]);if(fs[_0xc289('0x6d')](_0x589d61)){_0x12dc81[_0xc289('0x5d')][_0xc289('0x5f')]({'name':_0x2431f0[_0xc289('0x21')],'contentType':_0x2431f0[_0xc289('0x28')],'data':fs[_0xc289('0x6e')](_0x589d61)});}}}emlformat[_0xc289('0x6f')](_0x12dc81,function(_0x1e331f,_0x27d1e4){if(_0x1e331f)return _0x599ce0(_0x1e331f);fs['writeFileSync'](path[_0xc289('0x58')](_0x4e2fdf,util[_0xc289('0x70')]('message%d.eml',_0x3d5058)),_0x27d1e4);return _0x209e01(_0x27d1e4);});});})[_0xc289('0x1d')](function(){return new BPromise(function(_0x59e9fa,_0x4af61b){zipdir(_0x4e2fdf,{'saveTo':_0xef6051},function(_0x130ee5,_0x100b36){if(_0x130ee5)return _0x4af61b(_0x130ee5);return _0x59e9fa(_0x100b36);});})[_0xc289('0x1d')](function(){return new BPromise(function(_0x582ddb,_0x5f469d){rimraf(_0x4e2fdf,function(_0x26cf88){if(_0x26cf88)_0x5f469d(_0x26cf88);return _0x582ddb();});});})[_0xc289('0x1d')](function(){return _0x59574a[_0xc289('0x56')](_0xef6051,_0x491be0,function(_0x4403ee){if(!_0x4403ee)fs[_0xc289('0x71')](_0xef6051);});});});}else{return _0x59574a[_0xc289('0x13')](0xc8);}})[_0xc289('0x2d')](handleError(_0x59574a,null));}; \ No newline at end of file +var _0x1e14=['build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','status','offset','undefined','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','mail','query','user','catch','show','model','keys','intersection','attributes','length','includeAll','find','create','body','params','describe','addMessage','ids','getMessages','findOne','filters','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','MailMessage','count','include','inlineCss','true','rows','addTags','omit','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','from','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','basename','existsSync','push','readFileSync'];(function(_0xa23c8b,_0x379417){var _0xf8135e=function(_0x59d167){while(--_0x59d167){_0xa23c8b['push'](_0xa23c8b['shift']());}};_0xf8135e(++_0x379417);}(_0x1e14,0xef));var _0x41e1=function(_0x1138e4,_0x3b12b7){_0x1138e4=_0x1138e4-0x0;var _0x2aaa6c=_0x1e14[_0x1138e4];return _0x2aaa6c;};'use strict';var emlformat=require(_0x41e1('0x0'));var rimraf=require(_0x41e1('0x1'));var zipdir=require(_0x41e1('0x2'));var moment=require(_0x41e1('0x3'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x41e1('0x4'));var juice=require('juice');var Redis=require(_0x41e1('0x5'));var interaction=require(_0x41e1('0x6'));var qs=require(_0x41e1('0x7'));var logger=require(_0x41e1('0x8'))(_0x41e1('0x9'));var config=require(_0x41e1('0xa'));var db=require(_0x41e1('0xb'))['db'];var htmlEntities=require(_0x41e1('0xc'));config[_0x41e1('0xd')]=_[_0x41e1('0xe')](config[_0x41e1('0xd')],{'host':_0x41e1('0xf'),'port':0x18eb});var socket=require(_0x41e1('0x10'))(new Redis(config['redis']));require(_0x41e1('0x11'))[_0x41e1('0x12')](socket);function respondWithStatusCode(_0x33db39,_0xaefd72){_0xaefd72=_0xaefd72||0xcc;return function(_0x15a684){if(_0x15a684){return _0x33db39['sendStatus'](_0xaefd72);}return _0x33db39['status'](_0xaefd72)['end']();};}function respondWithResult(_0x532f95,_0x79b098){_0x79b098=_0x79b098||0xc8;return function(_0x58ad33){if(_0x58ad33){return _0x532f95[_0x41e1('0x13')](_0x79b098)['json'](_0x58ad33);}};}function respondWithFilteredResult(_0x31aad2,_0x461829){return function(_0x581023){if(_0x581023){var _0x3f7fb3=typeof _0x461829[_0x41e1('0x14')]===_0x41e1('0x15')&&typeof _0x461829['limit']==='undefined';var _0x104b36=_0x581023['count'];var _0x2aa097=_0x3f7fb3?0x0:_0x461829[_0x41e1('0x14')];var _0x4a52e2=_0x3f7fb3?_0x581023['count']:_0x461829[_0x41e1('0x14')]+_0x461829[_0x41e1('0x16')];var _0x3c4297;if(_0x4a52e2>=_0x104b36){_0x4a52e2=_0x104b36;_0x3c4297=0xc8;}else{_0x3c4297=0xce;}_0x31aad2[_0x41e1('0x13')](_0x3c4297);return _0x31aad2[_0x41e1('0x17')](_0x41e1('0x18'),_0x2aa097+'-'+_0x4a52e2+'/'+_0x104b36)['json'](_0x581023);}return null;};}function saveUpdates(_0x47fa57){return function(_0x9da56){if(_0x9da56){return _0x9da56[_0x41e1('0x19')](_0x47fa57)[_0x41e1('0x1a')](function(_0xd97378){return _0xd97378;});}return null;};}function removeEntity(_0x3774e9){return function(_0x4a65ff){if(_0x4a65ff){return _0x4a65ff[_0x41e1('0x1b')]()[_0x41e1('0x1a')](function(){_0x3774e9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb3fc9){return function(_0x121d62){if(!_0x121d62){_0xb3fc9[_0x41e1('0x1c')](0x194);}return _0x121d62;};}function handleError(_0x2025a1,_0x451bd7){_0x451bd7=_0x451bd7||0x1f4;return function(_0xf96cf8){logger[_0x41e1('0x1d')](_0xf96cf8[_0x41e1('0x1e')]);if(_0xf96cf8['name']){delete _0xf96cf8[_0x41e1('0x1f')];}_0x2025a1[_0x41e1('0x13')](_0x451bd7)[_0x41e1('0x20')](_0xf96cf8);};}exports[_0x41e1('0x21')]=function(_0x449143,_0x1aa113){var _0x4fa4af={};var _0x30942a=_[_0x41e1('0x22')](db[_0x41e1('0x23')][_0x41e1('0x24')],function(_0x275a22){return{'name':_0x275a22[_0x41e1('0x25')],'type':_0x275a22[_0x41e1('0x26')][_0x41e1('0x27')]};});_0x4fa4af=qs['getOptions'](_0x30942a,_0x449143);return interaction[_0x41e1('0x28')](_0x41e1('0x29'),_0x449143[_0x41e1('0x2a')],_0x449143[_0x41e1('0x2b')],_0x4fa4af,_0x30942a)[_0x41e1('0x1a')](respondWithFilteredResult(_0x1aa113,_0x4fa4af))[_0x41e1('0x2c')](handleError(_0x1aa113,null));};exports[_0x41e1('0x2d')]=function(_0x438d20,_0x1b7b1b){var _0x12fef2={'raw':![],'where':{'id':_0x438d20['params']['id']}},_0x4e000a={};_0x4e000a[_0x41e1('0x2e')]=_[_0x41e1('0x2f')](db[_0x41e1('0x23')][_0x41e1('0x24')]);_0x4e000a['query']=_['keys'](_0x438d20['query']);_0x4e000a['filters']=_[_0x41e1('0x30')](_0x4e000a['model'],_0x4e000a['query']);_0x12fef2[_0x41e1('0x31')]=_[_0x41e1('0x30')](_0x4e000a[_0x41e1('0x2e')],qs['fields'](_0x438d20[_0x41e1('0x2a')]['fields']));_0x12fef2[_0x41e1('0x31')]=_0x12fef2[_0x41e1('0x31')][_0x41e1('0x32')]?_0x12fef2[_0x41e1('0x31')]:_0x4e000a[_0x41e1('0x2e')];if(_0x438d20['query'][_0x41e1('0x33')]){_0x12fef2['include']=[{'all':!![]}];}_0x12fef2=_['merge']({},_0x12fef2,_0x438d20['options']);return db[_0x41e1('0x23')][_0x41e1('0x34')](_0x12fef2)['then'](handleEntityNotFound(_0x1b7b1b,null))['then'](respondWithResult(_0x1b7b1b,null))[_0x41e1('0x2c')](handleError(_0x1b7b1b,null));};exports['create']=function(_0x6e0fc2,_0x4d6163){return db[_0x41e1('0x23')][_0x41e1('0x35')](_0x6e0fc2[_0x41e1('0x36')],{})[_0x41e1('0x1a')](respondWithResult(_0x4d6163,0xc9))[_0x41e1('0x2c')](handleError(_0x4d6163,null));};exports['update']=function(_0x40e36e,_0x272c66){if(_0x40e36e[_0x41e1('0x36')]['id']){delete _0x40e36e[_0x41e1('0x36')]['id'];}return db[_0x41e1('0x23')][_0x41e1('0x34')]({'where':{'id':_0x40e36e['params']['id']}})[_0x41e1('0x1a')](handleEntityNotFound(_0x272c66,null))['then'](saveUpdates(_0x40e36e[_0x41e1('0x36')],null))['then'](respondWithResult(_0x272c66,null))[_0x41e1('0x2c')](handleError(_0x272c66,null));};exports[_0x41e1('0x1b')]=function(_0x16a9b1,_0x1df96e){return db[_0x41e1('0x23')][_0x41e1('0x34')]({'where':{'id':_0x16a9b1[_0x41e1('0x37')]['id']}})[_0x41e1('0x1a')](handleEntityNotFound(_0x1df96e,null))[_0x41e1('0x1a')](removeEntity(_0x1df96e,null))[_0x41e1('0x2c')](handleError(_0x1df96e,null));};exports['describe']=function(_0x55b675,_0x207e36){return db[_0x41e1('0x23')][_0x41e1('0x38')]()[_0x41e1('0x1a')](respondWithResult(_0x207e36,null))[_0x41e1('0x2c')](handleError(_0x207e36,null));};exports[_0x41e1('0x39')]=function(_0x2b2090,_0x14b1d8){return db['MailMessage']['find']({'where':{'id':_0x2b2090[_0x41e1('0x37')]['id']}})['then'](handleEntityNotFound(_0x14b1d8,null))['then'](function(_0x4e102d){if(_0x4e102d){return _0x4e102d[_0x41e1('0x39')](_0x2b2090['body'][_0x41e1('0x3a')],_['omit'](_0x2b2090[_0x41e1('0x36')],['ids','id'])||{});}})['then'](respondWithResult(_0x14b1d8,null))[_0x41e1('0x2c')](handleError(_0x14b1d8,null));};exports[_0x41e1('0x3b')]=function(_0x406865,_0x1463b2){var _0x529a9d={'raw':![],'where':{}};var _0x4cf11a={};var _0x13364e={'count':0x0,'rows':[]};return db['MailInteraction'][_0x41e1('0x3c')]({'where':{'id':_0x406865[_0x41e1('0x37')]['id']}})[_0x41e1('0x1a')](handleEntityNotFound(_0x1463b2,null))[_0x41e1('0x1a')](function(_0x3ef3e7){if(_0x3ef3e7){_0x4cf11a['model']=_['keys'](db['MailMessage'][_0x41e1('0x24')]);_0x4cf11a[_0x41e1('0x2a')]=_[_0x41e1('0x2f')](_0x406865['query']);_0x4cf11a[_0x41e1('0x3d')]=_['intersection'](_0x4cf11a[_0x41e1('0x2e')],_0x4cf11a['query']);_0x529a9d[_0x41e1('0x31')]=_[_0x41e1('0x30')](_0x4cf11a[_0x41e1('0x2e')],qs[_0x41e1('0x3e')](_0x406865[_0x41e1('0x2a')]['fields']));_0x529a9d['attributes']=_0x529a9d['attributes'][_0x41e1('0x32')]?_0x529a9d[_0x41e1('0x31')]:_0x4cf11a[_0x41e1('0x2e')];if(!_0x406865[_0x41e1('0x2a')][_0x41e1('0x3f')](_0x41e1('0x40'))){_0x529a9d[_0x41e1('0x16')]=qs[_0x41e1('0x16')](_0x406865[_0x41e1('0x2a')]['limit']);_0x529a9d['offset']=qs['offset'](_0x406865['query'][_0x41e1('0x14')]);}_0x529a9d['order']=qs[_0x41e1('0x41')](_0x406865[_0x41e1('0x2a')]['sort']);_0x529a9d[_0x41e1('0x42')]=qs[_0x41e1('0x3d')](_[_0x41e1('0x43')](_0x406865['query'],_0x4cf11a[_0x41e1('0x3d')]));_0x529a9d[_0x41e1('0x42')]['MailInteractionId']=_0x3ef3e7['id'];if(_0x406865[_0x41e1('0x2a')]['filter']){_0x529a9d['where']=_[_0x41e1('0x44')](_0x529a9d[_0x41e1('0x42')],{'$or':_[_0x41e1('0x22')](_0x529a9d[_0x41e1('0x31')],function(_0x534931){var _0x5cda91={};_0x5cda91[_0x534931]={'$like':'%'+_0x406865[_0x41e1('0x2a')][_0x41e1('0x45')]+'%'};return _0x5cda91;})});}if(_0x406865[_0x41e1('0x2a')][_0x41e1('0x46')]){var _0x4c1d79=_0x406865['query'][_0x41e1('0x46')][_0x41e1('0x47')](',');var _0x564a3b={};_0x564a3b[_0x4c1d79[0x0]]={'$gte':moment(_0x4c1d79[0x1])[_0x41e1('0x48')](_0x41e1('0x49'))};_0x529a9d[_0x41e1('0x42')]=_['merge'](_0x529a9d[_0x41e1('0x42')],_0x564a3b);}_0x529a9d=_[_0x41e1('0x44')]({},_0x529a9d,_0x406865[_0x41e1('0x4a')]);return db[_0x41e1('0x4b')][_0x41e1('0x4c')]({'where':_0x529a9d[_0x41e1('0x42')]})[_0x41e1('0x1a')](function(_0x2a0356){_0x13364e[_0x41e1('0x4c')]=_0x2a0356;if(_0x406865[_0x41e1('0x2a')][_0x41e1('0x33')]){_0x529a9d[_0x41e1('0x4d')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x529a9d);})[_0x41e1('0x1a')](function(_0x1a2dd1){if(_0x406865[_0x41e1('0x2a')][_0x41e1('0x4e')]===_0x41e1('0x4f')){for(var _0x143512=0x0;_0x143512<_0x1a2dd1['length'];_0x143512++){_0x1a2dd1[_0x143512][_0x41e1('0x36')]=juice(_0x1a2dd1[_0x143512][_0x41e1('0x36')]);}}_0x13364e[_0x41e1('0x50')]=_0x1a2dd1;return _0x13364e;});}})[_0x41e1('0x1a')](respondWithFilteredResult(_0x1463b2,_0x529a9d))['catch'](handleError(_0x1463b2,null));};exports[_0x41e1('0x51')]=function(_0x5b91bb,_0x3e655a){return db[_0x41e1('0x23')][_0x41e1('0x34')]({'where':{'id':_0x5b91bb[_0x41e1('0x37')]['id']}})[_0x41e1('0x1a')](handleEntityNotFound(_0x3e655a,null))[_0x41e1('0x1a')](function(_0x821718){if(_0x821718){return _0x821718['setTags'](_0x5b91bb[_0x41e1('0x36')][_0x41e1('0x3a')],_[_0x41e1('0x52')](_0x5b91bb[_0x41e1('0x36')],['ids','id'])||{})[_0x41e1('0x53')](function(){return db[_0x41e1('0x54')][_0x41e1('0x28')]({'attributes':['id',_0x41e1('0x1f'),_0x41e1('0x55')],'where':{'id':_0x5b91bb['body']['ids']}});})[_0x41e1('0x1a')](function(_0x572bc5){socket['emit'](_0x41e1('0x56'),{'id':Number(_0x5b91bb[_0x41e1('0x37')]['id']),'tags':_0x572bc5||[]});return{'id':Number(_0x5b91bb['params']['id']),'tags':_0x572bc5||[]};});}})['then'](respondWithResult(_0x3e655a,null))[_0x41e1('0x2c')](handleError(_0x3e655a,null));};exports['removeTags']=function(_0x495aaf,_0x3b0661){return db[_0x41e1('0x23')][_0x41e1('0x34')]({'where':{'id':_0x495aaf['params']['id']}})[_0x41e1('0x1a')](handleEntityNotFound(_0x3b0661,null))[_0x41e1('0x1a')](function(_0xc570d7){if(_0xc570d7){return _0xc570d7[_0x41e1('0x57')](_0x495aaf['query'][_0x41e1('0x3a')]);}})[_0x41e1('0x1a')](respondWithStatusCode(_0x3b0661,null))[_0x41e1('0x2c')](handleError(_0x3b0661,null));};exports[_0x41e1('0x58')]=function(_0x527e3b,_0x2a1c41){var _0x161390=moment()[_0x41e1('0x59')]()[_0x41e1('0x5a')]();var _0x3650fc=path[_0x41e1('0x5b')](config[_0x41e1('0x5c')],_0x41e1('0x5d'),_0x41e1('0x5e'),_0x41e1('0x5f'));var _0x443740=path[_0x41e1('0x5b')](config['root'],_0x41e1('0x5d'),'files',_0x41e1('0x60'));var _0x24067b=path[_0x41e1('0x5b')](_0x3650fc,_0x161390);var _0xe26aa9=util['format'](_0x41e1('0x61'),_0x527e3b['params']['id'],_0x161390);var _0x534a58=path[_0x41e1('0x5b')](_0x3650fc,_0xe26aa9);var _0xe00b53=[];if(_0x527e3b[_0x41e1('0x2a')][_0x41e1('0x60')]){_0xe00b53['push']({'model':db[_0x41e1('0x62')],'as':_0x41e1('0x63'),'raw':!![]});}var _0xfd551f=[{'model':db['MailMessage'],'as':_0x41e1('0x64'),'attributes':['id',_0x41e1('0x36'),_0x41e1('0x65'),'to','cc','bcc',_0x41e1('0x66'),_0x41e1('0x67')],'where':{'secret':![]},'order':qs[_0x41e1('0x41')]('id'),'include':_0xe00b53}];return db['MailInteraction']['find']({'where':{'id':_0x527e3b[_0x41e1('0x37')]['id']},'include':_0xfd551f})['then'](handleEntityNotFound(_0x2a1c41,null))[_0x41e1('0x1a')](function(_0x1dce6a){if(_0x1dce6a&&_0x1dce6a[_0x41e1('0x64')]){var _0xab6569=_0x1dce6a[_0x41e1('0x68')]({'plain':!![]});fs[_0x41e1('0x69')](_0x24067b);return BPromise[_0x41e1('0x6a')](_0xab6569[_0x41e1('0x64')],function(_0xb8510c,_0x27333f){var _0x2faa14={'from':_0xb8510c[_0x41e1('0x65')],'to':_0xb8510c['to'],'subject':_0xb8510c[_0x41e1('0x66')],'html':htmlEntities[_0x41e1('0x6b')](_0xb8510c[_0x41e1('0x36')]),'headers':{'Date':moment(_0xb8510c['createdAt'])[_0x41e1('0x48')](_0x41e1('0x6c'))},'attachments':[]};if(_0xb8510c['cc']){_0x2faa14[_0x41e1('0x6d')]['Cc']=_0xb8510c['cc'];}if(_0xb8510c[_0x41e1('0x6e')]){_0x2faa14[_0x41e1('0x6d')]['Bcc']=_0xb8510c[_0x41e1('0x6e')];}return new BPromise(function(_0x5cb1a7,_0x311c58){if(_0xb8510c[_0x41e1('0x63')]){for(var _0x46061e=0x0;_0x46061e<_0xb8510c[_0x41e1('0x63')]['length'];_0x46061e++){var _0x55ec41=_0xb8510c[_0x41e1('0x63')][_0x46061e];var _0x48de50=path['join'](_0x443740,_0x55ec41[_0x41e1('0x6f')]);if(fs[_0x41e1('0x70')](_0x48de50)){_0x2faa14[_0x41e1('0x60')][_0x41e1('0x71')]({'name':_0x55ec41[_0x41e1('0x1f')],'contentType':_0x55ec41[_0x41e1('0x26')],'data':fs[_0x41e1('0x72')](_0x48de50)});}}}emlformat[_0x41e1('0x73')](_0x2faa14,function(_0x5b83d8,_0x6bc9c1){if(_0x5b83d8)return _0x311c58(_0x5b83d8);fs[_0x41e1('0x74')](path[_0x41e1('0x5b')](_0x24067b,util[_0x41e1('0x48')](_0x41e1('0x75'),_0x27333f)),_0x6bc9c1);return _0x5cb1a7(_0x6bc9c1);});});})[_0x41e1('0x1a')](function(){return new BPromise(function(_0x593258,_0x322c14){zipdir(_0x24067b,{'saveTo':_0x534a58},function(_0x435c2f,_0x655426){if(_0x435c2f)return _0x322c14(_0x435c2f);return _0x593258(_0x655426);});})[_0x41e1('0x1a')](function(){return new BPromise(function(_0x3f16aa,_0x42ccd6){rimraf(_0x24067b,function(_0x889eee){if(_0x889eee)_0x42ccd6(_0x889eee);return _0x3f16aa();});});})[_0x41e1('0x1a')](function(){return _0x2a1c41[_0x41e1('0x58')](_0x534a58,_0xe26aa9,function(_0x19e0e6){if(!_0x19e0e6)fs['unlinkSync'](_0x534a58);});});});}else{return _0x2a1c41[_0x41e1('0x1c')](0xc8);}})[_0x41e1('0x2c')](handleError(_0x2a1c41,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 4980324..5d5386e 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 _0xe4f5=['setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','../../mysqldb','MailMessage','setMaxListeners','remove','getUsers','then'];(function(_0xa9e3ac,_0x52d22f){var _0x2b0830=function(_0xd3f7d9){while(--_0xd3f7d9){_0xa9e3ac['push'](_0xa9e3ac['shift']());}};_0x2b0830(++_0x52d22f);}(_0xe4f5,0x182));var _0x5e4f=function(_0x5f3012,_0x3799fc){_0x5f3012=_0x5f3012-0x0;var _0x55927d=_0xe4f5[_0x5f3012];return _0x55927d;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x5e4f('0x0'))['db']['MailInteraction'];var MailMessage=require(_0x5e4f('0x0'))['db'][_0x5e4f('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5e4f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5e4f('0x3')};function emitEvent(_0x20e2d3){return function(_0x3d51ea,_0x4a7b6f,_0x5a1ace){_0x3d51ea[_0x5e4f('0x4')]({'attributes':['id'],'raw':!![]})[_0x5e4f('0x5')](function(_0x54720c){_0x3d51ea[_0x5e4f('0x6')](_0x5e4f('0x7'),_0x54720c[_0x5e4f('0x8')](function(_0x3fad4b){return{'id':_0x3fad4b['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3d51ea['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5e4f('0x5')](function(_0x337032){_0x3d51ea['setDataValue'](_0x5e4f('0x9'),_0x337032[_0x5e4f('0xa')]);MailInteractionEvents[_0x5e4f('0xb')](_0x20e2d3+':'+_0x3d51ea['id'],_0x3d51ea);MailInteractionEvents['emit'](_0x20e2d3,_0x3d51ea);_0x5a1ace(null);})[_0x5e4f('0xc')](_0x5a1ace(null));};}for(var e in events){if(events[_0x5e4f('0xd')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x087d=['events','../../mysqldb','MailMessage','setMaxListeners','save','update','then','setDataValue','Users','map','unreadMessages','emit','catch','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x087d,0x10a));var _0xd087=function(_0x44cd5a,_0x2651f5){_0x44cd5a=_0x44cd5a-0x0;var _0x19507a=_0x087d[_0x44cd5a];return _0x19507a;};'use strict';var EventEmitter=require(_0xd087('0x0'));var MailInteraction=require(_0xd087('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xd087('0x1'))['db'][_0xd087('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd087('0x3')](0x0);var events={'afterCreate':_0xd087('0x4'),'afterUpdate':_0xd087('0x5'),'afterDestroy':'remove'};function emitEvent(_0x159dbb){return function(_0x2159d2,_0x1379bb,_0x7de1a0){_0x2159d2['getUsers']({'attributes':['id'],'raw':!![]})[_0xd087('0x6')](function(_0x576127){_0x2159d2[_0xd087('0x7')](_0xd087('0x8'),_0x576127[_0xd087('0x9')](function(_0x1d1674){return{'id':_0x1d1674['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2159d2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4edc25){_0x2159d2[_0xd087('0x7')](_0xd087('0xa'),_0x4edc25['length']);MailInteractionEvents['emit'](_0x159dbb+':'+_0x2159d2['id'],_0x2159d2);MailInteractionEvents[_0xd087('0xb')](_0x159dbb,_0x2159d2);_0x7de1a0(null);})[_0xd087('0xc')](_0x7de1a0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xd087('0xd')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 04f340c..f2bd939 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 _0x2fab=['MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','define'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x2fab,0x117));var _0xb2fa=function(_0x4eeb6f,_0x1ad1a3){_0x4eeb6f=_0x4eeb6f-0x0;var _0x3b7a99=_0x2fab[_0x4eeb6f];return _0x3b7a99;};'use strict';var _=require(_0xb2fa('0x0'));var util=require(_0xb2fa('0x1'));var logger=require(_0xb2fa('0x2'))(_0xb2fa('0x3'));var moment=require(_0xb2fa('0x4'));var BPromise=require(_0xb2fa('0x5'));var rp=require(_0xb2fa('0x6'));var fs=require('fs');var path=require(_0xb2fa('0x7'));var rimraf=require(_0xb2fa('0x8'));var config=require('../../config/environment');var attributes=require(_0xb2fa('0x9'));module['exports']=function(_0x4b3312,_0x2cbce9){return _0x4b3312[_0xb2fa('0xa')](_0xb2fa('0xb'),attributes,{'tableName':_0xb2fa('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xb2fa('0xd'),'to'],'type':_0xb2fa('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4fc2ce,_0x5de93f,_0x522301){if(_0x4fc2ce[_0xb2fa('0xf')]){_0x4fc2ce[_0xb2fa('0x10')]=moment()[_0xb2fa('0x11')](_0xb2fa('0x12'));}if(_0x4fc2ce[_0xb2fa('0x13')]){_0x4fc2ce[_0xb2fa('0x14')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x522301(null,_0x5de93f);},'beforeUpdate':function(_0x4eea44,_0xfdf899,_0x31dcdf){if(_0x4eea44[_0xb2fa('0x15')](_0xb2fa('0xf'))){_0x4eea44['substatusAt']=_0x4eea44[_0xb2fa('0xf')]?moment()['format'](_0xb2fa('0x12')):null;}if(_0x4eea44[_0xb2fa('0x15')](_0xb2fa('0x13'))){_0x4eea44[_0xb2fa('0x14')]=moment()[_0xb2fa('0x11')](_0xb2fa('0x12'));_0x4eea44[_0xb2fa('0xf')]=null;_0x4eea44[_0xb2fa('0x10')]=null;}_0x31dcdf(null,_0x4eea44);},'afterUpdate':function(_0x375312,_0x5c4890,_0x37f7c3){var _0x7f1e35=_0x4b3312['models'];var _0x14878e=_0x375312[_0xb2fa('0x16')]({'plain':!![]});if(_0x14878e[_0xb2fa('0x13')]){return _0x7f1e35[_0xb2fa('0x17')][_0xb2fa('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x14878e['id']}})[_0xb2fa('0x19')](function(){_0x37f7c3();})[_0xb2fa('0x1a')](function(_0x117996){_0x37f7c3(_0x117996);});}else{_0x37f7c3();}}},'charset':_0xb2fa('0x1b'),'collate':_0xb2fa('0x1c')});}; \ No newline at end of file +var _0x862b=['changed','substatus','closed','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','subject','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','format'];(function(_0xb5fb77,_0x2ec122){var _0x3f4101=function(_0x25b782){while(--_0x25b782){_0xb5fb77['push'](_0xb5fb77['shift']());}};_0x3f4101(++_0x2ec122);}(_0x862b,0x175));var _0xb862=function(_0xf23728,_0x3229ec){_0xf23728=_0xf23728-0x0;var _0x10f550=_0x862b[_0xf23728];return _0x10f550;};'use strict';var _=require('lodash');var util=require(_0xb862('0x0'));var logger=require(_0xb862('0x1'))('api');var moment=require(_0xb862('0x2'));var BPromise=require(_0xb862('0x3'));var rp=require(_0xb862('0x4'));var fs=require('fs');var path=require(_0xb862('0x5'));var rimraf=require(_0xb862('0x6'));var config=require(_0xb862('0x7'));var attributes=require(_0xb862('0x8'));module[_0xb862('0x9')]=function(_0x3d7363,_0x17bd4d){return _0x3d7363[_0xb862('0xa')](_0xb862('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xb862('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1faefa,_0x254592,_0x55a25a){if(_0x1faefa['substatus']){_0x1faefa[_0xb862('0xd')]=moment()['format'](_0xb862('0xe'));}if(_0x1faefa['closed']){_0x1faefa[_0xb862('0xf')]=moment()[_0xb862('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x55a25a(null,_0x254592);},'beforeUpdate':function(_0x328b24,_0x2bcf22,_0x3d09ba){if(_0x328b24[_0xb862('0x11')](_0xb862('0x12'))){_0x328b24[_0xb862('0xd')]=_0x328b24[_0xb862('0x12')]?moment()['format'](_0xb862('0xe')):null;}if(_0x328b24[_0xb862('0x11')](_0xb862('0x13'))){_0x328b24[_0xb862('0xf')]=moment()[_0xb862('0x10')](_0xb862('0xe'));_0x328b24[_0xb862('0x12')]=null;_0x328b24[_0xb862('0xd')]=null;}_0x3d09ba(null,_0x328b24);},'afterUpdate':function(_0x5b61b0,_0x5cac29,_0x40a85c){var _0x256850=_0x3d7363['models'];var _0x4bc97a=_0x5b61b0[_0xb862('0x14')]({'plain':!![]});if(_0x4bc97a[_0xb862('0x13')]){return _0x256850[_0xb862('0x15')][_0xb862('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x4bc97a['id']}})['then'](function(){_0x40a85c();})[_0xb862('0x17')](function(_0x5a4fcd){_0x40a85c(_0x5a4fcd);});}else{_0x40a85c();}}},'charset':_0xb862('0x18'),'collate':_0xb862('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index eb0bdb2..0e17dfc 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 _0x2c6e=['UpdateMailInteraction','MailInteraction','options','raw','attributes','AddTagsToMailInteraction','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x32ca5a,_0x44cea7){var _0x8bc078=function(_0x454730){while(--_0x454730){_0x32ca5a['push'](_0x32ca5a['shift']());}};_0x8bc078(++_0x44cea7);}(_0x2c6e,0x161));var _0xe2c6=function(_0x339214,_0x3f4076){_0x339214=_0x339214-0x0;var _0x1427a3=_0x2c6e[_0x339214];return _0x1427a3;};'use strict';var _=require(_0xe2c6('0x0'));var util=require(_0xe2c6('0x1'));var moment=require(_0xe2c6('0x2'));var BPromise=require(_0xe2c6('0x3'));var rs=require(_0xe2c6('0x4'));var fs=require('fs');var Redis=require(_0xe2c6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe2c6('0x6'))(_0xe2c6('0x7'));var config=require(_0xe2c6('0x8'));var jayson=require(_0xe2c6('0x9'));var client=jayson['client'][_0xe2c6('0xa')]({'port':0x232a});config[_0xe2c6('0xb')]=_[_0xe2c6('0xc')](config[_0xe2c6('0xb')],{'host':_0xe2c6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2c6('0xb')]));require(_0xe2c6('0xe'))['register'](socket);function respondWithRpcPromise(_0x43c17a,_0x3eef40,_0x4632c9){return new BPromise(function(_0x4b8499,_0x207f7f){return client[_0xe2c6('0xf')](_0x43c17a,_0x4632c9)[_0xe2c6('0x10')](function(_0xc29680){logger[_0xe2c6('0x11')](_0xe2c6('0x12'),_0x3eef40,_0xe2c6('0x13'));logger[_0xe2c6('0x14')](_0xe2c6('0x15'),_0x3eef40,_0xe2c6('0x13'),JSON[_0xe2c6('0x16')](_0xc29680));if(_0xc29680[_0xe2c6('0x17')]){if(_0xc29680[_0xe2c6('0x17')][_0xe2c6('0x18')]===0x1f4){logger[_0xe2c6('0x17')](_0xe2c6('0x12'),_0x3eef40,_0xc29680[_0xe2c6('0x17')][_0xe2c6('0x19')]);return _0x207f7f(_0xc29680[_0xe2c6('0x17')][_0xe2c6('0x19')]);}logger[_0xe2c6('0x17')]('MailInteraction,\x20%s,\x20%s',_0x3eef40,_0xc29680[_0xe2c6('0x17')]['message']);return _0x4b8499(_0xc29680[_0xe2c6('0x17')][_0xe2c6('0x19')]);}else{logger['info'](_0xe2c6('0x12'),_0x3eef40,_0xe2c6('0x13'));_0x4b8499(_0xc29680['result'][_0xe2c6('0x19')]);}})[_0xe2c6('0x1a')](function(_0x180565){logger[_0xe2c6('0x17')](_0xe2c6('0x12'),_0x3eef40,_0x180565);_0x207f7f(_0x180565);});});}exports[_0xe2c6('0x1b')]=function(_0x31e0ac){var _0x46585d=this;return new Promise(function(_0x4f77be,_0x27c895){return db[_0xe2c6('0x1c')]['update'](_0x31e0ac['body'],{'raw':_0x31e0ac[_0xe2c6('0x1d')]?_0x31e0ac[_0xe2c6('0x1d')][_0xe2c6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31e0ac['options']?_0x31e0ac[_0xe2c6('0x1d')]['where']||null:null,'attributes':_0x31e0ac[_0xe2c6('0x1d')]?_0x31e0ac[_0xe2c6('0x1d')][_0xe2c6('0x1f')]||null:null,'limit':_0x31e0ac[_0xe2c6('0x1d')]?_0x31e0ac['options']['limit']||null:null})[_0xe2c6('0x10')](function(_0x33bf32){logger[_0xe2c6('0x11')]('UpdateMailInteraction',_0x31e0ac);logger[_0xe2c6('0x14')](_0xe2c6('0x1b'),_0x31e0ac,JSON['stringify'](_0x33bf32));_0x4f77be(_0x33bf32);})[_0xe2c6('0x1a')](function(_0x2b6d30){logger[_0xe2c6('0x17')]('UpdateMailInteraction',_0x2b6d30[_0xe2c6('0x19')],_0x31e0ac);_0x27c895(_0x46585d[_0xe2c6('0x17')](0x1f4,_0x2b6d30[_0xe2c6('0x19')]));});});};exports[_0xe2c6('0x20')]=function(_0x2da719){return new Promise(function(_0x1eb6e6,_0x1a3d44){return db['MailInteraction']['find']({'where':_0x2da719[_0xe2c6('0x1d')]?_0x2da719[_0xe2c6('0x1d')]['where']||null:null})[_0xe2c6('0x10')](function(_0x3b7083){if(_0x3b7083){return _0x3b7083['addTags'](_0x2da719[_0xe2c6('0x21')][_0xe2c6('0x22')],_[_0xe2c6('0x23')](_0x2da719[_0xe2c6('0x21')],[_0xe2c6('0x22'),'id'])||{});}})[_0xe2c6('0x24')](function(_0x154e5d){logger[_0xe2c6('0x11')](_0xe2c6('0x25'),_0x2da719);logger[_0xe2c6('0x14')](_0xe2c6('0x25'),_0x2da719,JSON[_0xe2c6('0x16')](_0x154e5d));_0x1eb6e6(_0x154e5d);})[_0xe2c6('0x1a')](function(_0x5a1f17){logger[_0xe2c6('0x17')](_0xe2c6('0x25'),_0x5a1f17['message'],_0x2da719);_0x1a3d44(_this[_0xe2c6('0x17')](0x1f4,_0x5a1f17['message']));});});}; \ No newline at end of file +var _0x4b57=['where','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./mailInteraction.socket','request','then','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','info','result','catch','UpdateMailInteraction','MailInteraction','update','options','attributes','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b57,0xaa));var _0x74b5=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x4b57[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0x74b5('0x0'));var util=require(_0x74b5('0x1'));var moment=require(_0x74b5('0x2'));var BPromise=require(_0x74b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74b5('0x4'));var db=require(_0x74b5('0x5'))['db'];var utils=require(_0x74b5('0x6'));var logger=require(_0x74b5('0x7'))(_0x74b5('0x8'));var config=require('../../config/environment');var jayson=require(_0x74b5('0x9'));var client=jayson[_0x74b5('0xa')]['http']({'port':0x232a});config['redis']=_[_0x74b5('0xb')](config['redis'],{'host':_0x74b5('0xc'),'port':0x18eb});var socket=require(_0x74b5('0xd'))(new Redis(config[_0x74b5('0xe')]));require(_0x74b5('0xf'))['register'](socket);function respondWithRpcPromise(_0x4e9840,_0x3c8b85,_0x241d95){return new BPromise(function(_0x2129ee,_0x300fd2){return client[_0x74b5('0x10')](_0x4e9840,_0x241d95)[_0x74b5('0x11')](function(_0x426900){logger['info']('MailInteraction,\x20%s,\x20%s',_0x3c8b85,_0x74b5('0x12'));logger[_0x74b5('0x13')](_0x74b5('0x14'),_0x3c8b85,_0x74b5('0x12'),JSON[_0x74b5('0x15')](_0x426900));if(_0x426900[_0x74b5('0x16')]){if(_0x426900['error'][_0x74b5('0x17')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x3c8b85,_0x426900[_0x74b5('0x16')][_0x74b5('0x18')]);return _0x300fd2(_0x426900['error']['message']);}logger[_0x74b5('0x16')](_0x74b5('0x19'),_0x3c8b85,_0x426900[_0x74b5('0x16')][_0x74b5('0x18')]);return _0x2129ee(_0x426900[_0x74b5('0x16')]['message']);}else{logger[_0x74b5('0x1a')](_0x74b5('0x19'),_0x3c8b85,_0x74b5('0x12'));_0x2129ee(_0x426900[_0x74b5('0x1b')][_0x74b5('0x18')]);}})[_0x74b5('0x1c')](function(_0x275e8d){logger[_0x74b5('0x16')](_0x74b5('0x19'),_0x3c8b85,_0x275e8d);_0x300fd2(_0x275e8d);});});}exports[_0x74b5('0x1d')]=function(_0x19d90a){var _0x2f45b9=this;return new Promise(function(_0x9ce273,_0x20adda){return db[_0x74b5('0x1e')][_0x74b5('0x1f')](_0x19d90a['body'],{'raw':_0x19d90a[_0x74b5('0x20')]?_0x19d90a[_0x74b5('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d90a[_0x74b5('0x20')]?_0x19d90a[_0x74b5('0x20')]['where']||null:null,'attributes':_0x19d90a[_0x74b5('0x20')]?_0x19d90a[_0x74b5('0x20')][_0x74b5('0x21')]||null:null,'limit':_0x19d90a[_0x74b5('0x20')]?_0x19d90a[_0x74b5('0x20')][_0x74b5('0x22')]||null:null})['then'](function(_0x3f9e8a){logger[_0x74b5('0x1a')]('UpdateMailInteraction',_0x19d90a);logger[_0x74b5('0x13')](_0x74b5('0x1d'),_0x19d90a,JSON['stringify'](_0x3f9e8a));_0x9ce273(_0x3f9e8a);})['catch'](function(_0x53321d){logger[_0x74b5('0x16')](_0x74b5('0x1d'),_0x53321d['message'],_0x19d90a);_0x20adda(_0x2f45b9['error'](0x1f4,_0x53321d[_0x74b5('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0x426d9d){return new Promise(function(_0x48be21,_0x2cbf4f){return db[_0x74b5('0x1e')]['find']({'where':_0x426d9d[_0x74b5('0x20')]?_0x426d9d[_0x74b5('0x20')][_0x74b5('0x23')]||null:null})['then'](function(_0x34fa13){if(_0x34fa13){return _0x34fa13[_0x74b5('0x24')](_0x426d9d[_0x74b5('0x25')][_0x74b5('0x26')],_['omit'](_0x426d9d[_0x74b5('0x25')],[_0x74b5('0x26'),'id'])||{});}})[_0x74b5('0x27')](function(_0x3bb74e){logger['info'](_0x74b5('0x28'),_0x426d9d);logger[_0x74b5('0x13')](_0x74b5('0x28'),_0x426d9d,JSON[_0x74b5('0x15')](_0x3bb74e));_0x48be21(_0x3bb74e);})['catch'](function(_0x56cdd7){logger[_0x74b5('0x16')](_0x74b5('0x28'),_0x56cdd7[_0x74b5('0x18')],_0x426d9d);_0x2cbf4f(_this[_0x74b5('0x16')](0x1f4,_0x56cdd7[_0x74b5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index af9f9f2..50a06ae 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 _0x4d80=['save','remove','emit','register','length','mailInteraction:'];(function(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0x4d80,0x162));var _0x04d8=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4d80[_0x199572];return _0x13cfa3;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x04d8('0x0'),_0x04d8('0x1'),'update'];function createListener(_0x24ff43,_0x41ad22){return function(_0x46f3a0){_0x41ad22[_0x04d8('0x2')](_0x24ff43,_0x46f3a0);};}function removeListener(_0x508ea3,_0x4e80d1){return function(){MailInteractionEvents['removeListener'](_0x508ea3,_0x4e80d1);};}exports[_0x04d8('0x3')]=function(_0x5def5d){for(var _0x2b194b=0x0,_0x2e3f64=events[_0x04d8('0x4')];_0x2b194b<_0x2e3f64;_0x2b194b++){var _0x2ba37f=events[_0x2b194b];var _0x32d88f=createListener(_0x04d8('0x5')+_0x2ba37f,_0x5def5d);MailInteractionEvents['on'](_0x2ba37f,_0x32d88f);}}; \ No newline at end of file +var _0xbf85=['remove','update','emit','removeListener','./mailInteraction.events'];(function(_0x388dc4,_0x10ef93){var _0x372b1b=function(_0x23fada){while(--_0x23fada){_0x388dc4['push'](_0x388dc4['shift']());}};_0x372b1b(++_0x10ef93);}(_0xbf85,0x7c));var _0x5bf8=function(_0x16c81a,_0x409366){_0x16c81a=_0x16c81a-0x0;var _0x261858=_0xbf85[_0x16c81a];return _0x261858;};'use strict';var MailInteractionEvents=require(_0x5bf8('0x0'));var events=['save',_0x5bf8('0x1'),_0x5bf8('0x2')];function createListener(_0x1a360e,_0x2c876e){return function(_0x4a985a){_0x2c876e[_0x5bf8('0x3')](_0x1a360e,_0x4a985a);};}function removeListener(_0x468e65,_0x6b4360){return function(){MailInteractionEvents[_0x5bf8('0x4')](_0x468e65,_0x6b4360);};}exports['register']=function(_0x496cdb){for(var _0x4831bb=0x0,_0x56259f=events['length'];_0x4831bb<_0x56259f;_0x4831bb++){var _0x5be6f0=events[_0x4831bb];var _0x47df9a=createListener('mailInteraction:'+_0x5be6f0,_0x496cdb);MailInteractionEvents['on'](_0x5be6f0,_0x47df9a);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index c8397ae..cc48196 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 _0x1d2d=['/:id','show','/:id/download','download','post','tracked','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe'];(function(_0x452259,_0x580308){var _0x192c46=function(_0x4bd83c){while(--_0x4bd83c){_0x452259['push'](_0x452259['shift']());}};_0x192c46(++_0x580308);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x19cae0,_0x390962){_0x19cae0=_0x19cae0-0x0;var _0xfec11e=_0x1d2d[_0x19cae0];return _0xfec11e;};'use strict';var multer=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var path=require(_0xd1d2('0x2'));var timeout=require(_0xd1d2('0x3'));var express=require(_0xd1d2('0x4'));var router=express['Router']();var fs_extra=require(_0xd1d2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1d2('0x6'));var controller=require(_0xd1d2('0x7'));router[_0xd1d2('0x8')]('/',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xa')]);router[_0xd1d2('0x8')]('/describe',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xb')]);router[_0xd1d2('0x8')](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xd')]);router[_0xd1d2('0x8')](_0xd1d2('0xe'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xf')]);router[_0xd1d2('0x10')]('/',auth[_0xd1d2('0x9')](),interaction[_0xd1d2('0x11')]('mail',_0xd1d2('0x12')),controller[_0xd1d2('0x13')]);router[_0xd1d2('0x14')](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x15')]);router[_0xd1d2('0x14')](_0xd1d2('0x16'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x17')]);router['put'](_0xd1d2('0x18'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x19')]);router['delete'](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x1a')]);module[_0xd1d2('0x1b')]=router; \ No newline at end of file +var _0x6d4a=['/:id','update','put','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','post','mail','mailmessage:create','create'];(function(_0x12abdd,_0x40c627){var _0x24df07=function(_0x9f44eb){while(--_0x9f44eb){_0x12abdd['push'](_0x12abdd['shift']());}};_0x24df07(++_0x40c627);}(_0x6d4a,0x117));var _0xa6d4=function(_0x575907,_0x1d3402){_0x575907=_0x575907-0x0;var _0x208b83=_0x6d4a[_0x575907];return _0x208b83;};'use strict';var multer=require(_0xa6d4('0x0'));var util=require('util');var path=require(_0xa6d4('0x1'));var timeout=require(_0xa6d4('0x2'));var express=require(_0xa6d4('0x3'));var router=express[_0xa6d4('0x4')]();var fs_extra=require(_0xa6d4('0x5'));var auth=require(_0xa6d4('0x6'));var interaction=require(_0xa6d4('0x7'));var config=require(_0xa6d4('0x8'));var controller=require(_0xa6d4('0x9'));router[_0xa6d4('0xa')]('/',auth[_0xa6d4('0xb')](),controller[_0xa6d4('0xc')]);router[_0xa6d4('0xa')](_0xa6d4('0xd'),auth['isAuthenticated'](),controller[_0xa6d4('0xe')]);router[_0xa6d4('0xa')]('/:id',auth[_0xa6d4('0xb')](),controller[_0xa6d4('0xf')]);router[_0xa6d4('0xa')](_0xa6d4('0x10'),auth[_0xa6d4('0xb')](),controller['download']);router[_0xa6d4('0x11')]('/',auth[_0xa6d4('0xb')](),interaction['tracked'](_0xa6d4('0x12'),_0xa6d4('0x13')),controller[_0xa6d4('0x14')]);router['put'](_0xa6d4('0x15'),auth['isAuthenticated'](),controller[_0xa6d4('0x16')]);router[_0xa6d4('0x17')]('/:id/accept',auth[_0xa6d4('0xb')](),controller[_0xa6d4('0x18')]);router[_0xa6d4('0x17')](_0xa6d4('0x19'),auth[_0xa6d4('0xb')](),controller[_0xa6d4('0x1a')]);router[_0xa6d4('0x1b')](_0xa6d4('0x15'),auth[_0xa6d4('0xb')](),controller[_0xa6d4('0x1c')]);module[_0xa6d4('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index adeedb6..81ff81b 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 _0xe6c3=['out','DATE','INTEGER','Email','lodash','TEXT','long','medium','ENUM'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xe6c3,0x8b));var _0x3e6c=function(_0x410e47,_0x52b364){_0x410e47=_0x410e47-0x0;var _0x385a9c=_0xe6c3[_0x410e47];return _0x385a9c;};'use strict';var Sequelize=require('sequelize');var _=require(_0x3e6c('0x0'));module['exports']={'body':{'type':Sequelize[_0x3e6c('0x1')](_0x3e6c('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3e6c('0x1')](_0x3e6c('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3e6c('0x4')]('in','out'),'defaultValue':_0x3e6c('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x3e6c('0x1')]('long')},'cc':{'type':Sequelize['TEXT'](_0x3e6c('0x2'))},'bcc':{'type':Sequelize[_0x3e6c('0x1')](_0x3e6c('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x3e6c('0x6')]},'attach':{'type':Sequelize[_0x3e6c('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x3e6c('0x1')](_0x3e6c('0x2'))},'originCc':{'type':Sequelize[_0x3e6c('0x1')]('long')},'originChannel':{'type':Sequelize[_0x3e6c('0x4')]('Email','Chat'),'defaultValue':_0x3e6c('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0x66e2=['INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','out','STRING','DATE'];(function(_0x3be470,_0x4f5286){var _0x43aefa=function(_0x1dd96c){while(--_0x1dd96c){_0x3be470['push'](_0x3be470['shift']());}};_0x43aefa(++_0x4f5286);}(_0x66e2,0xfa));var _0x266e=function(_0x41476c,_0x91403){_0x41476c=_0x41476c-0x0;var _0x367e81=_0x66e2[_0x41476c];return _0x367e81;};'use strict';var Sequelize=require(_0x266e('0x0'));var _=require(_0x266e('0x1'));module[_0x266e('0x2')]={'body':{'type':Sequelize[_0x266e('0x3')](_0x266e('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x266e('0x3')](_0x266e('0x5'))},'read':{'type':Sequelize[_0x266e('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x266e('0x7')),'defaultValue':_0x266e('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x266e('0x8')](0x1fe)},'from':{'type':Sequelize[_0x266e('0x8')]},'to':{'type':Sequelize[_0x266e('0x3')](_0x266e('0x4'))},'cc':{'type':Sequelize[_0x266e('0x3')](_0x266e('0x4'))},'bcc':{'type':Sequelize[_0x266e('0x3')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x266e('0x9')]},'attach':{'type':Sequelize[_0x266e('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x266e('0x3')](_0x266e('0x4'))},'originCc':{'type':Sequelize[_0x266e('0x3')](_0x266e('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x266e('0xb'),_0x266e('0xc')),'defaultValue':_0x266e('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 827624a..be6f6ad 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 _0x669e=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','VIRTUAL','filter','merge','MailMessage','includeAll','rows','show','params','options','find','body','describe','create','direction','out','secret','split','MailAccountId','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','CmContact','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','SIP/%s','channel','fromString','EventManager','acceptmessage','reject','mail','rejectMessage','motionChannel','event','rejectmessage','download','toString','server','files','tmp','join','message-%s.eml','from','subject','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Attachments','push','readFileSync','writeFileSync','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','catch','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','map'];(function(_0x48c64f,_0x2bc228){var _0x15e8df=function(_0x403a39){while(--_0x403a39){_0x48c64f['push'](_0x48c64f['shift']());}};_0x15e8df(++_0x2bc228);}(_0x669e,0x70));var _0xe669=function(_0xfa7903,_0x1743fe){_0xfa7903=_0xfa7903-0x0;var _0x2d0d8a=_0x669e[_0xfa7903];return _0x2d0d8a;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0xe669('0x0'));var util=require(_0xe669('0x1'));var path=require(_0xe669('0x2'));var fs=require('fs');var _=require(_0xe669('0x3'));var Redis=require(_0xe669('0x4'));var htmlToText=require('html-to-text');var qs=require(_0xe669('0x5'));var logger=require('../../config/logger')(_0xe669('0x6'));var interaction_log=require('../../config/logger')(_0xe669('0x7'));var config=require(_0xe669('0x8'));var db=require(_0xe669('0x9'))['db'];config[_0xe669('0xa')]=_['defaults'](config['redis'],{'host':_0xe669('0xb'),'port':0x18eb});var socket=require(_0xe669('0xc'))(new Redis(config[_0xe669('0xa')]));var htmlEntities=require(_0xe669('0xd'));require(_0xe669('0xe'))[_0xe669('0xf')](socket);var jayson=require(_0xe669('0x10'));var client=jayson[_0xe669('0x11')]['http']({'port':0x232c});var client9003=jayson[_0xe669('0x11')][_0xe669('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xe669('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x140688,_0x303db0,_0xe2f171,_0x1f6990){return new BPromise(function(_0x31aaef,_0x55c439){var _0x5b5116=_0x1f6990||client;return _0x5b5116[_0xe669('0x13')](_0x140688,_0xe2f171)[_0xe669('0x14')](function(_0x4806f9){logger[_0xe669('0x15')]('MailMessage,\x20%s,\x20%s',_0x303db0,_0xe669('0x16'));logger[_0xe669('0x17')](_0xe669('0x18'),_0x303db0,_0xe669('0x16'),JSON[_0xe669('0x19')](_0x4806f9));if(_0x4806f9[_0xe669('0x1a')]){if(_0x4806f9[_0xe669('0x1a')][_0xe669('0x1b')]===0x1f4){logger['error'](_0xe669('0x1c'),_0x303db0,_0x4806f9[_0xe669('0x1a')]['message']);return _0x55c439(_0x4806f9['error'][_0xe669('0x1d')]);}logger[_0xe669('0x1a')](_0xe669('0x1c'),_0x303db0,_0x4806f9['error']['message']);return _0x31aaef(_0x4806f9[_0xe669('0x1a')][_0xe669('0x1d')]);}else{logger[_0xe669('0x15')]('MailMessage,\x20%s,\x20%s',_0x303db0,'request\x20sent');_0x31aaef(_0x4806f9['result'][_0xe669('0x1d')]);}})[_0xe669('0x1e')](function(_0x1f8a2c){logger[_0xe669('0x1a')](_0xe669('0x1c'),_0x303db0,_0x1f8a2c);_0x55c439(_0x1f8a2c);});});}function respondWithResult(_0x2f684c,_0x275901){_0x275901=_0x275901||0xc8;return function(_0x446025){if(_0x446025){return _0x2f684c[_0xe669('0x1f')](_0x275901)[_0xe669('0x20')](_0x446025);}};}function respondWithFilteredResult(_0x44dd7a,_0x46f732){return function(_0xfa1da9){if(_0xfa1da9){var _0x3e0aba=typeof _0x46f732['offset']===_0xe669('0x21')&&typeof _0x46f732['limit']===_0xe669('0x21');var _0x47bc41=_0xfa1da9[_0xe669('0x22')];var _0x17221a=_0x3e0aba?0x0:_0x46f732[_0xe669('0x23')];var _0xb8e487=_0x3e0aba?_0xfa1da9['count']:_0x46f732['offset']+_0x46f732[_0xe669('0x24')];var _0x2e4b9a;if(_0xb8e487>=_0x47bc41){_0xb8e487=_0x47bc41;_0x2e4b9a=0xc8;}else{_0x2e4b9a=0xce;}_0x44dd7a[_0xe669('0x1f')](_0x2e4b9a);return _0x44dd7a[_0xe669('0x25')](_0xe669('0x26'),_0x17221a+'-'+_0xb8e487+'/'+_0x47bc41)[_0xe669('0x20')](_0xfa1da9);}return null;};}function saveUpdates(_0x2487f7){return function(_0x6b0bd1){if(_0x6b0bd1){return _0x6b0bd1[_0xe669('0x27')](_0x2487f7)[_0xe669('0x14')](function(_0x4c2b51){return _0x4c2b51;});}return null;};}function removeEntity(_0x470eff){return function(_0x13a1d5){if(_0x13a1d5){return _0x13a1d5[_0xe669('0x28')]()[_0xe669('0x14')](function(){_0x470eff[_0xe669('0x1f')](0xcc)[_0xe669('0x29')]();});}};}function handleEntityNotFound(_0x43472c){return function(_0x45ecf3){if(!_0x45ecf3){_0x43472c[_0xe669('0x2a')](0x194);}return _0x45ecf3;};}function handleError(_0x80b419,_0xa27a46){_0xa27a46=_0xa27a46||0x1f4;return function(_0x5419d4){logger[_0xe669('0x1a')](_0x5419d4[_0xe669('0x2b')]);if(_0x5419d4['name']){delete _0x5419d4[_0xe669('0x2c')];}_0x80b419['status'](_0xa27a46)['send'](_0x5419d4);};}exports[_0xe669('0x2d')]=function(_0x17b3c3,_0x25bd2d){var _0x3f3a09={},_0x940c57={},_0x2e3248={'count':0x0,'rows':[]};var _0x2c9126=_[_0xe669('0x2e')](db['MailMessage'][_0xe669('0x2f')],function(_0x5442c7){return{'name':_0x5442c7[_0xe669('0x30')],'type':_0x5442c7[_0xe669('0x31')][_0xe669('0x32')]};});_0x940c57[_0xe669('0x33')]=_[_0xe669('0x2e')](_0x2c9126,'name');_0x940c57[_0xe669('0x34')]=_[_0xe669('0x35')](_0x17b3c3['query']);_0x940c57['filters']=_[_0xe669('0x36')](_0x940c57['model'],_0x940c57[_0xe669('0x34')]);_0x3f3a09[_0xe669('0x37')]=_[_0xe669('0x36')](_0x940c57[_0xe669('0x33')],qs[_0xe669('0x38')](_0x17b3c3['query']['fields']));_0x3f3a09['attributes']=_0x3f3a09[_0xe669('0x37')][_0xe669('0x39')]?_0x3f3a09[_0xe669('0x37')]:_0x940c57[_0xe669('0x33')];if(!_0x17b3c3['query'][_0xe669('0x3a')](_0xe669('0x3b'))){_0x3f3a09['limit']=qs[_0xe669('0x24')](_0x17b3c3[_0xe669('0x34')][_0xe669('0x24')]);_0x3f3a09['offset']=qs['offset'](_0x17b3c3[_0xe669('0x34')][_0xe669('0x23')]);}_0x3f3a09['order']=qs[_0xe669('0x3c')](_0x17b3c3[_0xe669('0x34')][_0xe669('0x3c')]);_0x3f3a09['where']=qs[_0xe669('0x3d')](_[_0xe669('0x3e')](_0x17b3c3[_0xe669('0x34')],_0x940c57[_0xe669('0x3d')]),_0x2c9126);if(_0x17b3c3['query']['filter']){_0x3f3a09[_0xe669('0x3f')]=_['merge'](_0x3f3a09[_0xe669('0x3f')],{'$or':_[_0xe669('0x2e')](_0x2c9126,function(_0x7a54a5){if(_0x7a54a5[_0xe669('0x31')]!==_0xe669('0x40')){var _0x4796db={};_0x4796db[_0x7a54a5[_0xe669('0x2c')]]={'$like':'%'+_0x17b3c3[_0xe669('0x34')][_0xe669('0x41')]+'%'};return _0x4796db;}})});}_0x3f3a09=_[_0xe669('0x42')]({},_0x3f3a09,_0x17b3c3['options']);var _0x455b0b={'where':_0x3f3a09[_0xe669('0x3f')]};return db[_0xe669('0x43')][_0xe669('0x22')](_0x455b0b)['then'](function(_0x302785){_0x2e3248[_0xe669('0x22')]=_0x302785;if(_0x17b3c3[_0xe669('0x34')][_0xe669('0x44')]){_0x3f3a09['include']=[{'all':!![]}];}return db[_0xe669('0x43')]['findAll'](_0x3f3a09);})[_0xe669('0x14')](function(_0x264736){_0x2e3248[_0xe669('0x45')]=_0x264736;return _0x2e3248;})[_0xe669('0x14')](respondWithFilteredResult(_0x25bd2d,_0x3f3a09))[_0xe669('0x1e')](handleError(_0x25bd2d,null));};exports[_0xe669('0x46')]=function(_0x1fa48a,_0x46dd10){var _0x20ffc7={'raw':!![],'where':{'id':_0x1fa48a[_0xe669('0x47')]['id']}},_0x20dfd4={};_0x20dfd4[_0xe669('0x33')]=_[_0xe669('0x35')](db[_0xe669('0x43')]['rawAttributes']);_0x20dfd4['query']=_['keys'](_0x1fa48a[_0xe669('0x34')]);_0x20dfd4[_0xe669('0x3d')]=_[_0xe669('0x36')](_0x20dfd4[_0xe669('0x33')],_0x20dfd4[_0xe669('0x34')]);_0x20ffc7[_0xe669('0x37')]=_[_0xe669('0x36')](_0x20dfd4[_0xe669('0x33')],qs[_0xe669('0x38')](_0x1fa48a[_0xe669('0x34')][_0xe669('0x38')]));_0x20ffc7['attributes']=_0x20ffc7[_0xe669('0x37')][_0xe669('0x39')]?_0x20ffc7[_0xe669('0x37')]:_0x20dfd4['model'];if(_0x1fa48a[_0xe669('0x34')][_0xe669('0x44')]){_0x20ffc7['include']=[{'all':!![]}];}_0x20ffc7=_['merge']({},_0x20ffc7,_0x1fa48a[_0xe669('0x48')]);return db['MailMessage'][_0xe669('0x49')](_0x20ffc7)[_0xe669('0x14')](handleEntityNotFound(_0x46dd10,null))[_0xe669('0x14')](respondWithResult(_0x46dd10,null))[_0xe669('0x1e')](handleError(_0x46dd10,null));};exports['update']=function(_0x2970e1,_0x5a97cc){if(_0x2970e1[_0xe669('0x4a')]['id']){delete _0x2970e1[_0xe669('0x4a')]['id'];}return db['MailMessage'][_0xe669('0x49')]({'where':{'id':_0x2970e1[_0xe669('0x47')]['id']}})[_0xe669('0x14')](handleEntityNotFound(_0x5a97cc,null))[_0xe669('0x14')](saveUpdates(_0x2970e1[_0xe669('0x4a')],null))[_0xe669('0x14')](respondWithResult(_0x5a97cc,null))[_0xe669('0x1e')](handleError(_0x5a97cc,null));};exports[_0xe669('0x28')]=function(_0x4d1b09,_0x55d526){return db['MailMessage'][_0xe669('0x49')]({'where':{'id':_0x4d1b09[_0xe669('0x47')]['id']}})['then'](handleEntityNotFound(_0x55d526,null))[_0xe669('0x14')](removeEntity(_0x55d526,null))[_0xe669('0x1e')](handleError(_0x55d526,null));};exports[_0xe669('0x4b')]=function(_0x4b7e96,_0x239878){return db[_0xe669('0x43')][_0xe669('0x4b')]()[_0xe669('0x14')](respondWithResult(_0x239878,null))[_0xe669('0x1e')](handleError(_0x239878,null));};exports[_0xe669('0x4c')]=function(_0x3f700f,_0x3dccab){return db[_0xe669('0x43')][_0xe669('0x4c')](_0x3f700f[_0xe669('0x4a')])[_0xe669('0x14')](function(_0x175468){if(_0x175468){if(_0x175468[_0xe669('0x4d')]===_0xe669('0x4e')&&!_0x175468[_0xe669('0x4f')]){var _0x34153c,_0x37d25a,_0x3b963b;if(_0x3f700f[_0xe669('0x4a')]['to']){_0x37d25a=_0x3f700f[_0xe669('0x4a')]['to'][_0xe669('0x50')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x175468[_0xe669('0x51')]},'include':[{'model':db['CmList'],'as':_0xe669('0x52'),'include':[{'model':db['CmContact'],'as':_0xe669('0x53'),'where':{'email':_0x37d25a},'limit':0x1,'order':[[_0xe669('0x54'),_0xe669('0x55')]]}]},{'model':db[_0xe669('0x56')],'as':_0xe669('0x57'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe669('0x58'),'raw':!![]}]}]})[_0xe669('0x14')](function(_0x50a0cb){_0x34153c=_0x50a0cb;if(!_0x34153c||!_0x34153c['Smtp'])return;var _0x4e2fff=_0x34153c[_0xe669('0x59')]();if(_0x3f700f['body']['attachments']&&_0x3f700f[_0xe669('0x4a')][_0xe669('0x5a')]['length']){for(var _0x20e1aa=0x0;_0x20e1aa<_0x3f700f[_0xe669('0x4a')][_0xe669('0x5a')]['length'];_0x20e1aa+=0x1){_0x3f700f[_0xe669('0x4a')]['attachments'][_0x20e1aa]={'filename':_0x3f700f['body'][_0xe669('0x5a')][_0x20e1aa][_0xe669('0x2c')],'path':path['join'](config[_0xe669('0x5b')],_0xe669('0x5c'),_0x3f700f['body'][_0xe669('0x5a')][_0x20e1aa][_0xe669('0x5d')])};}}_0x3b963b={'account':_0x4e2fff,'message':_0x3f700f[_0xe669('0x4a')]};return;})['then'](function(){if(_0x34153c[_0xe669('0x52')]){if(_0x34153c[_0xe669('0x52')][_0xe669('0x53')][_0xe669('0x39')]){return _0x34153c[_0xe669('0x52')][_0xe669('0x53')][0x0];}else{return db[_0xe669('0x5e')][_0xe669('0x4c')](_[_0xe669('0x5f')](_0x3f700f[_0xe669('0x4a')],{'firstName':_0x3f700f['body']['to'],'email':_0x3f700f[_0xe669('0x4a')]['to'],'phone':_0x3f700f[_0xe669('0x4a')]['to'],'ListId':_0x34153c[_0xe669('0x60')]}));}}else{throw new Error(_0xe669('0x61'));}})[_0xe669('0x14')](function(){if(_0x3b963b){return respondWithRpcPromise(_0xe669('0x62'),_0xe669('0x63'),_0x3b963b,client9003)[_0xe669('0x14')](function(_0x5a7259){return _0x175468['update']({'read':!![],'messageId':_0x5a7259[_0xe669('0x64')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x4192f5){logger['error']('%s',JSON['stringify'](_0x4192f5));return _0x175468;});}return _0x175468;});}return _0x175468;}})[_0xe669('0x14')](respondWithResult(_0x3dccab,0xc9))['catch'](handleError(_0x3dccab,null));};exports[_0xe669('0x65')]=function(_0x287342,_0x18a57c){var _0x5ed40b={'agent':{},'channel':'mail'};if(_0x287342[_0xe669('0x4a')]['id']){delete _0x287342[_0xe669('0x4a')]['id'];}_0x287342['body'][_0xe669('0x66')]=!![];_0x287342[_0xe669('0x4a')][_0xe669('0x67')]=moment()[_0xe669('0x68')](_0xe669('0x69'));_0x287342[_0xe669('0x4a')][_0xe669('0x6a')]=_0x287342[_0xe669('0x4a')]['UserId']||_0x287342[_0xe669('0x6b')]['id'];_0x5ed40b[_0xe669('0x6c')]['id']=_0x287342[_0xe669('0x4a')]['UserId'];return db[_0xe669('0x43')][_0xe669('0x49')]({'where':{'id':_0x287342[_0xe669('0x47')]['id'],'UserId':null}})[_0xe669('0x14')](handleEntityNotFound(_0x18a57c,null))[_0xe669('0x14')](saveUpdates(_0x287342[_0xe669('0x4a')],null))['then'](function(_0x20ab71){if(_0x20ab71){_0x5ed40b[_0xe669('0x1d')]=_0x20ab71[_0xe669('0x6d')]({'plain':!![]});return db[_0xe669('0x6e')][_0xe669('0x49')]({'where':{'id':_0x20ab71[_0xe669('0x6f')]}});}return null;})[_0xe669('0x14')](handleEntityNotFound(_0x18a57c,null))[_0xe669('0x14')](function(_0x539b7a){if(_0x539b7a){return _0x539b7a[_0xe669('0x27')]({'UserId':_0x287342[_0xe669('0x4a')][_0xe669('0x6a')],'read1stAt':_[_0xe669('0x70')](_0x539b7a[_0xe669('0x71')])?moment()[_0xe669('0x68')](_0xe669('0x69')):undefined});}return null;})[_0xe669('0x14')](function(_0x1ffb28){if(_0x1ffb28){_0x5ed40b[_0xe669('0x72')]=_0x1ffb28['get']({'plain':!![]});interaction_log[_0xe669('0x15')](_0xe669('0x73'),_0x287342[_0xe669('0x6b')]['id'],_0x287342[_0xe669('0x6b')][_0xe669('0x2c')],_0x287342[_0xe669('0x6b')][_0xe669('0x74')],_0x5ed40b[_0xe669('0x72')]['id'],_0x287342[_0xe669('0x4a')]?JSON[_0xe669('0x19')](_0x287342[_0xe669('0x4a')]):'null');return respondWithRpcPromise(_0xe669('0x75'),_0xe669('0x76'),_0x5ed40b);}return null;})[_0xe669('0x14')](function(_0x3a5dfb){var _0x3669e1=_0xe669('0x77')+_0x3a5dfb[_0xe669('0x1d')][_0xe669('0x78')];return db[_0xe669('0x79')][_0xe669('0x34')](_0x3669e1,{'type':db['Sequelize'][_0xe669('0x7a')][_0xe669('0x7b')],'raw':!![]})[_0xe669('0x14')](function(_0x1fd450){return _0x1fd450;});})['then'](function(_0x16d7b8){if(_0x16d7b8){_0x5ed40b[_0xe669('0x1d')][_0xe669('0x7c')]=_0x16d7b8[0x0];if(!_0x287342[_0xe669('0x4a')][_0xe669('0x6a')])return;return db[_0xe669('0x7d')][_0xe669('0x49')]({'where':{'id':_0x287342[_0xe669('0x4a')][_0xe669('0x6a')],'role':_0xe669('0x6c')},'attributes':['id',_0xe669('0x2c'),_0xe669('0x7e'),'email',_0xe669('0x7f')],'raw':!![]});}return null;})['then'](function(_0x623f7c){if(!_0x623f7c)return null;_0x5ed40b['message']['agent']=_0x623f7c;return _0x5ed40b;})['then'](function(_0x58c5b0){if(_0x58c5b0){if(_0x287342[_0xe669('0x4a')]['manual']){_0x5ed40b['message'][_0xe669('0x80')]=util[_0xe669('0x68')](_0xe669('0x81'),_0x287342[_0xe669('0x6b')][_0xe669('0x2c')]);_0x5ed40b['message'][_0xe669('0x82')]=_0x5ed40b[_0xe669('0x82')];_0x5ed40b[_0xe669('0x1d')]['motionChannel']=_0x5ed40b[_0xe669('0x82')];_0x5ed40b[_0xe669('0x1d')]['event']=_0xe669('0x65');_0x5ed40b[_0xe669('0x1d')][_0xe669('0x4a')]=htmlToText[_0xe669('0x83')](_0x5ed40b[_0xe669('0x1d')]['body']);return respondWithRpcPromise(_0xe669('0x84'),_0xe669('0x84'),{'event':_0xe669('0x85'),'message':_0x5ed40b[_0xe669('0x1d')]},client9002)[_0xe669('0x14')](function(){return _0x5ed40b;});}return _0x5ed40b;}return null;})[_0xe669('0x14')](respondWithResult(_0x18a57c,null))[_0xe669('0x1e')](handleError(_0x18a57c,null));};exports[_0xe669('0x86')]=function(_0x156ab5,_0x428a4f){var _0x5d8df6={'agent':{},'channel':_0xe669('0x87')};if(_0x156ab5[_0xe669('0x4a')]['id']){delete _0x156ab5[_0xe669('0x4a')]['id'];}_0x156ab5[_0xe669('0x4a')]['UserId']=_0x156ab5[_0xe669('0x4a')][_0xe669('0x6a')]||_0x156ab5[_0xe669('0x6b')]['id'];_0x5d8df6[_0xe669('0x6c')]['id']=_0x156ab5[_0xe669('0x4a')][_0xe669('0x6a')];return db['MailMessage'][_0xe669('0x49')]({'where':{'id':_0x156ab5[_0xe669('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x428a4f,null))[_0xe669('0x14')](function(_0x211d08){if(_0x211d08){_0x5d8df6[_0xe669('0x1d')]=_0x211d08[_0xe669('0x6d')]({'plain':!![]});return db['MailInteraction'][_0xe669('0x49')]({'where':{'id':_0x211d08[_0xe669('0x6f')]}});}return null;})[_0xe669('0x14')](handleEntityNotFound(_0x428a4f,null))[_0xe669('0x14')](function(_0x4d8d3a){if(_0x4d8d3a){_0x5d8df6[_0xe669('0x72')]=_0x4d8d3a[_0xe669('0x6d')]({'plain':!![]});interaction_log[_0xe669('0x15')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x156ab5[_0xe669('0x6b')]['id'],_0x156ab5[_0xe669('0x6b')][_0xe669('0x2c')],_0x156ab5[_0xe669('0x6b')][_0xe669('0x74')],_0x5d8df6[_0xe669('0x72')]['id'],_0x156ab5[_0xe669('0x4a')]?JSON['stringify'](_0x156ab5[_0xe669('0x4a')]):'null');return respondWithRpcPromise('RejectMessage',_0xe669('0x88'),_0x5d8df6);}return null;})[_0xe669('0x14')](function(_0x25baf9){var _0x5b6db6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x25baf9[_0xe669('0x1d')]['ContactId'];return db[_0xe669('0x79')][_0xe669('0x34')](_0x5b6db6,{'type':db['Sequelize'][_0xe669('0x7a')][_0xe669('0x7b')],'raw':!![]})[_0xe669('0x14')](function(_0x133d15){return _0x133d15;});})['then'](function(_0x1579aa){if(_0x1579aa){_0x5d8df6['message'][_0xe669('0x7c')]=_0x1579aa[0x0];if(!_0x156ab5['body']['UserId'])return;return db[_0xe669('0x7d')][_0xe669('0x49')]({'where':{'id':_0x156ab5[_0xe669('0x4a')][_0xe669('0x6a')],'role':_0xe669('0x6c')},'attributes':['id',_0xe669('0x2c'),_0xe669('0x7e'),'email',_0xe669('0x7f')],'raw':!![]});}return null;})['then'](function(_0x4fe0a5){if(!_0x4fe0a5)return null;_0x5d8df6[_0xe669('0x1d')][_0xe669('0x6c')]=_0x4fe0a5;return _0x5d8df6;})[_0xe669('0x14')](function(_0x295d5d){if(_0x295d5d){_0x295d5d[_0xe669('0x1d')][_0xe669('0x80')]=util['format'](_0xe669('0x81'),_0x156ab5['user'][_0xe669('0x2c')]);_0x295d5d[_0xe669('0x1d')][_0xe669('0x82')]=_0x5d8df6[_0xe669('0x82')];_0x295d5d['message'][_0xe669('0x89')]=_0x5d8df6[_0xe669('0x82')];_0x295d5d[_0xe669('0x1d')][_0xe669('0x8a')]=_0xe669('0x86');_0x295d5d[_0xe669('0x1d')][_0xe669('0x4a')]=htmlToText[_0xe669('0x83')](_0x5d8df6[_0xe669('0x1d')][_0xe669('0x4a')]);respondWithRpcPromise(_0xe669('0x84'),_0xe669('0x84'),{'event':_0xe669('0x8b'),'message':_0x295d5d[_0xe669('0x1d')]},client9002);return _0x5d8df6;}return null;})[_0xe669('0x14')](respondWithResult(_0x428a4f,null))[_0xe669('0x1e')](handleError(_0x428a4f,null));};exports[_0xe669('0x8c')]=function(_0x5484e1,_0x493b20){var _0x374d13=moment()['unix']()[_0xe669('0x8d')]();var _0x3f0f42=path['join'](config[_0xe669('0x5b')],_0xe669('0x8e'),_0xe669('0x8f'),_0xe669('0x90'));var _0x124fcf=path[_0xe669('0x91')](config[_0xe669('0x5b')],_0xe669('0x8e'),'files','attachments');var _0x549805=util['format'](_0xe669('0x92'),_0x374d13);return db[_0xe669('0x43')][_0xe669('0x49')]({'where':{'id':_0x5484e1[_0xe669('0x47')]['id']},'attributes':['id',_0xe669('0x4a'),_0xe669('0x93'),'to','cc','bcc',_0xe669('0x94'),_0xe669('0x95')],'include':_0x5484e1[_0xe669('0x34')][_0xe669('0x5a')]?[{'model':db[_0xe669('0x96')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x493b20,null))[_0xe669('0x14')](function(_0x5661c4){if(_0x5661c4){var _0x2f5a61=_0x5661c4;var _0x504850={'from':_0x2f5a61[_0xe669('0x93')],'to':_0x2f5a61['to'],'subject':_0x2f5a61['subject'],'html':htmlEntities[_0xe669('0x97')](_0x2f5a61[_0xe669('0x4a')]),'headers':{'Date':moment(_0x2f5a61[_0xe669('0x95')])[_0xe669('0x68')](_0xe669('0x98'))},'attachments':[]};if(_0x5661c4['cc']){_0x504850[_0xe669('0x99')]['Cc']=_0x5661c4['cc'];}if(_0x5661c4[_0xe669('0x9a')]){_0x504850[_0xe669('0x99')]['Bcc']=_0x5661c4['bcc'];}return new BPromise(function(_0x7fb467,_0x41fdf5){if(_0x5661c4['Attachments']){for(var _0x2c7267=0x0;_0x2c7267<_0x5661c4[_0xe669('0x9b')]['length'];_0x2c7267++){var _0xcaca71=_0x5661c4[_0xe669('0x9b')][_0x2c7267];var _0x41e217=path[_0xe669('0x91')](_0x124fcf,_0xcaca71[_0xe669('0x5d')]);if(fs['existsSync'](_0x41e217)){_0x504850[_0xe669('0x5a')][_0xe669('0x9c')]({'name':_0xcaca71[_0xe669('0x2c')],'contentType':_0xcaca71[_0xe669('0x31')],'data':fs[_0xe669('0x9d')](_0x41e217)});}}}emlformat['build'](_0x504850,function(_0x2ef532,_0x536ac3){if(_0x2ef532)return _0x41fdf5(_0x2ef532);fs[_0xe669('0x9e')](path['join'](_0x3f0f42,_0x549805),_0x536ac3);return _0x7fb467(_0x536ac3);});});}})['then'](function(_0x276801){if(_0x276801){return _0x493b20[_0xe669('0x8c')](path['join'](_0x3f0f42,_0x549805),_0x549805,function(_0x57fa33){if(!_0x57fa33)fs['unlinkSync'](path[_0xe669('0x91')](_0x3f0f42,_0x549805));});}})[_0xe669('0x1e')](handleError(_0x493b20,null));}; \ No newline at end of file +var _0x3405=['accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','Sequelize','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','fullname','email','rejectmessage','unix','toString','join','server','files','message-%s.eml','bcc','subject','Attachment','Attachments','from','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../mysqldb','defaults','localhost','socket.io-emitter','redis','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','MailMessage,\x20%s,\x20%s','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','MailMessage','includeAll','include','findAll','rows','show','params','find','body','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','length','attachments','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4728f8,_0x5ed9e7){var _0x58951e=function(_0x50dab7){while(--_0x50dab7){_0x4728f8['push'](_0x4728f8['shift']());}};_0x58951e(++_0x5ed9e7);}(_0x3405,0x186));var _0x5340=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x3405[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0x5340('0x0'));var moment=require(_0x5340('0x1'));var BPromise=require(_0x5340('0x2'));var util=require(_0x5340('0x3'));var path=require(_0x5340('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x5340('0x5'));var htmlToText=require(_0x5340('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x5340('0x7'))(_0x5340('0x8'));var interaction_log=require(_0x5340('0x7'))(_0x5340('0x9'));var config=require('../../config/environment');var db=require(_0x5340('0xa'))['db'];config['redis']=_[_0x5340('0xb')](config['redis'],{'host':_0x5340('0xc'),'port':0x18eb});var socket=require(_0x5340('0xd'))(new Redis(config[_0x5340('0xe')]));var htmlEntities=require(_0x5340('0xf'));require(_0x5340('0x10'))['register'](socket);var jayson=require(_0x5340('0x11'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x5340('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x5340('0x12')][_0x5340('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x6852dc,_0x119697,_0x54bc04,_0xc876f){return new BPromise(function(_0x5a89f9,_0x11b8c1){var _0x355b3f=_0xc876f||client;return _0x355b3f[_0x5340('0x14')](_0x6852dc,_0x54bc04)[_0x5340('0x15')](function(_0x956482){logger[_0x5340('0x16')]('MailMessage,\x20%s,\x20%s',_0x119697,'request\x20sent');logger[_0x5340('0x17')](_0x5340('0x18'),_0x119697,_0x5340('0x19'),JSON[_0x5340('0x1a')](_0x956482));if(_0x956482['error']){if(_0x956482['error']['code']===0x1f4){logger[_0x5340('0x1b')]('MailMessage,\x20%s,\x20%s',_0x119697,_0x956482['error'][_0x5340('0x1c')]);return _0x11b8c1(_0x956482[_0x5340('0x1b')][_0x5340('0x1c')]);}logger[_0x5340('0x1b')](_0x5340('0x1d'),_0x119697,_0x956482[_0x5340('0x1b')]['message']);return _0x5a89f9(_0x956482[_0x5340('0x1b')][_0x5340('0x1c')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x119697,_0x5340('0x19'));_0x5a89f9(_0x956482[_0x5340('0x1e')]['message']);}})[_0x5340('0x1f')](function(_0x529084){logger[_0x5340('0x1b')](_0x5340('0x1d'),_0x119697,_0x529084);_0x11b8c1(_0x529084);});});}function respondWithResult(_0x2344cd,_0x1c8a96){_0x1c8a96=_0x1c8a96||0xc8;return function(_0x48a444){if(_0x48a444){return _0x2344cd['status'](_0x1c8a96)[_0x5340('0x20')](_0x48a444);}};}function respondWithFilteredResult(_0x1a752d,_0x386303){return function(_0x561f65){if(_0x561f65){var _0x3e110c=typeof _0x386303[_0x5340('0x21')]===_0x5340('0x22')&&typeof _0x386303[_0x5340('0x23')]===_0x5340('0x22');var _0x19550b=_0x561f65[_0x5340('0x24')];var _0xb51698=_0x3e110c?0x0:_0x386303[_0x5340('0x21')];var _0x5c20ed=_0x3e110c?_0x561f65[_0x5340('0x24')]:_0x386303[_0x5340('0x21')]+_0x386303[_0x5340('0x23')];var _0x2a931a;if(_0x5c20ed>=_0x19550b){_0x5c20ed=_0x19550b;_0x2a931a=0xc8;}else{_0x2a931a=0xce;}_0x1a752d[_0x5340('0x25')](_0x2a931a);return _0x1a752d[_0x5340('0x26')](_0x5340('0x27'),_0xb51698+'-'+_0x5c20ed+'/'+_0x19550b)[_0x5340('0x20')](_0x561f65);}return null;};}function saveUpdates(_0x511a55){return function(_0x2d848b){if(_0x2d848b){return _0x2d848b[_0x5340('0x28')](_0x511a55)[_0x5340('0x15')](function(_0x135b5e){return _0x135b5e;});}return null;};}function removeEntity(_0x3e9793){return function(_0xe95f45){if(_0xe95f45){return _0xe95f45['destroy']()[_0x5340('0x15')](function(){_0x3e9793[_0x5340('0x25')](0xcc)[_0x5340('0x29')]();});}};}function handleEntityNotFound(_0x5cf874){return function(_0x36f498){if(!_0x36f498){_0x5cf874[_0x5340('0x2a')](0x194);}return _0x36f498;};}function handleError(_0x53d4af,_0x39e368){_0x39e368=_0x39e368||0x1f4;return function(_0x24a424){logger['error'](_0x24a424[_0x5340('0x2b')]);if(_0x24a424[_0x5340('0x2c')]){delete _0x24a424['name'];}_0x53d4af[_0x5340('0x25')](_0x39e368)[_0x5340('0x2d')](_0x24a424);};}exports['index']=function(_0x280cd3,_0x1d9838){var _0x40ab3d={},_0x452ef9={},_0x752ee4={'count':0x0,'rows':[]};var _0x2f6ef1=_[_0x5340('0x2e')](db['MailMessage'][_0x5340('0x2f')],function(_0x208e52){return{'name':_0x208e52[_0x5340('0x30')],'type':_0x208e52[_0x5340('0x31')]['key']};});_0x452ef9[_0x5340('0x32')]=_[_0x5340('0x2e')](_0x2f6ef1,_0x5340('0x2c'));_0x452ef9['query']=_[_0x5340('0x33')](_0x280cd3[_0x5340('0x34')]);_0x452ef9[_0x5340('0x35')]=_[_0x5340('0x36')](_0x452ef9[_0x5340('0x32')],_0x452ef9[_0x5340('0x34')]);_0x40ab3d[_0x5340('0x37')]=_[_0x5340('0x36')](_0x452ef9[_0x5340('0x32')],qs['fields'](_0x280cd3[_0x5340('0x34')][_0x5340('0x38')]));_0x40ab3d[_0x5340('0x37')]=_0x40ab3d[_0x5340('0x37')]['length']?_0x40ab3d[_0x5340('0x37')]:_0x452ef9['model'];if(!_0x280cd3['query'][_0x5340('0x39')](_0x5340('0x3a'))){_0x40ab3d['limit']=qs[_0x5340('0x23')](_0x280cd3[_0x5340('0x34')][_0x5340('0x23')]);_0x40ab3d[_0x5340('0x21')]=qs[_0x5340('0x21')](_0x280cd3[_0x5340('0x34')][_0x5340('0x21')]);}_0x40ab3d[_0x5340('0x3b')]=qs['sort'](_0x280cd3['query']['sort']);_0x40ab3d[_0x5340('0x3c')]=qs[_0x5340('0x35')](_['pick'](_0x280cd3['query'],_0x452ef9[_0x5340('0x35')]),_0x2f6ef1);if(_0x280cd3[_0x5340('0x34')][_0x5340('0x3d')]){_0x40ab3d[_0x5340('0x3c')]=_[_0x5340('0x3e')](_0x40ab3d[_0x5340('0x3c')],{'$or':_['map'](_0x2f6ef1,function(_0x43a67b){if(_0x43a67b[_0x5340('0x31')]!==_0x5340('0x3f')){var _0x39a223={};_0x39a223[_0x43a67b[_0x5340('0x2c')]]={'$like':'%'+_0x280cd3['query']['filter']+'%'};return _0x39a223;}})});}_0x40ab3d=_[_0x5340('0x3e')]({},_0x40ab3d,_0x280cd3[_0x5340('0x40')]);var _0x132011={'where':_0x40ab3d[_0x5340('0x3c')]};return db[_0x5340('0x41')][_0x5340('0x24')](_0x132011)['then'](function(_0x2ea7de){_0x752ee4[_0x5340('0x24')]=_0x2ea7de;if(_0x280cd3[_0x5340('0x34')][_0x5340('0x42')]){_0x40ab3d[_0x5340('0x43')]=[{'all':!![]}];}return db[_0x5340('0x41')][_0x5340('0x44')](_0x40ab3d);})[_0x5340('0x15')](function(_0x987455){_0x752ee4[_0x5340('0x45')]=_0x987455;return _0x752ee4;})[_0x5340('0x15')](respondWithFilteredResult(_0x1d9838,_0x40ab3d))[_0x5340('0x1f')](handleError(_0x1d9838,null));};exports[_0x5340('0x46')]=function(_0x5356ce,_0x52e534){var _0x216d8f={'raw':!![],'where':{'id':_0x5356ce[_0x5340('0x47')]['id']}},_0x42ba61={};_0x42ba61['model']=_[_0x5340('0x33')](db[_0x5340('0x41')]['rawAttributes']);_0x42ba61['query']=_[_0x5340('0x33')](_0x5356ce[_0x5340('0x34')]);_0x42ba61[_0x5340('0x35')]=_['intersection'](_0x42ba61[_0x5340('0x32')],_0x42ba61[_0x5340('0x34')]);_0x216d8f[_0x5340('0x37')]=_[_0x5340('0x36')](_0x42ba61['model'],qs[_0x5340('0x38')](_0x5356ce['query'][_0x5340('0x38')]));_0x216d8f['attributes']=_0x216d8f[_0x5340('0x37')]['length']?_0x216d8f[_0x5340('0x37')]:_0x42ba61[_0x5340('0x32')];if(_0x5356ce[_0x5340('0x34')][_0x5340('0x42')]){_0x216d8f[_0x5340('0x43')]=[{'all':!![]}];}_0x216d8f=_['merge']({},_0x216d8f,_0x5356ce['options']);return db[_0x5340('0x41')][_0x5340('0x48')](_0x216d8f)[_0x5340('0x15')](handleEntityNotFound(_0x52e534,null))['then'](respondWithResult(_0x52e534,null))[_0x5340('0x1f')](handleError(_0x52e534,null));};exports['update']=function(_0x2b79fe,_0x515085){if(_0x2b79fe[_0x5340('0x49')]['id']){delete _0x2b79fe[_0x5340('0x49')]['id'];}return db[_0x5340('0x41')]['find']({'where':{'id':_0x2b79fe[_0x5340('0x47')]['id']}})[_0x5340('0x15')](handleEntityNotFound(_0x515085,null))[_0x5340('0x15')](saveUpdates(_0x2b79fe[_0x5340('0x49')],null))[_0x5340('0x15')](respondWithResult(_0x515085,null))['catch'](handleError(_0x515085,null));};exports['destroy']=function(_0x542721,_0x502026){return db[_0x5340('0x41')][_0x5340('0x48')]({'where':{'id':_0x542721['params']['id']}})[_0x5340('0x15')](handleEntityNotFound(_0x502026,null))[_0x5340('0x15')](removeEntity(_0x502026,null))['catch'](handleError(_0x502026,null));};exports['describe']=function(_0x30226d,_0x2dd598){return db[_0x5340('0x41')][_0x5340('0x4a')]()[_0x5340('0x15')](respondWithResult(_0x2dd598,null))['catch'](handleError(_0x2dd598,null));};exports[_0x5340('0x4b')]=function(_0x49444c,_0x535c26){return db[_0x5340('0x41')][_0x5340('0x4b')](_0x49444c['body'])[_0x5340('0x15')](function(_0x3c6b11){if(_0x3c6b11){if(_0x3c6b11['direction']===_0x5340('0x4c')&&!_0x3c6b11[_0x5340('0x4d')]){var _0x29684a,_0x5b5993,_0x5b9022;if(_0x49444c[_0x5340('0x49')]['to']){_0x5b5993=_0x49444c[_0x5340('0x49')]['to'][_0x5340('0x4e')](',')[0x0];}return db[_0x5340('0x4f')][_0x5340('0x50')]({'where':{'id':_0x3c6b11[_0x5340('0x51')]},'include':[{'model':db[_0x5340('0x52')],'as':_0x5340('0x53'),'include':[{'model':db[_0x5340('0x54')],'as':'Contacts','where':{'email':_0x5b5993},'limit':0x1,'order':[[_0x5340('0x55'),'DESC']]}]},{'model':db[_0x5340('0x56')],'as':_0x5340('0x57'),'raw':!![],'include':[{'model':db[_0x5340('0x58')],'as':_0x5340('0x58'),'raw':!![]}]}]})[_0x5340('0x15')](function(_0x24b88f){_0x29684a=_0x24b88f;if(!_0x29684a||!_0x29684a[_0x5340('0x57')])return;var _0x37c36f=_0x29684a[_0x5340('0x59')]();if(_0x49444c['body']['attachments']&&_0x49444c[_0x5340('0x49')]['attachments'][_0x5340('0x5a')]){for(var _0x1ab05e=0x0;_0x1ab05e<_0x49444c[_0x5340('0x49')]['attachments'][_0x5340('0x5a')];_0x1ab05e+=0x1){_0x49444c[_0x5340('0x49')][_0x5340('0x5b')][_0x1ab05e]={'filename':_0x49444c[_0x5340('0x49')]['attachments'][_0x1ab05e][_0x5340('0x2c')],'path':path['join'](config[_0x5340('0x5c')],_0x5340('0x5d'),_0x49444c[_0x5340('0x49')]['attachments'][_0x1ab05e][_0x5340('0x5e')])};}}_0x5b9022={'account':_0x37c36f,'message':_0x49444c[_0x5340('0x49')]};return;})[_0x5340('0x15')](function(){if(_0x29684a[_0x5340('0x53')]){if(_0x29684a[_0x5340('0x53')][_0x5340('0x5f')][_0x5340('0x5a')]){return _0x29684a[_0x5340('0x53')]['Contacts'][0x0];}else{return db[_0x5340('0x54')]['create'](_[_0x5340('0xb')](_0x49444c['body'],{'firstName':_0x49444c[_0x5340('0x49')]['to'],'email':_0x49444c[_0x5340('0x49')]['to'],'phone':_0x49444c[_0x5340('0x49')]['to'],'ListId':_0x29684a[_0x5340('0x60')]}));}}else{throw new Error(_0x5340('0x61'));}})[_0x5340('0x15')](function(){if(_0x5b9022){return respondWithRpcPromise(_0x5340('0x62'),'sendMail',_0x5b9022,client9003)['then'](function(_0x1db355){return _0x3c6b11[_0x5340('0x28')]({'read':!![],'messageId':_0x1db355[_0x5340('0x63')],'sentAt':moment()[_0x5340('0x64')](_0x5340('0x65'))});})[_0x5340('0x1f')](function(_0x5ec013){logger[_0x5340('0x1b')]('%s',JSON[_0x5340('0x1a')](_0x5ec013));return _0x3c6b11;});}return _0x3c6b11;});}return _0x3c6b11;}})[_0x5340('0x15')](respondWithResult(_0x535c26,0xc9))['catch'](handleError(_0x535c26,null));};exports[_0x5340('0x66')]=function(_0x58e667,_0xf59831){var _0x246162={'agent':{},'channel':_0x5340('0x67')};if(_0x58e667[_0x5340('0x49')]['id']){delete _0x58e667['body']['id'];}_0x58e667[_0x5340('0x49')][_0x5340('0x68')]=!![];_0x58e667['body'][_0x5340('0x69')]=moment()[_0x5340('0x64')](_0x5340('0x65'));_0x58e667[_0x5340('0x49')]['UserId']=_0x58e667[_0x5340('0x49')][_0x5340('0x6a')]||_0x58e667['user']['id'];_0x246162[_0x5340('0x6b')]['id']=_0x58e667[_0x5340('0x49')][_0x5340('0x6a')];return db[_0x5340('0x41')][_0x5340('0x48')]({'where':{'id':_0x58e667[_0x5340('0x47')]['id'],'UserId':null}})[_0x5340('0x15')](handleEntityNotFound(_0xf59831,null))['then'](saveUpdates(_0x58e667[_0x5340('0x49')],null))[_0x5340('0x15')](function(_0x2783fd){if(_0x2783fd){_0x246162[_0x5340('0x1c')]=_0x2783fd[_0x5340('0x6c')]({'plain':!![]});return db[_0x5340('0x6d')][_0x5340('0x48')]({'where':{'id':_0x2783fd[_0x5340('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0xf59831,null))[_0x5340('0x15')](function(_0x3affec){if(_0x3affec){return _0x3affec[_0x5340('0x28')]({'UserId':_0x58e667[_0x5340('0x49')][_0x5340('0x6a')],'read1stAt':_[_0x5340('0x6f')](_0x3affec[_0x5340('0x70')])?moment()[_0x5340('0x64')](_0x5340('0x65')):undefined});}return null;})[_0x5340('0x15')](function(_0xf0583b){if(_0xf0583b){_0x246162[_0x5340('0x71')]=_0xf0583b[_0x5340('0x6c')]({'plain':!![]});interaction_log[_0x5340('0x16')](_0x5340('0x72'),_0x58e667['user']['id'],_0x58e667[_0x5340('0x73')][_0x5340('0x2c')],_0x58e667['user'][_0x5340('0x74')],_0x246162[_0x5340('0x71')]['id'],_0x58e667['body']?JSON['stringify'](_0x58e667[_0x5340('0x49')]):_0x5340('0x75'));return respondWithRpcPromise(_0x5340('0x76'),_0x5340('0x77'),_0x246162);}return null;})[_0x5340('0x15')](function(_0x171401){var _0x444d6c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x171401[_0x5340('0x1c')]['ContactId'];return db['sequelize'][_0x5340('0x34')](_0x444d6c,{'type':db[_0x5340('0x78')]['QueryTypes'][_0x5340('0x79')],'raw':!![]})[_0x5340('0x15')](function(_0x214725){return _0x214725;});})[_0x5340('0x15')](function(_0x477edb){if(_0x477edb){_0x246162[_0x5340('0x1c')][_0x5340('0x7a')]=_0x477edb[0x0];if(!_0x58e667['body']['UserId'])return;return db[_0x5340('0x7b')][_0x5340('0x48')]({'where':{'id':_0x58e667['body'][_0x5340('0x6a')],'role':_0x5340('0x6b')},'attributes':['id',_0x5340('0x2c'),'fullname','email',_0x5340('0x7c')],'raw':!![]});}return null;})[_0x5340('0x15')](function(_0x54bb9a){if(!_0x54bb9a)return null;_0x246162['message'][_0x5340('0x6b')]=_0x54bb9a;return _0x246162;})[_0x5340('0x15')](function(_0x48939c){if(_0x48939c){if(_0x58e667[_0x5340('0x49')][_0x5340('0x7d')]){_0x246162['message'][_0x5340('0x7e')]=util[_0x5340('0x64')](_0x5340('0x7f'),_0x58e667[_0x5340('0x73')][_0x5340('0x2c')]);_0x246162[_0x5340('0x1c')]['channel']=_0x246162[_0x5340('0x80')];_0x246162['message'][_0x5340('0x81')]=_0x246162[_0x5340('0x80')];_0x246162['message'][_0x5340('0x82')]='accept';_0x246162[_0x5340('0x1c')][_0x5340('0x49')]=htmlToText[_0x5340('0x83')](_0x246162[_0x5340('0x1c')]['body']);return respondWithRpcPromise(_0x5340('0x84'),_0x5340('0x84'),{'event':_0x5340('0x85'),'message':_0x246162[_0x5340('0x1c')]},client9002)[_0x5340('0x15')](function(){return _0x246162;});}return _0x246162;}return null;})[_0x5340('0x15')](respondWithResult(_0xf59831,null))[_0x5340('0x1f')](handleError(_0xf59831,null));};exports[_0x5340('0x86')]=function(_0x1256b6,_0x2bffb3){var _0x4362af={'agent':{},'channel':_0x5340('0x67')};if(_0x1256b6[_0x5340('0x49')]['id']){delete _0x1256b6[_0x5340('0x49')]['id'];}_0x1256b6[_0x5340('0x49')]['UserId']=_0x1256b6[_0x5340('0x49')]['UserId']||_0x1256b6[_0x5340('0x73')]['id'];_0x4362af[_0x5340('0x6b')]['id']=_0x1256b6[_0x5340('0x49')]['UserId'];return db[_0x5340('0x41')][_0x5340('0x48')]({'where':{'id':_0x1256b6[_0x5340('0x47')]['id'],'UserId':null}})[_0x5340('0x15')](handleEntityNotFound(_0x2bffb3,null))[_0x5340('0x15')](function(_0x1d47e6){if(_0x1d47e6){_0x4362af[_0x5340('0x1c')]=_0x1d47e6['get']({'plain':!![]});return db[_0x5340('0x6d')][_0x5340('0x48')]({'where':{'id':_0x1d47e6[_0x5340('0x6e')]}});}return null;})[_0x5340('0x15')](handleEntityNotFound(_0x2bffb3,null))[_0x5340('0x15')](function(_0x3e8572){if(_0x3e8572){_0x4362af[_0x5340('0x71')]=_0x3e8572[_0x5340('0x6c')]({'plain':!![]});interaction_log[_0x5340('0x16')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1256b6[_0x5340('0x73')]['id'],_0x1256b6[_0x5340('0x73')][_0x5340('0x2c')],_0x1256b6[_0x5340('0x73')][_0x5340('0x74')],_0x4362af[_0x5340('0x71')]['id'],_0x1256b6[_0x5340('0x49')]?JSON[_0x5340('0x1a')](_0x1256b6['body']):_0x5340('0x75'));return respondWithRpcPromise(_0x5340('0x87'),_0x5340('0x88'),_0x4362af);}return null;})[_0x5340('0x15')](function(_0x5b2f7a){var _0x19e54e=_0x5340('0x89')+_0x5b2f7a[_0x5340('0x1c')][_0x5340('0x8a')];return db[_0x5340('0x8b')][_0x5340('0x34')](_0x19e54e,{'type':db['Sequelize'][_0x5340('0x8c')][_0x5340('0x79')],'raw':!![]})['then'](function(_0x40b591){return _0x40b591;});})[_0x5340('0x15')](function(_0x3610ee){if(_0x3610ee){_0x4362af['message'][_0x5340('0x7a')]=_0x3610ee[0x0];if(!_0x1256b6[_0x5340('0x49')][_0x5340('0x6a')])return;return db['User'][_0x5340('0x48')]({'where':{'id':_0x1256b6['body'][_0x5340('0x6a')],'role':_0x5340('0x6b')},'attributes':['id',_0x5340('0x2c'),_0x5340('0x8d'),_0x5340('0x8e'),_0x5340('0x7c')],'raw':!![]});}return null;})[_0x5340('0x15')](function(_0x2fd674){if(!_0x2fd674)return null;_0x4362af[_0x5340('0x1c')][_0x5340('0x6b')]=_0x2fd674;return _0x4362af;})[_0x5340('0x15')](function(_0x28a1ce){if(_0x28a1ce){_0x28a1ce[_0x5340('0x1c')][_0x5340('0x7e')]=util['format'](_0x5340('0x7f'),_0x1256b6[_0x5340('0x73')][_0x5340('0x2c')]);_0x28a1ce[_0x5340('0x1c')][_0x5340('0x80')]=_0x4362af['channel'];_0x28a1ce[_0x5340('0x1c')][_0x5340('0x81')]=_0x4362af[_0x5340('0x80')];_0x28a1ce[_0x5340('0x1c')]['event']=_0x5340('0x86');_0x28a1ce['message']['body']=htmlToText['fromString'](_0x4362af[_0x5340('0x1c')][_0x5340('0x49')]);respondWithRpcPromise(_0x5340('0x84'),_0x5340('0x84'),{'event':_0x5340('0x8f'),'message':_0x28a1ce[_0x5340('0x1c')]},client9002);return _0x4362af;}return null;})[_0x5340('0x15')](respondWithResult(_0x2bffb3,null))['catch'](handleError(_0x2bffb3,null));};exports['download']=function(_0x152693,_0x579b9c){var _0x43cf08=moment()[_0x5340('0x90')]()[_0x5340('0x91')]();var _0x3a07f9=path[_0x5340('0x92')](config[_0x5340('0x5c')],_0x5340('0x93'),_0x5340('0x94'),'tmp');var _0x5c2a64=path[_0x5340('0x92')](config[_0x5340('0x5c')],'server',_0x5340('0x94'),_0x5340('0x5b'));var _0x37eabb=util['format'](_0x5340('0x95'),_0x43cf08);return db[_0x5340('0x41')][_0x5340('0x48')]({'where':{'id':_0x152693[_0x5340('0x47')]['id']},'attributes':['id',_0x5340('0x49'),'from','to','cc',_0x5340('0x96'),_0x5340('0x97'),'createdAt'],'include':_0x152693[_0x5340('0x34')][_0x5340('0x5b')]?[{'model':db[_0x5340('0x98')],'as':_0x5340('0x99')}]:undefined})[_0x5340('0x15')](handleEntityNotFound(_0x579b9c,null))[_0x5340('0x15')](function(_0x26142e){if(_0x26142e){var _0x37d7ac=_0x26142e;var _0x305de0={'from':_0x37d7ac[_0x5340('0x9a')],'to':_0x37d7ac['to'],'subject':_0x37d7ac['subject'],'html':htmlEntities['decode'](_0x37d7ac['body']),'headers':{'Date':moment(_0x37d7ac[_0x5340('0x9b')])[_0x5340('0x64')](_0x5340('0x9c'))},'attachments':[]};if(_0x26142e['cc']){_0x305de0[_0x5340('0x9d')]['Cc']=_0x26142e['cc'];}if(_0x26142e[_0x5340('0x96')]){_0x305de0[_0x5340('0x9d')][_0x5340('0x9e')]=_0x26142e[_0x5340('0x96')];}return new BPromise(function(_0x496cfb,_0x3146f8){if(_0x26142e[_0x5340('0x99')]){for(var _0x2bc34d=0x0;_0x2bc34d<_0x26142e[_0x5340('0x99')][_0x5340('0x5a')];_0x2bc34d++){var _0x4d95b3=_0x26142e['Attachments'][_0x2bc34d];var _0x1448da=path[_0x5340('0x92')](_0x5c2a64,_0x4d95b3[_0x5340('0x5e')]);if(fs[_0x5340('0x9f')](_0x1448da)){_0x305de0[_0x5340('0x5b')]['push']({'name':_0x4d95b3['name'],'contentType':_0x4d95b3[_0x5340('0x31')],'data':fs[_0x5340('0xa0')](_0x1448da)});}}}emlformat[_0x5340('0xa1')](_0x305de0,function(_0x1da1b4,_0x33c8e8){if(_0x1da1b4)return _0x3146f8(_0x1da1b4);fs[_0x5340('0xa2')](path[_0x5340('0x92')](_0x3a07f9,_0x37eabb),_0x33c8e8);return _0x496cfb(_0x33c8e8);});});}})[_0x5340('0x15')](function(_0x212b32){if(_0x212b32){return _0x579b9c['download'](path[_0x5340('0x92')](_0x3a07f9,_0x37eabb),_0x37eabb,function(_0x4e6c7a){if(!_0x4e6c7a)fs[_0x5340('0xa3')](path[_0x5340('0x92')](_0x3a07f9,_0x37eabb));});}})[_0x5340('0x1f')](handleError(_0x579b9c,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e27cc61..d0efb90 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 _0x7aa0=['MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3592fd,_0x4b490e){var _0x381ae3=function(_0x6cd8ff){while(--_0x6cd8ff){_0x3592fd['push'](_0x3592fd['shift']());}};_0x381ae3(++_0x4b490e);}(_0x7aa0,0xc6));var _0x07aa=function(_0x5a7489,_0x3be9f2){_0x5a7489=_0x5a7489-0x0;var _0x5b1ff3=_0x7aa0[_0x5a7489];return _0x5b1ff3;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x07aa('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x07aa('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x07aa('0x2'),'afterDestroy':_0x07aa('0x3')};function emitEvent(_0x46e9b5){return function(_0x3bd425,_0x4cee32,_0x19e164){MailMessageEvents[_0x07aa('0x4')](_0x46e9b5+':'+_0x3bd425['id'],_0x3bd425);MailMessageEvents['emit'](_0x46e9b5,_0x3bd425);_0x19e164(null);};}for(var e in events){if(events[_0x07aa('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xfeb7=['remove','emit','hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners','save'];(function(_0xa8369a,_0x3d2319){var _0x4b74b7=function(_0x11d138){while(--_0x11d138){_0xa8369a['push'](_0xa8369a['shift']());}};_0x4b74b7(++_0x3d2319);}(_0xfeb7,0x7a));var _0x7feb=function(_0x4700d0,_0x450e5d){_0x4700d0=_0x4700d0-0x0;var _0x191726=_0xfeb7[_0x4700d0];return _0x191726;};'use strict';var EventEmitter=require(_0x7feb('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x7feb('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x7feb('0x2')](0x0);var events={'afterCreate':_0x7feb('0x3'),'afterUpdate':'update','afterDestroy':_0x7feb('0x4')};function emitEvent(_0x9ea219){return function(_0x5626a4,_0x1dc751,_0x36e9bb){MailMessageEvents[_0x7feb('0x5')](_0x9ea219+':'+_0x5626a4['id'],_0x5626a4);MailMessageEvents[_0x7feb('0x5')](_0x9ea219,_0x5626a4);_0x36e9bb(null);};}for(var e in events){if(events[_0x7feb('0x6')](e)){var event=events[e];MailMessage[_0x7feb('0x7')](e,emitEvent(event));}}module[_0x7feb('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 cff84f7..60731a9 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 _0xf808=['../../config/environment','exports','mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','catch','api','moment','bluebird','html-to-text'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf808,0x86));var _0x8f80=function(_0x45929d,_0x22f588){_0x45929d=_0x45929d-0x0;var _0x57651c=_0xf808[_0x45929d];return _0x57651c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8f80('0x0'));var moment=require(_0x8f80('0x1'));var BPromise=require(_0x8f80('0x2'));var rp=require('request-promise');var htmlToText=require(_0x8f80('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8f80('0x4'));var attributes=require('./mailMessage.attributes');module[_0x8f80('0x5')]=function(_0x5baec0,_0x30385b){return _0x5baec0['define']('MailMessage',attributes,{'tableName':_0x8f80('0x6'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x8f80('0x7'),_0x8f80('0x8')],'type':_0x8f80('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4eb600,_0x58c4ee,_0x32e4){if(_0x4eb600[_0x8f80('0xa')]){_0x4eb600['plainBody']=htmlToText[_0x8f80('0xb')](_0x4eb600[_0x8f80('0xa')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x32e4(null,_0x58c4ee);},'afterCreate':function(_0x195113,_0x306915,_0x57544f){var _0x21449b=_0x5baec0['models'];var _0x2b1916=_0x195113[_0x8f80('0xc')]({'plain':!![]});if(_0x2b1916[_0x8f80('0xd')]['toLowerCase']()==='in'||_0x2b1916['direction'][_0x8f80('0xe')]()==='out'&&!_0x2b1916[_0x8f80('0xf')]&&!_[_0x8f80('0x10')](_0x2b1916[_0x8f80('0x11')])){_0x21449b[_0x8f80('0x12')][_0x8f80('0x13')]({'where':{'id':_0x2b1916[_0x8f80('0x14')]}})[_0x8f80('0x15')](function(_0x4c20ff){if(_0x4c20ff){_0x4c20ff['update']({'lastMsgAt':_0x2b1916['createdAt'],'lastMsgDirection':_0x2b1916[_0x8f80('0xd')][_0x8f80('0xe')]()});}})[_0x8f80('0x16')](function(_0x2e37b0){console['error'](_0x2e37b0);});}_0x57544f();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd226=['rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','html-to-text','path'];(function(_0x371088,_0x32abf1){var _0xa60179=function(_0x1e4bf6){while(--_0x1e4bf6){_0x371088['push'](_0x371088['shift']());}};_0xa60179(++_0x32abf1);}(_0xd226,0x82));var _0x6d22=function(_0x3c2166,_0x41fc16){_0x3c2166=_0x3c2166-0x0;var _0x30ccc3=_0xd226[_0x3c2166];return _0x30ccc3;};'use strict';var _=require(_0x6d22('0x0'));var util=require('util');var logger=require(_0x6d22('0x1'))(_0x6d22('0x2'));var moment=require('moment');var BPromise=require(_0x6d22('0x3'));var rp=require('request-promise');var htmlToText=require(_0x6d22('0x4'));var fs=require('fs');var path=require(_0x6d22('0x5'));var rimraf=require(_0x6d22('0x6'));var config=require(_0x6d22('0x7'));var attributes=require(_0x6d22('0x8'));module[_0x6d22('0x9')]=function(_0x3caf26,_0x188390){return _0x3caf26[_0x6d22('0xa')]('MailMessage',attributes,{'tableName':_0x6d22('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6d22('0xc')]},{'name':_0x6d22('0xd'),'fields':[_0x6d22('0xe'),_0x6d22('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x231efc,_0x37618e,_0x4df600){if(_0x231efc[_0x6d22('0x10')]){_0x231efc[_0x6d22('0xe')]=htmlToText[_0x6d22('0x11')](_0x231efc['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4df600(null,_0x37618e);},'afterCreate':function(_0x8d081c,_0x330b74,_0x4e6c41){var _0x3eef5b=_0x3caf26[_0x6d22('0x12')];var _0x23a119=_0x8d081c['get']({'plain':!![]});if(_0x23a119[_0x6d22('0x13')]['toLowerCase']()==='in'||_0x23a119[_0x6d22('0x13')][_0x6d22('0x14')]()===_0x6d22('0x15')&&!_0x23a119[_0x6d22('0x16')]&&!_[_0x6d22('0x17')](_0x23a119[_0x6d22('0x18')])){_0x3eef5b[_0x6d22('0x19')][_0x6d22('0x1a')]({'where':{'id':_0x23a119[_0x6d22('0x1b')]}})[_0x6d22('0x1c')](function(_0x1354d2){if(_0x1354d2){_0x1354d2[_0x6d22('0x1d')]({'lastMsgAt':_0x23a119['createdAt'],'lastMsgDirection':_0x23a119[_0x6d22('0x13')][_0x6d22('0x14')]()});}})[_0x6d22('0x1e')](function(_0x5c4058){console[_0x6d22('0x1f')](_0x5c4058);});}_0x4e6c41();}},'charset':_0x6d22('0x20'),'collate':_0x6d22('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 12c95b7..25375d1 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 _0x1893=['result','MailMessage','body','options','CreateMailMessage','debug','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2ad139,_0x1561ae){var _0x283823=function(_0x373f68){while(--_0x373f68){_0x2ad139['push'](_0x2ad139['shift']());}};_0x283823(++_0x1561ae);}(_0x1893,0xa2));var _0x3189=function(_0x14477e,_0x44d4da){_0x14477e=_0x14477e-0x0;var _0x5d4a05=_0x1893[_0x14477e];return _0x5d4a05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});config[_0x3189('0xb')]=_[_0x3189('0xc')](config[_0x3189('0xb')],{'host':_0x3189('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3189('0xb')]));require('./mailMessage.socket')[_0x3189('0xe')](socket);function respondWithRpcPromise(_0x4ac683,_0x3ec9d0,_0x33cdfb){return new BPromise(function(_0xca480c,_0x176799){return client['request'](_0x4ac683,_0x33cdfb)[_0x3189('0xf')](function(_0x149428){logger[_0x3189('0x10')](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));logger['debug'](_0x3189('0x13'),_0x3ec9d0,_0x3189('0x12'),JSON[_0x3189('0x14')](_0x149428));if(_0x149428[_0x3189('0x15')]){if(_0x149428[_0x3189('0x15')][_0x3189('0x16')]===0x1f4){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0x149428['error'][_0x3189('0x17')]);return _0x176799(_0x149428[_0x3189('0x15')][_0x3189('0x17')]);}logger[_0x3189('0x15')]('MailMessage,\x20%s,\x20%s',_0x3ec9d0,_0x149428[_0x3189('0x15')]['message']);return _0xca480c(_0x149428['error'][_0x3189('0x17')]);}else{logger['info'](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));_0xca480c(_0x149428[_0x3189('0x18')][_0x3189('0x17')]);}})['catch'](function(_0xd3d5a){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0xd3d5a);_0x176799(_0xd3d5a);});});}exports['CreateMailMessage']=function(_0x561265){var _0xb0e89b=this;return new Promise(function(_0x306ed3,_0x2c1e59){return db[_0x3189('0x19')]['create'](_0x561265[_0x3189('0x1a')],{'raw':_0x561265[_0x3189('0x1b')]?_0x561265[_0x3189('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3189('0xf')](function(_0x47abb4){logger[_0x3189('0x10')](_0x3189('0x1c'),_0x561265);logger[_0x3189('0x1d')](_0x3189('0x1c'),_0x561265,JSON[_0x3189('0x14')](_0x47abb4));_0x306ed3(_0x47abb4);})[_0x3189('0x1e')](function(_0x5a08dc){logger['error'](_0x3189('0x1c'),_0x5a08dc[_0x3189('0x17')],_0x561265);_0x2c1e59(_0xb0e89b[_0x3189('0x15')](0x1f4,_0x5a08dc[_0x3189('0x17')]));});});}; \ No newline at end of file +var _0x430c=['ioredis','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','MailMessage','body','raw','CreateMailMessage','lodash','bluebird','randomstring'];(function(_0x3bc0e6,_0x333599){var _0x4cf415=function(_0x2a78f7){while(--_0x2a78f7){_0x3bc0e6['push'](_0x3bc0e6['shift']());}};_0x4cf415(++_0x333599);}(_0x430c,0x1a1));var _0xc430=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0x430c[_0x2e3107];return _0x833d69;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});config['redis']=_[_0xc430('0x7')](config[_0xc430('0x8')],{'host':_0xc430('0x9'),'port':0x18eb});var socket=require(_0xc430('0xa'))(new Redis(config[_0xc430('0x8')]));require(_0xc430('0xb'))[_0xc430('0xc')](socket);function respondWithRpcPromise(_0x115814,_0x24737a,_0x5bbdf9){return new BPromise(function(_0x97fa5b,_0x2b47d6){return client['request'](_0x115814,_0x5bbdf9)[_0xc430('0xd')](function(_0x5aeed9){logger[_0xc430('0xe')]('MailMessage,\x20%s,\x20%s',_0x24737a,_0xc430('0xf'));logger[_0xc430('0x10')](_0xc430('0x11'),_0x24737a,_0xc430('0xf'),JSON[_0xc430('0x12')](_0x5aeed9));if(_0x5aeed9[_0xc430('0x13')]){if(_0x5aeed9[_0xc430('0x13')]['code']===0x1f4){logger['error'](_0xc430('0x14'),_0x24737a,_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);return _0x2b47d6(_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);}logger['error'](_0xc430('0x14'),_0x24737a,_0x5aeed9['error']['message']);return _0x97fa5b(_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);}else{logger[_0xc430('0xe')]('MailMessage,\x20%s,\x20%s',_0x24737a,'request\x20sent');_0x97fa5b(_0x5aeed9[_0xc430('0x16')]['message']);}})[_0xc430('0x17')](function(_0x4f7094){logger['error'](_0xc430('0x14'),_0x24737a,_0x4f7094);_0x2b47d6(_0x4f7094);});});}exports['CreateMailMessage']=function(_0x302926){var _0x1eae3b=this;return new Promise(function(_0x3eb888,_0x1f90bb){return db[_0xc430('0x18')]['create'](_0x302926[_0xc430('0x19')],{'raw':_0x302926['options']?_0x302926['options'][_0xc430('0x1a')]===undefined?!![]:![]:!![]})[_0xc430('0xd')](function(_0x3c7afa){logger['info'](_0xc430('0x1b'),_0x302926);logger['debug'](_0xc430('0x1b'),_0x302926,JSON[_0xc430('0x12')](_0x3c7afa));_0x3eb888(_0x3c7afa);})['catch'](function(_0x31b4f1){logger[_0xc430('0x13')]('CreateMailMessage',_0x31b4f1[_0xc430('0x15')],_0x302926);_0x1f90bb(_0x1eae3b['error'](0x1f4,_0x31b4f1[_0xc430('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 5fd89b7..dd5b52e 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 _0x8e63=['save','removeListener','register','length'];(function(_0x4e23c3,_0xe2a070){var _0x4466fa=function(_0xdee7ee){while(--_0xdee7ee){_0x4e23c3['push'](_0x4e23c3['shift']());}};_0x4466fa(++_0xe2a070);}(_0x8e63,0x7c));var _0x38e6=function(_0x17a973,_0x385d62){_0x17a973=_0x17a973-0x0;var _0x3129e8=_0x8e63[_0x17a973];return _0x3129e8;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x38e6('0x0'),'remove','update'];function createListener(_0x3a381c,_0xb2c68b){return function(_0x1c6de7){_0xb2c68b['emit'](_0x3a381c,_0x1c6de7);};}function removeListener(_0x4c85e7,_0xe108a4){return function(){MailMessageEvents[_0x38e6('0x1')](_0x4c85e7,_0xe108a4);};}exports[_0x38e6('0x2')]=function(_0x5af45e){for(var _0x3048c0=0x0,_0x19e7be=events[_0x38e6('0x3')];_0x3048c0<_0x19e7be;_0x3048c0++){var _0x315953=events[_0x3048c0];var _0x51b586=createListener('mailMessage:'+_0x315953,_0x5af45e);MailMessageEvents['on'](_0x315953,_0x51b586);}}; \ No newline at end of file +var _0x65b9=['removeListener','register','length','mailMessage:','./mailMessage.events','update','emit'];(function(_0x417a6c,_0xc5e136){var _0x2fa9c2=function(_0xb017d1){while(--_0xb017d1){_0x417a6c['push'](_0x417a6c['shift']());}};_0x2fa9c2(++_0xc5e136);}(_0x65b9,0x154));var _0x965b=function(_0x19974b,_0x93fd57){_0x19974b=_0x19974b-0x0;var _0x15f655=_0x65b9[_0x19974b];return _0x15f655;};'use strict';var MailMessageEvents=require(_0x965b('0x0'));var events=['save','remove',_0x965b('0x1')];function createListener(_0x5152c6,_0x389e30){return function(_0x36a2c2){_0x389e30[_0x965b('0x2')](_0x5152c6,_0x36a2c2);};}function removeListener(_0x49d931,_0x4f6a13){return function(){MailMessageEvents[_0x965b('0x3')](_0x49d931,_0x4f6a13);};}exports[_0x965b('0x4')]=function(_0x556e5f){for(var _0x5015a3=0x0,_0x30ea04=events[_0x965b('0x5')];_0x5015a3<_0x30ea04;_0x5015a3++){var _0x465024=events[_0x5015a3];var _0x254490=createListener(_0x965b('0x6')+_0x465024,_0x556e5f);MailMessageEvents['on'](_0x465024,_0x254490);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b8f7d1e..39def96 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 _0x39c5=['../../components/interaction/service','./mailQueue.controller','index','get','/describe','/:id','show','getMembers','isAuthenticated','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x642b84,_0x461a5c){var _0x906e25=function(_0x2a57e0){while(--_0x2a57e0){_0x642b84['push'](_0x642b84['shift']());}};_0x906e25(++_0x461a5c);}(_0x39c5,0x87));var _0x539c=function(_0xa41df9,_0x20fed0){_0xa41df9=_0xa41df9-0x0;var _0x342a45=_0x39c5[_0xa41df9];return _0x342a45;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x539c('0x0'));var timeout=require(_0x539c('0x1'));var express=require(_0x539c('0x2'));var router=express[_0x539c('0x3')]();var fs_extra=require(_0x539c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x539c('0x5'));var config=require('../../config/environment');var controller=require(_0x539c('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x539c('0x7')]);router[_0x539c('0x8')](_0x539c('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x539c('0xa'),auth['isAuthenticated'](),controller[_0x539c('0xb')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x539c('0xc')]);router[_0x539c('0x8')]('/:id/teams',auth[_0x539c('0xd')](),controller[_0x539c('0xe')]);router[_0x539c('0x8')](_0x539c('0xf'),auth[_0x539c('0xd')](),controller[_0x539c('0x10')]);router[_0x539c('0x11')]('/',auth['isAuthenticated'](),controller[_0x539c('0x12')]);router[_0x539c('0x11')](_0x539c('0x13'),auth[_0x539c('0xd')](),controller['addTeams']);router[_0x539c('0x11')](_0x539c('0xf'),auth[_0x539c('0xd')](),controller[_0x539c('0x14')]);router[_0x539c('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x539c('0x16')]);router[_0x539c('0x17')](_0x539c('0xa'),auth[_0x539c('0xd')](),controller[_0x539c('0x18')]);router[_0x539c('0x17')]('/:id/teams',auth[_0x539c('0xd')](),controller[_0x539c('0x19')]);router['delete'](_0x539c('0xf'),auth[_0x539c('0xd')](),controller[_0x539c('0x1a')]);module[_0x539c('0x1b')]=router; \ No newline at end of file +var _0x20ba=['fs-extra','../../components/interaction/service','get','index','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express'];(function(_0x4654d1,_0x3206a9){var _0x251cc6=function(_0x3e91cb){while(--_0x3e91cb){_0x4654d1['push'](_0x4654d1['shift']());}};_0x251cc6(++_0x3206a9);}(_0x20ba,0xb3));var _0xa20b=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0x20ba[_0x34c027];return _0x47bff0;};'use strict';var multer=require(_0xa20b('0x0'));var util=require('util');var path=require(_0xa20b('0x1'));var timeout=require('connect-timeout');var express=require(_0xa20b('0x2'));var router=express['Router']();var fs_extra=require(_0xa20b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa20b('0x4'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xa20b('0x5')]('/',auth['isAuthenticated'](),controller[_0xa20b('0x6')]);router['get']('/describe',auth[_0xa20b('0x7')](),controller[_0xa20b('0x8')]);router[_0xa20b('0x5')](_0xa20b('0x9'),auth['isAuthenticated'](),controller[_0xa20b('0xa')]);router[_0xa20b('0x5')]('/:id/members',auth[_0xa20b('0x7')](),controller[_0xa20b('0xb')]);router[_0xa20b('0x5')](_0xa20b('0xc'),auth[_0xa20b('0x7')](),controller[_0xa20b('0xd')]);router[_0xa20b('0x5')](_0xa20b('0xe'),auth[_0xa20b('0x7')](),controller[_0xa20b('0xf')]);router['post']('/',auth[_0xa20b('0x7')](),controller[_0xa20b('0x10')]);router[_0xa20b('0x11')](_0xa20b('0xc'),auth[_0xa20b('0x7')](),controller['addTeams']);router[_0xa20b('0x11')]('/:id/users',auth[_0xa20b('0x7')](),controller[_0xa20b('0x12')]);router[_0xa20b('0x13')](_0xa20b('0x9'),auth[_0xa20b('0x7')](),controller[_0xa20b('0x14')]);router[_0xa20b('0x15')](_0xa20b('0x9'),auth['isAuthenticated'](),controller[_0xa20b('0x16')]);router[_0xa20b('0x15')](_0xa20b('0xc'),auth[_0xa20b('0x7')](),controller[_0xa20b('0x17')]);router['delete']('/:id/users',auth[_0xa20b('0x7')](),controller[_0xa20b('0x18')]);module[_0xa20b('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 1e8c8b8..6aab413 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 _0x66fb=['name','INTEGER','ENUM','beepall','roundrobin','exports'];(function(_0x43fc09,_0x11ebe4){var _0x2ee256=function(_0x8a0db2){while(--_0x8a0db2){_0x43fc09['push'](_0x43fc09['shift']());}};_0x2ee256(++_0x11ebe4);}(_0x66fb,0x71));var _0xb66f=function(_0x548898,_0x1db169){_0x548898=_0x548898-0x0;var _0x53fe69=_0x66fb[_0x548898];return _0x53fe69;};'use strict';var Sequelize=require('sequelize');module[_0xb66f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb66f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb66f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb66f('0x3')]('rrmemory',_0xb66f('0x4'),_0xb66f('0x5'))}}; \ No newline at end of file +var _0xaddc=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x14127d,_0x3f8251){var _0x13dd3e=function(_0x5eee2c){while(--_0x5eee2c){_0x14127d['push'](_0x14127d['shift']());}};_0x13dd3e(++_0x3f8251);}(_0xaddc,0xbc));var _0xcadd=function(_0x3e9b6a,_0x29dbde){_0x3e9b6a=_0x3e9b6a-0x0;var _0x5aa89b=_0xaddc[_0x3e9b6a];return _0x5aa89b;};'use strict';var Sequelize=require(_0xcadd('0x0'));module[_0xcadd('0x1')]={'name':{'type':Sequelize[_0xcadd('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcadd('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcadd('0x4')](_0xcadd('0x5'),_0xcadd('0x6'),_0xcadd('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 5d6dc16..b838bf3 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 _0x20a9=['path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','MailQueues','UserProfileResource','destroy','then','end','error','name','send','index','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','options','MailQueue','includeAll','include','findAll','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMembers','UserMailQueue','rawAttributes','MailQueueId','filter','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','SIP','getTeams','findOne','Team','addTeams','ids','User','Agents','online','voicePause','transaction','each','forEach','emit','removeTeams','select','tq.TeamId','from','join','user_has_teams','MailQueueId\x20=\x20?','clone','sequelize','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','userMailQueue:save','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xfd983f,_0x2495c2){var _0x5a9986=function(_0x30fbd8){while(--_0x30fbd8){_0xfd983f['push'](_0xfd983f['shift']());}};_0x5a9986(++_0x2495c2);}(_0x20a9,0x113));var _0x920a=function(_0x51d71a,_0x596fda){_0x51d71a=_0x51d71a-0x0;var _0xff01f1=_0x20a9[_0x51d71a];return _0xff01f1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x920a('0x0'));var jsonpatch=require(_0x920a('0x1'));var rp=require(_0x920a('0x2'));var moment=require(_0x920a('0x3'));var BPromise=require(_0x920a('0x4'));var Mustache=require(_0x920a('0x5'));var util=require(_0x920a('0x6'));var path=require(_0x920a('0x7'));var sox=require(_0x920a('0x8'));var csv=require(_0x920a('0x9'));var ejs=require(_0x920a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x920a('0xb'));var squel=require(_0x920a('0xc'));var crypto=require('crypto');var jsforce=require(_0x920a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x920a('0x9'));var querystring=require('querystring');var Papa=require(_0x920a('0xe'));var Redis=require(_0x920a('0xf'));var authService=require(_0x920a('0x10'));var qs=require(_0x920a('0x11'));var as=require(_0x920a('0x12'));var hardwareService=require(_0x920a('0x13'));var logger=require(_0x920a('0x14'))(_0x920a('0x15'));var utils=require(_0x920a('0x16'));var config=require(_0x920a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x920a('0x18'))['db'];config[_0x920a('0x19')]=_[_0x920a('0x1a')](config[_0x920a('0x19')],{'host':_0x920a('0x1b'),'port':0x18eb});var socket=require(_0x920a('0x1c'))(new Redis(config[_0x920a('0x19')]));require(_0x920a('0x1d'))[_0x920a('0x1e')](socket);function respondWithStatusCode(_0x2513b1,_0x347103){_0x347103=_0x347103||0xcc;return function(_0x309fb4){if(_0x309fb4){return _0x2513b1[_0x920a('0x1f')](_0x347103);}return _0x2513b1[_0x920a('0x20')](_0x347103)['end']();};}function respondWithResult(_0x5e5605,_0x29ec2a){_0x29ec2a=_0x29ec2a||0xc8;return function(_0x493a92){if(_0x493a92){return _0x5e5605[_0x920a('0x20')](_0x29ec2a)[_0x920a('0x21')](_0x493a92);}};}function respondWithFilteredResult(_0x3871a7,_0x13348e){return function(_0x2349e5){if(_0x2349e5){var _0x2b8953=typeof _0x13348e[_0x920a('0x22')]===_0x920a('0x23')&&typeof _0x13348e[_0x920a('0x24')]===_0x920a('0x23');var _0x430eb6=_0x2349e5[_0x920a('0x25')];var _0x5b446f=_0x2b8953?0x0:_0x13348e[_0x920a('0x22')];var _0x3a39c1=_0x2b8953?_0x2349e5[_0x920a('0x25')]:_0x13348e['offset']+_0x13348e['limit'];var _0x34d78f;if(_0x3a39c1>=_0x430eb6){_0x3a39c1=_0x430eb6;_0x34d78f=0xc8;}else{_0x34d78f=0xce;}_0x3871a7[_0x920a('0x20')](_0x34d78f);return _0x3871a7[_0x920a('0x26')](_0x920a('0x27'),_0x5b446f+'-'+_0x3a39c1+'/'+_0x430eb6)[_0x920a('0x21')](_0x2349e5);}return null;};}function patchUpdates(_0x52532a){return function(_0x568195){try{jsonpatch[_0x920a('0x28')](_0x568195,_0x52532a,!![]);}catch(_0x2b97dc){return BPromise[_0x920a('0x29')](_0x2b97dc);}return _0x568195[_0x920a('0x2a')]();};}function saveUpdates(_0x2fb14e,_0x27811c){return function(_0x2a3010){if(_0x2a3010){return _0x2a3010['update'](_0x2fb14e)['then'](function(_0x420637){return _0x420637;});}return null;};}function removeEntity(_0x4d8852,_0x36d050){return function(_0x118333){if(_0x118333){return _0x118333['destroy']()['then'](function(){var _0x45d0e1=_0x118333['get']({'plain':!![]});var _0xf2653d=_0x920a('0x2b');return db[_0x920a('0x2c')][_0x920a('0x2d')]({'where':{'type':_0xf2653d,'resourceId':_0x45d0e1['id']}})['then'](function(){return _0x118333;});})[_0x920a('0x2e')](function(){_0x4d8852['status'](0xcc)[_0x920a('0x2f')]();});}};}function handleEntityNotFound(_0x304c0b,_0x1aeaba){return function(_0x357cda){if(!_0x357cda){_0x304c0b[_0x920a('0x1f')](0x194);}return _0x357cda;};}function handleError(_0x2ca94d,_0x47cad8){_0x47cad8=_0x47cad8||0x1f4;return function(_0x27e6a3){logger[_0x920a('0x30')](_0x27e6a3['stack']);if(_0x27e6a3['name']){delete _0x27e6a3[_0x920a('0x31')];}_0x2ca94d[_0x920a('0x20')](_0x47cad8)[_0x920a('0x32')](_0x27e6a3);};}exports[_0x920a('0x33')]=function(_0x6d4a14,_0x48dee3){var _0x3f3dd9={},_0x2934bf={},_0x2c492e={'count':0x0,'rows':[]};var _0x2b19a3=_['map'](db['MailQueue']['rawAttributes'],function(_0x10c9fb){return{'name':_0x10c9fb['fieldName'],'type':_0x10c9fb[_0x920a('0x34')][_0x920a('0x35')]};});_0x2934bf[_0x920a('0x36')]=_['map'](_0x2b19a3,_0x920a('0x31'));_0x2934bf['query']=_[_0x920a('0x37')](_0x6d4a14[_0x920a('0x38')]);_0x2934bf[_0x920a('0x39')]=_['intersection'](_0x2934bf[_0x920a('0x36')],_0x2934bf['query']);_0x3f3dd9['attributes']=_[_0x920a('0x3a')](_0x2934bf[_0x920a('0x36')],qs[_0x920a('0x3b')](_0x6d4a14[_0x920a('0x38')][_0x920a('0x3b')]));_0x3f3dd9[_0x920a('0x3c')]=_0x3f3dd9[_0x920a('0x3c')]['length']?_0x3f3dd9[_0x920a('0x3c')]:_0x2934bf[_0x920a('0x36')];if(!_0x6d4a14[_0x920a('0x38')][_0x920a('0x3d')](_0x920a('0x3e'))){_0x3f3dd9[_0x920a('0x24')]=qs[_0x920a('0x24')](_0x6d4a14[_0x920a('0x38')][_0x920a('0x24')]);_0x3f3dd9['offset']=qs[_0x920a('0x22')](_0x6d4a14[_0x920a('0x38')][_0x920a('0x22')]);}_0x3f3dd9[_0x920a('0x3f')]=qs[_0x920a('0x40')](_0x6d4a14['query']['sort']);_0x3f3dd9[_0x920a('0x41')]=qs[_0x920a('0x39')](_[_0x920a('0x42')](_0x6d4a14[_0x920a('0x38')],_0x2934bf[_0x920a('0x39')]),_0x2b19a3);if(_0x6d4a14[_0x920a('0x38')]['filter']){_0x3f3dd9[_0x920a('0x41')]=_[_0x920a('0x43')](_0x3f3dd9['where'],{'$or':_[_0x920a('0x44')](_0x2b19a3,function(_0x4daa7a){if(_0x4daa7a['type']!=='VIRTUAL'){var _0x14ae9d={};_0x14ae9d[_0x4daa7a[_0x920a('0x31')]]={'$like':'%'+_0x6d4a14['query']['filter']+'%'};return _0x14ae9d;}})});}_0x3f3dd9=_['merge']({},_0x3f3dd9,_0x6d4a14[_0x920a('0x45')]);var _0x5d0137={'where':_0x3f3dd9[_0x920a('0x41')]};return db[_0x920a('0x46')][_0x920a('0x25')](_0x5d0137)[_0x920a('0x2e')](function(_0x2383c3){_0x2c492e[_0x920a('0x25')]=_0x2383c3;if(_0x6d4a14[_0x920a('0x38')][_0x920a('0x47')]){_0x3f3dd9[_0x920a('0x48')]=[{'all':!![]}];}return db[_0x920a('0x46')][_0x920a('0x49')](_0x3f3dd9);})[_0x920a('0x2e')](function(_0x5e3562){_0x2c492e['rows']=_0x5e3562;return _0x2c492e;})['then'](respondWithFilteredResult(_0x48dee3,_0x3f3dd9))['catch'](handleError(_0x48dee3,null));};exports['show']=function(_0x3a705d,_0x2d635e){var _0x53e9e4={'raw':!![],'where':{'id':_0x3a705d[_0x920a('0x4a')]['id']}},_0x15d285={};_0x15d285[_0x920a('0x36')]=_['keys'](db[_0x920a('0x46')]['rawAttributes']);_0x15d285['query']=_[_0x920a('0x37')](_0x3a705d[_0x920a('0x38')]);_0x15d285[_0x920a('0x39')]=_[_0x920a('0x3a')](_0x15d285[_0x920a('0x36')],_0x15d285[_0x920a('0x38')]);_0x53e9e4[_0x920a('0x3c')]=_[_0x920a('0x3a')](_0x15d285['model'],qs[_0x920a('0x3b')](_0x3a705d['query'][_0x920a('0x3b')]));_0x53e9e4[_0x920a('0x3c')]=_0x53e9e4[_0x920a('0x3c')][_0x920a('0x4b')]?_0x53e9e4[_0x920a('0x3c')]:_0x15d285[_0x920a('0x36')];if(_0x3a705d[_0x920a('0x38')][_0x920a('0x47')]){_0x53e9e4[_0x920a('0x48')]=[{'all':!![]}];}_0x53e9e4=_[_0x920a('0x43')]({},_0x53e9e4,_0x3a705d[_0x920a('0x45')]);return db[_0x920a('0x46')]['find'](_0x53e9e4)['then'](handleEntityNotFound(_0x2d635e,null))[_0x920a('0x2e')](respondWithResult(_0x2d635e,null))['catch'](handleError(_0x2d635e,null));};exports[_0x920a('0x4c')]=function(_0x5c9694,_0x52eeb2){return db[_0x920a('0x46')][_0x920a('0x4c')](_0x5c9694[_0x920a('0x4d')],{})[_0x920a('0x2e')](function(_0x22fb90){var _0x30c6f5=_0x5c9694[_0x920a('0x4e')][_0x920a('0x4f')]({'plain':!![]});if(!_0x30c6f5)throw new Error(_0x920a('0x50'));if(_0x30c6f5[_0x920a('0x51')]===_0x920a('0x4e')){var _0x5821f6=_0x22fb90[_0x920a('0x4f')]({'plain':!![]});var _0x44b99a=_0x920a('0x2b');return db[_0x920a('0x52')][_0x920a('0x53')]({'where':{'name':_0x44b99a,'userProfileId':_0x30c6f5[_0x920a('0x54')]},'raw':!![]})[_0x920a('0x2e')](function(_0x2a2fc0){if(_0x2a2fc0&&_0x2a2fc0[_0x920a('0x55')]===0x0){return db[_0x920a('0x2c')]['create']({'name':_0x5821f6[_0x920a('0x31')],'resourceId':_0x5821f6['id'],'type':_0x2a2fc0[_0x920a('0x31')],'sectionId':_0x2a2fc0['id']},{})[_0x920a('0x2e')](function(){return _0x22fb90;});}else{return _0x22fb90;}})[_0x920a('0x56')](function(_0x392aba){logger[_0x920a('0x30')](_0x920a('0x57'),_0x392aba);throw _0x392aba;});}return _0x22fb90;})[_0x920a('0x2e')](respondWithResult(_0x52eeb2,0xc9))[_0x920a('0x56')](handleError(_0x52eeb2,null));};exports[_0x920a('0x58')]=function(_0x419b2a,_0xddf13f){if(_0x419b2a[_0x920a('0x4d')]['id']){delete _0x419b2a[_0x920a('0x4d')]['id'];}return db['MailQueue'][_0x920a('0x53')]({'where':{'id':_0x419b2a[_0x920a('0x4a')]['id']}})['then'](handleEntityNotFound(_0xddf13f,null))['then'](saveUpdates(_0x419b2a[_0x920a('0x4d')],null))[_0x920a('0x2e')](respondWithResult(_0xddf13f,null))[_0x920a('0x56')](handleError(_0xddf13f,null));};exports['destroy']=function(_0x3e267a,_0x301e8d){return db['MailQueue'][_0x920a('0x53')]({'where':{'id':_0x3e267a[_0x920a('0x4a')]['id']}})[_0x920a('0x2e')](handleEntityNotFound(_0x301e8d,null))[_0x920a('0x2e')](removeEntity(_0x301e8d,null))[_0x920a('0x56')](handleError(_0x301e8d,null));};exports['describe']=function(_0x4e089d,_0x4e55d7){return db[_0x920a('0x46')]['describe']()['then'](respondWithResult(_0x4e55d7,null))[_0x920a('0x56')](handleError(_0x4e55d7,null));};exports[_0x920a('0x59')]=function(_0x2a9ac1,_0x54b439,_0x22db3a){var _0x4bb081={'raw':!![],'where':{}},_0x13fc04={},_0x1ca828;return db[_0x920a('0x46')]['findOne']({'where':{'id':_0x2a9ac1['params']['id']}})[_0x920a('0x2e')](handleEntityNotFound(_0x54b439,null))[_0x920a('0x2e')](function(_0x35b946){if(_0x35b946){_0x1ca828=_0x35b946[_0x920a('0x4f')]({'plain':!![]});_0x13fc04['model']=_['keys'](db[_0x920a('0x5a')][_0x920a('0x5b')]);_0x13fc04[_0x920a('0x38')]=_[_0x920a('0x37')](_0x2a9ac1['query']);_0x13fc04[_0x920a('0x39')]=_[_0x920a('0x3a')](_0x13fc04['model'],_0x13fc04['query']);_0x4bb081[_0x920a('0x3c')]=_[_0x920a('0x3a')](_0x13fc04[_0x920a('0x36')],qs[_0x920a('0x3b')](_0x2a9ac1['query'][_0x920a('0x3b')]));_0x4bb081[_0x920a('0x3c')]=_0x4bb081[_0x920a('0x3c')]['length']?_0x4bb081[_0x920a('0x3c')]:_0x13fc04[_0x920a('0x36')];if(!_0x2a9ac1['query'][_0x920a('0x3d')]('nolimit')){_0x4bb081[_0x920a('0x24')]=qs['limit'](_0x2a9ac1['query'][_0x920a('0x24')]);_0x4bb081[_0x920a('0x22')]=qs[_0x920a('0x22')](_0x2a9ac1[_0x920a('0x38')]['offset']);}_0x4bb081[_0x920a('0x3f')]=qs[_0x920a('0x40')](_0x2a9ac1['query'][_0x920a('0x40')]);_0x4bb081['where']=qs[_0x920a('0x39')](_[_0x920a('0x42')](_0x2a9ac1['query'],_0x13fc04['filters']));_0x4bb081[_0x920a('0x41')][_0x920a('0x5c')]=_0x35b946['id'];if(_0x2a9ac1['query'][_0x920a('0x5d')]){_0x4bb081['where']=_[_0x920a('0x43')](_0x4bb081[_0x920a('0x41')],{'$or':_[_0x920a('0x44')](_0x4bb081['attributes'],function(_0x18c4a6){var _0x19cc15={};_0x19cc15[_0x18c4a6]={'$like':'%'+_0x2a9ac1['query'][_0x920a('0x5d')]+'%'};return _0x19cc15;})});}_0x4bb081=_[_0x920a('0x43')]({},_0x4bb081,_0x2a9ac1[_0x920a('0x45')]);return db[_0x920a('0x5a')][_0x920a('0x49')](_0x4bb081);}})[_0x920a('0x2e')](function(_0x34d233){if(_0x34d233){return db['User'][_0x920a('0x5e')]({'where':{'id':_[_0x920a('0x44')](_0x34d233,_0x920a('0x5f')),'role':_0x920a('0x60')},'attributes':['id',_0x920a('0x31'),_0x920a('0x61'),_0x920a('0x62'),_0x920a('0x63')]});}})['then'](function(_0x141bcc){if(_0x141bcc){return{'count':_0x141bcc[_0x920a('0x25')],'rows':_[_0x920a('0x44')](_0x141bcc[_0x920a('0x64')],function(_0x994a60){return{'membername':_0x994a60[_0x920a('0x31')],'UserId':_0x994a60['id'],'queue_name':_0x1ca828['name'],'MailQueueId':_0x1ca828['id'],'interface':util[_0x920a('0x65')]('%s/%s',_0x920a('0x66'),_0x994a60[_0x920a('0x31')]),'penalty':0x0,'paused':_0x994a60['mailPause'],'createdAt':_0x994a60['createdAt'],'updatedAt':_0x994a60[_0x920a('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x920a('0x2e')](respondWithFilteredResult(_0x54b439,_0x4bb081))['catch'](handleError(_0x54b439,null));};exports[_0x920a('0x67')]=function(_0x25fb37,_0x47c6ae,_0x2a9179){var _0x487b93={};var _0x2c6c2a={};var _0xf6fe52;var _0x49b9d9;return db['MailQueue'][_0x920a('0x68')]({'where':{'id':_0x25fb37[_0x920a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x47c6ae,null))[_0x920a('0x2e')](function(_0xbe023){if(_0xbe023){_0xf6fe52=_0xbe023;_0x2c6c2a[_0x920a('0x36')]=_[_0x920a('0x37')](db[_0x920a('0x69')][_0x920a('0x5b')]);_0x2c6c2a[_0x920a('0x38')]=_[_0x920a('0x37')](_0x25fb37[_0x920a('0x38')]);_0x2c6c2a[_0x920a('0x39')]=_[_0x920a('0x3a')](_0x2c6c2a[_0x920a('0x36')],_0x2c6c2a[_0x920a('0x38')]);_0x487b93[_0x920a('0x3c')]=_[_0x920a('0x3a')](_0x2c6c2a[_0x920a('0x36')],qs['fields'](_0x25fb37['query'][_0x920a('0x3b')]));_0x487b93[_0x920a('0x3c')]=_0x487b93['attributes'][_0x920a('0x4b')]?_0x487b93[_0x920a('0x3c')]:_0x2c6c2a[_0x920a('0x36')];_0x487b93[_0x920a('0x3f')]=qs['sort'](_0x25fb37['query'][_0x920a('0x40')]);_0x487b93['where']=qs[_0x920a('0x39')](_['pick'](_0x25fb37['query'],_0x2c6c2a[_0x920a('0x39')]));if(_0x25fb37[_0x920a('0x38')][_0x920a('0x5d')]){_0x487b93[_0x920a('0x41')]=_[_0x920a('0x43')](_0x487b93[_0x920a('0x41')],{'$or':_[_0x920a('0x44')](_0x487b93[_0x920a('0x3c')],function(_0x5b502f){var _0x2a3d01={};_0x2a3d01[_0x5b502f]={'$like':'%'+_0x25fb37[_0x920a('0x38')]['filter']+'%'};return _0x2a3d01;})});}_0x487b93=_[_0x920a('0x43')]({},_0x487b93,_0x25fb37[_0x920a('0x45')]);return _0xf6fe52[_0x920a('0x67')](_0x487b93);}})[_0x920a('0x2e')](function(_0x4768e4){if(_0x4768e4){_0x49b9d9=_0x4768e4[_0x920a('0x4b')];if(!_0x25fb37[_0x920a('0x38')][_0x920a('0x3d')](_0x920a('0x3e'))){_0x487b93[_0x920a('0x24')]=qs[_0x920a('0x24')](_0x25fb37[_0x920a('0x38')][_0x920a('0x24')]);_0x487b93[_0x920a('0x22')]=qs[_0x920a('0x22')](_0x25fb37['query'][_0x920a('0x22')]);}return _0xf6fe52['getTeams'](_0x487b93);}})[_0x920a('0x2e')](function(_0xe1557e){if(_0xe1557e){return _0xe1557e?{'count':_0x49b9d9,'rows':_0xe1557e}:null;}})[_0x920a('0x2e')](respondWithResult(_0x47c6ae,null))[_0x920a('0x56')](handleError(_0x47c6ae,null));};exports[_0x920a('0x6a')]=function(_0x3de80f,_0x4c1df3,_0x1eb7d4){var _0x3c7955=_0x3de80f['body'][_0x920a('0x6b')];return db[_0x920a('0x69')][_0x920a('0x49')]({'where':{'id':_0x3c7955},'attributes':['id'],'include':[{'model':db[_0x920a('0x6c')],'as':_0x920a('0x6d'),'attributes':['id',_0x920a('0x31'),_0x920a('0x6e'),_0x920a('0x6f'),'interface'],'raw':!![]}]})[_0x920a('0x2e')](function(_0x1e3257){if(_0x1e3257){var _0x788a51=_['flatMap'](_0x1e3257,function(_0x41e05e){var _0x2a0a6f=_0x41e05e['get']({'plain':!![]});return _0x2a0a6f[_0x920a('0x6d')];});return db[_0x920a('0x46')]['find']({'where':{'id':_0x3de80f[_0x920a('0x4a')]['id']}})['then'](function(_0x29852c){return db['sequelize'][_0x920a('0x70')](function(_0x52b0ce){return _0x29852c[_0x920a('0x6a')](_0x3c7955,{'transaction':_0x52b0ce})[_0x920a('0x2e')](function(){return BPromise[_0x920a('0x71')](_0x788a51,function(_0x1845ef){return db[_0x920a('0x5a')]['findOrCreate']({'where':{'UserId':_0x1845ef['id'],'MailQueueId':_0x3de80f[_0x920a('0x4a')]['id']},'transaction':_0x52b0ce});});})[_0x920a('0x2e')](function(){_0x788a51[_0x920a('0x72')](function(_0xc25a4c){socket[_0x920a('0x73')]('userMailQueue:save',{'UserId':_0xc25a4c['id'],'MailQueueId':_0x29852c['id']});});});});});}})[_0x920a('0x2e')](respondWithStatusCode(_0x4c1df3,null))[_0x920a('0x56')](handleError(_0x4c1df3,null));};exports[_0x920a('0x74')]=function(_0x38aa95,_0x12aa46,_0x151b6b){return db[_0x920a('0x69')][_0x920a('0x49')]({'where':{'id':_0x38aa95[_0x920a('0x38')][_0x920a('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x920a('0x6c')],'as':_0x920a('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x920a('0x2e')](handleEntityNotFound(_0x12aa46,null))[_0x920a('0x2e')](function(_0x4f6f4f){var _0x5703d4=_[_0x920a('0x44')](_0x4f6f4f,'id');var _0x253544=[];var _0x1d80e1=[];var _0xbcd26e=squel[_0x920a('0x75')]();_0xbcd26e['field'](_0x920a('0x76'))[_0x920a('0x77')]('team_has_mail_queues','tq')[_0x920a('0x78')](_0x920a('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x920a('0x41')](_0x920a('0x7a'),_0x38aa95[_0x920a('0x4a')]['id']);for(var _0x499f83=0x0;_0x499f83<_0x4f6f4f['length'];_0x499f83+=0x1){let _0x4cf36e=_0x4f6f4f[_0x499f83];for(var _0x2c2946=0x0;_0x2c2946<_0x4cf36e['Agents'][_0x920a('0x4b')];_0x2c2946+=0x1){let _0x30cd79=_0x4cf36e['Agents'][_0x2c2946];var _0x73ae6d=_0xbcd26e[_0x920a('0x7b')]();_0x73ae6d[_0x920a('0x41')]('ut.UserId\x20=\x20?',_0x30cd79['id']);_0x1d80e1['push'](db[_0x920a('0x7c')][_0x920a('0x38')](_0x73ae6d[_0x920a('0x7d')](),{'type':db[_0x920a('0x7c')]['QueryTypes'][_0x920a('0x7e')]})[_0x920a('0x2e')](function(_0x1b6a07){if(_0x1b6a07[_0x920a('0x4b')]===0x1){return _0x30cd79['id'];}else{var _0x1d45e1=_[_0x920a('0x7f')](_[_0x920a('0x44')](_0x1b6a07,_0x920a('0x80')),function(_0x5f2bab){return _['includes'](_0x5703d4,_0x5f2bab);});if(_0x1d45e1){return _0x30cd79['id'];}}}));}}return BPromise[_0x920a('0x81')](_0x1d80e1)[_0x920a('0x2e')](function(_0xbe505d){_0x253544=_(_0x253544)[_0x920a('0x82')](_0xbe505d)[_0x920a('0x83')]()[_0x920a('0x84')]();return db[_0x920a('0x46')][_0x920a('0x53')]({'where':{'id':_0x38aa95['params']['id']}})[_0x920a('0x2e')](function(_0xc717c0){return db['sequelize'][_0x920a('0x70')](function(_0x12eb8a){return _0xc717c0[_0x920a('0x74')](_0x38aa95['query'][_0x920a('0x6b')],{'transaction':_0x12eb8a})[_0x920a('0x2e')](function(){if(!_[_0x920a('0x85')](_0x253544)){return _0xc717c0[_0x920a('0x86')](_0x253544,{'transaction':_0x12eb8a});}})[_0x920a('0x2e')](function(){_0x253544[_0x920a('0x72')](function(_0x572cc7){socket[_0x920a('0x73')](_0x920a('0x87'),{'UserId':_0x572cc7,'MailQueueId':_0xc717c0['id']});});});});});});})[_0x920a('0x2e')](respondWithStatusCode(_0x12aa46,null))[_0x920a('0x56')](handleError(_0x12aa46,null));};exports[_0x920a('0x88')]=function(_0x1a57da,_0x44df85,_0x595ff4){return db[_0x920a('0x46')]['find']({'where':{'id':_0x1a57da['params']['id']}})['then'](handleEntityNotFound(_0x44df85,null))['then'](function(_0x173262){if(_0x173262){return _0x173262[_0x920a('0x88')](_0x1a57da[_0x920a('0x4d')][_0x920a('0x6b')],_[_0x920a('0x89')](_0x1a57da[_0x920a('0x4d')],['ids','id'])||{})['spread'](function(_0x2ba493){for(var _0x4eff99=0x0;_0x4eff99<_0x1a57da[_0x920a('0x4d')][_0x920a('0x6b')][_0x920a('0x4b')];_0x4eff99+=0x1){socket[_0x920a('0x73')](_0x920a('0x8a'),{'UserId':Number(_0x1a57da['body'][_0x920a('0x6b')][_0x4eff99]),'MailQueueId':Number(_0x1a57da[_0x920a('0x4a')]['id'])});}return _0x2ba493;});}})[_0x920a('0x2e')](respondWithResult(_0x44df85,null))['catch'](handleError(_0x44df85,null));};exports[_0x920a('0x86')]=function(_0x403525,_0x4e0443,_0x14aac1){return db[_0x920a('0x46')][_0x920a('0x53')]({'where':{'id':_0x403525['params']['id']}})[_0x920a('0x2e')](handleEntityNotFound(_0x4e0443,null))[_0x920a('0x2e')](function(_0x530823){if(_0x530823){return _0x530823['removeAgents'](_0x403525[_0x920a('0x38')][_0x920a('0x6b')])[_0x920a('0x2e')](function(){if(_[_0x920a('0x8b')](_0x403525[_0x920a('0x38')][_0x920a('0x6b')])){for(var _0x3a47b9=0x0;_0x3a47b9<_0x403525['query']['ids'][_0x920a('0x4b')];_0x3a47b9+=0x1){socket[_0x920a('0x73')](_0x920a('0x87'),{'UserId':Number(_0x403525[_0x920a('0x38')]['ids'][_0x3a47b9]),'MailQueueId':Number(_0x403525['params']['id'])});}}else{socket[_0x920a('0x73')](_0x920a('0x87'),{'UserId':Number(_0x403525['query'][_0x920a('0x6b')]),'MailQueueId':Number(_0x403525[_0x920a('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e0443,null))[_0x920a('0x56')](handleError(_0x4e0443,null));};exports[_0x920a('0x8c')]=function(_0x3457e9,_0x30f87f,_0x23d060){var _0x5e37f0={};var _0x4efb41={};var _0x49b09a;var _0x5799b3;return db[_0x920a('0x46')][_0x920a('0x68')]({'where':{'id':_0x3457e9['params']['id']}})[_0x920a('0x2e')](handleEntityNotFound(_0x30f87f,null))[_0x920a('0x2e')](function(_0x2624d9){if(_0x2624d9){_0x49b09a=_0x2624d9;_0x4efb41[_0x920a('0x36')]=_[_0x920a('0x37')](db[_0x920a('0x6c')][_0x920a('0x5b')]);_0x4efb41[_0x920a('0x38')]=_[_0x920a('0x37')](_0x3457e9['query']);_0x4efb41[_0x920a('0x39')]=_[_0x920a('0x3a')](_0x4efb41[_0x920a('0x36')],_0x4efb41[_0x920a('0x38')]);_0x5e37f0[_0x920a('0x3c')]=_[_0x920a('0x3a')](_0x4efb41['model'],qs[_0x920a('0x3b')](_0x3457e9[_0x920a('0x38')][_0x920a('0x3b')]));_0x5e37f0[_0x920a('0x3c')]=_0x5e37f0[_0x920a('0x3c')][_0x920a('0x4b')]?_0x5e37f0[_0x920a('0x3c')]:_0x4efb41[_0x920a('0x36')];_0x5e37f0[_0x920a('0x3f')]=qs[_0x920a('0x40')](_0x3457e9[_0x920a('0x38')][_0x920a('0x40')]);_0x5e37f0[_0x920a('0x41')]=qs['filters'](_[_0x920a('0x42')](_0x3457e9[_0x920a('0x38')],_0x4efb41[_0x920a('0x39')]));if(_0x3457e9[_0x920a('0x38')]['filter']){_0x5e37f0['where']=_[_0x920a('0x43')](_0x5e37f0['where'],{'$or':_[_0x920a('0x44')](_0x5e37f0[_0x920a('0x3c')],function(_0x19e88d){var _0x128ab0={};_0x128ab0[_0x19e88d]={'$like':'%'+_0x3457e9[_0x920a('0x38')][_0x920a('0x5d')]+'%'};return _0x128ab0;})});}_0x5e37f0=_[_0x920a('0x43')]({},_0x5e37f0,_0x3457e9['options']);return _0x49b09a['getAgents'](_0x5e37f0);}})[_0x920a('0x2e')](function(_0x3464fa){if(_0x3464fa){_0x5799b3=_0x3464fa['length'];if(!_0x3457e9[_0x920a('0x38')][_0x920a('0x3d')](_0x920a('0x3e'))){_0x5e37f0[_0x920a('0x24')]=qs[_0x920a('0x24')](_0x3457e9[_0x920a('0x38')][_0x920a('0x24')]);_0x5e37f0['offset']=qs[_0x920a('0x22')](_0x3457e9[_0x920a('0x38')][_0x920a('0x22')]);}return _0x49b09a[_0x920a('0x8c')](_0x5e37f0);}})[_0x920a('0x2e')](function(_0x3d86bd){if(_0x3d86bd){return _0x3d86bd?{'count':_0x5799b3,'rows':_0x3d86bd}:null;}})[_0x920a('0x2e')](respondWithResult(_0x30f87f,null))[_0x920a('0x56')](handleError(_0x30f87f,null));}; \ No newline at end of file +var _0xc0b0=['removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','map','MailQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','findAll','rows','params','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','UserMailQueue','order','pick','MailQueueId','User','UserId','agent','format','%s/%s','mailPause','createdAt','updatedAt','getTeams','Team','rawAttributes','addTeams','ids','Agents','voicePause','interface','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','transaction'];(function(_0x8e051b,_0xde2ee9){var _0x49719c=function(_0x175f4e){while(--_0x175f4e){_0x8e051b['push'](_0x8e051b['shift']());}};_0x49719c(++_0xde2ee9);}(_0xc0b0,0x19a));var _0x0c0b=function(_0x1c4b33,_0x49492e){_0x1c4b33=_0x1c4b33-0x0;var _0x238f81=_0xc0b0[_0x1c4b33];return _0x238f81;};'use strict';var emlformat=require(_0x0c0b('0x0'));var rimraf=require(_0x0c0b('0x1'));var zipdir=require(_0x0c0b('0x2'));var jsonpatch=require(_0x0c0b('0x3'));var rp=require(_0x0c0b('0x4'));var moment=require('moment');var BPromise=require(_0x0c0b('0x5'));var Mustache=require(_0x0c0b('0x6'));var util=require(_0x0c0b('0x7'));var path=require(_0x0c0b('0x8'));var sox=require(_0x0c0b('0x9'));var csv=require(_0x0c0b('0xa'));var ejs=require(_0x0c0b('0xb'));var fs=require('fs');var fs_extra=require(_0x0c0b('0xc'));var _=require('lodash');var squel=require(_0x0c0b('0xd'));var crypto=require('crypto');var jsforce=require(_0x0c0b('0xe'));var deskjs=require(_0x0c0b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0c0b('0x10'));var Papa=require('papaparse');var Redis=require(_0x0c0b('0x11'));var authService=require(_0x0c0b('0x12'));var qs=require(_0x0c0b('0x13'));var as=require(_0x0c0b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c0b('0x15'))('api');var utils=require(_0x0c0b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0c0b('0x17'));var db=require(_0x0c0b('0x18'))['db'];config['redis']=_[_0x0c0b('0x19')](config[_0x0c0b('0x1a')],{'host':_0x0c0b('0x1b'),'port':0x18eb});var socket=require(_0x0c0b('0x1c'))(new Redis(config[_0x0c0b('0x1a')]));require(_0x0c0b('0x1d'))['register'](socket);function respondWithStatusCode(_0x4ec588,_0x2c75e5){_0x2c75e5=_0x2c75e5||0xcc;return function(_0x24f619){if(_0x24f619){return _0x4ec588[_0x0c0b('0x1e')](_0x2c75e5);}return _0x4ec588[_0x0c0b('0x1f')](_0x2c75e5)[_0x0c0b('0x20')]();};}function respondWithResult(_0x1fa57d,_0x404e8d){_0x404e8d=_0x404e8d||0xc8;return function(_0x4e79b8){if(_0x4e79b8){return _0x1fa57d[_0x0c0b('0x1f')](_0x404e8d)[_0x0c0b('0x21')](_0x4e79b8);}};}function respondWithFilteredResult(_0x4b5cd5,_0x4d0182){return function(_0x208933){if(_0x208933){var _0x3bb4bd=typeof _0x4d0182['offset']==='undefined'&&typeof _0x4d0182['limit']===_0x0c0b('0x22');var _0x3aeb40=_0x208933['count'];var _0x4a346f=_0x3bb4bd?0x0:_0x4d0182[_0x0c0b('0x23')];var _0x114318=_0x3bb4bd?_0x208933[_0x0c0b('0x24')]:_0x4d0182[_0x0c0b('0x23')]+_0x4d0182[_0x0c0b('0x25')];var _0x31c12a;if(_0x114318>=_0x3aeb40){_0x114318=_0x3aeb40;_0x31c12a=0xc8;}else{_0x31c12a=0xce;}_0x4b5cd5['status'](_0x31c12a);return _0x4b5cd5[_0x0c0b('0x26')](_0x0c0b('0x27'),_0x4a346f+'-'+_0x114318+'/'+_0x3aeb40)[_0x0c0b('0x21')](_0x208933);}return null;};}function patchUpdates(_0x36a99b){return function(_0x4efe43){try{jsonpatch['apply'](_0x4efe43,_0x36a99b,!![]);}catch(_0xce403e){return BPromise[_0x0c0b('0x28')](_0xce403e);}return _0x4efe43['save']();};}function saveUpdates(_0x2baed9,_0xcea1ab){return function(_0x641292){if(_0x641292){return _0x641292['update'](_0x2baed9)[_0x0c0b('0x29')](function(_0x32b27e){return _0x32b27e;});}return null;};}function removeEntity(_0x192e62,_0x2f9966){return function(_0x4befde){if(_0x4befde){return _0x4befde['destroy']()[_0x0c0b('0x29')](function(){var _0x4a1a20=_0x4befde[_0x0c0b('0x2a')]({'plain':!![]});var _0x4aabc1=_0x0c0b('0x2b');return db[_0x0c0b('0x2c')][_0x0c0b('0x2d')]({'where':{'type':_0x4aabc1,'resourceId':_0x4a1a20['id']}})['then'](function(){return _0x4befde;});})[_0x0c0b('0x29')](function(){_0x192e62[_0x0c0b('0x1f')](0xcc)[_0x0c0b('0x20')]();});}};}function handleEntityNotFound(_0x1476fd,_0x4b210d){return function(_0x243ee9){if(!_0x243ee9){_0x1476fd[_0x0c0b('0x1e')](0x194);}return _0x243ee9;};}function handleError(_0xf0516c,_0x533f4c){_0x533f4c=_0x533f4c||0x1f4;return function(_0x2b502b){logger[_0x0c0b('0x2e')](_0x2b502b[_0x0c0b('0x2f')]);if(_0x2b502b[_0x0c0b('0x30')]){delete _0x2b502b[_0x0c0b('0x30')];}_0xf0516c['status'](_0x533f4c)[_0x0c0b('0x31')](_0x2b502b);};}exports[_0x0c0b('0x32')]=function(_0x2bb6ca,_0x3b8aad){var _0x3688c7={},_0x2c69f7={},_0x135466={'count':0x0,'rows':[]};var _0xd85c67=_[_0x0c0b('0x33')](db[_0x0c0b('0x34')]['rawAttributes'],function(_0x1fa221){return{'name':_0x1fa221[_0x0c0b('0x35')],'type':_0x1fa221['type'][_0x0c0b('0x36')]};});_0x2c69f7[_0x0c0b('0x37')]=_[_0x0c0b('0x33')](_0xd85c67,'name');_0x2c69f7[_0x0c0b('0x38')]=_[_0x0c0b('0x39')](_0x2bb6ca[_0x0c0b('0x38')]);_0x2c69f7[_0x0c0b('0x3a')]=_[_0x0c0b('0x3b')](_0x2c69f7['model'],_0x2c69f7[_0x0c0b('0x38')]);_0x3688c7[_0x0c0b('0x3c')]=_[_0x0c0b('0x3b')](_0x2c69f7[_0x0c0b('0x37')],qs[_0x0c0b('0x3d')](_0x2bb6ca[_0x0c0b('0x38')][_0x0c0b('0x3d')]));_0x3688c7['attributes']=_0x3688c7[_0x0c0b('0x3c')][_0x0c0b('0x3e')]?_0x3688c7[_0x0c0b('0x3c')]:_0x2c69f7['model'];if(!_0x2bb6ca['query'][_0x0c0b('0x3f')](_0x0c0b('0x40'))){_0x3688c7[_0x0c0b('0x25')]=qs['limit'](_0x2bb6ca[_0x0c0b('0x38')][_0x0c0b('0x25')]);_0x3688c7[_0x0c0b('0x23')]=qs[_0x0c0b('0x23')](_0x2bb6ca[_0x0c0b('0x38')][_0x0c0b('0x23')]);}_0x3688c7['order']=qs[_0x0c0b('0x41')](_0x2bb6ca[_0x0c0b('0x38')][_0x0c0b('0x41')]);_0x3688c7[_0x0c0b('0x42')]=qs[_0x0c0b('0x3a')](_['pick'](_0x2bb6ca[_0x0c0b('0x38')],_0x2c69f7['filters']),_0xd85c67);if(_0x2bb6ca['query'][_0x0c0b('0x43')]){_0x3688c7[_0x0c0b('0x42')]=_[_0x0c0b('0x44')](_0x3688c7[_0x0c0b('0x42')],{'$or':_[_0x0c0b('0x33')](_0xd85c67,function(_0x7ad0cc){if(_0x7ad0cc[_0x0c0b('0x45')]!=='VIRTUAL'){var _0x33ff5f={};_0x33ff5f[_0x7ad0cc['name']]={'$like':'%'+_0x2bb6ca['query']['filter']+'%'};return _0x33ff5f;}})});}_0x3688c7=_['merge']({},_0x3688c7,_0x2bb6ca['options']);var _0x250868={'where':_0x3688c7[_0x0c0b('0x42')]};return db[_0x0c0b('0x34')][_0x0c0b('0x24')](_0x250868)['then'](function(_0x3252e5){_0x135466[_0x0c0b('0x24')]=_0x3252e5;if(_0x2bb6ca[_0x0c0b('0x38')]['includeAll']){_0x3688c7['include']=[{'all':!![]}];}return db[_0x0c0b('0x34')][_0x0c0b('0x46')](_0x3688c7);})[_0x0c0b('0x29')](function(_0x4606b5){_0x135466[_0x0c0b('0x47')]=_0x4606b5;return _0x135466;})[_0x0c0b('0x29')](respondWithFilteredResult(_0x3b8aad,_0x3688c7))['catch'](handleError(_0x3b8aad,null));};exports['show']=function(_0x3c94b,_0x815af5){var _0x3c86c0={'raw':!![],'where':{'id':_0x3c94b[_0x0c0b('0x48')]['id']}},_0x19daf8={};_0x19daf8['model']=_[_0x0c0b('0x39')](db[_0x0c0b('0x34')]['rawAttributes']);_0x19daf8[_0x0c0b('0x38')]=_[_0x0c0b('0x39')](_0x3c94b[_0x0c0b('0x38')]);_0x19daf8[_0x0c0b('0x3a')]=_[_0x0c0b('0x3b')](_0x19daf8[_0x0c0b('0x37')],_0x19daf8[_0x0c0b('0x38')]);_0x3c86c0[_0x0c0b('0x3c')]=_['intersection'](_0x19daf8[_0x0c0b('0x37')],qs['fields'](_0x3c94b[_0x0c0b('0x38')]['fields']));_0x3c86c0['attributes']=_0x3c86c0[_0x0c0b('0x3c')][_0x0c0b('0x3e')]?_0x3c86c0['attributes']:_0x19daf8[_0x0c0b('0x37')];if(_0x3c94b[_0x0c0b('0x38')][_0x0c0b('0x49')]){_0x3c86c0['include']=[{'all':!![]}];}_0x3c86c0=_[_0x0c0b('0x44')]({},_0x3c86c0,_0x3c94b[_0x0c0b('0x4a')]);return db[_0x0c0b('0x34')]['find'](_0x3c86c0)['then'](handleEntityNotFound(_0x815af5,null))[_0x0c0b('0x29')](respondWithResult(_0x815af5,null))[_0x0c0b('0x4b')](handleError(_0x815af5,null));};exports[_0x0c0b('0x4c')]=function(_0x434af5,_0x1ac8a5){return db[_0x0c0b('0x34')]['create'](_0x434af5[_0x0c0b('0x4d')],{})['then'](function(_0x4fdfb8){var _0x77abb1=_0x434af5[_0x0c0b('0x4e')][_0x0c0b('0x2a')]({'plain':!![]});if(!_0x77abb1)throw new Error(_0x0c0b('0x4f'));if(_0x77abb1[_0x0c0b('0x50')]===_0x0c0b('0x4e')){var _0x19aa32=_0x4fdfb8[_0x0c0b('0x2a')]({'plain':!![]});var _0x35b35e=_0x0c0b('0x2b');return db[_0x0c0b('0x51')][_0x0c0b('0x52')]({'where':{'name':_0x35b35e,'userProfileId':_0x77abb1[_0x0c0b('0x53')]},'raw':!![]})[_0x0c0b('0x29')](function(_0x4e3d0d){if(_0x4e3d0d&&_0x4e3d0d[_0x0c0b('0x54')]===0x0){return db[_0x0c0b('0x2c')][_0x0c0b('0x4c')]({'name':_0x19aa32['name'],'resourceId':_0x19aa32['id'],'type':_0x4e3d0d['name'],'sectionId':_0x4e3d0d['id']},{})[_0x0c0b('0x29')](function(){return _0x4fdfb8;});}else{return _0x4fdfb8;}})[_0x0c0b('0x4b')](function(_0x4019db){logger['error'](_0x0c0b('0x55'),_0x4019db);throw _0x4019db;});}return _0x4fdfb8;})['then'](respondWithResult(_0x1ac8a5,0xc9))['catch'](handleError(_0x1ac8a5,null));};exports['update']=function(_0x42497a,_0x201a3e){if(_0x42497a[_0x0c0b('0x4d')]['id']){delete _0x42497a[_0x0c0b('0x4d')]['id'];}return db[_0x0c0b('0x34')][_0x0c0b('0x52')]({'where':{'id':_0x42497a[_0x0c0b('0x48')]['id']}})[_0x0c0b('0x29')](handleEntityNotFound(_0x201a3e,null))[_0x0c0b('0x29')](saveUpdates(_0x42497a[_0x0c0b('0x4d')],null))[_0x0c0b('0x29')](respondWithResult(_0x201a3e,null))['catch'](handleError(_0x201a3e,null));};exports[_0x0c0b('0x2d')]=function(_0x250be5,_0x541f2a){return db[_0x0c0b('0x34')][_0x0c0b('0x52')]({'where':{'id':_0x250be5[_0x0c0b('0x48')]['id']}})['then'](handleEntityNotFound(_0x541f2a,null))['then'](removeEntity(_0x541f2a,null))[_0x0c0b('0x4b')](handleError(_0x541f2a,null));};exports['describe']=function(_0x3de7ea,_0x44a9bd){return db[_0x0c0b('0x34')]['describe']()[_0x0c0b('0x29')](respondWithResult(_0x44a9bd,null))[_0x0c0b('0x4b')](handleError(_0x44a9bd,null));};exports['getMembers']=function(_0x584783,_0x1ea2a0,_0x5e90e6){var _0x565249={'raw':!![],'where':{}},_0x4b22ae={},_0x426654;return db[_0x0c0b('0x34')][_0x0c0b('0x56')]({'where':{'id':_0x584783[_0x0c0b('0x48')]['id']}})['then'](handleEntityNotFound(_0x1ea2a0,null))[_0x0c0b('0x29')](function(_0xdf9055){if(_0xdf9055){_0x426654=_0xdf9055['get']({'plain':!![]});_0x4b22ae['model']=_['keys'](db[_0x0c0b('0x57')]['rawAttributes']);_0x4b22ae[_0x0c0b('0x38')]=_[_0x0c0b('0x39')](_0x584783[_0x0c0b('0x38')]);_0x4b22ae[_0x0c0b('0x3a')]=_['intersection'](_0x4b22ae[_0x0c0b('0x37')],_0x4b22ae['query']);_0x565249['attributes']=_[_0x0c0b('0x3b')](_0x4b22ae[_0x0c0b('0x37')],qs['fields'](_0x584783[_0x0c0b('0x38')]['fields']));_0x565249['attributes']=_0x565249['attributes'][_0x0c0b('0x3e')]?_0x565249['attributes']:_0x4b22ae['model'];if(!_0x584783[_0x0c0b('0x38')]['hasOwnProperty'](_0x0c0b('0x40'))){_0x565249[_0x0c0b('0x25')]=qs[_0x0c0b('0x25')](_0x584783['query']['limit']);_0x565249[_0x0c0b('0x23')]=qs['offset'](_0x584783[_0x0c0b('0x38')][_0x0c0b('0x23')]);}_0x565249[_0x0c0b('0x58')]=qs['sort'](_0x584783[_0x0c0b('0x38')][_0x0c0b('0x41')]);_0x565249[_0x0c0b('0x42')]=qs[_0x0c0b('0x3a')](_[_0x0c0b('0x59')](_0x584783[_0x0c0b('0x38')],_0x4b22ae['filters']));_0x565249['where'][_0x0c0b('0x5a')]=_0xdf9055['id'];if(_0x584783[_0x0c0b('0x38')][_0x0c0b('0x43')]){_0x565249[_0x0c0b('0x42')]=_['merge'](_0x565249[_0x0c0b('0x42')],{'$or':_[_0x0c0b('0x33')](_0x565249['attributes'],function(_0x240139){var _0xd92330={};_0xd92330[_0x240139]={'$like':'%'+_0x584783[_0x0c0b('0x38')][_0x0c0b('0x43')]+'%'};return _0xd92330;})});}_0x565249=_['merge']({},_0x565249,_0x584783[_0x0c0b('0x4a')]);return db[_0x0c0b('0x57')]['findAll'](_0x565249);}})[_0x0c0b('0x29')](function(_0x59ef4a){if(_0x59ef4a){return db[_0x0c0b('0x5b')]['findAndCountAll']({'where':{'id':_[_0x0c0b('0x33')](_0x59ef4a,_0x0c0b('0x5c')),'role':_0x0c0b('0x5d')},'attributes':['id',_0x0c0b('0x30'),'mailPause','updatedAt','createdAt']});}})[_0x0c0b('0x29')](function(_0x4ef475){if(_0x4ef475){return{'count':_0x4ef475[_0x0c0b('0x24')],'rows':_['map'](_0x4ef475[_0x0c0b('0x47')],function(_0x2f7c4f){return{'membername':_0x2f7c4f[_0x0c0b('0x30')],'UserId':_0x2f7c4f['id'],'queue_name':_0x426654[_0x0c0b('0x30')],'MailQueueId':_0x426654['id'],'interface':util[_0x0c0b('0x5e')](_0x0c0b('0x5f'),'SIP',_0x2f7c4f[_0x0c0b('0x30')]),'penalty':0x0,'paused':_0x2f7c4f[_0x0c0b('0x60')],'createdAt':_0x2f7c4f[_0x0c0b('0x61')],'updatedAt':_0x2f7c4f[_0x0c0b('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1ea2a0,_0x565249))['catch'](handleError(_0x1ea2a0,null));};exports[_0x0c0b('0x63')]=function(_0x5ea748,_0x3601f8,_0x453725){var _0x57e964={};var _0x5c4f29={};var _0x520c5f;var _0x619407;return db[_0x0c0b('0x34')]['findOne']({'where':{'id':_0x5ea748[_0x0c0b('0x48')]['id']}})[_0x0c0b('0x29')](handleEntityNotFound(_0x3601f8,null))[_0x0c0b('0x29')](function(_0x489993){if(_0x489993){_0x520c5f=_0x489993;_0x5c4f29['model']=_['keys'](db[_0x0c0b('0x64')][_0x0c0b('0x65')]);_0x5c4f29[_0x0c0b('0x38')]=_['keys'](_0x5ea748['query']);_0x5c4f29[_0x0c0b('0x3a')]=_['intersection'](_0x5c4f29['model'],_0x5c4f29[_0x0c0b('0x38')]);_0x57e964[_0x0c0b('0x3c')]=_[_0x0c0b('0x3b')](_0x5c4f29['model'],qs['fields'](_0x5ea748['query'][_0x0c0b('0x3d')]));_0x57e964[_0x0c0b('0x3c')]=_0x57e964[_0x0c0b('0x3c')][_0x0c0b('0x3e')]?_0x57e964[_0x0c0b('0x3c')]:_0x5c4f29[_0x0c0b('0x37')];_0x57e964[_0x0c0b('0x58')]=qs[_0x0c0b('0x41')](_0x5ea748['query']['sort']);_0x57e964[_0x0c0b('0x42')]=qs[_0x0c0b('0x3a')](_[_0x0c0b('0x59')](_0x5ea748['query'],_0x5c4f29['filters']));if(_0x5ea748['query']['filter']){_0x57e964[_0x0c0b('0x42')]=_['merge'](_0x57e964[_0x0c0b('0x42')],{'$or':_[_0x0c0b('0x33')](_0x57e964['attributes'],function(_0x198de1){var _0x336993={};_0x336993[_0x198de1]={'$like':'%'+_0x5ea748[_0x0c0b('0x38')][_0x0c0b('0x43')]+'%'};return _0x336993;})});}_0x57e964=_[_0x0c0b('0x44')]({},_0x57e964,_0x5ea748[_0x0c0b('0x4a')]);return _0x520c5f['getTeams'](_0x57e964);}})[_0x0c0b('0x29')](function(_0x20bb2b){if(_0x20bb2b){_0x619407=_0x20bb2b[_0x0c0b('0x3e')];if(!_0x5ea748[_0x0c0b('0x38')]['hasOwnProperty'](_0x0c0b('0x40'))){_0x57e964[_0x0c0b('0x25')]=qs[_0x0c0b('0x25')](_0x5ea748['query'][_0x0c0b('0x25')]);_0x57e964['offset']=qs[_0x0c0b('0x23')](_0x5ea748[_0x0c0b('0x38')][_0x0c0b('0x23')]);}return _0x520c5f['getTeams'](_0x57e964);}})[_0x0c0b('0x29')](function(_0x553803){if(_0x553803){return _0x553803?{'count':_0x619407,'rows':_0x553803}:null;}})[_0x0c0b('0x29')](respondWithResult(_0x3601f8,null))['catch'](handleError(_0x3601f8,null));};exports[_0x0c0b('0x66')]=function(_0xab57e9,_0x1a0c74,_0x5955f5){var _0x129eeb=_0xab57e9[_0x0c0b('0x4d')][_0x0c0b('0x67')];return db[_0x0c0b('0x64')]['findAll']({'where':{'id':_0x129eeb},'attributes':['id'],'include':[{'model':db[_0x0c0b('0x5b')],'as':_0x0c0b('0x68'),'attributes':['id',_0x0c0b('0x30'),'online',_0x0c0b('0x69'),_0x0c0b('0x6a')],'raw':!![]}]})[_0x0c0b('0x29')](function(_0x290a03){if(_0x290a03){var _0x447d11=_['flatMap'](_0x290a03,function(_0x7f0aeb){var _0x25c70b=_0x7f0aeb[_0x0c0b('0x2a')]({'plain':!![]});return _0x25c70b[_0x0c0b('0x68')];});return db['MailQueue']['find']({'where':{'id':_0xab57e9[_0x0c0b('0x48')]['id']}})[_0x0c0b('0x29')](function(_0x33e015){return db[_0x0c0b('0x6b')]['transaction'](function(_0x207609){return _0x33e015[_0x0c0b('0x66')](_0x129eeb,{'transaction':_0x207609})[_0x0c0b('0x29')](function(){return BPromise[_0x0c0b('0x6c')](_0x447d11,function(_0x1d256b){return db[_0x0c0b('0x57')][_0x0c0b('0x6d')]({'where':{'UserId':_0x1d256b['id'],'MailQueueId':_0xab57e9[_0x0c0b('0x48')]['id']},'transaction':_0x207609});});})[_0x0c0b('0x29')](function(){_0x447d11[_0x0c0b('0x6e')](function(_0x302ecd){socket[_0x0c0b('0x6f')](_0x0c0b('0x70'),{'UserId':_0x302ecd['id'],'MailQueueId':_0x33e015['id']});});});});});}})['then'](respondWithStatusCode(_0x1a0c74,null))[_0x0c0b('0x4b')](handleError(_0x1a0c74,null));};exports[_0x0c0b('0x71')]=function(_0x439f0e,_0x137670,_0x1e9a76){return db[_0x0c0b('0x64')][_0x0c0b('0x46')]({'where':{'id':_0x439f0e[_0x0c0b('0x38')][_0x0c0b('0x67')]},'attributes':['id'],'include':[{'model':db[_0x0c0b('0x5b')],'as':_0x0c0b('0x68'),'attributes':['id'],'raw':!![]}]})[_0x0c0b('0x29')](handleEntityNotFound(_0x137670,null))['then'](function(_0xcb7bd3){var _0x4887a0=_['map'](_0xcb7bd3,'id');var _0x58528e=[];var _0x1e581a=[];var _0x3433a8=squel['select']();_0x3433a8['field']('tq.TeamId')[_0x0c0b('0x72')](_0x0c0b('0x73'),'tq')[_0x0c0b('0x74')](_0x0c0b('0x75'),'ut',_0x0c0b('0x76'))['where']('MailQueueId\x20=\x20?',_0x439f0e[_0x0c0b('0x48')]['id']);for(var _0x235fcc=0x0;_0x235fcc<_0xcb7bd3['length'];_0x235fcc+=0x1){let _0x41da3a=_0xcb7bd3[_0x235fcc];for(var _0x26a550=0x0;_0x26a550<_0x41da3a[_0x0c0b('0x68')]['length'];_0x26a550+=0x1){let _0x456895=_0x41da3a[_0x0c0b('0x68')][_0x26a550];var _0x1746cc=_0x3433a8[_0x0c0b('0x77')]();_0x1746cc[_0x0c0b('0x42')](_0x0c0b('0x78'),_0x456895['id']);_0x1e581a['push'](db[_0x0c0b('0x6b')]['query'](_0x1746cc[_0x0c0b('0x79')](),{'type':db[_0x0c0b('0x6b')][_0x0c0b('0x7a')][_0x0c0b('0x7b')]})[_0x0c0b('0x29')](function(_0x276acb){if(_0x276acb[_0x0c0b('0x3e')]===0x1){return _0x456895['id'];}else{var _0x305fd6=_[_0x0c0b('0x7c')](_[_0x0c0b('0x33')](_0x276acb,_0x0c0b('0x7d')),function(_0x2b26dc){return _[_0x0c0b('0x7e')](_0x4887a0,_0x2b26dc);});if(_0x305fd6){return _0x456895['id'];}}}));}}return BPromise['all'](_0x1e581a)['then'](function(_0x82c8cf){_0x58528e=_(_0x58528e)[_0x0c0b('0x7f')](_0x82c8cf)[_0x0c0b('0x80')]()['value']();return db[_0x0c0b('0x34')][_0x0c0b('0x52')]({'where':{'id':_0x439f0e[_0x0c0b('0x48')]['id']}})[_0x0c0b('0x29')](function(_0x354df9){return db[_0x0c0b('0x6b')][_0x0c0b('0x81')](function(_0x5be8e5){return _0x354df9[_0x0c0b('0x71')](_0x439f0e[_0x0c0b('0x38')][_0x0c0b('0x67')],{'transaction':_0x5be8e5})['then'](function(){if(!_['isEmpty'](_0x58528e)){return _0x354df9[_0x0c0b('0x82')](_0x58528e,{'transaction':_0x5be8e5});}})['then'](function(){_0x58528e[_0x0c0b('0x6e')](function(_0x60861d){socket['emit'](_0x0c0b('0x83'),{'UserId':_0x60861d,'MailQueueId':_0x354df9['id']});});});});});});})[_0x0c0b('0x29')](respondWithStatusCode(_0x137670,null))[_0x0c0b('0x4b')](handleError(_0x137670,null));};exports['addAgents']=function(_0x2be79f,_0xdbfe31,_0x3ad2db){return db['MailQueue'][_0x0c0b('0x52')]({'where':{'id':_0x2be79f[_0x0c0b('0x48')]['id']}})[_0x0c0b('0x29')](handleEntityNotFound(_0xdbfe31,null))[_0x0c0b('0x29')](function(_0x473330){if(_0x473330){return _0x473330[_0x0c0b('0x84')](_0x2be79f[_0x0c0b('0x4d')][_0x0c0b('0x67')],_['omit'](_0x2be79f[_0x0c0b('0x4d')],[_0x0c0b('0x67'),'id'])||{})['spread'](function(_0x2c926c){for(var _0x394641=0x0;_0x394641<_0x2be79f[_0x0c0b('0x4d')]['ids'][_0x0c0b('0x3e')];_0x394641+=0x1){socket['emit'](_0x0c0b('0x70'),{'UserId':Number(_0x2be79f[_0x0c0b('0x4d')][_0x0c0b('0x67')][_0x394641]),'MailQueueId':Number(_0x2be79f['params']['id'])});}return _0x2c926c;});}})[_0x0c0b('0x29')](respondWithResult(_0xdbfe31,null))[_0x0c0b('0x4b')](handleError(_0xdbfe31,null));};exports[_0x0c0b('0x82')]=function(_0x1da3c6,_0x12b619,_0x1051cb){return db[_0x0c0b('0x34')]['find']({'where':{'id':_0x1da3c6['params']['id']}})[_0x0c0b('0x29')](handleEntityNotFound(_0x12b619,null))[_0x0c0b('0x29')](function(_0x3bac23){if(_0x3bac23){return _0x3bac23[_0x0c0b('0x82')](_0x1da3c6[_0x0c0b('0x38')][_0x0c0b('0x67')])[_0x0c0b('0x29')](function(){if(_[_0x0c0b('0x85')](_0x1da3c6['query'][_0x0c0b('0x67')])){for(var _0x4c8e21=0x0;_0x4c8e21<_0x1da3c6[_0x0c0b('0x38')][_0x0c0b('0x67')][_0x0c0b('0x3e')];_0x4c8e21+=0x1){socket[_0x0c0b('0x6f')](_0x0c0b('0x83'),{'UserId':Number(_0x1da3c6['query'][_0x0c0b('0x67')][_0x4c8e21]),'MailQueueId':Number(_0x1da3c6[_0x0c0b('0x48')]['id'])});}}else{socket['emit'](_0x0c0b('0x83'),{'UserId':Number(_0x1da3c6['query'][_0x0c0b('0x67')]),'MailQueueId':Number(_0x1da3c6[_0x0c0b('0x48')]['id'])});}});}})[_0x0c0b('0x29')](respondWithStatusCode(_0x12b619,null))[_0x0c0b('0x4b')](handleError(_0x12b619,null));};exports[_0x0c0b('0x86')]=function(_0x89e852,_0x4f3561,_0x57b5ee){var _0x3d0c19={};var _0x11fe8e={};var _0x1b557d;var _0x1f8fab;return db[_0x0c0b('0x34')][_0x0c0b('0x56')]({'where':{'id':_0x89e852['params']['id']}})['then'](handleEntityNotFound(_0x4f3561,null))[_0x0c0b('0x29')](function(_0xa34440){if(_0xa34440){_0x1b557d=_0xa34440;_0x11fe8e[_0x0c0b('0x37')]=_[_0x0c0b('0x39')](db[_0x0c0b('0x5b')][_0x0c0b('0x65')]);_0x11fe8e[_0x0c0b('0x38')]=_['keys'](_0x89e852[_0x0c0b('0x38')]);_0x11fe8e[_0x0c0b('0x3a')]=_[_0x0c0b('0x3b')](_0x11fe8e['model'],_0x11fe8e[_0x0c0b('0x38')]);_0x3d0c19[_0x0c0b('0x3c')]=_['intersection'](_0x11fe8e[_0x0c0b('0x37')],qs[_0x0c0b('0x3d')](_0x89e852['query'][_0x0c0b('0x3d')]));_0x3d0c19['attributes']=_0x3d0c19[_0x0c0b('0x3c')]['length']?_0x3d0c19[_0x0c0b('0x3c')]:_0x11fe8e['model'];_0x3d0c19[_0x0c0b('0x58')]=qs[_0x0c0b('0x41')](_0x89e852[_0x0c0b('0x38')]['sort']);_0x3d0c19['where']=qs[_0x0c0b('0x3a')](_[_0x0c0b('0x59')](_0x89e852[_0x0c0b('0x38')],_0x11fe8e[_0x0c0b('0x3a')]));if(_0x89e852[_0x0c0b('0x38')][_0x0c0b('0x43')]){_0x3d0c19[_0x0c0b('0x42')]=_[_0x0c0b('0x44')](_0x3d0c19['where'],{'$or':_[_0x0c0b('0x33')](_0x3d0c19[_0x0c0b('0x3c')],function(_0x521fa0){var _0x4fda7c={};_0x4fda7c[_0x521fa0]={'$like':'%'+_0x89e852[_0x0c0b('0x38')][_0x0c0b('0x43')]+'%'};return _0x4fda7c;})});}_0x3d0c19=_['merge']({},_0x3d0c19,_0x89e852[_0x0c0b('0x4a')]);return _0x1b557d[_0x0c0b('0x86')](_0x3d0c19);}})[_0x0c0b('0x29')](function(_0x1dbf9f){if(_0x1dbf9f){_0x1f8fab=_0x1dbf9f[_0x0c0b('0x3e')];if(!_0x89e852[_0x0c0b('0x38')][_0x0c0b('0x3f')](_0x0c0b('0x40'))){_0x3d0c19[_0x0c0b('0x25')]=qs[_0x0c0b('0x25')](_0x89e852[_0x0c0b('0x38')][_0x0c0b('0x25')]);_0x3d0c19[_0x0c0b('0x23')]=qs[_0x0c0b('0x23')](_0x89e852[_0x0c0b('0x38')][_0x0c0b('0x23')]);}return _0x1b557d[_0x0c0b('0x86')](_0x3d0c19);}})[_0x0c0b('0x29')](function(_0x34b599){if(_0x34b599){return _0x34b599?{'count':_0x1f8fab,'rows':_0x34b599}:null;}})[_0x0c0b('0x29')](respondWithResult(_0x4f3561,null))[_0x0c0b('0x4b')](handleError(_0x4f3561,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 29775ac..645e9ac 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 _0x08be=['events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x3783dd,_0x159064){var _0x5a71d9=function(_0x2484fa){while(--_0x2484fa){_0x3783dd['push'](_0x3783dd['shift']());}};_0x5a71d9(++_0x159064);}(_0x08be,0x183));var _0xe08b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x08be[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xe08b('0x0'));var MailQueue=require(_0xe08b('0x1'))['db'][_0xe08b('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe08b('0x3')](0x0);var events={'afterCreate':_0xe08b('0x4'),'afterUpdate':'update','afterDestroy':_0xe08b('0x5')};function emitEvent(_0xc267a){return function(_0x4515aa,_0xd586c2,_0x4f4e46){MailQueueEvents[_0xe08b('0x6')](_0xc267a+':'+_0x4515aa['id'],_0x4515aa);MailQueueEvents[_0xe08b('0x6')](_0xc267a,_0x4515aa);_0x4f4e46(null);};}for(var e in events){if(events[_0xe08b('0x7')](e)){var event=events[e];MailQueue[_0xe08b('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xf5dc=['exports','events','../../mysqldb','MailQueue','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf5dc,0x189));var _0xcf5d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf5dc[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0xcf5d('0x0'));var MailQueue=require(_0xcf5d('0x1'))['db'][_0xcf5d('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xcf5d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf5d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x161535){return function(_0xf3792d,_0x3c9981,_0x53da0a){MailQueueEvents[_0xcf5d('0x5')](_0x161535+':'+_0xf3792d['id'],_0xf3792d);MailQueueEvents[_0xcf5d('0x5')](_0x161535,_0xf3792d);_0x53da0a(null);};}for(var e in events){if(events[_0xcf5d('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xcf5d('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 7474e99..4926556 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 _0x1ab6=['../../config/logger','api','moment','bluebird','rimraf','./mailQueue.attributes','define','MailQueue','mail_queues','lodash'];(function(_0x47b4b4,_0x1c75ee){var _0x546f72=function(_0xd7fd20){while(--_0xd7fd20){_0x47b4b4['push'](_0x47b4b4['shift']());}};_0x546f72(++_0x1c75ee);}(_0x1ab6,0xbd));var _0x61ab=function(_0x43d016,_0xe5a028){_0x43d016=_0x43d016-0x0;var _0xf45747=_0x1ab6[_0x43d016];return _0xf45747;};'use strict';var _=require(_0x61ab('0x0'));var util=require('util');var logger=require(_0x61ab('0x1'))(_0x61ab('0x2'));var moment=require(_0x61ab('0x3'));var BPromise=require(_0x61ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x61ab('0x5'));var config=require('../../config/environment');var attributes=require(_0x61ab('0x6'));module['exports']=function(_0x19f330,_0x1d02ac){return _0x19f330[_0x61ab('0x7')](_0x61ab('0x8'),attributes,{'tableName':_0x61ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa488=['path','exports','define','mail_queues','lodash','util','../../config/logger','api','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa488,0x13f));var _0x8a48=function(_0x466611,_0x421a63){_0x466611=_0x466611-0x0;var _0x4112c4=_0xa488[_0x466611];return _0x4112c4;};'use strict';var _=require(_0x8a48('0x0'));var util=require(_0x8a48('0x1'));var logger=require(_0x8a48('0x2'))(_0x8a48('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8a48('0x4'));var fs=require('fs');var path=require(_0x8a48('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x8a48('0x6')]=function(_0x25601b,_0x63be2b){return _0x25601b[_0x8a48('0x7')]('MailQueue',attributes,{'tableName':_0x8a48('0x8'),'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 2565ed4..3cbda89 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 _0xa74d=['GetMailQueue','options','raw','attributes','limit','include','map','model','catch','MailQueue','where','ShowMailQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result'];(function(_0x57199a,_0xeee9e2){var _0x352279=function(_0x48b979){while(--_0x48b979){_0x57199a['push'](_0x57199a['shift']());}};_0x352279(++_0xeee9e2);}(_0xa74d,0x1cf));var _0xda74=function(_0x12c9ec,_0x603b97){_0x12c9ec=_0x12c9ec-0x0;var _0x152942=_0xa74d[_0x12c9ec];return _0x152942;};'use strict';var _=require('lodash');var util=require(_0xda74('0x0'));var moment=require(_0xda74('0x1'));var BPromise=require(_0xda74('0x2'));var rs=require(_0xda74('0x3'));var fs=require('fs');var Redis=require(_0xda74('0x4'));var db=require(_0xda74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda74('0x6'))(_0xda74('0x7'));var config=require(_0xda74('0x8'));var jayson=require(_0xda74('0x9'));var client=jayson[_0xda74('0xa')][_0xda74('0xb')]({'port':0x232a});config[_0xda74('0xc')]=_[_0xda74('0xd')](config['redis'],{'host':_0xda74('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xda74('0xf'))[_0xda74('0x10')](socket);function respondWithRpcPromise(_0x4f7fab,_0x3804cc,_0x3f55ac){return new BPromise(function(_0x3180c3,_0x15fd0d){return client[_0xda74('0x11')](_0x4f7fab,_0x3f55ac)[_0xda74('0x12')](function(_0x25a4b4){logger[_0xda74('0x13')]('MailQueue,\x20%s,\x20%s',_0x3804cc,_0xda74('0x14'));logger[_0xda74('0x15')](_0xda74('0x16'),_0x3804cc,'request\x20sent',JSON[_0xda74('0x17')](_0x25a4b4));if(_0x25a4b4[_0xda74('0x18')]){if(_0x25a4b4[_0xda74('0x18')][_0xda74('0x19')]===0x1f4){logger[_0xda74('0x18')](_0xda74('0x1a'),_0x3804cc,_0x25a4b4[_0xda74('0x18')]['message']);return _0x15fd0d(_0x25a4b4[_0xda74('0x18')][_0xda74('0x1b')]);}logger[_0xda74('0x18')](_0xda74('0x1a'),_0x3804cc,_0x25a4b4[_0xda74('0x18')]['message']);return _0x3180c3(_0x25a4b4[_0xda74('0x18')][_0xda74('0x1b')]);}else{logger[_0xda74('0x13')](_0xda74('0x1a'),_0x3804cc,_0xda74('0x14'));_0x3180c3(_0x25a4b4[_0xda74('0x1c')][_0xda74('0x1b')]);}})['catch'](function(_0x260e33){logger[_0xda74('0x18')](_0xda74('0x1a'),_0x3804cc,_0x260e33);_0x15fd0d(_0x260e33);});});}exports[_0xda74('0x1d')]=function(_0xd07402){var _0x3fb049=this;return new Promise(function(_0x2ba203,_0x291dd6){return db['MailQueue']['findAll']({'raw':_0xd07402['options']?_0xd07402[_0xda74('0x1e')][_0xda74('0x1f')]===undefined?!![]:![]:!![],'where':_0xd07402[_0xda74('0x1e')]?_0xd07402[_0xda74('0x1e')]['where']||null:null,'attributes':_0xd07402['options']?_0xd07402[_0xda74('0x1e')][_0xda74('0x20')]||null:null,'limit':_0xd07402[_0xda74('0x1e')]?_0xd07402[_0xda74('0x1e')][_0xda74('0x21')]||null:null,'include':_0xd07402[_0xda74('0x1e')]?_0xd07402[_0xda74('0x1e')][_0xda74('0x22')]?_[_0xda74('0x23')](_0xd07402[_0xda74('0x1e')][_0xda74('0x22')],function(_0x5a01d4){return{'model':db[_0x5a01d4[_0xda74('0x24')]],'as':_0x5a01d4['as'],'attributes':_0x5a01d4[_0xda74('0x20')],'include':_0x5a01d4['include']?_[_0xda74('0x23')](_0x5a01d4[_0xda74('0x22')],function(_0x1e6083){return{'model':db[_0x1e6083[_0xda74('0x24')]],'as':_0x1e6083['as'],'attributes':_0x1e6083[_0xda74('0x20')],'include':_0x1e6083['include']?_['map'](_0x1e6083[_0xda74('0x22')],function(_0x4d0098){return{'model':db[_0x4d0098[_0xda74('0x24')]],'as':_0x4d0098['as'],'attributes':_0x4d0098[_0xda74('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e0bdb){logger['info'](_0xda74('0x1d'),_0xd07402);logger[_0xda74('0x15')](_0xda74('0x1d'),_0xd07402,JSON['stringify'](_0x2e0bdb));_0x2ba203(_0x2e0bdb);})[_0xda74('0x25')](function(_0x46dee0){logger[_0xda74('0x18')](_0xda74('0x1d'),_0x46dee0['message'],_0xd07402);_0x291dd6(_0x3fb049[_0xda74('0x18')](0x1f4,_0x46dee0[_0xda74('0x1b')]));});});};exports['ShowMailQueue']=function(_0xe6b39){var _0x3f7eed=this;return new Promise(function(_0x3560c3,_0x3a076c){return db[_0xda74('0x26')]['find']({'raw':_0xe6b39[_0xda74('0x1e')]?_0xe6b39[_0xda74('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xe6b39['options']?_0xe6b39[_0xda74('0x1e')][_0xda74('0x27')]||null:null,'attributes':_0xe6b39[_0xda74('0x1e')]?_0xe6b39[_0xda74('0x1e')][_0xda74('0x20')]||null:null,'include':_0xe6b39[_0xda74('0x1e')]?_0xe6b39['options'][_0xda74('0x22')]?_[_0xda74('0x23')](_0xe6b39[_0xda74('0x1e')][_0xda74('0x22')],function(_0x3c2214){return{'model':db[_0x3c2214['model']],'as':_0x3c2214['as'],'attributes':_0x3c2214[_0xda74('0x20')],'include':_0x3c2214[_0xda74('0x22')]?_[_0xda74('0x23')](_0x3c2214[_0xda74('0x22')],function(_0x1361b1){return{'model':db[_0x1361b1[_0xda74('0x24')]],'as':_0x1361b1['as'],'attributes':_0x1361b1[_0xda74('0x20')],'include':_0x1361b1[_0xda74('0x22')]?_[_0xda74('0x23')](_0x1361b1[_0xda74('0x22')],function(_0x5b727e){return{'model':db[_0x5b727e[_0xda74('0x24')]],'as':_0x5b727e['as'],'attributes':_0x5b727e[_0xda74('0x20')]};}):[]};}):[]};}):[]:[]})[_0xda74('0x12')](function(_0x75e614){logger[_0xda74('0x13')]('ShowMailQueue',_0xe6b39);logger[_0xda74('0x15')]('ShowMailQueue',_0xe6b39,JSON[_0xda74('0x17')](_0x75e614));_0x3560c3(_0x75e614);})[_0xda74('0x25')](function(_0x3078a9){logger[_0xda74('0x18')](_0xda74('0x28'),_0x3078a9[_0xda74('0x1b')],_0xe6b39);_0x3a076c(_0x3f7eed[_0xda74('0x18')](0x1f4,_0x3078a9[_0xda74('0x1b')]));});});}; \ No newline at end of file +var _0xfaf0=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowMailQueue','stringify'];(function(_0x29b141,_0xb9462){var _0x51e016=function(_0x112679){while(--_0x112679){_0x29b141['push'](_0x29b141['shift']());}};_0x51e016(++_0xb9462);}(_0xfaf0,0x1b8));var _0x0faf=function(_0x1bab51,_0x576951){_0x1bab51=_0x1bab51-0x0;var _0x3b39fa=_0xfaf0[_0x1bab51];return _0x3b39fa;};'use strict';var _=require(_0x0faf('0x0'));var util=require('util');var moment=require(_0x0faf('0x1'));var BPromise=require(_0x0faf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0faf('0x3'));var db=require(_0x0faf('0x4'))['db'];var utils=require(_0x0faf('0x5'));var logger=require('../../config/logger')(_0x0faf('0x6'));var config=require('../../config/environment');var jayson=require(_0x0faf('0x7'));var client=jayson[_0x0faf('0x8')][_0x0faf('0x9')]({'port':0x232a});config[_0x0faf('0xa')]=_['defaults'](config['redis'],{'host':_0x0faf('0xb'),'port':0x18eb});var socket=require(_0x0faf('0xc'))(new Redis(config[_0x0faf('0xa')]));require('./mailQueue.socket')[_0x0faf('0xd')](socket);function respondWithRpcPromise(_0x1fded9,_0x48bc6a,_0xd19f3){return new BPromise(function(_0x416f71,_0x1bd8b2){return client[_0x0faf('0xe')](_0x1fded9,_0xd19f3)['then'](function(_0x54e802){logger[_0x0faf('0xf')](_0x0faf('0x10'),_0x48bc6a,'request\x20sent');logger[_0x0faf('0x11')](_0x0faf('0x12'),_0x48bc6a,_0x0faf('0x13'),JSON['stringify'](_0x54e802));if(_0x54e802[_0x0faf('0x14')]){if(_0x54e802['error'][_0x0faf('0x15')]===0x1f4){logger[_0x0faf('0x14')]('MailQueue,\x20%s,\x20%s',_0x48bc6a,_0x54e802['error'][_0x0faf('0x16')]);return _0x1bd8b2(_0x54e802[_0x0faf('0x14')][_0x0faf('0x16')]);}logger[_0x0faf('0x14')](_0x0faf('0x10'),_0x48bc6a,_0x54e802[_0x0faf('0x14')][_0x0faf('0x16')]);return _0x416f71(_0x54e802['error']['message']);}else{logger[_0x0faf('0xf')](_0x0faf('0x10'),_0x48bc6a,_0x0faf('0x13'));_0x416f71(_0x54e802[_0x0faf('0x17')][_0x0faf('0x16')]);}})[_0x0faf('0x18')](function(_0x1d2e69){logger[_0x0faf('0x14')]('MailQueue,\x20%s,\x20%s',_0x48bc6a,_0x1d2e69);_0x1bd8b2(_0x1d2e69);});});}exports[_0x0faf('0x19')]=function(_0x1401b4){var _0x59801a=this;return new Promise(function(_0x626ea4,_0x3817ce){return db[_0x0faf('0x1a')][_0x0faf('0x1b')]({'raw':_0x1401b4[_0x0faf('0x1c')]?_0x1401b4[_0x0faf('0x1c')][_0x0faf('0x1d')]===undefined?!![]:![]:!![],'where':_0x1401b4['options']?_0x1401b4['options'][_0x0faf('0x1e')]||null:null,'attributes':_0x1401b4[_0x0faf('0x1c')]?_0x1401b4[_0x0faf('0x1c')][_0x0faf('0x1f')]||null:null,'limit':_0x1401b4[_0x0faf('0x1c')]?_0x1401b4[_0x0faf('0x1c')][_0x0faf('0x20')]||null:null,'include':_0x1401b4[_0x0faf('0x1c')]?_0x1401b4['options'][_0x0faf('0x21')]?_[_0x0faf('0x22')](_0x1401b4[_0x0faf('0x1c')][_0x0faf('0x21')],function(_0x5d9b39){return{'model':db[_0x5d9b39[_0x0faf('0x23')]],'as':_0x5d9b39['as'],'attributes':_0x5d9b39[_0x0faf('0x1f')],'include':_0x5d9b39[_0x0faf('0x21')]?_[_0x0faf('0x22')](_0x5d9b39[_0x0faf('0x21')],function(_0x3ca2d3){return{'model':db[_0x3ca2d3[_0x0faf('0x23')]],'as':_0x3ca2d3['as'],'attributes':_0x3ca2d3[_0x0faf('0x1f')],'include':_0x3ca2d3[_0x0faf('0x21')]?_[_0x0faf('0x22')](_0x3ca2d3['include'],function(_0xd2ad1a){return{'model':db[_0xd2ad1a[_0x0faf('0x23')]],'as':_0xd2ad1a['as'],'attributes':_0xd2ad1a[_0x0faf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0faf('0x24')](function(_0x143a96){logger[_0x0faf('0xf')]('GetMailQueue',_0x1401b4);logger[_0x0faf('0x11')]('GetMailQueue',_0x1401b4,JSON['stringify'](_0x143a96));_0x626ea4(_0x143a96);})['catch'](function(_0x3eaed6){logger[_0x0faf('0x14')]('GetMailQueue',_0x3eaed6[_0x0faf('0x16')],_0x1401b4);_0x3817ce(_0x59801a['error'](0x1f4,_0x3eaed6['message']));});});};exports['ShowMailQueue']=function(_0x275249){var _0x2b78ee=this;return new Promise(function(_0x128dd5,_0xd27097){return db['MailQueue'][_0x0faf('0x25')]({'raw':_0x275249[_0x0faf('0x1c')]?_0x275249['options'][_0x0faf('0x1d')]===undefined?!![]:![]:!![],'where':_0x275249[_0x0faf('0x1c')]?_0x275249[_0x0faf('0x1c')][_0x0faf('0x1e')]||null:null,'attributes':_0x275249[_0x0faf('0x1c')]?_0x275249[_0x0faf('0x1c')]['attributes']||null:null,'include':_0x275249[_0x0faf('0x1c')]?_0x275249[_0x0faf('0x1c')][_0x0faf('0x21')]?_['map'](_0x275249['options'][_0x0faf('0x21')],function(_0x1d2cb8){return{'model':db[_0x1d2cb8[_0x0faf('0x23')]],'as':_0x1d2cb8['as'],'attributes':_0x1d2cb8['attributes'],'include':_0x1d2cb8[_0x0faf('0x21')]?_[_0x0faf('0x22')](_0x1d2cb8[_0x0faf('0x21')],function(_0x570551){return{'model':db[_0x570551[_0x0faf('0x23')]],'as':_0x570551['as'],'attributes':_0x570551[_0x0faf('0x1f')],'include':_0x570551[_0x0faf('0x21')]?_['map'](_0x570551[_0x0faf('0x21')],function(_0x3bf560){return{'model':db[_0x3bf560[_0x0faf('0x23')]],'as':_0x3bf560['as'],'attributes':_0x3bf560[_0x0faf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0faf('0x24')](function(_0x4a7237){logger[_0x0faf('0xf')](_0x0faf('0x26'),_0x275249);logger[_0x0faf('0x11')]('ShowMailQueue',_0x275249,JSON[_0x0faf('0x27')](_0x4a7237));_0x128dd5(_0x4a7237);})[_0x0faf('0x18')](function(_0x59d028){logger['error'](_0x0faf('0x26'),_0x59d028[_0x0faf('0x16')],_0x275249);_0xd27097(_0x2b78ee[_0x0faf('0x14')](0x1f4,_0x59d028[_0x0faf('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index d893093..df08a65 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 _0x4bab=['save','remove','update','emit','removeListener','length','./mailQueue.events'];(function(_0x567ea1,_0x3cb026){var _0x20964d=function(_0x2a7102){while(--_0x2a7102){_0x567ea1['push'](_0x567ea1['shift']());}};_0x20964d(++_0x3cb026);}(_0x4bab,0x1d4));var _0xb4ba=function(_0x3d37cc,_0x5b355b){_0x3d37cc=_0x3d37cc-0x0;var _0x36b043=_0x4bab[_0x3d37cc];return _0x36b043;};'use strict';var MailQueueEvents=require(_0xb4ba('0x0'));var events=[_0xb4ba('0x1'),_0xb4ba('0x2'),_0xb4ba('0x3')];function createListener(_0x12cda8,_0x1d9a13){return function(_0x1c53e3){_0x1d9a13[_0xb4ba('0x4')](_0x12cda8,_0x1c53e3);};}function removeListener(_0x2f8195,_0x486621){return function(){MailQueueEvents[_0xb4ba('0x5')](_0x2f8195,_0x486621);};}exports['register']=function(_0xa9ea74){for(var _0x46d2a1=0x0,_0x2c846b=events[_0xb4ba('0x6')];_0x46d2a1<_0x2c846b;_0x46d2a1++){var _0x449c72=events[_0x46d2a1];var _0x1a87fe=createListener('mailQueue:'+_0x449c72,_0xa9ea74);MailQueueEvents['on'](_0x449c72,_0x1a87fe);}}; \ No newline at end of file +var _0x90f7=['save','remove','update','emit','length'];(function(_0x26d7e3,_0x4d5ad8){var _0x5f3ee1=function(_0x399660){while(--_0x399660){_0x26d7e3['push'](_0x26d7e3['shift']());}};_0x5f3ee1(++_0x4d5ad8);}(_0x90f7,0x1d6));var _0x790f=function(_0x13f5a2,_0x435893){_0x13f5a2=_0x13f5a2-0x0;var _0x1c2719=_0x90f7[_0x13f5a2];return _0x1c2719;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x790f('0x0'),_0x790f('0x1'),_0x790f('0x2')];function createListener(_0x2f48a7,_0x2d7e28){return function(_0x448f97){_0x2d7e28[_0x790f('0x3')](_0x2f48a7,_0x448f97);};}function removeListener(_0x1772df,_0x22917c){return function(){MailQueueEvents['removeListener'](_0x1772df,_0x22917c);};}exports['register']=function(_0x2a31d9){for(var _0x3f2d0b=0x0,_0x35ac08=events[_0x790f('0x4')];_0x3f2d0b<_0x35ac08;_0x3f2d0b++){var _0x59de47=events[_0x3f2d0b];var _0x2205ae=createListener('mailQueue:'+_0x59de47,_0x2a31d9);MailQueueEvents['on'](_0x59de47,_0x2205ae);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 44e1325..9163451 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 _0xcd8d=['fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','index','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x43fd4c,_0x1a3efb){var _0x19d45a=function(_0xc1d7bf){while(--_0xc1d7bf){_0x43fd4c['push'](_0x43fd4c['shift']());}};_0x19d45a(++_0x1a3efb);}(_0xcd8d,0x1b0));var _0xdcd8=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0xcd8d[_0x3f465d];return _0x121ad1;};'use strict';var multer=require(_0xdcd8('0x0'));var util=require(_0xdcd8('0x1'));var path=require(_0xdcd8('0x2'));var timeout=require(_0xdcd8('0x3'));var express=require('express');var router=express[_0xdcd8('0x4')]();var fs_extra=require(_0xdcd8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdcd8('0x6'));var config=require('../../config/environment');var controller=require(_0xdcd8('0x7'));router[_0xdcd8('0x8')]('/',auth['isAuthenticated'](),controller[_0xdcd8('0x9')]);router['get']('/describe',auth[_0xdcd8('0xa')](),controller['describe']);router[_0xdcd8('0x8')](_0xdcd8('0xb'),auth[_0xdcd8('0xa')](),controller[_0xdcd8('0xc')]);router[_0xdcd8('0xd')]('/',auth[_0xdcd8('0xa')](),controller['create']);router[_0xdcd8('0xe')](_0xdcd8('0xb'),auth[_0xdcd8('0xa')](),controller[_0xdcd8('0xf')]);router[_0xdcd8('0x10')](_0xdcd8('0xb'),auth[_0xdcd8('0xa')](),controller[_0xdcd8('0x11')]);module[_0xdcd8('0x12')]=router; \ No newline at end of file +var _0xea88=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','multer','express','fs-extra'];(function(_0xa220ed,_0x309883){var _0x5e34e6=function(_0x2edb93){while(--_0x2edb93){_0xa220ed['push'](_0xa220ed['shift']());}};_0x5e34e6(++_0x309883);}(_0xea88,0x189));var _0x8ea8=function(_0x1be76d,_0xcd36b){_0x1be76d=_0x1be76d-0x0;var _0x53f003=_0xea88[_0x1be76d];return _0x53f003;};'use strict';var multer=require(_0x8ea8('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8ea8('0x1'));var router=express['Router']();var fs_extra=require(_0x8ea8('0x2'));var auth=require(_0x8ea8('0x3'));var interaction=require(_0x8ea8('0x4'));var config=require(_0x8ea8('0x5'));var controller=require(_0x8ea8('0x6'));router[_0x8ea8('0x7')]('/',auth['isAuthenticated'](),controller[_0x8ea8('0x8')]);router[_0x8ea8('0x7')](_0x8ea8('0x9'),auth[_0x8ea8('0xa')](),controller[_0x8ea8('0xb')]);router['get'](_0x8ea8('0xc'),auth[_0x8ea8('0xa')](),controller['show']);router[_0x8ea8('0xd')]('/',auth[_0x8ea8('0xa')](),controller[_0x8ea8('0xe')]);router[_0x8ea8('0xf')](_0x8ea8('0xc'),auth['isAuthenticated'](),controller[_0x8ea8('0x10')]);router[_0x8ea8('0x11')](_0x8ea8('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 1cfbb11..99e86d7 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 _0x5b5a=['exports','STRING','DATE','sequelize'];(function(_0x53df58,_0x35160d){var _0x305aef=function(_0x7c52fd){while(--_0x7c52fd){_0x53df58['push'](_0x53df58['shift']());}};_0x305aef(++_0x35160d);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x5c2cfc,_0x225457){_0x5c2cfc=_0x5c2cfc-0x0;var _0x39ef01=_0x5b5a[_0x5c2cfc];return _0x39ef01;};'use strict';var moment=require('moment');var Sequelize=require(_0xa5b5('0x0'));module[_0xa5b5('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa5b5('0x2')]},'joinAt':{'type':Sequelize[_0xa5b5('0x3')]},'leaveAt':{'type':Sequelize[_0xa5b5('0x3')]},'acceptAt':{'type':Sequelize[_0xa5b5('0x3')]},'exitAt':{'type':Sequelize[_0xa5b5('0x3')]},'reason':{'type':Sequelize[_0xa5b5('0x2')]}}; \ No newline at end of file +var _0x0e4f=['STRING','DATE','moment','exports'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x0e4f,0xca));var _0xf0e4=function(_0xf6c153,_0x39b8aa){_0xf6c153=_0xf6c153-0x0;var _0x10c11d=_0x0e4f[_0xf6c153];return _0x10c11d;};'use strict';var moment=require(_0xf0e4('0x0'));var Sequelize=require('sequelize');module[_0xf0e4('0x1')]={'uniqueid':{'type':Sequelize[_0xf0e4('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf0e4('0x3')]},'leaveAt':{'type':Sequelize[_0xf0e4('0x3')]},'acceptAt':{'type':Sequelize[_0xf0e4('0x3')]},'exitAt':{'type':Sequelize[_0xf0e4('0x3')]},'reason':{'type':Sequelize[_0xf0e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 2bcf2d0..5ec0e8c 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 _0x627e=['limit','count','set','reject','save','then','destroy','error','stack','name','index','MailQueueReport','fieldName','key','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','rows','catch','params','fields','length','includeAll','include','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x26f32c,_0x15b8a4){var _0x38f54a=function(_0x2f29fc){while(--_0x2f29fc){_0x26f32c['push'](_0x26f32c['shift']());}};_0x38f54a(++_0x15b8a4);}(_0x627e,0x14a));var _0xe627=function(_0x23aede,_0x4f0fec){_0x23aede=_0x23aede-0x0;var _0x2acd47=_0x627e[_0x23aede];return _0x2acd47;};'use strict';var emlformat=require(_0xe627('0x0'));var rimraf=require(_0xe627('0x1'));var zipdir=require(_0xe627('0x2'));var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require('moment');var BPromise=require(_0xe627('0x5'));var Mustache=require(_0xe627('0x6'));var util=require(_0xe627('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe627('0x8'));var fs=require('fs');var fs_extra=require(_0xe627('0x9'));var _=require(_0xe627('0xa'));var squel=require(_0xe627('0xb'));var crypto=require(_0xe627('0xc'));var jsforce=require(_0xe627('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe627('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe627('0xf'));var authService=require(_0xe627('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x11'));var logger=require(_0xe627('0x12'))(_0xe627('0x13'));var utils=require(_0xe627('0x14'));var config=require(_0xe627('0x15'));var licenseUtil=require(_0xe627('0x16'));var db=require(_0xe627('0x17'))['db'];function respondWithStatusCode(_0x3919be,_0x1922f5){_0x1922f5=_0x1922f5||0xcc;return function(_0x582190){if(_0x582190){return _0x3919be[_0xe627('0x18')](_0x1922f5);}return _0x3919be[_0xe627('0x19')](_0x1922f5)[_0xe627('0x1a')]();};}function respondWithResult(_0x4be370,_0x42dd1c){_0x42dd1c=_0x42dd1c||0xc8;return function(_0x1e2e62){if(_0x1e2e62){return _0x4be370[_0xe627('0x19')](_0x42dd1c)[_0xe627('0x1b')](_0x1e2e62);}};}function respondWithFilteredResult(_0x62896f,_0x6a9a15){return function(_0x271325){if(_0x271325){var _0x54720a=typeof _0x6a9a15[_0xe627('0x1c')]===_0xe627('0x1d')&&typeof _0x6a9a15[_0xe627('0x1e')]===_0xe627('0x1d');var _0x403982=_0x271325[_0xe627('0x1f')];var _0x56559b=_0x54720a?0x0:_0x6a9a15[_0xe627('0x1c')];var _0x538b22=_0x54720a?_0x271325[_0xe627('0x1f')]:_0x6a9a15['offset']+_0x6a9a15[_0xe627('0x1e')];var _0x565213;if(_0x538b22>=_0x403982){_0x538b22=_0x403982;_0x565213=0xc8;}else{_0x565213=0xce;}_0x62896f['status'](_0x565213);return _0x62896f[_0xe627('0x20')]('Content-Range',_0x56559b+'-'+_0x538b22+'/'+_0x403982)[_0xe627('0x1b')](_0x271325);}return null;};}function patchUpdates(_0x3391ce){return function(_0x4adde7){try{jsonpatch['apply'](_0x4adde7,_0x3391ce,!![]);}catch(_0x4ecfa6){return BPromise[_0xe627('0x21')](_0x4ecfa6);}return _0x4adde7[_0xe627('0x22')]();};}function saveUpdates(_0x4e3338,_0x708a8a){return function(_0x33cb27){if(_0x33cb27){return _0x33cb27['update'](_0x4e3338)[_0xe627('0x23')](function(_0x29221b){return _0x29221b;});}return null;};}function removeEntity(_0x52d492,_0x42f3d1){return function(_0x19adbc){if(_0x19adbc){return _0x19adbc[_0xe627('0x24')]()['then'](function(){_0x52d492[_0xe627('0x19')](0xcc)[_0xe627('0x1a')]();});}};}function handleEntityNotFound(_0x1a5081,_0x3ddd8d){return function(_0x4b9ff9){if(!_0x4b9ff9){_0x1a5081[_0xe627('0x18')](0x194);}return _0x4b9ff9;};}function handleError(_0x1fe192,_0x1635a0){_0x1635a0=_0x1635a0||0x1f4;return function(_0x29eb8e){logger[_0xe627('0x25')](_0x29eb8e[_0xe627('0x26')]);if(_0x29eb8e[_0xe627('0x27')]){delete _0x29eb8e[_0xe627('0x27')];}_0x1fe192[_0xe627('0x19')](_0x1635a0)['send'](_0x29eb8e);};}exports[_0xe627('0x28')]=function(_0x5aeba1,_0x5cd7c8){var _0x1e0bd7={},_0xdf63c8={},_0x5799a3={'count':0x0,'rows':[]};var _0x39c23f=_['map'](db[_0xe627('0x29')]['rawAttributes'],function(_0x262253){return{'name':_0x262253[_0xe627('0x2a')],'type':_0x262253['type'][_0xe627('0x2b')]};});_0xdf63c8['model']=_[_0xe627('0x2c')](_0x39c23f,_0xe627('0x27'));_0xdf63c8[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x5aeba1[_0xe627('0x2d')]);_0xdf63c8[_0xe627('0x2f')]=_[_0xe627('0x30')](_0xdf63c8[_0xe627('0x31')],_0xdf63c8[_0xe627('0x2d')]);_0x1e0bd7[_0xe627('0x32')]=_[_0xe627('0x30')](_0xdf63c8['model'],qs['fields'](_0x5aeba1[_0xe627('0x2d')]['fields']));_0x1e0bd7[_0xe627('0x32')]=_0x1e0bd7['attributes']['length']?_0x1e0bd7[_0xe627('0x32')]:_0xdf63c8['model'];if(!_0x5aeba1['query'][_0xe627('0x33')](_0xe627('0x34'))){_0x1e0bd7[_0xe627('0x1e')]=qs['limit'](_0x5aeba1['query']['limit']);_0x1e0bd7[_0xe627('0x1c')]=qs['offset'](_0x5aeba1[_0xe627('0x2d')][_0xe627('0x1c')]);}_0x1e0bd7['order']=qs[_0xe627('0x35')](_0x5aeba1[_0xe627('0x2d')]['sort']);_0x1e0bd7[_0xe627('0x36')]=qs[_0xe627('0x2f')](_[_0xe627('0x37')](_0x5aeba1[_0xe627('0x2d')],_0xdf63c8[_0xe627('0x2f')]),_0x39c23f);if(_0x5aeba1[_0xe627('0x2d')]['filter']){_0x1e0bd7[_0xe627('0x36')]=_['merge'](_0x1e0bd7[_0xe627('0x36')],{'$or':_['map'](_0x39c23f,function(_0xe90eda){if(_0xe90eda[_0xe627('0x38')]!==_0xe627('0x39')){var _0x21a533={};_0x21a533[_0xe90eda[_0xe627('0x27')]]={'$like':'%'+_0x5aeba1[_0xe627('0x2d')][_0xe627('0x3a')]+'%'};return _0x21a533;}})});}_0x1e0bd7=_[_0xe627('0x3b')]({},_0x1e0bd7,_0x5aeba1[_0xe627('0x3c')]);var _0x415a25={'where':_0x1e0bd7[_0xe627('0x36')]};return db[_0xe627('0x29')][_0xe627('0x1f')](_0x415a25)['then'](function(_0x4ddff5){_0x5799a3['count']=_0x4ddff5;if(_0x5aeba1['query']['includeAll']){_0x1e0bd7['include']=[{'all':!![]}];}return db[_0xe627('0x29')]['findAll'](_0x1e0bd7);})[_0xe627('0x23')](function(_0x59cd6a){_0x5799a3[_0xe627('0x3d')]=_0x59cd6a;return _0x5799a3;})[_0xe627('0x23')](respondWithFilteredResult(_0x5cd7c8,_0x1e0bd7))[_0xe627('0x3e')](handleError(_0x5cd7c8,null));};exports['show']=function(_0x58e110,_0x26064c){var _0x5f3374={'raw':!![],'where':{'id':_0x58e110[_0xe627('0x3f')]['id']}},_0x5e352e={};_0x5e352e['model']=_[_0xe627('0x2e')](db['MailQueueReport']['rawAttributes']);_0x5e352e[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x58e110[_0xe627('0x2d')]);_0x5e352e['filters']=_['intersection'](_0x5e352e[_0xe627('0x31')],_0x5e352e['query']);_0x5f3374['attributes']=_[_0xe627('0x30')](_0x5e352e[_0xe627('0x31')],qs[_0xe627('0x40')](_0x58e110[_0xe627('0x2d')][_0xe627('0x40')]));_0x5f3374[_0xe627('0x32')]=_0x5f3374['attributes'][_0xe627('0x41')]?_0x5f3374[_0xe627('0x32')]:_0x5e352e['model'];if(_0x58e110['query'][_0xe627('0x42')]){_0x5f3374[_0xe627('0x43')]=[{'all':!![]}];}_0x5f3374=_[_0xe627('0x3b')]({},_0x5f3374,_0x58e110[_0xe627('0x3c')]);return db[_0xe627('0x29')][_0xe627('0x44')](_0x5f3374)[_0xe627('0x23')](handleEntityNotFound(_0x26064c,null))['then'](respondWithResult(_0x26064c,null))[_0xe627('0x3e')](handleError(_0x26064c,null));};exports['create']=function(_0x648456,_0xcd19f5){return db[_0xe627('0x29')]['create'](_0x648456[_0xe627('0x45')],{})['then'](respondWithResult(_0xcd19f5,0xc9))[_0xe627('0x3e')](handleError(_0xcd19f5,null));};exports[_0xe627('0x46')]=function(_0x375e05,_0x30e057){if(_0x375e05[_0xe627('0x45')]['id']){delete _0x375e05['body']['id'];}return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x375e05[_0xe627('0x3f')]['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x30e057,null))[_0xe627('0x23')](saveUpdates(_0x375e05[_0xe627('0x45')],null))[_0xe627('0x23')](respondWithResult(_0x30e057,null))[_0xe627('0x3e')](handleError(_0x30e057,null));};exports[_0xe627('0x24')]=function(_0x3824da,_0x550b74){return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x3824da['params']['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x550b74,null))[_0xe627('0x23')](removeEntity(_0x550b74,null))['catch'](handleError(_0x550b74,null));};exports[_0xe627('0x47')]=function(_0x3a827e,_0x542a4c){return db[_0xe627('0x29')][_0xe627('0x47')]()['then'](respondWithResult(_0x542a4c,null))[_0xe627('0x3e')](handleError(_0x542a4c,null));}; \ No newline at end of file +var _0x5430=['update','then','destroy','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','save'];(function(_0xe017f7,_0x3725ba){var _0x3f2d4e=function(_0xcf0577){while(--_0xcf0577){_0xe017f7['push'](_0xe017f7['shift']());}};_0x3f2d4e(++_0x3725ba);}(_0x5430,0x10c));var _0x0543=function(_0x3a9f18,_0x1ec7d2){_0x3a9f18=_0x3a9f18-0x0;var _0x125b32=_0x5430[_0x3a9f18];return _0x125b32;};'use strict';var emlformat=require(_0x0543('0x0'));var rimraf=require(_0x0543('0x1'));var zipdir=require(_0x0543('0x2'));var jsonpatch=require(_0x0543('0x3'));var rp=require(_0x0543('0x4'));var moment=require(_0x0543('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0543('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0543('0x7'));var ejs=require(_0x0543('0x8'));var fs=require('fs');var fs_extra=require(_0x0543('0x9'));var _=require(_0x0543('0xa'));var squel=require(_0x0543('0xb'));var crypto=require('crypto');var jsforce=require(_0x0543('0xc'));var deskjs=require(_0x0543('0xd'));var toCsv=require(_0x0543('0x7'));var querystring=require(_0x0543('0xe'));var Papa=require(_0x0543('0xf'));var Redis=require(_0x0543('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0543('0x11'));var as=require(_0x0543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0543('0x13'))(_0x0543('0x14'));var utils=require(_0x0543('0x15'));var config=require(_0x0543('0x16'));var licenseUtil=require(_0x0543('0x17'));var db=require(_0x0543('0x18'))['db'];function respondWithStatusCode(_0x30c54e,_0x27290d){_0x27290d=_0x27290d||0xcc;return function(_0x46d176){if(_0x46d176){return _0x30c54e[_0x0543('0x19')](_0x27290d);}return _0x30c54e[_0x0543('0x1a')](_0x27290d)[_0x0543('0x1b')]();};}function respondWithResult(_0x552980,_0x4f1f2a){_0x4f1f2a=_0x4f1f2a||0xc8;return function(_0x21e9ac){if(_0x21e9ac){return _0x552980['status'](_0x4f1f2a)['json'](_0x21e9ac);}};}function respondWithFilteredResult(_0xcb09df,_0x40fb03){return function(_0x1dff7d){if(_0x1dff7d){var _0x1cfadf=typeof _0x40fb03[_0x0543('0x1c')]==='undefined'&&typeof _0x40fb03[_0x0543('0x1d')]===_0x0543('0x1e');var _0x2dd5cb=_0x1dff7d[_0x0543('0x1f')];var _0x20b396=_0x1cfadf?0x0:_0x40fb03[_0x0543('0x1c')];var _0x577cf0=_0x1cfadf?_0x1dff7d['count']:_0x40fb03[_0x0543('0x1c')]+_0x40fb03['limit'];var _0x50ea84;if(_0x577cf0>=_0x2dd5cb){_0x577cf0=_0x2dd5cb;_0x50ea84=0xc8;}else{_0x50ea84=0xce;}_0xcb09df[_0x0543('0x1a')](_0x50ea84);return _0xcb09df[_0x0543('0x20')](_0x0543('0x21'),_0x20b396+'-'+_0x577cf0+'/'+_0x2dd5cb)['json'](_0x1dff7d);}return null;};}function patchUpdates(_0x3f0452){return function(_0x51c271){try{jsonpatch[_0x0543('0x22')](_0x51c271,_0x3f0452,!![]);}catch(_0x411ec2){return BPromise['reject'](_0x411ec2);}return _0x51c271[_0x0543('0x23')]();};}function saveUpdates(_0x333c72,_0x427919){return function(_0x110060){if(_0x110060){return _0x110060[_0x0543('0x24')](_0x333c72)[_0x0543('0x25')](function(_0x4adba7){return _0x4adba7;});}return null;};}function removeEntity(_0x5979d2,_0x59f1b2){return function(_0xbfe5dc){if(_0xbfe5dc){return _0xbfe5dc[_0x0543('0x26')]()[_0x0543('0x25')](function(){_0x5979d2[_0x0543('0x1a')](0xcc)[_0x0543('0x1b')]();});}};}function handleEntityNotFound(_0x26e500,_0x36d824){return function(_0x17a3de){if(!_0x17a3de){_0x26e500[_0x0543('0x19')](0x194);}return _0x17a3de;};}function handleError(_0xf1eccf,_0x40a261){_0x40a261=_0x40a261||0x1f4;return function(_0x21fc63){logger['error'](_0x21fc63[_0x0543('0x27')]);if(_0x21fc63[_0x0543('0x28')]){delete _0x21fc63[_0x0543('0x28')];}_0xf1eccf['status'](_0x40a261)[_0x0543('0x29')](_0x21fc63);};}exports[_0x0543('0x2a')]=function(_0x41c4a7,_0x10b881){var _0x5dd789={},_0x1732be={},_0x10b9f3={'count':0x0,'rows':[]};var _0x492f60=_['map'](db[_0x0543('0x2b')][_0x0543('0x2c')],function(_0x51d49d){return{'name':_0x51d49d[_0x0543('0x2d')],'type':_0x51d49d[_0x0543('0x2e')][_0x0543('0x2f')]};});_0x1732be[_0x0543('0x30')]=_[_0x0543('0x31')](_0x492f60,_0x0543('0x28'));_0x1732be[_0x0543('0x32')]=_['keys'](_0x41c4a7[_0x0543('0x32')]);_0x1732be['filters']=_[_0x0543('0x33')](_0x1732be[_0x0543('0x30')],_0x1732be[_0x0543('0x32')]);_0x5dd789[_0x0543('0x34')]=_[_0x0543('0x33')](_0x1732be['model'],qs[_0x0543('0x35')](_0x41c4a7['query'][_0x0543('0x35')]));_0x5dd789[_0x0543('0x34')]=_0x5dd789[_0x0543('0x34')][_0x0543('0x36')]?_0x5dd789['attributes']:_0x1732be[_0x0543('0x30')];if(!_0x41c4a7['query'][_0x0543('0x37')](_0x0543('0x38'))){_0x5dd789[_0x0543('0x1d')]=qs[_0x0543('0x1d')](_0x41c4a7[_0x0543('0x32')][_0x0543('0x1d')]);_0x5dd789[_0x0543('0x1c')]=qs[_0x0543('0x1c')](_0x41c4a7[_0x0543('0x32')][_0x0543('0x1c')]);}_0x5dd789['order']=qs[_0x0543('0x39')](_0x41c4a7[_0x0543('0x32')]['sort']);_0x5dd789[_0x0543('0x3a')]=qs['filters'](_[_0x0543('0x3b')](_0x41c4a7[_0x0543('0x32')],_0x1732be['filters']),_0x492f60);if(_0x41c4a7['query'][_0x0543('0x3c')]){_0x5dd789[_0x0543('0x3a')]=_['merge'](_0x5dd789[_0x0543('0x3a')],{'$or':_[_0x0543('0x31')](_0x492f60,function(_0x54543f){if(_0x54543f[_0x0543('0x2e')]!==_0x0543('0x3d')){var _0x3ecd70={};_0x3ecd70[_0x54543f[_0x0543('0x28')]]={'$like':'%'+_0x41c4a7[_0x0543('0x32')]['filter']+'%'};return _0x3ecd70;}})});}_0x5dd789=_['merge']({},_0x5dd789,_0x41c4a7['options']);var _0x486d9c={'where':_0x5dd789[_0x0543('0x3a')]};return db[_0x0543('0x2b')][_0x0543('0x1f')](_0x486d9c)['then'](function(_0xc66396){_0x10b9f3[_0x0543('0x1f')]=_0xc66396;if(_0x41c4a7[_0x0543('0x32')][_0x0543('0x3e')]){_0x5dd789[_0x0543('0x3f')]=[{'all':!![]}];}return db[_0x0543('0x2b')][_0x0543('0x40')](_0x5dd789);})['then'](function(_0x24a891){_0x10b9f3[_0x0543('0x41')]=_0x24a891;return _0x10b9f3;})[_0x0543('0x25')](respondWithFilteredResult(_0x10b881,_0x5dd789))[_0x0543('0x42')](handleError(_0x10b881,null));};exports[_0x0543('0x43')]=function(_0x43b7e8,_0x5bf53d){var _0x53dfb8={'raw':!![],'where':{'id':_0x43b7e8[_0x0543('0x44')]['id']}},_0x44116a={};_0x44116a[_0x0543('0x30')]=_[_0x0543('0x45')](db[_0x0543('0x2b')][_0x0543('0x2c')]);_0x44116a[_0x0543('0x32')]=_[_0x0543('0x45')](_0x43b7e8[_0x0543('0x32')]);_0x44116a['filters']=_['intersection'](_0x44116a[_0x0543('0x30')],_0x44116a[_0x0543('0x32')]);_0x53dfb8['attributes']=_['intersection'](_0x44116a[_0x0543('0x30')],qs[_0x0543('0x35')](_0x43b7e8['query'][_0x0543('0x35')]));_0x53dfb8['attributes']=_0x53dfb8[_0x0543('0x34')][_0x0543('0x36')]?_0x53dfb8['attributes']:_0x44116a['model'];if(_0x43b7e8[_0x0543('0x32')]['includeAll']){_0x53dfb8[_0x0543('0x3f')]=[{'all':!![]}];}_0x53dfb8=_[_0x0543('0x46')]({},_0x53dfb8,_0x43b7e8[_0x0543('0x47')]);return db[_0x0543('0x2b')][_0x0543('0x48')](_0x53dfb8)[_0x0543('0x25')](handleEntityNotFound(_0x5bf53d,null))['then'](respondWithResult(_0x5bf53d,null))[_0x0543('0x42')](handleError(_0x5bf53d,null));};exports[_0x0543('0x49')]=function(_0xb8076c,_0xf0a28f){return db[_0x0543('0x2b')]['create'](_0xb8076c[_0x0543('0x4a')],{})['then'](respondWithResult(_0xf0a28f,0xc9))[_0x0543('0x42')](handleError(_0xf0a28f,null));};exports[_0x0543('0x24')]=function(_0x3f4c40,_0x46d398){if(_0x3f4c40[_0x0543('0x4a')]['id']){delete _0x3f4c40[_0x0543('0x4a')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x3f4c40['params']['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x46d398,null))[_0x0543('0x25')](saveUpdates(_0x3f4c40['body'],null))[_0x0543('0x25')](respondWithResult(_0x46d398,null))[_0x0543('0x42')](handleError(_0x46d398,null));};exports[_0x0543('0x26')]=function(_0x3d3bfc,_0x90dd22){return db[_0x0543('0x2b')]['find']({'where':{'id':_0x3d3bfc[_0x0543('0x44')]['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x90dd22,null))[_0x0543('0x25')](removeEntity(_0x90dd22,null))[_0x0543('0x42')](handleError(_0x90dd22,null));};exports[_0x0543('0x4b')]=function(_0x449150,_0x265bc1){return db[_0x0543('0x2b')][_0x0543('0x4b')]()[_0x0543('0x25')](respondWithResult(_0x265bc1,null))[_0x0543('0x42')](handleError(_0x265bc1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index d57af55..8790383 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 _0xa9e4=['rimraf','../../config/environment','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x969ba4,_0x3d80f9){var _0xebf7bd=function(_0x3d891d){while(--_0x3d891d){_0x969ba4['push'](_0x969ba4['shift']());}};_0xebf7bd(++_0x3d80f9);}(_0xa9e4,0x89));var _0x4a9e=function(_0x3880ed,_0x27d5af){_0x3880ed=_0x3880ed-0x0;var _0x43ae75=_0xa9e4[_0x3880ed];return _0x43ae75;};'use strict';var _=require(_0x4a9e('0x0'));var util=require(_0x4a9e('0x1'));var logger=require(_0x4a9e('0x2'))(_0x4a9e('0x3'));var moment=require(_0x4a9e('0x4'));var BPromise=require(_0x4a9e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a9e('0x6'));var rimraf=require(_0x4a9e('0x7'));var config=require(_0x4a9e('0x8'));var attributes=require('./mailQueueReport.attributes');module[_0x4a9e('0x9')]=function(_0xa541ce,_0x2cb9a4){return _0xa541ce[_0x4a9e('0xa')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b4a=['moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','../../config/logger','api'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x0b4a,0x1c6));var _0xa0b4=function(_0x2b24db,_0x39ced1){_0x2b24db=_0x2b24db-0x0;var _0x5ad545=_0x0b4a[_0x2b24db];return _0x5ad545;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa0b4('0x0'))(_0xa0b4('0x1'));var moment=require(_0xa0b4('0x2'));var BPromise=require(_0xa0b4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0b4('0x4'));var rimraf=require(_0xa0b4('0x5'));var config=require(_0xa0b4('0x6'));var attributes=require(_0xa0b4('0x7'));module[_0xa0b4('0x8')]=function(_0xec55c6,_0x5cfd89){return _0xec55c6['define'](_0xa0b4('0x9'),attributes,{'tableName':_0xa0b4('0xa'),'paranoid':![],'indexes':[{'name':_0xa0b4('0xb'),'fields':[_0xa0b4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index b040dcd..71c1e24 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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x699c68,_0x3c7a67){var _0x4bf728=function(_0x575d9b){while(--_0x575d9b){_0x699c68['push'](_0x699c68['shift']());}};_0x4bf728(++_0x3c7a67);}(_0x326f,0xd1));var _0xf326=function(_0x3414c3,_0x55897c){_0x3414c3=_0x3414c3-0x0;var _0x2d44ef=_0x326f[_0x3414c3];return _0x2d44ef;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x3e5bf1,_0x3f764f){var _0x13da95=function(_0x1f34da){while(--_0x1f34da){_0x3e5bf1['push'](_0x3e5bf1['shift']());}};_0x13da95(++_0x3f764f);}(_0x7a54,0x106));var _0x47a5=function(_0x357699,_0x4dccc5){_0x357699=_0x357699-0x0;var _0xc4bda=_0x7a54[_0x357699];return _0xc4bda;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=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')]('CreateMailQueueReport',_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')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 84f9bbb..d264b1b 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3810a2,_0x545ecd){var _0x14f6cf=function(_0x4879e3){while(--_0x4879e3){_0x3810a2['push'](_0x3810a2['shift']());}};_0x14f6cf(++_0x545ecd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x463e4d,_0x3607f5){var _0x20185c=function(_0x53b50a){while(--_0x53b50a){_0x463e4d['push'](_0x463e4d['shift']());}};_0x20185c(++_0x3607f5);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 183e6a6..e24c183 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 _0xa9fa=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x2ceac2,_0x42fbca){var _0x3c47b7=function(_0x1bc4ec){while(--_0x1bc4ec){_0x2ceac2['push'](_0x2ceac2['shift']());}};_0x3c47b7(++_0x42fbca);}(_0xa9fa,0x1e2));var _0xaa9f=function(_0x50fd5d,_0x55fdab){_0x50fd5d=_0x50fd5d-0x0;var _0xc066c8=_0xa9fa[_0x50fd5d];return _0xc066c8;};'use strict';var Sequelize=require(_0xaa9f('0x0'));module[_0xaa9f('0x1')]={'description':{'type':Sequelize[_0xaa9f('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaa9f('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaa9f('0x4')]},'tls':{'type':Sequelize[_0xaa9f('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xaa9f('0x5')},'connTimeout':{'type':Sequelize[_0xaa9f('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xaa9f('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xaa9f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x29b1=['INBOX','BOOLEAN','exports','STRING','INTEGER'];(function(_0x560539,_0x5d73f3){var _0x52ad14=function(_0x268077){while(--_0x268077){_0x560539['push'](_0x560539['shift']());}};_0x52ad14(++_0x5d73f3);}(_0x29b1,0xbb));var _0x129b=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x29b1[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require('sequelize');module[_0x129b('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x129b('0x1')]},'password':{'type':Sequelize[_0x129b('0x1')]},'port':{'type':Sequelize[_0x129b('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x129b('0x1')],'defaultValue':_0x129b('0x3')},'connTimeout':{'type':Sequelize[_0x129b('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x129b('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x129b('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index e25afae..7df52be 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 _0xf471=['mail_servers_in','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./mailServerIn.attributes','define','MailServerIn'];(function(_0x4b1233,_0xd1440c){var _0x46d0da=function(_0x12ee8c){while(--_0x12ee8c){_0x4b1233['push'](_0x4b1233['shift']());}};_0x46d0da(++_0xd1440c);}(_0xf471,0x1c4));var _0x1f47=function(_0x192833,_0x3880d1){_0x192833=_0x192833-0x0;var _0x32d5ee=_0xf471[_0x192833];return _0x32d5ee;};'use strict';var _=require(_0x1f47('0x0'));var util=require(_0x1f47('0x1'));var logger=require(_0x1f47('0x2'))('api');var moment=require(_0x1f47('0x3'));var BPromise=require(_0x1f47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f47('0x5'));var rimraf=require('rimraf');var config=require(_0x1f47('0x6'));var attributes=require(_0x1f47('0x7'));module['exports']=function(_0x3daa52,_0x46c365){return _0x3daa52[_0x1f47('0x8')](_0x1f47('0x9'),attributes,{'tableName':_0x1f47('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf35=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','util','../../config/logger'];(function(_0x3f4564,_0x5b4427){var _0x3c560f=function(_0x465009){while(--_0x465009){_0x3f4564['push'](_0x3f4564['shift']());}};_0x3c560f(++_0x5b4427);}(_0xdf35,0x8d));var _0x5df3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdf35[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x5df3('0x0'));var logger=require(_0x5df3('0x1'))(_0x5df3('0x2'));var moment=require(_0x5df3('0x3'));var BPromise=require(_0x5df3('0x4'));var rp=require(_0x5df3('0x5'));var fs=require('fs');var path=require(_0x5df3('0x6'));var rimraf=require(_0x5df3('0x7'));var config=require(_0x5df3('0x8'));var attributes=require('./mailServerIn.attributes');module[_0x5df3('0x9')]=function(_0x1c14ea,_0x5562cc){return _0x1c14ea[_0x5df3('0xa')](_0x5df3('0xb'),attributes,{'tableName':_0x5df3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 85cb712..1387b46 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 _0x902b=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','findAll','options','raw','attributes','limit','include','map','model','GetMailServerIn','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x5eb1b7,_0x5075ab){var _0x147118=function(_0x51e4fc){while(--_0x51e4fc){_0x5eb1b7['push'](_0x5eb1b7['shift']());}};_0x147118(++_0x5075ab);}(_0x902b,0x6a));var _0xb902=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x902b[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xb902('0x0'));var util=require('util');var moment=require(_0xb902('0x1'));var BPromise=require(_0xb902('0x2'));var rs=require(_0xb902('0x3'));var fs=require('fs');var Redis=require(_0xb902('0x4'));var db=require(_0xb902('0x5'))['db'];var utils=require(_0xb902('0x6'));var logger=require('../../config/logger')(_0xb902('0x7'));var config=require('../../config/environment');var jayson=require(_0xb902('0x8'));var client=jayson['client'][_0xb902('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e7240,_0x49f60d,_0x5b0b74){return new BPromise(function(_0x55331d,_0x534c79){return client[_0xb902('0xa')](_0x5e7240,_0x5b0b74)[_0xb902('0xb')](function(_0x573fa5){logger['info'](_0xb902('0xc'),_0x49f60d,_0xb902('0xd'));logger[_0xb902('0xe')](_0xb902('0xf'),_0x49f60d,_0xb902('0xd'),JSON[_0xb902('0x10')](_0x573fa5));if(_0x573fa5[_0xb902('0x11')]){if(_0x573fa5[_0xb902('0x11')]['code']===0x1f4){logger[_0xb902('0x11')](_0xb902('0xc'),_0x49f60d,_0x573fa5[_0xb902('0x11')][_0xb902('0x12')]);return _0x534c79(_0x573fa5['error']['message']);}logger[_0xb902('0x11')](_0xb902('0xc'),_0x49f60d,_0x573fa5['error'][_0xb902('0x12')]);return _0x55331d(_0x573fa5[_0xb902('0x11')][_0xb902('0x12')]);}else{logger[_0xb902('0x13')](_0xb902('0xc'),_0x49f60d,_0xb902('0xd'));_0x55331d(_0x573fa5['result'][_0xb902('0x12')]);}})[_0xb902('0x14')](function(_0x32d4c1){logger[_0xb902('0x11')](_0xb902('0xc'),_0x49f60d,_0x32d4c1);_0x534c79(_0x32d4c1);});});}exports['GetMailServerIn']=function(_0x10bd3a){var _0x15fda2=this;return new Promise(function(_0x271218,_0x22e859){return db['MailServerIn'][_0xb902('0x15')]({'raw':_0x10bd3a['options']?_0x10bd3a[_0xb902('0x16')][_0xb902('0x17')]===undefined?!![]:![]:!![],'where':_0x10bd3a[_0xb902('0x16')]?_0x10bd3a['options']['where']||null:null,'attributes':_0x10bd3a[_0xb902('0x16')]?_0x10bd3a[_0xb902('0x16')][_0xb902('0x18')]||null:null,'limit':_0x10bd3a['options']?_0x10bd3a[_0xb902('0x16')][_0xb902('0x19')]||null:null,'include':_0x10bd3a[_0xb902('0x16')]?_0x10bd3a[_0xb902('0x16')][_0xb902('0x1a')]?_[_0xb902('0x1b')](_0x10bd3a[_0xb902('0x16')][_0xb902('0x1a')],function(_0xcd806b){return{'model':db[_0xcd806b[_0xb902('0x1c')]],'as':_0xcd806b['as'],'attributes':_0xcd806b['attributes'],'include':_0xcd806b[_0xb902('0x1a')]?_[_0xb902('0x1b')](_0xcd806b[_0xb902('0x1a')],function(_0x4fdd9c){return{'model':db[_0x4fdd9c[_0xb902('0x1c')]],'as':_0x4fdd9c['as'],'attributes':_0x4fdd9c['attributes'],'include':_0x4fdd9c[_0xb902('0x1a')]?_[_0xb902('0x1b')](_0x4fdd9c['include'],function(_0x447e06){return{'model':db[_0x447e06[_0xb902('0x1c')]],'as':_0x447e06['as'],'attributes':_0x447e06[_0xb902('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb902('0xb')](function(_0x51b93b){logger[_0xb902('0x13')](_0xb902('0x1d'),_0x10bd3a);logger[_0xb902('0xe')]('GetMailServerIn',_0x10bd3a,JSON[_0xb902('0x10')](_0x51b93b));_0x271218(_0x51b93b);})[_0xb902('0x14')](function(_0xdb81){logger['error']('GetMailServerIn',_0xdb81[_0xb902('0x12')],_0x10bd3a);_0x22e859(_0x15fda2[_0xb902('0x11')](0x1f4,_0xdb81[_0xb902('0x12')]));});});}; \ No newline at end of file +var _0x6865=['../../config/environment','jayson/promise','client','http','request','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','limit','include','map','model','attributes','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x58bba8,_0x213d48){var _0x110a16=function(_0x5af1c7){while(--_0x5af1c7){_0x58bba8['push'](_0x58bba8['shift']());}};_0x110a16(++_0x213d48);}(_0x6865,0xa7));var _0x5686=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6865[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x5686('0x0'));var moment=require(_0x5686('0x1'));var BPromise=require(_0x5686('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5686('0x3'));var db=require(_0x5686('0x4'))['db'];var utils=require(_0x5686('0x5'));var logger=require(_0x5686('0x6'))(_0x5686('0x7'));var config=require(_0x5686('0x8'));var jayson=require(_0x5686('0x9'));var client=jayson[_0x5686('0xa')][_0x5686('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f86db,_0x53ff16,_0x2a15c9){return new BPromise(function(_0x3371e9,_0x272ccc){return client[_0x5686('0xc')](_0x4f86db,_0x2a15c9)[_0x5686('0xd')](function(_0x4104ac){logger[_0x5686('0xe')]('MailServerIn,\x20%s,\x20%s',_0x53ff16,'request\x20sent');logger[_0x5686('0xf')](_0x5686('0x10'),_0x53ff16,_0x5686('0x11'),JSON['stringify'](_0x4104ac));if(_0x4104ac[_0x5686('0x12')]){if(_0x4104ac[_0x5686('0x12')][_0x5686('0x13')]===0x1f4){logger['error'](_0x5686('0x14'),_0x53ff16,_0x4104ac[_0x5686('0x12')][_0x5686('0x15')]);return _0x272ccc(_0x4104ac[_0x5686('0x12')][_0x5686('0x15')]);}logger['error'](_0x5686('0x14'),_0x53ff16,_0x4104ac['error'][_0x5686('0x15')]);return _0x3371e9(_0x4104ac[_0x5686('0x12')][_0x5686('0x15')]);}else{logger[_0x5686('0xe')](_0x5686('0x14'),_0x53ff16,_0x5686('0x11'));_0x3371e9(_0x4104ac[_0x5686('0x16')][_0x5686('0x15')]);}})[_0x5686('0x17')](function(_0x23c453){logger['error'](_0x5686('0x14'),_0x53ff16,_0x23c453);_0x272ccc(_0x23c453);});});}exports[_0x5686('0x18')]=function(_0x14c19e){var _0x40c2e6=this;return new Promise(function(_0x32fe3a,_0x364e78){return db[_0x5686('0x19')][_0x5686('0x1a')]({'raw':_0x14c19e['options']?_0x14c19e[_0x5686('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x14c19e['options']?_0x14c19e[_0x5686('0x1b')][_0x5686('0x1c')]||null:null,'attributes':_0x14c19e[_0x5686('0x1b')]?_0x14c19e[_0x5686('0x1b')]['attributes']||null:null,'limit':_0x14c19e[_0x5686('0x1b')]?_0x14c19e[_0x5686('0x1b')][_0x5686('0x1d')]||null:null,'include':_0x14c19e[_0x5686('0x1b')]?_0x14c19e[_0x5686('0x1b')][_0x5686('0x1e')]?_[_0x5686('0x1f')](_0x14c19e[_0x5686('0x1b')][_0x5686('0x1e')],function(_0x36c1e3){return{'model':db[_0x36c1e3[_0x5686('0x20')]],'as':_0x36c1e3['as'],'attributes':_0x36c1e3[_0x5686('0x21')],'include':_0x36c1e3[_0x5686('0x1e')]?_[_0x5686('0x1f')](_0x36c1e3[_0x5686('0x1e')],function(_0x516e46){return{'model':db[_0x516e46[_0x5686('0x20')]],'as':_0x516e46['as'],'attributes':_0x516e46['attributes'],'include':_0x516e46[_0x5686('0x1e')]?_[_0x5686('0x1f')](_0x516e46[_0x5686('0x1e')],function(_0x3d50bd){return{'model':db[_0x3d50bd[_0x5686('0x20')]],'as':_0x3d50bd['as'],'attributes':_0x3d50bd[_0x5686('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5686('0xd')](function(_0x1d18ff){logger[_0x5686('0xe')](_0x5686('0x18'),_0x14c19e);logger[_0x5686('0xf')](_0x5686('0x18'),_0x14c19e,JSON[_0x5686('0x22')](_0x1d18ff));_0x32fe3a(_0x1d18ff);})[_0x5686('0x17')](function(_0x2184e3){logger[_0x5686('0x12')]('GetMailServerIn',_0x2184e3[_0x5686('0x15')],_0x14c19e);_0x364e78(_0x40c2e6[_0x5686('0x12')](0x1f4,_0x2184e3[_0x5686('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index e51cb15..2498b07 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x503e0e,_0x57ac51){_0x503e0e=_0x503e0e-0x0;var _0x52a808=_0x7a54[_0x503e0e];return _0x52a808;};'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(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7a54,0x106));var _0x47a5=function(_0x22a281,_0x21f9fa){_0x22a281=_0x22a281-0x0;var _0x374286=_0x7a54[_0x22a281];return _0x374286;};'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 2fb2027..802f6ad 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 _0x087b=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x3829c4,_0x5b720c){var _0x40d453=function(_0x14817b){while(--_0x14817b){_0x3829c4['push'](_0x3829c4['shift']());}};_0x40d453(++_0x5b720c);}(_0x087b,0x11a));var _0xb087=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x087b[_0x307d86];return _0x361745;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xb087('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xb087('0x3')]},'secure':{'type':Sequelize[_0xb087('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xb087('0x2')]},'authentication':{'type':Sequelize[_0xb087('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xb087('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xc788=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x204178,_0x5d30a7){var _0x460ba5=function(_0x49e957){while(--_0x49e957){_0x204178['push'](_0x204178['shift']());}};_0x460ba5(++_0x5d30a7);}(_0xc788,0xc4));var _0x8c78=function(_0x19017b,_0x56d52c){_0x19017b=_0x19017b-0x0;var _0x3becdc=_0xc788[_0x19017b];return _0x3becdc;};'use strict';var Sequelize=require(_0x8c78('0x0'));module[_0x8c78('0x1')]={'description':{'type':Sequelize[_0x8c78('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x8c78('0x2')]},'port':{'type':Sequelize[_0x8c78('0x3')]},'secure':{'type':Sequelize[_0x8c78('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x8c78('0x2')]},'authentication':{'type':Sequelize[_0x8c78('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index dd9904e..24168d8 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 _0xe78f=['ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','MailServerOut','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv'];(function(_0x1877d0,_0x4fc2ec){var _0x5d5778=function(_0x34e1c2){while(--_0x34e1c2){_0x1877d0['push'](_0x1877d0['shift']());}};_0x5d5778(++_0x4fc2ec);}(_0xe78f,0x8b));var _0xfe78=function(_0x1d6cbc,_0x13b298){_0x1d6cbc=_0x1d6cbc-0x0;var _0x3e1ba3=_0xe78f[_0x1d6cbc];return _0x3e1ba3;};'use strict';var emlformat=require(_0xfe78('0x0'));var rimraf=require(_0xfe78('0x1'));var zipdir=require(_0xfe78('0x2'));var jsonpatch=require(_0xfe78('0x3'));var rp=require(_0xfe78('0x4'));var moment=require(_0xfe78('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfe78('0x6'));var sox=require(_0xfe78('0x7'));var csv=require(_0xfe78('0x8'));var ejs=require(_0xfe78('0x9'));var fs=require('fs');var fs_extra=require(_0xfe78('0xa'));var _=require(_0xfe78('0xb'));var squel=require(_0xfe78('0xc'));var crypto=require('crypto');var jsforce=require(_0xfe78('0xd'));var deskjs=require(_0xfe78('0xe'));var toCsv=require(_0xfe78('0x8'));var querystring=require('querystring');var Papa=require(_0xfe78('0xf'));var Redis=require(_0xfe78('0x10'));var authService=require(_0xfe78('0x11'));var qs=require(_0xfe78('0x12'));var as=require(_0xfe78('0x13'));var hardwareService=require(_0xfe78('0x14'));var logger=require(_0xfe78('0x15'))(_0xfe78('0x16'));var utils=require('../../config/utils');var config=require(_0xfe78('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe78('0x18'))['db'];function respondWithStatusCode(_0x385145,_0x5b85b7){_0x5b85b7=_0x5b85b7||0xcc;return function(_0x129cb0){if(_0x129cb0){return _0x385145[_0xfe78('0x19')](_0x5b85b7);}return _0x385145['status'](_0x5b85b7)[_0xfe78('0x1a')]();};}function respondWithResult(_0x3952c2,_0x3a5dfb){_0x3a5dfb=_0x3a5dfb||0xc8;return function(_0x25352a){if(_0x25352a){return _0x3952c2[_0xfe78('0x1b')](_0x3a5dfb)[_0xfe78('0x1c')](_0x25352a);}};}function respondWithFilteredResult(_0x468e97,_0x2021e1){return function(_0x55672a){if(_0x55672a){var _0x598d5d=typeof _0x2021e1[_0xfe78('0x1d')]==='undefined'&&typeof _0x2021e1[_0xfe78('0x1e')]===_0xfe78('0x1f');var _0x17c870=_0x55672a['count'];var _0x48b0fb=_0x598d5d?0x0:_0x2021e1['offset'];var _0x6dc79f=_0x598d5d?_0x55672a[_0xfe78('0x20')]:_0x2021e1[_0xfe78('0x1d')]+_0x2021e1['limit'];var _0x141d39;if(_0x6dc79f>=_0x17c870){_0x6dc79f=_0x17c870;_0x141d39=0xc8;}else{_0x141d39=0xce;}_0x468e97[_0xfe78('0x1b')](_0x141d39);return _0x468e97['set'](_0xfe78('0x21'),_0x48b0fb+'-'+_0x6dc79f+'/'+_0x17c870)[_0xfe78('0x1c')](_0x55672a);}return null;};}function patchUpdates(_0x5a03af){return function(_0x3bfbfe){try{jsonpatch[_0xfe78('0x22')](_0x3bfbfe,_0x5a03af,!![]);}catch(_0x5bbdbb){return BPromise[_0xfe78('0x23')](_0x5bbdbb);}return _0x3bfbfe[_0xfe78('0x24')]();};}function saveUpdates(_0x3afe9b,_0x45dcdb){return function(_0x1c28b2){if(_0x1c28b2){return _0x1c28b2[_0xfe78('0x25')](_0x3afe9b)[_0xfe78('0x26')](function(_0x1023f2){return _0x1023f2;});}return null;};}function removeEntity(_0x2e7c41,_0x204ec9){return function(_0x14a21f){if(_0x14a21f){return _0x14a21f[_0xfe78('0x27')]()[_0xfe78('0x26')](function(){_0x2e7c41[_0xfe78('0x1b')](0xcc)[_0xfe78('0x1a')]();});}};}function handleEntityNotFound(_0x98ba3b,_0x3cff69){return function(_0x13a4ba){if(!_0x13a4ba){_0x98ba3b[_0xfe78('0x19')](0x194);}return _0x13a4ba;};}function handleError(_0x3b46e9,_0x29b52a){_0x29b52a=_0x29b52a||0x1f4;return function(_0x32ec63){logger[_0xfe78('0x28')](_0x32ec63['stack']);if(_0x32ec63[_0xfe78('0x29')]){delete _0x32ec63[_0xfe78('0x29')];}_0x3b46e9[_0xfe78('0x1b')](_0x29b52a)[_0xfe78('0x2a')](_0x32ec63);};}exports['index']=function(_0x1c8df1,_0x58a455){var _0x2d3846={},_0x5bdc5e={},_0x2c54fb={'count':0x0,'rows':[]};var _0x5fc2c0=_[_0xfe78('0x2b')](db[_0xfe78('0x2c')][_0xfe78('0x2d')],function(_0x193748){return{'name':_0x193748[_0xfe78('0x2e')],'type':_0x193748['type']['key']};});_0x5bdc5e[_0xfe78('0x2f')]=_[_0xfe78('0x2b')](_0x5fc2c0,_0xfe78('0x29'));_0x5bdc5e[_0xfe78('0x30')]=_[_0xfe78('0x31')](_0x1c8df1['query']);_0x5bdc5e[_0xfe78('0x32')]=_['intersection'](_0x5bdc5e[_0xfe78('0x2f')],_0x5bdc5e[_0xfe78('0x30')]);_0x2d3846['attributes']=_[_0xfe78('0x33')](_0x5bdc5e['model'],qs[_0xfe78('0x34')](_0x1c8df1[_0xfe78('0x30')][_0xfe78('0x34')]));_0x2d3846[_0xfe78('0x35')]=_0x2d3846[_0xfe78('0x35')][_0xfe78('0x36')]?_0x2d3846['attributes']:_0x5bdc5e[_0xfe78('0x2f')];if(!_0x1c8df1[_0xfe78('0x30')][_0xfe78('0x37')](_0xfe78('0x38'))){_0x2d3846[_0xfe78('0x1e')]=qs[_0xfe78('0x1e')](_0x1c8df1['query'][_0xfe78('0x1e')]);_0x2d3846[_0xfe78('0x1d')]=qs[_0xfe78('0x1d')](_0x1c8df1['query']['offset']);}_0x2d3846[_0xfe78('0x39')]=qs[_0xfe78('0x3a')](_0x1c8df1[_0xfe78('0x30')][_0xfe78('0x3a')]);_0x2d3846[_0xfe78('0x3b')]=qs[_0xfe78('0x32')](_['pick'](_0x1c8df1['query'],_0x5bdc5e[_0xfe78('0x32')]),_0x5fc2c0);if(_0x1c8df1['query'][_0xfe78('0x3c')]){_0x2d3846[_0xfe78('0x3b')]=_[_0xfe78('0x3d')](_0x2d3846[_0xfe78('0x3b')],{'$or':_['map'](_0x5fc2c0,function(_0x38f4bd){if(_0x38f4bd[_0xfe78('0x3e')]!==_0xfe78('0x3f')){var _0x11c479={};_0x11c479[_0x38f4bd['name']]={'$like':'%'+_0x1c8df1[_0xfe78('0x30')][_0xfe78('0x3c')]+'%'};return _0x11c479;}})});}_0x2d3846=_[_0xfe78('0x3d')]({},_0x2d3846,_0x1c8df1['options']);var _0xabd5c5={'where':_0x2d3846[_0xfe78('0x3b')]};return db['MailServerOut'][_0xfe78('0x20')](_0xabd5c5)['then'](function(_0x293209){_0x2c54fb[_0xfe78('0x20')]=_0x293209;if(_0x1c8df1[_0xfe78('0x30')][_0xfe78('0x40')]){_0x2d3846[_0xfe78('0x41')]=[{'all':!![]}];}return db[_0xfe78('0x2c')][_0xfe78('0x42')](_0x2d3846);})[_0xfe78('0x26')](function(_0xe50445){_0x2c54fb[_0xfe78('0x43')]=_0xe50445;return _0x2c54fb;})[_0xfe78('0x26')](respondWithFilteredResult(_0x58a455,_0x2d3846))[_0xfe78('0x44')](handleError(_0x58a455,null));};exports[_0xfe78('0x45')]=function(_0x8036af,_0x4edf84){var _0x503e88={'raw':!![],'where':{'id':_0x8036af['params']['id']}},_0x2bb7d0={};_0x2bb7d0['model']=_[_0xfe78('0x31')](db[_0xfe78('0x2c')][_0xfe78('0x2d')]);_0x2bb7d0[_0xfe78('0x30')]=_[_0xfe78('0x31')](_0x8036af[_0xfe78('0x30')]);_0x2bb7d0[_0xfe78('0x32')]=_[_0xfe78('0x33')](_0x2bb7d0[_0xfe78('0x2f')],_0x2bb7d0['query']);_0x503e88['attributes']=_[_0xfe78('0x33')](_0x2bb7d0['model'],qs[_0xfe78('0x34')](_0x8036af['query'][_0xfe78('0x34')]));_0x503e88[_0xfe78('0x35')]=_0x503e88[_0xfe78('0x35')][_0xfe78('0x36')]?_0x503e88[_0xfe78('0x35')]:_0x2bb7d0['model'];if(_0x8036af[_0xfe78('0x30')][_0xfe78('0x40')]){_0x503e88[_0xfe78('0x41')]=[{'all':!![]}];}_0x503e88=_[_0xfe78('0x3d')]({},_0x503e88,_0x8036af[_0xfe78('0x46')]);return db[_0xfe78('0x2c')][_0xfe78('0x47')](_0x503e88)['then'](handleEntityNotFound(_0x4edf84,null))[_0xfe78('0x26')](respondWithResult(_0x4edf84,null))['catch'](handleError(_0x4edf84,null));};exports[_0xfe78('0x48')]=function(_0x5d4cbf,_0x590dd7){return db[_0xfe78('0x2c')][_0xfe78('0x48')](_0x5d4cbf['body'],{})['then'](respondWithResult(_0x590dd7,0xc9))['catch'](handleError(_0x590dd7,null));};exports[_0xfe78('0x25')]=function(_0x215e09,_0x5617b2){if(_0x215e09['body']['id']){delete _0x215e09['body']['id'];}return db[_0xfe78('0x2c')][_0xfe78('0x47')]({'where':{'id':_0x215e09[_0xfe78('0x49')]['id']}})[_0xfe78('0x26')](handleEntityNotFound(_0x5617b2,null))[_0xfe78('0x26')](saveUpdates(_0x215e09['body'],null))[_0xfe78('0x26')](respondWithResult(_0x5617b2,null))[_0xfe78('0x44')](handleError(_0x5617b2,null));};exports[_0xfe78('0x27')]=function(_0x41c7db,_0x20d7eb){return db[_0xfe78('0x2c')][_0xfe78('0x47')]({'where':{'id':_0x41c7db[_0xfe78('0x49')]['id']}})['then'](handleEntityNotFound(_0x20d7eb,null))[_0xfe78('0x26')](removeEntity(_0x20d7eb,null))[_0xfe78('0x44')](handleError(_0x20d7eb,null));}; \ No newline at end of file +var _0xbe3c=['name','index','MailServerOut','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','destroy','find','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x1229fc,_0x32fd1d){var _0x5148b6=function(_0x34e7df){while(--_0x34e7df){_0x1229fc['push'](_0x1229fc['shift']());}};_0x5148b6(++_0x32fd1d);}(_0xbe3c,0xbd));var _0xcbe3=function(_0x464e74,_0x583c17){_0x464e74=_0x464e74-0x0;var _0x439c03=_0xbe3c[_0x464e74];return _0x439c03;};'use strict';var emlformat=require(_0xcbe3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcbe3('0x1'));var jsonpatch=require(_0xcbe3('0x2'));var rp=require(_0xcbe3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcbe3('0x4'));var util=require(_0xcbe3('0x5'));var path=require(_0xcbe3('0x6'));var sox=require(_0xcbe3('0x7'));var csv=require('to-csv');var ejs=require(_0xcbe3('0x8'));var fs=require('fs');var fs_extra=require(_0xcbe3('0x9'));var _=require(_0xcbe3('0xa'));var squel=require('squel');var crypto=require(_0xcbe3('0xb'));var jsforce=require(_0xcbe3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcbe3('0xd'));var querystring=require(_0xcbe3('0xe'));var Papa=require(_0xcbe3('0xf'));var Redis=require(_0xcbe3('0x10'));var authService=require(_0xcbe3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcbe3('0x12'));var logger=require('../../config/logger')(_0xcbe3('0x13'));var utils=require(_0xcbe3('0x14'));var config=require(_0xcbe3('0x15'));var licenseUtil=require(_0xcbe3('0x16'));var db=require(_0xcbe3('0x17'))['db'];function respondWithStatusCode(_0xb5396c,_0x211f57){_0x211f57=_0x211f57||0xcc;return function(_0x5acb4c){if(_0x5acb4c){return _0xb5396c['sendStatus'](_0x211f57);}return _0xb5396c[_0xcbe3('0x18')](_0x211f57)[_0xcbe3('0x19')]();};}function respondWithResult(_0x4e6ea3,_0x540bb5){_0x540bb5=_0x540bb5||0xc8;return function(_0x4e8dfd){if(_0x4e8dfd){return _0x4e6ea3[_0xcbe3('0x18')](_0x540bb5)[_0xcbe3('0x1a')](_0x4e8dfd);}};}function respondWithFilteredResult(_0x2f4cdc,_0x2bf2e6){return function(_0x5eb9e8){if(_0x5eb9e8){var _0x3b3fad=typeof _0x2bf2e6[_0xcbe3('0x1b')]===_0xcbe3('0x1c')&&typeof _0x2bf2e6[_0xcbe3('0x1d')]===_0xcbe3('0x1c');var _0x573975=_0x5eb9e8['count'];var _0x90bad3=_0x3b3fad?0x0:_0x2bf2e6[_0xcbe3('0x1b')];var _0x24f175=_0x3b3fad?_0x5eb9e8[_0xcbe3('0x1e')]:_0x2bf2e6[_0xcbe3('0x1b')]+_0x2bf2e6[_0xcbe3('0x1d')];var _0x21a0c1;if(_0x24f175>=_0x573975){_0x24f175=_0x573975;_0x21a0c1=0xc8;}else{_0x21a0c1=0xce;}_0x2f4cdc['status'](_0x21a0c1);return _0x2f4cdc['set'](_0xcbe3('0x1f'),_0x90bad3+'-'+_0x24f175+'/'+_0x573975)[_0xcbe3('0x1a')](_0x5eb9e8);}return null;};}function patchUpdates(_0x3262dd){return function(_0x1692e1){try{jsonpatch[_0xcbe3('0x20')](_0x1692e1,_0x3262dd,!![]);}catch(_0x544807){return BPromise[_0xcbe3('0x21')](_0x544807);}return _0x1692e1[_0xcbe3('0x22')]();};}function saveUpdates(_0x179371,_0x237496){return function(_0x55ba5c){if(_0x55ba5c){return _0x55ba5c[_0xcbe3('0x23')](_0x179371)['then'](function(_0x1a8fce){return _0x1a8fce;});}return null;};}function removeEntity(_0x51e865,_0x1d55ef){return function(_0x2ec8ac){if(_0x2ec8ac){return _0x2ec8ac['destroy']()[_0xcbe3('0x24')](function(){_0x51e865[_0xcbe3('0x18')](0xcc)[_0xcbe3('0x19')]();});}};}function handleEntityNotFound(_0x8206ca,_0x2835e6){return function(_0x2be85d){if(!_0x2be85d){_0x8206ca['sendStatus'](0x194);}return _0x2be85d;};}function handleError(_0x56279c,_0x3ac32a){_0x3ac32a=_0x3ac32a||0x1f4;return function(_0x184689){logger[_0xcbe3('0x25')](_0x184689[_0xcbe3('0x26')]);if(_0x184689[_0xcbe3('0x27')]){delete _0x184689[_0xcbe3('0x27')];}_0x56279c[_0xcbe3('0x18')](_0x3ac32a)['send'](_0x184689);};}exports[_0xcbe3('0x28')]=function(_0x3a0221,_0x3a8595){var _0x328d70={},_0x245cdc={},_0x33487a={'count':0x0,'rows':[]};var _0x12217f=_['map'](db[_0xcbe3('0x29')]['rawAttributes'],function(_0x3680b1){return{'name':_0x3680b1[_0xcbe3('0x2a')],'type':_0x3680b1[_0xcbe3('0x2b')][_0xcbe3('0x2c')]};});_0x245cdc[_0xcbe3('0x2d')]=_[_0xcbe3('0x2e')](_0x12217f,_0xcbe3('0x27'));_0x245cdc['query']=_[_0xcbe3('0x2f')](_0x3a0221[_0xcbe3('0x30')]);_0x245cdc['filters']=_['intersection'](_0x245cdc[_0xcbe3('0x2d')],_0x245cdc[_0xcbe3('0x30')]);_0x328d70[_0xcbe3('0x31')]=_[_0xcbe3('0x32')](_0x245cdc[_0xcbe3('0x2d')],qs[_0xcbe3('0x33')](_0x3a0221[_0xcbe3('0x30')][_0xcbe3('0x33')]));_0x328d70[_0xcbe3('0x31')]=_0x328d70[_0xcbe3('0x31')][_0xcbe3('0x34')]?_0x328d70['attributes']:_0x245cdc[_0xcbe3('0x2d')];if(!_0x3a0221[_0xcbe3('0x30')][_0xcbe3('0x35')](_0xcbe3('0x36'))){_0x328d70[_0xcbe3('0x1d')]=qs[_0xcbe3('0x1d')](_0x3a0221[_0xcbe3('0x30')][_0xcbe3('0x1d')]);_0x328d70['offset']=qs[_0xcbe3('0x1b')](_0x3a0221[_0xcbe3('0x30')][_0xcbe3('0x1b')]);}_0x328d70[_0xcbe3('0x37')]=qs[_0xcbe3('0x38')](_0x3a0221['query']['sort']);_0x328d70[_0xcbe3('0x39')]=qs['filters'](_[_0xcbe3('0x3a')](_0x3a0221['query'],_0x245cdc[_0xcbe3('0x3b')]),_0x12217f);if(_0x3a0221[_0xcbe3('0x30')][_0xcbe3('0x3c')]){_0x328d70['where']=_[_0xcbe3('0x3d')](_0x328d70[_0xcbe3('0x39')],{'$or':_[_0xcbe3('0x2e')](_0x12217f,function(_0x5c58b3){if(_0x5c58b3['type']!==_0xcbe3('0x3e')){var _0x56dd94={};_0x56dd94[_0x5c58b3['name']]={'$like':'%'+_0x3a0221[_0xcbe3('0x30')][_0xcbe3('0x3c')]+'%'};return _0x56dd94;}})});}_0x328d70=_[_0xcbe3('0x3d')]({},_0x328d70,_0x3a0221[_0xcbe3('0x3f')]);var _0x19962c={'where':_0x328d70[_0xcbe3('0x39')]};return db[_0xcbe3('0x29')]['count'](_0x19962c)[_0xcbe3('0x24')](function(_0x440702){_0x33487a[_0xcbe3('0x1e')]=_0x440702;if(_0x3a0221['query'][_0xcbe3('0x40')]){_0x328d70['include']=[{'all':!![]}];}return db[_0xcbe3('0x29')][_0xcbe3('0x41')](_0x328d70);})['then'](function(_0xc8e86){_0x33487a[_0xcbe3('0x42')]=_0xc8e86;return _0x33487a;})['then'](respondWithFilteredResult(_0x3a8595,_0x328d70))[_0xcbe3('0x43')](handleError(_0x3a8595,null));};exports[_0xcbe3('0x44')]=function(_0x22c8fa,_0x23bdd0){var _0x37af49={'raw':!![],'where':{'id':_0x22c8fa[_0xcbe3('0x45')]['id']}},_0x3d70f8={};_0x3d70f8[_0xcbe3('0x2d')]=_['keys'](db[_0xcbe3('0x29')][_0xcbe3('0x46')]);_0x3d70f8['query']=_[_0xcbe3('0x2f')](_0x22c8fa[_0xcbe3('0x30')]);_0x3d70f8[_0xcbe3('0x3b')]=_[_0xcbe3('0x32')](_0x3d70f8[_0xcbe3('0x2d')],_0x3d70f8[_0xcbe3('0x30')]);_0x37af49['attributes']=_[_0xcbe3('0x32')](_0x3d70f8[_0xcbe3('0x2d')],qs[_0xcbe3('0x33')](_0x22c8fa[_0xcbe3('0x30')]['fields']));_0x37af49[_0xcbe3('0x31')]=_0x37af49['attributes'][_0xcbe3('0x34')]?_0x37af49[_0xcbe3('0x31')]:_0x3d70f8[_0xcbe3('0x2d')];if(_0x22c8fa[_0xcbe3('0x30')][_0xcbe3('0x40')]){_0x37af49[_0xcbe3('0x47')]=[{'all':!![]}];}_0x37af49=_[_0xcbe3('0x3d')]({},_0x37af49,_0x22c8fa['options']);return db['MailServerOut']['find'](_0x37af49)['then'](handleEntityNotFound(_0x23bdd0,null))[_0xcbe3('0x24')](respondWithResult(_0x23bdd0,null))[_0xcbe3('0x43')](handleError(_0x23bdd0,null));};exports[_0xcbe3('0x48')]=function(_0xe5246,_0x5397ba){return db[_0xcbe3('0x29')][_0xcbe3('0x48')](_0xe5246['body'],{})['then'](respondWithResult(_0x5397ba,0xc9))[_0xcbe3('0x43')](handleError(_0x5397ba,null));};exports['update']=function(_0x475ab1,_0x35433a){if(_0x475ab1[_0xcbe3('0x49')]['id']){delete _0x475ab1[_0xcbe3('0x49')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x475ab1[_0xcbe3('0x45')]['id']}})[_0xcbe3('0x24')](handleEntityNotFound(_0x35433a,null))[_0xcbe3('0x24')](saveUpdates(_0x475ab1[_0xcbe3('0x49')],null))['then'](respondWithResult(_0x35433a,null))[_0xcbe3('0x43')](handleError(_0x35433a,null));};exports[_0xcbe3('0x4a')]=function(_0x2b63c4,_0x2b1dc7){return db[_0xcbe3('0x29')][_0xcbe3('0x4b')]({'where':{'id':_0x2b63c4['params']['id']}})[_0xcbe3('0x24')](handleEntityNotFound(_0x2b1dc7,null))[_0xcbe3('0x24')](removeEntity(_0x2b1dc7,null))['catch'](handleError(_0x2b1dc7,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f08d272..1574b34 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 _0x3060=['exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','path','rimraf','./mailServerOut.attributes'];(function(_0x5ca17c,_0xc082bd){var _0xf7348b=function(_0x4f2885){while(--_0x4f2885){_0x5ca17c['push'](_0x5ca17c['shift']());}};_0xf7348b(++_0xc082bd);}(_0x3060,0x1d8));var _0x0306=function(_0x3c4016,_0x2e220f){_0x3c4016=_0x3c4016-0x0;var _0x3cebbd=_0x3060[_0x3c4016];return _0x3cebbd;};'use strict';var _=require(_0x0306('0x0'));var util=require(_0x0306('0x1'));var logger=require(_0x0306('0x2'))(_0x0306('0x3'));var moment=require(_0x0306('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0306('0x5'));var rimraf=require(_0x0306('0x6'));var config=require('../../config/environment');var attributes=require(_0x0306('0x7'));module[_0x0306('0x8')]=function(_0xbdeb37,_0x43315a){return _0xbdeb37[_0x0306('0x9')](_0x0306('0xa'),attributes,{'tableName':_0x0306('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x268b=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash'];(function(_0x3746e8,_0xcb6757){var _0x2cbdba=function(_0x39ba21){while(--_0x39ba21){_0x3746e8['push'](_0x3746e8['shift']());}};_0x2cbdba(++_0xcb6757);}(_0x268b,0xe9));var _0xb268=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0x268b[_0x53f0db];return _0xae0a5c;};'use strict';var _=require(_0xb268('0x0'));var util=require(_0xb268('0x1'));var logger=require(_0xb268('0x2'))(_0xb268('0x3'));var moment=require(_0xb268('0x4'));var BPromise=require(_0xb268('0x5'));var rp=require(_0xb268('0x6'));var fs=require('fs');var path=require(_0xb268('0x7'));var rimraf=require('rimraf');var config=require(_0xb268('0x8'));var attributes=require(_0xb268('0x9'));module[_0xb268('0xa')]=function(_0x21e897,_0x22bdda){return _0x21e897['define'](_0xb268('0xb'),attributes,{'tableName':_0xb268('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 13b6af4..248284b 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x2ef3,0xba));var _0x32ef=function(_0x6041f7,_0x130fd4){_0x6041f7=_0x6041f7-0x0;var _0x460255=_0x2ef3[_0x6041f7];return _0x460255;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x2ce4fb,_0x10aa86){_0x2ce4fb=_0x2ce4fb-0x0;var _0xe62586=_0x7a54[_0x2ce4fb];return _0xe62586;};'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 01ebfd6..d07e5b0 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 _0xb91a=['../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','/describe','describe','/:id','isAuthenticated','post','create','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0xb91a,0x1c2));var _0xab91=function(_0x393d70,_0x49dffe){_0x393d70=_0x393d70-0x0;var _0x24c2f9=_0xb91a[_0x393d70];return _0x24c2f9;};'use strict';var multer=require(_0xab91('0x0'));var util=require('util');var path=require(_0xab91('0x1'));var timeout=require(_0xab91('0x2'));var express=require(_0xab91('0x3'));var router=express['Router']();var fs_extra=require(_0xab91('0x4'));var auth=require(_0xab91('0x5'));var interaction=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var controller=require(_0xab91('0x8'));router[_0xab91('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xab91('0x9')](_0xab91('0xa'),auth['isAuthenticated'](),controller[_0xab91('0xb')]);router[_0xab91('0x9')](_0xab91('0xc'),auth[_0xab91('0xd')](),controller['show']);router[_0xab91('0xe')]('/',auth[_0xab91('0xd')](),controller[_0xab91('0xf')]);router['put'](_0xab91('0xc'),auth[_0xab91('0xd')](),controller[_0xab91('0x10')]);router[_0xab91('0x11')](_0xab91('0xc'),auth[_0xab91('0xd')](),controller['destroy']);module[_0xab91('0x12')]=router; \ No newline at end of file +var _0x2341=['post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','index','get','/describe','isAuthenticated','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2341,0x1aa));var _0x1234=function(_0x1b337b,_0x11c511){_0x1b337b=_0x1b337b-0x0;var _0x497ab2=_0x2341[_0x1b337b];return _0x497ab2;};'use strict';var multer=require(_0x1234('0x0'));var util=require(_0x1234('0x1'));var path=require(_0x1234('0x2'));var timeout=require(_0x1234('0x3'));var express=require(_0x1234('0x4'));var router=express[_0x1234('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1234('0x6'));var interaction=require(_0x1234('0x7'));var config=require('../../config/environment');var controller=require(_0x1234('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1234('0x9')]);router[_0x1234('0xa')](_0x1234('0xb'),auth[_0x1234('0xc')](),controller['describe']);router[_0x1234('0xa')]('/:id',auth[_0x1234('0xc')](),controller[_0x1234('0xd')]);router[_0x1234('0xe')]('/',auth[_0x1234('0xc')](),controller[_0x1234('0xf')]);router['put'](_0x1234('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x1234('0x11')](_0x1234('0x10'),auth['isAuthenticated'](),controller[_0x1234('0x12')]);module[_0x1234('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 424daf9..471bc7e 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 _0xbeea=['sequelize','STRING','name'];(function(_0x2dbc16,_0x18b2f3){var _0x3f3cf5=function(_0x32f64d){while(--_0x32f64d){_0x2dbc16['push'](_0x2dbc16['shift']());}};_0x3f3cf5(++_0x18b2f3);}(_0xbeea,0xb1));var _0xabee=function(_0x1eabe2,_0x24666c){_0x1eabe2=_0x1eabe2-0x0;var _0x39adc0=_0xbeea[_0x1eabe2];return _0x39adc0;};'use strict';var Sequelize=require(_0xabee('0x0'));module['exports']={'name':{'type':Sequelize[_0xabee('0x1')],'unique':_0xabee('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xabee('0x1')]}}; \ No newline at end of file +var _0x41fe=['name','sequelize','exports','STRING'];(function(_0x928aa1,_0x16bd67){var _0x37b02b=function(_0x740f9e){while(--_0x740f9e){_0x928aa1['push'](_0x928aa1['shift']());}};_0x37b02b(++_0x16bd67);}(_0x41fe,0xd1));var _0xe41f=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x41fe[_0x34eb31];return _0x254994;};'use strict';var Sequelize=require(_0xe41f('0x0'));module[_0xe41f('0x1')]={'name':{'type':Sequelize[_0xe41f('0x2')],'unique':_0xe41f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe41f('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d4df8be..8b32031 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 _0x64e1=['model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','then','params','intersection','length','find','catch','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','end','error','stack','name','send','index','MailSubstatus','rawAttributes','type','key','map','query','keys','filters'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x64e1,0x15f));var _0x164e=function(_0x2dfd53,_0x342eb7){_0x2dfd53=_0x2dfd53-0x0;var _0x4100e7=_0x64e1[_0x2dfd53];return _0x4100e7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x164e('0x0'));var jsonpatch=require(_0x164e('0x1'));var rp=require(_0x164e('0x2'));var moment=require(_0x164e('0x3'));var BPromise=require(_0x164e('0x4'));var Mustache=require(_0x164e('0x5'));var util=require(_0x164e('0x6'));var path=require(_0x164e('0x7'));var sox=require(_0x164e('0x8'));var csv=require(_0x164e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x164e('0xa'));var _=require(_0x164e('0xb'));var squel=require('squel');var crypto=require(_0x164e('0xc'));var jsforce=require(_0x164e('0xd'));var deskjs=require(_0x164e('0xe'));var toCsv=require(_0x164e('0x9'));var querystring=require(_0x164e('0xf'));var Papa=require(_0x164e('0x10'));var Redis=require(_0x164e('0x11'));var authService=require(_0x164e('0x12'));var qs=require(_0x164e('0x13'));var as=require(_0x164e('0x14'));var hardwareService=require(_0x164e('0x15'));var logger=require(_0x164e('0x16'))(_0x164e('0x17'));var utils=require('../../config/utils');var config=require(_0x164e('0x18'));var licenseUtil=require(_0x164e('0x19'));var db=require(_0x164e('0x1a'))['db'];function respondWithStatusCode(_0xbc2198,_0x59f66e){_0x59f66e=_0x59f66e||0xcc;return function(_0x437702){if(_0x437702){return _0xbc2198[_0x164e('0x1b')](_0x59f66e);}return _0xbc2198[_0x164e('0x1c')](_0x59f66e)['end']();};}function respondWithResult(_0xbd2b2f,_0xcb6f03){_0xcb6f03=_0xcb6f03||0xc8;return function(_0xbe4d51){if(_0xbe4d51){return _0xbd2b2f[_0x164e('0x1c')](_0xcb6f03)[_0x164e('0x1d')](_0xbe4d51);}};}function respondWithFilteredResult(_0x8cde4c,_0xc74996){return function(_0x17a9db){if(_0x17a9db){var _0x8c0e9c=typeof _0xc74996[_0x164e('0x1e')]===_0x164e('0x1f')&&typeof _0xc74996[_0x164e('0x20')]==='undefined';var _0x1bd244=_0x17a9db[_0x164e('0x21')];var _0x2ee0ae=_0x8c0e9c?0x0:_0xc74996[_0x164e('0x1e')];var _0x5ecd7a=_0x8c0e9c?_0x17a9db['count']:_0xc74996[_0x164e('0x1e')]+_0xc74996[_0x164e('0x20')];var _0x3a3e7d;if(_0x5ecd7a>=_0x1bd244){_0x5ecd7a=_0x1bd244;_0x3a3e7d=0xc8;}else{_0x3a3e7d=0xce;}_0x8cde4c[_0x164e('0x1c')](_0x3a3e7d);return _0x8cde4c[_0x164e('0x22')](_0x164e('0x23'),_0x2ee0ae+'-'+_0x5ecd7a+'/'+_0x1bd244)[_0x164e('0x1d')](_0x17a9db);}return null;};}function patchUpdates(_0x380a67){return function(_0x45106f){try{jsonpatch[_0x164e('0x24')](_0x45106f,_0x380a67,!![]);}catch(_0x540b13){return BPromise[_0x164e('0x25')](_0x540b13);}return _0x45106f[_0x164e('0x26')]();};}function saveUpdates(_0x550ad8,_0x5e7bd5){return function(_0xf633d5){if(_0xf633d5){return _0xf633d5[_0x164e('0x27')](_0x550ad8)['then'](function(_0x408313){return _0x408313;});}return null;};}function removeEntity(_0x47b27c,_0x5c98fb){return function(_0x666d60){if(_0x666d60){return _0x666d60['destroy']()['then'](function(){_0x47b27c[_0x164e('0x1c')](0xcc)[_0x164e('0x28')]();});}};}function handleEntityNotFound(_0x4ff9af,_0x62ca0f){return function(_0x245bbc){if(!_0x245bbc){_0x4ff9af[_0x164e('0x1b')](0x194);}return _0x245bbc;};}function handleError(_0x4e8813,_0x131958){_0x131958=_0x131958||0x1f4;return function(_0x417508){logger[_0x164e('0x29')](_0x417508[_0x164e('0x2a')]);if(_0x417508[_0x164e('0x2b')]){delete _0x417508[_0x164e('0x2b')];}_0x4e8813['status'](_0x131958)[_0x164e('0x2c')](_0x417508);};}exports[_0x164e('0x2d')]=function(_0x193370,_0x254b14){var _0x9edab2={},_0x1cd585={},_0x1a74dd={'count':0x0,'rows':[]};var _0x5d919d=_['map'](db[_0x164e('0x2e')][_0x164e('0x2f')],function(_0x22c100){return{'name':_0x22c100['fieldName'],'type':_0x22c100[_0x164e('0x30')][_0x164e('0x31')]};});_0x1cd585['model']=_[_0x164e('0x32')](_0x5d919d,'name');_0x1cd585[_0x164e('0x33')]=_[_0x164e('0x34')](_0x193370[_0x164e('0x33')]);_0x1cd585[_0x164e('0x35')]=_['intersection'](_0x1cd585[_0x164e('0x36')],_0x1cd585[_0x164e('0x33')]);_0x9edab2[_0x164e('0x37')]=_['intersection'](_0x1cd585[_0x164e('0x36')],qs[_0x164e('0x38')](_0x193370[_0x164e('0x33')][_0x164e('0x38')]));_0x9edab2[_0x164e('0x37')]=_0x9edab2[_0x164e('0x37')]['length']?_0x9edab2[_0x164e('0x37')]:_0x1cd585[_0x164e('0x36')];if(!_0x193370['query'][_0x164e('0x39')](_0x164e('0x3a'))){_0x9edab2['limit']=qs[_0x164e('0x20')](_0x193370[_0x164e('0x33')]['limit']);_0x9edab2['offset']=qs[_0x164e('0x1e')](_0x193370[_0x164e('0x33')][_0x164e('0x1e')]);}_0x9edab2[_0x164e('0x3b')]=qs[_0x164e('0x3c')](_0x193370[_0x164e('0x33')][_0x164e('0x3c')]);_0x9edab2['where']=qs[_0x164e('0x35')](_[_0x164e('0x3d')](_0x193370[_0x164e('0x33')],_0x1cd585[_0x164e('0x35')]),_0x5d919d);if(_0x193370['query']['filter']){_0x9edab2[_0x164e('0x3e')]=_[_0x164e('0x3f')](_0x9edab2[_0x164e('0x3e')],{'$or':_[_0x164e('0x32')](_0x5d919d,function(_0x14422b){if(_0x14422b[_0x164e('0x30')]!==_0x164e('0x40')){var _0x67f9f={};_0x67f9f[_0x14422b['name']]={'$like':'%'+_0x193370[_0x164e('0x33')][_0x164e('0x41')]+'%'};return _0x67f9f;}})});}_0x9edab2=_[_0x164e('0x3f')]({},_0x9edab2,_0x193370[_0x164e('0x42')]);var _0x4fea8d={'where':_0x9edab2[_0x164e('0x3e')]};return db['MailSubstatus'][_0x164e('0x21')](_0x4fea8d)['then'](function(_0x205a7c){_0x1a74dd[_0x164e('0x21')]=_0x205a7c;if(_0x193370[_0x164e('0x33')][_0x164e('0x43')]){_0x9edab2[_0x164e('0x44')]=[{'all':!![]}];}return db['MailSubstatus'][_0x164e('0x45')](_0x9edab2);})['then'](function(_0x319d97){_0x1a74dd[_0x164e('0x46')]=_0x319d97;return _0x1a74dd;})[_0x164e('0x47')](respondWithFilteredResult(_0x254b14,_0x9edab2))['catch'](handleError(_0x254b14,null));};exports['show']=function(_0x33baaf,_0x26c630){var _0x18bd24={'raw':!![],'where':{'id':_0x33baaf[_0x164e('0x48')]['id']}},_0x42c6c4={};_0x42c6c4[_0x164e('0x36')]=_['keys'](db['MailSubstatus'][_0x164e('0x2f')]);_0x42c6c4[_0x164e('0x33')]=_['keys'](_0x33baaf['query']);_0x42c6c4[_0x164e('0x35')]=_[_0x164e('0x49')](_0x42c6c4['model'],_0x42c6c4['query']);_0x18bd24[_0x164e('0x37')]=_[_0x164e('0x49')](_0x42c6c4[_0x164e('0x36')],qs[_0x164e('0x38')](_0x33baaf[_0x164e('0x33')][_0x164e('0x38')]));_0x18bd24[_0x164e('0x37')]=_0x18bd24['attributes'][_0x164e('0x4a')]?_0x18bd24[_0x164e('0x37')]:_0x42c6c4['model'];if(_0x33baaf[_0x164e('0x33')]['includeAll']){_0x18bd24['include']=[{'all':!![]}];}_0x18bd24=_[_0x164e('0x3f')]({},_0x18bd24,_0x33baaf[_0x164e('0x42')]);return db[_0x164e('0x2e')][_0x164e('0x4b')](_0x18bd24)[_0x164e('0x47')](handleEntityNotFound(_0x26c630,null))['then'](respondWithResult(_0x26c630,null))[_0x164e('0x4c')](handleError(_0x26c630,null));};exports[_0x164e('0x4d')]=function(_0x5c878d,_0x13e1a5){return db[_0x164e('0x2e')][_0x164e('0x4d')](_0x5c878d[_0x164e('0x4e')],{})[_0x164e('0x47')](respondWithResult(_0x13e1a5,0xc9))[_0x164e('0x4c')](handleError(_0x13e1a5,null));};exports['update']=function(_0x4415ea,_0xf5994e){if(_0x4415ea['body']['id']){delete _0x4415ea[_0x164e('0x4e')]['id'];}return db[_0x164e('0x2e')]['find']({'where':{'id':_0x4415ea[_0x164e('0x48')]['id']}})[_0x164e('0x47')](handleEntityNotFound(_0xf5994e,null))['then'](saveUpdates(_0x4415ea['body'],null))[_0x164e('0x47')](respondWithResult(_0xf5994e,null))[_0x164e('0x4c')](handleError(_0xf5994e,null));};exports[_0x164e('0x4f')]=function(_0x44f849,_0x5e102c){return db[_0x164e('0x2e')][_0x164e('0x4b')]({'where':{'id':_0x44f849[_0x164e('0x48')]['id']}})[_0x164e('0x47')](handleEntityNotFound(_0x5e102c,null))['then'](removeEntity(_0x5e102c,null))[_0x164e('0x4c')](handleError(_0x5e102c,null));};exports[_0x164e('0x50')]=function(_0x792cf9,_0x45995d){return db[_0x164e('0x2e')][_0x164e('0x50')]()['then'](respondWithResult(_0x45995d,null))['catch'](handleError(_0x45995d,null));}; \ No newline at end of file +var _0xe87d=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','catch','rawAttributes','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','MailSubstatus'];(function(_0x6484d9,_0x211ccd){var _0xa14b86=function(_0x3ee46b){while(--_0x3ee46b){_0x6484d9['push'](_0x6484d9['shift']());}};_0xa14b86(++_0x211ccd);}(_0xe87d,0x198));var _0xde87=function(_0x1c7359,_0x32c4b8){_0x1c7359=_0x1c7359-0x0;var _0x40c051=_0xe87d[_0x1c7359];return _0x40c051;};'use strict';var emlformat=require(_0xde87('0x0'));var rimraf=require(_0xde87('0x1'));var zipdir=require(_0xde87('0x2'));var jsonpatch=require(_0xde87('0x3'));var rp=require(_0xde87('0x4'));var moment=require(_0xde87('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xde87('0x6'));var util=require(_0xde87('0x7'));var path=require(_0xde87('0x8'));var sox=require(_0xde87('0x9'));var csv=require(_0xde87('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde87('0xb'));var _=require(_0xde87('0xc'));var squel=require(_0xde87('0xd'));var crypto=require(_0xde87('0xe'));var jsforce=require(_0xde87('0xf'));var deskjs=require(_0xde87('0x10'));var toCsv=require(_0xde87('0xa'));var querystring=require(_0xde87('0x11'));var Papa=require(_0xde87('0x12'));var Redis=require(_0xde87('0x13'));var authService=require(_0xde87('0x14'));var qs=require(_0xde87('0x15'));var as=require(_0xde87('0x16'));var hardwareService=require(_0xde87('0x17'));var logger=require('../../config/logger')(_0xde87('0x18'));var utils=require(_0xde87('0x19'));var config=require(_0xde87('0x1a'));var licenseUtil=require(_0xde87('0x1b'));var db=require(_0xde87('0x1c'))['db'];function respondWithStatusCode(_0x354af7,_0x2be4f8){_0x2be4f8=_0x2be4f8||0xcc;return function(_0x126c47){if(_0x126c47){return _0x354af7[_0xde87('0x1d')](_0x2be4f8);}return _0x354af7[_0xde87('0x1e')](_0x2be4f8)['end']();};}function respondWithResult(_0x48922c,_0x2aea76){_0x2aea76=_0x2aea76||0xc8;return function(_0x157243){if(_0x157243){return _0x48922c[_0xde87('0x1e')](_0x2aea76)[_0xde87('0x1f')](_0x157243);}};}function respondWithFilteredResult(_0x541ec5,_0x2f7a4a){return function(_0x56f69b){if(_0x56f69b){var _0x59bde5=typeof _0x2f7a4a[_0xde87('0x20')]===_0xde87('0x21')&&typeof _0x2f7a4a['limit']==='undefined';var _0x1efbea=_0x56f69b[_0xde87('0x22')];var _0x389ff2=_0x59bde5?0x0:_0x2f7a4a[_0xde87('0x20')];var _0x5d44ac=_0x59bde5?_0x56f69b[_0xde87('0x22')]:_0x2f7a4a[_0xde87('0x20')]+_0x2f7a4a[_0xde87('0x23')];var _0x44d8e9;if(_0x5d44ac>=_0x1efbea){_0x5d44ac=_0x1efbea;_0x44d8e9=0xc8;}else{_0x44d8e9=0xce;}_0x541ec5['status'](_0x44d8e9);return _0x541ec5[_0xde87('0x24')](_0xde87('0x25'),_0x389ff2+'-'+_0x5d44ac+'/'+_0x1efbea)[_0xde87('0x1f')](_0x56f69b);}return null;};}function patchUpdates(_0x347d18){return function(_0x1cee2a){try{jsonpatch[_0xde87('0x26')](_0x1cee2a,_0x347d18,!![]);}catch(_0xff120d){return BPromise[_0xde87('0x27')](_0xff120d);}return _0x1cee2a['save']();};}function saveUpdates(_0x62fe2f,_0x4ffb80){return function(_0x4acd3f){if(_0x4acd3f){return _0x4acd3f['update'](_0x62fe2f)[_0xde87('0x28')](function(_0x3c1eef){return _0x3c1eef;});}return null;};}function removeEntity(_0x1eedce,_0x188a90){return function(_0x2d8abf){if(_0x2d8abf){return _0x2d8abf['destroy']()['then'](function(){_0x1eedce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53daa4,_0x37ccf9){return function(_0x207b3e){if(!_0x207b3e){_0x53daa4[_0xde87('0x1d')](0x194);}return _0x207b3e;};}function handleError(_0x3726ed,_0x346f2e){_0x346f2e=_0x346f2e||0x1f4;return function(_0x585338){logger[_0xde87('0x29')](_0x585338[_0xde87('0x2a')]);if(_0x585338[_0xde87('0x2b')]){delete _0x585338[_0xde87('0x2b')];}_0x3726ed[_0xde87('0x1e')](_0x346f2e)[_0xde87('0x2c')](_0x585338);};}exports[_0xde87('0x2d')]=function(_0x164176,_0x17fffe){var _0x31de09={},_0x4bc297={},_0x5a461a={'count':0x0,'rows':[]};var _0x5c173e=_[_0xde87('0x2e')](db[_0xde87('0x2f')]['rawAttributes'],function(_0xdb113a){return{'name':_0xdb113a['fieldName'],'type':_0xdb113a['type'][_0xde87('0x30')]};});_0x4bc297[_0xde87('0x31')]=_['map'](_0x5c173e,'name');_0x4bc297[_0xde87('0x32')]=_[_0xde87('0x33')](_0x164176[_0xde87('0x32')]);_0x4bc297[_0xde87('0x34')]=_[_0xde87('0x35')](_0x4bc297[_0xde87('0x31')],_0x4bc297['query']);_0x31de09[_0xde87('0x36')]=_['intersection'](_0x4bc297[_0xde87('0x31')],qs[_0xde87('0x37')](_0x164176['query'][_0xde87('0x37')]));_0x31de09['attributes']=_0x31de09[_0xde87('0x36')][_0xde87('0x38')]?_0x31de09[_0xde87('0x36')]:_0x4bc297[_0xde87('0x31')];if(!_0x164176['query'][_0xde87('0x39')](_0xde87('0x3a'))){_0x31de09[_0xde87('0x23')]=qs['limit'](_0x164176[_0xde87('0x32')][_0xde87('0x23')]);_0x31de09['offset']=qs[_0xde87('0x20')](_0x164176[_0xde87('0x32')][_0xde87('0x20')]);}_0x31de09[_0xde87('0x3b')]=qs[_0xde87('0x3c')](_0x164176[_0xde87('0x32')][_0xde87('0x3c')]);_0x31de09[_0xde87('0x3d')]=qs['filters'](_['pick'](_0x164176[_0xde87('0x32')],_0x4bc297[_0xde87('0x34')]),_0x5c173e);if(_0x164176[_0xde87('0x32')][_0xde87('0x3e')]){_0x31de09[_0xde87('0x3d')]=_['merge'](_0x31de09[_0xde87('0x3d')],{'$or':_[_0xde87('0x2e')](_0x5c173e,function(_0x5e9edb){if(_0x5e9edb[_0xde87('0x3f')]!==_0xde87('0x40')){var _0x5a2341={};_0x5a2341[_0x5e9edb[_0xde87('0x2b')]]={'$like':'%'+_0x164176[_0xde87('0x32')][_0xde87('0x3e')]+'%'};return _0x5a2341;}})});}_0x31de09=_[_0xde87('0x41')]({},_0x31de09,_0x164176[_0xde87('0x42')]);var _0x3cca67={'where':_0x31de09[_0xde87('0x3d')]};return db[_0xde87('0x2f')]['count'](_0x3cca67)[_0xde87('0x28')](function(_0x2a59de){_0x5a461a[_0xde87('0x22')]=_0x2a59de;if(_0x164176[_0xde87('0x32')][_0xde87('0x43')]){_0x31de09['include']=[{'all':!![]}];}return db[_0xde87('0x2f')]['findAll'](_0x31de09);})['then'](function(_0x18c3d3){_0x5a461a['rows']=_0x18c3d3;return _0x5a461a;})[_0xde87('0x28')](respondWithFilteredResult(_0x17fffe,_0x31de09))[_0xde87('0x44')](handleError(_0x17fffe,null));};exports['show']=function(_0x3b070b,_0x2da4f4){var _0xbb03e4={'raw':!![],'where':{'id':_0x3b070b['params']['id']}},_0x566eb8={};_0x566eb8[_0xde87('0x31')]=_[_0xde87('0x33')](db[_0xde87('0x2f')][_0xde87('0x45')]);_0x566eb8[_0xde87('0x32')]=_[_0xde87('0x33')](_0x3b070b[_0xde87('0x32')]);_0x566eb8[_0xde87('0x34')]=_[_0xde87('0x35')](_0x566eb8['model'],_0x566eb8[_0xde87('0x32')]);_0xbb03e4[_0xde87('0x36')]=_[_0xde87('0x35')](_0x566eb8[_0xde87('0x31')],qs[_0xde87('0x37')](_0x3b070b[_0xde87('0x32')][_0xde87('0x37')]));_0xbb03e4[_0xde87('0x36')]=_0xbb03e4[_0xde87('0x36')]['length']?_0xbb03e4[_0xde87('0x36')]:_0x566eb8[_0xde87('0x31')];if(_0x3b070b[_0xde87('0x32')][_0xde87('0x43')]){_0xbb03e4['include']=[{'all':!![]}];}_0xbb03e4=_[_0xde87('0x41')]({},_0xbb03e4,_0x3b070b[_0xde87('0x42')]);return db[_0xde87('0x2f')][_0xde87('0x46')](_0xbb03e4)['then'](handleEntityNotFound(_0x2da4f4,null))[_0xde87('0x28')](respondWithResult(_0x2da4f4,null))[_0xde87('0x44')](handleError(_0x2da4f4,null));};exports[_0xde87('0x47')]=function(_0x5a3d0d,_0x19a73b){return db[_0xde87('0x2f')][_0xde87('0x47')](_0x5a3d0d[_0xde87('0x48')],{})[_0xde87('0x28')](respondWithResult(_0x19a73b,0xc9))['catch'](handleError(_0x19a73b,null));};exports['update']=function(_0x4ea4a1,_0x50eaeb){if(_0x4ea4a1['body']['id']){delete _0x4ea4a1['body']['id'];}return db[_0xde87('0x2f')][_0xde87('0x46')]({'where':{'id':_0x4ea4a1[_0xde87('0x49')]['id']}})[_0xde87('0x28')](handleEntityNotFound(_0x50eaeb,null))[_0xde87('0x28')](saveUpdates(_0x4ea4a1['body'],null))['then'](respondWithResult(_0x50eaeb,null))['catch'](handleError(_0x50eaeb,null));};exports[_0xde87('0x4a')]=function(_0xbb7d8d,_0x1b6412){return db[_0xde87('0x2f')]['find']({'where':{'id':_0xbb7d8d[_0xde87('0x49')]['id']}})[_0xde87('0x28')](handleEntityNotFound(_0x1b6412,null))[_0xde87('0x28')](removeEntity(_0x1b6412,null))[_0xde87('0x44')](handleError(_0x1b6412,null));};exports[_0xde87('0x4b')]=function(_0x44a23c,_0x1e31d5){return db[_0xde87('0x2f')][_0xde87('0x4b')]()['then'](respondWithResult(_0x1e31d5,null))['catch'](handleError(_0x1e31d5,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 6fa94ac..68be0da 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 _0x52f4=['MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x1cbad2,_0x13518b){var _0x4225bd=function(_0xb1e8d7){while(--_0xb1e8d7){_0x1cbad2['push'](_0x1cbad2['shift']());}};_0x4225bd(++_0x13518b);}(_0x52f4,0x19c));var _0x452f=function(_0x3f2f84,_0x1b0291){_0x3f2f84=_0x3f2f84-0x0;var _0x814c03=_0x52f4[_0x3f2f84];return _0x814c03;};'use strict';var EventEmitter=require(_0x452f('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x452f('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x452f('0x2')](0x0);var events={'afterUpdate':_0x452f('0x3')};function emitEvent(_0x3c7ce1){return function(_0x599029,_0x34ebc3,_0x15dfc8){MailSubstatusEvents[_0x452f('0x4')](_0x3c7ce1+':'+_0x599029['id'],_0x599029);MailSubstatusEvents[_0x452f('0x4')](_0x3c7ce1,_0x599029);_0x15dfc8(null);};}for(var e in events){if(events[_0x452f('0x5')](e)){var event=events[e];MailSubstatus[_0x452f('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x6440=['emit','exports','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0x333e43,_0x6db023){var _0x5569e4=function(_0xfbfd32){while(--_0xfbfd32){_0x333e43['push'](_0x333e43['shift']());}};_0x5569e4(++_0x6db023);}(_0x6440,0x9e));var _0x0644=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6440[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x0644('0x0'))['db'][_0x0644('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0644('0x2')](0x0);var events={'afterUpdate':_0x0644('0x3')};function emitEvent(_0x5685f3){return function(_0x301810,_0x2d10a1,_0x1b3a38){MailSubstatusEvents['emit'](_0x5685f3+':'+_0x301810['id'],_0x301810);MailSubstatusEvents[_0x0644('0x4')](_0x5685f3,_0x301810);_0x1b3a38(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x0644('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5d2e34b..66828ba 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 _0x6b55=['define','mail_substatuses','update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports'];(function(_0x54f241,_0x2b8581){var _0x4ffe7d=function(_0x1d1222){while(--_0x1d1222){_0x54f241['push'](_0x54f241['shift']());}};_0x4ffe7d(++_0x2b8581);}(_0x6b55,0x1f2));var _0x56b5=function(_0x404401,_0x373e5b){_0x404401=_0x404401-0x0;var _0x34c2c9=_0x6b55[_0x404401];return _0x34c2c9;};'use strict';var attributes=require(_0x56b5('0x0'));module[_0x56b5('0x1')]=function(_0x575885){var _0x426f5a=_0x575885['models'];return _0x575885[_0x56b5('0x2')]('MailSubstatus',attributes,{'tableName':_0x56b5('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5f1eb1,_0x1ca8d7,_0xb3fff7){return _0x426f5a['Condition'][_0x56b5('0x4')]({'value':_0x5f1eb1['name']},{'where':{'field':_0x56b5('0x5'),'value':_0x5f1eb1[_0x56b5('0x6')][_0x56b5('0x7')]}})[_0x56b5('0x8')](function(){_0xb3fff7();})[_0x56b5('0x9')](function(_0x45b20a){_0xb3fff7(_0x45b20a);});}}});}; \ No newline at end of file +var _0x20d4=['./mailSubstatus.attributes','exports','models','define','MailSubstatus','update','name','mailSubstatus','_previousDataValues','catch'];(function(_0x474872,_0x227eab){var _0x3f47f5=function(_0x320938){while(--_0x320938){_0x474872['push'](_0x474872['shift']());}};_0x3f47f5(++_0x227eab);}(_0x20d4,0xdc));var _0x420d=function(_0xb82a3a,_0x55a2cc){_0xb82a3a=_0xb82a3a-0x0;var _0xa71dbc=_0x20d4[_0xb82a3a];return _0xa71dbc;};'use strict';var attributes=require(_0x420d('0x0'));module[_0x420d('0x1')]=function(_0x103e31){var _0x1c29e4=_0x103e31[_0x420d('0x2')];return _0x103e31[_0x420d('0x3')](_0x420d('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x19f7d4,_0x130cfd,_0x48b149){return _0x1c29e4['Condition'][_0x420d('0x5')]({'value':_0x19f7d4[_0x420d('0x6')]},{'where':{'field':_0x420d('0x7'),'value':_0x19f7d4[_0x420d('0x8')][_0x420d('0x6')]}})['then'](function(){_0x48b149();})[_0x420d('0x9')](function(_0x1526d4){_0x48b149(_0x1526d4);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 7a12620..abff4ec 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 _0x6b69=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b69,0x19e));var _0x96b6=function(_0x29aea6,_0x3fe3df){_0x29aea6=_0x29aea6-0x0;var _0x32da51=_0x6b69[_0x29aea6];return _0x32da51;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x96b6('0x0'));var BPromise=require(_0x96b6('0x1'));var rs=require(_0x96b6('0x2'));var fs=require('fs');var Redis=require(_0x96b6('0x3'));var db=require(_0x96b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x96b6('0x5'))(_0x96b6('0x6'));var config=require(_0x96b6('0x7'));var jayson=require(_0x96b6('0x8'));var client=jayson[_0x96b6('0x9')][_0x96b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a57e6,_0x5585fb,_0x8fa59c){return new BPromise(function(_0x57e59c,_0x2fb074){return client['request'](_0x4a57e6,_0x8fa59c)[_0x96b6('0xb')](function(_0x1260c7){logger['info'](_0x96b6('0xc'),_0x5585fb,'request\x20sent');logger[_0x96b6('0xd')](_0x96b6('0xe'),_0x5585fb,_0x96b6('0xf'),JSON[_0x96b6('0x10')](_0x1260c7));if(_0x1260c7[_0x96b6('0x11')]){if(_0x1260c7[_0x96b6('0x11')][_0x96b6('0x12')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x5585fb,_0x1260c7[_0x96b6('0x11')][_0x96b6('0x13')]);return _0x2fb074(_0x1260c7[_0x96b6('0x11')][_0x96b6('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x5585fb,_0x1260c7[_0x96b6('0x11')][_0x96b6('0x13')]);return _0x57e59c(_0x1260c7[_0x96b6('0x11')][_0x96b6('0x13')]);}else{logger[_0x96b6('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x5585fb,_0x96b6('0xf'));_0x57e59c(_0x1260c7['result'][_0x96b6('0x13')]);}})[_0x96b6('0x15')](function(_0x54fe78){logger['error'](_0x96b6('0xc'),_0x5585fb,_0x54fe78);_0x2fb074(_0x54fe78);});});} \ No newline at end of file +var _0x4062=['message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3e01c8,_0x30ec78){var _0x2a6804=function(_0x499374){while(--_0x499374){_0x3e01c8['push'](_0x3e01c8['shift']());}};_0x2a6804(++_0x30ec78);}(_0x4062,0x1b6));var _0x2406=function(_0x2389ac,_0x4844e7){_0x2389ac=_0x2389ac-0x0;var _0x2d0ed8=_0x4062[_0x2389ac];return _0x2d0ed8;};'use strict';var _=require(_0x2406('0x0'));var util=require(_0x2406('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2406('0x2'));var fs=require('fs');var Redis=require(_0x2406('0x3'));var db=require(_0x2406('0x4'))['db'];var utils=require(_0x2406('0x5'));var logger=require(_0x2406('0x6'))(_0x2406('0x7'));var config=require(_0x2406('0x8'));var jayson=require(_0x2406('0x9'));var client=jayson['client'][_0x2406('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34b0e7,_0x3901d0,_0xf9b297){return new BPromise(function(_0x435538,_0x1436f4){return client['request'](_0x34b0e7,_0xf9b297)[_0x2406('0xb')](function(_0x896dc9){logger['info'](_0x2406('0xc'),_0x3901d0,_0x2406('0xd'));logger[_0x2406('0xe')](_0x2406('0xf'),_0x3901d0,_0x2406('0xd'),JSON['stringify'](_0x896dc9));if(_0x896dc9[_0x2406('0x10')]){if(_0x896dc9[_0x2406('0x10')][_0x2406('0x11')]===0x1f4){logger[_0x2406('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x3901d0,_0x896dc9['error'][_0x2406('0x12')]);return _0x1436f4(_0x896dc9[_0x2406('0x10')][_0x2406('0x12')]);}logger['error'](_0x2406('0xc'),_0x3901d0,_0x896dc9[_0x2406('0x10')]['message']);return _0x435538(_0x896dc9[_0x2406('0x10')]['message']);}else{logger['info'](_0x2406('0xc'),_0x3901d0,_0x2406('0xd'));_0x435538(_0x896dc9['result'][_0x2406('0x12')]);}})['catch'](function(_0x4a9fc8){logger[_0x2406('0x10')](_0x2406('0xc'),_0x3901d0,_0x4a9fc8);_0x1436f4(_0x4a9fc8);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 7622fd5..0964fbf 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 _0xfc8e=['index','describe','show','post','create','put','/:id','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfc8e,0x14b));var _0xefc8=function(_0x19c953,_0x379fde){_0x19c953=_0x19c953-0x0;var _0x47a65d=_0xfc8e[_0x19c953];return _0x47a65d;};'use strict';var multer=require('multer');var util=require(_0xefc8('0x0'));var path=require(_0xefc8('0x1'));var timeout=require(_0xefc8('0x2'));var express=require(_0xefc8('0x3'));var router=express[_0xefc8('0x4')]();var fs_extra=require(_0xefc8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xefc8('0x6'));var config=require(_0xefc8('0x7'));var controller=require(_0xefc8('0x8'));router[_0xefc8('0x9')]('/',auth[_0xefc8('0xa')](),controller[_0xefc8('0xb')]);router['get']('/describe',auth[_0xefc8('0xa')](),controller[_0xefc8('0xc')]);router[_0xefc8('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xefc8('0xd')]);router[_0xefc8('0xe')]('/',auth[_0xefc8('0xa')](),controller[_0xefc8('0xf')]);router[_0xefc8('0x10')](_0xefc8('0x11'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0a3f=['describe','/:id','show','post','create','update','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0xdc81d7,_0x5b9182){var _0x41ddc6=function(_0x56b0e3){while(--_0x56b0e3){_0xdc81d7['push'](_0xdc81d7['shift']());}};_0x41ddc6(++_0x5b9182);}(_0x0a3f,0x1e3));var _0xf0a3=function(_0x22fdea,_0x1aee37){_0x22fdea=_0x22fdea-0x0;var _0x56803d=_0x0a3f[_0x22fdea];return _0x56803d;};'use strict';var multer=require(_0xf0a3('0x0'));var util=require(_0xf0a3('0x1'));var path=require(_0xf0a3('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0a3('0x3'));var router=express['Router']();var fs_extra=require(_0xf0a3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf0a3('0x5'));var config=require(_0xf0a3('0x6'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xf0a3('0x7')](),controller[_0xf0a3('0x8')]);router[_0xf0a3('0x9')](_0xf0a3('0xa'),auth[_0xf0a3('0x7')](),controller[_0xf0a3('0xb')]);router[_0xf0a3('0x9')](_0xf0a3('0xc'),auth[_0xf0a3('0x7')](),controller[_0xf0a3('0xd')]);router[_0xf0a3('0xe')]('/',auth[_0xf0a3('0x7')](),controller[_0xf0a3('0xf')]);router['put'](_0xf0a3('0xc'),auth[_0xf0a3('0x7')](),controller[_0xf0a3('0x10')]);router[_0xf0a3('0x11')]('/:id',auth[_0xf0a3('0x7')](),controller[_0xf0a3('0x12')]);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 a235a5b..763656c 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x91c1,_0x5d4637){_0x91c1=_0x91c1-0x0;var _0x539cd9=_0xb43b[_0x91c1];return _0x539cd9;};'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 +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x26239f,_0x16743f){var _0x429132=function(_0x177c58){while(--_0x177c58){_0x26239f['push'](_0x26239f['shift']());}};_0x429132(++_0x16743f);}(_0x70e0,0x17b));var _0x070e=function(_0xe753e7,_0x42bb6c){_0xe753e7=_0xe753e7-0x0;var _0x3f99e6=_0x70e0[_0xe753e7];return _0x3f99e6;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index bf54813..09a0a78 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 _0x277e=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','MailTransferReport','include','findAll','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x44700b,_0x1cef26){var _0x4af965=function(_0x5dc4fd){while(--_0x5dc4fd){_0x44700b['push'](_0x44700b['shift']());}};_0x4af965(++_0x1cef26);}(_0x277e,0x1a4));var _0xe277=function(_0x2b53bc,_0x4106ef){_0x2b53bc=_0x2b53bc-0x0;var _0x7641af=_0x277e[_0x2b53bc];return _0x7641af;};'use strict';var emlformat=require(_0xe277('0x0'));var rimraf=require(_0xe277('0x1'));var zipdir=require(_0xe277('0x2'));var jsonpatch=require(_0xe277('0x3'));var rp=require(_0xe277('0x4'));var moment=require(_0xe277('0x5'));var BPromise=require(_0xe277('0x6'));var Mustache=require('mustache');var util=require(_0xe277('0x7'));var path=require(_0xe277('0x8'));var sox=require(_0xe277('0x9'));var csv=require(_0xe277('0xa'));var ejs=require(_0xe277('0xb'));var fs=require('fs');var fs_extra=require(_0xe277('0xc'));var _=require(_0xe277('0xd'));var squel=require('squel');var crypto=require(_0xe277('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe277('0xf'));var toCsv=require(_0xe277('0xa'));var querystring=require(_0xe277('0x10'));var Papa=require(_0xe277('0x11'));var Redis=require(_0xe277('0x12'));var authService=require(_0xe277('0x13'));var qs=require(_0xe277('0x14'));var as=require(_0xe277('0x15'));var hardwareService=require(_0xe277('0x16'));var logger=require(_0xe277('0x17'))(_0xe277('0x18'));var utils=require(_0xe277('0x19'));var config=require(_0xe277('0x1a'));var licenseUtil=require(_0xe277('0x1b'));var db=require(_0xe277('0x1c'))['db'];function respondWithStatusCode(_0x20661c,_0x2aa000){_0x2aa000=_0x2aa000||0xcc;return function(_0x344985){if(_0x344985){return _0x20661c[_0xe277('0x1d')](_0x2aa000);}return _0x20661c[_0xe277('0x1e')](_0x2aa000)[_0xe277('0x1f')]();};}function respondWithResult(_0x46e671,_0x39a508){_0x39a508=_0x39a508||0xc8;return function(_0x18cd86){if(_0x18cd86){return _0x46e671[_0xe277('0x1e')](_0x39a508)[_0xe277('0x20')](_0x18cd86);}};}function respondWithFilteredResult(_0xa78a84,_0x309ed7){return function(_0x448eca){if(_0x448eca){var _0x20bcf0=typeof _0x309ed7[_0xe277('0x21')]===_0xe277('0x22')&&typeof _0x309ed7[_0xe277('0x23')]===_0xe277('0x22');var _0x56cfa7=_0x448eca[_0xe277('0x24')];var _0x365094=_0x20bcf0?0x0:_0x309ed7[_0xe277('0x21')];var _0x26fb82=_0x20bcf0?_0x448eca[_0xe277('0x24')]:_0x309ed7[_0xe277('0x21')]+_0x309ed7[_0xe277('0x23')];var _0xfcd4bf;if(_0x26fb82>=_0x56cfa7){_0x26fb82=_0x56cfa7;_0xfcd4bf=0xc8;}else{_0xfcd4bf=0xce;}_0xa78a84[_0xe277('0x1e')](_0xfcd4bf);return _0xa78a84['set'](_0xe277('0x25'),_0x365094+'-'+_0x26fb82+'/'+_0x56cfa7)[_0xe277('0x20')](_0x448eca);}return null;};}function patchUpdates(_0x1224bd){return function(_0x485222){try{jsonpatch[_0xe277('0x26')](_0x485222,_0x1224bd,!![]);}catch(_0x6027c){return BPromise['reject'](_0x6027c);}return _0x485222['save']();};}function saveUpdates(_0x31815e,_0x519c18){return function(_0x236d05){if(_0x236d05){return _0x236d05[_0xe277('0x27')](_0x31815e)[_0xe277('0x28')](function(_0x4c3e16){return _0x4c3e16;});}return null;};}function removeEntity(_0x1532f9,_0x4e215a){return function(_0xaab000){if(_0xaab000){return _0xaab000[_0xe277('0x29')]()['then'](function(){_0x1532f9['status'](0xcc)[_0xe277('0x1f')]();});}};}function handleEntityNotFound(_0x386d5d,_0x2e8285){return function(_0x4d2dc6){if(!_0x4d2dc6){_0x386d5d['sendStatus'](0x194);}return _0x4d2dc6;};}function handleError(_0x12ef3d,_0x3f3d78){_0x3f3d78=_0x3f3d78||0x1f4;return function(_0x437a87){logger[_0xe277('0x2a')](_0x437a87[_0xe277('0x2b')]);if(_0x437a87[_0xe277('0x2c')]){delete _0x437a87['name'];}_0x12ef3d['status'](_0x3f3d78)[_0xe277('0x2d')](_0x437a87);};}exports['index']=function(_0x4eb129,_0x47eaaf){var _0x11c613={},_0x236d59={},_0x5afd6d={'count':0x0,'rows':[]};var _0x4207c2=_[_0xe277('0x2e')](db['MailTransferReport'][_0xe277('0x2f')],function(_0x488ea4){return{'name':_0x488ea4[_0xe277('0x30')],'type':_0x488ea4[_0xe277('0x31')][_0xe277('0x32')]};});_0x236d59['model']=_[_0xe277('0x2e')](_0x4207c2,_0xe277('0x2c'));_0x236d59[_0xe277('0x33')]=_[_0xe277('0x34')](_0x4eb129['query']);_0x236d59[_0xe277('0x35')]=_[_0xe277('0x36')](_0x236d59[_0xe277('0x37')],_0x236d59['query']);_0x11c613[_0xe277('0x38')]=_[_0xe277('0x36')](_0x236d59[_0xe277('0x37')],qs[_0xe277('0x39')](_0x4eb129[_0xe277('0x33')]['fields']));_0x11c613[_0xe277('0x38')]=_0x11c613[_0xe277('0x38')][_0xe277('0x3a')]?_0x11c613[_0xe277('0x38')]:_0x236d59[_0xe277('0x37')];if(!_0x4eb129[_0xe277('0x33')][_0xe277('0x3b')](_0xe277('0x3c'))){_0x11c613[_0xe277('0x23')]=qs['limit'](_0x4eb129[_0xe277('0x33')][_0xe277('0x23')]);_0x11c613['offset']=qs[_0xe277('0x21')](_0x4eb129[_0xe277('0x33')][_0xe277('0x21')]);}_0x11c613[_0xe277('0x3d')]=qs[_0xe277('0x3e')](_0x4eb129['query'][_0xe277('0x3e')]);_0x11c613[_0xe277('0x3f')]=qs[_0xe277('0x35')](_[_0xe277('0x40')](_0x4eb129[_0xe277('0x33')],_0x236d59[_0xe277('0x35')]),_0x4207c2);if(_0x4eb129[_0xe277('0x33')]['filter']){_0x11c613['where']=_['merge'](_0x11c613['where'],{'$or':_[_0xe277('0x2e')](_0x4207c2,function(_0x2c8350){if(_0x2c8350[_0xe277('0x31')]!=='VIRTUAL'){var _0x5b0203={};_0x5b0203[_0x2c8350[_0xe277('0x2c')]]={'$like':'%'+_0x4eb129['query'][_0xe277('0x41')]+'%'};return _0x5b0203;}})});}_0x11c613=_[_0xe277('0x42')]({},_0x11c613,_0x4eb129[_0xe277('0x43')]);var _0x18cc7a={'where':_0x11c613['where']};return db[_0xe277('0x44')][_0xe277('0x24')](_0x18cc7a)['then'](function(_0x3f4437){_0x5afd6d[_0xe277('0x24')]=_0x3f4437;if(_0x4eb129['query']['includeAll']){_0x11c613[_0xe277('0x45')]=[{'all':!![]}];}return db[_0xe277('0x44')][_0xe277('0x46')](_0x11c613);})['then'](function(_0x123704){_0x5afd6d['rows']=_0x123704;return _0x5afd6d;})[_0xe277('0x28')](respondWithFilteredResult(_0x47eaaf,_0x11c613))[_0xe277('0x47')](handleError(_0x47eaaf,null));};exports[_0xe277('0x48')]=function(_0x43c3dc,_0x15c222){var _0x521bb4={'raw':!![],'where':{'id':_0x43c3dc[_0xe277('0x49')]['id']}},_0x85c1f6={};_0x85c1f6['model']=_[_0xe277('0x34')](db[_0xe277('0x44')]['rawAttributes']);_0x85c1f6[_0xe277('0x33')]=_['keys'](_0x43c3dc[_0xe277('0x33')]);_0x85c1f6[_0xe277('0x35')]=_[_0xe277('0x36')](_0x85c1f6['model'],_0x85c1f6[_0xe277('0x33')]);_0x521bb4[_0xe277('0x38')]=_['intersection'](_0x85c1f6[_0xe277('0x37')],qs[_0xe277('0x39')](_0x43c3dc['query'][_0xe277('0x39')]));_0x521bb4['attributes']=_0x521bb4[_0xe277('0x38')][_0xe277('0x3a')]?_0x521bb4[_0xe277('0x38')]:_0x85c1f6[_0xe277('0x37')];if(_0x43c3dc[_0xe277('0x33')][_0xe277('0x4a')]){_0x521bb4[_0xe277('0x45')]=[{'all':!![]}];}_0x521bb4=_[_0xe277('0x42')]({},_0x521bb4,_0x43c3dc['options']);return db['MailTransferReport'][_0xe277('0x4b')](_0x521bb4)[_0xe277('0x28')](handleEntityNotFound(_0x15c222,null))[_0xe277('0x28')](respondWithResult(_0x15c222,null))[_0xe277('0x47')](handleError(_0x15c222,null));};exports['create']=function(_0x33111b,_0x3892f1){return db[_0xe277('0x44')][_0xe277('0x4c')](_0x33111b[_0xe277('0x4d')],{})[_0xe277('0x28')](respondWithResult(_0x3892f1,0xc9))[_0xe277('0x47')](handleError(_0x3892f1,null));};exports[_0xe277('0x27')]=function(_0x39e4d7,_0x296562){if(_0x39e4d7[_0xe277('0x4d')]['id']){delete _0x39e4d7[_0xe277('0x4d')]['id'];}return db[_0xe277('0x44')]['find']({'where':{'id':_0x39e4d7[_0xe277('0x49')]['id']}})['then'](handleEntityNotFound(_0x296562,null))[_0xe277('0x28')](saveUpdates(_0x39e4d7[_0xe277('0x4d')],null))[_0xe277('0x28')](respondWithResult(_0x296562,null))['catch'](handleError(_0x296562,null));};exports[_0xe277('0x29')]=function(_0xe3b5c4,_0x24e2cd){return db[_0xe277('0x44')][_0xe277('0x4b')]({'where':{'id':_0xe3b5c4[_0xe277('0x49')]['id']}})['then'](handleEntityNotFound(_0x24e2cd,null))[_0xe277('0x28')](removeEntity(_0x24e2cd,null))[_0xe277('0x47')](handleError(_0x24e2cd,null));};exports[_0xe277('0x4e')]=function(_0x1691d1,_0x18ad73){return db['MailTransferReport'][_0xe277('0x4e')]()[_0xe277('0x28')](respondWithResult(_0x18ad73,null))['catch'](handleError(_0x18ad73,null));}; \ No newline at end of file +var _0x3f5c=['stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','merge','options','MailTransferReport','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end'];(function(_0x57cc22,_0x2d351f){var _0x6f7bdc=function(_0x4935b5){while(--_0x4935b5){_0x57cc22['push'](_0x57cc22['shift']());}};_0x6f7bdc(++_0x2d351f);}(_0x3f5c,0xba));var _0xc3f5=function(_0x1fe052,_0xa2ee39){_0x1fe052=_0x1fe052-0x0;var _0xbf1886=_0x3f5c[_0x1fe052];return _0xbf1886;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f5('0x0'));var jsonpatch=require(_0xc3f5('0x1'));var rp=require(_0xc3f5('0x2'));var moment=require(_0xc3f5('0x3'));var BPromise=require(_0xc3f5('0x4'));var Mustache=require(_0xc3f5('0x5'));var util=require(_0xc3f5('0x6'));var path=require(_0xc3f5('0x7'));var sox=require(_0xc3f5('0x8'));var csv=require(_0xc3f5('0x9'));var ejs=require(_0xc3f5('0xa'));var fs=require('fs');var fs_extra=require(_0xc3f5('0xb'));var _=require(_0xc3f5('0xc'));var squel=require(_0xc3f5('0xd'));var crypto=require(_0xc3f5('0xe'));var jsforce=require(_0xc3f5('0xf'));var deskjs=require(_0xc3f5('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc3f5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f5('0x12'));var logger=require('../../config/logger')(_0xc3f5('0x13'));var utils=require(_0xc3f5('0x14'));var config=require(_0xc3f5('0x15'));var licenseUtil=require(_0xc3f5('0x16'));var db=require(_0xc3f5('0x17'))['db'];function respondWithStatusCode(_0xadc372,_0xe3cf23){_0xe3cf23=_0xe3cf23||0xcc;return function(_0xfbd401){if(_0xfbd401){return _0xadc372[_0xc3f5('0x18')](_0xe3cf23);}return _0xadc372[_0xc3f5('0x19')](_0xe3cf23)['end']();};}function respondWithResult(_0x3b9bc1,_0x9ffdde){_0x9ffdde=_0x9ffdde||0xc8;return function(_0x176d77){if(_0x176d77){return _0x3b9bc1[_0xc3f5('0x19')](_0x9ffdde)[_0xc3f5('0x1a')](_0x176d77);}};}function respondWithFilteredResult(_0x39621c,_0x228ea6){return function(_0x28b6f4){if(_0x28b6f4){var _0x1da511=typeof _0x228ea6[_0xc3f5('0x1b')]===_0xc3f5('0x1c')&&typeof _0x228ea6[_0xc3f5('0x1d')]==='undefined';var _0x56c99f=_0x28b6f4[_0xc3f5('0x1e')];var _0x156da0=_0x1da511?0x0:_0x228ea6[_0xc3f5('0x1b')];var _0x2dbab4=_0x1da511?_0x28b6f4['count']:_0x228ea6[_0xc3f5('0x1b')]+_0x228ea6[_0xc3f5('0x1d')];var _0x31a929;if(_0x2dbab4>=_0x56c99f){_0x2dbab4=_0x56c99f;_0x31a929=0xc8;}else{_0x31a929=0xce;}_0x39621c[_0xc3f5('0x19')](_0x31a929);return _0x39621c[_0xc3f5('0x1f')]('Content-Range',_0x156da0+'-'+_0x2dbab4+'/'+_0x56c99f)[_0xc3f5('0x1a')](_0x28b6f4);}return null;};}function patchUpdates(_0x183b4f){return function(_0x645d77){try{jsonpatch[_0xc3f5('0x20')](_0x645d77,_0x183b4f,!![]);}catch(_0x930d34){return BPromise[_0xc3f5('0x21')](_0x930d34);}return _0x645d77[_0xc3f5('0x22')]();};}function saveUpdates(_0x370b52,_0x101330){return function(_0x321c08){if(_0x321c08){return _0x321c08[_0xc3f5('0x23')](_0x370b52)['then'](function(_0x3f316a){return _0x3f316a;});}return null;};}function removeEntity(_0x200d66,_0xbf32d7){return function(_0x4a8288){if(_0x4a8288){return _0x4a8288[_0xc3f5('0x24')]()[_0xc3f5('0x25')](function(){_0x200d66[_0xc3f5('0x19')](0xcc)[_0xc3f5('0x26')]();});}};}function handleEntityNotFound(_0x484af9,_0x24c361){return function(_0x534285){if(!_0x534285){_0x484af9['sendStatus'](0x194);}return _0x534285;};}function handleError(_0x123b95,_0x1fc40e){_0x1fc40e=_0x1fc40e||0x1f4;return function(_0xf21d3b){logger['error'](_0xf21d3b[_0xc3f5('0x27')]);if(_0xf21d3b[_0xc3f5('0x28')]){delete _0xf21d3b[_0xc3f5('0x28')];}_0x123b95[_0xc3f5('0x19')](_0x1fc40e)[_0xc3f5('0x29')](_0xf21d3b);};}exports[_0xc3f5('0x2a')]=function(_0x48af19,_0xaae9d2){var _0x258a56={},_0x3a0190={},_0xfa733a={'count':0x0,'rows':[]};var _0x1b29b2=_[_0xc3f5('0x2b')](db['MailTransferReport'][_0xc3f5('0x2c')],function(_0x12a1b8){return{'name':_0x12a1b8[_0xc3f5('0x2d')],'type':_0x12a1b8['type'][_0xc3f5('0x2e')]};});_0x3a0190['model']=_[_0xc3f5('0x2b')](_0x1b29b2,_0xc3f5('0x28'));_0x3a0190[_0xc3f5('0x2f')]=_['keys'](_0x48af19[_0xc3f5('0x2f')]);_0x3a0190[_0xc3f5('0x30')]=_[_0xc3f5('0x31')](_0x3a0190[_0xc3f5('0x32')],_0x3a0190[_0xc3f5('0x2f')]);_0x258a56[_0xc3f5('0x33')]=_[_0xc3f5('0x31')](_0x3a0190['model'],qs[_0xc3f5('0x34')](_0x48af19[_0xc3f5('0x2f')][_0xc3f5('0x34')]));_0x258a56[_0xc3f5('0x33')]=_0x258a56[_0xc3f5('0x33')][_0xc3f5('0x35')]?_0x258a56[_0xc3f5('0x33')]:_0x3a0190[_0xc3f5('0x32')];if(!_0x48af19['query']['hasOwnProperty'](_0xc3f5('0x36'))){_0x258a56[_0xc3f5('0x1d')]=qs[_0xc3f5('0x1d')](_0x48af19['query'][_0xc3f5('0x1d')]);_0x258a56[_0xc3f5('0x1b')]=qs[_0xc3f5('0x1b')](_0x48af19['query'][_0xc3f5('0x1b')]);}_0x258a56[_0xc3f5('0x37')]=qs['sort'](_0x48af19[_0xc3f5('0x2f')][_0xc3f5('0x38')]);_0x258a56[_0xc3f5('0x39')]=qs[_0xc3f5('0x30')](_['pick'](_0x48af19['query'],_0x3a0190[_0xc3f5('0x30')]),_0x1b29b2);if(_0x48af19[_0xc3f5('0x2f')][_0xc3f5('0x3a')]){_0x258a56['where']=_['merge'](_0x258a56['where'],{'$or':_['map'](_0x1b29b2,function(_0x1aff9a){if(_0x1aff9a[_0xc3f5('0x3b')]!=='VIRTUAL'){var _0x30ba99={};_0x30ba99[_0x1aff9a['name']]={'$like':'%'+_0x48af19['query']['filter']+'%'};return _0x30ba99;}})});}_0x258a56=_[_0xc3f5('0x3c')]({},_0x258a56,_0x48af19[_0xc3f5('0x3d')]);var _0x417c84={'where':_0x258a56[_0xc3f5('0x39')]};return db[_0xc3f5('0x3e')][_0xc3f5('0x1e')](_0x417c84)[_0xc3f5('0x25')](function(_0x5a6722){_0xfa733a[_0xc3f5('0x1e')]=_0x5a6722;if(_0x48af19['query']['includeAll']){_0x258a56['include']=[{'all':!![]}];}return db[_0xc3f5('0x3e')][_0xc3f5('0x3f')](_0x258a56);})[_0xc3f5('0x25')](function(_0x1fe450){_0xfa733a[_0xc3f5('0x40')]=_0x1fe450;return _0xfa733a;})['then'](respondWithFilteredResult(_0xaae9d2,_0x258a56))[_0xc3f5('0x41')](handleError(_0xaae9d2,null));};exports[_0xc3f5('0x42')]=function(_0x30fc3d,_0x5d08fa){var _0x495bc7={'raw':!![],'where':{'id':_0x30fc3d[_0xc3f5('0x43')]['id']}},_0x10c8b4={};_0x10c8b4[_0xc3f5('0x32')]=_[_0xc3f5('0x44')](db['MailTransferReport'][_0xc3f5('0x2c')]);_0x10c8b4['query']=_['keys'](_0x30fc3d[_0xc3f5('0x2f')]);_0x10c8b4[_0xc3f5('0x30')]=_['intersection'](_0x10c8b4[_0xc3f5('0x32')],_0x10c8b4['query']);_0x495bc7[_0xc3f5('0x33')]=_[_0xc3f5('0x31')](_0x10c8b4['model'],qs['fields'](_0x30fc3d['query'][_0xc3f5('0x34')]));_0x495bc7[_0xc3f5('0x33')]=_0x495bc7[_0xc3f5('0x33')][_0xc3f5('0x35')]?_0x495bc7['attributes']:_0x10c8b4[_0xc3f5('0x32')];if(_0x30fc3d[_0xc3f5('0x2f')][_0xc3f5('0x45')]){_0x495bc7[_0xc3f5('0x46')]=[{'all':!![]}];}_0x495bc7=_['merge']({},_0x495bc7,_0x30fc3d[_0xc3f5('0x3d')]);return db[_0xc3f5('0x3e')][_0xc3f5('0x47')](_0x495bc7)[_0xc3f5('0x25')](handleEntityNotFound(_0x5d08fa,null))[_0xc3f5('0x25')](respondWithResult(_0x5d08fa,null))[_0xc3f5('0x41')](handleError(_0x5d08fa,null));};exports[_0xc3f5('0x48')]=function(_0x14e94d,_0x5c9da0){return db[_0xc3f5('0x3e')][_0xc3f5('0x48')](_0x14e94d['body'],{})['then'](respondWithResult(_0x5c9da0,0xc9))[_0xc3f5('0x41')](handleError(_0x5c9da0,null));};exports[_0xc3f5('0x23')]=function(_0x5d2221,_0x2c0c2f){if(_0x5d2221[_0xc3f5('0x49')]['id']){delete _0x5d2221[_0xc3f5('0x49')]['id'];}return db['MailTransferReport'][_0xc3f5('0x47')]({'where':{'id':_0x5d2221['params']['id']}})[_0xc3f5('0x25')](handleEntityNotFound(_0x2c0c2f,null))[_0xc3f5('0x25')](saveUpdates(_0x5d2221[_0xc3f5('0x49')],null))['then'](respondWithResult(_0x2c0c2f,null))[_0xc3f5('0x41')](handleError(_0x2c0c2f,null));};exports[_0xc3f5('0x24')]=function(_0xb53132,_0x2b0dab){return db[_0xc3f5('0x3e')][_0xc3f5('0x47')]({'where':{'id':_0xb53132[_0xc3f5('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b0dab,null))[_0xc3f5('0x25')](removeEntity(_0x2b0dab,null))[_0xc3f5('0x41')](handleError(_0x2b0dab,null));};exports[_0xc3f5('0x4a')]=function(_0xf95fa5,_0x808439){return db[_0xc3f5('0x3e')]['describe']()[_0xc3f5('0x25')](respondWithResult(_0x808439,null))[_0xc3f5('0x41')](handleError(_0x808439,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 1804c8f..e6579d7 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 _0xb6a6=['uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','MailTransferReport','report_mail_transfer'];(function(_0x5af1ce,_0x318f6e){var _0x4e7f4f=function(_0x4c4c90){while(--_0x4c4c90){_0x5af1ce['push'](_0x5af1ce['shift']());}};_0x4e7f4f(++_0x318f6e);}(_0xb6a6,0x1ed));var _0x6b6a=function(_0x45ed09,_0x4deb08){_0x45ed09=_0x45ed09-0x0;var _0x1938a5=_0xb6a6[_0x45ed09];return _0x1938a5;};'use strict';var _=require('lodash');var util=require(_0x6b6a('0x0'));var logger=require(_0x6b6a('0x1'))(_0x6b6a('0x2'));var moment=require(_0x6b6a('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b6a('0x4'));var fs=require('fs');var path=require(_0x6b6a('0x5'));var rimraf=require(_0x6b6a('0x6'));var config=require(_0x6b6a('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0xb5bba7,_0x46fc69){return _0xb5bba7[_0x6b6a('0x8')](_0x6b6a('0x9'),attributes,{'tableName':_0x6b6a('0xa'),'paranoid':![],'indexes':[{'name':_0x6b6a('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa41a=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','report_mail_transfer','uniqueid','lodash'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa41a,0x6b));var _0xaa41=function(_0x3bc9e0,_0x11d9e8){_0x3bc9e0=_0x3bc9e0-0x0;var _0x5c51fc=_0xa41a[_0x3bc9e0];return _0x5c51fc;};'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']('MailTransferReport',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[{'name':_0xaa41('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 d275b7d..6d2d0ee 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 _0x1df9=['error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x434752,_0x2985b5){var _0x28b498=function(_0x210cfe){while(--_0x210cfe){_0x434752['push'](_0x434752['shift']());}};_0x28b498(++_0x2985b5);}(_0x1df9,0x9e));var _0x91df=function(_0x5a0769,_0x367f43){_0x5a0769=_0x5a0769-0x0;var _0x131698=_0x1df9[_0x5a0769];return _0x131698;};'use strict';var _=require('lodash');var util=require(_0x91df('0x0'));var moment=require(_0x91df('0x1'));var BPromise=require(_0x91df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91df('0x3'))['db'];var utils=require(_0x91df('0x4'));var logger=require(_0x91df('0x5'))(_0x91df('0x6'));var config=require(_0x91df('0x7'));var jayson=require(_0x91df('0x8'));var client=jayson[_0x91df('0x9')][_0x91df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f43b5,_0x3516e4,_0x2beae0){return new BPromise(function(_0x5d0e7c,_0x21d15a){return client['request'](_0x2f43b5,_0x2beae0)[_0x91df('0xb')](function(_0x54a6df){logger[_0x91df('0xc')](_0x91df('0xd'),_0x3516e4,_0x91df('0xe'));logger[_0x91df('0xf')](_0x91df('0x10'),_0x3516e4,_0x91df('0xe'),JSON[_0x91df('0x11')](_0x54a6df));if(_0x54a6df[_0x91df('0x12')]){if(_0x54a6df[_0x91df('0x12')][_0x91df('0x13')]===0x1f4){logger[_0x91df('0x12')](_0x91df('0xd'),_0x3516e4,_0x54a6df[_0x91df('0x12')][_0x91df('0x14')]);return _0x21d15a(_0x54a6df[_0x91df('0x12')]['message']);}logger[_0x91df('0x12')](_0x91df('0xd'),_0x3516e4,_0x54a6df['error'][_0x91df('0x14')]);return _0x5d0e7c(_0x54a6df[_0x91df('0x12')][_0x91df('0x14')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x3516e4,_0x91df('0xe'));_0x5d0e7c(_0x54a6df['result'][_0x91df('0x14')]);}})[_0x91df('0x15')](function(_0x3f16a3){logger[_0x91df('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x3516e4,_0x3f16a3);_0x21d15a(_0x3f16a3);});});} \ No newline at end of file +var _0x7037=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','randomstring','ioredis'];(function(_0x171bef,_0x4cba08){var _0x28828a=function(_0x19d85c){while(--_0x19d85c){_0x171bef['push'](_0x171bef['shift']());}};_0x28828a(++_0x4cba08);}(_0x7037,0xed));var _0x7703=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7037[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0x7703('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7703('0x1'));var fs=require('fs');var Redis=require(_0x7703('0x2'));var db=require(_0x7703('0x3'))['db'];var utils=require(_0x7703('0x4'));var logger=require('../../config/logger')(_0x7703('0x5'));var config=require(_0x7703('0x6'));var jayson=require(_0x7703('0x7'));var client=jayson[_0x7703('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36e3b1,_0x5b480f,_0x1cbf03){return new BPromise(function(_0xb977b,_0x837bc8){return client[_0x7703('0x9')](_0x36e3b1,_0x1cbf03)['then'](function(_0xe7b77){logger[_0x7703('0xa')](_0x7703('0xb'),_0x5b480f,_0x7703('0xc'));logger[_0x7703('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5b480f,_0x7703('0xc'),JSON[_0x7703('0xe')](_0xe7b77));if(_0xe7b77[_0x7703('0xf')]){if(_0xe7b77[_0x7703('0xf')][_0x7703('0x10')]===0x1f4){logger[_0x7703('0xf')](_0x7703('0xb'),_0x5b480f,_0xe7b77[_0x7703('0xf')]['message']);return _0x837bc8(_0xe7b77[_0x7703('0xf')][_0x7703('0x11')]);}logger[_0x7703('0xf')](_0x7703('0xb'),_0x5b480f,_0xe7b77['error'][_0x7703('0x11')]);return _0xb977b(_0xe7b77[_0x7703('0xf')]['message']);}else{logger[_0x7703('0xa')](_0x7703('0xb'),_0x5b480f,'request\x20sent');_0xb977b(_0xe7b77[_0x7703('0x12')][_0x7703('0x11')]);}})[_0x7703('0x13')](function(_0x2ac49d){logger[_0x7703('0xf')](_0x7703('0xb'),_0x5b480f,_0x2ac49d);_0x837bc8(_0x2ac49d);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 2490b5d..2a64025 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 _0x9508=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','index','get','describe','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x5b0f89,_0x303a8b){var _0x21ae25=function(_0x1726af){while(--_0x1726af){_0x5b0f89['push'](_0x5b0f89['shift']());}};_0x21ae25(++_0x303a8b);}(_0x9508,0xd9));var _0x8950=function(_0xba472,_0x4ffe8e){_0xba472=_0xba472-0x0;var _0x177f2f=_0x9508[_0xba472];return _0x177f2f;};'use strict';var multer=require(_0x8950('0x0'));var util=require('util');var path=require(_0x8950('0x1'));var timeout=require(_0x8950('0x2'));var express=require(_0x8950('0x3'));var router=express[_0x8950('0x4')]();var fs_extra=require(_0x8950('0x5'));var auth=require(_0x8950('0x6'));var interaction=require(_0x8950('0x7'));var config=require(_0x8950('0x8'));var controller=require(_0x8950('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8950('0xa')]);router[_0x8950('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x8950('0xc')]);router['get'](_0x8950('0xd'),auth['isAuthenticated'](),controller[_0x8950('0xe')]);router[_0x8950('0xf')]('/',auth[_0x8950('0x10')](),controller[_0x8950('0x11')]);router[_0x8950('0x12')](_0x8950('0xd'),auth[_0x8950('0x10')](),controller[_0x8950('0x13')]);router[_0x8950('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8950('0x15')]);module['exports']=router; \ No newline at end of file +var _0x3905=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x7fb522,_0x5adcba){var _0x1b4e93=function(_0x2c77cf){while(--_0x2c77cf){_0x7fb522['push'](_0x7fb522['shift']());}};_0x1b4e93(++_0x5adcba);}(_0x3905,0x19f));var _0x5390=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x3905[_0x326e79];return _0x37eb89;};'use strict';var multer=require(_0x5390('0x0'));var util=require(_0x5390('0x1'));var path=require(_0x5390('0x2'));var timeout=require(_0x5390('0x3'));var express=require(_0x5390('0x4'));var router=express['Router']();var fs_extra=require(_0x5390('0x5'));var auth=require(_0x5390('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5390('0x7'));var controller=require(_0x5390('0x8'));router[_0x5390('0x9')]('/',auth[_0x5390('0xa')](),controller['index']);router[_0x5390('0x9')](_0x5390('0xb'),auth['isAuthenticated'](),controller[_0x5390('0xc')]);router[_0x5390('0x9')](_0x5390('0xd'),auth[_0x5390('0xa')](),controller[_0x5390('0xe')]);router[_0x5390('0xf')]('/',auth[_0x5390('0xa')](),controller[_0x5390('0x10')]);router[_0x5390('0x11')](_0x5390('0xd'),auth['isAuthenticated'](),controller[_0x5390('0x12')]);router[_0x5390('0x13')](_0x5390('0xd'),auth[_0x5390('0xa')](),controller[_0x5390('0x14')]);module[_0x5390('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index fab24e6..ee47f78 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 _0x215e=['enterAt','diff','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue'];(function(_0x42a759,_0x1a42b6){var _0x49a799=function(_0x19be92){while(--_0x19be92){_0x42a759['push'](_0x42a759['shift']());}};_0x49a799(++_0x1a42b6);}(_0x215e,0x6f));var _0xe215=function(_0x5699ed,_0x228b81){_0x5699ed=_0x5699ed-0x0;var _0x164ab5=_0x215e[_0x5699ed];return _0x164ab5;};'use strict';var Sequelize=require(_0xe215('0x0'));var moment=require(_0xe215('0x1'));module[_0xe215('0x2')]={'channel':{'type':Sequelize[_0xe215('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xe215('0x3')]},'type':{'type':Sequelize[_0xe215('0x3')],'defaultValue':_0xe215('0x4'),'comment':_0xe215('0x5')},'duration':{'type':Sequelize[_0xe215('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe215('0x7')],'set':function(_0x213653){var _0xc149b1=moment(_0x213653);var _0x1bfa28=moment(this[_0xe215('0x8')](_0xe215('0x9')));var _0x555a53=_0xc149b1[_0xe215('0xa')](_0x1bfa28,'seconds');this[_0xe215('0xb')](_0xe215('0xc'),_0x213653);this[_0xe215('0xb')]('duration',_0x555a53>=0x0?_0x555a53:null);}},'data1':{'type':Sequelize[_0xe215('0x3')],'comment':_0xe215('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0xe215('0xe')},'data3':{'type':Sequelize[_0xe215('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xe215('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xe215('0x3')]},'internal':{'type':Sequelize[_0xe215('0x6')]},'uniqueid':{'type':Sequelize[_0xe215('0x3')]}}; \ No newline at end of file +var _0x311e=['talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x311e,0xc0));var _0xe311=function(_0x53fc2d,_0x5195db){_0x53fc2d=_0x53fc2d-0x0;var _0x5dde27=_0x311e[_0x53fc2d];return _0x5dde27;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe311('0x0'));module[_0xe311('0x1')]={'channel':{'type':Sequelize[_0xe311('0x2')]},'membername':{'type':Sequelize[_0xe311('0x2')]},'interface':{'type':Sequelize[_0xe311('0x2')]},'type':{'type':Sequelize[_0xe311('0x2')],'defaultValue':_0xe311('0x3'),'comment':_0xe311('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe311('0x5')],'set':function(_0x309187){var _0x24f938=moment(_0x309187);var _0x1dea76=moment(this[_0xe311('0x6')](_0xe311('0x7')));var _0x2d9add=_0x24f938[_0xe311('0x8')](_0x1dea76,_0xe311('0x9'));this[_0xe311('0xa')]('exitAt',_0x309187);this[_0xe311('0xa')](_0xe311('0xb'),_0x2d9add>=0x0?_0x2d9add:null);}},'data1':{'type':Sequelize[_0xe311('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0xe311('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0xe311('0xd')},'data4':{'type':Sequelize[_0xe311('0x2')],'comment':_0xe311('0xe')},'data5':{'type':Sequelize[_0xe311('0x2')],'comment':_0xe311('0xf')},'role':{'type':Sequelize[_0xe311('0x2')]},'internal':{'type':Sequelize[_0xe311('0x10')]},'uniqueid':{'type':Sequelize[_0xe311('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 25eaa59..02e79ba 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x55ca,0x126));var _0xa55c=function(_0xe3f360,_0x203484){_0xe3f360=_0xe3f360-0x0;var _0x4b6d3d=_0x55ca[_0xe3f360];return _0x4b6d3d;};'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 _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x4f41fb,_0x252161){var _0x333d7a=function(_0x473be3){while(--_0x473be3){_0x4f41fb['push'](_0x4f41fb['shift']());}};_0x333d7a(++_0x252161);}(_0x3e74,0x175));var _0x43e7=function(_0x3cb1c5,_0x28c1fb){_0x3cb1c5=_0x3cb1c5-0x0;var _0x463f8f=_0x3e74[_0x3cb1c5];return _0x463f8f;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index ea56df3..716fed2 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 _0xeebc=['membername','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','report_member'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xeebc,0x6f));var _0xceeb=function(_0x3b86da,_0x43cb76){_0x3b86da=_0x3b86da-0x0;var _0x355663=_0xeebc[_0x3b86da];return _0x355663;};'use strict';var _=require(_0xceeb('0x0'));var util=require(_0xceeb('0x1'));var logger=require(_0xceeb('0x2'))(_0xceeb('0x3'));var moment=require('moment');var BPromise=require(_0xceeb('0x4'));var rp=require(_0xceeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xceeb('0x6'));var config=require(_0xceeb('0x7'));var attributes=require('./memberReport.attributes');module[_0xceeb('0x8')]=function(_0x38d59e,_0x345e92){return _0x38d59e['define']('MemberReport',attributes,{'tableName':_0xceeb('0x9'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xceeb('0xa'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x34be=['interface','util','rimraf','../../config/environment','exports','MemberReport','membername_interface','membername'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0x34be,0x139));var _0xe34b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x34be[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xe34b('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe34b('0x1'));var config=require(_0xe34b('0x2'));var attributes=require('./memberReport.attributes');module[_0xe34b('0x3')]=function(_0x5f4c78,_0x2c7e9d){return _0x5f4c78['define'](_0xe34b('0x4'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xe34b('0x5'),'fields':[_0xe34b('0x6'),_0xe34b('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 844a05e..4bc7149 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 _0x1fcc=['attributes','map','include','model','GetMemberReport','CreateMemberReport','create','then','UpdateMemberReport','update','body','limit','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','MemberReport','findAll','options','raw','where'];(function(_0x5de4b5,_0x20b249){var _0x2b5fa7=function(_0x1b1b80){while(--_0x1b1b80){_0x5de4b5['push'](_0x5de4b5['shift']());}};_0x2b5fa7(++_0x20b249);}(_0x1fcc,0x125));var _0xc1fc=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x1fcc[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0xc1fc('0x0'));var util=require(_0xc1fc('0x1'));var moment=require('moment');var BPromise=require(_0xc1fc('0x2'));var rs=require(_0xc1fc('0x3'));var fs=require('fs');var Redis=require(_0xc1fc('0x4'));var db=require(_0xc1fc('0x5'))['db'];var utils=require(_0xc1fc('0x6'));var logger=require(_0xc1fc('0x7'))(_0xc1fc('0x8'));var config=require('../../config/environment');var jayson=require(_0xc1fc('0x9'));var client=jayson[_0xc1fc('0xa')][_0xc1fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4df2ae,_0x1b8560,_0x1f847d){return new BPromise(function(_0x5ae7b3,_0x3a9ad7){return client[_0xc1fc('0xc')](_0x4df2ae,_0x1f847d)['then'](function(_0x3178de){logger['info'](_0xc1fc('0xd'),_0x1b8560,_0xc1fc('0xe'));logger['debug'](_0xc1fc('0xf'),_0x1b8560,_0xc1fc('0xe'),JSON[_0xc1fc('0x10')](_0x3178de));if(_0x3178de[_0xc1fc('0x11')]){if(_0x3178de[_0xc1fc('0x11')]['code']===0x1f4){logger[_0xc1fc('0x11')](_0xc1fc('0xd'),_0x1b8560,_0x3178de[_0xc1fc('0x11')]['message']);return _0x3a9ad7(_0x3178de[_0xc1fc('0x11')][_0xc1fc('0x12')]);}logger[_0xc1fc('0x11')]('MemberReport,\x20%s,\x20%s',_0x1b8560,_0x3178de[_0xc1fc('0x11')][_0xc1fc('0x12')]);return _0x5ae7b3(_0x3178de[_0xc1fc('0x11')][_0xc1fc('0x12')]);}else{logger[_0xc1fc('0x13')](_0xc1fc('0xd'),_0x1b8560,_0xc1fc('0xe'));_0x5ae7b3(_0x3178de[_0xc1fc('0x14')][_0xc1fc('0x12')]);}})[_0xc1fc('0x15')](function(_0x5823ae){logger[_0xc1fc('0x11')]('MemberReport,\x20%s,\x20%s',_0x1b8560,_0x5823ae);_0x3a9ad7(_0x5823ae);});});}exports['GetMemberReport']=function(_0x6c0e26){var _0x20f4ec=this;return new Promise(function(_0x3fba13,_0x8f5528){return db[_0xc1fc('0x16')][_0xc1fc('0x17')]({'raw':_0x6c0e26[_0xc1fc('0x18')]?_0x6c0e26[_0xc1fc('0x18')][_0xc1fc('0x19')]===undefined?!![]:![]:!![],'where':_0x6c0e26['options']?_0x6c0e26[_0xc1fc('0x18')][_0xc1fc('0x1a')]||null:null,'attributes':_0x6c0e26['options']?_0x6c0e26['options'][_0xc1fc('0x1b')]||null:null,'limit':_0x6c0e26[_0xc1fc('0x18')]?_0x6c0e26[_0xc1fc('0x18')]['limit']||null:null,'include':_0x6c0e26[_0xc1fc('0x18')]?_0x6c0e26['options']['include']?_[_0xc1fc('0x1c')](_0x6c0e26[_0xc1fc('0x18')][_0xc1fc('0x1d')],function(_0x3aacf2){return{'model':db[_0x3aacf2[_0xc1fc('0x1e')]],'as':_0x3aacf2['as'],'attributes':_0x3aacf2[_0xc1fc('0x1b')],'include':_0x3aacf2['include']?_[_0xc1fc('0x1c')](_0x3aacf2['include'],function(_0x27723f){return{'model':db[_0x27723f[_0xc1fc('0x1e')]],'as':_0x27723f['as'],'attributes':_0x27723f['attributes'],'include':_0x27723f[_0xc1fc('0x1d')]?_[_0xc1fc('0x1c')](_0x27723f[_0xc1fc('0x1d')],function(_0x23594f){return{'model':db[_0x23594f[_0xc1fc('0x1e')]],'as':_0x23594f['as'],'attributes':_0x23594f[_0xc1fc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x369914){logger[_0xc1fc('0x13')](_0xc1fc('0x1f'),_0x6c0e26);logger['debug'](_0xc1fc('0x1f'),_0x6c0e26,JSON['stringify'](_0x369914));_0x3fba13(_0x369914);})[_0xc1fc('0x15')](function(_0x1977a4){logger[_0xc1fc('0x11')](_0xc1fc('0x1f'),_0x1977a4[_0xc1fc('0x12')],_0x6c0e26);_0x8f5528(_0x20f4ec[_0xc1fc('0x11')](0x1f4,_0x1977a4['message']));});});};exports[_0xc1fc('0x20')]=function(_0x56f217){var _0x2dd3b5=this;return new Promise(function(_0x346b0d,_0x53d9d1){return db['MemberReport'][_0xc1fc('0x21')](_0x56f217['body'],{'raw':_0x56f217[_0xc1fc('0x18')]?_0x56f217[_0xc1fc('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xc1fc('0x22')](function(_0x4a29cd){logger[_0xc1fc('0x13')](_0xc1fc('0x20'),_0x56f217);logger['debug'](_0xc1fc('0x20'),_0x56f217,JSON[_0xc1fc('0x10')](_0x4a29cd));_0x346b0d(_0x4a29cd);})['catch'](function(_0x459252){logger[_0xc1fc('0x11')]('CreateMemberReport',_0x459252[_0xc1fc('0x12')],_0x56f217);_0x53d9d1(_0x2dd3b5['error'](0x1f4,_0x459252['message']));});});};exports[_0xc1fc('0x23')]=function(_0x28aa90){var _0x485f79=this;return new Promise(function(_0x251e28,_0x46d2a0){return db[_0xc1fc('0x16')][_0xc1fc('0x24')](_0x28aa90[_0xc1fc('0x25')],{'raw':_0x28aa90[_0xc1fc('0x18')]?_0x28aa90[_0xc1fc('0x18')][_0xc1fc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28aa90[_0xc1fc('0x18')]?_0x28aa90['options']['where']||null:null,'attributes':_0x28aa90[_0xc1fc('0x18')]?_0x28aa90['options'][_0xc1fc('0x1b')]||null:null,'limit':_0x28aa90[_0xc1fc('0x18')]?_0x28aa90[_0xc1fc('0x18')][_0xc1fc('0x26')]||null:null})['then'](function(_0x5942c5){logger[_0xc1fc('0x13')](_0xc1fc('0x23'),_0x28aa90);logger[_0xc1fc('0x27')](_0xc1fc('0x23'),_0x28aa90,JSON[_0xc1fc('0x10')](_0x5942c5));_0x251e28(_0x5942c5);})[_0xc1fc('0x15')](function(_0x26f130){logger[_0xc1fc('0x11')]('UpdateMemberReport',_0x26f130['message'],_0x28aa90);_0x46d2a0(_0x485f79[_0xc1fc('0x11')](0x1f4,_0x26f130['message']));});});}; \ No newline at end of file +var _0x1203=['error','code','message','result','GetMemberReport','MemberReport','options','raw','attributes','limit','include','model','map','then','catch','CreateMemberReport','create','UpdateMemberReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1203,0x8c));var _0x3120=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1203[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3120('0x0'));var util=require(_0x3120('0x1'));var moment=require(_0x3120('0x2'));var BPromise=require(_0x3120('0x3'));var rs=require(_0x3120('0x4'));var fs=require('fs');var Redis=require(_0x3120('0x5'));var db=require(_0x3120('0x6'))['db'];var utils=require(_0x3120('0x7'));var logger=require(_0x3120('0x8'))(_0x3120('0x9'));var config=require(_0x3120('0xa'));var jayson=require(_0x3120('0xb'));var client=jayson[_0x3120('0xc')][_0x3120('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ac620,_0x1f1c97,_0x5e9785){return new BPromise(function(_0x1fa4b8,_0x513da6){return client['request'](_0x2ac620,_0x5e9785)['then'](function(_0x580f86){logger[_0x3120('0xe')](_0x3120('0xf'),_0x1f1c97,'request\x20sent');logger[_0x3120('0x10')](_0x3120('0x11'),_0x1f1c97,_0x3120('0x12'),JSON[_0x3120('0x13')](_0x580f86));if(_0x580f86['error']){if(_0x580f86[_0x3120('0x14')][_0x3120('0x15')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x1f1c97,_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);return _0x513da6(_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);}logger[_0x3120('0x14')](_0x3120('0xf'),_0x1f1c97,_0x580f86[_0x3120('0x14')]['message']);return _0x1fa4b8(_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);}else{logger[_0x3120('0xe')](_0x3120('0xf'),_0x1f1c97,_0x3120('0x12'));_0x1fa4b8(_0x580f86[_0x3120('0x17')][_0x3120('0x16')]);}})['catch'](function(_0x308873){logger['error'](_0x3120('0xf'),_0x1f1c97,_0x308873);_0x513da6(_0x308873);});});}exports[_0x3120('0x18')]=function(_0x2bbdb7){var _0x1a513c=this;return new Promise(function(_0x3c8c9b,_0x3af913){return db[_0x3120('0x19')]['findAll']({'raw':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1b')]===undefined?!![]:![]:!![],'where':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7[_0x3120('0x1a')]['where']||null:null,'attributes':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1c')]||null:null,'limit':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1d')]||null:null,'include':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7[_0x3120('0x1a')][_0x3120('0x1e')]?_['map'](_0x2bbdb7[_0x3120('0x1a')]['include'],function(_0x444b3b){return{'model':db[_0x444b3b[_0x3120('0x1f')]],'as':_0x444b3b['as'],'attributes':_0x444b3b[_0x3120('0x1c')],'include':_0x444b3b['include']?_['map'](_0x444b3b[_0x3120('0x1e')],function(_0x7d0b5f){return{'model':db[_0x7d0b5f['model']],'as':_0x7d0b5f['as'],'attributes':_0x7d0b5f[_0x3120('0x1c')],'include':_0x7d0b5f[_0x3120('0x1e')]?_[_0x3120('0x20')](_0x7d0b5f['include'],function(_0x2636b5){return{'model':db[_0x2636b5[_0x3120('0x1f')]],'as':_0x2636b5['as'],'attributes':_0x2636b5[_0x3120('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3120('0x21')](function(_0x4b343b){logger['info']('GetMemberReport',_0x2bbdb7);logger[_0x3120('0x10')]('GetMemberReport',_0x2bbdb7,JSON[_0x3120('0x13')](_0x4b343b));_0x3c8c9b(_0x4b343b);})[_0x3120('0x22')](function(_0x3de290){logger[_0x3120('0x14')](_0x3120('0x18'),_0x3de290[_0x3120('0x16')],_0x2bbdb7);_0x3af913(_0x1a513c['error'](0x1f4,_0x3de290[_0x3120('0x16')]));});});};exports[_0x3120('0x23')]=function(_0x1471de){var _0x1ee7bc=this;return new Promise(function(_0x6ba5,_0x35e69f){return db[_0x3120('0x19')][_0x3120('0x24')](_0x1471de['body'],{'raw':_0x1471de['options']?_0x1471de[_0x3120('0x1a')][_0x3120('0x1b')]===undefined?!![]:![]:!![]})[_0x3120('0x21')](function(_0x34beab){logger[_0x3120('0xe')](_0x3120('0x23'),_0x1471de);logger['debug'](_0x3120('0x23'),_0x1471de,JSON[_0x3120('0x13')](_0x34beab));_0x6ba5(_0x34beab);})[_0x3120('0x22')](function(_0x2d786a){logger[_0x3120('0x14')](_0x3120('0x23'),_0x2d786a[_0x3120('0x16')],_0x1471de);_0x35e69f(_0x1ee7bc['error'](0x1f4,_0x2d786a[_0x3120('0x16')]));});});};exports[_0x3120('0x25')]=function(_0x2d6b82){var _0x2f80f1=this;return new Promise(function(_0x3067ca,_0x3d0d05){return db[_0x3120('0x19')][_0x3120('0x26')](_0x2d6b82[_0x3120('0x27')],{'raw':_0x2d6b82[_0x3120('0x1a')]?_0x2d6b82[_0x3120('0x1a')][_0x3120('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d6b82[_0x3120('0x1a')]?_0x2d6b82['options']['where']||null:null,'attributes':_0x2d6b82[_0x3120('0x1a')]?_0x2d6b82[_0x3120('0x1a')][_0x3120('0x1c')]||null:null,'limit':_0x2d6b82['options']?_0x2d6b82[_0x3120('0x1a')][_0x3120('0x1d')]||null:null})[_0x3120('0x21')](function(_0x5d414e){logger[_0x3120('0xe')](_0x3120('0x25'),_0x2d6b82);logger[_0x3120('0x10')](_0x3120('0x25'),_0x2d6b82,JSON[_0x3120('0x13')](_0x5d414e));_0x3067ca(_0x5d414e);})[_0x3120('0x22')](function(_0x4bbc5d){logger['error']('UpdateMemberReport',_0x4bbc5d[_0x3120('0x16')],_0x2d6b82);_0x3d0d05(_0x2f80f1['error'](0x1f4,_0x4bbc5d[_0x3120('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d881aee..7fd5bc0 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 _0x43a6=['get','index','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./migration.controller'];(function(_0x3f6a30,_0x53f3fc){var _0x192186=function(_0x45135e){while(--_0x45135e){_0x3f6a30['push'](_0x3f6a30['shift']());}};_0x192186(++_0x53f3fc);}(_0x43a6,0x9d));var _0x643a=function(_0x12d6c2,_0x409bc8){_0x12d6c2=_0x12d6c2-0x0;var _0x1c9825=_0x43a6[_0x12d6c2];return _0x1c9825;};'use strict';var multer=require(_0x643a('0x0'));var util=require(_0x643a('0x1'));var path=require(_0x643a('0x2'));var timeout=require('connect-timeout');var express=require(_0x643a('0x3'));var router=express[_0x643a('0x4')]();var fs_extra=require(_0x643a('0x5'));var auth=require(_0x643a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x643a('0x7'));router[_0x643a('0x8')]('/',controller[_0x643a('0x9')]);module[_0x643a('0xa')]=router; \ No newline at end of file +var _0xdadf=['get','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x23094d,_0x5b0e1d){var _0x479e8e=function(_0x13279e){while(--_0x13279e){_0x23094d['push'](_0x23094d['shift']());}};_0x479e8e(++_0x5b0e1d);}(_0xdadf,0xc8));var _0xfdad=function(_0x1d67d8,_0x48d186){_0x1d67d8=_0x1d67d8-0x0;var _0x1ff88f=_0xdadf[_0x1d67d8];return _0x1ff88f;};'use strict';var multer=require(_0xfdad('0x0'));var util=require('util');var path=require(_0xfdad('0x1'));var timeout=require(_0xfdad('0x2'));var express=require('express');var router=express[_0xfdad('0x3')]();var fs_extra=require(_0xfdad('0x4'));var auth=require(_0xfdad('0x5'));var interaction=require(_0xfdad('0x6'));var config=require(_0xfdad('0x7'));var controller=require(_0xfdad('0x8'));router[_0xfdad('0x9')]('/',controller['index']);module[_0xfdad('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 16661aa..081bade 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 _0x638c=['exports','STRING','version','sequelize'];(function(_0xab4a7c,_0x28b640){var _0x4b0bd2=function(_0x254009){while(--_0x254009){_0xab4a7c['push'](_0xab4a7c['shift']());}};_0x4b0bd2(++_0x28b640);}(_0x638c,0xf7));var _0xc638=function(_0x2af7e3,_0x1ae648){_0x2af7e3=_0x2af7e3-0x0;var _0x49890b=_0x638c[_0x2af7e3];return _0x49890b;};'use strict';var Sequelize=require(_0xc638('0x0'));module[_0xc638('0x1')]={'version':{'type':Sequelize[_0xc638('0x2')],'unique':_0xc638('0x3')}}; \ No newline at end of file +var _0xbd30=['sequelize','STRING'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xbd30,0x9e));var _0x0bd3=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xbd30[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0x0bd3('0x0'));module['exports']={'version':{'type':Sequelize[_0x0bd3('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index dd82749..449fa3d 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 _0x44e8=['count','includeAll','include','findAll','rows','eml-format','fast-json-patch','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','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','then','destroy','end','error','name','send','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x23a79e,_0x235f89){var _0x3dab57=function(_0x346cf4){while(--_0x346cf4){_0x23a79e['push'](_0x23a79e['shift']());}};_0x3dab57(++_0x235f89);}(_0x44e8,0xd7));var _0x844e=function(_0x2e9a89,_0x54bcf8){_0x2e9a89=_0x2e9a89-0x0;var _0x4c4a6e=_0x44e8[_0x2e9a89];return _0x4c4a6e;};'use strict';var emlformat=require(_0x844e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x844e('0x1'));var rp=require(_0x844e('0x2'));var moment=require(_0x844e('0x3'));var BPromise=require(_0x844e('0x4'));var Mustache=require('mustache');var util=require(_0x844e('0x5'));var path=require(_0x844e('0x6'));var sox=require(_0x844e('0x7'));var csv=require(_0x844e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x844e('0x9'));var _=require(_0x844e('0xa'));var squel=require(_0x844e('0xb'));var crypto=require(_0x844e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x844e('0xd'));var toCsv=require(_0x844e('0x8'));var querystring=require(_0x844e('0xe'));var Papa=require(_0x844e('0xf'));var Redis=require(_0x844e('0x10'));var authService=require(_0x844e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x844e('0x12'));var hardwareService=require(_0x844e('0x13'));var logger=require(_0x844e('0x14'))(_0x844e('0x15'));var utils=require(_0x844e('0x16'));var config=require(_0x844e('0x17'));var licenseUtil=require(_0x844e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8d3bea,_0x23df3f){_0x23df3f=_0x23df3f||0xcc;return function(_0x52ac76){if(_0x52ac76){return _0x8d3bea[_0x844e('0x19')](_0x23df3f);}return _0x8d3bea[_0x844e('0x1a')](_0x23df3f)['end']();};}function respondWithResult(_0x1f48e2,_0x6b542d){_0x6b542d=_0x6b542d||0xc8;return function(_0x1c1689){if(_0x1c1689){return _0x1f48e2['status'](_0x6b542d)[_0x844e('0x1b')](_0x1c1689);}};}function respondWithFilteredResult(_0x465e49,_0x380eb4){return function(_0x935134){if(_0x935134){var _0x2588a3=typeof _0x380eb4[_0x844e('0x1c')]===_0x844e('0x1d')&&typeof _0x380eb4[_0x844e('0x1e')]==='undefined';var _0x36286c=_0x935134['count'];var _0x3c307f=_0x2588a3?0x0:_0x380eb4['offset'];var _0x315c50=_0x2588a3?_0x935134['count']:_0x380eb4[_0x844e('0x1c')]+_0x380eb4[_0x844e('0x1e')];var _0x2d6ba8;if(_0x315c50>=_0x36286c){_0x315c50=_0x36286c;_0x2d6ba8=0xc8;}else{_0x2d6ba8=0xce;}_0x465e49[_0x844e('0x1a')](_0x2d6ba8);return _0x465e49[_0x844e('0x1f')](_0x844e('0x20'),_0x3c307f+'-'+_0x315c50+'/'+_0x36286c)[_0x844e('0x1b')](_0x935134);}return null;};}function patchUpdates(_0x243aeb){return function(_0x4ffb86){try{jsonpatch[_0x844e('0x21')](_0x4ffb86,_0x243aeb,!![]);}catch(_0x50aeec){return BPromise['reject'](_0x50aeec);}return _0x4ffb86[_0x844e('0x22')]();};}function saveUpdates(_0x345dcc,_0x439b26){return function(_0x286fdd){if(_0x286fdd){return _0x286fdd['update'](_0x345dcc)[_0x844e('0x23')](function(_0x3dde07){return _0x3dde07;});}return null;};}function removeEntity(_0x571498,_0x2520f8){return function(_0x13489b){if(_0x13489b){return _0x13489b[_0x844e('0x24')]()[_0x844e('0x23')](function(){_0x571498[_0x844e('0x1a')](0xcc)[_0x844e('0x25')]();});}};}function handleEntityNotFound(_0x498ae0,_0x399a81){return function(_0xadf0d8){if(!_0xadf0d8){_0x498ae0[_0x844e('0x19')](0x194);}return _0xadf0d8;};}function handleError(_0x263702,_0x2c915f){_0x2c915f=_0x2c915f||0x1f4;return function(_0x5d6856){logger[_0x844e('0x26')](_0x5d6856['stack']);if(_0x5d6856['name']){delete _0x5d6856[_0x844e('0x27')];}_0x263702[_0x844e('0x1a')](_0x2c915f)[_0x844e('0x28')](_0x5d6856);};}exports['index']=function(_0x489349,_0x2d4acd){var _0xc3ec93={},_0x54fd73={},_0x228cc1={'count':0x0,'rows':[]};var _0x81d4de=_[_0x844e('0x29')](db[_0x844e('0x2a')][_0x844e('0x2b')],function(_0x799cde){return{'name':_0x799cde[_0x844e('0x2c')],'type':_0x799cde[_0x844e('0x2d')][_0x844e('0x2e')]};});_0x54fd73[_0x844e('0x2f')]=_['map'](_0x81d4de,_0x844e('0x27'));_0x54fd73[_0x844e('0x30')]=_[_0x844e('0x31')](_0x489349[_0x844e('0x30')]);_0x54fd73[_0x844e('0x32')]=_[_0x844e('0x33')](_0x54fd73[_0x844e('0x2f')],_0x54fd73['query']);_0xc3ec93[_0x844e('0x34')]=_[_0x844e('0x33')](_0x54fd73[_0x844e('0x2f')],qs['fields'](_0x489349[_0x844e('0x30')][_0x844e('0x35')]));_0xc3ec93['attributes']=_0xc3ec93[_0x844e('0x34')][_0x844e('0x36')]?_0xc3ec93['attributes']:_0x54fd73[_0x844e('0x2f')];if(!_0x489349[_0x844e('0x30')][_0x844e('0x37')](_0x844e('0x38'))){_0xc3ec93[_0x844e('0x1e')]=qs[_0x844e('0x1e')](_0x489349[_0x844e('0x30')]['limit']);_0xc3ec93[_0x844e('0x1c')]=qs[_0x844e('0x1c')](_0x489349[_0x844e('0x30')][_0x844e('0x1c')]);}_0xc3ec93[_0x844e('0x39')]=qs[_0x844e('0x3a')](_0x489349[_0x844e('0x30')][_0x844e('0x3a')]);_0xc3ec93[_0x844e('0x3b')]=qs[_0x844e('0x32')](_[_0x844e('0x3c')](_0x489349['query'],_0x54fd73['filters']),_0x81d4de);if(_0x489349[_0x844e('0x30')][_0x844e('0x3d')]){_0xc3ec93[_0x844e('0x3b')]=_[_0x844e('0x3e')](_0xc3ec93[_0x844e('0x3b')],{'$or':_[_0x844e('0x29')](_0x81d4de,function(_0x6f902e){if(_0x6f902e[_0x844e('0x2d')]!==_0x844e('0x3f')){var _0x539077={};_0x539077[_0x6f902e[_0x844e('0x27')]]={'$like':'%'+_0x489349['query'][_0x844e('0x3d')]+'%'};return _0x539077;}})});}_0xc3ec93=_['merge']({},_0xc3ec93,_0x489349[_0x844e('0x40')]);var _0x5dc530={'where':_0xc3ec93[_0x844e('0x3b')]};return db[_0x844e('0x2a')][_0x844e('0x41')](_0x5dc530)[_0x844e('0x23')](function(_0x2eb412){_0x228cc1[_0x844e('0x41')]=_0x2eb412;if(_0x489349[_0x844e('0x30')][_0x844e('0x42')]){_0xc3ec93[_0x844e('0x43')]=[{'all':!![]}];}return db[_0x844e('0x2a')][_0x844e('0x44')](_0xc3ec93);})['then'](function(_0x3ecb60){_0x228cc1[_0x844e('0x45')]=_0x3ecb60;return _0x228cc1;})[_0x844e('0x23')](respondWithFilteredResult(_0x2d4acd,_0xc3ec93))['catch'](handleError(_0x2d4acd,null));}; \ No newline at end of file +var _0x8809=['Migration','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','findAll','then','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','Content-Range','reject','update','destroy','error','stack','name','index'];(function(_0xa2f2c0,_0x1bd315){var _0x3f2623=function(_0x38ff37){while(--_0x38ff37){_0xa2f2c0['push'](_0xa2f2c0['shift']());}};_0x3f2623(++_0x1bd315);}(_0x8809,0x171));var _0x9880=function(_0x299d27,_0x4cbc19){_0x299d27=_0x299d27-0x0;var _0x5692a1=_0x8809[_0x299d27];return _0x5692a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9880('0x0'));var zipdir=require(_0x9880('0x1'));var jsonpatch=require(_0x9880('0x2'));var rp=require(_0x9880('0x3'));var moment=require(_0x9880('0x4'));var BPromise=require(_0x9880('0x5'));var Mustache=require(_0x9880('0x6'));var util=require(_0x9880('0x7'));var path=require(_0x9880('0x8'));var sox=require(_0x9880('0x9'));var csv=require(_0x9880('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9880('0xb'));var _=require(_0x9880('0xc'));var squel=require(_0x9880('0xd'));var crypto=require(_0x9880('0xe'));var jsforce=require(_0x9880('0xf'));var deskjs=require(_0x9880('0x10'));var toCsv=require(_0x9880('0xa'));var querystring=require(_0x9880('0x11'));var Papa=require(_0x9880('0x12'));var Redis=require(_0x9880('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9880('0x14'));var as=require(_0x9880('0x15'));var hardwareService=require(_0x9880('0x16'));var logger=require(_0x9880('0x17'))(_0x9880('0x18'));var utils=require(_0x9880('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x9880('0x1a'));var db=require(_0x9880('0x1b'))['db'];function respondWithStatusCode(_0x2a8aa9,_0x16f0b7){_0x16f0b7=_0x16f0b7||0xcc;return function(_0x12697b){if(_0x12697b){return _0x2a8aa9[_0x9880('0x1c')](_0x16f0b7);}return _0x2a8aa9['status'](_0x16f0b7)[_0x9880('0x1d')]();};}function respondWithResult(_0x2eb6af,_0x1d0a1f){_0x1d0a1f=_0x1d0a1f||0xc8;return function(_0x15e8d4){if(_0x15e8d4){return _0x2eb6af[_0x9880('0x1e')](_0x1d0a1f)[_0x9880('0x1f')](_0x15e8d4);}};}function respondWithFilteredResult(_0x5a6cb6,_0x5efd6e){return function(_0x3f967d){if(_0x3f967d){var _0x3e92e3=typeof _0x5efd6e[_0x9880('0x20')]===_0x9880('0x21')&&typeof _0x5efd6e[_0x9880('0x22')]==='undefined';var _0x1d9108=_0x3f967d['count'];var _0x66bba0=_0x3e92e3?0x0:_0x5efd6e[_0x9880('0x20')];var _0x59d4bf=_0x3e92e3?_0x3f967d[_0x9880('0x23')]:_0x5efd6e[_0x9880('0x20')]+_0x5efd6e[_0x9880('0x22')];var _0x2edcd8;if(_0x59d4bf>=_0x1d9108){_0x59d4bf=_0x1d9108;_0x2edcd8=0xc8;}else{_0x2edcd8=0xce;}_0x5a6cb6[_0x9880('0x1e')](_0x2edcd8);return _0x5a6cb6[_0x9880('0x24')](_0x9880('0x25'),_0x66bba0+'-'+_0x59d4bf+'/'+_0x1d9108)[_0x9880('0x1f')](_0x3f967d);}return null;};}function patchUpdates(_0x486cec){return function(_0x384077){try{jsonpatch['apply'](_0x384077,_0x486cec,!![]);}catch(_0x1b9ddf){return BPromise[_0x9880('0x26')](_0x1b9ddf);}return _0x384077['save']();};}function saveUpdates(_0x1a5e72,_0x18dce5){return function(_0x49620c){if(_0x49620c){return _0x49620c[_0x9880('0x27')](_0x1a5e72)['then'](function(_0x5f1e8f){return _0x5f1e8f;});}return null;};}function removeEntity(_0x162766,_0x3235fb){return function(_0x42e673){if(_0x42e673){return _0x42e673[_0x9880('0x28')]()['then'](function(){_0x162766['status'](0xcc)[_0x9880('0x1d')]();});}};}function handleEntityNotFound(_0x5d7216,_0x391f48){return function(_0x5b94cd){if(!_0x5b94cd){_0x5d7216['sendStatus'](0x194);}return _0x5b94cd;};}function handleError(_0x5c4ac9,_0x1ae548){_0x1ae548=_0x1ae548||0x1f4;return function(_0xe883eb){logger[_0x9880('0x29')](_0xe883eb[_0x9880('0x2a')]);if(_0xe883eb[_0x9880('0x2b')]){delete _0xe883eb['name'];}_0x5c4ac9['status'](_0x1ae548)['send'](_0xe883eb);};}exports[_0x9880('0x2c')]=function(_0x4de96f,_0x21d4ef){var _0x1e9844={},_0x5697ff={},_0x396e42={'count':0x0,'rows':[]};var _0x3ea403=_['map'](db[_0x9880('0x2d')][_0x9880('0x2e')],function(_0x1232c0){return{'name':_0x1232c0[_0x9880('0x2f')],'type':_0x1232c0[_0x9880('0x30')]['key']};});_0x5697ff['model']=_['map'](_0x3ea403,'name');_0x5697ff[_0x9880('0x31')]=_[_0x9880('0x32')](_0x4de96f['query']);_0x5697ff[_0x9880('0x33')]=_[_0x9880('0x34')](_0x5697ff['model'],_0x5697ff[_0x9880('0x31')]);_0x1e9844[_0x9880('0x35')]=_[_0x9880('0x34')](_0x5697ff[_0x9880('0x36')],qs[_0x9880('0x37')](_0x4de96f[_0x9880('0x31')][_0x9880('0x37')]));_0x1e9844['attributes']=_0x1e9844[_0x9880('0x35')]['length']?_0x1e9844[_0x9880('0x35')]:_0x5697ff[_0x9880('0x36')];if(!_0x4de96f[_0x9880('0x31')][_0x9880('0x38')](_0x9880('0x39'))){_0x1e9844[_0x9880('0x22')]=qs[_0x9880('0x22')](_0x4de96f[_0x9880('0x31')][_0x9880('0x22')]);_0x1e9844[_0x9880('0x20')]=qs[_0x9880('0x20')](_0x4de96f[_0x9880('0x31')][_0x9880('0x20')]);}_0x1e9844[_0x9880('0x3a')]=qs[_0x9880('0x3b')](_0x4de96f[_0x9880('0x31')][_0x9880('0x3b')]);_0x1e9844[_0x9880('0x3c')]=qs[_0x9880('0x33')](_[_0x9880('0x3d')](_0x4de96f['query'],_0x5697ff['filters']),_0x3ea403);if(_0x4de96f[_0x9880('0x31')][_0x9880('0x3e')]){_0x1e9844['where']=_[_0x9880('0x3f')](_0x1e9844[_0x9880('0x3c')],{'$or':_[_0x9880('0x40')](_0x3ea403,function(_0x25461a){if(_0x25461a['type']!=='VIRTUAL'){var _0x1bd918={};_0x1bd918[_0x25461a['name']]={'$like':'%'+_0x4de96f[_0x9880('0x31')][_0x9880('0x3e')]+'%'};return _0x1bd918;}})});}_0x1e9844=_['merge']({},_0x1e9844,_0x4de96f[_0x9880('0x41')]);var _0x40ab46={'where':_0x1e9844[_0x9880('0x3c')]};return db[_0x9880('0x2d')]['count'](_0x40ab46)['then'](function(_0x57132f){_0x396e42['count']=_0x57132f;if(_0x4de96f[_0x9880('0x31')]['includeAll']){_0x1e9844['include']=[{'all':!![]}];}return db['Migration'][_0x9880('0x42')](_0x1e9844);})[_0x9880('0x43')](function(_0x38fdf2){_0x396e42['rows']=_0x38fdf2;return _0x396e42;})[_0x9880('0x43')](respondWithFilteredResult(_0x21d4ef,_0x1e9844))[_0x9880('0x44')](handleError(_0x21d4ef,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e19dab5..4895a43 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 _0xe7cf=['request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','migrations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x156dee,_0xaa7c23){var _0x1a6e5f=function(_0x56cfe4){while(--_0x56cfe4){_0x156dee['push'](_0x156dee['shift']());}};_0x1a6e5f(++_0xaa7c23);}(_0xe7cf,0x1c1));var _0xfe7c=function(_0x568427,_0x742280){_0x568427=_0x568427-0x0;var _0x3c2f86=_0xe7cf[_0x568427];return _0x3c2f86;};'use strict';var _=require(_0xfe7c('0x0'));var util=require(_0xfe7c('0x1'));var logger=require(_0xfe7c('0x2'))(_0xfe7c('0x3'));var moment=require(_0xfe7c('0x4'));var BPromise=require(_0xfe7c('0x5'));var rp=require(_0xfe7c('0x6'));var fs=require('fs');var path=require(_0xfe7c('0x7'));var rimraf=require(_0xfe7c('0x8'));var config=require(_0xfe7c('0x9'));var attributes=require(_0xfe7c('0xa'));module[_0xfe7c('0xb')]=function(_0x3fa120,_0x11791b){return _0x3fa120['define']('Migration',attributes,{'tableName':_0xfe7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9ef=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1f058b,_0x4a47cf){var _0x5c5232=function(_0x11eee8){while(--_0x11eee8){_0x1f058b['push'](_0x1f058b['shift']());}};_0x5c5232(++_0x4a47cf);}(_0xf9ef,0x10b));var _0xff9e=function(_0xbeaf26,_0x4bd9a7){_0xbeaf26=_0xbeaf26-0x0;var _0x53d7b4=_0xf9ef[_0xbeaf26];return _0x53d7b4;};'use strict';var _=require('lodash');var util=require(_0xff9e('0x0'));var logger=require(_0xff9e('0x1'))(_0xff9e('0x2'));var moment=require(_0xff9e('0x3'));var BPromise=require(_0xff9e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff9e('0x5'));var rimraf=require(_0xff9e('0x6'));var config=require(_0xff9e('0x7'));var attributes=require(_0xff9e('0x8'));module[_0xff9e('0x9')]=function(_0x1abd43,_0x19f926){return _0x1abd43[_0xff9e('0xa')](_0xff9e('0xb'),attributes,{'tableName':_0xff9e('0xc'),'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 d9fbaed..418eb31 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 _0x4ffe=['../../config/environment','jayson/promise','client','request','info','Migration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x571852,_0x34ae1f){var _0x1ec365=function(_0x398fe5){while(--_0x398fe5){_0x571852['push'](_0x571852['shift']());}};_0x1ec365(++_0x34ae1f);}(_0x4ffe,0x172));var _0xe4ff=function(_0x3efe9b,_0x5b41a8){_0x3efe9b=_0x3efe9b-0x0;var _0x132073=_0x4ffe[_0x3efe9b];return _0x132073;};'use strict';var _=require(_0xe4ff('0x0'));var util=require(_0xe4ff('0x1'));var moment=require(_0xe4ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4ff('0x3'));var fs=require('fs');var Redis=require(_0xe4ff('0x4'));var db=require(_0xe4ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4ff('0x6'))(_0xe4ff('0x7'));var config=require(_0xe4ff('0x8'));var jayson=require(_0xe4ff('0x9'));var client=jayson[_0xe4ff('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eed52,_0x455874,_0x227be1){return new BPromise(function(_0x2aa67c,_0x5b9a40){return client[_0xe4ff('0xb')](_0x5eed52,_0x227be1)['then'](function(_0xc992bd){logger[_0xe4ff('0xc')](_0xe4ff('0xd'),_0x455874,_0xe4ff('0xe'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x455874,_0xe4ff('0xe'),JSON[_0xe4ff('0xf')](_0xc992bd));if(_0xc992bd[_0xe4ff('0x10')]){if(_0xc992bd[_0xe4ff('0x10')][_0xe4ff('0x11')]===0x1f4){logger[_0xe4ff('0x10')]('Migration,\x20%s,\x20%s',_0x455874,_0xc992bd[_0xe4ff('0x10')][_0xe4ff('0x12')]);return _0x5b9a40(_0xc992bd['error'][_0xe4ff('0x12')]);}logger['error'](_0xe4ff('0xd'),_0x455874,_0xc992bd[_0xe4ff('0x10')]['message']);return _0x2aa67c(_0xc992bd[_0xe4ff('0x10')][_0xe4ff('0x12')]);}else{logger[_0xe4ff('0xc')](_0xe4ff('0xd'),_0x455874,_0xe4ff('0xe'));_0x2aa67c(_0xc992bd[_0xe4ff('0x13')]['message']);}})[_0xe4ff('0x14')](function(_0x5344ed){logger[_0xe4ff('0x10')](_0xe4ff('0xd'),_0x455874,_0x5344ed);_0x5b9a40(_0x5344ed);});});} \ No newline at end of file +var _0x7eb9=['Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info'];(function(_0x62ae2a,_0x5c01f2){var _0x390d90=function(_0x5e9a78){while(--_0x5e9a78){_0x62ae2a['push'](_0x62ae2a['shift']());}};_0x390d90(++_0x5c01f2);}(_0x7eb9,0xd9));var _0x97eb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7eb9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x97eb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x97eb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97eb('0x2'));var db=require(_0x97eb('0x3'))['db'];var utils=require(_0x97eb('0x4'));var logger=require(_0x97eb('0x5'))('rpc');var config=require(_0x97eb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x97eb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44595e,_0x4a8f26,_0x5227f4){return new BPromise(function(_0x429ed6,_0x5af402){return client[_0x97eb('0x8')](_0x44595e,_0x5227f4)[_0x97eb('0x9')](function(_0x10eba2){logger[_0x97eb('0xa')](_0x97eb('0xb'),_0x4a8f26,'request\x20sent');logger['debug'](_0x97eb('0xc'),_0x4a8f26,_0x97eb('0xd'),JSON[_0x97eb('0xe')](_0x10eba2));if(_0x10eba2[_0x97eb('0xf')]){if(_0x10eba2[_0x97eb('0xf')][_0x97eb('0x10')]===0x1f4){logger[_0x97eb('0xf')](_0x97eb('0xb'),_0x4a8f26,_0x10eba2[_0x97eb('0xf')][_0x97eb('0x11')]);return _0x5af402(_0x10eba2[_0x97eb('0xf')][_0x97eb('0x11')]);}logger[_0x97eb('0xf')](_0x97eb('0xb'),_0x4a8f26,_0x10eba2['error'][_0x97eb('0x11')]);return _0x429ed6(_0x10eba2[_0x97eb('0xf')][_0x97eb('0x11')]);}else{logger['info'](_0x97eb('0xb'),_0x4a8f26,_0x97eb('0xd'));_0x429ed6(_0x10eba2[_0x97eb('0x12')]['message']);}})['catch'](function(_0x42efe3){logger[_0x97eb('0xf')](_0x97eb('0xb'),_0x4a8f26,_0x42efe3);_0x5af402(_0x42efe3);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 925e411..f71cef8 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 _0x4b36=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b36,0xcb));var _0x64b3=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x4b36[_0x47aa64];return _0x549c7a;};'use strict';var multer=require(_0x64b3('0x0'));var util=require('util');var path=require(_0x64b3('0x1'));var timeout=require(_0x64b3('0x2'));var express=require(_0x64b3('0x3'));var router=express[_0x64b3('0x4')]();var fs_extra=require(_0x64b3('0x5'));var auth=require(_0x64b3('0x6'));var interaction=require(_0x64b3('0x7'));var config=require(_0x64b3('0x8'));var controller=require('./network.controller');router[_0x64b3('0x9')]('/',auth[_0x64b3('0xa')](),controller[_0x64b3('0xb')]);router['get'](_0x64b3('0xc'),auth[_0x64b3('0xa')](),controller[_0x64b3('0xd')]);router['post']('/',auth[_0x64b3('0xa')](),controller[_0x64b3('0xe')]);router[_0x64b3('0xf')]('/:id',auth[_0x64b3('0xa')](),controller[_0x64b3('0x10')]);router[_0x64b3('0x11')](_0x64b3('0xc'),auth[_0x64b3('0xa')](),controller[_0x64b3('0x12')]);module[_0x64b3('0x13')]=router; \ No newline at end of file +var _0x4b24=['../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x5de5a5,_0x25ba48){var _0x5d5bfa=function(_0x81d0f2){while(--_0x81d0f2){_0x5de5a5['push'](_0x5de5a5['shift']());}};_0x5d5bfa(++_0x25ba48);}(_0x4b24,0x8a));var _0x44b2=function(_0x48459a,_0x4773ff){_0x48459a=_0x48459a-0x0;var _0x31e404=_0x4b24[_0x48459a];return _0x31e404;};'use strict';var multer=require(_0x44b2('0x0'));var util=require(_0x44b2('0x1'));var path=require(_0x44b2('0x2'));var timeout=require(_0x44b2('0x3'));var express=require(_0x44b2('0x4'));var router=express['Router']();var fs_extra=require(_0x44b2('0x5'));var auth=require(_0x44b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x44b2('0x7'));var controller=require('./network.controller');router[_0x44b2('0x8')]('/',auth['isAuthenticated'](),controller[_0x44b2('0x9')]);router[_0x44b2('0x8')](_0x44b2('0xa'),auth[_0x44b2('0xb')](),controller['show']);router[_0x44b2('0xc')]('/',auth[_0x44b2('0xb')](),controller['create']);router[_0x44b2('0xd')](_0x44b2('0xa'),auth[_0x44b2('0xb')](),controller[_0x44b2('0xe')]);router[_0x44b2('0xf')](_0x44b2('0xa'),auth[_0x44b2('0xb')](),controller[_0x44b2('0x10')]);module[_0x44b2('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 2e15ed2..6be9193 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 _0xaa9c=['turn','STRING','sequelize','exports','ENUM','localnet'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xaa9c,0x1ac));var _0xcaa9=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xaa9c[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0xcaa9('0x0'));module[_0xcaa9('0x1')]={'type':{'type':Sequelize[_0xcaa9('0x2')](_0xcaa9('0x3'),'externip','stun',_0xcaa9('0x4'))},'value':{'type':Sequelize[_0xcaa9('0x5')]},'username':{'type':Sequelize[_0xcaa9('0x5')]},'password':{'type':Sequelize[_0xcaa9('0x5')]}}; \ No newline at end of file +var _0x5efc=['stun','turn','STRING','sequelize','ENUM','externip'];(function(_0x3a1c2e,_0x58c14d){var _0x1096cd=function(_0x5c385e){while(--_0x5c385e){_0x3a1c2e['push'](_0x3a1c2e['shift']());}};_0x1096cd(++_0x58c14d);}(_0x5efc,0x11d));var _0xc5ef=function(_0xa9b9f7,_0x5b0151){_0xa9b9f7=_0xa9b9f7-0x0;var _0x4637b2=_0x5efc[_0xa9b9f7];return _0x4637b2;};'use strict';var Sequelize=require(_0xc5ef('0x0'));module['exports']={'type':{'type':Sequelize[_0xc5ef('0x1')]('localnet',_0xc5ef('0x2'),_0xc5ef('0x3'),_0xc5ef('0x4'))},'value':{'type':Sequelize[_0xc5ef('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 9b82421..5a10602 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 _0x0a58=['api','../../config/environment','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','offset','undefined','limit','count','Content-Range','update','destroy','then','end','sendStatus','stack','status','index','map','Network','rawAttributes','fieldName','key','name','query','filters','intersection','model','attributes','fields','length','order','sort','where','filter','type','VIRTUAL','merge','includeAll','findAll','rows','params','keys','include','find','create','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','toLowerCase','chan_sip.so','TURN','server/files/templates/network.ejs','format','STUN','util','path','ejs'];(function(_0x551b7a,_0x49d738){var _0x1180ef=function(_0x20e80d){while(--_0x20e80d){_0x551b7a['push'](_0x551b7a['shift']());}};_0x1180ef(++_0x49d738);}(_0x0a58,0x192));var _0x80a5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0a58[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0x80a5('0x0'));var path=require(_0x80a5('0x1'));var ejs=require(_0x80a5('0x2'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x80a5('0x3'));var config=require(_0x80a5('0x4'));var db=require('../../mysqldb')['db'];var jayson=require(_0x80a5('0x5'));var client=jayson[_0x80a5('0x6')][_0x80a5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x100a5d,_0x257a6a,_0xee29d8,_0x2ff219){return new Promise(function(_0x12393f,_0x3d61b4){var _0x31c2dc=_0x2ff219||client;return _0x31c2dc[_0x80a5('0x8')](_0x100a5d,_0xee29d8)['then'](function(_0x20236d){logger[_0x80a5('0x9')](_0x80a5('0xa'),_0x257a6a,_0x80a5('0xb'));logger[_0x80a5('0xc')](_0x80a5('0xd'),_0x257a6a,_0x80a5('0xb'),JSON['stringify'](_0x20236d));if(_0x20236d[_0x80a5('0xe')]){if(_0x20236d['error'][_0x80a5('0xf')]===0x1f4){logger['error'](_0x80a5('0xa'),_0x257a6a,_0x20236d['error'][_0x80a5('0x10')]);return _0x3d61b4(_0x20236d[_0x80a5('0xe')][_0x80a5('0x10')]);}logger[_0x80a5('0xe')](_0x80a5('0xa'),_0x257a6a,_0x20236d[_0x80a5('0xe')]['message']);return _0x12393f(_0x20236d[_0x80a5('0xe')][_0x80a5('0x10')]);}else{logger[_0x80a5('0x9')]('Network,\x20%s,\x20%s',_0x257a6a,_0x80a5('0xb'));_0x12393f(_0x20236d[_0x80a5('0x11')][_0x80a5('0x10')]);}})[_0x80a5('0x12')](function(_0x1a6d39){logger[_0x80a5('0xe')](_0x80a5('0xa'),_0x257a6a,_0x1a6d39);_0x3d61b4(_0x1a6d39);});});}function respondWithResult(_0x1efd8a,_0x34c109){_0x34c109=_0x34c109||0xc8;return function(_0x333e6f){if(_0x333e6f){return _0x1efd8a['status'](_0x34c109)[_0x80a5('0x13')](_0x333e6f);}};}function respondWithFilteredResult(_0x170569,_0x549136){return function(_0x5cf1e5){if(_0x5cf1e5){var _0x73152f=typeof _0x549136[_0x80a5('0x14')]===_0x80a5('0x15')&&typeof _0x549136[_0x80a5('0x16')]==='undefined';var _0x163b88=_0x5cf1e5[_0x80a5('0x17')];var _0x5e3852=_0x73152f?0x0:_0x549136[_0x80a5('0x14')];var _0x5bae02=_0x73152f?_0x5cf1e5['count']:_0x549136[_0x80a5('0x14')]+_0x549136[_0x80a5('0x16')];var _0x4beb35;if(_0x5bae02>=_0x163b88){_0x5bae02=_0x163b88;_0x4beb35=0xc8;}else{_0x4beb35=0xce;}_0x170569['status'](_0x4beb35);return _0x170569['set'](_0x80a5('0x18'),_0x5e3852+'-'+_0x5bae02+'/'+_0x163b88)[_0x80a5('0x13')](_0x5cf1e5);}return null;};}function saveUpdates(_0x3a5178){return function(_0xdf0e25){if(_0xdf0e25){return _0xdf0e25[_0x80a5('0x19')](_0x3a5178)['then'](function(_0x50a774){return _0x50a774;});}return null;};}function removeEntity(_0x37a53c){return function(_0x4f4ccc){if(_0x4f4ccc){return _0x4f4ccc[_0x80a5('0x1a')]()[_0x80a5('0x1b')](function(){_0x37a53c['status'](0xcc)[_0x80a5('0x1c')]();});}};}function handleEntityNotFound(_0x48ae4a){return function(_0x16b4d4){if(!_0x16b4d4){_0x48ae4a[_0x80a5('0x1d')](0x194);}return _0x16b4d4;};}function handleError(_0x4d5569,_0x41d402){_0x41d402=_0x41d402||0x1f4;return function(_0x294b44){logger[_0x80a5('0xe')](_0x294b44[_0x80a5('0x1e')]);if(_0x294b44['name']){delete _0x294b44['name'];}_0x4d5569[_0x80a5('0x1f')](_0x41d402)['send'](_0x294b44);};}exports[_0x80a5('0x20')]=function(_0x2cb680,_0x7e456f){var _0x3185d1={},_0x2a7167={},_0x247f61={'count':0x0,'rows':[]};var _0x2a1507=_[_0x80a5('0x21')](db[_0x80a5('0x22')][_0x80a5('0x23')],function(_0x40f0f6){return{'name':_0x40f0f6[_0x80a5('0x24')],'type':_0x40f0f6['type'][_0x80a5('0x25')]};});_0x2a7167['model']=_[_0x80a5('0x21')](_0x2a1507,_0x80a5('0x26'));_0x2a7167[_0x80a5('0x27')]=_['keys'](_0x2cb680[_0x80a5('0x27')]);_0x2a7167[_0x80a5('0x28')]=_[_0x80a5('0x29')](_0x2a7167[_0x80a5('0x2a')],_0x2a7167['query']);_0x3185d1[_0x80a5('0x2b')]=_[_0x80a5('0x29')](_0x2a7167[_0x80a5('0x2a')],qs[_0x80a5('0x2c')](_0x2cb680['query'][_0x80a5('0x2c')]));_0x3185d1['attributes']=_0x3185d1['attributes'][_0x80a5('0x2d')]?_0x3185d1[_0x80a5('0x2b')]:_0x2a7167[_0x80a5('0x2a')];if(!_0x2cb680['query']['hasOwnProperty']('nolimit')){_0x3185d1['limit']=qs[_0x80a5('0x16')](_0x2cb680[_0x80a5('0x27')][_0x80a5('0x16')]);_0x3185d1[_0x80a5('0x14')]=qs[_0x80a5('0x14')](_0x2cb680[_0x80a5('0x27')][_0x80a5('0x14')]);}_0x3185d1[_0x80a5('0x2e')]=qs[_0x80a5('0x2f')](_0x2cb680[_0x80a5('0x27')][_0x80a5('0x2f')]);_0x3185d1[_0x80a5('0x30')]=qs['filters'](_['pick'](_0x2cb680[_0x80a5('0x27')],_0x2a7167[_0x80a5('0x28')]),_0x2a1507);if(_0x2cb680[_0x80a5('0x27')][_0x80a5('0x31')]){_0x3185d1['where']=_['merge'](_0x3185d1[_0x80a5('0x30')],{'$or':_[_0x80a5('0x21')](_0x2a1507,function(_0x2eb6d6){if(_0x2eb6d6[_0x80a5('0x32')]!==_0x80a5('0x33')){var _0x507c48={};_0x507c48[_0x2eb6d6['name']]={'$like':'%'+_0x2cb680[_0x80a5('0x27')]['filter']+'%'};return _0x507c48;}})});}_0x3185d1=_[_0x80a5('0x34')]({},_0x3185d1,_0x2cb680['options']);var _0x2f2d2f={'where':_0x3185d1[_0x80a5('0x30')]};return db[_0x80a5('0x22')][_0x80a5('0x17')](_0x2f2d2f)[_0x80a5('0x1b')](function(_0x44ce77){_0x247f61[_0x80a5('0x17')]=_0x44ce77;if(_0x2cb680[_0x80a5('0x27')][_0x80a5('0x35')]){_0x3185d1['include']=[{'all':!![]}];}return db[_0x80a5('0x22')][_0x80a5('0x36')](_0x3185d1);})[_0x80a5('0x1b')](function(_0x5948fc){_0x247f61[_0x80a5('0x37')]=_0x5948fc;return _0x247f61;})[_0x80a5('0x1b')](respondWithFilteredResult(_0x7e456f,_0x3185d1))[_0x80a5('0x12')](handleError(_0x7e456f,null));};exports['show']=function(_0x49dbdf,_0x510169){var _0x55a9c1={'raw':!![],'where':{'id':_0x49dbdf[_0x80a5('0x38')]['id']}},_0x2f64e2={};_0x2f64e2['model']=_[_0x80a5('0x39')](db['Network'][_0x80a5('0x23')]);_0x2f64e2['query']=_[_0x80a5('0x39')](_0x49dbdf['query']);_0x2f64e2[_0x80a5('0x28')]=_[_0x80a5('0x29')](_0x2f64e2['model'],_0x2f64e2[_0x80a5('0x27')]);_0x55a9c1['attributes']=_['intersection'](_0x2f64e2[_0x80a5('0x2a')],qs[_0x80a5('0x2c')](_0x49dbdf[_0x80a5('0x27')][_0x80a5('0x2c')]));_0x55a9c1[_0x80a5('0x2b')]=_0x55a9c1[_0x80a5('0x2b')][_0x80a5('0x2d')]?_0x55a9c1[_0x80a5('0x2b')]:_0x2f64e2[_0x80a5('0x2a')];if(_0x49dbdf[_0x80a5('0x27')]['includeAll']){_0x55a9c1[_0x80a5('0x3a')]=[{'all':!![]}];}_0x55a9c1=_[_0x80a5('0x34')]({},_0x55a9c1,_0x49dbdf['options']);return db['Network'][_0x80a5('0x3b')](_0x55a9c1)[_0x80a5('0x1b')](handleEntityNotFound(_0x510169,null))[_0x80a5('0x1b')](respondWithResult(_0x510169,null))[_0x80a5('0x12')](handleError(_0x510169,null));};exports[_0x80a5('0x3c')]=function(_0x3481f6,_0x1d314d){var _0x26221c;return db[_0x80a5('0x22')]['create'](_0x3481f6[_0x80a5('0x3d')],{'raw':!![]})[_0x80a5('0x1b')](function(_0x1d527b){_0x26221c=_0x1d527b;return db[_0x80a5('0x22')]['findAll']({'where':{'type':_0x3481f6['body'][_0x80a5('0x32')]},'raw':!![]});})[_0x80a5('0x1b')](function(_0x5beb2f){if(_0x26221c[_0x80a5('0x32')][_0x80a5('0x3e')]()=='STUN'){var _0x454b95=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config[_0x80a5('0x41')],_0x80a5('0x42')),_0x80a5('0x43'));var _0x1843d=ejs['render'](_0x454b95,{'networks':_0x5beb2f||[]});fs[_0x80a5('0x44')](_0x80a5('0x45'),_0x1843d);return respondWithRpcPromise(_0x80a5('0x46'),_0x80a5('0x3c'),{'module':_0x80a5('0x47')});}else if(_0x26221c[_0x80a5('0x32')][_0x80a5('0x3e')]()=='TURN'){var _0x4e9c95=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config[_0x80a5('0x41')],_0x80a5('0x48')),_0x80a5('0x43'));var _0x4a36a2=ejs[_0x80a5('0x49')](_0x4e9c95,{'networks':_0x5beb2f||[]});fs[_0x80a5('0x44')](_0x80a5('0x4a'),_0x4a36a2);return respondWithRpcPromise(_0x80a5('0x46'),_0x80a5('0x3c'),{'module':_0x80a5('0x47')});}else{var _0x58a967=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config[_0x80a5('0x41')],'server/files/templates/network.ejs'),_0x80a5('0x43'));var _0x3ffd84=ejs[_0x80a5('0x49')](_0x58a967,{'networks':_0x5beb2f||[]});fs[_0x80a5('0x44')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3481f6[_0x80a5('0x3d')][_0x80a5('0x32')][_0x80a5('0x4b')]()),_0x3ffd84);return respondWithRpcPromise(_0x80a5('0x46'),_0x80a5('0x3c'),{'module':_0x80a5('0x4c')});}})['then'](function(){return _0x26221c;})[_0x80a5('0x1b')](respondWithResult(_0x1d314d,0xc9))[_0x80a5('0x12')](handleError(_0x1d314d,null));};exports[_0x80a5('0x19')]=function(_0x51428c,_0xfbeff4){var _0x3beae2;return db[_0x80a5('0x22')][_0x80a5('0x3b')]({'where':{'id':_0x51428c[_0x80a5('0x38')]['id']}})['then'](handleEntityNotFound(_0xfbeff4,null))[_0x80a5('0x1b')](saveUpdates(_0x51428c['body'],null))['then'](function(_0x47ae3c){if(_0x47ae3c){_0x3beae2=_0x47ae3c;return db[_0x80a5('0x22')]['findAll']({'where':{'type':_0x3beae2[_0x80a5('0x32')]},'raw':!![]});}return null;})[_0x80a5('0x1b')](function(_0x19c725){if(_0x3beae2[_0x80a5('0x32')][_0x80a5('0x3e')]()=='STUN'){var _0x5df61c=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config[_0x80a5('0x41')],_0x80a5('0x42')),'utf8');var _0x52a88f=ejs[_0x80a5('0x49')](_0x5df61c,{'networks':_0x19c725||[]});fs[_0x80a5('0x44')](_0x80a5('0x45'),_0x52a88f);return respondWithRpcPromise(_0x80a5('0x46'),_0x80a5('0x19'),{'module':'res_stun_monitor.so'});}else if(_0x3beae2[_0x80a5('0x32')][_0x80a5('0x3e')]()==_0x80a5('0x4d')){var _0x32501b=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config['root'],_0x80a5('0x48')),'utf8');var _0x2f7286=ejs[_0x80a5('0x49')](_0x32501b,{'networks':_0x19c725||[]});fs[_0x80a5('0x44')](_0x80a5('0x4a'),_0x2f7286);return respondWithRpcPromise('Reload',_0x80a5('0x19'),{'module':_0x80a5('0x47')});}else{var _0x1af86d=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config[_0x80a5('0x41')],_0x80a5('0x4e')),_0x80a5('0x43'));var _0x4524cf=ejs['render'](_0x1af86d,{'networks':_0x19c725||[]});fs[_0x80a5('0x44')](util[_0x80a5('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x51428c['body'][_0x80a5('0x32')]['toLowerCase']()),_0x4524cf);return respondWithRpcPromise(_0x80a5('0x46'),'update',{'module':_0x80a5('0x4c')});}})[_0x80a5('0x1b')](function(_0x433623){if(_0x433623){return _0x3beae2;}return null;})[_0x80a5('0x1b')](respondWithResult(_0xfbeff4,null))[_0x80a5('0x12')](handleError(_0xfbeff4,null));};exports[_0x80a5('0x1a')]=function(_0xda5f21,_0x5b89f7){var _0x2319ba;return db[_0x80a5('0x22')][_0x80a5('0x3b')]({'where':{'id':_0xda5f21[_0x80a5('0x38')]['id']}})[_0x80a5('0x1b')](function(_0x4db2d9){_0x2319ba=_0x4db2d9;return _0x4db2d9;})[_0x80a5('0x1b')](handleEntityNotFound(_0x5b89f7,null))['then'](removeEntity(_0x5b89f7,null))['then'](function(){if(_0x2319ba){return db[_0x80a5('0x22')][_0x80a5('0x36')]({'where':{'type':_0x2319ba[_0x80a5('0x32')]},'raw':!![]});}})[_0x80a5('0x1b')](function(_0x4d047e){if(_0x2319ba[_0x80a5('0x32')][_0x80a5('0x3e')]()==_0x80a5('0x50')){var _0x56aaac=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config[_0x80a5('0x41')],_0x80a5('0x42')),_0x80a5('0x43'));var _0x537f22=ejs[_0x80a5('0x49')](_0x56aaac,{'networks':_0x4d047e||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x537f22);return respondWithRpcPromise(_0x80a5('0x46'),_0x80a5('0x1a'),{'module':_0x80a5('0x47')});}else if(_0x2319ba[_0x80a5('0x32')]['toUpperCase']()==_0x80a5('0x4d')){var _0x7e4e5=fs[_0x80a5('0x3f')](path['join'](config[_0x80a5('0x41')],_0x80a5('0x48')),_0x80a5('0x43'));var _0xe58da8=ejs['render'](_0x7e4e5,{'networks':_0x4d047e||[]});fs[_0x80a5('0x44')](_0x80a5('0x4a'),_0xe58da8);return respondWithRpcPromise(_0x80a5('0x46'),_0x80a5('0x1a'),{'module':_0x80a5('0x47')});}else{var _0x2beb52=fs['readFileSync'](path[_0x80a5('0x40')](config[_0x80a5('0x41')],_0x80a5('0x4e')),_0x80a5('0x43'));var _0x1fbb12=ejs[_0x80a5('0x49')](_0x2beb52,{'networks':_0x4d047e||[]});fs[_0x80a5('0x44')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x2319ba[_0x80a5('0x32')][_0x80a5('0x4b')]()),_0x1fbb12);return respondWithRpcPromise('Reload',_0x80a5('0x1a'),{'module':_0x80a5('0x4c')});}})['catch'](handleError(_0x5b89f7,null));}; \ No newline at end of file +var _0x9a91=['includeAll','include','findAll','rows','show','params','keys','length','find','create','body','readFileSync','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','join','root','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','STUN','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','undefined','count','offset','limit','set','Content-Range','json','update','destroy','end','stack','name','send','index','map','Network','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','order','sort','where','filter','VIRTUAL','merge'];(function(_0x559f6c,_0x4b6a27){var _0x1ca9b1=function(_0x3b22f6){while(--_0x3b22f6){_0x559f6c['push'](_0x559f6c['shift']());}};_0x1ca9b1(++_0x4b6a27);}(_0x9a91,0x1d2));var _0x19a9=function(_0x5f559a,_0x2780ff){_0x5f559a=_0x5f559a-0x0;var _0x3d287=_0x9a91[_0x5f559a];return _0x3d287;};'use strict';var util=require(_0x19a9('0x0'));var path=require(_0x19a9('0x1'));var ejs=require(_0x19a9('0x2'));var fs=require('fs');var _=require(_0x19a9('0x3'));var qs=require(_0x19a9('0x4'));var logger=require(_0x19a9('0x5'))(_0x19a9('0x6'));var config=require(_0x19a9('0x7'));var db=require(_0x19a9('0x8'))['db'];var jayson=require(_0x19a9('0x9'));var client=jayson[_0x19a9('0xa')][_0x19a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22159d,_0x31c86e,_0x530ae5,_0x4bea8e){return new Promise(function(_0x4aedb8,_0x244ba0){var _0x203282=_0x4bea8e||client;return _0x203282[_0x19a9('0xc')](_0x22159d,_0x530ae5)[_0x19a9('0xd')](function(_0x2aca6f){logger['info'](_0x19a9('0xe'),_0x31c86e,_0x19a9('0xf'));logger[_0x19a9('0x10')]('Network,\x20%s,\x20%s,\x20%s',_0x31c86e,_0x19a9('0xf'),JSON[_0x19a9('0x11')](_0x2aca6f));if(_0x2aca6f[_0x19a9('0x12')]){if(_0x2aca6f[_0x19a9('0x12')][_0x19a9('0x13')]===0x1f4){logger['error'](_0x19a9('0xe'),_0x31c86e,_0x2aca6f[_0x19a9('0x12')][_0x19a9('0x14')]);return _0x244ba0(_0x2aca6f[_0x19a9('0x12')][_0x19a9('0x14')]);}logger[_0x19a9('0x12')](_0x19a9('0xe'),_0x31c86e,_0x2aca6f[_0x19a9('0x12')][_0x19a9('0x14')]);return _0x4aedb8(_0x2aca6f[_0x19a9('0x12')]['message']);}else{logger[_0x19a9('0x15')](_0x19a9('0xe'),_0x31c86e,_0x19a9('0xf'));_0x4aedb8(_0x2aca6f[_0x19a9('0x16')][_0x19a9('0x14')]);}})[_0x19a9('0x17')](function(_0x40aee2){logger[_0x19a9('0x12')]('Network,\x20%s,\x20%s',_0x31c86e,_0x40aee2);_0x244ba0(_0x40aee2);});});}function respondWithResult(_0x262a1d,_0x4c8a02){_0x4c8a02=_0x4c8a02||0xc8;return function(_0xd86324){if(_0xd86324){return _0x262a1d[_0x19a9('0x18')](_0x4c8a02)['json'](_0xd86324);}};}function respondWithFilteredResult(_0x562c48,_0x556fd1){return function(_0x3e66e9){if(_0x3e66e9){var _0x16d1b5=typeof _0x556fd1['offset']===_0x19a9('0x19')&&typeof _0x556fd1['limit']==='undefined';var _0x8ff61f=_0x3e66e9[_0x19a9('0x1a')];var _0x23fcac=_0x16d1b5?0x0:_0x556fd1[_0x19a9('0x1b')];var _0x1e47d8=_0x16d1b5?_0x3e66e9[_0x19a9('0x1a')]:_0x556fd1[_0x19a9('0x1b')]+_0x556fd1[_0x19a9('0x1c')];var _0x5c2f0a;if(_0x1e47d8>=_0x8ff61f){_0x1e47d8=_0x8ff61f;_0x5c2f0a=0xc8;}else{_0x5c2f0a=0xce;}_0x562c48[_0x19a9('0x18')](_0x5c2f0a);return _0x562c48[_0x19a9('0x1d')](_0x19a9('0x1e'),_0x23fcac+'-'+_0x1e47d8+'/'+_0x8ff61f)[_0x19a9('0x1f')](_0x3e66e9);}return null;};}function saveUpdates(_0x543011){return function(_0x198956){if(_0x198956){return _0x198956[_0x19a9('0x20')](_0x543011)['then'](function(_0x4a77ab){return _0x4a77ab;});}return null;};}function removeEntity(_0x3bbd2b){return function(_0x492a2c){if(_0x492a2c){return _0x492a2c[_0x19a9('0x21')]()[_0x19a9('0xd')](function(){_0x3bbd2b[_0x19a9('0x18')](0xcc)[_0x19a9('0x22')]();});}};}function handleEntityNotFound(_0x52d7f6){return function(_0x5c9228){if(!_0x5c9228){_0x52d7f6['sendStatus'](0x194);}return _0x5c9228;};}function handleError(_0x5bb57f,_0x3d44fd){_0x3d44fd=_0x3d44fd||0x1f4;return function(_0x384ee9){logger[_0x19a9('0x12')](_0x384ee9[_0x19a9('0x23')]);if(_0x384ee9[_0x19a9('0x24')]){delete _0x384ee9[_0x19a9('0x24')];}_0x5bb57f[_0x19a9('0x18')](_0x3d44fd)[_0x19a9('0x25')](_0x384ee9);};}exports[_0x19a9('0x26')]=function(_0x5ad971,_0x75235a){var _0x24ab37={},_0x210045={},_0x352f96={'count':0x0,'rows':[]};var _0xdeef3a=_[_0x19a9('0x27')](db[_0x19a9('0x28')][_0x19a9('0x29')],function(_0x5362e4){return{'name':_0x5362e4[_0x19a9('0x2a')],'type':_0x5362e4[_0x19a9('0x2b')]['key']};});_0x210045[_0x19a9('0x2c')]=_[_0x19a9('0x27')](_0xdeef3a,'name');_0x210045[_0x19a9('0x2d')]=_['keys'](_0x5ad971[_0x19a9('0x2d')]);_0x210045[_0x19a9('0x2e')]=_[_0x19a9('0x2f')](_0x210045[_0x19a9('0x2c')],_0x210045[_0x19a9('0x2d')]);_0x24ab37[_0x19a9('0x30')]=_[_0x19a9('0x2f')](_0x210045[_0x19a9('0x2c')],qs['fields'](_0x5ad971[_0x19a9('0x2d')][_0x19a9('0x31')]));_0x24ab37[_0x19a9('0x30')]=_0x24ab37['attributes']['length']?_0x24ab37[_0x19a9('0x30')]:_0x210045['model'];if(!_0x5ad971[_0x19a9('0x2d')]['hasOwnProperty']('nolimit')){_0x24ab37[_0x19a9('0x1c')]=qs['limit'](_0x5ad971[_0x19a9('0x2d')][_0x19a9('0x1c')]);_0x24ab37[_0x19a9('0x1b')]=qs[_0x19a9('0x1b')](_0x5ad971[_0x19a9('0x2d')][_0x19a9('0x1b')]);}_0x24ab37[_0x19a9('0x32')]=qs[_0x19a9('0x33')](_0x5ad971['query'][_0x19a9('0x33')]);_0x24ab37[_0x19a9('0x34')]=qs[_0x19a9('0x2e')](_['pick'](_0x5ad971['query'],_0x210045[_0x19a9('0x2e')]),_0xdeef3a);if(_0x5ad971[_0x19a9('0x2d')][_0x19a9('0x35')]){_0x24ab37['where']=_['merge'](_0x24ab37[_0x19a9('0x34')],{'$or':_['map'](_0xdeef3a,function(_0x303381){if(_0x303381[_0x19a9('0x2b')]!==_0x19a9('0x36')){var _0x41a71d={};_0x41a71d[_0x303381['name']]={'$like':'%'+_0x5ad971['query'][_0x19a9('0x35')]+'%'};return _0x41a71d;}})});}_0x24ab37=_[_0x19a9('0x37')]({},_0x24ab37,_0x5ad971['options']);var _0x564cba={'where':_0x24ab37[_0x19a9('0x34')]};return db[_0x19a9('0x28')]['count'](_0x564cba)[_0x19a9('0xd')](function(_0x2a5093){_0x352f96['count']=_0x2a5093;if(_0x5ad971[_0x19a9('0x2d')][_0x19a9('0x38')]){_0x24ab37[_0x19a9('0x39')]=[{'all':!![]}];}return db[_0x19a9('0x28')][_0x19a9('0x3a')](_0x24ab37);})['then'](function(_0x182d78){_0x352f96[_0x19a9('0x3b')]=_0x182d78;return _0x352f96;})['then'](respondWithFilteredResult(_0x75235a,_0x24ab37))['catch'](handleError(_0x75235a,null));};exports[_0x19a9('0x3c')]=function(_0x54a3f2,_0x42242f){var _0x572ad0={'raw':!![],'where':{'id':_0x54a3f2[_0x19a9('0x3d')]['id']}},_0x34c88b={};_0x34c88b['model']=_['keys'](db[_0x19a9('0x28')]['rawAttributes']);_0x34c88b[_0x19a9('0x2d')]=_[_0x19a9('0x3e')](_0x54a3f2[_0x19a9('0x2d')]);_0x34c88b[_0x19a9('0x2e')]=_['intersection'](_0x34c88b['model'],_0x34c88b[_0x19a9('0x2d')]);_0x572ad0[_0x19a9('0x30')]=_[_0x19a9('0x2f')](_0x34c88b[_0x19a9('0x2c')],qs[_0x19a9('0x31')](_0x54a3f2[_0x19a9('0x2d')]['fields']));_0x572ad0[_0x19a9('0x30')]=_0x572ad0['attributes'][_0x19a9('0x3f')]?_0x572ad0[_0x19a9('0x30')]:_0x34c88b[_0x19a9('0x2c')];if(_0x54a3f2[_0x19a9('0x2d')]['includeAll']){_0x572ad0[_0x19a9('0x39')]=[{'all':!![]}];}_0x572ad0=_[_0x19a9('0x37')]({},_0x572ad0,_0x54a3f2['options']);return db[_0x19a9('0x28')][_0x19a9('0x40')](_0x572ad0)['then'](handleEntityNotFound(_0x42242f,null))[_0x19a9('0xd')](respondWithResult(_0x42242f,null))['catch'](handleError(_0x42242f,null));};exports[_0x19a9('0x41')]=function(_0x29829c,_0xac9ee5){var _0x13cf8f;return db[_0x19a9('0x28')]['create'](_0x29829c[_0x19a9('0x42')],{'raw':!![]})[_0x19a9('0xd')](function(_0xe52e1e){_0x13cf8f=_0xe52e1e;return db[_0x19a9('0x28')]['findAll']({'where':{'type':_0x29829c[_0x19a9('0x42')][_0x19a9('0x2b')]},'raw':!![]});})[_0x19a9('0xd')](function(_0x758d37){if(_0x13cf8f[_0x19a9('0x2b')]['toUpperCase']()=='STUN'){var _0x54b1e9=fs[_0x19a9('0x43')](path['join'](config['root'],_0x19a9('0x44')),_0x19a9('0x45'));var _0x1df3a4=ejs['render'](_0x54b1e9,{'networks':_0x758d37||[]});fs[_0x19a9('0x46')](_0x19a9('0x47'),_0x1df3a4);return respondWithRpcPromise(_0x19a9('0x48'),_0x19a9('0x41'),{'module':_0x19a9('0x49')});}else if(_0x13cf8f[_0x19a9('0x2b')][_0x19a9('0x4a')]()==_0x19a9('0x4b')){var _0x3d0f60=fs[_0x19a9('0x43')](path[_0x19a9('0x4c')](config[_0x19a9('0x4d')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x8a4cb6=ejs[_0x19a9('0x4e')](_0x3d0f60,{'networks':_0x758d37||[]});fs[_0x19a9('0x46')](_0x19a9('0x4f'),_0x8a4cb6);return respondWithRpcPromise('Reload',_0x19a9('0x41'),{'module':_0x19a9('0x49')});}else{var _0x332510=fs[_0x19a9('0x43')](path[_0x19a9('0x4c')](config[_0x19a9('0x4d')],_0x19a9('0x50')),'utf8');var _0x15dc2f=ejs[_0x19a9('0x4e')](_0x332510,{'networks':_0x758d37||[]});fs[_0x19a9('0x46')](util[_0x19a9('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x29829c[_0x19a9('0x42')]['type'][_0x19a9('0x52')]()),_0x15dc2f);return respondWithRpcPromise(_0x19a9('0x48'),_0x19a9('0x41'),{'module':_0x19a9('0x53')});}})[_0x19a9('0xd')](function(){return _0x13cf8f;})[_0x19a9('0xd')](respondWithResult(_0xac9ee5,0xc9))[_0x19a9('0x17')](handleError(_0xac9ee5,null));};exports[_0x19a9('0x20')]=function(_0x1365d2,_0x44fa14){var _0x4f2787;return db[_0x19a9('0x28')][_0x19a9('0x40')]({'where':{'id':_0x1365d2[_0x19a9('0x3d')]['id']}})[_0x19a9('0xd')](handleEntityNotFound(_0x44fa14,null))[_0x19a9('0xd')](saveUpdates(_0x1365d2[_0x19a9('0x42')],null))['then'](function(_0x23c935){if(_0x23c935){_0x4f2787=_0x23c935;return db[_0x19a9('0x28')]['findAll']({'where':{'type':_0x4f2787[_0x19a9('0x2b')]},'raw':!![]});}return null;})[_0x19a9('0xd')](function(_0x150e87){if(_0x4f2787['type'][_0x19a9('0x4a')]()=='STUN'){var _0xc43839=fs[_0x19a9('0x43')](path[_0x19a9('0x4c')](config[_0x19a9('0x4d')],_0x19a9('0x44')),'utf8');var _0x45180b=ejs[_0x19a9('0x4e')](_0xc43839,{'networks':_0x150e87||[]});fs['writeFileSync'](_0x19a9('0x47'),_0x45180b);return respondWithRpcPromise(_0x19a9('0x48'),_0x19a9('0x20'),{'module':_0x19a9('0x49')});}else if(_0x4f2787[_0x19a9('0x2b')][_0x19a9('0x4a')]()=='TURN'){var _0x53446a=fs[_0x19a9('0x43')](path[_0x19a9('0x4c')](config[_0x19a9('0x4d')],_0x19a9('0x54')),_0x19a9('0x45'));var _0x51bc91=ejs[_0x19a9('0x4e')](_0x53446a,{'networks':_0x150e87||[]});fs[_0x19a9('0x46')](_0x19a9('0x4f'),_0x51bc91);return respondWithRpcPromise('Reload',_0x19a9('0x20'),{'module':'res_stun_monitor.so'});}else{var _0x2a547e=fs['readFileSync'](path[_0x19a9('0x4c')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x14c8d4=ejs[_0x19a9('0x4e')](_0x2a547e,{'networks':_0x150e87||[]});fs['writeFileSync'](util[_0x19a9('0x51')](_0x19a9('0x55'),_0x1365d2[_0x19a9('0x42')][_0x19a9('0x2b')][_0x19a9('0x52')]()),_0x14c8d4);return respondWithRpcPromise(_0x19a9('0x48'),_0x19a9('0x20'),{'module':'chan_sip.so'});}})['then'](function(_0xb72289){if(_0xb72289){return _0x4f2787;}return null;})[_0x19a9('0xd')](respondWithResult(_0x44fa14,null))['catch'](handleError(_0x44fa14,null));};exports[_0x19a9('0x21')]=function(_0x5f4c49,_0x119284){var _0x32b4e8;return db['Network'][_0x19a9('0x40')]({'where':{'id':_0x5f4c49['params']['id']}})['then'](function(_0x35f760){_0x32b4e8=_0x35f760;return _0x35f760;})['then'](handleEntityNotFound(_0x119284,null))['then'](removeEntity(_0x119284,null))['then'](function(){if(_0x32b4e8){return db[_0x19a9('0x28')]['findAll']({'where':{'type':_0x32b4e8[_0x19a9('0x2b')]},'raw':!![]});}})[_0x19a9('0xd')](function(_0x30f9a2){if(_0x32b4e8[_0x19a9('0x2b')][_0x19a9('0x4a')]()==_0x19a9('0x56')){var _0x2320f2=fs[_0x19a9('0x43')](path['join'](config[_0x19a9('0x4d')],_0x19a9('0x44')),_0x19a9('0x45'));var _0x5b12ac=ejs['render'](_0x2320f2,{'networks':_0x30f9a2||[]});fs[_0x19a9('0x46')](_0x19a9('0x47'),_0x5b12ac);return respondWithRpcPromise(_0x19a9('0x48'),_0x19a9('0x21'),{'module':'res_stun_monitor.so'});}else if(_0x32b4e8[_0x19a9('0x2b')]['toUpperCase']()==_0x19a9('0x4b')){var _0x51f355=fs['readFileSync'](path[_0x19a9('0x4c')](config[_0x19a9('0x4d')],_0x19a9('0x54')),'utf8');var _0x219488=ejs['render'](_0x51f355,{'networks':_0x30f9a2||[]});fs['writeFileSync'](_0x19a9('0x4f'),_0x219488);return respondWithRpcPromise(_0x19a9('0x48'),_0x19a9('0x21'),{'module':_0x19a9('0x49')});}else{var _0x538b56=fs[_0x19a9('0x43')](path[_0x19a9('0x4c')](config['root'],_0x19a9('0x50')),_0x19a9('0x45'));var _0x278cf7=ejs[_0x19a9('0x4e')](_0x538b56,{'networks':_0x30f9a2||[]});fs[_0x19a9('0x46')](util[_0x19a9('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x32b4e8[_0x19a9('0x2b')][_0x19a9('0x52')]()),_0x278cf7);return respondWithRpcPromise(_0x19a9('0x48'),'destroy',{'module':_0x19a9('0x53')});}})['catch'](handleError(_0x119284,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index b7e5c6c..f2e7661 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 _0x9567=['lodash','util','../../config/logger','api','moment','path','rimraf','./network.attributes','define','Network'];(function(_0x3a2d96,_0x5d2628){var _0x1420f1=function(_0x40a988){while(--_0x40a988){_0x3a2d96['push'](_0x3a2d96['shift']());}};_0x1420f1(++_0x5d2628);}(_0x9567,0xdc));var _0x7956=function(_0x1f91e6,_0x1d7aa8){_0x1f91e6=_0x1f91e6-0x0;var _0x5e6030=_0x9567[_0x1f91e6];return _0x5e6030;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var logger=require(_0x7956('0x2'))(_0x7956('0x3'));var moment=require(_0x7956('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7956('0x5'));var rimraf=require(_0x7956('0x6'));var config=require('../../config/environment');var attributes=require(_0x7956('0x7'));module['exports']=function(_0x12c09e,_0x48c4b6){return _0x12c09e[_0x7956('0x8')](_0x7956('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc36d=['rimraf','./network.attributes','exports','define','network','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x17bbe5,_0x1ad283){var _0x3fd973=function(_0x49105b){while(--_0x49105b){_0x17bbe5['push'](_0x17bbe5['shift']());}};_0x3fd973(++_0x1ad283);}(_0xc36d,0x7d));var _0xdc36=function(_0x378752,_0x158b32){_0x378752=_0x378752-0x0;var _0xd5a262=_0xc36d[_0x378752];return _0xd5a262;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var logger=require(_0xdc36('0x2'))(_0xdc36('0x3'));var moment=require(_0xdc36('0x4'));var BPromise=require(_0xdc36('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc36('0x6'));var rimraf=require(_0xdc36('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc36('0x8'));module[_0xdc36('0x9')]=function(_0x186c58,_0x11ad3b){return _0x186c58[_0xdc36('0xa')]('Network',attributes,{'tableName':_0xdc36('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 2e8e67c..181395b 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x34323a,_0x4d2f37){_0x34323a=_0x34323a-0x0;var _0xe34579=_0x7a54[_0x34323a];return _0xe34579;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3c8ee1,_0x420e21){var _0x3fb9bf=function(_0x1fa660){while(--_0x1fa660){_0x3c8ee1['push'](_0x3c8ee1['shift']());}};_0x3fb9bf(++_0x420e21);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 30a6ed5..155f366 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 _0xbd79=['/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','addApplications','addAgents','/:id/send','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications'];(function(_0x2df4cc,_0x1233c6){var _0x40af8d=function(_0x5e0f2a){while(--_0x5e0f2a){_0x2df4cc['push'](_0x2df4cc['shift']());}};_0x40af8d(++_0x1233c6);}(_0xbd79,0x81));var _0x9bd7=function(_0x1282a0,_0x58b2f9){_0x1282a0=_0x1282a0-0x0;var _0x18af0c=_0xbd79[_0x1282a0];return _0x18af0c;};'use strict';var multer=require('multer');var util=require(_0x9bd7('0x0'));var path=require(_0x9bd7('0x1'));var timeout=require(_0x9bd7('0x2'));var express=require(_0x9bd7('0x3'));var router=express[_0x9bd7('0x4')]();var fs_extra=require(_0x9bd7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9bd7('0x6'));var controller=require(_0x9bd7('0x7'));router[_0x9bd7('0x8')]('/',auth['isAuthenticated'](),controller[_0x9bd7('0x9')]);router[_0x9bd7('0x8')](_0x9bd7('0xa'),auth[_0x9bd7('0xb')](),controller['describe']);router['get'](_0x9bd7('0xc'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0xd')]);router[_0x9bd7('0x8')](_0x9bd7('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x9bd7('0x8')](_0x9bd7('0xf'),auth['isAuthenticated'](),controller[_0x9bd7('0x10')]);router['get'](_0x9bd7('0x11'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x12')]);router['get'](_0x9bd7('0x13'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x14')]);router['get'](_0x9bd7('0x15'),auth['isAuthenticated'](),controller[_0x9bd7('0x16')]);router[_0x9bd7('0x17')]('/',auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x18')]);router[_0x9bd7('0x17')](_0x9bd7('0xe'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x19')]);router[_0x9bd7('0x17')](_0x9bd7('0xf'),auth['isAuthenticated'](),controller[_0x9bd7('0x1a')]);router[_0x9bd7('0x17')]('/:id/notify',controller['notify']);router[_0x9bd7('0x17')](_0x9bd7('0x11'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x1b')]);router[_0x9bd7('0x17')]('/:id/users',auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x1c')]);router[_0x9bd7('0x17')](_0x9bd7('0x1d'),auth[_0x9bd7('0xb')](),controller['send']);router[_0x9bd7('0x1e')]('/:id',auth[_0x9bd7('0xb')](),controller['update']);router['delete'](_0x9bd7('0xc'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x1f')]);router[_0x9bd7('0x20')](_0x9bd7('0xe'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x21')]);router[_0x9bd7('0x20')]('/:id/canned_answers',auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x22')]);router[_0x9bd7('0x20')](_0x9bd7('0x15'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x23')]);module[_0x9bd7('0x24')]=router; \ No newline at end of file +var _0x19e9=['/:id/users','getAgents','post','create','/:id/notify','notify','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x19e9,0xac));var _0x919e=function(_0x223dd8,_0x5d003b){_0x223dd8=_0x223dd8-0x0;var _0xb8f09a=_0x19e9[_0x223dd8];return _0xb8f09a;};'use strict';var multer=require(_0x919e('0x0'));var util=require(_0x919e('0x1'));var path=require(_0x919e('0x2'));var timeout=require('connect-timeout');var express=require(_0x919e('0x3'));var router=express[_0x919e('0x4')]();var fs_extra=require(_0x919e('0x5'));var auth=require(_0x919e('0x6'));var interaction=require(_0x919e('0x7'));var config=require(_0x919e('0x8'));var controller=require(_0x919e('0x9'));router[_0x919e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x919e('0xa')](_0x919e('0xb'),auth[_0x919e('0xc')](),controller[_0x919e('0xd')]);router[_0x919e('0xa')](_0x919e('0xe'),auth[_0x919e('0xc')](),controller[_0x919e('0xf')]);router[_0x919e('0xa')](_0x919e('0x10'),auth[_0x919e('0xc')](),controller[_0x919e('0x11')]);router['get'](_0x919e('0x12'),auth[_0x919e('0xc')](),controller['getAnswers']);router['get'](_0x919e('0x13'),auth[_0x919e('0xc')](),controller[_0x919e('0x14')]);router[_0x919e('0xa')](_0x919e('0x15'),auth[_0x919e('0xc')](),controller[_0x919e('0x16')]);router[_0x919e('0xa')](_0x919e('0x17'),auth[_0x919e('0xc')](),controller[_0x919e('0x18')]);router[_0x919e('0x19')]('/',auth[_0x919e('0xc')](),controller[_0x919e('0x1a')]);router[_0x919e('0x19')]('/:id/dispositions',auth[_0x919e('0xc')](),controller['addDisposition']);router['post'](_0x919e('0x12'),auth[_0x919e('0xc')](),controller['addAnswer']);router[_0x919e('0x19')](_0x919e('0x1b'),controller[_0x919e('0x1c')]);router[_0x919e('0x19')](_0x919e('0x13'),auth['isAuthenticated'](),controller['addApplications']);router['post']('/:id/users',auth[_0x919e('0xc')](),controller[_0x919e('0x1d')]);router['post'](_0x919e('0x1e'),auth[_0x919e('0xc')](),controller[_0x919e('0x1f')]);router[_0x919e('0x20')](_0x919e('0xe'),auth[_0x919e('0xc')](),controller[_0x919e('0x21')]);router[_0x919e('0x22')](_0x919e('0xe'),auth[_0x919e('0xc')](),controller[_0x919e('0x23')]);router['delete'](_0x919e('0x10'),auth['isAuthenticated'](),controller[_0x919e('0x24')]);router['delete'](_0x919e('0x12'),auth['isAuthenticated'](),controller[_0x919e('0x25')]);router[_0x919e('0x22')](_0x919e('0x17'),auth[_0x919e('0xc')](),controller[_0x919e('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 3d38381..6ff01d9 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 _0x72a9=['mandatoryDisposition','sequelize','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x72a9,0x1cf));var _0x972a=function(_0x1b3c82,_0x4cf0ca){_0x1b3c82=_0x1b3c82-0x0;var _0x435a72=_0x72a9[_0x1b3c82];return _0x435a72;};'use strict';var Sequelize=require(_0x972a('0x0'));var rs=require(_0x972a('0x1'));module['exports']={'name':{'type':Sequelize[_0x972a('0x2')],'unique':_0x972a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x972a('0x2')]},'token':{'type':Sequelize[_0x972a('0x2')],'defaultValue':function(){return rs[_0x972a('0x4')]();}},'replyUri':{'type':Sequelize[_0x972a('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x972a('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x972a('0x5')],'defaultValue':function(){return _0x972a('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x972a('0x2')]},'queueTransfer':{'type':Sequelize[_0x972a('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x972a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x972a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x972a('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x972a('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x972a('0x7')],'defaultValue':![],'comment':_0x972a('0xa'),'set':function(_0x3ef0b5){if(!_0x3ef0b5)this[_0x972a('0xb')](_0x972a('0xc'),null);this[_0x972a('0xb')](_0x972a('0xd'),_0x3ef0b5);}}}; \ No newline at end of file +var _0xdbf8=['exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x5a778b,_0x717daa){var _0x32f0da=function(_0x546db4){while(--_0x546db4){_0x5a778b['push'](_0x5a778b['shift']());}};_0x32f0da(++_0x717daa);}(_0xdbf8,0x1d4));var _0x8dbf=function(_0x14b938,_0x19a5f9){_0x14b938=_0x14b938-0x0;var _0xc02464=_0xdbf8[_0x14b938];return _0xc02464;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x8dbf('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8dbf('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8dbf('0x2')],'defaultValue':function(){return rs[_0x8dbf('0x3')]();}},'replyUri':{'type':Sequelize[_0x8dbf('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x8dbf('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8dbf('0x4')],'defaultValue':function(){return _0x8dbf('0x5');}},'notificationSound':{'type':Sequelize[_0x8dbf('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8dbf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8dbf('0x2')]},'queueTransfer':{'type':Sequelize[_0x8dbf('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8dbf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8dbf('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8dbf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8dbf('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x8dbf('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x8dbf('0x6')],'defaultValue':![],'comment':_0x8dbf('0x9'),'set':function(_0x44d8d9){if(!_0x44d8d9)this[_0x8dbf('0xa')](_0x8dbf('0xb'),null);this[_0x8dbf('0xa')](_0x8dbf('0xc'),_0x44d8d9);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 96ad3e4..902af9b 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 _0x9ec3=['internal','Tag','Tags','color','tag','addAgents','ids','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','out','OpenchannelMessage','dataValues','push','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','OpenchannelAccount','includeAll','include','findAll','rows','show','params','keys','intersection','options','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','body','describe','addDisposition','OpenchannelAccountId','getDispositions','Disposition','order','removeDispositions','CannedAnswer','getAnswers','findOne','pick','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','defaults','ListId','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','getInteractions','Contact','User','Owner'];(function(_0x521c2d,_0x60b836){var _0xda5ea4=function(_0x258b8a){while(--_0x258b8a){_0x521c2d['push'](_0x521c2d['shift']());}};_0xda5ea4(++_0x60b836);}(_0x9ec3,0xcd));var _0x39ec=function(_0x5cc3b6,_0x249e4f){_0x5cc3b6=_0x5cc3b6-0x0;var _0x3ea2e0=_0x9ec3[_0x5cc3b6];return _0x3ea2e0;};'use strict';var emlformat=require(_0x39ec('0x0'));var rimraf=require(_0x39ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x39ec('0x2'));var moment=require('moment');var BPromise=require(_0x39ec('0x3'));var Mustache=require(_0x39ec('0x4'));var util=require(_0x39ec('0x5'));var path=require(_0x39ec('0x6'));var sox=require(_0x39ec('0x7'));var csv=require(_0x39ec('0x8'));var ejs=require(_0x39ec('0x9'));var fs=require('fs');var fs_extra=require(_0x39ec('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x39ec('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x39ec('0xc'));var toCsv=require(_0x39ec('0x8'));var querystring=require(_0x39ec('0xd'));var Papa=require('papaparse');var Redis=require(_0x39ec('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x39ec('0xf'));var as=require(_0x39ec('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39ec('0x11'))(_0x39ec('0x12'));var utils=require(_0x39ec('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x39ec('0x14'))['db'];config[_0x39ec('0x15')]=_['defaults'](config[_0x39ec('0x15')],{'host':_0x39ec('0x16'),'port':0x18eb});var socket=require(_0x39ec('0x17'))(new Redis(config['redis']));require(_0x39ec('0x18'))[_0x39ec('0x19')](socket);var jayson=require(_0x39ec('0x1a'));var client=jayson[_0x39ec('0x1b')][_0x39ec('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x39ec('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe6b518,_0x57cc39,_0x1e0fe1,_0x53d2a9){return new BPromise(function(_0x303173,_0x390fa5){var _0x2ada19=_0x53d2a9||client;return _0x2ada19['request'](_0xe6b518,_0x1e0fe1)[_0x39ec('0x1d')](function(_0x233ef4){logger[_0x39ec('0x1e')](_0x39ec('0x1f'),_0x57cc39,_0x39ec('0x20'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x57cc39,_0x39ec('0x20'),JSON['stringify'](_0x233ef4));if(_0x233ef4[_0x39ec('0x21')]){if(_0x233ef4[_0x39ec('0x21')][_0x39ec('0x22')]===0x1f4){logger[_0x39ec('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x57cc39,_0x233ef4[_0x39ec('0x21')]['message']);return _0x390fa5(_0x233ef4['error'][_0x39ec('0x23')]);}logger[_0x39ec('0x21')](_0x39ec('0x1f'),_0x57cc39,_0x233ef4[_0x39ec('0x21')][_0x39ec('0x23')]);return _0x303173(_0x233ef4[_0x39ec('0x21')][_0x39ec('0x23')]);}else{logger[_0x39ec('0x1e')](_0x39ec('0x1f'),_0x57cc39,_0x39ec('0x20'));_0x303173(_0x233ef4['result']['message']);}})[_0x39ec('0x24')](function(_0x1c5351){logger[_0x39ec('0x21')](_0x39ec('0x1f'),_0x57cc39,_0x1c5351);_0x390fa5(_0x1c5351);});});}function respondWithStatusCode(_0x3c1b00,_0x547993){_0x547993=_0x547993||0xcc;return function(_0x1cda73){if(_0x1cda73){return _0x3c1b00[_0x39ec('0x25')](_0x547993);}return _0x3c1b00[_0x39ec('0x26')](_0x547993)[_0x39ec('0x27')]();};}function respondWithResult(_0x554388,_0xd17e54){_0xd17e54=_0xd17e54||0xc8;return function(_0x100224){if(_0x100224){return _0x554388[_0x39ec('0x26')](_0xd17e54)['json'](_0x100224);}};}function respondWithFilteredResult(_0x403e30,_0x307ee2){return function(_0x4fde69){if(_0x4fde69){var _0x33d071=typeof _0x307ee2[_0x39ec('0x28')]===_0x39ec('0x29')&&typeof _0x307ee2[_0x39ec('0x2a')]===_0x39ec('0x29');var _0x1aac60=_0x4fde69[_0x39ec('0x2b')];var _0x49d9c0=_0x33d071?0x0:_0x307ee2[_0x39ec('0x28')];var _0x3d5020=_0x33d071?_0x4fde69[_0x39ec('0x2b')]:_0x307ee2[_0x39ec('0x28')]+_0x307ee2['limit'];var _0x240384;if(_0x3d5020>=_0x1aac60){_0x3d5020=_0x1aac60;_0x240384=0xc8;}else{_0x240384=0xce;}_0x403e30[_0x39ec('0x26')](_0x240384);return _0x403e30[_0x39ec('0x2c')](_0x39ec('0x2d'),_0x49d9c0+'-'+_0x3d5020+'/'+_0x1aac60)[_0x39ec('0x2e')](_0x4fde69);}return null;};}function patchUpdates(_0x5786c2){return function(_0x760ec9){try{jsonpatch[_0x39ec('0x2f')](_0x760ec9,_0x5786c2,!![]);}catch(_0x5bb5da){return BPromise[_0x39ec('0x30')](_0x5bb5da);}return _0x760ec9[_0x39ec('0x31')]();};}function saveUpdates(_0x54985d,_0x58002e){return function(_0xe67ebc){if(_0xe67ebc){return _0xe67ebc[_0x39ec('0x32')](_0x54985d)[_0x39ec('0x1d')](function(_0x65175c){return _0x65175c;});}return null;};}function removeEntity(_0x13abba,_0x4a36b6){return function(_0x4ac930){if(_0x4ac930){return _0x4ac930[_0x39ec('0x33')]()[_0x39ec('0x1d')](function(){var _0x5e1bdd=_0x4ac930[_0x39ec('0x34')]({'plain':!![]});var _0x3b49d0='OpenchannelAccounts';return db[_0x39ec('0x35')][_0x39ec('0x33')]({'where':{'type':_0x3b49d0,'resourceId':_0x5e1bdd['id']}})[_0x39ec('0x1d')](function(){return _0x4ac930;});})[_0x39ec('0x1d')](function(){_0x13abba[_0x39ec('0x26')](0xcc)[_0x39ec('0x27')]();});}};}function handleEntityNotFound(_0x46c859,_0x4e96bc){return function(_0x306231){if(!_0x306231){_0x46c859[_0x39ec('0x25')](0x194);}return _0x306231;};}function handleError(_0x62803,_0x6d0c36){_0x6d0c36=_0x6d0c36||0x1f4;return function(_0x1958ee){logger['error'](_0x1958ee[_0x39ec('0x36')]);if(_0x1958ee[_0x39ec('0x37')]){delete _0x1958ee[_0x39ec('0x37')];}_0x62803[_0x39ec('0x26')](_0x6d0c36)[_0x39ec('0x38')](_0x1958ee);};}exports[_0x39ec('0x39')]=function(_0x24df3c,_0x4abc34){var _0x5aa209={'include':[{'model':db[_0x39ec('0x3a')],'as':_0x39ec('0x3b')}]},_0xe0e25b={},_0xfb656c={'count':0x0,'rows':[]};var _0x1d4502=_[_0x39ec('0x3c')](db['OpenchannelAccount'][_0x39ec('0x3d')],function(_0x353ab5){return{'name':_0x353ab5[_0x39ec('0x3e')],'type':_0x353ab5['type'][_0x39ec('0x3f')]};});_0xe0e25b['model']=_[_0x39ec('0x3c')](_0x1d4502,'name');_0xe0e25b[_0x39ec('0x40')]=_['keys'](_0x24df3c['query']);_0xe0e25b['filters']=_['intersection'](_0xe0e25b['model'],_0xe0e25b[_0x39ec('0x40')]);_0x5aa209[_0x39ec('0x41')]=_['intersection'](_0xe0e25b['model'],qs[_0x39ec('0x42')](_0x24df3c[_0x39ec('0x40')]['fields']));_0x5aa209[_0x39ec('0x41')]=_0x5aa209[_0x39ec('0x41')][_0x39ec('0x43')]?_0x5aa209[_0x39ec('0x41')]:_0xe0e25b[_0x39ec('0x44')];if(!_0x24df3c['query'][_0x39ec('0x45')](_0x39ec('0x46'))){_0x5aa209['limit']=qs['limit'](_0x24df3c[_0x39ec('0x40')]['limit']);_0x5aa209[_0x39ec('0x28')]=qs[_0x39ec('0x28')](_0x24df3c[_0x39ec('0x40')][_0x39ec('0x28')]);}_0x5aa209['order']=qs[_0x39ec('0x47')](_0x24df3c['query'][_0x39ec('0x47')]);_0x5aa209[_0x39ec('0x48')]=qs[_0x39ec('0x49')](_['pick'](_0x24df3c['query'],_0xe0e25b['filters']),_0x1d4502);if(_0x24df3c['query'][_0x39ec('0x4a')]){_0x5aa209[_0x39ec('0x48')]=_[_0x39ec('0x4b')](_0x5aa209[_0x39ec('0x48')],{'$or':_[_0x39ec('0x3c')](_0x1d4502,function(_0x2159e9){if(_0x2159e9[_0x39ec('0x4c')]!==_0x39ec('0x4d')){var _0x902df2={};_0x902df2[_0x2159e9[_0x39ec('0x37')]]={'$like':'%'+_0x24df3c[_0x39ec('0x40')][_0x39ec('0x4a')]+'%'};return _0x902df2;}})});}_0x5aa209=_[_0x39ec('0x4b')]({},_0x5aa209,_0x24df3c['options']);var _0x497de8={'where':_0x5aa209[_0x39ec('0x48')]};return db[_0x39ec('0x4e')][_0x39ec('0x2b')](_0x497de8)['then'](function(_0x3ad831){_0xfb656c[_0x39ec('0x2b')]=_0x3ad831;if(_0x24df3c[_0x39ec('0x40')][_0x39ec('0x4f')]){_0x5aa209[_0x39ec('0x50')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x39ec('0x51')](_0x5aa209);})[_0x39ec('0x1d')](function(_0x1eca59){_0xfb656c[_0x39ec('0x52')]=_0x1eca59;return _0xfb656c;})[_0x39ec('0x1d')](respondWithFilteredResult(_0x4abc34,_0x5aa209))[_0x39ec('0x24')](handleError(_0x4abc34,null));};exports[_0x39ec('0x53')]=function(_0x5b11e0,_0x24bff4){var _0x38f2ed={'raw':![],'where':{'id':_0x5b11e0[_0x39ec('0x54')]['id']},'include':[{'model':db[_0x39ec('0x3a')],'as':_0x39ec('0x3b')}]},_0xde0881={};_0xde0881[_0x39ec('0x44')]=_[_0x39ec('0x55')](db['OpenchannelAccount']['rawAttributes']);_0xde0881[_0x39ec('0x40')]=_[_0x39ec('0x55')](_0x5b11e0[_0x39ec('0x40')]);_0xde0881[_0x39ec('0x49')]=_[_0x39ec('0x56')](_0xde0881[_0x39ec('0x44')],_0xde0881[_0x39ec('0x40')]);_0x38f2ed[_0x39ec('0x41')]=_[_0x39ec('0x56')](_0xde0881[_0x39ec('0x44')],qs[_0x39ec('0x42')](_0x5b11e0[_0x39ec('0x40')][_0x39ec('0x42')]));_0x38f2ed[_0x39ec('0x41')]=_0x38f2ed[_0x39ec('0x41')][_0x39ec('0x43')]?_0x38f2ed[_0x39ec('0x41')]:_0xde0881['model'];if(_0x5b11e0[_0x39ec('0x40')][_0x39ec('0x4f')]){_0x38f2ed[_0x39ec('0x50')]=[{'all':!![]}];}_0x38f2ed=_[_0x39ec('0x4b')]({},_0x38f2ed,_0x5b11e0[_0x39ec('0x57')]);return db[_0x39ec('0x4e')]['find'](_0x38f2ed)[_0x39ec('0x1d')](handleEntityNotFound(_0x24bff4,null))[_0x39ec('0x1d')](respondWithResult(_0x24bff4,null))[_0x39ec('0x24')](handleError(_0x24bff4,null));};exports[_0x39ec('0x58')]=function(_0x98e01c,_0x47dbe8){return db[_0x39ec('0x4e')][_0x39ec('0x58')](_0x98e01c['body'],{})['then'](function(_0x184007){var _0x47939d=_0x98e01c[_0x39ec('0x59')][_0x39ec('0x34')]({'plain':!![]});if(!_0x47939d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47939d[_0x39ec('0x5a')]===_0x39ec('0x59')){var _0x1a8ea0=_0x184007['get']({'plain':!![]});var _0x51cac2='OpenchannelAccounts';return db[_0x39ec('0x5b')][_0x39ec('0x5c')]({'where':{'name':_0x51cac2,'userProfileId':_0x47939d[_0x39ec('0x5d')]},'raw':!![]})[_0x39ec('0x1d')](function(_0x5163b8){if(_0x5163b8&&_0x5163b8[_0x39ec('0x5e')]===0x0){return db[_0x39ec('0x35')]['create']({'name':_0x1a8ea0['name'],'resourceId':_0x1a8ea0['id'],'type':_0x5163b8[_0x39ec('0x37')],'sectionId':_0x5163b8['id']},{})[_0x39ec('0x1d')](function(){return _0x184007;});}else{return _0x184007;}})[_0x39ec('0x24')](function(_0x2759c9){logger[_0x39ec('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2759c9);throw _0x2759c9;});}return _0x184007;})[_0x39ec('0x1d')](respondWithResult(_0x47dbe8,0xc9))['catch'](handleError(_0x47dbe8,null));};exports[_0x39ec('0x32')]=function(_0x481ce5,_0x36f5a8){if(_0x481ce5[_0x39ec('0x5f')]['id']){delete _0x481ce5[_0x39ec('0x5f')]['id'];}return db['OpenchannelAccount'][_0x39ec('0x5c')]({'where':{'id':_0x481ce5[_0x39ec('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x39ec('0x3b')}]})['then'](handleEntityNotFound(_0x36f5a8,null))[_0x39ec('0x1d')](saveUpdates(_0x481ce5['body'],null))['then'](respondWithResult(_0x36f5a8,null))[_0x39ec('0x24')](handleError(_0x36f5a8,null));};exports['destroy']=function(_0x15c6ba,_0x5e72c0){return db[_0x39ec('0x4e')][_0x39ec('0x5c')]({'where':{'id':_0x15c6ba[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x5e72c0,null))[_0x39ec('0x1d')](removeEntity(_0x5e72c0,null))['catch'](handleError(_0x5e72c0,null));};exports[_0x39ec('0x60')]=function(_0x97136d,_0x59b788){return db['OpenchannelAccount'][_0x39ec('0x60')]()['then'](respondWithResult(_0x59b788,null))[_0x39ec('0x24')](handleError(_0x59b788,null));};exports[_0x39ec('0x61')]=function(_0xcad5d9,_0x37d1a6,_0x2cd7b3){if(_0xcad5d9[_0x39ec('0x5f')]['id']){delete _0xcad5d9['body']['id'];}return db[_0x39ec('0x4e')][_0x39ec('0x5c')]({'where':{'id':_0xcad5d9['params']['id']}})['then'](handleEntityNotFound(_0x37d1a6,null))[_0x39ec('0x1d')](function(_0x4b3e0a){if(_0x4b3e0a){_0xcad5d9[_0x39ec('0x5f')][_0x39ec('0x62')]=_0x4b3e0a['id'];return db['Disposition'][_0x39ec('0x58')](_0xcad5d9[_0x39ec('0x5f')]);}})[_0x39ec('0x1d')](respondWithResult(_0x37d1a6,null))[_0x39ec('0x24')](handleError(_0x37d1a6,null));};exports[_0x39ec('0x63')]=function(_0x913bd6,_0x125189,_0x496c23){var _0x1d8470={'raw':![],'where':{}};var _0x45f368={};var _0x334f8e={'count':0x0,'rows':[]};return db[_0x39ec('0x4e')]['findOne']({'where':{'id':_0x913bd6[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x125189,null))[_0x39ec('0x1d')](function(_0xae6aa5){if(_0xae6aa5){_0x45f368[_0x39ec('0x44')]=_[_0x39ec('0x55')](db[_0x39ec('0x64')][_0x39ec('0x3d')]);_0x45f368['query']=_[_0x39ec('0x55')](_0x913bd6['query']);_0x45f368[_0x39ec('0x49')]=_[_0x39ec('0x56')](_0x45f368['model'],_0x45f368[_0x39ec('0x40')]);_0x1d8470[_0x39ec('0x41')]=_['intersection'](_0x45f368[_0x39ec('0x44')],qs[_0x39ec('0x42')](_0x913bd6[_0x39ec('0x40')][_0x39ec('0x42')]));_0x1d8470[_0x39ec('0x41')]=_0x1d8470[_0x39ec('0x41')][_0x39ec('0x43')]?_0x1d8470[_0x39ec('0x41')]:_0x45f368[_0x39ec('0x44')];if(!_0x913bd6['query']['hasOwnProperty'](_0x39ec('0x46'))){_0x1d8470['limit']=qs[_0x39ec('0x2a')](_0x913bd6[_0x39ec('0x40')]['limit']);_0x1d8470['offset']=qs[_0x39ec('0x28')](_0x913bd6[_0x39ec('0x40')][_0x39ec('0x28')]);}_0x1d8470[_0x39ec('0x65')]=qs[_0x39ec('0x47')](_0x913bd6[_0x39ec('0x40')][_0x39ec('0x47')]);_0x1d8470[_0x39ec('0x48')]=qs[_0x39ec('0x49')](_['pick'](_0x913bd6['query'],_0x45f368['filters']));_0x1d8470[_0x39ec('0x48')]['OpenchannelAccountId']=_0xae6aa5['id'];if(_0x913bd6['query'][_0x39ec('0x4a')]){_0x1d8470['where']=_['merge'](_0x1d8470['where'],{'$or':_[_0x39ec('0x3c')](_0x1d8470[_0x39ec('0x41')],function(_0x58f748){var _0x15a505={};_0x15a505[_0x58f748]={'$like':'%'+_0x913bd6[_0x39ec('0x40')][_0x39ec('0x4a')]+'%'};return _0x15a505;})});}_0x1d8470=_[_0x39ec('0x4b')]({},_0x1d8470,_0x913bd6[_0x39ec('0x57')]);return db['Disposition'][_0x39ec('0x2b')]({'where':_0x1d8470[_0x39ec('0x48')]})[_0x39ec('0x1d')](function(_0x7af973){_0x334f8e[_0x39ec('0x2b')]=_0x7af973;if(_0x913bd6[_0x39ec('0x40')][_0x39ec('0x4f')]){_0x1d8470['include']=[{'all':!![]}];}return db[_0x39ec('0x64')]['findAll'](_0x1d8470);})[_0x39ec('0x1d')](function(_0x190e5d){_0x334f8e['rows']=_0x190e5d;return _0x334f8e;});}})[_0x39ec('0x1d')](respondWithFilteredResult(_0x125189,_0x1d8470))[_0x39ec('0x24')](handleError(_0x125189,null));};exports[_0x39ec('0x66')]=function(_0x36bd14,_0x59462e,_0x4af6b8){return db['OpenchannelAccount']['find']({'where':{'id':_0x36bd14[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x59462e,null))[_0x39ec('0x1d')](function(_0x3ec4d4){if(_0x3ec4d4){return _0x3ec4d4[_0x39ec('0x66')](_0x36bd14[_0x39ec('0x40')]['ids']);}})[_0x39ec('0x1d')](respondWithStatusCode(_0x59462e,null))['catch'](handleError(_0x59462e,null));};exports['addAnswer']=function(_0xbe83e7,_0xd6689,_0x440908){if(_0xbe83e7[_0x39ec('0x5f')]['id']){delete _0xbe83e7[_0x39ec('0x5f')]['id'];}return db['OpenchannelAccount'][_0x39ec('0x5c')]({'where':{'id':_0xbe83e7[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0xd6689,null))[_0x39ec('0x1d')](function(_0x7c7720){if(_0x7c7720){_0xbe83e7[_0x39ec('0x5f')][_0x39ec('0x62')]=_0x7c7720['id'];return db[_0x39ec('0x67')][_0x39ec('0x58')](_0xbe83e7[_0x39ec('0x5f')]);}})[_0x39ec('0x1d')](respondWithResult(_0xd6689,null))[_0x39ec('0x24')](handleError(_0xd6689,null));};exports[_0x39ec('0x68')]=function(_0x5d4ca0,_0x2c843a,_0x2ad1ed){var _0x285e09={'raw':![],'where':{}};var _0x27b07b={};var _0x37dd3d={'count':0x0,'rows':[]};return db[_0x39ec('0x4e')][_0x39ec('0x69')]({'where':{'id':_0x5d4ca0['params']['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x2c843a,null))[_0x39ec('0x1d')](function(_0x3389ec){if(_0x3389ec){_0x27b07b['model']=_[_0x39ec('0x55')](db[_0x39ec('0x67')][_0x39ec('0x3d')]);_0x27b07b[_0x39ec('0x40')]=_[_0x39ec('0x55')](_0x5d4ca0[_0x39ec('0x40')]);_0x27b07b[_0x39ec('0x49')]=_[_0x39ec('0x56')](_0x27b07b['model'],_0x27b07b[_0x39ec('0x40')]);_0x285e09[_0x39ec('0x41')]=_[_0x39ec('0x56')](_0x27b07b['model'],qs['fields'](_0x5d4ca0[_0x39ec('0x40')][_0x39ec('0x42')]));_0x285e09[_0x39ec('0x41')]=_0x285e09[_0x39ec('0x41')]['length']?_0x285e09[_0x39ec('0x41')]:_0x27b07b['model'];if(!_0x5d4ca0[_0x39ec('0x40')]['hasOwnProperty']('nolimit')){_0x285e09[_0x39ec('0x2a')]=qs[_0x39ec('0x2a')](_0x5d4ca0[_0x39ec('0x40')][_0x39ec('0x2a')]);_0x285e09[_0x39ec('0x28')]=qs[_0x39ec('0x28')](_0x5d4ca0[_0x39ec('0x40')]['offset']);}_0x285e09[_0x39ec('0x65')]=qs[_0x39ec('0x47')](_0x5d4ca0[_0x39ec('0x40')]['sort']);_0x285e09['where']=qs[_0x39ec('0x49')](_[_0x39ec('0x6a')](_0x5d4ca0[_0x39ec('0x40')],_0x27b07b[_0x39ec('0x49')]));_0x285e09[_0x39ec('0x48')]['OpenchannelAccountId']=_0x3389ec['id'];if(_0x5d4ca0[_0x39ec('0x40')][_0x39ec('0x4a')]){_0x285e09[_0x39ec('0x48')]=_[_0x39ec('0x4b')](_0x285e09[_0x39ec('0x48')],{'$or':_[_0x39ec('0x3c')](_0x285e09[_0x39ec('0x41')],function(_0x5c78c8){var _0x3f7174={};_0x3f7174[_0x5c78c8]={'$like':'%'+_0x5d4ca0['query']['filter']+'%'};return _0x3f7174;})});}_0x285e09=_['merge']({},_0x285e09,_0x5d4ca0[_0x39ec('0x57')]);return db['CannedAnswer']['count']({'where':_0x285e09['where']})[_0x39ec('0x1d')](function(_0x20c074){_0x37dd3d[_0x39ec('0x2b')]=_0x20c074;if(_0x5d4ca0[_0x39ec('0x40')][_0x39ec('0x4f')]){_0x285e09[_0x39ec('0x50')]=[{'all':!![]}];}return db[_0x39ec('0x67')][_0x39ec('0x51')](_0x285e09);})[_0x39ec('0x1d')](function(_0x284c90){_0x37dd3d[_0x39ec('0x52')]=_0x284c90;return _0x37dd3d;});}})[_0x39ec('0x1d')](respondWithFilteredResult(_0x2c843a,_0x285e09))[_0x39ec('0x24')](handleError(_0x2c843a,null));};exports['removeAnswers']=function(_0x170b78,_0x21ad72,_0x474be5){return db['OpenchannelAccount'][_0x39ec('0x5c')]({'where':{'id':_0x170b78[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x21ad72,null))['then'](function(_0x3e77a3){if(_0x3e77a3){return _0x3e77a3[_0x39ec('0x6b')](_0x170b78['query']['ids']);}})[_0x39ec('0x1d')](respondWithStatusCode(_0x21ad72,null))[_0x39ec('0x24')](handleError(_0x21ad72,null));};exports[_0x39ec('0x6c')]=function(_0x5cfbe8,_0x8c27fa,_0x472e3d){var _0x17bc45={'body':_0x5cfbe8[_0x39ec('0x5f')],'channel':_0x39ec('0x6d')};var _0x57d11a=[];var _0x4a13dd=[];var _0x1178c3={};var _0x152f7a=![];return db[_0x39ec('0x6e')][_0x39ec('0x60')]()[_0x39ec('0x1d')](function(_0x5108e7){if(!_0x5108e7){throw new db[(_0x39ec('0x6f'))][(_0x39ec('0x70'))](_0x39ec('0x71'));}_0x57d11a=_[_0x39ec('0x72')](_['keys'](_0x5108e7),[_0x39ec('0x73'),'updatedAt']);_0x4a13dd=_[_0x39ec('0x72')](_[_0x39ec('0x55')](_0x5108e7),[_0x39ec('0x73'),_0x39ec('0x74'),_0x39ec('0x75'),'ListId']);if(_0x5cfbe8[_0x39ec('0x5f')]['id']){delete _0x5cfbe8[_0x39ec('0x5f')]['id'];}if(_[_0x39ec('0x76')](_0x5cfbe8['body'][_0x39ec('0x77')])){throw new db[(_0x39ec('0x6f'))][(_0x39ec('0x70'))](_0x39ec('0x78'));}if(_[_0x39ec('0x76')](_0x5cfbe8[_0x39ec('0x5f')]['body'])||_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x5f')]===''){throw new db[(_0x39ec('0x6f'))][(_0x39ec('0x70'))](_0x39ec('0x79'));}if(_['isNil'](_0x5cfbe8['body'][_0x39ec('0x7a')])){throw new db[(_0x39ec('0x6f'))][(_0x39ec('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4a13dd);}if(!_[_0x39ec('0x7b')](_0x4a13dd,_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x7a')])){throw new db[(_0x39ec('0x6f'))][(_0x39ec('0x70'))](_0x39ec('0x7c')+_0x4a13dd);}_0x1178c3[_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x7a')]]=_0x5cfbe8['body']['from'];})[_0x39ec('0x1d')](function(){return db[_0x39ec('0x4e')][_0x39ec('0x5c')]({'where':{'id':_0x5cfbe8[_0x39ec('0x54')]['id']},'include':[{'model':db[_0x39ec('0x7d')],'as':_0x39ec('0x7e'),'include':[{'model':db[_0x39ec('0x6e')],'as':_0x39ec('0x7f'),'where':_0x1178c3,'limit':0x1,'order':[[_0x39ec('0x74'),_0x39ec('0x80')]]}]},{'model':db[_0x39ec('0x81')],'as':_0x39ec('0x82')}]});})[_0x39ec('0x1d')](handleEntityNotFound(_0x8c27fa,null))[_0x39ec('0x1d')](function(_0x5d2136){if(_0x5d2136&&_0x5d2136['List']){_0x17bc45[_0x39ec('0x83')]=_0x5d2136;_0x17bc45[_0x39ec('0x84')]=_0x5d2136['Applications'];_0x17bc45['list']=_0x5d2136[_0x39ec('0x7e')];_0x17bc45[_0x39ec('0x84')]=_[_0x39ec('0x85')](_0x17bc45[_0x39ec('0x84')],[_0x39ec('0x86')],['asc']);if(_0x17bc45[_0x39ec('0x83')][_0x39ec('0x82')]){delete _0x17bc45[_0x39ec('0x83')][_0x39ec('0x82')];}if(_0x17bc45[_0x39ec('0x83')][_0x39ec('0x7e')]&&_0x17bc45[_0x39ec('0x83')]['List'][_0x39ec('0x7f')]['length']){return _0x17bc45['account'][_0x39ec('0x7e')]['Contacts'][0x0];}var _0x5dfa6c=_[_0x39ec('0x87')](_0x5cfbe8[_0x39ec('0x5f')],{'firstName':_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x77')],'ListId':_0x5d2136[_0x39ec('0x88')]});_0x5dfa6c[_0x5cfbe8[_0x39ec('0x5f')]['mapKey']]=_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x77')];return db[_0x39ec('0x6e')][_0x39ec('0x58')](_0x5dfa6c,{'fields':_0x57d11a,'raw':!![]});}})[_0x39ec('0x1d')](handleEntityNotFound(_0x8c27fa,null))[_0x39ec('0x1d')](function(_0x16ab98){_0x17bc45[_0x39ec('0x89')]=_0x16ab98;if(_0x16ab98){var _0x1a4621={'ContactId':_0x16ab98['id'],'OpenchannelAccountId':_0x5cfbe8[_0x39ec('0x54')]['id'],'from':(_0x16ab98[_0x39ec('0x8a')]||'')+'\x20'+(_0x16ab98['lastName']||'')};var _0x44bde7={'OpenchannelAccountId':_0x5cfbe8[_0x39ec('0x54')]['id'],'closed':![]};if(_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x8b')]){_0x44bde7[_0x39ec('0x8b')]=_0x5cfbe8[_0x39ec('0x5f')]['threadId'];return db[_0x39ec('0x8c')][_0x39ec('0x5c')]({'where':_0x44bde7})[_0x39ec('0x1d')](function(_0x80575a){if(_0x80575a){return[_0x80575a,![]];}_0x1a4621[_0x39ec('0x8b')]=_0x5cfbe8['body'][_0x39ec('0x8b')];_0x1a4621['externalUrl']=_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x8d')];return db[_0x39ec('0x8c')]['create'](_0x1a4621)[_0x39ec('0x1d')](function(_0x47f3d8){return[_0x47f3d8,!![]];});});}else{_0x44bde7[_0x39ec('0x8b')]=null;}_0x44bde7[_0x39ec('0x8e')]=_0x16ab98['id'];return db[_0x39ec('0x8c')][_0x39ec('0x5c')]({'where':_0x44bde7})[_0x39ec('0x1d')](function(_0x58d2d5){if(_0x58d2d5){return[_0x58d2d5,![]];}return db[_0x39ec('0x8c')][_0x39ec('0x58')](_0x1a4621)['then'](function(_0x36267e){return[_0x36267e,!![]];});});}})[_0x39ec('0x8f')](function(_0x26b2f9,_0x174939){if(_0x26b2f9){_0x152f7a=_0x174939;if(!_0x174939){var _0x565eec={'from':(_0x17bc45[_0x39ec('0x89')][_0x39ec('0x8a')]||'')+'\x20'+(_0x17bc45[_0x39ec('0x89')][_0x39ec('0x90')]||'')};if(_0x5cfbe8[_0x39ec('0x5f')]['threadId']&&_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x91')]&&_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x8b')]!=_0x5cfbe8['body'][_0x39ec('0x91')]){_0x565eec['threadId']=_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x91')];}return _0x26b2f9['update'](_0x565eec);}else{return _0x26b2f9;}}})[_0x39ec('0x1d')](function(_0x323202){_0x17bc45['interaction']=_0x323202[_0x39ec('0x34')]({'plain':!![]});_0x17bc45[_0x39ec('0x92')]['created']=_0x152f7a;if(_0x17bc45[_0x39ec('0x92')][_0x39ec('0x93')]){if(_0x17bc45[_0x39ec('0x83')][_0x39ec('0x94')]){_0x17bc45[_0x39ec('0x84')]['push']({'id':0x0,'priority':_0x17bc45[_0x39ec('0x84')]['length']+0x1,'app':_0x39ec('0x95'),'appdata':_0x39ec('0x96'),'interval':_0x39ec('0x97')});}}return db['OpenchannelMessage']['create']({'body':_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x5f')],'OpenchannelAccountId':_0x5cfbe8['params']['id'],'OpenchannelInteractionId':_0x323202['id'],'direction':'in','ContactId':_0x17bc45['contact']['id'],'AttachmentId':_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x98')]});})[_0x39ec('0x1d')](function(_0x664e6){_0x17bc45[_0x39ec('0x23')]=_0x664e6;if(_0x17bc45[_0x39ec('0x92')][_0x39ec('0x99')]){return db['User'][_0x39ec('0x5c')]({'attributes':['id',_0x39ec('0x37')],'where':{'id':_0x17bc45[_0x39ec('0x92')][_0x39ec('0x99')]}})[_0x39ec('0x1d')](function(_0x8236b9){if(_0x8236b9){_0x17bc45['applications'][_0x39ec('0x9a')]({'id':0x0,'priority':0x0,'app':_0x39ec('0x9b'),'appdata':_0x8236b9[_0x39ec('0x37')]+','+(_0x17bc45[_0x39ec('0x83')][_0x39ec('0x9c')]||0xa),'interval':_0x39ec('0x97')});_0x17bc45[_0x39ec('0x9d')]=![];}return respondWithRpcPromise(_0x39ec('0x9e'),_0x39ec('0x9f'),_0x17bc45);});}return respondWithRpcPromise(_0x39ec('0x9e'),'startRouting',_0x17bc45);})['then'](function(_0x1ec3d7){respondWithRpcPromise(_0x39ec('0xa0'),_0x39ec('0xa0'),{'event':'notify','message':_0x1ec3d7},client9002);return _0x1ec3d7;})['then'](respondWithResult(_0x8c27fa,null))[_0x39ec('0x24')](handleError(_0x8c27fa,null));};exports[_0x39ec('0xa1')]=function(_0x3f189f,_0x661e7){var _0x4b696f=_0x3f189f[_0x39ec('0x54')]['id'];var _0x1cb3b5=_0x3f189f[_0x39ec('0x5f')];var _0x33313a=0xc8;var _0x4ccad2=null;return db[_0x39ec('0xa2')][_0x39ec('0xa3')]({'isolationLevel':db[_0x39ec('0xa2')][_0x39ec('0xa4')][_0x39ec('0xa5')]['READ_COMMITTED']},function(_0x42f137){return db[_0x39ec('0x4e')][_0x39ec('0x69')]({'where':{'id':_0x4b696f},'transaction':_0x42f137})[_0x39ec('0x1d')](function(_0x434ad1){if(_0x434ad1){return db[_0x39ec('0x81')]['destroy']({'where':{'OpenchannelAccountId':_0x4b696f},'transaction':_0x42f137})[_0x39ec('0x1d')](function(){var _0x4952f0=_[_0x39ec('0x3c')](_0x1cb3b5,function(_0x1e3697){_0x1e3697[_0x39ec('0x62')]=_0x4b696f;return _0x1e3697;});return db['OpenchannelApplication']['bulkCreate'](_0x4952f0,{'transaction':_0x42f137});});}else{_0x33313a=0x194;_0x4ccad2=[];}});})['then'](function(){if(_0x33313a!==0x194){return db[_0x39ec('0x81')][_0x39ec('0xa6')]({'where':{'OpenchannelAccountId':_0x4b696f},'order':'priority'})['then'](function(_0x486a92){_0x4ccad2=_0x486a92;});}})[_0x39ec('0x24')](function(_0x5a3afe){_0x33313a=0x1f4;logger[_0x39ec('0x21')](_0x5a3afe[_0x39ec('0x36')]);if(_0x5a3afe[_0x39ec('0x37')]){delete _0x5a3afe[_0x39ec('0x37')];}_0x4ccad2=_0x5a3afe;})[_0x39ec('0xa7')](function(){if(_0x4ccad2===null){_0x661e7[_0x39ec('0x25')](_0x33313a);}else{if(_0x33313a===0x1f4){_0x661e7[_0x39ec('0x26')](_0x33313a)['send'](_0x4ccad2);}else{_0x661e7[_0x39ec('0x26')](_0x33313a)['json'](_0x4ccad2);}}});};exports[_0x39ec('0xa8')]=function(_0xccade5,_0x14fe00,_0x5ca0ad){var _0xce83e={};var _0x3ce239={};var _0xd32348;var _0x34d12f;return db[_0x39ec('0x4e')][_0x39ec('0x69')]({'where':{'id':_0xccade5[_0x39ec('0x54')]['id']}})['then'](handleEntityNotFound(_0x14fe00,null))['then'](function(_0x6b0923){if(_0x6b0923){_0xd32348=_0x6b0923;_0x3ce239[_0x39ec('0x44')]=_[_0x39ec('0x55')](db[_0x39ec('0x81')][_0x39ec('0x3d')]);_0x3ce239['query']=_[_0x39ec('0x55')](_0xccade5[_0x39ec('0x40')]);_0x3ce239[_0x39ec('0x49')]=_[_0x39ec('0x56')](_0x3ce239['model'],_0x3ce239[_0x39ec('0x40')]);_0xce83e['attributes']=_[_0x39ec('0x56')](_0x3ce239[_0x39ec('0x44')],qs['fields'](_0xccade5[_0x39ec('0x40')]['fields']));_0xce83e[_0x39ec('0x41')]=_0xce83e[_0x39ec('0x41')]['length']?_0xce83e['attributes']:_0x3ce239[_0x39ec('0x44')];_0xce83e[_0x39ec('0x65')]=qs[_0x39ec('0x47')](_0xccade5['query'][_0x39ec('0x47')]);_0xce83e[_0x39ec('0x48')]=qs['filters'](_[_0x39ec('0x6a')](_0xccade5[_0x39ec('0x40')],_0x3ce239[_0x39ec('0x49')]));if(_0xccade5['query']['filter']){_0xce83e[_0x39ec('0x48')]=_[_0x39ec('0x4b')](_0xce83e[_0x39ec('0x48')],{'$or':_[_0x39ec('0x3c')](_0xce83e[_0x39ec('0x41')],function(_0x154a03){var _0x95d2d7={};_0x95d2d7[_0x154a03]={'$like':'%'+_0xccade5[_0x39ec('0x40')][_0x39ec('0x4a')]+'%'};return _0x95d2d7;})});}_0xce83e=_[_0x39ec('0x4b')]({},_0xce83e,_0xccade5[_0x39ec('0x57')]);return _0xd32348[_0x39ec('0xa8')](_0xce83e);}})[_0x39ec('0x1d')](function(_0x226966){if(_0x226966){_0x34d12f=_0x226966[_0x39ec('0x43')];if(!_0xccade5[_0x39ec('0x40')]['hasOwnProperty']('nolimit')){_0xce83e['limit']=qs[_0x39ec('0x2a')](_0xccade5['query']['limit']);_0xce83e[_0x39ec('0x28')]=qs[_0x39ec('0x28')](_0xccade5[_0x39ec('0x40')][_0x39ec('0x28')]);}return _0xd32348[_0x39ec('0xa8')](_0xce83e);}})['then'](function(_0x434c04){if(_0x434c04){return _0x434c04?{'count':_0x34d12f,'rows':_0x434c04}:null;}})[_0x39ec('0x1d')](respondWithResult(_0x14fe00,null))['catch'](handleError(_0x14fe00,null));};exports[_0x39ec('0xa9')]=function(_0xa29710,_0x4ec295,_0x1c9e51){var _0x51b37b={'raw':![],'where':{}};var _0xa66627={};var _0x46e872={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x39ec('0x69')]({'where':{'id':_0xa29710[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x4ec295,null))[_0x39ec('0x1d')](function(_0x50c63e){if(_0x50c63e){_0xa66627[_0x39ec('0x44')]=_[_0x39ec('0x55')](db['OpenchannelInteraction'][_0x39ec('0x3d')]);_0xa66627[_0x39ec('0x40')]=_[_0x39ec('0x55')](_0xa29710[_0x39ec('0x40')]);_0xa66627[_0x39ec('0x49')]=_[_0x39ec('0x56')](_0xa66627[_0x39ec('0x44')],_0xa66627[_0x39ec('0x40')]);_0x51b37b[_0x39ec('0x41')]=_[_0x39ec('0x56')](_0xa66627[_0x39ec('0x44')],qs[_0x39ec('0x42')](_0xa29710[_0x39ec('0x40')][_0x39ec('0x42')]));_0x51b37b[_0x39ec('0x41')]=_0x51b37b['attributes'][_0x39ec('0x43')]?_0x51b37b[_0x39ec('0x41')]:_0xa66627[_0x39ec('0x44')];if(!_0xa29710[_0x39ec('0x40')][_0x39ec('0x45')]('nolimit')){_0x51b37b[_0x39ec('0x2a')]=qs[_0x39ec('0x2a')](_0xa29710[_0x39ec('0x40')][_0x39ec('0x2a')]);_0x51b37b[_0x39ec('0x28')]=qs[_0x39ec('0x28')](_0xa29710['query']['offset']);}_0x51b37b[_0x39ec('0x65')]=qs[_0x39ec('0x47')](_0xa29710[_0x39ec('0x40')]['sort']);_0x51b37b[_0x39ec('0x48')]=qs[_0x39ec('0x49')](_['pick'](_0xa29710['query'],_0xa66627['filters']));_0x51b37b[_0x39ec('0x48')][_0x39ec('0x62')]=_0x50c63e['id'];if(_0xa29710['query'][_0x39ec('0x4a')]){_0x51b37b[_0x39ec('0x48')]=_[_0x39ec('0x4b')](_0x51b37b['where'],{'$or':_[_0x39ec('0x3c')](_0x51b37b[_0x39ec('0x41')],function(_0x97341c){var _0x3ad8ca={};_0x3ad8ca[_0x97341c]={'$like':'%'+_0xa29710['query'][_0x39ec('0x4a')]+'%'};return _0x3ad8ca;})});}_0x51b37b=_[_0x39ec('0x4b')]({},_0x51b37b,_0xa29710[_0x39ec('0x57')]);return db[_0x39ec('0x8c')][_0x39ec('0x2b')]({'where':_0x51b37b['where']})[_0x39ec('0x1d')](function(_0x2d55ef){_0x46e872[_0x39ec('0x2b')]=_0x2d55ef;if(_0xa29710[_0x39ec('0x40')][_0x39ec('0x4f')]){_0x51b37b['include']=[{'model':db['CmContact'],'as':_0x39ec('0xaa'),'required':![]},{'model':db[_0x39ec('0xab')],'as':_0x39ec('0xac'),'attributes':['name','fullname',_0x39ec('0xad')],'required':![]},{'model':db[_0x39ec('0xae')],'as':_0x39ec('0xaf'),'attributes':['id',_0x39ec('0x37'),_0x39ec('0xb0')],'where':_0xa29710['query'][_0x39ec('0xb1')]?{'id':_0xa29710[_0x39ec('0x40')]['tag']}:undefined,'required':_0xa29710['query']['tag']?!![]:![]}];}return db[_0x39ec('0x8c')][_0x39ec('0x51')](_0x51b37b);})[_0x39ec('0x1d')](function(_0x1df9dd){_0x46e872[_0x39ec('0x52')]=_0x1df9dd;return _0x46e872;});}})['then'](respondWithFilteredResult(_0x4ec295,_0x51b37b))[_0x39ec('0x24')](handleError(_0x4ec295,null));};exports[_0x39ec('0xb2')]=function(_0x53fd3c,_0x24ae47,_0xde4eb){return db['OpenchannelAccount']['find']({'where':{'id':_0x53fd3c[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x24ae47,null))[_0x39ec('0x1d')](function(_0x27b016){if(_0x27b016){return _0x27b016[_0x39ec('0xb2')](_0x53fd3c[_0x39ec('0x5f')][_0x39ec('0xb3')],_['omit'](_0x53fd3c[_0x39ec('0x5f')],[_0x39ec('0xb3'),'id'])||{})['spread'](function(_0x12378f){for(var _0x18cad7=0x0;_0x18cad7<_0x53fd3c[_0x39ec('0x5f')][_0x39ec('0xb3')][_0x39ec('0x43')];_0x18cad7+=0x1){socket['emit'](_0x39ec('0xb4'),{'UserId':Number(_0x53fd3c[_0x39ec('0x5f')][_0x39ec('0xb3')][_0x18cad7]),'OpenchannelAccountId':Number(_0x53fd3c[_0x39ec('0x54')]['id'])});}return _0x12378f;});}})[_0x39ec('0x1d')](respondWithResult(_0x24ae47,null))[_0x39ec('0x24')](handleError(_0x24ae47,null));};exports['removeAgents']=function(_0x37e2f1,_0x57d374,_0x3262cc){return db[_0x39ec('0x4e')][_0x39ec('0x5c')]({'where':{'id':_0x37e2f1['params']['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x57d374,null))[_0x39ec('0x1d')](function(_0x4fa4a9){if(_0x4fa4a9){return _0x4fa4a9[_0x39ec('0xb5')](_0x37e2f1['query'][_0x39ec('0xb3')])['then'](function(){if(_[_0x39ec('0xb6')](_0x37e2f1[_0x39ec('0x40')][_0x39ec('0xb3')])){for(var _0xf0a300=0x0;_0xf0a300<_0x37e2f1[_0x39ec('0x40')][_0x39ec('0xb3')]['length'];_0xf0a300+=0x1){socket[_0x39ec('0xb7')](_0x39ec('0xb8'),{'UserId':Number(_0x37e2f1[_0x39ec('0x40')][_0x39ec('0xb3')][_0xf0a300]),'OpenchannelAccountId':Number(_0x37e2f1['params']['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x37e2f1[_0x39ec('0x40')][_0x39ec('0xb3')]),'OpenchannelAccountId':Number(_0x37e2f1['params']['id'])});}});}})[_0x39ec('0x1d')](respondWithStatusCode(_0x57d374,null))[_0x39ec('0x24')](handleError(_0x57d374,null));};exports['getAgents']=function(_0x152d8c,_0x481aa5,_0xe88c15){var _0x3fd23c={};var _0x2b64aa={};var _0x50dcfa;var _0x29719b;return db[_0x39ec('0x4e')][_0x39ec('0x69')]({'where':{'id':_0x152d8c[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x481aa5,null))[_0x39ec('0x1d')](function(_0x4c4df9){if(_0x4c4df9){_0x50dcfa=_0x4c4df9;_0x2b64aa[_0x39ec('0x44')]=_[_0x39ec('0x55')](db[_0x39ec('0xab')][_0x39ec('0x3d')]);_0x2b64aa[_0x39ec('0x40')]=_[_0x39ec('0x55')](_0x152d8c['query']);_0x2b64aa[_0x39ec('0x49')]=_['intersection'](_0x2b64aa[_0x39ec('0x44')],_0x2b64aa[_0x39ec('0x40')]);_0x3fd23c[_0x39ec('0x41')]=_[_0x39ec('0x56')](_0x2b64aa[_0x39ec('0x44')],qs[_0x39ec('0x42')](_0x152d8c[_0x39ec('0x40')][_0x39ec('0x42')]));_0x3fd23c[_0x39ec('0x41')]=_0x3fd23c[_0x39ec('0x41')][_0x39ec('0x43')]?_0x3fd23c[_0x39ec('0x41')]:_0x2b64aa['model'];_0x3fd23c['order']=qs[_0x39ec('0x47')](_0x152d8c[_0x39ec('0x40')][_0x39ec('0x47')]);_0x3fd23c['where']=qs['filters'](_[_0x39ec('0x6a')](_0x152d8c['query'],_0x2b64aa[_0x39ec('0x49')]));if(_0x152d8c['query'][_0x39ec('0x4a')]){_0x3fd23c['where']=_[_0x39ec('0x4b')](_0x3fd23c['where'],{'$or':_[_0x39ec('0x3c')](_0x3fd23c[_0x39ec('0x41')],function(_0xa0142){var _0x1b9110={};_0x1b9110[_0xa0142]={'$like':'%'+_0x152d8c[_0x39ec('0x40')]['filter']+'%'};return _0x1b9110;})});}_0x3fd23c=_[_0x39ec('0x4b')]({},_0x3fd23c,_0x152d8c['options']);return _0x50dcfa['getAgents'](_0x3fd23c);}})[_0x39ec('0x1d')](function(_0x542b2f){if(_0x542b2f){_0x29719b=_0x542b2f[_0x39ec('0x43')];if(!_0x152d8c[_0x39ec('0x40')][_0x39ec('0x45')](_0x39ec('0x46'))){_0x3fd23c[_0x39ec('0x2a')]=qs[_0x39ec('0x2a')](_0x152d8c[_0x39ec('0x40')]['limit']);_0x3fd23c['offset']=qs[_0x39ec('0x28')](_0x152d8c['query'][_0x39ec('0x28')]);}return _0x50dcfa['getAgents'](_0x3fd23c);}})[_0x39ec('0x1d')](function(_0x2a7dbb){if(_0x2a7dbb){return _0x2a7dbb?{'count':_0x29719b,'rows':_0x2a7dbb}:null;}})[_0x39ec('0x1d')](respondWithResult(_0x481aa5,null))[_0x39ec('0x24')](handleError(_0x481aa5,null));};exports['send']=function(_0x6c1e0f,_0x566082,_0x2bb067){var _0x402d1f,_0x30bce2,_0x3855a8;if(_[_0x39ec('0x76')](_0x6c1e0f[_0x39ec('0x5f')][_0x39ec('0x5f')])||_0x6c1e0f[_0x39ec('0x5f')][_0x39ec('0x5f')]===''){throw new db['Sequelize'][(_0x39ec('0x70'))](_0x39ec('0x79'));}if(_['isNil'](_0x6c1e0f[_0x39ec('0x5f')]['to'])){}_0x402d1f=_0x6c1e0f[_0x39ec('0x5f')]['to'];return db[_0x39ec('0x4e')][_0x39ec('0x69')]({'where':{'id':_0x6c1e0f[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x566082,null))[_0x39ec('0x1d')](function(_0x1c2441){if(_0x1c2441){return db[_0x39ec('0x4e')][_0x39ec('0x5c')]({'where':{'id':_0x1c2441['id']},'include':[{'model':db[_0x39ec('0x7d')],'as':_0x39ec('0x7e'),'include':[{'model':db['CmContact'],'as':_0x39ec('0x7f'),'where':{[_0x1c2441[_0x39ec('0x7a')]]:_0x402d1f},'limit':0x1,'order':[[_0x39ec('0x74'),_0x39ec('0x80')]]}]}]})[_0x39ec('0x1d')](handleEntityNotFound(_0x566082,null))['then'](function(_0x165928){if(_0x165928&&_0x165928[_0x39ec('0x7e')]){_0x30bce2=_0x165928[_0x39ec('0x34')]({'plain':!![]});if(_0x30bce2[_0x39ec('0x7e')]&&_0x30bce2[_0x39ec('0x7e')][_0x39ec('0x7f')][_0x39ec('0x43')]){return _0x30bce2[_0x39ec('0x7e')][_0x39ec('0x7f')][0x0];}return db[_0x39ec('0x6e')]['create'](_[_0x39ec('0x87')](_0x6c1e0f['body'],{'firstName':_0x402d1f,[_0x165928['mapKey']]:_0x402d1f,'phone':_0x402d1f,'ListId':_0x30bce2[_0x39ec('0x88')]}));}})[_0x39ec('0x1d')](handleEntityNotFound(_0x566082,null))[_0x39ec('0x1d')](function(_0x17ad30){if(_0x17ad30){_0x3855a8=_0x17ad30;return db[_0x39ec('0x8c')][_0x39ec('0x5c')]({'where':{'ContactId':_0x3855a8['id'],'closed':![],'OpenchannelAccountId':_0x30bce2['id']}})['then'](function(_0x1f54a9){if(_0x1f54a9){return[_0x1f54a9,![]];}return db[_0x39ec('0x8c')][_0x39ec('0x58')]({'UserId':_0x6c1e0f[_0x39ec('0x59')]['id'],'ContactId':_0x3855a8['id'],'OpenchannelAccountId':_0x30bce2['id'],'lastMsgDirection':_0x39ec('0xb9'),'firstMsgDirection':_0x39ec('0xb9'),'Messages':[_['merge'](_0x6c1e0f[_0x39ec('0x5f')],{'read':![],'body':_0x6c1e0f[_0x39ec('0x5f')][_0x39ec('0x5f')],'OpenchannelAccountId':_0x30bce2['id'],'UserId':_0x6c1e0f['user']['id'],'ContactId':_0x3855a8['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x39ec('0x1d')](function(_0x470502){return[_0x470502,!![]];});});}})['spread'](function(_0x3e5dd8,_0x30b65c){if(_0x30b65c){return _0x3e5dd8;}return db[_0x39ec('0xba')][_0x39ec('0x58')](_[_0x39ec('0x4b')](_0x6c1e0f['body'],{'read':![],'body':_0x6c1e0f[_0x39ec('0x5f')][_0x39ec('0x5f')],'OpenchannelAccountId':_0x30bce2['id'],'OpenchannelInteractionId':_0x3e5dd8['id'],'UserId':_0x6c1e0f[_0x39ec('0x59')]['id'],'ContactId':_0x3855a8['id']}))['then'](function(_0x2e8181){_0x3e5dd8['dataValues']['Messages']=[];_0x3e5dd8[_0x39ec('0xbb')]['Messages'][_0x39ec('0xbc')](_0x2e8181['dataValues']);return _0x3e5dd8;});});}})[_0x39ec('0x1d')](respondWithResult(_0x566082,null))[_0x39ec('0x24')](handleError(_0x566082,null));}; \ No newline at end of file +var _0x165d=['set','Content-Range','reject','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','OpenchannelAccount','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','nolimit','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','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','from','CmList','List','DESC','Applications','account','applications','orderBy','priority','asc','Contacts','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','color','tag','addAgents','spread','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','user','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./openchannelAccount.socket','register','client','http','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x165d,0x14a));var _0xd165=function(_0x58ced0,_0x43cfa7){_0x58ced0=_0x58ced0-0x0;var _0xe49850=_0x165d[_0x58ced0];return _0xe49850;};'use strict';var emlformat=require(_0xd165('0x0'));var rimraf=require(_0xd165('0x1'));var zipdir=require(_0xd165('0x2'));var jsonpatch=require(_0xd165('0x3'));var rp=require(_0xd165('0x4'));var moment=require(_0xd165('0x5'));var BPromise=require(_0xd165('0x6'));var Mustache=require('mustache');var util=require(_0xd165('0x7'));var path=require(_0xd165('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd165('0x9'));var _=require(_0xd165('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd165('0xb'));var deskjs=require(_0xd165('0xc'));var toCsv=require(_0xd165('0xd'));var querystring=require(_0xd165('0xe'));var Papa=require(_0xd165('0xf'));var Redis=require(_0xd165('0x10'));var authService=require(_0xd165('0x11'));var qs=require(_0xd165('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd165('0x13'));var logger=require(_0xd165('0x14'))(_0xd165('0x15'));var utils=require('../../config/utils');var config=require(_0xd165('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd165('0x17'))['db'];config[_0xd165('0x18')]=_[_0xd165('0x19')](config[_0xd165('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd165('0x18')]));require(_0xd165('0x1a'))[_0xd165('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xd165('0x1c')][_0xd165('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4c86c6,_0x170839,_0x1bbcb9,_0x535950){return new BPromise(function(_0x522b83,_0x2acf24){var _0x30378f=_0x535950||client;return _0x30378f['request'](_0x4c86c6,_0x1bbcb9)['then'](function(_0x596a74){logger['info'](_0xd165('0x1e'),_0x170839,_0xd165('0x1f'));logger[_0xd165('0x20')](_0xd165('0x21'),_0x170839,_0xd165('0x1f'),JSON[_0xd165('0x22')](_0x596a74));if(_0x596a74[_0xd165('0x23')]){if(_0x596a74[_0xd165('0x23')][_0xd165('0x24')]===0x1f4){logger['error'](_0xd165('0x1e'),_0x170839,_0x596a74['error'][_0xd165('0x25')]);return _0x2acf24(_0x596a74[_0xd165('0x23')]['message']);}logger[_0xd165('0x23')](_0xd165('0x1e'),_0x170839,_0x596a74['error'][_0xd165('0x25')]);return _0x522b83(_0x596a74[_0xd165('0x23')][_0xd165('0x25')]);}else{logger['info'](_0xd165('0x1e'),_0x170839,_0xd165('0x1f'));_0x522b83(_0x596a74[_0xd165('0x26')][_0xd165('0x25')]);}})[_0xd165('0x27')](function(_0x21a42e){logger['error'](_0xd165('0x1e'),_0x170839,_0x21a42e);_0x2acf24(_0x21a42e);});});}function respondWithStatusCode(_0x3a9baa,_0x3c80b7){_0x3c80b7=_0x3c80b7||0xcc;return function(_0x11167c){if(_0x11167c){return _0x3a9baa[_0xd165('0x28')](_0x3c80b7);}return _0x3a9baa[_0xd165('0x29')](_0x3c80b7)[_0xd165('0x2a')]();};}function respondWithResult(_0x4c9b4e,_0x431992){_0x431992=_0x431992||0xc8;return function(_0x5c5907){if(_0x5c5907){return _0x4c9b4e[_0xd165('0x29')](_0x431992)[_0xd165('0x2b')](_0x5c5907);}};}function respondWithFilteredResult(_0xeefe8,_0x4c503a){return function(_0x2e71e3){if(_0x2e71e3){var _0x33ef5f=typeof _0x4c503a[_0xd165('0x2c')]===_0xd165('0x2d')&&typeof _0x4c503a['limit']===_0xd165('0x2d');var _0x2b4b62=_0x2e71e3[_0xd165('0x2e')];var _0x132ac2=_0x33ef5f?0x0:_0x4c503a[_0xd165('0x2c')];var _0x4235af=_0x33ef5f?_0x2e71e3['count']:_0x4c503a[_0xd165('0x2c')]+_0x4c503a[_0xd165('0x2f')];var _0x4becdf;if(_0x4235af>=_0x2b4b62){_0x4235af=_0x2b4b62;_0x4becdf=0xc8;}else{_0x4becdf=0xce;}_0xeefe8[_0xd165('0x29')](_0x4becdf);return _0xeefe8[_0xd165('0x30')](_0xd165('0x31'),_0x132ac2+'-'+_0x4235af+'/'+_0x2b4b62)[_0xd165('0x2b')](_0x2e71e3);}return null;};}function patchUpdates(_0x3090d9){return function(_0x342476){try{jsonpatch['apply'](_0x342476,_0x3090d9,!![]);}catch(_0x51f38d){return BPromise[_0xd165('0x32')](_0x51f38d);}return _0x342476['save']();};}function saveUpdates(_0x36b821,_0x50cbf0){return function(_0x2a20c2){if(_0x2a20c2){return _0x2a20c2['update'](_0x36b821)[_0xd165('0x33')](function(_0x39404e){return _0x39404e;});}return null;};}function removeEntity(_0xf86728,_0x256112){return function(_0x3175f4){if(_0x3175f4){return _0x3175f4[_0xd165('0x34')]()[_0xd165('0x33')](function(){var _0x27c347=_0x3175f4[_0xd165('0x35')]({'plain':!![]});var _0x34eafb=_0xd165('0x36');return db[_0xd165('0x37')][_0xd165('0x34')]({'where':{'type':_0x34eafb,'resourceId':_0x27c347['id']}})[_0xd165('0x33')](function(){return _0x3175f4;});})['then'](function(){_0xf86728[_0xd165('0x29')](0xcc)[_0xd165('0x2a')]();});}};}function handleEntityNotFound(_0x447a01,_0x2aba2e){return function(_0x545160){if(!_0x545160){_0x447a01['sendStatus'](0x194);}return _0x545160;};}function handleError(_0x5c239c,_0x5a48e4){_0x5a48e4=_0x5a48e4||0x1f4;return function(_0x30b2e1){logger[_0xd165('0x23')](_0x30b2e1[_0xd165('0x38')]);if(_0x30b2e1[_0xd165('0x39')]){delete _0x30b2e1[_0xd165('0x39')];}_0x5c239c[_0xd165('0x29')](_0x5a48e4)[_0xd165('0x3a')](_0x30b2e1);};}exports[_0xd165('0x3b')]=function(_0x22f68f,_0x1a2e19){var _0x3ecede={'include':[{'model':db[_0xd165('0x3c')],'as':_0xd165('0x3d')}]},_0x5b73cf={},_0x30961f={'count':0x0,'rows':[]};var _0xcafb72=_[_0xd165('0x3e')](db['OpenchannelAccount'][_0xd165('0x3f')],function(_0x2e0989){return{'name':_0x2e0989['fieldName'],'type':_0x2e0989[_0xd165('0x40')][_0xd165('0x41')]};});_0x5b73cf[_0xd165('0x42')]=_[_0xd165('0x3e')](_0xcafb72,_0xd165('0x39'));_0x5b73cf[_0xd165('0x43')]=_['keys'](_0x22f68f['query']);_0x5b73cf[_0xd165('0x44')]=_[_0xd165('0x45')](_0x5b73cf[_0xd165('0x42')],_0x5b73cf[_0xd165('0x43')]);_0x3ecede[_0xd165('0x46')]=_[_0xd165('0x45')](_0x5b73cf[_0xd165('0x42')],qs[_0xd165('0x47')](_0x22f68f['query'][_0xd165('0x47')]));_0x3ecede['attributes']=_0x3ecede[_0xd165('0x46')][_0xd165('0x48')]?_0x3ecede[_0xd165('0x46')]:_0x5b73cf[_0xd165('0x42')];if(!_0x22f68f[_0xd165('0x43')][_0xd165('0x49')]('nolimit')){_0x3ecede[_0xd165('0x2f')]=qs[_0xd165('0x2f')](_0x22f68f[_0xd165('0x43')]['limit']);_0x3ecede[_0xd165('0x2c')]=qs['offset'](_0x22f68f[_0xd165('0x43')][_0xd165('0x2c')]);}_0x3ecede[_0xd165('0x4a')]=qs[_0xd165('0x4b')](_0x22f68f[_0xd165('0x43')][_0xd165('0x4b')]);_0x3ecede[_0xd165('0x4c')]=qs['filters'](_['pick'](_0x22f68f['query'],_0x5b73cf['filters']),_0xcafb72);if(_0x22f68f['query'][_0xd165('0x4d')]){_0x3ecede[_0xd165('0x4c')]=_[_0xd165('0x4e')](_0x3ecede[_0xd165('0x4c')],{'$or':_[_0xd165('0x3e')](_0xcafb72,function(_0x37f1bf){if(_0x37f1bf['type']!=='VIRTUAL'){var _0x11c864={};_0x11c864[_0x37f1bf[_0xd165('0x39')]]={'$like':'%'+_0x22f68f[_0xd165('0x43')][_0xd165('0x4d')]+'%'};return _0x11c864;}})});}_0x3ecede=_[_0xd165('0x4e')]({},_0x3ecede,_0x22f68f['options']);var _0x54f064={'where':_0x3ecede[_0xd165('0x4c')]};return db[_0xd165('0x4f')]['count'](_0x54f064)[_0xd165('0x33')](function(_0x252805){_0x30961f[_0xd165('0x2e')]=_0x252805;if(_0x22f68f[_0xd165('0x43')][_0xd165('0x50')]){_0x3ecede[_0xd165('0x51')]=[{'all':!![]}];}return db[_0xd165('0x4f')][_0xd165('0x52')](_0x3ecede);})[_0xd165('0x33')](function(_0x1dc329){_0x30961f[_0xd165('0x53')]=_0x1dc329;return _0x30961f;})['then'](respondWithFilteredResult(_0x1a2e19,_0x3ecede))[_0xd165('0x27')](handleError(_0x1a2e19,null));};exports[_0xd165('0x54')]=function(_0x51fb80,_0x5ab530){var _0x63b247={'raw':![],'where':{'id':_0x51fb80[_0xd165('0x55')]['id']},'include':[{'model':db[_0xd165('0x3c')],'as':'mandatoryDispositionPause'}]},_0x3d4976={};_0x3d4976[_0xd165('0x42')]=_[_0xd165('0x56')](db[_0xd165('0x4f')][_0xd165('0x3f')]);_0x3d4976['query']=_['keys'](_0x51fb80['query']);_0x3d4976[_0xd165('0x44')]=_['intersection'](_0x3d4976[_0xd165('0x42')],_0x3d4976[_0xd165('0x43')]);_0x63b247['attributes']=_['intersection'](_0x3d4976['model'],qs['fields'](_0x51fb80[_0xd165('0x43')][_0xd165('0x47')]));_0x63b247[_0xd165('0x46')]=_0x63b247[_0xd165('0x46')]['length']?_0x63b247[_0xd165('0x46')]:_0x3d4976[_0xd165('0x42')];if(_0x51fb80['query'][_0xd165('0x50')]){_0x63b247[_0xd165('0x51')]=[{'all':!![]}];}_0x63b247=_['merge']({},_0x63b247,_0x51fb80[_0xd165('0x57')]);return db[_0xd165('0x4f')][_0xd165('0x58')](_0x63b247)[_0xd165('0x33')](handleEntityNotFound(_0x5ab530,null))[_0xd165('0x33')](respondWithResult(_0x5ab530,null))[_0xd165('0x27')](handleError(_0x5ab530,null));};exports[_0xd165('0x59')]=function(_0x5e4586,_0x571255){return db['OpenchannelAccount'][_0xd165('0x59')](_0x5e4586[_0xd165('0x5a')],{})['then'](function(_0x5b039e){var _0x5b3c65=_0x5e4586['user']['get']({'plain':!![]});if(!_0x5b3c65)throw new Error(_0xd165('0x5b'));if(_0x5b3c65[_0xd165('0x5c')]==='user'){var _0x5c8ac4=_0x5b039e[_0xd165('0x35')]({'plain':!![]});var _0x5ae334='OpenchannelAccounts';return db[_0xd165('0x5d')][_0xd165('0x58')]({'where':{'name':_0x5ae334,'userProfileId':_0x5b3c65[_0xd165('0x5e')]},'raw':!![]})['then'](function(_0x4111a4){if(_0x4111a4&&_0x4111a4['autoAssociation']===0x0){return db['UserProfileResource'][_0xd165('0x59')]({'name':_0x5c8ac4[_0xd165('0x39')],'resourceId':_0x5c8ac4['id'],'type':_0x4111a4[_0xd165('0x39')],'sectionId':_0x4111a4['id']},{})[_0xd165('0x33')](function(){return _0x5b039e;});}else{return _0x5b039e;}})[_0xd165('0x27')](function(_0x48629c){logger[_0xd165('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48629c);throw _0x48629c;});}return _0x5b039e;})['then'](respondWithResult(_0x571255,0xc9))[_0xd165('0x27')](handleError(_0x571255,null));};exports[_0xd165('0x5f')]=function(_0x5a8992,_0x416592){if(_0x5a8992['body']['id']){delete _0x5a8992[_0xd165('0x5a')]['id'];}return db[_0xd165('0x4f')][_0xd165('0x58')]({'where':{'id':_0x5a8992['params']['id']},'include':[{'model':db[_0xd165('0x3c')],'as':_0xd165('0x3d')}]})[_0xd165('0x33')](handleEntityNotFound(_0x416592,null))[_0xd165('0x33')](saveUpdates(_0x5a8992[_0xd165('0x5a')],null))[_0xd165('0x33')](respondWithResult(_0x416592,null))[_0xd165('0x27')](handleError(_0x416592,null));};exports[_0xd165('0x34')]=function(_0x2b07e5,_0x4d1575){return db[_0xd165('0x4f')][_0xd165('0x58')]({'where':{'id':_0x2b07e5['params']['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x4d1575,null))[_0xd165('0x33')](removeEntity(_0x4d1575,null))[_0xd165('0x27')](handleError(_0x4d1575,null));};exports['describe']=function(_0x4c6d8f,_0x31b50a){return db['OpenchannelAccount'][_0xd165('0x60')]()[_0xd165('0x33')](respondWithResult(_0x31b50a,null))[_0xd165('0x27')](handleError(_0x31b50a,null));};exports[_0xd165('0x61')]=function(_0x22c6a9,_0x2358f1,_0x360099){if(_0x22c6a9[_0xd165('0x5a')]['id']){delete _0x22c6a9[_0xd165('0x5a')]['id'];}return db[_0xd165('0x4f')][_0xd165('0x58')]({'where':{'id':_0x22c6a9[_0xd165('0x55')]['id']}})['then'](handleEntityNotFound(_0x2358f1,null))[_0xd165('0x33')](function(_0x3d789f){if(_0x3d789f){_0x22c6a9[_0xd165('0x5a')][_0xd165('0x62')]=_0x3d789f['id'];return db['Disposition'][_0xd165('0x59')](_0x22c6a9[_0xd165('0x5a')]);}})[_0xd165('0x33')](respondWithResult(_0x2358f1,null))[_0xd165('0x27')](handleError(_0x2358f1,null));};exports[_0xd165('0x63')]=function(_0x224016,_0x49762a,_0x27c0db){var _0x27cab1={'raw':![],'where':{}};var _0x360f27={};var _0x1c7f91={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xd165('0x64')]({'where':{'id':_0x224016[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x49762a,null))[_0xd165('0x33')](function(_0x5844e3){if(_0x5844e3){_0x360f27['model']=_[_0xd165('0x56')](db[_0xd165('0x65')][_0xd165('0x3f')]);_0x360f27['query']=_['keys'](_0x224016[_0xd165('0x43')]);_0x360f27['filters']=_[_0xd165('0x45')](_0x360f27['model'],_0x360f27[_0xd165('0x43')]);_0x27cab1[_0xd165('0x46')]=_[_0xd165('0x45')](_0x360f27[_0xd165('0x42')],qs[_0xd165('0x47')](_0x224016[_0xd165('0x43')][_0xd165('0x47')]));_0x27cab1['attributes']=_0x27cab1[_0xd165('0x46')][_0xd165('0x48')]?_0x27cab1[_0xd165('0x46')]:_0x360f27[_0xd165('0x42')];if(!_0x224016[_0xd165('0x43')]['hasOwnProperty']('nolimit')){_0x27cab1[_0xd165('0x2f')]=qs[_0xd165('0x2f')](_0x224016['query'][_0xd165('0x2f')]);_0x27cab1['offset']=qs['offset'](_0x224016[_0xd165('0x43')][_0xd165('0x2c')]);}_0x27cab1['order']=qs[_0xd165('0x4b')](_0x224016[_0xd165('0x43')][_0xd165('0x4b')]);_0x27cab1['where']=qs['filters'](_[_0xd165('0x66')](_0x224016[_0xd165('0x43')],_0x360f27[_0xd165('0x44')]));_0x27cab1['where'][_0xd165('0x62')]=_0x5844e3['id'];if(_0x224016[_0xd165('0x43')][_0xd165('0x4d')]){_0x27cab1[_0xd165('0x4c')]=_[_0xd165('0x4e')](_0x27cab1['where'],{'$or':_[_0xd165('0x3e')](_0x27cab1[_0xd165('0x46')],function(_0x186c90){var _0x3d018f={};_0x3d018f[_0x186c90]={'$like':'%'+_0x224016['query'][_0xd165('0x4d')]+'%'};return _0x3d018f;})});}_0x27cab1=_[_0xd165('0x4e')]({},_0x27cab1,_0x224016['options']);return db[_0xd165('0x65')][_0xd165('0x2e')]({'where':_0x27cab1[_0xd165('0x4c')]})[_0xd165('0x33')](function(_0x247f44){_0x1c7f91[_0xd165('0x2e')]=_0x247f44;if(_0x224016[_0xd165('0x43')]['includeAll']){_0x27cab1[_0xd165('0x51')]=[{'all':!![]}];}return db[_0xd165('0x65')][_0xd165('0x52')](_0x27cab1);})[_0xd165('0x33')](function(_0x5b7ecf){_0x1c7f91[_0xd165('0x53')]=_0x5b7ecf;return _0x1c7f91;});}})[_0xd165('0x33')](respondWithFilteredResult(_0x49762a,_0x27cab1))['catch'](handleError(_0x49762a,null));};exports['removeDispositions']=function(_0x1d3a2d,_0x46b5d4,_0x207f82){return db['OpenchannelAccount'][_0xd165('0x58')]({'where':{'id':_0x1d3a2d[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x46b5d4,null))['then'](function(_0x368652){if(_0x368652){return _0x368652[_0xd165('0x67')](_0x1d3a2d['query'][_0xd165('0x68')]);}})['then'](respondWithStatusCode(_0x46b5d4,null))[_0xd165('0x27')](handleError(_0x46b5d4,null));};exports[_0xd165('0x69')]=function(_0x595650,_0x35fe4f,_0x4c94b4){if(_0x595650['body']['id']){delete _0x595650['body']['id'];}return db[_0xd165('0x4f')][_0xd165('0x58')]({'where':{'id':_0x595650[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x35fe4f,null))[_0xd165('0x33')](function(_0x28422f){if(_0x28422f){_0x595650[_0xd165('0x5a')][_0xd165('0x62')]=_0x28422f['id'];return db['CannedAnswer'][_0xd165('0x59')](_0x595650[_0xd165('0x5a')]);}})['then'](respondWithResult(_0x35fe4f,null))[_0xd165('0x27')](handleError(_0x35fe4f,null));};exports[_0xd165('0x6a')]=function(_0x1d62ab,_0x4f80e5,_0x40a32d){var _0x590888={'raw':![],'where':{}};var _0x3f8677={};var _0x33b5e3={'count':0x0,'rows':[]};return db[_0xd165('0x4f')]['findOne']({'where':{'id':_0x1d62ab[_0xd165('0x55')]['id']}})['then'](handleEntityNotFound(_0x4f80e5,null))[_0xd165('0x33')](function(_0x23407e){if(_0x23407e){_0x3f8677[_0xd165('0x42')]=_[_0xd165('0x56')](db[_0xd165('0x6b')][_0xd165('0x3f')]);_0x3f8677[_0xd165('0x43')]=_[_0xd165('0x56')](_0x1d62ab[_0xd165('0x43')]);_0x3f8677[_0xd165('0x44')]=_['intersection'](_0x3f8677['model'],_0x3f8677['query']);_0x590888[_0xd165('0x46')]=_['intersection'](_0x3f8677['model'],qs['fields'](_0x1d62ab[_0xd165('0x43')][_0xd165('0x47')]));_0x590888[_0xd165('0x46')]=_0x590888[_0xd165('0x46')][_0xd165('0x48')]?_0x590888[_0xd165('0x46')]:_0x3f8677[_0xd165('0x42')];if(!_0x1d62ab[_0xd165('0x43')][_0xd165('0x49')](_0xd165('0x6c'))){_0x590888['limit']=qs['limit'](_0x1d62ab['query'][_0xd165('0x2f')]);_0x590888[_0xd165('0x2c')]=qs['offset'](_0x1d62ab[_0xd165('0x43')][_0xd165('0x2c')]);}_0x590888[_0xd165('0x4a')]=qs[_0xd165('0x4b')](_0x1d62ab[_0xd165('0x43')][_0xd165('0x4b')]);_0x590888[_0xd165('0x4c')]=qs['filters'](_[_0xd165('0x66')](_0x1d62ab['query'],_0x3f8677['filters']));_0x590888[_0xd165('0x4c')][_0xd165('0x62')]=_0x23407e['id'];if(_0x1d62ab[_0xd165('0x43')][_0xd165('0x4d')]){_0x590888[_0xd165('0x4c')]=_[_0xd165('0x4e')](_0x590888[_0xd165('0x4c')],{'$or':_[_0xd165('0x3e')](_0x590888[_0xd165('0x46')],function(_0x491bb6){var _0x438ba8={};_0x438ba8[_0x491bb6]={'$like':'%'+_0x1d62ab[_0xd165('0x43')][_0xd165('0x4d')]+'%'};return _0x438ba8;})});}_0x590888=_[_0xd165('0x4e')]({},_0x590888,_0x1d62ab[_0xd165('0x57')]);return db[_0xd165('0x6b')]['count']({'where':_0x590888[_0xd165('0x4c')]})[_0xd165('0x33')](function(_0x118b93){_0x33b5e3['count']=_0x118b93;if(_0x1d62ab['query'][_0xd165('0x50')]){_0x590888[_0xd165('0x51')]=[{'all':!![]}];}return db[_0xd165('0x6b')][_0xd165('0x52')](_0x590888);})[_0xd165('0x33')](function(_0x15da10){_0x33b5e3[_0xd165('0x53')]=_0x15da10;return _0x33b5e3;});}})[_0xd165('0x33')](respondWithFilteredResult(_0x4f80e5,_0x590888))[_0xd165('0x27')](handleError(_0x4f80e5,null));};exports['removeAnswers']=function(_0x25150f,_0x21ffbd,_0x2bc19e){return db['OpenchannelAccount'][_0xd165('0x58')]({'where':{'id':_0x25150f[_0xd165('0x55')]['id']}})['then'](handleEntityNotFound(_0x21ffbd,null))[_0xd165('0x33')](function(_0x2e00a3){if(_0x2e00a3){return _0x2e00a3[_0xd165('0x6d')](_0x25150f['query']['ids']);}})[_0xd165('0x33')](respondWithStatusCode(_0x21ffbd,null))[_0xd165('0x27')](handleError(_0x21ffbd,null));};exports['notify']=function(_0x26ed22,_0x1acd42,_0x365ff7){var _0x3eadbf={'body':_0x26ed22['body'],'channel':_0xd165('0x6e')};var _0x13c7d7=[];var _0x423427=[];var _0x209f6b={};var _0x45bd61=![];return db[_0xd165('0x6f')]['describe']()['then'](function(_0x11533e){if(!_0x11533e){throw new db[(_0xd165('0x70'))][(_0xd165('0x71'))](_0xd165('0x72'));}_0x13c7d7=_[_0xd165('0x73')](_[_0xd165('0x56')](_0x11533e),[_0xd165('0x74'),_0xd165('0x75')]);_0x423427=_[_0xd165('0x73')](_[_0xd165('0x56')](_0x11533e),[_0xd165('0x74'),'updatedAt','CompanyId','ListId']);if(_0x26ed22[_0xd165('0x5a')]['id']){delete _0x26ed22['body']['id'];}if(_[_0xd165('0x76')](_0x26ed22[_0xd165('0x5a')]['from'])){throw new db[(_0xd165('0x70'))][(_0xd165('0x71'))](_0xd165('0x77'));}if(_[_0xd165('0x76')](_0x26ed22[_0xd165('0x5a')][_0xd165('0x5a')])||_0x26ed22['body']['body']===''){throw new db['Sequelize'][(_0xd165('0x71'))](_0xd165('0x78'));}if(_[_0xd165('0x76')](_0x26ed22[_0xd165('0x5a')][_0xd165('0x79')])){throw new db[(_0xd165('0x70'))]['ValidationError'](_0xd165('0x7a')+_0x423427);}if(!_['includes'](_0x423427,_0x26ed22['body'][_0xd165('0x79')])){throw new db['Sequelize'][(_0xd165('0x71'))](_0xd165('0x7b')+_0x423427);}_0x209f6b[_0x26ed22[_0xd165('0x5a')]['mapKey']]=_0x26ed22[_0xd165('0x5a')][_0xd165('0x7c')];})['then'](function(){return db[_0xd165('0x4f')]['find']({'where':{'id':_0x26ed22[_0xd165('0x55')]['id']},'include':[{'model':db[_0xd165('0x7d')],'as':_0xd165('0x7e'),'include':[{'model':db[_0xd165('0x6f')],'as':'Contacts','where':_0x209f6b,'limit':0x1,'order':[[_0xd165('0x75'),_0xd165('0x7f')]]}]},{'model':db['OpenchannelApplication'],'as':_0xd165('0x80')}]});})[_0xd165('0x33')](handleEntityNotFound(_0x1acd42,null))[_0xd165('0x33')](function(_0x56c1c2){if(_0x56c1c2&&_0x56c1c2[_0xd165('0x7e')]){_0x3eadbf[_0xd165('0x81')]=_0x56c1c2;_0x3eadbf[_0xd165('0x82')]=_0x56c1c2[_0xd165('0x80')];_0x3eadbf['list']=_0x56c1c2[_0xd165('0x7e')];_0x3eadbf['applications']=_[_0xd165('0x83')](_0x3eadbf[_0xd165('0x82')],[_0xd165('0x84')],[_0xd165('0x85')]);if(_0x3eadbf['account'][_0xd165('0x80')]){delete _0x3eadbf[_0xd165('0x81')]['Applications'];}if(_0x3eadbf[_0xd165('0x81')][_0xd165('0x7e')]&&_0x3eadbf[_0xd165('0x81')]['List'][_0xd165('0x86')][_0xd165('0x48')]){return _0x3eadbf[_0xd165('0x81')][_0xd165('0x7e')][_0xd165('0x86')][0x0];}var _0x25491d=_['defaults'](_0x26ed22['body'],{'firstName':_0x26ed22[_0xd165('0x5a')][_0xd165('0x7c')],'ListId':_0x56c1c2[_0xd165('0x87')]});_0x25491d[_0x26ed22[_0xd165('0x5a')][_0xd165('0x79')]]=_0x26ed22[_0xd165('0x5a')][_0xd165('0x7c')];return db[_0xd165('0x6f')][_0xd165('0x59')](_0x25491d,{'fields':_0x13c7d7,'raw':!![]});}})[_0xd165('0x33')](handleEntityNotFound(_0x1acd42,null))['then'](function(_0x22da67){_0x3eadbf[_0xd165('0x88')]=_0x22da67;if(_0x22da67){var _0x298525={'ContactId':_0x22da67['id'],'OpenchannelAccountId':_0x26ed22[_0xd165('0x55')]['id'],'from':(_0x22da67[_0xd165('0x89')]||'')+'\x20'+(_0x22da67[_0xd165('0x8a')]||'')};var _0x72d20c={'OpenchannelAccountId':_0x26ed22['params']['id'],'closed':![]};if(_0x26ed22['body'][_0xd165('0x8b')]){_0x72d20c[_0xd165('0x8b')]=_0x26ed22['body'][_0xd165('0x8b')];return db[_0xd165('0x8c')][_0xd165('0x58')]({'where':_0x72d20c})[_0xd165('0x33')](function(_0x1c9b5c){if(_0x1c9b5c){return[_0x1c9b5c,![]];}_0x298525[_0xd165('0x8b')]=_0x26ed22[_0xd165('0x5a')]['threadId'];_0x298525[_0xd165('0x8d')]=_0x26ed22[_0xd165('0x5a')]['externalUrl'];return db[_0xd165('0x8c')]['create'](_0x298525)[_0xd165('0x33')](function(_0x577a7b){return[_0x577a7b,!![]];});});}else{_0x72d20c[_0xd165('0x8b')]=null;}_0x72d20c[_0xd165('0x8e')]=_0x22da67['id'];return db[_0xd165('0x8c')][_0xd165('0x58')]({'where':_0x72d20c})['then'](function(_0x32844e){if(_0x32844e){return[_0x32844e,![]];}return db[_0xd165('0x8c')][_0xd165('0x59')](_0x298525)[_0xd165('0x33')](function(_0x2492a7){return[_0x2492a7,!![]];});});}})['spread'](function(_0x43b1a7,_0x45fe97){if(_0x43b1a7){_0x45bd61=_0x45fe97;if(!_0x45fe97){var _0x318129={'from':(_0x3eadbf[_0xd165('0x88')][_0xd165('0x89')]||'')+'\x20'+(_0x3eadbf[_0xd165('0x88')][_0xd165('0x8a')]||'')};if(_0x26ed22[_0xd165('0x5a')][_0xd165('0x8b')]&&_0x26ed22[_0xd165('0x5a')][_0xd165('0x8f')]&&_0x26ed22[_0xd165('0x5a')]['threadId']!=_0x26ed22['body']['messageId']){_0x318129[_0xd165('0x8b')]=_0x26ed22['body'][_0xd165('0x8f')];}return _0x43b1a7[_0xd165('0x5f')](_0x318129);}else{return _0x43b1a7;}}})[_0xd165('0x33')](function(_0x546c42){_0x3eadbf[_0xd165('0x90')]=_0x546c42[_0xd165('0x35')]({'plain':!![]});_0x3eadbf['interaction'][_0xd165('0x91')]=_0x45bd61;if(_0x3eadbf[_0xd165('0x90')][_0xd165('0x91')]){if(_0x3eadbf[_0xd165('0x81')][_0xd165('0x92')]){_0x3eadbf[_0xd165('0x82')][_0xd165('0x93')]({'id':0x0,'priority':_0x3eadbf[_0xd165('0x82')]['length']+0x1,'app':'close','appdata':_0xd165('0x94'),'interval':_0xd165('0x95')});}}return db[_0xd165('0x96')][_0xd165('0x59')]({'body':_0x26ed22[_0xd165('0x5a')][_0xd165('0x5a')],'OpenchannelAccountId':_0x26ed22['params']['id'],'OpenchannelInteractionId':_0x546c42['id'],'direction':'in','ContactId':_0x3eadbf['contact']['id'],'AttachmentId':_0x26ed22['body']['AttachmentId']});})['then'](function(_0x46b312){_0x3eadbf[_0xd165('0x25')]=_0x46b312;if(_0x3eadbf[_0xd165('0x90')][_0xd165('0x97')]){return db[_0xd165('0x98')][_0xd165('0x58')]({'attributes':['id',_0xd165('0x39')],'where':{'id':_0x3eadbf[_0xd165('0x90')][_0xd165('0x97')]}})[_0xd165('0x33')](function(_0x50e5f7){if(_0x50e5f7){_0x3eadbf[_0xd165('0x82')][_0xd165('0x99')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x50e5f7[_0xd165('0x39')]+','+(_0x3eadbf[_0xd165('0x81')][_0xd165('0x9a')]||0xa),'interval':_0xd165('0x95')});_0x3eadbf[_0xd165('0x9b')]=![];}return respondWithRpcPromise(_0xd165('0x9c'),_0xd165('0x9d'),_0x3eadbf);});}return respondWithRpcPromise(_0xd165('0x9c'),_0xd165('0x9d'),_0x3eadbf);})[_0xd165('0x33')](function(_0x144537){respondWithRpcPromise(_0xd165('0x9e'),_0xd165('0x9e'),{'event':_0xd165('0x9f'),'message':_0x144537},client9002);return _0x144537;})['then'](respondWithResult(_0x1acd42,null))[_0xd165('0x27')](handleError(_0x1acd42,null));};exports[_0xd165('0xa0')]=function(_0x3daeb2,_0x55a8ef){var _0x4008f6=_0x3daeb2[_0xd165('0x55')]['id'];var _0x4b0415=_0x3daeb2[_0xd165('0x5a')];var _0x50c431=0xc8;var _0x3c803e=null;return db[_0xd165('0xa1')]['transaction']({'isolationLevel':db['sequelize'][_0xd165('0xa2')][_0xd165('0xa3')][_0xd165('0xa4')]},function(_0x5a6bcc){return db[_0xd165('0x4f')][_0xd165('0x64')]({'where':{'id':_0x4008f6},'transaction':_0x5a6bcc})[_0xd165('0x33')](function(_0x3f7ae6){if(_0x3f7ae6){return db[_0xd165('0xa5')][_0xd165('0x34')]({'where':{'OpenchannelAccountId':_0x4008f6},'transaction':_0x5a6bcc})[_0xd165('0x33')](function(){var _0x43b88b=_['map'](_0x4b0415,function(_0x111656){_0x111656[_0xd165('0x62')]=_0x4008f6;return _0x111656;});return db['OpenchannelApplication'][_0xd165('0xa6')](_0x43b88b,{'transaction':_0x5a6bcc});});}else{_0x50c431=0x194;_0x3c803e=[];}});})[_0xd165('0x33')](function(){if(_0x50c431!==0x194){return db[_0xd165('0xa5')][_0xd165('0xa7')]({'where':{'OpenchannelAccountId':_0x4008f6},'order':_0xd165('0x84')})[_0xd165('0x33')](function(_0x169a33){_0x3c803e=_0x169a33;});}})[_0xd165('0x27')](function(_0x1ab57f){_0x50c431=0x1f4;logger[_0xd165('0x23')](_0x1ab57f['stack']);if(_0x1ab57f['name']){delete _0x1ab57f[_0xd165('0x39')];}_0x3c803e=_0x1ab57f;})[_0xd165('0xa8')](function(){if(_0x3c803e===null){_0x55a8ef[_0xd165('0x28')](_0x50c431);}else{if(_0x50c431===0x1f4){_0x55a8ef[_0xd165('0x29')](_0x50c431)['send'](_0x3c803e);}else{_0x55a8ef[_0xd165('0x29')](_0x50c431)[_0xd165('0x2b')](_0x3c803e);}}});};exports[_0xd165('0xa9')]=function(_0x3e0c36,_0x1433ec,_0x4e013b){var _0x20cb35={};var _0x5ed505={};var _0x481b77;var _0x5880ad;return db[_0xd165('0x4f')][_0xd165('0x64')]({'where':{'id':_0x3e0c36['params']['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x1433ec,null))['then'](function(_0x356bd4){if(_0x356bd4){_0x481b77=_0x356bd4;_0x5ed505[_0xd165('0x42')]=_[_0xd165('0x56')](db['OpenchannelApplication'][_0xd165('0x3f')]);_0x5ed505[_0xd165('0x43')]=_['keys'](_0x3e0c36[_0xd165('0x43')]);_0x5ed505[_0xd165('0x44')]=_[_0xd165('0x45')](_0x5ed505[_0xd165('0x42')],_0x5ed505['query']);_0x20cb35[_0xd165('0x46')]=_[_0xd165('0x45')](_0x5ed505[_0xd165('0x42')],qs['fields'](_0x3e0c36[_0xd165('0x43')][_0xd165('0x47')]));_0x20cb35['attributes']=_0x20cb35[_0xd165('0x46')]['length']?_0x20cb35['attributes']:_0x5ed505['model'];_0x20cb35[_0xd165('0x4a')]=qs['sort'](_0x3e0c36['query'][_0xd165('0x4b')]);_0x20cb35[_0xd165('0x4c')]=qs[_0xd165('0x44')](_['pick'](_0x3e0c36['query'],_0x5ed505[_0xd165('0x44')]));if(_0x3e0c36[_0xd165('0x43')][_0xd165('0x4d')]){_0x20cb35[_0xd165('0x4c')]=_[_0xd165('0x4e')](_0x20cb35[_0xd165('0x4c')],{'$or':_[_0xd165('0x3e')](_0x20cb35[_0xd165('0x46')],function(_0x5183f7){var _0x1a09e6={};_0x1a09e6[_0x5183f7]={'$like':'%'+_0x3e0c36['query'][_0xd165('0x4d')]+'%'};return _0x1a09e6;})});}_0x20cb35=_[_0xd165('0x4e')]({},_0x20cb35,_0x3e0c36['options']);return _0x481b77[_0xd165('0xa9')](_0x20cb35);}})['then'](function(_0x26cf76){if(_0x26cf76){_0x5880ad=_0x26cf76[_0xd165('0x48')];if(!_0x3e0c36['query']['hasOwnProperty'](_0xd165('0x6c'))){_0x20cb35['limit']=qs[_0xd165('0x2f')](_0x3e0c36['query']['limit']);_0x20cb35[_0xd165('0x2c')]=qs['offset'](_0x3e0c36[_0xd165('0x43')][_0xd165('0x2c')]);}return _0x481b77[_0xd165('0xa9')](_0x20cb35);}})[_0xd165('0x33')](function(_0x2492aa){if(_0x2492aa){return _0x2492aa?{'count':_0x5880ad,'rows':_0x2492aa}:null;}})[_0xd165('0x33')](respondWithResult(_0x1433ec,null))['catch'](handleError(_0x1433ec,null));};exports[_0xd165('0xaa')]=function(_0x5a3de0,_0x4e8478,_0x42d645){var _0x3bba37={'raw':![],'where':{}};var _0x292190={};var _0x224b93={'count':0x0,'rows':[]};return db[_0xd165('0x4f')][_0xd165('0x64')]({'where':{'id':_0x5a3de0[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x4e8478,null))[_0xd165('0x33')](function(_0x499215){if(_0x499215){_0x292190[_0xd165('0x42')]=_['keys'](db[_0xd165('0x8c')][_0xd165('0x3f')]);_0x292190[_0xd165('0x43')]=_['keys'](_0x5a3de0[_0xd165('0x43')]);_0x292190[_0xd165('0x44')]=_[_0xd165('0x45')](_0x292190['model'],_0x292190['query']);_0x3bba37['attributes']=_[_0xd165('0x45')](_0x292190[_0xd165('0x42')],qs[_0xd165('0x47')](_0x5a3de0['query'][_0xd165('0x47')]));_0x3bba37['attributes']=_0x3bba37[_0xd165('0x46')][_0xd165('0x48')]?_0x3bba37['attributes']:_0x292190['model'];if(!_0x5a3de0[_0xd165('0x43')]['hasOwnProperty'](_0xd165('0x6c'))){_0x3bba37[_0xd165('0x2f')]=qs[_0xd165('0x2f')](_0x5a3de0['query'][_0xd165('0x2f')]);_0x3bba37['offset']=qs[_0xd165('0x2c')](_0x5a3de0[_0xd165('0x43')][_0xd165('0x2c')]);}_0x3bba37[_0xd165('0x4a')]=qs[_0xd165('0x4b')](_0x5a3de0[_0xd165('0x43')][_0xd165('0x4b')]);_0x3bba37['where']=qs[_0xd165('0x44')](_[_0xd165('0x66')](_0x5a3de0[_0xd165('0x43')],_0x292190[_0xd165('0x44')]));_0x3bba37[_0xd165('0x4c')][_0xd165('0x62')]=_0x499215['id'];if(_0x5a3de0[_0xd165('0x43')]['filter']){_0x3bba37[_0xd165('0x4c')]=_[_0xd165('0x4e')](_0x3bba37[_0xd165('0x4c')],{'$or':_[_0xd165('0x3e')](_0x3bba37[_0xd165('0x46')],function(_0x385a5b){var _0x870017={};_0x870017[_0x385a5b]={'$like':'%'+_0x5a3de0[_0xd165('0x43')][_0xd165('0x4d')]+'%'};return _0x870017;})});}_0x3bba37=_['merge']({},_0x3bba37,_0x5a3de0[_0xd165('0x57')]);return db[_0xd165('0x8c')][_0xd165('0x2e')]({'where':_0x3bba37[_0xd165('0x4c')]})[_0xd165('0x33')](function(_0x2885cb){_0x224b93['count']=_0x2885cb;if(_0x5a3de0[_0xd165('0x43')][_0xd165('0x50')]){_0x3bba37[_0xd165('0x51')]=[{'model':db[_0xd165('0x6f')],'as':_0xd165('0xab'),'required':![]},{'model':db[_0xd165('0x98')],'as':_0xd165('0xac'),'attributes':[_0xd165('0x39'),_0xd165('0xad'),'internal'],'required':![]},{'model':db[_0xd165('0xae')],'as':'Tags','attributes':['id','name',_0xd165('0xaf')],'where':_0x5a3de0[_0xd165('0x43')][_0xd165('0xb0')]?{'id':_0x5a3de0[_0xd165('0x43')][_0xd165('0xb0')]}:undefined,'required':_0x5a3de0[_0xd165('0x43')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xd165('0x52')](_0x3bba37);})[_0xd165('0x33')](function(_0x300338){_0x224b93[_0xd165('0x53')]=_0x300338;return _0x224b93;});}})[_0xd165('0x33')](respondWithFilteredResult(_0x4e8478,_0x3bba37))['catch'](handleError(_0x4e8478,null));};exports[_0xd165('0xb1')]=function(_0x1e8a78,_0x569192,_0xfc782d){return db[_0xd165('0x4f')]['find']({'where':{'id':_0x1e8a78['params']['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x569192,null))[_0xd165('0x33')](function(_0x1a7a1b){if(_0x1a7a1b){return _0x1a7a1b[_0xd165('0xb1')](_0x1e8a78[_0xd165('0x5a')][_0xd165('0x68')],_['omit'](_0x1e8a78[_0xd165('0x5a')],[_0xd165('0x68'),'id'])||{})[_0xd165('0xb2')](function(_0x489129){for(var _0x2fca94=0x0;_0x2fca94<_0x1e8a78[_0xd165('0x5a')]['ids'][_0xd165('0x48')];_0x2fca94+=0x1){socket['emit'](_0xd165('0xb3'),{'UserId':Number(_0x1e8a78[_0xd165('0x5a')][_0xd165('0x68')][_0x2fca94]),'OpenchannelAccountId':Number(_0x1e8a78[_0xd165('0x55')]['id'])});}return _0x489129;});}})['then'](respondWithResult(_0x569192,null))['catch'](handleError(_0x569192,null));};exports[_0xd165('0xb4')]=function(_0x270be9,_0xb76ac,_0x34e4f0){return db[_0xd165('0x4f')][_0xd165('0x58')]({'where':{'id':_0x270be9[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0xb76ac,null))[_0xd165('0x33')](function(_0x3402f0){if(_0x3402f0){return _0x3402f0[_0xd165('0xb4')](_0x270be9['query'][_0xd165('0x68')])[_0xd165('0x33')](function(){if(_[_0xd165('0xb5')](_0x270be9[_0xd165('0x43')][_0xd165('0x68')])){for(var _0x1a0ef3=0x0;_0x1a0ef3<_0x270be9['query']['ids'][_0xd165('0x48')];_0x1a0ef3+=0x1){socket[_0xd165('0xb6')](_0xd165('0xb7'),{'UserId':Number(_0x270be9[_0xd165('0x43')][_0xd165('0x68')][_0x1a0ef3]),'OpenchannelAccountId':Number(_0x270be9[_0xd165('0x55')]['id'])});}}else{socket[_0xd165('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x270be9[_0xd165('0x43')][_0xd165('0x68')]),'OpenchannelAccountId':Number(_0x270be9[_0xd165('0x55')]['id'])});}});}})[_0xd165('0x33')](respondWithStatusCode(_0xb76ac,null))['catch'](handleError(_0xb76ac,null));};exports['getAgents']=function(_0x40b1e5,_0x19f4f7,_0x5db29a){var _0x1df5e4={};var _0x13948b={};var _0x38b89c;var _0x542a33;return db[_0xd165('0x4f')][_0xd165('0x64')]({'where':{'id':_0x40b1e5[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x19f4f7,null))[_0xd165('0x33')](function(_0x25c111){if(_0x25c111){_0x38b89c=_0x25c111;_0x13948b[_0xd165('0x42')]=_['keys'](db[_0xd165('0x98')][_0xd165('0x3f')]);_0x13948b[_0xd165('0x43')]=_[_0xd165('0x56')](_0x40b1e5[_0xd165('0x43')]);_0x13948b[_0xd165('0x44')]=_[_0xd165('0x45')](_0x13948b[_0xd165('0x42')],_0x13948b[_0xd165('0x43')]);_0x1df5e4[_0xd165('0x46')]=_[_0xd165('0x45')](_0x13948b[_0xd165('0x42')],qs[_0xd165('0x47')](_0x40b1e5[_0xd165('0x43')][_0xd165('0x47')]));_0x1df5e4[_0xd165('0x46')]=_0x1df5e4[_0xd165('0x46')][_0xd165('0x48')]?_0x1df5e4['attributes']:_0x13948b[_0xd165('0x42')];_0x1df5e4[_0xd165('0x4a')]=qs['sort'](_0x40b1e5[_0xd165('0x43')]['sort']);_0x1df5e4['where']=qs['filters'](_[_0xd165('0x66')](_0x40b1e5[_0xd165('0x43')],_0x13948b[_0xd165('0x44')]));if(_0x40b1e5[_0xd165('0x43')][_0xd165('0x4d')]){_0x1df5e4[_0xd165('0x4c')]=_['merge'](_0x1df5e4[_0xd165('0x4c')],{'$or':_[_0xd165('0x3e')](_0x1df5e4[_0xd165('0x46')],function(_0x100f02){var _0x2a2533={};_0x2a2533[_0x100f02]={'$like':'%'+_0x40b1e5[_0xd165('0x43')]['filter']+'%'};return _0x2a2533;})});}_0x1df5e4=_[_0xd165('0x4e')]({},_0x1df5e4,_0x40b1e5[_0xd165('0x57')]);return _0x38b89c[_0xd165('0xb8')](_0x1df5e4);}})['then'](function(_0x70f151){if(_0x70f151){_0x542a33=_0x70f151[_0xd165('0x48')];if(!_0x40b1e5[_0xd165('0x43')][_0xd165('0x49')](_0xd165('0x6c'))){_0x1df5e4[_0xd165('0x2f')]=qs['limit'](_0x40b1e5[_0xd165('0x43')][_0xd165('0x2f')]);_0x1df5e4[_0xd165('0x2c')]=qs[_0xd165('0x2c')](_0x40b1e5['query']['offset']);}return _0x38b89c[_0xd165('0xb8')](_0x1df5e4);}})['then'](function(_0x108681){if(_0x108681){return _0x108681?{'count':_0x542a33,'rows':_0x108681}:null;}})[_0xd165('0x33')](respondWithResult(_0x19f4f7,null))[_0xd165('0x27')](handleError(_0x19f4f7,null));};exports[_0xd165('0x3a')]=function(_0x362c40,_0x1cf98e,_0x34373e){var _0x36e04b,_0x5395f1,_0x59db36;if(_[_0xd165('0x76')](_0x362c40['body'][_0xd165('0x5a')])||_0x362c40[_0xd165('0x5a')][_0xd165('0x5a')]===''){throw new db['Sequelize'][(_0xd165('0x71'))](_0xd165('0x78'));}if(_[_0xd165('0x76')](_0x362c40[_0xd165('0x5a')]['to'])){}_0x36e04b=_0x362c40[_0xd165('0x5a')]['to'];return db['OpenchannelAccount'][_0xd165('0x64')]({'where':{'id':_0x362c40[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x1cf98e,null))['then'](function(_0x4ce6d8){if(_0x4ce6d8){return db[_0xd165('0x4f')][_0xd165('0x58')]({'where':{'id':_0x4ce6d8['id']},'include':[{'model':db[_0xd165('0x7d')],'as':_0xd165('0x7e'),'include':[{'model':db[_0xd165('0x6f')],'as':_0xd165('0x86'),'where':{[_0x4ce6d8[_0xd165('0x79')]]:_0x36e04b},'limit':0x1,'order':[[_0xd165('0x75'),_0xd165('0x7f')]]}]}]})[_0xd165('0x33')](handleEntityNotFound(_0x1cf98e,null))['then'](function(_0x50644b){if(_0x50644b&&_0x50644b[_0xd165('0x7e')]){_0x5395f1=_0x50644b[_0xd165('0x35')]({'plain':!![]});if(_0x5395f1[_0xd165('0x7e')]&&_0x5395f1[_0xd165('0x7e')][_0xd165('0x86')][_0xd165('0x48')]){return _0x5395f1['List'][_0xd165('0x86')][0x0];}return db[_0xd165('0x6f')][_0xd165('0x59')](_[_0xd165('0x19')](_0x362c40['body'],{'firstName':_0x36e04b,[_0x50644b[_0xd165('0x79')]]:_0x36e04b,'phone':_0x36e04b,'ListId':_0x5395f1[_0xd165('0x87')]}));}})[_0xd165('0x33')](handleEntityNotFound(_0x1cf98e,null))[_0xd165('0x33')](function(_0x5b63c9){if(_0x5b63c9){_0x59db36=_0x5b63c9;return db[_0xd165('0x8c')]['find']({'where':{'ContactId':_0x59db36['id'],'closed':![],'OpenchannelAccountId':_0x5395f1['id']}})[_0xd165('0x33')](function(_0x4515ff){if(_0x4515ff){return[_0x4515ff,![]];}return db[_0xd165('0x8c')]['create']({'UserId':_0x362c40[_0xd165('0xb9')]['id'],'ContactId':_0x59db36['id'],'OpenchannelAccountId':_0x5395f1['id'],'lastMsgDirection':_0xd165('0xba'),'firstMsgDirection':'out','Messages':[_[_0xd165('0x4e')](_0x362c40['body'],{'read':![],'body':_0x362c40[_0xd165('0x5a')]['body'],'OpenchannelAccountId':_0x5395f1['id'],'UserId':_0x362c40[_0xd165('0xb9')]['id'],'ContactId':_0x59db36['id']})]},{'include':[{'model':db[_0xd165('0x96')],'as':'Messages'}]})[_0xd165('0x33')](function(_0x3f4fa8){return[_0x3f4fa8,!![]];});});}})[_0xd165('0xb2')](function(_0x206a3e,_0x11cfad){if(_0x11cfad){return _0x206a3e;}return db[_0xd165('0x96')]['create'](_['merge'](_0x362c40['body'],{'read':![],'body':_0x362c40[_0xd165('0x5a')][_0xd165('0x5a')],'OpenchannelAccountId':_0x5395f1['id'],'OpenchannelInteractionId':_0x206a3e['id'],'UserId':_0x362c40['user']['id'],'ContactId':_0x59db36['id']}))[_0xd165('0x33')](function(_0x425330){_0x206a3e[_0xd165('0xbb')]['Messages']=[];_0x206a3e['dataValues'][_0xd165('0xbc')]['push'](_0x425330[_0xd165('0xbb')]);return _0x206a3e;});});}})[_0xd165('0x33')](respondWithResult(_0x1cf98e,null))[_0xd165('0x27')](handleError(_0x1cf98e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 178aca2..9e53e03 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 _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','update','emit'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var OpenchannelAccount=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){OpenchannelAccountEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);OpenchannelAccountEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];OpenchannelAccount[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x5ff3=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','update','remove'];(function(_0x25b145,_0x235d47){var _0x481e11=function(_0x5e76f1){while(--_0x5e76f1){_0x25b145['push'](_0x25b145['shift']());}};_0x481e11(++_0x235d47);}(_0x5ff3,0x17d));var _0x35ff=function(_0x58ea84,_0x1d7804){_0x58ea84=_0x58ea84-0x0;var _0x38380a=_0x5ff3[_0x58ea84];return _0x38380a;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x35ff('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x35ff('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35ff('0x2'),'afterDestroy':_0x35ff('0x3')};function emitEvent(_0x3bd66a){return function(_0xd0846d,_0x551514,_0x2fcb74){OpenchannelAccountEvents[_0x35ff('0x4')](_0x3bd66a+':'+_0xd0846d['id'],_0xd0846d);OpenchannelAccountEvents[_0x35ff('0x4')](_0x3bd66a,_0xd0846d);_0x2fcb74(null);};}for(var e in events){if(events[_0x35ff('0x5')](e)){var event=events[e];OpenchannelAccount[_0x35ff('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 5f943d8..1dea9e1 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(_0x5296aa,_0x12e1bc){var _0x49169b=function(_0x295d0c){while(--_0x295d0c){_0x5296aa['push'](_0x5296aa['shift']());}};_0x49169b(++_0x12e1bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x529677,_0x4198c0){var _0x5796ce=function(_0x4ac7ef){while(--_0x4ac7ef){_0x529677['push'](_0x529677['shift']());}};_0x5796ce(++_0x4198c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 ae01ca0..1734d4a 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 _0x3f8c=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x312634,_0x165c8e){var _0x34a887=function(_0x319519){while(--_0x319519){_0x312634['push'](_0x312634['shift']());}};_0x34a887(++_0x165c8e);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4acfa4,_0x5f21d5){_0x4acfa4=_0x4acfa4-0x0;var _0x246be4=_0x3f8c[_0x4acfa4];return _0x246be4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});config[_0xc3f8('0x7')]=_[_0xc3f8('0x8')](config[_0xc3f8('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xc3f8('0x9'))(new Redis(config[_0xc3f8('0x7')]));require(_0xc3f8('0xa'))[_0xc3f8('0xb')](socket);function respondWithRpcPromise(_0x148e6f,_0x67f688,_0x445299){return new BPromise(function(_0x55ea74,_0x22736b){return client[_0xc3f8('0xc')](_0x148e6f,_0x445299)[_0xc3f8('0xd')](function(_0x4303aa){logger['info'](_0xc3f8('0xe'),_0x67f688,_0xc3f8('0xf'));logger[_0xc3f8('0x10')](_0xc3f8('0x11'),_0x67f688,'request\x20sent',JSON[_0xc3f8('0x12')](_0x4303aa));if(_0x4303aa[_0xc3f8('0x13')]){if(_0x4303aa[_0xc3f8('0x13')][_0xc3f8('0x14')]===0x1f4){logger[_0xc3f8('0x13')](_0xc3f8('0xe'),_0x67f688,_0x4303aa[_0xc3f8('0x13')][_0xc3f8('0x15')]);return _0x22736b(_0x4303aa[_0xc3f8('0x13')][_0xc3f8('0x15')]);}logger[_0xc3f8('0x13')](_0xc3f8('0xe'),_0x67f688,_0x4303aa[_0xc3f8('0x13')]['message']);return _0x55ea74(_0x4303aa[_0xc3f8('0x13')]['message']);}else{logger['info'](_0xc3f8('0xe'),_0x67f688,_0xc3f8('0xf'));_0x55ea74(_0x4303aa[_0xc3f8('0x16')][_0xc3f8('0x15')]);}})['catch'](function(_0x3e75a4){logger[_0xc3f8('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x67f688,_0x3e75a4);_0x22736b(_0x3e75a4);});});} \ No newline at end of file +var _0x8580=['http','redis','defaults','localhost','socket.io-emitter','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x1bf75d,_0x1d3920){var _0x5cce12=function(_0x5b5170){while(--_0x5b5170){_0x1bf75d['push'](_0x1bf75d['shift']());}};_0x5cce12(++_0x1d3920);}(_0x8580,0x1c7));var _0x0858=function(_0x4f8335,_0x50fa6a){_0x4f8335=_0x4f8335-0x0;var _0x24080a=_0x8580[_0x4f8335];return _0x24080a;};'use strict';var _=require('lodash');var util=require(_0x0858('0x0'));var moment=require('moment');var BPromise=require(_0x0858('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0858('0x2'))['db'];var utils=require(_0x0858('0x3'));var logger=require('../../config/logger')(_0x0858('0x4'));var config=require(_0x0858('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0858('0x6')][_0x0858('0x7')]({'port':0x232a});config[_0x0858('0x8')]=_[_0x0858('0x9')](config['redis'],{'host':_0x0858('0xa'),'port':0x18eb});var socket=require(_0x0858('0xb'))(new Redis(config[_0x0858('0x8')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x470459,_0x4b5072,_0x24996d){return new BPromise(function(_0x1c214c,_0x38371f){return client[_0x0858('0xc')](_0x470459,_0x24996d)[_0x0858('0xd')](function(_0x207cda){logger[_0x0858('0xe')](_0x0858('0xf'),_0x4b5072,'request\x20sent');logger['debug'](_0x0858('0x10'),_0x4b5072,'request\x20sent',JSON['stringify'](_0x207cda));if(_0x207cda['error']){if(_0x207cda[_0x0858('0x11')][_0x0858('0x12')]===0x1f4){logger['error'](_0x0858('0xf'),_0x4b5072,_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);return _0x38371f(_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);}logger[_0x0858('0x11')](_0x0858('0xf'),_0x4b5072,_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);return _0x1c214c(_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);}else{logger[_0x0858('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b5072,_0x0858('0x14'));_0x1c214c(_0x207cda['result'][_0x0858('0x13')]);}})[_0x0858('0x15')](function(_0x3a2d96){logger[_0x0858('0x11')](_0x0858('0xf'),_0x4b5072,_0x3a2d96);_0x38371f(_0x3a2d96);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index b2ab1cb..220df4a 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 _0xff96=['openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x3300db,_0x373ecd){var _0x41ff14=function(_0x341553){while(--_0x341553){_0x3300db['push'](_0x3300db['shift']());}};_0x41ff14(++_0x373ecd);}(_0xff96,0x179));var _0x6ff9=function(_0x36d183,_0x321974){_0x36d183=_0x36d183-0x0;var _0x442e71=_0xff96[_0x36d183];return _0x442e71;};'use strict';var OpenchannelAccountEvents=require(_0x6ff9('0x0'));var events=[_0x6ff9('0x1'),_0x6ff9('0x2'),_0x6ff9('0x3')];function createListener(_0xa3cf6b,_0x19b956){return function(_0xc1de29){_0x19b956[_0x6ff9('0x4')](_0xa3cf6b,_0xc1de29);};}function removeListener(_0x3561d7,_0x207c06){return function(){OpenchannelAccountEvents[_0x6ff9('0x5')](_0x3561d7,_0x207c06);};}exports[_0x6ff9('0x6')]=function(_0x4adb77){for(var _0x3efaff=0x0,_0x5509ee=events['length'];_0x3efaff<_0x5509ee;_0x3efaff++){var _0x4f982b=events[_0x3efaff];var _0x5d56f4=createListener(_0x6ff9('0x7')+_0x4f982b,_0x4adb77);OpenchannelAccountEvents['on'](_0x4f982b,_0x5d56f4);}}; \ No newline at end of file +var _0x1da1=['./openchannelAccount.events','save','remove','update','emit','register'];(function(_0x5f16c7,_0x431912){var _0x467699=function(_0x2add21){while(--_0x2add21){_0x5f16c7['push'](_0x5f16c7['shift']());}};_0x467699(++_0x431912);}(_0x1da1,0x1a4));var _0x11da=function(_0x4e6bfc,_0x45a89f){_0x4e6bfc=_0x4e6bfc-0x0;var _0x9cedec=_0x1da1[_0x4e6bfc];return _0x9cedec;};'use strict';var OpenchannelAccountEvents=require(_0x11da('0x0'));var events=[_0x11da('0x1'),_0x11da('0x2'),_0x11da('0x3')];function createListener(_0x46896e,_0x5b0fe4){return function(_0x55af86){_0x5b0fe4[_0x11da('0x4')](_0x46896e,_0x55af86);};}function removeListener(_0x1beca5,_0x3d6bd5){return function(){OpenchannelAccountEvents['removeListener'](_0x1beca5,_0x3d6bd5);};}exports[_0x11da('0x5')]=function(_0x209cbb){for(var _0x15c324=0x0,_0x5ecc27=events['length'];_0x15c324<_0x5ecc27;_0x15c324++){var _0x287653=events[_0x15c324];var _0x109f4b=createListener('openchannelAccount:'+_0x287653,_0x209cbb);OpenchannelAccountEvents['on'](_0x287653,_0x109f4b);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 079c7f0..c4d5eb3 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 _0xb7a1=['show','create','put','destroy','exports','util','path','fs-extra','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','/:id'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb7a1,0x14a));var _0x1b7a=function(_0x154b09,_0xdb71b3){_0x154b09=_0x154b09-0x0;var _0x56fac2=_0xb7a1[_0x154b09];return _0x56fac2;};'use strict';var multer=require('multer');var util=require(_0x1b7a('0x0'));var path=require(_0x1b7a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1b7a('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1b7a('0x3'));var config=require('../../config/environment');var controller=require(_0x1b7a('0x4'));router[_0x1b7a('0x5')]('/',auth[_0x1b7a('0x6')](),controller['index']);router[_0x1b7a('0x5')](_0x1b7a('0x7'),auth[_0x1b7a('0x6')](),controller[_0x1b7a('0x8')]);router['post']('/',auth[_0x1b7a('0x6')](),controller[_0x1b7a('0x9')]);router[_0x1b7a('0xa')](_0x1b7a('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1b7a('0x7'),auth[_0x1b7a('0x6')](),controller[_0x1b7a('0xb')]);module[_0x1b7a('0xc')]=router; \ No newline at end of file +var _0x743a=['show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id'];(function(_0x7b198b,_0x493bbf){var _0x5503a3=function(_0xa993d){while(--_0xa993d){_0x7b198b['push'](_0x7b198b['shift']());}};_0x5503a3(++_0x493bbf);}(_0x743a,0xd3));var _0xa743=function(_0x5b9a52,_0x407826){_0x5b9a52=_0x5b9a52-0x0;var _0x55bc4c=_0x743a[_0x5b9a52];return _0x55bc4c;};'use strict';var multer=require('multer');var util=require(_0xa743('0x0'));var path=require(_0xa743('0x1'));var timeout=require(_0xa743('0x2'));var express=require(_0xa743('0x3'));var router=express[_0xa743('0x4')]();var fs_extra=require(_0xa743('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa743('0x6'));var controller=require('./openchannelApplication.controller');router[_0xa743('0x7')]('/',auth[_0xa743('0x8')](),controller['index']);router[_0xa743('0x7')](_0xa743('0x9'),auth[_0xa743('0x8')](),controller[_0xa743('0xa')]);router[_0xa743('0xb')]('/',auth[_0xa743('0x8')](),controller[_0xa743('0xc')]);router[_0xa743('0xd')]('/:id',auth[_0xa743('0x8')](),controller[_0xa743('0xe')]);router[_0xa743('0xf')](_0xa743('0x9'),auth[_0xa743('0x8')](),controller[_0xa743('0x10')]);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 b55b089..85d9b23 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 _0x2182=['exports','TEXT','STRING'];(function(_0x2d721c,_0x235bba){var _0x2168b0=function(_0x5d3861){while(--_0x5d3861){_0x2d721c['push'](_0x2d721c['shift']());}};_0x2168b0(++_0x235bba);}(_0x2182,0x1c5));var _0x2218=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2182[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0x2218('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2218('0x1')]()},'description':{'type':Sequelize[_0x2218('0x2')]},'interval':{'type':Sequelize[_0x2218('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xbb4b=['*,*,*,*','exports','INTEGER','TEXT','STRING'];(function(_0x23ff58,_0x165758){var _0x3771c6=function(_0x173c35){while(--_0x173c35){_0x23ff58['push'](_0x23ff58['shift']());}};_0x3771c6(++_0x165758);}(_0xbb4b,0x15a));var _0xbbb4=function(_0x2f43ae,_0x24f967){_0x2f43ae=_0x2f43ae-0x0;var _0x454655=_0xbb4b[_0x2f43ae];return _0x454655;};'use strict';var Sequelize=require('sequelize');module[_0xbbb4('0x0')]={'priority':{'type':Sequelize[_0xbbb4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbbb4('0x2')]()},'description':{'type':Sequelize[_0xbbb4('0x3')]},'interval':{'type':Sequelize[_0xbbb4('0x3')],'defaultValue':_0xbbb4('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 559c81b..06f51fe 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 _0xf539=['limit','count','set','apply','reject','save','then','destroy','stack','name','send','index','map','OpenchannelApplication','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','options','include','findAll','catch','show','params','includeAll','merge','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined'];(function(_0x1bd7b7,_0x18e7c4){var _0x46a408=function(_0x447563){while(--_0x447563){_0x1bd7b7['push'](_0x1bd7b7['shift']());}};_0x46a408(++_0x18e7c4);}(_0xf539,0x18e));var _0x9f53=function(_0x4bcf51,_0x3ad51a){_0x4bcf51=_0x4bcf51-0x0;var _0x25e17c=_0xf539[_0x4bcf51];return _0x25e17c;};'use strict';var emlformat=require(_0x9f53('0x0'));var rimraf=require(_0x9f53('0x1'));var zipdir=require(_0x9f53('0x2'));var jsonpatch=require(_0x9f53('0x3'));var rp=require(_0x9f53('0x4'));var moment=require(_0x9f53('0x5'));var BPromise=require(_0x9f53('0x6'));var Mustache=require('mustache');var util=require(_0x9f53('0x7'));var path=require('path');var sox=require(_0x9f53('0x8'));var csv=require('to-csv');var ejs=require(_0x9f53('0x9'));var fs=require('fs');var fs_extra=require(_0x9f53('0xa'));var _=require(_0x9f53('0xb'));var squel=require(_0x9f53('0xc'));var crypto=require('crypto');var jsforce=require(_0x9f53('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9f53('0xe'));var querystring=require(_0x9f53('0xf'));var Papa=require(_0x9f53('0x10'));var Redis=require(_0x9f53('0x11'));var authService=require(_0x9f53('0x12'));var qs=require(_0x9f53('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f53('0x14'))('api');var utils=require(_0x9f53('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9f53('0x16'))['db'];function respondWithStatusCode(_0xb07b9a,_0x311741){_0x311741=_0x311741||0xcc;return function(_0x2669c0){if(_0x2669c0){return _0xb07b9a['sendStatus'](_0x311741);}return _0xb07b9a[_0x9f53('0x17')](_0x311741)[_0x9f53('0x18')]();};}function respondWithResult(_0x31f56c,_0x24c2ef){_0x24c2ef=_0x24c2ef||0xc8;return function(_0x40724d){if(_0x40724d){return _0x31f56c[_0x9f53('0x17')](_0x24c2ef)[_0x9f53('0x19')](_0x40724d);}};}function respondWithFilteredResult(_0x5f5d6e,_0x166f06){return function(_0x469d1f){if(_0x469d1f){var _0x1af840=typeof _0x166f06[_0x9f53('0x1a')]===_0x9f53('0x1b')&&typeof _0x166f06[_0x9f53('0x1c')]===_0x9f53('0x1b');var _0x33fc2b=_0x469d1f[_0x9f53('0x1d')];var _0x587dd7=_0x1af840?0x0:_0x166f06[_0x9f53('0x1a')];var _0x23fb25=_0x1af840?_0x469d1f['count']:_0x166f06['offset']+_0x166f06[_0x9f53('0x1c')];var _0x206f25;if(_0x23fb25>=_0x33fc2b){_0x23fb25=_0x33fc2b;_0x206f25=0xc8;}else{_0x206f25=0xce;}_0x5f5d6e[_0x9f53('0x17')](_0x206f25);return _0x5f5d6e[_0x9f53('0x1e')]('Content-Range',_0x587dd7+'-'+_0x23fb25+'/'+_0x33fc2b)['json'](_0x469d1f);}return null;};}function patchUpdates(_0x5b4a68){return function(_0x355a16){try{jsonpatch[_0x9f53('0x1f')](_0x355a16,_0x5b4a68,!![]);}catch(_0x1ed87f){return BPromise[_0x9f53('0x20')](_0x1ed87f);}return _0x355a16[_0x9f53('0x21')]();};}function saveUpdates(_0x3a71d6,_0x3b5c86){return function(_0x1a5650){if(_0x1a5650){return _0x1a5650['update'](_0x3a71d6)[_0x9f53('0x22')](function(_0x1c1393){return _0x1c1393;});}return null;};}function removeEntity(_0x5f3b52,_0x361037){return function(_0x55efe4){if(_0x55efe4){return _0x55efe4[_0x9f53('0x23')]()['then'](function(){_0x5f3b52[_0x9f53('0x17')](0xcc)[_0x9f53('0x18')]();});}};}function handleEntityNotFound(_0x469146,_0x3cddfe){return function(_0x103a56){if(!_0x103a56){_0x469146['sendStatus'](0x194);}return _0x103a56;};}function handleError(_0x236fcb,_0x532493){_0x532493=_0x532493||0x1f4;return function(_0x551ade){logger['error'](_0x551ade[_0x9f53('0x24')]);if(_0x551ade['name']){delete _0x551ade[_0x9f53('0x25')];}_0x236fcb[_0x9f53('0x17')](_0x532493)[_0x9f53('0x26')](_0x551ade);};}exports[_0x9f53('0x27')]=function(_0x49b70a,_0x5906d6){var _0x268807={},_0x100732={},_0x3e5173={'count':0x0,'rows':[]};var _0x2ba4ef=_[_0x9f53('0x28')](db[_0x9f53('0x29')][_0x9f53('0x2a')],function(_0x4024fa){return{'name':_0x4024fa['fieldName'],'type':_0x4024fa['type'][_0x9f53('0x2b')]};});_0x100732[_0x9f53('0x2c')]=_['map'](_0x2ba4ef,_0x9f53('0x25'));_0x100732[_0x9f53('0x2d')]=_[_0x9f53('0x2e')](_0x49b70a[_0x9f53('0x2d')]);_0x100732[_0x9f53('0x2f')]=_[_0x9f53('0x30')](_0x100732[_0x9f53('0x2c')],_0x100732[_0x9f53('0x2d')]);_0x268807[_0x9f53('0x31')]=_[_0x9f53('0x30')](_0x100732[_0x9f53('0x2c')],qs[_0x9f53('0x32')](_0x49b70a['query'][_0x9f53('0x32')]));_0x268807['attributes']=_0x268807['attributes'][_0x9f53('0x33')]?_0x268807[_0x9f53('0x31')]:_0x100732[_0x9f53('0x2c')];if(!_0x49b70a[_0x9f53('0x2d')][_0x9f53('0x34')](_0x9f53('0x35'))){_0x268807['limit']=qs[_0x9f53('0x1c')](_0x49b70a[_0x9f53('0x2d')][_0x9f53('0x1c')]);_0x268807['offset']=qs[_0x9f53('0x1a')](_0x49b70a['query'][_0x9f53('0x1a')]);}_0x268807['order']=qs[_0x9f53('0x36')](_0x49b70a['query'][_0x9f53('0x36')]);_0x268807['where']=qs[_0x9f53('0x2f')](_[_0x9f53('0x37')](_0x49b70a[_0x9f53('0x2d')],_0x100732[_0x9f53('0x2f')]),_0x2ba4ef);if(_0x49b70a[_0x9f53('0x2d')][_0x9f53('0x38')]){_0x268807['where']=_['merge'](_0x268807[_0x9f53('0x39')],{'$or':_[_0x9f53('0x28')](_0x2ba4ef,function(_0x59d92f){if(_0x59d92f[_0x9f53('0x3a')]!=='VIRTUAL'){var _0x231156={};_0x231156[_0x59d92f['name']]={'$like':'%'+_0x49b70a[_0x9f53('0x2d')][_0x9f53('0x38')]+'%'};return _0x231156;}})});}_0x268807=_['merge']({},_0x268807,_0x49b70a[_0x9f53('0x3b')]);var _0x4fe6bc={'where':_0x268807['where']};return db['OpenchannelApplication'][_0x9f53('0x1d')](_0x4fe6bc)[_0x9f53('0x22')](function(_0x2deaa2){_0x3e5173['count']=_0x2deaa2;if(_0x49b70a[_0x9f53('0x2d')]['includeAll']){_0x268807[_0x9f53('0x3c')]=[{'all':!![]}];}return db[_0x9f53('0x29')][_0x9f53('0x3d')](_0x268807);})['then'](function(_0x2d2d1a){_0x3e5173['rows']=_0x2d2d1a;return _0x3e5173;})[_0x9f53('0x22')](respondWithFilteredResult(_0x5906d6,_0x268807))[_0x9f53('0x3e')](handleError(_0x5906d6,null));};exports[_0x9f53('0x3f')]=function(_0x15e7d7,_0x5ab426){var _0x5457e9={'raw':!![],'where':{'id':_0x15e7d7[_0x9f53('0x40')]['id']}},_0x559df9={};_0x559df9[_0x9f53('0x2c')]=_[_0x9f53('0x2e')](db['OpenchannelApplication'][_0x9f53('0x2a')]);_0x559df9[_0x9f53('0x2d')]=_['keys'](_0x15e7d7['query']);_0x559df9[_0x9f53('0x2f')]=_[_0x9f53('0x30')](_0x559df9[_0x9f53('0x2c')],_0x559df9[_0x9f53('0x2d')]);_0x5457e9[_0x9f53('0x31')]=_[_0x9f53('0x30')](_0x559df9[_0x9f53('0x2c')],qs[_0x9f53('0x32')](_0x15e7d7[_0x9f53('0x2d')][_0x9f53('0x32')]));_0x5457e9[_0x9f53('0x31')]=_0x5457e9[_0x9f53('0x31')][_0x9f53('0x33')]?_0x5457e9[_0x9f53('0x31')]:_0x559df9[_0x9f53('0x2c')];if(_0x15e7d7[_0x9f53('0x2d')][_0x9f53('0x41')]){_0x5457e9[_0x9f53('0x3c')]=[{'all':!![]}];}_0x5457e9=_[_0x9f53('0x42')]({},_0x5457e9,_0x15e7d7[_0x9f53('0x3b')]);return db[_0x9f53('0x29')][_0x9f53('0x43')](_0x5457e9)[_0x9f53('0x22')](handleEntityNotFound(_0x5ab426,null))[_0x9f53('0x22')](respondWithResult(_0x5ab426,null))[_0x9f53('0x3e')](handleError(_0x5ab426,null));};exports[_0x9f53('0x44')]=function(_0x26c478,_0x2f7766){return db[_0x9f53('0x29')][_0x9f53('0x44')](_0x26c478[_0x9f53('0x45')],{})[_0x9f53('0x22')](respondWithResult(_0x2f7766,0xc9))[_0x9f53('0x3e')](handleError(_0x2f7766,null));};exports[_0x9f53('0x46')]=function(_0x1b6b4d,_0x1bf2bf){if(_0x1b6b4d[_0x9f53('0x45')]['id']){delete _0x1b6b4d[_0x9f53('0x45')]['id'];}return db[_0x9f53('0x29')]['find']({'where':{'id':_0x1b6b4d[_0x9f53('0x40')]['id']}})[_0x9f53('0x22')](handleEntityNotFound(_0x1bf2bf,null))['then'](saveUpdates(_0x1b6b4d[_0x9f53('0x45')],null))[_0x9f53('0x22')](respondWithResult(_0x1bf2bf,null))['catch'](handleError(_0x1bf2bf,null));};exports[_0x9f53('0x23')]=function(_0x4e2e4d,_0x352164){return db[_0x9f53('0x29')][_0x9f53('0x43')]({'where':{'id':_0x4e2e4d['params']['id']}})['then'](handleEntityNotFound(_0x352164,null))['then'](removeEntity(_0x352164,null))[_0x9f53('0x3e')](handleError(_0x352164,null));}; \ No newline at end of file +var _0xf6dd=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xf6dd,0x1e1));var _0xdf6d=function(_0x32fe02,_0x5e75b6){_0x32fe02=_0x32fe02-0x0;var _0xac08aa=_0xf6dd[_0x32fe02];return _0xac08aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf6d('0x0'));var zipdir=require(_0xdf6d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf6d('0x2'));var moment=require(_0xdf6d('0x3'));var BPromise=require(_0xdf6d('0x4'));var Mustache=require(_0xdf6d('0x5'));var util=require(_0xdf6d('0x6'));var path=require(_0xdf6d('0x7'));var sox=require(_0xdf6d('0x8'));var csv=require(_0xdf6d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdf6d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdf6d('0xb'));var toCsv=require(_0xdf6d('0x9'));var querystring=require(_0xdf6d('0xc'));var Papa=require(_0xdf6d('0xd'));var Redis=require(_0xdf6d('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf6d('0xf'));var hardwareService=require(_0xdf6d('0x10'));var logger=require(_0xdf6d('0x11'))(_0xdf6d('0x12'));var utils=require(_0xdf6d('0x13'));var config=require(_0xdf6d('0x14'));var licenseUtil=require(_0xdf6d('0x15'));var db=require(_0xdf6d('0x16'))['db'];function respondWithStatusCode(_0x26aba0,_0x1841c2){_0x1841c2=_0x1841c2||0xcc;return function(_0x5ef9ac){if(_0x5ef9ac){return _0x26aba0[_0xdf6d('0x17')](_0x1841c2);}return _0x26aba0[_0xdf6d('0x18')](_0x1841c2)['end']();};}function respondWithResult(_0xb1718,_0x81c3cd){_0x81c3cd=_0x81c3cd||0xc8;return function(_0x5638cd){if(_0x5638cd){return _0xb1718[_0xdf6d('0x18')](_0x81c3cd)[_0xdf6d('0x19')](_0x5638cd);}};}function respondWithFilteredResult(_0x2b515c,_0x3614a9){return function(_0x3c7baf){if(_0x3c7baf){var _0xc8371=typeof _0x3614a9[_0xdf6d('0x1a')]===_0xdf6d('0x1b')&&typeof _0x3614a9[_0xdf6d('0x1c')]===_0xdf6d('0x1b');var _0x1e7fa7=_0x3c7baf[_0xdf6d('0x1d')];var _0x5278b9=_0xc8371?0x0:_0x3614a9[_0xdf6d('0x1a')];var _0x40c824=_0xc8371?_0x3c7baf[_0xdf6d('0x1d')]:_0x3614a9[_0xdf6d('0x1a')]+_0x3614a9['limit'];var _0x2c3dd8;if(_0x40c824>=_0x1e7fa7){_0x40c824=_0x1e7fa7;_0x2c3dd8=0xc8;}else{_0x2c3dd8=0xce;}_0x2b515c[_0xdf6d('0x18')](_0x2c3dd8);return _0x2b515c[_0xdf6d('0x1e')](_0xdf6d('0x1f'),_0x5278b9+'-'+_0x40c824+'/'+_0x1e7fa7)[_0xdf6d('0x19')](_0x3c7baf);}return null;};}function patchUpdates(_0x567778){return function(_0xa66bd5){try{jsonpatch['apply'](_0xa66bd5,_0x567778,!![]);}catch(_0xf87b7e){return BPromise['reject'](_0xf87b7e);}return _0xa66bd5[_0xdf6d('0x20')]();};}function saveUpdates(_0x1c3a7f,_0x19ea69){return function(_0x19fddb){if(_0x19fddb){return _0x19fddb[_0xdf6d('0x21')](_0x1c3a7f)[_0xdf6d('0x22')](function(_0x5280b1){return _0x5280b1;});}return null;};}function removeEntity(_0x5d7e16,_0x165592){return function(_0x5065d2){if(_0x5065d2){return _0x5065d2['destroy']()[_0xdf6d('0x22')](function(){_0x5d7e16['status'](0xcc)[_0xdf6d('0x23')]();});}};}function handleEntityNotFound(_0x422bc7,_0x13c382){return function(_0x635acd){if(!_0x635acd){_0x422bc7['sendStatus'](0x194);}return _0x635acd;};}function handleError(_0x12bf08,_0x1e7d55){_0x1e7d55=_0x1e7d55||0x1f4;return function(_0x8de975){logger[_0xdf6d('0x24')](_0x8de975[_0xdf6d('0x25')]);if(_0x8de975['name']){delete _0x8de975[_0xdf6d('0x26')];}_0x12bf08['status'](_0x1e7d55)[_0xdf6d('0x27')](_0x8de975);};}exports[_0xdf6d('0x28')]=function(_0x431064,_0x5e14af){var _0x30c4aa={},_0x208aa7={},_0x20c8b7={'count':0x0,'rows':[]};var _0x5d9f89=_[_0xdf6d('0x29')](db[_0xdf6d('0x2a')]['rawAttributes'],function(_0x33f92e){return{'name':_0x33f92e[_0xdf6d('0x2b')],'type':_0x33f92e[_0xdf6d('0x2c')][_0xdf6d('0x2d')]};});_0x208aa7[_0xdf6d('0x2e')]=_[_0xdf6d('0x29')](_0x5d9f89,_0xdf6d('0x26'));_0x208aa7[_0xdf6d('0x2f')]=_['keys'](_0x431064[_0xdf6d('0x2f')]);_0x208aa7[_0xdf6d('0x30')]=_['intersection'](_0x208aa7[_0xdf6d('0x2e')],_0x208aa7[_0xdf6d('0x2f')]);_0x30c4aa['attributes']=_[_0xdf6d('0x31')](_0x208aa7['model'],qs[_0xdf6d('0x32')](_0x431064[_0xdf6d('0x2f')]['fields']));_0x30c4aa[_0xdf6d('0x33')]=_0x30c4aa[_0xdf6d('0x33')]['length']?_0x30c4aa[_0xdf6d('0x33')]:_0x208aa7[_0xdf6d('0x2e')];if(!_0x431064[_0xdf6d('0x2f')]['hasOwnProperty'](_0xdf6d('0x34'))){_0x30c4aa['limit']=qs[_0xdf6d('0x1c')](_0x431064[_0xdf6d('0x2f')]['limit']);_0x30c4aa['offset']=qs[_0xdf6d('0x1a')](_0x431064['query']['offset']);}_0x30c4aa['order']=qs[_0xdf6d('0x35')](_0x431064[_0xdf6d('0x2f')]['sort']);_0x30c4aa[_0xdf6d('0x36')]=qs[_0xdf6d('0x30')](_[_0xdf6d('0x37')](_0x431064['query'],_0x208aa7['filters']),_0x5d9f89);if(_0x431064[_0xdf6d('0x2f')]['filter']){_0x30c4aa[_0xdf6d('0x36')]=_[_0xdf6d('0x38')](_0x30c4aa[_0xdf6d('0x36')],{'$or':_['map'](_0x5d9f89,function(_0x8d1def){if(_0x8d1def[_0xdf6d('0x2c')]!==_0xdf6d('0x39')){var _0x312e1c={};_0x312e1c[_0x8d1def[_0xdf6d('0x26')]]={'$like':'%'+_0x431064[_0xdf6d('0x2f')][_0xdf6d('0x3a')]+'%'};return _0x312e1c;}})});}_0x30c4aa=_[_0xdf6d('0x38')]({},_0x30c4aa,_0x431064[_0xdf6d('0x3b')]);var _0x33c8f1={'where':_0x30c4aa[_0xdf6d('0x36')]};return db[_0xdf6d('0x2a')][_0xdf6d('0x1d')](_0x33c8f1)[_0xdf6d('0x22')](function(_0x45989a){_0x20c8b7['count']=_0x45989a;if(_0x431064[_0xdf6d('0x2f')][_0xdf6d('0x3c')]){_0x30c4aa[_0xdf6d('0x3d')]=[{'all':!![]}];}return db[_0xdf6d('0x2a')]['findAll'](_0x30c4aa);})[_0xdf6d('0x22')](function(_0x16241f){_0x20c8b7[_0xdf6d('0x3e')]=_0x16241f;return _0x20c8b7;})[_0xdf6d('0x22')](respondWithFilteredResult(_0x5e14af,_0x30c4aa))[_0xdf6d('0x3f')](handleError(_0x5e14af,null));};exports[_0xdf6d('0x40')]=function(_0x44af7d,_0x22063){var _0x537c58={'raw':!![],'where':{'id':_0x44af7d[_0xdf6d('0x41')]['id']}},_0x3212c1={};_0x3212c1[_0xdf6d('0x2e')]=_[_0xdf6d('0x42')](db[_0xdf6d('0x2a')]['rawAttributes']);_0x3212c1[_0xdf6d('0x2f')]=_[_0xdf6d('0x42')](_0x44af7d[_0xdf6d('0x2f')]);_0x3212c1[_0xdf6d('0x30')]=_[_0xdf6d('0x31')](_0x3212c1[_0xdf6d('0x2e')],_0x3212c1['query']);_0x537c58[_0xdf6d('0x33')]=_[_0xdf6d('0x31')](_0x3212c1[_0xdf6d('0x2e')],qs[_0xdf6d('0x32')](_0x44af7d[_0xdf6d('0x2f')][_0xdf6d('0x32')]));_0x537c58[_0xdf6d('0x33')]=_0x537c58[_0xdf6d('0x33')][_0xdf6d('0x43')]?_0x537c58[_0xdf6d('0x33')]:_0x3212c1[_0xdf6d('0x2e')];if(_0x44af7d[_0xdf6d('0x2f')][_0xdf6d('0x3c')]){_0x537c58[_0xdf6d('0x3d')]=[{'all':!![]}];}_0x537c58=_[_0xdf6d('0x38')]({},_0x537c58,_0x44af7d[_0xdf6d('0x3b')]);return db[_0xdf6d('0x2a')][_0xdf6d('0x44')](_0x537c58)[_0xdf6d('0x22')](handleEntityNotFound(_0x22063,null))[_0xdf6d('0x22')](respondWithResult(_0x22063,null))[_0xdf6d('0x3f')](handleError(_0x22063,null));};exports[_0xdf6d('0x45')]=function(_0x5ba55c,_0x3706a2){return db['OpenchannelApplication'][_0xdf6d('0x45')](_0x5ba55c[_0xdf6d('0x46')],{})[_0xdf6d('0x22')](respondWithResult(_0x3706a2,0xc9))[_0xdf6d('0x3f')](handleError(_0x3706a2,null));};exports['update']=function(_0x23e097,_0x55f0aa){if(_0x23e097['body']['id']){delete _0x23e097['body']['id'];}return db[_0xdf6d('0x2a')][_0xdf6d('0x44')]({'where':{'id':_0x23e097[_0xdf6d('0x41')]['id']}})[_0xdf6d('0x22')](handleEntityNotFound(_0x55f0aa,null))[_0xdf6d('0x22')](saveUpdates(_0x23e097[_0xdf6d('0x46')],null))[_0xdf6d('0x22')](respondWithResult(_0x55f0aa,null))[_0xdf6d('0x3f')](handleError(_0x55f0aa,null));};exports[_0xdf6d('0x47')]=function(_0x2eade0,_0x22a708){return db[_0xdf6d('0x2a')][_0xdf6d('0x44')]({'where':{'id':_0x2eade0[_0xdf6d('0x41')]['id']}})['then'](handleEntityNotFound(_0x22a708,null))['then'](removeEntity(_0x22a708,null))[_0xdf6d('0x3f')](handleError(_0x22a708,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index e37604b..fd77d36 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 _0x07ad=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x283b84,_0x18dba0){var _0x3c53b7=function(_0x10b183){while(--_0x10b183){_0x283b84['push'](_0x283b84['shift']());}};_0x3c53b7(++_0x18dba0);}(_0x07ad,0x176));var _0xd07a=function(_0x16e2a0,_0x499f26){_0x16e2a0=_0x16e2a0-0x0;var _0x582f15=_0x07ad[_0x16e2a0];return _0x582f15;};'use strict';var _=require(_0xd07a('0x0'));var util=require(_0xd07a('0x1'));var logger=require('../../config/logger')(_0xd07a('0x2'));var moment=require(_0xd07a('0x3'));var BPromise=require(_0xd07a('0x4'));var rp=require(_0xd07a('0x5'));var fs=require('fs');var path=require(_0xd07a('0x6'));var rimraf=require(_0xd07a('0x7'));var config=require(_0xd07a('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0xd07a('0x9')]=function(_0x3cf393,_0x551ba6){return _0x3cf393[_0xd07a('0xa')](_0xd07a('0xb'),attributes,{'tableName':_0xd07a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd07a('0xd')});}; \ No newline at end of file +var _0x4851=['api','moment','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x313600,_0x10a50d){var _0x85ba4f=function(_0x4603fb){while(--_0x4603fb){_0x313600['push'](_0x313600['shift']());}};_0x85ba4f(++_0x10a50d);}(_0x4851,0x15f));var _0x1485=function(_0x438788,_0x17ff59){_0x438788=_0x438788-0x0;var _0x56b974=_0x4851[_0x438788];return _0x56b974;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1485('0x0'))(_0x1485('0x1'));var moment=require(_0x1485('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1485('0x3'));var config=require(_0x1485('0x4'));var attributes=require(_0x1485('0x5'));module[_0x1485('0x6')]=function(_0x47f2a8,_0x3f7e77){return _0x47f2a8[_0x1485('0x7')]('OpenchannelApplication',attributes,{'tableName':_0x1485('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1485('0x9'),'collate':_0x1485('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 717f4d9..a82b6fa 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 _0x29ab=['UpdateOpenchannelApplication','update','body','options','raw','limit','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x29ab,0x1e2));var _0xb29a=function(_0x55baf4,_0x1dc93a){_0x55baf4=_0x55baf4-0x0;var _0x4c5fd1=_0x29ab[_0x55baf4];return _0x4c5fd1;};'use strict';var _=require(_0xb29a('0x0'));var util=require(_0xb29a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb29a('0x2'));var db=require(_0xb29a('0x3'))['db'];var utils=require(_0xb29a('0x4'));var logger=require(_0xb29a('0x5'))(_0xb29a('0x6'));var config=require(_0xb29a('0x7'));var jayson=require(_0xb29a('0x8'));var client=jayson[_0xb29a('0x9')][_0xb29a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5561cf,_0x50632e,_0x580627){return new BPromise(function(_0x2d7891,_0x53dce6){return client['request'](_0x5561cf,_0x580627)[_0xb29a('0xb')](function(_0x41898d){logger['info'](_0xb29a('0xc'),_0x50632e,_0xb29a('0xd'));logger[_0xb29a('0xe')](_0xb29a('0xf'),_0x50632e,'request\x20sent',JSON[_0xb29a('0x10')](_0x41898d));if(_0x41898d[_0xb29a('0x11')]){if(_0x41898d[_0xb29a('0x11')]['code']===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x50632e,_0x41898d['error']['message']);return _0x53dce6(_0x41898d[_0xb29a('0x11')][_0xb29a('0x12')]);}logger[_0xb29a('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x50632e,_0x41898d[_0xb29a('0x11')][_0xb29a('0x12')]);return _0x2d7891(_0x41898d[_0xb29a('0x11')][_0xb29a('0x12')]);}else{logger[_0xb29a('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x50632e,_0xb29a('0xd'));_0x2d7891(_0x41898d[_0xb29a('0x14')][_0xb29a('0x12')]);}})[_0xb29a('0x15')](function(_0x496a1b){logger[_0xb29a('0x11')](_0xb29a('0xc'),_0x50632e,_0x496a1b);_0x53dce6(_0x496a1b);});});}exports[_0xb29a('0x16')]=function(_0x54e54f){var _0x224e2e=this;return new Promise(function(_0x2af36b,_0x3f6514){return db['OpenchannelApplication'][_0xb29a('0x17')](_0x54e54f[_0xb29a('0x18')],{'raw':_0x54e54f[_0xb29a('0x19')]?_0x54e54f[_0xb29a('0x19')][_0xb29a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54e54f['options']?_0x54e54f['options']['where']||null:null,'attributes':_0x54e54f[_0xb29a('0x19')]?_0x54e54f['options']['attributes']||null:null,'limit':_0x54e54f['options']?_0x54e54f[_0xb29a('0x19')][_0xb29a('0x1b')]||null:null})['then'](function(_0x3596f8){logger[_0xb29a('0x13')](_0xb29a('0x16'),_0x54e54f);logger['debug'](_0xb29a('0x16'),_0x54e54f,JSON['stringify'](_0x3596f8));_0x2af36b(_0x3596f8);})['catch'](function(_0x38fda5){logger['error'](_0xb29a('0x16'),_0x38fda5[_0xb29a('0x12')],_0x54e54f);_0x3f6514(_0x224e2e[_0xb29a('0x11')](0x1f4,_0x38fda5[_0xb29a('0x12')]));});});}; \ No newline at end of file +var _0x86aa=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','debug','lodash','bluebird','randomstring'];(function(_0x56c250,_0x22aefd){var _0x168d8b=function(_0xe515ea){while(--_0xe515ea){_0x56c250['push'](_0x56c250['shift']());}};_0x168d8b(++_0x22aefd);}(_0x86aa,0x1af));var _0xa86a=function(_0x4d3460,_0x4488eb){_0x4d3460=_0x4d3460-0x0;var _0x19bd8e=_0x86aa[_0x4d3460];return _0x19bd8e;};'use strict';var _=require(_0xa86a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa86a('0x1'));var rs=require(_0xa86a('0x2'));var fs=require('fs');var Redis=require(_0xa86a('0x3'));var db=require(_0xa86a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa86a('0x5'))(_0xa86a('0x6'));var config=require(_0xa86a('0x7'));var jayson=require(_0xa86a('0x8'));var client=jayson[_0xa86a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29d80a,_0x30c168,_0x51c11d){return new BPromise(function(_0x34bafb,_0x300c66){return client[_0xa86a('0xa')](_0x29d80a,_0x51c11d)[_0xa86a('0xb')](function(_0x281a1f){logger[_0xa86a('0xc')](_0xa86a('0xd'),_0x30c168,_0xa86a('0xe'));logger['debug'](_0xa86a('0xf'),_0x30c168,_0xa86a('0xe'),JSON[_0xa86a('0x10')](_0x281a1f));if(_0x281a1f['error']){if(_0x281a1f[_0xa86a('0x11')][_0xa86a('0x12')]===0x1f4){logger[_0xa86a('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x30c168,_0x281a1f['error']['message']);return _0x300c66(_0x281a1f['error']['message']);}logger[_0xa86a('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x30c168,_0x281a1f[_0xa86a('0x11')][_0xa86a('0x13')]);return _0x34bafb(_0x281a1f[_0xa86a('0x11')][_0xa86a('0x13')]);}else{logger[_0xa86a('0xc')](_0xa86a('0xd'),_0x30c168,_0xa86a('0xe'));_0x34bafb(_0x281a1f['result'][_0xa86a('0x13')]);}})[_0xa86a('0x14')](function(_0x43770f){logger[_0xa86a('0x11')](_0xa86a('0xd'),_0x30c168,_0x43770f);_0x300c66(_0x43770f);});});}exports[_0xa86a('0x15')]=function(_0x3f49c5){var _0x5661a2=this;return new Promise(function(_0x599082,_0x3c3f3c){return db[_0xa86a('0x16')][_0xa86a('0x17')](_0x3f49c5[_0xa86a('0x18')],{'raw':_0x3f49c5[_0xa86a('0x19')]?_0x3f49c5[_0xa86a('0x19')][_0xa86a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f49c5['options']?_0x3f49c5[_0xa86a('0x19')][_0xa86a('0x1b')]||null:null,'attributes':_0x3f49c5[_0xa86a('0x19')]?_0x3f49c5[_0xa86a('0x19')][_0xa86a('0x1c')]||null:null,'limit':_0x3f49c5['options']?_0x3f49c5[_0xa86a('0x19')][_0xa86a('0x1d')]||null:null})[_0xa86a('0xb')](function(_0x4128ed){logger[_0xa86a('0xc')](_0xa86a('0x15'),_0x3f49c5);logger[_0xa86a('0x1e')](_0xa86a('0x15'),_0x3f49c5,JSON[_0xa86a('0x10')](_0x4128ed));_0x599082(_0x4128ed);})['catch'](function(_0x18a971){logger[_0xa86a('0x11')](_0xa86a('0x15'),_0x18a971[_0xa86a('0x13')],_0x3f49c5);_0x3c3f3c(_0x5661a2[_0xa86a('0x11')](0x1f4,_0x18a971[_0xa86a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 51fb690..1193b74 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 _0xdd48=['/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xdd48,0x1d3));var _0x8dd4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xdd48[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x8dd4('0x0'));var util=require(_0x8dd4('0x1'));var path=require(_0x8dd4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8dd4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8dd4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8dd4('0x5'));var controller=require(_0x8dd4('0x6'));router[_0x8dd4('0x7')]('/',auth[_0x8dd4('0x8')](),controller['index']);router[_0x8dd4('0x7')](_0x8dd4('0x9'),auth[_0x8dd4('0x8')](),controller[_0x8dd4('0xa')]);router[_0x8dd4('0x7')](_0x8dd4('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8dd4('0x7')](_0x8dd4('0xc'),auth[_0x8dd4('0x8')](),controller[_0x8dd4('0xd')]);router[_0x8dd4('0x7')](_0x8dd4('0xe'),auth[_0x8dd4('0x8')](),controller['download']);router[_0x8dd4('0xf')]('/',auth[_0x8dd4('0x8')](),controller[_0x8dd4('0x10')]);router[_0x8dd4('0xf')](_0x8dd4('0xc'),auth[_0x8dd4('0x8')](),controller[_0x8dd4('0x11')]);router[_0x8dd4('0xf')](_0x8dd4('0x12'),auth[_0x8dd4('0x8')](),interaction[_0x8dd4('0x13')](_0x8dd4('0x14'),_0x8dd4('0x15')),controller[_0x8dd4('0x16')]);router[_0x8dd4('0x17')](_0x8dd4('0xb'),auth[_0x8dd4('0x8')](),interaction[_0x8dd4('0x13')](_0x8dd4('0x14'),_0x8dd4('0x18')),controller['update']);router[_0x8dd4('0x19')](_0x8dd4('0xb'),auth[_0x8dd4('0x8')](),interaction[_0x8dd4('0x13')](_0x8dd4('0x14'),'openchannelinteraction:destroy'),controller[_0x8dd4('0x1a')]);router['delete'](_0x8dd4('0x12'),auth[_0x8dd4('0x8')](),controller['removeTags']);module[_0x8dd4('0x1b')]=router; \ No newline at end of file +var _0xd23a=['update','openchannelinteraction:destroy','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update'];(function(_0xda0c6a,_0x4e0eb5){var _0x16395e=function(_0x12c783){while(--_0x12c783){_0xda0c6a['push'](_0xda0c6a['shift']());}};_0x16395e(++_0x4e0eb5);}(_0xd23a,0xe4));var _0xad23=function(_0x302734,_0x581530){_0x302734=_0x302734-0x0;var _0x57abb0=_0xd23a[_0x302734];return _0x57abb0;};'use strict';var multer=require(_0xad23('0x0'));var util=require(_0xad23('0x1'));var path=require(_0xad23('0x2'));var timeout=require('connect-timeout');var express=require(_0xad23('0x3'));var router=express[_0xad23('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xad23('0x5'));var interaction=require(_0xad23('0x6'));var config=require(_0xad23('0x7'));var controller=require(_0xad23('0x8'));router[_0xad23('0x9')]('/',auth[_0xad23('0xa')](),controller[_0xad23('0xb')]);router[_0xad23('0x9')](_0xad23('0xc'),auth[_0xad23('0xa')](),controller[_0xad23('0xd')]);router[_0xad23('0x9')](_0xad23('0xe'),auth['isAuthenticated'](),controller[_0xad23('0xf')]);router[_0xad23('0x9')](_0xad23('0x10'),auth[_0xad23('0xa')](),controller[_0xad23('0x11')]);router[_0xad23('0x9')](_0xad23('0x12'),auth[_0xad23('0xa')](),controller[_0xad23('0x13')]);router['post']('/',auth[_0xad23('0xa')](),controller['create']);router[_0xad23('0x14')](_0xad23('0x10'),auth[_0xad23('0xa')](),controller[_0xad23('0x15')]);router[_0xad23('0x14')](_0xad23('0x16'),auth[_0xad23('0xa')](),interaction[_0xad23('0x17')](_0xad23('0x18'),_0xad23('0x19')),controller[_0xad23('0x1a')]);router['put'](_0xad23('0xe'),auth[_0xad23('0xa')](),interaction[_0xad23('0x17')](_0xad23('0x18'),_0xad23('0x1b')),controller[_0xad23('0x1c')]);router['delete'](_0xad23('0xe'),auth[_0xad23('0xa')](),interaction[_0xad23('0x17')](_0xad23('0x18'),_0xad23('0x1d')),controller[_0xad23('0x1e')]);router['delete'](_0xad23('0x16'),auth['isAuthenticated'](),controller['removeTags']);module[_0xad23('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index f261889..9276d40 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 _0xc820=['out','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x54bdc9,_0x1996ad){var _0x4e8743=function(_0x1fd121){while(--_0x1fd121){_0x54bdc9['push'](_0x54bdc9['shift']());}};_0x4e8743(++_0x1996ad);}(_0xc820,0x13f));var _0x0c82=function(_0xd4252e,_0x1e8065){_0xd4252e=_0xd4252e-0x0;var _0x4842dd=_0xc820[_0xd4252e];return _0x4842dd;};'use strict';var Sequelize=require('sequelize');module[_0x0c82('0x0')]={'closed':{'type':Sequelize[_0x0c82('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0c82('0x2')]},'disposition':{'type':Sequelize[_0x0c82('0x3')]},'secondDisposition':{'type':Sequelize[_0x0c82('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0c82('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x0c82('0x3')]},'externalUrl':{'type':Sequelize[_0x0c82('0x3')]},'lastMsgAt':{'type':Sequelize[_0x0c82('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x0c82('0x4')]('in',_0x0c82('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x0c82('0x4')]('in',_0x0c82('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0c82('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x0c82('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xc524=['ENUM','out','BOOLEAN','DATE','STRING'];(function(_0x2ead6b,_0x1c7f76){var _0x598be5=function(_0x4203e2){while(--_0x4203e2){_0x2ead6b['push'](_0x2ead6b['shift']());}};_0x598be5(++_0x1c7f76);}(_0xc524,0x1bf));var _0x4c52=function(_0x532139,_0x4719e0){_0x532139=_0x532139-0x0;var _0x1a2561=_0xc524[_0x532139];return _0x1a2561;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x4c52('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4c52('0x1')]},'disposition':{'type':Sequelize[_0x4c52('0x2')]},'secondDisposition':{'type':Sequelize[_0x4c52('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4c52('0x2')]},'note':{'type':Sequelize[_0x4c52('0x2')]},'read1stAt':{'type':Sequelize[_0x4c52('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x4c52('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x4c52('0x3')]('in',_0x4c52('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x4c52('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x4c52('0x0')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6c1bf5e..5285a13 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 _0xadfc=['Account','User','Owner','Openchannel','N.A.','createdAt','closed','disposition','threadId','Public','Private','existsSync','pipe','createWriteStream','basename','out','System','lastName','value','renderFile','transcript-','.pdf','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','then','error','stack','name','send','index','map','rawAttributes','type','key','findAll','openchannel','query','show','from','params','model','keys','OpenchannelInteraction','filters','attributes','intersection','fields','length','includeAll','include','merge','catch','create','body','update','find','destroy','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','toString','root','server','files','join','format','transcript-%d-%s.zip','push','fullname','CmContact','Contact','firstName','attachments','Attachment','Messages','direction','secret','read','OpenchannelAccount'];(function(_0x11569c,_0x1bea63){var _0x55e1ae=function(_0x5c4a3d){while(--_0x5c4a3d){_0x11569c['push'](_0x11569c['shift']());}};_0x55e1ae(++_0x1bea63);}(_0xadfc,0x9a));var _0xcadf=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xadfc[_0x55f8b4];return _0x2475f9;};'use strict';var rimraf=require(_0xcadf('0x0'));var zipdir=require(_0xcadf('0x1'));var moment=require(_0xcadf('0x2'));var util=require('util');var path=require(_0xcadf('0x3'));var ejs=require(_0xcadf('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xcadf('0x5'));var interaction=require(_0xcadf('0x6'));var qs=require(_0xcadf('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xcadf('0x8'))(_0xcadf('0x9'));var config=require(_0xcadf('0xa'));var db=require(_0xcadf('0xb'))['db'];config[_0xcadf('0xc')]=_[_0xcadf('0xd')](config['redis'],{'host':_0xcadf('0xe'),'port':0x18eb});var socket=require(_0xcadf('0xf'))(new Redis(config[_0xcadf('0xc')]));require(_0xcadf('0x10'))[_0xcadf('0x11')](socket);function respondWithStatusCode(_0x2f376c,_0x46cf38){_0x46cf38=_0x46cf38||0xcc;return function(_0x5b06a1){if(_0x5b06a1){return _0x2f376c[_0xcadf('0x12')](_0x46cf38);}return _0x2f376c['status'](_0x46cf38)[_0xcadf('0x13')]();};}function respondWithResult(_0x25baca,_0x10f583){_0x10f583=_0x10f583||0xc8;return function(_0x19d0ba){if(_0x19d0ba){return _0x25baca[_0xcadf('0x14')](_0x10f583)[_0xcadf('0x15')](_0x19d0ba);}};}function respondWithFilteredResult(_0x3b27c5,_0x12c209){return function(_0x6f1793){if(_0x6f1793){var _0x50080e=typeof _0x12c209[_0xcadf('0x16')]===_0xcadf('0x17')&&typeof _0x12c209[_0xcadf('0x18')]==='undefined';var _0x111143=_0x6f1793[_0xcadf('0x19')];var _0x1fc2e5=_0x50080e?0x0:_0x12c209[_0xcadf('0x16')];var _0xd88201=_0x50080e?_0x6f1793['count']:_0x12c209[_0xcadf('0x16')]+_0x12c209['limit'];var _0x36b02c;if(_0xd88201>=_0x111143){_0xd88201=_0x111143;_0x36b02c=0xc8;}else{_0x36b02c=0xce;}_0x3b27c5['status'](_0x36b02c);return _0x3b27c5['set']('Content-Range',_0x1fc2e5+'-'+_0xd88201+'/'+_0x111143)[_0xcadf('0x15')](_0x6f1793);}return null;};}function saveUpdates(_0x349067){return function(_0x4ad3e1){if(_0x4ad3e1){return _0x4ad3e1['update'](_0x349067)[_0xcadf('0x1a')](function(_0x5f2068){return _0x5f2068;});}return null;};}function removeEntity(_0x379c55){return function(_0x3eb846){if(_0x3eb846){return _0x3eb846['destroy']()[_0xcadf('0x1a')](function(){_0x379c55[_0xcadf('0x14')](0xcc)[_0xcadf('0x13')]();});}};}function handleEntityNotFound(_0x4f508d){return function(_0x183fab){if(!_0x183fab){_0x4f508d[_0xcadf('0x12')](0x194);}return _0x183fab;};}function handleError(_0x124a7d,_0x31f5db){_0x31f5db=_0x31f5db||0x1f4;return function(_0x39e586){logger[_0xcadf('0x1b')](_0x39e586[_0xcadf('0x1c')]);if(_0x39e586['name']){delete _0x39e586[_0xcadf('0x1d')];}_0x124a7d['status'](_0x31f5db)[_0xcadf('0x1e')](_0x39e586);};}exports[_0xcadf('0x1f')]=function(_0x35722e,_0x4d894c){var _0x32a47d={};var _0x399188=_[_0xcadf('0x20')](db['OpenchannelInteraction'][_0xcadf('0x21')],function(_0x5e751b){return{'name':_0x5e751b['fieldName'],'type':_0x5e751b[_0xcadf('0x22')][_0xcadf('0x23')]};});_0x32a47d=qs['getOptions'](_0x399188,_0x35722e);return interaction[_0xcadf('0x24')](_0xcadf('0x25'),_0x35722e[_0xcadf('0x26')],_0x35722e['user'],_0x32a47d,_0x399188)[_0xcadf('0x1a')](respondWithFilteredResult(_0x4d894c,_0x32a47d))['catch'](handleError(_0x4d894c,null));};exports[_0xcadf('0x27')]=function(_0x56c9c7,_0x3e0222){var _0x4f4d99={};if(_0x56c9c7[_0xcadf('0x26')][_0xcadf('0x22')]&&_0x56c9c7[_0xcadf('0x26')][_0xcadf('0x22')]==='from'){_0x4f4d99[_0xcadf('0x28')]=_0x56c9c7[_0xcadf('0x29')]['id'];}else{_0x4f4d99['id']=_0x56c9c7[_0xcadf('0x29')]['id'];}var _0x41ae62={'raw':![],'where':_0x4f4d99},_0xe80c3d={};_0xe80c3d[_0xcadf('0x2a')]=_[_0xcadf('0x2b')](db[_0xcadf('0x2c')]['rawAttributes']);_0xe80c3d['query']=_[_0xcadf('0x2b')](_0x56c9c7[_0xcadf('0x26')]);_0xe80c3d[_0xcadf('0x2d')]=_['intersection'](_0xe80c3d['model'],_0xe80c3d['query']);_0x41ae62[_0xcadf('0x2e')]=_[_0xcadf('0x2f')](_0xe80c3d[_0xcadf('0x2a')],qs[_0xcadf('0x30')](_0x56c9c7[_0xcadf('0x26')][_0xcadf('0x30')]));_0x41ae62[_0xcadf('0x2e')]=_0x41ae62[_0xcadf('0x2e')][_0xcadf('0x31')]?_0x41ae62['attributes']:_0xe80c3d[_0xcadf('0x2a')];if(_0x56c9c7[_0xcadf('0x26')][_0xcadf('0x32')]){_0x41ae62[_0xcadf('0x33')]=[{'all':!![]}];}_0x41ae62=_[_0xcadf('0x34')]({},_0x41ae62,_0x56c9c7['options']);return db[_0xcadf('0x2c')]['find'](_0x41ae62)[_0xcadf('0x1a')](handleEntityNotFound(_0x3e0222,null))[_0xcadf('0x1a')](respondWithResult(_0x3e0222,null))[_0xcadf('0x35')](handleError(_0x3e0222,null));};exports[_0xcadf('0x36')]=function(_0x18cd74,_0x5e3b90){return db[_0xcadf('0x2c')]['create'](_0x18cd74[_0xcadf('0x37')],{})[_0xcadf('0x1a')](respondWithResult(_0x5e3b90,0xc9))[_0xcadf('0x35')](handleError(_0x5e3b90,null));};exports[_0xcadf('0x38')]=function(_0x1c1ea7,_0xb7076d){if(_0x1c1ea7[_0xcadf('0x37')]['id']){delete _0x1c1ea7['body']['id'];}return db[_0xcadf('0x2c')][_0xcadf('0x39')]({'where':{'id':_0x1c1ea7[_0xcadf('0x29')]['id']}})[_0xcadf('0x1a')](handleEntityNotFound(_0xb7076d,null))[_0xcadf('0x1a')](saveUpdates(_0x1c1ea7[_0xcadf('0x37')],null))['then'](respondWithResult(_0xb7076d,null))[_0xcadf('0x35')](handleError(_0xb7076d,null));};exports[_0xcadf('0x3a')]=function(_0x26f74f,_0x43d95c){return db[_0xcadf('0x2c')][_0xcadf('0x39')]({'where':{'id':_0x26f74f[_0xcadf('0x29')]['id']}})[_0xcadf('0x1a')](handleEntityNotFound(_0x43d95c,null))['then'](removeEntity(_0x43d95c,null))[_0xcadf('0x35')](handleError(_0x43d95c,null));};exports[_0xcadf('0x3b')]=function(_0x181264,_0x1b0f5f){return db[_0xcadf('0x2c')][_0xcadf('0x3b')]()[_0xcadf('0x1a')](respondWithResult(_0x1b0f5f,null))[_0xcadf('0x35')](handleError(_0x1b0f5f,null));};exports[_0xcadf('0x3c')]=function(_0x39587b,_0x9ff752){return db[_0xcadf('0x3d')][_0xcadf('0x39')]({'where':{'id':_0x39587b['params']['id']}})[_0xcadf('0x1a')](handleEntityNotFound(_0x9ff752,null))['then'](function(_0x5d0008){if(_0x5d0008){return _0x5d0008[_0xcadf('0x3c')](_0x39587b[_0xcadf('0x37')][_0xcadf('0x3e')],_['omit'](_0x39587b[_0xcadf('0x37')],[_0xcadf('0x3e'),'id'])||{});}})[_0xcadf('0x1a')](respondWithResult(_0x9ff752,null))['catch'](handleError(_0x9ff752,null));};exports[_0xcadf('0x3f')]=function(_0xf0acc8,_0x5bc81a){var _0x2fa20={'raw':![],'where':{}};var _0x7a6962={};var _0x1282e6={'count':0x0,'rows':[]};return db[_0xcadf('0x2c')][_0xcadf('0x40')]({'where':{'id':_0xf0acc8[_0xcadf('0x29')]['id']}})[_0xcadf('0x1a')](handleEntityNotFound(_0x5bc81a,null))[_0xcadf('0x1a')](function(_0x33eba5){if(_0x33eba5){_0x7a6962['model']=_[_0xcadf('0x2b')](db[_0xcadf('0x3d')][_0xcadf('0x21')]);_0x7a6962['query']=_[_0xcadf('0x2b')](_0xf0acc8[_0xcadf('0x26')]);_0x7a6962['filters']=_[_0xcadf('0x2f')](_0x7a6962[_0xcadf('0x2a')],_0x7a6962[_0xcadf('0x26')]);_0x2fa20[_0xcadf('0x2e')]=_[_0xcadf('0x2f')](_0x7a6962[_0xcadf('0x2a')],qs['fields'](_0xf0acc8['query'][_0xcadf('0x30')]));_0x2fa20[_0xcadf('0x2e')]=_0x2fa20['attributes'][_0xcadf('0x31')]?_0x2fa20[_0xcadf('0x2e')]:_0x7a6962[_0xcadf('0x2a')];if(!_0xf0acc8[_0xcadf('0x26')][_0xcadf('0x41')](_0xcadf('0x42'))){_0x2fa20[_0xcadf('0x18')]=qs[_0xcadf('0x18')](_0xf0acc8['query'][_0xcadf('0x18')]);_0x2fa20[_0xcadf('0x16')]=qs['offset'](_0xf0acc8[_0xcadf('0x26')][_0xcadf('0x16')]);}_0x2fa20[_0xcadf('0x43')]=qs[_0xcadf('0x44')](_0xf0acc8['query']['sort']);_0x2fa20[_0xcadf('0x45')]=qs[_0xcadf('0x2d')](_[_0xcadf('0x46')](_0xf0acc8[_0xcadf('0x26')],_0x7a6962[_0xcadf('0x2d')]));_0x2fa20[_0xcadf('0x45')][_0xcadf('0x47')]=_0x33eba5['id'];if(_0xf0acc8['query'][_0xcadf('0x48')]){_0x2fa20[_0xcadf('0x45')]=_[_0xcadf('0x34')](_0x2fa20[_0xcadf('0x45')],{'$or':_[_0xcadf('0x20')](_0x2fa20[_0xcadf('0x2e')],function(_0x521e31){var _0x184266={};_0x184266[_0x521e31]={'$like':'%'+_0xf0acc8['query'][_0xcadf('0x48')]+'%'};return _0x184266;})});}if(_0xf0acc8['query']['$gte']){var _0x35b4e2=_0xf0acc8[_0xcadf('0x26')][_0xcadf('0x49')][_0xcadf('0x4a')](',');var _0x40da1b={};_0x40da1b[_0x35b4e2[0x0]]={'$gte':moment(_0x35b4e2[0x1])['format'](_0xcadf('0x4b'))};_0x2fa20[_0xcadf('0x45')]=_[_0xcadf('0x34')](_0x2fa20['where'],_0x40da1b);}_0x2fa20=_['merge']({},_0x2fa20,_0xf0acc8[_0xcadf('0x4c')]);return db[_0xcadf('0x3d')][_0xcadf('0x19')]({'where':_0x2fa20[_0xcadf('0x45')]})[_0xcadf('0x1a')](function(_0x52cf0b){_0x1282e6['count']=_0x52cf0b;if(_0xf0acc8[_0xcadf('0x26')][_0xcadf('0x32')]){_0x2fa20[_0xcadf('0x33')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xcadf('0x24')](_0x2fa20);})['then'](function(_0x10d8e9){_0x1282e6[_0xcadf('0x4d')]=_0x10d8e9;return _0x1282e6;});}})[_0xcadf('0x1a')](respondWithFilteredResult(_0x5bc81a,_0x2fa20))[_0xcadf('0x35')](handleError(_0x5bc81a,null));};exports[_0xcadf('0x4e')]=function(_0x1f1866,_0x272577){return db[_0xcadf('0x2c')]['find']({'where':{'id':_0x1f1866[_0xcadf('0x29')]['id']}})[_0xcadf('0x1a')](handleEntityNotFound(_0x272577,null))[_0xcadf('0x1a')](function(_0x4dc179){if(_0x4dc179){return _0x4dc179[_0xcadf('0x4f')](_0x1f1866[_0xcadf('0x37')][_0xcadf('0x3e')],_['omit'](_0x1f1866[_0xcadf('0x37')],[_0xcadf('0x3e'),'id'])||{})[_0xcadf('0x50')](function(){return db[_0xcadf('0x51')][_0xcadf('0x24')]({'attributes':['id',_0xcadf('0x1d'),_0xcadf('0x52')],'where':{'id':_0x1f1866[_0xcadf('0x37')][_0xcadf('0x3e')]}});})['then'](function(_0x59043f){socket[_0xcadf('0x53')](_0xcadf('0x54'),{'id':Number(_0x1f1866[_0xcadf('0x29')]['id']),'tags':_0x59043f||[]});return{'id':Number(_0x1f1866[_0xcadf('0x29')]['id']),'tags':_0x59043f||[]};});}})[_0xcadf('0x1a')](respondWithResult(_0x272577,null))['catch'](handleError(_0x272577,null));};exports['removeTags']=function(_0x52e928,_0x2d2e4e){return db['OpenchannelInteraction'][_0xcadf('0x39')]({'where':{'id':_0x52e928[_0xcadf('0x29')]['id']}})[_0xcadf('0x1a')](handleEntityNotFound(_0x2d2e4e,null))[_0xcadf('0x1a')](function(_0x4c0e85){if(_0x4c0e85){return _0x4c0e85['removeTags'](_0x52e928[_0xcadf('0x26')][_0xcadf('0x3e')]);}})[_0xcadf('0x1a')](respondWithStatusCode(_0x2d2e4e,null))[_0xcadf('0x35')](handleError(_0x2d2e4e,null));};exports['download']=function(_0xa3c838,_0x47953b){var _0x523be4=moment()['unix']()[_0xcadf('0x55')]();var _0x58bf90=path['join'](config[_0xcadf('0x56')],_0xcadf('0x57'),_0xcadf('0x58'),'tmp');var _0x18cae0=path['join'](config[_0xcadf('0x56')],_0xcadf('0x57'),'files','attachments');var _0x1bc894=path[_0xcadf('0x59')](_0x58bf90,_0x523be4);var _0x3675b2=util[_0xcadf('0x5a')](_0xcadf('0x5b'),_0xa3c838['params']['id'],_0x523be4);var _0x5da63b=path[_0xcadf('0x59')](_0x58bf90,_0x3675b2);var _0xdc371d=[];_0xdc371d[_0xcadf('0x5c')]({'model':db['User'],'as':'User','attributes':['id',_0xcadf('0x5d')],'raw':!![]});_0xdc371d['push']({'model':db[_0xcadf('0x5e')],'as':_0xcadf('0x5f'),'attributes':['id',_0xcadf('0x60'),'lastName'],'raw':!![]});if(_0xa3c838['query'][_0xcadf('0x61')]){_0xdc371d[_0xcadf('0x5c')]({'model':db[_0xcadf('0x62')],'as':_0xcadf('0x62'),'raw':!![]});}var _0x2927b2=[{'model':db[_0xcadf('0x3d')],'as':_0xcadf('0x63'),'attributes':['id',_0xcadf('0x37'),'createdAt',_0xcadf('0x64'),_0xcadf('0x65'),_0xcadf('0x66')],'include':_0xdc371d}];_0x2927b2['push']({'model':db[_0xcadf('0x67')],'as':_0xcadf('0x68'),'attributes':['id',_0xcadf('0x1d')]});_0x2927b2['push']({'model':db[_0xcadf('0x69')],'as':_0xcadf('0x6a'),'attributes':['id',_0xcadf('0x5d')]});return db[_0xcadf('0x2c')][_0xcadf('0x39')]({'where':{'id':_0xa3c838['params']['id']},'include':_0x2927b2})[_0xcadf('0x1a')](handleEntityNotFound(_0x47953b,null))[_0xcadf('0x1a')](function(_0x149650){if(_0x149650){var _0x1aa0c5=_0x149650['get']({'plain':!![]});fs['mkdirSync'](_0x1bc894);var _0xd2993d={'channel':_0xcadf('0x6b'),'account':_0x1aa0c5[_0xcadf('0x68')][_0xcadf('0x1d')],'agent':_0x1aa0c5[_0xcadf('0x6a')]?_0x1aa0c5[_0xcadf('0x6a')]['fullname']:_0xcadf('0x6c'),'createdAt':moment(_0x1aa0c5[_0xcadf('0x6d')])[_0xcadf('0x5a')](_0xcadf('0x4b'))[_0xcadf('0x55')](),'closedAt':_0x1aa0c5[_0xcadf('0x6e')]?moment(_0x1aa0c5['closedAt'])[_0xcadf('0x5a')](_0xcadf('0x4b'))[_0xcadf('0x55')]():'','disposition':_0x1aa0c5[_0xcadf('0x6f')],'visibility':_0x1aa0c5[_0xcadf('0x70')]?_0xcadf('0x71'):_0xcadf('0x72'),'messages':_(_0x1aa0c5['Messages'])[_0xcadf('0x48')]({'secret':![]})[_0xcadf('0x20')](function(_0x5ca5f1){if(_0x5ca5f1[_0xcadf('0x62')]){var _0x35c5fd=path[_0xcadf('0x59')](_0x18cae0,_0x5ca5f1[_0xcadf('0x62')]['basename']);if(fs[_0xcadf('0x73')](_0x35c5fd)){fs['createReadStream'](_0x35c5fd)[_0xcadf('0x74')](fs[_0xcadf('0x75')](path[_0xcadf('0x59')](_0x1bc894,_0x5ca5f1[_0xcadf('0x62')][_0xcadf('0x76')])));}}return{'date':moment(_0x5ca5f1['createdAt'])[_0xcadf('0x5a')](_0xcadf('0x4b'))[_0xcadf('0x55')](),'sender':_0x5ca5f1[_0xcadf('0x64')]===_0xcadf('0x77')?_0x5ca5f1[_0xcadf('0x69')]?_0x5ca5f1['User']['fullname']:_0xcadf('0x78'):_0x5ca5f1[_0xcadf('0x5f')]['firstName']+(_0x5ca5f1[_0xcadf('0x5f')][_0xcadf('0x79')]?'\x20'+_0x5ca5f1[_0xcadf('0x5f')][_0xcadf('0x79')]:''),'body':_0x5ca5f1[_0xcadf('0x62')]?_0x5ca5f1[_0xcadf('0x62')][_0xcadf('0x76')]:_0x5ca5f1[_0xcadf('0x37')],'direction':_0x5ca5f1['direction']===_0xcadf('0x77')?'A':'C','secret':_0x5ca5f1['secret'],'read':_0x5ca5f1['read'],'attachment':_0x5ca5f1[_0xcadf('0x62')]};})[_0xcadf('0x7a')]()};return ejs[_0xcadf('0x7b')](path[_0xcadf('0x59')](config[_0xcadf('0x56')],_0xcadf('0x57'),'views','downloadInteraction.ejs'),{'interaction':_0xd2993d})[_0xcadf('0x1a')](function(_0x44a258){var _0x277446=path[_0xcadf('0x59')](_0x1bc894,_0xcadf('0x7c')+_0x1aa0c5['id']+'-'+_0x523be4+_0xcadf('0x7d'));var _0x356449={'path':_0x277446,'channel':_0xcadf('0x6b'),'interactionId':_0x1aa0c5['id']};return pdf[_0xcadf('0x7e')](_0x44a258,_0x356449);})['then'](function(){return new Promise(function(_0xf960d1,_0x51b93b){zipdir(_0x1bc894,{'saveTo':_0x5da63b},function(_0x5c020f,_0x3ee112){if(_0x5c020f)return _0x51b93b(_0x5c020f);return _0xf960d1(_0x3ee112);});})[_0xcadf('0x1a')](function(){return new Promise(function(_0x2948e1,_0x32b0f9){rimraf(_0x1bc894,function(_0xb65971){if(_0xb65971)_0x32b0f9(_0xb65971);return _0x2948e1();});});})[_0xcadf('0x1a')](function(){return _0x47953b[_0xcadf('0x7f')](_0x5da63b,_0x3675b2,function(_0x196bfb){if(_0x196bfb){logger['error'](_0xcadf('0x80'),_0x196bfb);}else{fs['unlinkSync'](_0x5da63b);}});});});}else{return _0x47953b[_0xcadf('0x12')](0xc8);}})[_0xcadf('0x35')](handleError(_0x47953b,null));}; \ No newline at end of file +var _0xc124=['catch','show','query','from','params','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','create','body','update','destroy','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','attachments','join','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Openchannel','Account','Owner','N.A.','createdAt','closed','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','sendStatus','rimraf','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','end','status','json','offset','undefined','limit','count','set','Content-Range','then','error','name','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','user'];(function(_0x130976,_0x137060){var _0x1d110a=function(_0x16b4d7){while(--_0x16b4d7){_0x130976['push'](_0x130976['shift']());}};_0x1d110a(++_0x137060);}(_0xc124,0x1e3));var _0x4c12=function(_0x2f608b,_0x23c090){_0x2f608b=_0x2f608b-0x0;var _0x48c492=_0xc124[_0x2f608b];return _0x48c492;};'use strict';var rimraf=require(_0x4c12('0x0'));var zipdir=require('zip-dir');var moment=require(_0x4c12('0x1'));var util=require(_0x4c12('0x2'));var path=require('path');var ejs=require(_0x4c12('0x3'));var fs=require('fs');var _=require(_0x4c12('0x4'));var Redis=require(_0x4c12('0x5'));var interaction=require(_0x4c12('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x4c12('0x7'));var logger=require(_0x4c12('0x8'))('api');var config=require(_0x4c12('0x9'));var db=require(_0x4c12('0xa'))['db'];config['redis']=_['defaults'](config[_0x4c12('0xb')],{'host':_0x4c12('0xc'),'port':0x18eb});var socket=require(_0x4c12('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x211c7c,_0x3cb98f){_0x3cb98f=_0x3cb98f||0xcc;return function(_0x3693fb){if(_0x3693fb){return _0x211c7c['sendStatus'](_0x3cb98f);}return _0x211c7c['status'](_0x3cb98f)[_0x4c12('0xe')]();};}function respondWithResult(_0x5d45cd,_0x599498){_0x599498=_0x599498||0xc8;return function(_0x24fbe5){if(_0x24fbe5){return _0x5d45cd[_0x4c12('0xf')](_0x599498)[_0x4c12('0x10')](_0x24fbe5);}};}function respondWithFilteredResult(_0x560055,_0x149af5){return function(_0x56f251){if(_0x56f251){var _0x105c0d=typeof _0x149af5[_0x4c12('0x11')]===_0x4c12('0x12')&&typeof _0x149af5[_0x4c12('0x13')]===_0x4c12('0x12');var _0x43a8ef=_0x56f251[_0x4c12('0x14')];var _0x20f30f=_0x105c0d?0x0:_0x149af5['offset'];var _0x124d71=_0x105c0d?_0x56f251[_0x4c12('0x14')]:_0x149af5[_0x4c12('0x11')]+_0x149af5['limit'];var _0x300dd1;if(_0x124d71>=_0x43a8ef){_0x124d71=_0x43a8ef;_0x300dd1=0xc8;}else{_0x300dd1=0xce;}_0x560055[_0x4c12('0xf')](_0x300dd1);return _0x560055[_0x4c12('0x15')](_0x4c12('0x16'),_0x20f30f+'-'+_0x124d71+'/'+_0x43a8ef)[_0x4c12('0x10')](_0x56f251);}return null;};}function saveUpdates(_0x25be5e){return function(_0x10a9c5){if(_0x10a9c5){return _0x10a9c5['update'](_0x25be5e)[_0x4c12('0x17')](function(_0x458cfd){return _0x458cfd;});}return null;};}function removeEntity(_0xf65391){return function(_0x33d9b6){if(_0x33d9b6){return _0x33d9b6['destroy']()[_0x4c12('0x17')](function(){_0xf65391[_0x4c12('0xf')](0xcc)[_0x4c12('0xe')]();});}};}function handleEntityNotFound(_0x536558){return function(_0x5ecab0){if(!_0x5ecab0){_0x536558['sendStatus'](0x194);}return _0x5ecab0;};}function handleError(_0x4aba42,_0x2a30b5){_0x2a30b5=_0x2a30b5||0x1f4;return function(_0x5c2d79){logger[_0x4c12('0x18')](_0x5c2d79['stack']);if(_0x5c2d79[_0x4c12('0x19')]){delete _0x5c2d79[_0x4c12('0x19')];}_0x4aba42[_0x4c12('0xf')](_0x2a30b5)['send'](_0x5c2d79);};}exports[_0x4c12('0x1a')]=function(_0x225716,_0x2308a0){var _0x38c2af={};var _0x35571f=_[_0x4c12('0x1b')](db[_0x4c12('0x1c')][_0x4c12('0x1d')],function(_0x4a5c62){return{'name':_0x4a5c62[_0x4c12('0x1e')],'type':_0x4a5c62[_0x4c12('0x1f')][_0x4c12('0x20')]};});_0x38c2af=qs[_0x4c12('0x21')](_0x35571f,_0x225716);return interaction[_0x4c12('0x22')](_0x4c12('0x23'),_0x225716['query'],_0x225716[_0x4c12('0x24')],_0x38c2af,_0x35571f)[_0x4c12('0x17')](respondWithFilteredResult(_0x2308a0,_0x38c2af))[_0x4c12('0x25')](handleError(_0x2308a0,null));};exports[_0x4c12('0x26')]=function(_0x5d9f6c,_0x2cddfe){var _0x41110c={};if(_0x5d9f6c[_0x4c12('0x27')][_0x4c12('0x1f')]&&_0x5d9f6c[_0x4c12('0x27')][_0x4c12('0x1f')]==='from'){_0x41110c[_0x4c12('0x28')]=_0x5d9f6c[_0x4c12('0x29')]['id'];}else{_0x41110c['id']=_0x5d9f6c[_0x4c12('0x29')]['id'];}var _0x559a24={'raw':![],'where':_0x41110c},_0x29d709={};_0x29d709['model']=_[_0x4c12('0x2a')](db['OpenchannelInteraction'][_0x4c12('0x1d')]);_0x29d709[_0x4c12('0x27')]=_[_0x4c12('0x2a')](_0x5d9f6c['query']);_0x29d709[_0x4c12('0x2b')]=_[_0x4c12('0x2c')](_0x29d709[_0x4c12('0x2d')],_0x29d709['query']);_0x559a24['attributes']=_[_0x4c12('0x2c')](_0x29d709['model'],qs[_0x4c12('0x2e')](_0x5d9f6c[_0x4c12('0x27')]['fields']));_0x559a24[_0x4c12('0x2f')]=_0x559a24['attributes'][_0x4c12('0x30')]?_0x559a24[_0x4c12('0x2f')]:_0x29d709['model'];if(_0x5d9f6c['query'][_0x4c12('0x31')]){_0x559a24[_0x4c12('0x32')]=[{'all':!![]}];}_0x559a24=_[_0x4c12('0x33')]({},_0x559a24,_0x5d9f6c[_0x4c12('0x34')]);return db[_0x4c12('0x1c')][_0x4c12('0x35')](_0x559a24)[_0x4c12('0x17')](handleEntityNotFound(_0x2cddfe,null))['then'](respondWithResult(_0x2cddfe,null))[_0x4c12('0x25')](handleError(_0x2cddfe,null));};exports[_0x4c12('0x36')]=function(_0x56d075,_0x3237d8){return db[_0x4c12('0x1c')][_0x4c12('0x36')](_0x56d075[_0x4c12('0x37')],{})[_0x4c12('0x17')](respondWithResult(_0x3237d8,0xc9))[_0x4c12('0x25')](handleError(_0x3237d8,null));};exports[_0x4c12('0x38')]=function(_0x31f6af,_0x228d37){if(_0x31f6af['body']['id']){delete _0x31f6af['body']['id'];}return db[_0x4c12('0x1c')][_0x4c12('0x35')]({'where':{'id':_0x31f6af[_0x4c12('0x29')]['id']}})['then'](handleEntityNotFound(_0x228d37,null))[_0x4c12('0x17')](saveUpdates(_0x31f6af[_0x4c12('0x37')],null))[_0x4c12('0x17')](respondWithResult(_0x228d37,null))['catch'](handleError(_0x228d37,null));};exports[_0x4c12('0x39')]=function(_0x55195b,_0x12c897){return db[_0x4c12('0x1c')]['find']({'where':{'id':_0x55195b[_0x4c12('0x29')]['id']}})['then'](handleEntityNotFound(_0x12c897,null))[_0x4c12('0x17')](removeEntity(_0x12c897,null))['catch'](handleError(_0x12c897,null));};exports[_0x4c12('0x3a')]=function(_0x200a17,_0xed9105){return db[_0x4c12('0x1c')][_0x4c12('0x3a')]()['then'](respondWithResult(_0xed9105,null))[_0x4c12('0x25')](handleError(_0xed9105,null));};exports[_0x4c12('0x3b')]=function(_0x2e781a,_0x4634c5){return db[_0x4c12('0x3c')]['find']({'where':{'id':_0x2e781a[_0x4c12('0x29')]['id']}})[_0x4c12('0x17')](handleEntityNotFound(_0x4634c5,null))['then'](function(_0x261289){if(_0x261289){return _0x261289[_0x4c12('0x3b')](_0x2e781a[_0x4c12('0x37')]['ids'],_[_0x4c12('0x3d')](_0x2e781a['body'],[_0x4c12('0x3e'),'id'])||{});}})[_0x4c12('0x17')](respondWithResult(_0x4634c5,null))['catch'](handleError(_0x4634c5,null));};exports[_0x4c12('0x3f')]=function(_0x440dfa,_0x12d1eb){var _0xe402d4={'raw':![],'where':{}};var _0x11ca6f={};var _0x164e95={'count':0x0,'rows':[]};return db[_0x4c12('0x1c')][_0x4c12('0x40')]({'where':{'id':_0x440dfa['params']['id']}})[_0x4c12('0x17')](handleEntityNotFound(_0x12d1eb,null))['then'](function(_0x5cb193){if(_0x5cb193){_0x11ca6f[_0x4c12('0x2d')]=_[_0x4c12('0x2a')](db[_0x4c12('0x3c')][_0x4c12('0x1d')]);_0x11ca6f[_0x4c12('0x27')]=_[_0x4c12('0x2a')](_0x440dfa[_0x4c12('0x27')]);_0x11ca6f[_0x4c12('0x2b')]=_['intersection'](_0x11ca6f[_0x4c12('0x2d')],_0x11ca6f['query']);_0xe402d4[_0x4c12('0x2f')]=_[_0x4c12('0x2c')](_0x11ca6f[_0x4c12('0x2d')],qs[_0x4c12('0x2e')](_0x440dfa[_0x4c12('0x27')][_0x4c12('0x2e')]));_0xe402d4[_0x4c12('0x2f')]=_0xe402d4[_0x4c12('0x2f')]['length']?_0xe402d4[_0x4c12('0x2f')]:_0x11ca6f[_0x4c12('0x2d')];if(!_0x440dfa[_0x4c12('0x27')][_0x4c12('0x41')](_0x4c12('0x42'))){_0xe402d4[_0x4c12('0x13')]=qs[_0x4c12('0x13')](_0x440dfa[_0x4c12('0x27')][_0x4c12('0x13')]);_0xe402d4['offset']=qs['offset'](_0x440dfa[_0x4c12('0x27')][_0x4c12('0x11')]);}_0xe402d4[_0x4c12('0x43')]=qs[_0x4c12('0x44')](_0x440dfa[_0x4c12('0x27')][_0x4c12('0x44')]);_0xe402d4[_0x4c12('0x45')]=qs[_0x4c12('0x2b')](_[_0x4c12('0x46')](_0x440dfa[_0x4c12('0x27')],_0x11ca6f[_0x4c12('0x2b')]));_0xe402d4['where'][_0x4c12('0x47')]=_0x5cb193['id'];if(_0x440dfa['query'][_0x4c12('0x48')]){_0xe402d4['where']=_[_0x4c12('0x33')](_0xe402d4[_0x4c12('0x45')],{'$or':_[_0x4c12('0x1b')](_0xe402d4[_0x4c12('0x2f')],function(_0x568b13){var _0x16f280={};_0x16f280[_0x568b13]={'$like':'%'+_0x440dfa['query']['filter']+'%'};return _0x16f280;})});}if(_0x440dfa[_0x4c12('0x27')]['$gte']){var _0x11b535=_0x440dfa[_0x4c12('0x27')][_0x4c12('0x49')][_0x4c12('0x4a')](',');var _0x4e948f={};_0x4e948f[_0x11b535[0x0]]={'$gte':moment(_0x11b535[0x1])[_0x4c12('0x4b')](_0x4c12('0x4c'))};_0xe402d4[_0x4c12('0x45')]=_[_0x4c12('0x33')](_0xe402d4['where'],_0x4e948f);}_0xe402d4=_[_0x4c12('0x33')]({},_0xe402d4,_0x440dfa[_0x4c12('0x34')]);return db[_0x4c12('0x3c')][_0x4c12('0x14')]({'where':_0xe402d4['where']})[_0x4c12('0x17')](function(_0x12afb2){_0x164e95[_0x4c12('0x14')]=_0x12afb2;if(_0x440dfa[_0x4c12('0x27')][_0x4c12('0x31')]){_0xe402d4[_0x4c12('0x32')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0xe402d4);})[_0x4c12('0x17')](function(_0x44ba3c){_0x164e95['rows']=_0x44ba3c;return _0x164e95;});}})[_0x4c12('0x17')](respondWithFilteredResult(_0x12d1eb,_0xe402d4))[_0x4c12('0x25')](handleError(_0x12d1eb,null));};exports[_0x4c12('0x4d')]=function(_0xc6edd4,_0x43cc69){return db[_0x4c12('0x1c')]['find']({'where':{'id':_0xc6edd4[_0x4c12('0x29')]['id']}})[_0x4c12('0x17')](handleEntityNotFound(_0x43cc69,null))[_0x4c12('0x17')](function(_0x5702f8){if(_0x5702f8){return _0x5702f8[_0x4c12('0x4e')](_0xc6edd4['body'][_0x4c12('0x3e')],_[_0x4c12('0x3d')](_0xc6edd4[_0x4c12('0x37')],[_0x4c12('0x3e'),'id'])||{})[_0x4c12('0x4f')](function(){return db[_0x4c12('0x50')]['findAll']({'attributes':['id',_0x4c12('0x19'),'color'],'where':{'id':_0xc6edd4['body']['ids']}});})['then'](function(_0x56c418){socket[_0x4c12('0x51')](_0x4c12('0x52'),{'id':Number(_0xc6edd4[_0x4c12('0x29')]['id']),'tags':_0x56c418||[]});return{'id':Number(_0xc6edd4[_0x4c12('0x29')]['id']),'tags':_0x56c418||[]};});}})[_0x4c12('0x17')](respondWithResult(_0x43cc69,null))['catch'](handleError(_0x43cc69,null));};exports[_0x4c12('0x53')]=function(_0x50d980,_0x1fb522){return db[_0x4c12('0x1c')][_0x4c12('0x35')]({'where':{'id':_0x50d980[_0x4c12('0x29')]['id']}})[_0x4c12('0x17')](handleEntityNotFound(_0x1fb522,null))['then'](function(_0x1eb71c){if(_0x1eb71c){return _0x1eb71c[_0x4c12('0x53')](_0x50d980[_0x4c12('0x27')][_0x4c12('0x3e')]);}})[_0x4c12('0x17')](respondWithStatusCode(_0x1fb522,null))['catch'](handleError(_0x1fb522,null));};exports[_0x4c12('0x54')]=function(_0x29c4ae,_0x3ebb8c){var _0x5737c0=moment()[_0x4c12('0x55')]()[_0x4c12('0x56')]();var _0xefe2a=path['join'](config[_0x4c12('0x57')],_0x4c12('0x58'),_0x4c12('0x59'),_0x4c12('0x5a'));var _0x18aea5=path['join'](config['root'],_0x4c12('0x58'),_0x4c12('0x59'),_0x4c12('0x5b'));var _0x598e3f=path[_0x4c12('0x5c')](_0xefe2a,_0x5737c0);var _0x4ef2a3=util[_0x4c12('0x4b')]('transcript-%d-%s.zip',_0x29c4ae[_0x4c12('0x29')]['id'],_0x5737c0);var _0x13906e=path[_0x4c12('0x5c')](_0xefe2a,_0x4ef2a3);var _0x2e87d2=[];_0x2e87d2[_0x4c12('0x5d')]({'model':db[_0x4c12('0x5e')],'as':_0x4c12('0x5e'),'attributes':['id',_0x4c12('0x5f')],'raw':!![]});_0x2e87d2['push']({'model':db[_0x4c12('0x60')],'as':_0x4c12('0x61'),'attributes':['id',_0x4c12('0x62'),_0x4c12('0x63')],'raw':!![]});if(_0x29c4ae[_0x4c12('0x27')][_0x4c12('0x5b')]){_0x2e87d2[_0x4c12('0x5d')]({'model':db[_0x4c12('0x64')],'as':'Attachment','raw':!![]});}var _0x3aa2cd=[{'model':db[_0x4c12('0x3c')],'as':_0x4c12('0x65'),'attributes':['id',_0x4c12('0x37'),'createdAt',_0x4c12('0x66'),_0x4c12('0x67'),_0x4c12('0x68')],'include':_0x2e87d2}];_0x3aa2cd[_0x4c12('0x5d')]({'model':db[_0x4c12('0x69')],'as':'Account','attributes':['id',_0x4c12('0x19')]});_0x3aa2cd['push']({'model':db[_0x4c12('0x5e')],'as':'Owner','attributes':['id',_0x4c12('0x5f')]});return db[_0x4c12('0x1c')][_0x4c12('0x35')]({'where':{'id':_0x29c4ae[_0x4c12('0x29')]['id']},'include':_0x3aa2cd})['then'](handleEntityNotFound(_0x3ebb8c,null))[_0x4c12('0x17')](function(_0x20f0fc){if(_0x20f0fc){var _0x1a6a3f=_0x20f0fc['get']({'plain':!![]});fs['mkdirSync'](_0x598e3f);var _0x1e33e9={'channel':_0x4c12('0x6a'),'account':_0x1a6a3f[_0x4c12('0x6b')]['name'],'agent':_0x1a6a3f[_0x4c12('0x6c')]?_0x1a6a3f[_0x4c12('0x6c')][_0x4c12('0x5f')]:_0x4c12('0x6d'),'createdAt':moment(_0x1a6a3f[_0x4c12('0x6e')])['format'](_0x4c12('0x4c'))[_0x4c12('0x56')](),'closedAt':_0x1a6a3f[_0x4c12('0x6f')]?moment(_0x1a6a3f[_0x4c12('0x70')])[_0x4c12('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4c12('0x56')]():'','disposition':_0x1a6a3f[_0x4c12('0x71')],'visibility':_0x1a6a3f[_0x4c12('0x72')]?_0x4c12('0x73'):'Private','messages':_(_0x1a6a3f['Messages'])[_0x4c12('0x48')]({'secret':![]})[_0x4c12('0x1b')](function(_0x1e9331){if(_0x1e9331['Attachment']){var _0x3f5707=path['join'](_0x18aea5,_0x1e9331[_0x4c12('0x64')][_0x4c12('0x74')]);if(fs[_0x4c12('0x75')](_0x3f5707)){fs[_0x4c12('0x76')](_0x3f5707)['pipe'](fs[_0x4c12('0x77')](path[_0x4c12('0x5c')](_0x598e3f,_0x1e9331[_0x4c12('0x64')][_0x4c12('0x74')])));}}return{'date':moment(_0x1e9331[_0x4c12('0x6e')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1e9331[_0x4c12('0x66')]===_0x4c12('0x78')?_0x1e9331[_0x4c12('0x5e')]?_0x1e9331[_0x4c12('0x5e')][_0x4c12('0x5f')]:_0x4c12('0x79'):_0x1e9331['Contact'][_0x4c12('0x62')]+(_0x1e9331[_0x4c12('0x61')][_0x4c12('0x63')]?'\x20'+_0x1e9331[_0x4c12('0x61')][_0x4c12('0x63')]:''),'body':_0x1e9331['Attachment']?_0x1e9331[_0x4c12('0x64')][_0x4c12('0x74')]:_0x1e9331[_0x4c12('0x37')],'direction':_0x1e9331[_0x4c12('0x66')]===_0x4c12('0x78')?'A':'C','secret':_0x1e9331[_0x4c12('0x67')],'read':_0x1e9331[_0x4c12('0x68')],'attachment':_0x1e9331[_0x4c12('0x64')]};})['value']()};return ejs[_0x4c12('0x7a')](path[_0x4c12('0x5c')](config[_0x4c12('0x57')],'server',_0x4c12('0x7b'),_0x4c12('0x7c')),{'interaction':_0x1e33e9})[_0x4c12('0x17')](function(_0x44423a){var _0x54ce68=path[_0x4c12('0x5c')](_0x598e3f,_0x4c12('0x7d')+_0x1a6a3f['id']+'-'+_0x5737c0+_0x4c12('0x7e'));var _0x3484c7={'path':_0x54ce68,'channel':_0x4c12('0x6a'),'interactionId':_0x1a6a3f['id']};return pdf[_0x4c12('0x7f')](_0x44423a,_0x3484c7);})['then'](function(){return new Promise(function(_0x36caca,_0x1e1ac9){zipdir(_0x598e3f,{'saveTo':_0x13906e},function(_0x4f6b42,_0x2ddde9){if(_0x4f6b42)return _0x1e1ac9(_0x4f6b42);return _0x36caca(_0x2ddde9);});})[_0x4c12('0x17')](function(){return new Promise(function(_0x14822d,_0x3f9633){rimraf(_0x598e3f,function(_0x404a1f){if(_0x404a1f)_0x3f9633(_0x404a1f);return _0x14822d();});});})['then'](function(){return _0x3ebb8c['download'](_0x13906e,_0x4ef2a3,function(_0x36b7e3){if(_0x36b7e3){logger[_0x4c12('0x18')](_0x4c12('0x80'),_0x36b7e3);}else{fs['unlinkSync'](_0x13906e);}});});});}else{return _0x3ebb8c[_0x4c12('0x81')](0xc8);}})[_0x4c12('0x25')](handleError(_0x3ebb8c,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e22f5f6..71fc9dd 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 _0x0d0d=['hook','events','OpenchannelInteraction','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch'];(function(_0x4925d0,_0x2e3683){var _0x936f8a=function(_0x46d2cb){while(--_0x46d2cb){_0x4925d0['push'](_0x4925d0['shift']());}};_0x936f8a(++_0x2e3683);}(_0x0d0d,0x171));var _0xd0d0=function(_0x32f7ac,_0x1d3170){_0x32f7ac=_0x32f7ac-0x0;var _0x4727c3=_0x0d0d[_0x32f7ac];return _0x4727c3;};'use strict';var EventEmitter=require(_0xd0d0('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xd0d0('0x1')];var OpenchannelMessage=require(_0xd0d0('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd0d0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd0d0('0x4'),'afterDestroy':_0xd0d0('0x5')};function emitEvent(_0x19849b){return function(_0x1be549,_0x116809,_0x70463b){_0x1be549[_0xd0d0('0x6')]({'attributes':['id'],'raw':!![]})[_0xd0d0('0x7')](function(_0x30ef40){_0x1be549[_0xd0d0('0x8')]('Users',_0x30ef40[_0xd0d0('0x9')](function(_0x273fcc){return{'id':_0x273fcc['id']};}));return OpenchannelMessage[_0xd0d0('0xa')]({'where':{'OpenchannelInteractionId':_0x1be549['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd0d0('0x7')](function(_0x57b153){_0x1be549[_0xd0d0('0x8')](_0xd0d0('0xb'),_0x57b153[_0xd0d0('0xc')]);OpenchannelInteractionEvents[_0xd0d0('0xd')](_0x19849b+':'+_0x1be549['id'],_0x1be549);OpenchannelInteractionEvents[_0xd0d0('0xd')](_0x19849b,_0x1be549);_0x70463b(null);})[_0xd0d0('0xe')](_0x70463b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xd0d0('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xbc2f=['OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0xbc2f,0x1a0));var _0xfbc2=function(_0x1036e7,_0x32fc34){_0x1036e7=_0x1036e7-0x0;var _0x156760=_0xbc2f[_0x1036e7];return _0x156760;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xfbc2('0x0'))['db'][_0xfbc2('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xfbc2('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xfbc2('0x3')](0x0);var events={'afterCreate':_0xfbc2('0x4'),'afterUpdate':_0xfbc2('0x5'),'afterDestroy':_0xfbc2('0x6')};function emitEvent(_0x34223a){return function(_0xccae2b,_0x25b5ec,_0x1d2d88){_0xccae2b['getUsers']({'attributes':['id'],'raw':!![]})[_0xfbc2('0x7')](function(_0x512a5a){_0xccae2b[_0xfbc2('0x8')](_0xfbc2('0x9'),_0x512a5a[_0xfbc2('0xa')](function(_0xbd976c){return{'id':_0xbd976c['id']};}));return OpenchannelMessage[_0xfbc2('0xb')]({'where':{'OpenchannelInteractionId':_0xccae2b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5baa95){_0xccae2b[_0xfbc2('0x8')](_0xfbc2('0xc'),_0x5baa95[_0xfbc2('0xd')]);OpenchannelInteractionEvents[_0xfbc2('0xe')](_0x34223a+':'+_0xccae2b['id'],_0xccae2b);OpenchannelInteractionEvents[_0xfbc2('0xe')](_0x34223a,_0xccae2b);_0x1d2d88(null);})[_0xfbc2('0xf')](_0x1d2d88(null));};}for(var e in events){if(events[_0xfbc2('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xfbc2('0x11')](e,emitEvent(event));}}module[_0xfbc2('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 1610bab..6eddd69 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 _0x16dc=['bluebird','rimraf','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','lodash','util','../../config/logger','api','moment'];(function(_0x1a3bf3,_0x30e0b4){var _0x234602=function(_0x28f0d0){while(--_0x28f0d0){_0x1a3bf3['push'](_0x1a3bf3['shift']());}};_0x234602(++_0x30e0b4);}(_0x16dc,0x113));var _0xc16d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16dc[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc16d('0x0'));var util=require(_0xc16d('0x1'));var logger=require(_0xc16d('0x2'))(_0xc16d('0x3'));var moment=require(_0xc16d('0x4'));var BPromise=require(_0xc16d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc16d('0x6'));var config=require('../../config/environment');var attributes=require(_0xc16d('0x7'));module['exports']=function(_0x5b0e83,_0x1ad2fd){return _0x5b0e83[_0xc16d('0x8')](_0xc16d('0x9'),attributes,{'tableName':_0xc16d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc16d('0xb'),'hooks':{'beforeUpdate':function(_0x85da1,_0x3928fa,_0x1ed345){if(_0x85da1[_0xc16d('0xc')](_0xc16d('0xd'))){_0x85da1['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1ed345(null,_0x85da1);}}});}; \ No newline at end of file +var _0x64b5=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x397c80,_0x3f9b05){var _0x4c822e=function(_0x4095ed){while(--_0x4095ed){_0x397c80['push'](_0x397c80['shift']());}};_0x4c822e(++_0x3f9b05);}(_0x64b5,0x168));var _0x564b=function(_0x52c4e7,_0x22b847){_0x52c4e7=_0x52c4e7-0x0;var _0x506c49=_0x64b5[_0x52c4e7];return _0x506c49;};'use strict';var _=require(_0x564b('0x0'));var util=require(_0x564b('0x1'));var logger=require(_0x564b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x564b('0x3'));var rp=require(_0x564b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x564b('0x5'));var config=require(_0x564b('0x6'));var attributes=require(_0x564b('0x7'));module['exports']=function(_0x30e31f,_0x400c66){return _0x30e31f[_0x564b('0x8')]('OpenchannelInteraction',attributes,{'tableName':_0x564b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x51dc1b,_0x50185a,_0x238671){if(_0x51dc1b[_0x564b('0xa')](_0x564b('0xb'))){_0x51dc1b[_0x564b('0xc')]=moment()[_0x564b('0xd')](_0x564b('0xe'));}_0x238671(null,_0x51dc1b);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index aad942c..782d876 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 _0x5100=['options','limit','catch','find','where','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body'];(function(_0x67ad7,_0x35567e){var _0x50dab2=function(_0x59c2e3){while(--_0x59c2e3){_0x67ad7['push'](_0x67ad7['shift']());}};_0x50dab2(++_0x35567e);}(_0x5100,0xac));var _0x0510=function(_0xf46a96,_0xc6539){_0xf46a96=_0xf46a96-0x0;var _0x464aad=_0x5100[_0xf46a96];return _0x464aad;};'use strict';var _=require(_0x0510('0x0'));var util=require(_0x0510('0x1'));var moment=require(_0x0510('0x2'));var BPromise=require(_0x0510('0x3'));var rs=require(_0x0510('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0510('0x5'))['db'];var utils=require(_0x0510('0x6'));var logger=require(_0x0510('0x7'))(_0x0510('0x8'));var config=require(_0x0510('0x9'));var jayson=require(_0x0510('0xa'));var client=jayson[_0x0510('0xb')][_0x0510('0xc')]({'port':0x232a});config[_0x0510('0xd')]=_[_0x0510('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0510('0xf'))(new Redis(config[_0x0510('0xd')]));require(_0x0510('0x10'))[_0x0510('0x11')](socket);function respondWithRpcPromise(_0x2eefcd,_0xee3553,_0xcc006a){return new BPromise(function(_0x2f09b2,_0x3c627c){return client['request'](_0x2eefcd,_0xcc006a)[_0x0510('0x12')](function(_0x370e2c){logger[_0x0510('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0xee3553,_0x0510('0x14'));logger[_0x0510('0x15')](_0x0510('0x16'),_0xee3553,_0x0510('0x14'),JSON[_0x0510('0x17')](_0x370e2c));if(_0x370e2c[_0x0510('0x18')]){if(_0x370e2c[_0x0510('0x18')][_0x0510('0x19')]===0x1f4){logger[_0x0510('0x18')](_0x0510('0x1a'),_0xee3553,_0x370e2c[_0x0510('0x18')][_0x0510('0x1b')]);return _0x3c627c(_0x370e2c[_0x0510('0x18')][_0x0510('0x1b')]);}logger[_0x0510('0x18')](_0x0510('0x1a'),_0xee3553,_0x370e2c[_0x0510('0x18')][_0x0510('0x1b')]);return _0x2f09b2(_0x370e2c[_0x0510('0x18')]['message']);}else{logger[_0x0510('0x13')](_0x0510('0x1a'),_0xee3553,_0x0510('0x14'));_0x2f09b2(_0x370e2c[_0x0510('0x1c')][_0x0510('0x1b')]);}})['catch'](function(_0x2ae922){logger[_0x0510('0x18')](_0x0510('0x1a'),_0xee3553,_0x2ae922);_0x3c627c(_0x2ae922);});});}exports[_0x0510('0x1d')]=function(_0x3db72f){var _0xfca31c=this;return new Promise(function(_0x21ef2a,_0x3e0861){return db[_0x0510('0x1e')][_0x0510('0x1f')](_0x3db72f[_0x0510('0x20')],{'raw':_0x3db72f[_0x0510('0x21')]?_0x3db72f[_0x0510('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3db72f[_0x0510('0x21')]?_0x3db72f[_0x0510('0x21')]['where']||null:null,'attributes':_0x3db72f[_0x0510('0x21')]?_0x3db72f[_0x0510('0x21')]['attributes']||null:null,'limit':_0x3db72f[_0x0510('0x21')]?_0x3db72f[_0x0510('0x21')][_0x0510('0x22')]||null:null})[_0x0510('0x12')](function(_0x5990b0){logger['info']('UpdateOpenchannelInteraction',_0x3db72f);logger[_0x0510('0x15')](_0x0510('0x1d'),_0x3db72f,JSON[_0x0510('0x17')](_0x5990b0));_0x21ef2a(_0x5990b0);})[_0x0510('0x23')](function(_0x3d2602){logger[_0x0510('0x18')](_0x0510('0x1d'),_0x3d2602['message'],_0x3db72f);_0x3e0861(_0xfca31c[_0x0510('0x18')](0x1f4,_0x3d2602['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x473739){return new Promise(function(_0x3e3683,_0x5f16b4){return db['OpenchannelInteraction'][_0x0510('0x24')]({'where':_0x473739[_0x0510('0x21')]?_0x473739[_0x0510('0x21')][_0x0510('0x25')]||null:null})[_0x0510('0x12')](function(_0x3a39d3){if(_0x3a39d3){return _0x3a39d3['addTags'](_0x473739[_0x0510('0x20')][_0x0510('0x26')],_[_0x0510('0x27')](_0x473739[_0x0510('0x20')],[_0x0510('0x26'),'id'])||{});}})['spread'](function(_0x18c917){logger['info'](_0x0510('0x28'),_0x473739);logger[_0x0510('0x15')](_0x0510('0x28'),_0x473739,JSON[_0x0510('0x17')](_0x18c917));_0x3e3683(_0x18c917);})[_0x0510('0x23')](function(_0x4f16df){logger[_0x0510('0x18')](_0x0510('0x28'),_0x4f16df[_0x0510('0x1b')],_0x473739);_0x5f16b4(_this[_0x0510('0x18')](0x1f4,_0x4f16df[_0x0510('0x1b')]));});});}; \ No newline at end of file +var _0x0f55=['request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','raw','options','where','limit','then','AddTagsToOpenchannelInteraction','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','info'];(function(_0x59a3dd,_0xad48e3){var _0x18aec7=function(_0xdfb2e1){while(--_0xdfb2e1){_0x59a3dd['push'](_0x59a3dd['shift']());}};_0x18aec7(++_0xad48e3);}(_0x0f55,0xbc));var _0x50f5=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x0f55[_0x4d7a61];return _0x186f73;};'use strict';var _=require(_0x50f5('0x0'));var util=require(_0x50f5('0x1'));var moment=require(_0x50f5('0x2'));var BPromise=require('bluebird');var rs=require(_0x50f5('0x3'));var fs=require('fs');var Redis=require(_0x50f5('0x4'));var db=require(_0x50f5('0x5'))['db'];var utils=require(_0x50f5('0x6'));var logger=require(_0x50f5('0x7'))('rpc');var config=require(_0x50f5('0x8'));var jayson=require(_0x50f5('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x50f5('0xa')]=_[_0x50f5('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x50f5('0xc'))(new Redis(config[_0x50f5('0xa')]));require(_0x50f5('0xd'))[_0x50f5('0xe')](socket);function respondWithRpcPromise(_0x28e5a2,_0xd2420e,_0x43a430){return new BPromise(function(_0x204be9,_0x529449){return client[_0x50f5('0xf')](_0x28e5a2,_0x43a430)['then'](function(_0x1ad0e2){logger[_0x50f5('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0xd2420e,_0x50f5('0x11'));logger[_0x50f5('0x12')](_0x50f5('0x13'),_0xd2420e,_0x50f5('0x11'),JSON[_0x50f5('0x14')](_0x1ad0e2));if(_0x1ad0e2[_0x50f5('0x15')]){if(_0x1ad0e2[_0x50f5('0x15')]['code']===0x1f4){logger[_0x50f5('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xd2420e,_0x1ad0e2[_0x50f5('0x15')]['message']);return _0x529449(_0x1ad0e2[_0x50f5('0x15')][_0x50f5('0x16')]);}logger[_0x50f5('0x15')](_0x50f5('0x17'),_0xd2420e,_0x1ad0e2['error'][_0x50f5('0x16')]);return _0x204be9(_0x1ad0e2['error'][_0x50f5('0x16')]);}else{logger[_0x50f5('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0xd2420e,_0x50f5('0x11'));_0x204be9(_0x1ad0e2[_0x50f5('0x18')][_0x50f5('0x16')]);}})[_0x50f5('0x19')](function(_0x54bb41){logger[_0x50f5('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xd2420e,_0x54bb41);_0x529449(_0x54bb41);});});}exports[_0x50f5('0x1a')]=function(_0x4abb65){var _0x40e865=this;return new Promise(function(_0x1afed5,_0x4aa29e){return db[_0x50f5('0x1b')][_0x50f5('0x1c')](_0x4abb65['body'],{'raw':_0x4abb65['options']?_0x4abb65['options'][_0x50f5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4abb65[_0x50f5('0x1e')]?_0x4abb65[_0x50f5('0x1e')][_0x50f5('0x1f')]||null:null,'attributes':_0x4abb65[_0x50f5('0x1e')]?_0x4abb65[_0x50f5('0x1e')]['attributes']||null:null,'limit':_0x4abb65[_0x50f5('0x1e')]?_0x4abb65[_0x50f5('0x1e')][_0x50f5('0x20')]||null:null})[_0x50f5('0x21')](function(_0x525bd0){logger[_0x50f5('0x10')]('UpdateOpenchannelInteraction',_0x4abb65);logger[_0x50f5('0x12')](_0x50f5('0x1a'),_0x4abb65,JSON['stringify'](_0x525bd0));_0x1afed5(_0x525bd0);})[_0x50f5('0x19')](function(_0x56648a){logger[_0x50f5('0x15')](_0x50f5('0x1a'),_0x56648a[_0x50f5('0x16')],_0x4abb65);_0x4aa29e(_0x40e865['error'](0x1f4,_0x56648a['message']));});});};exports[_0x50f5('0x22')]=function(_0x2565b4){return new Promise(function(_0x73cea8,_0x5e4a17){return db[_0x50f5('0x1b')]['find']({'where':_0x2565b4[_0x50f5('0x1e')]?_0x2565b4[_0x50f5('0x1e')][_0x50f5('0x1f')]||null:null})['then'](function(_0x48e224){if(_0x48e224){return _0x48e224[_0x50f5('0x23')](_0x2565b4[_0x50f5('0x24')]['ids'],_[_0x50f5('0x25')](_0x2565b4[_0x50f5('0x24')],[_0x50f5('0x26'),'id'])||{});}})[_0x50f5('0x27')](function(_0x368980){logger['info']('AddTags',_0x2565b4);logger['debug'](_0x50f5('0x28'),_0x2565b4,JSON['stringify'](_0x368980));_0x73cea8(_0x368980);})[_0x50f5('0x19')](function(_0x5207a1){logger['error'](_0x50f5('0x28'),_0x5207a1[_0x50f5('0x16')],_0x2565b4);_0x5e4a17(_this['error'](0x1f4,_0x5207a1[_0x50f5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 786390b..7fa0a10 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 _0x9e48=['openchannelInteraction:','./openchannelInteraction.events','save','remove','emit','removeListener','register','length'];(function(_0x3392d3,_0x345d5e){var _0x17d2a6=function(_0xd58efc){while(--_0xd58efc){_0x3392d3['push'](_0x3392d3['shift']());}};_0x17d2a6(++_0x345d5e);}(_0x9e48,0x179));var _0x89e4=function(_0x28d1c7,_0x20ef51){_0x28d1c7=_0x28d1c7-0x0;var _0x584a72=_0x9e48[_0x28d1c7];return _0x584a72;};'use strict';var OpenchannelInteractionEvents=require(_0x89e4('0x0'));var events=[_0x89e4('0x1'),_0x89e4('0x2'),'update'];function createListener(_0x4ab581,_0x5942b4){return function(_0x2c89bc){_0x5942b4[_0x89e4('0x3')](_0x4ab581,_0x2c89bc);};}function removeListener(_0x1c2a2c,_0x29b660){return function(){OpenchannelInteractionEvents[_0x89e4('0x4')](_0x1c2a2c,_0x29b660);};}exports[_0x89e4('0x5')]=function(_0x161a92){for(var _0x2d5b7e=0x0,_0xaf1cbd=events[_0x89e4('0x6')];_0x2d5b7e<_0xaf1cbd;_0x2d5b7e++){var _0x71623a=events[_0x2d5b7e];var _0x470531=createListener(_0x89e4('0x7')+_0x71623a,_0x161a92);OpenchannelInteractionEvents['on'](_0x71623a,_0x470531);}}; \ No newline at end of file +var _0x19bd=['save','remove','emit','removeListener','register'];(function(_0x17c0fa,_0x3a47d6){var _0x44746d=function(_0x557f0f){while(--_0x557f0f){_0x17c0fa['push'](_0x17c0fa['shift']());}};_0x44746d(++_0x3a47d6);}(_0x19bd,0x1ef));var _0xd19b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x19bd[_0x2dafbe];return _0x58a45a;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xd19b('0x0'),_0xd19b('0x1'),'update'];function createListener(_0x1ad1ce,_0x3fbe29){return function(_0xff1995){_0x3fbe29[_0xd19b('0x2')](_0x1ad1ce,_0xff1995);};}function removeListener(_0x49be9,_0x27f482){return function(){OpenchannelInteractionEvents[_0xd19b('0x3')](_0x49be9,_0x27f482);};}exports[_0xd19b('0x4')]=function(_0x3ad628){for(var _0x12576f=0x0,_0x3839ee=events['length'];_0x12576f<_0x3839ee;_0x12576f++){var _0x29906c=events[_0x12576f];var _0x29865e=createListener('openchannelInteraction:'+_0x29906c,_0x3ad628);OpenchannelInteractionEvents['on'](_0x29906c,_0x29865e);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 4de35b3..4f22d7c 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x49cdcf,_0x3a82b5){var _0x286d74=function(_0xb0ceb8){while(--_0xb0ceb8){_0x49cdcf['push'](_0x49cdcf['shift']());}};_0x286d74(++_0x3a82b5);}(_0xedd9,0xfc));var _0x9edd=function(_0x2042a4,_0x16f91e){_0x2042a4=_0x2042a4-0x0;var _0x233995=_0xedd9[_0x2042a4];return _0x233995;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _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(_0x31597a,_0xab4ca4){var _0x546775=function(_0x3bea90){while(--_0x3bea90){_0x31597a['push'](_0x31597a['shift']());}};_0x546775(++_0xab4ca4);}(_0xe706,0xa3));var _0x6e70=function(_0x1bb0b8,_0x24add2){_0x1bb0b8=_0x1bb0b8-0x0;var _0x22fc67=_0xe706[_0x1bb0b8];return _0x22fc67;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 1b47778..3ed7138 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 _0xa321=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x119841,_0x5009c2){var _0x5bc7cb=function(_0x3df78c){while(--_0x3df78c){_0x119841['push'](_0x119841['shift']());}};_0x5bc7cb(++_0x5009c2);}(_0xa321,0x9d));var _0x1a32=function(_0x279ab1,_0x527374){_0x279ab1=_0x279ab1-0x0;var _0x8ba87c=_0xa321[_0x279ab1];return _0x8ba87c;};'use strict';var Sequelize=require(_0x1a32('0x0'));module[_0x1a32('0x1')]={'body':{'type':Sequelize[_0x1a32('0x2')](_0x1a32('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x1a32('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1a32('0x5')]('in','out'),'defaultValue':_0x1a32('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x1a32('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3c66=['BOOLEAN','ENUM','out','DATE','STRING','TEXT','medium'];(function(_0x4307e1,_0x1335bc){var _0xef6ef2=function(_0x47ddbe){while(--_0x47ddbe){_0x4307e1['push'](_0x4307e1['shift']());}};_0xef6ef2(++_0x1335bc);}(_0x3c66,0x8b));var _0x63c6=function(_0x2da413,_0xdf7b98){_0x2da413=_0x2da413-0x0;var _0xdc3b79=_0x3c66[_0x2da413];return _0xdc3b79;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x63c6('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x63c6('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x63c6('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x63c6('0x2')]('in',_0x63c6('0x3')),'defaultValue':_0x63c6('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x63c6('0x4')]},'providerName':{'type':Sequelize[_0x63c6('0x5')]},'providerResponse':{'type':Sequelize[_0x63c6('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 4d5969c..c4cec67 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 _0x5d87=['body','update','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','SELECT','User','agent','fullname','manual','SIP/%s','channel','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','email','internal','interface','event','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','request','then','request\x20sent','error','code','message','OpenchannelMessage,\x20%s,\x20%s','info','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create'];(function(_0x464c5a,_0x199c40){var _0x1a4e71=function(_0x434e0b){while(--_0x434e0b){_0x464c5a['push'](_0x464c5a['shift']());}};_0x1a4e71(++_0x199c40);}(_0x5d87,0x1b0));var _0x75d8=function(_0x2fc428,_0x387d42){_0x2fc428=_0x2fc428-0x0;var _0x122cac=_0x5d87[_0x2fc428];return _0x122cac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x75d8('0x0'));var zipdir=require(_0x75d8('0x1'));var jsonpatch=require(_0x75d8('0x2'));var rp=require(_0x75d8('0x3'));var moment=require(_0x75d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x75d8('0x5'));var util=require(_0x75d8('0x6'));var path=require('path');var sox=require(_0x75d8('0x7'));var csv=require(_0x75d8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d8('0x9'));var _=require(_0x75d8('0xa'));var squel=require(_0x75d8('0xb'));var crypto=require(_0x75d8('0xc'));var jsforce=require(_0x75d8('0xd'));var deskjs=require(_0x75d8('0xe'));var toCsv=require(_0x75d8('0x8'));var querystring=require(_0x75d8('0xf'));var Papa=require(_0x75d8('0x10'));var Redis=require(_0x75d8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x75d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75d8('0x13'));var logger=require(_0x75d8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x75d8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x75d8('0x16'))['db'];config[_0x75d8('0x17')]=_[_0x75d8('0x18')](config[_0x75d8('0x17')],{'host':_0x75d8('0x19'),'port':0x18eb});var socket=require(_0x75d8('0x1a'))(new Redis(config[_0x75d8('0x17')]));require(_0x75d8('0x1b'))['register'](socket);var jayson=require(_0x75d8('0x1c'));var client=jayson['client'][_0x75d8('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x75d8('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xb269b1,_0x12ba5a,_0x2c4ebc,_0x4473e3){return new BPromise(function(_0x598ab1,_0x38785c){var _0x4504d0=_0x4473e3||client;return _0x4504d0[_0x75d8('0x1e')](_0xb269b1,_0x2c4ebc)[_0x75d8('0x1f')](function(_0x4a47e9){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x12ba5a,_0x75d8('0x20'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x12ba5a,'request\x20sent',JSON['stringify'](_0x4a47e9));if(_0x4a47e9[_0x75d8('0x21')]){if(_0x4a47e9[_0x75d8('0x21')][_0x75d8('0x22')]===0x1f4){logger[_0x75d8('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x12ba5a,_0x4a47e9[_0x75d8('0x21')]['message']);return _0x38785c(_0x4a47e9['error'][_0x75d8('0x23')]);}logger['error'](_0x75d8('0x24'),_0x12ba5a,_0x4a47e9[_0x75d8('0x21')][_0x75d8('0x23')]);return _0x598ab1(_0x4a47e9[_0x75d8('0x21')][_0x75d8('0x23')]);}else{logger[_0x75d8('0x25')](_0x75d8('0x24'),_0x12ba5a,_0x75d8('0x20'));_0x598ab1(_0x4a47e9[_0x75d8('0x26')][_0x75d8('0x23')]);}})[_0x75d8('0x27')](function(_0x259b7d){logger[_0x75d8('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x12ba5a,_0x259b7d);_0x38785c(_0x259b7d);});});}function respondWithStatusCode(_0xca4f70,_0x4aac58){_0x4aac58=_0x4aac58||0xcc;return function(_0xb89de3){if(_0xb89de3){return _0xca4f70['sendStatus'](_0x4aac58);}return _0xca4f70[_0x75d8('0x28')](_0x4aac58)[_0x75d8('0x29')]();};}function respondWithResult(_0x171c3c,_0x48cb47){_0x48cb47=_0x48cb47||0xc8;return function(_0x20dd22){if(_0x20dd22){return _0x171c3c[_0x75d8('0x28')](_0x48cb47)[_0x75d8('0x2a')](_0x20dd22);}};}function respondWithFilteredResult(_0x9593ef,_0x4c31ac){return function(_0x417e55){if(_0x417e55){var _0x5625b1=typeof _0x4c31ac[_0x75d8('0x2b')]===_0x75d8('0x2c')&&typeof _0x4c31ac[_0x75d8('0x2d')]===_0x75d8('0x2c');var _0x31c943=_0x417e55[_0x75d8('0x2e')];var _0x527641=_0x5625b1?0x0:_0x4c31ac[_0x75d8('0x2b')];var _0xc4b7d8=_0x5625b1?_0x417e55[_0x75d8('0x2e')]:_0x4c31ac[_0x75d8('0x2b')]+_0x4c31ac[_0x75d8('0x2d')];var _0x469368;if(_0xc4b7d8>=_0x31c943){_0xc4b7d8=_0x31c943;_0x469368=0xc8;}else{_0x469368=0xce;}_0x9593ef[_0x75d8('0x28')](_0x469368);return _0x9593ef[_0x75d8('0x2f')](_0x75d8('0x30'),_0x527641+'-'+_0xc4b7d8+'/'+_0x31c943)[_0x75d8('0x2a')](_0x417e55);}return null;};}function patchUpdates(_0x270730){return function(_0x4e1ad7){try{jsonpatch[_0x75d8('0x31')](_0x4e1ad7,_0x270730,!![]);}catch(_0x1a7053){return BPromise[_0x75d8('0x32')](_0x1a7053);}return _0x4e1ad7[_0x75d8('0x33')]();};}function saveUpdates(_0x4b0d91,_0x58b638){return function(_0x15b6d3){if(_0x15b6d3){return _0x15b6d3['update'](_0x4b0d91)[_0x75d8('0x1f')](function(_0x271665){return _0x271665;});}return null;};}function removeEntity(_0x37ba60,_0x241d8c){return function(_0x4973c7){if(_0x4973c7){return _0x4973c7[_0x75d8('0x34')]()[_0x75d8('0x1f')](function(){_0x37ba60[_0x75d8('0x28')](0xcc)[_0x75d8('0x29')]();});}};}function handleEntityNotFound(_0x3cba3d,_0x3817d2){return function(_0x95bddf){if(!_0x95bddf){_0x3cba3d['sendStatus'](0x194);}return _0x95bddf;};}function handleError(_0x1a703f,_0x4fa5e3){_0x4fa5e3=_0x4fa5e3||0x1f4;return function(_0x47c2c9){logger[_0x75d8('0x21')](_0x47c2c9[_0x75d8('0x35')]);if(_0x47c2c9[_0x75d8('0x36')]){delete _0x47c2c9[_0x75d8('0x36')];}_0x1a703f[_0x75d8('0x28')](_0x4fa5e3)[_0x75d8('0x37')](_0x47c2c9);};}exports[_0x75d8('0x38')]=function(_0x5d9cbd,_0x464f93){var _0x472dab={},_0x58eabe={},_0x4d3745={'count':0x0,'rows':[]};var _0x48bb6c=_[_0x75d8('0x39')](db[_0x75d8('0x3a')][_0x75d8('0x3b')],function(_0x2da7b8){return{'name':_0x2da7b8[_0x75d8('0x3c')],'type':_0x2da7b8[_0x75d8('0x3d')]['key']};});_0x58eabe['model']=_['map'](_0x48bb6c,_0x75d8('0x36'));_0x58eabe['query']=_[_0x75d8('0x3e')](_0x5d9cbd[_0x75d8('0x3f')]);_0x58eabe[_0x75d8('0x40')]=_[_0x75d8('0x41')](_0x58eabe[_0x75d8('0x42')],_0x58eabe[_0x75d8('0x3f')]);_0x472dab['attributes']=_[_0x75d8('0x41')](_0x58eabe[_0x75d8('0x42')],qs[_0x75d8('0x43')](_0x5d9cbd[_0x75d8('0x3f')][_0x75d8('0x43')]));_0x472dab[_0x75d8('0x44')]=_0x472dab[_0x75d8('0x44')][_0x75d8('0x45')]?_0x472dab[_0x75d8('0x44')]:_0x58eabe[_0x75d8('0x42')];if(!_0x5d9cbd['query'][_0x75d8('0x46')](_0x75d8('0x47'))){_0x472dab['limit']=qs['limit'](_0x5d9cbd[_0x75d8('0x3f')][_0x75d8('0x2d')]);_0x472dab[_0x75d8('0x2b')]=qs['offset'](_0x5d9cbd['query'][_0x75d8('0x2b')]);}_0x472dab[_0x75d8('0x48')]=qs['sort'](_0x5d9cbd['query'][_0x75d8('0x49')]);_0x472dab[_0x75d8('0x4a')]=qs[_0x75d8('0x40')](_[_0x75d8('0x4b')](_0x5d9cbd[_0x75d8('0x3f')],_0x58eabe[_0x75d8('0x40')]),_0x48bb6c);if(_0x5d9cbd[_0x75d8('0x3f')][_0x75d8('0x4c')]){_0x472dab['where']=_[_0x75d8('0x4d')](_0x472dab[_0x75d8('0x4a')],{'$or':_[_0x75d8('0x39')](_0x48bb6c,function(_0x3a75a1){if(_0x3a75a1[_0x75d8('0x3d')]!==_0x75d8('0x4e')){var _0x4684b3={};_0x4684b3[_0x3a75a1[_0x75d8('0x36')]]={'$like':'%'+_0x5d9cbd[_0x75d8('0x3f')][_0x75d8('0x4c')]+'%'};return _0x4684b3;}})});}_0x472dab=_[_0x75d8('0x4d')]({},_0x472dab,_0x5d9cbd[_0x75d8('0x4f')]);var _0x4296db={'where':_0x472dab[_0x75d8('0x4a')]};return db[_0x75d8('0x3a')]['count'](_0x4296db)[_0x75d8('0x1f')](function(_0xa06963){_0x4d3745[_0x75d8('0x2e')]=_0xa06963;if(_0x5d9cbd[_0x75d8('0x3f')]['includeAll']){_0x472dab[_0x75d8('0x50')]=[{'all':!![]}];}return db[_0x75d8('0x3a')][_0x75d8('0x51')](_0x472dab);})[_0x75d8('0x1f')](function(_0x2a5442){_0x4d3745[_0x75d8('0x52')]=_0x2a5442;return _0x4d3745;})[_0x75d8('0x1f')](respondWithFilteredResult(_0x464f93,_0x472dab))[_0x75d8('0x27')](handleError(_0x464f93,null));};exports[_0x75d8('0x53')]=function(_0x2f044e,_0x48b4f2){var _0x37daaa={'raw':!![],'where':{'id':_0x2f044e[_0x75d8('0x54')]['id']}},_0x3af12f={};_0x3af12f['model']=_[_0x75d8('0x3e')](db[_0x75d8('0x3a')][_0x75d8('0x3b')]);_0x3af12f[_0x75d8('0x3f')]=_[_0x75d8('0x3e')](_0x2f044e['query']);_0x3af12f[_0x75d8('0x40')]=_['intersection'](_0x3af12f[_0x75d8('0x42')],_0x3af12f['query']);_0x37daaa[_0x75d8('0x44')]=_['intersection'](_0x3af12f[_0x75d8('0x42')],qs[_0x75d8('0x43')](_0x2f044e[_0x75d8('0x3f')][_0x75d8('0x43')]));_0x37daaa[_0x75d8('0x44')]=_0x37daaa[_0x75d8('0x44')][_0x75d8('0x45')]?_0x37daaa[_0x75d8('0x44')]:_0x3af12f[_0x75d8('0x42')];if(_0x2f044e[_0x75d8('0x3f')][_0x75d8('0x55')]){_0x37daaa[_0x75d8('0x50')]=[{'all':!![]}];}_0x37daaa=_['merge']({},_0x37daaa,_0x2f044e[_0x75d8('0x4f')]);return db['OpenchannelMessage'][_0x75d8('0x56')](_0x37daaa)[_0x75d8('0x1f')](handleEntityNotFound(_0x48b4f2,null))[_0x75d8('0x1f')](respondWithResult(_0x48b4f2,null))[_0x75d8('0x27')](handleError(_0x48b4f2,null));};exports[_0x75d8('0x57')]=function(_0x3bb59e,_0x12bbfb){return db[_0x75d8('0x3a')]['create'](_0x3bb59e[_0x75d8('0x58')],{})[_0x75d8('0x1f')](respondWithResult(_0x12bbfb,0xc9))[_0x75d8('0x27')](handleError(_0x12bbfb,null));};exports[_0x75d8('0x59')]=function(_0x54721d,_0x127b3b){if(_0x54721d[_0x75d8('0x58')]['id']){delete _0x54721d[_0x75d8('0x58')]['id'];}return db[_0x75d8('0x3a')][_0x75d8('0x56')]({'where':{'id':_0x54721d['params']['id']}})['then'](handleEntityNotFound(_0x127b3b,null))[_0x75d8('0x1f')](saveUpdates(_0x54721d[_0x75d8('0x58')],null))[_0x75d8('0x1f')](respondWithResult(_0x127b3b,null))[_0x75d8('0x27')](handleError(_0x127b3b,null));};exports[_0x75d8('0x34')]=function(_0x42cc49,_0x3de80d){return db[_0x75d8('0x3a')][_0x75d8('0x56')]({'where':{'id':_0x42cc49[_0x75d8('0x54')]['id']}})['then'](handleEntityNotFound(_0x3de80d,null))[_0x75d8('0x1f')](removeEntity(_0x3de80d,null))[_0x75d8('0x27')](handleError(_0x3de80d,null));};exports[_0x75d8('0x5a')]=function(_0x513f54,_0x110bf6){return db[_0x75d8('0x3a')][_0x75d8('0x5a')]()[_0x75d8('0x1f')](respondWithResult(_0x110bf6,null))[_0x75d8('0x27')](handleError(_0x110bf6,null));};var interaction_log=require(_0x75d8('0x14'))(_0x75d8('0x5b'));exports[_0x75d8('0x5c')]=function(_0x119e7d,_0x32e85e,_0x25fa67){var _0x17e8c9={'agent':{},'channel':'openchannel'};if(_0x119e7d[_0x75d8('0x58')]['id']){delete _0x119e7d['body']['id'];}_0x119e7d['body'][_0x75d8('0x5d')]=!![];_0x119e7d['body'][_0x75d8('0x5e')]=moment()[_0x75d8('0x5f')](_0x75d8('0x60'));_0x119e7d[_0x75d8('0x58')][_0x75d8('0x61')]=_0x119e7d[_0x75d8('0x58')]['UserId']||_0x119e7d['user']['id'];_0x17e8c9['agent']['id']=_0x119e7d['body'][_0x75d8('0x61')];return db[_0x75d8('0x3a')]['find']({'where':{'id':_0x119e7d[_0x75d8('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32e85e,null))[_0x75d8('0x1f')](saveUpdates(_0x119e7d[_0x75d8('0x58')],null))[_0x75d8('0x1f')](function(_0x262667){if(_0x262667){_0x17e8c9[_0x75d8('0x23')]=_0x262667[_0x75d8('0x62')]({'plain':!![]});return db[_0x75d8('0x63')][_0x75d8('0x56')]({'where':{'id':_0x262667[_0x75d8('0x64')]}});}return null;})[_0x75d8('0x1f')](handleEntityNotFound(_0x32e85e,null))[_0x75d8('0x1f')](function(_0x884505){if(_0x884505){return _0x884505['update']({'UserId':_0x119e7d[_0x75d8('0x58')]['UserId'],'read1stAt':_['isNil'](_0x884505['read1stAt'])?moment()[_0x75d8('0x5f')](_0x75d8('0x60')):undefined});}return null;})[_0x75d8('0x1f')](function(_0x38ee02){if(_0x38ee02){_0x17e8c9[_0x75d8('0x65')]=_0x38ee02[_0x75d8('0x62')]({'plain':!![]});interaction_log[_0x75d8('0x25')](_0x75d8('0x66'),_0x119e7d['user']['id'],_0x119e7d[_0x75d8('0x67')][_0x75d8('0x36')],_0x119e7d[_0x75d8('0x67')][_0x75d8('0x68')],_0x17e8c9[_0x75d8('0x65')]['id'],_0x119e7d[_0x75d8('0x58')]?JSON['stringify'](_0x119e7d[_0x75d8('0x58')]):_0x75d8('0x69'));return respondWithRpcPromise(_0x75d8('0x6a'),_0x75d8('0x6b'),_0x17e8c9);}return null;})['then'](function(_0x30f9bd){var _0x3a5f44='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x30f9bd[_0x75d8('0x23')]['ContactId'];return db[_0x75d8('0x6c')]['query'](_0x3a5f44,{'type':db[_0x75d8('0x6d')]['QueryTypes'][_0x75d8('0x6e')],'raw':!![]})['then'](function(_0x2d0b26){return _0x2d0b26;});})['then'](function(_0x402212){if(_0x402212){_0x17e8c9[_0x75d8('0x23')]['contact']=_0x402212[0x0];if(!_0x119e7d[_0x75d8('0x58')][_0x75d8('0x61')])return;return db[_0x75d8('0x6f')][_0x75d8('0x56')]({'where':{'id':_0x119e7d['body'][_0x75d8('0x61')],'role':_0x75d8('0x70')},'attributes':['id',_0x75d8('0x36'),_0x75d8('0x71'),'email','internal'],'raw':!![]});}return null;})[_0x75d8('0x1f')](function(_0x50a18b){if(!_0x50a18b)return null;_0x17e8c9[_0x75d8('0x23')][_0x75d8('0x70')]=_0x50a18b;return _0x17e8c9;})[_0x75d8('0x1f')](function(_0x349558){if(_0x349558){if(_0x119e7d[_0x75d8('0x58')][_0x75d8('0x72')]){_0x17e8c9[_0x75d8('0x23')]['interface']=util[_0x75d8('0x5f')](_0x75d8('0x73'),_0x119e7d[_0x75d8('0x67')][_0x75d8('0x36')]);_0x17e8c9[_0x75d8('0x23')][_0x75d8('0x74')]=_0x17e8c9['channel'];_0x17e8c9[_0x75d8('0x23')]['motionChannel']=_0x17e8c9['channel'];_0x17e8c9[_0x75d8('0x23')]['event']=_0x75d8('0x5c');return respondWithRpcPromise(_0x75d8('0x75'),_0x75d8('0x75'),{'event':_0x75d8('0x76'),'message':_0x17e8c9[_0x75d8('0x23')]},client9002)['then'](function(){return _0x17e8c9;});}return _0x17e8c9;}return null;})['then'](respondWithResult(_0x32e85e,null))[_0x75d8('0x27')](handleError(_0x32e85e,null));};var interaction_log=require(_0x75d8('0x14'))(_0x75d8('0x5b'));exports['reject']=function(_0x55ffec,_0x23eeb9,_0x22a968){var _0x44f170={'agent':{},'channel':_0x75d8('0x77')};if(_0x55ffec[_0x75d8('0x58')]['id']){delete _0x55ffec['body']['id'];}_0x55ffec['body']['UserId']=_0x55ffec[_0x75d8('0x58')][_0x75d8('0x61')]||_0x55ffec['user']['id'];_0x44f170['agent']['id']=_0x55ffec[_0x75d8('0x58')][_0x75d8('0x61')];return db[_0x75d8('0x3a')][_0x75d8('0x56')]({'where':{'id':_0x55ffec[_0x75d8('0x54')]['id'],'UserId':null}})[_0x75d8('0x1f')](handleEntityNotFound(_0x23eeb9,null))[_0x75d8('0x1f')](function(_0x4183a8){if(_0x4183a8){_0x44f170[_0x75d8('0x23')]=_0x4183a8[_0x75d8('0x62')]({'plain':!![]});return db[_0x75d8('0x63')][_0x75d8('0x56')]({'where':{'id':_0x4183a8[_0x75d8('0x64')]}});}return null;})[_0x75d8('0x1f')](handleEntityNotFound(_0x23eeb9,null))[_0x75d8('0x1f')](function(_0x351b04){if(_0x351b04){_0x44f170[_0x75d8('0x65')]=_0x351b04['get']({'plain':!![]});interaction_log[_0x75d8('0x25')](_0x75d8('0x78'),_0x55ffec[_0x75d8('0x67')]['id'],_0x55ffec[_0x75d8('0x67')][_0x75d8('0x36')],_0x55ffec[_0x75d8('0x67')][_0x75d8('0x68')],_0x44f170['interaction']['id'],_0x55ffec[_0x75d8('0x58')]?JSON[_0x75d8('0x79')](_0x55ffec[_0x75d8('0x58')]):'null');return respondWithRpcPromise('RejectMessage',_0x75d8('0x7a'),_0x44f170);}return null;})[_0x75d8('0x1f')](function(_0x455a48){var _0x4dd25d=_0x75d8('0x7b')+_0x455a48[_0x75d8('0x23')]['ContactId'];return db[_0x75d8('0x6c')][_0x75d8('0x3f')](_0x4dd25d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x75d8('0x1f')](function(_0x19c7b0){return _0x19c7b0;});})[_0x75d8('0x1f')](function(_0x2dc04b){if(_0x2dc04b){_0x44f170[_0x75d8('0x23')][_0x75d8('0x7c')]=_0x2dc04b[0x0];if(!_0x55ffec[_0x75d8('0x58')]['UserId'])return;return db[_0x75d8('0x6f')][_0x75d8('0x56')]({'where':{'id':_0x55ffec['body'][_0x75d8('0x61')],'role':_0x75d8('0x70')},'attributes':['id',_0x75d8('0x36'),_0x75d8('0x71'),_0x75d8('0x7d'),_0x75d8('0x7e')],'raw':!![]});}return null;})[_0x75d8('0x1f')](function(_0xfbbf84){if(!_0xfbbf84)return null;_0x44f170[_0x75d8('0x23')][_0x75d8('0x70')]=_0xfbbf84;return _0x44f170;})['then'](function(_0x34bb82){if(_0x34bb82){_0x34bb82[_0x75d8('0x23')][_0x75d8('0x7f')]=util[_0x75d8('0x5f')](_0x75d8('0x73'),_0x55ffec[_0x75d8('0x67')][_0x75d8('0x36')]);_0x34bb82['message'][_0x75d8('0x74')]=_0x44f170[_0x75d8('0x74')];_0x34bb82[_0x75d8('0x23')]['motionChannel']=_0x44f170[_0x75d8('0x74')];_0x34bb82['message'][_0x75d8('0x80')]=_0x75d8('0x32');respondWithRpcPromise(_0x75d8('0x75'),_0x75d8('0x75'),{'event':_0x75d8('0x81'),'message':_0x34bb82[_0x75d8('0x23')]},client9002);return _0x44f170;}return null;})[_0x75d8('0x1f')](respondWithResult(_0x23eeb9,null))[_0x75d8('0x27')](handleError(_0x23eeb9,null));}; \ No newline at end of file +var _0x1db9=['request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','name','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','describe','../../config/logger','openchannel-interactions','accept','readAt','format','UserId','user','agent','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','get','OpenchannelInteractionId','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1db9,0x176));var _0x91db=function(_0xb29cae,_0x5a000f){_0xb29cae=_0xb29cae-0x0;var _0x564b02=_0x1db9[_0xb29cae];return _0x564b02;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91db('0x6'));var util=require(_0x91db('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x91db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x91db('0x15')](config[_0x91db('0x16')],{'host':_0x91db('0x17'),'port':0x18eb});var socket=require(_0x91db('0x18'))(new Redis(config[_0x91db('0x16')]));require('./openchannelMessage.socket')[_0x91db('0x19')](socket);var jayson=require(_0x91db('0x1a'));var client=jayson[_0x91db('0x1b')][_0x91db('0x1c')]({'port':0x232c});var client9002=jayson[_0x91db('0x1b')][_0x91db('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x260b56,_0x143bc4,_0x675bd,_0x26d10c){return new BPromise(function(_0x1e9679,_0x12416f){var _0x5f5440=_0x26d10c||client;return _0x5f5440[_0x91db('0x1d')](_0x260b56,_0x675bd)[_0x91db('0x1e')](function(_0x39480f){logger[_0x91db('0x1f')](_0x91db('0x20'),_0x143bc4,_0x91db('0x21'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x143bc4,_0x91db('0x21'),JSON[_0x91db('0x22')](_0x39480f));if(_0x39480f[_0x91db('0x23')]){if(_0x39480f[_0x91db('0x23')]['code']===0x1f4){logger[_0x91db('0x23')](_0x91db('0x20'),_0x143bc4,_0x39480f[_0x91db('0x23')][_0x91db('0x24')]);return _0x12416f(_0x39480f[_0x91db('0x23')][_0x91db('0x24')]);}logger[_0x91db('0x23')](_0x91db('0x20'),_0x143bc4,_0x39480f[_0x91db('0x23')][_0x91db('0x24')]);return _0x1e9679(_0x39480f['error']['message']);}else{logger[_0x91db('0x1f')](_0x91db('0x20'),_0x143bc4,'request\x20sent');_0x1e9679(_0x39480f[_0x91db('0x25')][_0x91db('0x24')]);}})[_0x91db('0x26')](function(_0x6e3a9c){logger[_0x91db('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x143bc4,_0x6e3a9c);_0x12416f(_0x6e3a9c);});});}function respondWithStatusCode(_0x51664d,_0x42e53f){_0x42e53f=_0x42e53f||0xcc;return function(_0x2f0b86){if(_0x2f0b86){return _0x51664d[_0x91db('0x27')](_0x42e53f);}return _0x51664d['status'](_0x42e53f)[_0x91db('0x28')]();};}function respondWithResult(_0x3c31ea,_0x46c0e8){_0x46c0e8=_0x46c0e8||0xc8;return function(_0x1bb4f8){if(_0x1bb4f8){return _0x3c31ea['status'](_0x46c0e8)[_0x91db('0x29')](_0x1bb4f8);}};}function respondWithFilteredResult(_0x2a00d1,_0x1805ef){return function(_0x49c504){if(_0x49c504){var _0x2ff6c8=typeof _0x1805ef[_0x91db('0x2a')]===_0x91db('0x2b')&&typeof _0x1805ef[_0x91db('0x2c')]===_0x91db('0x2b');var _0x1e865e=_0x49c504[_0x91db('0x2d')];var _0x1b5a7b=_0x2ff6c8?0x0:_0x1805ef[_0x91db('0x2a')];var _0x1b27f9=_0x2ff6c8?_0x49c504[_0x91db('0x2d')]:_0x1805ef[_0x91db('0x2a')]+_0x1805ef[_0x91db('0x2c')];var _0x105c01;if(_0x1b27f9>=_0x1e865e){_0x1b27f9=_0x1e865e;_0x105c01=0xc8;}else{_0x105c01=0xce;}_0x2a00d1['status'](_0x105c01);return _0x2a00d1[_0x91db('0x2e')](_0x91db('0x2f'),_0x1b5a7b+'-'+_0x1b27f9+'/'+_0x1e865e)[_0x91db('0x29')](_0x49c504);}return null;};}function patchUpdates(_0x431bf6){return function(_0x370934){try{jsonpatch['apply'](_0x370934,_0x431bf6,!![]);}catch(_0x2c5e5e){return BPromise[_0x91db('0x30')](_0x2c5e5e);}return _0x370934[_0x91db('0x31')]();};}function saveUpdates(_0x4fada9,_0x2a456d){return function(_0x55d40b){if(_0x55d40b){return _0x55d40b[_0x91db('0x32')](_0x4fada9)[_0x91db('0x1e')](function(_0xb0e74b){return _0xb0e74b;});}return null;};}function removeEntity(_0x322cac,_0x569a70){return function(_0xaa578c){if(_0xaa578c){return _0xaa578c[_0x91db('0x33')]()[_0x91db('0x1e')](function(){_0x322cac['status'](0xcc)[_0x91db('0x28')]();});}};}function handleEntityNotFound(_0x39b87d,_0x4f3e8d){return function(_0x451639){if(!_0x451639){_0x39b87d[_0x91db('0x27')](0x194);}return _0x451639;};}function handleError(_0x57dc00,_0x39ba97){_0x39ba97=_0x39ba97||0x1f4;return function(_0x4f609c){logger[_0x91db('0x23')](_0x4f609c[_0x91db('0x34')]);if(_0x4f609c['name']){delete _0x4f609c['name'];}_0x57dc00['status'](_0x39ba97)[_0x91db('0x35')](_0x4f609c);};}exports[_0x91db('0x36')]=function(_0x5ce345,_0x1cda26){var _0xb651c6={},_0x1a0703={},_0x26511c={'count':0x0,'rows':[]};var _0xbb7289=_[_0x91db('0x37')](db[_0x91db('0x38')][_0x91db('0x39')],function(_0xcdc472){return{'name':_0xcdc472[_0x91db('0x3a')],'type':_0xcdc472[_0x91db('0x3b')]['key']};});_0x1a0703[_0x91db('0x3c')]=_['map'](_0xbb7289,_0x91db('0x3d'));_0x1a0703[_0x91db('0x3e')]=_['keys'](_0x5ce345[_0x91db('0x3e')]);_0x1a0703[_0x91db('0x3f')]=_[_0x91db('0x40')](_0x1a0703[_0x91db('0x3c')],_0x1a0703[_0x91db('0x3e')]);_0xb651c6['attributes']=_[_0x91db('0x40')](_0x1a0703[_0x91db('0x3c')],qs[_0x91db('0x41')](_0x5ce345['query'][_0x91db('0x41')]));_0xb651c6[_0x91db('0x42')]=_0xb651c6[_0x91db('0x42')]['length']?_0xb651c6[_0x91db('0x42')]:_0x1a0703[_0x91db('0x3c')];if(!_0x5ce345[_0x91db('0x3e')][_0x91db('0x43')](_0x91db('0x44'))){_0xb651c6['limit']=qs[_0x91db('0x2c')](_0x5ce345['query'][_0x91db('0x2c')]);_0xb651c6[_0x91db('0x2a')]=qs[_0x91db('0x2a')](_0x5ce345[_0x91db('0x3e')][_0x91db('0x2a')]);}_0xb651c6[_0x91db('0x45')]=qs[_0x91db('0x46')](_0x5ce345[_0x91db('0x3e')][_0x91db('0x46')]);_0xb651c6[_0x91db('0x47')]=qs[_0x91db('0x3f')](_['pick'](_0x5ce345['query'],_0x1a0703[_0x91db('0x3f')]),_0xbb7289);if(_0x5ce345[_0x91db('0x3e')][_0x91db('0x48')]){_0xb651c6['where']=_[_0x91db('0x49')](_0xb651c6[_0x91db('0x47')],{'$or':_[_0x91db('0x37')](_0xbb7289,function(_0x35ffaf){if(_0x35ffaf[_0x91db('0x3b')]!=='VIRTUAL'){var _0x16c50c={};_0x16c50c[_0x35ffaf['name']]={'$like':'%'+_0x5ce345[_0x91db('0x3e')][_0x91db('0x48')]+'%'};return _0x16c50c;}})});}_0xb651c6=_[_0x91db('0x49')]({},_0xb651c6,_0x5ce345[_0x91db('0x4a')]);var _0x3c3568={'where':_0xb651c6[_0x91db('0x47')]};return db[_0x91db('0x38')][_0x91db('0x2d')](_0x3c3568)[_0x91db('0x1e')](function(_0x4fb60e){_0x26511c['count']=_0x4fb60e;if(_0x5ce345[_0x91db('0x3e')][_0x91db('0x4b')]){_0xb651c6[_0x91db('0x4c')]=[{'all':!![]}];}return db[_0x91db('0x38')][_0x91db('0x4d')](_0xb651c6);})['then'](function(_0x272657){_0x26511c[_0x91db('0x4e')]=_0x272657;return _0x26511c;})[_0x91db('0x1e')](respondWithFilteredResult(_0x1cda26,_0xb651c6))[_0x91db('0x26')](handleError(_0x1cda26,null));};exports[_0x91db('0x4f')]=function(_0x51a75b,_0xf90032){var _0x1da3dc={'raw':!![],'where':{'id':_0x51a75b[_0x91db('0x50')]['id']}},_0xb60404={};_0xb60404[_0x91db('0x3c')]=_[_0x91db('0x51')](db['OpenchannelMessage']['rawAttributes']);_0xb60404[_0x91db('0x3e')]=_['keys'](_0x51a75b[_0x91db('0x3e')]);_0xb60404['filters']=_['intersection'](_0xb60404[_0x91db('0x3c')],_0xb60404[_0x91db('0x3e')]);_0x1da3dc[_0x91db('0x42')]=_['intersection'](_0xb60404[_0x91db('0x3c')],qs[_0x91db('0x41')](_0x51a75b[_0x91db('0x3e')]['fields']));_0x1da3dc['attributes']=_0x1da3dc[_0x91db('0x42')][_0x91db('0x52')]?_0x1da3dc['attributes']:_0xb60404[_0x91db('0x3c')];if(_0x51a75b['query'][_0x91db('0x4b')]){_0x1da3dc[_0x91db('0x4c')]=[{'all':!![]}];}_0x1da3dc=_[_0x91db('0x49')]({},_0x1da3dc,_0x51a75b[_0x91db('0x4a')]);return db['OpenchannelMessage'][_0x91db('0x53')](_0x1da3dc)[_0x91db('0x1e')](handleEntityNotFound(_0xf90032,null))[_0x91db('0x1e')](respondWithResult(_0xf90032,null))[_0x91db('0x26')](handleError(_0xf90032,null));};exports[_0x91db('0x54')]=function(_0x3c8dec,_0x176a7e){return db[_0x91db('0x38')][_0x91db('0x54')](_0x3c8dec[_0x91db('0x55')],{})['then'](respondWithResult(_0x176a7e,0xc9))[_0x91db('0x26')](handleError(_0x176a7e,null));};exports[_0x91db('0x32')]=function(_0x445c2b,_0x276bc7){if(_0x445c2b[_0x91db('0x55')]['id']){delete _0x445c2b['body']['id'];}return db[_0x91db('0x38')]['find']({'where':{'id':_0x445c2b[_0x91db('0x50')]['id']}})[_0x91db('0x1e')](handleEntityNotFound(_0x276bc7,null))['then'](saveUpdates(_0x445c2b['body'],null))[_0x91db('0x1e')](respondWithResult(_0x276bc7,null))[_0x91db('0x26')](handleError(_0x276bc7,null));};exports[_0x91db('0x33')]=function(_0x51324a,_0x14a150){return db[_0x91db('0x38')][_0x91db('0x53')]({'where':{'id':_0x51324a[_0x91db('0x50')]['id']}})[_0x91db('0x1e')](handleEntityNotFound(_0x14a150,null))[_0x91db('0x1e')](removeEntity(_0x14a150,null))['catch'](handleError(_0x14a150,null));};exports[_0x91db('0x56')]=function(_0x469e1e,_0x335b44){return db[_0x91db('0x38')][_0x91db('0x56')]()[_0x91db('0x1e')](respondWithResult(_0x335b44,null))[_0x91db('0x26')](handleError(_0x335b44,null));};var interaction_log=require(_0x91db('0x57'))(_0x91db('0x58'));exports[_0x91db('0x59')]=function(_0x3dfd79,_0x505639,_0x186835){var _0x1faa56={'agent':{},'channel':'openchannel'};if(_0x3dfd79['body']['id']){delete _0x3dfd79[_0x91db('0x55')]['id'];}_0x3dfd79[_0x91db('0x55')]['read']=!![];_0x3dfd79['body'][_0x91db('0x5a')]=moment()[_0x91db('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x3dfd79[_0x91db('0x55')][_0x91db('0x5c')]=_0x3dfd79[_0x91db('0x55')]['UserId']||_0x3dfd79[_0x91db('0x5d')]['id'];_0x1faa56[_0x91db('0x5e')]['id']=_0x3dfd79['body']['UserId'];return db[_0x91db('0x38')]['find']({'where':{'id':_0x3dfd79[_0x91db('0x50')]['id'],'UserId':null}})[_0x91db('0x1e')](handleEntityNotFound(_0x505639,null))[_0x91db('0x1e')](saveUpdates(_0x3dfd79[_0x91db('0x55')],null))[_0x91db('0x1e')](function(_0x361498){if(_0x361498){_0x1faa56[_0x91db('0x24')]=_0x361498['get']({'plain':!![]});return db[_0x91db('0x5f')][_0x91db('0x53')]({'where':{'id':_0x361498['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x505639,null))[_0x91db('0x1e')](function(_0x3444d9){if(_0x3444d9){return _0x3444d9[_0x91db('0x32')]({'UserId':_0x3dfd79[_0x91db('0x55')]['UserId'],'read1stAt':_[_0x91db('0x60')](_0x3444d9[_0x91db('0x61')])?moment()['format'](_0x91db('0x62')):undefined});}return null;})[_0x91db('0x1e')](function(_0x2880fe){if(_0x2880fe){_0x1faa56[_0x91db('0x63')]=_0x2880fe['get']({'plain':!![]});interaction_log[_0x91db('0x1f')](_0x91db('0x64'),_0x3dfd79[_0x91db('0x5d')]['id'],_0x3dfd79['user'][_0x91db('0x3d')],_0x3dfd79[_0x91db('0x5d')]['role'],_0x1faa56[_0x91db('0x63')]['id'],_0x3dfd79[_0x91db('0x55')]?JSON[_0x91db('0x22')](_0x3dfd79[_0x91db('0x55')]):_0x91db('0x65'));return respondWithRpcPromise('AcceptMessage',_0x91db('0x66'),_0x1faa56);}return null;})[_0x91db('0x1e')](function(_0x43bc6e){var _0x4f1a27='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x43bc6e[_0x91db('0x24')][_0x91db('0x67')];return db[_0x91db('0x68')][_0x91db('0x3e')](_0x4f1a27,{'type':db[_0x91db('0x69')][_0x91db('0x6a')][_0x91db('0x6b')],'raw':!![]})['then'](function(_0xc484d1){return _0xc484d1;});})[_0x91db('0x1e')](function(_0x7f2f12){if(_0x7f2f12){_0x1faa56['message']['contact']=_0x7f2f12[0x0];if(!_0x3dfd79[_0x91db('0x55')][_0x91db('0x5c')])return;return db[_0x91db('0x6c')]['find']({'where':{'id':_0x3dfd79[_0x91db('0x55')][_0x91db('0x5c')],'role':_0x91db('0x5e')},'attributes':['id',_0x91db('0x3d'),_0x91db('0x6d'),_0x91db('0x6e'),_0x91db('0x6f')],'raw':!![]});}return null;})[_0x91db('0x1e')](function(_0x4b80ad){if(!_0x4b80ad)return null;_0x1faa56[_0x91db('0x24')][_0x91db('0x5e')]=_0x4b80ad;return _0x1faa56;})[_0x91db('0x1e')](function(_0xe4a61d){if(_0xe4a61d){if(_0x3dfd79['body'][_0x91db('0x70')]){_0x1faa56['message'][_0x91db('0x71')]=util[_0x91db('0x5b')](_0x91db('0x72'),_0x3dfd79[_0x91db('0x5d')][_0x91db('0x3d')]);_0x1faa56[_0x91db('0x24')]['channel']=_0x1faa56[_0x91db('0x73')];_0x1faa56['message'][_0x91db('0x74')]=_0x1faa56['channel'];_0x1faa56[_0x91db('0x24')][_0x91db('0x75')]=_0x91db('0x59');return respondWithRpcPromise('EventManager',_0x91db('0x76'),{'event':_0x91db('0x77'),'message':_0x1faa56[_0x91db('0x24')]},client9002)[_0x91db('0x1e')](function(){return _0x1faa56;});}return _0x1faa56;}return null;})[_0x91db('0x1e')](respondWithResult(_0x505639,null))[_0x91db('0x26')](handleError(_0x505639,null));};var interaction_log=require(_0x91db('0x57'))(_0x91db('0x58'));exports[_0x91db('0x30')]=function(_0x1e1d71,_0x4de398,_0x221b63){var _0x26b168={'agent':{},'channel':_0x91db('0x78')};if(_0x1e1d71[_0x91db('0x55')]['id']){delete _0x1e1d71[_0x91db('0x55')]['id'];}_0x1e1d71['body'][_0x91db('0x5c')]=_0x1e1d71[_0x91db('0x55')][_0x91db('0x5c')]||_0x1e1d71[_0x91db('0x5d')]['id'];_0x26b168[_0x91db('0x5e')]['id']=_0x1e1d71[_0x91db('0x55')][_0x91db('0x5c')];return db[_0x91db('0x38')][_0x91db('0x53')]({'where':{'id':_0x1e1d71[_0x91db('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4de398,null))['then'](function(_0x373888){if(_0x373888){_0x26b168[_0x91db('0x24')]=_0x373888[_0x91db('0x79')]({'plain':!![]});return db['OpenchannelInteraction'][_0x91db('0x53')]({'where':{'id':_0x373888[_0x91db('0x7a')]}});}return null;})[_0x91db('0x1e')](handleEntityNotFound(_0x4de398,null))[_0x91db('0x1e')](function(_0x5231e9){if(_0x5231e9){_0x26b168['interaction']=_0x5231e9['get']({'plain':!![]});interaction_log[_0x91db('0x1f')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1e1d71[_0x91db('0x5d')]['id'],_0x1e1d71[_0x91db('0x5d')][_0x91db('0x3d')],_0x1e1d71[_0x91db('0x5d')]['role'],_0x26b168[_0x91db('0x63')]['id'],_0x1e1d71[_0x91db('0x55')]?JSON[_0x91db('0x22')](_0x1e1d71[_0x91db('0x55')]):_0x91db('0x65'));return respondWithRpcPromise(_0x91db('0x7b'),_0x91db('0x7c'),_0x26b168);}return null;})[_0x91db('0x1e')](function(_0x55e395){var _0x394a0f=_0x91db('0x7d')+_0x55e395[_0x91db('0x24')][_0x91db('0x67')];return db[_0x91db('0x68')][_0x91db('0x3e')](_0x394a0f,{'type':db[_0x91db('0x69')][_0x91db('0x6a')][_0x91db('0x6b')],'raw':!![]})[_0x91db('0x1e')](function(_0x1c98e1){return _0x1c98e1;});})[_0x91db('0x1e')](function(_0x20ceb4){if(_0x20ceb4){_0x26b168[_0x91db('0x24')]['contact']=_0x20ceb4[0x0];if(!_0x1e1d71[_0x91db('0x55')]['UserId'])return;return db[_0x91db('0x6c')][_0x91db('0x53')]({'where':{'id':_0x1e1d71[_0x91db('0x55')][_0x91db('0x5c')],'role':_0x91db('0x5e')},'attributes':['id','name',_0x91db('0x6d'),'email','internal'],'raw':!![]});}return null;})[_0x91db('0x1e')](function(_0x2f9145){if(!_0x2f9145)return null;_0x26b168[_0x91db('0x24')][_0x91db('0x5e')]=_0x2f9145;return _0x26b168;})[_0x91db('0x1e')](function(_0x5dcf6e){if(_0x5dcf6e){_0x5dcf6e[_0x91db('0x24')]['interface']=util[_0x91db('0x5b')](_0x91db('0x72'),_0x1e1d71[_0x91db('0x5d')][_0x91db('0x3d')]);_0x5dcf6e['message'][_0x91db('0x73')]=_0x26b168['channel'];_0x5dcf6e[_0x91db('0x24')]['motionChannel']=_0x26b168[_0x91db('0x73')];_0x5dcf6e[_0x91db('0x24')]['event']=_0x91db('0x30');respondWithRpcPromise(_0x91db('0x76'),'EventManager',{'event':'rejectmessage','message':_0x5dcf6e[_0x91db('0x24')]},client9002);return _0x26b168;}return null;})[_0x91db('0x1e')](respondWithResult(_0x4de398,null))[_0x91db('0x26')](handleError(_0x4de398,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 3df69f2..b32db29 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 _0x260b=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x378db4,_0x35a97f){var _0x3747d5=function(_0x208362){while(--_0x208362){_0x378db4['push'](_0x378db4['shift']());}};_0x3747d5(++_0x35a97f);}(_0x260b,0x8a));var _0xb260=function(_0x39c081,_0x1604cb){_0x39c081=_0x39c081-0x0;var _0x3aed88=_0x260b[_0x39c081];return _0x3aed88;};'use strict';var EventEmitter=require(_0xb260('0x0'));var OpenchannelMessage=require(_0xb260('0x1'))['db'][_0xb260('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb260('0x3')](0x0);var events={'afterCreate':_0xb260('0x4'),'afterUpdate':_0xb260('0x5'),'afterDestroy':_0xb260('0x6')};function emitEvent(_0x4ffb94){return function(_0x4b3fe2,_0x37b027,_0x32e67a){OpenchannelMessageEvents[_0xb260('0x7')](_0x4ffb94+':'+_0x4b3fe2['id'],_0x4b3fe2);OpenchannelMessageEvents['emit'](_0x4ffb94,_0x4b3fe2);_0x32e67a(null);};}for(var e in events){if(events[_0xb260('0x8')](e)){var event=events[e];OpenchannelMessage[_0xb260('0x9')](e,emitEvent(event));}}module[_0xb260('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x491b=['hook','exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x491b,0x17c));var _0xb491=function(_0x1899e9,_0x142665){_0x1899e9=_0x1899e9-0x0;var _0x399a45=_0x491b[_0x1899e9];return _0x399a45;};'use strict';var EventEmitter=require(_0xb491('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb491('0x1')](0x0);var events={'afterCreate':_0xb491('0x2'),'afterUpdate':_0xb491('0x3'),'afterDestroy':_0xb491('0x4')};function emitEvent(_0x100939){return function(_0x729bb,_0x214671,_0x5aab1d){OpenchannelMessageEvents['emit'](_0x100939+':'+_0x729bb['id'],_0x729bb);OpenchannelMessageEvents[_0xb491('0x5')](_0x100939,_0x729bb);_0x5aab1d(null);};}for(var e in events){if(events[_0xb491('0x6')](e)){var event=events[e];OpenchannelMessage[_0xb491('0x7')](e,emitEvent(event));}}module[_0xb491('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 87e166a..b47e7c3 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 _0xa3ee=['keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','omit','GET','threadId','Interaction','update','OpenchannelMessage,\x20%s,\x20%s','inspect','utf8mb4_unicode_ci','../../config/logger','request-promise','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','catch','OpenchannelAccountId','CmContact','Contact'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa3ee,0xbc));var _0xea3e=function(_0x3d163e,_0x39d438){_0x3d163e=_0x3d163e-0x0;var _0x3e7d89=_0xa3ee[_0x3d163e];return _0x3e7d89;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea3e('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xea3e('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea3e('0x2'));var config=require(_0xea3e('0x3'));var attributes=require('./openchannelMessage.attributes');module[_0xea3e('0x4')]=function(_0x148a30,_0x3e1cab){return _0x148a30[_0xea3e('0x5')](_0xea3e('0x6'),attributes,{'tableName':_0xea3e('0x7'),'paranoid':![],'indexes':[{'name':_0xea3e('0x8'),'fields':[_0xea3e('0x9')],'type':_0xea3e('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c9fce,_0x10000e,_0x8f6703){var _0x40cd84=_0x148a30[_0xea3e('0xb')];var _0x58cf1a=_0x1c9fce[_0xea3e('0xc')]({'plain':!![]});if(_0x58cf1a['direction'][_0xea3e('0xd')]()==='in'||_0x58cf1a[_0xea3e('0xe')]['toLowerCase']()===_0xea3e('0xf')&&!_0x58cf1a[_0xea3e('0x10')]&&!_[_0xea3e('0x11')](_0x58cf1a[_0xea3e('0x12')])){_0x40cd84[_0xea3e('0x13')][_0xea3e('0x14')]({'where':{'id':_0x58cf1a[_0xea3e('0x15')]}})[_0xea3e('0x16')](function(_0x5967de){if(_0x5967de){_0x5967de['update']({'lastMsgAt':_0x58cf1a['createdAt'],'lastMsgDirection':_0x58cf1a['direction'][_0xea3e('0xd')]()});}})[_0xea3e('0x17')](function(_0x3071aa){console['error'](_0x3071aa);});}if(_0x58cf1a[_0xea3e('0xe')]==='out'&&!_0x58cf1a[_0xea3e('0x10')]){var _0x1aecd6;_0x40cd84['CmContact']['describe']()[_0xea3e('0x16')](function(_0x33c718){return _0x40cd84['OpenchannelAccount']['find']({'where':{'id':_0x58cf1a[_0xea3e('0x18')]},'include':[{'model':_0x40cd84['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x58cf1a[_0xea3e('0x15')]},'limit':0x1,'include':[{'model':_0x40cd84[_0xea3e('0x19')],'as':_0xea3e('0x1a'),'attributes':_[_0xea3e('0x1b')](_0x33c718)}]}]});})[_0xea3e('0x16')](function(_0x543636){_0x1aecd6=_0x543636['get']({'plain':!![]});if(_0x1aecd6&&_0x1aecd6[_0xea3e('0x1c')]){logger[_0xea3e('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0xea3e('0x1e'),util[_0xea3e('0x1f')](_0xea3e('0x20'),_0x58cf1a['id'],_0x1aecd6['replyUri']));if(_0x1aecd6[_0xea3e('0x21')]&&_0x1aecd6[_0xea3e('0x21')][_0xea3e('0x22')]){_0x58cf1a['Interaction']=_[_0xea3e('0x23')](_0x1aecd6[_0xea3e('0x21')][0x0],_0xea3e('0x1a'));_0x58cf1a[_0xea3e('0x1a')]=_0x1aecd6[_0xea3e('0x21')][0x0][_0xea3e('0x1a')];}var _0x10000e={'method':'POST','uri':encodeURI(_0x1aecd6['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x10000e['method']){case _0xea3e('0x24'):_0x10000e['qs']=_0x58cf1a;break;case'POST':_0x10000e[_0xea3e('0x9')]=_0x58cf1a;break;}return rp(_0x10000e)['then'](function(_0xdfd31f){logger[_0xea3e('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0xea3e('0x1e'),util[_0xea3e('0x1f')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x58cf1a['id'],_0x1aecd6['replyUri']));if(_0xdfd31f[_0xea3e('0x9')][_0xea3e('0x25')]&&_0xdfd31f[_0xea3e('0x9')][_0xea3e('0x25')]!=_0x58cf1a[_0xea3e('0x26')][_0xea3e('0x25')]){return _0x40cd84['OpenchannelInteraction']['update']({'threadId':_0xdfd31f[_0xea3e('0x9')]['threadId']},{'where':{'id':_0x58cf1a['Interaction']['id']}});}else{return;}})[_0xea3e('0x16')](function(){return _0x1c9fce[_0xea3e('0x27')]({'read':!![]});})['catch'](function(_0x148fee){logger['error'](_0xea3e('0x28'),_0xea3e('0x1e'),util[_0xea3e('0x29')](_0x148fee,{'showHidden':![],'depth':null}));_0x8f6703();});}else{_0x8f6703();}})['finally'](function(){_0x8f6703();});}else{_0x8f6703();}}},'charset':'utf8mb4','collate':_0xea3e('0x2a')});}; \ No newline at end of file +var _0x442c=['models','get','direction','out','secret','UserId','OpenchannelInteraction','findOne','then','update','toLowerCase','catch','CmContact','describe','OpenchannelAccount','Interactions','OpenchannelInteractionId','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','length','Interaction','omit','Contact','POST','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','body'];(function(_0x3ed388,_0x423fd6){var _0x5af25e=function(_0x406f3d){while(--_0x406f3d){_0x3ed388['push'](_0x3ed388['shift']());}};_0x5af25e(++_0x423fd6);}(_0x442c,0x1a3));var _0xc442=function(_0x1a3a63,_0x424db7){_0x1a3a63=_0x1a3a63-0x0;var _0x20e253=_0x442c[_0x1a3a63];return _0x20e253;};'use strict';var _=require('lodash');var util=require(_0xc442('0x0'));var logger=require(_0xc442('0x1'))('api');var moment=require(_0xc442('0x2'));var BPromise=require(_0xc442('0x3'));var rp=require(_0xc442('0x4'));var fs=require('fs');var path=require(_0xc442('0x5'));var rimraf=require(_0xc442('0x6'));var config=require(_0xc442('0x7'));var attributes=require(_0xc442('0x8'));module[_0xc442('0x9')]=function(_0x4734df,_0x1e5719){return _0x4734df[_0xc442('0xa')]('OpenchannelMessage',attributes,{'tableName':_0xc442('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xc442('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4136ac,_0x36d956,_0x4392c4){var _0x32885c=_0x4734df[_0xc442('0xd')];var _0x5f5852=_0x4136ac[_0xc442('0xe')]({'plain':!![]});if(_0x5f5852[_0xc442('0xf')]['toLowerCase']()==='in'||_0x5f5852[_0xc442('0xf')]['toLowerCase']()===_0xc442('0x10')&&!_0x5f5852[_0xc442('0x11')]&&!_['isNil'](_0x5f5852[_0xc442('0x12')])){_0x32885c[_0xc442('0x13')][_0xc442('0x14')]({'where':{'id':_0x5f5852['OpenchannelInteractionId']}})[_0xc442('0x15')](function(_0x4f7f42){if(_0x4f7f42){_0x4f7f42[_0xc442('0x16')]({'lastMsgAt':_0x5f5852['createdAt'],'lastMsgDirection':_0x5f5852['direction'][_0xc442('0x17')]()});}})[_0xc442('0x18')](function(_0x38cbac){console['error'](_0x38cbac);});}if(_0x5f5852[_0xc442('0xf')]===_0xc442('0x10')&&!_0x5f5852['secret']){var _0x4f2471;_0x32885c[_0xc442('0x19')][_0xc442('0x1a')]()['then'](function(_0x9c2121){return _0x32885c[_0xc442('0x1b')]['find']({'where':{'id':_0x5f5852['OpenchannelAccountId']},'include':[{'model':_0x32885c[_0xc442('0x13')],'as':_0xc442('0x1c'),'where':{'id':_0x5f5852[_0xc442('0x1d')]},'limit':0x1,'include':[{'model':_0x32885c[_0xc442('0x19')],'as':'Contact','attributes':_['keys'](_0x9c2121)}]}]});})[_0xc442('0x15')](function(_0x8963f2){_0x4f2471=_0x8963f2['get']({'plain':!![]});if(_0x4f2471&&_0x4f2471[_0xc442('0x1e')]){logger[_0xc442('0x1f')](_0xc442('0x20'),'afterCreate',util[_0xc442('0x21')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5f5852['id'],_0x4f2471[_0xc442('0x1e')]));if(_0x4f2471[_0xc442('0x1c')]&&_0x4f2471[_0xc442('0x1c')][_0xc442('0x22')]){_0x5f5852[_0xc442('0x23')]=_[_0xc442('0x24')](_0x4f2471[_0xc442('0x1c')][0x0],_0xc442('0x25'));_0x5f5852[_0xc442('0x25')]=_0x4f2471[_0xc442('0x1c')][0x0][_0xc442('0x25')];}var _0x36d956={'method':_0xc442('0x26'),'uri':encodeURI(_0x4f2471[_0xc442('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x36d956[_0xc442('0x27')]){case _0xc442('0x28'):_0x36d956['qs']=_0x5f5852;break;case _0xc442('0x26'):_0x36d956['body']=_0x5f5852;break;}return rp(_0x36d956)[_0xc442('0x15')](function(_0x407a6f){logger[_0xc442('0x1f')](_0xc442('0x20'),_0xc442('0x29'),util['format'](_0xc442('0x2a'),_0x5f5852['id'],_0x4f2471['replyUri']));if(_0x407a6f[_0xc442('0xc')][_0xc442('0x2b')]&&_0x407a6f[_0xc442('0xc')][_0xc442('0x2b')]!=_0x5f5852['Interaction'][_0xc442('0x2b')]){return _0x32885c['OpenchannelInteraction'][_0xc442('0x16')]({'threadId':_0x407a6f['body'][_0xc442('0x2b')]},{'where':{'id':_0x5f5852[_0xc442('0x23')]['id']}});}else{return;}})[_0xc442('0x15')](function(){return _0x4136ac[_0xc442('0x16')]({'read':!![]});})[_0xc442('0x18')](function(_0x30b66a){logger[_0xc442('0x2c')](_0xc442('0x20'),_0xc442('0x29'),util[_0xc442('0x2d')](_0x30b66a,{'showHidden':![],'depth':null}));_0x4392c4();});}else{_0x4392c4();}})[_0xc442('0x2e')](function(){_0x4392c4();});}else{_0x4392c4();}}},'charset':'utf8mb4','collate':_0xc442('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index d936251..7d72989 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 _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x260300,_0x4b57e2){var _0x515ebb=function(_0x5750ca){while(--_0x5750ca){_0x260300['push'](_0x260300['shift']());}};_0x515ebb(++_0x4b57e2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xea4e51,_0x4ae384){var _0x3a1583=function(_0x119b6f){while(--_0x119b6f){_0xea4e51['push'](_0xea4e51['shift']());}};_0x3a1583(++_0x4ae384);}(_0x7a54,0x106));var _0x47a5=function(_0xab7a58,_0x189898){_0xab7a58=_0xab7a58-0x0;var _0x597aac=_0x7a54[_0xab7a58];return _0x597aac;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index f896424..19a7b56 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 _0x66e2=['register','length','openchannelMessage:','./openchannelMessage.events','save','emit'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x66e2,0x105));var _0x266e=function(_0x2142ea,_0x5a8f39){_0x2142ea=_0x2142ea-0x0;var _0x53e2a9=_0x66e2[_0x2142ea];return _0x53e2a9;};'use strict';var OpenchannelMessageEvents=require(_0x266e('0x0'));var events=[_0x266e('0x1'),'remove','update'];function createListener(_0x2196e7,_0x15549b){return function(_0x195c54){_0x15549b[_0x266e('0x2')](_0x2196e7,_0x195c54);};}function removeListener(_0x460288,_0x300cf7){return function(){OpenchannelMessageEvents['removeListener'](_0x460288,_0x300cf7);};}exports[_0x266e('0x3')]=function(_0x25e1ab){for(var _0x288ede=0x0,_0x1107d0=events[_0x266e('0x4')];_0x288ede<_0x1107d0;_0x288ede++){var _0x2ddd10=events[_0x288ede];var _0x51442e=createListener(_0x266e('0x5')+_0x2ddd10,_0x25e1ab);OpenchannelMessageEvents['on'](_0x2ddd10,_0x51442e);}}; \ No newline at end of file +var _0x425d=['save','remove','update','emit','removeListener','length','./openchannelMessage.events'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x425d,0x179));var _0xd425=function(_0x1ccda4,_0x1647d3){_0x1ccda4=_0x1ccda4-0x0;var _0x334196=_0x425d[_0x1ccda4];return _0x334196;};'use strict';var OpenchannelMessageEvents=require(_0xd425('0x0'));var events=[_0xd425('0x1'),_0xd425('0x2'),_0xd425('0x3')];function createListener(_0x22f12f,_0x50eee4){return function(_0x1f10db){_0x50eee4[_0xd425('0x4')](_0x22f12f,_0x1f10db);};}function removeListener(_0x1a8186,_0x5127d8){return function(){OpenchannelMessageEvents[_0xd425('0x5')](_0x1a8186,_0x5127d8);};}exports['register']=function(_0x4377e9){for(var _0x3b6510=0x0,_0x4c7ed5=events[_0xd425('0x6')];_0x3b6510<_0x4c7ed5;_0x3b6510++){var _0x37cda8=events[_0x3b6510];var _0x3a047c=createListener('openchannelMessage:'+_0x37cda8,_0x4377e9);OpenchannelMessageEvents['on'](_0x37cda8,_0x3a047c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index a492f1e..ead3859 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 _0xcc0e=['get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','update','destroy','delete','removeTeams','removeAgents','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller'];(function(_0xc74fbf,_0x59a3e6){var _0x2840cb=function(_0x2ba976){while(--_0x2ba976){_0xc74fbf['push'](_0xc74fbf['shift']());}};_0x2840cb(++_0x59a3e6);}(_0xcc0e,0x1de));var _0xecc0=function(_0x4a4433,_0x4a052f){_0x4a4433=_0x4a4433-0x0;var _0x25af8a=_0xcc0e[_0x4a4433];return _0x25af8a;};'use strict';var multer=require('multer');var util=require(_0xecc0('0x0'));var path=require(_0xecc0('0x1'));var timeout=require(_0xecc0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xecc0('0x3'));var auth=require(_0xecc0('0x4'));var interaction=require(_0xecc0('0x5'));var config=require(_0xecc0('0x6'));var controller=require(_0xecc0('0x7'));router[_0xecc0('0x8')]('/',auth[_0xecc0('0x9')](),controller[_0xecc0('0xa')]);router[_0xecc0('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xecc0('0xb')]);router[_0xecc0('0x8')](_0xecc0('0xc'),auth[_0xecc0('0x9')](),controller[_0xecc0('0xd')]);router['get'](_0xecc0('0xe'),auth['isAuthenticated'](),controller[_0xecc0('0xf')]);router['get'](_0xecc0('0x10'),auth[_0xecc0('0x9')](),controller['getTeams']);router[_0xecc0('0x8')](_0xecc0('0x11'),auth[_0xecc0('0x9')](),controller[_0xecc0('0x12')]);router[_0xecc0('0x13')]('/',auth[_0xecc0('0x9')](),controller[_0xecc0('0x14')]);router[_0xecc0('0x13')](_0xecc0('0x10'),auth[_0xecc0('0x9')](),controller['addTeams']);router[_0xecc0('0x13')](_0xecc0('0x11'),auth['isAuthenticated'](),controller[_0xecc0('0x15')]);router['put'](_0xecc0('0xc'),auth[_0xecc0('0x9')](),controller[_0xecc0('0x16')]);router['delete'](_0xecc0('0xc'),auth['isAuthenticated'](),controller[_0xecc0('0x17')]);router[_0xecc0('0x18')](_0xecc0('0x10'),auth[_0xecc0('0x9')](),controller[_0xecc0('0x19')]);router[_0xecc0('0x18')](_0xecc0('0x11'),auth[_0xecc0('0x9')](),controller[_0xecc0('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x9848=['removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','index','get','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','delete','destroy'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9848,0x14d));var _0x8984=function(_0x53df47,_0x5b8326){_0x53df47=_0x53df47-0x0;var _0x2fb0f2=_0x9848[_0x53df47];return _0x2fb0f2;};'use strict';var multer=require('multer');var util=require(_0x8984('0x0'));var path=require(_0x8984('0x1'));var timeout=require(_0x8984('0x2'));var express=require(_0x8984('0x3'));var router=express[_0x8984('0x4')]();var fs_extra=require(_0x8984('0x5'));var auth=require(_0x8984('0x6'));var interaction=require(_0x8984('0x7'));var config=require(_0x8984('0x8'));var controller=require(_0x8984('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8984('0xa')]);router[_0x8984('0xb')]('/describe',auth[_0x8984('0xc')](),controller[_0x8984('0xd')]);router[_0x8984('0xb')](_0x8984('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x8984('0xb')](_0x8984('0xf'),auth['isAuthenticated'](),controller[_0x8984('0x10')]);router['get'](_0x8984('0x11'),auth[_0x8984('0xc')](),controller[_0x8984('0x12')]);router['get'](_0x8984('0x13'),auth[_0x8984('0xc')](),controller[_0x8984('0x14')]);router[_0x8984('0x15')]('/',auth[_0x8984('0xc')](),controller[_0x8984('0x16')]);router[_0x8984('0x15')](_0x8984('0x11'),auth[_0x8984('0xc')](),controller[_0x8984('0x17')]);router[_0x8984('0x15')](_0x8984('0x13'),auth[_0x8984('0xc')](),controller['addAgents']);router[_0x8984('0x18')](_0x8984('0xe'),auth[_0x8984('0xc')](),controller['update']);router[_0x8984('0x19')](_0x8984('0xe'),auth[_0x8984('0xc')](),controller[_0x8984('0x1a')]);router[_0x8984('0x19')](_0x8984('0x11'),auth['isAuthenticated'](),controller[_0x8984('0x1b')]);router[_0x8984('0x19')](_0x8984('0x13'),auth[_0x8984('0xc')](),controller[_0x8984('0x1c')]);module[_0x8984('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ec4571a..440bb3f 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 _0xae3c=['beepall','roundrobin','sequelize','exports','name','STRING','ENUM','rrmemory'];(function(_0x150fa2,_0x156632){var _0x88e6ba=function(_0x23536e){while(--_0x23536e){_0x150fa2['push'](_0x150fa2['shift']());}};_0x88e6ba(++_0x156632);}(_0xae3c,0x1ca));var _0xcae3=function(_0x38ff1e,_0x3b9385){_0x38ff1e=_0x38ff1e-0x0;var _0x3755d4=_0xae3c[_0x38ff1e];return _0x3755d4;};'use strict';var Sequelize=require(_0xcae3('0x0'));module[_0xcae3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcae3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcae3('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcae3('0x4')](_0xcae3('0x5'),_0xcae3('0x6'),_0xcae3('0x7'))}}; \ No newline at end of file +var _0xe669=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x459879,_0x16b25d){var _0xa84228=function(_0x28d85b){while(--_0x28d85b){_0x459879['push'](_0x459879['shift']());}};_0xa84228(++_0x16b25d);}(_0xe669,0x137));var _0x9e66=function(_0x553150,_0x589ff3){_0x553150=_0x553150-0x0;var _0x18193d=_0xe669[_0x553150];return _0x18193d;};'use strict';var Sequelize=require(_0x9e66('0x0'));module[_0x9e66('0x1')]={'name':{'type':Sequelize[_0x9e66('0x2')],'unique':_0x9e66('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9e66('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9e66('0x5'),_0x9e66('0x6'),_0x9e66('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index e382659..6ac9ead 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 _0xdf5d=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','where','VIRTUAL','filter','merge','options','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','sort','OpenchannelQueueId','UserOpenchannelQueue','UserId','agent','createdAt','format','%s/%s','openchannelPause','updatedAt','getTeams','addTeams','ids','Team','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','field','from','team_has_openchannel_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./openchannelQueue.socket','register','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf5d,0x187));var _0xddf5=function(_0x11abba,_0x56a4b6){_0x11abba=_0x11abba-0x0;var _0x1e8081=_0xdf5d[_0x11abba];return _0x1e8081;};'use strict';var emlformat=require(_0xddf5('0x0'));var rimraf=require(_0xddf5('0x1'));var zipdir=require(_0xddf5('0x2'));var jsonpatch=require(_0xddf5('0x3'));var rp=require(_0xddf5('0x4'));var moment=require(_0xddf5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xddf5('0x6'));var util=require(_0xddf5('0x7'));var path=require('path');var sox=require(_0xddf5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddf5('0x9'));var _=require('lodash');var squel=require(_0xddf5('0xa'));var crypto=require(_0xddf5('0xb'));var jsforce=require(_0xddf5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xddf5('0xd'));var Redis=require(_0xddf5('0xe'));var authService=require(_0xddf5('0xf'));var qs=require(_0xddf5('0x10'));var as=require(_0xddf5('0x11'));var hardwareService=require(_0xddf5('0x12'));var logger=require('../../config/logger')(_0xddf5('0x13'));var utils=require(_0xddf5('0x14'));var config=require(_0xddf5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xddf5('0x16'))['db'];config[_0xddf5('0x17')]=_['defaults'](config[_0xddf5('0x17')],{'host':_0xddf5('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xddf5('0x17')]));require(_0xddf5('0x19'))[_0xddf5('0x1a')](socket);function respondWithStatusCode(_0x5a756e,_0x2717be){_0x2717be=_0x2717be||0xcc;return function(_0x6d57dc){if(_0x6d57dc){return _0x5a756e[_0xddf5('0x1b')](_0x2717be);}return _0x5a756e[_0xddf5('0x1c')](_0x2717be)[_0xddf5('0x1d')]();};}function respondWithResult(_0x2573e9,_0xc9245d){_0xc9245d=_0xc9245d||0xc8;return function(_0x59bbae){if(_0x59bbae){return _0x2573e9[_0xddf5('0x1c')](_0xc9245d)[_0xddf5('0x1e')](_0x59bbae);}};}function respondWithFilteredResult(_0x31475f,_0x2c3a7c){return function(_0x2671eb){if(_0x2671eb){var _0x5ee8e7=typeof _0x2c3a7c[_0xddf5('0x1f')]===_0xddf5('0x20')&&typeof _0x2c3a7c[_0xddf5('0x21')]===_0xddf5('0x20');var _0x58b9c7=_0x2671eb[_0xddf5('0x22')];var _0x3cf9ae=_0x5ee8e7?0x0:_0x2c3a7c[_0xddf5('0x1f')];var _0x28e8bc=_0x5ee8e7?_0x2671eb['count']:_0x2c3a7c[_0xddf5('0x1f')]+_0x2c3a7c[_0xddf5('0x21')];var _0x2e6242;if(_0x28e8bc>=_0x58b9c7){_0x28e8bc=_0x58b9c7;_0x2e6242=0xc8;}else{_0x2e6242=0xce;}_0x31475f[_0xddf5('0x1c')](_0x2e6242);return _0x31475f[_0xddf5('0x23')](_0xddf5('0x24'),_0x3cf9ae+'-'+_0x28e8bc+'/'+_0x58b9c7)[_0xddf5('0x1e')](_0x2671eb);}return null;};}function patchUpdates(_0x354279){return function(_0x38d1a8){try{jsonpatch[_0xddf5('0x25')](_0x38d1a8,_0x354279,!![]);}catch(_0x27a2ee){return BPromise[_0xddf5('0x26')](_0x27a2ee);}return _0x38d1a8[_0xddf5('0x27')]();};}function saveUpdates(_0x354b8b,_0x4e89cb){return function(_0x1fd513){if(_0x1fd513){return _0x1fd513[_0xddf5('0x28')](_0x354b8b)[_0xddf5('0x29')](function(_0x572efb){return _0x572efb;});}return null;};}function removeEntity(_0x22621d,_0x104ec9){return function(_0x15dc09){if(_0x15dc09){return _0x15dc09[_0xddf5('0x2a')]()[_0xddf5('0x29')](function(){var _0x20d83b=_0x15dc09[_0xddf5('0x2b')]({'plain':!![]});var _0x400f13=_0xddf5('0x2c');return db['UserProfileResource'][_0xddf5('0x2a')]({'where':{'type':_0x400f13,'resourceId':_0x20d83b['id']}})[_0xddf5('0x29')](function(){return _0x15dc09;});})[_0xddf5('0x29')](function(){_0x22621d[_0xddf5('0x1c')](0xcc)[_0xddf5('0x1d')]();});}};}function handleEntityNotFound(_0x247c1f,_0x3d50fa){return function(_0x219aca){if(!_0x219aca){_0x247c1f[_0xddf5('0x1b')](0x194);}return _0x219aca;};}function handleError(_0x5e21ec,_0x34a5c1){_0x34a5c1=_0x34a5c1||0x1f4;return function(_0x5a0457){logger[_0xddf5('0x2d')](_0x5a0457['stack']);if(_0x5a0457[_0xddf5('0x2e')]){delete _0x5a0457['name'];}_0x5e21ec[_0xddf5('0x1c')](_0x34a5c1)[_0xddf5('0x2f')](_0x5a0457);};}exports[_0xddf5('0x30')]=function(_0x4b7c75,_0x219b01){var _0x5777cc={},_0x7837d5={},_0x4974c9={'count':0x0,'rows':[]};var _0x7fbe62=_[_0xddf5('0x31')](db[_0xddf5('0x32')][_0xddf5('0x33')],function(_0x37025d){return{'name':_0x37025d[_0xddf5('0x34')],'type':_0x37025d[_0xddf5('0x35')][_0xddf5('0x36')]};});_0x7837d5[_0xddf5('0x37')]=_[_0xddf5('0x31')](_0x7fbe62,_0xddf5('0x2e'));_0x7837d5[_0xddf5('0x38')]=_[_0xddf5('0x39')](_0x4b7c75['query']);_0x7837d5[_0xddf5('0x3a')]=_[_0xddf5('0x3b')](_0x7837d5[_0xddf5('0x37')],_0x7837d5['query']);_0x5777cc[_0xddf5('0x3c')]=_[_0xddf5('0x3b')](_0x7837d5['model'],qs[_0xddf5('0x3d')](_0x4b7c75['query'][_0xddf5('0x3d')]));_0x5777cc['attributes']=_0x5777cc[_0xddf5('0x3c')][_0xddf5('0x3e')]?_0x5777cc[_0xddf5('0x3c')]:_0x7837d5[_0xddf5('0x37')];if(!_0x4b7c75[_0xddf5('0x38')]['hasOwnProperty'](_0xddf5('0x3f'))){_0x5777cc[_0xddf5('0x21')]=qs[_0xddf5('0x21')](_0x4b7c75[_0xddf5('0x38')][_0xddf5('0x21')]);_0x5777cc[_0xddf5('0x1f')]=qs[_0xddf5('0x1f')](_0x4b7c75[_0xddf5('0x38')][_0xddf5('0x1f')]);}_0x5777cc[_0xddf5('0x40')]=qs['sort'](_0x4b7c75[_0xddf5('0x38')]['sort']);_0x5777cc['where']=qs['filters'](_[_0xddf5('0x41')](_0x4b7c75['query'],_0x7837d5[_0xddf5('0x3a')]),_0x7fbe62);if(_0x4b7c75[_0xddf5('0x38')]['filter']){_0x5777cc['where']=_['merge'](_0x5777cc[_0xddf5('0x42')],{'$or':_[_0xddf5('0x31')](_0x7fbe62,function(_0x16b667){if(_0x16b667[_0xddf5('0x35')]!==_0xddf5('0x43')){var _0x165248={};_0x165248[_0x16b667[_0xddf5('0x2e')]]={'$like':'%'+_0x4b7c75[_0xddf5('0x38')][_0xddf5('0x44')]+'%'};return _0x165248;}})});}_0x5777cc=_[_0xddf5('0x45')]({},_0x5777cc,_0x4b7c75[_0xddf5('0x46')]);var _0xd50a7d={'where':_0x5777cc[_0xddf5('0x42')]};return db[_0xddf5('0x32')][_0xddf5('0x22')](_0xd50a7d)[_0xddf5('0x29')](function(_0x164648){_0x4974c9[_0xddf5('0x22')]=_0x164648;if(_0x4b7c75[_0xddf5('0x38')]['includeAll']){_0x5777cc['include']=[{'all':!![]}];}return db[_0xddf5('0x32')][_0xddf5('0x47')](_0x5777cc);})['then'](function(_0x3bc51b){_0x4974c9[_0xddf5('0x48')]=_0x3bc51b;return _0x4974c9;})[_0xddf5('0x29')](respondWithFilteredResult(_0x219b01,_0x5777cc))[_0xddf5('0x49')](handleError(_0x219b01,null));};exports[_0xddf5('0x4a')]=function(_0x566a3e,_0x4a56b5){var _0x3f8ae2={'raw':!![],'where':{'id':_0x566a3e[_0xddf5('0x4b')]['id']}},_0x19abe7={};_0x19abe7[_0xddf5('0x37')]=_[_0xddf5('0x39')](db[_0xddf5('0x32')]['rawAttributes']);_0x19abe7['query']=_[_0xddf5('0x39')](_0x566a3e['query']);_0x19abe7[_0xddf5('0x3a')]=_[_0xddf5('0x3b')](_0x19abe7[_0xddf5('0x37')],_0x19abe7[_0xddf5('0x38')]);_0x3f8ae2[_0xddf5('0x3c')]=_[_0xddf5('0x3b')](_0x19abe7['model'],qs[_0xddf5('0x3d')](_0x566a3e[_0xddf5('0x38')][_0xddf5('0x3d')]));_0x3f8ae2[_0xddf5('0x3c')]=_0x3f8ae2[_0xddf5('0x3c')]['length']?_0x3f8ae2[_0xddf5('0x3c')]:_0x19abe7[_0xddf5('0x37')];if(_0x566a3e[_0xddf5('0x38')][_0xddf5('0x4c')]){_0x3f8ae2['include']=[{'all':!![]}];}_0x3f8ae2=_[_0xddf5('0x45')]({},_0x3f8ae2,_0x566a3e['options']);return db[_0xddf5('0x32')][_0xddf5('0x4d')](_0x3f8ae2)[_0xddf5('0x29')](handleEntityNotFound(_0x4a56b5,null))['then'](respondWithResult(_0x4a56b5,null))[_0xddf5('0x49')](handleError(_0x4a56b5,null));};exports[_0xddf5('0x4e')]=function(_0x260b07,_0x5cbfbd){return db['OpenchannelQueue'][_0xddf5('0x4e')](_0x260b07[_0xddf5('0x4f')],{})['then'](function(_0x4bee5c){var _0x5d1752=_0x260b07['user'][_0xddf5('0x2b')]({'plain':!![]});if(!_0x5d1752)throw new Error(_0xddf5('0x50'));if(_0x5d1752[_0xddf5('0x51')]==='user'){var _0x243039=_0x4bee5c['get']({'plain':!![]});var _0x350c8a=_0xddf5('0x2c');return db[_0xddf5('0x52')][_0xddf5('0x4d')]({'where':{'name':_0x350c8a,'userProfileId':_0x5d1752[_0xddf5('0x53')]},'raw':!![]})[_0xddf5('0x29')](function(_0x47731e){if(_0x47731e&&_0x47731e['autoAssociation']===0x0){return db[_0xddf5('0x54')][_0xddf5('0x4e')]({'name':_0x243039[_0xddf5('0x2e')],'resourceId':_0x243039['id'],'type':_0x47731e[_0xddf5('0x2e')],'sectionId':_0x47731e['id']},{})['then'](function(){return _0x4bee5c;});}else{return _0x4bee5c;}})[_0xddf5('0x49')](function(_0x15a855){logger['error'](_0xddf5('0x55'),_0x15a855);throw _0x15a855;});}return _0x4bee5c;})['then'](respondWithResult(_0x5cbfbd,0xc9))[_0xddf5('0x49')](handleError(_0x5cbfbd,null));};exports[_0xddf5('0x28')]=function(_0x4fd674,_0x561eee){if(_0x4fd674[_0xddf5('0x4f')]['id']){delete _0x4fd674[_0xddf5('0x4f')]['id'];}return db[_0xddf5('0x32')][_0xddf5('0x4d')]({'where':{'id':_0x4fd674['params']['id']}})[_0xddf5('0x29')](handleEntityNotFound(_0x561eee,null))['then'](saveUpdates(_0x4fd674[_0xddf5('0x4f')],null))[_0xddf5('0x29')](respondWithResult(_0x561eee,null))[_0xddf5('0x49')](handleError(_0x561eee,null));};exports[_0xddf5('0x2a')]=function(_0x1a953a,_0x32db3b){return db[_0xddf5('0x32')]['find']({'where':{'id':_0x1a953a['params']['id']}})[_0xddf5('0x29')](handleEntityNotFound(_0x32db3b,null))[_0xddf5('0x29')](removeEntity(_0x32db3b,null))[_0xddf5('0x49')](handleError(_0x32db3b,null));};exports[_0xddf5('0x56')]=function(_0x4cf32c,_0x1adea7){return db[_0xddf5('0x32')]['describe']()[_0xddf5('0x29')](respondWithResult(_0x1adea7,null))[_0xddf5('0x49')](handleError(_0x1adea7,null));};exports[_0xddf5('0x57')]=function(_0x509915,_0xfb5569,_0x529b9f){var _0x450267={'raw':!![],'where':{}},_0x2d93df={},_0x33f29b;return db[_0xddf5('0x32')][_0xddf5('0x58')]({'where':{'id':_0x509915[_0xddf5('0x4b')]['id']}})[_0xddf5('0x29')](handleEntityNotFound(_0xfb5569,null))[_0xddf5('0x29')](function(_0x5f074c){if(_0x5f074c){_0x33f29b=_0x5f074c[_0xddf5('0x2b')]({'plain':!![]});_0x2d93df['model']=_[_0xddf5('0x39')](db['UserOpenchannelQueue'][_0xddf5('0x33')]);_0x2d93df[_0xddf5('0x38')]=_[_0xddf5('0x39')](_0x509915[_0xddf5('0x38')]);_0x2d93df[_0xddf5('0x3a')]=_[_0xddf5('0x3b')](_0x2d93df[_0xddf5('0x37')],_0x2d93df[_0xddf5('0x38')]);_0x450267[_0xddf5('0x3c')]=_[_0xddf5('0x3b')](_0x2d93df[_0xddf5('0x37')],qs[_0xddf5('0x3d')](_0x509915[_0xddf5('0x38')][_0xddf5('0x3d')]));_0x450267['attributes']=_0x450267['attributes'][_0xddf5('0x3e')]?_0x450267[_0xddf5('0x3c')]:_0x2d93df['model'];if(!_0x509915[_0xddf5('0x38')][_0xddf5('0x59')](_0xddf5('0x3f'))){_0x450267['limit']=qs[_0xddf5('0x21')](_0x509915[_0xddf5('0x38')]['limit']);_0x450267[_0xddf5('0x1f')]=qs['offset'](_0x509915[_0xddf5('0x38')]['offset']);}_0x450267[_0xddf5('0x40')]=qs[_0xddf5('0x5a')](_0x509915[_0xddf5('0x38')][_0xddf5('0x5a')]);_0x450267[_0xddf5('0x42')]=qs[_0xddf5('0x3a')](_[_0xddf5('0x41')](_0x509915[_0xddf5('0x38')],_0x2d93df[_0xddf5('0x3a')]));_0x450267[_0xddf5('0x42')][_0xddf5('0x5b')]=_0x5f074c['id'];if(_0x509915['query'][_0xddf5('0x44')]){_0x450267['where']=_[_0xddf5('0x45')](_0x450267[_0xddf5('0x42')],{'$or':_[_0xddf5('0x31')](_0x450267[_0xddf5('0x3c')],function(_0x21acbc){var _0xf05566={};_0xf05566[_0x21acbc]={'$like':'%'+_0x509915['query'][_0xddf5('0x44')]+'%'};return _0xf05566;})});}_0x450267=_[_0xddf5('0x45')]({},_0x450267,_0x509915[_0xddf5('0x46')]);return db[_0xddf5('0x5c')][_0xddf5('0x47')](_0x450267);}})['then'](function(_0x5ed436){if(_0x5ed436){return db['User']['findAndCountAll']({'where':{'id':_[_0xddf5('0x31')](_0x5ed436,_0xddf5('0x5d')),'role':_0xddf5('0x5e')},'attributes':['id',_0xddf5('0x2e'),'openchannelPause','updatedAt',_0xddf5('0x5f')]});}})[_0xddf5('0x29')](function(_0x12e69c){if(_0x12e69c){return{'count':_0x12e69c[_0xddf5('0x22')],'rows':_['map'](_0x12e69c[_0xddf5('0x48')],function(_0x141eea){return{'membername':_0x141eea['name'],'UserId':_0x141eea['id'],'queue_name':_0x33f29b[_0xddf5('0x2e')],'OpenchannelQueueId':_0x33f29b['id'],'interface':util[_0xddf5('0x60')](_0xddf5('0x61'),'SIP',_0x141eea['name']),'penalty':0x0,'paused':_0x141eea[_0xddf5('0x62')],'createdAt':_0x141eea[_0xddf5('0x5f')],'updatedAt':_0x141eea[_0xddf5('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xddf5('0x29')](respondWithFilteredResult(_0xfb5569,_0x450267))[_0xddf5('0x49')](handleError(_0xfb5569,null));};exports['getTeams']=function(_0x5ce947,_0x1786ef,_0x5b853c){var _0x58ca53={};var _0xfb90ed={};var _0x4ea300;var _0x11a787;return db[_0xddf5('0x32')][_0xddf5('0x58')]({'where':{'id':_0x5ce947['params']['id']}})['then'](handleEntityNotFound(_0x1786ef,null))[_0xddf5('0x29')](function(_0x5307c8){if(_0x5307c8){_0x4ea300=_0x5307c8;_0xfb90ed[_0xddf5('0x37')]=_[_0xddf5('0x39')](db['Team'][_0xddf5('0x33')]);_0xfb90ed[_0xddf5('0x38')]=_[_0xddf5('0x39')](_0x5ce947[_0xddf5('0x38')]);_0xfb90ed[_0xddf5('0x3a')]=_['intersection'](_0xfb90ed[_0xddf5('0x37')],_0xfb90ed[_0xddf5('0x38')]);_0x58ca53['attributes']=_['intersection'](_0xfb90ed[_0xddf5('0x37')],qs[_0xddf5('0x3d')](_0x5ce947[_0xddf5('0x38')]['fields']));_0x58ca53[_0xddf5('0x3c')]=_0x58ca53['attributes']['length']?_0x58ca53[_0xddf5('0x3c')]:_0xfb90ed[_0xddf5('0x37')];_0x58ca53['order']=qs[_0xddf5('0x5a')](_0x5ce947['query']['sort']);_0x58ca53[_0xddf5('0x42')]=qs['filters'](_[_0xddf5('0x41')](_0x5ce947[_0xddf5('0x38')],_0xfb90ed[_0xddf5('0x3a')]));if(_0x5ce947[_0xddf5('0x38')][_0xddf5('0x44')]){_0x58ca53['where']=_[_0xddf5('0x45')](_0x58ca53['where'],{'$or':_[_0xddf5('0x31')](_0x58ca53[_0xddf5('0x3c')],function(_0x28a6c5){var _0x4dac40={};_0x4dac40[_0x28a6c5]={'$like':'%'+_0x5ce947['query'][_0xddf5('0x44')]+'%'};return _0x4dac40;})});}_0x58ca53=_['merge']({},_0x58ca53,_0x5ce947[_0xddf5('0x46')]);return _0x4ea300[_0xddf5('0x64')](_0x58ca53);}})[_0xddf5('0x29')](function(_0x37ee48){if(_0x37ee48){_0x11a787=_0x37ee48[_0xddf5('0x3e')];if(!_0x5ce947[_0xddf5('0x38')][_0xddf5('0x59')](_0xddf5('0x3f'))){_0x58ca53[_0xddf5('0x21')]=qs['limit'](_0x5ce947['query']['limit']);_0x58ca53[_0xddf5('0x1f')]=qs[_0xddf5('0x1f')](_0x5ce947[_0xddf5('0x38')][_0xddf5('0x1f')]);}return _0x4ea300[_0xddf5('0x64')](_0x58ca53);}})[_0xddf5('0x29')](function(_0x27ffb8){if(_0x27ffb8){return _0x27ffb8?{'count':_0x11a787,'rows':_0x27ffb8}:null;}})[_0xddf5('0x29')](respondWithResult(_0x1786ef,null))[_0xddf5('0x49')](handleError(_0x1786ef,null));};exports[_0xddf5('0x65')]=function(_0x90f8ec,_0xa617be,_0x5b6378){var _0x1bdda8=_0x90f8ec['body'][_0xddf5('0x66')];return db[_0xddf5('0x67')][_0xddf5('0x47')]({'where':{'id':_0x1bdda8},'attributes':['id'],'include':[{'model':db[_0xddf5('0x68')],'as':_0xddf5('0x69'),'attributes':['id',_0xddf5('0x2e'),_0xddf5('0x6a'),'voicePause',_0xddf5('0x6b')],'raw':!![]}]})[_0xddf5('0x29')](function(_0x20194f){if(_0x20194f){var _0x4552df=_[_0xddf5('0x6c')](_0x20194f,function(_0x3772ee){var _0x5e7842=_0x3772ee['get']({'plain':!![]});return _0x5e7842[_0xddf5('0x69')];});return db[_0xddf5('0x32')][_0xddf5('0x4d')]({'where':{'id':_0x90f8ec[_0xddf5('0x4b')]['id']}})['then'](function(_0x1b12a0){return db[_0xddf5('0x6d')][_0xddf5('0x6e')](function(_0x2d41fe){return _0x1b12a0[_0xddf5('0x65')](_0x1bdda8,{'transaction':_0x2d41fe})[_0xddf5('0x29')](function(){return BPromise[_0xddf5('0x6f')](_0x4552df,function(_0x44278a){return db[_0xddf5('0x5c')][_0xddf5('0x70')]({'where':{'UserId':_0x44278a['id'],'OpenchannelQueueId':_0x90f8ec[_0xddf5('0x4b')]['id']},'transaction':_0x2d41fe});});})[_0xddf5('0x29')](function(){_0x4552df[_0xddf5('0x71')](function(_0x1c35b1){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x1c35b1['id'],'OpenchannelQueueId':_0x1b12a0['id']});});});});});}})['then'](respondWithStatusCode(_0xa617be,null))[_0xddf5('0x49')](handleError(_0xa617be,null));};exports[_0xddf5('0x72')]=function(_0x46a7c4,_0xf1ca04,_0x1a2ea6){return db[_0xddf5('0x67')]['findAll']({'where':{'id':_0x46a7c4[_0xddf5('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xddf5('0x68')],'as':_0xddf5('0x69'),'attributes':['id'],'raw':!![]}]})[_0xddf5('0x29')](handleEntityNotFound(_0xf1ca04,null))['then'](function(_0x24a546){var _0x23120a=_[_0xddf5('0x31')](_0x24a546,'id');var _0x5ec701=[];var _0x20beab=[];var _0x4e28fa=squel['select']();_0x4e28fa[_0xddf5('0x73')]('tq.TeamId')[_0xddf5('0x74')](_0xddf5('0x75'),'tq')[_0xddf5('0x76')](_0xddf5('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xddf5('0x42')]('OpenchannelQueueId\x20=\x20?',_0x46a7c4['params']['id']);for(var _0x424548=0x0;_0x424548<_0x24a546[_0xddf5('0x3e')];_0x424548+=0x1){let _0x535196=_0x24a546[_0x424548];for(var _0x36c49b=0x0;_0x36c49b<_0x535196[_0xddf5('0x69')][_0xddf5('0x3e')];_0x36c49b+=0x1){let _0x3b6115=_0x535196[_0xddf5('0x69')][_0x36c49b];var _0x4fd466=_0x4e28fa[_0xddf5('0x78')]();_0x4fd466[_0xddf5('0x42')](_0xddf5('0x79'),_0x3b6115['id']);_0x20beab[_0xddf5('0x7a')](db[_0xddf5('0x6d')][_0xddf5('0x38')](_0x4fd466[_0xddf5('0x7b')](),{'type':db['sequelize']['QueryTypes'][_0xddf5('0x7c')]})[_0xddf5('0x29')](function(_0x2638a8){if(_0x2638a8[_0xddf5('0x3e')]===0x1){return _0x3b6115['id'];}else{var _0xf2c8ed=_[_0xddf5('0x7d')](_[_0xddf5('0x31')](_0x2638a8,_0xddf5('0x7e')),function(_0x5174c7){return _[_0xddf5('0x7f')](_0x23120a,_0x5174c7);});if(_0xf2c8ed){return _0x3b6115['id'];}}}));}}return BPromise[_0xddf5('0x80')](_0x20beab)[_0xddf5('0x29')](function(_0x295264){_0x5ec701=_(_0x5ec701)[_0xddf5('0x81')](_0x295264)[_0xddf5('0x82')]()[_0xddf5('0x83')]();return db[_0xddf5('0x32')][_0xddf5('0x4d')]({'where':{'id':_0x46a7c4[_0xddf5('0x4b')]['id']}})[_0xddf5('0x29')](function(_0x3bc5db){return db[_0xddf5('0x6d')][_0xddf5('0x6e')](function(_0x574334){return _0x3bc5db[_0xddf5('0x72')](_0x46a7c4['query'][_0xddf5('0x66')],{'transaction':_0x574334})[_0xddf5('0x29')](function(){if(!_['isEmpty'](_0x5ec701)){return _0x3bc5db[_0xddf5('0x84')](_0x5ec701,{'transaction':_0x574334});}})[_0xddf5('0x29')](function(){_0x5ec701[_0xddf5('0x71')](function(_0x24d4f5){socket[_0xddf5('0x85')](_0xddf5('0x86'),{'UserId':_0x24d4f5,'OpenchannelQueueId':_0x3bc5db['id']});});});});});});})['then'](respondWithStatusCode(_0xf1ca04,null))['catch'](handleError(_0xf1ca04,null));};exports[_0xddf5('0x87')]=function(_0x12e3b9,_0x226abc,_0x59cd3a){return db[_0xddf5('0x32')][_0xddf5('0x4d')]({'where':{'id':_0x12e3b9[_0xddf5('0x4b')]['id']}})[_0xddf5('0x29')](handleEntityNotFound(_0x226abc,null))[_0xddf5('0x29')](function(_0xce1cfd){if(_0xce1cfd){return _0xce1cfd[_0xddf5('0x87')](_0x12e3b9[_0xddf5('0x4f')][_0xddf5('0x66')],_[_0xddf5('0x88')](_0x12e3b9[_0xddf5('0x4f')],['ids','id'])||{})[_0xddf5('0x89')](function(_0xbbecfd){for(var _0x380393=0x0;_0x380393<_0x12e3b9[_0xddf5('0x4f')][_0xddf5('0x66')]['length'];_0x380393+=0x1){socket[_0xddf5('0x85')](_0xddf5('0x8a'),{'UserId':Number(_0x12e3b9[_0xddf5('0x4f')]['ids'][_0x380393]),'OpenchannelQueueId':Number(_0x12e3b9[_0xddf5('0x4b')]['id'])});}return _0xbbecfd;});}})['then'](respondWithResult(_0x226abc,null))[_0xddf5('0x49')](handleError(_0x226abc,null));};exports[_0xddf5('0x84')]=function(_0x35e5e0,_0x5d51e5,_0x10523e){return db[_0xddf5('0x32')]['find']({'where':{'id':_0x35e5e0['params']['id']}})['then'](handleEntityNotFound(_0x5d51e5,null))['then'](function(_0x4e2244){if(_0x4e2244){return _0x4e2244[_0xddf5('0x84')](_0x35e5e0[_0xddf5('0x38')][_0xddf5('0x66')])[_0xddf5('0x29')](function(){if(_['isArray'](_0x35e5e0[_0xddf5('0x38')][_0xddf5('0x66')])){for(var _0x3b86bc=0x0;_0x3b86bc<_0x35e5e0[_0xddf5('0x38')][_0xddf5('0x66')]['length'];_0x3b86bc+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x35e5e0[_0xddf5('0x38')][_0xddf5('0x66')][_0x3b86bc]),'OpenchannelQueueId':Number(_0x35e5e0['params']['id'])});}}else{socket[_0xddf5('0x85')](_0xddf5('0x86'),{'UserId':Number(_0x35e5e0['query'][_0xddf5('0x66')]),'OpenchannelQueueId':Number(_0x35e5e0[_0xddf5('0x4b')]['id'])});}});}})[_0xddf5('0x29')](respondWithStatusCode(_0x5d51e5,null))[_0xddf5('0x49')](handleError(_0x5d51e5,null));};exports['getAgents']=function(_0x1c7569,_0x3b987e,_0x562fde){var _0x50ed4f={};var _0x14ebbd={};var _0x4c1d17;var _0x57fa82;return db[_0xddf5('0x32')]['findOne']({'where':{'id':_0x1c7569[_0xddf5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3b987e,null))[_0xddf5('0x29')](function(_0x5e5a90){if(_0x5e5a90){_0x4c1d17=_0x5e5a90;_0x14ebbd['model']=_[_0xddf5('0x39')](db['User'][_0xddf5('0x33')]);_0x14ebbd[_0xddf5('0x38')]=_[_0xddf5('0x39')](_0x1c7569[_0xddf5('0x38')]);_0x14ebbd['filters']=_[_0xddf5('0x3b')](_0x14ebbd[_0xddf5('0x37')],_0x14ebbd[_0xddf5('0x38')]);_0x50ed4f[_0xddf5('0x3c')]=_[_0xddf5('0x3b')](_0x14ebbd[_0xddf5('0x37')],qs['fields'](_0x1c7569['query'][_0xddf5('0x3d')]));_0x50ed4f[_0xddf5('0x3c')]=_0x50ed4f[_0xddf5('0x3c')][_0xddf5('0x3e')]?_0x50ed4f[_0xddf5('0x3c')]:_0x14ebbd[_0xddf5('0x37')];_0x50ed4f[_0xddf5('0x40')]=qs['sort'](_0x1c7569['query'][_0xddf5('0x5a')]);_0x50ed4f[_0xddf5('0x42')]=qs['filters'](_['pick'](_0x1c7569[_0xddf5('0x38')],_0x14ebbd[_0xddf5('0x3a')]));if(_0x1c7569['query'][_0xddf5('0x44')]){_0x50ed4f[_0xddf5('0x42')]=_[_0xddf5('0x45')](_0x50ed4f['where'],{'$or':_[_0xddf5('0x31')](_0x50ed4f[_0xddf5('0x3c')],function(_0x158014){var _0x1cf0a0={};_0x1cf0a0[_0x158014]={'$like':'%'+_0x1c7569[_0xddf5('0x38')][_0xddf5('0x44')]+'%'};return _0x1cf0a0;})});}_0x50ed4f=_[_0xddf5('0x45')]({},_0x50ed4f,_0x1c7569[_0xddf5('0x46')]);return _0x4c1d17['getAgents'](_0x50ed4f);}})[_0xddf5('0x29')](function(_0x339805){if(_0x339805){_0x57fa82=_0x339805[_0xddf5('0x3e')];if(!_0x1c7569[_0xddf5('0x38')][_0xddf5('0x59')](_0xddf5('0x3f'))){_0x50ed4f[_0xddf5('0x21')]=qs[_0xddf5('0x21')](_0x1c7569[_0xddf5('0x38')][_0xddf5('0x21')]);_0x50ed4f[_0xddf5('0x1f')]=qs[_0xddf5('0x1f')](_0x1c7569[_0xddf5('0x38')][_0xddf5('0x1f')]);}return _0x4c1d17[_0xddf5('0x8b')](_0x50ed4f);}})[_0xddf5('0x29')](function(_0x313fbf){if(_0x313fbf){return _0x313fbf?{'count':_0x57fa82,'rows':_0x313fbf}:null;}})['then'](respondWithResult(_0x3b987e,null))['catch'](handleError(_0x3b987e,null));}; \ No newline at end of file +var _0x9805=['status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','stack','name','send','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelQueue','includeAll','include','findAll','catch','show','params','filters','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','error','destroy','describe','findOne','UserOpenchannelQueue','hasOwnProperty','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','select','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9805,0xfd));var _0x5980=function(_0x4aace4,_0x2c2119){_0x4aace4=_0x4aace4-0x0;var _0x15b47c=_0x9805[_0x4aace4];return _0x15b47c;};'use strict';var emlformat=require(_0x5980('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5980('0x1'));var jsonpatch=require(_0x5980('0x2'));var rp=require('request-promise');var moment=require(_0x5980('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5980('0x4'));var util=require(_0x5980('0x5'));var path=require(_0x5980('0x6'));var sox=require(_0x5980('0x7'));var csv=require('to-csv');var ejs=require(_0x5980('0x8'));var fs=require('fs');var fs_extra=require(_0x5980('0x9'));var _=require(_0x5980('0xa'));var squel=require(_0x5980('0xb'));var crypto=require(_0x5980('0xc'));var jsforce=require(_0x5980('0xd'));var deskjs=require(_0x5980('0xe'));var toCsv=require(_0x5980('0xf'));var querystring=require(_0x5980('0x10'));var Papa=require(_0x5980('0x11'));var Redis=require('ioredis');var authService=require(_0x5980('0x12'));var qs=require(_0x5980('0x13'));var as=require(_0x5980('0x14'));var hardwareService=require(_0x5980('0x15'));var logger=require(_0x5980('0x16'))(_0x5980('0x17'));var utils=require(_0x5980('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5980('0x19'));var db=require(_0x5980('0x1a'))['db'];config[_0x5980('0x1b')]=_[_0x5980('0x1c')](config['redis'],{'host':_0x5980('0x1d'),'port':0x18eb});var socket=require(_0x5980('0x1e'))(new Redis(config[_0x5980('0x1b')]));require(_0x5980('0x1f'))['register'](socket);function respondWithStatusCode(_0x1ebc4b,_0x41a3a5){_0x41a3a5=_0x41a3a5||0xcc;return function(_0x4334d0){if(_0x4334d0){return _0x1ebc4b[_0x5980('0x20')](_0x41a3a5);}return _0x1ebc4b[_0x5980('0x21')](_0x41a3a5)[_0x5980('0x22')]();};}function respondWithResult(_0x57d39c,_0x4cdb64){_0x4cdb64=_0x4cdb64||0xc8;return function(_0x3aca49){if(_0x3aca49){return _0x57d39c['status'](_0x4cdb64)[_0x5980('0x23')](_0x3aca49);}};}function respondWithFilteredResult(_0x137932,_0x119b7f){return function(_0x2af8c9){if(_0x2af8c9){var _0xb98c7e=typeof _0x119b7f[_0x5980('0x24')]===_0x5980('0x25')&&typeof _0x119b7f[_0x5980('0x26')]===_0x5980('0x25');var _0xbe08e1=_0x2af8c9[_0x5980('0x27')];var _0x1bcc3b=_0xb98c7e?0x0:_0x119b7f['offset'];var _0x962163=_0xb98c7e?_0x2af8c9['count']:_0x119b7f[_0x5980('0x24')]+_0x119b7f[_0x5980('0x26')];var _0x305bb1;if(_0x962163>=_0xbe08e1){_0x962163=_0xbe08e1;_0x305bb1=0xc8;}else{_0x305bb1=0xce;}_0x137932[_0x5980('0x21')](_0x305bb1);return _0x137932['set'](_0x5980('0x28'),_0x1bcc3b+'-'+_0x962163+'/'+_0xbe08e1)[_0x5980('0x23')](_0x2af8c9);}return null;};}function patchUpdates(_0x5e40a6){return function(_0x58b651){try{jsonpatch['apply'](_0x58b651,_0x5e40a6,!![]);}catch(_0x293cef){return BPromise[_0x5980('0x29')](_0x293cef);}return _0x58b651[_0x5980('0x2a')]();};}function saveUpdates(_0xe6b0b3,_0x4e067b){return function(_0x15bcf){if(_0x15bcf){return _0x15bcf[_0x5980('0x2b')](_0xe6b0b3)[_0x5980('0x2c')](function(_0x52e24b){return _0x52e24b;});}return null;};}function removeEntity(_0x413b86,_0x179afa){return function(_0x36ca19){if(_0x36ca19){return _0x36ca19['destroy']()[_0x5980('0x2c')](function(){var _0x1d5897=_0x36ca19[_0x5980('0x2d')]({'plain':!![]});var _0xdd7b58=_0x5980('0x2e');return db[_0x5980('0x2f')]['destroy']({'where':{'type':_0xdd7b58,'resourceId':_0x1d5897['id']}})[_0x5980('0x2c')](function(){return _0x36ca19;});})[_0x5980('0x2c')](function(){_0x413b86[_0x5980('0x21')](0xcc)[_0x5980('0x22')]();});}};}function handleEntityNotFound(_0x3f8714,_0xc61c10){return function(_0x4bc697){if(!_0x4bc697){_0x3f8714[_0x5980('0x20')](0x194);}return _0x4bc697;};}function handleError(_0x2ff342,_0x2d28f3){_0x2d28f3=_0x2d28f3||0x1f4;return function(_0x183f15){logger['error'](_0x183f15[_0x5980('0x30')]);if(_0x183f15[_0x5980('0x31')]){delete _0x183f15[_0x5980('0x31')];}_0x2ff342[_0x5980('0x21')](_0x2d28f3)[_0x5980('0x32')](_0x183f15);};}exports['index']=function(_0x192ad0,_0x29c843){var _0x3143bd={},_0x231f0f={},_0x1015cd={'count':0x0,'rows':[]};var _0x430651=_['map'](db['OpenchannelQueue'][_0x5980('0x33')],function(_0x592f1a){return{'name':_0x592f1a['fieldName'],'type':_0x592f1a[_0x5980('0x34')][_0x5980('0x35')]};});_0x231f0f[_0x5980('0x36')]=_[_0x5980('0x37')](_0x430651,_0x5980('0x31'));_0x231f0f[_0x5980('0x38')]=_[_0x5980('0x39')](_0x192ad0['query']);_0x231f0f['filters']=_[_0x5980('0x3a')](_0x231f0f[_0x5980('0x36')],_0x231f0f['query']);_0x3143bd[_0x5980('0x3b')]=_[_0x5980('0x3a')](_0x231f0f['model'],qs[_0x5980('0x3c')](_0x192ad0[_0x5980('0x38')]['fields']));_0x3143bd[_0x5980('0x3b')]=_0x3143bd['attributes']['length']?_0x3143bd[_0x5980('0x3b')]:_0x231f0f[_0x5980('0x36')];if(!_0x192ad0[_0x5980('0x38')]['hasOwnProperty'](_0x5980('0x3d'))){_0x3143bd[_0x5980('0x26')]=qs['limit'](_0x192ad0[_0x5980('0x38')]['limit']);_0x3143bd[_0x5980('0x24')]=qs[_0x5980('0x24')](_0x192ad0[_0x5980('0x38')]['offset']);}_0x3143bd[_0x5980('0x3e')]=qs['sort'](_0x192ad0[_0x5980('0x38')][_0x5980('0x3f')]);_0x3143bd[_0x5980('0x40')]=qs['filters'](_[_0x5980('0x41')](_0x192ad0[_0x5980('0x38')],_0x231f0f['filters']),_0x430651);if(_0x192ad0[_0x5980('0x38')][_0x5980('0x42')]){_0x3143bd['where']=_[_0x5980('0x43')](_0x3143bd[_0x5980('0x40')],{'$or':_[_0x5980('0x37')](_0x430651,function(_0x3df510){if(_0x3df510[_0x5980('0x34')]!=='VIRTUAL'){var _0x423f49={};_0x423f49[_0x3df510['name']]={'$like':'%'+_0x192ad0[_0x5980('0x38')][_0x5980('0x42')]+'%'};return _0x423f49;}})});}_0x3143bd=_[_0x5980('0x43')]({},_0x3143bd,_0x192ad0[_0x5980('0x44')]);var _0x5cebfc={'where':_0x3143bd[_0x5980('0x40')]};return db[_0x5980('0x45')][_0x5980('0x27')](_0x5cebfc)['then'](function(_0x1925da){_0x1015cd[_0x5980('0x27')]=_0x1925da;if(_0x192ad0[_0x5980('0x38')][_0x5980('0x46')]){_0x3143bd[_0x5980('0x47')]=[{'all':!![]}];}return db[_0x5980('0x45')][_0x5980('0x48')](_0x3143bd);})[_0x5980('0x2c')](function(_0x3cc1c5){_0x1015cd['rows']=_0x3cc1c5;return _0x1015cd;})[_0x5980('0x2c')](respondWithFilteredResult(_0x29c843,_0x3143bd))[_0x5980('0x49')](handleError(_0x29c843,null));};exports[_0x5980('0x4a')]=function(_0x33e8d0,_0x34e958){var _0x99b169={'raw':!![],'where':{'id':_0x33e8d0[_0x5980('0x4b')]['id']}},_0x343366={};_0x343366[_0x5980('0x36')]=_[_0x5980('0x39')](db[_0x5980('0x45')][_0x5980('0x33')]);_0x343366[_0x5980('0x38')]=_[_0x5980('0x39')](_0x33e8d0['query']);_0x343366[_0x5980('0x4c')]=_[_0x5980('0x3a')](_0x343366[_0x5980('0x36')],_0x343366[_0x5980('0x38')]);_0x99b169[_0x5980('0x3b')]=_[_0x5980('0x3a')](_0x343366[_0x5980('0x36')],qs[_0x5980('0x3c')](_0x33e8d0[_0x5980('0x38')][_0x5980('0x3c')]));_0x99b169['attributes']=_0x99b169['attributes'][_0x5980('0x4d')]?_0x99b169[_0x5980('0x3b')]:_0x343366[_0x5980('0x36')];if(_0x33e8d0[_0x5980('0x38')][_0x5980('0x46')]){_0x99b169[_0x5980('0x47')]=[{'all':!![]}];}_0x99b169=_[_0x5980('0x43')]({},_0x99b169,_0x33e8d0[_0x5980('0x44')]);return db[_0x5980('0x45')]['find'](_0x99b169)[_0x5980('0x2c')](handleEntityNotFound(_0x34e958,null))[_0x5980('0x2c')](respondWithResult(_0x34e958,null))[_0x5980('0x49')](handleError(_0x34e958,null));};exports['create']=function(_0x717eab,_0x4d60bc){return db[_0x5980('0x45')][_0x5980('0x4e')](_0x717eab[_0x5980('0x4f')],{})['then'](function(_0x5039be){var _0x1e494b=_0x717eab['user'][_0x5980('0x2d')]({'plain':!![]});if(!_0x1e494b)throw new Error(_0x5980('0x50'));if(_0x1e494b[_0x5980('0x51')]===_0x5980('0x52')){var _0x1bd679=_0x5039be['get']({'plain':!![]});var _0x48813d=_0x5980('0x2e');return db['UserProfileSection'][_0x5980('0x53')]({'where':{'name':_0x48813d,'userProfileId':_0x1e494b[_0x5980('0x54')]},'raw':!![]})[_0x5980('0x2c')](function(_0x4c5ec7){if(_0x4c5ec7&&_0x4c5ec7[_0x5980('0x55')]===0x0){return db[_0x5980('0x2f')][_0x5980('0x4e')]({'name':_0x1bd679['name'],'resourceId':_0x1bd679['id'],'type':_0x4c5ec7[_0x5980('0x31')],'sectionId':_0x4c5ec7['id']},{})[_0x5980('0x2c')](function(){return _0x5039be;});}else{return _0x5039be;}})[_0x5980('0x49')](function(_0x2eee58){logger[_0x5980('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2eee58);throw _0x2eee58;});}return _0x5039be;})[_0x5980('0x2c')](respondWithResult(_0x4d60bc,0xc9))['catch'](handleError(_0x4d60bc,null));};exports[_0x5980('0x2b')]=function(_0x38fdbb,_0x47a48d){if(_0x38fdbb[_0x5980('0x4f')]['id']){delete _0x38fdbb[_0x5980('0x4f')]['id'];}return db[_0x5980('0x45')][_0x5980('0x53')]({'where':{'id':_0x38fdbb[_0x5980('0x4b')]['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x47a48d,null))[_0x5980('0x2c')](saveUpdates(_0x38fdbb[_0x5980('0x4f')],null))['then'](respondWithResult(_0x47a48d,null))['catch'](handleError(_0x47a48d,null));};exports[_0x5980('0x57')]=function(_0x580b9e,_0x4483b0){return db[_0x5980('0x45')]['find']({'where':{'id':_0x580b9e[_0x5980('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4483b0,null))[_0x5980('0x2c')](removeEntity(_0x4483b0,null))[_0x5980('0x49')](handleError(_0x4483b0,null));};exports[_0x5980('0x58')]=function(_0x34521f,_0x92072b){return db[_0x5980('0x45')]['describe']()[_0x5980('0x2c')](respondWithResult(_0x92072b,null))['catch'](handleError(_0x92072b,null));};exports['getMembers']=function(_0x5c37b4,_0xeb5efc,_0xd80ffe){var _0xa68f39={'raw':!![],'where':{}},_0x57a0fb={},_0xf677c9;return db[_0x5980('0x45')][_0x5980('0x59')]({'where':{'id':_0x5c37b4['params']['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0xeb5efc,null))[_0x5980('0x2c')](function(_0x1a5e9d){if(_0x1a5e9d){_0xf677c9=_0x1a5e9d[_0x5980('0x2d')]({'plain':!![]});_0x57a0fb['model']=_['keys'](db[_0x5980('0x5a')][_0x5980('0x33')]);_0x57a0fb[_0x5980('0x38')]=_[_0x5980('0x39')](_0x5c37b4[_0x5980('0x38')]);_0x57a0fb['filters']=_['intersection'](_0x57a0fb[_0x5980('0x36')],_0x57a0fb[_0x5980('0x38')]);_0xa68f39['attributes']=_[_0x5980('0x3a')](_0x57a0fb[_0x5980('0x36')],qs[_0x5980('0x3c')](_0x5c37b4[_0x5980('0x38')][_0x5980('0x3c')]));_0xa68f39[_0x5980('0x3b')]=_0xa68f39[_0x5980('0x3b')][_0x5980('0x4d')]?_0xa68f39[_0x5980('0x3b')]:_0x57a0fb[_0x5980('0x36')];if(!_0x5c37b4[_0x5980('0x38')][_0x5980('0x5b')]('nolimit')){_0xa68f39[_0x5980('0x26')]=qs[_0x5980('0x26')](_0x5c37b4[_0x5980('0x38')][_0x5980('0x26')]);_0xa68f39[_0x5980('0x24')]=qs[_0x5980('0x24')](_0x5c37b4['query'][_0x5980('0x24')]);}_0xa68f39[_0x5980('0x3e')]=qs[_0x5980('0x3f')](_0x5c37b4[_0x5980('0x38')][_0x5980('0x3f')]);_0xa68f39['where']=qs[_0x5980('0x4c')](_[_0x5980('0x41')](_0x5c37b4[_0x5980('0x38')],_0x57a0fb[_0x5980('0x4c')]));_0xa68f39[_0x5980('0x40')]['OpenchannelQueueId']=_0x1a5e9d['id'];if(_0x5c37b4[_0x5980('0x38')]['filter']){_0xa68f39['where']=_[_0x5980('0x43')](_0xa68f39[_0x5980('0x40')],{'$or':_[_0x5980('0x37')](_0xa68f39['attributes'],function(_0x3ebf2f){var _0x405fe8={};_0x405fe8[_0x3ebf2f]={'$like':'%'+_0x5c37b4[_0x5980('0x38')][_0x5980('0x42')]+'%'};return _0x405fe8;})});}_0xa68f39=_[_0x5980('0x43')]({},_0xa68f39,_0x5c37b4[_0x5980('0x44')]);return db[_0x5980('0x5a')][_0x5980('0x48')](_0xa68f39);}})[_0x5980('0x2c')](function(_0x480153){if(_0x480153){return db[_0x5980('0x5c')][_0x5980('0x5d')]({'where':{'id':_[_0x5980('0x37')](_0x480153,_0x5980('0x5e')),'role':_0x5980('0x5f')},'attributes':['id',_0x5980('0x31'),_0x5980('0x60'),_0x5980('0x61'),_0x5980('0x62')]});}})['then'](function(_0x3738f4){if(_0x3738f4){return{'count':_0x3738f4[_0x5980('0x27')],'rows':_[_0x5980('0x37')](_0x3738f4['rows'],function(_0x4bb53a){return{'membername':_0x4bb53a[_0x5980('0x31')],'UserId':_0x4bb53a['id'],'queue_name':_0xf677c9[_0x5980('0x31')],'OpenchannelQueueId':_0xf677c9['id'],'interface':util[_0x5980('0x63')](_0x5980('0x64'),_0x5980('0x65'),_0x4bb53a[_0x5980('0x31')]),'penalty':0x0,'paused':_0x4bb53a[_0x5980('0x60')],'createdAt':_0x4bb53a[_0x5980('0x62')],'updatedAt':_0x4bb53a[_0x5980('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5980('0x2c')](respondWithFilteredResult(_0xeb5efc,_0xa68f39))['catch'](handleError(_0xeb5efc,null));};exports['getTeams']=function(_0x11873a,_0x26b030,_0x8e75a3){var _0xef9082={};var _0x2197ca={};var _0x23322d;var _0x3335ad;return db[_0x5980('0x45')]['findOne']({'where':{'id':_0x11873a[_0x5980('0x4b')]['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x26b030,null))['then'](function(_0x54ec0b){if(_0x54ec0b){_0x23322d=_0x54ec0b;_0x2197ca[_0x5980('0x36')]=_[_0x5980('0x39')](db[_0x5980('0x66')][_0x5980('0x33')]);_0x2197ca[_0x5980('0x38')]=_[_0x5980('0x39')](_0x11873a[_0x5980('0x38')]);_0x2197ca['filters']=_[_0x5980('0x3a')](_0x2197ca[_0x5980('0x36')],_0x2197ca[_0x5980('0x38')]);_0xef9082[_0x5980('0x3b')]=_[_0x5980('0x3a')](_0x2197ca[_0x5980('0x36')],qs[_0x5980('0x3c')](_0x11873a['query'][_0x5980('0x3c')]));_0xef9082['attributes']=_0xef9082['attributes'][_0x5980('0x4d')]?_0xef9082[_0x5980('0x3b')]:_0x2197ca[_0x5980('0x36')];_0xef9082['order']=qs[_0x5980('0x3f')](_0x11873a[_0x5980('0x38')]['sort']);_0xef9082[_0x5980('0x40')]=qs[_0x5980('0x4c')](_['pick'](_0x11873a['query'],_0x2197ca['filters']));if(_0x11873a[_0x5980('0x38')][_0x5980('0x42')]){_0xef9082[_0x5980('0x40')]=_['merge'](_0xef9082['where'],{'$or':_[_0x5980('0x37')](_0xef9082['attributes'],function(_0x45bebf){var _0x42ad75={};_0x42ad75[_0x45bebf]={'$like':'%'+_0x11873a[_0x5980('0x38')][_0x5980('0x42')]+'%'};return _0x42ad75;})});}_0xef9082=_[_0x5980('0x43')]({},_0xef9082,_0x11873a[_0x5980('0x44')]);return _0x23322d[_0x5980('0x67')](_0xef9082);}})['then'](function(_0x36cf75){if(_0x36cf75){_0x3335ad=_0x36cf75[_0x5980('0x4d')];if(!_0x11873a[_0x5980('0x38')][_0x5980('0x5b')](_0x5980('0x3d'))){_0xef9082[_0x5980('0x26')]=qs['limit'](_0x11873a[_0x5980('0x38')][_0x5980('0x26')]);_0xef9082[_0x5980('0x24')]=qs['offset'](_0x11873a[_0x5980('0x38')][_0x5980('0x24')]);}return _0x23322d[_0x5980('0x67')](_0xef9082);}})[_0x5980('0x2c')](function(_0x5f2780){if(_0x5f2780){return _0x5f2780?{'count':_0x3335ad,'rows':_0x5f2780}:null;}})['then'](respondWithResult(_0x26b030,null))['catch'](handleError(_0x26b030,null));};exports[_0x5980('0x68')]=function(_0x2d0558,_0x19dcf4,_0x33f0f1){var _0x56fc0b=_0x2d0558[_0x5980('0x4f')][_0x5980('0x69')];return db[_0x5980('0x66')][_0x5980('0x48')]({'where':{'id':_0x56fc0b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5980('0x6a'),'attributes':['id',_0x5980('0x31'),_0x5980('0x6b'),_0x5980('0x6c'),'interface'],'raw':!![]}]})[_0x5980('0x2c')](function(_0x324803){if(_0x324803){var _0x4d8cac=_[_0x5980('0x6d')](_0x324803,function(_0x59410a){var _0x4fb8f4=_0x59410a[_0x5980('0x2d')]({'plain':!![]});return _0x4fb8f4[_0x5980('0x6a')];});return db[_0x5980('0x45')][_0x5980('0x53')]({'where':{'id':_0x2d0558['params']['id']}})[_0x5980('0x2c')](function(_0x111471){return db[_0x5980('0x6e')][_0x5980('0x6f')](function(_0x5239f3){return _0x111471['addTeams'](_0x56fc0b,{'transaction':_0x5239f3})[_0x5980('0x2c')](function(){return BPromise[_0x5980('0x70')](_0x4d8cac,function(_0x59fe25){return db[_0x5980('0x5a')]['findOrCreate']({'where':{'UserId':_0x59fe25['id'],'OpenchannelQueueId':_0x2d0558['params']['id']},'transaction':_0x5239f3});});})[_0x5980('0x2c')](function(){_0x4d8cac[_0x5980('0x71')](function(_0x4d0f69){socket[_0x5980('0x72')](_0x5980('0x73'),{'UserId':_0x4d0f69['id'],'OpenchannelQueueId':_0x111471['id']});});});});});}})[_0x5980('0x2c')](respondWithStatusCode(_0x19dcf4,null))['catch'](handleError(_0x19dcf4,null));};exports['removeTeams']=function(_0x357274,_0x578c26,_0x54603b){return db[_0x5980('0x66')][_0x5980('0x48')]({'where':{'id':_0x357274[_0x5980('0x38')][_0x5980('0x69')]},'attributes':['id'],'include':[{'model':db[_0x5980('0x5c')],'as':_0x5980('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x5980('0x2c')](handleEntityNotFound(_0x578c26,null))['then'](function(_0x7e80f3){var _0x2ea175=_['map'](_0x7e80f3,'id');var _0x3cf38e=[];var _0x3e7a93=[];var _0x2752cc=squel[_0x5980('0x74')]();_0x2752cc['field'](_0x5980('0x75'))[_0x5980('0x76')](_0x5980('0x77'),'tq')[_0x5980('0x78')]('user_has_teams','ut',_0x5980('0x79'))['where'](_0x5980('0x7a'),_0x357274[_0x5980('0x4b')]['id']);for(var _0x59aa74=0x0;_0x59aa74<_0x7e80f3[_0x5980('0x4d')];_0x59aa74+=0x1){let _0x402da1=_0x7e80f3[_0x59aa74];for(var _0x5400ff=0x0;_0x5400ff<_0x402da1[_0x5980('0x6a')][_0x5980('0x4d')];_0x5400ff+=0x1){let _0x3f169d=_0x402da1[_0x5980('0x6a')][_0x5400ff];var _0x379d69=_0x2752cc['clone']();_0x379d69['where'](_0x5980('0x7b'),_0x3f169d['id']);_0x3e7a93[_0x5980('0x7c')](db[_0x5980('0x6e')]['query'](_0x379d69[_0x5980('0x7d')](),{'type':db[_0x5980('0x6e')][_0x5980('0x7e')]['SELECT']})['then'](function(_0x29b1f5){if(_0x29b1f5['length']===0x1){return _0x3f169d['id'];}else{var _0x1a178b=_[_0x5980('0x7f')](_[_0x5980('0x37')](_0x29b1f5,_0x5980('0x80')),function(_0x42ba98){return _[_0x5980('0x81')](_0x2ea175,_0x42ba98);});if(_0x1a178b){return _0x3f169d['id'];}}}));}}return BPromise[_0x5980('0x82')](_0x3e7a93)[_0x5980('0x2c')](function(_0x1c5c61){_0x3cf38e=_(_0x3cf38e)[_0x5980('0x83')](_0x1c5c61)[_0x5980('0x84')]()[_0x5980('0x85')]();return db['OpenchannelQueue'][_0x5980('0x53')]({'where':{'id':_0x357274[_0x5980('0x4b')]['id']}})[_0x5980('0x2c')](function(_0x8f93e6){return db[_0x5980('0x6e')]['transaction'](function(_0x4b3474){return _0x8f93e6[_0x5980('0x86')](_0x357274['query'][_0x5980('0x69')],{'transaction':_0x4b3474})['then'](function(){if(!_[_0x5980('0x87')](_0x3cf38e)){return _0x8f93e6[_0x5980('0x88')](_0x3cf38e,{'transaction':_0x4b3474});}})[_0x5980('0x2c')](function(){_0x3cf38e[_0x5980('0x71')](function(_0x54ac34){socket['emit'](_0x5980('0x89'),{'UserId':_0x54ac34,'OpenchannelQueueId':_0x8f93e6['id']});});});});});});})[_0x5980('0x2c')](respondWithStatusCode(_0x578c26,null))[_0x5980('0x49')](handleError(_0x578c26,null));};exports[_0x5980('0x8a')]=function(_0x57c20a,_0x4b2f6a,_0x21b3df){return db[_0x5980('0x45')]['find']({'where':{'id':_0x57c20a['params']['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x4b2f6a,null))['then'](function(_0x315bff){if(_0x315bff){return _0x315bff[_0x5980('0x8a')](_0x57c20a[_0x5980('0x4f')][_0x5980('0x69')],_[_0x5980('0x8b')](_0x57c20a[_0x5980('0x4f')],[_0x5980('0x69'),'id'])||{})[_0x5980('0x8c')](function(_0x174bb8){for(var _0x9433c4=0x0;_0x9433c4<_0x57c20a['body'][_0x5980('0x69')][_0x5980('0x4d')];_0x9433c4+=0x1){socket[_0x5980('0x72')](_0x5980('0x73'),{'UserId':Number(_0x57c20a[_0x5980('0x4f')][_0x5980('0x69')][_0x9433c4]),'OpenchannelQueueId':Number(_0x57c20a['params']['id'])});}return _0x174bb8;});}})[_0x5980('0x2c')](respondWithResult(_0x4b2f6a,null))[_0x5980('0x49')](handleError(_0x4b2f6a,null));};exports[_0x5980('0x88')]=function(_0x406cde,_0x4e6dc1,_0x955979){return db[_0x5980('0x45')]['find']({'where':{'id':_0x406cde[_0x5980('0x4b')]['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x4e6dc1,null))[_0x5980('0x2c')](function(_0x1ddcd9){if(_0x1ddcd9){return _0x1ddcd9[_0x5980('0x88')](_0x406cde[_0x5980('0x38')][_0x5980('0x69')])[_0x5980('0x2c')](function(){if(_[_0x5980('0x8d')](_0x406cde[_0x5980('0x38')][_0x5980('0x69')])){for(var _0x588cdf=0x0;_0x588cdf<_0x406cde[_0x5980('0x38')][_0x5980('0x69')][_0x5980('0x4d')];_0x588cdf+=0x1){socket[_0x5980('0x72')](_0x5980('0x89'),{'UserId':Number(_0x406cde[_0x5980('0x38')][_0x5980('0x69')][_0x588cdf]),'OpenchannelQueueId':Number(_0x406cde[_0x5980('0x4b')]['id'])});}}else{socket[_0x5980('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x406cde[_0x5980('0x38')][_0x5980('0x69')]),'OpenchannelQueueId':Number(_0x406cde[_0x5980('0x4b')]['id'])});}});}})[_0x5980('0x2c')](respondWithStatusCode(_0x4e6dc1,null))[_0x5980('0x49')](handleError(_0x4e6dc1,null));};exports[_0x5980('0x8e')]=function(_0x5976b1,_0x4eefc2,_0x2375a6){var _0x2eb70c={};var _0x42388b={};var _0x2c0036;var _0x20776e;return db[_0x5980('0x45')][_0x5980('0x59')]({'where':{'id':_0x5976b1[_0x5980('0x4b')]['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x4eefc2,null))[_0x5980('0x2c')](function(_0x37e6be){if(_0x37e6be){_0x2c0036=_0x37e6be;_0x42388b[_0x5980('0x36')]=_[_0x5980('0x39')](db[_0x5980('0x5c')][_0x5980('0x33')]);_0x42388b[_0x5980('0x38')]=_[_0x5980('0x39')](_0x5976b1[_0x5980('0x38')]);_0x42388b[_0x5980('0x4c')]=_[_0x5980('0x3a')](_0x42388b[_0x5980('0x36')],_0x42388b[_0x5980('0x38')]);_0x2eb70c['attributes']=_[_0x5980('0x3a')](_0x42388b[_0x5980('0x36')],qs[_0x5980('0x3c')](_0x5976b1['query']['fields']));_0x2eb70c[_0x5980('0x3b')]=_0x2eb70c[_0x5980('0x3b')][_0x5980('0x4d')]?_0x2eb70c[_0x5980('0x3b')]:_0x42388b[_0x5980('0x36')];_0x2eb70c[_0x5980('0x3e')]=qs['sort'](_0x5976b1[_0x5980('0x38')][_0x5980('0x3f')]);_0x2eb70c['where']=qs[_0x5980('0x4c')](_['pick'](_0x5976b1[_0x5980('0x38')],_0x42388b[_0x5980('0x4c')]));if(_0x5976b1[_0x5980('0x38')][_0x5980('0x42')]){_0x2eb70c[_0x5980('0x40')]=_[_0x5980('0x43')](_0x2eb70c[_0x5980('0x40')],{'$or':_[_0x5980('0x37')](_0x2eb70c['attributes'],function(_0x57f76b){var _0x419ce0={};_0x419ce0[_0x57f76b]={'$like':'%'+_0x5976b1['query'][_0x5980('0x42')]+'%'};return _0x419ce0;})});}_0x2eb70c=_['merge']({},_0x2eb70c,_0x5976b1[_0x5980('0x44')]);return _0x2c0036[_0x5980('0x8e')](_0x2eb70c);}})['then'](function(_0x56961d){if(_0x56961d){_0x20776e=_0x56961d[_0x5980('0x4d')];if(!_0x5976b1[_0x5980('0x38')][_0x5980('0x5b')](_0x5980('0x3d'))){_0x2eb70c['limit']=qs[_0x5980('0x26')](_0x5976b1[_0x5980('0x38')]['limit']);_0x2eb70c['offset']=qs[_0x5980('0x24')](_0x5976b1[_0x5980('0x38')][_0x5980('0x24')]);}return _0x2c0036['getAgents'](_0x2eb70c);}})[_0x5980('0x2c')](function(_0x1b8770){if(_0x1b8770){return _0x1b8770?{'count':_0x20776e,'rows':_0x1b8770}:null;}})[_0x5980('0x2c')](respondWithResult(_0x4eefc2,null))[_0x5980('0x49')](handleError(_0x4eefc2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 3d013c3..02fcd12 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 _0x608b=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x608b,0xbe));var _0xb608=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x608b[_0x39096d];return _0x13da4f;};'use strict';var EventEmitter=require(_0xb608('0x0'));var OpenchannelQueue=require(_0xb608('0x1'))['db'][_0xb608('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb608('0x3')](0x0);var events={'afterCreate':_0xb608('0x4'),'afterUpdate':'update','afterDestroy':_0xb608('0x5')};function emitEvent(_0x194b30){return function(_0x31da3c,_0x4ce14d,_0x59e01b){OpenchannelQueueEvents[_0xb608('0x6')](_0x194b30+':'+_0x31da3c['id'],_0x31da3c);OpenchannelQueueEvents[_0xb608('0x6')](_0x194b30,_0x31da3c);_0x59e01b(null);};}for(var e in events){if(events[_0xb608('0x7')](e)){var event=events[e];OpenchannelQueue[_0xb608('0x8')](e,emitEvent(event));}}module[_0xb608('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x6c9d=['exports','events','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x6c9d,0xac));var _0xd6c9=function(_0x229a95,_0x292d4f){_0x229a95=_0x229a95-0x0;var _0x2c74e7=_0x6c9d[_0x229a95];return _0x2c74e7;};'use strict';var EventEmitter=require(_0xd6c9('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xd6c9('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd6c9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd6c9('0x3'),'afterDestroy':_0xd6c9('0x4')};function emitEvent(_0x423c23){return function(_0x1dcfab,_0x243797,_0x3a389a){OpenchannelQueueEvents[_0xd6c9('0x5')](_0x423c23+':'+_0x1dcfab['id'],_0x1dcfab);OpenchannelQueueEvents[_0xd6c9('0x5')](_0x423c23,_0x1dcfab);_0x3a389a(null);};}for(var e in events){if(events[_0xd6c9('0x6')](e)){var event=events[e];OpenchannelQueue[_0xd6c9('0x7')](e,emitEvent(event));}}module[_0xd6c9('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 c9f496e..deadacf 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 _0xf9c3=['exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x4ff2bc,_0xedd1df){var _0x21751c=function(_0x16d9c2){while(--_0x16d9c2){_0x4ff2bc['push'](_0x4ff2bc['shift']());}};_0x21751c(++_0xedd1df);}(_0xf9c3,0x7d));var _0x3f9c=function(_0x1c31f4,_0x8e8aeb){_0x1c31f4=_0x1c31f4-0x0;var _0x5a3f66=_0xf9c3[_0x1c31f4];return _0x5a3f66;};'use strict';var _=require(_0x3f9c('0x0'));var util=require(_0x3f9c('0x1'));var logger=require(_0x3f9c('0x2'))('api');var moment=require(_0x3f9c('0x3'));var BPromise=require(_0x3f9c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f9c('0x5'));var rimraf=require('rimraf');var config=require(_0x3f9c('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x3f9c('0x7')]=function(_0x641b9c,_0x4c6f2b){return _0x641b9c[_0x3f9c('0x8')](_0x3f9c('0x9'),attributes,{'tableName':_0x3f9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e58=['define','OpenchannelQueue','openchannel_queues','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueue.attributes','exports'];(function(_0x25c8ae,_0x3c677f){var _0x491010=function(_0x35c0d7){while(--_0x35c0d7){_0x25c8ae['push'](_0x25c8ae['shift']());}};_0x491010(++_0x3c677f);}(_0x2e58,0xf5));var _0x82e5=function(_0x4d3bf5,_0x5720af){_0x4d3bf5=_0x4d3bf5-0x0;var _0x4ea3b3=_0x2e58[_0x4d3bf5];return _0x4ea3b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x82e5('0x0'))(_0x82e5('0x1'));var moment=require(_0x82e5('0x2'));var BPromise=require(_0x82e5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82e5('0x4'));var rimraf=require(_0x82e5('0x5'));var config=require('../../config/environment');var attributes=require(_0x82e5('0x6'));module[_0x82e5('0x7')]=function(_0x374093,_0x3eb8cb){return _0x374093[_0x82e5('0x8')](_0x82e5('0x9'),attributes,{'tableName':_0x82e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index c4056ed..875c3e9 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 _0xf4b4=['attributes','limit','include','model','map','then','catch','find','where','ShowOpenchannelQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw'];(function(_0x1f943a,_0x1b9ec2){var _0x2a56f4=function(_0x18ad49){while(--_0x18ad49){_0x1f943a['push'](_0x1f943a['shift']());}};_0x2a56f4(++_0x1b9ec2);}(_0xf4b4,0x172));var _0x4f4b=function(_0x4f90af,_0x14b70c){_0x4f90af=_0x4f90af-0x0;var _0x5e62c0=_0xf4b4[_0x4f90af];return _0x5e62c0;};'use strict';var _=require('lodash');var util=require(_0x4f4b('0x0'));var moment=require(_0x4f4b('0x1'));var BPromise=require(_0x4f4b('0x2'));var rs=require(_0x4f4b('0x3'));var fs=require('fs');var Redis=require(_0x4f4b('0x4'));var db=require(_0x4f4b('0x5'))['db'];var utils=require(_0x4f4b('0x6'));var logger=require('../../config/logger')(_0x4f4b('0x7'));var config=require(_0x4f4b('0x8'));var jayson=require(_0x4f4b('0x9'));var client=jayson[_0x4f4b('0xa')][_0x4f4b('0xb')]({'port':0x232a});config[_0x4f4b('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4f4b('0xd'))(new Redis(config[_0x4f4b('0xc')]));require('./openchannelQueue.socket')[_0x4f4b('0xe')](socket);function respondWithRpcPromise(_0x430ce0,_0x114a1,_0x24a723){return new BPromise(function(_0x53bb07,_0x3d2362){return client[_0x4f4b('0xf')](_0x430ce0,_0x24a723)['then'](function(_0x3e9b18){logger['info'](_0x4f4b('0x10'),_0x114a1,_0x4f4b('0x11'));logger[_0x4f4b('0x12')](_0x4f4b('0x13'),_0x114a1,_0x4f4b('0x11'),JSON[_0x4f4b('0x14')](_0x3e9b18));if(_0x3e9b18[_0x4f4b('0x15')]){if(_0x3e9b18[_0x4f4b('0x15')]['code']===0x1f4){logger[_0x4f4b('0x15')](_0x4f4b('0x10'),_0x114a1,_0x3e9b18['error'][_0x4f4b('0x16')]);return _0x3d2362(_0x3e9b18['error'][_0x4f4b('0x16')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x114a1,_0x3e9b18[_0x4f4b('0x15')]['message']);return _0x53bb07(_0x3e9b18[_0x4f4b('0x15')]['message']);}else{logger[_0x4f4b('0x17')](_0x4f4b('0x10'),_0x114a1,_0x4f4b('0x11'));_0x53bb07(_0x3e9b18[_0x4f4b('0x18')]['message']);}})['catch'](function(_0x91dfcd){logger[_0x4f4b('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x114a1,_0x91dfcd);_0x3d2362(_0x91dfcd);});});}exports[_0x4f4b('0x19')]=function(_0x24859a){var _0x2c6ba7=this;return new Promise(function(_0x161e83,_0x31abab){return db[_0x4f4b('0x1a')][_0x4f4b('0x1b')]({'raw':_0x24859a[_0x4f4b('0x1c')]?_0x24859a[_0x4f4b('0x1c')][_0x4f4b('0x1d')]===undefined?!![]:![]:!![],'where':_0x24859a[_0x4f4b('0x1c')]?_0x24859a[_0x4f4b('0x1c')]['where']||null:null,'attributes':_0x24859a[_0x4f4b('0x1c')]?_0x24859a[_0x4f4b('0x1c')][_0x4f4b('0x1e')]||null:null,'limit':_0x24859a[_0x4f4b('0x1c')]?_0x24859a[_0x4f4b('0x1c')][_0x4f4b('0x1f')]||null:null,'include':_0x24859a[_0x4f4b('0x1c')]?_0x24859a['options']['include']?_['map'](_0x24859a[_0x4f4b('0x1c')][_0x4f4b('0x20')],function(_0x3c8ba6){return{'model':db[_0x3c8ba6[_0x4f4b('0x21')]],'as':_0x3c8ba6['as'],'attributes':_0x3c8ba6[_0x4f4b('0x1e')],'include':_0x3c8ba6[_0x4f4b('0x20')]?_[_0x4f4b('0x22')](_0x3c8ba6[_0x4f4b('0x20')],function(_0x592a2c){return{'model':db[_0x592a2c['model']],'as':_0x592a2c['as'],'attributes':_0x592a2c['attributes'],'include':_0x592a2c['include']?_[_0x4f4b('0x22')](_0x592a2c[_0x4f4b('0x20')],function(_0x53148d){return{'model':db[_0x53148d[_0x4f4b('0x21')]],'as':_0x53148d['as'],'attributes':_0x53148d[_0x4f4b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f4b('0x23')](function(_0x4c5bdb){logger['info'](_0x4f4b('0x19'),_0x24859a);logger[_0x4f4b('0x12')]('GetOpenchannelQueue',_0x24859a,JSON[_0x4f4b('0x14')](_0x4c5bdb));_0x161e83(_0x4c5bdb);})[_0x4f4b('0x24')](function(_0x284112){logger[_0x4f4b('0x15')](_0x4f4b('0x19'),_0x284112[_0x4f4b('0x16')],_0x24859a);_0x31abab(_0x2c6ba7[_0x4f4b('0x15')](0x1f4,_0x284112['message']));});});};exports['ShowOpenchannelQueue']=function(_0x265316){var _0x293084=this;return new Promise(function(_0x213c8b,_0x1057a2){return db[_0x4f4b('0x1a')][_0x4f4b('0x25')]({'raw':_0x265316[_0x4f4b('0x1c')]?_0x265316[_0x4f4b('0x1c')][_0x4f4b('0x1d')]===undefined?!![]:![]:!![],'where':_0x265316['options']?_0x265316[_0x4f4b('0x1c')][_0x4f4b('0x26')]||null:null,'attributes':_0x265316['options']?_0x265316[_0x4f4b('0x1c')]['attributes']||null:null,'include':_0x265316[_0x4f4b('0x1c')]?_0x265316[_0x4f4b('0x1c')][_0x4f4b('0x20')]?_[_0x4f4b('0x22')](_0x265316['options']['include'],function(_0x3c635e){return{'model':db[_0x3c635e[_0x4f4b('0x21')]],'as':_0x3c635e['as'],'attributes':_0x3c635e[_0x4f4b('0x1e')],'include':_0x3c635e[_0x4f4b('0x20')]?_[_0x4f4b('0x22')](_0x3c635e[_0x4f4b('0x20')],function(_0x523437){return{'model':db[_0x523437[_0x4f4b('0x21')]],'as':_0x523437['as'],'attributes':_0x523437[_0x4f4b('0x1e')],'include':_0x523437[_0x4f4b('0x20')]?_[_0x4f4b('0x22')](_0x523437[_0x4f4b('0x20')],function(_0x5158b2){return{'model':db[_0x5158b2['model']],'as':_0x5158b2['as'],'attributes':_0x5158b2[_0x4f4b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f4b('0x23')](function(_0x11049b){logger['info'](_0x4f4b('0x27'),_0x265316);logger['debug'](_0x4f4b('0x27'),_0x265316,JSON['stringify'](_0x11049b));_0x213c8b(_0x11049b);})['catch'](function(_0xc69f0f){logger[_0x4f4b('0x15')]('ShowOpenchannelQueue',_0xc69f0f[_0x4f4b('0x16')],_0x265316);_0x1057a2(_0x293084['error'](0x1f4,_0xc69f0f[_0x4f4b('0x16')]));});});}; \ No newline at end of file +var _0xfd06=['OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowOpenchannelQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./openchannelQueue.socket','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetOpenchannelQueue'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0xfd06,0xd4));var _0x6fd0=function(_0x3eed3f,_0x5253b5){_0x3eed3f=_0x3eed3f-0x0;var _0xd68fd8=_0xfd06[_0x3eed3f];return _0xd68fd8;};'use strict';var _=require(_0x6fd0('0x0'));var util=require(_0x6fd0('0x1'));var moment=require(_0x6fd0('0x2'));var BPromise=require(_0x6fd0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6fd0('0x4'));var db=require(_0x6fd0('0x5'))['db'];var utils=require(_0x6fd0('0x6'));var logger=require(_0x6fd0('0x7'))(_0x6fd0('0x8'));var config=require(_0x6fd0('0x9'));var jayson=require(_0x6fd0('0xa'));var client=jayson[_0x6fd0('0xb')][_0x6fd0('0xc')]({'port':0x232a});config[_0x6fd0('0xd')]=_['defaults'](config[_0x6fd0('0xd')],{'host':_0x6fd0('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6fd0('0xf'))[_0x6fd0('0x10')](socket);function respondWithRpcPromise(_0x30a193,_0x290189,_0x35d812){return new BPromise(function(_0x438ac8,_0x5188a8){return client['request'](_0x30a193,_0x35d812)[_0x6fd0('0x11')](function(_0x3f27d7){logger['info'](_0x6fd0('0x12'),_0x290189,_0x6fd0('0x13'));logger[_0x6fd0('0x14')](_0x6fd0('0x15'),_0x290189,'request\x20sent',JSON['stringify'](_0x3f27d7));if(_0x3f27d7[_0x6fd0('0x16')]){if(_0x3f27d7[_0x6fd0('0x16')]['code']===0x1f4){logger[_0x6fd0('0x16')](_0x6fd0('0x12'),_0x290189,_0x3f27d7['error'][_0x6fd0('0x17')]);return _0x5188a8(_0x3f27d7[_0x6fd0('0x16')][_0x6fd0('0x17')]);}logger[_0x6fd0('0x16')](_0x6fd0('0x12'),_0x290189,_0x3f27d7[_0x6fd0('0x16')][_0x6fd0('0x17')]);return _0x438ac8(_0x3f27d7[_0x6fd0('0x16')][_0x6fd0('0x17')]);}else{logger[_0x6fd0('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x290189,'request\x20sent');_0x438ac8(_0x3f27d7[_0x6fd0('0x19')]['message']);}})[_0x6fd0('0x1a')](function(_0x46b825){logger[_0x6fd0('0x16')](_0x6fd0('0x12'),_0x290189,_0x46b825);_0x5188a8(_0x46b825);});});}exports[_0x6fd0('0x1b')]=function(_0x3dde64){var _0x1c1f18=this;return new Promise(function(_0x58e95d,_0x5d7b30){return db[_0x6fd0('0x1c')][_0x6fd0('0x1d')]({'raw':_0x3dde64['options']?_0x3dde64[_0x6fd0('0x1e')][_0x6fd0('0x1f')]===undefined?!![]:![]:!![],'where':_0x3dde64[_0x6fd0('0x1e')]?_0x3dde64[_0x6fd0('0x1e')][_0x6fd0('0x20')]||null:null,'attributes':_0x3dde64[_0x6fd0('0x1e')]?_0x3dde64[_0x6fd0('0x1e')][_0x6fd0('0x21')]||null:null,'limit':_0x3dde64[_0x6fd0('0x1e')]?_0x3dde64['options'][_0x6fd0('0x22')]||null:null,'include':_0x3dde64[_0x6fd0('0x1e')]?_0x3dde64[_0x6fd0('0x1e')][_0x6fd0('0x23')]?_['map'](_0x3dde64[_0x6fd0('0x1e')]['include'],function(_0x373ba5){return{'model':db[_0x373ba5[_0x6fd0('0x24')]],'as':_0x373ba5['as'],'attributes':_0x373ba5['attributes'],'include':_0x373ba5['include']?_[_0x6fd0('0x25')](_0x373ba5[_0x6fd0('0x23')],function(_0x5670b7){return{'model':db[_0x5670b7[_0x6fd0('0x24')]],'as':_0x5670b7['as'],'attributes':_0x5670b7[_0x6fd0('0x21')],'include':_0x5670b7[_0x6fd0('0x23')]?_['map'](_0x5670b7[_0x6fd0('0x23')],function(_0x175b46){return{'model':db[_0x175b46[_0x6fd0('0x24')]],'as':_0x175b46['as'],'attributes':_0x175b46['attributes']};}):[]};}):[]};}):[]:[]})[_0x6fd0('0x11')](function(_0x443708){logger[_0x6fd0('0x18')](_0x6fd0('0x1b'),_0x3dde64);logger['debug'](_0x6fd0('0x1b'),_0x3dde64,JSON[_0x6fd0('0x26')](_0x443708));_0x58e95d(_0x443708);})[_0x6fd0('0x1a')](function(_0x117755){logger[_0x6fd0('0x16')](_0x6fd0('0x1b'),_0x117755[_0x6fd0('0x17')],_0x3dde64);_0x5d7b30(_0x1c1f18[_0x6fd0('0x16')](0x1f4,_0x117755[_0x6fd0('0x17')]));});});};exports['ShowOpenchannelQueue']=function(_0x357d34){var _0x578d70=this;return new Promise(function(_0x16cb67,_0x3374ae){return db['OpenchannelQueue']['find']({'raw':_0x357d34[_0x6fd0('0x1e')]?_0x357d34[_0x6fd0('0x1e')][_0x6fd0('0x1f')]===undefined?!![]:![]:!![],'where':_0x357d34[_0x6fd0('0x1e')]?_0x357d34[_0x6fd0('0x1e')][_0x6fd0('0x20')]||null:null,'attributes':_0x357d34[_0x6fd0('0x1e')]?_0x357d34['options'][_0x6fd0('0x21')]||null:null,'include':_0x357d34[_0x6fd0('0x1e')]?_0x357d34[_0x6fd0('0x1e')]['include']?_[_0x6fd0('0x25')](_0x357d34['options'][_0x6fd0('0x23')],function(_0x6539a7){return{'model':db[_0x6539a7[_0x6fd0('0x24')]],'as':_0x6539a7['as'],'attributes':_0x6539a7[_0x6fd0('0x21')],'include':_0x6539a7[_0x6fd0('0x23')]?_[_0x6fd0('0x25')](_0x6539a7[_0x6fd0('0x23')],function(_0xbd638f){return{'model':db[_0xbd638f[_0x6fd0('0x24')]],'as':_0xbd638f['as'],'attributes':_0xbd638f[_0x6fd0('0x21')],'include':_0xbd638f[_0x6fd0('0x23')]?_[_0x6fd0('0x25')](_0xbd638f[_0x6fd0('0x23')],function(_0x112650){return{'model':db[_0x112650['model']],'as':_0x112650['as'],'attributes':_0x112650[_0x6fd0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6fd0('0x11')](function(_0x2a90bf){logger['info'](_0x6fd0('0x27'),_0x357d34);logger[_0x6fd0('0x14')](_0x6fd0('0x27'),_0x357d34,JSON[_0x6fd0('0x26')](_0x2a90bf));_0x16cb67(_0x2a90bf);})[_0x6fd0('0x1a')](function(_0x18ba05){logger[_0x6fd0('0x16')](_0x6fd0('0x27'),_0x18ba05['message'],_0x357d34);_0x3374ae(_0x578d70['error'](0x1f4,_0x18ba05['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 8df27e9..913054a 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 _0x9aa8=['openchannelQueue:','./openchannelQueue.events','remove','update','emit','removeListener','register','length'];(function(_0x458832,_0x1fdc31){var _0x2b7a6a=function(_0x307027){while(--_0x307027){_0x458832['push'](_0x458832['shift']());}};_0x2b7a6a(++_0x1fdc31);}(_0x9aa8,0x171));var _0x89aa=function(_0x3de849,_0x35af1d){_0x3de849=_0x3de849-0x0;var _0x55e555=_0x9aa8[_0x3de849];return _0x55e555;};'use strict';var OpenchannelQueueEvents=require(_0x89aa('0x0'));var events=['save',_0x89aa('0x1'),_0x89aa('0x2')];function createListener(_0x2cfaa7,_0x39c337){return function(_0x245253){_0x39c337[_0x89aa('0x3')](_0x2cfaa7,_0x245253);};}function removeListener(_0x418e8e,_0x5ec850){return function(){OpenchannelQueueEvents[_0x89aa('0x4')](_0x418e8e,_0x5ec850);};}exports[_0x89aa('0x5')]=function(_0x3e13d4){for(var _0x4c8bd5=0x0,_0x27015c=events[_0x89aa('0x6')];_0x4c8bd5<_0x27015c;_0x4c8bd5++){var _0x380800=events[_0x4c8bd5];var _0x4203a8=createListener(_0x89aa('0x7')+_0x380800,_0x3e13d4);OpenchannelQueueEvents['on'](_0x380800,_0x4203a8);}}; \ No newline at end of file +var _0xebdd=['remove','update','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xebdd,0x1be));var _0xdebd=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0xebdd[_0x4c2dfc];return _0xfd728d;};'use strict';var OpenchannelQueueEvents=require(_0xdebd('0x0'));var events=[_0xdebd('0x1'),_0xdebd('0x2'),_0xdebd('0x3')];function createListener(_0x180d50,_0x48e1be){return function(_0x2e78c2){_0x48e1be[_0xdebd('0x4')](_0x180d50,_0x2e78c2);};}function removeListener(_0x4b3fc2,_0x441873){return function(){OpenchannelQueueEvents[_0xdebd('0x5')](_0x4b3fc2,_0x441873);};}exports['register']=function(_0x3e8c91){for(var _0x5a49b9=0x0,_0x1cd7f4=events[_0xdebd('0x6')];_0x5a49b9<_0x1cd7f4;_0x5a49b9++){var _0x22fe3e=events[_0x5a49b9];var _0x2a8a12=createListener(_0xdebd('0x7')+_0x22fe3e,_0x3e8c91);OpenchannelQueueEvents['on'](_0x22fe3e,_0x2a8a12);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index d63e4b6..b83a8a2 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 _0xdcc5=['describe','show','post','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','/describe','isAuthenticated'];(function(_0x514d92,_0x3d85b2){var _0x263f7f=function(_0x262afb){while(--_0x262afb){_0x514d92['push'](_0x514d92['shift']());}};_0x263f7f(++_0x3d85b2);}(_0xdcc5,0x126));var _0x5dcc=function(_0x15e9b7,_0x4307ed){_0x15e9b7=_0x15e9b7-0x0;var _0x58dd3f=_0xdcc5[_0x15e9b7];return _0x58dd3f;};'use strict';var multer=require('multer');var util=require(_0x5dcc('0x0'));var path=require(_0x5dcc('0x1'));var timeout=require(_0x5dcc('0x2'));var express=require(_0x5dcc('0x3'));var router=express[_0x5dcc('0x4')]();var fs_extra=require(_0x5dcc('0x5'));var auth=require(_0x5dcc('0x6'));var interaction=require(_0x5dcc('0x7'));var config=require('../../config/environment');var controller=require(_0x5dcc('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5dcc('0x9')](_0x5dcc('0xa'),auth[_0x5dcc('0xb')](),controller[_0x5dcc('0xc')]);router['get']('/:id',auth[_0x5dcc('0xb')](),controller[_0x5dcc('0xd')]);router[_0x5dcc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5dcc('0xf'),auth[_0x5dcc('0xb')](),controller['update']);router['delete'](_0x5dcc('0xf'),auth['isAuthenticated'](),controller[_0x5dcc('0x10')]);module[_0x5dcc('0x11')]=router; \ No newline at end of file +var _0xc5be=['/:id','show','post','create','put','update','delete','exports','util','path','express','Router','fs-extra','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x3a1248,_0x2872d6){var _0x5ac675=function(_0x99f629){while(--_0x99f629){_0x3a1248['push'](_0x3a1248['shift']());}};_0x5ac675(++_0x2872d6);}(_0xc5be,0x1e3));var _0xec5b=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xc5be[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require('multer');var util=require(_0xec5b('0x0'));var path=require(_0xec5b('0x1'));var timeout=require('connect-timeout');var express=require(_0xec5b('0x2'));var router=express[_0xec5b('0x3')]();var fs_extra=require(_0xec5b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xec5b('0x5'));var controller=require(_0xec5b('0x6'));router[_0xec5b('0x7')]('/',auth[_0xec5b('0x8')](),controller['index']);router[_0xec5b('0x7')](_0xec5b('0x9'),auth[_0xec5b('0x8')](),controller[_0xec5b('0xa')]);router[_0xec5b('0x7')](_0xec5b('0xb'),auth[_0xec5b('0x8')](),controller[_0xec5b('0xc')]);router[_0xec5b('0xd')]('/',auth[_0xec5b('0x8')](),controller[_0xec5b('0xe')]);router[_0xec5b('0xf')](_0xec5b('0xb'),auth[_0xec5b('0x8')](),controller[_0xec5b('0x10')]);router[_0xec5b('0x11')](_0xec5b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xec5b('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c9b27fb..94ca4ce 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 _0x705a=['exports','STRING','DATE','sequelize'];(function(_0x1de0b6,_0xa5e799){var _0x22d61d=function(_0x283a31){while(--_0x283a31){_0x1de0b6['push'](_0x1de0b6['shift']());}};_0x22d61d(++_0xa5e799);}(_0x705a,0x7f));var _0xa705=function(_0x35faef,_0xdc61e7){_0x35faef=_0x35faef-0x0;var _0x30a421=_0x705a[_0x35faef];return _0x30a421;};'use strict';var moment=require('moment');var Sequelize=require(_0xa705('0x0'));module[_0xa705('0x1')]={'uniqueid':{'type':Sequelize[_0xa705('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa705('0x2')]},'joinAt':{'type':Sequelize[_0xa705('0x3')]},'leaveAt':{'type':Sequelize[_0xa705('0x3')]},'acceptAt':{'type':Sequelize[_0xa705('0x3')]},'exitAt':{'type':Sequelize[_0xa705('0x3')]},'reason':{'type':Sequelize[_0xa705('0x2')]}}; \ No newline at end of file +var _0x14f8=['STRING','DATE','sequelize','exports'];(function(_0x567eba,_0x20baf4){var _0x5c97fc=function(_0x3cb458){while(--_0x3cb458){_0x567eba['push'](_0x567eba['shift']());}};_0x5c97fc(++_0x20baf4);}(_0x14f8,0x66));var _0x814f=function(_0x4aa58b,_0x17e87a){_0x4aa58b=_0x4aa58b-0x0;var _0x4f50f8=_0x14f8[_0x4aa58b];return _0x4f50f8;};'use strict';var moment=require('moment');var Sequelize=require(_0x814f('0x0'));module[_0x814f('0x1')]={'uniqueid':{'type':Sequelize[_0x814f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x814f('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x814f('0x3')]},'reason':{'type':Sequelize[_0x814f('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 0866a56..ca4d704 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 _0xfb9f=['catch','show','params','rawAttributes','include','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','OpenchannelQueueReport','findAll','rows'];(function(_0x469c6c,_0x5daf29){var _0x2e9b29=function(_0x143263){while(--_0x143263){_0x469c6c['push'](_0x469c6c['shift']());}};_0x2e9b29(++_0x5daf29);}(_0xfb9f,0x17c));var _0xffb9=function(_0x52b50b,_0x5d60b8){_0x52b50b=_0x52b50b-0x0;var _0x41d66c=_0xfb9f[_0x52b50b];return _0x41d66c;};'use strict';var emlformat=require(_0xffb9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xffb9('0x1'));var jsonpatch=require(_0xffb9('0x2'));var rp=require(_0xffb9('0x3'));var moment=require('moment');var BPromise=require(_0xffb9('0x4'));var Mustache=require('mustache');var util=require(_0xffb9('0x5'));var path=require(_0xffb9('0x6'));var sox=require(_0xffb9('0x7'));var csv=require(_0xffb9('0x8'));var ejs=require(_0xffb9('0x9'));var fs=require('fs');var fs_extra=require(_0xffb9('0xa'));var _=require(_0xffb9('0xb'));var squel=require('squel');var crypto=require(_0xffb9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xffb9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xffb9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xffb9('0xf'));var qs=require(_0xffb9('0x10'));var as=require(_0xffb9('0x11'));var hardwareService=require(_0xffb9('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xffb9('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xffb9('0x14'))['db'];function respondWithStatusCode(_0x1aafe0,_0x43e25f){_0x43e25f=_0x43e25f||0xcc;return function(_0x1ebdaf){if(_0x1ebdaf){return _0x1aafe0['sendStatus'](_0x43e25f);}return _0x1aafe0[_0xffb9('0x15')](_0x43e25f)[_0xffb9('0x16')]();};}function respondWithResult(_0x15ddab,_0x41877f){_0x41877f=_0x41877f||0xc8;return function(_0x11f103){if(_0x11f103){return _0x15ddab['status'](_0x41877f)['json'](_0x11f103);}};}function respondWithFilteredResult(_0x3e8fec,_0x518ef5){return function(_0x401fae){if(_0x401fae){var _0x4df98a=typeof _0x518ef5[_0xffb9('0x17')]===_0xffb9('0x18')&&typeof _0x518ef5[_0xffb9('0x19')]===_0xffb9('0x18');var _0xdae423=_0x401fae[_0xffb9('0x1a')];var _0x474ace=_0x4df98a?0x0:_0x518ef5[_0xffb9('0x17')];var _0x2fcb02=_0x4df98a?_0x401fae[_0xffb9('0x1a')]:_0x518ef5[_0xffb9('0x17')]+_0x518ef5[_0xffb9('0x19')];var _0x5b8c71;if(_0x2fcb02>=_0xdae423){_0x2fcb02=_0xdae423;_0x5b8c71=0xc8;}else{_0x5b8c71=0xce;}_0x3e8fec[_0xffb9('0x15')](_0x5b8c71);return _0x3e8fec[_0xffb9('0x1b')](_0xffb9('0x1c'),_0x474ace+'-'+_0x2fcb02+'/'+_0xdae423)[_0xffb9('0x1d')](_0x401fae);}return null;};}function patchUpdates(_0x3926ef){return function(_0x16357e){try{jsonpatch[_0xffb9('0x1e')](_0x16357e,_0x3926ef,!![]);}catch(_0x31809f){return BPromise[_0xffb9('0x1f')](_0x31809f);}return _0x16357e[_0xffb9('0x20')]();};}function saveUpdates(_0xfaa361,_0x4e2c0c){return function(_0x108011){if(_0x108011){return _0x108011[_0xffb9('0x21')](_0xfaa361)[_0xffb9('0x22')](function(_0x29ec0c){return _0x29ec0c;});}return null;};}function removeEntity(_0x546bc7,_0x8168f5){return function(_0x185c56){if(_0x185c56){return _0x185c56['destroy']()[_0xffb9('0x22')](function(){_0x546bc7[_0xffb9('0x15')](0xcc)[_0xffb9('0x16')]();});}};}function handleEntityNotFound(_0x1fc1bc,_0x5077cb){return function(_0x5b5db0){if(!_0x5b5db0){_0x1fc1bc[_0xffb9('0x23')](0x194);}return _0x5b5db0;};}function handleError(_0x3727a9,_0x122789){_0x122789=_0x122789||0x1f4;return function(_0x292615){logger[_0xffb9('0x24')](_0x292615[_0xffb9('0x25')]);if(_0x292615[_0xffb9('0x26')]){delete _0x292615[_0xffb9('0x26')];}_0x3727a9[_0xffb9('0x15')](_0x122789)[_0xffb9('0x27')](_0x292615);};}exports[_0xffb9('0x28')]=function(_0x5e73bd,_0x627ccb){var _0x2a970c={},_0x483afa={},_0x7310d9={'count':0x0,'rows':[]};var _0x3e33d2=_['map'](db['OpenchannelQueueReport']['rawAttributes'],function(_0x5ada83){return{'name':_0x5ada83[_0xffb9('0x29')],'type':_0x5ada83[_0xffb9('0x2a')][_0xffb9('0x2b')]};});_0x483afa[_0xffb9('0x2c')]=_[_0xffb9('0x2d')](_0x3e33d2,'name');_0x483afa[_0xffb9('0x2e')]=_[_0xffb9('0x2f')](_0x5e73bd[_0xffb9('0x2e')]);_0x483afa[_0xffb9('0x30')]=_[_0xffb9('0x31')](_0x483afa[_0xffb9('0x2c')],_0x483afa[_0xffb9('0x2e')]);_0x2a970c['attributes']=_['intersection'](_0x483afa[_0xffb9('0x2c')],qs[_0xffb9('0x32')](_0x5e73bd['query']['fields']));_0x2a970c[_0xffb9('0x33')]=_0x2a970c[_0xffb9('0x33')][_0xffb9('0x34')]?_0x2a970c[_0xffb9('0x33')]:_0x483afa['model'];if(!_0x5e73bd[_0xffb9('0x2e')][_0xffb9('0x35')](_0xffb9('0x36'))){_0x2a970c['limit']=qs[_0xffb9('0x19')](_0x5e73bd['query'][_0xffb9('0x19')]);_0x2a970c['offset']=qs['offset'](_0x5e73bd[_0xffb9('0x2e')][_0xffb9('0x17')]);}_0x2a970c[_0xffb9('0x37')]=qs[_0xffb9('0x38')](_0x5e73bd['query']['sort']);_0x2a970c[_0xffb9('0x39')]=qs[_0xffb9('0x30')](_[_0xffb9('0x3a')](_0x5e73bd[_0xffb9('0x2e')],_0x483afa['filters']),_0x3e33d2);if(_0x5e73bd[_0xffb9('0x2e')]['filter']){_0x2a970c[_0xffb9('0x39')]=_['merge'](_0x2a970c[_0xffb9('0x39')],{'$or':_['map'](_0x3e33d2,function(_0x2f9619){if(_0x2f9619['type']!=='VIRTUAL'){var _0x2cbf00={};_0x2cbf00[_0x2f9619[_0xffb9('0x26')]]={'$like':'%'+_0x5e73bd[_0xffb9('0x2e')][_0xffb9('0x3b')]+'%'};return _0x2cbf00;}})});}_0x2a970c=_['merge']({},_0x2a970c,_0x5e73bd[_0xffb9('0x3c')]);var _0x16ea9f={'where':_0x2a970c[_0xffb9('0x39')]};return db[_0xffb9('0x3d')][_0xffb9('0x1a')](_0x16ea9f)[_0xffb9('0x22')](function(_0x1e4fba){_0x7310d9[_0xffb9('0x1a')]=_0x1e4fba;if(_0x5e73bd['query']['includeAll']){_0x2a970c['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xffb9('0x3e')](_0x2a970c);})[_0xffb9('0x22')](function(_0x8623ff){_0x7310d9[_0xffb9('0x3f')]=_0x8623ff;return _0x7310d9;})['then'](respondWithFilteredResult(_0x627ccb,_0x2a970c))[_0xffb9('0x40')](handleError(_0x627ccb,null));};exports[_0xffb9('0x41')]=function(_0x50c167,_0xfaab07){var _0x2644be={'raw':!![],'where':{'id':_0x50c167[_0xffb9('0x42')]['id']}},_0x417720={};_0x417720['model']=_['keys'](db[_0xffb9('0x3d')][_0xffb9('0x43')]);_0x417720[_0xffb9('0x2e')]=_[_0xffb9('0x2f')](_0x50c167['query']);_0x417720['filters']=_[_0xffb9('0x31')](_0x417720[_0xffb9('0x2c')],_0x417720[_0xffb9('0x2e')]);_0x2644be[_0xffb9('0x33')]=_[_0xffb9('0x31')](_0x417720[_0xffb9('0x2c')],qs[_0xffb9('0x32')](_0x50c167[_0xffb9('0x2e')]['fields']));_0x2644be[_0xffb9('0x33')]=_0x2644be[_0xffb9('0x33')][_0xffb9('0x34')]?_0x2644be['attributes']:_0x417720[_0xffb9('0x2c')];if(_0x50c167[_0xffb9('0x2e')]['includeAll']){_0x2644be[_0xffb9('0x44')]=[{'all':!![]}];}_0x2644be=_['merge']({},_0x2644be,_0x50c167[_0xffb9('0x3c')]);return db[_0xffb9('0x3d')]['find'](_0x2644be)[_0xffb9('0x22')](handleEntityNotFound(_0xfaab07,null))['then'](respondWithResult(_0xfaab07,null))[_0xffb9('0x40')](handleError(_0xfaab07,null));};exports[_0xffb9('0x45')]=function(_0x53b911,_0x4b6907){return db[_0xffb9('0x3d')][_0xffb9('0x45')](_0x53b911[_0xffb9('0x46')],{})[_0xffb9('0x22')](respondWithResult(_0x4b6907,0xc9))[_0xffb9('0x40')](handleError(_0x4b6907,null));};exports[_0xffb9('0x21')]=function(_0x53653c,_0x710bf9){if(_0x53653c[_0xffb9('0x46')]['id']){delete _0x53653c[_0xffb9('0x46')]['id'];}return db[_0xffb9('0x3d')][_0xffb9('0x47')]({'where':{'id':_0x53653c[_0xffb9('0x42')]['id']}})['then'](handleEntityNotFound(_0x710bf9,null))[_0xffb9('0x22')](saveUpdates(_0x53653c['body'],null))[_0xffb9('0x22')](respondWithResult(_0x710bf9,null))[_0xffb9('0x40')](handleError(_0x710bf9,null));};exports[_0xffb9('0x48')]=function(_0x118f16,_0x3e29b7){return db[_0xffb9('0x3d')][_0xffb9('0x47')]({'where':{'id':_0x118f16[_0xffb9('0x42')]['id']}})[_0xffb9('0x22')](handleEntityNotFound(_0x3e29b7,null))[_0xffb9('0x22')](removeEntity(_0x3e29b7,null))[_0xffb9('0x40')](handleError(_0x3e29b7,null));};exports[_0xffb9('0x49')]=function(_0x5d75de,_0x316de2){return db['OpenchannelQueueReport'][_0xffb9('0x49')]()['then'](respondWithResult(_0x316de2,null))[_0xffb9('0x40')](handleError(_0x316de2,null));}; \ No newline at end of file +var _0x61f5=['filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','filters','include','find','create','body','params','destroy','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','limit','count','status','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick'];(function(_0x26dde3,_0x1d07d9){var _0x251970=function(_0x46e745){while(--_0x46e745){_0x26dde3['push'](_0x26dde3['shift']());}};_0x251970(++_0x1d07d9);}(_0x61f5,0x193));var _0x561f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x61f5[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x561f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x561f('0x1'));var rp=require('request-promise');var moment=require(_0x561f('0x2'));var BPromise=require(_0x561f('0x3'));var Mustache=require(_0x561f('0x4'));var util=require(_0x561f('0x5'));var path=require(_0x561f('0x6'));var sox=require(_0x561f('0x7'));var csv=require(_0x561f('0x8'));var ejs=require(_0x561f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x561f('0xa'));var squel=require(_0x561f('0xb'));var crypto=require(_0x561f('0xc'));var jsforce=require(_0x561f('0xd'));var deskjs=require(_0x561f('0xe'));var toCsv=require(_0x561f('0x8'));var querystring=require('querystring');var Papa=require(_0x561f('0xf'));var Redis=require(_0x561f('0x10'));var authService=require(_0x561f('0x11'));var qs=require(_0x561f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x561f('0x13'));var logger=require(_0x561f('0x14'))(_0x561f('0x15'));var utils=require(_0x561f('0x16'));var config=require(_0x561f('0x17'));var licenseUtil=require(_0x561f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11c347,_0x524f9c){_0x524f9c=_0x524f9c||0xcc;return function(_0x447e87){if(_0x447e87){return _0x11c347[_0x561f('0x19')](_0x524f9c);}return _0x11c347['status'](_0x524f9c)[_0x561f('0x1a')]();};}function respondWithResult(_0x552d50,_0x1e54fd){_0x1e54fd=_0x1e54fd||0xc8;return function(_0x369e8b){if(_0x369e8b){return _0x552d50['status'](_0x1e54fd)['json'](_0x369e8b);}};}function respondWithFilteredResult(_0x5192b5,_0x428133){return function(_0x31591a){if(_0x31591a){var _0x2ee690=typeof _0x428133[_0x561f('0x1b')]==='undefined'&&typeof _0x428133[_0x561f('0x1c')]==='undefined';var _0x38b871=_0x31591a[_0x561f('0x1d')];var _0x3758c1=_0x2ee690?0x0:_0x428133[_0x561f('0x1b')];var _0x48512c=_0x2ee690?_0x31591a[_0x561f('0x1d')]:_0x428133[_0x561f('0x1b')]+_0x428133['limit'];var _0x3a8f3a;if(_0x48512c>=_0x38b871){_0x48512c=_0x38b871;_0x3a8f3a=0xc8;}else{_0x3a8f3a=0xce;}_0x5192b5[_0x561f('0x1e')](_0x3a8f3a);return _0x5192b5['set'](_0x561f('0x1f'),_0x3758c1+'-'+_0x48512c+'/'+_0x38b871)[_0x561f('0x20')](_0x31591a);}return null;};}function patchUpdates(_0xcef299){return function(_0x21d7d8){try{jsonpatch[_0x561f('0x21')](_0x21d7d8,_0xcef299,!![]);}catch(_0x55c9fc){return BPromise[_0x561f('0x22')](_0x55c9fc);}return _0x21d7d8[_0x561f('0x23')]();};}function saveUpdates(_0x1082d5,_0x447202){return function(_0x741fdb){if(_0x741fdb){return _0x741fdb[_0x561f('0x24')](_0x1082d5)['then'](function(_0x2877cf){return _0x2877cf;});}return null;};}function removeEntity(_0x44ee76,_0x23eff3){return function(_0x162eec){if(_0x162eec){return _0x162eec['destroy']()[_0x561f('0x25')](function(){_0x44ee76[_0x561f('0x1e')](0xcc)[_0x561f('0x1a')]();});}};}function handleEntityNotFound(_0x1d6549,_0x1ffab3){return function(_0xc46011){if(!_0xc46011){_0x1d6549[_0x561f('0x19')](0x194);}return _0xc46011;};}function handleError(_0x5f055d,_0x31a037){_0x31a037=_0x31a037||0x1f4;return function(_0xa2f424){logger[_0x561f('0x26')](_0xa2f424[_0x561f('0x27')]);if(_0xa2f424[_0x561f('0x28')]){delete _0xa2f424[_0x561f('0x28')];}_0x5f055d[_0x561f('0x1e')](_0x31a037)[_0x561f('0x29')](_0xa2f424);};}exports[_0x561f('0x2a')]=function(_0x2f2469,_0x4a3f72){var _0x48ef47={},_0x37670d={},_0x5f4a9e={'count':0x0,'rows':[]};var _0xd1d195=_[_0x561f('0x2b')](db[_0x561f('0x2c')][_0x561f('0x2d')],function(_0xe8a928){return{'name':_0xe8a928[_0x561f('0x2e')],'type':_0xe8a928['type'][_0x561f('0x2f')]};});_0x37670d[_0x561f('0x30')]=_[_0x561f('0x2b')](_0xd1d195,_0x561f('0x28'));_0x37670d[_0x561f('0x31')]=_[_0x561f('0x32')](_0x2f2469[_0x561f('0x31')]);_0x37670d['filters']=_[_0x561f('0x33')](_0x37670d[_0x561f('0x30')],_0x37670d['query']);_0x48ef47['attributes']=_[_0x561f('0x33')](_0x37670d[_0x561f('0x30')],qs['fields'](_0x2f2469['query'][_0x561f('0x34')]));_0x48ef47['attributes']=_0x48ef47[_0x561f('0x35')][_0x561f('0x36')]?_0x48ef47[_0x561f('0x35')]:_0x37670d['model'];if(!_0x2f2469[_0x561f('0x31')][_0x561f('0x37')](_0x561f('0x38'))){_0x48ef47[_0x561f('0x1c')]=qs[_0x561f('0x1c')](_0x2f2469[_0x561f('0x31')][_0x561f('0x1c')]);_0x48ef47[_0x561f('0x1b')]=qs[_0x561f('0x1b')](_0x2f2469[_0x561f('0x31')][_0x561f('0x1b')]);}_0x48ef47[_0x561f('0x39')]=qs['sort'](_0x2f2469['query']['sort']);_0x48ef47['where']=qs['filters'](_[_0x561f('0x3a')](_0x2f2469['query'],_0x37670d['filters']),_0xd1d195);if(_0x2f2469[_0x561f('0x31')][_0x561f('0x3b')]){_0x48ef47[_0x561f('0x3c')]=_['merge'](_0x48ef47[_0x561f('0x3c')],{'$or':_[_0x561f('0x2b')](_0xd1d195,function(_0x31a215){if(_0x31a215[_0x561f('0x3d')]!==_0x561f('0x3e')){var _0x1983f8={};_0x1983f8[_0x31a215[_0x561f('0x28')]]={'$like':'%'+_0x2f2469[_0x561f('0x31')]['filter']+'%'};return _0x1983f8;}})});}_0x48ef47=_[_0x561f('0x3f')]({},_0x48ef47,_0x2f2469[_0x561f('0x40')]);var _0x2170fe={'where':_0x48ef47[_0x561f('0x3c')]};return db[_0x561f('0x2c')][_0x561f('0x1d')](_0x2170fe)['then'](function(_0x1ad1c5){_0x5f4a9e[_0x561f('0x1d')]=_0x1ad1c5;if(_0x2f2469[_0x561f('0x31')][_0x561f('0x41')]){_0x48ef47['include']=[{'all':!![]}];}return db[_0x561f('0x2c')][_0x561f('0x42')](_0x48ef47);})['then'](function(_0x55d21b){_0x5f4a9e[_0x561f('0x43')]=_0x55d21b;return _0x5f4a9e;})['then'](respondWithFilteredResult(_0x4a3f72,_0x48ef47))[_0x561f('0x44')](handleError(_0x4a3f72,null));};exports[_0x561f('0x45')]=function(_0xef61d7,_0x39e8bc){var _0x47fda9={'raw':!![],'where':{'id':_0xef61d7['params']['id']}},_0x499add={};_0x499add['model']=_['keys'](db[_0x561f('0x2c')][_0x561f('0x2d')]);_0x499add[_0x561f('0x31')]=_[_0x561f('0x32')](_0xef61d7[_0x561f('0x31')]);_0x499add[_0x561f('0x46')]=_[_0x561f('0x33')](_0x499add[_0x561f('0x30')],_0x499add[_0x561f('0x31')]);_0x47fda9[_0x561f('0x35')]=_['intersection'](_0x499add[_0x561f('0x30')],qs[_0x561f('0x34')](_0xef61d7[_0x561f('0x31')][_0x561f('0x34')]));_0x47fda9[_0x561f('0x35')]=_0x47fda9['attributes']['length']?_0x47fda9['attributes']:_0x499add[_0x561f('0x30')];if(_0xef61d7['query'][_0x561f('0x41')]){_0x47fda9[_0x561f('0x47')]=[{'all':!![]}];}_0x47fda9=_[_0x561f('0x3f')]({},_0x47fda9,_0xef61d7[_0x561f('0x40')]);return db[_0x561f('0x2c')][_0x561f('0x48')](_0x47fda9)['then'](handleEntityNotFound(_0x39e8bc,null))[_0x561f('0x25')](respondWithResult(_0x39e8bc,null))[_0x561f('0x44')](handleError(_0x39e8bc,null));};exports[_0x561f('0x49')]=function(_0x7d26a3,_0xacd59e){return db[_0x561f('0x2c')][_0x561f('0x49')](_0x7d26a3['body'],{})[_0x561f('0x25')](respondWithResult(_0xacd59e,0xc9))[_0x561f('0x44')](handleError(_0xacd59e,null));};exports[_0x561f('0x24')]=function(_0x279a4e,_0xb5e67c){if(_0x279a4e[_0x561f('0x4a')]['id']){delete _0x279a4e[_0x561f('0x4a')]['id'];}return db[_0x561f('0x2c')][_0x561f('0x48')]({'where':{'id':_0x279a4e[_0x561f('0x4b')]['id']}})[_0x561f('0x25')](handleEntityNotFound(_0xb5e67c,null))[_0x561f('0x25')](saveUpdates(_0x279a4e[_0x561f('0x4a')],null))[_0x561f('0x25')](respondWithResult(_0xb5e67c,null))[_0x561f('0x44')](handleError(_0xb5e67c,null));};exports[_0x561f('0x4c')]=function(_0x291871,_0x56d920){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x291871[_0x561f('0x4b')]['id']}})[_0x561f('0x25')](handleEntityNotFound(_0x56d920,null))[_0x561f('0x25')](removeEntity(_0x56d920,null))[_0x561f('0x44')](handleError(_0x56d920,null));};exports['describe']=function(_0x540d7c,_0x369855){return db['OpenchannelQueueReport']['describe']()[_0x561f('0x25')](respondWithResult(_0x369855,null))[_0x561f('0x44')](handleError(_0x369855,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 579be15..7e09c09 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x19f33e,_0x212a54){var _0x23c9ca=function(_0x414a85){while(--_0x414a85){_0x19f33e['push'](_0x19f33e['shift']());}};_0x23c9ca(++_0x212a54);}(_0x7a54,0x106));var _0x47a5=function(_0x34c950,_0x325202){_0x34c950=_0x34c950-0x0;var _0x2d1ac9=_0x7a54[_0x34c950];return _0x2d1ac9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x814b,0x1a2));var _0xb814=function(_0x2b3478,_0x58afd7){_0x2b3478=_0x2b3478-0x0;var _0x1c106f=_0x814b[_0x2b3478];return _0x1c106f;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 4be7efb..8c937c1 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 _0x23a3=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','raw','UpdateOpenchannelQueueReport','body','options','where','attributes','limit','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0x23a3,0x131));var _0x323a=function(_0x1bdaca,_0x36c243){_0x1bdaca=_0x1bdaca-0x0;var _0x48f486=_0x23a3[_0x1bdaca];return _0x48f486;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x323a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x323a('0x1'));var db=require(_0x323a('0x2'))['db'];var utils=require(_0x323a('0x3'));var logger=require(_0x323a('0x4'))(_0x323a('0x5'));var config=require(_0x323a('0x6'));var jayson=require(_0x323a('0x7'));var client=jayson[_0x323a('0x8')][_0x323a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad5a,_0x3452d3,_0x3544bd){return new BPromise(function(_0x568996,_0x385a54){return client[_0x323a('0xa')](_0x50ad5a,_0x3544bd)[_0x323a('0xb')](function(_0x4a74bd){logger[_0x323a('0xc')](_0x323a('0xd'),_0x3452d3,_0x323a('0xe'));logger[_0x323a('0xf')](_0x323a('0x10'),_0x3452d3,_0x323a('0xe'),JSON[_0x323a('0x11')](_0x4a74bd));if(_0x4a74bd[_0x323a('0x12')]){if(_0x4a74bd[_0x323a('0x12')][_0x323a('0x13')]===0x1f4){logger[_0x323a('0x12')](_0x323a('0xd'),_0x3452d3,_0x4a74bd[_0x323a('0x12')][_0x323a('0x14')]);return _0x385a54(_0x4a74bd['error'][_0x323a('0x14')]);}logger['error'](_0x323a('0xd'),_0x3452d3,_0x4a74bd['error']['message']);return _0x568996(_0x4a74bd[_0x323a('0x12')]['message']);}else{logger[_0x323a('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3452d3,_0x323a('0xe'));_0x568996(_0x4a74bd[_0x323a('0x15')]['message']);}})[_0x323a('0x16')](function(_0x32674f){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3452d3,_0x32674f);_0x385a54(_0x32674f);});});}exports[_0x323a('0x17')]=function(_0x221ae4){var _0x2feed1=this;return new Promise(function(_0x29dd21,_0x303338){return db[_0x323a('0x18')]['create'](_0x221ae4['body'],{'raw':_0x221ae4['options']?_0x221ae4['options'][_0x323a('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xc0f3e4){logger[_0x323a('0xc')](_0x323a('0x17'),_0x221ae4);logger[_0x323a('0xf')]('CreateOpenchannelQueueReport',_0x221ae4,JSON[_0x323a('0x11')](_0xc0f3e4));_0x29dd21(_0xc0f3e4);})['catch'](function(_0x12c8d7){logger[_0x323a('0x12')](_0x323a('0x17'),_0x12c8d7['message'],_0x221ae4);_0x303338(_0x2feed1[_0x323a('0x12')](0x1f4,_0x12c8d7[_0x323a('0x14')]));});});};exports[_0x323a('0x1a')]=function(_0x2960e0){var _0x35f8ec=this;return new Promise(function(_0x204f76,_0x5ba015){return db[_0x323a('0x18')]['update'](_0x2960e0[_0x323a('0x1b')],{'raw':_0x2960e0[_0x323a('0x1c')]?_0x2960e0[_0x323a('0x1c')][_0x323a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2960e0[_0x323a('0x1c')]?_0x2960e0['options'][_0x323a('0x1d')]||null:null,'attributes':_0x2960e0[_0x323a('0x1c')]?_0x2960e0[_0x323a('0x1c')][_0x323a('0x1e')]||null:null,'limit':_0x2960e0[_0x323a('0x1c')]?_0x2960e0['options'][_0x323a('0x1f')]||null:null})['then'](function(_0x24747b){logger[_0x323a('0xc')](_0x323a('0x1a'),_0x2960e0);logger[_0x323a('0xf')](_0x323a('0x1a'),_0x2960e0,JSON[_0x323a('0x11')](_0x24747b));_0x204f76(_0x24747b);})['catch'](function(_0x2a1a85){logger[_0x323a('0x12')]('UpdateOpenchannelQueueReport',_0x2a1a85[_0x323a('0x14')],_0x2960e0);_0x5ba015(_0x35f8ec['error'](0x1f4,_0x2a1a85['message']));});});}; \ No newline at end of file +var _0xed3c=['then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw'];(function(_0xd0b9ff,_0x26bc08){var _0x160dbf=function(_0x7d597e){while(--_0x7d597e){_0xd0b9ff['push'](_0xd0b9ff['shift']());}};_0x160dbf(++_0x26bc08);}(_0xed3c,0x1a6));var _0xced3=function(_0x5ed7af,_0x422676){_0x5ed7af=_0x5ed7af-0x0;var _0x29a495=_0xed3c[_0x5ed7af];return _0x29a495;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4795cd,_0x510164,_0x5ca701){return new BPromise(function(_0x851bd3,_0x5f2f90){return client['request'](_0x4795cd,_0x5ca701)['then'](function(_0x19a727){logger[_0xced3('0xb')](_0xced3('0xc'),_0x510164,_0xced3('0xd'));logger[_0xced3('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x510164,_0xced3('0xd'),JSON[_0xced3('0xf')](_0x19a727));if(_0x19a727[_0xced3('0x10')]){if(_0x19a727['error'][_0xced3('0x11')]===0x1f4){logger[_0xced3('0x10')](_0xced3('0xc'),_0x510164,_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);return _0x5f2f90(_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);}logger['error'](_0xced3('0xc'),_0x510164,_0x19a727['error'][_0xced3('0x12')]);return _0x851bd3(_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);}else{logger[_0xced3('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x510164,_0xced3('0xd'));_0x851bd3(_0x19a727[_0xced3('0x13')]['message']);}})[_0xced3('0x14')](function(_0x37e2d5){logger[_0xced3('0x10')](_0xced3('0xc'),_0x510164,_0x37e2d5);_0x5f2f90(_0x37e2d5);});});}exports['CreateOpenchannelQueueReport']=function(_0x4569af){var _0x4a3afe=this;return new Promise(function(_0x353580,_0x4480a6){return db[_0xced3('0x15')][_0xced3('0x16')](_0x4569af[_0xced3('0x17')],{'raw':_0x4569af[_0xced3('0x18')]?_0x4569af[_0xced3('0x18')][_0xced3('0x19')]===undefined?!![]:![]:!![]})[_0xced3('0x1a')](function(_0x17c011){logger[_0xced3('0xb')]('CreateOpenchannelQueueReport',_0x4569af);logger['debug']('CreateOpenchannelQueueReport',_0x4569af,JSON[_0xced3('0xf')](_0x17c011));_0x353580(_0x17c011);})[_0xced3('0x14')](function(_0x21e074){logger['error'](_0xced3('0x1b'),_0x21e074[_0xced3('0x12')],_0x4569af);_0x4480a6(_0x4a3afe['error'](0x1f4,_0x21e074['message']));});});};exports[_0xced3('0x1c')]=function(_0x101708){var _0x219fa8=this;return new Promise(function(_0x15c6c5,_0x50f7c1){return db[_0xced3('0x15')][_0xced3('0x1d')](_0x101708['body'],{'raw':_0x101708[_0xced3('0x18')]?_0x101708['options'][_0xced3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x101708[_0xced3('0x18')]?_0x101708[_0xced3('0x18')][_0xced3('0x1e')]||null:null,'attributes':_0x101708[_0xced3('0x18')]?_0x101708['options']['attributes']||null:null,'limit':_0x101708[_0xced3('0x18')]?_0x101708['options'][_0xced3('0x1f')]||null:null})[_0xced3('0x1a')](function(_0x4a8e85){logger[_0xced3('0xb')](_0xced3('0x1c'),_0x101708);logger[_0xced3('0xe')](_0xced3('0x1c'),_0x101708,JSON[_0xced3('0xf')](_0x4a8e85));_0x15c6c5(_0x4a8e85);})[_0xced3('0x14')](function(_0x895a32){logger[_0xced3('0x10')](_0xced3('0x1c'),_0x895a32['message'],_0x101708);_0x50f7c1(_0x219fa8[_0xced3('0x10')](0x1f4,_0x895a32[_0xced3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8fec178..774de22 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 _0xf67a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf67a,0x105));var _0xaf67=function(_0x4bebd0,_0x5c549c){_0x4bebd0=_0x4bebd0-0x0;var _0xaf70b4=_0xf67a[_0x4bebd0];return _0xaf70b4;};'use strict';var multer=require(_0xaf67('0x0'));var util=require(_0xaf67('0x1'));var path=require(_0xaf67('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf67('0x3'));var router=express[_0xaf67('0x4')]();var fs_extra=require(_0xaf67('0x5'));var auth=require(_0xaf67('0x6'));var interaction=require(_0xaf67('0x7'));var config=require(_0xaf67('0x8'));var controller=require(_0xaf67('0x9'));router[_0xaf67('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xaf67('0xb'),auth[_0xaf67('0xc')](),controller[_0xaf67('0xd')]);router['get'](_0xaf67('0xe'),auth['isAuthenticated'](),controller[_0xaf67('0xf')]);router[_0xaf67('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaf67('0x11')]('/:id',auth[_0xaf67('0xc')](),controller[_0xaf67('0x12')]);router[_0xaf67('0x13')](_0xaf67('0xe'),auth[_0xaf67('0xc')](),controller[_0xaf67('0x14')]);module[_0xaf67('0x15')]=router; \ No newline at end of file +var _0xd3de=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3de,0xac));var _0xed3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3de[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xed3d('0x0'));var util=require(_0xed3d('0x1'));var path=require(_0xed3d('0x2'));var timeout=require(_0xed3d('0x3'));var express=require(_0xed3d('0x4'));var router=express['Router']();var fs_extra=require(_0xed3d('0x5'));var auth=require(_0xed3d('0x6'));var interaction=require(_0xed3d('0x7'));var config=require(_0xed3d('0x8'));var controller=require(_0xed3d('0x9'));router[_0xed3d('0xa')]('/',auth[_0xed3d('0xb')](),controller[_0xed3d('0xc')]);router['get'](_0xed3d('0xd'),auth[_0xed3d('0xb')](),controller['describe']);router[_0xed3d('0xa')]('/:id',auth[_0xed3d('0xb')](),controller[_0xed3d('0xe')]);router[_0xed3d('0xf')]('/',auth['isAuthenticated'](),controller[_0xed3d('0x10')]);router[_0xed3d('0x11')](_0xed3d('0x12'),auth[_0xed3d('0xb')](),controller[_0xed3d('0x13')]);router['delete']('/:id',auth[_0xed3d('0xb')](),controller[_0xed3d('0x14')]);module[_0xed3d('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index e864856..02b7f2c 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x413bab,_0x3be4a6){var _0x283f04=function(_0x452fd2){while(--_0x452fd2){_0x413bab['push'](_0x413bab['shift']());}};_0x283f04(++_0x3be4a6);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3b8f2e,_0x5a99a8){_0x3b8f2e=_0x3b8f2e-0x0;var _0x1433d5=_0xf3cd[_0x3b8f2e];return _0x1433d5;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xa0e21f,_0x34add3){var _0x192cfe=function(_0x52c40a){while(--_0x52c40a){_0xa0e21f['push'](_0xa0e21f['shift']());}};_0x192cfe(++_0x34add3);}(_0x70e0,0x17b));var _0x070e=function(_0x6a1b28,_0x11a9f3){_0x6a1b28=_0x6a1b28-0x0;var _0x1f7247=_0x70e0[_0x6a1b28];return _0x1f7247;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 09448e6..8f94377 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 _0xdc50=['filter','merge','where','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc50,0x143));var _0x0dc5=function(_0x3e8a51,_0x564b40){_0x3e8a51=_0x3e8a51-0x0;var _0x1ecac3=_0xdc50[_0x3e8a51];return _0x1ecac3;};'use strict';var emlformat=require(_0x0dc5('0x0'));var rimraf=require(_0x0dc5('0x1'));var zipdir=require(_0x0dc5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0dc5('0x3'));var moment=require('moment');var BPromise=require(_0x0dc5('0x4'));var Mustache=require(_0x0dc5('0x5'));var util=require('util');var path=require(_0x0dc5('0x6'));var sox=require(_0x0dc5('0x7'));var csv=require(_0x0dc5('0x8'));var ejs=require(_0x0dc5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0dc5('0xa'));var squel=require(_0x0dc5('0xb'));var crypto=require(_0x0dc5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0dc5('0x8'));var querystring=require(_0x0dc5('0xd'));var Papa=require(_0x0dc5('0xe'));var Redis=require('ioredis');var authService=require(_0x0dc5('0xf'));var qs=require(_0x0dc5('0x10'));var as=require(_0x0dc5('0x11'));var hardwareService=require(_0x0dc5('0x12'));var logger=require(_0x0dc5('0x13'))('api');var utils=require(_0x0dc5('0x14'));var config=require(_0x0dc5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dc5('0x16'))['db'];function respondWithStatusCode(_0x4d8ef9,_0x176da2){_0x176da2=_0x176da2||0xcc;return function(_0x589e37){if(_0x589e37){return _0x4d8ef9['sendStatus'](_0x176da2);}return _0x4d8ef9['status'](_0x176da2)[_0x0dc5('0x17')]();};}function respondWithResult(_0x37fb8f,_0x52a360){_0x52a360=_0x52a360||0xc8;return function(_0x35b3ed){if(_0x35b3ed){return _0x37fb8f[_0x0dc5('0x18')](_0x52a360)[_0x0dc5('0x19')](_0x35b3ed);}};}function respondWithFilteredResult(_0x5738ee,_0x53dde1){return function(_0x4fe3e7){if(_0x4fe3e7){var _0x5ad37c=typeof _0x53dde1[_0x0dc5('0x1a')]===_0x0dc5('0x1b')&&typeof _0x53dde1[_0x0dc5('0x1c')]==='undefined';var _0x763893=_0x4fe3e7[_0x0dc5('0x1d')];var _0x3f2d9b=_0x5ad37c?0x0:_0x53dde1[_0x0dc5('0x1a')];var _0x40b93b=_0x5ad37c?_0x4fe3e7[_0x0dc5('0x1d')]:_0x53dde1[_0x0dc5('0x1a')]+_0x53dde1[_0x0dc5('0x1c')];var _0x515c43;if(_0x40b93b>=_0x763893){_0x40b93b=_0x763893;_0x515c43=0xc8;}else{_0x515c43=0xce;}_0x5738ee['status'](_0x515c43);return _0x5738ee[_0x0dc5('0x1e')](_0x0dc5('0x1f'),_0x3f2d9b+'-'+_0x40b93b+'/'+_0x763893)[_0x0dc5('0x19')](_0x4fe3e7);}return null;};}function patchUpdates(_0x1f68af){return function(_0x58a864){try{jsonpatch['apply'](_0x58a864,_0x1f68af,!![]);}catch(_0x31e3ce){return BPromise[_0x0dc5('0x20')](_0x31e3ce);}return _0x58a864[_0x0dc5('0x21')]();};}function saveUpdates(_0x1cd2a5,_0x1ebab9){return function(_0x4c9a9d){if(_0x4c9a9d){return _0x4c9a9d[_0x0dc5('0x22')](_0x1cd2a5)[_0x0dc5('0x23')](function(_0x4602b3){return _0x4602b3;});}return null;};}function removeEntity(_0x4ed77c,_0x556ea2){return function(_0x2b3aae){if(_0x2b3aae){return _0x2b3aae[_0x0dc5('0x24')]()[_0x0dc5('0x23')](function(){_0x4ed77c['status'](0xcc)[_0x0dc5('0x17')]();});}};}function handleEntityNotFound(_0x55fc5c,_0x1b31a0){return function(_0x2dab64){if(!_0x2dab64){_0x55fc5c[_0x0dc5('0x25')](0x194);}return _0x2dab64;};}function handleError(_0x4dd164,_0x21321c){_0x21321c=_0x21321c||0x1f4;return function(_0xfc048e){logger[_0x0dc5('0x26')](_0xfc048e[_0x0dc5('0x27')]);if(_0xfc048e[_0x0dc5('0x28')]){delete _0xfc048e[_0x0dc5('0x28')];}_0x4dd164['status'](_0x21321c)[_0x0dc5('0x29')](_0xfc048e);};}exports[_0x0dc5('0x2a')]=function(_0x38f960,_0x4ef4af){var _0x159186={},_0x1f9481={},_0x100c86={'count':0x0,'rows':[]};var _0x739cc6=_[_0x0dc5('0x2b')](db[_0x0dc5('0x2c')][_0x0dc5('0x2d')],function(_0x5be98f){return{'name':_0x5be98f[_0x0dc5('0x2e')],'type':_0x5be98f[_0x0dc5('0x2f')][_0x0dc5('0x30')]};});_0x1f9481[_0x0dc5('0x31')]=_[_0x0dc5('0x2b')](_0x739cc6,_0x0dc5('0x28'));_0x1f9481[_0x0dc5('0x32')]=_[_0x0dc5('0x33')](_0x38f960[_0x0dc5('0x32')]);_0x1f9481[_0x0dc5('0x34')]=_[_0x0dc5('0x35')](_0x1f9481[_0x0dc5('0x31')],_0x1f9481[_0x0dc5('0x32')]);_0x159186[_0x0dc5('0x36')]=_[_0x0dc5('0x35')](_0x1f9481[_0x0dc5('0x31')],qs[_0x0dc5('0x37')](_0x38f960[_0x0dc5('0x32')][_0x0dc5('0x37')]));_0x159186[_0x0dc5('0x36')]=_0x159186[_0x0dc5('0x36')][_0x0dc5('0x38')]?_0x159186[_0x0dc5('0x36')]:_0x1f9481['model'];if(!_0x38f960['query'][_0x0dc5('0x39')](_0x0dc5('0x3a'))){_0x159186[_0x0dc5('0x1c')]=qs[_0x0dc5('0x1c')](_0x38f960['query'][_0x0dc5('0x1c')]);_0x159186[_0x0dc5('0x1a')]=qs[_0x0dc5('0x1a')](_0x38f960['query']['offset']);}_0x159186[_0x0dc5('0x3b')]=qs[_0x0dc5('0x3c')](_0x38f960[_0x0dc5('0x32')]['sort']);_0x159186['where']=qs['filters'](_[_0x0dc5('0x3d')](_0x38f960[_0x0dc5('0x32')],_0x1f9481[_0x0dc5('0x34')]),_0x739cc6);if(_0x38f960[_0x0dc5('0x32')][_0x0dc5('0x3e')]){_0x159186['where']=_[_0x0dc5('0x3f')](_0x159186[_0x0dc5('0x40')],{'$or':_[_0x0dc5('0x2b')](_0x739cc6,function(_0xbc66d1){if(_0xbc66d1['type']!==_0x0dc5('0x41')){var _0x3d1406={};_0x3d1406[_0xbc66d1[_0x0dc5('0x28')]]={'$like':'%'+_0x38f960[_0x0dc5('0x32')]['filter']+'%'};return _0x3d1406;}})});}_0x159186=_[_0x0dc5('0x3f')]({},_0x159186,_0x38f960[_0x0dc5('0x42')]);var _0x27ed8a={'where':_0x159186[_0x0dc5('0x40')]};return db[_0x0dc5('0x2c')][_0x0dc5('0x1d')](_0x27ed8a)[_0x0dc5('0x23')](function(_0x1b3cc0){_0x100c86[_0x0dc5('0x1d')]=_0x1b3cc0;if(_0x38f960['query'][_0x0dc5('0x43')]){_0x159186['include']=[{'all':!![]}];}return db[_0x0dc5('0x2c')]['findAll'](_0x159186);})['then'](function(_0x3d7933){_0x100c86[_0x0dc5('0x44')]=_0x3d7933;return _0x100c86;})[_0x0dc5('0x23')](respondWithFilteredResult(_0x4ef4af,_0x159186))[_0x0dc5('0x45')](handleError(_0x4ef4af,null));};exports[_0x0dc5('0x46')]=function(_0x2b8da5,_0x3d5a06){var _0x308944={'raw':!![],'where':{'id':_0x2b8da5[_0x0dc5('0x47')]['id']}},_0x1f5808={};_0x1f5808['model']=_[_0x0dc5('0x33')](db['OpenchannelTransferReport'][_0x0dc5('0x2d')]);_0x1f5808['query']=_['keys'](_0x2b8da5[_0x0dc5('0x32')]);_0x1f5808[_0x0dc5('0x34')]=_[_0x0dc5('0x35')](_0x1f5808[_0x0dc5('0x31')],_0x1f5808[_0x0dc5('0x32')]);_0x308944['attributes']=_[_0x0dc5('0x35')](_0x1f5808[_0x0dc5('0x31')],qs[_0x0dc5('0x37')](_0x2b8da5[_0x0dc5('0x32')][_0x0dc5('0x37')]));_0x308944[_0x0dc5('0x36')]=_0x308944[_0x0dc5('0x36')][_0x0dc5('0x38')]?_0x308944[_0x0dc5('0x36')]:_0x1f5808[_0x0dc5('0x31')];if(_0x2b8da5[_0x0dc5('0x32')]['includeAll']){_0x308944[_0x0dc5('0x48')]=[{'all':!![]}];}_0x308944=_[_0x0dc5('0x3f')]({},_0x308944,_0x2b8da5['options']);return db[_0x0dc5('0x2c')][_0x0dc5('0x49')](_0x308944)[_0x0dc5('0x23')](handleEntityNotFound(_0x3d5a06,null))['then'](respondWithResult(_0x3d5a06,null))[_0x0dc5('0x45')](handleError(_0x3d5a06,null));};exports[_0x0dc5('0x4a')]=function(_0x4782cc,_0x87a099){return db[_0x0dc5('0x2c')]['create'](_0x4782cc[_0x0dc5('0x4b')],{})['then'](respondWithResult(_0x87a099,0xc9))['catch'](handleError(_0x87a099,null));};exports[_0x0dc5('0x22')]=function(_0x27a27c,_0x589902){if(_0x27a27c[_0x0dc5('0x4b')]['id']){delete _0x27a27c[_0x0dc5('0x4b')]['id'];}return db[_0x0dc5('0x2c')][_0x0dc5('0x49')]({'where':{'id':_0x27a27c[_0x0dc5('0x47')]['id']}})[_0x0dc5('0x23')](handleEntityNotFound(_0x589902,null))[_0x0dc5('0x23')](saveUpdates(_0x27a27c[_0x0dc5('0x4b')],null))[_0x0dc5('0x23')](respondWithResult(_0x589902,null))[_0x0dc5('0x45')](handleError(_0x589902,null));};exports[_0x0dc5('0x24')]=function(_0x2c67d0,_0x52a50d){return db['OpenchannelTransferReport'][_0x0dc5('0x49')]({'where':{'id':_0x2c67d0['params']['id']}})[_0x0dc5('0x23')](handleEntityNotFound(_0x52a50d,null))[_0x0dc5('0x23')](removeEntity(_0x52a50d,null))[_0x0dc5('0x45')](handleError(_0x52a50d,null));};exports['describe']=function(_0x2d6132,_0x4f7fb0){return db[_0x0dc5('0x2c')][_0x0dc5('0x4c')]()[_0x0dc5('0x23')](respondWithResult(_0x4f7fb0,null))[_0x0dc5('0x45')](handleError(_0x4f7fb0,null));}; \ No newline at end of file +var _0x2c82=['end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5c6a66,_0x539212){var _0x4fe981=function(_0x4392ed){while(--_0x4392ed){_0x5c6a66['push'](_0x5c6a66['shift']());}};_0x4fe981(++_0x539212);}(_0x2c82,0x1b4));var _0x22c8=function(_0x4d3187,_0x267c51){_0x4d3187=_0x4d3187-0x0;var _0x107906=_0x2c82[_0x4d3187];return _0x107906;};'use strict';var emlformat=require(_0x22c8('0x0'));var rimraf=require(_0x22c8('0x1'));var zipdir=require(_0x22c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x22c8('0x3'));var moment=require(_0x22c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x22c8('0x5'));var util=require(_0x22c8('0x6'));var path=require(_0x22c8('0x7'));var sox=require('sox');var csv=require(_0x22c8('0x8'));var ejs=require(_0x22c8('0x9'));var fs=require('fs');var fs_extra=require(_0x22c8('0xa'));var _=require(_0x22c8('0xb'));var squel=require('squel');var crypto=require(_0x22c8('0xc'));var jsforce=require(_0x22c8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x22c8('0x8'));var querystring=require(_0x22c8('0xe'));var Papa=require('papaparse');var Redis=require(_0x22c8('0xf'));var authService=require(_0x22c8('0x10'));var qs=require(_0x22c8('0x11'));var as=require(_0x22c8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22c8('0x13'))(_0x22c8('0x14'));var utils=require(_0x22c8('0x15'));var config=require(_0x22c8('0x16'));var licenseUtil=require(_0x22c8('0x17'));var db=require(_0x22c8('0x18'))['db'];function respondWithStatusCode(_0x18a779,_0x6632fc){_0x6632fc=_0x6632fc||0xcc;return function(_0x4e678a){if(_0x4e678a){return _0x18a779[_0x22c8('0x19')](_0x6632fc);}return _0x18a779['status'](_0x6632fc)[_0x22c8('0x1a')]();};}function respondWithResult(_0x2b2170,_0x56c11e){_0x56c11e=_0x56c11e||0xc8;return function(_0x13c12a){if(_0x13c12a){return _0x2b2170['status'](_0x56c11e)[_0x22c8('0x1b')](_0x13c12a);}};}function respondWithFilteredResult(_0x54e959,_0x50a6bf){return function(_0x25fac0){if(_0x25fac0){var _0x29090a=typeof _0x50a6bf[_0x22c8('0x1c')]===_0x22c8('0x1d')&&typeof _0x50a6bf[_0x22c8('0x1e')]==='undefined';var _0x29d4fd=_0x25fac0[_0x22c8('0x1f')];var _0x3eb56d=_0x29090a?0x0:_0x50a6bf[_0x22c8('0x1c')];var _0x1b239d=_0x29090a?_0x25fac0[_0x22c8('0x1f')]:_0x50a6bf['offset']+_0x50a6bf['limit'];var _0x2b2137;if(_0x1b239d>=_0x29d4fd){_0x1b239d=_0x29d4fd;_0x2b2137=0xc8;}else{_0x2b2137=0xce;}_0x54e959[_0x22c8('0x20')](_0x2b2137);return _0x54e959['set'](_0x22c8('0x21'),_0x3eb56d+'-'+_0x1b239d+'/'+_0x29d4fd)[_0x22c8('0x1b')](_0x25fac0);}return null;};}function patchUpdates(_0x3d9766){return function(_0x5f57af){try{jsonpatch[_0x22c8('0x22')](_0x5f57af,_0x3d9766,!![]);}catch(_0x34e7c8){return BPromise[_0x22c8('0x23')](_0x34e7c8);}return _0x5f57af[_0x22c8('0x24')]();};}function saveUpdates(_0x5de1fe,_0x254587){return function(_0x41ad4d){if(_0x41ad4d){return _0x41ad4d['update'](_0x5de1fe)['then'](function(_0x352f93){return _0x352f93;});}return null;};}function removeEntity(_0x85ed93,_0x4e8993){return function(_0x4cb3da){if(_0x4cb3da){return _0x4cb3da['destroy']()[_0x22c8('0x25')](function(){_0x85ed93[_0x22c8('0x20')](0xcc)[_0x22c8('0x1a')]();});}};}function handleEntityNotFound(_0x180afa,_0x5b2972){return function(_0x253e7b){if(!_0x253e7b){_0x180afa[_0x22c8('0x19')](0x194);}return _0x253e7b;};}function handleError(_0x5de1ab,_0x1c6ba9){_0x1c6ba9=_0x1c6ba9||0x1f4;return function(_0x1f49f3){logger['error'](_0x1f49f3[_0x22c8('0x26')]);if(_0x1f49f3[_0x22c8('0x27')]){delete _0x1f49f3[_0x22c8('0x27')];}_0x5de1ab[_0x22c8('0x20')](_0x1c6ba9)[_0x22c8('0x28')](_0x1f49f3);};}exports[_0x22c8('0x29')]=function(_0x590460,_0x3ef5ed){var _0x162a54={},_0x27f130={},_0x5b76c7={'count':0x0,'rows':[]};var _0x40b417=_['map'](db['OpenchannelTransferReport'][_0x22c8('0x2a')],function(_0xf974b9){return{'name':_0xf974b9[_0x22c8('0x2b')],'type':_0xf974b9[_0x22c8('0x2c')][_0x22c8('0x2d')]};});_0x27f130[_0x22c8('0x2e')]=_[_0x22c8('0x2f')](_0x40b417,_0x22c8('0x27'));_0x27f130['query']=_[_0x22c8('0x30')](_0x590460['query']);_0x27f130[_0x22c8('0x31')]=_[_0x22c8('0x32')](_0x27f130[_0x22c8('0x2e')],_0x27f130[_0x22c8('0x33')]);_0x162a54['attributes']=_[_0x22c8('0x32')](_0x27f130['model'],qs['fields'](_0x590460[_0x22c8('0x33')][_0x22c8('0x34')]));_0x162a54[_0x22c8('0x35')]=_0x162a54[_0x22c8('0x35')][_0x22c8('0x36')]?_0x162a54[_0x22c8('0x35')]:_0x27f130[_0x22c8('0x2e')];if(!_0x590460[_0x22c8('0x33')]['hasOwnProperty'](_0x22c8('0x37'))){_0x162a54[_0x22c8('0x1e')]=qs['limit'](_0x590460['query'][_0x22c8('0x1e')]);_0x162a54['offset']=qs['offset'](_0x590460[_0x22c8('0x33')][_0x22c8('0x1c')]);}_0x162a54[_0x22c8('0x38')]=qs[_0x22c8('0x39')](_0x590460[_0x22c8('0x33')][_0x22c8('0x39')]);_0x162a54['where']=qs['filters'](_['pick'](_0x590460[_0x22c8('0x33')],_0x27f130[_0x22c8('0x31')]),_0x40b417);if(_0x590460[_0x22c8('0x33')][_0x22c8('0x3a')]){_0x162a54[_0x22c8('0x3b')]=_[_0x22c8('0x3c')](_0x162a54['where'],{'$or':_[_0x22c8('0x2f')](_0x40b417,function(_0x1537c3){if(_0x1537c3[_0x22c8('0x2c')]!==_0x22c8('0x3d')){var _0x233e6f={};_0x233e6f[_0x1537c3[_0x22c8('0x27')]]={'$like':'%'+_0x590460[_0x22c8('0x33')][_0x22c8('0x3a')]+'%'};return _0x233e6f;}})});}_0x162a54=_['merge']({},_0x162a54,_0x590460[_0x22c8('0x3e')]);var _0x59839d={'where':_0x162a54[_0x22c8('0x3b')]};return db[_0x22c8('0x3f')][_0x22c8('0x1f')](_0x59839d)['then'](function(_0x47cf79){_0x5b76c7[_0x22c8('0x1f')]=_0x47cf79;if(_0x590460[_0x22c8('0x33')][_0x22c8('0x40')]){_0x162a54[_0x22c8('0x41')]=[{'all':!![]}];}return db[_0x22c8('0x3f')][_0x22c8('0x42')](_0x162a54);})['then'](function(_0x1baaab){_0x5b76c7[_0x22c8('0x43')]=_0x1baaab;return _0x5b76c7;})[_0x22c8('0x25')](respondWithFilteredResult(_0x3ef5ed,_0x162a54))[_0x22c8('0x44')](handleError(_0x3ef5ed,null));};exports[_0x22c8('0x45')]=function(_0x5650bd,_0x5cbc5a){var _0x170c0c={'raw':!![],'where':{'id':_0x5650bd[_0x22c8('0x46')]['id']}},_0x34f334={};_0x34f334[_0x22c8('0x2e')]=_[_0x22c8('0x30')](db[_0x22c8('0x3f')]['rawAttributes']);_0x34f334[_0x22c8('0x33')]=_[_0x22c8('0x30')](_0x5650bd[_0x22c8('0x33')]);_0x34f334['filters']=_[_0x22c8('0x32')](_0x34f334[_0x22c8('0x2e')],_0x34f334[_0x22c8('0x33')]);_0x170c0c['attributes']=_['intersection'](_0x34f334[_0x22c8('0x2e')],qs['fields'](_0x5650bd[_0x22c8('0x33')][_0x22c8('0x34')]));_0x170c0c[_0x22c8('0x35')]=_0x170c0c[_0x22c8('0x35')][_0x22c8('0x36')]?_0x170c0c[_0x22c8('0x35')]:_0x34f334[_0x22c8('0x2e')];if(_0x5650bd[_0x22c8('0x33')][_0x22c8('0x40')]){_0x170c0c[_0x22c8('0x41')]=[{'all':!![]}];}_0x170c0c=_['merge']({},_0x170c0c,_0x5650bd[_0x22c8('0x3e')]);return db[_0x22c8('0x3f')][_0x22c8('0x47')](_0x170c0c)[_0x22c8('0x25')](handleEntityNotFound(_0x5cbc5a,null))[_0x22c8('0x25')](respondWithResult(_0x5cbc5a,null))[_0x22c8('0x44')](handleError(_0x5cbc5a,null));};exports['create']=function(_0x10e753,_0x5e3691){return db[_0x22c8('0x3f')][_0x22c8('0x48')](_0x10e753[_0x22c8('0x49')],{})[_0x22c8('0x25')](respondWithResult(_0x5e3691,0xc9))['catch'](handleError(_0x5e3691,null));};exports[_0x22c8('0x4a')]=function(_0x1c793c,_0x4df6a1){if(_0x1c793c[_0x22c8('0x49')]['id']){delete _0x1c793c[_0x22c8('0x49')]['id'];}return db[_0x22c8('0x3f')][_0x22c8('0x47')]({'where':{'id':_0x1c793c['params']['id']}})['then'](handleEntityNotFound(_0x4df6a1,null))['then'](saveUpdates(_0x1c793c['body'],null))[_0x22c8('0x25')](respondWithResult(_0x4df6a1,null))[_0x22c8('0x44')](handleError(_0x4df6a1,null));};exports[_0x22c8('0x4b')]=function(_0x280b5b,_0x1edc57){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x280b5b[_0x22c8('0x46')]['id']}})[_0x22c8('0x25')](handleEntityNotFound(_0x1edc57,null))[_0x22c8('0x25')](removeEntity(_0x1edc57,null))[_0x22c8('0x44')](handleError(_0x1edc57,null));};exports['describe']=function(_0x44855d,_0x187533){return db[_0x22c8('0x3f')][_0x22c8('0x4c')]()['then'](respondWithResult(_0x187533,null))['catch'](handleError(_0x187533,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 022c4ad..c1b1091 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 _0x7435=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x13819e,_0x48e8d4){var _0x5cf21a=function(_0x207828){while(--_0x207828){_0x13819e['push'](_0x13819e['shift']());}};_0x5cf21a(++_0x48e8d4);}(_0x7435,0x14e));var _0x5743=function(_0x5914e1,_0x283f8e){_0x5914e1=_0x5914e1-0x0;var _0x1abc2f=_0x7435[_0x5914e1];return _0x1abc2f;};'use strict';var _=require(_0x5743('0x0'));var util=require(_0x5743('0x1'));var logger=require(_0x5743('0x2'))(_0x5743('0x3'));var moment=require(_0x5743('0x4'));var BPromise=require('bluebird');var rp=require(_0x5743('0x5'));var fs=require('fs');var path=require(_0x5743('0x6'));var rimraf=require(_0x5743('0x7'));var config=require(_0x5743('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0x5743('0x9')]=function(_0x1b4afe,_0x3226b0){return _0x1b4afe[_0x5743('0xa')](_0x5743('0xb'),attributes,{'tableName':_0x5743('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5743('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8137=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x2b5714,_0x45d508){var _0x274eac=function(_0x113091){while(--_0x113091){_0x2b5714['push'](_0x2b5714['shift']());}};_0x274eac(++_0x45d508);}(_0x8137,0x1aa));var _0x7813=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x8137[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x7813('0x0'));var util=require(_0x7813('0x1'));var logger=require(_0x7813('0x2'))(_0x7813('0x3'));var moment=require(_0x7813('0x4'));var BPromise=require(_0x7813('0x5'));var rp=require(_0x7813('0x6'));var fs=require('fs');var path=require(_0x7813('0x7'));var rimraf=require(_0x7813('0x8'));var config=require(_0x7813('0x9'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x519b13,_0x5ca775){return _0x519b13['define'](_0x7813('0xa'),attributes,{'tableName':_0x7813('0xb'),'paranoid':![],'indexes':[{'name':_0x7813('0xc'),'fields':[_0x7813('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 095474a..b9db4ea 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 _0x9f02=['request\x20sent','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','debug','error','message','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x481aa5,_0x3bedde){var _0x28c250=function(_0x549be3){while(--_0x549be3){_0x481aa5['push'](_0x481aa5['shift']());}};_0x28c250(++_0x3bedde);}(_0x9f02,0x68));var _0x29f0=function(_0x312c67,_0x407ce3){_0x312c67=_0x312c67-0x0;var _0x1aa3e4=_0x9f02[_0x312c67];return _0x1aa3e4;};'use strict';var _=require(_0x29f0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x29f0('0x1'));var fs=require('fs');var Redis=require(_0x29f0('0x2'));var db=require(_0x29f0('0x3'))['db'];var utils=require(_0x29f0('0x4'));var logger=require(_0x29f0('0x5'))('rpc');var config=require(_0x29f0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x29f0('0x7')][_0x29f0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d4852,_0x53d629,_0x4d47b3){return new BPromise(function(_0x594e30,_0x1da49e){return client['request'](_0x2d4852,_0x4d47b3)[_0x29f0('0x9')](function(_0x232592){logger[_0x29f0('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x53d629,'request\x20sent');logger[_0x29f0('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x53d629,'request\x20sent',JSON['stringify'](_0x232592));if(_0x232592['error']){if(_0x232592[_0x29f0('0xc')]['code']===0x1f4){logger[_0x29f0('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x53d629,_0x232592[_0x29f0('0xc')][_0x29f0('0xd')]);return _0x1da49e(_0x232592[_0x29f0('0xc')][_0x29f0('0xd')]);}logger['error'](_0x29f0('0xe'),_0x53d629,_0x232592[_0x29f0('0xc')]['message']);return _0x594e30(_0x232592[_0x29f0('0xc')]['message']);}else{logger[_0x29f0('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x53d629,_0x29f0('0xf'));_0x594e30(_0x232592[_0x29f0('0x10')]['message']);}})['catch'](function(_0x58e4e2){logger[_0x29f0('0xc')](_0x29f0('0xe'),_0x53d629,_0x58e4e2);_0x1da49e(_0x58e4e2);});});} \ No newline at end of file +var _0xdc59=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5ecb21,_0x4ea672){var _0x4c925d=function(_0x54a5f4){while(--_0x54a5f4){_0x5ecb21['push'](_0x5ecb21['shift']());}};_0x4c925d(++_0x4ea672);}(_0xdc59,0x12c));var _0x9dc5=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xdc59[_0x46ae5a];return _0x434986;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var moment=require(_0x9dc5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dc5('0x3'));var db=require(_0x9dc5('0x4'))['db'];var utils=require(_0x9dc5('0x5'));var logger=require(_0x9dc5('0x6'))(_0x9dc5('0x7'));var config=require(_0x9dc5('0x8'));var jayson=require(_0x9dc5('0x9'));var client=jayson[_0x9dc5('0xa')][_0x9dc5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48beee,_0x42941b,_0x10b268){return new BPromise(function(_0x202a8a,_0x3729b6){return client[_0x9dc5('0xc')](_0x48beee,_0x10b268)[_0x9dc5('0xd')](function(_0x174835){logger[_0x9dc5('0xe')](_0x9dc5('0xf'),_0x42941b,_0x9dc5('0x10'));logger['debug'](_0x9dc5('0x11'),_0x42941b,_0x9dc5('0x10'),JSON[_0x9dc5('0x12')](_0x174835));if(_0x174835[_0x9dc5('0x13')]){if(_0x174835['error'][_0x9dc5('0x14')]===0x1f4){logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x174835['error'][_0x9dc5('0x15')]);return _0x3729b6(_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);}logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);return _0x202a8a(_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);}else{logger[_0x9dc5('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x42941b,_0x9dc5('0x10'));_0x202a8a(_0x174835['result'][_0x9dc5('0x15')]);}})[_0x9dc5('0x16')](function(_0x5a9ffb){logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x5a9ffb);_0x3729b6(_0x5a9ffb);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 5d1d7d6..328e8f1 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 _0xddaa=['../../config/environment','get','isAuthenticated','index','/:id','show','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x48e315,_0x5f4c6b){var _0x4c6122=function(_0x5abfed){while(--_0x5abfed){_0x48e315['push'](_0x48e315['shift']());}};_0x4c6122(++_0x5f4c6b);}(_0xddaa,0xb5));var _0xadda=function(_0x472053,_0x271ca5){_0x472053=_0x472053-0x0;var _0x16ff04=_0xddaa[_0x472053];return _0x16ff04;};'use strict';var multer=require(_0xadda('0x0'));var util=require(_0xadda('0x1'));var path=require(_0xadda('0x2'));var timeout=require(_0xadda('0x3'));var express=require(_0xadda('0x4'));var router=express[_0xadda('0x5')]();var fs_extra=require(_0xadda('0x6'));var auth=require(_0xadda('0x7'));var interaction=require(_0xadda('0x8'));var config=require(_0xadda('0x9'));var controller=require('./pause.controller');router[_0xadda('0xa')]('/',auth[_0xadda('0xb')](),controller[_0xadda('0xc')]);router[_0xadda('0xa')](_0xadda('0xd'),auth[_0xadda('0xb')](),controller[_0xadda('0xe')]);router[_0xadda('0xf')]('/',auth[_0xadda('0xb')](),controller['create']);router['put'](_0xadda('0xd'),auth[_0xadda('0xb')](),controller['update']);router[_0xadda('0x10')](_0xadda('0xd'),auth[_0xadda('0xb')](),controller[_0xadda('0x11')]);module[_0xadda('0x12')]=router; \ No newline at end of file +var _0xf150=['get','/:id','isAuthenticated','show','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x54ee75,_0x5aa2a5){var _0x190beb=function(_0x25441a){while(--_0x25441a){_0x54ee75['push'](_0x54ee75['shift']());}};_0x190beb(++_0x5aa2a5);}(_0xf150,0x106));var _0x0f15=function(_0x2940e9,_0x43b3b4){_0x2940e9=_0x2940e9-0x0;var _0x20ca59=_0xf150[_0x2940e9];return _0x20ca59;};'use strict';var multer=require(_0x0f15('0x0'));var util=require(_0x0f15('0x1'));var path=require(_0x0f15('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f15('0x3'));var router=express[_0x0f15('0x4')]();var fs_extra=require(_0x0f15('0x5'));var auth=require(_0x0f15('0x6'));var interaction=require(_0x0f15('0x7'));var config=require(_0x0f15('0x8'));var controller=require(_0x0f15('0x9'));router[_0x0f15('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0f15('0xa')](_0x0f15('0xb'),auth[_0x0f15('0xc')](),controller[_0x0f15('0xd')]);router['post']('/',auth[_0x0f15('0xc')](),controller['create']);router[_0x0f15('0xe')](_0x0f15('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0f15('0xf')](_0x0f15('0xb'),auth[_0x0f15('0xc')](),controller['destroy']);module[_0x0f15('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 2afc32b..4cad531 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 _0xc9c9=['STRING','name'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xc9c9,0x10c));var _0x9c9c=function(_0x5805a2,_0x3cb76b){_0x5805a2=_0x5805a2-0x0;var _0x542db2=_0xc9c9[_0x5805a2];return _0x542db2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9c9c('0x0')],'unique':_0x9c9c('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x9c9c('0x0')]}}; \ No newline at end of file +var _0xbca9=['STRING','name','sequelize','exports'];(function(_0x3f44bf,_0x3b816a){var _0x4fa0a2=function(_0x381c84){while(--_0x381c84){_0x3f44bf['push'](_0x3f44bf['shift']());}};_0x4fa0a2(++_0x3b816a);}(_0xbca9,0x1aa));var _0x9bca=function(_0x29aca3,_0x440fe5){_0x29aca3=_0x29aca3-0x0;var _0x373249=_0xbca9[_0x29aca3];return _0x373249;};'use strict';var Sequelize=require(_0x9bca('0x0'));module[_0x9bca('0x1')]={'name':{'type':Sequelize[_0x9bca('0x2')],'unique':_0x9bca('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e232ff8..ebf8189 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 _0xec88=['index','Pause','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','rows','catch','show','params','keys','includeAll','find','create','body','user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','desk.js','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','count','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send'];(function(_0x4cc1af,_0x22c39e){var _0x2ec7f7=function(_0x3eab17){while(--_0x3eab17){_0x4cc1af['push'](_0x4cc1af['shift']());}};_0x2ec7f7(++_0x22c39e);}(_0xec88,0xc8));var _0x8ec8=function(_0x4cdaa3,_0x3227fa){_0x4cdaa3=_0x4cdaa3-0x0;var _0x288cbb=_0xec88[_0x4cdaa3];return _0x288cbb;};'use strict';var emlformat=require(_0x8ec8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ec8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8ec8('0x2'));var BPromise=require(_0x8ec8('0x3'));var Mustache=require(_0x8ec8('0x4'));var util=require(_0x8ec8('0x5'));var path=require('path');var sox=require(_0x8ec8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ec8('0x7'));var _=require(_0x8ec8('0x8'));var squel=require(_0x8ec8('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8ec8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ec8('0xb'));var Redis=require(_0x8ec8('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x8ec8('0xd'));var as=require(_0x8ec8('0xe'));var hardwareService=require(_0x8ec8('0xf'));var logger=require(_0x8ec8('0x10'))(_0x8ec8('0x11'));var utils=require(_0x8ec8('0x12'));var config=require(_0x8ec8('0x13'));var licenseUtil=require(_0x8ec8('0x14'));var db=require(_0x8ec8('0x15'))['db'];function respondWithStatusCode(_0x8be9e0,_0x3da7e6){_0x3da7e6=_0x3da7e6||0xcc;return function(_0xba849d){if(_0xba849d){return _0x8be9e0[_0x8ec8('0x16')](_0x3da7e6);}return _0x8be9e0[_0x8ec8('0x17')](_0x3da7e6)[_0x8ec8('0x18')]();};}function respondWithResult(_0x152529,_0x19dcec){_0x19dcec=_0x19dcec||0xc8;return function(_0x266004){if(_0x266004){return _0x152529[_0x8ec8('0x17')](_0x19dcec)[_0x8ec8('0x19')](_0x266004);}};}function respondWithFilteredResult(_0x17385a,_0xb7a9b8){return function(_0x35ae65){if(_0x35ae65){var _0x56d7ec=typeof _0xb7a9b8[_0x8ec8('0x1a')]==='undefined'&&typeof _0xb7a9b8['limit']===_0x8ec8('0x1b');var _0x214f7c=_0x35ae65[_0x8ec8('0x1c')];var _0x2c6012=_0x56d7ec?0x0:_0xb7a9b8[_0x8ec8('0x1a')];var _0x204b1d=_0x56d7ec?_0x35ae65[_0x8ec8('0x1c')]:_0xb7a9b8[_0x8ec8('0x1a')]+_0xb7a9b8[_0x8ec8('0x1d')];var _0x1e960f;if(_0x204b1d>=_0x214f7c){_0x204b1d=_0x214f7c;_0x1e960f=0xc8;}else{_0x1e960f=0xce;}_0x17385a[_0x8ec8('0x17')](_0x1e960f);return _0x17385a[_0x8ec8('0x1e')](_0x8ec8('0x1f'),_0x2c6012+'-'+_0x204b1d+'/'+_0x214f7c)[_0x8ec8('0x19')](_0x35ae65);}return null;};}function patchUpdates(_0x4ad54d){return function(_0x24768a){try{jsonpatch[_0x8ec8('0x20')](_0x24768a,_0x4ad54d,!![]);}catch(_0x38b313){return BPromise['reject'](_0x38b313);}return _0x24768a[_0x8ec8('0x21')]();};}function saveUpdates(_0x38c21d,_0xd5a050){return function(_0x4cb7a3){if(_0x4cb7a3){return _0x4cb7a3[_0x8ec8('0x22')](_0x38c21d)[_0x8ec8('0x23')](function(_0x1638c6){return _0x1638c6;});}return null;};}function removeEntity(_0x19254f,_0x221881){return function(_0x1de881){if(_0x1de881){return _0x1de881[_0x8ec8('0x24')]()[_0x8ec8('0x23')](function(){var _0x568160=_0x1de881[_0x8ec8('0x25')]({'plain':!![]});var _0x4cfc42='Pauses';return db[_0x8ec8('0x26')][_0x8ec8('0x24')]({'where':{'type':_0x4cfc42,'resourceId':_0x568160['id']}})['then'](function(){return _0x1de881;});})['then'](function(){_0x19254f[_0x8ec8('0x17')](0xcc)[_0x8ec8('0x18')]();});}};}function handleEntityNotFound(_0x59b4b0,_0x32f8cb){return function(_0x13e2b3){if(!_0x13e2b3){_0x59b4b0['sendStatus'](0x194);}return _0x13e2b3;};}function handleError(_0x58fba6,_0x53f475){_0x53f475=_0x53f475||0x1f4;return function(_0x340dc0){logger[_0x8ec8('0x27')](_0x340dc0[_0x8ec8('0x28')]);if(_0x340dc0[_0x8ec8('0x29')]){delete _0x340dc0[_0x8ec8('0x29')];}_0x58fba6[_0x8ec8('0x17')](_0x53f475)[_0x8ec8('0x2a')](_0x340dc0);};}exports[_0x8ec8('0x2b')]=function(_0x32f524,_0x4ecb5e){var _0x4fbb64={},_0x20912c={},_0xf8c88={'count':0x0,'rows':[]};var _0x501696=_['map'](db[_0x8ec8('0x2c')][_0x8ec8('0x2d')],function(_0x38ada5){return{'name':_0x38ada5[_0x8ec8('0x2e')],'type':_0x38ada5[_0x8ec8('0x2f')][_0x8ec8('0x30')]};});_0x20912c['model']=_[_0x8ec8('0x31')](_0x501696,_0x8ec8('0x29'));_0x20912c[_0x8ec8('0x32')]=_['keys'](_0x32f524[_0x8ec8('0x32')]);_0x20912c['filters']=_[_0x8ec8('0x33')](_0x20912c[_0x8ec8('0x34')],_0x20912c[_0x8ec8('0x32')]);_0x4fbb64[_0x8ec8('0x35')]=_[_0x8ec8('0x33')](_0x20912c[_0x8ec8('0x34')],qs[_0x8ec8('0x36')](_0x32f524['query'][_0x8ec8('0x36')]));_0x4fbb64[_0x8ec8('0x35')]=_0x4fbb64[_0x8ec8('0x35')][_0x8ec8('0x37')]?_0x4fbb64['attributes']:_0x20912c[_0x8ec8('0x34')];if(!_0x32f524[_0x8ec8('0x32')][_0x8ec8('0x38')](_0x8ec8('0x39'))){_0x4fbb64[_0x8ec8('0x1d')]=qs[_0x8ec8('0x1d')](_0x32f524[_0x8ec8('0x32')][_0x8ec8('0x1d')]);_0x4fbb64[_0x8ec8('0x1a')]=qs[_0x8ec8('0x1a')](_0x32f524['query']['offset']);}_0x4fbb64['order']=qs[_0x8ec8('0x3a')](_0x32f524['query'][_0x8ec8('0x3a')]);_0x4fbb64[_0x8ec8('0x3b')]=qs[_0x8ec8('0x3c')](_[_0x8ec8('0x3d')](_0x32f524['query'],_0x20912c['filters']),_0x501696);if(_0x32f524[_0x8ec8('0x32')][_0x8ec8('0x3e')]){_0x4fbb64[_0x8ec8('0x3b')]=_[_0x8ec8('0x3f')](_0x4fbb64[_0x8ec8('0x3b')],{'$or':_[_0x8ec8('0x31')](_0x501696,function(_0x38501d){if(_0x38501d['type']!=='VIRTUAL'){var _0x557ca3={};_0x557ca3[_0x38501d['name']]={'$like':'%'+_0x32f524[_0x8ec8('0x32')][_0x8ec8('0x3e')]+'%'};return _0x557ca3;}})});}_0x4fbb64=_[_0x8ec8('0x3f')]({},_0x4fbb64,_0x32f524[_0x8ec8('0x40')]);var _0xfcfbc6={'where':_0x4fbb64['where']};return db[_0x8ec8('0x2c')][_0x8ec8('0x1c')](_0xfcfbc6)[_0x8ec8('0x23')](function(_0x2aae75){_0xf8c88['count']=_0x2aae75;if(_0x32f524[_0x8ec8('0x32')]['includeAll']){_0x4fbb64[_0x8ec8('0x41')]=[{'all':!![]}];}return db[_0x8ec8('0x2c')]['findAll'](_0x4fbb64);})['then'](function(_0x4543a9){_0xf8c88[_0x8ec8('0x42')]=_0x4543a9;return _0xf8c88;})[_0x8ec8('0x23')](respondWithFilteredResult(_0x4ecb5e,_0x4fbb64))[_0x8ec8('0x43')](handleError(_0x4ecb5e,null));};exports[_0x8ec8('0x44')]=function(_0x5a3212,_0x339620){var _0x4b4427={'raw':!![],'where':{'id':_0x5a3212[_0x8ec8('0x45')]['id']}},_0x2aba0d={};_0x2aba0d['model']=_[_0x8ec8('0x46')](db['Pause'][_0x8ec8('0x2d')]);_0x2aba0d['query']=_[_0x8ec8('0x46')](_0x5a3212[_0x8ec8('0x32')]);_0x2aba0d[_0x8ec8('0x3c')]=_[_0x8ec8('0x33')](_0x2aba0d[_0x8ec8('0x34')],_0x2aba0d[_0x8ec8('0x32')]);_0x4b4427[_0x8ec8('0x35')]=_[_0x8ec8('0x33')](_0x2aba0d['model'],qs[_0x8ec8('0x36')](_0x5a3212[_0x8ec8('0x32')][_0x8ec8('0x36')]));_0x4b4427[_0x8ec8('0x35')]=_0x4b4427[_0x8ec8('0x35')][_0x8ec8('0x37')]?_0x4b4427[_0x8ec8('0x35')]:_0x2aba0d['model'];if(_0x5a3212[_0x8ec8('0x32')][_0x8ec8('0x47')]){_0x4b4427['include']=[{'all':!![]}];}_0x4b4427=_['merge']({},_0x4b4427,_0x5a3212[_0x8ec8('0x40')]);return db[_0x8ec8('0x2c')][_0x8ec8('0x48')](_0x4b4427)[_0x8ec8('0x23')](handleEntityNotFound(_0x339620,null))[_0x8ec8('0x23')](respondWithResult(_0x339620,null))[_0x8ec8('0x43')](handleError(_0x339620,null));};exports[_0x8ec8('0x49')]=function(_0x462f34,_0x3e9946){return db[_0x8ec8('0x2c')][_0x8ec8('0x49')](_0x462f34[_0x8ec8('0x4a')],{})[_0x8ec8('0x23')](function(_0x2e21c7){var _0x3373aa=_0x462f34[_0x8ec8('0x4b')]['get']({'plain':!![]});if(!_0x3373aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3373aa[_0x8ec8('0x4c')]==='user'){var _0x25ce67=_0x2e21c7[_0x8ec8('0x25')]({'plain':!![]});var _0x20528d=_0x8ec8('0x4d');return db[_0x8ec8('0x4e')][_0x8ec8('0x48')]({'where':{'name':_0x20528d,'userProfileId':_0x3373aa[_0x8ec8('0x4f')]},'raw':!![]})[_0x8ec8('0x23')](function(_0x47ad04){if(_0x47ad04&&_0x47ad04[_0x8ec8('0x50')]===0x0){return db[_0x8ec8('0x26')][_0x8ec8('0x49')]({'name':_0x25ce67['name'],'resourceId':_0x25ce67['id'],'type':_0x47ad04[_0x8ec8('0x29')],'sectionId':_0x47ad04['id']},{})[_0x8ec8('0x23')](function(){return _0x2e21c7;});}else{return _0x2e21c7;}})['catch'](function(_0x2c13d4){logger[_0x8ec8('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c13d4);throw _0x2c13d4;});}return _0x2e21c7;})[_0x8ec8('0x23')](respondWithResult(_0x3e9946,0xc9))[_0x8ec8('0x43')](handleError(_0x3e9946,null));};exports[_0x8ec8('0x22')]=function(_0x578de4,_0x72e65f){if(_0x578de4[_0x8ec8('0x4a')]['id']){delete _0x578de4['body']['id'];}return db[_0x8ec8('0x2c')][_0x8ec8('0x48')]({'where':{'id':_0x578de4[_0x8ec8('0x45')]['id']}})[_0x8ec8('0x23')](handleEntityNotFound(_0x72e65f,null))[_0x8ec8('0x23')](saveUpdates(_0x578de4[_0x8ec8('0x4a')],null))[_0x8ec8('0x23')](respondWithResult(_0x72e65f,null))['catch'](handleError(_0x72e65f,null));};exports['destroy']=function(_0x5f0138,_0x5ca3de){return db[_0x8ec8('0x2c')][_0x8ec8('0x48')]({'where':{'id':_0x5f0138['params']['id']}})['then'](handleEntityNotFound(_0x5ca3de,null))[_0x8ec8('0x23')](removeEntity(_0x5ca3de,null))[_0x8ec8('0x43')](handleError(_0x5ca3de,null));}; \ No newline at end of file +var _0x63fd=['save','update','then','destroy','get','end','sendStatus','stack','name','send','index','map','Pause','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x63fd,0xe9));var _0xd63f=function(_0x9c0671,_0x5b5a02){_0x9c0671=_0x9c0671-0x0;var _0x544284=_0x63fd[_0x9c0671];return _0x544284;};'use strict';var emlformat=require(_0xd63f('0x0'));var rimraf=require(_0xd63f('0x1'));var zipdir=require(_0xd63f('0x2'));var jsonpatch=require(_0xd63f('0x3'));var rp=require(_0xd63f('0x4'));var moment=require(_0xd63f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd63f('0x6'));var util=require(_0xd63f('0x7'));var path=require(_0xd63f('0x8'));var sox=require(_0xd63f('0x9'));var csv=require(_0xd63f('0xa'));var ejs=require(_0xd63f('0xb'));var fs=require('fs');var fs_extra=require(_0xd63f('0xc'));var _=require(_0xd63f('0xd'));var squel=require(_0xd63f('0xe'));var crypto=require(_0xd63f('0xf'));var jsforce=require(_0xd63f('0x10'));var deskjs=require(_0xd63f('0x11'));var toCsv=require(_0xd63f('0xa'));var querystring=require(_0xd63f('0x12'));var Papa=require(_0xd63f('0x13'));var Redis=require(_0xd63f('0x14'));var authService=require(_0xd63f('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd63f('0x16'))(_0xd63f('0x17'));var utils=require(_0xd63f('0x18'));var config=require(_0xd63f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd63f('0x1a'))['db'];function respondWithStatusCode(_0x3a6789,_0x1e631e){_0x1e631e=_0x1e631e||0xcc;return function(_0x3c60e6){if(_0x3c60e6){return _0x3a6789['sendStatus'](_0x1e631e);}return _0x3a6789[_0xd63f('0x1b')](_0x1e631e)['end']();};}function respondWithResult(_0x23ede3,_0x4c604a){_0x4c604a=_0x4c604a||0xc8;return function(_0x5ecc18){if(_0x5ecc18){return _0x23ede3['status'](_0x4c604a)[_0xd63f('0x1c')](_0x5ecc18);}};}function respondWithFilteredResult(_0x12b769,_0x5b9765){return function(_0xbab725){if(_0xbab725){var _0x16640b=typeof _0x5b9765['offset']==='undefined'&&typeof _0x5b9765[_0xd63f('0x1d')]===_0xd63f('0x1e');var _0x9c105e=_0xbab725[_0xd63f('0x1f')];var _0x2c5d62=_0x16640b?0x0:_0x5b9765[_0xd63f('0x20')];var _0x2698fe=_0x16640b?_0xbab725[_0xd63f('0x1f')]:_0x5b9765[_0xd63f('0x20')]+_0x5b9765['limit'];var _0x155bfa;if(_0x2698fe>=_0x9c105e){_0x2698fe=_0x9c105e;_0x155bfa=0xc8;}else{_0x155bfa=0xce;}_0x12b769['status'](_0x155bfa);return _0x12b769[_0xd63f('0x21')](_0xd63f('0x22'),_0x2c5d62+'-'+_0x2698fe+'/'+_0x9c105e)[_0xd63f('0x1c')](_0xbab725);}return null;};}function patchUpdates(_0x3fc177){return function(_0x37c91c){try{jsonpatch[_0xd63f('0x23')](_0x37c91c,_0x3fc177,!![]);}catch(_0x5458c7){return BPromise[_0xd63f('0x24')](_0x5458c7);}return _0x37c91c[_0xd63f('0x25')]();};}function saveUpdates(_0x1ef2dd,_0x28f5f8){return function(_0x2471ae){if(_0x2471ae){return _0x2471ae[_0xd63f('0x26')](_0x1ef2dd)[_0xd63f('0x27')](function(_0x2e92d4){return _0x2e92d4;});}return null;};}function removeEntity(_0x314aad,_0x3f89c7){return function(_0x548df4){if(_0x548df4){return _0x548df4[_0xd63f('0x28')]()[_0xd63f('0x27')](function(){var _0x9e101f=_0x548df4[_0xd63f('0x29')]({'plain':!![]});var _0x9775cb='Pauses';return db['UserProfileResource'][_0xd63f('0x28')]({'where':{'type':_0x9775cb,'resourceId':_0x9e101f['id']}})[_0xd63f('0x27')](function(){return _0x548df4;});})[_0xd63f('0x27')](function(){_0x314aad['status'](0xcc)[_0xd63f('0x2a')]();});}};}function handleEntityNotFound(_0x405850,_0xb77a3d){return function(_0x36541d){if(!_0x36541d){_0x405850[_0xd63f('0x2b')](0x194);}return _0x36541d;};}function handleError(_0x349834,_0x2123ae){_0x2123ae=_0x2123ae||0x1f4;return function(_0x9cfd75){logger['error'](_0x9cfd75[_0xd63f('0x2c')]);if(_0x9cfd75[_0xd63f('0x2d')]){delete _0x9cfd75[_0xd63f('0x2d')];}_0x349834[_0xd63f('0x1b')](_0x2123ae)[_0xd63f('0x2e')](_0x9cfd75);};}exports[_0xd63f('0x2f')]=function(_0x1cb0ca,_0x164472){var _0x29c767={},_0x552b74={},_0x45aac8={'count':0x0,'rows':[]};var _0x4df06c=_[_0xd63f('0x30')](db[_0xd63f('0x31')]['rawAttributes'],function(_0x5df2b3){return{'name':_0x5df2b3[_0xd63f('0x32')],'type':_0x5df2b3[_0xd63f('0x33')][_0xd63f('0x34')]};});_0x552b74[_0xd63f('0x35')]=_[_0xd63f('0x30')](_0x4df06c,_0xd63f('0x2d'));_0x552b74[_0xd63f('0x36')]=_[_0xd63f('0x37')](_0x1cb0ca[_0xd63f('0x36')]);_0x552b74[_0xd63f('0x38')]=_['intersection'](_0x552b74[_0xd63f('0x35')],_0x552b74['query']);_0x29c767['attributes']=_['intersection'](_0x552b74[_0xd63f('0x35')],qs[_0xd63f('0x39')](_0x1cb0ca[_0xd63f('0x36')]['fields']));_0x29c767['attributes']=_0x29c767[_0xd63f('0x3a')]['length']?_0x29c767['attributes']:_0x552b74['model'];if(!_0x1cb0ca[_0xd63f('0x36')][_0xd63f('0x3b')](_0xd63f('0x3c'))){_0x29c767[_0xd63f('0x1d')]=qs['limit'](_0x1cb0ca['query'][_0xd63f('0x1d')]);_0x29c767[_0xd63f('0x20')]=qs[_0xd63f('0x20')](_0x1cb0ca[_0xd63f('0x36')][_0xd63f('0x20')]);}_0x29c767[_0xd63f('0x3d')]=qs[_0xd63f('0x3e')](_0x1cb0ca[_0xd63f('0x36')][_0xd63f('0x3e')]);_0x29c767[_0xd63f('0x3f')]=qs[_0xd63f('0x38')](_[_0xd63f('0x40')](_0x1cb0ca[_0xd63f('0x36')],_0x552b74[_0xd63f('0x38')]),_0x4df06c);if(_0x1cb0ca[_0xd63f('0x36')][_0xd63f('0x41')]){_0x29c767[_0xd63f('0x3f')]=_['merge'](_0x29c767[_0xd63f('0x3f')],{'$or':_[_0xd63f('0x30')](_0x4df06c,function(_0x91526){if(_0x91526[_0xd63f('0x33')]!=='VIRTUAL'){var _0x197ff4={};_0x197ff4[_0x91526['name']]={'$like':'%'+_0x1cb0ca[_0xd63f('0x36')][_0xd63f('0x41')]+'%'};return _0x197ff4;}})});}_0x29c767=_[_0xd63f('0x42')]({},_0x29c767,_0x1cb0ca[_0xd63f('0x43')]);var _0x3ea77c={'where':_0x29c767[_0xd63f('0x3f')]};return db[_0xd63f('0x31')][_0xd63f('0x1f')](_0x3ea77c)['then'](function(_0x43f487){_0x45aac8[_0xd63f('0x1f')]=_0x43f487;if(_0x1cb0ca[_0xd63f('0x36')][_0xd63f('0x44')]){_0x29c767[_0xd63f('0x45')]=[{'all':!![]}];}return db[_0xd63f('0x31')][_0xd63f('0x46')](_0x29c767);})[_0xd63f('0x27')](function(_0x524bbf){_0x45aac8[_0xd63f('0x47')]=_0x524bbf;return _0x45aac8;})[_0xd63f('0x27')](respondWithFilteredResult(_0x164472,_0x29c767))[_0xd63f('0x48')](handleError(_0x164472,null));};exports[_0xd63f('0x49')]=function(_0x3fb976,_0x19caf3){var _0x5b7059={'raw':!![],'where':{'id':_0x3fb976[_0xd63f('0x4a')]['id']}},_0x1382b1={};_0x1382b1[_0xd63f('0x35')]=_[_0xd63f('0x37')](db[_0xd63f('0x31')][_0xd63f('0x4b')]);_0x1382b1[_0xd63f('0x36')]=_[_0xd63f('0x37')](_0x3fb976['query']);_0x1382b1[_0xd63f('0x38')]=_[_0xd63f('0x4c')](_0x1382b1[_0xd63f('0x35')],_0x1382b1[_0xd63f('0x36')]);_0x5b7059[_0xd63f('0x3a')]=_[_0xd63f('0x4c')](_0x1382b1[_0xd63f('0x35')],qs[_0xd63f('0x39')](_0x3fb976['query'][_0xd63f('0x39')]));_0x5b7059['attributes']=_0x5b7059[_0xd63f('0x3a')][_0xd63f('0x4d')]?_0x5b7059[_0xd63f('0x3a')]:_0x1382b1[_0xd63f('0x35')];if(_0x3fb976[_0xd63f('0x36')]['includeAll']){_0x5b7059[_0xd63f('0x45')]=[{'all':!![]}];}_0x5b7059=_[_0xd63f('0x42')]({},_0x5b7059,_0x3fb976['options']);return db[_0xd63f('0x31')][_0xd63f('0x4e')](_0x5b7059)[_0xd63f('0x27')](handleEntityNotFound(_0x19caf3,null))[_0xd63f('0x27')](respondWithResult(_0x19caf3,null))[_0xd63f('0x48')](handleError(_0x19caf3,null));};exports[_0xd63f('0x4f')]=function(_0x734204,_0x18772e){return db['Pause'][_0xd63f('0x4f')](_0x734204[_0xd63f('0x50')],{})['then'](function(_0x359e1c){var _0x4cd67b=_0x734204['user']['get']({'plain':!![]});if(!_0x4cd67b)throw new Error(_0xd63f('0x51'));if(_0x4cd67b[_0xd63f('0x52')]==='user'){var _0x2baeb0=_0x359e1c['get']({'plain':!![]});var _0x1fce83=_0xd63f('0x53');return db[_0xd63f('0x54')][_0xd63f('0x4e')]({'where':{'name':_0x1fce83,'userProfileId':_0x4cd67b[_0xd63f('0x55')]},'raw':!![]})[_0xd63f('0x27')](function(_0x2769b6){if(_0x2769b6&&_0x2769b6[_0xd63f('0x56')]===0x0){return db[_0xd63f('0x57')][_0xd63f('0x4f')]({'name':_0x2baeb0[_0xd63f('0x2d')],'resourceId':_0x2baeb0['id'],'type':_0x2769b6[_0xd63f('0x2d')],'sectionId':_0x2769b6['id']},{})[_0xd63f('0x27')](function(){return _0x359e1c;});}else{return _0x359e1c;}})[_0xd63f('0x48')](function(_0x511e74){logger[_0xd63f('0x58')](_0xd63f('0x59'),_0x511e74);throw _0x511e74;});}return _0x359e1c;})[_0xd63f('0x27')](respondWithResult(_0x18772e,0xc9))['catch'](handleError(_0x18772e,null));};exports[_0xd63f('0x26')]=function(_0x37afe5,_0x5cb160){if(_0x37afe5['body']['id']){delete _0x37afe5[_0xd63f('0x50')]['id'];}return db[_0xd63f('0x31')]['find']({'where':{'id':_0x37afe5[_0xd63f('0x4a')]['id']}})[_0xd63f('0x27')](handleEntityNotFound(_0x5cb160,null))['then'](saveUpdates(_0x37afe5['body'],null))[_0xd63f('0x27')](respondWithResult(_0x5cb160,null))[_0xd63f('0x48')](handleError(_0x5cb160,null));};exports[_0xd63f('0x28')]=function(_0x5bb668,_0x3ba607){return db['Pause'][_0xd63f('0x4e')]({'where':{'id':_0x5bb668['params']['id']}})[_0xd63f('0x27')](handleEntityNotFound(_0x3ba607,null))[_0xd63f('0x27')](removeEntity(_0x3ba607,null))[_0xd63f('0x48')](handleError(_0x3ba607,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 8bde706..2828ce7 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(_0x507369,_0x2e9f03){var _0x4fc4cd=function(_0x30ced8){while(--_0x30ced8){_0x507369['push'](_0x507369['shift']());}};_0x4fc4cd(++_0x2e9f03);}(_0x326f,0xd1));var _0xf326=function(_0x4c0632,_0x311207){_0x4c0632=_0x4c0632-0x0;var _0x2d7897=_0x326f[_0x4c0632];return _0x2d7897;};'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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5bc158,_0x20ba90){_0x5bc158=_0x5bc158-0x0;var _0x288d43=_0x7fbe[_0x5bc158];return _0x288d43;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','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 b20bb05..647eac1 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(_0x20d81d,_0x506609){var _0x16d7ca=function(_0x468c4e){while(--_0x468c4e){_0x20d81d['push'](_0x20d81d['shift']());}};_0x16d7ca(++_0x506609);}(_0x7a54,0x106));var _0x47a5=function(_0x23aa8b,_0x589840){_0x23aa8b=_0x23aa8b-0x0;var _0x51dd6d=_0x7a54[_0x23aa8b];return _0x51dd6d;};'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 _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(_0x320687,_0x14ecb9){var _0x3bdebc=function(_0x5b073a){while(--_0x5b073a){_0x320687['push'](_0x320687['shift']());}};_0x3bdebc(++_0x14ecb9);}(_0x7a54,0x106));var _0x47a5=function(_0x2d06ce,_0x1002f5){_0x2d06ce=_0x2d06ce-0x0;var _0x4a3d19=_0x7a54[_0x2d06ce];return _0x4a3d19;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 44f77f8..e0089d0 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 _0xc874=['originalname','extname','now','post','single','webhookPost','/:id','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index','/webhook','webhookGet','isAuthenticated','/:id/download','download','diskStorage','root','server/files/plugins','format','%s-%s%s','basename'];(function(_0x4beb57,_0x35a937){var _0x365108=function(_0xe04e26){while(--_0xe04e26){_0x4beb57['push'](_0x4beb57['shift']());}};_0x365108(++_0x35a937);}(_0xc874,0x154));var _0x4c87=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0xc874[_0x11155f];return _0xd07e48;};'use strict';var multer=require(_0x4c87('0x0'));var util=require('util');var path=require(_0x4c87('0x1'));var timeout=require(_0x4c87('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c87('0x3'));var auth=require(_0x4c87('0x4'));var interaction=require(_0x4c87('0x5'));var config=require('../../config/environment');var controller=require(_0x4c87('0x6'));router[_0x4c87('0x7')]('/',auth['isAuthenticated'](),controller[_0x4c87('0x8')]);router[_0x4c87('0x7')](_0x4c87('0x9'),controller[_0x4c87('0xa')]);router[_0x4c87('0x7')]('/:id',auth[_0x4c87('0xb')](),controller['show']);router[_0x4c87('0x7')](_0x4c87('0xc'),auth[_0x4c87('0xb')](),controller[_0x4c87('0xd')]);var upload=multer({'storage':multer[_0x4c87('0xe')]({'destination':function(_0x548e1a,_0x1fcc99,_0x2b82cb){_0x2b82cb(null,path['join'](config[_0x4c87('0xf')],_0x4c87('0x10')));},'filename':function(_0x1e0530,_0x3b01bb,_0x3a2aa2){_0x3b01bb['originalname']=_0x3b01bb['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a2aa2(null,util[_0x4c87('0x11')](_0x4c87('0x12'),path[_0x4c87('0x13')](_0x3b01bb[_0x4c87('0x14')],path[_0x4c87('0x15')](_0x3b01bb[_0x4c87('0x14')])),Date[_0x4c87('0x16')](),path[_0x4c87('0x15')](_0x3b01bb['originalname'])));}})});router[_0x4c87('0x17')]('/',upload[_0x4c87('0x18')]('file'),controller['upload']);router[_0x4c87('0x17')](_0x4c87('0x9'),controller[_0x4c87('0x19')]);router['put'](_0x4c87('0x1a'),auth['isAuthenticated'](),controller[_0x4c87('0x1b')]);router[_0x4c87('0x1c')](_0x4c87('0x1a'),auth[_0x4c87('0xb')](),controller['delete']);module[_0x4c87('0x1d')]=router; \ No newline at end of file +var _0x2dae=['put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','post','file','upload'];(function(_0x1ad756,_0x43f2d1){var _0x4e76b9=function(_0x3705d6){while(--_0x3705d6){_0x1ad756['push'](_0x1ad756['shift']());}};_0x4e76b9(++_0x43f2d1);}(_0x2dae,0xc3));var _0xe2da=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0x2dae[_0x305486];return _0xa04940;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),controller[_0xe2da('0xc')]);router[_0xe2da('0x9')](_0xe2da('0xd'),auth[_0xe2da('0xe')](),controller[_0xe2da('0xf')]);router[_0xe2da('0x9')]('/:id/download',auth[_0xe2da('0xe')](),controller[_0xe2da('0x10')]);var upload=multer({'storage':multer[_0xe2da('0x11')]({'destination':function(_0x17086c,_0x3c1309,_0x44ec3e){_0x44ec3e(null,path[_0xe2da('0x12')](config[_0xe2da('0x13')],'server/files/plugins'));},'filename':function(_0xb98909,_0x5200b1,_0x4377c6){_0x5200b1[_0xe2da('0x14')]=_0x5200b1[_0xe2da('0x14')][_0xe2da('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4377c6(null,util[_0xe2da('0x16')](_0xe2da('0x17'),path[_0xe2da('0x18')](_0x5200b1['originalname'],path[_0xe2da('0x19')](_0x5200b1['originalname'])),Date['now'](),path[_0xe2da('0x19')](_0x5200b1[_0xe2da('0x14')])));}})});router[_0xe2da('0x1a')]('/',upload['single'](_0xe2da('0x1b')),controller[_0xe2da('0x1c')]);router[_0xe2da('0x1a')](_0xe2da('0xb'),controller['webhookPost']);router[_0xe2da('0x1d')](_0xe2da('0xd'),auth[_0xe2da('0xe')](),controller[_0xe2da('0x1e')]);router[_0xe2da('0x1f')]('/:id',auth[_0xe2da('0xe')](),controller[_0xe2da('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 74cbb88..e9835cb 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 _0x8fde=['agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x8fde,0x17d));var _0xe8fd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8fde[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0xe8fd('0x0')]={'name':{'type':Sequelize[_0xe8fd('0x1')]},'type':{'type':Sequelize['ENUM'](_0xe8fd('0x2'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xe8fd('0x3')]},'path':{'type':Sequelize[_0xe8fd('0x1')],'comment':_0xe8fd('0x4')},'active':{'type':Sequelize[_0xe8fd('0x5')],'defaultValue':0x0,'comment':_0xe8fd('0x6')},'sidebar':{'type':Sequelize[_0xe8fd('0x7')](_0xe8fd('0x8'),_0xe8fd('0x9'),'always',_0xe8fd('0xa')),'defaultValue':_0xe8fd('0xb'),'comment':_0xe8fd('0xc')},'icon':{'type':Sequelize[_0xe8fd('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xe8fd('0x1')]},'scriptName':{'type':Sequelize[_0xe8fd('0x1')]},'scriptPath':{'type':Sequelize[_0xe8fd('0x1')]}}; \ No newline at end of file +var _0xc474=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','ENUM','adminOnly','agentOnly','always'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc474,0x147));var _0x4c47=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xc474[_0x4b7895];return _0x264180;};'use strict';var Sequelize=require(_0x4c47('0x0'));module[_0x4c47('0x1')]={'name':{'type':Sequelize[_0x4c47('0x2')]},'type':{'type':Sequelize['ENUM'](_0x4c47('0x3'),_0x4c47('0x4'))},'description':{'type':Sequelize[_0x4c47('0x5')]},'version':{'type':Sequelize[_0x4c47('0x5')]},'path':{'type':Sequelize[_0x4c47('0x2')],'comment':_0x4c47('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x4c47('0x7')](_0x4c47('0x8'),_0x4c47('0x9'),_0x4c47('0xa'),_0x4c47('0xb')),'defaultValue':_0x4c47('0xa'),'comment':_0x4c47('0xc')},'icon':{'type':Sequelize[_0x4c47('0x2')]},'adminUrl':{'type':Sequelize[_0x4c47('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x4c47('0x2')]},'scriptPath':{'type':Sequelize[_0x4c47('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 46d1e3c..d1d4c43 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 _0x2b28=['find','download','join','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','dirname','basename','node_modules/**/*','attachments/**/*','finalize','existsSync','Sequelize','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','upload','file','filename','root','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','unlinkSync','Extracted\x20folder\x20removed','update','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','port','\x27PORT\x27\x20parameter\x20not\x20specified','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','json','then','get','UserProfileResource','destroy','error','stack','name','send','map','Plugin','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','includeAll','include','findAll','catch','params'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2b28,0x192));var _0x82b2=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x2b28[_0x2c1dcd];return _0x158ce5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82b2('0x0'));var zipdir=require(_0x82b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82b2('0x2'));var moment=require(_0x82b2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x82b2('0x4'));var path=require(_0x82b2('0x5'));var sox=require(_0x82b2('0x6'));var csv=require('to-csv');var ejs=require(_0x82b2('0x7'));var fs=require('fs');var fs_extra=require(_0x82b2('0x8'));var _=require(_0x82b2('0x9'));var squel=require(_0x82b2('0xa'));var crypto=require(_0x82b2('0xb'));var jsforce=require(_0x82b2('0xc'));var deskjs=require(_0x82b2('0xd'));var toCsv=require(_0x82b2('0xe'));var querystring=require(_0x82b2('0xf'));var Papa=require(_0x82b2('0x10'));var extract=require(_0x82b2('0x11'));var rimraf=require(_0x82b2('0x0'));var archiver=require(_0x82b2('0x12'));var Redis=require(_0x82b2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x82b2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82b2('0x15'));var logger=require(_0x82b2('0x16'))(_0x82b2('0x17'));var utils=require(_0x82b2('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x82b2('0x19')]=_[_0x82b2('0x1a')](config[_0x82b2('0x19')],{'host':_0x82b2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82b2('0x19')]));require(_0x82b2('0x1c'))[_0x82b2('0x1d')](socket);function respondWithStatusCode(_0x1ebb20,_0x140ba6){_0x140ba6=_0x140ba6||0xcc;return function(_0x1b61f8){if(_0x1b61f8){return _0x1ebb20[_0x82b2('0x1e')](_0x140ba6);}return _0x1ebb20[_0x82b2('0x1f')](_0x140ba6)[_0x82b2('0x20')]();};}function respondWithResult(_0x2740ac,_0x44d49f){_0x44d49f=_0x44d49f||0xc8;return function(_0x3531d4){if(_0x3531d4){return _0x2740ac[_0x82b2('0x1f')](_0x44d49f)['json'](_0x3531d4);}};}function respondWithFilteredResult(_0x2fcf3b,_0x38b8cf){return function(_0x49fc4e){if(_0x49fc4e){var _0x483462=typeof _0x38b8cf[_0x82b2('0x21')]==='undefined'&&typeof _0x38b8cf[_0x82b2('0x22')]==='undefined';var _0x17dc37=_0x49fc4e['count'];var _0x4a9bd3=_0x483462?0x0:_0x38b8cf[_0x82b2('0x21')];var _0x5d37c8=_0x483462?_0x49fc4e['count']:_0x38b8cf[_0x82b2('0x21')]+_0x38b8cf[_0x82b2('0x22')];var _0xb0f39a;if(_0x5d37c8>=_0x17dc37){_0x5d37c8=_0x17dc37;_0xb0f39a=0xc8;}else{_0xb0f39a=0xce;}_0x2fcf3b['status'](_0xb0f39a);return _0x2fcf3b[_0x82b2('0x23')](_0x82b2('0x24'),_0x4a9bd3+'-'+_0x5d37c8+'/'+_0x17dc37)[_0x82b2('0x25')](_0x49fc4e);}return null;};}function patchUpdates(_0x53c4bb){return function(_0x17bdd3){try{jsonpatch['apply'](_0x17bdd3,_0x53c4bb,!![]);}catch(_0x444dd4){return BPromise['reject'](_0x444dd4);}return _0x17bdd3['save']();};}function saveUpdates(_0x58caea,_0x117228){return function(_0x202309){if(_0x202309){return _0x202309['update'](_0x58caea)[_0x82b2('0x26')](function(_0x3e42e1){return _0x3e42e1;});}return null;};}function removeEntity(_0x5c831,_0x480d2e){return function(_0x3c51e9){if(_0x3c51e9){return _0x3c51e9['destroy']()[_0x82b2('0x26')](function(){var _0x11074c=_0x3c51e9[_0x82b2('0x27')]({'plain':!![]});var _0x2ae6b0='Plugins';return db[_0x82b2('0x28')][_0x82b2('0x29')]({'where':{'type':_0x2ae6b0,'resourceId':_0x11074c['id']}})[_0x82b2('0x26')](function(){return _0x3c51e9;});})[_0x82b2('0x26')](function(){_0x5c831['status'](0xcc)[_0x82b2('0x20')]();});}};}function handleEntityNotFound(_0x2e30c6,_0x2d5384){return function(_0x3eda1c){if(!_0x3eda1c){_0x2e30c6[_0x82b2('0x1e')](0x194);}return _0x3eda1c;};}function handleError(_0x2229b9,_0x5a7897){_0x5a7897=_0x5a7897||0x1f4;return function(_0x294eb1){logger[_0x82b2('0x2a')](_0x294eb1[_0x82b2('0x2b')]);if(_0x294eb1[_0x82b2('0x2c')]){delete _0x294eb1[_0x82b2('0x2c')];}_0x2229b9[_0x82b2('0x1f')](_0x5a7897)[_0x82b2('0x2d')](_0x294eb1);};}exports['index']=function(_0x3625f9,_0x3c291a){var _0xed8478={},_0x109f0d={},_0x35fc41={'count':0x0,'rows':[]};var _0x225580=_[_0x82b2('0x2e')](db[_0x82b2('0x2f')][_0x82b2('0x30')],function(_0x4c63e5){return{'name':_0x4c63e5[_0x82b2('0x31')],'type':_0x4c63e5['type']['key']};});_0x109f0d['model']=_[_0x82b2('0x2e')](_0x225580,_0x82b2('0x2c'));_0x109f0d[_0x82b2('0x32')]=_[_0x82b2('0x33')](_0x3625f9[_0x82b2('0x32')]);_0x109f0d[_0x82b2('0x34')]=_[_0x82b2('0x35')](_0x109f0d['model'],_0x109f0d[_0x82b2('0x32')]);_0xed8478['attributes']=_[_0x82b2('0x35')](_0x109f0d[_0x82b2('0x36')],qs[_0x82b2('0x37')](_0x3625f9[_0x82b2('0x32')]['fields']));_0xed8478[_0x82b2('0x38')]=_0xed8478[_0x82b2('0x38')][_0x82b2('0x39')]?_0xed8478[_0x82b2('0x38')]:_0x109f0d['model'];if(!_0x3625f9[_0x82b2('0x32')][_0x82b2('0x3a')](_0x82b2('0x3b'))){_0xed8478[_0x82b2('0x22')]=qs[_0x82b2('0x22')](_0x3625f9[_0x82b2('0x32')][_0x82b2('0x22')]);_0xed8478['offset']=qs['offset'](_0x3625f9[_0x82b2('0x32')][_0x82b2('0x21')]);}_0xed8478[_0x82b2('0x3c')]=qs[_0x82b2('0x3d')](_0x3625f9[_0x82b2('0x32')][_0x82b2('0x3d')]);_0xed8478['where']=qs[_0x82b2('0x34')](_['pick'](_0x3625f9[_0x82b2('0x32')],_0x109f0d[_0x82b2('0x34')]),_0x225580);if(_0x3625f9['query'][_0x82b2('0x3e')]){_0xed8478['where']=_[_0x82b2('0x3f')](_0xed8478[_0x82b2('0x40')],{'$or':_['map'](_0x225580,function(_0x431c0e){if(_0x431c0e[_0x82b2('0x41')]!==_0x82b2('0x42')){var _0x3f875d={};_0x3f875d[_0x431c0e[_0x82b2('0x2c')]]={'$like':'%'+_0x3625f9['query'][_0x82b2('0x3e')]+'%'};return _0x3f875d;}})});}_0xed8478=_[_0x82b2('0x3f')]({},_0xed8478,_0x3625f9['options']);var _0xb89016={'where':_0xed8478[_0x82b2('0x40')]};return db['Plugin']['count'](_0xb89016)['then'](function(_0x1949b7){_0x35fc41['count']=_0x1949b7;if(_0x3625f9[_0x82b2('0x32')][_0x82b2('0x43')]){_0xed8478[_0x82b2('0x44')]=[{'all':!![]}];}return db[_0x82b2('0x2f')][_0x82b2('0x45')](_0xed8478);})[_0x82b2('0x26')](function(_0x1ab2a9){_0x35fc41['rows']=_0x1ab2a9;return _0x35fc41;})['then'](respondWithFilteredResult(_0x3c291a,_0xed8478))[_0x82b2('0x46')](handleError(_0x3c291a,null));};exports['show']=function(_0x5d89ea,_0x111c80){var _0x4686f1={'raw':!![],'where':{'id':_0x5d89ea[_0x82b2('0x47')]['id']}},_0x2f41b0={};_0x2f41b0[_0x82b2('0x36')]=_[_0x82b2('0x33')](db[_0x82b2('0x2f')][_0x82b2('0x30')]);_0x2f41b0['query']=_[_0x82b2('0x33')](_0x5d89ea[_0x82b2('0x32')]);_0x2f41b0[_0x82b2('0x34')]=_['intersection'](_0x2f41b0[_0x82b2('0x36')],_0x2f41b0[_0x82b2('0x32')]);_0x4686f1[_0x82b2('0x38')]=_[_0x82b2('0x35')](_0x2f41b0[_0x82b2('0x36')],qs[_0x82b2('0x37')](_0x5d89ea[_0x82b2('0x32')]['fields']));_0x4686f1[_0x82b2('0x38')]=_0x4686f1[_0x82b2('0x38')][_0x82b2('0x39')]?_0x4686f1[_0x82b2('0x38')]:_0x2f41b0[_0x82b2('0x36')];if(_0x5d89ea[_0x82b2('0x32')][_0x82b2('0x43')]){_0x4686f1['include']=[{'all':!![]}];}_0x4686f1=_['merge']({},_0x4686f1,_0x5d89ea['options']);return db[_0x82b2('0x2f')][_0x82b2('0x48')](_0x4686f1)[_0x82b2('0x26')](handleEntityNotFound(_0x111c80,null))[_0x82b2('0x26')](respondWithResult(_0x111c80,null))[_0x82b2('0x46')](handleError(_0x111c80,null));};exports[_0x82b2('0x49')]=function(_0x104cb8,_0x238cd3,_0x2f5ba1){return db[_0x82b2('0x2f')][_0x82b2('0x48')]({'where':{'id':_0x104cb8[_0x82b2('0x47')]['id']},'attributes':[_0x82b2('0x2c'),_0x82b2('0x5')],'raw':!![]})[_0x82b2('0x26')](handleEntityNotFound(_0x238cd3,null))[_0x82b2('0x26')](function(_0x1cfc03){if(_0x1cfc03){var _0x399bf9=path[_0x82b2('0x4a')](config['root'],_0x82b2('0x4b'),util[_0x82b2('0x4c')](_0x82b2('0x4d'),path['basename'](_0x1cfc03[_0x82b2('0x5')])));var _0x3f5cc7=fs[_0x82b2('0x4e')](_0x399bf9);var _0x43eab1=archiver(_0x82b2('0x4f'),{'zlib':{'level':0x9}});_0x43eab1['on'](_0x82b2('0x50'),function(_0x21e9b5){if(_0x21e9b5[_0x82b2('0x51')]==='ENOENT'){logger[_0x82b2('0x2a')](_0x21e9b5);}else{throw new db['Sequelize'][(_0x82b2('0x52'))](_0x82b2('0x53'));}});_0x43eab1['on'](_0x82b2('0x2a'),function(_0x37ba3e){throw new db['Sequelize'][(_0x82b2('0x52'))](_0x82b2('0x53'));});_0x43eab1[_0x82b2('0x54')](_0x3f5cc7);_0x43eab1['glob']('**/*',{'cwd':path['join'](config['root'],_0x82b2('0x4b'),path[_0x82b2('0x55')](_0x1cfc03[_0x82b2('0x5')])),'ignore':[path[_0x82b2('0x4a')](path[_0x82b2('0x56')](_0x1cfc03['path']),_0x82b2('0x57')),path[_0x82b2('0x4a')](path['basename'](_0x1cfc03[_0x82b2('0x5')]),_0x82b2('0x58'))],'nodir':!![]})[_0x82b2('0x59')]();_0x3f5cc7['on']('close',function(){if(!fs[_0x82b2('0x5a')](_0x399bf9)){throw new db[(_0x82b2('0x5b'))][(_0x82b2('0x52'))]('Plugin\x20not\x20found');}return _0x238cd3[_0x82b2('0x49')](_0x399bf9,util[_0x82b2('0x4c')](_0x82b2('0x4d'),path[_0x82b2('0x56')](_0x1cfc03[_0x82b2('0x5')])),function(_0x56f2ab){if(_0x56f2ab){throw new db[(_0x82b2('0x5b'))]['Error'](_0x82b2('0x5c'));}fs['unlinkSync'](_0x399bf9);logger[_0x82b2('0x5d')]('Download\x20completed');logger[_0x82b2('0x5d')](_0x82b2('0x5e'));});});}return null;})[_0x82b2('0x46')](handleError(_0x238cd3,null));};exports[_0x82b2('0x5f')]=function(_0x434f74,_0x1c0d53,_0x3eeabe){var _0x50cd99=path[_0x82b2('0x56')](_0x434f74[_0x82b2('0x60')][_0x82b2('0x61')],path['extname'](_0x434f74[_0x82b2('0x60')]['filename']));var _0x162b02=path[_0x82b2('0x4a')](config[_0x82b2('0x62')],'server/files/plugins',_0x434f74[_0x82b2('0x60')][_0x82b2('0x61')]);var _0x160048=path[_0x82b2('0x4a')](config['root'],_0x82b2('0x4b'),_0x50cd99);logger[_0x82b2('0x5d')](_0x82b2('0x63'),_0x162b02);logger[_0x82b2('0x5d')](_0x82b2('0x64'),_0x160048);try{fs['chmodSync'](_0x162b02,parseInt(_0x82b2('0x65'),0x8));extract(_0x162b02,{'dir':_0x160048},function(_0x256412){if(_0x256412){logger[_0x82b2('0x2a')](_0x256412);handleError(_0x256412,!![]);};var _0x161b42=fs[_0x82b2('0x66')](_0x160048);if(_0x161b42[_0x82b2('0x39')]>0x1){removeReferences(_0x162b02,_0x160048);logger['error'](_0x82b2('0x67'));return _0x3eeabe(new Error(_0x82b2('0x67')));}var _0x13130f=fs['lstatSync'](path[_0x82b2('0x4a')](_0x160048,_0x161b42[0x0]));if(_0x13130f[_0x82b2('0x68')]()){removeReferences(_0x162b02,_0x160048);logger[_0x82b2('0x2a')](_0x82b2('0x67'));return _0x3eeabe(new Error(_0x82b2('0x67')));}if(_0x13130f['isDirectory']()){var _0x2d1bb0=fs[_0x82b2('0x66')](path[_0x82b2('0x4a')](_0x160048,_0x161b42[0x0]));if(_0x2d1bb0[_0x82b2('0x39')]===0x0){removeReferences(_0x162b02,_0x160048);logger[_0x82b2('0x2a')](_0x82b2('0x67'));return _0x3eeabe(new Error(_0x82b2('0x67')));}var _0x423909=_0x2d1bb0[_0x82b2('0x69')](function(_0x4b1e79){return _0x4b1e79===_0x82b2('0x6a');});if(!_0x423909){return _0x3eeabe(new Error('Plugin\x20manifest\x20missing'));}var _0x512573=fs[_0x82b2('0x6b')](path[_0x82b2('0x4a')](_0x160048,_0x161b42[0x0],_0x82b2('0x6a')));var _0x5d29a6=JSON[_0x82b2('0x6c')](_0x512573);if(_0x82b2('0x6d')==typeof _0x5d29a6[_0x82b2('0x2c')]){return _0x3eeabe(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x5d29a6[_0x82b2('0x41')]){return _0x3eeabe(new Error(_0x82b2('0x6e')));}if(_0x82b2('0x6d')==typeof _0x5d29a6[_0x82b2('0x6f')]){return _0x3eeabe(new Error(_0x82b2('0x70')));}if(_0x82b2('0x6d')==typeof _0x5d29a6[_0x82b2('0x71')]){return _0x3eeabe(new Error(_0x82b2('0x72')));}if(_0x5d29a6[_0x82b2('0x41')]===_0x82b2('0x73')){if(_0x82b2('0x6d')==typeof _0x5d29a6['parameters']['views']){return _0x3eeabe(new Error(_0x82b2('0x74')));}if('undefined'==typeof _0x5d29a6[_0x82b2('0x71')]['views']['admin']&&_0x82b2('0x6d')==typeof _0x5d29a6[_0x82b2('0x71')][_0x82b2('0x75')][_0x82b2('0x76')]){return _0x3eeabe(new Error(_0x82b2('0x77')));}}else if(_0x5d29a6['type']===_0x82b2('0x78')){if(_0x82b2('0x6d')==typeof _0x5d29a6[_0x82b2('0x71')][_0x82b2('0x79')]){return _0x3eeabe(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x82b2('0x6d')==typeof _0x5d29a6['parameters'][_0x82b2('0x7a')]){return _0x3eeabe(new Error(_0x82b2('0x7b')));}}else{return _0x3eeabe(new Error(_0x82b2('0x7c')));}var _0x37f8cd=_0x5d29a6[_0x82b2('0x2c')];var _0x4de4bb=_0x5d29a6['description'];var _0x1591b6=_0x5d29a6[_0x82b2('0x41')];var _0x5f1ec3=_0x5d29a6[_0x82b2('0x7d')]?_0x5d29a6[_0x82b2('0x7d')]:_0x82b2('0x7e');var _0x4fa101=_0x5d29a6[_0x82b2('0x7f')]?_0x5d29a6['icon']:'icon-apps';var _0x45d281='';var _0x38470d='';var _0x5cfbc0='';var _0x4785bf='';var _0x34db15=_0x5d29a6['version'];if(_0x1591b6===_0x82b2('0x73')){if('undefined'!=typeof _0x5d29a6[_0x82b2('0x71')][_0x82b2('0x75')]['admin']){var _0x3d32f4=_0x5d29a6['parameters'][_0x82b2('0x75')][_0x82b2('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x82b2('0x81')](_0x3d32f4)){_0x45d281=path[_0x82b2('0x4a')](_0x82b2('0x82'),_0x50cd99,_0x161b42[0x0],_0x3d32f4);}else{_0x45d281=_0x3d32f4;}}else{logger[_0x82b2('0x5d')](_0x82b2('0x83'));}if(_0x82b2('0x6d')!=typeof _0x5d29a6['parameters'][_0x82b2('0x75')][_0x82b2('0x76')]){var _0x3a85e8=_0x5d29a6[_0x82b2('0x71')][_0x82b2('0x75')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x82b2('0x81')](_0x3a85e8)){_0x38470d=path[_0x82b2('0x4a')](_0x82b2('0x82'),_0x50cd99,_0x161b42[0x0],_0x3a85e8);}else{_0x38470d=_0x3a85e8;}}else{logger[_0x82b2('0x5d')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x1591b6===_0x82b2('0x78')){_0x5cfbc0=_0x5d29a6['parameters'][_0x82b2('0x79')];_0x4785bf=_0x5d29a6[_0x82b2('0x71')][_0x82b2('0x7a')];if('undefined'!=typeof _0x5d29a6['parameters'][_0x82b2('0x75')]){if('undefined'!=typeof _0x5d29a6[_0x82b2('0x71')]['views'][_0x82b2('0x80')]){var _0x3d32f4=_0x5d29a6['parameters'][_0x82b2('0x75')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x82b2('0x81')](_0x3d32f4)){_0x45d281=path[_0x82b2('0x4a')](_0x82b2('0x82'),_0x50cd99,_0x161b42[0x0],_0x3d32f4);}else{_0x45d281=_0x3d32f4;}}if('undefined'!=typeof _0x5d29a6[_0x82b2('0x71')][_0x82b2('0x75')][_0x82b2('0x76')]){var _0x3a85e8=_0x5d29a6[_0x82b2('0x71')][_0x82b2('0x75')][_0x82b2('0x76')];if(!/^(f|ht)tps?:\/\//i[_0x82b2('0x81')](_0x3a85e8)){_0x38470d=path[_0x82b2('0x4a')](_0x82b2('0x82'),_0x50cd99,_0x161b42[0x0],_0x3a85e8);}else{_0x38470d=_0x3a85e8;}}}}var _0x103568={'name':_0x37f8cd,'description':_0x4de4bb,'path':path[_0x82b2('0x4a')](_0x50cd99,_0x161b42[0x0]),'type':_0x1591b6,'sidebar':_0x5f1ec3,'icon':_0x4fa101,'adminUrl':_0x45d281,'agentUrl':_0x38470d,'scriptName':_0x5cfbc0,'scriptPath':_0x4785bf,'version':_0x34db15};removeReferences(_0x162b02,null);return db[_0x82b2('0x2f')][_0x82b2('0x84')](_0x103568)[_0x82b2('0x26')](function(_0x2fbba5){var _0x5a84a1={'role':_0x434f74[_0x82b2('0x85')][_0x82b2('0x86')],'userProfileId':_0x434f74[_0x82b2('0x85')]['userProfileId']};if(!_0x5a84a1)throw new Error(_0x82b2('0x87'));if(_0x5a84a1[_0x82b2('0x86')]===_0x82b2('0x88')){var _0x541497=_0x2fbba5[_0x82b2('0x27')]({'plain':!![]});return db[_0x82b2('0x89')]['find']({'where':{'name':'Plugins','userProfileId':_0x5a84a1[_0x82b2('0x8a')]},'raw':!![]})[_0x82b2('0x26')](function(_0x2ec953){if(_0x2ec953&&_0x2ec953[_0x82b2('0x8b')]===0x0){return db[_0x82b2('0x28')]['create']({'name':_0x541497['name'],'resourceId':_0x541497['id'],'type':_0x2ec953['name'],'sectionId':_0x2ec953['id']},{})[_0x82b2('0x26')](function(){return _0x2fbba5;});}else{return _0x2fbba5;}})[_0x82b2('0x46')](function(_0x13eb72){logger[_0x82b2('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13eb72);throw _0x13eb72;});}return _0x2fbba5;})[_0x82b2('0x26')](respondWithResult(_0x1c0d53,null))[_0x82b2('0x46')](handleError(_0x1c0d53,null));}});}catch(_0x93be4d){_0x1c0d53[_0x82b2('0x1f')](0x1f4)[_0x82b2('0x2d')](_0x93be4d);}};function removeReferences(_0x485cf1,_0x145119){try{if(_0x485cf1){fs[_0x82b2('0x8c')](_0x485cf1);logger[_0x82b2('0x5d')]('Zip\x20archive\x20removed');}if(_0x145119){rimraf(_0x145119,function(){});logger['info'](_0x82b2('0x8d'));}}catch(_0xb15675){logger['error'](_0xb15675);}}exports[_0x82b2('0x8e')]=function(_0x3b740f,_0x41425e,_0x52cd9f){return db[_0x82b2('0x2f')]['find']({'where':{'id':_0x3b740f[_0x82b2('0x47')]['id']}})[_0x82b2('0x26')](handleEntityNotFound(_0x41425e,null))[_0x82b2('0x26')](saveUpdates(_0x3b740f['body'],null))[_0x82b2('0x26')](respondWithResult(_0x41425e,null))['catch'](handleError(_0x41425e,null));};exports['delete']=function(_0x8896b8,_0x462db1,_0x8368c5){return db[_0x82b2('0x2f')][_0x82b2('0x48')]({'where':{'id':_0x8896b8['params']['id']}})[_0x82b2('0x26')](function(_0x3410e1){if(_0x3410e1){return _0x3410e1[_0x82b2('0x29')]();}})['then'](function(_0x4850c1){rimraf(path['join'](config[_0x82b2('0x62')],_0x82b2('0x4b'),path[_0x82b2('0x55')](_0x4850c1[_0x82b2('0x5')])),function(){});return _0x4850c1;})[_0x82b2('0x26')](handleEntityNotFound(_0x462db1,null))[_0x82b2('0x26')](respondWithStatusCode(_0x462db1,null))['catch'](handleError(_0x462db1,null));};exports[_0x82b2('0x8f')]=function(_0x5d1a95,_0x4dac7d,_0x400553){return BPromise[_0x82b2('0x90')]()['then'](function(){if(!_0x5d1a95['query'][_0x82b2('0x5')]){throw new Error(_0x82b2('0x91'));}if(!_0x5d1a95[_0x82b2('0x32')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x38065f=_0x5d1a95[_0x82b2('0x32')][_0x82b2('0x92')]?_0x5d1a95['query'][_0x82b2('0x92')]+':'+_0x5d1a95[_0x82b2('0x32')]['port']:_0x82b2('0x93')+_0x5d1a95[_0x82b2('0x32')]['port'];var _0x312235=_0x5d1a95[_0x82b2('0x32')]['json']?_0x5d1a95[_0x82b2('0x32')]['json']:!![];var _0x38d81a=_0x5d1a95[_0x82b2('0x32')][_0x82b2('0x94')]?_0x5d1a95[_0x82b2('0x32')][_0x82b2('0x94')]:null;var _0x25af79={'method':_0x5d1a95[_0x82b2('0x95')],'uri':util['format'](_0x82b2('0x96'),_0x38065f,_0x5d1a95[_0x82b2('0x32')][_0x82b2('0x5')]),'json':_0x312235,'resolveWithFullResponse':!![],'encoding':_0x38d81a,'qs':_0x5d1a95[_0x82b2('0x32')]};if(_0x5d1a95[_0x82b2('0x97')]){_0x25af79['headers']=_0x5d1a95[_0x82b2('0x97')];if(_0x25af79['headers']['content-length']){delete _0x25af79[_0x82b2('0x97')][_0x82b2('0x98')];}}if(_0x25af79[_0x82b2('0x97')][_0x82b2('0x99')]){delete _0x25af79['headers'][_0x82b2('0x99')];}return rp(_0x25af79);})[_0x82b2('0x26')](function(_0x32ebda){if(_0x32ebda){_0x4dac7d[_0x82b2('0x23')](_0x32ebda[_0x82b2('0x97')]);logger['info'](_0x32ebda['body']);if(_['endsWith'](_0x5d1a95['query'][_0x82b2('0x5')],'download')&&_0x32ebda['statusCode']==0x1f4){return _0x4dac7d[_0x82b2('0x1e')](_0x32ebda[_0x82b2('0x9a')]);}else{return _0x4dac7d['status'](_0x32ebda[_0x82b2('0x9a')])[_0x82b2('0x2d')](_0x32ebda[_0x82b2('0x85')]);}}else{return _0x4dac7d['sendStatus'](0xc8);}})[_0x82b2('0x46')](handleError(_0x4dac7d,null));};exports[_0x82b2('0x9b')]=function(_0x2b0fff,_0x4255f8,_0x32b682){return BPromise[_0x82b2('0x90')]()[_0x82b2('0x26')](function(){if(!_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x5')]){throw new Error(_0x82b2('0x91'));}if(!_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x9c')]){throw new Error(_0x82b2('0x9d'));}var _0x4e0348=_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x92')]?_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x92')]+':'+_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x9c')]:'http://localhost:'+_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x9c')];var _0x31dccd=_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x25')]?_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x25')]:!![];var _0x38a907=_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x94')]?_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x94')]:null;var _0x250332={'method':_0x2b0fff['method'],'uri':util[_0x82b2('0x4c')]('%s%s',_0x4e0348,_0x2b0fff[_0x82b2('0x32')]['path']),'json':_0x31dccd,'resolveWithFullResponse':!![],'encoding':_0x38a907,'body':_0x2b0fff['body']};if(_0x2b0fff['headers']){_0x250332[_0x82b2('0x97')]=_0x2b0fff[_0x82b2('0x97')];if(_0x250332[_0x82b2('0x97')][_0x82b2('0x98')]){delete _0x250332[_0x82b2('0x97')][_0x82b2('0x98')];}}if(_0x250332[_0x82b2('0x97')][_0x82b2('0x99')]){delete _0x250332[_0x82b2('0x97')][_0x82b2('0x99')];}return rp(_0x250332);})[_0x82b2('0x26')](function(_0x2a692c){if(_0x2a692c){_0x4255f8[_0x82b2('0x23')](_0x2a692c[_0x82b2('0x97')]);logger['info'](_0x2a692c['body']);return _0x4255f8[_0x82b2('0x1f')](_0x2a692c[_0x82b2('0x9a')])[_0x82b2('0x2d')](_0x2a692c[_0x82b2('0x85')]);}else{return _0x4255f8[_0x82b2('0x1e')](0xc8);}})[_0x82b2('0x46')](handleError(_0x4255f8,null));}; \ No newline at end of file +var _0x6dfb=['get','UserProfileResource','stack','name','send','map','Plugin','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','catch','show','params','include','find','download','root','server/files/plugins','format','%s.zip','basename','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','join','dirname','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','error','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','description','sidebar','always','icon','icon-apps','version','html','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','test','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Plugins','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6dfb,0x7c));var _0xb6df=function(_0x948cc8,_0x4fea10){_0x948cc8=_0x948cc8-0x0;var _0x109cb4=_0x6dfb[_0x948cc8];return _0x109cb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb6df('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb6df('0x1'));var rp=require(_0xb6df('0x2'));var moment=require(_0xb6df('0x3'));var BPromise=require(_0xb6df('0x4'));var Mustache=require(_0xb6df('0x5'));var util=require(_0xb6df('0x6'));var path=require(_0xb6df('0x7'));var sox=require(_0xb6df('0x8'));var csv=require(_0xb6df('0x9'));var ejs=require(_0xb6df('0xa'));var fs=require('fs');var fs_extra=require(_0xb6df('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb6df('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb6df('0xd'));var toCsv=require(_0xb6df('0x9'));var querystring=require(_0xb6df('0xe'));var Papa=require(_0xb6df('0xf'));var extract=require(_0xb6df('0x10'));var rimraf=require(_0xb6df('0x0'));var archiver=require(_0xb6df('0x11'));var Redis=require(_0xb6df('0x12'));var authService=require(_0xb6df('0x13'));var qs=require(_0xb6df('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6df('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xb6df('0x16'));var config=require(_0xb6df('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb6df('0x18')]=_[_0xb6df('0x19')](config[_0xb6df('0x18')],{'host':_0xb6df('0x1a'),'port':0x18eb});var socket=require(_0xb6df('0x1b'))(new Redis(config['redis']));require(_0xb6df('0x1c'))['register'](socket);function respondWithStatusCode(_0x5173f9,_0x743b95){_0x743b95=_0x743b95||0xcc;return function(_0x2bffc4){if(_0x2bffc4){return _0x5173f9[_0xb6df('0x1d')](_0x743b95);}return _0x5173f9[_0xb6df('0x1e')](_0x743b95)[_0xb6df('0x1f')]();};}function respondWithResult(_0x1fc901,_0x4fb6db){_0x4fb6db=_0x4fb6db||0xc8;return function(_0x4ffa78){if(_0x4ffa78){return _0x1fc901['status'](_0x4fb6db)[_0xb6df('0x20')](_0x4ffa78);}};}function respondWithFilteredResult(_0x350713,_0x3f2466){return function(_0x279e49){if(_0x279e49){var _0x4d9673=typeof _0x3f2466['offset']===_0xb6df('0x21')&&typeof _0x3f2466[_0xb6df('0x22')]===_0xb6df('0x21');var _0x57e641=_0x279e49[_0xb6df('0x23')];var _0x300462=_0x4d9673?0x0:_0x3f2466[_0xb6df('0x24')];var _0x4205f8=_0x4d9673?_0x279e49[_0xb6df('0x23')]:_0x3f2466[_0xb6df('0x24')]+_0x3f2466['limit'];var _0x360a47;if(_0x4205f8>=_0x57e641){_0x4205f8=_0x57e641;_0x360a47=0xc8;}else{_0x360a47=0xce;}_0x350713['status'](_0x360a47);return _0x350713[_0xb6df('0x25')](_0xb6df('0x26'),_0x300462+'-'+_0x4205f8+'/'+_0x57e641)[_0xb6df('0x20')](_0x279e49);}return null;};}function patchUpdates(_0x37f0a3){return function(_0x3667e7){try{jsonpatch[_0xb6df('0x27')](_0x3667e7,_0x37f0a3,!![]);}catch(_0x3daa72){return BPromise['reject'](_0x3daa72);}return _0x3667e7[_0xb6df('0x28')]();};}function saveUpdates(_0xdae3bd,_0xef020){return function(_0x302020){if(_0x302020){return _0x302020[_0xb6df('0x29')](_0xdae3bd)[_0xb6df('0x2a')](function(_0x3ee320){return _0x3ee320;});}return null;};}function removeEntity(_0x4c633f,_0x3671eb){return function(_0x17f959){if(_0x17f959){return _0x17f959[_0xb6df('0x2b')]()['then'](function(){var _0x5cb67d=_0x17f959[_0xb6df('0x2c')]({'plain':!![]});var _0x5df030='Plugins';return db[_0xb6df('0x2d')][_0xb6df('0x2b')]({'where':{'type':_0x5df030,'resourceId':_0x5cb67d['id']}})[_0xb6df('0x2a')](function(){return _0x17f959;});})[_0xb6df('0x2a')](function(){_0x4c633f[_0xb6df('0x1e')](0xcc)[_0xb6df('0x1f')]();});}};}function handleEntityNotFound(_0x441cec,_0x1aece0){return function(_0xb41df3){if(!_0xb41df3){_0x441cec[_0xb6df('0x1d')](0x194);}return _0xb41df3;};}function handleError(_0x4df25d,_0x59a9a8){_0x59a9a8=_0x59a9a8||0x1f4;return function(_0x3efc66){logger['error'](_0x3efc66[_0xb6df('0x2e')]);if(_0x3efc66[_0xb6df('0x2f')]){delete _0x3efc66[_0xb6df('0x2f')];}_0x4df25d[_0xb6df('0x1e')](_0x59a9a8)[_0xb6df('0x30')](_0x3efc66);};}exports['index']=function(_0x4af67c,_0x301762){var _0x122e15={},_0x5c3305={},_0x5acbec={'count':0x0,'rows':[]};var _0x18c4aa=_[_0xb6df('0x31')](db[_0xb6df('0x32')][_0xb6df('0x33')],function(_0x2c7382){return{'name':_0x2c7382[_0xb6df('0x34')],'type':_0x2c7382['type'][_0xb6df('0x35')]};});_0x5c3305[_0xb6df('0x36')]=_[_0xb6df('0x31')](_0x18c4aa,_0xb6df('0x2f'));_0x5c3305[_0xb6df('0x37')]=_[_0xb6df('0x38')](_0x4af67c[_0xb6df('0x37')]);_0x5c3305[_0xb6df('0x39')]=_[_0xb6df('0x3a')](_0x5c3305['model'],_0x5c3305[_0xb6df('0x37')]);_0x122e15[_0xb6df('0x3b')]=_['intersection'](_0x5c3305[_0xb6df('0x36')],qs[_0xb6df('0x3c')](_0x4af67c[_0xb6df('0x37')][_0xb6df('0x3c')]));_0x122e15[_0xb6df('0x3b')]=_0x122e15['attributes'][_0xb6df('0x3d')]?_0x122e15['attributes']:_0x5c3305[_0xb6df('0x36')];if(!_0x4af67c['query'][_0xb6df('0x3e')]('nolimit')){_0x122e15[_0xb6df('0x22')]=qs[_0xb6df('0x22')](_0x4af67c[_0xb6df('0x37')][_0xb6df('0x22')]);_0x122e15['offset']=qs[_0xb6df('0x24')](_0x4af67c['query']['offset']);}_0x122e15[_0xb6df('0x3f')]=qs[_0xb6df('0x40')](_0x4af67c[_0xb6df('0x37')][_0xb6df('0x40')]);_0x122e15[_0xb6df('0x41')]=qs['filters'](_['pick'](_0x4af67c[_0xb6df('0x37')],_0x5c3305[_0xb6df('0x39')]),_0x18c4aa);if(_0x4af67c[_0xb6df('0x37')][_0xb6df('0x42')]){_0x122e15[_0xb6df('0x41')]=_[_0xb6df('0x43')](_0x122e15[_0xb6df('0x41')],{'$or':_['map'](_0x18c4aa,function(_0x306ff4){if(_0x306ff4[_0xb6df('0x44')]!==_0xb6df('0x45')){var _0x6acc09={};_0x6acc09[_0x306ff4[_0xb6df('0x2f')]]={'$like':'%'+_0x4af67c[_0xb6df('0x37')][_0xb6df('0x42')]+'%'};return _0x6acc09;}})});}_0x122e15=_[_0xb6df('0x43')]({},_0x122e15,_0x4af67c[_0xb6df('0x46')]);var _0x396dcb={'where':_0x122e15[_0xb6df('0x41')]};return db[_0xb6df('0x32')]['count'](_0x396dcb)[_0xb6df('0x2a')](function(_0x2230c9){_0x5acbec['count']=_0x2230c9;if(_0x4af67c['query'][_0xb6df('0x47')]){_0x122e15['include']=[{'all':!![]}];}return db[_0xb6df('0x32')]['findAll'](_0x122e15);})[_0xb6df('0x2a')](function(_0x3c695e){_0x5acbec['rows']=_0x3c695e;return _0x5acbec;})['then'](respondWithFilteredResult(_0x301762,_0x122e15))[_0xb6df('0x48')](handleError(_0x301762,null));};exports[_0xb6df('0x49')]=function(_0x343ac2,_0x35957f){var _0x20d137={'raw':!![],'where':{'id':_0x343ac2[_0xb6df('0x4a')]['id']}},_0xc577b5={};_0xc577b5[_0xb6df('0x36')]=_['keys'](db[_0xb6df('0x32')]['rawAttributes']);_0xc577b5['query']=_[_0xb6df('0x38')](_0x343ac2[_0xb6df('0x37')]);_0xc577b5[_0xb6df('0x39')]=_[_0xb6df('0x3a')](_0xc577b5['model'],_0xc577b5[_0xb6df('0x37')]);_0x20d137['attributes']=_[_0xb6df('0x3a')](_0xc577b5[_0xb6df('0x36')],qs[_0xb6df('0x3c')](_0x343ac2[_0xb6df('0x37')][_0xb6df('0x3c')]));_0x20d137['attributes']=_0x20d137[_0xb6df('0x3b')][_0xb6df('0x3d')]?_0x20d137[_0xb6df('0x3b')]:_0xc577b5['model'];if(_0x343ac2['query']['includeAll']){_0x20d137[_0xb6df('0x4b')]=[{'all':!![]}];}_0x20d137=_[_0xb6df('0x43')]({},_0x20d137,_0x343ac2[_0xb6df('0x46')]);return db[_0xb6df('0x32')][_0xb6df('0x4c')](_0x20d137)[_0xb6df('0x2a')](handleEntityNotFound(_0x35957f,null))[_0xb6df('0x2a')](respondWithResult(_0x35957f,null))['catch'](handleError(_0x35957f,null));};exports[_0xb6df('0x4d')]=function(_0xd77ac7,_0x42b54b,_0x5b62bc){return db[_0xb6df('0x32')][_0xb6df('0x4c')]({'where':{'id':_0xd77ac7[_0xb6df('0x4a')]['id']},'attributes':[_0xb6df('0x2f'),'path'],'raw':!![]})[_0xb6df('0x2a')](handleEntityNotFound(_0x42b54b,null))[_0xb6df('0x2a')](function(_0x3f8278){if(_0x3f8278){var _0x535636=path['join'](config[_0xb6df('0x4e')],_0xb6df('0x4f'),util[_0xb6df('0x50')](_0xb6df('0x51'),path[_0xb6df('0x52')](_0x3f8278[_0xb6df('0x7')])));var _0x3f41b1=fs['createWriteStream'](_0x535636);var _0x5e99a7=archiver(_0xb6df('0x53'),{'zlib':{'level':0x9}});_0x5e99a7['on']('warning',function(_0x51a775){if(_0x51a775[_0xb6df('0x54')]===_0xb6df('0x55')){logger['error'](_0x51a775);}else{throw new db[(_0xb6df('0x56'))][(_0xb6df('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x5e99a7['on']('error',function(_0x539f48){throw new db[(_0xb6df('0x56'))][(_0xb6df('0x57'))](_0xb6df('0x58'));});_0x5e99a7[_0xb6df('0x59')](_0x3f41b1);_0x5e99a7['glob'](_0xb6df('0x5a'),{'cwd':path[_0xb6df('0x5b')](config[_0xb6df('0x4e')],_0xb6df('0x4f'),path[_0xb6df('0x5c')](_0x3f8278[_0xb6df('0x7')])),'ignore':[path[_0xb6df('0x5b')](path[_0xb6df('0x52')](_0x3f8278[_0xb6df('0x7')]),'node_modules/**/*'),path[_0xb6df('0x5b')](path[_0xb6df('0x52')](_0x3f8278['path']),_0xb6df('0x5d'))],'nodir':!![]})[_0xb6df('0x5e')]();_0x3f41b1['on'](_0xb6df('0x5f'),function(){if(!fs['existsSync'](_0x535636)){throw new db[(_0xb6df('0x56'))][(_0xb6df('0x57'))](_0xb6df('0x60'));}return _0x42b54b[_0xb6df('0x4d')](_0x535636,util[_0xb6df('0x50')](_0xb6df('0x51'),path[_0xb6df('0x52')](_0x3f8278[_0xb6df('0x7')])),function(_0x55fd03){if(_0x55fd03){throw new db[(_0xb6df('0x56'))][(_0xb6df('0x57'))](_0xb6df('0x61'));}fs[_0xb6df('0x62')](_0x535636);logger[_0xb6df('0x63')](_0xb6df('0x64'));logger['info'](_0xb6df('0x65'));});});}return null;})[_0xb6df('0x48')](handleError(_0x42b54b,null));};exports['upload']=function(_0x2d16cc,_0x407ea4,_0xc519e4){var _0x7bf787=path['basename'](_0x2d16cc[_0xb6df('0x66')]['filename'],path[_0xb6df('0x67')](_0x2d16cc[_0xb6df('0x66')][_0xb6df('0x68')]));var _0x243a44=path['join'](config[_0xb6df('0x4e')],_0xb6df('0x4f'),_0x2d16cc[_0xb6df('0x66')][_0xb6df('0x68')]);var _0x4c4c7e=path[_0xb6df('0x5b')](config['root'],_0xb6df('0x4f'),_0x7bf787);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x243a44);logger['info'](_0xb6df('0x69'),_0x4c4c7e);try{fs[_0xb6df('0x6a')](_0x243a44,parseInt(_0xb6df('0x6b'),0x8));extract(_0x243a44,{'dir':_0x4c4c7e},function(_0x50f2ce){if(_0x50f2ce){logger[_0xb6df('0x6c')](_0x50f2ce);handleError(_0x50f2ce,!![]);};var _0xdf54a5=fs[_0xb6df('0x6d')](_0x4c4c7e);if(_0xdf54a5[_0xb6df('0x3d')]>0x1){removeReferences(_0x243a44,_0x4c4c7e);logger[_0xb6df('0x6c')](_0xb6df('0x6e'));return _0xc519e4(new Error(_0xb6df('0x6e')));}var _0x2514ee=fs[_0xb6df('0x6f')](path[_0xb6df('0x5b')](_0x4c4c7e,_0xdf54a5[0x0]));if(_0x2514ee[_0xb6df('0x70')]()){removeReferences(_0x243a44,_0x4c4c7e);logger[_0xb6df('0x6c')](_0xb6df('0x6e'));return _0xc519e4(new Error(_0xb6df('0x6e')));}if(_0x2514ee[_0xb6df('0x71')]()){var _0x49ef23=fs[_0xb6df('0x6d')](path[_0xb6df('0x5b')](_0x4c4c7e,_0xdf54a5[0x0]));if(_0x49ef23['length']===0x0){removeReferences(_0x243a44,_0x4c4c7e);logger['error'](_0xb6df('0x6e'));return _0xc519e4(new Error(_0xb6df('0x6e')));}var _0x18bdc3=_0x49ef23[_0xb6df('0x72')](function(_0x2a7c08){return _0x2a7c08==='manifest.json';});if(!_0x18bdc3){return _0xc519e4(new Error(_0xb6df('0x73')));}var _0x376ca0=fs[_0xb6df('0x74')](path[_0xb6df('0x5b')](_0x4c4c7e,_0xdf54a5[0x0],'manifest.json'));var _0x26a51b=JSON[_0xb6df('0x75')](_0x376ca0);if('undefined'==typeof _0x26a51b[_0xb6df('0x2f')]){return _0xc519e4(new Error(_0xb6df('0x76')));}if(_0xb6df('0x21')==typeof _0x26a51b[_0xb6df('0x44')]){return _0xc519e4(new Error(_0xb6df('0x77')));}if(_0xb6df('0x21')==typeof _0x26a51b['version']){return _0xc519e4(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xb6df('0x21')==typeof _0x26a51b['parameters']){return _0xc519e4(new Error(_0xb6df('0x78')));}if(_0x26a51b['type']==='html'){if(_0xb6df('0x21')==typeof _0x26a51b['parameters'][_0xb6df('0x79')]){return _0xc519e4(new Error(_0xb6df('0x7a')));}if(_0xb6df('0x21')==typeof _0x26a51b[_0xb6df('0x7b')]['views'][_0xb6df('0x7c')]&&'undefined'==typeof _0x26a51b['parameters'][_0xb6df('0x79')][_0xb6df('0x7d')]){return _0xc519e4(new Error(_0xb6df('0x7e')));}}else if(_0x26a51b[_0xb6df('0x44')]==='script'){if(_0xb6df('0x21')==typeof _0x26a51b[_0xb6df('0x7b')]['scriptName']){return _0xc519e4(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xb6df('0x21')==typeof _0x26a51b['parameters'][_0xb6df('0x7f')]){return _0xc519e4(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0xc519e4(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2944c6=_0x26a51b['name'];var _0x50721d=_0x26a51b[_0xb6df('0x80')];var _0x4ef442=_0x26a51b[_0xb6df('0x44')];var _0x4d88e3=_0x26a51b['sidebar']?_0x26a51b[_0xb6df('0x81')]:_0xb6df('0x82');var _0x552b84=_0x26a51b['icon']?_0x26a51b[_0xb6df('0x83')]:_0xb6df('0x84');var _0x4967a9='';var _0x4d20dd='';var _0x2e0447='';var _0x1655b9='';var _0x21044f=_0x26a51b[_0xb6df('0x85')];if(_0x4ef442===_0xb6df('0x86')){if(_0xb6df('0x21')!=typeof _0x26a51b['parameters'][_0xb6df('0x79')][_0xb6df('0x7c')]){var _0x15f443=_0x26a51b[_0xb6df('0x7b')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x15f443)){_0x4967a9=path[_0xb6df('0x5b')](_0xb6df('0x87'),_0x7bf787,_0xdf54a5[0x0],_0x15f443);}else{_0x4967a9=_0x15f443;}}else{logger[_0xb6df('0x63')](_0xb6df('0x88'));}if('undefined'!=typeof _0x26a51b[_0xb6df('0x7b')][_0xb6df('0x79')][_0xb6df('0x7d')]){var _0x4467e2=_0x26a51b[_0xb6df('0x7b')]['views'][_0xb6df('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4467e2)){_0x4d20dd=path[_0xb6df('0x5b')]('plugins',_0x7bf787,_0xdf54a5[0x0],_0x4467e2);}else{_0x4d20dd=_0x4467e2;}}else{logger[_0xb6df('0x63')](_0xb6df('0x89'));}}else if(_0x4ef442===_0xb6df('0x8a')){_0x2e0447=_0x26a51b[_0xb6df('0x7b')][_0xb6df('0x8b')];_0x1655b9=_0x26a51b[_0xb6df('0x7b')][_0xb6df('0x7f')];if(_0xb6df('0x21')!=typeof _0x26a51b[_0xb6df('0x7b')][_0xb6df('0x79')]){if(_0xb6df('0x21')!=typeof _0x26a51b[_0xb6df('0x7b')]['views']['admin']){var _0x15f443=_0x26a51b['parameters'][_0xb6df('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xb6df('0x8c')](_0x15f443)){_0x4967a9=path[_0xb6df('0x5b')](_0xb6df('0x87'),_0x7bf787,_0xdf54a5[0x0],_0x15f443);}else{_0x4967a9=_0x15f443;}}if(_0xb6df('0x21')!=typeof _0x26a51b[_0xb6df('0x7b')][_0xb6df('0x79')][_0xb6df('0x7d')]){var _0x4467e2=_0x26a51b['parameters'][_0xb6df('0x79')][_0xb6df('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xb6df('0x8c')](_0x4467e2)){_0x4d20dd=path[_0xb6df('0x5b')](_0xb6df('0x87'),_0x7bf787,_0xdf54a5[0x0],_0x4467e2);}else{_0x4d20dd=_0x4467e2;}}}}var _0x26be7a={'name':_0x2944c6,'description':_0x50721d,'path':path[_0xb6df('0x5b')](_0x7bf787,_0xdf54a5[0x0]),'type':_0x4ef442,'sidebar':_0x4d88e3,'icon':_0x552b84,'adminUrl':_0x4967a9,'agentUrl':_0x4d20dd,'scriptName':_0x2e0447,'scriptPath':_0x1655b9,'version':_0x21044f};removeReferences(_0x243a44,null);return db[_0xb6df('0x32')]['create'](_0x26be7a)['then'](function(_0x21eac1){var _0x3c46a={'role':_0x2d16cc[_0xb6df('0x8d')][_0xb6df('0x8e')],'userProfileId':_0x2d16cc[_0xb6df('0x8d')][_0xb6df('0x8f')]};if(!_0x3c46a)throw new Error(_0xb6df('0x90'));if(_0x3c46a[_0xb6df('0x8e')]==='user'){var _0x507ded=_0x21eac1[_0xb6df('0x2c')]({'plain':!![]});return db[_0xb6df('0x91')][_0xb6df('0x4c')]({'where':{'name':_0xb6df('0x92'),'userProfileId':_0x3c46a[_0xb6df('0x8f')]},'raw':!![]})[_0xb6df('0x2a')](function(_0x24564a){if(_0x24564a&&_0x24564a[_0xb6df('0x93')]===0x0){return db[_0xb6df('0x2d')][_0xb6df('0x94')]({'name':_0x507ded[_0xb6df('0x2f')],'resourceId':_0x507ded['id'],'type':_0x24564a[_0xb6df('0x2f')],'sectionId':_0x24564a['id']},{})[_0xb6df('0x2a')](function(){return _0x21eac1;});}else{return _0x21eac1;}})[_0xb6df('0x48')](function(_0x535a26){logger['error'](_0xb6df('0x95'),_0x535a26);throw _0x535a26;});}return _0x21eac1;})['then'](respondWithResult(_0x407ea4,null))[_0xb6df('0x48')](handleError(_0x407ea4,null));}});}catch(_0x562bc1){_0x407ea4[_0xb6df('0x1e')](0x1f4)[_0xb6df('0x30')](_0x562bc1);}};function removeReferences(_0x1f4b4e,_0x3c5018){try{if(_0x1f4b4e){fs[_0xb6df('0x62')](_0x1f4b4e);logger[_0xb6df('0x63')](_0xb6df('0x96'));}if(_0x3c5018){rimraf(_0x3c5018,function(){});logger[_0xb6df('0x63')](_0xb6df('0x97'));}}catch(_0x30b36e){logger[_0xb6df('0x6c')](_0x30b36e);}}exports[_0xb6df('0x29')]=function(_0x384eb1,_0x4507a4,_0x342d5d){return db[_0xb6df('0x32')][_0xb6df('0x4c')]({'where':{'id':_0x384eb1[_0xb6df('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4507a4,null))[_0xb6df('0x2a')](saveUpdates(_0x384eb1[_0xb6df('0x8d')],null))[_0xb6df('0x2a')](respondWithResult(_0x4507a4,null))[_0xb6df('0x48')](handleError(_0x4507a4,null));};exports[_0xb6df('0x98')]=function(_0x4c73eb,_0x1ed43b,_0x1a971c){return db[_0xb6df('0x32')][_0xb6df('0x4c')]({'where':{'id':_0x4c73eb[_0xb6df('0x4a')]['id']}})[_0xb6df('0x2a')](function(_0x2a3047){if(_0x2a3047){return _0x2a3047[_0xb6df('0x2b')]();}})[_0xb6df('0x2a')](function(_0x3f1d3e){rimraf(path['join'](config[_0xb6df('0x4e')],_0xb6df('0x4f'),path[_0xb6df('0x5c')](_0x3f1d3e[_0xb6df('0x7')])),function(){});return _0x3f1d3e;})[_0xb6df('0x2a')](handleEntityNotFound(_0x1ed43b,null))[_0xb6df('0x2a')](respondWithStatusCode(_0x1ed43b,null))[_0xb6df('0x48')](handleError(_0x1ed43b,null));};exports['webhookGet']=function(_0x5ecd5d,_0x5a918c,_0x49605e){return BPromise[_0xb6df('0x99')]()[_0xb6df('0x2a')](function(){if(!_0x5ecd5d['query'][_0xb6df('0x7')]){throw new Error(_0xb6df('0x9a'));}if(!_0x5ecd5d['query'][_0xb6df('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x388236=_0x5ecd5d[_0xb6df('0x37')]['hostname']?_0x5ecd5d[_0xb6df('0x37')][_0xb6df('0x9c')]+':'+_0x5ecd5d[_0xb6df('0x37')]['port']:_0xb6df('0x9d')+_0x5ecd5d[_0xb6df('0x37')][_0xb6df('0x9b')];var _0x741b3=_0x5ecd5d[_0xb6df('0x37')][_0xb6df('0x20')]?_0x5ecd5d[_0xb6df('0x37')][_0xb6df('0x20')]:!![];var _0x1ce902=_0x5ecd5d['query']['encoding']?_0x5ecd5d[_0xb6df('0x37')][_0xb6df('0x9e')]:null;var _0x32f26a={'method':_0x5ecd5d[_0xb6df('0x9f')],'uri':util[_0xb6df('0x50')](_0xb6df('0xa0'),_0x388236,_0x5ecd5d['query'][_0xb6df('0x7')]),'json':_0x741b3,'resolveWithFullResponse':!![],'encoding':_0x1ce902,'qs':_0x5ecd5d['query']};if(_0x5ecd5d[_0xb6df('0xa1')]){_0x32f26a[_0xb6df('0xa1')]=_0x5ecd5d[_0xb6df('0xa1')];if(_0x32f26a['headers'][_0xb6df('0xa2')]){delete _0x32f26a[_0xb6df('0xa1')]['content-length'];}}if(_0x32f26a[_0xb6df('0xa1')][_0xb6df('0xa3')]){delete _0x32f26a[_0xb6df('0xa1')][_0xb6df('0xa3')];}return rp(_0x32f26a);})['then'](function(_0x3d6cf1){if(_0x3d6cf1){_0x5a918c[_0xb6df('0x25')](_0x3d6cf1['headers']);logger[_0xb6df('0x63')](_0x3d6cf1[_0xb6df('0x8d')]);if(_[_0xb6df('0xa4')](_0x5ecd5d[_0xb6df('0x37')][_0xb6df('0x7')],_0xb6df('0x4d'))&&_0x3d6cf1['statusCode']==0x1f4){return _0x5a918c[_0xb6df('0x1d')](_0x3d6cf1[_0xb6df('0xa5')]);}else{return _0x5a918c[_0xb6df('0x1e')](_0x3d6cf1['statusCode'])[_0xb6df('0x30')](_0x3d6cf1[_0xb6df('0x8d')]);}}else{return _0x5a918c[_0xb6df('0x1d')](0xc8);}})['catch'](handleError(_0x5a918c,null));};exports[_0xb6df('0xa6')]=function(_0x1f238f,_0x26cfea,_0x34f10a){return BPromise['resolve']()['then'](function(){if(!_0x1f238f[_0xb6df('0x37')][_0xb6df('0x7')]){throw new Error(_0xb6df('0x9a'));}if(!_0x1f238f[_0xb6df('0x37')][_0xb6df('0x9b')]){throw new Error(_0xb6df('0xa7'));}var _0x4fe309=_0x1f238f[_0xb6df('0x37')][_0xb6df('0x9c')]?_0x1f238f['query'][_0xb6df('0x9c')]+':'+_0x1f238f[_0xb6df('0x37')][_0xb6df('0x9b')]:_0xb6df('0x9d')+_0x1f238f[_0xb6df('0x37')][_0xb6df('0x9b')];var _0x545e37=_0x1f238f[_0xb6df('0x37')][_0xb6df('0x20')]?_0x1f238f[_0xb6df('0x37')][_0xb6df('0x20')]:!![];var _0x5d83fd=_0x1f238f[_0xb6df('0x37')]['encoding']?_0x1f238f[_0xb6df('0x37')][_0xb6df('0x9e')]:null;var _0x283cea={'method':_0x1f238f[_0xb6df('0x9f')],'uri':util['format']('%s%s',_0x4fe309,_0x1f238f[_0xb6df('0x37')]['path']),'json':_0x545e37,'resolveWithFullResponse':!![],'encoding':_0x5d83fd,'body':_0x1f238f[_0xb6df('0x8d')]};if(_0x1f238f[_0xb6df('0xa1')]){_0x283cea[_0xb6df('0xa1')]=_0x1f238f['headers'];if(_0x283cea[_0xb6df('0xa1')]['content-length']){delete _0x283cea[_0xb6df('0xa1')][_0xb6df('0xa2')];}}if(_0x283cea[_0xb6df('0xa1')]['content-type']){delete _0x283cea[_0xb6df('0xa1')][_0xb6df('0xa3')];}return rp(_0x283cea);})['then'](function(_0x574981){if(_0x574981){_0x26cfea[_0xb6df('0x25')](_0x574981[_0xb6df('0xa1')]);logger['info'](_0x574981['body']);return _0x26cfea[_0xb6df('0x1e')](_0x574981[_0xb6df('0xa5')])[_0xb6df('0x30')](_0x574981[_0xb6df('0x8d')]);}else{return _0x26cfea[_0xb6df('0x1d')](0xc8);}})['catch'](handleError(_0x26cfea,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 5de1ae5..239bbb6 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 _0xbeea=['emit','exports','events','Plugin','setMaxListeners','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbeea,0xb1));var _0xabee=function(_0x44068d,_0x32310a){_0x44068d=_0x44068d-0x0;var _0x208dd7=_0xbeea[_0x44068d];return _0x208dd7;};'use strict';var EventEmitter=require(_0xabee('0x0'));var Plugin=require('../../mysqldb')['db'][_0xabee('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xabee('0x2')](0x0);var events={'afterCreate':_0xabee('0x3'),'afterUpdate':'update','afterDestroy':_0xabee('0x4')};function emitEvent(_0x59e264){return function(_0x58afa7,_0x33571e,_0x2fb6d9){PluginEvents[_0xabee('0x5')](_0x59e264+':'+_0x58afa7['id'],_0x58afa7);PluginEvents[_0xabee('0x5')](_0x59e264,_0x58afa7);_0x2fb6d9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xabee('0x6')]=PluginEvents; \ No newline at end of file +var _0x3595=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x597529,_0x174d44){var _0x25a47e=function(_0xf124c6){while(--_0xf124c6){_0x597529['push'](_0x597529['shift']());}};_0x25a47e(++_0x174d44);}(_0x3595,0x147));var _0x5359=function(_0x50b48d,_0x47aea2){_0x50b48d=_0x50b48d-0x0;var _0x42fcb5=_0x3595[_0x50b48d];return _0x42fcb5;};'use strict';var EventEmitter=require(_0x5359('0x0'));var Plugin=require(_0x5359('0x1'))['db'][_0x5359('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5359('0x3'),'afterUpdate':_0x5359('0x4'),'afterDestroy':_0x5359('0x5')};function emitEvent(_0x3fd018){return function(_0x1fa814,_0x125c76,_0x4e42e0){PluginEvents['emit'](_0x3fd018+':'+_0x1fa814['id'],_0x1fa814);PluginEvents[_0x5359('0x6')](_0x3fd018,_0x1fa814);_0x4e42e0(null);};}for(var e in events){if(events[_0x5359('0x7')](e)){var event=events[e];Plugin[_0x5359('0x8')](e,emitEvent(event));}}module[_0x5359('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index b598b64..4727558 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 _0x91f4=['exports','define','plugins','util','bluebird','path'];(function(_0x3d856e,_0x4e22a1){var _0x2b1aa4=function(_0x32d10b){while(--_0x32d10b){_0x3d856e['push'](_0x3d856e['shift']());}};_0x2b1aa4(++_0x4e22a1);}(_0x91f4,0xc9));var _0x491f=function(_0x39cc0c,_0x18786f){_0x39cc0c=_0x39cc0c-0x0;var _0x15691b=_0x91f4[_0x39cc0c];return _0x15691b;};'use strict';var _=require('lodash');var util=require(_0x491f('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x491f('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x491f('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x491f('0x3')]=function(_0x54d45c,_0x37df6a){return _0x54d45c[_0x491f('0x4')]('Plugin',attributes,{'tableName':_0x491f('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb06=['../../config/environment','./plugin.attributes','exports','define','plugins','util','api','bluebird','request-promise','path','rimraf'];(function(_0x487f47,_0x32b30b){var _0x35988b=function(_0x589ef6){while(--_0x589ef6){_0x487f47['push'](_0x487f47['shift']());}};_0x35988b(++_0x32b30b);}(_0xfb06,0x118));var _0x6fb0=function(_0x556a99,_0x3d0574){_0x556a99=_0x556a99-0x0;var _0x45a65a=_0xfb06[_0x556a99];return _0x45a65a;};'use strict';var _=require('lodash');var util=require(_0x6fb0('0x0'));var logger=require('../../config/logger')(_0x6fb0('0x1'));var moment=require('moment');var BPromise=require(_0x6fb0('0x2'));var rp=require(_0x6fb0('0x3'));var fs=require('fs');var path=require(_0x6fb0('0x4'));var rimraf=require(_0x6fb0('0x5'));var config=require(_0x6fb0('0x6'));var attributes=require(_0x6fb0('0x7'));module[_0x6fb0('0x8')]=function(_0x50019c,_0x5cd903){return _0x50019c[_0x6fb0('0x9')]('Plugin',attributes,{'tableName':_0x6fb0('0xa'),'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 f7f407b..5dfdb94 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 _0x413f=['http','defaults','redis','localhost','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','CreatePlugin','Plugin','create','body','options','raw','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x6095cd,_0x4ee7a3){var _0x227728=function(_0x1538a9){while(--_0x1538a9){_0x6095cd['push'](_0x6095cd['shift']());}};_0x227728(++_0x4ee7a3);}(_0x413f,0xd7));var _0xf413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x413f[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xf413('0x0'));var moment=require(_0xf413('0x1'));var BPromise=require(_0xf413('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf413('0x3'));var db=require(_0xf413('0x4'))['db'];var utils=require(_0xf413('0x5'));var logger=require('../../config/logger')(_0xf413('0x6'));var config=require(_0xf413('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf413('0x8')][_0xf413('0x9')]({'port':0x232a});config['redis']=_[_0xf413('0xa')](config[_0xf413('0xb')],{'host':_0xf413('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf413('0xb')]));require('./plugin.socket')[_0xf413('0xd')](socket);function respondWithRpcPromise(_0x4335d8,_0xbcd42a,_0x1d27c5){return new BPromise(function(_0x1deaad,_0x524fe9){return client[_0xf413('0xe')](_0x4335d8,_0x1d27c5)[_0xf413('0xf')](function(_0x3f4113){logger[_0xf413('0x10')](_0xf413('0x11'),_0xbcd42a,_0xf413('0x12'));logger[_0xf413('0x13')](_0xf413('0x14'),_0xbcd42a,'request\x20sent',JSON['stringify'](_0x3f4113));if(_0x3f4113[_0xf413('0x15')]){if(_0x3f4113['error'][_0xf413('0x16')]===0x1f4){logger[_0xf413('0x15')](_0xf413('0x11'),_0xbcd42a,_0x3f4113[_0xf413('0x15')][_0xf413('0x17')]);return _0x524fe9(_0x3f4113['error'][_0xf413('0x17')]);}logger[_0xf413('0x15')]('Plugin,\x20%s,\x20%s',_0xbcd42a,_0x3f4113[_0xf413('0x15')]['message']);return _0x1deaad(_0x3f4113['error']['message']);}else{logger[_0xf413('0x10')](_0xf413('0x11'),_0xbcd42a,_0xf413('0x12'));_0x1deaad(_0x3f4113[_0xf413('0x18')][_0xf413('0x17')]);}})['catch'](function(_0x3586c7){logger['error'](_0xf413('0x11'),_0xbcd42a,_0x3586c7);_0x524fe9(_0x3586c7);});});}exports[_0xf413('0x19')]=function(_0x40632e){var _0x44754a=this;return new Promise(function(_0x3fdf2d,_0xfe3ae4){return db[_0xf413('0x1a')][_0xf413('0x1b')](_0x40632e[_0xf413('0x1c')],{'raw':_0x40632e[_0xf413('0x1d')]?_0x40632e[_0xf413('0x1d')][_0xf413('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x51a8e){logger['info'](_0xf413('0x19'),_0x40632e);logger[_0xf413('0x13')](_0xf413('0x19'),_0x40632e,JSON['stringify'](_0x51a8e));_0x3fdf2d(_0x51a8e);})[_0xf413('0x1f')](function(_0x5d1ef6){logger['error']('CreatePlugin',_0x5d1ef6[_0xf413('0x17')],_0x40632e);_0xfe3ae4(_0x44754a['error'](0x1f4,_0x5d1ef6['message']));});});}; \ No newline at end of file +var _0xac0b=['../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','CreatePlugin','lodash','util','moment','ioredis'];(function(_0x4d0ff8,_0x2b79fb){var _0x389288=function(_0x446bbc){while(--_0x446bbc){_0x4d0ff8['push'](_0x4d0ff8['shift']());}};_0x389288(++_0x2b79fb);}(_0xac0b,0x164));var _0xbac0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xac0b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbac0('0x0'));var util=require(_0xbac0('0x1'));var moment=require(_0xbac0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbac0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbac0('0x4'));var logger=require(_0xbac0('0x5'))(_0xbac0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbac0('0x7')]({'port':0x232a});config[_0xbac0('0x8')]=_[_0xbac0('0x9')](config[_0xbac0('0x8')],{'host':_0xbac0('0xa'),'port':0x18eb});var socket=require(_0xbac0('0xb'))(new Redis(config[_0xbac0('0x8')]));require(_0xbac0('0xc'))[_0xbac0('0xd')](socket);function respondWithRpcPromise(_0x127a59,_0x2041b7,_0x51458f){return new BPromise(function(_0x3ebb77,_0x83bb22){return client[_0xbac0('0xe')](_0x127a59,_0x51458f)[_0xbac0('0xf')](function(_0x184019){logger[_0xbac0('0x10')](_0xbac0('0x11'),_0x2041b7,_0xbac0('0x12'));logger[_0xbac0('0x13')](_0xbac0('0x14'),_0x2041b7,'request\x20sent',JSON[_0xbac0('0x15')](_0x184019));if(_0x184019[_0xbac0('0x16')]){if(_0x184019[_0xbac0('0x16')][_0xbac0('0x17')]===0x1f4){logger['error'](_0xbac0('0x11'),_0x2041b7,_0x184019[_0xbac0('0x16')][_0xbac0('0x18')]);return _0x83bb22(_0x184019[_0xbac0('0x16')]['message']);}logger[_0xbac0('0x16')](_0xbac0('0x11'),_0x2041b7,_0x184019[_0xbac0('0x16')][_0xbac0('0x18')]);return _0x3ebb77(_0x184019[_0xbac0('0x16')][_0xbac0('0x18')]);}else{logger[_0xbac0('0x10')](_0xbac0('0x11'),_0x2041b7,_0xbac0('0x12'));_0x3ebb77(_0x184019['result']['message']);}})[_0xbac0('0x19')](function(_0x3f4287){logger['error']('Plugin,\x20%s,\x20%s',_0x2041b7,_0x3f4287);_0x83bb22(_0x3f4287);});});}exports['CreatePlugin']=function(_0x4e2079){var _0x1144e8=this;return new Promise(function(_0x17ddb3,_0xe10b53){return db['Plugin'][_0xbac0('0x1a')](_0x4e2079[_0xbac0('0x1b')],{'raw':_0x4e2079[_0xbac0('0x1c')]?_0x4e2079[_0xbac0('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xbac0('0xf')](function(_0x3a3f1d){logger[_0xbac0('0x10')](_0xbac0('0x1d'),_0x4e2079);logger['debug'](_0xbac0('0x1d'),_0x4e2079,JSON['stringify'](_0x3a3f1d));_0x17ddb3(_0x3a3f1d);})['catch'](function(_0x37e0ed){logger[_0xbac0('0x16')]('CreatePlugin',_0x37e0ed[_0xbac0('0x18')],_0x4e2079);_0xe10b53(_0x1144e8[_0xbac0('0x16')](0x1f4,_0x37e0ed[_0xbac0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index cd11260..9c41a61 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 _0x9ed8=['remove','register','plugin:','./plugin.events','save'];(function(_0x2d26b6,_0x4c560e){var _0x4ee601=function(_0x2ad07d){while(--_0x2ad07d){_0x2d26b6['push'](_0x2d26b6['shift']());}};_0x4ee601(++_0x4c560e);}(_0x9ed8,0xda));var _0x89ed=function(_0x1a286b,_0x5ac202){_0x1a286b=_0x1a286b-0x0;var _0x59021d=_0x9ed8[_0x1a286b];return _0x59021d;};'use strict';var PluginEvents=require(_0x89ed('0x0'));var events=[_0x89ed('0x1'),_0x89ed('0x2'),'update'];function createListener(_0x2fae1d,_0x549ae4){return function(_0x51b1f3){_0x549ae4['emit'](_0x2fae1d,_0x51b1f3);};}function removeListener(_0x5bae4b,_0x687a8e){return function(){PluginEvents['removeListener'](_0x5bae4b,_0x687a8e);};}exports[_0x89ed('0x3')]=function(_0x2fb03f){for(var _0xc6e70c=0x0,_0x26d952=events['length'];_0xc6e70c<_0x26d952;_0xc6e70c++){var _0x20daea=events[_0xc6e70c];var _0x1d4c87=createListener(_0x89ed('0x4')+_0x20daea,_0x2fb03f);PluginEvents['on'](_0x20daea,_0x1d4c87);}}; \ No newline at end of file +var _0x65fb=['length','plugin:','./plugin.events','update','emit','removeListener','register'];(function(_0x18caeb,_0x1b8f97){var _0x455aca=function(_0x2cde20){while(--_0x2cde20){_0x18caeb['push'](_0x18caeb['shift']());}};_0x455aca(++_0x1b8f97);}(_0x65fb,0xaa));var _0xb65f=function(_0x400766,_0x368660){_0x400766=_0x400766-0x0;var _0x3ae58b=_0x65fb[_0x400766];return _0x3ae58b;};'use strict';var PluginEvents=require(_0xb65f('0x0'));var events=['save','remove',_0xb65f('0x1')];function createListener(_0x21098b,_0x20f93d){return function(_0x33af1a){_0x20f93d[_0xb65f('0x2')](_0x21098b,_0x33af1a);};}function removeListener(_0x7c31f7,_0x52f142){return function(){PluginEvents[_0xb65f('0x3')](_0x7c31f7,_0x52f142);};}exports[_0xb65f('0x4')]=function(_0x3b7893){for(var _0x1caed4=0x0,_0x4131b2=events[_0xb65f('0x5')];_0x1caed4<_0x4131b2;_0x1caed4++){var _0x45c938=events[_0x1caed4];var _0x55d231=createListener(_0xb65f('0x6')+_0x45c938,_0x3b7893);PluginEvents['on'](_0x45c938,_0x55d231);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 384ff0b..3f0852f 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(_0x102fc6,_0x19d7ee){var _0x290711=function(_0x1777bf){while(--_0x1777bf){_0x102fc6['push'](_0x102fc6['shift']());}};_0x290711(++_0x19d7ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x283adc,_0x443066){var _0x518cfa=function(_0x42ecc8){while(--_0x42ecc8){_0x283adc['push'](_0x283adc['shift']());}};_0x518cfa(++_0x443066);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 e9d96de..20dcb5a 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 _0x16d2=['cwd','chdir','start','dump','update','stop','send','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','list','express','motion2','length','then','catch','show','params','create','body','script','join'];(function(_0x49e0f7,_0xc274c3){var _0x5b54cf=function(_0x533982){while(--_0x533982){_0x49e0f7['push'](_0x49e0f7['shift']());}};_0x5b54cf(++_0xc274c3);}(_0x16d2,0x123));var _0x216d=function(_0x5acaea,_0x442cb0){_0x5acaea=_0x5acaea-0x0;var _0x509dfa=_0x16d2[_0x5acaea];return _0x509dfa;};'use strict';var _=require(_0x216d('0x0'));var pm2=require(_0x216d('0x1'));var logger=require(_0x216d('0x2'))(_0x216d('0x3'));var path=require(_0x216d('0x4'));var exec=require(_0x216d('0x5'))[_0x216d('0x6')];var BPromise=require(_0x216d('0x7'));function handleEntityNotFound(_0xfd7306,_0x593bb0){return function(_0x2c662d){if(!_0x2c662d){_0xfd7306[_0x216d('0x8')](0x194);;}return _0x2c662d;};}function respondWithResult(_0xef687c,_0x205101){_0x205101=_0x205101||0xc8;return function(_0x1dd8e2){if(_0x1dd8e2){return _0xef687c[_0x216d('0x9')](_0x205101)[_0x216d('0xa')](_0x1dd8e2);}return null;};}function handleError(_0x28da14,_0x57accc){_0x57accc=_0x57accc||0x1f4;return function(_0x22c7b3){logger[_0x216d('0xb')](_0x22c7b3[_0x216d('0xc')]);if(_0x22c7b3[_0x216d('0xd')]){delete _0x22c7b3[_0x216d('0xd')];}_0x28da14[_0x216d('0x9')](_0x57accc)['send'](_0x22c7b3);};}function execChildProcess(){return new BPromise(function(_0x7ca9c9,_0x50db30){exec(_0x216d('0xe'),function(_0x2e02ce,_0x332e30,_0x398970){logger[_0x216d('0xf')](_0x332e30);logger[_0x216d('0xf')](_0x398970);if(_0x2e02ce){logger['error'](_0x2e02ce);return _0x50db30(_0x2e02ce);}return _0x7ca9c9(_0x332e30);});});}exports[_0x216d('0x10')]=function(_0x4c07d0,_0x271bb1){return pm2[_0x216d('0x11')]()['then'](function(_0x165c19){if(_0x165c19){var _0x322e4b=_['reject'](_0x165c19,function(_0x1b3215){return _0x1b3215['name']===_0x216d('0x12')||_0x1b3215[_0x216d('0xd')]===_0x216d('0x13');});return{'rows':_0x322e4b,'count':_0x322e4b[_0x216d('0x14')]};}return null;})[_0x216d('0x15')](respondWithResult(_0x271bb1,null))[_0x216d('0x16')](handleError(_0x271bb1,null));};exports[_0x216d('0x17')]=function(_0x1496fe,_0x19fdac){return pm2['describe'](_0x1496fe[_0x216d('0x18')]['id'])['then'](respondWithResult(_0x19fdac,null))['then'](handleEntityNotFound(_0x19fdac,null))[_0x216d('0x16')](handleError(_0x19fdac,null));};exports[_0x216d('0x19')]=function(_0x574758,_0x3f32e0){if(_0x574758[_0x216d('0x1a')]['name']&&_0x574758[_0x216d('0x1a')][_0x216d('0x1b')]){var _0x430e81=path[_0x216d('0x1c')](__dirname,'../../files/plugins',_0x574758[_0x216d('0x1a')][_0x216d('0x1b')]);var _0x10f299=process[_0x216d('0x1d')]();process[_0x216d('0x1e')](path['dirname'](_0x430e81));return execChildProcess()[_0x216d('0x15')](function(_0x1bd4db){process[_0x216d('0x1e')](_0x10f299);return pm2[_0x216d('0x1f')]({'name':_0x574758[_0x216d('0x1a')]['name'],'script':_0x430e81});})[_0x216d('0x15')](function(_0xab672){pm2[_0x216d('0x20')]();return _0xab672[0x0];})['then'](respondWithResult(_0x3f32e0,0xc9))['catch'](handleError(_0x3f32e0,null));}else{return _0x3f32e0['status'](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x216d('0x21')]=function(_0x470d8a,_0x189413){if(_0x470d8a[_0x216d('0x1a')]['id']){delete _0x470d8a[_0x216d('0x1a')]['id'];}var _0x47fa6d={'online':'restart','stopped':_0x216d('0x22')};if(_0x47fa6d['hasOwnProperty'](_0x470d8a[_0x216d('0x1a')][_0x216d('0x9')])){return pm2[_0x47fa6d[_0x470d8a[_0x216d('0x1a')][_0x216d('0x9')]]](_0x470d8a[_0x216d('0x18')]['id'])[_0x216d('0x15')](respondWithResult(_0x189413,0xc8))[_0x216d('0x16')](handleError(_0x189413,null));}else{return _0x189413[_0x216d('0x9')](0x1f4)[_0x216d('0x23')]({'message':_0x216d('0x24')});}};exports[_0x216d('0x25')]=function(_0x260134,_0x4537fd){if(_0x260134['body']['id']){delete _0x260134[_0x216d('0x1a')]['id'];}if(_0x260134[_0x216d('0x18')]['id']){return pm2[_0x216d('0x26')](_0x260134['params']['id'])[_0x216d('0x15')](function(_0x1743ee){pm2[_0x216d('0x20')]();return _0x1743ee[0x0];})[_0x216d('0x15')](respondWithResult(_0x4537fd,null))['catch'](handleError(_0x4537fd,null));}else{return _0x4537fd[_0x216d('0x9')](0x1f4)[_0x216d('0x23')]({'message':_0x216d('0x27')});}}; \ No newline at end of file +var _0xd404=['stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','api','path','exec','bluebird','sendStatus','json','name','status','send','npm\x20install','info','error','index','list','then','express','motion2','length','catch','show','describe','params','body','join','script','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart'];(function(_0x3f10b0,_0x44451b){var _0x1f4fee=function(_0x37d752){while(--_0x37d752){_0x3f10b0['push'](_0x3f10b0['shift']());}};_0x1f4fee(++_0x44451b);}(_0xd404,0x15b));var _0x4d40=function(_0x174cc7,_0x1b0b06){_0x174cc7=_0x174cc7-0x0;var _0x4055b6=_0xd404[_0x174cc7];return _0x4055b6;};'use strict';var _=require(_0x4d40('0x0'));var pm2=require(_0x4d40('0x1'));var logger=require('../../config/logger')(_0x4d40('0x2'));var path=require(_0x4d40('0x3'));var exec=require('child_process')[_0x4d40('0x4')];var BPromise=require(_0x4d40('0x5'));function handleEntityNotFound(_0xba821,_0x8bde12){return function(_0xbfb4c6){if(!_0xbfb4c6){_0xba821[_0x4d40('0x6')](0x194);;}return _0xbfb4c6;};}function respondWithResult(_0xc2a9db,_0x24a237){_0x24a237=_0x24a237||0xc8;return function(_0x2e4bd8){if(_0x2e4bd8){return _0xc2a9db['status'](_0x24a237)[_0x4d40('0x7')](_0x2e4bd8);}return null;};}function handleError(_0x116941,_0x5a23a2){_0x5a23a2=_0x5a23a2||0x1f4;return function(_0x3bf81a){logger['error'](_0x3bf81a['stack']);if(_0x3bf81a[_0x4d40('0x8')]){delete _0x3bf81a[_0x4d40('0x8')];}_0x116941[_0x4d40('0x9')](_0x5a23a2)[_0x4d40('0xa')](_0x3bf81a);};}function execChildProcess(){return new BPromise(function(_0x1d00cf,_0x357abf){exec(_0x4d40('0xb'),function(_0x2eab7a,_0x1e18bc,_0x3f5c29){logger[_0x4d40('0xc')](_0x1e18bc);logger[_0x4d40('0xc')](_0x3f5c29);if(_0x2eab7a){logger[_0x4d40('0xd')](_0x2eab7a);return _0x357abf(_0x2eab7a);}return _0x1d00cf(_0x1e18bc);});});}exports[_0x4d40('0xe')]=function(_0x5162f9,_0xa644d2){return pm2[_0x4d40('0xf')]()[_0x4d40('0x10')](function(_0x2083bd){if(_0x2083bd){var _0x477a91=_['reject'](_0x2083bd,function(_0x23de7b){return _0x23de7b[_0x4d40('0x8')]===_0x4d40('0x11')||_0x23de7b[_0x4d40('0x8')]===_0x4d40('0x12');});return{'rows':_0x477a91,'count':_0x477a91[_0x4d40('0x13')]};}return null;})[_0x4d40('0x10')](respondWithResult(_0xa644d2,null))[_0x4d40('0x14')](handleError(_0xa644d2,null));};exports[_0x4d40('0x15')]=function(_0x4b5d23,_0x535989){return pm2[_0x4d40('0x16')](_0x4b5d23[_0x4d40('0x17')]['id'])['then'](respondWithResult(_0x535989,null))[_0x4d40('0x10')](handleEntityNotFound(_0x535989,null))[_0x4d40('0x14')](handleError(_0x535989,null));};exports['create']=function(_0x36d031,_0x5a77e0){if(_0x36d031[_0x4d40('0x18')][_0x4d40('0x8')]&&_0x36d031['body']['script']){var _0x375ce0=path[_0x4d40('0x19')](__dirname,'../../files/plugins',_0x36d031[_0x4d40('0x18')][_0x4d40('0x1a')]);var _0x30f058=process['cwd']();process[_0x4d40('0x1b')](path[_0x4d40('0x1c')](_0x375ce0));return execChildProcess()[_0x4d40('0x10')](function(_0x5ca0a0){process['chdir'](_0x30f058);return pm2[_0x4d40('0x1d')]({'name':_0x36d031[_0x4d40('0x18')][_0x4d40('0x8')],'script':_0x375ce0});})[_0x4d40('0x10')](function(_0x4677c9){pm2['dump']();return _0x4677c9[0x0];})[_0x4d40('0x10')](respondWithResult(_0x5a77e0,0xc9))[_0x4d40('0x14')](handleError(_0x5a77e0,null));}else{return _0x5a77e0['status'](0x1f4)['send']({'message':_0x4d40('0x1e')});}};exports[_0x4d40('0x1f')]=function(_0x3fa83e,_0x3ad1d7){if(_0x3fa83e[_0x4d40('0x18')]['id']){delete _0x3fa83e[_0x4d40('0x18')]['id'];}var _0x105635={'online':_0x4d40('0x20'),'stopped':_0x4d40('0x21')};if(_0x105635[_0x4d40('0x22')](_0x3fa83e[_0x4d40('0x18')]['status'])){return pm2[_0x105635[_0x3fa83e['body']['status']]](_0x3fa83e[_0x4d40('0x17')]['id'])[_0x4d40('0x10')](respondWithResult(_0x3ad1d7,0xc8))[_0x4d40('0x14')](handleError(_0x3ad1d7,null));}else{return _0x3ad1d7[_0x4d40('0x9')](0x1f4)['send']({'message':_0x4d40('0x23')});}};exports[_0x4d40('0x24')]=function(_0x429da9,_0x5a6aff){if(_0x429da9[_0x4d40('0x18')]['id']){delete _0x429da9[_0x4d40('0x18')]['id'];}if(_0x429da9[_0x4d40('0x17')]['id']){return pm2[_0x4d40('0x25')](_0x429da9[_0x4d40('0x17')]['id'])['then'](function(_0x2f4b22){pm2['dump']();return _0x2f4b22[0x0];})[_0x4d40('0x10')](respondWithResult(_0x5a6aff,null))[_0x4d40('0x14')](handleError(_0x5a6aff,null));}else{return _0x5a6aff[_0x4d40('0x9')](0x1f4)[_0x4d40('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 86b2650..2dc4ab8 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 _0xb119=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','express','Router'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0xb119,0x73));var _0x9b11=function(_0x39dceb,_0x260486){_0x39dceb=_0x39dceb-0x0;var _0x5a3d9d=_0xb119[_0x39dceb];return _0x5a3d9d;};'use strict';var express=require(_0x9b11('0x0'));var router=express[_0x9b11('0x1')]();var auth=require(_0x9b11('0x2'));var controller=require(_0x9b11('0x3'));router[_0x9b11('0x4')](_0x9b11('0x5'),auth[_0x9b11('0x6')](),controller[_0x9b11('0x7')]);router[_0x9b11('0x4')](_0x9b11('0x8'),auth[_0x9b11('0x6')](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0x4842=['getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x30ebed,_0x42b3f9){var _0x3d0417=function(_0x396de8){while(--_0x396de8){_0x30ebed['push'](_0x30ebed['shift']());}};_0x3d0417(++_0x42b3f9);}(_0x4842,0x1ec));var _0x2484=function(_0x1a5da0,_0x5806a1){_0x1a5da0=_0x1a5da0-0x0;var _0x178f5a=_0x4842[_0x1a5da0];return _0x178f5a;};'use strict';var express=require(_0x2484('0x0'));var router=express[_0x2484('0x1')]();var auth=require(_0x2484('0x2'));var controller=require(_0x2484('0x3'));router[_0x2484('0x4')](_0x2484('0x5'),auth[_0x2484('0x6')](),controller[_0x2484('0x7')]);router[_0x2484('0x4')]('/queues',auth[_0x2484('0x6')](),controller[_0x2484('0x8')]);module[_0x2484('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index bbc7bfa..460c27a 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 _0xea04=['toLowerCase','getAgents','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','resolve','channel','sort','globalStatus','validateSortParameter','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','rawAttributes','type','key','agent','raw','sequelize','literal','forEach','where','role','user','userProfileId','extraQueryConditions','assign','UserProfile','User','findAndCountAll','filterAgentAttributes','getAgentStatus','pause','sortAgentsByStatus','getQueues','fieldName','getOptions','getResources','all','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','undefined','limit','count','offset','set','Content-Range','json','error','stack','name','status','send','request','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','catch','loggedIn','available','waiting','talking','paused','outbound','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','voice','pTalking','originated','find','merge','pick','filter','queue','busy','some','connectedlinenum','internal','toString','getMembers','length','UserId','accountcode','online','voiceStatus','agents','push','startCase','Queue','Pause','loggedInDb','getChannels','includes'];(function(_0x3b1f27,_0x40188b){var _0x5b8dd3=function(_0x4cdd20){while(--_0x4cdd20){_0x3b1f27['push'](_0x3b1f27['shift']());}};_0x5b8dd3(++_0x40188b);}(_0xea04,0x19f));var _0x4ea0=function(_0x48df04,_0x1522b1){_0x48df04=_0x48df04-0x0;var _0x4de5fa=_0xea04[_0x48df04];return _0x4de5fa;};'use strict';var util=require(_0x4ea0('0x0'));var _=require(_0x4ea0('0x1'));var jayson=require(_0x4ea0('0x2'));var rta=require('../../components/realtime/agents');var qs=require(_0x4ea0('0x3'));var utils=require('../../config/utils');var logger=require(_0x4ea0('0x4'))(_0x4ea0('0x5'));var db=require(_0x4ea0('0x6'))['db'];var amiClient=jayson[_0x4ea0('0x7')][_0x4ea0('0x8')]({'port':0x232a});var routingClient=jayson[_0x4ea0('0x7')]['http']({'port':0x232c});function respondWithFilteredResult(_0xab5eeb,_0x1ba777){return function(_0x664149){if(_0x664149){var _0x39485a=typeof _0x1ba777['offset']===_0x4ea0('0x9')&&typeof _0x1ba777[_0x4ea0('0xa')]===_0x4ea0('0x9');var _0x5e3bd1=_0x664149[_0x4ea0('0xb')];var _0x5e7c9b=_0x39485a?0x0:_0x1ba777[_0x4ea0('0xc')];var _0x18cf04=_0x39485a?_0x664149[_0x4ea0('0xb')]:_0x1ba777['offset']+_0x1ba777[_0x4ea0('0xa')];var _0x32971d;if(_0x18cf04>=_0x5e3bd1){_0x18cf04=_0x5e3bd1;_0x32971d=0xc8;}else{_0x32971d=0xce;}_0xab5eeb['status'](_0x32971d);return _0xab5eeb[_0x4ea0('0xd')](_0x4ea0('0xe'),_0x5e7c9b+'-'+_0x18cf04+'/'+_0x5e3bd1)[_0x4ea0('0xf')](_0x664149);}return null;};}function handleError(_0x199751,_0xc3abc5){_0xc3abc5=_0xc3abc5||0x1f4;return function(_0x251f95){logger[_0x4ea0('0x10')](_0x251f95[_0x4ea0('0x11')]);if(_0x251f95[_0x4ea0('0x12')]){delete _0x251f95[_0x4ea0('0x12')];}_0x199751[_0x4ea0('0x13')](_0xc3abc5)[_0x4ea0('0x14')](_0x251f95);};}function getRealtimeQueues(_0x4a0063,_0x4b1a91){return new Promise(function(_0x204e5a,_0x12def4){var _0x43c860=_0x4b1a91==='voice'?amiClient:routingClient;return _0x43c860[_0x4ea0('0x15')](_['startCase'](_0x4b1a91)+_0x4ea0('0x16'),_0x4a0063)[_0x4ea0('0x17')](function(_0x4b5ca0){if(_0x4b5ca0[_0x4ea0('0x10')])throw new Error(util[_0x4ea0('0x18')](_0x4ea0('0x19'),_0x4b1a91));return _0x204e5a(_0x4b5ca0[_0x4ea0('0x1a')]);})['catch'](function(_0x14ddeb){_0x12def4(_0x14ddeb);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x5aa547,_0x3e53b8){return amiClient[_0x4ea0('0x15')](_0x4ea0('0x1b'),{})['then'](function(_0x19fa79){if(_0x19fa79['error'])throw new Error(_0x4ea0('0x1c'));return _0x5aa547(_0x19fa79[_0x4ea0('0x1a')]);})[_0x4ea0('0x1d')](function(_0x221ad0){_0x3e53b8(_0x221ad0);});});}function initializeQueues(_0x2e5e7f,_0x1c9682,_0x3a120e,_0x3e8084){var _0x171eb2=[_0x4ea0('0x1e'),_0x4ea0('0x1f'),_0x4ea0('0x20'),_0x4ea0('0x21'),_0x4ea0('0x22')];if(_0x3a120e==='voice'&&_0x3e8084===_0x4ea0('0x23')){_0x171eb2['push']('pTalking','originated','message','dialActive',_0x4ea0('0x24'),'Trunk',_0x4ea0('0x25'),_0x4ea0('0x26'),_0x4ea0('0x27'),_0x4ea0('0x28'),_0x4ea0('0x29'),_0x4ea0('0x2a'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x4ea0('0x2b'),_0x4ea0('0x2c'),_0x4ea0('0x2d'),'predictiveIntervalAnsweredCalls',_0x4ea0('0x2e'),_0x4ea0('0x2f'),_0x4ea0('0x30'),'predictiveIntervalAvgTalktime');}return _0x2e5e7f[_0x4ea0('0x31')](function(_0x3d7573){var _0x28ceb3=_0x3d7573['get']({'plain':!![]});_0x28ceb3['agents']=[];_0x28ceb3[_0x4ea0('0x22')]=0x0;_0x28ceb3['loggedInDb']=0x0;_0x28ceb3[_0x4ea0('0x1e')]=0x0;_0x28ceb3['available']=0x0;_0x28ceb3[_0x4ea0('0x20')]=0x0;if(_0x3a120e===_0x4ea0('0x32')){_0x28ceb3['talking']=0x0;_0x28ceb3['busy']=0x0;if(_0x3e8084===_0x4ea0('0x23')){_0x28ceb3[_0x4ea0('0x33')]=0x0;_0x28ceb3[_0x4ea0('0x34')]=0x0;}}var _0x4cdf50=_[_0x4ea0('0x35')](_0x1c9682,['id',_0x28ceb3['id']]);if(_0x4cdf50)_[_0x4ea0('0x36')](_0x28ceb3,_[_0x4ea0('0x37')](_0x4cdf50,_0x171eb2));return _0x28ceb3;});}function updateAgentVoiceStatus(_0x2e5623,_0x6ab614,_0xe65ddd){var _0x530682=_[_0x4ea0('0x38')](_0xe65ddd,[_0x4ea0('0x39'),_0x6ab614['name']]);if(_0x530682['length']===0x0)return _0x2e5623[_0x4ea0('0x3a')]=!![];if(_[_0x4ea0('0x3b')](_0x530682,[_0x4ea0('0x3c'),_0x2e5623[_0x4ea0('0x3d')][_0x4ea0('0x3e')]()]))return _0x2e5623['talking']=!![];if(!_0x2e5623[_0x4ea0('0x21')])return _0x2e5623[_0x4ea0('0x3a')]=!![];}function getVoiceQueueAgents(_0x425030,_0x4add0c,_0x2a6a9e,_0x19ccf5){var _0x5b859b=_[_0x4ea0('0x35')](_0x4add0c,['id',_0x425030['id']]);if(!_0x5b859b)return _0x425030;return _0x5b859b[_0x4ea0('0x3f')]({'raw':!![]})[_0x4ea0('0x17')](function(_0xef345b){for(var _0x31c6f4=0x0;_0x31c6f4<_0xef345b[_0x4ea0('0x40')];_0x31c6f4++){var _0x2b5b41=_[_0x4ea0('0x35')](_0x2a6a9e,['id',_0xef345b[_0x31c6f4][_0x4ea0('0x41')]]);if(!_0x2b5b41){_0x2b5b41={'id':_0xef345b[_0x31c6f4]['UserId'],'name':_0xef345b[_0x31c6f4][_0x4ea0('0x41')],'accountcode':'','online':![]};}var _0x53cefc={'id':_0x2b5b41['id'],'name':_0x2b5b41[_0x4ea0('0x12')],'internal':_0x2b5b41[_0x4ea0('0x42')],'online':Boolean(_0x2b5b41[_0x4ea0('0x43')]),'paused':Boolean(_0xef345b[_0x31c6f4][_0x4ea0('0x22')])};if(_0x2b5b41[_0x4ea0('0x44')]==='talking')updateAgentVoiceStatus(_0x53cefc,_0x425030,_0x19ccf5);if(_0x53cefc[_0x4ea0('0x43')])_0x425030['loggedInDb']++;if(_0x53cefc[_0x4ea0('0x3a')])_0x425030[_0x4ea0('0x3a')]++;if(_0x53cefc[_0x4ea0('0x22')]&&!_0x53cefc['busy']&&!_0x53cefc[_0x4ea0('0x21')])_0x425030[_0x4ea0('0x22')]++;_0x425030[_0x4ea0('0x45')][_0x4ea0('0x46')](_0x53cefc);}return _0x425030;});}function getQueueAgents(_0x328340,_0x494d80,_0x154e38){var _0x1755d3='User'+_[_0x4ea0('0x47')](_0x154e38)+_0x4ea0('0x48');var _0x2926ad=_0x154e38+_0x4ea0('0x49');return db[_0x1755d3]['findAll']({'where':{[_[_0x4ea0('0x47')](_0x154e38)+'QueueId']:_0x328340['id']},'raw':!![]})[_0x4ea0('0x17')](function(_0x3f1484){for(var _0x52f955=0x0;_0x52f955<_0x3f1484[_0x4ea0('0x40')];_0x52f955++){var _0x57c90f=_[_0x4ea0('0x35')](_0x494d80,['id',_0x3f1484[_0x52f955][_0x4ea0('0x41')]]);if(!_0x57c90f){_0x57c90f={'id':_0x3f1484[_0x52f955][_0x4ea0('0x41')],'name':_0x3f1484[_0x52f955]['UserId'],'online':![],['pauseField']:![]};}var _0x3fa9d9={'id':_0x57c90f['id'],'name':_0x57c90f['name'],'online':Boolean(_0x57c90f[_0x4ea0('0x43')]),'paused':Boolean(_0x57c90f[_0x2926ad])};if(_0x3fa9d9[_0x4ea0('0x43')])_0x328340[_0x4ea0('0x4a')]++;_0x328340[_0x4ea0('0x45')]['push'](_0x3fa9d9);}return _0x328340;});}function validateChannel(_0x4ec594){var _0x37bb8e=utils[_0x4ea0('0x4b')]();if(!_[_0x4ea0('0x4c')](_0x37bb8e,_0x4ec594[_0x4ea0('0x4d')]()))throw new Error('Invalid\x20channel');return _0x4ec594[_0x4ea0('0x4d')]();}exports[_0x4ea0('0x4e')]=function(_0x1ea5c4,_0x293e30){var _0x1e1176={'count':0x0,'rows':[]};var _0x2952fa={};var _0x34f995;var _0x4d6670;var _0x42dc60;var _0x6e5c61;var _0x23e45a=utils['getChannels']();var _0x48fdf1=_0x1ea5c4[_0x4ea0('0x4f')][_0x4ea0('0x50')];var _0x327f3c=_0x1ea5c4[_0x4ea0('0x4f')][_0x4ea0('0x51')];var _0x484212=_0x1ea5c4[_0x4ea0('0x4f')][_0x4ea0('0x52')];var _0x366415=_0x327f3c==='pause'||_0x327f3c===_0x4ea0('0x53')?!![]:![];var _0x13cc63=[];var _0x2e29ed;Promise[_0x4ea0('0x54')]()['then'](function(){if(_0x1ea5c4[_0x4ea0('0x4f')][_0x4ea0('0x55')]){_0x34f995=validateChannel(_0x1ea5c4['query'][_0x4ea0('0x55')]);}if(!_0x1ea5c4['query'][_0x4ea0('0x56')]||!_0x1ea5c4[_0x4ea0('0x4f')][_0x4ea0('0x56')][_0x4ea0('0x4c')](_0x4ea0('0x57'))){_0x1ea5c4['query'][_0x4ea0('0x56')]=rta[_0x4ea0('0x58')](_0x1ea5c4['query'][_0x4ea0('0x56')]);return;}var _0x534359=rta['getUpdatedSortOptions'](_0x1ea5c4['query'][_0x4ea0('0x56')]);_0x1ea5c4[_0x4ea0('0x4f')][_0x4ea0('0x56')]=_0x534359[_0x4ea0('0x59')][_0x4ea0('0x5a')](',');_0x4d6670=_0x534359[_0x4ea0('0x5b')];})[_0x4ea0('0x17')](function(){if(!_0x48fdf1){return[];}return rta[_0x4ea0('0x5c')](_0x48fdf1,_0x34f995);})['then'](function(_0x14fcc5){_0x13cc63=_0x14fcc5;return rta[_0x4ea0('0x5d')]();})[_0x4ea0('0x17')](function(_0x162640){_0x6e5c61=_0x162640[_0x4ea0('0x5e')];if((!_0x327f3c||_0x366415)&&!_0x4d6670){return _0x13cc63;}if(_0x4d6670&&!_0x327f3c){return rta[_0x4ea0('0x5f')](_0x6e5c61,_0x13cc63,_0x4d6670);}else{return rta[_0x4ea0('0x60')](_0x6e5c61,_0x13cc63,_0x327f3c);}})[_0x4ea0('0x17')](function(_0x61ce3d){_0x13cc63=_0x61ce3d;var _0x2d6677=![];if(_0x13cc63[_0x4ea0('0x40')]===0x0){if(_0x48fdf1||_0x327f3c){_0x2d6677=!![];}if(_0x366415){_0x2d6677=![];}}if(_0x2d6677){return _0x1e1176;}var _0x4b2842=_[_0x4ea0('0x31')](db['User'][_0x4ea0('0x61')],function(_0x3d4bd){return{'name':_0x3d4bd['fieldName'],'type':_0x3d4bd[_0x4ea0('0x62')][_0x4ea0('0x63')]};});_0x1ea5c4[_0x4ea0('0x4f')]['role']=_0x4ea0('0x64');_0x1ea5c4[_0x4ea0('0x4f')]['online']=!![];_0x2952fa=qs['getOptions'](_0x4b2842,_0x1ea5c4);_0x2952fa[_0x4ea0('0x65')]=!![];var _0x4f398e=[];if(_0x13cc63[_0x4ea0('0x40')]>0x0){_0x4f398e['push']({'id':{'$in':_0x13cc63}});if(_0x4d6670&&!_0x327f3c){_0x2e29ed=[db[_0x4ea0('0x66')][_0x4ea0('0x67')]('FIELD(id,'+_0x13cc63+')')];_0x2952fa[_0x4ea0('0x5b')]=_0x2e29ed;}}if(_0x366415){_0x23e45a[_0x4ea0('0x68')](function(_0x57d1ab){var _0x3dc95a=!![];if(_0x327f3c==='*pause'&&_0x34f995!==_0x57d1ab){_0x3dc95a=![];}_0x4f398e['push']({[_0x57d1ab+'Pause']:_0x3dc95a});});if(_0x484212){_0x4f398e[_0x4ea0('0x46')]({'pauseType':_0x484212});}}else if(_0x327f3c){_0x23e45a[_0x4ea0('0x68')](function(_0x280895){_0x4f398e[_0x4ea0('0x46')]({[_0x280895+'Pause']:![]});});}_0x2952fa[_0x4ea0('0x69')]=_[_0x4ea0('0x36')](_0x2952fa[_0x4ea0('0x69')],{'$and':_0x4f398e});if(_0x1ea5c4['user'][_0x4ea0('0x6a')]===_0x4ea0('0x6b')){var _0x145334={'params':{'id':_0x1ea5c4[_0x4ea0('0x6b')][_0x4ea0('0x6c')]},'query':{'section':'Agents','role':_0x4ea0('0x64'),'online':!![],'raw':!![],'ids':_0x13cc63,'customSorting':_0x2e29ed}};if(_0x366415){_0x145334[_0x4ea0('0x4f')][_0x4ea0('0x6d')]=_0x4f398e;}_0x145334['query']=Object[_0x4ea0('0x6e')](_0x145334[_0x4ea0('0x4f')],_0x1ea5c4[_0x4ea0('0x4f')]);delete _0x145334[_0x4ea0('0x4f')]['id'];return db[_0x4ea0('0x6f')]['getResources'](_0x145334);}return db[_0x4ea0('0x70')][_0x4ea0('0x71')](_0x2952fa);})[_0x4ea0('0x17')](function(_0x3a0afb){_0x1e1176[_0x4ea0('0xb')]=_0x3a0afb[_0x4ea0('0xb')];_0x42dc60=_0x3a0afb[_0x4ea0('0x5e')];return _0x42dc60['map'](function(_0x5a540b){var _0x400b1e=_[_0x4ea0('0x35')](_0x6e5c61,['id',_0x5a540b['id']]);if(_0x400b1e){var _0x2d9f90=rta[_0x4ea0('0x72')](_0x400b1e);_[_0x4ea0('0x36')](_0x5a540b,_0x2d9f90);}_0x5a540b[_0x4ea0('0x57')]=rta[_0x4ea0('0x73')](_0x5a540b);if(_0x5a540b['globalStatus'][_0x4ea0('0x4c')]('pause')){_0x23e45a['forEach'](function(_0x498c05){if(_0x5a540b[_0x498c05+'Pause']){_0x5a540b[_0x498c05+'Status']=_0x4ea0('0x74');}});}return _0x5a540b;});})['then'](function(_0x4b80c1){if(!_0x4d6670||_0x2e29ed){return _0x4b80c1;}return rta[_0x4ea0('0x75')](_0x4b80c1,_0x4d6670);})['then'](function(_0x32f2e6){_0x1e1176[_0x4ea0('0x5e')]=_0x32f2e6;return _0x1e1176;})[_0x4ea0('0x17')](respondWithFilteredResult(_0x293e30,_0x2952fa))[_0x4ea0('0x1d')](handleError(_0x293e30,null));};exports[_0x4ea0('0x76')]=function(_0x5a3406,_0x31464a){var _0x5d24de={'count':0x0,'rows':[]},_0x322bc6={},_0x26b807,_0x278d41,_0x18b563,_0x155173,_0x46bbb0;Promise[_0x4ea0('0x54')]()[_0x4ea0('0x17')](function(){if(_0x5a3406['query'][_0x4ea0('0x55')])_0x26b807=validateChannel(_0x5a3406[_0x4ea0('0x4f')][_0x4ea0('0x55')]);var _0x5be858=_[_0x4ea0('0x47')](_0x26b807)+_0x4ea0('0x48');var _0x408448=_['map'](db[_0x5be858][_0x4ea0('0x61')],function(_0x81403f){return{'name':_0x81403f[_0x4ea0('0x77')],'type':_0x81403f[_0x4ea0('0x62')][_0x4ea0('0x63')]};});_0x322bc6=qs[_0x4ea0('0x78')](_0x408448,_0x5a3406);if(_0x5a3406[_0x4ea0('0x6b')][_0x4ea0('0x6a')]===_0x4ea0('0x6b')){var _0x455f90={'params':{'id':_0x5a3406['user'][_0x4ea0('0x6c')]},'query':{'section':_0x26b807===_0x4ea0('0x32')&&_0x5a3406['query']['type']===_0x4ea0('0x23')?'QueueCampaigns':_[_0x4ea0('0x47')](_0x26b807)+'Queues','type':_0x5a3406['query'][_0x4ea0('0x62')],'nolimit':!![],'sort':_0x4ea0('0x12'),'filter':_0x5a3406[_0x4ea0('0x4f')][_0x4ea0('0x38')]}};return db[_0x4ea0('0x6f')][_0x4ea0('0x79')](_0x455f90);}return db[_0x5be858][_0x4ea0('0x71')](_0x322bc6);})['then'](function(_0x4433ce){_0x5d24de[_0x4ea0('0xb')]=_0x4433ce[_0x4ea0('0xb')];_0x278d41=_0x4433ce[_0x4ea0('0x5e')];return getRealtimeQueues(_0x5a3406,_0x26b807);})[_0x4ea0('0x17')](function(_0x51e82c){_0x155173=_0x51e82c[_0x4ea0('0x5e')];return rta[_0x4ea0('0x5d')]();})[_0x4ea0('0x17')](function(_0x2943ee){_0x18b563=_0x2943ee[_0x4ea0('0x5e')];if(_0x26b807!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x4ea0('0x17')](function(_0xb2d7c1){_0x46bbb0=_0xb2d7c1?_0xb2d7c1[_0x4ea0('0x5e')]:[];return initializeQueues(_0x278d41,_0x155173,_0x26b807,_0x5a3406[_0x4ea0('0x4f')]['type']);})[_0x4ea0('0x17')](function(_0x1cebe4){var _0x282d18=_0x1cebe4['map'](function(_0x165432){if(_0x26b807===_0x4ea0('0x32'))return getVoiceQueueAgents(_0x165432,_0x278d41,_0x18b563,_0x46bbb0);else return getQueueAgents(_0x165432,_0x18b563,_0x26b807);});return Promise[_0x4ea0('0x7a')](_0x282d18);})[_0x4ea0('0x17')](function(_0x34a7f3){_0x5d24de[_0x4ea0('0x5e')]=_0x34a7f3;return _0x5d24de;})[_0x4ea0('0x17')](respondWithFilteredResult(_0x31464a,_0x322bc6))['catch'](handleError(_0x31464a,null));}; \ No newline at end of file +var _0x8541=['validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','map','fieldName','key','role','agent','getOptions','sequelize','literal','forEach','Pause','where','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','rows','getAgentStatus','Status','sortAgentsByStatus','getQueues','resolve','rawAttributes','type','QueueCampaigns','UserProfile','all','util','lodash','../../components/parsers/qs','../../config/utils','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','name','send','voice','request','startCase','Queues','then','catch','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','result','waiting','paused','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','agents','loggedInDb','loggedIn','talking','busy','outbound','find','merge','pick','queue','length','some','internal','toString','UserId','online','User','Queue','findAll','push','includes','Invalid\x20channel','toLowerCase','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','channel','sort','globalStatus'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x8541,0x9e));var _0x1854=function(_0x5b44f8,_0x4972e3){_0x5b44f8=_0x5b44f8-0x0;var _0x2483e0=_0x8541[_0x5b44f8];return _0x2483e0;};'use strict';var util=require(_0x1854('0x0'));var _=require(_0x1854('0x1'));var jayson=require('jayson/promise');var rta=require('../../components/realtime/agents');var qs=require(_0x1854('0x2'));var utils=require(_0x1854('0x3'));var logger=require(_0x1854('0x4'))(_0x1854('0x5'));var db=require(_0x1854('0x6'))['db'];var amiClient=jayson[_0x1854('0x7')][_0x1854('0x8')]({'port':0x232a});var routingClient=jayson['client'][_0x1854('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x36bad1,_0x477042){return function(_0x49dc4e){if(_0x49dc4e){var _0x3bcb3a=typeof _0x477042[_0x1854('0x9')]===_0x1854('0xa')&&typeof _0x477042[_0x1854('0xb')]==='undefined';var _0x10684d=_0x49dc4e[_0x1854('0xc')];var _0x1bc922=_0x3bcb3a?0x0:_0x477042[_0x1854('0x9')];var _0x4efc8e=_0x3bcb3a?_0x49dc4e['count']:_0x477042[_0x1854('0x9')]+_0x477042[_0x1854('0xb')];var _0x46e665;if(_0x4efc8e>=_0x10684d){_0x4efc8e=_0x10684d;_0x46e665=0xc8;}else{_0x46e665=0xce;}_0x36bad1[_0x1854('0xd')](_0x46e665);return _0x36bad1[_0x1854('0xe')](_0x1854('0xf'),_0x1bc922+'-'+_0x4efc8e+'/'+_0x10684d)[_0x1854('0x10')](_0x49dc4e);}return null;};}function handleError(_0x3b928e,_0x2dc6fb){_0x2dc6fb=_0x2dc6fb||0x1f4;return function(_0x31ead2){logger['error'](_0x31ead2['stack']);if(_0x31ead2[_0x1854('0x11')]){delete _0x31ead2[_0x1854('0x11')];}_0x3b928e[_0x1854('0xd')](_0x2dc6fb)[_0x1854('0x12')](_0x31ead2);};}function getRealtimeQueues(_0x43f1dd,_0x46cb2e){return new Promise(function(_0x33cb82,_0x4ae798){var _0x4e7d9d=_0x46cb2e===_0x1854('0x13')?amiClient:routingClient;return _0x4e7d9d[_0x1854('0x14')](_[_0x1854('0x15')](_0x46cb2e)+_0x1854('0x16'),_0x43f1dd)[_0x1854('0x17')](function(_0x1c8303){if(_0x1c8303['error'])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x46cb2e));return _0x33cb82(_0x1c8303['result']);})[_0x1854('0x18')](function(_0x39b322){_0x4ae798(_0x39b322);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x221ff0,_0x3bf681){return amiClient[_0x1854('0x14')]('VoiceQueuesChannels',{})[_0x1854('0x17')](function(_0x1ad4f9){if(_0x1ad4f9['error'])throw new Error(_0x1854('0x19'));return _0x221ff0(_0x1ad4f9[_0x1854('0x1a')]);})[_0x1854('0x18')](function(_0x1a1647){_0x3bf681(_0x1a1647);});});}function initializeQueues(_0x48415e,_0x54ec3c,_0x46ab21,_0x1af846){var _0x58a5cc=['loggedIn','available',_0x1854('0x1b'),'talking',_0x1854('0x1c')];if(_0x46ab21===_0x1854('0x13')&&_0x1af846==='outbound'){_0x58a5cc['push'](_0x1854('0x1d'),_0x1854('0x1e'),_0x1854('0x1f'),_0x1854('0x20'),_0x1854('0x21'),_0x1854('0x22'),_0x1854('0x23'),_0x1854('0x24'),_0x1854('0x25'),_0x1854('0x26'),_0x1854('0x27'),_0x1854('0x28'),_0x1854('0x29'),_0x1854('0x2a'),_0x1854('0x2b'),_0x1854('0x2c'),_0x1854('0x2d'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x1854('0x2e'),_0x1854('0x2f'),_0x1854('0x30'));}return _0x48415e['map'](function(_0x714865){var _0x97cb79=_0x714865[_0x1854('0x31')]({'plain':!![]});_0x97cb79[_0x1854('0x32')]=[];_0x97cb79[_0x1854('0x1c')]=0x0;_0x97cb79[_0x1854('0x33')]=0x0;_0x97cb79[_0x1854('0x34')]=0x0;_0x97cb79['available']=0x0;_0x97cb79[_0x1854('0x1b')]=0x0;if(_0x46ab21==='voice'){_0x97cb79[_0x1854('0x35')]=0x0;_0x97cb79[_0x1854('0x36')]=0x0;if(_0x1af846===_0x1854('0x37')){_0x97cb79[_0x1854('0x1d')]=0x0;_0x97cb79['originated']=0x0;}}var _0x226f2a=_[_0x1854('0x38')](_0x54ec3c,['id',_0x97cb79['id']]);if(_0x226f2a)_[_0x1854('0x39')](_0x97cb79,_[_0x1854('0x3a')](_0x226f2a,_0x58a5cc));return _0x97cb79;});}function updateAgentVoiceStatus(_0x2d942a,_0x355c5c,_0x376f9c){var _0x43152a=_['filter'](_0x376f9c,[_0x1854('0x3b'),_0x355c5c['name']]);if(_0x43152a[_0x1854('0x3c')]===0x0)return _0x2d942a[_0x1854('0x36')]=!![];if(_[_0x1854('0x3d')](_0x43152a,['connectedlinenum',_0x2d942a[_0x1854('0x3e')][_0x1854('0x3f')]()]))return _0x2d942a[_0x1854('0x35')]=!![];if(!_0x2d942a[_0x1854('0x35')])return _0x2d942a['busy']=!![];}function getVoiceQueueAgents(_0x16ffc2,_0x46ae8d,_0xbdc8c9,_0x5d37ad){var _0x451f85=_[_0x1854('0x38')](_0x46ae8d,['id',_0x16ffc2['id']]);if(!_0x451f85)return _0x16ffc2;return _0x451f85['getMembers']({'raw':!![]})[_0x1854('0x17')](function(_0x1f0728){for(var _0x584376=0x0;_0x584376<_0x1f0728[_0x1854('0x3c')];_0x584376++){var _0x5e6270=_[_0x1854('0x38')](_0xbdc8c9,['id',_0x1f0728[_0x584376][_0x1854('0x40')]]);if(!_0x5e6270){_0x5e6270={'id':_0x1f0728[_0x584376][_0x1854('0x40')],'name':_0x1f0728[_0x584376][_0x1854('0x40')],'accountcode':'','online':![]};}var _0x2cbcb5={'id':_0x5e6270['id'],'name':_0x5e6270[_0x1854('0x11')],'internal':_0x5e6270['accountcode'],'online':Boolean(_0x5e6270[_0x1854('0x41')]),'paused':Boolean(_0x1f0728[_0x584376][_0x1854('0x1c')])};if(_0x5e6270['voiceStatus']===_0x1854('0x35'))updateAgentVoiceStatus(_0x2cbcb5,_0x16ffc2,_0x5d37ad);if(_0x2cbcb5[_0x1854('0x41')])_0x16ffc2[_0x1854('0x33')]++;if(_0x2cbcb5[_0x1854('0x36')])_0x16ffc2[_0x1854('0x36')]++;if(_0x2cbcb5[_0x1854('0x1c')]&&!_0x2cbcb5[_0x1854('0x36')]&&!_0x2cbcb5[_0x1854('0x35')])_0x16ffc2['paused']++;_0x16ffc2[_0x1854('0x32')]['push'](_0x2cbcb5);}return _0x16ffc2;});}function getQueueAgents(_0x165ce0,_0x3a0f32,_0x1049d5){var _0x391752=_0x1854('0x42')+_[_0x1854('0x15')](_0x1049d5)+_0x1854('0x43');var _0x4b6f47=_0x1049d5+'Pause';return db[_0x391752][_0x1854('0x44')]({'where':{[_[_0x1854('0x15')](_0x1049d5)+'QueueId']:_0x165ce0['id']},'raw':!![]})['then'](function(_0x40dae0){for(var _0x1b5b7c=0x0;_0x1b5b7c<_0x40dae0[_0x1854('0x3c')];_0x1b5b7c++){var _0x55c053=_[_0x1854('0x38')](_0x3a0f32,['id',_0x40dae0[_0x1b5b7c][_0x1854('0x40')]]);if(!_0x55c053){_0x55c053={'id':_0x40dae0[_0x1b5b7c][_0x1854('0x40')],'name':_0x40dae0[_0x1b5b7c][_0x1854('0x40')],'online':![],['pauseField']:![]};}var _0x3193b6={'id':_0x55c053['id'],'name':_0x55c053[_0x1854('0x11')],'online':Boolean(_0x55c053[_0x1854('0x41')]),'paused':Boolean(_0x55c053[_0x4b6f47])};if(_0x3193b6[_0x1854('0x41')])_0x165ce0[_0x1854('0x33')]++;_0x165ce0['agents'][_0x1854('0x45')](_0x3193b6);}return _0x165ce0;});}function validateChannel(_0x58552f){var _0xb428f7=utils['getChannels']();if(!_[_0x1854('0x46')](_0xb428f7,_0x58552f['toLowerCase']()))throw new Error(_0x1854('0x47'));return _0x58552f[_0x1854('0x48')]();}exports[_0x1854('0x49')]=function(_0x1cb758,_0x14e23e){var _0x4cbd49={'count':0x0,'rows':[]};var _0x40bd4e={};var _0x2dcac5;var _0x35490b;var _0x3e184a;var _0x25e818;var _0x2dbcf7=utils[_0x1854('0x4a')]();var _0x5514c4=_0x1cb758[_0x1854('0x4b')][_0x1854('0x4c')];var _0x472c21=_0x1cb758[_0x1854('0x4b')][_0x1854('0x4d')];var _0x13e1fb=_0x1cb758[_0x1854('0x4b')][_0x1854('0x4e')];var _0x276f83=_0x472c21===_0x1854('0x4f')||_0x472c21===_0x1854('0x50')?!![]:![];var _0x3b79bc=[];var _0x2c1efe;Promise['resolve']()['then'](function(){if(_0x1cb758['query']['channel']){_0x2dcac5=validateChannel(_0x1cb758[_0x1854('0x4b')][_0x1854('0x51')]);}if(!_0x1cb758[_0x1854('0x4b')][_0x1854('0x52')]||!_0x1cb758[_0x1854('0x4b')]['sort']['includes'](_0x1854('0x53'))){_0x1cb758[_0x1854('0x4b')][_0x1854('0x52')]=rta[_0x1854('0x54')](_0x1cb758[_0x1854('0x4b')][_0x1854('0x52')]);return;}var _0xfcb14f=rta[_0x1854('0x55')](_0x1cb758[_0x1854('0x4b')][_0x1854('0x52')]);_0x1cb758[_0x1854('0x4b')][_0x1854('0x52')]=_0xfcb14f[_0x1854('0x56')][_0x1854('0x57')](',');_0x35490b=_0xfcb14f[_0x1854('0x58')];})[_0x1854('0x17')](function(){if(!_0x5514c4){return[];}return rta[_0x1854('0x59')](_0x5514c4,_0x2dcac5);})[_0x1854('0x17')](function(_0x347426){_0x3b79bc=_0x347426;return rta[_0x1854('0x5a')]();})[_0x1854('0x17')](function(_0x2edde0){_0x25e818=_0x2edde0['rows'];if((!_0x472c21||_0x276f83)&&!_0x35490b){return _0x3b79bc;}if(_0x35490b&&!_0x472c21){return rta[_0x1854('0x5b')](_0x25e818,_0x3b79bc,_0x35490b);}else{return rta['getAgentIdsByStatus'](_0x25e818,_0x3b79bc,_0x472c21);}})[_0x1854('0x17')](function(_0x270816){_0x3b79bc=_0x270816;var _0x5691ba=![];if(_0x3b79bc[_0x1854('0x3c')]===0x0){if(_0x5514c4||_0x472c21){_0x5691ba=!![];}if(_0x276f83){_0x5691ba=![];}}if(_0x5691ba){return _0x4cbd49;}var _0xce4a82=_[_0x1854('0x5c')](db[_0x1854('0x42')]['rawAttributes'],function(_0x50297e){return{'name':_0x50297e[_0x1854('0x5d')],'type':_0x50297e['type'][_0x1854('0x5e')]};});_0x1cb758[_0x1854('0x4b')][_0x1854('0x5f')]=_0x1854('0x60');_0x1cb758[_0x1854('0x4b')][_0x1854('0x41')]=!![];_0x40bd4e=qs[_0x1854('0x61')](_0xce4a82,_0x1cb758);_0x40bd4e['raw']=!![];var _0x584f0b=[];if(_0x3b79bc[_0x1854('0x3c')]>0x0){_0x584f0b[_0x1854('0x45')]({'id':{'$in':_0x3b79bc}});if(_0x35490b&&!_0x472c21){_0x2c1efe=[db[_0x1854('0x62')][_0x1854('0x63')]('FIELD(id,'+_0x3b79bc+')')];_0x40bd4e[_0x1854('0x58')]=_0x2c1efe;}}if(_0x276f83){_0x2dbcf7[_0x1854('0x64')](function(_0x72ee71){var _0x38c4bc=!![];if(_0x472c21===_0x1854('0x50')&&_0x2dcac5!==_0x72ee71){_0x38c4bc=![];}_0x584f0b[_0x1854('0x45')]({[_0x72ee71+_0x1854('0x65')]:_0x38c4bc});});if(_0x13e1fb){_0x584f0b['push']({'pauseType':_0x13e1fb});}}else if(_0x472c21){_0x2dbcf7[_0x1854('0x64')](function(_0x2e7a4c){_0x584f0b[_0x1854('0x45')]({[_0x2e7a4c+_0x1854('0x65')]:![]});});}_0x40bd4e[_0x1854('0x66')]=_[_0x1854('0x39')](_0x40bd4e[_0x1854('0x66')],{'$and':_0x584f0b});if(_0x1cb758[_0x1854('0x67')]['role']===_0x1854('0x67')){var _0x196267={'params':{'id':_0x1cb758['user'][_0x1854('0x68')]},'query':{'section':_0x1854('0x69'),'role':_0x1854('0x60'),'online':!![],'raw':!![],'ids':_0x3b79bc,'customSorting':_0x2c1efe}};if(_0x276f83){_0x196267[_0x1854('0x4b')][_0x1854('0x6a')]=_0x584f0b;}_0x196267['query']=Object[_0x1854('0x6b')](_0x196267['query'],_0x1cb758[_0x1854('0x4b')]);delete _0x196267['query']['id'];return db['UserProfile'][_0x1854('0x6c')](_0x196267);}return db[_0x1854('0x42')][_0x1854('0x6d')](_0x40bd4e);})[_0x1854('0x17')](function(_0x63342b){_0x4cbd49['count']=_0x63342b[_0x1854('0xc')];_0x3e184a=_0x63342b[_0x1854('0x6e')];return _0x3e184a[_0x1854('0x5c')](function(_0x5e06c1){var _0x3ca969=_[_0x1854('0x38')](_0x25e818,['id',_0x5e06c1['id']]);if(_0x3ca969){var _0x29b8a6=rta['filterAgentAttributes'](_0x3ca969);_[_0x1854('0x39')](_0x5e06c1,_0x29b8a6);}_0x5e06c1['globalStatus']=rta[_0x1854('0x6f')](_0x5e06c1);if(_0x5e06c1[_0x1854('0x53')][_0x1854('0x46')](_0x1854('0x4f'))){_0x2dbcf7[_0x1854('0x64')](function(_0x512f6c){if(_0x5e06c1[_0x512f6c+'Pause']){_0x5e06c1[_0x512f6c+_0x1854('0x70')]='pause';}});}return _0x5e06c1;});})[_0x1854('0x17')](function(_0x3d37e6){if(!_0x35490b||_0x2c1efe){return _0x3d37e6;}return rta[_0x1854('0x71')](_0x3d37e6,_0x35490b);})[_0x1854('0x17')](function(_0x354aa6){_0x4cbd49[_0x1854('0x6e')]=_0x354aa6;return _0x4cbd49;})[_0x1854('0x17')](respondWithFilteredResult(_0x14e23e,_0x40bd4e))[_0x1854('0x18')](handleError(_0x14e23e,null));};exports[_0x1854('0x72')]=function(_0x1cf078,_0x1baeb4){var _0x4888a0={'count':0x0,'rows':[]},_0x1fa8d6={},_0x39fc38,_0x277f3a,_0x8c6289,_0xfe5a81,_0x51de46;Promise[_0x1854('0x73')]()[_0x1854('0x17')](function(){if(_0x1cf078[_0x1854('0x4b')][_0x1854('0x51')])_0x39fc38=validateChannel(_0x1cf078[_0x1854('0x4b')][_0x1854('0x51')]);var _0x5ddf9e=_[_0x1854('0x15')](_0x39fc38)+_0x1854('0x43');var _0x4aa6af=_[_0x1854('0x5c')](db[_0x5ddf9e][_0x1854('0x74')],function(_0x439548){return{'name':_0x439548['fieldName'],'type':_0x439548[_0x1854('0x75')]['key']};});_0x1fa8d6=qs[_0x1854('0x61')](_0x4aa6af,_0x1cf078);if(_0x1cf078[_0x1854('0x67')][_0x1854('0x5f')]===_0x1854('0x67')){var _0x2b0d72={'params':{'id':_0x1cf078[_0x1854('0x67')][_0x1854('0x68')]},'query':{'section':_0x39fc38==='voice'&&_0x1cf078[_0x1854('0x4b')]['type']==='outbound'?_0x1854('0x76'):_[_0x1854('0x15')](_0x39fc38)+_0x1854('0x16'),'type':_0x1cf078[_0x1854('0x4b')]['type'],'nolimit':!![],'sort':'name','filter':_0x1cf078[_0x1854('0x4b')]['filter']}};return db[_0x1854('0x77')][_0x1854('0x6c')](_0x2b0d72);}return db[_0x5ddf9e][_0x1854('0x6d')](_0x1fa8d6);})[_0x1854('0x17')](function(_0x1f44a5){_0x4888a0[_0x1854('0xc')]=_0x1f44a5[_0x1854('0xc')];_0x277f3a=_0x1f44a5['rows'];return getRealtimeQueues(_0x1cf078,_0x39fc38);})[_0x1854('0x17')](function(_0x148d9b){_0xfe5a81=_0x148d9b['rows'];return rta[_0x1854('0x5a')]();})[_0x1854('0x17')](function(_0x2e3680){_0x8c6289=_0x2e3680[_0x1854('0x6e')];if(_0x39fc38!=_0x1854('0x13'))return;return getRealtimeVoiceQueueChannels();})[_0x1854('0x17')](function(_0x1a1ad2){_0x51de46=_0x1a1ad2?_0x1a1ad2[_0x1854('0x6e')]:[];return initializeQueues(_0x277f3a,_0xfe5a81,_0x39fc38,_0x1cf078[_0x1854('0x4b')][_0x1854('0x75')]);})[_0x1854('0x17')](function(_0x4b8090){var _0x582b79=_0x4b8090[_0x1854('0x5c')](function(_0x37c8d3){if(_0x39fc38===_0x1854('0x13'))return getVoiceQueueAgents(_0x37c8d3,_0x277f3a,_0x8c6289,_0x51de46);else return getQueueAgents(_0x37c8d3,_0x8c6289,_0x39fc38);});return Promise[_0x1854('0x78')](_0x582b79);})[_0x1854('0x17')](function(_0x402fd3){_0x4888a0[_0x1854('0x6e')]=_0x402fd3;return _0x4888a0;})[_0x1854('0x17')](respondWithFilteredResult(_0x1baeb4,_0x1fa8d6))['catch'](handleError(_0x1baeb4,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index e71e2b4..7f8c2e9 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2c0931,_0x503573){var _0x3d781f=function(_0x3f84ac){while(--_0x3f84ac){_0x2c0931['push'](_0x2c0931['shift']());}};_0x3d781f(++_0x503573);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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(_0x45ff81,_0x3cb624){var _0x1abf39=function(_0x118836){while(--_0x118836){_0x45ff81['push'](_0x45ff81['shift']());}};_0x1abf39(++_0x3cb624);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 4c78eb2..8eff2ef 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 _0x2e88=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0xc2dde6,_0x1cccc9){var _0x9fc29c=function(_0x54ba28){while(--_0x54ba28){_0xc2dde6['push'](_0xc2dde6['shift']());}};_0x9fc29c(++_0x1cccc9);}(_0x2e88,0x95));var _0x82e8=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0x2e88[_0x8af54b];return _0x27d8f0;};'use strict';var Sequelize=require(_0x82e8('0x0'));module[_0x82e8('0x1')]={'state':{'type':Sequelize[_0x82e8('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x82e8('0x3')]},'scheduledat':{'type':Sequelize[_0x82e8('0x4')]},'uniqueid':{'type':Sequelize[_0x82e8('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x82e8('0x4')]},'ringtime':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x82e8('0x3')]},'membername':{'type':Sequelize[_0x82e8('0x3')]}}; \ No newline at end of file +var _0x8085=['STRING','DATE','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8085,0x71));var _0x5808=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x8085[_0x313c96];return _0x522f53;};'use strict';var Sequelize=require(_0x5808('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5808('0x1')]},'scheduledat':{'type':Sequelize[_0x5808('0x2')]},'uniqueid':{'type':Sequelize[_0x5808('0x1')]},'starttime':{'type':Sequelize[_0x5808('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5808('0x1')]},'campaigntype':{'type':Sequelize[_0x5808('0x1')]},'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 febded0..40962bd 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 _0x40f0=['api','moment','bluebird','request-promise','path','rimraf','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x4f7bd5,_0x5dc0ad){var _0x4a7c11=function(_0x589f16){while(--_0x589f16){_0x4f7bd5['push'](_0x4f7bd5['shift']());}};_0x4a7c11(++_0x5dc0ad);}(_0x40f0,0xd5));var _0x040f=function(_0x34885c,_0x5241ab){_0x34885c=_0x34885c-0x0;var _0x2381e1=_0x40f0[_0x34885c];return _0x2381e1;};'use strict';var _=require(_0x040f('0x0'));var util=require(_0x040f('0x1'));var logger=require(_0x040f('0x2'))(_0x040f('0x3'));var moment=require(_0x040f('0x4'));var BPromise=require(_0x040f('0x5'));var rp=require(_0x040f('0x6'));var fs=require('fs');var path=require(_0x040f('0x7'));var rimraf=require(_0x040f('0x8'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x8df3f6,_0x377732){return _0x8df3f6[_0x040f('0x9')](_0x040f('0xa'),attributes,{'tableName':_0x040f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5106=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','report_agent_preview','lodash'];(function(_0x3876f9,_0x30a8f4){var _0x5797ce=function(_0x18278e){while(--_0x18278e){_0x3876f9['push'](_0x3876f9['shift']());}};_0x5797ce(++_0x30a8f4);}(_0x5106,0x197));var _0x6510=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5106[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6510('0x0'));var util=require(_0x6510('0x1'));var logger=require(_0x6510('0x2'))(_0x6510('0x3'));var moment=require(_0x6510('0x4'));var BPromise=require(_0x6510('0x5'));var rp=require(_0x6510('0x6'));var fs=require('fs');var path=require(_0x6510('0x7'));var rimraf=require('rimraf');var config=require(_0x6510('0x8'));var attributes=require(_0x6510('0x9'));module[_0x6510('0xa')]=function(_0x44bc3a,_0x2d7fd4){return _0x44bc3a['define']('ReportAgentPreview',attributes,{'tableName':_0x6510('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 121b27d..c2dc3d3 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 _0xdc94=['then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ReportAgentPreview,\x20%s,\x20%s','CreateReportAgentPreview','create','body','options','raw','debug','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x18a782,_0x5a07c3){var _0x23732d=function(_0x1d390e){while(--_0x1d390e){_0x18a782['push'](_0x18a782['shift']());}};_0x23732d(++_0x5a07c3);}(_0xdc94,0x16f));var _0x4dc9=function(_0x3fa996,_0x357d29){_0x3fa996=_0x3fa996-0x0;var _0x8f48da=_0xdc94[_0x3fa996];return _0x8f48da;};'use strict';var _=require('lodash');var util=require(_0x4dc9('0x0'));var moment=require('moment');var BPromise=require(_0x4dc9('0x1'));var rs=require(_0x4dc9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4dc9('0x3'));var logger=require(_0x4dc9('0x4'))(_0x4dc9('0x5'));var config=require(_0x4dc9('0x6'));var jayson=require(_0x4dc9('0x7'));var client=jayson[_0x4dc9('0x8')][_0x4dc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f255f,_0x1ab036,_0xd942){return new BPromise(function(_0x5f50a8,_0x15cad8){return client[_0x4dc9('0xa')](_0x5f255f,_0xd942)[_0x4dc9('0xb')](function(_0x567fb8){logger[_0x4dc9('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x1ab036,_0x4dc9('0xd'));logger['debug'](_0x4dc9('0xe'),_0x1ab036,_0x4dc9('0xd'),JSON[_0x4dc9('0xf')](_0x567fb8));if(_0x567fb8[_0x4dc9('0x10')]){if(_0x567fb8[_0x4dc9('0x10')]['code']===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1ab036,_0x567fb8[_0x4dc9('0x10')][_0x4dc9('0x11')]);return _0x15cad8(_0x567fb8[_0x4dc9('0x10')][_0x4dc9('0x11')]);}logger[_0x4dc9('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x1ab036,_0x567fb8['error'][_0x4dc9('0x11')]);return _0x5f50a8(_0x567fb8['error'][_0x4dc9('0x11')]);}else{logger[_0x4dc9('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x1ab036,'request\x20sent');_0x5f50a8(_0x567fb8[_0x4dc9('0x12')]['message']);}})[_0x4dc9('0x13')](function(_0x4ff920){logger['error'](_0x4dc9('0x14'),_0x1ab036,_0x4ff920);_0x15cad8(_0x4ff920);});});}exports[_0x4dc9('0x15')]=function(_0x3bfd97){var _0x44f69a=this;return new Promise(function(_0x3839ee,_0x9318e5){return db['ReportAgentPreview'][_0x4dc9('0x16')](_0x3bfd97[_0x4dc9('0x17')],{'raw':_0x3bfd97[_0x4dc9('0x18')]?_0x3bfd97[_0x4dc9('0x18')][_0x4dc9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x211033){logger[_0x4dc9('0xc')]('CreateReportAgentPreview',_0x3bfd97);logger[_0x4dc9('0x1a')]('CreateReportAgentPreview',_0x3bfd97,JSON[_0x4dc9('0xf')](_0x211033));_0x3839ee(_0x211033);})[_0x4dc9('0x13')](function(_0x21617e){logger[_0x4dc9('0x10')](_0x4dc9('0x15'),_0x21617e[_0x4dc9('0x11')],_0x3bfd97);_0x9318e5(_0x44f69a[_0x4dc9('0x10')](0x1f4,_0x21617e[_0x4dc9('0x11')]));});});}; \ No newline at end of file +var _0x5190=['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','ReportAgentPreview','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x312b8a,_0x3b75c2){var _0x3ab5f8=function(_0x466cfd){while(--_0x466cfd){_0x312b8a['push'](_0x312b8a['shift']());}};_0x3ab5f8(++_0x3b75c2);}(_0x5190,0x17a));var _0x0519=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0x5190[_0x37c07d];return _0x10dadc;};'use strict';var _=require(_0x0519('0x0'));var util=require(_0x0519('0x1'));var moment=require(_0x0519('0x2'));var BPromise=require(_0x0519('0x3'));var rs=require(_0x0519('0x4'));var fs=require('fs');var Redis=require(_0x0519('0x5'));var db=require(_0x0519('0x6'))['db'];var utils=require(_0x0519('0x7'));var logger=require('../../config/logger')(_0x0519('0x8'));var config=require('../../config/environment');var jayson=require(_0x0519('0x9'));var client=jayson[_0x0519('0xa')][_0x0519('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3759a6,_0x175252,_0x1d8b73){return new BPromise(function(_0x1fcd6a,_0x32aa2a){return client[_0x0519('0xc')](_0x3759a6,_0x1d8b73)[_0x0519('0xd')](function(_0x6e76a7){logger[_0x0519('0xe')](_0x0519('0xf'),_0x175252,_0x0519('0x10'));logger[_0x0519('0x11')](_0x0519('0x12'),_0x175252,'request\x20sent',JSON[_0x0519('0x13')](_0x6e76a7));if(_0x6e76a7['error']){if(_0x6e76a7[_0x0519('0x14')][_0x0519('0x15')]===0x1f4){logger[_0x0519('0x14')](_0x0519('0xf'),_0x175252,_0x6e76a7[_0x0519('0x14')][_0x0519('0x16')]);return _0x32aa2a(_0x6e76a7[_0x0519('0x14')][_0x0519('0x16')]);}logger[_0x0519('0x14')](_0x0519('0xf'),_0x175252,_0x6e76a7[_0x0519('0x14')][_0x0519('0x16')]);return _0x1fcd6a(_0x6e76a7[_0x0519('0x14')]['message']);}else{logger[_0x0519('0xe')](_0x0519('0xf'),_0x175252,_0x0519('0x10'));_0x1fcd6a(_0x6e76a7[_0x0519('0x17')]['message']);}})[_0x0519('0x18')](function(_0x34d892){logger[_0x0519('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x175252,_0x34d892);_0x32aa2a(_0x34d892);});});}exports[_0x0519('0x19')]=function(_0x2ceb4d){var _0x59e454=this;return new Promise(function(_0x6bb44,_0x39d9a9){return db[_0x0519('0x1a')]['create'](_0x2ceb4d[_0x0519('0x1b')],{'raw':_0x2ceb4d['options']?_0x2ceb4d[_0x0519('0x1c')][_0x0519('0x1d')]===undefined?!![]:![]:!![]})[_0x0519('0xd')](function(_0x127589){logger[_0x0519('0xe')](_0x0519('0x19'),_0x2ceb4d);logger[_0x0519('0x11')]('CreateReportAgentPreview',_0x2ceb4d,JSON[_0x0519('0x13')](_0x127589));_0x6bb44(_0x127589);})[_0x0519('0x18')](function(_0x24297f){logger[_0x0519('0x14')](_0x0519('0x19'),_0x24297f[_0x0519('0x16')],_0x2ceb4d);_0x39d9a9(_0x59e454[_0x0519('0x14')](0x1f4,_0x24297f[_0x0519('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 1334ba2..18fee73 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 _0x1254=['/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','trunks','/campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor'];(function(_0x52597a,_0xc693e9){var _0x5f431d=function(_0x176c3b){while(--_0x176c3b){_0x52597a['push'](_0x52597a['shift']());}};_0x5f431d(++_0xc693e9);}(_0x1254,0x1e2));var _0x4125=function(_0x33ff1e,_0x15dcd8){_0x33ff1e=_0x33ff1e-0x0;var _0x3d7f08=_0x1254[_0x33ff1e];return _0x3d7f08;};'use strict';var multer=require(_0x4125('0x0'));var util=require(_0x4125('0x1'));var path=require(_0x4125('0x2'));var express=require('express');var router=express[_0x4125('0x3')]();var auth=require(_0x4125('0x4'));var controller=require(_0x4125('0x5'));router[_0x4125('0x6')]('/voice/channels',auth[_0x4125('0x7')](),controller[_0x4125('0x8')]);router['get'](_0x4125('0x9'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x4125('0x6')](_0x4125('0xa'),auth[_0x4125('0x7')](),controller[_0x4125('0xb')]);router[_0x4125('0x6')](_0x4125('0xc'),auth[_0x4125('0x7')](),controller[_0x4125('0xd')]);router[_0x4125('0x6')](_0x4125('0xe'),auth['isAuthenticated'](),controller[_0x4125('0xf')]);router[_0x4125('0x6')](_0x4125('0x10'),auth[_0x4125('0x7')](),controller[_0x4125('0x11')]);router[_0x4125('0x6')](_0x4125('0x12'),auth[_0x4125('0x7')](),controller[_0x4125('0x13')]);router['get'](_0x4125('0x14'),auth[_0x4125('0x7')](),controller[_0x4125('0x15')]);router[_0x4125('0x6')](_0x4125('0x16'),auth[_0x4125('0x7')](),controller['smsQueues']);router[_0x4125('0x6')](_0x4125('0x17'),auth[_0x4125('0x7')](),controller['whatsappQueues']);router[_0x4125('0x6')](_0x4125('0x18'),auth['isAuthenticated'](),controller[_0x4125('0x19')]);router[_0x4125('0x6')](_0x4125('0x1a'),auth['isAuthenticated'](),controller[_0x4125('0x1b')]);router['get'](_0x4125('0x1c'),auth[_0x4125('0x7')](),controller[_0x4125('0x1d')]);router[_0x4125('0x6')](_0x4125('0x1e'),auth[_0x4125('0x7')](),controller[_0x4125('0x1f')]);router[_0x4125('0x6')](_0x4125('0x20'),auth[_0x4125('0x7')](),controller[_0x4125('0x21')]);router[_0x4125('0x6')](_0x4125('0x22'),auth[_0x4125('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x4125('0x6')](_0x4125('0x23'),auth[_0x4125('0x7')](),controller[_0x4125('0x24')]);router[_0x4125('0x25')](_0x4125('0x23'),auth[_0x4125('0x7')](),controller[_0x4125('0x26')]);router[_0x4125('0x6')](_0x4125('0x27'),auth[_0x4125('0x7')](),controller[_0x4125('0x28')]);router['get'](_0x4125('0x29'),auth['isAuthenticated'](),controller[_0x4125('0x2a')]);router[_0x4125('0x6')](_0x4125('0x2b'),auth['isAuthenticated'](),controller['agents']);router[_0x4125('0x25')](_0x4125('0x2c'),auth[_0x4125('0x7')](),controller[_0x4125('0x2d')]);router[_0x4125('0x6')](_0x4125('0x2e'),auth[_0x4125('0x7')](),controller['telephones']);router[_0x4125('0x6')]('/trunks',auth[_0x4125('0x7')](),controller[_0x4125('0x2f')]);router[_0x4125('0x6')](_0x4125('0x30'),auth[_0x4125('0x7')](),controller['campaigns']);router[_0x4125('0x6')]('/fax/accounts',auth[_0x4125('0x7')](),controller['faxAccounts']);router[_0x4125('0x6')](_0x4125('0x31'),auth[_0x4125('0x7')](),controller[_0x4125('0x32')]);router[_0x4125('0x6')](_0x4125('0x33'),auth[_0x4125('0x7')](),controller[_0x4125('0x34')]);router[_0x4125('0x6')](_0x4125('0x35'),auth[_0x4125('0x7')](),controller[_0x4125('0x36')]);router[_0x4125('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x4125('0x7')](),controller[_0x4125('0x37')]);router[_0x4125('0x6')](_0x4125('0x38'),auth[_0x4125('0x7')](),controller[_0x4125('0x39')]);router[_0x4125('0x6')](_0x4125('0x3a'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x4125('0x6')](_0x4125('0x3b'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x4125('0x3c')](_0x4125('0x3d'),auth[_0x4125('0x7')](),controller[_0x4125('0x3e')](_0x4125('0x3f')));router['get'](_0x4125('0x40'),auth['isAuthenticated'](),controller[_0x4125('0x41')]);router['post'](_0x4125('0x42'),auth[_0x4125('0x7')](),controller['queueNotify'](_0x4125('0x43')));router[_0x4125('0x6')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0x4125('0x3c')](_0x4125('0x44'),auth[_0x4125('0x7')](),controller[_0x4125('0x3e')]('fax'));router['get']('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x4125('0x45')]);router[_0x4125('0x3c')](_0x4125('0x46'),auth['isAuthenticated'](),controller[_0x4125('0x3e')](_0x4125('0x47')));router[_0x4125('0x6')](_0x4125('0x48'),auth[_0x4125('0x7')](),controller['showOpenchannelQueues']);router['post'](_0x4125('0x49'),auth[_0x4125('0x7')](),controller[_0x4125('0x3e')]('sms'));router['post'](_0x4125('0x4a'),auth[_0x4125('0x7')](),controller[_0x4125('0x3e')](_0x4125('0x4b')));router[_0x4125('0x6')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x4125('0x4c')]);router[_0x4125('0x6')](_0x4125('0x4d'),auth[_0x4125('0x7')](),controller[_0x4125('0x4e')]);router[_0x4125('0x3c')](_0x4125('0x4f'),auth[_0x4125('0x7')](),controller[_0x4125('0x50')]);module[_0x4125('0x51')]=router; \ No newline at end of file +var _0x4163=['/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','post','queueNotify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts'];(function(_0xe6d1b1,_0x5c4bcc){var _0x484e49=function(_0x16cdcb){while(--_0x16cdcb){_0xe6d1b1['push'](_0xe6d1b1['shift']());}};_0x484e49(++_0x5c4bcc);}(_0x4163,0xee));var _0x3416=function(_0x4acf6f,_0x5072e5){_0x4acf6f=_0x4acf6f-0x0;var _0x3c6d3a=_0x4163[_0x4acf6f];return _0x3c6d3a;};'use strict';var multer=require(_0x3416('0x0'));var util=require(_0x3416('0x1'));var path=require(_0x3416('0x2'));var express=require(_0x3416('0x3'));var router=express['Router']();var auth=require(_0x3416('0x4'));var controller=require(_0x3416('0x5'));router[_0x3416('0x6')](_0x3416('0x7'),auth[_0x3416('0x8')](),controller[_0x3416('0x9')]);router['get'](_0x3416('0xa'),auth[_0x3416('0x8')](),controller[_0x3416('0xb')]);router[_0x3416('0x6')](_0x3416('0xc'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x3416('0x6')](_0x3416('0xd'),auth['isAuthenticated'](),controller[_0x3416('0xe')]);router[_0x3416('0x6')](_0x3416('0xf'),auth['isAuthenticated'](),controller[_0x3416('0x10')]);router[_0x3416('0x6')](_0x3416('0x11'),auth[_0x3416('0x8')](),controller[_0x3416('0x12')]);router[_0x3416('0x6')]('/mail/accounts',auth[_0x3416('0x8')](),controller[_0x3416('0x13')]);router[_0x3416('0x6')](_0x3416('0x14'),auth['isAuthenticated'](),controller[_0x3416('0x15')]);router[_0x3416('0x6')](_0x3416('0x16'),auth['isAuthenticated'](),controller[_0x3416('0x17')]);router[_0x3416('0x6')](_0x3416('0x18'),auth[_0x3416('0x8')](),controller['whatsappQueues']);router[_0x3416('0x6')](_0x3416('0x19'),auth[_0x3416('0x8')](),controller[_0x3416('0x1a')]);router[_0x3416('0x6')](_0x3416('0x1b'),auth['isAuthenticated'](),controller[_0x3416('0x1c')]);router[_0x3416('0x6')](_0x3416('0x1d'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x3416('0x6')](_0x3416('0x1e'),auth[_0x3416('0x8')](),controller['voiceQueuesChannel']);router[_0x3416('0x6')](_0x3416('0x1f'),auth[_0x3416('0x8')](),controller[_0x3416('0x20')]);router['get'](_0x3416('0x21'),auth[_0x3416('0x8')](),controller[_0x3416('0x22')]);router[_0x3416('0x6')]('/voice/queues/:id',auth[_0x3416('0x8')](),controller[_0x3416('0x23')]);router['put'](_0x3416('0x24'),auth[_0x3416('0x8')](),controller[_0x3416('0x25')]);router[_0x3416('0x6')](_0x3416('0x26'),auth[_0x3416('0x8')](),controller[_0x3416('0x27')]);router[_0x3416('0x6')]('/outbound/channels',auth[_0x3416('0x8')](),controller[_0x3416('0x28')]);router[_0x3416('0x6')]('/agents',auth['isAuthenticated'](),controller[_0x3416('0x29')]);router[_0x3416('0x2a')](_0x3416('0x2b'),auth[_0x3416('0x8')](),controller[_0x3416('0x2c')]);router[_0x3416('0x6')](_0x3416('0x2d'),auth[_0x3416('0x8')](),controller[_0x3416('0x2e')]);router[_0x3416('0x6')]('/trunks',auth[_0x3416('0x8')](),controller[_0x3416('0x2f')]);router[_0x3416('0x6')](_0x3416('0x30'),auth[_0x3416('0x8')](),controller[_0x3416('0x31')]);router[_0x3416('0x6')](_0x3416('0x32'),auth['isAuthenticated'](),controller[_0x3416('0x33')]);router['get'](_0x3416('0x34'),auth[_0x3416('0x8')](),controller[_0x3416('0x35')]);router[_0x3416('0x6')]('/mail/queues/waitinginteractions',auth[_0x3416('0x8')](),controller[_0x3416('0x36')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0x3416('0x8')](),controller[_0x3416('0x37')]);router['get'](_0x3416('0x38'),auth[_0x3416('0x8')](),controller[_0x3416('0x39')]);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x3416('0x6')](_0x3416('0x3a'),auth[_0x3416('0x8')](),controller[_0x3416('0x3b')]);router[_0x3416('0x6')](_0x3416('0x3c'),auth[_0x3416('0x8')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x3416('0x3d'),auth['isAuthenticated'](),controller['queueNotify'](_0x3416('0x3e')));router[_0x3416('0x6')](_0x3416('0x3f'),auth[_0x3416('0x8')](),controller[_0x3416('0x40')]);router[_0x3416('0x41')]('/chat/queues/:id/notify',auth[_0x3416('0x8')](),controller[_0x3416('0x42')](_0x3416('0x43')));router[_0x3416('0x6')](_0x3416('0x44'),auth[_0x3416('0x8')](),controller[_0x3416('0x45')]);router[_0x3416('0x41')]('/fax/queues/:id/notify',auth[_0x3416('0x8')](),controller[_0x3416('0x42')](_0x3416('0x46')));router[_0x3416('0x6')](_0x3416('0x47'),auth[_0x3416('0x8')](),controller[_0x3416('0x48')]);router[_0x3416('0x41')](_0x3416('0x49'),auth[_0x3416('0x8')](),controller[_0x3416('0x42')](_0x3416('0x4a')));router[_0x3416('0x6')](_0x3416('0x4b'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x3416('0x41')](_0x3416('0x4c'),auth['isAuthenticated'](),controller[_0x3416('0x42')]('sms'));router[_0x3416('0x41')](_0x3416('0x4d'),auth['isAuthenticated'](),controller[_0x3416('0x42')](_0x3416('0x4e')));router['get'](_0x3416('0x4f'),auth[_0x3416('0x8')](),controller[_0x3416('0x50')]);router[_0x3416('0x6')](_0x3416('0x51'),auth[_0x3416('0x8')](),controller[_0x3416('0x52')]);router['post'](_0x3416('0x53'),auth[_0x3416('0x8')](),controller[_0x3416('0x54')]);module[_0x3416('0x55')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index c30902a..1d17d06 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 _0x1cb9=['query','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','findOrCreate','agent','AgentCapacity','telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','findOne','\x20Queue\x20not\x20found','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','bluebird','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','then','error','code','message','result','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','merge'];(function(_0x5ec634,_0xa835b9){var _0x5b94a9=function(_0x3a720e){while(--_0x3a720e){_0x5ec634['push'](_0x5ec634['shift']());}};_0x5b94a9(++_0xa835b9);}(_0x1cb9,0x14e));var _0x91cb=function(_0x49d9a6,_0x5a5291){_0x49d9a6=_0x49d9a6-0x0;var _0x28195d=_0x1cb9[_0x49d9a6];return _0x28195d;};'use strict';var BPromise=require(_0x91cb('0x0'));var moment=require('moment');var _=require(_0x91cb('0x1'));var util=require(_0x91cb('0x2'));var db=require(_0x91cb('0x3'))['db'];var logger=require(_0x91cb('0x4'))('api');var jayson=require(_0x91cb('0x5'));var amiClient=jayson[_0x91cb('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x91cb('0x6')][_0x91cb('0x7')]({'port':0x232b});var routingClient=jayson[_0x91cb('0x6')][_0x91cb('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){var _0x2fdfce=_0x4c1f56?_0x4c1f56:amiClient;return _0x2fdfce['request'](_0x3b9d98,_0x8f8a3b)[_0x91cb('0x8')](function(_0x317df0){if(_0x317df0[_0x91cb('0x9')]){if(_0x317df0[_0x91cb('0x9')][_0x91cb('0xa')]===0x1f4){return _0x5bda2f(_0x317df0[_0x91cb('0x9')][_0x91cb('0xb')]);}return _0x15c517(_0x317df0[_0x91cb('0x9')][_0x91cb('0xb')]);}else{_0x15c517(_0x317df0[_0x91cb('0xc')]);}})['catch'](function(_0x3c1f56){_0x5bda2f(_0x3c1f56);});});}function respondWithResult(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xc8;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0xd')](_0x4ba2f2)[_0x91cb('0xe')](_0x20e6e0);}return _0x366f09[_0x91cb('0xf')](0x194);};}function handleError(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0x1f4;return function(_0x4aae25){logger[_0x91cb('0x9')](_0x4aae25['stack']);if(_0x4aae25['name']){delete _0x4aae25[_0x91cb('0x10')];}_0x4a7d45[_0x91cb('0xd')](_0x4cc6ef)[_0x91cb('0x11')](_0x4aae25);};}function findById(_0x5ea796){return function(_0x238f11){if(!_[_0x91cb('0x12')](_0x5ea796)&&!_['isNil'](_0x238f11)&&!_[_0x91cb('0x12')](_0x238f11[_0x91cb('0x13')])){return _[_0x91cb('0x14')](_0x238f11[_0x91cb('0x13')],function(_0x5cc1c3){return _0x5cc1c3['id']==_0x5ea796;});}return null;};}exports[_0x91cb('0x15')]=function(_0x7dcf60,_0x4ca8e8){return respondWithRpcPromise(_0x91cb('0x16'),_0x7dcf60['query'])['then'](respondWithResult(_0x4ca8e8,null))[_0x91cb('0x17')](handleError(_0x4ca8e8,null));};exports[_0x91cb('0x18')]=function(_0x56e409,_0x51a1d5){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x91cb('0x19')](_0x56e409[_0x91cb('0x1a')],_0x56e409[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x51a1d5,null))['catch'](handleError(_0x51a1d5,null));};exports[_0x91cb('0x1c')]=function(_0x43881c,_0x1fa837){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x91cb('0x19')](_0x43881c[_0x91cb('0x1a')],_0x43881c[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x1fa837,null))[_0x91cb('0x17')](handleError(_0x1fa837,null));};exports[_0x91cb('0x1d')]=function(_0x414e60,_0x423c4f){return respondWithRpcPromise(_0x91cb('0x1e'),_0x414e60['query'])['then'](respondWithResult(_0x423c4f,null))[_0x91cb('0x17')](handleError(_0x423c4f,null));};exports['showVoiceQueues']=function(_0x1c67d2,_0x34d372){return respondWithRpcPromise(_0x91cb('0x1e'),_0x1c67d2['query'])[_0x91cb('0x8')](findById(_0x1c67d2['params']['id']))[_0x91cb('0x8')](respondWithResult(_0x34d372,null))[_0x91cb('0x17')](handleError(_0x34d372,null));};exports[_0x91cb('0x1f')]=function(_0x2fb473,_0x468908){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x91cb('0x19')](_0x2fb473['body'],_0x2fb473[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x468908,null))[_0x91cb('0x17')](handleError(_0x468908,null));};exports['voiceQueuesPreview']=function(_0x775c25,_0x146e1f){return respondWithRpcPromise(_0x91cb('0x20'),_[_0x91cb('0x19')](_0x775c25[_0x91cb('0x1a')],_0x775c25[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x146e1f,null))[_0x91cb('0x17')](handleError(_0x146e1f,null));};exports[_0x91cb('0x21')]=function(_0x5e6ed3,_0x2ccf6e){return respondWithRpcPromise(_0x91cb('0x22'),_0x5e6ed3[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x2ccf6e,null))[_0x91cb('0x17')](handleError(_0x2ccf6e,null));};exports['voiceQueuesChannel']=function(_0x2409d3,_0x74b443){return respondWithRpcPromise(_0x91cb('0x23'),_[_0x91cb('0x19')](_0x2409d3[_0x91cb('0x1a')],_0x2409d3['params']))[_0x91cb('0x8')](respondWithResult(_0x74b443,null))['catch'](handleError(_0x74b443,null));};exports['voiceQueuesChannelHangup']=function(_0x479968,_0x2011fc){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x91cb('0x19')](_0x479968['query'],_0x479968['params']))[_0x91cb('0x8')](respondWithResult(_0x2011fc,null))[_0x91cb('0x17')](handleError(_0x2011fc,null));};exports[_0x91cb('0x24')]=function(_0x14319b,_0x2d8fb9){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x91cb('0x19')](_0x14319b[_0x91cb('0x1a')],_0x14319b[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x2d8fb9,null))['catch'](handleError(_0x2d8fb9,null));};exports['outbound']=function(_0x1eed21,_0x135bf1){return respondWithRpcPromise('Outbound',_0x1eed21[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x135bf1,null))['catch'](handleError(_0x135bf1,null));};exports[_0x91cb('0x25')]=function(_0xddc409,_0x5f456c){return respondWithRpcPromise(_0x91cb('0x26'),_0xddc409['query'])[_0x91cb('0x8')](respondWithResult(_0x5f456c,null))[_0x91cb('0x17')](handleError(_0x5f456c,null));};exports[_0x91cb('0x27')]=function(_0x279ad5,_0x51d0ea){var _0x20bf50;return respondWithRpcPromise('Agents',_0x279ad5[_0x91cb('0x1a')])[_0x91cb('0x8')](function(_0x4e5b4b){_0x20bf50=_0x4e5b4b;return respondWithRpcPromise(_0x91cb('0x28'),_0x279ad5['query'],routingClient);})[_0x91cb('0x8')](function(_0x2eac87){return _[_0x91cb('0x19')]({},_0x2eac87,_0x20bf50);})[_0x91cb('0x8')](respondWithResult(_0x51d0ea,null))['catch'](handleError(_0x51d0ea,null));};exports[_0x91cb('0x29')]=function(_0x5af0e6,_0x2cf27e){if(_0x5af0e6[_0x91cb('0x2a')]&&_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')]&&_0x5af0e6[_0x91cb('0x2c')]&&_0x5af0e6[_0x91cb('0x2c')][_0x91cb('0x10')]){for(var _0x3cc4c1 in _0x5af0e6['body'][_0x91cb('0x2b')]){if(_0x5af0e6['body'][_0x91cb('0x2b')]['hasOwnProperty'](_0x3cc4c1)){db[_0x91cb('0x2d')]['findAll']({'where':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')][_0x91cb('0x10')],'type':_0x91cb('0x2e'),'exitAt':null,'uniqueid':_0x5af0e6[_0x91cb('0x2a')]['interaction'][_0x3cc4c1]&&_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1]['length']?{'$notIn':_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1]}:{'$ne':null}}})[_0x91cb('0x8')](function(_0x32517d){var _0x267efb=moment()[_0x91cb('0x2f')](_0x91cb('0x30'));for(var _0x29d5a1=0x0,_0x396b81=_0x32517d['length'];_0x29d5a1<_0x396b81;_0x29d5a1+=0x1){_0x32517d[_0x29d5a1][_0x91cb('0x31')]({'exitAt':_0x267efb});}});for(var _0x3e20d1=0x0;_0x3e20d1<_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1][_0x91cb('0x32')];_0x3e20d1+=0x1){db[_0x91cb('0x2d')][_0x91cb('0x33')]({'where':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')]['name'],'type':_0x91cb('0x2e'),'uniqueid':_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1][_0x3e20d1],'exitAt':null},'defaults':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')]['name'],'interface':_[_0x91cb('0x12')](_0x5af0e6[_0x91cb('0x2c')]['interface'])?util[_0x91cb('0x2f')]('SIP/%s',_0x5af0e6[_0x91cb('0x2c')]['name']):_0x5af0e6['user']['interface'],'type':_0x91cb('0x2e'),'enterAt':moment()[_0x91cb('0x2f')](_0x91cb('0x30')),'role':_0x91cb('0x34'),'internal':_0x5af0e6[_0x91cb('0x2c')]['internal'],'uniqueid':_0x5af0e6['body'][_0x91cb('0x2b')][_0x3cc4c1][_0x3e20d1]}});}}}}return respondWithRpcPromise(_0x91cb('0x35'),{'id':_0x5af0e6[_0x91cb('0x1b')]['id'],'capacity':_0x5af0e6[_0x91cb('0x2a')]['capacity']},routingClient)['then'](respondWithResult(_0x2cf27e,null))['catch'](handleError(_0x2cf27e,null));};exports[_0x91cb('0x36')]=function(_0x490417,_0x3f22a1){return respondWithRpcPromise('Telephones',_0x490417[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x3f22a1,null))[_0x91cb('0x17')](handleError(_0x3f22a1,null));};exports[_0x91cb('0x37')]=function(_0x1884bc,_0x362532){return respondWithRpcPromise(_0x91cb('0x38'),_0x1884bc[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x362532,null))[_0x91cb('0x17')](handleError(_0x362532,null));};exports[_0x91cb('0x39')]=function(_0x5752ed,_0x1e445a){return respondWithRpcPromise(_0x91cb('0x3a'),_0x5752ed['query'])[_0x91cb('0x8')](respondWithResult(_0x1e445a,null))[_0x91cb('0x17')](handleError(_0x1e445a,null));};exports['chatQueues']=function(_0x2f5311,_0x166eeb){return respondWithRpcPromise(_0x91cb('0x3b'),_0x2f5311[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x166eeb,null))[_0x91cb('0x17')](handleError(_0x166eeb,null));};exports[_0x91cb('0x3c')]=function(_0x274fff,_0x3320bd){return respondWithRpcPromise(_0x91cb('0x3b'),_0x274fff[_0x91cb('0x1a')],routingClient)['then'](findById(_0x274fff[_0x91cb('0x1b')]['id']))['then'](respondWithResult(_0x3320bd,null))[_0x91cb('0x17')](handleError(_0x3320bd,null));};exports['mailQueues']=function(_0x3dfff9,_0x1b2fec){return respondWithRpcPromise(_0x91cb('0x3d'),_0x3dfff9['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1b2fec,null))[_0x91cb('0x17')](handleError(_0x1b2fec,null));};exports['showMailQueues']=function(_0xef4754,_0x102025){return respondWithRpcPromise(_0x91cb('0x3d'),_0xef4754[_0x91cb('0x1a')],routingClient)['then'](findById(_0xef4754[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x102025,null))[_0x91cb('0x17')](handleError(_0x102025,null));};exports[_0x91cb('0x3e')]=function(_0x55a0e3,_0x11025a){return respondWithRpcPromise(_0x91cb('0x3f'),_0x55a0e3['query'],mailClient)['then'](respondWithResult(_0x11025a,null))[_0x91cb('0x17')](handleError(_0x11025a,null));};exports['openchannelQueues']=function(_0x1180ac,_0x1237fd){return respondWithRpcPromise('OpenchannelQueues',_0x1180ac['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1237fd,null))['catch'](handleError(_0x1237fd,null));};exports[_0x91cb('0x40')]=function(_0x961ebf,_0x33de58){return respondWithRpcPromise('OpenchannelQueues',_0x961ebf[_0x91cb('0x1a')],routingClient)['then'](findById(_0x961ebf[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x33de58,null))[_0x91cb('0x17')](handleError(_0x33de58,null));};exports[_0x91cb('0x41')]=function(_0x483172,_0xb37f8e){return respondWithRpcPromise(_0x91cb('0x42'),_0x483172[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0xb37f8e,null))[_0x91cb('0x17')](handleError(_0xb37f8e,null));};exports[_0x91cb('0x43')]=function(_0x14114d,_0x2785f9){return respondWithRpcPromise(_0x91cb('0x42'),_0x14114d[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x14114d[_0x91cb('0x1b')]['id']))['then'](respondWithResult(_0x2785f9,null))[_0x91cb('0x17')](handleError(_0x2785f9,null));};exports[_0x91cb('0x44')]=function(_0x474682,_0x51ab8a){return respondWithRpcPromise(_0x91cb('0x45'),_0x474682[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x51ab8a,null))['catch'](handleError(_0x51ab8a,null));};exports[_0x91cb('0x46')]=function(_0x5a3c7d,_0x4484d6){return respondWithRpcPromise(_0x91cb('0x45'),_0x5a3c7d[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x5a3c7d['params']['id']))[_0x91cb('0x8')](respondWithResult(_0x4484d6,null))[_0x91cb('0x17')](handleError(_0x4484d6,null));};exports[_0x91cb('0x47')]=function(_0x404b50,_0x1bb16f){return respondWithRpcPromise(_0x91cb('0x48'),_0x404b50['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1bb16f,null))[_0x91cb('0x17')](handleError(_0x1bb16f,null));};exports[_0x91cb('0x49')]=function(_0x1f0ba2,_0x891569){return respondWithRpcPromise(_0x91cb('0x48'),_0x1f0ba2[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x1f0ba2[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x891569,null))[_0x91cb('0x17')](handleError(_0x891569,null));};exports[_0x91cb('0x4a')]=function(_0xda123b,_0x3eead5){return respondWithRpcPromise(_0x91cb('0x4b'),_0xda123b[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x3eead5,null))['catch'](handleError(_0x3eead5,null));};exports[_0x91cb('0x4c')]=function(_0x1455cd,_0x4b639d){return respondWithRpcPromise(_0x91cb('0x4d'),_0x1455cd[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x4b639d,null))['catch'](handleError(_0x4b639d,null));};exports[_0x91cb('0x4e')]=function(_0x6ecba8,_0x5cd31c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x6ecba8[_0x91cb('0x1a')],routingClient)['then'](respondWithResult(_0x5cd31c,null))[_0x91cb('0x17')](handleError(_0x5cd31c,null));};exports[_0x91cb('0x4f')]=function(_0x4e11e3,_0x43a8b1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4e11e3[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x43a8b1,null))['catch'](handleError(_0x43a8b1,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x16a21f,_0x43be3e){return respondWithRpcPromise(_0x91cb('0x50'),_0x16a21f['query'],routingClient)[_0x91cb('0x8')](function(_0x23a458){if(_0x16a21f[_0x91cb('0x1a')][_0x91cb('0x51')]!==undefined){var _0x570f6b=_(_0x23a458[_0x91cb('0x13')])['filter']([_0x16a21f[_0x91cb('0x1a')][_0x91cb('0x51')],_0x16a21f[_0x91cb('0x1b')]['id']])[_0x91cb('0x52')]('queue_id')['uniq']()[_0x91cb('0x53')]();return _0x23a458['rows'][_0x91cb('0x54')](function(_0x3dc6f9){return _0x570f6b[_0x91cb('0x55')](_0x3dc6f9[_0x91cb('0x56')])>-0x1;});}else{return _0x23a458[_0x91cb('0x13')][_0x91cb('0x54')](function(_0x12d3d1){return _0x12d3d1['queue_id']===parseInt(_0x16a21f[_0x91cb('0x1b')]['id']);});}})[_0x91cb('0x8')](respondWithResult(_0x43be3e,null))['catch'](handleError(_0x43be3e,null));};exports[_0x91cb('0x57')]=function(_0x4d5862,_0x35525c){return respondWithRpcPromise(_0x91cb('0x58'),_0x4d5862[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x35525c,null))[_0x91cb('0x17')](handleError(_0x35525c,null));};exports[_0x91cb('0x59')]=function(_0x1459c4,_0x30259d){return respondWithRpcPromise(_0x91cb('0x5a'),_0x1459c4[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x30259d,null))[_0x91cb('0x17')](handleError(_0x30259d,null));};exports[_0x91cb('0x5b')]=function(_0x14882d,_0x22ba54){return respondWithRpcPromise(_0x91cb('0x5c'),_0x14882d['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x22ba54,null))['catch'](handleError(_0x22ba54,null));};exports[_0x91cb('0x5d')]=function(_0x123d72){return function(_0x13f358,_0x422928){var _0x319289,_0x1fa3c7;var _0x324bdb=_[_0x91cb('0x5e')](_0x123d72);var _0x569df1=_0x123d72===_0x91cb('0x5f')?_0x91cb('0x60'):'Account';return db[_0x324bdb+'Queue'][_0x91cb('0x61')]({'raw':!![],'where':{'id':_0x13f358['params']['id']}})['then'](function(_0x95f2de){if(_['isNil'](_0x95f2de)){throw new Error(_0x324bdb+_0x91cb('0x62'));}_0x319289=_0x95f2de;return db[_0x324bdb+'Message'][_0x91cb('0x61')]({'where':{'id':_0x13f358[_0x91cb('0x2a')][_0x91cb('0x63')]},'include':[{'model':db[_0x324bdb+_0x91cb('0x64')],'as':'Interaction'},{'model':db[_0x324bdb+_0x569df1],'as':_0x91cb('0x65')}]});})[_0x91cb('0x8')](function(_0x42d07b){if(_[_0x91cb('0x12')](_0x42d07b)){throw new Error(_0x324bdb+_0x91cb('0x66'));}_0x1fa3c7=_0x42d07b;return _0x42d07b[_0x91cb('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x91cb('0x8')](function(){var _0x3cf8c5={'uniqueid':_0x123d72+'.'+_0x1fa3c7['id']+'.'+_0x1fa3c7[_0x91cb('0x64')]['id'],'FromUserId':_0x13f358[_0x91cb('0x2c')]['id'],'type':_0x91cb('0x68')};_0x3cf8c5[_0x324bdb+_0x91cb('0x69')]=_0x1fa3c7['id'];_0x3cf8c5[_0x324bdb+_0x91cb('0x6a')]=_0x1fa3c7[_0x91cb('0x64')]['id'];_0x3cf8c5[_0x91cb('0x6b')+_0x324bdb+_0x569df1+'Id']=_0x1fa3c7[_0x91cb('0x65')]['id'];_0x3cf8c5['To'+_0x324bdb+_0x91cb('0x6c')]=_0x319289['id'];return db[_0x324bdb+_0x91cb('0x6d')][_0x91cb('0x6e')](_0x3cf8c5);})[_0x91cb('0x8')](function(){return respondWithRpcPromise(_0x91cb('0x6f'),{'channel':_0x123d72,'interaction':_0x1fa3c7[_0x91cb('0x64')],'message':_0x1fa3c7,'account':_0x1fa3c7[_0x91cb('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x91cb('0x68'),'appdata':_0x319289[_0x91cb('0x10')]+','+(_0x1fa3c7['Account'][_0x91cb('0x70')]||0x12c),'interval':_0x91cb('0x71')}]},routingClient);})[_0x91cb('0x8')](respondWithResult(_0x422928,null))[_0x91cb('0x17')](handleError(_0x422928,null));};};exports[_0x91cb('0x72')]=function(_0x650ac9,_0x404457){var _0xa9de8b,_0x3bf154;if(_[_0x91cb('0x12')](_0x650ac9[_0x91cb('0x2a')]['channel'])){throw new Error(_0x91cb('0x73'));}var _0x4c459a=_0x650ac9['body'][_0x91cb('0x74')];var _0x265ffb=_[_0x91cb('0x5e')](_0x4c459a);var _0x446738=_0x4c459a===_0x91cb('0x5f')?_0x91cb('0x60'):_0x91cb('0x65');return db[_0x91cb('0x75')][_0x91cb('0x61')]({'raw':!![],'where':{'id':_0x650ac9[_0x91cb('0x1b')]['id'],'role':'agent'}})[_0x91cb('0x8')](function(_0xb784d5){if(_['isNil'](_0xb784d5)){throw new Error(_0x91cb('0x76'));}_0xa9de8b=_0xb784d5;return db[_0x265ffb+_0x91cb('0x77')]['findOne']({'where':{'id':_0x650ac9[_0x91cb('0x2a')][_0x91cb('0x63')]},'include':[{'model':db[_0x265ffb+_0x91cb('0x64')],'as':_0x91cb('0x64')},{'model':db[_0x265ffb+_0x446738],'as':_0x91cb('0x65')}]});})[_0x91cb('0x8')](function(_0x65c551){if(_[_0x91cb('0x12')](_0x65c551)){throw new Error(_0x265ffb+_0x91cb('0x66'));}_0x3bf154=_0x65c551;return _0x65c551[_0x91cb('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x91cb('0x8')](function(){var _0x378cd0={'uniqueid':_0x4c459a+'.'+_0x3bf154['id']+'.'+_0x3bf154['Interaction']['id'],'FromUserId':_0x650ac9['user']['id'],'type':_0x91cb('0x68'),'ToUserId':_0xa9de8b['id']};_0x378cd0[_0x265ffb+_0x91cb('0x69')]=_0x3bf154['id'];_0x378cd0[_0x265ffb+_0x91cb('0x6a')]=_0x3bf154[_0x91cb('0x64')]['id'];_0x378cd0[_0x91cb('0x6b')+_0x265ffb+_0x446738+'Id']=_0x3bf154[_0x91cb('0x65')]['id'];return db[_0x265ffb+_0x91cb('0x6d')]['create'](_0x378cd0);})[_0x91cb('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x4c459a,'interaction':_0x3bf154[_0x91cb('0x64')],'message':_0x3bf154,'account':_0x3bf154[_0x91cb('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x91cb('0x34'),'appdata':_0xa9de8b[_0x91cb('0x10')]+','+(_0x3bf154[_0x91cb('0x65')]['agentTransferTimeout']||0x12c),'interval':_0x91cb('0x71')}]},routingClient);})[_0x91cb('0x8')](respondWithResult(_0x404457,null))[_0x91cb('0x17')](handleError(_0x404457,null));}; \ No newline at end of file +var _0xbd51=['chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','value','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','create','Start','queue','*,*,*,*','Channel\x20field\x20is\x20mandatory','channel','capitalize','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','client','http','request','error','code','message','catch','status','json','stack','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','SIP/%s','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts'];(function(_0x3070d5,_0x1d3284){var _0x2067e6=function(_0x15fe16){while(--_0x15fe16){_0x3070d5['push'](_0x3070d5['shift']());}};_0x2067e6(++_0x1d3284);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x18a6f9,_0x4834f5){_0x18a6f9=_0x18a6f9-0x0;var _0x762792=_0xbd51[_0x18a6f9];return _0x762792;};'use strict';var BPromise=require(_0x1bd5('0x0'));var moment=require('moment');var _=require(_0x1bd5('0x1'));var util=require(_0x1bd5('0x2'));var db=require(_0x1bd5('0x3'))['db'];var logger=require(_0x1bd5('0x4'))('api');var jayson=require('jayson/promise');var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0x1bd5('0x5')][_0x1bd5('0x6')]({'port':0x232b});var routingClient=jayson[_0x1bd5('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){var _0x4a7f90=_0x19077c?_0x19077c:amiClient;return _0x4a7f90[_0x1bd5('0x7')](_0x29abea,_0x30a385)['then'](function(_0x2bd975){if(_0x2bd975[_0x1bd5('0x8')]){if(_0x2bd975[_0x1bd5('0x8')][_0x1bd5('0x9')]===0x1f4){return _0xd8418f(_0x2bd975[_0x1bd5('0x8')][_0x1bd5('0xa')]);}return _0x27d58f(_0x2bd975['error'][_0x1bd5('0xa')]);}else{_0x27d58f(_0x2bd975['result']);}})[_0x1bd5('0xb')](function(_0x24e38c){_0xd8418f(_0x24e38c);});});}function respondWithResult(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xc8;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0xc')](_0x14606b)[_0x1bd5('0xd')](_0x177be0);}return _0x37e8e1['sendStatus'](0x194);};}function handleError(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0x1f4;return function(_0x6d2c40){logger[_0x1bd5('0x8')](_0x6d2c40[_0x1bd5('0xe')]);if(_0x6d2c40['name']){delete _0x6d2c40['name'];}_0x5650b5[_0x1bd5('0xc')](_0x8b2390)[_0x1bd5('0xf')](_0x6d2c40);};}function findById(_0x2b2c57){return function(_0x4793dd){if(!_[_0x1bd5('0x10')](_0x2b2c57)&&!_[_0x1bd5('0x10')](_0x4793dd)&&!_[_0x1bd5('0x10')](_0x4793dd[_0x1bd5('0x11')])){return _[_0x1bd5('0x12')](_0x4793dd['rows'],function(_0x53ad5e){return _0x53ad5e['id']==_0x2b2c57;});}return null;};}exports[_0x1bd5('0x13')]=function(_0x260827,_0x476bd1){return respondWithRpcPromise(_0x1bd5('0x14'),_0x260827[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x476bd1,null))[_0x1bd5('0xb')](handleError(_0x476bd1,null));};exports[_0x1bd5('0x17')]=function(_0x456051,_0xb1ac1e){return respondWithRpcPromise(_0x1bd5('0x18'),_[_0x1bd5('0x19')](_0x456051[_0x1bd5('0x15')],_0x456051[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0xb1ac1e,null))[_0x1bd5('0xb')](handleError(_0xb1ac1e,null));};exports[_0x1bd5('0x1b')]=function(_0x29c340,_0x5567c9){return respondWithRpcPromise(_0x1bd5('0x1c'),_['merge'](_0x29c340[_0x1bd5('0x15')],_0x29c340[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x5567c9,null))['catch'](handleError(_0x5567c9,null));};exports[_0x1bd5('0x1d')]=function(_0x4fa37c,_0x2ed551){return respondWithRpcPromise(_0x1bd5('0x1e'),_0x4fa37c[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x2ed551,null))['catch'](handleError(_0x2ed551,null));};exports[_0x1bd5('0x1f')]=function(_0x69bb17,_0x20245c){return respondWithRpcPromise(_0x1bd5('0x1e'),_0x69bb17['query'])[_0x1bd5('0x16')](findById(_0x69bb17[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x20245c,null))[_0x1bd5('0xb')](handleError(_0x20245c,null));};exports[_0x1bd5('0x20')]=function(_0xc73670,_0x4e72b2){return respondWithRpcPromise(_0x1bd5('0x21'),_[_0x1bd5('0x19')](_0xc73670[_0x1bd5('0x22')],_0xc73670['params']))[_0x1bd5('0x16')](respondWithResult(_0x4e72b2,null))[_0x1bd5('0xb')](handleError(_0x4e72b2,null));};exports[_0x1bd5('0x23')]=function(_0x3430bf,_0x1f4456){return respondWithRpcPromise(_0x1bd5('0x24'),_['merge'](_0x3430bf['query'],_0x3430bf[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x1f4456,null))['catch'](handleError(_0x1f4456,null));};exports[_0x1bd5('0x25')]=function(_0x198b88,_0x1efa8c){return respondWithRpcPromise(_0x1bd5('0x26'),_0x198b88['query'])[_0x1bd5('0x16')](respondWithResult(_0x1efa8c,null))[_0x1bd5('0xb')](handleError(_0x1efa8c,null));};exports[_0x1bd5('0x27')]=function(_0x233743,_0x209ce1){return respondWithRpcPromise(_0x1bd5('0x28'),_[_0x1bd5('0x19')](_0x233743[_0x1bd5('0x15')],_0x233743['params']))[_0x1bd5('0x16')](respondWithResult(_0x209ce1,null))[_0x1bd5('0xb')](handleError(_0x209ce1,null));};exports[_0x1bd5('0x29')]=function(_0x24c92e,_0x11a6d2){return respondWithRpcPromise(_0x1bd5('0x2a'),_[_0x1bd5('0x19')](_0x24c92e['query'],_0x24c92e[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x11a6d2,null))[_0x1bd5('0xb')](handleError(_0x11a6d2,null));};exports[_0x1bd5('0x2b')]=function(_0x3cf898,_0x192ca7){return respondWithRpcPromise(_0x1bd5('0x2c'),_['merge'](_0x3cf898['query'],_0x3cf898[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x192ca7,null))[_0x1bd5('0xb')](handleError(_0x192ca7,null));};exports['outbound']=function(_0x4595a0,_0x5af974){return respondWithRpcPromise(_0x1bd5('0x2d'),_0x4595a0[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x5af974,null))[_0x1bd5('0xb')](handleError(_0x5af974,null));};exports[_0x1bd5('0x2e')]=function(_0x2470ec,_0x41096d){return respondWithRpcPromise(_0x1bd5('0x2f'),_0x2470ec['query'])[_0x1bd5('0x16')](respondWithResult(_0x41096d,null))[_0x1bd5('0xb')](handleError(_0x41096d,null));};exports['agents']=function(_0x3b5a0d,_0x77ebcf){var _0x20b25c;return respondWithRpcPromise('Agents',_0x3b5a0d[_0x1bd5('0x15')])[_0x1bd5('0x16')](function(_0x2997a2){_0x20b25c=_0x2997a2;return respondWithRpcPromise(_0x1bd5('0x30'),_0x3b5a0d['query'],routingClient);})[_0x1bd5('0x16')](function(_0x22f437){return _[_0x1bd5('0x19')]({},_0x22f437,_0x20b25c);})[_0x1bd5('0x16')](respondWithResult(_0x77ebcf,null))['catch'](handleError(_0x77ebcf,null));};exports['agentCapacity']=function(_0x40eeff,_0x35afc7){if(_0x40eeff[_0x1bd5('0x22')]&&_0x40eeff['body'][_0x1bd5('0x31')]&&_0x40eeff[_0x1bd5('0x32')]&&_0x40eeff['user'][_0x1bd5('0x33')]){for(var _0x5761b8 in _0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')]){if(_0x40eeff['body'][_0x1bd5('0x31')][_0x1bd5('0x34')](_0x5761b8)){db[_0x1bd5('0x35')][_0x1bd5('0x36')]({'where':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'type':_0x1bd5('0x37'),'exitAt':null,'uniqueid':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8]&&_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8][_0x1bd5('0x38')]?{'$notIn':_0x40eeff['body'][_0x1bd5('0x31')][_0x5761b8]}:{'$ne':null}}})[_0x1bd5('0x16')](function(_0x335125){var _0x52ade4=moment()[_0x1bd5('0x39')](_0x1bd5('0x3a'));for(var _0x5bb8a6=0x0,_0x1dbde9=_0x335125['length'];_0x5bb8a6<_0x1dbde9;_0x5bb8a6+=0x1){_0x335125[_0x5bb8a6][_0x1bd5('0x3b')]({'exitAt':_0x52ade4});}});for(var _0x558fec=0x0;_0x558fec<_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8]['length'];_0x558fec+=0x1){db[_0x1bd5('0x35')]['findOrCreate']({'where':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'type':_0x1bd5('0x37'),'uniqueid':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8][_0x558fec],'exitAt':null},'defaults':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'interface':_[_0x1bd5('0x10')](_0x40eeff['user'][_0x1bd5('0x3c')])?util[_0x1bd5('0x39')](_0x1bd5('0x3d'),_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')]):_0x40eeff[_0x1bd5('0x32')]['interface'],'type':_0x1bd5('0x37'),'enterAt':moment()[_0x1bd5('0x39')](_0x1bd5('0x3a')),'role':_0x1bd5('0x3e'),'internal':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x3f')],'uniqueid':_0x40eeff[_0x1bd5('0x22')]['interaction'][_0x5761b8][_0x558fec]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x40eeff[_0x1bd5('0x1a')]['id'],'capacity':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x40')]},routingClient)['then'](respondWithResult(_0x35afc7,null))[_0x1bd5('0xb')](handleError(_0x35afc7,null));};exports[_0x1bd5('0x41')]=function(_0x1ad2ff,_0x1f2d7e){return respondWithRpcPromise(_0x1bd5('0x42'),_0x1ad2ff[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x1f2d7e,null))['catch'](handleError(_0x1f2d7e,null));};exports[_0x1bd5('0x43')]=function(_0x2bcd23,_0x4f2d91){return respondWithRpcPromise(_0x1bd5('0x44'),_0x2bcd23['query'])[_0x1bd5('0x16')](respondWithResult(_0x4f2d91,null))['catch'](handleError(_0x4f2d91,null));};exports[_0x1bd5('0x45')]=function(_0x555ba1,_0x5a011e){return respondWithRpcPromise(_0x1bd5('0x46'),_0x555ba1[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x5a011e,null))[_0x1bd5('0xb')](handleError(_0x5a011e,null));};exports[_0x1bd5('0x47')]=function(_0x33f011,_0x35c478){return respondWithRpcPromise('ChatQueues',_0x33f011[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x35c478,null))[_0x1bd5('0xb')](handleError(_0x35c478,null));};exports[_0x1bd5('0x48')]=function(_0x2cc5ba,_0x5a8132){return respondWithRpcPromise('ChatQueues',_0x2cc5ba[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x2cc5ba[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x5a8132,null))[_0x1bd5('0xb')](handleError(_0x5a8132,null));};exports[_0x1bd5('0x49')]=function(_0x46e36c,_0x383a68){return respondWithRpcPromise(_0x1bd5('0x4a'),_0x46e36c[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x383a68,null))[_0x1bd5('0xb')](handleError(_0x383a68,null));};exports['showMailQueues']=function(_0x2fe8f4,_0x34d93b){return respondWithRpcPromise(_0x1bd5('0x4a'),_0x2fe8f4['query'],routingClient)[_0x1bd5('0x16')](findById(_0x2fe8f4[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x34d93b,null))['catch'](handleError(_0x34d93b,null));};exports[_0x1bd5('0x4b')]=function(_0x10103a,_0x39f973){return respondWithRpcPromise(_0x1bd5('0x4c'),_0x10103a['query'],mailClient)['then'](respondWithResult(_0x39f973,null))[_0x1bd5('0xb')](handleError(_0x39f973,null));};exports[_0x1bd5('0x4d')]=function(_0x1790af,_0x54a8c4){return respondWithRpcPromise('OpenchannelQueues',_0x1790af[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x54a8c4,null))[_0x1bd5('0xb')](handleError(_0x54a8c4,null));};exports[_0x1bd5('0x4e')]=function(_0x5068ae,_0x32f646){return respondWithRpcPromise('OpenchannelQueues',_0x5068ae[_0x1bd5('0x15')],routingClient)['then'](findById(_0x5068ae[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x32f646,null))['catch'](handleError(_0x32f646,null));};exports[_0x1bd5('0x4f')]=function(_0x19f765,_0x47ca3f){return respondWithRpcPromise('SmsQueues',_0x19f765[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x47ca3f,null))['catch'](handleError(_0x47ca3f,null));};exports[_0x1bd5('0x50')]=function(_0x40b508,_0x5da595){return respondWithRpcPromise('SmsQueues',_0x40b508[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x40b508[_0x1bd5('0x1a')]['id']))['then'](respondWithResult(_0x5da595,null))[_0x1bd5('0xb')](handleError(_0x5da595,null));};exports[_0x1bd5('0x51')]=function(_0x5c1db7,_0x4b317d){return respondWithRpcPromise(_0x1bd5('0x52'),_0x5c1db7[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x4b317d,null))[_0x1bd5('0xb')](handleError(_0x4b317d,null));};exports[_0x1bd5('0x53')]=function(_0x53c6de,_0x3827d7){return respondWithRpcPromise('WhatsappQueues',_0x53c6de[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x53c6de[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x3827d7,null))['catch'](handleError(_0x3827d7,null));};exports['faxQueues']=function(_0x3a7dd6,_0x36d62e){return respondWithRpcPromise(_0x1bd5('0x54'),_0x3a7dd6[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x36d62e,null))[_0x1bd5('0xb')](handleError(_0x36d62e,null));};exports[_0x1bd5('0x55')]=function(_0xc080d5,_0x1a35cf){return respondWithRpcPromise(_0x1bd5('0x54'),_0xc080d5[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0xc080d5[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x1a35cf,null))[_0x1bd5('0xb')](handleError(_0x1a35cf,null));};exports[_0x1bd5('0x56')]=function(_0x1b99ff,_0x195176){return respondWithRpcPromise(_0x1bd5('0x57'),_0x1b99ff[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x195176,null))[_0x1bd5('0xb')](handleError(_0x195176,null));};exports[_0x1bd5('0x58')]=function(_0x3ddf27,_0x56e99c){return respondWithRpcPromise(_0x1bd5('0x59'),_0x3ddf27[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x56e99c,null))[_0x1bd5('0xb')](handleError(_0x56e99c,null));};exports[_0x1bd5('0x5a')]=function(_0x37a6f3,_0x1e282c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x37a6f3[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x1e282c,null))[_0x1bd5('0xb')](handleError(_0x1e282c,null));};exports[_0x1bd5('0x5b')]=function(_0x590b3d,_0x2ed59d){return respondWithRpcPromise(_0x1bd5('0x5c'),_0x590b3d[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x2ed59d,null))[_0x1bd5('0xb')](handleError(_0x2ed59d,null));};exports[_0x1bd5('0x5d')]=function(_0x32a878,_0x4cc7a5){return respondWithRpcPromise(_0x1bd5('0x5c'),_0x32a878['query'],routingClient)['then'](function(_0x34f98c){if(_0x32a878['query'][_0x1bd5('0x5e')]!==undefined){var _0x1a4ee6=_(_0x34f98c['rows'])[_0x1bd5('0x5f')]([_0x32a878[_0x1bd5('0x15')][_0x1bd5('0x5e')],_0x32a878[_0x1bd5('0x1a')]['id']])[_0x1bd5('0x60')](_0x1bd5('0x61'))['uniq']()[_0x1bd5('0x62')]();return _0x34f98c[_0x1bd5('0x11')][_0x1bd5('0x5f')](function(_0x1c9cec){return _0x1a4ee6['indexOf'](_0x1c9cec['queue_id'])>-0x1;});}else{return _0x34f98c[_0x1bd5('0x11')][_0x1bd5('0x5f')](function(_0x2fe037){return _0x2fe037[_0x1bd5('0x61')]===parseInt(_0x32a878['params']['id']);});}})[_0x1bd5('0x16')](respondWithResult(_0x4cc7a5,null))['catch'](handleError(_0x4cc7a5,null));};exports['smsQueuesWaitingInteractions']=function(_0x3a203f,_0x5045f9){return respondWithRpcPromise(_0x1bd5('0x63'),_0x3a203f[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x5045f9,null))[_0x1bd5('0xb')](handleError(_0x5045f9,null));};exports[_0x1bd5('0x64')]=function(_0xab4ed6,_0x232077){return respondWithRpcPromise(_0x1bd5('0x65'),_0xab4ed6[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x232077,null))[_0x1bd5('0xb')](handleError(_0x232077,null));};exports['faxQueuesWaitingInteractions']=function(_0x58c715,_0x59b491){return respondWithRpcPromise(_0x1bd5('0x66'),_0x58c715['query'],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x59b491,null))[_0x1bd5('0xb')](handleError(_0x59b491,null));};exports[_0x1bd5('0x67')]=function(_0x4a3f74){return function(_0x201968,_0x91bcf8){var _0x3410f8,_0x52cd5f;var _0xfc9282=_['capitalize'](_0x4a3f74);var _0x327eb6=_0x4a3f74===_0x1bd5('0x68')?_0x1bd5('0x69'):'Account';return db[_0xfc9282+'Queue'][_0x1bd5('0x6a')]({'raw':!![],'where':{'id':_0x201968['params']['id']}})[_0x1bd5('0x16')](function(_0x53be05){if(_[_0x1bd5('0x10')](_0x53be05)){throw new Error(_0xfc9282+_0x1bd5('0x6b'));}_0x3410f8=_0x53be05;return db[_0xfc9282+_0x1bd5('0x6c')][_0x1bd5('0x6a')]({'where':{'id':_0x201968[_0x1bd5('0x22')][_0x1bd5('0x6d')]},'include':[{'model':db[_0xfc9282+_0x1bd5('0x6e')],'as':_0x1bd5('0x6e')},{'model':db[_0xfc9282+_0x327eb6],'as':_0x1bd5('0x6f')}]});})[_0x1bd5('0x16')](function(_0x3c90dc){if(_[_0x1bd5('0x10')](_0x3c90dc)){throw new Error(_0xfc9282+_0x1bd5('0x70'));}_0x52cd5f=_0x3c90dc;return _0x3c90dc[_0x1bd5('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2a1b4a={'uniqueid':_0x4a3f74+'.'+_0x52cd5f['id']+'.'+_0x52cd5f[_0x1bd5('0x6e')]['id'],'FromUserId':_0x201968[_0x1bd5('0x32')]['id'],'type':'queue'};_0x2a1b4a[_0xfc9282+_0x1bd5('0x72')]=_0x52cd5f['id'];_0x2a1b4a[_0xfc9282+_0x1bd5('0x73')]=_0x52cd5f['Interaction']['id'];_0x2a1b4a[_0x1bd5('0x74')+_0xfc9282+_0x327eb6+'Id']=_0x52cd5f[_0x1bd5('0x6f')]['id'];_0x2a1b4a['To'+_0xfc9282+_0x1bd5('0x75')]=_0x3410f8['id'];return db[_0xfc9282+'TransferReport'][_0x1bd5('0x76')](_0x2a1b4a);})[_0x1bd5('0x16')](function(){return respondWithRpcPromise(_0x1bd5('0x77'),{'channel':_0x4a3f74,'interaction':_0x52cd5f[_0x1bd5('0x6e')],'message':_0x52cd5f,'account':_0x52cd5f['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x1bd5('0x78'),'appdata':_0x3410f8[_0x1bd5('0x33')]+','+(_0x52cd5f[_0x1bd5('0x6f')]['queueTransferTimeout']||0x12c),'interval':_0x1bd5('0x79')}]},routingClient);})[_0x1bd5('0x16')](respondWithResult(_0x91bcf8,null))['catch'](handleError(_0x91bcf8,null));};};exports['agentNotify']=function(_0x4230e9,_0x182d75){var _0x5c9098,_0x5d6b17;if(_[_0x1bd5('0x10')](_0x4230e9['body']['channel'])){throw new Error(_0x1bd5('0x7a'));}var _0x5cb13d=_0x4230e9[_0x1bd5('0x22')][_0x1bd5('0x7b')];var _0x5df043=_[_0x1bd5('0x7c')](_0x5cb13d);var _0x254c8d=_0x5cb13d===_0x1bd5('0x68')?'Website':_0x1bd5('0x6f');return db['User'][_0x1bd5('0x6a')]({'raw':!![],'where':{'id':_0x4230e9[_0x1bd5('0x1a')]['id'],'role':_0x1bd5('0x3e')}})[_0x1bd5('0x16')](function(_0x2f9dff){if(_['isNil'](_0x2f9dff)){throw new Error(_0x1bd5('0x7d'));}_0x5c9098=_0x2f9dff;return db[_0x5df043+'Message'][_0x1bd5('0x6a')]({'where':{'id':_0x4230e9['body']['messageId']},'include':[{'model':db[_0x5df043+_0x1bd5('0x6e')],'as':_0x1bd5('0x6e')},{'model':db[_0x5df043+_0x254c8d],'as':_0x1bd5('0x6f')}]});})[_0x1bd5('0x16')](function(_0x4c9931){if(_[_0x1bd5('0x10')](_0x4c9931)){throw new Error(_0x5df043+_0x1bd5('0x70'));}_0x5d6b17=_0x4c9931;return _0x4c9931[_0x1bd5('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1bd5('0x16')](function(){var _0x15e584={'uniqueid':_0x5cb13d+'.'+_0x5d6b17['id']+'.'+_0x5d6b17[_0x1bd5('0x6e')]['id'],'FromUserId':_0x4230e9[_0x1bd5('0x32')]['id'],'type':_0x1bd5('0x78'),'ToUserId':_0x5c9098['id']};_0x15e584[_0x5df043+_0x1bd5('0x72')]=_0x5d6b17['id'];_0x15e584[_0x5df043+_0x1bd5('0x73')]=_0x5d6b17[_0x1bd5('0x6e')]['id'];_0x15e584[_0x1bd5('0x74')+_0x5df043+_0x254c8d+'Id']=_0x5d6b17[_0x1bd5('0x6f')]['id'];return db[_0x5df043+_0x1bd5('0x7e')]['create'](_0x15e584);})[_0x1bd5('0x16')](function(){return respondWithRpcPromise(_0x1bd5('0x77'),{'channel':_0x5cb13d,'interaction':_0x5d6b17[_0x1bd5('0x6e')],'message':_0x5d6b17,'account':_0x5d6b17[_0x1bd5('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1bd5('0x3e'),'appdata':_0x5c9098[_0x1bd5('0x33')]+','+(_0x5d6b17[_0x1bd5('0x6f')][_0x1bd5('0x7f')]||0x12c),'interval':_0x1bd5('0x79')}]},routingClient);})[_0x1bd5('0x16')](respondWithResult(_0x182d75,null))[_0x1bd5('0xb')](handleError(_0x182d75,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d090390..d9f5f9a 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 _0x2e8c=['run','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','show','/:id/run'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2e8c,0xd9));var _0xc2e8=function(_0x181a6c,_0xdb9a9c){_0x181a6c=_0x181a6c-0x0;var _0x22e3c4=_0x2e8c[_0x181a6c];return _0x22e3c4;};'use strict';var multer=require(_0xc2e8('0x0'));var util=require(_0xc2e8('0x1'));var path=require(_0xc2e8('0x2'));var timeout=require(_0xc2e8('0x3'));var express=require(_0xc2e8('0x4'));var router=express[_0xc2e8('0x5')]();var fs_extra=require(_0xc2e8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc2e8('0x7'));var config=require(_0xc2e8('0x8'));var controller=require(_0xc2e8('0x9'));router[_0xc2e8('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc2e8('0xa')]('/:id',auth[_0xc2e8('0xb')](),controller[_0xc2e8('0xc')]);router[_0xc2e8('0xa')](_0xc2e8('0xd'),auth['isAuthenticated'](),controller[_0xc2e8('0xe')]);router['post']('/',auth[_0xc2e8('0xb')](),controller[_0xc2e8('0xf')]);router[_0xc2e8('0x10')](_0xc2e8('0x11'),auth[_0xc2e8('0xb')](),controller[_0xc2e8('0x12')]);router[_0xc2e8('0x13')](_0xc2e8('0x11'),auth[_0xc2e8('0xb')](),controller[_0xc2e8('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3f1a=['express','Router','fs-extra','./schedule.controller','get','isAuthenticated','show','run','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x1cd203,_0x3b71e0){var _0x35cd4=function(_0x340360){while(--_0x340360){_0x1cd203['push'](_0x1cd203['shift']());}};_0x35cd4(++_0x3b71e0);}(_0x3f1a,0x1eb));var _0xa3f1=function(_0x274ccc,_0x3c34d3){_0x274ccc=_0x274ccc-0x0;var _0x20c108=_0x3f1a[_0x274ccc];return _0x20c108;};'use strict';var multer=require(_0xa3f1('0x0'));var util=require(_0xa3f1('0x1'));var path=require('path');var timeout=require(_0xa3f1('0x2'));var express=require(_0xa3f1('0x3'));var router=express[_0xa3f1('0x4')]();var fs_extra=require(_0xa3f1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa3f1('0x6'));router[_0xa3f1('0x7')]('/',auth[_0xa3f1('0x8')](),controller['index']);router[_0xa3f1('0x7')]('/:id',auth[_0xa3f1('0x8')](),controller[_0xa3f1('0x9')]);router[_0xa3f1('0x7')]('/:id/run',auth[_0xa3f1('0x8')](),controller[_0xa3f1('0xa')]);router[_0xa3f1('0xb')]('/',auth[_0xa3f1('0x8')](),controller[_0xa3f1('0xc')]);router[_0xa3f1('0xd')](_0xa3f1('0xe'),auth[_0xa3f1('0x8')](),controller[_0xa3f1('0xf')]);router[_0xa3f1('0x10')]('/:id',auth[_0xa3f1('0x8')](),controller[_0xa3f1('0x11')]);module[_0xa3f1('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 6fddd35..6addecd 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 _0x4e13=['days','hours','minutes','csv','pdf','xlsx','default','custom','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks'];(function(_0x382168,_0xe03b6a){var _0x3ecf7e=function(_0x17b089){while(--_0x17b089){_0x382168['push'](_0x382168['shift']());}};_0x3ecf7e(++_0xe03b6a);}(_0x4e13,0x1a0));var _0x34e1=function(_0x471a85,_0x239e8d){_0x471a85=_0x471a85-0x0;var _0x5f2039=_0x4e13[_0x471a85];return _0x5f2039;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x34e1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x34e1('0x0')]},'active':{'type':Sequelize[_0x34e1('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x34e1('0x0')],'allowNull':![],'defaultValue':_0x34e1('0x2')},'startAt':{'type':Sequelize[_0x34e1('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x34e1('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x34e1('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x34e1('0x5')]('years',_0x34e1('0x6'),_0x34e1('0x7'),_0x34e1('0x8'),_0x34e1('0x9'),_0x34e1('0xa'),_0x34e1('0xb')),'allowNull':![],'defaultValue':_0x34e1('0x9')},'output':{'type':Sequelize[_0x34e1('0x5')](_0x34e1('0xc'),_0x34e1('0xd'),_0x34e1('0xe')),'allowNull':![],'defaultValue':_0x34e1('0xc')},'type':{'type':Sequelize[_0x34e1('0x5')]('custom',_0x34e1('0xf')),'allowNull':![],'defaultValue':_0x34e1('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x34e1('0x0')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x34e1('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x872c=['sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','months','weeks','days','hours','minutes','csv','pdf','xlsx','ENUM','custom','default','TEXT','BOOLEAN'];(function(_0x2e4f49,_0x622233){var _0xd3d791=function(_0x24031f){while(--_0x24031f){_0x2e4f49['push'](_0x2e4f49['shift']());}};_0xd3d791(++_0x622233);}(_0x872c,0xf7));var _0xc872=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x872c[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xc872('0x0'));module[_0xc872('0x1')]={'name':{'type':Sequelize[_0xc872('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc872('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc872('0x3')},'startAt':{'type':Sequelize[_0xc872('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xc872('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc872('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years','quarters',_0xc872('0x6'),_0xc872('0x7'),_0xc872('0x8'),_0xc872('0x9'),_0xc872('0xa')),'allowNull':![],'defaultValue':_0xc872('0x8')},'output':{'type':Sequelize['ENUM'](_0xc872('0xb'),_0xc872('0xc'),_0xc872('0xd')),'allowNull':![],'defaultValue':_0xc872('0xb')},'type':{'type':Sequelize[_0xc872('0xe')](_0xc872('0xf'),_0xc872('0x10')),'allowNull':![],'defaultValue':_0xc872('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xc872('0x2')]},'cc':{'type':Sequelize[_0xc872('0x11')]},'bcc':{'type':Sequelize[_0xc872('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xc872('0x12')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index b4d7e53..56ce598 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 _0xd3dd=['get','Scheduler','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Schedule','includeAll','include','rows','show','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy'];(function(_0xfb4753,_0x38a20a){var _0xd14352=function(_0x3ab5ac){while(--_0x3ab5ac){_0xfb4753['push'](_0xfb4753['shift']());}};_0xd14352(++_0x38a20a);}(_0xd3dd,0x89));var _0xdd3d=function(_0x515652,_0x18657c){_0x515652=_0x515652-0x0;var _0x3a8ea5=_0xd3dd[_0x515652];return _0x3a8ea5;};'use strict';var emlformat=require(_0xdd3d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd3d('0x1'));var jsonpatch=require(_0xdd3d('0x2'));var rp=require(_0xdd3d('0x3'));var moment=require(_0xdd3d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdd3d('0x5'));var util=require(_0xdd3d('0x6'));var path=require(_0xdd3d('0x7'));var sox=require(_0xdd3d('0x8'));var csv=require(_0xdd3d('0x9'));var ejs=require(_0xdd3d('0xa'));var fs=require('fs');var fs_extra=require(_0xdd3d('0xb'));var _=require(_0xdd3d('0xc'));var squel=require(_0xdd3d('0xd'));var crypto=require('crypto');var jsforce=require(_0xdd3d('0xe'));var deskjs=require(_0xdd3d('0xf'));var toCsv=require(_0xdd3d('0x9'));var querystring=require(_0xdd3d('0x10'));var Papa=require(_0xdd3d('0x11'));var Redis=require(_0xdd3d('0x12'));var authService=require(_0xdd3d('0x13'));var qs=require(_0xdd3d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd3d('0x15'));var logger=require(_0xdd3d('0x16'))(_0xdd3d('0x17'));var utils=require(_0xdd3d('0x18'));var config=require(_0xdd3d('0x19'));var licenseUtil=require(_0xdd3d('0x1a'));var db=require(_0xdd3d('0x1b'))['db'];function respondWithStatusCode(_0x34a7ba,_0x2be8d4){_0x2be8d4=_0x2be8d4||0xcc;return function(_0x363529){if(_0x363529){return _0x34a7ba[_0xdd3d('0x1c')](_0x2be8d4);}return _0x34a7ba[_0xdd3d('0x1d')](_0x2be8d4)['end']();};}function respondWithResult(_0xdd4071,_0x3f5c1a){_0x3f5c1a=_0x3f5c1a||0xc8;return function(_0x1476b4){if(_0x1476b4){return _0xdd4071[_0xdd3d('0x1d')](_0x3f5c1a)[_0xdd3d('0x1e')](_0x1476b4);}};}function respondWithFilteredResult(_0x155eda,_0x329f7a){return function(_0x43bfd6){if(_0x43bfd6){var _0x5587f7=typeof _0x329f7a[_0xdd3d('0x1f')]===_0xdd3d('0x20')&&typeof _0x329f7a[_0xdd3d('0x21')]===_0xdd3d('0x20');var _0x34f903=_0x43bfd6[_0xdd3d('0x22')];var _0x4379b5=_0x5587f7?0x0:_0x329f7a[_0xdd3d('0x1f')];var _0x5d5b15=_0x5587f7?_0x43bfd6[_0xdd3d('0x22')]:_0x329f7a[_0xdd3d('0x1f')]+_0x329f7a[_0xdd3d('0x21')];var _0x27cb69;if(_0x5d5b15>=_0x34f903){_0x5d5b15=_0x34f903;_0x27cb69=0xc8;}else{_0x27cb69=0xce;}_0x155eda[_0xdd3d('0x1d')](_0x27cb69);return _0x155eda[_0xdd3d('0x23')](_0xdd3d('0x24'),_0x4379b5+'-'+_0x5d5b15+'/'+_0x34f903)['json'](_0x43bfd6);}return null;};}function patchUpdates(_0x2a1679){return function(_0x4e0101){try{jsonpatch['apply'](_0x4e0101,_0x2a1679,!![]);}catch(_0x94c787){return BPromise['reject'](_0x94c787);}return _0x4e0101[_0xdd3d('0x25')]();};}function saveUpdates(_0x260233,_0x237f46){return function(_0x1f3104){if(_0x1f3104){return _0x1f3104[_0xdd3d('0x26')](_0x260233)[_0xdd3d('0x27')](function(_0x110571){return _0x110571;});}return null;};}function removeEntity(_0x30c08c,_0x301527){return function(_0x5838e6){if(_0x5838e6){return _0x5838e6[_0xdd3d('0x28')]()[_0xdd3d('0x27')](function(){var _0x55f0c7=_0x5838e6[_0xdd3d('0x29')]({'plain':!![]});var _0x21b0e5=_0xdd3d('0x2a');return db[_0xdd3d('0x2b')][_0xdd3d('0x28')]({'where':{'type':_0x21b0e5,'resourceId':_0x55f0c7['id']}})[_0xdd3d('0x27')](function(){return _0x5838e6;});})[_0xdd3d('0x27')](function(){_0x30c08c[_0xdd3d('0x1d')](0xcc)[_0xdd3d('0x2c')]();});}};}function handleEntityNotFound(_0x2b5107,_0x311d22){return function(_0x27fd0f){if(!_0x27fd0f){_0x2b5107['sendStatus'](0x194);}return _0x27fd0f;};}function handleError(_0xc5e6d3,_0x21741c){_0x21741c=_0x21741c||0x1f4;return function(_0x281eca){logger['error'](_0x281eca['stack']);if(_0x281eca[_0xdd3d('0x2d')]){delete _0x281eca[_0xdd3d('0x2d')];}_0xc5e6d3[_0xdd3d('0x1d')](_0x21741c)[_0xdd3d('0x2e')](_0x281eca);};}exports[_0xdd3d('0x2f')]=function(_0x4002a1,_0x26e5af){var _0xe0550c={},_0x1ddd87={},_0x14b28b={'count':0x0,'rows':[]};var _0x348979=_[_0xdd3d('0x30')](db['Schedule'][_0xdd3d('0x31')],function(_0x6c72){return{'name':_0x6c72[_0xdd3d('0x32')],'type':_0x6c72[_0xdd3d('0x33')][_0xdd3d('0x34')]};});_0x1ddd87[_0xdd3d('0x35')]=_['map'](_0x348979,'name');_0x1ddd87[_0xdd3d('0x36')]=_[_0xdd3d('0x37')](_0x4002a1[_0xdd3d('0x36')]);_0x1ddd87[_0xdd3d('0x38')]=_['intersection'](_0x1ddd87[_0xdd3d('0x35')],_0x1ddd87[_0xdd3d('0x36')]);_0xe0550c['attributes']=_[_0xdd3d('0x39')](_0x1ddd87['model'],qs[_0xdd3d('0x3a')](_0x4002a1[_0xdd3d('0x36')][_0xdd3d('0x3a')]));_0xe0550c['attributes']=_0xe0550c[_0xdd3d('0x3b')]['length']?_0xe0550c['attributes']:_0x1ddd87['model'];if(!_0x4002a1[_0xdd3d('0x36')][_0xdd3d('0x3c')]('nolimit')){_0xe0550c[_0xdd3d('0x21')]=qs[_0xdd3d('0x21')](_0x4002a1[_0xdd3d('0x36')][_0xdd3d('0x21')]);_0xe0550c[_0xdd3d('0x1f')]=qs['offset'](_0x4002a1['query'][_0xdd3d('0x1f')]);}_0xe0550c[_0xdd3d('0x3d')]=qs[_0xdd3d('0x3e')](_0x4002a1[_0xdd3d('0x36')]['sort']);_0xe0550c[_0xdd3d('0x3f')]=qs['filters'](_[_0xdd3d('0x40')](_0x4002a1[_0xdd3d('0x36')],_0x1ddd87[_0xdd3d('0x38')]),_0x348979);if(_0x4002a1[_0xdd3d('0x36')][_0xdd3d('0x41')]){_0xe0550c[_0xdd3d('0x3f')]=_[_0xdd3d('0x42')](_0xe0550c['where'],{'$or':_['map'](_0x348979,function(_0x4120c7){if(_0x4120c7[_0xdd3d('0x33')]!==_0xdd3d('0x43')){var _0x447815={};_0x447815[_0x4120c7[_0xdd3d('0x2d')]]={'$like':'%'+_0x4002a1[_0xdd3d('0x36')][_0xdd3d('0x41')]+'%'};return _0x447815;}})});}_0xe0550c=_[_0xdd3d('0x42')]({},_0xe0550c,_0x4002a1[_0xdd3d('0x44')]);var _0x16f46a={'where':_0xe0550c[_0xdd3d('0x3f')]};return db[_0xdd3d('0x45')][_0xdd3d('0x22')](_0x16f46a)[_0xdd3d('0x27')](function(_0x2e7e09){_0x14b28b[_0xdd3d('0x22')]=_0x2e7e09;if(_0x4002a1[_0xdd3d('0x36')][_0xdd3d('0x46')]){_0xe0550c[_0xdd3d('0x47')]=[{'all':!![]}];}return db[_0xdd3d('0x45')]['findAll'](_0xe0550c);})[_0xdd3d('0x27')](function(_0x55ca04){_0x14b28b[_0xdd3d('0x48')]=_0x55ca04;return _0x14b28b;})[_0xdd3d('0x27')](respondWithFilteredResult(_0x26e5af,_0xe0550c))['catch'](handleError(_0x26e5af,null));};exports[_0xdd3d('0x49')]=function(_0x32c95f,_0x172ffe){var _0x118221={'raw':![],'where':{'id':_0x32c95f['params']['id']}},_0x267b40={};_0x267b40['model']=_[_0xdd3d('0x37')](db[_0xdd3d('0x45')][_0xdd3d('0x31')]);_0x267b40[_0xdd3d('0x36')]=_['keys'](_0x32c95f[_0xdd3d('0x36')]);_0x267b40[_0xdd3d('0x38')]=_[_0xdd3d('0x39')](_0x267b40['model'],_0x267b40[_0xdd3d('0x36')]);_0x118221[_0xdd3d('0x3b')]=_['intersection'](_0x267b40[_0xdd3d('0x35')],qs[_0xdd3d('0x3a')](_0x32c95f['query'][_0xdd3d('0x3a')]));_0x118221['attributes']=_0x118221[_0xdd3d('0x3b')][_0xdd3d('0x4a')]?_0x118221[_0xdd3d('0x3b')]:_0x267b40[_0xdd3d('0x35')];if(_0x32c95f[_0xdd3d('0x36')][_0xdd3d('0x46')]){_0x118221['include']=[{'all':!![]}];}_0x118221=_[_0xdd3d('0x42')]({},_0x118221,_0x32c95f['options']);return db[_0xdd3d('0x45')][_0xdd3d('0x4b')](_0x118221)[_0xdd3d('0x27')](handleEntityNotFound(_0x172ffe,null))[_0xdd3d('0x27')](respondWithResult(_0x172ffe,null))[_0xdd3d('0x4c')](handleError(_0x172ffe,null));};exports[_0xdd3d('0x4d')]=function(_0x5cce7d,_0x319c76){return db[_0xdd3d('0x45')][_0xdd3d('0x4d')](_0x5cce7d[_0xdd3d('0x4e')],{})[_0xdd3d('0x27')](function(_0x2fa5c2){var _0x4198d5=_0x5cce7d[_0xdd3d('0x4f')]['get']({'plain':!![]});if(!_0x4198d5)throw new Error(_0xdd3d('0x50'));if(_0x4198d5['role']===_0xdd3d('0x4f')){var _0x34aab6=_0x2fa5c2['get']({'plain':!![]});var _0x5c2aa5='Scheduler';return db[_0xdd3d('0x51')]['find']({'where':{'name':_0x5c2aa5,'userProfileId':_0x4198d5[_0xdd3d('0x52')]},'raw':!![]})[_0xdd3d('0x27')](function(_0x11f18d){if(_0x11f18d&&_0x11f18d[_0xdd3d('0x53')]===0x0){return db[_0xdd3d('0x2b')][_0xdd3d('0x4d')]({'name':_0x34aab6[_0xdd3d('0x2d')],'resourceId':_0x34aab6['id'],'type':_0x11f18d[_0xdd3d('0x2d')],'sectionId':_0x11f18d['id']},{})[_0xdd3d('0x27')](function(){return _0x2fa5c2;});}else{return _0x2fa5c2;}})['catch'](function(_0x2b0439){logger[_0xdd3d('0x54')](_0xdd3d('0x55'),_0x2b0439);throw _0x2b0439;});}return _0x2fa5c2;})[_0xdd3d('0x27')](respondWithResult(_0x319c76,0xc9))[_0xdd3d('0x4c')](handleError(_0x319c76,null));};exports['update']=function(_0x229e79,_0x19e8d9){if(_0x229e79[_0xdd3d('0x4e')]['id']){delete _0x229e79['body']['id'];}return db[_0xdd3d('0x45')][_0xdd3d('0x4b')]({'where':{'id':_0x229e79[_0xdd3d('0x56')]['id']}})[_0xdd3d('0x27')](handleEntityNotFound(_0x19e8d9,null))[_0xdd3d('0x27')](saveUpdates(_0x229e79[_0xdd3d('0x4e')],null))[_0xdd3d('0x27')](respondWithResult(_0x19e8d9,null))[_0xdd3d('0x4c')](handleError(_0x19e8d9,null));};exports['destroy']=function(_0x3feaa0,_0x300eda){return db[_0xdd3d('0x45')][_0xdd3d('0x4b')]({'where':{'id':_0x3feaa0['params']['id']}})[_0xdd3d('0x27')](handleEntityNotFound(_0x300eda,null))[_0xdd3d('0x27')](removeEntity(_0x300eda,null))[_0xdd3d('0x4c')](handleError(_0x300eda,null));};exports[_0xdd3d('0x57')]=function(_0x300518,_0x23b2c6,_0x43e260){var _0x2a3350=require(_0xdd3d('0x58'));return db[_0xdd3d('0x45')][_0xdd3d('0x4b')]({'where':{'id':_0x300518[_0xdd3d('0x56')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x23b2c6,null))[_0xdd3d('0x27')](function(){_0x2a3350[_0xdd3d('0x57')](_0x300518['params']['id']);})[_0xdd3d('0x27')](respondWithStatusCode(_0x23b2c6,null))[_0xdd3d('0x4c')](handleError(_0x23b2c6,null));}; \ No newline at end of file +var _0xbac5=['fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','zip-dir','fast-json-patch','moment','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','reject','save','then','get','Scheduler','UserProfileResource','destroy','error','name','send','map','Schedule'];(function(_0x592416,_0x2c75e9){var _0x3005fa=function(_0x21d0dd){while(--_0x21d0dd){_0x592416['push'](_0x592416['shift']());}};_0x3005fa(++_0x2c75e9);}(_0xbac5,0x7a));var _0x5bac=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0xbac5[_0x207d2f];return _0x3c3498;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5bac('0x0'));var jsonpatch=require(_0x5bac('0x1'));var rp=require('request-promise');var moment=require(_0x5bac('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5bac('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5bac('0x4'));var fs=require('fs');var fs_extra=require(_0x5bac('0x5'));var _=require(_0x5bac('0x6'));var squel=require(_0x5bac('0x7'));var crypto=require('crypto');var jsforce=require(_0x5bac('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x5bac('0x9'));var querystring=require(_0x5bac('0xa'));var Papa=require(_0x5bac('0xb'));var Redis=require(_0x5bac('0xc'));var authService=require(_0x5bac('0xd'));var qs=require(_0x5bac('0xe'));var as=require(_0x5bac('0xf'));var hardwareService=require(_0x5bac('0x10'));var logger=require('../../config/logger')(_0x5bac('0x11'));var utils=require(_0x5bac('0x12'));var config=require(_0x5bac('0x13'));var licenseUtil=require(_0x5bac('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10d2d7,_0x372d83){_0x372d83=_0x372d83||0xcc;return function(_0x29a2df){if(_0x29a2df){return _0x10d2d7[_0x5bac('0x15')](_0x372d83);}return _0x10d2d7[_0x5bac('0x16')](_0x372d83)[_0x5bac('0x17')]();};}function respondWithResult(_0x2e8482,_0x4494ef){_0x4494ef=_0x4494ef||0xc8;return function(_0x1439bd){if(_0x1439bd){return _0x2e8482[_0x5bac('0x16')](_0x4494ef)[_0x5bac('0x18')](_0x1439bd);}};}function respondWithFilteredResult(_0x2b1662,_0x49f0e1){return function(_0x19bbc5){if(_0x19bbc5){var _0x35c2ca=typeof _0x49f0e1['offset']===_0x5bac('0x19')&&typeof _0x49f0e1['limit']===_0x5bac('0x19');var _0x196f49=_0x19bbc5['count'];var _0x4e349d=_0x35c2ca?0x0:_0x49f0e1[_0x5bac('0x1a')];var _0x5cecd4=_0x35c2ca?_0x19bbc5[_0x5bac('0x1b')]:_0x49f0e1[_0x5bac('0x1a')]+_0x49f0e1[_0x5bac('0x1c')];var _0x4a1037;if(_0x5cecd4>=_0x196f49){_0x5cecd4=_0x196f49;_0x4a1037=0xc8;}else{_0x4a1037=0xce;}_0x2b1662[_0x5bac('0x16')](_0x4a1037);return _0x2b1662['set'](_0x5bac('0x1d'),_0x4e349d+'-'+_0x5cecd4+'/'+_0x196f49)[_0x5bac('0x18')](_0x19bbc5);}return null;};}function patchUpdates(_0x574eb0){return function(_0x3a0c5f){try{jsonpatch['apply'](_0x3a0c5f,_0x574eb0,!![]);}catch(_0x1fcf65){return BPromise[_0x5bac('0x1e')](_0x1fcf65);}return _0x3a0c5f[_0x5bac('0x1f')]();};}function saveUpdates(_0x4a9bac,_0x39dae4){return function(_0x2c0ca5){if(_0x2c0ca5){return _0x2c0ca5['update'](_0x4a9bac)['then'](function(_0x282339){return _0x282339;});}return null;};}function removeEntity(_0x115f56,_0x6c4803){return function(_0x3ea80e){if(_0x3ea80e){return _0x3ea80e['destroy']()[_0x5bac('0x20')](function(){var _0x5a14bd=_0x3ea80e[_0x5bac('0x21')]({'plain':!![]});var _0x21aaa5=_0x5bac('0x22');return db[_0x5bac('0x23')][_0x5bac('0x24')]({'where':{'type':_0x21aaa5,'resourceId':_0x5a14bd['id']}})[_0x5bac('0x20')](function(){return _0x3ea80e;});})[_0x5bac('0x20')](function(){_0x115f56[_0x5bac('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8bca,_0x7525dd){return function(_0x1cef32){if(!_0x1cef32){_0x5d8bca[_0x5bac('0x15')](0x194);}return _0x1cef32;};}function handleError(_0x2d6650,_0xd41388){_0xd41388=_0xd41388||0x1f4;return function(_0x422bdf){logger[_0x5bac('0x25')](_0x422bdf['stack']);if(_0x422bdf[_0x5bac('0x26')]){delete _0x422bdf[_0x5bac('0x26')];}_0x2d6650[_0x5bac('0x16')](_0xd41388)[_0x5bac('0x27')](_0x422bdf);};}exports['index']=function(_0x339f41,_0x422dc1){var _0x136566={},_0x337fd4={},_0x35f502={'count':0x0,'rows':[]};var _0x566aba=_[_0x5bac('0x28')](db[_0x5bac('0x29')]['rawAttributes'],function(_0x485943){return{'name':_0x485943[_0x5bac('0x2a')],'type':_0x485943['type'][_0x5bac('0x2b')]};});_0x337fd4['model']=_[_0x5bac('0x28')](_0x566aba,_0x5bac('0x26'));_0x337fd4[_0x5bac('0x2c')]=_['keys'](_0x339f41['query']);_0x337fd4[_0x5bac('0x2d')]=_[_0x5bac('0x2e')](_0x337fd4[_0x5bac('0x2f')],_0x337fd4['query']);_0x136566[_0x5bac('0x30')]=_[_0x5bac('0x2e')](_0x337fd4['model'],qs[_0x5bac('0x31')](_0x339f41[_0x5bac('0x2c')][_0x5bac('0x31')]));_0x136566[_0x5bac('0x30')]=_0x136566[_0x5bac('0x30')][_0x5bac('0x32')]?_0x136566['attributes']:_0x337fd4['model'];if(!_0x339f41[_0x5bac('0x2c')][_0x5bac('0x33')](_0x5bac('0x34'))){_0x136566['limit']=qs['limit'](_0x339f41[_0x5bac('0x2c')][_0x5bac('0x1c')]);_0x136566[_0x5bac('0x1a')]=qs[_0x5bac('0x1a')](_0x339f41[_0x5bac('0x2c')]['offset']);}_0x136566[_0x5bac('0x35')]=qs[_0x5bac('0x36')](_0x339f41['query'][_0x5bac('0x36')]);_0x136566[_0x5bac('0x37')]=qs['filters'](_[_0x5bac('0x38')](_0x339f41['query'],_0x337fd4[_0x5bac('0x2d')]),_0x566aba);if(_0x339f41['query'][_0x5bac('0x39')]){_0x136566['where']=_[_0x5bac('0x3a')](_0x136566['where'],{'$or':_[_0x5bac('0x28')](_0x566aba,function(_0x2e08ac){if(_0x2e08ac[_0x5bac('0x3b')]!==_0x5bac('0x3c')){var _0x12671c={};_0x12671c[_0x2e08ac['name']]={'$like':'%'+_0x339f41[_0x5bac('0x2c')]['filter']+'%'};return _0x12671c;}})});}_0x136566=_[_0x5bac('0x3a')]({},_0x136566,_0x339f41[_0x5bac('0x3d')]);var _0x3654a0={'where':_0x136566[_0x5bac('0x37')]};return db[_0x5bac('0x29')][_0x5bac('0x1b')](_0x3654a0)[_0x5bac('0x20')](function(_0x42976e){_0x35f502[_0x5bac('0x1b')]=_0x42976e;if(_0x339f41[_0x5bac('0x2c')][_0x5bac('0x3e')]){_0x136566[_0x5bac('0x3f')]=[{'all':!![]}];}return db['Schedule'][_0x5bac('0x40')](_0x136566);})[_0x5bac('0x20')](function(_0x54424b){_0x35f502[_0x5bac('0x41')]=_0x54424b;return _0x35f502;})[_0x5bac('0x20')](respondWithFilteredResult(_0x422dc1,_0x136566))[_0x5bac('0x42')](handleError(_0x422dc1,null));};exports[_0x5bac('0x43')]=function(_0x15dbd7,_0xf62601){var _0xb46fd7={'raw':![],'where':{'id':_0x15dbd7[_0x5bac('0x44')]['id']}},_0x298ccb={};_0x298ccb[_0x5bac('0x2f')]=_['keys'](db[_0x5bac('0x29')][_0x5bac('0x45')]);_0x298ccb[_0x5bac('0x2c')]=_[_0x5bac('0x46')](_0x15dbd7[_0x5bac('0x2c')]);_0x298ccb[_0x5bac('0x2d')]=_[_0x5bac('0x2e')](_0x298ccb[_0x5bac('0x2f')],_0x298ccb[_0x5bac('0x2c')]);_0xb46fd7[_0x5bac('0x30')]=_['intersection'](_0x298ccb[_0x5bac('0x2f')],qs['fields'](_0x15dbd7[_0x5bac('0x2c')][_0x5bac('0x31')]));_0xb46fd7[_0x5bac('0x30')]=_0xb46fd7[_0x5bac('0x30')][_0x5bac('0x32')]?_0xb46fd7['attributes']:_0x298ccb[_0x5bac('0x2f')];if(_0x15dbd7[_0x5bac('0x2c')][_0x5bac('0x3e')]){_0xb46fd7[_0x5bac('0x3f')]=[{'all':!![]}];}_0xb46fd7=_[_0x5bac('0x3a')]({},_0xb46fd7,_0x15dbd7[_0x5bac('0x3d')]);return db[_0x5bac('0x29')][_0x5bac('0x47')](_0xb46fd7)[_0x5bac('0x20')](handleEntityNotFound(_0xf62601,null))[_0x5bac('0x20')](respondWithResult(_0xf62601,null))[_0x5bac('0x42')](handleError(_0xf62601,null));};exports[_0x5bac('0x48')]=function(_0x541043,_0x4eab72){return db[_0x5bac('0x29')][_0x5bac('0x48')](_0x541043[_0x5bac('0x49')],{})[_0x5bac('0x20')](function(_0x3d361c){var _0x17f73e=_0x541043[_0x5bac('0x4a')]['get']({'plain':!![]});if(!_0x17f73e)throw new Error(_0x5bac('0x4b'));if(_0x17f73e[_0x5bac('0x4c')]==='user'){var _0x4e391a=_0x3d361c[_0x5bac('0x21')]({'plain':!![]});var _0x4c56c3=_0x5bac('0x22');return db[_0x5bac('0x4d')][_0x5bac('0x47')]({'where':{'name':_0x4c56c3,'userProfileId':_0x17f73e[_0x5bac('0x4e')]},'raw':!![]})[_0x5bac('0x20')](function(_0x27df42){if(_0x27df42&&_0x27df42[_0x5bac('0x4f')]===0x0){return db[_0x5bac('0x23')][_0x5bac('0x48')]({'name':_0x4e391a['name'],'resourceId':_0x4e391a['id'],'type':_0x27df42[_0x5bac('0x26')],'sectionId':_0x27df42['id']},{})['then'](function(){return _0x3d361c;});}else{return _0x3d361c;}})[_0x5bac('0x42')](function(_0x12f879){logger[_0x5bac('0x25')](_0x5bac('0x50'),_0x12f879);throw _0x12f879;});}return _0x3d361c;})[_0x5bac('0x20')](respondWithResult(_0x4eab72,0xc9))[_0x5bac('0x42')](handleError(_0x4eab72,null));};exports[_0x5bac('0x51')]=function(_0x133b90,_0x4872db){if(_0x133b90[_0x5bac('0x49')]['id']){delete _0x133b90[_0x5bac('0x49')]['id'];}return db['Schedule'][_0x5bac('0x47')]({'where':{'id':_0x133b90[_0x5bac('0x44')]['id']}})[_0x5bac('0x20')](handleEntityNotFound(_0x4872db,null))[_0x5bac('0x20')](saveUpdates(_0x133b90[_0x5bac('0x49')],null))['then'](respondWithResult(_0x4872db,null))[_0x5bac('0x42')](handleError(_0x4872db,null));};exports[_0x5bac('0x24')]=function(_0x22173,_0x5cdbc2){return db['Schedule'][_0x5bac('0x47')]({'where':{'id':_0x22173[_0x5bac('0x44')]['id']}})[_0x5bac('0x20')](handleEntityNotFound(_0x5cdbc2,null))[_0x5bac('0x20')](removeEntity(_0x5cdbc2,null))[_0x5bac('0x42')](handleError(_0x5cdbc2,null));};exports['run']=function(_0x7dfb3,_0x2615a4,_0x5c135){var _0x353650=require('../../config/schedule');return db[_0x5bac('0x29')][_0x5bac('0x47')]({'where':{'id':_0x7dfb3['params']['id']},'raw':!![]})[_0x5bac('0x20')](handleEntityNotFound(_0x2615a4,null))[_0x5bac('0x20')](function(){_0x353650['run'](_0x7dfb3[_0x5bac('0x44')]['id']);})[_0x5bac('0x20')](respondWithStatusCode(_0x2615a4,null))['catch'](handleError(_0x2615a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 42d2b46..42878b8 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 _0xf26b=['Schedule','tools_schedules','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./schedule.attributes','exports','define'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf26b,0x7a));var _0xbf26=function(_0x5dbf38,_0x1ff06d){_0x5dbf38=_0x5dbf38-0x0;var _0x4ea452=_0xf26b[_0x5dbf38];return _0x4ea452;};'use strict';var _=require(_0xbf26('0x0'));var util=require(_0xbf26('0x1'));var logger=require(_0xbf26('0x2'))('api');var moment=require(_0xbf26('0x3'));var BPromise=require('bluebird');var rp=require(_0xbf26('0x4'));var fs=require('fs');var path=require(_0xbf26('0x5'));var rimraf=require('rimraf');var config=require(_0xbf26('0x6'));var attributes=require(_0xbf26('0x7'));module[_0xbf26('0x8')]=function(_0x47f392,_0x10a572){return _0x47f392[_0xbf26('0x9')](_0xbf26('0xa'),attributes,{'tableName':_0xbf26('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b5b=['define','tools_schedules','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports'];(function(_0xe1ab3a,_0x5b6175){var _0x55c798=function(_0x13ea69){while(--_0x13ea69){_0xe1ab3a['push'](_0xe1ab3a['shift']());}};_0x55c798(++_0x5b6175);}(_0x4b5b,0x146));var _0xb4b5=function(_0x54e4eb,_0x4c8d50){_0x54e4eb=_0x54e4eb-0x0;var _0xeec1fe=_0x4b5b[_0x54e4eb];return _0xeec1fe;};'use strict';var _=require(_0xb4b5('0x0'));var util=require('util');var logger=require(_0xb4b5('0x1'))(_0xb4b5('0x2'));var moment=require('moment');var BPromise=require(_0xb4b5('0x3'));var rp=require(_0xb4b5('0x4'));var fs=require('fs');var path=require(_0xb4b5('0x5'));var rimraf=require(_0xb4b5('0x6'));var config=require(_0xb4b5('0x7'));var attributes=require(_0xb4b5('0x8'));module[_0xb4b5('0x9')]=function(_0x52dca3,_0x24618a){return _0x52dca3[_0xb4b5('0xa')]('Schedule',attributes,{'tableName':_0xb4b5('0xb'),'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 d616464..6c695c1 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 _0x4f6d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','Schedule,\x20%s,\x20%s','message','result','lodash','moment'];(function(_0x546867,_0x1cab21){var _0x43cafe=function(_0x255204){while(--_0x255204){_0x546867['push'](_0x546867['shift']());}};_0x43cafe(++_0x1cab21);}(_0x4f6d,0x112));var _0xd4f6=function(_0x2fbe18,_0x4620b5){_0x2fbe18=_0x2fbe18-0x0;var _0x2f8808=_0x4f6d[_0x2fbe18];return _0x2f8808;};'use strict';var _=require(_0xd4f6('0x0'));var util=require('util');var moment=require(_0xd4f6('0x1'));var BPromise=require(_0xd4f6('0x2'));var rs=require(_0xd4f6('0x3'));var fs=require('fs');var Redis=require(_0xd4f6('0x4'));var db=require(_0xd4f6('0x5'))['db'];var utils=require(_0xd4f6('0x6'));var logger=require(_0xd4f6('0x7'))(_0xd4f6('0x8'));var config=require(_0xd4f6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd4f6('0xa')][_0xd4f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25218c,_0x451599,_0x20e808){return new BPromise(function(_0x91919e,_0x12cf2b){return client[_0xd4f6('0xc')](_0x25218c,_0x20e808)[_0xd4f6('0xd')](function(_0x29ca1a){logger[_0xd4f6('0xe')]('Schedule,\x20%s,\x20%s',_0x451599,_0xd4f6('0xf'));logger[_0xd4f6('0x10')](_0xd4f6('0x11'),_0x451599,'request\x20sent',JSON['stringify'](_0x29ca1a));if(_0x29ca1a[_0xd4f6('0x12')]){if(_0x29ca1a[_0xd4f6('0x12')][_0xd4f6('0x13')]===0x1f4){logger[_0xd4f6('0x12')](_0xd4f6('0x14'),_0x451599,_0x29ca1a[_0xd4f6('0x12')][_0xd4f6('0x15')]);return _0x12cf2b(_0x29ca1a[_0xd4f6('0x12')]['message']);}logger[_0xd4f6('0x12')](_0xd4f6('0x14'),_0x451599,_0x29ca1a[_0xd4f6('0x12')][_0xd4f6('0x15')]);return _0x91919e(_0x29ca1a['error'][_0xd4f6('0x15')]);}else{logger[_0xd4f6('0xe')](_0xd4f6('0x14'),_0x451599,'request\x20sent');_0x91919e(_0x29ca1a[_0xd4f6('0x16')]['message']);}})['catch'](function(_0xebc6fa){logger[_0xd4f6('0x12')](_0xd4f6('0x14'),_0x451599,_0xebc6fa);_0x12cf2b(_0xebc6fa);});});} \ No newline at end of file +var _0x9634=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x3248a3,_0x5d63c7){var _0x3ed7e0=function(_0x3602b1){while(--_0x3602b1){_0x3248a3['push'](_0x3248a3['shift']());}};_0x3ed7e0(++_0x5d63c7);}(_0x9634,0xa7));var _0x4963=function(_0x5cc79d,_0x2a58f1){_0x5cc79d=_0x5cc79d-0x0;var _0x588954=_0x9634[_0x5cc79d];return _0x588954;};'use strict';var _=require(_0x4963('0x0'));var util=require(_0x4963('0x1'));var moment=require(_0x4963('0x2'));var BPromise=require(_0x4963('0x3'));var rs=require(_0x4963('0x4'));var fs=require('fs');var Redis=require(_0x4963('0x5'));var db=require(_0x4963('0x6'))['db'];var utils=require(_0x4963('0x7'));var logger=require(_0x4963('0x8'))(_0x4963('0x9'));var config=require(_0x4963('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4963('0xb')][_0x4963('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x521d3e,_0x3f2654,_0x24f53b){return new BPromise(function(_0x3d6dd8,_0x3ff752){return client[_0x4963('0xd')](_0x521d3e,_0x24f53b)[_0x4963('0xe')](function(_0x29612a){logger['info'](_0x4963('0xf'),_0x3f2654,_0x4963('0x10'));logger['debug'](_0x4963('0x11'),_0x3f2654,_0x4963('0x10'),JSON[_0x4963('0x12')](_0x29612a));if(_0x29612a[_0x4963('0x13')]){if(_0x29612a[_0x4963('0x13')][_0x4963('0x14')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x3f2654,_0x29612a[_0x4963('0x13')]['message']);return _0x3ff752(_0x29612a[_0x4963('0x13')][_0x4963('0x15')]);}logger[_0x4963('0x13')]('Schedule,\x20%s,\x20%s',_0x3f2654,_0x29612a[_0x4963('0x13')]['message']);return _0x3d6dd8(_0x29612a['error'][_0x4963('0x15')]);}else{logger['info'](_0x4963('0xf'),_0x3f2654,_0x4963('0x10'));_0x3d6dd8(_0x29612a[_0x4963('0x16')]['message']);}})['catch'](function(_0x4a9126){logger[_0x4963('0x13')]('Schedule,\x20%s,\x20%s',_0x3f2654,_0x4a9126);_0x3ff752(_0x4a9126);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 731868a..56dfd17 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 _0xbc4b=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','create','/:id','destroy','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbc4b,0x15e));var _0xbbc4=function(_0x3f6b79,_0x4b1ab4){_0x3f6b79=_0x3f6b79-0x0;var _0xf983f7=_0xbc4b[_0x3f6b79];return _0xf983f7;};'use strict';var multer=require(_0xbbc4('0x0'));var util=require(_0xbbc4('0x1'));var path=require(_0xbbc4('0x2'));var timeout=require(_0xbbc4('0x3'));var express=require(_0xbbc4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbbc4('0x5'));var interaction=require(_0xbbc4('0x6'));var config=require(_0xbbc4('0x7'));var controller=require(_0xbbc4('0x8'));router[_0xbbc4('0x9')]('/',auth[_0xbbc4('0xa')](),controller[_0xbbc4('0xb')]);router['get'](_0xbbc4('0xc'),auth['isAuthenticated'](),controller[_0xbbc4('0xd')]);router[_0xbbc4('0x9')]('/:id',auth[_0xbbc4('0xa')](),controller[_0xbbc4('0xe')]);router['get'](_0xbbc4('0xf'),auth[_0xbbc4('0xa')](),controller[_0xbbc4('0x10')]);router[_0xbbc4('0x11')]('/',auth[_0xbbc4('0xa')](),controller[_0xbbc4('0x12')]);router['put'](_0xbbc4('0x13'),auth[_0xbbc4('0xa')](),controller['update']);router['delete'](_0xbbc4('0x13'),auth[_0xbbc4('0xa')](),controller[_0xbbc4('0x14')]);module[_0xbbc4('0x15')]=router; \ No newline at end of file +var _0x6d67=['update','delete','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','describe','/:id','show','get','download','post','create','put'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0x6d67,0x156));var _0x76d6=function(_0x3fd0f5,_0x41f452){_0x3fd0f5=_0x3fd0f5-0x0;var _0x2bed8f=_0x6d67[_0x3fd0f5];return _0x2bed8f;};'use strict';var multer=require(_0x76d6('0x0'));var util=require('util');var path=require(_0x76d6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x76d6('0x2')]();var fs_extra=require(_0x76d6('0x3'));var auth=require(_0x76d6('0x4'));var interaction=require(_0x76d6('0x5'));var config=require(_0x76d6('0x6'));var controller=require(_0x76d6('0x7'));router['get']('/',auth[_0x76d6('0x8')](),controller[_0x76d6('0x9')]);router['get']('/describe',auth[_0x76d6('0x8')](),controller[_0x76d6('0xa')]);router['get'](_0x76d6('0xb'),auth[_0x76d6('0x8')](),controller[_0x76d6('0xc')]);router[_0x76d6('0xd')]('/:id/download',auth[_0x76d6('0x8')](),controller[_0x76d6('0xe')]);router[_0x76d6('0xf')]('/',auth[_0x76d6('0x8')](),controller[_0x76d6('0x10')]);router[_0x76d6('0x11')](_0x76d6('0xb'),auth[_0x76d6('0x8')](),controller[_0x76d6('0x12')]);router[_0x76d6('0x13')](_0x76d6('0xb'),auth[_0x76d6('0x8')](),controller['destroy']);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 8ce561a..eadce51 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 _0x7d06=['format','DATE','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','startedAt','subtract','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7d06,0x158));var _0x67d0=function(_0x51c3e1,_0x4463b7){_0x51c3e1=_0x51c3e1-0x0;var _0x3db8b8=_0x7d06[_0x51c3e1];return _0x3db8b8;};'use strict';var Sequelize=require(_0x67d0('0x0'));var moment=require(_0x67d0('0x1'));var path=require(_0x67d0('0x2'));var config=require(_0x67d0('0x3'));module[_0x67d0('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x67d0('0x5')](_0x67d0('0x6'))?path[_0x67d0('0x7')](this['getDataValue'](_0x67d0('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x67d0('0x8')]},'value':{'type':Sequelize[_0x67d0('0x8')],'set':function(_0x367f1d){var _0xe4789b=_0x367f1d[_0x67d0('0x9')](/\\/g,'/');this['setDataValue'](_0x67d0('0x6'),_0xe4789b);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x67d0('0xa')],'set':function(_0x5916d0){this[_0x67d0('0xb')](_0x67d0('0xc'),moment()[_0x67d0('0xd')](_0x5916d0,'ms'));this[_0x67d0('0xb')]('closedAt',moment());this[_0x67d0('0xb')]('duration',_0x5916d0);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x67d0('0x5')](_0x67d0('0xc')))['format'](_0x67d0('0xe'))[_0x67d0('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x67d0('0x5')]('closedAt'))[_0x67d0('0x10')](_0x67d0('0xe'))[_0x67d0('0xf')]();}},'createdAt':{'type':Sequelize[_0x67d0('0x11')],'get':function(){return moment(this[_0x67d0('0x5')](_0x67d0('0x12')))[_0x67d0('0x10')](_0x67d0('0xe'))[_0x67d0('0xf')]();}},'updatedAt':{'type':Sequelize[_0x67d0('0x11')],'get':function(){return moment(this['getDataValue'](_0x67d0('0x13')))[_0x67d0('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x67d0('0xf')]();}}}; \ No newline at end of file +var _0xfb11=['subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','path','../../config/environment','VIRTUAL','value','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt'];(function(_0xde0a7f,_0x33437f){var _0x1b5b69=function(_0x5d9805){while(--_0x5d9805){_0xde0a7f['push'](_0xde0a7f['shift']());}};_0x1b5b69(++_0x33437f);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xfb11[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0x1fb1('0x0'));var moment=require('moment');var path=require(_0x1fb1('0x1'));var config=require(_0x1fb1('0x2'));module['exports']={'format':{'type':Sequelize[_0x1fb1('0x3')],'get':function(){return this['getDataValue'](_0x1fb1('0x4'))?path['extname'](this[_0x1fb1('0x5')](_0x1fb1('0x4'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1fb1('0x6')]},'value':{'type':Sequelize[_0x1fb1('0x6')],'set':function(_0x4c098d){var _0x1859da=_0x4c098d[_0x1fb1('0x7')](/\\/g,'/');this[_0x1fb1('0x8')](_0x1fb1('0x4'),_0x1859da);}},'rating':{'type':Sequelize[_0x1fb1('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x1fb1('0x9')],'set':function(_0x438d15){this[_0x1fb1('0x8')](_0x1fb1('0xa'),moment()[_0x1fb1('0xb')](_0x438d15,'ms'));this['setDataValue'](_0x1fb1('0xc'),moment());this['setDataValue'](_0x1fb1('0xd'),_0x438d15);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1fb1('0x5')](_0x1fb1('0xa')))[_0x1fb1('0xe')](_0x1fb1('0xf'))[_0x1fb1('0x10')]();}},'closedAt':{'type':Sequelize[_0x1fb1('0x11')],'get':function(){return moment(this['getDataValue'](_0x1fb1('0xc')))[_0x1fb1('0xe')](_0x1fb1('0xf'))[_0x1fb1('0x10')]();}},'createdAt':{'type':Sequelize[_0x1fb1('0x11')],'get':function(){return moment(this[_0x1fb1('0x5')](_0x1fb1('0x12')))[_0x1fb1('0xe')](_0x1fb1('0xf'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1fb1('0x5')](_0x1fb1('0x13')))[_0x1fb1('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x1fb1('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index c6567e2..9c54c81 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 _0x33c5=['download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','catch','create','body','duration','createdAt','closedAt','value','describe'];(function(_0x3f7188,_0x458aca){var _0x5197b2=function(_0x5918f5){while(--_0x5918f5){_0x3f7188['push'](_0x3f7188['shift']());}};_0x5197b2(++_0x458aca);}(_0x33c5,0xe6));var _0x533c=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0x33c5[_0x3a9635];return _0x10d08c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x533c('0x0'));var zipdir=require(_0x533c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x533c('0x2'));var moment=require(_0x533c('0x3'));var BPromise=require(_0x533c('0x4'));var Mustache=require(_0x533c('0x5'));var util=require(_0x533c('0x6'));var path=require('path');var sox=require(_0x533c('0x7'));var csv=require(_0x533c('0x8'));var ejs=require(_0x533c('0x9'));var fs=require('fs');var fs_extra=require(_0x533c('0xa'));var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x8'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];function respondWithStatusCode(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xcc;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0x1c')](_0x5c9462);}return _0x530e10[_0x533c('0x1d')](_0x5c9462)[_0x533c('0x1e')]();};}function respondWithResult(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0xc8;return function(_0xa616ca){if(_0xa616ca){return _0x1a2a83['status'](_0x8d7c66)[_0x533c('0x1f')](_0xa616ca);}};}function respondWithFilteredResult(_0x7c1d33,_0x3f4a5c){return function(_0x3e544f){if(_0x3e544f){var _0x56dfb7=typeof _0x3f4a5c[_0x533c('0x20')]===_0x533c('0x21')&&typeof _0x3f4a5c[_0x533c('0x22')]===_0x533c('0x21');var _0x2854ab=_0x3e544f[_0x533c('0x23')];var _0x1f0a72=_0x56dfb7?0x0:_0x3f4a5c[_0x533c('0x20')];var _0x1f9f85=_0x56dfb7?_0x3e544f[_0x533c('0x23')]:_0x3f4a5c[_0x533c('0x20')]+_0x3f4a5c[_0x533c('0x22')];var _0x78dd72;if(_0x1f9f85>=_0x2854ab){_0x1f9f85=_0x2854ab;_0x78dd72=0xc8;}else{_0x78dd72=0xce;}_0x7c1d33[_0x533c('0x1d')](_0x78dd72);return _0x7c1d33[_0x533c('0x24')](_0x533c('0x25'),_0x1f0a72+'-'+_0x1f9f85+'/'+_0x2854ab)[_0x533c('0x1f')](_0x3e544f);}return null;};}function patchUpdates(_0x2bc58f){return function(_0x4ba0bd){try{jsonpatch[_0x533c('0x26')](_0x4ba0bd,_0x2bc58f,!![]);}catch(_0x51785c){return BPromise['reject'](_0x51785c);}return _0x4ba0bd[_0x533c('0x27')]();};}function saveUpdates(_0x36d4e4,_0x5f5090){return function(_0x21dfd3){if(_0x21dfd3){return _0x21dfd3[_0x533c('0x28')](_0x36d4e4)[_0x533c('0x29')](function(_0x3dd249){return _0x3dd249;});}return null;};}function removeEntity(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(_0x42c87b){return _0x42c87b[_0x533c('0x2a')]()[_0x533c('0x29')](function(){_0x5ebbe0[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();});}};}function handleEntityNotFound(_0xb51a5,_0x43f669){return function(_0xb1c937){if(!_0xb1c937){_0xb51a5[_0x533c('0x1c')](0x194);}return _0xb1c937;};}function handleError(_0x4d47d0,_0x11d775){_0x11d775=_0x11d775||0x1f4;return function(_0xfab4da){logger['error'](_0xfab4da[_0x533c('0x2b')]);if(_0xfab4da['name']){delete _0xfab4da[_0x533c('0x2c')];}_0x4d47d0[_0x533c('0x1d')](_0x11d775)[_0x533c('0x2d')](_0xfab4da);};}exports[_0x533c('0x2e')]=function(_0x425f60,_0x146a8e){var _0x212d1b={},_0x38d886={},_0x3c559b={'count':0x0,'rows':[]};var _0x2fc7fa=_[_0x533c('0x2f')](db[_0x533c('0x30')]['rawAttributes'],function(_0x370263){return{'name':_0x370263['fieldName'],'type':_0x370263[_0x533c('0x31')][_0x533c('0x32')]};});_0x38d886[_0x533c('0x33')]=_[_0x533c('0x34')](_[_0x533c('0x2f')](_0x2fc7fa,_0x533c('0x2c')),[_0x533c('0x35')]);_0x38d886[_0x533c('0x36')]=_[_0x533c('0x37')](_0x425f60[_0x533c('0x36')]);_0x38d886[_0x533c('0x38')]=_[_0x533c('0x39')](_0x38d886[_0x533c('0x33')],_0x38d886[_0x533c('0x36')]);_0x212d1b[_0x533c('0x3a')]=_['intersection'](_0x38d886[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x425f60[_0x533c('0x36')][_0x533c('0x3b')]));_0x212d1b['attributes']=_0x212d1b[_0x533c('0x3a')][_0x533c('0x3c')]?_0x212d1b[_0x533c('0x3a')]:_0x38d886[_0x533c('0x33')];if(!_0x425f60[_0x533c('0x36')]['hasOwnProperty']('nolimit')){_0x212d1b['limit']=qs['limit'](_0x425f60['query'][_0x533c('0x22')]);_0x212d1b['offset']=qs[_0x533c('0x20')](_0x425f60['query'][_0x533c('0x20')]);}_0x212d1b[_0x533c('0x3d')]=qs[_0x533c('0x3e')](_0x425f60['query'][_0x533c('0x3e')]);_0x212d1b[_0x533c('0x3f')]=qs[_0x533c('0x38')](_['pick'](_0x425f60[_0x533c('0x36')],_0x38d886[_0x533c('0x38')]),_0x2fc7fa);if(_0x425f60[_0x533c('0x36')]['filter']){_0x212d1b[_0x533c('0x3f')]=_[_0x533c('0x40')](_0x212d1b[_0x533c('0x3f')],{'$or':_[_0x533c('0x2f')](_0x2fc7fa,function(_0x454dbc){if(_0x454dbc[_0x533c('0x31')]!==_0x533c('0x41')){var _0x2dbd81={};_0x2dbd81[_0x454dbc[_0x533c('0x2c')]]={'$like':'%'+_0x425f60[_0x533c('0x36')][_0x533c('0x42')]+'%'};return _0x2dbd81;}})});}_0x212d1b=_['merge']({},_0x212d1b,_0x425f60[_0x533c('0x43')]);var _0x784493={'where':_0x212d1b[_0x533c('0x3f')]};return db[_0x533c('0x30')][_0x533c('0x23')](_0x784493)[_0x533c('0x29')](function(_0x5d2bf9){_0x3c559b[_0x533c('0x23')]=_0x5d2bf9;if(_0x425f60[_0x533c('0x36')][_0x533c('0x44')]){_0x212d1b['include']=[{'all':!![]}];}return db[_0x533c('0x30')][_0x533c('0x45')](_0x212d1b);})[_0x533c('0x29')](function(_0x1abd47){_0x3c559b['rows']=_0x1abd47;return _0x3c559b;})[_0x533c('0x29')](respondWithFilteredResult(_0x146a8e,_0x212d1b))['catch'](handleError(_0x146a8e,null));};exports[_0x533c('0x46')]=function(_0x39034e,_0x55a372){var _0x3f4015={'raw':![],'where':{'id':_0x39034e[_0x533c('0x47')]['id']}},_0x3f1e47={};_0x3f1e47['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x3f1e47[_0x533c('0x36')]=_['keys'](_0x39034e[_0x533c('0x36')]);_0x3f1e47['filters']=_[_0x533c('0x39')](_0x3f1e47['model'],_0x3f1e47[_0x533c('0x36')]);_0x3f4015[_0x533c('0x3a')]=_['intersection'](_0x3f1e47[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x39034e[_0x533c('0x36')][_0x533c('0x3b')]));_0x3f4015[_0x533c('0x3a')]=_0x3f4015['attributes'][_0x533c('0x3c')]?_0x3f4015[_0x533c('0x3a')]:_0x3f1e47[_0x533c('0x33')];if(_0x39034e[_0x533c('0x36')]['includeAll']){_0x3f4015[_0x533c('0x48')]=[{'all':!![]}];}_0x3f4015=_[_0x533c('0x40')]({},_0x3f4015,_0x39034e['options']);return db['ScreenRecording'][_0x533c('0x49')](_0x3f4015)['then'](handleEntityNotFound(_0x55a372,null))[_0x533c('0x29')](respondWithResult(_0x55a372,null))[_0x533c('0x4a')](handleError(_0x55a372,null));};exports[_0x533c('0x4b')]=function(_0x471c59,_0xe9354a){return db[_0x533c('0x30')][_0x533c('0x4b')](_0x471c59[_0x533c('0x4c')],{})['then'](respondWithResult(_0xe9354a,0xc9))[_0x533c('0x4a')](handleError(_0xe9354a,null));};exports[_0x533c('0x28')]=function(_0xaaf682,_0x57c6c6){if(_0xaaf682[_0x533c('0x4c')]['id']){delete _0xaaf682[_0x533c('0x4c')]['id'];}delete _0xaaf682['body'][_0x533c('0x4d')];delete _0xaaf682['body'][_0x533c('0x4e')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x4f')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x50')];return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0xaaf682['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x57c6c6,null))[_0x533c('0x29')](saveUpdates(_0xaaf682[_0x533c('0x4c')],null))[_0x533c('0x29')](respondWithResult(_0x57c6c6,null))[_0x533c('0x4a')](handleError(_0x57c6c6,null));};exports[_0x533c('0x51')]=function(_0x3eb174,_0x50d5a2){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x50d5a2,null))[_0x533c('0x4a')](handleError(_0x50d5a2,null));};exports[_0x533c('0x52')]=function(_0x5c5dd0,_0xac086b,_0x1da579){var _0x2f6794=require('../../components/encryptor');var _0x1de19e=![];var _0x564a31={};if(_0x5c5dd0['query'][_0x533c('0x31')]&&_0x5c5dd0[_0x533c('0x36')][_0x533c('0x31')]===_0x533c('0x53')){_0x564a31[_0x533c('0x53')]=_0x5c5dd0[_0x533c('0x47')]['id'];}else{_0x564a31['id']=_0x5c5dd0[_0x533c('0x47')]['id'];}return db['ScreenRecording'][_0x533c('0x49')]({'where':_0x564a31,'attributes':['id','value'],'raw':!![]})[_0x533c('0x29')](handleEntityNotFound(_0xac086b,null))[_0x533c('0x29')](function(_0x274686){if(_0x274686){var _0x2c7600=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x274686[_0x533c('0x50')]);var _0x58f528=util[_0x533c('0x35')](_0x533c('0x57'),_0x2c7600);if(fs[_0x533c('0x58')](_0x58f528)){_0x1de19e=!![];return _0x2f6794[_0x533c('0x59')](_0x58f528,_0x2c7600,config[_0x533c('0x5a')][_0x533c('0x5b')])['then'](function(){return _0x274686;});}return _0x274686;}})[_0x533c('0x29')](function(_0x554a9f){if(_0x554a9f){var _0x43383e=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x554a9f[_0x533c('0x50')]);if(!fs[_0x533c('0x58')](_0x43383e)){throw new db['Sequelize']['ValidationError'](_0x533c('0x5c'));}if(_0x554a9f[_0x533c('0x5d')]){return _0xac086b[_0x533c('0x52')](_0x43383e,_0x554a9f[_0x533c('0x5d')]+path['extname'](_0x43383e),function(){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}else{return _0xac086b[_0x533c('0x52')](_0x43383e,function(_0x8e04c7){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}}})[_0x533c('0x4a')](function(_0x2f2863){if(_0x2f2863[_0x533c('0x5f')]===_0x533c('0x5c')){_0xac086b[_0x533c('0x1d')](0x194)[_0x533c('0x2d')](_0x533c('0x60'));}else{return handleError(_0xac086b,null);}});};exports[_0x533c('0x2a')]=function(_0x13a7f2,_0xea6ea2){return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0x13a7f2[_0x533c('0x47')]['id']}})['then'](function(_0x31bba1){if(_['isNil'](_0x31bba1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x31bba1;})[_0x533c('0x29')](function(_0xb23f94){var _0x965b85=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0xb23f94[_0x533c('0x50')]);logger['info'](_0x533c('0x61'),_0x965b85);if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')](_0x533c('0x64')+_0x965b85+_0x533c('0x65'));fs['unlinkSync'](_0x965b85);}_0x965b85=_0x965b85+_0x533c('0x66');if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')]('File:\x20\x22'+_0x965b85+_0x533c('0x65'));fs[_0x533c('0x67')](_0x965b85);}return _0xb23f94;})['then'](function(_0x444f46){if(!_0x444f46)throw new InternalError();return _0x444f46['destroy']();})['then'](function(){_0xea6ea2[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();})[_0x533c('0x4a')](handleError(_0xea6ea2,null));}; \ No newline at end of file +var _0x6aa7=['fieldName','type','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','find','catch','create','body','duration','createdAt','closedAt','params','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','secrets','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','download','message','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6aa7,0x178));var _0x76aa=function(_0x49a200,_0x437c97){_0x49a200=_0x49a200-0x0;var _0x4900b4=_0x6aa7[_0x49a200];return _0x4900b4;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x26b75e,_0x3599a9){return function(_0x4ef9b0){if(!_0x4ef9b0){_0x26b75e[_0x76aa('0x19')](0x194);}return _0x4ef9b0;};}function handleError(_0x1d6d15,_0x25c614){_0x25c614=_0x25c614||0x1f4;return function(_0x2e7ab4){logger[_0x76aa('0x29')](_0x2e7ab4[_0x76aa('0x2a')]);if(_0x2e7ab4[_0x76aa('0x2b')]){delete _0x2e7ab4[_0x76aa('0x2b')];}_0x1d6d15[_0x76aa('0x1a')](_0x25c614)[_0x76aa('0x2c')](_0x2e7ab4);};}exports['index']=function(_0x3fcb7f,_0x5a8030){var _0x994550={},_0x365ff8={},_0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x2d')](db[_0x76aa('0x2e')][_0x76aa('0x2f')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x30')],'type':_0x3827ec[_0x76aa('0x31')]['key']};});_0x365ff8[_0x76aa('0x32')]=_[_0x76aa('0x33')](_[_0x76aa('0x2d')](_0x1e90b9,_0x76aa('0x2b')),[_0x76aa('0x34')]);_0x365ff8[_0x76aa('0x35')]=_[_0x76aa('0x36')](_0x3fcb7f['query']);_0x365ff8[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x365ff8['model'],_0x365ff8[_0x76aa('0x35')]);_0x994550['attributes']=_[_0x76aa('0x38')](_0x365ff8['model'],qs[_0x76aa('0x39')](_0x3fcb7f['query']['fields']));_0x994550[_0x76aa('0x3a')]=_0x994550[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x994550[_0x76aa('0x3a')]:_0x365ff8['model'];if(!_0x3fcb7f['query'][_0x76aa('0x3c')](_0x76aa('0x3d'))){_0x994550[_0x76aa('0x1f')]=qs[_0x76aa('0x1f')](_0x3fcb7f[_0x76aa('0x35')]['limit']);_0x994550[_0x76aa('0x1e')]=qs['offset'](_0x3fcb7f['query'][_0x76aa('0x1e')]);}_0x994550[_0x76aa('0x3e')]=qs[_0x76aa('0x3f')](_0x3fcb7f[_0x76aa('0x35')]['sort']);_0x994550[_0x76aa('0x40')]=qs[_0x76aa('0x37')](_[_0x76aa('0x41')](_0x3fcb7f['query'],_0x365ff8[_0x76aa('0x37')]),_0x1e90b9);if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]){_0x994550[_0x76aa('0x40')]=_[_0x76aa('0x43')](_0x994550[_0x76aa('0x40')],{'$or':_[_0x76aa('0x2d')](_0x1e90b9,function(_0x307d67){if(_0x307d67[_0x76aa('0x31')]!=='VIRTUAL'){var _0x1525cb={};_0x1525cb[_0x307d67[_0x76aa('0x2b')]]={'$like':'%'+_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]+'%'};return _0x1525cb;}})});}_0x994550=_[_0x76aa('0x43')]({},_0x994550,_0x3fcb7f[_0x76aa('0x44')]);var _0x572fdb={'where':_0x994550['where']};return db[_0x76aa('0x2e')][_0x76aa('0x1d')](_0x572fdb)[_0x76aa('0x27')](function(_0x365612){_0x2dec94['count']=_0x365612;if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x45')]){_0x994550[_0x76aa('0x46')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x47')](_0x994550);})['then'](function(_0x13dafe){_0x2dec94['rows']=_0x13dafe;return _0x2dec94;})[_0x76aa('0x27')](respondWithFilteredResult(_0x5a8030,_0x994550))['catch'](handleError(_0x5a8030,null));};exports['show']=function(_0x4f7f3a,_0x144f0a){var _0x541594={'raw':![],'where':{'id':_0x4f7f3a['params']['id']}},_0x5cf314={};_0x5cf314[_0x76aa('0x32')]=_[_0x76aa('0x36')](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x5cf314[_0x76aa('0x35')]=_['keys'](_0x4f7f3a[_0x76aa('0x35')]);_0x5cf314[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],_0x5cf314[_0x76aa('0x35')]);_0x541594['attributes']=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],qs['fields'](_0x4f7f3a[_0x76aa('0x35')]['fields']));_0x541594[_0x76aa('0x3a')]=_0x541594[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x541594[_0x76aa('0x3a')]:_0x5cf314[_0x76aa('0x32')];if(_0x4f7f3a[_0x76aa('0x35')][_0x76aa('0x45')]){_0x541594[_0x76aa('0x46')]=[{'all':!![]}];}_0x541594=_[_0x76aa('0x43')]({},_0x541594,_0x4f7f3a[_0x76aa('0x44')]);return db['ScreenRecording'][_0x76aa('0x48')](_0x541594)['then'](handleEntityNotFound(_0x144f0a,null))[_0x76aa('0x27')](respondWithResult(_0x144f0a,null))[_0x76aa('0x49')](handleError(_0x144f0a,null));};exports[_0x76aa('0x4a')]=function(_0x156d4e,_0x5ca721){return db['ScreenRecording'][_0x76aa('0x4a')](_0x156d4e['body'],{})[_0x76aa('0x27')](respondWithResult(_0x5ca721,0xc9))[_0x76aa('0x49')](handleError(_0x5ca721,null));};exports[_0x76aa('0x26')]=function(_0x2e5633,_0x30c577){if(_0x2e5633[_0x76aa('0x4b')]['id']){delete _0x2e5633['body']['id'];}delete _0x2e5633['body'][_0x76aa('0x4c')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4d')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4e')];delete _0x2e5633[_0x76aa('0x4b')]['value'];return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x2e5633[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x30c577,null))[_0x76aa('0x27')](saveUpdates(_0x2e5633['body'],null))[_0x76aa('0x27')](respondWithResult(_0x30c577,null))['catch'](handleError(_0x30c577,null));};exports[_0x76aa('0x50')]=function(_0x4449c1,_0x3c63e5){return db[_0x76aa('0x2e')][_0x76aa('0x50')]()[_0x76aa('0x27')](respondWithResult(_0x3c63e5,null))[_0x76aa('0x49')](handleError(_0x3c63e5,null));};exports['download']=function(_0x186654,_0x5eeaa5,_0x3ee32){var _0x311bd5=require(_0x76aa('0x51'));var _0x53be10=![];var _0x3fa7ec={};if(_0x186654[_0x76aa('0x35')][_0x76aa('0x31')]&&_0x186654['query'][_0x76aa('0x31')]===_0x76aa('0x52')){_0x3fa7ec[_0x76aa('0x52')]=_0x186654[_0x76aa('0x4f')]['id'];}else{_0x3fa7ec['id']=_0x186654['params']['id'];}return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':_0x3fa7ec,'attributes':['id',_0x76aa('0x53')],'raw':!![]})[_0x76aa('0x27')](handleEntityNotFound(_0x5eeaa5,null))[_0x76aa('0x27')](function(_0xf7732){if(_0xf7732){var _0x4e6c09=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0xf7732[_0x76aa('0x53')]);var _0x3967f3=util[_0x76aa('0x34')](_0x76aa('0x57'),_0x4e6c09);if(fs['existsSync'](_0x3967f3)){_0x53be10=!![];return _0x311bd5['decryptFile'](_0x3967f3,_0x4e6c09,config[_0x76aa('0x58')][_0x76aa('0x59')])['then'](function(){return _0xf7732;});}return _0xf7732;}})[_0x76aa('0x27')](function(_0x1e6f3c){if(_0x1e6f3c){var _0x4f832d=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x1e6f3c[_0x76aa('0x53')]);if(!fs[_0x76aa('0x5a')](_0x4f832d)){throw new db[(_0x76aa('0x5b'))][(_0x76aa('0x5c'))](_0x76aa('0x5d'));}if(_0x1e6f3c[_0x76aa('0x5e')]){return _0x5eeaa5['download'](_0x4f832d,_0x1e6f3c[_0x76aa('0x5e')]+path['extname'](_0x4f832d),function(){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}else{return _0x5eeaa5[_0x76aa('0x60')](_0x4f832d,function(_0x2fef92){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}}})[_0x76aa('0x49')](function(_0x260ad2){if(_0x260ad2[_0x76aa('0x61')]===_0x76aa('0x5d')){_0x5eeaa5[_0x76aa('0x1a')](0x194)['send'](_0x76aa('0x62'));}else{return handleError(_0x5eeaa5,null);}});};exports[_0x76aa('0x28')]=function(_0x5c542b,_0xe5957d){return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x5c542b[_0x76aa('0x4f')]['id']}})[_0x76aa('0x27')](function(_0x5546b6){if(_[_0x76aa('0x63')](_0x5546b6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5546b6;})[_0x76aa('0x27')](function(_0x35881c){var _0x3e97f8=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x35881c[_0x76aa('0x53')]);logger['info'](_0x76aa('0x64'),_0x3e97f8);if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs['existsSync'](_0x3e97f8)){logger[_0x76aa('0x65')](_0x76aa('0x66')+_0x3e97f8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76aa('0x67')](_0x3e97f8);}_0x3e97f8=_0x3e97f8+_0x76aa('0x68');if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs[_0x76aa('0x5a')](_0x3e97f8)){logger['info'](_0x76aa('0x66')+_0x3e97f8+_0x76aa('0x69'));fs[_0x76aa('0x67')](_0x3e97f8);}return _0x35881c;})[_0x76aa('0x27')](function(_0x55ca84){if(!_0x55ca84)throw new InternalError();return _0x55ca84['destroy']();})[_0x76aa('0x27')](function(){_0xe5957d['status'](0xcc)[_0x76aa('0x1b')]();})[_0x76aa('0x49')](handleError(_0xe5957d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 5ab08b4..1d83d14 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 _0x4c28=['api','moment','bluebird','path','rimraf','./screenRecording.attributes','exports','define','interactionid','../../config/logger'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4c28,0xf9));var _0x84c2=function(_0x570ad8,_0x425ec5){_0x570ad8=_0x570ad8-0x0;var _0x1eb874=_0x4c28[_0x570ad8];return _0x1eb874;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x84c2('0x0'))(_0x84c2('0x1'));var moment=require(_0x84c2('0x2'));var BPromise=require(_0x84c2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84c2('0x4'));var rimraf=require(_0x84c2('0x5'));var config=require('../../config/environment');var attributes=require(_0x84c2('0x6'));module[_0x84c2('0x7')]=function(_0x6fa29f,_0x4b596d){return _0x6fa29f[_0x84c2('0x8')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x84c2('0x9'),'fields':[_0x84c2('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x867d=['./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x867d,0xcb));var _0xd867=function(_0x4a5562,_0x29c485){_0x4a5562=_0x4a5562-0x0;var _0x5c2d32=_0x867d[_0x4a5562];return _0x5c2d32;};'use strict';var _=require(_0xd867('0x0'));var util=require(_0xd867('0x1'));var logger=require(_0xd867('0x2'))(_0xd867('0x3'));var moment=require('moment');var BPromise=require(_0xd867('0x4'));var rp=require(_0xd867('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd867('0x6'));module[_0xd867('0x7')]=function(_0x14b3db,_0xd6ffb6){return _0x14b3db[_0xd867('0x8')]('ScreenRecording',attributes,{'tableName':_0xd867('0x9'),'paranoid':![],'indexes':[{'name':_0xd867('0xa'),'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 8753cbc..7e67165 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 _0x88ae=['then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x274f14,_0x27dd7f){var _0x13b97e=function(_0x7d9432){while(--_0x7d9432){_0x274f14['push'](_0x274f14['shift']());}};_0x13b97e(++_0x27dd7f);}(_0x88ae,0x107));var _0xe88a=function(_0x4e4de9,_0x14bd2e){_0x4e4de9=_0x4e4de9-0x0;var _0x2939b9=_0x88ae[_0x4e4de9];return _0x2939b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe88a('0x0'));var db=require(_0xe88a('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xe88a('0x2'))('rpc');var config=require(_0xe88a('0x3'));var jayson=require(_0xe88a('0x4'));var client=jayson[_0xe88a('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53ab89,_0x549fae,_0x293597){return new BPromise(function(_0x5b0009,_0x40f43f){return client[_0xe88a('0x6')](_0x53ab89,_0x293597)[_0xe88a('0x7')](function(_0x1eaf86){logger[_0xe88a('0x8')](_0xe88a('0x9'),_0x549fae,'request\x20sent');logger[_0xe88a('0xa')](_0xe88a('0xb'),_0x549fae,'request\x20sent',JSON[_0xe88a('0xc')](_0x1eaf86));if(_0x1eaf86[_0xe88a('0xd')]){if(_0x1eaf86[_0xe88a('0xd')]['code']===0x1f4){logger[_0xe88a('0xd')](_0xe88a('0x9'),_0x549fae,_0x1eaf86[_0xe88a('0xd')][_0xe88a('0xe')]);return _0x40f43f(_0x1eaf86[_0xe88a('0xd')]['message']);}logger[_0xe88a('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x549fae,_0x1eaf86[_0xe88a('0xd')]['message']);return _0x5b0009(_0x1eaf86[_0xe88a('0xd')][_0xe88a('0xe')]);}else{logger[_0xe88a('0x8')](_0xe88a('0x9'),_0x549fae,_0xe88a('0xf'));_0x5b0009(_0x1eaf86[_0xe88a('0x10')][_0xe88a('0xe')]);}})[_0xe88a('0x11')](function(_0x4634e4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x549fae,_0x4634e4);_0x40f43f(_0x4634e4);});});} \ No newline at end of file +var _0xbd44=['rpc','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2bae67,_0x1077b2){var _0x5f29ed=function(_0xa01841){while(--_0xa01841){_0x2bae67['push'](_0x2bae67['shift']());}};_0x5f29ed(++_0x1077b2);}(_0xbd44,0x14e));var _0x4bd4=function(_0x1e15e1,_0x45f4c3){_0x1e15e1=_0x1e15e1-0x0;var _0x4ab625=_0xbd44[_0x1e15e1];return _0x4ab625;};'use strict';var _=require(_0x4bd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4bd4('0x1'));var rs=require(_0x4bd4('0x2'));var fs=require('fs');var Redis=require(_0x4bd4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4bd4('0x4'));var logger=require(_0x4bd4('0x5'))(_0x4bd4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4bd4('0x7')][_0x4bd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b77ba,_0x29981b,_0x56bf71){return new BPromise(function(_0x6ad64a,_0x46dd14){return client[_0x4bd4('0x9')](_0x3b77ba,_0x56bf71)[_0x4bd4('0xa')](function(_0x5ec716){logger['info'](_0x4bd4('0xb'),_0x29981b,_0x4bd4('0xc'));logger['debug'](_0x4bd4('0xd'),_0x29981b,'request\x20sent',JSON[_0x4bd4('0xe')](_0x5ec716));if(_0x5ec716[_0x4bd4('0xf')]){if(_0x5ec716['error'][_0x4bd4('0x10')]===0x1f4){logger[_0x4bd4('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x29981b,_0x5ec716[_0x4bd4('0xf')]['message']);return _0x46dd14(_0x5ec716[_0x4bd4('0xf')][_0x4bd4('0x11')]);}logger['error'](_0x4bd4('0xb'),_0x29981b,_0x5ec716[_0x4bd4('0xf')][_0x4bd4('0x11')]);return _0x6ad64a(_0x5ec716[_0x4bd4('0xf')][_0x4bd4('0x11')]);}else{logger['info'](_0x4bd4('0xb'),_0x29981b,_0x4bd4('0xc'));_0x6ad64a(_0x5ec716[_0x4bd4('0x12')][_0x4bd4('0x11')]);}})[_0x4bd4('0x13')](function(_0xaf40fb){logger['error'](_0x4bd4('0xb'),_0x29981b,_0xaf40fb);_0x46dd14(_0xaf40fb);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 95f094b..0fd5620 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 _0x0186=['server/files/images/logos/','format','logo','extname','originalname','/:id/logo','single','file','addLogo','join','%s%s','logologin','post','/:id/logo_login','addLogoLogin','/:id/preferred','addPreferred','favicon','addFavicon','isAuthenticated','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/now','getDate','show','getLogoLogin','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','root'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x0186,0x1b0));var _0x6018=function(_0x260927,_0xd4deee){_0x260927=_0x260927-0x0;var _0x5e5515=_0x0186[_0x260927];return _0x5e5515;};'use strict';var multer=require(_0x6018('0x0'));var util=require('util');var path=require(_0x6018('0x1'));var timeout=require(_0x6018('0x2'));var express=require(_0x6018('0x3'));var router=express[_0x6018('0x4')]();var fs_extra=require(_0x6018('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6018('0x6'));var config=require(_0x6018('0x7'));var controller=require('./setting.controller');router[_0x6018('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6018('0x8')](_0x6018('0x9'),controller[_0x6018('0xa')]);router[_0x6018('0x8')]('/:id',controller[_0x6018('0xb')]);router[_0x6018('0x8')]('/:id/logo',controller['getLogo']);router[_0x6018('0x8')]('/:id/logo_login',controller[_0x6018('0xc')]);router[_0x6018('0x8')]('/:id/gdpr',controller[_0x6018('0xd')]);router[_0x6018('0x8')]('/:id/preferred',controller[_0x6018('0xe')]);router[_0x6018('0x8')](_0x6018('0xf'),controller[_0x6018('0x10')]);var upload=multer({'storage':multer[_0x6018('0x11')]({'destination':function(_0x4b9102,_0x3fa7c3,_0x2faf1e){_0x2faf1e(null,path['join'](config[_0x6018('0x12')],_0x6018('0x13')));},'filename':function(_0x5873cb,_0x484411,_0x1a9b84){_0x1a9b84(null,util[_0x6018('0x14')]('%s%s',_0x6018('0x15'),path[_0x6018('0x16')](_0x484411[_0x6018('0x17')])));}})});router['post'](_0x6018('0x18'),upload[_0x6018('0x19')](_0x6018('0x1a')),controller[_0x6018('0x1b')]);var upload=multer({'storage':multer[_0x6018('0x11')]({'destination':function(_0x51028e,_0xdf9e10,_0xba756b){_0xba756b(null,path[_0x6018('0x1c')](config[_0x6018('0x12')],_0x6018('0x13')));},'filename':function(_0x5cebdd,_0x54023f,_0x1b0775){_0x1b0775(null,util[_0x6018('0x14')](_0x6018('0x1d'),_0x6018('0x1e'),path[_0x6018('0x16')](_0x54023f[_0x6018('0x17')])));}})});router[_0x6018('0x1f')](_0x6018('0x20'),upload[_0x6018('0x19')](_0x6018('0x1a')),controller[_0x6018('0x21')]);var upload=multer({'storage':multer[_0x6018('0x11')]({'destination':function(_0x38bf9a,_0x4554bb,_0x3f1496){_0x3f1496(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x2ddaa5,_0x2d0640,_0xcedeaa){_0xcedeaa(null,util[_0x6018('0x14')](_0x6018('0x1d'),'preferred',path[_0x6018('0x16')](_0x2d0640[_0x6018('0x17')])));}})});router['post'](_0x6018('0x22'),upload[_0x6018('0x19')](_0x6018('0x1a')),controller[_0x6018('0x23')]);var upload=multer({'storage':multer[_0x6018('0x11')]({'destination':function(_0x810df1,_0xb573f4,_0x12cf7d){_0x12cf7d(null,path[_0x6018('0x1c')](config[_0x6018('0x12')],_0x6018('0x13')));},'filename':function(_0x24b1c5,_0x486521,_0x505eea){_0x505eea(null,util[_0x6018('0x14')](_0x6018('0x1d'),_0x6018('0x24'),path['extname'](_0x486521[_0x6018('0x17')])));}})});router[_0x6018('0x1f')](_0x6018('0xf'),upload[_0x6018('0x19')]('file'),controller[_0x6018('0x25')]);router['put']('/:id',auth[_0x6018('0x26')](),controller[_0x6018('0x27')]);module[_0x6018('0x28')]=router; \ No newline at end of file +var _0x3cc4=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','getDate','/:id','show','/:id/logo','getLogo','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','addLogo','root','logologin','file','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','update','multer','util'];(function(_0x14fa3f,_0x169836){var _0xd92d0d=function(_0x956c20){while(--_0x956c20){_0x14fa3f['push'](_0x14fa3f['shift']());}};_0xd92d0d(++_0x169836);}(_0x3cc4,0xa2));var _0x43cc=function(_0xa7a5e3,_0x597b50){_0xa7a5e3=_0xa7a5e3-0x0;var _0x1a4b59=_0x3cc4[_0xa7a5e3];return _0x1a4b59;};'use strict';var multer=require(_0x43cc('0x0'));var util=require(_0x43cc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x43cc('0x2'));var router=express[_0x43cc('0x3')]();var fs_extra=require(_0x43cc('0x4'));var auth=require(_0x43cc('0x5'));var interaction=require(_0x43cc('0x6'));var config=require('../../config/environment');var controller=require(_0x43cc('0x7'));router[_0x43cc('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x43cc('0x8')]('/now',controller[_0x43cc('0x9')]);router[_0x43cc('0x8')](_0x43cc('0xa'),controller[_0x43cc('0xb')]);router[_0x43cc('0x8')](_0x43cc('0xc'),controller[_0x43cc('0xd')]);router[_0x43cc('0x8')]('/:id/logo_login',controller['getLogoLogin']);router['get'](_0x43cc('0xe'),controller[_0x43cc('0xf')]);router[_0x43cc('0x8')](_0x43cc('0x10'),controller['getPreferred']);router[_0x43cc('0x8')](_0x43cc('0x11'),controller[_0x43cc('0x12')]);var upload=multer({'storage':multer[_0x43cc('0x13')]({'destination':function(_0x154e48,_0x476082,_0x2e1c41){_0x2e1c41(null,path[_0x43cc('0x14')](config['root'],_0x43cc('0x15')));},'filename':function(_0x4567a2,_0x99a267,_0x36e7c0){_0x36e7c0(null,util[_0x43cc('0x16')](_0x43cc('0x17'),_0x43cc('0x18'),path[_0x43cc('0x19')](_0x99a267[_0x43cc('0x1a')])));}})});router[_0x43cc('0x1b')](_0x43cc('0xc'),upload[_0x43cc('0x1c')]('file'),controller[_0x43cc('0x1d')]);var upload=multer({'storage':multer[_0x43cc('0x13')]({'destination':function(_0x2d622d,_0x167397,_0x111d70){_0x111d70(null,path[_0x43cc('0x14')](config[_0x43cc('0x1e')],_0x43cc('0x15')));},'filename':function(_0x592fa5,_0xd3e8fa,_0x146633){_0x146633(null,util[_0x43cc('0x16')](_0x43cc('0x17'),_0x43cc('0x1f'),path[_0x43cc('0x19')](_0xd3e8fa['originalname'])));}})});router[_0x43cc('0x1b')]('/:id/logo_login',upload['single'](_0x43cc('0x20')),controller[_0x43cc('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4a7999,_0x44a0dc,_0x281e26){_0x281e26(null,path['join'](config[_0x43cc('0x1e')],'server/files/images/logos/'));},'filename':function(_0x44e584,_0x2f278f,_0x253d90){_0x253d90(null,util['format'](_0x43cc('0x17'),_0x43cc('0x22'),path[_0x43cc('0x19')](_0x2f278f[_0x43cc('0x1a')])));}})});router[_0x43cc('0x1b')](_0x43cc('0x10'),upload['single'](_0x43cc('0x20')),controller[_0x43cc('0x23')]);var upload=multer({'storage':multer[_0x43cc('0x13')]({'destination':function(_0x29c342,_0x1ec59a,_0x15e3bc){_0x15e3bc(null,path['join'](config[_0x43cc('0x1e')],_0x43cc('0x15')));},'filename':function(_0x222d6d,_0x473d76,_0x3b7697){_0x3b7697(null,util['format'](_0x43cc('0x17'),_0x43cc('0x24'),path[_0x43cc('0x19')](_0x473d76[_0x43cc('0x1a')])));}})});router[_0x43cc('0x1b')](_0x43cc('0x11'),upload['single'](_0x43cc('0x20')),controller[_0x43cc('0x25')]);router[_0x43cc('0x26')](_0x43cc('0xa'),auth[_0x43cc('0x27')](),controller[_0x43cc('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 6fe946f..d4b9bc7 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 _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x58c02b,_0x325036){var _0x42e22c=function(_0x145a22){while(--_0x145a22){_0x58c02b['push'](_0x58c02b['shift']());}};_0x42e22c(++_0x325036);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0xc6bdf0,_0x291c20){var _0x37f20b=function(_0x5d0855){while(--_0x5d0855){_0xc6bdf0['push'](_0xc6bdf0['shift']());}};_0x37f20b(++_0x291c20);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 179b113..51a8ff6 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 _0xecd5=['preferred','favicon','defaultLoginLogo','existsSync','join','root','toLower','logo','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLogo','defaultPreferred','defaultFavicon','default_loginLogo.svg','securePassword','custom','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','name','send','index','map','Setting','rawAttributes','fieldName','type','key','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','keys','find','body','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos','getLicense'];(function(_0x22eca5,_0x3fa0e5){var _0x384d73=function(_0x139588){while(--_0x139588){_0x22eca5['push'](_0x22eca5['shift']());}};_0x384d73(++_0x3fa0e5);}(_0xecd5,0x110));var _0x5ecd=function(_0x500f77,_0x854b68){_0x500f77=_0x500f77-0x0;var _0x3979d5=_0xecd5[_0x500f77];return _0x3979d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ecd('0x0'));var zipdir=require(_0x5ecd('0x1'));var jsonpatch=require(_0x5ecd('0x2'));var rp=require('request-promise');var moment=require(_0x5ecd('0x3'));var BPromise=require(_0x5ecd('0x4'));var Mustache=require(_0x5ecd('0x5'));var util=require(_0x5ecd('0x6'));var path=require('path');var sox=require(_0x5ecd('0x7'));var csv=require('to-csv');var ejs=require(_0x5ecd('0x8'));var fs=require('fs');var fs_extra=require(_0x5ecd('0x9'));var _=require('lodash');var squel=require(_0x5ecd('0xa'));var crypto=require(_0x5ecd('0xb'));var jsforce=require(_0x5ecd('0xc'));var deskjs=require(_0x5ecd('0xd'));var toCsv=require(_0x5ecd('0xe'));var querystring=require(_0x5ecd('0xf'));var Papa=require(_0x5ecd('0x10'));var Redis=require(_0x5ecd('0x11'));var authService=require(_0x5ecd('0x12'));var qs=require(_0x5ecd('0x13'));var as=require(_0x5ecd('0x14'));var hardwareService=require(_0x5ecd('0x15'));var logger=require('../../config/logger')(_0x5ecd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5ecd('0x17'));var db=require(_0x5ecd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5ecd('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2106a0,_0x47cf02,_0x37bfe1,_0x57bd97){return new BPromise(function(_0x3b918c,_0x3b54f1){var _0x50e11c=_0x57bd97||client;return _0x50e11c[_0x5ecd('0x1a')](_0x2106a0,_0x37bfe1)[_0x5ecd('0x1b')](function(_0x48442a){logger[_0x5ecd('0x1c')]('Setting,\x20%s,\x20%s',_0x47cf02,_0x5ecd('0x1d'));logger[_0x5ecd('0x1e')](_0x5ecd('0x1f'),_0x47cf02,_0x5ecd('0x1d'),JSON[_0x5ecd('0x20')](_0x48442a));if(_0x48442a[_0x5ecd('0x21')]){if(_0x48442a[_0x5ecd('0x21')][_0x5ecd('0x22')]===0x1f4){logger[_0x5ecd('0x21')](_0x5ecd('0x23'),_0x47cf02,_0x48442a[_0x5ecd('0x21')][_0x5ecd('0x24')]);return _0x3b54f1(_0x48442a['error'][_0x5ecd('0x24')]);}logger[_0x5ecd('0x21')](_0x5ecd('0x23'),_0x47cf02,_0x48442a[_0x5ecd('0x21')][_0x5ecd('0x24')]);return _0x3b918c(_0x48442a['error'][_0x5ecd('0x24')]);}else{logger['info'](_0x5ecd('0x23'),_0x47cf02,_0x5ecd('0x1d'));_0x3b918c(_0x48442a[_0x5ecd('0x25')][_0x5ecd('0x24')]);}})[_0x5ecd('0x26')](function(_0x4becfd){logger[_0x5ecd('0x21')](_0x5ecd('0x23'),_0x47cf02,_0x4becfd);_0x3b54f1(_0x4becfd);});});}function respondWithStatusCode(_0x1d9161,_0x57168b){_0x57168b=_0x57168b||0xcc;return function(_0xe80905){if(_0xe80905){return _0x1d9161[_0x5ecd('0x27')](_0x57168b);}return _0x1d9161[_0x5ecd('0x28')](_0x57168b)[_0x5ecd('0x29')]();};}function respondWithResult(_0x29f8c0,_0x20f134){_0x20f134=_0x20f134||0xc8;return function(_0x3d0086){if(_0x3d0086){return _0x29f8c0[_0x5ecd('0x28')](_0x20f134)['json'](_0x3d0086);}};}function respondWithFilteredResult(_0x1e3902,_0x5ae414){return function(_0x12a109){if(_0x12a109){var _0x36d964=typeof _0x5ae414[_0x5ecd('0x2a')]===_0x5ecd('0x2b')&&typeof _0x5ae414[_0x5ecd('0x2c')]==='undefined';var _0x446324=_0x12a109[_0x5ecd('0x2d')];var _0x33ca9e=_0x36d964?0x0:_0x5ae414[_0x5ecd('0x2a')];var _0x389b88=_0x36d964?_0x12a109[_0x5ecd('0x2d')]:_0x5ae414[_0x5ecd('0x2a')]+_0x5ae414[_0x5ecd('0x2c')];var _0x253b1b;if(_0x389b88>=_0x446324){_0x389b88=_0x446324;_0x253b1b=0xc8;}else{_0x253b1b=0xce;}_0x1e3902[_0x5ecd('0x28')](_0x253b1b);return _0x1e3902[_0x5ecd('0x2e')](_0x5ecd('0x2f'),_0x33ca9e+'-'+_0x389b88+'/'+_0x446324)[_0x5ecd('0x30')](_0x12a109);}return null;};}function patchUpdates(_0xd2711e){return function(_0x3055eb){try{jsonpatch[_0x5ecd('0x31')](_0x3055eb,_0xd2711e,!![]);}catch(_0x3da093){return BPromise['reject'](_0x3da093);}return _0x3055eb[_0x5ecd('0x32')]();};}function saveUpdates(_0x4252d5,_0x37fdaa){return function(_0x179c63){if(_0x179c63){return _0x179c63[_0x5ecd('0x33')](_0x4252d5)['then'](function(_0x3cca00){return _0x3cca00;});}return null;};}function removeEntity(_0x169fa3,_0xabe8b5){return function(_0x195641){if(_0x195641){return _0x195641[_0x5ecd('0x34')]()['then'](function(){_0x169fa3[_0x5ecd('0x28')](0xcc)[_0x5ecd('0x29')]();});}};}function handleEntityNotFound(_0x46148e,_0x507a3d){return function(_0x3d18fe){if(!_0x3d18fe){_0x46148e[_0x5ecd('0x27')](0x194);}return _0x3d18fe;};}function handleError(_0x2c738b,_0x46fb84){_0x46fb84=_0x46fb84||0x1f4;return function(_0x27b8e5){logger[_0x5ecd('0x21')](_0x27b8e5['stack']);if(_0x27b8e5[_0x5ecd('0x35')]){delete _0x27b8e5['name'];}_0x2c738b['status'](_0x46fb84)[_0x5ecd('0x36')](_0x27b8e5);};}exports[_0x5ecd('0x37')]=function(_0x1dd54c,_0x29d265){var _0x38809f={},_0x41975e={},_0x4f3373={'count':0x0,'rows':[]};var _0x58561f=_[_0x5ecd('0x38')](db[_0x5ecd('0x39')][_0x5ecd('0x3a')],function(_0x3df69c){return{'name':_0x3df69c[_0x5ecd('0x3b')],'type':_0x3df69c[_0x5ecd('0x3c')][_0x5ecd('0x3d')]};});_0x41975e['model']=_[_0x5ecd('0x38')](_0x58561f,_0x5ecd('0x35'));_0x41975e[_0x5ecd('0x3e')]=_['keys'](_0x1dd54c[_0x5ecd('0x3e')]);_0x41975e[_0x5ecd('0x3f')]=_[_0x5ecd('0x40')](_0x41975e['model'],_0x41975e['query']);_0x38809f['attributes']=_[_0x5ecd('0x40')](_0x41975e['model'],qs[_0x5ecd('0x41')](_0x1dd54c[_0x5ecd('0x3e')]['fields']));_0x38809f[_0x5ecd('0x42')]=_0x38809f[_0x5ecd('0x42')][_0x5ecd('0x43')]?_0x38809f['attributes']:_0x41975e[_0x5ecd('0x44')];if(!_0x1dd54c[_0x5ecd('0x3e')][_0x5ecd('0x45')](_0x5ecd('0x46'))){_0x38809f[_0x5ecd('0x2c')]=qs['limit'](_0x1dd54c[_0x5ecd('0x3e')][_0x5ecd('0x2c')]);_0x38809f['offset']=qs['offset'](_0x1dd54c[_0x5ecd('0x3e')][_0x5ecd('0x2a')]);}_0x38809f[_0x5ecd('0x47')]=qs['sort'](_0x1dd54c[_0x5ecd('0x3e')]['sort']);_0x38809f[_0x5ecd('0x48')]=qs['filters'](_['pick'](_0x1dd54c['query'],_0x41975e[_0x5ecd('0x3f')]),_0x58561f);if(_0x1dd54c[_0x5ecd('0x3e')][_0x5ecd('0x49')]){_0x38809f['where']=_['merge'](_0x38809f[_0x5ecd('0x48')],{'$or':_['map'](_0x58561f,function(_0x3546a0){if(_0x3546a0[_0x5ecd('0x3c')]!==_0x5ecd('0x4a')){var _0x5aec2a={};_0x5aec2a[_0x3546a0['name']]={'$like':'%'+_0x1dd54c['query']['filter']+'%'};return _0x5aec2a;}})});}_0x38809f=_[_0x5ecd('0x4b')]({},_0x38809f,_0x1dd54c['options']);var _0x4aed1c={'where':_0x38809f[_0x5ecd('0x48')]};return db[_0x5ecd('0x39')]['count'](_0x4aed1c)[_0x5ecd('0x1b')](function(_0x173947){_0x4f3373[_0x5ecd('0x2d')]=_0x173947;if(_0x1dd54c['query'][_0x5ecd('0x4c')]){_0x38809f[_0x5ecd('0x4d')]=[{'all':!![]}];}return db[_0x5ecd('0x39')][_0x5ecd('0x4e')](_0x38809f);})[_0x5ecd('0x1b')](function(_0x3e6504){_0x4f3373[_0x5ecd('0x4f')]=_0x3e6504;return _0x4f3373;})[_0x5ecd('0x1b')](respondWithFilteredResult(_0x29d265,_0x38809f))[_0x5ecd('0x26')](handleError(_0x29d265,null));};exports['show']=function(_0x11487f,_0x13fed0){var _0xda9406={'raw':![],'where':{'id':_0x11487f[_0x5ecd('0x50')]['id']}},_0x35b68e={};_0x35b68e[_0x5ecd('0x44')]=_[_0x5ecd('0x51')](db[_0x5ecd('0x39')]['rawAttributes']);_0x35b68e[_0x5ecd('0x3e')]=_[_0x5ecd('0x51')](_0x11487f['query']);_0x35b68e[_0x5ecd('0x3f')]=_[_0x5ecd('0x40')](_0x35b68e['model'],_0x35b68e[_0x5ecd('0x3e')]);_0xda9406[_0x5ecd('0x42')]=_[_0x5ecd('0x40')](_0x35b68e['model'],qs[_0x5ecd('0x41')](_0x11487f[_0x5ecd('0x3e')][_0x5ecd('0x41')]));_0xda9406[_0x5ecd('0x42')]=_0xda9406['attributes'][_0x5ecd('0x43')]?_0xda9406['attributes']:_0x35b68e[_0x5ecd('0x44')];if(_0x11487f[_0x5ecd('0x3e')][_0x5ecd('0x4c')]){_0xda9406[_0x5ecd('0x4d')]=[{'all':!![]}];}_0xda9406=_[_0x5ecd('0x4b')]({},_0xda9406,_0x11487f['options']);return db[_0x5ecd('0x39')][_0x5ecd('0x52')](_0xda9406)[_0x5ecd('0x1b')](handleEntityNotFound(_0x13fed0,null))[_0x5ecd('0x1b')](respondWithResult(_0x13fed0,null))[_0x5ecd('0x26')](handleError(_0x13fed0,null));};exports[_0x5ecd('0x33')]=function(_0x4374fd,_0x47b260){if(_0x4374fd[_0x5ecd('0x53')]['id']){delete _0x4374fd['body']['id'];}return db[_0x5ecd('0x39')][_0x5ecd('0x52')]({'where':{'id':_0x4374fd[_0x5ecd('0x50')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x47b260,null))['then'](saveUpdates(_0x4374fd[_0x5ecd('0x53')],null))[_0x5ecd('0x1b')](respondWithResult(_0x47b260,null))[_0x5ecd('0x26')](handleError(_0x47b260,null));};exports[_0x5ecd('0x54')]=function(_0x1dbf89,_0x433bac,_0x3dbc04){if(_0x1dbf89[_0x5ecd('0x55')]&&_0x1dbf89[_0x5ecd('0x55')][_0x5ecd('0x56')]){_0x1dbf89['body']['logo']=_0x1dbf89[_0x5ecd('0x55')]['filename'];}return db[_0x5ecd('0x39')][_0x5ecd('0x52')]({'where':{'id':_0x1dbf89['params']['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x433bac,null))[_0x5ecd('0x1b')](saveUpdates(_0x1dbf89['body'],null))['then'](respondWithResult(_0x433bac,null))[_0x5ecd('0x26')](handleError(_0x433bac,null));};exports['addLogoLogin']=function(_0x13048c,_0x368dc7,_0x27aabb){if(_0x13048c[_0x5ecd('0x55')]&&_0x13048c[_0x5ecd('0x55')][_0x5ecd('0x56')]){_0x13048c[_0x5ecd('0x53')][_0x5ecd('0x57')]=_0x13048c['file'][_0x5ecd('0x56')];}return db[_0x5ecd('0x39')][_0x5ecd('0x52')]({'where':{'id':_0x13048c[_0x5ecd('0x50')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x368dc7,null))[_0x5ecd('0x1b')](saveUpdates(_0x13048c[_0x5ecd('0x53')],null))[_0x5ecd('0x1b')](respondWithResult(_0x368dc7,null))[_0x5ecd('0x26')](handleError(_0x368dc7,null));};var utilLicense=require(_0x5ecd('0x17'));exports[_0x5ecd('0x58')]=function(_0x12f301,_0x32b4c1,_0x243931){var _0x3a15ca=_0x5ecd('0x59');var _0x1755ca={'custom':![]};return utilLicense[_0x5ecd('0x5a')]()[_0x5ecd('0x1b')](function(_0x1f6261){if(_0x1f6261){_0x1755ca=_0x1f6261;}return db['Setting'][_0x5ecd('0x52')]({'where':{'id':_0x12f301['params']['id']},'attributes':['logo',_0x5ecd('0x57'),_0x5ecd('0x5b'),_0x5ecd('0x5c'),'defaultLogo',_0x5ecd('0x5d'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x5ecd('0x1b')](handleEntityNotFound(_0x32b4c1,null))[_0x5ecd('0x1b')](function(_0x5b1801){if(_0x5b1801){var _0x41f6b6=_0x5b1801['logo']&&fs[_0x5ecd('0x5e')](path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3a15ca,_[_0x5ecd('0x61')](_0x5b1801[_0x5ecd('0x62')])))?path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3a15ca,_['toLower'](_0x5b1801[_0x5ecd('0x62')])):path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3a15ca,_[_0x5ecd('0x61')](_0x5ecd('0x63')));var _0x3606ee=_0x5ecd('0x64')+_[_0x5ecd('0x65')](_0x5ecd('0x62'));if(_0x5b1801[_0x3606ee]||!_0x1755ca['custom']){_0x41f6b6=path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3a15ca,_['toLower'](_0x5ecd('0x63')));}if(!fs[_0x5ecd('0x5e')](_0x41f6b6)){throw new db[(_0x5ecd('0x66'))][(_0x5ecd('0x67'))](_[_0x5ecd('0x65')](_0x5ecd('0x62'))+_0x5ecd('0x68'));}return _0x32b4c1[_0x5ecd('0x69')](_0x41f6b6);}})['catch'](handleError(_0x32b4c1,null));};var utilLicense=require('../../config/license/util');exports[_0x5ecd('0x6a')]=function(_0x1ede54,_0x320ed9,_0xc43ff9){var _0x3ee317=_0x5ecd('0x59');var _0xacf40a={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1bdfbc){if(_0x1bdfbc){_0xacf40a=_0x1bdfbc;}return db['Setting'][_0x5ecd('0x52')]({'where':{'id':_0x1ede54[_0x5ecd('0x50')]['id']},'attributes':[_0x5ecd('0x62'),_0x5ecd('0x57'),_0x5ecd('0x5b'),_0x5ecd('0x5c'),_0x5ecd('0x6b'),'defaultLoginLogo',_0x5ecd('0x6c'),_0x5ecd('0x6d')],'raw':!![]});})[_0x5ecd('0x1b')](handleEntityNotFound(_0x320ed9,null))[_0x5ecd('0x1b')](function(_0x46a40a){if(_0x46a40a){var _0x49c478=_0x46a40a[_0x5ecd('0x57')]&&fs['existsSync'](path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3ee317,_['toLower'](_0x46a40a[_0x5ecd('0x57')])))?path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3ee317,_['toLower'](_0x46a40a[_0x5ecd('0x57')])):path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3ee317,_[_0x5ecd('0x61')](_0x5ecd('0x6e')));var _0x23277f=_0x5ecd('0x64')+_['upperFirst'](_0x5ecd('0x57'));if(_0x46a40a[_0x23277f]||!_0xacf40a['custom']){_0x49c478=path['join'](config[_0x5ecd('0x60')],_0x3ee317,_[_0x5ecd('0x61')](_0x5ecd('0x6e')));}if(!fs[_0x5ecd('0x5e')](_0x49c478)){throw new db['Sequelize']['ValidationError'](_[_0x5ecd('0x65')]('loginLogo')+_0x5ecd('0x68'));}return _0x320ed9['download'](_0x49c478);}})['catch'](handleError(_0x320ed9,null));};exports['gdpr']=function(_0x52acc7,_0xe6da16){return db[_0x5ecd('0x39')]['find']({'where':{'id':_0x52acc7[_0x5ecd('0x50')]['id']},'attributes':[_0x5ecd('0x6f')]})[_0x5ecd('0x1b')](respondWithResult(_0xe6da16,null))[_0x5ecd('0x26')](handleError(_0xe6da16,null));};exports['addPreferred']=function(_0x523748,_0x41787d,_0xde93a9){if(_0x523748[_0x5ecd('0x55')]&&_0x523748[_0x5ecd('0x55')][_0x5ecd('0x56')]){_0x523748['body'][_0x5ecd('0x5b')]=_0x523748['file'][_0x5ecd('0x56')];}return db['Setting']['find']({'where':{'id':_0x523748[_0x5ecd('0x50')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x41787d,null))['then'](saveUpdates(_0x523748['body'],null))[_0x5ecd('0x1b')](respondWithResult(_0x41787d,null))['catch'](handleError(_0x41787d,null));};var utilLicense=require(_0x5ecd('0x17'));exports['getPreferred']=function(_0x25413e,_0x13e38a,_0xb4bfb1){var _0x138be8=_0x5ecd('0x59');var _0xffef89={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x515936){if(_0x515936){_0xffef89=_0x515936;}return db['Setting'][_0x5ecd('0x52')]({'where':{'id':_0x25413e[_0x5ecd('0x50')]['id']},'attributes':['logo',_0x5ecd('0x57'),_0x5ecd('0x5b'),_0x5ecd('0x5c'),_0x5ecd('0x6b'),_0x5ecd('0x5d'),_0x5ecd('0x6c'),'defaultFavicon'],'raw':!![]});})[_0x5ecd('0x1b')](handleEntityNotFound(_0x13e38a,null))[_0x5ecd('0x1b')](function(_0x48d95d){if(_0x48d95d){var _0x3f7d05=_0x48d95d['preferred']&&fs['existsSync'](path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x138be8,_[_0x5ecd('0x61')](_0x48d95d['preferred'])))?path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x138be8,_[_0x5ecd('0x61')](_0x48d95d[_0x5ecd('0x5b')])):path['join'](config[_0x5ecd('0x60')],_0x138be8,_[_0x5ecd('0x61')]('default_preferred.png'));var _0x500d2f=_0x5ecd('0x64')+_['upperFirst'](_0x5ecd('0x5b'));if(_0x48d95d[_0x500d2f]||!_0xffef89[_0x5ecd('0x70')]||!_0xffef89[_0x5ecd('0x5b')]){_0x3f7d05=path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x138be8,_['toLower']('default_preferred.png'));}if(!fs[_0x5ecd('0x5e')](_0x3f7d05)){throw new db['Sequelize']['ValidationError'](_[_0x5ecd('0x65')]('preferred')+_0x5ecd('0x68'));}return _0x13e38a[_0x5ecd('0x69')](_0x3f7d05);}})[_0x5ecd('0x26')](handleError(_0x13e38a,null));};exports[_0x5ecd('0x71')]=function(_0x1b4cc5,_0x4e6a22,_0x3ddc6c){if(_0x1b4cc5[_0x5ecd('0x55')]&&_0x1b4cc5['file'][_0x5ecd('0x56')]){_0x1b4cc5[_0x5ecd('0x53')][_0x5ecd('0x5c')]=_0x1b4cc5[_0x5ecd('0x55')]['filename'];}return db[_0x5ecd('0x39')][_0x5ecd('0x52')]({'where':{'id':_0x1b4cc5[_0x5ecd('0x50')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x4e6a22,null))[_0x5ecd('0x1b')](saveUpdates(_0x1b4cc5[_0x5ecd('0x53')],null))['then'](respondWithResult(_0x4e6a22,null))['catch'](handleError(_0x4e6a22,null));};var utilLicense=require(_0x5ecd('0x17'));exports[_0x5ecd('0x72')]=function(_0x544a8d,_0x7d69dd,_0x292eaa){var _0x1bfaff=_0x5ecd('0x59');var _0x5acea2={'custom':![]};return utilLicense[_0x5ecd('0x5a')]()['then'](function(_0x3814fb){if(_0x3814fb){_0x5acea2=_0x3814fb;}return db[_0x5ecd('0x39')][_0x5ecd('0x52')]({'where':{'id':_0x544a8d['params']['id']},'attributes':[_0x5ecd('0x62'),_0x5ecd('0x57'),_0x5ecd('0x5b'),_0x5ecd('0x5c'),_0x5ecd('0x6b'),_0x5ecd('0x5d'),_0x5ecd('0x6c'),_0x5ecd('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x7d69dd,null))[_0x5ecd('0x1b')](function(_0x5d4db1){if(_0x5d4db1){var _0x5ba799=_0x5d4db1['favicon']&&fs[_0x5ecd('0x5e')](path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x1bfaff,_[_0x5ecd('0x61')](_0x5d4db1[_0x5ecd('0x5c')])))?path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x1bfaff,_['toLower'](_0x5d4db1[_0x5ecd('0x5c')])):path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x1bfaff,_[_0x5ecd('0x61')](_0x5ecd('0x73')));var _0x4dc2f8='default'+_[_0x5ecd('0x65')](_0x5ecd('0x5c'));if(_0x5d4db1[_0x4dc2f8]||!_0x5acea2[_0x5ecd('0x70')]){_0x5ba799=path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x1bfaff,_[_0x5ecd('0x61')](_0x5ecd('0x73')));}if(!fs[_0x5ecd('0x5e')](_0x5ba799)){throw new db[(_0x5ecd('0x66'))][(_0x5ecd('0x67'))](_[_0x5ecd('0x65')]('favicon')+_0x5ecd('0x68'));}return _0x7d69dd[_0x5ecd('0x69')](_0x5ba799);}})[_0x5ecd('0x26')](handleError(_0x7d69dd,null));};exports[_0x5ecd('0x74')]=function(_0x2a192a,_0x152522){var _0x298b5b={'offset':moment()[_0x5ecd('0x75')]()};_0x298b5b[_0x5ecd('0x76')]=moment()[_0x5ecd('0x75')](_0x298b5b[_0x5ecd('0x2a')])[_0x5ecd('0x77')](_0x5ecd('0x78'));return _0x152522[_0x5ecd('0x28')](0xc8)[_0x5ecd('0x36')](_0x298b5b);}; \ No newline at end of file +var _0x4680=['gdpr','securePassword','../../config/license/util','getPreferred','default_preferred.png','getFavicon','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','Setting','include','findAll','show','keys','includeAll','find','body','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','preferred','defaultLoginLogo','default_loginLogo.svg','custom'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4680,0x106));var _0x0468=function(_0x2c7f6c,_0x5e50e8){_0x2c7f6c=_0x2c7f6c-0x0;var _0x52a856=_0x4680[_0x2c7f6c];return _0x52a856;};'use strict';var emlformat=require(_0x0468('0x0'));var rimraf=require(_0x0468('0x1'));var zipdir=require(_0x0468('0x2'));var jsonpatch=require(_0x0468('0x3'));var rp=require('request-promise');var moment=require(_0x0468('0x4'));var BPromise=require(_0x0468('0x5'));var Mustache=require(_0x0468('0x6'));var util=require(_0x0468('0x7'));var path=require(_0x0468('0x8'));var sox=require(_0x0468('0x9'));var csv=require(_0x0468('0xa'));var ejs=require(_0x0468('0xb'));var fs=require('fs');var fs_extra=require(_0x0468('0xc'));var _=require('lodash');var squel=require(_0x0468('0xd'));var crypto=require(_0x0468('0xe'));var jsforce=require(_0x0468('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0468('0xa'));var querystring=require(_0x0468('0x10'));var Papa=require(_0x0468('0x11'));var Redis=require(_0x0468('0x12'));var authService=require(_0x0468('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0468('0x14'));var hardwareService=require(_0x0468('0x15'));var logger=require('../../config/logger')(_0x0468('0x16'));var utils=require('../../config/utils');var config=require(_0x0468('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0468('0x18'))['db'];var jayson=require(_0x0468('0x19'));var client=jayson[_0x0468('0x1a')][_0x0468('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x20c3fa,_0x3fee51,_0x37dd5a,_0x2fa8b4){return new BPromise(function(_0x1cf0a0,_0x2f583f){var _0x36ed72=_0x2fa8b4||client;return _0x36ed72[_0x0468('0x1c')](_0x20c3fa,_0x37dd5a)['then'](function(_0x12537a){logger[_0x0468('0x1d')]('Setting,\x20%s,\x20%s',_0x3fee51,_0x0468('0x1e'));logger[_0x0468('0x1f')](_0x0468('0x20'),_0x3fee51,_0x0468('0x1e'),JSON['stringify'](_0x12537a));if(_0x12537a[_0x0468('0x21')]){if(_0x12537a[_0x0468('0x21')][_0x0468('0x22')]===0x1f4){logger[_0x0468('0x21')](_0x0468('0x23'),_0x3fee51,_0x12537a[_0x0468('0x21')][_0x0468('0x24')]);return _0x2f583f(_0x12537a['error'][_0x0468('0x24')]);}logger[_0x0468('0x21')](_0x0468('0x23'),_0x3fee51,_0x12537a[_0x0468('0x21')][_0x0468('0x24')]);return _0x1cf0a0(_0x12537a[_0x0468('0x21')][_0x0468('0x24')]);}else{logger[_0x0468('0x1d')]('Setting,\x20%s,\x20%s',_0x3fee51,'request\x20sent');_0x1cf0a0(_0x12537a[_0x0468('0x25')][_0x0468('0x24')]);}})[_0x0468('0x26')](function(_0xf2ea57){logger[_0x0468('0x21')](_0x0468('0x23'),_0x3fee51,_0xf2ea57);_0x2f583f(_0xf2ea57);});});}function respondWithStatusCode(_0x5d9330,_0x57a232){_0x57a232=_0x57a232||0xcc;return function(_0x4cbbdf){if(_0x4cbbdf){return _0x5d9330[_0x0468('0x27')](_0x57a232);}return _0x5d9330[_0x0468('0x28')](_0x57a232)[_0x0468('0x29')]();};}function respondWithResult(_0x3d6042,_0x639946){_0x639946=_0x639946||0xc8;return function(_0x23e772){if(_0x23e772){return _0x3d6042['status'](_0x639946)['json'](_0x23e772);}};}function respondWithFilteredResult(_0x3b9d1f,_0x3d36a1){return function(_0x57c1cd){if(_0x57c1cd){var _0x203b69=typeof _0x3d36a1[_0x0468('0x2a')]===_0x0468('0x2b')&&typeof _0x3d36a1[_0x0468('0x2c')]===_0x0468('0x2b');var _0x17929b=_0x57c1cd[_0x0468('0x2d')];var _0x4097fd=_0x203b69?0x0:_0x3d36a1[_0x0468('0x2a')];var _0x240782=_0x203b69?_0x57c1cd['count']:_0x3d36a1[_0x0468('0x2a')]+_0x3d36a1[_0x0468('0x2c')];var _0x2e2089;if(_0x240782>=_0x17929b){_0x240782=_0x17929b;_0x2e2089=0xc8;}else{_0x2e2089=0xce;}_0x3b9d1f[_0x0468('0x28')](_0x2e2089);return _0x3b9d1f[_0x0468('0x2e')](_0x0468('0x2f'),_0x4097fd+'-'+_0x240782+'/'+_0x17929b)['json'](_0x57c1cd);}return null;};}function patchUpdates(_0xf921ce){return function(_0x51424d){try{jsonpatch[_0x0468('0x30')](_0x51424d,_0xf921ce,!![]);}catch(_0x1a8c4b){return BPromise['reject'](_0x1a8c4b);}return _0x51424d[_0x0468('0x31')]();};}function saveUpdates(_0x5d4391,_0x574888){return function(_0x4a6668){if(_0x4a6668){return _0x4a6668[_0x0468('0x32')](_0x5d4391)[_0x0468('0x33')](function(_0x3d42f3){return _0x3d42f3;});}return null;};}function removeEntity(_0x48afc8,_0x3510bb){return function(_0x2c9558){if(_0x2c9558){return _0x2c9558[_0x0468('0x34')]()[_0x0468('0x33')](function(){_0x48afc8[_0x0468('0x28')](0xcc)[_0x0468('0x29')]();});}};}function handleEntityNotFound(_0x241d3e,_0x882dd1){return function(_0x1caad1){if(!_0x1caad1){_0x241d3e[_0x0468('0x27')](0x194);}return _0x1caad1;};}function handleError(_0x2b387d,_0x56ded6){_0x56ded6=_0x56ded6||0x1f4;return function(_0x515fca){logger[_0x0468('0x21')](_0x515fca[_0x0468('0x35')]);if(_0x515fca[_0x0468('0x36')]){delete _0x515fca['name'];}_0x2b387d[_0x0468('0x28')](_0x56ded6)['send'](_0x515fca);};}exports[_0x0468('0x37')]=function(_0x10dcef,_0x5ac02b){var _0x1bfbc4={},_0x3b61cc={},_0x45f00a={'count':0x0,'rows':[]};var _0x8baaa1=_['map'](db['Setting'][_0x0468('0x38')],function(_0x109a5f){return{'name':_0x109a5f[_0x0468('0x39')],'type':_0x109a5f[_0x0468('0x3a')][_0x0468('0x3b')]};});_0x3b61cc[_0x0468('0x3c')]=_['map'](_0x8baaa1,_0x0468('0x36'));_0x3b61cc['query']=_['keys'](_0x10dcef[_0x0468('0x3d')]);_0x3b61cc[_0x0468('0x3e')]=_['intersection'](_0x3b61cc[_0x0468('0x3c')],_0x3b61cc[_0x0468('0x3d')]);_0x1bfbc4['attributes']=_[_0x0468('0x3f')](_0x3b61cc['model'],qs[_0x0468('0x40')](_0x10dcef[_0x0468('0x3d')][_0x0468('0x40')]));_0x1bfbc4[_0x0468('0x41')]=_0x1bfbc4['attributes'][_0x0468('0x42')]?_0x1bfbc4['attributes']:_0x3b61cc[_0x0468('0x3c')];if(!_0x10dcef[_0x0468('0x3d')][_0x0468('0x43')](_0x0468('0x44'))){_0x1bfbc4[_0x0468('0x2c')]=qs[_0x0468('0x2c')](_0x10dcef[_0x0468('0x3d')]['limit']);_0x1bfbc4[_0x0468('0x2a')]=qs[_0x0468('0x2a')](_0x10dcef[_0x0468('0x3d')]['offset']);}_0x1bfbc4[_0x0468('0x45')]=qs[_0x0468('0x46')](_0x10dcef[_0x0468('0x3d')]['sort']);_0x1bfbc4['where']=qs['filters'](_[_0x0468('0x47')](_0x10dcef['query'],_0x3b61cc[_0x0468('0x3e')]),_0x8baaa1);if(_0x10dcef[_0x0468('0x3d')][_0x0468('0x48')]){_0x1bfbc4[_0x0468('0x49')]=_[_0x0468('0x4a')](_0x1bfbc4['where'],{'$or':_['map'](_0x8baaa1,function(_0x491e6e){if(_0x491e6e[_0x0468('0x3a')]!=='VIRTUAL'){var _0x3746ce={};_0x3746ce[_0x491e6e[_0x0468('0x36')]]={'$like':'%'+_0x10dcef['query'][_0x0468('0x48')]+'%'};return _0x3746ce;}})});}_0x1bfbc4=_[_0x0468('0x4a')]({},_0x1bfbc4,_0x10dcef[_0x0468('0x4b')]);var _0x26fbc4={'where':_0x1bfbc4[_0x0468('0x49')]};return db[_0x0468('0x4c')][_0x0468('0x2d')](_0x26fbc4)[_0x0468('0x33')](function(_0x19516b){_0x45f00a[_0x0468('0x2d')]=_0x19516b;if(_0x10dcef[_0x0468('0x3d')]['includeAll']){_0x1bfbc4[_0x0468('0x4d')]=[{'all':!![]}];}return db[_0x0468('0x4c')][_0x0468('0x4e')](_0x1bfbc4);})['then'](function(_0x1b3fdc){_0x45f00a['rows']=_0x1b3fdc;return _0x45f00a;})['then'](respondWithFilteredResult(_0x5ac02b,_0x1bfbc4))[_0x0468('0x26')](handleError(_0x5ac02b,null));};exports[_0x0468('0x4f')]=function(_0x4bc0a1,_0x3488ed){var _0x228f29={'raw':![],'where':{'id':_0x4bc0a1['params']['id']}},_0x408ccb={};_0x408ccb['model']=_[_0x0468('0x50')](db[_0x0468('0x4c')][_0x0468('0x38')]);_0x408ccb[_0x0468('0x3d')]=_[_0x0468('0x50')](_0x4bc0a1[_0x0468('0x3d')]);_0x408ccb['filters']=_[_0x0468('0x3f')](_0x408ccb[_0x0468('0x3c')],_0x408ccb[_0x0468('0x3d')]);_0x228f29[_0x0468('0x41')]=_[_0x0468('0x3f')](_0x408ccb[_0x0468('0x3c')],qs['fields'](_0x4bc0a1[_0x0468('0x3d')][_0x0468('0x40')]));_0x228f29['attributes']=_0x228f29[_0x0468('0x41')][_0x0468('0x42')]?_0x228f29[_0x0468('0x41')]:_0x408ccb['model'];if(_0x4bc0a1[_0x0468('0x3d')][_0x0468('0x51')]){_0x228f29[_0x0468('0x4d')]=[{'all':!![]}];}_0x228f29=_[_0x0468('0x4a')]({},_0x228f29,_0x4bc0a1['options']);return db['Setting'][_0x0468('0x52')](_0x228f29)[_0x0468('0x33')](handleEntityNotFound(_0x3488ed,null))[_0x0468('0x33')](respondWithResult(_0x3488ed,null))[_0x0468('0x26')](handleError(_0x3488ed,null));};exports[_0x0468('0x32')]=function(_0x28e218,_0x27a4fe){if(_0x28e218['body']['id']){delete _0x28e218[_0x0468('0x53')]['id'];}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x28e218[_0x0468('0x54')]['id']}})['then'](handleEntityNotFound(_0x27a4fe,null))[_0x0468('0x33')](saveUpdates(_0x28e218[_0x0468('0x53')],null))[_0x0468('0x33')](respondWithResult(_0x27a4fe,null))[_0x0468('0x26')](handleError(_0x27a4fe,null));};exports[_0x0468('0x55')]=function(_0x501801,_0x2e107e,_0x1bbbea){if(_0x501801[_0x0468('0x56')]&&_0x501801['file'][_0x0468('0x57')]){_0x501801['body'][_0x0468('0x58')]=_0x501801['file']['filename'];}return db[_0x0468('0x4c')]['find']({'where':{'id':_0x501801[_0x0468('0x54')]['id']}})['then'](handleEntityNotFound(_0x2e107e,null))[_0x0468('0x33')](saveUpdates(_0x501801[_0x0468('0x53')],null))[_0x0468('0x33')](respondWithResult(_0x2e107e,null))[_0x0468('0x26')](handleError(_0x2e107e,null));};exports[_0x0468('0x59')]=function(_0x58d0ef,_0x16fb46,_0x3489c6){if(_0x58d0ef[_0x0468('0x56')]&&_0x58d0ef[_0x0468('0x56')][_0x0468('0x57')]){_0x58d0ef['body'][_0x0468('0x5a')]=_0x58d0ef[_0x0468('0x56')][_0x0468('0x57')];}return db['Setting']['find']({'where':{'id':_0x58d0ef[_0x0468('0x54')]['id']}})[_0x0468('0x33')](handleEntityNotFound(_0x16fb46,null))[_0x0468('0x33')](saveUpdates(_0x58d0ef[_0x0468('0x53')],null))['then'](respondWithResult(_0x16fb46,null))[_0x0468('0x26')](handleError(_0x16fb46,null));};var utilLicense=require('../../config/license/util');exports[_0x0468('0x5b')]=function(_0x143625,_0x3643b1,_0x121bcd){var _0x1c4538=_0x0468('0x5c');var _0x2ef05f={'custom':![]};return utilLicense[_0x0468('0x5d')]()['then'](function(_0x2cb9aa){if(_0x2cb9aa){_0x2ef05f=_0x2cb9aa;}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x143625[_0x0468('0x54')]['id']},'attributes':[_0x0468('0x58'),_0x0468('0x5a'),'preferred',_0x0468('0x5e'),_0x0468('0x5f'),'defaultLoginLogo',_0x0468('0x60'),_0x0468('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x3643b1,null))['then'](function(_0x1dc5ed){if(_0x1dc5ed){var _0xe01d32=_0x1dc5ed['logo']&&fs[_0x0468('0x62')](path[_0x0468('0x63')](config[_0x0468('0x64')],_0x1c4538,_[_0x0468('0x65')](_0x1dc5ed['logo'])))?path[_0x0468('0x63')](config[_0x0468('0x64')],_0x1c4538,_[_0x0468('0x65')](_0x1dc5ed[_0x0468('0x58')])):path[_0x0468('0x63')](config[_0x0468('0x64')],_0x1c4538,_[_0x0468('0x65')](_0x0468('0x66')));var _0x5267df=_0x0468('0x67')+_[_0x0468('0x68')](_0x0468('0x58'));if(_0x1dc5ed[_0x5267df]||!_0x2ef05f['custom']){_0xe01d32=path[_0x0468('0x63')](config['root'],_0x1c4538,_[_0x0468('0x65')]('default_logo.svg'));}if(!fs[_0x0468('0x62')](_0xe01d32)){throw new db[(_0x0468('0x69'))][(_0x0468('0x6a'))](_[_0x0468('0x68')](_0x0468('0x58'))+_0x0468('0x6b'));}return _0x3643b1[_0x0468('0x6c')](_0xe01d32);}})['catch'](handleError(_0x3643b1,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x87b8d6,_0x3f6015,_0x1fc857){var _0x4928bd='server/files/images/logos';var _0x1b7d48={'custom':![]};return utilLicense[_0x0468('0x5d')]()[_0x0468('0x33')](function(_0x42c077){if(_0x42c077){_0x1b7d48=_0x42c077;}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x87b8d6[_0x0468('0x54')]['id']},'attributes':[_0x0468('0x58'),_0x0468('0x5a'),_0x0468('0x6d'),_0x0468('0x5e'),_0x0468('0x5f'),_0x0468('0x6e'),_0x0468('0x60'),_0x0468('0x61')],'raw':!![]});})[_0x0468('0x33')](handleEntityNotFound(_0x3f6015,null))[_0x0468('0x33')](function(_0x159bca){if(_0x159bca){var _0x5a82ec=_0x159bca[_0x0468('0x5a')]&&fs[_0x0468('0x62')](path[_0x0468('0x63')](config['root'],_0x4928bd,_[_0x0468('0x65')](_0x159bca[_0x0468('0x5a')])))?path[_0x0468('0x63')](config[_0x0468('0x64')],_0x4928bd,_[_0x0468('0x65')](_0x159bca[_0x0468('0x5a')])):path[_0x0468('0x63')](config[_0x0468('0x64')],_0x4928bd,_[_0x0468('0x65')](_0x0468('0x6f')));var _0x1913d7=_0x0468('0x67')+_[_0x0468('0x68')](_0x0468('0x5a'));if(_0x159bca[_0x1913d7]||!_0x1b7d48[_0x0468('0x70')]){_0x5a82ec=path['join'](config[_0x0468('0x64')],_0x4928bd,_[_0x0468('0x65')](_0x0468('0x6f')));}if(!fs[_0x0468('0x62')](_0x5a82ec)){throw new db[(_0x0468('0x69'))][(_0x0468('0x6a'))](_['upperFirst'](_0x0468('0x5a'))+_0x0468('0x6b'));}return _0x3f6015[_0x0468('0x6c')](_0x5a82ec);}})[_0x0468('0x26')](handleError(_0x3f6015,null));};exports[_0x0468('0x71')]=function(_0x333eba,_0x419d8c){return db[_0x0468('0x4c')]['find']({'where':{'id':_0x333eba[_0x0468('0x54')]['id']},'attributes':[_0x0468('0x72')]})[_0x0468('0x33')](respondWithResult(_0x419d8c,null))[_0x0468('0x26')](handleError(_0x419d8c,null));};exports['addPreferred']=function(_0x195933,_0x18fddc,_0x1a6ede){if(_0x195933[_0x0468('0x56')]&&_0x195933[_0x0468('0x56')][_0x0468('0x57')]){_0x195933[_0x0468('0x53')][_0x0468('0x6d')]=_0x195933[_0x0468('0x56')][_0x0468('0x57')];}return db['Setting'][_0x0468('0x52')]({'where':{'id':_0x195933[_0x0468('0x54')]['id']}})[_0x0468('0x33')](handleEntityNotFound(_0x18fddc,null))[_0x0468('0x33')](saveUpdates(_0x195933[_0x0468('0x53')],null))[_0x0468('0x33')](respondWithResult(_0x18fddc,null))[_0x0468('0x26')](handleError(_0x18fddc,null));};var utilLicense=require(_0x0468('0x73'));exports[_0x0468('0x74')]=function(_0x4bb7be,_0x402814,_0x2089d7){var _0x10cd21='server/files/images/logos';var _0x3c6828={'custom':![]};return utilLicense['getLicense']()[_0x0468('0x33')](function(_0x4a5792){if(_0x4a5792){_0x3c6828=_0x4a5792;}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x4bb7be['params']['id']},'attributes':[_0x0468('0x58'),_0x0468('0x5a'),_0x0468('0x6d'),_0x0468('0x5e'),'defaultLogo','defaultLoginLogo',_0x0468('0x60'),_0x0468('0x61')],'raw':!![]});})[_0x0468('0x33')](handleEntityNotFound(_0x402814,null))[_0x0468('0x33')](function(_0x5525a8){if(_0x5525a8){var _0x51f081=_0x5525a8[_0x0468('0x6d')]&&fs[_0x0468('0x62')](path['join'](config[_0x0468('0x64')],_0x10cd21,_[_0x0468('0x65')](_0x5525a8[_0x0468('0x6d')])))?path['join'](config[_0x0468('0x64')],_0x10cd21,_['toLower'](_0x5525a8[_0x0468('0x6d')])):path['join'](config['root'],_0x10cd21,_['toLower'](_0x0468('0x75')));var _0x364374=_0x0468('0x67')+_[_0x0468('0x68')]('preferred');if(_0x5525a8[_0x364374]||!_0x3c6828[_0x0468('0x70')]||!_0x3c6828['preferred']){_0x51f081=path[_0x0468('0x63')](config[_0x0468('0x64')],_0x10cd21,_['toLower']('default_preferred.png'));}if(!fs[_0x0468('0x62')](_0x51f081)){throw new db['Sequelize'][(_0x0468('0x6a'))](_['upperFirst'](_0x0468('0x6d'))+'\x20not\x20found');}return _0x402814[_0x0468('0x6c')](_0x51f081);}})[_0x0468('0x26')](handleError(_0x402814,null));};exports['addFavicon']=function(_0x737f24,_0x663f03,_0x6d2cef){if(_0x737f24['file']&&_0x737f24[_0x0468('0x56')][_0x0468('0x57')]){_0x737f24[_0x0468('0x53')][_0x0468('0x5e')]=_0x737f24['file']['filename'];}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x737f24['params']['id']}})['then'](handleEntityNotFound(_0x663f03,null))[_0x0468('0x33')](saveUpdates(_0x737f24['body'],null))[_0x0468('0x33')](respondWithResult(_0x663f03,null))['catch'](handleError(_0x663f03,null));};var utilLicense=require(_0x0468('0x73'));exports[_0x0468('0x76')]=function(_0x4525af,_0x831127,_0x5686f9){var _0x3aa85c='server/files/images/logos';var _0x5909d8={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xe2ad56){if(_0xe2ad56){_0x5909d8=_0xe2ad56;}return db[_0x0468('0x4c')]['find']({'where':{'id':_0x4525af[_0x0468('0x54')]['id']},'attributes':[_0x0468('0x58'),_0x0468('0x5a'),_0x0468('0x6d'),_0x0468('0x5e'),'defaultLogo','defaultLoginLogo',_0x0468('0x60'),_0x0468('0x61')],'raw':!![]});})[_0x0468('0x33')](handleEntityNotFound(_0x831127,null))[_0x0468('0x33')](function(_0x4779a6){if(_0x4779a6){var _0xa66bc9=_0x4779a6[_0x0468('0x5e')]&&fs[_0x0468('0x62')](path[_0x0468('0x63')](config[_0x0468('0x64')],_0x3aa85c,_[_0x0468('0x65')](_0x4779a6['favicon'])))?path[_0x0468('0x63')](config[_0x0468('0x64')],_0x3aa85c,_['toLower'](_0x4779a6['favicon'])):path[_0x0468('0x63')](config[_0x0468('0x64')],_0x3aa85c,_[_0x0468('0x65')]('default_favicon.ico'));var _0x3d79c6=_0x0468('0x67')+_[_0x0468('0x68')](_0x0468('0x5e'));if(_0x4779a6[_0x3d79c6]||!_0x5909d8[_0x0468('0x70')]){_0xa66bc9=path[_0x0468('0x63')](config[_0x0468('0x64')],_0x3aa85c,_[_0x0468('0x65')]('default_favicon.ico'));}if(!fs['existsSync'](_0xa66bc9)){throw new db[(_0x0468('0x69'))][(_0x0468('0x6a'))](_[_0x0468('0x68')]('favicon')+_0x0468('0x6b'));}return _0x831127[_0x0468('0x6c')](_0xa66bc9);}})[_0x0468('0x26')](handleError(_0x831127,null));};exports[_0x0468('0x77')]=function(_0x59485f,_0x4b21b5){var _0x2c82b5={'offset':moment()['utcOffset']()};_0x2c82b5[_0x0468('0x78')]=moment()[_0x0468('0x79')](_0x2c82b5[_0x0468('0x2a')])[_0x0468('0x7a')](_0x0468('0x7b'));return _0x4b21b5['status'](0xc8)[_0x0468('0x7c')](_0x2c82b5);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 26d584f..830c5f8 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x22dca5,_0x298b56){var _0x4737fa=function(_0x4b721b){while(--_0x4b721b){_0x22dca5['push'](_0x22dca5['shift']());}};_0x4737fa(++_0x298b56);}(_0x34e8,0x12c));var _0x834e=function(_0x11aed9,_0x126166){_0x11aed9=_0x11aed9-0x0;var _0x115799=_0x34e8[_0x11aed9];return _0x115799;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x55ca,0x126));var _0xa55c=function(_0x3dbd6d,_0x3ee9d7){_0x3dbd6d=_0x3dbd6d-0x0;var _0x1216f1=_0x55ca[_0x3dbd6d];return _0x1216f1;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 89031f9..6ca91cc 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 _0x1c41=['error','code','message','catch','ShowSetting','Setting','options','attributes','include','map','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1cbaf8,_0x50354b){var _0x135f7a=function(_0x132a60){while(--_0x132a60){_0x1cbaf8['push'](_0x1cbaf8['shift']());}};_0x135f7a(++_0x50354b);}(_0x1c41,0xa7));var _0x11c4=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0x1c41[_0x11155f];return _0xd07e48;};'use strict';var _=require(_0x11c4('0x0'));var util=require(_0x11c4('0x1'));var moment=require('moment');var BPromise=require(_0x11c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11c4('0x3'));var db=require(_0x11c4('0x4'))['db'];var utils=require(_0x11c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x11c4('0x6'));var client=jayson[_0x11c4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4223f7,_0x57873e,_0x5c36f8){return new BPromise(function(_0x5d5531,_0x30efec){return client[_0x11c4('0x8')](_0x4223f7,_0x5c36f8)[_0x11c4('0x9')](function(_0x4632ee){logger[_0x11c4('0xa')](_0x11c4('0xb'),_0x57873e,_0x11c4('0xc'));logger[_0x11c4('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x57873e,_0x11c4('0xc'),JSON[_0x11c4('0xe')](_0x4632ee));if(_0x4632ee[_0x11c4('0xf')]){if(_0x4632ee['error'][_0x11c4('0x10')]===0x1f4){logger[_0x11c4('0xf')](_0x11c4('0xb'),_0x57873e,_0x4632ee[_0x11c4('0xf')][_0x11c4('0x11')]);return _0x30efec(_0x4632ee[_0x11c4('0xf')][_0x11c4('0x11')]);}logger[_0x11c4('0xf')]('Setting,\x20%s,\x20%s',_0x57873e,_0x4632ee[_0x11c4('0xf')]['message']);return _0x5d5531(_0x4632ee[_0x11c4('0xf')][_0x11c4('0x11')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x57873e,_0x11c4('0xc'));_0x5d5531(_0x4632ee['result'][_0x11c4('0x11')]);}})[_0x11c4('0x12')](function(_0x46e26f){logger['error'](_0x11c4('0xb'),_0x57873e,_0x46e26f);_0x30efec(_0x46e26f);});});}exports[_0x11c4('0x13')]=function(_0x3f9fc2){var _0x486fea=this;return new Promise(function(_0x5e8a24,_0x135e1a){return db[_0x11c4('0x14')]['find']({'raw':_0x3f9fc2[_0x11c4('0x15')]?_0x3f9fc2[_0x11c4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3f9fc2[_0x11c4('0x15')]?_0x3f9fc2['options']['where']||null:null,'attributes':_0x3f9fc2[_0x11c4('0x15')]?_0x3f9fc2[_0x11c4('0x15')][_0x11c4('0x16')]||null:null,'include':_0x3f9fc2[_0x11c4('0x15')]?_0x3f9fc2['options'][_0x11c4('0x17')]?_[_0x11c4('0x18')](_0x3f9fc2['options'][_0x11c4('0x17')],function(_0x399fb6){return{'model':db[_0x399fb6[_0x11c4('0x19')]],'as':_0x399fb6['as'],'attributes':_0x399fb6[_0x11c4('0x16')],'include':_0x399fb6[_0x11c4('0x17')]?_[_0x11c4('0x18')](_0x399fb6[_0x11c4('0x17')],function(_0x3927c7){return{'model':db[_0x3927c7[_0x11c4('0x19')]],'as':_0x3927c7['as'],'attributes':_0x3927c7[_0x11c4('0x16')],'include':_0x3927c7['include']?_['map'](_0x3927c7[_0x11c4('0x17')],function(_0x110061){return{'model':db[_0x110061[_0x11c4('0x19')]],'as':_0x110061['as'],'attributes':_0x110061[_0x11c4('0x16')]};}):[]};}):[]};}):[]:[]})[_0x11c4('0x9')](function(_0x3ce9a2){logger[_0x11c4('0xa')](_0x11c4('0x13'),_0x3f9fc2);logger['debug'](_0x11c4('0x13'),_0x3f9fc2,JSON['stringify'](_0x3ce9a2));_0x5e8a24(_0x3ce9a2);})['catch'](function(_0x5bc270){logger[_0x11c4('0xf')](_0x11c4('0x13'),_0x5bc270['message'],_0x3f9fc2);_0x135e1a(_0x486fea[_0x11c4('0xf')](0x1f4,_0x5bc270['message']));});});}; \ No newline at end of file +var _0xb39c=['map','model','attributes','then','stringify','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','include'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0xb39c,0xec));var _0xcb39=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb39c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xcb39('0x0'));var moment=require('moment');var BPromise=require(_0xcb39('0x1'));var rs=require(_0xcb39('0x2'));var fs=require('fs');var Redis=require(_0xcb39('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb39('0x4'));var logger=require(_0xcb39('0x5'))(_0xcb39('0x6'));var config=require(_0xcb39('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcb39('0x8')][_0xcb39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x253b0c,_0x1773eb,_0x1f85cb){return new BPromise(function(_0x36cc06,_0x56ef9b){return client[_0xcb39('0xa')](_0x253b0c,_0x1f85cb)['then'](function(_0x3f1a9b){logger[_0xcb39('0xb')](_0xcb39('0xc'),_0x1773eb,_0xcb39('0xd'));logger[_0xcb39('0xe')](_0xcb39('0xf'),_0x1773eb,_0xcb39('0xd'),JSON['stringify'](_0x3f1a9b));if(_0x3f1a9b['error']){if(_0x3f1a9b[_0xcb39('0x10')][_0xcb39('0x11')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x1773eb,_0x3f1a9b[_0xcb39('0x10')][_0xcb39('0x12')]);return _0x56ef9b(_0x3f1a9b[_0xcb39('0x10')][_0xcb39('0x12')]);}logger[_0xcb39('0x10')](_0xcb39('0xc'),_0x1773eb,_0x3f1a9b[_0xcb39('0x10')]['message']);return _0x36cc06(_0x3f1a9b[_0xcb39('0x10')][_0xcb39('0x12')]);}else{logger[_0xcb39('0xb')]('Setting,\x20%s,\x20%s',_0x1773eb,_0xcb39('0xd'));_0x36cc06(_0x3f1a9b[_0xcb39('0x13')]['message']);}})[_0xcb39('0x14')](function(_0x3215c9){logger[_0xcb39('0x10')](_0xcb39('0xc'),_0x1773eb,_0x3215c9);_0x56ef9b(_0x3215c9);});});}exports[_0xcb39('0x15')]=function(_0x28b759){var _0x1e5d0e=this;return new Promise(function(_0x5a4770,_0x4ffaed){return db[_0xcb39('0x16')][_0xcb39('0x17')]({'raw':_0x28b759[_0xcb39('0x18')]?_0x28b759[_0xcb39('0x18')][_0xcb39('0x19')]===undefined?!![]:![]:!![],'where':_0x28b759[_0xcb39('0x18')]?_0x28b759[_0xcb39('0x18')][_0xcb39('0x1a')]||null:null,'attributes':_0x28b759[_0xcb39('0x18')]?_0x28b759[_0xcb39('0x18')]['attributes']||null:null,'include':_0x28b759[_0xcb39('0x18')]?_0x28b759[_0xcb39('0x18')][_0xcb39('0x1b')]?_[_0xcb39('0x1c')](_0x28b759[_0xcb39('0x18')][_0xcb39('0x1b')],function(_0x4fa7b0){return{'model':db[_0x4fa7b0[_0xcb39('0x1d')]],'as':_0x4fa7b0['as'],'attributes':_0x4fa7b0[_0xcb39('0x1e')],'include':_0x4fa7b0[_0xcb39('0x1b')]?_[_0xcb39('0x1c')](_0x4fa7b0[_0xcb39('0x1b')],function(_0x12d6e7){return{'model':db[_0x12d6e7[_0xcb39('0x1d')]],'as':_0x12d6e7['as'],'attributes':_0x12d6e7[_0xcb39('0x1e')],'include':_0x12d6e7[_0xcb39('0x1b')]?_[_0xcb39('0x1c')](_0x12d6e7[_0xcb39('0x1b')],function(_0x3804b5){return{'model':db[_0x3804b5[_0xcb39('0x1d')]],'as':_0x3804b5['as'],'attributes':_0x3804b5[_0xcb39('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcb39('0x1f')](function(_0x59a72a){logger['info']('ShowSetting',_0x28b759);logger[_0xcb39('0xe')](_0xcb39('0x15'),_0x28b759,JSON[_0xcb39('0x20')](_0x59a72a));_0x5a4770(_0x59a72a);})['catch'](function(_0x4d86e5){logger['error']('ShowSetting',_0x4d86e5[_0xcb39('0x12')],_0x28b759);_0x4ffaed(_0x1e5d0e[_0xcb39('0x10')](0x1f4,_0x4d86e5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 72ef638..9a7a298 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 _0x7fbe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','/:id/notify','notify','put','delete','removeAnswers','path','connect-timeout','express'];(function(_0x39e982,_0x431e35){var _0x45bb57=function(_0x4cf829){while(--_0x4cf829){_0x39e982['push'](_0x39e982['shift']());}};_0x45bb57(++_0x431e35);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x452450,_0x40b419){_0x452450=_0x452450-0x0;var _0x448b19=_0x7fbe[_0x452450];return _0x448b19;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['get'](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x9')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x9')](_0xe7fb('0x13'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x9')](_0xe7fb('0x15'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x16')]);router['get'](_0xe7fb('0x17'),controller[_0xe7fb('0x18')]);router['get'](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['getAgents']);router[_0xe7fb('0x1a')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x1b')]);router[_0xe7fb('0x1a')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['addDisposition']);router[_0xe7fb('0x1a')]('/:id/canned_answers',auth[_0xe7fb('0xa')](),controller['addAnswer']);router[_0xe7fb('0x1a')](_0xe7fb('0x1c'),controller[_0xe7fb('0x1d')]);router[_0xe7fb('0x1a')]('/:id/applications',auth[_0xe7fb('0xa')](),controller['addApplications']);router[_0xe7fb('0x1a')]('/:id/send',auth[_0xe7fb('0xa')](),controller['send']);router[_0xe7fb('0x1a')](_0xe7fb('0x17'),controller['status']);router[_0xe7fb('0x1a')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['addAgents']);router[_0xe7fb('0x1e')](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe7fb('0x1f')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['removeDispositions']);router[_0xe7fb('0x1f')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x20')]);router[_0xe7fb('0x1f')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0xccc236,_0x3b75d7){var _0x45767f=function(_0x4d000e){while(--_0x4d000e){_0xccc236['push'](_0xccc236['shift']());}};_0x45767f(++_0x3b75d7);}(_0x6aa7,0x178));var _0x76aa=function(_0x3077dc,_0x17cc4d){_0x3077dc=_0x3077dc-0x0;var _0x4afba7=_0x6aa7[_0x3077dc];return _0x4afba7;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index b4a9b14..08c39b6 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 _0xf7df=['infobip','intelepeer','BOOLEAN','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','name','ENUM','skebby','plivo','clickatell','bandwidth','csc'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xf7df,0x10e));var _0xff7d=function(_0x4e288d,_0x155efe){_0x4e288d=_0x4e288d-0x0;var _0x58baf6=_0xf7df[_0x4e288d];return _0x58baf6;};'use strict';var Sequelize=require(_0xff7d('0x0'));var rs=require('randomstring');module[_0xff7d('0x1')]={'name':{'type':Sequelize[_0xff7d('0x2')],'unique':_0xff7d('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xff7d('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xff7d('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xff7d('0x2')]},'type':{'type':Sequelize[_0xff7d('0x4')]('twilio',_0xff7d('0x5'),'connectel','clicksend',_0xff7d('0x6'),_0xff7d('0x7'),_0xff7d('0x8'),_0xff7d('0x9'),_0xff7d('0xa'),_0xff7d('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xff7d('0x2')]},'authToken':{'type':Sequelize[_0xff7d('0x2')]},'smsMethod':{'type':Sequelize[_0xff7d('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xff7d('0x2')]},'password':{'type':Sequelize[_0xff7d('0x2')]},'apiKey':{'type':Sequelize[_0xff7d('0x2')]},'applicationId':{'type':Sequelize[_0xff7d('0x2')]},'accountId':{'type':Sequelize[_0xff7d('0x2')]},'senderString':{'type':Sequelize[_0xff7d('0x2')]},'deliveryReport':{'type':Sequelize[_0xff7d('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xff7d('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xff7d('0xd');}},'notificationSound':{'type':Sequelize[_0xff7d('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xff7d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xff7d('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xff7d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xff7d('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xff7d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xff7d('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xff7d('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xff7d('0xc')],'defaultValue':![],'comment':_0xff7d('0x10'),'set':function(_0x14d6b3){if(!_0x14d6b3)this[_0xff7d('0x11')](_0xff7d('0x12'),null);this[_0xff7d('0x11')](_0xff7d('0x13'),_0x14d6b3);}}}; \ No newline at end of file +var _0xfb2f=['connectel','clicksend','plivo','clickatell','bandwidth','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','twilio','skebby'];(function(_0x78373d,_0x2507db){var _0x5f3a5d=function(_0x373255){while(--_0x373255){_0x78373d['push'](_0x78373d['shift']());}};_0x5f3a5d(++_0x2507db);}(_0xfb2f,0x13d));var _0xffb2=function(_0x5880a5,_0x4a52d6){_0x5880a5=_0x5880a5-0x0;var _0xa2818d=_0xfb2f[_0x5880a5];return _0xa2818d;};'use strict';var Sequelize=require(_0xffb2('0x0'));var rs=require('randomstring');module[_0xffb2('0x1')]={'name':{'type':Sequelize[_0xffb2('0x2')],'unique':_0xffb2('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xffb2('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xffb2('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xffb2('0x2')]},'type':{'type':Sequelize[_0xffb2('0x4')](_0xffb2('0x5'),_0xffb2('0x6'),_0xffb2('0x7'),_0xffb2('0x8'),_0xffb2('0x9'),_0xffb2('0xa'),_0xffb2('0xb'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xffb2('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xffb2('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xffb2('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xffb2('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xffb2('0x2')]},'senderString':{'type':Sequelize[_0xffb2('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xffb2('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xffb2('0xc');}},'notificationSound':{'type':Sequelize[_0xffb2('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xffb2('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xffb2('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xffb2('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xffb2('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xffb2('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xffb2('0xe')],'comment':_0xffb2('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x32ef5f){if(!_0x32ef5f)this[_0xffb2('0x10')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xffb2('0x11'),_0x32ef5f);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 50fde33..3ca9cca 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 _0x97f2=['groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','body','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','order','ids','CannedAnswer','getAnswers','removeAnswers','notify','Applications','applications','priority','asc','account','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','text','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','DESC','list','omit','Contacts','SmsInteraction','interaction','created','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','SmsApplication','findAndCountAll','stack','finally','getApplications','Contact','Owner','fullname','internal','color','tag','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','status_code'];(function(_0x8afaa9,_0x4c3138){var _0x3c1ad0=function(_0x5d1817){while(--_0x5d1817){_0x8afaa9['push'](_0x8afaa9['shift']());}};_0x3c1ad0(++_0x4c3138);}(_0x97f2,0xf3));var _0x297f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x97f2[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x297f('0x0'));var zipdir=require(_0x297f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x297f('0x2'));var BPromise=require(_0x297f('0x3'));var Mustache=require(_0x297f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x297f('0x5'));var csv=require(_0x297f('0x6'));var ejs=require(_0x297f('0x7'));var fs=require('fs');var fs_extra=require(_0x297f('0x8'));var _=require(_0x297f('0x9'));var squel=require(_0x297f('0xa'));var crypto=require(_0x297f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x297f('0x6'));var querystring=require('querystring');var Papa=require(_0x297f('0xc'));var Redis=require(_0x297f('0xd'));var authService=require(_0x297f('0xe'));var qs=require(_0x297f('0xf'));var as=require(_0x297f('0x10'));var hardwareService=require(_0x297f('0x11'));var logger=require(_0x297f('0x12'))(_0x297f('0x13'));var utils=require(_0x297f('0x14'));var config=require(_0x297f('0x15'));var licenseUtil=require(_0x297f('0x16'));var db=require(_0x297f('0x17'))['db'];config[_0x297f('0x18')]=_[_0x297f('0x19')](config[_0x297f('0x18')],{'host':_0x297f('0x1a'),'port':0x18eb});var socket=require(_0x297f('0x1b'))(new Redis(config[_0x297f('0x18')]));require(_0x297f('0x1c'))[_0x297f('0x1d')](socket);var jayson=require(_0x297f('0x1e'));var client=jayson['client'][_0x297f('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x343bf9,_0x3dcc2b,_0x3283c9,_0x68b465){return new BPromise(function(_0x5bcdcf,_0x49b3bd){var _0xc718b8=_0x68b465||client;return _0xc718b8['request'](_0x343bf9,_0x3283c9)[_0x297f('0x20')](function(_0x43aa89){logger[_0x297f('0x21')]('SmsAccount,\x20%s,\x20%s',_0x3dcc2b,'request\x20sent');logger[_0x297f('0x22')](_0x297f('0x23'),_0x3dcc2b,_0x297f('0x24'),JSON['stringify'](_0x43aa89));if(_0x43aa89[_0x297f('0x25')]){if(_0x43aa89[_0x297f('0x25')][_0x297f('0x26')]===0x1f4){logger[_0x297f('0x25')](_0x297f('0x27'),_0x3dcc2b,_0x43aa89['error'][_0x297f('0x28')]);return _0x49b3bd(_0x43aa89[_0x297f('0x25')][_0x297f('0x28')]);}logger['error'](_0x297f('0x27'),_0x3dcc2b,_0x43aa89['error'][_0x297f('0x28')]);return _0x5bcdcf(_0x43aa89['error'][_0x297f('0x28')]);}else{logger['info'](_0x297f('0x27'),_0x3dcc2b,'request\x20sent');_0x5bcdcf(_0x43aa89[_0x297f('0x29')][_0x297f('0x28')]);}})[_0x297f('0x2a')](function(_0x1f95fe){logger['error'](_0x297f('0x27'),_0x3dcc2b,_0x1f95fe);_0x49b3bd(_0x1f95fe);});});}function respondWithStatusCode(_0x1922e1,_0x54c1c4){_0x54c1c4=_0x54c1c4||0xcc;return function(_0x1aeea6){if(_0x1aeea6){return _0x1922e1[_0x297f('0x2b')](_0x54c1c4);}return _0x1922e1[_0x297f('0x2c')](_0x54c1c4)[_0x297f('0x2d')]();};}function respondWithResult(_0x3c8026,_0x3f0326){_0x3f0326=_0x3f0326||0xc8;return function(_0x263c83){if(_0x263c83){return _0x3c8026[_0x297f('0x2c')](_0x3f0326)[_0x297f('0x2e')](_0x263c83);}};}function respondWithFilteredResult(_0x36e05e,_0x3ba925){return function(_0x40a59b){if(_0x40a59b){var _0x48a7e8=typeof _0x3ba925[_0x297f('0x2f')]===_0x297f('0x30')&&typeof _0x3ba925['limit']===_0x297f('0x30');var _0x31ffb1=_0x40a59b[_0x297f('0x31')];var _0xc2607b=_0x48a7e8?0x0:_0x3ba925[_0x297f('0x2f')];var _0x1d07c9=_0x48a7e8?_0x40a59b[_0x297f('0x31')]:_0x3ba925[_0x297f('0x2f')]+_0x3ba925[_0x297f('0x32')];var _0x471b21;if(_0x1d07c9>=_0x31ffb1){_0x1d07c9=_0x31ffb1;_0x471b21=0xc8;}else{_0x471b21=0xce;}_0x36e05e[_0x297f('0x2c')](_0x471b21);return _0x36e05e['set']('Content-Range',_0xc2607b+'-'+_0x1d07c9+'/'+_0x31ffb1)[_0x297f('0x2e')](_0x40a59b);}return null;};}function patchUpdates(_0xcc9826){return function(_0x3dd142){try{jsonpatch[_0x297f('0x33')](_0x3dd142,_0xcc9826,!![]);}catch(_0xd00dc6){return BPromise[_0x297f('0x34')](_0xd00dc6);}return _0x3dd142[_0x297f('0x35')]();};}function saveUpdates(_0x10ff17,_0x27154f){return function(_0x235777){if(_0x235777){return _0x235777[_0x297f('0x36')](_0x10ff17)['then'](function(_0x4ba0e2){return _0x4ba0e2;});}return null;};}function removeEntity(_0x386e86,_0x4adae3){return function(_0x451100){if(_0x451100){return _0x451100['destroy']()[_0x297f('0x20')](function(){var _0x3c385b=_0x451100[_0x297f('0x37')]({'plain':!![]});var _0x4219e1=_0x297f('0x38');return db[_0x297f('0x39')][_0x297f('0x3a')]({'where':{'type':_0x4219e1,'resourceId':_0x3c385b['id']}})[_0x297f('0x20')](function(){return _0x451100;});})[_0x297f('0x20')](function(){_0x386e86[_0x297f('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf37724,_0x3a3575){return function(_0x30a0fa){if(!_0x30a0fa){_0xf37724[_0x297f('0x2b')](0x194);}return _0x30a0fa;};}function handleError(_0x12486e,_0x13cb07){_0x13cb07=_0x13cb07||0x1f4;return function(_0x39298d){logger['error'](_0x39298d['stack']);if(_0x39298d[_0x297f('0x3b')]){delete _0x39298d[_0x297f('0x3b')];}_0x12486e[_0x297f('0x2c')](_0x13cb07)[_0x297f('0x3c')](_0x39298d);};}exports[_0x297f('0x3d')]=function(_0x3cf7f0,_0x5d1343){var _0x40601c={'include':[{'model':db['Pause'],'as':_0x297f('0x3e')}]},_0x12b128={},_0x4455be={'count':0x0,'rows':[]};var _0x37340c=_[_0x297f('0x3f')](db[_0x297f('0x40')][_0x297f('0x41')],function(_0x4d636e){return{'name':_0x4d636e['fieldName'],'type':_0x4d636e[_0x297f('0x42')][_0x297f('0x43')]};});_0x12b128[_0x297f('0x44')]=_[_0x297f('0x3f')](_0x37340c,_0x297f('0x3b'));_0x12b128[_0x297f('0x45')]=_['keys'](_0x3cf7f0[_0x297f('0x45')]);_0x12b128[_0x297f('0x46')]=_['intersection'](_0x12b128[_0x297f('0x44')],_0x12b128['query']);_0x40601c[_0x297f('0x47')]=_[_0x297f('0x48')](_0x12b128[_0x297f('0x44')],qs[_0x297f('0x49')](_0x3cf7f0[_0x297f('0x45')][_0x297f('0x49')]));_0x40601c[_0x297f('0x47')]=_0x40601c[_0x297f('0x47')][_0x297f('0x4a')]?_0x40601c[_0x297f('0x47')]:_0x12b128[_0x297f('0x44')];if(!_0x3cf7f0[_0x297f('0x45')][_0x297f('0x4b')](_0x297f('0x4c'))){_0x40601c[_0x297f('0x32')]=qs[_0x297f('0x32')](_0x3cf7f0['query'][_0x297f('0x32')]);_0x40601c['offset']=qs[_0x297f('0x2f')](_0x3cf7f0['query'][_0x297f('0x2f')]);}_0x40601c['order']=qs[_0x297f('0x4d')](_0x3cf7f0['query'][_0x297f('0x4d')]);_0x40601c[_0x297f('0x4e')]=qs[_0x297f('0x46')](_[_0x297f('0x4f')](_0x3cf7f0[_0x297f('0x45')],_0x12b128[_0x297f('0x46')]),_0x37340c);if(_0x3cf7f0[_0x297f('0x45')][_0x297f('0x50')]){_0x40601c[_0x297f('0x4e')]=_[_0x297f('0x51')](_0x40601c[_0x297f('0x4e')],{'$or':_['map'](_0x37340c,function(_0x1b3193){if(_0x1b3193[_0x297f('0x42')]!==_0x297f('0x52')){var _0x3b65ad={};_0x3b65ad[_0x1b3193[_0x297f('0x3b')]]={'$like':'%'+_0x3cf7f0[_0x297f('0x45')]['filter']+'%'};return _0x3b65ad;}})});}_0x40601c=_['merge']({},_0x40601c,_0x3cf7f0[_0x297f('0x53')]);var _0x394b82={'where':_0x40601c[_0x297f('0x4e')]};return db[_0x297f('0x40')][_0x297f('0x31')](_0x394b82)[_0x297f('0x20')](function(_0x2b91cc){_0x4455be[_0x297f('0x31')]=_0x2b91cc;if(_0x3cf7f0[_0x297f('0x45')][_0x297f('0x54')]){_0x40601c[_0x297f('0x55')]=[{'all':!![]}];}return db[_0x297f('0x40')][_0x297f('0x56')](_0x40601c);})['then'](function(_0xf07ba7){_0x4455be[_0x297f('0x57')]=_0xf07ba7;return _0x4455be;})[_0x297f('0x20')](respondWithFilteredResult(_0x5d1343,_0x40601c))[_0x297f('0x2a')](handleError(_0x5d1343,null));};exports[_0x297f('0x58')]=function(_0x568086,_0x3214cd){var _0x5aafab={'raw':![],'where':{'id':_0x568086[_0x297f('0x59')]['id']},'include':[{'model':db[_0x297f('0x5a')],'as':_0x297f('0x3e')}]},_0x8ce9f7={};_0x8ce9f7[_0x297f('0x44')]=_[_0x297f('0x5b')](db[_0x297f('0x40')]['rawAttributes']);_0x8ce9f7[_0x297f('0x45')]=_[_0x297f('0x5b')](_0x568086[_0x297f('0x45')]);_0x8ce9f7[_0x297f('0x46')]=_[_0x297f('0x48')](_0x8ce9f7[_0x297f('0x44')],_0x8ce9f7[_0x297f('0x45')]);_0x5aafab[_0x297f('0x47')]=_['intersection'](_0x8ce9f7[_0x297f('0x44')],qs[_0x297f('0x49')](_0x568086[_0x297f('0x45')]['fields']));_0x5aafab['attributes']=_0x5aafab['attributes'][_0x297f('0x4a')]?_0x5aafab[_0x297f('0x47')]:_0x8ce9f7[_0x297f('0x44')];if(_0x568086['query']['includeAll']){_0x5aafab['include']=[{'all':!![]}];}_0x5aafab=_[_0x297f('0x51')]({},_0x5aafab,_0x568086['options']);return db['SmsAccount']['find'](_0x5aafab)[_0x297f('0x20')](handleEntityNotFound(_0x3214cd,null))['then'](respondWithResult(_0x3214cd,null))[_0x297f('0x2a')](handleError(_0x3214cd,null));};exports['create']=function(_0x5e0ba8,_0x78004f){return db[_0x297f('0x40')][_0x297f('0x5c')](_0x5e0ba8['body'],{})['then'](function(_0x1ce6e0){var _0x363d15=_0x5e0ba8[_0x297f('0x5d')][_0x297f('0x37')]({'plain':!![]});if(!_0x363d15)throw new Error(_0x297f('0x5e'));if(_0x363d15['role']===_0x297f('0x5d')){var _0x2e245=_0x1ce6e0['get']({'plain':!![]});var _0x52a61a=_0x297f('0x38');return db[_0x297f('0x5f')][_0x297f('0x60')]({'where':{'name':_0x52a61a,'userProfileId':_0x363d15[_0x297f('0x61')]},'raw':!![]})[_0x297f('0x20')](function(_0x1e3d19){if(_0x1e3d19&&_0x1e3d19[_0x297f('0x62')]===0x0){return db[_0x297f('0x39')]['create']({'name':_0x2e245[_0x297f('0x3b')],'resourceId':_0x2e245['id'],'type':_0x1e3d19[_0x297f('0x3b')],'sectionId':_0x1e3d19['id']},{})[_0x297f('0x20')](function(){return _0x1ce6e0;});}else{return _0x1ce6e0;}})['catch'](function(_0x532cb9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x532cb9);throw _0x532cb9;});}return _0x1ce6e0;})[_0x297f('0x20')](respondWithResult(_0x78004f,0xc9))[_0x297f('0x2a')](handleError(_0x78004f,null));};exports[_0x297f('0x36')]=function(_0x230c5a,_0x155765){if(_0x230c5a['body']['id']){delete _0x230c5a['body']['id'];}return db[_0x297f('0x40')][_0x297f('0x60')]({'where':{'id':_0x230c5a[_0x297f('0x59')]['id']},'include':[{'model':db[_0x297f('0x5a')],'as':_0x297f('0x3e')}]})[_0x297f('0x20')](handleEntityNotFound(_0x155765,null))[_0x297f('0x20')](saveUpdates(_0x230c5a[_0x297f('0x63')],null))[_0x297f('0x20')](respondWithResult(_0x155765,null))[_0x297f('0x2a')](handleError(_0x155765,null));};exports[_0x297f('0x3a')]=function(_0xe7a31a,_0x3803b3){return db[_0x297f('0x40')]['find']({'where':{'id':_0xe7a31a[_0x297f('0x59')]['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x3803b3,null))[_0x297f('0x20')](removeEntity(_0x3803b3,null))['catch'](handleError(_0x3803b3,null));};exports[_0x297f('0x64')]=function(_0x4033d7,_0xbb9686){return db[_0x297f('0x40')][_0x297f('0x64')]()['then'](respondWithResult(_0xbb9686,null))[_0x297f('0x2a')](handleError(_0xbb9686,null));};exports[_0x297f('0x65')]=function(_0x417777,_0x4d55f9,_0x1183f0){if(_0x417777[_0x297f('0x63')]['id']){delete _0x417777[_0x297f('0x63')]['id'];}return db[_0x297f('0x40')][_0x297f('0x60')]({'where':{'id':_0x417777['params']['id']}})['then'](handleEntityNotFound(_0x4d55f9,null))[_0x297f('0x20')](function(_0x30cb47){if(_0x30cb47){_0x417777[_0x297f('0x63')][_0x297f('0x66')]=_0x30cb47['id'];return db['Disposition'][_0x297f('0x5c')](_0x417777[_0x297f('0x63')]);}})['then'](respondWithResult(_0x4d55f9,null))[_0x297f('0x2a')](handleError(_0x4d55f9,null));};exports[_0x297f('0x67')]=function(_0x758711,_0x1b64f0,_0x242c7c){var _0x36d22c={'raw':![],'where':{}};var _0x56b571={};var _0x1bae83={'count':0x0,'rows':[]};return db[_0x297f('0x40')][_0x297f('0x68')]({'where':{'id':_0x758711['params']['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x1b64f0,null))[_0x297f('0x20')](function(_0x12edd4){if(_0x12edd4){_0x56b571[_0x297f('0x44')]=_[_0x297f('0x5b')](db[_0x297f('0x69')][_0x297f('0x41')]);_0x56b571['query']=_['keys'](_0x758711['query']);_0x56b571[_0x297f('0x46')]=_['intersection'](_0x56b571[_0x297f('0x44')],_0x56b571['query']);_0x36d22c[_0x297f('0x47')]=_['intersection'](_0x56b571['model'],qs['fields'](_0x758711['query']['fields']));_0x36d22c['attributes']=_0x36d22c[_0x297f('0x47')][_0x297f('0x4a')]?_0x36d22c[_0x297f('0x47')]:_0x56b571[_0x297f('0x44')];if(!_0x758711[_0x297f('0x45')][_0x297f('0x4b')](_0x297f('0x4c'))){_0x36d22c[_0x297f('0x32')]=qs[_0x297f('0x32')](_0x758711[_0x297f('0x45')][_0x297f('0x32')]);_0x36d22c[_0x297f('0x2f')]=qs[_0x297f('0x2f')](_0x758711[_0x297f('0x45')][_0x297f('0x2f')]);}_0x36d22c[_0x297f('0x6a')]=qs[_0x297f('0x4d')](_0x758711['query'][_0x297f('0x4d')]);_0x36d22c[_0x297f('0x4e')]=qs[_0x297f('0x46')](_[_0x297f('0x4f')](_0x758711['query'],_0x56b571[_0x297f('0x46')]));_0x36d22c[_0x297f('0x4e')]['SmsAccountId']=_0x12edd4['id'];if(_0x758711['query'][_0x297f('0x50')]){_0x36d22c[_0x297f('0x4e')]=_[_0x297f('0x51')](_0x36d22c[_0x297f('0x4e')],{'$or':_[_0x297f('0x3f')](_0x36d22c[_0x297f('0x47')],function(_0x46c4df){var _0x42349f={};_0x42349f[_0x46c4df]={'$like':'%'+_0x758711[_0x297f('0x45')][_0x297f('0x50')]+'%'};return _0x42349f;})});}_0x36d22c=_['merge']({},_0x36d22c,_0x758711[_0x297f('0x53')]);return db[_0x297f('0x69')][_0x297f('0x31')]({'where':_0x36d22c[_0x297f('0x4e')]})[_0x297f('0x20')](function(_0x1445d0){_0x1bae83[_0x297f('0x31')]=_0x1445d0;if(_0x758711[_0x297f('0x45')][_0x297f('0x54')]){_0x36d22c[_0x297f('0x55')]=[{'all':!![]}];}return db[_0x297f('0x69')][_0x297f('0x56')](_0x36d22c);})[_0x297f('0x20')](function(_0x307984){_0x1bae83[_0x297f('0x57')]=_0x307984;return _0x1bae83;});}})[_0x297f('0x20')](respondWithFilteredResult(_0x1b64f0,_0x36d22c))[_0x297f('0x2a')](handleError(_0x1b64f0,null));};exports['removeDispositions']=function(_0x2d99a7,_0x2c5d05,_0x298b76){return db['SmsAccount'][_0x297f('0x60')]({'where':{'id':_0x2d99a7[_0x297f('0x59')]['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x2c5d05,null))[_0x297f('0x20')](function(_0x9af0c9){if(_0x9af0c9){return _0x9af0c9['removeDispositions'](_0x2d99a7[_0x297f('0x45')][_0x297f('0x6b')]);}})[_0x297f('0x20')](respondWithStatusCode(_0x2c5d05,null))[_0x297f('0x2a')](handleError(_0x2c5d05,null));};exports['addAnswer']=function(_0x56adae,_0x14b7d1,_0x49f90c){if(_0x56adae[_0x297f('0x63')]['id']){delete _0x56adae['body']['id'];}return db[_0x297f('0x40')]['find']({'where':{'id':_0x56adae[_0x297f('0x59')]['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x14b7d1,null))[_0x297f('0x20')](function(_0x6b5431){if(_0x6b5431){_0x56adae[_0x297f('0x63')]['SmsAccountId']=_0x6b5431['id'];return db[_0x297f('0x6c')][_0x297f('0x5c')](_0x56adae[_0x297f('0x63')]);}})[_0x297f('0x20')](respondWithResult(_0x14b7d1,null))[_0x297f('0x2a')](handleError(_0x14b7d1,null));};exports[_0x297f('0x6d')]=function(_0x562423,_0x287c88,_0x24a81e){var _0x183426={'raw':![],'where':{}};var _0x8328e6={};var _0x214140={'count':0x0,'rows':[]};return db['SmsAccount'][_0x297f('0x68')]({'where':{'id':_0x562423['params']['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x287c88,null))[_0x297f('0x20')](function(_0x26b471){if(_0x26b471){_0x8328e6['model']=_[_0x297f('0x5b')](db[_0x297f('0x6c')][_0x297f('0x41')]);_0x8328e6['query']=_['keys'](_0x562423[_0x297f('0x45')]);_0x8328e6[_0x297f('0x46')]=_[_0x297f('0x48')](_0x8328e6[_0x297f('0x44')],_0x8328e6[_0x297f('0x45')]);_0x183426['attributes']=_['intersection'](_0x8328e6['model'],qs['fields'](_0x562423['query'][_0x297f('0x49')]));_0x183426[_0x297f('0x47')]=_0x183426[_0x297f('0x47')]['length']?_0x183426[_0x297f('0x47')]:_0x8328e6[_0x297f('0x44')];if(!_0x562423['query'][_0x297f('0x4b')]('nolimit')){_0x183426[_0x297f('0x32')]=qs[_0x297f('0x32')](_0x562423[_0x297f('0x45')][_0x297f('0x32')]);_0x183426['offset']=qs[_0x297f('0x2f')](_0x562423[_0x297f('0x45')][_0x297f('0x2f')]);}_0x183426[_0x297f('0x6a')]=qs['sort'](_0x562423['query'][_0x297f('0x4d')]);_0x183426[_0x297f('0x4e')]=qs[_0x297f('0x46')](_['pick'](_0x562423[_0x297f('0x45')],_0x8328e6[_0x297f('0x46')]));_0x183426['where']['SmsAccountId']=_0x26b471['id'];if(_0x562423['query'][_0x297f('0x50')]){_0x183426[_0x297f('0x4e')]=_[_0x297f('0x51')](_0x183426[_0x297f('0x4e')],{'$or':_['map'](_0x183426[_0x297f('0x47')],function(_0x2c890a){var _0x2238f8={};_0x2238f8[_0x2c890a]={'$like':'%'+_0x562423[_0x297f('0x45')][_0x297f('0x50')]+'%'};return _0x2238f8;})});}_0x183426=_['merge']({},_0x183426,_0x562423['options']);return db[_0x297f('0x6c')][_0x297f('0x31')]({'where':_0x183426[_0x297f('0x4e')]})[_0x297f('0x20')](function(_0x4e35e7){_0x214140[_0x297f('0x31')]=_0x4e35e7;if(_0x562423[_0x297f('0x45')][_0x297f('0x54')]){_0x183426[_0x297f('0x55')]=[{'all':!![]}];}return db[_0x297f('0x6c')][_0x297f('0x56')](_0x183426);})[_0x297f('0x20')](function(_0x2bfc87){_0x214140[_0x297f('0x57')]=_0x2bfc87;return _0x214140;});}})[_0x297f('0x20')](respondWithFilteredResult(_0x287c88,_0x183426))['catch'](handleError(_0x287c88,null));};exports['removeAnswers']=function(_0x555dcb,_0x765b06,_0x446656){return db['SmsAccount'][_0x297f('0x60')]({'where':{'id':_0x555dcb[_0x297f('0x59')]['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x765b06,null))[_0x297f('0x20')](function(_0x5ba40a){if(_0x5ba40a){return _0x5ba40a[_0x297f('0x6e')](_0x555dcb[_0x297f('0x45')][_0x297f('0x6b')]);}})['then'](respondWithStatusCode(_0x765b06,null))[_0x297f('0x2a')](handleError(_0x765b06,null));};exports[_0x297f('0x6f')]=function(_0x4c5087,_0x448e01,_0x5291e6){var _0x3dca90={'channel':'sms'};var _0x455c57=[];var _0x249921=[];var _0x183d56={};return db[_0x297f('0x40')][_0x297f('0x60')]({'where':{'id':_0x4c5087[_0x297f('0x59')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x297f('0x70')}]})[_0x297f('0x20')](handleEntityNotFound(_0x448e01,null))['then'](function(_0x743d2a){_0x3dca90['account']=_0x743d2a;_0x3dca90[_0x297f('0x71')]=_['orderBy'](_0x743d2a[_0x297f('0x70')],[_0x297f('0x72')],[_0x297f('0x73')]);if(_0x3dca90[_0x297f('0x74')][_0x297f('0x70')]){delete _0x3dca90[_0x297f('0x74')]['Applications'];}return db[_0x297f('0x75')][_0x297f('0x64')]();})[_0x297f('0x20')](function(_0x4fbd06){if(!_0x4fbd06){throw new db[(_0x297f('0x76'))][(_0x297f('0x77'))]('no\x20available\x20attributes');}_0x455c57=_[_0x297f('0x78')](_[_0x297f('0x5b')](_0x4fbd06),['createdAt',_0x297f('0x79')]);_0x249921=_['difference'](_[_0x297f('0x5b')](_0x4fbd06),[_0x297f('0x7a'),_0x297f('0x79'),_0x297f('0x7b'),'ListId']);_0x3dca90[_0x297f('0x63')]={'mapKey':_0x297f('0x7c')};if(_0x3dca90[_0x297f('0x74')]['type']){switch(_0x3dca90[_0x297f('0x74')][_0x297f('0x42')]){case _0x297f('0x7d'):_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x7f')];_0x3dca90[_0x297f('0x63')][_0x297f('0x63')]=_0x4c5087['body'][_0x297f('0x80')];_0x3dca90[_0x297f('0x63')][_0x297f('0x81')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x82')];break;case _0x297f('0x83'):_0x3dca90[_0x297f('0x63')]['from']='+'+_0x4c5087[_0x297f('0x63')][_0x297f('0x84')];_0x3dca90['body']['body']=_0x4c5087[_0x297f('0x63')]['text'];break;case _0x297f('0x85'):_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]=_0x4c5087['body'][_0x297f('0x7e')];_0x3dca90[_0x297f('0x63')]['body']=_0x4c5087[_0x297f('0x63')][_0x297f('0x28')];break;case _0x297f('0x86'):_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]=_0x4c5087['body'][_0x297f('0x7e')];_0x3dca90[_0x297f('0x63')][_0x297f('0x63')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x63')];_0x3dca90[_0x297f('0x63')][_0x297f('0x81')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x87')];break;case'plivo':_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x7f')];_0x3dca90[_0x297f('0x63')][_0x297f('0x63')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x88')];_0x3dca90[_0x297f('0x63')][_0x297f('0x81')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x89')];break;case _0x297f('0x8a'):_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]='+'+_0x4c5087[_0x297f('0x63')][_0x297f('0x8b')][0x0][_0x297f('0x7e')];_0x3dca90[_0x297f('0x63')][_0x297f('0x63')]=_0x4c5087['body']['results'][0x0][_0x297f('0x8c')];_0x3dca90['body']['messageId']=_0x4c5087[_0x297f('0x63')][_0x297f('0x8b')][0x0][_0x297f('0x81')];break;case _0x297f('0x8d'):_0x3dca90['body'][_0x297f('0x7e')]=_0x4c5087[_0x297f('0x63')]['originatingAddress'];_0x3dca90['body'][_0x297f('0x63')]=_0x4c5087['body'][_0x297f('0x8e')][_0x297f('0x28')];break;case _0x297f('0x8f'):_0x3dca90['body'][_0x297f('0x7e')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x90')];_0x3dca90['body']['body']=_0x4c5087[_0x297f('0x63')][_0x297f('0x8c')];_0x3dca90['body'][_0x297f('0x81')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x91')];break;case _0x297f('0x92'):_0x3dca90[_0x297f('0x63')][_0x297f('0x81')]=_0x4c5087[_0x297f('0x63')][0x0]['message']['id'];_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]=_0x4c5087[_0x297f('0x63')][0x0][_0x297f('0x28')][_0x297f('0x7e')];_0x3dca90['body'][_0x297f('0x63')]=_0x4c5087[_0x297f('0x63')][0x0][_0x297f('0x28')][_0x297f('0x8c')];break;case'intelepeer':_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x7e')];_0x3dca90[_0x297f('0x63')][_0x297f('0x63')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x28')];_0x3dca90[_0x297f('0x63')][_0x297f('0x81')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x93')];break;}}if(_0x3dca90[_0x297f('0x63')]['id']){delete _0x3dca90[_0x297f('0x63')]['id'];}if(_['isNil'](_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')])){throw new db[(_0x297f('0x76'))][(_0x297f('0x77'))](_0x297f('0x94'));}if(_[_0x297f('0x95')](_0x3dca90[_0x297f('0x63')][_0x297f('0x63')])||_0x3dca90['body'][_0x297f('0x63')]===''){throw new db[(_0x297f('0x76'))]['ValidationError'](_0x297f('0x96'));}if(_[_0x297f('0x95')](_0x3dca90[_0x297f('0x63')]['mapKey'])){throw new db['Sequelize'][(_0x297f('0x77'))](_0x297f('0x97')+_0x249921);}if(!_['includes'](_0x249921,_0x3dca90[_0x297f('0x63')][_0x297f('0x98')])){throw new db['Sequelize'][(_0x297f('0x77'))](_0x297f('0x99')+_0x249921);}_0x183d56[_0x3dca90['body'][_0x297f('0x98')]]=_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')];return db['CmList'][_0x297f('0x60')]({'where':{'id':_0x3dca90[_0x297f('0x74')][_0x297f('0x9a')]},'include':[{'model':db[_0x297f('0x75')],'as':'Contacts','where':_0x183d56,'limit':0x1,'order':[[_0x297f('0x79'),_0x297f('0x9b')]]}]});})[_0x297f('0x20')](handleEntityNotFound(_0x448e01,null))[_0x297f('0x20')](function(_0x37f48f){if(_0x37f48f){_0x3dca90[_0x297f('0x9c')]=_[_0x297f('0x9d')](_0x37f48f,['Contacts']);if(_0x37f48f[_0x297f('0x9e')][_0x297f('0x4a')]){return _0x37f48f[_0x297f('0x9e')][0x0];}var _0x36005a=_['defaults'](_0x3dca90[_0x297f('0x63')],{'firstName':_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')],'ListId':_0x37f48f['id']});_0x36005a[_0x3dca90[_0x297f('0x63')][_0x297f('0x98')]]=_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')];return db[_0x297f('0x75')][_0x297f('0x5c')](_0x36005a,{'fields':_0x455c57,'raw':!![]});}})[_0x297f('0x20')](handleEntityNotFound(_0x448e01,null))['then'](function(_0x50936b){if(_0x50936b){_0x3dca90['contact']=_0x50936b;var _0x2993a8={'ContactId':_0x50936b['id'],'phone':_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')],'SmsAccountId':_0x4c5087[_0x297f('0x59')]['id']};var _0xedb2e9={'ContactId':_0x50936b['id'],'SmsAccountId':_0x4c5087[_0x297f('0x59')]['id'],'closed':![]};return db[_0x297f('0x9f')][_0x297f('0x60')]({'where':_0xedb2e9})[_0x297f('0x20')](function(_0x5295e8){if(_0x5295e8){return[_0x5295e8,![]];}return db[_0x297f('0x9f')]['create'](_0x2993a8)[_0x297f('0x20')](function(_0x33f842){return[_0x33f842,!![]];});});}})['spread'](function(_0xc2f8d6,_0x47ac3d){_0x3dca90[_0x297f('0xa0')]=_0xc2f8d6[_0x297f('0x37')]({'plain':!![]});_0x3dca90[_0x297f('0xa0')][_0x297f('0xa1')]=![];if(_0x47ac3d){if(_0x3dca90[_0x297f('0x74')]['autoclose']){_0x3dca90[_0x297f('0x71')][_0x297f('0xa2')]({'id':0x0,'priority':_0x3dca90['applications'][_0x297f('0x4a')]+0x1,'app':_0x297f('0xa3'),'appdata':_0x297f('0xa4'),'interval':'*,*,*,*'});}_0x3dca90[_0x297f('0xa0')]['created']=!![];}return db[_0x297f('0xa5')]['create']({'phone':_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')],'messageId':_0x3dca90[_0x297f('0x63')][_0x297f('0x81')],'body':_0x3dca90[_0x297f('0x63')]['body'],'SmsAccountId':_0x4c5087[_0x297f('0x59')]['id'],'SmsInteractionId':_0xc2f8d6['id'],'direction':'in','ContactId':_0xc2f8d6[_0x297f('0xa6')],'AttachmentId':_0x3dca90[_0x297f('0x63')][_0x297f('0xa7')]});})[_0x297f('0x20')](function(_0x1b679e){_0x3dca90[_0x297f('0x28')]=_0x1b679e;if(_0x3dca90['interaction'][_0x297f('0xa8')]){return db[_0x297f('0xa9')][_0x297f('0x60')]({'attributes':['id','name'],'where':{'id':_0x3dca90['interaction'][_0x297f('0xa8')]}})[_0x297f('0x20')](function(_0x2ace5f){if(_0x2ace5f){_0x3dca90[_0x297f('0x71')][_0x297f('0xaa')]({'id':0x0,'priority':0x0,'app':_0x297f('0xab'),'appdata':_0x2ace5f[_0x297f('0x3b')]+','+(_0x3dca90[_0x297f('0x74')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x297f('0xac'),_0x297f('0xad'),_0x3dca90);});}return respondWithRpcPromise(_0x297f('0xac'),'startRouting',_0x3dca90);})['then'](function(_0xe62b73){if(_0xe62b73){var _0x598b84=0xc8;var _0x5a366b=_0x297f('0xae');logger[_0x297f('0x21')](_0x297f('0x23'),_0x5a366b,_0x598b84,_0x297f('0xaf'));logger[_0x297f('0x22')](_0x297f('0xb0'),_0x5a366b,_0x598b84,'entity\x20found',JSON[_0x297f('0xb1')](_0xe62b73));if(_0x3dca90[_0x297f('0x74')][_0x297f('0x42')]===_0x297f('0x7d')){return _0x448e01[_0x297f('0x2c')](_0x598b84)[_0x297f('0xb2')](_0x297f('0xb3'),_0x297f('0xb4'))[_0x297f('0x3c')](_0x297f('0xb5'));}else{return _0x448e01[_0x297f('0x2c')](_0x598b84)[_0x297f('0x2e')](_0xe62b73);}}})[_0x297f('0x2a')](handleError(_0x448e01,null));};exports[_0x297f('0xb6')]=function(_0x2c4d94,_0x5084a1){var _0x193394=_0x2c4d94['params']['id'];var _0x250a14=_0x2c4d94[_0x297f('0x63')];var _0x47cfee=0xc8;var _0x2f6a7c=null;return db[_0x297f('0xb7')][_0x297f('0xb8')]({'isolationLevel':db[_0x297f('0xb7')][_0x297f('0xb9')][_0x297f('0xba')]['READ_COMMITTED']},function(_0x47c43a){return db['SmsAccount'][_0x297f('0x68')]({'where':{'id':_0x193394},'transaction':_0x47c43a})['then'](function(_0x3d1d21){if(_0x3d1d21){return db[_0x297f('0xbb')][_0x297f('0x3a')]({'where':{'SmsAccountId':_0x193394},'transaction':_0x47c43a})['then'](function(){var _0x38a326=_[_0x297f('0x3f')](_0x250a14,function(_0x3b5fc6){_0x3b5fc6[_0x297f('0x66')]=_0x193394;return _0x3b5fc6;});return db[_0x297f('0xbb')]['bulkCreate'](_0x38a326,{'transaction':_0x47c43a});});}else{_0x47cfee=0x194;_0x2f6a7c=[];}});})['then'](function(){if(_0x47cfee!==0x194){return db[_0x297f('0xbb')][_0x297f('0xbc')]({'where':{'SmsAccountId':_0x193394},'order':_0x297f('0x72')})[_0x297f('0x20')](function(_0x1ec314){_0x2f6a7c=_0x1ec314;});}})[_0x297f('0x2a')](function(_0x1a35ba){_0x47cfee=0x1f4;logger[_0x297f('0x25')](_0x1a35ba[_0x297f('0xbd')]);if(_0x1a35ba[_0x297f('0x3b')]){delete _0x1a35ba[_0x297f('0x3b')];}_0x2f6a7c=_0x1a35ba;})[_0x297f('0xbe')](function(){if(_0x2f6a7c===null){_0x5084a1['sendStatus'](_0x47cfee);}else{if(_0x47cfee===0x1f4){_0x5084a1[_0x297f('0x2c')](_0x47cfee)['send'](_0x2f6a7c);}else{_0x5084a1[_0x297f('0x2c')](_0x47cfee)['json'](_0x2f6a7c);}}});};exports[_0x297f('0xbf')]=function(_0x226092,_0x3b4d7d,_0xa71389){var _0x4057cb={};var _0x2158af={};var _0x166e20;var _0x238100;return db[_0x297f('0x40')][_0x297f('0x68')]({'where':{'id':_0x226092['params']['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x3b4d7d,null))[_0x297f('0x20')](function(_0x2789ae){if(_0x2789ae){_0x166e20=_0x2789ae;_0x2158af[_0x297f('0x44')]=_[_0x297f('0x5b')](db['SmsApplication'][_0x297f('0x41')]);_0x2158af[_0x297f('0x45')]=_[_0x297f('0x5b')](_0x226092['query']);_0x2158af[_0x297f('0x46')]=_[_0x297f('0x48')](_0x2158af[_0x297f('0x44')],_0x2158af[_0x297f('0x45')]);_0x4057cb[_0x297f('0x47')]=_[_0x297f('0x48')](_0x2158af[_0x297f('0x44')],qs[_0x297f('0x49')](_0x226092[_0x297f('0x45')][_0x297f('0x49')]));_0x4057cb[_0x297f('0x47')]=_0x4057cb['attributes'][_0x297f('0x4a')]?_0x4057cb[_0x297f('0x47')]:_0x2158af[_0x297f('0x44')];_0x4057cb[_0x297f('0x6a')]=qs[_0x297f('0x4d')](_0x226092['query'][_0x297f('0x4d')]);_0x4057cb[_0x297f('0x4e')]=qs[_0x297f('0x46')](_[_0x297f('0x4f')](_0x226092[_0x297f('0x45')],_0x2158af[_0x297f('0x46')]));if(_0x226092[_0x297f('0x45')][_0x297f('0x50')]){_0x4057cb[_0x297f('0x4e')]=_[_0x297f('0x51')](_0x4057cb[_0x297f('0x4e')],{'$or':_[_0x297f('0x3f')](_0x4057cb[_0x297f('0x47')],function(_0x5bbf6d){var _0x3d9c1b={};_0x3d9c1b[_0x5bbf6d]={'$like':'%'+_0x226092['query'][_0x297f('0x50')]+'%'};return _0x3d9c1b;})});}_0x4057cb=_[_0x297f('0x51')]({},_0x4057cb,_0x226092[_0x297f('0x53')]);return _0x166e20[_0x297f('0xbf')](_0x4057cb);}})[_0x297f('0x20')](function(_0x48f73e){if(_0x48f73e){_0x238100=_0x48f73e['length'];if(!_0x226092['query'][_0x297f('0x4b')](_0x297f('0x4c'))){_0x4057cb[_0x297f('0x32')]=qs[_0x297f('0x32')](_0x226092[_0x297f('0x45')][_0x297f('0x32')]);_0x4057cb['offset']=qs[_0x297f('0x2f')](_0x226092['query'][_0x297f('0x2f')]);}return _0x166e20['getApplications'](_0x4057cb);}})[_0x297f('0x20')](function(_0x5328d4){if(_0x5328d4){return _0x5328d4?{'count':_0x238100,'rows':_0x5328d4}:null;}})[_0x297f('0x20')](respondWithResult(_0x3b4d7d,null))[_0x297f('0x2a')](handleError(_0x3b4d7d,null));};exports['getInteractions']=function(_0x5971d4,_0x429589,_0x3e7bee){var _0x5dabf2={'raw':![],'where':{}};var _0x5c11df={};var _0x17ed09={'count':0x0,'rows':[]};return db[_0x297f('0x40')]['findOne']({'where':{'id':_0x5971d4[_0x297f('0x59')]['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x429589,null))['then'](function(_0x291655){if(_0x291655){_0x5c11df[_0x297f('0x44')]=_['keys'](db[_0x297f('0x9f')]['rawAttributes']);_0x5c11df['query']=_[_0x297f('0x5b')](_0x5971d4[_0x297f('0x45')]);_0x5c11df[_0x297f('0x46')]=_['intersection'](_0x5c11df[_0x297f('0x44')],_0x5c11df['query']);_0x5dabf2[_0x297f('0x47')]=_['intersection'](_0x5c11df['model'],qs[_0x297f('0x49')](_0x5971d4['query'][_0x297f('0x49')]));_0x5dabf2[_0x297f('0x47')]=_0x5dabf2[_0x297f('0x47')][_0x297f('0x4a')]?_0x5dabf2[_0x297f('0x47')]:_0x5c11df['model'];if(!_0x5971d4[_0x297f('0x45')][_0x297f('0x4b')](_0x297f('0x4c'))){_0x5dabf2[_0x297f('0x32')]=qs['limit'](_0x5971d4[_0x297f('0x45')]['limit']);_0x5dabf2[_0x297f('0x2f')]=qs['offset'](_0x5971d4[_0x297f('0x45')]['offset']);}_0x5dabf2['order']=qs[_0x297f('0x4d')](_0x5971d4[_0x297f('0x45')][_0x297f('0x4d')]);_0x5dabf2[_0x297f('0x4e')]=qs[_0x297f('0x46')](_[_0x297f('0x4f')](_0x5971d4[_0x297f('0x45')],_0x5c11df[_0x297f('0x46')]));_0x5dabf2[_0x297f('0x4e')][_0x297f('0x66')]=_0x291655['id'];if(_0x5971d4[_0x297f('0x45')][_0x297f('0x50')]){_0x5dabf2['where']=_[_0x297f('0x51')](_0x5dabf2[_0x297f('0x4e')],{'$or':_[_0x297f('0x3f')](_0x5dabf2[_0x297f('0x47')],function(_0x5003a1){var _0x3c490f={};_0x3c490f[_0x5003a1]={'$like':'%'+_0x5971d4[_0x297f('0x45')][_0x297f('0x50')]+'%'};return _0x3c490f;})});}_0x5dabf2=_[_0x297f('0x51')]({},_0x5dabf2,_0x5971d4[_0x297f('0x53')]);return db[_0x297f('0x9f')][_0x297f('0x31')]({'where':_0x5dabf2[_0x297f('0x4e')]})['then'](function(_0x13cfbf){_0x17ed09[_0x297f('0x31')]=_0x13cfbf;if(_0x5971d4[_0x297f('0x45')][_0x297f('0x54')]){_0x5dabf2[_0x297f('0x55')]=[{'model':db['CmContact'],'as':_0x297f('0xc0'),'required':![]},{'model':db['User'],'as':_0x297f('0xc1'),'attributes':['name',_0x297f('0xc2'),_0x297f('0xc3')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x297f('0x3b'),_0x297f('0xc4')],'where':_0x5971d4['query'][_0x297f('0xc5')]?{'id':_0x5971d4[_0x297f('0x45')][_0x297f('0xc5')]}:undefined,'required':_0x5971d4[_0x297f('0x45')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x297f('0x56')](_0x5dabf2);})['then'](function(_0x6f4e50){_0x17ed09[_0x297f('0x57')]=_0x6f4e50;return _0x17ed09;});}})[_0x297f('0x20')](respondWithFilteredResult(_0x429589,_0x5dabf2))[_0x297f('0x2a')](handleError(_0x429589,null));};exports['send']=function(_0x4bd141,_0x3084a7,_0x17a17c){var _0x3764be,_0x2d5ba4,_0xf7e9ab;if(_[_0x297f('0x95')](_0x4bd141[_0x297f('0x63')][_0x297f('0x63')])||_0x4bd141[_0x297f('0x63')][_0x297f('0x63')]===''){throw new db[(_0x297f('0x76'))][(_0x297f('0x77'))](_0x297f('0x96'));}if(_['isNil'](_0x4bd141[_0x297f('0x63')]['to'])){throw new db['Sequelize'][(_0x297f('0x77'))](_0x297f('0xc6'));}_0x3764be=_0x4bd141['body']['to'];return db[_0x297f('0x40')][_0x297f('0x60')]({'where':{'id':_0x4bd141[_0x297f('0x59')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x297f('0x75')],'as':_0x297f('0x9e'),'where':{'mobile':_0x3764be},'limit':0x1,'order':[[_0x297f('0x79'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3084a7,null))[_0x297f('0x20')](function(_0x308434){if(_0x308434&&_0x308434['List']){_0x2d5ba4=_0x308434[_0x297f('0x37')]({'plain':!![]});if(_0x2d5ba4[_0x297f('0xc7')]&&_0x2d5ba4['List'][_0x297f('0x9e')][_0x297f('0x4a')]){return _0x2d5ba4['List'][_0x297f('0x9e')][0x0];}return db['CmContact'][_0x297f('0x5c')](_[_0x297f('0x19')](_0x4bd141[_0x297f('0x63')],{'firstName':_0x3764be,'mobile':_0x3764be,'phone':_0x3764be,'ListId':_0x2d5ba4[_0x297f('0x9a')]}));}})[_0x297f('0x20')](handleEntityNotFound(_0x3084a7,null))['then'](function(_0x46adc3){if(_0x46adc3){_0xf7e9ab=_0x46adc3;return db[_0x297f('0x9f')][_0x297f('0x60')]({'where':{'ContactId':_0xf7e9ab['id'],'closed':![],'SmsAccountId':_0x2d5ba4['id']}})[_0x297f('0x20')](function(_0x4ca2a4){if(_0x4ca2a4){return[_0x4ca2a4,![]];}return db[_0x297f('0x9f')][_0x297f('0x5c')]({'UserId':_0x4bd141[_0x297f('0x5d')]['id'],'ContactId':_0xf7e9ab['id'],'SmsAccountId':_0x2d5ba4['id'],'phone':_0x3764be,'firstMsgDirection':_0x297f('0xc8'),'Messages':[_['merge'](_0x4bd141[_0x297f('0x63')],{'read':![],'body':_0x4bd141[_0x297f('0x63')][_0x297f('0x63')],'phone':_0x3764be,'SmsAccountId':_0x2d5ba4['id'],'UserId':_0x4bd141[_0x297f('0x5d')]['id'],'ContactId':_0xf7e9ab['id']})]},{'include':[{'model':db[_0x297f('0xa5')],'as':_0x297f('0xc9')}]})[_0x297f('0x20')](function(_0x38a5ca){return[_0x38a5ca,!![]];});});}})[_0x297f('0xca')](function(_0x575950,_0x2ed0e8){if(_0x2ed0e8){return _0x575950;}return db['SmsMessage']['create'](_['merge'](_0x4bd141[_0x297f('0x63')],{'read':![],'body':_0x4bd141[_0x297f('0x63')][_0x297f('0x63')],'phone':_0x3764be,'SmsAccountId':_0x2d5ba4['id'],'SmsInteractionId':_0x575950['id'],'UserId':_0x4bd141[_0x297f('0x5d')]['id'],'ContactId':_0xf7e9ab['id']}))[_0x297f('0x20')](function(_0x57e66e){_0x575950[_0x297f('0xcb')]['Messages']=[];_0x575950[_0x297f('0xcb')][_0x297f('0xc9')][_0x297f('0xa2')](_0x57e66e[_0x297f('0xcb')]);return _0x575950;});})[_0x297f('0x20')](respondWithResult(_0x3084a7,null))['catch'](handleError(_0x3084a7,null));};exports[_0x297f('0x2c')]=function(_0x2ad9f7,_0x1a25aa,_0x5bcee8){if(_0x2ad9f7['body']['id']){delete _0x2ad9f7[_0x297f('0x63')]['id'];}var _0x10cceb,_0x398ee8,_0x185279;return db[_0x297f('0x40')][_0x297f('0x60')]({'where':{'id':_0x2ad9f7['params']['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x1a25aa,null))[_0x297f('0x20')](function(_0x569068){if(_0x569068){_0x185279=_0x569068;logger[_0x297f('0x22')](_0x297f('0x23'),'status',_0x297f('0xcc'),_0x569068['type'],util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));switch(_0x569068[_0x297f('0x42')]){case _0x297f('0x83'):if(_0x2ad9f7[_0x297f('0x63')]['skebby_dispatch_id']&&_0x2ad9f7[_0x297f('0x63')]['status']){_0x398ee8=_0x2ad9f7[_0x297f('0x63')][_0x297f('0x2c')];return db[_0x297f('0xa5')][_0x297f('0x60')]({'where':{'messageId':_0x2ad9f7[_0x297f('0x63')][_0x297f('0xce')]}});}break;case'connectel':if(_0x2ad9f7[_0x297f('0x63')]['requestid']&&_0x2ad9f7[_0x297f('0x63')][_0x297f('0xcf')]){_0x398ee8=_0x2ad9f7[_0x297f('0x63')][_0x297f('0xcf')];return db[_0x297f('0xa5')]['find']({'where':{'messageId':_0x2ad9f7[_0x297f('0x63')]['requestid']}});}break;case _0x297f('0x86'):if(_0x2ad9f7[_0x297f('0x63')]['message_id']&&_0x2ad9f7['body'][_0x297f('0xd0')]){_0x398ee8=_0x2ad9f7['body']['status_code'];return db[_0x297f('0xa5')][_0x297f('0x60')]({'where':{'messageId':_0x2ad9f7[_0x297f('0x63')][_0x297f('0x87')]}});}break;case _0x297f('0x8a'):var _0x2b5686=_0x2ad9f7['body']['results'][0x0];if(_0x2b5686[_0x297f('0x81')]&&_0x2b5686['status'][_0x297f('0xd1')]===_0x297f('0xd2')){_0x398ee8=_0x2b5686[_0x297f('0x2c')]['groupName'];return db['SmsMessage'][_0x297f('0x60')]({'where':{'messageId':_0x2b5686[_0x297f('0x81')]}});}break;case _0x297f('0x8f'):if(_0x2ad9f7[_0x297f('0x63')]['messageId']&&_0x2ad9f7[_0x297f('0x63')][_0x297f('0x2c')]){_0x398ee8=_0x2ad9f7[_0x297f('0x63')][_0x297f('0x2c')];return db[_0x297f('0xa5')]['find']({'where':{'messageId':_0x2ad9f7[_0x297f('0x63')][_0x297f('0x81')]}});}break;case'bandwidth':if(_0x2ad9f7[_0x297f('0x63')][0x0][_0x297f('0x28')]['id']){_0x398ee8=_0x2ad9f7[_0x297f('0x63')][0x0][_0x297f('0x42')];return db['SmsMessage'][_0x297f('0x60')]({'where':{'messageId':_0x2ad9f7[_0x297f('0x63')][0x0][_0x297f('0x28')]['id']}});}break;case _0x297f('0xd3'):if(_0x2ad9f7[_0x297f('0x63')][_0x297f('0xd4')]&&_0x2ad9f7[_0x297f('0x63')]['status']){_0x398ee8=_0x2ad9f7[_0x297f('0x63')]['status'];return db['SmsMessage']['find']({'where':{'messageId':_0x2ad9f7[_0x297f('0x63')][_0x297f('0xd4')]}});}break;}}})[_0x297f('0x20')](handleEntityNotFound(_0x1a25aa,null))['then'](function(_0x5bac1f){if(_0x5bac1f){_0x10cceb=_0x5bac1f;switch(_0x185279['type']){case _0x297f('0x83'):if(_0x398ee8===_0x297f('0xd2')){return _0x10cceb[_0x297f('0x36')]({'read':!![]});}else{logger[_0x297f('0x25')](_0x297f('0x23'),_0x297f('0x2c'),'skebby',util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x398ee8==='1'){return _0x10cceb[_0x297f('0x36')]({'read':!![]});}else{logger['error'](_0x297f('0x23'),'status',_0x297f('0x83'),util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;case _0x297f('0x86'):if(!_0x2ad9f7[_0x297f('0x63')][_0x297f('0xd5')]&&_0x398ee8>=0xc8&&_0x398ee8<=0xce){return _0x10cceb[_0x297f('0x36')]({'read':!![]});}else{logger[_0x297f('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','clicksend',util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;case _0x297f('0x8a'):var _0x3d95e9=_0x2ad9f7['body']['results'][0x0];if(_0x3d95e9[_0x297f('0x2c')][_0x297f('0xd1')]===_0x297f('0xd2')){return _0x10cceb['update']({'read':!![]});}else{logger[_0x297f('0x25')](_0x297f('0x23'),_0x297f('0x2c'),_0x297f('0x8a'),util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;case _0x297f('0x8f'):if(_0x398ee8==_0x297f('0xd6')||_0x398ee8=='RECEIVED_BY_RECIPIENT'){return _0x10cceb[_0x297f('0x36')]({'read':!![]});}else{logger[_0x297f('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x297f('0x2c'),'clickatell',util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x398ee8==_0x297f('0xd7')){return _0x10cceb[_0x297f('0x36')]({'read':!![]});}else{logger[_0x297f('0x25')](_0x297f('0x23'),_0x297f('0x2c'),_0x297f('0x92'),util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x398ee8===_0x297f('0xd8')||_0x398ee8==='ACCEPTD'){return _0x10cceb[_0x297f('0x36')]({'read':!![]});}else{logger[_0x297f('0x25')](_0x297f('0x23'),_0x297f('0x2c'),_0x297f('0xd3'),util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x10cceb;}})[_0x297f('0x20')](respondWithResult(_0x1a25aa,null))['catch'](handleError(_0x1a25aa,null));};exports['statusGet']=function(_0x1cd329,_0x4f1473,_0x45eae0){var _0xd46eed,_0x255367,_0x366fcf;return db[_0x297f('0x40')]['find']({'where':{'id':_0x1cd329[_0x297f('0x59')]['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x4f1473,null))['then'](function(_0x57f01c){if(_0x57f01c){_0x366fcf=_0x57f01c;logger[_0x297f('0x22')](_0x297f('0x23'),_0x297f('0x2c'),_0x297f('0xcc'),_0x57f01c[_0x297f('0x42')],util['inspect'](_0x1cd329[_0x297f('0x45')],{'showHidden':![],'depth':null}));switch(_0x57f01c[_0x297f('0x42')]){case _0x297f('0x8d'):if(_0x1cd329['query'][_0x297f('0xd9')]&&_0x1cd329['query'][_0x297f('0xda')]){_0x255367=_0x1cd329[_0x297f('0x45')][_0x297f('0xda')];return db[_0x297f('0xa5')][_0x297f('0x60')]({'where':{'messageId':_0x1cd329['query'][_0x297f('0xd9')]}});}break;}}})[_0x297f('0x20')](handleEntityNotFound(_0x4f1473,null))['then'](function(_0x1f9fcd){if(_0x1f9fcd){_0xd46eed=_0x1f9fcd;switch(_0x366fcf[_0x297f('0x42')]){case _0x297f('0x8d'):if(_0x255367==='2'||_0x255367==='6'){return _0xd46eed[_0x297f('0x36')]({'read':!![]});}else{logger[_0x297f('0x25')](_0x297f('0x23'),_0x297f('0x2c'),_0x297f('0x8d'),util[_0x297f('0xcd')](_0x1cd329[_0x297f('0x45')],{'showHidden':![],'depth':null}));};break;}return _0xd46eed;}})[_0x297f('0x20')](respondWithResult(_0x4f1473,null))['catch'](handleError(_0x4f1473,null));};exports[_0x297f('0xdb')]=function(_0x4bbee0,_0x1e0a43,_0x2c99ea){return db[_0x297f('0x40')][_0x297f('0x60')]({'where':{'id':_0x4bbee0['params']['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x1e0a43,null))[_0x297f('0x20')](function(_0x5a7efa){if(_0x5a7efa){return _0x5a7efa[_0x297f('0xdb')](_0x4bbee0[_0x297f('0x63')][_0x297f('0x6b')],_[_0x297f('0x9d')](_0x4bbee0['body'],['ids','id'])||{})['spread'](function(_0x25cec1){for(var _0xd5370d=0x0;_0xd5370d<_0x4bbee0[_0x297f('0x63')]['ids']['length'];_0xd5370d+=0x1){socket[_0x297f('0xdc')](_0x297f('0xdd'),{'UserId':Number(_0x4bbee0[_0x297f('0x63')][_0x297f('0x6b')][_0xd5370d]),'SmsAccountId':Number(_0x4bbee0[_0x297f('0x59')]['id'])});}return _0x25cec1;});}})['then'](respondWithResult(_0x1e0a43,null))[_0x297f('0x2a')](handleError(_0x1e0a43,null));};exports[_0x297f('0xde')]=function(_0xa9db2,_0x545949,_0x46529c){return db['SmsAccount'][_0x297f('0x60')]({'where':{'id':_0xa9db2['params']['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x545949,null))['then'](function(_0x42cba5){if(_0x42cba5){return _0x42cba5['removeAgents'](_0xa9db2['query'][_0x297f('0x6b')])['then'](function(){if(_[_0x297f('0xdf')](_0xa9db2[_0x297f('0x45')][_0x297f('0x6b')])){for(var _0x433b31=0x0;_0x433b31<_0xa9db2['query'][_0x297f('0x6b')]['length'];_0x433b31+=0x1){socket[_0x297f('0xdc')](_0x297f('0xe0'),{'UserId':Number(_0xa9db2[_0x297f('0x45')][_0x297f('0x6b')][_0x433b31]),'SmsAccountId':Number(_0xa9db2['params']['id'])});}}else{socket[_0x297f('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0xa9db2['query'][_0x297f('0x6b')]),'SmsAccountId':Number(_0xa9db2[_0x297f('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x545949,null))['catch'](handleError(_0x545949,null));};exports[_0x297f('0xe1')]=function(_0x1fc8bf,_0x4b347d,_0x2172b3){var _0x7e2b80={};var _0x120d22={};var _0x272441;var _0x289aee;return db[_0x297f('0x40')][_0x297f('0x68')]({'where':{'id':_0x1fc8bf[_0x297f('0x59')]['id']}})['then'](handleEntityNotFound(_0x4b347d,null))[_0x297f('0x20')](function(_0x36f5cb){if(_0x36f5cb){_0x272441=_0x36f5cb;_0x120d22['model']=_[_0x297f('0x5b')](db[_0x297f('0xa9')][_0x297f('0x41')]);_0x120d22[_0x297f('0x45')]=_[_0x297f('0x5b')](_0x1fc8bf['query']);_0x120d22[_0x297f('0x46')]=_['intersection'](_0x120d22[_0x297f('0x44')],_0x120d22[_0x297f('0x45')]);_0x7e2b80[_0x297f('0x47')]=_['intersection'](_0x120d22[_0x297f('0x44')],qs['fields'](_0x1fc8bf[_0x297f('0x45')][_0x297f('0x49')]));_0x7e2b80[_0x297f('0x47')]=_0x7e2b80[_0x297f('0x47')][_0x297f('0x4a')]?_0x7e2b80[_0x297f('0x47')]:_0x120d22[_0x297f('0x44')];_0x7e2b80[_0x297f('0x6a')]=qs[_0x297f('0x4d')](_0x1fc8bf['query'][_0x297f('0x4d')]);_0x7e2b80['where']=qs[_0x297f('0x46')](_[_0x297f('0x4f')](_0x1fc8bf[_0x297f('0x45')],_0x120d22['filters']));if(_0x1fc8bf[_0x297f('0x45')][_0x297f('0x50')]){_0x7e2b80[_0x297f('0x4e')]=_[_0x297f('0x51')](_0x7e2b80[_0x297f('0x4e')],{'$or':_['map'](_0x7e2b80['attributes'],function(_0xa6de33){var _0x22962f={};_0x22962f[_0xa6de33]={'$like':'%'+_0x1fc8bf[_0x297f('0x45')][_0x297f('0x50')]+'%'};return _0x22962f;})});}_0x7e2b80=_[_0x297f('0x51')]({},_0x7e2b80,_0x1fc8bf['options']);return _0x272441[_0x297f('0xe1')](_0x7e2b80);}})['then'](function(_0xdc0d54){if(_0xdc0d54){_0x289aee=_0xdc0d54['length'];if(!_0x1fc8bf[_0x297f('0x45')][_0x297f('0x4b')]('nolimit')){_0x7e2b80[_0x297f('0x32')]=qs[_0x297f('0x32')](_0x1fc8bf['query'][_0x297f('0x32')]);_0x7e2b80['offset']=qs[_0x297f('0x2f')](_0x1fc8bf[_0x297f('0x45')]['offset']);}return _0x272441[_0x297f('0xe1')](_0x7e2b80);}})[_0x297f('0x20')](function(_0x238875){if(_0x238875){return _0x238875?{'count':_0x289aee,'rows':_0x238875}:null;}})[_0x297f('0x20')](respondWithResult(_0x4b347d,null))[_0x297f('0x2a')](handleError(_0x4b347d,null));}; \ No newline at end of file +var _0xf42c=['CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','twilio','From','Body','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','message_id','plivo','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','Sequelize','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','Content-Type','addApplications','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','send','getApplications','Contact','User','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/environment','../../config/license/util','../../mysqldb','defaults','localhost','./smsAccount.socket','register','client','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','get','SmsAccounts','destroy','stack','name','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','fields','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','update','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','order','pick','SmsAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','SmsApplication','account','applications','orderBy','Applications','asc'];(function(_0x3bbb16,_0x238a54){var _0x134e7a=function(_0x447fba){while(--_0x447fba){_0x3bbb16['push'](_0x3bbb16['shift']());}};_0x134e7a(++_0x238a54);}(_0xf42c,0x6a));var _0xcf42=function(_0x29b564,_0x2d95bd){_0x29b564=_0x29b564-0x0;var _0xae0676=_0xf42c[_0x29b564];return _0xae0676;};'use strict';var emlformat=require(_0xcf42('0x0'));var rimraf=require(_0xcf42('0x1'));var zipdir=require(_0xcf42('0x2'));var jsonpatch=require(_0xcf42('0x3'));var rp=require(_0xcf42('0x4'));var moment=require('moment');var BPromise=require(_0xcf42('0x5'));var Mustache=require(_0xcf42('0x6'));var util=require(_0xcf42('0x7'));var path=require(_0xcf42('0x8'));var sox=require('sox');var csv=require(_0xcf42('0x9'));var ejs=require(_0xcf42('0xa'));var fs=require('fs');var fs_extra=require(_0xcf42('0xb'));var _=require(_0xcf42('0xc'));var squel=require(_0xcf42('0xd'));var crypto=require(_0xcf42('0xe'));var jsforce=require(_0xcf42('0xf'));var deskjs=require(_0xcf42('0x10'));var toCsv=require(_0xcf42('0x9'));var querystring=require(_0xcf42('0x11'));var Papa=require(_0xcf42('0x12'));var Redis=require(_0xcf42('0x13'));var authService=require(_0xcf42('0x14'));var qs=require(_0xcf42('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf42('0x16'))(_0xcf42('0x17'));var utils=require(_0xcf42('0x18'));var config=require(_0xcf42('0x19'));var licenseUtil=require(_0xcf42('0x1a'));var db=require(_0xcf42('0x1b'))['db'];config['redis']=_[_0xcf42('0x1c')](config['redis'],{'host':_0xcf42('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcf42('0x1e'))[_0xcf42('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xcf42('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x54e2f3,_0x300d0d,_0x20367f,_0x365b5e){return new BPromise(function(_0x15f88f,_0xb12fd){var _0x4b9714=_0x365b5e||client;return _0x4b9714[_0xcf42('0x21')](_0x54e2f3,_0x20367f)['then'](function(_0x491bd7){logger[_0xcf42('0x22')](_0xcf42('0x23'),_0x300d0d,_0xcf42('0x24'));logger[_0xcf42('0x25')](_0xcf42('0x26'),_0x300d0d,_0xcf42('0x24'),JSON[_0xcf42('0x27')](_0x491bd7));if(_0x491bd7[_0xcf42('0x28')]){if(_0x491bd7[_0xcf42('0x28')][_0xcf42('0x29')]===0x1f4){logger[_0xcf42('0x28')](_0xcf42('0x23'),_0x300d0d,_0x491bd7[_0xcf42('0x28')]['message']);return _0xb12fd(_0x491bd7['error'][_0xcf42('0x2a')]);}logger[_0xcf42('0x28')]('SmsAccount,\x20%s,\x20%s',_0x300d0d,_0x491bd7['error'][_0xcf42('0x2a')]);return _0x15f88f(_0x491bd7['error'][_0xcf42('0x2a')]);}else{logger[_0xcf42('0x22')]('SmsAccount,\x20%s,\x20%s',_0x300d0d,_0xcf42('0x24'));_0x15f88f(_0x491bd7['result']['message']);}})[_0xcf42('0x2b')](function(_0x3788cb){logger[_0xcf42('0x28')](_0xcf42('0x23'),_0x300d0d,_0x3788cb);_0xb12fd(_0x3788cb);});});}function respondWithStatusCode(_0x4e9771,_0x3d4f0c){_0x3d4f0c=_0x3d4f0c||0xcc;return function(_0x1ddb6c){if(_0x1ddb6c){return _0x4e9771['sendStatus'](_0x3d4f0c);}return _0x4e9771[_0xcf42('0x2c')](_0x3d4f0c)[_0xcf42('0x2d')]();};}function respondWithResult(_0x2f7aad,_0x5ad0fc){_0x5ad0fc=_0x5ad0fc||0xc8;return function(_0x2d51a0){if(_0x2d51a0){return _0x2f7aad[_0xcf42('0x2c')](_0x5ad0fc)[_0xcf42('0x2e')](_0x2d51a0);}};}function respondWithFilteredResult(_0xaa22ed,_0x3d122b){return function(_0x28822a){if(_0x28822a){var _0x28ea1e=typeof _0x3d122b[_0xcf42('0x2f')]===_0xcf42('0x30')&&typeof _0x3d122b[_0xcf42('0x31')]===_0xcf42('0x30');var _0x437d74=_0x28822a['count'];var _0x48a13a=_0x28ea1e?0x0:_0x3d122b[_0xcf42('0x2f')];var _0x188c8c=_0x28ea1e?_0x28822a[_0xcf42('0x32')]:_0x3d122b['offset']+_0x3d122b[_0xcf42('0x31')];var _0x374c24;if(_0x188c8c>=_0x437d74){_0x188c8c=_0x437d74;_0x374c24=0xc8;}else{_0x374c24=0xce;}_0xaa22ed[_0xcf42('0x2c')](_0x374c24);return _0xaa22ed[_0xcf42('0x33')](_0xcf42('0x34'),_0x48a13a+'-'+_0x188c8c+'/'+_0x437d74)[_0xcf42('0x2e')](_0x28822a);}return null;};}function patchUpdates(_0x1bb1a0){return function(_0x12a3bb){try{jsonpatch['apply'](_0x12a3bb,_0x1bb1a0,!![]);}catch(_0x29e2c5){return BPromise[_0xcf42('0x35')](_0x29e2c5);}return _0x12a3bb[_0xcf42('0x36')]();};}function saveUpdates(_0x19d5b5,_0x553f55){return function(_0x479abb){if(_0x479abb){return _0x479abb['update'](_0x19d5b5)[_0xcf42('0x37')](function(_0x54a3c6){return _0x54a3c6;});}return null;};}function removeEntity(_0x340241,_0x3b4e01){return function(_0x270ea5){if(_0x270ea5){return _0x270ea5['destroy']()['then'](function(){var _0xe5400b=_0x270ea5[_0xcf42('0x38')]({'plain':!![]});var _0x35311b=_0xcf42('0x39');return db['UserProfileResource'][_0xcf42('0x3a')]({'where':{'type':_0x35311b,'resourceId':_0xe5400b['id']}})[_0xcf42('0x37')](function(){return _0x270ea5;});})[_0xcf42('0x37')](function(){_0x340241[_0xcf42('0x2c')](0xcc)[_0xcf42('0x2d')]();});}};}function handleEntityNotFound(_0x25cc69,_0x36c85e){return function(_0x282eb2){if(!_0x282eb2){_0x25cc69['sendStatus'](0x194);}return _0x282eb2;};}function handleError(_0x4f3c1d,_0x51f9cd){_0x51f9cd=_0x51f9cd||0x1f4;return function(_0x43f2f7){logger['error'](_0x43f2f7[_0xcf42('0x3b')]);if(_0x43f2f7['name']){delete _0x43f2f7[_0xcf42('0x3c')];}_0x4f3c1d['status'](_0x51f9cd)['send'](_0x43f2f7);};}exports['index']=function(_0x5ed910,_0x2a20c2){var _0x33d248={'include':[{'model':db[_0xcf42('0x3d')],'as':_0xcf42('0x3e')}]},_0x104a04={},_0x2c0b97={'count':0x0,'rows':[]};var _0x3592ba=_[_0xcf42('0x3f')](db[_0xcf42('0x40')][_0xcf42('0x41')],function(_0x24f4cc){return{'name':_0x24f4cc[_0xcf42('0x42')],'type':_0x24f4cc[_0xcf42('0x43')]['key']};});_0x104a04[_0xcf42('0x44')]=_[_0xcf42('0x3f')](_0x3592ba,_0xcf42('0x3c'));_0x104a04[_0xcf42('0x45')]=_[_0xcf42('0x46')](_0x5ed910[_0xcf42('0x45')]);_0x104a04[_0xcf42('0x47')]=_[_0xcf42('0x48')](_0x104a04[_0xcf42('0x44')],_0x104a04[_0xcf42('0x45')]);_0x33d248[_0xcf42('0x49')]=_[_0xcf42('0x48')](_0x104a04[_0xcf42('0x44')],qs['fields'](_0x5ed910[_0xcf42('0x45')]['fields']));_0x33d248['attributes']=_0x33d248[_0xcf42('0x49')][_0xcf42('0x4a')]?_0x33d248[_0xcf42('0x49')]:_0x104a04[_0xcf42('0x44')];if(!_0x5ed910[_0xcf42('0x45')][_0xcf42('0x4b')]('nolimit')){_0x33d248[_0xcf42('0x31')]=qs[_0xcf42('0x31')](_0x5ed910[_0xcf42('0x45')][_0xcf42('0x31')]);_0x33d248[_0xcf42('0x2f')]=qs[_0xcf42('0x2f')](_0x5ed910[_0xcf42('0x45')][_0xcf42('0x2f')]);}_0x33d248['order']=qs[_0xcf42('0x4c')](_0x5ed910[_0xcf42('0x45')][_0xcf42('0x4c')]);_0x33d248[_0xcf42('0x4d')]=qs[_0xcf42('0x47')](_['pick'](_0x5ed910[_0xcf42('0x45')],_0x104a04[_0xcf42('0x47')]),_0x3592ba);if(_0x5ed910[_0xcf42('0x45')][_0xcf42('0x4e')]){_0x33d248[_0xcf42('0x4d')]=_[_0xcf42('0x4f')](_0x33d248[_0xcf42('0x4d')],{'$or':_['map'](_0x3592ba,function(_0x39c34c){if(_0x39c34c[_0xcf42('0x43')]!=='VIRTUAL'){var _0x59e9ab={};_0x59e9ab[_0x39c34c['name']]={'$like':'%'+_0x5ed910['query'][_0xcf42('0x4e')]+'%'};return _0x59e9ab;}})});}_0x33d248=_[_0xcf42('0x4f')]({},_0x33d248,_0x5ed910[_0xcf42('0x50')]);var _0x5ace06={'where':_0x33d248[_0xcf42('0x4d')]};return db[_0xcf42('0x40')][_0xcf42('0x32')](_0x5ace06)[_0xcf42('0x37')](function(_0x50ae45){_0x2c0b97[_0xcf42('0x32')]=_0x50ae45;if(_0x5ed910[_0xcf42('0x45')][_0xcf42('0x51')]){_0x33d248['include']=[{'all':!![]}];}return db[_0xcf42('0x40')][_0xcf42('0x52')](_0x33d248);})['then'](function(_0x267226){_0x2c0b97[_0xcf42('0x53')]=_0x267226;return _0x2c0b97;})[_0xcf42('0x37')](respondWithFilteredResult(_0x2a20c2,_0x33d248))[_0xcf42('0x2b')](handleError(_0x2a20c2,null));};exports[_0xcf42('0x54')]=function(_0x437a46,_0x597bb9){var _0x16de6c={'raw':![],'where':{'id':_0x437a46[_0xcf42('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xcf42('0x3e')}]},_0x1d4269={};_0x1d4269[_0xcf42('0x44')]=_[_0xcf42('0x46')](db[_0xcf42('0x40')][_0xcf42('0x41')]);_0x1d4269[_0xcf42('0x45')]=_[_0xcf42('0x46')](_0x437a46[_0xcf42('0x45')]);_0x1d4269[_0xcf42('0x47')]=_[_0xcf42('0x48')](_0x1d4269[_0xcf42('0x44')],_0x1d4269[_0xcf42('0x45')]);_0x16de6c[_0xcf42('0x49')]=_[_0xcf42('0x48')](_0x1d4269[_0xcf42('0x44')],qs[_0xcf42('0x56')](_0x437a46[_0xcf42('0x45')][_0xcf42('0x56')]));_0x16de6c['attributes']=_0x16de6c[_0xcf42('0x49')]['length']?_0x16de6c[_0xcf42('0x49')]:_0x1d4269[_0xcf42('0x44')];if(_0x437a46[_0xcf42('0x45')][_0xcf42('0x51')]){_0x16de6c[_0xcf42('0x57')]=[{'all':!![]}];}_0x16de6c=_[_0xcf42('0x4f')]({},_0x16de6c,_0x437a46['options']);return db['SmsAccount'][_0xcf42('0x58')](_0x16de6c)[_0xcf42('0x37')](handleEntityNotFound(_0x597bb9,null))[_0xcf42('0x37')](respondWithResult(_0x597bb9,null))['catch'](handleError(_0x597bb9,null));};exports[_0xcf42('0x59')]=function(_0x8b98ce,_0x28e2dc){return db['SmsAccount'][_0xcf42('0x59')](_0x8b98ce[_0xcf42('0x5a')],{})[_0xcf42('0x37')](function(_0x41ff12){var _0x3b038e=_0x8b98ce['user'][_0xcf42('0x38')]({'plain':!![]});if(!_0x3b038e)throw new Error(_0xcf42('0x5b'));if(_0x3b038e[_0xcf42('0x5c')]===_0xcf42('0x5d')){var _0x30f8c4=_0x41ff12[_0xcf42('0x38')]({'plain':!![]});var _0x49136a='SmsAccounts';return db[_0xcf42('0x5e')][_0xcf42('0x58')]({'where':{'name':_0x49136a,'userProfileId':_0x3b038e['userProfileId']},'raw':!![]})['then'](function(_0x115cde){if(_0x115cde&&_0x115cde[_0xcf42('0x5f')]===0x0){return db[_0xcf42('0x60')][_0xcf42('0x59')]({'name':_0x30f8c4[_0xcf42('0x3c')],'resourceId':_0x30f8c4['id'],'type':_0x115cde[_0xcf42('0x3c')],'sectionId':_0x115cde['id']},{})[_0xcf42('0x37')](function(){return _0x41ff12;});}else{return _0x41ff12;}})[_0xcf42('0x2b')](function(_0x2a78fa){logger[_0xcf42('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a78fa);throw _0x2a78fa;});}return _0x41ff12;})[_0xcf42('0x37')](respondWithResult(_0x28e2dc,0xc9))[_0xcf42('0x2b')](handleError(_0x28e2dc,null));};exports[_0xcf42('0x61')]=function(_0x14b9c4,_0x204a6e){if(_0x14b9c4[_0xcf42('0x5a')]['id']){delete _0x14b9c4[_0xcf42('0x5a')]['id'];}return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x14b9c4[_0xcf42('0x55')]['id']},'include':[{'model':db[_0xcf42('0x3d')],'as':_0xcf42('0x3e')}]})[_0xcf42('0x37')](handleEntityNotFound(_0x204a6e,null))[_0xcf42('0x37')](saveUpdates(_0x14b9c4[_0xcf42('0x5a')],null))[_0xcf42('0x37')](respondWithResult(_0x204a6e,null))['catch'](handleError(_0x204a6e,null));};exports[_0xcf42('0x3a')]=function(_0x176255,_0x24ddc2){return db[_0xcf42('0x40')]['find']({'where':{'id':_0x176255[_0xcf42('0x55')]['id']}})['then'](handleEntityNotFound(_0x24ddc2,null))[_0xcf42('0x37')](removeEntity(_0x24ddc2,null))[_0xcf42('0x2b')](handleError(_0x24ddc2,null));};exports[_0xcf42('0x62')]=function(_0x4ee85e,_0x493a62){return db[_0xcf42('0x40')]['describe']()['then'](respondWithResult(_0x493a62,null))[_0xcf42('0x2b')](handleError(_0x493a62,null));};exports[_0xcf42('0x63')]=function(_0x355b9e,_0x22cd7f,_0x216808){if(_0x355b9e['body']['id']){delete _0x355b9e[_0xcf42('0x5a')]['id'];}return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x355b9e['params']['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x22cd7f,null))['then'](function(_0x2e6cfb){if(_0x2e6cfb){_0x355b9e[_0xcf42('0x5a')]['SmsAccountId']=_0x2e6cfb['id'];return db[_0xcf42('0x64')][_0xcf42('0x59')](_0x355b9e['body']);}})[_0xcf42('0x37')](respondWithResult(_0x22cd7f,null))['catch'](handleError(_0x22cd7f,null));};exports[_0xcf42('0x65')]=function(_0x1ba19b,_0x1ac1d0,_0x25be0a){var _0x46d165={'raw':![],'where':{}};var _0x4dcb3d={};var _0x11ad83={'count':0x0,'rows':[]};return db[_0xcf42('0x40')][_0xcf42('0x66')]({'where':{'id':_0x1ba19b[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x1ac1d0,null))[_0xcf42('0x37')](function(_0x270dd9){if(_0x270dd9){_0x4dcb3d[_0xcf42('0x44')]=_[_0xcf42('0x46')](db[_0xcf42('0x64')]['rawAttributes']);_0x4dcb3d[_0xcf42('0x45')]=_[_0xcf42('0x46')](_0x1ba19b[_0xcf42('0x45')]);_0x4dcb3d['filters']=_[_0xcf42('0x48')](_0x4dcb3d['model'],_0x4dcb3d[_0xcf42('0x45')]);_0x46d165['attributes']=_[_0xcf42('0x48')](_0x4dcb3d[_0xcf42('0x44')],qs[_0xcf42('0x56')](_0x1ba19b['query'][_0xcf42('0x56')]));_0x46d165['attributes']=_0x46d165[_0xcf42('0x49')][_0xcf42('0x4a')]?_0x46d165[_0xcf42('0x49')]:_0x4dcb3d[_0xcf42('0x44')];if(!_0x1ba19b[_0xcf42('0x45')]['hasOwnProperty'](_0xcf42('0x67'))){_0x46d165[_0xcf42('0x31')]=qs[_0xcf42('0x31')](_0x1ba19b[_0xcf42('0x45')][_0xcf42('0x31')]);_0x46d165[_0xcf42('0x2f')]=qs[_0xcf42('0x2f')](_0x1ba19b[_0xcf42('0x45')][_0xcf42('0x2f')]);}_0x46d165[_0xcf42('0x68')]=qs[_0xcf42('0x4c')](_0x1ba19b[_0xcf42('0x45')]['sort']);_0x46d165[_0xcf42('0x4d')]=qs[_0xcf42('0x47')](_[_0xcf42('0x69')](_0x1ba19b[_0xcf42('0x45')],_0x4dcb3d[_0xcf42('0x47')]));_0x46d165[_0xcf42('0x4d')][_0xcf42('0x6a')]=_0x270dd9['id'];if(_0x1ba19b[_0xcf42('0x45')][_0xcf42('0x4e')]){_0x46d165[_0xcf42('0x4d')]=_[_0xcf42('0x4f')](_0x46d165[_0xcf42('0x4d')],{'$or':_[_0xcf42('0x3f')](_0x46d165[_0xcf42('0x49')],function(_0x4fb6e1){var _0x3471c0={};_0x3471c0[_0x4fb6e1]={'$like':'%'+_0x1ba19b[_0xcf42('0x45')][_0xcf42('0x4e')]+'%'};return _0x3471c0;})});}_0x46d165=_['merge']({},_0x46d165,_0x1ba19b[_0xcf42('0x50')]);return db['Disposition'][_0xcf42('0x32')]({'where':_0x46d165[_0xcf42('0x4d')]})[_0xcf42('0x37')](function(_0x10dfaf){_0x11ad83[_0xcf42('0x32')]=_0x10dfaf;if(_0x1ba19b['query'][_0xcf42('0x51')]){_0x46d165[_0xcf42('0x57')]=[{'all':!![]}];}return db[_0xcf42('0x64')]['findAll'](_0x46d165);})[_0xcf42('0x37')](function(_0x236a80){_0x11ad83[_0xcf42('0x53')]=_0x236a80;return _0x11ad83;});}})['then'](respondWithFilteredResult(_0x1ac1d0,_0x46d165))[_0xcf42('0x2b')](handleError(_0x1ac1d0,null));};exports[_0xcf42('0x6b')]=function(_0x3d65de,_0x239409,_0x40acf6){return db['SmsAccount'][_0xcf42('0x58')]({'where':{'id':_0x3d65de[_0xcf42('0x55')]['id']}})['then'](handleEntityNotFound(_0x239409,null))['then'](function(_0x2622c2){if(_0x2622c2){return _0x2622c2[_0xcf42('0x6b')](_0x3d65de[_0xcf42('0x45')][_0xcf42('0x6c')]);}})['then'](respondWithStatusCode(_0x239409,null))[_0xcf42('0x2b')](handleError(_0x239409,null));};exports[_0xcf42('0x6d')]=function(_0x47ae15,_0x271f5b,_0x3b3aeb){if(_0x47ae15[_0xcf42('0x5a')]['id']){delete _0x47ae15['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x47ae15[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x271f5b,null))[_0xcf42('0x37')](function(_0x33bdc5){if(_0x33bdc5){_0x47ae15['body'][_0xcf42('0x6a')]=_0x33bdc5['id'];return db['CannedAnswer'][_0xcf42('0x59')](_0x47ae15[_0xcf42('0x5a')]);}})[_0xcf42('0x37')](respondWithResult(_0x271f5b,null))[_0xcf42('0x2b')](handleError(_0x271f5b,null));};exports[_0xcf42('0x6e')]=function(_0x308acd,_0x520083,_0x3bd2a1){var _0x3e17aa={'raw':![],'where':{}};var _0x37efa3={};var _0x2555ce={'count':0x0,'rows':[]};return db[_0xcf42('0x40')][_0xcf42('0x66')]({'where':{'id':_0x308acd[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x520083,null))['then'](function(_0x3404d7){if(_0x3404d7){_0x37efa3[_0xcf42('0x44')]=_[_0xcf42('0x46')](db[_0xcf42('0x6f')][_0xcf42('0x41')]);_0x37efa3[_0xcf42('0x45')]=_[_0xcf42('0x46')](_0x308acd[_0xcf42('0x45')]);_0x37efa3[_0xcf42('0x47')]=_[_0xcf42('0x48')](_0x37efa3[_0xcf42('0x44')],_0x37efa3['query']);_0x3e17aa[_0xcf42('0x49')]=_['intersection'](_0x37efa3[_0xcf42('0x44')],qs[_0xcf42('0x56')](_0x308acd[_0xcf42('0x45')][_0xcf42('0x56')]));_0x3e17aa[_0xcf42('0x49')]=_0x3e17aa[_0xcf42('0x49')]['length']?_0x3e17aa['attributes']:_0x37efa3[_0xcf42('0x44')];if(!_0x308acd[_0xcf42('0x45')][_0xcf42('0x4b')](_0xcf42('0x67'))){_0x3e17aa['limit']=qs[_0xcf42('0x31')](_0x308acd[_0xcf42('0x45')][_0xcf42('0x31')]);_0x3e17aa[_0xcf42('0x2f')]=qs['offset'](_0x308acd[_0xcf42('0x45')][_0xcf42('0x2f')]);}_0x3e17aa[_0xcf42('0x68')]=qs[_0xcf42('0x4c')](_0x308acd[_0xcf42('0x45')][_0xcf42('0x4c')]);_0x3e17aa[_0xcf42('0x4d')]=qs[_0xcf42('0x47')](_[_0xcf42('0x69')](_0x308acd[_0xcf42('0x45')],_0x37efa3['filters']));_0x3e17aa['where'][_0xcf42('0x6a')]=_0x3404d7['id'];if(_0x308acd[_0xcf42('0x45')][_0xcf42('0x4e')]){_0x3e17aa[_0xcf42('0x4d')]=_[_0xcf42('0x4f')](_0x3e17aa[_0xcf42('0x4d')],{'$or':_['map'](_0x3e17aa[_0xcf42('0x49')],function(_0x4dbdc4){var _0x4d4674={};_0x4d4674[_0x4dbdc4]={'$like':'%'+_0x308acd[_0xcf42('0x45')]['filter']+'%'};return _0x4d4674;})});}_0x3e17aa=_[_0xcf42('0x4f')]({},_0x3e17aa,_0x308acd[_0xcf42('0x50')]);return db['CannedAnswer']['count']({'where':_0x3e17aa[_0xcf42('0x4d')]})[_0xcf42('0x37')](function(_0x455c27){_0x2555ce[_0xcf42('0x32')]=_0x455c27;if(_0x308acd[_0xcf42('0x45')][_0xcf42('0x51')]){_0x3e17aa[_0xcf42('0x57')]=[{'all':!![]}];}return db[_0xcf42('0x6f')][_0xcf42('0x52')](_0x3e17aa);})[_0xcf42('0x37')](function(_0x1b827c){_0x2555ce['rows']=_0x1b827c;return _0x2555ce;});}})['then'](respondWithFilteredResult(_0x520083,_0x3e17aa))[_0xcf42('0x2b')](handleError(_0x520083,null));};exports['removeAnswers']=function(_0x825e7a,_0x44086a,_0x53ea6d){return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x825e7a[_0xcf42('0x55')]['id']}})['then'](handleEntityNotFound(_0x44086a,null))[_0xcf42('0x37')](function(_0x1ebe37){if(_0x1ebe37){return _0x1ebe37[_0xcf42('0x70')](_0x825e7a[_0xcf42('0x45')][_0xcf42('0x6c')]);}})['then'](respondWithStatusCode(_0x44086a,null))[_0xcf42('0x2b')](handleError(_0x44086a,null));};exports[_0xcf42('0x71')]=function(_0x21cbc3,_0x2472b1,_0x182293){var _0xb9f732={'channel':'sms'};var _0x373576=[];var _0x23ee1c=[];var _0x802bcd={};return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x21cbc3[_0xcf42('0x55')]['id']},'include':[{'model':db[_0xcf42('0x72')],'as':'Applications'}]})[_0xcf42('0x37')](handleEntityNotFound(_0x2472b1,null))['then'](function(_0x29bb7d){_0xb9f732[_0xcf42('0x73')]=_0x29bb7d;_0xb9f732[_0xcf42('0x74')]=_[_0xcf42('0x75')](_0x29bb7d[_0xcf42('0x76')],['priority'],[_0xcf42('0x77')]);if(_0xb9f732[_0xcf42('0x73')][_0xcf42('0x76')]){delete _0xb9f732['account'][_0xcf42('0x76')];}return db[_0xcf42('0x78')][_0xcf42('0x62')]();})[_0xcf42('0x37')](function(_0xa37ff4){if(!_0xa37ff4){throw new db['Sequelize'][(_0xcf42('0x79'))](_0xcf42('0x7a'));}_0x373576=_[_0xcf42('0x7b')](_['keys'](_0xa37ff4),['createdAt',_0xcf42('0x7c')]);_0x23ee1c=_['difference'](_['keys'](_0xa37ff4),[_0xcf42('0x7d'),'updatedAt','CompanyId',_0xcf42('0x7e')]);_0xb9f732[_0xcf42('0x5a')]={'mapKey':'mobile'};if(_0xb9f732[_0xcf42('0x73')][_0xcf42('0x43')]){switch(_0xb9f732[_0xcf42('0x73')][_0xcf42('0x43')]){case _0xcf42('0x7f'):_0xb9f732[_0xcf42('0x5a')]['from']=_0x21cbc3['body'][_0xcf42('0x80')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x81')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x82')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x83')];break;case _0xcf42('0x84'):_0xb9f732['body'][_0xcf42('0x85')]='+'+_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x86')];_0xb9f732[_0xcf42('0x5a')]['body']=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x87')];break;case _0xcf42('0x88'):_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3['body'][_0xcf42('0x85')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')]=_0x21cbc3['body']['message'];break;case _0xcf42('0x89'):_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x85')];_0xb9f732['body']['body']=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x5a')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x82')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x8a')];break;case _0xcf42('0x8b'):_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3[_0xcf42('0x5a')]['From'];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')]=_0x21cbc3[_0xcf42('0x5a')]['Text'];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x82')]=_0x21cbc3[_0xcf42('0x5a')]['MessageUUID'];break;case'infobip':_0xb9f732['body'][_0xcf42('0x85')]='+'+_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x8c')][0x0][_0xcf42('0x85')];_0xb9f732['body'][_0xcf42('0x5a')]=_0x21cbc3['body']['results'][0x0][_0xcf42('0x87')];_0xb9f732['body'][_0xcf42('0x82')]=_0x21cbc3['body'][_0xcf42('0x8c')][0x0][_0xcf42('0x82')];break;case _0xcf42('0x8d'):_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x8e')];_0xb9f732['body'][_0xcf42('0x5a')]=_0x21cbc3['body'][_0xcf42('0x8f')][_0xcf42('0x2a')];break;case'clickatell':_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x90')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x87')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x82')]=_0x21cbc3['body'][_0xcf42('0x91')];break;case _0xcf42('0x92'):_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x82')]=_0x21cbc3['body'][0x0]['message']['id'];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3[_0xcf42('0x5a')][0x0][_0xcf42('0x2a')][_0xcf42('0x85')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')]=_0x21cbc3['body'][0x0][_0xcf42('0x2a')]['text'];break;case _0xcf42('0x93'):_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3['body'][_0xcf42('0x85')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x2a')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x82')]=_0x21cbc3[_0xcf42('0x5a')]['refid'];break;}}if(_0xb9f732[_0xcf42('0x5a')]['id']){delete _0xb9f732[_0xcf42('0x5a')]['id'];}if(_['isNil'](_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')])){throw new db[(_0xcf42('0x94'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xcf42('0x95')](_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')])||_0xb9f732[_0xcf42('0x5a')]['body']===''){throw new db[(_0xcf42('0x94'))][(_0xcf42('0x79'))](_0xcf42('0x96'));}if(_['isNil'](_0xb9f732['body']['mapKey'])){throw new db[(_0xcf42('0x94'))][(_0xcf42('0x79'))](_0xcf42('0x97')+_0x23ee1c);}if(!_[_0xcf42('0x98')](_0x23ee1c,_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x99')])){throw new db[(_0xcf42('0x94'))]['ValidationError'](_0xcf42('0x9a')+_0x23ee1c);}_0x802bcd[_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x99')]]=_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')];return db[_0xcf42('0x9b')][_0xcf42('0x58')]({'where':{'id':_0xb9f732['account'][_0xcf42('0x7e')]},'include':[{'model':db['CmContact'],'as':_0xcf42('0x9c'),'where':_0x802bcd,'limit':0x1,'order':[[_0xcf42('0x7c'),_0xcf42('0x9d')]]}]});})[_0xcf42('0x37')](handleEntityNotFound(_0x2472b1,null))[_0xcf42('0x37')](function(_0x47c204){if(_0x47c204){_0xb9f732['list']=_[_0xcf42('0x9e')](_0x47c204,['Contacts']);if(_0x47c204[_0xcf42('0x9c')]['length']){return _0x47c204[_0xcf42('0x9c')][0x0];}var _0x59d365=_[_0xcf42('0x1c')](_0xb9f732['body'],{'firstName':_0xb9f732[_0xcf42('0x5a')]['from'],'ListId':_0x47c204['id']});_0x59d365[_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x99')]]=_0xb9f732['body'][_0xcf42('0x85')];return db['CmContact'][_0xcf42('0x59')](_0x59d365,{'fields':_0x373576,'raw':!![]});}})[_0xcf42('0x37')](handleEntityNotFound(_0x2472b1,null))['then'](function(_0x234df0){if(_0x234df0){_0xb9f732[_0xcf42('0x9f')]=_0x234df0;var _0x5104e9={'ContactId':_0x234df0['id'],'phone':_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')],'SmsAccountId':_0x21cbc3[_0xcf42('0x55')]['id']};var _0x3f523a={'ContactId':_0x234df0['id'],'SmsAccountId':_0x21cbc3[_0xcf42('0x55')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x3f523a})[_0xcf42('0x37')](function(_0x303c60){if(_0x303c60){return[_0x303c60,![]];}return db[_0xcf42('0xa0')]['create'](_0x5104e9)['then'](function(_0x487cc9){return[_0x487cc9,!![]];});});}})[_0xcf42('0xa1')](function(_0x2e223d,_0x4fea8d){_0xb9f732[_0xcf42('0xa2')]=_0x2e223d['get']({'plain':!![]});_0xb9f732[_0xcf42('0xa2')][_0xcf42('0xa3')]=![];if(_0x4fea8d){if(_0xb9f732[_0xcf42('0x73')][_0xcf42('0xa4')]){_0xb9f732[_0xcf42('0x74')]['push']({'id':0x0,'priority':_0xb9f732[_0xcf42('0x74')][_0xcf42('0x4a')]+0x1,'app':_0xcf42('0xa5'),'appdata':_0xcf42('0xa6'),'interval':_0xcf42('0xa7')});}_0xb9f732[_0xcf42('0xa2')][_0xcf42('0xa3')]=!![];}return db[_0xcf42('0xa8')][_0xcf42('0x59')]({'phone':_0xb9f732['body']['from'],'messageId':_0xb9f732[_0xcf42('0x5a')]['messageId'],'body':_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')],'SmsAccountId':_0x21cbc3['params']['id'],'SmsInteractionId':_0x2e223d['id'],'direction':'in','ContactId':_0x2e223d[_0xcf42('0xa9')],'AttachmentId':_0xb9f732['body'][_0xcf42('0xaa')]});})['then'](function(_0x200b4f){_0xb9f732[_0xcf42('0x2a')]=_0x200b4f;if(_0xb9f732[_0xcf42('0xa2')]['UserId']){return db['User'][_0xcf42('0x58')]({'attributes':['id',_0xcf42('0x3c')],'where':{'id':_0xb9f732[_0xcf42('0xa2')][_0xcf42('0xab')]}})[_0xcf42('0x37')](function(_0x4282ca){if(_0x4282ca){_0xb9f732[_0xcf42('0x74')]['unshift']({'id':0x0,'priority':0x0,'app':_0xcf42('0xac'),'appdata':_0x4282ca[_0xcf42('0x3c')]+','+(_0xb9f732[_0xcf42('0x73')][_0xcf42('0xad')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xcf42('0xae'),_0xb9f732);});}return respondWithRpcPromise(_0xcf42('0xaf'),_0xcf42('0xae'),_0xb9f732);})[_0xcf42('0x37')](function(_0x270210){if(_0x270210){var _0x3f1b49=0xc8;var _0x4a16e1=_0xcf42('0xb0');logger['info'](_0xcf42('0x26'),_0x4a16e1,_0x3f1b49,_0xcf42('0xb1'));logger[_0xcf42('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4a16e1,_0x3f1b49,_0xcf42('0xb1'),JSON['stringify'](_0x270210));if(_0xb9f732[_0xcf42('0x73')][_0xcf42('0x43')]===_0xcf42('0x7f')){return _0x2472b1[_0xcf42('0x2c')](_0x3f1b49)[_0xcf42('0x33')](_0xcf42('0xb2'),'text/xml')['send']('\x0a');}else{return _0x2472b1[_0xcf42('0x2c')](_0x3f1b49)['json'](_0x270210);}}})[_0xcf42('0x2b')](handleError(_0x2472b1,null));};exports[_0xcf42('0xb3')]=function(_0x583538,_0x5083c0){var _0x302563=_0x583538[_0xcf42('0x55')]['id'];var _0x5ad8a8=_0x583538[_0xcf42('0x5a')];var _0x117198=0xc8;var _0x2f20ff=null;return db[_0xcf42('0xb4')][_0xcf42('0xb5')]({'isolationLevel':db[_0xcf42('0xb4')]['Transaction'][_0xcf42('0xb6')]['READ_COMMITTED']},function(_0x3908fc){return db[_0xcf42('0x40')]['findOne']({'where':{'id':_0x302563},'transaction':_0x3908fc})['then'](function(_0x2cf989){if(_0x2cf989){return db[_0xcf42('0x72')][_0xcf42('0x3a')]({'where':{'SmsAccountId':_0x302563},'transaction':_0x3908fc})[_0xcf42('0x37')](function(){var _0x2cd9d8=_['map'](_0x5ad8a8,function(_0x140e12){_0x140e12[_0xcf42('0x6a')]=_0x302563;return _0x140e12;});return db[_0xcf42('0x72')][_0xcf42('0xb7')](_0x2cd9d8,{'transaction':_0x3908fc});});}else{_0x117198=0x194;_0x2f20ff=[];}});})[_0xcf42('0x37')](function(){if(_0x117198!==0x194){return db[_0xcf42('0x72')][_0xcf42('0xb8')]({'where':{'SmsAccountId':_0x302563},'order':'priority'})[_0xcf42('0x37')](function(_0x49d47a){_0x2f20ff=_0x49d47a;});}})[_0xcf42('0x2b')](function(_0xb7aba5){_0x117198=0x1f4;logger[_0xcf42('0x28')](_0xb7aba5[_0xcf42('0x3b')]);if(_0xb7aba5[_0xcf42('0x3c')]){delete _0xb7aba5[_0xcf42('0x3c')];}_0x2f20ff=_0xb7aba5;})[_0xcf42('0xb9')](function(){if(_0x2f20ff===null){_0x5083c0['sendStatus'](_0x117198);}else{if(_0x117198===0x1f4){_0x5083c0['status'](_0x117198)[_0xcf42('0xba')](_0x2f20ff);}else{_0x5083c0['status'](_0x117198)[_0xcf42('0x2e')](_0x2f20ff);}}});};exports['getApplications']=function(_0x56d2b0,_0x34a12e,_0x1de694){var _0x43bfcb={};var _0x377f9b={};var _0x21896a;var _0x250485;return db[_0xcf42('0x40')][_0xcf42('0x66')]({'where':{'id':_0x56d2b0[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x34a12e,null))[_0xcf42('0x37')](function(_0x13e998){if(_0x13e998){_0x21896a=_0x13e998;_0x377f9b['model']=_[_0xcf42('0x46')](db['SmsApplication'][_0xcf42('0x41')]);_0x377f9b['query']=_[_0xcf42('0x46')](_0x56d2b0[_0xcf42('0x45')]);_0x377f9b['filters']=_[_0xcf42('0x48')](_0x377f9b[_0xcf42('0x44')],_0x377f9b[_0xcf42('0x45')]);_0x43bfcb[_0xcf42('0x49')]=_[_0xcf42('0x48')](_0x377f9b[_0xcf42('0x44')],qs[_0xcf42('0x56')](_0x56d2b0[_0xcf42('0x45')][_0xcf42('0x56')]));_0x43bfcb[_0xcf42('0x49')]=_0x43bfcb[_0xcf42('0x49')]['length']?_0x43bfcb[_0xcf42('0x49')]:_0x377f9b[_0xcf42('0x44')];_0x43bfcb[_0xcf42('0x68')]=qs[_0xcf42('0x4c')](_0x56d2b0[_0xcf42('0x45')][_0xcf42('0x4c')]);_0x43bfcb[_0xcf42('0x4d')]=qs[_0xcf42('0x47')](_[_0xcf42('0x69')](_0x56d2b0[_0xcf42('0x45')],_0x377f9b[_0xcf42('0x47')]));if(_0x56d2b0[_0xcf42('0x45')][_0xcf42('0x4e')]){_0x43bfcb[_0xcf42('0x4d')]=_[_0xcf42('0x4f')](_0x43bfcb[_0xcf42('0x4d')],{'$or':_[_0xcf42('0x3f')](_0x43bfcb['attributes'],function(_0x10bd71){var _0x4d8262={};_0x4d8262[_0x10bd71]={'$like':'%'+_0x56d2b0['query'][_0xcf42('0x4e')]+'%'};return _0x4d8262;})});}_0x43bfcb=_['merge']({},_0x43bfcb,_0x56d2b0[_0xcf42('0x50')]);return _0x21896a[_0xcf42('0xbb')](_0x43bfcb);}})[_0xcf42('0x37')](function(_0x4faca0){if(_0x4faca0){_0x250485=_0x4faca0[_0xcf42('0x4a')];if(!_0x56d2b0[_0xcf42('0x45')][_0xcf42('0x4b')]('nolimit')){_0x43bfcb[_0xcf42('0x31')]=qs[_0xcf42('0x31')](_0x56d2b0[_0xcf42('0x45')][_0xcf42('0x31')]);_0x43bfcb[_0xcf42('0x2f')]=qs[_0xcf42('0x2f')](_0x56d2b0[_0xcf42('0x45')][_0xcf42('0x2f')]);}return _0x21896a[_0xcf42('0xbb')](_0x43bfcb);}})['then'](function(_0x3f45ee){if(_0x3f45ee){return _0x3f45ee?{'count':_0x250485,'rows':_0x3f45ee}:null;}})[_0xcf42('0x37')](respondWithResult(_0x34a12e,null))[_0xcf42('0x2b')](handleError(_0x34a12e,null));};exports['getInteractions']=function(_0x3abcf7,_0x5769eb,_0x843d9d){var _0x71accb={'raw':![],'where':{}};var _0x130b0e={};var _0x546d0a={'count':0x0,'rows':[]};return db[_0xcf42('0x40')]['findOne']({'where':{'id':_0x3abcf7[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x5769eb,null))['then'](function(_0x2eab26){if(_0x2eab26){_0x130b0e[_0xcf42('0x44')]=_[_0xcf42('0x46')](db[_0xcf42('0xa0')][_0xcf42('0x41')]);_0x130b0e[_0xcf42('0x45')]=_[_0xcf42('0x46')](_0x3abcf7[_0xcf42('0x45')]);_0x130b0e[_0xcf42('0x47')]=_[_0xcf42('0x48')](_0x130b0e[_0xcf42('0x44')],_0x130b0e['query']);_0x71accb[_0xcf42('0x49')]=_['intersection'](_0x130b0e['model'],qs[_0xcf42('0x56')](_0x3abcf7['query'][_0xcf42('0x56')]));_0x71accb[_0xcf42('0x49')]=_0x71accb[_0xcf42('0x49')][_0xcf42('0x4a')]?_0x71accb[_0xcf42('0x49')]:_0x130b0e[_0xcf42('0x44')];if(!_0x3abcf7['query'][_0xcf42('0x4b')](_0xcf42('0x67'))){_0x71accb[_0xcf42('0x31')]=qs[_0xcf42('0x31')](_0x3abcf7['query'][_0xcf42('0x31')]);_0x71accb[_0xcf42('0x2f')]=qs[_0xcf42('0x2f')](_0x3abcf7[_0xcf42('0x45')][_0xcf42('0x2f')]);}_0x71accb['order']=qs['sort'](_0x3abcf7[_0xcf42('0x45')][_0xcf42('0x4c')]);_0x71accb[_0xcf42('0x4d')]=qs['filters'](_[_0xcf42('0x69')](_0x3abcf7['query'],_0x130b0e['filters']));_0x71accb[_0xcf42('0x4d')][_0xcf42('0x6a')]=_0x2eab26['id'];if(_0x3abcf7['query'][_0xcf42('0x4e')]){_0x71accb[_0xcf42('0x4d')]=_['merge'](_0x71accb['where'],{'$or':_[_0xcf42('0x3f')](_0x71accb[_0xcf42('0x49')],function(_0x1628af){var _0x4ea4b5={};_0x4ea4b5[_0x1628af]={'$like':'%'+_0x3abcf7[_0xcf42('0x45')][_0xcf42('0x4e')]+'%'};return _0x4ea4b5;})});}_0x71accb=_[_0xcf42('0x4f')]({},_0x71accb,_0x3abcf7[_0xcf42('0x50')]);return db[_0xcf42('0xa0')]['count']({'where':_0x71accb[_0xcf42('0x4d')]})[_0xcf42('0x37')](function(_0x42ea69){_0x546d0a[_0xcf42('0x32')]=_0x42ea69;if(_0x3abcf7['query'][_0xcf42('0x51')]){_0x71accb[_0xcf42('0x57')]=[{'model':db['CmContact'],'as':_0xcf42('0xbc'),'required':![]},{'model':db[_0xcf42('0xbd')],'as':'Owner','attributes':[_0xcf42('0x3c'),_0xcf42('0xbe'),_0xcf42('0xbf')],'required':![]},{'model':db[_0xcf42('0xc0')],'as':_0xcf42('0xc1'),'attributes':['id','name',_0xcf42('0xc2')],'where':_0x3abcf7[_0xcf42('0x45')][_0xcf42('0xc3')]?{'id':_0x3abcf7['query'][_0xcf42('0xc3')]}:undefined,'required':_0x3abcf7[_0xcf42('0x45')]['tag']?!![]:![]}];}return db[_0xcf42('0xa0')][_0xcf42('0x52')](_0x71accb);})['then'](function(_0x4f9252){_0x546d0a[_0xcf42('0x53')]=_0x4f9252;return _0x546d0a;});}})[_0xcf42('0x37')](respondWithFilteredResult(_0x5769eb,_0x71accb))['catch'](handleError(_0x5769eb,null));};exports[_0xcf42('0xba')]=function(_0x26ba8d,_0x7cd9d5,_0x14d261){var _0x5207e6,_0x52c3f2,_0x422e52;if(_['isNil'](_0x26ba8d[_0xcf42('0x5a')][_0xcf42('0x5a')])||_0x26ba8d[_0xcf42('0x5a')]['body']===''){throw new db[(_0xcf42('0x94'))][(_0xcf42('0x79'))](_0xcf42('0x96'));}if(_[_0xcf42('0x95')](_0x26ba8d[_0xcf42('0x5a')]['to'])){throw new db[(_0xcf42('0x94'))]['ValidationError'](_0xcf42('0xc4'));}_0x5207e6=_0x26ba8d[_0xcf42('0x5a')]['to'];return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x26ba8d[_0xcf42('0x55')]['id']},'include':[{'model':db[_0xcf42('0x9b')],'as':_0xcf42('0xc5'),'include':[{'model':db[_0xcf42('0x78')],'as':_0xcf42('0x9c'),'where':{'mobile':_0x5207e6},'limit':0x1,'order':[[_0xcf42('0x7c'),'DESC']]}]}]})[_0xcf42('0x37')](handleEntityNotFound(_0x7cd9d5,null))['then'](function(_0x5613a9){if(_0x5613a9&&_0x5613a9[_0xcf42('0xc5')]){_0x52c3f2=_0x5613a9[_0xcf42('0x38')]({'plain':!![]});if(_0x52c3f2[_0xcf42('0xc5')]&&_0x52c3f2[_0xcf42('0xc5')][_0xcf42('0x9c')][_0xcf42('0x4a')]){return _0x52c3f2[_0xcf42('0xc5')][_0xcf42('0x9c')][0x0];}return db[_0xcf42('0x78')][_0xcf42('0x59')](_[_0xcf42('0x1c')](_0x26ba8d['body'],{'firstName':_0x5207e6,'mobile':_0x5207e6,'phone':_0x5207e6,'ListId':_0x52c3f2['ListId']}));}})[_0xcf42('0x37')](handleEntityNotFound(_0x7cd9d5,null))[_0xcf42('0x37')](function(_0x23c828){if(_0x23c828){_0x422e52=_0x23c828;return db[_0xcf42('0xa0')][_0xcf42('0x58')]({'where':{'ContactId':_0x422e52['id'],'closed':![],'SmsAccountId':_0x52c3f2['id']}})[_0xcf42('0x37')](function(_0x446e1b){if(_0x446e1b){return[_0x446e1b,![]];}return db[_0xcf42('0xa0')][_0xcf42('0x59')]({'UserId':_0x26ba8d[_0xcf42('0x5d')]['id'],'ContactId':_0x422e52['id'],'SmsAccountId':_0x52c3f2['id'],'phone':_0x5207e6,'firstMsgDirection':_0xcf42('0xc6'),'Messages':[_[_0xcf42('0x4f')](_0x26ba8d['body'],{'read':![],'body':_0x26ba8d[_0xcf42('0x5a')][_0xcf42('0x5a')],'phone':_0x5207e6,'SmsAccountId':_0x52c3f2['id'],'UserId':_0x26ba8d[_0xcf42('0x5d')]['id'],'ContactId':_0x422e52['id']})]},{'include':[{'model':db[_0xcf42('0xa8')],'as':_0xcf42('0xc7')}]})[_0xcf42('0x37')](function(_0x1c5410){return[_0x1c5410,!![]];});});}})[_0xcf42('0xa1')](function(_0xc3952a,_0x314643){if(_0x314643){return _0xc3952a;}return db['SmsMessage'][_0xcf42('0x59')](_[_0xcf42('0x4f')](_0x26ba8d[_0xcf42('0x5a')],{'read':![],'body':_0x26ba8d[_0xcf42('0x5a')][_0xcf42('0x5a')],'phone':_0x5207e6,'SmsAccountId':_0x52c3f2['id'],'SmsInteractionId':_0xc3952a['id'],'UserId':_0x26ba8d['user']['id'],'ContactId':_0x422e52['id']}))[_0xcf42('0x37')](function(_0x1c5200){_0xc3952a[_0xcf42('0xc8')][_0xcf42('0xc7')]=[];_0xc3952a[_0xcf42('0xc8')][_0xcf42('0xc7')][_0xcf42('0xc9')](_0x1c5200['dataValues']);return _0xc3952a;});})['then'](respondWithResult(_0x7cd9d5,null))[_0xcf42('0x2b')](handleError(_0x7cd9d5,null));};exports[_0xcf42('0x2c')]=function(_0x388953,_0x48a8e5,_0x422523){if(_0x388953[_0xcf42('0x5a')]['id']){delete _0x388953[_0xcf42('0x5a')]['id'];}var _0x3a1701,_0x44f92f,_0x14d617;return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x388953[_0xcf42('0x55')]['id']}})['then'](handleEntityNotFound(_0x48a8e5,null))['then'](function(_0xc3750a){if(_0xc3750a){_0x14d617=_0xc3750a;logger[_0xcf42('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcf42('0x2c'),_0xcf42('0xca'),_0xc3750a[_0xcf42('0x43')],util[_0xcf42('0xcb')](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));switch(_0xc3750a['type']){case _0xcf42('0x84'):if(_0x388953['body'][_0xcf42('0xcc')]&&_0x388953[_0xcf42('0x5a')]['status']){_0x44f92f=_0x388953[_0xcf42('0x5a')]['status'];return db['SmsMessage'][_0xcf42('0x58')]({'where':{'messageId':_0x388953[_0xcf42('0x5a')][_0xcf42('0xcc')]}});}break;case _0xcf42('0x88'):if(_0x388953[_0xcf42('0x5a')][_0xcf42('0xcd')]&&_0x388953[_0xcf42('0x5a')][_0xcf42('0xce')]){_0x44f92f=_0x388953['body']['statusInt'];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x388953[_0xcf42('0x5a')]['requestid']}});}break;case _0xcf42('0x89'):if(_0x388953[_0xcf42('0x5a')][_0xcf42('0x8a')]&&_0x388953[_0xcf42('0x5a')][_0xcf42('0xcf')]){_0x44f92f=_0x388953['body']['status_code'];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x388953[_0xcf42('0x5a')][_0xcf42('0x8a')]}});}break;case'infobip':var _0x1a4d26=_0x388953[_0xcf42('0x5a')][_0xcf42('0x8c')][0x0];if(_0x1a4d26[_0xcf42('0x82')]&&_0x1a4d26[_0xcf42('0x2c')][_0xcf42('0xd0')]===_0xcf42('0xd1')){_0x44f92f=_0x1a4d26[_0xcf42('0x2c')][_0xcf42('0xd0')];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x1a4d26['messageId']}});}break;case _0xcf42('0xd2'):if(_0x388953['body'][_0xcf42('0x82')]&&_0x388953[_0xcf42('0x5a')][_0xcf42('0x2c')]){_0x44f92f=_0x388953[_0xcf42('0x5a')][_0xcf42('0x2c')];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x388953[_0xcf42('0x5a')][_0xcf42('0x82')]}});}break;case _0xcf42('0x92'):if(_0x388953[_0xcf42('0x5a')][0x0][_0xcf42('0x2a')]['id']){_0x44f92f=_0x388953[_0xcf42('0x5a')][0x0][_0xcf42('0x43')];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x388953[_0xcf42('0x5a')][0x0][_0xcf42('0x2a')]['id']}});}break;case _0xcf42('0x93'):if(_0x388953['body'][_0xcf42('0xd3')]&&_0x388953[_0xcf42('0x5a')][_0xcf42('0x2c')]){_0x44f92f=_0x388953[_0xcf42('0x5a')]['status'];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x388953[_0xcf42('0x5a')][_0xcf42('0xd3')]}});}break;}}})[_0xcf42('0x37')](handleEntityNotFound(_0x48a8e5,null))[_0xcf42('0x37')](function(_0x5ca913){if(_0x5ca913){_0x3a1701=_0x5ca913;switch(_0x14d617[_0xcf42('0x43')]){case'skebby':if(_0x44f92f==='DELIVERED'){return _0x3a1701[_0xcf42('0x61')]({'read':!![]});}else{logger[_0xcf42('0x28')](_0xcf42('0x26'),_0xcf42('0x2c'),_0xcf42('0x84'),util[_0xcf42('0xcb')](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x44f92f==='1'){return _0x3a1701['update']({'read':!![]});}else{logger[_0xcf42('0x28')](_0xcf42('0x26'),_0xcf42('0x2c'),_0xcf42('0x84'),util['inspect'](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xcf42('0x89'):if(!_0x388953[_0xcf42('0x5a')]['error_code']&&_0x44f92f>=0xc8&&_0x44f92f<=0xce){return _0x3a1701[_0xcf42('0x61')]({'read':!![]});}else{logger[_0xcf42('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcf42('0x2c'),_0xcf42('0x89'),util[_0xcf42('0xcb')](_0x388953['body'],{'showHidden':![],'depth':null}));}break;case _0xcf42('0xd4'):var _0x15b858=_0x388953['body']['results'][0x0];if(_0x15b858[_0xcf42('0x2c')][_0xcf42('0xd0')]===_0xcf42('0xd1')){return _0x3a1701['update']({'read':!![]});}else{logger[_0xcf42('0x28')](_0xcf42('0x26'),_0xcf42('0x2c'),_0xcf42('0xd4'),util[_0xcf42('0xcb')](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xcf42('0xd2'):if(_0x44f92f==_0xcf42('0xd5')||_0x44f92f==_0xcf42('0xd6')){return _0x3a1701['update']({'read':!![]});}else{logger[_0xcf42('0x28')](_0xcf42('0x26'),_0xcf42('0x2c'),_0xcf42('0xd2'),util[_0xcf42('0xcb')](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xcf42('0x92'):if(_0x44f92f=='message-delivered'){return _0x3a1701['update']({'read':!![]});}else{logger['error'](_0xcf42('0x26'),_0xcf42('0x2c'),_0xcf42('0x92'),util['inspect'](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xcf42('0x93'):if(_0x44f92f===_0xcf42('0xd7')||_0x44f92f===_0xcf42('0xd8')){return _0x3a1701[_0xcf42('0x61')]({'read':!![]});}else{logger[_0xcf42('0x28')](_0xcf42('0x26'),'status',_0xcf42('0x93'),util[_0xcf42('0xcb')](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x3a1701;}})[_0xcf42('0x37')](respondWithResult(_0x48a8e5,null))[_0xcf42('0x2b')](handleError(_0x48a8e5,null));};exports[_0xcf42('0xd9')]=function(_0x586ac0,_0x1631b6,_0x1e71e7){var _0x5c1902,_0x46f054,_0x36849b;return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x586ac0[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x1631b6,null))[_0xcf42('0x37')](function(_0xa9e48c){if(_0xa9e48c){_0x36849b=_0xa9e48c;logger[_0xcf42('0x25')](_0xcf42('0x26'),_0xcf42('0x2c'),'received\x20delivery\x20report\x20from',_0xa9e48c[_0xcf42('0x43')],util[_0xcf42('0xcb')](_0x586ac0[_0xcf42('0x45')],{'showHidden':![],'depth':null}));switch(_0xa9e48c['type']){case _0xcf42('0x8d'):if(_0x586ac0[_0xcf42('0x45')]['message-id']&&_0x586ac0[_0xcf42('0x45')][_0xcf42('0xda')]){_0x46f054=_0x586ac0[_0xcf42('0x45')][_0xcf42('0xda')];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x586ac0[_0xcf42('0x45')]['message-id']}});}break;}}})[_0xcf42('0x37')](handleEntityNotFound(_0x1631b6,null))[_0xcf42('0x37')](function(_0x563eba){if(_0x563eba){_0x5c1902=_0x563eba;switch(_0x36849b[_0xcf42('0x43')]){case _0xcf42('0x8d'):if(_0x46f054==='2'||_0x46f054==='6'){return _0x5c1902[_0xcf42('0x61')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xcf42('0x8d'),util[_0xcf42('0xcb')](_0x586ac0['query'],{'showHidden':![],'depth':null}));};break;}return _0x5c1902;}})[_0xcf42('0x37')](respondWithResult(_0x1631b6,null))[_0xcf42('0x2b')](handleError(_0x1631b6,null));};exports[_0xcf42('0xdb')]=function(_0x5eb3d9,_0x277b7a,_0x36d012){return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x5eb3d9[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x277b7a,null))['then'](function(_0x3fa36b){if(_0x3fa36b){return _0x3fa36b[_0xcf42('0xdb')](_0x5eb3d9[_0xcf42('0x5a')][_0xcf42('0x6c')],_[_0xcf42('0x9e')](_0x5eb3d9[_0xcf42('0x5a')],['ids','id'])||{})[_0xcf42('0xa1')](function(_0x48409b){for(var _0x3dc6a1=0x0;_0x3dc6a1<_0x5eb3d9[_0xcf42('0x5a')]['ids'][_0xcf42('0x4a')];_0x3dc6a1+=0x1){socket[_0xcf42('0xdc')](_0xcf42('0xdd'),{'UserId':Number(_0x5eb3d9[_0xcf42('0x5a')][_0xcf42('0x6c')][_0x3dc6a1]),'SmsAccountId':Number(_0x5eb3d9[_0xcf42('0x55')]['id'])});}return _0x48409b;});}})[_0xcf42('0x37')](respondWithResult(_0x277b7a,null))['catch'](handleError(_0x277b7a,null));};exports['removeAgents']=function(_0x481b3b,_0x5ae993,_0x31409e){return db['SmsAccount'][_0xcf42('0x58')]({'where':{'id':_0x481b3b[_0xcf42('0x55')]['id']}})['then'](handleEntityNotFound(_0x5ae993,null))[_0xcf42('0x37')](function(_0x58dd30){if(_0x58dd30){return _0x58dd30[_0xcf42('0xde')](_0x481b3b[_0xcf42('0x45')]['ids'])['then'](function(){if(_[_0xcf42('0xdf')](_0x481b3b[_0xcf42('0x45')][_0xcf42('0x6c')])){for(var _0x271731=0x0;_0x271731<_0x481b3b[_0xcf42('0x45')][_0xcf42('0x6c')][_0xcf42('0x4a')];_0x271731+=0x1){socket['emit'](_0xcf42('0xe0'),{'UserId':Number(_0x481b3b[_0xcf42('0x45')]['ids'][_0x271731]),'SmsAccountId':Number(_0x481b3b[_0xcf42('0x55')]['id'])});}}else{socket[_0xcf42('0xdc')](_0xcf42('0xe0'),{'UserId':Number(_0x481b3b[_0xcf42('0x45')][_0xcf42('0x6c')]),'SmsAccountId':Number(_0x481b3b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5ae993,null))[_0xcf42('0x2b')](handleError(_0x5ae993,null));};exports[_0xcf42('0xe1')]=function(_0x25a201,_0x1f4f61,_0x2743e4){var _0x379c0c={};var _0x46e20e={};var _0x3eab73;var _0x4054fe;return db[_0xcf42('0x40')][_0xcf42('0x66')]({'where':{'id':_0x25a201[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x1f4f61,null))[_0xcf42('0x37')](function(_0x3b60aa){if(_0x3b60aa){_0x3eab73=_0x3b60aa;_0x46e20e[_0xcf42('0x44')]=_['keys'](db[_0xcf42('0xbd')][_0xcf42('0x41')]);_0x46e20e[_0xcf42('0x45')]=_[_0xcf42('0x46')](_0x25a201['query']);_0x46e20e[_0xcf42('0x47')]=_['intersection'](_0x46e20e[_0xcf42('0x44')],_0x46e20e['query']);_0x379c0c[_0xcf42('0x49')]=_[_0xcf42('0x48')](_0x46e20e[_0xcf42('0x44')],qs[_0xcf42('0x56')](_0x25a201[_0xcf42('0x45')][_0xcf42('0x56')]));_0x379c0c[_0xcf42('0x49')]=_0x379c0c['attributes'][_0xcf42('0x4a')]?_0x379c0c[_0xcf42('0x49')]:_0x46e20e[_0xcf42('0x44')];_0x379c0c[_0xcf42('0x68')]=qs[_0xcf42('0x4c')](_0x25a201['query'][_0xcf42('0x4c')]);_0x379c0c[_0xcf42('0x4d')]=qs[_0xcf42('0x47')](_[_0xcf42('0x69')](_0x25a201['query'],_0x46e20e[_0xcf42('0x47')]));if(_0x25a201['query'][_0xcf42('0x4e')]){_0x379c0c['where']=_[_0xcf42('0x4f')](_0x379c0c[_0xcf42('0x4d')],{'$or':_['map'](_0x379c0c[_0xcf42('0x49')],function(_0x3b6c37){var _0x41fc27={};_0x41fc27[_0x3b6c37]={'$like':'%'+_0x25a201[_0xcf42('0x45')][_0xcf42('0x4e')]+'%'};return _0x41fc27;})});}_0x379c0c=_['merge']({},_0x379c0c,_0x25a201[_0xcf42('0x50')]);return _0x3eab73[_0xcf42('0xe1')](_0x379c0c);}})[_0xcf42('0x37')](function(_0x42ddca){if(_0x42ddca){_0x4054fe=_0x42ddca['length'];if(!_0x25a201[_0xcf42('0x45')][_0xcf42('0x4b')](_0xcf42('0x67'))){_0x379c0c['limit']=qs['limit'](_0x25a201[_0xcf42('0x45')][_0xcf42('0x31')]);_0x379c0c[_0xcf42('0x2f')]=qs['offset'](_0x25a201[_0xcf42('0x45')][_0xcf42('0x2f')]);}return _0x3eab73[_0xcf42('0xe1')](_0x379c0c);}})[_0xcf42('0x37')](function(_0xe8a62f){if(_0xe8a62f){return _0xe8a62f?{'count':_0x4054fe,'rows':_0xe8a62f}:null;}})[_0xcf42('0x37')](respondWithResult(_0x1f4f61,null))['catch'](handleError(_0x1f4f61,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 9a7b5d2..d449d31 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 _0x5787=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','save','remove'];(function(_0x4ad4ab,_0x2cf84a){var _0x104b07=function(_0x26dbf5){while(--_0x26dbf5){_0x4ad4ab['push'](_0x4ad4ab['shift']());}};_0x104b07(++_0x2cf84a);}(_0x5787,0x1f3));var _0x7578=function(_0x2b0ccc,_0x2d6371){_0x2b0ccc=_0x2b0ccc-0x0;var _0x1fea1b=_0x5787[_0x2b0ccc];return _0x1fea1b;};'use strict';var EventEmitter=require(_0x7578('0x0'));var SmsAccount=require(_0x7578('0x1'))['db'][_0x7578('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7578('0x3'),'afterUpdate':'update','afterDestroy':_0x7578('0x4')};function emitEvent(_0x5532e9){return function(_0x202e97,_0x509429,_0x2bfa31){SmsAccountEvents[_0x7578('0x5')](_0x5532e9+':'+_0x202e97['id'],_0x202e97);SmsAccountEvents['emit'](_0x5532e9,_0x202e97);_0x2bfa31(null);};}for(var e in events){if(events[_0x7578('0x6')](e)){var event=events[e];SmsAccount[_0x7578('0x7')](e,emitEvent(event));}}module[_0x7578('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x9df1=['remove','emit','events','SmsAccount','setMaxListeners','save','update'];(function(_0x992616,_0x237351){var _0x1fe0f5=function(_0x4c5e06){while(--_0x4c5e06){_0x992616['push'](_0x992616['shift']());}};_0x1fe0f5(++_0x237351);}(_0x9df1,0x1a6));var _0x19df=function(_0x18e403,_0x2bbc79){_0x18e403=_0x18e403-0x0;var _0x4dbca8=_0x9df1[_0x18e403];return _0x4dbca8;};'use strict';var EventEmitter=require(_0x19df('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x19df('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x19df('0x2')](0x0);var events={'afterCreate':_0x19df('0x3'),'afterUpdate':_0x19df('0x4'),'afterDestroy':_0x19df('0x5')};function emitEvent(_0x548b6a){return function(_0x2d0d0e,_0x3b7ce4,_0x658137){SmsAccountEvents[_0x19df('0x6')](_0x548b6a+':'+_0x2d0d0e['id'],_0x2d0d0e);SmsAccountEvents[_0x19df('0x6')](_0x548b6a,_0x2d0d0e);_0x658137(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 7327a82..a2025bc 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 _0x0484=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','define','SmsAccount','sms_accounts'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x0484,0x1ce));var _0x4048=function(_0x463331,_0x529b64){_0x463331=_0x463331-0x0;var _0x156fd1=_0x0484[_0x463331];return _0x156fd1;};'use strict';var _=require(_0x4048('0x0'));var util=require(_0x4048('0x1'));var logger=require(_0x4048('0x2'))(_0x4048('0x3'));var moment=require(_0x4048('0x4'));var BPromise=require(_0x4048('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4048('0x6'));var rimraf=require(_0x4048('0x7'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module['exports']=function(_0x10b7ec,_0x12e7ce){return _0x10b7ec[_0x4048('0x8')](_0x4048('0x9'),attributes,{'tableName':_0x4048('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6ac=['./smsAccount.attributes','exports','define','sms_accounts','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1ea5a5,_0x22e0d9){var _0x317464=function(_0x1cc220){while(--_0x1cc220){_0x1ea5a5['push'](_0x1ea5a5['shift']());}};_0x317464(++_0x22e0d9);}(_0xd6ac,0x1c7));var _0xcd6a=function(_0x173dec,_0x4e1613){_0x173dec=_0x173dec-0x0;var _0x99b13b=_0xd6ac[_0x173dec];return _0x99b13b;};'use strict';var _=require(_0xcd6a('0x0'));var util=require(_0xcd6a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcd6a('0x2'));var BPromise=require(_0xcd6a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd6a('0x4'));var rimraf=require(_0xcd6a('0x5'));var config=require(_0xcd6a('0x6'));var attributes=require(_0xcd6a('0x7'));module[_0xcd6a('0x8')]=function(_0xf8ab0d,_0xda72e){return _0xf8ab0d[_0xcd6a('0x9')]('SmsAccount',attributes,{'tableName':_0xcd6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 66f8457..bfcf2c2 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 _0x418a=['info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','request\x20sent','result','catch','ShowSmsAccount','find','raw','where','options','attributes','include','map','model','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then'];(function(_0x20eca8,_0x5cf63f){var _0x1dd774=function(_0x85e754){while(--_0x85e754){_0x20eca8['push'](_0x20eca8['shift']());}};_0x1dd774(++_0x5cf63f);}(_0x418a,0x1d0));var _0xa418=function(_0xc3b473,_0x25d929){_0xc3b473=_0xc3b473-0x0;var _0x1fa818=_0x418a[_0xc3b473];return _0x1fa818;};'use strict';var _=require(_0xa418('0x0'));var util=require(_0xa418('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa418('0x2'));var fs=require('fs');var Redis=require(_0xa418('0x3'));var db=require(_0xa418('0x4'))['db'];var utils=require(_0xa418('0x5'));var logger=require(_0xa418('0x6'))(_0xa418('0x7'));var config=require(_0xa418('0x8'));var jayson=require(_0xa418('0x9'));var client=jayson['client'][_0xa418('0xa')]({'port':0x232a});config[_0xa418('0xb')]=_[_0xa418('0xc')](config['redis'],{'host':_0xa418('0xd'),'port':0x18eb});var socket=require(_0xa418('0xe'))(new Redis(config[_0xa418('0xb')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x447b61,_0xca200d,_0x201ac7){return new BPromise(function(_0x3ac4fb,_0x36ccbe){return client[_0xa418('0xf')](_0x447b61,_0x201ac7)[_0xa418('0x10')](function(_0x3aa979){logger[_0xa418('0x11')]('SmsAccount,\x20%s,\x20%s',_0xca200d,'request\x20sent');logger[_0xa418('0x12')](_0xa418('0x13'),_0xca200d,'request\x20sent',JSON[_0xa418('0x14')](_0x3aa979));if(_0x3aa979[_0xa418('0x15')]){if(_0x3aa979[_0xa418('0x15')][_0xa418('0x16')]===0x1f4){logger[_0xa418('0x15')]('SmsAccount,\x20%s,\x20%s',_0xca200d,_0x3aa979[_0xa418('0x15')][_0xa418('0x17')]);return _0x36ccbe(_0x3aa979[_0xa418('0x15')][_0xa418('0x17')]);}logger[_0xa418('0x15')](_0xa418('0x18'),_0xca200d,_0x3aa979['error'][_0xa418('0x17')]);return _0x3ac4fb(_0x3aa979['error'][_0xa418('0x17')]);}else{logger[_0xa418('0x11')](_0xa418('0x18'),_0xca200d,_0xa418('0x19'));_0x3ac4fb(_0x3aa979[_0xa418('0x1a')][_0xa418('0x17')]);}})[_0xa418('0x1b')](function(_0x34d58d){logger[_0xa418('0x15')](_0xa418('0x18'),_0xca200d,_0x34d58d);_0x36ccbe(_0x34d58d);});});}exports[_0xa418('0x1c')]=function(_0x589dc4){var _0x3c68f5=this;return new Promise(function(_0x405b34,_0x5c3b85){return db['SmsAccount'][_0xa418('0x1d')]({'raw':_0x589dc4['options']?_0x589dc4['options'][_0xa418('0x1e')]===undefined?!![]:![]:!![],'where':_0x589dc4['options']?_0x589dc4['options'][_0xa418('0x1f')]||null:null,'attributes':_0x589dc4[_0xa418('0x20')]?_0x589dc4[_0xa418('0x20')][_0xa418('0x21')]||null:null,'include':_0x589dc4[_0xa418('0x20')]?_0x589dc4[_0xa418('0x20')][_0xa418('0x22')]?_[_0xa418('0x23')](_0x589dc4[_0xa418('0x20')][_0xa418('0x22')],function(_0x42e0eb){return{'model':db[_0x42e0eb[_0xa418('0x24')]],'as':_0x42e0eb['as'],'attributes':_0x42e0eb[_0xa418('0x21')],'include':_0x42e0eb[_0xa418('0x22')]?_[_0xa418('0x23')](_0x42e0eb[_0xa418('0x22')],function(_0x453b09){return{'model':db[_0x453b09[_0xa418('0x24')]],'as':_0x453b09['as'],'attributes':_0x453b09[_0xa418('0x21')],'include':_0x453b09[_0xa418('0x22')]?_[_0xa418('0x23')](_0x453b09[_0xa418('0x22')],function(_0x572a0a){return{'model':db[_0x572a0a[_0xa418('0x24')]],'as':_0x572a0a['as'],'attributes':_0x572a0a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa418('0x10')](function(_0x3e6650){logger['info'](_0xa418('0x1c'),_0x589dc4);logger[_0xa418('0x12')](_0xa418('0x1c'),_0x589dc4,JSON[_0xa418('0x14')](_0x3e6650));_0x405b34(_0x3e6650);})[_0xa418('0x1b')](function(_0x4272c4){logger[_0xa418('0x15')](_0xa418('0x1c'),_0x4272c4[_0xa418('0x17')],_0x589dc4);_0x5c3b85(_0x3c68f5[_0xa418('0x15')](0x1f4,_0x4272c4[_0xa418('0x17')]));});});}; \ No newline at end of file +var _0x501f=['message','SmsAccount,\x20%s,\x20%s','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x8c0bf5,_0x2456ab){var _0x447387=function(_0x4c2469){while(--_0x4c2469){_0x8c0bf5['push'](_0x8c0bf5['shift']());}};_0x447387(++_0x2456ab);}(_0x501f,0xa2));var _0xf501=function(_0x3ebc72,_0x5f14de){_0x3ebc72=_0x3ebc72-0x0;var _0x562eb8=_0x501f[_0x3ebc72];return _0x562eb8;};'use strict';var _=require(_0xf501('0x0'));var util=require(_0xf501('0x1'));var moment=require(_0xf501('0x2'));var BPromise=require(_0xf501('0x3'));var rs=require(_0xf501('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf501('0x5'));var logger=require(_0xf501('0x6'))('rpc');var config=require(_0xf501('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf501('0x8')]({'port':0x232a});config[_0xf501('0x9')]=_[_0xf501('0xa')](config[_0xf501('0x9')],{'host':_0xf501('0xb'),'port':0x18eb});var socket=require(_0xf501('0xc'))(new Redis(config[_0xf501('0x9')]));require(_0xf501('0xd'))[_0xf501('0xe')](socket);function respondWithRpcPromise(_0x541280,_0x1ecce2,_0x30afdd){return new BPromise(function(_0x212c83,_0x4689b6){return client[_0xf501('0xf')](_0x541280,_0x30afdd)[_0xf501('0x10')](function(_0x1521c1){logger[_0xf501('0x11')]('SmsAccount,\x20%s,\x20%s',_0x1ecce2,_0xf501('0x12'));logger['debug'](_0xf501('0x13'),_0x1ecce2,_0xf501('0x12'),JSON[_0xf501('0x14')](_0x1521c1));if(_0x1521c1[_0xf501('0x15')]){if(_0x1521c1[_0xf501('0x15')][_0xf501('0x16')]===0x1f4){logger[_0xf501('0x15')]('SmsAccount,\x20%s,\x20%s',_0x1ecce2,_0x1521c1[_0xf501('0x15')][_0xf501('0x17')]);return _0x4689b6(_0x1521c1['error']['message']);}logger[_0xf501('0x15')](_0xf501('0x18'),_0x1ecce2,_0x1521c1['error'][_0xf501('0x17')]);return _0x212c83(_0x1521c1[_0xf501('0x15')][_0xf501('0x17')]);}else{logger[_0xf501('0x11')]('SmsAccount,\x20%s,\x20%s',_0x1ecce2,_0xf501('0x12'));_0x212c83(_0x1521c1['result'][_0xf501('0x17')]);}})[_0xf501('0x19')](function(_0x793042){logger[_0xf501('0x15')](_0xf501('0x18'),_0x1ecce2,_0x793042);_0x4689b6(_0x793042);});});}exports[_0xf501('0x1a')]=function(_0x36178b){var _0x516f67=this;return new Promise(function(_0x7f4448,_0x755eba){return db[_0xf501('0x1b')][_0xf501('0x1c')]({'raw':_0x36178b[_0xf501('0x1d')]?_0x36178b[_0xf501('0x1d')][_0xf501('0x1e')]===undefined?!![]:![]:!![],'where':_0x36178b[_0xf501('0x1d')]?_0x36178b[_0xf501('0x1d')][_0xf501('0x1f')]||null:null,'attributes':_0x36178b['options']?_0x36178b['options'][_0xf501('0x20')]||null:null,'include':_0x36178b[_0xf501('0x1d')]?_0x36178b['options'][_0xf501('0x21')]?_['map'](_0x36178b[_0xf501('0x1d')]['include'],function(_0x1fe3d5){return{'model':db[_0x1fe3d5[_0xf501('0x22')]],'as':_0x1fe3d5['as'],'attributes':_0x1fe3d5[_0xf501('0x20')],'include':_0x1fe3d5[_0xf501('0x21')]?_[_0xf501('0x23')](_0x1fe3d5[_0xf501('0x21')],function(_0x308784){return{'model':db[_0x308784[_0xf501('0x22')]],'as':_0x308784['as'],'attributes':_0x308784[_0xf501('0x20')],'include':_0x308784[_0xf501('0x21')]?_['map'](_0x308784[_0xf501('0x21')],function(_0x3b9800){return{'model':db[_0x3b9800[_0xf501('0x22')]],'as':_0x3b9800['as'],'attributes':_0x3b9800['attributes']};}):[]};}):[]};}):[]:[]})[_0xf501('0x10')](function(_0x4bd131){logger[_0xf501('0x11')](_0xf501('0x1a'),_0x36178b);logger[_0xf501('0x24')](_0xf501('0x1a'),_0x36178b,JSON['stringify'](_0x4bd131));_0x7f4448(_0x4bd131);})[_0xf501('0x19')](function(_0x522153){logger[_0xf501('0x15')]('ShowSmsAccount',_0x522153['message'],_0x36178b);_0x755eba(_0x516f67[_0xf501('0x15')](0x1f4,_0x522153[_0xf501('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 82457e6..f97320a 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 98c1723..e503406 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x395aa5,_0x12eb4c){var _0x53f4ac=function(_0x2d80da){while(--_0x2d80da){_0x395aa5['push'](_0x395aa5['shift']());}};_0x53f4ac(++_0x12eb4c);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x474c00,_0x26d9c4){var _0x593bce=function(_0x3103ae){while(--_0x3103ae){_0x474c00['push'](_0x474c00['shift']());}};_0x593bce(++_0x26d9c4);}(_0xedd9,0xfc));var _0x9edd=function(_0x339d0a,_0x152d67){_0x339d0a=_0x339d0a-0x0;var _0x7f1818=_0xedd9[_0x339d0a];return _0x7f1818;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index d0db57c..7cf1ce3 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 _0xf709=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3fa1c7,_0x13d816){var _0x21e45d=function(_0x390c64){while(--_0x390c64){_0x3fa1c7['push'](_0x3fa1c7['shift']());}};_0x21e45d(++_0x13d816);}(_0xf709,0x18e));var _0x9f70=function(_0x544036,_0x4b17c7){_0x544036=_0x544036-0x0;var _0x5a53d1=_0xf709[_0x544036];return _0x5a53d1;};'use strict';var Sequelize=require(_0x9f70('0x0'));module[_0x9f70('0x1')]={'priority':{'type':Sequelize[_0x9f70('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9f70('0x3')],'allowNull':![],'defaultValue':_0x9f70('0x4')},'appdata':{'type':Sequelize[_0x9f70('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9f70('0x3')],'defaultValue':_0x9f70('0x6')}}; \ No newline at end of file +var _0xdd94=['*,*,*,*','sequelize','exports','noop','STRING'];(function(_0x11263d,_0x2a5701){var _0x850a0d=function(_0x307832){while(--_0x307832){_0x11263d['push'](_0x11263d['shift']());}};_0x850a0d(++_0x2a5701);}(_0xdd94,0x1c8));var _0x4dd9=function(_0x1bc32c,_0x5d267e){_0x1bc32c=_0x1bc32c-0x0;var _0x380aeb=_0xdd94[_0x1bc32c];return _0x380aeb;};'use strict';var Sequelize=require(_0x4dd9('0x0'));module[_0x4dd9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4dd9('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4dd9('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4dd9('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 2ff175d..5f13ae8 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 _0x633f=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','status','name','index','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','SmsApplication','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x15e098,_0x539cfc){var _0x2ab697=function(_0x53a216){while(--_0x53a216){_0x15e098['push'](_0x15e098['shift']());}};_0x2ab697(++_0x539cfc);}(_0x633f,0x1c0));var _0xf633=function(_0x4e9f9f,_0x1f5c62){_0x4e9f9f=_0x4e9f9f-0x0;var _0x5ada14=_0x633f[_0x4e9f9f];return _0x5ada14;};'use strict';var emlformat=require(_0xf633('0x0'));var rimraf=require(_0xf633('0x1'));var zipdir=require(_0xf633('0x2'));var jsonpatch=require(_0xf633('0x3'));var rp=require(_0xf633('0x4'));var moment=require(_0xf633('0x5'));var BPromise=require(_0xf633('0x6'));var Mustache=require(_0xf633('0x7'));var util=require('util');var path=require(_0xf633('0x8'));var sox=require(_0xf633('0x9'));var csv=require(_0xf633('0xa'));var ejs=require(_0xf633('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf633('0xc'));var squel=require(_0xf633('0xd'));var crypto=require(_0xf633('0xe'));var jsforce=require(_0xf633('0xf'));var deskjs=require(_0xf633('0x10'));var toCsv=require(_0xf633('0xa'));var querystring=require(_0xf633('0x11'));var Papa=require(_0xf633('0x12'));var Redis=require(_0xf633('0x13'));var authService=require(_0xf633('0x14'));var qs=require(_0xf633('0x15'));var as=require(_0xf633('0x16'));var hardwareService=require(_0xf633('0x17'));var logger=require(_0xf633('0x18'))(_0xf633('0x19'));var utils=require('../../config/utils');var config=require(_0xf633('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf633('0x1b'))['db'];function respondWithStatusCode(_0x42f6b8,_0x5c84a4){_0x5c84a4=_0x5c84a4||0xcc;return function(_0x5bb3a5){if(_0x5bb3a5){return _0x42f6b8[_0xf633('0x1c')](_0x5c84a4);}return _0x42f6b8['status'](_0x5c84a4)[_0xf633('0x1d')]();};}function respondWithResult(_0xff14a3,_0x1a70b8){_0x1a70b8=_0x1a70b8||0xc8;return function(_0x369ed2){if(_0x369ed2){return _0xff14a3['status'](_0x1a70b8)[_0xf633('0x1e')](_0x369ed2);}};}function respondWithFilteredResult(_0x5983d5,_0x276198){return function(_0x2492d8){if(_0x2492d8){var _0x4c9a75=typeof _0x276198[_0xf633('0x1f')]===_0xf633('0x20')&&typeof _0x276198[_0xf633('0x21')]===_0xf633('0x20');var _0x1f0d63=_0x2492d8['count'];var _0x301c17=_0x4c9a75?0x0:_0x276198[_0xf633('0x1f')];var _0x1647cc=_0x4c9a75?_0x2492d8[_0xf633('0x22')]:_0x276198[_0xf633('0x1f')]+_0x276198[_0xf633('0x21')];var _0x7e1fb1;if(_0x1647cc>=_0x1f0d63){_0x1647cc=_0x1f0d63;_0x7e1fb1=0xc8;}else{_0x7e1fb1=0xce;}_0x5983d5['status'](_0x7e1fb1);return _0x5983d5['set'](_0xf633('0x23'),_0x301c17+'-'+_0x1647cc+'/'+_0x1f0d63)[_0xf633('0x1e')](_0x2492d8);}return null;};}function patchUpdates(_0x4b6c43){return function(_0x3f11f7){try{jsonpatch[_0xf633('0x24')](_0x3f11f7,_0x4b6c43,!![]);}catch(_0x47d8c5){return BPromise[_0xf633('0x25')](_0x47d8c5);}return _0x3f11f7[_0xf633('0x26')]();};}function saveUpdates(_0x361576,_0x27f958){return function(_0x166394){if(_0x166394){return _0x166394['update'](_0x361576)['then'](function(_0x5a5926){return _0x5a5926;});}return null;};}function removeEntity(_0x1d0e87,_0x57947d){return function(_0x450347){if(_0x450347){return _0x450347[_0xf633('0x27')]()[_0xf633('0x28')](function(){_0x1d0e87[_0xf633('0x29')](0xcc)[_0xf633('0x1d')]();});}};}function handleEntityNotFound(_0x33ac03,_0x28bdf0){return function(_0x17b869){if(!_0x17b869){_0x33ac03['sendStatus'](0x194);}return _0x17b869;};}function handleError(_0x2beafb,_0x7199fa){_0x7199fa=_0x7199fa||0x1f4;return function(_0x1eac07){logger['error'](_0x1eac07['stack']);if(_0x1eac07[_0xf633('0x2a')]){delete _0x1eac07[_0xf633('0x2a')];}_0x2beafb[_0xf633('0x29')](_0x7199fa)['send'](_0x1eac07);};}exports[_0xf633('0x2b')]=function(_0x4971e7,_0x2cc24f){var _0x187c02={},_0x470a24={},_0x332cfb={'count':0x0,'rows':[]};var _0x162798=_['map'](db['SmsApplication'][_0xf633('0x2c')],function(_0x4fe981){return{'name':_0x4fe981[_0xf633('0x2d')],'type':_0x4fe981[_0xf633('0x2e')][_0xf633('0x2f')]};});_0x470a24[_0xf633('0x30')]=_[_0xf633('0x31')](_0x162798,_0xf633('0x2a'));_0x470a24[_0xf633('0x32')]=_['keys'](_0x4971e7[_0xf633('0x32')]);_0x470a24['filters']=_['intersection'](_0x470a24[_0xf633('0x30')],_0x470a24[_0xf633('0x32')]);_0x187c02[_0xf633('0x33')]=_[_0xf633('0x34')](_0x470a24[_0xf633('0x30')],qs['fields'](_0x4971e7['query'][_0xf633('0x35')]));_0x187c02[_0xf633('0x33')]=_0x187c02[_0xf633('0x33')][_0xf633('0x36')]?_0x187c02['attributes']:_0x470a24[_0xf633('0x30')];if(!_0x4971e7[_0xf633('0x32')][_0xf633('0x37')](_0xf633('0x38'))){_0x187c02[_0xf633('0x21')]=qs[_0xf633('0x21')](_0x4971e7[_0xf633('0x32')][_0xf633('0x21')]);_0x187c02[_0xf633('0x1f')]=qs[_0xf633('0x1f')](_0x4971e7[_0xf633('0x32')][_0xf633('0x1f')]);}_0x187c02[_0xf633('0x39')]=qs['sort'](_0x4971e7[_0xf633('0x32')][_0xf633('0x3a')]);_0x187c02[_0xf633('0x3b')]=qs['filters'](_[_0xf633('0x3c')](_0x4971e7[_0xf633('0x32')],_0x470a24[_0xf633('0x3d')]),_0x162798);if(_0x4971e7[_0xf633('0x32')][_0xf633('0x3e')]){_0x187c02[_0xf633('0x3b')]=_[_0xf633('0x3f')](_0x187c02['where'],{'$or':_['map'](_0x162798,function(_0x1a8f87){if(_0x1a8f87[_0xf633('0x2e')]!=='VIRTUAL'){var _0x2d0c99={};_0x2d0c99[_0x1a8f87[_0xf633('0x2a')]]={'$like':'%'+_0x4971e7[_0xf633('0x32')][_0xf633('0x3e')]+'%'};return _0x2d0c99;}})});}_0x187c02=_[_0xf633('0x3f')]({},_0x187c02,_0x4971e7['options']);var _0x26c89e={'where':_0x187c02[_0xf633('0x3b')]};return db[_0xf633('0x40')][_0xf633('0x22')](_0x26c89e)[_0xf633('0x28')](function(_0x49eafc){_0x332cfb[_0xf633('0x22')]=_0x49eafc;if(_0x4971e7[_0xf633('0x32')][_0xf633('0x41')]){_0x187c02[_0xf633('0x42')]=[{'all':!![]}];}return db[_0xf633('0x40')][_0xf633('0x43')](_0x187c02);})[_0xf633('0x28')](function(_0x502905){_0x332cfb[_0xf633('0x44')]=_0x502905;return _0x332cfb;})[_0xf633('0x28')](respondWithFilteredResult(_0x2cc24f,_0x187c02))[_0xf633('0x45')](handleError(_0x2cc24f,null));};exports[_0xf633('0x46')]=function(_0xa8177c,_0x11af93){var _0x2eff66={'raw':!![],'where':{'id':_0xa8177c[_0xf633('0x47')]['id']}},_0x14a70a={};_0x14a70a['model']=_[_0xf633('0x48')](db[_0xf633('0x40')]['rawAttributes']);_0x14a70a[_0xf633('0x32')]=_[_0xf633('0x48')](_0xa8177c[_0xf633('0x32')]);_0x14a70a[_0xf633('0x3d')]=_[_0xf633('0x34')](_0x14a70a['model'],_0x14a70a[_0xf633('0x32')]);_0x2eff66[_0xf633('0x33')]=_[_0xf633('0x34')](_0x14a70a[_0xf633('0x30')],qs['fields'](_0xa8177c['query'][_0xf633('0x35')]));_0x2eff66[_0xf633('0x33')]=_0x2eff66[_0xf633('0x33')][_0xf633('0x36')]?_0x2eff66[_0xf633('0x33')]:_0x14a70a[_0xf633('0x30')];if(_0xa8177c[_0xf633('0x32')][_0xf633('0x41')]){_0x2eff66[_0xf633('0x42')]=[{'all':!![]}];}_0x2eff66=_[_0xf633('0x3f')]({},_0x2eff66,_0xa8177c[_0xf633('0x49')]);return db[_0xf633('0x40')]['find'](_0x2eff66)['then'](handleEntityNotFound(_0x11af93,null))[_0xf633('0x28')](respondWithResult(_0x11af93,null))['catch'](handleError(_0x11af93,null));};exports[_0xf633('0x4a')]=function(_0x222d0e,_0x1a1df5){return db[_0xf633('0x40')][_0xf633('0x4a')](_0x222d0e[_0xf633('0x4b')],{})['then'](respondWithResult(_0x1a1df5,0xc9))[_0xf633('0x45')](handleError(_0x1a1df5,null));};exports[_0xf633('0x4c')]=function(_0x3aab14,_0x1ea1e5){if(_0x3aab14[_0xf633('0x4b')]['id']){delete _0x3aab14['body']['id'];}return db[_0xf633('0x40')]['find']({'where':{'id':_0x3aab14[_0xf633('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ea1e5,null))[_0xf633('0x28')](saveUpdates(_0x3aab14[_0xf633('0x4b')],null))[_0xf633('0x28')](respondWithResult(_0x1ea1e5,null))[_0xf633('0x45')](handleError(_0x1ea1e5,null));};exports[_0xf633('0x27')]=function(_0x1707bc,_0x3ba2cd){return db['SmsApplication'][_0xf633('0x4d')]({'where':{'id':_0x1707bc[_0xf633('0x47')]['id']}})[_0xf633('0x28')](handleEntityNotFound(_0x3ba2cd,null))[_0xf633('0x28')](removeEntity(_0x3ba2cd,null))[_0xf633('0x45')](handleError(_0x3ba2cd,null));}; \ No newline at end of file +var _0xeff7=['map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','SmsApplication','includeAll','include','findAll','options','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model'];(function(_0x194c71,_0x529556){var _0x4f360e=function(_0x57b958){while(--_0x57b958){_0x194c71['push'](_0x194c71['shift']());}};_0x4f360e(++_0x529556);}(_0xeff7,0x145));var _0x7eff=function(_0x551131,_0x52cb34){_0x551131=_0x551131-0x0;var _0x1e00c7=_0xeff7[_0x551131];return _0x1e00c7;};'use strict';var emlformat=require(_0x7eff('0x0'));var rimraf=require(_0x7eff('0x1'));var zipdir=require(_0x7eff('0x2'));var jsonpatch=require(_0x7eff('0x3'));var rp=require(_0x7eff('0x4'));var moment=require(_0x7eff('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7eff('0x6'));var path=require(_0x7eff('0x7'));var sox=require(_0x7eff('0x8'));var csv=require(_0x7eff('0x9'));var ejs=require(_0x7eff('0xa'));var fs=require('fs');var fs_extra=require(_0x7eff('0xb'));var _=require(_0x7eff('0xc'));var squel=require(_0x7eff('0xd'));var crypto=require(_0x7eff('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7eff('0x9'));var querystring=require(_0x7eff('0xf'));var Papa=require(_0x7eff('0x10'));var Redis=require(_0x7eff('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7eff('0x12'));var as=require(_0x7eff('0x13'));var hardwareService=require(_0x7eff('0x14'));var logger=require(_0x7eff('0x15'))(_0x7eff('0x16'));var utils=require('../../config/utils');var config=require(_0x7eff('0x17'));var licenseUtil=require(_0x7eff('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xafd5b7,_0x280189){_0x280189=_0x280189||0xcc;return function(_0x5a64aa){if(_0x5a64aa){return _0xafd5b7[_0x7eff('0x19')](_0x280189);}return _0xafd5b7[_0x7eff('0x1a')](_0x280189)[_0x7eff('0x1b')]();};}function respondWithResult(_0x92d879,_0x2af7dd){_0x2af7dd=_0x2af7dd||0xc8;return function(_0x26830f){if(_0x26830f){return _0x92d879[_0x7eff('0x1a')](_0x2af7dd)[_0x7eff('0x1c')](_0x26830f);}};}function respondWithFilteredResult(_0x470570,_0x21a617){return function(_0x11e397){if(_0x11e397){var _0x246b3e=typeof _0x21a617[_0x7eff('0x1d')]===_0x7eff('0x1e')&&typeof _0x21a617['limit']==='undefined';var _0x159db4=_0x11e397[_0x7eff('0x1f')];var _0x3e3f29=_0x246b3e?0x0:_0x21a617['offset'];var _0x6dbf26=_0x246b3e?_0x11e397[_0x7eff('0x1f')]:_0x21a617['offset']+_0x21a617[_0x7eff('0x20')];var _0x191028;if(_0x6dbf26>=_0x159db4){_0x6dbf26=_0x159db4;_0x191028=0xc8;}else{_0x191028=0xce;}_0x470570['status'](_0x191028);return _0x470570[_0x7eff('0x21')](_0x7eff('0x22'),_0x3e3f29+'-'+_0x6dbf26+'/'+_0x159db4)[_0x7eff('0x1c')](_0x11e397);}return null;};}function patchUpdates(_0x2e6108){return function(_0x116eaf){try{jsonpatch[_0x7eff('0x23')](_0x116eaf,_0x2e6108,!![]);}catch(_0x465a4f){return BPromise[_0x7eff('0x24')](_0x465a4f);}return _0x116eaf[_0x7eff('0x25')]();};}function saveUpdates(_0x5bd3bd,_0x57f842){return function(_0x46b5ca){if(_0x46b5ca){return _0x46b5ca['update'](_0x5bd3bd)[_0x7eff('0x26')](function(_0xd88d3f){return _0xd88d3f;});}return null;};}function removeEntity(_0x26874a,_0x538855){return function(_0x2886b6){if(_0x2886b6){return _0x2886b6[_0x7eff('0x27')]()[_0x7eff('0x26')](function(){_0x26874a[_0x7eff('0x1a')](0xcc)[_0x7eff('0x1b')]();});}};}function handleEntityNotFound(_0x2eaa71,_0x5f490a){return function(_0x15d052){if(!_0x15d052){_0x2eaa71[_0x7eff('0x19')](0x194);}return _0x15d052;};}function handleError(_0x37b3c5,_0x44b1d9){_0x44b1d9=_0x44b1d9||0x1f4;return function(_0x5cee76){logger[_0x7eff('0x28')](_0x5cee76[_0x7eff('0x29')]);if(_0x5cee76['name']){delete _0x5cee76[_0x7eff('0x2a')];}_0x37b3c5[_0x7eff('0x1a')](_0x44b1d9)[_0x7eff('0x2b')](_0x5cee76);};}exports[_0x7eff('0x2c')]=function(_0x3085b8,_0x4c7672){var _0x2d5603={},_0x10066d={},_0x173548={'count':0x0,'rows':[]};var _0x3c54b3=_['map'](db['SmsApplication'][_0x7eff('0x2d')],function(_0x149f8d){return{'name':_0x149f8d[_0x7eff('0x2e')],'type':_0x149f8d[_0x7eff('0x2f')][_0x7eff('0x30')]};});_0x10066d[_0x7eff('0x31')]=_[_0x7eff('0x32')](_0x3c54b3,_0x7eff('0x2a'));_0x10066d[_0x7eff('0x33')]=_[_0x7eff('0x34')](_0x3085b8[_0x7eff('0x33')]);_0x10066d[_0x7eff('0x35')]=_[_0x7eff('0x36')](_0x10066d['model'],_0x10066d[_0x7eff('0x33')]);_0x2d5603[_0x7eff('0x37')]=_['intersection'](_0x10066d['model'],qs[_0x7eff('0x38')](_0x3085b8[_0x7eff('0x33')][_0x7eff('0x38')]));_0x2d5603[_0x7eff('0x37')]=_0x2d5603['attributes'][_0x7eff('0x39')]?_0x2d5603[_0x7eff('0x37')]:_0x10066d[_0x7eff('0x31')];if(!_0x3085b8[_0x7eff('0x33')][_0x7eff('0x3a')]('nolimit')){_0x2d5603['limit']=qs[_0x7eff('0x20')](_0x3085b8[_0x7eff('0x33')]['limit']);_0x2d5603[_0x7eff('0x1d')]=qs[_0x7eff('0x1d')](_0x3085b8[_0x7eff('0x33')]['offset']);}_0x2d5603['order']=qs[_0x7eff('0x3b')](_0x3085b8[_0x7eff('0x33')]['sort']);_0x2d5603['where']=qs[_0x7eff('0x35')](_['pick'](_0x3085b8[_0x7eff('0x33')],_0x10066d[_0x7eff('0x35')]),_0x3c54b3);if(_0x3085b8['query'][_0x7eff('0x3c')]){_0x2d5603[_0x7eff('0x3d')]=_[_0x7eff('0x3e')](_0x2d5603['where'],{'$or':_[_0x7eff('0x32')](_0x3c54b3,function(_0x3ddfed){if(_0x3ddfed[_0x7eff('0x2f')]!==_0x7eff('0x3f')){var _0x527a07={};_0x527a07[_0x3ddfed[_0x7eff('0x2a')]]={'$like':'%'+_0x3085b8['query'][_0x7eff('0x3c')]+'%'};return _0x527a07;}})});}_0x2d5603=_[_0x7eff('0x3e')]({},_0x2d5603,_0x3085b8['options']);var _0x4e6268={'where':_0x2d5603[_0x7eff('0x3d')]};return db[_0x7eff('0x40')][_0x7eff('0x1f')](_0x4e6268)[_0x7eff('0x26')](function(_0x3db13b){_0x173548['count']=_0x3db13b;if(_0x3085b8[_0x7eff('0x33')][_0x7eff('0x41')]){_0x2d5603[_0x7eff('0x42')]=[{'all':!![]}];}return db['SmsApplication'][_0x7eff('0x43')](_0x2d5603);})[_0x7eff('0x26')](function(_0x5b0a26){_0x173548['rows']=_0x5b0a26;return _0x173548;})['then'](respondWithFilteredResult(_0x4c7672,_0x2d5603))['catch'](handleError(_0x4c7672,null));};exports['show']=function(_0xf59b88,_0xfa37c9){var _0x6de01a={'raw':!![],'where':{'id':_0xf59b88['params']['id']}},_0x41d511={};_0x41d511['model']=_[_0x7eff('0x34')](db[_0x7eff('0x40')]['rawAttributes']);_0x41d511[_0x7eff('0x33')]=_[_0x7eff('0x34')](_0xf59b88[_0x7eff('0x33')]);_0x41d511['filters']=_[_0x7eff('0x36')](_0x41d511[_0x7eff('0x31')],_0x41d511[_0x7eff('0x33')]);_0x6de01a[_0x7eff('0x37')]=_[_0x7eff('0x36')](_0x41d511['model'],qs['fields'](_0xf59b88['query'][_0x7eff('0x38')]));_0x6de01a[_0x7eff('0x37')]=_0x6de01a['attributes'][_0x7eff('0x39')]?_0x6de01a['attributes']:_0x41d511['model'];if(_0xf59b88[_0x7eff('0x33')][_0x7eff('0x41')]){_0x6de01a['include']=[{'all':!![]}];}_0x6de01a=_[_0x7eff('0x3e')]({},_0x6de01a,_0xf59b88[_0x7eff('0x44')]);return db[_0x7eff('0x40')][_0x7eff('0x45')](_0x6de01a)[_0x7eff('0x26')](handleEntityNotFound(_0xfa37c9,null))[_0x7eff('0x26')](respondWithResult(_0xfa37c9,null))[_0x7eff('0x46')](handleError(_0xfa37c9,null));};exports['create']=function(_0xb57596,_0x389a55){return db[_0x7eff('0x40')][_0x7eff('0x47')](_0xb57596[_0x7eff('0x48')],{})[_0x7eff('0x26')](respondWithResult(_0x389a55,0xc9))[_0x7eff('0x46')](handleError(_0x389a55,null));};exports[_0x7eff('0x49')]=function(_0x1b4203,_0x1c6dca){if(_0x1b4203[_0x7eff('0x48')]['id']){delete _0x1b4203[_0x7eff('0x48')]['id'];}return db[_0x7eff('0x40')][_0x7eff('0x45')]({'where':{'id':_0x1b4203[_0x7eff('0x4a')]['id']}})[_0x7eff('0x26')](handleEntityNotFound(_0x1c6dca,null))[_0x7eff('0x26')](saveUpdates(_0x1b4203['body'],null))[_0x7eff('0x26')](respondWithResult(_0x1c6dca,null))[_0x7eff('0x46')](handleError(_0x1c6dca,null));};exports[_0x7eff('0x27')]=function(_0x49a4a8,_0x29ada5){return db[_0x7eff('0x40')]['find']({'where':{'id':_0x49a4a8['params']['id']}})['then'](handleEntityNotFound(_0x29ada5,null))[_0x7eff('0x26')](removeEntity(_0x29ada5,null))['catch'](handleError(_0x29ada5,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 821b1fc..7441447 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 _0xeedf=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','sms_applications','utf8mb4_unicode_ci'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0xeedf,0x12c));var _0xfeed=function(_0x4aab96,_0x59db9c){_0x4aab96=_0x4aab96-0x0;var _0x2a8eb3=_0xeedf[_0x4aab96];return _0x2a8eb3;};'use strict';var _=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var logger=require(_0xfeed('0x2'))('api');var moment=require(_0xfeed('0x3'));var BPromise=require('bluebird');var rp=require(_0xfeed('0x4'));var fs=require('fs');var path=require(_0xfeed('0x5'));var rimraf=require(_0xfeed('0x6'));var config=require(_0xfeed('0x7'));var attributes=require('./smsApplication.attributes');module[_0xfeed('0x8')]=function(_0x2c211d,_0x5df4fe){return _0x2c211d[_0xfeed('0x9')]('SmsApplication',attributes,{'tableName':_0xfeed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfeed('0xb')});}; \ No newline at end of file +var _0x3aea=['moment','request-promise','path','../../config/environment','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x1a9c75,_0xa83750){var _0xb2f37e=function(_0x2b90f6){while(--_0x2b90f6){_0x1a9c75['push'](_0x1a9c75['shift']());}};_0xb2f37e(++_0xa83750);}(_0x3aea,0xc9));var _0xa3ae=function(_0xf5a6f,_0x3d3933){_0xf5a6f=_0xf5a6f-0x0;var _0x5d6f31=_0x3aea[_0xf5a6f];return _0x5d6f31;};'use strict';var _=require(_0xa3ae('0x0'));var util=require('util');var logger=require(_0xa3ae('0x1'))(_0xa3ae('0x2'));var moment=require(_0xa3ae('0x3'));var BPromise=require('bluebird');var rp=require(_0xa3ae('0x4'));var fs=require('fs');var path=require(_0xa3ae('0x5'));var rimraf=require('rimraf');var config=require(_0xa3ae('0x6'));var attributes=require('./smsApplication.attributes');module[_0xa3ae('0x7')]=function(_0x2f1c79,_0x4b5cf2){return _0x2f1c79[_0xa3ae('0x8')]('SmsApplication',attributes,{'tableName':_0xa3ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa3ae('0xa'),'collate':_0xa3ae('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 668fede..f215c5b 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 _0xceef=['jayson/promise','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x567dc7,_0x4e0e9c){var _0x5bb553=function(_0x21e776){while(--_0x21e776){_0x567dc7['push'](_0x567dc7['shift']());}};_0x5bb553(++_0x4e0e9c);}(_0xceef,0xf6));var _0xfcee=function(_0x1e53ca,_0x2692ed){_0x1e53ca=_0x1e53ca-0x0;var _0x55e658=_0xceef[_0x1e53ca];return _0x55e658;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcee('0x0'));var BPromise=require(_0xfcee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcee('0x3'));var logger=require(_0xfcee('0x4'))('rpc');var config=require(_0xfcee('0x5'));var jayson=require(_0xfcee('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35234a,_0xfbfb75,_0xd69040){return new BPromise(function(_0x5b0d2c,_0x513a59){return client[_0xfcee('0x7')](_0x35234a,_0xd69040)[_0xfcee('0x8')](function(_0xcea858){logger[_0xfcee('0x9')](_0xfcee('0xa'),_0xfbfb75,_0xfcee('0xb'));logger[_0xfcee('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0xfbfb75,_0xfcee('0xb'),JSON[_0xfcee('0xd')](_0xcea858));if(_0xcea858[_0xfcee('0xe')]){if(_0xcea858[_0xfcee('0xe')][_0xfcee('0xf')]===0x1f4){logger[_0xfcee('0xe')](_0xfcee('0xa'),_0xfbfb75,_0xcea858[_0xfcee('0xe')][_0xfcee('0x10')]);return _0x513a59(_0xcea858['error'][_0xfcee('0x10')]);}logger[_0xfcee('0xe')]('SmsApplication,\x20%s,\x20%s',_0xfbfb75,_0xcea858['error'][_0xfcee('0x10')]);return _0x5b0d2c(_0xcea858[_0xfcee('0xe')][_0xfcee('0x10')]);}else{logger[_0xfcee('0x9')](_0xfcee('0xa'),_0xfbfb75,_0xfcee('0xb'));_0x5b0d2c(_0xcea858['result'][_0xfcee('0x10')]);}})[_0xfcee('0x11')](function(_0x38a971){logger['error'](_0xfcee('0xa'),_0xfbfb75,_0x38a971);_0x513a59(_0x38a971);});});} \ No newline at end of file +var _0xf5b6=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x2866b5,_0x438eaf){var _0x4deabd=function(_0x5cdbc3){while(--_0x5cdbc3){_0x2866b5['push'](_0x2866b5['shift']());}};_0x4deabd(++_0x438eaf);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x3887f1,_0x51d317){_0x3887f1=_0x3887f1-0x0;var _0x280933=_0xf5b6[_0x3887f1];return _0x280933;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f5b('0x0'));var BPromise=require(_0x6f5b('0x1'));var rs=require(_0x6f5b('0x2'));var fs=require('fs');var Redis=require(_0x6f5b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f5b('0x4'));var logger=require(_0x6f5b('0x5'))(_0x6f5b('0x6'));var config=require(_0x6f5b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6f5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5cf395,_0x58899e,_0x4a8fe8){return new BPromise(function(_0x437f27,_0x5b97a4){return client[_0x6f5b('0x9')](_0x5cf395,_0x4a8fe8)[_0x6f5b('0xa')](function(_0x17692b){logger['info'](_0x6f5b('0xb'),_0x58899e,'request\x20sent');logger[_0x6f5b('0xc')](_0x6f5b('0xd'),_0x58899e,_0x6f5b('0xe'),JSON[_0x6f5b('0xf')](_0x17692b));if(_0x17692b[_0x6f5b('0x10')]){if(_0x17692b['error'][_0x6f5b('0x11')]===0x1f4){logger[_0x6f5b('0x10')](_0x6f5b('0xb'),_0x58899e,_0x17692b['error']['message']);return _0x5b97a4(_0x17692b[_0x6f5b('0x10')][_0x6f5b('0x12')]);}logger[_0x6f5b('0x10')](_0x6f5b('0xb'),_0x58899e,_0x17692b[_0x6f5b('0x10')][_0x6f5b('0x12')]);return _0x437f27(_0x17692b[_0x6f5b('0x10')]['message']);}else{logger[_0x6f5b('0x13')](_0x6f5b('0xb'),_0x58899e,'request\x20sent');_0x437f27(_0x17692b[_0x6f5b('0x14')][_0x6f5b('0x12')]);}})[_0x6f5b('0x15')](function(_0x344cf6){logger[_0x6f5b('0x10')](_0x6f5b('0xb'),_0x58899e,_0x344cf6);_0x5b97a4(_0x344cf6);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 7d2acad..85cb2e2 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 _0x2547=['/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5821c8,_0x3d83d4){var _0x24718c=function(_0x3f85fc){while(--_0x3f85fc){_0x5821c8['push'](_0x5821c8['shift']());}};_0x24718c(++_0x3d83d4);}(_0x2547,0x1cd));var _0x7254=function(_0x2177c8,_0x1e06be){_0x2177c8=_0x2177c8-0x0;var _0x169301=_0x2547[_0x2177c8];return _0x169301;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['get'](_0x7254('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);router[_0x7254('0x9')](_0x7254('0x11'),auth[_0x7254('0xa')](),controller['download']);router[_0x7254('0x12')]('/',auth['isAuthenticated'](),controller[_0x7254('0x13')]);router['post'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x14')]);router[_0x7254('0x12')](_0x7254('0x15'),auth[_0x7254('0xa')](),interaction[_0x7254('0x16')](_0x7254('0x17'),_0x7254('0x18')),controller[_0x7254('0x19')]);router[_0x7254('0x1a')](_0x7254('0xe'),auth[_0x7254('0xa')](),interaction['tracked'](_0x7254('0x17'),_0x7254('0x1b')),controller[_0x7254('0x1c')]);router[_0x7254('0x1d')](_0x7254('0xe'),auth[_0x7254('0xa')](),interaction[_0x7254('0x16')]('sms',_0x7254('0x1e')),controller[_0x7254('0x1f')]);router[_0x7254('0x1d')](_0x7254('0x15'),auth[_0x7254('0xa')](),controller[_0x7254('0x20')]);module[_0x7254('0x21')]=router; \ No newline at end of file +var _0x1775=['/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xa')](_0x5177('0xf'),auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5177('0x11')]);router[_0x5177('0xa')](_0x5177('0x12'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);router['post']('/',auth[_0x5177('0xb')](),controller[_0x5177('0x14')]);router[_0x5177('0x15')](_0x5177('0x16'),auth[_0x5177('0xb')](),controller[_0x5177('0x17')]);router[_0x5177('0x15')](_0x5177('0x18'),auth[_0x5177('0xb')](),interaction[_0x5177('0x19')](_0x5177('0x1a'),_0x5177('0x1b')),controller[_0x5177('0x1c')]);router[_0x5177('0x1d')](_0x5177('0xf'),auth[_0x5177('0xb')](),interaction[_0x5177('0x19')](_0x5177('0x1a'),_0x5177('0x1e')),controller['update']);router[_0x5177('0x1f')](_0x5177('0xf'),auth[_0x5177('0xb')](),interaction[_0x5177('0x19')]('sms',_0x5177('0x20')),controller[_0x5177('0x21')]);router[_0x5177('0x1f')]('/:id/tags',auth[_0x5177('0xb')](),controller['removeTags']);module[_0x5177('0x22')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index bd307ce..0442630 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 _0x4813=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x1e418c,_0x3cb809){var _0x456465=function(_0x3043d8){while(--_0x3043d8){_0x1e418c['push'](_0x1e418c['shift']());}};_0x456465(++_0x3cb809);}(_0x4813,0x14e));var _0x3481=function(_0x90ae83,_0x3faf05){_0x90ae83=_0x90ae83-0x0;var _0x4fde13=_0x4813[_0x90ae83];return _0x4fde13;};'use strict';var Sequelize=require(_0x3481('0x0'));var moment=require(_0x3481('0x1'));module[_0x3481('0x2')]={'closed':{'type':Sequelize[_0x3481('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3481('0x4')]},'disposition':{'type':Sequelize[_0x3481('0x5')]},'secondDisposition':{'type':Sequelize[_0x3481('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3481('0x5')]},'phone':{'type':Sequelize[_0x3481('0x5')]},'read1stAt':{'type':Sequelize[_0x3481('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3481('0x6')]('in',_0x3481('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3481('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5e11=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x1132f9,_0x15d882){var _0x5c96bf=function(_0xe833bc){while(--_0xe833bc){_0x1132f9['push'](_0x1132f9['shift']());}};_0x5c96bf(++_0x15d882);}(_0x5e11,0x1c3));var _0x15e1=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x5e11[_0x3bb5b4];return _0x586c60;};'use strict';var Sequelize=require(_0x15e1('0x0'));var moment=require('moment');module[_0x15e1('0x1')]={'closed':{'type':Sequelize[_0x15e1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x15e1('0x3')]},'disposition':{'type':Sequelize[_0x15e1('0x4')]},'secondDisposition':{'type':Sequelize[_0x15e1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x15e1('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x15e1('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x15e1('0x5')]('in',_0x15e1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x15e1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x15e1('0x5')]('in',_0x15e1('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 92b4ac8..449e427 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 _0x12cb=['body','describe','addMessage','SmsMessage','ids','omit','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsInteractionId','filter','where','$gte','split','format','options','count','includeAll','rows','addTags','setTags','Tag','color','emit','smsInteractionTags:save','removeTags','find','unix','toString','server','files','tmp','transcript-%d-%s.zip','join','push','User','fullname','CmContact','Contact','firstName','lastName','createdAt','direction','secret','read','get','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','value','renderFile','root','views','downloadInteraction.ejs','transcript-','Sms','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','update','then','destroy','error','stack','name','index','map','fieldName','type','key','findAll','sms','query','catch','params','keys','SmsInteraction','filters','intersection','attributes','model','fields','length','merge'];(function(_0x44e827,_0x145ed8){var _0xa19d97=function(_0x3a1176){while(--_0x3a1176){_0x44e827['push'](_0x44e827['shift']());}};_0xa19d97(++_0x145ed8);}(_0x12cb,0xb9));var _0xb12c=function(_0x3b83b7,_0x1214a3){_0x3b83b7=_0x3b83b7-0x0;var _0x2d7d1f=_0x12cb[_0x3b83b7];return _0x2d7d1f;};'use strict';var rimraf=require(_0xb12c('0x0'));var zipdir=require(_0xb12c('0x1'));var moment=require(_0xb12c('0x2'));var BPromise=require(_0xb12c('0x3'));var util=require(_0xb12c('0x4'));var path=require(_0xb12c('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb12c('0x6'));var Redis=require('ioredis');var interaction=require(_0xb12c('0x7'));var qs=require(_0xb12c('0x8'));var pdf=require(_0xb12c('0x9'));var logger=require(_0xb12c('0xa'))(_0xb12c('0xb'));var config=require(_0xb12c('0xc'));var db=require('../../mysqldb')['db'];config[_0xb12c('0xd')]=_[_0xb12c('0xe')](config[_0xb12c('0xd')],{'host':_0xb12c('0xf'),'port':0x18eb});var socket=require(_0xb12c('0x10'))(new Redis(config[_0xb12c('0xd')]));require(_0xb12c('0x11'))[_0xb12c('0x12')](socket);function respondWithStatusCode(_0xf76df4,_0x1db74d){_0x1db74d=_0x1db74d||0xcc;return function(_0x5da7d1){if(_0x5da7d1){return _0xf76df4[_0xb12c('0x13')](_0x1db74d);}return _0xf76df4['status'](_0x1db74d)[_0xb12c('0x14')]();};}function respondWithResult(_0x8b7919,_0x90440a){_0x90440a=_0x90440a||0xc8;return function(_0x3fe6af){if(_0x3fe6af){return _0x8b7919[_0xb12c('0x15')](_0x90440a)[_0xb12c('0x16')](_0x3fe6af);}};}function respondWithFilteredResult(_0x933577,_0x382411){return function(_0x1bb3ad){if(_0x1bb3ad){var _0x4ee77f=typeof _0x382411[_0xb12c('0x17')]==='undefined'&&typeof _0x382411[_0xb12c('0x18')]===_0xb12c('0x19');var _0x364132=_0x1bb3ad['count'];var _0x2a8d54=_0x4ee77f?0x0:_0x382411['offset'];var _0x2a22cf=_0x4ee77f?_0x1bb3ad['count']:_0x382411[_0xb12c('0x17')]+_0x382411[_0xb12c('0x18')];var _0x1de6e9;if(_0x2a22cf>=_0x364132){_0x2a22cf=_0x364132;_0x1de6e9=0xc8;}else{_0x1de6e9=0xce;}_0x933577['status'](_0x1de6e9);return _0x933577[_0xb12c('0x1a')](_0xb12c('0x1b'),_0x2a8d54+'-'+_0x2a22cf+'/'+_0x364132)[_0xb12c('0x16')](_0x1bb3ad);}return null;};}function saveUpdates(_0x878a09){return function(_0x144c28){if(_0x144c28){return _0x144c28[_0xb12c('0x1c')](_0x878a09)[_0xb12c('0x1d')](function(_0x105b5d){return _0x105b5d;});}return null;};}function removeEntity(_0x2f8224){return function(_0x9126a3){if(_0x9126a3){return _0x9126a3[_0xb12c('0x1e')]()[_0xb12c('0x1d')](function(){_0x2f8224['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14db6f){return function(_0x4f35af){if(!_0x4f35af){_0x14db6f[_0xb12c('0x13')](0x194);}return _0x4f35af;};}function handleError(_0x461fb3,_0x308aa8){_0x308aa8=_0x308aa8||0x1f4;return function(_0xc81f1a){logger[_0xb12c('0x1f')](_0xc81f1a[_0xb12c('0x20')]);if(_0xc81f1a[_0xb12c('0x21')]){delete _0xc81f1a[_0xb12c('0x21')];}_0x461fb3['status'](_0x308aa8)['send'](_0xc81f1a);};}exports[_0xb12c('0x22')]=function(_0x5af27d,_0x38c997){var _0x5e70c9={};var _0x3cf42e=_[_0xb12c('0x23')](db['SmsInteraction']['rawAttributes'],function(_0x321c71){return{'name':_0x321c71[_0xb12c('0x24')],'type':_0x321c71[_0xb12c('0x25')][_0xb12c('0x26')]};});_0x5e70c9=qs['getOptions'](_0x3cf42e,_0x5af27d);return interaction[_0xb12c('0x27')](_0xb12c('0x28'),_0x5af27d[_0xb12c('0x29')],_0x5af27d['user'],_0x5e70c9,_0x3cf42e)[_0xb12c('0x1d')](respondWithFilteredResult(_0x38c997,_0x5e70c9))[_0xb12c('0x2a')](handleError(_0x38c997,null));};exports['show']=function(_0x1ccd5a,_0x3c2621){var _0x58cd02={'raw':![],'where':{'id':_0x1ccd5a[_0xb12c('0x2b')]['id']}},_0x5ec83d={};_0x5ec83d['model']=_[_0xb12c('0x2c')](db[_0xb12c('0x2d')]['rawAttributes']);_0x5ec83d[_0xb12c('0x29')]=_[_0xb12c('0x2c')](_0x1ccd5a['query']);_0x5ec83d[_0xb12c('0x2e')]=_[_0xb12c('0x2f')](_0x5ec83d['model'],_0x5ec83d[_0xb12c('0x29')]);_0x58cd02[_0xb12c('0x30')]=_['intersection'](_0x5ec83d[_0xb12c('0x31')],qs[_0xb12c('0x32')](_0x1ccd5a['query']['fields']));_0x58cd02[_0xb12c('0x30')]=_0x58cd02[_0xb12c('0x30')][_0xb12c('0x33')]?_0x58cd02[_0xb12c('0x30')]:_0x5ec83d[_0xb12c('0x31')];if(_0x1ccd5a[_0xb12c('0x29')]['includeAll']){_0x58cd02['include']=[{'all':!![]}];}_0x58cd02=_[_0xb12c('0x34')]({},_0x58cd02,_0x1ccd5a['options']);return db[_0xb12c('0x2d')]['find'](_0x58cd02)[_0xb12c('0x1d')](handleEntityNotFound(_0x3c2621,null))[_0xb12c('0x1d')](respondWithResult(_0x3c2621,null))[_0xb12c('0x2a')](handleError(_0x3c2621,null));};exports['create']=function(_0x8d417c,_0x311277){return db[_0xb12c('0x2d')]['create'](_0x8d417c[_0xb12c('0x35')],{})[_0xb12c('0x1d')](respondWithResult(_0x311277,0xc9))['catch'](handleError(_0x311277,null));};exports[_0xb12c('0x1c')]=function(_0x5ab16b,_0x3162e8){if(_0x5ab16b[_0xb12c('0x35')]['id']){delete _0x5ab16b[_0xb12c('0x35')]['id'];}return db[_0xb12c('0x2d')]['find']({'where':{'id':_0x5ab16b['params']['id']}})[_0xb12c('0x1d')](handleEntityNotFound(_0x3162e8,null))[_0xb12c('0x1d')](saveUpdates(_0x5ab16b[_0xb12c('0x35')],null))['then'](respondWithResult(_0x3162e8,null))[_0xb12c('0x2a')](handleError(_0x3162e8,null));};exports['destroy']=function(_0x613b47,_0x384a1a){return db[_0xb12c('0x2d')]['find']({'where':{'id':_0x613b47[_0xb12c('0x2b')]['id']}})[_0xb12c('0x1d')](handleEntityNotFound(_0x384a1a,null))['then'](removeEntity(_0x384a1a,null))['catch'](handleError(_0x384a1a,null));};exports['describe']=function(_0x7ff6a9,_0x280900){return db[_0xb12c('0x2d')][_0xb12c('0x36')]()[_0xb12c('0x1d')](respondWithResult(_0x280900,null))[_0xb12c('0x2a')](handleError(_0x280900,null));};exports[_0xb12c('0x37')]=function(_0x521a14,_0x5cfa22){return db[_0xb12c('0x38')]['find']({'where':{'id':_0x521a14['params']['id']}})[_0xb12c('0x1d')](handleEntityNotFound(_0x5cfa22,null))[_0xb12c('0x1d')](function(_0x501a0c){if(_0x501a0c){return _0x501a0c[_0xb12c('0x37')](_0x521a14['body'][_0xb12c('0x39')],_[_0xb12c('0x3a')](_0x521a14['body'],['ids','id'])||{});}})[_0xb12c('0x1d')](respondWithResult(_0x5cfa22,null))[_0xb12c('0x2a')](handleError(_0x5cfa22,null));};exports['getMessages']=function(_0x2ca378,_0x235480){var _0x355d0a={'raw':![],'where':{}};var _0x342552={};var _0x455b59={'count':0x0,'rows':[]};return db[_0xb12c('0x2d')]['findOne']({'where':{'id':_0x2ca378['params']['id']}})['then'](handleEntityNotFound(_0x235480,null))[_0xb12c('0x1d')](function(_0x1db4d5){if(_0x1db4d5){_0x342552['model']=_[_0xb12c('0x2c')](db[_0xb12c('0x38')][_0xb12c('0x3b')]);_0x342552[_0xb12c('0x29')]=_['keys'](_0x2ca378[_0xb12c('0x29')]);_0x342552[_0xb12c('0x2e')]=_[_0xb12c('0x2f')](_0x342552[_0xb12c('0x31')],_0x342552['query']);_0x355d0a['attributes']=_[_0xb12c('0x2f')](_0x342552[_0xb12c('0x31')],qs[_0xb12c('0x32')](_0x2ca378[_0xb12c('0x29')][_0xb12c('0x32')]));_0x355d0a[_0xb12c('0x30')]=_0x355d0a['attributes'][_0xb12c('0x33')]?_0x355d0a[_0xb12c('0x30')]:_0x342552[_0xb12c('0x31')];if(!_0x2ca378[_0xb12c('0x29')][_0xb12c('0x3c')](_0xb12c('0x3d'))){_0x355d0a[_0xb12c('0x18')]=qs[_0xb12c('0x18')](_0x2ca378[_0xb12c('0x29')][_0xb12c('0x18')]);_0x355d0a[_0xb12c('0x17')]=qs['offset'](_0x2ca378[_0xb12c('0x29')][_0xb12c('0x17')]);}_0x355d0a[_0xb12c('0x3e')]=qs['sort'](_0x2ca378[_0xb12c('0x29')][_0xb12c('0x3f')]);_0x355d0a['where']=qs['filters'](_['pick'](_0x2ca378[_0xb12c('0x29')],_0x342552[_0xb12c('0x2e')]));_0x355d0a['where'][_0xb12c('0x40')]=_0x1db4d5['id'];if(_0x2ca378[_0xb12c('0x29')][_0xb12c('0x41')]){_0x355d0a[_0xb12c('0x42')]=_[_0xb12c('0x34')](_0x355d0a[_0xb12c('0x42')],{'$or':_[_0xb12c('0x23')](_0x355d0a[_0xb12c('0x30')],function(_0x500725){var _0x5db6ba={};_0x5db6ba[_0x500725]={'$like':'%'+_0x2ca378[_0xb12c('0x29')][_0xb12c('0x41')]+'%'};return _0x5db6ba;})});}if(_0x2ca378['query'][_0xb12c('0x43')]){var _0x5d3df4=_0x2ca378['query'][_0xb12c('0x43')][_0xb12c('0x44')](',');var _0x57b43b={};_0x57b43b[_0x5d3df4[0x0]]={'$gte':moment(_0x5d3df4[0x1])[_0xb12c('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x355d0a[_0xb12c('0x42')]=_[_0xb12c('0x34')](_0x355d0a['where'],_0x57b43b);}_0x355d0a=_['merge']({},_0x355d0a,_0x2ca378[_0xb12c('0x46')]);return db[_0xb12c('0x38')][_0xb12c('0x47')]({'where':_0x355d0a[_0xb12c('0x42')]})[_0xb12c('0x1d')](function(_0x3a609b){_0x455b59[_0xb12c('0x47')]=_0x3a609b;if(_0x2ca378[_0xb12c('0x29')][_0xb12c('0x48')]){_0x355d0a['include']=[{'all':!![]}];}return db[_0xb12c('0x38')][_0xb12c('0x27')](_0x355d0a);})[_0xb12c('0x1d')](function(_0x13d0ce){_0x455b59[_0xb12c('0x49')]=_0x13d0ce;return _0x455b59;});}})['then'](respondWithFilteredResult(_0x235480,_0x355d0a))[_0xb12c('0x2a')](handleError(_0x235480,null));};exports[_0xb12c('0x4a')]=function(_0x436903,_0x709632){return db[_0xb12c('0x2d')]['find']({'where':{'id':_0x436903[_0xb12c('0x2b')]['id']}})[_0xb12c('0x1d')](handleEntityNotFound(_0x709632,null))[_0xb12c('0x1d')](function(_0x2c0445){if(_0x2c0445){return _0x2c0445[_0xb12c('0x4b')](_0x436903[_0xb12c('0x35')][_0xb12c('0x39')],_[_0xb12c('0x3a')](_0x436903[_0xb12c('0x35')],[_0xb12c('0x39'),'id'])||{})['spread'](function(){return db[_0xb12c('0x4c')][_0xb12c('0x27')]({'attributes':['id',_0xb12c('0x21'),_0xb12c('0x4d')],'where':{'id':_0x436903[_0xb12c('0x35')]['ids']}});})[_0xb12c('0x1d')](function(_0x1b4222){socket[_0xb12c('0x4e')](_0xb12c('0x4f'),{'id':Number(_0x436903[_0xb12c('0x2b')]['id']),'tags':_0x1b4222||[]});return{'id':Number(_0x436903[_0xb12c('0x2b')]['id']),'tags':_0x1b4222||[]};});}})['then'](respondWithResult(_0x709632,null))['catch'](handleError(_0x709632,null));};exports[_0xb12c('0x50')]=function(_0x600fa0,_0x24d910){return db['SmsInteraction'][_0xb12c('0x51')]({'where':{'id':_0x600fa0[_0xb12c('0x2b')]['id']}})[_0xb12c('0x1d')](handleEntityNotFound(_0x24d910,null))['then'](function(_0x60e601){if(_0x60e601){return _0x60e601[_0xb12c('0x50')](_0x600fa0[_0xb12c('0x29')][_0xb12c('0x39')]);}})['then'](respondWithStatusCode(_0x24d910,null))[_0xb12c('0x2a')](handleError(_0x24d910,null));};exports['download']=function(_0x135a93,_0x3987e3){var _0x31ac43=moment()[_0xb12c('0x52')]()[_0xb12c('0x53')]();var _0x167d9e=path['join'](config['root'],_0xb12c('0x54'),_0xb12c('0x55'),_0xb12c('0x56'));var _0x23edb5=path['join'](_0x167d9e,_0x31ac43);var _0x2beec8=util['format'](_0xb12c('0x57'),_0x135a93['params']['id'],_0x31ac43);var _0x4052b6=path[_0xb12c('0x58')](_0x167d9e,_0x2beec8);var _0x26ff85=[];_0x26ff85[_0xb12c('0x59')]({'model':db[_0xb12c('0x5a')],'as':_0xb12c('0x5a'),'attributes':['id',_0xb12c('0x5b')],'raw':!![]});_0x26ff85[_0xb12c('0x59')]({'model':db[_0xb12c('0x5c')],'as':_0xb12c('0x5d'),'attributes':['id',_0xb12c('0x5e'),_0xb12c('0x5f')],'raw':!![]});var _0x160852=[{'model':db[_0xb12c('0x38')],'as':'Messages','attributes':['id','body',_0xb12c('0x60'),_0xb12c('0x61'),_0xb12c('0x62'),_0xb12c('0x63')],'include':_0x26ff85}];_0x160852['push']({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0xb12c('0x21')]});_0x160852[_0xb12c('0x59')]({'model':db[_0xb12c('0x5a')],'as':'Owner','attributes':['id',_0xb12c('0x5b')]});return db['SmsInteraction'][_0xb12c('0x51')]({'where':{'id':_0x135a93[_0xb12c('0x2b')]['id']},'include':_0x160852})[_0xb12c('0x1d')](handleEntityNotFound(_0x3987e3,null))[_0xb12c('0x1d')](function(_0x431090){if(_0x431090){var _0x197c81=_0x431090[_0xb12c('0x64')]({'plain':!![]});fs['mkdirSync'](_0x23edb5);var _0x3644c0={'channel':'Sms','account':_0x197c81['Account'][_0xb12c('0x21')],'agent':_0x197c81[_0xb12c('0x65')]?_0x197c81['Owner'][_0xb12c('0x5b')]:_0xb12c('0x66'),'createdAt':moment(_0x197c81[_0xb12c('0x60')])[_0xb12c('0x45')](_0xb12c('0x67'))[_0xb12c('0x53')](),'closedAt':_0x197c81[_0xb12c('0x68')]?moment(_0x197c81[_0xb12c('0x69')])['format'](_0xb12c('0x67'))[_0xb12c('0x53')]():'','disposition':_0x197c81[_0xb12c('0x6a')],'messages':_(_0x197c81['Messages'])['filter']({'secret':![]})['map'](function(_0x2d9de5){return{'date':moment(_0x2d9de5[_0xb12c('0x60')])['format'](_0xb12c('0x67'))[_0xb12c('0x53')](),'sender':_0x2d9de5[_0xb12c('0x61')]===_0xb12c('0x6b')?_0x2d9de5[_0xb12c('0x5a')]?_0x2d9de5['User']['fullname']:'System':_0x2d9de5['Contact'][_0xb12c('0x5e')]+(_0x2d9de5[_0xb12c('0x5d')][_0xb12c('0x5f')]?'\x20'+_0x2d9de5[_0xb12c('0x5d')][_0xb12c('0x5f')]:''),'body':_0x2d9de5[_0xb12c('0x35')],'direction':_0x2d9de5['direction']===_0xb12c('0x6b')?'A':'C','secret':_0x2d9de5[_0xb12c('0x62')],'read':_0x2d9de5['read']};})[_0xb12c('0x6c')]()};return ejs[_0xb12c('0x6d')](path['join'](config[_0xb12c('0x6e')],_0xb12c('0x54'),_0xb12c('0x6f'),_0xb12c('0x70')),{'interaction':_0x3644c0})[_0xb12c('0x1d')](function(_0x207823){var _0x59a474=path[_0xb12c('0x58')](_0x23edb5,_0xb12c('0x71')+_0x197c81['id']+'-'+_0x31ac43+'.pdf');var _0x1a0d24={'path':_0x59a474,'channel':_0xb12c('0x72'),'interactionId':_0x197c81['id']};return pdf[_0xb12c('0x73')](_0x207823,_0x1a0d24);})[_0xb12c('0x1d')](function(){return new BPromise(function(_0x1ead13,_0x5e5ff8){zipdir(_0x23edb5,{'saveTo':_0x4052b6},function(_0x308909,_0xf265ef){if(_0x308909)return _0x5e5ff8(_0x308909);return _0x1ead13(_0xf265ef);});})['then'](function(){return new BPromise(function(_0x281eb3,_0x26a00e){rimraf(_0x23edb5,function(_0xf184e3){if(_0xf184e3)_0x26a00e(_0xf184e3);return _0x281eb3();});});})[_0xb12c('0x1d')](function(){return _0x3987e3['download'](_0x4052b6,_0x2beec8,function(_0xa16152){if(_0xa16152){console[_0xb12c('0x74')](_0xb12c('0x75'),_0xa16152);}else{fs[_0xb12c('0x76')](_0x4052b6);}});});});}else{return _0x3987e3[_0xb12c('0x13')](0xc8);}})[_0xb12c('0x2a')](handleError(_0x3987e3,null));}; \ No newline at end of file +var _0x6e43=['filters','nolimit','order','sort','where','SmsInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','color','emit','unix','toString','join','server','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','out','System','secret','value','renderFile','root','views','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','error','name','send','map','SmsInteraction','fieldName','key','getOptions','sms','query','user','catch','model','keys','rawAttributes','attributes','intersection','fields','length','includeAll','include','merge','options','body','find','params','destroy','describe','addMessage','SmsMessage','ids','omit','findOne'];(function(_0x386c54,_0x1ffdaf){var _0x263222=function(_0x13c615){while(--_0x13c615){_0x386c54['push'](_0x386c54['shift']());}};_0x263222(++_0x1ffdaf);}(_0x6e43,0x127));var _0x36e4=function(_0x582b25,_0x3a9182){_0x582b25=_0x582b25-0x0;var _0x1dba1f=_0x6e43[_0x582b25];return _0x1dba1f;};'use strict';var rimraf=require(_0x36e4('0x0'));var zipdir=require(_0x36e4('0x1'));var moment=require('moment');var BPromise=require(_0x36e4('0x2'));var util=require(_0x36e4('0x3'));var path=require(_0x36e4('0x4'));var ejs=require(_0x36e4('0x5'));var fs=require('fs');var _=require(_0x36e4('0x6'));var Redis=require(_0x36e4('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x36e4('0x8'));var logger=require(_0x36e4('0x9'))('api');var config=require(_0x36e4('0xa'));var db=require(_0x36e4('0xb'))['db'];config[_0x36e4('0xc')]=_[_0x36e4('0xd')](config['redis'],{'host':_0x36e4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36e4('0xc')]));require(_0x36e4('0xf'))[_0x36e4('0x10')](socket);function respondWithStatusCode(_0x35dfa5,_0xa676aa){_0xa676aa=_0xa676aa||0xcc;return function(_0x8b2e6){if(_0x8b2e6){return _0x35dfa5[_0x36e4('0x11')](_0xa676aa);}return _0x35dfa5[_0x36e4('0x12')](_0xa676aa)['end']();};}function respondWithResult(_0x1d3a9a,_0x5135dd){_0x5135dd=_0x5135dd||0xc8;return function(_0x482211){if(_0x482211){return _0x1d3a9a[_0x36e4('0x12')](_0x5135dd)[_0x36e4('0x13')](_0x482211);}};}function respondWithFilteredResult(_0x1657c1,_0x16490a){return function(_0x556e4f){if(_0x556e4f){var _0x12dd5c=typeof _0x16490a[_0x36e4('0x14')]===_0x36e4('0x15')&&typeof _0x16490a[_0x36e4('0x16')]===_0x36e4('0x15');var _0x5c354b=_0x556e4f[_0x36e4('0x17')];var _0x8e98ad=_0x12dd5c?0x0:_0x16490a[_0x36e4('0x14')];var _0x5513bd=_0x12dd5c?_0x556e4f['count']:_0x16490a['offset']+_0x16490a[_0x36e4('0x16')];var _0x4f291b;if(_0x5513bd>=_0x5c354b){_0x5513bd=_0x5c354b;_0x4f291b=0xc8;}else{_0x4f291b=0xce;}_0x1657c1[_0x36e4('0x12')](_0x4f291b);return _0x1657c1[_0x36e4('0x18')](_0x36e4('0x19'),_0x8e98ad+'-'+_0x5513bd+'/'+_0x5c354b)[_0x36e4('0x13')](_0x556e4f);}return null;};}function saveUpdates(_0x7e48c9){return function(_0x4a3fe8){if(_0x4a3fe8){return _0x4a3fe8[_0x36e4('0x1a')](_0x7e48c9)[_0x36e4('0x1b')](function(_0x29c7e6){return _0x29c7e6;});}return null;};}function removeEntity(_0x55859b){return function(_0x4fa6f8){if(_0x4fa6f8){return _0x4fa6f8['destroy']()[_0x36e4('0x1b')](function(){_0x55859b[_0x36e4('0x12')](0xcc)[_0x36e4('0x1c')]();});}};}function handleEntityNotFound(_0x5d4755){return function(_0x355254){if(!_0x355254){_0x5d4755[_0x36e4('0x11')](0x194);}return _0x355254;};}function handleError(_0x1270a5,_0x30a2ea){_0x30a2ea=_0x30a2ea||0x1f4;return function(_0x31ce12){logger[_0x36e4('0x1d')](_0x31ce12['stack']);if(_0x31ce12[_0x36e4('0x1e')]){delete _0x31ce12[_0x36e4('0x1e')];}_0x1270a5['status'](_0x30a2ea)[_0x36e4('0x1f')](_0x31ce12);};}exports['index']=function(_0x22457d,_0x5c5c0e){var _0x4a8fe6={};var _0x51043c=_[_0x36e4('0x20')](db[_0x36e4('0x21')]['rawAttributes'],function(_0x47b1ee){return{'name':_0x47b1ee[_0x36e4('0x22')],'type':_0x47b1ee['type'][_0x36e4('0x23')]};});_0x4a8fe6=qs[_0x36e4('0x24')](_0x51043c,_0x22457d);return interaction['findAll'](_0x36e4('0x25'),_0x22457d[_0x36e4('0x26')],_0x22457d[_0x36e4('0x27')],_0x4a8fe6,_0x51043c)[_0x36e4('0x1b')](respondWithFilteredResult(_0x5c5c0e,_0x4a8fe6))[_0x36e4('0x28')](handleError(_0x5c5c0e,null));};exports['show']=function(_0x5d17a8,_0x10dcbc){var _0x36ca6d={'raw':![],'where':{'id':_0x5d17a8['params']['id']}},_0x500c6e={};_0x500c6e[_0x36e4('0x29')]=_[_0x36e4('0x2a')](db[_0x36e4('0x21')][_0x36e4('0x2b')]);_0x500c6e[_0x36e4('0x26')]=_[_0x36e4('0x2a')](_0x5d17a8[_0x36e4('0x26')]);_0x500c6e['filters']=_['intersection'](_0x500c6e[_0x36e4('0x29')],_0x500c6e[_0x36e4('0x26')]);_0x36ca6d[_0x36e4('0x2c')]=_[_0x36e4('0x2d')](_0x500c6e['model'],qs[_0x36e4('0x2e')](_0x5d17a8[_0x36e4('0x26')][_0x36e4('0x2e')]));_0x36ca6d['attributes']=_0x36ca6d[_0x36e4('0x2c')][_0x36e4('0x2f')]?_0x36ca6d['attributes']:_0x500c6e[_0x36e4('0x29')];if(_0x5d17a8['query'][_0x36e4('0x30')]){_0x36ca6d[_0x36e4('0x31')]=[{'all':!![]}];}_0x36ca6d=_[_0x36e4('0x32')]({},_0x36ca6d,_0x5d17a8[_0x36e4('0x33')]);return db[_0x36e4('0x21')]['find'](_0x36ca6d)[_0x36e4('0x1b')](handleEntityNotFound(_0x10dcbc,null))[_0x36e4('0x1b')](respondWithResult(_0x10dcbc,null))[_0x36e4('0x28')](handleError(_0x10dcbc,null));};exports['create']=function(_0x1b1642,_0x889fc3){return db['SmsInteraction']['create'](_0x1b1642[_0x36e4('0x34')],{})[_0x36e4('0x1b')](respondWithResult(_0x889fc3,0xc9))[_0x36e4('0x28')](handleError(_0x889fc3,null));};exports[_0x36e4('0x1a')]=function(_0x2356fe,_0x224cff){if(_0x2356fe[_0x36e4('0x34')]['id']){delete _0x2356fe['body']['id'];}return db[_0x36e4('0x21')][_0x36e4('0x35')]({'where':{'id':_0x2356fe[_0x36e4('0x36')]['id']}})[_0x36e4('0x1b')](handleEntityNotFound(_0x224cff,null))['then'](saveUpdates(_0x2356fe[_0x36e4('0x34')],null))[_0x36e4('0x1b')](respondWithResult(_0x224cff,null))[_0x36e4('0x28')](handleError(_0x224cff,null));};exports[_0x36e4('0x37')]=function(_0x5836ac,_0x36660a){return db[_0x36e4('0x21')][_0x36e4('0x35')]({'where':{'id':_0x5836ac[_0x36e4('0x36')]['id']}})['then'](handleEntityNotFound(_0x36660a,null))[_0x36e4('0x1b')](removeEntity(_0x36660a,null))[_0x36e4('0x28')](handleError(_0x36660a,null));};exports[_0x36e4('0x38')]=function(_0x1e0c42,_0x15cb97){return db[_0x36e4('0x21')][_0x36e4('0x38')]()[_0x36e4('0x1b')](respondWithResult(_0x15cb97,null))[_0x36e4('0x28')](handleError(_0x15cb97,null));};exports[_0x36e4('0x39')]=function(_0x57c734,_0x51d655){return db[_0x36e4('0x3a')]['find']({'where':{'id':_0x57c734[_0x36e4('0x36')]['id']}})[_0x36e4('0x1b')](handleEntityNotFound(_0x51d655,null))['then'](function(_0xa58d28){if(_0xa58d28){return _0xa58d28[_0x36e4('0x39')](_0x57c734[_0x36e4('0x34')][_0x36e4('0x3b')],_[_0x36e4('0x3c')](_0x57c734[_0x36e4('0x34')],[_0x36e4('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x51d655,null))['catch'](handleError(_0x51d655,null));};exports['getMessages']=function(_0x43fa1,_0x219a76){var _0x39ac78={'raw':![],'where':{}};var _0x34aa69={};var _0x36fb9f={'count':0x0,'rows':[]};return db[_0x36e4('0x21')][_0x36e4('0x3d')]({'where':{'id':_0x43fa1['params']['id']}})[_0x36e4('0x1b')](handleEntityNotFound(_0x219a76,null))['then'](function(_0x13bcea){if(_0x13bcea){_0x34aa69[_0x36e4('0x29')]=_[_0x36e4('0x2a')](db[_0x36e4('0x3a')]['rawAttributes']);_0x34aa69[_0x36e4('0x26')]=_[_0x36e4('0x2a')](_0x43fa1[_0x36e4('0x26')]);_0x34aa69[_0x36e4('0x3e')]=_['intersection'](_0x34aa69['model'],_0x34aa69[_0x36e4('0x26')]);_0x39ac78[_0x36e4('0x2c')]=_[_0x36e4('0x2d')](_0x34aa69['model'],qs[_0x36e4('0x2e')](_0x43fa1['query'][_0x36e4('0x2e')]));_0x39ac78[_0x36e4('0x2c')]=_0x39ac78[_0x36e4('0x2c')]['length']?_0x39ac78[_0x36e4('0x2c')]:_0x34aa69['model'];if(!_0x43fa1[_0x36e4('0x26')]['hasOwnProperty'](_0x36e4('0x3f'))){_0x39ac78['limit']=qs['limit'](_0x43fa1[_0x36e4('0x26')]['limit']);_0x39ac78[_0x36e4('0x14')]=qs[_0x36e4('0x14')](_0x43fa1[_0x36e4('0x26')]['offset']);}_0x39ac78[_0x36e4('0x40')]=qs[_0x36e4('0x41')](_0x43fa1['query'][_0x36e4('0x41')]);_0x39ac78[_0x36e4('0x42')]=qs[_0x36e4('0x3e')](_['pick'](_0x43fa1[_0x36e4('0x26')],_0x34aa69[_0x36e4('0x3e')]));_0x39ac78[_0x36e4('0x42')][_0x36e4('0x43')]=_0x13bcea['id'];if(_0x43fa1[_0x36e4('0x26')][_0x36e4('0x44')]){_0x39ac78[_0x36e4('0x42')]=_['merge'](_0x39ac78['where'],{'$or':_['map'](_0x39ac78[_0x36e4('0x2c')],function(_0x57267a){var _0x1c96f7={};_0x1c96f7[_0x57267a]={'$like':'%'+_0x43fa1[_0x36e4('0x26')][_0x36e4('0x44')]+'%'};return _0x1c96f7;})});}if(_0x43fa1[_0x36e4('0x26')]['$gte']){var _0xfcd63a=_0x43fa1[_0x36e4('0x26')][_0x36e4('0x45')]['split'](',');var _0x318676={};_0x318676[_0xfcd63a[0x0]]={'$gte':moment(_0xfcd63a[0x1])[_0x36e4('0x46')](_0x36e4('0x47'))};_0x39ac78[_0x36e4('0x42')]=_[_0x36e4('0x32')](_0x39ac78[_0x36e4('0x42')],_0x318676);}_0x39ac78=_['merge']({},_0x39ac78,_0x43fa1[_0x36e4('0x33')]);return db['SmsMessage']['count']({'where':_0x39ac78[_0x36e4('0x42')]})[_0x36e4('0x1b')](function(_0x44eb3a){_0x36fb9f[_0x36e4('0x17')]=_0x44eb3a;if(_0x43fa1[_0x36e4('0x26')][_0x36e4('0x30')]){_0x39ac78[_0x36e4('0x31')]=[{'all':!![]}];}return db[_0x36e4('0x3a')][_0x36e4('0x48')](_0x39ac78);})['then'](function(_0xa714aa){_0x36fb9f['rows']=_0xa714aa;return _0x36fb9f;});}})[_0x36e4('0x1b')](respondWithFilteredResult(_0x219a76,_0x39ac78))[_0x36e4('0x28')](handleError(_0x219a76,null));};exports[_0x36e4('0x49')]=function(_0x1d858d,_0x19846f){return db[_0x36e4('0x21')][_0x36e4('0x35')]({'where':{'id':_0x1d858d['params']['id']}})[_0x36e4('0x1b')](handleEntityNotFound(_0x19846f,null))['then'](function(_0x42a4e8){if(_0x42a4e8){return _0x42a4e8[_0x36e4('0x4a')](_0x1d858d[_0x36e4('0x34')][_0x36e4('0x3b')],_['omit'](_0x1d858d[_0x36e4('0x34')],[_0x36e4('0x3b'),'id'])||{})[_0x36e4('0x4b')](function(){return db[_0x36e4('0x4c')][_0x36e4('0x48')]({'attributes':['id',_0x36e4('0x1e'),_0x36e4('0x4d')],'where':{'id':_0x1d858d[_0x36e4('0x34')][_0x36e4('0x3b')]}});})[_0x36e4('0x1b')](function(_0x4eb3c4){socket[_0x36e4('0x4e')]('smsInteractionTags:save',{'id':Number(_0x1d858d[_0x36e4('0x36')]['id']),'tags':_0x4eb3c4||[]});return{'id':Number(_0x1d858d[_0x36e4('0x36')]['id']),'tags':_0x4eb3c4||[]};});}})['then'](respondWithResult(_0x19846f,null))['catch'](handleError(_0x19846f,null));};exports['removeTags']=function(_0xeede78,_0x2674f5){return db[_0x36e4('0x21')][_0x36e4('0x35')]({'where':{'id':_0xeede78[_0x36e4('0x36')]['id']}})[_0x36e4('0x1b')](handleEntityNotFound(_0x2674f5,null))[_0x36e4('0x1b')](function(_0x341d31){if(_0x341d31){return _0x341d31['removeTags'](_0xeede78[_0x36e4('0x26')][_0x36e4('0x3b')]);}})[_0x36e4('0x1b')](respondWithStatusCode(_0x2674f5,null))[_0x36e4('0x28')](handleError(_0x2674f5,null));};exports['download']=function(_0x1b79b4,_0x34ae37){var _0x397f02=moment()[_0x36e4('0x4f')]()[_0x36e4('0x50')]();var _0x4c3be9=path[_0x36e4('0x51')](config['root'],_0x36e4('0x52'),'files','tmp');var _0x41a534=path[_0x36e4('0x51')](_0x4c3be9,_0x397f02);var _0x321e94=util[_0x36e4('0x46')](_0x36e4('0x53'),_0x1b79b4[_0x36e4('0x36')]['id'],_0x397f02);var _0x189501=path[_0x36e4('0x51')](_0x4c3be9,_0x321e94);var _0x3e90e7=[];_0x3e90e7[_0x36e4('0x54')]({'model':db[_0x36e4('0x55')],'as':_0x36e4('0x55'),'attributes':['id',_0x36e4('0x56')],'raw':!![]});_0x3e90e7[_0x36e4('0x54')]({'model':db[_0x36e4('0x57')],'as':_0x36e4('0x58'),'attributes':['id',_0x36e4('0x59'),_0x36e4('0x5a')],'raw':!![]});var _0x12e271=[{'model':db[_0x36e4('0x3a')],'as':_0x36e4('0x5b'),'attributes':['id','body',_0x36e4('0x5c'),_0x36e4('0x5d'),'secret',_0x36e4('0x5e')],'include':_0x3e90e7}];_0x12e271[_0x36e4('0x54')]({'model':db[_0x36e4('0x5f')],'as':_0x36e4('0x60'),'attributes':['id',_0x36e4('0x1e')]});_0x12e271[_0x36e4('0x54')]({'model':db[_0x36e4('0x55')],'as':_0x36e4('0x61'),'attributes':['id',_0x36e4('0x56')]});return db['SmsInteraction']['find']({'where':{'id':_0x1b79b4[_0x36e4('0x36')]['id']},'include':_0x12e271})[_0x36e4('0x1b')](handleEntityNotFound(_0x34ae37,null))[_0x36e4('0x1b')](function(_0x916d25){if(_0x916d25){var _0x179f65=_0x916d25[_0x36e4('0x62')]({'plain':!![]});fs[_0x36e4('0x63')](_0x41a534);var _0x306cf4={'channel':_0x36e4('0x64'),'account':_0x179f65[_0x36e4('0x60')][_0x36e4('0x1e')],'agent':_0x179f65['Owner']?_0x179f65[_0x36e4('0x61')][_0x36e4('0x56')]:_0x36e4('0x65'),'createdAt':moment(_0x179f65[_0x36e4('0x5c')])[_0x36e4('0x46')](_0x36e4('0x47'))[_0x36e4('0x50')](),'closedAt':_0x179f65[_0x36e4('0x66')]?moment(_0x179f65[_0x36e4('0x67')])[_0x36e4('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x36e4('0x50')]():'','disposition':_0x179f65[_0x36e4('0x68')],'messages':_(_0x179f65[_0x36e4('0x5b')])[_0x36e4('0x44')]({'secret':![]})['map'](function(_0x32e7a4){return{'date':moment(_0x32e7a4[_0x36e4('0x5c')])[_0x36e4('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x36e4('0x50')](),'sender':_0x32e7a4[_0x36e4('0x5d')]===_0x36e4('0x69')?_0x32e7a4[_0x36e4('0x55')]?_0x32e7a4[_0x36e4('0x55')][_0x36e4('0x56')]:_0x36e4('0x6a'):_0x32e7a4[_0x36e4('0x58')][_0x36e4('0x59')]+(_0x32e7a4[_0x36e4('0x58')][_0x36e4('0x5a')]?'\x20'+_0x32e7a4['Contact'][_0x36e4('0x5a')]:''),'body':_0x32e7a4['body'],'direction':_0x32e7a4[_0x36e4('0x5d')]===_0x36e4('0x69')?'A':'C','secret':_0x32e7a4[_0x36e4('0x6b')],'read':_0x32e7a4[_0x36e4('0x5e')]};})[_0x36e4('0x6c')]()};return ejs[_0x36e4('0x6d')](path[_0x36e4('0x51')](config[_0x36e4('0x6e')],'server',_0x36e4('0x6f'),'downloadInteraction.ejs'),{'interaction':_0x306cf4})[_0x36e4('0x1b')](function(_0x296304){var _0x694c8a=path[_0x36e4('0x51')](_0x41a534,_0x36e4('0x70')+_0x179f65['id']+'-'+_0x397f02+_0x36e4('0x71'));var _0x5ada12={'path':_0x694c8a,'channel':_0x36e4('0x64'),'interactionId':_0x179f65['id']};return pdf[_0x36e4('0x72')](_0x296304,_0x5ada12);})['then'](function(){return new BPromise(function(_0x348711,_0x1335a3){zipdir(_0x41a534,{'saveTo':_0x189501},function(_0x2ee5e6,_0x4d7de7){if(_0x2ee5e6)return _0x1335a3(_0x2ee5e6);return _0x348711(_0x4d7de7);});})[_0x36e4('0x1b')](function(){return new BPromise(function(_0x4ccfb0,_0x71519d){rimraf(_0x41a534,function(_0x4e9b33){if(_0x4e9b33)_0x71519d(_0x4e9b33);return _0x4ccfb0();});});})[_0x36e4('0x1b')](function(){return _0x34ae37[_0x36e4('0x73')](_0x189501,_0x321e94,function(_0x55fd65){if(_0x55fd65){console[_0x36e4('0x74')](_0x36e4('0x75'),_0x55fd65);}else{fs[_0x36e4('0x76')](_0x189501);}});});});}else{return _0x34ae37[_0x36e4('0x11')](0xc8);}})[_0x36e4('0x28')](handleError(_0x34ae37,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 79d1f12..55a0d32 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 _0x5fdc=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','map'];(function(_0x5627ac,_0x487bbb){var _0x2748b9=function(_0x5843f4){while(--_0x5843f4){_0x5627ac['push'](_0x5627ac['shift']());}};_0x2748b9(++_0x487bbb);}(_0x5fdc,0x127));var _0xc5fd=function(_0x233708,_0x1e5461){_0x233708=_0x233708-0x0;var _0x111a6c=_0x5fdc[_0x233708];return _0x111a6c;};'use strict';var EventEmitter=require(_0xc5fd('0x0'));var SmsInteraction=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x2')];var SmsMessage=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5fd('0x4')](0x0);var events={'afterCreate':_0xc5fd('0x5'),'afterUpdate':_0xc5fd('0x6'),'afterDestroy':_0xc5fd('0x7')};function emitEvent(_0x1b6205){return function(_0xca27a0,_0xea5748,_0x44722b){_0xca27a0[_0xc5fd('0x8')]({'attributes':['id'],'raw':!![]})[_0xc5fd('0x9')](function(_0x5a2eb4){_0xca27a0['setDataValue']('Users',_0x5a2eb4[_0xc5fd('0xa')](function(_0x46bce3){return{'id':_0x46bce3['id']};}));return SmsMessage[_0xc5fd('0xb')]({'where':{'SmsInteractionId':_0xca27a0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5fd('0x9')](function(_0x4e6d35){_0xca27a0['setDataValue'](_0xc5fd('0xc'),_0x4e6d35[_0xc5fd('0xd')]);SmsInteractionEvents[_0xc5fd('0xe')](_0x1b6205+':'+_0xca27a0['id'],_0xca27a0);SmsInteractionEvents[_0xc5fd('0xe')](_0x1b6205,_0xca27a0);_0x44722b(null);})[_0xc5fd('0xf')](_0x44722b(null));};}for(var e in events){if(events[_0xc5fd('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xc5fd('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xef0f=['SmsInteraction','../../mysqldb','SmsMessage','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x1df803,_0x25192d){var _0x20ef12=function(_0xfc0101){while(--_0xfc0101){_0x1df803['push'](_0x1df803['shift']());}};_0x20ef12(++_0x25192d);}(_0xef0f,0x168));var _0xfef0=function(_0x4a34c5,_0x396ab0){_0x4a34c5=_0x4a34c5-0x0;var _0x360460=_0xef0f[_0x4a34c5];return _0x360460;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xfef0('0x1')];var SmsMessage=require(_0xfef0('0x2'))['db'][_0xfef0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfef0('0x4'),'afterUpdate':_0xfef0('0x5'),'afterDestroy':_0xfef0('0x6')};function emitEvent(_0x4e1af6){return function(_0x2a6fcf,_0x9b8b9e,_0x2697df){_0x2a6fcf[_0xfef0('0x7')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x8')](function(_0x11dfd7){_0x2a6fcf['setDataValue'](_0xfef0('0x9'),_0x11dfd7['map'](function(_0x82e37a){return{'id':_0x82e37a['id']};}));return SmsMessage[_0xfef0('0xa')]({'where':{'SmsInteractionId':_0x2a6fcf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfef0('0x8')](function(_0x2d42dc){_0x2a6fcf[_0xfef0('0xb')](_0xfef0('0xc'),_0x2d42dc[_0xfef0('0xd')]);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6+':'+_0x2a6fcf['id'],_0x2a6fcf);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6,_0x2a6fcf);_0x2697df(null);})[_0xfef0('0xf')](_0x2697df(null));};}for(var e in events){if(events[_0xfef0('0x10')](e)){var event=events[e];SmsInteraction[_0xfef0('0x11')](e,emitEvent(event));}}module[_0xfef0('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index fde5b5b..0029a97 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 _0x9486=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x3da8e3,_0x5785ba){var _0x5ce634=function(_0x48027e){while(--_0x48027e){_0x3da8e3['push'](_0x3da8e3['shift']());}};_0x5ce634(++_0x5785ba);}(_0x9486,0xca));var _0x6948=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9486[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x6948('0x0'));var util=require(_0x6948('0x1'));var logger=require(_0x6948('0x2'))('api');var moment=require(_0x6948('0x3'));var BPromise=require(_0x6948('0x4'));var rp=require(_0x6948('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6948('0x6'));var attributes=require(_0x6948('0x7'));module[_0x6948('0x8')]=function(_0x496445,_0x1fbc87){return _0x496445[_0x6948('0x9')](_0x6948('0xa'),attributes,{'tableName':_0x6948('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a5fa0,_0x3c670d,_0x1c3947){if(_0x1a5fa0[_0x6948('0xc')](_0x6948('0xd'))){_0x1a5fa0[_0x6948('0xe')]=moment()[_0x6948('0xf')](_0x6948('0x10'));}_0x1c3947(null,_0x1a5fa0);}}});}; \ No newline at end of file +var _0xa1df=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x249e6e,_0x2249d6){var _0x4d3d76=function(_0x55a321){while(--_0x55a321){_0x249e6e['push'](_0x249e6e['shift']());}};_0x4d3d76(++_0x2249d6);}(_0xa1df,0x179));var _0xfa1d=function(_0x22156e,_0xa2fb5a){_0x22156e=_0x22156e-0x0;var _0x38b264=_0xa1df[_0x22156e];return _0x38b264;};'use strict';var _=require('lodash');var util=require(_0xfa1d('0x0'));var logger=require(_0xfa1d('0x1'))(_0xfa1d('0x2'));var moment=require(_0xfa1d('0x3'));var BPromise=require(_0xfa1d('0x4'));var rp=require(_0xfa1d('0x5'));var fs=require('fs');var path=require(_0xfa1d('0x6'));var rimraf=require(_0xfa1d('0x7'));var config=require(_0xfa1d('0x8'));var attributes=require(_0xfa1d('0x9'));module[_0xfa1d('0xa')]=function(_0x4194ef,_0x1d1785){return _0x4194ef[_0xfa1d('0xb')](_0xfa1d('0xc'),attributes,{'tableName':_0xfa1d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4437e2,_0x11878b,_0x32e487){if(_0x4437e2['changed'](_0xfa1d('0xe'))){_0x4437e2[_0xfa1d('0xf')]=moment()[_0xfa1d('0x10')](_0xfa1d('0x11'));}_0x32e487(null,_0x4437e2);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 59ba8a0..cd47373 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 _0xbfd4=['stringify','AddTagsToSmsInteraction','find','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','defaults','redis','localhost','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where'];(function(_0x5df033,_0x29458b){var _0x445829=function(_0x2c795b){while(--_0x2c795b){_0x5df033['push'](_0x5df033['shift']());}};_0x445829(++_0x29458b);}(_0xbfd4,0x1aa));var _0x4bfd=function(_0x43926d,_0x335f6b){_0x43926d=_0x43926d-0x0;var _0x596e4c=_0xbfd4[_0x43926d];return _0x596e4c;};'use strict';var _=require(_0x4bfd('0x0'));var util=require(_0x4bfd('0x1'));var moment=require(_0x4bfd('0x2'));var BPromise=require(_0x4bfd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4bfd('0x4'));var db=require(_0x4bfd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bfd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4bfd('0x7'));var client=jayson[_0x4bfd('0x8')]['http']({'port':0x232a});config['redis']=_[_0x4bfd('0x9')](config[_0x4bfd('0xa')],{'host':_0x4bfd('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4bfd('0xc'))['register'](socket);function respondWithRpcPromise(_0x48870a,_0x43a814,_0x3f3974){return new BPromise(function(_0x30ddbb,_0x53475a){return client[_0x4bfd('0xd')](_0x48870a,_0x3f3974)[_0x4bfd('0xe')](function(_0x53f035){logger[_0x4bfd('0xf')](_0x4bfd('0x10'),_0x43a814,_0x4bfd('0x11'));logger[_0x4bfd('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x43a814,_0x4bfd('0x11'),JSON['stringify'](_0x53f035));if(_0x53f035['error']){if(_0x53f035['error']['code']===0x1f4){logger[_0x4bfd('0x13')](_0x4bfd('0x10'),_0x43a814,_0x53f035['error'][_0x4bfd('0x14')]);return _0x53475a(_0x53f035[_0x4bfd('0x13')]['message']);}logger[_0x4bfd('0x13')](_0x4bfd('0x10'),_0x43a814,_0x53f035[_0x4bfd('0x13')][_0x4bfd('0x14')]);return _0x30ddbb(_0x53f035['error'][_0x4bfd('0x14')]);}else{logger[_0x4bfd('0xf')](_0x4bfd('0x10'),_0x43a814,_0x4bfd('0x11'));_0x30ddbb(_0x53f035[_0x4bfd('0x15')][_0x4bfd('0x14')]);}})[_0x4bfd('0x16')](function(_0x1f1019){logger[_0x4bfd('0x13')](_0x4bfd('0x10'),_0x43a814,_0x1f1019);_0x53475a(_0x1f1019);});});}exports[_0x4bfd('0x17')]=function(_0xbde7b5){var _0x54fb42=this;return new Promise(function(_0x28cb73,_0xd1c8ac){return db[_0x4bfd('0x18')][_0x4bfd('0x19')](_0xbde7b5[_0x4bfd('0x1a')],{'raw':_0xbde7b5[_0x4bfd('0x1b')]?_0xbde7b5[_0x4bfd('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbde7b5[_0x4bfd('0x1b')]?_0xbde7b5[_0x4bfd('0x1b')][_0x4bfd('0x1c')]||null:null,'attributes':_0xbde7b5[_0x4bfd('0x1b')]?_0xbde7b5[_0x4bfd('0x1b')]['attributes']||null:null,'limit':_0xbde7b5[_0x4bfd('0x1b')]?_0xbde7b5[_0x4bfd('0x1b')]['limit']||null:null})[_0x4bfd('0xe')](function(_0x219968){logger[_0x4bfd('0xf')](_0x4bfd('0x17'),_0xbde7b5);logger[_0x4bfd('0x12')](_0x4bfd('0x17'),_0xbde7b5,JSON[_0x4bfd('0x1d')](_0x219968));_0x28cb73(_0x219968);})['catch'](function(_0x4bef8c){logger[_0x4bfd('0x13')](_0x4bfd('0x17'),_0x4bef8c[_0x4bfd('0x14')],_0xbde7b5);_0xd1c8ac(_0x54fb42[_0x4bfd('0x13')](0x1f4,_0x4bef8c[_0x4bfd('0x14')]));});});};exports[_0x4bfd('0x1e')]=function(_0x5338f3){return new Promise(function(_0x1762c4,_0x5cb7eb){return db[_0x4bfd('0x18')][_0x4bfd('0x1f')]({'where':_0x5338f3['options']?_0x5338f3[_0x4bfd('0x1b')][_0x4bfd('0x1c')]||null:null})[_0x4bfd('0xe')](function(_0x496f5e){if(_0x496f5e){return _0x496f5e['addTags'](_0x5338f3[_0x4bfd('0x1a')][_0x4bfd('0x20')],_[_0x4bfd('0x21')](_0x5338f3['body'],['ids','id'])||{});}})['spread'](function(_0x598fc4){logger[_0x4bfd('0xf')](_0x4bfd('0x22'),_0x5338f3);logger['debug'](_0x4bfd('0x22'),_0x5338f3,JSON[_0x4bfd('0x1d')](_0x598fc4));_0x1762c4(_0x598fc4);})[_0x4bfd('0x16')](function(_0x52da4a){logger['error'](_0x4bfd('0x22'),_0x52da4a[_0x4bfd('0x14')],_0x5338f3);_0x5cb7eb(_this['error'](0x1f4,_0x52da4a[_0x4bfd('0x14')]));});});}; \ No newline at end of file +var _0x0c69=['attributes','limit','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where'];(function(_0x4e2d03,_0x1f7247){var _0x3f42a1=function(_0x9fb0c6){while(--_0x9fb0c6){_0x4e2d03['push'](_0x4e2d03['shift']());}};_0x3f42a1(++_0x1f7247);}(_0x0c69,0x11c));var _0x90c6=function(_0x2f022a,_0x8b2d98){_0x2f022a=_0x2f022a-0x0;var _0x211ec4=_0x0c69[_0x2f022a];return _0x211ec4;};'use strict';var _=require(_0x90c6('0x0'));var util=require(_0x90c6('0x1'));var moment=require(_0x90c6('0x2'));var BPromise=require(_0x90c6('0x3'));var rs=require(_0x90c6('0x4'));var fs=require('fs');var Redis=require(_0x90c6('0x5'));var db=require(_0x90c6('0x6'))['db'];var utils=require(_0x90c6('0x7'));var logger=require(_0x90c6('0x8'))(_0x90c6('0x9'));var config=require('../../config/environment');var jayson=require(_0x90c6('0xa'));var client=jayson[_0x90c6('0xb')][_0x90c6('0xc')]({'port':0x232a});config[_0x90c6('0xd')]=_[_0x90c6('0xe')](config[_0x90c6('0xd')],{'host':_0x90c6('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90c6('0xd')]));require(_0x90c6('0x10'))[_0x90c6('0x11')](socket);function respondWithRpcPromise(_0x90120b,_0x697c93,_0x3ae5c9){return new BPromise(function(_0x2c5d27,_0x2fad32){return client[_0x90c6('0x12')](_0x90120b,_0x3ae5c9)[_0x90c6('0x13')](function(_0x3bcb04){logger[_0x90c6('0x14')](_0x90c6('0x15'),_0x697c93,'request\x20sent');logger[_0x90c6('0x16')](_0x90c6('0x17'),_0x697c93,_0x90c6('0x18'),JSON[_0x90c6('0x19')](_0x3bcb04));if(_0x3bcb04['error']){if(_0x3bcb04[_0x90c6('0x1a')][_0x90c6('0x1b')]===0x1f4){logger[_0x90c6('0x1a')](_0x90c6('0x15'),_0x697c93,_0x3bcb04[_0x90c6('0x1a')][_0x90c6('0x1c')]);return _0x2fad32(_0x3bcb04[_0x90c6('0x1a')][_0x90c6('0x1c')]);}logger['error'](_0x90c6('0x15'),_0x697c93,_0x3bcb04[_0x90c6('0x1a')][_0x90c6('0x1c')]);return _0x2c5d27(_0x3bcb04[_0x90c6('0x1a')][_0x90c6('0x1c')]);}else{logger['info'](_0x90c6('0x15'),_0x697c93,_0x90c6('0x18'));_0x2c5d27(_0x3bcb04[_0x90c6('0x1d')][_0x90c6('0x1c')]);}})[_0x90c6('0x1e')](function(_0x2263c9){logger[_0x90c6('0x1a')]('SmsInteraction,\x20%s,\x20%s',_0x697c93,_0x2263c9);_0x2fad32(_0x2263c9);});});}exports[_0x90c6('0x1f')]=function(_0x338983){var _0x18d511=this;return new Promise(function(_0x251986,_0x466b9f){return db[_0x90c6('0x20')][_0x90c6('0x21')](_0x338983[_0x90c6('0x22')],{'raw':_0x338983[_0x90c6('0x23')]?_0x338983['options'][_0x90c6('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x338983[_0x90c6('0x23')]?_0x338983[_0x90c6('0x23')][_0x90c6('0x25')]||null:null,'attributes':_0x338983[_0x90c6('0x23')]?_0x338983[_0x90c6('0x23')][_0x90c6('0x26')]||null:null,'limit':_0x338983[_0x90c6('0x23')]?_0x338983[_0x90c6('0x23')][_0x90c6('0x27')]||null:null})[_0x90c6('0x13')](function(_0xae6dbc){logger[_0x90c6('0x14')]('UpdateSmsInteraction',_0x338983);logger[_0x90c6('0x16')](_0x90c6('0x1f'),_0x338983,JSON[_0x90c6('0x19')](_0xae6dbc));_0x251986(_0xae6dbc);})[_0x90c6('0x1e')](function(_0x148a81){logger[_0x90c6('0x1a')](_0x90c6('0x1f'),_0x148a81[_0x90c6('0x1c')],_0x338983);_0x466b9f(_0x18d511[_0x90c6('0x1a')](0x1f4,_0x148a81['message']));});});};exports[_0x90c6('0x28')]=function(_0x4e7e9f){return new Promise(function(_0x3ac6f9,_0x37efa1){return db[_0x90c6('0x20')]['find']({'where':_0x4e7e9f[_0x90c6('0x23')]?_0x4e7e9f['options']['where']||null:null})[_0x90c6('0x13')](function(_0x4e8eee){if(_0x4e8eee){return _0x4e8eee[_0x90c6('0x29')](_0x4e7e9f[_0x90c6('0x22')][_0x90c6('0x2a')],_[_0x90c6('0x2b')](_0x4e7e9f[_0x90c6('0x22')],[_0x90c6('0x2a'),'id'])||{});}})[_0x90c6('0x2c')](function(_0x3ed9f8){logger[_0x90c6('0x14')]('AddTags',_0x4e7e9f);logger[_0x90c6('0x16')](_0x90c6('0x2d'),_0x4e7e9f,JSON[_0x90c6('0x19')](_0x3ed9f8));_0x3ac6f9(_0x3ed9f8);})[_0x90c6('0x1e')](function(_0x179207){logger[_0x90c6('0x1a')](_0x90c6('0x2d'),_0x179207[_0x90c6('0x1c')],_0x4e7e9f);_0x37efa1(_this['error'](0x1f4,_0x179207[_0x90c6('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index fb4c6de..56f8035 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 _0x8555=['save','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8555,0x1cf));var _0x5855=function(_0x22310b,_0x26e861){_0x22310b=_0x22310b-0x0;var _0xeb089e=_0x8555[_0x22310b];return _0xeb089e;};'use strict';var SmsInteractionEvents=require(_0x5855('0x0'));var events=[_0x5855('0x1'),'remove',_0x5855('0x2')];function createListener(_0x26e021,_0x23f31a){return function(_0x37e4b7){_0x23f31a[_0x5855('0x3')](_0x26e021,_0x37e4b7);};}function removeListener(_0x3eeab6,_0x1ead0a){return function(){SmsInteractionEvents[_0x5855('0x4')](_0x3eeab6,_0x1ead0a);};}exports[_0x5855('0x5')]=function(_0x5523ac){for(var _0x965d17=0x0,_0x3de12f=events[_0x5855('0x6')];_0x965d17<_0x3de12f;_0x965d17++){var _0x435ede=events[_0x965d17];var _0x595521=createListener(_0x5855('0x7')+_0x435ede,_0x5523ac);SmsInteractionEvents['on'](_0x435ede,_0x595521);}}; \ No newline at end of file +var _0xcaee=['save','remove','update','emit','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x4165c3,_0x3401bd){var _0x3e6900=function(_0x14d8e2){while(--_0x14d8e2){_0x4165c3['push'](_0x4165c3['shift']());}};_0x3e6900(++_0x3401bd);}(_0xcaee,0x157));var _0xecae=function(_0x48bae4,_0x3502fe){_0x48bae4=_0x48bae4-0x0;var _0x210760=_0xcaee[_0x48bae4];return _0x210760;};'use strict';var SmsInteractionEvents=require(_0xecae('0x0'));var events=[_0xecae('0x1'),_0xecae('0x2'),_0xecae('0x3')];function createListener(_0x2cee19,_0x235cb9){return function(_0xc0d075){_0x235cb9[_0xecae('0x4')](_0x2cee19,_0xc0d075);};}function removeListener(_0x2bc2b0,_0x3d5ee5){return function(){SmsInteractionEvents[_0xecae('0x5')](_0x2bc2b0,_0x3d5ee5);};}exports['register']=function(_0x42128b){for(var _0x8f138f=0x0,_0x177513=events[_0xecae('0x6')];_0x8f138f<_0x177513;_0x8f138f++){var _0x2fb0d4=events[_0x8f138f];var _0x60e452=createListener(_0xecae('0x7')+_0x2fb0d4,_0x42128b);SmsInteractionEvents['on'](_0x2fb0d4,_0x60e452);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a6ab5d2..cda1c7f 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 _0x7341=['update','/:id/reject','reject','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','sms','create','status','put'];(function(_0x1a8bed,_0x181288){var _0x5a00e4=function(_0x418740){while(--_0x418740){_0x1a8bed['push'](_0x1a8bed['shift']());}};_0x5a00e4(++_0x181288);}(_0x7341,0x1d1));var _0x1734=function(_0x26437b,_0x183315){_0x26437b=_0x26437b-0x0;var _0x452c52=_0x7341[_0x26437b];return _0x452c52;};'use strict';var multer=require(_0x1734('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1734('0x1'));var express=require('express');var router=express[_0x1734('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1734('0x3'));var interaction=require(_0x1734('0x4'));var config=require(_0x1734('0x5'));var controller=require(_0x1734('0x6'));router[_0x1734('0x7')]('/',auth[_0x1734('0x8')](),controller['index']);router['get'](_0x1734('0x9'),auth[_0x1734('0x8')](),controller[_0x1734('0xa')]);router['get'](_0x1734('0xb'),auth[_0x1734('0x8')](),controller[_0x1734('0xc')]);router[_0x1734('0xd')]('/',auth[_0x1734('0x8')](),interaction[_0x1734('0xe')](_0x1734('0xf'),'smsmessage:create'),controller[_0x1734('0x10')]);router['post']('/:id/status',controller[_0x1734('0x11')]);router[_0x1734('0x12')](_0x1734('0xb'),auth[_0x1734('0x8')](),controller[_0x1734('0x13')]);router['put']('/:id/accept',auth[_0x1734('0x8')](),controller['accept']);router['put'](_0x1734('0x14'),auth['isAuthenticated'](),controller[_0x1734('0x15')]);router['delete'](_0x1734('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6169=['delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','index','isAuthenticated','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject'];(function(_0x5c24f4,_0x160bd4){var _0x6d7c95=function(_0x503445){while(--_0x503445){_0x5c24f4['push'](_0x5c24f4['shift']());}};_0x6d7c95(++_0x160bd4);}(_0x6169,0x162));var _0x9616=function(_0x47e8d8,_0x178188){_0x47e8d8=_0x47e8d8-0x0;var _0x1d02dc=_0x6169[_0x47e8d8];return _0x1d02dc;};'use strict';var multer=require(_0x9616('0x0'));var util=require(_0x9616('0x1'));var path=require('path');var timeout=require(_0x9616('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9616('0x3'));var auth=require(_0x9616('0x4'));var interaction=require(_0x9616('0x5'));var config=require('../../config/environment');var controller=require(_0x9616('0x6'));router[_0x9616('0x7')]('/',auth['isAuthenticated'](),controller[_0x9616('0x8')]);router[_0x9616('0x7')]('/describe',auth[_0x9616('0x9')](),controller['describe']);router[_0x9616('0x7')](_0x9616('0xa'),auth[_0x9616('0x9')](),controller[_0x9616('0xb')]);router[_0x9616('0xc')]('/',auth['isAuthenticated'](),interaction[_0x9616('0xd')](_0x9616('0xe'),_0x9616('0xf')),controller[_0x9616('0x10')]);router[_0x9616('0xc')](_0x9616('0x11'),controller[_0x9616('0x12')]);router[_0x9616('0x13')](_0x9616('0xa'),auth[_0x9616('0x9')](),controller[_0x9616('0x14')]);router[_0x9616('0x13')](_0x9616('0x15'),auth[_0x9616('0x9')](),controller[_0x9616('0x16')]);router[_0x9616('0x13')](_0x9616('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0x9616('0x18')](_0x9616('0xa'),auth['isAuthenticated'](),controller[_0x9616('0x19')]);module[_0x9616('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 4a3848e..ce8e5af 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 _0xd73c=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x255754,_0x3945c4){var _0x3bab9c=function(_0xcf700c){while(--_0xcf700c){_0x255754['push'](_0x255754['shift']());}};_0x3bab9c(++_0x3945c4);}(_0xd73c,0x134));var _0xcd73=function(_0x5c6b8e,_0x320a0e){_0x5c6b8e=_0x5c6b8e-0x0;var _0x226933=_0xd73c[_0x5c6b8e];return _0x226933;};'use strict';var Sequelize=require(_0xcd73('0x0'));module[_0xcd73('0x1')]={'body':{'type':Sequelize[_0xcd73('0x2')](_0xcd73('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xcd73('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd73('0x5')]('in',_0xcd73('0x6')),'defaultValue':_0xcd73('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcd73('0x7')](0xbe)},'phone':{'type':Sequelize[_0xcd73('0x7')]},'readAt':{'type':Sequelize[_0xcd73('0x8')]},'secret':{'type':Sequelize[_0xcd73('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcd73('0x7')]},'providerResponse':{'type':Sequelize[_0xcd73('0x2')]}}; \ No newline at end of file +var _0x06a5=['STRING','sequelize','TEXT','BOOLEAN','ENUM','out'];(function(_0x221b1a,_0x2c81a1){var _0x4ce188=function(_0x13d583){while(--_0x13d583){_0x221b1a['push'](_0x221b1a['shift']());}};_0x4ce188(++_0x2c81a1);}(_0x06a5,0xfd));var _0x506a=function(_0x54afe3,_0x258ce5){_0x54afe3=_0x54afe3-0x0;var _0x3e76d6=_0x06a5[_0x54afe3];return _0x3e76d6;};'use strict';var Sequelize=require(_0x506a('0x0'));module['exports']={'body':{'type':Sequelize[_0x506a('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x506a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x506a('0x3')]('in',_0x506a('0x4')),'defaultValue':_0x506a('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x506a('0x5')](0xbe)},'phone':{'type':Sequelize[_0x506a('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x506a('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x506a('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index ac76f56..7ef81c3 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 _0x2fc9=['YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','rejectMessage','ContactId','SIP/%s','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','plivio','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','map','SmsMessage','fieldName','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','keys','rawAttributes','find','create','body','params','sms-interactions','sms','read','format'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x2fc9,0xc2));var _0x92fc=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x2fc9[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92fc('0x0'));var zipdir=require(_0x92fc('0x1'));var jsonpatch=require(_0x92fc('0x2'));var rp=require(_0x92fc('0x3'));var moment=require(_0x92fc('0x4'));var BPromise=require(_0x92fc('0x5'));var Mustache=require(_0x92fc('0x6'));var util=require(_0x92fc('0x7'));var path=require(_0x92fc('0x8'));var sox=require(_0x92fc('0x9'));var csv=require(_0x92fc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x92fc('0xb'));var crypto=require(_0x92fc('0xc'));var jsforce=require(_0x92fc('0xd'));var deskjs=require(_0x92fc('0xe'));var toCsv=require(_0x92fc('0xa'));var querystring=require(_0x92fc('0xf'));var Papa=require(_0x92fc('0x10'));var Redis=require('ioredis');var authService=require(_0x92fc('0x11'));var qs=require(_0x92fc('0x12'));var as=require(_0x92fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92fc('0x14'))(_0x92fc('0x15'));var utils=require(_0x92fc('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x92fc('0x17'))['db'];config[_0x92fc('0x18')]=_['defaults'](config[_0x92fc('0x18')],{'host':_0x92fc('0x19'),'port':0x18eb});var socket=require(_0x92fc('0x1a'))(new Redis(config[_0x92fc('0x18')]));require(_0x92fc('0x1b'))['register'](socket);var jayson=require(_0x92fc('0x1c'));var client=jayson[_0x92fc('0x1d')][_0x92fc('0x1e')]({'port':0x232c});var client9002=jayson[_0x92fc('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c45f3,_0x111f42,_0x6de681,_0x510e12){return new BPromise(function(_0x3370c9,_0x1eb0ec){var _0x90f874=_0x510e12||client;return _0x90f874['request'](_0x4c45f3,_0x6de681)[_0x92fc('0x1f')](function(_0x346ee8){logger[_0x92fc('0x20')](_0x92fc('0x21'),_0x111f42,_0x92fc('0x22'));logger[_0x92fc('0x23')](_0x92fc('0x24'),_0x111f42,_0x92fc('0x22'),JSON['stringify'](_0x346ee8));if(_0x346ee8[_0x92fc('0x25')]){if(_0x346ee8['error'][_0x92fc('0x26')]===0x1f4){logger[_0x92fc('0x25')](_0x92fc('0x21'),_0x111f42,_0x346ee8[_0x92fc('0x25')][_0x92fc('0x27')]);return _0x1eb0ec(_0x346ee8[_0x92fc('0x25')][_0x92fc('0x27')]);}logger['error'](_0x92fc('0x21'),_0x111f42,_0x346ee8[_0x92fc('0x25')][_0x92fc('0x27')]);return _0x3370c9(_0x346ee8['error'][_0x92fc('0x27')]);}else{logger[_0x92fc('0x20')](_0x92fc('0x21'),_0x111f42,'request\x20sent');_0x3370c9(_0x346ee8[_0x92fc('0x28')][_0x92fc('0x27')]);}})[_0x92fc('0x29')](function(_0x4052d5){logger[_0x92fc('0x25')](_0x92fc('0x21'),_0x111f42,_0x4052d5);_0x1eb0ec(_0x4052d5);});});}function respondWithStatusCode(_0x8fbd62,_0x27346a){_0x27346a=_0x27346a||0xcc;return function(_0x186d35){if(_0x186d35){return _0x8fbd62[_0x92fc('0x2a')](_0x27346a);}return _0x8fbd62[_0x92fc('0x2b')](_0x27346a)[_0x92fc('0x2c')]();};}function respondWithResult(_0x215e98,_0x4ef103){_0x4ef103=_0x4ef103||0xc8;return function(_0x373851){if(_0x373851){return _0x215e98[_0x92fc('0x2b')](_0x4ef103)[_0x92fc('0x2d')](_0x373851);}};}function respondWithFilteredResult(_0x391c71,_0x7cb643){return function(_0x32a54b){if(_0x32a54b){var _0x129bcf=typeof _0x7cb643['offset']===_0x92fc('0x2e')&&typeof _0x7cb643[_0x92fc('0x2f')]===_0x92fc('0x2e');var _0x57ad3a=_0x32a54b[_0x92fc('0x30')];var _0x1607ab=_0x129bcf?0x0:_0x7cb643[_0x92fc('0x31')];var _0x265b38=_0x129bcf?_0x32a54b[_0x92fc('0x30')]:_0x7cb643['offset']+_0x7cb643[_0x92fc('0x2f')];var _0x10b687;if(_0x265b38>=_0x57ad3a){_0x265b38=_0x57ad3a;_0x10b687=0xc8;}else{_0x10b687=0xce;}_0x391c71[_0x92fc('0x2b')](_0x10b687);return _0x391c71['set'](_0x92fc('0x32'),_0x1607ab+'-'+_0x265b38+'/'+_0x57ad3a)[_0x92fc('0x2d')](_0x32a54b);}return null;};}function patchUpdates(_0x31d5f9){return function(_0x281c92){try{jsonpatch[_0x92fc('0x33')](_0x281c92,_0x31d5f9,!![]);}catch(_0x4b1ae8){return BPromise[_0x92fc('0x34')](_0x4b1ae8);}return _0x281c92[_0x92fc('0x35')]();};}function saveUpdates(_0x16a0fa,_0x2f0e45){return function(_0x4e781c){if(_0x4e781c){return _0x4e781c[_0x92fc('0x36')](_0x16a0fa)['then'](function(_0x5e3202){return _0x5e3202;});}return null;};}function removeEntity(_0xff7992,_0x3fc0ba){return function(_0x2e0774){if(_0x2e0774){return _0x2e0774[_0x92fc('0x37')]()[_0x92fc('0x1f')](function(){_0xff7992['status'](0xcc)[_0x92fc('0x2c')]();});}};}function handleEntityNotFound(_0x93aab7,_0x306be5){return function(_0x42e849){if(!_0x42e849){_0x93aab7['sendStatus'](0x194);}return _0x42e849;};}function handleError(_0x971c24,_0x1f62c6){_0x1f62c6=_0x1f62c6||0x1f4;return function(_0x189950){logger[_0x92fc('0x25')](_0x189950[_0x92fc('0x38')]);if(_0x189950[_0x92fc('0x39')]){delete _0x189950[_0x92fc('0x39')];}_0x971c24['status'](_0x1f62c6)['send'](_0x189950);};}exports['index']=function(_0x121fc3,_0x6e2b42){var _0x2e3230={},_0x5ef89c={},_0x434fa4={'count':0x0,'rows':[]};var _0x1fc3c3=_[_0x92fc('0x3a')](db[_0x92fc('0x3b')]['rawAttributes'],function(_0x459eba){return{'name':_0x459eba[_0x92fc('0x3c')],'type':_0x459eba['type']['key']};});_0x5ef89c['model']=_[_0x92fc('0x3a')](_0x1fc3c3,_0x92fc('0x39'));_0x5ef89c[_0x92fc('0x3d')]=_['keys'](_0x121fc3[_0x92fc('0x3d')]);_0x5ef89c['filters']=_[_0x92fc('0x3e')](_0x5ef89c[_0x92fc('0x3f')],_0x5ef89c[_0x92fc('0x3d')]);_0x2e3230[_0x92fc('0x40')]=_['intersection'](_0x5ef89c[_0x92fc('0x3f')],qs[_0x92fc('0x41')](_0x121fc3[_0x92fc('0x3d')][_0x92fc('0x41')]));_0x2e3230['attributes']=_0x2e3230[_0x92fc('0x40')]['length']?_0x2e3230[_0x92fc('0x40')]:_0x5ef89c[_0x92fc('0x3f')];if(!_0x121fc3['query'][_0x92fc('0x42')](_0x92fc('0x43'))){_0x2e3230[_0x92fc('0x2f')]=qs[_0x92fc('0x2f')](_0x121fc3[_0x92fc('0x3d')][_0x92fc('0x2f')]);_0x2e3230[_0x92fc('0x31')]=qs[_0x92fc('0x31')](_0x121fc3['query'][_0x92fc('0x31')]);}_0x2e3230[_0x92fc('0x44')]=qs['sort'](_0x121fc3[_0x92fc('0x3d')][_0x92fc('0x45')]);_0x2e3230[_0x92fc('0x46')]=qs[_0x92fc('0x47')](_[_0x92fc('0x48')](_0x121fc3[_0x92fc('0x3d')],_0x5ef89c['filters']),_0x1fc3c3);if(_0x121fc3['query'][_0x92fc('0x49')]){_0x2e3230[_0x92fc('0x46')]=_[_0x92fc('0x4a')](_0x2e3230[_0x92fc('0x46')],{'$or':_[_0x92fc('0x3a')](_0x1fc3c3,function(_0x453f0a){if(_0x453f0a[_0x92fc('0x4b')]!=='VIRTUAL'){var _0x43d0f9={};_0x43d0f9[_0x453f0a[_0x92fc('0x39')]]={'$like':'%'+_0x121fc3[_0x92fc('0x3d')][_0x92fc('0x49')]+'%'};return _0x43d0f9;}})});}_0x2e3230=_['merge']({},_0x2e3230,_0x121fc3[_0x92fc('0x4c')]);var _0x42f97c={'where':_0x2e3230[_0x92fc('0x46')]};return db[_0x92fc('0x3b')]['count'](_0x42f97c)['then'](function(_0x24a86f){_0x434fa4['count']=_0x24a86f;if(_0x121fc3[_0x92fc('0x3d')][_0x92fc('0x4d')]){_0x2e3230[_0x92fc('0x4e')]=[{'all':!![]}];}return db[_0x92fc('0x3b')][_0x92fc('0x4f')](_0x2e3230);})[_0x92fc('0x1f')](function(_0x9e5cc5){_0x434fa4['rows']=_0x9e5cc5;return _0x434fa4;})[_0x92fc('0x1f')](respondWithFilteredResult(_0x6e2b42,_0x2e3230))[_0x92fc('0x29')](handleError(_0x6e2b42,null));};exports['show']=function(_0x28ad1c,_0x509464){var _0x2777db={'raw':!![],'where':{'id':_0x28ad1c['params']['id']}},_0x4f3e0={};_0x4f3e0['model']=_[_0x92fc('0x50')](db[_0x92fc('0x3b')][_0x92fc('0x51')]);_0x4f3e0[_0x92fc('0x3d')]=_['keys'](_0x28ad1c[_0x92fc('0x3d')]);_0x4f3e0[_0x92fc('0x47')]=_[_0x92fc('0x3e')](_0x4f3e0[_0x92fc('0x3f')],_0x4f3e0[_0x92fc('0x3d')]);_0x2777db[_0x92fc('0x40')]=_['intersection'](_0x4f3e0['model'],qs['fields'](_0x28ad1c[_0x92fc('0x3d')][_0x92fc('0x41')]));_0x2777db['attributes']=_0x2777db[_0x92fc('0x40')]['length']?_0x2777db['attributes']:_0x4f3e0[_0x92fc('0x3f')];if(_0x28ad1c[_0x92fc('0x3d')][_0x92fc('0x4d')]){_0x2777db[_0x92fc('0x4e')]=[{'all':!![]}];}_0x2777db=_[_0x92fc('0x4a')]({},_0x2777db,_0x28ad1c[_0x92fc('0x4c')]);return db[_0x92fc('0x3b')][_0x92fc('0x52')](_0x2777db)[_0x92fc('0x1f')](handleEntityNotFound(_0x509464,null))['then'](respondWithResult(_0x509464,null))['catch'](handleError(_0x509464,null));};exports[_0x92fc('0x53')]=function(_0x18c7cf,_0x3a5e72){return db['SmsMessage'][_0x92fc('0x53')](_0x18c7cf['body'],{})[_0x92fc('0x1f')](respondWithResult(_0x3a5e72,0xc9))[_0x92fc('0x29')](handleError(_0x3a5e72,null));};exports[_0x92fc('0x36')]=function(_0x5c9197,_0x4fe5be){if(_0x5c9197['body']['id']){delete _0x5c9197[_0x92fc('0x54')]['id'];}return db['SmsMessage'][_0x92fc('0x52')]({'where':{'id':_0x5c9197[_0x92fc('0x55')]['id']}})['then'](handleEntityNotFound(_0x4fe5be,null))[_0x92fc('0x1f')](saveUpdates(_0x5c9197[_0x92fc('0x54')],null))[_0x92fc('0x1f')](respondWithResult(_0x4fe5be,null))[_0x92fc('0x29')](handleError(_0x4fe5be,null));};exports[_0x92fc('0x37')]=function(_0x181dc4,_0x34d9cc){return db[_0x92fc('0x3b')][_0x92fc('0x52')]({'where':{'id':_0x181dc4[_0x92fc('0x55')]['id']}})[_0x92fc('0x1f')](handleEntityNotFound(_0x34d9cc,null))[_0x92fc('0x1f')](removeEntity(_0x34d9cc,null))[_0x92fc('0x29')](handleError(_0x34d9cc,null));};exports['describe']=function(_0x3ef611,_0x4b6101){return db[_0x92fc('0x3b')]['describe']()['then'](respondWithResult(_0x4b6101,null))[_0x92fc('0x29')](handleError(_0x4b6101,null));};var interaction_log=require('../../config/logger')(_0x92fc('0x56'));exports['accept']=function(_0x55da06,_0x319c2a,_0x3d47c5){var _0x16a180={'agent':{},'channel':_0x92fc('0x57')};if(_0x55da06[_0x92fc('0x54')]['id']){delete _0x55da06[_0x92fc('0x54')]['id'];}_0x55da06[_0x92fc('0x54')][_0x92fc('0x58')]=!![];_0x55da06['body']['readAt']=moment()[_0x92fc('0x59')](_0x92fc('0x5a'));_0x55da06[_0x92fc('0x54')][_0x92fc('0x5b')]=_0x55da06[_0x92fc('0x54')][_0x92fc('0x5b')]||_0x55da06[_0x92fc('0x5c')]['id'];_0x16a180['agent']['id']=_0x55da06['body'][_0x92fc('0x5b')];return db[_0x92fc('0x3b')][_0x92fc('0x52')]({'where':{'id':_0x55da06[_0x92fc('0x55')]['id'],'UserId':null}})[_0x92fc('0x1f')](handleEntityNotFound(_0x319c2a,null))[_0x92fc('0x1f')](saveUpdates(_0x55da06[_0x92fc('0x54')],null))[_0x92fc('0x1f')](function(_0x422f85){if(_0x422f85){_0x16a180[_0x92fc('0x27')]=_0x422f85[_0x92fc('0x5d')]({'plain':!![]});return db[_0x92fc('0x5e')][_0x92fc('0x52')]({'where':{'id':_0x422f85[_0x92fc('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x319c2a,null))[_0x92fc('0x1f')](function(_0x58d417){if(_0x58d417){return _0x58d417['update']({'UserId':_0x55da06[_0x92fc('0x54')][_0x92fc('0x5b')],'read1stAt':_[_0x92fc('0x60')](_0x58d417[_0x92fc('0x61')])?moment()[_0x92fc('0x59')](_0x92fc('0x5a')):undefined});}return null;})['then'](function(_0xdf6a47){if(_0xdf6a47){_0x16a180['interaction']=_0xdf6a47[_0x92fc('0x5d')]({'plain':!![]});interaction_log[_0x92fc('0x20')](_0x92fc('0x62'),_0x55da06[_0x92fc('0x5c')]['id'],_0x55da06[_0x92fc('0x5c')][_0x92fc('0x39')],_0x55da06['user'][_0x92fc('0x63')],_0x16a180[_0x92fc('0x64')]['id'],_0x55da06[_0x92fc('0x54')]?JSON[_0x92fc('0x65')](_0x55da06[_0x92fc('0x54')]):'null');return respondWithRpcPromise(_0x92fc('0x66'),_0x92fc('0x67'),_0x16a180);}return null;})[_0x92fc('0x1f')](function(_0xa18bc8){var _0x4149bb=_0x92fc('0x68')+_0xa18bc8[_0x92fc('0x27')]['ContactId'];return db[_0x92fc('0x69')]['query'](_0x4149bb,{'type':db[_0x92fc('0x6a')][_0x92fc('0x6b')][_0x92fc('0x6c')],'raw':!![]})['then'](function(_0x37f973){return _0x37f973;});})[_0x92fc('0x1f')](function(_0x465970){if(_0x465970){_0x16a180[_0x92fc('0x27')]['contact']=_0x465970[0x0];if(!_0x55da06['body']['UserId'])return;return db[_0x92fc('0x6d')][_0x92fc('0x52')]({'where':{'id':_0x55da06[_0x92fc('0x54')][_0x92fc('0x5b')],'role':_0x92fc('0x6e')},'attributes':['id',_0x92fc('0x39'),_0x92fc('0x6f'),_0x92fc('0x70'),_0x92fc('0x71')],'raw':!![]});}return null;})[_0x92fc('0x1f')](function(_0x4a6dbf){if(!_0x4a6dbf)return null;_0x16a180[_0x92fc('0x27')][_0x92fc('0x6e')]=_0x4a6dbf;return _0x16a180;})[_0x92fc('0x1f')](function(_0x284786){if(_0x284786){if(_0x55da06['body'][_0x92fc('0x72')]){_0x16a180[_0x92fc('0x27')][_0x92fc('0x73')]=util['format']('SIP/%s',_0x55da06[_0x92fc('0x5c')][_0x92fc('0x39')]);_0x16a180[_0x92fc('0x27')][_0x92fc('0x74')]=_0x16a180[_0x92fc('0x74')];_0x16a180[_0x92fc('0x27')][_0x92fc('0x75')]=_0x16a180[_0x92fc('0x74')];_0x16a180['message'][_0x92fc('0x76')]=_0x92fc('0x77');return respondWithRpcPromise(_0x92fc('0x78'),_0x92fc('0x78'),{'event':_0x92fc('0x79'),'message':_0x16a180[_0x92fc('0x27')]},client9002)[_0x92fc('0x1f')](function(){return _0x16a180;});}return _0x16a180;}return null;})[_0x92fc('0x1f')](respondWithResult(_0x319c2a,null))['catch'](handleError(_0x319c2a,null));};var interaction_log=require(_0x92fc('0x14'))('sms-interactions');exports['reject']=function(_0x338ca6,_0x254aca,_0x22a255){var _0x4f9f75={'agent':{},'channel':_0x92fc('0x57')};if(_0x338ca6['body']['id']){delete _0x338ca6[_0x92fc('0x54')]['id'];}_0x338ca6[_0x92fc('0x54')][_0x92fc('0x5b')]=_0x338ca6[_0x92fc('0x54')][_0x92fc('0x5b')]||_0x338ca6[_0x92fc('0x5c')]['id'];_0x4f9f75[_0x92fc('0x6e')]['id']=_0x338ca6[_0x92fc('0x54')]['UserId'];return db[_0x92fc('0x3b')][_0x92fc('0x52')]({'where':{'id':_0x338ca6[_0x92fc('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x254aca,null))[_0x92fc('0x1f')](function(_0x1f2ffc){if(_0x1f2ffc){_0x4f9f75[_0x92fc('0x27')]=_0x1f2ffc[_0x92fc('0x5d')]({'plain':!![]});return db['SmsInteraction'][_0x92fc('0x52')]({'where':{'id':_0x1f2ffc['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x254aca,null))['then'](function(_0x3c82f2){if(_0x3c82f2){_0x4f9f75[_0x92fc('0x64')]=_0x3c82f2['get']({'plain':!![]});interaction_log[_0x92fc('0x20')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x338ca6[_0x92fc('0x5c')]['id'],_0x338ca6[_0x92fc('0x5c')][_0x92fc('0x39')],_0x338ca6[_0x92fc('0x5c')][_0x92fc('0x63')],_0x4f9f75['interaction']['id'],_0x338ca6['body']?JSON[_0x92fc('0x65')](_0x338ca6[_0x92fc('0x54')]):'null');return respondWithRpcPromise('RejectMessage',_0x92fc('0x7a'),_0x4f9f75);}return null;})['then'](function(_0x2dab55){var _0x311fe0=_0x92fc('0x68')+_0x2dab55[_0x92fc('0x27')][_0x92fc('0x7b')];return db[_0x92fc('0x69')][_0x92fc('0x3d')](_0x311fe0,{'type':db[_0x92fc('0x6a')][_0x92fc('0x6b')][_0x92fc('0x6c')],'raw':!![]})[_0x92fc('0x1f')](function(_0x5af37d){return _0x5af37d;});})[_0x92fc('0x1f')](function(_0x55bb6b){if(_0x55bb6b){_0x4f9f75['message']['contact']=_0x55bb6b[0x0];if(!_0x338ca6['body'][_0x92fc('0x5b')])return;return db[_0x92fc('0x6d')][_0x92fc('0x52')]({'where':{'id':_0x338ca6[_0x92fc('0x54')][_0x92fc('0x5b')],'role':'agent'},'attributes':['id',_0x92fc('0x39'),_0x92fc('0x6f'),'email',_0x92fc('0x71')],'raw':!![]});}return null;})['then'](function(_0x382137){if(!_0x382137)return null;_0x4f9f75['message']['agent']=_0x382137;return _0x4f9f75;})[_0x92fc('0x1f')](function(_0x3664df){if(_0x3664df){_0x3664df[_0x92fc('0x27')]['interface']=util[_0x92fc('0x59')](_0x92fc('0x7c'),_0x338ca6[_0x92fc('0x5c')][_0x92fc('0x39')]);_0x3664df[_0x92fc('0x27')]['channel']=_0x4f9f75[_0x92fc('0x74')];_0x3664df[_0x92fc('0x27')][_0x92fc('0x75')]=_0x4f9f75['channel'];_0x3664df[_0x92fc('0x27')][_0x92fc('0x76')]=_0x92fc('0x34');respondWithRpcPromise(_0x92fc('0x78'),_0x92fc('0x78'),{'event':_0x92fc('0x7d'),'message':_0x3664df[_0x92fc('0x27')]},client9002);return _0x4f9f75;}return null;})[_0x92fc('0x1f')](respondWithResult(_0x254aca,null))[_0x92fc('0x29')](handleError(_0x254aca,null));};exports[_0x92fc('0x2b')]=function(_0x3ec9c1,_0x5d2296,_0x2c2d53){if(_0x3ec9c1[_0x92fc('0x54')]['id']){delete _0x3ec9c1[_0x92fc('0x54')]['id'];}var _0xe8d44d;return db[_0x92fc('0x3b')][_0x92fc('0x52')]({'where':{'id':_0x3ec9c1[_0x92fc('0x55')]['id']}})[_0x92fc('0x1f')](handleEntityNotFound(_0x5d2296,null))[_0x92fc('0x1f')](function(_0x2f8e4b){if(_0x2f8e4b){_0xe8d44d=_0x2f8e4b;return db['SmsAccount'][_0x92fc('0x52')]({'where':{'id':_0x2f8e4b[_0x92fc('0x7e')]}});}})[_0x92fc('0x1f')](handleEntityNotFound(_0x5d2296,null))[_0x92fc('0x1f')](function(_0x20fb87){if(_0x20fb87){logger['debug'](_0x92fc('0x24'),_0x92fc('0x2b'),'received\x20delivery\x20report\x20from',_0x20fb87['type'],util[_0x92fc('0x7f')](_0x3ec9c1[_0x92fc('0x54')],{'showHidden':![],'depth':null}));switch(_0x20fb87[_0x92fc('0x4b')]){case _0x92fc('0x80'):if(_0x3ec9c1[_0x92fc('0x54')][_0x92fc('0x81')]&&_0x3ec9c1[_0x92fc('0x54')][_0x92fc('0x81')]===_0xe8d44d['messageId']){return _0xe8d44d[_0x92fc('0x36')]({'read':!![]});}else{logger[_0x92fc('0x25')](_0x92fc('0x82'),'status',_0x92fc('0x80'),util[_0x92fc('0x7f')](_0x3ec9c1[_0x92fc('0x54')],{'showHidden':![],'depth':null}));}break;case _0x92fc('0x83'):if(_0x3ec9c1[_0x92fc('0x54')][_0x92fc('0x84')]&&_0x3ec9c1[_0x92fc('0x54')]['MessageUUID']===_0xe8d44d[_0x92fc('0x85')]&&_[_0x92fc('0x86')]([_0x92fc('0x87'),_0x92fc('0x88')],_0x3ec9c1[_0x92fc('0x54')]['Status'])>=0x0){return _0xe8d44d[_0x92fc('0x36')]({'read':!![]});}else{logger[_0x92fc('0x25')](_0x92fc('0x82'),_0x92fc('0x2b'),_0x92fc('0x89'),util[_0x92fc('0x7f')](_0x3ec9c1[_0x92fc('0x54')],{'showHidden':![],'depth':null}));}break;case _0x92fc('0x8a'):var _0x282813=_0x3ec9c1[_0x92fc('0x54')][_0x92fc('0x8b')][0x0];if(_0x282813[_0x92fc('0x2b')][_0x92fc('0x8c')]===_0x92fc('0x8d')){return _0xe8d44d[_0x92fc('0x36')]({'read':!![]});}else{logger['error'](_0x92fc('0x82'),_0x92fc('0x2b'),'infobip',util[_0x92fc('0x7f')](_0x3ec9c1['body'],{'showHidden':![],'depth':null}));}break;}return _0xe8d44d;}})['then'](respondWithResult(_0x5d2296,null))[_0x92fc('0x29')](handleError(_0x5d2296,null));}; \ No newline at end of file +var _0x852c=['set','json','apply','reject','save','update','destroy','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','describe','accept','read','readAt','UserId','get','SmsInteractionId','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','sms-interactions','SmsInteraction','RejectMessage','rejectMessage','QueryTypes','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','results','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x175ce0,_0x2b6e91){var _0x4e705a=function(_0x2b855a){while(--_0x2b855a){_0x175ce0['push'](_0x175ce0['shift']());}};_0x4e705a(++_0x2b6e91);}(_0x852c,0x179));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc852('0x0'));var rimraf=require(_0xc852('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc852('0x2'));var rp=require(_0xc852('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc852('0x4'));var util=require(_0xc852('0x5'));var path=require(_0xc852('0x6'));var sox=require(_0xc852('0x7'));var csv=require(_0xc852('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc852('0x9'));var squel=require(_0xc852('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc852('0xb'));var toCsv=require(_0xc852('0x8'));var querystring=require(_0xc852('0xc'));var Papa=require(_0xc852('0xd'));var Redis=require(_0xc852('0xe'));var authService=require(_0xc852('0xf'));var qs=require(_0xc852('0x10'));var as=require(_0xc852('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc852('0x12'))('api');var utils=require(_0xc852('0x13'));var config=require(_0xc852('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc852('0x15'))['db'];config['redis']=_[_0xc852('0x16')](config[_0xc852('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc852('0x18'))(new Redis(config['redis']));require(_0xc852('0x19'))[_0xc852('0x1a')](socket);var jayson=require(_0xc852('0x1b'));var client=jayson[_0xc852('0x1c')][_0xc852('0x1d')]({'port':0x232c});var client9002=jayson[_0xc852('0x1c')][_0xc852('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4c6429,_0x4f3095,_0x112291,_0x1c9072){return new BPromise(function(_0x4c38d7,_0x4d0e96){var _0x23968d=_0x1c9072||client;return _0x23968d['request'](_0x4c6429,_0x112291)[_0xc852('0x1e')](function(_0x4e8c45){logger[_0xc852('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x4f3095,_0xc852('0x20'));logger[_0xc852('0x21')](_0xc852('0x22'),_0x4f3095,_0xc852('0x20'),JSON[_0xc852('0x23')](_0x4e8c45));if(_0x4e8c45[_0xc852('0x24')]){if(_0x4e8c45[_0xc852('0x24')][_0xc852('0x25')]===0x1f4){logger['error'](_0xc852('0x26'),_0x4f3095,_0x4e8c45[_0xc852('0x24')]['message']);return _0x4d0e96(_0x4e8c45[_0xc852('0x24')][_0xc852('0x27')]);}logger[_0xc852('0x24')](_0xc852('0x26'),_0x4f3095,_0x4e8c45[_0xc852('0x24')]['message']);return _0x4c38d7(_0x4e8c45[_0xc852('0x24')]['message']);}else{logger[_0xc852('0x1f')](_0xc852('0x26'),_0x4f3095,_0xc852('0x20'));_0x4c38d7(_0x4e8c45[_0xc852('0x28')][_0xc852('0x27')]);}})[_0xc852('0x29')](function(_0xcc516a){logger['error'](_0xc852('0x26'),_0x4f3095,_0xcc516a);_0x4d0e96(_0xcc516a);});});}function respondWithStatusCode(_0x74d88a,_0x354d67){_0x354d67=_0x354d67||0xcc;return function(_0x1a1327){if(_0x1a1327){return _0x74d88a[_0xc852('0x2a')](_0x354d67);}return _0x74d88a[_0xc852('0x2b')](_0x354d67)[_0xc852('0x2c')]();};}function respondWithResult(_0x5bac8c,_0xda00c5){_0xda00c5=_0xda00c5||0xc8;return function(_0x1c52dc){if(_0x1c52dc){return _0x5bac8c[_0xc852('0x2b')](_0xda00c5)['json'](_0x1c52dc);}};}function respondWithFilteredResult(_0x1266e0,_0x49f65){return function(_0x118df9){if(_0x118df9){var _0x18c72f=typeof _0x49f65[_0xc852('0x2d')]===_0xc852('0x2e')&&typeof _0x49f65['limit']===_0xc852('0x2e');var _0x2d6aa7=_0x118df9[_0xc852('0x2f')];var _0x53d5a1=_0x18c72f?0x0:_0x49f65[_0xc852('0x2d')];var _0x1895e0=_0x18c72f?_0x118df9['count']:_0x49f65[_0xc852('0x2d')]+_0x49f65[_0xc852('0x30')];var _0x428702;if(_0x1895e0>=_0x2d6aa7){_0x1895e0=_0x2d6aa7;_0x428702=0xc8;}else{_0x428702=0xce;}_0x1266e0[_0xc852('0x2b')](_0x428702);return _0x1266e0[_0xc852('0x31')]('Content-Range',_0x53d5a1+'-'+_0x1895e0+'/'+_0x2d6aa7)[_0xc852('0x32')](_0x118df9);}return null;};}function patchUpdates(_0x20da7f){return function(_0x47e04d){try{jsonpatch[_0xc852('0x33')](_0x47e04d,_0x20da7f,!![]);}catch(_0xbba04e){return BPromise[_0xc852('0x34')](_0xbba04e);}return _0x47e04d[_0xc852('0x35')]();};}function saveUpdates(_0x5c0a99,_0x4c6c06){return function(_0x1a86b8){if(_0x1a86b8){return _0x1a86b8[_0xc852('0x36')](_0x5c0a99)['then'](function(_0x6ef3f2){return _0x6ef3f2;});}return null;};}function removeEntity(_0x48704d,_0x5f1754){return function(_0xc16ad5){if(_0xc16ad5){return _0xc16ad5[_0xc852('0x37')]()[_0xc852('0x1e')](function(){_0x48704d['status'](0xcc)[_0xc852('0x2c')]();});}};}function handleEntityNotFound(_0x555cd1,_0x5547bf){return function(_0x23440a){if(!_0x23440a){_0x555cd1[_0xc852('0x2a')](0x194);}return _0x23440a;};}function handleError(_0x3acdbe,_0x4d606e){_0x4d606e=_0x4d606e||0x1f4;return function(_0x2d6b0c){logger[_0xc852('0x24')](_0x2d6b0c['stack']);if(_0x2d6b0c[_0xc852('0x38')]){delete _0x2d6b0c[_0xc852('0x38')];}_0x3acdbe[_0xc852('0x2b')](_0x4d606e)['send'](_0x2d6b0c);};}exports[_0xc852('0x39')]=function(_0x1b610d,_0x1001db){var _0x2cb3e0={},_0x2ed2cc={},_0x93ec8e={'count':0x0,'rows':[]};var _0x1f9c48=_[_0xc852('0x3a')](db[_0xc852('0x3b')][_0xc852('0x3c')],function(_0x17c543){return{'name':_0x17c543[_0xc852('0x3d')],'type':_0x17c543[_0xc852('0x3e')][_0xc852('0x3f')]};});_0x2ed2cc[_0xc852('0x40')]=_[_0xc852('0x3a')](_0x1f9c48,_0xc852('0x38'));_0x2ed2cc['query']=_[_0xc852('0x41')](_0x1b610d['query']);_0x2ed2cc[_0xc852('0x42')]=_[_0xc852('0x43')](_0x2ed2cc[_0xc852('0x40')],_0x2ed2cc[_0xc852('0x44')]);_0x2cb3e0[_0xc852('0x45')]=_['intersection'](_0x2ed2cc[_0xc852('0x40')],qs[_0xc852('0x46')](_0x1b610d['query'][_0xc852('0x46')]));_0x2cb3e0[_0xc852('0x45')]=_0x2cb3e0[_0xc852('0x45')][_0xc852('0x47')]?_0x2cb3e0['attributes']:_0x2ed2cc[_0xc852('0x40')];if(!_0x1b610d[_0xc852('0x44')][_0xc852('0x48')](_0xc852('0x49'))){_0x2cb3e0['limit']=qs[_0xc852('0x30')](_0x1b610d[_0xc852('0x44')][_0xc852('0x30')]);_0x2cb3e0[_0xc852('0x2d')]=qs[_0xc852('0x2d')](_0x1b610d[_0xc852('0x44')][_0xc852('0x2d')]);}_0x2cb3e0['order']=qs['sort'](_0x1b610d['query'][_0xc852('0x4a')]);_0x2cb3e0[_0xc852('0x4b')]=qs[_0xc852('0x42')](_[_0xc852('0x4c')](_0x1b610d[_0xc852('0x44')],_0x2ed2cc[_0xc852('0x42')]),_0x1f9c48);if(_0x1b610d[_0xc852('0x44')][_0xc852('0x4d')]){_0x2cb3e0[_0xc852('0x4b')]=_[_0xc852('0x4e')](_0x2cb3e0[_0xc852('0x4b')],{'$or':_['map'](_0x1f9c48,function(_0x428286){if(_0x428286[_0xc852('0x3e')]!==_0xc852('0x4f')){var _0x11fc77={};_0x11fc77[_0x428286[_0xc852('0x38')]]={'$like':'%'+_0x1b610d[_0xc852('0x44')][_0xc852('0x4d')]+'%'};return _0x11fc77;}})});}_0x2cb3e0=_[_0xc852('0x4e')]({},_0x2cb3e0,_0x1b610d[_0xc852('0x50')]);var _0x351f4f={'where':_0x2cb3e0[_0xc852('0x4b')]};return db[_0xc852('0x3b')][_0xc852('0x2f')](_0x351f4f)[_0xc852('0x1e')](function(_0x5b9164){_0x93ec8e[_0xc852('0x2f')]=_0x5b9164;if(_0x1b610d[_0xc852('0x44')][_0xc852('0x51')]){_0x2cb3e0[_0xc852('0x52')]=[{'all':!![]}];}return db[_0xc852('0x3b')]['findAll'](_0x2cb3e0);})[_0xc852('0x1e')](function(_0x96abea){_0x93ec8e[_0xc852('0x53')]=_0x96abea;return _0x93ec8e;})[_0xc852('0x1e')](respondWithFilteredResult(_0x1001db,_0x2cb3e0))[_0xc852('0x29')](handleError(_0x1001db,null));};exports[_0xc852('0x54')]=function(_0x2cbc92,_0x181752){var _0x4331e7={'raw':!![],'where':{'id':_0x2cbc92[_0xc852('0x55')]['id']}},_0xcbb110={};_0xcbb110['model']=_[_0xc852('0x41')](db[_0xc852('0x3b')]['rawAttributes']);_0xcbb110[_0xc852('0x44')]=_[_0xc852('0x41')](_0x2cbc92['query']);_0xcbb110[_0xc852('0x42')]=_[_0xc852('0x43')](_0xcbb110['model'],_0xcbb110[_0xc852('0x44')]);_0x4331e7[_0xc852('0x45')]=_['intersection'](_0xcbb110[_0xc852('0x40')],qs[_0xc852('0x46')](_0x2cbc92['query'][_0xc852('0x46')]));_0x4331e7[_0xc852('0x45')]=_0x4331e7[_0xc852('0x45')][_0xc852('0x47')]?_0x4331e7[_0xc852('0x45')]:_0xcbb110[_0xc852('0x40')];if(_0x2cbc92[_0xc852('0x44')]['includeAll']){_0x4331e7[_0xc852('0x52')]=[{'all':!![]}];}_0x4331e7=_[_0xc852('0x4e')]({},_0x4331e7,_0x2cbc92[_0xc852('0x50')]);return db[_0xc852('0x3b')][_0xc852('0x56')](_0x4331e7)[_0xc852('0x1e')](handleEntityNotFound(_0x181752,null))[_0xc852('0x1e')](respondWithResult(_0x181752,null))[_0xc852('0x29')](handleError(_0x181752,null));};exports[_0xc852('0x57')]=function(_0x1d5fd1,_0x40c171){return db[_0xc852('0x3b')][_0xc852('0x57')](_0x1d5fd1[_0xc852('0x58')],{})['then'](respondWithResult(_0x40c171,0xc9))[_0xc852('0x29')](handleError(_0x40c171,null));};exports['update']=function(_0x427f1b,_0x45af4c){if(_0x427f1b[_0xc852('0x58')]['id']){delete _0x427f1b[_0xc852('0x58')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x427f1b['params']['id']}})[_0xc852('0x1e')](handleEntityNotFound(_0x45af4c,null))[_0xc852('0x1e')](saveUpdates(_0x427f1b['body'],null))[_0xc852('0x1e')](respondWithResult(_0x45af4c,null))['catch'](handleError(_0x45af4c,null));};exports[_0xc852('0x37')]=function(_0x558b73,_0x2dcd68){return db[_0xc852('0x3b')]['find']({'where':{'id':_0x558b73[_0xc852('0x55')]['id']}})[_0xc852('0x1e')](handleEntityNotFound(_0x2dcd68,null))[_0xc852('0x1e')](removeEntity(_0x2dcd68,null))[_0xc852('0x29')](handleError(_0x2dcd68,null));};exports['describe']=function(_0x5ae986,_0x32f5ec){return db[_0xc852('0x3b')][_0xc852('0x59')]()['then'](respondWithResult(_0x32f5ec,null))[_0xc852('0x29')](handleError(_0x32f5ec,null));};var interaction_log=require(_0xc852('0x12'))('sms-interactions');exports[_0xc852('0x5a')]=function(_0x2738c1,_0x489e33,_0xde481d){var _0x4897eb={'agent':{},'channel':'sms'};if(_0x2738c1[_0xc852('0x58')]['id']){delete _0x2738c1[_0xc852('0x58')]['id'];}_0x2738c1[_0xc852('0x58')][_0xc852('0x5b')]=!![];_0x2738c1[_0xc852('0x58')][_0xc852('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')]=_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')]||_0x2738c1['user']['id'];_0x4897eb['agent']['id']=_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')];return db[_0xc852('0x3b')]['find']({'where':{'id':_0x2738c1[_0xc852('0x55')]['id'],'UserId':null}})[_0xc852('0x1e')](handleEntityNotFound(_0x489e33,null))['then'](saveUpdates(_0x2738c1['body'],null))[_0xc852('0x1e')](function(_0x4fcfea){if(_0x4fcfea){_0x4897eb[_0xc852('0x27')]=_0x4fcfea[_0xc852('0x5e')]({'plain':!![]});return db['SmsInteraction'][_0xc852('0x56')]({'where':{'id':_0x4fcfea[_0xc852('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x489e33,null))[_0xc852('0x1e')](function(_0x31ef41){if(_0x31ef41){return _0x31ef41[_0xc852('0x36')]({'UserId':_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')],'read1stAt':_['isNil'](_0x31ef41[_0xc852('0x60')])?moment()[_0xc852('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc852('0x1e')](function(_0x119cb5){if(_0x119cb5){_0x4897eb[_0xc852('0x62')]=_0x119cb5['get']({'plain':!![]});interaction_log[_0xc852('0x1f')](_0xc852('0x63'),_0x2738c1[_0xc852('0x64')]['id'],_0x2738c1['user'][_0xc852('0x38')],_0x2738c1['user'][_0xc852('0x65')],_0x4897eb[_0xc852('0x62')]['id'],_0x2738c1[_0xc852('0x58')]?JSON['stringify'](_0x2738c1[_0xc852('0x58')]):_0xc852('0x66'));return respondWithRpcPromise(_0xc852('0x67'),'acceptMessage',_0x4897eb);}return null;})['then'](function(_0x4fa9b6){var _0xc106a5=_0xc852('0x68')+_0x4fa9b6['message'][_0xc852('0x69')];return db[_0xc852('0x6a')][_0xc852('0x44')](_0xc106a5,{'type':db[_0xc852('0x6b')]['QueryTypes'][_0xc852('0x6c')],'raw':!![]})[_0xc852('0x1e')](function(_0x5cfff0){return _0x5cfff0;});})[_0xc852('0x1e')](function(_0x1cc613){if(_0x1cc613){_0x4897eb[_0xc852('0x27')][_0xc852('0x6d')]=_0x1cc613[0x0];if(!_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')])return;return db[_0xc852('0x6e')]['find']({'where':{'id':_0x2738c1[_0xc852('0x58')]['UserId'],'role':_0xc852('0x6f')},'attributes':['id',_0xc852('0x38'),_0xc852('0x70'),_0xc852('0x71'),_0xc852('0x72')],'raw':!![]});}return null;})[_0xc852('0x1e')](function(_0x1811ea){if(!_0x1811ea)return null;_0x4897eb[_0xc852('0x27')][_0xc852('0x6f')]=_0x1811ea;return _0x4897eb;})[_0xc852('0x1e')](function(_0x6cbcbd){if(_0x6cbcbd){if(_0x2738c1['body']['manual']){_0x4897eb[_0xc852('0x27')][_0xc852('0x73')]=util[_0xc852('0x61')](_0xc852('0x74'),_0x2738c1[_0xc852('0x64')][_0xc852('0x38')]);_0x4897eb[_0xc852('0x27')]['channel']=_0x4897eb[_0xc852('0x75')];_0x4897eb['message'][_0xc852('0x76')]=_0x4897eb['channel'];_0x4897eb['message'][_0xc852('0x77')]=_0xc852('0x5a');return respondWithRpcPromise(_0xc852('0x78'),_0xc852('0x78'),{'event':'acceptmessage','message':_0x4897eb[_0xc852('0x27')]},client9002)[_0xc852('0x1e')](function(){return _0x4897eb;});}return _0x4897eb;}return null;})[_0xc852('0x1e')](respondWithResult(_0x489e33,null))['catch'](handleError(_0x489e33,null));};var interaction_log=require('../../config/logger')(_0xc852('0x79'));exports[_0xc852('0x34')]=function(_0x312b8a,_0x6eefe0,_0x16cbed){var _0x21ac24={'agent':{},'channel':'sms'};if(_0x312b8a[_0xc852('0x58')]['id']){delete _0x312b8a['body']['id'];}_0x312b8a[_0xc852('0x58')]['UserId']=_0x312b8a['body']['UserId']||_0x312b8a[_0xc852('0x64')]['id'];_0x21ac24[_0xc852('0x6f')]['id']=_0x312b8a[_0xc852('0x58')][_0xc852('0x5d')];return db[_0xc852('0x3b')][_0xc852('0x56')]({'where':{'id':_0x312b8a['params']['id'],'UserId':null}})[_0xc852('0x1e')](handleEntityNotFound(_0x6eefe0,null))[_0xc852('0x1e')](function(_0xcdb4d1){if(_0xcdb4d1){_0x21ac24[_0xc852('0x27')]=_0xcdb4d1[_0xc852('0x5e')]({'plain':!![]});return db[_0xc852('0x7a')][_0xc852('0x56')]({'where':{'id':_0xcdb4d1['SmsInteractionId']}});}return null;})[_0xc852('0x1e')](handleEntityNotFound(_0x6eefe0,null))['then'](function(_0x3cdf8f){if(_0x3cdf8f){_0x21ac24[_0xc852('0x62')]=_0x3cdf8f['get']({'plain':!![]});interaction_log[_0xc852('0x1f')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x312b8a[_0xc852('0x64')]['id'],_0x312b8a[_0xc852('0x64')][_0xc852('0x38')],_0x312b8a[_0xc852('0x64')][_0xc852('0x65')],_0x21ac24['interaction']['id'],_0x312b8a[_0xc852('0x58')]?JSON[_0xc852('0x23')](_0x312b8a[_0xc852('0x58')]):'null');return respondWithRpcPromise(_0xc852('0x7b'),_0xc852('0x7c'),_0x21ac24);}return null;})['then'](function(_0xd5dac2){var _0x373b14=_0xc852('0x68')+_0xd5dac2[_0xc852('0x27')]['ContactId'];return db['sequelize'][_0xc852('0x44')](_0x373b14,{'type':db[_0xc852('0x6b')][_0xc852('0x7d')][_0xc852('0x6c')],'raw':!![]})[_0xc852('0x1e')](function(_0x18ea1a){return _0x18ea1a;});})[_0xc852('0x1e')](function(_0x5f061c){if(_0x5f061c){_0x21ac24[_0xc852('0x27')][_0xc852('0x6d')]=_0x5f061c[0x0];if(!_0x312b8a[_0xc852('0x58')][_0xc852('0x5d')])return;return db[_0xc852('0x6e')][_0xc852('0x56')]({'where':{'id':_0x312b8a[_0xc852('0x58')][_0xc852('0x5d')],'role':_0xc852('0x6f')},'attributes':['id','name',_0xc852('0x70'),_0xc852('0x71'),_0xc852('0x72')],'raw':!![]});}return null;})['then'](function(_0x5cfbde){if(!_0x5cfbde)return null;_0x21ac24[_0xc852('0x27')][_0xc852('0x6f')]=_0x5cfbde;return _0x21ac24;})[_0xc852('0x1e')](function(_0x13d36c){if(_0x13d36c){_0x13d36c['message'][_0xc852('0x73')]=util[_0xc852('0x61')](_0xc852('0x74'),_0x312b8a[_0xc852('0x64')][_0xc852('0x38')]);_0x13d36c[_0xc852('0x27')]['channel']=_0x21ac24[_0xc852('0x75')];_0x13d36c['message']['motionChannel']=_0x21ac24[_0xc852('0x75')];_0x13d36c[_0xc852('0x27')][_0xc852('0x77')]=_0xc852('0x34');respondWithRpcPromise(_0xc852('0x78'),_0xc852('0x78'),{'event':_0xc852('0x7e'),'message':_0x13d36c[_0xc852('0x27')]},client9002);return _0x21ac24;}return null;})['then'](respondWithResult(_0x6eefe0,null))[_0xc852('0x29')](handleError(_0x6eefe0,null));};exports[_0xc852('0x2b')]=function(_0x50b582,_0x2ea5f8,_0x41bb7d){if(_0x50b582['body']['id']){delete _0x50b582[_0xc852('0x58')]['id'];}var _0x581397;return db[_0xc852('0x3b')][_0xc852('0x56')]({'where':{'id':_0x50b582[_0xc852('0x55')]['id']}})[_0xc852('0x1e')](handleEntityNotFound(_0x2ea5f8,null))['then'](function(_0x33f7cd){if(_0x33f7cd){_0x581397=_0x33f7cd;return db[_0xc852('0x7f')]['find']({'where':{'id':_0x33f7cd['SmsAccountId']}});}})[_0xc852('0x1e')](handleEntityNotFound(_0x2ea5f8,null))[_0xc852('0x1e')](function(_0x16b9cf){if(_0x16b9cf){logger[_0xc852('0x21')](_0xc852('0x22'),_0xc852('0x2b'),_0xc852('0x80'),_0x16b9cf[_0xc852('0x3e')],util[_0xc852('0x81')](_0x50b582['body'],{'showHidden':![],'depth':null}));switch(_0x16b9cf[_0xc852('0x3e')]){case _0xc852('0x82'):if(_0x50b582[_0xc852('0x58')][_0xc852('0x83')]&&_0x50b582[_0xc852('0x58')][_0xc852('0x83')]===_0x581397['messageId']){return _0x581397[_0xc852('0x36')]({'read':!![]});}else{logger[_0xc852('0x24')](_0xc852('0x84'),_0xc852('0x2b'),'twilio',util[_0xc852('0x81')](_0x50b582[_0xc852('0x58')],{'showHidden':![],'depth':null}));}break;case _0xc852('0x85'):if(_0x50b582[_0xc852('0x58')][_0xc852('0x86')]&&_0x50b582[_0xc852('0x58')][_0xc852('0x86')]===_0x581397[_0xc852('0x87')]&&_[_0xc852('0x88')]([_0xc852('0x89'),_0xc852('0x8a')],_0x50b582['body'][_0xc852('0x8b')])>=0x0){return _0x581397['update']({'read':!![]});}else{logger[_0xc852('0x24')](_0xc852('0x84'),_0xc852('0x2b'),'plivio',util[_0xc852('0x81')](_0x50b582[_0xc852('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4c4ae5=_0x50b582[_0xc852('0x58')][_0xc852('0x8c')][0x0];if(_0x4c4ae5['status']['groupName']===_0xc852('0x8d')){return _0x581397[_0xc852('0x36')]({'read':!![]});}else{logger[_0xc852('0x24')](_0xc852('0x84'),'status','infobip',util[_0xc852('0x81')](_0x50b582[_0xc852('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x581397;}})[_0xc852('0x1e')](respondWithResult(_0x2ea5f8,null))[_0xc852('0x29')](handleError(_0x2ea5f8,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index cab7b56..306cea0 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 _0x34b5=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x59d07e,_0x58383e){var _0x229c0b=function(_0x14144f){while(--_0x14144f){_0x59d07e['push'](_0x59d07e['shift']());}};_0x229c0b(++_0x58383e);}(_0x34b5,0x88));var _0x534b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34b5[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x534b('0x0'));var SmsMessage=require(_0x534b('0x1'))['db'][_0x534b('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x534b('0x3')](0x0);var events={'afterCreate':_0x534b('0x4'),'afterUpdate':_0x534b('0x5'),'afterDestroy':_0x534b('0x6')};function emitEvent(_0x1257f1){return function(_0x6c1df5,_0x503234,_0x3de976){SmsMessageEvents[_0x534b('0x7')](_0x1257f1+':'+_0x6c1df5['id'],_0x6c1df5);SmsMessageEvents[_0x534b('0x7')](_0x1257f1,_0x6c1df5);_0x3de976(null);};}for(var e in events){if(events[_0x534b('0x8')](e)){var event=events[e];SmsMessage[_0x534b('0x9')](e,emitEvent(event));}}module[_0x534b('0xa')]=SmsMessageEvents; \ No newline at end of file +var _0xc2dc=['../../mysqldb','setMaxListeners','save','remove','emit','exports','events'];(function(_0x4aa6bb,_0x544026){var _0x236352=function(_0x2be211){while(--_0x2be211){_0x4aa6bb['push'](_0x4aa6bb['shift']());}};_0x236352(++_0x544026);}(_0xc2dc,0xa7));var _0xcc2d=function(_0x400f2a,_0x52a559){_0x400f2a=_0x400f2a-0x0;var _0x3dd8d1=_0xc2dc[_0x400f2a];return _0x3dd8d1;};'use strict';var EventEmitter=require(_0xcc2d('0x0'));var SmsMessage=require(_0xcc2d('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xcc2d('0x2')](0x0);var events={'afterCreate':_0xcc2d('0x3'),'afterUpdate':'update','afterDestroy':_0xcc2d('0x4')};function emitEvent(_0xfc5195){return function(_0x3925c5,_0x4c86a7,_0xad3843){SmsMessageEvents[_0xcc2d('0x5')](_0xfc5195+':'+_0x3925c5['id'],_0x3925c5);SmsMessageEvents[_0xcc2d('0x5')](_0xfc5195,_0x3925c5);_0xad3843(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xcc2d('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 22a9629..997bafd 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 _0x5390=['apiKey','https://platform.clickatell.com/messages','UTF-8','clickatell','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','utf8mb4','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','body','remote','/api/sms/messages/','/status?token=','token','sid','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','queued_count','data','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','login','text','timestamp','keys','createHash','md5','digest','hex','/external/get/send.php?'];(function(_0x45aaf9,_0x222e1b){var _0x5aca09=function(_0x4c8f18){while(--_0x4c8f18){_0x45aaf9['push'](_0x45aaf9['shift']());}};_0x5aca09(++_0x222e1b);}(_0x5390,0x8d));var _0x0539=function(_0x2c012b,_0x5b3f5c){_0x2c012b=_0x2c012b-0x0;var _0x380a13=_0x5390[_0x2c012b];return _0x380a13;};'use strict';var _=require(_0x0539('0x0'));var util=require(_0x0539('0x1'));var logger=require('../../config/logger')(_0x0539('0x2'));var moment=require(_0x0539('0x3'));var BPromise=require(_0x0539('0x4'));var rp=require(_0x0539('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0539('0x6'));var attributes=require(_0x0539('0x7'));module['exports']=function(_0x8a834e,_0x565c53){return _0x8a834e[_0x0539('0x8')](_0x0539('0x9'),attributes,{'tableName':_0x0539('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0539('0xb')]},{'name':_0x0539('0xc'),'fields':['body'],'type':_0x0539('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fe683,_0x5d845a,_0x9f72e5){var _0x22014a=_0x8a834e[_0x0539('0xe')];var _0x4d36e6=_0x1fe683[_0x0539('0xf')]({'plain':!![]});if(_0x4d36e6['direction'][_0x0539('0x10')]()==='in'||_0x4d36e6[_0x0539('0x11')][_0x0539('0x10')]()===_0x0539('0x12')&&!_0x4d36e6[_0x0539('0x13')]&&!_[_0x0539('0x14')](_0x4d36e6[_0x0539('0x15')])&&!_[_0x0539('0x14')](_0x4d36e6['SmsInteractionId'])){_0x22014a[_0x0539('0x16')][_0x0539('0x17')]({'where':{'id':_0x4d36e6[_0x0539('0x18')]}})[_0x0539('0x19')](function(_0x546199){if(_0x546199){_0x546199[_0x0539('0x1a')]({'lastMsgAt':_0x4d36e6[_0x0539('0x1b')],'lastMsgDirection':_0x4d36e6[_0x0539('0x11')][_0x0539('0x10')]()});}})[_0x0539('0x1c')](function(_0x4bb856){console[_0x0539('0x1d')](_0x4bb856);});}if(_0x4d36e6[_0x0539('0x11')]===_0x0539('0x12')&&!_0x4d36e6[_0x0539('0x13')]){var _0xcc57df;_0x22014a['SmsAccount'][_0x0539('0x1e')]({'where':{'id':_0x4d36e6[_0x0539('0x1f')]},'raw':!![]})[_0x0539('0x19')](function(_0x5bc68a){_0xcc57df=_0x5bc68a;if(_0xcc57df&&_0xcc57df[_0x0539('0x20')]){switch(_0xcc57df[_0x0539('0x20')]){case _0x0539('0x21'):var _0x3c22b3=require(_0x0539('0x21'));if(_0xcc57df['accountSid']&&_0xcc57df[_0x0539('0x22')]&&_0xcc57df[_0x0539('0x23')]){var _0x145951=new _0x3c22b3(_0xcc57df[_0x0539('0x24')],_0xcc57df['authToken']);_0x145951[_0x0539('0x25')]['create']({'body':_0x4d36e6[_0x0539('0x26')],'to':_0x4d36e6[_0x0539('0x23')],'from':_0xcc57df[_0x0539('0x23')],'statusCallback':_0xcc57df[_0x0539('0x27')]+_0x0539('0x28')+_0x4d36e6['id']+_0x0539('0x29')+_0xcc57df[_0x0539('0x2a')]})[_0x0539('0x19')](function(_0x572ed7){if(_0x572ed7['sid']){return _0x1fe683[_0x0539('0x1a')]({'messageId':_0x572ed7[_0x0539('0x2b')]});}})[_0x0539('0x1c')](function(_0x20aa82){logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0539('0x21'),util[_0x0539('0x2c')](_0x20aa82,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x21'),_0x0539('0x2f'));}break;case _0x0539('0x30'):var _0x43e49d=_0x0539('0x31');if(_0xcc57df['username']&&_0xcc57df[_0x0539('0x32')]){var _0x3654ca={'recipient':[_0x4d36e6['phone']],'message':_0x4d36e6['body'],'message_type':_0xcc57df['smsMethod']};if(_0xcc57df['smsMethod']&&_0xcc57df[_0x0539('0x33')]!=='SI'){_0x3654ca[_0x0539('0x34')]=_0xcc57df[_0x0539('0x23')];}var _0x352c06={'url':_0x43e49d+_0x0539('0x35')+_0xcc57df[_0x0539('0x36')]+_0x0539('0x37')+_0xcc57df['password'],'method':_0x0539('0x38')};rp(_0x352c06)[_0x0539('0x19')](function(_0x5615b2){var _0x3c120d=_0x5615b2[_0x0539('0x39')](';');var _0x10bb61={'user_key':_0x3c120d[0x0],'session_key':_0x3c120d[0x1]};_0x352c06={'url':_0x43e49d+_0x0539('0x3a'),'method':'POST','headers':{'user_key':_0x10bb61['user_key'],'Session_key':_0x10bb61[_0x0539('0x3b')]},'json':!![],'body':_0x3654ca};return rp(_0x352c06);})[_0x0539('0x19')](function(_0x371e55){if(_0x371e55[_0x0539('0x3c')]>=0x1){var _0x873455={'messageId':_0x371e55[_0x0539('0x3d')]};if(_0xcc57df[_0x0539('0x33')]!=='GP'||!_0xcc57df[_0x0539('0x3e')]){_0x873455[_0x0539('0x3f')]=!![];}return _0x1fe683[_0x0539('0x1a')](_0x873455);}else{return logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x30'),util[_0x0539('0x2c')](_0x371e55,{'showHidden':![],'depth':null}));}})[_0x0539('0x1c')](function(_0x29d05b){return logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x30'),util[_0x0539('0x2c')](_0x29d05b,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),'skebby',_0x0539('0x40'));}break;case _0x0539('0x41'):if(_0xcc57df[_0x0539('0x22')]){var _0x45f519={'recipient':_0x4d36e6[_0x0539('0x23')],'message':_0x4d36e6[_0x0539('0x26')],'sender':_0xcc57df[_0x0539('0x42')]||_0xcc57df[_0x0539('0x23')],'authorization':_0xcc57df[_0x0539('0x22')]};var _0x5d845a={'method':_0x0539('0x43'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x45f519,'json':!![]};rp(_0x5d845a)[_0x0539('0x19')](function(_0x3773c3){var _0x406e5a={'messageId':_0x3773c3[_0x0539('0x44')]};if(!_0xcc57df['deliveryReport']){_0x406e5a[_0x0539('0x3f')]=!![];}return _0x1fe683[_0x0539('0x1a')](_0x406e5a);})[_0x0539('0x1c')](function(_0x3e69b7){logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),'connectel',util[_0x0539('0x2c')](_0x3e69b7,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),_0x0539('0x41'),_0x0539('0x45'));}break;case _0x0539('0x46'):if(_0xcc57df[_0x0539('0x36')]&&_0xcc57df[_0x0539('0x32')]){var _0x45f519={'messages':[{'source':_0x0539('0x47'),'to':_0x4d36e6[_0x0539('0x23')],'body':_0x4d36e6[_0x0539('0x26')],'from':_0xcc57df['senderString']||_0xcc57df[_0x0539('0x23')]}]};var _0xbb4d7d=util[_0x0539('0x48')](_0x0539('0x49'),_0xcc57df[_0x0539('0x36')],_0xcc57df[_0x0539('0x32')]);var _0x5d845a={'method':_0x0539('0x43'),'uri':_0x0539('0x4a'),'body':_0x45f519,'headers':{'Authorization':util[_0x0539('0x48')](_0x0539('0x4b'),new Buffer(_0xbb4d7d)['toString'](_0x0539('0x4c')))},'json':!![]};rp(_0x5d845a)[_0x0539('0x19')](function(_0x3b0839){if(_0x3b0839[_0x0539('0x4d')]>=0xc8&&_0x3b0839[_0x0539('0x4d')]<=0xce){if(_0x3b0839['data']&&_0x3b0839['data'][_0x0539('0x4e')]>0x0){var _0x57706d=_['head'](_0x3b0839[_0x0539('0x4f')]['messages']);var _0x4054df={'messageId':_0x57706d[_0x0539('0x50')]};if(!_0xcc57df['deliveryReport']){_0x4054df[_0x0539('0x3f')]=!![];}return _0x1fe683[_0x0539('0x1a')](_0x4054df);}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x51'),util[_0x0539('0x2c')](_0x3b0839,{'showHidden':![],'depth':null}));}}else{logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),_0x0539('0x51'),util[_0x0539('0x2c')](_0x3b0839,{'showHidden':![],'depth':null}));}})['catch'](function(_0x44bf7e){logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x51'),util['inspect'](_0x44bf7e,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x51'),_0x0539('0x40'));}break;case _0x0539('0x52'):if(_0xcc57df[_0x0539('0x53')]&&_0xcc57df['authToken']){var _0x45f519={'dst':_0x4d36e6[_0x0539('0x23')],'text':_0x4d36e6[_0x0539('0x26')],'src':_0xcc57df[_0x0539('0x42')]||_0xcc57df[_0x0539('0x23')],'url':_0xcc57df[_0x0539('0x27')]+_0x0539('0x28')+_0x4d36e6['id']+_0x0539('0x29')+_0xcc57df[_0x0539('0x2a')]};var _0xbb4d7d=util['format'](_0x0539('0x49'),_0xcc57df[_0x0539('0x53')],_0xcc57df[_0x0539('0x22')]);var _0x5d845a={'method':_0x0539('0x43'),'uri':util[_0x0539('0x48')](_0x0539('0x54'),_0xcc57df[_0x0539('0x53')]),'body':_0x45f519,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0xbb4d7d)[_0x0539('0x55')](_0x0539('0x4c')))},'json':!![]};rp(_0x5d845a)[_0x0539('0x19')](function(_0x478888){var _0x24f360={'messageId':_0x478888[_0x0539('0x56')][0x0]};return _0x1fe683['update'](_0x24f360);})['catch'](function(_0x20e999){logger['error'](_0x0539('0x2d'),_0x0539('0x2e'),'plivo',util[_0x0539('0x2c')](_0x20e999,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),'afterCreate','plivo',_0x0539('0x57'));}break;case _0x0539('0x58'):if(_0xcc57df['username']&&_0xcc57df[_0x0539('0x32')]){if(_0xcc57df[_0x0539('0x59')]){var _0xd076db={'method':_0x0539('0x43'),'uri':_0xcc57df['baseUrl']+_0x0539('0x5a'),'body':{'username':_0xcc57df['username'],'password':_0xcc57df[_0x0539('0x32')]},'json':!![]};return rp(_0xd076db)['then'](function(_0x21ccd6){var _0x2cbc9e={'method':'POST','uri':_0xcc57df[_0x0539('0x59')]+_0x0539('0x5b'),'body':{'messages':[{'from':_0xcc57df[_0x0539('0x23')],'destinations':[{'to':_0x4d36e6[_0x0539('0x23')]}],'text':_0x4d36e6['body'],'notifyUrl':_0xcc57df[_0x0539('0x27')]+_0x0539('0x28')+_0x4d36e6['id']+_0x0539('0x29')+_0xcc57df[_0x0539('0x2a')],'notifyContentType':_0x0539('0x5c'),'callbackData':_0xcc57df[_0x0539('0x23')]+';'+_0x4d36e6[_0x0539('0x26')]}]},'headers':{'Authorization':_0x0539('0x5d')+_0x21ccd6['token']},'json':!![]};return rp(_0x2cbc9e)[_0x0539('0x19')](function(_0x4c9723){if(_0x4c9723[_0x0539('0x25')]){var _0x30e475={'messageId':_0x4c9723['messages'][0x0]['messageId']};if(!_0xcc57df[_0x0539('0x3e')]){_0x30e475[_0x0539('0x3f')]=!![];}return _0x1fe683[_0x0539('0x1a')](_0x30e475);}else{return logger[_0x0539('0x1d')](_0x0539('0x2d'),'afterCreate',_0x0539('0x58'),util[_0x0539('0x2c')](_0x4c9723,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x2b5160){return logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x58'),util[_0x0539('0x2c')](_0x2b5160,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),'afterCreate',_0x0539('0x58'),_0x0539('0x5e'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),_0x0539('0x58'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x0539('0x5f'):var _0xa7bd6a=require('crypto');if(_0xcc57df['apiKey']){var _0x30a183={};_0x30a183[_0x0539('0x60')]=_0xcc57df['username'];_0x30a183[_0x0539('0x23')]=_0x4d36e6['phone'];_0x30a183[_0x0539('0x34')]=_0xcc57df[_0x0539('0x23')];_0x30a183[_0x0539('0x61')]=_0x4d36e6[_0x0539('0x26')];_0x30a183[_0x0539('0x62')]=+new Date();var _0x258fce='';var _0x40425e='';var _0x286e42=Object[_0x0539('0x63')](_0x30a183);_0x286e42['sort']();for(var _0x4d741e=0x0;_0x4d741e<_0x286e42['length'];_0x4d741e++){if(_0x258fce!=''){_0x258fce+='&';}_0x258fce+=_0x286e42[_0x4d741e]+'='+encodeURIComponent(_0x30a183[_0x286e42[_0x4d741e]]);_0x40425e+=_0x30a183[_0x286e42[_0x4d741e]];}_0x40425e+=_0xcc57df['apiKey'];_0x40425e=_0xa7bd6a[_0x0539('0x64')](_0x0539('0x65'))['update'](_0x40425e)[_0x0539('0x66')](_0x0539('0x67'));if(_0x258fce!==''){_0x258fce+='&';}_0x258fce+='signature='+_0x40425e;var _0x352c06={'method':_0x0539('0x38'),'uri':_0xcc57df['baseUrl']+_0x0539('0x68')+_0x258fce,'json':!![]};return rp(_0x352c06)[_0x0539('0x19')](function(_0x30a743){var _0xe4a110=Object[_0x0539('0x63')](_0x30a743);if(_0x30a743[_0xe4a110[0x0]][_0x0539('0x1d')]&&parseInt(_0x30a743[_0xe4a110[0x0]][_0x0539('0x1d')])===0x0){var _0x5b698f={'messageId':_0x30a743[_0xe4a110[0x0]]['id_sms']};if(!_0xcc57df['deliveryReport']){_0x5b698f[_0x0539('0x3f')]=!![];}return _0x1fe683[_0x0539('0x1a')](_0x5b698f);}else{return logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),_0x0539('0x5f'),util[_0x0539('0x2c')](_0x30a743[_0x0539('0x1d')],{'showHidden':![],'depth':null}));}})[_0x0539('0x1c')](function(_0x2337b0){return logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),'csc',util[_0x0539('0x2c')](_0x2337b0,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x5f'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0xcc57df[_0x0539('0x69')]){var _0x443496={'method':_0x0539('0x43'),'uri':_0x0539('0x6a'),'headers':{'Authorization':_0xcc57df[_0x0539('0x69')]},'body':{'content':_0x4d36e6['body'],'to':[_0x4d36e6[_0x0539('0x23')]],'from':_0xcc57df['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x0539('0x6b')},'json':!![]};rp(_0x443496)['then'](function(_0x3f4f23){if(!_0x3f4f23[_0x0539('0x1d')]){var _0x5412cf={'messageId':_0x3f4f23['messages'][0x0]['apiMessageId']};if(!_0xcc57df[_0x0539('0x3e')]){_0x5412cf[_0x0539('0x3f')]=!![];}return _0x1fe683[_0x0539('0x1a')](_0x5412cf);}else{return logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x6c'),util[_0x0539('0x2c')](_0x3f4f23[_0x0539('0x1d')],{'showHidden':![],'depth':null}));}})[_0x0539('0x1c')](function(_0x400458){return logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util['inspect'](_0x400458,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x6c'),_0x0539('0x6d'));}break;case _0x0539('0x6e'):if(_0xcc57df[_0x0539('0x36')]&&_0xcc57df[_0x0539('0x32')]){var _0xbb4d7d=util[_0x0539('0x48')](_0x0539('0x49'),_0xcc57df[_0x0539('0x36')],_0xcc57df[_0x0539('0x32')]);var _0x5d845a={'method':_0x0539('0x43'),'uri':_0x0539('0x6f')+_0xcc57df[_0x0539('0x70')]+'/messages','body':{'to':[_0x4d36e6[_0x0539('0x23')]],'text':_0x4d36e6[_0x0539('0x26')],'from':_0xcc57df[_0x0539('0x23')],'applicationId':_0xcc57df[_0x0539('0x71')]},'headers':{'Authorization':util[_0x0539('0x48')]('Basic\x20%s',new Buffer(_0xbb4d7d)[_0x0539('0x55')](_0x0539('0x4c')))},'json':!![]};rp(_0x5d845a)[_0x0539('0x19')](function(_0x279483){if(_0x279483['id']){var _0x43d9b0={'messageId':_0x279483['id']};return _0x1fe683['update'](_0x43d9b0);}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),'afterCreate',_0x0539('0x6e'),util[_0x0539('0x2c')](_0x279483,{'showHidden':![],'depth':null}));}})[_0x0539('0x1c')](function(_0x2d9504){logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),_0x0539('0x6e'),util[_0x0539('0x2c')](_0x2d9504,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x6e'),_0x0539('0x40'));}break;case _0x0539('0x72'):if(_0xcc57df[_0x0539('0x69')]){var _0x188140={};var _0x352c06={'method':_0x0539('0x43'),'uri':_0x0539('0x73'),'headers':{'Authorization':_0x0539('0x74')+_0xcc57df['apiKey'],'Content-Type':_0x0539('0x5c')},'body':{'from':_0xcc57df['phone'],'to':_0x4d36e6[_0x0539('0x23')],'text':_0x4d36e6[_0x0539('0x26')]},'json':!![]};return rp(_0x352c06)[_0x0539('0x19')](function(_0x5c1066){if(_0x5c1066['code']==0xca){_0x188140[_0x0539('0x75')]=_0x5c1066;var _0x4a35d6={'method':_0x0539('0x43'),'uri':_0x0539('0x76'),'headers':{'Authorization':_0x0539('0x74')+_0xcc57df['apiKey'],'Content-Type':_0x0539('0x5c')},'body':{'refid':_0x188140[_0x0539('0x75')][_0x0539('0x77')]},'json':!![]};return rp(_0x4a35d6)[_0x0539('0x19')](function(_0x3f7049){_0x188140[_0x0539('0x78')]=_0x3f7049;var _0x8590de={'messageId':_0x188140[_0x0539('0x75')][_0x0539('0x77')],'read':!![]};return _0x1fe683[_0x0539('0x1a')](_0x8590de);});}else{return logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x72'),util[_0x0539('0x2c')](_0x5c1066,{'showHidden':![],'depth':null}));}})[_0x0539('0x1c')](function(_0x559811){return logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0539('0x72'),util[_0x0539('0x2c')](_0x559811,{'showHidden':![],'depth':null}));});}else{return logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),_0x0539('0x72'),_0x0539('0x79'));}break;}}})['finally'](function(){_0x9f72e5();});}else{_0x9f72e5();}}},'charset':_0x0539('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x99d0=['path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','isNil','SmsInteraction','findOne','then','update','createdAt','error','out','secret','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','session_key','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','authId','message_uuid','plivo','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','text','keys','length','apiKey','createHash','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x99d0,0x1e8));var _0x099d=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x99d0[_0xffa198];return _0x1e4b50;};'use strict';var _=require(_0x099d('0x0'));var util=require('util');var logger=require(_0x099d('0x1'))('api');var moment=require(_0x099d('0x2'));var BPromise=require('bluebird');var rp=require(_0x099d('0x3'));var fs=require('fs');var path=require(_0x099d('0x4'));var rimraf=require(_0x099d('0x5'));var config=require(_0x099d('0x6'));var attributes=require(_0x099d('0x7'));module[_0x099d('0x8')]=function(_0x49293d,_0x46faf8){return _0x49293d[_0x099d('0x9')](_0x099d('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x099d('0xb')]},{'name':_0x099d('0xc'),'fields':[_0x099d('0xd')],'type':_0x099d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4063e0,_0x5ab3bf,_0x3438f3){var _0x20f953=_0x49293d[_0x099d('0xf')];var _0x3cc3e4=_0x4063e0[_0x099d('0x10')]({'plain':!![]});if(_0x3cc3e4[_0x099d('0x11')][_0x099d('0x12')]()==='in'||_0x3cc3e4['direction'][_0x099d('0x12')]()==='out'&&!_0x3cc3e4['secret']&&!_['isNil'](_0x3cc3e4[_0x099d('0x13')])&&!_[_0x099d('0x14')](_0x3cc3e4['SmsInteractionId'])){_0x20f953[_0x099d('0x15')][_0x099d('0x16')]({'where':{'id':_0x3cc3e4['SmsInteractionId']}})[_0x099d('0x17')](function(_0x44fc09){if(_0x44fc09){_0x44fc09[_0x099d('0x18')]({'lastMsgAt':_0x3cc3e4[_0x099d('0x19')],'lastMsgDirection':_0x3cc3e4['direction']['toLowerCase']()});}})['catch'](function(_0x47430d){console[_0x099d('0x1a')](_0x47430d);});}if(_0x3cc3e4['direction']===_0x099d('0x1b')&&!_0x3cc3e4[_0x099d('0x1c')]){var _0xd17093;_0x20f953[_0x099d('0x1d')]['find']({'where':{'id':_0x3cc3e4[_0x099d('0x1e')]},'raw':!![]})[_0x099d('0x17')](function(_0x3716b4){_0xd17093=_0x3716b4;if(_0xd17093&&_0xd17093['type']){switch(_0xd17093[_0x099d('0x1f')]){case _0x099d('0x20'):var _0x15b2a9=require(_0x099d('0x20'));if(_0xd17093[_0x099d('0x21')]&&_0xd17093[_0x099d('0x22')]&&_0xd17093[_0x099d('0x23')]){var _0x475b5d=new _0x15b2a9(_0xd17093[_0x099d('0x21')],_0xd17093[_0x099d('0x22')]);_0x475b5d[_0x099d('0x24')][_0x099d('0x25')]({'body':_0x3cc3e4[_0x099d('0xd')],'to':_0x3cc3e4['phone'],'from':_0xd17093['phone'],'statusCallback':_0xd17093[_0x099d('0x26')]+_0x099d('0x27')+_0x3cc3e4['id']+_0x099d('0x28')+_0xd17093['token']})[_0x099d('0x17')](function(_0x30cee){if(_0x30cee['sid']){return _0x4063e0['update']({'messageId':_0x30cee[_0x099d('0x29')]});}})[_0x099d('0x2a')](function(_0x25994e){logger[_0x099d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x099d('0x20'),util['inspect'](_0x25994e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x20'),_0x099d('0x2d'));}break;case _0x099d('0x2e'):var _0x580525=_0x099d('0x2f');if(_0xd17093[_0x099d('0x30')]&&_0xd17093[_0x099d('0x31')]){var _0x2bbb5d={'recipient':[_0x3cc3e4['phone']],'message':_0x3cc3e4[_0x099d('0xd')],'message_type':_0xd17093['smsMethod']};if(_0xd17093[_0x099d('0x32')]&&_0xd17093[_0x099d('0x32')]!=='SI'){_0x2bbb5d[_0x099d('0x33')]=_0xd17093['phone'];}var _0x2fb786={'url':_0x580525+_0x099d('0x34')+_0xd17093['username']+_0x099d('0x35')+_0xd17093['password'],'method':_0x099d('0x36')};rp(_0x2fb786)[_0x099d('0x17')](function(_0x1c3497){var _0x276583=_0x1c3497[_0x099d('0x37')](';');var _0x39c434={'user_key':_0x276583[0x0],'session_key':_0x276583[0x1]};_0x2fb786={'url':_0x580525+_0x099d('0x38'),'method':_0x099d('0x39'),'headers':{'user_key':_0x39c434['user_key'],'Session_key':_0x39c434[_0x099d('0x3a')]},'json':!![],'body':_0x2bbb5d};return rp(_0x2fb786);})[_0x099d('0x17')](function(_0x5901f7){if(_0x5901f7['total_sent']>=0x1){var _0x510dad={'messageId':_0x5901f7['internal_order_id']};if(_0xd17093['smsMethod']!=='GP'||!_0xd17093[_0x099d('0x3b')]){_0x510dad[_0x099d('0x3c')]=!![];}return _0x4063e0[_0x099d('0x18')](_0x510dad);}else{return logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x2e'),util[_0x099d('0x3d')](_0x5901f7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1d5f4e){return logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),'skebby',util['inspect'](_0x1d5f4e,{'showHidden':![],'depth':null}));});}else{logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),'skebby',_0x099d('0x3e'));}break;case _0x099d('0x3f'):if(_0xd17093[_0x099d('0x22')]){var _0x2ba21a={'recipient':_0x3cc3e4[_0x099d('0x23')],'message':_0x3cc3e4[_0x099d('0xd')],'sender':_0xd17093[_0x099d('0x40')]||_0xd17093[_0x099d('0x23')],'authorization':_0xd17093[_0x099d('0x22')]};var _0x5ab3bf={'method':_0x099d('0x39'),'uri':_0x099d('0x41'),'body':_0x2ba21a,'json':!![]};rp(_0x5ab3bf)[_0x099d('0x17')](function(_0x430656){var _0x519d24={'messageId':_0x430656[_0x099d('0x42')]};if(!_0xd17093[_0x099d('0x3b')]){_0x519d24[_0x099d('0x3c')]=!![];}return _0x4063e0[_0x099d('0x18')](_0x519d24);})[_0x099d('0x2a')](function(_0x3f0d72){logger[_0x099d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x099d('0x2c'),_0x099d('0x3f'),util[_0x099d('0x3d')](_0x3f0d72,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x3f'),_0x099d('0x43'));}break;case'clicksend':if(_0xd17093[_0x099d('0x30')]&&_0xd17093['password']){var _0x2ba21a={'messages':[{'source':_0x099d('0x44'),'to':_0x3cc3e4[_0x099d('0x23')],'body':_0x3cc3e4['body'],'from':_0xd17093['senderString']||_0xd17093[_0x099d('0x23')]}]};var _0x543a7f=util[_0x099d('0x45')](_0x099d('0x46'),_0xd17093[_0x099d('0x30')],_0xd17093[_0x099d('0x31')]);var _0x5ab3bf={'method':'POST','uri':_0x099d('0x47'),'body':_0x2ba21a,'headers':{'Authorization':util['format'](_0x099d('0x48'),new Buffer(_0x543a7f)[_0x099d('0x49')](_0x099d('0x4a')))},'json':!![]};rp(_0x5ab3bf)[_0x099d('0x17')](function(_0x39e9c0){if(_0x39e9c0[_0x099d('0x4b')]>=0xc8&&_0x39e9c0[_0x099d('0x4b')]<=0xce){if(_0x39e9c0[_0x099d('0x4c')]&&_0x39e9c0[_0x099d('0x4c')][_0x099d('0x4d')]>0x0){var _0x29443f=_['head'](_0x39e9c0[_0x099d('0x4c')][_0x099d('0x24')]);var _0x18528a={'messageId':_0x29443f[_0x099d('0x4e')]};if(!_0xd17093[_0x099d('0x3b')]){_0x18528a['read']=!![];}return _0x4063e0['update'](_0x18528a);}else{logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x4f'),util[_0x099d('0x3d')](_0x39e9c0,{'showHidden':![],'depth':null}));}}else{logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),'clickSend',util[_0x099d('0x3d')](_0x39e9c0,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c1a40){logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),'clickSend',util[_0x099d('0x3d')](_0x3c1a40,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x099d('0x2b'),'afterCreate',_0x099d('0x4f'),_0x099d('0x3e'));}break;case'plivo':if(_0xd17093[_0x099d('0x50')]&&_0xd17093[_0x099d('0x22')]){var _0x2ba21a={'dst':_0x3cc3e4[_0x099d('0x23')],'text':_0x3cc3e4[_0x099d('0xd')],'src':_0xd17093['senderString']||_0xd17093[_0x099d('0x23')],'url':_0xd17093[_0x099d('0x26')]+_0x099d('0x27')+_0x3cc3e4['id']+_0x099d('0x28')+_0xd17093['token']};var _0x543a7f=util[_0x099d('0x45')](_0x099d('0x46'),_0xd17093[_0x099d('0x50')],_0xd17093['authToken']);var _0x5ab3bf={'method':_0x099d('0x39'),'uri':util[_0x099d('0x45')]('https://api.plivo.com/v1/Account/%s/Message/',_0xd17093[_0x099d('0x50')]),'body':_0x2ba21a,'headers':{'Authorization':util[_0x099d('0x45')](_0x099d('0x48'),new Buffer(_0x543a7f)[_0x099d('0x49')](_0x099d('0x4a')))},'json':!![]};rp(_0x5ab3bf)[_0x099d('0x17')](function(_0x553385){var _0x15111c={'messageId':_0x553385[_0x099d('0x51')][0x0]};return _0x4063e0['update'](_0x15111c);})[_0x099d('0x2a')](function(_0x1d3586){logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x52'),util[_0x099d('0x3d')](_0x1d3586,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x52'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x099d('0x53'):if(_0xd17093[_0x099d('0x30')]&&_0xd17093[_0x099d('0x31')]){if(_0xd17093[_0x099d('0x54')]){var _0x4c583b={'method':_0x099d('0x39'),'uri':_0xd17093[_0x099d('0x54')]+_0x099d('0x55'),'body':{'username':_0xd17093[_0x099d('0x30')],'password':_0xd17093[_0x099d('0x31')]},'json':!![]};return rp(_0x4c583b)['then'](function(_0x28d515){var _0x1a29cf={'method':'POST','uri':_0xd17093[_0x099d('0x54')]+_0x099d('0x56'),'body':{'messages':[{'from':_0xd17093[_0x099d('0x23')],'destinations':[{'to':_0x3cc3e4['phone']}],'text':_0x3cc3e4['body'],'notifyUrl':_0xd17093[_0x099d('0x26')]+_0x099d('0x27')+_0x3cc3e4['id']+'/status?token='+_0xd17093['token'],'notifyContentType':_0x099d('0x57'),'callbackData':_0xd17093[_0x099d('0x23')]+';'+_0x3cc3e4[_0x099d('0xd')]}]},'headers':{'Authorization':_0x099d('0x58')+_0x28d515['token']},'json':!![]};return rp(_0x1a29cf)[_0x099d('0x17')](function(_0x46aafe){if(_0x46aafe['messages']){var _0x5a2599={'messageId':_0x46aafe[_0x099d('0x24')][0x0][_0x099d('0xb')]};if(!_0xd17093[_0x099d('0x3b')]){_0x5a2599[_0x099d('0x3c')]=!![];}return _0x4063e0[_0x099d('0x18')](_0x5a2599);}else{return logger[_0x099d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x099d('0x2c'),_0x099d('0x53'),util[_0x099d('0x3d')](_0x46aafe,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x21daa7){return logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x53'),util[_0x099d('0x3d')](_0x21daa7,{'showHidden':![],'depth':null}));});}else{logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x53'),_0x099d('0x59'));}}else{logger[_0x099d('0x1a')](_0x099d('0x2b'),'afterCreate',_0x099d('0x53'),_0x099d('0x3e'));}break;case _0x099d('0x5a'):var _0x7f62b3=require(_0x099d('0x5b'));if(_0xd17093['apiKey']){var _0x474dbf={};_0x474dbf['login']=_0xd17093[_0x099d('0x30')];_0x474dbf[_0x099d('0x23')]=_0x3cc3e4['phone'];_0x474dbf[_0x099d('0x33')]=_0xd17093[_0x099d('0x23')];_0x474dbf[_0x099d('0x5c')]=_0x3cc3e4[_0x099d('0xd')];_0x474dbf['timestamp']=+new Date();var _0xf1119c='';var _0x4bcbb8='';var _0x510add=Object[_0x099d('0x5d')](_0x474dbf);_0x510add['sort']();for(var _0x535d13=0x0;_0x535d13<_0x510add[_0x099d('0x5e')];_0x535d13++){if(_0xf1119c!=''){_0xf1119c+='&';}_0xf1119c+=_0x510add[_0x535d13]+'='+encodeURIComponent(_0x474dbf[_0x510add[_0x535d13]]);_0x4bcbb8+=_0x474dbf[_0x510add[_0x535d13]];}_0x4bcbb8+=_0xd17093[_0x099d('0x5f')];_0x4bcbb8=_0x7f62b3[_0x099d('0x60')]('md5')[_0x099d('0x18')](_0x4bcbb8)[_0x099d('0x61')](_0x099d('0x62'));if(_0xf1119c!==''){_0xf1119c+='&';}_0xf1119c+=_0x099d('0x63')+_0x4bcbb8;var _0x2fb786={'method':'GET','uri':_0xd17093[_0x099d('0x54')]+'/external/get/send.php?'+_0xf1119c,'json':!![]};return rp(_0x2fb786)['then'](function(_0x585538){var _0x4cd4e0=Object['keys'](_0x585538);if(_0x585538[_0x4cd4e0[0x0]][_0x099d('0x1a')]&&parseInt(_0x585538[_0x4cd4e0[0x0]][_0x099d('0x1a')])===0x0){var _0x2ea3fc={'messageId':_0x585538[_0x4cd4e0[0x0]][_0x099d('0x64')]};if(!_0xd17093[_0x099d('0x3b')]){_0x2ea3fc[_0x099d('0x3c')]=!![];}return _0x4063e0['update'](_0x2ea3fc);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x099d('0x2c'),_0x099d('0x5a'),util[_0x099d('0x3d')](_0x585538['error'],{'showHidden':![],'depth':null}));}})[_0x099d('0x2a')](function(_0x579165){return logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),'csc',util['inspect'](_0x579165,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x5a'),_0x099d('0x65'));}break;case _0x099d('0x66'):if(_0xd17093['apiKey']){var _0x13a7cd={'method':_0x099d('0x39'),'uri':_0x099d('0x67'),'headers':{'Authorization':_0xd17093[_0x099d('0x5f')]},'body':{'content':_0x3cc3e4[_0x099d('0xd')],'to':[_0x3cc3e4[_0x099d('0x23')]],'from':_0xd17093[_0x099d('0x23')],'binary':![],'clientMessageId':'uuid','charset':_0x099d('0x68')},'json':!![]};rp(_0x13a7cd)['then'](function(_0x477a63){if(!_0x477a63[_0x099d('0x1a')]){var _0x21b369={'messageId':_0x477a63[_0x099d('0x24')][0x0][_0x099d('0x69')]};if(!_0xd17093[_0x099d('0x3b')]){_0x21b369[_0x099d('0x3c')]=!![];}return _0x4063e0[_0x099d('0x18')](_0x21b369);}else{return logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x66'),util[_0x099d('0x3d')](_0x477a63['error'],{'showHidden':![],'depth':null}));}})[_0x099d('0x2a')](function(_0x229b06){return logger['error'](_0x099d('0x2b'),'afterCreate',_0x099d('0x66'),util['inspect'](_0x229b06,{'showHidden':![],'depth':null}));});}else{logger[_0x099d('0x1a')](_0x099d('0x2b'),'afterCreate',_0x099d('0x66'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0xd17093[_0x099d('0x30')]&&_0xd17093['password']){var _0x543a7f=util[_0x099d('0x45')](_0x099d('0x46'),_0xd17093[_0x099d('0x30')],_0xd17093[_0x099d('0x31')]);var _0x5ab3bf={'method':'POST','uri':_0x099d('0x6a')+_0xd17093[_0x099d('0x6b')]+_0x099d('0x6c'),'body':{'to':[_0x3cc3e4[_0x099d('0x23')]],'text':_0x3cc3e4['body'],'from':_0xd17093[_0x099d('0x23')],'applicationId':_0xd17093[_0x099d('0x6d')]},'headers':{'Authorization':util[_0x099d('0x45')](_0x099d('0x48'),new Buffer(_0x543a7f)[_0x099d('0x49')](_0x099d('0x4a')))},'json':!![]};rp(_0x5ab3bf)[_0x099d('0x17')](function(_0x43444d){if(_0x43444d['id']){var _0x18a2a6={'messageId':_0x43444d['id']};return _0x4063e0['update'](_0x18a2a6);}else{logger[_0x099d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x099d('0x2c'),'bandwidth',util[_0x099d('0x3d')](_0x43444d,{'showHidden':![],'depth':null}));}})[_0x099d('0x2a')](function(_0x46b88f){logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x6e'),util[_0x099d('0x3d')](_0x46b88f,{'showHidden':![],'depth':null}));});}else{logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x6e'),_0x099d('0x3e'));}break;case _0x099d('0x6f'):if(_0xd17093[_0x099d('0x5f')]){var _0xef0e3e={};var _0x2fb786={'method':_0x099d('0x39'),'uri':_0x099d('0x70'),'headers':{'Authorization':_0x099d('0x71')+_0xd17093[_0x099d('0x5f')],'Content-Type':_0x099d('0x57')},'body':{'from':_0xd17093[_0x099d('0x23')],'to':_0x3cc3e4[_0x099d('0x23')],'text':_0x3cc3e4[_0x099d('0xd')]},'json':!![]};return rp(_0x2fb786)['then'](function(_0x21b3f8){if(_0x21b3f8[_0x099d('0x72')]==0xca){_0xef0e3e[_0x099d('0x73')]=_0x21b3f8;var _0x549264={'method':_0x099d('0x39'),'uri':_0x099d('0x74'),'headers':{'Authorization':_0x099d('0x71')+_0xd17093['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0xef0e3e[_0x099d('0x73')][_0x099d('0x75')]},'json':!![]};return rp(_0x549264)[_0x099d('0x17')](function(_0x13396a){_0xef0e3e[_0x099d('0x76')]=_0x13396a;var _0x21309a={'messageId':_0xef0e3e[_0x099d('0x73')]['refid'],'read':!![]};return _0x4063e0['update'](_0x21309a);});}else{return logger[_0x099d('0x1a')](_0x099d('0x2b'),'afterCreate',_0x099d('0x6f'),util[_0x099d('0x3d')](_0x21b3f8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x207f87){return logger[_0x099d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x099d('0x6f'),util['inspect'](_0x207f87,{'showHidden':![],'depth':null}));});}else{return logger[_0x099d('0x1a')](_0x099d('0x2b'),'afterCreate',_0x099d('0x6f'),_0x099d('0x77'));}break;}}})[_0x099d('0x78')](function(){_0x3438f3();});}else{_0x3438f3();}}},'charset':_0x099d('0x79'),'collate':_0x099d('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 75f7682..00a4846 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 _0x5e5f=['util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsMessage.socket','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','create','body','options','raw','then','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e5f,0x9f));var _0xf5e5=function(_0x159d58,_0x1908e9){_0x159d58=_0x159d58-0x0;var _0x2ab047=_0x5e5f[_0x159d58];return _0x2ab047;};'use strict';var _=require(_0xf5e5('0x0'));var util=require(_0xf5e5('0x1'));var moment=require('moment');var BPromise=require(_0xf5e5('0x2'));var rs=require(_0xf5e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5e5('0x4'))['db'];var utils=require(_0xf5e5('0x5'));var logger=require('../../config/logger')(_0xf5e5('0x6'));var config=require(_0xf5e5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf5e5('0x8')][_0xf5e5('0x9')]({'port':0x232a});config[_0xf5e5('0xa')]=_[_0xf5e5('0xb')](config[_0xf5e5('0xa')],{'host':_0xf5e5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf5e5('0xd'))['register'](socket);function respondWithRpcPromise(_0x108757,_0x4ec380,_0x2885bb){return new BPromise(function(_0x3be706,_0x552603){return client[_0xf5e5('0xe')](_0x108757,_0x2885bb)['then'](function(_0x30e549){logger[_0xf5e5('0xf')](_0xf5e5('0x10'),_0x4ec380,_0xf5e5('0x11'));logger[_0xf5e5('0x12')](_0xf5e5('0x13'),_0x4ec380,_0xf5e5('0x11'),JSON[_0xf5e5('0x14')](_0x30e549));if(_0x30e549[_0xf5e5('0x15')]){if(_0x30e549['error'][_0xf5e5('0x16')]===0x1f4){logger['error'](_0xf5e5('0x10'),_0x4ec380,_0x30e549[_0xf5e5('0x15')][_0xf5e5('0x17')]);return _0x552603(_0x30e549['error'][_0xf5e5('0x17')]);}logger[_0xf5e5('0x15')](_0xf5e5('0x10'),_0x4ec380,_0x30e549[_0xf5e5('0x15')][_0xf5e5('0x17')]);return _0x3be706(_0x30e549[_0xf5e5('0x15')][_0xf5e5('0x17')]);}else{logger['info'](_0xf5e5('0x10'),_0x4ec380,'request\x20sent');_0x3be706(_0x30e549[_0xf5e5('0x18')][_0xf5e5('0x17')]);}})[_0xf5e5('0x19')](function(_0x1d178f){logger[_0xf5e5('0x15')]('SmsMessage,\x20%s,\x20%s',_0x4ec380,_0x1d178f);_0x552603(_0x1d178f);});});}exports[_0xf5e5('0x1a')]=function(_0x2afcee){var _0x1199f3=this;return new Promise(function(_0x591dce,_0x20da05){return db['SmsMessage'][_0xf5e5('0x1b')](_0x2afcee[_0xf5e5('0x1c')],{'raw':_0x2afcee[_0xf5e5('0x1d')]?_0x2afcee[_0xf5e5('0x1d')][_0xf5e5('0x1e')]===undefined?!![]:![]:!![]})[_0xf5e5('0x1f')](function(_0x58990a){logger[_0xf5e5('0xf')](_0xf5e5('0x1a'),_0x2afcee);logger['debug'](_0xf5e5('0x1a'),_0x2afcee,JSON['stringify'](_0x58990a));_0x591dce(_0x58990a);})[_0xf5e5('0x19')](function(_0x24ea21){logger[_0xf5e5('0x15')](_0xf5e5('0x1a'),_0x24ea21['message'],_0x2afcee);_0x20da05(_0x1199f3[_0xf5e5('0x15')](0x1f4,_0x24ea21[_0xf5e5('0x17')]));});});}; \ No newline at end of file +var _0x64f6=['CreateSmsMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x12f108,_0x2f976c){var _0xa6ca6b=function(_0x21967c){while(--_0x21967c){_0x12f108['push'](_0x12f108['shift']());}};_0xa6ca6b(++_0x2f976c);}(_0x64f6,0x13b));var _0x664f=function(_0x5b0369,_0x16e522){_0x5b0369=_0x5b0369-0x0;var _0x4c1547=_0x64f6[_0x5b0369];return _0x4c1547;};'use strict';var _=require(_0x664f('0x0'));var util=require('util');var moment=require(_0x664f('0x1'));var BPromise=require(_0x664f('0x2'));var rs=require(_0x664f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x664f('0x4'));var logger=require(_0x664f('0x5'))('rpc');var config=require(_0x664f('0x6'));var jayson=require(_0x664f('0x7'));var client=jayson[_0x664f('0x8')][_0x664f('0x9')]({'port':0x232a});config[_0x664f('0xa')]=_[_0x664f('0xb')](config[_0x664f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x664f('0xc'))(new Redis(config[_0x664f('0xa')]));require(_0x664f('0xd'))[_0x664f('0xe')](socket);function respondWithRpcPromise(_0x506c62,_0x362637,_0xc4e116){return new BPromise(function(_0x1e56c6,_0x11ed46){return client['request'](_0x506c62,_0xc4e116)[_0x664f('0xf')](function(_0x36bcd8){logger['info'](_0x664f('0x10'),_0x362637,_0x664f('0x11'));logger[_0x664f('0x12')](_0x664f('0x13'),_0x362637,'request\x20sent',JSON[_0x664f('0x14')](_0x36bcd8));if(_0x36bcd8[_0x664f('0x15')]){if(_0x36bcd8['error'][_0x664f('0x16')]===0x1f4){logger[_0x664f('0x15')](_0x664f('0x10'),_0x362637,_0x36bcd8[_0x664f('0x15')][_0x664f('0x17')]);return _0x11ed46(_0x36bcd8['error'][_0x664f('0x17')]);}logger[_0x664f('0x15')](_0x664f('0x10'),_0x362637,_0x36bcd8[_0x664f('0x15')]['message']);return _0x1e56c6(_0x36bcd8['error'][_0x664f('0x17')]);}else{logger[_0x664f('0x18')]('SmsMessage,\x20%s,\x20%s',_0x362637,_0x664f('0x11'));_0x1e56c6(_0x36bcd8[_0x664f('0x19')][_0x664f('0x17')]);}})['catch'](function(_0x29f007){logger[_0x664f('0x15')](_0x664f('0x10'),_0x362637,_0x29f007);_0x11ed46(_0x29f007);});});}exports[_0x664f('0x1a')]=function(_0x256a92){var _0x573f80=this;return new Promise(function(_0x253df2,_0x147644){return db['SmsMessage'][_0x664f('0x1b')](_0x256a92[_0x664f('0x1c')],{'raw':_0x256a92['options']?_0x256a92[_0x664f('0x1d')][_0x664f('0x1e')]===undefined?!![]:![]:!![]})[_0x664f('0xf')](function(_0x5f0c2d){logger[_0x664f('0x18')](_0x664f('0x1a'),_0x256a92);logger[_0x664f('0x12')](_0x664f('0x1a'),_0x256a92,JSON[_0x664f('0x14')](_0x5f0c2d));_0x253df2(_0x5f0c2d);})['catch'](function(_0x2b9910){logger[_0x664f('0x15')](_0x664f('0x1a'),_0x2b9910[_0x664f('0x17')],_0x256a92);_0x147644(_0x573f80[_0x664f('0x15')](0x1f4,_0x2b9910[_0x664f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1aae2b4..b02a676 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 _0x8056=['./smsMessage.events','save','update','emit','register','length','smsMessage:'];(function(_0x8aa083,_0x12b9af){var _0x47ae04=function(_0x465334){while(--_0x465334){_0x8aa083['push'](_0x8aa083['shift']());}};_0x47ae04(++_0x12b9af);}(_0x8056,0xe0));var _0x6805=function(_0x743ca2,_0x3ef14b){_0x743ca2=_0x743ca2-0x0;var _0x1d4b58=_0x8056[_0x743ca2];return _0x1d4b58;};'use strict';var SmsMessageEvents=require(_0x6805('0x0'));var events=[_0x6805('0x1'),'remove',_0x6805('0x2')];function createListener(_0x5c458e,_0x17a824){return function(_0x3a5c94){_0x17a824[_0x6805('0x3')](_0x5c458e,_0x3a5c94);};}function removeListener(_0x23cd47,_0x17eed1){return function(){SmsMessageEvents['removeListener'](_0x23cd47,_0x17eed1);};}exports[_0x6805('0x4')]=function(_0x32c432){for(var _0x3d3f26=0x0,_0x29e83b=events[_0x6805('0x5')];_0x3d3f26<_0x29e83b;_0x3d3f26++){var _0x8dc082=events[_0x3d3f26];var _0x3f806f=createListener(_0x6805('0x6')+_0x8dc082,_0x32c432);SmsMessageEvents['on'](_0x8dc082,_0x3f806f);}}; \ No newline at end of file +var _0x0d0f=['length','smsMessage:','save','emit','removeListener','register'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0d0f,0x194));var _0xf0d0=function(_0x1ac090,_0x9a266f){_0x1ac090=_0x1ac090-0x0;var _0x105ebd=_0x0d0f[_0x1ac090];return _0x105ebd;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xf0d0('0x0'),'remove','update'];function createListener(_0x3ad43c,_0x4e27ab){return function(_0x50eba6){_0x4e27ab[_0xf0d0('0x1')](_0x3ad43c,_0x50eba6);};}function removeListener(_0x483833,_0x16d00e){return function(){SmsMessageEvents[_0xf0d0('0x2')](_0x483833,_0x16d00e);};}exports[_0xf0d0('0x3')]=function(_0x5ca0bc){for(var _0x191e22=0x0,_0x148b52=events[_0xf0d0('0x4')];_0x191e22<_0x148b52;_0x191e22++){var _0xbe1dd0=events[_0x191e22];var _0x3dd04f=createListener(_0xf0d0('0x5')+_0xbe1dd0,_0x5ca0bc);SmsMessageEvents['on'](_0xbe1dd0,_0x3dd04f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 96f8542..6b5e29a 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 _0xcde6=['delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','show','/:id/members','getMembers','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','/:id','removeTeams'];(function(_0x214129,_0x1bcd7d){var _0xf7ae2b=function(_0x53b0c8){while(--_0x53b0c8){_0x214129['push'](_0x214129['shift']());}};_0xf7ae2b(++_0x1bcd7d);}(_0xcde6,0xf3));var _0x6cde=function(_0x3bb030,_0xc6ba75){_0x3bb030=_0x3bb030-0x0;var _0x2d5f96=_0xcde6[_0x3bb030];return _0x2d5f96;};'use strict';var multer=require(_0x6cde('0x0'));var util=require(_0x6cde('0x1'));var path=require(_0x6cde('0x2'));var timeout=require(_0x6cde('0x3'));var express=require(_0x6cde('0x4'));var router=express[_0x6cde('0x5')]();var fs_extra=require(_0x6cde('0x6'));var auth=require(_0x6cde('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6cde('0x8'));var controller=require(_0x6cde('0x9'));router[_0x6cde('0xa')]('/',auth[_0x6cde('0xb')](),controller[_0x6cde('0xc')]);router[_0x6cde('0xa')]('/describe',auth[_0x6cde('0xb')](),controller['describe']);router['get']('/:id',auth[_0x6cde('0xb')](),controller[_0x6cde('0xd')]);router[_0x6cde('0xa')](_0x6cde('0xe'),auth['isAuthenticated'](),controller[_0x6cde('0xf')]);router[_0x6cde('0xa')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x6cde('0xa')](_0x6cde('0x10'),auth[_0x6cde('0xb')](),controller[_0x6cde('0x11')]);router[_0x6cde('0x12')]('/',auth[_0x6cde('0xb')](),controller[_0x6cde('0x13')]);router['post'](_0x6cde('0x14'),auth['isAuthenticated'](),controller[_0x6cde('0x15')]);router[_0x6cde('0x12')](_0x6cde('0x10'),auth['isAuthenticated'](),controller[_0x6cde('0x16')]);router[_0x6cde('0x17')]('/:id',auth[_0x6cde('0xb')](),controller[_0x6cde('0x18')]);router['delete'](_0x6cde('0x19'),auth[_0x6cde('0xb')](),controller['destroy']);router['delete'](_0x6cde('0x14'),auth[_0x6cde('0xb')](),controller[_0x6cde('0x1a')]);router[_0x6cde('0x1b')](_0x6cde('0x10'),auth['isAuthenticated'](),controller[_0x6cde('0x1c')]);module[_0x6cde('0x1d')]=router; \ No newline at end of file +var _0x9f19=['describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','update','delete','destroy','removeAgents','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe'];(function(_0x594edd,_0x44edc0){var _0x468af5=function(_0x3541ff){while(--_0x3541ff){_0x594edd['push'](_0x594edd['shift']());}};_0x468af5(++_0x44edc0);}(_0x9f19,0x17c));var _0x99f1=function(_0x13f461,_0x5298dd){_0x13f461=_0x13f461-0x0;var _0x5c4848=_0x9f19[_0x13f461];return _0x5c4848;};'use strict';var multer=require('multer');var util=require(_0x99f1('0x0'));var path=require('path');var timeout=require(_0x99f1('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x99f1('0x2'));var auth=require(_0x99f1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x99f1('0x4'));var controller=require(_0x99f1('0x5'));router['get']('/',auth[_0x99f1('0x6')](),controller[_0x99f1('0x7')]);router[_0x99f1('0x8')](_0x99f1('0x9'),auth[_0x99f1('0x6')](),controller[_0x99f1('0xa')]);router[_0x99f1('0x8')](_0x99f1('0xb'),auth[_0x99f1('0x6')](),controller['show']);router['get'](_0x99f1('0xc'),auth[_0x99f1('0x6')](),controller[_0x99f1('0xd')]);router[_0x99f1('0x8')](_0x99f1('0xe'),auth[_0x99f1('0x6')](),controller[_0x99f1('0xf')]);router['get']('/:id/users',auth[_0x99f1('0x6')](),controller[_0x99f1('0x10')]);router[_0x99f1('0x11')]('/',auth[_0x99f1('0x6')](),controller[_0x99f1('0x12')]);router[_0x99f1('0x11')]('/:id/teams',auth[_0x99f1('0x6')](),controller[_0x99f1('0x13')]);router['post'](_0x99f1('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x99f1('0x6')](),controller[_0x99f1('0x15')]);router[_0x99f1('0x16')](_0x99f1('0xb'),auth[_0x99f1('0x6')](),controller[_0x99f1('0x17')]);router[_0x99f1('0x16')](_0x99f1('0xe'),auth[_0x99f1('0x6')](),controller['removeTeams']);router[_0x99f1('0x16')](_0x99f1('0x14'),auth['isAuthenticated'](),controller[_0x99f1('0x18')]);module[_0x99f1('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 02fd539..96b2fb2 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 _0xa00e=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5bfeac,_0x1c787f){var _0x5f596e=function(_0x6c605f){while(--_0x6c605f){_0x5bfeac['push'](_0x5bfeac['shift']());}};_0x5f596e(++_0x1c787f);}(_0xa00e,0x1e3));var _0xea00=function(_0x435245,_0x3c9fa2){_0x435245=_0x435245-0x0;var _0x325180=_0xa00e[_0x435245];return _0x325180;};'use strict';var Sequelize=require(_0xea00('0x0'));module[_0xea00('0x1')]={'name':{'type':Sequelize[_0xea00('0x2')],'unique':_0xea00('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea00('0x2')]},'timeout':{'type':Sequelize[_0xea00('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea00('0x5')](_0xea00('0x6'),_0xea00('0x7'),_0xea00('0x8'))}}; \ No newline at end of file +var _0x79dc=['beepall','roundrobin','exports','name','STRING','INTEGER','ENUM'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x79dc,0x1c2));var _0xc79d=function(_0x4e1ef5,_0x4c94cd){_0x4e1ef5=_0x4e1ef5-0x0;var _0x58afa8=_0x79dc[_0x4e1ef5];return _0x58afa8;};'use strict';var Sequelize=require('sequelize');module[_0xc79d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc79d('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc79d('0x2')]},'timeout':{'type':Sequelize[_0xc79d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc79d('0x4')]('rrmemory',_0xc79d('0x5'),_0xc79d('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0dabb7a..5a13856 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 _0xc275=['keys','include','catch','create','body','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','omit','getAgents','hasOwnProperty','rimraf','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','SmsQueues','UserProfileResource','error','name','send','index','map','SmsQueue','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','filter','options','includeAll','findAll','rows','show','params'];(function(_0x2baf49,_0xea3f8c){var _0x112aa0=function(_0x1c7060){while(--_0x1c7060){_0x2baf49['push'](_0x2baf49['shift']());}};_0x112aa0(++_0xea3f8c);}(_0xc275,0x1c5));var _0x5c27=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc275[_0x16b9ed];return _0x66b1f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c27('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(_0x5c27('0x1'));var util=require(_0x5c27('0x2'));var path=require(_0x5c27('0x3'));var sox=require(_0x5c27('0x4'));var csv=require(_0x5c27('0x5'));var ejs=require(_0x5c27('0x6'));var fs=require('fs');var fs_extra=require(_0x5c27('0x7'));var _=require(_0x5c27('0x8'));var squel=require(_0x5c27('0x9'));var crypto=require('crypto');var jsforce=require(_0x5c27('0xa'));var deskjs=require(_0x5c27('0xb'));var toCsv=require(_0x5c27('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c27('0xc'));var authService=require(_0x5c27('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c27('0xe'))(_0x5c27('0xf'));var utils=require(_0x5c27('0x10'));var config=require(_0x5c27('0x11'));var licenseUtil=require(_0x5c27('0x12'));var db=require('../../mysqldb')['db'];config[_0x5c27('0x13')]=_[_0x5c27('0x14')](config[_0x5c27('0x13')],{'host':_0x5c27('0x15'),'port':0x18eb});var socket=require(_0x5c27('0x16'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x5c27('0x17')](socket);function respondWithStatusCode(_0x234857,_0x43bea3){_0x43bea3=_0x43bea3||0xcc;return function(_0x12b4ff){if(_0x12b4ff){return _0x234857[_0x5c27('0x18')](_0x43bea3);}return _0x234857['status'](_0x43bea3)[_0x5c27('0x19')]();};}function respondWithResult(_0x876ab8,_0x12cb23){_0x12cb23=_0x12cb23||0xc8;return function(_0x4e820a){if(_0x4e820a){return _0x876ab8[_0x5c27('0x1a')](_0x12cb23)['json'](_0x4e820a);}};}function respondWithFilteredResult(_0x28aff9,_0x19d376){return function(_0x1d1518){if(_0x1d1518){var _0x381d7f=typeof _0x19d376[_0x5c27('0x1b')]===_0x5c27('0x1c')&&typeof _0x19d376['limit']==='undefined';var _0x59014f=_0x1d1518[_0x5c27('0x1d')];var _0x193d73=_0x381d7f?0x0:_0x19d376['offset'];var _0x2afc25=_0x381d7f?_0x1d1518['count']:_0x19d376[_0x5c27('0x1b')]+_0x19d376[_0x5c27('0x1e')];var _0x58595f;if(_0x2afc25>=_0x59014f){_0x2afc25=_0x59014f;_0x58595f=0xc8;}else{_0x58595f=0xce;}_0x28aff9[_0x5c27('0x1a')](_0x58595f);return _0x28aff9[_0x5c27('0x1f')](_0x5c27('0x20'),_0x193d73+'-'+_0x2afc25+'/'+_0x59014f)[_0x5c27('0x21')](_0x1d1518);}return null;};}function patchUpdates(_0x2c9df9){return function(_0x37094e){try{jsonpatch[_0x5c27('0x22')](_0x37094e,_0x2c9df9,!![]);}catch(_0x3d52f0){return BPromise[_0x5c27('0x23')](_0x3d52f0);}return _0x37094e['save']();};}function saveUpdates(_0x4efa0c,_0x5721e7){return function(_0x3ff293){if(_0x3ff293){return _0x3ff293[_0x5c27('0x24')](_0x4efa0c)[_0x5c27('0x25')](function(_0x41e7f8){return _0x41e7f8;});}return null;};}function removeEntity(_0x1779aa,_0x1a6141){return function(_0x5d5591){if(_0x5d5591){return _0x5d5591[_0x5c27('0x26')]()[_0x5c27('0x25')](function(){var _0x372181=_0x5d5591[_0x5c27('0x27')]({'plain':!![]});var _0x194829=_0x5c27('0x28');return db[_0x5c27('0x29')]['destroy']({'where':{'type':_0x194829,'resourceId':_0x372181['id']}})['then'](function(){return _0x5d5591;});})[_0x5c27('0x25')](function(){_0x1779aa[_0x5c27('0x1a')](0xcc)[_0x5c27('0x19')]();});}};}function handleEntityNotFound(_0xc38e46,_0x1d0af7){return function(_0x3bacfe){if(!_0x3bacfe){_0xc38e46['sendStatus'](0x194);}return _0x3bacfe;};}function handleError(_0x28c3f3,_0x2b4eac){_0x2b4eac=_0x2b4eac||0x1f4;return function(_0x52e90c){logger[_0x5c27('0x2a')](_0x52e90c['stack']);if(_0x52e90c[_0x5c27('0x2b')]){delete _0x52e90c[_0x5c27('0x2b')];}_0x28c3f3[_0x5c27('0x1a')](_0x2b4eac)[_0x5c27('0x2c')](_0x52e90c);};}exports[_0x5c27('0x2d')]=function(_0x4f6523,_0x36cc46){var _0x1bebd7={},_0x4cc02a={},_0x320754={'count':0x0,'rows':[]};var _0x4ee368=_[_0x5c27('0x2e')](db[_0x5c27('0x2f')][_0x5c27('0x30')],function(_0x404c0b){return{'name':_0x404c0b['fieldName'],'type':_0x404c0b[_0x5c27('0x31')][_0x5c27('0x32')]};});_0x4cc02a[_0x5c27('0x33')]=_[_0x5c27('0x2e')](_0x4ee368,_0x5c27('0x2b'));_0x4cc02a[_0x5c27('0x34')]=_['keys'](_0x4f6523[_0x5c27('0x34')]);_0x4cc02a[_0x5c27('0x35')]=_[_0x5c27('0x36')](_0x4cc02a[_0x5c27('0x33')],_0x4cc02a[_0x5c27('0x34')]);_0x1bebd7[_0x5c27('0x37')]=_[_0x5c27('0x36')](_0x4cc02a[_0x5c27('0x33')],qs[_0x5c27('0x38')](_0x4f6523[_0x5c27('0x34')]['fields']));_0x1bebd7[_0x5c27('0x37')]=_0x1bebd7[_0x5c27('0x37')][_0x5c27('0x39')]?_0x1bebd7[_0x5c27('0x37')]:_0x4cc02a[_0x5c27('0x33')];if(!_0x4f6523[_0x5c27('0x34')]['hasOwnProperty'](_0x5c27('0x3a'))){_0x1bebd7[_0x5c27('0x1e')]=qs[_0x5c27('0x1e')](_0x4f6523[_0x5c27('0x34')][_0x5c27('0x1e')]);_0x1bebd7[_0x5c27('0x1b')]=qs[_0x5c27('0x1b')](_0x4f6523[_0x5c27('0x34')]['offset']);}_0x1bebd7[_0x5c27('0x3b')]=qs[_0x5c27('0x3c')](_0x4f6523[_0x5c27('0x34')]['sort']);_0x1bebd7['where']=qs[_0x5c27('0x35')](_[_0x5c27('0x3d')](_0x4f6523[_0x5c27('0x34')],_0x4cc02a[_0x5c27('0x35')]),_0x4ee368);if(_0x4f6523[_0x5c27('0x34')]['filter']){_0x1bebd7[_0x5c27('0x3e')]=_[_0x5c27('0x3f')](_0x1bebd7[_0x5c27('0x3e')],{'$or':_[_0x5c27('0x2e')](_0x4ee368,function(_0x57b973){if(_0x57b973['type']!=='VIRTUAL'){var _0x324a48={};_0x324a48[_0x57b973[_0x5c27('0x2b')]]={'$like':'%'+_0x4f6523[_0x5c27('0x34')][_0x5c27('0x40')]+'%'};return _0x324a48;}})});}_0x1bebd7=_['merge']({},_0x1bebd7,_0x4f6523[_0x5c27('0x41')]);var _0x5a6d62={'where':_0x1bebd7[_0x5c27('0x3e')]};return db[_0x5c27('0x2f')][_0x5c27('0x1d')](_0x5a6d62)['then'](function(_0x100717){_0x320754[_0x5c27('0x1d')]=_0x100717;if(_0x4f6523[_0x5c27('0x34')][_0x5c27('0x42')]){_0x1bebd7['include']=[{'all':!![]}];}return db['SmsQueue'][_0x5c27('0x43')](_0x1bebd7);})[_0x5c27('0x25')](function(_0x437cd4){_0x320754[_0x5c27('0x44')]=_0x437cd4;return _0x320754;})['then'](respondWithFilteredResult(_0x36cc46,_0x1bebd7))['catch'](handleError(_0x36cc46,null));};exports[_0x5c27('0x45')]=function(_0x2f957f,_0x5d82c4){var _0x10fee7={'raw':!![],'where':{'id':_0x2f957f[_0x5c27('0x46')]['id']}},_0x3ae902={};_0x3ae902[_0x5c27('0x33')]=_[_0x5c27('0x47')](db[_0x5c27('0x2f')][_0x5c27('0x30')]);_0x3ae902[_0x5c27('0x34')]=_[_0x5c27('0x47')](_0x2f957f[_0x5c27('0x34')]);_0x3ae902['filters']=_[_0x5c27('0x36')](_0x3ae902[_0x5c27('0x33')],_0x3ae902[_0x5c27('0x34')]);_0x10fee7['attributes']=_[_0x5c27('0x36')](_0x3ae902[_0x5c27('0x33')],qs[_0x5c27('0x38')](_0x2f957f[_0x5c27('0x34')][_0x5c27('0x38')]));_0x10fee7[_0x5c27('0x37')]=_0x10fee7[_0x5c27('0x37')][_0x5c27('0x39')]?_0x10fee7[_0x5c27('0x37')]:_0x3ae902[_0x5c27('0x33')];if(_0x2f957f['query'][_0x5c27('0x42')]){_0x10fee7[_0x5c27('0x48')]=[{'all':!![]}];}_0x10fee7=_[_0x5c27('0x3f')]({},_0x10fee7,_0x2f957f[_0x5c27('0x41')]);return db['SmsQueue']['find'](_0x10fee7)[_0x5c27('0x25')](handleEntityNotFound(_0x5d82c4,null))['then'](respondWithResult(_0x5d82c4,null))[_0x5c27('0x49')](handleError(_0x5d82c4,null));};exports['create']=function(_0x2af072,_0x357782){return db[_0x5c27('0x2f')][_0x5c27('0x4a')](_0x2af072[_0x5c27('0x4b')],{})[_0x5c27('0x25')](function(_0x4b7921){var _0x36228b=_0x2af072[_0x5c27('0x4c')]['get']({'plain':!![]});if(!_0x36228b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36228b['role']==='user'){var _0x3dda45=_0x4b7921['get']({'plain':!![]});var _0x290108=_0x5c27('0x28');return db[_0x5c27('0x4d')][_0x5c27('0x4e')]({'where':{'name':_0x290108,'userProfileId':_0x36228b['userProfileId']},'raw':!![]})[_0x5c27('0x25')](function(_0x564354){if(_0x564354&&_0x564354[_0x5c27('0x4f')]===0x0){return db[_0x5c27('0x29')][_0x5c27('0x4a')]({'name':_0x3dda45['name'],'resourceId':_0x3dda45['id'],'type':_0x564354[_0x5c27('0x2b')],'sectionId':_0x564354['id']},{})['then'](function(){return _0x4b7921;});}else{return _0x4b7921;}})[_0x5c27('0x49')](function(_0x46942b){logger[_0x5c27('0x2a')](_0x5c27('0x50'),_0x46942b);throw _0x46942b;});}return _0x4b7921;})[_0x5c27('0x25')](respondWithResult(_0x357782,0xc9))['catch'](handleError(_0x357782,null));};exports[_0x5c27('0x24')]=function(_0x5b0f0b,_0x25de71){if(_0x5b0f0b[_0x5c27('0x4b')]['id']){delete _0x5b0f0b[_0x5c27('0x4b')]['id'];}return db['SmsQueue'][_0x5c27('0x4e')]({'where':{'id':_0x5b0f0b[_0x5c27('0x46')]['id']}})[_0x5c27('0x25')](handleEntityNotFound(_0x25de71,null))[_0x5c27('0x25')](saveUpdates(_0x5b0f0b[_0x5c27('0x4b')],null))[_0x5c27('0x25')](respondWithResult(_0x25de71,null))[_0x5c27('0x49')](handleError(_0x25de71,null));};exports[_0x5c27('0x26')]=function(_0x5d0751,_0x3bf8e7){return db[_0x5c27('0x2f')]['find']({'where':{'id':_0x5d0751['params']['id']}})[_0x5c27('0x25')](handleEntityNotFound(_0x3bf8e7,null))['then'](removeEntity(_0x3bf8e7,null))[_0x5c27('0x49')](handleError(_0x3bf8e7,null));};exports[_0x5c27('0x51')]=function(_0x12060a,_0x56ecc0){return db['SmsQueue'][_0x5c27('0x51')]()[_0x5c27('0x25')](respondWithResult(_0x56ecc0,null))[_0x5c27('0x49')](handleError(_0x56ecc0,null));};exports[_0x5c27('0x52')]=function(_0x308d04,_0x203c5f,_0x279b85){var _0x55e093={'raw':!![],'where':{}},_0x4d9ada={},_0x47d4c6;return db[_0x5c27('0x2f')][_0x5c27('0x53')]({'where':{'id':_0x308d04['params']['id']}})['then'](handleEntityNotFound(_0x203c5f,null))[_0x5c27('0x25')](function(_0x5851bc){if(_0x5851bc){_0x47d4c6=_0x5851bc[_0x5c27('0x27')]({'plain':!![]});_0x4d9ada['model']=_['keys'](db[_0x5c27('0x54')][_0x5c27('0x30')]);_0x4d9ada[_0x5c27('0x34')]=_[_0x5c27('0x47')](_0x308d04['query']);_0x4d9ada[_0x5c27('0x35')]=_[_0x5c27('0x36')](_0x4d9ada[_0x5c27('0x33')],_0x4d9ada[_0x5c27('0x34')]);_0x55e093['attributes']=_['intersection'](_0x4d9ada[_0x5c27('0x33')],qs['fields'](_0x308d04[_0x5c27('0x34')][_0x5c27('0x38')]));_0x55e093[_0x5c27('0x37')]=_0x55e093['attributes']['length']?_0x55e093['attributes']:_0x4d9ada[_0x5c27('0x33')];if(!_0x308d04[_0x5c27('0x34')]['hasOwnProperty']('nolimit')){_0x55e093[_0x5c27('0x1e')]=qs[_0x5c27('0x1e')](_0x308d04[_0x5c27('0x34')]['limit']);_0x55e093[_0x5c27('0x1b')]=qs[_0x5c27('0x1b')](_0x308d04['query'][_0x5c27('0x1b')]);}_0x55e093[_0x5c27('0x3b')]=qs['sort'](_0x308d04[_0x5c27('0x34')][_0x5c27('0x3c')]);_0x55e093[_0x5c27('0x3e')]=qs[_0x5c27('0x35')](_['pick'](_0x308d04['query'],_0x4d9ada[_0x5c27('0x35')]));_0x55e093[_0x5c27('0x3e')][_0x5c27('0x55')]=_0x5851bc['id'];if(_0x308d04[_0x5c27('0x34')][_0x5c27('0x40')]){_0x55e093[_0x5c27('0x3e')]=_[_0x5c27('0x3f')](_0x55e093['where'],{'$or':_[_0x5c27('0x2e')](_0x55e093['attributes'],function(_0x56bf88){var _0x56dcac={};_0x56dcac[_0x56bf88]={'$like':'%'+_0x308d04[_0x5c27('0x34')][_0x5c27('0x40')]+'%'};return _0x56dcac;})});}_0x55e093=_[_0x5c27('0x3f')]({},_0x55e093,_0x308d04[_0x5c27('0x41')]);return db[_0x5c27('0x54')][_0x5c27('0x43')](_0x55e093);}})[_0x5c27('0x25')](function(_0x3ba1dd){if(_0x3ba1dd){return db[_0x5c27('0x56')]['findAndCountAll']({'where':{'id':_[_0x5c27('0x2e')](_0x3ba1dd,_0x5c27('0x57')),'role':_0x5c27('0x58')},'attributes':['id',_0x5c27('0x2b'),_0x5c27('0x59'),_0x5c27('0x5a'),_0x5c27('0x5b')]});}})[_0x5c27('0x25')](function(_0x105325){if(_0x105325){return{'count':_0x105325[_0x5c27('0x1d')],'rows':_['map'](_0x105325[_0x5c27('0x44')],function(_0x9aebd6){return{'membername':_0x9aebd6[_0x5c27('0x2b')],'UserId':_0x9aebd6['id'],'queue_name':_0x47d4c6[_0x5c27('0x2b')],'SmsQueueId':_0x47d4c6['id'],'interface':util[_0x5c27('0x5c')](_0x5c27('0x5d'),'SIP',_0x9aebd6['name']),'penalty':0x0,'paused':_0x9aebd6['smsPause'],'createdAt':_0x9aebd6[_0x5c27('0x5b')],'updatedAt':_0x9aebd6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5c27('0x25')](respondWithFilteredResult(_0x203c5f,_0x55e093))['catch'](handleError(_0x203c5f,null));};exports[_0x5c27('0x5e')]=function(_0x590677,_0x458404,_0x5b6688){var _0x37c9e3={};var _0x285937={};var _0x557cc2;var _0x41495b;return db[_0x5c27('0x2f')][_0x5c27('0x53')]({'where':{'id':_0x590677[_0x5c27('0x46')]['id']}})[_0x5c27('0x25')](handleEntityNotFound(_0x458404,null))[_0x5c27('0x25')](function(_0x5781a3){if(_0x5781a3){_0x557cc2=_0x5781a3;_0x285937[_0x5c27('0x33')]=_[_0x5c27('0x47')](db['Team'][_0x5c27('0x30')]);_0x285937['query']=_[_0x5c27('0x47')](_0x590677['query']);_0x285937[_0x5c27('0x35')]=_[_0x5c27('0x36')](_0x285937[_0x5c27('0x33')],_0x285937['query']);_0x37c9e3[_0x5c27('0x37')]=_[_0x5c27('0x36')](_0x285937[_0x5c27('0x33')],qs['fields'](_0x590677[_0x5c27('0x34')][_0x5c27('0x38')]));_0x37c9e3['attributes']=_0x37c9e3[_0x5c27('0x37')][_0x5c27('0x39')]?_0x37c9e3[_0x5c27('0x37')]:_0x285937['model'];_0x37c9e3[_0x5c27('0x3b')]=qs[_0x5c27('0x3c')](_0x590677['query'][_0x5c27('0x3c')]);_0x37c9e3[_0x5c27('0x3e')]=qs[_0x5c27('0x35')](_['pick'](_0x590677[_0x5c27('0x34')],_0x285937[_0x5c27('0x35')]));if(_0x590677[_0x5c27('0x34')]['filter']){_0x37c9e3[_0x5c27('0x3e')]=_[_0x5c27('0x3f')](_0x37c9e3['where'],{'$or':_[_0x5c27('0x2e')](_0x37c9e3['attributes'],function(_0xd7c9b0){var _0x4d1574={};_0x4d1574[_0xd7c9b0]={'$like':'%'+_0x590677[_0x5c27('0x34')][_0x5c27('0x40')]+'%'};return _0x4d1574;})});}_0x37c9e3=_[_0x5c27('0x3f')]({},_0x37c9e3,_0x590677['options']);return _0x557cc2[_0x5c27('0x5e')](_0x37c9e3);}})[_0x5c27('0x25')](function(_0xa95e71){if(_0xa95e71){_0x41495b=_0xa95e71[_0x5c27('0x39')];if(!_0x590677['query']['hasOwnProperty']('nolimit')){_0x37c9e3[_0x5c27('0x1e')]=qs[_0x5c27('0x1e')](_0x590677[_0x5c27('0x34')][_0x5c27('0x1e')]);_0x37c9e3[_0x5c27('0x1b')]=qs[_0x5c27('0x1b')](_0x590677[_0x5c27('0x34')][_0x5c27('0x1b')]);}return _0x557cc2['getTeams'](_0x37c9e3);}})[_0x5c27('0x25')](function(_0x5dd1db){if(_0x5dd1db){return _0x5dd1db?{'count':_0x41495b,'rows':_0x5dd1db}:null;}})[_0x5c27('0x25')](respondWithResult(_0x458404,null))[_0x5c27('0x49')](handleError(_0x458404,null));};exports[_0x5c27('0x5f')]=function(_0x218150,_0x5d6a69,_0x3d1c73){var _0x4e0ec0=_0x218150[_0x5c27('0x4b')][_0x5c27('0x60')];return db[_0x5c27('0x61')][_0x5c27('0x43')]({'where':{'id':_0x4e0ec0},'attributes':['id'],'include':[{'model':db[_0x5c27('0x56')],'as':_0x5c27('0x62'),'attributes':['id',_0x5c27('0x2b'),_0x5c27('0x63'),_0x5c27('0x64'),_0x5c27('0x65')],'raw':!![]}]})[_0x5c27('0x25')](function(_0x287f2a){if(_0x287f2a){var _0x366fb9=_[_0x5c27('0x66')](_0x287f2a,function(_0x491582){var _0x34ac3b=_0x491582[_0x5c27('0x27')]({'plain':!![]});return _0x34ac3b[_0x5c27('0x62')];});return db[_0x5c27('0x2f')][_0x5c27('0x4e')]({'where':{'id':_0x218150[_0x5c27('0x46')]['id']}})[_0x5c27('0x25')](function(_0x45968c){return db['sequelize'][_0x5c27('0x67')](function(_0x4c51fa){return _0x45968c[_0x5c27('0x5f')](_0x4e0ec0,{'transaction':_0x4c51fa})[_0x5c27('0x25')](function(){return BPromise['each'](_0x366fb9,function(_0x343ab5){return db[_0x5c27('0x54')][_0x5c27('0x68')]({'where':{'UserId':_0x343ab5['id'],'SmsQueueId':_0x218150[_0x5c27('0x46')]['id']},'transaction':_0x4c51fa});});})[_0x5c27('0x25')](function(){_0x366fb9['forEach'](function(_0x549eb7){socket[_0x5c27('0x69')](_0x5c27('0x6a'),{'UserId':_0x549eb7['id'],'SmsQueueId':_0x45968c['id']});});});});});}})[_0x5c27('0x25')](respondWithStatusCode(_0x5d6a69,null))[_0x5c27('0x49')](handleError(_0x5d6a69,null));};exports[_0x5c27('0x6b')]=function(_0x3cab23,_0x17080e,_0x496a0a){return db['Team'][_0x5c27('0x43')]({'where':{'id':_0x3cab23['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x5c27('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5c27('0x25')](handleEntityNotFound(_0x17080e,null))[_0x5c27('0x25')](function(_0x1202fb){var _0x30171f=_[_0x5c27('0x2e')](_0x1202fb,'id');var _0x77b760=[];var _0x18c732=[];var _0x36b8ad=squel[_0x5c27('0x6c')]();_0x36b8ad[_0x5c27('0x6d')](_0x5c27('0x6e'))[_0x5c27('0x6f')](_0x5c27('0x70'),'tq')[_0x5c27('0x71')](_0x5c27('0x72'),'ut',_0x5c27('0x73'))[_0x5c27('0x3e')]('SmsQueueId\x20=\x20?',_0x3cab23[_0x5c27('0x46')]['id']);for(var _0x85b355=0x0;_0x85b355<_0x1202fb[_0x5c27('0x39')];_0x85b355+=0x1){let _0x399184=_0x1202fb[_0x85b355];for(var _0x29fb4e=0x0;_0x29fb4e<_0x399184['Agents'][_0x5c27('0x39')];_0x29fb4e+=0x1){let _0x2db523=_0x399184[_0x5c27('0x62')][_0x29fb4e];var _0x165246=_0x36b8ad['clone']();_0x165246[_0x5c27('0x3e')](_0x5c27('0x74'),_0x2db523['id']);_0x18c732['push'](db[_0x5c27('0x75')][_0x5c27('0x34')](_0x165246['toString'](),{'type':db['sequelize'][_0x5c27('0x76')][_0x5c27('0x77')]})['then'](function(_0x359e59){if(_0x359e59[_0x5c27('0x39')]===0x1){return _0x2db523['id'];}else{var _0x227013=_[_0x5c27('0x78')](_[_0x5c27('0x2e')](_0x359e59,_0x5c27('0x79')),function(_0x3367e3){return _['includes'](_0x30171f,_0x3367e3);});if(_0x227013){return _0x2db523['id'];}}}));}}return BPromise[_0x5c27('0x7a')](_0x18c732)[_0x5c27('0x25')](function(_0x4b2601){_0x77b760=_(_0x77b760)['union'](_0x4b2601)[_0x5c27('0x7b')]()[_0x5c27('0x7c')]();return db['SmsQueue']['find']({'where':{'id':_0x3cab23[_0x5c27('0x46')]['id']}})[_0x5c27('0x25')](function(_0x51367b){return db[_0x5c27('0x75')][_0x5c27('0x67')](function(_0x243cd7){return _0x51367b[_0x5c27('0x6b')](_0x3cab23[_0x5c27('0x34')]['ids'],{'transaction':_0x243cd7})[_0x5c27('0x25')](function(){if(!_[_0x5c27('0x7d')](_0x77b760)){return _0x51367b[_0x5c27('0x7e')](_0x77b760,{'transaction':_0x243cd7});}})['then'](function(){_0x77b760['forEach'](function(_0x22463e){socket[_0x5c27('0x69')](_0x5c27('0x7f'),{'UserId':_0x22463e,'SmsQueueId':_0x51367b['id']});});});});});});})[_0x5c27('0x25')](respondWithStatusCode(_0x17080e,null))[_0x5c27('0x49')](handleError(_0x17080e,null));};exports['addAgents']=function(_0x42317f,_0x56d5e3,_0x3387cc){return db['SmsQueue'][_0x5c27('0x4e')]({'where':{'id':_0x42317f[_0x5c27('0x46')]['id']}})[_0x5c27('0x25')](handleEntityNotFound(_0x56d5e3,null))['then'](function(_0x4e149e){if(_0x4e149e){return _0x4e149e['addAgents'](_0x42317f[_0x5c27('0x4b')][_0x5c27('0x60')],_[_0x5c27('0x80')](_0x42317f['body'],[_0x5c27('0x60'),'id'])||{})['spread'](function(_0x33bcad){for(var _0x5a76f4=0x0;_0x5a76f4<_0x42317f[_0x5c27('0x4b')][_0x5c27('0x60')][_0x5c27('0x39')];_0x5a76f4+=0x1){socket[_0x5c27('0x69')](_0x5c27('0x6a'),{'UserId':Number(_0x42317f[_0x5c27('0x4b')][_0x5c27('0x60')][_0x5a76f4]),'SmsQueueId':Number(_0x42317f[_0x5c27('0x46')]['id'])});}return _0x33bcad;});}})[_0x5c27('0x25')](respondWithResult(_0x56d5e3,null))[_0x5c27('0x49')](handleError(_0x56d5e3,null));};exports[_0x5c27('0x7e')]=function(_0x1df89c,_0x187f20,_0x449315){return db[_0x5c27('0x2f')][_0x5c27('0x4e')]({'where':{'id':_0x1df89c['params']['id']}})['then'](handleEntityNotFound(_0x187f20,null))[_0x5c27('0x25')](function(_0x8e4916){if(_0x8e4916){return _0x8e4916['removeAgents'](_0x1df89c[_0x5c27('0x34')][_0x5c27('0x60')])[_0x5c27('0x25')](function(){if(_['isArray'](_0x1df89c['query'][_0x5c27('0x60')])){for(var _0xa74469=0x0;_0xa74469<_0x1df89c['query'][_0x5c27('0x60')][_0x5c27('0x39')];_0xa74469+=0x1){socket[_0x5c27('0x69')](_0x5c27('0x7f'),{'UserId':Number(_0x1df89c[_0x5c27('0x34')][_0x5c27('0x60')][_0xa74469]),'SmsQueueId':Number(_0x1df89c[_0x5c27('0x46')]['id'])});}}else{socket[_0x5c27('0x69')](_0x5c27('0x7f'),{'UserId':Number(_0x1df89c[_0x5c27('0x34')][_0x5c27('0x60')]),'SmsQueueId':Number(_0x1df89c[_0x5c27('0x46')]['id'])});}});}})[_0x5c27('0x25')](respondWithStatusCode(_0x187f20,null))['catch'](handleError(_0x187f20,null));};exports[_0x5c27('0x81')]=function(_0x55a28d,_0x298ec2,_0x26f38d){var _0x5a81bf={};var _0x3a822e={};var _0x2cf4da;var _0x49948a;return db[_0x5c27('0x2f')][_0x5c27('0x53')]({'where':{'id':_0x55a28d[_0x5c27('0x46')]['id']}})[_0x5c27('0x25')](handleEntityNotFound(_0x298ec2,null))[_0x5c27('0x25')](function(_0x24f408){if(_0x24f408){_0x2cf4da=_0x24f408;_0x3a822e[_0x5c27('0x33')]=_[_0x5c27('0x47')](db[_0x5c27('0x56')]['rawAttributes']);_0x3a822e[_0x5c27('0x34')]=_['keys'](_0x55a28d['query']);_0x3a822e[_0x5c27('0x35')]=_[_0x5c27('0x36')](_0x3a822e[_0x5c27('0x33')],_0x3a822e[_0x5c27('0x34')]);_0x5a81bf[_0x5c27('0x37')]=_[_0x5c27('0x36')](_0x3a822e[_0x5c27('0x33')],qs[_0x5c27('0x38')](_0x55a28d[_0x5c27('0x34')]['fields']));_0x5a81bf['attributes']=_0x5a81bf[_0x5c27('0x37')][_0x5c27('0x39')]?_0x5a81bf['attributes']:_0x3a822e[_0x5c27('0x33')];_0x5a81bf[_0x5c27('0x3b')]=qs[_0x5c27('0x3c')](_0x55a28d[_0x5c27('0x34')][_0x5c27('0x3c')]);_0x5a81bf[_0x5c27('0x3e')]=qs[_0x5c27('0x35')](_[_0x5c27('0x3d')](_0x55a28d['query'],_0x3a822e[_0x5c27('0x35')]));if(_0x55a28d[_0x5c27('0x34')][_0x5c27('0x40')]){_0x5a81bf['where']=_['merge'](_0x5a81bf[_0x5c27('0x3e')],{'$or':_[_0x5c27('0x2e')](_0x5a81bf['attributes'],function(_0x150534){var _0x3b6672={};_0x3b6672[_0x150534]={'$like':'%'+_0x55a28d['query'][_0x5c27('0x40')]+'%'};return _0x3b6672;})});}_0x5a81bf=_[_0x5c27('0x3f')]({},_0x5a81bf,_0x55a28d['options']);return _0x2cf4da[_0x5c27('0x81')](_0x5a81bf);}})[_0x5c27('0x25')](function(_0x570dfc){if(_0x570dfc){_0x49948a=_0x570dfc[_0x5c27('0x39')];if(!_0x55a28d[_0x5c27('0x34')][_0x5c27('0x82')](_0x5c27('0x3a'))){_0x5a81bf[_0x5c27('0x1e')]=qs[_0x5c27('0x1e')](_0x55a28d[_0x5c27('0x34')][_0x5c27('0x1e')]);_0x5a81bf[_0x5c27('0x1b')]=qs[_0x5c27('0x1b')](_0x55a28d[_0x5c27('0x34')]['offset']);}return _0x2cf4da['getAgents'](_0x5a81bf);}})[_0x5c27('0x25')](function(_0x11c39c){if(_0x11c39c){return _0x11c39c?{'count':_0x49948a,'rows':_0x11c39c}:null;}})[_0x5c27('0x25')](respondWithResult(_0x298ec2,null))['catch'](handleError(_0x298ec2,null));}; \ No newline at end of file +var _0xf8f2=['describe','findOne','UserSmsQueue','order','sort','pick','SmsQueueId','User','findAndCountAll','UserId','smsPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','compact','value','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','apply','reject','save','update','then','destroy','SmsQueues','end','stack','name','send','index','map','SmsQueue','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation'];(function(_0x38deb8,_0x572466){var _0xae0a3b=function(_0x31a67b){while(--_0x31a67b){_0x38deb8['push'](_0x38deb8['shift']());}};_0xae0a3b(++_0x572466);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x140fae,_0xac5e4a){_0x140fae=_0x140fae-0x0;var _0x5eac87=_0xf8f2[_0x140fae];return _0x5eac87;};'use strict';var emlformat=require(_0x2f8f('0x0'));var rimraf=require(_0x2f8f('0x1'));var zipdir=require(_0x2f8f('0x2'));var jsonpatch=require(_0x2f8f('0x3'));var rp=require('request-promise');var moment=require(_0x2f8f('0x4'));var BPromise=require(_0x2f8f('0x5'));var Mustache=require(_0x2f8f('0x6'));var util=require(_0x2f8f('0x7'));var path=require(_0x2f8f('0x8'));var sox=require('sox');var csv=require(_0x2f8f('0x9'));var ejs=require(_0x2f8f('0xa'));var fs=require('fs');var fs_extra=require(_0x2f8f('0xb'));var _=require(_0x2f8f('0xc'));var squel=require(_0x2f8f('0xd'));var crypto=require(_0x2f8f('0xe'));var jsforce=require(_0x2f8f('0xf'));var deskjs=require(_0x2f8f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f8f('0x11'));var Papa=require(_0x2f8f('0x12'));var Redis=require(_0x2f8f('0x13'));var authService=require(_0x2f8f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2f8f('0x15'));var hardwareService=require(_0x2f8f('0x16'));var logger=require('../../config/logger')(_0x2f8f('0x17'));var utils=require(_0x2f8f('0x18'));var config=require(_0x2f8f('0x19'));var licenseUtil=require(_0x2f8f('0x1a'));var db=require('../../mysqldb')['db'];config[_0x2f8f('0x1b')]=_[_0x2f8f('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2f8f('0x1d'))(new Redis(config[_0x2f8f('0x1b')]));require('./smsQueue.socket')[_0x2f8f('0x1e')](socket);function respondWithStatusCode(_0x3c8461,_0xd55a01){_0xd55a01=_0xd55a01||0xcc;return function(_0x3c3b3c){if(_0x3c3b3c){return _0x3c8461[_0x2f8f('0x1f')](_0xd55a01);}return _0x3c8461['status'](_0xd55a01)['end']();};}function respondWithResult(_0x5d7dfa,_0x566025){_0x566025=_0x566025||0xc8;return function(_0x1e34bd){if(_0x1e34bd){return _0x5d7dfa[_0x2f8f('0x20')](_0x566025)[_0x2f8f('0x21')](_0x1e34bd);}};}function respondWithFilteredResult(_0x98a34c,_0x15ceea){return function(_0x54a5d2){if(_0x54a5d2){var _0x581d39=typeof _0x15ceea[_0x2f8f('0x22')]==='undefined'&&typeof _0x15ceea['limit']===_0x2f8f('0x23');var _0x100344=_0x54a5d2[_0x2f8f('0x24')];var _0xe816fd=_0x581d39?0x0:_0x15ceea[_0x2f8f('0x22')];var _0x261a5a=_0x581d39?_0x54a5d2[_0x2f8f('0x24')]:_0x15ceea[_0x2f8f('0x22')]+_0x15ceea['limit'];var _0x2e94df;if(_0x261a5a>=_0x100344){_0x261a5a=_0x100344;_0x2e94df=0xc8;}else{_0x2e94df=0xce;}_0x98a34c[_0x2f8f('0x20')](_0x2e94df);return _0x98a34c['set']('Content-Range',_0xe816fd+'-'+_0x261a5a+'/'+_0x100344)[_0x2f8f('0x21')](_0x54a5d2);}return null;};}function patchUpdates(_0x44fba4){return function(_0x17c862){try{jsonpatch[_0x2f8f('0x25')](_0x17c862,_0x44fba4,!![]);}catch(_0x2cc09e){return BPromise[_0x2f8f('0x26')](_0x2cc09e);}return _0x17c862[_0x2f8f('0x27')]();};}function saveUpdates(_0x3cf648,_0xcb3156){return function(_0x2202e5){if(_0x2202e5){return _0x2202e5[_0x2f8f('0x28')](_0x3cf648)[_0x2f8f('0x29')](function(_0x1bef3c){return _0x1bef3c;});}return null;};}function removeEntity(_0x55b591,_0x38a16a){return function(_0x16dc27){if(_0x16dc27){return _0x16dc27[_0x2f8f('0x2a')]()[_0x2f8f('0x29')](function(){var _0x286fb2=_0x16dc27['get']({'plain':!![]});var _0x378cdd=_0x2f8f('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x378cdd,'resourceId':_0x286fb2['id']}})['then'](function(){return _0x16dc27;});})[_0x2f8f('0x29')](function(){_0x55b591['status'](0xcc)[_0x2f8f('0x2c')]();});}};}function handleEntityNotFound(_0x1f9ad1,_0x125ed5){return function(_0x12924d){if(!_0x12924d){_0x1f9ad1[_0x2f8f('0x1f')](0x194);}return _0x12924d;};}function handleError(_0x4cb570,_0x180da7){_0x180da7=_0x180da7||0x1f4;return function(_0x2af7e4){logger['error'](_0x2af7e4[_0x2f8f('0x2d')]);if(_0x2af7e4[_0x2f8f('0x2e')]){delete _0x2af7e4[_0x2f8f('0x2e')];}_0x4cb570[_0x2f8f('0x20')](_0x180da7)[_0x2f8f('0x2f')](_0x2af7e4);};}exports[_0x2f8f('0x30')]=function(_0x37ed3e,_0x372fdd){var _0x3477ca={},_0x561c3a={},_0x21dcfb={'count':0x0,'rows':[]};var _0x6b35c6=_[_0x2f8f('0x31')](db[_0x2f8f('0x32')]['rawAttributes'],function(_0x413020){return{'name':_0x413020[_0x2f8f('0x33')],'type':_0x413020[_0x2f8f('0x34')][_0x2f8f('0x35')]};});_0x561c3a[_0x2f8f('0x36')]=_[_0x2f8f('0x31')](_0x6b35c6,'name');_0x561c3a[_0x2f8f('0x37')]=_[_0x2f8f('0x38')](_0x37ed3e[_0x2f8f('0x37')]);_0x561c3a[_0x2f8f('0x39')]=_[_0x2f8f('0x3a')](_0x561c3a[_0x2f8f('0x36')],_0x561c3a['query']);_0x3477ca['attributes']=_['intersection'](_0x561c3a['model'],qs[_0x2f8f('0x3b')](_0x37ed3e[_0x2f8f('0x37')][_0x2f8f('0x3b')]));_0x3477ca[_0x2f8f('0x3c')]=_0x3477ca[_0x2f8f('0x3c')][_0x2f8f('0x3d')]?_0x3477ca[_0x2f8f('0x3c')]:_0x561c3a['model'];if(!_0x37ed3e[_0x2f8f('0x37')][_0x2f8f('0x3e')](_0x2f8f('0x3f'))){_0x3477ca[_0x2f8f('0x40')]=qs['limit'](_0x37ed3e[_0x2f8f('0x37')]['limit']);_0x3477ca['offset']=qs['offset'](_0x37ed3e[_0x2f8f('0x37')][_0x2f8f('0x22')]);}_0x3477ca['order']=qs['sort'](_0x37ed3e[_0x2f8f('0x37')]['sort']);_0x3477ca[_0x2f8f('0x41')]=qs['filters'](_['pick'](_0x37ed3e[_0x2f8f('0x37')],_0x561c3a['filters']),_0x6b35c6);if(_0x37ed3e['query'][_0x2f8f('0x42')]){_0x3477ca[_0x2f8f('0x41')]=_[_0x2f8f('0x43')](_0x3477ca['where'],{'$or':_[_0x2f8f('0x31')](_0x6b35c6,function(_0x3d8873){if(_0x3d8873[_0x2f8f('0x34')]!==_0x2f8f('0x44')){var _0x3bd513={};_0x3bd513[_0x3d8873[_0x2f8f('0x2e')]]={'$like':'%'+_0x37ed3e[_0x2f8f('0x37')][_0x2f8f('0x42')]+'%'};return _0x3bd513;}})});}_0x3477ca=_[_0x2f8f('0x43')]({},_0x3477ca,_0x37ed3e[_0x2f8f('0x45')]);var _0x4e4a12={'where':_0x3477ca[_0x2f8f('0x41')]};return db['SmsQueue']['count'](_0x4e4a12)[_0x2f8f('0x29')](function(_0x5d665b){_0x21dcfb['count']=_0x5d665b;if(_0x37ed3e[_0x2f8f('0x37')]['includeAll']){_0x3477ca[_0x2f8f('0x46')]=[{'all':!![]}];}return db[_0x2f8f('0x32')][_0x2f8f('0x47')](_0x3477ca);})[_0x2f8f('0x29')](function(_0x13d5ed){_0x21dcfb[_0x2f8f('0x48')]=_0x13d5ed;return _0x21dcfb;})[_0x2f8f('0x29')](respondWithFilteredResult(_0x372fdd,_0x3477ca))[_0x2f8f('0x49')](handleError(_0x372fdd,null));};exports[_0x2f8f('0x4a')]=function(_0x320d65,_0x335468){var _0x1c290f={'raw':!![],'where':{'id':_0x320d65[_0x2f8f('0x4b')]['id']}},_0x3ad52b={};_0x3ad52b[_0x2f8f('0x36')]=_[_0x2f8f('0x38')](db[_0x2f8f('0x32')][_0x2f8f('0x4c')]);_0x3ad52b[_0x2f8f('0x37')]=_[_0x2f8f('0x38')](_0x320d65[_0x2f8f('0x37')]);_0x3ad52b[_0x2f8f('0x39')]=_['intersection'](_0x3ad52b['model'],_0x3ad52b[_0x2f8f('0x37')]);_0x1c290f['attributes']=_[_0x2f8f('0x3a')](_0x3ad52b[_0x2f8f('0x36')],qs['fields'](_0x320d65['query']['fields']));_0x1c290f[_0x2f8f('0x3c')]=_0x1c290f[_0x2f8f('0x3c')][_0x2f8f('0x3d')]?_0x1c290f['attributes']:_0x3ad52b[_0x2f8f('0x36')];if(_0x320d65[_0x2f8f('0x37')][_0x2f8f('0x4d')]){_0x1c290f[_0x2f8f('0x46')]=[{'all':!![]}];}_0x1c290f=_[_0x2f8f('0x43')]({},_0x1c290f,_0x320d65[_0x2f8f('0x45')]);return db['SmsQueue']['find'](_0x1c290f)['then'](handleEntityNotFound(_0x335468,null))[_0x2f8f('0x29')](respondWithResult(_0x335468,null))[_0x2f8f('0x49')](handleError(_0x335468,null));};exports[_0x2f8f('0x4e')]=function(_0xd51df4,_0x42b573){return db[_0x2f8f('0x32')][_0x2f8f('0x4e')](_0xd51df4[_0x2f8f('0x4f')],{})[_0x2f8f('0x29')](function(_0x34bcdc){var _0x1b1ab2=_0xd51df4[_0x2f8f('0x50')][_0x2f8f('0x51')]({'plain':!![]});if(!_0x1b1ab2)throw new Error(_0x2f8f('0x52'));if(_0x1b1ab2['role']===_0x2f8f('0x50')){var _0x514bf6=_0x34bcdc['get']({'plain':!![]});var _0x231ae9=_0x2f8f('0x2b');return db[_0x2f8f('0x53')][_0x2f8f('0x54')]({'where':{'name':_0x231ae9,'userProfileId':_0x1b1ab2['userProfileId']},'raw':!![]})[_0x2f8f('0x29')](function(_0x4c2918){if(_0x4c2918&&_0x4c2918[_0x2f8f('0x55')]===0x0){return db['UserProfileResource'][_0x2f8f('0x4e')]({'name':_0x514bf6[_0x2f8f('0x2e')],'resourceId':_0x514bf6['id'],'type':_0x4c2918[_0x2f8f('0x2e')],'sectionId':_0x4c2918['id']},{})[_0x2f8f('0x29')](function(){return _0x34bcdc;});}else{return _0x34bcdc;}})[_0x2f8f('0x49')](function(_0x5b6e62){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b6e62);throw _0x5b6e62;});}return _0x34bcdc;})[_0x2f8f('0x29')](respondWithResult(_0x42b573,0xc9))[_0x2f8f('0x49')](handleError(_0x42b573,null));};exports[_0x2f8f('0x28')]=function(_0x3410bd,_0x2884fc){if(_0x3410bd[_0x2f8f('0x4f')]['id']){delete _0x3410bd['body']['id'];}return db[_0x2f8f('0x32')]['find']({'where':{'id':_0x3410bd[_0x2f8f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2884fc,null))[_0x2f8f('0x29')](saveUpdates(_0x3410bd[_0x2f8f('0x4f')],null))[_0x2f8f('0x29')](respondWithResult(_0x2884fc,null))['catch'](handleError(_0x2884fc,null));};exports[_0x2f8f('0x2a')]=function(_0x33a731,_0x43ca3d){return db['SmsQueue'][_0x2f8f('0x54')]({'where':{'id':_0x33a731[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](handleEntityNotFound(_0x43ca3d,null))[_0x2f8f('0x29')](removeEntity(_0x43ca3d,null))[_0x2f8f('0x49')](handleError(_0x43ca3d,null));};exports[_0x2f8f('0x56')]=function(_0x2b7060,_0x41bcca){return db['SmsQueue'][_0x2f8f('0x56')]()[_0x2f8f('0x29')](respondWithResult(_0x41bcca,null))['catch'](handleError(_0x41bcca,null));};exports['getMembers']=function(_0x423b87,_0x4c1b15,_0x44921c){var _0x7c737={'raw':!![],'where':{}},_0x565896={},_0x34332b;return db[_0x2f8f('0x32')][_0x2f8f('0x57')]({'where':{'id':_0x423b87[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](handleEntityNotFound(_0x4c1b15,null))[_0x2f8f('0x29')](function(_0x40d45c){if(_0x40d45c){_0x34332b=_0x40d45c[_0x2f8f('0x51')]({'plain':!![]});_0x565896[_0x2f8f('0x36')]=_[_0x2f8f('0x38')](db[_0x2f8f('0x58')][_0x2f8f('0x4c')]);_0x565896[_0x2f8f('0x37')]=_[_0x2f8f('0x38')](_0x423b87[_0x2f8f('0x37')]);_0x565896[_0x2f8f('0x39')]=_[_0x2f8f('0x3a')](_0x565896[_0x2f8f('0x36')],_0x565896['query']);_0x7c737['attributes']=_['intersection'](_0x565896['model'],qs[_0x2f8f('0x3b')](_0x423b87[_0x2f8f('0x37')][_0x2f8f('0x3b')]));_0x7c737[_0x2f8f('0x3c')]=_0x7c737['attributes'][_0x2f8f('0x3d')]?_0x7c737[_0x2f8f('0x3c')]:_0x565896[_0x2f8f('0x36')];if(!_0x423b87[_0x2f8f('0x37')]['hasOwnProperty'](_0x2f8f('0x3f'))){_0x7c737[_0x2f8f('0x40')]=qs['limit'](_0x423b87['query'][_0x2f8f('0x40')]);_0x7c737[_0x2f8f('0x22')]=qs[_0x2f8f('0x22')](_0x423b87['query']['offset']);}_0x7c737[_0x2f8f('0x59')]=qs[_0x2f8f('0x5a')](_0x423b87[_0x2f8f('0x37')][_0x2f8f('0x5a')]);_0x7c737[_0x2f8f('0x41')]=qs['filters'](_[_0x2f8f('0x5b')](_0x423b87['query'],_0x565896[_0x2f8f('0x39')]));_0x7c737[_0x2f8f('0x41')][_0x2f8f('0x5c')]=_0x40d45c['id'];if(_0x423b87['query'][_0x2f8f('0x42')]){_0x7c737[_0x2f8f('0x41')]=_[_0x2f8f('0x43')](_0x7c737['where'],{'$or':_[_0x2f8f('0x31')](_0x7c737['attributes'],function(_0x15c8b7){var _0x1da2c2={};_0x1da2c2[_0x15c8b7]={'$like':'%'+_0x423b87[_0x2f8f('0x37')][_0x2f8f('0x42')]+'%'};return _0x1da2c2;})});}_0x7c737=_[_0x2f8f('0x43')]({},_0x7c737,_0x423b87['options']);return db[_0x2f8f('0x58')][_0x2f8f('0x47')](_0x7c737);}})[_0x2f8f('0x29')](function(_0x4675b9){if(_0x4675b9){return db[_0x2f8f('0x5d')][_0x2f8f('0x5e')]({'where':{'id':_[_0x2f8f('0x31')](_0x4675b9,_0x2f8f('0x5f')),'role':'agent'},'attributes':['id','name',_0x2f8f('0x60'),_0x2f8f('0x61'),'createdAt']});}})[_0x2f8f('0x29')](function(_0x1b8906){if(_0x1b8906){return{'count':_0x1b8906[_0x2f8f('0x24')],'rows':_[_0x2f8f('0x31')](_0x1b8906['rows'],function(_0x201e31){return{'membername':_0x201e31[_0x2f8f('0x2e')],'UserId':_0x201e31['id'],'queue_name':_0x34332b[_0x2f8f('0x2e')],'SmsQueueId':_0x34332b['id'],'interface':util[_0x2f8f('0x62')](_0x2f8f('0x63'),_0x2f8f('0x64'),_0x201e31[_0x2f8f('0x2e')]),'penalty':0x0,'paused':_0x201e31[_0x2f8f('0x60')],'createdAt':_0x201e31[_0x2f8f('0x65')],'updatedAt':_0x201e31[_0x2f8f('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4c1b15,_0x7c737))['catch'](handleError(_0x4c1b15,null));};exports[_0x2f8f('0x66')]=function(_0x4799ad,_0x118d18,_0x511da4){var _0x185b8a={};var _0x509a27={};var _0x45546d;var _0x37b3e9;return db[_0x2f8f('0x32')]['findOne']({'where':{'id':_0x4799ad[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](handleEntityNotFound(_0x118d18,null))[_0x2f8f('0x29')](function(_0x2a9486){if(_0x2a9486){_0x45546d=_0x2a9486;_0x509a27['model']=_['keys'](db['Team']['rawAttributes']);_0x509a27[_0x2f8f('0x37')]=_[_0x2f8f('0x38')](_0x4799ad['query']);_0x509a27[_0x2f8f('0x39')]=_[_0x2f8f('0x3a')](_0x509a27['model'],_0x509a27[_0x2f8f('0x37')]);_0x185b8a[_0x2f8f('0x3c')]=_[_0x2f8f('0x3a')](_0x509a27[_0x2f8f('0x36')],qs['fields'](_0x4799ad[_0x2f8f('0x37')][_0x2f8f('0x3b')]));_0x185b8a[_0x2f8f('0x3c')]=_0x185b8a[_0x2f8f('0x3c')][_0x2f8f('0x3d')]?_0x185b8a['attributes']:_0x509a27[_0x2f8f('0x36')];_0x185b8a['order']=qs[_0x2f8f('0x5a')](_0x4799ad[_0x2f8f('0x37')]['sort']);_0x185b8a[_0x2f8f('0x41')]=qs['filters'](_['pick'](_0x4799ad[_0x2f8f('0x37')],_0x509a27['filters']));if(_0x4799ad[_0x2f8f('0x37')][_0x2f8f('0x42')]){_0x185b8a[_0x2f8f('0x41')]=_[_0x2f8f('0x43')](_0x185b8a[_0x2f8f('0x41')],{'$or':_['map'](_0x185b8a[_0x2f8f('0x3c')],function(_0x2dfac2){var _0x941c55={};_0x941c55[_0x2dfac2]={'$like':'%'+_0x4799ad['query'][_0x2f8f('0x42')]+'%'};return _0x941c55;})});}_0x185b8a=_[_0x2f8f('0x43')]({},_0x185b8a,_0x4799ad[_0x2f8f('0x45')]);return _0x45546d[_0x2f8f('0x66')](_0x185b8a);}})[_0x2f8f('0x29')](function(_0xea224b){if(_0xea224b){_0x37b3e9=_0xea224b[_0x2f8f('0x3d')];if(!_0x4799ad[_0x2f8f('0x37')][_0x2f8f('0x3e')](_0x2f8f('0x3f'))){_0x185b8a[_0x2f8f('0x40')]=qs[_0x2f8f('0x40')](_0x4799ad['query'][_0x2f8f('0x40')]);_0x185b8a[_0x2f8f('0x22')]=qs[_0x2f8f('0x22')](_0x4799ad[_0x2f8f('0x37')][_0x2f8f('0x22')]);}return _0x45546d[_0x2f8f('0x66')](_0x185b8a);}})['then'](function(_0x1a893d){if(_0x1a893d){return _0x1a893d?{'count':_0x37b3e9,'rows':_0x1a893d}:null;}})[_0x2f8f('0x29')](respondWithResult(_0x118d18,null))[_0x2f8f('0x49')](handleError(_0x118d18,null));};exports[_0x2f8f('0x67')]=function(_0x4f3f8e,_0x129deb,_0x4b267c){var _0x1e942b=_0x4f3f8e['body'][_0x2f8f('0x68')];return db[_0x2f8f('0x69')]['findAll']({'where':{'id':_0x1e942b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2f8f('0x6a'),'attributes':['id',_0x2f8f('0x2e'),_0x2f8f('0x6b'),_0x2f8f('0x6c'),_0x2f8f('0x6d')],'raw':!![]}]})[_0x2f8f('0x29')](function(_0x33fb9d){if(_0x33fb9d){var _0x350b4f=_['flatMap'](_0x33fb9d,function(_0x208305){var _0x494085=_0x208305[_0x2f8f('0x51')]({'plain':!![]});return _0x494085[_0x2f8f('0x6a')];});return db['SmsQueue'][_0x2f8f('0x54')]({'where':{'id':_0x4f3f8e[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](function(_0x18877c){return db[_0x2f8f('0x6e')][_0x2f8f('0x6f')](function(_0x5b8c07){return _0x18877c[_0x2f8f('0x67')](_0x1e942b,{'transaction':_0x5b8c07})['then'](function(){return BPromise[_0x2f8f('0x70')](_0x350b4f,function(_0x155a39){return db[_0x2f8f('0x58')][_0x2f8f('0x71')]({'where':{'UserId':_0x155a39['id'],'SmsQueueId':_0x4f3f8e[_0x2f8f('0x4b')]['id']},'transaction':_0x5b8c07});});})[_0x2f8f('0x29')](function(){_0x350b4f[_0x2f8f('0x72')](function(_0x17d5b1){socket[_0x2f8f('0x73')](_0x2f8f('0x74'),{'UserId':_0x17d5b1['id'],'SmsQueueId':_0x18877c['id']});});});});});}})[_0x2f8f('0x29')](respondWithStatusCode(_0x129deb,null))[_0x2f8f('0x49')](handleError(_0x129deb,null));};exports[_0x2f8f('0x75')]=function(_0x2aa4f4,_0x5492b9,_0x3ca61a){return db[_0x2f8f('0x69')][_0x2f8f('0x47')]({'where':{'id':_0x2aa4f4[_0x2f8f('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2f8f('0x5d')],'as':_0x2f8f('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x2f8f('0x29')](handleEntityNotFound(_0x5492b9,null))[_0x2f8f('0x29')](function(_0x1ff9b0){var _0x1847f0=_['map'](_0x1ff9b0,'id');var _0x30b96c=[];var _0x28b9fa=[];var _0x50a752=squel[_0x2f8f('0x76')]();_0x50a752['field'](_0x2f8f('0x77'))[_0x2f8f('0x78')](_0x2f8f('0x79'),'tq')[_0x2f8f('0x7a')]('user_has_teams','ut',_0x2f8f('0x7b'))['where'](_0x2f8f('0x7c'),_0x2aa4f4[_0x2f8f('0x4b')]['id']);for(var _0x3c78a5=0x0;_0x3c78a5<_0x1ff9b0[_0x2f8f('0x3d')];_0x3c78a5+=0x1){let _0x112911=_0x1ff9b0[_0x3c78a5];for(var _0x1e841f=0x0;_0x1e841f<_0x112911[_0x2f8f('0x6a')][_0x2f8f('0x3d')];_0x1e841f+=0x1){let _0xb5e3c=_0x112911['Agents'][_0x1e841f];var _0x3c275b=_0x50a752[_0x2f8f('0x7d')]();_0x3c275b[_0x2f8f('0x41')](_0x2f8f('0x7e'),_0xb5e3c['id']);_0x28b9fa['push'](db['sequelize']['query'](_0x3c275b[_0x2f8f('0x7f')](),{'type':db[_0x2f8f('0x6e')]['QueryTypes']['SELECT']})[_0x2f8f('0x29')](function(_0x4847e0){if(_0x4847e0[_0x2f8f('0x3d')]===0x1){return _0xb5e3c['id'];}else{var _0x4c2bbf=_[_0x2f8f('0x80')](_['map'](_0x4847e0,_0x2f8f('0x81')),function(_0x2c7681){return _[_0x2f8f('0x82')](_0x1847f0,_0x2c7681);});if(_0x4c2bbf){return _0xb5e3c['id'];}}}));}}return BPromise[_0x2f8f('0x83')](_0x28b9fa)[_0x2f8f('0x29')](function(_0x541540){_0x30b96c=_(_0x30b96c)['union'](_0x541540)[_0x2f8f('0x84')]()[_0x2f8f('0x85')]();return db['SmsQueue']['find']({'where':{'id':_0x2aa4f4[_0x2f8f('0x4b')]['id']}})['then'](function(_0x11c71b){return db[_0x2f8f('0x6e')][_0x2f8f('0x6f')](function(_0x43b22f){return _0x11c71b[_0x2f8f('0x75')](_0x2aa4f4[_0x2f8f('0x37')]['ids'],{'transaction':_0x43b22f})['then'](function(){if(!_['isEmpty'](_0x30b96c)){return _0x11c71b[_0x2f8f('0x86')](_0x30b96c,{'transaction':_0x43b22f});}})[_0x2f8f('0x29')](function(){_0x30b96c[_0x2f8f('0x72')](function(_0x266d7c){socket[_0x2f8f('0x73')](_0x2f8f('0x87'),{'UserId':_0x266d7c,'SmsQueueId':_0x11c71b['id']});});});});});});})['then'](respondWithStatusCode(_0x5492b9,null))[_0x2f8f('0x49')](handleError(_0x5492b9,null));};exports[_0x2f8f('0x88')]=function(_0x39efd9,_0x279f67,_0x332f92){return db[_0x2f8f('0x32')][_0x2f8f('0x54')]({'where':{'id':_0x39efd9[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](handleEntityNotFound(_0x279f67,null))['then'](function(_0x1f7a03){if(_0x1f7a03){return _0x1f7a03[_0x2f8f('0x88')](_0x39efd9[_0x2f8f('0x4f')][_0x2f8f('0x68')],_[_0x2f8f('0x89')](_0x39efd9['body'],['ids','id'])||{})['spread'](function(_0x5e06c3){for(var _0x250e89=0x0;_0x250e89<_0x39efd9[_0x2f8f('0x4f')]['ids'][_0x2f8f('0x3d')];_0x250e89+=0x1){socket[_0x2f8f('0x73')](_0x2f8f('0x74'),{'UserId':Number(_0x39efd9[_0x2f8f('0x4f')]['ids'][_0x250e89]),'SmsQueueId':Number(_0x39efd9[_0x2f8f('0x4b')]['id'])});}return _0x5e06c3;});}})[_0x2f8f('0x29')](respondWithResult(_0x279f67,null))[_0x2f8f('0x49')](handleError(_0x279f67,null));};exports[_0x2f8f('0x86')]=function(_0x4f51d1,_0x429a69,_0x280d8d){return db['SmsQueue'][_0x2f8f('0x54')]({'where':{'id':_0x4f51d1[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](handleEntityNotFound(_0x429a69,null))[_0x2f8f('0x29')](function(_0x552b37){if(_0x552b37){return _0x552b37[_0x2f8f('0x86')](_0x4f51d1[_0x2f8f('0x37')][_0x2f8f('0x68')])[_0x2f8f('0x29')](function(){if(_[_0x2f8f('0x8a')](_0x4f51d1['query'][_0x2f8f('0x68')])){for(var _0x159200=0x0;_0x159200<_0x4f51d1[_0x2f8f('0x37')]['ids']['length'];_0x159200+=0x1){socket[_0x2f8f('0x73')](_0x2f8f('0x87'),{'UserId':Number(_0x4f51d1[_0x2f8f('0x37')]['ids'][_0x159200]),'SmsQueueId':Number(_0x4f51d1[_0x2f8f('0x4b')]['id'])});}}else{socket['emit'](_0x2f8f('0x87'),{'UserId':Number(_0x4f51d1[_0x2f8f('0x37')]['ids']),'SmsQueueId':Number(_0x4f51d1[_0x2f8f('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x429a69,null))[_0x2f8f('0x49')](handleError(_0x429a69,null));};exports[_0x2f8f('0x8b')]=function(_0x308c02,_0xf9a828,_0x4bb46c){var _0x746c77={};var _0x455627={};var _0x1fb608;var _0x3ccd18;return db[_0x2f8f('0x32')][_0x2f8f('0x57')]({'where':{'id':_0x308c02[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](handleEntityNotFound(_0xf9a828,null))[_0x2f8f('0x29')](function(_0x274a84){if(_0x274a84){_0x1fb608=_0x274a84;_0x455627[_0x2f8f('0x36')]=_[_0x2f8f('0x38')](db['User']['rawAttributes']);_0x455627[_0x2f8f('0x37')]=_[_0x2f8f('0x38')](_0x308c02[_0x2f8f('0x37')]);_0x455627[_0x2f8f('0x39')]=_[_0x2f8f('0x3a')](_0x455627[_0x2f8f('0x36')],_0x455627['query']);_0x746c77['attributes']=_[_0x2f8f('0x3a')](_0x455627['model'],qs['fields'](_0x308c02['query']['fields']));_0x746c77['attributes']=_0x746c77[_0x2f8f('0x3c')][_0x2f8f('0x3d')]?_0x746c77['attributes']:_0x455627['model'];_0x746c77['order']=qs[_0x2f8f('0x5a')](_0x308c02[_0x2f8f('0x37')]['sort']);_0x746c77[_0x2f8f('0x41')]=qs[_0x2f8f('0x39')](_[_0x2f8f('0x5b')](_0x308c02[_0x2f8f('0x37')],_0x455627['filters']));if(_0x308c02[_0x2f8f('0x37')][_0x2f8f('0x42')]){_0x746c77[_0x2f8f('0x41')]=_[_0x2f8f('0x43')](_0x746c77[_0x2f8f('0x41')],{'$or':_['map'](_0x746c77[_0x2f8f('0x3c')],function(_0x4ba756){var _0x23fe19={};_0x23fe19[_0x4ba756]={'$like':'%'+_0x308c02[_0x2f8f('0x37')][_0x2f8f('0x42')]+'%'};return _0x23fe19;})});}_0x746c77=_[_0x2f8f('0x43')]({},_0x746c77,_0x308c02['options']);return _0x1fb608[_0x2f8f('0x8b')](_0x746c77);}})[_0x2f8f('0x29')](function(_0x32275e){if(_0x32275e){_0x3ccd18=_0x32275e['length'];if(!_0x308c02[_0x2f8f('0x37')][_0x2f8f('0x3e')](_0x2f8f('0x3f'))){_0x746c77[_0x2f8f('0x40')]=qs[_0x2f8f('0x40')](_0x308c02['query'][_0x2f8f('0x40')]);_0x746c77[_0x2f8f('0x22')]=qs['offset'](_0x308c02[_0x2f8f('0x37')]['offset']);}return _0x1fb608['getAgents'](_0x746c77);}})[_0x2f8f('0x29')](function(_0x5877ee){if(_0x5877ee){return _0x5877ee?{'count':_0x3ccd18,'rows':_0x5877ee}:null;}})[_0x2f8f('0x29')](respondWithResult(_0xf9a828,null))[_0x2f8f('0x49')](handleError(_0xf9a828,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index bca7231..a88f97d 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 _0xa6b1=['SmsQueue','setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0x20bb22,_0x78e38f){var _0xe48619=function(_0x4d6237){while(--_0x4d6237){_0x20bb22['push'](_0x20bb22['shift']());}};_0xe48619(++_0x78e38f);}(_0xa6b1,0x6e));var _0x1a6b=function(_0x463049,_0x2c1d0c){_0x463049=_0x463049-0x0;var _0x39b25a=_0xa6b1[_0x463049];return _0x39b25a;};'use strict';var EventEmitter=require(_0x1a6b('0x0'));var SmsQueue=require(_0x1a6b('0x1'))['db'][_0x1a6b('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1a6b('0x3')](0x0);var events={'afterCreate':_0x1a6b('0x4'),'afterUpdate':'update','afterDestroy':_0x1a6b('0x5')};function emitEvent(_0x129f8c){return function(_0x4a34da,_0x56b2aa,_0x398eeb){SmsQueueEvents[_0x1a6b('0x6')](_0x129f8c+':'+_0x4a34da['id'],_0x4a34da);SmsQueueEvents['emit'](_0x129f8c,_0x4a34da);_0x398eeb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x1a6b('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x1635=['hasOwnProperty','hook','events','../../mysqldb','save','update','remove','emit'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0x1635,0xea));var _0x5163=function(_0x32b153,_0x41d2ec){_0x32b153=_0x32b153-0x0;var _0x118dbd=_0x1635[_0x32b153];return _0x118dbd;};'use strict';var EventEmitter=require(_0x5163('0x0'));var SmsQueue=require(_0x5163('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5163('0x2'),'afterUpdate':_0x5163('0x3'),'afterDestroy':_0x5163('0x4')};function emitEvent(_0x415367){return function(_0x5b9a8e,_0x18245c,_0x58f37a){SmsQueueEvents[_0x5163('0x5')](_0x415367+':'+_0x5b9a8e['id'],_0x5b9a8e);SmsQueueEvents['emit'](_0x415367,_0x5b9a8e);_0x58f37a(null);};}for(var e in events){if(events[_0x5163('0x6')](e)){var event=events[e];SmsQueue[_0x5163('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 9f7b182..5c797f6 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 _0x3b16=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0x3b16,0x1b2));var _0x63b1=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x3b16[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0x63b1('0x0'));var logger=require(_0x63b1('0x1'))(_0x63b1('0x2'));var moment=require(_0x63b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x63b1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63b1('0x5'));var config=require(_0x63b1('0x6'));var attributes=require(_0x63b1('0x7'));module[_0x63b1('0x8')]=function(_0xe09d5,_0x31ac91){return _0xe09d5[_0x63b1('0x9')](_0x63b1('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8461=['bluebird','request-promise','path','../../config/environment','exports','define','sms_queues','lodash','util','../../config/logger','moment'];(function(_0x26742c,_0xe241ee){var _0x4d9df4=function(_0x5bf307){while(--_0x5bf307){_0x26742c['push'](_0x26742c['shift']());}};_0x4d9df4(++_0xe241ee);}(_0x8461,0x193));var _0x1846=function(_0x3d538a,_0x2dc2a6){_0x3d538a=_0x3d538a-0x0;var _0x4fae2a=_0x8461[_0x3d538a];return _0x4fae2a;};'use strict';var _=require(_0x1846('0x0'));var util=require(_0x1846('0x1'));var logger=require(_0x1846('0x2'))('api');var moment=require(_0x1846('0x3'));var BPromise=require(_0x1846('0x4'));var rp=require(_0x1846('0x5'));var fs=require('fs');var path=require(_0x1846('0x6'));var rimraf=require('rimraf');var config=require(_0x1846('0x7'));var attributes=require('./smsQueue.attributes');module[_0x1846('0x8')]=function(_0x131f0d,_0x1d858c){return _0x131f0d[_0x1846('0x9')]('SmsQueue',attributes,{'tableName':_0x1846('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index d9ebfbf..7c400e9 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 _0xb74c=['localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetSmsQueue','ShowSmsQueue','SmsQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x157298,_0x2f1dd2){var _0x43368c=function(_0x5848ff){while(--_0x5848ff){_0x157298['push'](_0x157298['shift']());}};_0x43368c(++_0x2f1dd2);}(_0xb74c,0x111));var _0xcb74=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb74c[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xcb74('0x0'));var util=require(_0xcb74('0x1'));var moment=require(_0xcb74('0x2'));var BPromise=require(_0xcb74('0x3'));var rs=require(_0xcb74('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb74('0x6'))(_0xcb74('0x7'));var config=require(_0xcb74('0x8'));var jayson=require(_0xcb74('0x9'));var client=jayson[_0xcb74('0xa')][_0xcb74('0xb')]({'port':0x232a});config[_0xcb74('0xc')]=_[_0xcb74('0xd')](config[_0xcb74('0xc')],{'host':_0xcb74('0xe'),'port':0x18eb});var socket=require(_0xcb74('0xf'))(new Redis(config[_0xcb74('0xc')]));require(_0xcb74('0x10'))[_0xcb74('0x11')](socket);function respondWithRpcPromise(_0x71f14d,_0x2574f5,_0x4c87b5){return new BPromise(function(_0x4a7b8b,_0x19424f){return client[_0xcb74('0x12')](_0x71f14d,_0x4c87b5)[_0xcb74('0x13')](function(_0x1ef4ea){logger[_0xcb74('0x14')](_0xcb74('0x15'),_0x2574f5,'request\x20sent');logger[_0xcb74('0x16')](_0xcb74('0x17'),_0x2574f5,_0xcb74('0x18'),JSON[_0xcb74('0x19')](_0x1ef4ea));if(_0x1ef4ea['error']){if(_0x1ef4ea[_0xcb74('0x1a')]['code']===0x1f4){logger[_0xcb74('0x1a')](_0xcb74('0x15'),_0x2574f5,_0x1ef4ea[_0xcb74('0x1a')][_0xcb74('0x1b')]);return _0x19424f(_0x1ef4ea[_0xcb74('0x1a')][_0xcb74('0x1b')]);}logger[_0xcb74('0x1a')](_0xcb74('0x15'),_0x2574f5,_0x1ef4ea[_0xcb74('0x1a')][_0xcb74('0x1b')]);return _0x4a7b8b(_0x1ef4ea[_0xcb74('0x1a')][_0xcb74('0x1b')]);}else{logger[_0xcb74('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2574f5,_0xcb74('0x18'));_0x4a7b8b(_0x1ef4ea[_0xcb74('0x1c')][_0xcb74('0x1b')]);}})[_0xcb74('0x1d')](function(_0x1b70fd){logger[_0xcb74('0x1a')](_0xcb74('0x15'),_0x2574f5,_0x1b70fd);_0x19424f(_0x1b70fd);});});}exports['GetSmsQueue']=function(_0x132a6e){var _0x299a6e=this;return new Promise(function(_0xab35d1,_0x158fe1){return db['SmsQueue'][_0xcb74('0x1e')]({'raw':_0x132a6e[_0xcb74('0x1f')]?_0x132a6e[_0xcb74('0x1f')][_0xcb74('0x20')]===undefined?!![]:![]:!![],'where':_0x132a6e[_0xcb74('0x1f')]?_0x132a6e[_0xcb74('0x1f')][_0xcb74('0x21')]||null:null,'attributes':_0x132a6e[_0xcb74('0x1f')]?_0x132a6e[_0xcb74('0x1f')][_0xcb74('0x22')]||null:null,'limit':_0x132a6e[_0xcb74('0x1f')]?_0x132a6e[_0xcb74('0x1f')]['limit']||null:null,'include':_0x132a6e[_0xcb74('0x1f')]?_0x132a6e[_0xcb74('0x1f')][_0xcb74('0x23')]?_[_0xcb74('0x24')](_0x132a6e['options'][_0xcb74('0x23')],function(_0x4a37f2){return{'model':db[_0x4a37f2['model']],'as':_0x4a37f2['as'],'attributes':_0x4a37f2[_0xcb74('0x22')],'include':_0x4a37f2[_0xcb74('0x23')]?_[_0xcb74('0x24')](_0x4a37f2[_0xcb74('0x23')],function(_0x47ed09){return{'model':db[_0x47ed09[_0xcb74('0x25')]],'as':_0x47ed09['as'],'attributes':_0x47ed09[_0xcb74('0x22')],'include':_0x47ed09[_0xcb74('0x23')]?_[_0xcb74('0x24')](_0x47ed09[_0xcb74('0x23')],function(_0x4cfb86){return{'model':db[_0x4cfb86[_0xcb74('0x25')]],'as':_0x4cfb86['as'],'attributes':_0x4cfb86[_0xcb74('0x22')]};}):[]};}):[]};}):[]:[]})[_0xcb74('0x13')](function(_0xf9c42f){logger['info'](_0xcb74('0x26'),_0x132a6e);logger[_0xcb74('0x16')](_0xcb74('0x26'),_0x132a6e,JSON[_0xcb74('0x19')](_0xf9c42f));_0xab35d1(_0xf9c42f);})['catch'](function(_0x2ef8d6){logger[_0xcb74('0x1a')]('GetSmsQueue',_0x2ef8d6[_0xcb74('0x1b')],_0x132a6e);_0x158fe1(_0x299a6e[_0xcb74('0x1a')](0x1f4,_0x2ef8d6[_0xcb74('0x1b')]));});});};exports[_0xcb74('0x27')]=function(_0x44cf55){var _0x1fc1ba=this;return new Promise(function(_0x1fe32e,_0x1fba73){return db[_0xcb74('0x28')]['find']({'raw':_0x44cf55[_0xcb74('0x1f')]?_0x44cf55[_0xcb74('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x44cf55[_0xcb74('0x1f')]?_0x44cf55[_0xcb74('0x1f')]['where']||null:null,'attributes':_0x44cf55[_0xcb74('0x1f')]?_0x44cf55[_0xcb74('0x1f')][_0xcb74('0x22')]||null:null,'include':_0x44cf55['options']?_0x44cf55[_0xcb74('0x1f')]['include']?_[_0xcb74('0x24')](_0x44cf55[_0xcb74('0x1f')][_0xcb74('0x23')],function(_0x37ca53){return{'model':db[_0x37ca53[_0xcb74('0x25')]],'as':_0x37ca53['as'],'attributes':_0x37ca53[_0xcb74('0x22')],'include':_0x37ca53[_0xcb74('0x23')]?_[_0xcb74('0x24')](_0x37ca53['include'],function(_0x4b2fb8){return{'model':db[_0x4b2fb8[_0xcb74('0x25')]],'as':_0x4b2fb8['as'],'attributes':_0x4b2fb8['attributes'],'include':_0x4b2fb8[_0xcb74('0x23')]?_[_0xcb74('0x24')](_0x4b2fb8[_0xcb74('0x23')],function(_0x5f555d){return{'model':db[_0x5f555d[_0xcb74('0x25')]],'as':_0x5f555d['as'],'attributes':_0x5f555d[_0xcb74('0x22')]};}):[]};}):[]};}):[]:[]})[_0xcb74('0x13')](function(_0x4e5b3a){logger[_0xcb74('0x14')](_0xcb74('0x27'),_0x44cf55);logger[_0xcb74('0x16')](_0xcb74('0x27'),_0x44cf55,JSON[_0xcb74('0x19')](_0x4e5b3a));_0x1fe32e(_0x4e5b3a);})['catch'](function(_0x1beb55){logger[_0xcb74('0x1a')](_0xcb74('0x27'),_0x1beb55[_0xcb74('0x1b')],_0x44cf55);_0x1fba73(_0x1fc1ba[_0xcb74('0x1a')](0x1f4,_0x1beb55[_0xcb74('0x1b')]));});});}; \ No newline at end of file +var _0x4b99=['defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','options','where','attributes','limit','map','include','model','then','ShowSmsQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b99,0x96));var _0x94b9=function(_0x4c7297,_0x29260c){_0x4c7297=_0x4c7297-0x0;var _0x496d14=_0x4b99[_0x4c7297];return _0x496d14;};'use strict';var _=require(_0x94b9('0x0'));var util=require(_0x94b9('0x1'));var moment=require(_0x94b9('0x2'));var BPromise=require(_0x94b9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94b9('0x4'));var db=require(_0x94b9('0x5'))['db'];var utils=require(_0x94b9('0x6'));var logger=require(_0x94b9('0x7'))(_0x94b9('0x8'));var config=require(_0x94b9('0x9'));var jayson=require(_0x94b9('0xa'));var client=jayson[_0x94b9('0xb')][_0x94b9('0xc')]({'port':0x232a});config[_0x94b9('0xd')]=_[_0x94b9('0xe')](config[_0x94b9('0xd')],{'host':_0x94b9('0xf'),'port':0x18eb});var socket=require(_0x94b9('0x10'))(new Redis(config[_0x94b9('0xd')]));require(_0x94b9('0x11'))[_0x94b9('0x12')](socket);function respondWithRpcPromise(_0x137308,_0x4101b7,_0x2f0dfd){return new BPromise(function(_0x20499c,_0x270d36){return client[_0x94b9('0x13')](_0x137308,_0x2f0dfd)['then'](function(_0x3da901){logger[_0x94b9('0x14')](_0x94b9('0x15'),_0x4101b7,_0x94b9('0x16'));logger[_0x94b9('0x17')](_0x94b9('0x18'),_0x4101b7,_0x94b9('0x16'),JSON[_0x94b9('0x19')](_0x3da901));if(_0x3da901['error']){if(_0x3da901[_0x94b9('0x1a')][_0x94b9('0x1b')]===0x1f4){logger[_0x94b9('0x1a')](_0x94b9('0x15'),_0x4101b7,_0x3da901[_0x94b9('0x1a')][_0x94b9('0x1c')]);return _0x270d36(_0x3da901[_0x94b9('0x1a')][_0x94b9('0x1c')]);}logger[_0x94b9('0x1a')](_0x94b9('0x15'),_0x4101b7,_0x3da901['error'][_0x94b9('0x1c')]);return _0x20499c(_0x3da901[_0x94b9('0x1a')]['message']);}else{logger[_0x94b9('0x14')](_0x94b9('0x15'),_0x4101b7,'request\x20sent');_0x20499c(_0x3da901[_0x94b9('0x1d')][_0x94b9('0x1c')]);}})[_0x94b9('0x1e')](function(_0x5f19c6){logger[_0x94b9('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x4101b7,_0x5f19c6);_0x270d36(_0x5f19c6);});});}exports[_0x94b9('0x1f')]=function(_0xa985cd){var _0xcc4dc8=this;return new Promise(function(_0x5b8d95,_0x41041e){return db['SmsQueue']['findAll']({'raw':_0xa985cd[_0x94b9('0x20')]?_0xa985cd[_0x94b9('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0xa985cd['options']?_0xa985cd['options'][_0x94b9('0x21')]||null:null,'attributes':_0xa985cd[_0x94b9('0x20')]?_0xa985cd[_0x94b9('0x20')][_0x94b9('0x22')]||null:null,'limit':_0xa985cd[_0x94b9('0x20')]?_0xa985cd[_0x94b9('0x20')][_0x94b9('0x23')]||null:null,'include':_0xa985cd[_0x94b9('0x20')]?_0xa985cd[_0x94b9('0x20')]['include']?_[_0x94b9('0x24')](_0xa985cd[_0x94b9('0x20')][_0x94b9('0x25')],function(_0x54d5a0){return{'model':db[_0x54d5a0[_0x94b9('0x26')]],'as':_0x54d5a0['as'],'attributes':_0x54d5a0[_0x94b9('0x22')],'include':_0x54d5a0[_0x94b9('0x25')]?_[_0x94b9('0x24')](_0x54d5a0['include'],function(_0x5926f7){return{'model':db[_0x5926f7['model']],'as':_0x5926f7['as'],'attributes':_0x5926f7['attributes'],'include':_0x5926f7[_0x94b9('0x25')]?_[_0x94b9('0x24')](_0x5926f7[_0x94b9('0x25')],function(_0x184192){return{'model':db[_0x184192[_0x94b9('0x26')]],'as':_0x184192['as'],'attributes':_0x184192[_0x94b9('0x22')]};}):[]};}):[]};}):[]:[]})[_0x94b9('0x27')](function(_0x4a738e){logger['info'](_0x94b9('0x1f'),_0xa985cd);logger['debug']('GetSmsQueue',_0xa985cd,JSON[_0x94b9('0x19')](_0x4a738e));_0x5b8d95(_0x4a738e);})[_0x94b9('0x1e')](function(_0x59532d){logger[_0x94b9('0x1a')]('GetSmsQueue',_0x59532d[_0x94b9('0x1c')],_0xa985cd);_0x41041e(_0xcc4dc8['error'](0x1f4,_0x59532d[_0x94b9('0x1c')]));});});};exports['ShowSmsQueue']=function(_0x507bab){var _0x352e0d=this;return new Promise(function(_0x1365bf,_0x59598d){return db['SmsQueue']['find']({'raw':_0x507bab[_0x94b9('0x20')]?_0x507bab[_0x94b9('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x507bab[_0x94b9('0x20')]?_0x507bab[_0x94b9('0x20')][_0x94b9('0x21')]||null:null,'attributes':_0x507bab[_0x94b9('0x20')]?_0x507bab[_0x94b9('0x20')][_0x94b9('0x22')]||null:null,'include':_0x507bab[_0x94b9('0x20')]?_0x507bab[_0x94b9('0x20')][_0x94b9('0x25')]?_[_0x94b9('0x24')](_0x507bab['options'][_0x94b9('0x25')],function(_0x1133b6){return{'model':db[_0x1133b6[_0x94b9('0x26')]],'as':_0x1133b6['as'],'attributes':_0x1133b6[_0x94b9('0x22')],'include':_0x1133b6['include']?_[_0x94b9('0x24')](_0x1133b6[_0x94b9('0x25')],function(_0x90c1ed){return{'model':db[_0x90c1ed[_0x94b9('0x26')]],'as':_0x90c1ed['as'],'attributes':_0x90c1ed[_0x94b9('0x22')],'include':_0x90c1ed[_0x94b9('0x25')]?_[_0x94b9('0x24')](_0x90c1ed[_0x94b9('0x25')],function(_0x29e7bd){return{'model':db[_0x29e7bd[_0x94b9('0x26')]],'as':_0x29e7bd['as'],'attributes':_0x29e7bd[_0x94b9('0x22')]};}):[]};}):[]};}):[]:[]})[_0x94b9('0x27')](function(_0x2e3d21){logger[_0x94b9('0x14')]('ShowSmsQueue',_0x507bab);logger[_0x94b9('0x17')](_0x94b9('0x28'),_0x507bab,JSON[_0x94b9('0x19')](_0x2e3d21));_0x1365bf(_0x2e3d21);})[_0x94b9('0x1e')](function(_0x16042e){logger['error']('ShowSmsQueue',_0x16042e[_0x94b9('0x1c')],_0x507bab);_0x59598d(_0x352e0d['error'](0x1f4,_0x16042e[_0x94b9('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index d5c180d..7eadabd 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 _0x77ba=['update','removeListener','register','smsQueue:','./smsQueue.events','remove'];(function(_0x20a8a2,_0x1f0093){var _0x160826=function(_0xc3d34c){while(--_0xc3d34c){_0x20a8a2['push'](_0x20a8a2['shift']());}};_0x160826(++_0x1f0093);}(_0x77ba,0x1ea));var _0xa77b=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0x77ba[_0x137d1d];return _0x485108;};'use strict';var SmsQueueEvents=require(_0xa77b('0x0'));var events=['save',_0xa77b('0x1'),_0xa77b('0x2')];function createListener(_0x42e43a,_0x329b4f){return function(_0x17a42d){_0x329b4f['emit'](_0x42e43a,_0x17a42d);};}function removeListener(_0x37bdea,_0x2e9d60){return function(){SmsQueueEvents[_0xa77b('0x3')](_0x37bdea,_0x2e9d60);};}exports[_0xa77b('0x4')]=function(_0x48c759){for(var _0x48a29c=0x0,_0x3e608d=events['length'];_0x48a29c<_0x3e608d;_0x48a29c++){var _0x19e2fa=events[_0x48a29c];var _0x216182=createListener(_0xa77b('0x5')+_0x19e2fa,_0x48c759);SmsQueueEvents['on'](_0x19e2fa,_0x216182);}}; \ No newline at end of file +var _0x47e8=['update','emit','removeListener','register','length','smsQueue:','save','remove'];(function(_0xfe5403,_0x1628b1){var _0x2d1e48=function(_0x71342){while(--_0x71342){_0xfe5403['push'](_0xfe5403['shift']());}};_0x2d1e48(++_0x1628b1);}(_0x47e8,0x76));var _0x847e=function(_0x4dfa20,_0x35afb5){_0x4dfa20=_0x4dfa20-0x0;var _0x146afc=_0x47e8[_0x4dfa20];return _0x146afc;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x847e('0x0'),_0x847e('0x1'),_0x847e('0x2')];function createListener(_0x52d32d,_0x77dff0){return function(_0x2757b6){_0x77dff0[_0x847e('0x3')](_0x52d32d,_0x2757b6);};}function removeListener(_0x1f084f,_0x2a5dca){return function(){SmsQueueEvents[_0x847e('0x4')](_0x1f084f,_0x2a5dca);};}exports[_0x847e('0x5')]=function(_0x196861){for(var _0x583044=0x0,_0x35ec6e=events[_0x847e('0x6')];_0x583044<_0x35ec6e;_0x583044++){var _0x1c0189=events[_0x583044];var _0x138b6f=createListener(_0x847e('0x7')+_0x1c0189,_0x196861);SmsQueueEvents['on'](_0x1c0189,_0x138b6f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c35ebf3..3fb3b72 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 _0xdd0c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','util','path','connect-timeout','Router'];(function(_0x7a4a03,_0x91417c){var _0xfe0c7a=function(_0x2bbf81){while(--_0x2bbf81){_0x7a4a03['push'](_0x7a4a03['shift']());}};_0xfe0c7a(++_0x91417c);}(_0xdd0c,0x165));var _0xcdd0=function(_0xffdbac,_0x1bc1a5){_0xffdbac=_0xffdbac-0x0;var _0x10f9dd=_0xdd0c[_0xffdbac];return _0x10f9dd;};'use strict';var multer=require('multer');var util=require(_0xcdd0('0x0'));var path=require(_0xcdd0('0x1'));var timeout=require(_0xcdd0('0x2'));var express=require('express');var router=express[_0xcdd0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcdd0('0x4'));var interaction=require(_0xcdd0('0x5'));var config=require(_0xcdd0('0x6'));var controller=require(_0xcdd0('0x7'));router[_0xcdd0('0x8')]('/',auth['isAuthenticated'](),controller[_0xcdd0('0x9')]);router[_0xcdd0('0x8')](_0xcdd0('0xa'),auth[_0xcdd0('0xb')](),controller[_0xcdd0('0xc')]);router['get'](_0xcdd0('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xcdd0('0xe')]('/',auth[_0xcdd0('0xb')](),controller[_0xcdd0('0xf')]);router[_0xcdd0('0x10')](_0xcdd0('0xd'),auth[_0xcdd0('0xb')](),controller[_0xcdd0('0x11')]);router[_0xcdd0('0x12')](_0xcdd0('0xd'),auth[_0xcdd0('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x99e0=['/describe','describe','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x99e0,0xd0));var _0x099e=function(_0x1ed68f,_0x7e2383){_0x1ed68f=_0x1ed68f-0x0;var _0x195c18=_0x99e0[_0x1ed68f];return _0x195c18;};'use strict';var multer=require(_0x099e('0x0'));var util=require(_0x099e('0x1'));var path=require(_0x099e('0x2'));var timeout=require(_0x099e('0x3'));var express=require(_0x099e('0x4'));var router=express['Router']();var fs_extra=require(_0x099e('0x5'));var auth=require(_0x099e('0x6'));var interaction=require(_0x099e('0x7'));var config=require(_0x099e('0x8'));var controller=require(_0x099e('0x9'));router[_0x099e('0xa')]('/',auth['isAuthenticated'](),controller[_0x099e('0xb')]);router[_0x099e('0xa')](_0x099e('0xc'),auth['isAuthenticated'](),controller[_0x099e('0xd')]);router[_0x099e('0xa')](_0x099e('0xe'),auth[_0x099e('0xf')](),controller['show']);router['post']('/',auth[_0x099e('0xf')](),controller[_0x099e('0x10')]);router[_0x099e('0x11')](_0x099e('0xe'),auth[_0x099e('0xf')](),controller[_0x099e('0x12')]);router[_0x099e('0x13')](_0x099e('0xe'),auth['isAuthenticated'](),controller[_0x099e('0x14')]);module[_0x099e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 5bd45d8..bf5025c 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 _0x3770=['moment','sequelize','exports','DATE'];(function(_0x5ba23f,_0x3ce99e){var _0x392def=function(_0x174b74){while(--_0x174b74){_0x5ba23f['push'](_0x5ba23f['shift']());}};_0x392def(++_0x3ce99e);}(_0x3770,0x13c));var _0x0377=function(_0x365590,_0x22e645){_0x365590=_0x365590-0x0;var _0x5ce0f3=_0x3770[_0x365590];return _0x5ce0f3;};'use strict';var moment=require(_0x0377('0x0'));var Sequelize=require(_0x0377('0x1'));module[_0x0377('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0377('0x3')]},'leaveAt':{'type':Sequelize[_0x0377('0x3')]},'acceptAt':{'type':Sequelize[_0x0377('0x3')]},'exitAt':{'type':Sequelize[_0x0377('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd814=['DATE','sequelize','STRING'];(function(_0x13c47b,_0x5b5505){var _0x485110=function(_0x20886e){while(--_0x20886e){_0x13c47b['push'](_0x13c47b['shift']());}};_0x485110(++_0x5b5505);}(_0xd814,0x187));var _0x4d81=function(_0x5ed0e5,_0x3c77da){_0x5ed0e5=_0x5ed0e5-0x0;var _0x603b7d=_0xd814[_0x5ed0e5];return _0x603b7d;};'use strict';var moment=require('moment');var Sequelize=require(_0x4d81('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4d81('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4d81('0x1')]},'joinAt':{'type':Sequelize[_0x4d81('0x2')]},'leaveAt':{'type':Sequelize[_0x4d81('0x2')]},'acceptAt':{'type':Sequelize[_0x4d81('0x2')]},'exitAt':{'type':Sequelize[_0x4d81('0x2')]},'reason':{'type':Sequelize[_0x4d81('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index f02fd84..fc18f83 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 _0x3914=['fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','where','filter','type','VIRTUAL','includeAll','include','show','params','intersection','merge','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','destroy','then','end','error','stack','name','send','map','SmsQueueReport','rawAttributes'];(function(_0x26ddd9,_0x128536){var _0x2dafd9=function(_0x382f0b){while(--_0x382f0b){_0x26ddd9['push'](_0x26ddd9['shift']());}};_0x2dafd9(++_0x128536);}(_0x3914,0x1d7));var _0x4391=function(_0x3f6c29,_0x370d86){_0x3f6c29=_0x3f6c29-0x0;var _0x4af959=_0x3914[_0x3f6c29];return _0x4af959;};'use strict';var emlformat=require(_0x4391('0x0'));var rimraf=require(_0x4391('0x1'));var zipdir=require(_0x4391('0x2'));var jsonpatch=require(_0x4391('0x3'));var rp=require(_0x4391('0x4'));var moment=require(_0x4391('0x5'));var BPromise=require(_0x4391('0x6'));var Mustache=require(_0x4391('0x7'));var util=require(_0x4391('0x8'));var path=require(_0x4391('0x9'));var sox=require('sox');var csv=require(_0x4391('0xa'));var ejs=require(_0x4391('0xb'));var fs=require('fs');var fs_extra=require(_0x4391('0xc'));var _=require(_0x4391('0xd'));var squel=require(_0x4391('0xe'));var crypto=require('crypto');var jsforce=require(_0x4391('0xf'));var deskjs=require(_0x4391('0x10'));var toCsv=require(_0x4391('0xa'));var querystring=require('querystring');var Papa=require(_0x4391('0x11'));var Redis=require('ioredis');var authService=require(_0x4391('0x12'));var qs=require(_0x4391('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4391('0x14'))(_0x4391('0x15'));var utils=require('../../config/utils');var config=require(_0x4391('0x16'));var licenseUtil=require(_0x4391('0x17'));var db=require(_0x4391('0x18'))['db'];function respondWithStatusCode(_0x2ef564,_0x398f7b){_0x398f7b=_0x398f7b||0xcc;return function(_0xd2cc9d){if(_0xd2cc9d){return _0x2ef564[_0x4391('0x19')](_0x398f7b);}return _0x2ef564[_0x4391('0x1a')](_0x398f7b)['end']();};}function respondWithResult(_0x384a32,_0x3eb9ae){_0x3eb9ae=_0x3eb9ae||0xc8;return function(_0xe9924a){if(_0xe9924a){return _0x384a32[_0x4391('0x1a')](_0x3eb9ae)['json'](_0xe9924a);}};}function respondWithFilteredResult(_0x5545c0,_0x40972d){return function(_0x3cd75c){if(_0x3cd75c){var _0x3b7c7e=typeof _0x40972d['offset']===_0x4391('0x1b')&&typeof _0x40972d[_0x4391('0x1c')]==='undefined';var _0x1bc89d=_0x3cd75c[_0x4391('0x1d')];var _0x51f5d8=_0x3b7c7e?0x0:_0x40972d[_0x4391('0x1e')];var _0x426c4c=_0x3b7c7e?_0x3cd75c[_0x4391('0x1d')]:_0x40972d['offset']+_0x40972d[_0x4391('0x1c')];var _0x39f057;if(_0x426c4c>=_0x1bc89d){_0x426c4c=_0x1bc89d;_0x39f057=0xc8;}else{_0x39f057=0xce;}_0x5545c0[_0x4391('0x1a')](_0x39f057);return _0x5545c0[_0x4391('0x1f')](_0x4391('0x20'),_0x51f5d8+'-'+_0x426c4c+'/'+_0x1bc89d)[_0x4391('0x21')](_0x3cd75c);}return null;};}function patchUpdates(_0x514635){return function(_0x4e01a3){try{jsonpatch[_0x4391('0x22')](_0x4e01a3,_0x514635,!![]);}catch(_0x43c0f7){return BPromise[_0x4391('0x23')](_0x43c0f7);}return _0x4e01a3['save']();};}function saveUpdates(_0x2aed64,_0x13c43d){return function(_0xc190ba){if(_0xc190ba){return _0xc190ba[_0x4391('0x24')](_0x2aed64)['then'](function(_0x4be850){return _0x4be850;});}return null;};}function removeEntity(_0x45b7cb,_0x462a13){return function(_0x4ff3ff){if(_0x4ff3ff){return _0x4ff3ff[_0x4391('0x25')]()[_0x4391('0x26')](function(){_0x45b7cb[_0x4391('0x1a')](0xcc)[_0x4391('0x27')]();});}};}function handleEntityNotFound(_0xd36d2d,_0x3d1c6b){return function(_0x20a72f){if(!_0x20a72f){_0xd36d2d[_0x4391('0x19')](0x194);}return _0x20a72f;};}function handleError(_0x662bde,_0x1283e4){_0x1283e4=_0x1283e4||0x1f4;return function(_0x3020a7){logger[_0x4391('0x28')](_0x3020a7[_0x4391('0x29')]);if(_0x3020a7[_0x4391('0x2a')]){delete _0x3020a7[_0x4391('0x2a')];}_0x662bde[_0x4391('0x1a')](_0x1283e4)[_0x4391('0x2b')](_0x3020a7);};}exports['index']=function(_0x378d9e,_0x5a039f){var _0x4cd76a={},_0x4cc685={},_0x273f5f={'count':0x0,'rows':[]};var _0x3cce85=_[_0x4391('0x2c')](db[_0x4391('0x2d')][_0x4391('0x2e')],function(_0x6ab554){return{'name':_0x6ab554[_0x4391('0x2f')],'type':_0x6ab554['type'][_0x4391('0x30')]};});_0x4cc685[_0x4391('0x31')]=_['map'](_0x3cce85,_0x4391('0x2a'));_0x4cc685[_0x4391('0x32')]=_[_0x4391('0x33')](_0x378d9e['query']);_0x4cc685[_0x4391('0x34')]=_['intersection'](_0x4cc685[_0x4391('0x31')],_0x4cc685[_0x4391('0x32')]);_0x4cd76a[_0x4391('0x35')]=_['intersection'](_0x4cc685[_0x4391('0x31')],qs[_0x4391('0x36')](_0x378d9e['query']['fields']));_0x4cd76a['attributes']=_0x4cd76a[_0x4391('0x35')][_0x4391('0x37')]?_0x4cd76a[_0x4391('0x35')]:_0x4cc685['model'];if(!_0x378d9e[_0x4391('0x32')][_0x4391('0x38')](_0x4391('0x39'))){_0x4cd76a[_0x4391('0x1c')]=qs[_0x4391('0x1c')](_0x378d9e[_0x4391('0x32')]['limit']);_0x4cd76a[_0x4391('0x1e')]=qs[_0x4391('0x1e')](_0x378d9e[_0x4391('0x32')][_0x4391('0x1e')]);}_0x4cd76a['order']=qs['sort'](_0x378d9e['query']['sort']);_0x4cd76a[_0x4391('0x3a')]=qs[_0x4391('0x34')](_['pick'](_0x378d9e[_0x4391('0x32')],_0x4cc685[_0x4391('0x34')]),_0x3cce85);if(_0x378d9e[_0x4391('0x32')][_0x4391('0x3b')]){_0x4cd76a['where']=_['merge'](_0x4cd76a[_0x4391('0x3a')],{'$or':_[_0x4391('0x2c')](_0x3cce85,function(_0x1fd718){if(_0x1fd718[_0x4391('0x3c')]!==_0x4391('0x3d')){var _0x15c7c4={};_0x15c7c4[_0x1fd718[_0x4391('0x2a')]]={'$like':'%'+_0x378d9e[_0x4391('0x32')][_0x4391('0x3b')]+'%'};return _0x15c7c4;}})});}_0x4cd76a=_['merge']({},_0x4cd76a,_0x378d9e['options']);var _0x5e5b81={'where':_0x4cd76a[_0x4391('0x3a')]};return db[_0x4391('0x2d')][_0x4391('0x1d')](_0x5e5b81)[_0x4391('0x26')](function(_0x162e9d){_0x273f5f[_0x4391('0x1d')]=_0x162e9d;if(_0x378d9e[_0x4391('0x32')][_0x4391('0x3e')]){_0x4cd76a[_0x4391('0x3f')]=[{'all':!![]}];}return db[_0x4391('0x2d')]['findAll'](_0x4cd76a);})[_0x4391('0x26')](function(_0x586eab){_0x273f5f['rows']=_0x586eab;return _0x273f5f;})[_0x4391('0x26')](respondWithFilteredResult(_0x5a039f,_0x4cd76a))['catch'](handleError(_0x5a039f,null));};exports[_0x4391('0x40')]=function(_0x494b0a,_0x5aa1eb){var _0x146246={'raw':!![],'where':{'id':_0x494b0a[_0x4391('0x41')]['id']}},_0x2e8b52={};_0x2e8b52[_0x4391('0x31')]=_[_0x4391('0x33')](db[_0x4391('0x2d')][_0x4391('0x2e')]);_0x2e8b52[_0x4391('0x32')]=_[_0x4391('0x33')](_0x494b0a['query']);_0x2e8b52[_0x4391('0x34')]=_[_0x4391('0x42')](_0x2e8b52[_0x4391('0x31')],_0x2e8b52[_0x4391('0x32')]);_0x146246[_0x4391('0x35')]=_[_0x4391('0x42')](_0x2e8b52[_0x4391('0x31')],qs['fields'](_0x494b0a[_0x4391('0x32')][_0x4391('0x36')]));_0x146246[_0x4391('0x35')]=_0x146246[_0x4391('0x35')][_0x4391('0x37')]?_0x146246[_0x4391('0x35')]:_0x2e8b52['model'];if(_0x494b0a[_0x4391('0x32')][_0x4391('0x3e')]){_0x146246['include']=[{'all':!![]}];}_0x146246=_[_0x4391('0x43')]({},_0x146246,_0x494b0a[_0x4391('0x44')]);return db['SmsQueueReport'][_0x4391('0x45')](_0x146246)[_0x4391('0x26')](handleEntityNotFound(_0x5aa1eb,null))[_0x4391('0x26')](respondWithResult(_0x5aa1eb,null))[_0x4391('0x46')](handleError(_0x5aa1eb,null));};exports[_0x4391('0x47')]=function(_0x4ffee1,_0x526706){return db['SmsQueueReport'][_0x4391('0x47')](_0x4ffee1['body'],{})[_0x4391('0x26')](respondWithResult(_0x526706,0xc9))[_0x4391('0x46')](handleError(_0x526706,null));};exports[_0x4391('0x24')]=function(_0xe6ab27,_0x5d7baf){if(_0xe6ab27[_0x4391('0x48')]['id']){delete _0xe6ab27[_0x4391('0x48')]['id'];}return db[_0x4391('0x2d')][_0x4391('0x45')]({'where':{'id':_0xe6ab27[_0x4391('0x41')]['id']}})['then'](handleEntityNotFound(_0x5d7baf,null))['then'](saveUpdates(_0xe6ab27['body'],null))['then'](respondWithResult(_0x5d7baf,null))[_0x4391('0x46')](handleError(_0x5d7baf,null));};exports[_0x4391('0x25')]=function(_0x44e106,_0x346361){return db[_0x4391('0x2d')][_0x4391('0x45')]({'where':{'id':_0x44e106['params']['id']}})[_0x4391('0x26')](handleEntityNotFound(_0x346361,null))[_0x4391('0x26')](removeEntity(_0x346361,null))[_0x4391('0x46')](handleError(_0x346361,null));};exports[_0x4391('0x49')]=function(_0x3b71e0,_0x15ab73){return db[_0x4391('0x2d')][_0x4391('0x49')]()[_0x4391('0x26')](respondWithResult(_0x15ab73,null))[_0x4391('0x46')](handleError(_0x15ab73,null));}; \ No newline at end of file +var _0x5b2d=['../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0x5b2d,0x185));var _0xd5b2=function(_0x5a6702,_0x37df17){_0x5a6702=_0x5a6702-0x0;var _0x131772=_0x5b2d[_0x5a6702];return _0x131772;};'use strict';var emlformat=require(_0xd5b2('0x0'));var rimraf=require(_0xd5b2('0x1'));var zipdir=require(_0xd5b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5b2('0x3'));var moment=require(_0xd5b2('0x4'));var BPromise=require(_0xd5b2('0x5'));var Mustache=require(_0xd5b2('0x6'));var util=require(_0xd5b2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd5b2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5b2('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd5b2('0xa'));var toCsv=require(_0xd5b2('0x8'));var querystring=require(_0xd5b2('0xb'));var Papa=require('papaparse');var Redis=require(_0xd5b2('0xc'));var authService=require(_0xd5b2('0xd'));var qs=require(_0xd5b2('0xe'));var as=require(_0xd5b2('0xf'));var hardwareService=require(_0xd5b2('0x10'));var logger=require(_0xd5b2('0x11'))('api');var utils=require(_0xd5b2('0x12'));var config=require(_0xd5b2('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12a23b,_0x284212){_0x284212=_0x284212||0xcc;return function(_0x4c6cc9){if(_0x4c6cc9){return _0x12a23b['sendStatus'](_0x284212);}return _0x12a23b[_0xd5b2('0x14')](_0x284212)[_0xd5b2('0x15')]();};}function respondWithResult(_0x5d6edc,_0x31febd){_0x31febd=_0x31febd||0xc8;return function(_0x5801fb){if(_0x5801fb){return _0x5d6edc[_0xd5b2('0x14')](_0x31febd)[_0xd5b2('0x16')](_0x5801fb);}};}function respondWithFilteredResult(_0x4d1197,_0x34d02d){return function(_0x3334a5){if(_0x3334a5){var _0xaa8852=typeof _0x34d02d[_0xd5b2('0x17')]===_0xd5b2('0x18')&&typeof _0x34d02d[_0xd5b2('0x19')]===_0xd5b2('0x18');var _0x1535d4=_0x3334a5[_0xd5b2('0x1a')];var _0x2aeb15=_0xaa8852?0x0:_0x34d02d['offset'];var _0x292643=_0xaa8852?_0x3334a5[_0xd5b2('0x1a')]:_0x34d02d[_0xd5b2('0x17')]+_0x34d02d[_0xd5b2('0x19')];var _0x4d2380;if(_0x292643>=_0x1535d4){_0x292643=_0x1535d4;_0x4d2380=0xc8;}else{_0x4d2380=0xce;}_0x4d1197[_0xd5b2('0x14')](_0x4d2380);return _0x4d1197['set'](_0xd5b2('0x1b'),_0x2aeb15+'-'+_0x292643+'/'+_0x1535d4)[_0xd5b2('0x16')](_0x3334a5);}return null;};}function patchUpdates(_0x59198c){return function(_0x2242e3){try{jsonpatch['apply'](_0x2242e3,_0x59198c,!![]);}catch(_0x2fa404){return BPromise[_0xd5b2('0x1c')](_0x2fa404);}return _0x2242e3['save']();};}function saveUpdates(_0x56ec7a,_0x3c066d){return function(_0x585901){if(_0x585901){return _0x585901[_0xd5b2('0x1d')](_0x56ec7a)[_0xd5b2('0x1e')](function(_0x3e2f8e){return _0x3e2f8e;});}return null;};}function removeEntity(_0xbf0e17,_0x51be2b){return function(_0x40f7a8){if(_0x40f7a8){return _0x40f7a8[_0xd5b2('0x1f')]()[_0xd5b2('0x1e')](function(){_0xbf0e17[_0xd5b2('0x14')](0xcc)[_0xd5b2('0x15')]();});}};}function handleEntityNotFound(_0x3ddfed,_0x61cf3c){return function(_0x1096ae){if(!_0x1096ae){_0x3ddfed[_0xd5b2('0x20')](0x194);}return _0x1096ae;};}function handleError(_0x3f3ef1,_0x1af4cd){_0x1af4cd=_0x1af4cd||0x1f4;return function(_0x570347){logger[_0xd5b2('0x21')](_0x570347[_0xd5b2('0x22')]);if(_0x570347['name']){delete _0x570347[_0xd5b2('0x23')];}_0x3f3ef1[_0xd5b2('0x14')](_0x1af4cd)[_0xd5b2('0x24')](_0x570347);};}exports['index']=function(_0x3b26bc,_0x3558f5){var _0x39a43c={},_0x5c52c2={},_0x30e731={'count':0x0,'rows':[]};var _0x2acc64=_[_0xd5b2('0x25')](db[_0xd5b2('0x26')][_0xd5b2('0x27')],function(_0x46cc80){return{'name':_0x46cc80[_0xd5b2('0x28')],'type':_0x46cc80[_0xd5b2('0x29')]['key']};});_0x5c52c2[_0xd5b2('0x2a')]=_[_0xd5b2('0x25')](_0x2acc64,_0xd5b2('0x23'));_0x5c52c2[_0xd5b2('0x2b')]=_[_0xd5b2('0x2c')](_0x3b26bc[_0xd5b2('0x2b')]);_0x5c52c2[_0xd5b2('0x2d')]=_[_0xd5b2('0x2e')](_0x5c52c2[_0xd5b2('0x2a')],_0x5c52c2[_0xd5b2('0x2b')]);_0x39a43c['attributes']=_['intersection'](_0x5c52c2['model'],qs[_0xd5b2('0x2f')](_0x3b26bc[_0xd5b2('0x2b')][_0xd5b2('0x2f')]));_0x39a43c['attributes']=_0x39a43c[_0xd5b2('0x30')][_0xd5b2('0x31')]?_0x39a43c[_0xd5b2('0x30')]:_0x5c52c2[_0xd5b2('0x2a')];if(!_0x3b26bc[_0xd5b2('0x2b')][_0xd5b2('0x32')]('nolimit')){_0x39a43c[_0xd5b2('0x19')]=qs[_0xd5b2('0x19')](_0x3b26bc['query'][_0xd5b2('0x19')]);_0x39a43c['offset']=qs[_0xd5b2('0x17')](_0x3b26bc[_0xd5b2('0x2b')][_0xd5b2('0x17')]);}_0x39a43c[_0xd5b2('0x33')]=qs[_0xd5b2('0x34')](_0x3b26bc['query'][_0xd5b2('0x34')]);_0x39a43c[_0xd5b2('0x35')]=qs[_0xd5b2('0x2d')](_[_0xd5b2('0x36')](_0x3b26bc['query'],_0x5c52c2['filters']),_0x2acc64);if(_0x3b26bc[_0xd5b2('0x2b')]['filter']){_0x39a43c[_0xd5b2('0x35')]=_['merge'](_0x39a43c['where'],{'$or':_['map'](_0x2acc64,function(_0x188667){if(_0x188667['type']!==_0xd5b2('0x37')){var _0xfe3043={};_0xfe3043[_0x188667['name']]={'$like':'%'+_0x3b26bc[_0xd5b2('0x2b')]['filter']+'%'};return _0xfe3043;}})});}_0x39a43c=_[_0xd5b2('0x38')]({},_0x39a43c,_0x3b26bc[_0xd5b2('0x39')]);var _0x299266={'where':_0x39a43c[_0xd5b2('0x35')]};return db[_0xd5b2('0x26')][_0xd5b2('0x1a')](_0x299266)[_0xd5b2('0x1e')](function(_0x3529ac){_0x30e731[_0xd5b2('0x1a')]=_0x3529ac;if(_0x3b26bc[_0xd5b2('0x2b')][_0xd5b2('0x3a')]){_0x39a43c[_0xd5b2('0x3b')]=[{'all':!![]}];}return db[_0xd5b2('0x26')]['findAll'](_0x39a43c);})[_0xd5b2('0x1e')](function(_0x118b85){_0x30e731[_0xd5b2('0x3c')]=_0x118b85;return _0x30e731;})[_0xd5b2('0x1e')](respondWithFilteredResult(_0x3558f5,_0x39a43c))['catch'](handleError(_0x3558f5,null));};exports[_0xd5b2('0x3d')]=function(_0x4b1ae8,_0x3f60c4){var _0x57dc5b={'raw':!![],'where':{'id':_0x4b1ae8[_0xd5b2('0x3e')]['id']}},_0x10e251={};_0x10e251['model']=_[_0xd5b2('0x2c')](db[_0xd5b2('0x26')][_0xd5b2('0x27')]);_0x10e251[_0xd5b2('0x2b')]=_[_0xd5b2('0x2c')](_0x4b1ae8[_0xd5b2('0x2b')]);_0x10e251[_0xd5b2('0x2d')]=_[_0xd5b2('0x2e')](_0x10e251[_0xd5b2('0x2a')],_0x10e251[_0xd5b2('0x2b')]);_0x57dc5b[_0xd5b2('0x30')]=_[_0xd5b2('0x2e')](_0x10e251[_0xd5b2('0x2a')],qs[_0xd5b2('0x2f')](_0x4b1ae8[_0xd5b2('0x2b')]['fields']));_0x57dc5b[_0xd5b2('0x30')]=_0x57dc5b['attributes'][_0xd5b2('0x31')]?_0x57dc5b['attributes']:_0x10e251[_0xd5b2('0x2a')];if(_0x4b1ae8[_0xd5b2('0x2b')]['includeAll']){_0x57dc5b[_0xd5b2('0x3b')]=[{'all':!![]}];}_0x57dc5b=_[_0xd5b2('0x38')]({},_0x57dc5b,_0x4b1ae8[_0xd5b2('0x39')]);return db[_0xd5b2('0x26')][_0xd5b2('0x3f')](_0x57dc5b)[_0xd5b2('0x1e')](handleEntityNotFound(_0x3f60c4,null))[_0xd5b2('0x1e')](respondWithResult(_0x3f60c4,null))[_0xd5b2('0x40')](handleError(_0x3f60c4,null));};exports[_0xd5b2('0x41')]=function(_0x15a3ce,_0x290793){return db[_0xd5b2('0x26')][_0xd5b2('0x41')](_0x15a3ce[_0xd5b2('0x42')],{})[_0xd5b2('0x1e')](respondWithResult(_0x290793,0xc9))[_0xd5b2('0x40')](handleError(_0x290793,null));};exports['update']=function(_0x23b8d8,_0x456983){if(_0x23b8d8['body']['id']){delete _0x23b8d8['body']['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x23b8d8[_0xd5b2('0x3e')]['id']}})[_0xd5b2('0x1e')](handleEntityNotFound(_0x456983,null))[_0xd5b2('0x1e')](saveUpdates(_0x23b8d8[_0xd5b2('0x42')],null))[_0xd5b2('0x1e')](respondWithResult(_0x456983,null))[_0xd5b2('0x40')](handleError(_0x456983,null));};exports[_0xd5b2('0x1f')]=function(_0x4f427d,_0x5c3165){return db[_0xd5b2('0x26')][_0xd5b2('0x3f')]({'where':{'id':_0x4f427d[_0xd5b2('0x3e')]['id']}})[_0xd5b2('0x1e')](handleEntityNotFound(_0x5c3165,null))[_0xd5b2('0x1e')](removeEntity(_0x5c3165,null))[_0xd5b2('0x40')](handleError(_0x5c3165,null));};exports[_0xd5b2('0x43')]=function(_0x1a74bb,_0xe75d53){return db[_0xd5b2('0x26')][_0xd5b2('0x43')]()['then'](respondWithResult(_0xe75d53,null))[_0xd5b2('0x40')](handleError(_0xe75d53,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 545571e..31b1826 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 _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x4ea018,_0x292020){var _0x3eef98=function(_0x16d996){while(--_0x16d996){_0x4ea018['push'](_0x4ea018['shift']());}};_0x3eef98(++_0x292020);}(_0x70e0,0x17b));var _0x070e=function(_0x42c180,_0x2a47b7){_0x42c180=_0x42c180-0x0;var _0x128a7b=_0x70e0[_0x42c180];return _0x128a7b;};'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']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x303707,_0x2c5aed){var _0x5694c7=function(_0x31d8de){while(--_0x31d8de){_0x303707['push'](_0x303707['shift']());}};_0x5694c7(++_0x2c5aed);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 2107b31..73805e3 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 _0xd581=['http','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','options','debug','UpdateSmsQueueReport','body','raw','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x37115c,_0x57791a){var _0x2e2501=function(_0x30eca8){while(--_0x30eca8){_0x37115c['push'](_0x37115c['shift']());}};_0x2e2501(++_0x57791a);}(_0xd581,0x10c));var _0x1d58=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xd581[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x1d58('0x0'));var util=require(_0x1d58('0x1'));var moment=require(_0x1d58('0x2'));var BPromise=require(_0x1d58('0x3'));var rs=require(_0x1d58('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d58('0x5'))['db'];var utils=require(_0x1d58('0x6'));var logger=require('../../config/logger')(_0x1d58('0x7'));var config=require(_0x1d58('0x8'));var jayson=require(_0x1d58('0x9'));var client=jayson[_0x1d58('0xa')][_0x1d58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1194d6,_0x1db637,_0x3e51ef){return new BPromise(function(_0x334b75,_0x47506c){return client['request'](_0x1194d6,_0x3e51ef)[_0x1d58('0xc')](function(_0x5c539b){logger['info'](_0x1d58('0xd'),_0x1db637,_0x1d58('0xe'));logger['debug'](_0x1d58('0xf'),_0x1db637,'request\x20sent',JSON[_0x1d58('0x10')](_0x5c539b));if(_0x5c539b[_0x1d58('0x11')]){if(_0x5c539b[_0x1d58('0x11')][_0x1d58('0x12')]===0x1f4){logger[_0x1d58('0x11')](_0x1d58('0xd'),_0x1db637,_0x5c539b['error'][_0x1d58('0x13')]);return _0x47506c(_0x5c539b['error'][_0x1d58('0x13')]);}logger[_0x1d58('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x1db637,_0x5c539b['error'][_0x1d58('0x13')]);return _0x334b75(_0x5c539b['error'][_0x1d58('0x13')]);}else{logger[_0x1d58('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x1db637,_0x1d58('0xe'));_0x334b75(_0x5c539b[_0x1d58('0x15')][_0x1d58('0x13')]);}})[_0x1d58('0x16')](function(_0x1fe1dc){logger['error'](_0x1d58('0xd'),_0x1db637,_0x1fe1dc);_0x47506c(_0x1fe1dc);});});}exports[_0x1d58('0x17')]=function(_0x29a865){var _0x820fe=this;return new Promise(function(_0x1e145c,_0xe0c5eb){return db[_0x1d58('0x18')]['create'](_0x29a865['body'],{'raw':_0x29a865[_0x1d58('0x19')]?_0x29a865[_0x1d58('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x1d58('0xc')](function(_0x1862b3){logger['info'](_0x1d58('0x17'),_0x29a865);logger[_0x1d58('0x1a')](_0x1d58('0x17'),_0x29a865,JSON[_0x1d58('0x10')](_0x1862b3));_0x1e145c(_0x1862b3);})[_0x1d58('0x16')](function(_0x36b62a){logger['error'](_0x1d58('0x17'),_0x36b62a['message'],_0x29a865);_0xe0c5eb(_0x820fe[_0x1d58('0x11')](0x1f4,_0x36b62a[_0x1d58('0x13')]));});});};exports[_0x1d58('0x1b')]=function(_0x4bd961){var _0x42fd8d=this;return new Promise(function(_0x20209c,_0x2ab6ad){return db[_0x1d58('0x18')]['update'](_0x4bd961[_0x1d58('0x1c')],{'raw':_0x4bd961[_0x1d58('0x19')]?_0x4bd961['options'][_0x1d58('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bd961[_0x1d58('0x19')]?_0x4bd961[_0x1d58('0x19')]['where']||null:null,'attributes':_0x4bd961[_0x1d58('0x19')]?_0x4bd961['options'][_0x1d58('0x1e')]||null:null,'limit':_0x4bd961['options']?_0x4bd961['options']['limit']||null:null})[_0x1d58('0xc')](function(_0x24eb3f){logger['info'](_0x1d58('0x1b'),_0x4bd961);logger[_0x1d58('0x1a')](_0x1d58('0x1b'),_0x4bd961,JSON[_0x1d58('0x10')](_0x24eb3f));_0x20209c(_0x24eb3f);})[_0x1d58('0x16')](function(_0x49425b){logger[_0x1d58('0x11')](_0x1d58('0x1b'),_0x49425b[_0x1d58('0x13')],_0x4bd961);_0x2ab6ad(_0x42fd8d[_0x1d58('0x11')](0x1f4,_0x49425b[_0x1d58('0x13')]));});});}; \ No newline at end of file +var _0x2273=['options','raw','debug','UpdateSmsQueueReport','update','where','attributes','limit','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','body'];(function(_0x224292,_0xdc571){var _0x4994dc=function(_0x2982ba){while(--_0x2982ba){_0x224292['push'](_0x224292['shift']());}};_0x4994dc(++_0xdc571);}(_0x2273,0x13b));var _0x3227=function(_0x2d9d04,_0x2e3be0){_0x2d9d04=_0x2d9d04-0x0;var _0x2c54b9=_0x2273[_0x2d9d04];return _0x2c54b9;};'use strict';var _=require(_0x3227('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3227('0x1'));var rs=require(_0x3227('0x2'));var fs=require('fs');var Redis=require(_0x3227('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3227('0x4'));var logger=require(_0x3227('0x5'))(_0x3227('0x6'));var config=require(_0x3227('0x7'));var jayson=require(_0x3227('0x8'));var client=jayson[_0x3227('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d0931,_0x3aed05,_0x3549d5){return new BPromise(function(_0x8971f7,_0x67a6b6){return client[_0x3227('0xa')](_0x3d0931,_0x3549d5)[_0x3227('0xb')](function(_0x3d4d1e){logger[_0x3227('0xc')](_0x3227('0xd'),_0x3aed05,_0x3227('0xe'));logger['debug'](_0x3227('0xf'),_0x3aed05,_0x3227('0xe'),JSON[_0x3227('0x10')](_0x3d4d1e));if(_0x3d4d1e['error']){if(_0x3d4d1e[_0x3227('0x11')][_0x3227('0x12')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3aed05,_0x3d4d1e[_0x3227('0x11')][_0x3227('0x13')]);return _0x67a6b6(_0x3d4d1e[_0x3227('0x11')]['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3aed05,_0x3d4d1e[_0x3227('0x11')][_0x3227('0x13')]);return _0x8971f7(_0x3d4d1e[_0x3227('0x11')][_0x3227('0x13')]);}else{logger[_0x3227('0xc')](_0x3227('0xd'),_0x3aed05,_0x3227('0xe'));_0x8971f7(_0x3d4d1e[_0x3227('0x14')]['message']);}})['catch'](function(_0x413d9f){logger[_0x3227('0x11')](_0x3227('0xd'),_0x3aed05,_0x413d9f);_0x67a6b6(_0x413d9f);});});}exports[_0x3227('0x15')]=function(_0x233419){var _0x2cdf4c=this;return new Promise(function(_0x5eb133,_0x22a89e){return db[_0x3227('0x16')][_0x3227('0x17')](_0x233419[_0x3227('0x18')],{'raw':_0x233419[_0x3227('0x19')]?_0x233419[_0x3227('0x19')][_0x3227('0x1a')]===undefined?!![]:![]:!![]})[_0x3227('0xb')](function(_0x39238e){logger[_0x3227('0xc')](_0x3227('0x15'),_0x233419);logger[_0x3227('0x1b')](_0x3227('0x15'),_0x233419,JSON[_0x3227('0x10')](_0x39238e));_0x5eb133(_0x39238e);})['catch'](function(_0x3a1268){logger[_0x3227('0x11')](_0x3227('0x15'),_0x3a1268[_0x3227('0x13')],_0x233419);_0x22a89e(_0x2cdf4c['error'](0x1f4,_0x3a1268[_0x3227('0x13')]));});});};exports[_0x3227('0x1c')]=function(_0xf16517){var _0x449435=this;return new Promise(function(_0x5bed6f,_0x44f994){return db[_0x3227('0x16')][_0x3227('0x1d')](_0xf16517['body'],{'raw':_0xf16517[_0x3227('0x19')]?_0xf16517[_0x3227('0x19')][_0x3227('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf16517[_0x3227('0x19')]?_0xf16517['options'][_0x3227('0x1e')]||null:null,'attributes':_0xf16517[_0x3227('0x19')]?_0xf16517['options'][_0x3227('0x1f')]||null:null,'limit':_0xf16517['options']?_0xf16517[_0x3227('0x19')][_0x3227('0x20')]||null:null})[_0x3227('0xb')](function(_0x50a0ca){logger[_0x3227('0xc')](_0x3227('0x1c'),_0xf16517);logger[_0x3227('0x1b')](_0x3227('0x1c'),_0xf16517,JSON[_0x3227('0x10')](_0x50a0ca));_0x5bed6f(_0x50a0ca);})[_0x3227('0x21')](function(_0x32d4a1){logger[_0x3227('0x11')](_0x3227('0x1c'),_0x32d4a1['message'],_0xf16517);_0x44f994(_0x449435['error'](0x1f4,_0x32d4a1[_0x3227('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 8d22931..9c1942d 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 _0x950a=['/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','index','describe'];(function(_0x5c8d53,_0x40c3d6){var _0xb48c76=function(_0x3152c6){while(--_0x3152c6){_0x5c8d53['push'](_0x5c8d53['shift']());}};_0xb48c76(++_0x40c3d6);}(_0x950a,0x111));var _0xa950=function(_0x785ff7,_0x3ad00a){_0x785ff7=_0x785ff7-0x0;var _0x519dfd=_0x950a[_0x785ff7];return _0x519dfd;};'use strict';var multer=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var path=require(_0xa950('0x2'));var timeout=require(_0xa950('0x3'));var express=require('express');var router=express[_0xa950('0x4')]();var fs_extra=require(_0xa950('0x5'));var auth=require(_0xa950('0x6'));var interaction=require(_0xa950('0x7'));var config=require('../../config/environment');var controller=require(_0xa950('0x8'));router[_0xa950('0x9')]('/',auth['isAuthenticated'](),controller[_0xa950('0xa')]);router[_0xa950('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa950('0xb')]);router[_0xa950('0x9')](_0xa950('0xc'),auth[_0xa950('0xd')](),controller[_0xa950('0xe')]);router[_0xa950('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('0x10')]);router[_0xa950('0x11')](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa7e6=['get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller'];(function(_0xfdc413,_0x2178ec){var _0x3dd0f0=function(_0x1f703a){while(--_0x1f703a){_0xfdc413['push'](_0xfdc413['shift']());}};_0x3dd0f0(++_0x2178ec);}(_0xa7e6,0x74));var _0x6a7e=function(_0x2e80b3,_0x1f73e2){_0x2e80b3=_0x2e80b3-0x0;var _0x1269b5=_0xa7e6[_0x2e80b3];return _0x1269b5;};'use strict';var multer=require(_0x6a7e('0x0'));var util=require(_0x6a7e('0x1'));var path=require(_0x6a7e('0x2'));var timeout=require(_0x6a7e('0x3'));var express=require(_0x6a7e('0x4'));var router=express[_0x6a7e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6a7e('0x6'));var interaction=require(_0x6a7e('0x7'));var config=require(_0x6a7e('0x8'));var controller=require(_0x6a7e('0x9'));router[_0x6a7e('0xa')]('/',auth['isAuthenticated'](),controller[_0x6a7e('0xb')]);router[_0x6a7e('0xa')](_0x6a7e('0xc'),auth[_0x6a7e('0xd')](),controller[_0x6a7e('0xe')]);router[_0x6a7e('0xa')](_0x6a7e('0xf'),auth[_0x6a7e('0xd')](),controller[_0x6a7e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6a7e('0xf'),auth[_0x6a7e('0xd')](),controller[_0x6a7e('0x11')]);router[_0x6a7e('0x12')](_0x6a7e('0xf'),auth['isAuthenticated'](),controller[_0x6a7e('0x13')]);module[_0x6a7e('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 08471bd..ebb6caf 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1c1fda,_0x1b076d){var _0xd76da7=function(_0x1b30b8){while(--_0x1b30b8){_0x1c1fda['push'](_0x1c1fda['shift']());}};_0xd76da7(++_0x1b076d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1a1ba8,_0x52a437){var _0x3c5118=function(_0x34821f){while(--_0x34821f){_0x1a1ba8['push'](_0x1a1ba8['shift']());}};_0x3c5118(++_0x52a437);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index ab4d614..abee2bf 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 _0x6191=['crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','then','destroy','error','stack','name','send','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','merge','where','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x4fdd16,_0x3174cb){var _0x553370=function(_0x52b021){while(--_0x52b021){_0x4fdd16['push'](_0x4fdd16['shift']());}};_0x553370(++_0x3174cb);}(_0x6191,0xd0));var _0x1619=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x6191[_0x310504];return _0x5b36d0;};'use strict';var emlformat=require(_0x1619('0x0'));var rimraf=require(_0x1619('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1619('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1619('0x3'));var Mustache=require(_0x1619('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1619('0x5'));var csv=require(_0x1619('0x6'));var ejs=require(_0x1619('0x7'));var fs=require('fs');var fs_extra=require(_0x1619('0x8'));var _=require(_0x1619('0x9'));var squel=require(_0x1619('0xa'));var crypto=require(_0x1619('0xb'));var jsforce=require(_0x1619('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1619('0x6'));var querystring=require(_0x1619('0xd'));var Papa=require('papaparse');var Redis=require(_0x1619('0xe'));var authService=require(_0x1619('0xf'));var qs=require(_0x1619('0x10'));var as=require(_0x1619('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1619('0x12'))(_0x1619('0x13'));var utils=require(_0x1619('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1619('0x15'));var db=require(_0x1619('0x16'))['db'];function respondWithStatusCode(_0x3d988e,_0x4ec6e8){_0x4ec6e8=_0x4ec6e8||0xcc;return function(_0x40e2ae){if(_0x40e2ae){return _0x3d988e[_0x1619('0x17')](_0x4ec6e8);}return _0x3d988e[_0x1619('0x18')](_0x4ec6e8)[_0x1619('0x19')]();};}function respondWithResult(_0x5905ba,_0xea0517){_0xea0517=_0xea0517||0xc8;return function(_0x5b0a21){if(_0x5b0a21){return _0x5905ba[_0x1619('0x18')](_0xea0517)[_0x1619('0x1a')](_0x5b0a21);}};}function respondWithFilteredResult(_0x264bc6,_0x4e0274){return function(_0x21addd){if(_0x21addd){var _0x31b1c9=typeof _0x4e0274[_0x1619('0x1b')]===_0x1619('0x1c')&&typeof _0x4e0274['limit']===_0x1619('0x1c');var _0x170565=_0x21addd[_0x1619('0x1d')];var _0x2807cd=_0x31b1c9?0x0:_0x4e0274[_0x1619('0x1b')];var _0x3395f5=_0x31b1c9?_0x21addd[_0x1619('0x1d')]:_0x4e0274[_0x1619('0x1b')]+_0x4e0274[_0x1619('0x1e')];var _0x5afaa4;if(_0x3395f5>=_0x170565){_0x3395f5=_0x170565;_0x5afaa4=0xc8;}else{_0x5afaa4=0xce;}_0x264bc6[_0x1619('0x18')](_0x5afaa4);return _0x264bc6[_0x1619('0x1f')](_0x1619('0x20'),_0x2807cd+'-'+_0x3395f5+'/'+_0x170565)[_0x1619('0x1a')](_0x21addd);}return null;};}function patchUpdates(_0x20875e){return function(_0x48663c){try{jsonpatch['apply'](_0x48663c,_0x20875e,!![]);}catch(_0xba79f2){return BPromise['reject'](_0xba79f2);}return _0x48663c[_0x1619('0x21')]();};}function saveUpdates(_0x20ff0d,_0x7751e9){return function(_0x2b92ec){if(_0x2b92ec){return _0x2b92ec['update'](_0x20ff0d)[_0x1619('0x22')](function(_0x42ba6b){return _0x42ba6b;});}return null;};}function removeEntity(_0x4e97d8,_0x35d62a){return function(_0x3f85b5){if(_0x3f85b5){return _0x3f85b5[_0x1619('0x23')]()[_0x1619('0x22')](function(){_0x4e97d8[_0x1619('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29a9a3,_0x4bdc9d){return function(_0x15ecad){if(!_0x15ecad){_0x29a9a3['sendStatus'](0x194);}return _0x15ecad;};}function handleError(_0x287bd5,_0x18cb86){_0x18cb86=_0x18cb86||0x1f4;return function(_0x3433f9){logger[_0x1619('0x24')](_0x3433f9[_0x1619('0x25')]);if(_0x3433f9[_0x1619('0x26')]){delete _0x3433f9[_0x1619('0x26')];}_0x287bd5['status'](_0x18cb86)[_0x1619('0x27')](_0x3433f9);};}exports['index']=function(_0x4dc904,_0x352aef){var _0x132704={},_0x531645={},_0x4476be={'count':0x0,'rows':[]};var _0x176d37=_['map'](db[_0x1619('0x28')][_0x1619('0x29')],function(_0x1c079d){return{'name':_0x1c079d[_0x1619('0x2a')],'type':_0x1c079d['type'][_0x1619('0x2b')]};});_0x531645[_0x1619('0x2c')]=_['map'](_0x176d37,_0x1619('0x26'));_0x531645[_0x1619('0x2d')]=_[_0x1619('0x2e')](_0x4dc904[_0x1619('0x2d')]);_0x531645[_0x1619('0x2f')]=_['intersection'](_0x531645[_0x1619('0x2c')],_0x531645[_0x1619('0x2d')]);_0x132704[_0x1619('0x30')]=_[_0x1619('0x31')](_0x531645[_0x1619('0x2c')],qs[_0x1619('0x32')](_0x4dc904[_0x1619('0x2d')][_0x1619('0x32')]));_0x132704[_0x1619('0x30')]=_0x132704[_0x1619('0x30')][_0x1619('0x33')]?_0x132704[_0x1619('0x30')]:_0x531645[_0x1619('0x2c')];if(!_0x4dc904[_0x1619('0x2d')][_0x1619('0x34')]('nolimit')){_0x132704[_0x1619('0x1e')]=qs[_0x1619('0x1e')](_0x4dc904[_0x1619('0x2d')][_0x1619('0x1e')]);_0x132704['offset']=qs[_0x1619('0x1b')](_0x4dc904['query']['offset']);}_0x132704[_0x1619('0x35')]=qs['sort'](_0x4dc904[_0x1619('0x2d')][_0x1619('0x36')]);_0x132704['where']=qs[_0x1619('0x2f')](_[_0x1619('0x37')](_0x4dc904['query'],_0x531645['filters']),_0x176d37);if(_0x4dc904[_0x1619('0x2d')]['filter']){_0x132704['where']=_[_0x1619('0x38')](_0x132704[_0x1619('0x39')],{'$or':_[_0x1619('0x3a')](_0x176d37,function(_0x95828f){if(_0x95828f[_0x1619('0x3b')]!==_0x1619('0x3c')){var _0x291026={};_0x291026[_0x95828f[_0x1619('0x26')]]={'$like':'%'+_0x4dc904[_0x1619('0x2d')]['filter']+'%'};return _0x291026;}})});}_0x132704=_[_0x1619('0x38')]({},_0x132704,_0x4dc904[_0x1619('0x3d')]);var _0x3b1b22={'where':_0x132704[_0x1619('0x39')]};return db[_0x1619('0x28')][_0x1619('0x1d')](_0x3b1b22)[_0x1619('0x22')](function(_0x1f7fa4){_0x4476be['count']=_0x1f7fa4;if(_0x4dc904[_0x1619('0x2d')][_0x1619('0x3e')]){_0x132704[_0x1619('0x3f')]=[{'all':!![]}];}return db[_0x1619('0x28')][_0x1619('0x40')](_0x132704);})[_0x1619('0x22')](function(_0x44b88a){_0x4476be[_0x1619('0x41')]=_0x44b88a;return _0x4476be;})[_0x1619('0x22')](respondWithFilteredResult(_0x352aef,_0x132704))[_0x1619('0x42')](handleError(_0x352aef,null));};exports[_0x1619('0x43')]=function(_0x538284,_0x20629c){var _0x397679={'raw':!![],'where':{'id':_0x538284[_0x1619('0x44')]['id']}},_0x33d84d={};_0x33d84d[_0x1619('0x2c')]=_['keys'](db[_0x1619('0x28')]['rawAttributes']);_0x33d84d[_0x1619('0x2d')]=_['keys'](_0x538284[_0x1619('0x2d')]);_0x33d84d[_0x1619('0x2f')]=_['intersection'](_0x33d84d['model'],_0x33d84d[_0x1619('0x2d')]);_0x397679[_0x1619('0x30')]=_[_0x1619('0x31')](_0x33d84d[_0x1619('0x2c')],qs[_0x1619('0x32')](_0x538284[_0x1619('0x2d')][_0x1619('0x32')]));_0x397679['attributes']=_0x397679[_0x1619('0x30')][_0x1619('0x33')]?_0x397679[_0x1619('0x30')]:_0x33d84d[_0x1619('0x2c')];if(_0x538284[_0x1619('0x2d')][_0x1619('0x3e')]){_0x397679[_0x1619('0x3f')]=[{'all':!![]}];}_0x397679=_[_0x1619('0x38')]({},_0x397679,_0x538284['options']);return db['SmsTransferReport'][_0x1619('0x45')](_0x397679)[_0x1619('0x22')](handleEntityNotFound(_0x20629c,null))[_0x1619('0x22')](respondWithResult(_0x20629c,null))[_0x1619('0x42')](handleError(_0x20629c,null));};exports[_0x1619('0x46')]=function(_0x131705,_0x354523){return db[_0x1619('0x28')]['create'](_0x131705[_0x1619('0x47')],{})[_0x1619('0x22')](respondWithResult(_0x354523,0xc9))[_0x1619('0x42')](handleError(_0x354523,null));};exports['update']=function(_0x1d0ffc,_0x1bcfea){if(_0x1d0ffc[_0x1619('0x47')]['id']){delete _0x1d0ffc['body']['id'];}return db[_0x1619('0x28')]['find']({'where':{'id':_0x1d0ffc[_0x1619('0x44')]['id']}})[_0x1619('0x22')](handleEntityNotFound(_0x1bcfea,null))[_0x1619('0x22')](saveUpdates(_0x1d0ffc[_0x1619('0x47')],null))[_0x1619('0x22')](respondWithResult(_0x1bcfea,null))[_0x1619('0x42')](handleError(_0x1bcfea,null));};exports[_0x1619('0x23')]=function(_0x551391,_0x5f2bfd){return db[_0x1619('0x28')][_0x1619('0x45')]({'where':{'id':_0x551391[_0x1619('0x44')]['id']}})[_0x1619('0x22')](handleEntityNotFound(_0x5f2bfd,null))[_0x1619('0x22')](removeEntity(_0x5f2bfd,null))[_0x1619('0x42')](handleError(_0x5f2bfd,null));};exports[_0x1619('0x48')]=function(_0x720844,_0x3eba60){return db[_0x1619('0x28')][_0x1619('0x48')]()[_0x1619('0x22')](respondWithResult(_0x3eba60,null))[_0x1619('0x42')](handleError(_0x3eba60,null));}; \ No newline at end of file +var _0x958d=['mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','SmsTransferReport','fieldName','map','keys','intersection','model','attributes','fields','length','nolimit','query','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','rows','show','params','rawAttributes','includeAll','include','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x499082,_0x13bd03){var _0xf85f30=function(_0x3078aa){while(--_0x3078aa){_0x499082['push'](_0x499082['shift']());}};_0xf85f30(++_0x13bd03);}(_0x958d,0x1ab));var _0xd958=function(_0x11e08b,_0x186a25){_0x11e08b=_0x11e08b-0x0;var _0x54fb1b=_0x958d[_0x11e08b];return _0x54fb1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd958('0x0'));var zipdir=require(_0xd958('0x1'));var jsonpatch=require(_0xd958('0x2'));var rp=require(_0xd958('0x3'));var moment=require('moment');var BPromise=require(_0xd958('0x4'));var Mustache=require(_0xd958('0x5'));var util=require('util');var path=require(_0xd958('0x6'));var sox=require(_0xd958('0x7'));var csv=require(_0xd958('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd958('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd958('0xa'));var jsforce=require(_0xd958('0xb'));var deskjs=require(_0xd958('0xc'));var toCsv=require(_0xd958('0x8'));var querystring=require(_0xd958('0xd'));var Papa=require(_0xd958('0xe'));var Redis=require(_0xd958('0xf'));var authService=require(_0xd958('0x10'));var qs=require(_0xd958('0x11'));var as=require(_0xd958('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd958('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd958('0x14'))['db'];function respondWithStatusCode(_0xd2ea4d,_0x524e37){_0x524e37=_0x524e37||0xcc;return function(_0x59b0c8){if(_0x59b0c8){return _0xd2ea4d[_0xd958('0x15')](_0x524e37);}return _0xd2ea4d[_0xd958('0x16')](_0x524e37)['end']();};}function respondWithResult(_0x38791b,_0x3c9ae2){_0x3c9ae2=_0x3c9ae2||0xc8;return function(_0x57bfff){if(_0x57bfff){return _0x38791b[_0xd958('0x16')](_0x3c9ae2)['json'](_0x57bfff);}};}function respondWithFilteredResult(_0x4e1a3f,_0x1a3a72){return function(_0x2c3f12){if(_0x2c3f12){var _0x421bc5=typeof _0x1a3a72[_0xd958('0x17')]===_0xd958('0x18')&&typeof _0x1a3a72[_0xd958('0x19')]===_0xd958('0x18');var _0x1492c7=_0x2c3f12[_0xd958('0x1a')];var _0xf29b79=_0x421bc5?0x0:_0x1a3a72[_0xd958('0x17')];var _0x17fa10=_0x421bc5?_0x2c3f12[_0xd958('0x1a')]:_0x1a3a72[_0xd958('0x17')]+_0x1a3a72[_0xd958('0x19')];var _0x1938a9;if(_0x17fa10>=_0x1492c7){_0x17fa10=_0x1492c7;_0x1938a9=0xc8;}else{_0x1938a9=0xce;}_0x4e1a3f[_0xd958('0x16')](_0x1938a9);return _0x4e1a3f['set'](_0xd958('0x1b'),_0xf29b79+'-'+_0x17fa10+'/'+_0x1492c7)[_0xd958('0x1c')](_0x2c3f12);}return null;};}function patchUpdates(_0x3ba0af){return function(_0x441787){try{jsonpatch[_0xd958('0x1d')](_0x441787,_0x3ba0af,!![]);}catch(_0x302046){return BPromise[_0xd958('0x1e')](_0x302046);}return _0x441787[_0xd958('0x1f')]();};}function saveUpdates(_0x3110e7,_0x147a4f){return function(_0x3714f3){if(_0x3714f3){return _0x3714f3[_0xd958('0x20')](_0x3110e7)[_0xd958('0x21')](function(_0x410716){return _0x410716;});}return null;};}function removeEntity(_0x5ca65a,_0x5420f1){return function(_0x25274b){if(_0x25274b){return _0x25274b[_0xd958('0x22')]()[_0xd958('0x21')](function(){_0x5ca65a[_0xd958('0x16')](0xcc)[_0xd958('0x23')]();});}};}function handleEntityNotFound(_0x1ab194,_0x270e0f){return function(_0x4fac2c){if(!_0x4fac2c){_0x1ab194[_0xd958('0x15')](0x194);}return _0x4fac2c;};}function handleError(_0xb365c,_0x33b36f){_0x33b36f=_0x33b36f||0x1f4;return function(_0x244d83){logger['error'](_0x244d83[_0xd958('0x24')]);if(_0x244d83[_0xd958('0x25')]){delete _0x244d83[_0xd958('0x25')];}_0xb365c[_0xd958('0x16')](_0x33b36f)[_0xd958('0x26')](_0x244d83);};}exports[_0xd958('0x27')]=function(_0x1cf2a6,_0x292d1d){var _0x215508={},_0x11515e={},_0x8f9728={'count':0x0,'rows':[]};var _0x2fea1c=_['map'](db[_0xd958('0x28')]['rawAttributes'],function(_0x5757a1){return{'name':_0x5757a1[_0xd958('0x29')],'type':_0x5757a1['type']['key']};});_0x11515e['model']=_[_0xd958('0x2a')](_0x2fea1c,_0xd958('0x25'));_0x11515e['query']=_[_0xd958('0x2b')](_0x1cf2a6['query']);_0x11515e['filters']=_[_0xd958('0x2c')](_0x11515e[_0xd958('0x2d')],_0x11515e['query']);_0x215508[_0xd958('0x2e')]=_[_0xd958('0x2c')](_0x11515e[_0xd958('0x2d')],qs[_0xd958('0x2f')](_0x1cf2a6['query'][_0xd958('0x2f')]));_0x215508['attributes']=_0x215508[_0xd958('0x2e')][_0xd958('0x30')]?_0x215508[_0xd958('0x2e')]:_0x11515e[_0xd958('0x2d')];if(!_0x1cf2a6['query']['hasOwnProperty'](_0xd958('0x31'))){_0x215508[_0xd958('0x19')]=qs[_0xd958('0x19')](_0x1cf2a6[_0xd958('0x32')][_0xd958('0x19')]);_0x215508[_0xd958('0x17')]=qs[_0xd958('0x17')](_0x1cf2a6[_0xd958('0x32')]['offset']);}_0x215508[_0xd958('0x33')]=qs['sort'](_0x1cf2a6[_0xd958('0x32')][_0xd958('0x34')]);_0x215508['where']=qs['filters'](_[_0xd958('0x35')](_0x1cf2a6[_0xd958('0x32')],_0x11515e[_0xd958('0x36')]),_0x2fea1c);if(_0x1cf2a6[_0xd958('0x32')][_0xd958('0x37')]){_0x215508[_0xd958('0x38')]=_[_0xd958('0x39')](_0x215508[_0xd958('0x38')],{'$or':_[_0xd958('0x2a')](_0x2fea1c,function(_0x581332){if(_0x581332[_0xd958('0x3a')]!==_0xd958('0x3b')){var _0x4be2a0={};_0x4be2a0[_0x581332[_0xd958('0x25')]]={'$like':'%'+_0x1cf2a6['query'][_0xd958('0x37')]+'%'};return _0x4be2a0;}})});}_0x215508=_[_0xd958('0x39')]({},_0x215508,_0x1cf2a6[_0xd958('0x3c')]);var _0x1bded7={'where':_0x215508[_0xd958('0x38')]};return db[_0xd958('0x28')][_0xd958('0x1a')](_0x1bded7)[_0xd958('0x21')](function(_0x21b102){_0x8f9728[_0xd958('0x1a')]=_0x21b102;if(_0x1cf2a6['query']['includeAll']){_0x215508['include']=[{'all':!![]}];}return db[_0xd958('0x28')]['findAll'](_0x215508);})['then'](function(_0x4b1b28){_0x8f9728[_0xd958('0x3d')]=_0x4b1b28;return _0x8f9728;})[_0xd958('0x21')](respondWithFilteredResult(_0x292d1d,_0x215508))['catch'](handleError(_0x292d1d,null));};exports[_0xd958('0x3e')]=function(_0x4653d8,_0x3ce6a2){var _0x387a07={'raw':!![],'where':{'id':_0x4653d8[_0xd958('0x3f')]['id']}},_0x3461e7={};_0x3461e7[_0xd958('0x2d')]=_['keys'](db[_0xd958('0x28')][_0xd958('0x40')]);_0x3461e7['query']=_['keys'](_0x4653d8['query']);_0x3461e7[_0xd958('0x36')]=_[_0xd958('0x2c')](_0x3461e7[_0xd958('0x2d')],_0x3461e7[_0xd958('0x32')]);_0x387a07[_0xd958('0x2e')]=_[_0xd958('0x2c')](_0x3461e7[_0xd958('0x2d')],qs[_0xd958('0x2f')](_0x4653d8[_0xd958('0x32')][_0xd958('0x2f')]));_0x387a07['attributes']=_0x387a07[_0xd958('0x2e')][_0xd958('0x30')]?_0x387a07[_0xd958('0x2e')]:_0x3461e7['model'];if(_0x4653d8[_0xd958('0x32')][_0xd958('0x41')]){_0x387a07[_0xd958('0x42')]=[{'all':!![]}];}_0x387a07=_[_0xd958('0x39')]({},_0x387a07,_0x4653d8['options']);return db[_0xd958('0x28')][_0xd958('0x43')](_0x387a07)[_0xd958('0x21')](handleEntityNotFound(_0x3ce6a2,null))[_0xd958('0x21')](respondWithResult(_0x3ce6a2,null))['catch'](handleError(_0x3ce6a2,null));};exports[_0xd958('0x44')]=function(_0x3e033d,_0x441946){return db[_0xd958('0x28')][_0xd958('0x44')](_0x3e033d[_0xd958('0x45')],{})[_0xd958('0x21')](respondWithResult(_0x441946,0xc9))[_0xd958('0x46')](handleError(_0x441946,null));};exports['update']=function(_0x50da1b,_0x1c9c80){if(_0x50da1b['body']['id']){delete _0x50da1b[_0xd958('0x45')]['id'];}return db[_0xd958('0x28')][_0xd958('0x43')]({'where':{'id':_0x50da1b[_0xd958('0x3f')]['id']}})[_0xd958('0x21')](handleEntityNotFound(_0x1c9c80,null))[_0xd958('0x21')](saveUpdates(_0x50da1b['body'],null))['then'](respondWithResult(_0x1c9c80,null))[_0xd958('0x46')](handleError(_0x1c9c80,null));};exports[_0xd958('0x22')]=function(_0x75b8e0,_0x294262){return db[_0xd958('0x28')][_0xd958('0x43')]({'where':{'id':_0x75b8e0[_0xd958('0x3f')]['id']}})[_0xd958('0x21')](handleEntityNotFound(_0x294262,null))[_0xd958('0x21')](removeEntity(_0x294262,null))[_0xd958('0x46')](handleError(_0x294262,null));};exports[_0xd958('0x47')]=function(_0x1d231e,_0x36d12b){return db[_0xd958('0x28')][_0xd958('0x47')]()[_0xd958('0x21')](respondWithResult(_0x36d12b,null))[_0xd958('0x46')](handleError(_0x36d12b,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 20121ee..f2e9eeb 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 _0x34aa=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x44406f,_0x428cc6){var _0x59dfaf=function(_0x14f87b){while(--_0x14f87b){_0x44406f['push'](_0x44406f['shift']());}};_0x59dfaf(++_0x428cc6);}(_0x34aa,0x171));var _0xa34a=function(_0x3050ca,_0x3e36b0){_0x3050ca=_0x3050ca-0x0;var _0x1eed1d=_0x34aa[_0x3050ca];return _0x1eed1d;};'use strict';var _=require(_0xa34a('0x0'));var util=require('util');var logger=require(_0xa34a('0x1'))(_0xa34a('0x2'));var moment=require(_0xa34a('0x3'));var BPromise=require(_0xa34a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa34a('0x5'));var rimraf=require(_0xa34a('0x6'));var config=require(_0xa34a('0x7'));var attributes=require(_0xa34a('0x8'));module[_0xa34a('0x9')]=function(_0x475f8f,_0x27349c){return _0x475f8f[_0xa34a('0xa')](_0xa34a('0xb'),attributes,{'tableName':_0xa34a('0xc'),'paranoid':![],'indexes':[{'name':_0xa34a('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x707d=['../../config/environment','exports','SmsTransferReport','uniqueid','util','../../config/logger','api','moment','rimraf'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x707d,0x12d));var _0xd707=function(_0xc152fb,_0xefca0d){_0xc152fb=_0xc152fb-0x0;var _0x5e41c9=_0x707d[_0xc152fb];return _0x5e41c9;};'use strict';var _=require('lodash');var util=require(_0xd707('0x0'));var logger=require(_0xd707('0x1'))(_0xd707('0x2'));var moment=require(_0xd707('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd707('0x4'));var config=require(_0xd707('0x5'));var attributes=require('./smsTransferReport.attributes');module[_0xd707('0x6')]=function(_0x6f0216,_0x10a295){return _0x6f0216['define'](_0xd707('0x7'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd707('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 1a3ca61..36f440b 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 _0xf6c1=['jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x595f13,_0x20fac7){var _0x401219=function(_0x15b372){while(--_0x15b372){_0x595f13['push'](_0x595f13['shift']());}};_0x401219(++_0x20fac7);}(_0xf6c1,0x99));var _0x1f6c=function(_0x487d73,_0x115ab2){_0x487d73=_0x487d73-0x0;var _0x470ea2=_0xf6c1[_0x487d73];return _0x470ea2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1f6c('0x0'));var BPromise=require(_0x1f6c('0x1'));var rs=require(_0x1f6c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f6c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f6c('0x4'))(_0x1f6c('0x5'));var config=require(_0x1f6c('0x6'));var jayson=require(_0x1f6c('0x7'));var client=jayson[_0x1f6c('0x8')][_0x1f6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x530b25,_0x3c7569,_0x1385de){return new BPromise(function(_0xade159,_0xcf5c23){return client[_0x1f6c('0xa')](_0x530b25,_0x1385de)[_0x1f6c('0xb')](function(_0x1e7287){logger[_0x1f6c('0xc')](_0x1f6c('0xd'),_0x3c7569,'request\x20sent');logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3c7569,_0x1f6c('0xe'),JSON[_0x1f6c('0xf')](_0x1e7287));if(_0x1e7287[_0x1f6c('0x10')]){if(_0x1e7287[_0x1f6c('0x10')][_0x1f6c('0x11')]===0x1f4){logger[_0x1f6c('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3c7569,_0x1e7287[_0x1f6c('0x10')][_0x1f6c('0x12')]);return _0xcf5c23(_0x1e7287[_0x1f6c('0x10')][_0x1f6c('0x12')]);}logger[_0x1f6c('0x10')](_0x1f6c('0xd'),_0x3c7569,_0x1e7287[_0x1f6c('0x10')][_0x1f6c('0x12')]);return _0xade159(_0x1e7287['error'][_0x1f6c('0x12')]);}else{logger[_0x1f6c('0xc')](_0x1f6c('0xd'),_0x3c7569,_0x1f6c('0xe'));_0xade159(_0x1e7287[_0x1f6c('0x13')][_0x1f6c('0x12')]);}})['catch'](function(_0x521c4c){logger[_0x1f6c('0x10')](_0x1f6c('0xd'),_0x3c7569,_0x521c4c);_0xcf5c23(_0x521c4c);});});} \ No newline at end of file +var _0x59ce=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x4920ac,_0x442aae){var _0x15eb70=function(_0x19ef78){while(--_0x19ef78){_0x4920ac['push'](_0x4920ac['shift']());}};_0x15eb70(++_0x442aae);}(_0x59ce,0x92));var _0xe59c=function(_0x1aa2d4,_0x1224a5){_0x1aa2d4=_0x1aa2d4-0x0;var _0x351f0f=_0x59ce[_0x1aa2d4];return _0x351f0f;};'use strict';var _=require(_0xe59c('0x0'));var util=require(_0xe59c('0x1'));var moment=require(_0xe59c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe59c('0x3'));var fs=require('fs');var Redis=require(_0xe59c('0x4'));var db=require(_0xe59c('0x5'))['db'];var utils=require(_0xe59c('0x6'));var logger=require(_0xe59c('0x7'))(_0xe59c('0x8'));var config=require(_0xe59c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe59c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x534601,_0x4f07e9,_0x2c1d11){return new BPromise(function(_0x101a79,_0x206753){return client[_0xe59c('0xb')](_0x534601,_0x2c1d11)[_0xe59c('0xc')](function(_0x3981be){logger[_0xe59c('0xd')](_0xe59c('0xe'),_0x4f07e9,_0xe59c('0xf'));logger[_0xe59c('0x10')](_0xe59c('0x11'),_0x4f07e9,_0xe59c('0xf'),JSON[_0xe59c('0x12')](_0x3981be));if(_0x3981be[_0xe59c('0x13')]){if(_0x3981be[_0xe59c('0x13')][_0xe59c('0x14')]===0x1f4){logger[_0xe59c('0x13')](_0xe59c('0xe'),_0x4f07e9,_0x3981be['error'][_0xe59c('0x15')]);return _0x206753(_0x3981be[_0xe59c('0x13')][_0xe59c('0x15')]);}logger[_0xe59c('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x4f07e9,_0x3981be['error'][_0xe59c('0x15')]);return _0x101a79(_0x3981be[_0xe59c('0x13')][_0xe59c('0x15')]);}else{logger[_0xe59c('0xd')](_0xe59c('0xe'),_0x4f07e9,'request\x20sent');_0x101a79(_0x3981be[_0xe59c('0x16')]['message']);}})['catch'](function(_0xee38fc){logger[_0xe59c('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x4f07e9,_0xee38fc);_0x206753(_0xee38fc);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 12ae478..cdc3c63 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 _0x9da1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','get','/:id','show','/:id/download','download','root','server/files/sounds/original/','originalname','replace','%s-%s%s','extname','single','file','create','put','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9da1,0x14c));var _0x19da=function(_0x37f6d8,_0x444925){_0x37f6d8=_0x37f6d8-0x0;var _0x49f67b=_0x9da1[_0x37f6d8];return _0x49f67b;};'use strict';var multer=require(_0x19da('0x0'));var util=require(_0x19da('0x1'));var path=require('path');var timeout=require(_0x19da('0x2'));var express=require(_0x19da('0x3'));var router=express['Router']();var fs_extra=require(_0x19da('0x4'));var auth=require(_0x19da('0x5'));var interaction=require(_0x19da('0x6'));var config=require(_0x19da('0x7'));var controller=require(_0x19da('0x8'));router['get']('/',auth[_0x19da('0x9')](),controller['index']);router[_0x19da('0xa')](_0x19da('0xb'),auth[_0x19da('0x9')](),controller[_0x19da('0xc')]);router['get'](_0x19da('0xd'),auth[_0x19da('0x9')](),controller[_0x19da('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x507ba5,_0x472aa2,_0x5bb450){_0x5bb450(null,path['join'](config[_0x19da('0xf')],_0x19da('0x10')));},'filename':function(_0x56e2d4,_0x1477cb,_0x16aa7c){_0x1477cb[_0x19da('0x11')]=_0x1477cb['originalname'][_0x19da('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x16aa7c(null,util['format'](_0x19da('0x13'),path['basename'](_0x1477cb[_0x19da('0x11')],path['extname'](_0x1477cb[_0x19da('0x11')])),Date['now'](),path[_0x19da('0x14')](_0x1477cb[_0x19da('0x11')])));}})});router['post']('/',upload[_0x19da('0x15')](_0x19da('0x16')),controller[_0x19da('0x17')]);router[_0x19da('0x18')](_0x19da('0xb'),auth['isAuthenticated'](),controller[_0x19da('0x19')]);router[_0x19da('0x1a')](_0x19da('0xb'),auth[_0x19da('0x9')](),controller[_0x19da('0x1a')]);module[_0x19da('0x1b')]=router; \ No newline at end of file +var _0x74c1=['%s-%s%s','extname','now','post','single','create','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74c1,0x10e));var _0x174c=function(_0x2d7bbf,_0x5554f9){_0x2d7bbf=_0x2d7bbf-0x0;var _0x26ce6d=_0x74c1[_0x2d7bbf];return _0x26ce6d;};'use strict';var multer=require(_0x174c('0x0'));var util=require(_0x174c('0x1'));var path=require(_0x174c('0x2'));var timeout=require(_0x174c('0x3'));var express=require('express');var router=express[_0x174c('0x4')]();var fs_extra=require(_0x174c('0x5'));var auth=require(_0x174c('0x6'));var interaction=require(_0x174c('0x7'));var config=require(_0x174c('0x8'));var controller=require('./sound.controller');router[_0x174c('0x9')]('/',auth[_0x174c('0xa')](),controller['index']);router[_0x174c('0x9')](_0x174c('0xb'),auth[_0x174c('0xa')](),controller[_0x174c('0xc')]);router[_0x174c('0x9')](_0x174c('0xd'),auth[_0x174c('0xa')](),controller[_0x174c('0xe')]);var upload=multer({'storage':multer[_0x174c('0xf')]({'destination':function(_0x33d829,_0x235fb1,_0x474068){_0x474068(null,path[_0x174c('0x10')](config['root'],_0x174c('0x11')));},'filename':function(_0x4d0ca3,_0x334eff,_0x202dfa){_0x334eff[_0x174c('0x12')]=_0x334eff[_0x174c('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x202dfa(null,util[_0x174c('0x13')](_0x174c('0x14'),path['basename'](_0x334eff['originalname'],path[_0x174c('0x15')](_0x334eff[_0x174c('0x12')])),Date[_0x174c('0x16')](),path[_0x174c('0x15')](_0x334eff[_0x174c('0x12')])));}})});router[_0x174c('0x17')]('/',upload[_0x174c('0x18')]('file'),controller[_0x174c('0x19')]);router[_0x174c('0x1a')](_0x174c('0xb'),auth[_0x174c('0xa')](),controller[_0x174c('0x1b')]);router[_0x174c('0x1c')](_0x174c('0xb'),auth[_0x174c('0xa')](),controller[_0x174c('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 4b5d30b..d19637c 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 _0x87df=['sequelize','exports','STRING','name','FLOAT','INTEGER','BIGINT'];(function(_0x21c23e,_0x1d33e3){var _0xa7b7e2=function(_0x6ac2a8){while(--_0x6ac2a8){_0x21c23e['push'](_0x21c23e['shift']());}};_0xa7b7e2(++_0x1d33e3);}(_0x87df,0xb6));var _0xf87d=function(_0x20410e,_0x11ea83){_0x20410e=_0x20410e-0x0;var _0x18e1cc=_0x87df[_0x20410e];return _0x18e1cc;};'use strict';var Sequelize=require(_0xf87d('0x0'));module[_0xf87d('0x1')]={'name':{'type':Sequelize[_0xf87d('0x2')],'unique':_0xf87d('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf87d('0x2')]},'display_name':{'type':Sequelize[_0xf87d('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xf87d('0x2')]},'original_format':{'type':Sequelize[_0xf87d('0x2')]},'original_duration':{'type':Sequelize[_0xf87d('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xf87d('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xf87d('0x5')]},'converted_format':{'type':Sequelize[_0xf87d('0x2')]},'converted_duration':{'type':Sequelize[_0xf87d('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xf87d('0x5')]},'converted_bitRate':{'type':Sequelize[_0xf87d('0x6')]},'converted_sampleRate':{'type':Sequelize[_0xf87d('0x5')]}}; \ No newline at end of file +var _0xbb84=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0xf1792c,_0x2d813f){var _0xd75e59=function(_0x5aae93){while(--_0x5aae93){_0xf1792c['push'](_0xf1792c['shift']());}};_0xd75e59(++_0x2d813f);}(_0xbb84,0x199));var _0x4bb8=function(_0x107f10,_0x5529f2){_0x107f10=_0x107f10-0x0;var _0x811cab=_0xbb84[_0x107f10];return _0x811cab;};'use strict';var Sequelize=require(_0x4bb8('0x0'));module[_0x4bb8('0x1')]={'name':{'type':Sequelize[_0x4bb8('0x2')],'unique':_0x4bb8('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4bb8('0x2')]},'display_name':{'type':Sequelize[_0x4bb8('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x4bb8('0x2')]},'original_format':{'type':Sequelize[_0x4bb8('0x2')]},'original_duration':{'type':Sequelize[_0x4bb8('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x4bb8('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x4bb8('0x5')]},'converted_channelCount':{'type':Sequelize[_0x4bb8('0x6')]},'converted_bitRate':{'type':Sequelize[_0x4bb8('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x4bb8('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 7bec7f9..7893721 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 _0x4fbb=['update','destroy','then','get','Sounds','UserProfileResource','end','stack','name','send','index','Sound','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','include','findAll','rows','catch','show','keys','rawAttributes','length','includeAll','options','download','find','params','save_name','converted_format','existsSync','server/files/sounds/converted','Sequelize','ValidationError','join','root','format','%s.%s','create','basename','originalname','file','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','start','description','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x238e37,_0x498228){var _0xa42004=function(_0x205447){while(--_0x205447){_0x238e37['push'](_0x238e37['shift']());}};_0xa42004(++_0x498228);}(_0x4fbb,0xdc));var _0xb4fb=function(_0x37ae2e,_0x35be3a){_0x37ae2e=_0x37ae2e-0x0;var _0x19c50f=_0x4fbb[_0x37ae2e];return _0x19c50f;};'use strict';var emlformat=require(_0xb4fb('0x0'));var rimraf=require(_0xb4fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb4fb('0x2'));var rp=require(_0xb4fb('0x3'));var moment=require(_0xb4fb('0x4'));var BPromise=require(_0xb4fb('0x5'));var Mustache=require(_0xb4fb('0x6'));var util=require(_0xb4fb('0x7'));var path=require(_0xb4fb('0x8'));var sox=require(_0xb4fb('0x9'));var csv=require(_0xb4fb('0xa'));var ejs=require(_0xb4fb('0xb'));var fs=require('fs');var fs_extra=require(_0xb4fb('0xc'));var _=require(_0xb4fb('0xd'));var squel=require(_0xb4fb('0xe'));var crypto=require(_0xb4fb('0xf'));var jsforce=require(_0xb4fb('0x10'));var deskjs=require(_0xb4fb('0x11'));var toCsv=require(_0xb4fb('0xa'));var querystring=require('querystring');var Papa=require(_0xb4fb('0x12'));var Redis=require(_0xb4fb('0x13'));var authService=require(_0xb4fb('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb4fb('0x15'));var hardwareService=require(_0xb4fb('0x16'));var logger=require(_0xb4fb('0x17'))(_0xb4fb('0x18'));var utils=require(_0xb4fb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb4fb('0x1a'));var db=require(_0xb4fb('0x1b'))['db'];function respondWithStatusCode(_0x107b84,_0x414e57){_0x414e57=_0x414e57||0xcc;return function(_0x4ea455){if(_0x4ea455){return _0x107b84[_0xb4fb('0x1c')](_0x414e57);}return _0x107b84[_0xb4fb('0x1d')](_0x414e57)['end']();};}function respondWithResult(_0x40055f,_0x29f8a5){_0x29f8a5=_0x29f8a5||0xc8;return function(_0x430a72){if(_0x430a72){return _0x40055f[_0xb4fb('0x1d')](_0x29f8a5)[_0xb4fb('0x1e')](_0x430a72);}};}function respondWithFilteredResult(_0x4e515b,_0x3cdad1){return function(_0x2a214c){if(_0x2a214c){var _0x1475ce=typeof _0x3cdad1[_0xb4fb('0x1f')]===_0xb4fb('0x20')&&typeof _0x3cdad1[_0xb4fb('0x21')]==='undefined';var _0x5f44cc=_0x2a214c['count'];var _0x2447c9=_0x1475ce?0x0:_0x3cdad1[_0xb4fb('0x1f')];var _0x219269=_0x1475ce?_0x2a214c[_0xb4fb('0x22')]:_0x3cdad1[_0xb4fb('0x1f')]+_0x3cdad1['limit'];var _0x4a674c;if(_0x219269>=_0x5f44cc){_0x219269=_0x5f44cc;_0x4a674c=0xc8;}else{_0x4a674c=0xce;}_0x4e515b[_0xb4fb('0x1d')](_0x4a674c);return _0x4e515b[_0xb4fb('0x23')](_0xb4fb('0x24'),_0x2447c9+'-'+_0x219269+'/'+_0x5f44cc)[_0xb4fb('0x1e')](_0x2a214c);}return null;};}function patchUpdates(_0x44d328){return function(_0x29369c){try{jsonpatch[_0xb4fb('0x25')](_0x29369c,_0x44d328,!![]);}catch(_0x651f15){return BPromise[_0xb4fb('0x26')](_0x651f15);}return _0x29369c[_0xb4fb('0x27')]();};}function saveUpdates(_0x4ddac7,_0x431cea){return function(_0x3be287){if(_0x3be287){return _0x3be287[_0xb4fb('0x28')](_0x4ddac7)['then'](function(_0x5c6722){return _0x5c6722;});}return null;};}function removeEntity(_0x10607e,_0x55ee47){return function(_0x11398a){if(_0x11398a){return _0x11398a[_0xb4fb('0x29')]()[_0xb4fb('0x2a')](function(){var _0x2b9e1c=_0x11398a[_0xb4fb('0x2b')]({'plain':!![]});var _0x42c739=_0xb4fb('0x2c');return db[_0xb4fb('0x2d')][_0xb4fb('0x29')]({'where':{'type':_0x42c739,'resourceId':_0x2b9e1c['id']}})['then'](function(){return _0x11398a;});})[_0xb4fb('0x2a')](function(){_0x10607e[_0xb4fb('0x1d')](0xcc)[_0xb4fb('0x2e')]();});}};}function handleEntityNotFound(_0x400506,_0x1cf5ed){return function(_0x120e47){if(!_0x120e47){_0x400506[_0xb4fb('0x1c')](0x194);}return _0x120e47;};}function handleError(_0x85b56a,_0x30241f){_0x30241f=_0x30241f||0x1f4;return function(_0x2cda27){logger['error'](_0x2cda27[_0xb4fb('0x2f')]);if(_0x2cda27[_0xb4fb('0x30')]){delete _0x2cda27['name'];}_0x85b56a[_0xb4fb('0x1d')](_0x30241f)[_0xb4fb('0x31')](_0x2cda27);};}exports[_0xb4fb('0x32')]=function(_0x4597b9,_0x47518f){var _0x4c8106={},_0x24bd55={},_0x56a64f={'count':0x0,'rows':[]};var _0x10ff64=_['map'](db[_0xb4fb('0x33')]['rawAttributes'],function(_0x1f3cb8){return{'name':_0x1f3cb8[_0xb4fb('0x34')],'type':_0x1f3cb8[_0xb4fb('0x35')][_0xb4fb('0x36')]};});_0x24bd55['model']=_[_0xb4fb('0x37')](_0x10ff64,'name');_0x24bd55[_0xb4fb('0x38')]=_['keys'](_0x4597b9[_0xb4fb('0x38')]);_0x24bd55[_0xb4fb('0x39')]=_[_0xb4fb('0x3a')](_0x24bd55[_0xb4fb('0x3b')],_0x24bd55[_0xb4fb('0x38')]);_0x4c8106[_0xb4fb('0x3c')]=_[_0xb4fb('0x3a')](_0x24bd55[_0xb4fb('0x3b')],qs[_0xb4fb('0x3d')](_0x4597b9[_0xb4fb('0x38')][_0xb4fb('0x3d')]));_0x4c8106[_0xb4fb('0x3c')]=_0x4c8106[_0xb4fb('0x3c')]['length']?_0x4c8106[_0xb4fb('0x3c')]:_0x24bd55[_0xb4fb('0x3b')];if(!_0x4597b9[_0xb4fb('0x38')][_0xb4fb('0x3e')](_0xb4fb('0x3f'))){_0x4c8106[_0xb4fb('0x21')]=qs[_0xb4fb('0x21')](_0x4597b9['query']['limit']);_0x4c8106[_0xb4fb('0x1f')]=qs[_0xb4fb('0x1f')](_0x4597b9[_0xb4fb('0x38')]['offset']);}_0x4c8106['order']=qs['sort'](_0x4597b9[_0xb4fb('0x38')][_0xb4fb('0x40')]);_0x4c8106[_0xb4fb('0x41')]=qs[_0xb4fb('0x39')](_[_0xb4fb('0x42')](_0x4597b9[_0xb4fb('0x38')],_0x24bd55[_0xb4fb('0x39')]),_0x10ff64);if(_0x4597b9[_0xb4fb('0x38')]['filter']){_0x4c8106[_0xb4fb('0x41')]=_[_0xb4fb('0x43')](_0x4c8106[_0xb4fb('0x41')],{'$or':_['map'](_0x10ff64,function(_0x2b02f4){if(_0x2b02f4[_0xb4fb('0x35')]!==_0xb4fb('0x44')){var _0x236ee0={};_0x236ee0[_0x2b02f4[_0xb4fb('0x30')]]={'$like':'%'+_0x4597b9[_0xb4fb('0x38')]['filter']+'%'};return _0x236ee0;}})});}_0x4c8106=_[_0xb4fb('0x43')]({},_0x4c8106,_0x4597b9['options']);var _0x432345={'where':_0x4c8106['where']};return db[_0xb4fb('0x33')][_0xb4fb('0x22')](_0x432345)['then'](function(_0x2e1922){_0x56a64f[_0xb4fb('0x22')]=_0x2e1922;if(_0x4597b9[_0xb4fb('0x38')]['includeAll']){_0x4c8106[_0xb4fb('0x45')]=[{'all':!![]}];}return db[_0xb4fb('0x33')][_0xb4fb('0x46')](_0x4c8106);})[_0xb4fb('0x2a')](function(_0x465eff){_0x56a64f[_0xb4fb('0x47')]=_0x465eff;return _0x56a64f;})['then'](respondWithFilteredResult(_0x47518f,_0x4c8106))[_0xb4fb('0x48')](handleError(_0x47518f,null));};exports[_0xb4fb('0x49')]=function(_0x33453a,_0x968656){var _0x372f74={'raw':!![],'where':{'id':_0x33453a['params']['id']}},_0x5e1d57={};_0x5e1d57['model']=_[_0xb4fb('0x4a')](db[_0xb4fb('0x33')][_0xb4fb('0x4b')]);_0x5e1d57['query']=_[_0xb4fb('0x4a')](_0x33453a['query']);_0x5e1d57[_0xb4fb('0x39')]=_[_0xb4fb('0x3a')](_0x5e1d57[_0xb4fb('0x3b')],_0x5e1d57[_0xb4fb('0x38')]);_0x372f74[_0xb4fb('0x3c')]=_[_0xb4fb('0x3a')](_0x5e1d57[_0xb4fb('0x3b')],qs['fields'](_0x33453a[_0xb4fb('0x38')]['fields']));_0x372f74['attributes']=_0x372f74[_0xb4fb('0x3c')][_0xb4fb('0x4c')]?_0x372f74['attributes']:_0x5e1d57[_0xb4fb('0x3b')];if(_0x33453a[_0xb4fb('0x38')][_0xb4fb('0x4d')]){_0x372f74[_0xb4fb('0x45')]=[{'all':!![]}];}_0x372f74=_[_0xb4fb('0x43')]({},_0x372f74,_0x33453a[_0xb4fb('0x4e')]);return db[_0xb4fb('0x33')]['find'](_0x372f74)[_0xb4fb('0x2a')](handleEntityNotFound(_0x968656,null))[_0xb4fb('0x2a')](respondWithResult(_0x968656,null))[_0xb4fb('0x48')](handleError(_0x968656,null));};exports[_0xb4fb('0x4f')]=function(_0x3f69e6,_0x599894,_0x34ca88){return db[_0xb4fb('0x33')][_0xb4fb('0x50')]({'where':{'id':_0x3f69e6[_0xb4fb('0x51')]['id']},'attributes':[_0xb4fb('0x30'),_0xb4fb('0x52'),_0xb4fb('0x53')],'raw':!![]})[_0xb4fb('0x2a')](handleEntityNotFound(_0x599894,null))['then'](function(_0x4245ab){if(_0x4245ab){if(!fs[_0xb4fb('0x54')](path['join'](config['root'],_0xb4fb('0x55'),_0x4245ab['save_name']+'.'+_0x4245ab['converted_format']))){throw new db[(_0xb4fb('0x56'))][(_0xb4fb('0x57'))]('Sound\x20not\x20found');}return _0x599894[_0xb4fb('0x4f')](path[_0xb4fb('0x58')](config[_0xb4fb('0x59')],_0xb4fb('0x55'),util[_0xb4fb('0x5a')](_0xb4fb('0x5b'),_0x4245ab['save_name'],_0x4245ab[_0xb4fb('0x53')])),util[_0xb4fb('0x5a')](_0xb4fb('0x5b'),_0x4245ab['name'],_0x4245ab[_0xb4fb('0x53')]));}return null;})[_0xb4fb('0x48')](handleError(_0x599894,null));};exports[_0xb4fb('0x5c')]=function(_0x1c2eef,_0x4de2b1,_0x2b381f){var _0x3fc8b0={'name':path[_0xb4fb('0x5d')](_0x1c2eef['file'][_0xb4fb('0x5e')],path['extname'](_0x1c2eef[_0xb4fb('0x5f')]['originalname'])),'save_name':path[_0xb4fb('0x5d')](_0x1c2eef[_0xb4fb('0x5f')][_0xb4fb('0x60')],path[_0xb4fb('0x61')](_0x1c2eef['file']['filename'])),'original_format':path[_0xb4fb('0x61')](_0x1c2eef[_0xb4fb('0x5f')][_0xb4fb('0x5e')])[_0xb4fb('0x62')](0x1),'converted_format':_0xb4fb('0x63')};var _0x418848=path[_0xb4fb('0x58')](config[_0xb4fb('0x59')],_0xb4fb('0x64'),_0x1c2eef[_0xb4fb('0x5f')]['filename']);var _0x4d0ade=path[_0xb4fb('0x58')](config['root'],'server/files/sounds/converted',util['format'](_0xb4fb('0x5b'),path[_0xb4fb('0x5d')](_0x1c2eef[_0xb4fb('0x5f')][_0xb4fb('0x60')],path['extname'](_0x1c2eef[_0xb4fb('0x5f')][_0xb4fb('0x60')])),_0x3fc8b0['converted_format']));logger[_0xb4fb('0x65')]('Sound\x20upload\x20filepath:\x20%s',_0x418848);logger[_0xb4fb('0x65')](_0xb4fb('0x66'),_0x4d0ade);try{fs[_0xb4fb('0x67')](_0x418848,parseInt('0777',0x8));var _0x5757a4=sox[_0xb4fb('0x68')](_0x418848,_0x4d0ade,{'sampleRate':0x1f40,'format':_0xb4fb('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5757a4['on']('error',function(_0x1ca29b){fs[_0xb4fb('0x69')](_0x418848);_0x4de2b1[_0xb4fb('0x1d')](0x1f4)[_0xb4fb('0x31')](_0x1ca29b);});_0x5757a4['on'](_0xb4fb('0x6a'),function(_0x17ba29){_0x3fc8b0[_0xb4fb('0x6b')]=isNaN(_0x17ba29[_0xb4fb('0x6c')])?null:_0x17ba29[_0xb4fb('0x6c')]*0x3e8;_0x3fc8b0[_0xb4fb('0x6d')]=isNaN(_0x17ba29[_0xb4fb('0x6e')])?null:_0x17ba29['sampleCount'];_0x3fc8b0[_0xb4fb('0x6f')]=isNaN(_0x17ba29[_0xb4fb('0x70')])?null:_0x17ba29['channelCount'];_0x3fc8b0[_0xb4fb('0x71')]=isNaN(_0x17ba29[_0xb4fb('0x72')])?null:_0x17ba29[_0xb4fb('0x72')];_0x3fc8b0[_0xb4fb('0x73')]=isNaN(_0x17ba29[_0xb4fb('0x74')])?null:_0x17ba29[_0xb4fb('0x74')];});_0x5757a4['on']('dest',function(_0x1dc9a8){_0x3fc8b0[_0xb4fb('0x75')]=isNaN(_0x1dc9a8['duration'])?null:_0x1dc9a8[_0xb4fb('0x6c')]*0x3e8;_0x3fc8b0[_0xb4fb('0x76')]=isNaN(_0x1dc9a8['sampleCount'])?null:_0x1dc9a8['sampleCount'];_0x3fc8b0[_0xb4fb('0x77')]=isNaN(_0x1dc9a8[_0xb4fb('0x70')])?null:_0x1dc9a8[_0xb4fb('0x70')];_0x3fc8b0[_0xb4fb('0x78')]=isNaN(_0x1dc9a8['bitRate'])?null:_0x1dc9a8[_0xb4fb('0x72')];_0x3fc8b0[_0xb4fb('0x79')]=isNaN(_0x1dc9a8[_0xb4fb('0x74')])?null:_0x1dc9a8['sampleRate'];});_0x5757a4['on'](_0xb4fb('0x2e'),function(){fs['chmodSync'](_0x4d0ade,parseInt('0777',0x8));return db[_0xb4fb('0x33')]['create'](_0x3fc8b0)[_0xb4fb('0x2a')](function(_0x1db443){var _0x5ca0f3={'role':_0x1c2eef[_0xb4fb('0x7a')][_0xb4fb('0x7b')],'userProfileId':_0x1c2eef['body'][_0xb4fb('0x7c')]};if(!_0x5ca0f3)throw new Error(_0xb4fb('0x7d'));if(_0x5ca0f3['role']==='user'){var _0x923a58=_0x1db443[_0xb4fb('0x2b')]({'plain':!![]});return db[_0xb4fb('0x7e')][_0xb4fb('0x50')]({'where':{'name':'Sounds','userProfileId':_0x5ca0f3[_0xb4fb('0x7c')]},'raw':!![]})[_0xb4fb('0x2a')](function(_0x395a57){if(_0x395a57&&_0x395a57['autoAssociation']===0x0){return db[_0xb4fb('0x2d')][_0xb4fb('0x5c')]({'name':_0x923a58[_0xb4fb('0x30')],'resourceId':_0x923a58['id'],'type':_0x395a57[_0xb4fb('0x30')],'sectionId':_0x395a57['id']},{})[_0xb4fb('0x2a')](function(){return _0x1db443;});}else{return _0x1db443;}})[_0xb4fb('0x48')](function(_0xcd71e2){logger[_0xb4fb('0x7f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcd71e2);throw _0xcd71e2;});}return _0x1db443;})[_0xb4fb('0x2a')](respondWithResult(_0x4de2b1,null))[_0xb4fb('0x48')](handleError(_0x4de2b1,null));});_0x5757a4[_0xb4fb('0x80')]();}catch(_0x2a65e5){_0x4de2b1[_0xb4fb('0x1d')](0x1f4)[_0xb4fb('0x31')](_0x2a65e5);}};exports['update']=function(_0x35794d,_0x4f8f0d,_0x5cb2d2){return db[_0xb4fb('0x33')][_0xb4fb('0x50')]({'where':{'id':_0x35794d[_0xb4fb('0x51')]['id']}})['then'](handleEntityNotFound(_0x4f8f0d,null))[_0xb4fb('0x2a')](saveUpdates(_['pick'](_0x35794d['body'],[_0xb4fb('0x30'),_0xb4fb('0x81')]),null))[_0xb4fb('0x2a')](respondWithResult(_0x4f8f0d,null))[_0xb4fb('0x48')](handleError(_0x4f8f0d,null));};exports['delete']=function(_0x389572,_0x5a8388,_0x176f48){return db[_0xb4fb('0x33')][_0xb4fb('0x50')]({'where':{'id':_0x389572['params']['id']}})['then'](function(_0x1467e4){if(_0x1467e4){return _0x1467e4[_0xb4fb('0x29')]();}})[_0xb4fb('0x2a')](function(_0x487ec1){var _0x1935c7=path['join'](config[_0xb4fb('0x59')],_0xb4fb('0x64'),util[_0xb4fb('0x5a')](_0xb4fb('0x5b'),_0x487ec1['save_name'],_0x487ec1['original_format']));var _0x2b0976=path['join'](config[_0xb4fb('0x59')],_0xb4fb('0x55'),util['format'](_0xb4fb('0x5b'),_0x487ec1[_0xb4fb('0x52')],_0x487ec1[_0xb4fb('0x53')]));fs[_0xb4fb('0x69')](_0x1935c7);fs[_0xb4fb('0x69')](_0x2b0976);return _0x487ec1;})[_0xb4fb('0x2a')](function(_0x546100){if(_0x546100){return _0x5a8388['status'](0xcc)[_0xb4fb('0x2e')]();}})['then'](handleEntityNotFound(_0x5a8388,null))[_0xb4fb('0x48')](handleError(_0x5a8388,null));}; \ No newline at end of file +var _0xd4a4=['join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','extname','originalname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','unlinkSync','end','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','options','includeAll','include','params','catch','download','find','save_name','converted_format','existsSync'];(function(_0x2d7c90,_0x4fbb1a){var _0x232071=function(_0x1c3bd6){while(--_0x1c3bd6){_0x2d7c90['push'](_0x2d7c90['shift']());}};_0x232071(++_0x4fbb1a);}(_0xd4a4,0x11b));var _0x4d4a=function(_0x33331a,_0x5dd74d){_0x33331a=_0x33331a-0x0;var _0x264e26=_0xd4a4[_0x33331a];return _0x264e26;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d4a('0x0'));var zipdir=require(_0x4d4a('0x1'));var jsonpatch=require(_0x4d4a('0x2'));var rp=require(_0x4d4a('0x3'));var moment=require('moment');var BPromise=require(_0x4d4a('0x4'));var Mustache=require('mustache');var util=require(_0x4d4a('0x5'));var path=require(_0x4d4a('0x6'));var sox=require(_0x4d4a('0x7'));var csv=require(_0x4d4a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d4a('0x9'));var _=require('lodash');var squel=require(_0x4d4a('0xa'));var crypto=require('crypto');var jsforce=require(_0x4d4a('0xb'));var deskjs=require(_0x4d4a('0xc'));var toCsv=require(_0x4d4a('0x8'));var querystring=require('querystring');var Papa=require(_0x4d4a('0xd'));var Redis=require(_0x4d4a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4d4a('0xf'));var as=require(_0x4d4a('0x10'));var hardwareService=require(_0x4d4a('0x11'));var logger=require(_0x4d4a('0x12'))(_0x4d4a('0x13'));var utils=require(_0x4d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4d4a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5f46,_0x479f75){_0x479f75=_0x479f75||0xcc;return function(_0x5d5f6b){if(_0x5d5f6b){return _0x5e5f46[_0x4d4a('0x16')](_0x479f75);}return _0x5e5f46[_0x4d4a('0x17')](_0x479f75)['end']();};}function respondWithResult(_0x2abcca,_0x44bcbb){_0x44bcbb=_0x44bcbb||0xc8;return function(_0x509746){if(_0x509746){return _0x2abcca[_0x4d4a('0x17')](_0x44bcbb)[_0x4d4a('0x18')](_0x509746);}};}function respondWithFilteredResult(_0x41d9c6,_0x1b20cf){return function(_0x1eadf2){if(_0x1eadf2){var _0x401bf2=typeof _0x1b20cf[_0x4d4a('0x19')]===_0x4d4a('0x1a')&&typeof _0x1b20cf['limit']===_0x4d4a('0x1a');var _0x108482=_0x1eadf2[_0x4d4a('0x1b')];var _0x5cbc1d=_0x401bf2?0x0:_0x1b20cf[_0x4d4a('0x19')];var _0x2422de=_0x401bf2?_0x1eadf2[_0x4d4a('0x1b')]:_0x1b20cf['offset']+_0x1b20cf[_0x4d4a('0x1c')];var _0x4b8f77;if(_0x2422de>=_0x108482){_0x2422de=_0x108482;_0x4b8f77=0xc8;}else{_0x4b8f77=0xce;}_0x41d9c6[_0x4d4a('0x17')](_0x4b8f77);return _0x41d9c6[_0x4d4a('0x1d')]('Content-Range',_0x5cbc1d+'-'+_0x2422de+'/'+_0x108482)['json'](_0x1eadf2);}return null;};}function patchUpdates(_0x5501c6){return function(_0x5e21cc){try{jsonpatch['apply'](_0x5e21cc,_0x5501c6,!![]);}catch(_0x587084){return BPromise[_0x4d4a('0x1e')](_0x587084);}return _0x5e21cc[_0x4d4a('0x1f')]();};}function saveUpdates(_0x55c205,_0x100398){return function(_0x59d0ff){if(_0x59d0ff){return _0x59d0ff[_0x4d4a('0x20')](_0x55c205)[_0x4d4a('0x21')](function(_0x205b41){return _0x205b41;});}return null;};}function removeEntity(_0x535041,_0x46ab7b){return function(_0x11ae04){if(_0x11ae04){return _0x11ae04[_0x4d4a('0x22')]()['then'](function(){var _0x3fc1d4=_0x11ae04['get']({'plain':!![]});var _0x4a1f49='Sounds';return db[_0x4d4a('0x23')]['destroy']({'where':{'type':_0x4a1f49,'resourceId':_0x3fc1d4['id']}})[_0x4d4a('0x21')](function(){return _0x11ae04;});})[_0x4d4a('0x21')](function(){_0x535041[_0x4d4a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a2957,_0x3afba0){return function(_0x145102){if(!_0x145102){_0x3a2957['sendStatus'](0x194);}return _0x145102;};}function handleError(_0x4bf907,_0x59da49){_0x59da49=_0x59da49||0x1f4;return function(_0x4b03bc){logger[_0x4d4a('0x24')](_0x4b03bc[_0x4d4a('0x25')]);if(_0x4b03bc[_0x4d4a('0x26')]){delete _0x4b03bc[_0x4d4a('0x26')];}_0x4bf907[_0x4d4a('0x17')](_0x59da49)[_0x4d4a('0x27')](_0x4b03bc);};}exports[_0x4d4a('0x28')]=function(_0x336f59,_0x1fef47){var _0x4b4cdb={},_0x3dfcfd={},_0x30f11d={'count':0x0,'rows':[]};var _0xb64d3=_[_0x4d4a('0x29')](db[_0x4d4a('0x2a')][_0x4d4a('0x2b')],function(_0x1bd98c){return{'name':_0x1bd98c['fieldName'],'type':_0x1bd98c['type'][_0x4d4a('0x2c')]};});_0x3dfcfd['model']=_['map'](_0xb64d3,_0x4d4a('0x26'));_0x3dfcfd['query']=_[_0x4d4a('0x2d')](_0x336f59[_0x4d4a('0x2e')]);_0x3dfcfd[_0x4d4a('0x2f')]=_['intersection'](_0x3dfcfd[_0x4d4a('0x30')],_0x3dfcfd[_0x4d4a('0x2e')]);_0x4b4cdb[_0x4d4a('0x31')]=_[_0x4d4a('0x32')](_0x3dfcfd['model'],qs[_0x4d4a('0x33')](_0x336f59[_0x4d4a('0x2e')][_0x4d4a('0x33')]));_0x4b4cdb[_0x4d4a('0x31')]=_0x4b4cdb[_0x4d4a('0x31')][_0x4d4a('0x34')]?_0x4b4cdb['attributes']:_0x3dfcfd['model'];if(!_0x336f59[_0x4d4a('0x2e')][_0x4d4a('0x35')](_0x4d4a('0x36'))){_0x4b4cdb[_0x4d4a('0x1c')]=qs[_0x4d4a('0x1c')](_0x336f59[_0x4d4a('0x2e')][_0x4d4a('0x1c')]);_0x4b4cdb[_0x4d4a('0x19')]=qs[_0x4d4a('0x19')](_0x336f59[_0x4d4a('0x2e')][_0x4d4a('0x19')]);}_0x4b4cdb['order']=qs[_0x4d4a('0x37')](_0x336f59[_0x4d4a('0x2e')][_0x4d4a('0x37')]);_0x4b4cdb[_0x4d4a('0x38')]=qs[_0x4d4a('0x2f')](_['pick'](_0x336f59['query'],_0x3dfcfd[_0x4d4a('0x2f')]),_0xb64d3);if(_0x336f59[_0x4d4a('0x2e')]['filter']){_0x4b4cdb['where']=_['merge'](_0x4b4cdb['where'],{'$or':_[_0x4d4a('0x29')](_0xb64d3,function(_0x36cd77){if(_0x36cd77['type']!=='VIRTUAL'){var _0x2b13cf={};_0x2b13cf[_0x36cd77[_0x4d4a('0x26')]]={'$like':'%'+_0x336f59['query']['filter']+'%'};return _0x2b13cf;}})});}_0x4b4cdb=_[_0x4d4a('0x39')]({},_0x4b4cdb,_0x336f59[_0x4d4a('0x3a')]);var _0x5065ef={'where':_0x4b4cdb[_0x4d4a('0x38')]};return db['Sound']['count'](_0x5065ef)[_0x4d4a('0x21')](function(_0x38ed64){_0x30f11d[_0x4d4a('0x1b')]=_0x38ed64;if(_0x336f59[_0x4d4a('0x2e')][_0x4d4a('0x3b')]){_0x4b4cdb[_0x4d4a('0x3c')]=[{'all':!![]}];}return db[_0x4d4a('0x2a')]['findAll'](_0x4b4cdb);})['then'](function(_0x2e0291){_0x30f11d['rows']=_0x2e0291;return _0x30f11d;})['then'](respondWithFilteredResult(_0x1fef47,_0x4b4cdb))['catch'](handleError(_0x1fef47,null));};exports['show']=function(_0x43230a,_0x1a07fe){var _0x2c0f4d={'raw':!![],'where':{'id':_0x43230a[_0x4d4a('0x3d')]['id']}},_0xbe1025={};_0xbe1025[_0x4d4a('0x30')]=_['keys'](db['Sound']['rawAttributes']);_0xbe1025[_0x4d4a('0x2e')]=_[_0x4d4a('0x2d')](_0x43230a[_0x4d4a('0x2e')]);_0xbe1025[_0x4d4a('0x2f')]=_[_0x4d4a('0x32')](_0xbe1025['model'],_0xbe1025[_0x4d4a('0x2e')]);_0x2c0f4d[_0x4d4a('0x31')]=_[_0x4d4a('0x32')](_0xbe1025[_0x4d4a('0x30')],qs[_0x4d4a('0x33')](_0x43230a[_0x4d4a('0x2e')]['fields']));_0x2c0f4d[_0x4d4a('0x31')]=_0x2c0f4d[_0x4d4a('0x31')][_0x4d4a('0x34')]?_0x2c0f4d[_0x4d4a('0x31')]:_0xbe1025[_0x4d4a('0x30')];if(_0x43230a[_0x4d4a('0x2e')][_0x4d4a('0x3b')]){_0x2c0f4d[_0x4d4a('0x3c')]=[{'all':!![]}];}_0x2c0f4d=_[_0x4d4a('0x39')]({},_0x2c0f4d,_0x43230a['options']);return db[_0x4d4a('0x2a')]['find'](_0x2c0f4d)[_0x4d4a('0x21')](handleEntityNotFound(_0x1a07fe,null))[_0x4d4a('0x21')](respondWithResult(_0x1a07fe,null))[_0x4d4a('0x3e')](handleError(_0x1a07fe,null));};exports[_0x4d4a('0x3f')]=function(_0x56aa3f,_0x30efe4,_0x363606){return db[_0x4d4a('0x2a')][_0x4d4a('0x40')]({'where':{'id':_0x56aa3f[_0x4d4a('0x3d')]['id']},'attributes':[_0x4d4a('0x26'),_0x4d4a('0x41'),_0x4d4a('0x42')],'raw':!![]})[_0x4d4a('0x21')](handleEntityNotFound(_0x30efe4,null))[_0x4d4a('0x21')](function(_0x148416){if(_0x148416){if(!fs[_0x4d4a('0x43')](path[_0x4d4a('0x44')](config[_0x4d4a('0x45')],_0x4d4a('0x46'),_0x148416[_0x4d4a('0x41')]+'.'+_0x148416[_0x4d4a('0x42')]))){throw new db[(_0x4d4a('0x47'))][(_0x4d4a('0x48'))](_0x4d4a('0x49'));}return _0x30efe4[_0x4d4a('0x3f')](path[_0x4d4a('0x44')](config['root'],'server/files/sounds/converted',util[_0x4d4a('0x4a')](_0x4d4a('0x4b'),_0x148416['save_name'],_0x148416[_0x4d4a('0x42')])),util['format'](_0x4d4a('0x4b'),_0x148416[_0x4d4a('0x26')],_0x148416[_0x4d4a('0x42')]));}return null;})[_0x4d4a('0x3e')](handleError(_0x30efe4,null));};exports[_0x4d4a('0x4c')]=function(_0x21a73d,_0x512776,_0xcef454){var _0x30e194={'name':path[_0x4d4a('0x4d')](_0x21a73d[_0x4d4a('0x4e')]['originalname'],path[_0x4d4a('0x4f')](_0x21a73d[_0x4d4a('0x4e')][_0x4d4a('0x50')])),'save_name':path[_0x4d4a('0x4d')](_0x21a73d[_0x4d4a('0x4e')]['filename'],path[_0x4d4a('0x4f')](_0x21a73d[_0x4d4a('0x4e')][_0x4d4a('0x51')])),'original_format':path[_0x4d4a('0x4f')](_0x21a73d[_0x4d4a('0x4e')]['originalname'])['substring'](0x1),'converted_format':_0x4d4a('0x52')};var _0x3ab397=path[_0x4d4a('0x44')](config['root'],_0x4d4a('0x53'),_0x21a73d[_0x4d4a('0x4e')][_0x4d4a('0x51')]);var _0x35715b=path[_0x4d4a('0x44')](config[_0x4d4a('0x45')],_0x4d4a('0x46'),util[_0x4d4a('0x4a')]('%s.%s',path[_0x4d4a('0x4d')](_0x21a73d[_0x4d4a('0x4e')][_0x4d4a('0x51')],path[_0x4d4a('0x4f')](_0x21a73d['file']['filename'])),_0x30e194[_0x4d4a('0x42')]));logger[_0x4d4a('0x54')]('Sound\x20upload\x20filepath:\x20%s',_0x3ab397);logger[_0x4d4a('0x54')](_0x4d4a('0x55'),_0x35715b);try{fs[_0x4d4a('0x56')](_0x3ab397,parseInt(_0x4d4a('0x57'),0x8));var _0x55a0be=sox[_0x4d4a('0x58')](_0x3ab397,_0x35715b,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x55a0be['on'](_0x4d4a('0x24'),function(_0x7596ec){fs['unlinkSync'](_0x3ab397);_0x512776[_0x4d4a('0x17')](0x1f4)['send'](_0x7596ec);});_0x55a0be['on'](_0x4d4a('0x59'),function(_0x15fa23){_0x30e194[_0x4d4a('0x5a')]=isNaN(_0x15fa23[_0x4d4a('0x5b')])?null:_0x15fa23[_0x4d4a('0x5b')]*0x3e8;_0x30e194[_0x4d4a('0x5c')]=isNaN(_0x15fa23[_0x4d4a('0x5d')])?null:_0x15fa23[_0x4d4a('0x5d')];_0x30e194['original_channelCount']=isNaN(_0x15fa23[_0x4d4a('0x5e')])?null:_0x15fa23['channelCount'];_0x30e194['original_bitRate']=isNaN(_0x15fa23[_0x4d4a('0x5f')])?null:_0x15fa23['bitRate'];_0x30e194['original_sampleRate']=isNaN(_0x15fa23[_0x4d4a('0x60')])?null:_0x15fa23[_0x4d4a('0x60')];});_0x55a0be['on'](_0x4d4a('0x61'),function(_0x512180){_0x30e194[_0x4d4a('0x62')]=isNaN(_0x512180[_0x4d4a('0x5b')])?null:_0x512180[_0x4d4a('0x5b')]*0x3e8;_0x30e194['converted_sampleCount']=isNaN(_0x512180['sampleCount'])?null:_0x512180[_0x4d4a('0x5d')];_0x30e194[_0x4d4a('0x63')]=isNaN(_0x512180[_0x4d4a('0x5e')])?null:_0x512180[_0x4d4a('0x5e')];_0x30e194[_0x4d4a('0x64')]=isNaN(_0x512180[_0x4d4a('0x5f')])?null:_0x512180['bitRate'];_0x30e194['converted_sampleRate']=isNaN(_0x512180[_0x4d4a('0x60')])?null:_0x512180['sampleRate'];});_0x55a0be['on']('end',function(){fs['chmodSync'](_0x35715b,parseInt(_0x4d4a('0x57'),0x8));return db[_0x4d4a('0x2a')][_0x4d4a('0x4c')](_0x30e194)[_0x4d4a('0x21')](function(_0x16d001){var _0x2a0477={'role':_0x21a73d[_0x4d4a('0x65')][_0x4d4a('0x66')],'userProfileId':_0x21a73d['body'][_0x4d4a('0x67')]};if(!_0x2a0477)throw new Error(_0x4d4a('0x68'));if(_0x2a0477[_0x4d4a('0x66')]===_0x4d4a('0x69')){var _0x46237b=_0x16d001[_0x4d4a('0x6a')]({'plain':!![]});return db[_0x4d4a('0x6b')][_0x4d4a('0x40')]({'where':{'name':'Sounds','userProfileId':_0x2a0477[_0x4d4a('0x67')]},'raw':!![]})['then'](function(_0x5a3362){if(_0x5a3362&&_0x5a3362[_0x4d4a('0x6c')]===0x0){return db[_0x4d4a('0x23')][_0x4d4a('0x4c')]({'name':_0x46237b[_0x4d4a('0x26')],'resourceId':_0x46237b['id'],'type':_0x5a3362[_0x4d4a('0x26')],'sectionId':_0x5a3362['id']},{})[_0x4d4a('0x21')](function(){return _0x16d001;});}else{return _0x16d001;}})['catch'](function(_0x16ce47){logger[_0x4d4a('0x24')](_0x4d4a('0x6d'),_0x16ce47);throw _0x16ce47;});}return _0x16d001;})['then'](respondWithResult(_0x512776,null))['catch'](handleError(_0x512776,null));});_0x55a0be[_0x4d4a('0x6e')]();}catch(_0x2a3909){_0x512776[_0x4d4a('0x17')](0x1f4)[_0x4d4a('0x27')](_0x2a3909);}};exports['update']=function(_0x395ab2,_0xc6ac1,_0x5e74a0){return db[_0x4d4a('0x2a')][_0x4d4a('0x40')]({'where':{'id':_0x395ab2[_0x4d4a('0x3d')]['id']}})['then'](handleEntityNotFound(_0xc6ac1,null))[_0x4d4a('0x21')](saveUpdates(_[_0x4d4a('0x6f')](_0x395ab2[_0x4d4a('0x65')],[_0x4d4a('0x26'),_0x4d4a('0x70')]),null))['then'](respondWithResult(_0xc6ac1,null))['catch'](handleError(_0xc6ac1,null));};exports[_0x4d4a('0x71')]=function(_0x6f5b01,_0x3b76a8,_0x5b3933){return db[_0x4d4a('0x2a')]['find']({'where':{'id':_0x6f5b01[_0x4d4a('0x3d')]['id']}})[_0x4d4a('0x21')](function(_0x31b6ab){if(_0x31b6ab){return _0x31b6ab[_0x4d4a('0x22')]();}})[_0x4d4a('0x21')](function(_0x1ca043){var _0x997585=path[_0x4d4a('0x44')](config[_0x4d4a('0x45')],_0x4d4a('0x53'),util['format']('%s.%s',_0x1ca043[_0x4d4a('0x41')],_0x1ca043[_0x4d4a('0x72')]));var _0x5ba9e3=path[_0x4d4a('0x44')](config[_0x4d4a('0x45')],_0x4d4a('0x46'),util[_0x4d4a('0x4a')]('%s.%s',_0x1ca043[_0x4d4a('0x41')],_0x1ca043[_0x4d4a('0x42')]));fs[_0x4d4a('0x73')](_0x997585);fs['unlinkSync'](_0x5ba9e3);return _0x1ca043;})[_0x4d4a('0x21')](function(_0x3aef24){if(_0x3aef24){return _0x3b76a8[_0x4d4a('0x17')](0xcc)[_0x4d4a('0x74')]();}})[_0x4d4a('0x21')](handleEntityNotFound(_0x3b76a8,null))[_0x4d4a('0x3e')](handleError(_0x3b76a8,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 7cb206b..e3da42e 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 _0x6b64=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','util'];(function(_0x1dbbdb,_0x390cd3){var _0x57cea2=function(_0x4229c1){while(--_0x4229c1){_0x1dbbdb['push'](_0x1dbbdb['shift']());}};_0x57cea2(++_0x390cd3);}(_0x6b64,0x1af));var _0x46b6=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0x6b64[_0x117f4c];return _0x2b24e9;};'use strict';var _=require('lodash');var util=require(_0x46b6('0x0'));var logger=require(_0x46b6('0x1'))(_0x46b6('0x2'));var moment=require(_0x46b6('0x3'));var BPromise=require('bluebird');var rp=require(_0x46b6('0x4'));var fs=require('fs');var path=require(_0x46b6('0x5'));var rimraf=require(_0x46b6('0x6'));var config=require(_0x46b6('0x7'));var attributes=require(_0x46b6('0x8'));module[_0x46b6('0x9')]=function(_0x226136,_0x45d594){return _0x226136[_0x46b6('0xa')](_0x46b6('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe73b=['../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','api','moment','bluebird','request-promise','path'];(function(_0x478d93,_0x1e986e){var _0x26aef7=function(_0x4ba75d){while(--_0x4ba75d){_0x478d93['push'](_0x478d93['shift']());}};_0x26aef7(++_0x1e986e);}(_0xe73b,0x1ce));var _0xbe73=function(_0x41648f,_0x4a8936){_0x41648f=_0x41648f-0x0;var _0x20340a=_0xe73b[_0x41648f];return _0x20340a;};'use strict';var _=require('lodash');var util=require(_0xbe73('0x0'));var logger=require('../../config/logger')(_0xbe73('0x1'));var moment=require(_0xbe73('0x2'));var BPromise=require(_0xbe73('0x3'));var rp=require(_0xbe73('0x4'));var fs=require('fs');var path=require(_0xbe73('0x5'));var rimraf=require('rimraf');var config=require(_0xbe73('0x6'));var attributes=require(_0xbe73('0x7'));module[_0xbe73('0x8')]=function(_0x234e40,_0x299b4e){return _0x234e40[_0xbe73('0x9')](_0xbe73('0xa'),attributes,{'tableName':_0xbe73('0xb'),'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 9a808c1..9d2f0db 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 _0x503f=['map','include','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSound','Sound','options','raw','attributes'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x503f,0xff));var _0xf503=function(_0x3f4d77,_0x4759a0){_0x3f4d77=_0x3f4d77-0x0;var _0x4073dc=_0x503f[_0x3f4d77];return _0x4073dc;};'use strict';var _=require('lodash');var util=require(_0xf503('0x0'));var moment=require('moment');var BPromise=require(_0xf503('0x1'));var rs=require(_0xf503('0x2'));var fs=require('fs');var Redis=require(_0xf503('0x3'));var db=require(_0xf503('0x4'))['db'];var utils=require(_0xf503('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf503('0x6'));var jayson=require(_0xf503('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x535dfb,_0x486701,_0x5e0415){return new BPromise(function(_0x5216f9,_0x4e954d){return client[_0xf503('0x8')](_0x535dfb,_0x5e0415)[_0xf503('0x9')](function(_0x3bd2cb){logger[_0xf503('0xa')](_0xf503('0xb'),_0x486701,_0xf503('0xc'));logger[_0xf503('0xd')](_0xf503('0xe'),_0x486701,_0xf503('0xc'),JSON[_0xf503('0xf')](_0x3bd2cb));if(_0x3bd2cb[_0xf503('0x10')]){if(_0x3bd2cb[_0xf503('0x10')]['code']===0x1f4){logger[_0xf503('0x10')](_0xf503('0xb'),_0x486701,_0x3bd2cb[_0xf503('0x10')][_0xf503('0x11')]);return _0x4e954d(_0x3bd2cb[_0xf503('0x10')]['message']);}logger['error'](_0xf503('0xb'),_0x486701,_0x3bd2cb[_0xf503('0x10')][_0xf503('0x11')]);return _0x5216f9(_0x3bd2cb[_0xf503('0x10')][_0xf503('0x11')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x486701,_0xf503('0xc'));_0x5216f9(_0x3bd2cb[_0xf503('0x12')]['message']);}})[_0xf503('0x13')](function(_0x5a7eca){logger[_0xf503('0x10')](_0xf503('0xb'),_0x486701,_0x5a7eca);_0x4e954d(_0x5a7eca);});});}exports[_0xf503('0x14')]=function(_0x3860fe){var _0x18dc38=this;return new Promise(function(_0x12c032,_0xe782ec){return db[_0xf503('0x15')]['find']({'raw':_0x3860fe[_0xf503('0x16')]?_0x3860fe[_0xf503('0x16')][_0xf503('0x17')]===undefined?!![]:![]:!![],'where':_0x3860fe[_0xf503('0x16')]?_0x3860fe[_0xf503('0x16')]['where']||null:null,'attributes':_0x3860fe[_0xf503('0x16')]?_0x3860fe['options'][_0xf503('0x18')]||null:null,'include':_0x3860fe[_0xf503('0x16')]?_0x3860fe[_0xf503('0x16')]['include']?_[_0xf503('0x19')](_0x3860fe[_0xf503('0x16')][_0xf503('0x1a')],function(_0x570a28){return{'model':db[_0x570a28[_0xf503('0x1b')]],'as':_0x570a28['as'],'attributes':_0x570a28['attributes'],'include':_0x570a28[_0xf503('0x1a')]?_[_0xf503('0x19')](_0x570a28['include'],function(_0x547bfa){return{'model':db[_0x547bfa[_0xf503('0x1b')]],'as':_0x547bfa['as'],'attributes':_0x547bfa[_0xf503('0x18')],'include':_0x547bfa[_0xf503('0x1a')]?_['map'](_0x547bfa[_0xf503('0x1a')],function(_0x159f71){return{'model':db[_0x159f71[_0xf503('0x1b')]],'as':_0x159f71['as'],'attributes':_0x159f71[_0xf503('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf503('0x9')](function(_0x5ad3b7){logger['info']('ShowSound',_0x3860fe);logger['debug'](_0xf503('0x14'),_0x3860fe,JSON[_0xf503('0xf')](_0x5ad3b7));_0x12c032(_0x5ad3b7);})['catch'](function(_0x4875ab){logger[_0xf503('0x10')](_0xf503('0x14'),_0x4875ab['message'],_0x3860fe);_0xe782ec(_0x18dc38[_0xf503('0x10')](0x1f4,_0x4875ab[_0xf503('0x11')]));});});}; \ No newline at end of file +var _0x950f=['rpc','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2c4d22,_0x4ca120){var _0x1f0537=function(_0x2374a9){while(--_0x2374a9){_0x2c4d22['push'](_0x2c4d22['shift']());}};_0x1f0537(++_0x4ca120);}(_0x950f,0x94));var _0xf950=function(_0x1492bd,_0x1ad636){_0x1492bd=_0x1492bd-0x0;var _0x317259=_0x950f[_0x1492bd];return _0x317259;};'use strict';var _=require(_0xf950('0x0'));var util=require(_0xf950('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf950('0x2'));var fs=require('fs');var Redis=require(_0xf950('0x3'));var db=require(_0xf950('0x4'))['db'];var utils=require(_0xf950('0x5'));var logger=require(_0xf950('0x6'))(_0xf950('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf950('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e4515,_0x255c68,_0x32d2ae){return new BPromise(function(_0x44c895,_0x4a00d6){return client[_0xf950('0x9')](_0x1e4515,_0x32d2ae)[_0xf950('0xa')](function(_0x3a22fc){logger[_0xf950('0xb')](_0xf950('0xc'),_0x255c68,_0xf950('0xd'));logger[_0xf950('0xe')](_0xf950('0xf'),_0x255c68,'request\x20sent',JSON['stringify'](_0x3a22fc));if(_0x3a22fc[_0xf950('0x10')]){if(_0x3a22fc[_0xf950('0x10')][_0xf950('0x11')]===0x1f4){logger[_0xf950('0x10')](_0xf950('0xc'),_0x255c68,_0x3a22fc[_0xf950('0x10')][_0xf950('0x12')]);return _0x4a00d6(_0x3a22fc[_0xf950('0x10')][_0xf950('0x12')]);}logger[_0xf950('0x10')]('Sound,\x20%s,\x20%s',_0x255c68,_0x3a22fc['error'][_0xf950('0x12')]);return _0x44c895(_0x3a22fc[_0xf950('0x10')][_0xf950('0x12')]);}else{logger[_0xf950('0xb')]('Sound,\x20%s,\x20%s',_0x255c68,'request\x20sent');_0x44c895(_0x3a22fc[_0xf950('0x13')][_0xf950('0x12')]);}})[_0xf950('0x14')](function(_0x1c4845){logger[_0xf950('0x10')](_0xf950('0xc'),_0x255c68,_0x1c4845);_0x4a00d6(_0x1c4845);});});}exports[_0xf950('0x15')]=function(_0x5e15ed){var _0x35db4c=this;return new Promise(function(_0x5e4a72,_0x314f5e){return db[_0xf950('0x16')][_0xf950('0x17')]({'raw':_0x5e15ed[_0xf950('0x18')]?_0x5e15ed['options'][_0xf950('0x19')]===undefined?!![]:![]:!![],'where':_0x5e15ed[_0xf950('0x18')]?_0x5e15ed[_0xf950('0x18')]['where']||null:null,'attributes':_0x5e15ed['options']?_0x5e15ed[_0xf950('0x18')][_0xf950('0x1a')]||null:null,'include':_0x5e15ed[_0xf950('0x18')]?_0x5e15ed[_0xf950('0x18')][_0xf950('0x1b')]?_[_0xf950('0x1c')](_0x5e15ed[_0xf950('0x18')][_0xf950('0x1b')],function(_0x4abec2){return{'model':db[_0x4abec2['model']],'as':_0x4abec2['as'],'attributes':_0x4abec2['attributes'],'include':_0x4abec2[_0xf950('0x1b')]?_['map'](_0x4abec2[_0xf950('0x1b')],function(_0x2502f2){return{'model':db[_0x2502f2[_0xf950('0x1d')]],'as':_0x2502f2['as'],'attributes':_0x2502f2['attributes'],'include':_0x2502f2['include']?_['map'](_0x2502f2[_0xf950('0x1b')],function(_0xf9b876){return{'model':db[_0xf9b876['model']],'as':_0xf9b876['as'],'attributes':_0xf9b876['attributes']};}):[]};}):[]};}):[]:[]})[_0xf950('0xa')](function(_0x8a5c69){logger[_0xf950('0xb')](_0xf950('0x15'),_0x5e15ed);logger[_0xf950('0xe')](_0xf950('0x15'),_0x5e15ed,JSON[_0xf950('0x1e')](_0x8a5c69));_0x5e4a72(_0x8a5c69);})[_0xf950('0x14')](function(_0x1048f2){logger[_0xf950('0x10')](_0xf950('0x15'),_0x1048f2[_0xf950('0x12')],_0x5e15ed);_0x314f5e(_0x35db4c['error'](0x1f4,_0x1048f2[_0xf950('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 84eb43a..9e48c8d 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 _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0x8603,0x190));var _0x3860=function(_0x454546,_0x144f1a){_0x454546=_0x454546-0x0;var _0x4bc707=_0x8603[_0x454546];return _0x4bc707;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file +var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x389f2b,_0x4dc398){var _0x3ea9d3=function(_0x5a276f){while(--_0x5a276f){_0x389f2b['push'](_0x389f2b['shift']());}};_0x3ea9d3(++_0x4dc398);}(_0xb10b,0x12a));var _0xbb10=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0xb10b[_0x37d0bc];return _0x170e60;};'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('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index b4921ea..10e9455 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 _0x656e=['out','TEXT','sequelize','exports','STRING','ENUM'];(function(_0x59923b,_0x3b510c){var _0x2b786c=function(_0xc1e09c){while(--_0xc1e09c){_0x59923b['push'](_0x59923b['shift']());}};_0x2b786c(++_0x3b510c);}(_0x656e,0x194));var _0xe656=function(_0x560546,_0x25f996){_0x560546=_0x560546-0x0;var _0x5318d8=_0x656e[_0x560546];return _0x5318d8;};'use strict';var Sequelize=require(_0xe656('0x0'));module[_0xe656('0x1')]={'uniqueid':{'type':Sequelize[_0xe656('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xe656('0x3')]('in',_0xe656('0x4')),'defaultValue':_0xe656('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe656('0x2')]},'providerResponse':{'type':Sequelize[_0xe656('0x5')]}}; \ No newline at end of file +var _0x7fe0=['sequelize','STRING','TEXT','ENUM','out'];(function(_0x4b36c1,_0x4346b0){var _0xb650e3=function(_0x2e51b0){while(--_0x2e51b0){_0x4b36c1['push'](_0x4b36c1['shift']());}};_0xb650e3(++_0x4346b0);}(_0x7fe0,0x159));var _0x07fe=function(_0x17f0e7,_0x364326){_0x17f0e7=_0x17f0e7-0x0;var _0x337879=_0x7fe0[_0x17f0e7];return _0x337879;};'use strict';var Sequelize=require(_0x07fe('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x07fe('0x1')]},'body':{'type':Sequelize[_0x07fe('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x07fe('0x3')]('in',_0x07fe('0x4')),'defaultValue':_0x07fe('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x07fe('0x1')]},'providerResponse':{'type':Sequelize[_0x07fe('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 3973d1a..6024357 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 _0x3f72=['stack','name','index','map','SquareMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','length','create','body','find','params','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','update','then','error'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x3f72,0xaf));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x23f7('0x0'));var rimraf=require(_0x23f7('0x1'));var zipdir=require(_0x23f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x23f7('0x3'));var BPromise=require(_0x23f7('0x4'));var Mustache=require(_0x23f7('0x5'));var util=require(_0x23f7('0x6'));var path=require(_0x23f7('0x7'));var sox=require('sox');var csv=require(_0x23f7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x23f7('0x9'));var _=require('lodash');var squel=require(_0x23f7('0xa'));var crypto=require(_0x23f7('0xb'));var jsforce=require(_0x23f7('0xc'));var deskjs=require(_0x23f7('0xd'));var toCsv=require(_0x23f7('0x8'));var querystring=require(_0x23f7('0xe'));var Papa=require(_0x23f7('0xf'));var Redis=require(_0x23f7('0x10'));var authService=require(_0x23f7('0x11'));var qs=require(_0x23f7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23f7('0x13'));var logger=require(_0x23f7('0x14'))(_0x23f7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x23f7('0x16'));var db=require(_0x23f7('0x17'))['db'];function respondWithStatusCode(_0x35c62e,_0x304748){_0x304748=_0x304748||0xcc;return function(_0x37510b){if(_0x37510b){return _0x35c62e['sendStatus'](_0x304748);}return _0x35c62e[_0x23f7('0x18')](_0x304748)[_0x23f7('0x19')]();};}function respondWithResult(_0x2dc34c,_0x39ac2d){_0x39ac2d=_0x39ac2d||0xc8;return function(_0x594887){if(_0x594887){return _0x2dc34c[_0x23f7('0x18')](_0x39ac2d)[_0x23f7('0x1a')](_0x594887);}};}function respondWithFilteredResult(_0x1c88ce,_0x2fab15){return function(_0x15a35d){if(_0x15a35d){var _0x436512=typeof _0x2fab15[_0x23f7('0x1b')]==='undefined'&&typeof _0x2fab15[_0x23f7('0x1c')]===_0x23f7('0x1d');var _0x4e125c=_0x15a35d['count'];var _0x10d8d2=_0x436512?0x0:_0x2fab15[_0x23f7('0x1b')];var _0x2f8f6a=_0x436512?_0x15a35d[_0x23f7('0x1e')]:_0x2fab15[_0x23f7('0x1b')]+_0x2fab15[_0x23f7('0x1c')];var _0x3748bb;if(_0x2f8f6a>=_0x4e125c){_0x2f8f6a=_0x4e125c;_0x3748bb=0xc8;}else{_0x3748bb=0xce;}_0x1c88ce[_0x23f7('0x18')](_0x3748bb);return _0x1c88ce['set'](_0x23f7('0x1f'),_0x10d8d2+'-'+_0x2f8f6a+'/'+_0x4e125c)[_0x23f7('0x1a')](_0x15a35d);}return null;};}function patchUpdates(_0x1811bf){return function(_0x5e8b7f){try{jsonpatch['apply'](_0x5e8b7f,_0x1811bf,!![]);}catch(_0xfc8726){return BPromise['reject'](_0xfc8726);}return _0x5e8b7f['save']();};}function saveUpdates(_0x1f82d4,_0x34a5e4){return function(_0x5441e2){if(_0x5441e2){return _0x5441e2[_0x23f7('0x20')](_0x1f82d4)[_0x23f7('0x21')](function(_0x59260b){return _0x59260b;});}return null;};}function removeEntity(_0x2333ca,_0x373421){return function(_0x3ebc73){if(_0x3ebc73){return _0x3ebc73['destroy']()['then'](function(){_0x2333ca[_0x23f7('0x18')](0xcc)[_0x23f7('0x19')]();});}};}function handleEntityNotFound(_0x3dad05,_0x4861de){return function(_0x26bdf6){if(!_0x26bdf6){_0x3dad05['sendStatus'](0x194);}return _0x26bdf6;};}function handleError(_0x23dd01,_0x1cc5e4){_0x1cc5e4=_0x1cc5e4||0x1f4;return function(_0x57d6e6){logger[_0x23f7('0x22')](_0x57d6e6[_0x23f7('0x23')]);if(_0x57d6e6[_0x23f7('0x24')]){delete _0x57d6e6[_0x23f7('0x24')];}_0x23dd01[_0x23f7('0x18')](_0x1cc5e4)['send'](_0x57d6e6);};}exports[_0x23f7('0x25')]=function(_0x2422d2,_0x310fa8){var _0x45513e={},_0x4165ed={},_0x3669fc={'count':0x0,'rows':[]};var _0x77d50f=_[_0x23f7('0x26')](db[_0x23f7('0x27')][_0x23f7('0x28')],function(_0xf0da88){return{'name':_0xf0da88[_0x23f7('0x29')],'type':_0xf0da88['type'][_0x23f7('0x2a')]};});_0x4165ed[_0x23f7('0x2b')]=_[_0x23f7('0x26')](_0x77d50f,'name');_0x4165ed[_0x23f7('0x2c')]=_[_0x23f7('0x2d')](_0x2422d2[_0x23f7('0x2c')]);_0x4165ed[_0x23f7('0x2e')]=_[_0x23f7('0x2f')](_0x4165ed[_0x23f7('0x2b')],_0x4165ed['query']);_0x45513e[_0x23f7('0x30')]=_[_0x23f7('0x2f')](_0x4165ed[_0x23f7('0x2b')],qs[_0x23f7('0x31')](_0x2422d2[_0x23f7('0x2c')][_0x23f7('0x31')]));_0x45513e[_0x23f7('0x30')]=_0x45513e[_0x23f7('0x30')]['length']?_0x45513e[_0x23f7('0x30')]:_0x4165ed[_0x23f7('0x2b')];if(!_0x2422d2[_0x23f7('0x2c')][_0x23f7('0x32')]('nolimit')){_0x45513e['limit']=qs[_0x23f7('0x1c')](_0x2422d2['query'][_0x23f7('0x1c')]);_0x45513e[_0x23f7('0x1b')]=qs[_0x23f7('0x1b')](_0x2422d2[_0x23f7('0x2c')]['offset']);}_0x45513e['order']=qs[_0x23f7('0x33')](_0x2422d2['query']['sort']);_0x45513e[_0x23f7('0x34')]=qs[_0x23f7('0x2e')](_[_0x23f7('0x35')](_0x2422d2[_0x23f7('0x2c')],_0x4165ed[_0x23f7('0x2e')]),_0x77d50f);if(_0x2422d2[_0x23f7('0x2c')][_0x23f7('0x36')]){_0x45513e[_0x23f7('0x34')]=_['merge'](_0x45513e[_0x23f7('0x34')],{'$or':_[_0x23f7('0x26')](_0x77d50f,function(_0x42a3c5){if(_0x42a3c5[_0x23f7('0x37')]!==_0x23f7('0x38')){var _0x8db080={};_0x8db080[_0x42a3c5['name']]={'$like':'%'+_0x2422d2['query'][_0x23f7('0x36')]+'%'};return _0x8db080;}})});}_0x45513e=_[_0x23f7('0x39')]({},_0x45513e,_0x2422d2[_0x23f7('0x3a')]);var _0x37cd61={'where':_0x45513e[_0x23f7('0x34')]};return db[_0x23f7('0x27')]['count'](_0x37cd61)[_0x23f7('0x21')](function(_0x1d852d){_0x3669fc[_0x23f7('0x1e')]=_0x1d852d;if(_0x2422d2[_0x23f7('0x2c')][_0x23f7('0x3b')]){_0x45513e[_0x23f7('0x3c')]=[{'all':!![]}];}return db[_0x23f7('0x27')][_0x23f7('0x3d')](_0x45513e);})['then'](function(_0x5e2b2d){_0x3669fc['rows']=_0x5e2b2d;return _0x3669fc;})[_0x23f7('0x21')](respondWithFilteredResult(_0x310fa8,_0x45513e))[_0x23f7('0x3e')](handleError(_0x310fa8,null));};exports[_0x23f7('0x3f')]=function(_0x36ce93,_0x272bac){var _0x25aaf6={'raw':!![],'where':{'id':_0x36ce93['params']['id']}},_0x4092b3={};_0x4092b3[_0x23f7('0x2b')]=_[_0x23f7('0x2d')](db[_0x23f7('0x27')][_0x23f7('0x28')]);_0x4092b3[_0x23f7('0x2c')]=_[_0x23f7('0x2d')](_0x36ce93['query']);_0x4092b3[_0x23f7('0x2e')]=_[_0x23f7('0x2f')](_0x4092b3['model'],_0x4092b3[_0x23f7('0x2c')]);_0x25aaf6[_0x23f7('0x30')]=_[_0x23f7('0x2f')](_0x4092b3[_0x23f7('0x2b')],qs['fields'](_0x36ce93[_0x23f7('0x2c')][_0x23f7('0x31')]));_0x25aaf6[_0x23f7('0x30')]=_0x25aaf6[_0x23f7('0x30')][_0x23f7('0x40')]?_0x25aaf6['attributes']:_0x4092b3[_0x23f7('0x2b')];if(_0x36ce93[_0x23f7('0x2c')][_0x23f7('0x3b')]){_0x25aaf6[_0x23f7('0x3c')]=[{'all':!![]}];}_0x25aaf6=_['merge']({},_0x25aaf6,_0x36ce93[_0x23f7('0x3a')]);return db[_0x23f7('0x27')]['find'](_0x25aaf6)[_0x23f7('0x21')](handleEntityNotFound(_0x272bac,null))['then'](respondWithResult(_0x272bac,null))[_0x23f7('0x3e')](handleError(_0x272bac,null));};exports['create']=function(_0x439d18,_0x5553e8){return db[_0x23f7('0x27')][_0x23f7('0x41')](_0x439d18[_0x23f7('0x42')],{})[_0x23f7('0x21')](respondWithResult(_0x5553e8,0xc9))[_0x23f7('0x3e')](handleError(_0x5553e8,null));};exports['update']=function(_0x3066f9,_0x3cc29c){if(_0x3066f9[_0x23f7('0x42')]['id']){delete _0x3066f9['body']['id'];}return db[_0x23f7('0x27')][_0x23f7('0x43')]({'where':{'id':_0x3066f9[_0x23f7('0x44')]['id']}})[_0x23f7('0x21')](handleEntityNotFound(_0x3cc29c,null))[_0x23f7('0x21')](saveUpdates(_0x3066f9[_0x23f7('0x42')],null))[_0x23f7('0x21')](respondWithResult(_0x3cc29c,null))['catch'](handleError(_0x3cc29c,null));};exports[_0x23f7('0x45')]=function(_0x1a5a4f,_0x226810){return db['SquareMessage'][_0x23f7('0x43')]({'where':{'id':_0x1a5a4f[_0x23f7('0x44')]['id']}})[_0x23f7('0x21')](handleEntityNotFound(_0x226810,null))[_0x23f7('0x21')](removeEntity(_0x226810,null))[_0x23f7('0x3e')](handleError(_0x226810,null));}; \ No newline at end of file +var _0x2c64=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','map','SquareMessage','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','include','rows','show','params','includeAll','merge','find','catch','create','body','eml-format'];(function(_0x1e8a01,_0x58cae4){var _0x28d520=function(_0x70e48){while(--_0x70e48){_0x1e8a01['push'](_0x1e8a01['shift']());}};_0x28d520(++_0x58cae4);}(_0x2c64,0x1bb));var _0x42c6=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x2c64[_0x4b7895];return _0x264180;};'use strict';var emlformat=require(_0x42c6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42c6('0x1'));var rp=require(_0x42c6('0x2'));var moment=require('moment');var BPromise=require(_0x42c6('0x3'));var Mustache=require(_0x42c6('0x4'));var util=require(_0x42c6('0x5'));var path=require(_0x42c6('0x6'));var sox=require(_0x42c6('0x7'));var csv=require(_0x42c6('0x8'));var ejs=require(_0x42c6('0x9'));var fs=require('fs');var fs_extra=require(_0x42c6('0xa'));var _=require(_0x42c6('0xb'));var squel=require(_0x42c6('0xc'));var crypto=require(_0x42c6('0xd'));var jsforce=require(_0x42c6('0xe'));var deskjs=require(_0x42c6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x42c6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x42c6('0x11'));var qs=require(_0x42c6('0x12'));var as=require(_0x42c6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x42c6('0x14'))(_0x42c6('0x15'));var utils=require(_0x42c6('0x16'));var config=require(_0x42c6('0x17'));var licenseUtil=require(_0x42c6('0x18'));var db=require(_0x42c6('0x19'))['db'];function respondWithStatusCode(_0x1a4c74,_0x16a9ac){_0x16a9ac=_0x16a9ac||0xcc;return function(_0x8867e5){if(_0x8867e5){return _0x1a4c74[_0x42c6('0x1a')](_0x16a9ac);}return _0x1a4c74[_0x42c6('0x1b')](_0x16a9ac)[_0x42c6('0x1c')]();};}function respondWithResult(_0x12666a,_0x20cbca){_0x20cbca=_0x20cbca||0xc8;return function(_0x1d6ddf){if(_0x1d6ddf){return _0x12666a[_0x42c6('0x1b')](_0x20cbca)[_0x42c6('0x1d')](_0x1d6ddf);}};}function respondWithFilteredResult(_0x1d458e,_0x354abc){return function(_0x16358b){if(_0x16358b){var _0x5bf801=typeof _0x354abc[_0x42c6('0x1e')]===_0x42c6('0x1f')&&typeof _0x354abc['limit']===_0x42c6('0x1f');var _0x1f63d1=_0x16358b[_0x42c6('0x20')];var _0x469576=_0x5bf801?0x0:_0x354abc['offset'];var _0x48a0c5=_0x5bf801?_0x16358b[_0x42c6('0x20')]:_0x354abc[_0x42c6('0x1e')]+_0x354abc[_0x42c6('0x21')];var _0x24d66d;if(_0x48a0c5>=_0x1f63d1){_0x48a0c5=_0x1f63d1;_0x24d66d=0xc8;}else{_0x24d66d=0xce;}_0x1d458e[_0x42c6('0x1b')](_0x24d66d);return _0x1d458e['set'](_0x42c6('0x22'),_0x469576+'-'+_0x48a0c5+'/'+_0x1f63d1)[_0x42c6('0x1d')](_0x16358b);}return null;};}function patchUpdates(_0x2a22be){return function(_0x2de44d){try{jsonpatch['apply'](_0x2de44d,_0x2a22be,!![]);}catch(_0x4d6195){return BPromise[_0x42c6('0x23')](_0x4d6195);}return _0x2de44d[_0x42c6('0x24')]();};}function saveUpdates(_0x3503bf,_0x3bae07){return function(_0x233676){if(_0x233676){return _0x233676[_0x42c6('0x25')](_0x3503bf)[_0x42c6('0x26')](function(_0x458db7){return _0x458db7;});}return null;};}function removeEntity(_0x456648,_0x93f01d){return function(_0x3ba420){if(_0x3ba420){return _0x3ba420[_0x42c6('0x27')]()['then'](function(){_0x456648[_0x42c6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x370260,_0xed9749){return function(_0xe943d7){if(!_0xe943d7){_0x370260[_0x42c6('0x1a')](0x194);}return _0xe943d7;};}function handleError(_0xc1e64b,_0x3f7bf2){_0x3f7bf2=_0x3f7bf2||0x1f4;return function(_0x2110f0){logger['error'](_0x2110f0[_0x42c6('0x28')]);if(_0x2110f0['name']){delete _0x2110f0[_0x42c6('0x29')];}_0xc1e64b[_0x42c6('0x1b')](_0x3f7bf2)[_0x42c6('0x2a')](_0x2110f0);};}exports['index']=function(_0x2bc4bb,_0x5124b6){var _0x140cf5={},_0x3677e1={},_0x35eee9={'count':0x0,'rows':[]};var _0x2c6bfd=_[_0x42c6('0x2b')](db[_0x42c6('0x2c')]['rawAttributes'],function(_0x4bb8b6){return{'name':_0x4bb8b6[_0x42c6('0x2d')],'type':_0x4bb8b6[_0x42c6('0x2e')][_0x42c6('0x2f')]};});_0x3677e1[_0x42c6('0x30')]=_[_0x42c6('0x2b')](_0x2c6bfd,'name');_0x3677e1[_0x42c6('0x31')]=_[_0x42c6('0x32')](_0x2bc4bb[_0x42c6('0x31')]);_0x3677e1[_0x42c6('0x33')]=_['intersection'](_0x3677e1[_0x42c6('0x30')],_0x3677e1['query']);_0x140cf5[_0x42c6('0x34')]=_[_0x42c6('0x35')](_0x3677e1[_0x42c6('0x30')],qs[_0x42c6('0x36')](_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x36')]));_0x140cf5[_0x42c6('0x34')]=_0x140cf5[_0x42c6('0x34')][_0x42c6('0x37')]?_0x140cf5[_0x42c6('0x34')]:_0x3677e1['model'];if(!_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x38')](_0x42c6('0x39'))){_0x140cf5['limit']=qs[_0x42c6('0x21')](_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x21')]);_0x140cf5[_0x42c6('0x1e')]=qs['offset'](_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x1e')]);}_0x140cf5[_0x42c6('0x3a')]=qs['sort'](_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x3b')]);_0x140cf5[_0x42c6('0x3c')]=qs[_0x42c6('0x33')](_[_0x42c6('0x3d')](_0x2bc4bb[_0x42c6('0x31')],_0x3677e1['filters']),_0x2c6bfd);if(_0x2bc4bb[_0x42c6('0x31')]['filter']){_0x140cf5['where']=_['merge'](_0x140cf5[_0x42c6('0x3c')],{'$or':_['map'](_0x2c6bfd,function(_0x4485c2){if(_0x4485c2['type']!==_0x42c6('0x3e')){var _0x565a22={};_0x565a22[_0x4485c2['name']]={'$like':'%'+_0x2bc4bb['query'][_0x42c6('0x3f')]+'%'};return _0x565a22;}})});}_0x140cf5=_['merge']({},_0x140cf5,_0x2bc4bb['options']);var _0x54032d={'where':_0x140cf5['where']};return db[_0x42c6('0x2c')][_0x42c6('0x20')](_0x54032d)[_0x42c6('0x26')](function(_0x1a328b){_0x35eee9[_0x42c6('0x20')]=_0x1a328b;if(_0x2bc4bb[_0x42c6('0x31')]['includeAll']){_0x140cf5[_0x42c6('0x40')]=[{'all':!![]}];}return db[_0x42c6('0x2c')]['findAll'](_0x140cf5);})[_0x42c6('0x26')](function(_0x4dda02){_0x35eee9[_0x42c6('0x41')]=_0x4dda02;return _0x35eee9;})['then'](respondWithFilteredResult(_0x5124b6,_0x140cf5))['catch'](handleError(_0x5124b6,null));};exports[_0x42c6('0x42')]=function(_0x27a8b9,_0x4eefec){var _0xc9a6b6={'raw':!![],'where':{'id':_0x27a8b9[_0x42c6('0x43')]['id']}},_0x55c29b={};_0x55c29b[_0x42c6('0x30')]=_[_0x42c6('0x32')](db['SquareMessage']['rawAttributes']);_0x55c29b[_0x42c6('0x31')]=_[_0x42c6('0x32')](_0x27a8b9[_0x42c6('0x31')]);_0x55c29b[_0x42c6('0x33')]=_[_0x42c6('0x35')](_0x55c29b[_0x42c6('0x30')],_0x55c29b[_0x42c6('0x31')]);_0xc9a6b6[_0x42c6('0x34')]=_[_0x42c6('0x35')](_0x55c29b['model'],qs[_0x42c6('0x36')](_0x27a8b9[_0x42c6('0x31')][_0x42c6('0x36')]));_0xc9a6b6[_0x42c6('0x34')]=_0xc9a6b6[_0x42c6('0x34')][_0x42c6('0x37')]?_0xc9a6b6[_0x42c6('0x34')]:_0x55c29b[_0x42c6('0x30')];if(_0x27a8b9[_0x42c6('0x31')][_0x42c6('0x44')]){_0xc9a6b6['include']=[{'all':!![]}];}_0xc9a6b6=_[_0x42c6('0x45')]({},_0xc9a6b6,_0x27a8b9['options']);return db[_0x42c6('0x2c')][_0x42c6('0x46')](_0xc9a6b6)[_0x42c6('0x26')](handleEntityNotFound(_0x4eefec,null))[_0x42c6('0x26')](respondWithResult(_0x4eefec,null))[_0x42c6('0x47')](handleError(_0x4eefec,null));};exports[_0x42c6('0x48')]=function(_0x544836,_0x4e5539){return db[_0x42c6('0x2c')][_0x42c6('0x48')](_0x544836[_0x42c6('0x49')],{})[_0x42c6('0x26')](respondWithResult(_0x4e5539,0xc9))['catch'](handleError(_0x4e5539,null));};exports[_0x42c6('0x25')]=function(_0x5c5e01,_0x43bf6d){if(_0x5c5e01[_0x42c6('0x49')]['id']){delete _0x5c5e01[_0x42c6('0x49')]['id'];}return db[_0x42c6('0x2c')][_0x42c6('0x46')]({'where':{'id':_0x5c5e01[_0x42c6('0x43')]['id']}})[_0x42c6('0x26')](handleEntityNotFound(_0x43bf6d,null))['then'](saveUpdates(_0x5c5e01[_0x42c6('0x49')],null))[_0x42c6('0x26')](respondWithResult(_0x43bf6d,null))['catch'](handleError(_0x43bf6d,null));};exports[_0x42c6('0x27')]=function(_0x226507,_0x47e533){return db[_0x42c6('0x2c')][_0x42c6('0x46')]({'where':{'id':_0x226507['params']['id']}})[_0x42c6('0x26')](handleEntityNotFound(_0x47e533,null))[_0x42c6('0x26')](removeEntity(_0x47e533,null))['catch'](handleError(_0x47e533,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index cd86377..e638692 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 _0xc289=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','../../config/logger'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0xc289,0x7c));var _0x9c28=function(_0x4dab69,_0x5b51d1){_0x4dab69=_0x4dab69-0x0;var _0xfdaa9c=_0xc289[_0x4dab69];return _0xfdaa9c;};'use strict';var _=require(_0x9c28('0x0'));var util=require('util');var logger=require(_0x9c28('0x1'))(_0x9c28('0x2'));var moment=require(_0x9c28('0x3'));var BPromise=require(_0x9c28('0x4'));var rp=require(_0x9c28('0x5'));var fs=require('fs');var path=require(_0x9c28('0x6'));var rimraf=require(_0x9c28('0x7'));var config=require(_0x9c28('0x8'));var attributes=require(_0x9c28('0x9'));module[_0x9c28('0xa')]=function(_0x55faca,_0xf051c){return _0x55faca[_0x9c28('0xb')](_0x9c28('0xc'),attributes,{'tableName':_0x9c28('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1796=['exports','define','SquareMessage','square_messages','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1b2a16,_0x2bbfb2){var _0x8f57c0=function(_0x112bae){while(--_0x112bae){_0x1b2a16['push'](_0x1b2a16['shift']());}};_0x8f57c0(++_0x2bbfb2);}(_0x1796,0xbf));var _0x6179=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x1796[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x6179('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6179('0x1'));var moment=require(_0x6179('0x2'));var BPromise=require(_0x6179('0x3'));var rp=require(_0x6179('0x4'));var fs=require('fs');var path=require(_0x6179('0x5'));var rimraf=require('rimraf');var config=require(_0x6179('0x6'));var attributes=require('./squareMessage.attributes');module[_0x6179('0x7')]=function(_0x179581,_0x10f357){return _0x179581[_0x6179('0x8')](_0x6179('0x9'),attributes,{'tableName':_0x6179('0xa'),'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 e3bcad6..210b68b 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 _0xbcd6=['SquareMessage','create','body','options','raw','stringify','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateSquareMessage'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0xbcd6,0x1c0));var _0x6bcd=function(_0x27c194,_0xedf3fa){_0x27c194=_0x27c194-0x0;var _0x451015=_0xbcd6[_0x27c194];return _0x451015;};'use strict';var _=require(_0x6bcd('0x0'));var util=require('util');var moment=require(_0x6bcd('0x1'));var BPromise=require('bluebird');var rs=require(_0x6bcd('0x2'));var fs=require('fs');var Redis=require(_0x6bcd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6bcd('0x4'));var logger=require(_0x6bcd('0x5'))(_0x6bcd('0x6'));var config=require(_0x6bcd('0x7'));var jayson=require(_0x6bcd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23c362,_0x4429ec,_0x167fc5){return new BPromise(function(_0x10fd58,_0x5dfb9c){return client['request'](_0x23c362,_0x167fc5)[_0x6bcd('0x9')](function(_0x5ee5ee){logger[_0x6bcd('0xa')](_0x6bcd('0xb'),_0x4429ec,_0x6bcd('0xc'));logger[_0x6bcd('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4429ec,_0x6bcd('0xc'),JSON['stringify'](_0x5ee5ee));if(_0x5ee5ee[_0x6bcd('0xe')]){if(_0x5ee5ee[_0x6bcd('0xe')][_0x6bcd('0xf')]===0x1f4){logger[_0x6bcd('0xe')](_0x6bcd('0xb'),_0x4429ec,_0x5ee5ee[_0x6bcd('0xe')][_0x6bcd('0x10')]);return _0x5dfb9c(_0x5ee5ee[_0x6bcd('0xe')][_0x6bcd('0x10')]);}logger[_0x6bcd('0xe')](_0x6bcd('0xb'),_0x4429ec,_0x5ee5ee['error'][_0x6bcd('0x10')]);return _0x10fd58(_0x5ee5ee[_0x6bcd('0xe')][_0x6bcd('0x10')]);}else{logger[_0x6bcd('0xa')](_0x6bcd('0xb'),_0x4429ec,'request\x20sent');_0x10fd58(_0x5ee5ee[_0x6bcd('0x11')]['message']);}})[_0x6bcd('0x12')](function(_0x3c3d50){logger[_0x6bcd('0xe')](_0x6bcd('0xb'),_0x4429ec,_0x3c3d50);_0x5dfb9c(_0x3c3d50);});});}exports[_0x6bcd('0x13')]=function(_0x144cca){var _0x59301c=this;return new Promise(function(_0x5a5ee6,_0x4e645c){return db[_0x6bcd('0x14')][_0x6bcd('0x15')](_0x144cca[_0x6bcd('0x16')],{'raw':_0x144cca['options']?_0x144cca[_0x6bcd('0x17')][_0x6bcd('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3a5481){logger[_0x6bcd('0xa')](_0x6bcd('0x13'),_0x144cca);logger[_0x6bcd('0xd')]('CreateSquareMessage',_0x144cca,JSON[_0x6bcd('0x19')](_0x3a5481));_0x5a5ee6(_0x3a5481);})[_0x6bcd('0x12')](function(_0x4426d1){logger[_0x6bcd('0xe')](_0x6bcd('0x13'),_0x4426d1['message'],_0x144cca);_0x4e645c(_0x59301c[_0x6bcd('0xe')](0x1f4,_0x4426d1[_0x6bcd('0x10')]));});});}; \ No newline at end of file +var _0x29fc=['SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareMessage','SquareMessage','body','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x26ae09,_0x147574){var _0xf18c09=function(_0x1d952f){while(--_0x1d952f){_0x26ae09['push'](_0x26ae09['shift']());}};_0xf18c09(++_0x147574);}(_0x29fc,0xbb));var _0xc29f=function(_0x339f27,_0x149cce){_0x339f27=_0x339f27-0x0;var _0x588848=_0x29fc[_0x339f27];return _0x588848;};'use strict';var _=require(_0xc29f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc29f('0x1'));var rs=require(_0xc29f('0x2'));var fs=require('fs');var Redis=require(_0xc29f('0x3'));var db=require(_0xc29f('0x4'))['db'];var utils=require(_0xc29f('0x5'));var logger=require('../../config/logger')(_0xc29f('0x6'));var config=require(_0xc29f('0x7'));var jayson=require(_0xc29f('0x8'));var client=jayson['client'][_0xc29f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a366e,_0x7a56c5,_0x1913a4){return new BPromise(function(_0x229555,_0x3ab314){return client[_0xc29f('0xa')](_0x1a366e,_0x1913a4)[_0xc29f('0xb')](function(_0x867711){logger[_0xc29f('0xc')](_0xc29f('0xd'),_0x7a56c5,_0xc29f('0xe'));logger[_0xc29f('0xf')](_0xc29f('0x10'),_0x7a56c5,_0xc29f('0xe'),JSON['stringify'](_0x867711));if(_0x867711['error']){if(_0x867711[_0xc29f('0x11')][_0xc29f('0x12')]===0x1f4){logger[_0xc29f('0x11')](_0xc29f('0xd'),_0x7a56c5,_0x867711['error'][_0xc29f('0x13')]);return _0x3ab314(_0x867711['error'][_0xc29f('0x13')]);}logger[_0xc29f('0x11')](_0xc29f('0xd'),_0x7a56c5,_0x867711[_0xc29f('0x11')][_0xc29f('0x13')]);return _0x229555(_0x867711['error'][_0xc29f('0x13')]);}else{logger[_0xc29f('0xc')](_0xc29f('0xd'),_0x7a56c5,'request\x20sent');_0x229555(_0x867711['result']['message']);}})[_0xc29f('0x14')](function(_0x5c1a45){logger[_0xc29f('0x11')](_0xc29f('0xd'),_0x7a56c5,_0x5c1a45);_0x3ab314(_0x5c1a45);});});}exports[_0xc29f('0x15')]=function(_0x4a75de){var _0x47fb24=this;return new Promise(function(_0x46726f,_0x53c0db){return db[_0xc29f('0x16')]['create'](_0x4a75de[_0xc29f('0x17')],{'raw':_0x4a75de['options']?_0x4a75de['options']['raw']===undefined?!![]:![]:!![]})[_0xc29f('0xb')](function(_0x4b789d){logger[_0xc29f('0xc')](_0xc29f('0x15'),_0x4a75de);logger[_0xc29f('0xf')](_0xc29f('0x15'),_0x4a75de,JSON[_0xc29f('0x18')](_0x4b789d));_0x46726f(_0x4b789d);})[_0xc29f('0x14')](function(_0x1be0b5){logger[_0xc29f('0x11')]('CreateSquareMessage',_0x1be0b5[_0xc29f('0x13')],_0x4a75de);_0x53c0db(_0x47fb24[_0xc29f('0x11')](0x1f4,_0x1be0b5[_0xc29f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index d14570d..1e0a240 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 _0x5648=['isAuthenticated','15s','test','post','put','/:id','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','index'];(function(_0x2017fe,_0x3e5598){var _0x46ac2b=function(_0x40673a){while(--_0x40673a){_0x2017fe['push'](_0x2017fe['shift']());}};_0x46ac2b(++_0x3e5598);}(_0x5648,0x14d));var _0x8564=function(_0x1d2e11,_0x38fc4f){_0x1d2e11=_0x1d2e11-0x0;var _0x5e9bb0=_0x5648[_0x1d2e11];return _0x5e9bb0;};'use strict';var multer=require('multer');var util=require(_0x8564('0x0'));var path=require('path');var timeout=require(_0x8564('0x1'));var express=require(_0x8564('0x2'));var router=express['Router']();var fs_extra=require(_0x8564('0x3'));var auth=require(_0x8564('0x4'));var interaction=require(_0x8564('0x5'));var config=require('../../config/environment');var controller=require(_0x8564('0x6'));router[_0x8564('0x7')]('/',auth['isAuthenticated'](),controller[_0x8564('0x8')]);router[_0x8564('0x7')]('/:id',auth[_0x8564('0x9')](),controller['show']);router[_0x8564('0x7')]('/:id/test',auth[_0x8564('0x9')](),timeout(_0x8564('0xa')),controller[_0x8564('0xb')]);router[_0x8564('0xc')]('/',auth[_0x8564('0x9')](),controller['create']);router[_0x8564('0xd')](_0x8564('0xe'),auth['isAuthenticated'](),controller[_0x8564('0xf')]);router[_0x8564('0x10')](_0x8564('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x8564('0x11')]=router; \ No newline at end of file +var _0x993e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','get','/:id/test','15s','test','post','create','/:id','delete','destroy','exports','multer'];(function(_0xda924f,_0xb613f6){var _0x1241f4=function(_0x165981){while(--_0x165981){_0xda924f['push'](_0xda924f['shift']());}};_0x1241f4(++_0xb613f6);}(_0x993e,0x8b));var _0xe993=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x993e[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe993('0x0'));var util=require('util');var path=require(_0xe993('0x1'));var timeout=require('connect-timeout');var express=require(_0xe993('0x2'));var router=express[_0xe993('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe993('0x4'));var interaction=require(_0xe993('0x5'));var config=require(_0xe993('0x6'));var controller=require('./squareOdbc.controller');router['get']('/',auth[_0xe993('0x7')](),controller[_0xe993('0x8')]);router['get']('/:id',auth[_0xe993('0x7')](),controller[_0xe993('0x9')]);router[_0xe993('0xa')](_0xe993('0xb'),auth[_0xe993('0x7')](),timeout(_0xe993('0xc')),controller[_0xe993('0xd')]);router[_0xe993('0xe')]('/',auth[_0xe993('0x7')](),controller[_0xe993('0xf')]);router['put'](_0xe993('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xe993('0x11')](_0xe993('0x10'),auth[_0xe993('0x7')](),controller[_0xe993('0x12')]);module[_0xe993('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index fe25738..5069097 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 _0x65b6=['name','sequelize','exports','STRING'];(function(_0x18c28a,_0x173c42){var _0x4745fe=function(_0x2d4e72){while(--_0x2d4e72){_0x18c28a['push'](_0x18c28a['shift']());}};_0x4745fe(++_0x173c42);}(_0x65b6,0xa9));var _0x665b=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0x65b6[_0x126f47];return _0x49508a;};'use strict';var Sequelize=require(_0x665b('0x0'));module[_0x665b('0x1')]={'name':{'type':Sequelize[_0x665b('0x2')],'unique':_0x665b('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x665b('0x2')]},'description':{'type':Sequelize[_0x665b('0x2')]}}; \ No newline at end of file +var _0x798f=['name','sequelize','exports','STRING'];(function(_0x4c35ca,_0x3abfd6){var _0x22688e=function(_0x5cb33f){while(--_0x5cb33f){_0x4c35ca['push'](_0x4c35ca['shift']());}};_0x22688e(++_0x3abfd6);}(_0x798f,0x6d));var _0xf798=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x798f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf798('0x0'));module[_0xf798('0x1')]={'name':{'type':Sequelize[_0xf798('0x2')],'unique':_0xf798('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf798('0x2')]},'description':{'type':Sequelize[_0xf798('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0841b38..91d1bd6 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 _0xf17c=['json','apply','reject','then','destroy','get','UserProfileResource','end','error','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareOdbc','includeAll','rows','catch','show','params','include','find','create','user','role','ODBC','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set'];(function(_0xb3beb1,_0x4a5118){var _0xd1f8e9=function(_0x23c485){while(--_0x23c485){_0xb3beb1['push'](_0xb3beb1['shift']());}};_0xd1f8e9(++_0x4a5118);}(_0xf17c,0x83));var _0xcf17=function(_0x3e5ccd,_0x1d0046){_0x3e5ccd=_0x3e5ccd-0x0;var _0xeb807e=_0xf17c[_0x3e5ccd];return _0xeb807e;};'use strict';var emlformat=require(_0xcf17('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf17('0x1'));var rp=require(_0xcf17('0x2'));var moment=require(_0xcf17('0x3'));var BPromise=require(_0xcf17('0x4'));var Mustache=require('mustache');var util=require(_0xcf17('0x5'));var path=require(_0xcf17('0x6'));var sox=require(_0xcf17('0x7'));var csv=require(_0xcf17('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf17('0x9'));var _=require('lodash');var squel=require(_0xcf17('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcf17('0x8'));var querystring=require(_0xcf17('0xb'));var Papa=require('papaparse');var Redis=require(_0xcf17('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xcf17('0xd'));var as=require(_0xcf17('0xe'));var hardwareService=require(_0xcf17('0xf'));var logger=require('../../config/logger')(_0xcf17('0x10'));var utils=require(_0xcf17('0x11'));var config=require(_0xcf17('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf17('0x13'))['db'];function respondWithStatusCode(_0x434b8d,_0x1131f7){_0x1131f7=_0x1131f7||0xcc;return function(_0x13d51f){if(_0x13d51f){return _0x434b8d[_0xcf17('0x14')](_0x1131f7);}return _0x434b8d['status'](_0x1131f7)['end']();};}function respondWithResult(_0x59b7a3,_0x82b0d1){_0x82b0d1=_0x82b0d1||0xc8;return function(_0x2bdf54){if(_0x2bdf54){return _0x59b7a3[_0xcf17('0x15')](_0x82b0d1)['json'](_0x2bdf54);}};}function respondWithFilteredResult(_0x3b487a,_0x56e8ee){return function(_0x12c625){if(_0x12c625){var _0x12a4cb=typeof _0x56e8ee[_0xcf17('0x16')]==='undefined'&&typeof _0x56e8ee[_0xcf17('0x17')]===_0xcf17('0x18');var _0x78e5ff=_0x12c625[_0xcf17('0x19')];var _0x1c8af2=_0x12a4cb?0x0:_0x56e8ee[_0xcf17('0x16')];var _0x29e66b=_0x12a4cb?_0x12c625[_0xcf17('0x19')]:_0x56e8ee[_0xcf17('0x16')]+_0x56e8ee['limit'];var _0x43eb05;if(_0x29e66b>=_0x78e5ff){_0x29e66b=_0x78e5ff;_0x43eb05=0xc8;}else{_0x43eb05=0xce;}_0x3b487a[_0xcf17('0x15')](_0x43eb05);return _0x3b487a[_0xcf17('0x1a')]('Content-Range',_0x1c8af2+'-'+_0x29e66b+'/'+_0x78e5ff)[_0xcf17('0x1b')](_0x12c625);}return null;};}function patchUpdates(_0x3a80c2){return function(_0x4baf11){try{jsonpatch[_0xcf17('0x1c')](_0x4baf11,_0x3a80c2,!![]);}catch(_0x378d4a){return BPromise[_0xcf17('0x1d')](_0x378d4a);}return _0x4baf11['save']();};}function saveUpdates(_0x5311c3,_0x2a69fd){return function(_0x17f335){if(_0x17f335){return _0x17f335['update'](_0x5311c3)[_0xcf17('0x1e')](function(_0x26ff82){return _0x26ff82;});}return null;};}function removeEntity(_0x27b324,_0xdcf62c){return function(_0x45f5aa){if(_0x45f5aa){return _0x45f5aa[_0xcf17('0x1f')]()[_0xcf17('0x1e')](function(){var _0x48bc44=_0x45f5aa[_0xcf17('0x20')]({'plain':!![]});var _0x34f380='ODBC';return db[_0xcf17('0x21')]['destroy']({'where':{'type':_0x34f380,'resourceId':_0x48bc44['id']}})[_0xcf17('0x1e')](function(){return _0x45f5aa;});})[_0xcf17('0x1e')](function(){_0x27b324[_0xcf17('0x15')](0xcc)[_0xcf17('0x22')]();});}};}function handleEntityNotFound(_0x5de865,_0x4ff60a){return function(_0x503884){if(!_0x503884){_0x5de865['sendStatus'](0x194);}return _0x503884;};}function handleError(_0x385b70,_0xc2274b){_0xc2274b=_0xc2274b||0x1f4;return function(_0x4dd2a6){logger[_0xcf17('0x23')](_0x4dd2a6['stack']);if(_0x4dd2a6['name']){delete _0x4dd2a6['name'];}_0x385b70[_0xcf17('0x15')](_0xc2274b)['send'](_0x4dd2a6);};}exports['index']=function(_0x51723c,_0x5852bb){var _0x361442={},_0x19ec3c={},_0x32862d={'count':0x0,'rows':[]};var _0x4afb02=_[_0xcf17('0x24')](db['SquareOdbc'][_0xcf17('0x25')],function(_0x4105b0){return{'name':_0x4105b0[_0xcf17('0x26')],'type':_0x4105b0[_0xcf17('0x27')][_0xcf17('0x28')]};});_0x19ec3c[_0xcf17('0x29')]=_[_0xcf17('0x24')](_0x4afb02,'name');_0x19ec3c['query']=_[_0xcf17('0x2a')](_0x51723c['query']);_0x19ec3c[_0xcf17('0x2b')]=_[_0xcf17('0x2c')](_0x19ec3c['model'],_0x19ec3c[_0xcf17('0x2d')]);_0x361442[_0xcf17('0x2e')]=_['intersection'](_0x19ec3c[_0xcf17('0x29')],qs[_0xcf17('0x2f')](_0x51723c[_0xcf17('0x2d')][_0xcf17('0x2f')]));_0x361442[_0xcf17('0x2e')]=_0x361442[_0xcf17('0x2e')][_0xcf17('0x30')]?_0x361442[_0xcf17('0x2e')]:_0x19ec3c['model'];if(!_0x51723c['query'][_0xcf17('0x31')](_0xcf17('0x32'))){_0x361442[_0xcf17('0x17')]=qs['limit'](_0x51723c[_0xcf17('0x2d')][_0xcf17('0x17')]);_0x361442['offset']=qs[_0xcf17('0x16')](_0x51723c[_0xcf17('0x2d')][_0xcf17('0x16')]);}_0x361442['order']=qs['sort'](_0x51723c[_0xcf17('0x2d')][_0xcf17('0x33')]);_0x361442[_0xcf17('0x34')]=qs[_0xcf17('0x2b')](_[_0xcf17('0x35')](_0x51723c[_0xcf17('0x2d')],_0x19ec3c[_0xcf17('0x2b')]),_0x4afb02);if(_0x51723c[_0xcf17('0x2d')][_0xcf17('0x36')]){_0x361442[_0xcf17('0x34')]=_[_0xcf17('0x37')](_0x361442['where'],{'$or':_[_0xcf17('0x24')](_0x4afb02,function(_0x2833a4){if(_0x2833a4[_0xcf17('0x27')]!==_0xcf17('0x38')){var _0xf22bac={};_0xf22bac[_0x2833a4['name']]={'$like':'%'+_0x51723c['query'][_0xcf17('0x36')]+'%'};return _0xf22bac;}})});}_0x361442=_[_0xcf17('0x37')]({},_0x361442,_0x51723c[_0xcf17('0x39')]);var _0x237919={'where':_0x361442[_0xcf17('0x34')]};return db[_0xcf17('0x3a')]['count'](_0x237919)[_0xcf17('0x1e')](function(_0x3c8bd9){_0x32862d['count']=_0x3c8bd9;if(_0x51723c[_0xcf17('0x2d')][_0xcf17('0x3b')]){_0x361442['include']=[{'all':!![]}];}return db[_0xcf17('0x3a')]['findAll'](_0x361442);})[_0xcf17('0x1e')](function(_0x558af7){_0x32862d[_0xcf17('0x3c')]=_0x558af7;return _0x32862d;})[_0xcf17('0x1e')](respondWithFilteredResult(_0x5852bb,_0x361442))[_0xcf17('0x3d')](handleError(_0x5852bb,null));};exports[_0xcf17('0x3e')]=function(_0x22052b,_0x225b88){var _0x231bd9={'raw':!![],'where':{'id':_0x22052b[_0xcf17('0x3f')]['id']}},_0x5b44ef={};_0x5b44ef[_0xcf17('0x29')]=_['keys'](db[_0xcf17('0x3a')][_0xcf17('0x25')]);_0x5b44ef[_0xcf17('0x2d')]=_['keys'](_0x22052b[_0xcf17('0x2d')]);_0x5b44ef['filters']=_[_0xcf17('0x2c')](_0x5b44ef['model'],_0x5b44ef['query']);_0x231bd9['attributes']=_[_0xcf17('0x2c')](_0x5b44ef[_0xcf17('0x29')],qs[_0xcf17('0x2f')](_0x22052b['query']['fields']));_0x231bd9[_0xcf17('0x2e')]=_0x231bd9['attributes']['length']?_0x231bd9[_0xcf17('0x2e')]:_0x5b44ef[_0xcf17('0x29')];if(_0x22052b[_0xcf17('0x2d')]['includeAll']){_0x231bd9[_0xcf17('0x40')]=[{'all':!![]}];}_0x231bd9=_['merge']({},_0x231bd9,_0x22052b[_0xcf17('0x39')]);return db[_0xcf17('0x3a')][_0xcf17('0x41')](_0x231bd9)['then'](handleEntityNotFound(_0x225b88,null))['then'](respondWithResult(_0x225b88,null))['catch'](handleError(_0x225b88,null));};exports[_0xcf17('0x42')]=function(_0x2b95b1,_0x804d61){return db['SquareOdbc'][_0xcf17('0x42')](_0x2b95b1['body'],{})[_0xcf17('0x1e')](function(_0x1b4bb3){var _0xff0753=_0x2b95b1[_0xcf17('0x43')][_0xcf17('0x20')]({'plain':!![]});if(!_0xff0753)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xff0753[_0xcf17('0x44')]==='user'){var _0x3cacee=_0x1b4bb3[_0xcf17('0x20')]({'plain':!![]});var _0x5df4ef=_0xcf17('0x45');return db[_0xcf17('0x46')][_0xcf17('0x41')]({'where':{'name':_0x5df4ef,'userProfileId':_0xff0753['userProfileId']},'raw':!![]})[_0xcf17('0x1e')](function(_0x4c4b78){if(_0x4c4b78&&_0x4c4b78[_0xcf17('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x3cacee[_0xcf17('0x48')],'resourceId':_0x3cacee['id'],'type':_0x4c4b78[_0xcf17('0x48')],'sectionId':_0x4c4b78['id']},{})[_0xcf17('0x1e')](function(){return _0x1b4bb3;});}else{return _0x1b4bb3;}})[_0xcf17('0x3d')](function(_0x57e8ff){logger['error'](_0xcf17('0x49'),_0x57e8ff);throw _0x57e8ff;});}return _0x1b4bb3;})[_0xcf17('0x1e')](respondWithResult(_0x804d61,0xc9))[_0xcf17('0x3d')](handleError(_0x804d61,null));};exports['update']=function(_0x1e5cd9,_0x17c38b){if(_0x1e5cd9['body']['id']){delete _0x1e5cd9[_0xcf17('0x4a')]['id'];}return db[_0xcf17('0x3a')][_0xcf17('0x41')]({'where':{'id':_0x1e5cd9['params']['id']}})[_0xcf17('0x1e')](handleEntityNotFound(_0x17c38b,null))[_0xcf17('0x1e')](saveUpdates(_0x1e5cd9[_0xcf17('0x4a')],null))[_0xcf17('0x1e')](respondWithResult(_0x17c38b,null))[_0xcf17('0x3d')](handleError(_0x17c38b,null));};exports['destroy']=function(_0x5e508c,_0x2bb21d){return db['SquareOdbc'][_0xcf17('0x41')]({'where':{'id':_0x5e508c[_0xcf17('0x3f')]['id']}})[_0xcf17('0x1e')](handleEntityNotFound(_0x2bb21d,null))[_0xcf17('0x1e')](removeEntity(_0x2bb21d,null))[_0xcf17('0x3d')](handleError(_0x2bb21d,null));};exports[_0xcf17('0x4b')]=function(_0x3bd658,_0x4048fb,_0xc56bcf){var _0x37f44c;return db[_0xcf17('0x3a')][_0xcf17('0x41')]({'where':{'id':_0x3bd658[_0xcf17('0x3f')]['id']},'attributes':['id',_0xcf17('0x4c')]})[_0xcf17('0x1e')](handleEntityNotFound(_0x4048fb,null))[_0xcf17('0x1e')](function(_0xd30701){if(_0xd30701){var _0x522924=require(_0xcf17('0x4d'))();_0x522924[_0xcf17('0x4e')](_0xd30701['dsn']);_0x522924['closeSync']();return _0xd30701;}})['then'](respondWithResult(_0x4048fb,null))[_0xcf17('0x3d')](handleError(_0x4048fb,null));}; \ No newline at end of file +var _0xec7e=['user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','count','limit','status','Content-Range','apply','reject','update','destroy','then','get','end','error','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','SquareOdbc','includeAll','include','rows','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xec7e,0x11a));var _0xeec7=function(_0x5a1038,_0x33bd65){_0x5a1038=_0x5a1038-0x0;var _0x4c7ee8=_0xec7e[_0x5a1038];return _0x4c7ee8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeec7('0x0'));var zipdir=require(_0xeec7('0x1'));var jsonpatch=require(_0xeec7('0x2'));var rp=require(_0xeec7('0x3'));var moment=require(_0xeec7('0x4'));var BPromise=require(_0xeec7('0x5'));var Mustache=require(_0xeec7('0x6'));var util=require(_0xeec7('0x7'));var path=require('path');var sox=require(_0xeec7('0x8'));var csv=require(_0xeec7('0x9'));var ejs=require(_0xeec7('0xa'));var fs=require('fs');var fs_extra=require(_0xeec7('0xb'));var _=require(_0xeec7('0xc'));var squel=require(_0xeec7('0xd'));var crypto=require(_0xeec7('0xe'));var jsforce=require(_0xeec7('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeec7('0x10'));var Redis=require(_0xeec7('0x11'));var authService=require(_0xeec7('0x12'));var qs=require(_0xeec7('0x13'));var as=require(_0xeec7('0x14'));var hardwareService=require(_0xeec7('0x15'));var logger=require('../../config/logger')(_0xeec7('0x16'));var utils=require(_0xeec7('0x17'));var config=require(_0xeec7('0x18'));var licenseUtil=require(_0xeec7('0x19'));var db=require(_0xeec7('0x1a'))['db'];function respondWithStatusCode(_0x207e2b,_0x2eaaff){_0x2eaaff=_0x2eaaff||0xcc;return function(_0x262a90){if(_0x262a90){return _0x207e2b['sendStatus'](_0x2eaaff);}return _0x207e2b['status'](_0x2eaaff)['end']();};}function respondWithResult(_0x316650,_0x2e358a){_0x2e358a=_0x2e358a||0xc8;return function(_0x1ab9c9){if(_0x1ab9c9){return _0x316650['status'](_0x2e358a)[_0xeec7('0x1b')](_0x1ab9c9);}};}function respondWithFilteredResult(_0x47bafb,_0x4d59eb){return function(_0x1c2d29){if(_0x1c2d29){var _0x3eb6c6=typeof _0x4d59eb[_0xeec7('0x1c')]===_0xeec7('0x1d')&&typeof _0x4d59eb['limit']===_0xeec7('0x1d');var _0x1a6f95=_0x1c2d29[_0xeec7('0x1e')];var _0x5c8a94=_0x3eb6c6?0x0:_0x4d59eb[_0xeec7('0x1c')];var _0x21a49c=_0x3eb6c6?_0x1c2d29['count']:_0x4d59eb['offset']+_0x4d59eb[_0xeec7('0x1f')];var _0x5b956f;if(_0x21a49c>=_0x1a6f95){_0x21a49c=_0x1a6f95;_0x5b956f=0xc8;}else{_0x5b956f=0xce;}_0x47bafb[_0xeec7('0x20')](_0x5b956f);return _0x47bafb['set'](_0xeec7('0x21'),_0x5c8a94+'-'+_0x21a49c+'/'+_0x1a6f95)[_0xeec7('0x1b')](_0x1c2d29);}return null;};}function patchUpdates(_0x337069){return function(_0x27f962){try{jsonpatch[_0xeec7('0x22')](_0x27f962,_0x337069,!![]);}catch(_0xc6ace0){return BPromise[_0xeec7('0x23')](_0xc6ace0);}return _0x27f962['save']();};}function saveUpdates(_0xcef790,_0x9f9044){return function(_0x15eed7){if(_0x15eed7){return _0x15eed7[_0xeec7('0x24')](_0xcef790)['then'](function(_0x11d871){return _0x11d871;});}return null;};}function removeEntity(_0x172076,_0x29c81d){return function(_0x41761d){if(_0x41761d){return _0x41761d[_0xeec7('0x25')]()[_0xeec7('0x26')](function(){var _0x3f49e7=_0x41761d[_0xeec7('0x27')]({'plain':!![]});var _0xf9ec26='ODBC';return db['UserProfileResource'][_0xeec7('0x25')]({'where':{'type':_0xf9ec26,'resourceId':_0x3f49e7['id']}})[_0xeec7('0x26')](function(){return _0x41761d;});})['then'](function(){_0x172076['status'](0xcc)[_0xeec7('0x28')]();});}};}function handleEntityNotFound(_0x27b21,_0x4df32e){return function(_0x150b7f){if(!_0x150b7f){_0x27b21['sendStatus'](0x194);}return _0x150b7f;};}function handleError(_0x1574ee,_0x1709a5){_0x1709a5=_0x1709a5||0x1f4;return function(_0x2a3ea7){logger[_0xeec7('0x29')](_0x2a3ea7['stack']);if(_0x2a3ea7[_0xeec7('0x2a')]){delete _0x2a3ea7[_0xeec7('0x2a')];}_0x1574ee['status'](_0x1709a5)[_0xeec7('0x2b')](_0x2a3ea7);};}exports[_0xeec7('0x2c')]=function(_0x1b3e2b,_0x314e18){var _0xda05a2={},_0x5ef222={},_0x38461c={'count':0x0,'rows':[]};var _0x111622=_[_0xeec7('0x2d')](db['SquareOdbc'][_0xeec7('0x2e')],function(_0x5a7963){return{'name':_0x5a7963[_0xeec7('0x2f')],'type':_0x5a7963[_0xeec7('0x30')][_0xeec7('0x31')]};});_0x5ef222['model']=_[_0xeec7('0x2d')](_0x111622,_0xeec7('0x2a'));_0x5ef222['query']=_[_0xeec7('0x32')](_0x1b3e2b[_0xeec7('0x33')]);_0x5ef222['filters']=_[_0xeec7('0x34')](_0x5ef222['model'],_0x5ef222[_0xeec7('0x33')]);_0xda05a2[_0xeec7('0x35')]=_[_0xeec7('0x34')](_0x5ef222[_0xeec7('0x36')],qs[_0xeec7('0x37')](_0x1b3e2b[_0xeec7('0x33')][_0xeec7('0x37')]));_0xda05a2[_0xeec7('0x35')]=_0xda05a2[_0xeec7('0x35')][_0xeec7('0x38')]?_0xda05a2['attributes']:_0x5ef222[_0xeec7('0x36')];if(!_0x1b3e2b[_0xeec7('0x33')][_0xeec7('0x39')](_0xeec7('0x3a'))){_0xda05a2[_0xeec7('0x1f')]=qs['limit'](_0x1b3e2b[_0xeec7('0x33')][_0xeec7('0x1f')]);_0xda05a2[_0xeec7('0x1c')]=qs[_0xeec7('0x1c')](_0x1b3e2b[_0xeec7('0x33')][_0xeec7('0x1c')]);}_0xda05a2['order']=qs[_0xeec7('0x3b')](_0x1b3e2b['query']['sort']);_0xda05a2['where']=qs[_0xeec7('0x3c')](_[_0xeec7('0x3d')](_0x1b3e2b[_0xeec7('0x33')],_0x5ef222[_0xeec7('0x3c')]),_0x111622);if(_0x1b3e2b[_0xeec7('0x33')][_0xeec7('0x3e')]){_0xda05a2['where']=_['merge'](_0xda05a2[_0xeec7('0x3f')],{'$or':_[_0xeec7('0x2d')](_0x111622,function(_0xb43c3d){if(_0xb43c3d[_0xeec7('0x30')]!==_0xeec7('0x40')){var _0x3fcf84={};_0x3fcf84[_0xb43c3d[_0xeec7('0x2a')]]={'$like':'%'+_0x1b3e2b[_0xeec7('0x33')]['filter']+'%'};return _0x3fcf84;}})});}_0xda05a2=_[_0xeec7('0x41')]({},_0xda05a2,_0x1b3e2b[_0xeec7('0x42')]);var _0x3d4b6a={'where':_0xda05a2['where']};return db[_0xeec7('0x43')]['count'](_0x3d4b6a)[_0xeec7('0x26')](function(_0x2c57d1){_0x38461c[_0xeec7('0x1e')]=_0x2c57d1;if(_0x1b3e2b[_0xeec7('0x33')][_0xeec7('0x44')]){_0xda05a2[_0xeec7('0x45')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0xda05a2);})[_0xeec7('0x26')](function(_0xadd6ee){_0x38461c[_0xeec7('0x46')]=_0xadd6ee;return _0x38461c;})['then'](respondWithFilteredResult(_0x314e18,_0xda05a2))[_0xeec7('0x47')](handleError(_0x314e18,null));};exports[_0xeec7('0x48')]=function(_0x3ee095,_0x28478f){var _0x2fd5fb={'raw':!![],'where':{'id':_0x3ee095[_0xeec7('0x49')]['id']}},_0x2be221={};_0x2be221[_0xeec7('0x36')]=_[_0xeec7('0x32')](db['SquareOdbc'][_0xeec7('0x2e')]);_0x2be221[_0xeec7('0x33')]=_[_0xeec7('0x32')](_0x3ee095['query']);_0x2be221[_0xeec7('0x3c')]=_[_0xeec7('0x34')](_0x2be221['model'],_0x2be221[_0xeec7('0x33')]);_0x2fd5fb['attributes']=_[_0xeec7('0x34')](_0x2be221[_0xeec7('0x36')],qs['fields'](_0x3ee095[_0xeec7('0x33')][_0xeec7('0x37')]));_0x2fd5fb[_0xeec7('0x35')]=_0x2fd5fb['attributes'][_0xeec7('0x38')]?_0x2fd5fb[_0xeec7('0x35')]:_0x2be221[_0xeec7('0x36')];if(_0x3ee095[_0xeec7('0x33')][_0xeec7('0x44')]){_0x2fd5fb[_0xeec7('0x45')]=[{'all':!![]}];}_0x2fd5fb=_['merge']({},_0x2fd5fb,_0x3ee095['options']);return db[_0xeec7('0x43')][_0xeec7('0x4a')](_0x2fd5fb)['then'](handleEntityNotFound(_0x28478f,null))[_0xeec7('0x26')](respondWithResult(_0x28478f,null))[_0xeec7('0x47')](handleError(_0x28478f,null));};exports['create']=function(_0x1fada9,_0x473268){return db[_0xeec7('0x43')]['create'](_0x1fada9[_0xeec7('0x4b')],{})[_0xeec7('0x26')](function(_0x4cbf8a){var _0x3ff162=_0x1fada9['user'][_0xeec7('0x27')]({'plain':!![]});if(!_0x3ff162)throw new Error(_0xeec7('0x4c'));if(_0x3ff162[_0xeec7('0x4d')]===_0xeec7('0x4e')){var _0x218fee=_0x4cbf8a[_0xeec7('0x27')]({'plain':!![]});var _0x3feefc='ODBC';return db[_0xeec7('0x4f')][_0xeec7('0x4a')]({'where':{'name':_0x3feefc,'userProfileId':_0x3ff162[_0xeec7('0x50')]},'raw':!![]})[_0xeec7('0x26')](function(_0xdb942a){if(_0xdb942a&&_0xdb942a[_0xeec7('0x51')]===0x0){return db[_0xeec7('0x52')][_0xeec7('0x53')]({'name':_0x218fee[_0xeec7('0x2a')],'resourceId':_0x218fee['id'],'type':_0xdb942a['name'],'sectionId':_0xdb942a['id']},{})[_0xeec7('0x26')](function(){return _0x4cbf8a;});}else{return _0x4cbf8a;}})[_0xeec7('0x47')](function(_0x159251){logger[_0xeec7('0x29')](_0xeec7('0x54'),_0x159251);throw _0x159251;});}return _0x4cbf8a;})[_0xeec7('0x26')](respondWithResult(_0x473268,0xc9))[_0xeec7('0x47')](handleError(_0x473268,null));};exports[_0xeec7('0x24')]=function(_0x268f36,_0x1af576){if(_0x268f36[_0xeec7('0x4b')]['id']){delete _0x268f36[_0xeec7('0x4b')]['id'];}return db[_0xeec7('0x43')][_0xeec7('0x4a')]({'where':{'id':_0x268f36['params']['id']}})[_0xeec7('0x26')](handleEntityNotFound(_0x1af576,null))[_0xeec7('0x26')](saveUpdates(_0x268f36[_0xeec7('0x4b')],null))[_0xeec7('0x26')](respondWithResult(_0x1af576,null))['catch'](handleError(_0x1af576,null));};exports[_0xeec7('0x25')]=function(_0x2c3443,_0x4306e7){return db[_0xeec7('0x43')]['find']({'where':{'id':_0x2c3443['params']['id']}})[_0xeec7('0x26')](handleEntityNotFound(_0x4306e7,null))[_0xeec7('0x26')](removeEntity(_0x4306e7,null))[_0xeec7('0x47')](handleError(_0x4306e7,null));};exports[_0xeec7('0x55')]=function(_0x3632ac,_0x255793,_0x2b0286){var _0x3628df;return db[_0xeec7('0x43')]['find']({'where':{'id':_0x3632ac[_0xeec7('0x49')]['id']},'attributes':['id',_0xeec7('0x56')]})[_0xeec7('0x26')](handleEntityNotFound(_0x255793,null))[_0xeec7('0x26')](function(_0x1e9879){if(_0x1e9879){var _0x55363e=require(_0xeec7('0x57'))();_0x55363e[_0xeec7('0x58')](_0x1e9879[_0xeec7('0x56')]);_0x55363e[_0xeec7('0x59')]();return _0x1e9879;}})['then'](respondWithResult(_0x255793,null))[_0xeec7('0x47')](handleError(_0x255793,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 95d1191..9f67928 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 _0x531a=['lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x36c6e3,_0x2de454){var _0x4b9514=function(_0x52b8e0){while(--_0x52b8e0){_0x36c6e3['push'](_0x36c6e3['shift']());}};_0x4b9514(++_0x2de454);}(_0x531a,0x79));var _0xa531=function(_0x30df37,_0x48ad64){_0x30df37=_0x30df37-0x0;var _0x41ab55=_0x531a[_0x30df37];return _0x41ab55;};'use strict';var _=require(_0xa531('0x0'));var util=require('util');var logger=require(_0xa531('0x1'))(_0xa531('0x2'));var moment=require(_0xa531('0x3'));var BPromise=require(_0xa531('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa531('0x5'));var config=require(_0xa531('0x6'));var attributes=require(_0xa531('0x7'));module[_0xa531('0x8')]=function(_0x571560,_0x4b5f6c){return _0x571560[_0xa531('0x9')](_0xa531('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe615=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xe615,0xfa));var _0x5e61=function(_0x2ceb31,_0x40ecf1){_0x2ceb31=_0x2ceb31-0x0;var _0x168859=_0xe615[_0x2ceb31];return _0x168859;};'use strict';var _=require(_0x5e61('0x0'));var util=require(_0x5e61('0x1'));var logger=require(_0x5e61('0x2'))('api');var moment=require(_0x5e61('0x3'));var BPromise=require(_0x5e61('0x4'));var rp=require(_0x5e61('0x5'));var fs=require('fs');var path=require(_0x5e61('0x6'));var rimraf=require('rimraf');var config=require(_0x5e61('0x7'));var attributes=require(_0x5e61('0x8'));module[_0x5e61('0x9')]=function(_0x22dc17,_0x4b6c33){return _0x22dc17['define']('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index edf1ada..c568819 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 _0x36d4=['code','message','info','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','attributes','model','debug','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3019c9,_0x1a8453){var _0x3d884d=function(_0x513a46){while(--_0x513a46){_0x3019c9['push'](_0x3019c9['shift']());}};_0x3d884d(++_0x1a8453);}(_0x36d4,0x118));var _0x436d=function(_0x3c3b57,_0x5c6241){_0x3c3b57=_0x3c3b57-0x0;var _0x630592=_0x36d4[_0x3c3b57];return _0x630592;};'use strict';var _=require('lodash');var util=require(_0x436d('0x0'));var moment=require(_0x436d('0x1'));var BPromise=require(_0x436d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x436d('0x3'));var db=require(_0x436d('0x4'))['db'];var utils=require(_0x436d('0x5'));var logger=require(_0x436d('0x6'))(_0x436d('0x7'));var config=require(_0x436d('0x8'));var jayson=require(_0x436d('0x9'));var client=jayson[_0x436d('0xa')][_0x436d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d4479,_0x2140d9,_0x5151c3){return new BPromise(function(_0x5a8cbf,_0x542194){return client[_0x436d('0xc')](_0x5d4479,_0x5151c3)[_0x436d('0xd')](function(_0x146e90){logger['info'](_0x436d('0xe'),_0x2140d9,'request\x20sent');logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x2140d9,_0x436d('0xf'),JSON['stringify'](_0x146e90));if(_0x146e90['error']){if(_0x146e90[_0x436d('0x10')][_0x436d('0x11')]===0x1f4){logger[_0x436d('0x10')](_0x436d('0xe'),_0x2140d9,_0x146e90[_0x436d('0x10')][_0x436d('0x12')]);return _0x542194(_0x146e90[_0x436d('0x10')][_0x436d('0x12')]);}logger[_0x436d('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x2140d9,_0x146e90[_0x436d('0x10')]['message']);return _0x5a8cbf(_0x146e90[_0x436d('0x10')][_0x436d('0x12')]);}else{logger[_0x436d('0x13')](_0x436d('0xe'),_0x2140d9,_0x436d('0xf'));_0x5a8cbf(_0x146e90['result']['message']);}})[_0x436d('0x14')](function(_0x262452){logger['error'](_0x436d('0xe'),_0x2140d9,_0x262452);_0x542194(_0x262452);});});}exports[_0x436d('0x15')]=function(_0x57e85f){var _0x57027e=this;return new Promise(function(_0x303a47,_0x53d9c4){return db[_0x436d('0x16')][_0x436d('0x17')]({'raw':_0x57e85f['options']?_0x57e85f[_0x436d('0x18')][_0x436d('0x19')]===undefined?!![]:![]:!![],'where':_0x57e85f[_0x436d('0x18')]?_0x57e85f[_0x436d('0x18')][_0x436d('0x1a')]||null:null,'attributes':_0x57e85f[_0x436d('0x18')]?_0x57e85f['options']['attributes']||null:null,'include':_0x57e85f[_0x436d('0x18')]?_0x57e85f[_0x436d('0x18')][_0x436d('0x1b')]?_[_0x436d('0x1c')](_0x57e85f[_0x436d('0x18')][_0x436d('0x1b')],function(_0x1a0018){return{'model':db[_0x1a0018['model']],'as':_0x1a0018['as'],'attributes':_0x1a0018[_0x436d('0x1d')],'include':_0x1a0018[_0x436d('0x1b')]?_[_0x436d('0x1c')](_0x1a0018[_0x436d('0x1b')],function(_0x933af){return{'model':db[_0x933af[_0x436d('0x1e')]],'as':_0x933af['as'],'attributes':_0x933af[_0x436d('0x1d')],'include':_0x933af[_0x436d('0x1b')]?_[_0x436d('0x1c')](_0x933af[_0x436d('0x1b')],function(_0x509314){return{'model':db[_0x509314[_0x436d('0x1e')]],'as':_0x509314['as'],'attributes':_0x509314[_0x436d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x436d('0xd')](function(_0x4edc67){logger[_0x436d('0x13')](_0x436d('0x15'),_0x57e85f);logger[_0x436d('0x1f')](_0x436d('0x15'),_0x57e85f,JSON[_0x436d('0x20')](_0x4edc67));_0x303a47(_0x4edc67);})[_0x436d('0x14')](function(_0x149a3d){logger[_0x436d('0x10')](_0x436d('0x15'),_0x149a3d[_0x436d('0x12')],_0x57e85f);_0x53d9c4(_0x57027e['error'](0x1f4,_0x149a3d[_0x436d('0x12')]));});});}; \ No newline at end of file +var _0x2125=['http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','model','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xafa0a2,_0x5f2f92){var _0x35c664=function(_0x1cd60c){while(--_0x1cd60c){_0xafa0a2['push'](_0xafa0a2['shift']());}};_0x35c664(++_0x5f2f92);}(_0x2125,0xdc));var _0x5212=function(_0x3b3065,_0x2a3f89){_0x3b3065=_0x3b3065-0x0;var _0x1e569f=_0x2125[_0x3b3065];return _0x1e569f;};'use strict';var _=require(_0x5212('0x0'));var util=require('util');var moment=require(_0x5212('0x1'));var BPromise=require(_0x5212('0x2'));var rs=require(_0x5212('0x3'));var fs=require('fs');var Redis=require(_0x5212('0x4'));var db=require(_0x5212('0x5'))['db'];var utils=require(_0x5212('0x6'));var logger=require(_0x5212('0x7'))('rpc');var config=require(_0x5212('0x8'));var jayson=require(_0x5212('0x9'));var client=jayson[_0x5212('0xa')][_0x5212('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52c02c,_0x1c2c8a,_0x1298c){return new BPromise(function(_0x304dda,_0x4feea2){return client[_0x5212('0xc')](_0x52c02c,_0x1298c)[_0x5212('0xd')](function(_0x5b5a90){logger[_0x5212('0xe')](_0x5212('0xf'),_0x1c2c8a,_0x5212('0x10'));logger[_0x5212('0x11')](_0x5212('0x12'),_0x1c2c8a,_0x5212('0x10'),JSON[_0x5212('0x13')](_0x5b5a90));if(_0x5b5a90[_0x5212('0x14')]){if(_0x5b5a90[_0x5212('0x14')]['code']===0x1f4){logger[_0x5212('0x14')](_0x5212('0xf'),_0x1c2c8a,_0x5b5a90[_0x5212('0x14')]['message']);return _0x4feea2(_0x5b5a90[_0x5212('0x14')][_0x5212('0x15')]);}logger[_0x5212('0x14')](_0x5212('0xf'),_0x1c2c8a,_0x5b5a90['error'][_0x5212('0x15')]);return _0x304dda(_0x5b5a90[_0x5212('0x14')][_0x5212('0x15')]);}else{logger[_0x5212('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x1c2c8a,_0x5212('0x10'));_0x304dda(_0x5b5a90[_0x5212('0x16')]['message']);}})[_0x5212('0x17')](function(_0x5cc47d){logger[_0x5212('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x1c2c8a,_0x5cc47d);_0x4feea2(_0x5cc47d);});});}exports[_0x5212('0x18')]=function(_0x497ff0){var _0x439c98=this;return new Promise(function(_0x5d257f,_0x5ad223){return db['SquareOdbc'][_0x5212('0x19')]({'raw':_0x497ff0['options']?_0x497ff0[_0x5212('0x1a')][_0x5212('0x1b')]===undefined?!![]:![]:!![],'where':_0x497ff0['options']?_0x497ff0[_0x5212('0x1a')][_0x5212('0x1c')]||null:null,'attributes':_0x497ff0['options']?_0x497ff0[_0x5212('0x1a')][_0x5212('0x1d')]||null:null,'include':_0x497ff0[_0x5212('0x1a')]?_0x497ff0['options']['include']?_['map'](_0x497ff0[_0x5212('0x1a')][_0x5212('0x1e')],function(_0x5893c8){return{'model':db[_0x5893c8[_0x5212('0x1f')]],'as':_0x5893c8['as'],'attributes':_0x5893c8['attributes'],'include':_0x5893c8[_0x5212('0x1e')]?_[_0x5212('0x20')](_0x5893c8[_0x5212('0x1e')],function(_0x386ac9){return{'model':db[_0x386ac9[_0x5212('0x1f')]],'as':_0x386ac9['as'],'attributes':_0x386ac9[_0x5212('0x1d')],'include':_0x386ac9[_0x5212('0x1e')]?_['map'](_0x386ac9[_0x5212('0x1e')],function(_0x35243f){return{'model':db[_0x35243f[_0x5212('0x1f')]],'as':_0x35243f['as'],'attributes':_0x35243f['attributes']};}):[]};}):[]};}):[]:[]})[_0x5212('0xd')](function(_0x41f42f){logger[_0x5212('0xe')](_0x5212('0x18'),_0x497ff0);logger[_0x5212('0x11')](_0x5212('0x18'),_0x497ff0,JSON[_0x5212('0x13')](_0x41f42f));_0x5d257f(_0x41f42f);})[_0x5212('0x17')](function(_0x228c03){logger[_0x5212('0x14')]('ShowSquareOdbc',_0x228c03[_0x5212('0x15')],_0x497ff0);_0x5ad223(_0x439c98[_0x5212('0x14')](0x1f4,_0x228c03[_0x5212('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 9b51c51..34747d8 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 _0x9fa2=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','create','post','addUsers','put','update','delete','exports','multer','util'];(function(_0xf28b42,_0x5a976f){var _0x4f1265=function(_0x37a26d){while(--_0x37a26d){_0xf28b42['push'](_0xf28b42['shift']());}};_0x4f1265(++_0x5a976f);}(_0x9fa2,0x67));var _0x29fa=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0x9fa2[_0x51bb38];return _0x51c09b;};'use strict';var multer=require(_0x29fa('0x0'));var util=require(_0x29fa('0x1'));var path=require(_0x29fa('0x2'));var timeout=require(_0x29fa('0x3'));var express=require(_0x29fa('0x4'));var router=express['Router']();var fs_extra=require(_0x29fa('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29fa('0x6'));var controller=require('./squareProject.controller');router[_0x29fa('0x7')]('/',auth[_0x29fa('0x8')](),controller[_0x29fa('0x9')]);router[_0x29fa('0x7')](_0x29fa('0xa'),auth[_0x29fa('0x8')](),controller[_0x29fa('0xb')]);router[_0x29fa('0x7')](_0x29fa('0xc'),auth['isAuthenticated'](),controller[_0x29fa('0xd')]);router['post']('/',auth[_0x29fa('0x8')](),controller[_0x29fa('0xe')]);router[_0x29fa('0xf')]('/:id/users',auth[_0x29fa('0x8')](),controller[_0x29fa('0x10')]);router[_0x29fa('0x11')](_0x29fa('0xa'),auth[_0x29fa('0x8')](),controller[_0x29fa('0x12')]);router['delete'](_0x29fa('0xa'),auth[_0x29fa('0x8')](),controller['destroy']);router[_0x29fa('0x13')](_0x29fa('0xc'),auth[_0x29fa('0x8')](),controller['removeUsers']);module[_0x29fa('0x14')]=router; \ No newline at end of file +var _0x7582=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','/:id','get','/:id/users','post','addUsers','put','destroy','delete','removeUsers','exports','util'];(function(_0x24a675,_0x3de6b4){var _0x43f798=function(_0x20c720){while(--_0x20c720){_0x24a675['push'](_0x24a675['shift']());}};_0x43f798(++_0x3de6b4);}(_0x7582,0x167));var _0x2758=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x7582[_0x5b64a1];return _0x4b6f55;};'use strict';var multer=require('multer');var util=require(_0x2758('0x0'));var path=require(_0x2758('0x1'));var timeout=require(_0x2758('0x2'));var express=require('express');var router=express[_0x2758('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2758('0x4'));var interaction=require(_0x2758('0x5'));var config=require(_0x2758('0x6'));var controller=require(_0x2758('0x7'));router['get']('/',auth[_0x2758('0x8')](),controller[_0x2758('0x9')]);router['get'](_0x2758('0xa'),auth[_0x2758('0x8')](),controller['show']);router[_0x2758('0xb')](_0x2758('0xc'),auth[_0x2758('0x8')](),controller['getUsers']);router[_0x2758('0xd')]('/',auth[_0x2758('0x8')](),controller['create']);router['post'](_0x2758('0xc'),auth[_0x2758('0x8')](),controller[_0x2758('0xe')]);router[_0x2758('0xf')](_0x2758('0xa'),auth[_0x2758('0x8')](),controller['update']);router['delete']('/:id',auth[_0x2758('0x8')](),controller[_0x2758('0x10')]);router[_0x2758('0x11')](_0x2758('0xc'),auth[_0x2758('0x8')](),controller[_0x2758('0x12')]);module[_0x2758('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index a6b08ef..f4e6416 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 _0xd997=['sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','production','utf8','DATE'];(function(_0x46c1d5,_0x5ca335){var _0x40fe7b=function(_0x34cb99){while(--_0x34cb99){_0x46c1d5['push'](_0x46c1d5['shift']());}};_0x40fe7b(++_0x5ca335);}(_0xd997,0x1a0));var _0x7d99=function(_0x4a0238,_0x497945){_0x4a0238=_0x4a0238-0x0;var _0x3b1441=_0xd997[_0x4a0238];return _0x3b1441;};'use strict';var Sequelize=require(_0x7d99('0x0'));module[_0x7d99('0x1')]={'name':{'type':Sequelize[_0x7d99('0x2')],'unique':_0x7d99('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7d99('0x2')]},'notes':{'type':Sequelize[_0x7d99('0x4')]},'preproduction':{'type':Sequelize[_0x7d99('0x5')](_0x7d99('0x6')),'get':function(){if(this[_0x7d99('0x7')](_0x7d99('0x8'))){return this[_0x7d99('0x7')]('preproduction')[_0x7d99('0x9')]('utf8');}}},'production':{'type':Sequelize[_0x7d99('0x5')](_0x7d99('0x6')),'get':function(){if(this[_0x7d99('0x7')](_0x7d99('0xa'))){return this[_0x7d99('0x7')](_0x7d99('0xa'))[_0x7d99('0x9')](_0x7d99('0xb'));}}},'savedAt':{'type':Sequelize[_0x7d99('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x182f=['DATE','exports','name','STRING','BLOB','long','getDataValue','preproduction','toString','production','utf8'];(function(_0xeb30d6,_0x46ba0a){var _0x42de1f=function(_0x1e3105){while(--_0x1e3105){_0xeb30d6['push'](_0xeb30d6['shift']());}};_0x42de1f(++_0x46ba0a);}(_0x182f,0x85));var _0xf182=function(_0x2eba44,_0x537222){_0x2eba44=_0x2eba44-0x0;var _0x24669c=_0x182f[_0x2eba44];return _0x24669c;};'use strict';var Sequelize=require('sequelize');module[_0xf182('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xf182('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xf182('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xf182('0x3')](_0xf182('0x4')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0xf182('0x5')](_0xf182('0x6'))[_0xf182('0x7')]('utf8');}}},'production':{'type':Sequelize[_0xf182('0x3')](_0xf182('0x4')),'get':function(){if(this[_0xf182('0x5')](_0xf182('0x8'))){return this[_0xf182('0x5')]('production')[_0xf182('0x7')](_0xf182('0x9'));}}},'savedAt':{'type':Sequelize[_0xf182('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index a009891..7ab2af1 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 _0x0598=['autoAssociation','body','destroy','addUsers','ids','isArray','emit','getUsers','User','nolimit','lodash','ioredis','../../config/logger','../../mysqldb','redis','socket.io-emitter','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','update','then','get','UserProfileResource','publish','agi','stringify','end','error','name','send','map','SquareProject','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','VIRTUAL','options','where','include','findAll','params','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection'];(function(_0x124926,_0x42eb6b){var _0x5eb241=function(_0x53a498){while(--_0x53a498){_0x124926['push'](_0x124926['shift']());}};_0x5eb241(++_0x42eb6b);}(_0x0598,0x92));var _0x8059=function(_0x373044,_0x247089){_0x373044=_0x373044-0x0;var _0x5e1b13=_0x0598[_0x373044];return _0x5e1b13;};'use strict';var _=require(_0x8059('0x0'));var Redis=require(_0x8059('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x8059('0x2'))('api');var config=require('../../config/environment');var db=require(_0x8059('0x3'))['db'];config[_0x8059('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8059('0x5'))(new Redis(config[_0x8059('0x4')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x248273,_0x347f1b){_0x347f1b=_0x347f1b||0xcc;return function(_0x4610d2){if(_0x4610d2){return _0x248273[_0x8059('0x6')](_0x347f1b);}return _0x248273['status'](_0x347f1b)['end']();};}function respondWithResult(_0x89dda1,_0x1bf5fd){_0x1bf5fd=_0x1bf5fd||0xc8;return function(_0x336f85){if(_0x336f85){return _0x89dda1[_0x8059('0x7')](_0x1bf5fd)[_0x8059('0x8')](_0x336f85);}};}function respondWithFilteredResult(_0x52a60d,_0x551d9e){return function(_0x2a60d7){if(_0x2a60d7){var _0x4109a9=typeof _0x551d9e['offset']==='undefined'&&typeof _0x551d9e['limit']===_0x8059('0x9');var _0x2d26e2=_0x2a60d7[_0x8059('0xa')];var _0x12d6ce=_0x4109a9?0x0:_0x551d9e[_0x8059('0xb')];var _0x4eb4c5=_0x4109a9?_0x2a60d7[_0x8059('0xa')]:_0x551d9e['offset']+_0x551d9e[_0x8059('0xc')];var _0x5c916e;if(_0x4eb4c5>=_0x2d26e2){_0x4eb4c5=_0x2d26e2;_0x5c916e=0xc8;}else{_0x5c916e=0xce;}_0x52a60d[_0x8059('0x7')](_0x5c916e);return _0x52a60d[_0x8059('0xd')](_0x8059('0xe'),_0x12d6ce+'-'+_0x4eb4c5+'/'+_0x2d26e2)['json'](_0x2a60d7);}return null;};}function saveUpdates(_0x516c1f){return function(_0x5cda43){if(_0x5cda43){return _0x5cda43[_0x8059('0xf')](_0x516c1f)[_0x8059('0x10')](function(_0x2ffebf){return _0x2ffebf;});}return null;};}function removeEntity(_0x246c9d){return function(_0x3abfe8){if(_0x3abfe8){return _0x3abfe8['destroy']()[_0x8059('0x10')](function(){var _0x2bb670=_0x3abfe8[_0x8059('0x11')]({'plain':!![]});var _0x1c4566='SquareProjects';return db[_0x8059('0x12')]['destroy']({'where':{'type':_0x1c4566,'resourceId':_0x2bb670['id']}})[_0x8059('0x10')](function(){return _0x3abfe8;});})['then'](function(){var _0x1857c1=new Redis(config['redis']);_0x1857c1[_0x8059('0x13')](_0x8059('0x14'),JSON[_0x8059('0x15')]({'id':_0x3abfe8['id'],'deleted':!![]}));})['then'](function(){_0x246c9d['status'](0xcc)[_0x8059('0x16')]();});}};}function handleEntityNotFound(_0x232f1b){return function(_0x32aeda){if(!_0x32aeda){_0x232f1b[_0x8059('0x6')](0x194);}return _0x32aeda;};}function handleError(_0x4c6234,_0x3bc226){_0x3bc226=_0x3bc226||0x1f4;return function(_0x21ac82){logger[_0x8059('0x17')](_0x21ac82['stack']);if(_0x21ac82[_0x8059('0x18')]){delete _0x21ac82[_0x8059('0x18')];}_0x4c6234[_0x8059('0x7')](_0x3bc226)[_0x8059('0x19')](_0x21ac82);};}exports['index']=function(_0x140f64,_0x2cd179){var _0x4781e2={},_0x3e2d2b={},_0x202b30={'count':0x0,'rows':[]};var _0x54b88b=_[_0x8059('0x1a')](db[_0x8059('0x1b')][_0x8059('0x1c')],function(_0x4a294f){return{'name':_0x4a294f['fieldName'],'type':_0x4a294f['type'][_0x8059('0x1d')]};});_0x3e2d2b[_0x8059('0x1e')]=_[_0x8059('0x1a')](_0x54b88b,_0x8059('0x18'));_0x3e2d2b['query']=_[_0x8059('0x1f')](_0x140f64['query']);_0x3e2d2b[_0x8059('0x20')]=_[_0x8059('0x21')](_0x3e2d2b['model'],_0x3e2d2b[_0x8059('0x22')]);_0x4781e2[_0x8059('0x23')]=_[_0x8059('0x21')](_0x3e2d2b[_0x8059('0x1e')],qs[_0x8059('0x24')](_0x140f64[_0x8059('0x22')][_0x8059('0x24')]));_0x4781e2[_0x8059('0x23')]=_0x4781e2['attributes'][_0x8059('0x25')]?_0x4781e2[_0x8059('0x23')]:_0x3e2d2b[_0x8059('0x1e')];if(!_0x140f64[_0x8059('0x22')][_0x8059('0x26')]('nolimit')){_0x4781e2[_0x8059('0xc')]=qs[_0x8059('0xc')](_0x140f64[_0x8059('0x22')][_0x8059('0xc')]);_0x4781e2[_0x8059('0xb')]=qs[_0x8059('0xb')](_0x140f64[_0x8059('0x22')][_0x8059('0xb')]);}_0x4781e2[_0x8059('0x27')]=qs[_0x8059('0x28')](_0x140f64['query'][_0x8059('0x28')]);_0x4781e2['where']=qs[_0x8059('0x20')](_['pick'](_0x140f64['query'],_0x3e2d2b[_0x8059('0x20')]),_0x54b88b);if(_0x140f64['query'][_0x8059('0x29')]){_0x4781e2['where']=_[_0x8059('0x2a')](_0x4781e2['where'],{'$or':_[_0x8059('0x1a')](_0x54b88b,function(_0x5c4aa0){if(_0x5c4aa0['type']!==_0x8059('0x2b')){var _0x7961af={};_0x7961af[_0x5c4aa0[_0x8059('0x18')]]={'$like':'%'+_0x140f64['query'][_0x8059('0x29')]+'%'};return _0x7961af;}})});}_0x4781e2=_['merge']({},_0x4781e2,_0x140f64[_0x8059('0x2c')]);var _0x50a685={'where':_0x4781e2[_0x8059('0x2d')]};return db[_0x8059('0x1b')][_0x8059('0xa')](_0x50a685)[_0x8059('0x10')](function(_0x4db4e1){_0x202b30[_0x8059('0xa')]=_0x4db4e1;if(_0x140f64['query']['includeAll']){_0x4781e2[_0x8059('0x2e')]=[{'all':!![]}];}return db[_0x8059('0x1b')][_0x8059('0x2f')](_0x4781e2);})[_0x8059('0x10')](function(_0x2f68b0){_0x202b30['rows']=_0x2f68b0;return _0x202b30;})['then'](respondWithFilteredResult(_0x2cd179,_0x4781e2))['catch'](handleError(_0x2cd179,null));};exports['show']=function(_0x373e10,_0x126ec1){var _0xc84f04={'raw':![],'where':{'id':_0x373e10[_0x8059('0x30')]['id']}},_0x4a0323={};_0x4a0323[_0x8059('0x1e')]=_['keys'](db[_0x8059('0x1b')][_0x8059('0x1c')]);_0x4a0323[_0x8059('0x22')]=_['keys'](_0x373e10[_0x8059('0x22')]);_0x4a0323[_0x8059('0x20')]=_['intersection'](_0x4a0323[_0x8059('0x1e')],_0x4a0323[_0x8059('0x22')]);_0xc84f04[_0x8059('0x23')]=_[_0x8059('0x21')](_0x4a0323[_0x8059('0x1e')],qs[_0x8059('0x24')](_0x373e10[_0x8059('0x22')][_0x8059('0x24')]));_0xc84f04[_0x8059('0x23')]=_0xc84f04[_0x8059('0x23')][_0x8059('0x25')]?_0xc84f04[_0x8059('0x23')]:_0x4a0323[_0x8059('0x1e')];if(_0x373e10[_0x8059('0x22')][_0x8059('0x31')]){_0xc84f04[_0x8059('0x2e')]=[{'all':!![]}];}_0xc84f04=_[_0x8059('0x2a')]({},_0xc84f04,_0x373e10[_0x8059('0x2c')]);return db[_0x8059('0x1b')][_0x8059('0x32')](_0xc84f04)[_0x8059('0x10')](handleEntityNotFound(_0x126ec1,null))[_0x8059('0x10')](respondWithResult(_0x126ec1,null))[_0x8059('0x33')](handleError(_0x126ec1,null));};exports['create']=function(_0x38ec09,_0x5655d9){return db['SquareProject'][_0x8059('0x34')](_0x38ec09['body'],{})[_0x8059('0x10')](function(_0x5e5c2c){var _0xf4bc19=_0x38ec09[_0x8059('0x35')][_0x8059('0x11')]({'plain':!![]});if(!_0xf4bc19)throw new Error(_0x8059('0x36'));if(_0xf4bc19[_0x8059('0x37')]===_0x8059('0x35')){var _0x538ab6=_0x5e5c2c[_0x8059('0x11')]({'plain':!![]});var _0x518517=_0x8059('0x38');return db[_0x8059('0x39')][_0x8059('0x32')]({'where':{'name':_0x518517,'userProfileId':_0xf4bc19['userProfileId']},'raw':!![]})[_0x8059('0x10')](function(_0x120665){if(_0x120665&&_0x120665[_0x8059('0x3a')]===0x0){return db[_0x8059('0x12')]['create']({'name':_0x538ab6[_0x8059('0x18')],'resourceId':_0x538ab6['id'],'type':_0x120665[_0x8059('0x18')],'sectionId':_0x120665['id']},{})[_0x8059('0x10')](function(){return _0x5e5c2c;});}else{return _0x5e5c2c;}})['catch'](function(_0x2ba3f1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ba3f1);throw _0x2ba3f1;});}return _0x5e5c2c;})[_0x8059('0x10')](respondWithResult(_0x5655d9,0xc9))['catch'](handleError(_0x5655d9,null));};exports[_0x8059('0xf')]=function(_0x54d2d2,_0x261967){if(_0x54d2d2[_0x8059('0x3b')]['id']){delete _0x54d2d2['body']['id'];}return db[_0x8059('0x1b')]['find']({'where':{'id':_0x54d2d2[_0x8059('0x30')]['id']}})[_0x8059('0x10')](handleEntityNotFound(_0x261967,null))[_0x8059('0x10')](saveUpdates(_0x54d2d2['body'],null))[_0x8059('0x10')](function(_0x5035a9){if(!_0x5035a9)return;var _0x21ceef=_0x5035a9[_0x8059('0x11')]({'plain':!![]});return _0x21ceef;})[_0x8059('0x10')](function(_0xb63fee){var _0x48ab33=new Redis(config[_0x8059('0x4')]);_0x48ab33[_0x8059('0x13')]('agi',JSON[_0x8059('0x15')](_['pick'](_0xb63fee,['id',_0x8059('0x18'),'production'])));return _0xb63fee;})['then'](respondWithResult(_0x261967,null))[_0x8059('0x33')](handleError(_0x261967,null));};exports[_0x8059('0x3c')]=function(_0x15ed31,_0x3afe66){return db[_0x8059('0x1b')][_0x8059('0x32')]({'where':{'id':_0x15ed31[_0x8059('0x30')]['id']}})['then'](handleEntityNotFound(_0x3afe66,null))['then'](removeEntity(_0x3afe66,null))['catch'](handleError(_0x3afe66,null));};exports['addUsers']=function(_0x37c254,_0x21d53c){return db['SquareProject'][_0x8059('0x32')]({'where':{'id':_0x37c254['params']['id']}})['then'](handleEntityNotFound(_0x21d53c,null))[_0x8059('0x10')](function(_0x55cb8d){if(_0x55cb8d){return _0x55cb8d[_0x8059('0x3d')](_0x37c254[_0x8059('0x3b')][_0x8059('0x3e')],_['omit'](_0x37c254['body'],[_0x8059('0x3e'),'id'])||{});}})[_0x8059('0x10')](respondWithResult(_0x21d53c,null))[_0x8059('0x33')](handleError(_0x21d53c,null));};exports['removeUsers']=function(_0x501f2c,_0x1260b1){return db['SquareProject']['find']({'where':{'id':_0x501f2c[_0x8059('0x30')]['id']}})['then'](handleEntityNotFound(_0x1260b1,null))[_0x8059('0x10')](function(_0x1c4015){if(_0x1c4015){return _0x1c4015['removeUsers'](_0x501f2c['query'][_0x8059('0x3e')])[_0x8059('0x10')](function(){if(_[_0x8059('0x3f')](_0x501f2c['query'][_0x8059('0x3e')])){for(var _0x4452ab=0x0;_0x4452ab<_0x501f2c[_0x8059('0x22')][_0x8059('0x3e')]['length'];_0x4452ab+=0x1){socket[_0x8059('0x40')]('userSquareProject:remove',{'UserId':Number(_0x501f2c[_0x8059('0x22')][_0x8059('0x3e')][_0x4452ab]),'SquareProjectId':Number(_0x501f2c['params']['id'])});}}else{socket[_0x8059('0x40')]('userSquareProject:remove',{'UserId':Number(_0x501f2c[_0x8059('0x22')][_0x8059('0x3e')]),'SquareProjectId':Number(_0x501f2c[_0x8059('0x30')]['id'])});}});}})[_0x8059('0x10')](respondWithStatusCode(_0x1260b1,null))[_0x8059('0x33')](handleError(_0x1260b1,null));};exports[_0x8059('0x41')]=function(_0x28b466,_0x410bf4){var _0x352e51={};var _0x471cb3={};var _0x4449b3;var _0x20e9d7;return db[_0x8059('0x1b')]['findOne']({'where':{'id':_0x28b466[_0x8059('0x30')]['id']}})[_0x8059('0x10')](handleEntityNotFound(_0x410bf4,null))[_0x8059('0x10')](function(_0x421682){if(_0x421682){_0x4449b3=_0x421682;_0x471cb3[_0x8059('0x1e')]=_['keys'](db[_0x8059('0x42')][_0x8059('0x1c')]);_0x471cb3[_0x8059('0x22')]=_[_0x8059('0x1f')](_0x28b466[_0x8059('0x22')]);_0x471cb3[_0x8059('0x20')]=_[_0x8059('0x21')](_0x471cb3[_0x8059('0x1e')],_0x471cb3[_0x8059('0x22')]);_0x352e51['attributes']=_[_0x8059('0x21')](_0x471cb3[_0x8059('0x1e')],qs[_0x8059('0x24')](_0x28b466['query']['fields']));_0x352e51[_0x8059('0x23')]=_0x352e51[_0x8059('0x23')][_0x8059('0x25')]?_0x352e51[_0x8059('0x23')]:_0x471cb3[_0x8059('0x1e')];_0x352e51[_0x8059('0x27')]=qs[_0x8059('0x28')](_0x28b466['query'][_0x8059('0x28')]);_0x352e51[_0x8059('0x2d')]=qs[_0x8059('0x20')](_['pick'](_0x28b466[_0x8059('0x22')],_0x471cb3[_0x8059('0x20')]));if(_0x28b466[_0x8059('0x22')][_0x8059('0x29')]){_0x352e51['where']=_['merge'](_0x352e51[_0x8059('0x2d')],{'$or':_[_0x8059('0x1a')](_0x352e51['attributes'],function(_0x2662a5){var _0x1c19b0={};_0x1c19b0[_0x2662a5]={'$like':'%'+_0x28b466[_0x8059('0x22')][_0x8059('0x29')]+'%'};return _0x1c19b0;})});}_0x352e51=_[_0x8059('0x2a')]({},_0x352e51,_0x28b466[_0x8059('0x2c')]);return _0x4449b3['getUsers'](_0x352e51);}})[_0x8059('0x10')](function(_0x2cdcc4){if(_0x2cdcc4){_0x20e9d7=_0x2cdcc4[_0x8059('0x25')];if(!_0x28b466['query']['hasOwnProperty'](_0x8059('0x43'))){_0x352e51[_0x8059('0xc')]=qs['limit'](_0x28b466[_0x8059('0x22')][_0x8059('0xc')]);_0x352e51[_0x8059('0xb')]=qs[_0x8059('0xb')](_0x28b466[_0x8059('0x22')][_0x8059('0xb')]);}return _0x4449b3[_0x8059('0x41')](_0x352e51);}})[_0x8059('0x10')](function(_0x27a1ca){if(_0x27a1ca){return _0x27a1ca?{'count':_0x20e9d7,'rows':_0x27a1ca}:null;}})[_0x8059('0x10')](respondWithResult(_0x410bf4,null))[_0x8059('0x33')](handleError(_0x410bf4,null));}; \ No newline at end of file +var _0x01d9=['SquareProject','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','production','addUsers','ids','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SquareProjects','agi','stringify','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x2edf7c,_0x413641){var _0x4f09a=function(_0x3de745){while(--_0x3de745){_0x2edf7c['push'](_0x2edf7c['shift']());}};_0x4f09a(++_0x413641);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var Redis=require(_0x901d('0x1'));var qs=require(_0x901d('0x2'));var logger=require(_0x901d('0x3'))('api');var config=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];config[_0x901d('0x6')]=_[_0x901d('0x7')](config[_0x901d('0x6')],{'host':_0x901d('0x8'),'port':0x18eb});var socket=require(_0x901d('0x9'))(new Redis(config['redis']));require(_0x901d('0xa'))[_0x901d('0xb')](socket);function respondWithStatusCode(_0x21e1d7,_0x12c39f){_0x12c39f=_0x12c39f||0xcc;return function(_0x313f85){if(_0x313f85){return _0x21e1d7[_0x901d('0xc')](_0x12c39f);}return _0x21e1d7[_0x901d('0xd')](_0x12c39f)[_0x901d('0xe')]();};}function respondWithResult(_0x15076e,_0xacff40){_0xacff40=_0xacff40||0xc8;return function(_0x440fb0){if(_0x440fb0){return _0x15076e[_0x901d('0xd')](_0xacff40)[_0x901d('0xf')](_0x440fb0);}};}function respondWithFilteredResult(_0x5d74e2,_0x439f17){return function(_0x5ba100){if(_0x5ba100){var _0x220153=typeof _0x439f17[_0x901d('0x10')]===_0x901d('0x11')&&typeof _0x439f17[_0x901d('0x12')]===_0x901d('0x11');var _0x5d2345=_0x5ba100[_0x901d('0x13')];var _0x31cbbd=_0x220153?0x0:_0x439f17[_0x901d('0x10')];var _0x1618a8=_0x220153?_0x5ba100[_0x901d('0x13')]:_0x439f17[_0x901d('0x10')]+_0x439f17['limit'];var _0x991ee2;if(_0x1618a8>=_0x5d2345){_0x1618a8=_0x5d2345;_0x991ee2=0xc8;}else{_0x991ee2=0xce;}_0x5d74e2[_0x901d('0xd')](_0x991ee2);return _0x5d74e2[_0x901d('0x14')](_0x901d('0x15'),_0x31cbbd+'-'+_0x1618a8+'/'+_0x5d2345)[_0x901d('0xf')](_0x5ba100);}return null;};}function saveUpdates(_0x7dd5f4){return function(_0x477cd4){if(_0x477cd4){return _0x477cd4[_0x901d('0x16')](_0x7dd5f4)[_0x901d('0x17')](function(_0x3b62e5){return _0x3b62e5;});}return null;};}function removeEntity(_0x28caae){return function(_0x390c33){if(_0x390c33){return _0x390c33[_0x901d('0x18')]()[_0x901d('0x17')](function(){var _0x38f42b=_0x390c33[_0x901d('0x19')]({'plain':!![]});var _0xf3c66a=_0x901d('0x1a');return db['UserProfileResource'][_0x901d('0x18')]({'where':{'type':_0xf3c66a,'resourceId':_0x38f42b['id']}})[_0x901d('0x17')](function(){return _0x390c33;});})['then'](function(){var _0x5bdff4=new Redis(config['redis']);_0x5bdff4['publish'](_0x901d('0x1b'),JSON[_0x901d('0x1c')]({'id':_0x390c33['id'],'deleted':!![]}));})['then'](function(){_0x28caae[_0x901d('0xd')](0xcc)[_0x901d('0xe')]();});}};}function handleEntityNotFound(_0x488e24){return function(_0x20778b){if(!_0x20778b){_0x488e24[_0x901d('0xc')](0x194);}return _0x20778b;};}function handleError(_0x2402de,_0x3f80b9){_0x3f80b9=_0x3f80b9||0x1f4;return function(_0x1e7d36){logger[_0x901d('0x1d')](_0x1e7d36[_0x901d('0x1e')]);if(_0x1e7d36[_0x901d('0x1f')]){delete _0x1e7d36['name'];}_0x2402de[_0x901d('0xd')](_0x3f80b9)[_0x901d('0x20')](_0x1e7d36);};}exports[_0x901d('0x21')]=function(_0x1f0ee5,_0x557809){var _0x293119={},_0x23fd43={},_0x27f4ca={'count':0x0,'rows':[]};var _0x3cbe43=_[_0x901d('0x22')](db['SquareProject'][_0x901d('0x23')],function(_0xc52d0f){return{'name':_0xc52d0f[_0x901d('0x24')],'type':_0xc52d0f[_0x901d('0x25')][_0x901d('0x26')]};});_0x23fd43[_0x901d('0x27')]=_['map'](_0x3cbe43,_0x901d('0x1f'));_0x23fd43['query']=_[_0x901d('0x28')](_0x1f0ee5[_0x901d('0x29')]);_0x23fd43[_0x901d('0x2a')]=_[_0x901d('0x2b')](_0x23fd43[_0x901d('0x27')],_0x23fd43[_0x901d('0x29')]);_0x293119[_0x901d('0x2c')]=_[_0x901d('0x2b')](_0x23fd43[_0x901d('0x27')],qs[_0x901d('0x2d')](_0x1f0ee5[_0x901d('0x29')][_0x901d('0x2d')]));_0x293119[_0x901d('0x2c')]=_0x293119[_0x901d('0x2c')][_0x901d('0x2e')]?_0x293119['attributes']:_0x23fd43[_0x901d('0x27')];if(!_0x1f0ee5[_0x901d('0x29')][_0x901d('0x2f')]('nolimit')){_0x293119[_0x901d('0x12')]=qs[_0x901d('0x12')](_0x1f0ee5[_0x901d('0x29')][_0x901d('0x12')]);_0x293119[_0x901d('0x10')]=qs[_0x901d('0x10')](_0x1f0ee5[_0x901d('0x29')][_0x901d('0x10')]);}_0x293119[_0x901d('0x30')]=qs[_0x901d('0x31')](_0x1f0ee5['query']['sort']);_0x293119[_0x901d('0x32')]=qs['filters'](_[_0x901d('0x33')](_0x1f0ee5[_0x901d('0x29')],_0x23fd43['filters']),_0x3cbe43);if(_0x1f0ee5[_0x901d('0x29')][_0x901d('0x34')]){_0x293119[_0x901d('0x32')]=_['merge'](_0x293119[_0x901d('0x32')],{'$or':_[_0x901d('0x22')](_0x3cbe43,function(_0x1a1f9c){if(_0x1a1f9c[_0x901d('0x25')]!==_0x901d('0x35')){var _0x32aa29={};_0x32aa29[_0x1a1f9c[_0x901d('0x1f')]]={'$like':'%'+_0x1f0ee5[_0x901d('0x29')][_0x901d('0x34')]+'%'};return _0x32aa29;}})});}_0x293119=_[_0x901d('0x36')]({},_0x293119,_0x1f0ee5[_0x901d('0x37')]);var _0x3d4f8b={'where':_0x293119[_0x901d('0x32')]};return db[_0x901d('0x38')][_0x901d('0x13')](_0x3d4f8b)[_0x901d('0x17')](function(_0x54a654){_0x27f4ca[_0x901d('0x13')]=_0x54a654;if(_0x1f0ee5[_0x901d('0x29')]['includeAll']){_0x293119['include']=[{'all':!![]}];}return db[_0x901d('0x38')]['findAll'](_0x293119);})[_0x901d('0x17')](function(_0x3d0556){_0x27f4ca[_0x901d('0x39')]=_0x3d0556;return _0x27f4ca;})[_0x901d('0x17')](respondWithFilteredResult(_0x557809,_0x293119))[_0x901d('0x3a')](handleError(_0x557809,null));};exports[_0x901d('0x3b')]=function(_0x5df4cb,_0x4ce6e4){var _0x4ee804={'raw':![],'where':{'id':_0x5df4cb[_0x901d('0x3c')]['id']}},_0x4c4fd0={};_0x4c4fd0[_0x901d('0x27')]=_['keys'](db[_0x901d('0x38')][_0x901d('0x23')]);_0x4c4fd0['query']=_[_0x901d('0x28')](_0x5df4cb[_0x901d('0x29')]);_0x4c4fd0[_0x901d('0x2a')]=_[_0x901d('0x2b')](_0x4c4fd0['model'],_0x4c4fd0['query']);_0x4ee804[_0x901d('0x2c')]=_[_0x901d('0x2b')](_0x4c4fd0[_0x901d('0x27')],qs[_0x901d('0x2d')](_0x5df4cb[_0x901d('0x29')][_0x901d('0x2d')]));_0x4ee804[_0x901d('0x2c')]=_0x4ee804[_0x901d('0x2c')][_0x901d('0x2e')]?_0x4ee804[_0x901d('0x2c')]:_0x4c4fd0[_0x901d('0x27')];if(_0x5df4cb['query'][_0x901d('0x3d')]){_0x4ee804['include']=[{'all':!![]}];}_0x4ee804=_[_0x901d('0x36')]({},_0x4ee804,_0x5df4cb['options']);return db[_0x901d('0x38')]['find'](_0x4ee804)[_0x901d('0x17')](handleEntityNotFound(_0x4ce6e4,null))[_0x901d('0x17')](respondWithResult(_0x4ce6e4,null))[_0x901d('0x3a')](handleError(_0x4ce6e4,null));};exports[_0x901d('0x3e')]=function(_0x2fc1d2,_0x2787ae){return db[_0x901d('0x38')][_0x901d('0x3e')](_0x2fc1d2[_0x901d('0x3f')],{})[_0x901d('0x17')](function(_0x1a27c0){var _0x54fc19=_0x2fc1d2[_0x901d('0x40')][_0x901d('0x19')]({'plain':!![]});if(!_0x54fc19)throw new Error(_0x901d('0x41'));if(_0x54fc19[_0x901d('0x42')]===_0x901d('0x40')){var _0x24b6fa=_0x1a27c0[_0x901d('0x19')]({'plain':!![]});var _0x43135c=_0x901d('0x1a');return db[_0x901d('0x43')][_0x901d('0x44')]({'where':{'name':_0x43135c,'userProfileId':_0x54fc19[_0x901d('0x45')]},'raw':!![]})[_0x901d('0x17')](function(_0x23f2a9){if(_0x23f2a9&&_0x23f2a9['autoAssociation']===0x0){return db['UserProfileResource'][_0x901d('0x3e')]({'name':_0x24b6fa[_0x901d('0x1f')],'resourceId':_0x24b6fa['id'],'type':_0x23f2a9[_0x901d('0x1f')],'sectionId':_0x23f2a9['id']},{})[_0x901d('0x17')](function(){return _0x1a27c0;});}else{return _0x1a27c0;}})[_0x901d('0x3a')](function(_0x5cbc90){logger['error'](_0x901d('0x46'),_0x5cbc90);throw _0x5cbc90;});}return _0x1a27c0;})[_0x901d('0x17')](respondWithResult(_0x2787ae,0xc9))['catch'](handleError(_0x2787ae,null));};exports[_0x901d('0x16')]=function(_0x165207,_0x4d2b2d){if(_0x165207[_0x901d('0x3f')]['id']){delete _0x165207['body']['id'];}return db[_0x901d('0x38')][_0x901d('0x44')]({'where':{'id':_0x165207[_0x901d('0x3c')]['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x4d2b2d,null))['then'](saveUpdates(_0x165207[_0x901d('0x3f')],null))[_0x901d('0x17')](function(_0x1d5880){if(!_0x1d5880)return;var _0x8af950=_0x1d5880[_0x901d('0x19')]({'plain':!![]});return _0x8af950;})[_0x901d('0x17')](function(_0x17c716){var _0x42ddd=new Redis(config[_0x901d('0x6')]);_0x42ddd[_0x901d('0x47')]('agi',JSON[_0x901d('0x1c')](_['pick'](_0x17c716,['id',_0x901d('0x1f'),_0x901d('0x48')])));return _0x17c716;})[_0x901d('0x17')](respondWithResult(_0x4d2b2d,null))[_0x901d('0x3a')](handleError(_0x4d2b2d,null));};exports[_0x901d('0x18')]=function(_0x21f3bd,_0x45c730){return db[_0x901d('0x38')]['find']({'where':{'id':_0x21f3bd[_0x901d('0x3c')]['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x45c730,null))[_0x901d('0x17')](removeEntity(_0x45c730,null))['catch'](handleError(_0x45c730,null));};exports[_0x901d('0x49')]=function(_0x5d049d,_0x1c99ce){return db[_0x901d('0x38')][_0x901d('0x44')]({'where':{'id':_0x5d049d['params']['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x1c99ce,null))[_0x901d('0x17')](function(_0x3740a3){if(_0x3740a3){return _0x3740a3[_0x901d('0x49')](_0x5d049d[_0x901d('0x3f')][_0x901d('0x4a')],_['omit'](_0x5d049d[_0x901d('0x3f')],[_0x901d('0x4a'),'id'])||{});}})[_0x901d('0x17')](respondWithResult(_0x1c99ce,null))[_0x901d('0x3a')](handleError(_0x1c99ce,null));};exports[_0x901d('0x4b')]=function(_0x41f8a5,_0x52eb30){return db[_0x901d('0x38')]['find']({'where':{'id':_0x41f8a5['params']['id']}})['then'](handleEntityNotFound(_0x52eb30,null))['then'](function(_0x23a9aa){if(_0x23a9aa){return _0x23a9aa[_0x901d('0x4b')](_0x41f8a5[_0x901d('0x29')]['ids'])[_0x901d('0x17')](function(){if(_['isArray'](_0x41f8a5[_0x901d('0x29')][_0x901d('0x4a')])){for(var _0xecc8f9=0x0;_0xecc8f9<_0x41f8a5[_0x901d('0x29')][_0x901d('0x4a')][_0x901d('0x2e')];_0xecc8f9+=0x1){socket[_0x901d('0x4c')](_0x901d('0x4d'),{'UserId':Number(_0x41f8a5[_0x901d('0x29')][_0x901d('0x4a')][_0xecc8f9]),'SquareProjectId':Number(_0x41f8a5[_0x901d('0x3c')]['id'])});}}else{socket[_0x901d('0x4c')](_0x901d('0x4d'),{'UserId':Number(_0x41f8a5[_0x901d('0x29')]['ids']),'SquareProjectId':Number(_0x41f8a5['params']['id'])});}});}})[_0x901d('0x17')](respondWithStatusCode(_0x52eb30,null))[_0x901d('0x3a')](handleError(_0x52eb30,null));};exports[_0x901d('0x4e')]=function(_0x3fbb32,_0x109e0a){var _0x383b06={};var _0x2d6431={};var _0x4e9d42;var _0x596a04;return db['SquareProject'][_0x901d('0x4f')]({'where':{'id':_0x3fbb32[_0x901d('0x3c')]['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x109e0a,null))[_0x901d('0x17')](function(_0x32bb51){if(_0x32bb51){_0x4e9d42=_0x32bb51;_0x2d6431[_0x901d('0x27')]=_[_0x901d('0x28')](db[_0x901d('0x50')][_0x901d('0x23')]);_0x2d6431['query']=_['keys'](_0x3fbb32[_0x901d('0x29')]);_0x2d6431[_0x901d('0x2a')]=_[_0x901d('0x2b')](_0x2d6431[_0x901d('0x27')],_0x2d6431[_0x901d('0x29')]);_0x383b06[_0x901d('0x2c')]=_[_0x901d('0x2b')](_0x2d6431[_0x901d('0x27')],qs[_0x901d('0x2d')](_0x3fbb32[_0x901d('0x29')]['fields']));_0x383b06[_0x901d('0x2c')]=_0x383b06[_0x901d('0x2c')]['length']?_0x383b06['attributes']:_0x2d6431[_0x901d('0x27')];_0x383b06[_0x901d('0x30')]=qs['sort'](_0x3fbb32[_0x901d('0x29')][_0x901d('0x31')]);_0x383b06[_0x901d('0x32')]=qs[_0x901d('0x2a')](_['pick'](_0x3fbb32[_0x901d('0x29')],_0x2d6431[_0x901d('0x2a')]));if(_0x3fbb32[_0x901d('0x29')][_0x901d('0x34')]){_0x383b06[_0x901d('0x32')]=_[_0x901d('0x36')](_0x383b06['where'],{'$or':_[_0x901d('0x22')](_0x383b06[_0x901d('0x2c')],function(_0x26b498){var _0x5763ef={};_0x5763ef[_0x26b498]={'$like':'%'+_0x3fbb32[_0x901d('0x29')][_0x901d('0x34')]+'%'};return _0x5763ef;})});}_0x383b06=_[_0x901d('0x36')]({},_0x383b06,_0x3fbb32['options']);return _0x4e9d42['getUsers'](_0x383b06);}})['then'](function(_0x2350ac){if(_0x2350ac){_0x596a04=_0x2350ac[_0x901d('0x2e')];if(!_0x3fbb32['query']['hasOwnProperty'](_0x901d('0x51'))){_0x383b06[_0x901d('0x12')]=qs[_0x901d('0x12')](_0x3fbb32[_0x901d('0x29')][_0x901d('0x12')]);_0x383b06['offset']=qs[_0x901d('0x10')](_0x3fbb32[_0x901d('0x29')][_0x901d('0x10')]);}return _0x4e9d42[_0x901d('0x4e')](_0x383b06);}})['then'](function(_0x2e1dcb){if(_0x2e1dcb){return _0x2e1dcb?{'count':_0x596a04,'rows':_0x2e1dcb}:null;}})['then'](respondWithResult(_0x109e0a,null))[_0x901d('0x3a')](handleError(_0x109e0a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 471d097..ee6b2af 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 _0x2920=['events','../../mysqldb','SquareProject','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4f59f1,_0x4e4090){var _0x372f8d=function(_0x35c767){while(--_0x35c767){_0x4f59f1['push'](_0x4f59f1['shift']());}};_0x372f8d(++_0x4e4090);}(_0x2920,0x80));var _0x0292=function(_0xde11ed,_0x40eaba){_0xde11ed=_0xde11ed-0x0;var _0x173b45=_0x2920[_0xde11ed];return _0x173b45;};'use strict';var EventEmitter=require(_0x0292('0x0'));var SquareProject=require(_0x0292('0x1'))['db'][_0x0292('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0292('0x3')};function emitEvent(_0x231af5){return function(_0x25949d,_0x49fd32,_0x5ca802){SquareProjectEvents[_0x0292('0x4')](_0x231af5+':'+_0x25949d['id'],_0x25949d);SquareProjectEvents['emit'](_0x231af5,_0x25949d);_0x5ca802(null);};}for(var e in events){if(events[_0x0292('0x5')](e)){var event=events[e];SquareProject[_0x0292('0x6')](e,emitEvent(event));}}module[_0x0292('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x4ffa=['../../mysqldb','save','update','remove','emit','hook'];(function(_0x3584b2,_0x55d909){var _0x3db4d9=function(_0x278e05){while(--_0x278e05){_0x3584b2['push'](_0x3584b2['shift']());}};_0x3db4d9(++_0x55d909);}(_0x4ffa,0xf0));var _0xa4ff=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4ffa[_0x5d6456];return _0x4d66c1;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xa4ff('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa4ff('0x1'),'afterUpdate':_0xa4ff('0x2'),'afterDestroy':_0xa4ff('0x3')};function emitEvent(_0x4e4cf4){return function(_0x42ed30,_0x4ed0ff,_0x18d990){SquareProjectEvents[_0xa4ff('0x4')](_0x4e4cf4+':'+_0x42ed30['id'],_0x42ed30);SquareProjectEvents[_0xa4ff('0x4')](_0x4e4cf4,_0x42ed30);_0x18d990(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xa4ff('0x5')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index feff86c..e8beceb 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 _0x635c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','SquareProject','square_projects','changed','savedAt','production','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x23a314,_0x3fe032){var _0x2dd093=function(_0x24a712){while(--_0x24a712){_0x23a314['push'](_0x23a314['shift']());}};_0x2dd093(++_0x3fe032);}(_0x635c,0x90));var _0xc635=function(_0x4cdaf6,_0xaa38b2){_0x4cdaf6=_0x4cdaf6-0x0;var _0x7f0c64=_0x635c[_0x4cdaf6];return _0x7f0c64;};'use strict';var _=require(_0xc635('0x0'));var util=require(_0xc635('0x1'));var logger=require(_0xc635('0x2'))(_0xc635('0x3'));var moment=require(_0xc635('0x4'));var BPromise=require('bluebird');var rp=require(_0xc635('0x5'));var fs=require('fs');var path=require(_0xc635('0x6'));var rimraf=require(_0xc635('0x7'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0xc635('0x8')]=function(_0x116e44,_0x105b45){return _0x116e44['define'](_0xc635('0x9'),attributes,{'tableName':_0xc635('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e4456,_0x580203,_0x53b88c){if(_0x1e4456[_0xc635('0xb')]('preproduction')){_0x1e4456[_0xc635('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1e4456[_0xc635('0xb')](_0xc635('0xd'))){_0x1e4456['publishedAt']=moment()[_0xc635('0xe')](_0xc635('0xf'));}_0x53b88c(null,_0x1e4456);}}});}; \ No newline at end of file +var _0x6003=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6003,0xd0));var _0x3600=function(_0x59d339,_0x10fb52){_0x59d339=_0x59d339-0x0;var _0x1923cf=_0x6003[_0x59d339];return _0x1923cf;};'use strict';var _=require(_0x3600('0x0'));var util=require(_0x3600('0x1'));var logger=require(_0x3600('0x2'))(_0x3600('0x3'));var moment=require(_0x3600('0x4'));var BPromise=require(_0x3600('0x5'));var rp=require(_0x3600('0x6'));var fs=require('fs');var path=require(_0x3600('0x7'));var rimraf=require(_0x3600('0x8'));var config=require(_0x3600('0x9'));var attributes=require(_0x3600('0xa'));module['exports']=function(_0x32ea9e,_0x3409b5){return _0x32ea9e[_0x3600('0xb')](_0x3600('0xc'),attributes,{'tableName':_0x3600('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1341f1,_0x14f0fa,_0x4a3adc){if(_0x1341f1[_0x3600('0xe')](_0x3600('0xf'))){_0x1341f1[_0x3600('0x10')]=moment()[_0x3600('0x11')](_0x3600('0x12'));}if(_0x1341f1[_0x3600('0xe')](_0x3600('0x13'))){_0x1341f1[_0x3600('0x14')]=moment()['format'](_0x3600('0x12'));}_0x4a3adc(null,_0x1341f1);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 97310d0..4b2de48 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 _0x8ebf=['attributes','limit','include','model','map','then','info','debug','stringify','catch','error','message','ShowSquareProject','SquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','redis','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','where'];(function(_0x531ca7,_0x3cc837){var _0x25d395=function(_0x2b5661){while(--_0x2b5661){_0x531ca7['push'](_0x531ca7['shift']());}};_0x25d395(++_0x3cc837);}(_0x8ebf,0x1b2));var _0xf8eb=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8ebf[_0x432682];return _0x463d05;};'use strict';var _=require(_0xf8eb('0x0'));var Redis=require(_0xf8eb('0x1'));var db=require(_0xf8eb('0x2'))['db'];var logger=require(_0xf8eb('0x3'))(_0xf8eb('0x4'));var config=require('../../config/environment');config[_0xf8eb('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf8eb('0x6'))(new Redis(config[_0xf8eb('0x5')]));require(_0xf8eb('0x7'))[_0xf8eb('0x8')](socket);exports[_0xf8eb('0x9')]=function(_0x34aea0){var _0x4a8b05=this;return new Promise(function(_0x4552ac,_0x51420a){return db['SquareProject'][_0xf8eb('0xa')]({'raw':_0x34aea0[_0xf8eb('0xb')]?_0x34aea0[_0xf8eb('0xb')][_0xf8eb('0xc')]===undefined?!![]:![]:!![],'where':_0x34aea0['options']?_0x34aea0[_0xf8eb('0xb')][_0xf8eb('0xd')]||null:null,'attributes':_0x34aea0[_0xf8eb('0xb')]?_0x34aea0[_0xf8eb('0xb')][_0xf8eb('0xe')]||null:null,'limit':_0x34aea0['options']?_0x34aea0[_0xf8eb('0xb')][_0xf8eb('0xf')]||null:null,'include':_0x34aea0['options']?_0x34aea0[_0xf8eb('0xb')][_0xf8eb('0x10')]?_['map'](_0x34aea0['options']['include'],function(_0x492ccd){return{'model':db[_0x492ccd[_0xf8eb('0x11')]],'as':_0x492ccd['as'],'attributes':_0x492ccd[_0xf8eb('0xe')],'include':_0x492ccd['include']?_[_0xf8eb('0x12')](_0x492ccd['include'],function(_0x1530b8){return{'model':db[_0x1530b8[_0xf8eb('0x11')]],'as':_0x1530b8['as'],'attributes':_0x1530b8[_0xf8eb('0xe')],'include':_0x1530b8['include']?_[_0xf8eb('0x12')](_0x1530b8[_0xf8eb('0x10')],function(_0x4c10b6){return{'model':db[_0x4c10b6[_0xf8eb('0x11')]],'as':_0x4c10b6['as'],'attributes':_0x4c10b6[_0xf8eb('0xe')]};}):[]};}):[]};}):[]:[]})[_0xf8eb('0x13')](function(_0x274aff){logger[_0xf8eb('0x14')](_0xf8eb('0x9'),_0x34aea0);logger[_0xf8eb('0x15')](_0xf8eb('0x9'),_0x34aea0,JSON[_0xf8eb('0x16')](_0x274aff));_0x4552ac(_0x274aff);})[_0xf8eb('0x17')](function(_0x199f1e){logger[_0xf8eb('0x18')](_0xf8eb('0x9'),_0x199f1e[_0xf8eb('0x19')],_0x34aea0);_0x51420a(_0x4a8b05['error'](0x1f4,_0x199f1e[_0xf8eb('0x19')]));});});};exports[_0xf8eb('0x1a')]=function(_0x498c15){var _0x3f1109=this;return new Promise(function(_0x4abe1f,_0x299a29){return db[_0xf8eb('0x1b')]['find']({'raw':_0x498c15[_0xf8eb('0xb')]?_0x498c15[_0xf8eb('0xb')][_0xf8eb('0xc')]===undefined?!![]:![]:!![],'where':_0x498c15[_0xf8eb('0xb')]?_0x498c15['options'][_0xf8eb('0xd')]||null:null,'attributes':_0x498c15['options']?_0x498c15['options'][_0xf8eb('0xe')]||null:null,'include':_0x498c15[_0xf8eb('0xb')]?_0x498c15[_0xf8eb('0xb')][_0xf8eb('0x10')]?_[_0xf8eb('0x12')](_0x498c15['options']['include'],function(_0x5399d5){return{'model':db[_0x5399d5[_0xf8eb('0x11')]],'as':_0x5399d5['as'],'attributes':_0x5399d5[_0xf8eb('0xe')],'include':_0x5399d5[_0xf8eb('0x10')]?_[_0xf8eb('0x12')](_0x5399d5[_0xf8eb('0x10')],function(_0x2e28dd){return{'model':db[_0x2e28dd[_0xf8eb('0x11')]],'as':_0x2e28dd['as'],'attributes':_0x2e28dd[_0xf8eb('0xe')],'include':_0x2e28dd[_0xf8eb('0x10')]?_[_0xf8eb('0x12')](_0x2e28dd[_0xf8eb('0x10')],function(_0x51e722){return{'model':db[_0x51e722[_0xf8eb('0x11')]],'as':_0x51e722['as'],'attributes':_0x51e722[_0xf8eb('0xe')]};}):[]};}):[]};}):[]:[]})[_0xf8eb('0x13')](function(_0x10e8cc){logger[_0xf8eb('0x14')]('ShowSquareProject',_0x498c15);logger[_0xf8eb('0x15')](_0xf8eb('0x1a'),_0x498c15,JSON[_0xf8eb('0x16')](_0x10e8cc));_0x4abe1f(_0x10e8cc);})[_0xf8eb('0x17')](function(_0x1f50fe){logger[_0xf8eb('0x18')]('ShowSquareProject',_0x1f50fe[_0xf8eb('0x19')],_0x498c15);_0x299a29(_0x3f1109[_0xf8eb('0x18')](0x1f4,_0x1f50fe[_0xf8eb('0x19')]));});});}; \ No newline at end of file +var _0xbb62=['raw','where','limit','include','map','model','attributes','then','info','stringify','error','message','ShowSquareProject','debug','catch','ioredis','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options'];(function(_0x59b4c5,_0x70659a){var _0x6b253e=function(_0x2edd7d){while(--_0x2edd7d){_0x59b4c5['push'](_0x59b4c5['shift']());}};_0x6b253e(++_0x70659a);}(_0xbb62,0x96));var _0x2bb6=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0xbb62[_0x4d1ee9];return _0x9a5456;};'use strict';var _=require('lodash');var Redis=require(_0x2bb6('0x0'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x2bb6('0x1'));config[_0x2bb6('0x2')]=_[_0x2bb6('0x3')](config['redis'],{'host':_0x2bb6('0x4'),'port':0x18eb});var socket=require(_0x2bb6('0x5'))(new Redis(config[_0x2bb6('0x2')]));require(_0x2bb6('0x6'))[_0x2bb6('0x7')](socket);exports[_0x2bb6('0x8')]=function(_0x52874a){var _0x594eab=this;return new Promise(function(_0x20c642,_0x2f8a4b){return db[_0x2bb6('0x9')][_0x2bb6('0xa')]({'raw':_0x52874a[_0x2bb6('0xb')]?_0x52874a['options'][_0x2bb6('0xc')]===undefined?!![]:![]:!![],'where':_0x52874a[_0x2bb6('0xb')]?_0x52874a[_0x2bb6('0xb')][_0x2bb6('0xd')]||null:null,'attributes':_0x52874a[_0x2bb6('0xb')]?_0x52874a['options']['attributes']||null:null,'limit':_0x52874a[_0x2bb6('0xb')]?_0x52874a[_0x2bb6('0xb')][_0x2bb6('0xe')]||null:null,'include':_0x52874a[_0x2bb6('0xb')]?_0x52874a['options'][_0x2bb6('0xf')]?_[_0x2bb6('0x10')](_0x52874a['options']['include'],function(_0x45099c){return{'model':db[_0x45099c[_0x2bb6('0x11')]],'as':_0x45099c['as'],'attributes':_0x45099c[_0x2bb6('0x12')],'include':_0x45099c[_0x2bb6('0xf')]?_[_0x2bb6('0x10')](_0x45099c[_0x2bb6('0xf')],function(_0x1855f5){return{'model':db[_0x1855f5[_0x2bb6('0x11')]],'as':_0x1855f5['as'],'attributes':_0x1855f5[_0x2bb6('0x12')],'include':_0x1855f5[_0x2bb6('0xf')]?_[_0x2bb6('0x10')](_0x1855f5['include'],function(_0x117a0e){return{'model':db[_0x117a0e[_0x2bb6('0x11')]],'as':_0x117a0e['as'],'attributes':_0x117a0e[_0x2bb6('0x12')]};}):[]};}):[]};}):[]:[]})[_0x2bb6('0x13')](function(_0x5acada){logger[_0x2bb6('0x14')]('GetSquareProjects',_0x52874a);logger['debug'](_0x2bb6('0x8'),_0x52874a,JSON[_0x2bb6('0x15')](_0x5acada));_0x20c642(_0x5acada);})['catch'](function(_0x33792b){logger[_0x2bb6('0x16')](_0x2bb6('0x8'),_0x33792b[_0x2bb6('0x17')],_0x52874a);_0x2f8a4b(_0x594eab[_0x2bb6('0x16')](0x1f4,_0x33792b[_0x2bb6('0x17')]));});});};exports[_0x2bb6('0x18')]=function(_0x20e5d2){var _0xa242e9=this;return new Promise(function(_0x28faaf,_0x238af0){return db[_0x2bb6('0x9')]['find']({'raw':_0x20e5d2[_0x2bb6('0xb')]?_0x20e5d2['options'][_0x2bb6('0xc')]===undefined?!![]:![]:!![],'where':_0x20e5d2['options']?_0x20e5d2[_0x2bb6('0xb')][_0x2bb6('0xd')]||null:null,'attributes':_0x20e5d2[_0x2bb6('0xb')]?_0x20e5d2[_0x2bb6('0xb')]['attributes']||null:null,'include':_0x20e5d2[_0x2bb6('0xb')]?_0x20e5d2[_0x2bb6('0xb')][_0x2bb6('0xf')]?_[_0x2bb6('0x10')](_0x20e5d2[_0x2bb6('0xb')]['include'],function(_0x21e104){return{'model':db[_0x21e104[_0x2bb6('0x11')]],'as':_0x21e104['as'],'attributes':_0x21e104[_0x2bb6('0x12')],'include':_0x21e104[_0x2bb6('0xf')]?_[_0x2bb6('0x10')](_0x21e104['include'],function(_0x26a549){return{'model':db[_0x26a549[_0x2bb6('0x11')]],'as':_0x26a549['as'],'attributes':_0x26a549[_0x2bb6('0x12')],'include':_0x26a549[_0x2bb6('0xf')]?_[_0x2bb6('0x10')](_0x26a549[_0x2bb6('0xf')],function(_0x5611f8){return{'model':db[_0x5611f8[_0x2bb6('0x11')]],'as':_0x5611f8['as'],'attributes':_0x5611f8[_0x2bb6('0x12')]};}):[]};}):[]};}):[]:[]})[_0x2bb6('0x13')](function(_0xa69918){logger[_0x2bb6('0x14')](_0x2bb6('0x18'),_0x20e5d2);logger[_0x2bb6('0x19')](_0x2bb6('0x18'),_0x20e5d2,JSON[_0x2bb6('0x15')](_0xa69918));_0x28faaf(_0xa69918);})[_0x2bb6('0x1a')](function(_0x5e27df){logger[_0x2bb6('0x16')](_0x2bb6('0x18'),_0x5e27df[_0x2bb6('0x17')],_0x20e5d2);_0x238af0(_0xa242e9[_0x2bb6('0x16')](0x1f4,_0x5e27df[_0x2bb6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 92a9ff1..8bdaec8 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 _0x0f02=['update','emit','removeListener','register','length','squareProject:','save','remove'];(function(_0x31e123,_0x20e3e7){var _0x387415=function(_0xc4e749){while(--_0xc4e749){_0x31e123['push'](_0x31e123['shift']());}};_0x387415(++_0x20e3e7);}(_0x0f02,0x1ae));var _0x20f0=function(_0x25cf97,_0x327a9e){_0x25cf97=_0x25cf97-0x0;var _0x51d584=_0x0f02[_0x25cf97];return _0x51d584;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x20f0('0x0'),_0x20f0('0x1'),_0x20f0('0x2')];function createListener(_0x478e88,_0x2d2014){return function(_0x367bc7){_0x2d2014[_0x20f0('0x3')](_0x478e88,_0x367bc7);};}function removeListener(_0x3eea3b,_0x9a61eb){return function(){SquareProjectEvents[_0x20f0('0x4')](_0x3eea3b,_0x9a61eb);};}exports[_0x20f0('0x5')]=function(_0x4d3ca8){for(var _0x3102f2=0x0,_0x1171e9=events[_0x20f0('0x6')];_0x3102f2<_0x1171e9;_0x3102f2++){var _0xbce052=events[_0x3102f2];var _0x1d204c=createListener(_0x20f0('0x7')+_0xbce052,_0x4d3ca8);SquareProjectEvents['on'](_0xbce052,_0x1d204c);}}; \ No newline at end of file +var _0xda69=['removeListener','register','length','squareProject:','remove','update'];(function(_0x29a894,_0x5f2d6f){var _0x588f68=function(_0x3a19cf){while(--_0x3a19cf){_0x29a894['push'](_0x29a894['shift']());}};_0x588f68(++_0x5f2d6f);}(_0xda69,0x112));var _0x9da6=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0xda69[_0x56ba92];return _0x8fe94d;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0x9da6('0x0'),_0x9da6('0x1')];function createListener(_0x43a4f0,_0x232415){return function(_0x843b4d){_0x232415['emit'](_0x43a4f0,_0x843b4d);};}function removeListener(_0x31a4a5,_0x4521c9){return function(){SquareProjectEvents[_0x9da6('0x2')](_0x31a4a5,_0x4521c9);};}exports[_0x9da6('0x3')]=function(_0x588b6c){for(var _0x57ac8f=0x0,_0x491942=events[_0x9da6('0x4')];_0x57ac8f<_0x491942;_0x57ac8f++){var _0x3ed8c1=events[_0x57ac8f];var _0x2fcfd6=createListener(_0x9da6('0x5')+_0x3ed8c1,_0x588b6c);SquareProjectEvents['on'](_0x3ed8c1,_0x2fcfd6);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 5d77ffa..9119513 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 _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5c65e7,_0x5dc157){var _0x559132=function(_0x3856c5){while(--_0x3856c5){_0x5c65e7['push'](_0x5c65e7['shift']());}};_0x559132(++_0x5dc157);}(_0xf494,0x1c6));var _0x4f49=function(_0x283f68,_0x4cbc63){_0x283f68=_0x283f68-0x0;var _0x51b05b=_0xf494[_0x283f68];return _0x51b05b;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x19f8b6,_0x2b4e8c){var _0x213ebc=function(_0x40fc8c){while(--_0x40fc8c){_0x19f8b6['push'](_0x19f8b6['shift']());}};_0x213ebc(++_0x2b4e8c);}(_0x326f,0xd1));var _0xf326=function(_0x49793e,_0x1b97fa){_0x49793e=_0x49793e-0x0;var _0x152df8=_0x326f[_0x49793e];return _0x152df8;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 49b6748..4584724 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 _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x4bccaf,_0x4bdf3d){var _0x4458b2=function(_0x1c2f7b){while(--_0x1c2f7b){_0x4bccaf['push'](_0x4bccaf['shift']());}};_0x4458b2(++_0x4bdf3d);}(_0x2675,0x75));var _0x5267=function(_0x57eb96,_0x130f9d){_0x57eb96=_0x57eb96-0x0;var _0x13e34a=_0x2675[_0x57eb96];return _0x13e34a;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file +var _0xac31=['STRING','VIRTUAL','savePath','lastIndexOf','sequelize','exports'];(function(_0x48de84,_0x291585){var _0x186874=function(_0x4e92c4){while(--_0x4e92c4){_0x48de84['push'](_0x48de84['shift']());}};_0x186874(++_0x291585);}(_0xac31,0xca));var _0x1ac3=function(_0xa30f55,_0x382ad8){_0xa30f55=_0xa30f55-0x0;var _0x5d3d9a=_0xac31[_0xa30f55];return _0x5d3d9a;};'use strict';var Sequelize=require(_0x1ac3('0x0'));module[_0x1ac3('0x1')]={'uniqueid':{'type':Sequelize[_0x1ac3('0x2')]},'callerid':{'type':Sequelize[_0x1ac3('0x2')]},'calleridname':{'type':Sequelize[_0x1ac3('0x2')]},'context':{'type':Sequelize[_0x1ac3('0x2')]},'extension':{'type':Sequelize[_0x1ac3('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1ac3('0x2')]},'dnid':{'type':Sequelize[_0x1ac3('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x1ac3('0x2')]},'savePath':{'type':Sequelize[_0x1ac3('0x2')]},'format':{'type':Sequelize[_0x1ac3('0x3')],'get':function(){var _0x1be223='';var _0x157604=this['getDataValue'](_0x1ac3('0x4'));if(_0x157604){_0x1be223=_0x157604['substring'](_0x157604[_0x1ac3('0x5')]('.'));}return _0x1be223;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a898a20..bbd1218 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 _0x88e2=['path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','offset','limit','count','set','Content-Range','json','apply','update','then','destroy','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SquareRecording','include','findAll','rows','catch','show','params','includeAll','options','create','body','download','uniqueid','find','savePath','filename','format','existsSync','decryptFile','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','end','eml-format','zip-dir','request-promise','moment','bluebird','util'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x88e2,0x10e));var _0x288e=function(_0x1d4ee6,_0x3b4c1e){_0x1d4ee6=_0x1d4ee6-0x0;var _0x510683=_0x88e2[_0x1d4ee6];return _0x510683;};'use strict';var emlformat=require(_0x288e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x288e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x288e('0x2'));var moment=require(_0x288e('0x3'));var BPromise=require(_0x288e('0x4'));var Mustache=require('mustache');var util=require(_0x288e('0x5'));var path=require(_0x288e('0x6'));var sox=require(_0x288e('0x7'));var csv=require(_0x288e('0x8'));var ejs=require(_0x288e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x288e('0xa'));var squel=require(_0x288e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x288e('0xc'));var toCsv=require(_0x288e('0x8'));var querystring=require(_0x288e('0xd'));var Papa=require(_0x288e('0xe'));var Redis=require(_0x288e('0xf'));var authService=require(_0x288e('0x10'));var qs=require(_0x288e('0x11'));var as=require(_0x288e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x288e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x288e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x288e('0x15'))['db'];function respondWithStatusCode(_0x13d9fb,_0xceb91){_0xceb91=_0xceb91||0xcc;return function(_0x3a7016){if(_0x3a7016){return _0x13d9fb['sendStatus'](_0xceb91);}return _0x13d9fb[_0x288e('0x16')](_0xceb91)['end']();};}function respondWithResult(_0x5599a1,_0x220689){_0x220689=_0x220689||0xc8;return function(_0x2e789e){if(_0x2e789e){return _0x5599a1['status'](_0x220689)['json'](_0x2e789e);}};}function respondWithFilteredResult(_0x37d8dc,_0x3d7650){return function(_0x4a9086){if(_0x4a9086){var _0x2207e8=typeof _0x3d7650[_0x288e('0x17')]==='undefined'&&typeof _0x3d7650[_0x288e('0x18')]==='undefined';var _0x4931f5=_0x4a9086[_0x288e('0x19')];var _0x21c47a=_0x2207e8?0x0:_0x3d7650[_0x288e('0x17')];var _0x5813f2=_0x2207e8?_0x4a9086['count']:_0x3d7650[_0x288e('0x17')]+_0x3d7650[_0x288e('0x18')];var _0x1388c7;if(_0x5813f2>=_0x4931f5){_0x5813f2=_0x4931f5;_0x1388c7=0xc8;}else{_0x1388c7=0xce;}_0x37d8dc[_0x288e('0x16')](_0x1388c7);return _0x37d8dc[_0x288e('0x1a')](_0x288e('0x1b'),_0x21c47a+'-'+_0x5813f2+'/'+_0x4931f5)[_0x288e('0x1c')](_0x4a9086);}return null;};}function patchUpdates(_0x919a89){return function(_0x1e554e){try{jsonpatch[_0x288e('0x1d')](_0x1e554e,_0x919a89,!![]);}catch(_0x4d27ed){return BPromise['reject'](_0x4d27ed);}return _0x1e554e['save']();};}function saveUpdates(_0x1258c9,_0x1831cf){return function(_0x3c9118){if(_0x3c9118){return _0x3c9118[_0x288e('0x1e')](_0x1258c9)[_0x288e('0x1f')](function(_0x334209){return _0x334209;});}return null;};}function removeEntity(_0x131aed,_0x4f5e38){return function(_0x1922ab){if(_0x1922ab){return _0x1922ab[_0x288e('0x20')]()[_0x288e('0x1f')](function(){_0x131aed[_0x288e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1090cc,_0x7427cc){return function(_0x1d2841){if(!_0x1d2841){_0x1090cc['sendStatus'](0x194);}return _0x1d2841;};}function handleError(_0x40c6f4,_0x2a0161){_0x2a0161=_0x2a0161||0x1f4;return function(_0x249ae3){logger[_0x288e('0x21')](_0x249ae3[_0x288e('0x22')]);if(_0x249ae3['name']){delete _0x249ae3[_0x288e('0x23')];}_0x40c6f4[_0x288e('0x16')](_0x2a0161)['send'](_0x249ae3);};}exports[_0x288e('0x24')]=function(_0x18d746,_0x27951d){var _0x5cd52d={},_0x2e55a3={},_0x489a43={'count':0x0,'rows':[]};var _0x102f92=_[_0x288e('0x25')](db['SquareRecording'][_0x288e('0x26')],function(_0x1ea531){return{'name':_0x1ea531['fieldName'],'type':_0x1ea531[_0x288e('0x27')]['key']};});_0x2e55a3[_0x288e('0x28')]=_[_0x288e('0x25')](_0x102f92,_0x288e('0x23'));_0x2e55a3[_0x288e('0x29')]=_[_0x288e('0x2a')](_0x18d746[_0x288e('0x29')]);_0x2e55a3[_0x288e('0x2b')]=_['intersection'](_0x2e55a3[_0x288e('0x28')],_0x2e55a3[_0x288e('0x29')]);_0x5cd52d[_0x288e('0x2c')]=_[_0x288e('0x2d')](_0x2e55a3[_0x288e('0x28')],qs[_0x288e('0x2e')](_0x18d746[_0x288e('0x29')][_0x288e('0x2e')]));_0x5cd52d['attributes']=_0x5cd52d['attributes'][_0x288e('0x2f')]?_0x5cd52d[_0x288e('0x2c')]:_0x2e55a3[_0x288e('0x28')];if(!_0x18d746['query'][_0x288e('0x30')](_0x288e('0x31'))){_0x5cd52d[_0x288e('0x18')]=qs[_0x288e('0x18')](_0x18d746[_0x288e('0x29')][_0x288e('0x18')]);_0x5cd52d['offset']=qs['offset'](_0x18d746['query']['offset']);}_0x5cd52d[_0x288e('0x32')]=qs['sort'](_0x18d746[_0x288e('0x29')][_0x288e('0x33')]);_0x5cd52d['where']=qs[_0x288e('0x2b')](_[_0x288e('0x34')](_0x18d746[_0x288e('0x29')],_0x2e55a3[_0x288e('0x2b')]),_0x102f92);if(_0x18d746['query'][_0x288e('0x35')]){_0x5cd52d[_0x288e('0x36')]=_[_0x288e('0x37')](_0x5cd52d['where'],{'$or':_[_0x288e('0x25')](_0x102f92,function(_0x2b21a8){if(_0x2b21a8[_0x288e('0x27')]!==_0x288e('0x38')){var _0x38fc5a={};_0x38fc5a[_0x2b21a8[_0x288e('0x23')]]={'$like':'%'+_0x18d746[_0x288e('0x29')][_0x288e('0x35')]+'%'};return _0x38fc5a;}})});}_0x5cd52d=_['merge']({},_0x5cd52d,_0x18d746['options']);var _0x5568d7={'where':_0x5cd52d[_0x288e('0x36')]};return db[_0x288e('0x39')]['count'](_0x5568d7)['then'](function(_0x52e55c){_0x489a43[_0x288e('0x19')]=_0x52e55c;if(_0x18d746['query']['includeAll']){_0x5cd52d[_0x288e('0x3a')]=[{'all':!![]}];}return db[_0x288e('0x39')][_0x288e('0x3b')](_0x5cd52d);})[_0x288e('0x1f')](function(_0x43082e){_0x489a43[_0x288e('0x3c')]=_0x43082e;return _0x489a43;})[_0x288e('0x1f')](respondWithFilteredResult(_0x27951d,_0x5cd52d))[_0x288e('0x3d')](handleError(_0x27951d,null));};exports[_0x288e('0x3e')]=function(_0x19c3c3,_0x17db21){var _0xf701b={'raw':!![],'where':{'id':_0x19c3c3[_0x288e('0x3f')]['id']}},_0x35b7e8={};_0x35b7e8['model']=_[_0x288e('0x2a')](db['SquareRecording']['rawAttributes']);_0x35b7e8[_0x288e('0x29')]=_[_0x288e('0x2a')](_0x19c3c3[_0x288e('0x29')]);_0x35b7e8[_0x288e('0x2b')]=_[_0x288e('0x2d')](_0x35b7e8['model'],_0x35b7e8[_0x288e('0x29')]);_0xf701b[_0x288e('0x2c')]=_[_0x288e('0x2d')](_0x35b7e8[_0x288e('0x28')],qs[_0x288e('0x2e')](_0x19c3c3[_0x288e('0x29')][_0x288e('0x2e')]));_0xf701b[_0x288e('0x2c')]=_0xf701b[_0x288e('0x2c')]['length']?_0xf701b[_0x288e('0x2c')]:_0x35b7e8[_0x288e('0x28')];if(_0x19c3c3[_0x288e('0x29')][_0x288e('0x40')]){_0xf701b[_0x288e('0x3a')]=[{'all':!![]}];}_0xf701b=_[_0x288e('0x37')]({},_0xf701b,_0x19c3c3[_0x288e('0x41')]);return db['SquareRecording']['find'](_0xf701b)[_0x288e('0x1f')](handleEntityNotFound(_0x17db21,null))[_0x288e('0x1f')](respondWithResult(_0x17db21,null))[_0x288e('0x3d')](handleError(_0x17db21,null));};exports['create']=function(_0x4ead54,_0x4cd7b8){return db[_0x288e('0x39')][_0x288e('0x42')](_0x4ead54[_0x288e('0x43')],{})['then'](respondWithResult(_0x4cd7b8,0xc9))[_0x288e('0x3d')](handleError(_0x4cd7b8,null));};exports[_0x288e('0x1e')]=function(_0x5b426b,_0x1fb4b3){if(_0x5b426b[_0x288e('0x43')]['id']){delete _0x5b426b[_0x288e('0x43')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x5b426b[_0x288e('0x3f')]['id']}})[_0x288e('0x1f')](handleEntityNotFound(_0x1fb4b3,null))['then'](saveUpdates(_0x5b426b['body'],null))[_0x288e('0x1f')](respondWithResult(_0x1fb4b3,null))[_0x288e('0x3d')](handleError(_0x1fb4b3,null));};exports[_0x288e('0x44')]=function(_0x897e1b,_0x26f767,_0x366296){var _0x41b5b6=require('../../components/encryptor');var _0x3d9860=![];var _0x5ec76b={};if(_0x897e1b['query']['type']&&_0x897e1b[_0x288e('0x29')][_0x288e('0x27')]===_0x288e('0x45')){_0x5ec76b[_0x288e('0x45')]=_0x897e1b[_0x288e('0x3f')]['id'];}else{_0x5ec76b['id']=_0x897e1b[_0x288e('0x3f')]['id'];}return db[_0x288e('0x39')][_0x288e('0x46')]({'where':_0x5ec76b,'attributes':['id',_0x288e('0x47'),_0x288e('0x48')],'raw':!![]})[_0x288e('0x1f')](handleEntityNotFound(_0x26f767,null))[_0x288e('0x1f')](function(_0x3f2ba2){if(_0x3f2ba2){var _0x8c5628=_0x3f2ba2[_0x288e('0x47')];var _0x3c30a5=util[_0x288e('0x49')]('%s.cypher',_0x8c5628);if(fs[_0x288e('0x4a')](_0x3c30a5)){_0x3d9860=!![];return _0x41b5b6[_0x288e('0x4b')](_0x3c30a5,_0x8c5628,config['secrets'][_0x288e('0x4c')])[_0x288e('0x1f')](function(){return _0x3f2ba2;});}return _0x3f2ba2;}})[_0x288e('0x1f')](function(_0x252ed6){if(_0x252ed6){var _0xd66a04=_0x252ed6[_0x288e('0x47')];if(!fs[_0x288e('0x4a')](_0xd66a04)){throw new db[(_0x288e('0x4d'))]['ValidationError'](_0x288e('0x4e'));}if(_0x252ed6[_0x288e('0x48')]){return _0x26f767['download'](_0xd66a04,_0x252ed6[_0x288e('0x48')]+path[_0x288e('0x4f')](_0xd66a04),function(){if(_0x3d9860){fs[_0x288e('0x50')](_0xd66a04);}});}else{return _0x26f767[_0x288e('0x44')](_0xd66a04,function(_0x4d4259){if(_0x3d9860){fs[_0x288e('0x50')](_0xd66a04);}});}}})[_0x288e('0x3d')](function(_0x34e66d){if(_0x34e66d[_0x288e('0x51')]===_0x288e('0x4e')){_0x26f767[_0x288e('0x16')](0x194)[_0x288e('0x52')](_0x288e('0x53'));}else{return handleError(_0x26f767,null);}});};exports[_0x288e('0x20')]=function(_0xe9960,_0x506911){return db[_0x288e('0x39')]['find']({'where':{'id':_0xe9960[_0x288e('0x3f')]['id']}})[_0x288e('0x1f')](function(_0x50a8c4){if(_[_0x288e('0x54')](_0x50a8c4)){throw new ReferenceError(_0x288e('0x55'));}return _0x50a8c4;})['then'](function(_0x1079a3){var _0x3e4b37=_0x1079a3['savePath'];logger[_0x288e('0x56')](_0x288e('0x57'),_0x3e4b37);if(!_[_0x288e('0x54')](_0x1079a3[_0x288e('0x47')])&&fs[_0x288e('0x4a')](_0x3e4b37)){logger[_0x288e('0x56')](_0x288e('0x58')+_0x3e4b37+_0x288e('0x59'));fs['unlinkSync'](_0x3e4b37);}_0x3e4b37=_0x3e4b37+_0x288e('0x5a');if(!_[_0x288e('0x54')](_0x1079a3[_0x288e('0x47')])&&fs[_0x288e('0x4a')](_0x3e4b37)){logger[_0x288e('0x56')]('File:\x20\x22'+_0x3e4b37+_0x288e('0x59'));fs['unlinkSync'](_0x3e4b37);}return _0x1079a3;})[_0x288e('0x1f')](function(_0x163ea2){if(!_0x163ea2)throw new InternalError();return _0x163ea2[_0x288e('0x20')]();})[_0x288e('0x1f')](function(){_0x506911[_0x288e('0x16')](0xcc)[_0x288e('0x5b')]();})[_0x288e('0x3d')](handleError(_0x506911,null));}; \ No newline at end of file +var _0xd353=['secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','status','error','stack','name','index','map','SquareRecording','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile'];(function(_0x267c93,_0x133bfe){var _0x24d2c3=function(_0x3c3466){while(--_0x3c3466){_0x267c93['push'](_0x267c93['shift']());}};_0x24d2c3(++_0x133bfe);}(_0xd353,0xd1));var _0x3d35=function(_0x948867,_0x475f5e){_0x948867=_0x948867-0x0;var _0x2b5b30=_0xd353[_0x948867];return _0x2b5b30;};'use strict';var emlformat=require(_0x3d35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d35('0x1'));var jsonpatch=require(_0x3d35('0x2'));var rp=require(_0x3d35('0x3'));var moment=require('moment');var BPromise=require(_0x3d35('0x4'));var Mustache=require(_0x3d35('0x5'));var util=require(_0x3d35('0x6'));var path=require(_0x3d35('0x7'));var sox=require(_0x3d35('0x8'));var csv=require('to-csv');var ejs=require(_0x3d35('0x9'));var fs=require('fs');var fs_extra=require(_0x3d35('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d35('0xb'));var jsforce=require(_0x3d35('0xc'));var deskjs=require(_0x3d35('0xd'));var toCsv=require(_0x3d35('0xe'));var querystring=require(_0x3d35('0xf'));var Papa=require(_0x3d35('0x10'));var Redis=require('ioredis');var authService=require(_0x3d35('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3d35('0x12'));var hardwareService=require(_0x3d35('0x13'));var logger=require(_0x3d35('0x14'))(_0x3d35('0x15'));var utils=require(_0x3d35('0x16'));var config=require(_0x3d35('0x17'));var licenseUtil=require(_0x3d35('0x18'));var db=require(_0x3d35('0x19'))['db'];function respondWithStatusCode(_0x5c10a4,_0x20e58a){_0x20e58a=_0x20e58a||0xcc;return function(_0x4ff813){if(_0x4ff813){return _0x5c10a4[_0x3d35('0x1a')](_0x20e58a);}return _0x5c10a4['status'](_0x20e58a)[_0x3d35('0x1b')]();};}function respondWithResult(_0x38a6e7,_0xba715e){_0xba715e=_0xba715e||0xc8;return function(_0x1493cc){if(_0x1493cc){return _0x38a6e7['status'](_0xba715e)[_0x3d35('0x1c')](_0x1493cc);}};}function respondWithFilteredResult(_0x94c43,_0x59f59d){return function(_0x5e0316){if(_0x5e0316){var _0x1bce34=typeof _0x59f59d[_0x3d35('0x1d')]===_0x3d35('0x1e')&&typeof _0x59f59d['limit']===_0x3d35('0x1e');var _0x3f092a=_0x5e0316[_0x3d35('0x1f')];var _0x47aec7=_0x1bce34?0x0:_0x59f59d[_0x3d35('0x1d')];var _0x1a944c=_0x1bce34?_0x5e0316[_0x3d35('0x1f')]:_0x59f59d[_0x3d35('0x1d')]+_0x59f59d[_0x3d35('0x20')];var _0x2dfb20;if(_0x1a944c>=_0x3f092a){_0x1a944c=_0x3f092a;_0x2dfb20=0xc8;}else{_0x2dfb20=0xce;}_0x94c43['status'](_0x2dfb20);return _0x94c43[_0x3d35('0x21')](_0x3d35('0x22'),_0x47aec7+'-'+_0x1a944c+'/'+_0x3f092a)[_0x3d35('0x1c')](_0x5e0316);}return null;};}function patchUpdates(_0x24f970){return function(_0x55b578){try{jsonpatch[_0x3d35('0x23')](_0x55b578,_0x24f970,!![]);}catch(_0x5289c8){return BPromise['reject'](_0x5289c8);}return _0x55b578['save']();};}function saveUpdates(_0x4c04fb,_0x4310a8){return function(_0x33bc65){if(_0x33bc65){return _0x33bc65['update'](_0x4c04fb)[_0x3d35('0x24')](function(_0x47e599){return _0x47e599;});}return null;};}function removeEntity(_0x229911,_0x420fd7){return function(_0x3a8036){if(_0x3a8036){return _0x3a8036[_0x3d35('0x25')]()['then'](function(){_0x229911[_0x3d35('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a0e1c,_0x5b05b0){return function(_0x13d896){if(!_0x13d896){_0x4a0e1c[_0x3d35('0x1a')](0x194);}return _0x13d896;};}function handleError(_0x1d22c3,_0x506b14){_0x506b14=_0x506b14||0x1f4;return function(_0x288af9){logger[_0x3d35('0x27')](_0x288af9[_0x3d35('0x28')]);if(_0x288af9[_0x3d35('0x29')]){delete _0x288af9[_0x3d35('0x29')];}_0x1d22c3['status'](_0x506b14)['send'](_0x288af9);};}exports[_0x3d35('0x2a')]=function(_0x2889f0,_0x36476e){var _0x2ff8c7={},_0x38c766={},_0x35587e={'count':0x0,'rows':[]};var _0x32f728=_[_0x3d35('0x2b')](db[_0x3d35('0x2c')][_0x3d35('0x2d')],function(_0x185eb0){return{'name':_0x185eb0['fieldName'],'type':_0x185eb0['type'][_0x3d35('0x2e')]};});_0x38c766[_0x3d35('0x2f')]=_[_0x3d35('0x2b')](_0x32f728,_0x3d35('0x29'));_0x38c766[_0x3d35('0x30')]=_[_0x3d35('0x31')](_0x2889f0[_0x3d35('0x30')]);_0x38c766[_0x3d35('0x32')]=_[_0x3d35('0x33')](_0x38c766[_0x3d35('0x2f')],_0x38c766[_0x3d35('0x30')]);_0x2ff8c7[_0x3d35('0x34')]=_[_0x3d35('0x33')](_0x38c766[_0x3d35('0x2f')],qs[_0x3d35('0x35')](_0x2889f0[_0x3d35('0x30')][_0x3d35('0x35')]));_0x2ff8c7[_0x3d35('0x34')]=_0x2ff8c7[_0x3d35('0x34')][_0x3d35('0x36')]?_0x2ff8c7[_0x3d35('0x34')]:_0x38c766[_0x3d35('0x2f')];if(!_0x2889f0[_0x3d35('0x30')]['hasOwnProperty'](_0x3d35('0x37'))){_0x2ff8c7[_0x3d35('0x20')]=qs[_0x3d35('0x20')](_0x2889f0[_0x3d35('0x30')]['limit']);_0x2ff8c7[_0x3d35('0x1d')]=qs['offset'](_0x2889f0[_0x3d35('0x30')][_0x3d35('0x1d')]);}_0x2ff8c7[_0x3d35('0x38')]=qs[_0x3d35('0x39')](_0x2889f0[_0x3d35('0x30')]['sort']);_0x2ff8c7[_0x3d35('0x3a')]=qs[_0x3d35('0x32')](_['pick'](_0x2889f0['query'],_0x38c766[_0x3d35('0x32')]),_0x32f728);if(_0x2889f0[_0x3d35('0x30')][_0x3d35('0x3b')]){_0x2ff8c7[_0x3d35('0x3a')]=_['merge'](_0x2ff8c7[_0x3d35('0x3a')],{'$or':_[_0x3d35('0x2b')](_0x32f728,function(_0x24519f){if(_0x24519f[_0x3d35('0x3c')]!==_0x3d35('0x3d')){var _0x4dde5f={};_0x4dde5f[_0x24519f[_0x3d35('0x29')]]={'$like':'%'+_0x2889f0[_0x3d35('0x30')]['filter']+'%'};return _0x4dde5f;}})});}_0x2ff8c7=_[_0x3d35('0x3e')]({},_0x2ff8c7,_0x2889f0['options']);var _0x6cdd96={'where':_0x2ff8c7[_0x3d35('0x3a')]};return db[_0x3d35('0x2c')][_0x3d35('0x1f')](_0x6cdd96)[_0x3d35('0x24')](function(_0x2436f5){_0x35587e[_0x3d35('0x1f')]=_0x2436f5;if(_0x2889f0['query'][_0x3d35('0x3f')]){_0x2ff8c7[_0x3d35('0x40')]=[{'all':!![]}];}return db[_0x3d35('0x2c')][_0x3d35('0x41')](_0x2ff8c7);})[_0x3d35('0x24')](function(_0x2ecc49){_0x35587e[_0x3d35('0x42')]=_0x2ecc49;return _0x35587e;})[_0x3d35('0x24')](respondWithFilteredResult(_0x36476e,_0x2ff8c7))['catch'](handleError(_0x36476e,null));};exports[_0x3d35('0x43')]=function(_0x38f4c6,_0x2e0d25){var _0x315fb0={'raw':!![],'where':{'id':_0x38f4c6['params']['id']}},_0x2e5716={};_0x2e5716[_0x3d35('0x2f')]=_[_0x3d35('0x31')](db[_0x3d35('0x2c')][_0x3d35('0x2d')]);_0x2e5716[_0x3d35('0x30')]=_[_0x3d35('0x31')](_0x38f4c6[_0x3d35('0x30')]);_0x2e5716[_0x3d35('0x32')]=_[_0x3d35('0x33')](_0x2e5716[_0x3d35('0x2f')],_0x2e5716['query']);_0x315fb0[_0x3d35('0x34')]=_[_0x3d35('0x33')](_0x2e5716[_0x3d35('0x2f')],qs[_0x3d35('0x35')](_0x38f4c6[_0x3d35('0x30')][_0x3d35('0x35')]));_0x315fb0['attributes']=_0x315fb0[_0x3d35('0x34')]['length']?_0x315fb0[_0x3d35('0x34')]:_0x2e5716['model'];if(_0x38f4c6[_0x3d35('0x30')]['includeAll']){_0x315fb0[_0x3d35('0x40')]=[{'all':!![]}];}_0x315fb0=_['merge']({},_0x315fb0,_0x38f4c6['options']);return db[_0x3d35('0x2c')][_0x3d35('0x44')](_0x315fb0)[_0x3d35('0x24')](handleEntityNotFound(_0x2e0d25,null))[_0x3d35('0x24')](respondWithResult(_0x2e0d25,null))[_0x3d35('0x45')](handleError(_0x2e0d25,null));};exports['create']=function(_0x46dd26,_0x22bc5e){return db[_0x3d35('0x2c')][_0x3d35('0x46')](_0x46dd26[_0x3d35('0x47')],{})[_0x3d35('0x24')](respondWithResult(_0x22bc5e,0xc9))[_0x3d35('0x45')](handleError(_0x22bc5e,null));};exports[_0x3d35('0x48')]=function(_0xc2aca0,_0x23a200){if(_0xc2aca0['body']['id']){delete _0xc2aca0[_0x3d35('0x47')]['id'];}return db[_0x3d35('0x2c')][_0x3d35('0x44')]({'where':{'id':_0xc2aca0[_0x3d35('0x49')]['id']}})['then'](handleEntityNotFound(_0x23a200,null))[_0x3d35('0x24')](saveUpdates(_0xc2aca0[_0x3d35('0x47')],null))[_0x3d35('0x24')](respondWithResult(_0x23a200,null))['catch'](handleError(_0x23a200,null));};exports['download']=function(_0x25cfc2,_0x584919,_0x4a432e){var _0x246149=require(_0x3d35('0x4a'));var _0x3ffbfe=![];var _0x57839b={};if(_0x25cfc2[_0x3d35('0x30')][_0x3d35('0x3c')]&&_0x25cfc2[_0x3d35('0x30')][_0x3d35('0x3c')]==='uniqueid'){_0x57839b[_0x3d35('0x4b')]=_0x25cfc2[_0x3d35('0x49')]['id'];}else{_0x57839b['id']=_0x25cfc2[_0x3d35('0x49')]['id'];}return db['SquareRecording']['find']({'where':_0x57839b,'attributes':['id',_0x3d35('0x4c'),_0x3d35('0x4d')],'raw':!![]})[_0x3d35('0x24')](handleEntityNotFound(_0x584919,null))['then'](function(_0x19d683){if(_0x19d683){var _0x37b1a7=_0x19d683[_0x3d35('0x4c')];var _0x36b50d=util[_0x3d35('0x4e')](_0x3d35('0x4f'),_0x37b1a7);if(fs[_0x3d35('0x50')](_0x36b50d)){_0x3ffbfe=!![];return _0x246149[_0x3d35('0x51')](_0x36b50d,_0x37b1a7,config[_0x3d35('0x52')][_0x3d35('0x53')])[_0x3d35('0x24')](function(){return _0x19d683;});}return _0x19d683;}})[_0x3d35('0x24')](function(_0x3c61ba){if(_0x3c61ba){var _0x5012d6=_0x3c61ba['savePath'];if(!fs[_0x3d35('0x50')](_0x5012d6)){throw new db[(_0x3d35('0x54'))][(_0x3d35('0x55'))](_0x3d35('0x56'));}if(_0x3c61ba[_0x3d35('0x4d')]){return _0x584919[_0x3d35('0x57')](_0x5012d6,_0x3c61ba[_0x3d35('0x4d')]+path[_0x3d35('0x58')](_0x5012d6),function(){if(_0x3ffbfe){fs['unlink'](_0x5012d6);}});}else{return _0x584919[_0x3d35('0x57')](_0x5012d6,function(_0x118c5b){if(_0x3ffbfe){fs[_0x3d35('0x59')](_0x5012d6);}});}}})[_0x3d35('0x45')](function(_0x2b7e77){if(_0x2b7e77[_0x3d35('0x5a')]===_0x3d35('0x56')){_0x584919[_0x3d35('0x26')](0x194)['send']('Not\x20found');}else{return handleError(_0x584919,null);}});};exports['destroy']=function(_0x3c5204,_0x480549){return db[_0x3d35('0x2c')][_0x3d35('0x44')]({'where':{'id':_0x3c5204[_0x3d35('0x49')]['id']}})['then'](function(_0x52130e){if(_[_0x3d35('0x5b')](_0x52130e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x52130e;})['then'](function(_0x5a3f49){var _0xf64c0a=_0x5a3f49['savePath'];logger[_0x3d35('0x5c')]('cancellazione\x20fisica\x20documento\x20%s',_0xf64c0a);if(!_[_0x3d35('0x5b')](_0x5a3f49[_0x3d35('0x4c')])&&fs[_0x3d35('0x50')](_0xf64c0a)){logger[_0x3d35('0x5c')](_0x3d35('0x5d')+_0xf64c0a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3d35('0x5e')](_0xf64c0a);}_0xf64c0a=_0xf64c0a+_0x3d35('0x5f');if(!_['isNil'](_0x5a3f49[_0x3d35('0x4c')])&&fs[_0x3d35('0x50')](_0xf64c0a)){logger[_0x3d35('0x5c')](_0x3d35('0x5d')+_0xf64c0a+_0x3d35('0x60'));fs[_0x3d35('0x5e')](_0xf64c0a);}return _0x5a3f49;})[_0x3d35('0x24')](function(_0x205ea9){if(!_0x205ea9)throw new InternalError();return _0x205ea9[_0x3d35('0x25')]();})[_0x3d35('0x24')](function(){_0x480549[_0x3d35('0x26')](0xcc)[_0x3d35('0x1b')]();})[_0x3d35('0x45')](handleError(_0x480549,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 36ae115..ac976b8 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 _0xc962=['square_recordings','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x442b41,_0x22dc53){var _0x140d06=function(_0x5afa6d){while(--_0x5afa6d){_0x442b41['push'](_0x442b41['shift']());}};_0x140d06(++_0x22dc53);}(_0xc962,0x6d));var _0x2c96=function(_0x49c852,_0x315ad0){_0x49c852=_0x49c852-0x0;var _0xbdec25=_0xc962[_0x49c852];return _0xbdec25;};'use strict';var _=require(_0x2c96('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2c96('0x1'));var BPromise=require(_0x2c96('0x2'));var rp=require(_0x2c96('0x3'));var fs=require('fs');var path=require(_0x2c96('0x4'));var rimraf=require(_0x2c96('0x5'));var config=require(_0x2c96('0x6'));var attributes=require(_0x2c96('0x7'));module[_0x2c96('0x8')]=function(_0x599a47,_0x1b7ca9){return _0x599a47[_0x2c96('0x9')](_0x2c96('0xa'),attributes,{'tableName':_0x2c96('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e56=['api','moment','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util'];(function(_0x32b9c9,_0x5881e6){var _0x1a837f=function(_0x2edd85){while(--_0x2edd85){_0x32b9c9['push'](_0x32b9c9['shift']());}};_0x1a837f(++_0x5881e6);}(_0x0e56,0xf5));var _0x60e5=function(_0x33a21a,_0x22d1a8){_0x33a21a=_0x33a21a-0x0;var _0x4c628e=_0x0e56[_0x33a21a];return _0x4c628e;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var logger=require('../../config/logger')(_0x60e5('0x2'));var moment=require(_0x60e5('0x3'));var BPromise=require('bluebird');var rp=require(_0x60e5('0x4'));var fs=require('fs');var path=require(_0x60e5('0x5'));var rimraf=require(_0x60e5('0x6'));var config=require(_0x60e5('0x7'));var attributes=require(_0x60e5('0x8'));module[_0x60e5('0x9')]=function(_0x25b3a4,_0x54422a){return _0x25b3a4[_0x60e5('0xa')](_0x60e5('0xb'),attributes,{'tableName':_0x60e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index e9fbc38..20a07fc 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 _0xcfac=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','SquareRecording','options','raw'];(function(_0x4ddf58,_0x5cb9ca){var _0xd68645=function(_0x4d90bb){while(--_0x4d90bb){_0x4ddf58['push'](_0x4ddf58['shift']());}};_0xd68645(++_0x5cb9ca);}(_0xcfac,0x170));var _0xccfa=function(_0x56fc71,_0xc9c743){_0x56fc71=_0x56fc71-0x0;var _0x1efdd5=_0xcfac[_0x56fc71];return _0x1efdd5;};'use strict';var _=require(_0xccfa('0x0'));var util=require(_0xccfa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccfa('0x2'));var db=require(_0xccfa('0x3'))['db'];var utils=require(_0xccfa('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xccfa('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xccfa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38ea25,_0x5a29db,_0x253f44){return new BPromise(function(_0x3621b1,_0x3ae8e2){return client[_0xccfa('0x7')](_0x38ea25,_0x253f44)[_0xccfa('0x8')](function(_0x5bd60f){logger[_0xccfa('0x9')]('SquareRecording,\x20%s,\x20%s',_0x5a29db,'request\x20sent');logger[_0xccfa('0xa')](_0xccfa('0xb'),_0x5a29db,_0xccfa('0xc'),JSON[_0xccfa('0xd')](_0x5bd60f));if(_0x5bd60f[_0xccfa('0xe')]){if(_0x5bd60f[_0xccfa('0xe')][_0xccfa('0xf')]===0x1f4){logger[_0xccfa('0xe')](_0xccfa('0x10'),_0x5a29db,_0x5bd60f['error'][_0xccfa('0x11')]);return _0x3ae8e2(_0x5bd60f[_0xccfa('0xe')][_0xccfa('0x11')]);}logger[_0xccfa('0xe')](_0xccfa('0x10'),_0x5a29db,_0x5bd60f[_0xccfa('0xe')]['message']);return _0x3621b1(_0x5bd60f['error'][_0xccfa('0x11')]);}else{logger[_0xccfa('0x9')](_0xccfa('0x10'),_0x5a29db,_0xccfa('0xc'));_0x3621b1(_0x5bd60f['result'][_0xccfa('0x11')]);}})[_0xccfa('0x12')](function(_0x4af1f9){logger['error'](_0xccfa('0x10'),_0x5a29db,_0x4af1f9);_0x3ae8e2(_0x4af1f9);});});}exports[_0xccfa('0x13')]=function(_0x518708){var _0x487904=this;return new Promise(function(_0x4d97d4,_0x569b2a){return db[_0xccfa('0x14')]['create'](_0x518708['body'],{'raw':_0x518708[_0xccfa('0x15')]?_0x518708[_0xccfa('0x15')][_0xccfa('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xc7d754){logger[_0xccfa('0x9')](_0xccfa('0x13'),_0x518708);logger[_0xccfa('0xa')](_0xccfa('0x13'),_0x518708,JSON[_0xccfa('0xd')](_0xc7d754));_0x4d97d4(_0xc7d754);})[_0xccfa('0x12')](function(_0x494e3){logger[_0xccfa('0xe')](_0xccfa('0x13'),_0x494e3[_0xccfa('0x11')],_0x518708);_0x569b2a(_0x487904['error'](0x1f4,_0x494e3['message']));});});}; \ No newline at end of file +var _0xba22=['CreateSquareRecording','create','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xba22,0xc1));var _0x2ba2=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xba22[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ba2('0x0'));var BPromise=require(_0x2ba2('0x1'));var rs=require(_0x2ba2('0x2'));var fs=require('fs');var Redis=require(_0x2ba2('0x3'));var db=require(_0x2ba2('0x4'))['db'];var utils=require(_0x2ba2('0x5'));var logger=require(_0x2ba2('0x6'))(_0x2ba2('0x7'));var config=require(_0x2ba2('0x8'));var jayson=require(_0x2ba2('0x9'));var client=jayson[_0x2ba2('0xa')][_0x2ba2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c1183,_0x1a75fd,_0xeaa626){return new BPromise(function(_0x3376de,_0x356ddb){return client['request'](_0x1c1183,_0xeaa626)[_0x2ba2('0xc')](function(_0x44693e){logger[_0x2ba2('0xd')](_0x2ba2('0xe'),_0x1a75fd,_0x2ba2('0xf'));logger[_0x2ba2('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1a75fd,'request\x20sent',JSON[_0x2ba2('0x11')](_0x44693e));if(_0x44693e['error']){if(_0x44693e['error'][_0x2ba2('0x12')]===0x1f4){logger[_0x2ba2('0x13')](_0x2ba2('0xe'),_0x1a75fd,_0x44693e[_0x2ba2('0x13')][_0x2ba2('0x14')]);return _0x356ddb(_0x44693e[_0x2ba2('0x13')][_0x2ba2('0x14')]);}logger[_0x2ba2('0x13')]('SquareRecording,\x20%s,\x20%s',_0x1a75fd,_0x44693e['error']['message']);return _0x3376de(_0x44693e[_0x2ba2('0x13')]['message']);}else{logger[_0x2ba2('0xd')]('SquareRecording,\x20%s,\x20%s',_0x1a75fd,'request\x20sent');_0x3376de(_0x44693e[_0x2ba2('0x15')][_0x2ba2('0x14')]);}})[_0x2ba2('0x16')](function(_0xfc8160){logger['error'](_0x2ba2('0xe'),_0x1a75fd,_0xfc8160);_0x356ddb(_0xfc8160);});});}exports[_0x2ba2('0x17')]=function(_0x5d9ae7){var _0x167d10=this;return new Promise(function(_0x52ff76,_0x43fcea){return db['SquareRecording'][_0x2ba2('0x18')](_0x5d9ae7['body'],{'raw':_0x5d9ae7[_0x2ba2('0x19')]?_0x5d9ae7['options'][_0x2ba2('0x1a')]===undefined?!![]:![]:!![]})[_0x2ba2('0xc')](function(_0x538db4){logger[_0x2ba2('0xd')](_0x2ba2('0x17'),_0x5d9ae7);logger[_0x2ba2('0x10')](_0x2ba2('0x17'),_0x5d9ae7,JSON[_0x2ba2('0x11')](_0x538db4));_0x52ff76(_0x538db4);})['catch'](function(_0x1c91e1){logger['error'](_0x2ba2('0x17'),_0x1c91e1[_0x2ba2('0x14')],_0x5d9ae7);_0x43fcea(_0x167d10[_0x2ba2('0x13')](0x1f4,_0x1c91e1['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1ab6f74..0789265 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3861c6,_0x18be51){var _0x15f1ce=function(_0x40c276){while(--_0x40c276){_0x3861c6['push'](_0x3861c6['shift']());}};_0x15f1ce(++_0x18be51);}(_0xe706,0xa3));var _0x6e70=function(_0x2633c7,_0x4db8b3){_0x2633c7=_0x2633c7-0x0;var _0xbb644=_0xe706[_0x2633c7];return _0xbb644;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x33e831,_0x267ac1){var _0x25e3df=function(_0x151261){while(--_0x151261){_0x33e831['push'](_0x33e831['shift']());}};_0x25e3df(++_0x267ac1);}(_0xe706,0xa3));var _0x6e70=function(_0x4839a2,_0x1f67eb){_0x4839a2=_0x4839a2-0x0;var _0x465147=_0xe706[_0x4839a2];return _0x465147;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 14c3258..3bf625d 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 _0x4325=['sequelize','exports','STRING','DATE'];(function(_0x764ad5,_0x12f9ba){var _0x422244=function(_0x21e39c){while(--_0x21e39c){_0x764ad5['push'](_0x764ad5['shift']());}};_0x422244(++_0x12f9ba);}(_0x4325,0x138));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'network':{'type':Sequelize[_0x5432('0x2')]},'network_script':{'type':Sequelize[_0x5432('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5432('0x2')]},'language':{'type':Sequelize[_0x5432('0x2')]},'type':{'type':Sequelize[_0x5432('0x2')]},'uniqueid':{'type':Sequelize[_0x5432('0x2')]},'version':{'type':Sequelize[_0x5432('0x2')]},'callerid':{'type':Sequelize[_0x5432('0x2')]},'calleridname':{'type':Sequelize[_0x5432('0x2')]},'callingpres':{'type':Sequelize[_0x5432('0x2')]},'callingani2':{'type':Sequelize[_0x5432('0x2')]},'callington':{'type':Sequelize[_0x5432('0x2')]},'callingtns':{'type':Sequelize[_0x5432('0x2')]},'dnid':{'type':Sequelize[_0x5432('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5432('0x2')]},'extension':{'type':Sequelize[_0x5432('0x2')]},'priority':{'type':Sequelize[_0x5432('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5432('0x2')]},'threadid':{'type':Sequelize[_0x5432('0x2')]},'project_name':{'type':Sequelize[_0x5432('0x2')]},'joinAt':{'type':Sequelize[_0x5432('0x3')]},'leaveAt':{'type':Sequelize[_0x5432('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x119e=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x5de818,_0x7c4485){var _0x345670=function(_0x5e268d){while(--_0x5e268d){_0x5de818['push'](_0x5de818['shift']());}};_0x345670(++_0x7c4485);}(_0x119e,0xf9));var _0xe119=function(_0x293828,_0x3d4f2c){_0x293828=_0x293828-0x0;var _0x1f3bd7=_0x119e[_0x293828];return _0x1f3bd7;};'use strict';var Sequelize=require(_0xe119('0x0'));module[_0xe119('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xe119('0x2')]},'request':{'type':Sequelize[_0xe119('0x2')]},'channel':{'type':Sequelize[_0xe119('0x2')]},'language':{'type':Sequelize[_0xe119('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xe119('0x2')]},'version':{'type':Sequelize[_0xe119('0x2')]},'callerid':{'type':Sequelize[_0xe119('0x2')]},'calleridname':{'type':Sequelize[_0xe119('0x2')]},'callingpres':{'type':Sequelize[_0xe119('0x2')]},'callingani2':{'type':Sequelize[_0xe119('0x2')]},'callington':{'type':Sequelize[_0xe119('0x2')]},'callingtns':{'type':Sequelize[_0xe119('0x2')]},'dnid':{'type':Sequelize[_0xe119('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe119('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe119('0x2')]},'enhanced':{'type':Sequelize[_0xe119('0x2')]},'accountcode':{'type':Sequelize[_0xe119('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xe119('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe119('0x3')]},'bot':{'type':Sequelize[_0xe119('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2750557..9c4b620 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 _0x505f=['rawAttributes','keys','intersection','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','save','then','error','name','send','index','map','SquareReport','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','params'];(function(_0x19fd3f,_0x8adcfa){var _0x28ad05=function(_0x3a3ce4){while(--_0x3a3ce4){_0x19fd3f['push'](_0x19fd3f['shift']());}};_0x28ad05(++_0x8adcfa);}(_0x505f,0x16c));var _0xf505=function(_0x4011ee,_0x2f9974){_0x4011ee=_0x4011ee-0x0;var _0xe66073=_0x505f[_0x4011ee];return _0xe66073;};'use strict';var emlformat=require(_0xf505('0x0'));var rimraf=require(_0xf505('0x1'));var zipdir=require(_0xf505('0x2'));var jsonpatch=require(_0xf505('0x3'));var rp=require(_0xf505('0x4'));var moment=require(_0xf505('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf505('0x6'));var path=require(_0xf505('0x7'));var sox=require(_0xf505('0x8'));var csv=require(_0xf505('0x9'));var ejs=require(_0xf505('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf505('0xb'));var squel=require(_0xf505('0xc'));var crypto=require(_0xf505('0xd'));var jsforce=require(_0xf505('0xe'));var deskjs=require(_0xf505('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf505('0x10'));var Redis=require('ioredis');var authService=require(_0xf505('0x11'));var qs=require(_0xf505('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf505('0x13'));var config=require(_0xf505('0x14'));var licenseUtil=require(_0xf505('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x774fbe,_0x3f1c19){_0x3f1c19=_0x3f1c19||0xcc;return function(_0x46f39a){if(_0x46f39a){return _0x774fbe[_0xf505('0x16')](_0x3f1c19);}return _0x774fbe[_0xf505('0x17')](_0x3f1c19)[_0xf505('0x18')]();};}function respondWithResult(_0xf2ed0d,_0x245f35){_0x245f35=_0x245f35||0xc8;return function(_0x137b85){if(_0x137b85){return _0xf2ed0d['status'](_0x245f35)[_0xf505('0x19')](_0x137b85);}};}function respondWithFilteredResult(_0x4285f9,_0x484d61){return function(_0x3c1865){if(_0x3c1865){var _0xb3a1db=typeof _0x484d61[_0xf505('0x1a')]===_0xf505('0x1b')&&typeof _0x484d61[_0xf505('0x1c')]==='undefined';var _0x3210b7=_0x3c1865[_0xf505('0x1d')];var _0x3ba90f=_0xb3a1db?0x0:_0x484d61[_0xf505('0x1a')];var _0xb326fd=_0xb3a1db?_0x3c1865[_0xf505('0x1d')]:_0x484d61[_0xf505('0x1a')]+_0x484d61[_0xf505('0x1c')];var _0x3d185e;if(_0xb326fd>=_0x3210b7){_0xb326fd=_0x3210b7;_0x3d185e=0xc8;}else{_0x3d185e=0xce;}_0x4285f9[_0xf505('0x17')](_0x3d185e);return _0x4285f9[_0xf505('0x1e')]('Content-Range',_0x3ba90f+'-'+_0xb326fd+'/'+_0x3210b7)[_0xf505('0x19')](_0x3c1865);}return null;};}function patchUpdates(_0x177523){return function(_0x34ede9){try{jsonpatch['apply'](_0x34ede9,_0x177523,!![]);}catch(_0x5eebd4){return BPromise['reject'](_0x5eebd4);}return _0x34ede9[_0xf505('0x1f')]();};}function saveUpdates(_0x461cec,_0x10a938){return function(_0x44509e){if(_0x44509e){return _0x44509e['update'](_0x461cec)[_0xf505('0x20')](function(_0x3e2a4c){return _0x3e2a4c;});}return null;};}function removeEntity(_0x285fad,_0x58d125){return function(_0x5cb062){if(_0x5cb062){return _0x5cb062['destroy']()['then'](function(){_0x285fad[_0xf505('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c2194,_0x336ef1){return function(_0x569c90){if(!_0x569c90){_0x6c2194[_0xf505('0x16')](0x194);}return _0x569c90;};}function handleError(_0x3a92d6,_0x30c3dd){_0x30c3dd=_0x30c3dd||0x1f4;return function(_0x472bf7){logger[_0xf505('0x21')](_0x472bf7['stack']);if(_0x472bf7[_0xf505('0x22')]){delete _0x472bf7['name'];}_0x3a92d6[_0xf505('0x17')](_0x30c3dd)[_0xf505('0x23')](_0x472bf7);};}exports[_0xf505('0x24')]=function(_0x4a22e0,_0x4f4779){var _0x15888a={},_0x35a858={},_0x2da17f={'count':0x0,'rows':[]};var _0x111931=_[_0xf505('0x25')](db[_0xf505('0x26')]['rawAttributes'],function(_0x2be9cb){return{'name':_0x2be9cb[_0xf505('0x27')],'type':_0x2be9cb['type'][_0xf505('0x28')]};});_0x35a858[_0xf505('0x29')]=_['map'](_0x111931,_0xf505('0x22'));_0x35a858[_0xf505('0x2a')]=_['keys'](_0x4a22e0[_0xf505('0x2a')]);_0x35a858[_0xf505('0x2b')]=_['intersection'](_0x35a858[_0xf505('0x29')],_0x35a858['query']);_0x15888a[_0xf505('0x2c')]=_['intersection'](_0x35a858[_0xf505('0x29')],qs[_0xf505('0x2d')](_0x4a22e0['query'][_0xf505('0x2d')]));_0x15888a[_0xf505('0x2c')]=_0x15888a[_0xf505('0x2c')][_0xf505('0x2e')]?_0x15888a[_0xf505('0x2c')]:_0x35a858[_0xf505('0x29')];if(!_0x4a22e0[_0xf505('0x2a')][_0xf505('0x2f')](_0xf505('0x30'))){_0x15888a[_0xf505('0x1c')]=qs[_0xf505('0x1c')](_0x4a22e0[_0xf505('0x2a')][_0xf505('0x1c')]);_0x15888a['offset']=qs['offset'](_0x4a22e0[_0xf505('0x2a')][_0xf505('0x1a')]);}_0x15888a[_0xf505('0x31')]=qs[_0xf505('0x32')](_0x4a22e0[_0xf505('0x2a')][_0xf505('0x32')]);_0x15888a[_0xf505('0x33')]=qs[_0xf505('0x2b')](_[_0xf505('0x34')](_0x4a22e0[_0xf505('0x2a')],_0x35a858['filters']),_0x111931);if(_0x4a22e0[_0xf505('0x2a')][_0xf505('0x35')]){_0x15888a[_0xf505('0x33')]=_[_0xf505('0x36')](_0x15888a[_0xf505('0x33')],{'$or':_[_0xf505('0x25')](_0x111931,function(_0x2db6cc){if(_0x2db6cc[_0xf505('0x37')]!==_0xf505('0x38')){var _0x4d71c6={};_0x4d71c6[_0x2db6cc[_0xf505('0x22')]]={'$like':'%'+_0x4a22e0[_0xf505('0x2a')][_0xf505('0x35')]+'%'};return _0x4d71c6;}})});}_0x15888a=_[_0xf505('0x36')]({},_0x15888a,_0x4a22e0[_0xf505('0x39')]);var _0x210fac={'where':_0x15888a[_0xf505('0x33')]};return db[_0xf505('0x26')]['count'](_0x210fac)[_0xf505('0x20')](function(_0x1d5346){_0x2da17f[_0xf505('0x1d')]=_0x1d5346;if(_0x4a22e0['query'][_0xf505('0x3a')]){_0x15888a['include']=[{'all':!![]}];}return db[_0xf505('0x26')]['findAll'](_0x15888a);})[_0xf505('0x20')](function(_0xba293e){_0x2da17f[_0xf505('0x3b')]=_0xba293e;return _0x2da17f;})[_0xf505('0x20')](respondWithFilteredResult(_0x4f4779,_0x15888a))[_0xf505('0x3c')](handleError(_0x4f4779,null));};exports['show']=function(_0x1211da,_0x2086f0){var _0x284ee6={'raw':!![],'where':{'id':_0x1211da[_0xf505('0x3d')]['id']}},_0x581c86={};_0x581c86[_0xf505('0x29')]=_['keys'](db[_0xf505('0x26')][_0xf505('0x3e')]);_0x581c86[_0xf505('0x2a')]=_[_0xf505('0x3f')](_0x1211da[_0xf505('0x2a')]);_0x581c86[_0xf505('0x2b')]=_[_0xf505('0x40')](_0x581c86[_0xf505('0x29')],_0x581c86[_0xf505('0x2a')]);_0x284ee6[_0xf505('0x2c')]=_[_0xf505('0x40')](_0x581c86['model'],qs[_0xf505('0x2d')](_0x1211da[_0xf505('0x2a')][_0xf505('0x2d')]));_0x284ee6[_0xf505('0x2c')]=_0x284ee6[_0xf505('0x2c')][_0xf505('0x2e')]?_0x284ee6[_0xf505('0x2c')]:_0x581c86['model'];if(_0x1211da[_0xf505('0x2a')]['includeAll']){_0x284ee6[_0xf505('0x41')]=[{'all':!![]}];}_0x284ee6=_[_0xf505('0x36')]({},_0x284ee6,_0x1211da[_0xf505('0x39')]);return db[_0xf505('0x26')][_0xf505('0x42')](_0x284ee6)['then'](handleEntityNotFound(_0x2086f0,null))[_0xf505('0x20')](respondWithResult(_0x2086f0,null))[_0xf505('0x3c')](handleError(_0x2086f0,null));};exports[_0xf505('0x43')]=function(_0xe2f38,_0x1c0f5b){return db[_0xf505('0x26')][_0xf505('0x43')](_0xe2f38[_0xf505('0x44')],{})[_0xf505('0x20')](respondWithResult(_0x1c0f5b,0xc9))[_0xf505('0x3c')](handleError(_0x1c0f5b,null));};exports[_0xf505('0x45')]=function(_0x52cbbd,_0x22cbf4){if(_0x52cbbd[_0xf505('0x44')]['id']){delete _0x52cbbd[_0xf505('0x44')]['id'];}return db[_0xf505('0x26')][_0xf505('0x42')]({'where':{'id':_0x52cbbd['params']['id']}})[_0xf505('0x20')](handleEntityNotFound(_0x22cbf4,null))[_0xf505('0x20')](saveUpdates(_0x52cbbd[_0xf505('0x44')],null))['then'](respondWithResult(_0x22cbf4,null))[_0xf505('0x3c')](handleError(_0x22cbf4,null));};exports['destroy']=function(_0x2f30fc,_0xd6e8f6){return db[_0xf505('0x26')]['find']({'where':{'id':_0x2f30fc[_0xf505('0x3d')]['id']}})[_0xf505('0x20')](handleEntityNotFound(_0xd6e8f6,null))[_0xf505('0x20')](removeEntity(_0xd6e8f6,null))['catch'](handleError(_0xd6e8f6,null));};exports[_0xf505('0x46')]=function(_0x1fe8f0,_0x5d25ac){return db[_0xf505('0x26')][_0xf505('0x46')]()[_0xf505('0x20')](respondWithResult(_0x5d25ac,null))[_0xf505('0x3c')](handleError(_0x5d25ac,null));}; \ No newline at end of file +var _0x5728=['key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareReport','rawAttributes','type'];(function(_0x48f5a7,_0x19a824){var _0x30234b=function(_0x2d0fb0){while(--_0x2d0fb0){_0x48f5a7['push'](_0x48f5a7['shift']());}};_0x30234b(++_0x19a824);}(_0x5728,0xb5));var _0x8572=function(_0x4d8e4e,_0xfc4f7){_0x4d8e4e=_0x4d8e4e-0x0;var _0x4debcc=_0x5728[_0x4d8e4e];return _0x4debcc;};'use strict';var emlformat=require(_0x8572('0x0'));var rimraf=require(_0x8572('0x1'));var zipdir=require(_0x8572('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8572('0x3'));var moment=require(_0x8572('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8572('0x5'));var util=require(_0x8572('0x6'));var path=require(_0x8572('0x7'));var sox=require(_0x8572('0x8'));var csv=require(_0x8572('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8572('0xa'));var crypto=require(_0x8572('0xb'));var jsforce=require(_0x8572('0xc'));var deskjs=require(_0x8572('0xd'));var toCsv=require(_0x8572('0x9'));var querystring=require(_0x8572('0xe'));var Papa=require(_0x8572('0xf'));var Redis=require(_0x8572('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8572('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8572('0x12'));var utils=require(_0x8572('0x13'));var config=require(_0x8572('0x14'));var licenseUtil=require(_0x8572('0x15'));var db=require(_0x8572('0x16'))['db'];function respondWithStatusCode(_0x38691d,_0x252873){_0x252873=_0x252873||0xcc;return function(_0x266f60){if(_0x266f60){return _0x38691d['sendStatus'](_0x252873);}return _0x38691d[_0x8572('0x17')](_0x252873)[_0x8572('0x18')]();};}function respondWithResult(_0x4dd704,_0x415ff7){_0x415ff7=_0x415ff7||0xc8;return function(_0x44a259){if(_0x44a259){return _0x4dd704[_0x8572('0x17')](_0x415ff7)[_0x8572('0x19')](_0x44a259);}};}function respondWithFilteredResult(_0x47f392,_0x10d35d){return function(_0x38e9bd){if(_0x38e9bd){var _0x8416e3=typeof _0x10d35d['offset']===_0x8572('0x1a')&&typeof _0x10d35d['limit']===_0x8572('0x1a');var _0x20efa5=_0x38e9bd[_0x8572('0x1b')];var _0xbdf7ca=_0x8416e3?0x0:_0x10d35d[_0x8572('0x1c')];var _0x2954d5=_0x8416e3?_0x38e9bd[_0x8572('0x1b')]:_0x10d35d[_0x8572('0x1c')]+_0x10d35d[_0x8572('0x1d')];var _0x3dc631;if(_0x2954d5>=_0x20efa5){_0x2954d5=_0x20efa5;_0x3dc631=0xc8;}else{_0x3dc631=0xce;}_0x47f392[_0x8572('0x17')](_0x3dc631);return _0x47f392[_0x8572('0x1e')](_0x8572('0x1f'),_0xbdf7ca+'-'+_0x2954d5+'/'+_0x20efa5)['json'](_0x38e9bd);}return null;};}function patchUpdates(_0x39e708){return function(_0x555389){try{jsonpatch[_0x8572('0x20')](_0x555389,_0x39e708,!![]);}catch(_0x198563){return BPromise['reject'](_0x198563);}return _0x555389[_0x8572('0x21')]();};}function saveUpdates(_0x2bc303,_0xda7e32){return function(_0x530a71){if(_0x530a71){return _0x530a71[_0x8572('0x22')](_0x2bc303)[_0x8572('0x23')](function(_0x11d9c4){return _0x11d9c4;});}return null;};}function removeEntity(_0x474bd7,_0x7d90ea){return function(_0x4d8cd5){if(_0x4d8cd5){return _0x4d8cd5[_0x8572('0x24')]()[_0x8572('0x23')](function(){_0x474bd7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x251f70,_0x31e6a0){return function(_0x47189f){if(!_0x47189f){_0x251f70[_0x8572('0x25')](0x194);}return _0x47189f;};}function handleError(_0xb89411,_0x455d59){_0x455d59=_0x455d59||0x1f4;return function(_0x61627f){logger[_0x8572('0x26')](_0x61627f[_0x8572('0x27')]);if(_0x61627f[_0x8572('0x28')]){delete _0x61627f[_0x8572('0x28')];}_0xb89411['status'](_0x455d59)[_0x8572('0x29')](_0x61627f);};}exports[_0x8572('0x2a')]=function(_0x478f73,_0x39b6ef){var _0x4e9095={},_0x54de20={},_0x471488={'count':0x0,'rows':[]};var _0x3b4266=_[_0x8572('0x2b')](db[_0x8572('0x2c')][_0x8572('0x2d')],function(_0x2e1309){return{'name':_0x2e1309['fieldName'],'type':_0x2e1309[_0x8572('0x2e')][_0x8572('0x2f')]};});_0x54de20[_0x8572('0x30')]=_['map'](_0x3b4266,_0x8572('0x28'));_0x54de20['query']=_[_0x8572('0x31')](_0x478f73[_0x8572('0x32')]);_0x54de20['filters']=_[_0x8572('0x33')](_0x54de20['model'],_0x54de20[_0x8572('0x32')]);_0x4e9095[_0x8572('0x34')]=_[_0x8572('0x33')](_0x54de20[_0x8572('0x30')],qs[_0x8572('0x35')](_0x478f73[_0x8572('0x32')][_0x8572('0x35')]));_0x4e9095[_0x8572('0x34')]=_0x4e9095['attributes'][_0x8572('0x36')]?_0x4e9095[_0x8572('0x34')]:_0x54de20[_0x8572('0x30')];if(!_0x478f73[_0x8572('0x32')]['hasOwnProperty'](_0x8572('0x37'))){_0x4e9095[_0x8572('0x1d')]=qs['limit'](_0x478f73['query'][_0x8572('0x1d')]);_0x4e9095['offset']=qs[_0x8572('0x1c')](_0x478f73['query'][_0x8572('0x1c')]);}_0x4e9095[_0x8572('0x38')]=qs[_0x8572('0x39')](_0x478f73[_0x8572('0x32')]['sort']);_0x4e9095[_0x8572('0x3a')]=qs[_0x8572('0x3b')](_[_0x8572('0x3c')](_0x478f73[_0x8572('0x32')],_0x54de20[_0x8572('0x3b')]),_0x3b4266);if(_0x478f73[_0x8572('0x32')]['filter']){_0x4e9095['where']=_[_0x8572('0x3d')](_0x4e9095[_0x8572('0x3a')],{'$or':_[_0x8572('0x2b')](_0x3b4266,function(_0x3eec28){if(_0x3eec28[_0x8572('0x2e')]!==_0x8572('0x3e')){var _0x5d1c82={};_0x5d1c82[_0x3eec28[_0x8572('0x28')]]={'$like':'%'+_0x478f73[_0x8572('0x32')][_0x8572('0x3f')]+'%'};return _0x5d1c82;}})});}_0x4e9095=_[_0x8572('0x3d')]({},_0x4e9095,_0x478f73[_0x8572('0x40')]);var _0x25a09b={'where':_0x4e9095[_0x8572('0x3a')]};return db[_0x8572('0x2c')]['count'](_0x25a09b)[_0x8572('0x23')](function(_0x359ed9){_0x471488[_0x8572('0x1b')]=_0x359ed9;if(_0x478f73[_0x8572('0x32')][_0x8572('0x41')]){_0x4e9095[_0x8572('0x42')]=[{'all':!![]}];}return db[_0x8572('0x2c')][_0x8572('0x43')](_0x4e9095);})[_0x8572('0x23')](function(_0x35cd3a){_0x471488[_0x8572('0x44')]=_0x35cd3a;return _0x471488;})[_0x8572('0x23')](respondWithFilteredResult(_0x39b6ef,_0x4e9095))[_0x8572('0x45')](handleError(_0x39b6ef,null));};exports[_0x8572('0x46')]=function(_0x9deabb,_0x65b64){var _0x1476a6={'raw':!![],'where':{'id':_0x9deabb['params']['id']}},_0x55851e={};_0x55851e[_0x8572('0x30')]=_[_0x8572('0x31')](db['SquareReport'][_0x8572('0x2d')]);_0x55851e[_0x8572('0x32')]=_[_0x8572('0x31')](_0x9deabb[_0x8572('0x32')]);_0x55851e[_0x8572('0x3b')]=_[_0x8572('0x33')](_0x55851e[_0x8572('0x30')],_0x55851e[_0x8572('0x32')]);_0x1476a6[_0x8572('0x34')]=_[_0x8572('0x33')](_0x55851e['model'],qs[_0x8572('0x35')](_0x9deabb[_0x8572('0x32')][_0x8572('0x35')]));_0x1476a6['attributes']=_0x1476a6[_0x8572('0x34')][_0x8572('0x36')]?_0x1476a6['attributes']:_0x55851e['model'];if(_0x9deabb[_0x8572('0x32')][_0x8572('0x41')]){_0x1476a6[_0x8572('0x42')]=[{'all':!![]}];}_0x1476a6=_[_0x8572('0x3d')]({},_0x1476a6,_0x9deabb[_0x8572('0x40')]);return db[_0x8572('0x2c')][_0x8572('0x47')](_0x1476a6)[_0x8572('0x23')](handleEntityNotFound(_0x65b64,null))[_0x8572('0x23')](respondWithResult(_0x65b64,null))[_0x8572('0x45')](handleError(_0x65b64,null));};exports[_0x8572('0x48')]=function(_0x2ca9fe,_0x39836a){return db[_0x8572('0x2c')][_0x8572('0x48')](_0x2ca9fe['body'],{})[_0x8572('0x23')](respondWithResult(_0x39836a,0xc9))[_0x8572('0x45')](handleError(_0x39836a,null));};exports[_0x8572('0x22')]=function(_0x180e5a,_0x36dd0e){if(_0x180e5a[_0x8572('0x49')]['id']){delete _0x180e5a[_0x8572('0x49')]['id'];}return db[_0x8572('0x2c')]['find']({'where':{'id':_0x180e5a['params']['id']}})[_0x8572('0x23')](handleEntityNotFound(_0x36dd0e,null))[_0x8572('0x23')](saveUpdates(_0x180e5a[_0x8572('0x49')],null))[_0x8572('0x23')](respondWithResult(_0x36dd0e,null))[_0x8572('0x45')](handleError(_0x36dd0e,null));};exports[_0x8572('0x24')]=function(_0x82332,_0x102454){return db[_0x8572('0x2c')][_0x8572('0x47')]({'where':{'id':_0x82332[_0x8572('0x4a')]['id']}})[_0x8572('0x23')](handleEntityNotFound(_0x102454,null))[_0x8572('0x23')](removeEntity(_0x102454,null))[_0x8572('0x45')](handleError(_0x102454,null));};exports[_0x8572('0x4b')]=function(_0xa18b26,_0x29f1aa){return db['SquareReport'][_0x8572('0x4b')]()[_0x8572('0x23')](respondWithResult(_0x29f1aa,null))[_0x8572('0x45')](handleError(_0x29f1aa,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e0ca4ec..710d922 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 _0xa068=['uniqueid','project_name','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa068,0x122));var _0x8a06=function(_0xc8530e,_0x292597){_0xc8530e=_0xc8530e-0x0;var _0x53c7fa=_0xa068[_0xc8530e];return _0x53c7fa;};'use strict';var _=require('lodash');var util=require(_0x8a06('0x0'));var logger=require(_0x8a06('0x1'))(_0x8a06('0x2'));var moment=require(_0x8a06('0x3'));var BPromise=require(_0x8a06('0x4'));var rp=require(_0x8a06('0x5'));var fs=require('fs');var path=require(_0x8a06('0x6'));var rimraf=require(_0x8a06('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a06('0x8'));module[_0x8a06('0x9')]=function(_0x2098df,_0x58f0b9){return _0x2098df[_0x8a06('0xa')](_0x8a06('0xb'),attributes,{'tableName':_0x8a06('0xc'),'paranoid':![],'indexes':[{'name':_0x8a06('0xd'),'fields':[_0x8a06('0xe'),_0x8a06('0xf')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf7c=['uniqueid','project_name','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xbf7c,0xf0));var _0xcbf7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbf7c[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xcbf7('0x0'));var util=require(_0xcbf7('0x1'));var logger=require(_0xcbf7('0x2'))('api');var moment=require(_0xcbf7('0x3'));var BPromise=require('bluebird');var rp=require(_0xcbf7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcbf7('0x5'));var attributes=require(_0xcbf7('0x6'));module[_0xcbf7('0x7')]=function(_0x43579f,_0x4d3362){return _0x43579f[_0xcbf7('0x8')](_0xcbf7('0x9'),attributes,{'tableName':_0xcbf7('0xa'),'paranoid':![],'indexes':[{'name':_0xcbf7('0xb'),'fields':[_0xcbf7('0xc'),_0xcbf7('0xd')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 1874340..b848c28 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 _0x6cb9=['SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info'];(function(_0x206403,_0x28a496){var _0x4373ad=function(_0xdcf5f0){while(--_0xdcf5f0){_0x206403['push'](_0x206403['shift']());}};_0x4373ad(++_0x28a496);}(_0x6cb9,0x17e));var _0x96cb=function(_0x3806f7,_0xf20f97){_0x3806f7=_0x3806f7-0x0;var _0x27c67d=_0x6cb9[_0x3806f7];return _0x27c67d;};'use strict';var _=require(_0x96cb('0x0'));var util=require(_0x96cb('0x1'));var moment=require(_0x96cb('0x2'));var BPromise=require(_0x96cb('0x3'));var rs=require(_0x96cb('0x4'));var fs=require('fs');var Redis=require(_0x96cb('0x5'));var db=require(_0x96cb('0x6'))['db'];var utils=require(_0x96cb('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x96cb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x96cb('0x9')][_0x96cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfa40d2,_0x177eb1,_0x4a377f){return new BPromise(function(_0x3a1fbe,_0x3315ca){return client[_0x96cb('0xb')](_0xfa40d2,_0x4a377f)[_0x96cb('0xc')](function(_0x4e1f26){logger[_0x96cb('0xd')](_0x96cb('0xe'),_0x177eb1,'request\x20sent');logger[_0x96cb('0xf')](_0x96cb('0x10'),_0x177eb1,_0x96cb('0x11'),JSON[_0x96cb('0x12')](_0x4e1f26));if(_0x4e1f26[_0x96cb('0x13')]){if(_0x4e1f26['error']['code']===0x1f4){logger[_0x96cb('0x13')](_0x96cb('0xe'),_0x177eb1,_0x4e1f26[_0x96cb('0x13')][_0x96cb('0x14')]);return _0x3315ca(_0x4e1f26[_0x96cb('0x13')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x177eb1,_0x4e1f26[_0x96cb('0x13')][_0x96cb('0x14')]);return _0x3a1fbe(_0x4e1f26[_0x96cb('0x13')][_0x96cb('0x14')]);}else{logger[_0x96cb('0xd')](_0x96cb('0xe'),_0x177eb1,_0x96cb('0x11'));_0x3a1fbe(_0x4e1f26['result'][_0x96cb('0x14')]);}})[_0x96cb('0x15')](function(_0x46cd3e){logger[_0x96cb('0x13')](_0x96cb('0xe'),_0x177eb1,_0x46cd3e);_0x3315ca(_0x46cd3e);});});}exports[_0x96cb('0x16')]=function(_0x39fcba){var _0x119b8c=this;return new Promise(function(_0x280a44,_0x2a1a66){return db[_0x96cb('0x17')][_0x96cb('0x18')](_0x39fcba['body'],{'raw':_0x39fcba[_0x96cb('0x19')]?_0x39fcba['options'][_0x96cb('0x1a')]===undefined?!![]:![]:!![]})[_0x96cb('0xc')](function(_0x28b69e){logger[_0x96cb('0xd')]('CreateSquareReport',_0x39fcba);logger[_0x96cb('0xf')](_0x96cb('0x16'),_0x39fcba,JSON[_0x96cb('0x12')](_0x28b69e));_0x280a44(_0x28b69e);})[_0x96cb('0x15')](function(_0x18e578){logger['error'](_0x96cb('0x16'),_0x18e578[_0x96cb('0x14')],_0x39fcba);_0x2a1a66(_0x119b8c['error'](0x1f4,_0x18e578[_0x96cb('0x14')]));});});};exports[_0x96cb('0x1b')]=function(_0x2914ba){var _0xed8494=this;return new Promise(function(_0x4509c1,_0x1e3c49){return db[_0x96cb('0x17')][_0x96cb('0x1c')](_0x2914ba[_0x96cb('0x1d')],{'raw':_0x2914ba[_0x96cb('0x19')]?_0x2914ba[_0x96cb('0x19')][_0x96cb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2914ba['options']?_0x2914ba['options'][_0x96cb('0x1e')]||null:null,'attributes':_0x2914ba[_0x96cb('0x19')]?_0x2914ba[_0x96cb('0x19')][_0x96cb('0x1f')]||null:null,'limit':_0x2914ba['options']?_0x2914ba[_0x96cb('0x19')][_0x96cb('0x20')]||null:null})['then'](function(_0x52de97){logger[_0x96cb('0xd')](_0x96cb('0x1b'),_0x2914ba);logger['debug']('UpdateSquareReport',_0x2914ba,JSON[_0x96cb('0x12')](_0x52de97));_0x4509c1(_0x52de97);})[_0x96cb('0x15')](function(_0x50a4d2){logger[_0x96cb('0x13')]('UpdateSquareReport',_0x50a4d2[_0x96cb('0x14')],_0x2914ba);_0x1e3c49(_0xed8494['error'](0x1f4,_0x50a4d2[_0x96cb('0x14')]));});});}; \ No newline at end of file +var _0x3e81=['update','where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','SquareReport','body','options','raw','debug','UpdateSquareReport'];(function(_0x245772,_0x2c0818){var _0x1a1c3b=function(_0x4087ac){while(--_0x4087ac){_0x245772['push'](_0x245772['shift']());}};_0x1a1c3b(++_0x2c0818);}(_0x3e81,0x124));var _0x13e8=function(_0x11d065,_0x34eb09){_0x11d065=_0x11d065-0x0;var _0x2cfe39=_0x3e81[_0x11d065];return _0x2cfe39;};'use strict';var _=require(_0x13e8('0x0'));var util=require(_0x13e8('0x1'));var moment=require('moment');var BPromise=require(_0x13e8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13e8('0x3'));var db=require(_0x13e8('0x4'))['db'];var utils=require(_0x13e8('0x5'));var logger=require(_0x13e8('0x6'))('rpc');var config=require(_0x13e8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x13e8('0x8')][_0x13e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b38bd,_0x4b2b05,_0xa83b46){return new BPromise(function(_0x26c8f0,_0x4627fe){return client[_0x13e8('0xa')](_0x2b38bd,_0xa83b46)[_0x13e8('0xb')](function(_0x1bdf90){logger[_0x13e8('0xc')](_0x13e8('0xd'),_0x4b2b05,_0x13e8('0xe'));logger['debug'](_0x13e8('0xf'),_0x4b2b05,'request\x20sent',JSON[_0x13e8('0x10')](_0x1bdf90));if(_0x1bdf90[_0x13e8('0x11')]){if(_0x1bdf90['error'][_0x13e8('0x12')]===0x1f4){logger[_0x13e8('0x11')]('SquareReport,\x20%s,\x20%s',_0x4b2b05,_0x1bdf90['error']['message']);return _0x4627fe(_0x1bdf90[_0x13e8('0x11')]['message']);}logger['error'](_0x13e8('0xd'),_0x4b2b05,_0x1bdf90[_0x13e8('0x11')][_0x13e8('0x13')]);return _0x26c8f0(_0x1bdf90[_0x13e8('0x11')][_0x13e8('0x13')]);}else{logger[_0x13e8('0xc')](_0x13e8('0xd'),_0x4b2b05,'request\x20sent');_0x26c8f0(_0x1bdf90['result'][_0x13e8('0x13')]);}})[_0x13e8('0x14')](function(_0x21da4c){logger[_0x13e8('0x11')](_0x13e8('0xd'),_0x4b2b05,_0x21da4c);_0x4627fe(_0x21da4c);});});}exports[_0x13e8('0x15')]=function(_0x3ffdce){var _0x11c9d3=this;return new Promise(function(_0x5acb73,_0x25931a){return db[_0x13e8('0x16')]['create'](_0x3ffdce[_0x13e8('0x17')],{'raw':_0x3ffdce['options']?_0x3ffdce[_0x13e8('0x18')][_0x13e8('0x19')]===undefined?!![]:![]:!![]})[_0x13e8('0xb')](function(_0xb4eeb7){logger[_0x13e8('0xc')]('CreateSquareReport',_0x3ffdce);logger[_0x13e8('0x1a')](_0x13e8('0x15'),_0x3ffdce,JSON['stringify'](_0xb4eeb7));_0x5acb73(_0xb4eeb7);})['catch'](function(_0x61269a){logger[_0x13e8('0x11')](_0x13e8('0x15'),_0x61269a[_0x13e8('0x13')],_0x3ffdce);_0x25931a(_0x11c9d3[_0x13e8('0x11')](0x1f4,_0x61269a[_0x13e8('0x13')]));});});};exports[_0x13e8('0x1b')]=function(_0x30b6ca){var _0x1561ed=this;return new Promise(function(_0x856fed,_0x5f5da6){return db[_0x13e8('0x16')][_0x13e8('0x1c')](_0x30b6ca[_0x13e8('0x17')],{'raw':_0x30b6ca['options']?_0x30b6ca[_0x13e8('0x18')][_0x13e8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30b6ca[_0x13e8('0x18')]?_0x30b6ca[_0x13e8('0x18')][_0x13e8('0x1d')]||null:null,'attributes':_0x30b6ca[_0x13e8('0x18')]?_0x30b6ca[_0x13e8('0x18')][_0x13e8('0x1e')]||null:null,'limit':_0x30b6ca['options']?_0x30b6ca[_0x13e8('0x18')][_0x13e8('0x1f')]||null:null})['then'](function(_0x4ab8f3){logger[_0x13e8('0xc')](_0x13e8('0x1b'),_0x30b6ca);logger[_0x13e8('0x1a')]('UpdateSquareReport',_0x30b6ca,JSON[_0x13e8('0x10')](_0x4ab8f3));_0x856fed(_0x4ab8f3);})[_0x13e8('0x14')](function(_0x5ebe8f){logger[_0x13e8('0x11')]('UpdateSquareReport',_0x5ebe8f[_0x13e8('0x13')],_0x30b6ca);_0x5f5da6(_0x1561ed[_0x13e8('0x11')](0x1f4,_0x5ebe8f[_0x13e8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index cbe6b14..9086d66 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 _0x0ba1=['/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x6180e6,_0x3ff8ec){var _0x3dcd81=function(_0x1c10d7){while(--_0x1c10d7){_0x6180e6['push'](_0x6180e6['shift']());}};_0x3dcd81(++_0x3ff8ec);}(_0x0ba1,0x126));var _0x10ba=function(_0x7ba01,_0xf9c8b9){_0x7ba01=_0x7ba01-0x0;var _0x4be6b4=_0x0ba1[_0x7ba01];return _0x4be6b4;};'use strict';var multer=require('multer');var util=require(_0x10ba('0x0'));var path=require(_0x10ba('0x1'));var timeout=require(_0x10ba('0x2'));var express=require(_0x10ba('0x3'));var router=express[_0x10ba('0x4')]();var fs_extra=require(_0x10ba('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x10ba('0x6'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x10ba('0x7')](),controller[_0x10ba('0x8')]);router[_0x10ba('0x9')](_0x10ba('0xa'),auth[_0x10ba('0x7')](),controller[_0x10ba('0xb')]);router[_0x10ba('0x9')](_0x10ba('0xc'),auth[_0x10ba('0x7')](),controller[_0x10ba('0xd')]);router['post']('/',auth[_0x10ba('0x7')](),controller[_0x10ba('0xe')]);router[_0x10ba('0xf')](_0x10ba('0xc'),auth[_0x10ba('0x7')](),controller['update']);router[_0x10ba('0x10')](_0x10ba('0xc'),auth['isAuthenticated'](),controller[_0x10ba('0x11')]);module[_0x10ba('0x12')]=router; \ No newline at end of file +var _0x1cb1=['post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x1cb1,0x137));var _0x11cb=function(_0x6ff0ae,_0x57b636){_0x6ff0ae=_0x6ff0ae-0x0;var _0x4ce748=_0x1cb1[_0x6ff0ae];return _0x4ce748;};'use strict';var multer=require(_0x11cb('0x0'));var util=require(_0x11cb('0x1'));var path=require(_0x11cb('0x2'));var timeout=require(_0x11cb('0x3'));var express=require('express');var router=express[_0x11cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x11cb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x11cb('0x6'));var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x11cb('0x7')](_0x11cb('0x8'),auth[_0x11cb('0x9')](),controller[_0x11cb('0xa')]);router[_0x11cb('0x7')](_0x11cb('0xb'),auth[_0x11cb('0x9')](),controller[_0x11cb('0xc')]);router[_0x11cb('0xd')]('/',auth[_0x11cb('0x9')](),controller[_0x11cb('0xe')]);router[_0x11cb('0xf')](_0x11cb('0xb'),auth[_0x11cb('0x9')](),controller['update']);router[_0x11cb('0x10')]('/:id',auth[_0x11cb('0x9')](),controller[_0x11cb('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index a3bdeaa..6e83016 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 _0xe8e6=['STRING','TEXT','exports'];(function(_0x419c87,_0x41bf4d){var _0x3ac07f=function(_0x43240c){while(--_0x43240c){_0x419c87['push'](_0x419c87['shift']());}};_0x3ac07f(++_0x41bf4d);}(_0xe8e6,0x116));var _0x6e8e=function(_0xa26780,_0x269dc3){_0xa26780=_0xa26780-0x0;var _0x39556d=_0xe8e6[_0xa26780];return _0x39556d;};'use strict';var Sequelize=require('sequelize');module[_0x6e8e('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x6e8e('0x1')]},'application':{'type':Sequelize[_0x6e8e('0x1')]},'data':{'type':Sequelize[_0x6e8e('0x2')]},'project_name':{'type':Sequelize[_0x6e8e('0x1')]},'callerid':{'type':Sequelize[_0x6e8e('0x1')]}}; \ No newline at end of file +var _0x745f=['exports','STRING','TEXT','sequelize'];(function(_0x340df9,_0x58fe4d){var _0x4b5637=function(_0x3ca7f3){while(--_0x3ca7f3){_0x340df9['push'](_0x340df9['shift']());}};_0x4b5637(++_0x58fe4d);}(_0x745f,0x127));var _0xf745=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0x745f[_0x1e5068];return _0x2230b6;};'use strict';var Sequelize=require(_0xf745('0x0'));module[_0xf745('0x1')]={'uniqueid':{'type':Sequelize[_0xf745('0x2')]},'node':{'type':Sequelize[_0xf745('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xf745('0x3')]},'project_name':{'type':Sequelize[_0xf745('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 752afc6..41123c5 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 _0x1936=['create','update','body','find','describe','rimraf','fast-json-patch','bluebird','util','path','sox','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','destroy','then','name','send','index','map','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','SquareDetailsReport','includeAll','include','findAll','rows','params','keys','options','catch'];(function(_0x39cbe4,_0x4a7958){var _0xe76ba7=function(_0x332a08){while(--_0x332a08){_0x39cbe4['push'](_0x39cbe4['shift']());}};_0xe76ba7(++_0x4a7958);}(_0x1936,0x1e1));var _0x6193=function(_0x721e8b,_0x5e679d){_0x721e8b=_0x721e8b-0x0;var _0x3a0b53=_0x1936[_0x721e8b];return _0x3a0b53;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6193('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6193('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6193('0x2'));var Mustache=require('mustache');var util=require(_0x6193('0x3'));var path=require(_0x6193('0x4'));var sox=require(_0x6193('0x5'));var csv=require('to-csv');var ejs=require(_0x6193('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6193('0x7'));var jsforce=require(_0x6193('0x8'));var deskjs=require(_0x6193('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6193('0xa'));var Redis=require(_0x6193('0xb'));var authService=require(_0x6193('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6193('0xd'));var logger=require('../../config/logger')(_0x6193('0xe'));var utils=require(_0x6193('0xf'));var config=require(_0x6193('0x10'));var licenseUtil=require(_0x6193('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe36e77,_0x1bb856){_0x1bb856=_0x1bb856||0xcc;return function(_0x8c0d83){if(_0x8c0d83){return _0xe36e77[_0x6193('0x12')](_0x1bb856);}return _0xe36e77[_0x6193('0x13')](_0x1bb856)[_0x6193('0x14')]();};}function respondWithResult(_0x346bc9,_0x2e60e8){_0x2e60e8=_0x2e60e8||0xc8;return function(_0x7b7fe6){if(_0x7b7fe6){return _0x346bc9[_0x6193('0x13')](_0x2e60e8)[_0x6193('0x15')](_0x7b7fe6);}};}function respondWithFilteredResult(_0x1ed90f,_0x483128){return function(_0x2114bc){if(_0x2114bc){var _0x279d79=typeof _0x483128['offset']===_0x6193('0x16')&&typeof _0x483128['limit']===_0x6193('0x16');var _0x27f02c=_0x2114bc[_0x6193('0x17')];var _0x4b80a2=_0x279d79?0x0:_0x483128['offset'];var _0x2dcb1c=_0x279d79?_0x2114bc[_0x6193('0x17')]:_0x483128[_0x6193('0x18')]+_0x483128[_0x6193('0x19')];var _0x32bd51;if(_0x2dcb1c>=_0x27f02c){_0x2dcb1c=_0x27f02c;_0x32bd51=0xc8;}else{_0x32bd51=0xce;}_0x1ed90f[_0x6193('0x13')](_0x32bd51);return _0x1ed90f['set'](_0x6193('0x1a'),_0x4b80a2+'-'+_0x2dcb1c+'/'+_0x27f02c)[_0x6193('0x15')](_0x2114bc);}return null;};}function patchUpdates(_0x48f729){return function(_0x2e88e1){try{jsonpatch[_0x6193('0x1b')](_0x2e88e1,_0x48f729,!![]);}catch(_0x5f5776){return BPromise[_0x6193('0x1c')](_0x5f5776);}return _0x2e88e1['save']();};}function saveUpdates(_0x5411f7,_0x532849){return function(_0x2c2344){if(_0x2c2344){return _0x2c2344['update'](_0x5411f7)['then'](function(_0x3811ac){return _0x3811ac;});}return null;};}function removeEntity(_0x8f9c32,_0x1d871f){return function(_0x49119a){if(_0x49119a){return _0x49119a[_0x6193('0x1d')]()[_0x6193('0x1e')](function(){_0x8f9c32['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c25a,_0x375658){return function(_0xd25d50){if(!_0xd25d50){_0x46c25a[_0x6193('0x12')](0x194);}return _0xd25d50;};}function handleError(_0x354137,_0x317493){_0x317493=_0x317493||0x1f4;return function(_0x469ba5){logger['error'](_0x469ba5['stack']);if(_0x469ba5[_0x6193('0x1f')]){delete _0x469ba5[_0x6193('0x1f')];}_0x354137['status'](_0x317493)[_0x6193('0x20')](_0x469ba5);};}exports[_0x6193('0x21')]=function(_0x2fe436,_0x33f0bd){var _0x1957e7={},_0x18eff1={},_0x2bf0b7={'count':0x0,'rows':[]};var _0x128a52=_[_0x6193('0x22')](db['SquareDetailsReport'][_0x6193('0x23')],function(_0x2521d7){return{'name':_0x2521d7['fieldName'],'type':_0x2521d7['type'][_0x6193('0x24')]};});_0x18eff1[_0x6193('0x25')]=_[_0x6193('0x22')](_0x128a52,_0x6193('0x1f'));_0x18eff1[_0x6193('0x26')]=_['keys'](_0x2fe436[_0x6193('0x26')]);_0x18eff1[_0x6193('0x27')]=_['intersection'](_0x18eff1['model'],_0x18eff1[_0x6193('0x26')]);_0x1957e7[_0x6193('0x28')]=_[_0x6193('0x29')](_0x18eff1[_0x6193('0x25')],qs[_0x6193('0x2a')](_0x2fe436[_0x6193('0x26')]['fields']));_0x1957e7[_0x6193('0x28')]=_0x1957e7[_0x6193('0x28')][_0x6193('0x2b')]?_0x1957e7['attributes']:_0x18eff1[_0x6193('0x25')];if(!_0x2fe436[_0x6193('0x26')][_0x6193('0x2c')](_0x6193('0x2d'))){_0x1957e7[_0x6193('0x19')]=qs[_0x6193('0x19')](_0x2fe436['query']['limit']);_0x1957e7['offset']=qs[_0x6193('0x18')](_0x2fe436[_0x6193('0x26')]['offset']);}_0x1957e7[_0x6193('0x2e')]=qs[_0x6193('0x2f')](_0x2fe436[_0x6193('0x26')][_0x6193('0x2f')]);_0x1957e7[_0x6193('0x30')]=qs[_0x6193('0x27')](_[_0x6193('0x31')](_0x2fe436['query'],_0x18eff1[_0x6193('0x27')]),_0x128a52);if(_0x2fe436[_0x6193('0x26')][_0x6193('0x32')]){_0x1957e7[_0x6193('0x30')]=_[_0x6193('0x33')](_0x1957e7['where'],{'$or':_[_0x6193('0x22')](_0x128a52,function(_0x19ade8){if(_0x19ade8[_0x6193('0x34')]!==_0x6193('0x35')){var _0x4524a5={};_0x4524a5[_0x19ade8[_0x6193('0x1f')]]={'$like':'%'+_0x2fe436[_0x6193('0x26')][_0x6193('0x32')]+'%'};return _0x4524a5;}})});}_0x1957e7=_[_0x6193('0x33')]({},_0x1957e7,_0x2fe436['options']);var _0x1172ef={'where':_0x1957e7[_0x6193('0x30')]};return db[_0x6193('0x36')]['count'](_0x1172ef)[_0x6193('0x1e')](function(_0x20ef0d){_0x2bf0b7[_0x6193('0x17')]=_0x20ef0d;if(_0x2fe436['query'][_0x6193('0x37')]){_0x1957e7[_0x6193('0x38')]=[{'all':!![]}];}return db[_0x6193('0x36')][_0x6193('0x39')](_0x1957e7);})['then'](function(_0x10babf){_0x2bf0b7[_0x6193('0x3a')]=_0x10babf;return _0x2bf0b7;})['then'](respondWithFilteredResult(_0x33f0bd,_0x1957e7))['catch'](handleError(_0x33f0bd,null));};exports['show']=function(_0xfec6ce,_0x2a1fc3){var _0x4bede5={'raw':!![],'where':{'id':_0xfec6ce[_0x6193('0x3b')]['id']}},_0x391101={};_0x391101[_0x6193('0x25')]=_[_0x6193('0x3c')](db['SquareDetailsReport'][_0x6193('0x23')]);_0x391101['query']=_[_0x6193('0x3c')](_0xfec6ce['query']);_0x391101[_0x6193('0x27')]=_[_0x6193('0x29')](_0x391101[_0x6193('0x25')],_0x391101[_0x6193('0x26')]);_0x4bede5[_0x6193('0x28')]=_[_0x6193('0x29')](_0x391101[_0x6193('0x25')],qs[_0x6193('0x2a')](_0xfec6ce[_0x6193('0x26')][_0x6193('0x2a')]));_0x4bede5[_0x6193('0x28')]=_0x4bede5[_0x6193('0x28')]['length']?_0x4bede5['attributes']:_0x391101[_0x6193('0x25')];if(_0xfec6ce[_0x6193('0x26')][_0x6193('0x37')]){_0x4bede5[_0x6193('0x38')]=[{'all':!![]}];}_0x4bede5=_[_0x6193('0x33')]({},_0x4bede5,_0xfec6ce[_0x6193('0x3d')]);return db[_0x6193('0x36')]['find'](_0x4bede5)[_0x6193('0x1e')](handleEntityNotFound(_0x2a1fc3,null))['then'](respondWithResult(_0x2a1fc3,null))[_0x6193('0x3e')](handleError(_0x2a1fc3,null));};exports['create']=function(_0x11b0d0,_0x1cb8db){return db[_0x6193('0x36')][_0x6193('0x3f')](_0x11b0d0['body'],{})[_0x6193('0x1e')](respondWithResult(_0x1cb8db,0xc9))[_0x6193('0x3e')](handleError(_0x1cb8db,null));};exports[_0x6193('0x40')]=function(_0x1bab58,_0x581074){if(_0x1bab58[_0x6193('0x41')]['id']){delete _0x1bab58['body']['id'];}return db[_0x6193('0x36')][_0x6193('0x42')]({'where':{'id':_0x1bab58[_0x6193('0x3b')]['id']}})['then'](handleEntityNotFound(_0x581074,null))[_0x6193('0x1e')](saveUpdates(_0x1bab58[_0x6193('0x41')],null))[_0x6193('0x1e')](respondWithResult(_0x581074,null))[_0x6193('0x3e')](handleError(_0x581074,null));};exports[_0x6193('0x1d')]=function(_0x1d3ee5,_0x260744){return db[_0x6193('0x36')]['find']({'where':{'id':_0x1d3ee5[_0x6193('0x3b')]['id']}})[_0x6193('0x1e')](handleEntityNotFound(_0x260744,null))[_0x6193('0x1e')](removeEntity(_0x260744,null))[_0x6193('0x3e')](handleError(_0x260744,null));};exports[_0x6193('0x43')]=function(_0x5f2b8a,_0x3c48ea){return db[_0x6193('0x36')][_0x6193('0x43')]()['then'](respondWithResult(_0x3c48ea,null))['catch'](handleError(_0x3c48ea,null));}; \ No newline at end of file +var _0x4645=['offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','SquareDetailsReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count'];(function(_0x2b72d1,_0x112508){var _0x482358=function(_0x4c827c){while(--_0x4c827c){_0x2b72d1['push'](_0x2b72d1['shift']());}};_0x482358(++_0x112508);}(_0x4645,0x141));var _0x5464=function(_0x24e18d,_0x239822){_0x24e18d=_0x24e18d-0x0;var _0xa570be=_0x4645[_0x24e18d];return _0xa570be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5464('0x0'));var zipdir=require(_0x5464('0x1'));var jsonpatch=require(_0x5464('0x2'));var rp=require('request-promise');var moment=require(_0x5464('0x3'));var BPromise=require(_0x5464('0x4'));var Mustache=require('mustache');var util=require(_0x5464('0x5'));var path=require(_0x5464('0x6'));var sox=require(_0x5464('0x7'));var csv=require(_0x5464('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5464('0x9'));var crypto=require(_0x5464('0xa'));var jsforce=require(_0x5464('0xb'));var deskjs=require(_0x5464('0xc'));var toCsv=require(_0x5464('0x8'));var querystring=require(_0x5464('0xd'));var Papa=require('papaparse');var Redis=require(_0x5464('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5464('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5464('0x10'));var logger=require(_0x5464('0x11'))(_0x5464('0x12'));var utils=require(_0x5464('0x13'));var config=require(_0x5464('0x14'));var licenseUtil=require(_0x5464('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x409d6f,_0x14952b){_0x14952b=_0x14952b||0xcc;return function(_0x711648){if(_0x711648){return _0x409d6f[_0x5464('0x16')](_0x14952b);}return _0x409d6f[_0x5464('0x17')](_0x14952b)[_0x5464('0x18')]();};}function respondWithResult(_0x34e7d8,_0x22cad4){_0x22cad4=_0x22cad4||0xc8;return function(_0x3d25b8){if(_0x3d25b8){return _0x34e7d8[_0x5464('0x17')](_0x22cad4)[_0x5464('0x19')](_0x3d25b8);}};}function respondWithFilteredResult(_0x341cab,_0xc7eba1){return function(_0x3aeed5){if(_0x3aeed5){var _0x2d1fa7=typeof _0xc7eba1['offset']==='undefined'&&typeof _0xc7eba1[_0x5464('0x1a')]===_0x5464('0x1b');var _0x2153ac=_0x3aeed5[_0x5464('0x1c')];var _0x6c95e3=_0x2d1fa7?0x0:_0xc7eba1[_0x5464('0x1d')];var _0xac8f5c=_0x2d1fa7?_0x3aeed5[_0x5464('0x1c')]:_0xc7eba1[_0x5464('0x1d')]+_0xc7eba1['limit'];var _0x20dd17;if(_0xac8f5c>=_0x2153ac){_0xac8f5c=_0x2153ac;_0x20dd17=0xc8;}else{_0x20dd17=0xce;}_0x341cab[_0x5464('0x17')](_0x20dd17);return _0x341cab[_0x5464('0x1e')]('Content-Range',_0x6c95e3+'-'+_0xac8f5c+'/'+_0x2153ac)['json'](_0x3aeed5);}return null;};}function patchUpdates(_0x197bbf){return function(_0x128abc){try{jsonpatch[_0x5464('0x1f')](_0x128abc,_0x197bbf,!![]);}catch(_0x1e2a1d){return BPromise[_0x5464('0x20')](_0x1e2a1d);}return _0x128abc[_0x5464('0x21')]();};}function saveUpdates(_0x3816f8,_0x82bcba){return function(_0x44a56d){if(_0x44a56d){return _0x44a56d[_0x5464('0x22')](_0x3816f8)[_0x5464('0x23')](function(_0x57bcd2){return _0x57bcd2;});}return null;};}function removeEntity(_0x114edc,_0x2fe6d4){return function(_0x14098){if(_0x14098){return _0x14098[_0x5464('0x24')]()[_0x5464('0x23')](function(){_0x114edc[_0x5464('0x17')](0xcc)[_0x5464('0x18')]();});}};}function handleEntityNotFound(_0x585f7d,_0x2be216){return function(_0x43459f){if(!_0x43459f){_0x585f7d[_0x5464('0x16')](0x194);}return _0x43459f;};}function handleError(_0x3451b9,_0x5c219f){_0x5c219f=_0x5c219f||0x1f4;return function(_0x2df173){logger[_0x5464('0x25')](_0x2df173[_0x5464('0x26')]);if(_0x2df173[_0x5464('0x27')]){delete _0x2df173['name'];}_0x3451b9['status'](_0x5c219f)[_0x5464('0x28')](_0x2df173);};}exports['index']=function(_0x4b7154,_0x4c23ae){var _0x3f73ee={},_0x2f8a28={},_0x547eb7={'count':0x0,'rows':[]};var _0x34badf=_['map'](db[_0x5464('0x29')][_0x5464('0x2a')],function(_0x37d50d){return{'name':_0x37d50d[_0x5464('0x2b')],'type':_0x37d50d['type']['key']};});_0x2f8a28[_0x5464('0x2c')]=_['map'](_0x34badf,'name');_0x2f8a28[_0x5464('0x2d')]=_['keys'](_0x4b7154['query']);_0x2f8a28[_0x5464('0x2e')]=_['intersection'](_0x2f8a28[_0x5464('0x2c')],_0x2f8a28[_0x5464('0x2d')]);_0x3f73ee['attributes']=_[_0x5464('0x2f')](_0x2f8a28[_0x5464('0x2c')],qs['fields'](_0x4b7154[_0x5464('0x2d')]['fields']));_0x3f73ee[_0x5464('0x30')]=_0x3f73ee[_0x5464('0x30')]['length']?_0x3f73ee[_0x5464('0x30')]:_0x2f8a28[_0x5464('0x2c')];if(!_0x4b7154[_0x5464('0x2d')][_0x5464('0x31')]('nolimit')){_0x3f73ee[_0x5464('0x1a')]=qs[_0x5464('0x1a')](_0x4b7154[_0x5464('0x2d')]['limit']);_0x3f73ee['offset']=qs['offset'](_0x4b7154[_0x5464('0x2d')][_0x5464('0x1d')]);}_0x3f73ee[_0x5464('0x32')]=qs[_0x5464('0x33')](_0x4b7154[_0x5464('0x2d')][_0x5464('0x33')]);_0x3f73ee[_0x5464('0x34')]=qs[_0x5464('0x2e')](_['pick'](_0x4b7154['query'],_0x2f8a28[_0x5464('0x2e')]),_0x34badf);if(_0x4b7154[_0x5464('0x2d')][_0x5464('0x35')]){_0x3f73ee[_0x5464('0x34')]=_[_0x5464('0x36')](_0x3f73ee[_0x5464('0x34')],{'$or':_[_0x5464('0x37')](_0x34badf,function(_0x6644ed){if(_0x6644ed[_0x5464('0x38')]!==_0x5464('0x39')){var _0x18ab65={};_0x18ab65[_0x6644ed['name']]={'$like':'%'+_0x4b7154[_0x5464('0x2d')]['filter']+'%'};return _0x18ab65;}})});}_0x3f73ee=_[_0x5464('0x36')]({},_0x3f73ee,_0x4b7154[_0x5464('0x3a')]);var _0x26dc7a={'where':_0x3f73ee[_0x5464('0x34')]};return db[_0x5464('0x29')][_0x5464('0x1c')](_0x26dc7a)[_0x5464('0x23')](function(_0x243d44){_0x547eb7['count']=_0x243d44;if(_0x4b7154[_0x5464('0x2d')][_0x5464('0x3b')]){_0x3f73ee[_0x5464('0x3c')]=[{'all':!![]}];}return db[_0x5464('0x29')][_0x5464('0x3d')](_0x3f73ee);})[_0x5464('0x23')](function(_0xe22241){_0x547eb7[_0x5464('0x3e')]=_0xe22241;return _0x547eb7;})[_0x5464('0x23')](respondWithFilteredResult(_0x4c23ae,_0x3f73ee))['catch'](handleError(_0x4c23ae,null));};exports[_0x5464('0x3f')]=function(_0x5e85e3,_0x17569a){var _0x2485b8={'raw':!![],'where':{'id':_0x5e85e3[_0x5464('0x40')]['id']}},_0x365353={};_0x365353[_0x5464('0x2c')]=_[_0x5464('0x41')](db[_0x5464('0x29')][_0x5464('0x2a')]);_0x365353[_0x5464('0x2d')]=_[_0x5464('0x41')](_0x5e85e3[_0x5464('0x2d')]);_0x365353[_0x5464('0x2e')]=_[_0x5464('0x2f')](_0x365353[_0x5464('0x2c')],_0x365353[_0x5464('0x2d')]);_0x2485b8[_0x5464('0x30')]=_[_0x5464('0x2f')](_0x365353['model'],qs['fields'](_0x5e85e3[_0x5464('0x2d')]['fields']));_0x2485b8['attributes']=_0x2485b8[_0x5464('0x30')]['length']?_0x2485b8['attributes']:_0x365353[_0x5464('0x2c')];if(_0x5e85e3[_0x5464('0x2d')][_0x5464('0x3b')]){_0x2485b8[_0x5464('0x3c')]=[{'all':!![]}];}_0x2485b8=_[_0x5464('0x36')]({},_0x2485b8,_0x5e85e3[_0x5464('0x3a')]);return db[_0x5464('0x29')][_0x5464('0x42')](_0x2485b8)[_0x5464('0x23')](handleEntityNotFound(_0x17569a,null))['then'](respondWithResult(_0x17569a,null))['catch'](handleError(_0x17569a,null));};exports[_0x5464('0x43')]=function(_0x274872,_0xd939ee){return db[_0x5464('0x29')][_0x5464('0x43')](_0x274872[_0x5464('0x44')],{})[_0x5464('0x23')](respondWithResult(_0xd939ee,0xc9))[_0x5464('0x45')](handleError(_0xd939ee,null));};exports[_0x5464('0x22')]=function(_0x490f55,_0x1f5e77){if(_0x490f55[_0x5464('0x44')]['id']){delete _0x490f55[_0x5464('0x44')]['id'];}return db[_0x5464('0x29')][_0x5464('0x42')]({'where':{'id':_0x490f55[_0x5464('0x40')]['id']}})[_0x5464('0x23')](handleEntityNotFound(_0x1f5e77,null))['then'](saveUpdates(_0x490f55[_0x5464('0x44')],null))[_0x5464('0x23')](respondWithResult(_0x1f5e77,null))[_0x5464('0x45')](handleError(_0x1f5e77,null));};exports[_0x5464('0x24')]=function(_0x573dd3,_0x4113aa){return db['SquareDetailsReport'][_0x5464('0x42')]({'where':{'id':_0x573dd3[_0x5464('0x40')]['id']}})['then'](handleEntityNotFound(_0x4113aa,null))[_0x5464('0x23')](removeEntity(_0x4113aa,null))[_0x5464('0x45')](handleError(_0x4113aa,null));};exports['describe']=function(_0x2dded2,_0x3002a8){return db[_0x5464('0x29')]['describe']()['then'](respondWithResult(_0x3002a8,null))[_0x5464('0x45')](handleError(_0x3002a8,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b3573bb..374a0d8 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 _0xe48b=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x4fec3a,_0x537e56){var _0x4eebe1=function(_0x6f7ddf){while(--_0x6f7ddf){_0x4fec3a['push'](_0x4fec3a['shift']());}};_0x4eebe1(++_0x537e56);}(_0xe48b,0x129));var _0xbe48=function(_0x481f46,_0x221bd5){_0x481f46=_0x481f46-0x0;var _0x3baa47=_0xe48b[_0x481f46];return _0x3baa47;};'use strict';var _=require(_0xbe48('0x0'));var util=require(_0xbe48('0x1'));var logger=require(_0xbe48('0x2'))(_0xbe48('0x3'));var moment=require(_0xbe48('0x4'));var BPromise=require(_0xbe48('0x5'));var rp=require(_0xbe48('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe48('0x7'));var config=require('../../config/environment');var attributes=require(_0xbe48('0x8'));module[_0xbe48('0x9')]=function(_0x52c230,_0x540587){return _0x52c230[_0xbe48('0xa')](_0xbe48('0xb'),attributes,{'tableName':_0xbe48('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x545c=['api','bluebird','request-promise','path','rimraf','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x2351ee,_0x2cdff5){var _0x40377d=function(_0x30226b){while(--_0x30226b){_0x2351ee['push'](_0x2351ee['shift']());}};_0x40377d(++_0x2cdff5);}(_0x545c,0x1c0));var _0xc545=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x545c[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xc545('0x0'));var util=require(_0xc545('0x1'));var logger=require('../../config/logger')(_0xc545('0x2'));var moment=require('moment');var BPromise=require(_0xc545('0x3'));var rp=require(_0xc545('0x4'));var fs=require('fs');var path=require(_0xc545('0x5'));var rimraf=require(_0xc545('0x6'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x137c74,_0x23e99f){return _0x137c74[_0xc545('0x7')](_0xc545('0x8'),attributes,{'tableName':_0xc545('0x9'),'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 f87fddf..f0e2f55 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 _0xde9f=['../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareDetailsReport','options','raw','CreateSquareDetailsReport','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x256827,_0xc5c033){var _0x41efa8=function(_0x5eb4f2){while(--_0x5eb4f2){_0x256827['push'](_0x256827['shift']());}};_0x41efa8(++_0xc5c033);}(_0xde9f,0x118));var _0xfde9=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xde9f[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0xfde9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfde9('0x1'));var rs=require(_0xfde9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfde9('0x3'))['db'];var utils=require(_0xfde9('0x4'));var logger=require('../../config/logger')(_0xfde9('0x5'));var config=require(_0xfde9('0x6'));var jayson=require(_0xfde9('0x7'));var client=jayson[_0xfde9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3e01,_0x179ee0,_0x18a202){return new BPromise(function(_0x5569c2,_0x19a337){return client[_0xfde9('0x9')](_0x4c3e01,_0x18a202)[_0xfde9('0xa')](function(_0x3b775d){logger[_0xfde9('0xb')](_0xfde9('0xc'),_0x179ee0,_0xfde9('0xd'));logger[_0xfde9('0xe')](_0xfde9('0xf'),_0x179ee0,_0xfde9('0xd'),JSON[_0xfde9('0x10')](_0x3b775d));if(_0x3b775d[_0xfde9('0x11')]){if(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x12')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x19a337(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x5569c2(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}else{logger[_0xfde9('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x179ee0,_0xfde9('0xd'));_0x5569c2(_0x3b775d[_0xfde9('0x14')][_0xfde9('0x13')]);}})['catch'](function(_0x31b1c7){logger[_0xfde9('0x11')](_0xfde9('0xc'),_0x179ee0,_0x31b1c7);_0x19a337(_0x31b1c7);});});}exports['CreateSquareDetailsReport']=function(_0x4c9f24){var _0x5eb89e=this;return new Promise(function(_0x544f19,_0x166f1c){return db[_0xfde9('0x15')]['create'](_0x4c9f24['body'],{'raw':_0x4c9f24[_0xfde9('0x16')]?_0x4c9f24[_0xfde9('0x16')][_0xfde9('0x17')]===undefined?!![]:![]:!![]})[_0xfde9('0xa')](function(_0x162b07){logger[_0xfde9('0xb')](_0xfde9('0x18'),_0x4c9f24);logger[_0xfde9('0xe')](_0xfde9('0x18'),_0x4c9f24,JSON[_0xfde9('0x10')](_0x162b07));_0x544f19(_0x162b07);})[_0xfde9('0x19')](function(_0x28d189){logger['error'](_0xfde9('0x18'),_0x28d189['message'],_0x4c9f24);_0x166f1c(_0x5eb89e[_0xfde9('0x11')](0x1f4,_0x28d189[_0xfde9('0x13')]));});});}; \ No newline at end of file +var _0x7fce=['request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fce,0xdc));var _0xe7fc=function(_0xaa9e56,_0x3f64e9){_0xaa9e56=_0xaa9e56-0x0;var _0x54b7dc=_0x7fce[_0xaa9e56];return _0x54b7dc;};'use strict';var _=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var moment=require(_0xe7fc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7fc('0x5'))(_0xe7fc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe7fc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4665f6,_0x161dca,_0x296b2e){return new BPromise(function(_0x19eeef,_0x22fabf){return client['request'](_0x4665f6,_0x296b2e)[_0xe7fc('0x8')](function(_0x4a1209){logger[_0xe7fc('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x161dca,_0xe7fc('0xa'));logger[_0xe7fc('0xb')](_0xe7fc('0xc'),_0x161dca,_0xe7fc('0xa'),JSON['stringify'](_0x4a1209));if(_0x4a1209[_0xe7fc('0xd')]){if(_0x4a1209[_0xe7fc('0xd')]['code']===0x1f4){logger['error'](_0xe7fc('0xe'),_0x161dca,_0x4a1209['error'][_0xe7fc('0xf')]);return _0x22fabf(_0x4a1209['error']['message']);}logger[_0xe7fc('0xd')](_0xe7fc('0xe'),_0x161dca,_0x4a1209[_0xe7fc('0xd')][_0xe7fc('0xf')]);return _0x19eeef(_0x4a1209[_0xe7fc('0xd')]['message']);}else{logger[_0xe7fc('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x161dca,'request\x20sent');_0x19eeef(_0x4a1209[_0xe7fc('0x10')][_0xe7fc('0xf')]);}})[_0xe7fc('0x11')](function(_0x3a44a6){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x161dca,_0x3a44a6);_0x22fabf(_0x3a44a6);});});}exports['CreateSquareDetailsReport']=function(_0x4aa4f0){var _0x52902f=this;return new Promise(function(_0x490a99,_0x14515d){return db['SquareDetailsReport'][_0xe7fc('0x12')](_0x4aa4f0[_0xe7fc('0x13')],{'raw':_0x4aa4f0[_0xe7fc('0x14')]?_0x4aa4f0[_0xe7fc('0x14')][_0xe7fc('0x15')]===undefined?!![]:![]:!![]})[_0xe7fc('0x8')](function(_0x329051){logger[_0xe7fc('0x9')]('CreateSquareDetailsReport',_0x4aa4f0);logger[_0xe7fc('0xb')](_0xe7fc('0x16'),_0x4aa4f0,JSON['stringify'](_0x329051));_0x490a99(_0x329051);})['catch'](function(_0x35bb53){logger[_0xe7fc('0xd')](_0xe7fc('0x16'),_0x35bb53[_0xe7fc('0xf')],_0x4aa4f0);_0x14515d(_0x52902f[_0xe7fc('0xd')](0x1f4,_0x35bb53[_0xe7fc('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index cfad67e..f754b8a 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 _0x19b6=['/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router','./system.controller','get'];(function(_0x2ec77a,_0x3ea593){var _0x15d430=function(_0x38721f){while(--_0x38721f){_0x2ec77a['push'](_0x2ec77a['shift']());}};_0x15d430(++_0x3ea593);}(_0x19b6,0x124));var _0x619b=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0x19b6[_0x277721];return _0x286051;};'use strict';var express=require(_0x619b('0x0'));var router=express[_0x619b('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x619b('0x2'));router[_0x619b('0x3')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x619b('0x4'),auth[_0x619b('0x5')](),controller[_0x619b('0x6')]);module[_0x619b('0x7')]=router; \ No newline at end of file +var _0x130b=['index','/process/:pid/kill','../../components/auth/service','./system.controller','get'];(function(_0x49faf0,_0x42193f){var _0x11c60a=function(_0x14d20c){while(--_0x14d20c){_0x49faf0['push'](_0x49faf0['shift']());}};_0x11c60a(++_0x42193f);}(_0x130b,0xc0));var _0xb130=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x130b[_0x3e5086];return _0xfeb102;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xb130('0x0'));var controller=require(_0xb130('0x1'));router[_0xb130('0x2')]('/',auth['isAuthenticated'](),controller[_0xb130('0x3')]);router[_0xb130('0x2')](_0xb130('0x4'),auth['isAuthenticated'](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 1fe77f7..744375c 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 _0xb0ee=['length','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json','catch','killProcess','components/import/cm','format','params','pid','split'];(function(_0x85f05d,_0x1d6297){var _0x19c315=function(_0x1e689d){while(--_0x1e689d){_0x85f05d['push'](_0x85f05d['shift']());}};_0x19c315(++_0x1d6297);}(_0xb0ee,0x12e));var _0xeb0e=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xb0ee[_0x819464];return _0x49dcc0;};'use strict';var info=require(_0xeb0e('0x0'));var exec=require(_0xeb0e('0x1'))['exec'];var logger=require(_0xeb0e('0x2'))(_0xeb0e('0x3'));var util=require(_0xeb0e('0x4'));var BPromise=require(_0xeb0e('0x5'));var _=require('lodash');function handleError(_0x31dc0e,_0x292e78,_0x102dad){_0x292e78=_0x292e78||0x1f4;return function(_0x22ca01){logger[_0xeb0e('0x6')](_0xeb0e('0x7'),_0x102dad,_0x292e78,util[_0xeb0e('0x8')](_0x22ca01,{'showHidden':![],'depth':null}));delete _0x22ca01[_0xeb0e('0x9')];_0x31dc0e[_0xeb0e('0xa')](_0x292e78)['send'](_0x22ca01);};}exports[_0xeb0e('0xb')]=function(_0x5c866c,_0x375477){return info[_0xeb0e('0xc')]()[_0xeb0e('0xd')](function(_0x18809d){return _0x375477[_0xeb0e('0xa')](0xc8)[_0xeb0e('0xe')](_0x18809d);})[_0xeb0e('0xf')](function(_0x308a02){return _0x375477[_0xeb0e('0xa')](0x1f4)[_0xeb0e('0xe')](_0x308a02);});};exports[_0xeb0e('0x10')]=function(_0x44369f,_0x33c593){var _0xebe593=[_0xeb0e('0x11')];return new BPromise(function(_0x4ee539,_0x4f4afc){return exec(util[_0xeb0e('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x44369f[_0xeb0e('0x13')][_0xeb0e('0x14')]),function(_0x3dc192,_0x1ab9c2,_0x113ae3){if(_0x3dc192){return _0x4f4afc(_0x3dc192);}return _0x4ee539(_0x1ab9c2);});})['then'](function(_0x3a2320){var _0x107f33=![];var _0x19c69a=_0x3a2320[_0xeb0e('0x15')](/\n/);for(var _0x1dcad7=0x0,_0x2543c8=_0xebe593[_0xeb0e('0x16')];_0x1dcad7<_0x2543c8,_0x107f33===![];_0x1dcad7+=0x1){if(_0x3a2320[_0xeb0e('0x17')](_0xebe593[_0x1dcad7])>=0x0){_0x107f33=!![];}}if(!_0x107f33){throw new Error(util[_0xeb0e('0x12')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x44369f['params'][_0xeb0e('0x14')]));}process[_0xeb0e('0x18')](_0x44369f[_0xeb0e('0x13')][_0xeb0e('0x14')],_0xeb0e('0x19'));return _0x33c593[_0xeb0e('0xa')](0xc8)[_0xeb0e('0xe')]({'message':util['format'](_0xeb0e('0x1a'),_0x44369f[_0xeb0e('0x13')][_0xeb0e('0x14')])});})[_0xeb0e('0xf')](handleError(_0x33c593,null,_0xeb0e('0x10')));}; \ No newline at end of file +var _0xd261=['then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','getAllData'];(function(_0x339f67,_0x3eef63){var _0x9d6b2=function(_0x260f5c){while(--_0x260f5c){_0x339f67['push'](_0x339f67['shift']());}};_0x9d6b2(++_0x3eef63);}(_0xd261,0x1e1));var _0x1d26=function(_0x2224df,_0x4b0c4a){_0x2224df=_0x2224df-0x0;var _0x5391a5=_0xd261[_0x2224df];return _0x5391a5;};'use strict';var info=require(_0x1d26('0x0'));var exec=require(_0x1d26('0x1'))['exec'];var logger=require(_0x1d26('0x2'))(_0x1d26('0x3'));var util=require(_0x1d26('0x4'));var BPromise=require(_0x1d26('0x5'));var _=require(_0x1d26('0x6'));function handleError(_0x56a297,_0xd440fb,_0x2cbe9a){_0xd440fb=_0xd440fb||0x1f4;return function(_0x4f6731){logger[_0x1d26('0x7')](_0x1d26('0x8'),_0x2cbe9a,_0xd440fb,util['inspect'](_0x4f6731,{'showHidden':![],'depth':null}));delete _0x4f6731[_0x1d26('0x9')];_0x56a297[_0x1d26('0xa')](_0xd440fb)[_0x1d26('0xb')](_0x4f6731);};}exports['index']=function(_0x489baf,_0x2fee2e){return info[_0x1d26('0xc')]()[_0x1d26('0xd')](function(_0x4f670b){return _0x2fee2e[_0x1d26('0xa')](0xc8)[_0x1d26('0xe')](_0x4f670b);})[_0x1d26('0xf')](function(_0x230887){return _0x2fee2e[_0x1d26('0xa')](0x1f4)[_0x1d26('0xe')](_0x230887);});};exports[_0x1d26('0x10')]=function(_0x1f83f6,_0x22cebe){var _0x4de0d5=[_0x1d26('0x11')];return new BPromise(function(_0x1d2623,_0xda2242){return exec(util[_0x1d26('0x12')](_0x1d26('0x13'),_0x1f83f6[_0x1d26('0x14')][_0x1d26('0x15')]),function(_0x204c5f,_0x6c5f6,_0x1d39a9){if(_0x204c5f){return _0xda2242(_0x204c5f);}return _0x1d2623(_0x6c5f6);});})[_0x1d26('0xd')](function(_0x24e018){var _0x1d0a3a=![];var _0x43a5de=_0x24e018[_0x1d26('0x16')](/\n/);for(var _0x4a857b=0x0,_0x25b916=_0x4de0d5[_0x1d26('0x17')];_0x4a857b<_0x25b916,_0x1d0a3a===![];_0x4a857b+=0x1){if(_0x24e018[_0x1d26('0x18')](_0x4de0d5[_0x4a857b])>=0x0){_0x1d0a3a=!![];}}if(!_0x1d0a3a){throw new Error(util[_0x1d26('0x12')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1f83f6[_0x1d26('0x14')][_0x1d26('0x15')]));}process['kill'](_0x1f83f6[_0x1d26('0x14')][_0x1d26('0x15')],'SIGINT');return _0x22cebe['status'](0xc8)['json']({'message':util['format'](_0x1d26('0x19'),_0x1f83f6['params']['pid'])});})['catch'](handleError(_0x22cebe,null,_0x1d26('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f461227..074c4e4 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 _0x098b=['update','delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','post','create'];(function(_0x103466,_0x190bb5){var _0x416ba8=function(_0x4854c9){while(--_0x4854c9){_0x103466['push'](_0x103466['shift']());}};_0x416ba8(++_0x190bb5);}(_0x098b,0x6c));var _0xb098=function(_0x40bb04,_0x19f17f){_0x40bb04=_0x40bb04-0x0;var _0xa7bd12=_0x098b[_0x40bb04];return _0xa7bd12;};'use strict';var multer=require(_0xb098('0x0'));var util=require(_0xb098('0x1'));var path=require('path');var timeout=require(_0xb098('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb098('0x3'));var interaction=require(_0xb098('0x4'));var config=require(_0xb098('0x5'));var controller=require(_0xb098('0x6'));router[_0xb098('0x7')]('/',auth[_0xb098('0x8')](),controller['index']);router[_0xb098('0x7')](_0xb098('0x9'),auth[_0xb098('0x8')](),controller['show']);router[_0xb098('0xa')]('/',auth['isAuthenticated'](),controller[_0xb098('0xb')]);router['put']('/:id',auth[_0xb098('0x8')](),controller[_0xb098('0xc')]);router[_0xb098('0xd')](_0xb098('0x9'),auth[_0xb098('0x8')](),controller[_0xb098('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc8bd=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','/:id','isAuthenticated'];(function(_0x36d944,_0x200b2e){var _0x165882=function(_0x4806d6){while(--_0x4806d6){_0x36d944['push'](_0x36d944['shift']());}};_0x165882(++_0x200b2e);}(_0xc8bd,0xf6));var _0xdc8b=function(_0x33fc57,_0xdd2591){_0x33fc57=_0x33fc57-0x0;var _0xf701ca=_0xc8bd[_0x33fc57];return _0xf701ca;};'use strict';var multer=require(_0xdc8b('0x0'));var util=require(_0xdc8b('0x1'));var path=require(_0xdc8b('0x2'));var timeout=require(_0xdc8b('0x3'));var express=require(_0xdc8b('0x4'));var router=express[_0xdc8b('0x5')]();var fs_extra=require(_0xdc8b('0x6'));var auth=require(_0xdc8b('0x7'));var interaction=require(_0xdc8b('0x8'));var config=require(_0xdc8b('0x9'));var controller=require(_0xdc8b('0xa'));router[_0xdc8b('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdc8b('0xb')](_0xdc8b('0xc'),auth[_0xdc8b('0xd')](),controller[_0xdc8b('0xe')]);router[_0xdc8b('0xf')]('/',auth[_0xdc8b('0xd')](),controller[_0xdc8b('0x10')]);router[_0xdc8b('0x11')](_0xdc8b('0xc'),auth['isAuthenticated'](),controller[_0xdc8b('0x12')]);router['delete'](_0xdc8b('0xc'),auth[_0xdc8b('0xd')](),controller['destroy']);module[_0xdc8b('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 7741347..c174a76 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 _0x263f=['#0091EA','sequelize','exports','STRING','name'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x263f,0x182));var _0xf263=function(_0x2e1767,_0x2d43e7){_0x2e1767=_0x2e1767-0x0;var _0x1697f6=_0x263f[_0x2e1767];return _0x1697f6;};'use strict';var Sequelize=require(_0xf263('0x0'));module[_0xf263('0x1')]={'name':{'type':Sequelize[_0xf263('0x2')],'unique':_0xf263('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf263('0x2')],'defaultValue':_0xf263('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0565=['name','#0091EA','sequelize','exports','STRING'];(function(_0x29d87d,_0x23dc31){var _0x1fd84b=function(_0x4e2aa1){while(--_0x4e2aa1){_0x29d87d['push'](_0x29d87d['shift']());}};_0x1fd84b(++_0x23dc31);}(_0x0565,0xf2));var _0x5056=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x0565[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'name':{'type':Sequelize[_0x5056('0x2')],'unique':_0x5056('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x5056('0x2')],'defaultValue':_0x5056('0x4')},'description':{'type':Sequelize[_0x5056('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index f8787ec..fd83156 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 _0x76dc=['where','pick','filter','merge','map','type','VIRTUAL','options','findAll','rows','catch','show','params','intersection','includeAll','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','name','send','Tag','fieldName','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x50e30b,_0x216368){var _0x4b7300=function(_0x8f06d7){while(--_0x8f06d7){_0x50e30b['push'](_0x50e30b['shift']());}};_0x4b7300(++_0x216368);}(_0x76dc,0x1f2));var _0xc76d=function(_0x8844e1,_0x3220d3){_0x8844e1=_0x8844e1-0x0;var _0x84782f=_0x76dc[_0x8844e1];return _0x84782f;};'use strict';var emlformat=require(_0xc76d('0x0'));var rimraf=require(_0xc76d('0x1'));var zipdir=require(_0xc76d('0x2'));var jsonpatch=require(_0xc76d('0x3'));var rp=require('request-promise');var moment=require(_0xc76d('0x4'));var BPromise=require(_0xc76d('0x5'));var Mustache=require('mustache');var util=require(_0xc76d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc76d('0x7'));var ejs=require(_0xc76d('0x8'));var fs=require('fs');var fs_extra=require(_0xc76d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc76d('0xa'));var jsforce=require(_0xc76d('0xb'));var deskjs=require(_0xc76d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc76d('0xd'));var Redis=require(_0xc76d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc76d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76d('0x10'));var logger=require(_0xc76d('0x11'))(_0xc76d('0x12'));var utils=require(_0xc76d('0x13'));var config=require(_0xc76d('0x14'));var licenseUtil=require(_0xc76d('0x15'));var db=require(_0xc76d('0x16'))['db'];function respondWithStatusCode(_0x2e02e9,_0x1722b3){_0x1722b3=_0x1722b3||0xcc;return function(_0x311814){if(_0x311814){return _0x2e02e9[_0xc76d('0x17')](_0x1722b3);}return _0x2e02e9[_0xc76d('0x18')](_0x1722b3)[_0xc76d('0x19')]();};}function respondWithResult(_0x3ed1bd,_0x5cda20){_0x5cda20=_0x5cda20||0xc8;return function(_0x8696db){if(_0x8696db){return _0x3ed1bd[_0xc76d('0x18')](_0x5cda20)['json'](_0x8696db);}};}function respondWithFilteredResult(_0x4741a4,_0x2d23d2){return function(_0x47a4ee){if(_0x47a4ee){var _0x6f94e=typeof _0x2d23d2['offset']===_0xc76d('0x1a')&&typeof _0x2d23d2['limit']==='undefined';var _0x45a83e=_0x47a4ee[_0xc76d('0x1b')];var _0x339623=_0x6f94e?0x0:_0x2d23d2[_0xc76d('0x1c')];var _0xd1d16f=_0x6f94e?_0x47a4ee['count']:_0x2d23d2[_0xc76d('0x1c')]+_0x2d23d2[_0xc76d('0x1d')];var _0xa0c5b6;if(_0xd1d16f>=_0x45a83e){_0xd1d16f=_0x45a83e;_0xa0c5b6=0xc8;}else{_0xa0c5b6=0xce;}_0x4741a4[_0xc76d('0x18')](_0xa0c5b6);return _0x4741a4[_0xc76d('0x1e')]('Content-Range',_0x339623+'-'+_0xd1d16f+'/'+_0x45a83e)[_0xc76d('0x1f')](_0x47a4ee);}return null;};}function patchUpdates(_0x324db7){return function(_0x5dffde){try{jsonpatch[_0xc76d('0x20')](_0x5dffde,_0x324db7,!![]);}catch(_0x777f22){return BPromise[_0xc76d('0x21')](_0x777f22);}return _0x5dffde[_0xc76d('0x22')]();};}function saveUpdates(_0x18f546,_0x3d357b){return function(_0x42b89c){if(_0x42b89c){return _0x42b89c[_0xc76d('0x23')](_0x18f546)[_0xc76d('0x24')](function(_0x20e09c){return _0x20e09c;});}return null;};}function removeEntity(_0x15328d,_0x5de11f){return function(_0x11b42f){if(_0x11b42f){return _0x11b42f[_0xc76d('0x25')]()['then'](function(){var _0x637d68=_0x11b42f[_0xc76d('0x26')]({'plain':!![]});var _0x55ca79=_0xc76d('0x27');return db[_0xc76d('0x28')][_0xc76d('0x25')]({'where':{'type':_0x55ca79,'resourceId':_0x637d68['id']}})[_0xc76d('0x24')](function(){return _0x11b42f;});})[_0xc76d('0x24')](function(){_0x15328d[_0xc76d('0x18')](0xcc)[_0xc76d('0x19')]();});}};}function handleEntityNotFound(_0x59ebd1,_0x59dabf){return function(_0x285430){if(!_0x285430){_0x59ebd1[_0xc76d('0x17')](0x194);}return _0x285430;};}function handleError(_0x5069ea,_0x31501a){_0x31501a=_0x31501a||0x1f4;return function(_0x52a79a){logger[_0xc76d('0x29')](_0x52a79a['stack']);if(_0x52a79a[_0xc76d('0x2a')]){delete _0x52a79a['name'];}_0x5069ea[_0xc76d('0x18')](_0x31501a)[_0xc76d('0x2b')](_0x52a79a);};}exports['index']=function(_0x3d4076,_0x1c68f3){var _0x9ab96c={},_0x2cf501={},_0x4feeda={'count':0x0,'rows':[]};var _0x283e16=_['map'](db[_0xc76d('0x2c')]['rawAttributes'],function(_0x30769f){return{'name':_0x30769f[_0xc76d('0x2d')],'type':_0x30769f['type']['key']};});_0x2cf501['model']=_['map'](_0x283e16,_0xc76d('0x2a'));_0x2cf501[_0xc76d('0x2e')]=_[_0xc76d('0x2f')](_0x3d4076[_0xc76d('0x2e')]);_0x2cf501[_0xc76d('0x30')]=_['intersection'](_0x2cf501[_0xc76d('0x31')],_0x2cf501['query']);_0x9ab96c[_0xc76d('0x32')]=_['intersection'](_0x2cf501[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x33')]));_0x9ab96c[_0xc76d('0x32')]=_0x9ab96c['attributes'][_0xc76d('0x34')]?_0x9ab96c[_0xc76d('0x32')]:_0x2cf501[_0xc76d('0x31')];if(!_0x3d4076['query'][_0xc76d('0x35')](_0xc76d('0x36'))){_0x9ab96c[_0xc76d('0x1d')]=qs['limit'](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x1d')]);_0x9ab96c[_0xc76d('0x1c')]=qs[_0xc76d('0x1c')](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x1c')]);}_0x9ab96c['order']=qs['sort'](_0x3d4076[_0xc76d('0x2e')]['sort']);_0x9ab96c[_0xc76d('0x37')]=qs[_0xc76d('0x30')](_[_0xc76d('0x38')](_0x3d4076[_0xc76d('0x2e')],_0x2cf501['filters']),_0x283e16);if(_0x3d4076['query'][_0xc76d('0x39')]){_0x9ab96c[_0xc76d('0x37')]=_[_0xc76d('0x3a')](_0x9ab96c[_0xc76d('0x37')],{'$or':_[_0xc76d('0x3b')](_0x283e16,function(_0x58c724){if(_0x58c724[_0xc76d('0x3c')]!==_0xc76d('0x3d')){var _0x321989={};_0x321989[_0x58c724[_0xc76d('0x2a')]]={'$like':'%'+_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x39')]+'%'};return _0x321989;}})});}_0x9ab96c=_[_0xc76d('0x3a')]({},_0x9ab96c,_0x3d4076[_0xc76d('0x3e')]);var _0x305f7d={'where':_0x9ab96c[_0xc76d('0x37')]};return db['Tag']['count'](_0x305f7d)[_0xc76d('0x24')](function(_0x2a0759){_0x4feeda[_0xc76d('0x1b')]=_0x2a0759;if(_0x3d4076[_0xc76d('0x2e')]['includeAll']){_0x9ab96c['include']=[{'all':!![]}];}return db[_0xc76d('0x2c')][_0xc76d('0x3f')](_0x9ab96c);})[_0xc76d('0x24')](function(_0x15eb42){_0x4feeda[_0xc76d('0x40')]=_0x15eb42;return _0x4feeda;})[_0xc76d('0x24')](respondWithFilteredResult(_0x1c68f3,_0x9ab96c))[_0xc76d('0x41')](handleError(_0x1c68f3,null));};exports[_0xc76d('0x42')]=function(_0x50e922,_0x7bf0){var _0x95193f={'raw':!![],'where':{'id':_0x50e922[_0xc76d('0x43')]['id']}},_0x1bf8a0={};_0x1bf8a0['model']=_['keys'](db['Tag']['rawAttributes']);_0x1bf8a0['query']=_['keys'](_0x50e922['query']);_0x1bf8a0[_0xc76d('0x30')]=_[_0xc76d('0x44')](_0x1bf8a0[_0xc76d('0x31')],_0x1bf8a0[_0xc76d('0x2e')]);_0x95193f[_0xc76d('0x32')]=_[_0xc76d('0x44')](_0x1bf8a0[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x50e922['query'][_0xc76d('0x33')]));_0x95193f[_0xc76d('0x32')]=_0x95193f[_0xc76d('0x32')][_0xc76d('0x34')]?_0x95193f[_0xc76d('0x32')]:_0x1bf8a0[_0xc76d('0x31')];if(_0x50e922[_0xc76d('0x2e')][_0xc76d('0x45')]){_0x95193f[_0xc76d('0x46')]=[{'all':!![]}];}_0x95193f=_['merge']({},_0x95193f,_0x50e922['options']);return db[_0xc76d('0x2c')][_0xc76d('0x47')](_0x95193f)[_0xc76d('0x24')](handleEntityNotFound(_0x7bf0,null))[_0xc76d('0x24')](respondWithResult(_0x7bf0,null))[_0xc76d('0x41')](handleError(_0x7bf0,null));};exports['create']=function(_0x25fc9d,_0x1ede13){return db['Tag']['create'](_0x25fc9d[_0xc76d('0x48')],{})[_0xc76d('0x24')](function(_0x48cad0){var _0xe44a25=_0x25fc9d[_0xc76d('0x49')][_0xc76d('0x26')]({'plain':!![]});if(!_0xe44a25)throw new Error(_0xc76d('0x4a'));if(_0xe44a25[_0xc76d('0x4b')]===_0xc76d('0x49')){var _0x25a549=_0x48cad0[_0xc76d('0x26')]({'plain':!![]});var _0x4452a8=_0xc76d('0x27');return db['UserProfileSection'][_0xc76d('0x47')]({'where':{'name':_0x4452a8,'userProfileId':_0xe44a25[_0xc76d('0x4c')]},'raw':!![]})[_0xc76d('0x24')](function(_0x55e3af){if(_0x55e3af&&_0x55e3af[_0xc76d('0x4d')]===0x0){return db[_0xc76d('0x28')]['create']({'name':_0x25a549[_0xc76d('0x2a')],'resourceId':_0x25a549['id'],'type':_0x55e3af['name'],'sectionId':_0x55e3af['id']},{})[_0xc76d('0x24')](function(){return _0x48cad0;});}else{return _0x48cad0;}})[_0xc76d('0x41')](function(_0x316978){logger[_0xc76d('0x29')](_0xc76d('0x4e'),_0x316978);throw _0x316978;});}return _0x48cad0;})['then'](respondWithResult(_0x1ede13,0xc9))['catch'](handleError(_0x1ede13,null));};exports['update']=function(_0x320483,_0x746759){if(_0x320483[_0xc76d('0x48')]['id']){delete _0x320483[_0xc76d('0x48')]['id'];}return db[_0xc76d('0x2c')][_0xc76d('0x47')]({'where':{'id':_0x320483['params']['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x746759,null))[_0xc76d('0x24')](saveUpdates(_0x320483[_0xc76d('0x48')],null))[_0xc76d('0x24')](respondWithResult(_0x746759,null))[_0xc76d('0x41')](handleError(_0x746759,null));};exports['destroy']=function(_0x275dfd,_0x463cbe){return db[_0xc76d('0x2c')][_0xc76d('0x47')]({'where':{'id':_0x275dfd[_0xc76d('0x43')]['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x463cbe,null))['then'](removeEntity(_0x463cbe,null))[_0xc76d('0x41')](handleError(_0x463cbe,null));}; \ No newline at end of file +var _0x593e=['UserProfileResource','error','name','send','index','map','Tag','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','Tags'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0x593e,0xcb));var _0xe593=function(_0x4a37bc,_0x3ffa26){_0x4a37bc=_0x4a37bc-0x0;var _0x1d3f5a=_0x593e[_0x4a37bc];return _0x1d3f5a;};'use strict';var emlformat=require(_0xe593('0x0'));var rimraf=require(_0xe593('0x1'));var zipdir=require(_0xe593('0x2'));var jsonpatch=require(_0xe593('0x3'));var rp=require(_0xe593('0x4'));var moment=require(_0xe593('0x5'));var BPromise=require(_0xe593('0x6'));var Mustache=require(_0xe593('0x7'));var util=require('util');var path=require(_0xe593('0x8'));var sox=require(_0xe593('0x9'));var csv=require(_0xe593('0xa'));var ejs=require(_0xe593('0xb'));var fs=require('fs');var fs_extra=require(_0xe593('0xc'));var _=require(_0xe593('0xd'));var squel=require(_0xe593('0xe'));var crypto=require(_0xe593('0xf'));var jsforce=require(_0xe593('0x10'));var deskjs=require(_0xe593('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe593('0x12'));var Papa=require(_0xe593('0x13'));var Redis=require(_0xe593('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe593('0x15'));var hardwareService=require(_0xe593('0x16'));var logger=require(_0xe593('0x17'))('api');var utils=require(_0xe593('0x18'));var config=require(_0xe593('0x19'));var licenseUtil=require(_0xe593('0x1a'));var db=require(_0xe593('0x1b'))['db'];function respondWithStatusCode(_0x8ee313,_0x31dad0){_0x31dad0=_0x31dad0||0xcc;return function(_0x24c9fd){if(_0x24c9fd){return _0x8ee313[_0xe593('0x1c')](_0x31dad0);}return _0x8ee313[_0xe593('0x1d')](_0x31dad0)[_0xe593('0x1e')]();};}function respondWithResult(_0x499819,_0x2907e4){_0x2907e4=_0x2907e4||0xc8;return function(_0x1de391){if(_0x1de391){return _0x499819['status'](_0x2907e4)[_0xe593('0x1f')](_0x1de391);}};}function respondWithFilteredResult(_0x44837b,_0x5d4c6a){return function(_0x2ae9b6){if(_0x2ae9b6){var _0x40416c=typeof _0x5d4c6a[_0xe593('0x20')]===_0xe593('0x21')&&typeof _0x5d4c6a[_0xe593('0x22')]===_0xe593('0x21');var _0x48f3b4=_0x2ae9b6[_0xe593('0x23')];var _0x470d07=_0x40416c?0x0:_0x5d4c6a['offset'];var _0xd1020e=_0x40416c?_0x2ae9b6[_0xe593('0x23')]:_0x5d4c6a['offset']+_0x5d4c6a[_0xe593('0x22')];var _0x3dba1b;if(_0xd1020e>=_0x48f3b4){_0xd1020e=_0x48f3b4;_0x3dba1b=0xc8;}else{_0x3dba1b=0xce;}_0x44837b[_0xe593('0x1d')](_0x3dba1b);return _0x44837b[_0xe593('0x24')](_0xe593('0x25'),_0x470d07+'-'+_0xd1020e+'/'+_0x48f3b4)[_0xe593('0x1f')](_0x2ae9b6);}return null;};}function patchUpdates(_0x3d2a51){return function(_0x4ea53f){try{jsonpatch['apply'](_0x4ea53f,_0x3d2a51,!![]);}catch(_0x1634d4){return BPromise['reject'](_0x1634d4);}return _0x4ea53f['save']();};}function saveUpdates(_0x1bb8e8,_0x3c65b5){return function(_0x57379d){if(_0x57379d){return _0x57379d[_0xe593('0x26')](_0x1bb8e8)['then'](function(_0x1672bf){return _0x1672bf;});}return null;};}function removeEntity(_0x2c191f,_0x185cea){return function(_0x44d997){if(_0x44d997){return _0x44d997[_0xe593('0x27')]()[_0xe593('0x28')](function(){var _0x20a098=_0x44d997[_0xe593('0x29')]({'plain':!![]});var _0x4fc483=_0xe593('0x2a');return db[_0xe593('0x2b')]['destroy']({'where':{'type':_0x4fc483,'resourceId':_0x20a098['id']}})['then'](function(){return _0x44d997;});})[_0xe593('0x28')](function(){_0x2c191f[_0xe593('0x1d')](0xcc)[_0xe593('0x1e')]();});}};}function handleEntityNotFound(_0x43699d,_0x3b66bc){return function(_0x27a3d2){if(!_0x27a3d2){_0x43699d['sendStatus'](0x194);}return _0x27a3d2;};}function handleError(_0x350e2b,_0x54e5e2){_0x54e5e2=_0x54e5e2||0x1f4;return function(_0x1dacf6){logger[_0xe593('0x2c')](_0x1dacf6['stack']);if(_0x1dacf6[_0xe593('0x2d')]){delete _0x1dacf6['name'];}_0x350e2b[_0xe593('0x1d')](_0x54e5e2)[_0xe593('0x2e')](_0x1dacf6);};}exports[_0xe593('0x2f')]=function(_0x501e54,_0x1ae8d9){var _0x13f44={},_0x3066ed={},_0x338222={'count':0x0,'rows':[]};var _0x2588be=_[_0xe593('0x30')](db[_0xe593('0x31')]['rawAttributes'],function(_0x4098a9){return{'name':_0x4098a9[_0xe593('0x32')],'type':_0x4098a9['type'][_0xe593('0x33')]};});_0x3066ed['model']=_[_0xe593('0x30')](_0x2588be,_0xe593('0x2d'));_0x3066ed[_0xe593('0x34')]=_[_0xe593('0x35')](_0x501e54[_0xe593('0x34')]);_0x3066ed[_0xe593('0x36')]=_[_0xe593('0x37')](_0x3066ed[_0xe593('0x38')],_0x3066ed[_0xe593('0x34')]);_0x13f44[_0xe593('0x39')]=_['intersection'](_0x3066ed[_0xe593('0x38')],qs[_0xe593('0x3a')](_0x501e54[_0xe593('0x34')]['fields']));_0x13f44['attributes']=_0x13f44[_0xe593('0x39')]['length']?_0x13f44[_0xe593('0x39')]:_0x3066ed[_0xe593('0x38')];if(!_0x501e54[_0xe593('0x34')][_0xe593('0x3b')](_0xe593('0x3c'))){_0x13f44[_0xe593('0x22')]=qs[_0xe593('0x22')](_0x501e54['query']['limit']);_0x13f44[_0xe593('0x20')]=qs['offset'](_0x501e54[_0xe593('0x34')]['offset']);}_0x13f44[_0xe593('0x3d')]=qs['sort'](_0x501e54['query'][_0xe593('0x3e')]);_0x13f44[_0xe593('0x3f')]=qs[_0xe593('0x36')](_['pick'](_0x501e54['query'],_0x3066ed['filters']),_0x2588be);if(_0x501e54[_0xe593('0x34')]['filter']){_0x13f44[_0xe593('0x3f')]=_[_0xe593('0x40')](_0x13f44[_0xe593('0x3f')],{'$or':_[_0xe593('0x30')](_0x2588be,function(_0x50249e){if(_0x50249e[_0xe593('0x41')]!=='VIRTUAL'){var _0x36c08e={};_0x36c08e[_0x50249e['name']]={'$like':'%'+_0x501e54['query']['filter']+'%'};return _0x36c08e;}})});}_0x13f44=_[_0xe593('0x40')]({},_0x13f44,_0x501e54['options']);var _0x3addf0={'where':_0x13f44[_0xe593('0x3f')]};return db[_0xe593('0x31')]['count'](_0x3addf0)[_0xe593('0x28')](function(_0x3f9784){_0x338222[_0xe593('0x23')]=_0x3f9784;if(_0x501e54[_0xe593('0x34')][_0xe593('0x42')]){_0x13f44[_0xe593('0x43')]=[{'all':!![]}];}return db[_0xe593('0x31')][_0xe593('0x44')](_0x13f44);})['then'](function(_0x211065){_0x338222[_0xe593('0x45')]=_0x211065;return _0x338222;})[_0xe593('0x28')](respondWithFilteredResult(_0x1ae8d9,_0x13f44))[_0xe593('0x46')](handleError(_0x1ae8d9,null));};exports[_0xe593('0x47')]=function(_0x4d3018,_0x4a9a5f){var _0x3fd874={'raw':!![],'where':{'id':_0x4d3018[_0xe593('0x48')]['id']}},_0x380429={};_0x380429['model']=_[_0xe593('0x35')](db[_0xe593('0x31')]['rawAttributes']);_0x380429['query']=_[_0xe593('0x35')](_0x4d3018[_0xe593('0x34')]);_0x380429[_0xe593('0x36')]=_['intersection'](_0x380429[_0xe593('0x38')],_0x380429[_0xe593('0x34')]);_0x3fd874[_0xe593('0x39')]=_[_0xe593('0x37')](_0x380429['model'],qs['fields'](_0x4d3018['query']['fields']));_0x3fd874[_0xe593('0x39')]=_0x3fd874['attributes'][_0xe593('0x49')]?_0x3fd874[_0xe593('0x39')]:_0x380429[_0xe593('0x38')];if(_0x4d3018[_0xe593('0x34')][_0xe593('0x42')]){_0x3fd874[_0xe593('0x43')]=[{'all':!![]}];}_0x3fd874=_[_0xe593('0x40')]({},_0x3fd874,_0x4d3018[_0xe593('0x4a')]);return db['Tag'][_0xe593('0x4b')](_0x3fd874)[_0xe593('0x28')](handleEntityNotFound(_0x4a9a5f,null))[_0xe593('0x28')](respondWithResult(_0x4a9a5f,null))['catch'](handleError(_0x4a9a5f,null));};exports[_0xe593('0x4c')]=function(_0x5dfdb1,_0x39ec9e){return db[_0xe593('0x31')][_0xe593('0x4c')](_0x5dfdb1['body'],{})['then'](function(_0x7431a3){var _0x45beb1=_0x5dfdb1['user']['get']({'plain':!![]});if(!_0x45beb1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45beb1['role']==='user'){var _0x383645=_0x7431a3[_0xe593('0x29')]({'plain':!![]});var _0x1ed8b5=_0xe593('0x2a');return db[_0xe593('0x4d')][_0xe593('0x4b')]({'where':{'name':_0x1ed8b5,'userProfileId':_0x45beb1[_0xe593('0x4e')]},'raw':!![]})[_0xe593('0x28')](function(_0x355ad8){if(_0x355ad8&&_0x355ad8[_0xe593('0x4f')]===0x0){return db[_0xe593('0x2b')][_0xe593('0x4c')]({'name':_0x383645[_0xe593('0x2d')],'resourceId':_0x383645['id'],'type':_0x355ad8[_0xe593('0x2d')],'sectionId':_0x355ad8['id']},{})[_0xe593('0x28')](function(){return _0x7431a3;});}else{return _0x7431a3;}})[_0xe593('0x46')](function(_0x5d60c3){logger[_0xe593('0x2c')](_0xe593('0x50'),_0x5d60c3);throw _0x5d60c3;});}return _0x7431a3;})[_0xe593('0x28')](respondWithResult(_0x39ec9e,0xc9))[_0xe593('0x46')](handleError(_0x39ec9e,null));};exports[_0xe593('0x26')]=function(_0x8130b2,_0x363643){if(_0x8130b2[_0xe593('0x51')]['id']){delete _0x8130b2[_0xe593('0x51')]['id'];}return db[_0xe593('0x31')][_0xe593('0x4b')]({'where':{'id':_0x8130b2[_0xe593('0x48')]['id']}})[_0xe593('0x28')](handleEntityNotFound(_0x363643,null))[_0xe593('0x28')](saveUpdates(_0x8130b2[_0xe593('0x51')],null))['then'](respondWithResult(_0x363643,null))[_0xe593('0x46')](handleError(_0x363643,null));};exports[_0xe593('0x27')]=function(_0x142d0f,_0x24d061){return db[_0xe593('0x31')]['find']({'where':{'id':_0x142d0f['params']['id']}})[_0xe593('0x28')](handleEntityNotFound(_0x24d061,null))[_0xe593('0x28')](removeEntity(_0x24d061,null))[_0xe593('0x46')](handleError(_0x24d061,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index a5f9419..8ead0ba 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 _0x91b0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','lodash','util','../../config/logger','api'];(function(_0x21cb07,_0x1deaac){var _0x18129b=function(_0x21e778){while(--_0x21e778){_0x21cb07['push'](_0x21cb07['shift']());}};_0x18129b(++_0x1deaac);}(_0x91b0,0x1ca));var _0x091b=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x91b0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x091b('0x0'));var util=require(_0x091b('0x1'));var logger=require(_0x091b('0x2'))(_0x091b('0x3'));var moment=require(_0x091b('0x4'));var BPromise=require(_0x091b('0x5'));var rp=require(_0x091b('0x6'));var fs=require('fs');var path=require(_0x091b('0x7'));var rimraf=require(_0x091b('0x8'));var config=require(_0x091b('0x9'));var attributes=require(_0x091b('0xa'));module['exports']=function(_0x4b7c11,_0x58e92f){return _0x4b7c11['define']('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf65e=['api','bluebird','request-promise','path','./tag.attributes','define','Tag','lodash','../../config/logger'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0xf65e,0xfa));var _0xef65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf65e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xef65('0x0'));var util=require('util');var logger=require(_0xef65('0x1'))(_0xef65('0x2'));var moment=require('moment');var BPromise=require(_0xef65('0x3'));var rp=require(_0xef65('0x4'));var fs=require('fs');var path=require(_0xef65('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef65('0x6'));module['exports']=function(_0x5b9d31,_0x33a59a){return _0x5b9d31[_0xef65('0x7')](_0xef65('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index ee0ccc3..41323a4 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 _0x8ce3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird'];(function(_0x283249,_0x1fcf24){var _0xe0c64e=function(_0xd990b9){while(--_0xd990b9){_0x283249['push'](_0x283249['shift']());}};_0xe0c64e(++_0x1fcf24);}(_0x8ce3,0xc3));var _0x38ce=function(_0x51b52e,_0x3c2506){_0x51b52e=_0x51b52e-0x0;var _0x59a011=_0x8ce3[_0x51b52e];return _0x59a011;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var moment=require('moment');var BPromise=require(_0x38ce('0x2'));var rs=require(_0x38ce('0x3'));var fs=require('fs');var Redis=require(_0x38ce('0x4'));var db=require(_0x38ce('0x5'))['db'];var utils=require(_0x38ce('0x6'));var logger=require(_0x38ce('0x7'))(_0x38ce('0x8'));var config=require(_0x38ce('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38ce('0xa')][_0x38ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58074c,_0x262b13,_0xbe7332){return new BPromise(function(_0x3f8011,_0x482955){return client[_0x38ce('0xc')](_0x58074c,_0xbe7332)['then'](function(_0x725d27){logger['info'](_0x38ce('0xd'),_0x262b13,_0x38ce('0xe'));logger[_0x38ce('0xf')](_0x38ce('0x10'),_0x262b13,_0x38ce('0xe'),JSON[_0x38ce('0x11')](_0x725d27));if(_0x725d27[_0x38ce('0x12')]){if(_0x725d27[_0x38ce('0x12')][_0x38ce('0x13')]===0x1f4){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);return _0x482955(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}logger[_0x38ce('0x12')]('Tag,\x20%s,\x20%s',_0x262b13,_0x725d27['error'][_0x38ce('0x14')]);return _0x3f8011(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}else{logger['info'](_0x38ce('0xd'),_0x262b13,'request\x20sent');_0x3f8011(_0x725d27[_0x38ce('0x15')][_0x38ce('0x14')]);}})['catch'](function(_0x5fc115){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x5fc115);_0x482955(_0x5fc115);});});} \ No newline at end of file +var _0x4fef=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x427885,_0x3c3bc0){var _0xa8b21e=function(_0x1e3f85){while(--_0x1e3f85){_0x427885['push'](_0x427885['shift']());}};_0xa8b21e(++_0x3c3bc0);}(_0x4fef,0x10f));var _0xf4fe=function(_0x345900,_0x5e9513){_0x345900=_0x345900-0x0;var _0x52e241=_0x4fef[_0x345900];return _0x52e241;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var moment=require('moment');var BPromise=require(_0xf4fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4fe('0x3'));var db=require(_0xf4fe('0x4'))['db'];var utils=require(_0xf4fe('0x5'));var logger=require(_0xf4fe('0x6'))(_0xf4fe('0x7'));var config=require(_0xf4fe('0x8'));var jayson=require(_0xf4fe('0x9'));var client=jayson[_0xf4fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363096,_0x3e844d,_0x4805b0){return new BPromise(function(_0x23b761,_0x1e858f){return client[_0xf4fe('0xb')](_0x363096,_0x4805b0)[_0xf4fe('0xc')](function(_0xdec534){logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,_0xf4fe('0xf'));logger['debug'](_0xf4fe('0x10'),_0x3e844d,'request\x20sent',JSON[_0xf4fe('0x11')](_0xdec534));if(_0xdec534[_0xf4fe('0x12')]){if(_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x13')]===0x1f4){logger[_0xf4fe('0x12')]('Tag,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x1e858f(_0xdec534[_0xf4fe('0x12')]['message']);}logger[_0xf4fe('0x12')]('Tag,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x23b761(_0xdec534[_0xf4fe('0x12')]['message']);}else{logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,'request\x20sent');_0x23b761(_0xdec534[_0xf4fe('0x15')][_0xf4fe('0x14')]);}})[_0xf4fe('0x16')](function(_0x565dc6){logger['error'](_0xf4fe('0xe'),_0x3e844d,_0x565dc6);_0x1e858f(_0x565dc6);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 536df99..e6eaba8 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(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 25e8101..711db18 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x35bea2,_0x54beb7){var _0x1ef1c9=function(_0x327e2b){while(--_0x327e2b){_0x35bea2['push'](_0x35bea2['shift']());}};_0x1ef1c9(++_0x54beb7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x262ce,_0x3f53ca){var _0x5d9c5f=function(_0x52fef1){while(--_0x52fef1){_0x262ce['push'](_0x262ce['shift']());}};_0x5d9c5f(++_0x3f53ca);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index fbb894c..8ff4684 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 _0x3f23=['emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Team','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','rows','show','params','find','catch','create','body','get','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','findOne','channel','capitalize','toLowerCase','Queue','rawAttributes','length','pick','Queues','addQueues','isValidChannel','ValidationError','Unknown\x20channel','add','removeQueues','remove','addAgents','isArray','ids','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','spread','removeAgents'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x3f23,0x13e));var _0x33f2=function(_0x39fdbf,_0x3c7761){_0x39fdbf=_0x39fdbf-0x0;var _0x4a35d8=_0x3f23[_0x39fdbf];return _0x4a35d8;};'use strict';var emlformat=require(_0x33f2('0x0'));var rimraf=require(_0x33f2('0x1'));var zipdir=require(_0x33f2('0x2'));var jsonpatch=require(_0x33f2('0x3'));var rp=require(_0x33f2('0x4'));var moment=require(_0x33f2('0x5'));var BPromise=require(_0x33f2('0x6'));var Mustache=require('mustache');var util=require(_0x33f2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x33f2('0x8'));var ejs=require(_0x33f2('0x9'));var fs=require('fs');var fs_extra=require(_0x33f2('0xa'));var _=require(_0x33f2('0xb'));var squel=require(_0x33f2('0xc'));var crypto=require(_0x33f2('0xd'));var jsforce=require(_0x33f2('0xe'));var deskjs=require(_0x33f2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x33f2('0x10'));var Papa=require(_0x33f2('0x11'));var Redis=require(_0x33f2('0x12'));var authService=require(_0x33f2('0x13'));var qs=require(_0x33f2('0x14'));var as=require(_0x33f2('0x15'));var hardwareService=require(_0x33f2('0x16'));var logger=require(_0x33f2('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x33f2('0x18'));var licenseUtil=require(_0x33f2('0x19'));var db=require(_0x33f2('0x1a'))['db'];config['redis']=_[_0x33f2('0x1b')](config[_0x33f2('0x1c')],{'host':_0x33f2('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33f2('0x1c')]));require('./team.socket')[_0x33f2('0x1e')](socket);function respondWithStatusCode(_0x1a789a,_0x1e120b){_0x1e120b=_0x1e120b||0xcc;return function(_0x483ce0){if(_0x483ce0){return _0x1a789a[_0x33f2('0x1f')](_0x1e120b);}return _0x1a789a[_0x33f2('0x20')](_0x1e120b)[_0x33f2('0x21')]();};}function respondWithResult(_0x1289e4,_0x473daf){_0x473daf=_0x473daf||0xc8;return function(_0xcd5c78){if(_0xcd5c78){return _0x1289e4['status'](_0x473daf)[_0x33f2('0x22')](_0xcd5c78);}};}function respondWithFilteredResult(_0x21a3b1,_0xd685e3){return function(_0x87ae02){if(_0x87ae02){var _0x40dcee=typeof _0xd685e3['offset']===_0x33f2('0x23')&&typeof _0xd685e3[_0x33f2('0x24')]===_0x33f2('0x23');var _0x494e52=_0x87ae02[_0x33f2('0x25')];var _0x17b91d=_0x40dcee?0x0:_0xd685e3[_0x33f2('0x26')];var _0x11ebc8=_0x40dcee?_0x87ae02['count']:_0xd685e3[_0x33f2('0x26')]+_0xd685e3['limit'];var _0x381daa;if(_0x11ebc8>=_0x494e52){_0x11ebc8=_0x494e52;_0x381daa=0xc8;}else{_0x381daa=0xce;}_0x21a3b1['status'](_0x381daa);return _0x21a3b1['set'](_0x33f2('0x27'),_0x17b91d+'-'+_0x11ebc8+'/'+_0x494e52)['json'](_0x87ae02);}return null;};}function patchUpdates(_0x4d2e90){return function(_0x5e0962){try{jsonpatch['apply'](_0x5e0962,_0x4d2e90,!![]);}catch(_0x2e4bdf){return BPromise[_0x33f2('0x28')](_0x2e4bdf);}return _0x5e0962[_0x33f2('0x29')]();};}function saveUpdates(_0x84ca5e,_0x3fa75a){return function(_0x56a0cd){if(_0x56a0cd){return _0x56a0cd[_0x33f2('0x2a')](_0x84ca5e)[_0x33f2('0x2b')](function(_0x36bfc6){return _0x36bfc6;});}return null;};}function handleEntityNotFound(_0x444ec5,_0x20cc0a){return function(_0x541b2e){if(!_0x541b2e){_0x444ec5['sendStatus'](0x194);}return _0x541b2e;};}function handleError(_0x57f0cf,_0x23934){_0x23934=_0x23934||0x1f4;return function(_0x2906ba){logger[_0x33f2('0x2c')](_0x2906ba[_0x33f2('0x2d')]);if(_0x2906ba['name']){delete _0x2906ba[_0x33f2('0x2e')];}_0x57f0cf[_0x33f2('0x20')](_0x23934)[_0x33f2('0x2f')](_0x2906ba);};}exports[_0x33f2('0x30')]=function(_0x3c92ea,_0x1c194a){var _0x43ffbd={},_0x59f98b={},_0x2f2ba9={'count':0x0,'rows':[]};var _0x3e417f=_[_0x33f2('0x31')](db[_0x33f2('0x32')]['rawAttributes'],function(_0x14c9eb){return{'name':_0x14c9eb[_0x33f2('0x33')],'type':_0x14c9eb[_0x33f2('0x34')]['key']};});_0x59f98b[_0x33f2('0x35')]=_['map'](_0x3e417f,_0x33f2('0x2e'));_0x59f98b[_0x33f2('0x36')]=_[_0x33f2('0x37')](_0x3c92ea[_0x33f2('0x36')]);_0x59f98b['filters']=_[_0x33f2('0x38')](_0x59f98b[_0x33f2('0x35')],_0x59f98b['query']);_0x43ffbd['attributes']=_['intersection'](_0x59f98b['model'],qs[_0x33f2('0x39')](_0x3c92ea[_0x33f2('0x36')][_0x33f2('0x39')]));_0x43ffbd[_0x33f2('0x3a')]=_0x43ffbd['attributes']['length']?_0x43ffbd[_0x33f2('0x3a')]:_0x59f98b[_0x33f2('0x35')];if(!_0x3c92ea[_0x33f2('0x36')][_0x33f2('0x3b')](_0x33f2('0x3c'))){_0x43ffbd[_0x33f2('0x24')]=qs[_0x33f2('0x24')](_0x3c92ea[_0x33f2('0x36')][_0x33f2('0x24')]);_0x43ffbd['offset']=qs['offset'](_0x3c92ea[_0x33f2('0x36')][_0x33f2('0x26')]);}_0x43ffbd[_0x33f2('0x3d')]=qs[_0x33f2('0x3e')](_0x3c92ea['query']['sort']);_0x43ffbd[_0x33f2('0x3f')]=qs[_0x33f2('0x40')](_['pick'](_0x3c92ea['query'],_0x59f98b[_0x33f2('0x40')]),_0x3e417f);if(_0x3c92ea[_0x33f2('0x36')]['filter']){_0x43ffbd[_0x33f2('0x3f')]=_[_0x33f2('0x41')](_0x43ffbd['where'],{'$or':_[_0x33f2('0x31')](_0x3e417f,function(_0x11649a){if(_0x11649a[_0x33f2('0x34')]!=='VIRTUAL'){var _0x1607f3={};_0x1607f3[_0x11649a[_0x33f2('0x2e')]]={'$like':'%'+_0x3c92ea['query'][_0x33f2('0x42')]+'%'};return _0x1607f3;}})});}_0x43ffbd=_[_0x33f2('0x41')]({},_0x43ffbd,_0x3c92ea[_0x33f2('0x43')]);var _0x55b267={'where':_0x43ffbd['where']};return db[_0x33f2('0x32')][_0x33f2('0x25')](_0x55b267)[_0x33f2('0x2b')](function(_0x13ae4b){_0x2f2ba9[_0x33f2('0x25')]=_0x13ae4b;if(_0x3c92ea['query'][_0x33f2('0x44')]){_0x43ffbd[_0x33f2('0x45')]=[{'all':!![]}];}return db[_0x33f2('0x32')]['findAll'](_0x43ffbd);})[_0x33f2('0x2b')](function(_0x4d7a1e){_0x2f2ba9[_0x33f2('0x46')]=_0x4d7a1e;return _0x2f2ba9;})[_0x33f2('0x2b')](respondWithFilteredResult(_0x1c194a,_0x43ffbd))['catch'](handleError(_0x1c194a,null));};exports[_0x33f2('0x47')]=function(_0x218177,_0x11da20){var _0x76c3e4={'raw':![],'where':{'id':_0x218177[_0x33f2('0x48')]['id']}},_0x4313e9={};_0x4313e9[_0x33f2('0x35')]=_[_0x33f2('0x37')](db['Team']['rawAttributes']);_0x4313e9[_0x33f2('0x36')]=_[_0x33f2('0x37')](_0x218177[_0x33f2('0x36')]);_0x4313e9[_0x33f2('0x40')]=_[_0x33f2('0x38')](_0x4313e9[_0x33f2('0x35')],_0x4313e9[_0x33f2('0x36')]);_0x76c3e4[_0x33f2('0x3a')]=_[_0x33f2('0x38')](_0x4313e9[_0x33f2('0x35')],qs['fields'](_0x218177[_0x33f2('0x36')]['fields']));_0x76c3e4[_0x33f2('0x3a')]=_0x76c3e4[_0x33f2('0x3a')]['length']?_0x76c3e4[_0x33f2('0x3a')]:_0x4313e9[_0x33f2('0x35')];if(_0x218177['query'][_0x33f2('0x44')]){_0x76c3e4[_0x33f2('0x45')]=[{'all':!![]}];}_0x76c3e4=_[_0x33f2('0x41')]({},_0x76c3e4,_0x218177['options']);return db[_0x33f2('0x32')][_0x33f2('0x49')](_0x76c3e4)[_0x33f2('0x2b')](handleEntityNotFound(_0x11da20,null))['then'](respondWithResult(_0x11da20,null))[_0x33f2('0x4a')](handleError(_0x11da20,null));};exports[_0x33f2('0x4b')]=function(_0xfbca4c,_0x1951f3){return db[_0x33f2('0x32')][_0x33f2('0x4b')](_0xfbca4c[_0x33f2('0x4c')],{})[_0x33f2('0x2b')](function(_0xba19e5){var _0x1ca566=_0xfbca4c['user'][_0x33f2('0x4d')]({'plain':!![]});if(!_0x1ca566)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ca566[_0x33f2('0x4e')]===_0x33f2('0x4f')){var _0x27cc8d=_0xba19e5[_0x33f2('0x4d')]({'plain':!![]});var _0x487060='Teams';return db[_0x33f2('0x50')][_0x33f2('0x49')]({'where':{'name':_0x487060,'userProfileId':_0x1ca566[_0x33f2('0x51')]},'raw':!![]})[_0x33f2('0x2b')](function(_0x2742a5){if(_0x2742a5&&_0x2742a5['autoAssociation']===0x0){return db[_0x33f2('0x52')][_0x33f2('0x4b')]({'name':_0x27cc8d[_0x33f2('0x2e')],'resourceId':_0x27cc8d['id'],'type':_0x2742a5[_0x33f2('0x2e')],'sectionId':_0x2742a5['id']},{})['then'](function(){return _0xba19e5;});}else{return _0xba19e5;}})[_0x33f2('0x4a')](function(_0x346931){logger['error'](_0x33f2('0x53'),_0x346931);throw _0x346931;});}return _0xba19e5;})['then'](respondWithResult(_0x1951f3,0xc9))[_0x33f2('0x4a')](handleError(_0x1951f3,null));};exports[_0x33f2('0x2a')]=function(_0xcf549d,_0x1c9cab){if(_0xcf549d[_0x33f2('0x4c')]['id']){delete _0xcf549d[_0x33f2('0x4c')]['id'];}return db['Team'][_0x33f2('0x49')]({'where':{'id':_0xcf549d[_0x33f2('0x48')]['id']}})[_0x33f2('0x2b')](handleEntityNotFound(_0x1c9cab,null))[_0x33f2('0x2b')](saveUpdates(_0xcf549d[_0x33f2('0x4c')],null))['then'](respondWithResult(_0x1c9cab,null))[_0x33f2('0x4a')](handleError(_0x1c9cab,null));};exports[_0x33f2('0x54')]=function(_0x3a1559,_0x2ccaf4){var _0x52c500=_0x3a1559[_0x33f2('0x48')]['id'];var _0x3e0a60=[];return db[_0x33f2('0x55')][_0x33f2('0x56')](function(_0x5a0234){var _0xf4803c=_0x33f2('0x57')+_0x52c500;return db[_0x33f2('0x55')]['query'](_0xf4803c,{'type':db[_0x33f2('0x58')][_0x33f2('0x59')][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234})[_0x33f2('0x2b')](function(_0x21fa3c){_0x3e0a60=_[_0x33f2('0x31')](_0x21fa3c,function(_0x11032c){return Number(_0x11032c[_0x33f2('0x5b')]);});})[_0x33f2('0x2b')](function(){var _0x3e6280='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x52c500;return db['sequelize'][_0x33f2('0x36')](_0x3e6280,{'type':db[_0x33f2('0x58')][_0x33f2('0x59')]['SELECT'],'raw':!![],'transaction':_0x5a0234});})['then'](function(_0x19e074){var _0x52e288=_['map'](_0x19e074,function(_0x29ec3c){return Number(_0x29ec3c[_0x33f2('0x5c')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x3e0a60},'VoiceQueueId':{'$in':_0x52e288}},'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(){var _0x1f1417=_0x33f2('0x5d')+_0x52c500;return db[_0x33f2('0x55')][_0x33f2('0x36')](_0x1f1417,{'type':db[_0x33f2('0x58')][_0x33f2('0x59')][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(_0x194624){var _0x222f11=_[_0x33f2('0x31')](_0x194624,function(_0x51f2ff){return Number(_0x51f2ff[_0x33f2('0x5e')]);});return db[_0x33f2('0x5f')][_0x33f2('0x54')]({'where':{'UserId':{'$in':_0x3e0a60},'MailQueueId':{'$in':_0x222f11}},'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(){var _0x5a4ce4=_0x33f2('0x60')+_0x52c500;return db['sequelize'][_0x33f2('0x36')](_0x5a4ce4,{'type':db[_0x33f2('0x58')]['QueryTypes'][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(_0x3b966d){var _0x325cb1=_[_0x33f2('0x31')](_0x3b966d,function(_0x5f0785){return Number(_0x5f0785[_0x33f2('0x61')]);});return db[_0x33f2('0x62')][_0x33f2('0x54')]({'where':{'UserId':{'$in':_0x3e0a60},'SmsQueueId':{'$in':_0x325cb1}},'transaction':_0x5a0234});})['then'](function(){var _0xd0cf5f=_0x33f2('0x63')+_0x52c500;return db[_0x33f2('0x55')]['query'](_0xd0cf5f,{'type':db[_0x33f2('0x58')][_0x33f2('0x59')][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234});})['then'](function(_0x124674){var _0x339590=_['map'](_0x124674,function(_0x469e27){return Number(_0x469e27['ChatQueueId']);});return db[_0x33f2('0x64')]['destroy']({'where':{'UserId':{'$in':_0x3e0a60},'ChatQueueId':{'$in':_0x339590}},'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(){var _0x26a877=_0x33f2('0x65')+_0x52c500;return db['sequelize'][_0x33f2('0x36')](_0x26a877,{'type':db[_0x33f2('0x58')][_0x33f2('0x59')][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(_0x3d86c5){var _0x26d814=_[_0x33f2('0x31')](_0x3d86c5,function(_0x4bb0bb){return Number(_0x4bb0bb[_0x33f2('0x66')]);});return db[_0x33f2('0x67')][_0x33f2('0x54')]({'where':{'UserId':{'$in':_0x3e0a60},'FaxQueueId':{'$in':_0x26d814}},'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(){var _0x3ab565=_0x33f2('0x68')+_0x52c500;return db[_0x33f2('0x55')][_0x33f2('0x36')](_0x3ab565,{'type':db[_0x33f2('0x58')][_0x33f2('0x59')][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(_0x2374e5){var _0x573d80=_[_0x33f2('0x31')](_0x2374e5,function(_0x2e0172){return Number(_0x2e0172[_0x33f2('0x69')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x3e0a60},'OpenchannelQueueId':{'$in':_0x573d80}},'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(){var _0x5c79ce=_0x33f2('0x6a')+_0x52c500;return db[_0x33f2('0x55')][_0x33f2('0x36')](_0x5c79ce,{'type':db['Sequelize']['QueryTypes'][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(_0x1f7ad0){var _0x5052d9=_[_0x33f2('0x31')](_0x1f7ad0,function(_0x4c2ae5){return Number(_0x4c2ae5[_0x33f2('0x6b')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x3e0a60},'WhatsappQueueId':{'$in':_0x5052d9}},'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(){return db[_0x33f2('0x6c')]['find']({'where':{'TeamId':_0x52c500}});})[_0x33f2('0x2b')](function(_0x1f79f8){if(_0x1f79f8===null){return;}return db[_0x33f2('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x3e0a60},'VoicePrefixId':_0x1f79f8[_0x33f2('0x6e')]},'transaction':_0x5a0234});})['then'](function(){return db[_0x33f2('0x32')]['destroy']({'where':{'id':_0x52c500},'cascade':!![],'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(_0xe69258){if(_0xe69258===0x0){_0x2ccaf4[_0x33f2('0x1f')](0x194);}else{return db['UserProfileResource'][_0x33f2('0x54')]({'where':{'type':_0x33f2('0x6f'),'resourceId':_0x52c500},'cascade':!![],'transaction':_0x5a0234})[_0x33f2('0x2b')](function(){_0x2ccaf4[_0x33f2('0x20')](0xcc)[_0x33f2('0x21')]();});}})[_0x33f2('0x4a')](function(_0x109ca6){_0x2ccaf4[_0x33f2('0x20')](0x1f4)[_0x33f2('0x2f')](_0x109ca6);});});};exports['getQueues']=function(_0x2af2c7,_0x55f3b6,_0x4b615b){return db[_0x33f2('0x32')][_0x33f2('0x70')]({'where':{'id':_0x2af2c7[_0x33f2('0x48')]['id']}})[_0x33f2('0x2b')](handleEntityNotFound(_0x55f3b6,null))[_0x33f2('0x2b')](function(_0x26a2ec){if(!_0x2af2c7[_0x33f2('0x36')]['channel']||!utils['isValidChannel'](_0x2af2c7[_0x33f2('0x36')][_0x33f2('0x71')])){throw new db[(_0x33f2('0x58'))]['ValidationError']('Unknown\x20channel');}var _0x50eba9={};var _0x1d0e84={};_0x1d0e84[_0x33f2('0x35')]=_['keys'](db[_[_0x33f2('0x72')](_0x2af2c7[_0x33f2('0x36')]['channel'][_0x33f2('0x73')]())+_0x33f2('0x74')][_0x33f2('0x75')]);_0x1d0e84[_0x33f2('0x36')]=_[_0x33f2('0x37')](_0x2af2c7['query']);_0x1d0e84[_0x33f2('0x40')]=_['intersection'](_0x1d0e84[_0x33f2('0x35')],_0x1d0e84[_0x33f2('0x36')]);_0x50eba9[_0x33f2('0x3a')]=_['intersection'](_0x1d0e84['model'],qs['fields'](_0x2af2c7[_0x33f2('0x36')][_0x33f2('0x39')]));_0x50eba9[_0x33f2('0x3a')]=_0x50eba9[_0x33f2('0x3a')][_0x33f2('0x76')]?_0x50eba9[_0x33f2('0x3a')]:_0x1d0e84[_0x33f2('0x35')];_0x50eba9[_0x33f2('0x24')]=qs[_0x33f2('0x24')](_0x2af2c7['query'][_0x33f2('0x24')]);_0x50eba9[_0x33f2('0x26')]=qs['offset'](_0x2af2c7[_0x33f2('0x36')][_0x33f2('0x26')]);_0x50eba9[_0x33f2('0x3d')]=qs['sort'](_0x2af2c7['query'][_0x33f2('0x3e')]);_0x50eba9[_0x33f2('0x3f')]=qs['filters'](_[_0x33f2('0x77')](_0x2af2c7[_0x33f2('0x36')],_0x1d0e84[_0x33f2('0x40')]));_0x50eba9=_['merge']({},_0x50eba9,_0x2af2c7[_0x33f2('0x43')]);return _0x26a2ec[_0x33f2('0x4d')+_[_0x33f2('0x72')](_0x2af2c7[_0x33f2('0x36')]['channel'][_0x33f2('0x73')]())+_0x33f2('0x78')](_0x50eba9);})[_0x33f2('0x2b')](respondWithResult(_0x55f3b6,null))[_0x33f2('0x4a')](handleError(_0x55f3b6,null));};exports[_0x33f2('0x79')]=function(_0xe6b23e,_0x2d793a,_0x5845c8){return db[_0x33f2('0x32')][_0x33f2('0x70')]({'where':{'id':_0xe6b23e[_0x33f2('0x48')]['id']}})[_0x33f2('0x2b')](function(_0x3eb292){if(_0x3eb292){if(!_0xe6b23e[_0x33f2('0x4c')][_0x33f2('0x71')]||!utils[_0x33f2('0x7a')](_0xe6b23e['body'][_0x33f2('0x71')])){throw new db[(_0x33f2('0x58'))][(_0x33f2('0x7b'))](_0x33f2('0x7c'));}return _0x3eb292[_0x33f2('0x7d')+_[_0x33f2('0x72')](_0xe6b23e['body'][_0x33f2('0x71')][_0x33f2('0x73')]())+'Queues'](_0xe6b23e['body']['ids']);}return null;})[_0x33f2('0x2b')](handleEntityNotFound(_0x2d793a,null))[_0x33f2('0x2b')](respondWithStatusCode(_0x2d793a,null))[_0x33f2('0x4a')](handleError(_0x2d793a,null));};exports[_0x33f2('0x7e')]=function(_0x4f9cf9,_0x350473,_0x17f550){return db[_0x33f2('0x32')][_0x33f2('0x70')]({'where':{'id':_0x4f9cf9[_0x33f2('0x48')]['id']}})['then'](function(_0x2caed1){if(_0x2caed1){if(!_0x4f9cf9[_0x33f2('0x36')][_0x33f2('0x71')]||!utils['isValidChannel'](_0x4f9cf9['query'][_0x33f2('0x71')])){throw new db[(_0x33f2('0x58'))][(_0x33f2('0x7b'))]('Unknown\x20channel');}return _0x2caed1[_0x33f2('0x7f')+_[_0x33f2('0x72')](_0x4f9cf9['query']['channel']['toLowerCase']())+_0x33f2('0x78')](_0x4f9cf9['query']['ids']);}return null;})[_0x33f2('0x2b')](handleEntityNotFound(_0x350473,null))[_0x33f2('0x2b')](respondWithStatusCode(_0x350473,null))[_0x33f2('0x4a')](handleError(_0x350473,null));};exports[_0x33f2('0x80')]=function(_0x3b18ea,_0x26d54e){var _0x2ddfe5=_[_0x33f2('0x81')](_0x3b18ea[_0x33f2('0x4c')]['ids'])?_0x3b18ea['body'][_0x33f2('0x82')]:[_0x3b18ea[_0x33f2('0x4c')][_0x33f2('0x82')]];var _0xef6fa2=_0x3b18ea[_0x33f2('0x48')]['id'];return db[_0x33f2('0x32')][_0x33f2('0x49')]({'where':{'id':_0xef6fa2}})[_0x33f2('0x2b')](handleEntityNotFound(_0x26d54e,null))[_0x33f2('0x2b')](function(_0x40d44f){if(_0x40d44f){var _0xd2ea5f=[_0x33f2('0x83'),_0x33f2('0x84'),_0x33f2('0x85'),_0x33f2('0x86'),_0x33f2('0x87'),_0x33f2('0x88'),_0x33f2('0x89')];return db['sequelize']['transaction'](function(_0x6abb43){var _0x1da43c=_[_0x33f2('0x31')](_0xd2ea5f,function(_0x4c7c05){var _0x285eea={'attributes':['id',_0x33f2('0x2e')]};if(_0x4c7c05===_0x33f2('0x83')){_0x285eea[_0x33f2('0x8a')]={'attributes':['penalty']};}return _0x40d44f[_0x33f2('0x4d')+_0x4c7c05+_0x33f2('0x78')](_0x285eea)[_0x33f2('0x2b')](function(_0x219261){var _0x5f36c6=_[_0x33f2('0x31')](_0x219261,function(_0x3e0975){var _0x286c8f=_['map'](_0x2ddfe5,function(_0x4a0f8b){var _0x362e0c={'where':{'UserId':_0x4a0f8b,[_0x4c7c05+_0x33f2('0x8b')]:_0x3e0975['id']},'transaction':_0x6abb43};if(_0x4c7c05==='Voice'){_0x362e0c[_0x33f2('0x1b')]={'penalty':_0x3e0975[_0x33f2('0x8c')][_0x33f2('0x8d')]};}return db[_0x33f2('0x8e')+_0x4c7c05+_0x33f2('0x74')][_0x33f2('0x8f')](_0x362e0c)[_0x33f2('0x2b')](function(){socket['emit'](_0x33f2('0x4f')+_0x4c7c05+_0x33f2('0x90'),{'UserId':_0x4a0f8b,[_0x4c7c05+_0x33f2('0x8b')]:_0x3e0975['id']});if(_0x4c7c05!=='Voice'){return;}return db[_0x33f2('0x8e')][_0x33f2('0x91')]({'where':{'id':_0x2ddfe5,'online':0x1},'attributes':['id',_0x33f2('0x2e'),_0x33f2('0x92'),_0x33f2('0x93'),_0x33f2('0x94')],'raw':!![]})[_0x33f2('0x2b')](function(_0x101a75){var _0xdc0b74=_[_0x33f2('0x31')](_0x101a75,function(_0x349253){return db[_0x33f2('0x95')]['upsert']({'membername':_0x349253[_0x33f2('0x2e')],'UserId':_0x349253['id'],'queue_name':_0x3e0975[_0x33f2('0x2e')],'VoiceQueueId':_0x3e0975['id'],'interface':_[_0x33f2('0x96')](_0x349253[_0x33f2('0x94')])?util[_0x33f2('0x97')](_0x33f2('0x98'),_0x349253[_0x33f2('0x2e')]):_0x349253[_0x33f2('0x94')],'paused':_0x349253[_0x33f2('0x93')]||![],'penalty':_0x3e0975[_0x33f2('0x8c')][_0x33f2('0x8d')]},{'transaction':_0x6abb43});});return Promise[_0x33f2('0x99')](_0xdc0b74);});});});return Promise[_0x33f2('0x99')](_0x286c8f);});return Promise['all'](_0x5f36c6);})[_0x33f2('0x2b')](function(){return db[_0x33f2('0x6c')][_0x33f2('0x70')]({'where':{'teamId':_0xef6fa2}})['then'](function(_0x53381a){if(_0x53381a){var _0xd6fbe0=_[_0x33f2('0x31')](_0x2ddfe5,function(_0x10f8dc){db[_0x33f2('0x6d')]['upsert']({'UserId':_0x10f8dc,'VoicePrefixId':_0x53381a[_0x33f2('0x6e')]});});return Promise[_0x33f2('0x99')](_0xd6fbe0);}});});});return Promise[_0x33f2('0x99')](_0x1da43c)[_0x33f2('0x2b')](function(){return _0x40d44f[_0x33f2('0x80')](_0x2ddfe5,{'transaction':_0x6abb43})[_0x33f2('0x9a')](function(_0x35ab17){return _0x35ab17;});});});}})['then'](respondWithResult(_0x26d54e,null))[_0x33f2('0x4a')](handleError(_0x26d54e,null));};exports[_0x33f2('0x9b')]=function(_0x495006,_0x20d478){var _0x2f8cf0=_[_0x33f2('0x81')](_0x495006[_0x33f2('0x36')]['ids'])?_0x495006[_0x33f2('0x36')][_0x33f2('0x82')]:[_0x495006[_0x33f2('0x36')][_0x33f2('0x82')]];var _0x96f045=_0x495006[_0x33f2('0x48')]['id'];return db[_0x33f2('0x32')][_0x33f2('0x49')]({'where':{'id':_0x96f045}})[_0x33f2('0x2b')](handleEntityNotFound(_0x20d478,null))[_0x33f2('0x2b')](function(_0x5a4bbc){if(_0x5a4bbc){var _0x280199=[_0x33f2('0x83'),_0x33f2('0x84'),'Mail','Sms',_0x33f2('0x87'),_0x33f2('0x88'),_0x33f2('0x89')];return db[_0x33f2('0x55')][_0x33f2('0x56')](function(_0x398505){var _0xc59e1f=_[_0x33f2('0x31')](_0x280199,function(_0x5a3159){var _0xf14e9b={'attributes':['id','name']};return _0x5a4bbc[_0x33f2('0x4d')+_0x5a3159+_0x33f2('0x78')](_0xf14e9b)[_0x33f2('0x2b')](function(_0x13e8da){var _0x5e1167=_[_0x33f2('0x31')](_0x13e8da,function(_0x3cb0c0){return _0x3cb0c0[_0x33f2('0x9b')](_0x2f8cf0,{'transaction':_0x398505})['then'](function(){var _0x430370=_[_0x33f2('0x31')](_0x2f8cf0,function(_0x594361){socket[_0x33f2('0x9c')](_0x33f2('0x4f')+_0x5a3159+'Queue:remove',{'UserId':Number(_0x594361),[_0x5a3159+'QueueId']:_0x3cb0c0['id']});if(_0x5a3159!=='Voice'){return;}return db[_0x33f2('0x95')][_0x33f2('0x54')]({'where':{'VoiceQueueId':_0x3cb0c0['id'],'UserId':_0x594361},'transaction':_0x398505});});return Promise['all'](_0x430370);});});return Promise[_0x33f2('0x99')](_0x5e1167);});});return Promise[_0x33f2('0x99')](_0xc59e1f)[_0x33f2('0x2b')](function(){return _0x5a4bbc['removeAgents'](_0x2f8cf0,{'transaction':_0x398505});})[_0x33f2('0x2b')](function(){return db[_0x33f2('0x6c')]['findOne']({'where':{'teamId':_0x96f045}})[_0x33f2('0x2b')](function(_0xf27fae){if(_0xf27fae){var _0x23443e=_['map'](_0x2f8cf0,function(_0x38f896){db[_0x33f2('0x6d')]['destroy']({'where':{'UserId':_0x38f896,'VoicePrefixId':_0xf27fae[_0x33f2('0x6e')]}});});return Promise['all'](_0x23443e);}});});});}})[_0x33f2('0x2b')](respondWithStatusCode(_0x20d478,null))['catch'](handleError(_0x20d478,null));};exports[_0x33f2('0x9d')]=function(_0x52b55f,_0x412847,_0x6fd78f){var _0x117f49={};var _0x595e82={};var _0x22890a;var _0x5623af;return db[_0x33f2('0x32')][_0x33f2('0x70')]({'where':{'id':_0x52b55f['params']['id']}})[_0x33f2('0x2b')](handleEntityNotFound(_0x412847,null))['then'](function(_0x31e0c9){if(_0x31e0c9){_0x22890a=_0x31e0c9;_0x595e82[_0x33f2('0x35')]=_[_0x33f2('0x37')](db[_0x33f2('0x8e')][_0x33f2('0x75')]);_0x595e82['query']=_['keys'](_0x52b55f[_0x33f2('0x36')]);_0x595e82[_0x33f2('0x40')]=_[_0x33f2('0x38')](_0x595e82[_0x33f2('0x35')],_0x595e82[_0x33f2('0x36')]);_0x117f49['attributes']=_[_0x33f2('0x38')](_0x595e82[_0x33f2('0x35')],qs[_0x33f2('0x39')](_0x52b55f[_0x33f2('0x36')][_0x33f2('0x39')]));_0x117f49[_0x33f2('0x3a')]=_0x117f49[_0x33f2('0x3a')]['length']?_0x117f49[_0x33f2('0x3a')]:_0x595e82['model'];_0x117f49[_0x33f2('0x3d')]=qs[_0x33f2('0x3e')](_0x52b55f['query']['sort']);_0x117f49['where']=qs['filters'](_[_0x33f2('0x77')](_0x52b55f[_0x33f2('0x36')],_0x595e82[_0x33f2('0x40')]));if(_0x52b55f[_0x33f2('0x36')][_0x33f2('0x42')]){_0x117f49[_0x33f2('0x3f')]=_[_0x33f2('0x41')](_0x117f49[_0x33f2('0x3f')],{'$or':_[_0x33f2('0x31')](_0x117f49['attributes'],function(_0x4bcf6a){var _0x331308={};_0x331308[_0x4bcf6a]={'$like':'%'+_0x52b55f[_0x33f2('0x36')][_0x33f2('0x42')]+'%'};return _0x331308;})});}_0x117f49=_[_0x33f2('0x41')]({},_0x117f49,_0x52b55f[_0x33f2('0x43')]);return _0x22890a['getAgents'](_0x117f49);}})[_0x33f2('0x2b')](function(_0x49f087){if(_0x49f087){_0x5623af=_0x49f087[_0x33f2('0x76')];if(!_0x52b55f[_0x33f2('0x36')][_0x33f2('0x3b')](_0x33f2('0x3c'))){_0x117f49[_0x33f2('0x24')]=qs[_0x33f2('0x24')](_0x52b55f['query']['limit']);_0x117f49[_0x33f2('0x26')]=qs[_0x33f2('0x26')](_0x52b55f['query'][_0x33f2('0x26')]);}return _0x22890a[_0x33f2('0x9d')](_0x117f49);}})[_0x33f2('0x2b')](function(_0x11aa33){if(_0x11aa33){return _0x11aa33?{'count':_0x5623af,'rows':_0x11aa33}:null;}})['then'](respondWithResult(_0x412847,null))['catch'](handleError(_0x412847,null));}; \ No newline at end of file +var _0x4f44=['where','filters','filter','merge','options','Team','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','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','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','toLowerCase','Queue','order','pick','capitalize','Queues','addQueues','findOne','Unknown\x20channel','add','ids','removeQueues','addAgents','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','online','voicePause','interface','format','all','upsert','isArray','Chat','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','set','json','apply','reject','save','then','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort'];(function(_0x3c8998,_0x3c5f4d){var _0x4cf83f=function(_0x3bbc5e){while(--_0x3bbc5e){_0x3c8998['push'](_0x3c8998['shift']());}};_0x4cf83f(++_0x3c5f4d);}(_0x4f44,0xf6));var _0x44f4=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4f44[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x44f4('0x0'));var rimraf=require(_0x44f4('0x1'));var zipdir=require(_0x44f4('0x2'));var jsonpatch=require(_0x44f4('0x3'));var rp=require(_0x44f4('0x4'));var moment=require(_0x44f4('0x5'));var BPromise=require(_0x44f4('0x6'));var Mustache=require(_0x44f4('0x7'));var util=require(_0x44f4('0x8'));var path=require('path');var sox=require(_0x44f4('0x9'));var csv=require('to-csv');var ejs=require(_0x44f4('0xa'));var fs=require('fs');var fs_extra=require(_0x44f4('0xb'));var _=require(_0x44f4('0xc'));var squel=require(_0x44f4('0xd'));var crypto=require(_0x44f4('0xe'));var jsforce=require(_0x44f4('0xf'));var deskjs=require(_0x44f4('0x10'));var toCsv=require(_0x44f4('0x11'));var querystring=require(_0x44f4('0x12'));var Papa=require(_0x44f4('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x44f4('0x14'));var as=require(_0x44f4('0x15'));var hardwareService=require(_0x44f4('0x16'));var logger=require('../../config/logger')(_0x44f4('0x17'));var utils=require(_0x44f4('0x18'));var config=require(_0x44f4('0x19'));var licenseUtil=require(_0x44f4('0x1a'));var db=require(_0x44f4('0x1b'))['db'];config[_0x44f4('0x1c')]=_[_0x44f4('0x1d')](config[_0x44f4('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x44f4('0x1e'))(new Redis(config[_0x44f4('0x1c')]));require('./team.socket')[_0x44f4('0x1f')](socket);function respondWithStatusCode(_0xa1ba09,_0x41c4dd){_0x41c4dd=_0x41c4dd||0xcc;return function(_0x236140){if(_0x236140){return _0xa1ba09[_0x44f4('0x20')](_0x41c4dd);}return _0xa1ba09[_0x44f4('0x21')](_0x41c4dd)[_0x44f4('0x22')]();};}function respondWithResult(_0x2a4e7e,_0x58d2fe){_0x58d2fe=_0x58d2fe||0xc8;return function(_0x51c55a){if(_0x51c55a){return _0x2a4e7e[_0x44f4('0x21')](_0x58d2fe)['json'](_0x51c55a);}};}function respondWithFilteredResult(_0x57fba8,_0x2f8915){return function(_0x2fe2fb){if(_0x2fe2fb){var _0x94ae2b=typeof _0x2f8915['offset']===_0x44f4('0x23')&&typeof _0x2f8915[_0x44f4('0x24')]===_0x44f4('0x23');var _0x4a3dea=_0x2fe2fb[_0x44f4('0x25')];var _0xee9500=_0x94ae2b?0x0:_0x2f8915['offset'];var _0x256bf4=_0x94ae2b?_0x2fe2fb[_0x44f4('0x25')]:_0x2f8915['offset']+_0x2f8915[_0x44f4('0x24')];var _0x2f09c7;if(_0x256bf4>=_0x4a3dea){_0x256bf4=_0x4a3dea;_0x2f09c7=0xc8;}else{_0x2f09c7=0xce;}_0x57fba8['status'](_0x2f09c7);return _0x57fba8[_0x44f4('0x26')]('Content-Range',_0xee9500+'-'+_0x256bf4+'/'+_0x4a3dea)[_0x44f4('0x27')](_0x2fe2fb);}return null;};}function patchUpdates(_0x631a01){return function(_0x196019){try{jsonpatch[_0x44f4('0x28')](_0x196019,_0x631a01,!![]);}catch(_0x1ff400){return BPromise[_0x44f4('0x29')](_0x1ff400);}return _0x196019[_0x44f4('0x2a')]();};}function saveUpdates(_0x470933,_0x5bea33){return function(_0x6ee1c8){if(_0x6ee1c8){return _0x6ee1c8['update'](_0x470933)[_0x44f4('0x2b')](function(_0x3ecbd2){return _0x3ecbd2;});}return null;};}function handleEntityNotFound(_0x585efa,_0x224b90){return function(_0x513876){if(!_0x513876){_0x585efa[_0x44f4('0x20')](0x194);}return _0x513876;};}function handleError(_0x28a537,_0x13e4d1){_0x13e4d1=_0x13e4d1||0x1f4;return function(_0x31c628){logger['error'](_0x31c628[_0x44f4('0x2c')]);if(_0x31c628[_0x44f4('0x2d')]){delete _0x31c628[_0x44f4('0x2d')];}_0x28a537['status'](_0x13e4d1)[_0x44f4('0x2e')](_0x31c628);};}exports[_0x44f4('0x2f')]=function(_0x3da7eb,_0x30ba7f){var _0x3216bc={},_0x1b4c9f={},_0x2df071={'count':0x0,'rows':[]};var _0x4fe5fe=_['map'](db['Team'][_0x44f4('0x30')],function(_0x29e0c2){return{'name':_0x29e0c2['fieldName'],'type':_0x29e0c2[_0x44f4('0x31')][_0x44f4('0x32')]};});_0x1b4c9f[_0x44f4('0x33')]=_[_0x44f4('0x34')](_0x4fe5fe,_0x44f4('0x2d'));_0x1b4c9f[_0x44f4('0x35')]=_[_0x44f4('0x36')](_0x3da7eb[_0x44f4('0x35')]);_0x1b4c9f['filters']=_[_0x44f4('0x37')](_0x1b4c9f[_0x44f4('0x33')],_0x1b4c9f[_0x44f4('0x35')]);_0x3216bc['attributes']=_[_0x44f4('0x37')](_0x1b4c9f[_0x44f4('0x33')],qs[_0x44f4('0x38')](_0x3da7eb[_0x44f4('0x35')][_0x44f4('0x38')]));_0x3216bc[_0x44f4('0x39')]=_0x3216bc['attributes']['length']?_0x3216bc[_0x44f4('0x39')]:_0x1b4c9f[_0x44f4('0x33')];if(!_0x3da7eb[_0x44f4('0x35')][_0x44f4('0x3a')](_0x44f4('0x3b'))){_0x3216bc[_0x44f4('0x24')]=qs['limit'](_0x3da7eb['query'][_0x44f4('0x24')]);_0x3216bc['offset']=qs[_0x44f4('0x3c')](_0x3da7eb[_0x44f4('0x35')][_0x44f4('0x3c')]);}_0x3216bc['order']=qs[_0x44f4('0x3d')](_0x3da7eb[_0x44f4('0x35')][_0x44f4('0x3d')]);_0x3216bc[_0x44f4('0x3e')]=qs[_0x44f4('0x3f')](_['pick'](_0x3da7eb[_0x44f4('0x35')],_0x1b4c9f[_0x44f4('0x3f')]),_0x4fe5fe);if(_0x3da7eb['query'][_0x44f4('0x40')]){_0x3216bc[_0x44f4('0x3e')]=_[_0x44f4('0x41')](_0x3216bc['where'],{'$or':_[_0x44f4('0x34')](_0x4fe5fe,function(_0x300150){if(_0x300150[_0x44f4('0x31')]!=='VIRTUAL'){var _0x43143d={};_0x43143d[_0x300150[_0x44f4('0x2d')]]={'$like':'%'+_0x3da7eb[_0x44f4('0x35')]['filter']+'%'};return _0x43143d;}})});}_0x3216bc=_['merge']({},_0x3216bc,_0x3da7eb[_0x44f4('0x42')]);var _0x3e3ebc={'where':_0x3216bc[_0x44f4('0x3e')]};return db[_0x44f4('0x43')]['count'](_0x3e3ebc)[_0x44f4('0x2b')](function(_0x3bec27){_0x2df071[_0x44f4('0x25')]=_0x3bec27;if(_0x3da7eb[_0x44f4('0x35')]['includeAll']){_0x3216bc[_0x44f4('0x44')]=[{'all':!![]}];}return db[_0x44f4('0x43')][_0x44f4('0x45')](_0x3216bc);})[_0x44f4('0x2b')](function(_0xc96159){_0x2df071[_0x44f4('0x46')]=_0xc96159;return _0x2df071;})[_0x44f4('0x2b')](respondWithFilteredResult(_0x30ba7f,_0x3216bc))[_0x44f4('0x47')](handleError(_0x30ba7f,null));};exports[_0x44f4('0x48')]=function(_0x5a824b,_0x293388){var _0x5b9ad0={'raw':![],'where':{'id':_0x5a824b[_0x44f4('0x49')]['id']}},_0x2248ad={};_0x2248ad[_0x44f4('0x33')]=_[_0x44f4('0x36')](db['Team'][_0x44f4('0x30')]);_0x2248ad['query']=_[_0x44f4('0x36')](_0x5a824b[_0x44f4('0x35')]);_0x2248ad[_0x44f4('0x3f')]=_[_0x44f4('0x37')](_0x2248ad[_0x44f4('0x33')],_0x2248ad[_0x44f4('0x35')]);_0x5b9ad0['attributes']=_[_0x44f4('0x37')](_0x2248ad[_0x44f4('0x33')],qs[_0x44f4('0x38')](_0x5a824b[_0x44f4('0x35')]['fields']));_0x5b9ad0[_0x44f4('0x39')]=_0x5b9ad0[_0x44f4('0x39')][_0x44f4('0x4a')]?_0x5b9ad0[_0x44f4('0x39')]:_0x2248ad[_0x44f4('0x33')];if(_0x5a824b['query'][_0x44f4('0x4b')]){_0x5b9ad0[_0x44f4('0x44')]=[{'all':!![]}];}_0x5b9ad0=_[_0x44f4('0x41')]({},_0x5b9ad0,_0x5a824b['options']);return db[_0x44f4('0x43')][_0x44f4('0x4c')](_0x5b9ad0)[_0x44f4('0x2b')](handleEntityNotFound(_0x293388,null))[_0x44f4('0x2b')](respondWithResult(_0x293388,null))['catch'](handleError(_0x293388,null));};exports['create']=function(_0x54ca1,_0x463a6a){return db[_0x44f4('0x43')][_0x44f4('0x4d')](_0x54ca1[_0x44f4('0x4e')],{})['then'](function(_0x5b7950){var _0x44c094=_0x54ca1[_0x44f4('0x4f')]['get']({'plain':!![]});if(!_0x44c094)throw new Error(_0x44f4('0x50'));if(_0x44c094[_0x44f4('0x51')]==='user'){var _0x13dabf=_0x5b7950[_0x44f4('0x52')]({'plain':!![]});var _0x41bc9c=_0x44f4('0x53');return db['UserProfileSection']['find']({'where':{'name':_0x41bc9c,'userProfileId':_0x44c094[_0x44f4('0x54')]},'raw':!![]})[_0x44f4('0x2b')](function(_0x11205b){if(_0x11205b&&_0x11205b['autoAssociation']===0x0){return db[_0x44f4('0x55')][_0x44f4('0x4d')]({'name':_0x13dabf[_0x44f4('0x2d')],'resourceId':_0x13dabf['id'],'type':_0x11205b[_0x44f4('0x2d')],'sectionId':_0x11205b['id']},{})[_0x44f4('0x2b')](function(){return _0x5b7950;});}else{return _0x5b7950;}})[_0x44f4('0x47')](function(_0x602f33){logger[_0x44f4('0x56')](_0x44f4('0x57'),_0x602f33);throw _0x602f33;});}return _0x5b7950;})[_0x44f4('0x2b')](respondWithResult(_0x463a6a,0xc9))['catch'](handleError(_0x463a6a,null));};exports['update']=function(_0x15bdbc,_0x1bbe3c){if(_0x15bdbc[_0x44f4('0x4e')]['id']){delete _0x15bdbc[_0x44f4('0x4e')]['id'];}return db[_0x44f4('0x43')]['find']({'where':{'id':_0x15bdbc['params']['id']}})[_0x44f4('0x2b')](handleEntityNotFound(_0x1bbe3c,null))['then'](saveUpdates(_0x15bdbc[_0x44f4('0x4e')],null))[_0x44f4('0x2b')](respondWithResult(_0x1bbe3c,null))[_0x44f4('0x47')](handleError(_0x1bbe3c,null));};exports[_0x44f4('0x58')]=function(_0x3e4d5b,_0x1b146c){var _0x4d2821=_0x3e4d5b[_0x44f4('0x49')]['id'];var _0x37eb3c=[];return db[_0x44f4('0x59')][_0x44f4('0x5a')](function(_0x2dbb2f){var _0x5b9aec=_0x44f4('0x5b')+_0x4d2821;return db['sequelize']['query'](_0x5b9aec,{'type':db[_0x44f4('0x5c')][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f})[_0x44f4('0x2b')](function(_0x1f43a3){_0x37eb3c=_[_0x44f4('0x34')](_0x1f43a3,function(_0x4e452e){return Number(_0x4e452e[_0x44f4('0x5f')]);});})[_0x44f4('0x2b')](function(){var _0x30a951='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4d2821;return db[_0x44f4('0x59')][_0x44f4('0x35')](_0x30a951,{'type':db[_0x44f4('0x5c')][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(_0x331728){var _0x3eab57=_[_0x44f4('0x34')](_0x331728,function(_0x5525f9){return Number(_0x5525f9[_0x44f4('0x60')]);});return db['UserVoiceQueue'][_0x44f4('0x58')]({'where':{'UserId':{'$in':_0x37eb3c},'VoiceQueueId':{'$in':_0x3eab57}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){var _0xa247c4=_0x44f4('0x61')+_0x4d2821;return db[_0x44f4('0x59')]['query'](_0xa247c4,{'type':db[_0x44f4('0x5c')][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})['then'](function(_0x27fb24){var _0x2b9af5=_[_0x44f4('0x34')](_0x27fb24,function(_0x11af46){return Number(_0x11af46['MailQueueId']);});return db[_0x44f4('0x62')]['destroy']({'where':{'UserId':{'$in':_0x37eb3c},'MailQueueId':{'$in':_0x2b9af5}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){var _0x508356='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4d2821;return db[_0x44f4('0x59')][_0x44f4('0x35')](_0x508356,{'type':db[_0x44f4('0x5c')][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})['then'](function(_0x4165ce){var _0x4dcec6=_[_0x44f4('0x34')](_0x4165ce,function(_0x4b5bc8){return Number(_0x4b5bc8[_0x44f4('0x63')]);});return db[_0x44f4('0x64')][_0x44f4('0x58')]({'where':{'UserId':{'$in':_0x37eb3c},'SmsQueueId':{'$in':_0x4dcec6}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){var _0x3f6c4b=_0x44f4('0x65')+_0x4d2821;return db[_0x44f4('0x59')][_0x44f4('0x35')](_0x3f6c4b,{'type':db['Sequelize'][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})['then'](function(_0xcd0f2a){var _0x4f0dcf=_[_0x44f4('0x34')](_0xcd0f2a,function(_0x28757a){return Number(_0x28757a[_0x44f4('0x66')]);});return db['UserChatQueue'][_0x44f4('0x58')]({'where':{'UserId':{'$in':_0x37eb3c},'ChatQueueId':{'$in':_0x4f0dcf}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){var _0x1cf936=_0x44f4('0x67')+_0x4d2821;return db[_0x44f4('0x59')][_0x44f4('0x35')](_0x1cf936,{'type':db['Sequelize'][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(_0x4f1d54){var _0x52f3f4=_[_0x44f4('0x34')](_0x4f1d54,function(_0x368a30){return Number(_0x368a30[_0x44f4('0x68')]);});return db[_0x44f4('0x69')]['destroy']({'where':{'UserId':{'$in':_0x37eb3c},'FaxQueueId':{'$in':_0x52f3f4}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){var _0x47655f=_0x44f4('0x6a')+_0x4d2821;return db['sequelize'][_0x44f4('0x35')](_0x47655f,{'type':db[_0x44f4('0x5c')][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(_0x492c8e){var _0x4356c4=_['map'](_0x492c8e,function(_0x438c64){return Number(_0x438c64[_0x44f4('0x6b')]);});return db[_0x44f4('0x6c')][_0x44f4('0x58')]({'where':{'UserId':{'$in':_0x37eb3c},'OpenchannelQueueId':{'$in':_0x4356c4}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){var _0x370865=_0x44f4('0x6d')+_0x4d2821;return db[_0x44f4('0x59')][_0x44f4('0x35')](_0x370865,{'type':db[_0x44f4('0x5c')][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(_0x59ce75){var _0x3a8c2b=_[_0x44f4('0x34')](_0x59ce75,function(_0x5389e2){return Number(_0x5389e2['WhatsappQueueId']);});return db[_0x44f4('0x6e')]['destroy']({'where':{'UserId':{'$in':_0x37eb3c},'WhatsappQueueId':{'$in':_0x3a8c2b}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){return db[_0x44f4('0x6f')][_0x44f4('0x4c')]({'where':{'TeamId':_0x4d2821}});})[_0x44f4('0x2b')](function(_0x107d55){if(_0x107d55===null){return;}return db[_0x44f4('0x70')][_0x44f4('0x58')]({'where':{'UserId':{'$in':_0x37eb3c},'VoicePrefixId':_0x107d55[_0x44f4('0x71')]},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){return db[_0x44f4('0x43')][_0x44f4('0x58')]({'where':{'id':_0x4d2821},'cascade':!![],'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(_0x3a89c0){if(_0x3a89c0===0x0){_0x1b146c[_0x44f4('0x20')](0x194);}else{return db[_0x44f4('0x55')][_0x44f4('0x58')]({'where':{'type':_0x44f4('0x53'),'resourceId':_0x4d2821},'cascade':!![],'transaction':_0x2dbb2f})[_0x44f4('0x2b')](function(){_0x1b146c[_0x44f4('0x21')](0xcc)[_0x44f4('0x22')]();});}})[_0x44f4('0x47')](function(_0x54f5e2){_0x1b146c[_0x44f4('0x21')](0x1f4)[_0x44f4('0x2e')](_0x54f5e2);});});};exports[_0x44f4('0x72')]=function(_0x2fded9,_0x383dae,_0x52ed75){return db['Team']['findOne']({'where':{'id':_0x2fded9[_0x44f4('0x49')]['id']}})[_0x44f4('0x2b')](handleEntityNotFound(_0x383dae,null))['then'](function(_0x2b9f10){if(!_0x2fded9[_0x44f4('0x35')][_0x44f4('0x73')]||!utils[_0x44f4('0x74')](_0x2fded9['query']['channel'])){throw new db[(_0x44f4('0x5c'))][(_0x44f4('0x75'))]('Unknown\x20channel');}var _0xd9a862={};var _0x4c7837={};_0x4c7837[_0x44f4('0x33')]=_[_0x44f4('0x36')](db[_['capitalize'](_0x2fded9[_0x44f4('0x35')][_0x44f4('0x73')][_0x44f4('0x76')]())+_0x44f4('0x77')][_0x44f4('0x30')]);_0x4c7837['query']=_['keys'](_0x2fded9[_0x44f4('0x35')]);_0x4c7837[_0x44f4('0x3f')]=_[_0x44f4('0x37')](_0x4c7837[_0x44f4('0x33')],_0x4c7837[_0x44f4('0x35')]);_0xd9a862[_0x44f4('0x39')]=_['intersection'](_0x4c7837['model'],qs[_0x44f4('0x38')](_0x2fded9[_0x44f4('0x35')][_0x44f4('0x38')]));_0xd9a862[_0x44f4('0x39')]=_0xd9a862[_0x44f4('0x39')][_0x44f4('0x4a')]?_0xd9a862['attributes']:_0x4c7837[_0x44f4('0x33')];_0xd9a862[_0x44f4('0x24')]=qs[_0x44f4('0x24')](_0x2fded9['query'][_0x44f4('0x24')]);_0xd9a862[_0x44f4('0x3c')]=qs[_0x44f4('0x3c')](_0x2fded9[_0x44f4('0x35')][_0x44f4('0x3c')]);_0xd9a862[_0x44f4('0x78')]=qs['sort'](_0x2fded9[_0x44f4('0x35')][_0x44f4('0x3d')]);_0xd9a862['where']=qs[_0x44f4('0x3f')](_[_0x44f4('0x79')](_0x2fded9[_0x44f4('0x35')],_0x4c7837[_0x44f4('0x3f')]));_0xd9a862=_['merge']({},_0xd9a862,_0x2fded9[_0x44f4('0x42')]);return _0x2b9f10[_0x44f4('0x52')+_[_0x44f4('0x7a')](_0x2fded9[_0x44f4('0x35')][_0x44f4('0x73')][_0x44f4('0x76')]())+_0x44f4('0x7b')](_0xd9a862);})[_0x44f4('0x2b')](respondWithResult(_0x383dae,null))['catch'](handleError(_0x383dae,null));};exports[_0x44f4('0x7c')]=function(_0x1d444c,_0x166010,_0x4efa51){return db[_0x44f4('0x43')][_0x44f4('0x7d')]({'where':{'id':_0x1d444c[_0x44f4('0x49')]['id']}})['then'](function(_0x2fbf76){if(_0x2fbf76){if(!_0x1d444c[_0x44f4('0x4e')][_0x44f4('0x73')]||!utils[_0x44f4('0x74')](_0x1d444c[_0x44f4('0x4e')][_0x44f4('0x73')])){throw new db[(_0x44f4('0x5c'))][(_0x44f4('0x75'))](_0x44f4('0x7e'));}return _0x2fbf76[_0x44f4('0x7f')+_['capitalize'](_0x1d444c[_0x44f4('0x4e')][_0x44f4('0x73')]['toLowerCase']())+_0x44f4('0x7b')](_0x1d444c[_0x44f4('0x4e')][_0x44f4('0x80')]);}return null;})['then'](handleEntityNotFound(_0x166010,null))[_0x44f4('0x2b')](respondWithStatusCode(_0x166010,null))['catch'](handleError(_0x166010,null));};exports[_0x44f4('0x81')]=function(_0x841142,_0xf9ec2d,_0x1cb476){return db[_0x44f4('0x43')][_0x44f4('0x7d')]({'where':{'id':_0x841142[_0x44f4('0x49')]['id']}})['then'](function(_0xbc32dc){if(_0xbc32dc){if(!_0x841142[_0x44f4('0x35')][_0x44f4('0x73')]||!utils[_0x44f4('0x74')](_0x841142[_0x44f4('0x35')]['channel'])){throw new db['Sequelize'][(_0x44f4('0x75'))](_0x44f4('0x7e'));}return _0xbc32dc['remove'+_[_0x44f4('0x7a')](_0x841142[_0x44f4('0x35')][_0x44f4('0x73')][_0x44f4('0x76')]())+'Queues'](_0x841142[_0x44f4('0x35')][_0x44f4('0x80')]);}return null;})[_0x44f4('0x2b')](handleEntityNotFound(_0xf9ec2d,null))['then'](respondWithStatusCode(_0xf9ec2d,null))[_0x44f4('0x47')](handleError(_0xf9ec2d,null));};exports[_0x44f4('0x82')]=function(_0x2bd571,_0x3b50a5){var _0x2ea13a=_['isArray'](_0x2bd571[_0x44f4('0x4e')][_0x44f4('0x80')])?_0x2bd571[_0x44f4('0x4e')][_0x44f4('0x80')]:[_0x2bd571[_0x44f4('0x4e')][_0x44f4('0x80')]];var _0x5b0694=_0x2bd571[_0x44f4('0x49')]['id'];return db['Team'][_0x44f4('0x4c')]({'where':{'id':_0x5b0694}})[_0x44f4('0x2b')](handleEntityNotFound(_0x3b50a5,null))[_0x44f4('0x2b')](function(_0x4da55f){if(_0x4da55f){var _0x108afd=[_0x44f4('0x83'),'Chat',_0x44f4('0x84'),_0x44f4('0x85'),_0x44f4('0x86'),_0x44f4('0x87'),_0x44f4('0x88')];return db[_0x44f4('0x59')][_0x44f4('0x5a')](function(_0x42b4c6){var _0xa23626=_['map'](_0x108afd,function(_0x36b256){var _0x2164ed={'attributes':['id',_0x44f4('0x2d')]};if(_0x36b256===_0x44f4('0x83')){_0x2164ed[_0x44f4('0x89')]={'attributes':[_0x44f4('0x8a')]};}return _0x4da55f[_0x44f4('0x52')+_0x36b256+_0x44f4('0x7b')](_0x2164ed)[_0x44f4('0x2b')](function(_0x249922){var _0x3dddc0=_[_0x44f4('0x34')](_0x249922,function(_0x11d0ae){var _0x30d1bb=_[_0x44f4('0x34')](_0x2ea13a,function(_0x56ba35){var _0x3175ac={'where':{'UserId':_0x56ba35,[_0x36b256+_0x44f4('0x8b')]:_0x11d0ae['id']},'transaction':_0x42b4c6};if(_0x36b256==='Voice'){_0x3175ac[_0x44f4('0x1d')]={'penalty':_0x11d0ae[_0x44f4('0x8c')][_0x44f4('0x8a')]};}return db[_0x44f4('0x8d')+_0x36b256+_0x44f4('0x77')][_0x44f4('0x8e')](_0x3175ac)[_0x44f4('0x2b')](function(){socket[_0x44f4('0x8f')](_0x44f4('0x4f')+_0x36b256+'Queue:save',{'UserId':_0x56ba35,[_0x36b256+_0x44f4('0x8b')]:_0x11d0ae['id']});if(_0x36b256!==_0x44f4('0x83')){return;}return db[_0x44f4('0x8d')][_0x44f4('0x45')]({'where':{'id':_0x2ea13a,'online':0x1},'attributes':['id',_0x44f4('0x2d'),_0x44f4('0x90'),_0x44f4('0x91'),'interface'],'raw':!![]})[_0x44f4('0x2b')](function(_0x1ffc2c){var _0x285eae=_[_0x44f4('0x34')](_0x1ffc2c,function(_0x450ff0){return db['UserVoiceQueueRt']['upsert']({'membername':_0x450ff0[_0x44f4('0x2d')],'UserId':_0x450ff0['id'],'queue_name':_0x11d0ae[_0x44f4('0x2d')],'VoiceQueueId':_0x11d0ae['id'],'interface':_['isNil'](_0x450ff0[_0x44f4('0x92')])?util[_0x44f4('0x93')]('SIP/%s',_0x450ff0[_0x44f4('0x2d')]):_0x450ff0['interface'],'paused':_0x450ff0[_0x44f4('0x91')]||![],'penalty':_0x11d0ae['TeamVoiceQueue'][_0x44f4('0x8a')]},{'transaction':_0x42b4c6});});return Promise[_0x44f4('0x94')](_0x285eae);});});});return Promise['all'](_0x30d1bb);});return Promise['all'](_0x3dddc0);})[_0x44f4('0x2b')](function(){return db[_0x44f4('0x6f')][_0x44f4('0x7d')]({'where':{'teamId':_0x5b0694}})['then'](function(_0x1bb310){if(_0x1bb310){var _0x28b98e=_[_0x44f4('0x34')](_0x2ea13a,function(_0x3b1979){db[_0x44f4('0x70')][_0x44f4('0x95')]({'UserId':_0x3b1979,'VoicePrefixId':_0x1bb310['VoicePrefixId']});});return Promise[_0x44f4('0x94')](_0x28b98e);}});});});return Promise['all'](_0xa23626)[_0x44f4('0x2b')](function(){return _0x4da55f[_0x44f4('0x82')](_0x2ea13a,{'transaction':_0x42b4c6})['spread'](function(_0x2cbaeb){return _0x2cbaeb;});});});}})[_0x44f4('0x2b')](respondWithResult(_0x3b50a5,null))[_0x44f4('0x47')](handleError(_0x3b50a5,null));};exports['removeAgents']=function(_0x6c563a,_0x5ccb0b){var _0x315f87=_[_0x44f4('0x96')](_0x6c563a[_0x44f4('0x35')][_0x44f4('0x80')])?_0x6c563a[_0x44f4('0x35')][_0x44f4('0x80')]:[_0x6c563a[_0x44f4('0x35')][_0x44f4('0x80')]];var _0x2d2468=_0x6c563a[_0x44f4('0x49')]['id'];return db[_0x44f4('0x43')][_0x44f4('0x4c')]({'where':{'id':_0x2d2468}})[_0x44f4('0x2b')](handleEntityNotFound(_0x5ccb0b,null))['then'](function(_0x134376){if(_0x134376){var _0x4827b9=[_0x44f4('0x83'),_0x44f4('0x97'),_0x44f4('0x84'),'Sms',_0x44f4('0x86'),_0x44f4('0x87'),_0x44f4('0x88')];return db[_0x44f4('0x59')][_0x44f4('0x5a')](function(_0x571665){var _0x519ec1=_[_0x44f4('0x34')](_0x4827b9,function(_0x52e027){var _0x1d6fd4={'attributes':['id','name']};return _0x134376['get'+_0x52e027+_0x44f4('0x7b')](_0x1d6fd4)[_0x44f4('0x2b')](function(_0x376cfe){var _0x5a25d8=_['map'](_0x376cfe,function(_0x1ce9b1){return _0x1ce9b1['removeAgents'](_0x315f87,{'transaction':_0x571665})['then'](function(){var _0x4a7e9f=_[_0x44f4('0x34')](_0x315f87,function(_0x42b8c2){socket['emit']('user'+_0x52e027+'Queue:remove',{'UserId':Number(_0x42b8c2),[_0x52e027+'QueueId']:_0x1ce9b1['id']});if(_0x52e027!==_0x44f4('0x83')){return;}return db['UserVoiceQueueRt'][_0x44f4('0x58')]({'where':{'VoiceQueueId':_0x1ce9b1['id'],'UserId':_0x42b8c2},'transaction':_0x571665});});return Promise[_0x44f4('0x94')](_0x4a7e9f);});});return Promise[_0x44f4('0x94')](_0x5a25d8);});});return Promise[_0x44f4('0x94')](_0x519ec1)[_0x44f4('0x2b')](function(){return _0x134376[_0x44f4('0x98')](_0x315f87,{'transaction':_0x571665});})['then'](function(){return db[_0x44f4('0x6f')][_0x44f4('0x7d')]({'where':{'teamId':_0x2d2468}})[_0x44f4('0x2b')](function(_0x1e2507){if(_0x1e2507){var _0x348b3c=_[_0x44f4('0x34')](_0x315f87,function(_0x40267e){db[_0x44f4('0x70')][_0x44f4('0x58')]({'where':{'UserId':_0x40267e,'VoicePrefixId':_0x1e2507['VoicePrefixId']}});});return Promise[_0x44f4('0x94')](_0x348b3c);}});});});}})[_0x44f4('0x2b')](respondWithStatusCode(_0x5ccb0b,null))[_0x44f4('0x47')](handleError(_0x5ccb0b,null));};exports[_0x44f4('0x99')]=function(_0x254d6b,_0x3ec956,_0x3e19c8){var _0x28781e={};var _0x23777f={};var _0x2638c3;var _0x20cfce;return db[_0x44f4('0x43')][_0x44f4('0x7d')]({'where':{'id':_0x254d6b['params']['id']}})[_0x44f4('0x2b')](handleEntityNotFound(_0x3ec956,null))[_0x44f4('0x2b')](function(_0x50a2e1){if(_0x50a2e1){_0x2638c3=_0x50a2e1;_0x23777f[_0x44f4('0x33')]=_['keys'](db[_0x44f4('0x8d')][_0x44f4('0x30')]);_0x23777f[_0x44f4('0x35')]=_[_0x44f4('0x36')](_0x254d6b[_0x44f4('0x35')]);_0x23777f[_0x44f4('0x3f')]=_['intersection'](_0x23777f['model'],_0x23777f[_0x44f4('0x35')]);_0x28781e[_0x44f4('0x39')]=_[_0x44f4('0x37')](_0x23777f['model'],qs[_0x44f4('0x38')](_0x254d6b[_0x44f4('0x35')][_0x44f4('0x38')]));_0x28781e[_0x44f4('0x39')]=_0x28781e[_0x44f4('0x39')][_0x44f4('0x4a')]?_0x28781e['attributes']:_0x23777f['model'];_0x28781e[_0x44f4('0x78')]=qs[_0x44f4('0x3d')](_0x254d6b[_0x44f4('0x35')]['sort']);_0x28781e[_0x44f4('0x3e')]=qs[_0x44f4('0x3f')](_[_0x44f4('0x79')](_0x254d6b[_0x44f4('0x35')],_0x23777f[_0x44f4('0x3f')]));if(_0x254d6b[_0x44f4('0x35')][_0x44f4('0x40')]){_0x28781e[_0x44f4('0x3e')]=_[_0x44f4('0x41')](_0x28781e[_0x44f4('0x3e')],{'$or':_[_0x44f4('0x34')](_0x28781e[_0x44f4('0x39')],function(_0x31a945){var _0x4e67d1={};_0x4e67d1[_0x31a945]={'$like':'%'+_0x254d6b[_0x44f4('0x35')]['filter']+'%'};return _0x4e67d1;})});}_0x28781e=_[_0x44f4('0x41')]({},_0x28781e,_0x254d6b[_0x44f4('0x42')]);return _0x2638c3[_0x44f4('0x99')](_0x28781e);}})[_0x44f4('0x2b')](function(_0x4e8ac3){if(_0x4e8ac3){_0x20cfce=_0x4e8ac3[_0x44f4('0x4a')];if(!_0x254d6b[_0x44f4('0x35')]['hasOwnProperty'](_0x44f4('0x3b'))){_0x28781e[_0x44f4('0x24')]=qs[_0x44f4('0x24')](_0x254d6b[_0x44f4('0x35')][_0x44f4('0x24')]);_0x28781e[_0x44f4('0x3c')]=qs['offset'](_0x254d6b[_0x44f4('0x35')][_0x44f4('0x3c')]);}return _0x2638c3['getAgents'](_0x28781e);}})[_0x44f4('0x2b')](function(_0x1abd69){if(_0x1abd69){return _0x1abd69?{'count':_0x20cfce,'rows':_0x1abd69}:null;}})[_0x44f4('0x2b')](respondWithResult(_0x3ec956,null))[_0x44f4('0x47')](handleError(_0x3ec956,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 6f20771..77d59b5 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 _0x9c77=['Team','setMaxListeners','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x1f4559,_0xac6e5){var _0x212d70=function(_0x2016c7){while(--_0x2016c7){_0x1f4559['push'](_0x1f4559['shift']());}};_0x212d70(++_0xac6e5);}(_0x9c77,0x9e));var _0x79c7=function(_0x5a934b,_0x43ad62){_0x5a934b=_0x5a934b-0x0;var _0x2f5087=_0x9c77[_0x5a934b];return _0x2f5087;};'use strict';var EventEmitter=require(_0x79c7('0x0'));var Team=require(_0x79c7('0x1'))['db'][_0x79c7('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x79c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x79c7('0x4')};function emitEvent(_0x145439){return function(_0x2e4ea0,_0x481d46,_0x46f2ac){TeamEvents[_0x79c7('0x5')](_0x145439+':'+_0x2e4ea0['id'],_0x2e4ea0);TeamEvents[_0x79c7('0x5')](_0x145439,_0x2e4ea0);_0x46f2ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x79c7('0x6')](e,emitEvent(event));}}module[_0x79c7('0x7')]=TeamEvents; \ No newline at end of file +var _0x4b51=['save','remove','emit','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x2cdab6,_0x4e1faf){var _0x3b250e=function(_0x4236ac){while(--_0x4236ac){_0x2cdab6['push'](_0x2cdab6['shift']());}};_0x3b250e(++_0x4e1faf);}(_0x4b51,0x83));var _0x14b5=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x4b51[_0x318840];return _0x223da4;};'use strict';var EventEmitter=require(_0x14b5('0x0'));var Team=require(_0x14b5('0x1'))['db'][_0x14b5('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x14b5('0x3')](0x0);var events={'afterCreate':_0x14b5('0x4'),'afterUpdate':'update','afterDestroy':_0x14b5('0x5')};function emitEvent(_0x43eaae){return function(_0x321b67,_0x290a3e,_0x2d4b0c){TeamEvents['emit'](_0x43eaae+':'+_0x321b67['id'],_0x321b67);TeamEvents[_0x14b5('0x6')](_0x43eaae,_0x321b67);_0x2d4b0c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x14b5('0x7')](e,emitEvent(event));}}module[_0x14b5('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index ca62fe3..6734098 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 _0x4b80=['Mail','Openchannel','Voice','resolve','then','all','lodash','./team.attributes','get','setDataValue','channel','catch','define','Team','teams','Fax'];(function(_0x4c8f05,_0x24a91e){var _0x8a673d=function(_0x175b51){while(--_0x175b51){_0x4c8f05['push'](_0x4c8f05['shift']());}};_0x8a673d(++_0x24a91e);}(_0x4b80,0x1a6));var _0x04b8=function(_0x51c362,_0x1c8bb2){_0x51c362=_0x51c362-0x0;var _0x5cd6fb=_0x4b80[_0x51c362];return _0x5cd6fb;};'use strict';var _=require(_0x04b8('0x0'));var attributes=require(_0x04b8('0x1'));function getQueuesByChannel(_0x1ac4b3,_0x45ec4d){var _0x5e1051=_0x04b8('0x2')+_0x45ec4d+'Queues';return _0x1ac4b3[_0x5e1051]()['then'](function(_0x632e03){return _['map'](_0x632e03,function(_0x3ebbc4){_0x3ebbc4[_0x04b8('0x3')](_0x04b8('0x4'),_0x45ec4d);return _0x3ebbc4;});})[_0x04b8('0x5')](function(_0x79a9a2){throw _0x79a9a2;});}module['exports']=function(_0x3841b7){return _0x3841b7[_0x04b8('0x6')](_0x04b8('0x7'),attributes,{'tableName':_0x04b8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x379272=this;var _0x5d1530=['Chat',_0x04b8('0x9'),_0x04b8('0xa'),_0x04b8('0xb'),'Sms',_0x04b8('0xc'),'Whatsapp'];return Promise[_0x04b8('0xd')]()[_0x04b8('0xe')](function(){var _0x28c4c0=_['map'](_0x5d1530,function(_0x56dd90){return getQueuesByChannel(_0x379272,_0x56dd90);});return Promise[_0x04b8('0xf')](_0x28c4c0);})['catch'](function(_0x35c874){throw _0x35c874;});}}});}; \ No newline at end of file +var _0xbfa1=['Team','teams','Chat','Fax','Mail','Sms','Voice','Whatsapp','lodash','./team.attributes','get','Queues','map','setDataValue','channel','exports','define'];(function(_0x26aee4,_0x530ead){var _0x2e1048=function(_0x2e92db){while(--_0x2e92db){_0x26aee4['push'](_0x26aee4['shift']());}};_0x2e1048(++_0x530ead);}(_0xbfa1,0x1a0));var _0x1bfa=function(_0x6186fc,_0x5bf7ec){_0x6186fc=_0x6186fc-0x0;var _0x3a6753=_0xbfa1[_0x6186fc];return _0x3a6753;};'use strict';var _=require(_0x1bfa('0x0'));var attributes=require(_0x1bfa('0x1'));function getQueuesByChannel(_0x4db712,_0x365249){var _0x2269ae=_0x1bfa('0x2')+_0x365249+_0x1bfa('0x3');return _0x4db712[_0x2269ae]()['then'](function(_0x373b8f){return _[_0x1bfa('0x4')](_0x373b8f,function(_0x5312c3){_0x5312c3[_0x1bfa('0x5')](_0x1bfa('0x6'),_0x365249);return _0x5312c3;});})['catch'](function(_0x62ae6){throw _0x62ae6;});}module[_0x1bfa('0x7')]=function(_0x452dcb){return _0x452dcb[_0x1bfa('0x8')](_0x1bfa('0x9'),attributes,{'tableName':_0x1bfa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x373559=this;var _0x1e7aa4=[_0x1bfa('0xb'),_0x1bfa('0xc'),_0x1bfa('0xd'),'Openchannel',_0x1bfa('0xe'),_0x1bfa('0xf'),_0x1bfa('0x10')];return Promise['resolve']()['then'](function(){var _0x4c1365=_[_0x1bfa('0x4')](_0x1e7aa4,function(_0xf34b62){return getQueuesByChannel(_0x373559,_0xf34b62);});return Promise['all'](_0x4c1365);})['catch'](function(_0x4ce096){throw _0x4ce096;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 981c904..f5f9fca 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 _0x9bcc=['Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','./team.socket','register','then','info','Team,\x20%s,\x20%s','debug'];(function(_0x55627b,_0x47be96){var _0x526d26=function(_0x27f008){while(--_0x27f008){_0x55627b['push'](_0x55627b['shift']());}};_0x526d26(++_0x47be96);}(_0x9bcc,0x1b7));var _0xc9bc=function(_0x47fafa,_0x1b0fbf){_0x47fafa=_0x47fafa-0x0;var _0x838958=_0x9bcc[_0x47fafa];return _0x838958;};'use strict';var _=require(_0xc9bc('0x0'));var util=require(_0xc9bc('0x1'));var moment=require(_0xc9bc('0x2'));var BPromise=require(_0xc9bc('0x3'));var rs=require(_0xc9bc('0x4'));var fs=require('fs');var Redis=require(_0xc9bc('0x5'));var db=require(_0xc9bc('0x6'))['db'];var utils=require(_0xc9bc('0x7'));var logger=require(_0xc9bc('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc9bc('0x9'));var client=jayson[_0xc9bc('0xa')][_0xc9bc('0xb')]({'port':0x232a});config[_0xc9bc('0xc')]=_[_0xc9bc('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc9bc('0xc')]));require(_0xc9bc('0xe'))[_0xc9bc('0xf')](socket);function respondWithRpcPromise(_0x2337d9,_0x22aa2c,_0x521b7b){return new BPromise(function(_0x379d46,_0x4b4088){return client['request'](_0x2337d9,_0x521b7b)[_0xc9bc('0x10')](function(_0x1830b4){logger[_0xc9bc('0x11')](_0xc9bc('0x12'),_0x22aa2c,'request\x20sent');logger[_0xc9bc('0x13')](_0xc9bc('0x14'),_0x22aa2c,_0xc9bc('0x15'),JSON[_0xc9bc('0x16')](_0x1830b4));if(_0x1830b4[_0xc9bc('0x17')]){if(_0x1830b4[_0xc9bc('0x17')][_0xc9bc('0x18')]===0x1f4){logger[_0xc9bc('0x17')](_0xc9bc('0x12'),_0x22aa2c,_0x1830b4[_0xc9bc('0x17')][_0xc9bc('0x19')]);return _0x4b4088(_0x1830b4['error'][_0xc9bc('0x19')]);}logger[_0xc9bc('0x17')](_0xc9bc('0x12'),_0x22aa2c,_0x1830b4[_0xc9bc('0x17')][_0xc9bc('0x19')]);return _0x379d46(_0x1830b4[_0xc9bc('0x17')]['message']);}else{logger['info'](_0xc9bc('0x12'),_0x22aa2c,'request\x20sent');_0x379d46(_0x1830b4[_0xc9bc('0x1a')]['message']);}})['catch'](function(_0x51013e){logger[_0xc9bc('0x17')](_0xc9bc('0x12'),_0x22aa2c,_0x51013e);_0x4b4088(_0x51013e);});});} \ No newline at end of file +var _0x256e=['../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./team.socket','register','then','info','request\x20sent','debug','stringify','error','Team,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5ec15a,_0x598159){var _0x1d73d7=function(_0x20c67c){while(--_0x20c67c){_0x5ec15a['push'](_0x5ec15a['shift']());}};_0x1d73d7(++_0x598159);}(_0x256e,0xd0));var _0xe256=function(_0x19ea9e,_0x17f99c){_0x19ea9e=_0x19ea9e-0x0;var _0x137540=_0x256e[_0x19ea9e];return _0x137540;};'use strict';var _=require(_0xe256('0x0'));var util=require('util');var moment=require(_0xe256('0x1'));var BPromise=require(_0xe256('0x2'));var rs=require(_0xe256('0x3'));var fs=require('fs');var Redis=require(_0xe256('0x4'));var db=require(_0xe256('0x5'))['db'];var utils=require(_0xe256('0x6'));var logger=require(_0xe256('0x7'))('rpc');var config=require(_0xe256('0x8'));var jayson=require(_0xe256('0x9'));var client=jayson[_0xe256('0xa')][_0xe256('0xb')]({'port':0x232a});config['redis']=_[_0xe256('0xc')](config[_0xe256('0xd')],{'host':_0xe256('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe256('0xd')]));require(_0xe256('0xf'))[_0xe256('0x10')](socket);function respondWithRpcPromise(_0x2c69b8,_0x527a89,_0x21ad38){return new BPromise(function(_0x5579a4,_0x517814){return client['request'](_0x2c69b8,_0x21ad38)[_0xe256('0x11')](function(_0x5edfd6){logger[_0xe256('0x12')]('Team,\x20%s,\x20%s',_0x527a89,_0xe256('0x13'));logger[_0xe256('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x527a89,_0xe256('0x13'),JSON[_0xe256('0x15')](_0x5edfd6));if(_0x5edfd6['error']){if(_0x5edfd6['error']['code']===0x1f4){logger[_0xe256('0x16')](_0xe256('0x17'),_0x527a89,_0x5edfd6['error'][_0xe256('0x18')]);return _0x517814(_0x5edfd6[_0xe256('0x16')][_0xe256('0x18')]);}logger[_0xe256('0x16')](_0xe256('0x17'),_0x527a89,_0x5edfd6[_0xe256('0x16')][_0xe256('0x18')]);return _0x5579a4(_0x5edfd6[_0xe256('0x16')]['message']);}else{logger['info'](_0xe256('0x17'),_0x527a89,_0xe256('0x13'));_0x5579a4(_0x5edfd6[_0xe256('0x19')][_0xe256('0x18')]);}})[_0xe256('0x1a')](function(_0x40b7fc){logger[_0xe256('0x16')](_0xe256('0x17'),_0x527a89,_0x40b7fc);_0x517814(_0x40b7fc);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 413490e..76062b8 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 _0xa49e=['emit','removeListener','register','length','team:','./team.events','remove'];(function(_0x4225aa,_0x582bf2){var _0x3f8fab=function(_0x498647){while(--_0x498647){_0x4225aa['push'](_0x4225aa['shift']());}};_0x3f8fab(++_0x582bf2);}(_0xa49e,0x147));var _0xea49=function(_0xb247e3,_0x1319d1){_0xb247e3=_0xb247e3-0x0;var _0x57fb7b=_0xa49e[_0xb247e3];return _0x57fb7b;};'use strict';var TeamEvents=require(_0xea49('0x0'));var events=['save',_0xea49('0x1'),'update'];function createListener(_0x2b81d7,_0x313853){return function(_0x142f60){_0x313853[_0xea49('0x2')](_0x2b81d7,_0x142f60);};}function removeListener(_0x14e587,_0xf22802){return function(){TeamEvents[_0xea49('0x3')](_0x14e587,_0xf22802);};}exports[_0xea49('0x4')]=function(_0x2a08cb){for(var _0x2e4f31=0x0,_0x3ba938=events[_0xea49('0x5')];_0x2e4f31<_0x3ba938;_0x2e4f31++){var _0x4bec0c=events[_0x2e4f31];var _0x15d8e1=createListener(_0xea49('0x6')+_0x4bec0c,_0x2a08cb);TeamEvents['on'](_0x4bec0c,_0x15d8e1);}}; \ No newline at end of file +var _0x135b=['length','./team.events','save','remove','update','removeListener'];(function(_0x57118a,_0x3b7a5a){var _0x5abf56=function(_0x44bb17){while(--_0x44bb17){_0x57118a['push'](_0x57118a['shift']());}};_0x5abf56(++_0x3b7a5a);}(_0x135b,0xaf));var _0xb135=function(_0x3ba537,_0x56b969){_0x3ba537=_0x3ba537-0x0;var _0x585c1a=_0x135b[_0x3ba537];return _0x585c1a;};'use strict';var TeamEvents=require(_0xb135('0x0'));var events=[_0xb135('0x1'),_0xb135('0x2'),_0xb135('0x3')];function createListener(_0x5c1413,_0x41767e){return function(_0x211ffb){_0x41767e['emit'](_0x5c1413,_0x211ffb);};}function removeListener(_0x3b6c51,_0x4dffca){return function(){TeamEvents[_0xb135('0x4')](_0x3b6c51,_0x4dffca);};}exports['register']=function(_0x51a09c){for(var _0x5b96fe=0x0,_0x11780d=events[_0xb135('0x5')];_0x5b96fe<_0x11780d;_0x5b96fe++){var _0x2b57dd=events[_0x5b96fe];var _0xdc547c=createListener('team:'+_0x2b57dd,_0x51a09c);TeamEvents['on'](_0x2b57dd,_0xdc547c);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 66dde8f..c4e1d44 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 _0x75f0=['INTEGER','sequelize','exports'];(function(_0x363fb7,_0x4e6aa2){var _0x1e88dc=function(_0x1dec46){while(--_0x1dec46){_0x363fb7['push'](_0x363fb7['shift']());}};_0x1e88dc(++_0x4e6aa2);}(_0x75f0,0x196));var _0x075f=function(_0xfab3e1,_0x2d9028){_0xfab3e1=_0xfab3e1-0x0;var _0x5afd4d=_0x75f0[_0xfab3e1];return _0x5afd4d;};'use strict';var Sequelize=require(_0x075f('0x0'));module[_0x075f('0x1')]={'TeamId':{'type':Sequelize[_0x075f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x075f('0x2')]}}; \ No newline at end of file +var _0xb404=['INTEGER','sequelize'];(function(_0x35c1f5,_0x2f92fb){var _0x2995b4=function(_0x2e1da7){while(--_0x2e1da7){_0x35c1f5['push'](_0x35c1f5['shift']());}};_0x2995b4(++_0x2f92fb);}(_0xb404,0x123));var _0x4b40=function(_0x1598d4,_0x209b2d){_0x1598d4=_0x1598d4-0x0;var _0x57c770=_0xb404[_0x1598d4];return _0x57c770;};'use strict';var Sequelize=require(_0x4b40('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x4b40('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x4b40('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 965a685..feaad15 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 _0xe0c0=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x4eb68b,_0x4c933f){var _0x1610d1=function(_0x4f293e){while(--_0x4f293e){_0x4eb68b['push'](_0x4eb68b['shift']());}};_0x1610d1(++_0x4c933f);}(_0xe0c0,0xa7));var _0x0e0c=function(_0xffd870,_0x3c556f){_0xffd870=_0xffd870-0x0;var _0x4b8e31=_0xe0c0[_0xffd870];return _0x4b8e31;};'use strict';var _=require(_0x0e0c('0x0'));var util=require('util');var logger=require(_0x0e0c('0x1'))(_0x0e0c('0x2'));var moment=require(_0x0e0c('0x3'));var BPromise=require(_0x0e0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e0c('0x5'));var rimraf=require(_0x0e0c('0x6'));var config=require(_0x0e0c('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0x0e0c('0x8')]=function(_0x2856d7,_0x4a094c){return _0x2856d7[_0x0e0c('0x9')](_0x0e0c('0xa'),attributes,{'tableName':_0x0e0c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb9c=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xcb9c,0x110));var _0xccb9=function(_0x3b0ac0,_0x1eb671){_0x3b0ac0=_0x3b0ac0-0x0;var _0x30cc4d=_0xcb9c[_0x3b0ac0];return _0x30cc4d;};'use strict';var _=require(_0xccb9('0x0'));var util=require(_0xccb9('0x1'));var logger=require(_0xccb9('0x2'))(_0xccb9('0x3'));var moment=require(_0xccb9('0x4'));var BPromise=require(_0xccb9('0x5'));var rp=require(_0xccb9('0x6'));var fs=require('fs');var path=require(_0xccb9('0x7'));var rimraf=require('rimraf');var config=require(_0xccb9('0x8'));var attributes=require(_0xccb9('0x9'));module[_0xccb9('0xa')]=function(_0x5bb0e5,_0x34a3da){return _0x5bb0e5[_0xccb9('0xb')](_0xccb9('0xc'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 8d21df9..2de4ab4 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x51256c,_0x5ad225){var _0x2e0574=function(_0x322df8){while(--_0x322df8){_0x51256c['push'](_0x51256c['shift']());}};_0x2e0574(++_0x5ad225);}(_0xe706,0xa3));var _0x6e70=function(_0x1e6ca5,_0xfb9d62){_0x1e6ca5=_0x1e6ca5-0x0;var _0xf1e27=_0xe706[_0x1e6ca5];return _0xf1e27;};'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(_0x3a76f0,_0x3060e9){var _0x9e5222=function(_0x31c154){while(--_0x31c154){_0x3a76f0['push'](_0x3a76f0['shift']());}};_0x9e5222(++_0x3060e9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index be11a91..46893a9 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 _0x5f4e=['sequelize','INTEGER'];(function(_0x12e075,_0x2f6b9c){var _0xacd6dd=function(_0x1135c2){while(--_0x1135c2){_0x12e075['push'](_0x12e075['shift']());}};_0xacd6dd(++_0x2f6b9c);}(_0x5f4e,0x1d8));var _0xe5f4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f4e[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xe5f4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe5f4('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd68d=['exports','sequelize'];(function(_0x29861c,_0x408d8d){var _0xdc50dc=function(_0x63ed50){while(--_0x63ed50){_0x29861c['push'](_0x29861c['shift']());}};_0xdc50dc(++_0x408d8d);}(_0xd68d,0x7f));var _0xdd68=function(_0x110801,_0x49c972){_0x110801=_0x110801-0x0;var _0x37d3db=_0xd68d[_0x110801];return _0x37d3db;};'use strict';var Sequelize=require(_0xdd68('0x0'));module[_0xdd68('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 9db6351..44680b7 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 _0xfc65=['rimraf','exports','define','TeamVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x465b87,_0x504537){var _0x4a43b5=function(_0x38500c){while(--_0x38500c){_0x465b87['push'](_0x465b87['shift']());}};_0x4a43b5(++_0x504537);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x5f5a3d,_0x1fe698){_0x5f5a3d=_0x5f5a3d-0x0;var _0x2bd5a1=_0xfc65[_0x5f5a3d];return _0x2bd5a1;};'use strict';var _=require(_0x5fc6('0x0'));var util=require(_0x5fc6('0x1'));var logger=require(_0x5fc6('0x2'))(_0x5fc6('0x3'));var moment=require(_0x5fc6('0x4'));var BPromise=require(_0x5fc6('0x5'));var rp=require(_0x5fc6('0x6'));var fs=require('fs');var path=require(_0x5fc6('0x7'));var rimraf=require(_0x5fc6('0x8'));var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0x5fc6('0x9')]=function(_0x2e1c2b,_0x3e9bf3){return _0x2e1c2b[_0x5fc6('0xa')](_0x5fc6('0xb'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36f1=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment','bluebird'];(function(_0x17f153,_0x5491fc){var _0x430136=function(_0x2700f2){while(--_0x2700f2){_0x17f153['push'](_0x17f153['shift']());}};_0x430136(++_0x5491fc);}(_0x36f1,0xb0));var _0x136f=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x36f1[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x136f('0x0'));var util=require('util');var logger=require(_0x136f('0x1'))('api');var moment=require(_0x136f('0x2'));var BPromise=require(_0x136f('0x3'));var rp=require(_0x136f('0x4'));var fs=require('fs');var path=require(_0x136f('0x5'));var rimraf=require(_0x136f('0x6'));var config=require(_0x136f('0x7'));var attributes=require(_0x136f('0x8'));module[_0x136f('0x9')]=function(_0x5b00b5,_0x430433){return _0x5b00b5['define'](_0x136f('0xa'),attributes,{'tableName':_0x136f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 85698ae..d2df2cf 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 _0xf9a6=['randomstring','../../mysqldb','../../config/utils','rpc','client','http','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x42b19d,_0x5ec500){var _0x27cc9b=function(_0x4b20bf){while(--_0x4b20bf){_0x42b19d['push'](_0x42b19d['shift']());}};_0x27cc9b(++_0x5ec500);}(_0xf9a6,0xd8));var _0x6f9a=function(_0x1a424b,_0x3d344d){_0x1a424b=_0x1a424b-0x0;var _0x775933=_0xf9a6[_0x1a424b];return _0x775933;};'use strict';var _=require(_0x6f9a('0x0'));var util=require(_0x6f9a('0x1'));var moment=require(_0x6f9a('0x2'));var BPromise=require(_0x6f9a('0x3'));var rs=require(_0x6f9a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f9a('0x5'))['db'];var utils=require(_0x6f9a('0x6'));var logger=require('../../config/logger')(_0x6f9a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6f9a('0x8')][_0x6f9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x407b35,_0x2c724e,_0x512674){return new BPromise(function(_0x3ef7b1,_0x2fe152){return client['request'](_0x407b35,_0x512674)['then'](function(_0x4d23f8){logger[_0x6f9a('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2c724e,_0x6f9a('0xb'));logger[_0x6f9a('0xc')](_0x6f9a('0xd'),_0x2c724e,_0x6f9a('0xb'),JSON[_0x6f9a('0xe')](_0x4d23f8));if(_0x4d23f8['error']){if(_0x4d23f8[_0x6f9a('0xf')]['code']===0x1f4){logger[_0x6f9a('0xf')](_0x6f9a('0x10'),_0x2c724e,_0x4d23f8[_0x6f9a('0xf')][_0x6f9a('0x11')]);return _0x2fe152(_0x4d23f8[_0x6f9a('0xf')][_0x6f9a('0x11')]);}logger[_0x6f9a('0xf')](_0x6f9a('0x10'),_0x2c724e,_0x4d23f8[_0x6f9a('0xf')][_0x6f9a('0x11')]);return _0x3ef7b1(_0x4d23f8['error'][_0x6f9a('0x11')]);}else{logger[_0x6f9a('0xa')](_0x6f9a('0x10'),_0x2c724e,_0x6f9a('0xb'));_0x3ef7b1(_0x4d23f8[_0x6f9a('0x12')][_0x6f9a('0x11')]);}})[_0x6f9a('0x13')](function(_0x131df2){logger[_0x6f9a('0xf')](_0x6f9a('0x10'),_0x2c724e,_0x131df2);_0x2fe152(_0x131df2);});});} \ No newline at end of file +var _0x296f=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x291cf3,_0x5be25a){var _0x2987fa=function(_0x189b40){while(--_0x189b40){_0x291cf3['push'](_0x291cf3['shift']());}};_0x2987fa(++_0x5be25a);}(_0x296f,0xf0));var _0xf296=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x296f[_0x46efd7];return _0x5637e4;};'use strict';var _=require(_0xf296('0x0'));var util=require(_0xf296('0x1'));var moment=require(_0xf296('0x2'));var BPromise=require(_0xf296('0x3'));var rs=require(_0xf296('0x4'));var fs=require('fs');var Redis=require(_0xf296('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf296('0x6'))(_0xf296('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf296('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x325b39,_0x5123d3,_0x300f99){return new BPromise(function(_0x3197bc,_0x4b05c5){return client[_0xf296('0x9')](_0x325b39,_0x300f99)['then'](function(_0x1ec8cc){logger[_0xf296('0xa')](_0xf296('0xb'),_0x5123d3,'request\x20sent');logger[_0xf296('0xc')](_0xf296('0xd'),_0x5123d3,_0xf296('0xe'),JSON['stringify'](_0x1ec8cc));if(_0x1ec8cc[_0xf296('0xf')]){if(_0x1ec8cc[_0xf296('0xf')][_0xf296('0x10')]===0x1f4){logger[_0xf296('0xf')](_0xf296('0xb'),_0x5123d3,_0x1ec8cc['error']['message']);return _0x4b05c5(_0x1ec8cc[_0xf296('0xf')][_0xf296('0x11')]);}logger['error'](_0xf296('0xb'),_0x5123d3,_0x1ec8cc[_0xf296('0xf')]['message']);return _0x3197bc(_0x1ec8cc[_0xf296('0xf')][_0xf296('0x11')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x5123d3,'request\x20sent');_0x3197bc(_0x1ec8cc[_0xf296('0x12')][_0xf296('0x11')]);}})[_0xf296('0x13')](function(_0x3d3225){logger[_0xf296('0xf')](_0xf296('0xb'),_0x5123d3,_0x3d3225);_0x4b05c5(_0x3d3225);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 7883a3c..4793650 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 _0xd509=['post','create','/:id','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','show'];(function(_0x1e85db,_0x432aad){var _0x11066d=function(_0x254d3c){while(--_0x254d3c){_0x1e85db['push'](_0x1e85db['shift']());}};_0x11066d(++_0x432aad);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9d50('0x0'));var timeout=require(_0x9d50('0x1'));var express=require(_0x9d50('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9d50('0x3'));var interaction=require(_0x9d50('0x4'));var config=require('../../config/environment');var controller=require(_0x9d50('0x5'));router[_0x9d50('0x6')]('/',auth[_0x9d50('0x7')](),controller['index']);router[_0x9d50('0x6')]('/:id',auth[_0x9d50('0x7')](),controller[_0x9d50('0x8')]);router[_0x9d50('0x9')]('/',auth[_0x9d50('0x7')](),controller[_0x9d50('0xa')]);router['put'](_0x9d50('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9d50('0xc')]('/:id',auth[_0x9d50('0x7')](),controller[_0x9d50('0xd')]);module[_0x9d50('0xe')]=router; \ No newline at end of file +var _0x0447=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer'];(function(_0x56b288,_0x1ed5ac){var _0x355ae0=function(_0x44b808){while(--_0x44b808){_0x56b288['push'](_0x56b288['shift']());}};_0x355ae0(++_0x1ed5ac);}(_0x0447,0x8b));var _0x7044=function(_0x59f655,_0x1c12aa){_0x59f655=_0x59f655-0x0;var _0x1dbb6e=_0x0447[_0x59f655];return _0x1dbb6e;};'use strict';var multer=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var path=require(_0x7044('0x2'));var timeout=require(_0x7044('0x3'));var express=require(_0x7044('0x4'));var router=express['Router']();var fs_extra=require(_0x7044('0x5'));var auth=require(_0x7044('0x6'));var interaction=require(_0x7044('0x7'));var config=require(_0x7044('0x8'));var controller=require(_0x7044('0x9'));router[_0x7044('0xa')]('/',auth[_0x7044('0xb')](),controller[_0x7044('0xc')]);router[_0x7044('0xa')]('/:id',auth[_0x7044('0xb')](),controller[_0x7044('0xd')]);router[_0x7044('0xe')]('/',auth[_0x7044('0xb')](),controller['create']);router[_0x7044('0xf')](_0x7044('0x10'),auth['isAuthenticated'](),controller[_0x7044('0x11')]);router[_0x7044('0x12')](_0x7044('0x10'),auth[_0x7044('0xb')](),controller['destroy']);module[_0x7044('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index b1dc2ed..03f1c04 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 _0xd6fe=['exports','STRING','sequelize'];(function(_0x17d903,_0x3b0714){var _0x76c440=function(_0xe472f0){while(--_0xe472f0){_0x17d903['push'](_0x17d903['shift']());}};_0x76c440(++_0x3b0714);}(_0xd6fe,0x158));var _0xed6f=function(_0x465f61,_0x2b5e6c){_0x465f61=_0x465f61-0x0;var _0xa721e6=_0xd6fe[_0x465f61];return _0xa721e6;};'use strict';var Sequelize=require(_0xed6f('0x0'));module[_0xed6f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xed6f('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb52f=['STRING','TEXT'];(function(_0x5a04cd,_0x3c2206){var _0xd2d6c8=function(_0x363f2a){while(--_0x363f2a){_0x5a04cd['push'](_0x5a04cd['shift']());}};_0xd2d6c8(++_0x3c2206);}(_0xb52f,0x158));var _0xfb52=function(_0x3de5b7,_0x3d540a){_0x3de5b7=_0x3de5b7-0x0;var _0x2dad16=_0xb52f[_0x3de5b7];return _0x2dad16;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfb52('0x0')]},'description':{'type':Sequelize[_0xfb52('0x0')]},'html':{'type':Sequelize[_0xfb52('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index be0a165..004e047 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 _0x8652=['stack','name','send','map','Template','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','filter','options','include','findAll','params','keys','length','includeAll','find','catch','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','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/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','get','Templates','destroy','error'];(function(_0x37dd5b,_0xf4db75){var _0x14982a=function(_0x31a70){while(--_0x31a70){_0x37dd5b['push'](_0x37dd5b['shift']());}};_0x14982a(++_0xf4db75);}(_0x8652,0x17c));var _0x2865=function(_0x1966f3,_0x210ea3){_0x1966f3=_0x1966f3-0x0;var _0x17575f=_0x8652[_0x1966f3];return _0x17575f;};'use strict';var emlformat=require(_0x2865('0x0'));var rimraf=require(_0x2865('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2865('0x2'));var rp=require(_0x2865('0x3'));var moment=require(_0x2865('0x4'));var BPromise=require(_0x2865('0x5'));var Mustache=require(_0x2865('0x6'));var util=require(_0x2865('0x7'));var path=require(_0x2865('0x8'));var sox=require(_0x2865('0x9'));var csv=require(_0x2865('0xa'));var ejs=require(_0x2865('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2865('0xc'));var squel=require(_0x2865('0xd'));var crypto=require(_0x2865('0xe'));var jsforce=require(_0x2865('0xf'));var deskjs=require(_0x2865('0x10'));var toCsv=require(_0x2865('0xa'));var querystring=require(_0x2865('0x11'));var Papa=require(_0x2865('0x12'));var Redis=require(_0x2865('0x13'));var authService=require(_0x2865('0x14'));var qs=require(_0x2865('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2865('0x16'));var logger=require(_0x2865('0x17'))('api');var utils=require(_0x2865('0x18'));var config=require(_0x2865('0x19'));var licenseUtil=require(_0x2865('0x1a'));var db=require(_0x2865('0x1b'))['db'];function respondWithStatusCode(_0x52d1e9,_0x4420ea){_0x4420ea=_0x4420ea||0xcc;return function(_0x19b017){if(_0x19b017){return _0x52d1e9[_0x2865('0x1c')](_0x4420ea);}return _0x52d1e9[_0x2865('0x1d')](_0x4420ea)[_0x2865('0x1e')]();};}function respondWithResult(_0x3f3978,_0x3ac276){_0x3ac276=_0x3ac276||0xc8;return function(_0x46bc9b){if(_0x46bc9b){return _0x3f3978[_0x2865('0x1d')](_0x3ac276)[_0x2865('0x1f')](_0x46bc9b);}};}function respondWithFilteredResult(_0x2e234d,_0x1215e1){return function(_0x1e8947){if(_0x1e8947){var _0x268295=typeof _0x1215e1[_0x2865('0x20')]===_0x2865('0x21')&&typeof _0x1215e1[_0x2865('0x22')]===_0x2865('0x21');var _0x1ab1c5=_0x1e8947[_0x2865('0x23')];var _0x56f35c=_0x268295?0x0:_0x1215e1[_0x2865('0x20')];var _0x911b43=_0x268295?_0x1e8947[_0x2865('0x23')]:_0x1215e1[_0x2865('0x20')]+_0x1215e1[_0x2865('0x22')];var _0x24c88b;if(_0x911b43>=_0x1ab1c5){_0x911b43=_0x1ab1c5;_0x24c88b=0xc8;}else{_0x24c88b=0xce;}_0x2e234d['status'](_0x24c88b);return _0x2e234d[_0x2865('0x24')]('Content-Range',_0x56f35c+'-'+_0x911b43+'/'+_0x1ab1c5)['json'](_0x1e8947);}return null;};}function patchUpdates(_0x412d43){return function(_0x2acfdf){try{jsonpatch[_0x2865('0x25')](_0x2acfdf,_0x412d43,!![]);}catch(_0x1409b8){return BPromise['reject'](_0x1409b8);}return _0x2acfdf[_0x2865('0x26')]();};}function saveUpdates(_0x1c5b3e,_0x2b9f9b){return function(_0x5aaca8){if(_0x5aaca8){return _0x5aaca8[_0x2865('0x27')](_0x1c5b3e)[_0x2865('0x28')](function(_0x11f187){return _0x11f187;});}return null;};}function removeEntity(_0x4ce155,_0x4685c4){return function(_0x15429d){if(_0x15429d){return _0x15429d['destroy']()['then'](function(){var _0x174375=_0x15429d[_0x2865('0x29')]({'plain':!![]});var _0x24ea3f=_0x2865('0x2a');return db['UserProfileResource'][_0x2865('0x2b')]({'where':{'type':_0x24ea3f,'resourceId':_0x174375['id']}})[_0x2865('0x28')](function(){return _0x15429d;});})['then'](function(){_0x4ce155[_0x2865('0x1d')](0xcc)[_0x2865('0x1e')]();});}};}function handleEntityNotFound(_0xd86987,_0x989eee){return function(_0x5e1019){if(!_0x5e1019){_0xd86987[_0x2865('0x1c')](0x194);}return _0x5e1019;};}function handleError(_0x24c6a8,_0x543d69){_0x543d69=_0x543d69||0x1f4;return function(_0x597d7c){logger[_0x2865('0x2c')](_0x597d7c[_0x2865('0x2d')]);if(_0x597d7c[_0x2865('0x2e')]){delete _0x597d7c[_0x2865('0x2e')];}_0x24c6a8[_0x2865('0x1d')](_0x543d69)[_0x2865('0x2f')](_0x597d7c);};}exports['index']=function(_0x56cb81,_0x101e5c){var _0x39ba7f={},_0x19498e={},_0x4ae336={'count':0x0,'rows':[]};var _0x12f7bd=_[_0x2865('0x30')](db[_0x2865('0x31')][_0x2865('0x32')],function(_0x29dd8c){return{'name':_0x29dd8c[_0x2865('0x33')],'type':_0x29dd8c[_0x2865('0x34')][_0x2865('0x35')]};});_0x19498e[_0x2865('0x36')]=_[_0x2865('0x30')](_0x12f7bd,_0x2865('0x2e'));_0x19498e['query']=_['keys'](_0x56cb81[_0x2865('0x37')]);_0x19498e[_0x2865('0x38')]=_[_0x2865('0x39')](_0x19498e[_0x2865('0x36')],_0x19498e[_0x2865('0x37')]);_0x39ba7f[_0x2865('0x3a')]=_[_0x2865('0x39')](_0x19498e[_0x2865('0x36')],qs[_0x2865('0x3b')](_0x56cb81[_0x2865('0x37')][_0x2865('0x3b')]));_0x39ba7f[_0x2865('0x3a')]=_0x39ba7f['attributes']['length']?_0x39ba7f[_0x2865('0x3a')]:_0x19498e['model'];if(!_0x56cb81[_0x2865('0x37')][_0x2865('0x3c')](_0x2865('0x3d'))){_0x39ba7f['limit']=qs[_0x2865('0x22')](_0x56cb81['query'][_0x2865('0x22')]);_0x39ba7f[_0x2865('0x20')]=qs[_0x2865('0x20')](_0x56cb81[_0x2865('0x37')][_0x2865('0x20')]);}_0x39ba7f['order']=qs[_0x2865('0x3e')](_0x56cb81[_0x2865('0x37')][_0x2865('0x3e')]);_0x39ba7f[_0x2865('0x3f')]=qs[_0x2865('0x38')](_['pick'](_0x56cb81[_0x2865('0x37')],_0x19498e[_0x2865('0x38')]),_0x12f7bd);if(_0x56cb81['query']['filter']){_0x39ba7f[_0x2865('0x3f')]=_[_0x2865('0x40')](_0x39ba7f[_0x2865('0x3f')],{'$or':_[_0x2865('0x30')](_0x12f7bd,function(_0x49cf10){if(_0x49cf10['type']!=='VIRTUAL'){var _0x211ceb={};_0x211ceb[_0x49cf10[_0x2865('0x2e')]]={'$like':'%'+_0x56cb81[_0x2865('0x37')][_0x2865('0x41')]+'%'};return _0x211ceb;}})});}_0x39ba7f=_[_0x2865('0x40')]({},_0x39ba7f,_0x56cb81[_0x2865('0x42')]);var _0x5e9699={'where':_0x39ba7f[_0x2865('0x3f')]};return db[_0x2865('0x31')][_0x2865('0x23')](_0x5e9699)[_0x2865('0x28')](function(_0x2905f8){_0x4ae336[_0x2865('0x23')]=_0x2905f8;if(_0x56cb81[_0x2865('0x37')]['includeAll']){_0x39ba7f[_0x2865('0x43')]=[{'all':!![]}];}return db[_0x2865('0x31')][_0x2865('0x44')](_0x39ba7f);})['then'](function(_0x521657){_0x4ae336['rows']=_0x521657;return _0x4ae336;})[_0x2865('0x28')](respondWithFilteredResult(_0x101e5c,_0x39ba7f))['catch'](handleError(_0x101e5c,null));};exports['show']=function(_0x13fccf,_0x4dd01b){var _0x4f8bcc={'raw':!![],'where':{'id':_0x13fccf[_0x2865('0x45')]['id']}},_0x25d927={};_0x25d927[_0x2865('0x36')]=_[_0x2865('0x46')](db[_0x2865('0x31')][_0x2865('0x32')]);_0x25d927[_0x2865('0x37')]=_[_0x2865('0x46')](_0x13fccf[_0x2865('0x37')]);_0x25d927[_0x2865('0x38')]=_['intersection'](_0x25d927[_0x2865('0x36')],_0x25d927[_0x2865('0x37')]);_0x4f8bcc[_0x2865('0x3a')]=_['intersection'](_0x25d927['model'],qs[_0x2865('0x3b')](_0x13fccf[_0x2865('0x37')]['fields']));_0x4f8bcc[_0x2865('0x3a')]=_0x4f8bcc[_0x2865('0x3a')][_0x2865('0x47')]?_0x4f8bcc[_0x2865('0x3a')]:_0x25d927[_0x2865('0x36')];if(_0x13fccf[_0x2865('0x37')][_0x2865('0x48')]){_0x4f8bcc['include']=[{'all':!![]}];}_0x4f8bcc=_['merge']({},_0x4f8bcc,_0x13fccf[_0x2865('0x42')]);return db[_0x2865('0x31')][_0x2865('0x49')](_0x4f8bcc)[_0x2865('0x28')](handleEntityNotFound(_0x4dd01b,null))[_0x2865('0x28')](respondWithResult(_0x4dd01b,null))[_0x2865('0x4a')](handleError(_0x4dd01b,null));};exports[_0x2865('0x4b')]=function(_0x45ff41,_0x1f8800){return db[_0x2865('0x31')][_0x2865('0x4b')](_0x45ff41[_0x2865('0x4c')],{})[_0x2865('0x28')](function(_0x3c438b){var _0x24204d=_0x45ff41[_0x2865('0x4d')][_0x2865('0x29')]({'plain':!![]});if(!_0x24204d)throw new Error(_0x2865('0x4e'));if(_0x24204d[_0x2865('0x4f')]===_0x2865('0x4d')){var _0x5d6b5e=_0x3c438b['get']({'plain':!![]});var _0x349d14=_0x2865('0x2a');return db[_0x2865('0x50')][_0x2865('0x49')]({'where':{'name':_0x349d14,'userProfileId':_0x24204d[_0x2865('0x51')]},'raw':!![]})[_0x2865('0x28')](function(_0x29f763){if(_0x29f763&&_0x29f763[_0x2865('0x52')]===0x0){return db[_0x2865('0x53')][_0x2865('0x4b')]({'name':_0x5d6b5e['name'],'resourceId':_0x5d6b5e['id'],'type':_0x29f763[_0x2865('0x2e')],'sectionId':_0x29f763['id']},{})['then'](function(){return _0x3c438b;});}else{return _0x3c438b;}})[_0x2865('0x4a')](function(_0x4e56a3){logger[_0x2865('0x2c')](_0x2865('0x54'),_0x4e56a3);throw _0x4e56a3;});}return _0x3c438b;})[_0x2865('0x28')](respondWithResult(_0x1f8800,0xc9))[_0x2865('0x4a')](handleError(_0x1f8800,null));};exports[_0x2865('0x27')]=function(_0x2f77e1,_0x12ed65){if(_0x2f77e1['body']['id']){delete _0x2f77e1['body']['id'];}return db[_0x2865('0x31')]['find']({'where':{'id':_0x2f77e1[_0x2865('0x45')]['id']}})['then'](handleEntityNotFound(_0x12ed65,null))['then'](saveUpdates(_0x2f77e1[_0x2865('0x4c')],null))['then'](respondWithResult(_0x12ed65,null))[_0x2865('0x4a')](handleError(_0x12ed65,null));};exports[_0x2865('0x2b')]=function(_0x5d02bc,_0x505258){return db[_0x2865('0x31')][_0x2865('0x49')]({'where':{'id':_0x5d02bc['params']['id']}})[_0x2865('0x28')](handleEntityNotFound(_0x505258,null))['then'](removeEntity(_0x505258,null))[_0x2865('0x4a')](handleError(_0x505258,null));}; \ No newline at end of file +var _0x214d=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','count','set','json','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','model','query'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x214d,0xbb));var _0xd214=function(_0x4a65cb,_0x35e3ae){_0x4a65cb=_0x4a65cb-0x0;var _0x5185e6=_0x214d[_0x4a65cb];return _0x5185e6;};'use strict';var emlformat=require(_0xd214('0x0'));var rimraf=require(_0xd214('0x1'));var zipdir=require(_0xd214('0x2'));var jsonpatch=require(_0xd214('0x3'));var rp=require('request-promise');var moment=require(_0xd214('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd214('0x5'));var util=require(_0xd214('0x6'));var path=require(_0xd214('0x7'));var sox=require(_0xd214('0x8'));var csv=require(_0xd214('0x9'));var ejs=require(_0xd214('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd214('0x9'));var querystring=require('querystring');var Papa=require(_0xd214('0xb'));var Redis=require(_0xd214('0xc'));var authService=require(_0xd214('0xd'));var qs=require(_0xd214('0xe'));var as=require(_0xd214('0xf'));var hardwareService=require(_0xd214('0x10'));var logger=require(_0xd214('0x11'))(_0xd214('0x12'));var utils=require('../../config/utils');var config=require(_0xd214('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd214('0x14'))['db'];function respondWithStatusCode(_0x367bd1,_0x225f58){_0x225f58=_0x225f58||0xcc;return function(_0xb20eed){if(_0xb20eed){return _0x367bd1[_0xd214('0x15')](_0x225f58);}return _0x367bd1['status'](_0x225f58)[_0xd214('0x16')]();};}function respondWithResult(_0x497cd3,_0x4f354b){_0x4f354b=_0x4f354b||0xc8;return function(_0x51d2cc){if(_0x51d2cc){return _0x497cd3[_0xd214('0x17')](_0x4f354b)['json'](_0x51d2cc);}};}function respondWithFilteredResult(_0x6419be,_0x3b475c){return function(_0x206389){if(_0x206389){var _0x59852f=typeof _0x3b475c['offset']===_0xd214('0x18')&&typeof _0x3b475c['limit']===_0xd214('0x18');var _0x579354=_0x206389['count'];var _0x3ce24c=_0x59852f?0x0:_0x3b475c[_0xd214('0x19')];var _0x146ab1=_0x59852f?_0x206389[_0xd214('0x1a')]:_0x3b475c[_0xd214('0x19')]+_0x3b475c['limit'];var _0x1c7ca7;if(_0x146ab1>=_0x579354){_0x146ab1=_0x579354;_0x1c7ca7=0xc8;}else{_0x1c7ca7=0xce;}_0x6419be[_0xd214('0x17')](_0x1c7ca7);return _0x6419be[_0xd214('0x1b')]('Content-Range',_0x3ce24c+'-'+_0x146ab1+'/'+_0x579354)[_0xd214('0x1c')](_0x206389);}return null;};}function patchUpdates(_0x23046c){return function(_0x5d03be){try{jsonpatch['apply'](_0x5d03be,_0x23046c,!![]);}catch(_0x4bf39d){return BPromise['reject'](_0x4bf39d);}return _0x5d03be[_0xd214('0x1d')]();};}function saveUpdates(_0x2a3c04,_0x177c4c){return function(_0x106e32){if(_0x106e32){return _0x106e32[_0xd214('0x1e')](_0x2a3c04)[_0xd214('0x1f')](function(_0x190118){return _0x190118;});}return null;};}function removeEntity(_0x2f2d06,_0x273827){return function(_0x5bd49b){if(_0x5bd49b){return _0x5bd49b[_0xd214('0x20')]()['then'](function(){var _0x2755ff=_0x5bd49b[_0xd214('0x21')]({'plain':!![]});var _0x621cd9='Templates';return db[_0xd214('0x22')][_0xd214('0x20')]({'where':{'type':_0x621cd9,'resourceId':_0x2755ff['id']}})[_0xd214('0x1f')](function(){return _0x5bd49b;});})['then'](function(){_0x2f2d06[_0xd214('0x17')](0xcc)[_0xd214('0x16')]();});}};}function handleEntityNotFound(_0x270654,_0x127fa3){return function(_0x2dcb1b){if(!_0x2dcb1b){_0x270654[_0xd214('0x15')](0x194);}return _0x2dcb1b;};}function handleError(_0x1322aa,_0xf2a067){_0xf2a067=_0xf2a067||0x1f4;return function(_0xa50f03){logger[_0xd214('0x23')](_0xa50f03[_0xd214('0x24')]);if(_0xa50f03[_0xd214('0x25')]){delete _0xa50f03[_0xd214('0x25')];}_0x1322aa[_0xd214('0x17')](_0xf2a067)[_0xd214('0x26')](_0xa50f03);};}exports[_0xd214('0x27')]=function(_0x1981d8,_0x20da25){var _0x9c9018={},_0x527e40={},_0x3b1520={'count':0x0,'rows':[]};var _0x4be491=_[_0xd214('0x28')](db[_0xd214('0x29')][_0xd214('0x2a')],function(_0x48d3cb){return{'name':_0x48d3cb[_0xd214('0x2b')],'type':_0x48d3cb[_0xd214('0x2c')]['key']};});_0x527e40[_0xd214('0x2d')]=_[_0xd214('0x28')](_0x4be491,_0xd214('0x25'));_0x527e40[_0xd214('0x2e')]=_[_0xd214('0x2f')](_0x1981d8[_0xd214('0x2e')]);_0x527e40[_0xd214('0x30')]=_[_0xd214('0x31')](_0x527e40[_0xd214('0x2d')],_0x527e40[_0xd214('0x2e')]);_0x9c9018['attributes']=_[_0xd214('0x31')](_0x527e40[_0xd214('0x2d')],qs[_0xd214('0x32')](_0x1981d8[_0xd214('0x2e')][_0xd214('0x32')]));_0x9c9018[_0xd214('0x33')]=_0x9c9018[_0xd214('0x33')][_0xd214('0x34')]?_0x9c9018['attributes']:_0x527e40[_0xd214('0x2d')];if(!_0x1981d8[_0xd214('0x2e')][_0xd214('0x35')]('nolimit')){_0x9c9018[_0xd214('0x36')]=qs[_0xd214('0x36')](_0x1981d8[_0xd214('0x2e')][_0xd214('0x36')]);_0x9c9018[_0xd214('0x19')]=qs[_0xd214('0x19')](_0x1981d8[_0xd214('0x2e')][_0xd214('0x19')]);}_0x9c9018[_0xd214('0x37')]=qs[_0xd214('0x38')](_0x1981d8[_0xd214('0x2e')][_0xd214('0x38')]);_0x9c9018[_0xd214('0x39')]=qs[_0xd214('0x30')](_[_0xd214('0x3a')](_0x1981d8[_0xd214('0x2e')],_0x527e40[_0xd214('0x30')]),_0x4be491);if(_0x1981d8[_0xd214('0x2e')][_0xd214('0x3b')]){_0x9c9018[_0xd214('0x39')]=_['merge'](_0x9c9018[_0xd214('0x39')],{'$or':_[_0xd214('0x28')](_0x4be491,function(_0x55cdd5){if(_0x55cdd5[_0xd214('0x2c')]!==_0xd214('0x3c')){var _0x29a2ae={};_0x29a2ae[_0x55cdd5['name']]={'$like':'%'+_0x1981d8['query'][_0xd214('0x3b')]+'%'};return _0x29a2ae;}})});}_0x9c9018=_[_0xd214('0x3d')]({},_0x9c9018,_0x1981d8[_0xd214('0x3e')]);var _0x482f73={'where':_0x9c9018['where']};return db[_0xd214('0x29')][_0xd214('0x1a')](_0x482f73)['then'](function(_0x1d4f28){_0x3b1520[_0xd214('0x1a')]=_0x1d4f28;if(_0x1981d8[_0xd214('0x2e')]['includeAll']){_0x9c9018[_0xd214('0x3f')]=[{'all':!![]}];}return db[_0xd214('0x29')][_0xd214('0x40')](_0x9c9018);})[_0xd214('0x1f')](function(_0x5d534a){_0x3b1520['rows']=_0x5d534a;return _0x3b1520;})[_0xd214('0x1f')](respondWithFilteredResult(_0x20da25,_0x9c9018))[_0xd214('0x41')](handleError(_0x20da25,null));};exports[_0xd214('0x42')]=function(_0x3ee1f4,_0x3313ff){var _0x538970={'raw':!![],'where':{'id':_0x3ee1f4['params']['id']}},_0x1f658b={};_0x1f658b[_0xd214('0x2d')]=_['keys'](db[_0xd214('0x29')]['rawAttributes']);_0x1f658b['query']=_[_0xd214('0x2f')](_0x3ee1f4[_0xd214('0x2e')]);_0x1f658b[_0xd214('0x30')]=_[_0xd214('0x31')](_0x1f658b[_0xd214('0x2d')],_0x1f658b[_0xd214('0x2e')]);_0x538970[_0xd214('0x33')]=_['intersection'](_0x1f658b[_0xd214('0x2d')],qs['fields'](_0x3ee1f4[_0xd214('0x2e')]['fields']));_0x538970[_0xd214('0x33')]=_0x538970[_0xd214('0x33')][_0xd214('0x34')]?_0x538970[_0xd214('0x33')]:_0x1f658b[_0xd214('0x2d')];if(_0x3ee1f4['query'][_0xd214('0x43')]){_0x538970['include']=[{'all':!![]}];}_0x538970=_[_0xd214('0x3d')]({},_0x538970,_0x3ee1f4[_0xd214('0x3e')]);return db[_0xd214('0x29')][_0xd214('0x44')](_0x538970)[_0xd214('0x1f')](handleEntityNotFound(_0x3313ff,null))[_0xd214('0x1f')](respondWithResult(_0x3313ff,null))[_0xd214('0x41')](handleError(_0x3313ff,null));};exports[_0xd214('0x45')]=function(_0x1ad3ee,_0x5e21f5){return db[_0xd214('0x29')][_0xd214('0x45')](_0x1ad3ee[_0xd214('0x46')],{})[_0xd214('0x1f')](function(_0x1078c4){var _0x1ae623=_0x1ad3ee[_0xd214('0x47')][_0xd214('0x21')]({'plain':!![]});if(!_0x1ae623)throw new Error(_0xd214('0x48'));if(_0x1ae623['role']===_0xd214('0x47')){var _0x1a6ac6=_0x1078c4[_0xd214('0x21')]({'plain':!![]});var _0x20a1ac='Templates';return db[_0xd214('0x49')]['find']({'where':{'name':_0x20a1ac,'userProfileId':_0x1ae623[_0xd214('0x4a')]},'raw':!![]})[_0xd214('0x1f')](function(_0x444451){if(_0x444451&&_0x444451[_0xd214('0x4b')]===0x0){return db[_0xd214('0x22')][_0xd214('0x45')]({'name':_0x1a6ac6['name'],'resourceId':_0x1a6ac6['id'],'type':_0x444451['name'],'sectionId':_0x444451['id']},{})[_0xd214('0x1f')](function(){return _0x1078c4;});}else{return _0x1078c4;}})[_0xd214('0x41')](function(_0x16ce2c){logger['error'](_0xd214('0x4c'),_0x16ce2c);throw _0x16ce2c;});}return _0x1078c4;})[_0xd214('0x1f')](respondWithResult(_0x5e21f5,0xc9))[_0xd214('0x41')](handleError(_0x5e21f5,null));};exports[_0xd214('0x1e')]=function(_0x416956,_0xea8565){if(_0x416956[_0xd214('0x46')]['id']){delete _0x416956[_0xd214('0x46')]['id'];}return db['Template'][_0xd214('0x44')]({'where':{'id':_0x416956[_0xd214('0x4d')]['id']}})['then'](handleEntityNotFound(_0xea8565,null))[_0xd214('0x1f')](saveUpdates(_0x416956[_0xd214('0x46')],null))[_0xd214('0x1f')](respondWithResult(_0xea8565,null))[_0xd214('0x41')](handleError(_0xea8565,null));};exports[_0xd214('0x20')]=function(_0x445f06,_0x459305){return db[_0xd214('0x29')]['find']({'where':{'id':_0x445f06[_0xd214('0x4d')]['id']}})['then'](handleEntityNotFound(_0x459305,null))[_0xd214('0x1f')](removeEntity(_0x459305,null))['catch'](handleError(_0x459305,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index c52faf0..fb6fcac 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 _0x73db=['path','rimraf','../../config/environment','define','Template','tools_templates','lodash','util','moment','request-promise'];(function(_0x260cf8,_0x1e8444){var _0x3b3549=function(_0x2f5a13){while(--_0x2f5a13){_0x260cf8['push'](_0x260cf8['shift']());}};_0x3b3549(++_0x1e8444);}(_0x73db,0x1c8));var _0xb73d=function(_0x18c1d6,_0x50b09c){_0x18c1d6=_0x18c1d6-0x0;var _0x5f225e=_0x73db[_0x18c1d6];return _0x5f225e;};'use strict';var _=require(_0xb73d('0x0'));var util=require(_0xb73d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb73d('0x2'));var BPromise=require('bluebird');var rp=require(_0xb73d('0x3'));var fs=require('fs');var path=require(_0xb73d('0x4'));var rimraf=require(_0xb73d('0x5'));var config=require(_0xb73d('0x6'));var attributes=require('./template.attributes');module['exports']=function(_0x3c6099,_0x729d19){return _0x3c6099[_0xb73d('0x7')](_0xb73d('0x8'),attributes,{'tableName':_0xb73d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb31=['../../config/environment','./template.attributes','define','Template','tools_templates','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1bf639,_0x864d54){var _0x553079=function(_0x144bd4){while(--_0x144bd4){_0x1bf639['push'](_0x1bf639['shift']());}};_0x553079(++_0x864d54);}(_0xfb31,0x1c8));var _0x1fb3=function(_0x12ead7,_0x54ce2d){_0x12ead7=_0x12ead7-0x0;var _0x2f9cb0=_0xfb31[_0x12ead7];return _0x2f9cb0;};'use strict';var _=require(_0x1fb3('0x0'));var util=require('util');var logger=require(_0x1fb3('0x1'))('api');var moment=require(_0x1fb3('0x2'));var BPromise=require(_0x1fb3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb3('0x4'));var rimraf=require(_0x1fb3('0x5'));var config=require(_0x1fb3('0x6'));var attributes=require(_0x1fb3('0x7'));module['exports']=function(_0x2426a7,_0x3c88d6){return _0x2426a7[_0x1fb3('0x8')](_0x1fb3('0x9'),attributes,{'tableName':_0x1fb3('0xa'),'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 d050a64..ff09e14 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 _0x94bf=['then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Template','findAll','options','raw','where','include','map','model','attributes','GetTemplate','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x216897,_0x5890a8){var _0x5a67a0=function(_0x51a77f){while(--_0x51a77f){_0x216897['push'](_0x216897['shift']());}};_0x5a67a0(++_0x5890a8);}(_0x94bf,0x1c2));var _0xf94b=function(_0x15f62e,_0x571c2a){_0x15f62e=_0x15f62e-0x0;var _0x56183a=_0x94bf[_0x15f62e];return _0x56183a;};'use strict';var _=require('lodash');var util=require(_0xf94b('0x0'));var moment=require('moment');var BPromise=require(_0xf94b('0x1'));var rs=require(_0xf94b('0x2'));var fs=require('fs');var Redis=require(_0xf94b('0x3'));var db=require(_0xf94b('0x4'))['db'];var utils=require(_0xf94b('0x5'));var logger=require(_0xf94b('0x6'))(_0xf94b('0x7'));var config=require(_0xf94b('0x8'));var jayson=require(_0xf94b('0x9'));var client=jayson['client'][_0xf94b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9a8ae7,_0x13e671,_0x5643b6){return new BPromise(function(_0x5cb253,_0x3a4ad7){return client[_0xf94b('0xb')](_0x9a8ae7,_0x5643b6)[_0xf94b('0xc')](function(_0x5afaa3){logger[_0xf94b('0xd')](_0xf94b('0xe'),_0x13e671,_0xf94b('0xf'));logger[_0xf94b('0x10')](_0xf94b('0x11'),_0x13e671,'request\x20sent',JSON[_0xf94b('0x12')](_0x5afaa3));if(_0x5afaa3[_0xf94b('0x13')]){if(_0x5afaa3[_0xf94b('0x13')]['code']===0x1f4){logger[_0xf94b('0x13')](_0xf94b('0xe'),_0x13e671,_0x5afaa3[_0xf94b('0x13')][_0xf94b('0x14')]);return _0x3a4ad7(_0x5afaa3[_0xf94b('0x13')][_0xf94b('0x14')]);}logger[_0xf94b('0x13')]('Template,\x20%s,\x20%s',_0x13e671,_0x5afaa3[_0xf94b('0x13')][_0xf94b('0x14')]);return _0x5cb253(_0x5afaa3[_0xf94b('0x13')][_0xf94b('0x14')]);}else{logger[_0xf94b('0xd')](_0xf94b('0xe'),_0x13e671,_0xf94b('0xf'));_0x5cb253(_0x5afaa3[_0xf94b('0x15')][_0xf94b('0x14')]);}})[_0xf94b('0x16')](function(_0xe5a61b){logger['error'](_0xf94b('0xe'),_0x13e671,_0xe5a61b);_0x3a4ad7(_0xe5a61b);});});}exports['GetTemplate']=function(_0x3b9306){var _0x4e1025=this;return new Promise(function(_0x340097,_0x271597){return db[_0xf94b('0x17')][_0xf94b('0x18')]({'raw':_0x3b9306[_0xf94b('0x19')]?_0x3b9306[_0xf94b('0x19')][_0xf94b('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b9306[_0xf94b('0x19')]?_0x3b9306[_0xf94b('0x19')][_0xf94b('0x1b')]||null:null,'attributes':_0x3b9306['options']?_0x3b9306[_0xf94b('0x19')]['attributes']||null:null,'limit':_0x3b9306[_0xf94b('0x19')]?_0x3b9306['options']['limit']||null:null,'include':_0x3b9306[_0xf94b('0x19')]?_0x3b9306[_0xf94b('0x19')][_0xf94b('0x1c')]?_[_0xf94b('0x1d')](_0x3b9306['options'][_0xf94b('0x1c')],function(_0x510fee){return{'model':db[_0x510fee[_0xf94b('0x1e')]],'as':_0x510fee['as'],'attributes':_0x510fee[_0xf94b('0x1f')],'include':_0x510fee[_0xf94b('0x1c')]?_[_0xf94b('0x1d')](_0x510fee['include'],function(_0x4d804f){return{'model':db[_0x4d804f[_0xf94b('0x1e')]],'as':_0x4d804f['as'],'attributes':_0x4d804f['attributes'],'include':_0x4d804f[_0xf94b('0x1c')]?_[_0xf94b('0x1d')](_0x4d804f[_0xf94b('0x1c')],function(_0x272451){return{'model':db[_0x272451[_0xf94b('0x1e')]],'as':_0x272451['as'],'attributes':_0x272451['attributes']};}):[]};}):[]};}):[]:[]})[_0xf94b('0xc')](function(_0x15073b){logger['info'](_0xf94b('0x20'),_0x3b9306);logger['debug']('GetTemplate',_0x3b9306,JSON['stringify'](_0x15073b));_0x340097(_0x15073b);})[_0xf94b('0x16')](function(_0x52b80b){logger[_0xf94b('0x13')](_0xf94b('0x20'),_0x52b80b[_0xf94b('0x14')],_0x3b9306);_0x271597(_0x4e1025['error'](0x1f4,_0x52b80b[_0xf94b('0x14')]));});});}; \ No newline at end of file +var _0x4b96=['http','request','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetTemplate','Template','findAll','options','raw','where','limit','include','attributes','map','model','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x423efe,_0x16497d){var _0x1466b8=function(_0x153100){while(--_0x153100){_0x423efe['push'](_0x423efe['shift']());}};_0x1466b8(++_0x16497d);}(_0x4b96,0x12e));var _0x64b9=function(_0x4778c1,_0x339be7){_0x4778c1=_0x4778c1-0x0;var _0x1c20b1=_0x4b96[_0x4778c1];return _0x1c20b1;};'use strict';var _=require(_0x64b9('0x0'));var util=require(_0x64b9('0x1'));var moment=require(_0x64b9('0x2'));var BPromise=require('bluebird');var rs=require(_0x64b9('0x3'));var fs=require('fs');var Redis=require(_0x64b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64b9('0x5'));var logger=require(_0x64b9('0x6'))(_0x64b9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x64b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51433b,_0x46adab,_0x9c08fb){return new BPromise(function(_0x3f9512,_0x405c29){return client[_0x64b9('0x9')](_0x51433b,_0x9c08fb)['then'](function(_0x22060e){logger[_0x64b9('0xa')](_0x64b9('0xb'),_0x46adab,'request\x20sent');logger[_0x64b9('0xc')](_0x64b9('0xd'),_0x46adab,_0x64b9('0xe'),JSON[_0x64b9('0xf')](_0x22060e));if(_0x22060e['error']){if(_0x22060e[_0x64b9('0x10')][_0x64b9('0x11')]===0x1f4){logger['error'](_0x64b9('0xb'),_0x46adab,_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);return _0x405c29(_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);}logger[_0x64b9('0x10')]('Template,\x20%s,\x20%s',_0x46adab,_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);return _0x3f9512(_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);}else{logger[_0x64b9('0xa')](_0x64b9('0xb'),_0x46adab,'request\x20sent');_0x3f9512(_0x22060e['result'][_0x64b9('0x12')]);}})['catch'](function(_0x39f91c){logger[_0x64b9('0x10')](_0x64b9('0xb'),_0x46adab,_0x39f91c);_0x405c29(_0x39f91c);});});}exports[_0x64b9('0x13')]=function(_0x4bed3d){var _0x7e7cd7=this;return new Promise(function(_0x1637a4,_0x1a9520){return db[_0x64b9('0x14')][_0x64b9('0x15')]({'raw':_0x4bed3d[_0x64b9('0x16')]?_0x4bed3d['options'][_0x64b9('0x17')]===undefined?!![]:![]:!![],'where':_0x4bed3d[_0x64b9('0x16')]?_0x4bed3d[_0x64b9('0x16')][_0x64b9('0x18')]||null:null,'attributes':_0x4bed3d[_0x64b9('0x16')]?_0x4bed3d[_0x64b9('0x16')]['attributes']||null:null,'limit':_0x4bed3d[_0x64b9('0x16')]?_0x4bed3d[_0x64b9('0x16')][_0x64b9('0x19')]||null:null,'include':_0x4bed3d[_0x64b9('0x16')]?_0x4bed3d[_0x64b9('0x16')][_0x64b9('0x1a')]?_['map'](_0x4bed3d[_0x64b9('0x16')][_0x64b9('0x1a')],function(_0x37034d){return{'model':db[_0x37034d['model']],'as':_0x37034d['as'],'attributes':_0x37034d[_0x64b9('0x1b')],'include':_0x37034d['include']?_[_0x64b9('0x1c')](_0x37034d['include'],function(_0x5088a7){return{'model':db[_0x5088a7[_0x64b9('0x1d')]],'as':_0x5088a7['as'],'attributes':_0x5088a7[_0x64b9('0x1b')],'include':_0x5088a7['include']?_[_0x64b9('0x1c')](_0x5088a7['include'],function(_0x1a35e0){return{'model':db[_0x1a35e0[_0x64b9('0x1d')]],'as':_0x1a35e0['as'],'attributes':_0x1a35e0[_0x64b9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42ae73){logger[_0x64b9('0xa')]('GetTemplate',_0x4bed3d);logger['debug'](_0x64b9('0x13'),_0x4bed3d,JSON[_0x64b9('0xf')](_0x42ae73));_0x1637a4(_0x42ae73);})[_0x64b9('0x1e')](function(_0x91e004){logger[_0x64b9('0x10')](_0x64b9('0x13'),_0x91e004['message'],_0x4bed3d);_0x1a9520(_0x7e7cd7[_0x64b9('0x10')](0x1f4,_0x91e004[_0x64b9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 743fbcb..714c0b9 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 _0x134d=['getAnyConditions','/:id/actions','getActions','create','post','addAllCondition','/:id/any_conditions','addAction','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','index','get','isAuthenticated','/:id/all_conditions','getAllConditions'];(function(_0xb8f65,_0x5b3d4f){var _0x537221=function(_0x157d70){while(--_0x157d70){_0xb8f65['push'](_0xb8f65['shift']());}};_0x537221(++_0x5b3d4f);}(_0x134d,0x16c));var _0xd134=function(_0x35f1f9,_0x18d87e){_0x35f1f9=_0x35f1f9-0x0;var _0x33eb78=_0x134d[_0x35f1f9];return _0x33eb78;};'use strict';var multer=require(_0xd134('0x0'));var util=require(_0xd134('0x1'));var path=require('path');var timeout=require(_0xd134('0x2'));var express=require(_0xd134('0x3'));var router=express[_0xd134('0x4')]();var fs_extra=require(_0xd134('0x5'));var auth=require(_0xd134('0x6'));var interaction=require(_0xd134('0x7'));var config=require('../../config/environment');var controller=require(_0xd134('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd134('0x9')]);router[_0xd134('0xa')]('/:id',auth[_0xd134('0xb')](),controller['show']);router[_0xd134('0xa')](_0xd134('0xc'),auth[_0xd134('0xb')](),controller[_0xd134('0xd')]);router[_0xd134('0xa')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xd134('0xe')]);router[_0xd134('0xa')](_0xd134('0xf'),auth[_0xd134('0xb')](),controller[_0xd134('0x10')]);router['post']('/',auth[_0xd134('0xb')](),controller[_0xd134('0x11')]);router[_0xd134('0x12')](_0xd134('0xc'),auth[_0xd134('0xb')](),controller[_0xd134('0x13')]);router['post'](_0xd134('0x14'),auth[_0xd134('0xb')](),controller['addAnyCondition']);router[_0xd134('0x12')](_0xd134('0xf'),auth[_0xd134('0xb')](),controller[_0xd134('0x15')]);router[_0xd134('0x16')](_0xd134('0x17'),auth[_0xd134('0xb')](),controller[_0xd134('0x18')]);router[_0xd134('0x19')](_0xd134('0x17'),auth[_0xd134('0xb')](),controller[_0xd134('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x02b6=['/:id','/:id/all_conditions','getAnyConditions','getActions','create','post','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./trigger.controller','get','isAuthenticated','index'];(function(_0x42fd32,_0x12d3ae){var _0x328b6f=function(_0x3b9d38){while(--_0x3b9d38){_0x42fd32['push'](_0x42fd32['shift']());}};_0x328b6f(++_0x12d3ae);}(_0x02b6,0xf0));var _0x602b=function(_0x28d0ba,_0xa652c5){_0x28d0ba=_0x28d0ba-0x0;var _0x3e7140=_0x02b6[_0x28d0ba];return _0x3e7140;};'use strict';var multer=require(_0x602b('0x0'));var util=require(_0x602b('0x1'));var path=require(_0x602b('0x2'));var timeout=require(_0x602b('0x3'));var express=require(_0x602b('0x4'));var router=express[_0x602b('0x5')]();var fs_extra=require(_0x602b('0x6'));var auth=require(_0x602b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x602b('0x8'));router[_0x602b('0x9')]('/',auth[_0x602b('0xa')](),controller[_0x602b('0xb')]);router[_0x602b('0x9')](_0x602b('0xc'),auth[_0x602b('0xa')](),controller['show']);router[_0x602b('0x9')](_0x602b('0xd'),auth['isAuthenticated'](),controller['getAllConditions']);router['get']('/:id/any_conditions',auth[_0x602b('0xa')](),controller[_0x602b('0xe')]);router[_0x602b('0x9')]('/:id/actions',auth[_0x602b('0xa')](),controller[_0x602b('0xf')]);router['post']('/',auth[_0x602b('0xa')](),controller[_0x602b('0x10')]);router[_0x602b('0x11')](_0x602b('0xd'),auth['isAuthenticated'](),controller[_0x602b('0x12')]);router[_0x602b('0x11')](_0x602b('0x13'),auth[_0x602b('0xa')](),controller[_0x602b('0x14')]);router[_0x602b('0x11')](_0x602b('0x15'),auth[_0x602b('0xa')](),controller[_0x602b('0x16')]);router[_0x602b('0x17')](_0x602b('0xc'),auth[_0x602b('0xa')](),controller[_0x602b('0x18')]);router[_0x602b('0x19')](_0x602b('0xc'),auth[_0x602b('0xa')](),controller[_0x602b('0x1a')]);module[_0x602b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 35d54b3..cec9377 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 _0xe83c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1aadeb,_0x56ed5b){var _0x1a9070=function(_0x301bdb){while(--_0x301bdb){_0x1aadeb['push'](_0x1aadeb['shift']());}};_0x1a9070(++_0x56ed5b);}(_0xe83c,0x1a6));var _0xce83=function(_0x5154a6,_0x428f5a){_0x5154a6=_0x5154a6-0x0;var _0x3c8400=_0xe83c[_0x5154a6];return _0x3c8400;};'use strict';var Sequelize=require(_0xce83('0x0'));module[_0xce83('0x1')]={'name':{'type':Sequelize[_0xce83('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xce83('0x2')]},'status':{'type':Sequelize[_0xce83('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xfbc1=['STRING','BOOLEAN'];(function(_0x236951,_0x7c3263){var _0xcb7439=function(_0x34a64d){while(--_0x34a64d){_0x236951['push'](_0x236951['shift']());}};_0xcb7439(++_0x7c3263);}(_0xfbc1,0x15a));var _0x1fbc=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0xfbc1[_0x120376];return _0x28c529;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1fbc('0x0')]},'description':{'type':Sequelize[_0x1fbc('0x0')]},'status':{'type':Sequelize[_0x1fbc('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 6708eba..ef2c2d8 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 _0xf5ea=['count','offset','set','apply','reject','save','update','then','get','Triggers','destroy','end','error','stack','index','map','Trigger','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','getAnyConditions','findOne','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit'];(function(_0x138baf,_0x374f21){var _0x3b865f=function(_0x598dff){while(--_0x598dff){_0x138baf['push'](_0x138baf['shift']());}};_0x3b865f(++_0x374f21);}(_0xf5ea,0xfd));var _0xaf5e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf5ea[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf5e('0x0'));var zipdir=require(_0xaf5e('0x1'));var jsonpatch=require(_0xaf5e('0x2'));var rp=require(_0xaf5e('0x3'));var moment=require(_0xaf5e('0x4'));var BPromise=require(_0xaf5e('0x5'));var Mustache=require(_0xaf5e('0x6'));var util=require(_0xaf5e('0x7'));var path=require('path');var sox=require(_0xaf5e('0x8'));var csv=require(_0xaf5e('0x9'));var ejs=require(_0xaf5e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaf5e('0xb'));var crypto=require('crypto');var jsforce=require(_0xaf5e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaf5e('0xd'));var Papa=require(_0xaf5e('0xe'));var Redis=require('ioredis');var authService=require(_0xaf5e('0xf'));var qs=require(_0xaf5e('0x10'));var as=require(_0xaf5e('0x11'));var hardwareService=require(_0xaf5e('0x12'));var logger=require(_0xaf5e('0x13'))(_0xaf5e('0x14'));var utils=require(_0xaf5e('0x15'));var config=require(_0xaf5e('0x16'));var licenseUtil=require(_0xaf5e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303ff8,_0x29be9a){_0x29be9a=_0x29be9a||0xcc;return function(_0x590bb9){if(_0x590bb9){return _0x303ff8[_0xaf5e('0x18')](_0x29be9a);}return _0x303ff8[_0xaf5e('0x19')](_0x29be9a)['end']();};}function respondWithResult(_0xd109d,_0x2a6296){_0x2a6296=_0x2a6296||0xc8;return function(_0x5c1f2e){if(_0x5c1f2e){return _0xd109d[_0xaf5e('0x19')](_0x2a6296)[_0xaf5e('0x1a')](_0x5c1f2e);}};}function respondWithFilteredResult(_0x1608ed,_0x21a299){return function(_0x17c567){if(_0x17c567){var _0x2ab65f=typeof _0x21a299['offset']===_0xaf5e('0x1b')&&typeof _0x21a299[_0xaf5e('0x1c')]===_0xaf5e('0x1b');var _0x1485ba=_0x17c567[_0xaf5e('0x1d')];var _0x227007=_0x2ab65f?0x0:_0x21a299[_0xaf5e('0x1e')];var _0x1633ea=_0x2ab65f?_0x17c567[_0xaf5e('0x1d')]:_0x21a299['offset']+_0x21a299[_0xaf5e('0x1c')];var _0x292e1d;if(_0x1633ea>=_0x1485ba){_0x1633ea=_0x1485ba;_0x292e1d=0xc8;}else{_0x292e1d=0xce;}_0x1608ed['status'](_0x292e1d);return _0x1608ed[_0xaf5e('0x1f')]('Content-Range',_0x227007+'-'+_0x1633ea+'/'+_0x1485ba)[_0xaf5e('0x1a')](_0x17c567);}return null;};}function patchUpdates(_0x4da47c){return function(_0x73e483){try{jsonpatch[_0xaf5e('0x20')](_0x73e483,_0x4da47c,!![]);}catch(_0x20b272){return BPromise[_0xaf5e('0x21')](_0x20b272);}return _0x73e483[_0xaf5e('0x22')]();};}function saveUpdates(_0x55eaf7,_0x18ea39){return function(_0x5f4c80){if(_0x5f4c80){return _0x5f4c80[_0xaf5e('0x23')](_0x55eaf7)[_0xaf5e('0x24')](function(_0x5d5710){return _0x5d5710;});}return null;};}function removeEntity(_0x37cbda,_0x1f36a3){return function(_0xb34ca7){if(_0xb34ca7){return _0xb34ca7['destroy']()['then'](function(){var _0xd2ba37=_0xb34ca7[_0xaf5e('0x25')]({'plain':!![]});var _0x37cd06=_0xaf5e('0x26');return db['UserProfileResource'][_0xaf5e('0x27')]({'where':{'type':_0x37cd06,'resourceId':_0xd2ba37['id']}})[_0xaf5e('0x24')](function(){return _0xb34ca7;});})[_0xaf5e('0x24')](function(){_0x37cbda['status'](0xcc)[_0xaf5e('0x28')]();});}};}function handleEntityNotFound(_0x131be6,_0x100632){return function(_0x3985c4){if(!_0x3985c4){_0x131be6[_0xaf5e('0x18')](0x194);}return _0x3985c4;};}function handleError(_0x1ae2b8,_0x1b12ac){_0x1b12ac=_0x1b12ac||0x1f4;return function(_0x474fe6){logger[_0xaf5e('0x29')](_0x474fe6[_0xaf5e('0x2a')]);if(_0x474fe6['name']){delete _0x474fe6['name'];}_0x1ae2b8['status'](_0x1b12ac)['send'](_0x474fe6);};}exports[_0xaf5e('0x2b')]=function(_0xc3a261,_0xf4983b){var _0x1abe90={},_0xced261={},_0x7fb6fa={'count':0x0,'rows':[]};var _0x26cf2e=_[_0xaf5e('0x2c')](db[_0xaf5e('0x2d')][_0xaf5e('0x2e')],function(_0x53f14b){return{'name':_0x53f14b['fieldName'],'type':_0x53f14b[_0xaf5e('0x2f')][_0xaf5e('0x30')]};});_0xced261[_0xaf5e('0x31')]=_[_0xaf5e('0x2c')](_0x26cf2e,_0xaf5e('0x32'));_0xced261[_0xaf5e('0x33')]=_[_0xaf5e('0x34')](_0xc3a261[_0xaf5e('0x33')]);_0xced261[_0xaf5e('0x35')]=_[_0xaf5e('0x36')](_0xced261[_0xaf5e('0x31')],_0xced261[_0xaf5e('0x33')]);_0x1abe90[_0xaf5e('0x37')]=_[_0xaf5e('0x36')](_0xced261[_0xaf5e('0x31')],qs[_0xaf5e('0x38')](_0xc3a261[_0xaf5e('0x33')][_0xaf5e('0x38')]));_0x1abe90['attributes']=_0x1abe90[_0xaf5e('0x37')]['length']?_0x1abe90[_0xaf5e('0x37')]:_0xced261[_0xaf5e('0x31')];if(!_0xc3a261[_0xaf5e('0x33')][_0xaf5e('0x39')](_0xaf5e('0x3a'))){_0x1abe90[_0xaf5e('0x1c')]=qs['limit'](_0xc3a261[_0xaf5e('0x33')][_0xaf5e('0x1c')]);_0x1abe90[_0xaf5e('0x1e')]=qs[_0xaf5e('0x1e')](_0xc3a261[_0xaf5e('0x33')]['offset']);}_0x1abe90[_0xaf5e('0x3b')]=qs['sort'](_0xc3a261[_0xaf5e('0x33')][_0xaf5e('0x3c')]);_0x1abe90[_0xaf5e('0x3d')]=qs[_0xaf5e('0x35')](_[_0xaf5e('0x3e')](_0xc3a261[_0xaf5e('0x33')],_0xced261[_0xaf5e('0x35')]),_0x26cf2e);if(_0xc3a261[_0xaf5e('0x33')][_0xaf5e('0x3f')]){_0x1abe90[_0xaf5e('0x3d')]=_[_0xaf5e('0x40')](_0x1abe90[_0xaf5e('0x3d')],{'$or':_['map'](_0x26cf2e,function(_0x4d38a8){if(_0x4d38a8[_0xaf5e('0x2f')]!==_0xaf5e('0x41')){var _0x477206={};_0x477206[_0x4d38a8[_0xaf5e('0x32')]]={'$like':'%'+_0xc3a261[_0xaf5e('0x33')]['filter']+'%'};return _0x477206;}})});}_0x1abe90=_['merge']({},_0x1abe90,_0xc3a261[_0xaf5e('0x42')]);var _0x53eca7={'where':_0x1abe90[_0xaf5e('0x3d')]};return db['Trigger'][_0xaf5e('0x1d')](_0x53eca7)['then'](function(_0x361ade){_0x7fb6fa[_0xaf5e('0x1d')]=_0x361ade;if(_0xc3a261['query'][_0xaf5e('0x43')]){_0x1abe90[_0xaf5e('0x44')]=[{'all':!![]}];}return db[_0xaf5e('0x2d')]['findAll'](_0x1abe90);})[_0xaf5e('0x24')](function(_0x2c4b90){_0x7fb6fa[_0xaf5e('0x45')]=_0x2c4b90;return _0x7fb6fa;})[_0xaf5e('0x24')](respondWithFilteredResult(_0xf4983b,_0x1abe90))[_0xaf5e('0x46')](handleError(_0xf4983b,null));};exports[_0xaf5e('0x47')]=function(_0x1adbe5,_0x54ed37){var _0x1f6f5f={'raw':![],'where':{'id':_0x1adbe5[_0xaf5e('0x48')]['id']}},_0x51a2c1={};_0x51a2c1[_0xaf5e('0x31')]=_[_0xaf5e('0x34')](db['Trigger'][_0xaf5e('0x2e')]);_0x51a2c1[_0xaf5e('0x33')]=_['keys'](_0x1adbe5[_0xaf5e('0x33')]);_0x51a2c1['filters']=_[_0xaf5e('0x36')](_0x51a2c1['model'],_0x51a2c1[_0xaf5e('0x33')]);_0x1f6f5f[_0xaf5e('0x37')]=_['intersection'](_0x51a2c1[_0xaf5e('0x31')],qs[_0xaf5e('0x38')](_0x1adbe5[_0xaf5e('0x33')][_0xaf5e('0x38')]));_0x1f6f5f['attributes']=_0x1f6f5f[_0xaf5e('0x37')][_0xaf5e('0x49')]?_0x1f6f5f[_0xaf5e('0x37')]:_0x51a2c1[_0xaf5e('0x31')];if(_0x1adbe5['query']['includeAll']){_0x1f6f5f[_0xaf5e('0x44')]=[{'all':!![]}];}_0x1f6f5f=_[_0xaf5e('0x40')]({},_0x1f6f5f,_0x1adbe5[_0xaf5e('0x42')]);return db[_0xaf5e('0x2d')][_0xaf5e('0x4a')](_0x1f6f5f)[_0xaf5e('0x24')](handleEntityNotFound(_0x54ed37,null))['then'](respondWithResult(_0x54ed37,null))[_0xaf5e('0x46')](handleError(_0x54ed37,null));};exports[_0xaf5e('0x4b')]=function(_0x409708,_0x4c8d9f){return db[_0xaf5e('0x2d')][_0xaf5e('0x4b')](_0x409708[_0xaf5e('0x4c')],{})[_0xaf5e('0x24')](function(_0x3b0088){var _0x4db5e3=_0x409708[_0xaf5e('0x4d')][_0xaf5e('0x25')]({'plain':!![]});if(!_0x4db5e3)throw new Error(_0xaf5e('0x4e'));if(_0x4db5e3[_0xaf5e('0x4f')]===_0xaf5e('0x4d')){var _0x165426=_0x3b0088[_0xaf5e('0x25')]({'plain':!![]});var _0x11246e=_0xaf5e('0x26');return db[_0xaf5e('0x50')][_0xaf5e('0x4a')]({'where':{'name':_0x11246e,'userProfileId':_0x4db5e3['userProfileId']},'raw':!![]})[_0xaf5e('0x24')](function(_0x338707){if(_0x338707&&_0x338707[_0xaf5e('0x51')]===0x0){return db[_0xaf5e('0x52')]['create']({'name':_0x165426[_0xaf5e('0x32')],'resourceId':_0x165426['id'],'type':_0x338707['name'],'sectionId':_0x338707['id']},{})[_0xaf5e('0x24')](function(){return _0x3b0088;});}else{return _0x3b0088;}})[_0xaf5e('0x46')](function(_0x1f440d){logger[_0xaf5e('0x29')](_0xaf5e('0x53'),_0x1f440d);throw _0x1f440d;});}return _0x3b0088;})[_0xaf5e('0x24')](respondWithResult(_0x4c8d9f,0xc9))[_0xaf5e('0x46')](handleError(_0x4c8d9f,null));};exports[_0xaf5e('0x23')]=function(_0x40efa9,_0x2bf925){if(_0x40efa9[_0xaf5e('0x4c')]['id']){delete _0x40efa9[_0xaf5e('0x4c')]['id'];}return db[_0xaf5e('0x2d')][_0xaf5e('0x4a')]({'where':{'id':_0x40efa9[_0xaf5e('0x48')]['id']}})['then'](handleEntityNotFound(_0x2bf925,null))[_0xaf5e('0x24')](saveUpdates(_0x40efa9['body'],null))[_0xaf5e('0x24')](respondWithResult(_0x2bf925,null))['catch'](handleError(_0x2bf925,null));};exports['destroy']=function(_0x18712e,_0x2a1318){return db[_0xaf5e('0x2d')][_0xaf5e('0x4a')]({'where':{'id':_0x18712e[_0xaf5e('0x48')]['id']}})[_0xaf5e('0x24')](handleEntityNotFound(_0x2a1318,null))[_0xaf5e('0x24')](removeEntity(_0x2a1318,null))[_0xaf5e('0x46')](handleError(_0x2a1318,null));};exports[_0xaf5e('0x54')]=function(_0x101227,_0x503347,_0x2700f8){if(_0x101227['body']['id']){delete _0x101227[_0xaf5e('0x4c')]['id'];}return db[_0xaf5e('0x2d')][_0xaf5e('0x4a')]({'where':{'id':_0x101227[_0xaf5e('0x48')]['id']}})[_0xaf5e('0x24')](handleEntityNotFound(_0x503347,null))[_0xaf5e('0x24')](function(_0x309a74){if(_0x309a74){_0x101227[_0xaf5e('0x4c')][_0xaf5e('0x55')]=_0x309a74['id'];return db['Condition']['create'](_0x101227[_0xaf5e('0x4c')]);}})[_0xaf5e('0x24')](respondWithResult(_0x503347,null))[_0xaf5e('0x46')](handleError(_0x503347,null));};exports[_0xaf5e('0x56')]=function(_0x30dba7,_0x52a375,_0x1e0608){if(_0x30dba7[_0xaf5e('0x4c')]['id']){delete _0x30dba7[_0xaf5e('0x4c')]['id'];}return db['Trigger'][_0xaf5e('0x4a')]({'where':{'id':_0x30dba7[_0xaf5e('0x48')]['id']}})['then'](handleEntityNotFound(_0x52a375,null))['then'](function(_0x1623f7){if(_0x1623f7){_0x30dba7[_0xaf5e('0x4c')][_0xaf5e('0x57')]=_0x1623f7['id'];return db[_0xaf5e('0x58')][_0xaf5e('0x4b')](_0x30dba7[_0xaf5e('0x4c')]);}})[_0xaf5e('0x24')](respondWithResult(_0x52a375,null))[_0xaf5e('0x46')](handleError(_0x52a375,null));};exports[_0xaf5e('0x59')]=function(_0x217b86,_0x569941,_0x5c8dd8){var _0x1f8fd8={};var _0x3fad46={};var _0x415b1f;var _0x52b04b;return db[_0xaf5e('0x2d')]['findOne']({'where':{'id':_0x217b86[_0xaf5e('0x48')]['id']}})[_0xaf5e('0x24')](handleEntityNotFound(_0x569941,null))['then'](function(_0x470c3a){if(_0x470c3a){_0x415b1f=_0x470c3a;_0x3fad46[_0xaf5e('0x31')]=_['keys'](db[_0xaf5e('0x58')][_0xaf5e('0x2e')]);_0x3fad46[_0xaf5e('0x33')]=_[_0xaf5e('0x34')](_0x217b86[_0xaf5e('0x33')]);_0x3fad46[_0xaf5e('0x35')]=_[_0xaf5e('0x36')](_0x3fad46[_0xaf5e('0x31')],_0x3fad46[_0xaf5e('0x33')]);_0x1f8fd8['attributes']=_['intersection'](_0x3fad46[_0xaf5e('0x31')],qs['fields'](_0x217b86[_0xaf5e('0x33')]['fields']));_0x1f8fd8[_0xaf5e('0x37')]=_0x1f8fd8[_0xaf5e('0x37')][_0xaf5e('0x49')]?_0x1f8fd8['attributes']:_0x3fad46[_0xaf5e('0x31')];_0x1f8fd8[_0xaf5e('0x3b')]=qs[_0xaf5e('0x3c')](_0x217b86[_0xaf5e('0x33')]['sort']);_0x1f8fd8[_0xaf5e('0x3d')]=qs['filters'](_['pick'](_0x217b86['query'],_0x3fad46[_0xaf5e('0x35')]));if(_0x217b86[_0xaf5e('0x33')][_0xaf5e('0x3f')]){_0x1f8fd8[_0xaf5e('0x3d')]=_[_0xaf5e('0x40')](_0x1f8fd8['where'],{'$or':_[_0xaf5e('0x2c')](_0x1f8fd8[_0xaf5e('0x37')],function(_0x4da43a){var _0x401ba1={};_0x401ba1[_0x4da43a]={'$like':'%'+_0x217b86[_0xaf5e('0x33')]['filter']+'%'};return _0x401ba1;})});}_0x1f8fd8=_['merge']({},_0x1f8fd8,_0x217b86[_0xaf5e('0x42')]);return _0x415b1f[_0xaf5e('0x59')](_0x1f8fd8);}})['then'](function(_0x241f0f){if(_0x241f0f){_0x52b04b=_0x241f0f[_0xaf5e('0x49')];if(!_0x217b86[_0xaf5e('0x33')][_0xaf5e('0x39')](_0xaf5e('0x3a'))){_0x1f8fd8['limit']=qs[_0xaf5e('0x1c')](_0x217b86[_0xaf5e('0x33')][_0xaf5e('0x1c')]);_0x1f8fd8[_0xaf5e('0x1e')]=qs[_0xaf5e('0x1e')](_0x217b86[_0xaf5e('0x33')][_0xaf5e('0x1e')]);}return _0x415b1f[_0xaf5e('0x59')](_0x1f8fd8);}})['then'](function(_0xc7dfee){if(_0xc7dfee){return _0xc7dfee?{'count':_0x52b04b,'rows':_0xc7dfee}:null;}})[_0xaf5e('0x24')](respondWithResult(_0x569941,null))[_0xaf5e('0x46')](handleError(_0x569941,null));};exports[_0xaf5e('0x5a')]=function(_0x52f3e0,_0x5b13ca,_0x5b6bfc){var _0x51ac51={};var _0x443524={};var _0x3a0e0f;var _0x3f9342;return db[_0xaf5e('0x2d')][_0xaf5e('0x5b')]({'where':{'id':_0x52f3e0[_0xaf5e('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b13ca,null))[_0xaf5e('0x24')](function(_0x23e713){if(_0x23e713){_0x3a0e0f=_0x23e713;_0x443524[_0xaf5e('0x31')]=_[_0xaf5e('0x34')](db[_0xaf5e('0x58')][_0xaf5e('0x2e')]);_0x443524[_0xaf5e('0x33')]=_[_0xaf5e('0x34')](_0x52f3e0[_0xaf5e('0x33')]);_0x443524[_0xaf5e('0x35')]=_[_0xaf5e('0x36')](_0x443524[_0xaf5e('0x31')],_0x443524['query']);_0x51ac51['attributes']=_[_0xaf5e('0x36')](_0x443524[_0xaf5e('0x31')],qs[_0xaf5e('0x38')](_0x52f3e0['query'][_0xaf5e('0x38')]));_0x51ac51['attributes']=_0x51ac51[_0xaf5e('0x37')][_0xaf5e('0x49')]?_0x51ac51['attributes']:_0x443524[_0xaf5e('0x31')];_0x51ac51[_0xaf5e('0x3b')]=qs[_0xaf5e('0x3c')](_0x52f3e0[_0xaf5e('0x33')][_0xaf5e('0x3c')]);_0x51ac51[_0xaf5e('0x3d')]=qs[_0xaf5e('0x35')](_[_0xaf5e('0x3e')](_0x52f3e0['query'],_0x443524[_0xaf5e('0x35')]));if(_0x52f3e0[_0xaf5e('0x33')][_0xaf5e('0x3f')]){_0x51ac51['where']=_[_0xaf5e('0x40')](_0x51ac51[_0xaf5e('0x3d')],{'$or':_[_0xaf5e('0x2c')](_0x51ac51['attributes'],function(_0x419d74){var _0x29b08f={};_0x29b08f[_0x419d74]={'$like':'%'+_0x52f3e0[_0xaf5e('0x33')][_0xaf5e('0x3f')]+'%'};return _0x29b08f;})});}_0x51ac51=_['merge']({},_0x51ac51,_0x52f3e0[_0xaf5e('0x42')]);return _0x3a0e0f[_0xaf5e('0x5a')](_0x51ac51);}})['then'](function(_0xc267aa){if(_0xc267aa){_0x3f9342=_0xc267aa[_0xaf5e('0x49')];if(!_0x52f3e0[_0xaf5e('0x33')][_0xaf5e('0x39')]('nolimit')){_0x51ac51[_0xaf5e('0x1c')]=qs[_0xaf5e('0x1c')](_0x52f3e0[_0xaf5e('0x33')][_0xaf5e('0x1c')]);_0x51ac51[_0xaf5e('0x1e')]=qs[_0xaf5e('0x1e')](_0x52f3e0[_0xaf5e('0x33')][_0xaf5e('0x1e')]);}return _0x3a0e0f[_0xaf5e('0x5a')](_0x51ac51);}})[_0xaf5e('0x24')](function(_0xe0069c){if(_0xe0069c){return _0xe0069c?{'count':_0x3f9342,'rows':_0xe0069c}:null;}})[_0xaf5e('0x24')](respondWithResult(_0x5b13ca,null))[_0xaf5e('0x46')](handleError(_0x5b13ca,null));};exports['addAction']=function(_0x3278f8,_0x40d7f9,_0x20e12a){if(_0x3278f8['body']['id']){delete _0x3278f8[_0xaf5e('0x4c')]['id'];}return db[_0xaf5e('0x2d')][_0xaf5e('0x4a')]({'where':{'id':_0x3278f8[_0xaf5e('0x48')]['id']}})[_0xaf5e('0x24')](handleEntityNotFound(_0x40d7f9,null))[_0xaf5e('0x24')](function(_0x37771c){if(_0x37771c){_0x3278f8['body']['TriggerId']=_0x37771c['id'];return db[_0xaf5e('0x5c')][_0xaf5e('0x4b')](_0x3278f8['body']);}})['then'](respondWithResult(_0x40d7f9,null))[_0xaf5e('0x46')](handleError(_0x40d7f9,null));};exports[_0xaf5e('0x5d')]=function(_0x565d99,_0x5d5c5a,_0x41ca03){var _0x1e6026={};var _0x3d5fe8={};var _0x562c66;var _0x3d08e5;return db[_0xaf5e('0x2d')][_0xaf5e('0x5b')]({'where':{'id':_0x565d99[_0xaf5e('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d5c5a,null))['then'](function(_0x525269){if(_0x525269){_0x562c66=_0x525269;_0x3d5fe8[_0xaf5e('0x31')]=_[_0xaf5e('0x34')](db['Action'][_0xaf5e('0x2e')]);_0x3d5fe8[_0xaf5e('0x33')]=_[_0xaf5e('0x34')](_0x565d99[_0xaf5e('0x33')]);_0x3d5fe8[_0xaf5e('0x35')]=_['intersection'](_0x3d5fe8['model'],_0x3d5fe8['query']);_0x1e6026['attributes']=_[_0xaf5e('0x36')](_0x3d5fe8['model'],qs[_0xaf5e('0x38')](_0x565d99[_0xaf5e('0x33')][_0xaf5e('0x38')]));_0x1e6026[_0xaf5e('0x37')]=_0x1e6026[_0xaf5e('0x37')][_0xaf5e('0x49')]?_0x1e6026['attributes']:_0x3d5fe8[_0xaf5e('0x31')];_0x1e6026[_0xaf5e('0x3b')]=qs['sort'](_0x565d99[_0xaf5e('0x33')][_0xaf5e('0x3c')]);_0x1e6026[_0xaf5e('0x3d')]=qs[_0xaf5e('0x35')](_['pick'](_0x565d99['query'],_0x3d5fe8[_0xaf5e('0x35')]));if(_0x565d99[_0xaf5e('0x33')][_0xaf5e('0x3f')]){_0x1e6026['where']=_[_0xaf5e('0x40')](_0x1e6026[_0xaf5e('0x3d')],{'$or':_[_0xaf5e('0x2c')](_0x1e6026['attributes'],function(_0x12f247){var _0x3b7d28={};_0x3b7d28[_0x12f247]={'$like':'%'+_0x565d99[_0xaf5e('0x33')][_0xaf5e('0x3f')]+'%'};return _0x3b7d28;})});}_0x1e6026=_[_0xaf5e('0x40')]({},_0x1e6026,_0x565d99[_0xaf5e('0x42')]);return _0x562c66[_0xaf5e('0x5d')](_0x1e6026);}})[_0xaf5e('0x24')](function(_0x3020ed){if(_0x3020ed){_0x3d08e5=_0x3020ed[_0xaf5e('0x49')];if(!_0x565d99[_0xaf5e('0x33')][_0xaf5e('0x39')]('nolimit')){_0x1e6026[_0xaf5e('0x1c')]=qs[_0xaf5e('0x1c')](_0x565d99['query'][_0xaf5e('0x1c')]);_0x1e6026[_0xaf5e('0x1e')]=qs['offset'](_0x565d99[_0xaf5e('0x33')][_0xaf5e('0x1e')]);}return _0x562c66['getActions'](_0x1e6026);}})[_0xaf5e('0x24')](function(_0x505c34){if(_0x505c34){return _0x505c34?{'count':_0x3d08e5,'rows':_0x505c34}:null;}})['then'](respondWithResult(_0x5d5c5a,null))[_0xaf5e('0x46')](handleError(_0x5d5c5a,null));}; \ No newline at end of file +var _0xfbec=['../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','get','Triggers','UserProfileResource','status','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x4fbdc3,_0x49dc61){var _0x1b0ea7=function(_0x472d24){while(--_0x472d24){_0x4fbdc3['push'](_0x4fbdc3['shift']());}};_0x1b0ea7(++_0x49dc61);}(_0xfbec,0x16d));var _0xcfbe=function(_0x2daa93,_0x1bcc18){_0x2daa93=_0x2daa93-0x0;var _0x5bd6b8=_0xfbec[_0x2daa93];return _0x5bd6b8;};'use strict';var emlformat=require(_0xcfbe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcfbe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfbe('0x2'));var moment=require(_0xcfbe('0x3'));var BPromise=require(_0xcfbe('0x4'));var Mustache=require(_0xcfbe('0x5'));var util=require(_0xcfbe('0x6'));var path=require(_0xcfbe('0x7'));var sox=require('sox');var csv=require(_0xcfbe('0x8'));var ejs=require(_0xcfbe('0x9'));var fs=require('fs');var fs_extra=require(_0xcfbe('0xa'));var _=require(_0xcfbe('0xb'));var squel=require(_0xcfbe('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcfbe('0xd'));var toCsv=require(_0xcfbe('0x8'));var querystring=require(_0xcfbe('0xe'));var Papa=require(_0xcfbe('0xf'));var Redis=require(_0xcfbe('0x10'));var authService=require(_0xcfbe('0x11'));var qs=require(_0xcfbe('0x12'));var as=require(_0xcfbe('0x13'));var hardwareService=require(_0xcfbe('0x14'));var logger=require('../../config/logger')(_0xcfbe('0x15'));var utils=require(_0xcfbe('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcfbe('0x17'));var db=require(_0xcfbe('0x18'))['db'];function respondWithStatusCode(_0x5cdb76,_0x459ed7){_0x459ed7=_0x459ed7||0xcc;return function(_0x21f5c7){if(_0x21f5c7){return _0x5cdb76[_0xcfbe('0x19')](_0x459ed7);}return _0x5cdb76['status'](_0x459ed7)[_0xcfbe('0x1a')]();};}function respondWithResult(_0x34bc83,_0x595f1d){_0x595f1d=_0x595f1d||0xc8;return function(_0x28ac6a){if(_0x28ac6a){return _0x34bc83['status'](_0x595f1d)[_0xcfbe('0x1b')](_0x28ac6a);}};}function respondWithFilteredResult(_0x174e65,_0x5c51e5){return function(_0x40c49b){if(_0x40c49b){var _0x5d3a15=typeof _0x5c51e5[_0xcfbe('0x1c')]===_0xcfbe('0x1d')&&typeof _0x5c51e5[_0xcfbe('0x1e')]===_0xcfbe('0x1d');var _0x5f5665=_0x40c49b[_0xcfbe('0x1f')];var _0x550dd3=_0x5d3a15?0x0:_0x5c51e5['offset'];var _0x20c435=_0x5d3a15?_0x40c49b['count']:_0x5c51e5[_0xcfbe('0x1c')]+_0x5c51e5['limit'];var _0x4d1c91;if(_0x20c435>=_0x5f5665){_0x20c435=_0x5f5665;_0x4d1c91=0xc8;}else{_0x4d1c91=0xce;}_0x174e65['status'](_0x4d1c91);return _0x174e65['set'](_0xcfbe('0x20'),_0x550dd3+'-'+_0x20c435+'/'+_0x5f5665)[_0xcfbe('0x1b')](_0x40c49b);}return null;};}function patchUpdates(_0x4d74fe){return function(_0x222f15){try{jsonpatch[_0xcfbe('0x21')](_0x222f15,_0x4d74fe,!![]);}catch(_0x8208e8){return BPromise['reject'](_0x8208e8);}return _0x222f15[_0xcfbe('0x22')]();};}function saveUpdates(_0x3f640b,_0x141e05){return function(_0x17eeac){if(_0x17eeac){return _0x17eeac['update'](_0x3f640b)[_0xcfbe('0x23')](function(_0x21c06e){return _0x21c06e;});}return null;};}function removeEntity(_0x3c1815,_0x441217){return function(_0x31e1f5){if(_0x31e1f5){return _0x31e1f5['destroy']()['then'](function(){var _0x3e2896=_0x31e1f5[_0xcfbe('0x24')]({'plain':!![]});var _0x1aa277=_0xcfbe('0x25');return db[_0xcfbe('0x26')]['destroy']({'where':{'type':_0x1aa277,'resourceId':_0x3e2896['id']}})[_0xcfbe('0x23')](function(){return _0x31e1f5;});})['then'](function(){_0x3c1815[_0xcfbe('0x27')](0xcc)[_0xcfbe('0x1a')]();});}};}function handleEntityNotFound(_0x518896,_0x2bd08c){return function(_0x43edab){if(!_0x43edab){_0x518896[_0xcfbe('0x19')](0x194);}return _0x43edab;};}function handleError(_0x21332d,_0x770d8){_0x770d8=_0x770d8||0x1f4;return function(_0x4238e2){logger[_0xcfbe('0x28')](_0x4238e2[_0xcfbe('0x29')]);if(_0x4238e2[_0xcfbe('0x2a')]){delete _0x4238e2[_0xcfbe('0x2a')];}_0x21332d['status'](_0x770d8)[_0xcfbe('0x2b')](_0x4238e2);};}exports[_0xcfbe('0x2c')]=function(_0x4539e7,_0xe332a2){var _0xa885f5={},_0x4fddf1={},_0x5dd55a={'count':0x0,'rows':[]};var _0x5906c9=_[_0xcfbe('0x2d')](db[_0xcfbe('0x2e')][_0xcfbe('0x2f')],function(_0x2f71d1){return{'name':_0x2f71d1[_0xcfbe('0x30')],'type':_0x2f71d1[_0xcfbe('0x31')][_0xcfbe('0x32')]};});_0x4fddf1['model']=_[_0xcfbe('0x2d')](_0x5906c9,_0xcfbe('0x2a'));_0x4fddf1[_0xcfbe('0x33')]=_[_0xcfbe('0x34')](_0x4539e7[_0xcfbe('0x33')]);_0x4fddf1[_0xcfbe('0x35')]=_[_0xcfbe('0x36')](_0x4fddf1[_0xcfbe('0x37')],_0x4fddf1[_0xcfbe('0x33')]);_0xa885f5[_0xcfbe('0x38')]=_[_0xcfbe('0x36')](_0x4fddf1[_0xcfbe('0x37')],qs[_0xcfbe('0x39')](_0x4539e7[_0xcfbe('0x33')][_0xcfbe('0x39')]));_0xa885f5[_0xcfbe('0x38')]=_0xa885f5[_0xcfbe('0x38')][_0xcfbe('0x3a')]?_0xa885f5[_0xcfbe('0x38')]:_0x4fddf1[_0xcfbe('0x37')];if(!_0x4539e7[_0xcfbe('0x33')]['hasOwnProperty'](_0xcfbe('0x3b'))){_0xa885f5[_0xcfbe('0x1e')]=qs['limit'](_0x4539e7[_0xcfbe('0x33')][_0xcfbe('0x1e')]);_0xa885f5[_0xcfbe('0x1c')]=qs['offset'](_0x4539e7[_0xcfbe('0x33')][_0xcfbe('0x1c')]);}_0xa885f5[_0xcfbe('0x3c')]=qs[_0xcfbe('0x3d')](_0x4539e7['query']['sort']);_0xa885f5[_0xcfbe('0x3e')]=qs[_0xcfbe('0x35')](_[_0xcfbe('0x3f')](_0x4539e7[_0xcfbe('0x33')],_0x4fddf1[_0xcfbe('0x35')]),_0x5906c9);if(_0x4539e7[_0xcfbe('0x33')][_0xcfbe('0x40')]){_0xa885f5[_0xcfbe('0x3e')]=_['merge'](_0xa885f5[_0xcfbe('0x3e')],{'$or':_['map'](_0x5906c9,function(_0xfa5971){if(_0xfa5971[_0xcfbe('0x31')]!=='VIRTUAL'){var _0x1826a2={};_0x1826a2[_0xfa5971[_0xcfbe('0x2a')]]={'$like':'%'+_0x4539e7['query'][_0xcfbe('0x40')]+'%'};return _0x1826a2;}})});}_0xa885f5=_[_0xcfbe('0x41')]({},_0xa885f5,_0x4539e7[_0xcfbe('0x42')]);var _0x576413={'where':_0xa885f5[_0xcfbe('0x3e')]};return db[_0xcfbe('0x2e')][_0xcfbe('0x1f')](_0x576413)['then'](function(_0x48e809){_0x5dd55a['count']=_0x48e809;if(_0x4539e7[_0xcfbe('0x33')]['includeAll']){_0xa885f5[_0xcfbe('0x43')]=[{'all':!![]}];}return db[_0xcfbe('0x2e')][_0xcfbe('0x44')](_0xa885f5);})[_0xcfbe('0x23')](function(_0x1e4400){_0x5dd55a[_0xcfbe('0x45')]=_0x1e4400;return _0x5dd55a;})[_0xcfbe('0x23')](respondWithFilteredResult(_0xe332a2,_0xa885f5))[_0xcfbe('0x46')](handleError(_0xe332a2,null));};exports['show']=function(_0x264c59,_0x162c2d){var _0x39a852={'raw':![],'where':{'id':_0x264c59[_0xcfbe('0x47')]['id']}},_0xfc84bd={};_0xfc84bd[_0xcfbe('0x37')]=_[_0xcfbe('0x34')](db[_0xcfbe('0x2e')][_0xcfbe('0x2f')]);_0xfc84bd['query']=_[_0xcfbe('0x34')](_0x264c59[_0xcfbe('0x33')]);_0xfc84bd[_0xcfbe('0x35')]=_['intersection'](_0xfc84bd['model'],_0xfc84bd['query']);_0x39a852[_0xcfbe('0x38')]=_[_0xcfbe('0x36')](_0xfc84bd[_0xcfbe('0x37')],qs['fields'](_0x264c59['query']['fields']));_0x39a852['attributes']=_0x39a852['attributes'][_0xcfbe('0x3a')]?_0x39a852[_0xcfbe('0x38')]:_0xfc84bd[_0xcfbe('0x37')];if(_0x264c59[_0xcfbe('0x33')][_0xcfbe('0x48')]){_0x39a852[_0xcfbe('0x43')]=[{'all':!![]}];}_0x39a852=_[_0xcfbe('0x41')]({},_0x39a852,_0x264c59[_0xcfbe('0x42')]);return db['Trigger'][_0xcfbe('0x49')](_0x39a852)[_0xcfbe('0x23')](handleEntityNotFound(_0x162c2d,null))[_0xcfbe('0x23')](respondWithResult(_0x162c2d,null))['catch'](handleError(_0x162c2d,null));};exports[_0xcfbe('0x4a')]=function(_0x159a22,_0x5d5521){return db['Trigger'][_0xcfbe('0x4a')](_0x159a22[_0xcfbe('0x4b')],{})['then'](function(_0x3cb095){var _0x19a0d3=_0x159a22[_0xcfbe('0x4c')][_0xcfbe('0x24')]({'plain':!![]});if(!_0x19a0d3)throw new Error(_0xcfbe('0x4d'));if(_0x19a0d3[_0xcfbe('0x4e')]===_0xcfbe('0x4c')){var _0x1eaf1f=_0x3cb095[_0xcfbe('0x24')]({'plain':!![]});var _0x35a7fb=_0xcfbe('0x25');return db[_0xcfbe('0x4f')]['find']({'where':{'name':_0x35a7fb,'userProfileId':_0x19a0d3[_0xcfbe('0x50')]},'raw':!![]})['then'](function(_0x318532){if(_0x318532&&_0x318532[_0xcfbe('0x51')]===0x0){return db[_0xcfbe('0x26')][_0xcfbe('0x4a')]({'name':_0x1eaf1f[_0xcfbe('0x2a')],'resourceId':_0x1eaf1f['id'],'type':_0x318532[_0xcfbe('0x2a')],'sectionId':_0x318532['id']},{})[_0xcfbe('0x23')](function(){return _0x3cb095;});}else{return _0x3cb095;}})[_0xcfbe('0x46')](function(_0x3a0b05){logger['error'](_0xcfbe('0x52'),_0x3a0b05);throw _0x3a0b05;});}return _0x3cb095;})['then'](respondWithResult(_0x5d5521,0xc9))[_0xcfbe('0x46')](handleError(_0x5d5521,null));};exports[_0xcfbe('0x53')]=function(_0x484ff3,_0x376450){if(_0x484ff3[_0xcfbe('0x4b')]['id']){delete _0x484ff3['body']['id'];}return db[_0xcfbe('0x2e')]['find']({'where':{'id':_0x484ff3['params']['id']}})[_0xcfbe('0x23')](handleEntityNotFound(_0x376450,null))['then'](saveUpdates(_0x484ff3['body'],null))[_0xcfbe('0x23')](respondWithResult(_0x376450,null))['catch'](handleError(_0x376450,null));};exports[_0xcfbe('0x54')]=function(_0x3d8dca,_0x1b0457){return db[_0xcfbe('0x2e')][_0xcfbe('0x49')]({'where':{'id':_0x3d8dca['params']['id']}})[_0xcfbe('0x23')](handleEntityNotFound(_0x1b0457,null))[_0xcfbe('0x23')](removeEntity(_0x1b0457,null))[_0xcfbe('0x46')](handleError(_0x1b0457,null));};exports[_0xcfbe('0x55')]=function(_0x4edcfb,_0x5bf1c3,_0x5499ab){if(_0x4edcfb[_0xcfbe('0x4b')]['id']){delete _0x4edcfb['body']['id'];}return db[_0xcfbe('0x2e')]['find']({'where':{'id':_0x4edcfb[_0xcfbe('0x47')]['id']}})['then'](handleEntityNotFound(_0x5bf1c3,null))['then'](function(_0x1e8898){if(_0x1e8898){_0x4edcfb[_0xcfbe('0x4b')]['TriggerAllId']=_0x1e8898['id'];return db[_0xcfbe('0x56')][_0xcfbe('0x4a')](_0x4edcfb[_0xcfbe('0x4b')]);}})[_0xcfbe('0x23')](respondWithResult(_0x5bf1c3,null))['catch'](handleError(_0x5bf1c3,null));};exports[_0xcfbe('0x57')]=function(_0x3c71d1,_0x1e16a3,_0x2c6a28){if(_0x3c71d1['body']['id']){delete _0x3c71d1[_0xcfbe('0x4b')]['id'];}return db[_0xcfbe('0x2e')][_0xcfbe('0x49')]({'where':{'id':_0x3c71d1[_0xcfbe('0x47')]['id']}})[_0xcfbe('0x23')](handleEntityNotFound(_0x1e16a3,null))['then'](function(_0x22931b){if(_0x22931b){_0x3c71d1['body'][_0xcfbe('0x58')]=_0x22931b['id'];return db[_0xcfbe('0x56')][_0xcfbe('0x4a')](_0x3c71d1[_0xcfbe('0x4b')]);}})['then'](respondWithResult(_0x1e16a3,null))['catch'](handleError(_0x1e16a3,null));};exports[_0xcfbe('0x59')]=function(_0x52b7e3,_0x2dc5ef,_0x5530b6){var _0x2d4667={};var _0x1acb81={};var _0x43a1a9;var _0x5c9a9a;return db[_0xcfbe('0x2e')][_0xcfbe('0x5a')]({'where':{'id':_0x52b7e3['params']['id']}})[_0xcfbe('0x23')](handleEntityNotFound(_0x2dc5ef,null))[_0xcfbe('0x23')](function(_0x1aedcf){if(_0x1aedcf){_0x43a1a9=_0x1aedcf;_0x1acb81[_0xcfbe('0x37')]=_[_0xcfbe('0x34')](db['Condition'][_0xcfbe('0x2f')]);_0x1acb81[_0xcfbe('0x33')]=_[_0xcfbe('0x34')](_0x52b7e3['query']);_0x1acb81['filters']=_[_0xcfbe('0x36')](_0x1acb81['model'],_0x1acb81['query']);_0x2d4667[_0xcfbe('0x38')]=_[_0xcfbe('0x36')](_0x1acb81[_0xcfbe('0x37')],qs['fields'](_0x52b7e3[_0xcfbe('0x33')][_0xcfbe('0x39')]));_0x2d4667[_0xcfbe('0x38')]=_0x2d4667['attributes'][_0xcfbe('0x3a')]?_0x2d4667[_0xcfbe('0x38')]:_0x1acb81[_0xcfbe('0x37')];_0x2d4667[_0xcfbe('0x3c')]=qs[_0xcfbe('0x3d')](_0x52b7e3[_0xcfbe('0x33')][_0xcfbe('0x3d')]);_0x2d4667[_0xcfbe('0x3e')]=qs['filters'](_[_0xcfbe('0x3f')](_0x52b7e3['query'],_0x1acb81[_0xcfbe('0x35')]));if(_0x52b7e3[_0xcfbe('0x33')][_0xcfbe('0x40')]){_0x2d4667['where']=_[_0xcfbe('0x41')](_0x2d4667[_0xcfbe('0x3e')],{'$or':_[_0xcfbe('0x2d')](_0x2d4667['attributes'],function(_0x5796d5){var _0x54f81f={};_0x54f81f[_0x5796d5]={'$like':'%'+_0x52b7e3[_0xcfbe('0x33')][_0xcfbe('0x40')]+'%'};return _0x54f81f;})});}_0x2d4667=_[_0xcfbe('0x41')]({},_0x2d4667,_0x52b7e3[_0xcfbe('0x42')]);return _0x43a1a9[_0xcfbe('0x59')](_0x2d4667);}})[_0xcfbe('0x23')](function(_0x20df20){if(_0x20df20){_0x5c9a9a=_0x20df20[_0xcfbe('0x3a')];if(!_0x52b7e3['query'][_0xcfbe('0x5b')](_0xcfbe('0x3b'))){_0x2d4667['limit']=qs['limit'](_0x52b7e3[_0xcfbe('0x33')][_0xcfbe('0x1e')]);_0x2d4667[_0xcfbe('0x1c')]=qs[_0xcfbe('0x1c')](_0x52b7e3[_0xcfbe('0x33')][_0xcfbe('0x1c')]);}return _0x43a1a9['getAllConditions'](_0x2d4667);}})['then'](function(_0x45bff5){if(_0x45bff5){return _0x45bff5?{'count':_0x5c9a9a,'rows':_0x45bff5}:null;}})['then'](respondWithResult(_0x2dc5ef,null))['catch'](handleError(_0x2dc5ef,null));};exports['getAnyConditions']=function(_0x598375,_0x28e2c9,_0x3e4da8){var _0x33a637={};var _0x213f72={};var _0x21fc3b;var _0x1149d5;return db[_0xcfbe('0x2e')][_0xcfbe('0x5a')]({'where':{'id':_0x598375[_0xcfbe('0x47')]['id']}})['then'](handleEntityNotFound(_0x28e2c9,null))[_0xcfbe('0x23')](function(_0x303879){if(_0x303879){_0x21fc3b=_0x303879;_0x213f72[_0xcfbe('0x37')]=_[_0xcfbe('0x34')](db[_0xcfbe('0x56')][_0xcfbe('0x2f')]);_0x213f72[_0xcfbe('0x33')]=_[_0xcfbe('0x34')](_0x598375[_0xcfbe('0x33')]);_0x213f72[_0xcfbe('0x35')]=_['intersection'](_0x213f72['model'],_0x213f72[_0xcfbe('0x33')]);_0x33a637[_0xcfbe('0x38')]=_[_0xcfbe('0x36')](_0x213f72[_0xcfbe('0x37')],qs['fields'](_0x598375['query'][_0xcfbe('0x39')]));_0x33a637[_0xcfbe('0x38')]=_0x33a637[_0xcfbe('0x38')][_0xcfbe('0x3a')]?_0x33a637['attributes']:_0x213f72[_0xcfbe('0x37')];_0x33a637[_0xcfbe('0x3c')]=qs['sort'](_0x598375['query'][_0xcfbe('0x3d')]);_0x33a637[_0xcfbe('0x3e')]=qs['filters'](_[_0xcfbe('0x3f')](_0x598375['query'],_0x213f72[_0xcfbe('0x35')]));if(_0x598375[_0xcfbe('0x33')][_0xcfbe('0x40')]){_0x33a637[_0xcfbe('0x3e')]=_[_0xcfbe('0x41')](_0x33a637[_0xcfbe('0x3e')],{'$or':_[_0xcfbe('0x2d')](_0x33a637[_0xcfbe('0x38')],function(_0x22bae1){var _0x3c1281={};_0x3c1281[_0x22bae1]={'$like':'%'+_0x598375['query']['filter']+'%'};return _0x3c1281;})});}_0x33a637=_['merge']({},_0x33a637,_0x598375[_0xcfbe('0x42')]);return _0x21fc3b[_0xcfbe('0x5c')](_0x33a637);}})[_0xcfbe('0x23')](function(_0x9705ba){if(_0x9705ba){_0x1149d5=_0x9705ba[_0xcfbe('0x3a')];if(!_0x598375[_0xcfbe('0x33')][_0xcfbe('0x5b')](_0xcfbe('0x3b'))){_0x33a637[_0xcfbe('0x1e')]=qs[_0xcfbe('0x1e')](_0x598375[_0xcfbe('0x33')][_0xcfbe('0x1e')]);_0x33a637['offset']=qs[_0xcfbe('0x1c')](_0x598375[_0xcfbe('0x33')]['offset']);}return _0x21fc3b[_0xcfbe('0x5c')](_0x33a637);}})[_0xcfbe('0x23')](function(_0x461a5d){if(_0x461a5d){return _0x461a5d?{'count':_0x1149d5,'rows':_0x461a5d}:null;}})['then'](respondWithResult(_0x28e2c9,null))[_0xcfbe('0x46')](handleError(_0x28e2c9,null));};exports[_0xcfbe('0x5d')]=function(_0x56a417,_0x536171,_0x39d410){if(_0x56a417[_0xcfbe('0x4b')]['id']){delete _0x56a417[_0xcfbe('0x4b')]['id'];}return db[_0xcfbe('0x2e')][_0xcfbe('0x49')]({'where':{'id':_0x56a417[_0xcfbe('0x47')]['id']}})[_0xcfbe('0x23')](handleEntityNotFound(_0x536171,null))[_0xcfbe('0x23')](function(_0x583d63){if(_0x583d63){_0x56a417[_0xcfbe('0x4b')][_0xcfbe('0x5e')]=_0x583d63['id'];return db[_0xcfbe('0x5f')][_0xcfbe('0x4a')](_0x56a417[_0xcfbe('0x4b')]);}})['then'](respondWithResult(_0x536171,null))['catch'](handleError(_0x536171,null));};exports['getActions']=function(_0x58838d,_0x1fe62c,_0x6bace0){var _0x5e41bb={};var _0xdff6dc={};var _0x1a461d;var _0x59dadf;return db[_0xcfbe('0x2e')][_0xcfbe('0x5a')]({'where':{'id':_0x58838d['params']['id']}})[_0xcfbe('0x23')](handleEntityNotFound(_0x1fe62c,null))['then'](function(_0x5a543a){if(_0x5a543a){_0x1a461d=_0x5a543a;_0xdff6dc[_0xcfbe('0x37')]=_[_0xcfbe('0x34')](db[_0xcfbe('0x5f')]['rawAttributes']);_0xdff6dc[_0xcfbe('0x33')]=_[_0xcfbe('0x34')](_0x58838d[_0xcfbe('0x33')]);_0xdff6dc[_0xcfbe('0x35')]=_[_0xcfbe('0x36')](_0xdff6dc[_0xcfbe('0x37')],_0xdff6dc['query']);_0x5e41bb['attributes']=_[_0xcfbe('0x36')](_0xdff6dc['model'],qs[_0xcfbe('0x39')](_0x58838d[_0xcfbe('0x33')]['fields']));_0x5e41bb[_0xcfbe('0x38')]=_0x5e41bb[_0xcfbe('0x38')][_0xcfbe('0x3a')]?_0x5e41bb[_0xcfbe('0x38')]:_0xdff6dc[_0xcfbe('0x37')];_0x5e41bb['order']=qs['sort'](_0x58838d[_0xcfbe('0x33')][_0xcfbe('0x3d')]);_0x5e41bb[_0xcfbe('0x3e')]=qs[_0xcfbe('0x35')](_[_0xcfbe('0x3f')](_0x58838d[_0xcfbe('0x33')],_0xdff6dc[_0xcfbe('0x35')]));if(_0x58838d[_0xcfbe('0x33')][_0xcfbe('0x40')]){_0x5e41bb['where']=_[_0xcfbe('0x41')](_0x5e41bb[_0xcfbe('0x3e')],{'$or':_[_0xcfbe('0x2d')](_0x5e41bb[_0xcfbe('0x38')],function(_0x507ae8){var _0x5aaaef={};_0x5aaaef[_0x507ae8]={'$like':'%'+_0x58838d[_0xcfbe('0x33')][_0xcfbe('0x40')]+'%'};return _0x5aaaef;})});}_0x5e41bb=_[_0xcfbe('0x41')]({},_0x5e41bb,_0x58838d[_0xcfbe('0x42')]);return _0x1a461d[_0xcfbe('0x60')](_0x5e41bb);}})['then'](function(_0x215b97){if(_0x215b97){_0x59dadf=_0x215b97[_0xcfbe('0x3a')];if(!_0x58838d['query'][_0xcfbe('0x5b')](_0xcfbe('0x3b'))){_0x5e41bb[_0xcfbe('0x1e')]=qs[_0xcfbe('0x1e')](_0x58838d[_0xcfbe('0x33')][_0xcfbe('0x1e')]);_0x5e41bb['offset']=qs[_0xcfbe('0x1c')](_0x58838d['query']['offset']);}return _0x1a461d[_0xcfbe('0x60')](_0x5e41bb);}})[_0xcfbe('0x23')](function(_0x16d4f0){if(_0x16d4f0){return _0x16d4f0?{'count':_0x59dadf,'rows':_0x16d4f0}:null;}})['then'](respondWithResult(_0x1fe62c,null))['catch'](handleError(_0x1fe62c,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 5ce62b3..250cdd7 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 _0x4b1f=['api','moment','bluebird','path','rimraf','../../config/environment','define','Trigger','tools_triggers','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4b1f,0x195));var _0xf4b1=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x4b1f[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var logger=require('../../config/logger')(_0xf4b1('0x2'));var moment=require(_0xf4b1('0x3'));var BPromise=require(_0xf4b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4b1('0x5'));var rimraf=require(_0xf4b1('0x6'));var config=require(_0xf4b1('0x7'));var attributes=require('./trigger.attributes');module['exports']=function(_0x1ab96b,_0x4b676){return _0x1ab96b[_0xf4b1('0x8')](_0xf4b1('0x9'),attributes,{'tableName':_0xf4b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fef=['path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','lodash','util','api','bluebird','request-promise'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x4fef,0x10f));var _0xf4fe=function(_0xea47b9,_0x12aa17){_0xea47b9=_0xea47b9-0x0;var _0xae61ad=_0x4fef[_0xea47b9];return _0xae61ad;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var logger=require('../../config/logger')(_0xf4fe('0x2'));var moment=require('moment');var BPromise=require(_0xf4fe('0x3'));var rp=require(_0xf4fe('0x4'));var fs=require('fs');var path=require(_0xf4fe('0x5'));var rimraf=require(_0xf4fe('0x6'));var config=require(_0xf4fe('0x7'));var attributes=require(_0xf4fe('0x8'));module[_0xf4fe('0x9')]=function(_0x27c6c9,_0x522427){return _0x27c6c9[_0xf4fe('0xa')](_0xf4fe('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index f6b963a..24ab05d 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 _0x54d6=['client','request','info','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x6ec41e,_0x49779b){var _0x53ca48=function(_0x47ac46){while(--_0x47ac46){_0x6ec41e['push'](_0x6ec41e['shift']());}};_0x53ca48(++_0x49779b);}(_0x54d6,0x1bd));var _0x654d=function(_0xcfbed,_0x454c06){_0xcfbed=_0xcfbed-0x0;var _0x4c153a=_0x54d6[_0xcfbed];return _0x4c153a;};'use strict';var _=require(_0x654d('0x0'));var util=require(_0x654d('0x1'));var moment=require(_0x654d('0x2'));var BPromise=require(_0x654d('0x3'));var rs=require(_0x654d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x654d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x654d('0x6'))(_0x654d('0x7'));var config=require(_0x654d('0x8'));var jayson=require(_0x654d('0x9'));var client=jayson[_0x654d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f2adf,_0x12ad58,_0x462622){return new BPromise(function(_0x1dbca9,_0x2f7a26){return client[_0x654d('0xb')](_0x5f2adf,_0x462622)['then'](function(_0x31dd99){logger[_0x654d('0xc')](_0x654d('0xd'),_0x12ad58,'request\x20sent');logger['debug'](_0x654d('0xe'),_0x12ad58,'request\x20sent',JSON[_0x654d('0xf')](_0x31dd99));if(_0x31dd99[_0x654d('0x10')]){if(_0x31dd99[_0x654d('0x10')]['code']===0x1f4){logger[_0x654d('0x10')](_0x654d('0xd'),_0x12ad58,_0x31dd99['error'][_0x654d('0x11')]);return _0x2f7a26(_0x31dd99['error'][_0x654d('0x11')]);}logger['error'](_0x654d('0xd'),_0x12ad58,_0x31dd99[_0x654d('0x10')][_0x654d('0x11')]);return _0x1dbca9(_0x31dd99['error'][_0x654d('0x11')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x12ad58,_0x654d('0x12'));_0x1dbca9(_0x31dd99[_0x654d('0x13')][_0x654d('0x11')]);}})[_0x654d('0x14')](function(_0x3747a6){logger[_0x654d('0x10')](_0x654d('0xd'),_0x12ad58,_0x3747a6);_0x2f7a26(_0x3747a6);});});}exports[_0x654d('0x15')]=function(_0x14adfc){var _0x580d09=this;return new Promise(function(_0x22f82e,_0xdd28b3){return db[_0x654d('0x16')][_0x654d('0x17')]({'raw':_0x14adfc[_0x654d('0x18')]?_0x14adfc[_0x654d('0x18')][_0x654d('0x19')]===undefined?!![]:![]:!![],'where':_0x14adfc['options']?_0x14adfc[_0x654d('0x18')][_0x654d('0x1a')]||null:null,'attributes':_0x14adfc[_0x654d('0x18')]?_0x14adfc[_0x654d('0x18')][_0x654d('0x1b')]||null:null,'limit':_0x14adfc[_0x654d('0x18')]?_0x14adfc['options'][_0x654d('0x1c')]||null:null,'include':_0x14adfc[_0x654d('0x18')]?_0x14adfc[_0x654d('0x18')][_0x654d('0x1d')]?_[_0x654d('0x1e')](_0x14adfc[_0x654d('0x18')][_0x654d('0x1d')],function(_0x183881){return{'model':db[_0x183881['model']],'as':_0x183881['as'],'attributes':_0x183881['attributes'],'include':_0x183881[_0x654d('0x1d')]?_[_0x654d('0x1e')](_0x183881[_0x654d('0x1d')],function(_0x59b0dd){return{'model':db[_0x59b0dd[_0x654d('0x1f')]],'as':_0x59b0dd['as'],'attributes':_0x59b0dd['attributes'],'include':_0x59b0dd[_0x654d('0x1d')]?_[_0x654d('0x1e')](_0x59b0dd[_0x654d('0x1d')],function(_0x29dfb4){return{'model':db[_0x29dfb4[_0x654d('0x1f')]],'as':_0x29dfb4['as'],'attributes':_0x29dfb4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f33da){logger[_0x654d('0xc')](_0x654d('0x15'),_0x14adfc);logger[_0x654d('0x20')]('GetTrigger',_0x14adfc,JSON[_0x654d('0xf')](_0x1f33da));_0x22f82e(_0x1f33da);})[_0x654d('0x14')](function(_0x5559b8){logger[_0x654d('0x10')](_0x654d('0x15'),_0x5559b8['message'],_0x14adfc);_0xdd28b3(_0x580d09[_0x654d('0x10')](0x1f4,_0x5559b8[_0x654d('0x11')]));});});};exports[_0x654d('0x21')]=function(_0x7a6051){var _0x52492=this;return new Promise(function(_0xebb910,_0x48837e){return db['Trigger'][_0x654d('0x22')]({'raw':_0x7a6051[_0x654d('0x18')]?_0x7a6051[_0x654d('0x18')][_0x654d('0x19')]===undefined?!![]:![]:!![],'where':_0x7a6051[_0x654d('0x18')]?_0x7a6051[_0x654d('0x18')]['where']||null:null,'attributes':_0x7a6051[_0x654d('0x18')]?_0x7a6051['options'][_0x654d('0x1b')]||null:null,'include':_0x7a6051['options']?_0x7a6051['options'][_0x654d('0x1d')]?_['map'](_0x7a6051[_0x654d('0x18')]['include'],function(_0x36078c){return{'model':db[_0x36078c[_0x654d('0x1f')]],'as':_0x36078c['as'],'attributes':_0x36078c[_0x654d('0x1b')],'include':_0x36078c[_0x654d('0x1d')]?_[_0x654d('0x1e')](_0x36078c[_0x654d('0x1d')],function(_0x15134f){return{'model':db[_0x15134f['model']],'as':_0x15134f['as'],'attributes':_0x15134f[_0x654d('0x1b')],'include':_0x15134f[_0x654d('0x1d')]?_[_0x654d('0x1e')](_0x15134f['include'],function(_0x2a9a5b){return{'model':db[_0x2a9a5b[_0x654d('0x1f')]],'as':_0x2a9a5b['as'],'attributes':_0x2a9a5b[_0x654d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51c79){logger['info'](_0x654d('0x21'),_0x7a6051);logger[_0x654d('0x20')](_0x654d('0x21'),_0x7a6051,JSON[_0x654d('0xf')](_0x51c79));_0xebb910(_0x51c79);})[_0x654d('0x14')](function(_0x3008fc){logger[_0x654d('0x10')](_0x654d('0x21'),_0x3008fc[_0x654d('0x11')],_0x7a6051);_0x48837e(_0x52492[_0x654d('0x10')](0x1f4,_0x3008fc[_0x654d('0x11')]));});});}; \ No newline at end of file +var _0x6bc5=['GetTrigger','catch','ShowTrigger','find','then','lodash','util','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','Trigger','findAll','options','raw','where','map','include','attributes','model'];(function(_0x3a4128,_0x5c9817){var _0x34e314=function(_0x36e51f){while(--_0x36e51f){_0x3a4128['push'](_0x3a4128['shift']());}};_0x34e314(++_0x5c9817);}(_0x6bc5,0x11c));var _0x56bc=function(_0x27fe77,_0x3fa847){_0x27fe77=_0x27fe77-0x0;var _0x29098a=_0x6bc5[_0x27fe77];return _0x29098a;};'use strict';var _=require(_0x56bc('0x0'));var util=require(_0x56bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56bc('0x2'))['db'];var utils=require(_0x56bc('0x3'));var logger=require(_0x56bc('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x56bc('0x5'));var client=jayson[_0x56bc('0x6')][_0x56bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23ad75,_0x32c791,_0x52d960){return new BPromise(function(_0x1d477e,_0x4b2d24){return client['request'](_0x23ad75,_0x52d960)['then'](function(_0x2ac061){logger[_0x56bc('0x8')](_0x56bc('0x9'),_0x32c791,_0x56bc('0xa'));logger[_0x56bc('0xb')](_0x56bc('0xc'),_0x32c791,_0x56bc('0xa'),JSON['stringify'](_0x2ac061));if(_0x2ac061['error']){if(_0x2ac061[_0x56bc('0xd')][_0x56bc('0xe')]===0x1f4){logger[_0x56bc('0xd')](_0x56bc('0x9'),_0x32c791,_0x2ac061[_0x56bc('0xd')]['message']);return _0x4b2d24(_0x2ac061['error'][_0x56bc('0xf')]);}logger[_0x56bc('0xd')](_0x56bc('0x9'),_0x32c791,_0x2ac061[_0x56bc('0xd')]['message']);return _0x1d477e(_0x2ac061[_0x56bc('0xd')][_0x56bc('0xf')]);}else{logger[_0x56bc('0x8')](_0x56bc('0x9'),_0x32c791,_0x56bc('0xa'));_0x1d477e(_0x2ac061[_0x56bc('0x10')][_0x56bc('0xf')]);}})['catch'](function(_0x537bd0){logger[_0x56bc('0xd')](_0x56bc('0x9'),_0x32c791,_0x537bd0);_0x4b2d24(_0x537bd0);});});}exports['GetTrigger']=function(_0x4e546c){var _0x5fe758=this;return new Promise(function(_0x3233b9,_0x49cccf){return db[_0x56bc('0x11')][_0x56bc('0x12')]({'raw':_0x4e546c[_0x56bc('0x13')]?_0x4e546c[_0x56bc('0x13')][_0x56bc('0x14')]===undefined?!![]:![]:!![],'where':_0x4e546c[_0x56bc('0x13')]?_0x4e546c[_0x56bc('0x13')][_0x56bc('0x15')]||null:null,'attributes':_0x4e546c[_0x56bc('0x13')]?_0x4e546c[_0x56bc('0x13')]['attributes']||null:null,'limit':_0x4e546c[_0x56bc('0x13')]?_0x4e546c[_0x56bc('0x13')]['limit']||null:null,'include':_0x4e546c[_0x56bc('0x13')]?_0x4e546c[_0x56bc('0x13')]['include']?_[_0x56bc('0x16')](_0x4e546c[_0x56bc('0x13')][_0x56bc('0x17')],function(_0x2ab5c6){return{'model':db[_0x2ab5c6['model']],'as':_0x2ab5c6['as'],'attributes':_0x2ab5c6[_0x56bc('0x18')],'include':_0x2ab5c6[_0x56bc('0x17')]?_[_0x56bc('0x16')](_0x2ab5c6[_0x56bc('0x17')],function(_0x4dce02){return{'model':db[_0x4dce02[_0x56bc('0x19')]],'as':_0x4dce02['as'],'attributes':_0x4dce02[_0x56bc('0x18')],'include':_0x4dce02['include']?_[_0x56bc('0x16')](_0x4dce02[_0x56bc('0x17')],function(_0x4fc734){return{'model':db[_0x4fc734[_0x56bc('0x19')]],'as':_0x4fc734['as'],'attributes':_0x4fc734[_0x56bc('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d3dae){logger[_0x56bc('0x8')](_0x56bc('0x1a'),_0x4e546c);logger[_0x56bc('0xb')](_0x56bc('0x1a'),_0x4e546c,JSON['stringify'](_0x5d3dae));_0x3233b9(_0x5d3dae);})[_0x56bc('0x1b')](function(_0x5c93a6){logger[_0x56bc('0xd')]('GetTrigger',_0x5c93a6['message'],_0x4e546c);_0x49cccf(_0x5fe758[_0x56bc('0xd')](0x1f4,_0x5c93a6[_0x56bc('0xf')]));});});};exports[_0x56bc('0x1c')]=function(_0x504422){var _0x2f0d80=this;return new Promise(function(_0x3c4bff,_0x2a9c77){return db['Trigger'][_0x56bc('0x1d')]({'raw':_0x504422['options']?_0x504422['options'][_0x56bc('0x14')]===undefined?!![]:![]:!![],'where':_0x504422['options']?_0x504422[_0x56bc('0x13')]['where']||null:null,'attributes':_0x504422[_0x56bc('0x13')]?_0x504422[_0x56bc('0x13')]['attributes']||null:null,'include':_0x504422[_0x56bc('0x13')]?_0x504422[_0x56bc('0x13')][_0x56bc('0x17')]?_[_0x56bc('0x16')](_0x504422[_0x56bc('0x13')][_0x56bc('0x17')],function(_0x4c4365){return{'model':db[_0x4c4365[_0x56bc('0x19')]],'as':_0x4c4365['as'],'attributes':_0x4c4365[_0x56bc('0x18')],'include':_0x4c4365[_0x56bc('0x17')]?_[_0x56bc('0x16')](_0x4c4365[_0x56bc('0x17')],function(_0xdf8bc7){return{'model':db[_0xdf8bc7[_0x56bc('0x19')]],'as':_0xdf8bc7['as'],'attributes':_0xdf8bc7[_0x56bc('0x18')],'include':_0xdf8bc7[_0x56bc('0x17')]?_[_0x56bc('0x16')](_0xdf8bc7[_0x56bc('0x17')],function(_0x28a57f){return{'model':db[_0x28a57f[_0x56bc('0x19')]],'as':_0x28a57f['as'],'attributes':_0x28a57f[_0x56bc('0x18')]};}):[]};}):[]};}):[]:[]})[_0x56bc('0x1e')](function(_0x53667f){logger[_0x56bc('0x8')](_0x56bc('0x1c'),_0x504422);logger[_0x56bc('0xb')]('ShowTrigger',_0x504422,JSON['stringify'](_0x53667f));_0x3c4bff(_0x53667f);})[_0x56bc('0x1b')](function(_0x204216){logger[_0x56bc('0xd')](_0x56bc('0x1c'),_0x204216[_0x56bc('0xf')],_0x504422);_0x2a9c77(_0x2f0d80[_0x56bc('0xd')](0x1f4,_0x204216[_0x56bc('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index d177533..fbe7020 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 _0xbf7e=['Router','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xbf7e,0x1b3));var _0xebf7=function(_0x4000eb,_0x3a0b97){_0x4000eb=_0x4000eb-0x0;var _0x27ee47=_0xbf7e[_0x4000eb];return _0x27ee47;};'use strict';var multer=require(_0xebf7('0x0'));var util=require(_0xebf7('0x1'));var path=require(_0xebf7('0x2'));var timeout=require(_0xebf7('0x3'));var express=require(_0xebf7('0x4'));var router=express[_0xebf7('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xebf7('0x6'));var controller=require('./trunk.controller');router[_0xebf7('0x7')]('/',auth[_0xebf7('0x8')](),controller[_0xebf7('0x9')]);router[_0xebf7('0x7')](_0xebf7('0xa'),auth['isAuthenticated'](),controller[_0xebf7('0xb')]);router[_0xebf7('0xc')](_0xebf7('0xd'),auth[_0xebf7('0x8')](),controller['clone']);router[_0xebf7('0xc')]('/',auth[_0xebf7('0x8')](),controller[_0xebf7('0xe')]);router[_0xebf7('0xf')](_0xebf7('0xa'),auth['isAuthenticated'](),controller[_0xebf7('0x10')]);router[_0xebf7('0x11')](_0xebf7('0xa'),auth['isAuthenticated'](),controller[_0xebf7('0x12')]);module[_0xebf7('0x13')]=router; \ No newline at end of file +var _0x797b=['post','create','put','update','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','index','get','show','/:id/clone','clone'];(function(_0x243869,_0x76ff3b){var _0x5728f5=function(_0x2a0d58){while(--_0x2a0d58){_0x243869['push'](_0x243869['shift']());}};_0x5728f5(++_0x76ff3b);}(_0x797b,0xe3));var _0xb797=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x797b[_0x4687df];return _0x32eaef;};'use strict';var multer=require(_0xb797('0x0'));var util=require(_0xb797('0x1'));var path=require(_0xb797('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb797('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb797('0x4'));var interaction=require(_0xb797('0x5'));var config=require('../../config/environment');var controller=require(_0xb797('0x6'));router['get']('/',auth[_0xb797('0x7')](),controller[_0xb797('0x8')]);router[_0xb797('0x9')]('/:id',auth[_0xb797('0x7')](),controller[_0xb797('0xa')]);router['post'](_0xb797('0xb'),auth['isAuthenticated'](),controller[_0xb797('0xc')]);router[_0xb797('0xd')]('/',auth['isAuthenticated'](),controller[_0xb797('0xe')]);router[_0xb797('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb797('0x10')]);router[_0xb797('0x11')](_0xb797('0x12'),auth[_0xb797('0x7')](),controller[_0xb797('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 07e7a21..24a0dac 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 _0x63ea=['STRING','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','nonat','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\x22alaw\x22]','port,invite','insecure','never','INTEGER','always','refuse','originate','uac','uas','pai','certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','name','ENUM','friend','user','peer'];(function(_0x151b00,_0x4804f6){var _0x50d526=function(_0x525ea5){while(--_0x525ea5){_0x151b00['push'](_0x151b00['shift']());}};_0x50d526(++_0x4804f6);}(_0x63ea,0x182));var _0xa63e=function(_0x3c5cd1,_0x50b10b){_0x3c5cd1=_0x3c5cd1-0x0;var _0x217fbe=_0x63ea[_0x3c5cd1];return _0x217fbe;};'use strict';var Sequelize=require(_0xa63e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa63e('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x3'),_0xa63e('0x4'),_0xa63e('0x5')),'allowNull':![],'defaultValue':_0xa63e('0x3')},'context':{'type':Sequelize[_0xa63e('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x7'),'ALLOWED_PASSED_SCREEN',_0xa63e('0x8'),_0xa63e('0x9'),_0xa63e('0xa'),_0xa63e('0xb'),_0xa63e('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0xa63e('0x6')]},'permit':{'type':Sequelize[_0xa63e('0x6')]},'secret':{'type':Sequelize[_0xa63e('0x6')]},'md5secret':{'type':Sequelize[_0xa63e('0x6')]},'remotesecret':{'type':Sequelize[_0xa63e('0x6')]},'transport':{'type':Sequelize[_0xa63e('0x6')],'defaultValue':'udp','set':function(_0x26b682){this[_0xa63e('0xd')](_0xa63e('0xe'),_0x26b682?_0x26b682[_0xa63e('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xa63e('0xe'))?this[_0xa63e('0x10')](_0xa63e('0xe'))[_0xa63e('0x11')](','):null;},'comment':_0xa63e('0x12')},'dtmfmode':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x13'),'info','shortinfo',_0xa63e('0x14'),_0xa63e('0x15')),'defaultValue':_0xa63e('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0xa63e('0x16'),'no',_0xa63e('0x17'),'update',_0xa63e('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa63e('0x6')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xa63e('0x6')],'defaultValue':_0xa63e('0x19'),'set':function(_0x3c4aa8){this[_0xa63e('0xd')](_0xa63e('0x1a'),_0x3c4aa8?_0x3c4aa8[_0xa63e('0xf')](','):null);},'get':function(){return this[_0xa63e('0x10')]('nat')?this[_0xa63e('0x10')]('nat')[_0xa63e('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xa63e('0x6')]},'namedcallgroup':{'type':Sequelize[_0xa63e('0x6')]},'pickupgroup':{'type':Sequelize[_0xa63e('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xa63e('0x6')]},'language':{'type':Sequelize[_0xa63e('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xa63e('0x1b')},'allow':{'type':Sequelize[_0xa63e('0x6')],'allowNull':![],'defaultValue':_0xa63e('0x1c'),'set':function(_0x4d7583){this[_0xa63e('0xd')](_0xa63e('0x1d'),_0x4d7583?_0x4d7583[_0xa63e('0xf')](';'):_0xa63e('0x1c'));},'get':function(){return this['getDataValue']('allow')?this['getDataValue'](_0xa63e('0x1d'))[_0xa63e('0x11')](';'):null;},'comment':_0xa63e('0x1e')},'autoframing':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xa63e('0x1f'),'set':function(_0x1ac7ff){this[_0xa63e('0xd')](_0xa63e('0x20'),_0x1ac7ff?_0x1ac7ff[_0xa63e('0xf')](','):null);},'get':function(){return this[_0xa63e('0x10')](_0xa63e('0x20'))?this[_0xa63e('0x10')]('insecure')[_0xa63e('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa63e('0x2')]('yes','no',_0xa63e('0x21'))},'promiscredir':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xa63e('0x6')]},'callerid':{'type':Sequelize[_0xa63e('0x6')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xa63e('0x6')]},'callcounter':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no'),'defaultValue':_0xa63e('0x16')},'busylevel':{'type':Sequelize[_0xa63e('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa63e('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xa63e('0x6')]},'videosupport':{'type':Sequelize['ENUM'](_0xa63e('0x16'),'no',_0xa63e('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa63e('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xa63e('0x16'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xa63e('0x2')]('accept',_0xa63e('0x24'),_0xa63e('0x25'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xa63e('0x26'),_0xa63e('0x27')),'defaultValue':_0xa63e('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0xa63e('0x6')]},'regexten':{'type':Sequelize[_0xa63e('0x6')]},'fromdomain':{'type':Sequelize[_0xa63e('0x6')]},'fromuser':{'type':Sequelize[_0xa63e('0x6')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no'),'defaultValue':_0xa63e('0x16')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xa63e('0x6')]},'defaultuser':{'type':Sequelize[_0xa63e('0x6')]},'rtptimeout':{'type':Sequelize[_0xa63e('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa63e('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0xa63e('0x2')]('yes','no',_0xa63e('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa63e('0x6')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xa63e('0x22')](0xb)},'timerb':{'type':Sequelize[_0xa63e('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0xa63e('0x22')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xa63e('0x6')]},'contactacl':{'type':Sequelize[_0xa63e('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0xa63e('0x6')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xa63e('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'force_avp':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'icesupport':{'type':Sequelize[_0xa63e('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xa63e('0x16'),'no','fingerprint',_0xa63e('0x29'))},'dtlsrekey':{'type':Sequelize[_0xa63e('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa63e('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0xa63e('0x6')]},'dtlscipher':{'type':Sequelize[_0xa63e('0x6')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x2a'),_0xa63e('0x2b'),_0xa63e('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa63e('0x6')]},'usereqphone':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa63e('0x6')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xa63e('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xa63e('0x2')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xa63e('0x6')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xa63e('0x6')]},'description':{'type':Sequelize[_0xa63e('0x6')]},'host':{'type':Sequelize[_0xa63e('0x6')],'defaultValue':_0xa63e('0x2d')},'canreinvite':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no',_0xa63e('0x17'),_0xa63e('0x2e'),_0xa63e('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa63e('0x6')]},'otherFields':{'type':Sequelize[_0xa63e('0x6')]},'active':{'type':Sequelize[_0xa63e('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa63e('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0xf962=['ENUM','friend','user','peer','from-voip-provider','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','info','inband','auto','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','INTEGER','refuse','uac','uas','pai','certificate','active','actpass','dynamic','nonat','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x2ecd9d,_0x4fe14c){var _0x27f062=function(_0x391408){while(--_0x391408){_0x2ecd9d['push'](_0x2ecd9d['shift']());}};_0x27f062(++_0x4fe14c);}(_0xf962,0xbc));var _0x2f96=function(_0x26222d,_0x1d2de1){_0x26222d=_0x26222d-0x0;var _0x16bf9f=_0xf962[_0x26222d];return _0x16bf9f;};'use strict';var Sequelize=require(_0x2f96('0x0'));module[_0x2f96('0x1')]={'name':{'type':Sequelize[_0x2f96('0x2')],'allowNull':![],'unique':_0x2f96('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x5'),_0x2f96('0x6'),_0x2f96('0x7')),'allowNull':![],'defaultValue':_0x2f96('0x5')},'context':{'type':Sequelize[_0x2f96('0x2')],'allowNull':![],'defaultValue':_0x2f96('0x8')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x2f96('0x9'),_0x2f96('0xa'),_0x2f96('0xb'),_0x2f96('0xc'),_0x2f96('0xd'),_0x2f96('0xe'),_0x2f96('0xf'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2f96('0x2')]},'secret':{'type':Sequelize[_0x2f96('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x2f96('0x2')],'defaultValue':_0x2f96('0x10'),'set':function(_0x46d41b){this[_0x2f96('0x11')](_0x2f96('0x12'),_0x46d41b?_0x46d41b[_0x2f96('0x13')](','):null);},'get':function(){return this[_0x2f96('0x14')]('transport')?this[_0x2f96('0x14')]('transport')[_0x2f96('0x15')](','):null;},'comment':_0x2f96('0x16')},'dtmfmode':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x17'),_0x2f96('0x18'),'shortinfo',_0x2f96('0x19'),_0x2f96('0x1a')),'defaultValue':_0x2f96('0x17')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat','update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2f96('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x2f96('0x2')],'defaultValue':_0x2f96('0x1c'),'set':function(_0x955596){this[_0x2f96('0x11')]('nat',_0x955596?_0x955596[_0x2f96('0x13')](','):null);},'get':function(){return this['getDataValue'](_0x2f96('0x1d'))?this['getDataValue']('nat')[_0x2f96('0x15')](','):null;},'comment':_0x2f96('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2f96('0x2')]},'pickupgroup':{'type':Sequelize[_0x2f96('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2f96('0x2')]},'language':{'type':Sequelize[_0x2f96('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2f96('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2f96('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x2f96('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x121053){this[_0x2f96('0x11')](_0x2f96('0x1f'),_0x121053?_0x121053[_0x2f96('0x13')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x2f96('0x14')](_0x2f96('0x1f'))?this[_0x2f96('0x14')](_0x2f96('0x1f'))[_0x2f96('0x15')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x2f96('0x4')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x208cd8){this[_0x2f96('0x11')](_0x2f96('0x20'),_0x208cd8?_0x208cd8[_0x2f96('0x13')](','):null);},'get':function(){return this[_0x2f96('0x14')](_0x2f96('0x20'))?this['getDataValue'](_0x2f96('0x20'))[_0x2f96('0x15')](','):null;},'comment':_0x2f96('0x21')},'trustrpid':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2f96('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no',_0x2f96('0x22'))},'promiscredir':{'type':Sequelize[_0x2f96('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0x2f96('0x4')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x2f96('0x23')},'amaflags':{'type':Sequelize[_0x2f96('0x2')]},'callcounter':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no'),'defaultValue':_0x2f96('0x1b')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x2f96('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0x2f96('0x2')]},'template':{'type':Sequelize[_0x2f96('0x2')]},'videosupport':{'type':Sequelize[_0x2f96('0x4')]('yes','no',_0x2f96('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2f96('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no')},'mailbox':{'type':Sequelize[_0x2f96('0x2')]},'session_timers':{'type':Sequelize[_0x2f96('0x4')]('accept',_0x2f96('0x26'),'originate')},'session_expires':{'type':Sequelize[_0x2f96('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x2f96('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x27'),_0x2f96('0x28')),'defaultValue':_0x2f96('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x2f96('0x2')]},'regexten':{'type':Sequelize[_0x2f96('0x2')]},'fromdomain':{'type':Sequelize[_0x2f96('0x2')]},'fromuser':{'type':Sequelize[_0x2f96('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no'),'defaultValue':_0x2f96('0x1b')},'keepalive':{'type':Sequelize[_0x2f96('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x2f96('0x2')]},'defaultuser':{'type':Sequelize[_0x2f96('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2f96('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x2f96('0x4')]('yes','no',_0x2f96('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2f96('0x2')]},'callbackextension':{'type':Sequelize[_0x2f96('0x2')]},'timert1':{'type':Sequelize[_0x2f96('0x25')](0xb)},'timerb':{'type':Sequelize[_0x2f96('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2f96('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x2f96('0x2')]},'contactacl':{'type':Sequelize[_0x2f96('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2f96('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2f96('0x2')]},'maxforwards':{'type':Sequelize[_0x2f96('0x25')](0xb)},'encryption':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x2f96('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x2f96('0x1b'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x2f96('0x1b'),'no','fingerprint',_0x2f96('0x2a'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x2f96('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x2f96('0x2')]},'dtlscipher':{'type':Sequelize[_0x2f96('0x2')]},'dtlscafile':{'type':Sequelize[_0x2f96('0x2')]},'dtlscapath':{'type':Sequelize[_0x2f96('0x2')]},'dtlssetup':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x2b'),'passive',_0x2f96('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x2f96('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2f96('0x2')]},'mohsuggest':{'type':Sequelize[_0x2f96('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2f96('0x2')]},'host':{'type':Sequelize[_0x2f96('0x2')],'defaultValue':_0x2f96('0x2d')},'canreinvite':{'type':Sequelize[_0x2f96('0x4')]('yes','no',_0x2f96('0x2e'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2f96('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2f96('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2f96('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 f74df1e..52c47b8 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 _0x84ab=['../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','type','query','keys','intersection','fields','attributes','length','model','order','sort','where','filters','pick','merge','filter','options','Trunk','count','includeAll','rows','params','include','find','createdAt','updatedAt','body','omit','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','autoAssociation','root','chan_sip.so','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x33b00c,_0x147745){var _0x5697dc=function(_0x45abc0){while(--_0x45abc0){_0x33b00c['push'](_0x33b00c['shift']());}};_0x5697dc(++_0x147745);}(_0x84ab,0x12f));var _0xb84a=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0x84ab[_0x57b432];return _0x2edf2a;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb84a('0x16')][_0xb84a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x39a0df,_0x3c161c,_0x44b26b,_0x11dfe9){return new BPromise(function(_0x12ccab,_0x475b){var _0x3113a2=_0x11dfe9||client;return _0x3113a2[_0xb84a('0x18')](_0x39a0df,_0x44b26b)[_0xb84a('0x19')](function(_0x1251ec){logger['info'](_0xb84a('0x1a'),_0x3c161c,_0xb84a('0x1b'));logger[_0xb84a('0x1c')](_0xb84a('0x1d'),_0x3c161c,_0xb84a('0x1b'),JSON[_0xb84a('0x1e')](_0x1251ec));if(_0x1251ec[_0xb84a('0x1f')]){if(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x20')]===0x1f4){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);return _0x475b(_0x1251ec[_0xb84a('0x1f')]['message']);}logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec['error'][_0xb84a('0x21')]);return _0x12ccab(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);}else{logger[_0xb84a('0x22')]('Trunk,\x20%s,\x20%s',_0x3c161c,'request\x20sent');_0x12ccab(_0x1251ec[_0xb84a('0x23')][_0xb84a('0x21')]);}})[_0xb84a('0x24')](function(_0x259f74){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x259f74);_0x475b(_0x259f74);});});}function respondWithStatusCode(_0x8b28cd,_0x21d0d3){_0x21d0d3=_0x21d0d3||0xcc;return function(_0x3aa06f){if(_0x3aa06f){return _0x8b28cd[_0xb84a('0x25')](_0x21d0d3);}return _0x8b28cd[_0xb84a('0x26')](_0x21d0d3)[_0xb84a('0x27')]();};}function respondWithResult(_0x218aef,_0x409df0){_0x409df0=_0x409df0||0xc8;return function(_0x19bdfa){if(_0x19bdfa){return _0x218aef[_0xb84a('0x26')](_0x409df0)[_0xb84a('0x28')](_0x19bdfa);}};}function respondWithFilteredResult(_0x3ff0bc,_0x3b6805){return function(_0xd468c3){if(_0xd468c3){var _0x33bf1d=typeof _0x3b6805[_0xb84a('0x29')]===_0xb84a('0x2a')&&typeof _0x3b6805[_0xb84a('0x2b')]===_0xb84a('0x2a');var _0x97d71b=_0xd468c3['count'];var _0x582954=_0x33bf1d?0x0:_0x3b6805[_0xb84a('0x29')];var _0x2c30b0=_0x33bf1d?_0xd468c3['count']:_0x3b6805[_0xb84a('0x29')]+_0x3b6805[_0xb84a('0x2b')];var _0x52c23c;if(_0x2c30b0>=_0x97d71b){_0x2c30b0=_0x97d71b;_0x52c23c=0xc8;}else{_0x52c23c=0xce;}_0x3ff0bc['status'](_0x52c23c);return _0x3ff0bc[_0xb84a('0x2c')](_0xb84a('0x2d'),_0x582954+'-'+_0x2c30b0+'/'+_0x97d71b)['json'](_0xd468c3);}return null;};}function patchUpdates(_0x251778){return function(_0xba1147){try{jsonpatch[_0xb84a('0x2e')](_0xba1147,_0x251778,!![]);}catch(_0x44a405){return BPromise[_0xb84a('0x2f')](_0x44a405);}return _0xba1147[_0xb84a('0x30')]();};}function saveUpdates(_0x34b212,_0xac214f){return function(_0x54ec50){if(_0x54ec50){return _0x54ec50[_0xb84a('0x31')](_0x34b212)['then'](function(_0x4bca85){return _0x4bca85;});}return null;};}function removeEntity(_0x2eea7e,_0x3b4515){return function(_0x47a5b6){if(_0x47a5b6){return _0x47a5b6['destroy']()[_0xb84a('0x19')](function(){var _0x13c167=_0x47a5b6[_0xb84a('0x32')]({'plain':!![]});var _0x308240=_0xb84a('0x33');return db[_0xb84a('0x34')][_0xb84a('0x35')]({'where':{'type':_0x308240,'resourceId':_0x13c167['id']}})[_0xb84a('0x19')](function(){return _0x47a5b6;});})['then'](function(){_0x2eea7e[_0xb84a('0x26')](0xcc)[_0xb84a('0x27')]();});}};}function handleEntityNotFound(_0x10b944,_0xf894a6){return function(_0x36aa07){if(!_0x36aa07){_0x10b944[_0xb84a('0x25')](0x194);}return _0x36aa07;};}function handleError(_0x2a5130,_0x5aa2ae){_0x5aa2ae=_0x5aa2ae||0x1f4;return function(_0x30d22d){logger['error'](_0x30d22d[_0xb84a('0x36')]);if(_0x30d22d[_0xb84a('0x37')]){delete _0x30d22d[_0xb84a('0x37')];}_0x2a5130['status'](_0x5aa2ae)['send'](_0x30d22d);};}exports[_0xb84a('0x38')]=function(_0x75e6e6,_0x4a3737){var _0x2d3e08={},_0xab76ce={},_0x4cb5d4={'count':0x0,'rows':[]};var _0x19aa4c=_[_0xb84a('0x39')](db['Trunk'][_0xb84a('0x3a')],function(_0xe6f19e){return{'name':_0xe6f19e[_0xb84a('0x3b')],'type':_0xe6f19e[_0xb84a('0x3c')]['key']};});_0xab76ce['model']=_['map'](_0x19aa4c,_0xb84a('0x37'));_0xab76ce[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x75e6e6[_0xb84a('0x3d')]);_0xab76ce['filters']=_[_0xb84a('0x3f')](_0xab76ce['model'],_0xab76ce[_0xb84a('0x3d')]);_0x2d3e08['attributes']=_['intersection'](_0xab76ce['model'],qs[_0xb84a('0x40')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x2d3e08[_0xb84a('0x41')]=_0x2d3e08['attributes'][_0xb84a('0x42')]?_0x2d3e08[_0xb84a('0x41')]:_0xab76ce[_0xb84a('0x43')];if(!_0x75e6e6[_0xb84a('0x3d')]['hasOwnProperty']('nolimit')){_0x2d3e08[_0xb84a('0x2b')]=qs[_0xb84a('0x2b')](_0x75e6e6['query'][_0xb84a('0x2b')]);_0x2d3e08[_0xb84a('0x29')]=qs[_0xb84a('0x29')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x29')]);}_0x2d3e08[_0xb84a('0x44')]=qs[_0xb84a('0x45')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x45')]);_0x2d3e08[_0xb84a('0x46')]=qs[_0xb84a('0x47')](_[_0xb84a('0x48')](_0x75e6e6[_0xb84a('0x3d')],_0xab76ce[_0xb84a('0x47')]),_0x19aa4c);if(_0x75e6e6[_0xb84a('0x3d')]['filter']){_0x2d3e08[_0xb84a('0x46')]=_[_0xb84a('0x49')](_0x2d3e08[_0xb84a('0x46')],{'$or':_[_0xb84a('0x39')](_0x19aa4c,function(_0x37f4fe){if(_0x37f4fe[_0xb84a('0x3c')]!=='VIRTUAL'){var _0xfd2927={};_0xfd2927[_0x37f4fe['name']]={'$like':'%'+_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4a')]+'%'};return _0xfd2927;}})});}_0x2d3e08=_[_0xb84a('0x49')]({},_0x2d3e08,_0x75e6e6[_0xb84a('0x4b')]);var _0x5e7327={'where':_0x2d3e08[_0xb84a('0x46')]};return db[_0xb84a('0x4c')][_0xb84a('0x4d')](_0x5e7327)['then'](function(_0x55f39f){_0x4cb5d4[_0xb84a('0x4d')]=_0x55f39f;if(_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4e')]){_0x2d3e08['include']=[{'all':!![]}];}return db['Trunk']['findAll'](_0x2d3e08);})[_0xb84a('0x19')](function(_0x384a0d){_0x4cb5d4[_0xb84a('0x4f')]=_0x384a0d;return _0x4cb5d4;})[_0xb84a('0x19')](respondWithFilteredResult(_0x4a3737,_0x2d3e08))[_0xb84a('0x24')](handleError(_0x4a3737,null));};exports['show']=function(_0x4b40fe,_0x5b853a){var _0x53d4d6={'raw':![],'where':{'id':_0x4b40fe[_0xb84a('0x50')]['id']}},_0x421ba0={};_0x421ba0['model']=_[_0xb84a('0x3e')](db[_0xb84a('0x4c')][_0xb84a('0x3a')]);_0x421ba0[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x4b40fe[_0xb84a('0x3d')]);_0x421ba0['filters']=_['intersection'](_0x421ba0[_0xb84a('0x43')],_0x421ba0['query']);_0x53d4d6[_0xb84a('0x41')]=_['intersection'](_0x421ba0['model'],qs['fields'](_0x4b40fe[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x53d4d6[_0xb84a('0x41')]=_0x53d4d6[_0xb84a('0x41')][_0xb84a('0x42')]?_0x53d4d6[_0xb84a('0x41')]:_0x421ba0[_0xb84a('0x43')];if(_0x4b40fe[_0xb84a('0x3d')]['includeAll']){_0x53d4d6['include']=[{'all':!![]}];}_0x53d4d6=_['merge']({},_0x53d4d6,_0x4b40fe[_0xb84a('0x4b')]);return db[_0xb84a('0x4c')]['find'](_0x53d4d6)[_0xb84a('0x19')](handleEntityNotFound(_0x5b853a,null))['then'](respondWithResult(_0x5b853a,null))['catch'](handleError(_0x5b853a,null));};exports['clone']=function(_0x419e27,_0x172076){var _0x49a0e2={'where':{'id':_0x419e27[_0xb84a('0x50')]['id']}},_0x51c415={};_0x51c415[_0xb84a('0x43')]=_[_0xb84a('0x3e')](db['Trunk'][_0xb84a('0x3a')]);_0x49a0e2['attributes']=_['intersection'](_0x51c415[_0xb84a('0x43')],qs['fields'](_0x419e27[_0xb84a('0x3d')]['fields']));_0x49a0e2[_0xb84a('0x41')]=_0x49a0e2[_0xb84a('0x41')][_0xb84a('0x42')]?_0x49a0e2[_0xb84a('0x41')]:_0x51c415['model'];if(_0x419e27['query']['includeAll']){_0x49a0e2[_0xb84a('0x51')]=[{'all':!![]}];}_0x49a0e2=_[_0xb84a('0x49')]({},_0x49a0e2,_0x419e27['options']);return db['Trunk'][_0xb84a('0x52')](_0x49a0e2)[_0xb84a('0x19')](handleEntityNotFound(_0x172076,null))[_0xb84a('0x19')](function(_0x5f415d){if(_0x5f415d){var _0x29f67f=_0x5f415d[_0xb84a('0x32')]({'plain':!![]});_0x29f67f=qs['omit'](_0x29f67f,['id',_0xb84a('0x53'),_0xb84a('0x54')]);_0x419e27[_0xb84a('0x55')]=_[_0xb84a('0x56')](_0x419e27[_0xb84a('0x55')],['id',_0xb84a('0x53'),_0xb84a('0x54')]);return db['Trunk'][_0xb84a('0x57')](_[_0xb84a('0x49')](_0x29f67f,_0x419e27['body']),{'include':_0x419e27[_0xb84a('0x3d')][_0xb84a('0x4e')]?[{'all':!![]}]:undefined})[_0xb84a('0x19')](function(_0x3e16d8){var _0x347998=_0x419e27[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x347998)throw new Error(_0xb84a('0x59'));if(_0x347998[_0xb84a('0x5a')]==='user'){var _0x291008=_0x3e16d8['get']({'plain':!![]});var _0x5a2d44=_0xb84a('0x33');return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0x5a2d44,'userProfileId':_0x347998['userProfileId']},'raw':!![]})[_0xb84a('0x19')](function(_0x44e508){if(_0x44e508&&_0x44e508['autoAssociation']===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x291008[_0xb84a('0x37')],'resourceId':_0x291008['id'],'type':_0x44e508[_0xb84a('0x37')],'sectionId':_0x44e508['id']},{})[_0xb84a('0x19')](function(){return _0x3e16d8;});}else{return _0x3e16d8;}})[_0xb84a('0x24')](function(_0x4514f0){logger['error'](_0xb84a('0x5b'),_0x4514f0);throw _0x4514f0;});}return _0x3e16d8;});}})['then'](respondWithResult(_0x172076,0xc9))['catch'](handleError(_0x172076,null));};exports[_0xb84a('0x57')]=function(_0x2a2dc0,_0x2ee241,_0x32a455){var _0x5612f3;return db['Trunk'][_0xb84a('0x57')](_0x2a2dc0[_0xb84a('0x55')],{'raw':!![]})[_0xb84a('0x19')](function(_0x1a2e1a){_0x5612f3=_0x1a2e1a;return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x1eec1f){var _0x57b784=fs[_0xb84a('0x5d')](path['join'](config['root'],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0xf936f1=fs[_0xb84a('0x5d')](path[_0xb84a('0x5f')](config['root'],_0xb84a('0x60')),_0xb84a('0x5e'));var _0x33d416=ejs[_0xb84a('0x61')](_0x57b784,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x63'),_0x33d416);if(_0x5612f3[_0xb84a('0x64')]){var _0x542d70=ejs[_0xb84a('0x61')](_0xf936f1,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0x542d70);}})[_0xb84a('0x19')](function(){return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x57'),{'module':'chan_sip.so'});})[_0xb84a('0x19')](function(){var _0x6f8f=_0x2a2dc0[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x6f8f)throw new Error(_0xb84a('0x59'));if(_0x6f8f['role']===_0xb84a('0x58')){var _0x4b0b18=_0x5612f3[_0xb84a('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0xb84a('0x33'),'userProfileId':_0x6f8f[_0xb84a('0x67')]},'raw':!![]})['then'](function(_0x121fda){if(_0x121fda&&_0x121fda[_0xb84a('0x68')]===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x4b0b18[_0xb84a('0x37')],'resourceId':_0x4b0b18['id'],'type':_0x121fda['name'],'sectionId':_0x121fda['id']},{})[_0xb84a('0x19')](function(){return _0x5612f3;});}else{return _0x5612f3;}})[_0xb84a('0x24')](function(_0x287d25){logger['error'](_0xb84a('0x5b'),_0x287d25);throw _0x287d25;});}return _0x5612f3;})['then'](respondWithResult(_0x2ee241,0xc9))['catch'](handleError(_0x2ee241,null));};exports[_0xb84a('0x31')]=function(_0x35cb8b,_0x13c7b7,_0x3b2a2d){var _0x2047f5;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x35cb8b[_0xb84a('0x50')]['id']}})[_0xb84a('0x19')](handleEntityNotFound(_0x13c7b7,null))[_0xb84a('0x19')](saveUpdates(_0x35cb8b[_0xb84a('0x55')],null))[_0xb84a('0x19')](function(_0x3ec1fb){if(_0x3ec1fb){_0x2047f5=_0x3ec1fb;return db[_0xb84a('0x4c')][_0xb84a('0x5c')]({'raw':!![]});}})[_0xb84a('0x19')](function(_0xb18756){if(_0xb18756){var _0x1169d1=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0x576df5=fs[_0xb84a('0x5d')](path['join'](config[_0xb84a('0x69')],'server/files/templates/registry.ejs'),'utf8');var _0xf3f253=ejs[_0xb84a('0x61')](_0x1169d1,{'trunks':_0xb18756||[]});fs['writeFileSync'](_0xb84a('0x63'),_0xf3f253);var _0xcf9bc2=ejs[_0xb84a('0x61')](_0x576df5,{'trunks':_0xb18756||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0xcf9bc2);return respondWithRpcPromise('Reload',_0xb84a('0x31'),{'module':_0xb84a('0x6a')});}return null;})[_0xb84a('0x19')](function(_0x30f7cd){if(_0x30f7cd){return _0x2047f5;}})['then'](respondWithResult(_0x13c7b7,null))[_0xb84a('0x24')](handleError(_0x13c7b7,null));};exports['destroy']=function(_0x14118c,_0x12d796,_0x54ae3e){var _0xf6765a;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x14118c['params']['id']}})['then'](handleEntityNotFound(_0x12d796,null))[_0xb84a('0x19')](removeEntity(_0x12d796,null))[_0xb84a('0x19')](function(){return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x166d75){var _0x54161c=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],_0xb84a('0x6b')),_0xb84a('0x5e'));var _0x403a3e=fs['readFileSync'](path['join'](config[_0xb84a('0x69')],_0xb84a('0x60')),'utf8');var _0x305b67=ejs[_0xb84a('0x61')](_0x54161c,{'trunks':_0x166d75});var _0x385a05=ejs[_0xb84a('0x61')](_0x403a3e,{'trunks':_0x166d75});fs['writeFileSync'](_0xb84a('0x63'),_0x305b67);fs['writeFileSync'](_0xb84a('0x65'),_0x385a05);return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x35'),{'module':_0xb84a('0x6a')});})[_0xb84a('0x24')](handleError(_0x12d796,null));}; \ No newline at end of file +var _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x4b2d3b,_0x4d1ea9){var _0x4bd344=function(_0x2b4734){while(--_0x2b4734){_0x4b2d3b['push'](_0x4b2d3b['shift']());}};_0x4bd344(++_0x4d1ea9);}(_0x6aa7,0x178));var _0x76aa=function(_0x57a8ef,_0x3009ed){_0x57a8ef=_0x57a8ef-0x0;var _0x273a49=_0x6aa7[_0x57a8ef];return _0x273a49;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 20eca1e..3536b3f 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 _0x8b1a=['exports','define','Trunk','tools_trunks','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0x8b1a,0x17a));var _0xa8b1=function(_0x45b752,_0x3d63d3){_0x45b752=_0x45b752-0x0;var _0xb1aac6=_0x8b1a[_0x45b752];return _0xb1aac6;};'use strict';var _=require('lodash');var util=require(_0xa8b1('0x0'));var logger=require(_0xa8b1('0x1'))(_0xa8b1('0x2'));var moment=require(_0xa8b1('0x3'));var BPromise=require('bluebird');var rp=require(_0xa8b1('0x4'));var fs=require('fs');var path=require(_0xa8b1('0x5'));var rimraf=require('rimraf');var config=require(_0xa8b1('0x6'));var attributes=require('./trunk.attributes');module[_0xa8b1('0x7')]=function(_0x274e92,_0xd17cbc){return _0x274e92[_0xa8b1('0x8')](_0xa8b1('0x9'),attributes,{'tableName':_0xa8b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec40=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','Trunk'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xec40,0xdc));var _0x0ec4=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0xec40[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0x0ec4('0x0'));var util=require(_0x0ec4('0x1'));var logger=require(_0x0ec4('0x2'))(_0x0ec4('0x3'));var moment=require(_0x0ec4('0x4'));var BPromise=require(_0x0ec4('0x5'));var rp=require(_0x0ec4('0x6'));var fs=require('fs');var path=require(_0x0ec4('0x7'));var rimraf=require('rimraf');var config=require(_0x0ec4('0x8'));var attributes=require('./trunk.attributes');module[_0x0ec4('0x9')]=function(_0x10305c,_0x4e38d7){return _0x10305c['define'](_0x0ec4('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index f0c9d82..fdd5cdb 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 _0x6467=['Trunk','findAll','raw','options','where','attributes','limit','include','map','model','stringify','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','GetTrunk'];(function(_0x2cbea1,_0x2cd722){var _0x4682f9=function(_0x4a9a4a){while(--_0x4a9a4a){_0x2cbea1['push'](_0x2cbea1['shift']());}};_0x4682f9(++_0x2cd722);}(_0x6467,0x110));var _0x7646=function(_0x35a1ce,_0x5d1934){_0x35a1ce=_0x35a1ce-0x0;var _0x4e18f9=_0x6467[_0x35a1ce];return _0x4e18f9;};'use strict';var _=require(_0x7646('0x0'));var util=require(_0x7646('0x1'));var moment=require(_0x7646('0x2'));var BPromise=require(_0x7646('0x3'));var rs=require(_0x7646('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7646('0x5'));var logger=require(_0x7646('0x6'))(_0x7646('0x7'));var config=require(_0x7646('0x8'));var jayson=require(_0x7646('0x9'));var client=jayson[_0x7646('0xa')][_0x7646('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40c136,_0x151ed6,_0x5023ae){return new BPromise(function(_0x241fe5,_0x10d4c5){return client[_0x7646('0xc')](_0x40c136,_0x5023ae)[_0x7646('0xd')](function(_0xf921c6){logger[_0x7646('0xe')](_0x7646('0xf'),_0x151ed6,_0x7646('0x10'));logger[_0x7646('0x11')](_0x7646('0x12'),_0x151ed6,'request\x20sent',JSON['stringify'](_0xf921c6));if(_0xf921c6['error']){if(_0xf921c6[_0x7646('0x13')][_0x7646('0x14')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x151ed6,_0xf921c6['error']['message']);return _0x10d4c5(_0xf921c6[_0x7646('0x13')][_0x7646('0x15')]);}logger[_0x7646('0x13')](_0x7646('0xf'),_0x151ed6,_0xf921c6['error']['message']);return _0x241fe5(_0xf921c6[_0x7646('0x13')][_0x7646('0x15')]);}else{logger['info'](_0x7646('0xf'),_0x151ed6,_0x7646('0x10'));_0x241fe5(_0xf921c6[_0x7646('0x16')]['message']);}})['catch'](function(_0x4c0d1d){logger['error']('Trunk,\x20%s,\x20%s',_0x151ed6,_0x4c0d1d);_0x10d4c5(_0x4c0d1d);});});}exports[_0x7646('0x17')]=function(_0x2b038e){var _0x13ca2=this;return new Promise(function(_0x63b4e1,_0x2332bb){return db[_0x7646('0x18')][_0x7646('0x19')]({'raw':_0x2b038e['options']?_0x2b038e['options'][_0x7646('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b038e[_0x7646('0x1b')]?_0x2b038e[_0x7646('0x1b')][_0x7646('0x1c')]||null:null,'attributes':_0x2b038e['options']?_0x2b038e[_0x7646('0x1b')][_0x7646('0x1d')]||null:null,'limit':_0x2b038e[_0x7646('0x1b')]?_0x2b038e['options'][_0x7646('0x1e')]||null:null,'include':_0x2b038e[_0x7646('0x1b')]?_0x2b038e[_0x7646('0x1b')][_0x7646('0x1f')]?_[_0x7646('0x20')](_0x2b038e['options'][_0x7646('0x1f')],function(_0x400d3e){return{'model':db[_0x400d3e[_0x7646('0x21')]],'as':_0x400d3e['as'],'attributes':_0x400d3e[_0x7646('0x1d')],'include':_0x400d3e[_0x7646('0x1f')]?_[_0x7646('0x20')](_0x400d3e['include'],function(_0x146faf){return{'model':db[_0x146faf[_0x7646('0x21')]],'as':_0x146faf['as'],'attributes':_0x146faf['attributes'],'include':_0x146faf[_0x7646('0x1f')]?_[_0x7646('0x20')](_0x146faf[_0x7646('0x1f')],function(_0x24c2f6){return{'model':db[_0x24c2f6[_0x7646('0x21')]],'as':_0x24c2f6['as'],'attributes':_0x24c2f6[_0x7646('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x202cc3){logger[_0x7646('0xe')]('GetTrunk',_0x2b038e);logger[_0x7646('0x11')](_0x7646('0x17'),_0x2b038e,JSON[_0x7646('0x22')](_0x202cc3));_0x63b4e1(_0x202cc3);})['catch'](function(_0x3c6100){logger['error'](_0x7646('0x17'),_0x3c6100[_0x7646('0x15')],_0x2b038e);_0x2332bb(_0x13ca2[_0x7646('0x13')](0x1f4,_0x3c6100['message']));});});};exports[_0x7646('0x23')]=function(_0x5e0660){var _0x1f2922=this;return new Promise(function(_0x1761b8,_0x5570e0){return db['Trunk'][_0x7646('0x24')]({'raw':_0x5e0660[_0x7646('0x1b')]?_0x5e0660['options'][_0x7646('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e0660[_0x7646('0x1b')]?_0x5e0660[_0x7646('0x1b')][_0x7646('0x1c')]||null:null,'attributes':_0x5e0660['options']?_0x5e0660[_0x7646('0x1b')][_0x7646('0x1d')]||null:null,'include':_0x5e0660[_0x7646('0x1b')]?_0x5e0660[_0x7646('0x1b')][_0x7646('0x1f')]?_[_0x7646('0x20')](_0x5e0660[_0x7646('0x1b')][_0x7646('0x1f')],function(_0x14b4dc){return{'model':db[_0x14b4dc[_0x7646('0x21')]],'as':_0x14b4dc['as'],'attributes':_0x14b4dc[_0x7646('0x1d')],'include':_0x14b4dc[_0x7646('0x1f')]?_[_0x7646('0x20')](_0x14b4dc[_0x7646('0x1f')],function(_0x29b772){return{'model':db[_0x29b772[_0x7646('0x21')]],'as':_0x29b772['as'],'attributes':_0x29b772[_0x7646('0x1d')],'include':_0x29b772[_0x7646('0x1f')]?_[_0x7646('0x20')](_0x29b772[_0x7646('0x1f')],function(_0x35826c){return{'model':db[_0x35826c['model']],'as':_0x35826c['as'],'attributes':_0x35826c[_0x7646('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7646('0xd')](function(_0x3229ef){logger[_0x7646('0xe')](_0x7646('0x23'),_0x5e0660);logger['debug'](_0x7646('0x23'),_0x5e0660,JSON['stringify'](_0x3229ef));_0x1761b8(_0x3229ef);})['catch'](function(_0x5e4f4f){logger[_0x7646('0x13')]('ShowTrunk',_0x5e4f4f['message'],_0x5e0660);_0x5570e0(_0x1f2922[_0x7646('0x13')](0x1f4,_0x5e4f4f[_0x7646('0x15')]));});});}; \ No newline at end of file +var _0x3368=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','Trunk,\x20%s,\x20%s','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowTrunk','find','lodash','util','randomstring'];(function(_0x283b55,_0x279bee){var _0x192e58=function(_0x535c7c){while(--_0x535c7c){_0x283b55['push'](_0x283b55['shift']());}};_0x192e58(++_0x279bee);}(_0x3368,0xc9));var _0x8336=function(_0x46aae1,_0x130f4e){_0x46aae1=_0x46aae1-0x0;var _0xc42a8e=_0x3368[_0x46aae1];return _0xc42a8e;};'use strict';var _=require(_0x8336('0x0'));var util=require(_0x8336('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8336('0x2'));var fs=require('fs');var Redis=require(_0x8336('0x3'));var db=require(_0x8336('0x4'))['db'];var utils=require(_0x8336('0x5'));var logger=require('../../config/logger')(_0x8336('0x6'));var config=require('../../config/environment');var jayson=require(_0x8336('0x7'));var client=jayson[_0x8336('0x8')][_0x8336('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf9bab0,_0x4f558e,_0x392a0a){return new BPromise(function(_0x242f69,_0x55ac49){return client['request'](_0xf9bab0,_0x392a0a)[_0x8336('0xa')](function(_0x3aa828){logger[_0x8336('0xb')]('Trunk,\x20%s,\x20%s',_0x4f558e,_0x8336('0xc'));logger[_0x8336('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x4f558e,_0x8336('0xc'),JSON['stringify'](_0x3aa828));if(_0x3aa828[_0x8336('0xe')]){if(_0x3aa828['error'][_0x8336('0xf')]===0x1f4){logger['error'](_0x8336('0x10'),_0x4f558e,_0x3aa828['error'][_0x8336('0x11')]);return _0x55ac49(_0x3aa828[_0x8336('0xe')][_0x8336('0x11')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x4f558e,_0x3aa828[_0x8336('0xe')][_0x8336('0x11')]);return _0x242f69(_0x3aa828[_0x8336('0xe')]['message']);}else{logger[_0x8336('0xb')](_0x8336('0x10'),_0x4f558e,'request\x20sent');_0x242f69(_0x3aa828[_0x8336('0x12')][_0x8336('0x11')]);}})['catch'](function(_0x4a2938){logger['error'](_0x8336('0x10'),_0x4f558e,_0x4a2938);_0x55ac49(_0x4a2938);});});}exports[_0x8336('0x13')]=function(_0x30dedb){var _0x3bd439=this;return new Promise(function(_0x3da5e8,_0x50fe15){return db[_0x8336('0x14')][_0x8336('0x15')]({'raw':_0x30dedb['options']?_0x30dedb[_0x8336('0x16')][_0x8336('0x17')]===undefined?!![]:![]:!![],'where':_0x30dedb[_0x8336('0x16')]?_0x30dedb[_0x8336('0x16')][_0x8336('0x18')]||null:null,'attributes':_0x30dedb[_0x8336('0x16')]?_0x30dedb[_0x8336('0x16')][_0x8336('0x19')]||null:null,'limit':_0x30dedb['options']?_0x30dedb[_0x8336('0x16')][_0x8336('0x1a')]||null:null,'include':_0x30dedb[_0x8336('0x16')]?_0x30dedb[_0x8336('0x16')][_0x8336('0x1b')]?_[_0x8336('0x1c')](_0x30dedb['options']['include'],function(_0x3c8e88){return{'model':db[_0x3c8e88[_0x8336('0x1d')]],'as':_0x3c8e88['as'],'attributes':_0x3c8e88[_0x8336('0x19')],'include':_0x3c8e88[_0x8336('0x1b')]?_[_0x8336('0x1c')](_0x3c8e88['include'],function(_0x273fa5){return{'model':db[_0x273fa5[_0x8336('0x1d')]],'as':_0x273fa5['as'],'attributes':_0x273fa5[_0x8336('0x19')],'include':_0x273fa5['include']?_[_0x8336('0x1c')](_0x273fa5[_0x8336('0x1b')],function(_0x536d9f){return{'model':db[_0x536d9f[_0x8336('0x1d')]],'as':_0x536d9f['as'],'attributes':_0x536d9f[_0x8336('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8336('0xa')](function(_0x295ca4){logger[_0x8336('0xb')](_0x8336('0x13'),_0x30dedb);logger[_0x8336('0xd')]('GetTrunk',_0x30dedb,JSON[_0x8336('0x1e')](_0x295ca4));_0x3da5e8(_0x295ca4);})[_0x8336('0x1f')](function(_0xc06ac7){logger['error']('GetTrunk',_0xc06ac7[_0x8336('0x11')],_0x30dedb);_0x50fe15(_0x3bd439[_0x8336('0xe')](0x1f4,_0xc06ac7[_0x8336('0x11')]));});});};exports[_0x8336('0x20')]=function(_0x22fe54){var _0x1e0464=this;return new Promise(function(_0x297aff,_0x5d4b56){return db[_0x8336('0x14')][_0x8336('0x21')]({'raw':_0x22fe54[_0x8336('0x16')]?_0x22fe54[_0x8336('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x22fe54[_0x8336('0x16')]?_0x22fe54['options']['where']||null:null,'attributes':_0x22fe54[_0x8336('0x16')]?_0x22fe54[_0x8336('0x16')][_0x8336('0x19')]||null:null,'include':_0x22fe54[_0x8336('0x16')]?_0x22fe54[_0x8336('0x16')][_0x8336('0x1b')]?_['map'](_0x22fe54[_0x8336('0x16')]['include'],function(_0x321a33){return{'model':db[_0x321a33[_0x8336('0x1d')]],'as':_0x321a33['as'],'attributes':_0x321a33[_0x8336('0x19')],'include':_0x321a33['include']?_[_0x8336('0x1c')](_0x321a33[_0x8336('0x1b')],function(_0x323938){return{'model':db[_0x323938[_0x8336('0x1d')]],'as':_0x323938['as'],'attributes':_0x323938[_0x8336('0x19')],'include':_0x323938[_0x8336('0x1b')]?_[_0x8336('0x1c')](_0x323938[_0x8336('0x1b')],function(_0x34d93d){return{'model':db[_0x34d93d[_0x8336('0x1d')]],'as':_0x34d93d['as'],'attributes':_0x34d93d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d274f){logger[_0x8336('0xb')](_0x8336('0x20'),_0x22fe54);logger['debug'](_0x8336('0x20'),_0x22fe54,JSON['stringify'](_0x4d274f));_0x297aff(_0x4d274f);})['catch'](function(_0x2cd716){logger[_0x8336('0xe')](_0x8336('0x20'),_0x2cd716[_0x8336('0x11')],_0x22fe54);_0x5d4b56(_0x1e0464[_0x8336('0xe')](0x1f4,_0x2cd716[_0x8336('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index d20c336..a20f649 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 _0xf7bf=['put','isAuthenticated','update','exports','express','Router','../../components/auth/service','./user-setting.controller'];(function(_0x596991,_0x198cea){var _0xb29c9d=function(_0x14c846){while(--_0x14c846){_0x596991['push'](_0x596991['shift']());}};_0xb29c9d(++_0x198cea);}(_0xf7bf,0x154));var _0xff7b=function(_0x1ef2e3,_0x380ec2){_0x1ef2e3=_0x1ef2e3-0x0;var _0x173e11=_0xf7bf[_0x1ef2e3];return _0x173e11;};'use strict';var express=require(_0xff7b('0x0'));var router=express[_0xff7b('0x1')]();var auth=require(_0xff7b('0x2'));var controller=require(_0xff7b('0x3'));router[_0xff7b('0x4')]('/:id',auth[_0xff7b('0x5')](),controller[_0xff7b('0x6')]);module[_0xff7b('0x7')]=router; \ No newline at end of file +var _0xa2d6=['./user-setting.controller','put','/:id','isAuthenticated','update','express','Router','../../components/auth/service'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xa2d6,0x65));var _0x6a2d=function(_0xb77d35,_0x291854){_0xb77d35=_0xb77d35-0x0;var _0x5389a8=_0xa2d6[_0xb77d35];return _0x5389a8;};'use strict';var express=require(_0x6a2d('0x0'));var router=express[_0x6a2d('0x1')]();var auth=require(_0x6a2d('0x2'));var controller=require(_0x6a2d('0x3'));router[_0x6a2d('0x4')](_0x6a2d('0x5'),auth[_0x6a2d('0x6')](),controller[_0x6a2d('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index ea6efb0..995b318 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 _0x3a18=['warning','info','debug','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error'];(function(_0x14cc49,_0x4ef393){var _0x100efd=function(_0x309fa5){while(--_0x309fa5){_0x14cc49['push'](_0x14cc49['shift']());}};_0x100efd(++_0x4ef393);}(_0x3a18,0x172));var _0x83a1=function(_0x535dad,_0x37300e){_0x535dad=_0x535dad-0x0;var _0x46c8ed=_0x3a18[_0x535dad];return _0x46c8ed;};'use strict';var Sequelize=require(_0x83a1('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x83a1('0x1'),_0x83a1('0x2'),_0x83a1('0x3'),_0x83a1('0x4')];module[_0x83a1('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x83a1('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x83a1('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x83a1('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x83a1('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x83a1('0x9')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x83a1('0xa')],'unique':_0x83a1('0xb')}}; \ No newline at end of file +var _0x8eb1=['UserId','sequelize','error','info','debug','exports','ENUM','BOOLEAN','TEXT','INTEGER'];(function(_0x3db58d,_0x3f0c01){var _0x17158d=function(_0x1b03f5){while(--_0x1b03f5){_0x3db58d['push'](_0x3db58d['shift']());}};_0x17158d(++_0x3f0c01);}(_0x8eb1,0x191));var _0x18eb=function(_0x30e50b,_0x26b79b){_0x30e50b=_0x30e50b-0x0;var _0x516d42=_0x8eb1[_0x30e50b];return _0x516d42;};'use strict';var Sequelize=require(_0x18eb('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x18eb('0x1'),'warning',_0x18eb('0x2'),_0x18eb('0x3')];module[_0x18eb('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x18eb('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x18eb('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x18eb('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x18eb('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x18eb('0x8')],'unique':_0x18eb('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 8d23d9f..fdd8750 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 _0x5f10=['socket.io-emitter','redis','./user-setting.socket','register','localhost','status','json','update','sendStatus','error','name','send','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','then','body','catch','lodash','ioredis','../../mysqldb'];(function(_0x36bce2,_0x4a22e7){var _0x5690ee=function(_0x5afc4f){while(--_0x5afc4f){_0x36bce2['push'](_0x36bce2['shift']());}};_0x5690ee(++_0x4a22e7);}(_0x5f10,0xd5));var _0x05f1=function(_0xb15182,_0x48d8fb){_0xb15182=_0xb15182-0x0;var _0x4a8749=_0x5f10[_0xb15182];return _0x4a8749;};'use strict';var _=require(_0x05f1('0x0'));var Redis=require(_0x05f1('0x1'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x05f1('0x2'))['db'];var socket=require(_0x05f1('0x3'))(new Redis(config[_0x05f1('0x4')]));require(_0x05f1('0x5'))[_0x05f1('0x6')](socket);config[_0x05f1('0x4')]=_['defaults'](config[_0x05f1('0x4')],{'host':_0x05f1('0x7'),'port':0x18eb});function respondWithResult(_0xf2902c,_0x5bd2d1){_0x5bd2d1=_0x5bd2d1||0xc8;return function(_0x268584){if(_0x268584){return _0xf2902c[_0x05f1('0x8')](_0x5bd2d1)[_0x05f1('0x9')](_0x268584);}};}function saveUpdates(_0x17baf8){return function(_0x2e6a70){if(_0x2e6a70){return _0x2e6a70[_0x05f1('0xa')](_0x17baf8)['then'](function(_0x338096){return _0x338096;});}return null;};}function handleEntityNotFound(_0x426c95){return function(_0xf28731){if(!_0xf28731){_0x426c95[_0x05f1('0xb')](0x194);}return _0xf28731;};}function handleError(_0x3cb42f,_0x2fceec){_0x2fceec=_0x2fceec||0x1f4;return function(_0x48ec7f){logger[_0x05f1('0xc')](_0x48ec7f['stack']);if(_0x48ec7f[_0x05f1('0xd')]){delete _0x48ec7f[_0x05f1('0xd')];}_0x3cb42f[_0x05f1('0x8')](_0x2fceec)[_0x05f1('0xe')](_0x48ec7f);};}exports[_0x05f1('0xa')]=function(_0x3497ae,_0x1367de){if(_0x3497ae[_0x05f1('0xf')][_0x05f1('0x10')]!=='admin')throw new Error(_0x05f1('0x11'));if(isNaN(Number(_0x3497ae[_0x05f1('0x12')]['id'])))throw new Error(_0x05f1('0x13'));return db[_0x05f1('0x14')]['find']({'where':{'id':_0x3497ae[_0x05f1('0x12')]['id']}})[_0x05f1('0x15')](handleEntityNotFound(_0x1367de,null))[_0x05f1('0x15')](saveUpdates(_0x3497ae[_0x05f1('0x16')],null))[_0x05f1('0x15')](respondWithResult(_0x1367de,null))[_0x05f1('0x17')](handleError(_0x1367de,null));}; \ No newline at end of file +var _0xf874=['status','update','then','sendStatus','error','stack','name','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xf874,0x177));var _0x4f87=function(_0x29019b,_0x816250){_0x29019b=_0x29019b-0x0;var _0x378e6e=_0xf874[_0x29019b];return _0x378e6e;};'use strict';var _=require(_0x4f87('0x0'));var Redis=require('ioredis');var logger=require(_0x4f87('0x1'))(_0x4f87('0x2'));var config=require(_0x4f87('0x3'));var db=require(_0x4f87('0x4'))['db'];var socket=require(_0x4f87('0x5'))(new Redis(config[_0x4f87('0x6')]));require(_0x4f87('0x7'))['register'](socket);config[_0x4f87('0x6')]=_[_0x4f87('0x8')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x497346,_0x4ac62f){_0x4ac62f=_0x4ac62f||0xc8;return function(_0x55a9b0){if(_0x55a9b0){return _0x497346[_0x4f87('0x9')](_0x4ac62f)['json'](_0x55a9b0);}};}function saveUpdates(_0x1bcbde){return function(_0x434b3f){if(_0x434b3f){return _0x434b3f[_0x4f87('0xa')](_0x1bcbde)[_0x4f87('0xb')](function(_0x4dfb28){return _0x4dfb28;});}return null;};}function handleEntityNotFound(_0x25dea7){return function(_0x364d09){if(!_0x364d09){_0x25dea7[_0x4f87('0xc')](0x194);}return _0x364d09;};}function handleError(_0x1777bb,_0x1faa4e){_0x1faa4e=_0x1faa4e||0x1f4;return function(_0x442128){logger[_0x4f87('0xd')](_0x442128[_0x4f87('0xe')]);if(_0x442128[_0x4f87('0xf')]){delete _0x442128[_0x4f87('0xf')];}_0x1777bb[_0x4f87('0x9')](_0x1faa4e)['send'](_0x442128);};}exports[_0x4f87('0xa')]=function(_0x16833c,_0x501ee7){if(_0x16833c['user'][_0x4f87('0x10')]!=='admin')throw new Error(_0x4f87('0x11'));if(isNaN(Number(_0x16833c[_0x4f87('0x12')]['id'])))throw new Error(_0x4f87('0x13'));return db[_0x4f87('0x14')][_0x4f87('0x15')]({'where':{'id':_0x16833c[_0x4f87('0x12')]['id']}})[_0x4f87('0xb')](handleEntityNotFound(_0x501ee7,null))[_0x4f87('0xb')](saveUpdates(_0x16833c[_0x4f87('0x16')],null))[_0x4f87('0xb')](respondWithResult(_0x501ee7,null))[_0x4f87('0x17')](handleError(_0x501ee7,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 b6da9a5..720cf6c 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 _0x6470=['remove','emit','../../mysqldb','UserSetting','setMaxListeners','update'];(function(_0xdc1d8,_0x11f15){var _0x862ece=function(_0x13af6a){while(--_0x13af6a){_0xdc1d8['push'](_0xdc1d8['shift']());}};_0x862ece(++_0x11f15);}(_0x6470,0x176));var _0x0647=function(_0xc5600d,_0x3da754){_0xc5600d=_0xc5600d-0x0;var _0x563e8e=_0x6470[_0xc5600d];return _0x563e8e;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x0647('0x0'))['db'][_0x0647('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0647('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0647('0x3'),'afterDestroy':_0x0647('0x4')};function emitEvent(_0x3db971){return function(_0x194d0e,_0x48c1a3,_0x338018){UserSettingEvents[_0x0647('0x5')](_0x3db971+':'+_0x194d0e['id'],_0x194d0e);UserSettingEvents[_0x0647('0x5')](_0x3db971,_0x194d0e);_0x338018(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x5199=['emit','exports','events','../../mysqldb','save','update','remove'];(function(_0x211195,_0x30929f){var _0x593b25=function(_0x192a3a){while(--_0x192a3a){_0x211195['push'](_0x211195['shift']());}};_0x593b25(++_0x30929f);}(_0x5199,0x10c));var _0x9519=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x5199[_0x29b609];return _0x54c952;};'use strict';var EventEmitter=require(_0x9519('0x0'));var UserSetting=require(_0x9519('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9519('0x2'),'afterUpdate':_0x9519('0x3'),'afterDestroy':_0x9519('0x4')};function emitEvent(_0x35b036){return function(_0xd20e1b,_0x2d1a84,_0x136d78){UserSettingEvents[_0x9519('0x5')](_0x35b036+':'+_0xd20e1b['id'],_0xd20e1b);UserSettingEvents[_0x9519('0x5')](_0x35b036,_0xd20e1b);_0x136d78(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x9519('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 fa31ccf..0a13b79 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 _0xc112=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting','user_settings'];(function(_0x59e9b4,_0x5f004a){var _0x105aa0=function(_0x2796c2){while(--_0x2796c2){_0x59e9b4['push'](_0x59e9b4['shift']());}};_0x105aa0(++_0x5f004a);}(_0xc112,0xec));var _0x2c11=function(_0x33d727,_0x55fe63){_0x33d727=_0x33d727-0x0;var _0x4f5732=_0xc112[_0x33d727];return _0x4f5732;};'use strict';var attributes=require(_0x2c11('0x0'));module[_0x2c11('0x1')]=function(_0x3f1d00){return _0x3f1d00['define'](_0x2c11('0x2'),attributes,{'tableName':_0x2c11('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x26e2a3){if(!_0x26e2a3[_0x2c11('0x4')])_0x26e2a3[_0x2c11('0x5')]=null;else if(_0x26e2a3[_0x2c11('0x5')]===null)_0x26e2a3[_0x2c11('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x78f0=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x1aca7e,_0x44f65e){var _0x5c489e=function(_0x19f0a1){while(--_0x19f0a1){_0x1aca7e['push'](_0x1aca7e['shift']());}};_0x5c489e(++_0x44f65e);}(_0x78f0,0x15d));var _0x078f=function(_0x51ba06,_0x90392a){_0x51ba06=_0x51ba06-0x0;var _0x183954=_0x78f0[_0x51ba06];return _0x183954;};'use strict';var attributes=require(_0x078f('0x0'));module[_0x078f('0x1')]=function(_0x140ffe){return _0x140ffe[_0x078f('0x2')](_0x078f('0x3'),attributes,{'tableName':_0x078f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34a715){if(!_0x34a715[_0x078f('0x5')])_0x34a715['clientSideLoggingEnabledSince']=null;else if(_0x34a715[_0x078f('0x6')]===null)_0x34a715[_0x078f('0x6')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 43c543e..0c55cef 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 _0x99f6=['user-setting:','./user-setting.events','save','remove','update','user-setting:update','emit','user-setting:update:user-','UserId','length'];(function(_0x239866,_0x261f27){var _0x3af064=function(_0x2715a0){while(--_0x2715a0){_0x239866['push'](_0x239866['shift']());}};_0x3af064(++_0x261f27);}(_0x99f6,0x83));var _0x699f=function(_0x1e0288,_0xf26008){_0x1e0288=_0x1e0288-0x0;var _0x2510d9=_0x99f6[_0x1e0288];return _0x2510d9;};'use strict';var UserSettingEvents=require(_0x699f('0x0'));var events=[_0x699f('0x1'),_0x699f('0x2'),_0x699f('0x3')];function createListener(_0x5a1136,_0x1fad23){return function(_0x1f2577){_0x1fad23['emit'](_0x5a1136,_0x1f2577);if(_0x5a1136===_0x699f('0x4')){_0x1fad23[_0x699f('0x5')](_0x699f('0x6')+_0x1f2577[_0x699f('0x7')],_0x1f2577);}};}exports['register']=function(_0x22a14e){for(var _0xe5106c=0x0,_0x2c7a08=events[_0x699f('0x8')];_0xe5106c<_0x2c7a08;_0xe5106c++){var _0x477d66=events[_0xe5106c];var _0x4a1493=createListener(_0x699f('0x9')+_0x477d66,_0x22a14e);UserSettingEvents['on'](_0x477d66,_0x4a1493);}}; \ No newline at end of file +var _0x0e1b=['register','length','user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update','UserId'];(function(_0x2f3067,_0x390d50){var _0x598564=function(_0x131fa1){while(--_0x131fa1){_0x2f3067['push'](_0x2f3067['shift']());}};_0x598564(++_0x390d50);}(_0x0e1b,0x143));var _0xb0e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e1b[_0x3dd15e];return _0x231fd0;};'use strict';var UserSettingEvents=require(_0xb0e1('0x0'));var events=[_0xb0e1('0x1'),_0xb0e1('0x2'),_0xb0e1('0x3')];function createListener(_0x23e9f5,_0x54ade3){return function(_0xce4e8d){_0x54ade3[_0xb0e1('0x4')](_0x23e9f5,_0xce4e8d);if(_0x23e9f5===_0xb0e1('0x5')){_0x54ade3[_0xb0e1('0x4')]('user-setting:update:user-'+_0xce4e8d[_0xb0e1('0x6')],_0xce4e8d);}};}exports[_0xb0e1('0x7')]=function(_0x369e64){for(var _0x10ddd1=0x0,_0x239350=events[_0xb0e1('0x8')];_0x10ddd1<_0x239350;_0x10ddd1++){var _0x2eecbe=events[_0x10ddd1];var _0x56d1da=createListener(_0xb0e1('0x9')+_0x2eecbe,_0x369e64);UserSettingEvents['on'](_0x2eecbe,_0x56d1da);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5ba930f..7db39c4 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 _0x93bd=['getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x93bd,0xd6));var _0xd93b=function(_0x22b334,_0x121725){_0x22b334=_0x22b334-0x0;var _0x133f77=_0x93bd[_0x22b334];return _0x133f77;};'use strict';var multer=require(_0xd93b('0x0'));var util=require('util');var path=require(_0xd93b('0x1'));var timeout=require(_0xd93b('0x2'));var express=require(_0xd93b('0x3'));var router=express[_0xd93b('0x4')]();var fs_extra=require(_0xd93b('0x5'));var auth=require(_0xd93b('0x6'));var interaction=require(_0xd93b('0x7'));var config=require(_0xd93b('0x8'));var controller=require(_0xd93b('0x9'));router[_0xd93b('0xa')]('/',auth['isAuthenticated'](),controller[_0xd93b('0xb')]);router['get']('/describe',auth[_0xd93b('0xc')](),controller[_0xd93b('0xd')]);router[_0xd93b('0xa')](_0xd93b('0xe'),auth['isAuthenticated'](),controller[_0xd93b('0xf')]);router['get'](_0xd93b('0x10'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x11')]);router[_0xd93b('0xa')](_0xd93b('0x12'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x13')]);router[_0xd93b('0xa')](_0xd93b('0x14'),controller[_0xd93b('0x15')]);router['get'](_0xd93b('0x16'),auth['isAuthenticated'](),controller[_0xd93b('0x17')]);router[_0xd93b('0xa')](_0xd93b('0x18'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x19')]);router[_0xd93b('0xa')](_0xd93b('0x1a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x1b')]);router[_0xd93b('0xa')](_0xd93b('0x1c'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x1d')]);router[_0xd93b('0xa')]('/:id/groups',auth[_0xd93b('0xc')](),controller[_0xd93b('0x1e')]);router[_0xd93b('0xa')](_0xd93b('0x1f'),auth[_0xd93b('0xc')](),controller['getRecordings']);router[_0xd93b('0xa')](_0xd93b('0x20'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x21')]);router['get'](_0xd93b('0x22'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x23')]);router[_0xd93b('0xa')]('/:id/openchannel/interactions',auth[_0xd93b('0xc')](),controller[_0xd93b('0x24')]);router['get'](_0xd93b('0x25'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x26')]);router[_0xd93b('0xa')](_0xd93b('0x27'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x28')]);router[_0xd93b('0xa')](_0xd93b('0x29'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x2a')]);router[_0xd93b('0xa')](_0xd93b('0x2b'),auth['isAuthenticated'](),controller[_0xd93b('0x2c')]);router[_0xd93b('0xa')](_0xd93b('0x2d'),auth[_0xd93b('0xc')](),controller['getTeams']);router['get'](_0xd93b('0x2e'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x2f')]);router[_0xd93b('0xa')]('/:id/agents',auth[_0xd93b('0xc')](),controller['getAgents']);router['get']('/:id/prefixes',auth[_0xd93b('0xc')](),controller[_0xd93b('0x30')]);router[_0xd93b('0xa')](_0xd93b('0x31'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0xd93b('0xa')](_0xd93b('0x32'),auth['isAuthenticated'](),controller[_0xd93b('0x33')]);router['get'](_0xd93b('0x34'),auth['isAuthenticated'](),controller[_0xd93b('0x35')]);router[_0xd93b('0xa')](_0xd93b('0x36'),auth[_0xd93b('0xc')](),controller['getSmsAccounts']);router['get'](_0xd93b('0x37'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x38')]);router['get']('/:id/whatsapp_accounts',auth[_0xd93b('0xc')](),controller[_0xd93b('0x39')]);router['get'](_0xd93b('0x3a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x3b')]);router[_0xd93b('0xa')](_0xd93b('0x3c'),auth['isAuthenticated'](),controller[_0xd93b('0x3d')]);router['get'](_0xd93b('0x3e'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x3f')]);router[_0xd93b('0x40')](_0xd93b('0x18'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x41')]);router[_0xd93b('0x40')]('/',auth[_0xd93b('0xc')](),controller[_0xd93b('0x42')]);router[_0xd93b('0x40')](_0xd93b('0x43'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x44')]);router[_0xd93b('0x40')](_0xd93b('0x1a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x45')]);var upload=multer({'storage':multer[_0xd93b('0x46')]({'destination':function(_0x5a39e4,_0x110b5c,_0x554078){_0x554078(null,path[_0xd93b('0x47')](config[_0xd93b('0x48')],'server/files/images/'));},'filename':function(_0x5b104d,_0xac5742,_0x3c1c61){_0x3c1c61(null,util[_0xd93b('0x49')](_0xd93b('0x4a'),Date[_0xd93b('0x4b')](),_0xac5742[_0xd93b('0x4c')]));}})});router['post'](_0xd93b('0x14'),upload[_0xd93b('0x4d')](_0xd93b('0x4e')),controller[_0xd93b('0x4f')]);router[_0xd93b('0x40')](_0xd93b('0x50'),auth['isAuthenticated'](),controller[_0xd93b('0x51')]);router[_0xd93b('0x40')](_0xd93b('0x52'),auth['isAuthenticated'](),controller[_0xd93b('0x53')]);router[_0xd93b('0x40')](_0xd93b('0x54'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x55')]);router['post'](_0xd93b('0x56'),auth[_0xd93b('0xc')](),controller['unpause']);router[_0xd93b('0x40')](_0xd93b('0x2d'),auth['isAuthenticated'](),controller[_0xd93b('0x57')]);router[_0xd93b('0x40')](_0xd93b('0x58'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x59')]);router[_0xd93b('0x40')](_0xd93b('0x5a'),auth['isAuthenticated'](),controller[_0xd93b('0x5b')]);router[_0xd93b('0x40')](_0xd93b('0x5c'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x5d')]);router['post'](_0xd93b('0x5e'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x5f')]);router['post'](_0xd93b('0x60'),auth['isAuthenticated'](),controller[_0xd93b('0x61')]);router[_0xd93b('0x40')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xd93b('0x62')]);router[_0xd93b('0x40')](_0xd93b('0x31'),auth[_0xd93b('0xc')](),controller['addFaxAccounts']);router['post'](_0xd93b('0x32'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x63')]);router[_0xd93b('0x40')](_0xd93b('0x34'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x64')]);router[_0xd93b('0x40')](_0xd93b('0x36'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x65')]);router[_0xd93b('0x40')]('/:id/chat_websites',auth[_0xd93b('0xc')](),controller[_0xd93b('0x66')]);router[_0xd93b('0x40')](_0xd93b('0x67'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x68')]);router[_0xd93b('0x40')](_0xd93b('0x3a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x69')]);router['post'](_0xd93b('0x3e'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x6a')]);router[_0xd93b('0x6b')](_0xd93b('0x12'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x6c')]);router[_0xd93b('0x6b')]('/:id/password',auth['isAuthenticated'](),controller[_0xd93b('0x6d')]);router[_0xd93b('0x6e')](_0xd93b('0x1a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x6f')]);router[_0xd93b('0x6e')](_0xd93b('0x2d'),auth['isAuthenticated'](),controller[_0xd93b('0x70')]);router[_0xd93b('0x6e')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xd93b('0x6e')]('/:id/chat_interactions',auth[_0xd93b('0xc')](),controller[_0xd93b('0x71')]);router[_0xd93b('0x6e')](_0xd93b('0x5a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x72')]);router[_0xd93b('0x6e')](_0xd93b('0x5c'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x73')]);router[_0xd93b('0x6e')]('/:id/sms_interactions',auth[_0xd93b('0xc')](),controller['removeSmsInteractions']);router[_0xd93b('0x6e')]('/:id/openchannel_interactions',auth[_0xd93b('0xc')](),controller[_0xd93b('0x74')]);router[_0xd93b('0x6e')](_0xd93b('0x75'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x76')]);router[_0xd93b('0x6e')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xd93b('0x77')]);router[_0xd93b('0x6e')]('/:id/mail_accounts',auth[_0xd93b('0xc')](),controller[_0xd93b('0x78')]);router[_0xd93b('0x6e')](_0xd93b('0x34'),auth['isAuthenticated'](),controller[_0xd93b('0x79')]);router['delete'](_0xd93b('0x36'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x7a')]);router[_0xd93b('0x6e')]('/:id/chat_websites',auth[_0xd93b('0xc')](),controller[_0xd93b('0x7b')]);router['delete'](_0xd93b('0x67'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x7c')]);router[_0xd93b('0x6e')](_0xd93b('0x3a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x7d')]);router[_0xd93b('0x6e')](_0xd93b('0x3e'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x7e')]);module['exports']=router; \ No newline at end of file +var _0xfa63=['addContacts','post','create','/create_many','/:id/queues','addQueues','diskStorage','join','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/api_key','getApiKey'];(function(_0x483cf8,_0x5b6c2c){var _0x378cb0=function(_0x353447){while(--_0x353447){_0x483cf8['push'](_0x483cf8['shift']());}};_0x378cb0(++_0x5b6c2c);}(_0xfa63,0x190));var _0x3fa6=function(_0x284b56,_0x12efc6){_0x284b56=_0x284b56-0x0;var _0x1f1f9b=_0xfa63[_0x284b56];return _0x1f1f9b;};'use strict';var multer=require('multer');var util=require(_0x3fa6('0x0'));var path=require(_0x3fa6('0x1'));var timeout=require(_0x3fa6('0x2'));var express=require(_0x3fa6('0x3'));var router=express['Router']();var fs_extra=require(_0x3fa6('0x4'));var auth=require(_0x3fa6('0x5'));var interaction=require(_0x3fa6('0x6'));var config=require(_0x3fa6('0x7'));var controller=require(_0x3fa6('0x8'));router['get']('/',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0xa')]);router[_0x3fa6('0xb')](_0x3fa6('0xc'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0xd')]);router['get'](_0x3fa6('0xe'),auth[_0x3fa6('0x9')](),controller['whoami']);router['get'](_0x3fa6('0xf'),auth['isAuthenticated'](),controller[_0x3fa6('0x10')]);router[_0x3fa6('0xb')](_0x3fa6('0x11'),auth[_0x3fa6('0x9')](),controller['show']);router[_0x3fa6('0xb')](_0x3fa6('0x12'),controller[_0x3fa6('0x13')]);router['get']('/:id/open_tabs',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x14')]);router[_0x3fa6('0xb')](_0x3fa6('0x15'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x16')]);router[_0x3fa6('0xb')]('/:id/queues',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x17')]);router[_0x3fa6('0xb')](_0x3fa6('0x18'),auth['isAuthenticated'](),controller[_0x3fa6('0x19')]);router[_0x3fa6('0xb')](_0x3fa6('0x1a'),auth['isAuthenticated'](),controller[_0x3fa6('0x1b')]);router[_0x3fa6('0xb')](_0x3fa6('0x1c'),auth['isAuthenticated'](),controller[_0x3fa6('0x1d')]);router['get'](_0x3fa6('0x1e'),auth['isAuthenticated'](),controller[_0x3fa6('0x1f')]);router[_0x3fa6('0xb')](_0x3fa6('0x20'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x21')]);router['get'](_0x3fa6('0x22'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x23')]);router[_0x3fa6('0xb')]('/:id/mail/interactions',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x24')]);router[_0x3fa6('0xb')](_0x3fa6('0x25'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x26')]);router[_0x3fa6('0xb')](_0x3fa6('0x27'),auth[_0x3fa6('0x9')](),controller['getFaxInteractions']);router['get']('/:id/whatsapp/interactions',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x28')]);router[_0x3fa6('0xb')](_0x3fa6('0x29'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3fa6('0xb')](_0x3fa6('0x2a'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x2b')]);router[_0x3fa6('0xb')](_0x3fa6('0x2c'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x2d')]);router[_0x3fa6('0xb')](_0x3fa6('0x2e'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x2f')]);router[_0x3fa6('0xb')](_0x3fa6('0x30'),auth[_0x3fa6('0x9')](),controller['getFaxAccounts']);router[_0x3fa6('0xb')](_0x3fa6('0x31'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x32')]);router[_0x3fa6('0xb')](_0x3fa6('0x33'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x34')]);router['get']('/:id/sms_accounts',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x35')]);router['get'](_0x3fa6('0x36'),auth[_0x3fa6('0x9')](),controller['getChatWebsites']);router[_0x3fa6('0xb')]('/:id/whatsapp_accounts',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x37')]);router['get'](_0x3fa6('0x38'),auth['isAuthenticated'](),controller[_0x3fa6('0x39')]);router[_0x3fa6('0xb')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0x3fa6('0xb')](_0x3fa6('0x3a'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x3b')]);router['post'](_0x3fa6('0x15'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x3c')]);router[_0x3fa6('0x3d')]('/',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x3e')]);router[_0x3fa6('0x3d')](_0x3fa6('0x3f'),auth[_0x3fa6('0x9')](),controller['bulkCreate']);router[_0x3fa6('0x3d')](_0x3fa6('0x40'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x41')]);var upload=multer({'storage':multer[_0x3fa6('0x42')]({'destination':function(_0x11f676,_0x5f1241,_0x164036){_0x164036(null,path[_0x3fa6('0x43')](config['root'],_0x3fa6('0x44')));},'filename':function(_0x1884bf,_0x547494,_0x3d8958){_0x3d8958(null,util['format'](_0x3fa6('0x45'),Date[_0x3fa6('0x46')](),_0x547494[_0x3fa6('0x47')]));}})});router[_0x3fa6('0x3d')](_0x3fa6('0x12'),upload[_0x3fa6('0x48')](_0x3fa6('0x49')),controller[_0x3fa6('0x4a')]);router['post'](_0x3fa6('0x4b'),auth['isAuthenticated'](),controller[_0x3fa6('0x4c')]);router['post'](_0x3fa6('0x4d'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x4e')]);router[_0x3fa6('0x3d')]('/:id/pause',auth[_0x3fa6('0x9')](),controller['pause']);router[_0x3fa6('0x3d')](_0x3fa6('0x4f'),auth[_0x3fa6('0x9')](),controller['unpause']);router[_0x3fa6('0x3d')](_0x3fa6('0x29'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x50')]);router[_0x3fa6('0x3d')](_0x3fa6('0x51'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x52')]);router[_0x3fa6('0x3d')](_0x3fa6('0x53'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x54')]);router[_0x3fa6('0x3d')](_0x3fa6('0x55'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x56')]);router[_0x3fa6('0x3d')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x3fa6('0x57')]);router[_0x3fa6('0x3d')](_0x3fa6('0x58'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x59')]);router['post'](_0x3fa6('0x5a'),auth[_0x3fa6('0x9')](),controller['addWhatsappInteractions']);router[_0x3fa6('0x3d')](_0x3fa6('0x30'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x5b')]);router[_0x3fa6('0x3d')](_0x3fa6('0x31'),auth[_0x3fa6('0x9')](),controller['addMailAccounts']);router['post'](_0x3fa6('0x33'),auth[_0x3fa6('0x9')](),controller['addOpenchannelAccounts']);router[_0x3fa6('0x3d')](_0x3fa6('0x5c'),auth['isAuthenticated'](),controller[_0x3fa6('0x5d')]);router[_0x3fa6('0x3d')](_0x3fa6('0x36'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x5e')]);router['post'](_0x3fa6('0x5f'),auth['isAuthenticated'](),controller[_0x3fa6('0x60')]);router[_0x3fa6('0x3d')]('/:id/square_projects',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x61')]);router[_0x3fa6('0x3d')](_0x3fa6('0x3a'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x62')]);router['put'](_0x3fa6('0x11'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x63')]);router['put'](_0x3fa6('0x64'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x65')]);router[_0x3fa6('0x66')](_0x3fa6('0x40'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x67')]);router[_0x3fa6('0x66')](_0x3fa6('0x29'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x68')]);router[_0x3fa6('0x66')](_0x3fa6('0x11'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x69')]);router[_0x3fa6('0x66')](_0x3fa6('0x51'),auth[_0x3fa6('0x9')](),controller['removeChatInteractions']);router[_0x3fa6('0x66')](_0x3fa6('0x53'),auth['isAuthenticated'](),controller[_0x3fa6('0x6a')]);router[_0x3fa6('0x66')](_0x3fa6('0x55'),auth[_0x3fa6('0x9')](),controller['removeFaxInteractions']);router[_0x3fa6('0x66')]('/:id/sms_interactions',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x6b')]);router[_0x3fa6('0x66')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x3fa6('0x6c')]);router['delete'](_0x3fa6('0x5a'),auth[_0x3fa6('0x9')](),controller['removeWhatsappInteractions']);router[_0x3fa6('0x66')](_0x3fa6('0x30'),auth['isAuthenticated'](),controller[_0x3fa6('0x6d')]);router[_0x3fa6('0x66')](_0x3fa6('0x31'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x3fa6('0x66')]('/:id/openchannel_accounts',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x6e')]);router[_0x3fa6('0x66')](_0x3fa6('0x5c'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x6f')]);router['delete'](_0x3fa6('0x36'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x3fa6('0x66')](_0x3fa6('0x5f'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x70')]);router[_0x3fa6('0x66')](_0x3fa6('0x38'),auth['isAuthenticated'](),controller[_0x3fa6('0x71')]);router[_0x3fa6('0x66')](_0x3fa6('0x3a'),auth[_0x3fa6('0x9')](),controller['removeApiKey']);module[_0x3fa6('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 19d5453..f14a12c 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 _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x1871ac,_0x2f3e10){var _0x499037=function(_0xdd4c1b){while(--_0xdd4c1b){_0x1871ac['push'](_0x1871ac['shift']());}};_0x499037(++_0x2f3e10);}(_0x34e8,0x12c));var _0x834e=function(_0x5e40af,_0x292ddf){_0x5e40af=_0x5e40af-0x0;var _0x4bca2f=_0x34e8[_0x5e40af];return _0x4bca2f;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x2087b4,_0x347664){var _0x3cb351=function(_0x2b02b7){while(--_0x2b02b7){_0x2087b4['push'](_0x2087b4['shift']());}};_0x3cb351(++_0x347664);}(_0x34e8,0x12c));var _0x834e=function(_0x376bee,_0x2db1fa){_0x376bee=_0x376bee-0x0;var _0x8724e7=_0x34e8[_0x376bee];return _0x8724e7;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 4c79f49..97be9b3 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 _0x0d54=['$not','$between','$notBetween','$in','$like','$notILike','$overlap','$contains','$contained','firstName','lastName','phone','Contact','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','queues','teams','inbound','getAgents','flatten','lower','col','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','idle','unknown','unavailable','ringing','voiceStatus','slice','charAt','toUpperCase','SELECT','field','ui.','InteractionId','user_has_','OpenTabs','moment','path','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','request','info','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','code','message','User,\x20%s,\x20%s','result','catch','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','update','then','emit','userNotification:recalc:','get','role','admin','Users','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','find','name','destroy','stack','send','index','User','rawAttributes','fieldName','type','key','salt','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','dataValues','sms','mail','whatsapp','all','show','params','keys','password','filters','model','intersection','fields','merge','chat','body','describe','ids','omit','internal','findById','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','103','113','110','105','106','107','108','109','100','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','compact','includes','UserProfileResource','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Wrong\x20credentials','newPassword','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','passwordHistoryLimit','securePassword','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','voicePause','interface','isValidChannel','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','VoiceQueue','voice','format','UserVoiceQueueRt','upsert','Unknown\x20channel','remove','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','openchannel','fax','ChatOpenTabs','createdAt','FaxOpenTabs','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','order','sort','options','hasOwnProperty','CmList','List','Tag','Tags','color','tag','nolimit','getQueues','pick','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','UserId','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','YYYY-MM-DD\x20HH:mm:ss','isMiddleware','resolve','logout','online','QueuePause','pause','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','unpause','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','transaction','getAssociatedQueues','flattenDeep','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','getLists','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq'];(function(_0xac40f2,_0x92122a){var _0x438130=function(_0x30830c){while(--_0x30830c){_0xac40f2['push'](_0xac40f2['shift']());}};_0x438130(++_0x92122a);}(_0x0d54,0x1d4));var _0x40d5=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x0d54[_0x396466];return _0x5e9ab4;};'use strict';var moment=require(_0x40d5('0x0'));var util=require('util');var path=require(_0x40d5('0x1'));var fs=require('fs');var _=require(_0x40d5('0x2'));var squel=require(_0x40d5('0x3'));var jayson=require('jayson/promise');var Redis=require(_0x40d5('0x4'));var authService=require(_0x40d5('0x5'));var qs=require(_0x40d5('0x6'));var logger=require(_0x40d5('0x7'))(_0x40d5('0x8'));var utils=require(_0x40d5('0x9'));var config=require(_0x40d5('0xa'));var licenseUtil=require(_0x40d5('0xb'));var APIBadRequestError=require(_0x40d5('0xc'))[_0x40d5('0xd')];var APINotFoundError=require('../../errors/api')[_0x40d5('0xe')];var APIHandleError=require(_0x40d5('0xc'))[_0x40d5('0xf')];var db=require(_0x40d5('0x10'))['db'];var socket=require(_0x40d5('0x11'))(new Redis(config[_0x40d5('0x12')]));require(_0x40d5('0x13'))[_0x40d5('0x14')](socket);config[_0x40d5('0x12')]=_[_0x40d5('0x15')](config['redis'],{'host':_0x40d5('0x16'),'port':0x18eb});var amiClient=jayson[_0x40d5('0x17')][_0x40d5('0x18')]({'port':0x232a});var values;function respondWithRpcPromise(_0x233f36,_0x2a5303,_0x2a23a6,_0xc01070){return new Promise(function(_0x3ea5a8,_0x2c1172){var _0x339b7e=_0xc01070||amiClient;return _0x339b7e[_0x40d5('0x19')](_0x233f36,_0x2a23a6)['then'](function(_0x1ad230){logger[_0x40d5('0x1a')]('User,\x20%s,\x20%s',_0x2a5303,_0x40d5('0x1b'));logger['debug'](_0x40d5('0x1c'),_0x2a5303,_0x40d5('0x1b'),JSON['stringify'](_0x1ad230));if(_0x1ad230[_0x40d5('0x1d')]){if(_0x1ad230[_0x40d5('0x1d')][_0x40d5('0x1e')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x2a5303,_0x1ad230[_0x40d5('0x1d')]['message']);return _0x2c1172(_0x1ad230[_0x40d5('0x1d')][_0x40d5('0x1f')]);}logger[_0x40d5('0x1d')](_0x40d5('0x20'),_0x2a5303,_0x1ad230[_0x40d5('0x1d')][_0x40d5('0x1f')]);return _0x3ea5a8(_0x1ad230[_0x40d5('0x1d')][_0x40d5('0x1f')]);}else{logger[_0x40d5('0x1a')]('User,\x20%s,\x20%s',_0x2a5303,_0x40d5('0x1b'));_0x3ea5a8(_0x1ad230[_0x40d5('0x21')][_0x40d5('0x1f')]);}})[_0x40d5('0x22')](function(_0x56ea25){logger['error'](_0x40d5('0x20'),_0x2a5303,_0x56ea25);_0x2c1172(_0x56ea25);});});}function respondWithStatusCode(_0x17413b,_0x2a378f){_0x2a378f=_0x2a378f||0xcc;return function(_0x6f60d3){if(_0x6f60d3){return _0x17413b[_0x40d5('0x23')](_0x2a378f);}return _0x17413b['status'](_0x2a378f)[_0x40d5('0x24')]();};}function respondWithResult(_0x1a8bc7,_0x17758f){_0x17758f=_0x17758f||0xc8;return function(_0xb5f406){if(_0xb5f406){return _0x1a8bc7[_0x40d5('0x25')](_0x17758f)['json'](_0xb5f406);}};}function respondWithFilteredResult(_0x117e3b,_0x327b42){return function(_0x295fc2){if(_0x295fc2){var _0x51ff5e=typeof _0x327b42['offset']===_0x40d5('0x26')&&typeof _0x327b42[_0x40d5('0x27')]==='undefined';var _0x16d4a6=_0x295fc2[_0x40d5('0x28')];var _0x1f89ce=_0x51ff5e?0x0:_0x327b42['offset'];var _0x52f171=_0x51ff5e?_0x295fc2[_0x40d5('0x28')]:_0x327b42[_0x40d5('0x29')]+_0x327b42[_0x40d5('0x27')];var _0x53fb81;if(_0x52f171>=_0x16d4a6){_0x52f171=_0x16d4a6;_0x53fb81=0xc8;}else{_0x53fb81=0xce;}_0x117e3b[_0x40d5('0x25')](_0x53fb81);return _0x117e3b['set'](_0x40d5('0x2a'),_0x1f89ce+'-'+_0x52f171+'/'+_0x16d4a6)[_0x40d5('0x2b')](_0x295fc2);}return null;};}function saveUpdates(_0x1fa14c){return function(_0x2b06f2){if(_0x2b06f2){return _0x2b06f2[_0x40d5('0x2c')](_0x1fa14c)[_0x40d5('0x2d')](function(_0x59c360){socket[_0x40d5('0x2e')](_0x40d5('0x2f')+_0x59c360['id'],{});return _0x59c360;});}return null;};}function removeEntity(_0x2a0374){return function(_0x591e7d){if(_0x591e7d){return _0x591e7d['destroy']()['then'](function(){var _0x1c011f=_0x591e7d[_0x40d5('0x30')]({'plain':!![]});if(_0x1c011f[_0x40d5('0x31')]===_0x40d5('0x32'))return;var _0x3b0ab7=[{'name':_0x40d5('0x33'),'value':_0x40d5('0x34'),'ignore':!![]},{'name':_0x40d5('0x35'),'value':_0x40d5('0x36'),'ignore':![]},{'name':_0x40d5('0x37'),'value':_0x40d5('0x38'),'ignore':![]}];var _0x34144c=_(_0x3b0ab7)[_0x40d5('0x39')](_0x40d5('0x3a'))[_0x40d5('0x3b')](_0x40d5('0x3c'))['value']();if(_['includes'](_0x34144c,_0x1c011f[_0x40d5('0x31')])){return;}var _0x516eb7=_[_0x40d5('0x3d')](_0x3b0ab7,[_0x40d5('0x3c'),_0x1c011f[_0x40d5('0x31')]])[_0x40d5('0x3e')];return db['UserProfileResource'][_0x40d5('0x3f')]({'where':{'type':_0x516eb7,'resourceId':_0x1c011f['id']}})['then'](function(){return _0x591e7d;});})[_0x40d5('0x2d')](function(){_0x2a0374[_0x40d5('0x25')](0xcc)[_0x40d5('0x24')]();});}};}function handleEntityNotFound(_0x345b79){return function(_0x20d9d1){if(!_0x20d9d1){_0x345b79[_0x40d5('0x23')](0x194);}return _0x20d9d1;};}function handleError(_0x3555f9,_0x38af43){_0x38af43=_0x38af43||0x1f4;return function(_0xb96b78){logger[_0x40d5('0x1d')](_0xb96b78[_0x40d5('0x40')]);if(_0xb96b78['name']){delete _0xb96b78[_0x40d5('0x3e')];}_0x3555f9[_0x40d5('0x25')](_0x38af43)[_0x40d5('0x41')](_0xb96b78);};}exports[_0x40d5('0x42')]=function(_0x2a9779,_0x2776bd){var _0x4481a8={},_0x3a2c7f={'count':0x0,'rows':[]};var _0x5b7bb2=_(db[_0x40d5('0x43')][_0x40d5('0x44')])[_0x40d5('0x3b')](function(_0x3e1fbf){return{'name':_0x3e1fbf[_0x40d5('0x45')],'type':_0x3e1fbf[_0x40d5('0x46')][_0x40d5('0x47')]};})[_0x40d5('0x39')](function(_0x155198){return!_['includes'](['password',_0x40d5('0x48')],_0x155198[_0x40d5('0x3e')]);})[_0x40d5('0x3c')]();_0x4481a8=qs[_0x40d5('0x49')](_0x5b7bb2,_0x2a9779);var _0x2841af={'where':_0x4481a8[_0x40d5('0x4a')]};return db[_0x40d5('0x43')]['count'](_0x2841af)[_0x40d5('0x2d')](function(_0x56181d){_0x3a2c7f[_0x40d5('0x28')]=_0x56181d;if(_0x2a9779[_0x40d5('0x4b')][_0x40d5('0x4c')]){_0x4481a8[_0x40d5('0x4d')]=[{'all':!![]}];}if(_0x2a9779[_0x40d5('0x4b')][_0x40d5('0x4e')]===_0x40d5('0x4f')){_0x4481a8[_0x40d5('0x4d')]=[{'model':db[_0x40d5('0x50')],'as':'userSetting'}];}if(!_['includes'](_0x4481a8[_0x40d5('0x51')],'id')){_0x4481a8[_0x40d5('0x51')][_0x40d5('0x52')]('id');}return db[_0x40d5('0x43')][_0x40d5('0x53')](_0x4481a8);})[_0x40d5('0x2d')](function(_0x44c077){_0x3a2c7f[_0x40d5('0x54')]=_0x44c077;if(_0x2a9779[_0x40d5('0x4b')][_0x40d5('0x55')]===_0x40d5('0x4f')){var _0x7fe61=[];for(var _0x58a8e0=0x0;_0x58a8e0<_0x3a2c7f['rows'][_0x40d5('0x56')];_0x58a8e0++){_0x7fe61[_0x40d5('0x52')](get_open_tabs('chat',_0x3a2c7f['rows'][_0x58a8e0][_0x40d5('0x57')]));_0x7fe61['push'](get_open_tabs(_0x40d5('0x58'),_0x3a2c7f[_0x40d5('0x54')][_0x58a8e0]['dataValues']));_0x7fe61[_0x40d5('0x52')](get_open_tabs('fax',_0x3a2c7f[_0x40d5('0x54')][_0x58a8e0]['dataValues']));_0x7fe61[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x59'),_0x3a2c7f[_0x40d5('0x54')][_0x58a8e0][_0x40d5('0x57')]));_0x7fe61[_0x40d5('0x52')](get_open_tabs('openchannel',_0x3a2c7f[_0x40d5('0x54')][_0x58a8e0]['dataValues']));_0x7fe61['push'](get_open_tabs(_0x40d5('0x5a'),_0x3a2c7f['rows'][_0x58a8e0][_0x40d5('0x57')]));}return Promise[_0x40d5('0x5b')](_0x7fe61)['then'](function(){return _0x3a2c7f;});}else{return _0x3a2c7f;}})[_0x40d5('0x2d')](respondWithFilteredResult(_0x2776bd,_0x4481a8))[_0x40d5('0x22')](handleError(_0x2776bd,null));};exports[_0x40d5('0x5c')]=function(_0x4eb134,_0x212d51){var _0x28c0b2={'raw':![],'where':{'id':_0x4eb134[_0x40d5('0x5d')]['id']}},_0x309000={};_0x309000['model']=_['differenceBy'](_[_0x40d5('0x5e')](db[_0x40d5('0x43')]['rawAttributes']),[_0x40d5('0x5f'),_0x40d5('0x48')]);_0x309000['query']=_['keys'](_0x4eb134[_0x40d5('0x4b')]);_0x309000[_0x40d5('0x60')]=_['intersection'](_0x309000[_0x40d5('0x61')],_0x309000[_0x40d5('0x4b')]);_0x28c0b2['attributes']=_[_0x40d5('0x62')](_0x309000['model'],qs[_0x40d5('0x63')](_0x4eb134[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x28c0b2[_0x40d5('0x51')]=_0x28c0b2['attributes'][_0x40d5('0x56')]?_0x28c0b2[_0x40d5('0x51')]:_0x309000['model'];if(_0x4eb134[_0x40d5('0x4b')][_0x40d5('0x4c')]){_0x28c0b2[_0x40d5('0x4d')]=[{'all':!![]}];}if(_0x4eb134[_0x40d5('0x4b')][_0x40d5('0x4e')]===_0x40d5('0x4f')){_0x28c0b2['include']=[{'model':db[_0x40d5('0x50')],'as':_0x40d5('0x4e')}];}_0x28c0b2=_[_0x40d5('0x64')]({},_0x28c0b2,_0x4eb134['options']);if(!_['includes'](_0x28c0b2['attributes'],'id')){_0x28c0b2[_0x40d5('0x51')][_0x40d5('0x52')]('id');}return db['User'][_0x40d5('0x3d')](_0x28c0b2)[_0x40d5('0x2d')](handleEntityNotFound(_0x212d51,null))[_0x40d5('0x2d')](function(_0x152949){var _0x4bdbfc=[];values=_0x152949;if(_0x4eb134[_0x40d5('0x4b')][_0x40d5('0x55')]===_0x40d5('0x4f')){_0x4bdbfc['push'](get_open_tabs(_0x40d5('0x65'),_0x152949[_0x40d5('0x57')]));_0x4bdbfc['push'](get_open_tabs(_0x40d5('0x58'),_0x152949[_0x40d5('0x57')]));_0x4bdbfc[_0x40d5('0x52')](get_open_tabs('openchannel',_0x152949[_0x40d5('0x57')]));_0x4bdbfc[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x5a'),_0x152949[_0x40d5('0x57')]));_0x4bdbfc['push'](get_open_tabs('fax',_0x152949['dataValues']));_0x4bdbfc[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x59'),_0x152949[_0x40d5('0x57')]));return Promise['all'](_0x4bdbfc);}else{return values;}})['then'](function(){return values;})[_0x40d5('0x2d')](respondWithResult(_0x212d51,null))['catch'](handleError(_0x212d51,null));};exports['update']=function(_0x4ca7c9,_0x2d398c){if(_0x4ca7c9['body']['id']){delete _0x4ca7c9[_0x40d5('0x66')]['id'];}delete _0x4ca7c9['body']['role'];return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x4ca7c9[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x2d398c,null))[_0x40d5('0x2d')](saveUpdates(_0x4ca7c9[_0x40d5('0x66')],null))['then'](respondWithResult(_0x2d398c,null))['catch'](handleError(_0x2d398c,null));};exports['describe']=function(_0x32a434,_0x3d188f){return db[_0x40d5('0x43')][_0x40d5('0x67')]()[_0x40d5('0x2d')](respondWithResult(_0x3d188f,null))['catch'](handleError(_0x3d188f,null));};exports['addContacts']=function(_0x5021ec,_0x4c69fd){return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x5021ec[_0x40d5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4c69fd,null))[_0x40d5('0x2d')](function(_0x347327){if(_0x347327){return _0x347327['addContacts'](_0x5021ec[_0x40d5('0x66')][_0x40d5('0x68')],_[_0x40d5('0x69')](_0x5021ec[_0x40d5('0x66')],['ids','id'])||{});}})[_0x40d5('0x2d')](respondWithResult(_0x4c69fd,null))[_0x40d5('0x22')](handleError(_0x4c69fd,null));};function validateUser(_0x3cc5ac){return new Promise(function(_0x2e5e18,_0x3accbf){if(_0x3cc5ac[_0x40d5('0x6a')])return _0x2e5e18(_0x3cc5ac);return db['Setting'][_0x40d5('0x6b')](0x1)[_0x40d5('0x2d')](function(_0x29750d){if(_0x29750d['securePassword'])authService[_0x40d5('0x6c')](_0x3cc5ac['password']);db['User'][_0x40d5('0x6d')](_0x40d5('0x6a'))[_0x40d5('0x2d')](function(_0x2bde59){if(_[_0x40d5('0x6e')](_0x2bde59)){_0x3cc5ac[_0x40d5('0x6a')]=_0x29750d[_0x40d5('0x6f')]||0x1;return;}if(_[_0x40d5('0x6e')](_0x29750d[_0x40d5('0x6f')])||_0x29750d[_0x40d5('0x6f')]===_0x2bde59){_0x3cc5ac[_0x40d5('0x6a')]=_0x2bde59+0x1;return;}if(_0x29750d['min_internal']>_0x2bde59){_0x3cc5ac['internal']=_0x29750d[_0x40d5('0x6f')];return;}return db[_0x40d5('0x70')][_0x40d5('0x4b')](_0x40d5('0x71'),{'type':db[_0x40d5('0x70')][_0x40d5('0x72')]['SELECT']})['then'](function(_0x3be093){if(_0x3be093&&_0x3be093['length']){for(var _0x4d447b=0x0,_0x53f4fe=_0x3be093[_0x40d5('0x56')];_0x4d447b<_0x53f4fe&&_['isNil'](_0x3cc5ac[_0x40d5('0x6a')]);_0x4d447b++){if(_0x29750d['min_internal']<=_0x3be093[_0x4d447b][_0x40d5('0x73')]){_0x3cc5ac['internal']=_0x3be093[_0x4d447b][_0x40d5('0x73')];}else if(_0x29750d[_0x40d5('0x6f')]>_0x3be093[_0x4d447b]['from']&&_0x29750d[_0x40d5('0x6f')]<=_0x3be093[_0x4d447b]['to']){_0x3cc5ac[_0x40d5('0x6a')]=_0x29750d[_0x40d5('0x6f')];}}}if(_['isNil'](_0x3cc5ac[_0x40d5('0x6a')])){_0x3cc5ac['internal']=_0x2bde59+0x1;}return _0x2e5e18(_0x3cc5ac);});});})[_0x40d5('0x22')](function(_0x1e58ea){_0x3accbf(_0x1e58ea);});});}function updateUser(_0x337678){return new Promise(function(_0x4543c4,_0x5f09b5){try{if(_0x337678[_0x40d5('0x74')]){_0x337678[_0x40d5('0x75')]=_0x337678[_0x40d5('0x6a')];_0x337678[_0x40d5('0x76')]={'mailbox':_0x337678['internal'],'password':_0x337678[_0x40d5('0x5f')],'fullname':_0x337678[_0x40d5('0x77')],'email':_0x337678[_0x40d5('0x78')]};}if(_0x337678[_0x40d5('0x31')]===_0x40d5('0x36')){if(!_0x337678[_0x40d5('0x79')])_0x337678[_0x40d5('0x79')]=['101','102',_0x40d5('0x7a'),_0x40d5('0x7b'),_0x40d5('0x7c'),'104',_0x40d5('0x7d'),_0x40d5('0x7e'),_0x40d5('0x7f'),_0x40d5('0x80'),_0x40d5('0x81'),_0x40d5('0x82'),'111',_0x40d5('0x83'),_0x40d5('0x84')];}_0x4543c4(_0x337678);}catch(_0x323e42){_0x5f09b5(_0x323e42);}});}exports[_0x40d5('0x85')]=function(_0x299e6d,_0x324393){if(_0x299e6d[_0x40d5('0x34')]['role']==='agent')throw new Error(_0x40d5('0x86'));if(_0x299e6d['body'][_0x40d5('0x31')]===_0x40d5('0x34')&&_0x299e6d['user'][_0x40d5('0x31')]!==_0x40d5('0x32')){throw new Error(_0x40d5('0x87'));}if(_0x299e6d[_0x40d5('0x66')]['role']==='admin'&&_0x299e6d[_0x40d5('0x34')][_0x40d5('0x31')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x40d5('0x88')]([_0x299e6d[_0x40d5('0x66')]])[_0x40d5('0x2d')](function(){return validateUser(_0x299e6d['body']);})[_0x40d5('0x2d')](function(_0x432b0d){return updateUser(_0x432b0d)['then'](function(_0x3c9c93){if(_0x3c9c93[_0x40d5('0x31')]===_0x40d5('0x32')){_0x3c9c93[_0x40d5('0x89')]=_0x299e6d['user'][_0x40d5('0x89')];delete _0x3c9c93[_0x40d5('0x8a')];}return _0x3c9c93;});})[_0x40d5('0x2d')](function(_0x41d918){return db[_0x40d5('0x43')]['create'](_0x41d918,{'include':[{'model':db[_0x40d5('0x76')],'as':_0x40d5('0x76')}]});})[_0x40d5('0x2d')](function(_0x561f50){if(_0x299e6d[_0x40d5('0x66')][_0x40d5('0x31')]==='user')return _0x561f50;if(_0x299e6d['user'][_0x40d5('0x31')]!==_0x40d5('0x34'))return _0x561f50;return db[_0x40d5('0x8b')]['find']({'where':{'name':_0x561f50['role']===_0x40d5('0x36')?_0x40d5('0x35'):_0x40d5('0x37'),'userProfileId':_0x299e6d[_0x40d5('0x34')][_0x40d5('0x8a')]},'raw':!![]})['then'](function(_0x1e77e8){if(!_0x1e77e8||_0x1e77e8[_0x40d5('0x8c')]!=0x0)return _0x561f50;return db['UserProfileResource'][_0x40d5('0x85')]({'name':_0x561f50[_0x40d5('0x3e')],'resourceId':_0x561f50['id'],'type':_0x1e77e8[_0x40d5('0x3e')],'sectionId':_0x1e77e8['id']},{})[_0x40d5('0x2d')](function(){return _0x561f50;});})[_0x40d5('0x22')](function(_0x383c5f){logger[_0x40d5('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x383c5f);throw _0x383c5f;});})[_0x40d5('0x2d')](respondWithResult(_0x324393,0xc9))[_0x40d5('0x22')](handleError(_0x324393,null));};exports[_0x40d5('0x8d')]=function(_0x1c7885,_0x40bfca){var _0x50db92=_0x1c7885[_0x40d5('0x66')];var _0x365f54=[];if(_0x1c7885['user'][_0x40d5('0x31')]===_0x40d5('0x36'))throw new Error('Unauthorized');if(_[_0x40d5('0x8e')](_0x50db92,[_0x40d5('0x31'),_0x40d5('0x34')])&&_0x1c7885[_0x40d5('0x34')]['role']!==_0x40d5('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x50db92,[_0x40d5('0x31'),_0x40d5('0x32')])&&_0x1c7885[_0x40d5('0x34')]['role']!==_0x40d5('0x32')){throw new Error(_0x40d5('0x8f'));}return licenseUtil[_0x40d5('0x88')](_0x50db92)[_0x40d5('0x2d')](function(){return validateUser(_0x50db92[0x0]);})['then'](function(){for(var _0x1bff71=0x1;_0x1bff71<_0x50db92['length'];_0x1bff71++){var _0x1a6a7e=_0x50db92[_0x1bff71-0x1]['internal'];if(!_0x50db92[_0x1bff71][_0x40d5('0x6a')])_0x50db92[_0x1bff71][_0x40d5('0x6a')]=_0x1a6a7e+0x1;_0x365f54[_0x40d5('0x52')](validateUser(_0x50db92[_0x1bff71]));}return Promise[_0x40d5('0x5b')](_0x365f54);})[_0x40d5('0x2d')](function(){_0x365f54=[];for(var _0x47c863=0x0;_0x47c863<_0x50db92[_0x40d5('0x56')];_0x47c863++){_0x365f54[_0x40d5('0x52')](updateUser(_0x50db92[_0x47c863]));}return Promise['all'](_0x365f54);})[_0x40d5('0x2d')](function(){_0x365f54=_0x50db92['map'](function(_0x42aab8){return db['User'][_0x40d5('0x85')](_0x42aab8,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x40d5('0x2d')](function(_0x5e0096){_0x42aab8['id']=_0x5e0096['id'];return _0x42aab8;});});return Promise[_0x40d5('0x5b')](_0x365f54);})['then'](function(_0x347187){if(_0x1c7885[_0x40d5('0x66')][_0x40d5('0x31')]===_0x40d5('0x34'))return _0x347187;if(_0x1c7885[_0x40d5('0x34')][_0x40d5('0x31')]!==_0x40d5('0x34'))return _0x347187;var _0x430f12=_[_0x40d5('0x8e')](_0x347187,function(_0x7a7eac){return _0x7a7eac[_0x40d5('0x31')]===_0x40d5('0x36')||_0x7a7eac[_0x40d5('0x31')]==='telephone';});if(!_0x430f12)return _0x347187;return db[_0x40d5('0x8b')][_0x40d5('0x53')]({'where':{'name':{'$or':['Agents',_0x40d5('0x37')]},'userProfileId':_0x1c7885[_0x40d5('0x34')][_0x40d5('0x8a')]},'raw':!![]})[_0x40d5('0x2d')](function(_0xe3363e){if(_[_0x40d5('0x90')](_0xe3363e)||!_[_0x40d5('0x8e')](_0xe3363e,[_0x40d5('0x8c'),0x0]))return _0x347187;_0x365f54=[];var _0xb69e51=_(_0xe3363e)[_0x40d5('0x3b')](function(_0xc5eeb){if(_0xc5eeb[_0x40d5('0x8c')]===0x1)return;return _0xc5eeb[_0x40d5('0x3e')]===_0x40d5('0x35')?_0x40d5('0x36'):'telephone';})[_0x40d5('0x91')]()[_0x40d5('0x3c')]();for(var _0x319823=0x0;_0x319823<_0x347187[_0x40d5('0x56')];_0x319823++){if(!_[_0x40d5('0x92')](_0xb69e51,_0x347187[_0x319823][_0x40d5('0x31')]))return;var _0x1208eb=_0x347187[_0x319823][_0x40d5('0x31')]===_0x40d5('0x36')?'Agents':'Telephones';_0x365f54['push'](db[_0x40d5('0x93')][_0x40d5('0x85')]({'name':_0x347187[_0x319823][_0x40d5('0x3e')],'resourceId':_0x347187[_0x319823]['id'],'type':_0x1208eb,'sectionId':_[_0x40d5('0x3d')](_0xe3363e,[_0x40d5('0x3e'),_0x1208eb])['id']},{}));}return Promise[_0x40d5('0x5b')](_0x365f54);});})[_0x40d5('0x2d')](respondWithResult(_0x40bfca,0xc9))[_0x40d5('0x22')](handleError(_0x40bfca,null));};exports['changePassword']=function(_0x33f078,_0x5a9599){if(_0x33f078[_0x40d5('0x66')]['id']){delete _0x33f078[_0x40d5('0x66')]['id'];}return db['User']['find']({'where':{'id':_0x33f078[_0x40d5('0x5d')]['id']}})['then'](function(_0x388ba2){if(!_0x388ba2)return null;if(_0x388ba2['id']===_0x33f078[_0x40d5('0x34')]['id']){if(!_0x33f078[_0x40d5('0x66')]['oldPassword']||!_0x33f078[_0x40d5('0x66')]['newPassword']){throw new db[(_0x40d5('0x94'))]['ValidationError'](_0x40d5('0x95'));}if(!_0x388ba2[_0x40d5('0x96')](_0x33f078[_0x40d5('0x66')][_0x40d5('0x97')])){throw new db[(_0x40d5('0x94'))]['ValidationError'](_0x40d5('0x98'));}if(_0x33f078[_0x40d5('0x66')][_0x40d5('0x97')]===_0x33f078[_0x40d5('0x66')][_0x40d5('0x99')]){throw new db[(_0x40d5('0x94'))][(_0x40d5('0x9a'))](_0x40d5('0x9b'));}}else if(_0x33f078[_0x40d5('0x34')]['role']==='admin'){if(!_0x33f078[_0x40d5('0x66')][_0x40d5('0x99')]){throw new db[(_0x40d5('0x94'))][(_0x40d5('0x9a'))](_0x40d5('0x9c'));}}else if(_0x33f078[_0x40d5('0x34')][_0x40d5('0x31')]===_0x40d5('0x34')){if(!_0x33f078['body'][_0x40d5('0x99')]){throw new db[(_0x40d5('0x94'))]['ValidationError'](_0x40d5('0x9c'));}if(_0x388ba2[_0x40d5('0x31')]!=='agent'){throw new db['Sequelize']['ValidationError'](_0x40d5('0x86'));}}else{throw new db[(_0x40d5('0x94'))][(_0x40d5('0x9a'))](_0x40d5('0x86'));}return _0x388ba2;})[_0x40d5('0x2d')](handleEntityNotFound(_0x5a9599,null))[_0x40d5('0x2d')](function(_0x37498b){return db[_0x40d5('0x9d')][_0x40d5('0x9e')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x40d5('0x9f')]})['then'](function(_0xd91cc2){if(_0xd91cc2[_0x40d5('0xa0')])authService[_0x40d5('0x6c')](_0x33f078[_0x40d5('0x66')][_0x40d5('0x99')]);if(!_0xd91cc2['enforcePasswordHistory']||!_0x37498b[_0x40d5('0xa1')])return _0x37498b;authService[_0x40d5('0xa2')](_0x33f078[_0x40d5('0x66')]['newPassword'],_0x37498b[_0x40d5('0xa1')],_0xd91cc2[_0x40d5('0x9f')]);return _0x37498b;})['then'](saveUpdates({'password':_0x33f078[_0x40d5('0x66')][_0x40d5('0x99')],'passwordResetAt':_0x33f078[_0x40d5('0x34')]['id']==_0x33f078[_0x40d5('0x5d')]['id']?moment():null,'previousPasswords':authService[_0x40d5('0xa3')](_0x33f078['body'][_0x40d5('0x99')],_0x37498b[_0x40d5('0xa1')])},null));})[_0x40d5('0x2d')](respondWithResult(_0x5a9599,null))['catch'](handleError(_0x5a9599,null));};exports[_0x40d5('0xa4')]=function(_0x9b1f46,_0x48c586){var _0x5e2ceb=_0x9b1f46[_0x40d5('0x66')][_0x40d5('0xa5')];return db['User'][_0x40d5('0x3d')]({'where':{'id':_0x9b1f46['params']['id']},'attributes':['id','name',_0x40d5('0x31'),'online',_0x40d5('0xa6'),_0x40d5('0xa7'),_0x40d5('0xa8')]})['then'](handleEntityNotFound(_0x48c586,null))[_0x40d5('0x2d')](function(_0x51b61c){if(_0x51b61c){if(!utils[_0x40d5('0xa9')](_0x5e2ceb)){throw new db[(_0x40d5('0x94'))][(_0x40d5('0x9a'))]('Unknown\x20channel');}return _0x51b61c['add'+_[_0x40d5('0xaa')](_0x5e2ceb[_0x40d5('0xab')]())+_0x40d5('0xac')](_0x9b1f46['body']['ids'],{'penalty':_0x9b1f46[_0x40d5('0x66')][_0x40d5('0xad')]||0x0})[_0x40d5('0xae')](function(_0x59dec8){for(var _0x21fcdf=0x0;_0x21fcdf<_0x9b1f46[_0x40d5('0x66')]['ids'][_0x40d5('0x56')];_0x21fcdf+=0x1){var _0x2d11df={'UserId':Number(_0x9b1f46['params']['id'])};_0x2d11df[_['capitalize'](_0x5e2ceb[_0x40d5('0xab')]())+_0x40d5('0xaf')]=Number(_0x9b1f46[_0x40d5('0x66')][_0x40d5('0x68')][_0x21fcdf]);socket[_0x40d5('0x2e')](_0x40d5('0x34')+_['capitalize'](_0x5e2ceb['toLowerCase']())+_0x40d5('0xb0'),_0x2d11df);}return _0x59dec8;})[_0x40d5('0x2d')](function(){if(_0x5e2ceb==='voice'){return db[_0x40d5('0xb1')][_0x40d5('0x53')]({'where':{'id':_0x9b1f46[_0x40d5('0x66')][_0x40d5('0x68')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x5d39ec){var _0x13b35b=_0x51b61c[_0x40d5('0x30')]({'plain':!![]});var _0x4c7589=[];if(_0x5e2ceb===_0x40d5('0xb2')&&_0x13b35b['role']==='agent'&&_0x13b35b['online']){for(let _0x12d242=0x0;_0x12d242<_0x5d39ec[_0x40d5('0x56')];_0x12d242+=0x1){_0x4c7589['push']({'membername':_0x13b35b['name'],'UserId':_0x13b35b['id'],'queue_name':_0x5d39ec[_0x12d242]['name'],'VoiceQueueId':_0x5d39ec[_0x12d242]['id'],'interface':_[_0x40d5('0x6e')](_0x13b35b[_0x40d5('0xa8')])?util[_0x40d5('0xb3')]('SIP/%s',_0x13b35b[_0x40d5('0x3e')]):_0x13b35b['interface'],'paused':_0x13b35b[_0x40d5('0xa7')]||![],'penalty':_0x9b1f46[_0x40d5('0x66')][_0x40d5('0xad')]||0x0});}return Promise[_0x40d5('0x5b')](_0x4c7589[_0x40d5('0x3b')](function(_0x581b8e){return db[_0x40d5('0xb4')][_0x40d5('0xb5')](_0x581b8e);}));}return _0x51b61c;});}})[_0x40d5('0x2d')](respondWithStatusCode(_0x48c586,null))['catch'](handleError(_0x48c586,null));};exports['removeQueues']=function(_0x386dd6,_0x47f71a){var _0x434331,_0x30a762;return db[_0x40d5('0x43')]['find']({'where':{'id':_0x386dd6[_0x40d5('0x5d')]['id']},'attributes':['id',_0x40d5('0x3e'),'role']})[_0x40d5('0x2d')](handleEntityNotFound(_0x47f71a,null))[_0x40d5('0x2d')](function(_0x56cdd7){if(_0x56cdd7){_0x434331=_0x56cdd7;if(!_0x386dd6[_0x40d5('0x4b')][_0x40d5('0xa5')]||!utils[_0x40d5('0xa9')](_0x386dd6[_0x40d5('0x4b')][_0x40d5('0xa5')])){throw new db[(_0x40d5('0x94'))][(_0x40d5('0x9a'))](_0x40d5('0xb6'));}return _0x56cdd7[_0x40d5('0xb7')+_['capitalize'](_0x386dd6[_0x40d5('0x4b')]['channel'][_0x40d5('0xab')]())+_0x40d5('0xac')](_0x386dd6[_0x40d5('0x4b')][_0x40d5('0x68')]);}})[_0x40d5('0x2d')](function(_0x367ff0){if(_[_0x40d5('0xb8')](_0x386dd6[_0x40d5('0x4b')][_0x40d5('0x68')])){for(var _0x563f41=0x0;_0x563f41<_0x386dd6['query'][_0x40d5('0x68')][_0x40d5('0x56')];_0x563f41+=0x1){_0x30a762={'UserId':Number(_0x386dd6[_0x40d5('0x5d')]['id'])};_0x30a762[_[_0x40d5('0xaa')](_0x386dd6[_0x40d5('0x4b')][_0x40d5('0xa5')][_0x40d5('0xab')]())+'QueueId']=Number(_0x386dd6[_0x40d5('0x4b')]['ids'][_0x563f41]);socket[_0x40d5('0x2e')]('user'+_[_0x40d5('0xaa')](_0x386dd6['query'][_0x40d5('0xa5')][_0x40d5('0xab')]())+_0x40d5('0xb9'),_0x30a762);}}else{_0x30a762={'UserId':Number(_0x386dd6[_0x40d5('0x5d')]['id'])};_0x30a762[_[_0x40d5('0xaa')](_0x386dd6[_0x40d5('0x4b')][_0x40d5('0xa5')][_0x40d5('0xab')]())+'QueueId']=Number(_0x386dd6[_0x40d5('0x4b')][_0x40d5('0x68')]);socket[_0x40d5('0x2e')](_0x40d5('0x34')+_[_0x40d5('0xaa')](_0x386dd6[_0x40d5('0x4b')][_0x40d5('0xa5')][_0x40d5('0xab')]())+_0x40d5('0xb9'),_0x30a762);}return _0x367ff0;})[_0x40d5('0x2d')](function(){if(_0x386dd6[_0x40d5('0x4b')][_0x40d5('0xa5')]==='voice'){return db[_0x40d5('0xb4')][_0x40d5('0x3f')]({'where':{'UserId':_0x386dd6[_0x40d5('0x5d')]['id'],'VoiceQueueId':_0x386dd6[_0x40d5('0x4b')]['ids']},'individualHooks':!![]})[_0x40d5('0x2d')](function(){return _0x434331;});}return _0x434331;})[_0x40d5('0x2d')](respondWithStatusCode(_0x47f71a,null))[_0x40d5('0x22')](handleError(_0x47f71a,null));};exports[_0x40d5('0xba')]=function(_0x3f9c9a,_0x790b52){_0x3f9c9a['body'][_0x40d5('0xbb')]=_0x3f9c9a[_0x40d5('0xbc')][_0x40d5('0xbd')];return db[_0x40d5('0x43')]['find']({'where':{'id':_0x3f9c9a['params']['id']}})['then'](handleEntityNotFound(_0x790b52,null))['then'](saveUpdates(_0x3f9c9a['body'],null))['then'](respondWithResult(_0x790b52,null))[_0x40d5('0x22')](handleError(_0x790b52,null));};exports[_0x40d5('0xbe')]=function(_0x306bfe,_0x500553){var _0x32320c=path[_0x40d5('0xbf')](config[_0x40d5('0xc0')],_0x40d5('0xc1'));return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x306bfe[_0x40d5('0x5d')]['id']},'attributes':['id',_0x40d5('0xbb')],'raw':!![]})[_0x40d5('0x2d')](handleEntityNotFound(_0x500553,null))['then'](function(_0x19d534){if(_0x19d534){if(_['isNil'](_0x19d534[_0x40d5('0xbb')])){return _0x500553[_0x40d5('0xc2')](_0x32320c);}else{if(!fs[_0x40d5('0xc3')](path[_0x40d5('0xbf')](config[_0x40d5('0xc0')],_0x40d5('0xc4'),_0x19d534['userpic']))){return _0x500553['download'](_0x32320c);}return _0x500553[_0x40d5('0xc2')](path[_0x40d5('0xbf')](config['root'],_0x40d5('0xc4'),_0x19d534[_0x40d5('0xbb')]));}}})['catch'](handleError(_0x500553,null));};exports[_0x40d5('0xc5')]=function(_0x53bc2e,_0x1cdfd2){return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x53bc2e[_0x40d5('0x5d')]['id']},'attributes':['id']})[_0x40d5('0x2d')](handleEntityNotFound(_0x1cdfd2,null))['then'](function(_0x525f5a){var _0x46515b=[];values=_0x525f5a[_0x40d5('0x57')];_0x46515b[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x65'),_0x525f5a[_0x40d5('0x57')]));_0x46515b[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x58'),_0x525f5a['dataValues']));_0x46515b[_0x40d5('0x52')](get_open_tabs(_0x40d5('0xc6'),_0x525f5a[_0x40d5('0x57')]));_0x46515b[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x5a'),_0x525f5a[_0x40d5('0x57')]));_0x46515b[_0x40d5('0x52')](get_open_tabs(_0x40d5('0xc7'),_0x525f5a[_0x40d5('0x57')]));_0x46515b[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x59'),_0x525f5a[_0x40d5('0x57')]));return Promise['all'](_0x46515b);})[_0x40d5('0x2d')](function(_0x5ae940){if(_0x5ae940){var _0x9b10ef=_[_0x40d5('0x3b')](values[_0x40d5('0xc8')],function(_0xdd49a3){return{'channel':'CHAT','id':_0xdd49a3['id'],'createdAt':_0xdd49a3[_0x40d5('0xc9')]};});var _0x7fc45=_['map'](values[_0x40d5('0xca')],function(_0x4e8f82){return{'channel':'FAX','id':_0x4e8f82['id'],'createdAt':_0x4e8f82['createdAt']};});var _0x2c8c84=_[_0x40d5('0x3b')](values[_0x40d5('0xcb')],function(_0x242824){return{'channel':'OPENCHANNEL','id':_0x242824['id'],'createdAt':_0x242824[_0x40d5('0xc9')]};});var _0x30b7d7=_[_0x40d5('0x3b')](values[_0x40d5('0xcc')],function(_0x416a6b){return{'channel':_0x40d5('0xcd'),'id':_0x416a6b['id'],'createdAt':_0x416a6b[_0x40d5('0xc9')]};});var _0x3a3eb7=_[_0x40d5('0x3b')](values[_0x40d5('0xce')],function(_0x43c424){return{'channel':_0x40d5('0xcf'),'id':_0x43c424['id'],'createdAt':_0x43c424[_0x40d5('0xc9')]};});var _0x4ca3b5=_[_0x40d5('0x3b')](values[_0x40d5('0xd0')],function(_0x2e445a){return{'channel':_0x40d5('0xd1'),'id':_0x2e445a['id'],'createdAt':_0x2e445a[_0x40d5('0xc9')]};});var _0x54c9b9=_[_0x40d5('0xd2')](_0x9b10ef,_0x7fc45,_0x2c8c84,_0x30b7d7,_0x3a3eb7,_0x4ca3b5);var _0x5d4308={'count':_0x54c9b9[_0x40d5('0x56')],'rows':_0x54c9b9};return _0x5d4308;}else return null;})[_0x40d5('0x2d')](respondWithResult(_0x1cdfd2,null))['catch'](handleError(_0x1cdfd2,null));};exports[_0x40d5('0xd3')]=function(_0x52d3e5,_0x41b8fb){var _0x1a3a84={};var _0x5dab8e={};var _0x100285;var _0x3bfaaf;return db[_0x40d5('0x43')]['findOne']({'where':{'id':_0x52d3e5[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x41b8fb,null))[_0x40d5('0x2d')](function(_0x3e5fbe){if(_0x3e5fbe){_0x100285=_0x3e5fbe;_0x5dab8e[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0xd4')][_0x40d5('0x44')]);_0x5dab8e[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x52d3e5[_0x40d5('0x4b')]);_0x5dab8e['filters']=_[_0x40d5('0x62')](_0x5dab8e[_0x40d5('0x61')],_0x5dab8e['query']);_0x1a3a84[_0x40d5('0x51')]=_[_0x40d5('0x62')](_0x5dab8e[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x52d3e5['query'][_0x40d5('0x63')]));_0x1a3a84[_0x40d5('0x51')]=_0x1a3a84[_0x40d5('0x51')][_0x40d5('0x56')]?_0x1a3a84[_0x40d5('0x51')]:_0x5dab8e['model'];_0x1a3a84[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x52d3e5[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0x1a3a84['where']=qs[_0x40d5('0x60')](_['pick'](_0x52d3e5[_0x40d5('0x4b')],_0x5dab8e['filters']));if(_0x52d3e5[_0x40d5('0x4b')][_0x40d5('0x39')]){_0x1a3a84[_0x40d5('0x4a')]=_[_0x40d5('0x64')](_0x1a3a84[_0x40d5('0x4a')],{'$or':_['map'](_0x1a3a84[_0x40d5('0x51')],function(_0x18c2e5){var _0x2c2a64={};_0x2c2a64[_0x18c2e5]={'$like':'%'+_0x52d3e5[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x2c2a64;})});}_0x1a3a84=_[_0x40d5('0x64')]({},_0x1a3a84,_0x52d3e5[_0x40d5('0xd7')]);return _0x100285['getContacts'](_0x1a3a84);}})['then'](function(_0x1b2dd6){if(_0x1b2dd6){_0x3bfaaf=_0x1b2dd6[_0x40d5('0x56')];if(_0x52d3e5[_0x40d5('0x4b')][_0x40d5('0xd8')](_0x40d5('0x4c'))){_0x1a3a84[_0x40d5('0x4d')]=[{'model':db[_0x40d5('0xd9')],'as':_0x40d5('0xda'),'required':![]},{'model':db[_0x40d5('0xdb')],'as':_0x40d5('0xdc'),'attributes':['id','name',_0x40d5('0xdd')],'where':_0x52d3e5['query'][_0x40d5('0xde')]?{'id':_0x52d3e5['query']['tag']}:undefined,'required':_0x52d3e5[_0x40d5('0x4b')][_0x40d5('0xde')]?!![]:![]}];}if(!_0x52d3e5['query'][_0x40d5('0xd8')](_0x40d5('0xdf'))){_0x1a3a84[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x52d3e5[_0x40d5('0x4b')][_0x40d5('0x27')]);_0x1a3a84[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x52d3e5['query'][_0x40d5('0x29')]);}return _0x100285[_0x40d5('0xd3')](_0x1a3a84);}})[_0x40d5('0x2d')](function(_0x227705){if(_0x227705){return _0x227705?{'count':_0x3bfaaf,'rows':_0x227705}:null;}})['then'](respondWithResult(_0x41b8fb,null))['catch'](handleError(_0x41b8fb,null));};exports[_0x40d5('0xe0')]=function(_0x43a160,_0x3b66d8){var _0x2aa263;var _0x347c34={};var _0x394b49;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x43a160['params']['id']},'attributes':['id',_0x40d5('0x3e'),'role']})[_0x40d5('0x2d')](handleEntityNotFound(_0x3b66d8,null))[_0x40d5('0x2d')](function(_0x14dd59){if(!utils[_0x40d5('0xa9')](_0x43a160[_0x40d5('0x4b')][_0x40d5('0xa5')])){throw new db['Sequelize'][(_0x40d5('0x9a'))](_0x40d5('0xb6'));}_0x2aa263=_0x14dd59;var _0x555a4c={};_0x555a4c['model']=_[_0x40d5('0x5e')](db[_[_0x40d5('0xaa')](_0x43a160[_0x40d5('0x4b')]['channel'])+'Queue']['rawAttributes']);_0x555a4c[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x43a160[_0x40d5('0x4b')]);_0x555a4c['filters']=_['intersection'](_0x555a4c[_0x40d5('0x61')],_0x555a4c[_0x40d5('0x4b')]);_0x347c34['attributes']=_[_0x40d5('0x62')](_0x555a4c[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x43a160['query'][_0x40d5('0x63')]));_0x347c34['attributes']=_0x347c34[_0x40d5('0x51')][_0x40d5('0x56')]?_0x347c34['attributes']:_0x555a4c['model'];_0x347c34[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x43a160[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0x347c34[_0x40d5('0x4a')]=qs['filters'](_[_0x40d5('0xe1')](_0x43a160[_0x40d5('0x4b')],_0x555a4c[_0x40d5('0x60')]));if(_0x43a160[_0x40d5('0x4b')]['filter']){_0x347c34[_0x40d5('0x4a')]=_['merge'](_0x347c34[_0x40d5('0x4a')],{'$or':_['map'](_0x347c34[_0x40d5('0x51')],function(_0x2020fe){var _0x5c3d88={};_0x5c3d88[_0x2020fe]={'$like':'%'+_0x43a160[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x5c3d88;})});}_0x347c34=_[_0x40d5('0x64')]({},_0x347c34,_0x43a160[_0x40d5('0xd7')]);switch(_0x2aa263['role']){case _0x40d5('0x32'):return db[_[_0x40d5('0xaa')](_0x43a160[_0x40d5('0x4b')][_0x40d5('0xa5')])+_0x40d5('0xe2')][_0x40d5('0x53')](_0x347c34);case _0x40d5('0x34'):case'agent':return _0x2aa263[_0x40d5('0x30')+_[_0x40d5('0xaa')](_0x43a160[_0x40d5('0x4b')]['channel'])+_0x40d5('0xac')](_0x347c34);default:throw new db['Sequelize']['ValidationError'](_0x40d5('0xe3'));}})['then'](function(_0x47cc31){_0x394b49=_0x47cc31['length'];if(!_0x43a160['query'][_0x40d5('0xd8')](_0x40d5('0xdf'))){_0x347c34[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x43a160['query']['limit']);_0x347c34[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x43a160[_0x40d5('0x4b')][_0x40d5('0x29')]);}switch(_0x2aa263[_0x40d5('0x31')]){case _0x40d5('0x32'):return db[_[_0x40d5('0xaa')](_0x43a160[_0x40d5('0x4b')]['channel'])+_0x40d5('0xe2')][_0x40d5('0x53')](_0x347c34);case'user':case _0x40d5('0x36'):return _0x2aa263[_0x40d5('0x30')+_[_0x40d5('0xaa')](_0x43a160[_0x40d5('0x4b')][_0x40d5('0xa5')])+'Queues'](_0x347c34);}})[_0x40d5('0x2d')](function(_0x140714){return{'count':_0x394b49,'rows':_0x140714};})[_0x40d5('0x2d')](respondWithResult(_0x3b66d8,null))[_0x40d5('0x22')](handleError(_0x3b66d8,null));};exports['getVoiceQueuesRt']=function(_0xc842d9,_0x572812){var _0x21a37c={};var _0x160f62={};var _0x267e3a;var _0x4fc607;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0xc842d9[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x572812,null))[_0x40d5('0x2d')](function(_0x2adcda){if(_0x2adcda){_0x267e3a=_0x2adcda;_0x160f62[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0xb4')][_0x40d5('0x44')]);_0x160f62['query']=_[_0x40d5('0x5e')](_0xc842d9[_0x40d5('0x4b')]);_0x160f62[_0x40d5('0x60')]=_['intersection'](_0x160f62[_0x40d5('0x61')],_0x160f62[_0x40d5('0x4b')]);_0x21a37c['attributes']=_['intersection'](_0x160f62[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0xc842d9[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x21a37c[_0x40d5('0x51')]=_0x21a37c['attributes'][_0x40d5('0x56')]?_0x21a37c[_0x40d5('0x51')]:_0x160f62[_0x40d5('0x61')];_0x21a37c[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0xc842d9[_0x40d5('0x4b')]['sort']);_0x21a37c[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_['pick'](_0xc842d9['query'],_0x160f62[_0x40d5('0x60')]));if(_0xc842d9[_0x40d5('0x4b')][_0x40d5('0x39')]){_0x21a37c['where']=_[_0x40d5('0x64')](_0x21a37c[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0x21a37c['attributes'],function(_0x350745){var _0x3d17db={};_0x3d17db[_0x350745]={'$like':'%'+_0xc842d9[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x3d17db;})});}_0x21a37c=_['merge']({},_0x21a37c,_0xc842d9[_0x40d5('0xd7')]);return _0x267e3a['getVoiceQueuesRt'](_0x21a37c);}})['then'](function(_0x1baa20){if(_0x1baa20){_0x4fc607=_0x1baa20[_0x40d5('0x56')];if(!_0xc842d9[_0x40d5('0x4b')][_0x40d5('0xd8')](_0x40d5('0xdf'))){_0x21a37c[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0xc842d9[_0x40d5('0x4b')][_0x40d5('0x27')]);_0x21a37c[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0xc842d9[_0x40d5('0x4b')][_0x40d5('0x29')]);}return _0x267e3a[_0x40d5('0xe4')](_0x21a37c);}})['then'](function(_0x4d23a4){if(_0x4d23a4){return _0x4d23a4?{'count':_0x4fc607,'rows':_0x4d23a4}:null;}})[_0x40d5('0x2d')](respondWithResult(_0x572812,null))[_0x40d5('0x22')](handleError(_0x572812,null));};exports[_0x40d5('0xe5')]=function(_0x20f6db,_0x34ce5c){var _0x31be74={};var _0x3e2a32={};var _0x4495ea;var _0x35c541;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x20f6db[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x34ce5c,null))[_0x40d5('0x2d')](function(_0x54f839){if(_0x54f839){_0x4495ea=_0x54f839;_0x3e2a32[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0xe6')]['rawAttributes']);_0x3e2a32['query']=_[_0x40d5('0x5e')](_0x20f6db[_0x40d5('0x4b')]);_0x3e2a32[_0x40d5('0x60')]=_[_0x40d5('0x62')](_0x3e2a32[_0x40d5('0x61')],_0x3e2a32[_0x40d5('0x4b')]);_0x31be74['attributes']=_[_0x40d5('0x62')](_0x3e2a32[_0x40d5('0x61')],qs['fields'](_0x20f6db['query'][_0x40d5('0x63')]));_0x31be74[_0x40d5('0x51')]=_0x31be74[_0x40d5('0x51')]['length']?_0x31be74[_0x40d5('0x51')]:_0x3e2a32['model'];_0x31be74[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x20f6db[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0x31be74[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_['pick'](_0x20f6db[_0x40d5('0x4b')],_0x3e2a32[_0x40d5('0x60')]));if(_0x20f6db['query'][_0x40d5('0x39')]){_0x31be74[_0x40d5('0x4a')]=_['merge'](_0x31be74['where'],{'$or':_['map'](_0x31be74[_0x40d5('0x51')],function(_0x4d4912){var _0x134e96={};_0x134e96[_0x4d4912]={'$like':'%'+_0x20f6db[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x134e96;})});}_0x31be74=_[_0x40d5('0x64')]({},_0x31be74,_0x20f6db[_0x40d5('0xd7')]);return _0x4495ea[_0x40d5('0xe5')](_0x31be74);}})['then'](function(_0x5a3194){if(_0x5a3194){_0x35c541=_0x5a3194[_0x40d5('0x56')];if(!_0x20f6db[_0x40d5('0x4b')]['hasOwnProperty']('nolimit')){_0x31be74[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x20f6db['query'][_0x40d5('0x27')]);_0x31be74[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x20f6db[_0x40d5('0x4b')]['offset']);}return _0x4495ea[_0x40d5('0xe5')](_0x31be74);}})[_0x40d5('0x2d')](function(_0x38cbe9){if(_0x38cbe9){return _0x38cbe9?{'count':_0x35c541,'rows':_0x38cbe9}:null;}})[_0x40d5('0x2d')](respondWithResult(_0x34ce5c,null))[_0x40d5('0x22')](handleError(_0x34ce5c,null));};exports[_0x40d5('0xe7')]=function(_0x290a0d,_0x29d518){var _0x57cf68={'raw':!![],'where':{}};var _0x6be890={};var _0x20b921={'count':0x0,'rows':[]};return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x290a0d[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x29d518,null))[_0x40d5('0x2d')](function(_0x4cc22e){if(_0x4cc22e){_0x6be890['model']=_['keys'](db[_0x40d5('0xe8')][_0x40d5('0x44')]);_0x6be890[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x290a0d[_0x40d5('0x4b')]);_0x6be890[_0x40d5('0x60')]=_[_0x40d5('0x62')](_0x6be890[_0x40d5('0x61')],_0x6be890[_0x40d5('0x4b')]);_0x57cf68[_0x40d5('0x51')]=_['intersection'](_0x6be890[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x290a0d[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x57cf68[_0x40d5('0x51')]=_0x57cf68[_0x40d5('0x51')][_0x40d5('0x56')]?_0x57cf68[_0x40d5('0x51')]:_0x6be890[_0x40d5('0x61')];if(!_0x290a0d[_0x40d5('0x4b')][_0x40d5('0xd8')](_0x40d5('0xdf'))){_0x57cf68[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x290a0d['query']['limit']);_0x57cf68[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x290a0d[_0x40d5('0x4b')][_0x40d5('0x29')]);}_0x57cf68['order']=qs[_0x40d5('0xd6')](_0x290a0d[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0x57cf68['where']=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x290a0d['query'],_0x6be890[_0x40d5('0x60')]));_0x57cf68[_0x40d5('0x4a')]['UserId']=_0x4cc22e['id'];if(_0x290a0d['query'][_0x40d5('0x39')]){_0x57cf68['where']=_[_0x40d5('0x64')](_0x57cf68['where'],{'$or':_[_0x40d5('0x3b')](_0x57cf68[_0x40d5('0x51')],function(_0x2183ff){var _0xf411a9={};_0xf411a9[_0x2183ff]={'$like':'%'+_0x290a0d[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0xf411a9;})});}_0x57cf68=_[_0x40d5('0x64')]({},_0x57cf68,_0x290a0d[_0x40d5('0xd7')]);return db['VoiceRecording'][_0x40d5('0x28')]({'where':_0x57cf68[_0x40d5('0x4a')]})[_0x40d5('0x2d')](function(_0x29b035){_0x20b921[_0x40d5('0x28')]=_0x29b035;if(_0x290a0d['query'][_0x40d5('0x4c')]){_0x57cf68[_0x40d5('0x4d')]=[{'all':!![]}];}return db[_0x40d5('0xe8')][_0x40d5('0x53')](_0x57cf68);})[_0x40d5('0x2d')](function(_0x1d82b5){_0x20b921[_0x40d5('0x54')]=_0x1d82b5;return _0x20b921;});}})[_0x40d5('0x2d')](respondWithFilteredResult(_0x29d518,_0x57cf68))[_0x40d5('0x22')](handleError(_0x29d518,null));};exports[_0x40d5('0xe9')]=function(_0x1d8348,_0x403ebb){var _0x3c06c3={'raw':!![],'where':{}};var _0x2c1320={};var _0x1041f1={'count':0x0,'rows':[]};return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x1d8348['params']['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x403ebb,null))[_0x40d5('0x2d')](function(_0x3e2102){if(_0x3e2102){_0x2c1320['model']=_[_0x40d5('0x5e')](db['ScreenRecording'][_0x40d5('0x44')]);_0x2c1320[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x1d8348['query']);_0x2c1320[_0x40d5('0x60')]=_[_0x40d5('0x62')](_0x2c1320[_0x40d5('0x61')],_0x2c1320[_0x40d5('0x4b')]);_0x3c06c3[_0x40d5('0x51')]=_[_0x40d5('0x62')](_0x2c1320[_0x40d5('0x61')],qs['fields'](_0x1d8348[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x3c06c3[_0x40d5('0x51')]=_0x3c06c3[_0x40d5('0x51')][_0x40d5('0x56')]?_0x3c06c3[_0x40d5('0x51')]:_0x2c1320[_0x40d5('0x61')];if(!_0x1d8348[_0x40d5('0x4b')][_0x40d5('0xd8')]('nolimit')){_0x3c06c3[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x1d8348[_0x40d5('0x4b')][_0x40d5('0x27')]);_0x3c06c3[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x1d8348['query']['offset']);}_0x3c06c3['order']=qs['sort'](_0x1d8348[_0x40d5('0x4b')]['sort']);_0x3c06c3[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_['pick'](_0x1d8348[_0x40d5('0x4b')],_0x2c1320[_0x40d5('0x60')]));_0x3c06c3[_0x40d5('0x4a')][_0x40d5('0xea')]=_0x3e2102['id'];if(_0x1d8348[_0x40d5('0x4b')][_0x40d5('0x39')]){_0x3c06c3[_0x40d5('0x4a')]=_['merge'](_0x3c06c3[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0x3c06c3[_0x40d5('0x51')],function(_0x303945){var _0x3814a8={};_0x3814a8[_0x303945]={'$like':'%'+_0x1d8348[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x3814a8;})});}_0x3c06c3=_[_0x40d5('0x64')]({},_0x3c06c3,_0x1d8348[_0x40d5('0xd7')]);return db[_0x40d5('0xeb')][_0x40d5('0x28')]({'where':_0x3c06c3[_0x40d5('0x4a')]})[_0x40d5('0x2d')](function(_0x29b141){_0x1041f1['count']=_0x29b141;if(_0x1d8348[_0x40d5('0x4b')][_0x40d5('0x4c')]){_0x3c06c3[_0x40d5('0x4d')]=[{'all':!![]}];}return db[_0x40d5('0xeb')][_0x40d5('0x53')](_0x3c06c3);})[_0x40d5('0x2d')](function(_0x1d0291){_0x1041f1['rows']=_0x1d0291;return _0x1041f1;});}})[_0x40d5('0x2d')](respondWithFilteredResult(_0x403ebb,_0x3c06c3))[_0x40d5('0x22')](handleError(_0x403ebb,null));};exports[_0x40d5('0xec')]=function(_0x13eb32,_0xd63f18){var _0x146172={};var _0x189fd4={};var _0x4e99e1;var _0x36c1cd;return db[_0x40d5('0x43')]['findOne']({'where':{'id':_0x13eb32[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0xd63f18,null))[_0x40d5('0x2d')](function(_0x26845e){if(_0x26845e){_0x4e99e1=_0x26845e;_0x189fd4['model']=_[_0x40d5('0x5e')](db[_0x40d5('0xed')][_0x40d5('0x44')]);_0x189fd4[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x13eb32[_0x40d5('0x4b')]);_0x189fd4['filters']=_['intersection'](_0x189fd4['model'],_0x189fd4[_0x40d5('0x4b')]);_0x146172['attributes']=_[_0x40d5('0x62')](_0x189fd4[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x13eb32['query'][_0x40d5('0x63')]));_0x146172[_0x40d5('0x51')]=_0x146172[_0x40d5('0x51')]['length']?_0x146172[_0x40d5('0x51')]:_0x189fd4['model'];_0x146172[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x13eb32['query'][_0x40d5('0xd6')]);_0x146172[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x13eb32[_0x40d5('0x4b')],_0x189fd4[_0x40d5('0x60')]));if(_0x13eb32[_0x40d5('0x4b')][_0x40d5('0x39')]){_0x146172[_0x40d5('0x4a')]=_[_0x40d5('0x64')](_0x146172[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0x146172[_0x40d5('0x51')],function(_0x5aa2cd){var _0x619b28={};_0x619b28[_0x5aa2cd]={'$like':'%'+_0x13eb32[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x619b28;})});}_0x146172=_['merge']({},_0x146172,_0x13eb32['options']);return _0x4e99e1['getChatInteractions'](_0x146172);}})['then'](function(_0x430449){if(_0x430449){_0x36c1cd=_0x430449['length'];if(!_0x13eb32[_0x40d5('0x4b')][_0x40d5('0xd8')]('nolimit')){_0x146172[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x13eb32['query'][_0x40d5('0x27')]);_0x146172[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x13eb32[_0x40d5('0x4b')][_0x40d5('0x29')]);}return _0x4e99e1[_0x40d5('0xec')](_0x146172);}})[_0x40d5('0x2d')](function(_0x78bb7){if(_0x78bb7){return _0x78bb7?{'count':_0x36c1cd,'rows':_0x78bb7}:null;}})[_0x40d5('0x2d')](respondWithResult(_0xd63f18,null))[_0x40d5('0x22')](handleError(_0xd63f18,null));};exports['getOpenchannelInteractions']=function(_0x3c96d5,_0x111d9c){var _0x29d6c4={};var _0x21f2ec={};var _0x4de9e5;var _0xb64ac4;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x3c96d5['params']['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x111d9c,null))[_0x40d5('0x2d')](function(_0x17f688){if(_0x17f688){_0x4de9e5=_0x17f688;_0x21f2ec[_0x40d5('0x61')]=_['keys'](db[_0x40d5('0xee')][_0x40d5('0x44')]);_0x21f2ec['query']=_[_0x40d5('0x5e')](_0x3c96d5[_0x40d5('0x4b')]);_0x21f2ec['filters']=_[_0x40d5('0x62')](_0x21f2ec[_0x40d5('0x61')],_0x21f2ec[_0x40d5('0x4b')]);_0x29d6c4[_0x40d5('0x51')]=_[_0x40d5('0x62')](_0x21f2ec[_0x40d5('0x61')],qs['fields'](_0x3c96d5[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x29d6c4[_0x40d5('0x51')]=_0x29d6c4[_0x40d5('0x51')]['length']?_0x29d6c4[_0x40d5('0x51')]:_0x21f2ec[_0x40d5('0x61')];_0x29d6c4['order']=qs[_0x40d5('0xd6')](_0x3c96d5[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0x29d6c4[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_['pick'](_0x3c96d5[_0x40d5('0x4b')],_0x21f2ec[_0x40d5('0x60')]));if(_0x3c96d5['query']['filter']){_0x29d6c4[_0x40d5('0x4a')]=_[_0x40d5('0x64')](_0x29d6c4[_0x40d5('0x4a')],{'$or':_['map'](_0x29d6c4[_0x40d5('0x51')],function(_0x14ee8e){var _0x2b4cbf={};_0x2b4cbf[_0x14ee8e]={'$like':'%'+_0x3c96d5[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x2b4cbf;})});}_0x29d6c4=_[_0x40d5('0x64')]({},_0x29d6c4,_0x3c96d5[_0x40d5('0xd7')]);return _0x4de9e5[_0x40d5('0xef')](_0x29d6c4);}})['then'](function(_0x574f6b){if(_0x574f6b){_0xb64ac4=_0x574f6b[_0x40d5('0x56')];if(!_0x3c96d5[_0x40d5('0x4b')]['hasOwnProperty'](_0x40d5('0xdf'))){_0x29d6c4[_0x40d5('0x27')]=qs['limit'](_0x3c96d5[_0x40d5('0x4b')][_0x40d5('0x27')]);_0x29d6c4[_0x40d5('0x29')]=qs['offset'](_0x3c96d5[_0x40d5('0x4b')]['offset']);}return _0x4de9e5[_0x40d5('0xef')](_0x29d6c4);}})[_0x40d5('0x2d')](function(_0x3c7275){if(_0x3c7275){return _0x3c7275?{'count':_0xb64ac4,'rows':_0x3c7275}:null;}})['then'](respondWithResult(_0x111d9c,null))[_0x40d5('0x22')](handleError(_0x111d9c,null));};exports[_0x40d5('0xf0')]=function(_0x20d7db,_0x239432){var _0xbb80a2={'raw':!![],'where':{}};var _0x1564b9={};var _0x3e5a94={'count':0x0,'rows':[]};return db['User'][_0x40d5('0x9e')]({'where':{'id':_0x20d7db[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x239432,null))[_0x40d5('0x2d')](function(_0x3bfbc7){if(_0x3bfbc7){_0x1564b9[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0xf1')]['rawAttributes']);_0x1564b9['query']=_['keys'](_0x20d7db[_0x40d5('0x4b')]);_0x1564b9[_0x40d5('0x60')]=_[_0x40d5('0x62')](_0x1564b9['model'],_0x1564b9[_0x40d5('0x4b')]);_0xbb80a2[_0x40d5('0x51')]=_['intersection'](_0x1564b9[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x20d7db[_0x40d5('0x4b')][_0x40d5('0x63')]));_0xbb80a2[_0x40d5('0x51')]=_0xbb80a2['attributes'][_0x40d5('0x56')]?_0xbb80a2['attributes']:_0x1564b9[_0x40d5('0x61')];if(!_0x20d7db[_0x40d5('0x4b')][_0x40d5('0xd8')]('nolimit')){_0xbb80a2[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x20d7db[_0x40d5('0x4b')][_0x40d5('0x27')]);_0xbb80a2[_0x40d5('0x29')]=qs['offset'](_0x20d7db[_0x40d5('0x4b')][_0x40d5('0x29')]);}_0xbb80a2['order']=qs[_0x40d5('0xd6')](_0x20d7db[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0xbb80a2['where']=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x20d7db[_0x40d5('0x4b')],_0x1564b9['filters']));_0xbb80a2[_0x40d5('0x4a')][_0x40d5('0xea')]=_0x3bfbc7['id'];if(_0x20d7db[_0x40d5('0x4b')][_0x40d5('0x39')]){_0xbb80a2[_0x40d5('0x4a')]=_['merge'](_0xbb80a2[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0xbb80a2['attributes'],function(_0x4a92b3){var _0x57f6ca={};_0x57f6ca[_0x4a92b3]={'$like':'%'+_0x20d7db[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x57f6ca;})});}_0xbb80a2=_['merge']({},_0xbb80a2,_0x20d7db['options']);return db[_0x40d5('0xf1')]['count']({'where':_0xbb80a2[_0x40d5('0x4a')]})[_0x40d5('0x2d')](function(_0x4b3d14){_0x3e5a94['count']=_0x4b3d14;if(_0x20d7db['query'][_0x40d5('0x4c')]){_0xbb80a2[_0x40d5('0x4d')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0xbb80a2);})[_0x40d5('0x2d')](function(_0x7a4d4e){_0x3e5a94[_0x40d5('0x54')]=_0x7a4d4e;return _0x3e5a94;});}})[_0x40d5('0x2d')](respondWithFilteredResult(_0x239432,_0xbb80a2))[_0x40d5('0x22')](handleError(_0x239432,null));};exports['getSmsInteractions']=function(_0x40d3d2,_0xc6b9f){var _0x5668e1={};var _0x51fc8f={};var _0x7a4586;var _0x591d7a;return db['User'][_0x40d5('0x9e')]({'where':{'id':_0x40d3d2[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0xc6b9f,null))[_0x40d5('0x2d')](function(_0x4f5b54){if(_0x4f5b54){_0x7a4586=_0x4f5b54;_0x51fc8f[_0x40d5('0x61')]=_['keys'](db[_0x40d5('0xf2')][_0x40d5('0x44')]);_0x51fc8f[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x40d3d2['query']);_0x51fc8f['filters']=_['intersection'](_0x51fc8f[_0x40d5('0x61')],_0x51fc8f[_0x40d5('0x4b')]);_0x5668e1[_0x40d5('0x51')]=_['intersection'](_0x51fc8f[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x40d3d2[_0x40d5('0x4b')]['fields']));_0x5668e1[_0x40d5('0x51')]=_0x5668e1['attributes'][_0x40d5('0x56')]?_0x5668e1[_0x40d5('0x51')]:_0x51fc8f[_0x40d5('0x61')];_0x5668e1[_0x40d5('0xd5')]=qs['sort'](_0x40d3d2[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0x5668e1[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x40d3d2[_0x40d5('0x4b')],_0x51fc8f[_0x40d5('0x60')]));if(_0x40d3d2['query'][_0x40d5('0x39')]){_0x5668e1[_0x40d5('0x4a')]=_['merge'](_0x5668e1[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0x5668e1['attributes'],function(_0x1622e4){var _0x4e5aa9={};_0x4e5aa9[_0x1622e4]={'$like':'%'+_0x40d3d2[_0x40d5('0x4b')]['filter']+'%'};return _0x4e5aa9;})});}_0x5668e1=_[_0x40d5('0x64')]({},_0x5668e1,_0x40d3d2['options']);return _0x7a4586[_0x40d5('0xf3')](_0x5668e1);}})[_0x40d5('0x2d')](function(_0x380866){if(_0x380866){_0x591d7a=_0x380866[_0x40d5('0x56')];if(!_0x40d3d2['query']['hasOwnProperty'](_0x40d5('0xdf'))){_0x5668e1['limit']=qs[_0x40d5('0x27')](_0x40d3d2[_0x40d5('0x4b')][_0x40d5('0x27')]);_0x5668e1[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x40d3d2['query'][_0x40d5('0x29')]);}return _0x7a4586[_0x40d5('0xf3')](_0x5668e1);}})['then'](function(_0x5437df){if(_0x5437df){return _0x5437df?{'count':_0x591d7a,'rows':_0x5437df}:null;}})[_0x40d5('0x2d')](respondWithResult(_0xc6b9f,null))[_0x40d5('0x22')](handleError(_0xc6b9f,null));};exports[_0x40d5('0xf4')]=function(_0x563796,_0x3f14a2){var _0xc8780f={};var _0x252682={};var _0x581700;var _0x4f59d2;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x563796[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x3f14a2,null))[_0x40d5('0x2d')](function(_0x60d78e){if(_0x60d78e){_0x581700=_0x60d78e;_0x252682[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0xf5')][_0x40d5('0x44')]);_0x252682[_0x40d5('0x4b')]=_['keys'](_0x563796[_0x40d5('0x4b')]);_0x252682['filters']=_['intersection'](_0x252682['model'],_0x252682[_0x40d5('0x4b')]);_0xc8780f[_0x40d5('0x51')]=_[_0x40d5('0x62')](_0x252682[_0x40d5('0x61')],qs['fields'](_0x563796[_0x40d5('0x4b')][_0x40d5('0x63')]));_0xc8780f[_0x40d5('0x51')]=_0xc8780f[_0x40d5('0x51')][_0x40d5('0x56')]?_0xc8780f[_0x40d5('0x51')]:_0x252682[_0x40d5('0x61')];_0xc8780f[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x563796['query'][_0x40d5('0xd6')]);_0xc8780f[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_['pick'](_0x563796[_0x40d5('0x4b')],_0x252682[_0x40d5('0x60')]));if(_0x563796['query'][_0x40d5('0x39')]){_0xc8780f[_0x40d5('0x4a')]=_[_0x40d5('0x64')](_0xc8780f[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0xc8780f[_0x40d5('0x51')],function(_0x50b67){var _0x56d992={};_0x56d992[_0x50b67]={'$like':'%'+_0x563796[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x56d992;})});}_0xc8780f=_[_0x40d5('0x64')]({},_0xc8780f,_0x563796[_0x40d5('0xd7')]);return _0x581700[_0x40d5('0xf4')](_0xc8780f);}})[_0x40d5('0x2d')](function(_0x58f439){if(_0x58f439){_0x4f59d2=_0x58f439[_0x40d5('0x56')];if(!_0x563796[_0x40d5('0x4b')][_0x40d5('0xd8')](_0x40d5('0xdf'))){_0xc8780f[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x563796[_0x40d5('0x4b')][_0x40d5('0x27')]);_0xc8780f[_0x40d5('0x29')]=qs['offset'](_0x563796[_0x40d5('0x4b')]['offset']);}return _0x581700[_0x40d5('0xf4')](_0xc8780f);}})[_0x40d5('0x2d')](function(_0x35f88b){if(_0x35f88b){return _0x35f88b?{'count':_0x4f59d2,'rows':_0x35f88b}:null;}})[_0x40d5('0x2d')](respondWithResult(_0x3f14a2,null))[_0x40d5('0x22')](handleError(_0x3f14a2,null));};exports[_0x40d5('0xf6')]=function(_0x5667d4,_0x88f7e5){var _0x567b19={};var _0x4bd156={};var _0xf0d246;var _0x5be336;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x5667d4[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x88f7e5,null))[_0x40d5('0x2d')](function(_0x1dc634){if(_0x1dc634){_0xf0d246=_0x1dc634;_0x4bd156[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0xf7')][_0x40d5('0x44')]);_0x4bd156[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x5667d4[_0x40d5('0x4b')]);_0x4bd156['filters']=_[_0x40d5('0x62')](_0x4bd156['model'],_0x4bd156[_0x40d5('0x4b')]);_0x567b19[_0x40d5('0x51')]=_[_0x40d5('0x62')](_0x4bd156[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x5667d4[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x567b19[_0x40d5('0x51')]=_0x567b19[_0x40d5('0x51')][_0x40d5('0x56')]?_0x567b19[_0x40d5('0x51')]:_0x4bd156[_0x40d5('0x61')];_0x567b19['order']=qs[_0x40d5('0xd6')](_0x5667d4['query'][_0x40d5('0xd6')]);_0x567b19['where']=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x5667d4[_0x40d5('0x4b')],_0x4bd156[_0x40d5('0x60')]));if(_0x5667d4[_0x40d5('0x4b')][_0x40d5('0x39')]){_0x567b19[_0x40d5('0x4a')]=_['merge'](_0x567b19[_0x40d5('0x4a')],{'$or':_['map'](_0x567b19['attributes'],function(_0x3fc675){var _0x2781dd={};_0x2781dd[_0x3fc675]={'$like':'%'+_0x5667d4[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x2781dd;})});}_0x567b19=_[_0x40d5('0x64')]({},_0x567b19,_0x5667d4['options']);return _0xf0d246[_0x40d5('0xf6')](_0x567b19);}})[_0x40d5('0x2d')](function(_0xa5af2b){if(_0xa5af2b){_0x5be336=_0xa5af2b['length'];if(!_0x5667d4[_0x40d5('0x4b')]['hasOwnProperty'](_0x40d5('0xdf'))){_0x567b19['limit']=qs[_0x40d5('0x27')](_0x5667d4['query'][_0x40d5('0x27')]);_0x567b19[_0x40d5('0x29')]=qs['offset'](_0x5667d4[_0x40d5('0x4b')][_0x40d5('0x29')]);}return _0xf0d246[_0x40d5('0xf6')](_0x567b19);}})[_0x40d5('0x2d')](function(_0x138137){if(_0x138137){return _0x138137?{'count':_0x5be336,'rows':_0x138137}:null;}})[_0x40d5('0x2d')](respondWithResult(_0x88f7e5,null))[_0x40d5('0x22')](handleError(_0x88f7e5,null));};exports[_0x40d5('0xf8')]=function(_0x201c72,_0x1c13ec,_0x840b56){var _0x470407;var _0x28e717;var _0xaac49c;var _0x10d98c=!_['isNil'](_0x201c72['params']['id'])?_0x201c72[_0x40d5('0x5d')]['id']:!_[_0x40d5('0x6e')](_0x201c72[_0x40d5('0x34')]['id'])?_0x201c72[_0x40d5('0x34')]['id']:null;return db[_0x40d5('0x43')]['find']({'where':{'id':_0x10d98c,'role':{'$or':[_0x40d5('0x32'),_0x40d5('0x34'),'agent']}},'attributes':['id',_0x40d5('0x3e'),'phone',_0x40d5('0xf9'),'role','internal',_0x40d5('0xa6')]})[_0x40d5('0x2d')](function(_0x1972b8){if(_0x1972b8){if(_0x1972b8[_0x40d5('0x31')]===_0x40d5('0x36')){_0x470407=_0x1972b8;if(_0x201c72['body'][_0x40d5('0xa8')]){_0xaac49c=util[_0x40d5('0xb3')](_0x40d5('0xfa'),_0x470407[_0x201c72[_0x40d5('0x66')][_0x40d5('0xa8')]]);}else if(_0x201c72[_0x40d5('0x66')][_0x40d5('0xfb')]){_0xaac49c=util[_0x40d5('0xb3')](_0x40d5('0xfc'),_0x201c72[_0x40d5('0x66')][_0x40d5('0xfb')]);}else{_0xaac49c=util[_0x40d5('0xb3')]('SIP/%s',_0x470407[_0x40d5('0x3e')]);}socket['to'](util[_0x40d5('0xb3')]('user:%s',_0x470407[_0x40d5('0x3e')]))['emit'](_0x40d5('0xfd'),{'user':{'id':_0x470407['id'],'name':_0x470407[_0x40d5('0x3e')]},'ip':_0x201c72['headers'][_0x40d5('0xfe')]||_0x201c72[_0x40d5('0xff')][_0x40d5('0x100')]||_0x201c72['socket'][_0x40d5('0x100')]||_0x201c72[_0x40d5('0xff')]['socket'][_0x40d5('0x100')]});return db[_0x40d5('0xb4')]['destroy']({'where':{'membername':_0x470407[_0x40d5('0x3e')]},'individualHooks':!![]});}}else{throw new db[(_0x40d5('0x94'))][(_0x40d5('0x9a'))](_0x40d5('0x101'));}})[_0x40d5('0x2d')](function(){if(_0x470407){return _0x470407[_0x40d5('0x102')]({'raw':!![]});}})[_0x40d5('0x2d')](function(_0x149b61){if(_0x470407){if(_0x149b61){_0x28e717=_0x149b61;if(_0x28e717[_0x40d5('0x56')]){var _0x454746=_0x28e717[_0x40d5('0x3b')](function(_0x218676){var _0x47e656={'membername':_0x470407[_0x40d5('0x3e')],'UserId':_0x470407['id'],'queue_name':_0x218676[_0x40d5('0x3e')],'VoiceQueueId':_0x218676['id'],'interface':_0xaac49c,'paused':_0x470407[_0x40d5('0xa6')]||![],'penalty':_0x218676[_0x40d5('0x103')]||0x0};return db[_0x40d5('0xb4')][_0x40d5('0xb5')](_0x47e656);});return Promise[_0x40d5('0x5b')](_0x454746);}}}})[_0x40d5('0x2d')](function(){if(_0x470407){return db[_0x40d5('0x104')]['findAll']({'where':{'membername':_0x470407[_0x40d5('0x3e')],'exitAt':null}});}})[_0x40d5('0x2d')](function(_0x43d3c3){if(_0x470407){var _0x40bfcc=[];_0x43d3c3[_0x40d5('0x105')](function(_0x2a5e0c){_0x40bfcc['push'](_0x2a5e0c[_0x40d5('0x2c')]({'exitAt':moment()[_0x40d5('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x40d5('0x5b')](_0x40bfcc);}})[_0x40d5('0x2d')](function(){if(_0x470407){var _0x247291=[];var _0x469139=[];var _0x543dd6=utils[_0x40d5('0x106')]();var _0x54ecb2={'membername':_0x470407[_0x40d5('0x3e')],'interface':_0xaac49c,'enterAt':moment()[_0x40d5('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x470407['role'],'internal':_0x470407[_0x40d5('0x6a')]};_0x543dd6[_0x40d5('0x105')](function(_0x5e402f){_0x247291['push'](_[_0x40d5('0x64')]({'channel':_0x5e402f,'type':_0x40d5('0x107'),'data1':_0x201c72['body'][_0x40d5('0x108')],'data2':_0xaac49c},_0x54ecb2));if(_0x470407[_0x40d5('0xa6')]){_0x469139[_0x40d5('0x52')](_[_0x40d5('0x64')]({'channel':_0x5e402f,'type':_0x40d5('0x109'),'data1':_0x40d5('0x10a')},_0x54ecb2));}});return db['MemberReport'][_0x40d5('0x8d')](_0x247291['concat'](_0x469139),{'individualHooks':!![]});}})[_0x40d5('0x2d')](function(){if(_0x470407){return _0x470407['update']({'online':!![],'lastLoginAt':moment()[_0x40d5('0xb3')](_0x40d5('0x10b')),'voicePause':_0x470407[_0x40d5('0xa6')]||![],'mailPause':_0x470407[_0x40d5('0xa6')]||![],'chatPause':_0x470407[_0x40d5('0xa6')]||![],'faxPause':_0x470407[_0x40d5('0xa6')]||![],'smsPause':_0x470407[_0x40d5('0xa6')]||![],'openchannelPause':_0x470407[_0x40d5('0xa6')]||![],'whatsappPause':_0x470407['loginInPause']||![],'pauseType':_0x470407[_0x40d5('0xa6')]?_0x40d5('0x10a'):null,'interface':_0xaac49c,'lastPauseAt':moment()[_0x40d5('0xb3')](_0x40d5('0x10b'))});}})[_0x40d5('0x2d')](function(_0x3b588f){if(_0x201c72[_0x40d5('0x10c')]){return _0x840b56();}else{return Promise[_0x40d5('0x10d')](_0x3b588f)[_0x40d5('0x2d')](respondWithResult(_0x1c13ec,null));}})[_0x40d5('0x22')](handleError(_0x1c13ec,null));};exports[_0x40d5('0x10e')]=function(_0x13794c,_0x1afb60){var _0x247f99;return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x13794c[_0x40d5('0x5d')]['id'],'role':_0x40d5('0x36')},'attributes':['id',_0x40d5('0x3e'),_0x40d5('0x31')]})[_0x40d5('0x2d')](handleEntityNotFound(_0x1afb60,null))[_0x40d5('0x2d')](function(_0x44bb73){if(_0x44bb73){_0x247f99=_0x44bb73;return db[_0x40d5('0xb4')][_0x40d5('0x3f')]({'where':{'membername':_0x247f99[_0x40d5('0x3e')]},'individualHooks':!![]});}})['then'](function(){return db[_0x40d5('0x104')][_0x40d5('0x53')]({'where':{'membername':_0x247f99[_0x40d5('0x3e')],'exitAt':null}});})['then'](function(_0x4cf9fa){var _0x5e118f=[];_0x4cf9fa['forEach'](function(_0x2bcdff){_0x5e118f[_0x40d5('0x52')](_0x2bcdff[_0x40d5('0x2c')]({'exitAt':moment()['format'](_0x40d5('0x10b'))}));});return Promise['all'](_0x5e118f);})[_0x40d5('0x2d')](function(){return _0x247f99['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x40d5('0x2d')](respondWithResult(_0x1afb60,null))['catch'](handleError(_0x1afb60,null));};exports['pause']=function(_0x46fad0,_0x14f79c){var _0x101565;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x46fad0[_0x40d5('0x5d')]['id']},'individualHooks':!![]})[_0x40d5('0x2d')](function(){return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x46fad0[_0x40d5('0x5d')]['id'],'role':_0x40d5('0x36')},'attributes':['id',_0x40d5('0x3e'),_0x40d5('0x31'),_0x40d5('0x6a'),_0x40d5('0xa8'),_0x40d5('0x10f')]});})['then'](handleEntityNotFound(_0x14f79c,null))['then'](function(_0x1d6aaf){if(_0x1d6aaf){_0x101565=_0x1d6aaf;return respondWithRpcPromise(_0x40d5('0x110'),_0x40d5('0x111'),{'id':_0x101565['id'],'name':_0x101565['name'],'pause':!![]});}})[_0x40d5('0x2d')](function(){if(_0x101565){return db[_0x40d5('0x104')][_0x40d5('0x53')]({'where':{'membername':_0x101565[_0x40d5('0x3e')],'type':_0x40d5('0x109'),'exitAt':null}});}})[_0x40d5('0x2d')](function(_0x1d5f72){if(_0x1d5f72[_0x40d5('0x56')]){var _0x5bfbcb=moment()[_0x40d5('0xb3')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3a806d=0x0,_0x1b0426=_0x1d5f72['length'];_0x3a806d<_0x1b0426;_0x3a806d++){_0x1d5f72[_0x3a806d]['updateAttributes']({'exitAt':_0x5bfbcb});}}})[_0x40d5('0x2d')](function(){var _0x1cf81d=[];var _0x330604=utils[_0x40d5('0x106')]();_0x330604['forEach'](function(_0x33ebfe){_0x1cf81d[_0x40d5('0x52')]({'channel':_0x33ebfe,'membername':_0x101565['name'],'interface':_[_0x40d5('0x6e')](_0x101565[_0x40d5('0xa8')])?util[_0x40d5('0xb3')](_0x40d5('0xfc'),_0x101565['name']):_0x101565['interface'],'type':_0x40d5('0x109'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x46fad0[_0x40d5('0x66')][_0x40d5('0x46')]||_0x40d5('0x112'),'role':_0x101565['role'],'internal':_0x101565['internal']});});return db['MemberReport']['bulkCreate'](_0x1cf81d,{'individualHooks':!![]});})[_0x40d5('0x2d')](function(){return _0x101565[_0x40d5('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x46fad0[_0x40d5('0x66')][_0x40d5('0x46')]||_0x40d5('0x112'),'lastPauseAt':moment()[_0x40d5('0xb3')](_0x40d5('0x10b'))});})[_0x40d5('0x2d')](respondWithResult(_0x14f79c,null))[_0x40d5('0x22')](handleError(_0x14f79c,null));};exports['unpause']=function(_0x26f9f5,_0xf4b01){if(_0x26f9f5[_0x40d5('0x66')][_0x40d5('0xa5')]&&!utils[_0x40d5('0xa9')](_0x26f9f5[_0x40d5('0x66')]['channel'])){throw new APIBadRequestError(util[_0x40d5('0xb3')](_0x40d5('0x113'),_0x26f9f5['body'][_0x40d5('0xa5')]));}return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x26f9f5[_0x40d5('0x5d')]['id']},'attributes':['id',_0x40d5('0x3e'),'role','internal',_0x40d5('0xa8'),'online','voicePause','mailPause',_0x40d5('0x114'),_0x40d5('0x115'),_0x40d5('0x116'),'smsPause',_0x40d5('0x117'),_0x40d5('0x118'),_0x40d5('0x119')]})[_0x40d5('0x2d')](function(_0x499829){if(!_0x499829){throw new APINotFoundError(util[_0x40d5('0xb3')]('User\x20with\x20id\x20%s\x20not\x20found',_0x26f9f5[_0x40d5('0x5d')]['id']));}return _0x499829[_0x40d5('0x11a')](_0x26f9f5[_0x40d5('0x66')][_0x40d5('0xa5')]);})[_0x40d5('0x2d')](respondWithResult(_0xf4b01,null))['catch'](APIHandleError(_0xf4b01));};exports['getTeams']=function(_0x14f9fc,_0x144627){var _0x3c105d={};var _0x533bcf={};var _0x768f3e;var _0x5e0bc6;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x14f9fc['params']['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x144627,null))[_0x40d5('0x2d')](function(_0x13dd71){if(_0x13dd71){_0x768f3e=_0x13dd71;_0x533bcf[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0x11b')][_0x40d5('0x44')]);_0x533bcf[_0x40d5('0x4b')]=_['keys'](_0x14f9fc[_0x40d5('0x4b')]);_0x533bcf[_0x40d5('0x60')]=_['intersection'](_0x533bcf[_0x40d5('0x61')],_0x533bcf[_0x40d5('0x4b')]);_0x3c105d['attributes']=_[_0x40d5('0x62')](_0x533bcf[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x14f9fc['query'][_0x40d5('0x63')]));_0x3c105d[_0x40d5('0x51')]=_0x3c105d['attributes']['length']?_0x3c105d[_0x40d5('0x51')]:_0x533bcf[_0x40d5('0x61')];_0x3c105d[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x14f9fc[_0x40d5('0x4b')]['sort']);_0x3c105d[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x14f9fc['query'],_0x533bcf[_0x40d5('0x60')]));if(_0x14f9fc[_0x40d5('0x4b')]['filter']){_0x3c105d['where']=_[_0x40d5('0x64')](_0x3c105d[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0x3c105d['attributes'],function(_0x522d32){var _0x272e44={};_0x272e44[_0x522d32]={'$like':'%'+_0x14f9fc['query'][_0x40d5('0x39')]+'%'};return _0x272e44;})});}_0x3c105d=_['merge']({},_0x3c105d,_0x14f9fc[_0x40d5('0xd7')]);return _0x768f3e['getTeams'](_0x3c105d);}})['then'](function(_0x4fb22e){if(_0x4fb22e){_0x5e0bc6=_0x4fb22e[_0x40d5('0x56')];if(!_0x14f9fc['query'][_0x40d5('0xd8')](_0x40d5('0xdf'))){_0x3c105d[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x14f9fc['query'][_0x40d5('0x27')]);_0x3c105d[_0x40d5('0x29')]=qs['offset'](_0x14f9fc['query'][_0x40d5('0x29')]);}return _0x768f3e[_0x40d5('0x11c')](_0x3c105d);}})[_0x40d5('0x2d')](function(_0x5b0f58){if(_0x5b0f58){return _0x5b0f58?{'count':_0x5e0bc6,'rows':_0x5b0f58}:null;}})[_0x40d5('0x2d')](respondWithResult(_0x144627,null))[_0x40d5('0x22')](handleError(_0x144627,null));};exports[_0x40d5('0x11d')]=function(_0x1d584a,_0x2bf8ba){var _0x58fe3f=_0x1d584a[_0x40d5('0x5d')]['id'];var _0x385814=_0x1d584a[_0x40d5('0x66')]?_0x1d584a[_0x40d5('0x66')]['ids']:null;var _0xd12062=[];return Promise[_0x40d5('0x10d')]()[_0x40d5('0x2d')](function(){if(!_0x385814)throw new APIBadRequestError(_0x40d5('0x11e'));})[_0x40d5('0x2d')](function(){return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x58fe3f}});})[_0x40d5('0x2d')](function(_0xb0c62d){if(!_0xb0c62d)throw new APINotFoundError(util[_0x40d5('0xb3')](_0x40d5('0x11f'),_0x1d584a[_0x40d5('0x5d')]['id']));return db[_0x40d5('0x70')][_0x40d5('0x120')](function(_0x3528e6){return _0xb0c62d[_0x40d5('0x11d')](_0x385814,{'transaction':_0x3528e6})['then'](function(){return db[_0x40d5('0x11b')]['findAll']({'where':{'id':{'$in':_0x385814}}});})[_0x40d5('0x2d')](function(_0x2befc6){var _0x1185a0=_['map'](_0x2befc6,function(_0x48a257){return _0x48a257[_0x40d5('0x121')]();});return Promise[_0x40d5('0x5b')](_0x1185a0);})[_0x40d5('0x2d')](function(_0x562856){_0xd12062=_[_0x40d5('0x122')](_0x562856);var _0x1f8de3=_[_0x40d5('0x3b')](_0xd12062,function(_0x34e14b){return _0x34e14b['addAgent'](_0xb0c62d['id'],{'transaction':_0x3528e6});});return Promise[_0x40d5('0x5b')](_0x1f8de3);})['then'](function(){if(!_0xb0c62d[_0x40d5('0x10f')])return;var _0x301fec=_[_0x40d5('0x39')](_0xd12062,function(_0x25646b){return _0x25646b[_0x40d5('0x123')](_0x40d5('0xa5'))===_0x40d5('0x124');});var _0x37cd3c=_[_0x40d5('0x3b')](_0x301fec,function(_0x5cca19){return db[_0x40d5('0xb4')][_0x40d5('0xb5')]({'membername':_0xb0c62d[_0x40d5('0x3e')],'UserId':_0xb0c62d['id'],'queue_name':_0x5cca19[_0x40d5('0x3e')],'VoiceQueueId':_0x5cca19['id'],'interface':_[_0x40d5('0x6e')](_0xb0c62d[_0x40d5('0xa8')])?util[_0x40d5('0xb3')]('SIP/%s',_0xb0c62d[_0x40d5('0x3e')]):_0xb0c62d['interface'],'paused':_0xb0c62d[_0x40d5('0xa7')]||![],'penalty':_0xb0c62d[_0x40d5('0xad')]},{'transaction':_0x3528e6});});return Promise[_0x40d5('0x5b')](_0x37cd3c);})['then'](function(){return db[_0x40d5('0x125')][_0x40d5('0x53')]({'where':{'teamId':{'$in':_0x385814}}});})['then'](function(_0x4536ad){var _0x426ea7=_[_0x40d5('0x3b')](_0x4536ad,function(_0x5836de){return db[_0x40d5('0x126')][_0x40d5('0x85')]({'UserId':_0xb0c62d['id'],'VoicePrefixId':_0x5836de[_0x40d5('0x127')]},{'transaction':_0x3528e6});});return Promise['all'](_0x426ea7);});});})[_0x40d5('0x2d')](function(){for(var _0x321bf9=0x0;_0x321bf9<_0xd12062[_0x40d5('0x56')];_0x321bf9++){var _0x40e0eb=_0xd12062[_0x321bf9][_0x40d5('0x123')](_0x40d5('0xa5'));var _0xc6a2b=_0x40e0eb+_0x40d5('0xaf');socket[_0x40d5('0x2e')](_0x40d5('0x34')+_0x40e0eb+_0x40d5('0xb0'),{'UserId':_0x58fe3f,['queueField']:_0xd12062[_0x321bf9]['id']});}})[_0x40d5('0x2d')](respondWithStatusCode(_0x2bf8ba,null))['catch'](APIHandleError(_0x2bf8ba));};exports[_0x40d5('0x128')]=function(_0x16d8e2,_0x50c30c){var _0x163ff6=_0x16d8e2[_0x40d5('0x5d')]['id'];var _0x152831=null;if(_0x16d8e2['query'][_0x40d5('0x68')]){_0x152831=_[_0x40d5('0xb8')](_0x16d8e2[_0x40d5('0x4b')][_0x40d5('0x68')])?_0x16d8e2[_0x40d5('0x4b')]['ids']:[_0x16d8e2['query'][_0x40d5('0x68')]];}var _0xf2b5e0=[];return Promise['resolve']()['then'](function(){if(!_0x152831)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db['User'][_0x40d5('0x9e')]({'where':{'id':_0x163ff6}});})[_0x40d5('0x2d')](function(_0x51d86d){if(!_0x51d86d)throw new APINotFoundError(util[_0x40d5('0xb3')]('User\x20with\x20id\x20%s\x20not\x20found',_0x16d8e2[_0x40d5('0x5d')]['id']));return db[_0x40d5('0x70')][_0x40d5('0x120')](function(_0x175b23){return _0x51d86d['removeTeams'](_0x152831,{'transaction':_0x175b23})[_0x40d5('0x2d')](function(){return db[_0x40d5('0x11b')][_0x40d5('0x53')]({'where':{'id':{'$in':_0x152831}}});})[_0x40d5('0x2d')](function(_0x462cc2){var _0x4f3f5e=_[_0x40d5('0x3b')](_0x462cc2,function(_0x5281bc){return _0x5281bc[_0x40d5('0x121')]();});return Promise['all'](_0x4f3f5e);})[_0x40d5('0x2d')](function(_0x5b546d){_0xf2b5e0=_[_0x40d5('0x122')](_0x5b546d);var _0x3ca5ff=_[_0x40d5('0x3b')](_0xf2b5e0,function(_0x397aa6){return _0x397aa6['removeAgent'](_0x51d86d['id'],{'transaction':_0x175b23});});return Promise[_0x40d5('0x5b')](_0x3ca5ff);})[_0x40d5('0x2d')](function(){if(!_0x51d86d['online'])return;var _0x4a5e09=_[_0x40d5('0x39')](_0xf2b5e0,function(_0x4c9b92){return _0x4c9b92[_0x40d5('0x123')](_0x40d5('0xa5'))===_0x40d5('0x124');});var _0x1aa786=_[_0x40d5('0x3b')](_0x4a5e09,function(_0x353d02){return db[_0x40d5('0xb4')]['destroy']({'where':{'VoiceQueueId':_0x353d02['id'],'UserId':_0x51d86d['id']},'transaction':_0x175b23});});return Promise['all'](_0x1aa786);})['then'](function(){return db[_0x40d5('0x125')][_0x40d5('0x53')]({'where':{'teamId':{'$in':_0x152831}}});})['then'](function(_0x5bc351){var _0x1584de=_[_0x40d5('0x3b')](_0x5bc351,function(_0x294a4f){return db[_0x40d5('0x126')][_0x40d5('0x3f')]({'where':{'UserId':_0x51d86d['id'],'VoicePrefixId':_0x294a4f['VoicePrefixId']}},{'transaction':_0x175b23});});return Promise[_0x40d5('0x5b')](_0x1584de);});});})[_0x40d5('0x2d')](function(){for(var _0x4cd22b=0x0;_0x4cd22b<_0xf2b5e0[_0x40d5('0x56')];_0x4cd22b++){var _0x56af2f=_0xf2b5e0[_0x4cd22b][_0x40d5('0x123')](_0x40d5('0xa5'));var _0x524e8f=_0x56af2f+_0x40d5('0xaf');socket[_0x40d5('0x2e')](_0x40d5('0x34')+_0x56af2f+'Queue:remove',{'UserId':_0x163ff6,['queueField']:_0xf2b5e0[_0x4cd22b]['id']});}})[_0x40d5('0x2d')](respondWithStatusCode(_0x50c30c,null))[_0x40d5('0x22')](APIHandleError(_0x50c30c));};exports[_0x40d5('0x129')]=function(_0x2a1bcc,_0x4bce87){var _0xfe3930={};var _0x3d305d={};var _0x3e77a9;var _0x4f9d75;return db[_0x40d5('0x43')]['findOne']({'where':{'id':_0x2a1bcc[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x4bce87,null))[_0x40d5('0x2d')](function(_0x1a5faf){if(_0x1a5faf){_0x3e77a9=_0x1a5faf;_0x3d305d[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db['CmList'][_0x40d5('0x44')]);_0x3d305d[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x2a1bcc[_0x40d5('0x4b')]);_0x3d305d['filters']=_[_0x40d5('0x62')](_0x3d305d[_0x40d5('0x61')],_0x3d305d[_0x40d5('0x4b')]);_0xfe3930[_0x40d5('0x51')]=_['intersection'](_0x3d305d['model'],qs['fields'](_0x2a1bcc[_0x40d5('0x4b')][_0x40d5('0x63')]));_0xfe3930['attributes']=_0xfe3930[_0x40d5('0x51')]['length']?_0xfe3930[_0x40d5('0x51')]:_0x3d305d[_0x40d5('0x61')];_0xfe3930[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x2a1bcc[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0xfe3930[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x2a1bcc[_0x40d5('0x4b')],_0x3d305d[_0x40d5('0x60')]));if(_0x2a1bcc[_0x40d5('0x4b')][_0x40d5('0x39')]){_0xfe3930['where']=_[_0x40d5('0x64')](_0xfe3930[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0xfe3930[_0x40d5('0x51')],function(_0xbe5b7c){var _0x341c89={};_0x341c89[_0xbe5b7c]={'$like':'%'+_0x2a1bcc['query'][_0x40d5('0x39')]+'%'};return _0x341c89;})});}_0xfe3930=_['merge']({},_0xfe3930,_0x2a1bcc[_0x40d5('0xd7')]);return _0x3e77a9[_0x40d5('0x129')](_0xfe3930);}})[_0x40d5('0x2d')](function(_0x1773b1){if(_0x1773b1){_0x4f9d75=_0x1773b1[_0x40d5('0x56')];if(!_0x2a1bcc[_0x40d5('0x4b')]['hasOwnProperty'](_0x40d5('0xdf'))){_0xfe3930[_0x40d5('0x27')]=qs['limit'](_0x2a1bcc[_0x40d5('0x4b')]['limit']);_0xfe3930['offset']=qs[_0x40d5('0x29')](_0x2a1bcc[_0x40d5('0x4b')][_0x40d5('0x29')]);}return _0x3e77a9['getLists'](_0xfe3930);}})[_0x40d5('0x2d')](function(_0x45c6f3){if(_0x45c6f3){return _0x45c6f3?{'count':_0x4f9d75,'rows':_0x45c6f3}:null;}})[_0x40d5('0x2d')](respondWithResult(_0x4bce87,null))[_0x40d5('0x22')](handleError(_0x4bce87,null));};exports['getAgents']=function(_0x244670,_0x2e2ccf){var _0x43f2e6={};var _0x265260={};var _0x5be291;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x244670['params']['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x2e2ccf,null))['then'](function(_0x37a317){if(_0x37a317){_0x5be291=_0x37a317;_0x265260[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db['User'][_0x40d5('0x44')]);_0x265260['query']=_[_0x40d5('0x5e')](_0x244670[_0x40d5('0x4b')]);_0x265260[_0x40d5('0x60')]=_[_0x40d5('0x62')](_0x265260[_0x40d5('0x61')],_0x265260['query']);_0x43f2e6[_0x40d5('0x51')]=_[_0x40d5('0x62')](_0x265260[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x244670[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x43f2e6[_0x40d5('0x51')]=_0x43f2e6[_0x40d5('0x51')][_0x40d5('0x56')]?_0x43f2e6[_0x40d5('0x51')]:_0x265260[_0x40d5('0x61')];_0x43f2e6[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x244670[_0x40d5('0x4b')]['sort']);_0x43f2e6[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x244670[_0x40d5('0x4b')],_0x265260[_0x40d5('0x60')]));if(_0x244670[_0x40d5('0x4b')][_0x40d5('0x39')]){_0x43f2e6[_0x40d5('0x4a')]=_[_0x40d5('0x64')](_0x43f2e6[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0x43f2e6[_0x40d5('0x51')],function(_0x43ca69){var _0x5c09de={};_0x5c09de[_0x43ca69]={'$like':'%'+_0x244670[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x5c09de;})});}_0x43f2e6['model']=db[_0x40d5('0x43')];_0x43f2e6['as']='Agents';_0x43f2e6=_[_0x40d5('0x64')]({},_0x43f2e6,_0x244670[_0x40d5('0xd7')]);return _0x5be291[_0x40d5('0x102')]({'include':[_0x43f2e6]});}})[_0x40d5('0x2d')](function(_0x182b66){if(_0x182b66){var _0x3a1e58={},_0x4cc1da=[];for(var _0x2f2a5e=0x0;_0x2f2a5e<_0x182b66[_0x40d5('0x56')];_0x2f2a5e+=0x1){for(var _0xb3a1a1=0x0,_0x308238;_0xb3a1a1<_0x182b66[_0x2f2a5e][_0x40d5('0x35')][_0x40d5('0x56')];_0xb3a1a1+=0x1){_0x308238=_0x182b66[_0x2f2a5e][_0x40d5('0x35')][_0xb3a1a1][_0x40d5('0x30')]({'plain':!![]});_0x3a1e58[_0x308238['id']]=_0x308238;}}_0x3a1e58=_['values'](_0x3a1e58);for(var _0x523a3c=qs[_0x40d5('0x29')](_0x244670[_0x40d5('0x4b')][_0x40d5('0x29')]);_0x523a3c<_0x3a1e58[_0x40d5('0x56')]&&_0x4cc1da[_0x40d5('0x56')]=_0x35af61){_0x464a9e=_0x35af61;_0xe9c726=0xc8;}else{_0xe9c726=0xce;}_0x46f611[_0x63f0('0x21')](_0xe9c726);return _0x46f611['set'](_0x63f0('0x26'),_0x33236f+'-'+_0x464a9e+'/'+_0x35af61)[_0x63f0('0x22')](_0x19027f);}return null;};}function saveUpdates(_0x2223fd){return function(_0x54d241){if(_0x54d241){return _0x54d241[_0x63f0('0x27')](_0x2223fd)[_0x63f0('0x16')](function(_0x13a5fc){socket[_0x63f0('0x28')](_0x63f0('0x29')+_0x13a5fc['id'],{});return _0x13a5fc;});}return null;};}function removeEntity(_0x11ed28){return function(_0x5a37bb){if(_0x5a37bb){return _0x5a37bb[_0x63f0('0x2a')]()[_0x63f0('0x16')](function(){var _0x17c87e=_0x5a37bb[_0x63f0('0x2b')]({'plain':!![]});if(_0x17c87e['role']==='admin')return;var _0x26e8ec=[{'name':_0x63f0('0x2c'),'value':_0x63f0('0x2d'),'ignore':!![]},{'name':_0x63f0('0x2e'),'value':_0x63f0('0x2f'),'ignore':![]},{'name':_0x63f0('0x30'),'value':_0x63f0('0x31'),'ignore':![]}];var _0x167fc9=_(_0x26e8ec)[_0x63f0('0x32')](_0x63f0('0x33'))[_0x63f0('0x34')](_0x63f0('0x35'))[_0x63f0('0x35')]();if(_[_0x63f0('0x36')](_0x167fc9,_0x17c87e[_0x63f0('0x37')])){return;}var _0x57e4d3=_[_0x63f0('0x38')](_0x26e8ec,[_0x63f0('0x35'),_0x17c87e[_0x63f0('0x37')]])['name'];return db[_0x63f0('0x39')][_0x63f0('0x2a')]({'where':{'type':_0x57e4d3,'resourceId':_0x17c87e['id']}})[_0x63f0('0x16')](function(){return _0x5a37bb;});})[_0x63f0('0x16')](function(){_0x11ed28[_0x63f0('0x21')](0xcc)[_0x63f0('0x3a')]();});}};}function handleEntityNotFound(_0x39e855){return function(_0x540ad9){if(!_0x540ad9){_0x39e855['sendStatus'](0x194);}return _0x540ad9;};}function handleError(_0x39e49b,_0x42031f){_0x42031f=_0x42031f||0x1f4;return function(_0x3282a2){logger[_0x63f0('0x1c')](_0x3282a2['stack']);if(_0x3282a2[_0x63f0('0x3b')]){delete _0x3282a2['name'];}_0x39e49b[_0x63f0('0x21')](_0x42031f)['send'](_0x3282a2);};}exports[_0x63f0('0x3c')]=function(_0x42682a,_0x6d6455){var _0x3930c0={},_0x54ca51={'count':0x0,'rows':[]};var _0x4ee70b=_(db[_0x63f0('0x3d')][_0x63f0('0x3e')])[_0x63f0('0x34')](function(_0xd83325){return{'name':_0xd83325[_0x63f0('0x3f')],'type':_0xd83325[_0x63f0('0x40')]['key']};})[_0x63f0('0x32')](function(_0x12310f){return!_[_0x63f0('0x36')]([_0x63f0('0x41'),'salt'],_0x12310f['name']);})[_0x63f0('0x35')]();_0x3930c0=qs[_0x63f0('0x42')](_0x4ee70b,_0x42682a);var _0x1b04e8={'where':_0x3930c0[_0x63f0('0x43')]};return db[_0x63f0('0x3d')][_0x63f0('0x25')](_0x1b04e8)[_0x63f0('0x16')](function(_0x4fabcc){_0x54ca51[_0x63f0('0x25')]=_0x4fabcc;if(_0x42682a[_0x63f0('0x44')][_0x63f0('0x45')]){_0x3930c0[_0x63f0('0x46')]=[{'all':!![]}];}if(_0x42682a[_0x63f0('0x44')][_0x63f0('0x47')]==='true'){_0x3930c0[_0x63f0('0x46')]=[{'model':db[_0x63f0('0x48')],'as':_0x63f0('0x47')}];}if(!_[_0x63f0('0x36')](_0x3930c0[_0x63f0('0x49')],'id')){_0x3930c0[_0x63f0('0x49')][_0x63f0('0x4a')]('id');}return db[_0x63f0('0x3d')][_0x63f0('0x4b')](_0x3930c0);})[_0x63f0('0x16')](function(_0x36642c){_0x54ca51['rows']=_0x36642c;if(_0x42682a[_0x63f0('0x44')][_0x63f0('0x4c')]==='true'){var _0x314165=[];for(var _0x507fd=0x0;_0x507fd<_0x54ca51[_0x63f0('0x4d')]['length'];_0x507fd++){_0x314165[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x4e'),_0x54ca51[_0x63f0('0x4d')][_0x507fd][_0x63f0('0x4f')]));_0x314165[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x50'),_0x54ca51[_0x63f0('0x4d')][_0x507fd]['dataValues']));_0x314165[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x51'),_0x54ca51[_0x63f0('0x4d')][_0x507fd][_0x63f0('0x4f')]));_0x314165[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x52'),_0x54ca51[_0x63f0('0x4d')][_0x507fd]['dataValues']));_0x314165[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x53'),_0x54ca51[_0x63f0('0x4d')][_0x507fd][_0x63f0('0x4f')]));_0x314165['push'](get_open_tabs(_0x63f0('0x54'),_0x54ca51['rows'][_0x507fd][_0x63f0('0x4f')]));}return Promise[_0x63f0('0x55')](_0x314165)['then'](function(){return _0x54ca51;});}else{return _0x54ca51;}})[_0x63f0('0x16')](respondWithFilteredResult(_0x6d6455,_0x3930c0))[_0x63f0('0x20')](handleError(_0x6d6455,null));};exports[_0x63f0('0x56')]=function(_0x14adf1,_0x23f5b3){var _0x2fc3ad={'raw':![],'where':{'id':_0x14adf1[_0x63f0('0x57')]['id']}},_0x379426={};_0x379426['model']=_[_0x63f0('0x58')](_[_0x63f0('0x59')](db[_0x63f0('0x3d')]['rawAttributes']),[_0x63f0('0x41'),_0x63f0('0x5a')]);_0x379426[_0x63f0('0x44')]=_['keys'](_0x14adf1[_0x63f0('0x44')]);_0x379426[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x379426[_0x63f0('0x5d')],_0x379426[_0x63f0('0x44')]);_0x2fc3ad[_0x63f0('0x49')]=_['intersection'](_0x379426[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x14adf1[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x2fc3ad[_0x63f0('0x49')]=_0x2fc3ad[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x2fc3ad[_0x63f0('0x49')]:_0x379426[_0x63f0('0x5d')];if(_0x14adf1['query'][_0x63f0('0x45')]){_0x2fc3ad[_0x63f0('0x46')]=[{'all':!![]}];}if(_0x14adf1[_0x63f0('0x44')][_0x63f0('0x47')]===_0x63f0('0x60')){_0x2fc3ad[_0x63f0('0x46')]=[{'model':db[_0x63f0('0x48')],'as':_0x63f0('0x47')}];}_0x2fc3ad=_['merge']({},_0x2fc3ad,_0x14adf1['options']);if(!_['includes'](_0x2fc3ad[_0x63f0('0x49')],'id')){_0x2fc3ad['attributes'][_0x63f0('0x4a')]('id');}return db[_0x63f0('0x3d')][_0x63f0('0x38')](_0x2fc3ad)[_0x63f0('0x16')](handleEntityNotFound(_0x23f5b3,null))['then'](function(_0x537c12){var _0x4702ed=[];values=_0x537c12;if(_0x14adf1['query'][_0x63f0('0x4c')]===_0x63f0('0x60')){_0x4702ed[_0x63f0('0x4a')](get_open_tabs('chat',_0x537c12['dataValues']));_0x4702ed[_0x63f0('0x4a')](get_open_tabs('sms',_0x537c12[_0x63f0('0x4f')]));_0x4702ed[_0x63f0('0x4a')](get_open_tabs('openchannel',_0x537c12['dataValues']));_0x4702ed[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x54'),_0x537c12['dataValues']));_0x4702ed[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x51'),_0x537c12[_0x63f0('0x4f')]));_0x4702ed['push'](get_open_tabs(_0x63f0('0x52'),_0x537c12[_0x63f0('0x4f')]));return Promise[_0x63f0('0x55')](_0x4702ed);}else{return values;}})[_0x63f0('0x16')](function(){return values;})['then'](respondWithResult(_0x23f5b3,null))['catch'](handleError(_0x23f5b3,null));};exports[_0x63f0('0x27')]=function(_0x391b64,_0x3b7351){if(_0x391b64[_0x63f0('0x61')]['id']){delete _0x391b64['body']['id'];}delete _0x391b64[_0x63f0('0x61')][_0x63f0('0x37')];return db[_0x63f0('0x3d')][_0x63f0('0x38')]({'where':{'id':_0x391b64[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x3b7351,null))[_0x63f0('0x16')](saveUpdates(_0x391b64['body'],null))[_0x63f0('0x16')](respondWithResult(_0x3b7351,null))[_0x63f0('0x20')](handleError(_0x3b7351,null));};exports['describe']=function(_0x56f400,_0x4ca85b){return db[_0x63f0('0x3d')][_0x63f0('0x62')]()[_0x63f0('0x16')](respondWithResult(_0x4ca85b,null))[_0x63f0('0x20')](handleError(_0x4ca85b,null));};exports[_0x63f0('0x63')]=function(_0x175b10,_0x2d9f2d){return db[_0x63f0('0x3d')][_0x63f0('0x38')]({'where':{'id':_0x175b10[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x2d9f2d,null))[_0x63f0('0x16')](function(_0x511308){if(_0x511308){return _0x511308[_0x63f0('0x63')](_0x175b10[_0x63f0('0x61')][_0x63f0('0x64')],_['omit'](_0x175b10[_0x63f0('0x61')],[_0x63f0('0x64'),'id'])||{});}})[_0x63f0('0x16')](respondWithResult(_0x2d9f2d,null))[_0x63f0('0x20')](handleError(_0x2d9f2d,null));};function validateUser(_0x21cbac){return new Promise(function(_0x4709f3,_0x5651fe){if(_0x21cbac[_0x63f0('0x65')])return _0x4709f3(_0x21cbac);return db[_0x63f0('0x66')]['findById'](0x1)[_0x63f0('0x16')](function(_0x2d5653){if(_0x2d5653[_0x63f0('0x67')])authService[_0x63f0('0x68')](_0x21cbac[_0x63f0('0x41')]);db[_0x63f0('0x3d')][_0x63f0('0x69')]('internal')[_0x63f0('0x16')](function(_0x237957){if(_[_0x63f0('0x6a')](_0x237957)){_0x21cbac[_0x63f0('0x65')]=_0x2d5653[_0x63f0('0x6b')]||0x1;return;}if(_[_0x63f0('0x6a')](_0x2d5653[_0x63f0('0x6b')])||_0x2d5653[_0x63f0('0x6b')]===_0x237957){_0x21cbac[_0x63f0('0x65')]=_0x237957+0x1;return;}if(_0x2d5653[_0x63f0('0x6b')]>_0x237957){_0x21cbac[_0x63f0('0x65')]=_0x2d5653[_0x63f0('0x6b')];return;}return db[_0x63f0('0x6c')]['query'](_0x63f0('0x6d'),{'type':db[_0x63f0('0x6c')]['QueryTypes'][_0x63f0('0x6e')]})[_0x63f0('0x16')](function(_0x5ce043){if(_0x5ce043&&_0x5ce043['length']){for(var _0x4c2bc0=0x0,_0x122076=_0x5ce043[_0x63f0('0x5f')];_0x4c2bc0<_0x122076&&_[_0x63f0('0x6a')](_0x21cbac[_0x63f0('0x65')]);_0x4c2bc0++){if(_0x2d5653[_0x63f0('0x6b')]<=_0x5ce043[_0x4c2bc0][_0x63f0('0x6f')]){_0x21cbac[_0x63f0('0x65')]=_0x5ce043[_0x4c2bc0][_0x63f0('0x6f')];}else if(_0x2d5653[_0x63f0('0x6b')]>_0x5ce043[_0x4c2bc0]['from']&&_0x2d5653[_0x63f0('0x6b')]<=_0x5ce043[_0x4c2bc0]['to']){_0x21cbac[_0x63f0('0x65')]=_0x2d5653['min_internal'];}}}if(_[_0x63f0('0x6a')](_0x21cbac['internal'])){_0x21cbac[_0x63f0('0x65')]=_0x237957+0x1;}return _0x4709f3(_0x21cbac);});});})[_0x63f0('0x20')](function(_0x1c8725){_0x5651fe(_0x1c8725);});});}function updateUser(_0xe6a7e9){return new Promise(function(_0x9c46eb,_0x1410c6){try{if(_0xe6a7e9['voicemail']){_0xe6a7e9[_0x63f0('0x70')]=_0xe6a7e9[_0x63f0('0x65')];_0xe6a7e9[_0x63f0('0x71')]={'mailbox':_0xe6a7e9['internal'],'password':_0xe6a7e9[_0x63f0('0x41')],'fullname':_0xe6a7e9[_0x63f0('0x72')],'email':_0xe6a7e9[_0x63f0('0x73')]};}if(_0xe6a7e9['role']==='agent'){if(!_0xe6a7e9['permissions'])_0xe6a7e9[_0x63f0('0x74')]=[_0x63f0('0x75'),_0x63f0('0x76'),'103',_0x63f0('0x77'),_0x63f0('0x78'),_0x63f0('0x79'),_0x63f0('0x7a'),_0x63f0('0x7b'),_0x63f0('0x7c'),_0x63f0('0x7d'),'109',_0x63f0('0x7e'),_0x63f0('0x7f'),'114',_0x63f0('0x80')];}_0x9c46eb(_0xe6a7e9);}catch(_0x29afcd){_0x1410c6(_0x29afcd);}});}exports[_0x63f0('0x81')]=function(_0x58a17c,_0x32f7c9){if(_0x58a17c[_0x63f0('0x2d')][_0x63f0('0x37')]===_0x63f0('0x2f'))throw new Error(_0x63f0('0x82'));if(_0x58a17c[_0x63f0('0x61')][_0x63f0('0x37')]===_0x63f0('0x2d')&&_0x58a17c[_0x63f0('0x2d')]['role']!==_0x63f0('0x83')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x58a17c['body']['role']===_0x63f0('0x83')&&_0x58a17c[_0x63f0('0x2d')][_0x63f0('0x37')]!==_0x63f0('0x83')){throw new Error(_0x63f0('0x84'));}return licenseUtil[_0x63f0('0x85')]([_0x58a17c[_0x63f0('0x61')]])['then'](function(){return validateUser(_0x58a17c[_0x63f0('0x61')]);})[_0x63f0('0x16')](function(_0x38cba5){return updateUser(_0x38cba5)['then'](function(_0x26fc4a){if(_0x26fc4a[_0x63f0('0x37')]===_0x63f0('0x83')){_0x26fc4a[_0x63f0('0x86')]=_0x58a17c[_0x63f0('0x2d')][_0x63f0('0x86')];delete _0x26fc4a[_0x63f0('0x87')];}return _0x26fc4a;});})[_0x63f0('0x16')](function(_0x182bf3){return db[_0x63f0('0x3d')][_0x63f0('0x81')](_0x182bf3,{'include':[{'model':db[_0x63f0('0x71')],'as':'VoiceMail'}]});})[_0x63f0('0x16')](function(_0x336727){if(_0x58a17c[_0x63f0('0x61')][_0x63f0('0x37')]==='user')return _0x336727;if(_0x58a17c[_0x63f0('0x2d')]['role']!=='user')return _0x336727;return db[_0x63f0('0x88')][_0x63f0('0x38')]({'where':{'name':_0x336727[_0x63f0('0x37')]===_0x63f0('0x2f')?_0x63f0('0x2e'):_0x63f0('0x30'),'userProfileId':_0x58a17c[_0x63f0('0x2d')][_0x63f0('0x87')]},'raw':!![]})[_0x63f0('0x16')](function(_0x29d529){if(!_0x29d529||_0x29d529[_0x63f0('0x89')]!=0x0)return _0x336727;return db[_0x63f0('0x39')][_0x63f0('0x81')]({'name':_0x336727[_0x63f0('0x3b')],'resourceId':_0x336727['id'],'type':_0x29d529[_0x63f0('0x3b')],'sectionId':_0x29d529['id']},{})['then'](function(){return _0x336727;});})['catch'](function(_0x5a03d0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a03d0);throw _0x5a03d0;});})[_0x63f0('0x16')](respondWithResult(_0x32f7c9,0xc9))['catch'](handleError(_0x32f7c9,null));};exports[_0x63f0('0x8a')]=function(_0x5d87d0,_0x28ec80){var _0x4f615d=_0x5d87d0[_0x63f0('0x61')];var _0x210d82=[];if(_0x5d87d0[_0x63f0('0x2d')][_0x63f0('0x37')]===_0x63f0('0x2f'))throw new Error(_0x63f0('0x82'));if(_[_0x63f0('0x8b')](_0x4f615d,[_0x63f0('0x37'),_0x63f0('0x2d')])&&_0x5d87d0[_0x63f0('0x2d')][_0x63f0('0x37')]!==_0x63f0('0x83')){throw new Error(_0x63f0('0x8c'));}if(_['some'](_0x4f615d,[_0x63f0('0x37'),_0x63f0('0x83')])&&_0x5d87d0['user']['role']!==_0x63f0('0x83')){throw new Error(_0x63f0('0x8d'));}return licenseUtil[_0x63f0('0x85')](_0x4f615d)[_0x63f0('0x16')](function(){return validateUser(_0x4f615d[0x0]);})['then'](function(){for(var _0x2eccb2=0x1;_0x2eccb2<_0x4f615d['length'];_0x2eccb2++){var _0x46bd7e=_0x4f615d[_0x2eccb2-0x1][_0x63f0('0x65')];if(!_0x4f615d[_0x2eccb2][_0x63f0('0x65')])_0x4f615d[_0x2eccb2]['internal']=_0x46bd7e+0x1;_0x210d82[_0x63f0('0x4a')](validateUser(_0x4f615d[_0x2eccb2]));}return Promise[_0x63f0('0x55')](_0x210d82);})[_0x63f0('0x16')](function(){_0x210d82=[];for(var _0x4c12cb=0x0;_0x4c12cb<_0x4f615d[_0x63f0('0x5f')];_0x4c12cb++){_0x210d82['push'](updateUser(_0x4f615d[_0x4c12cb]));}return Promise[_0x63f0('0x55')](_0x210d82);})[_0x63f0('0x16')](function(){_0x210d82=_0x4f615d[_0x63f0('0x34')](function(_0x45c60c){return db[_0x63f0('0x3d')][_0x63f0('0x81')](_0x45c60c,{'include':[{'model':db[_0x63f0('0x71')],'as':_0x63f0('0x71')}]})['then'](function(_0x16b484){_0x45c60c['id']=_0x16b484['id'];return _0x45c60c;});});return Promise[_0x63f0('0x55')](_0x210d82);})[_0x63f0('0x16')](function(_0x31cc64){if(_0x5d87d0[_0x63f0('0x61')]['role']===_0x63f0('0x2d'))return _0x31cc64;if(_0x5d87d0['user'][_0x63f0('0x37')]!==_0x63f0('0x2d'))return _0x31cc64;var _0x28816a=_[_0x63f0('0x8b')](_0x31cc64,function(_0x3a31b7){return _0x3a31b7[_0x63f0('0x37')]===_0x63f0('0x2f')||_0x3a31b7[_0x63f0('0x37')]==='telephone';});if(!_0x28816a)return _0x31cc64;return db[_0x63f0('0x88')][_0x63f0('0x4b')]({'where':{'name':{'$or':[_0x63f0('0x2e'),_0x63f0('0x30')]},'userProfileId':_0x5d87d0[_0x63f0('0x2d')]['userProfileId']},'raw':!![]})[_0x63f0('0x16')](function(_0xb2afc1){if(_[_0x63f0('0x8e')](_0xb2afc1)||!_[_0x63f0('0x8b')](_0xb2afc1,[_0x63f0('0x89'),0x0]))return _0x31cc64;_0x210d82=[];var _0x31c695=_(_0xb2afc1)[_0x63f0('0x34')](function(_0x39798c){if(_0x39798c[_0x63f0('0x89')]===0x1)return;return _0x39798c['name']===_0x63f0('0x2e')?'agent':'telephone';})['compact']()[_0x63f0('0x35')]();for(var _0x1f2b13=0x0;_0x1f2b13<_0x31cc64['length'];_0x1f2b13++){if(!_[_0x63f0('0x36')](_0x31c695,_0x31cc64[_0x1f2b13][_0x63f0('0x37')]))return;var _0x5d0775=_0x31cc64[_0x1f2b13][_0x63f0('0x37')]===_0x63f0('0x2f')?_0x63f0('0x2e'):_0x63f0('0x30');_0x210d82['push'](db['UserProfileResource'][_0x63f0('0x81')]({'name':_0x31cc64[_0x1f2b13]['name'],'resourceId':_0x31cc64[_0x1f2b13]['id'],'type':_0x5d0775,'sectionId':_['find'](_0xb2afc1,[_0x63f0('0x3b'),_0x5d0775])['id']},{}));}return Promise['all'](_0x210d82);});})[_0x63f0('0x16')](respondWithResult(_0x28ec80,0xc9))['catch'](handleError(_0x28ec80,null));};exports[_0x63f0('0x8f')]=function(_0x2f7044,_0x4f44f5){if(_0x2f7044[_0x63f0('0x61')]['id']){delete _0x2f7044[_0x63f0('0x61')]['id'];}return db[_0x63f0('0x3d')]['find']({'where':{'id':_0x2f7044['params']['id']}})[_0x63f0('0x16')](function(_0x2b1edc){if(!_0x2b1edc)return null;if(_0x2b1edc['id']===_0x2f7044['user']['id']){if(!_0x2f7044[_0x63f0('0x61')][_0x63f0('0x90')]||!_0x2f7044[_0x63f0('0x61')][_0x63f0('0x91')]){throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0x94'));}if(!_0x2b1edc[_0x63f0('0x95')](_0x2f7044[_0x63f0('0x61')][_0x63f0('0x90')])){throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0x96'));}if(_0x2f7044[_0x63f0('0x61')][_0x63f0('0x90')]===_0x2f7044[_0x63f0('0x61')][_0x63f0('0x91')]){throw new db[(_0x63f0('0x92'))]['ValidationError'](_0x63f0('0x97'));}}else if(_0x2f7044[_0x63f0('0x2d')][_0x63f0('0x37')]===_0x63f0('0x83')){if(!_0x2f7044[_0x63f0('0x61')]['newPassword']){throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0x98'));}}else if(_0x2f7044['user'][_0x63f0('0x37')]==='user'){if(!_0x2f7044[_0x63f0('0x61')][_0x63f0('0x91')]){throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0x98'));}if(_0x2b1edc[_0x63f0('0x37')]!==_0x63f0('0x2f')){throw new db[(_0x63f0('0x92'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0x63f0('0x92'))]['ValidationError'](_0x63f0('0x82'));}return _0x2b1edc;})['then'](handleEntityNotFound(_0x4f44f5,null))[_0x63f0('0x16')](function(_0x416eb4){return db[_0x63f0('0x66')]['findOne']({'attributes':['id',_0x63f0('0x67'),_0x63f0('0x99'),'passwordHistoryLimit']})[_0x63f0('0x16')](function(_0x48beba){if(_0x48beba[_0x63f0('0x67')])authService[_0x63f0('0x68')](_0x2f7044[_0x63f0('0x61')]['newPassword']);if(!_0x48beba[_0x63f0('0x99')]||!_0x416eb4[_0x63f0('0x9a')])return _0x416eb4;authService[_0x63f0('0x9b')](_0x2f7044[_0x63f0('0x61')][_0x63f0('0x91')],_0x416eb4['previousPasswords'],_0x48beba[_0x63f0('0x9c')]);return _0x416eb4;})['then'](saveUpdates({'password':_0x2f7044[_0x63f0('0x61')][_0x63f0('0x91')],'passwordResetAt':_0x2f7044['user']['id']==_0x2f7044[_0x63f0('0x57')]['id']?moment():null,'previousPasswords':authService[_0x63f0('0x9d')](_0x2f7044[_0x63f0('0x61')][_0x63f0('0x91')],_0x416eb4[_0x63f0('0x9a')])},null));})[_0x63f0('0x16')](respondWithResult(_0x4f44f5,null))['catch'](handleError(_0x4f44f5,null));};exports[_0x63f0('0x9e')]=function(_0x45c84d,_0x5d0b1f){var _0x20d943=_0x45c84d[_0x63f0('0x61')]['channel'];return db['User'][_0x63f0('0x38')]({'where':{'id':_0x45c84d[_0x63f0('0x57')]['id']},'attributes':['id',_0x63f0('0x3b'),_0x63f0('0x37'),_0x63f0('0x9f'),'loginInPause',_0x63f0('0xa0'),_0x63f0('0xa1')]})['then'](handleEntityNotFound(_0x5d0b1f,null))[_0x63f0('0x16')](function(_0x275571){if(_0x275571){if(!utils[_0x63f0('0xa2')](_0x20d943)){throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0xa3'));}return _0x275571[_0x63f0('0xa4')+_[_0x63f0('0xa5')](_0x20d943['toLowerCase']())+_0x63f0('0xa6')](_0x45c84d[_0x63f0('0x61')][_0x63f0('0x64')],{'penalty':_0x45c84d[_0x63f0('0x61')][_0x63f0('0xa7')]||0x0})[_0x63f0('0xa8')](function(_0x5cab28){for(var _0x276272=0x0;_0x276272<_0x45c84d[_0x63f0('0x61')]['ids']['length'];_0x276272+=0x1){var _0x554f9f={'UserId':Number(_0x45c84d[_0x63f0('0x57')]['id'])};_0x554f9f[_[_0x63f0('0xa5')](_0x20d943[_0x63f0('0xa9')]())+_0x63f0('0xaa')]=Number(_0x45c84d[_0x63f0('0x61')][_0x63f0('0x64')][_0x276272]);socket[_0x63f0('0x28')](_0x63f0('0x2d')+_[_0x63f0('0xa5')](_0x20d943['toLowerCase']())+'Queue:save',_0x554f9f);}return _0x5cab28;})[_0x63f0('0x16')](function(){if(_0x20d943==='voice'){return db['VoiceQueue'][_0x63f0('0x4b')]({'where':{'id':_0x45c84d[_0x63f0('0x61')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x53bc0f){var _0x181bee=_0x275571['get']({'plain':!![]});var _0x30fec6=[];if(_0x20d943===_0x63f0('0xab')&&_0x181bee[_0x63f0('0x37')]===_0x63f0('0x2f')&&_0x181bee[_0x63f0('0x9f')]){for(let _0x1c5754=0x0;_0x1c5754<_0x53bc0f['length'];_0x1c5754+=0x1){_0x30fec6['push']({'membername':_0x181bee[_0x63f0('0x3b')],'UserId':_0x181bee['id'],'queue_name':_0x53bc0f[_0x1c5754][_0x63f0('0x3b')],'VoiceQueueId':_0x53bc0f[_0x1c5754]['id'],'interface':_[_0x63f0('0x6a')](_0x181bee[_0x63f0('0xa1')])?util['format'](_0x63f0('0xac'),_0x181bee[_0x63f0('0x3b')]):_0x181bee['interface'],'paused':_0x181bee[_0x63f0('0xa0')]||![],'penalty':_0x45c84d[_0x63f0('0x61')][_0x63f0('0xa7')]||0x0});}return Promise['all'](_0x30fec6['map'](function(_0xbe36d9){return db[_0x63f0('0xad')]['upsert'](_0xbe36d9);}));}return _0x275571;});}})[_0x63f0('0x16')](respondWithStatusCode(_0x5d0b1f,null))[_0x63f0('0x20')](handleError(_0x5d0b1f,null));};exports[_0x63f0('0xae')]=function(_0x8da647,_0x48224c){var _0x124b90,_0x167f8f;return db[_0x63f0('0x3d')]['find']({'where':{'id':_0x8da647[_0x63f0('0x57')]['id']},'attributes':['id',_0x63f0('0x3b'),_0x63f0('0x37')]})[_0x63f0('0x16')](handleEntityNotFound(_0x48224c,null))[_0x63f0('0x16')](function(_0x4a3efa){if(_0x4a3efa){_0x124b90=_0x4a3efa;if(!_0x8da647['query'][_0x63f0('0xaf')]||!utils[_0x63f0('0xa2')](_0x8da647[_0x63f0('0x44')][_0x63f0('0xaf')])){throw new db['Sequelize'][(_0x63f0('0x93'))](_0x63f0('0xa3'));}return _0x4a3efa[_0x63f0('0xb0')+_[_0x63f0('0xa5')](_0x8da647[_0x63f0('0x44')][_0x63f0('0xaf')]['toLowerCase']())+_0x63f0('0xa6')](_0x8da647[_0x63f0('0x44')][_0x63f0('0x64')]);}})[_0x63f0('0x16')](function(_0x41015a){if(_[_0x63f0('0xb1')](_0x8da647[_0x63f0('0x44')][_0x63f0('0x64')])){for(var _0x13e678=0x0;_0x13e678<_0x8da647['query'][_0x63f0('0x64')][_0x63f0('0x5f')];_0x13e678+=0x1){_0x167f8f={'UserId':Number(_0x8da647[_0x63f0('0x57')]['id'])};_0x167f8f[_[_0x63f0('0xa5')](_0x8da647['query']['channel'][_0x63f0('0xa9')]())+_0x63f0('0xaa')]=Number(_0x8da647[_0x63f0('0x44')][_0x63f0('0x64')][_0x13e678]);socket['emit'](_0x63f0('0x2d')+_[_0x63f0('0xa5')](_0x8da647[_0x63f0('0x44')]['channel']['toLowerCase']())+_0x63f0('0xb2'),_0x167f8f);}}else{_0x167f8f={'UserId':Number(_0x8da647[_0x63f0('0x57')]['id'])};_0x167f8f[_[_0x63f0('0xa5')](_0x8da647[_0x63f0('0x44')][_0x63f0('0xaf')][_0x63f0('0xa9')]())+_0x63f0('0xaa')]=Number(_0x8da647['query'][_0x63f0('0x64')]);socket['emit'](_0x63f0('0x2d')+_[_0x63f0('0xa5')](_0x8da647[_0x63f0('0x44')][_0x63f0('0xaf')]['toLowerCase']())+'Queue:remove',_0x167f8f);}return _0x41015a;})['then'](function(){if(_0x8da647[_0x63f0('0x44')][_0x63f0('0xaf')]===_0x63f0('0xab')){return db['UserVoiceQueueRt'][_0x63f0('0x2a')]({'where':{'UserId':_0x8da647[_0x63f0('0x57')]['id'],'VoiceQueueId':_0x8da647['query']['ids']},'individualHooks':!![]})[_0x63f0('0x16')](function(){return _0x124b90;});}return _0x124b90;})[_0x63f0('0x16')](respondWithStatusCode(_0x48224c,null))[_0x63f0('0x20')](handleError(_0x48224c,null));};exports[_0x63f0('0xb3')]=function(_0x5d7186,_0x3d8a2f){_0x5d7186[_0x63f0('0x61')]['userpic']=_0x5d7186[_0x63f0('0xb4')][_0x63f0('0xb5')];return db[_0x63f0('0x3d')][_0x63f0('0x38')]({'where':{'id':_0x5d7186['params']['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x3d8a2f,null))[_0x63f0('0x16')](saveUpdates(_0x5d7186['body'],null))[_0x63f0('0x16')](respondWithResult(_0x3d8a2f,null))[_0x63f0('0x20')](handleError(_0x3d8a2f,null));};exports[_0x63f0('0xb6')]=function(_0x42603f,_0x8829d7){var _0x10dc06=path[_0x63f0('0xb7')](config[_0x63f0('0xb8')],_0x63f0('0xb9'));return db['User'][_0x63f0('0x38')]({'where':{'id':_0x42603f[_0x63f0('0x57')]['id']},'attributes':['id',_0x63f0('0xba')],'raw':!![]})['then'](handleEntityNotFound(_0x8829d7,null))[_0x63f0('0x16')](function(_0x5e376a){if(_0x5e376a){if(_[_0x63f0('0x6a')](_0x5e376a['userpic'])){return _0x8829d7['download'](_0x10dc06);}else{if(!fs['existsSync'](path[_0x63f0('0xb7')](config[_0x63f0('0xb8')],_0x63f0('0xbb'),_0x5e376a['userpic']))){return _0x8829d7[_0x63f0('0xbc')](_0x10dc06);}return _0x8829d7[_0x63f0('0xbc')](path[_0x63f0('0xb7')](config[_0x63f0('0xb8')],_0x63f0('0xbb'),_0x5e376a['userpic']));}}})[_0x63f0('0x20')](handleError(_0x8829d7,null));};exports['getOpenTabs']=function(_0x259c16,_0x57ee9f){return db['User']['find']({'where':{'id':_0x259c16['params']['id']},'attributes':['id']})[_0x63f0('0x16')](handleEntityNotFound(_0x57ee9f,null))[_0x63f0('0x16')](function(_0x3edf83){var _0x183ed1=[];values=_0x3edf83[_0x63f0('0x4f')];_0x183ed1['push'](get_open_tabs(_0x63f0('0x4e'),_0x3edf83['dataValues']));_0x183ed1[_0x63f0('0x4a')](get_open_tabs('sms',_0x3edf83['dataValues']));_0x183ed1[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x53'),_0x3edf83[_0x63f0('0x4f')]));_0x183ed1[_0x63f0('0x4a')](get_open_tabs('whatsapp',_0x3edf83[_0x63f0('0x4f')]));_0x183ed1[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x51'),_0x3edf83[_0x63f0('0x4f')]));_0x183ed1['push'](get_open_tabs(_0x63f0('0x52'),_0x3edf83[_0x63f0('0x4f')]));return Promise[_0x63f0('0x55')](_0x183ed1);})[_0x63f0('0x16')](function(_0x3bccd5){if(_0x3bccd5){var _0x462867=_['map'](values[_0x63f0('0xbd')],function(_0x5f534e){return{'channel':'CHAT','id':_0x5f534e['id'],'createdAt':_0x5f534e[_0x63f0('0xbe')]};});var _0x1ad3d0=_[_0x63f0('0x34')](values[_0x63f0('0xbf')],function(_0x330b0d){return{'channel':'FAX','id':_0x330b0d['id'],'createdAt':_0x330b0d[_0x63f0('0xbe')]};});var _0x19e8ea=_[_0x63f0('0x34')](values[_0x63f0('0xc0')],function(_0x1cc6fa){return{'channel':_0x63f0('0xc1'),'id':_0x1cc6fa['id'],'createdAt':_0x1cc6fa['createdAt']};});var _0x2e5602=_[_0x63f0('0x34')](values[_0x63f0('0xc2')],function(_0x5be25b){return{'channel':_0x63f0('0xc3'),'id':_0x5be25b['id'],'createdAt':_0x5be25b[_0x63f0('0xbe')]};});var _0x16d9df=_[_0x63f0('0x34')](values[_0x63f0('0xc4')],function(_0x254869){return{'channel':_0x63f0('0xc5'),'id':_0x254869['id'],'createdAt':_0x254869[_0x63f0('0xbe')]};});var _0x210445=_[_0x63f0('0x34')](values[_0x63f0('0xc6')],function(_0x406cd2){return{'channel':'WHATSAPP','id':_0x406cd2['id'],'createdAt':_0x406cd2[_0x63f0('0xbe')]};});var _0x4875b2=_[_0x63f0('0xc7')](_0x462867,_0x1ad3d0,_0x19e8ea,_0x2e5602,_0x16d9df,_0x210445);var _0x2c1968={'count':_0x4875b2[_0x63f0('0x5f')],'rows':_0x4875b2};return _0x2c1968;}else return null;})[_0x63f0('0x16')](respondWithResult(_0x57ee9f,null))['catch'](handleError(_0x57ee9f,null));};exports[_0x63f0('0xc8')]=function(_0x5e910c,_0x1341a){var _0x3840a9={};var _0x4f798d={};var _0x70fb47;var _0x4d47e7;return db['User'][_0x63f0('0xc9')]({'where':{'id':_0x5e910c['params']['id']}})['then'](handleEntityNotFound(_0x1341a,null))[_0x63f0('0x16')](function(_0x22a651){if(_0x22a651){_0x70fb47=_0x22a651;_0x4f798d[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db[_0x63f0('0xca')][_0x63f0('0x3e')]);_0x4f798d[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x5e910c[_0x63f0('0x44')]);_0x4f798d[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x4f798d['model'],_0x4f798d[_0x63f0('0x44')]);_0x3840a9[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x4f798d[_0x63f0('0x5d')],qs['fields'](_0x5e910c[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x3840a9[_0x63f0('0x49')]=_0x3840a9[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x3840a9[_0x63f0('0x49')]:_0x4f798d[_0x63f0('0x5d')];_0x3840a9['order']=qs[_0x63f0('0xcb')](_0x5e910c['query'][_0x63f0('0xcb')]);_0x3840a9['where']=qs[_0x63f0('0x5b')](_[_0x63f0('0xcc')](_0x5e910c[_0x63f0('0x44')],_0x4f798d['filters']));if(_0x5e910c[_0x63f0('0x44')][_0x63f0('0x32')]){_0x3840a9[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x3840a9[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x3840a9[_0x63f0('0x49')],function(_0x37818a){var _0x2d5d03={};_0x2d5d03[_0x37818a]={'$like':'%'+_0x5e910c[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x2d5d03;})});}_0x3840a9=_[_0x63f0('0xcd')]({},_0x3840a9,_0x5e910c['options']);return _0x70fb47[_0x63f0('0xc8')](_0x3840a9);}})[_0x63f0('0x16')](function(_0x490807){if(_0x490807){_0x4d47e7=_0x490807['length'];if(_0x5e910c[_0x63f0('0x44')][_0x63f0('0xce')]('includeAll')){_0x3840a9['include']=[{'model':db['CmList'],'as':_0x63f0('0xcf'),'required':![]},{'model':db[_0x63f0('0xd0')],'as':_0x63f0('0xd1'),'attributes':['id',_0x63f0('0x3b'),_0x63f0('0xd2')],'where':_0x5e910c['query'][_0x63f0('0xd3')]?{'id':_0x5e910c[_0x63f0('0x44')]['tag']}:undefined,'required':_0x5e910c[_0x63f0('0x44')]['tag']?!![]:![]}];}if(!_0x5e910c[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x3840a9[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x5e910c['query']['limit']);_0x3840a9[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x5e910c[_0x63f0('0x44')][_0x63f0('0x23')]);}return _0x70fb47[_0x63f0('0xc8')](_0x3840a9);}})['then'](function(_0x58ad63){if(_0x58ad63){return _0x58ad63?{'count':_0x4d47e7,'rows':_0x58ad63}:null;}})[_0x63f0('0x16')](respondWithResult(_0x1341a,null))[_0x63f0('0x20')](handleError(_0x1341a,null));};exports[_0x63f0('0xd5')]=function(_0x452ce7,_0x1c1736){var _0x1a4bc0;var _0x2ca0eb={};var _0x57594c;return db[_0x63f0('0x3d')][_0x63f0('0xc9')]({'where':{'id':_0x452ce7['params']['id']},'attributes':['id',_0x63f0('0x3b'),_0x63f0('0x37')]})[_0x63f0('0x16')](handleEntityNotFound(_0x1c1736,null))[_0x63f0('0x16')](function(_0x96e131){if(!utils[_0x63f0('0xa2')](_0x452ce7[_0x63f0('0x44')]['channel'])){throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))]('Unknown\x20channel');}_0x1a4bc0=_0x96e131;var _0x3c6677={};_0x3c6677[_0x63f0('0x5d')]=_['keys'](db[_[_0x63f0('0xa5')](_0x452ce7[_0x63f0('0x44')][_0x63f0('0xaf')])+'Queue'][_0x63f0('0x3e')]);_0x3c6677['query']=_['keys'](_0x452ce7[_0x63f0('0x44')]);_0x3c6677[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x3c6677[_0x63f0('0x5d')],_0x3c6677[_0x63f0('0x44')]);_0x2ca0eb[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x3c6677[_0x63f0('0x5d')],qs['fields'](_0x452ce7['query'][_0x63f0('0x5e')]));_0x2ca0eb[_0x63f0('0x49')]=_0x2ca0eb['attributes']['length']?_0x2ca0eb['attributes']:_0x3c6677[_0x63f0('0x5d')];_0x2ca0eb[_0x63f0('0xd6')]=qs['sort'](_0x452ce7[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x2ca0eb['where']=qs['filters'](_[_0x63f0('0xcc')](_0x452ce7[_0x63f0('0x44')],_0x3c6677[_0x63f0('0x5b')]));if(_0x452ce7[_0x63f0('0x44')]['filter']){_0x2ca0eb[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x2ca0eb[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x2ca0eb[_0x63f0('0x49')],function(_0x361381){var _0x1f57d8={};_0x1f57d8[_0x361381]={'$like':'%'+_0x452ce7[_0x63f0('0x44')]['filter']+'%'};return _0x1f57d8;})});}_0x2ca0eb=_[_0x63f0('0xcd')]({},_0x2ca0eb,_0x452ce7['options']);switch(_0x1a4bc0[_0x63f0('0x37')]){case'admin':return db[_[_0x63f0('0xa5')](_0x452ce7[_0x63f0('0x44')][_0x63f0('0xaf')])+_0x63f0('0xd7')]['findAll'](_0x2ca0eb);case _0x63f0('0x2d'):case _0x63f0('0x2f'):return _0x1a4bc0[_0x63f0('0x2b')+_[_0x63f0('0xa5')](_0x452ce7['query'][_0x63f0('0xaf')])+_0x63f0('0xa6')](_0x2ca0eb);default:throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0xd8'));}})[_0x63f0('0x16')](function(_0x15fb46){_0x57594c=_0x15fb46[_0x63f0('0x5f')];if(!_0x452ce7[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x2ca0eb['limit']=qs[_0x63f0('0x24')](_0x452ce7[_0x63f0('0x44')][_0x63f0('0x24')]);_0x2ca0eb[_0x63f0('0x23')]=qs['offset'](_0x452ce7['query'][_0x63f0('0x23')]);}switch(_0x1a4bc0[_0x63f0('0x37')]){case'admin':return db[_['capitalize'](_0x452ce7['query'][_0x63f0('0xaf')])+_0x63f0('0xd7')][_0x63f0('0x4b')](_0x2ca0eb);case _0x63f0('0x2d'):case _0x63f0('0x2f'):return _0x1a4bc0[_0x63f0('0x2b')+_[_0x63f0('0xa5')](_0x452ce7['query'][_0x63f0('0xaf')])+'Queues'](_0x2ca0eb);}})['then'](function(_0x525ca7){return{'count':_0x57594c,'rows':_0x525ca7};})[_0x63f0('0x16')](respondWithResult(_0x1c1736,null))[_0x63f0('0x20')](handleError(_0x1c1736,null));};exports[_0x63f0('0xd9')]=function(_0x23b114,_0x582972){var _0x20ac8b={};var _0x2213b4={};var _0x3af06e;var _0x3684b8;return db[_0x63f0('0x3d')][_0x63f0('0xc9')]({'where':{'id':_0x23b114[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x582972,null))[_0x63f0('0x16')](function(_0x17abc6){if(_0x17abc6){_0x3af06e=_0x17abc6;_0x2213b4[_0x63f0('0x5d')]=_['keys'](db[_0x63f0('0xad')][_0x63f0('0x3e')]);_0x2213b4[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x23b114['query']);_0x2213b4[_0x63f0('0x5b')]=_['intersection'](_0x2213b4[_0x63f0('0x5d')],_0x2213b4[_0x63f0('0x44')]);_0x20ac8b[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x2213b4[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x23b114['query'][_0x63f0('0x5e')]));_0x20ac8b[_0x63f0('0x49')]=_0x20ac8b[_0x63f0('0x49')]['length']?_0x20ac8b['attributes']:_0x2213b4['model'];_0x20ac8b[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x23b114['query'][_0x63f0('0xcb')]);_0x20ac8b[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_[_0x63f0('0xcc')](_0x23b114['query'],_0x2213b4[_0x63f0('0x5b')]));if(_0x23b114[_0x63f0('0x44')][_0x63f0('0x32')]){_0x20ac8b['where']=_[_0x63f0('0xcd')](_0x20ac8b[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x20ac8b[_0x63f0('0x49')],function(_0x4ec7a){var _0x2cf2b2={};_0x2cf2b2[_0x4ec7a]={'$like':'%'+_0x23b114[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x2cf2b2;})});}_0x20ac8b=_[_0x63f0('0xcd')]({},_0x20ac8b,_0x23b114[_0x63f0('0xda')]);return _0x3af06e[_0x63f0('0xd9')](_0x20ac8b);}})[_0x63f0('0x16')](function(_0x277f57){if(_0x277f57){_0x3684b8=_0x277f57[_0x63f0('0x5f')];if(!_0x23b114[_0x63f0('0x44')]['hasOwnProperty'](_0x63f0('0xd4'))){_0x20ac8b[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x23b114['query'][_0x63f0('0x24')]);_0x20ac8b['offset']=qs[_0x63f0('0x23')](_0x23b114['query'][_0x63f0('0x23')]);}return _0x3af06e['getVoiceQueuesRt'](_0x20ac8b);}})[_0x63f0('0x16')](function(_0x86a317){if(_0x86a317){return _0x86a317?{'count':_0x3684b8,'rows':_0x86a317}:null;}})['then'](respondWithResult(_0x582972,null))[_0x63f0('0x20')](handleError(_0x582972,null));};exports[_0x63f0('0xdb')]=function(_0x32b235,_0x1031c7){var _0x200075={};var _0x4b5d11={};var _0x566a5c;var _0x7ed43b;return db['User']['findOne']({'where':{'id':_0x32b235[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x1031c7,null))[_0x63f0('0x16')](function(_0x3a8c2b){if(_0x3a8c2b){_0x566a5c=_0x3a8c2b;_0x4b5d11['model']=_[_0x63f0('0x59')](db[_0x63f0('0xdc')][_0x63f0('0x3e')]);_0x4b5d11[_0x63f0('0x44')]=_['keys'](_0x32b235[_0x63f0('0x44')]);_0x4b5d11[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x4b5d11[_0x63f0('0x5d')],_0x4b5d11[_0x63f0('0x44')]);_0x200075['attributes']=_[_0x63f0('0x5c')](_0x4b5d11[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x32b235[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x200075[_0x63f0('0x49')]=_0x200075[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x200075[_0x63f0('0x49')]:_0x4b5d11[_0x63f0('0x5d')];_0x200075['order']=qs[_0x63f0('0xcb')](_0x32b235[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x200075['where']=qs[_0x63f0('0x5b')](_['pick'](_0x32b235[_0x63f0('0x44')],_0x4b5d11['filters']));if(_0x32b235[_0x63f0('0x44')][_0x63f0('0x32')]){_0x200075[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x200075[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x200075[_0x63f0('0x49')],function(_0x392bde){var _0x1a0bdf={};_0x1a0bdf[_0x392bde]={'$like':'%'+_0x32b235['query'][_0x63f0('0x32')]+'%'};return _0x1a0bdf;})});}_0x200075=_[_0x63f0('0xcd')]({},_0x200075,_0x32b235[_0x63f0('0xda')]);return _0x566a5c[_0x63f0('0xdb')](_0x200075);}})[_0x63f0('0x16')](function(_0x10d222){if(_0x10d222){_0x7ed43b=_0x10d222[_0x63f0('0x5f')];if(!_0x32b235[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x200075[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x32b235[_0x63f0('0x44')][_0x63f0('0x24')]);_0x200075['offset']=qs[_0x63f0('0x23')](_0x32b235[_0x63f0('0x44')][_0x63f0('0x23')]);}return _0x566a5c[_0x63f0('0xdb')](_0x200075);}})['then'](function(_0x434037){if(_0x434037){return _0x434037?{'count':_0x7ed43b,'rows':_0x434037}:null;}})['then'](respondWithResult(_0x1031c7,null))['catch'](handleError(_0x1031c7,null));};exports[_0x63f0('0xdd')]=function(_0x24bed6,_0x201928){var _0x2448b3={'raw':!![],'where':{}};var _0x6fa2f8={};var _0x29bbdc={'count':0x0,'rows':[]};return db[_0x63f0('0x3d')]['findOne']({'where':{'id':_0x24bed6['params']['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x201928,null))[_0x63f0('0x16')](function(_0x3017a9){if(_0x3017a9){_0x6fa2f8[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db['VoiceRecording'][_0x63f0('0x3e')]);_0x6fa2f8['query']=_[_0x63f0('0x59')](_0x24bed6['query']);_0x6fa2f8['filters']=_[_0x63f0('0x5c')](_0x6fa2f8[_0x63f0('0x5d')],_0x6fa2f8[_0x63f0('0x44')]);_0x2448b3[_0x63f0('0x49')]=_['intersection'](_0x6fa2f8[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x24bed6[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x2448b3[_0x63f0('0x49')]=_0x2448b3[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x2448b3[_0x63f0('0x49')]:_0x6fa2f8[_0x63f0('0x5d')];if(!_0x24bed6['query']['hasOwnProperty'](_0x63f0('0xd4'))){_0x2448b3[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x24bed6[_0x63f0('0x44')][_0x63f0('0x24')]);_0x2448b3['offset']=qs['offset'](_0x24bed6[_0x63f0('0x44')][_0x63f0('0x23')]);}_0x2448b3[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x24bed6[_0x63f0('0x44')]['sort']);_0x2448b3['where']=qs[_0x63f0('0x5b')](_['pick'](_0x24bed6['query'],_0x6fa2f8[_0x63f0('0x5b')]));_0x2448b3[_0x63f0('0x43')][_0x63f0('0xde')]=_0x3017a9['id'];if(_0x24bed6[_0x63f0('0x44')][_0x63f0('0x32')]){_0x2448b3[_0x63f0('0x43')]=_['merge'](_0x2448b3[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x2448b3['attributes'],function(_0x564450){var _0x5b8165={};_0x5b8165[_0x564450]={'$like':'%'+_0x24bed6[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x5b8165;})});}_0x2448b3=_[_0x63f0('0xcd')]({},_0x2448b3,_0x24bed6['options']);return db['VoiceRecording'][_0x63f0('0x25')]({'where':_0x2448b3['where']})[_0x63f0('0x16')](function(_0x159b2c){_0x29bbdc['count']=_0x159b2c;if(_0x24bed6['query'][_0x63f0('0x45')]){_0x2448b3[_0x63f0('0x46')]=[{'all':!![]}];}return db[_0x63f0('0xdf')][_0x63f0('0x4b')](_0x2448b3);})['then'](function(_0x56149e){_0x29bbdc['rows']=_0x56149e;return _0x29bbdc;});}})[_0x63f0('0x16')](respondWithFilteredResult(_0x201928,_0x2448b3))[_0x63f0('0x20')](handleError(_0x201928,null));};exports[_0x63f0('0xe0')]=function(_0x483a02,_0x343c40){var _0x31d07b={'raw':!![],'where':{}};var _0x5524a3={};var _0x22c542={'count':0x0,'rows':[]};return db[_0x63f0('0x3d')][_0x63f0('0xc9')]({'where':{'id':_0x483a02[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x343c40,null))[_0x63f0('0x16')](function(_0x46ccd0){if(_0x46ccd0){_0x5524a3[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db[_0x63f0('0xe1')]['rawAttributes']);_0x5524a3[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x483a02['query']);_0x5524a3[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x5524a3[_0x63f0('0x5d')],_0x5524a3[_0x63f0('0x44')]);_0x31d07b[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x5524a3[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x483a02[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x31d07b[_0x63f0('0x49')]=_0x31d07b['attributes'][_0x63f0('0x5f')]?_0x31d07b[_0x63f0('0x49')]:_0x5524a3[_0x63f0('0x5d')];if(!_0x483a02[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x31d07b[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x483a02[_0x63f0('0x44')][_0x63f0('0x24')]);_0x31d07b[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x483a02[_0x63f0('0x44')][_0x63f0('0x23')]);}_0x31d07b[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x483a02[_0x63f0('0x44')]['sort']);_0x31d07b[_0x63f0('0x43')]=qs['filters'](_[_0x63f0('0xcc')](_0x483a02['query'],_0x5524a3[_0x63f0('0x5b')]));_0x31d07b[_0x63f0('0x43')][_0x63f0('0xde')]=_0x46ccd0['id'];if(_0x483a02['query'][_0x63f0('0x32')]){_0x31d07b[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x31d07b[_0x63f0('0x43')],{'$or':_['map'](_0x31d07b['attributes'],function(_0x130786){var _0x2b6893={};_0x2b6893[_0x130786]={'$like':'%'+_0x483a02[_0x63f0('0x44')]['filter']+'%'};return _0x2b6893;})});}_0x31d07b=_[_0x63f0('0xcd')]({},_0x31d07b,_0x483a02[_0x63f0('0xda')]);return db[_0x63f0('0xe1')][_0x63f0('0x25')]({'where':_0x31d07b['where']})['then'](function(_0x32aac7){_0x22c542[_0x63f0('0x25')]=_0x32aac7;if(_0x483a02[_0x63f0('0x44')]['includeAll']){_0x31d07b['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x63f0('0x4b')](_0x31d07b);})[_0x63f0('0x16')](function(_0x1db77e){_0x22c542[_0x63f0('0x4d')]=_0x1db77e;return _0x22c542;});}})[_0x63f0('0x16')](respondWithFilteredResult(_0x343c40,_0x31d07b))[_0x63f0('0x20')](handleError(_0x343c40,null));};exports[_0x63f0('0xe2')]=function(_0x97d009,_0x4a2d52){var _0x5d2f2f={};var _0x40d35e={};var _0x4a4adc;var _0x46b1dc;return db['User'][_0x63f0('0xc9')]({'where':{'id':_0x97d009[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x4a2d52,null))[_0x63f0('0x16')](function(_0x4836ae){if(_0x4836ae){_0x4a4adc=_0x4836ae;_0x40d35e[_0x63f0('0x5d')]=_['keys'](db['ChatInteraction'][_0x63f0('0x3e')]);_0x40d35e['query']=_[_0x63f0('0x59')](_0x97d009['query']);_0x40d35e[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x40d35e['model'],_0x40d35e[_0x63f0('0x44')]);_0x5d2f2f[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x40d35e[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x97d009[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x5d2f2f[_0x63f0('0x49')]=_0x5d2f2f[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x5d2f2f[_0x63f0('0x49')]:_0x40d35e['model'];_0x5d2f2f[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x97d009[_0x63f0('0x44')]['sort']);_0x5d2f2f[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_['pick'](_0x97d009['query'],_0x40d35e[_0x63f0('0x5b')]));if(_0x97d009[_0x63f0('0x44')][_0x63f0('0x32')]){_0x5d2f2f[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x5d2f2f[_0x63f0('0x43')],{'$or':_['map'](_0x5d2f2f[_0x63f0('0x49')],function(_0x422194){var _0x3b4741={};_0x3b4741[_0x422194]={'$like':'%'+_0x97d009[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x3b4741;})});}_0x5d2f2f=_[_0x63f0('0xcd')]({},_0x5d2f2f,_0x97d009['options']);return _0x4a4adc[_0x63f0('0xe2')](_0x5d2f2f);}})['then'](function(_0x1435b8){if(_0x1435b8){_0x46b1dc=_0x1435b8[_0x63f0('0x5f')];if(!_0x97d009[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x5d2f2f[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x97d009[_0x63f0('0x44')][_0x63f0('0x24')]);_0x5d2f2f['offset']=qs[_0x63f0('0x23')](_0x97d009[_0x63f0('0x44')]['offset']);}return _0x4a4adc[_0x63f0('0xe2')](_0x5d2f2f);}})[_0x63f0('0x16')](function(_0xf04285){if(_0xf04285){return _0xf04285?{'count':_0x46b1dc,'rows':_0xf04285}:null;}})['then'](respondWithResult(_0x4a2d52,null))[_0x63f0('0x20')](handleError(_0x4a2d52,null));};exports[_0x63f0('0xe3')]=function(_0x5b8475,_0x15ae34){var _0x19f1c9={};var _0x1d57f3={};var _0x1c5795;var _0x39d3d9;return db['User'][_0x63f0('0xc9')]({'where':{'id':_0x5b8475[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x15ae34,null))[_0x63f0('0x16')](function(_0x402465){if(_0x402465){_0x1c5795=_0x402465;_0x1d57f3[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db[_0x63f0('0xe4')][_0x63f0('0x3e')]);_0x1d57f3['query']=_['keys'](_0x5b8475[_0x63f0('0x44')]);_0x1d57f3[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x1d57f3[_0x63f0('0x5d')],_0x1d57f3[_0x63f0('0x44')]);_0x19f1c9[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x1d57f3[_0x63f0('0x5d')],qs['fields'](_0x5b8475[_0x63f0('0x44')]['fields']));_0x19f1c9[_0x63f0('0x49')]=_0x19f1c9[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x19f1c9[_0x63f0('0x49')]:_0x1d57f3[_0x63f0('0x5d')];_0x19f1c9['order']=qs[_0x63f0('0xcb')](_0x5b8475[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x19f1c9[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_['pick'](_0x5b8475[_0x63f0('0x44')],_0x1d57f3[_0x63f0('0x5b')]));if(_0x5b8475[_0x63f0('0x44')][_0x63f0('0x32')]){_0x19f1c9[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x19f1c9[_0x63f0('0x43')],{'$or':_['map'](_0x19f1c9[_0x63f0('0x49')],function(_0x2c829c){var _0x1d58de={};_0x1d58de[_0x2c829c]={'$like':'%'+_0x5b8475[_0x63f0('0x44')]['filter']+'%'};return _0x1d58de;})});}_0x19f1c9=_[_0x63f0('0xcd')]({},_0x19f1c9,_0x5b8475[_0x63f0('0xda')]);return _0x1c5795[_0x63f0('0xe3')](_0x19f1c9);}})[_0x63f0('0x16')](function(_0x2c9e9c){if(_0x2c9e9c){_0x39d3d9=_0x2c9e9c[_0x63f0('0x5f')];if(!_0x5b8475[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x19f1c9[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x5b8475[_0x63f0('0x44')]['limit']);_0x19f1c9[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x5b8475[_0x63f0('0x44')][_0x63f0('0x23')]);}return _0x1c5795[_0x63f0('0xe3')](_0x19f1c9);}})['then'](function(_0x314264){if(_0x314264){return _0x314264?{'count':_0x39d3d9,'rows':_0x314264}:null;}})[_0x63f0('0x16')](respondWithResult(_0x15ae34,null))['catch'](handleError(_0x15ae34,null));};exports[_0x63f0('0xe5')]=function(_0x5a1b9f,_0x3a4d77){var _0x3df7b2={'raw':!![],'where':{}};var _0x2c9113={};var _0x560c07={'count':0x0,'rows':[]};return db[_0x63f0('0x3d')][_0x63f0('0xc9')]({'where':{'id':_0x5a1b9f[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x3a4d77,null))[_0x63f0('0x16')](function(_0x43e370){if(_0x43e370){_0x2c9113[_0x63f0('0x5d')]=_['keys'](db['MailInteraction'][_0x63f0('0x3e')]);_0x2c9113['query']=_['keys'](_0x5a1b9f[_0x63f0('0x44')]);_0x2c9113[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x2c9113[_0x63f0('0x5d')],_0x2c9113['query']);_0x3df7b2[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x2c9113[_0x63f0('0x5d')],qs['fields'](_0x5a1b9f[_0x63f0('0x44')]['fields']));_0x3df7b2[_0x63f0('0x49')]=_0x3df7b2[_0x63f0('0x49')]['length']?_0x3df7b2[_0x63f0('0x49')]:_0x2c9113[_0x63f0('0x5d')];if(!_0x5a1b9f[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x3df7b2[_0x63f0('0x24')]=qs['limit'](_0x5a1b9f['query'][_0x63f0('0x24')]);_0x3df7b2[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x5a1b9f[_0x63f0('0x44')][_0x63f0('0x23')]);}_0x3df7b2['order']=qs[_0x63f0('0xcb')](_0x5a1b9f[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x3df7b2[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_[_0x63f0('0xcc')](_0x5a1b9f[_0x63f0('0x44')],_0x2c9113[_0x63f0('0x5b')]));_0x3df7b2['where']['UserId']=_0x43e370['id'];if(_0x5a1b9f[_0x63f0('0x44')]['filter']){_0x3df7b2['where']=_[_0x63f0('0xcd')](_0x3df7b2[_0x63f0('0x43')],{'$or':_['map'](_0x3df7b2[_0x63f0('0x49')],function(_0x2d628e){var _0xeb8c1d={};_0xeb8c1d[_0x2d628e]={'$like':'%'+_0x5a1b9f[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0xeb8c1d;})});}_0x3df7b2=_[_0x63f0('0xcd')]({},_0x3df7b2,_0x5a1b9f[_0x63f0('0xda')]);return db[_0x63f0('0xe6')][_0x63f0('0x25')]({'where':_0x3df7b2[_0x63f0('0x43')]})[_0x63f0('0x16')](function(_0x4ae4b7){_0x560c07[_0x63f0('0x25')]=_0x4ae4b7;if(_0x5a1b9f['query']['includeAll']){_0x3df7b2[_0x63f0('0x46')]=[{'all':!![]}];}return db['MailInteraction'][_0x63f0('0x4b')](_0x3df7b2);})[_0x63f0('0x16')](function(_0x21da19){_0x560c07[_0x63f0('0x4d')]=_0x21da19;return _0x560c07;});}})[_0x63f0('0x16')](respondWithFilteredResult(_0x3a4d77,_0x3df7b2))['catch'](handleError(_0x3a4d77,null));};exports[_0x63f0('0xe7')]=function(_0x3cf960,_0x84ba41){var _0x4eb36e={};var _0x9f9144={};var _0x5d8b5d;var _0x169c4b;return db[_0x63f0('0x3d')][_0x63f0('0xc9')]({'where':{'id':_0x3cf960['params']['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x84ba41,null))[_0x63f0('0x16')](function(_0x5ea80b){if(_0x5ea80b){_0x5d8b5d=_0x5ea80b;_0x9f9144[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db[_0x63f0('0xe8')][_0x63f0('0x3e')]);_0x9f9144[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x3cf960[_0x63f0('0x44')]);_0x9f9144['filters']=_[_0x63f0('0x5c')](_0x9f9144[_0x63f0('0x5d')],_0x9f9144[_0x63f0('0x44')]);_0x4eb36e[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x9f9144[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x3cf960[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x4eb36e[_0x63f0('0x49')]=_0x4eb36e[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x4eb36e[_0x63f0('0x49')]:_0x9f9144[_0x63f0('0x5d')];_0x4eb36e[_0x63f0('0xd6')]=qs['sort'](_0x3cf960[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x4eb36e[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_['pick'](_0x3cf960[_0x63f0('0x44')],_0x9f9144[_0x63f0('0x5b')]));if(_0x3cf960[_0x63f0('0x44')]['filter']){_0x4eb36e[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x4eb36e[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x4eb36e[_0x63f0('0x49')],function(_0x1a83bd){var _0x61074c={};_0x61074c[_0x1a83bd]={'$like':'%'+_0x3cf960[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x61074c;})});}_0x4eb36e=_[_0x63f0('0xcd')]({},_0x4eb36e,_0x3cf960[_0x63f0('0xda')]);return _0x5d8b5d['getSmsInteractions'](_0x4eb36e);}})['then'](function(_0x3e88d9){if(_0x3e88d9){_0x169c4b=_0x3e88d9[_0x63f0('0x5f')];if(!_0x3cf960[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x4eb36e[_0x63f0('0x24')]=qs['limit'](_0x3cf960[_0x63f0('0x44')][_0x63f0('0x24')]);_0x4eb36e[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x3cf960[_0x63f0('0x44')][_0x63f0('0x23')]);}return _0x5d8b5d[_0x63f0('0xe7')](_0x4eb36e);}})[_0x63f0('0x16')](function(_0x52f1fa){if(_0x52f1fa){return _0x52f1fa?{'count':_0x169c4b,'rows':_0x52f1fa}:null;}})['then'](respondWithResult(_0x84ba41,null))[_0x63f0('0x20')](handleError(_0x84ba41,null));};exports[_0x63f0('0xe9')]=function(_0x551e05,_0x5e73a6){var _0xde57b1={};var _0xdc07fa={};var _0x28eea9;var _0x1eb7e4;return db[_0x63f0('0x3d')]['findOne']({'where':{'id':_0x551e05[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x5e73a6,null))[_0x63f0('0x16')](function(_0x775bcd){if(_0x775bcd){_0x28eea9=_0x775bcd;_0xdc07fa[_0x63f0('0x5d')]=_['keys'](db['FaxInteraction'][_0x63f0('0x3e')]);_0xdc07fa[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x551e05[_0x63f0('0x44')]);_0xdc07fa[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0xdc07fa[_0x63f0('0x5d')],_0xdc07fa[_0x63f0('0x44')]);_0xde57b1['attributes']=_[_0x63f0('0x5c')](_0xdc07fa[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x551e05['query'][_0x63f0('0x5e')]));_0xde57b1[_0x63f0('0x49')]=_0xde57b1[_0x63f0('0x49')][_0x63f0('0x5f')]?_0xde57b1[_0x63f0('0x49')]:_0xdc07fa[_0x63f0('0x5d')];_0xde57b1[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x551e05[_0x63f0('0x44')][_0x63f0('0xcb')]);_0xde57b1['where']=qs['filters'](_[_0x63f0('0xcc')](_0x551e05['query'],_0xdc07fa[_0x63f0('0x5b')]));if(_0x551e05[_0x63f0('0x44')]['filter']){_0xde57b1['where']=_[_0x63f0('0xcd')](_0xde57b1[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0xde57b1[_0x63f0('0x49')],function(_0x4aa044){var _0x4eadcf={};_0x4eadcf[_0x4aa044]={'$like':'%'+_0x551e05[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x4eadcf;})});}_0xde57b1=_[_0x63f0('0xcd')]({},_0xde57b1,_0x551e05[_0x63f0('0xda')]);return _0x28eea9[_0x63f0('0xe9')](_0xde57b1);}})[_0x63f0('0x16')](function(_0x3f0d26){if(_0x3f0d26){_0x1eb7e4=_0x3f0d26['length'];if(!_0x551e05[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0xde57b1[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x551e05['query'][_0x63f0('0x24')]);_0xde57b1[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x551e05['query'][_0x63f0('0x23')]);}return _0x28eea9[_0x63f0('0xe9')](_0xde57b1);}})[_0x63f0('0x16')](function(_0x210c9f){if(_0x210c9f){return _0x210c9f?{'count':_0x1eb7e4,'rows':_0x210c9f}:null;}})[_0x63f0('0x16')](respondWithResult(_0x5e73a6,null))[_0x63f0('0x20')](handleError(_0x5e73a6,null));};exports['getWhatsappInteractions']=function(_0x3bbd6a,_0xf80719){var _0x311241={};var _0x50592a={};var _0x18fe6c;var _0x22053a;return db['User'][_0x63f0('0xc9')]({'where':{'id':_0x3bbd6a['params']['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0xf80719,null))[_0x63f0('0x16')](function(_0x42b66d){if(_0x42b66d){_0x18fe6c=_0x42b66d;_0x50592a[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db['WhatsappInteraction'][_0x63f0('0x3e')]);_0x50592a[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x3bbd6a[_0x63f0('0x44')]);_0x50592a['filters']=_[_0x63f0('0x5c')](_0x50592a[_0x63f0('0x5d')],_0x50592a[_0x63f0('0x44')]);_0x311241['attributes']=_[_0x63f0('0x5c')](_0x50592a[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x3bbd6a[_0x63f0('0x44')]['fields']));_0x311241['attributes']=_0x311241[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x311241['attributes']:_0x50592a[_0x63f0('0x5d')];_0x311241[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x3bbd6a[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x311241[_0x63f0('0x43')]=qs['filters'](_[_0x63f0('0xcc')](_0x3bbd6a['query'],_0x50592a['filters']));if(_0x3bbd6a[_0x63f0('0x44')][_0x63f0('0x32')]){_0x311241['where']=_[_0x63f0('0xcd')](_0x311241[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x311241[_0x63f0('0x49')],function(_0x2e74c8){var _0x11a322={};_0x11a322[_0x2e74c8]={'$like':'%'+_0x3bbd6a[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x11a322;})});}_0x311241=_[_0x63f0('0xcd')]({},_0x311241,_0x3bbd6a[_0x63f0('0xda')]);return _0x18fe6c[_0x63f0('0xea')](_0x311241);}})[_0x63f0('0x16')](function(_0x3d8203){if(_0x3d8203){_0x22053a=_0x3d8203[_0x63f0('0x5f')];if(!_0x3bbd6a['query']['hasOwnProperty']('nolimit')){_0x311241['limit']=qs['limit'](_0x3bbd6a[_0x63f0('0x44')][_0x63f0('0x24')]);_0x311241[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x3bbd6a[_0x63f0('0x44')][_0x63f0('0x23')]);}return _0x18fe6c[_0x63f0('0xea')](_0x311241);}})[_0x63f0('0x16')](function(_0x48775f){if(_0x48775f){return _0x48775f?{'count':_0x22053a,'rows':_0x48775f}:null;}})[_0x63f0('0x16')](respondWithResult(_0xf80719,null))[_0x63f0('0x20')](handleError(_0xf80719,null));};exports[_0x63f0('0xeb')]=function(_0x19e5ed,_0xefc0f5,_0x115229){var _0x43abe8;var _0x2daabd;var _0x5e0bc6;var _0x552e96=!_[_0x63f0('0x6a')](_0x19e5ed[_0x63f0('0x57')]['id'])?_0x19e5ed['params']['id']:!_[_0x63f0('0x6a')](_0x19e5ed[_0x63f0('0x2d')]['id'])?_0x19e5ed[_0x63f0('0x2d')]['id']:null;return db[_0x63f0('0x3d')][_0x63f0('0x38')]({'where':{'id':_0x552e96,'role':{'$or':['admin','user',_0x63f0('0x2f')]}},'attributes':['id',_0x63f0('0x3b'),_0x63f0('0xec'),_0x63f0('0xed'),_0x63f0('0x37'),_0x63f0('0x65'),_0x63f0('0xee')]})[_0x63f0('0x16')](function(_0x10df13){if(_0x10df13){if(_0x10df13['role']===_0x63f0('0x2f')){_0x43abe8=_0x10df13;if(_0x19e5ed[_0x63f0('0x61')][_0x63f0('0xa1')]){_0x5e0bc6=util['format']('LOCAL/%s@from-sip/n',_0x43abe8[_0x19e5ed['body'][_0x63f0('0xa1')]]);}else if(_0x19e5ed['body'][_0x63f0('0xef')]){_0x5e0bc6=util[_0x63f0('0xf0')](_0x63f0('0xac'),_0x19e5ed[_0x63f0('0x61')][_0x63f0('0xef')]);}else{_0x5e0bc6=util[_0x63f0('0xf0')](_0x63f0('0xac'),_0x43abe8['name']);}socket['to'](util[_0x63f0('0xf0')](_0x63f0('0xf1'),_0x43abe8[_0x63f0('0x3b')]))[_0x63f0('0x28')](_0x63f0('0xf2'),{'user':{'id':_0x43abe8['id'],'name':_0x43abe8[_0x63f0('0x3b')]},'ip':_0x19e5ed[_0x63f0('0xf3')][_0x63f0('0xf4')]||_0x19e5ed[_0x63f0('0xf5')][_0x63f0('0xf6')]||_0x19e5ed[_0x63f0('0xf7')][_0x63f0('0xf6')]||_0x19e5ed[_0x63f0('0xf5')][_0x63f0('0xf7')]['remoteAddress']});return db[_0x63f0('0xad')][_0x63f0('0x2a')]({'where':{'membername':_0x43abe8[_0x63f0('0x3b')]},'individualHooks':!![]});}}else{throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0xf8'));}})['then'](function(){if(_0x43abe8){return _0x43abe8[_0x63f0('0xf9')]({'raw':!![]});}})[_0x63f0('0x16')](function(_0x50d5b6){if(_0x43abe8){if(_0x50d5b6){_0x2daabd=_0x50d5b6;if(_0x2daabd['length']){var _0xd264d=_0x2daabd[_0x63f0('0x34')](function(_0x1eff6c){var _0x836706={'membername':_0x43abe8[_0x63f0('0x3b')],'UserId':_0x43abe8['id'],'queue_name':_0x1eff6c[_0x63f0('0x3b')],'VoiceQueueId':_0x1eff6c['id'],'interface':_0x5e0bc6,'paused':_0x43abe8[_0x63f0('0xee')]||![],'penalty':_0x1eff6c[_0x63f0('0xfa')]||0x0};return db[_0x63f0('0xad')][_0x63f0('0xfb')](_0x836706);});return Promise[_0x63f0('0x55')](_0xd264d);}}}})[_0x63f0('0x16')](function(){if(_0x43abe8){return db[_0x63f0('0xfc')][_0x63f0('0x4b')]({'where':{'membername':_0x43abe8[_0x63f0('0x3b')],'exitAt':null}});}})[_0x63f0('0x16')](function(_0x45410c){if(_0x43abe8){var _0x1b51fd=[];_0x45410c[_0x63f0('0xfd')](function(_0xc4680){_0x1b51fd['push'](_0xc4680[_0x63f0('0x27')]({'exitAt':moment()[_0x63f0('0xf0')](_0x63f0('0xfe'))}));});return Promise['all'](_0x1b51fd);}})['then'](function(){if(_0x43abe8){var _0x20ab12=[];var _0x3518b7=[];var _0x27851c=utils[_0x63f0('0xff')]();var _0x2324cc={'membername':_0x43abe8[_0x63f0('0x3b')],'interface':_0x5e0bc6,'enterAt':moment()[_0x63f0('0xf0')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x43abe8['role'],'internal':_0x43abe8[_0x63f0('0x65')]};_0x27851c[_0x63f0('0xfd')](function(_0x2e3461){_0x20ab12['push'](_[_0x63f0('0xcd')]({'channel':_0x2e3461,'type':_0x63f0('0x100'),'data1':_0x19e5ed[_0x63f0('0x61')]['device'],'data2':_0x5e0bc6},_0x2324cc));if(_0x43abe8[_0x63f0('0xee')]){_0x3518b7[_0x63f0('0x4a')](_[_0x63f0('0xcd')]({'channel':_0x2e3461,'type':'PAUSE','data1':_0x63f0('0x101')},_0x2324cc));}});return db['MemberReport'][_0x63f0('0x8a')](_0x20ab12['concat'](_0x3518b7),{'individualHooks':!![]});}})[_0x63f0('0x16')](function(){if(_0x43abe8){return _0x43abe8[_0x63f0('0x27')]({'online':!![],'lastLoginAt':moment()[_0x63f0('0xf0')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x43abe8[_0x63f0('0xee')]||![],'mailPause':_0x43abe8['loginInPause']||![],'chatPause':_0x43abe8[_0x63f0('0xee')]||![],'faxPause':_0x43abe8[_0x63f0('0xee')]||![],'smsPause':_0x43abe8[_0x63f0('0xee')]||![],'openchannelPause':_0x43abe8['loginInPause']||![],'whatsappPause':_0x43abe8['loginInPause']||![],'pauseType':_0x43abe8[_0x63f0('0xee')]?'LOGININPAUSE':null,'interface':_0x5e0bc6,'lastPauseAt':moment()[_0x63f0('0xf0')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0xa1f89){if(_0x19e5ed[_0x63f0('0x102')]){return _0x115229();}else{return Promise[_0x63f0('0x103')](_0xa1f89)[_0x63f0('0x16')](respondWithResult(_0xefc0f5,null));}})[_0x63f0('0x20')](handleError(_0xefc0f5,null));};exports[_0x63f0('0x104')]=function(_0x11b3d5,_0x5758b9){var _0x3267b9;return db['User'][_0x63f0('0x38')]({'where':{'id':_0x11b3d5[_0x63f0('0x57')]['id'],'role':_0x63f0('0x2f')},'attributes':['id','name',_0x63f0('0x37')]})[_0x63f0('0x16')](handleEntityNotFound(_0x5758b9,null))[_0x63f0('0x16')](function(_0x189565){if(_0x189565){_0x3267b9=_0x189565;return db[_0x63f0('0xad')][_0x63f0('0x2a')]({'where':{'membername':_0x3267b9[_0x63f0('0x3b')]},'individualHooks':!![]});}})[_0x63f0('0x16')](function(){return db['MemberReport'][_0x63f0('0x4b')]({'where':{'membername':_0x3267b9[_0x63f0('0x3b')],'exitAt':null}});})['then'](function(_0x588ddb){var _0x304c55=[];_0x588ddb[_0x63f0('0xfd')](function(_0x15d223){_0x304c55[_0x63f0('0x4a')](_0x15d223[_0x63f0('0x27')]({'exitAt':moment()[_0x63f0('0xf0')](_0x63f0('0xfe'))}));});return Promise[_0x63f0('0x55')](_0x304c55);})[_0x63f0('0x16')](function(){return _0x3267b9[_0x63f0('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x63f0('0x16')](respondWithResult(_0x5758b9,null))[_0x63f0('0x20')](handleError(_0x5758b9,null));};exports[_0x63f0('0x105')]=function(_0x187acd,_0x4d6860){var _0x19972e;return db[_0x63f0('0xad')][_0x63f0('0x27')]({'paused':0x1},{'where':{'UserId':_0x187acd[_0x63f0('0x57')]['id']},'individualHooks':!![]})[_0x63f0('0x16')](function(){return db[_0x63f0('0x3d')][_0x63f0('0x38')]({'where':{'id':_0x187acd[_0x63f0('0x57')]['id'],'role':_0x63f0('0x2f')},'attributes':['id',_0x63f0('0x3b'),_0x63f0('0x37'),'internal',_0x63f0('0xa1'),_0x63f0('0x9f')]});})[_0x63f0('0x16')](handleEntityNotFound(_0x4d6860,null))[_0x63f0('0x16')](function(_0x2faffe){if(_0x2faffe){_0x19972e=_0x2faffe;return respondWithRpcPromise(_0x63f0('0x106'),'pause',{'id':_0x19972e['id'],'name':_0x19972e[_0x63f0('0x3b')],'pause':!![]});}})[_0x63f0('0x16')](function(){if(_0x19972e){return db[_0x63f0('0xfc')][_0x63f0('0x4b')]({'where':{'membername':_0x19972e[_0x63f0('0x3b')],'type':'PAUSE','exitAt':null}});}})[_0x63f0('0x16')](function(_0x46b13c){if(_0x46b13c[_0x63f0('0x5f')]){var _0x50c86d=moment()['format'](_0x63f0('0xfe'));for(var _0x553b5c=0x0,_0x4cc9eb=_0x46b13c['length'];_0x553b5c<_0x4cc9eb;_0x553b5c++){_0x46b13c[_0x553b5c][_0x63f0('0x107')]({'exitAt':_0x50c86d});}}})[_0x63f0('0x16')](function(){var _0x1a31f7=[];var _0xbf2da=utils[_0x63f0('0xff')]();_0xbf2da[_0x63f0('0xfd')](function(_0x4460a9){_0x1a31f7[_0x63f0('0x4a')]({'channel':_0x4460a9,'membername':_0x19972e[_0x63f0('0x3b')],'interface':_[_0x63f0('0x6a')](_0x19972e[_0x63f0('0xa1')])?util['format'](_0x63f0('0xac'),_0x19972e['name']):_0x19972e[_0x63f0('0xa1')],'type':_0x63f0('0x108'),'enterAt':moment()[_0x63f0('0xf0')](_0x63f0('0xfe')),'data1':_0x187acd[_0x63f0('0x61')][_0x63f0('0x40')]||'DEFAULT\x20PAUSE','role':_0x19972e[_0x63f0('0x37')],'internal':_0x19972e[_0x63f0('0x65')]});});return db[_0x63f0('0xfc')][_0x63f0('0x8a')](_0x1a31f7,{'individualHooks':!![]});})['then'](function(){return _0x19972e[_0x63f0('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x187acd[_0x63f0('0x61')][_0x63f0('0x40')]||_0x63f0('0x109'),'lastPauseAt':moment()[_0x63f0('0xf0')](_0x63f0('0xfe'))});})['then'](respondWithResult(_0x4d6860,null))['catch'](handleError(_0x4d6860,null));};exports[_0x63f0('0x10a')]=function(_0x3575d9,_0x15d4fd){if(_0x3575d9[_0x63f0('0x61')][_0x63f0('0xaf')]&&!utils[_0x63f0('0xa2')](_0x3575d9[_0x63f0('0x61')][_0x63f0('0xaf')])){throw new APIBadRequestError(util[_0x63f0('0xf0')](_0x63f0('0x10b'),_0x3575d9[_0x63f0('0x61')][_0x63f0('0xaf')]));}return db['User'][_0x63f0('0x38')]({'where':{'id':_0x3575d9[_0x63f0('0x57')]['id']},'attributes':['id',_0x63f0('0x3b'),_0x63f0('0x37'),'internal','interface',_0x63f0('0x9f'),'voicePause',_0x63f0('0x10c'),_0x63f0('0x10d'),'faxPause',_0x63f0('0x10e'),_0x63f0('0x10f'),_0x63f0('0x110'),_0x63f0('0x111'),_0x63f0('0x112')]})[_0x63f0('0x16')](function(_0x2e37ac){if(!_0x2e37ac){throw new APINotFoundError(util[_0x63f0('0xf0')](_0x63f0('0x113'),_0x3575d9[_0x63f0('0x57')]['id']));}return _0x2e37ac[_0x63f0('0x10a')](_0x3575d9[_0x63f0('0x61')][_0x63f0('0xaf')]);})['then'](respondWithResult(_0x15d4fd,null))['catch'](APIHandleError(_0x15d4fd));};exports[_0x63f0('0x114')]=function(_0x5a5c0a,_0x1423af){var _0x2fa020={};var _0x5ea282={};var _0x227ad5;var _0x78ba6d;return db['User'][_0x63f0('0xc9')]({'where':{'id':_0x5a5c0a['params']['id']}})['then'](handleEntityNotFound(_0x1423af,null))['then'](function(_0x34c1e4){if(_0x34c1e4){_0x227ad5=_0x34c1e4;_0x5ea282['model']=_['keys'](db['Team'][_0x63f0('0x3e')]);_0x5ea282[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x5a5c0a[_0x63f0('0x44')]);_0x5ea282[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x5ea282[_0x63f0('0x5d')],_0x5ea282[_0x63f0('0x44')]);_0x2fa020[_0x63f0('0x49')]=_['intersection'](_0x5ea282[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x5a5c0a[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x2fa020[_0x63f0('0x49')]=_0x2fa020[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x2fa020[_0x63f0('0x49')]:_0x5ea282[_0x63f0('0x5d')];_0x2fa020[_0x63f0('0xd6')]=qs['sort'](_0x5a5c0a[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x2fa020[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_['pick'](_0x5a5c0a['query'],_0x5ea282['filters']));if(_0x5a5c0a[_0x63f0('0x44')][_0x63f0('0x32')]){_0x2fa020[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x2fa020[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x2fa020[_0x63f0('0x49')],function(_0x2dd632){var _0x5e5ba2={};_0x5e5ba2[_0x2dd632]={'$like':'%'+_0x5a5c0a[_0x63f0('0x44')]['filter']+'%'};return _0x5e5ba2;})});}_0x2fa020=_[_0x63f0('0xcd')]({},_0x2fa020,_0x5a5c0a[_0x63f0('0xda')]);return _0x227ad5[_0x63f0('0x114')](_0x2fa020);}})['then'](function(_0x144bef){if(_0x144bef){_0x78ba6d=_0x144bef['length'];if(!_0x5a5c0a[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x2fa020[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x5a5c0a[_0x63f0('0x44')][_0x63f0('0x24')]);_0x2fa020[_0x63f0('0x23')]=qs['offset'](_0x5a5c0a[_0x63f0('0x44')][_0x63f0('0x23')]);}return _0x227ad5[_0x63f0('0x114')](_0x2fa020);}})[_0x63f0('0x16')](function(_0x47fb6e){if(_0x47fb6e){return _0x47fb6e?{'count':_0x78ba6d,'rows':_0x47fb6e}:null;}})[_0x63f0('0x16')](respondWithResult(_0x1423af,null))[_0x63f0('0x20')](handleError(_0x1423af,null));};exports[_0x63f0('0x115')]=function(_0x15b2e3,_0x181b5d){var _0xf33882=_0x15b2e3['params']['id'];var _0x452b98=_0x15b2e3[_0x63f0('0x61')]?_0x15b2e3[_0x63f0('0x61')][_0x63f0('0x64')]:null;var _0x587a29=[];return Promise[_0x63f0('0x103')]()['then'](function(){if(!_0x452b98)throw new APIBadRequestError(_0x63f0('0x116'));})[_0x63f0('0x16')](function(){return db['User'][_0x63f0('0xc9')]({'where':{'id':_0xf33882}});})[_0x63f0('0x16')](function(_0x1cdc47){if(!_0x1cdc47)throw new APINotFoundError(util[_0x63f0('0xf0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x15b2e3[_0x63f0('0x57')]['id']));return db[_0x63f0('0x6c')][_0x63f0('0x117')](function(_0x409f46){return _0x1cdc47['addTeams'](_0x452b98,{'transaction':_0x409f46})['then'](function(){return db['Team'][_0x63f0('0x4b')]({'where':{'id':{'$in':_0x452b98}}});})[_0x63f0('0x16')](function(_0xe4f32b){var _0x54544a=_[_0x63f0('0x34')](_0xe4f32b,function(_0x2b756e){return _0x2b756e[_0x63f0('0x118')]();});return Promise[_0x63f0('0x55')](_0x54544a);})[_0x63f0('0x16')](function(_0x20a495){_0x587a29=_[_0x63f0('0x119')](_0x20a495);var _0x4ec893=_[_0x63f0('0x34')](_0x587a29,function(_0x315503){return _0x315503['addAgent'](_0x1cdc47['id'],{'transaction':_0x409f46});});return Promise[_0x63f0('0x55')](_0x4ec893);})['then'](function(){if(!_0x1cdc47[_0x63f0('0x9f')])return;var _0x3e6111=_[_0x63f0('0x32')](_0x587a29,function(_0x551893){return _0x551893['getDataValue'](_0x63f0('0xaf'))==='Voice';});var _0x589632=_[_0x63f0('0x34')](_0x3e6111,function(_0xfbbcfe){return db['UserVoiceQueueRt'][_0x63f0('0xfb')]({'membername':_0x1cdc47[_0x63f0('0x3b')],'UserId':_0x1cdc47['id'],'queue_name':_0xfbbcfe[_0x63f0('0x3b')],'VoiceQueueId':_0xfbbcfe['id'],'interface':_[_0x63f0('0x6a')](_0x1cdc47['interface'])?util['format'](_0x63f0('0xac'),_0x1cdc47[_0x63f0('0x3b')]):_0x1cdc47[_0x63f0('0xa1')],'paused':_0x1cdc47[_0x63f0('0xa0')]||![],'penalty':_0x1cdc47[_0x63f0('0xa7')]},{'transaction':_0x409f46});});return Promise[_0x63f0('0x55')](_0x589632);})[_0x63f0('0x16')](function(){return db[_0x63f0('0x11a')][_0x63f0('0x4b')]({'where':{'teamId':{'$in':_0x452b98}}});})['then'](function(_0x31f91a){var _0x2ea2d9=_['map'](_0x31f91a,function(_0x14a76e){return db[_0x63f0('0x11b')]['create']({'UserId':_0x1cdc47['id'],'VoicePrefixId':_0x14a76e[_0x63f0('0x11c')]},{'transaction':_0x409f46});});return Promise[_0x63f0('0x55')](_0x2ea2d9);});});})[_0x63f0('0x16')](function(){for(var _0x3fb3ac=0x0;_0x3fb3ac<_0x587a29[_0x63f0('0x5f')];_0x3fb3ac++){var _0x1aa281=_0x587a29[_0x3fb3ac][_0x63f0('0x11d')](_0x63f0('0xaf'));var _0x4edd50=_0x1aa281+_0x63f0('0xaa');socket[_0x63f0('0x28')](_0x63f0('0x2d')+_0x1aa281+_0x63f0('0x11e'),{'UserId':_0xf33882,['queueField']:_0x587a29[_0x3fb3ac]['id']});}})[_0x63f0('0x16')](respondWithStatusCode(_0x181b5d,null))['catch'](APIHandleError(_0x181b5d));};exports[_0x63f0('0x11f')]=function(_0x4fee7a,_0x3ee7f0){var _0x55516e=_0x4fee7a[_0x63f0('0x57')]['id'];var _0x5ca5bc=null;if(_0x4fee7a['query'][_0x63f0('0x64')]){_0x5ca5bc=_['isArray'](_0x4fee7a['query'][_0x63f0('0x64')])?_0x4fee7a[_0x63f0('0x44')]['ids']:[_0x4fee7a[_0x63f0('0x44')][_0x63f0('0x64')]];}var _0x48f0a9=[];return Promise[_0x63f0('0x103')]()[_0x63f0('0x16')](function(){if(!_0x5ca5bc)throw new APIBadRequestError(_0x63f0('0x120'));})[_0x63f0('0x16')](function(){return db[_0x63f0('0x3d')][_0x63f0('0xc9')]({'where':{'id':_0x55516e}});})[_0x63f0('0x16')](function(_0x4ffa83){if(!_0x4ffa83)throw new APINotFoundError(util['format'](_0x63f0('0x113'),_0x4fee7a['params']['id']));return db['sequelize']['transaction'](function(_0x1e7f9b){return _0x4ffa83['removeTeams'](_0x5ca5bc,{'transaction':_0x1e7f9b})['then'](function(){return db[_0x63f0('0x121')][_0x63f0('0x4b')]({'where':{'id':{'$in':_0x5ca5bc}}});})[_0x63f0('0x16')](function(_0x5f3bd5){var _0x42100c=_[_0x63f0('0x34')](_0x5f3bd5,function(_0x32ee79){return _0x32ee79[_0x63f0('0x118')]();});return Promise[_0x63f0('0x55')](_0x42100c);})[_0x63f0('0x16')](function(_0x1800fe){_0x48f0a9=_[_0x63f0('0x119')](_0x1800fe);var _0x420d23=_[_0x63f0('0x34')](_0x48f0a9,function(_0x531f69){return _0x531f69[_0x63f0('0x122')](_0x4ffa83['id'],{'transaction':_0x1e7f9b});});return Promise[_0x63f0('0x55')](_0x420d23);})[_0x63f0('0x16')](function(){if(!_0x4ffa83[_0x63f0('0x9f')])return;var _0x4429a2=_['filter'](_0x48f0a9,function(_0x25b020){return _0x25b020[_0x63f0('0x11d')](_0x63f0('0xaf'))===_0x63f0('0x123');});var _0x4151c9=_[_0x63f0('0x34')](_0x4429a2,function(_0x56837a){return db[_0x63f0('0xad')][_0x63f0('0x2a')]({'where':{'VoiceQueueId':_0x56837a['id'],'UserId':_0x4ffa83['id']},'transaction':_0x1e7f9b});});return Promise['all'](_0x4151c9);})[_0x63f0('0x16')](function(){return db[_0x63f0('0x11a')][_0x63f0('0x4b')]({'where':{'teamId':{'$in':_0x5ca5bc}}});})[_0x63f0('0x16')](function(_0x3c2fbe){var _0x25bff5=_[_0x63f0('0x34')](_0x3c2fbe,function(_0x3ee507){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x4ffa83['id'],'VoicePrefixId':_0x3ee507[_0x63f0('0x11c')]}},{'transaction':_0x1e7f9b});});return Promise['all'](_0x25bff5);});});})[_0x63f0('0x16')](function(){for(var _0x15b80c=0x0;_0x15b80c<_0x48f0a9[_0x63f0('0x5f')];_0x15b80c++){var _0x407d16=_0x48f0a9[_0x15b80c][_0x63f0('0x11d')](_0x63f0('0xaf'));var _0x3e33f5=_0x407d16+_0x63f0('0xaa');socket[_0x63f0('0x28')](_0x63f0('0x2d')+_0x407d16+_0x63f0('0xb2'),{'UserId':_0x55516e,['queueField']:_0x48f0a9[_0x15b80c]['id']});}})[_0x63f0('0x16')](respondWithStatusCode(_0x3ee7f0,null))[_0x63f0('0x20')](APIHandleError(_0x3ee7f0));};exports[_0x63f0('0x124')]=function(_0x216b40,_0x1a7e77){var _0x13e845={};var _0xeb59a3={};var _0x5c58a2;var _0x5c2ed4;return db[_0x63f0('0x3d')]['findOne']({'where':{'id':_0x216b40[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x1a7e77,null))[_0x63f0('0x16')](function(_0xb8d657){if(_0xb8d657){_0x5c58a2=_0xb8d657;_0xeb59a3[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db[_0x63f0('0x125')][_0x63f0('0x3e')]);_0xeb59a3[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x216b40[_0x63f0('0x44')]);_0xeb59a3[_0x63f0('0x5b')]=_['intersection'](_0xeb59a3[_0x63f0('0x5d')],_0xeb59a3[_0x63f0('0x44')]);_0x13e845[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0xeb59a3['model'],qs[_0x63f0('0x5e')](_0x216b40[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x13e845['attributes']=_0x13e845[_0x63f0('0x49')]['length']?_0x13e845['attributes']:_0xeb59a3[_0x63f0('0x5d')];_0x13e845[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x216b40[_0x63f0('0x44')]['sort']);_0x13e845[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_[_0x63f0('0xcc')](_0x216b40[_0x63f0('0x44')],_0xeb59a3['filters']));if(_0x216b40[_0x63f0('0x44')]['filter']){_0x13e845[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x13e845[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x13e845[_0x63f0('0x49')],function(_0x1f47b3){var _0x382e03={};_0x382e03[_0x1f47b3]={'$like':'%'+_0x216b40[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x382e03;})});}_0x13e845=_['merge']({},_0x13e845,_0x216b40[_0x63f0('0xda')]);return _0x5c58a2['getLists'](_0x13e845);}})[_0x63f0('0x16')](function(_0x12d23b){if(_0x12d23b){_0x5c2ed4=_0x12d23b[_0x63f0('0x5f')];if(!_0x216b40[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x13e845['limit']=qs[_0x63f0('0x24')](_0x216b40['query'][_0x63f0('0x24')]);_0x13e845[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x216b40[_0x63f0('0x44')]['offset']);}return _0x5c58a2[_0x63f0('0x124')](_0x13e845);}})[_0x63f0('0x16')](function(_0x252ae8){if(_0x252ae8){return _0x252ae8?{'count':_0x5c2ed4,'rows':_0x252ae8}:null;}})[_0x63f0('0x16')](respondWithResult(_0x1a7e77,null))['catch'](handleError(_0x1a7e77,null));};exports[_0x63f0('0x126')]=function(_0x2bc39c,_0x46c7be){var _0x26f815={};var _0x5514e5={};var _0x1bd4f5;return db[_0x63f0('0x3d')]['findOne']({'where':{'id':_0x2bc39c['params']['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x46c7be,null))[_0x63f0('0x16')](function(_0x31a9c3){if(_0x31a9c3){_0x1bd4f5=_0x31a9c3;_0x5514e5['model']=_[_0x63f0('0x59')](db[_0x63f0('0x3d')]['rawAttributes']);_0x5514e5[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x2bc39c['query']);_0x5514e5[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x5514e5['model'],_0x5514e5[_0x63f0('0x44')]);_0x26f815[_0x63f0('0x49')]=_['intersection'](_0x5514e5['model'],qs['fields'](_0x2bc39c['query']['fields']));_0x26f815[_0x63f0('0x49')]=_0x26f815[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x26f815['attributes']:_0x5514e5['model'];_0x26f815[_0x63f0('0xd6')]=qs['sort'](_0x2bc39c['query']['sort']);_0x26f815[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_['pick'](_0x2bc39c[_0x63f0('0x44')],_0x5514e5[_0x63f0('0x5b')]));if(_0x2bc39c[_0x63f0('0x44')]['filter']){_0x26f815[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x26f815[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x26f815[_0x63f0('0x49')],function(_0xbf0c9d){var _0x38fba7={};_0x38fba7[_0xbf0c9d]={'$like':'%'+_0x2bc39c[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x38fba7;})});}_0x26f815[_0x63f0('0x5d')]=db[_0x63f0('0x3d')];_0x26f815['as']=_0x63f0('0x2e');_0x26f815=_['merge']({},_0x26f815,_0x2bc39c[_0x63f0('0xda')]);return _0x1bd4f5[_0x63f0('0xf9')]({'include':[_0x26f815]});}})[_0x63f0('0x16')](function(_0x278863){if(_0x278863){var _0x537a7e={},_0x3641a3=[];for(var _0x514594=0x0;_0x514594<_0x278863['length'];_0x514594+=0x1){for(var _0x46274e=0x0,_0x6c731f;_0x46274e<_0x278863[_0x514594]['Agents']['length'];_0x46274e+=0x1){_0x6c731f=_0x278863[_0x514594][_0x63f0('0x2e')][_0x46274e][_0x63f0('0x2b')]({'plain':!![]});_0x537a7e[_0x6c731f['id']]=_0x6c731f;}}_0x537a7e=_[_0x63f0('0x127')](_0x537a7e);for(var _0x13a727=qs['offset'](_0x2bc39c['query'][_0x63f0('0x23')]);_0x13a727<_0x537a7e[_0x63f0('0x5f')]&&_0x3641a3[_0x63f0('0x5f')]=_0x457fa6[_0xbdb7('0x4b')]){throw new Error(_0xbdb7('0x4c'));}})[_0xbdb7('0x15')](function(){if(_0x33efb0){return db['UserVoiceQueueRt'][_0xbdb7('0x4d')]({'where':{'membername':_0x33efb0[_0xbdb7('0x22')]},'individualHooks':!![]});}})[_0xbdb7('0x15')](function(){if(_0x33efb0){return _0x33efb0[_0xbdb7('0x4e')]({'raw':!![]});}})[_0xbdb7('0x15')](function(_0x5404d8){if(_0x33efb0){if(_0x5404d8){var _0x5f38e0=[];_0x328b70=_0x5404d8;if(_0x328b70[_0xbdb7('0x24')]){for(var _0xe4ef86=0x0;_0xe4ef86<_0x328b70[_0xbdb7('0x24')];_0xe4ef86++){_0x5f38e0['push'](db[_0xbdb7('0x1f')][_0xbdb7('0x4f')]({'membername':_0x33efb0[_0xbdb7('0x22')],'UserId':_0x33efb0['id'],'queue_name':_0x328b70[_0xe4ef86][_0xbdb7('0x22')],'VoiceQueueId':_0x328b70[_0xe4ef86]['id'],'interface':_0x3a2fee,'paused':_0x33efb0[_0xbdb7('0x50')]||![],'penalty':_0x328b70[_0xe4ef86][_0xbdb7('0x51')]||0x0}));}return BPromise[_0xbdb7('0x45')](_0x5f38e0);}}}})[_0xbdb7('0x15')](function(){if(_0x33efb0){return db[_0xbdb7('0x21')][_0xbdb7('0xd')]({'where':{'membername':_0x33efb0[_0xbdb7('0x22')],'exitAt':null}});}})[_0xbdb7('0x15')](function(_0x2ce12f){if(_0x33efb0){if(_0x2ce12f&&_0x2ce12f[_0xbdb7('0x24')]){var _0xbf6b25=[];_0x2ce12f['forEach'](function(_0x44e805){_0xbf6b25[_0xbdb7('0x29')](_0x44e805['update']({'exitAt':moment()[_0xbdb7('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xbdb7('0x45')](_0xbf6b25);}}})[_0xbdb7('0x15')](function(){if(_0x33efb0){var _0x209afc=[];var _0x18517a=[];var _0x385ec7=utils[_0xbdb7('0x27')]();var _0x38d916={'membername':_0x33efb0[_0xbdb7('0x22')],'interface':_0x3a2fee,'enterAt':moment()[_0xbdb7('0x2c')](_0xbdb7('0x25')),'role':_0x33efb0[_0xbdb7('0x1e')],'internal':_0x33efb0[_0xbdb7('0x2f')]};_0x385ec7['forEach'](function(_0x541189){_0x209afc[_0xbdb7('0x29')](_[_0xbdb7('0x52')]({'channel':_0x541189,'type':_0xbdb7('0x53'),'data1':_0xbdb7('0x54'),'data2':_0x3a2fee},_0x38d916));if(_0x33efb0['loginInPause']){_0x18517a['push'](_[_0xbdb7('0x52')]({'channel':_0x541189,'type':_0xbdb7('0x23'),'data1':_0xbdb7('0x55')},_0x38d916));}});return db[_0xbdb7('0x21')]['bulkCreate'](_0x209afc[_0xbdb7('0x56')](_0x18517a),{'individualHooks':!![]});}})[_0xbdb7('0x15')](function(){if(_0x33efb0){return _0x33efb0[_0xbdb7('0x20')]({'online':!![],'lastLoginAt':moment()[_0xbdb7('0x2c')](_0xbdb7('0x25')),'voicePause':_0x33efb0[_0xbdb7('0x50')]||![],'mailPause':_0x33efb0[_0xbdb7('0x50')]||![],'chatPause':_0x33efb0[_0xbdb7('0x50')]||![],'faxPause':_0x33efb0[_0xbdb7('0x50')]||![],'smsPause':_0x33efb0['loginInPause']||![],'openchannelPause':_0x33efb0[_0xbdb7('0x50')]||![],'pauseType':_0x33efb0[_0xbdb7('0x50')]?_0xbdb7('0x55'):null,'lastPauseAt':moment()['format'](_0xbdb7('0x25')),'interface':_0x3a2fee});}})[_0xbdb7('0x15')](function(_0x4a153c){_0x118cbf(_0x4a153c);})[_0xbdb7('0x18')](function(_0x2713e3){_0x2ed7c3(_0x47c12c['error'](0x1f4,_0x2713e3[_0xbdb7('0x1a')]));});});}; \ No newline at end of file +var _0x8084=['LoginUser','mobile','loginInPause','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','UserVoiceQueue.penalty','merge','LOGIN','callysquare','PAUSE','LOGININPAUSE','bulkCreate','concat','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','./user.socket','register','GetUser','options','raw','where','attributes','include','model','map','then','info','debug','stringify','catch','error','message','ShowUser','User','PauseUser','find','name','role','internal','interface','UserVoiceQueueRt','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','update','type','UnpauseUser','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','mailPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','LogoutUser','push','all'];(function(_0x381455,_0x54e126){var _0x4c96ab=function(_0x109e9a){while(--_0x109e9a){_0x381455['push'](_0x381455['shift']());}};_0x4c96ab(++_0x54e126);}(_0x8084,0x15e));var _0x4808=function(_0x1caaa3,_0x10a119){_0x1caaa3=_0x1caaa3-0x0;var _0x1e3c0a=_0x8084[_0x1caaa3];return _0x1e3c0a;};'use strict';var _=require('lodash');var util=require(_0x4808('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Redis=require('ioredis');var db=require(_0x4808('0x1'))['db'];var utils=require(_0x4808('0x2'));var logger=require(_0x4808('0x3'))('rpc');var config=require(_0x4808('0x4'));config[_0x4808('0x5')]=_[_0x4808('0x6')](config[_0x4808('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4808('0x5')]));require(_0x4808('0x7'))[_0x4808('0x8')](socket);exports[_0x4808('0x9')]=function(_0x1cdc18){var _0x2ba874=this;return new Promise(function(_0x380d14,_0x1652be){return db['User']['findAll']({'raw':_0x1cdc18[_0x4808('0xa')]?_0x1cdc18[_0x4808('0xa')][_0x4808('0xb')]===undefined?!![]:![]:!![],'where':_0x1cdc18['options']?_0x1cdc18[_0x4808('0xa')][_0x4808('0xc')]||null:null,'attributes':_0x1cdc18['options']?_0x1cdc18['options'][_0x4808('0xd')]||null:null,'limit':_0x1cdc18[_0x4808('0xa')]?_0x1cdc18['options']['limit']||null:null,'include':_0x1cdc18[_0x4808('0xa')]?_0x1cdc18[_0x4808('0xa')]['include']?_['map'](_0x1cdc18[_0x4808('0xa')][_0x4808('0xe')],function(_0x16fe3a){return{'model':db[_0x16fe3a[_0x4808('0xf')]],'as':_0x16fe3a['as'],'attributes':_0x16fe3a[_0x4808('0xd')],'include':_0x16fe3a[_0x4808('0xe')]?_[_0x4808('0x10')](_0x16fe3a['include'],function(_0x3eccf9){return{'model':db[_0x3eccf9[_0x4808('0xf')]],'as':_0x3eccf9['as'],'attributes':_0x3eccf9[_0x4808('0xd')],'include':_0x3eccf9['include']?_[_0x4808('0x10')](_0x3eccf9['include'],function(_0x15e13a){return{'model':db[_0x15e13a[_0x4808('0xf')]],'as':_0x15e13a['as'],'attributes':_0x15e13a[_0x4808('0xd')]};}):[]};}):[]};}):[]:[]})[_0x4808('0x11')](function(_0x6ec72e){logger[_0x4808('0x12')](_0x4808('0x9'),_0x1cdc18);logger[_0x4808('0x13')](_0x4808('0x9'),_0x1cdc18,JSON[_0x4808('0x14')](_0x6ec72e));_0x380d14(_0x6ec72e);})[_0x4808('0x15')](function(_0x24681c){logger['error'](_0x4808('0x9'),_0x24681c['message'],_0x1cdc18);_0x1652be(_0x2ba874[_0x4808('0x16')](0x1f4,_0x24681c[_0x4808('0x17')]));});});};exports[_0x4808('0x18')]=function(_0x5d7750){var _0x4e4ece=this;return new Promise(function(_0x4a8183,_0x314946){return db[_0x4808('0x19')]['find']({'raw':_0x5d7750[_0x4808('0xa')]?_0x5d7750['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d7750['options']?_0x5d7750[_0x4808('0xa')][_0x4808('0xc')]||null:null,'attributes':_0x5d7750['options']?_0x5d7750[_0x4808('0xa')][_0x4808('0xd')]||null:null,'include':_0x5d7750['options']?_0x5d7750[_0x4808('0xa')][_0x4808('0xe')]?_[_0x4808('0x10')](_0x5d7750['options'][_0x4808('0xe')],function(_0x208b57){return{'model':db[_0x208b57['model']],'as':_0x208b57['as'],'attributes':_0x208b57['attributes'],'include':_0x208b57[_0x4808('0xe')]?_[_0x4808('0x10')](_0x208b57[_0x4808('0xe')],function(_0x5ba190){return{'model':db[_0x5ba190[_0x4808('0xf')]],'as':_0x5ba190['as'],'attributes':_0x5ba190[_0x4808('0xd')],'include':_0x5ba190[_0x4808('0xe')]?_[_0x4808('0x10')](_0x5ba190[_0x4808('0xe')],function(_0x14bc7d){return{'model':db[_0x14bc7d[_0x4808('0xf')]],'as':_0x14bc7d['as'],'attributes':_0x14bc7d['attributes']};}):[]};}):[]};}):[]:[]})[_0x4808('0x11')](function(_0x345a26){logger[_0x4808('0x12')](_0x4808('0x18'),_0x5d7750);logger[_0x4808('0x13')]('ShowUser',_0x5d7750,JSON[_0x4808('0x14')](_0x345a26));_0x4a8183(_0x345a26);})['catch'](function(_0xed0a6c){logger[_0x4808('0x16')](_0x4808('0x18'),_0xed0a6c[_0x4808('0x17')],_0x5d7750);_0x314946(_0x4e4ece[_0x4808('0x16')](0x1f4,_0xed0a6c[_0x4808('0x17')]));});});};exports[_0x4808('0x1a')]=function(_0x6519c4){var _0x17fc08=this;return new Promise(function(_0x3ba41b,_0x1fc7f4){var _0x1206e4;return db['User'][_0x4808('0x1b')]({'where':_0x6519c4['options'][_0x4808('0xc')]||{},'attributes':['id',_0x4808('0x1c'),_0x4808('0x1d'),_0x4808('0x1e'),_0x4808('0x1f')]})[_0x4808('0x11')](function(_0x52ae52){if(_0x52ae52){_0x1206e4=_0x52ae52;return db[_0x4808('0x20')]['update']({'paused':0x1},{'where':{'UserId':_0x1206e4['id']},'individualHooks':!![]});}})[_0x4808('0x11')](function(){if(_0x1206e4){return db[_0x4808('0x21')][_0x4808('0x22')]({'where':{'membername':_0x1206e4['name'],'type':'PAUSE','exitAt':null}});}})[_0x4808('0x11')](function(_0x2c16c2){if(_0x1206e4){if(_0x2c16c2&&_0x2c16c2[_0x4808('0x23')]){var _0x24f2af=moment()[_0x4808('0x24')](_0x4808('0x25'));for(var _0x48c7c9=0x0,_0x329abe=_0x2c16c2[_0x4808('0x23')];_0x48c7c9<_0x329abe;_0x48c7c9++){_0x2c16c2[_0x48c7c9][_0x4808('0x26')]({'exitAt':_0x24f2af});}}}})[_0x4808('0x11')](function(){if(_0x1206e4){var _0x3e6c5e=[];var _0x139c81=utils[_0x4808('0x27')]();_0x139c81[_0x4808('0x28')](function(_0x29e259){_0x3e6c5e['push']({'channel':_0x29e259,'membername':_0x1206e4[_0x4808('0x1c')],'interface':_[_0x4808('0x29')](_0x1206e4[_0x4808('0x1f')])?util[_0x4808('0x24')](_0x4808('0x2a'),_0x1206e4[_0x4808('0x1c')]):_0x1206e4[_0x4808('0x1f')],'type':'PAUSE','enterAt':moment()[_0x4808('0x24')](_0x4808('0x25')),'data1':_0x6519c4[_0x4808('0x2b')]['type']||_0x4808('0x2c'),'role':_0x1206e4[_0x4808('0x1d')],'internal':_0x1206e4['internal'],'uniqueid':_0x6519c4[_0x4808('0x2b')][_0x4808('0x2d')]||null});});return db['MemberReport']['bulkCreate'](_0x3e6c5e,{'individualHooks':!![]});}})['then'](function(){if(_0x1206e4){return _0x1206e4[_0x4808('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x6519c4[_0x4808('0x2b')][_0x4808('0x2f')]||_0x4808('0x2c'),'lastPauseAt':moment()[_0x4808('0x24')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x4808('0x11')](function(_0x26037e){_0x3ba41b(_0x26037e);})[_0x4808('0x15')](function(_0x382ab8){_0x1fc7f4(_0x17fc08[_0x4808('0x16')](0x1f4,_0x382ab8['message']));});});};exports[_0x4808('0x30')]=function(_0x1b82a4){var _0x31a639=this;return new Promise(function(_0x1d1b91,_0x1c1ef9){if(_0x1b82a4[_0x4808('0x2b')]['channel']&&!utils[_0x4808('0x31')](_0x1b82a4[_0x4808('0x2b')][_0x4808('0x32')])){throw new Error(util['format'](_0x4808('0x33'),_0x1b82a4['body'][_0x4808('0x32')]));}return db[_0x4808('0x19')][_0x4808('0x34')]({'where':_0x1b82a4[_0x4808('0xa')][_0x4808('0xc')]||{},'attributes':['id',_0x4808('0x1c'),_0x4808('0x1d'),_0x4808('0x1e'),'interface','online','voicePause',_0x4808('0x35'),'chatPause',_0x4808('0x36'),_0x4808('0x37'),_0x4808('0x38'),'whatsappPause',_0x4808('0x39'),_0x4808('0x3a')]})[_0x4808('0x11')](function(_0x43022e){if(!_0x43022e){throw new Error(util[_0x4808('0x24')](_0x4808('0x3b'),_0x1b82a4[_0x4808('0x3c')]['id']));}return _0x43022e[_0x4808('0x3d')](_0x1b82a4['body'][_0x4808('0x32')],'system');})['then'](function(_0xbb9960){_0x1d1b91(_0xbb9960);})[_0x4808('0x15')](function(_0x509506){_0x1c1ef9(_0x31a639[_0x4808('0x16')](0x1f4,_0x509506[_0x4808('0x17')]));});});};exports[_0x4808('0x3e')]=function(_0x1e92a0){var _0x47e483=this;return new Promise(function(_0x427b24,_0x20e9bc){var _0x45e241;return db[_0x4808('0x19')][_0x4808('0x34')]({'where':_0x1e92a0['options'][_0x4808('0xc')]||{},'attributes':['id','name']})['then'](function(_0x3dd116){if(_0x3dd116){_0x45e241=_0x3dd116;return db[_0x4808('0x20')]['destroy']({'where':{'membername':_0x45e241[_0x4808('0x1c')]},'individualHooks':!![]});}})['then'](function(){if(_0x45e241){return db[_0x4808('0x21')][_0x4808('0x22')]({'where':{'membername':_0x45e241[_0x4808('0x1c')],'exitAt':null}});}})['then'](function(_0x53ff93){if(_0x45e241){if(_0x53ff93&&_0x53ff93[_0x4808('0x23')]){var _0x5a0206=[];_0x53ff93[_0x4808('0x28')](function(_0x338fe9){_0x5a0206[_0x4808('0x3f')](_0x338fe9['update']({'exitAt':moment()['format'](_0x4808('0x25'))}));});return BPromise[_0x4808('0x40')](_0x5a0206);}}})[_0x4808('0x11')](function(){if(_0x45e241){return _0x45e241[_0x4808('0x2e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x74b490){_0x427b24(_0x74b490);})[_0x4808('0x15')](function(_0x2e892c){_0x20e9bc(_0x47e483['error'](0x1f4,_0x2e892c['message']));});});};exports[_0x4808('0x41')]=function(_0x1e3fc4){var _0x4b9eb6=this;return new Promise(function(_0x21b49e,_0x38a75d){var _0x4c7a3e;var _0x1a53bd;var _0x50fdf3;var _0x3fcb18;return db[_0x4808('0x19')][_0x4808('0x34')]({'where':_0x1e3fc4['options'][_0x4808('0xc')]||{},'attributes':['id',_0x4808('0x1c'),_0x4808('0x1d'),_0x4808('0x42'),'phone',_0x4808('0x1e'),_0x4808('0x43'),_0x4808('0x1f')]})[_0x4808('0x11')](function(_0x330b7e){if(_0x330b7e){_0x4c7a3e=_0x330b7e;_0x3fcb18=_0x1e3fc4[_0x4808('0x2b')][_0x4808('0x1f')]?_0x1e3fc4[_0x4808('0x2b')][_0x4808('0x1f')]:util[_0x4808('0x24')](_0x4808('0x2a'),_0x4c7a3e[_0x4808('0x1c')]);return db[_0x4808('0x19')][_0x4808('0x44')]({'where':{'role':_0x4808('0x45'),'online':!![],'id':{'$ne':_0x4c7a3e['id']}}});}})[_0x4808('0x11')](function(_0x5f0f00){if(_0x5f0f00){_0x50fdf3=_0x5f0f00;return require(_0x4808('0x46'))['getLicense']();}})[_0x4808('0x11')](function(_0x274637){if(_0x274637&&_0x274637['agents']&&_0x50fdf3>=_0x274637[_0x4808('0x47')]){throw new Error(_0x4808('0x48'));}})['then'](function(){if(_0x4c7a3e){return db[_0x4808('0x20')][_0x4808('0x49')]({'where':{'membername':_0x4c7a3e['name']},'individualHooks':!![]});}})[_0x4808('0x11')](function(){if(_0x4c7a3e){return _0x4c7a3e[_0x4808('0x4a')]({'raw':!![]});}})[_0x4808('0x11')](function(_0x3699c2){if(_0x4c7a3e){if(_0x3699c2){var _0x191b67=[];_0x1a53bd=_0x3699c2;if(_0x1a53bd[_0x4808('0x23')]){for(var _0x28c5c5=0x0;_0x28c5c5<_0x1a53bd[_0x4808('0x23')];_0x28c5c5++){_0x191b67[_0x4808('0x3f')](db[_0x4808('0x20')]['upsert']({'membername':_0x4c7a3e[_0x4808('0x1c')],'UserId':_0x4c7a3e['id'],'queue_name':_0x1a53bd[_0x28c5c5][_0x4808('0x1c')],'VoiceQueueId':_0x1a53bd[_0x28c5c5]['id'],'interface':_0x3fcb18,'paused':_0x4c7a3e[_0x4808('0x43')]||![],'penalty':_0x1a53bd[_0x28c5c5][_0x4808('0x4b')]||0x0}));}return BPromise['all'](_0x191b67);}}}})[_0x4808('0x11')](function(){if(_0x4c7a3e){return db[_0x4808('0x21')]['findAll']({'where':{'membername':_0x4c7a3e[_0x4808('0x1c')],'exitAt':null}});}})[_0x4808('0x11')](function(_0x17ad09){if(_0x4c7a3e){if(_0x17ad09&&_0x17ad09[_0x4808('0x23')]){var _0x4439bb=[];_0x17ad09[_0x4808('0x28')](function(_0x506cfd){_0x4439bb[_0x4808('0x3f')](_0x506cfd[_0x4808('0x2e')]({'exitAt':moment()[_0x4808('0x24')](_0x4808('0x25'))}));});return BPromise[_0x4808('0x40')](_0x4439bb);}}})[_0x4808('0x11')](function(){if(_0x4c7a3e){var _0x1d1d1b=[];var _0xbb7222=[];var _0x1bbf1d=utils[_0x4808('0x27')]();var _0x4ef09f={'membername':_0x4c7a3e[_0x4808('0x1c')],'interface':_0x3fcb18,'enterAt':moment()[_0x4808('0x24')](_0x4808('0x25')),'role':_0x4c7a3e[_0x4808('0x1d')],'internal':_0x4c7a3e[_0x4808('0x1e')]};_0x1bbf1d[_0x4808('0x28')](function(_0x33a84a){_0x1d1d1b[_0x4808('0x3f')](_[_0x4808('0x4c')]({'channel':_0x33a84a,'type':_0x4808('0x4d'),'data1':_0x4808('0x4e'),'data2':_0x3fcb18},_0x4ef09f));if(_0x4c7a3e['loginInPause']){_0xbb7222['push'](_['merge']({'channel':_0x33a84a,'type':_0x4808('0x4f'),'data1':_0x4808('0x50')},_0x4ef09f));}});return db[_0x4808('0x21')][_0x4808('0x51')](_0x1d1d1b[_0x4808('0x52')](_0xbb7222),{'individualHooks':!![]});}})[_0x4808('0x11')](function(){if(_0x4c7a3e){return _0x4c7a3e[_0x4808('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x4808('0x24')](_0x4808('0x25')),'voicePause':_0x4c7a3e[_0x4808('0x43')]||![],'mailPause':_0x4c7a3e[_0x4808('0x43')]||![],'chatPause':_0x4c7a3e[_0x4808('0x43')]||![],'faxPause':_0x4c7a3e[_0x4808('0x43')]||![],'smsPause':_0x4c7a3e['loginInPause']||![],'openchannelPause':_0x4c7a3e[_0x4808('0x43')]||![],'pauseType':_0x4c7a3e[_0x4808('0x43')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x4808('0x24')](_0x4808('0x25')),'interface':_0x3fcb18});}})[_0x4808('0x11')](function(_0x459cc8){_0x21b49e(_0x459cc8);})['catch'](function(_0x3d8559){_0x38a75d(_0x4b9eb6['error'](0x1f4,_0x3d8559[_0x4808('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 80482f1..9dc73c4 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 _0xa4b7=['save','update','emit','removeListener','register','length','user:','./user.events'];(function(_0x339792,_0x52215c){var _0x4675a6=function(_0x714777){while(--_0x714777){_0x339792['push'](_0x339792['shift']());}};_0x4675a6(++_0x52215c);}(_0xa4b7,0xff));var _0x7a4b=function(_0x18006e,_0x14430a){_0x18006e=_0x18006e-0x0;var _0x503dad=_0xa4b7[_0x18006e];return _0x503dad;};'use strict';var UserEvents=require(_0x7a4b('0x0'));var events=[_0x7a4b('0x1'),'remove',_0x7a4b('0x2')];function createListener(_0x2226eb,_0x17f356){return function(_0x14492f){_0x17f356[_0x7a4b('0x3')](_0x2226eb,_0x14492f);};}function removeListener(_0x1c8f53,_0x25d99d){return function(){UserEvents[_0x7a4b('0x4')](_0x1c8f53,_0x25d99d);};}exports[_0x7a4b('0x5')]=function(_0x1f75ce){for(var _0x12f257=0x0,_0x264be1=events[_0x7a4b('0x6')];_0x12f257<_0x264be1;_0x12f257++){var _0x36b271=events[_0x12f257];var _0x2f0452=createListener(_0x7a4b('0x7')+_0x36b271,_0x1f75ce);UserEvents['on'](_0x36b271,_0x2f0452);}}; \ No newline at end of file +var _0xa3a7=['emit','removeListener','register','length','user:','./user.events','remove','update'];(function(_0x95d5d2,_0x19be17){var _0x4e601d=function(_0x4ddfc5){while(--_0x4ddfc5){_0x95d5d2['push'](_0x95d5d2['shift']());}};_0x4e601d(++_0x19be17);}(_0xa3a7,0x18d));var _0x7a3a=function(_0x49ffdf,_0x340e42){_0x49ffdf=_0x49ffdf-0x0;var _0x5b425d=_0xa3a7[_0x49ffdf];return _0x5b425d;};'use strict';var UserEvents=require(_0x7a3a('0x0'));var events=['save',_0x7a3a('0x1'),_0x7a3a('0x2')];function createListener(_0x45ecd5,_0x252fb3){return function(_0x12db9e){_0x252fb3[_0x7a3a('0x3')](_0x45ecd5,_0x12db9e);};}function removeListener(_0x21d3c6,_0xab29fe){return function(){UserEvents[_0x7a3a('0x4')](_0x21d3c6,_0xab29fe);};}exports[_0x7a3a('0x5')]=function(_0x3d37c4){for(var _0x2a9319=0x0,_0x3667c4=events[_0x7a3a('0x6')];_0x2a9319<_0x3667c4;_0x2a9319++){var _0x2c6154=events[_0x2a9319];var _0x101f5f=createListener(_0x7a3a('0x7')+_0x2c6154,_0x3d37c4);UserEvents['on'](_0x2c6154,_0x101f5f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index ffea540..6c38276 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x141043,_0xf143f9){var _0x468307=function(_0x5be2f7){while(--_0x5be2f7){_0x141043['push'](_0x141043['shift']());}};_0x468307(++_0xf143f9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0xcb91[_0x40be86];return _0xda3c3b;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5614a3,_0x1ebbb3){var _0x15f60c=function(_0x213c69){while(--_0x213c69){_0x5614a3['push'](_0x5614a3['shift']());}};_0x15f60c(++_0x1ebbb3);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'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 3f1aee3..b9ea6e6 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 _0xa205=['sequelize','exports','INTEGER'];(function(_0x51b3f3,_0x42205e){var _0x6c12c4=function(_0x2afa89){while(--_0x2afa89){_0x51b3f3['push'](_0x51b3f3['shift']());}};_0x6c12c4(++_0x42205e);}(_0xa205,0x177));var _0x5a20=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa205[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x5a20('0x0'));module[_0x5a20('0x1')]={'penalty':{'type':Sequelize[_0x5a20('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf34e=['sequelize','exports'];(function(_0x4ad19d,_0x1ed608){var _0x2d11b8=function(_0x42e7aa){while(--_0x42e7aa){_0x4ad19d['push'](_0x4ad19d['shift']());}};_0x2d11b8(++_0x1ed608);}(_0xf34e,0x1cc));var _0xef34=function(_0x383732,_0x4c5eb1){_0x383732=_0x383732-0x0;var _0xe08061=_0xf34e[_0x383732];return _0xe08061;};'use strict';var Sequelize=require(_0xef34('0x0'));module[_0xef34('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index faade56..b732d42 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 _0x5daa=['moment','bluebird','request-promise','path','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api'];(function(_0x3aff90,_0x2d2dbb){var _0x11253f=function(_0x3ea819){while(--_0x3ea819){_0x3aff90['push'](_0x3aff90['shift']());}};_0x11253f(++_0x2d2dbb);}(_0x5daa,0x1e9));var _0xa5da=function(_0x449cad,_0x4472ce){_0x449cad=_0x449cad-0x0;var _0x5e7c41=_0x5daa[_0x449cad];return _0x5e7c41;};'use strict';var _=require('lodash');var util=require(_0xa5da('0x0'));var logger=require(_0xa5da('0x1'))(_0xa5da('0x2'));var moment=require(_0xa5da('0x3'));var BPromise=require(_0xa5da('0x4'));var rp=require(_0xa5da('0x5'));var fs=require('fs');var path=require(_0xa5da('0x6'));var rimraf=require('rimraf');var config=require(_0xa5da('0x7'));var attributes=require('./userChatQueue.attributes');module[_0xa5da('0x8')]=function(_0x1424b7,_0x2d210a){return _0x1424b7[_0xa5da('0x9')](_0xa5da('0xa'),attributes,{'tableName':_0xa5da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a50=['api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x8febdb,_0x197628){var _0x30abe3=function(_0xdd63d2){while(--_0xdd63d2){_0x8febdb['push'](_0x8febdb['shift']());}};_0x30abe3(++_0x197628);}(_0x6a50,0x19d));var _0x06a5=function(_0x314e22,_0x891517){_0x314e22=_0x314e22-0x0;var _0x4ac0f5=_0x6a50[_0x314e22];return _0x4ac0f5;};'use strict';var _=require(_0x06a5('0x0'));var util=require(_0x06a5('0x1'));var logger=require(_0x06a5('0x2'))(_0x06a5('0x3'));var moment=require(_0x06a5('0x4'));var BPromise=require(_0x06a5('0x5'));var rp=require(_0x06a5('0x6'));var fs=require('fs');var path=require(_0x06a5('0x7'));var rimraf=require(_0x06a5('0x8'));var config=require('../../config/environment');var attributes=require(_0x06a5('0x9'));module['exports']=function(_0x296087,_0x111e0b){return _0x296087[_0x06a5('0xa')](_0x06a5('0xb'),attributes,{'tableName':_0x06a5('0xc'),'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 3866ccc..a58877c 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 _0x0482=['UserChatQueue,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info'];(function(_0x3f531a,_0x165074){var _0x31e27e=function(_0x15b420){while(--_0x15b420){_0x3f531a['push'](_0x3f531a['shift']());}};_0x31e27e(++_0x165074);}(_0x0482,0x191));var _0x2048=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0x0482[_0x503ffd];return _0x160437;};'use strict';var _=require(_0x2048('0x0'));var util=require('util');var moment=require(_0x2048('0x1'));var BPromise=require(_0x2048('0x2'));var rs=require(_0x2048('0x3'));var fs=require('fs');var Redis=require(_0x2048('0x4'));var db=require(_0x2048('0x5'))['db'];var utils=require(_0x2048('0x6'));var logger=require(_0x2048('0x7'))(_0x2048('0x8'));var config=require(_0x2048('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2048('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8dbc,_0x12b958,_0x2ed9e4){return new BPromise(function(_0x5ffb4c,_0x1e5759){return client['request'](_0x3e8dbc,_0x2ed9e4)[_0x2048('0xb')](function(_0x11c4b6){logger[_0x2048('0xc')](_0x2048('0xd'),_0x12b958,_0x2048('0xe'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x12b958,_0x2048('0xe'),JSON['stringify'](_0x11c4b6));if(_0x11c4b6[_0x2048('0xf')]){if(_0x11c4b6[_0x2048('0xf')]['code']===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x12b958,_0x11c4b6[_0x2048('0xf')][_0x2048('0x10')]);return _0x1e5759(_0x11c4b6[_0x2048('0xf')][_0x2048('0x10')]);}logger[_0x2048('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x12b958,_0x11c4b6[_0x2048('0xf')][_0x2048('0x10')]);return _0x5ffb4c(_0x11c4b6[_0x2048('0xf')][_0x2048('0x10')]);}else{logger[_0x2048('0xc')](_0x2048('0xd'),_0x12b958,_0x2048('0xe'));_0x5ffb4c(_0x11c4b6[_0x2048('0x11')][_0x2048('0x10')]);}})['catch'](function(_0x2898b7){logger[_0x2048('0xf')](_0x2048('0xd'),_0x12b958,_0x2898b7);_0x1e5759(_0x2898b7);});});} \ No newline at end of file +var _0x81b3=['UserChatQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x382747,_0xfe6a98){var _0x2080fb=function(_0x1a5d4b){while(--_0x1a5d4b){_0x382747['push'](_0x382747['shift']());}};_0x2080fb(++_0xfe6a98);}(_0x81b3,0xa6));var _0x381b=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x81b3[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x381b('0x0'));var util=require(_0x381b('0x1'));var moment=require(_0x381b('0x2'));var BPromise=require(_0x381b('0x3'));var rs=require(_0x381b('0x4'));var fs=require('fs');var Redis=require(_0x381b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x381b('0x6'));var config=require('../../config/environment');var jayson=require(_0x381b('0x7'));var client=jayson[_0x381b('0x8')][_0x381b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1222d7,_0x3f5ad5,_0x1774af){return new BPromise(function(_0xdfd20f,_0x235a1f){return client[_0x381b('0xa')](_0x1222d7,_0x1774af)['then'](function(_0x5f27eb){logger['info'](_0x381b('0xb'),_0x3f5ad5,_0x381b('0xc'));logger[_0x381b('0xd')](_0x381b('0xe'),_0x3f5ad5,_0x381b('0xc'),JSON['stringify'](_0x5f27eb));if(_0x5f27eb['error']){if(_0x5f27eb['error']['code']===0x1f4){logger[_0x381b('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x3f5ad5,_0x5f27eb['error'][_0x381b('0x10')]);return _0x235a1f(_0x5f27eb[_0x381b('0xf')][_0x381b('0x10')]);}logger['error'](_0x381b('0xb'),_0x3f5ad5,_0x5f27eb[_0x381b('0xf')]['message']);return _0xdfd20f(_0x5f27eb[_0x381b('0xf')][_0x381b('0x10')]);}else{logger[_0x381b('0x11')](_0x381b('0xb'),_0x3f5ad5,'request\x20sent');_0xdfd20f(_0x5f27eb[_0x381b('0x12')]['message']);}})[_0x381b('0x13')](function(_0x5977ce){logger[_0x381b('0xf')](_0x381b('0xb'),_0x3f5ad5,_0x5977ce);_0x235a1f(_0x5977ce);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 132da36..c2272d0 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x596cbf,_0x3ee197){var _0x50f1b6=function(_0x1ff543){while(--_0x1ff543){_0x596cbf['push'](_0x596cbf['shift']());}};_0x50f1b6(++_0x3ee197);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0xcb91[_0x151721];return _0x2deaa7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3438e0,_0x140a7f){var _0x45cbba=function(_0x4a6205){while(--_0x4a6205){_0x3438e0['push'](_0x3438e0['shift']());}};_0x45cbba(++_0x140a7f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index cd6a2f5..ff0b98e 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 _0x8615=['exports','sequelize'];(function(_0x529d4d,_0x4243fb){var _0x459662=function(_0x8db78){while(--_0x8db78){_0x529d4d['push'](_0x529d4d['shift']());}};_0x459662(++_0x4243fb);}(_0x8615,0x14d));var _0x5861=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0x8615[_0x319cb9];return _0x1735fc;};'use strict';var Sequelize=require(_0x5861('0x0'));module[_0x5861('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0666=['STRING','sequelize','INTEGER'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x0666,0xcd));var _0x6066=function(_0x580cf8,_0x26751e){_0x580cf8=_0x580cf8-0x0;var _0xcc9a9e=_0x0666[_0x580cf8];return _0xcc9a9e;};'use strict';var Sequelize=require(_0x6066('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6066('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6066('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index df1ddd2..206a652 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 _0xcab1=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x265f6a,_0x489e7b){var _0x411cb3=function(_0x2d9dcf){while(--_0x2d9dcf){_0x265f6a['push'](_0x265f6a['shift']());}};_0x411cb3(++_0x489e7b);}(_0xcab1,0x1a2));var _0x1cab=function(_0x2efc98,_0x5896b4){_0x2efc98=_0x2efc98-0x0;var _0x15dd1d=_0xcab1[_0x2efc98];return _0x15dd1d;};'use strict';var _=require(_0x1cab('0x0'));var util=require(_0x1cab('0x1'));var logger=require(_0x1cab('0x2'))(_0x1cab('0x3'));var moment=require(_0x1cab('0x4'));var BPromise=require(_0x1cab('0x5'));var rp=require(_0x1cab('0x6'));var fs=require('fs');var path=require(_0x1cab('0x7'));var rimraf=require(_0x1cab('0x8'));var config=require(_0x1cab('0x9'));var attributes=require(_0x1cab('0xa'));module[_0x1cab('0xb')]=function(_0x54f653,_0x5b16fc){return _0x54f653['define'](_0x1cab('0xc'),attributes,{'tableName':_0x1cab('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c14=['moment','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api'];(function(_0x345d7a,_0x247261){var _0x154602=function(_0x29c9c0){while(--_0x29c9c0){_0x345d7a['push'](_0x345d7a['shift']());}};_0x154602(++_0x247261);}(_0x5c14,0x14c));var _0x45c1=function(_0x5e39dd,_0x1c914d){_0x5e39dd=_0x5e39dd-0x0;var _0x3ae379=_0x5c14[_0x5e39dd];return _0x3ae379;};'use strict';var _=require(_0x45c1('0x0'));var util=require(_0x45c1('0x1'));var logger=require(_0x45c1('0x2'))(_0x45c1('0x3'));var moment=require(_0x45c1('0x4'));var BPromise=require(_0x45c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x45c1('0x6'));var rimraf=require(_0x45c1('0x7'));var config=require(_0x45c1('0x8'));var attributes=require(_0x45c1('0x9'));module[_0x45c1('0xa')]=function(_0x2c0183,_0x1b7646){return _0x2c0183[_0x45c1('0xb')](_0x45c1('0xc'),attributes,{'tableName':_0x45c1('0xd'),'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 090cbb7..da5aa01 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 _0xebb5=['info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x470961,_0x3315a9){var _0x288382=function(_0x315718){while(--_0x315718){_0x470961['push'](_0x470961['shift']());}};_0x288382(++_0x3315a9);}(_0xebb5,0x11d));var _0x5ebb=function(_0x4e9e63,_0x125d14){_0x4e9e63=_0x4e9e63-0x0;var _0x19b0b9=_0xebb5[_0x4e9e63];return _0x19b0b9;};'use strict';var _=require(_0x5ebb('0x0'));var util=require(_0x5ebb('0x1'));var moment=require(_0x5ebb('0x2'));var BPromise=require(_0x5ebb('0x3'));var rs=require(_0x5ebb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ebb('0x5'))['db'];var utils=require(_0x5ebb('0x6'));var logger=require(_0x5ebb('0x7'))('rpc');var config=require(_0x5ebb('0x8'));var jayson=require(_0x5ebb('0x9'));var client=jayson[_0x5ebb('0xa')][_0x5ebb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a7444,_0x203167,_0xdd8af9){return new BPromise(function(_0x4c5c11,_0x4673fe){return client[_0x5ebb('0xc')](_0x4a7444,_0xdd8af9)[_0x5ebb('0xd')](function(_0x2072ed){logger[_0x5ebb('0xe')](_0x5ebb('0xf'),_0x203167,'request\x20sent');logger[_0x5ebb('0x10')](_0x5ebb('0x11'),_0x203167,'request\x20sent',JSON['stringify'](_0x2072ed));if(_0x2072ed[_0x5ebb('0x12')]){if(_0x2072ed[_0x5ebb('0x12')]['code']===0x1f4){logger[_0x5ebb('0x12')](_0x5ebb('0xf'),_0x203167,_0x2072ed[_0x5ebb('0x12')][_0x5ebb('0x13')]);return _0x4673fe(_0x2072ed[_0x5ebb('0x12')][_0x5ebb('0x13')]);}logger[_0x5ebb('0x12')](_0x5ebb('0xf'),_0x203167,_0x2072ed[_0x5ebb('0x12')][_0x5ebb('0x13')]);return _0x4c5c11(_0x2072ed[_0x5ebb('0x12')][_0x5ebb('0x13')]);}else{logger['info'](_0x5ebb('0xf'),_0x203167,_0x5ebb('0x14'));_0x4c5c11(_0x2072ed[_0x5ebb('0x15')][_0x5ebb('0x13')]);}})[_0x5ebb('0x16')](function(_0x65b1fe){logger[_0x5ebb('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x203167,_0x65b1fe);_0x4673fe(_0x65b1fe);});});} \ No newline at end of file +var _0x15d7=['jayson/promise','http','request','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UserFaxQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x15d7,0x1c8));var _0x715d=function(_0x533edb,_0x431845){_0x533edb=_0x533edb-0x0;var _0x13e589=_0x15d7[_0x533edb];return _0x13e589;};'use strict';var _=require(_0x715d('0x0'));var util=require(_0x715d('0x1'));var moment=require(_0x715d('0x2'));var BPromise=require(_0x715d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x715d('0x4'));var logger=require(_0x715d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x715d('0x6'));var client=jayson['client'][_0x715d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5dbb22,_0x16b06a,_0x105233){return new BPromise(function(_0x13b857,_0xa4a51f){return client[_0x715d('0x8')](_0x5dbb22,_0x105233)[_0x715d('0x9')](function(_0x1b488e){logger[_0x715d('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x16b06a,_0x715d('0xb'));logger[_0x715d('0xc')](_0x715d('0xd'),_0x16b06a,'request\x20sent',JSON[_0x715d('0xe')](_0x1b488e));if(_0x1b488e['error']){if(_0x1b488e['error'][_0x715d('0xf')]===0x1f4){logger[_0x715d('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x16b06a,_0x1b488e[_0x715d('0x10')][_0x715d('0x11')]);return _0xa4a51f(_0x1b488e[_0x715d('0x10')][_0x715d('0x11')]);}logger[_0x715d('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x16b06a,_0x1b488e[_0x715d('0x10')][_0x715d('0x11')]);return _0x13b857(_0x1b488e['error'][_0x715d('0x11')]);}else{logger[_0x715d('0xa')](_0x715d('0x12'),_0x16b06a,_0x715d('0xb'));_0x13b857(_0x1b488e[_0x715d('0x13')][_0x715d('0x11')]);}})[_0x715d('0x14')](function(_0x3535cb){logger[_0x715d('0x10')](_0x715d('0x12'),_0x16b06a,_0x3535cb);_0xa4a51f(_0x3535cb);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index c1c428a..a1f69e3 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x29c0b7,_0x3c2245){var _0x4b0961=function(_0x3d9d5b){while(--_0x3d9d5b){_0x29c0b7['push'](_0x29c0b7['shift']());}};_0x4b0961(++_0x3c2245);}(_0xedd9,0xfc));var _0x9edd=function(_0x208767,_0x26b59d){_0x208767=_0x208767-0x0;var _0x4319b7=_0xedd9[_0x208767];return _0x4319b7;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x555bdc,_0x1e7f5b){var _0x425dcf=function(_0x4de9d2){while(--_0x4de9d2){_0x555bdc['push'](_0x555bdc['shift']());}};_0x425dcf(++_0x1e7f5b);}(_0x70e0,0x17b));var _0x070e=function(_0x4035fa,_0x58973b){_0x4035fa=_0x4035fa-0x0;var _0x265020=_0x70e0[_0x4035fa];return _0x265020;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 2b13694..8612578 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 _0xb4b1=['exports','INTEGER','sequelize'];(function(_0x2522ee,_0x28d475){var _0x40d4fb=function(_0xab61d7){while(--_0xab61d7){_0x2522ee['push'](_0x2522ee['shift']());}};_0x40d4fb(++_0x28d475);}(_0xb4b1,0x1d3));var _0x1b4b=function(_0x3850b0,_0x2a5251){_0x3850b0=_0x3850b0-0x0;var _0x6f82d6=_0xb4b1[_0x3850b0];return _0x6f82d6;};'use strict';var Sequelize=require(_0x1b4b('0x0'));module[_0x1b4b('0x1')]={'penalty':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x13f6=['exports'];(function(_0x127273,_0x273a2b){var _0x3a17cf=function(_0x238d60){while(--_0x238d60){_0x127273['push'](_0x127273['shift']());}};_0x3a17cf(++_0x273a2b);}(_0x13f6,0xaf));var _0x613f=function(_0x4a00b6,_0x2bbf56){_0x4a00b6=_0x4a00b6-0x0;var _0x4031f7=_0x13f6[_0x4a00b6];return _0x4031f7;};'use strict';var Sequelize=require('sequelize');module[_0x613f('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index f5460d6..94be70a 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 _0xfbf2=['lodash','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0xfbf2,0xbe));var _0x2fbf=function(_0x312b2b,_0x2174f3){_0x312b2b=_0x312b2b-0x0;var _0x1d6a18=_0xfbf2[_0x312b2b];return _0x1d6a18;};'use strict';var _=require(_0x2fbf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2fbf('0x1'));var BPromise=require(_0x2fbf('0x2'));var rp=require(_0x2fbf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fbf('0x4'));var config=require(_0x2fbf('0x5'));var attributes=require('./userMailQueue.attributes');module[_0x2fbf('0x6')]=function(_0x48d03e,_0xbcf03e){return _0x48d03e[_0x2fbf('0x7')](_0x2fbf('0x8'),attributes,{'tableName':_0x2fbf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c3d=['./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','bluebird','rimraf','../../config/environment'];(function(_0x5f259c,_0x26127d){var _0xddcf04=function(_0x5ea71f){while(--_0x5ea71f){_0x5f259c['push'](_0x5f259c['shift']());}};_0xddcf04(++_0x26127d);}(_0x0c3d,0x70));var _0xd0c3=function(_0x277607,_0x345a06){_0x277607=_0x277607-0x0;var _0x15fe23=_0x0c3d[_0x277607];return _0x15fe23;};'use strict';var _=require(_0xd0c3('0x0'));var util=require('util');var logger=require(_0xd0c3('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd0c3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd0c3('0x3'));var config=require(_0xd0c3('0x4'));var attributes=require(_0xd0c3('0x5'));module[_0xd0c3('0x6')]=function(_0x902ec0,_0xa1cfdf){return _0x902ec0['define'](_0xd0c3('0x7'),attributes,{'tableName':_0xd0c3('0x8'),'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 695aaa6..01133c5 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x4774e6,_0x1a2a6f){var _0xef1fa3=function(_0x4a0ec2){while(--_0x4a0ec2){_0x4774e6['push'](_0x4774e6['shift']());}};_0xef1fa3(++_0x1a2a6f);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x4b84[_0x1f1a97];return _0x29fc6a;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0xc092a6,_0xfdb8a6){var _0x1db0c6=function(_0x3117ed){while(--_0x3117ed){_0xc092a6['push'](_0xc092a6['shift']());}};_0x1db0c6(++_0xfdb8a6);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0x4b84[_0x3e961c];return _0x474f9c;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 1a61d14..fd82e19 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 _0x45a1=['Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','util','path'];(function(_0xf34c84,_0x18a73b){var _0x49c93e=function(_0x1279be){while(--_0x1279be){_0xf34c84['push'](_0xf34c84['shift']());}};_0x49c93e(++_0x18a73b);}(_0x45a1,0xd0));var _0x145a=function(_0x5f523d,_0x162500){_0x5f523d=_0x5f523d-0x0;var _0x21c4b1=_0x45a1[_0x5f523d];return _0x21c4b1;};'use strict';var multer=require('multer');var util=require(_0x145a('0x0'));var path=require(_0x145a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x145a('0x2')]();var fs_extra=require(_0x145a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x145a('0x4'));var config=require(_0x145a('0x5'));var controller=require(_0x145a('0x6'));router['post']('/',auth[_0x145a('0x7')](),controller[_0x145a('0x8')]);module[_0x145a('0x9')]=router; \ No newline at end of file +var _0x3e73=['../../components/auth/service','../../components/interaction/service','post','exports','multer','connect-timeout','express','Router'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0x3e73,0xcc));var _0x33e7=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x3e73[_0x1da527];return _0x40fc7c;};'use strict';var multer=require(_0x33e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x33e7('0x1'));var express=require(_0x33e7('0x2'));var router=express[_0x33e7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x33e7('0x4'));var interaction=require(_0x33e7('0x5'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0x33e7('0x6')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x33e7('0x7')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index b29c643..cfdc82a 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 _0xdc9a=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x520945,_0x28b144){var _0x17067a=function(_0x191ae1){while(--_0x191ae1){_0x520945['push'](_0x520945['shift']());}};_0x17067a(++_0x28b144);}(_0xdc9a,0x133));var _0xadc9=function(_0x1129a7,_0x1c88c7){_0x1129a7=_0x1129a7-0x0;var _0x38dffa=_0xdc9a[_0x1129a7];return _0x38dffa;};'use strict';var Sequelize=require(_0xadc9('0x0'));module[_0xadc9('0x1')]={'body':{'type':Sequelize[_0xadc9('0x2')]},'senderName':{'type':Sequelize[_0xadc9('0x3')]},'recipientsId':{'type':Sequelize[_0xadc9('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xadc9('0x4')]}}; \ No newline at end of file +var _0x0ef4=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x284664,_0x455bfa){var _0x2e5d22=function(_0x40f40b){while(--_0x40f40b){_0x284664['push'](_0x284664['shift']());}};_0x2e5d22(++_0x455bfa);}(_0x0ef4,0xd2));var _0x40ef=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x0ef4[_0x1f7996];return _0x584609;};'use strict';var Sequelize=require(_0x40ef('0x0'));module[_0x40ef('0x1')]={'body':{'type':Sequelize[_0x40ef('0x2')]},'senderName':{'type':Sequelize[_0x40ef('0x3')]},'recipientsId':{'type':Sequelize[_0x40ef('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x40ef('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d38bcbb..a47eb20 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 _0x8b41=['stack','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','Template','findOne','html','render','catch','startCase','User','union','ids','includes','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','save','update','destroy','then','error'];(function(_0xde9708,_0x118eac){var _0x58d460=function(_0x262a49){while(--_0x262a49){_0xde9708['push'](_0xde9708['shift']());}};_0x58d460(++_0x118eac);}(_0x8b41,0x175));var _0x18b4=function(_0x4db301,_0x368b4c){_0x4db301=_0x4db301-0x0;var _0x434b36=_0x8b41[_0x4db301];return _0x434b36;};'use strict';var emlformat=require(_0x18b4('0x0'));var rimraf=require(_0x18b4('0x1'));var zipdir=require(_0x18b4('0x2'));var jsonpatch=require(_0x18b4('0x3'));var rp=require('request-promise');var moment=require(_0x18b4('0x4'));var BPromise=require(_0x18b4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x18b4('0x6'));var ejs=require(_0x18b4('0x7'));var fs=require('fs');var fs_extra=require(_0x18b4('0x8'));var _=require(_0x18b4('0x9'));var squel=require(_0x18b4('0xa'));var crypto=require(_0x18b4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x18b4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x18b4('0xd'));var Redis=require(_0x18b4('0xe'));var authService=require(_0x18b4('0xf'));var qs=require(_0x18b4('0x10'));var as=require(_0x18b4('0x11'));var hardwareService=require(_0x18b4('0x12'));var logger=require(_0x18b4('0x13'))(_0x18b4('0x14'));var utils=require('../../config/utils');var config=require(_0x18b4('0x15'));var licenseUtil=require(_0x18b4('0x16'));var db=require(_0x18b4('0x17'))['db'];config[_0x18b4('0x18')]=_[_0x18b4('0x19')](config[_0x18b4('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x18b4('0x1a'))(new Redis(config[_0x18b4('0x18')]));require(_0x18b4('0x1b'))['register'](socket);function respondWithStatusCode(_0x161edb,_0x24c98c){_0x24c98c=_0x24c98c||0xcc;return function(_0x410612){if(_0x410612){return _0x161edb[_0x18b4('0x1c')](_0x24c98c);}return _0x161edb[_0x18b4('0x1d')](_0x24c98c)[_0x18b4('0x1e')]();};}function respondWithResult(_0x462ce0,_0x4487f1){_0x4487f1=_0x4487f1||0xc8;return function(_0x12de57){if(_0x12de57){return _0x462ce0[_0x18b4('0x1d')](_0x4487f1)['json'](_0x12de57);}};}function respondWithFilteredResult(_0x25d140,_0x452b40){return function(_0x1a896a){if(_0x1a896a){var _0x5202bb=typeof _0x452b40['offset']===_0x18b4('0x1f')&&typeof _0x452b40[_0x18b4('0x20')]===_0x18b4('0x1f');var _0x4d43e9=_0x1a896a['count'];var _0x517937=_0x5202bb?0x0:_0x452b40[_0x18b4('0x21')];var _0x235040=_0x5202bb?_0x1a896a['count']:_0x452b40[_0x18b4('0x21')]+_0x452b40[_0x18b4('0x20')];var _0x258f4f;if(_0x235040>=_0x4d43e9){_0x235040=_0x4d43e9;_0x258f4f=0xc8;}else{_0x258f4f=0xce;}_0x25d140['status'](_0x258f4f);return _0x25d140[_0x18b4('0x22')](_0x18b4('0x23'),_0x517937+'-'+_0x235040+'/'+_0x4d43e9)[_0x18b4('0x24')](_0x1a896a);}return null;};}function patchUpdates(_0x5d0434){return function(_0x414f92){try{jsonpatch[_0x18b4('0x25')](_0x414f92,_0x5d0434,!![]);}catch(_0x278f3d){return BPromise['reject'](_0x278f3d);}return _0x414f92[_0x18b4('0x26')]();};}function saveUpdates(_0xbb666b,_0x7a0f04){return function(_0x10767b){if(_0x10767b){return _0x10767b[_0x18b4('0x27')](_0xbb666b)['then'](function(_0x505420){return _0x505420;});}return null;};}function removeEntity(_0x314f78,_0x3dc7ed){return function(_0x3e50ce){if(_0x3e50ce){return _0x3e50ce[_0x18b4('0x28')]()[_0x18b4('0x29')](function(){_0x314f78[_0x18b4('0x1d')](0xcc)[_0x18b4('0x1e')]();});}};}function handleEntityNotFound(_0x4c9d63,_0x373ff4){return function(_0x25c069){if(!_0x25c069){_0x4c9d63[_0x18b4('0x1c')](0x194);}return _0x25c069;};}function handleError(_0xb3f348,_0x341806){_0x341806=_0x341806||0x1f4;return function(_0x4fd028){logger[_0x18b4('0x2a')](_0x4fd028[_0x18b4('0x2b')]);if(_0x4fd028[_0x18b4('0x2c')]){delete _0x4fd028[_0x18b4('0x2c')];}_0xb3f348[_0x18b4('0x1d')](_0x341806)[_0x18b4('0x2d')](_0x4fd028);};}exports[_0x18b4('0x2e')]=function(_0x2bddab,_0x35a692,_0x85a738){if(!_0x2bddab[_0x18b4('0x2f')][_0x18b4('0x30')](_0x18b4('0x31'))&&!_0x2bddab[_0x18b4('0x2f')]['hasOwnProperty']('TemplateId')){throw new db[(_0x18b4('0x32'))][(_0x18b4('0x33'))](_0x18b4('0x34'));}else{if(_0x2bddab[_0x18b4('0x2f')][_0x18b4('0x30')](_0x18b4('0x35'))&&!_0x2bddab[_0x18b4('0x2f')][_0x18b4('0x30')](_0x18b4('0x36'))){throw new db[(_0x18b4('0x32'))][(_0x18b4('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x2bddab[_0x18b4('0x2f')][_0x18b4('0x30')](_0x18b4('0x37'))){throw new db[(_0x18b4('0x32'))][(_0x18b4('0x33'))](_0x18b4('0x38'));}else{try{var _0x32dfb5=JSON[_0x18b4('0x39')](_0x2bddab['body'][_0x18b4('0x37')]);}catch(_0x2764db){logger[_0x18b4('0x2a')](_0x2764db);throw new db[(_0x18b4('0x32'))][(_0x18b4('0x33'))](_0x18b4('0x3a'));}var _0x58cb41=[_0x18b4('0x3b'),_0x18b4('0x3c'),'mailqueue',_0x18b4('0x3d'),_0x18b4('0x3e'),_0x18b4('0x3f'),_0x18b4('0x40'),_0x18b4('0x41'),_0x18b4('0x42')];if(_['some'](_0x32dfb5,function(_0x550a64){return!_['includes'](_0x58cb41,_0x550a64[_0x18b4('0x43')][_0x18b4('0x44')]());})){throw new db[(_0x18b4('0x32'))]['ValidationError'](_0x18b4('0x45'));}}}var _0x4a56c1={};_0x4a56c1[_0x18b4('0x46')]=_0x2bddab[_0x18b4('0x2f')][_0x18b4('0x30')]('senderName')?_0x2bddab['body'][_0x18b4('0x46')]:_0x2bddab[_0x18b4('0x42')][_0x18b4('0x47')];_0x4a56c1[_0x18b4('0x48')]=_[_0x18b4('0x49')](_0x2bddab[_0x18b4('0x2f')][_0x18b4('0x48')])?null:_0x2bddab['body'][_0x18b4('0x48')];_0x4a56c1[_0x18b4('0x4a')]=_0x2bddab[_0x18b4('0x2f')]['beep']||![];_0x4a56c1[_0x18b4('0x4b')]=_0x2bddab['user']['id'];return getContent(_0x2bddab['body'])['then'](function(_0x526e24){_0x4a56c1[_0x18b4('0x2f')]=_0x526e24;return getRecipients(_0x32dfb5);})[_0x18b4('0x29')](function(_0x6f6756){_0x4a56c1[_0x18b4('0x4c')]=_[_0x18b4('0x4d')](_0x6f6756)[_0x18b4('0x4e')](',');return db[_0x18b4('0x4f')][_0x18b4('0x50')](function(_0x4b6130){return db[_0x18b4('0x51')][_0x18b4('0x52')](_0x4a56c1,{'raw':!![],'transaction':_0x4b6130})[_0x18b4('0x29')](function(_0x89792f){var _0x14776a={'sender':_0x4a56c1[_0x18b4('0x46')],'description':_0x4a56c1[_0x18b4('0x48')],'content':_0x4a56c1['body'],'beep':_0x4a56c1[_0x18b4('0x4a')]};_0x6f6756[_0x18b4('0x53')](function(_0x1dc9eb){_0x14776a[_0x18b4('0x54')]=_0x1dc9eb;socket[_0x18b4('0x55')]('userNotification:send',_0x14776a);});return _0x89792f;});});})[_0x18b4('0x29')](respondWithResult(_0x35a692,0xc9))['catch'](handleError(_0x35a692,null));};function getContent(_0x4a82ee){return new BPromise(function(_0x41a493,_0x2c1a50){if(_0x4a82ee[_0x18b4('0x31')]){_0x41a493(_0x4a82ee['text']);return;}return db[_0x18b4('0x56')][_0x18b4('0x57')]({'attributes':[_0x18b4('0x58')],'where':{'id':_0x4a82ee[_0x18b4('0x35')]},'raw':!![]})[_0x18b4('0x29')](function(_0x29e3de){if(!_0x29e3de)throw new db[(_0x18b4('0x32'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0xacfc72=Mustache[_0x18b4('0x59')](_0x29e3de[_0x18b4('0x58')],_0x4a82ee['view']);_0x41a493(_0xacfc72);})[_0x18b4('0x5a')](function(_0x5e4ba9){_0x2c1a50(_0x5e4ba9);});});}function getRecipients(_0x285dcd){return new BPromise(function(_0xee6856,_0x32d41e){var _0x476e84=[];var _0x1ce276=[];_0x285dcd[_0x18b4('0x53')](function(_0x5d9a26){var _0x3007f5=_[_0x18b4('0x5b')](_0x5d9a26[_0x18b4('0x43')]['toLowerCase']());if(_0x3007f5===_0x18b4('0x5c')){_0x476e84=_[_0x18b4('0x5d')](_0x476e84,_0x5d9a26[_0x18b4('0x5e')]);}else{if(_[_0x18b4('0x5f')](_0x3007f5,_0x18b4('0x60')))_0x3007f5=_0x3007f5[_0x18b4('0x61')]('queue',_0x18b4('0x62'));_0x5d9a26[_0x18b4('0x5e')][_0x18b4('0x53')](function(_0x4fdd99){_0x1ce276[_0x18b4('0x63')](getAgents(_0x3007f5,_0x4fdd99));});}});return BPromise[_0x18b4('0x64')](_0x1ce276)[_0x18b4('0x29')](function(_0x432191){_0x476e84=_['union'](_0x476e84,_[_0x18b4('0x65')](_0x432191));_0xee6856(_0x476e84);})[_0x18b4('0x5a')](function(_0x1a9dfb){_0x32d41e(_0x1a9dfb);});});}function getAgents(_0x347bd2,_0x1ed2c5){return new BPromise(function(_0xb87526,_0x578a10){return db[_0x347bd2]['findOne']({'where':{'id':_0x1ed2c5}})[_0x18b4('0x29')](function(_0x1c0b92){return _0x1c0b92[_0x18b4('0x66')]({'attributes':['id'],'raw':!![]})[_0x18b4('0x29')](function(_0x22bebf){var _0x1d457b=_[_0x18b4('0x67')](_0x22bebf,'id');_0xb87526(_0x1d457b);});})[_0x18b4('0x5a')](function(_0x9c9c2){_0x578a10(_0x9c9c2);});});} \ No newline at end of file +var _0x18e8=['socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','save','update','then','destroy','error','stack','name','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','userNotification:send','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','User','union','ids','queue','push','all','findOne','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis'];(function(_0x1ecb4f,_0x1137a4){var _0x40fa12=function(_0x52c483){while(--_0x52c483){_0x1ecb4f['push'](_0x1ecb4f['shift']());}};_0x40fa12(++_0x1137a4);}(_0x18e8,0xa2));var _0x818e=function(_0x4c6385,_0x5aaa52){_0x4c6385=_0x4c6385-0x0;var _0x2e07d9=_0x18e8[_0x4c6385];return _0x2e07d9;};'use strict';var emlformat=require(_0x818e('0x0'));var rimraf=require(_0x818e('0x1'));var zipdir=require(_0x818e('0x2'));var jsonpatch=require(_0x818e('0x3'));var rp=require('request-promise');var moment=require(_0x818e('0x4'));var BPromise=require(_0x818e('0x5'));var Mustache=require(_0x818e('0x6'));var util=require(_0x818e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x818e('0x8'));var ejs=require(_0x818e('0x9'));var fs=require('fs');var fs_extra=require(_0x818e('0xa'));var _=require(_0x818e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x818e('0xc'));var deskjs=require(_0x818e('0xd'));var toCsv=require(_0x818e('0x8'));var querystring=require(_0x818e('0xe'));var Papa=require(_0x818e('0xf'));var Redis=require(_0x818e('0x10'));var authService=require(_0x818e('0x11'));var qs=require(_0x818e('0x12'));var as=require(_0x818e('0x13'));var hardwareService=require(_0x818e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x818e('0x15'));var config=require(_0x818e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x818e('0x17'))['db'];config['redis']=_[_0x818e('0x18')](config[_0x818e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x818e('0x1a'))(new Redis(config['redis']));require(_0x818e('0x1b'))[_0x818e('0x1c')](socket);function respondWithStatusCode(_0x1125ba,_0x3a3afa){_0x3a3afa=_0x3a3afa||0xcc;return function(_0x5647d5){if(_0x5647d5){return _0x1125ba[_0x818e('0x1d')](_0x3a3afa);}return _0x1125ba[_0x818e('0x1e')](_0x3a3afa)[_0x818e('0x1f')]();};}function respondWithResult(_0x10e851,_0x1edc80){_0x1edc80=_0x1edc80||0xc8;return function(_0x56ce6c){if(_0x56ce6c){return _0x10e851[_0x818e('0x1e')](_0x1edc80)['json'](_0x56ce6c);}};}function respondWithFilteredResult(_0x3aa12a,_0x2ac640){return function(_0x139d63){if(_0x139d63){var _0x34129b=typeof _0x2ac640[_0x818e('0x20')]===_0x818e('0x21')&&typeof _0x2ac640[_0x818e('0x22')]===_0x818e('0x21');var _0x57b099=_0x139d63[_0x818e('0x23')];var _0x3afbaf=_0x34129b?0x0:_0x2ac640[_0x818e('0x20')];var _0x51e620=_0x34129b?_0x139d63[_0x818e('0x23')]:_0x2ac640[_0x818e('0x20')]+_0x2ac640['limit'];var _0x328012;if(_0x51e620>=_0x57b099){_0x51e620=_0x57b099;_0x328012=0xc8;}else{_0x328012=0xce;}_0x3aa12a[_0x818e('0x1e')](_0x328012);return _0x3aa12a[_0x818e('0x24')]('Content-Range',_0x3afbaf+'-'+_0x51e620+'/'+_0x57b099)['json'](_0x139d63);}return null;};}function patchUpdates(_0x303e1c){return function(_0x1168a2){try{jsonpatch['apply'](_0x1168a2,_0x303e1c,!![]);}catch(_0x153db3){return BPromise['reject'](_0x153db3);}return _0x1168a2[_0x818e('0x25')]();};}function saveUpdates(_0x374603,_0x3de324){return function(_0x5b6b95){if(_0x5b6b95){return _0x5b6b95[_0x818e('0x26')](_0x374603)[_0x818e('0x27')](function(_0x108a35){return _0x108a35;});}return null;};}function removeEntity(_0x2818da,_0x5a7c59){return function(_0x237683){if(_0x237683){return _0x237683[_0x818e('0x28')]()[_0x818e('0x27')](function(){_0x2818da[_0x818e('0x1e')](0xcc)[_0x818e('0x1f')]();});}};}function handleEntityNotFound(_0x573dd1,_0x322227){return function(_0x13f44d){if(!_0x13f44d){_0x573dd1['sendStatus'](0x194);}return _0x13f44d;};}function handleError(_0x569268,_0x2113a2){_0x2113a2=_0x2113a2||0x1f4;return function(_0xc33e29){logger[_0x818e('0x29')](_0xc33e29[_0x818e('0x2a')]);if(_0xc33e29[_0x818e('0x2b')]){delete _0xc33e29[_0x818e('0x2b')];}_0x569268['status'](_0x2113a2)['send'](_0xc33e29);};}exports[_0x818e('0x2c')]=function(_0x4405b4,_0xee4803,_0xd382c1){if(!_0x4405b4['body'][_0x818e('0x2d')](_0x818e('0x2e'))&&!_0x4405b4[_0x818e('0x2f')][_0x818e('0x2d')](_0x818e('0x30'))){throw new db[(_0x818e('0x31'))][(_0x818e('0x32'))](_0x818e('0x33'));}else{if(_0x4405b4[_0x818e('0x2f')][_0x818e('0x2d')](_0x818e('0x30'))&&!_0x4405b4[_0x818e('0x2f')][_0x818e('0x2d')](_0x818e('0x34'))){throw new db[(_0x818e('0x31'))][(_0x818e('0x32'))](_0x818e('0x35'));}if(!_0x4405b4[_0x818e('0x2f')][_0x818e('0x2d')]('recipients')){throw new db[(_0x818e('0x31'))][(_0x818e('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x46734f=JSON[_0x818e('0x36')](_0x4405b4['body'][_0x818e('0x37')]);}catch(_0x1afafb){logger['error'](_0x1afafb);throw new db['Sequelize'][(_0x818e('0x32'))](_0x818e('0x38'));}var _0x5cba6b=['chatqueue',_0x818e('0x39'),_0x818e('0x3a'),_0x818e('0x3b'),'smsqueue','voicequeue',_0x818e('0x3c'),_0x818e('0x3d'),_0x818e('0x3e')];if(_['some'](_0x46734f,function(_0x43d34b){return!_[_0x818e('0x3f')](_0x5cba6b,_0x43d34b[_0x818e('0x40')][_0x818e('0x41')]());})){throw new db[(_0x818e('0x31'))][(_0x818e('0x32'))](_0x818e('0x42'));}}}var _0x22847f={};_0x22847f[_0x818e('0x43')]=_0x4405b4['body']['hasOwnProperty'](_0x818e('0x43'))?_0x4405b4[_0x818e('0x2f')]['senderName']:_0x4405b4[_0x818e('0x3e')][_0x818e('0x44')];_0x22847f[_0x818e('0x45')]=_[_0x818e('0x46')](_0x4405b4[_0x818e('0x2f')][_0x818e('0x45')])?null:_0x4405b4[_0x818e('0x2f')]['recipientsDescription'];_0x22847f[_0x818e('0x47')]=_0x4405b4['body'][_0x818e('0x47')]||![];_0x22847f[_0x818e('0x48')]=_0x4405b4['user']['id'];return getContent(_0x4405b4[_0x818e('0x2f')])[_0x818e('0x27')](function(_0x526693){_0x22847f[_0x818e('0x2f')]=_0x526693;return getRecipients(_0x46734f);})[_0x818e('0x27')](function(_0x6da9dc){_0x22847f[_0x818e('0x49')]=_[_0x818e('0x4a')](_0x6da9dc)[_0x818e('0x4b')](',');return db[_0x818e('0x4c')][_0x818e('0x4d')](function(_0x275165){return db[_0x818e('0x4e')]['create'](_0x22847f,{'raw':!![],'transaction':_0x275165})[_0x818e('0x27')](function(_0x4fe611){var _0x317068={'sender':_0x22847f[_0x818e('0x43')],'description':_0x22847f['recipientsDescription'],'content':_0x22847f[_0x818e('0x2f')],'beep':_0x22847f['beep']};_0x6da9dc['forEach'](function(_0x656293){_0x317068['recipient']=_0x656293;socket['emit'](_0x818e('0x4f'),_0x317068);});return _0x4fe611;});});})[_0x818e('0x27')](respondWithResult(_0xee4803,0xc9))[_0x818e('0x50')](handleError(_0xee4803,null));};function getContent(_0x3d187d){return new BPromise(function(_0x16a07b,_0x5e2be9){if(_0x3d187d['text']){_0x16a07b(_0x3d187d[_0x818e('0x2e')]);return;}return db[_0x818e('0x51')]['findOne']({'attributes':['html'],'where':{'id':_0x3d187d[_0x818e('0x30')]},'raw':!![]})[_0x818e('0x27')](function(_0x777d7d){if(!_0x777d7d)throw new db[(_0x818e('0x31'))][(_0x818e('0x32'))](_0x818e('0x52'));var _0x109222=Mustache[_0x818e('0x53')](_0x777d7d['html'],_0x3d187d[_0x818e('0x34')]);_0x16a07b(_0x109222);})['catch'](function(_0x479766){_0x5e2be9(_0x479766);});});}function getRecipients(_0x2aa788){return new BPromise(function(_0x1285f2,_0x124aba){var _0x4528a2=[];var _0x4d0ebf=[];_0x2aa788[_0x818e('0x54')](function(_0x2864ee){var _0x4cf489=_[_0x818e('0x55')](_0x2864ee[_0x818e('0x40')][_0x818e('0x41')]());if(_0x4cf489===_0x818e('0x56')){_0x4528a2=_[_0x818e('0x57')](_0x4528a2,_0x2864ee[_0x818e('0x58')]);}else{if(_[_0x818e('0x3f')](_0x4cf489,_0x818e('0x59')))_0x4cf489=_0x4cf489['replace']('queue','Queue');_0x2864ee[_0x818e('0x58')][_0x818e('0x54')](function(_0x227067){_0x4d0ebf[_0x818e('0x5a')](getAgents(_0x4cf489,_0x227067));});}});return BPromise[_0x818e('0x5b')](_0x4d0ebf)[_0x818e('0x27')](function(_0x24c6b1){_0x4528a2=_[_0x818e('0x57')](_0x4528a2,_['flatten'](_0x24c6b1));_0x1285f2(_0x4528a2);})[_0x818e('0x50')](function(_0x143835){_0x124aba(_0x143835);});});}function getAgents(_0x2551be,_0x5d7ae3){return new BPromise(function(_0x2e2e61,_0x5812d7){return db[_0x2551be][_0x818e('0x5c')]({'where':{'id':_0x5d7ae3}})[_0x818e('0x27')](function(_0x274083){return _0x274083['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x3e616f){var _0x253afc=_[_0x818e('0x5d')](_0x3e616f,'id');_0x2e2e61(_0x253afc);});})[_0x818e('0x50')](function(_0x5d6089){_0x5812d7(_0x5d6089);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 964fafb..9af854d 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 _0x1696=['../../mysqldb','UserNotification','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x2166e1,_0x4a9a63){var _0x42ada1=function(_0x1d487a){while(--_0x1d487a){_0x2166e1['push'](_0x2166e1['shift']());}};_0x42ada1(++_0x4a9a63);}(_0x1696,0x1ee));var _0x6169=function(_0x4c3c87,_0xae709d){_0x4c3c87=_0x4c3c87-0x0;var _0x1efffb=_0x1696[_0x4c3c87];return _0x1efffb;};'use strict';var EventEmitter=require(_0x6169('0x0'));var UserNotification=require(_0x6169('0x1'))['db'][_0x6169('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x6169('0x3')](0x0);var events={'afterCreate':_0x6169('0x4'),'afterUpdate':'update','afterDestroy':_0x6169('0x5')};function emitEvent(_0x50c765){return function(_0x1b379c,_0xc70b7b,_0x2ee751){UserNotificationEvents[_0x6169('0x6')](_0x50c765+':'+_0x1b379c['id'],_0x1b379c);UserNotificationEvents['emit'](_0x50c765,_0x1b379c);_0x2ee751(null);};}for(var e in events){if(events[_0x6169('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x6169('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x6b65=['save','remove','emit','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0xfc5e94,_0x22bcc7){var _0x3aa883=function(_0x3af896){while(--_0x3af896){_0xfc5e94['push'](_0xfc5e94['shift']());}};_0x3aa883(++_0x22bcc7);}(_0x6b65,0x68));var _0x56b6=function(_0x255a85,_0x43ea4c){_0x255a85=_0x255a85-0x0;var _0x5ee089=_0x6b65[_0x255a85];return _0x5ee089;};'use strict';var EventEmitter=require(_0x56b6('0x0'));var UserNotification=require(_0x56b6('0x1'))['db'][_0x56b6('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x56b6('0x3')](0x0);var events={'afterCreate':_0x56b6('0x4'),'afterUpdate':'update','afterDestroy':_0x56b6('0x5')};function emitEvent(_0x3fcb75){return function(_0xbd74e5,_0x41016f,_0x47c540){UserNotificationEvents[_0x56b6('0x6')](_0x3fcb75+':'+_0xbd74e5['id'],_0xbd74e5);UserNotificationEvents[_0x56b6('0x6')](_0x3fcb75,_0xbd74e5);_0x47c540(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x56b6('0x7')](e,emitEvent(event));}}module[_0x56b6('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 6c553c2..55fc340 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 _0xce24=['request-promise','../../config/environment','./userNotification.attributes','exports','userNotifications','utf8mb4','lodash','util','../../config/logger','api','bluebird'];(function(_0x84b0c9,_0x386dbc){var _0x124ab9=function(_0x58b7ed){while(--_0x58b7ed){_0x84b0c9['push'](_0x84b0c9['shift']());}};_0x124ab9(++_0x386dbc);}(_0xce24,0x119));var _0x4ce2=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xce24[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x4ce2('0x0'));var util=require(_0x4ce2('0x1'));var logger=require(_0x4ce2('0x2'))(_0x4ce2('0x3'));var moment=require('moment');var BPromise=require(_0x4ce2('0x4'));var rp=require(_0x4ce2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ce2('0x6'));var attributes=require(_0x4ce2('0x7'));module[_0x4ce2('0x8')]=function(_0x30042c,_0x1b8e5c){return _0x30042c['define']('UserNotification',attributes,{'tableName':_0x4ce2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ce2('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1529=['moment','path','rimraf','../../config/environment','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x1933c1,_0x2b9bac){var _0x5d30f8=function(_0x3e72d3){while(--_0x3e72d3){_0x1933c1['push'](_0x1933c1['shift']());}};_0x5d30f8(++_0x2b9bac);}(_0x1529,0x1b6));var _0x9152=function(_0x3f43ef,_0x4c2ba9){_0x3f43ef=_0x3f43ef-0x0;var _0x20af43=_0x1529[_0x3f43ef];return _0x20af43;};'use strict';var _=require('lodash');var util=require(_0x9152('0x0'));var logger=require(_0x9152('0x1'))('api');var moment=require(_0x9152('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9152('0x3'));var rimraf=require(_0x9152('0x4'));var config=require(_0x9152('0x5'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x4b1ef1,_0x3f69c7){return _0x4b1ef1[_0x9152('0x6')](_0x9152('0x7'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9152('0x8'),'collate':_0x9152('0x9')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index e184948..6c8b1ee 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 _0xec83=['localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0xec83,0x1d0));var _0x3ec8=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xec83[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x3ec8('0x0'));var util=require(_0x3ec8('0x1'));var moment=require(_0x3ec8('0x2'));var BPromise=require(_0x3ec8('0x3'));var rs=require(_0x3ec8('0x4'));var fs=require('fs');var Redis=require(_0x3ec8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ec8('0x6'));var logger=require('../../config/logger')(_0x3ec8('0x7'));var config=require('../../config/environment');var jayson=require(_0x3ec8('0x8'));var client=jayson[_0x3ec8('0x9')][_0x3ec8('0xa')]({'port':0x232a});config[_0x3ec8('0xb')]=_['defaults'](config['redis'],{'host':_0x3ec8('0xc'),'port':0x18eb});var socket=require(_0x3ec8('0xd'))(new Redis(config[_0x3ec8('0xb')]));require(_0x3ec8('0xe'))[_0x3ec8('0xf')](socket);function respondWithRpcPromise(_0x152155,_0x1997f2,_0x5cae36){return new BPromise(function(_0x335116,_0x9cfd6c){return client[_0x3ec8('0x10')](_0x152155,_0x5cae36)[_0x3ec8('0x11')](function(_0x2e2026){logger[_0x3ec8('0x12')]('UserNotification,\x20%s,\x20%s',_0x1997f2,_0x3ec8('0x13'));logger[_0x3ec8('0x14')](_0x3ec8('0x15'),_0x1997f2,_0x3ec8('0x13'),JSON['stringify'](_0x2e2026));if(_0x2e2026[_0x3ec8('0x16')]){if(_0x2e2026[_0x3ec8('0x16')][_0x3ec8('0x17')]===0x1f4){logger[_0x3ec8('0x16')](_0x3ec8('0x18'),_0x1997f2,_0x2e2026['error'][_0x3ec8('0x19')]);return _0x9cfd6c(_0x2e2026[_0x3ec8('0x16')][_0x3ec8('0x19')]);}logger[_0x3ec8('0x16')](_0x3ec8('0x18'),_0x1997f2,_0x2e2026['error']['message']);return _0x335116(_0x2e2026[_0x3ec8('0x16')][_0x3ec8('0x19')]);}else{logger[_0x3ec8('0x12')]('UserNotification,\x20%s,\x20%s',_0x1997f2,_0x3ec8('0x13'));_0x335116(_0x2e2026[_0x3ec8('0x1a')]['message']);}})[_0x3ec8('0x1b')](function(_0xb31ac6){logger['error'](_0x3ec8('0x18'),_0x1997f2,_0xb31ac6);_0x9cfd6c(_0xb31ac6);});});} \ No newline at end of file +var _0xcb3f=['message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s'];(function(_0x297763,_0x2c446a){var _0x1306b1=function(_0x350a9f){while(--_0x350a9f){_0x297763['push'](_0x297763['shift']());}};_0x1306b1(++_0x2c446a);}(_0xcb3f,0x1b4));var _0xfcb3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xcb3f[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xfcb3('0x0'));var util=require(_0xfcb3('0x1'));var moment=require('moment');var BPromise=require(_0xfcb3('0x2'));var rs=require(_0xfcb3('0x3'));var fs=require('fs');var Redis=require(_0xfcb3('0x4'));var db=require(_0xfcb3('0x5'))['db'];var utils=require(_0xfcb3('0x6'));var logger=require(_0xfcb3('0x7'))(_0xfcb3('0x8'));var config=require(_0xfcb3('0x9'));var jayson=require(_0xfcb3('0xa'));var client=jayson[_0xfcb3('0xb')][_0xfcb3('0xc')]({'port':0x232a});config[_0xfcb3('0xd')]=_[_0xfcb3('0xe')](config['redis'],{'host':_0xfcb3('0xf'),'port':0x18eb});var socket=require(_0xfcb3('0x10'))(new Redis(config[_0xfcb3('0xd')]));require(_0xfcb3('0x11'))[_0xfcb3('0x12')](socket);function respondWithRpcPromise(_0x302ae5,_0x34631c,_0x36eb8b){return new BPromise(function(_0x9ddc00,_0xb7ea17){return client[_0xfcb3('0x13')](_0x302ae5,_0x36eb8b)[_0xfcb3('0x14')](function(_0x3849e1){logger['info']('UserNotification,\x20%s,\x20%s',_0x34631c,_0xfcb3('0x15'));logger[_0xfcb3('0x16')](_0xfcb3('0x17'),_0x34631c,_0xfcb3('0x15'),JSON[_0xfcb3('0x18')](_0x3849e1));if(_0x3849e1[_0xfcb3('0x19')]){if(_0x3849e1[_0xfcb3('0x19')][_0xfcb3('0x1a')]===0x1f4){logger['error'](_0xfcb3('0x1b'),_0x34631c,_0x3849e1['error'][_0xfcb3('0x1c')]);return _0xb7ea17(_0x3849e1[_0xfcb3('0x19')]['message']);}logger[_0xfcb3('0x19')](_0xfcb3('0x1b'),_0x34631c,_0x3849e1['error'][_0xfcb3('0x1c')]);return _0x9ddc00(_0x3849e1[_0xfcb3('0x19')][_0xfcb3('0x1c')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x34631c,'request\x20sent');_0x9ddc00(_0x3849e1['result'][_0xfcb3('0x1c')]);}})['catch'](function(_0x45ee1f){logger['error']('UserNotification,\x20%s,\x20%s',_0x34631c,_0x45ee1f);_0xb7ea17(_0x45ee1f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index ca5053b..0b93004 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 _0x5560=['length','userNotification:','./userNotification.events','save','remove','update','register'];(function(_0x56500a,_0x5953c7){var _0x333977=function(_0x374007){while(--_0x374007){_0x56500a['push'](_0x56500a['shift']());}};_0x333977(++_0x5953c7);}(_0x5560,0x113));var _0x0556=function(_0x871ef0,_0x167b63){_0x871ef0=_0x871ef0-0x0;var _0x4e9fbf=_0x5560[_0x871ef0];return _0x4e9fbf;};'use strict';var UserNotificationEvents=require(_0x0556('0x0'));var events=[_0x0556('0x1'),_0x0556('0x2'),_0x0556('0x3')];function createListener(_0x5b693e,_0x4b1c5c){return function(_0xa9119){_0x4b1c5c['emit'](_0x5b693e,_0xa9119);};}function removeListener(_0x4cbe5b,_0x35aab5){return function(){UserNotificationEvents['removeListener'](_0x4cbe5b,_0x35aab5);};}exports[_0x0556('0x4')]=function(_0x271d96){for(var _0x5e153f=0x0,_0xc97486=events[_0x0556('0x5')];_0x5e153f<_0xc97486;_0x5e153f++){var _0x19da15=events[_0x5e153f];var _0x473d97=createListener(_0x0556('0x6')+_0x19da15,_0x271d96);UserNotificationEvents['on'](_0x19da15,_0x473d97);}}; \ No newline at end of file +var _0x1f1f=['emit','removeListener','register','length','userNotification:','./userNotification.events','save','update'];(function(_0x19fc8f,_0x264aa6){var _0x1f24f4=function(_0x2b1400){while(--_0x2b1400){_0x19fc8f['push'](_0x19fc8f['shift']());}};_0x1f24f4(++_0x264aa6);}(_0x1f1f,0x1cd));var _0xf1f1=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0x1f1f[_0xd9f102];return _0x2652e4;};'use strict';var UserNotificationEvents=require(_0xf1f1('0x0'));var events=[_0xf1f1('0x1'),'remove',_0xf1f1('0x2')];function createListener(_0xcfefa,_0x2dcc94){return function(_0x41a2aa){_0x2dcc94[_0xf1f1('0x3')](_0xcfefa,_0x41a2aa);};}function removeListener(_0x1db5d7,_0x4a6d56){return function(){UserNotificationEvents[_0xf1f1('0x4')](_0x1db5d7,_0x4a6d56);};}exports[_0xf1f1('0x5')]=function(_0x2372b0){for(var _0x5d7509=0x0,_0x30bcde=events[_0xf1f1('0x6')];_0x5d7509<_0x30bcde;_0x5d7509++){var _0x23447d=events[_0x5d7509];var _0x5783a6=createListener(_0xf1f1('0x7')+_0x23447d,_0x2372b0);UserNotificationEvents['on'](_0x23447d,_0x5783a6);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 464d76c..c114471 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4361c1,_0x175703){var _0x7d47bd=function(_0x185980){while(--_0x185980){_0x4361c1['push'](_0x4361c1['shift']());}};_0x7d47bd(++_0x175703);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x43919a,_0x567fa6){var _0x2738d6=function(_0x37e8dc){while(--_0x37e8dc){_0x43919a['push'](_0x43919a['shift']());}};_0x2738d6(++_0x567fa6);}(_0xedd9,0xfc));var _0x9edd=function(_0xbbfe2e,_0x4d5127){_0xbbfe2e=_0xbbfe2e-0x0;var _0x364fef=_0xedd9[_0xbbfe2e];return _0x364fef;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e78df57..ed85efe 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 _0xde02=['sequelize','exports','INTEGER'];(function(_0x54bf3f,_0x1963ab){var _0x2db7d4=function(_0x4971d7){while(--_0x4971d7){_0x54bf3f['push'](_0x54bf3f['shift']());}};_0x2db7d4(++_0x1963ab);}(_0xde02,0xd5));var _0x2de0=function(_0x469f7b,_0x475956){_0x469f7b=_0x469f7b-0x0;var _0x3addce=_0xde02[_0x469f7b];return _0x3addce;};'use strict';var Sequelize=require(_0x2de0('0x0'));module[_0x2de0('0x1')]={'penalty':{'type':Sequelize[_0x2de0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1539=['INTEGER','exports'];(function(_0x2ab2e2,_0x2bec9c){var _0x5941d2=function(_0x3779d0){while(--_0x3779d0){_0x2ab2e2['push'](_0x2ab2e2['shift']());}};_0x5941d2(++_0x2bec9c);}(_0x1539,0x139));var _0x9153=function(_0x28897b,_0x4c8a20){_0x28897b=_0x28897b-0x0;var _0x3a1b68=_0x1539[_0x28897b];return _0x3a1b68;};'use strict';var Sequelize=require('sequelize');module[_0x9153('0x0')]={'penalty':{'type':Sequelize[_0x9153('0x1')],'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 43e147a..b08f0db 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 _0xb88f=['rimraf','../../config/environment','exports','UserOpenchannelQueue','util','api','bluebird','request-promise','path'];(function(_0x34ced0,_0x21907f){var _0x3db58d=function(_0x51fb31){while(--_0x51fb31){_0x34ced0['push'](_0x34ced0['shift']());}};_0x3db58d(++_0x21907f);}(_0xb88f,0x124));var _0xfb88=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0xb88f[_0x5c6994];return _0x1d5c84;};'use strict';var _=require('lodash');var util=require(_0xfb88('0x0'));var logger=require('../../config/logger')(_0xfb88('0x1'));var moment=require('moment');var BPromise=require(_0xfb88('0x2'));var rp=require(_0xfb88('0x3'));var fs=require('fs');var path=require(_0xfb88('0x4'));var rimraf=require(_0xfb88('0x5'));var config=require(_0xfb88('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xfb88('0x7')]=function(_0x299565,_0x11ba28){return _0x299565['define'](_0xfb88('0x8'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94c5=['api','moment','bluebird','request-promise','path','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util'];(function(_0x54a930,_0x40062f){var _0x46743e=function(_0x5e51df){while(--_0x5e51df){_0x54a930['push'](_0x54a930['shift']());}};_0x46743e(++_0x40062f);}(_0x94c5,0xf0));var _0x594c=function(_0x190abb,_0x5c356d){_0x190abb=_0x190abb-0x0;var _0x31fe0f=_0x94c5[_0x190abb];return _0x31fe0f;};'use strict';var _=require(_0x594c('0x0'));var util=require(_0x594c('0x1'));var logger=require('../../config/logger')(_0x594c('0x2'));var moment=require(_0x594c('0x3'));var BPromise=require(_0x594c('0x4'));var rp=require(_0x594c('0x5'));var fs=require('fs');var path=require(_0x594c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x594c('0x7'));module[_0x594c('0x8')]=function(_0x268ec2,_0x3a3c28){return _0x268ec2[_0x594c('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x594c('0xa'),'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 d1e6f99..35eca8a 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 _0x0bb0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0bb0,0xf2));var _0x00bb=function(_0x16e684,_0x193aee){_0x16e684=_0x16e684-0x0;var _0xefc256=_0x0bb0[_0x16e684];return _0xefc256;};'use strict';var _=require(_0x00bb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x00bb('0x1'));var rs=require(_0x00bb('0x2'));var fs=require('fs');var Redis=require(_0x00bb('0x3'));var db=require(_0x00bb('0x4'))['db'];var utils=require(_0x00bb('0x5'));var logger=require(_0x00bb('0x6'))(_0x00bb('0x7'));var config=require(_0x00bb('0x8'));var jayson=require(_0x00bb('0x9'));var client=jayson['client'][_0x00bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24acac,_0x9d95ec,_0x4107ba){return new BPromise(function(_0x1aef0d,_0x40e2ff){return client['request'](_0x24acac,_0x4107ba)[_0x00bb('0xb')](function(_0x1ce56f){logger['info'](_0x00bb('0xc'),_0x9d95ec,_0x00bb('0xd'));logger['debug'](_0x00bb('0xe'),_0x9d95ec,_0x00bb('0xd'),JSON['stringify'](_0x1ce56f));if(_0x1ce56f[_0x00bb('0xf')]){if(_0x1ce56f['error']['code']===0x1f4){logger[_0x00bb('0xf')](_0x00bb('0xc'),_0x9d95ec,_0x1ce56f['error'][_0x00bb('0x10')]);return _0x40e2ff(_0x1ce56f[_0x00bb('0xf')][_0x00bb('0x10')]);}logger['error'](_0x00bb('0xc'),_0x9d95ec,_0x1ce56f['error']['message']);return _0x1aef0d(_0x1ce56f[_0x00bb('0xf')][_0x00bb('0x10')]);}else{logger['info'](_0x00bb('0xc'),_0x9d95ec,'request\x20sent');_0x1aef0d(_0x1ce56f[_0x00bb('0x11')][_0x00bb('0x10')]);}})[_0x00bb('0x12')](function(_0x315144){logger[_0x00bb('0xf')](_0x00bb('0xc'),_0x9d95ec,_0x315144);_0x40e2ff(_0x315144);});});} \ No newline at end of file +var _0x6aa9=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug'];(function(_0x1169e6,_0x32722f){var _0x534261=function(_0x34dd35){while(--_0x34dd35){_0x1169e6['push'](_0x1169e6['shift']());}};_0x534261(++_0x32722f);}(_0x6aa9,0x6e));var _0x96aa=function(_0x3d94ec,_0x4ba41b){_0x3d94ec=_0x3d94ec-0x0;var _0x7bd75d=_0x6aa9[_0x3d94ec];return _0x7bd75d;};'use strict';var _=require(_0x96aa('0x0'));var util=require(_0x96aa('0x1'));var moment=require(_0x96aa('0x2'));var BPromise=require(_0x96aa('0x3'));var rs=require(_0x96aa('0x4'));var fs=require('fs');var Redis=require(_0x96aa('0x5'));var db=require(_0x96aa('0x6'))['db'];var utils=require(_0x96aa('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x96aa('0x8'));var client=jayson[_0x96aa('0x9')][_0x96aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d862,_0x4443a4,_0x5658a4){return new BPromise(function(_0x123ae8,_0x45e834){return client[_0x96aa('0xb')](_0x1d862,_0x5658a4)[_0x96aa('0xc')](function(_0xfa4b7a){logger[_0x96aa('0xd')](_0x96aa('0xe'),_0x4443a4,'request\x20sent');logger[_0x96aa('0xf')](_0x96aa('0x10'),_0x4443a4,_0x96aa('0x11'),JSON[_0x96aa('0x12')](_0xfa4b7a));if(_0xfa4b7a['error']){if(_0xfa4b7a[_0x96aa('0x13')]['code']===0x1f4){logger[_0x96aa('0x13')](_0x96aa('0xe'),_0x4443a4,_0xfa4b7a[_0x96aa('0x13')][_0x96aa('0x14')]);return _0x45e834(_0xfa4b7a[_0x96aa('0x13')][_0x96aa('0x14')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4443a4,_0xfa4b7a['error'][_0x96aa('0x14')]);return _0x123ae8(_0xfa4b7a['error'][_0x96aa('0x14')]);}else{logger['info'](_0x96aa('0xe'),_0x4443a4,_0x96aa('0x11'));_0x123ae8(_0xfa4b7a['result'][_0x96aa('0x14')]);}})['catch'](function(_0x16a3b4){logger[_0x96aa('0x13')](_0x96aa('0xe'),_0x4443a4,_0x16a3b4);_0x45e834(_0x16a3b4);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 93728a4..1e9b41c 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 _0x10a1=['clone','addResources','update','delete','destroy','removeSections','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone'];(function(_0x2a2ece,_0x29cb59){var _0x221838=function(_0x4cd1f9){while(--_0x4cd1f9){_0x2a2ece['push'](_0x2a2ece['shift']());}};_0x221838(++_0x29cb59);}(_0x10a1,0x172));var _0x110a=function(_0x4e506a,_0x58869e){_0x4e506a=_0x4e506a-0x0;var _0x51d0f3=_0x10a1[_0x4e506a];return _0x51d0f3;};'use strict';var multer=require(_0x110a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x110a('0x1'));var express=require(_0x110a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x110a('0x3'));var interaction=require(_0x110a('0x4'));var config=require(_0x110a('0x5'));var controller=require(_0x110a('0x6'));router[_0x110a('0x7')]('/',auth[_0x110a('0x8')](),controller[_0x110a('0x9')]);router[_0x110a('0x7')](_0x110a('0xa'),auth[_0x110a('0x8')](),controller['describe']);router[_0x110a('0x7')](_0x110a('0xb'),auth['isAuthenticated'](),controller[_0x110a('0xc')]);router[_0x110a('0x7')](_0x110a('0xd'),auth[_0x110a('0x8')](),controller[_0x110a('0xe')]);router['get'](_0x110a('0xf'),auth[_0x110a('0x8')](),controller[_0x110a('0x10')]);router[_0x110a('0x11')]('/',auth[_0x110a('0x8')](),controller[_0x110a('0x12')]);router[_0x110a('0x11')](_0x110a('0x13'),auth['isAuthenticated'](),controller[_0x110a('0x14')]);router[_0x110a('0x11')]('/:id/sections',auth[_0x110a('0x8')](),controller['addSections']);router[_0x110a('0x11')](_0x110a('0xf'),auth[_0x110a('0x8')](),controller[_0x110a('0x15')]);router['put'](_0x110a('0xb'),auth[_0x110a('0x8')](),controller[_0x110a('0x16')]);router[_0x110a('0x17')]('/:id',auth[_0x110a('0x8')](),controller[_0x110a('0x18')]);router[_0x110a('0x17')](_0x110a('0xd'),auth[_0x110a('0x8')](),controller[_0x110a('0x19')]);router['delete']('/:id/resources',auth['isAuthenticated'](),controller['removeResources']);module['exports']=router; \ No newline at end of file +var _0x5eb0=['isAuthenticated','index','/describe','describe','/:id','getSections','getResources','post','create','/:id/clone','clone','/:id/sections','/:id/resources','put','update','delete','destroy','removeSections','removeResources','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get'];(function(_0x5ebeaf,_0x2dc0b7){var _0x2a1de7=function(_0x4c7841){while(--_0x4c7841){_0x5ebeaf['push'](_0x5ebeaf['shift']());}};_0x2a1de7(++_0x2dc0b7);}(_0x5eb0,0x1c6));var _0x05eb=function(_0x22d04a,_0x2986bc){_0x22d04a=_0x22d04a-0x0;var _0x542e52=_0x5eb0[_0x22d04a];return _0x542e52;};'use strict';var multer=require(_0x05eb('0x0'));var util=require(_0x05eb('0x1'));var path=require(_0x05eb('0x2'));var timeout=require(_0x05eb('0x3'));var express=require(_0x05eb('0x4'));var router=express['Router']();var fs_extra=require(_0x05eb('0x5'));var auth=require(_0x05eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x05eb('0x7'));var controller=require(_0x05eb('0x8'));router[_0x05eb('0x9')]('/',auth[_0x05eb('0xa')](),controller[_0x05eb('0xb')]);router[_0x05eb('0x9')](_0x05eb('0xc'),auth[_0x05eb('0xa')](),controller[_0x05eb('0xd')]);router[_0x05eb('0x9')](_0x05eb('0xe'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/sections',auth[_0x05eb('0xa')](),controller[_0x05eb('0xf')]);router['get']('/:id/resources',auth[_0x05eb('0xa')](),controller[_0x05eb('0x10')]);router[_0x05eb('0x11')]('/',auth['isAuthenticated'](),controller[_0x05eb('0x12')]);router['post'](_0x05eb('0x13'),auth[_0x05eb('0xa')](),controller[_0x05eb('0x14')]);router[_0x05eb('0x11')](_0x05eb('0x15'),auth[_0x05eb('0xa')](),controller['addSections']);router[_0x05eb('0x11')](_0x05eb('0x16'),auth['isAuthenticated'](),controller['addResources']);router[_0x05eb('0x17')](_0x05eb('0xe'),auth['isAuthenticated'](),controller[_0x05eb('0x18')]);router[_0x05eb('0x19')](_0x05eb('0xe'),auth[_0x05eb('0xa')](),controller[_0x05eb('0x1a')]);router['delete']('/:id/sections',auth[_0x05eb('0xa')](),controller[_0x05eb('0x1b')]);router['delete'](_0x05eb('0x16'),auth[_0x05eb('0xa')](),controller[_0x05eb('0x1c')]);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 38c9ba7..b0f4fa5 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 _0xb3e0=['BOOLEAN','exports','STRING','setDataValue','crudPermissions','getDataValue'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb3e0,0x1e7));var _0x0b3e=function(_0x2cb441,_0x56ea22){_0x2cb441=_0x2cb441-0x0;var _0x290548=_0xb3e0[_0x2cb441];return _0x290548;};'use strict';var Sequelize=require('sequelize');module[_0x0b3e('0x0')]={'name':{'type':Sequelize[_0x0b3e('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x0b3e('0x1')],'set':function(_0x1f10a3){this[_0x0b3e('0x2')](_0x0b3e('0x3'),_0x1f10a3?_0x1f10a3['join'](''):[]);},'get':function(){return this['getDataValue'](_0x0b3e('0x3'))?this[_0x0b3e('0x4')](_0x0b3e('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0b3e('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x0b3e('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0b3e('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x0b3e('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x0b3e('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x0b3e('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0b3e('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe489=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x53e887,_0x5a4cb9){var _0x2a7cce=function(_0x4dbfc4){while(--_0x4dbfc4){_0x53e887['push'](_0x53e887['shift']());}};_0x2a7cce(++_0x5a4cb9);}(_0xe489,0x181));var _0x9e48=function(_0x2a25d6,_0x4b304b){_0x2a25d6=_0x2a25d6-0x0;var _0x3b6822=_0xe489[_0x2a25d6];return _0x3b6822;};'use strict';var Sequelize=require(_0x9e48('0x0'));module[_0x9e48('0x1')]={'name':{'type':Sequelize[_0x9e48('0x2')],'allowNull':![],'unique':_0x9e48('0x3')},'crudPermissions':{'type':Sequelize[_0x9e48('0x2')],'set':function(_0x2b369e){this[_0x9e48('0x4')](_0x9e48('0x5'),_0x2b369e?_0x2b369e[_0x9e48('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x9e48('0x5'))?this[_0x9e48('0x7')](_0x9e48('0x5'))[_0x9e48('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9e48('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 09efcba..46db60a 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 _0x5f7b=['to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','UserProfile','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','clone','get','omit','updatedAt','crudPermissions','body','createdAt','sequelize','transaction','UserProfileSection','each','UserProfileResource','sectionId','userProfileId','Resources','describe','push','removeSections','ids','includes','isEmpty','subsections','enabled','autoAssociation','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3074e2,_0x24b6aa){var _0x2f7362=function(_0x539e6b){while(--_0x539e6b){_0x3074e2['push'](_0x3074e2['shift']());}};_0x2f7362(++_0x24b6aa);}(_0x5f7b,0x14a));var _0xb5f7=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x5f7b[_0x4b7895];return _0x264180;};'use strict';var emlformat=require(_0xb5f7('0x0'));var rimraf=require(_0xb5f7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5f7('0x2'));var rp=require(_0xb5f7('0x3'));var moment=require(_0xb5f7('0x4'));var BPromise=require(_0xb5f7('0x5'));var Mustache=require(_0xb5f7('0x6'));var util=require(_0xb5f7('0x7'));var path=require(_0xb5f7('0x8'));var sox=require('sox');var csv=require(_0xb5f7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5f7('0xa'));var _=require(_0xb5f7('0xb'));var squel=require('squel');var crypto=require(_0xb5f7('0xc'));var jsforce=require(_0xb5f7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb5f7('0x9'));var querystring=require(_0xb5f7('0xe'));var Papa=require(_0xb5f7('0xf'));var Redis=require(_0xb5f7('0x10'));var authService=require(_0xb5f7('0x11'));var qs=require(_0xb5f7('0x12'));var as=require(_0xb5f7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5f7('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb5f7('0x15'));var licenseUtil=require(_0xb5f7('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb5f7('0x17')](config[_0xb5f7('0x18')],{'host':_0xb5f7('0x19'),'port':0x18eb});var socket=require(_0xb5f7('0x1a'))(new Redis(config[_0xb5f7('0x18')]));require('./userProfile.socket')[_0xb5f7('0x1b')](socket);function respondWithStatusCode(_0x30db32,_0x123afb){_0x123afb=_0x123afb||0xcc;return function(_0x375815){if(_0x375815){return _0x30db32[_0xb5f7('0x1c')](_0x123afb);}return _0x30db32[_0xb5f7('0x1d')](_0x123afb)['end']();};}function respondWithResult(_0xe5b295,_0x2162d2){_0x2162d2=_0x2162d2||0xc8;return function(_0x5931f6){if(_0x5931f6){return _0xe5b295[_0xb5f7('0x1d')](_0x2162d2)[_0xb5f7('0x1e')](_0x5931f6);}};}function respondWithFilteredResult(_0x53e739,_0x4e76bb){return function(_0x286b7f){if(_0x286b7f){var _0x23e296=typeof _0x4e76bb['offset']===_0xb5f7('0x1f')&&typeof _0x4e76bb[_0xb5f7('0x20')]===_0xb5f7('0x1f');var _0x27cc6f=_0x286b7f[_0xb5f7('0x21')];var _0x2b7588=_0x23e296?0x0:_0x4e76bb[_0xb5f7('0x22')];var _0xae34f7=_0x23e296?_0x286b7f['count']:_0x4e76bb[_0xb5f7('0x22')]+_0x4e76bb[_0xb5f7('0x20')];var _0x27a320;if(_0xae34f7>=_0x27cc6f){_0xae34f7=_0x27cc6f;_0x27a320=0xc8;}else{_0x27a320=0xce;}_0x53e739[_0xb5f7('0x1d')](_0x27a320);return _0x53e739[_0xb5f7('0x23')](_0xb5f7('0x24'),_0x2b7588+'-'+_0xae34f7+'/'+_0x27cc6f)['json'](_0x286b7f);}return null;};}function patchUpdates(_0x45d9ef){return function(_0x530d8e){try{jsonpatch[_0xb5f7('0x25')](_0x530d8e,_0x45d9ef,!![]);}catch(_0x612777){return BPromise['reject'](_0x612777);}return _0x530d8e[_0xb5f7('0x26')]();};}function saveUpdates(_0x4bcc47,_0x3045be){return function(_0x38c70b){if(_0x38c70b){return _0x38c70b[_0xb5f7('0x27')](_0x4bcc47)['then'](function(_0x6aacf5){return _0x6aacf5;});}return null;};}function removeEntity(_0xdd9c83,_0x4b7c30){return function(_0x43fdf4){if(_0x43fdf4){return _0x43fdf4[_0xb5f7('0x28')]()[_0xb5f7('0x29')](function(){_0xdd9c83[_0xb5f7('0x1d')](0xcc)[_0xb5f7('0x2a')]();});}};}function handleEntityNotFound(_0x481f56,_0x542853){return function(_0x2c4d35){if(!_0x2c4d35){_0x481f56[_0xb5f7('0x1c')](0x194);}return _0x2c4d35;};}function handleError(_0xb7a42f,_0x398d37){_0x398d37=_0x398d37||0x1f4;return function(_0x2fc208){logger[_0xb5f7('0x2b')](_0x2fc208[_0xb5f7('0x2c')]);if(_0x2fc208['name']){delete _0x2fc208[_0xb5f7('0x2d')];}_0xb7a42f[_0xb5f7('0x1d')](_0x398d37)[_0xb5f7('0x2e')](_0x2fc208);};}exports['index']=function(_0x4dc7e0,_0x33e2c1){var _0x1fec8e={},_0x2b0db9={},_0xf8e211={'count':0x0,'rows':[]};var _0xb98a3=_['map'](db[_0xb5f7('0x2f')][_0xb5f7('0x30')],function(_0x4c6e35){return{'name':_0x4c6e35[_0xb5f7('0x31')],'type':_0x4c6e35[_0xb5f7('0x32')][_0xb5f7('0x33')]};});_0x2b0db9[_0xb5f7('0x34')]=_[_0xb5f7('0x35')](_0xb98a3,'name');_0x2b0db9['query']=_[_0xb5f7('0x36')](_0x4dc7e0[_0xb5f7('0x37')]);_0x2b0db9[_0xb5f7('0x38')]=_['intersection'](_0x2b0db9[_0xb5f7('0x34')],_0x2b0db9[_0xb5f7('0x37')]);_0x1fec8e[_0xb5f7('0x39')]=_['intersection'](_0x2b0db9[_0xb5f7('0x34')],qs[_0xb5f7('0x3a')](_0x4dc7e0[_0xb5f7('0x37')][_0xb5f7('0x3a')]));_0x1fec8e[_0xb5f7('0x39')]=_0x1fec8e[_0xb5f7('0x39')]['length']?_0x1fec8e[_0xb5f7('0x39')]:_0x2b0db9[_0xb5f7('0x34')];if(!_0x4dc7e0[_0xb5f7('0x37')][_0xb5f7('0x3b')]('nolimit')){_0x1fec8e[_0xb5f7('0x20')]=qs[_0xb5f7('0x20')](_0x4dc7e0[_0xb5f7('0x37')][_0xb5f7('0x20')]);_0x1fec8e[_0xb5f7('0x22')]=qs[_0xb5f7('0x22')](_0x4dc7e0['query'][_0xb5f7('0x22')]);}_0x1fec8e[_0xb5f7('0x3c')]=qs[_0xb5f7('0x3d')](_0x4dc7e0[_0xb5f7('0x37')][_0xb5f7('0x3d')]);_0x1fec8e['where']=qs[_0xb5f7('0x38')](_[_0xb5f7('0x3e')](_0x4dc7e0[_0xb5f7('0x37')],_0x2b0db9[_0xb5f7('0x38')]),_0xb98a3);if(_0x4dc7e0['query'][_0xb5f7('0x3f')]){_0x1fec8e['where']=_[_0xb5f7('0x40')](_0x1fec8e['where'],{'$or':_[_0xb5f7('0x35')](_0xb98a3,function(_0x2fe620){if(_0x2fe620[_0xb5f7('0x32')]!==_0xb5f7('0x41')){var _0x2688a4={};_0x2688a4[_0x2fe620[_0xb5f7('0x2d')]]={'$like':'%'+_0x4dc7e0[_0xb5f7('0x37')]['filter']+'%'};return _0x2688a4;}})});}_0x1fec8e=_['merge']({},_0x1fec8e,_0x4dc7e0['options']);var _0x1ed37e={'where':_0x1fec8e[_0xb5f7('0x42')]};return db[_0xb5f7('0x2f')][_0xb5f7('0x21')](_0x1ed37e)[_0xb5f7('0x29')](function(_0x24dc48){_0xf8e211[_0xb5f7('0x21')]=_0x24dc48;if(_0x4dc7e0[_0xb5f7('0x37')][_0xb5f7('0x43')]){_0x1fec8e[_0xb5f7('0x44')]=[{'all':!![]}];}return db[_0xb5f7('0x2f')][_0xb5f7('0x45')](_0x1fec8e);})[_0xb5f7('0x29')](function(_0x333714){_0xf8e211[_0xb5f7('0x46')]=_0x333714;return _0xf8e211;})['then'](respondWithFilteredResult(_0x33e2c1,_0x1fec8e))[_0xb5f7('0x47')](handleError(_0x33e2c1,null));};exports[_0xb5f7('0x48')]=function(_0xf6b742,_0x3fc0c7){var _0x5540d7={'raw':![],'where':{'id':_0xf6b742[_0xb5f7('0x49')]['id']}},_0x4e4c46={};_0x4e4c46[_0xb5f7('0x34')]=_['keys'](db[_0xb5f7('0x2f')][_0xb5f7('0x30')]);_0x4e4c46[_0xb5f7('0x37')]=_[_0xb5f7('0x36')](_0xf6b742[_0xb5f7('0x37')]);_0x4e4c46[_0xb5f7('0x38')]=_['intersection'](_0x4e4c46[_0xb5f7('0x34')],_0x4e4c46['query']);_0x5540d7[_0xb5f7('0x39')]=_[_0xb5f7('0x4a')](_0x4e4c46[_0xb5f7('0x34')],qs[_0xb5f7('0x3a')](_0xf6b742[_0xb5f7('0x37')]['fields']));_0x5540d7[_0xb5f7('0x39')]=_0x5540d7['attributes']['length']?_0x5540d7[_0xb5f7('0x39')]:_0x4e4c46['model'];if(_0xf6b742['query']['includeAll']){_0x5540d7[_0xb5f7('0x44')]=[{'all':!![]}];}_0x5540d7=_[_0xb5f7('0x40')]({},_0x5540d7,_0xf6b742[_0xb5f7('0x4b')]);return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')](_0x5540d7)['then'](handleEntityNotFound(_0x3fc0c7,null))['then'](respondWithResult(_0x3fc0c7,null))[_0xb5f7('0x47')](handleError(_0x3fc0c7,null));};exports['create']=function(_0x41ff3a,_0x25a701){return db[_0xb5f7('0x2f')][_0xb5f7('0x4d')](_0x41ff3a['body'],{})[_0xb5f7('0x29')](respondWithResult(_0x25a701,0xc9))[_0xb5f7('0x47')](handleError(_0x25a701,null));};exports[_0xb5f7('0x4e')]=function(_0x4a59e5,_0xc07b4b){var _0x4da6bc={'where':{'id':_0x4a59e5['params']['id']}},_0x7146d4={};_0x7146d4['model']=_[_0xb5f7('0x36')](db[_0xb5f7('0x2f')][_0xb5f7('0x30')]);_0x4da6bc[_0xb5f7('0x39')]=_[_0xb5f7('0x4a')](_0x7146d4[_0xb5f7('0x34')],qs['fields'](_0x4a59e5[_0xb5f7('0x37')][_0xb5f7('0x3a')]));_0x4da6bc[_0xb5f7('0x39')]=_0x4da6bc['attributes']['length']?_0x4da6bc['attributes']:_0x7146d4[_0xb5f7('0x34')];if(_0x4a59e5[_0xb5f7('0x37')]['includeAll']){_0x4da6bc[_0xb5f7('0x44')]=[{'all':!![]}];}_0x4da6bc=_[_0xb5f7('0x40')]({},_0x4da6bc,_0x4a59e5[_0xb5f7('0x4b')]);return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')](_0x4da6bc)[_0xb5f7('0x29')](handleEntityNotFound(_0xc07b4b,null))[_0xb5f7('0x29')](function(_0x3da59f){if(_0x3da59f){var _0x16983f=_0x3da59f[_0xb5f7('0x4f')]({'plain':!![]});_0x16983f=qs[_0xb5f7('0x50')](_0x16983f,['id','createdAt',_0xb5f7('0x51'),_0xb5f7('0x52')]);_0x4a59e5[_0xb5f7('0x53')]=_[_0xb5f7('0x50')](_0x4a59e5[_0xb5f7('0x53')],['id',_0xb5f7('0x54'),'updatedAt']);return db[_0xb5f7('0x55')][_0xb5f7('0x56')](function(_0x2ab875){return db[_0xb5f7('0x2f')][_0xb5f7('0x4d')](_[_0xb5f7('0x40')](_0x16983f,_0x4a59e5[_0xb5f7('0x53')]),{'include':_0x4a59e5[_0xb5f7('0x37')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2ab875})['then'](function(_0x4f5ca5){var _0x218f1e=_0x4f5ca5[_0xb5f7('0x4f')]({'plain':!![]});return db[_0xb5f7('0x57')][_0xb5f7('0x45')]({'where':{'userProfileId':_0x4a59e5['params']['id']},'raw':!![]})[_0xb5f7('0x29')](function(_0x5e9c45){if(_0x5e9c45){return BPromise[_0xb5f7('0x58')](_0x5e9c45,function(_0x21e2f5){return new BPromise(function(_0x42c915,_0x5e5259){if(_0x21e2f5['autoAssociation']===null||_0x21e2f5['autoAssociation']===0x1)_0x42c915(null);return db[_0xb5f7('0x59')][_0xb5f7('0x45')]({'where':{'sectionId':_0x21e2f5['id']},'raw':!![]})[_0xb5f7('0x29')](function(_0x52bda2){var _0x31a14c=_['map'](_0x52bda2,function(_0x530a1d){return qs[_0xb5f7('0x50')](_0x530a1d,['id',_0xb5f7('0x54'),'updatedAt',_0xb5f7('0x5a')]);});_0x42c915(_0x31a14c);})[_0xb5f7('0x47')](function(_0x3d69a4){_0x5e5259(_0x3d69a4);});})['then'](function(_0x3c03aa){var _0x3cb60f=qs[_0xb5f7('0x50')](_0x21e2f5,['id',_0xb5f7('0x54'),'updatedAt']);_0x3cb60f[_0xb5f7('0x5b')]=_0x218f1e['id'];if(_0x3c03aa)_0x3cb60f['Resources']=_0x3c03aa;return _0x3cb60f;})[_0xb5f7('0x29')](function(_0x493b96){return db[_0xb5f7('0x57')][_0xb5f7('0x4d')](_0x493b96,{'include':[{'model':db['UserProfileResource'],'as':_0xb5f7('0x5c')}],'raw':!![],'transaction':_0x2ab875});});})[_0xb5f7('0x29')](function(){return _0x218f1e;});}});});});}})[_0xb5f7('0x29')](respondWithResult(_0xc07b4b,0xc9))[_0xb5f7('0x47')](handleError(_0xc07b4b,null));};exports[_0xb5f7('0x27')]=function(_0x3a0536,_0x5b9b56){if(_0x3a0536['body']['id']){delete _0x3a0536[_0xb5f7('0x53')]['id'];}return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')]({'where':{'id':_0x3a0536[_0xb5f7('0x49')]['id']}})[_0xb5f7('0x29')](handleEntityNotFound(_0x5b9b56,null))[_0xb5f7('0x29')](saveUpdates(_0x3a0536[_0xb5f7('0x53')],null))[_0xb5f7('0x29')](respondWithResult(_0x5b9b56,null))[_0xb5f7('0x47')](handleError(_0x5b9b56,null));};exports['destroy']=function(_0x436b88,_0x113d11){return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')]({'where':{'id':_0x436b88[_0xb5f7('0x49')]['id']}})[_0xb5f7('0x29')](handleEntityNotFound(_0x113d11,null))[_0xb5f7('0x29')](removeEntity(_0x113d11,null))[_0xb5f7('0x47')](handleError(_0x113d11,null));};exports[_0xb5f7('0x5d')]=function(_0x4dca05,_0x234e66){return db[_0xb5f7('0x2f')][_0xb5f7('0x5d')]()[_0xb5f7('0x29')](respondWithResult(_0x234e66,null))[_0xb5f7('0x47')](handleError(_0x234e66,null));};exports['addSections']=function(_0x2dbfd5,_0x231472){var _0x3e77f9=_0x2dbfd5[_0xb5f7('0x53')];return db['UserProfile'][_0xb5f7('0x4c')]({'where':{'id':_0x2dbfd5[_0xb5f7('0x49')]['id']}})[_0xb5f7('0x29')](handleEntityNotFound(_0x231472,null))[_0xb5f7('0x29')](function(_0x5caeee){if(_0x5caeee){return db[_0xb5f7('0x55')][_0xb5f7('0x56')](function(_0x5c654b){return db[_0xb5f7('0x57')][_0xb5f7('0x28')]({'where':{'userProfileId':_0x2dbfd5[_0xb5f7('0x49')]['id'],'sectionId':_[_0xb5f7('0x35')](_0x3e77f9,function(_0x140823){return _0x140823['sectionId'];})},'transaction':_0x5c654b})[_0xb5f7('0x29')](function(){var _0x951d72=_['map'](_0x3e77f9,function(_0xcac5fb){_0xcac5fb[_0xb5f7('0x5b')]=_0x2dbfd5[_0xb5f7('0x49')]['id'];return _0xcac5fb;});var _0x135b53=[];return BPromise[_0xb5f7('0x58')](_0x951d72,function(_0x2b6fa7){return db[_0xb5f7('0x57')][_0xb5f7('0x4d')](_0x2b6fa7,{'include':[{'model':db[_0xb5f7('0x59')],'as':_0xb5f7('0x5c')}],'raw':!![],'transaction':_0x5c654b})[_0xb5f7('0x29')](function(_0x4c26a5){_0x135b53[_0xb5f7('0x5e')](_0x4c26a5['get']({'plain':!![]}));});})[_0xb5f7('0x29')](function(){return _0x135b53;});});});}})[_0xb5f7('0x29')](function(_0x5c87a1){return _0x5c87a1;})[_0xb5f7('0x29')](respondWithResult(_0x231472,null))['catch'](handleError(_0x231472,null));};exports[_0xb5f7('0x5f')]=function(_0x2edc58,_0x1e86e6){var _0x4ca2a8;return db[_0xb5f7('0x2f')]['find']({'where':{'id':_0x2edc58[_0xb5f7('0x49')]['id']},'attributes':['id',_0xb5f7('0x2d')]})[_0xb5f7('0x29')](handleEntityNotFound(_0x1e86e6,null))[_0xb5f7('0x29')](function(_0x5913a2){if(_0x5913a2){_0x4ca2a8=_0x5913a2;return db[_0xb5f7('0x57')][_0xb5f7('0x28')]({'where':{'userProfileId':_0x2edc58['params']['id'],'sectionId':_0x2edc58[_0xb5f7('0x37')][_0xb5f7('0x60')]}});}})[_0xb5f7('0x29')](function(){return _0x4ca2a8;})[_0xb5f7('0x29')](respondWithStatusCode(_0x1e86e6,null))[_0xb5f7('0x47')](handleError(_0x1e86e6,null));};exports['getSections']=function(_0x75ab4f,_0x541927){var _0x5bc24c=[];var _0x2d7ce4=[];return db[_0xb5f7('0x57')][_0xb5f7('0x45')]({'where':{'userProfileId':_0x75ab4f[_0xb5f7('0x49')]['id']},'raw':!![]})[_0xb5f7('0x29')](function(_0x163939){_0x5bc24c=_[_0xb5f7('0x3f')](_0x163939,function(_0x26d669){return _0x26d669['enabled']===0x1||_[_0xb5f7('0x61')]([0x3eb,0x709],_0x26d669[_0xb5f7('0x5a')]);});if(!_[_0xb5f7('0x62')](_0x5bc24c)){return _['map'](_0x5bc24c,function(_0x23ce01){return _0x23ce01[_0xb5f7('0x5a')];});}else{return;}})['then'](function(_0xfc7120){if(_0xfc7120)_0x2d7ce4=_0xfc7120;if(_[_0xb5f7('0x61')](_0x2d7ce4,0x64)){var _0x162b04=_[_0xb5f7('0x4c')](_0x5bc24c,{'sectionId':0x64});return hasDefaultDashboard(_0x162b04)[_0xb5f7('0x29')](function(_0x4e1d66){return _[_0xb5f7('0x35')](_0x5bc24c,function(_0x2666a2){if(_0x2666a2[_0xb5f7('0x5a')]===0x64){_0x2666a2[_0xb5f7('0x63')]=_0x4e1d66;}return _0x2666a2;});});}else{return;}})[_0xb5f7('0x29')](function(_0x281c0a){if(_0x281c0a)_0x5bc24c=_0x281c0a;if(_[_0xb5f7('0x61')](_0x2d7ce4,0x3eb)){var _0x5e0d65=_[_0xb5f7('0x4c')](_0x5bc24c,{'sectionId':0x3eb});return getCustomDashboards(_0x5e0d65)['then'](function(_0x5ea702){return _[_0xb5f7('0x35')](_0x5bc24c,function(_0x29c3a8){if(_0x5e0d65['enabled']){if(_0x29c3a8[_0xb5f7('0x5a')]===0x3eb){_0x29c3a8[_0xb5f7('0x63')]=_0x5ea702;}}else{if(_0x29c3a8[_0xb5f7('0x5a')]===0x64){_0x29c3a8['subsections']=_0x5ea702;}}return _0x29c3a8;});});}else{return;}})['then'](function(_0x23aa64){if(_0x23aa64)_0x5bc24c=_0x23aa64;if(_[_0xb5f7('0x61')](_0x2d7ce4,0x709)){var _0x30decc=_[_0xb5f7('0x4c')](_0x5bc24c,{'sectionId':0x709});return getPlugins(_0x30decc)[_0xb5f7('0x29')](function(_0x387502){if(_0x30decc[_0xb5f7('0x64')]){return _[_0xb5f7('0x35')](_0x5bc24c,function(_0x59f302){if(_0x59f302['sectionId']===0x709){_0x59f302[_0xb5f7('0x63')]=_0x387502;}return _0x59f302;});}else{var _0x440c7b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x387502};var _0x5db186=_[_0xb5f7('0x35')](_0x5bc24c);_0x5db186[_0xb5f7('0x5e')](_0x440c7b);return _0x5db186;}});}else{return;}})[_0xb5f7('0x29')](function(_0x99f231){if(_0x99f231)_0x5bc24c=_0x99f231;return _['filter'](_0x5bc24c,['enabled',0x1]);})[_0xb5f7('0x29')](respondWithResult(_0x541927,null))[_0xb5f7('0x47')](handleError(_0x541927,null));};function hasDefaultDashboard(_0x59a92f){var _0x50f9cb=[0x65];return new BPromise(function(_0x55ffc9,_0x277e47){try{if(_0x59a92f[_0xb5f7('0x65')]){_0x55ffc9(_0x50f9cb);}else{return db[_0xb5f7('0x59')][_0xb5f7('0x66')]({'where':{'sectionId':_0x59a92f['id']},'raw':!![]})[_0xb5f7('0x29')](function(_0x3c0767){_0x3c0767?_0x55ffc9(_0x50f9cb):_0x55ffc9();});}}catch(_0x3dadfd){_0x277e47(_0x3dadfd);}});}function getCustomDashboards(_0x311366){var _0xd5f429=[];return new BPromise(function(_0x55f6d9,_0x51ebea){try{if(_0x311366['autoAssociation']){return db[_0xb5f7('0x67')][_0xb5f7('0x45')]({'raw':!![]})[_0xb5f7('0x29')](function(_0x5112bf){_0x5112bf[_0xb5f7('0x68')](function(_0x4066a9){_0xd5f429['push'](_0x4066a9['id']+0x1869f);});_0x55f6d9(_0xd5f429);});}else{return db[_0xb5f7('0x59')]['findAll']({'where':{'sectionId':_0x311366['id']},'raw':!![]})['then'](function(_0x25f3be){_0x25f3be['forEach'](function(_0x372702){_0xd5f429[_0xb5f7('0x5e')](_0x372702[_0xb5f7('0x69')]+0x1869f);});_0x55f6d9(_0xd5f429);});}}catch(_0x34053b){_0x51ebea(_0x34053b);}});}function getPlugins(_0x23703a){var _0x5abbbc=[];return new BPromise(function(_0x122c0d,_0x539d14){try{if(_0x23703a[_0xb5f7('0x65')]){return db[_0xb5f7('0x6a')][_0xb5f7('0x45')]({'raw':!![]})[_0xb5f7('0x29')](function(_0x162d00){_0x162d00[_0xb5f7('0x68')](function(_0x4563f7){_0x5abbbc[_0xb5f7('0x5e')](_0x4563f7['id']+0x15b38);});_0x122c0d(_0x5abbbc);});}else{return db['UserProfileResource'][_0xb5f7('0x45')]({'where':{'sectionId':_0x23703a['id']},'raw':!![]})[_0xb5f7('0x29')](function(_0x24131a){_0x24131a[_0xb5f7('0x68')](function(_0xc6ebda){_0x5abbbc[_0xb5f7('0x5e')](_0xc6ebda[_0xb5f7('0x69')]+0x15b38);});_0x122c0d(_0x5abbbc);});}}catch(_0x158628){_0x539d14(_0x158628);}});}exports[_0xb5f7('0x6b')]=function(_0x3c7c40,_0x1ce934){return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')]({'where':{'id':_0x3c7c40[_0xb5f7('0x49')]['id']}})[_0xb5f7('0x29')](handleEntityNotFound(_0x1ce934,null))[_0xb5f7('0x29')](function(_0x465135){if(_0x465135){return db['sequelize'][_0xb5f7('0x56')](function(_0x2d8d3e){return db[_0xb5f7('0x57')][_0xb5f7('0x45')]({'where':{'userProfileId':_0x3c7c40[_0xb5f7('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xb5f7('0x29')](function(_0x2cd543){if(_0x2cd543){return db[_0xb5f7('0x57')][_0xb5f7('0x28')]({'where':{'userProfileId':_0x3c7c40[_0xb5f7('0x49')]['id'],'id':_['map'](_0x2cd543,function(_0x364092){return _0x364092['id'];})},'transaction':_0x2d8d3e});}})[_0xb5f7('0x29')](function(_0xf439e8){var _0x436856=_['map'](_0x3c7c40[_0xb5f7('0x53')],function(_0xbc0dbb){_0xbc0dbb['userProfileId']=_0x3c7c40[_0xb5f7('0x49')]['id'];return _0xbc0dbb;});return db[_0xb5f7('0x57')][_0xb5f7('0x6c')](_0x436856,{'raw':!![],'transaction':_0x2d8d3e});})[_0xb5f7('0x29')](function(_0x560bc9){var _0x30c262=_[_0xb5f7('0x3f')](_[_0xb5f7('0x35')](_0x560bc9,function(_0x264011){return _0x264011[_0xb5f7('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x30c262){return db[_0xb5f7('0x57')][_0xb5f7('0x45')]({'where':{'userProfileId':_0x3c7c40[_0xb5f7('0x49')]['id'],'sectionId':_[_0xb5f7('0x35')](_0x30c262,function(_0x5c5aef){return _0x5c5aef[_0xb5f7('0x5a')];})},'attributes':['id',_0xb5f7('0x5a')],'raw':!![]})['then'](function(_0x2adf6f){var _0x4f51a5=_[_0xb5f7('0x35')](_0x3c7c40[_0xb5f7('0x53')],function(_0x151ee9){_0x151ee9['userProfileId']=_0x3c7c40['params']['id'];return _0x151ee9;});return db[_0xb5f7('0x59')][_0xb5f7('0x6c')](_0x4f51a5,{'raw':!![],'transaction':_0x2d8d3e});});}})[_0xb5f7('0x47')](handleError(_0x1ce934,null));});}})['then'](function(_0x51e22a){var _0x16052b=_[_0xb5f7('0x35')](_0x51e22a,function(_0x52ebf2){return _0x52ebf2['get']({'plain':!![]});});})[_0xb5f7('0x29')](respondWithResult(_0x1ce934,null))[_0xb5f7('0x47')](handleError(_0x1ce934,null));};exports[_0xb5f7('0x6d')]=function(_0x294e81,_0x4783e4,_0x310b48){return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')]({'where':{'id':_0x294e81[_0xb5f7('0x49')]['id']}})['then'](handleEntityNotFound(_0x4783e4,null))[_0xb5f7('0x29')](function(_0x49f9e7){if(_0x49f9e7){return _0x49f9e7[_0xb5f7('0x6d')](_0x294e81[_0xb5f7('0x37')]['ids']);}})[_0xb5f7('0x29')](respondWithStatusCode(_0x4783e4,null))[_0xb5f7('0x47')](handleError(_0x4783e4,null));};exports['getResources']=function(_0x328389,_0x3ef28c){var _0x5240c8={};if(!_0x328389['query']['section'])throw new Error(_0xb5f7('0x6e'));if(!_0x328389['query'][_0xb5f7('0x3b')]('nolimit')){_0x5240c8[_0xb5f7('0x20')]=qs[_0xb5f7('0x20')](_0x328389[_0xb5f7('0x37')]['limit']);_0x5240c8['offset']=qs[_0xb5f7('0x22')](_0x328389['query']['offset']);}return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')]({'where':{'id':_0x328389[_0xb5f7('0x49')]['id']}})['then'](function(_0x5ea504){if(!_0x5ea504)throw new Error(_0xb5f7('0x6f')+_0x328389[_0xb5f7('0x49')]['id']);return db[_0xb5f7('0x2f')][_0xb5f7('0x70')](_0x328389);})[_0xb5f7('0x29')](respondWithFilteredResult(_0x3ef28c,_0x5240c8))[_0xb5f7('0x47')](handleError(_0x3ef28c,null));}; \ No newline at end of file +var _0xaaee=['nolimit','order','pick','where','merge','map','VIRTUAL','options','count','include','findAll','show','rawAttributes','includeAll','catch','create','body','clone','params','find','get','omit','createdAt','crudPermissions','updatedAt','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','UserProfileSection','push','removeSections','ids','filter','includes','isEmpty','subsections','enabled','findOne','forEach','resourceId','Plugin','addResources','sequelize','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','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/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','json','undefined','limit','offset','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','UserProfile','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x174658,_0x49d391){var _0x9d1d1a=function(_0x19f723){while(--_0x19f723){_0x174658['push'](_0x174658['shift']());}};_0x9d1d1a(++_0x49d391);}(_0xaaee,0xa9));var _0xeaae=function(_0x1f3b1c,_0x481f75){_0x1f3b1c=_0x1f3b1c-0x0;var _0x573b21=_0xaaee[_0x1f3b1c];return _0x573b21;};'use strict';var emlformat=require(_0xeaae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeaae('0x1'));var jsonpatch=require(_0xeaae('0x2'));var rp=require('request-promise');var moment=require(_0xeaae('0x3'));var BPromise=require(_0xeaae('0x4'));var Mustache=require(_0xeaae('0x5'));var util=require(_0xeaae('0x6'));var path=require('path');var sox=require(_0xeaae('0x7'));var csv=require(_0xeaae('0x8'));var ejs=require(_0xeaae('0x9'));var fs=require('fs');var fs_extra=require(_0xeaae('0xa'));var _=require(_0xeaae('0xb'));var squel=require(_0xeaae('0xc'));var crypto=require('crypto');var jsforce=require(_0xeaae('0xd'));var deskjs=require(_0xeaae('0xe'));var toCsv=require(_0xeaae('0x8'));var querystring=require(_0xeaae('0xf'));var Papa=require(_0xeaae('0x10'));var Redis=require(_0xeaae('0x11'));var authService=require(_0xeaae('0x12'));var qs=require(_0xeaae('0x13'));var as=require(_0xeaae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeaae('0x15'))(_0xeaae('0x16'));var utils=require(_0xeaae('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeaae('0x18'))['db'];config[_0xeaae('0x19')]=_[_0xeaae('0x1a')](config['redis'],{'host':_0xeaae('0x1b'),'port':0x18eb});var socket=require(_0xeaae('0x1c'))(new Redis(config[_0xeaae('0x19')]));require(_0xeaae('0x1d'))['register'](socket);function respondWithStatusCode(_0x4d3766,_0x1a75b7){_0x1a75b7=_0x1a75b7||0xcc;return function(_0x1b4f7e){if(_0x1b4f7e){return _0x4d3766[_0xeaae('0x1e')](_0x1a75b7);}return _0x4d3766[_0xeaae('0x1f')](_0x1a75b7)['end']();};}function respondWithResult(_0x1dd48f,_0x5be794){_0x5be794=_0x5be794||0xc8;return function(_0x29bd11){if(_0x29bd11){return _0x1dd48f[_0xeaae('0x1f')](_0x5be794)[_0xeaae('0x20')](_0x29bd11);}};}function respondWithFilteredResult(_0x355f39,_0x574ff7){return function(_0x538e3d){if(_0x538e3d){var _0x5d5aa1=typeof _0x574ff7['offset']===_0xeaae('0x21')&&typeof _0x574ff7[_0xeaae('0x22')]==='undefined';var _0x4667ff=_0x538e3d['count'];var _0x1ac7a2=_0x5d5aa1?0x0:_0x574ff7[_0xeaae('0x23')];var _0x3491a6=_0x5d5aa1?_0x538e3d['count']:_0x574ff7[_0xeaae('0x23')]+_0x574ff7[_0xeaae('0x22')];var _0x4c925a;if(_0x3491a6>=_0x4667ff){_0x3491a6=_0x4667ff;_0x4c925a=0xc8;}else{_0x4c925a=0xce;}_0x355f39['status'](_0x4c925a);return _0x355f39[_0xeaae('0x24')]('Content-Range',_0x1ac7a2+'-'+_0x3491a6+'/'+_0x4667ff)['json'](_0x538e3d);}return null;};}function patchUpdates(_0x12f1b0){return function(_0x20d632){try{jsonpatch[_0xeaae('0x25')](_0x20d632,_0x12f1b0,!![]);}catch(_0x25945c){return BPromise[_0xeaae('0x26')](_0x25945c);}return _0x20d632[_0xeaae('0x27')]();};}function saveUpdates(_0x2a961c,_0x3881f3){return function(_0x31801a){if(_0x31801a){return _0x31801a[_0xeaae('0x28')](_0x2a961c)['then'](function(_0xa7fa13){return _0xa7fa13;});}return null;};}function removeEntity(_0x124b21,_0x10a0f2){return function(_0x337bdb){if(_0x337bdb){return _0x337bdb[_0xeaae('0x29')]()[_0xeaae('0x2a')](function(){_0x124b21[_0xeaae('0x1f')](0xcc)[_0xeaae('0x2b')]();});}};}function handleEntityNotFound(_0x58ac1d,_0x51c515){return function(_0x261ccd){if(!_0x261ccd){_0x58ac1d[_0xeaae('0x1e')](0x194);}return _0x261ccd;};}function handleError(_0x3ee762,_0x5d2a26){_0x5d2a26=_0x5d2a26||0x1f4;return function(_0x294938){logger[_0xeaae('0x2c')](_0x294938[_0xeaae('0x2d')]);if(_0x294938[_0xeaae('0x2e')]){delete _0x294938[_0xeaae('0x2e')];}_0x3ee762[_0xeaae('0x1f')](_0x5d2a26)[_0xeaae('0x2f')](_0x294938);};}exports[_0xeaae('0x30')]=function(_0x38c80c,_0x24f0f2){var _0x48aeca={},_0x43a759={},_0x2363fa={'count':0x0,'rows':[]};var _0x4c938f=_['map'](db[_0xeaae('0x31')]['rawAttributes'],function(_0x1dfe6b){return{'name':_0x1dfe6b[_0xeaae('0x32')],'type':_0x1dfe6b[_0xeaae('0x33')]['key']};});_0x43a759['model']=_['map'](_0x4c938f,_0xeaae('0x2e'));_0x43a759['query']=_[_0xeaae('0x34')](_0x38c80c[_0xeaae('0x35')]);_0x43a759[_0xeaae('0x36')]=_['intersection'](_0x43a759[_0xeaae('0x37')],_0x43a759[_0xeaae('0x35')]);_0x48aeca[_0xeaae('0x38')]=_[_0xeaae('0x39')](_0x43a759[_0xeaae('0x37')],qs['fields'](_0x38c80c[_0xeaae('0x35')][_0xeaae('0x3a')]));_0x48aeca[_0xeaae('0x38')]=_0x48aeca[_0xeaae('0x38')][_0xeaae('0x3b')]?_0x48aeca[_0xeaae('0x38')]:_0x43a759[_0xeaae('0x37')];if(!_0x38c80c[_0xeaae('0x35')][_0xeaae('0x3c')](_0xeaae('0x3d'))){_0x48aeca[_0xeaae('0x22')]=qs['limit'](_0x38c80c['query']['limit']);_0x48aeca['offset']=qs['offset'](_0x38c80c[_0xeaae('0x35')]['offset']);}_0x48aeca[_0xeaae('0x3e')]=qs['sort'](_0x38c80c[_0xeaae('0x35')]['sort']);_0x48aeca['where']=qs[_0xeaae('0x36')](_[_0xeaae('0x3f')](_0x38c80c['query'],_0x43a759[_0xeaae('0x36')]),_0x4c938f);if(_0x38c80c[_0xeaae('0x35')]['filter']){_0x48aeca[_0xeaae('0x40')]=_[_0xeaae('0x41')](_0x48aeca[_0xeaae('0x40')],{'$or':_[_0xeaae('0x42')](_0x4c938f,function(_0x31ccc7){if(_0x31ccc7['type']!==_0xeaae('0x43')){var _0x53b310={};_0x53b310[_0x31ccc7[_0xeaae('0x2e')]]={'$like':'%'+_0x38c80c[_0xeaae('0x35')]['filter']+'%'};return _0x53b310;}})});}_0x48aeca=_[_0xeaae('0x41')]({},_0x48aeca,_0x38c80c[_0xeaae('0x44')]);var _0x412843={'where':_0x48aeca['where']};return db[_0xeaae('0x31')][_0xeaae('0x45')](_0x412843)[_0xeaae('0x2a')](function(_0x40d844){_0x2363fa[_0xeaae('0x45')]=_0x40d844;if(_0x38c80c['query']['includeAll']){_0x48aeca[_0xeaae('0x46')]=[{'all':!![]}];}return db[_0xeaae('0x31')][_0xeaae('0x47')](_0x48aeca);})['then'](function(_0x467a65){_0x2363fa['rows']=_0x467a65;return _0x2363fa;})[_0xeaae('0x2a')](respondWithFilteredResult(_0x24f0f2,_0x48aeca))['catch'](handleError(_0x24f0f2,null));};exports[_0xeaae('0x48')]=function(_0x456ab6,_0x24b855){var _0x4c5c73={'raw':![],'where':{'id':_0x456ab6['params']['id']}},_0x19dce2={};_0x19dce2[_0xeaae('0x37')]=_['keys'](db['UserProfile'][_0xeaae('0x49')]);_0x19dce2[_0xeaae('0x35')]=_['keys'](_0x456ab6[_0xeaae('0x35')]);_0x19dce2[_0xeaae('0x36')]=_[_0xeaae('0x39')](_0x19dce2[_0xeaae('0x37')],_0x19dce2[_0xeaae('0x35')]);_0x4c5c73[_0xeaae('0x38')]=_['intersection'](_0x19dce2[_0xeaae('0x37')],qs[_0xeaae('0x3a')](_0x456ab6[_0xeaae('0x35')]['fields']));_0x4c5c73['attributes']=_0x4c5c73[_0xeaae('0x38')][_0xeaae('0x3b')]?_0x4c5c73['attributes']:_0x19dce2[_0xeaae('0x37')];if(_0x456ab6[_0xeaae('0x35')][_0xeaae('0x4a')]){_0x4c5c73[_0xeaae('0x46')]=[{'all':!![]}];}_0x4c5c73=_[_0xeaae('0x41')]({},_0x4c5c73,_0x456ab6['options']);return db[_0xeaae('0x31')]['find'](_0x4c5c73)['then'](handleEntityNotFound(_0x24b855,null))[_0xeaae('0x2a')](respondWithResult(_0x24b855,null))[_0xeaae('0x4b')](handleError(_0x24b855,null));};exports[_0xeaae('0x4c')]=function(_0x285dfe,_0x235b0d){return db[_0xeaae('0x31')][_0xeaae('0x4c')](_0x285dfe[_0xeaae('0x4d')],{})[_0xeaae('0x2a')](respondWithResult(_0x235b0d,0xc9))[_0xeaae('0x4b')](handleError(_0x235b0d,null));};exports[_0xeaae('0x4e')]=function(_0x1312bb,_0xa77659){var _0x451553={'where':{'id':_0x1312bb[_0xeaae('0x4f')]['id']}},_0x5be668={};_0x5be668['model']=_[_0xeaae('0x34')](db[_0xeaae('0x31')][_0xeaae('0x49')]);_0x451553[_0xeaae('0x38')]=_['intersection'](_0x5be668[_0xeaae('0x37')],qs['fields'](_0x1312bb[_0xeaae('0x35')][_0xeaae('0x3a')]));_0x451553[_0xeaae('0x38')]=_0x451553[_0xeaae('0x38')]['length']?_0x451553[_0xeaae('0x38')]:_0x5be668[_0xeaae('0x37')];if(_0x1312bb[_0xeaae('0x35')][_0xeaae('0x4a')]){_0x451553['include']=[{'all':!![]}];}_0x451553=_[_0xeaae('0x41')]({},_0x451553,_0x1312bb[_0xeaae('0x44')]);return db['UserProfile'][_0xeaae('0x50')](_0x451553)[_0xeaae('0x2a')](handleEntityNotFound(_0xa77659,null))[_0xeaae('0x2a')](function(_0x2a9a84){if(_0x2a9a84){var _0xe8e418=_0x2a9a84[_0xeaae('0x51')]({'plain':!![]});_0xe8e418=qs[_0xeaae('0x52')](_0xe8e418,['id',_0xeaae('0x53'),'updatedAt',_0xeaae('0x54')]);_0x1312bb[_0xeaae('0x4d')]=_[_0xeaae('0x52')](_0x1312bb[_0xeaae('0x4d')],['id',_0xeaae('0x53'),_0xeaae('0x55')]);return db['sequelize'][_0xeaae('0x56')](function(_0x47a350){return db[_0xeaae('0x31')]['create'](_[_0xeaae('0x41')](_0xe8e418,_0x1312bb[_0xeaae('0x4d')]),{'include':_0x1312bb['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x47a350})[_0xeaae('0x2a')](function(_0x3d7d1b){var _0x19f230=_0x3d7d1b[_0xeaae('0x51')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x1312bb[_0xeaae('0x4f')]['id']},'raw':!![]})[_0xeaae('0x2a')](function(_0x46d1c1){if(_0x46d1c1){return BPromise[_0xeaae('0x57')](_0x46d1c1,function(_0x8005ec){return new BPromise(function(_0x52e20d,_0x570bb9){if(_0x8005ec[_0xeaae('0x58')]===null||_0x8005ec['autoAssociation']===0x1)_0x52e20d(null);return db[_0xeaae('0x59')][_0xeaae('0x47')]({'where':{'sectionId':_0x8005ec['id']},'raw':!![]})[_0xeaae('0x2a')](function(_0x4d9fce){var _0x2f290f=_[_0xeaae('0x42')](_0x4d9fce,function(_0x59881d){return qs[_0xeaae('0x52')](_0x59881d,['id',_0xeaae('0x53'),_0xeaae('0x55'),_0xeaae('0x5a')]);});_0x52e20d(_0x2f290f);})[_0xeaae('0x4b')](function(_0x397ba7){_0x570bb9(_0x397ba7);});})[_0xeaae('0x2a')](function(_0x24a36b){var _0x2975c8=qs[_0xeaae('0x52')](_0x8005ec,['id',_0xeaae('0x53'),_0xeaae('0x55')]);_0x2975c8[_0xeaae('0x5b')]=_0x19f230['id'];if(_0x24a36b)_0x2975c8[_0xeaae('0x5c')]=_0x24a36b;return _0x2975c8;})[_0xeaae('0x2a')](function(_0x52bc70){return db['UserProfileSection'][_0xeaae('0x4c')](_0x52bc70,{'include':[{'model':db[_0xeaae('0x59')],'as':_0xeaae('0x5c')}],'raw':!![],'transaction':_0x47a350});});})[_0xeaae('0x2a')](function(){return _0x19f230;});}});});});}})[_0xeaae('0x2a')](respondWithResult(_0xa77659,0xc9))[_0xeaae('0x4b')](handleError(_0xa77659,null));};exports[_0xeaae('0x28')]=function(_0x52f51c,_0x45886d){if(_0x52f51c[_0xeaae('0x4d')]['id']){delete _0x52f51c[_0xeaae('0x4d')]['id'];}return db[_0xeaae('0x31')][_0xeaae('0x50')]({'where':{'id':_0x52f51c['params']['id']}})['then'](handleEntityNotFound(_0x45886d,null))[_0xeaae('0x2a')](saveUpdates(_0x52f51c[_0xeaae('0x4d')],null))[_0xeaae('0x2a')](respondWithResult(_0x45886d,null))[_0xeaae('0x4b')](handleError(_0x45886d,null));};exports[_0xeaae('0x29')]=function(_0x4b4171,_0x1abd87){return db['UserProfile'][_0xeaae('0x50')]({'where':{'id':_0x4b4171[_0xeaae('0x4f')]['id']}})[_0xeaae('0x2a')](handleEntityNotFound(_0x1abd87,null))[_0xeaae('0x2a')](removeEntity(_0x1abd87,null))['catch'](handleError(_0x1abd87,null));};exports[_0xeaae('0x5d')]=function(_0x2f701c,_0x462ad5){return db[_0xeaae('0x31')][_0xeaae('0x5d')]()[_0xeaae('0x2a')](respondWithResult(_0x462ad5,null))[_0xeaae('0x4b')](handleError(_0x462ad5,null));};exports[_0xeaae('0x5e')]=function(_0x2cf10,_0x2a0b33){var _0x513a7e=_0x2cf10[_0xeaae('0x4d')];return db[_0xeaae('0x31')]['find']({'where':{'id':_0x2cf10[_0xeaae('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2a0b33,null))[_0xeaae('0x2a')](function(_0x23266f){if(_0x23266f){return db['sequelize']['transaction'](function(_0x1af83b){return db[_0xeaae('0x5f')][_0xeaae('0x29')]({'where':{'userProfileId':_0x2cf10[_0xeaae('0x4f')]['id'],'sectionId':_[_0xeaae('0x42')](_0x513a7e,function(_0x5a9e4e){return _0x5a9e4e[_0xeaae('0x5a')];})},'transaction':_0x1af83b})[_0xeaae('0x2a')](function(){var _0x3cd27e=_[_0xeaae('0x42')](_0x513a7e,function(_0x333f03){_0x333f03[_0xeaae('0x5b')]=_0x2cf10[_0xeaae('0x4f')]['id'];return _0x333f03;});var _0x1d42a9=[];return BPromise['each'](_0x3cd27e,function(_0x3a1c81){return db[_0xeaae('0x5f')][_0xeaae('0x4c')](_0x3a1c81,{'include':[{'model':db[_0xeaae('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x1af83b})['then'](function(_0x5f22fa){_0x1d42a9[_0xeaae('0x60')](_0x5f22fa[_0xeaae('0x51')]({'plain':!![]}));});})[_0xeaae('0x2a')](function(){return _0x1d42a9;});});});}})[_0xeaae('0x2a')](function(_0x4c22f7){return _0x4c22f7;})[_0xeaae('0x2a')](respondWithResult(_0x2a0b33,null))['catch'](handleError(_0x2a0b33,null));};exports[_0xeaae('0x61')]=function(_0x4b3f81,_0x1c529d){var _0x551df3;return db[_0xeaae('0x31')][_0xeaae('0x50')]({'where':{'id':_0x4b3f81[_0xeaae('0x4f')]['id']},'attributes':['id',_0xeaae('0x2e')]})[_0xeaae('0x2a')](handleEntityNotFound(_0x1c529d,null))['then'](function(_0x362629){if(_0x362629){_0x551df3=_0x362629;return db['UserProfileSection'][_0xeaae('0x29')]({'where':{'userProfileId':_0x4b3f81[_0xeaae('0x4f')]['id'],'sectionId':_0x4b3f81[_0xeaae('0x35')][_0xeaae('0x62')]}});}})['then'](function(){return _0x551df3;})['then'](respondWithStatusCode(_0x1c529d,null))[_0xeaae('0x4b')](handleError(_0x1c529d,null));};exports['getSections']=function(_0x2595e3,_0x2b44bd){var _0x48b5f7=[];var _0x42b694=[];return db['UserProfileSection'][_0xeaae('0x47')]({'where':{'userProfileId':_0x2595e3['params']['id']},'raw':!![]})['then'](function(_0x40c8cf){_0x48b5f7=_[_0xeaae('0x63')](_0x40c8cf,function(_0x42d002){return _0x42d002['enabled']===0x1||_[_0xeaae('0x64')]([0x3eb,0x709],_0x42d002[_0xeaae('0x5a')]);});if(!_[_0xeaae('0x65')](_0x48b5f7)){return _[_0xeaae('0x42')](_0x48b5f7,function(_0x3366c1){return _0x3366c1[_0xeaae('0x5a')];});}else{return;}})[_0xeaae('0x2a')](function(_0x55dc28){if(_0x55dc28)_0x42b694=_0x55dc28;if(_['includes'](_0x42b694,0x64)){var _0x589699=_['find'](_0x48b5f7,{'sectionId':0x64});return hasDefaultDashboard(_0x589699)['then'](function(_0x17c969){return _[_0xeaae('0x42')](_0x48b5f7,function(_0x224514){if(_0x224514[_0xeaae('0x5a')]===0x64){_0x224514[_0xeaae('0x66')]=_0x17c969;}return _0x224514;});});}else{return;}})[_0xeaae('0x2a')](function(_0x2b2427){if(_0x2b2427)_0x48b5f7=_0x2b2427;if(_['includes'](_0x42b694,0x3eb)){var _0x53a485=_[_0xeaae('0x50')](_0x48b5f7,{'sectionId':0x3eb});return getCustomDashboards(_0x53a485)['then'](function(_0x545ec9){return _[_0xeaae('0x42')](_0x48b5f7,function(_0x11fe79){if(_0x53a485['enabled']){if(_0x11fe79[_0xeaae('0x5a')]===0x3eb){_0x11fe79[_0xeaae('0x66')]=_0x545ec9;}}else{if(_0x11fe79[_0xeaae('0x5a')]===0x64){_0x11fe79[_0xeaae('0x66')]=_0x545ec9;}}return _0x11fe79;});});}else{return;}})[_0xeaae('0x2a')](function(_0x143969){if(_0x143969)_0x48b5f7=_0x143969;if(_[_0xeaae('0x64')](_0x42b694,0x709)){var _0x43bc34=_[_0xeaae('0x50')](_0x48b5f7,{'sectionId':0x709});return getPlugins(_0x43bc34)['then'](function(_0x14bd5f){if(_0x43bc34['enabled']){return _[_0xeaae('0x42')](_0x48b5f7,function(_0x56eb3f){if(_0x56eb3f[_0xeaae('0x5a')]===0x709){_0x56eb3f['subsections']=_0x14bd5f;}return _0x56eb3f;});}else{var _0x3fa3f9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x14bd5f};var _0x4b35f2=_[_0xeaae('0x42')](_0x48b5f7);_0x4b35f2[_0xeaae('0x60')](_0x3fa3f9);return _0x4b35f2;}});}else{return;}})[_0xeaae('0x2a')](function(_0x1b3992){if(_0x1b3992)_0x48b5f7=_0x1b3992;return _['filter'](_0x48b5f7,[_0xeaae('0x67'),0x1]);})['then'](respondWithResult(_0x2b44bd,null))[_0xeaae('0x4b')](handleError(_0x2b44bd,null));};function hasDefaultDashboard(_0x4098f6){var _0x1c1ceb=[0x65];return new BPromise(function(_0x5c1868,_0x4c7a7b){try{if(_0x4098f6[_0xeaae('0x58')]){_0x5c1868(_0x1c1ceb);}else{return db[_0xeaae('0x59')][_0xeaae('0x68')]({'where':{'sectionId':_0x4098f6['id']},'raw':!![]})[_0xeaae('0x2a')](function(_0x3e0591){_0x3e0591?_0x5c1868(_0x1c1ceb):_0x5c1868();});}}catch(_0x3055b5){_0x4c7a7b(_0x3055b5);}});}function getCustomDashboards(_0x47cc16){var _0x1c1223=[];return new BPromise(function(_0x3a0337,_0xb81906){try{if(_0x47cc16[_0xeaae('0x58')]){return db['Dashboard'][_0xeaae('0x47')]({'raw':!![]})[_0xeaae('0x2a')](function(_0x10e519){_0x10e519[_0xeaae('0x69')](function(_0x2638f5){_0x1c1223[_0xeaae('0x60')](_0x2638f5['id']+0x1869f);});_0x3a0337(_0x1c1223);});}else{return db[_0xeaae('0x59')][_0xeaae('0x47')]({'where':{'sectionId':_0x47cc16['id']},'raw':!![]})[_0xeaae('0x2a')](function(_0x18fabf){_0x18fabf[_0xeaae('0x69')](function(_0x4272d8){_0x1c1223[_0xeaae('0x60')](_0x4272d8[_0xeaae('0x6a')]+0x1869f);});_0x3a0337(_0x1c1223);});}}catch(_0x398612){_0xb81906(_0x398612);}});}function getPlugins(_0x1b3c11){var _0xdf4dc3=[];return new BPromise(function(_0x6e584,_0x3ed552){try{if(_0x1b3c11[_0xeaae('0x58')]){return db[_0xeaae('0x6b')]['findAll']({'raw':!![]})[_0xeaae('0x2a')](function(_0x1a4dff){_0x1a4dff[_0xeaae('0x69')](function(_0x30afdb){_0xdf4dc3[_0xeaae('0x60')](_0x30afdb['id']+0x15b38);});_0x6e584(_0xdf4dc3);});}else{return db[_0xeaae('0x59')][_0xeaae('0x47')]({'where':{'sectionId':_0x1b3c11['id']},'raw':!![]})[_0xeaae('0x2a')](function(_0x54b53f){_0x54b53f['forEach'](function(_0x3a0b84){_0xdf4dc3[_0xeaae('0x60')](_0x3a0b84[_0xeaae('0x6a')]+0x15b38);});_0x6e584(_0xdf4dc3);});}}catch(_0x2df97d){_0x3ed552(_0x2df97d);}});}exports[_0xeaae('0x6c')]=function(_0x45a081,_0x5db212){return db['UserProfile']['find']({'where':{'id':_0x45a081['params']['id']}})[_0xeaae('0x2a')](handleEntityNotFound(_0x5db212,null))[_0xeaae('0x2a')](function(_0x1f9089){if(_0x1f9089){return db[_0xeaae('0x6d')]['transaction'](function(_0x480a4e){return db[_0xeaae('0x5f')]['findAll']({'where':{'userProfileId':_0x45a081[_0xeaae('0x4f')]['id']},'attributes':['id'],'raw':!![]})[_0xeaae('0x2a')](function(_0x2a9f3b){if(_0x2a9f3b){return db[_0xeaae('0x5f')][_0xeaae('0x29')]({'where':{'userProfileId':_0x45a081[_0xeaae('0x4f')]['id'],'id':_['map'](_0x2a9f3b,function(_0x2b5770){return _0x2b5770['id'];})},'transaction':_0x480a4e});}})['then'](function(_0x6b5a0a){var _0x32dffe=_['map'](_0x45a081['body'],function(_0x25bf58){_0x25bf58['userProfileId']=_0x45a081[_0xeaae('0x4f')]['id'];return _0x25bf58;});return db[_0xeaae('0x5f')][_0xeaae('0x6e')](_0x32dffe,{'raw':!![],'transaction':_0x480a4e});})[_0xeaae('0x2a')](function(_0x39b1a2){var _0x22ad7f=_[_0xeaae('0x63')](_['map'](_0x39b1a2,function(_0x115e09){return _0x115e09['get']({'plain':!![]});}),{'includeAll':![]});if(_0x22ad7f){return db[_0xeaae('0x5f')][_0xeaae('0x47')]({'where':{'userProfileId':_0x45a081[_0xeaae('0x4f')]['id'],'sectionId':_[_0xeaae('0x42')](_0x22ad7f,function(_0x43d121){return _0x43d121['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xeaae('0x2a')](function(_0xc3d8e6){var _0x610fa3=_[_0xeaae('0x42')](_0x45a081['body'],function(_0x4eb1b2){_0x4eb1b2[_0xeaae('0x5b')]=_0x45a081[_0xeaae('0x4f')]['id'];return _0x4eb1b2;});return db['UserProfileResource'][_0xeaae('0x6e')](_0x610fa3,{'raw':!![],'transaction':_0x480a4e});});}})[_0xeaae('0x4b')](handleError(_0x5db212,null));});}})['then'](function(_0x5d060f){var _0x43aaff=_[_0xeaae('0x42')](_0x5d060f,function(_0xc19289){return _0xc19289[_0xeaae('0x51')]({'plain':!![]});});})[_0xeaae('0x2a')](respondWithResult(_0x5db212,null))['catch'](handleError(_0x5db212,null));};exports[_0xeaae('0x6f')]=function(_0x481fee,_0x17ea66,_0x307265){return db[_0xeaae('0x31')]['find']({'where':{'id':_0x481fee[_0xeaae('0x4f')]['id']}})[_0xeaae('0x2a')](handleEntityNotFound(_0x17ea66,null))[_0xeaae('0x2a')](function(_0x5d0426){if(_0x5d0426){return _0x5d0426[_0xeaae('0x6f')](_0x481fee['query']['ids']);}})[_0xeaae('0x2a')](respondWithStatusCode(_0x17ea66,null))[_0xeaae('0x4b')](handleError(_0x17ea66,null));};exports[_0xeaae('0x70')]=function(_0x7d9874,_0x4e2661){var _0x5ef9b9={};if(!_0x7d9874['query'][_0xeaae('0x71')])throw new Error('Missing\x20section\x20parameter');if(!_0x7d9874[_0xeaae('0x35')][_0xeaae('0x3c')]('nolimit')){_0x5ef9b9['limit']=qs[_0xeaae('0x22')](_0x7d9874[_0xeaae('0x35')]['limit']);_0x5ef9b9[_0xeaae('0x23')]=qs[_0xeaae('0x23')](_0x7d9874[_0xeaae('0x35')][_0xeaae('0x23')]);}return db[_0xeaae('0x31')][_0xeaae('0x50')]({'where':{'id':_0x7d9874['params']['id']}})[_0xeaae('0x2a')](function(_0x1f4785){if(!_0x1f4785)throw new Error(_0xeaae('0x72')+_0x7d9874['params']['id']);return db[_0xeaae('0x31')][_0xeaae('0x70')](_0x7d9874);})[_0xeaae('0x2a')](respondWithFilteredResult(_0x4e2661,_0x5ef9b9))[_0xeaae('0x4b')](handleError(_0x4e2661,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 48c2dd0..4bbd944 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 _0x0adf=['UserProfile','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x228cfb,_0x1b4294){var _0x21e85d=function(_0x377b37){while(--_0x377b37){_0x228cfb['push'](_0x228cfb['shift']());}};_0x21e85d(++_0x1b4294);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x2e3885,_0x101c38){_0x2e3885=_0x2e3885-0x0;var _0x148628=_0x0adf[_0x2e3885];return _0x148628;};'use strict';var EventEmitter=require(_0xf0ad('0x0'));var UserProfile=require(_0xf0ad('0x1'))['db'][_0xf0ad('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf0ad('0x3'),'afterUpdate':_0xf0ad('0x4'),'afterDestroy':_0xf0ad('0x5')};function emitEvent(_0x187aa4){return function(_0x27d666,_0x459e70,_0x719547){UserProfileEvents['emit'](_0x187aa4+':'+_0x27d666['id'],_0x27d666);UserProfileEvents[_0xf0ad('0x6')](_0x187aa4,_0x27d666);_0x719547(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xf0ad('0x7')](e,emitEvent(event));}}module[_0xf0ad('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xba18=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2732e5,_0x19e433){var _0x55896a=function(_0xed98df){while(--_0xed98df){_0x2732e5['push'](_0x2732e5['shift']());}};_0x55896a(++_0x19e433);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x8ba1('0x0'));var UserProfile=require(_0x8ba1('0x1'))['db'][_0x8ba1('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8ba1('0x3')](0x0);var events={'afterCreate':_0x8ba1('0x4'),'afterUpdate':_0x8ba1('0x5'),'afterDestroy':_0x8ba1('0x6')};function emitEvent(_0x3b5254){return function(_0x59c54c,_0xe3bc16,_0x3136d7){UserProfileEvents[_0x8ba1('0x7')](_0x3b5254+':'+_0x59c54c['id'],_0x59c54c);UserProfileEvents[_0x8ba1('0x7')](_0x3b5254,_0x59c54c);_0x3136d7(null);};}for(var e in events){if(events[_0x8ba1('0x8')](e)){var event=events[e];UserProfile[_0x8ba1('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 10b3837..a428419 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 _0xc1fd=['customSorting','extraQueryConditions','CmContact','Tag','Tags','ThroughTags','color','tag','openTabs','true','dataValues','fax','openchannel','whatsapp','all','lodash','../../components/parsers/qs','squel','exports','models','filter','findAll','then','associatedResources','catch','field','value','map','name','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','parentSections','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','voicerecordings','VoiceRecording','membername','role','agent','Telephones','User','telephone','VoiceQueues','VoiceQueue','QueueCampaigns','queue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','MailAccount','mailsubstatuses','openchannelqueues','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','admin','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','Schedule','Sound','tags','templates','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','rawAttributes','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids'];(function(_0x34e5c3,_0x2e2b9b){var _0x175897=function(_0x18c00b){while(--_0x18c00b){_0x34e5c3['push'](_0x34e5c3['shift']());}};_0x175897(++_0x2e2b9b);}(_0xc1fd,0xd3));var _0xdc1f=function(_0x5c56ca,_0x10f0a9){_0x5c56ca=_0x5c56ca-0x0;var _0x3bdfcd=_0xc1fd[_0x5c56ca];return _0x3bdfcd;};'use strict';var _=require(_0xdc1f('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0xdc1f('0x1'));var squel=require(_0xdc1f('0x2'));module[_0xdc1f('0x3')]=function(_0x3f469f){var _0x422a39=_0x3f469f[_0xdc1f('0x4')];function _0x76e1b6(_0x231194,_0x16d46f){return new Promise(function(_0x526024,_0x146559){if(!_0x16d46f)return _0x526024(null);var _0x3d51e1=_0x16d46f[_0xdc1f('0x5')]?{[_0x16d46f[_0xdc1f('0x5')]['field']]:_0x16d46f[_0xdc1f('0x5')]['value']}:undefined;return _0x422a39[_0x231194][_0xdc1f('0x6')]({'where':_0x3d51e1,'raw':!![]})[_0xdc1f('0x7')](function(_0x1d44bd){_0x16d46f[_0xdc1f('0x8')]=_['map'](_0x1d44bd,'id');_0x526024(_0x16d46f);})[_0xdc1f('0x9')](function(_0x5cac53){_0x146559(_0x5cac53);});});}function _0x440759(_0x176d32,_0x3b261e){return new Promise(function(_0x562fe5,_0x4f4884){var _0x1fa827=_0x176d32[_0xdc1f('0x5')]?{[_0x176d32['filter'][_0xdc1f('0xa')]]:_0x176d32[_0xdc1f('0x5')][_0xdc1f('0xb')]}:undefined;return _0x422a39[_0x176d32['model']][_0xdc1f('0x6')]({'where':_0x1fa827,'raw':!![]})[_0xdc1f('0x7')](function(_0x464993){_0x3b261e[_0xdc1f('0x8')]=_[_0xdc1f('0xc')](_0x464993,function(_0x420609){return _0x420609[_0xdc1f('0xd')];});_0x562fe5(_0x3b261e);})[_0xdc1f('0x9')](function(_0xbabb57){_0x4f4884(_0xbabb57);});});}function _0x1cea5f(_0x49321b,_0x1d8b4e,_0x5e8453){if(!_0x1d8b4e)return Promise['resolve'](null);return new Promise(function(_0x9ce4bd,_0x502080){return _0x422a39[_0xdc1f('0xe')][_0xdc1f('0x6')]({'where':{'sectionId':_0x1d8b4e['id']},'raw':!![]})[_0xdc1f('0x7')](function(_0x28760c){if(_0x49321b['field']&&_0x49321b[_0xdc1f('0xa')]!=='id'){_0x1d8b4e['associatedResources']=_[_0xdc1f('0xc')](_0x28760c,function(_0x1e66a0){return _0x1e66a0[_0x49321b[_0xdc1f('0xa')]];});}else{if(_0x5e8453==='AnalyticExtractedReport'){_0x1d8b4e['associatedResources']=_[_0xdc1f('0xc')](_0x28760c,function(_0x530d6d){return{'id':_0x530d6d[_0xdc1f('0xf')],'type':_0x530d6d[_0xdc1f('0x10')]};});}else{_0x1d8b4e[_0xdc1f('0x8')]=_[_0xdc1f('0xc')](_0x28760c,function(_0x3f7ccb){return _0x3f7ccb[_0xdc1f('0xf')];});}}_0x9ce4bd(_0x1d8b4e);})[_0xdc1f('0x9')](function(_0xefaab){_0x502080(_0xefaab);});});}function _0x720800(_0xaf7ce3,_0x430c6f){var _0x456d69={'parentSections':[]};switch(_0xaf7ce3[_0xdc1f('0x11')]()){case _0xdc1f('0x12'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x14');break;case'odbc':_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x15');break;case _0xdc1f('0x16'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x17');_0x456d69['parentSections']=[{'name':_0xdc1f('0x18'),'field':_0xdc1f('0xd'),'foreignKey':'projectName'}];break;case _0xdc1f('0x19'):_0x456d69[_0xdc1f('0x13')]='JscriptyProject';break;case'contacts':_0x456d69[_0xdc1f('0x13')]='CmContact';_0x456d69[_0xdc1f('0x1a')]=[{'name':_0xdc1f('0x1b'),'field':'id','foreignKey':_0xdc1f('0x1c')}];break;case _0xdc1f('0x1d'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x1e');break;case _0xdc1f('0x1f'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x20');break;case _0xdc1f('0x21'):_0x456d69['childModel']=_0xdc1f('0x22');break;case _0xdc1f('0x23'):_0x456d69['childModel']='ChatQueue';break;case _0xdc1f('0x24'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x25');break;case'faxqueues':_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x26');break;case _0xdc1f('0x27'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x28');break;case _0xdc1f('0x29'):case _0xdc1f('0x2a'):case _0xdc1f('0x2b'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x2c');break;case'contexts':_0x456d69['childModel']=_0xdc1f('0x2d');break;case _0xdc1f('0x2e'):_0x456d69[_0xdc1f('0x13')]='VoiceMail';break;case _0xdc1f('0x2f'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x30');_0x456d69[_0xdc1f('0x1a')]=[{'name':'Agents','field':_0xdc1f('0xd'),'foreignKey':_0xdc1f('0x31'),'model':'User','filter':{'field':_0xdc1f('0x32'),'value':[_0xdc1f('0x33')]}},{'name':_0xdc1f('0x34'),'field':_0xdc1f('0xd'),'foreignKey':'membername','model':_0xdc1f('0x35'),'filter':{'field':'role','value':[_0xdc1f('0x36')]}},{'name':_0xdc1f('0x37'),'field':'name','foreignKey':'queue','model':_0xdc1f('0x38'),'filter':{'field':_0xdc1f('0x10'),'value':['inbound']}},{'name':_0xdc1f('0x39'),'field':_0xdc1f('0xd'),'foreignKey':_0xdc1f('0x3a'),'model':_0xdc1f('0x38'),'filter':{'field':_0xdc1f('0x10'),'value':['outbound']}}];break;case _0xdc1f('0x3b'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x3c');break;case _0xdc1f('0x3d'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x3e');break;case _0xdc1f('0x3f'):_0x456d69[_0xdc1f('0x13')]='VoicePrefix';break;case _0xdc1f('0x40'):_0x456d69[_0xdc1f('0x13')]='Campaign';break;case _0xdc1f('0x41'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x42');break;case'mailaccounts':_0x456d69['childModel']=_0xdc1f('0x43');break;case _0xdc1f('0x44'):_0x456d69['childModel']='MailSubstatus';break;case _0xdc1f('0x45'):_0x456d69[_0xdc1f('0x13')]='OpenchannelQueue';break;case'openchannelaccounts':_0x456d69[_0xdc1f('0x13')]='OpenchannelAccount';break;case _0xdc1f('0x46'):_0x456d69['childModel']=_0xdc1f('0x47');break;case _0xdc1f('0x48'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x49');break;case _0xdc1f('0x4a'):_0x456d69[_0xdc1f('0x13')]='WhatsappQueue';break;case _0xdc1f('0x4b'):_0x456d69['childModel']=_0xdc1f('0x4c');break;case'teams':_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x4d');break;case _0xdc1f('0x4e'):case _0xdc1f('0x4f'):_0x456d69[_0xdc1f('0x13')]='VoiceQueue';if(_0x430c6f){_0x456d69[_0xdc1f('0x1a')]=[{'name':_0xdc1f('0x37')},{'name':_0xdc1f('0x39')}];}break;case'users':case'agents':case'telephones':_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x35');if(_0x430c6f){_0x456d69['parentSections']=[{'name':'Users','filter':{'field':'role','value':[_0xdc1f('0x50'),'user']},'ignore':!![]},{'name':_0xdc1f('0x51')},{'name':_0xdc1f('0x34')}];}break;case _0xdc1f('0x52'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x53');break;case _0xdc1f('0x54'):_0x456d69[_0xdc1f('0x13')]='SalesforceAccount';break;case _0xdc1f('0x55'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x56');break;case _0xdc1f('0x57'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x58');break;case _0xdc1f('0x59'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x5a');break;case _0xdc1f('0x5b'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x5c');break;case _0xdc1f('0x5d'):_0x456d69[_0xdc1f('0x13')]='User';break;case _0xdc1f('0x5e'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x5f');break;case _0xdc1f('0x60'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x61');break;case _0xdc1f('0x62'):_0x456d69['childModel']=_0xdc1f('0x63');break;case _0xdc1f('0x64'):_0x456d69[_0xdc1f('0x13')]='Interval';break;case _0xdc1f('0x65'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x66');break;case _0xdc1f('0x67'):_0x456d69['childModel']=_0xdc1f('0x68');break;case'sounds':_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x69');break;case _0xdc1f('0x6a'):_0x456d69['childModel']='Tag';break;case _0xdc1f('0x6b'):_0x456d69['childModel']='Template';break;case _0xdc1f('0x6c'):_0x456d69[_0xdc1f('0x13')]='Trigger';break;case _0xdc1f('0x6d'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x6e');break;case _0xdc1f('0x6f'):_0x456d69['childModel']=_0xdc1f('0x70');break;case _0xdc1f('0x71'):_0x456d69['childModel']=_0xdc1f('0x72');break;case _0xdc1f('0x73'):_0x456d69['childModel']=_0xdc1f('0x74');_0x456d69['parentSections']=[{'name':_0xdc1f('0x75'),'field':'id','foreignKey':_0xdc1f('0x76')}];break;case'metrics':_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x77');break;}return _0x456d69;}function _0xb38e39(_0xc8e79c,_0x47a293){var _0x5475a9=_0xc8e79c['charAt'](0x0)[_0xdc1f('0x78')]()+_0xc8e79c[_0xdc1f('0x79')](0x1);var _0x277df0={'type':_0x422a39[_0xdc1f('0x7a')][_0xdc1f('0x7b')][_0xdc1f('0x7c')],'raw':!![]};return new Promise(function(_0x41a955,_0x4843fe){var _0x3133e1=squel[_0xdc1f('0x7d')]()[_0xdc1f('0xa')](_0xdc1f('0x7e')+_0x5475a9+_0xdc1f('0x7f'),'id')[_0xdc1f('0xa')]('ui.createdAt')[_0xdc1f('0x80')](_0xdc1f('0x81')+_0xc8e79c+_0xdc1f('0x82'),'ui')[_0xdc1f('0x83')](_0xdc1f('0x84'),_0x47a293['id']);return _0x422a39[_0xdc1f('0x85')][_0xdc1f('0x86')](_0x3133e1[_0xdc1f('0x87')](),_0x277df0)[_0xdc1f('0x7')](function(_0x4bac3a){_0x47a293[_0x5475a9+_0xdc1f('0x88')]=_0x4bac3a;_0x41a955(_0x4bac3a);})[_0xdc1f('0x9')](function(_0x1b34a7){_0x4843fe(_0x1b34a7);});});}return _0x3f469f[_0xdc1f('0x89')]('UserProfile',attributes,{'tableName':_0xdc1f('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x305e70){var _0x55d6ff={'raw':_0x305e70[_0xdc1f('0x86')][_0xdc1f('0x8b')],'where':{}};var _0x37bc18={};var _0xce1f23={'count':0x0,'rows':[]};var _0x545c5d=_0x305e70[_0xdc1f('0x86')][_0xdc1f('0x8c')];var _0xe40f2=_0x305e70[_0xdc1f('0x86')]['mergeResources']||![];var _0x2346bf=_0x720800(_0x545c5d,_0xe40f2);if(!_0x2346bf[_0xdc1f('0x13')])throw new Error(_0xdc1f('0x8d')+_0x545c5d+'\x27');var _0x3b2b19=[{'name':_0x545c5d}];if(!_[_0xdc1f('0x8e')](_0x2346bf[_0xdc1f('0x1a')]))_0x3b2b19=_0x2346bf['parentSections'];var _0x3eace4=[];for(var _0x3a5733=0x0;_0x3a5733<_0x3b2b19[_0xdc1f('0x8f')];_0x3a5733++){_0x3eace4[_0xdc1f('0x90')](_0x422a39[_0xdc1f('0x91')][_0xdc1f('0x92')]({'where':{'userProfileId':_0x305e70[_0xdc1f('0x93')]['id'],'name':_0x3b2b19[_0x3a5733][_0xdc1f('0xd')]},'raw':!![]}));}return Promise['all'](_0x3eace4)[_0xdc1f('0x7')](function(_0x1b94ef){var _0x21c199=_['filter'](_0x1b94ef,function(_0x1ee071){return _0x1ee071?_0x1ee071:undefined;});var _0x544c45=_[_0xdc1f('0x5')](_0x3b2b19,[_0xdc1f('0x94'),!![]]);var _0x48b9c3=_[_0xdc1f('0x8e')](_0x21c199)&&_[_0xdc1f('0x8e')](_0x544c45)?null:_[_0xdc1f('0x95')](_0x544c45,_0x21c199);if(!_0x48b9c3)return null;var _0x31ac26=[];for(var _0x41a9b8=0x0;_0x41a9b8<_0x48b9c3[_0xdc1f('0x8f')];_0x41a9b8++){var _0x3e05a6=_['find'](_0x3b2b19,function(_0x231a2f){return _0x48b9c3[_0x41a9b8]?_0x231a2f[_0xdc1f('0xd')]===_0x48b9c3[_0x41a9b8][_0xdc1f('0xd')]:null;});if(_0x3e05a6){if(_0x48b9c3[_0x41a9b8][_0xdc1f('0x94')]){_0x31ac26[_0xdc1f('0x90')](_0x76e1b6(_0x2346bf[_0xdc1f('0x13')],_0x48b9c3[_0x41a9b8]));}else{if(!_0x48b9c3[_0x41a9b8][_0xdc1f('0x96')]){_0x31ac26[_0xdc1f('0x90')](_0x1cea5f(_0x3e05a6,_0x48b9c3[_0x41a9b8],_0x2346bf[_0xdc1f('0x13')]));}else{if(_0x3e05a6['model']){_0x31ac26['push'](_0x440759(_0x3e05a6,_0x48b9c3[_0x41a9b8]));}}}}}return Promise['all'](_0x31ac26);})[_0xdc1f('0x7')](function(_0x5b9a3c){var _0x5a0172=_0x5b9a3c;var _0x16b2a3=null;if(_0x5a0172){_0x16b2a3=_0x5a0172[_0xdc1f('0x8f')]===0x1?_0x5a0172[0x0]:null;}if(!_0x16b2a3&&!_0x5a0172)return _0xce1f23;var _0x404a3e=_0x422a39[_0x2346bf[_0xdc1f('0x13')]][_0xdc1f('0x97')];_0x37bc18['model']=_[_0xdc1f('0x98')](_0x404a3e);_0x37bc18[_0xdc1f('0x86')]=_[_0xdc1f('0x98')](_0x305e70[_0xdc1f('0x86')]);_0x37bc18[_0xdc1f('0x99')]=_['intersection'](_0x37bc18[_0xdc1f('0x9a')],_0x37bc18['query']);_0x55d6ff[_0xdc1f('0x9b')]=_[_0xdc1f('0x9c')](_0x37bc18[_0xdc1f('0x9a')],qs[_0xdc1f('0x9d')](_0x305e70[_0xdc1f('0x86')][_0xdc1f('0x9d')]));_0x55d6ff[_0xdc1f('0x9b')]=_0x55d6ff['attributes']['length']?_0x55d6ff[_0xdc1f('0x9b')]:_0x37bc18[_0xdc1f('0x9a')];if(!_0x305e70['query'][_0xdc1f('0x9e')](_0xdc1f('0x9f'))){_0x55d6ff[_0xdc1f('0xa0')]=qs[_0xdc1f('0xa0')](_0x305e70[_0xdc1f('0x86')][_0xdc1f('0xa0')]);_0x55d6ff[_0xdc1f('0xa1')]=qs[_0xdc1f('0xa1')](_0x305e70[_0xdc1f('0x86')][_0xdc1f('0xa1')]);}_0x55d6ff[_0xdc1f('0xa2')]=qs[_0xdc1f('0xa3')](_0x305e70['query'][_0xdc1f('0xa3')]);_0x55d6ff[_0xdc1f('0x83')]=qs['filters'](_[_0xdc1f('0xa4')](_0x305e70[_0xdc1f('0x86')],_0x37bc18[_0xdc1f('0x99')]));if(_0x305e70['query'][_0xdc1f('0x5')]){_0x55d6ff[_0xdc1f('0x83')]=_[_0xdc1f('0xa5')](_0x55d6ff[_0xdc1f('0x83')],{'$or':_[_0xdc1f('0xc')](_0x404a3e,function(_0x4e0f20){if(_0x4e0f20[_0xdc1f('0x10')][_0xdc1f('0xa6')]!==_0xdc1f('0xa7')){var _0x591c75={};_0x591c75[_0x4e0f20['field']]={'$like':'%'+_0x305e70[_0xdc1f('0x86')]['filter']+'%'};return _0x591c75;}})});}var _0x460d05=[];var _0x266c77=null;var _0x470b55={};if(_0x16b2a3){_0x266c77=_[_0xdc1f('0x92')](_0x3b2b19,[_0xdc1f('0xd'),_0x16b2a3['name']]);if(_0x266c77[_0xdc1f('0xa')]){_0x470b55={};if(_0x2346bf[_0xdc1f('0x13')]==='AnalyticExtractedReport'){_0x470b55[_0x266c77[_0xdc1f('0xa8')]]=_['map'](_0x16b2a3[_0xdc1f('0x8')],'id');}else{_0x470b55[_0x266c77[_0xdc1f('0xa8')]]=_0x16b2a3[_0xdc1f('0x8')];}_0x460d05['push'](_0x470b55);}else{_0x55d6ff[_0xdc1f('0x83')]['id']=_0x16b2a3['associatedResources'];}}else{for(var _0x2b609e=0x0;_0x2b609e<_0x5a0172[_0xdc1f('0x8f')];_0x2b609e++){_0x266c77=_[_0xdc1f('0x92')](_0x3b2b19,[_0xdc1f('0xd'),_0x5a0172[_0x2b609e][_0xdc1f('0xd')]]);if(_0x266c77[_0xdc1f('0xa')]){_0x470b55={};_0x470b55[_0x266c77[_0xdc1f('0xa8')]]=_0x5a0172[_0x2b609e][_0xdc1f('0x8')];_0x460d05[_0xdc1f('0x90')](_0x470b55);}else{if(!_0x55d6ff['where']['id'])_0x55d6ff[_0xdc1f('0x83')]['id']=[];_0x5a0172[_0x2b609e][_0xdc1f('0x8')][_0xdc1f('0xa9')](function(_0x490129){_0x55d6ff[_0xdc1f('0x83')]['id'][_0xdc1f('0x90')](_0x490129);});}}}if(!_[_0xdc1f('0x8e')](_0x460d05)){_0x55d6ff[_0xdc1f('0x83')]=_[_0xdc1f('0xa5')](_0x55d6ff[_0xdc1f('0x83')],{'$and':{'$or':_0x460d05}});}_0x55d6ff=_[_0xdc1f('0xa5')]({},_0x55d6ff,_0x305e70[_0xdc1f('0xaa')]);if(_0x16b2a3&&!_0x16b2a3[_0xdc1f('0x96')]&&_0x2346bf[_0xdc1f('0x13')]===_0xdc1f('0x74')){if(_0x305e70['query'][_0xdc1f('0xab')]){_0x55d6ff[_0xdc1f('0xac')]=[{'all':!![]}];}return _0x422a39[_0x2346bf[_0xdc1f('0x13')]][_0xdc1f('0x6')](_0x55d6ff)[_0xdc1f('0x7')](function(_0x2990af){var _0x3f216e=[];_0x2990af[_0xdc1f('0xa9')](function(_0x5a1bd8){var _0x2f4fb3;switch(_0x5a1bd8[_0xdc1f('0xad')]){case _0xdc1f('0xae'):_0x2f4fb3=_[_0xdc1f('0x92')](_0x16b2a3[_0xdc1f('0x8')],function(_0x1e8e13){return _0x1e8e13['id']===_0x5a1bd8[_0xdc1f('0x76')]&&_0x1e8e13[_0xdc1f('0x10')]===_0xdc1f('0xaf');});break;case _0xdc1f('0xb0'):_0x2f4fb3=_[_0xdc1f('0x92')](_0x16b2a3[_0xdc1f('0x8')],function(_0x7c3148){return _0x7c3148['id']===_0x5a1bd8[_0xdc1f('0x76')]&&_0x7c3148['type']===_0xdc1f('0xb1');});break;}if(_0x2f4fb3)_0x3f216e[_0xdc1f('0x90')](_0x5a1bd8);});_0xce1f23[_0xdc1f('0xb2')]=_0x3f216e['length'];_0xce1f23[_0xdc1f('0xb3')]=_0x3f216e;return _0xce1f23;});}else{if(!_['isEmpty'](_0x305e70['query']['ids'])){_0x55d6ff['where']['id']=_0x55d6ff[_0xdc1f('0x83')]['id']?_[_0xdc1f('0x9c')](_0x55d6ff[_0xdc1f('0x83')]['id'],_0x305e70[_0xdc1f('0x86')][_0xdc1f('0xb4')]):_0x305e70['query']['ids'];if(_0x305e70[_0xdc1f('0x86')][_0xdc1f('0xb5')]){_0x55d6ff[_0xdc1f('0xa2')]=_0x305e70[_0xdc1f('0x86')][_0xdc1f('0xb5')];}}if(_0x305e70['query'][_0xdc1f('0xb6')]){_0x55d6ff['where']=_[_0xdc1f('0xa5')](_0x55d6ff[_0xdc1f('0x83')],{'$and':_0x305e70[_0xdc1f('0x86')]['extraQueryConditions']});}return _0x422a39[_0x2346bf[_0xdc1f('0x13')]][_0xdc1f('0xb2')]({'where':_0x55d6ff[_0xdc1f('0x83')]})['then'](function(_0x5cd56f){_0xce1f23[_0xdc1f('0xb2')]=_0x5cd56f;if(_0x305e70[_0xdc1f('0x86')][_0xdc1f('0xab')]){if(_0x2346bf[_0xdc1f('0x13')]===_0xdc1f('0xb7')){_0x55d6ff[_0xdc1f('0xac')]=[{'model':_0x422a39[_0xdc1f('0xb8')],'as':_0xdc1f('0xb9'),'attributes':['id',_0xdc1f('0xd'),'color'],'required':_0x305e70[_0xdc1f('0x86')]['tag']?!![]:![]},{'model':_0x422a39['Tag'],'as':_0xdc1f('0xba'),'attributes':['id',_0xdc1f('0xd'),_0xdc1f('0xbb')],'through':_0x305e70['query'][_0xdc1f('0xbc')]?{'attributes':[],'where':{'TagId':_0x305e70[_0xdc1f('0x86')]['tag']||undefined}}:{},'required':_0x305e70['query'][_0xdc1f('0xbc')]?!![]:![]}];}else{_0x55d6ff[_0xdc1f('0xac')]=[{'all':!![]}];}}return _0x422a39[_0x2346bf['childModel']]['findAll'](_0x55d6ff);})['then'](function(_0x425264){_0xce1f23['rows']=_0x425264;if(_0x545c5d==='Agents'&&_0x305e70['query'][_0xdc1f('0xbd')]===_0xdc1f('0xbe')){var _0x2185a7=[];for(var _0x4eb63e=0x0;_0x4eb63e<_0xce1f23[_0xdc1f('0xb3')][_0xdc1f('0x8f')];_0x4eb63e++){_0x2185a7[_0xdc1f('0x90')](_0xb38e39('chat',_0xce1f23['rows'][_0x4eb63e]['dataValues']));_0x2185a7[_0xdc1f('0x90')](_0xb38e39('sms',_0xce1f23[_0xdc1f('0xb3')][_0x4eb63e][_0xdc1f('0xbf')]));_0x2185a7[_0xdc1f('0x90')](_0xb38e39(_0xdc1f('0xc0'),_0xce1f23[_0xdc1f('0xb3')][_0x4eb63e][_0xdc1f('0xbf')]));_0x2185a7[_0xdc1f('0x90')](_0xb38e39('mail',_0xce1f23[_0xdc1f('0xb3')][_0x4eb63e]['dataValues']));_0x2185a7['push'](_0xb38e39(_0xdc1f('0xc1'),_0xce1f23[_0xdc1f('0xb3')][_0x4eb63e]['dataValues']));_0x2185a7[_0xdc1f('0x90')](_0xb38e39(_0xdc1f('0xc2'),_0xce1f23[_0xdc1f('0xb3')][_0x4eb63e][_0xdc1f('0xbf')]));}return Promise[_0xdc1f('0xc3')](_0x2185a7)[_0xdc1f('0x7')](function(){return _0xce1f23;});}return _0xce1f23;});}});}}});}; \ No newline at end of file +var _0x3a58=['zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','vtigeraccounts','User','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','pauses','Schedule','sounds','tags','templates','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','AnalyticMetric','charAt','toUpperCase','slice','SELECT','select','ui.','ui.createdAt','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','user_profiles','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','params','all','union','ignore','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','AnalyticExtractedReport','foreignKey','find','forEach','includeAll','include','default','reportId','custom','count','ids','customSorting','extraQueryConditions','Tags','color','Tag','tag','rows','openTabs','true','chat','dataValues','fax','mail','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','name','catch','resolve','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','contacts','CmContact','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','agent','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','admin','user'];(function(_0x10f100,_0x20f3d3){var _0x51546e=function(_0x488217){while(--_0x488217){_0x10f100['push'](_0x10f100['shift']());}};_0x51546e(++_0x20f3d3);}(_0x3a58,0x64));var _0x83a5=function(_0x3df759,_0x1e00f4){_0x3df759=_0x3df759-0x0;var _0x479567=_0x3a58[_0x3df759];return _0x479567;};'use strict';var _=require(_0x83a5('0x0'));var attributes=require(_0x83a5('0x1'));var qs=require('../../components/parsers/qs');var squel=require(_0x83a5('0x2'));module[_0x83a5('0x3')]=function(_0x4daaea){var _0x432d16=_0x4daaea[_0x83a5('0x4')];function _0x7bb356(_0x3b4416,_0x1be5ca){return new Promise(function(_0x348949,_0x3edbac){if(!_0x1be5ca)return _0x348949(null);var _0x302e45=_0x1be5ca[_0x83a5('0x5')]?{[_0x1be5ca[_0x83a5('0x5')][_0x83a5('0x6')]]:_0x1be5ca[_0x83a5('0x5')][_0x83a5('0x7')]}:undefined;return _0x432d16[_0x3b4416][_0x83a5('0x8')]({'where':_0x302e45,'raw':!![]})[_0x83a5('0x9')](function(_0x534226){_0x1be5ca[_0x83a5('0xa')]=_[_0x83a5('0xb')](_0x534226,'id');_0x348949(_0x1be5ca);})['catch'](function(_0x3deb44){_0x3edbac(_0x3deb44);});});}function _0x43444a(_0x28b5fa,_0x1b1c5d){return new Promise(function(_0x3451f8,_0x2bd3be){var _0x5ad1df=_0x28b5fa[_0x83a5('0x5')]?{[_0x28b5fa[_0x83a5('0x5')][_0x83a5('0x6')]]:_0x28b5fa[_0x83a5('0x5')][_0x83a5('0x7')]}:undefined;return _0x432d16[_0x28b5fa['model']][_0x83a5('0x8')]({'where':_0x5ad1df,'raw':!![]})[_0x83a5('0x9')](function(_0x3510ac){_0x1b1c5d[_0x83a5('0xa')]=_[_0x83a5('0xb')](_0x3510ac,function(_0x29d55d){return _0x29d55d[_0x83a5('0xc')];});_0x3451f8(_0x1b1c5d);})[_0x83a5('0xd')](function(_0x2d1feb){_0x2bd3be(_0x2d1feb);});});}function _0x4e7738(_0x20a8b7,_0x589201,_0x39ccac){if(!_0x589201)return Promise[_0x83a5('0xe')](null);return new Promise(function(_0x1af7cc,_0x272a88){return _0x432d16[_0x83a5('0xf')][_0x83a5('0x8')]({'where':{'sectionId':_0x589201['id']},'raw':!![]})[_0x83a5('0x9')](function(_0x2d1f52){if(_0x20a8b7[_0x83a5('0x6')]&&_0x20a8b7[_0x83a5('0x6')]!=='id'){_0x589201['associatedResources']=_['map'](_0x2d1f52,function(_0x584e1f){return _0x584e1f[_0x20a8b7[_0x83a5('0x6')]];});}else{if(_0x39ccac==='AnalyticExtractedReport'){_0x589201[_0x83a5('0xa')]=_[_0x83a5('0xb')](_0x2d1f52,function(_0x8834de){return{'id':_0x8834de[_0x83a5('0x10')],'type':_0x8834de[_0x83a5('0x11')]};});}else{_0x589201['associatedResources']=_[_0x83a5('0xb')](_0x2d1f52,function(_0x59904d){return _0x59904d[_0x83a5('0x10')];});}}_0x1af7cc(_0x589201);})[_0x83a5('0xd')](function(_0x249443){_0x272a88(_0x249443);});});}function _0x37a4a1(_0x45f400,_0x399f9e){var _0x26e2a2={'parentSections':[]};switch(_0x45f400[_0x83a5('0x12')]()){case _0x83a5('0x13'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x15');break;case _0x83a5('0x16'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x17');break;case _0x83a5('0x18'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x19');_0x26e2a2[_0x83a5('0x1a')]=[{'name':_0x83a5('0x1b'),'field':'name','foreignKey':_0x83a5('0x1c')}];break;case'projects':_0x26e2a2['childModel']='JscriptyProject';break;case _0x83a5('0x1d'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x1e');_0x26e2a2[_0x83a5('0x1a')]=[{'name':'Lists','field':'id','foreignKey':_0x83a5('0x1f')}];break;case'lists':_0x26e2a2['childModel']=_0x83a5('0x20');break;case _0x83a5('0x21'):_0x26e2a2['childModel']=_0x83a5('0x22');break;case _0x83a5('0x23'):_0x26e2a2['childModel']='CmCustomField';break;case _0x83a5('0x24'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x25');break;case _0x83a5('0x26'):_0x26e2a2[_0x83a5('0x14')]='ChatWebsite';break;case _0x83a5('0x27'):_0x26e2a2['childModel']=_0x83a5('0x28');break;case _0x83a5('0x29'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x2a');break;case _0x83a5('0x2b'):case _0x83a5('0x2c'):case'outboundroutes':_0x26e2a2['childModel']=_0x83a5('0x2d');break;case _0x83a5('0x2e'):_0x26e2a2['childModel']=_0x83a5('0x2f');break;case _0x83a5('0x30'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x31');break;case _0x83a5('0x32'):_0x26e2a2['childModel']=_0x83a5('0x33');_0x26e2a2['parentSections']=[{'name':_0x83a5('0x34'),'field':_0x83a5('0xc'),'foreignKey':_0x83a5('0x35'),'model':'User','filter':{'field':'role','value':[_0x83a5('0x36')]}},{'name':'Telephones','field':_0x83a5('0xc'),'foreignKey':_0x83a5('0x35'),'model':'User','filter':{'field':'role','value':[_0x83a5('0x37')]}},{'name':_0x83a5('0x38'),'field':_0x83a5('0xc'),'foreignKey':_0x83a5('0x39'),'model':_0x83a5('0x3a'),'filter':{'field':_0x83a5('0x11'),'value':[_0x83a5('0x3b')]}},{'name':_0x83a5('0x3c'),'field':_0x83a5('0xc'),'foreignKey':_0x83a5('0x39'),'model':_0x83a5('0x3a'),'filter':{'field':_0x83a5('0x11'),'value':[_0x83a5('0x3d')]}}];break;case _0x83a5('0x3e'):_0x26e2a2[_0x83a5('0x14')]='VoiceMusicOnHold';break;case _0x83a5('0x3f'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x40');break;case _0x83a5('0x41'):_0x26e2a2[_0x83a5('0x14')]='VoicePrefix';break;case _0x83a5('0x42'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x43');break;case'mailqueues':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x44');break;case'mailaccounts':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x45');break;case _0x83a5('0x46'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x47');break;case _0x83a5('0x48'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x49');break;case'openchannelaccounts':_0x26e2a2['childModel']='OpenchannelAccount';break;case'smsqueues':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x4a');break;case'smsaccounts':_0x26e2a2['childModel']=_0x83a5('0x4b');break;case'whatsappqueues':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x4c');break;case _0x83a5('0x4d'):_0x26e2a2['childModel']='WhatsappAccount';break;case _0x83a5('0x4e'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x4f');break;case _0x83a5('0x50'):case _0x83a5('0x51'):_0x26e2a2['childModel']=_0x83a5('0x3a');if(_0x399f9e){_0x26e2a2['parentSections']=[{'name':_0x83a5('0x38')},{'name':_0x83a5('0x3c')}];}break;case _0x83a5('0x52'):case _0x83a5('0x53'):case _0x83a5('0x54'):_0x26e2a2[_0x83a5('0x14')]='User';if(_0x399f9e){_0x26e2a2[_0x83a5('0x1a')]=[{'name':'Users','filter':{'field':'role','value':[_0x83a5('0x55'),_0x83a5('0x56')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x83a5('0x57'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x58');break;case _0x83a5('0x59'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x5a');break;case'freshdeskaccounts':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x5b');break;case _0x83a5('0x5c'):_0x26e2a2['childModel']=_0x83a5('0x5d');break;case _0x83a5('0x5e'):_0x26e2a2[_0x83a5('0x14')]='DeskAccount';break;case _0x83a5('0x5f'):_0x26e2a2['childModel']='ZohoAccount';break;case _0x83a5('0x60'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x61');break;case _0x83a5('0x62'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x63');break;case _0x83a5('0x64'):_0x26e2a2['childModel']=_0x83a5('0x65');break;case _0x83a5('0x66'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x67');break;case'intervals':_0x26e2a2['childModel']='Interval';break;case _0x83a5('0x68'):_0x26e2a2[_0x83a5('0x14')]='Pause';break;case'scheduler':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x69');break;case _0x83a5('0x6a'):_0x26e2a2[_0x83a5('0x14')]='Sound';break;case _0x83a5('0x6b'):_0x26e2a2[_0x83a5('0x14')]='Tag';break;case _0x83a5('0x6c'):_0x26e2a2['childModel']=_0x83a5('0x6d');break;case _0x83a5('0x6e'):_0x26e2a2['childModel']='Trigger';break;case _0x83a5('0x6f'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x70');break;case _0x83a5('0x71'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x72');break;case _0x83a5('0x73'):_0x26e2a2['childModel']=_0x83a5('0x74');break;case'extractedreports':_0x26e2a2[_0x83a5('0x14')]='AnalyticExtractedReport';_0x26e2a2['parentSections']=[{'name':_0x83a5('0x75'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x76');break;}return _0x26e2a2;}function _0x6a0171(_0x3db906,_0x345161){var _0x2c5d9c=_0x3db906[_0x83a5('0x77')](0x0)[_0x83a5('0x78')]()+_0x3db906[_0x83a5('0x79')](0x1);var _0x71fa93={'type':_0x432d16['Sequelize']['QueryTypes'][_0x83a5('0x7a')],'raw':!![]};return new Promise(function(_0x13164e,_0x5f271b){var _0xfa4c93=squel[_0x83a5('0x7b')]()['field'](_0x83a5('0x7c')+_0x2c5d9c+'InteractionId','id')[_0x83a5('0x6')](_0x83a5('0x7d'))['from']('user_has_'+_0x3db906+_0x83a5('0x7e'),'ui')[_0x83a5('0x7f')](_0x83a5('0x80'),_0x345161['id']);return _0x432d16[_0x83a5('0x81')][_0x83a5('0x82')](_0xfa4c93['toString'](),_0x71fa93)[_0x83a5('0x9')](function(_0x565b1c){_0x345161[_0x2c5d9c+_0x83a5('0x83')]=_0x565b1c;_0x13164e(_0x565b1c);})['catch'](function(_0x5b146a){_0x5f271b(_0x5b146a);});});}return _0x4daaea[_0x83a5('0x84')]('UserProfile',attributes,{'tableName':_0x83a5('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x571051){var _0x187d33={'raw':_0x571051[_0x83a5('0x82')][_0x83a5('0x86')],'where':{}};var _0x5ecb63={};var _0x1e18ff={'count':0x0,'rows':[]};var _0x2363a7=_0x571051[_0x83a5('0x82')][_0x83a5('0x87')];var _0x4957f8=_0x571051[_0x83a5('0x82')][_0x83a5('0x88')]||![];var _0x45c5f5=_0x37a4a1(_0x2363a7,_0x4957f8);if(!_0x45c5f5['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x2363a7+'\x27');var _0x209f8b=[{'name':_0x2363a7}];if(!_[_0x83a5('0x89')](_0x45c5f5[_0x83a5('0x1a')]))_0x209f8b=_0x45c5f5['parentSections'];var _0x37699b=[];for(var _0x263602=0x0;_0x263602<_0x209f8b[_0x83a5('0x8a')];_0x263602++){_0x37699b[_0x83a5('0x8b')](_0x432d16[_0x83a5('0x8c')]['find']({'where':{'userProfileId':_0x571051[_0x83a5('0x8d')]['id'],'name':_0x209f8b[_0x263602][_0x83a5('0xc')]},'raw':!![]}));}return Promise[_0x83a5('0x8e')](_0x37699b)[_0x83a5('0x9')](function(_0x2bd903){var _0x2b6fd8=_[_0x83a5('0x5')](_0x2bd903,function(_0x295778){return _0x295778?_0x295778:undefined;});var _0x433765=_[_0x83a5('0x5')](_0x209f8b,['ignore',!![]]);var _0x15afa7=_['isEmpty'](_0x2b6fd8)&&_[_0x83a5('0x89')](_0x433765)?null:_[_0x83a5('0x8f')](_0x433765,_0x2b6fd8);if(!_0x15afa7)return null;var _0x28ba6e=[];for(var _0xbb06a3=0x0;_0xbb06a3<_0x15afa7[_0x83a5('0x8a')];_0xbb06a3++){var _0xbd1afa=_['find'](_0x209f8b,function(_0x455b82){return _0x15afa7[_0xbb06a3]?_0x455b82['name']===_0x15afa7[_0xbb06a3][_0x83a5('0xc')]:null;});if(_0xbd1afa){if(_0x15afa7[_0xbb06a3][_0x83a5('0x90')]){_0x28ba6e[_0x83a5('0x8b')](_0x7bb356(_0x45c5f5[_0x83a5('0x14')],_0x15afa7[_0xbb06a3]));}else{if(!_0x15afa7[_0xbb06a3][_0x83a5('0x91')]){_0x28ba6e['push'](_0x4e7738(_0xbd1afa,_0x15afa7[_0xbb06a3],_0x45c5f5['childModel']));}else{if(_0xbd1afa['model']){_0x28ba6e[_0x83a5('0x8b')](_0x43444a(_0xbd1afa,_0x15afa7[_0xbb06a3]));}}}}}return Promise[_0x83a5('0x8e')](_0x28ba6e);})[_0x83a5('0x9')](function(_0x487356){var _0x17c8db=_0x487356;var _0xe37a87=null;if(_0x17c8db){_0xe37a87=_0x17c8db[_0x83a5('0x8a')]===0x1?_0x17c8db[0x0]:null;}if(!_0xe37a87&&!_0x17c8db)return _0x1e18ff;var _0x5bdb35=_0x432d16[_0x45c5f5[_0x83a5('0x14')]][_0x83a5('0x92')];_0x5ecb63[_0x83a5('0x93')]=_['keys'](_0x5bdb35);_0x5ecb63[_0x83a5('0x82')]=_[_0x83a5('0x94')](_0x571051[_0x83a5('0x82')]);_0x5ecb63[_0x83a5('0x95')]=_[_0x83a5('0x96')](_0x5ecb63[_0x83a5('0x93')],_0x5ecb63[_0x83a5('0x82')]);_0x187d33[_0x83a5('0x97')]=_[_0x83a5('0x96')](_0x5ecb63['model'],qs[_0x83a5('0x98')](_0x571051[_0x83a5('0x82')][_0x83a5('0x98')]));_0x187d33[_0x83a5('0x97')]=_0x187d33[_0x83a5('0x97')]['length']?_0x187d33[_0x83a5('0x97')]:_0x5ecb63['model'];if(!_0x571051['query'][_0x83a5('0x99')](_0x83a5('0x9a'))){_0x187d33[_0x83a5('0x9b')]=qs['limit'](_0x571051[_0x83a5('0x82')]['limit']);_0x187d33[_0x83a5('0x9c')]=qs['offset'](_0x571051[_0x83a5('0x82')]['offset']);}_0x187d33[_0x83a5('0x9d')]=qs[_0x83a5('0x9e')](_0x571051['query'][_0x83a5('0x9e')]);_0x187d33[_0x83a5('0x7f')]=qs['filters'](_[_0x83a5('0x9f')](_0x571051[_0x83a5('0x82')],_0x5ecb63[_0x83a5('0x95')]));if(_0x571051[_0x83a5('0x82')][_0x83a5('0x5')]){_0x187d33['where']=_[_0x83a5('0xa0')](_0x187d33[_0x83a5('0x7f')],{'$or':_['map'](_0x5bdb35,function(_0x15d0a6){if(_0x15d0a6[_0x83a5('0x11')][_0x83a5('0xa1')]!==_0x83a5('0xa2')){var _0x366813={};_0x366813[_0x15d0a6[_0x83a5('0x6')]]={'$like':'%'+_0x571051['query'][_0x83a5('0x5')]+'%'};return _0x366813;}})});}var _0x271204=[];var _0x4ddc93=null;var _0x4b37ef={};if(_0xe37a87){_0x4ddc93=_['find'](_0x209f8b,[_0x83a5('0xc'),_0xe37a87[_0x83a5('0xc')]]);if(_0x4ddc93['field']){_0x4b37ef={};if(_0x45c5f5['childModel']===_0x83a5('0xa3')){_0x4b37ef[_0x4ddc93['foreignKey']]=_[_0x83a5('0xb')](_0xe37a87['associatedResources'],'id');}else{_0x4b37ef[_0x4ddc93[_0x83a5('0xa4')]]=_0xe37a87['associatedResources'];}_0x271204[_0x83a5('0x8b')](_0x4b37ef);}else{_0x187d33[_0x83a5('0x7f')]['id']=_0xe37a87[_0x83a5('0xa')];}}else{for(var _0xe31685=0x0;_0xe31685<_0x17c8db[_0x83a5('0x8a')];_0xe31685++){_0x4ddc93=_[_0x83a5('0xa5')](_0x209f8b,[_0x83a5('0xc'),_0x17c8db[_0xe31685]['name']]);if(_0x4ddc93['field']){_0x4b37ef={};_0x4b37ef[_0x4ddc93['foreignKey']]=_0x17c8db[_0xe31685][_0x83a5('0xa')];_0x271204[_0x83a5('0x8b')](_0x4b37ef);}else{if(!_0x187d33['where']['id'])_0x187d33[_0x83a5('0x7f')]['id']=[];_0x17c8db[_0xe31685]['associatedResources'][_0x83a5('0xa6')](function(_0x39d188){_0x187d33[_0x83a5('0x7f')]['id'][_0x83a5('0x8b')](_0x39d188);});}}}if(!_[_0x83a5('0x89')](_0x271204)){_0x187d33[_0x83a5('0x7f')]=_['merge'](_0x187d33[_0x83a5('0x7f')],{'$and':{'$or':_0x271204}});}_0x187d33=_[_0x83a5('0xa0')]({},_0x187d33,_0x571051['options']);if(_0xe37a87&&!_0xe37a87[_0x83a5('0x91')]&&_0x45c5f5[_0x83a5('0x14')]==='AnalyticExtractedReport'){if(_0x571051[_0x83a5('0x82')][_0x83a5('0xa7')]){_0x187d33[_0x83a5('0xa8')]=[{'all':!![]}];}return _0x432d16[_0x45c5f5[_0x83a5('0x14')]][_0x83a5('0x8')](_0x187d33)[_0x83a5('0x9')](function(_0x3bf9bf){var _0x3dfa6f=[];_0x3bf9bf[_0x83a5('0xa6')](function(_0x2de0e1){var _0x1e0821;switch(_0x2de0e1['reportType']){case _0x83a5('0xa9'):_0x1e0821=_[_0x83a5('0xa5')](_0xe37a87[_0x83a5('0xa')],function(_0x26a066){return _0x26a066['id']===_0x2de0e1[_0x83a5('0xaa')]&&_0x26a066['type']==='DefaultReports';});break;case _0x83a5('0xab'):_0x1e0821=_['find'](_0xe37a87[_0x83a5('0xa')],function(_0x2d3fda){return _0x2d3fda['id']===_0x2de0e1[_0x83a5('0xaa')]&&_0x2d3fda['type']==='CustomReports';});break;}if(_0x1e0821)_0x3dfa6f[_0x83a5('0x8b')](_0x2de0e1);});_0x1e18ff[_0x83a5('0xac')]=_0x3dfa6f['length'];_0x1e18ff['rows']=_0x3dfa6f;return _0x1e18ff;});}else{if(!_['isEmpty'](_0x571051[_0x83a5('0x82')][_0x83a5('0xad')])){_0x187d33['where']['id']=_0x187d33[_0x83a5('0x7f')]['id']?_[_0x83a5('0x96')](_0x187d33[_0x83a5('0x7f')]['id'],_0x571051[_0x83a5('0x82')][_0x83a5('0xad')]):_0x571051[_0x83a5('0x82')][_0x83a5('0xad')];if(_0x571051['query'][_0x83a5('0xae')]){_0x187d33[_0x83a5('0x9d')]=_0x571051[_0x83a5('0x82')][_0x83a5('0xae')];}}if(_0x571051['query'][_0x83a5('0xaf')]){_0x187d33['where']=_[_0x83a5('0xa0')](_0x187d33['where'],{'$and':_0x571051[_0x83a5('0x82')][_0x83a5('0xaf')]});}return _0x432d16[_0x45c5f5[_0x83a5('0x14')]][_0x83a5('0xac')]({'where':_0x187d33[_0x83a5('0x7f')]})[_0x83a5('0x9')](function(_0x2ac196){_0x1e18ff[_0x83a5('0xac')]=_0x2ac196;if(_0x571051[_0x83a5('0x82')][_0x83a5('0xa7')]){if(_0x45c5f5['childModel']===_0x83a5('0x1e')){_0x187d33[_0x83a5('0xa8')]=[{'model':_0x432d16['Tag'],'as':_0x83a5('0xb0'),'attributes':['id',_0x83a5('0xc'),_0x83a5('0xb1')],'required':_0x571051['query']['tag']?!![]:![]},{'model':_0x432d16[_0x83a5('0xb2')],'as':'ThroughTags','attributes':['id','name','color'],'through':_0x571051['query'][_0x83a5('0xb3')]?{'attributes':[],'where':{'TagId':_0x571051['query'][_0x83a5('0xb3')]||undefined}}:{},'required':_0x571051[_0x83a5('0x82')][_0x83a5('0xb3')]?!![]:![]}];}else{_0x187d33[_0x83a5('0xa8')]=[{'all':!![]}];}}return _0x432d16[_0x45c5f5[_0x83a5('0x14')]][_0x83a5('0x8')](_0x187d33);})[_0x83a5('0x9')](function(_0x2d164b){_0x1e18ff[_0x83a5('0xb4')]=_0x2d164b;if(_0x2363a7===_0x83a5('0x34')&&_0x571051[_0x83a5('0x82')][_0x83a5('0xb5')]===_0x83a5('0xb6')){var _0x54caee=[];for(var _0x4ef2d1=0x0;_0x4ef2d1<_0x1e18ff['rows'][_0x83a5('0x8a')];_0x4ef2d1++){_0x54caee[_0x83a5('0x8b')](_0x6a0171(_0x83a5('0xb7'),_0x1e18ff[_0x83a5('0xb4')][_0x4ef2d1]['dataValues']));_0x54caee[_0x83a5('0x8b')](_0x6a0171('sms',_0x1e18ff[_0x83a5('0xb4')][_0x4ef2d1][_0x83a5('0xb8')]));_0x54caee[_0x83a5('0x8b')](_0x6a0171(_0x83a5('0xb9'),_0x1e18ff['rows'][_0x4ef2d1]['dataValues']));_0x54caee[_0x83a5('0x8b')](_0x6a0171(_0x83a5('0xba'),_0x1e18ff[_0x83a5('0xb4')][_0x4ef2d1][_0x83a5('0xb8')]));_0x54caee[_0x83a5('0x8b')](_0x6a0171('openchannel',_0x1e18ff['rows'][_0x4ef2d1][_0x83a5('0xb8')]));_0x54caee[_0x83a5('0x8b')](_0x6a0171('whatsapp',_0x1e18ff[_0x83a5('0xb4')][_0x4ef2d1][_0x83a5('0xb8')]));}return Promise[_0x83a5('0x8e')](_0x54caee)[_0x83a5('0x9')](function(){return _0x1e18ff;});}return _0x1e18ff;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 3d724c5..6f3d6c5 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 _0x8ac9=['message','UserProfile,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','request','then','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4ade17,_0x1bff9b){var _0x3e4bb9=function(_0x2bbd08){while(--_0x2bbd08){_0x4ade17['push'](_0x4ade17['shift']());}};_0x3e4bb9(++_0x1bff9b);}(_0x8ac9,0x199));var _0x98ac=function(_0xc89f5,_0x1f8de7){_0xc89f5=_0xc89f5-0x0;var _0x39d90b=_0x8ac9[_0xc89f5];return _0x39d90b;};'use strict';var _=require(_0x98ac('0x0'));var util=require(_0x98ac('0x1'));var moment=require(_0x98ac('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98ac('0x3'));var db=require(_0x98ac('0x4'))['db'];var utils=require(_0x98ac('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x98ac('0x6'));var jayson=require(_0x98ac('0x7'));var client=jayson[_0x98ac('0x8')]['http']({'port':0x232a});config['redis']=_[_0x98ac('0x9')](config[_0x98ac('0xa')],{'host':_0x98ac('0xb'),'port':0x18eb});var socket=require(_0x98ac('0xc'))(new Redis(config[_0x98ac('0xa')]));require(_0x98ac('0xd'))['register'](socket);function respondWithRpcPromise(_0x3335ce,_0x55e46f,_0xb21a9d){return new BPromise(function(_0x432461,_0x8f058c){return client[_0x98ac('0xe')](_0x3335ce,_0xb21a9d)[_0x98ac('0xf')](function(_0x4724b6){logger[_0x98ac('0x10')]('UserProfile,\x20%s,\x20%s',_0x55e46f,'request\x20sent');logger[_0x98ac('0x11')](_0x98ac('0x12'),_0x55e46f,_0x98ac('0x13'),JSON[_0x98ac('0x14')](_0x4724b6));if(_0x4724b6['error']){if(_0x4724b6[_0x98ac('0x15')][_0x98ac('0x16')]===0x1f4){logger[_0x98ac('0x15')]('UserProfile,\x20%s,\x20%s',_0x55e46f,_0x4724b6['error'][_0x98ac('0x17')]);return _0x8f058c(_0x4724b6[_0x98ac('0x15')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x55e46f,_0x4724b6[_0x98ac('0x15')][_0x98ac('0x17')]);return _0x432461(_0x4724b6['error'][_0x98ac('0x17')]);}else{logger[_0x98ac('0x10')](_0x98ac('0x18'),_0x55e46f,'request\x20sent');_0x432461(_0x4724b6[_0x98ac('0x19')][_0x98ac('0x17')]);}})[_0x98ac('0x1a')](function(_0x48f000){logger[_0x98ac('0x15')](_0x98ac('0x18'),_0x55e46f,_0x48f000);_0x8f058c(_0x48f000);});});} \ No newline at end of file +var _0x0024=['defaults','localhost','socket.io-emitter','./userProfile.socket','request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','util','bluebird','ioredis','../../config/logger','rpc','client','http','redis'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x0024,0xa8));var _0x4002=function(_0x3c22b3,_0x509f39){_0x3c22b3=_0x3c22b3-0x0;var _0x6969f7=_0x0024[_0x3c22b3];return _0x6969f7;};'use strict';var _=require('lodash');var util=require(_0x4002('0x0'));var moment=require('moment');var BPromise=require(_0x4002('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4002('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4002('0x3'))(_0x4002('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4002('0x5')][_0x4002('0x6')]({'port':0x232a});config[_0x4002('0x7')]=_[_0x4002('0x8')](config['redis'],{'host':_0x4002('0x9'),'port':0x18eb});var socket=require(_0x4002('0xa'))(new Redis(config[_0x4002('0x7')]));require(_0x4002('0xb'))['register'](socket);function respondWithRpcPromise(_0x5f32c7,_0x21c971,_0x26fd5d){return new BPromise(function(_0x397864,_0x12c368){return client[_0x4002('0xc')](_0x5f32c7,_0x26fd5d)['then'](function(_0x53c0ef){logger['info'](_0x4002('0xd'),_0x21c971,_0x4002('0xe'));logger[_0x4002('0xf')](_0x4002('0x10'),_0x21c971,'request\x20sent',JSON[_0x4002('0x11')](_0x53c0ef));if(_0x53c0ef[_0x4002('0x12')]){if(_0x53c0ef[_0x4002('0x12')][_0x4002('0x13')]===0x1f4){logger[_0x4002('0x12')]('UserProfile,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x12c368(_0x53c0ef[_0x4002('0x12')][_0x4002('0x14')]);}logger[_0x4002('0x12')]('UserProfile,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x397864(_0x53c0ef['error'][_0x4002('0x14')]);}else{logger[_0x4002('0x15')]('UserProfile,\x20%s,\x20%s',_0x21c971,_0x4002('0xe'));_0x397864(_0x53c0ef['result']['message']);}})['catch'](function(_0x22820f){logger[_0x4002('0x12')](_0x4002('0xd'),_0x21c971,_0x22820f);_0x12c368(_0x22820f);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e49e8e3..bd9537d 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 _0x63fc=['./userProfile.events','remove','emit','removeListener','register','length','userProfile:'];(function(_0x2e057a,_0x399f37){var _0x10c9f3=function(_0x2ef459){while(--_0x2ef459){_0x2e057a['push'](_0x2e057a['shift']());}};_0x10c9f3(++_0x399f37);}(_0x63fc,0x150));var _0xc63f=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x63fc[_0x5a95fa];return _0x1a61b8;};'use strict';var UserProfileEvents=require(_0xc63f('0x0'));var events=['save',_0xc63f('0x1'),'update'];function createListener(_0x52c1cb,_0x125dce){return function(_0x15396b){_0x125dce[_0xc63f('0x2')](_0x52c1cb,_0x15396b);};}function removeListener(_0x1fb390,_0x371a84){return function(){UserProfileEvents[_0xc63f('0x3')](_0x1fb390,_0x371a84);};}exports[_0xc63f('0x4')]=function(_0x303965){for(var _0xfc86b4=0x0,_0x3c380d=events[_0xc63f('0x5')];_0xfc86b4<_0x3c380d;_0xfc86b4++){var _0x57b49b=events[_0xfc86b4];var _0x56b083=createListener(_0xc63f('0x6')+_0x57b49b,_0x303965);UserProfileEvents['on'](_0x57b49b,_0x56b083);}}; \ No newline at end of file +var _0xb3db=['emit','removeListener','length','./userProfile.events','save','remove','update'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xb3db,0xf8));var _0xbb3d=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xb3db[_0x40bffc];return _0x3007e9;};'use strict';var UserProfileEvents=require(_0xbb3d('0x0'));var events=[_0xbb3d('0x1'),_0xbb3d('0x2'),_0xbb3d('0x3')];function createListener(_0x1567e7,_0x1921b2){return function(_0x16a0f8){_0x1921b2[_0xbb3d('0x4')](_0x1567e7,_0x16a0f8);};}function removeListener(_0x4abccb,_0x423ff8){return function(){UserProfileEvents[_0xbb3d('0x5')](_0x4abccb,_0x423ff8);};}exports['register']=function(_0x4d644f){for(var _0x337736=0x0,_0x3b65a9=events[_0xbb3d('0x6')];_0x337736<_0x3b65a9;_0x337736++){var _0x34705f=events[_0x337736];var _0x3ecc0e=createListener('userProfile:'+_0x34705f,_0x4d644f);UserProfileEvents['on'](_0x34705f,_0x3ecc0e);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 87ecb65..92e7eca 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 _0x2a0d=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','/describe','describe','get','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x2a0d,0x1c8));var _0xd2a0=function(_0x4bfbc8,_0x182459){_0x4bfbc8=_0x4bfbc8-0x0;var _0xad75e1=_0x2a0d[_0x4bfbc8];return _0xad75e1;};'use strict';var multer=require(_0xd2a0('0x0'));var util=require(_0xd2a0('0x1'));var path=require(_0xd2a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xd2a0('0x3'));var router=express[_0xd2a0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd2a0('0x5'));var interaction=require(_0xd2a0('0x6'));var config=require(_0xd2a0('0x7'));var controller=require(_0xd2a0('0x8'));router['get']('/',auth[_0xd2a0('0x9')](),controller[_0xd2a0('0xa')]);router['get'](_0xd2a0('0xb'),auth[_0xd2a0('0x9')](),controller[_0xd2a0('0xc')]);router[_0xd2a0('0xd')]('/:id',auth[_0xd2a0('0x9')](),controller[_0xd2a0('0xe')]);router[_0xd2a0('0xf')]('/',auth[_0xd2a0('0x9')](),controller['create']);router[_0xd2a0('0x10')](_0xd2a0('0x11'),auth[_0xd2a0('0x9')](),controller[_0xd2a0('0x12')]);router[_0xd2a0('0x13')](_0xd2a0('0x11'),auth[_0xd2a0('0x9')](),controller[_0xd2a0('0x14')]);module[_0xd2a0('0x15')]=router; \ No newline at end of file +var _0xddc5=['post','create','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xf13641,_0x4342c1){var _0x3d9f3d=function(_0x1b1ef3){while(--_0x1b1ef3){_0xf13641['push'](_0xf13641['shift']());}};_0x3d9f3d(++_0x4342c1);}(_0xddc5,0x101));var _0x5ddc=function(_0xecb1b7,_0x5c05e6){_0xecb1b7=_0xecb1b7-0x0;var _0xa22d64=_0xddc5[_0xecb1b7];return _0xa22d64;};'use strict';var multer=require(_0x5ddc('0x0'));var util=require(_0x5ddc('0x1'));var path=require('path');var timeout=require(_0x5ddc('0x2'));var express=require(_0x5ddc('0x3'));var router=express[_0x5ddc('0x4')]();var fs_extra=require(_0x5ddc('0x5'));var auth=require(_0x5ddc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5ddc('0x7'));router[_0x5ddc('0x8')]('/',auth[_0x5ddc('0x9')](),controller[_0x5ddc('0xa')]);router[_0x5ddc('0x8')](_0x5ddc('0xb'),auth[_0x5ddc('0x9')](),controller[_0x5ddc('0xc')]);router[_0x5ddc('0x8')](_0x5ddc('0xd'),auth[_0x5ddc('0x9')](),controller[_0x5ddc('0xe')]);router[_0x5ddc('0xf')]('/',auth[_0x5ddc('0x9')](),controller[_0x5ddc('0x10')]);router['put'](_0x5ddc('0xd'),auth[_0x5ddc('0x9')](),controller['update']);router['delete'](_0x5ddc('0xd'),auth[_0x5ddc('0x9')](),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 33913fd..94db530 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 _0x62bc=['sequelize','STRING','INTEGER'];(function(_0x529798,_0x2d10d8){var _0x30bbfa=function(_0x307890){while(--_0x307890){_0x529798['push'](_0x529798['shift']());}};_0x30bbfa(++_0x2d10d8);}(_0x62bc,0x72));var _0xc62b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc62b('0x0'));module['exports']={'name':{'type':Sequelize[_0xc62b('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc62b('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x103e=['sequelize','STRING','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x103e,0x18c));var _0xe103=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x103e[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xe103('0x0'));module['exports']={'name':{'type':Sequelize[_0xe103('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe103('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index ac83785..e26b28a 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 _0x6343=['VIRTUAL','options','UserProfileResource','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x6343,0x168));var _0x3634=function(_0x40a006,_0x420901){_0x40a006=_0x40a006-0x0;var _0x5e8f89=_0x6343[_0x40a006];return _0x5e8f89;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['UserProfileResource'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['UserProfileResource'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file +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(_0x112c5d,_0x295440){var _0xb50c7e=function(_0x311b26){while(--_0x311b26){_0x112c5d['push'](_0x112c5d['shift']());}};_0xb50c7e(++_0x295440);}(_0xd117,0x182));var _0x7d11=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0xd117[_0x36d25e];return _0x4b95b8;};'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 diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 19ba98c..bee53a9 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 _0x6947=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6947,0x1c0));var _0x7694=function(_0x15d605,_0x6793ed){_0x15d605=_0x15d605-0x0;var _0x1cc906=_0x6947[_0x15d605];return _0x1cc906;};'use strict';var _=require(_0x7694('0x0'));var util=require(_0x7694('0x1'));var logger=require(_0x7694('0x2'))(_0x7694('0x3'));var moment=require(_0x7694('0x4'));var BPromise=require(_0x7694('0x5'));var rp=require(_0x7694('0x6'));var fs=require('fs');var path=require(_0x7694('0x7'));var rimraf=require(_0x7694('0x8'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x7694('0x9')]=function(_0x1c693a,_0x32cea0){return _0x1c693a[_0x7694('0xa')]('UserProfileResource',attributes,{'tableName':_0x7694('0xb'),'paranoid':![],'indexes':[{'name':_0x7694('0xc'),'fields':[_0x7694('0xd'),_0x7694('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d5c=['request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0x5d5c,0x17b));var _0xc5d5=function(_0x19b571,_0x2e3579){_0x19b571=_0x19b571-0x0;var _0x17cb19=_0x5d5c[_0x19b571];return _0x17cb19;};'use strict';var _=require(_0xc5d5('0x0'));var util=require(_0xc5d5('0x1'));var logger=require(_0xc5d5('0x2'))('api');var moment=require(_0xc5d5('0x3'));var BPromise=require(_0xc5d5('0x4'));var rp=require(_0xc5d5('0x5'));var fs=require('fs');var path=require(_0xc5d5('0x6'));var rimraf=require(_0xc5d5('0x7'));var config=require(_0xc5d5('0x8'));var attributes=require(_0xc5d5('0x9'));module[_0xc5d5('0xa')]=function(_0x548b23,_0x5cd1d7){return _0x548b23[_0xc5d5('0xb')](_0xc5d5('0xc'),attributes,{'tableName':_0xc5d5('0xd'),'paranoid':![],'indexes':[{'name':_0xc5d5('0xe'),'fields':[_0xc5d5('0xf'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4758bf2..01cedb8 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 _0x7694=['UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x4389ca,_0x447b1a){var _0x16932f=function(_0x4a6de1){while(--_0x4a6de1){_0x4389ca['push'](_0x4389ca['shift']());}};_0x16932f(++_0x447b1a);}(_0x7694,0x86));var _0x4769=function(_0x9e4996,_0x26df96){_0x9e4996=_0x9e4996-0x0;var _0x1ad5f1=_0x7694[_0x9e4996];return _0x1ad5f1;};'use strict';var _=require(_0x4769('0x0'));var util=require(_0x4769('0x1'));var moment=require('moment');var BPromise=require(_0x4769('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4769('0x3'));var db=require(_0x4769('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4769('0x5'))(_0x4769('0x6'));var config=require(_0x4769('0x7'));var jayson=require(_0x4769('0x8'));var client=jayson[_0x4769('0x9')][_0x4769('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21717b,_0x81d7a2,_0x58bceb){return new BPromise(function(_0x113c1e,_0x160875){return client[_0x4769('0xb')](_0x21717b,_0x58bceb)['then'](function(_0x5a0eb8){logger[_0x4769('0xc')](_0x4769('0xd'),_0x81d7a2,_0x4769('0xe'));logger['debug'](_0x4769('0xf'),_0x81d7a2,_0x4769('0xe'),JSON[_0x4769('0x10')](_0x5a0eb8));if(_0x5a0eb8[_0x4769('0x11')]){if(_0x5a0eb8[_0x4769('0x11')]['code']===0x1f4){logger[_0x4769('0x11')](_0x4769('0xd'),_0x81d7a2,_0x5a0eb8[_0x4769('0x11')][_0x4769('0x12')]);return _0x160875(_0x5a0eb8[_0x4769('0x11')][_0x4769('0x12')]);}logger[_0x4769('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x81d7a2,_0x5a0eb8[_0x4769('0x11')][_0x4769('0x12')]);return _0x113c1e(_0x5a0eb8[_0x4769('0x11')][_0x4769('0x12')]);}else{logger[_0x4769('0xc')](_0x4769('0xd'),_0x81d7a2,_0x4769('0xe'));_0x113c1e(_0x5a0eb8[_0x4769('0x13')]['message']);}})[_0x4769('0x14')](function(_0x21f83b){logger[_0x4769('0x11')](_0x4769('0xd'),_0x81d7a2,_0x21f83b);_0x160875(_0x21f83b);});});} \ No newline at end of file +var _0x6c37=['jayson/promise','client','http','request','then','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x16b667,_0xadec02){var _0x58620e=function(_0x5db60b){while(--_0x5db60b){_0x16b667['push'](_0x16b667['shift']());}};_0x58620e(++_0xadec02);}(_0x6c37,0x1c7));var _0x76c3=function(_0x3d61d7,_0x10ce18){_0x3d61d7=_0x3d61d7-0x0;var _0x3752b3=_0x6c37[_0x3d61d7];return _0x3752b3;};'use strict';var _=require('lodash');var util=require(_0x76c3('0x0'));var moment=require(_0x76c3('0x1'));var BPromise=require(_0x76c3('0x2'));var rs=require(_0x76c3('0x3'));var fs=require('fs');var Redis=require(_0x76c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76c3('0x5'));var logger=require('../../config/logger')(_0x76c3('0x6'));var config=require('../../config/environment');var jayson=require(_0x76c3('0x7'));var client=jayson[_0x76c3('0x8')][_0x76c3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x446e5a,_0x4fca28,_0x2d69cf){return new BPromise(function(_0x1912ec,_0x4dcd96){return client[_0x76c3('0xa')](_0x446e5a,_0x2d69cf)[_0x76c3('0xb')](function(_0x3da146){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x4fca28,_0x76c3('0xc'));logger[_0x76c3('0xd')](_0x76c3('0xe'),_0x4fca28,_0x76c3('0xc'),JSON[_0x76c3('0xf')](_0x3da146));if(_0x3da146[_0x76c3('0x10')]){if(_0x3da146[_0x76c3('0x10')][_0x76c3('0x11')]===0x1f4){logger[_0x76c3('0x10')](_0x76c3('0x12'),_0x4fca28,_0x3da146[_0x76c3('0x10')][_0x76c3('0x13')]);return _0x4dcd96(_0x3da146[_0x76c3('0x10')][_0x76c3('0x13')]);}logger[_0x76c3('0x10')](_0x76c3('0x12'),_0x4fca28,_0x3da146[_0x76c3('0x10')][_0x76c3('0x13')]);return _0x1912ec(_0x3da146[_0x76c3('0x10')][_0x76c3('0x13')]);}else{logger['info'](_0x76c3('0x12'),_0x4fca28,_0x76c3('0xc'));_0x1912ec(_0x3da146['result'][_0x76c3('0x13')]);}})[_0x76c3('0x14')](function(_0x577ad7){logger[_0x76c3('0x10')](_0x76c3('0x12'),_0x4fca28,_0x577ad7);_0x4dcd96(_0x577ad7);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 06e54f5..db31247 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 _0x6a0c=['fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','post','put','delete','/:id','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x57f8ca,_0x115fd9){var _0xe8e71d=function(_0x40dadd){while(--_0x40dadd){_0x57f8ca['push'](_0x57f8ca['shift']());}};_0xe8e71d(++_0x115fd9);}(_0x6a0c,0x140));var _0xc6a0=function(_0x1a68fa,_0x356c02){_0x1a68fa=_0x1a68fa-0x0;var _0x145b22=_0x6a0c[_0x1a68fa];return _0x145b22;};'use strict';var multer=require(_0xc6a0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc6a0('0x1'));var express=require(_0xc6a0('0x2'));var router=express[_0xc6a0('0x3')]();var fs_extra=require(_0xc6a0('0x4'));var auth=require(_0xc6a0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6a0('0x6'));var controller=require('./userProfileSection.controller');router[_0xc6a0('0x7')]('/',auth['isAuthenticated'](),controller[_0xc6a0('0x8')]);router[_0xc6a0('0x7')]('/describe',auth[_0xc6a0('0x9')](),controller[_0xc6a0('0xa')]);router[_0xc6a0('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc6a0('0xb')]);router[_0xc6a0('0xc')]('/',auth[_0xc6a0('0x9')](),controller['create']);router[_0xc6a0('0xd')]('/:id',auth[_0xc6a0('0x9')](),controller['update']);router[_0xc6a0('0xe')](_0xc6a0('0xf'),auth['isAuthenticated'](),controller[_0xc6a0('0x10')]);module[_0xc6a0('0x11')]=router; \ No newline at end of file +var _0xf969=['describe','/:id','show','create','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe'];(function(_0x45cb89,_0x99520e){var _0x5948c1=function(_0x4c81c3){while(--_0x4c81c3){_0x45cb89['push'](_0x45cb89['shift']());}};_0x5948c1(++_0x99520e);}(_0xf969,0x1ce));var _0x9f96=function(_0x55ee8e,_0x3409c3){_0x55ee8e=_0x55ee8e-0x0;var _0x5acdae=_0xf969[_0x55ee8e];return _0x5acdae;};'use strict';var multer=require(_0x9f96('0x0'));var util=require(_0x9f96('0x1'));var path=require(_0x9f96('0x2'));var timeout=require(_0x9f96('0x3'));var express=require(_0x9f96('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9f96('0x5'));var interaction=require(_0x9f96('0x6'));var config=require(_0x9f96('0x7'));var controller=require(_0x9f96('0x8'));router['get']('/',auth[_0x9f96('0x9')](),controller[_0x9f96('0xa')]);router[_0x9f96('0xb')](_0x9f96('0xc'),auth[_0x9f96('0x9')](),controller[_0x9f96('0xd')]);router['get'](_0x9f96('0xe'),auth[_0x9f96('0x9')](),controller[_0x9f96('0xf')]);router['post']('/',auth[_0x9f96('0x9')](),controller[_0x9f96('0x10')]);router['put'](_0x9f96('0xe'),auth[_0x9f96('0x9')](),controller['update']);router[_0x9f96('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9f96('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 7527fc0..24d90f4 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 _0x1c9a=['sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','split'];(function(_0x4089d1,_0x10c140){var _0x1b4aee=function(_0x77412a){while(--_0x77412a){_0x4089d1['push'](_0x4089d1['shift']());}};_0x1b4aee(++_0x10c140);}(_0x1c9a,0x98));var _0xa1c9=function(_0x30f181,_0x228bc0){_0x30f181=_0x30f181-0x0;var _0x151fa5=_0x1c9a[_0x30f181];return _0x151fa5;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1c9('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xa1c9('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xa1c9('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xa1c9('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x21c0fc){this[_0xa1c9('0x4')](_0xa1c9('0x5'),_0x21c0fc?_0x21c0fc[_0xa1c9('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xa1c9('0x5'))?this['getDataValue'](_0xa1c9('0x5'))[_0xa1c9('0x7')](''):[];}}}; \ No newline at end of file +var _0xb9a7=['getDataValue','split','exports','BOOLEAN','STRING','setDataValue','crudPermissions','join'];(function(_0x255542,_0x37855d){var _0x26cd52=function(_0x5427cb){while(--_0x5427cb){_0x255542['push'](_0x255542['shift']());}};_0x26cd52(++_0x37855d);}(_0xb9a7,0x112));var _0x7b9a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb9a7[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x7b9a('0x1')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7b9a('0x2')],'set':function(_0x40ef7d){this[_0x7b9a('0x3')](_0x7b9a('0x4'),_0x40ef7d?_0x40ef7d[_0x7b9a('0x5')](''):[]);},'get':function(){return this[_0x7b9a('0x6')](_0x7b9a('0x4'))?this[_0x7b9a('0x6')](_0x7b9a('0x4'))[_0x7b9a('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 505b123..35f3ac7 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 _0x670f=['length','nolimit','sort','where','pick','filter','merge','VIRTUAL','then','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0x670f,0x139));var _0xf670=function(_0x57e0b2,_0x2180fa){_0x57e0b2=_0x57e0b2-0x0;var _0x3c1920=_0x670f[_0x57e0b2];return _0x3c1920;};'use strict';var emlformat=require(_0xf670('0x0'));var rimraf=require(_0xf670('0x1'));var zipdir=require(_0xf670('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf670('0x3'));var moment=require('moment');var BPromise=require(_0xf670('0x4'));var Mustache=require('mustache');var util=require(_0xf670('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xf670('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf670('0x7'));var squel=require(_0xf670('0x8'));var crypto=require(_0xf670('0x9'));var jsforce=require(_0xf670('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf670('0x6'));var querystring=require('querystring');var Papa=require(_0xf670('0xb'));var Redis=require(_0xf670('0xc'));var authService=require(_0xf670('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf670('0xe'));var hardwareService=require(_0xf670('0xf'));var logger=require(_0xf670('0x10'))(_0xf670('0x11'));var utils=require('../../config/utils');var config=require(_0xf670('0x12'));var licenseUtil=require(_0xf670('0x13'));var db=require(_0xf670('0x14'))['db'];function respondWithStatusCode(_0x39e98f,_0x155574){_0x155574=_0x155574||0xcc;return function(_0x19d63b){if(_0x19d63b){return _0x39e98f[_0xf670('0x15')](_0x155574);}return _0x39e98f['status'](_0x155574)[_0xf670('0x16')]();};}function respondWithResult(_0x5db2f2,_0x3c9822){_0x3c9822=_0x3c9822||0xc8;return function(_0x44567f){if(_0x44567f){return _0x5db2f2[_0xf670('0x17')](_0x3c9822)[_0xf670('0x18')](_0x44567f);}};}function respondWithFilteredResult(_0x150ee5,_0x8c9c0a){return function(_0x22df12){if(_0x22df12){var _0x4a54f3=typeof _0x8c9c0a[_0xf670('0x19')]===_0xf670('0x1a')&&typeof _0x8c9c0a[_0xf670('0x1b')]===_0xf670('0x1a');var _0x28f358=_0x22df12[_0xf670('0x1c')];var _0x530aac=_0x4a54f3?0x0:_0x8c9c0a[_0xf670('0x19')];var _0x659775=_0x4a54f3?_0x22df12[_0xf670('0x1c')]:_0x8c9c0a['offset']+_0x8c9c0a[_0xf670('0x1b')];var _0x5a2141;if(_0x659775>=_0x28f358){_0x659775=_0x28f358;_0x5a2141=0xc8;}else{_0x5a2141=0xce;}_0x150ee5[_0xf670('0x17')](_0x5a2141);return _0x150ee5[_0xf670('0x1d')](_0xf670('0x1e'),_0x530aac+'-'+_0x659775+'/'+_0x28f358)[_0xf670('0x18')](_0x22df12);}return null;};}function patchUpdates(_0x4a30fd){return function(_0x21be89){try{jsonpatch[_0xf670('0x1f')](_0x21be89,_0x4a30fd,!![]);}catch(_0x3052f0){return BPromise[_0xf670('0x20')](_0x3052f0);}return _0x21be89[_0xf670('0x21')]();};}function saveUpdates(_0x5a12b4,_0x25e70d){return function(_0x542e4c){if(_0x542e4c){return _0x542e4c[_0xf670('0x22')](_0x5a12b4)['then'](function(_0x51429c){return _0x51429c;});}return null;};}function removeEntity(_0x357f95,_0x594375){return function(_0x3268f1){if(_0x3268f1){return _0x3268f1[_0xf670('0x23')]()['then'](function(){_0x357f95[_0xf670('0x17')](0xcc)[_0xf670('0x16')]();});}};}function handleEntityNotFound(_0x1fdc02,_0x476d10){return function(_0x4beca0){if(!_0x4beca0){_0x1fdc02[_0xf670('0x15')](0x194);}return _0x4beca0;};}function handleError(_0x5a848a,_0x4bd38d){_0x4bd38d=_0x4bd38d||0x1f4;return function(_0x484f1d){logger[_0xf670('0x24')](_0x484f1d[_0xf670('0x25')]);if(_0x484f1d[_0xf670('0x26')]){delete _0x484f1d['name'];}_0x5a848a[_0xf670('0x17')](_0x4bd38d)['send'](_0x484f1d);};}exports[_0xf670('0x27')]=function(_0x3622f4,_0x29b5e8){var _0x203b16={},_0x1a1077={},_0x524946={'count':0x0,'rows':[]};var _0x5158e8=_[_0xf670('0x28')](db[_0xf670('0x29')][_0xf670('0x2a')],function(_0x2b0bdb){return{'name':_0x2b0bdb[_0xf670('0x2b')],'type':_0x2b0bdb[_0xf670('0x2c')][_0xf670('0x2d')]};});_0x1a1077[_0xf670('0x2e')]=_[_0xf670('0x28')](_0x5158e8,_0xf670('0x26'));_0x1a1077[_0xf670('0x2f')]=_['keys'](_0x3622f4['query']);_0x1a1077[_0xf670('0x30')]=_[_0xf670('0x31')](_0x1a1077[_0xf670('0x2e')],_0x1a1077[_0xf670('0x2f')]);_0x203b16[_0xf670('0x32')]=_[_0xf670('0x31')](_0x1a1077[_0xf670('0x2e')],qs[_0xf670('0x33')](_0x3622f4[_0xf670('0x2f')][_0xf670('0x33')]));_0x203b16['attributes']=_0x203b16[_0xf670('0x32')][_0xf670('0x34')]?_0x203b16[_0xf670('0x32')]:_0x1a1077[_0xf670('0x2e')];if(!_0x3622f4[_0xf670('0x2f')]['hasOwnProperty'](_0xf670('0x35'))){_0x203b16[_0xf670('0x1b')]=qs[_0xf670('0x1b')](_0x3622f4[_0xf670('0x2f')]['limit']);_0x203b16['offset']=qs[_0xf670('0x19')](_0x3622f4[_0xf670('0x2f')][_0xf670('0x19')]);}_0x203b16['order']=qs[_0xf670('0x36')](_0x3622f4[_0xf670('0x2f')]['sort']);_0x203b16[_0xf670('0x37')]=qs[_0xf670('0x30')](_[_0xf670('0x38')](_0x3622f4[_0xf670('0x2f')],_0x1a1077[_0xf670('0x30')]),_0x5158e8);if(_0x3622f4[_0xf670('0x2f')][_0xf670('0x39')]){_0x203b16['where']=_[_0xf670('0x3a')](_0x203b16[_0xf670('0x37')],{'$or':_[_0xf670('0x28')](_0x5158e8,function(_0xa30931){if(_0xa30931['type']!==_0xf670('0x3b')){var _0x5eef8b={};_0x5eef8b[_0xa30931[_0xf670('0x26')]]={'$like':'%'+_0x3622f4[_0xf670('0x2f')]['filter']+'%'};return _0x5eef8b;}})});}_0x203b16=_['merge']({},_0x203b16,_0x3622f4['options']);var _0x5e7faf={'where':_0x203b16[_0xf670('0x37')]};return db[_0xf670('0x29')][_0xf670('0x1c')](_0x5e7faf)[_0xf670('0x3c')](function(_0x3b3f24){_0x524946[_0xf670('0x1c')]=_0x3b3f24;if(_0x3622f4[_0xf670('0x2f')]['includeAll']){_0x203b16[_0xf670('0x3d')]=[{'all':!![]}];}return db[_0xf670('0x29')][_0xf670('0x3e')](_0x203b16);})['then'](function(_0x5f2afa){_0x524946[_0xf670('0x3f')]=_0x5f2afa;return _0x524946;})[_0xf670('0x3c')](respondWithFilteredResult(_0x29b5e8,_0x203b16))[_0xf670('0x40')](handleError(_0x29b5e8,null));};exports['show']=function(_0x2cb61c,_0x95a66){var _0x508579={'raw':![],'where':{'id':_0x2cb61c[_0xf670('0x41')]['id']}},_0x5be8ab={};_0x5be8ab['model']=_[_0xf670('0x42')](db['UserProfileSection'][_0xf670('0x2a')]);_0x5be8ab[_0xf670('0x2f')]=_[_0xf670('0x42')](_0x2cb61c['query']);_0x5be8ab[_0xf670('0x30')]=_[_0xf670('0x31')](_0x5be8ab[_0xf670('0x2e')],_0x5be8ab[_0xf670('0x2f')]);_0x508579[_0xf670('0x32')]=_['intersection'](_0x5be8ab['model'],qs[_0xf670('0x33')](_0x2cb61c[_0xf670('0x2f')][_0xf670('0x33')]));_0x508579['attributes']=_0x508579['attributes']['length']?_0x508579[_0xf670('0x32')]:_0x5be8ab[_0xf670('0x2e')];if(_0x2cb61c[_0xf670('0x2f')][_0xf670('0x43')]){_0x508579[_0xf670('0x3d')]=[{'all':!![]}];}_0x508579=_[_0xf670('0x3a')]({},_0x508579,_0x2cb61c[_0xf670('0x44')]);return db[_0xf670('0x29')][_0xf670('0x45')](_0x508579)[_0xf670('0x3c')](handleEntityNotFound(_0x95a66,null))[_0xf670('0x3c')](respondWithResult(_0x95a66,null))[_0xf670('0x40')](handleError(_0x95a66,null));};exports[_0xf670('0x46')]=function(_0x579c9b,_0x1ca278){return db[_0xf670('0x29')]['create'](_0x579c9b[_0xf670('0x47')],{})['then'](respondWithResult(_0x1ca278,0xc9))[_0xf670('0x40')](handleError(_0x1ca278,null));};exports[_0xf670('0x22')]=function(_0x3cb251,_0x308943){if(_0x3cb251[_0xf670('0x47')]['id']){delete _0x3cb251[_0xf670('0x47')]['id'];}return db[_0xf670('0x29')][_0xf670('0x45')]({'where':{'id':_0x3cb251['params']['id']}})[_0xf670('0x3c')](handleEntityNotFound(_0x308943,null))[_0xf670('0x3c')](saveUpdates(_0x3cb251[_0xf670('0x47')],null))[_0xf670('0x3c')](respondWithResult(_0x308943,null))[_0xf670('0x40')](handleError(_0x308943,null));};exports[_0xf670('0x23')]=function(_0x4ae334,_0xbbe86c){return db[_0xf670('0x29')][_0xf670('0x45')]({'where':{'id':_0x4ae334['params']['id']}})[_0xf670('0x3c')](handleEntityNotFound(_0xbbe86c,null))['then'](removeEntity(_0xbbe86c,null))[_0xf670('0x40')](handleError(_0xbbe86c,null));};exports['describe']=function(_0xa935dd,_0x571bea){return db[_0xf670('0x29')][_0xf670('0x48')]()[_0xf670('0x3c')](respondWithResult(_0x571bea,null))['catch'](handleError(_0x571bea,null));}; \ No newline at end of file +var _0x4c46=['map','query','filters','intersection','attributes','order','sort','where','type','filter','merge','includeAll','findAll','rows','catch','show','params','keys','fields','length','include','options','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','key','model'];(function(_0x2f0417,_0xe2d1a2){var _0x233551=function(_0x254213){while(--_0x254213){_0x2f0417['push'](_0x2f0417['shift']());}};_0x233551(++_0xe2d1a2);}(_0x4c46,0x139));var _0x64c4=function(_0x50e9cc,_0x32a875){_0x50e9cc=_0x50e9cc-0x0;var _0x1e1175=_0x4c46[_0x50e9cc];return _0x1e1175;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x64c4('0x0'));var jsonpatch=require(_0x64c4('0x1'));var rp=require(_0x64c4('0x2'));var moment=require(_0x64c4('0x3'));var BPromise=require(_0x64c4('0x4'));var Mustache=require(_0x64c4('0x5'));var util=require('util');var path=require(_0x64c4('0x6'));var sox=require(_0x64c4('0x7'));var csv=require('to-csv');var ejs=require(_0x64c4('0x8'));var fs=require('fs');var fs_extra=require(_0x64c4('0x9'));var _=require(_0x64c4('0xa'));var squel=require('squel');var crypto=require(_0x64c4('0xb'));var jsforce=require(_0x64c4('0xc'));var deskjs=require(_0x64c4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x64c4('0xe'));var Papa=require(_0x64c4('0xf'));var Redis=require(_0x64c4('0x10'));var authService=require(_0x64c4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64c4('0x12'));var logger=require(_0x64c4('0x13'))('api');var utils=require(_0x64c4('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x64c4('0x15'))['db'];function respondWithStatusCode(_0x3235a0,_0x1213ab){_0x1213ab=_0x1213ab||0xcc;return function(_0x332131){if(_0x332131){return _0x3235a0['sendStatus'](_0x1213ab);}return _0x3235a0[_0x64c4('0x16')](_0x1213ab)[_0x64c4('0x17')]();};}function respondWithResult(_0x14aae8,_0x20b793){_0x20b793=_0x20b793||0xc8;return function(_0x39adcb){if(_0x39adcb){return _0x14aae8[_0x64c4('0x16')](_0x20b793)[_0x64c4('0x18')](_0x39adcb);}};}function respondWithFilteredResult(_0x485cdc,_0x428d83){return function(_0x2b13dd){if(_0x2b13dd){var _0x491fa6=typeof _0x428d83[_0x64c4('0x19')]===_0x64c4('0x1a')&&typeof _0x428d83['limit']===_0x64c4('0x1a');var _0x5142c3=_0x2b13dd[_0x64c4('0x1b')];var _0x1f66e0=_0x491fa6?0x0:_0x428d83[_0x64c4('0x19')];var _0x39a4df=_0x491fa6?_0x2b13dd['count']:_0x428d83['offset']+_0x428d83[_0x64c4('0x1c')];var _0x3a16a4;if(_0x39a4df>=_0x5142c3){_0x39a4df=_0x5142c3;_0x3a16a4=0xc8;}else{_0x3a16a4=0xce;}_0x485cdc[_0x64c4('0x16')](_0x3a16a4);return _0x485cdc[_0x64c4('0x1d')](_0x64c4('0x1e'),_0x1f66e0+'-'+_0x39a4df+'/'+_0x5142c3)[_0x64c4('0x18')](_0x2b13dd);}return null;};}function patchUpdates(_0x26abca){return function(_0x5ac95f){try{jsonpatch[_0x64c4('0x1f')](_0x5ac95f,_0x26abca,!![]);}catch(_0x41aab8){return BPromise[_0x64c4('0x20')](_0x41aab8);}return _0x5ac95f['save']();};}function saveUpdates(_0x23b2ce,_0x2a59bc){return function(_0x49acb2){if(_0x49acb2){return _0x49acb2[_0x64c4('0x21')](_0x23b2ce)[_0x64c4('0x22')](function(_0x1f7ed4){return _0x1f7ed4;});}return null;};}function removeEntity(_0x34b5fd,_0x56303a){return function(_0x31c73c){if(_0x31c73c){return _0x31c73c[_0x64c4('0x23')]()[_0x64c4('0x22')](function(){_0x34b5fd['status'](0xcc)[_0x64c4('0x17')]();});}};}function handleEntityNotFound(_0x4587dc,_0x2e6717){return function(_0x26216b){if(!_0x26216b){_0x4587dc[_0x64c4('0x24')](0x194);}return _0x26216b;};}function handleError(_0x4bca01,_0x329a89){_0x329a89=_0x329a89||0x1f4;return function(_0x12e216){logger[_0x64c4('0x25')](_0x12e216[_0x64c4('0x26')]);if(_0x12e216[_0x64c4('0x27')]){delete _0x12e216[_0x64c4('0x27')];}_0x4bca01[_0x64c4('0x16')](_0x329a89)[_0x64c4('0x28')](_0x12e216);};}exports[_0x64c4('0x29')]=function(_0x5ae613,_0xd98640){var _0x34ccad={},_0x59314e={},_0x52bb50={'count':0x0,'rows':[]};var _0x7db89b=_['map'](db[_0x64c4('0x2a')][_0x64c4('0x2b')],function(_0x707a4a){return{'name':_0x707a4a[_0x64c4('0x2c')],'type':_0x707a4a['type'][_0x64c4('0x2d')]};});_0x59314e[_0x64c4('0x2e')]=_[_0x64c4('0x2f')](_0x7db89b,_0x64c4('0x27'));_0x59314e[_0x64c4('0x30')]=_['keys'](_0x5ae613[_0x64c4('0x30')]);_0x59314e[_0x64c4('0x31')]=_[_0x64c4('0x32')](_0x59314e[_0x64c4('0x2e')],_0x59314e[_0x64c4('0x30')]);_0x34ccad[_0x64c4('0x33')]=_[_0x64c4('0x32')](_0x59314e['model'],qs['fields'](_0x5ae613[_0x64c4('0x30')]['fields']));_0x34ccad[_0x64c4('0x33')]=_0x34ccad[_0x64c4('0x33')]['length']?_0x34ccad[_0x64c4('0x33')]:_0x59314e[_0x64c4('0x2e')];if(!_0x5ae613['query']['hasOwnProperty']('nolimit')){_0x34ccad['limit']=qs[_0x64c4('0x1c')](_0x5ae613[_0x64c4('0x30')][_0x64c4('0x1c')]);_0x34ccad[_0x64c4('0x19')]=qs[_0x64c4('0x19')](_0x5ae613[_0x64c4('0x30')]['offset']);}_0x34ccad[_0x64c4('0x34')]=qs[_0x64c4('0x35')](_0x5ae613[_0x64c4('0x30')]['sort']);_0x34ccad[_0x64c4('0x36')]=qs[_0x64c4('0x31')](_['pick'](_0x5ae613[_0x64c4('0x30')],_0x59314e[_0x64c4('0x31')]),_0x7db89b);if(_0x5ae613[_0x64c4('0x30')]['filter']){_0x34ccad[_0x64c4('0x36')]=_['merge'](_0x34ccad[_0x64c4('0x36')],{'$or':_[_0x64c4('0x2f')](_0x7db89b,function(_0x5ab5b0){if(_0x5ab5b0[_0x64c4('0x37')]!=='VIRTUAL'){var _0x52880b={};_0x52880b[_0x5ab5b0[_0x64c4('0x27')]]={'$like':'%'+_0x5ae613[_0x64c4('0x30')][_0x64c4('0x38')]+'%'};return _0x52880b;}})});}_0x34ccad=_[_0x64c4('0x39')]({},_0x34ccad,_0x5ae613['options']);var _0x2b8afb={'where':_0x34ccad['where']};return db['UserProfileSection'][_0x64c4('0x1b')](_0x2b8afb)[_0x64c4('0x22')](function(_0x628b8b){_0x52bb50[_0x64c4('0x1b')]=_0x628b8b;if(_0x5ae613[_0x64c4('0x30')][_0x64c4('0x3a')]){_0x34ccad['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x64c4('0x3b')](_0x34ccad);})[_0x64c4('0x22')](function(_0x98b986){_0x52bb50[_0x64c4('0x3c')]=_0x98b986;return _0x52bb50;})[_0x64c4('0x22')](respondWithFilteredResult(_0xd98640,_0x34ccad))[_0x64c4('0x3d')](handleError(_0xd98640,null));};exports[_0x64c4('0x3e')]=function(_0x33334c,_0x37f698){var _0x319556={'raw':![],'where':{'id':_0x33334c[_0x64c4('0x3f')]['id']}},_0x18831a={};_0x18831a[_0x64c4('0x2e')]=_[_0x64c4('0x40')](db[_0x64c4('0x2a')][_0x64c4('0x2b')]);_0x18831a[_0x64c4('0x30')]=_[_0x64c4('0x40')](_0x33334c['query']);_0x18831a[_0x64c4('0x31')]=_['intersection'](_0x18831a[_0x64c4('0x2e')],_0x18831a[_0x64c4('0x30')]);_0x319556[_0x64c4('0x33')]=_[_0x64c4('0x32')](_0x18831a[_0x64c4('0x2e')],qs[_0x64c4('0x41')](_0x33334c[_0x64c4('0x30')][_0x64c4('0x41')]));_0x319556[_0x64c4('0x33')]=_0x319556[_0x64c4('0x33')][_0x64c4('0x42')]?_0x319556[_0x64c4('0x33')]:_0x18831a[_0x64c4('0x2e')];if(_0x33334c[_0x64c4('0x30')][_0x64c4('0x3a')]){_0x319556[_0x64c4('0x43')]=[{'all':!![]}];}_0x319556=_[_0x64c4('0x39')]({},_0x319556,_0x33334c[_0x64c4('0x44')]);return db['UserProfileSection']['find'](_0x319556)[_0x64c4('0x22')](handleEntityNotFound(_0x37f698,null))[_0x64c4('0x22')](respondWithResult(_0x37f698,null))[_0x64c4('0x3d')](handleError(_0x37f698,null));};exports[_0x64c4('0x45')]=function(_0x4509fb,_0x5a1270){return db[_0x64c4('0x2a')][_0x64c4('0x45')](_0x4509fb[_0x64c4('0x46')],{})[_0x64c4('0x22')](respondWithResult(_0x5a1270,0xc9))[_0x64c4('0x3d')](handleError(_0x5a1270,null));};exports[_0x64c4('0x21')]=function(_0x2b15fb,_0x1ffcaf){if(_0x2b15fb[_0x64c4('0x46')]['id']){delete _0x2b15fb[_0x64c4('0x46')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x2b15fb['params']['id']}})[_0x64c4('0x22')](handleEntityNotFound(_0x1ffcaf,null))[_0x64c4('0x22')](saveUpdates(_0x2b15fb[_0x64c4('0x46')],null))[_0x64c4('0x22')](respondWithResult(_0x1ffcaf,null))[_0x64c4('0x3d')](handleError(_0x1ffcaf,null));};exports['destroy']=function(_0x59cbe9,_0x41f7f3){return db[_0x64c4('0x2a')]['find']({'where':{'id':_0x59cbe9[_0x64c4('0x3f')]['id']}})[_0x64c4('0x22')](handleEntityNotFound(_0x41f7f3,null))[_0x64c4('0x22')](removeEntity(_0x41f7f3,null))['catch'](handleError(_0x41f7f3,null));};exports[_0x64c4('0x47')]=function(_0x667edb,_0x1bdfed){return db[_0x64c4('0x2a')]['describe']()[_0x64c4('0x22')](respondWithResult(_0x1bdfed,null))[_0x64c4('0x3d')](handleError(_0x1bdfed,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2964dee..6abe58e 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 _0xcde7=['UserProfileSection','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2f1343,_0x59bd6a){var _0x2d8268=function(_0x2844e9){while(--_0x2844e9){_0x2f1343['push'](_0x2f1343['shift']());}};_0x2d8268(++_0x59bd6a);}(_0xcde7,0x129));var _0x7cde=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcde7[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7cde('0x0'));var util=require(_0x7cde('0x1'));var logger=require(_0x7cde('0x2'))(_0x7cde('0x3'));var moment=require(_0x7cde('0x4'));var BPromise=require(_0x7cde('0x5'));var rp=require(_0x7cde('0x6'));var fs=require('fs');var path=require(_0x7cde('0x7'));var rimraf=require(_0x7cde('0x8'));var config=require(_0x7cde('0x9'));var attributes=require('./userProfileSection.attributes');module[_0x7cde('0xa')]=function(_0x2730e2,_0x410b00){return _0x2730e2['define'](_0x7cde('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x7cde('0xc'),_0x7cde('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9ef=['user_profile_has_sections','sectionId','userProfileId','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0xe9ef,0x16e));var _0xfe9e=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0xe9ef[_0xd1c39b];return _0x58f5bc;};'use strict';var _=require(_0xfe9e('0x0'));var util=require('util');var logger=require(_0xfe9e('0x1'))(_0xfe9e('0x2'));var moment=require('moment');var BPromise=require(_0xfe9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe9e('0x4'));var rimraf=require(_0xfe9e('0x5'));var config=require(_0xfe9e('0x6'));var attributes=require(_0xfe9e('0x7'));module['exports']=function(_0x448c5b,_0x929d6d){return _0x448c5b['define']('UserProfileSection',attributes,{'tableName':_0xfe9e('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xfe9e('0x9'),_0xfe9e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 712e9f9..abb6f0f 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 _0xeb27=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','ioredis'];(function(_0x38c02c,_0x29b291){var _0xbe2f5a=function(_0x4d5082){while(--_0x4d5082){_0x38c02c['push'](_0x38c02c['shift']());}};_0xbe2f5a(++_0x29b291);}(_0xeb27,0xe1));var _0x7eb2=function(_0x2fdf0c,_0x299ef2){_0x2fdf0c=_0x2fdf0c-0x0;var _0xbb3de5=_0xeb27[_0x2fdf0c];return _0xbb3de5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7eb2('0x0'));var BPromise=require(_0x7eb2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7eb2('0x2'));var db=require(_0x7eb2('0x3'))['db'];var utils=require(_0x7eb2('0x4'));var logger=require('../../config/logger')(_0x7eb2('0x5'));var config=require(_0x7eb2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7eb2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x231d63,_0x56c723,_0xda27e2){return new BPromise(function(_0x13d836,_0x2533b4){return client['request'](_0x231d63,_0xda27e2)[_0x7eb2('0x8')](function(_0xa38fba){logger[_0x7eb2('0x9')](_0x7eb2('0xa'),_0x56c723,_0x7eb2('0xb'));logger[_0x7eb2('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x56c723,_0x7eb2('0xb'),JSON[_0x7eb2('0xd')](_0xa38fba));if(_0xa38fba['error']){if(_0xa38fba[_0x7eb2('0xe')][_0x7eb2('0xf')]===0x1f4){logger[_0x7eb2('0xe')](_0x7eb2('0xa'),_0x56c723,_0xa38fba[_0x7eb2('0xe')][_0x7eb2('0x10')]);return _0x2533b4(_0xa38fba[_0x7eb2('0xe')][_0x7eb2('0x10')]);}logger['error'](_0x7eb2('0xa'),_0x56c723,_0xa38fba[_0x7eb2('0xe')][_0x7eb2('0x10')]);return _0x13d836(_0xa38fba[_0x7eb2('0xe')][_0x7eb2('0x10')]);}else{logger[_0x7eb2('0x9')]('UserProfileSection,\x20%s,\x20%s',_0x56c723,_0x7eb2('0xb'));_0x13d836(_0xa38fba[_0x7eb2('0x11')][_0x7eb2('0x10')]);}})[_0x7eb2('0x12')](function(_0x4e08c5){logger[_0x7eb2('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x56c723,_0x4e08c5);_0x2533b4(_0x4e08c5);});});} \ No newline at end of file +var _0x2b5f=['../../config/environment','jayson/promise','client','http','request','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1580e6,_0x3a4705){var _0x21dd50=function(_0x29d839){while(--_0x29d839){_0x1580e6['push'](_0x1580e6['shift']());}};_0x21dd50(++_0x3a4705);}(_0x2b5f,0xe7));var _0xf2b5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2b5f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf2b5('0x0'));var util=require(_0xf2b5('0x1'));var moment=require('moment');var BPromise=require(_0xf2b5('0x2'));var rs=require(_0xf2b5('0x3'));var fs=require('fs');var Redis=require(_0xf2b5('0x4'));var db=require(_0xf2b5('0x5'))['db'];var utils=require(_0xf2b5('0x6'));var logger=require(_0xf2b5('0x7'))(_0xf2b5('0x8'));var config=require(_0xf2b5('0x9'));var jayson=require(_0xf2b5('0xa'));var client=jayson[_0xf2b5('0xb')][_0xf2b5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x533c1c,_0x4149c9,_0x4d6a58){return new BPromise(function(_0x4271de,_0x5ae349){return client[_0xf2b5('0xd')](_0x533c1c,_0x4d6a58)['then'](function(_0x3b0a88){logger[_0xf2b5('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x4149c9,'request\x20sent');logger[_0xf2b5('0xf')](_0xf2b5('0x10'),_0x4149c9,_0xf2b5('0x11'),JSON['stringify'](_0x3b0a88));if(_0x3b0a88[_0xf2b5('0x12')]){if(_0x3b0a88[_0xf2b5('0x12')][_0xf2b5('0x13')]===0x1f4){logger[_0xf2b5('0x12')](_0xf2b5('0x14'),_0x4149c9,_0x3b0a88[_0xf2b5('0x12')][_0xf2b5('0x15')]);return _0x5ae349(_0x3b0a88[_0xf2b5('0x12')][_0xf2b5('0x15')]);}logger[_0xf2b5('0x12')](_0xf2b5('0x14'),_0x4149c9,_0x3b0a88['error'][_0xf2b5('0x15')]);return _0x4271de(_0x3b0a88[_0xf2b5('0x12')][_0xf2b5('0x15')]);}else{logger[_0xf2b5('0xe')](_0xf2b5('0x14'),_0x4149c9,_0xf2b5('0x11'));_0x4271de(_0x3b0a88[_0xf2b5('0x16')]['message']);}})[_0xf2b5('0x17')](function(_0xe2cf02){logger[_0xf2b5('0x12')](_0xf2b5('0x14'),_0x4149c9,_0xe2cf02);_0x5ae349(_0xe2cf02);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index af33f75..4dfb9ba 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5eab8c,_0x250dc7){var _0x2ff4f1=function(_0x57acb0){while(--_0x57acb0){_0x5eab8c['push'](_0x5eab8c['shift']());}};_0x2ff4f1(++_0x250dc7);}(_0xedd9,0xfc));var _0x9edd=function(_0x182273,_0x1c88ff){_0x182273=_0x182273-0x0;var _0x3cf552=_0xedd9[_0x182273];return _0x3cf552;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x22440d,_0x48aa1c){var _0x228672=function(_0x11ecda){while(--_0x11ecda){_0x22440d['push'](_0x22440d['shift']());}};_0x228672(++_0x48aa1c);}(_0xe706,0xa3));var _0x6e70=function(_0x358bf3,_0x40ec1f){_0x358bf3=_0x358bf3-0x0;var _0x248106=_0xe706[_0x358bf3];return _0x248106;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 53870d8..b78001e 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 _0xee35=['exports','INTEGER'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xee35,0x1ba));var _0x5ee3=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0xee35[_0xbc4560];return _0x298cfb;};'use strict';var Sequelize=require('sequelize');module[_0x5ee3('0x0')]={'penalty':{'type':Sequelize[_0x5ee3('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf465=['exports','INTEGER','sequelize'];(function(_0x54fb05,_0x5437a0){var _0xf23796=function(_0x329fb5){while(--_0x329fb5){_0x54fb05['push'](_0x54fb05['shift']());}};_0xf23796(++_0x5437a0);}(_0xf465,0x8f));var _0x5f46=function(_0x364220,_0x34ce6a){_0x364220=_0x364220-0x0;var _0x4a6928=_0xf465[_0x364220];return _0x4a6928;};'use strict';var Sequelize=require(_0x5f46('0x0'));module[_0x5f46('0x1')]={'penalty':{'type':Sequelize[_0x5f46('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 7dd5169..e5d28e9 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 _0x964b=['util','api','moment','bluebird','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0x964b,0x112));var _0xb964=function(_0x142830,_0x53a163){_0x142830=_0x142830-0x0;var _0x196c3c=_0x964b[_0x142830];return _0x196c3c;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var logger=require('../../config/logger')(_0xb964('0x2'));var moment=require(_0xb964('0x3'));var BPromise=require(_0xb964('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb964('0x5'));var config=require('../../config/environment');var attributes=require(_0xb964('0x6'));module[_0xb964('0x7')]=function(_0xba9f19,_0x11a0c1){return _0xba9f19[_0xb964('0x8')](_0xb964('0x9'),attributes,{'tableName':_0xb964('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf072=['path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','moment','request-promise'];(function(_0x2780d0,_0x5b94aa){var _0x81799d=function(_0x23b12f){while(--_0x23b12f){_0x2780d0['push'](_0x2780d0['shift']());}};_0x81799d(++_0x5b94aa);}(_0xf072,0x1cf));var _0x2f07=function(_0x375712,_0x5f0d34){_0x375712=_0x375712-0x0;var _0x13ab42=_0xf072[_0x375712];return _0x13ab42;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var logger=require(_0x2f07('0x2'))('api');var moment=require(_0x2f07('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f07('0x4'));var fs=require('fs');var path=require(_0x2f07('0x5'));var rimraf=require(_0x2f07('0x6'));var config=require('../../config/environment');var attributes=require(_0x2f07('0x7'));module[_0x2f07('0x8')]=function(_0x3643bb,_0x2e6422){return _0x3643bb[_0x2f07('0x9')](_0x2f07('0xa'),attributes,{'tableName':_0x2f07('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 09a5c3f..80123d1 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 _0x8cc6=['request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x481844,_0x259b1f){var _0x2afc17=function(_0x3404d4){while(--_0x3404d4){_0x481844['push'](_0x481844['shift']());}};_0x2afc17(++_0x259b1f);}(_0x8cc6,0x84));var _0x68cc=function(_0x5e1fbe,_0x429e33){_0x5e1fbe=_0x5e1fbe-0x0;var _0x51465b=_0x8cc6[_0x5e1fbe];return _0x51465b;};'use strict';var _=require(_0x68cc('0x0'));var util=require(_0x68cc('0x1'));var moment=require(_0x68cc('0x2'));var BPromise=require('bluebird');var rs=require(_0x68cc('0x3'));var fs=require('fs');var Redis=require(_0x68cc('0x4'));var db=require(_0x68cc('0x5'))['db'];var utils=require(_0x68cc('0x6'));var logger=require(_0x68cc('0x7'))(_0x68cc('0x8'));var config=require(_0x68cc('0x9'));var jayson=require(_0x68cc('0xa'));var client=jayson[_0x68cc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32b246,_0x2accaf,_0x4a6e21){return new BPromise(function(_0x5237b0,_0x5a0a60){return client[_0x68cc('0xc')](_0x32b246,_0x4a6e21)[_0x68cc('0xd')](function(_0x19316a){logger['info'](_0x68cc('0xe'),_0x2accaf,_0x68cc('0xf'));logger[_0x68cc('0x10')](_0x68cc('0x11'),_0x2accaf,'request\x20sent',JSON[_0x68cc('0x12')](_0x19316a));if(_0x19316a[_0x68cc('0x13')]){if(_0x19316a[_0x68cc('0x13')][_0x68cc('0x14')]===0x1f4){logger[_0x68cc('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2accaf,_0x19316a[_0x68cc('0x13')][_0x68cc('0x15')]);return _0x5a0a60(_0x19316a['error']['message']);}logger[_0x68cc('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2accaf,_0x19316a[_0x68cc('0x13')][_0x68cc('0x15')]);return _0x5237b0(_0x19316a[_0x68cc('0x13')]['message']);}else{logger['info'](_0x68cc('0xe'),_0x2accaf,_0x68cc('0xf'));_0x5237b0(_0x19316a[_0x68cc('0x16')][_0x68cc('0x15')]);}})[_0x68cc('0x17')](function(_0x4e476f){logger[_0x68cc('0x13')](_0x68cc('0xe'),_0x2accaf,_0x4e476f);_0x5a0a60(_0x4e476f);});});} \ No newline at end of file +var _0xd0a2=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x1a3a4c,_0x50e07b){var _0x8054c0=function(_0x504e18){while(--_0x504e18){_0x1a3a4c['push'](_0x1a3a4c['shift']());}};_0x8054c0(++_0x50e07b);}(_0xd0a2,0x10d));var _0x2d0a=function(_0x3df935,_0x2f6877){_0x3df935=_0x3df935-0x0;var _0x152412=_0xd0a2[_0x3df935];return _0x152412;};'use strict';var _=require(_0x2d0a('0x0'));var util=require('util');var moment=require(_0x2d0a('0x1'));var BPromise=require(_0x2d0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d0a('0x3'));var db=require(_0x2d0a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2d0a('0x5'));var jayson=require(_0x2d0a('0x6'));var client=jayson[_0x2d0a('0x7')][_0x2d0a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e0a28,_0xa8f44,_0x426a01){return new BPromise(function(_0x178c87,_0x1cccdc){return client['request'](_0x2e0a28,_0x426a01)[_0x2d0a('0x9')](function(_0x967cc1){logger[_0x2d0a('0xa')](_0x2d0a('0xb'),_0xa8f44,_0x2d0a('0xc'));logger[_0x2d0a('0xd')](_0x2d0a('0xe'),_0xa8f44,_0x2d0a('0xc'),JSON[_0x2d0a('0xf')](_0x967cc1));if(_0x967cc1[_0x2d0a('0x10')]){if(_0x967cc1[_0x2d0a('0x10')][_0x2d0a('0x11')]===0x1f4){logger[_0x2d0a('0x10')](_0x2d0a('0xb'),_0xa8f44,_0x967cc1['error'][_0x2d0a('0x12')]);return _0x1cccdc(_0x967cc1[_0x2d0a('0x10')][_0x2d0a('0x12')]);}logger[_0x2d0a('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0xa8f44,_0x967cc1[_0x2d0a('0x10')][_0x2d0a('0x12')]);return _0x178c87(_0x967cc1['error']['message']);}else{logger[_0x2d0a('0xa')](_0x2d0a('0xb'),_0xa8f44,_0x2d0a('0xc'));_0x178c87(_0x967cc1['result'][_0x2d0a('0x12')]);}})[_0x2d0a('0x13')](function(_0xae81aa){logger[_0x2d0a('0x10')](_0x2d0a('0xb'),_0xa8f44,_0xae81aa);_0x1cccdc(_0xae81aa);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 513c061..5b93a1c 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 _0xd7f7=['exports','sequelize'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xd7f7,0x1b1));var _0x7d7f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd7f7[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x7d7f('0x0'));module[_0x7d7f('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe974=['exports','INTEGER','sequelize'];(function(_0x18fde9,_0x12c174){var _0x3e30a4=function(_0x5db863){while(--_0x5db863){_0x18fde9['push'](_0x18fde9['shift']());}};_0x3e30a4(++_0x12c174);}(_0xe974,0x86));var _0x4e97=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0xe974[_0x1c3370];return _0xa9b358;};'use strict';var Sequelize=require(_0x4e97('0x0'));module[_0x4e97('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x4e97('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 65237df..4a6cf37 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(_0x2b47ed,_0x5beea8){var _0x30df64=function(_0x507e68){while(--_0x507e68){_0x2b47ed['push'](_0x2b47ed['shift']());}};_0x30df64(++_0x5beea8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x23d5be,_0x20f8a6){var _0xa7959d=function(_0x2107a1){while(--_0x2107a1){_0x23d5be['push'](_0x23d5be['shift']());}};_0xa7959d(++_0x20f8a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 52e55b8..fa10a55 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x291c9b,_0x52cdf2){var _0x5c392b=function(_0x930d5b){while(--_0x930d5b){_0x291c9b['push'](_0x291c9b['shift']());}};_0x5c392b(++_0x52cdf2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2c1841,_0x505204){var _0x28d148=function(_0x5be79f){while(--_0x5be79f){_0x2c1841['push'](_0x2c1841['shift']());}};_0x28d148(++_0x505204);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 06123ba..7318ea8 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 _0xc63a=['sequelize','exports'];(function(_0x5d6476,_0x56c199){var _0xd3f6bc=function(_0x157293){while(--_0x157293){_0x5d6476['push'](_0x5d6476['shift']());}};_0xd3f6bc(++_0x56c199);}(_0xc63a,0x130));var _0xac63=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xc63a[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0xac63('0x0'));module[_0xac63('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x79fc=['sequelize','exports','INTEGER'];(function(_0x4bb691,_0x37679a){var _0x588b53=function(_0x2c802d){while(--_0x2c802d){_0x4bb691['push'](_0x4bb691['shift']());}};_0x588b53(++_0x37679a);}(_0x79fc,0x1ad));var _0xc79f=function(_0x33a1c1,_0x28b6b3){_0x33a1c1=_0x33a1c1-0x0;var _0x34fbc6=_0x79fc[_0x33a1c1];return _0x34fbc6;};'use strict';var Sequelize=require(_0xc79f('0x0'));module[_0xc79f('0x1')]={'penalty':{'type':Sequelize[_0xc79f('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 a722a22..3b2a400 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 _0x4a43=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','../../config/logger','api','request-promise','path'];(function(_0x4f5661,_0x348c7a){var _0x2dd40e=function(_0x166c69){while(--_0x166c69){_0x4f5661['push'](_0x4f5661['shift']());}};_0x2dd40e(++_0x348c7a);}(_0x4a43,0xce));var _0x34a4=function(_0x54f5f9,_0x129efc){_0x54f5f9=_0x54f5f9-0x0;var _0x4a1f68=_0x4a43[_0x54f5f9];return _0x4a1f68;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x34a4('0x0'))(_0x34a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x34a4('0x2'));var fs=require('fs');var path=require(_0x34a4('0x3'));var rimraf=require(_0x34a4('0x4'));var config=require(_0x34a4('0x5'));var attributes=require(_0x34a4('0x6'));module[_0x34a4('0x7')]=function(_0x507ce0,_0x2f4fc7){return _0x507ce0[_0x34a4('0x8')](_0x34a4('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e91=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','api'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x4e91,0x17e));var _0x14e9=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x4e91[_0x5e4563];return _0x8d1bf5;};'use strict';var _=require(_0x14e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x14e9('0x1'));var moment=require(_0x14e9('0x2'));var BPromise=require(_0x14e9('0x3'));var rp=require(_0x14e9('0x4'));var fs=require('fs');var path=require(_0x14e9('0x5'));var rimraf=require(_0x14e9('0x6'));var config=require(_0x14e9('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0x14e9('0x8')]=function(_0x13acec,_0x264d3e){return _0x13acec[_0x14e9('0x9')](_0x14e9('0xa'),attributes,{'tableName':_0x14e9('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 18852e2..7d159ce 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 _0xf48c=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x55c00d,_0x520cb6){var _0x254a8f=function(_0x2b3378){while(--_0x2b3378){_0x55c00d['push'](_0x55c00d['shift']());}};_0x254a8f(++_0x520cb6);}(_0xf48c,0x1d0));var _0xcf48=function(_0x12c1e8,_0x1ffda9){_0x12c1e8=_0x12c1e8-0x0;var _0x284326=_0xf48c[_0x12c1e8];return _0x284326;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcf48('0x0'));var BPromise=require(_0xcf48('0x1'));var rs=require(_0xcf48('0x2'));var fs=require('fs');var Redis=require(_0xcf48('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf48('0x4'));var logger=require('../../config/logger')(_0xcf48('0x5'));var config=require(_0xcf48('0x6'));var jayson=require(_0xcf48('0x7'));var client=jayson['client'][_0xcf48('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x313471,_0x410705,_0x55213d){return new BPromise(function(_0xb0b9a3,_0x506be3){return client[_0xcf48('0x9')](_0x313471,_0x55213d)[_0xcf48('0xa')](function(_0x172890){logger[_0xcf48('0xb')](_0xcf48('0xc'),_0x410705,_0xcf48('0xd'));logger['debug'](_0xcf48('0xe'),_0x410705,_0xcf48('0xd'),JSON[_0xcf48('0xf')](_0x172890));if(_0x172890[_0xcf48('0x10')]){if(_0x172890[_0xcf48('0x10')]['code']===0x1f4){logger['error'](_0xcf48('0xc'),_0x410705,_0x172890[_0xcf48('0x10')]['message']);return _0x506be3(_0x172890[_0xcf48('0x10')]['message']);}logger[_0xcf48('0x10')](_0xcf48('0xc'),_0x410705,_0x172890['error'][_0xcf48('0x11')]);return _0xb0b9a3(_0x172890['error'][_0xcf48('0x11')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x410705,_0xcf48('0xd'));_0xb0b9a3(_0x172890[_0xcf48('0x12')][_0xcf48('0x11')]);}})['catch'](function(_0x495a2b){logger[_0xcf48('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x410705,_0x495a2b);_0x506be3(_0x495a2b);});});} \ No newline at end of file +var _0x9701=['../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x1de138,_0x3145f5){var _0x1f69c5=function(_0x3c3a13){while(--_0x3c3a13){_0x1de138['push'](_0x1de138['shift']());}};_0x1f69c5(++_0x3145f5);}(_0x9701,0x19a));var _0x1970=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9701[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x1970('0x0'));var util=require(_0x1970('0x1'));var moment=require(_0x1970('0x2'));var BPromise=require(_0x1970('0x3'));var rs=require(_0x1970('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1970('0x5'))['db'];var utils=require(_0x1970('0x6'));var logger=require('../../config/logger')(_0x1970('0x7'));var config=require(_0x1970('0x8'));var jayson=require(_0x1970('0x9'));var client=jayson[_0x1970('0xa')][_0x1970('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53d8ab,_0x2e4be8,_0x234dcb){return new BPromise(function(_0x3c9cf3,_0x1b003a){return client[_0x1970('0xc')](_0x53d8ab,_0x234dcb)[_0x1970('0xd')](function(_0x88e901){logger[_0x1970('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x2e4be8,'request\x20sent');logger[_0x1970('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2e4be8,_0x1970('0x10'),JSON['stringify'](_0x88e901));if(_0x88e901[_0x1970('0x11')]){if(_0x88e901[_0x1970('0x11')]['code']===0x1f4){logger[_0x1970('0x11')](_0x1970('0x12'),_0x2e4be8,_0x88e901['error'][_0x1970('0x13')]);return _0x1b003a(_0x88e901[_0x1970('0x11')][_0x1970('0x13')]);}logger['error'](_0x1970('0x12'),_0x2e4be8,_0x88e901[_0x1970('0x11')][_0x1970('0x13')]);return _0x3c9cf3(_0x88e901[_0x1970('0x11')][_0x1970('0x13')]);}else{logger[_0x1970('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x2e4be8,_0x1970('0x10'));_0x3c9cf3(_0x88e901[_0x1970('0x14')][_0x1970('0x13')]);}})[_0x1970('0x15')](function(_0x4290ec){logger[_0x1970('0x11')](_0x1970('0x12'),_0x2e4be8,_0x4290ec);_0x1b003a(_0x4290ec);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index ea5a3bd..f9e9b09 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xb12603,_0x142505){var _0x2bdc24=function(_0x5dca90){while(--_0x5dca90){_0xb12603['push'](_0xb12603['shift']());}};_0x2bdc24(++_0x142505);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5e6b40,_0x24d85a){var _0x4b1640=function(_0x2bc553){while(--_0x2bc553){_0x5e6b40['push'](_0x5e6b40['shift']());}};_0x4b1640(++_0x24d85a);}(_0x70e0,0x17b));var _0x070e=function(_0x53aa20,_0x2aaf6a){_0x53aa20=_0x53aa20-0x0;var _0x5c83d5=_0x70e0[_0x53aa20];return _0x5c83d5;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5b04dc3..409d7b6 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 _0xdba6=['sequelize','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0xdba6,0xe6));var _0x6dba=function(_0x2cf6fe,_0x2dbeac){_0x2cf6fe=_0x2cf6fe-0x0;var _0x34e1f9=_0xdba6[_0x2cf6fe];return _0x34e1f9;};'use strict';var Sequelize=require(_0x6dba('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6dba('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6dba('0x2')},'membername':{'type':Sequelize[_0x6dba('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x6dba('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6dba('0x3')],'allowNull':![],'unique':_0x6dba('0x4'),'comment':_0x6dba('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x6dba('0x3')],'allowNull':![],'unique':_0x6dba('0x4'),'comment':_0x6dba('0x2')},'penalty':{'type':Sequelize[_0x6dba('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x6dba('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x2aaa=['STRING','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x324f55,_0x2e6ca4){var _0x284952=function(_0x36ceae){while(--_0x36ceae){_0x324f55['push'](_0x324f55['shift']());}};_0x284952(++_0x2e6ca4);}(_0x2aaa,0x185));var _0xa2aa=function(_0x4f6203,_0x11eccd){_0x4f6203=_0x4f6203-0x0;var _0xde4e17=_0x2aaa[_0x4f6203];return _0xde4e17;};'use strict';var Sequelize=require('sequelize');module[_0xa2aa('0x0')]={'uniqueid':{'type':Sequelize[_0xa2aa('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa2aa('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xa2aa('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa2aa('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xa2aa('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xa2aa('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xa2aa('0x1')](0xb),'defaultValue':0x0,'comment':_0xa2aa('0x2')},'paused':{'type':Sequelize[_0xa2aa('0x1')](0xb),'defaultValue':0x0,'comment':_0xa2aa('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 3e889e8..03f26bb 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 _0xe2a2=['emit','hasOwnProperty','hook','UserVoiceQueueRt','save','update'];(function(_0x3ecf9c,_0x27d793){var _0x2ce38f=function(_0x3afba1){while(--_0x3afba1){_0x3ecf9c['push'](_0x3ecf9c['shift']());}};_0x2ce38f(++_0x27d793);}(_0xe2a2,0x1b9));var _0x2e2a=function(_0x1f743c,_0x352877){_0x1f743c=_0x1f743c-0x0;var _0x34c6a0=_0xe2a2[_0x1f743c];return _0x34c6a0;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x2e2a('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2e2a('0x1'),'afterUpdate':_0x2e2a('0x2'),'afterDestroy':'remove'};function emitEvent(_0xb07930){return function(_0x4fd6e5,_0x2b5849,_0x2454a8){UserVoiceQueueRtEvents['emit'](_0xb07930+':'+_0x4fd6e5['id'],_0x4fd6e5);UserVoiceQueueRtEvents[_0x2e2a('0x3')](_0xb07930,_0x4fd6e5);_0x2454a8(null);};}for(var e in events){if(events[_0x2e2a('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x2e2a('0x5')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd9f9=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x1b6d05,_0x54e014){var _0x441ec2=function(_0x3178a1){while(--_0x3178a1){_0x1b6d05['push'](_0x1b6d05['shift']());}};_0x441ec2(++_0x54e014);}(_0xd9f9,0x10f));var _0x9d9f=function(_0x58d3e4,_0x592460){_0x58d3e4=_0x58d3e4-0x0;var _0x4e68dc=_0xd9f9[_0x58d3e4];return _0x4e68dc;};'use strict';var EventEmitter=require(_0x9d9f('0x0'));var UserVoiceQueueRt=require(_0x9d9f('0x1'))['db'][_0x9d9f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9d9f('0x3')](0x0);var events={'afterCreate':_0x9d9f('0x4'),'afterUpdate':_0x9d9f('0x5'),'afterDestroy':_0x9d9f('0x6')};function emitEvent(_0x41d1fd){return function(_0x2404e9,_0x69cc42,_0x1c4946){UserVoiceQueueRtEvents[_0x9d9f('0x7')](_0x41d1fd+':'+_0x2404e9['id'],_0x2404e9);UserVoiceQueueRtEvents[_0x9d9f('0x7')](_0x41d1fd,_0x2404e9);_0x1c4946(null);};}for(var e in events){if(events[_0x9d9f('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x9d9f('0x9')](e,emitEvent(event));}}module[_0x9d9f('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index d6e3c54..20045d1 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 _0xbd89=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','api','moment','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x3f578f,_0x51f172){var _0x32c754=function(_0x1bd873){while(--_0x1bd873){_0x3f578f['push'](_0x3f578f['shift']());}};_0x32c754(++_0x51f172);}(_0xbd89,0x1c6));var _0x9bd8=function(_0x32d9fb,_0x46af04){_0x32d9fb=_0x32d9fb-0x0;var _0x3b3c0d=_0xbd89[_0x32d9fb];return _0x3b3c0d;};'use strict';var _=require(_0x9bd8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9bd8('0x1'));var moment=require(_0x9bd8('0x2'));var BPromise=require('bluebird');var rp=require(_0x9bd8('0x3'));var fs=require('fs');var path=require(_0x9bd8('0x4'));var rimraf=require('rimraf');var config=require(_0x9bd8('0x5'));var attributes=require(_0x9bd8('0x6'));module[_0x9bd8('0x7')]=function(_0x3ca330,_0x7cc44c){return _0x3ca330[_0x9bd8('0x8')](_0x9bd8('0x9'),attributes,{'tableName':_0x9bd8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc703=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x43f748,_0x2afb5f){var _0x2b6349=function(_0x26c642){while(--_0x26c642){_0x43f748['push'](_0x43f748['shift']());}};_0x2b6349(++_0x2afb5f);}(_0xc703,0x1ce));var _0x3c70=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0xc703[_0x5a5395];return _0x4da43d;};'use strict';var _=require(_0x3c70('0x0'));var util=require(_0x3c70('0x1'));var logger=require(_0x3c70('0x2'))(_0x3c70('0x3'));var moment=require(_0x3c70('0x4'));var BPromise=require(_0x3c70('0x5'));var rp=require(_0x3c70('0x6'));var fs=require('fs');var path=require(_0x3c70('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x1381aa,_0x242e47){return _0x1381aa[_0x3c70('0x8')](_0x3c70('0x9'),attributes,{'tableName':_0x3c70('0xa'),'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 09c0863..fc448fe 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 _0x3b9d=['literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','raw','options','where','sequelize','COUNT'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x3b9d,0x1ec));var _0xd3b9=function(_0x5c6fc1,_0x54eec3){_0x5c6fc1=_0x5c6fc1-0x0;var _0x1a96c6=_0x3b9d[_0x5c6fc1];return _0x1a96c6;};'use strict';var _=require(_0xd3b9('0x0'));var util=require(_0xd3b9('0x1'));var moment=require('moment');var BPromise=require(_0xd3b9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3b9('0x3'));var db=require(_0xd3b9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3b9('0x5'))(_0xd3b9('0x6'));var config=require(_0xd3b9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd3b9('0x8')]['http']({'port':0x232a});config[_0xd3b9('0x9')]=_['defaults'](config['redis'],{'host':_0xd3b9('0xa'),'port':0x18eb});var socket=require(_0xd3b9('0xb'))(new Redis(config[_0xd3b9('0x9')]));require(_0xd3b9('0xc'))['register'](socket);function respondWithRpcPromise(_0x54dbc4,_0x395143,_0x953639){return new BPromise(function(_0x27710c,_0x2e0e5f){return client['request'](_0x54dbc4,_0x953639)[_0xd3b9('0xd')](function(_0x5aaa14){logger[_0xd3b9('0xe')](_0xd3b9('0xf'),_0x395143,_0xd3b9('0x10'));logger[_0xd3b9('0x11')](_0xd3b9('0x12'),_0x395143,_0xd3b9('0x10'),JSON[_0xd3b9('0x13')](_0x5aaa14));if(_0x5aaa14['error']){if(_0x5aaa14[_0xd3b9('0x14')][_0xd3b9('0x15')]===0x1f4){logger[_0xd3b9('0x14')](_0xd3b9('0xf'),_0x395143,_0x5aaa14['error'][_0xd3b9('0x16')]);return _0x2e0e5f(_0x5aaa14[_0xd3b9('0x14')]['message']);}logger['error'](_0xd3b9('0xf'),_0x395143,_0x5aaa14['error'][_0xd3b9('0x16')]);return _0x27710c(_0x5aaa14[_0xd3b9('0x14')][_0xd3b9('0x16')]);}else{logger[_0xd3b9('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x395143,_0xd3b9('0x10'));_0x27710c(_0x5aaa14[_0xd3b9('0x17')][_0xd3b9('0x16')]);}})[_0xd3b9('0x18')](function(_0x54b215){logger[_0xd3b9('0x14')](_0xd3b9('0xf'),_0x395143,_0x54b215);_0x2e0e5f(_0x54b215);});});}exports[_0xd3b9('0x19')]=function(_0x4ca748){var _0x1c30fb=this;return new Promise(function(_0x53a5e4,_0x226f1b){return db[_0xd3b9('0x1a')][_0xd3b9('0x1b')]({'raw':_0x4ca748['options']?_0x4ca748['options'][_0xd3b9('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ca748['options']?_0x4ca748[_0xd3b9('0x1d')][_0xd3b9('0x1e')]||null:null,'attributes':[[db[_0xd3b9('0x1f')]['fn'](_0xd3b9('0x20'),db[_0xd3b9('0x1f')]['fn']('IF',db[_0xd3b9('0x1f')][_0xd3b9('0x21')](_0xd3b9('0x22')))),'outboundQueuePauses']]})[_0xd3b9('0xd')](function(_0x5851a4){logger['info'](_0xd3b9('0x19'),_0x4ca748);logger['debug'](_0xd3b9('0x19'),_0x4ca748,JSON[_0xd3b9('0x13')](_0x5851a4));_0x53a5e4(_0x5851a4);})[_0xd3b9('0x18')](function(_0x1f8525){logger[_0xd3b9('0x14')](_0xd3b9('0x19'),_0x1f8525['message'],_0x4ca748);_0x226f1b(_0x1c30fb[_0xd3b9('0x14')](0x1f4,_0x1f8525['message']));});});}; \ No newline at end of file +var _0xbb44=['defaults','redis','localhost','./userVoiceQueueRt.socket','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','raw','options','where','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x41eee0,_0x312b31){var _0x25387b=function(_0x114ffd){while(--_0x114ffd){_0x41eee0['push'](_0x41eee0['shift']());}};_0x25387b(++_0x312b31);}(_0xbb44,0x123));var _0x4bb4=function(_0x1eed2f,_0x444824){_0x1eed2f=_0x1eed2f-0x0;var _0x337856=_0xbb44[_0x1eed2f];return _0x337856;};'use strict';var _=require(_0x4bb4('0x0'));var util=require(_0x4bb4('0x1'));var moment=require(_0x4bb4('0x2'));var BPromise=require(_0x4bb4('0x3'));var rs=require(_0x4bb4('0x4'));var fs=require('fs');var Redis=require(_0x4bb4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4bb4('0x6'));var logger=require(_0x4bb4('0x7'))(_0x4bb4('0x8'));var config=require(_0x4bb4('0x9'));var jayson=require(_0x4bb4('0xa'));var client=jayson[_0x4bb4('0xb')][_0x4bb4('0xc')]({'port':0x232a});config['redis']=_[_0x4bb4('0xd')](config[_0x4bb4('0xe')],{'host':_0x4bb4('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4bb4('0xe')]));require(_0x4bb4('0x10'))['register'](socket);function respondWithRpcPromise(_0x2b05ad,_0x4cc1c0,_0x71b828){return new BPromise(function(_0x4b2290,_0x19c3d4){return client[_0x4bb4('0x11')](_0x2b05ad,_0x71b828)[_0x4bb4('0x12')](function(_0x4b346e){logger[_0x4bb4('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4cc1c0,_0x4bb4('0x14'));logger[_0x4bb4('0x15')](_0x4bb4('0x16'),_0x4cc1c0,_0x4bb4('0x14'),JSON[_0x4bb4('0x17')](_0x4b346e));if(_0x4b346e[_0x4bb4('0x18')]){if(_0x4b346e['error']['code']===0x1f4){logger[_0x4bb4('0x18')](_0x4bb4('0x19'),_0x4cc1c0,_0x4b346e[_0x4bb4('0x18')]['message']);return _0x19c3d4(_0x4b346e[_0x4bb4('0x18')][_0x4bb4('0x1a')]);}logger[_0x4bb4('0x18')](_0x4bb4('0x19'),_0x4cc1c0,_0x4b346e[_0x4bb4('0x18')][_0x4bb4('0x1a')]);return _0x4b2290(_0x4b346e[_0x4bb4('0x18')]['message']);}else{logger[_0x4bb4('0x13')](_0x4bb4('0x19'),_0x4cc1c0,'request\x20sent');_0x4b2290(_0x4b346e['result'][_0x4bb4('0x1a')]);}})[_0x4bb4('0x1b')](function(_0x3d4522){logger[_0x4bb4('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4cc1c0,_0x3d4522);_0x19c3d4(_0x3d4522);});});}exports[_0x4bb4('0x1c')]=function(_0x36217d){var _0x1c69f9=this;return new Promise(function(_0x331d21,_0x21f177){return db[_0x4bb4('0x1d')][_0x4bb4('0x1e')]({'raw':_0x36217d['options']?_0x36217d['options'][_0x4bb4('0x1f')]===undefined?!![]:![]:!![],'where':_0x36217d[_0x4bb4('0x20')]?_0x36217d[_0x4bb4('0x20')][_0x4bb4('0x21')]||null:null,'attributes':[[db['sequelize']['fn'](_0x4bb4('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x4bb4('0x23')](_0x4bb4('0x24')))),_0x4bb4('0x25')]]})[_0x4bb4('0x12')](function(_0x479671){logger[_0x4bb4('0x13')](_0x4bb4('0x1c'),_0x36217d);logger[_0x4bb4('0x15')]('GetVoiceQueueRtPauses',_0x36217d,JSON[_0x4bb4('0x17')](_0x479671));_0x331d21(_0x479671);})['catch'](function(_0x39f22c){logger[_0x4bb4('0x18')](_0x4bb4('0x1c'),_0x39f22c['message'],_0x36217d);_0x21f177(_0x1c69f9[_0x4bb4('0x18')](0x1f4,_0x39f22c[_0x4bb4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index f268910..7b927d3 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 _0xa0a1=['emit','removeListener','register','length','./userVoiceQueueRt.events','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x5aaa90,_0x493b89){_0x5aaa90=_0x5aaa90-0x0;var _0x532628=_0xa0a1[_0x5aaa90];return _0x532628;};'use strict';var UserVoiceQueueRtEvents=require(_0x1a0a('0x0'));var events=['save',_0x1a0a('0x1'),_0x1a0a('0x2')];function createListener(_0x45ebf9,_0x5bdfc1){return function(_0x54b3a4){_0x5bdfc1[_0x1a0a('0x3')](_0x45ebf9,_0x54b3a4);};}function removeListener(_0x22f069,_0x5114de){return function(){UserVoiceQueueRtEvents[_0x1a0a('0x4')](_0x22f069,_0x5114de);};}exports[_0x1a0a('0x5')]=function(_0x4b5573){for(var _0x2d4b04=0x0,_0xe59f97=events[_0x1a0a('0x6')];_0x2d4b04<_0xe59f97;_0x2d4b04++){var _0x245f3d=events[_0x2d4b04];var _0x9da67c=createListener('userVoiceQueueRt:'+_0x245f3d,_0x4b5573);UserVoiceQueueRtEvents['on'](_0x245f3d,_0x9da67c);}}; \ No newline at end of file +var _0xf611=['emit','removeListener','length','userVoiceQueueRt:','save','remove','update'];(function(_0x4dc207,_0x3fb8fd){var _0x2cb941=function(_0x1d02e2){while(--_0x1d02e2){_0x4dc207['push'](_0x4dc207['shift']());}};_0x2cb941(++_0x3fb8fd);}(_0xf611,0x7b));var _0x1f61=function(_0x37e848,_0x418405){_0x37e848=_0x37e848-0x0;var _0x512fe7=_0xf611[_0x37e848];return _0x512fe7;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x1f61('0x0'),_0x1f61('0x1'),_0x1f61('0x2')];function createListener(_0x58da3e,_0x5e6707){return function(_0x5ede64){_0x5e6707[_0x1f61('0x3')](_0x58da3e,_0x5ede64);};}function removeListener(_0x4e0df1,_0xdc8d91){return function(){UserVoiceQueueRtEvents[_0x1f61('0x4')](_0x4e0df1,_0xdc8d91);};}exports['register']=function(_0x4faa5b){for(var _0x290165=0x0,_0x34a924=events[_0x1f61('0x5')];_0x290165<_0x34a924;_0x290165++){var _0x21e3f6=events[_0x290165];var _0x5b2e5b=createListener(_0x1f61('0x6')+_0x21e3f6,_0x4faa5b);UserVoiceQueueRtEvents['on'](_0x21e3f6,_0x5b2e5b);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 9966f27..3c83d08 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x18a146,_0x7f9c66){var _0x5f4e60=function(_0x355114){while(--_0x355114){_0x18a146['push'](_0x18a146['shift']());}};_0x5f4e60(++_0x7f9c66);}(_0x70e0,0x17b));var _0x070e=function(_0x5d0002,_0x33d28a){_0x5d0002=_0x5d0002-0x0;var _0xaf4b1=_0x70e0[_0x5d0002];return _0xaf4b1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5c6f50,_0x2352f2){var _0x5f1838=function(_0x4ba739){while(--_0x4ba739){_0x5c6f50['push'](_0x5c6f50['shift']());}};_0x5f1838(++_0x2352f2);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 6626f92..7fe0419 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c30=['sequelize','INTEGER'];(function(_0x16bb21,_0x4181f4){var _0x179ca4=function(_0x1c3528){while(--_0x1c3528){_0x16bb21['push'](_0x16bb21['shift']());}};_0x179ca4(++_0x4181f4);}(_0x6c30,0x19a));var _0x06c3=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x6c30[_0x378720];return _0x47920a;};'use strict';var Sequelize=require(_0x06c3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x06c3('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8daf=['exports','sequelize'];(function(_0x316769,_0x3f6f2c){var _0x44562d=function(_0x5c2962){while(--_0x5c2962){_0x316769['push'](_0x316769['shift']());}};_0x44562d(++_0x3f6f2c);}(_0x8daf,0xf9));var _0xf8da=function(_0x7d0f83,_0x43b7e3){_0x7d0f83=_0x7d0f83-0x0;var _0x7e1b2e=_0x8daf[_0x7d0f83];return _0x7e1b2e;};'use strict';var Sequelize=require(_0xf8da('0x0'));module[_0xf8da('0x1')]={'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 a2936af..c705b94 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 _0x9832=['define','UserWhatsappQueue','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x120610,_0x226b61){var _0x4e5072=function(_0x27b8cd){while(--_0x27b8cd){_0x120610['push'](_0x120610['shift']());}};_0x4e5072(++_0x226b61);}(_0x9832,0xff));var _0x2983=function(_0x3bbc46,_0x58ee90){_0x3bbc46=_0x3bbc46-0x0;var _0x3658f2=_0x9832[_0x3bbc46];return _0x3658f2;};'use strict';var _=require('lodash');var util=require(_0x2983('0x0'));var logger=require('../../config/logger')(_0x2983('0x1'));var moment=require(_0x2983('0x2'));var BPromise=require(_0x2983('0x3'));var rp=require(_0x2983('0x4'));var fs=require('fs');var path=require(_0x2983('0x5'));var rimraf=require(_0x2983('0x6'));var config=require(_0x2983('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x2983('0x8')]=function(_0x1ac90a,_0x57b109){return _0x1ac90a[_0x2983('0x9')](_0x2983('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd32=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','api'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xfd32,0xa6));var _0x2fd3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2fd3('0x0'))(_0x2fd3('0x1'));var moment=require(_0x2fd3('0x2'));var BPromise=require(_0x2fd3('0x3'));var rp=require(_0x2fd3('0x4'));var fs=require('fs');var path=require(_0x2fd3('0x5'));var rimraf=require(_0x2fd3('0x6'));var config=require(_0x2fd3('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x2fd3('0x8')]=function(_0x4ce2c5,_0x186fe9){return _0x4ce2c5[_0x2fd3('0x9')](_0x2fd3('0xa'),attributes,{'tableName':_0x2fd3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index a6e3b26..6d8458d 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 _0x113e=['../../config/logger','rpc','jayson/promise','client','http','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1d3499,_0x25fd91){var _0x3871f4=function(_0x4528b1){while(--_0x4528b1){_0x1d3499['push'](_0x1d3499['shift']());}};_0x3871f4(++_0x25fd91);}(_0x113e,0x1c4));var _0xe113=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x113e[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xe113('0x0'));var util=require(_0xe113('0x1'));var moment=require(_0xe113('0x2'));var BPromise=require(_0xe113('0x3'));var rs=require(_0xe113('0x4'));var fs=require('fs');var Redis=require(_0xe113('0x5'));var db=require(_0xe113('0x6'))['db'];var utils=require(_0xe113('0x7'));var logger=require(_0xe113('0x8'))(_0xe113('0x9'));var config=require('../../config/environment');var jayson=require(_0xe113('0xa'));var client=jayson[_0xe113('0xb')][_0xe113('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b2248,_0x590bf3,_0x432a99){return new BPromise(function(_0x480197,_0x595620){return client[_0xe113('0xd')](_0x4b2248,_0x432a99)['then'](function(_0x51d3ac){logger['info'](_0xe113('0xe'),_0x590bf3,_0xe113('0xf'));logger[_0xe113('0x10')](_0xe113('0x11'),_0x590bf3,_0xe113('0xf'),JSON[_0xe113('0x12')](_0x51d3ac));if(_0x51d3ac[_0xe113('0x13')]){if(_0x51d3ac[_0xe113('0x13')]['code']===0x1f4){logger[_0xe113('0x13')](_0xe113('0xe'),_0x590bf3,_0x51d3ac['error']['message']);return _0x595620(_0x51d3ac[_0xe113('0x13')]['message']);}logger[_0xe113('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x590bf3,_0x51d3ac[_0xe113('0x13')][_0xe113('0x14')]);return _0x480197(_0x51d3ac[_0xe113('0x13')][_0xe113('0x14')]);}else{logger[_0xe113('0x15')]('UserWhatsappQueue,\x20%s,\x20%s',_0x590bf3,_0xe113('0xf'));_0x480197(_0x51d3ac[_0xe113('0x16')]['message']);}})['catch'](function(_0x2c13e5){logger[_0xe113('0x13')](_0xe113('0xe'),_0x590bf3,_0x2c13e5);_0x595620(_0x2c13e5);});});} \ No newline at end of file +var _0x3e23=['error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x207f13,_0x45b0ec){var _0x23d772=function(_0x5dde53){while(--_0x5dde53){_0x207f13['push'](_0x207f13['shift']());}};_0x23d772(++_0x45b0ec);}(_0x3e23,0x1a6));var _0x33e2=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x3e23[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x33e2('0x0'));var util=require('util');var moment=require(_0x33e2('0x1'));var BPromise=require(_0x33e2('0x2'));var rs=require(_0x33e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x33e2('0x5'))(_0x33e2('0x6'));var config=require(_0x33e2('0x7'));var jayson=require(_0x33e2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x236548,_0x322aed,_0x1ac7fb){return new BPromise(function(_0x308584,_0xb6e06b){return client[_0x33e2('0x9')](_0x236548,_0x1ac7fb)[_0x33e2('0xa')](function(_0x9e7a66){logger[_0x33e2('0xb')](_0x33e2('0xc'),_0x322aed,_0x33e2('0xd'));logger['debug'](_0x33e2('0xe'),_0x322aed,_0x33e2('0xd'),JSON['stringify'](_0x9e7a66));if(_0x9e7a66[_0x33e2('0xf')]){if(_0x9e7a66[_0x33e2('0xf')][_0x33e2('0x10')]===0x1f4){logger[_0x33e2('0xf')](_0x33e2('0xc'),_0x322aed,_0x9e7a66[_0x33e2('0xf')][_0x33e2('0x11')]);return _0xb6e06b(_0x9e7a66['error'][_0x33e2('0x11')]);}logger[_0x33e2('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x322aed,_0x9e7a66[_0x33e2('0xf')][_0x33e2('0x11')]);return _0x308584(_0x9e7a66['error'][_0x33e2('0x11')]);}else{logger[_0x33e2('0xb')](_0x33e2('0xc'),_0x322aed,_0x33e2('0xd'));_0x308584(_0x9e7a66[_0x33e2('0x12')]['message']);}})['catch'](function(_0x47b4ac){logger[_0x33e2('0xf')](_0x33e2('0xc'),_0x322aed,_0x47b4ac);_0xb6e06b(_0x47b4ac);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 35f6f10..341645c 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 _0xf25a=['create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','index','isAuthenticated','show','post'];(function(_0x380d32,_0x28c493){var _0x10fcdd=function(_0x3dadf4){while(--_0x3dadf4){_0x380d32['push'](_0x380d32['shift']());}};_0x10fcdd(++_0x28c493);}(_0xf25a,0x195));var _0xaf25=function(_0x19a5db,_0x3de9d9){_0x19a5db=_0x19a5db-0x0;var _0x3d9737=_0xf25a[_0x19a5db];return _0x3d9737;};'use strict';var multer=require(_0xaf25('0x0'));var util=require(_0xaf25('0x1'));var path=require(_0xaf25('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf25('0x3'));var router=express[_0xaf25('0x4')]();var fs_extra=require(_0xaf25('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaf25('0x6'));var config=require(_0xaf25('0x7'));var controller=require(_0xaf25('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xaf25('0x9')]);router['get']('/:id',auth[_0xaf25('0xa')](),controller[_0xaf25('0xb')]);router[_0xaf25('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf25('0xd')]);router[_0xaf25('0xe')](_0xaf25('0xf'),auth[_0xaf25('0xa')](),controller[_0xaf25('0x10')]);router['delete'](_0xaf25('0xf'),auth[_0xaf25('0xa')](),controller[_0xaf25('0x11')]);module[_0xaf25('0x12')]=router; \ No newline at end of file +var _0xb91a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x1f0f34,_0x48c366){var _0x4c1439=function(_0x58873e){while(--_0x58873e){_0x1f0f34['push'](_0x1f0f34['shift']());}};_0x4c1439(++_0x48c366);}(_0xb91a,0xf4));var _0xab91=function(_0x810e1e,_0x2a8d85){_0x810e1e=_0x810e1e-0x0;var _0xf076cf=_0xb91a[_0x810e1e];return _0xf076cf;};'use strict';var multer=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var path=require(_0xab91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xab91('0x3')]();var fs_extra=require(_0xab91('0x4'));var auth=require(_0xab91('0x5'));var interaction=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var controller=require(_0xab91('0x8'));router[_0xab91('0x9')]('/',auth[_0xab91('0xa')](),controller[_0xab91('0xb')]);router[_0xab91('0x9')]('/:id',auth[_0xab91('0xa')](),controller[_0xab91('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xab91('0xd')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller[_0xab91('0xf')]);router[_0xab91('0x10')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller[_0xab91('0x11')]);module[_0xab91('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 5620ae1..7f3adcd 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 _0x8bad=['sequelize','exports','STRING','name'];(function(_0xdae69b,_0x5544f3){var _0x503069=function(_0x38e499){while(--_0x38e499){_0xdae69b['push'](_0xdae69b['shift']());}};_0x503069(++_0x5544f3);}(_0x8bad,0x124));var _0xd8ba=function(_0x530cea,_0x5ba642){_0x530cea=_0x530cea-0x0;var _0xc0b750=_0x8bad[_0x530cea];return _0xc0b750;};'use strict';var Sequelize=require(_0xd8ba('0x0'));module[_0xd8ba('0x1')]={'name':{'type':Sequelize[_0xd8ba('0x2')],'unique':_0xd8ba('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd8ba('0x2')]}}; \ No newline at end of file +var _0x4444=['exports','name','STRING','sequelize'];(function(_0x2a8272,_0x5f3e38){var _0xe0fa73=function(_0x3a1878){while(--_0x3a1878){_0x2a8272['push'](_0x2a8272['shift']());}};_0xe0fa73(++_0x5f3e38);}(_0x4444,0xa3));var _0x4444=function(_0x5ee1ef,_0x8d83d5){_0x5ee1ef=_0x5ee1ef-0x0;var _0x601cdc=_0x4444[_0x5ee1ef];return _0x601cdc;};'use strict';var Sequelize=require(_0x4444('0x0'));module[_0x4444('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4444('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4444('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 39015b4..3724dfa 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 _0x18bd=['set','apply','reject','save','update','destroy','then','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','user','role','UserProfileSection','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset'];(function(_0x38613b,_0x593433){var _0x3f9353=function(_0x5e07ac){while(--_0x5e07ac){_0x38613b['push'](_0x38613b['shift']());}};_0x3f9353(++_0x593433);}(_0x18bd,0x1b1));var _0xd18b=function(_0x3d8e50,_0x48c5d6){_0x3d8e50=_0x3d8e50-0x0;var _0x18beb3=_0x18bd[_0x3d8e50];return _0x18beb3;};'use strict';var emlformat=require(_0xd18b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd18b('0x1'));var jsonpatch=require(_0xd18b('0x2'));var rp=require(_0xd18b('0x3'));var moment=require('moment');var BPromise=require(_0xd18b('0x4'));var Mustache=require(_0xd18b('0x5'));var util=require(_0xd18b('0x6'));var path=require(_0xd18b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd18b('0x8'));var squel=require(_0xd18b('0x9'));var crypto=require(_0xd18b('0xa'));var jsforce=require(_0xd18b('0xb'));var deskjs=require(_0xd18b('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd18b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd18b('0xe'));var qs=require(_0xd18b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd18b('0x10'));var logger=require('../../config/logger')(_0xd18b('0x11'));var utils=require(_0xd18b('0x12'));var config=require(_0xd18b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd18b('0x14'))['db'];function respondWithStatusCode(_0x516fb8,_0x3b6203){_0x3b6203=_0x3b6203||0xcc;return function(_0x245987){if(_0x245987){return _0x516fb8[_0xd18b('0x15')](_0x3b6203);}return _0x516fb8['status'](_0x3b6203)[_0xd18b('0x16')]();};}function respondWithResult(_0x439674,_0x50f7b3){_0x50f7b3=_0x50f7b3||0xc8;return function(_0xfcce77){if(_0xfcce77){return _0x439674[_0xd18b('0x17')](_0x50f7b3)[_0xd18b('0x18')](_0xfcce77);}};}function respondWithFilteredResult(_0xd0d9dc,_0x2ae589){return function(_0x275c48){if(_0x275c48){var _0x297e8b=typeof _0x2ae589['offset']===_0xd18b('0x19')&&typeof _0x2ae589[_0xd18b('0x1a')]==='undefined';var _0x31c5db=_0x275c48[_0xd18b('0x1b')];var _0x48847c=_0x297e8b?0x0:_0x2ae589[_0xd18b('0x1c')];var _0x232e40=_0x297e8b?_0x275c48['count']:_0x2ae589[_0xd18b('0x1c')]+_0x2ae589['limit'];var _0x1164a1;if(_0x232e40>=_0x31c5db){_0x232e40=_0x31c5db;_0x1164a1=0xc8;}else{_0x1164a1=0xce;}_0xd0d9dc[_0xd18b('0x17')](_0x1164a1);return _0xd0d9dc[_0xd18b('0x1d')]('Content-Range',_0x48847c+'-'+_0x232e40+'/'+_0x31c5db)['json'](_0x275c48);}return null;};}function patchUpdates(_0x27afbb){return function(_0x488820){try{jsonpatch[_0xd18b('0x1e')](_0x488820,_0x27afbb,!![]);}catch(_0x46d7a0){return BPromise[_0xd18b('0x1f')](_0x46d7a0);}return _0x488820[_0xd18b('0x20')]();};}function saveUpdates(_0x4dd4a6,_0x1bea17){return function(_0x1ffb9b){if(_0x1ffb9b){return _0x1ffb9b[_0xd18b('0x21')](_0x4dd4a6)['then'](function(_0x5afb21){return _0x5afb21;});}return null;};}function removeEntity(_0x6cc7a4,_0x2810ca){return function(_0x126b9f){if(_0x126b9f){return _0x126b9f[_0xd18b('0x22')]()[_0xd18b('0x23')](function(){var _0x2e3918=_0x126b9f[_0xd18b('0x24')]({'plain':!![]});var _0x1f8b21=_0xd18b('0x25');return db[_0xd18b('0x26')][_0xd18b('0x22')]({'where':{'type':_0x1f8b21,'resourceId':_0x2e3918['id']}})[_0xd18b('0x23')](function(){return _0x126b9f;});})[_0xd18b('0x23')](function(){_0x6cc7a4[_0xd18b('0x17')](0xcc)[_0xd18b('0x16')]();});}};}function handleEntityNotFound(_0x52b665,_0x4f56e0){return function(_0x2145f3){if(!_0x2145f3){_0x52b665[_0xd18b('0x15')](0x194);}return _0x2145f3;};}function handleError(_0x872fea,_0x4a87f4){_0x4a87f4=_0x4a87f4||0x1f4;return function(_0x5b123f){logger[_0xd18b('0x27')](_0x5b123f[_0xd18b('0x28')]);if(_0x5b123f['name']){delete _0x5b123f[_0xd18b('0x29')];}_0x872fea['status'](_0x4a87f4)[_0xd18b('0x2a')](_0x5b123f);};}exports[_0xd18b('0x2b')]=function(_0x3757eb,_0x597433){var _0x518afb={},_0x100c6c={},_0x16b81d={'count':0x0,'rows':[]};var _0x304503=_[_0xd18b('0x2c')](db[_0xd18b('0x2d')]['rawAttributes'],function(_0xe624d5){return{'name':_0xe624d5[_0xd18b('0x2e')],'type':_0xe624d5['type']['key']};});_0x100c6c[_0xd18b('0x2f')]=_[_0xd18b('0x2c')](_0x304503,'name');_0x100c6c[_0xd18b('0x30')]=_[_0xd18b('0x31')](_0x3757eb['query']);_0x100c6c[_0xd18b('0x32')]=_[_0xd18b('0x33')](_0x100c6c['model'],_0x100c6c[_0xd18b('0x30')]);_0x518afb[_0xd18b('0x34')]=_[_0xd18b('0x33')](_0x100c6c[_0xd18b('0x2f')],qs[_0xd18b('0x35')](_0x3757eb['query']['fields']));_0x518afb['attributes']=_0x518afb['attributes'][_0xd18b('0x36')]?_0x518afb[_0xd18b('0x34')]:_0x100c6c[_0xd18b('0x2f')];if(!_0x3757eb[_0xd18b('0x30')][_0xd18b('0x37')]('nolimit')){_0x518afb[_0xd18b('0x1a')]=qs[_0xd18b('0x1a')](_0x3757eb[_0xd18b('0x30')][_0xd18b('0x1a')]);_0x518afb[_0xd18b('0x1c')]=qs[_0xd18b('0x1c')](_0x3757eb[_0xd18b('0x30')]['offset']);}_0x518afb[_0xd18b('0x38')]=qs['sort'](_0x3757eb[_0xd18b('0x30')][_0xd18b('0x39')]);_0x518afb[_0xd18b('0x3a')]=qs[_0xd18b('0x32')](_[_0xd18b('0x3b')](_0x3757eb['query'],_0x100c6c[_0xd18b('0x32')]),_0x304503);if(_0x3757eb[_0xd18b('0x30')][_0xd18b('0x3c')]){_0x518afb[_0xd18b('0x3a')]=_[_0xd18b('0x3d')](_0x518afb[_0xd18b('0x3a')],{'$or':_[_0xd18b('0x2c')](_0x304503,function(_0xa303d){if(_0xa303d[_0xd18b('0x3e')]!=='VIRTUAL'){var _0x13ddf4={};_0x13ddf4[_0xa303d['name']]={'$like':'%'+_0x3757eb[_0xd18b('0x30')][_0xd18b('0x3c')]+'%'};return _0x13ddf4;}})});}_0x518afb=_[_0xd18b('0x3d')]({},_0x518afb,_0x3757eb[_0xd18b('0x3f')]);var _0x308e01={'where':_0x518afb[_0xd18b('0x3a')]};return db[_0xd18b('0x2d')][_0xd18b('0x1b')](_0x308e01)[_0xd18b('0x23')](function(_0x2294d7){_0x16b81d[_0xd18b('0x1b')]=_0x2294d7;if(_0x3757eb[_0xd18b('0x30')][_0xd18b('0x40')]){_0x518afb[_0xd18b('0x41')]=[{'all':!![]}];}return db[_0xd18b('0x2d')][_0xd18b('0x42')](_0x518afb);})['then'](function(_0x495f94){_0x16b81d['rows']=_0x495f94;return _0x16b81d;})[_0xd18b('0x23')](respondWithFilteredResult(_0x597433,_0x518afb))[_0xd18b('0x43')](handleError(_0x597433,null));};exports['show']=function(_0x5e7a1a,_0x179f18){var _0x3eea0a={'raw':!![],'where':{'id':_0x5e7a1a[_0xd18b('0x44')]['id']}},_0x484f29={};_0x484f29[_0xd18b('0x2f')]=_[_0xd18b('0x31')](db[_0xd18b('0x2d')][_0xd18b('0x45')]);_0x484f29[_0xd18b('0x30')]=_[_0xd18b('0x31')](_0x5e7a1a[_0xd18b('0x30')]);_0x484f29['filters']=_['intersection'](_0x484f29[_0xd18b('0x2f')],_0x484f29[_0xd18b('0x30')]);_0x3eea0a[_0xd18b('0x34')]=_['intersection'](_0x484f29['model'],qs[_0xd18b('0x35')](_0x5e7a1a['query'][_0xd18b('0x35')]));_0x3eea0a[_0xd18b('0x34')]=_0x3eea0a[_0xd18b('0x34')][_0xd18b('0x36')]?_0x3eea0a[_0xd18b('0x34')]:_0x484f29['model'];if(_0x5e7a1a[_0xd18b('0x30')][_0xd18b('0x40')]){_0x3eea0a[_0xd18b('0x41')]=[{'all':!![]}];}_0x3eea0a=_[_0xd18b('0x3d')]({},_0x3eea0a,_0x5e7a1a[_0xd18b('0x3f')]);return db['Variable'][_0xd18b('0x46')](_0x3eea0a)['then'](handleEntityNotFound(_0x179f18,null))['then'](respondWithResult(_0x179f18,null))[_0xd18b('0x43')](handleError(_0x179f18,null));};exports[_0xd18b('0x47')]=function(_0x3b08a3,_0x12a1f4){return db['Variable'][_0xd18b('0x47')](_0x3b08a3[_0xd18b('0x48')],{})[_0xd18b('0x23')](function(_0x2d0c40){var _0x3205a7=_0x3b08a3[_0xd18b('0x49')]['get']({'plain':!![]});if(!_0x3205a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3205a7[_0xd18b('0x4a')]===_0xd18b('0x49')){var _0x2602d7=_0x2d0c40['get']({'plain':!![]});var _0x2491b4='Variables';return db[_0xd18b('0x4b')][_0xd18b('0x46')]({'where':{'name':_0x2491b4,'userProfileId':_0x3205a7['userProfileId']},'raw':!![]})[_0xd18b('0x23')](function(_0x390b9e){if(_0x390b9e&&_0x390b9e[_0xd18b('0x4c')]===0x0){return db[_0xd18b('0x26')][_0xd18b('0x47')]({'name':_0x2602d7[_0xd18b('0x29')],'resourceId':_0x2602d7['id'],'type':_0x390b9e['name'],'sectionId':_0x390b9e['id']},{})['then'](function(){return _0x2d0c40;});}else{return _0x2d0c40;}})[_0xd18b('0x43')](function(_0x1e303c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e303c);throw _0x1e303c;});}return _0x2d0c40;})[_0xd18b('0x23')](respondWithResult(_0x12a1f4,0xc9))[_0xd18b('0x43')](handleError(_0x12a1f4,null));};exports[_0xd18b('0x21')]=function(_0x3022be,_0x50757b){if(_0x3022be[_0xd18b('0x48')]['id']){delete _0x3022be[_0xd18b('0x48')]['id'];}return db[_0xd18b('0x2d')][_0xd18b('0x46')]({'where':{'id':_0x3022be[_0xd18b('0x44')]['id']}})[_0xd18b('0x23')](handleEntityNotFound(_0x50757b,null))[_0xd18b('0x23')](saveUpdates(_0x3022be[_0xd18b('0x48')],null))[_0xd18b('0x23')](respondWithResult(_0x50757b,null))[_0xd18b('0x43')](handleError(_0x50757b,null));};exports[_0xd18b('0x22')]=function(_0x391e7f,_0x2914be){return db[_0xd18b('0x2d')]['find']({'where':{'id':_0x391e7f[_0xd18b('0x44')]['id']}})[_0xd18b('0x23')](handleEntityNotFound(_0x2914be,null))[_0xd18b('0x23')](removeEntity(_0x2914be,null))[_0xd18b('0x43')](handleError(_0x2914be,null));}; \ No newline at end of file +var _0xa714=['set','json','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch','params','keys','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','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','count'];(function(_0x23cc2d,_0xd02450){var _0x3dd47d=function(_0x26c771){while(--_0x26c771){_0x23cc2d['push'](_0x23cc2d['shift']());}};_0x3dd47d(++_0xd02450);}(_0xa714,0x17d));var _0x4a71=function(_0x191aed,_0x60a0fa){_0x191aed=_0x191aed-0x0;var _0x57311a=_0xa714[_0x191aed];return _0x57311a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4a71('0x0'));var jsonpatch=require(_0x4a71('0x1'));var rp=require(_0x4a71('0x2'));var moment=require(_0x4a71('0x3'));var BPromise=require(_0x4a71('0x4'));var Mustache=require(_0x4a71('0x5'));var util=require(_0x4a71('0x6'));var path=require(_0x4a71('0x7'));var sox=require(_0x4a71('0x8'));var csv=require(_0x4a71('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a71('0xa'));var _=require(_0x4a71('0xb'));var squel=require(_0x4a71('0xc'));var crypto=require(_0x4a71('0xd'));var jsforce=require(_0x4a71('0xe'));var deskjs=require(_0x4a71('0xf'));var toCsv=require(_0x4a71('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4a71('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4a71('0x11'));var hardwareService=require(_0x4a71('0x12'));var logger=require(_0x4a71('0x13'))(_0x4a71('0x14'));var utils=require(_0x4a71('0x15'));var config=require(_0x4a71('0x16'));var licenseUtil=require(_0x4a71('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x490b80,_0x23e508){_0x23e508=_0x23e508||0xcc;return function(_0x1c352f){if(_0x1c352f){return _0x490b80['sendStatus'](_0x23e508);}return _0x490b80[_0x4a71('0x18')](_0x23e508)[_0x4a71('0x19')]();};}function respondWithResult(_0x54be20,_0x5f361f){_0x5f361f=_0x5f361f||0xc8;return function(_0x4f4681){if(_0x4f4681){return _0x54be20[_0x4a71('0x18')](_0x5f361f)['json'](_0x4f4681);}};}function respondWithFilteredResult(_0x55356d,_0x583905){return function(_0x21bccb){if(_0x21bccb){var _0x3104d3=typeof _0x583905[_0x4a71('0x1a')]==='undefined'&&typeof _0x583905[_0x4a71('0x1b')]==='undefined';var _0x44e5bd=_0x21bccb[_0x4a71('0x1c')];var _0x7d751f=_0x3104d3?0x0:_0x583905[_0x4a71('0x1a')];var _0x521a56=_0x3104d3?_0x21bccb[_0x4a71('0x1c')]:_0x583905[_0x4a71('0x1a')]+_0x583905[_0x4a71('0x1b')];var _0x82b2c5;if(_0x521a56>=_0x44e5bd){_0x521a56=_0x44e5bd;_0x82b2c5=0xc8;}else{_0x82b2c5=0xce;}_0x55356d[_0x4a71('0x18')](_0x82b2c5);return _0x55356d[_0x4a71('0x1d')]('Content-Range',_0x7d751f+'-'+_0x521a56+'/'+_0x44e5bd)[_0x4a71('0x1e')](_0x21bccb);}return null;};}function patchUpdates(_0x50cdd5){return function(_0x3c6615){try{jsonpatch['apply'](_0x3c6615,_0x50cdd5,!![]);}catch(_0x52f524){return BPromise[_0x4a71('0x1f')](_0x52f524);}return _0x3c6615[_0x4a71('0x20')]();};}function saveUpdates(_0x577534,_0x27ec1f){return function(_0x208e80){if(_0x208e80){return _0x208e80[_0x4a71('0x21')](_0x577534)[_0x4a71('0x22')](function(_0x59e565){return _0x59e565;});}return null;};}function removeEntity(_0x2f447c,_0x32eadd){return function(_0x4a7279){if(_0x4a7279){return _0x4a7279[_0x4a71('0x23')]()[_0x4a71('0x22')](function(){var _0x4c6c2b=_0x4a7279[_0x4a71('0x24')]({'plain':!![]});var _0x1ec5b0=_0x4a71('0x25');return db[_0x4a71('0x26')]['destroy']({'where':{'type':_0x1ec5b0,'resourceId':_0x4c6c2b['id']}})[_0x4a71('0x22')](function(){return _0x4a7279;});})[_0x4a71('0x22')](function(){_0x2f447c[_0x4a71('0x18')](0xcc)[_0x4a71('0x19')]();});}};}function handleEntityNotFound(_0x29b003,_0x340d97){return function(_0x3a174e){if(!_0x3a174e){_0x29b003['sendStatus'](0x194);}return _0x3a174e;};}function handleError(_0x376d3f,_0x3a6d5d){_0x3a6d5d=_0x3a6d5d||0x1f4;return function(_0x463b3f){logger[_0x4a71('0x27')](_0x463b3f[_0x4a71('0x28')]);if(_0x463b3f[_0x4a71('0x29')]){delete _0x463b3f[_0x4a71('0x29')];}_0x376d3f[_0x4a71('0x18')](_0x3a6d5d)[_0x4a71('0x2a')](_0x463b3f);};}exports[_0x4a71('0x2b')]=function(_0x1c6653,_0x177b71){var _0xa508c4={},_0x537ed2={},_0x1b71d5={'count':0x0,'rows':[]};var _0x37a3e6=_[_0x4a71('0x2c')](db[_0x4a71('0x2d')][_0x4a71('0x2e')],function(_0x5e546f){return{'name':_0x5e546f[_0x4a71('0x2f')],'type':_0x5e546f['type'][_0x4a71('0x30')]};});_0x537ed2[_0x4a71('0x31')]=_[_0x4a71('0x2c')](_0x37a3e6,_0x4a71('0x29'));_0x537ed2[_0x4a71('0x32')]=_['keys'](_0x1c6653[_0x4a71('0x32')]);_0x537ed2['filters']=_[_0x4a71('0x33')](_0x537ed2['model'],_0x537ed2[_0x4a71('0x32')]);_0xa508c4[_0x4a71('0x34')]=_['intersection'](_0x537ed2[_0x4a71('0x31')],qs[_0x4a71('0x35')](_0x1c6653[_0x4a71('0x32')][_0x4a71('0x35')]));_0xa508c4['attributes']=_0xa508c4[_0x4a71('0x34')][_0x4a71('0x36')]?_0xa508c4['attributes']:_0x537ed2[_0x4a71('0x31')];if(!_0x1c6653[_0x4a71('0x32')][_0x4a71('0x37')](_0x4a71('0x38'))){_0xa508c4['limit']=qs[_0x4a71('0x1b')](_0x1c6653['query'][_0x4a71('0x1b')]);_0xa508c4[_0x4a71('0x1a')]=qs[_0x4a71('0x1a')](_0x1c6653['query'][_0x4a71('0x1a')]);}_0xa508c4[_0x4a71('0x39')]=qs[_0x4a71('0x3a')](_0x1c6653['query'][_0x4a71('0x3a')]);_0xa508c4[_0x4a71('0x3b')]=qs[_0x4a71('0x3c')](_[_0x4a71('0x3d')](_0x1c6653[_0x4a71('0x32')],_0x537ed2[_0x4a71('0x3c')]),_0x37a3e6);if(_0x1c6653[_0x4a71('0x32')][_0x4a71('0x3e')]){_0xa508c4[_0x4a71('0x3b')]=_[_0x4a71('0x3f')](_0xa508c4['where'],{'$or':_['map'](_0x37a3e6,function(_0x21efb4){if(_0x21efb4[_0x4a71('0x40')]!=='VIRTUAL'){var _0x4158c2={};_0x4158c2[_0x21efb4[_0x4a71('0x29')]]={'$like':'%'+_0x1c6653[_0x4a71('0x32')][_0x4a71('0x3e')]+'%'};return _0x4158c2;}})});}_0xa508c4=_['merge']({},_0xa508c4,_0x1c6653[_0x4a71('0x41')]);var _0x3c4873={'where':_0xa508c4[_0x4a71('0x3b')]};return db[_0x4a71('0x2d')][_0x4a71('0x1c')](_0x3c4873)[_0x4a71('0x22')](function(_0x305a2f){_0x1b71d5['count']=_0x305a2f;if(_0x1c6653['query'][_0x4a71('0x42')]){_0xa508c4[_0x4a71('0x43')]=[{'all':!![]}];}return db[_0x4a71('0x2d')][_0x4a71('0x44')](_0xa508c4);})[_0x4a71('0x22')](function(_0x3caa53){_0x1b71d5['rows']=_0x3caa53;return _0x1b71d5;})[_0x4a71('0x22')](respondWithFilteredResult(_0x177b71,_0xa508c4))[_0x4a71('0x45')](handleError(_0x177b71,null));};exports['show']=function(_0x5f2c14,_0x556399){var _0x1bef19={'raw':!![],'where':{'id':_0x5f2c14[_0x4a71('0x46')]['id']}},_0x1aa28f={};_0x1aa28f[_0x4a71('0x31')]=_[_0x4a71('0x47')](db[_0x4a71('0x2d')][_0x4a71('0x2e')]);_0x1aa28f['query']=_[_0x4a71('0x47')](_0x5f2c14[_0x4a71('0x32')]);_0x1aa28f['filters']=_['intersection'](_0x1aa28f[_0x4a71('0x31')],_0x1aa28f[_0x4a71('0x32')]);_0x1bef19[_0x4a71('0x34')]=_[_0x4a71('0x33')](_0x1aa28f[_0x4a71('0x31')],qs[_0x4a71('0x35')](_0x5f2c14[_0x4a71('0x32')][_0x4a71('0x35')]));_0x1bef19[_0x4a71('0x34')]=_0x1bef19[_0x4a71('0x34')][_0x4a71('0x36')]?_0x1bef19[_0x4a71('0x34')]:_0x1aa28f['model'];if(_0x5f2c14[_0x4a71('0x32')][_0x4a71('0x42')]){_0x1bef19[_0x4a71('0x43')]=[{'all':!![]}];}_0x1bef19=_[_0x4a71('0x3f')]({},_0x1bef19,_0x5f2c14[_0x4a71('0x41')]);return db[_0x4a71('0x2d')][_0x4a71('0x48')](_0x1bef19)[_0x4a71('0x22')](handleEntityNotFound(_0x556399,null))[_0x4a71('0x22')](respondWithResult(_0x556399,null))[_0x4a71('0x45')](handleError(_0x556399,null));};exports[_0x4a71('0x49')]=function(_0x30d514,_0x1b38a5){return db[_0x4a71('0x2d')]['create'](_0x30d514['body'],{})[_0x4a71('0x22')](function(_0x510e3b){var _0x2e1c75=_0x30d514[_0x4a71('0x4a')][_0x4a71('0x24')]({'plain':!![]});if(!_0x2e1c75)throw new Error(_0x4a71('0x4b'));if(_0x2e1c75[_0x4a71('0x4c')]==='user'){var _0x1b1e9b=_0x510e3b[_0x4a71('0x24')]({'plain':!![]});var _0xdc3131=_0x4a71('0x25');return db[_0x4a71('0x4d')][_0x4a71('0x48')]({'where':{'name':_0xdc3131,'userProfileId':_0x2e1c75[_0x4a71('0x4e')]},'raw':!![]})[_0x4a71('0x22')](function(_0x4d24d9){if(_0x4d24d9&&_0x4d24d9[_0x4a71('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x1b1e9b[_0x4a71('0x29')],'resourceId':_0x1b1e9b['id'],'type':_0x4d24d9['name'],'sectionId':_0x4d24d9['id']},{})[_0x4a71('0x22')](function(){return _0x510e3b;});}else{return _0x510e3b;}})['catch'](function(_0x49a2be){logger[_0x4a71('0x27')](_0x4a71('0x50'),_0x49a2be);throw _0x49a2be;});}return _0x510e3b;})[_0x4a71('0x22')](respondWithResult(_0x1b38a5,0xc9))[_0x4a71('0x45')](handleError(_0x1b38a5,null));};exports[_0x4a71('0x21')]=function(_0x2ec51b,_0xf10069){if(_0x2ec51b[_0x4a71('0x51')]['id']){delete _0x2ec51b['body']['id'];}return db[_0x4a71('0x2d')]['find']({'where':{'id':_0x2ec51b['params']['id']}})['then'](handleEntityNotFound(_0xf10069,null))[_0x4a71('0x22')](saveUpdates(_0x2ec51b[_0x4a71('0x51')],null))[_0x4a71('0x22')](respondWithResult(_0xf10069,null))[_0x4a71('0x45')](handleError(_0xf10069,null));};exports[_0x4a71('0x23')]=function(_0x1e5318,_0x9e12c1){return db[_0x4a71('0x2d')][_0x4a71('0x48')]({'where':{'id':_0x1e5318[_0x4a71('0x46')]['id']}})[_0x4a71('0x22')](handleEntityNotFound(_0x9e12c1,null))[_0x4a71('0x22')](removeEntity(_0x9e12c1,null))[_0x4a71('0x45')](handleError(_0x9e12c1,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 483e254..cbf74c8 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 _0xef80=['../../config/logger','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0xef80,0x175));var _0x0ef8=function(_0x5f12fd,_0x33c70d){_0x5f12fd=_0x5f12fd-0x0;var _0x58bd80=_0xef80[_0x5f12fd];return _0x58bd80;};'use strict';var _=require(_0x0ef8('0x0'));var util=require('util');var logger=require(_0x0ef8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0ef8('0x2'));var rp=require(_0x0ef8('0x3'));var fs=require('fs');var path=require(_0x0ef8('0x4'));var rimraf=require('rimraf');var config=require(_0x0ef8('0x5'));var attributes=require(_0x0ef8('0x6'));module[_0x0ef8('0x7')]=function(_0x1d4bfd,_0x5f0a63){return _0x1d4bfd[_0x0ef8('0x8')](_0x0ef8('0x9'),attributes,{'tableName':_0x0ef8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb928=['exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes'];(function(_0x1170ef,_0x26d037){var _0x36d888=function(_0x6ea133){while(--_0x6ea133){_0x1170ef['push'](_0x1170ef['shift']());}};_0x36d888(++_0x26d037);}(_0xb928,0x100));var _0x8b92=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0xb928[_0x36d25e];return _0x4b95b8;};'use strict';var _=require(_0x8b92('0x0'));var util=require(_0x8b92('0x1'));var logger=require(_0x8b92('0x2'))(_0x8b92('0x3'));var moment=require('moment');var BPromise=require(_0x8b92('0x4'));var rp=require(_0x8b92('0x5'));var fs=require('fs');var path=require(_0x8b92('0x6'));var rimraf=require(_0x8b92('0x7'));var config=require(_0x8b92('0x8'));var attributes=require(_0x8b92('0x9'));module[_0x8b92('0xa')]=function(_0x92ecf4,_0x3ff6e8){return _0x92ecf4[_0x8b92('0xb')](_0x8b92('0xc'),attributes,{'tableName':_0x8b92('0xd'),'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 6de66f1..5c9ae13 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 _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x4db081,_0xd3b834){var _0x3aa22e=function(_0x4fe5cc){while(--_0x4fe5cc){_0x4db081['push'](_0x4db081['shift']());}};_0x3aa22e(++_0xd3b834);}(_0x814b,0x1a2));var _0xb814=function(_0x11b4fb,_0x10c784){_0x11b4fb=_0x11b4fb-0x0;var _0x56cbb5=_0x814b[_0x11b4fb];return _0x56cbb5;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +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(_0x5b989e,_0x4e28f9){var _0x36f054=function(_0x4a0bd0){while(--_0x4a0bd0){_0x5b989e['push'](_0x5b989e['shift']());}};_0x36f054(++_0x4e28f9);}(_0x55ca,0x126));var _0xa55c=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x55ca[_0x5de532];return _0x4e9192;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index 3ab08b1..f780f3b 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 _0xf50a=['pull','/restart','restart','/migrations','exports','index','get','/fetch','isAuthenticated','fetch','/reset','canUpdate','/pull'];(function(_0x4a4d8e,_0x22a7a9){var _0x1a5cb4=function(_0xdcf2eb){while(--_0xdcf2eb){_0x4a4d8e['push'](_0x4a4d8e['shift']());}};_0x1a5cb4(++_0x22a7a9);}(_0xf50a,0x18b));var _0xaf50=function(_0x5a3ee9,_0x11ed55){_0x5a3ee9=_0x5a3ee9-0x0;var _0x45032c=_0xf50a[_0x5a3ee9];return _0x45032c;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./version.controller');router['get']('/',controller[_0xaf50('0x0')]);router[_0xaf50('0x1')](_0xaf50('0x2'),auth[_0xaf50('0x3')](),auth['canUpdate'](),controller[_0xaf50('0x4')]);router[_0xaf50('0x1')](_0xaf50('0x5'),auth[_0xaf50('0x3')](),auth[_0xaf50('0x6')](),controller['reset']);router[_0xaf50('0x1')](_0xaf50('0x7'),auth[_0xaf50('0x3')](),auth['canUpdate'](),controller[_0xaf50('0x8')]);router['get'](_0xaf50('0x9'),auth[_0xaf50('0x3')](),controller[_0xaf50('0xa')]);router[_0xaf50('0x1')](_0xaf50('0xb'),controller['migrations']);module[_0xaf50('0xc')]=router; \ No newline at end of file +var _0x481c=['/migrations','migrations','exports','Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart'];(function(_0x566a6d,_0x3baf32){var _0x405354=function(_0x152050){while(--_0x152050){_0x566a6d['push'](_0x566a6d['shift']());}};_0x405354(++_0x3baf32);}(_0x481c,0x153));var _0xc481=function(_0x5e7ca0,_0x8a3602){_0x5e7ca0=_0x5e7ca0-0x0;var _0x327230=_0x481c[_0x5e7ca0];return _0x327230;};'use strict';var express=require('express');var router=express[_0xc481('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xc481('0x1'));router[_0xc481('0x2')]('/',controller[_0xc481('0x3')]);router['get'](_0xc481('0x4'),auth[_0xc481('0x5')](),auth[_0xc481('0x6')](),controller[_0xc481('0x7')]);router[_0xc481('0x2')](_0xc481('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc481('0x9')]);router[_0xc481('0x2')](_0xc481('0xa'),auth[_0xc481('0x5')](),auth[_0xc481('0x6')](),controller[_0xc481('0xb')]);router[_0xc481('0x2')](_0xc481('0xc'),auth['isAuthenticated'](),controller['restart']);router[_0xc481('0x2')](_0xc481('0xd'),controller[_0xc481('0xe')]);module[_0xc481('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 d4ba3f8..42ef3b8 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 _0x5b7a=['exports','query','latest','fetch','2.0.0','json','master','error','status','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/logger','update','simple-git','root'];(function(_0x130777,_0x241c02){var _0x2a45d6=function(_0x50bae9){while(--_0x50bae9){_0x130777['push'](_0x130777['shift']());}};_0x2a45d6(++_0x241c02);}(_0x5b7a,0x160));var _0xa5b7=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x5b7a[_0x88cd7b];return _0x56fcc8;};'use strict';var Umzug=require(_0xa5b7('0x0'));var path=require(_0xa5b7('0x1'));var fs=require('fs');var _=require(_0xa5b7('0x2'));var pkginfo=require(_0xa5b7('0x3'))(module,_0xa5b7('0x4'));var compareVersions=require(_0xa5b7('0x5'));var exec=require(_0xa5b7('0x6'))[_0xa5b7('0x7')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0xa5b7('0x8'))(_0xa5b7('0x9'));var git=require(_0xa5b7('0xa'))(config[_0xa5b7('0xb')]);exports['index']=function(_0x51207f,_0x3e45be){var _0x5f4b24={'current':module[_0xa5b7('0xc')][_0xa5b7('0x4')],'phonebar':0x2};if(_0x51207f[_0xa5b7('0xd')]&&_0x51207f[_0xa5b7('0xd')][_0xa5b7('0xe')]){return git[_0xa5b7('0xf')]()['tags'](function(_0x1eefc8,_0x4879b9){_0x5f4b24[_0xa5b7('0xe')]=(_0x1eefc8?module[_0xa5b7('0xc')][_0xa5b7('0x4')]:_0x4879b9[_0xa5b7('0xe')])||_0xa5b7('0x10');return _0x3e45be['status'](0xc8)['json'](_0x5f4b24);});}else{return _0x3e45be['status'](0xc8)[_0xa5b7('0x11')](_0x5f4b24);}};exports[_0xa5b7('0xf')]=function(_0x4c49fb,_0x314a9c){return git['fetch'](['origin',_0xa5b7('0x12')],function(_0x33d27e){if(_0x33d27e){logger[_0xa5b7('0x13')](_0x33d27e);return _0x314a9c[_0xa5b7('0x14')](0x1f4)[_0xa5b7('0x11')](_0x33d27e);}logger[_0xa5b7('0x15')](_0xa5b7('0x16'));return _0x314a9c[_0xa5b7('0x14')](0xc8)[_0xa5b7('0x11')]({'output':_0xa5b7('0x17')});});};exports[_0xa5b7('0x18')]=function(_0x4cc725,_0x221cc3){return git[_0xa5b7('0x18')]([_0xa5b7('0x19'),_0xa5b7('0x1a')],function(_0x149e36){if(_0x149e36){logger[_0xa5b7('0x13')](_0x149e36);return _0x221cc3['status'](0x1f4)[_0xa5b7('0x11')](_0x149e36);}logger[_0xa5b7('0x15')](_0xa5b7('0x1b'));return _0x221cc3[_0xa5b7('0x14')](0xc8)['json']({'output':_0xa5b7('0x1c')});});};exports[_0xa5b7('0x1d')]=function(_0x4c97c0,_0x3032db){exec(_0xa5b7('0x1e'),function(_0x17db35,_0x4fd520,_0x5e87c7){logger[_0xa5b7('0x15')](_0x4fd520);logger[_0xa5b7('0x15')](_0x5e87c7);if(_0x17db35){logger[_0xa5b7('0x13')](_0x17db35);return _0x3032db[_0xa5b7('0x14')](0x1f4)['json'](_0x17db35);}return _0x3032db[_0xa5b7('0x14')](0xc8)[_0xa5b7('0x11')]({'output':_0x4fd520});});};exports[_0xa5b7('0x1f')]=function(_0x2bca53,_0x490959){return pm2[_0xa5b7('0x1f')](_0xa5b7('0x20'))[_0xa5b7('0x21')](function(_0x35aebd){logger[_0xa5b7('0x15')](_0xa5b7('0x22'),_0x35aebd);return _0x490959['status'](0xc8)[_0xa5b7('0x11')]({'output':_0xa5b7('0x23')});})[_0xa5b7('0x24')](function(_0x3dfb7f){logger[_0xa5b7('0x13')](_0x3dfb7f);return _0x490959[_0xa5b7('0x14')](0x1f4)[_0xa5b7('0x11')](_0x3dfb7f);});};exports[_0xa5b7('0x25')]=function(_0x24c1aa,_0xe25d06){var _0x13f38b=fs['readdirSync'](path[_0xa5b7('0x26')](config['root'],'server',_0xa5b7('0x25')));var _0x722aec=[];for(var _0x845a91=0x0;_0x845a91<_0x13f38b[_0xa5b7('0x27')];_0x845a91++){var _0x59bba1=_0x13f38b[_0x845a91][_0xa5b7('0x28')](_0xa5b7('0x29'),'');if(compareVersions(module[_0xa5b7('0xc')][_0xa5b7('0x4')],_0x59bba1)===-0x1){_0x722aec['push'](_0x59bba1);}}if(_0x722aec[_0xa5b7('0x27')]){var _0x1b2a4a=_0x722aec[_0xa5b7('0x2a')](compareVersions);var _0x25ffba=new Umzug({'storage':_0xa5b7('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0xa5b7('0x2c'),'columnName':_0xa5b7('0x4')},'migrations':{'params':[db[_0xa5b7('0x2b')][_0xa5b7('0x2d')](),db[_0xa5b7('0x2b')][_0xa5b7('0x2e')],function(){throw new Error(_0xa5b7('0x2f'));}],'path':path[_0xa5b7('0x26')](config['root'],_0xa5b7('0x30'),_0xa5b7('0x25')),'pattern':/\.js$/}});_0x25ffba['up']({'migrations':_[_0xa5b7('0x31')](_0x1b2a4a,function(_0xb2c8f8){return _0xb2c8f8+_0xa5b7('0x29');})})[_0xa5b7('0x21')](function(){return _0xe25d06['status'](0xc8)[_0xa5b7('0x11')]({'output':_0xa5b7('0x32')+module[_0xa5b7('0xc')][_0xa5b7('0x4')]+'\x20to\x20'+_['last'](_0x1b2a4a),'migrations':_[_0xa5b7('0x26')](_0x1b2a4a)});})[_0xa5b7('0x24')](function(_0x5340b7){if(_0x5340b7 instanceof db[_0xa5b7('0x2b')]['UniqueConstraintError']){return _0xe25d06['status'](0xc8)['json']({'output':_0xa5b7('0x33')});}else{return _0xe25d06['status'](0x1f4)['json'](_0x5340b7);}});}else{return _0xe25d06[_0xa5b7('0x14')](0xc8)[_0xa5b7('0x11')]({'output':_0xa5b7('0x33')});}}; \ No newline at end of file +var _0x5a36=['status','error','json','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','exports','sort','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','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','umzug','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','update','simple-git','root','index','query','latest','fetch','tags','2.0.0'];(function(_0x10fb19,_0x16bd31){var _0x483102=function(_0x1b8d68){while(--_0x1b8d68){_0x10fb19['push'](_0x10fb19['shift']());}};_0x483102(++_0x16bd31);}(_0x5a36,0x1cc));var _0x65a3=function(_0x5bccd3,_0x4e2b7b){_0x5bccd3=_0x5bccd3-0x0;var _0x322dbc=_0x5a36[_0x5bccd3];return _0x322dbc;};'use strict';var Umzug=require(_0x65a3('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x65a3('0x1'))(module,_0x65a3('0x2'));var compareVersions=require(_0x65a3('0x3'));var exec=require(_0x65a3('0x4'))[_0x65a3('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x65a3('0x6'));var pm2=require(_0x65a3('0x7'));var logger=require('../../config/logger')(_0x65a3('0x8'));var git=require(_0x65a3('0x9'))(config[_0x65a3('0xa')]);exports[_0x65a3('0xb')]=function(_0x14db51,_0x250c5b){var _0x3a2e5f={'current':module['exports'][_0x65a3('0x2')],'phonebar':0x2};if(_0x14db51['query']&&_0x14db51[_0x65a3('0xc')][_0x65a3('0xd')]){return git[_0x65a3('0xe')]()[_0x65a3('0xf')](function(_0x423bb7,_0x3ad664){_0x3a2e5f[_0x65a3('0xd')]=(_0x423bb7?module['exports'][_0x65a3('0x2')]:_0x3ad664[_0x65a3('0xd')])||_0x65a3('0x10');return _0x250c5b[_0x65a3('0x11')](0xc8)['json'](_0x3a2e5f);});}else{return _0x250c5b[_0x65a3('0x11')](0xc8)['json'](_0x3a2e5f);}};exports['fetch']=function(_0x242a05,_0x3d3016){return git['fetch'](['origin','master'],function(_0x405ee6){if(_0x405ee6){logger[_0x65a3('0x12')](_0x405ee6);return _0x3d3016[_0x65a3('0x11')](0x1f4)[_0x65a3('0x13')](_0x405ee6);}logger['info'](_0x65a3('0x14'));return _0x3d3016['status'](0xc8)['json']({'output':_0x65a3('0x15')});});};exports[_0x65a3('0x16')]=function(_0x3df422,_0x46113b){return git['reset']([_0x65a3('0x17'),_0x65a3('0x18')],function(_0x107efc){if(_0x107efc){logger[_0x65a3('0x12')](_0x107efc);return _0x46113b[_0x65a3('0x11')](0x1f4)[_0x65a3('0x13')](_0x107efc);}logger[_0x65a3('0x19')](_0x65a3('0x1a'));return _0x46113b['status'](0xc8)['json']({'output':_0x65a3('0x1b')});});};exports[_0x65a3('0x1c')]=function(_0x3e5456,_0x476c69){exec(_0x65a3('0x1d'),function(_0x4356cf,_0x470a2c,_0x15e558){logger[_0x65a3('0x19')](_0x470a2c);logger[_0x65a3('0x19')](_0x15e558);if(_0x4356cf){logger['error'](_0x4356cf);return _0x476c69[_0x65a3('0x11')](0x1f4)[_0x65a3('0x13')](_0x4356cf);}return _0x476c69[_0x65a3('0x11')](0xc8)['json']({'output':_0x470a2c});});};exports[_0x65a3('0x1e')]=function(_0x1a8a9e,_0x246fd0){return pm2[_0x65a3('0x1e')](_0x65a3('0x1f'))[_0x65a3('0x20')](function(_0x1387a3){logger['info'](_0x65a3('0x21'),_0x1387a3);return _0x246fd0[_0x65a3('0x11')](0xc8)['json']({'output':_0x65a3('0x22')});})[_0x65a3('0x23')](function(_0x2312e5){logger['error'](_0x2312e5);return _0x246fd0[_0x65a3('0x11')](0x1f4)[_0x65a3('0x13')](_0x2312e5);});};exports[_0x65a3('0x24')]=function(_0x3bad7c,_0x5086e3){var _0x554d8a=fs[_0x65a3('0x25')](path[_0x65a3('0x26')](config[_0x65a3('0xa')],_0x65a3('0x27'),_0x65a3('0x24')));var _0x2b5372=[];for(var _0x2eb0fe=0x0;_0x2eb0fe<_0x554d8a[_0x65a3('0x28')];_0x2eb0fe++){var _0x1ea5bd=_0x554d8a[_0x2eb0fe][_0x65a3('0x29')](_0x65a3('0x2a'),'');if(compareVersions(module[_0x65a3('0x2b')][_0x65a3('0x2')],_0x1ea5bd)===-0x1){_0x2b5372['push'](_0x1ea5bd);}}if(_0x2b5372[_0x65a3('0x28')]){var _0x444718=_0x2b5372[_0x65a3('0x2c')](compareVersions);var _0x47a86f=new Umzug({'storage':_0x65a3('0x2d'),'storageOptions':{'model':db[_0x65a3('0x2e')],'modelName':_0x65a3('0x2e'),'columnName':_0x65a3('0x2')},'migrations':{'params':[db[_0x65a3('0x2d')]['getQueryInterface'](),db['sequelize'][_0x65a3('0x2f')],function(){throw new Error(_0x65a3('0x30'));}],'path':path[_0x65a3('0x26')](config['root'],_0x65a3('0x27'),_0x65a3('0x24')),'pattern':/\.js$/}});_0x47a86f['up']({'migrations':_[_0x65a3('0x31')](_0x444718,function(_0x46b6b6){return _0x46b6b6+'.js';})})[_0x65a3('0x20')](function(){return _0x5086e3['status'](0xc8)[_0x65a3('0x13')]({'output':_0x65a3('0x32')+module[_0x65a3('0x2b')][_0x65a3('0x2')]+_0x65a3('0x33')+_[_0x65a3('0x34')](_0x444718),'migrations':_[_0x65a3('0x26')](_0x444718)});})['catch'](function(_0x509c2f){if(_0x509c2f instanceof db[_0x65a3('0x2d')]['UniqueConstraintError']){return _0x5086e3[_0x65a3('0x11')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x5086e3['status'](0x1f4)['json'](_0x509c2f);}});}else{return _0x5086e3[_0x65a3('0x11')](0xc8)[_0x65a3('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 59f498c..d02c889 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 _0x2870=['fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x5342eb,_0x425e62){var _0x57abcb=function(_0x35c4ff){while(--_0x35c4ff){_0x5342eb['push'](_0x5342eb['shift']());}};_0x57abcb(++_0x425e62);}(_0x2870,0x1e9));var _0x0287=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0x2870[_0x5e8c32];return _0x595f7b;};'use strict';var multer=require(_0x0287('0x0'));var util=require(_0x0287('0x1'));var path=require(_0x0287('0x2'));var timeout=require(_0x0287('0x3'));var express=require('express');var router=express[_0x0287('0x4')]();var fs_extra=require(_0x0287('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0287('0x6'));var config=require(_0x0287('0x7'));var controller=require(_0x0287('0x8'));router[_0x0287('0x9')]('/',auth[_0x0287('0xa')](),controller[_0x0287('0xb')]);router['get']('/describe',auth[_0x0287('0xa')](),controller['describe']);router[_0x0287('0x9')](_0x0287('0xc'),auth[_0x0287('0xa')](),controller['show']);router[_0x0287('0xd')]('/',auth[_0x0287('0xa')](),controller['create']);router[_0x0287('0xe')](_0x0287('0xc'),auth['isAuthenticated'](),controller[_0x0287('0xf')]);router[_0x0287('0x10')](_0x0287('0xc'),auth[_0x0287('0xa')](),controller[_0x0287('0x11')]);module[_0x0287('0x12')]=router; \ No newline at end of file +var _0x6698=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x63939,_0x56e783){var _0x41bb2e=function(_0x4fae3b){while(--_0x4fae3b){_0x63939['push'](_0x63939['shift']());}};_0x41bb2e(++_0x56e783);}(_0x6698,0x83));var _0x8669=function(_0x182622,_0x1d06e0){_0x182622=_0x182622-0x0;var _0x4cde14=_0x6698[_0x182622];return _0x4cde14;};'use strict';var multer=require(_0x8669('0x0'));var util=require('util');var path=require(_0x8669('0x1'));var timeout=require('connect-timeout');var express=require(_0x8669('0x2'));var router=express[_0x8669('0x3')]();var fs_extra=require(_0x8669('0x4'));var auth=require(_0x8669('0x5'));var interaction=require(_0x8669('0x6'));var config=require('../../config/environment');var controller=require(_0x8669('0x7'));router[_0x8669('0x8')]('/',auth[_0x8669('0x9')](),controller[_0x8669('0xa')]);router['get'](_0x8669('0xb'),auth[_0x8669('0x9')](),controller[_0x8669('0xc')]);router[_0x8669('0x8')](_0x8669('0xd'),auth[_0x8669('0x9')](),controller[_0x8669('0xe')]);router[_0x8669('0xf')]('/',auth['isAuthenticated'](),controller[_0x8669('0x10')]);router[_0x8669('0x11')](_0x8669('0xd'),auth[_0x8669('0x9')](),controller[_0x8669('0x12')]);router[_0x8669('0x13')](_0x8669('0xd'),auth[_0x8669('0x9')](),controller[_0x8669('0x14')]);module[_0x8669('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 990b118..217ea00 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 _0xcd6f=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x344adc,_0x183c37){var _0x4014b2=function(_0xe809e5){while(--_0xe809e5){_0x344adc['push'](_0x344adc['shift']());}};_0x4014b2(++_0x183c37);}(_0xcd6f,0x17b));var _0xfcd6=function(_0x27b9f4,_0x31657b){_0x27b9f4=_0x27b9f4-0x0;var _0x553b26=_0xcd6f[_0x27b9f4];return _0x553b26;};'use strict';var Sequelize=require(_0xfcd6('0x0'));module[_0xfcd6('0x1')]={'type':{'type':Sequelize[_0xfcd6('0x2')]},'uniqueid':{'type':Sequelize[_0xfcd6('0x2')]},'calleridnum':{'type':Sequelize[_0xfcd6('0x2')]},'calleridname':{'type':Sequelize[_0xfcd6('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xfcd6('0x2')]},'membername':{'type':Sequelize[_0xfcd6('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfcd6('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfcd6('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xfcd6('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xfcd6('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xfcd6('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xfcd6('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xfcd6('0x2')]},'accountcode':{'type':Sequelize[_0xfcd6('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xfcd6('0x2')]},'priority':{'type':Sequelize[_0xfcd6('0x2')]},'destchannel':{'type':Sequelize[_0xfcd6('0x2')]},'destchannelstate':{'type':Sequelize[_0xfcd6('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xfcd6('0x2')]},'destcalleridnum':{'type':Sequelize[_0xfcd6('0x2')]},'destcalleridname':{'type':Sequelize[_0xfcd6('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfcd6('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xfcd6('0x2')]},'destlanguage':{'type':Sequelize[_0xfcd6('0x2')]},'destaccountcode':{'type':Sequelize[_0xfcd6('0x2')]},'destcontext':{'type':Sequelize[_0xfcd6('0x2')]},'destexten':{'type':Sequelize[_0xfcd6('0x2')]},'destpriority':{'type':Sequelize[_0xfcd6('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xfcd6('0x2')]},'transfer':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xfcd6('0x6')},'transferexten':{'type':Sequelize[_0xfcd6('0x2')]},'transferuniqueid':{'type':Sequelize[_0xfcd6('0x2')]},'agententerreason':{'type':Sequelize[_0xfcd6('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcd6f=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x5734e1,_0x3e1d75){var _0x22c784=function(_0x4fe1eb){while(--_0x4fe1eb){_0x5734e1['push'](_0x5734e1['shift']());}};_0x22c784(++_0x3e1d75);}(_0xcd6f,0x17b));var _0xfcd6=function(_0xfe3407,_0x2d93f9){_0xfe3407=_0xfe3407-0x0;var _0x2a86ba=_0xcd6f[_0xfe3407];return _0x2a86ba;};'use strict';var Sequelize=require(_0xfcd6('0x0'));module[_0xfcd6('0x1')]={'type':{'type':Sequelize[_0xfcd6('0x2')]},'uniqueid':{'type':Sequelize[_0xfcd6('0x2')]},'calleridnum':{'type':Sequelize[_0xfcd6('0x2')]},'calleridname':{'type':Sequelize[_0xfcd6('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xfcd6('0x2')]},'membername':{'type':Sequelize[_0xfcd6('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfcd6('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfcd6('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xfcd6('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xfcd6('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xfcd6('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xfcd6('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xfcd6('0x2')]},'accountcode':{'type':Sequelize[_0xfcd6('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xfcd6('0x2')]},'priority':{'type':Sequelize[_0xfcd6('0x2')]},'destchannel':{'type':Sequelize[_0xfcd6('0x2')]},'destchannelstate':{'type':Sequelize[_0xfcd6('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xfcd6('0x2')]},'destcalleridnum':{'type':Sequelize[_0xfcd6('0x2')]},'destcalleridname':{'type':Sequelize[_0xfcd6('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfcd6('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xfcd6('0x2')]},'destlanguage':{'type':Sequelize[_0xfcd6('0x2')]},'destaccountcode':{'type':Sequelize[_0xfcd6('0x2')]},'destcontext':{'type':Sequelize[_0xfcd6('0x2')]},'destexten':{'type':Sequelize[_0xfcd6('0x2')]},'destpriority':{'type':Sequelize[_0xfcd6('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xfcd6('0x2')]},'transfer':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xfcd6('0x6')},'transferexten':{'type':Sequelize[_0xfcd6('0x2')]},'transferuniqueid':{'type':Sequelize[_0xfcd6('0x2')]},'agententerreason':{'type':Sequelize[_0xfcd6('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 9025d27..23f7ae0 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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_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 c43d5d1..4e65c25 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 _0x6bdc=['define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x28ccff,_0x97ded8){var _0x5c9c8d=function(_0x53359f){while(--_0x53359f){_0x28ccff['push'](_0x28ccff['shift']());}};_0x5c9c8d(++_0x97ded8);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x179dad,_0x137e84){_0x179dad=_0x179dad-0x0;var _0x27f370=_0x6bdc[_0x179dad];return _0x27f370;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var logger=require(_0xc6bd('0x2'))(_0xc6bd('0x3'));var moment=require(_0xc6bd('0x4'));var BPromise=require(_0xc6bd('0x5'));var rp=require(_0xc6bd('0x6'));var fs=require('fs');var path=require(_0xc6bd('0x7'));var rimraf=require(_0xc6bd('0x8'));var config=require(_0xc6bd('0x9'));var attributes=require('./voiceAgentReport.attributes');module[_0xc6bd('0xa')]=function(_0x26218a,_0x158271){return _0x26218a[_0xc6bd('0xb')](_0xc6bd('0xc'),attributes,{'tableName':_0xc6bd('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xc6bd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e8a=['destuniqueid','util','../../config/logger','moment','bluebird','path','define','report_agent','uniqueid'];(function(_0x175290,_0x42e572){var _0x52bd78=function(_0xea7cc7){while(--_0xea7cc7){_0x175290['push'](_0x175290['shift']());}};_0x52bd78(++_0x42e572);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x30b057,_0x1d1505){_0x30b057=_0x30b057-0x0;var _0x331671=_0x2e8a[_0x30b057];return _0x331671;};'use strict';var _=require('lodash');var util=require(_0xa2e8('0x0'));var logger=require(_0xa2e8('0x1'))('api');var moment=require(_0xa2e8('0x2'));var BPromise=require(_0xa2e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2e8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x4593d2,_0x32fb35){return _0x4593d2[_0xa2e8('0x5')]('VoiceAgentReport',attributes,{'tableName':_0xa2e8('0x6'),'paranoid':![],'indexes':[{'fields':[_0xa2e8('0x7'),_0xa2e8('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e274437..b3e04e6 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 _0x30e9=['info','result','catch','VoiceAgentReport','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5391ef,_0x3c8788){var _0x136499=function(_0x4d80a5){while(--_0x4d80a5){_0x5391ef['push'](_0x5391ef['shift']());}};_0x136499(++_0x3c8788);}(_0x30e9,0x70));var _0x930e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x30e9[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0x930e('0x0'));var moment=require(_0x930e('0x1'));var BPromise=require(_0x930e('0x2'));var rs=require(_0x930e('0x3'));var fs=require('fs');var Redis=require(_0x930e('0x4'));var db=require(_0x930e('0x5'))['db'];var utils=require(_0x930e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x930e('0x7'));var jayson=require(_0x930e('0x8'));var client=jayson[_0x930e('0x9')][_0x930e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a2dff,_0xf1cb05,_0x561a00){return new BPromise(function(_0x37612b,_0x25b12e){return client['request'](_0x2a2dff,_0x561a00)[_0x930e('0xb')](function(_0x12e75b){logger['info'](_0x930e('0xc'),_0xf1cb05,_0x930e('0xd'));logger[_0x930e('0xe')](_0x930e('0xf'),_0xf1cb05,_0x930e('0xd'),JSON[_0x930e('0x10')](_0x12e75b));if(_0x12e75b['error']){if(_0x12e75b[_0x930e('0x11')][_0x930e('0x12')]===0x1f4){logger[_0x930e('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0xf1cb05,_0x12e75b[_0x930e('0x11')][_0x930e('0x13')]);return _0x25b12e(_0x12e75b[_0x930e('0x11')]['message']);}logger[_0x930e('0x11')](_0x930e('0xc'),_0xf1cb05,_0x12e75b[_0x930e('0x11')][_0x930e('0x13')]);return _0x37612b(_0x12e75b[_0x930e('0x11')]['message']);}else{logger[_0x930e('0x14')](_0x930e('0xc'),_0xf1cb05,_0x930e('0xd'));_0x37612b(_0x12e75b[_0x930e('0x15')][_0x930e('0x13')]);}})[_0x930e('0x16')](function(_0x5e2fc5){logger[_0x930e('0x11')](_0x930e('0xc'),_0xf1cb05,_0x5e2fc5);_0x25b12e(_0x5e2fc5);});});}exports['CreateVoiceAgentReport']=function(_0x1c12d5){var _0xf2b145=this;return new Promise(function(_0x2d08f6,_0x31e09a){return db[_0x930e('0x17')]['create'](_0x1c12d5[_0x930e('0x18')],{'raw':_0x1c12d5['options']?_0x1c12d5[_0x930e('0x19')][_0x930e('0x1a')]===undefined?!![]:![]:!![]})[_0x930e('0xb')](function(_0x3b3aa2){logger['info'](_0x930e('0x1b'),_0x1c12d5);logger[_0x930e('0xe')](_0x930e('0x1b'),_0x1c12d5,JSON['stringify'](_0x3b3aa2));_0x2d08f6(_0x3b3aa2);})[_0x930e('0x16')](function(_0x358047){logger['error']('CreateVoiceAgentReport',_0x358047['message'],_0x1c12d5);_0x31e09a(_0xf2b145[_0x930e('0x11')](0x1f4,_0x358047[_0x930e('0x13')]));});});};exports[_0x930e('0x1c')]=function(_0xef6e0a){var _0x4ea063=this;return new Promise(function(_0x2a0c65,_0x58fb7a){return db[_0x930e('0x17')][_0x930e('0x1d')](_0xef6e0a[_0x930e('0x18')],{'raw':_0xef6e0a[_0x930e('0x19')]?_0xef6e0a[_0x930e('0x19')][_0x930e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xef6e0a[_0x930e('0x19')]?_0xef6e0a[_0x930e('0x19')][_0x930e('0x1e')]||null:null,'attributes':_0xef6e0a['options']?_0xef6e0a['options'][_0x930e('0x1f')]||null:null,'limit':_0xef6e0a[_0x930e('0x19')]?_0xef6e0a[_0x930e('0x19')][_0x930e('0x20')]||null:null})[_0x930e('0xb')](function(_0x58bd57){logger['info'](_0x930e('0x1c'),_0xef6e0a);logger[_0x930e('0xe')](_0x930e('0x1c'),_0xef6e0a,JSON[_0x930e('0x10')](_0x58bd57));_0x2a0c65(_0x58bd57);})[_0x930e('0x16')](function(_0x6d2f33){logger[_0x930e('0x11')]('UpdateVoiceAgentReport',_0x6d2f33[_0x930e('0x13')],_0xef6e0a);_0x58fb7a(_0x4ea063[_0x930e('0x11')](0x1f4,_0x6d2f33['message']));});});}; \ No newline at end of file +var _0x20e7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','update','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x56ec18,_0x38a5da){var _0x150509=function(_0x4e80d0){while(--_0x4e80d0){_0x56ec18['push'](_0x56ec18['shift']());}};_0x150509(++_0x38a5da);}(_0x20e7,0x1a9));var _0x720e=function(_0xcd812c,_0x41e128){_0xcd812c=_0xcd812c-0x0;var _0x40996a=_0x20e7[_0xcd812c];return _0x40996a;};'use strict';var _=require(_0x720e('0x0'));var util=require(_0x720e('0x1'));var moment=require('moment');var BPromise=require(_0x720e('0x2'));var rs=require(_0x720e('0x3'));var fs=require('fs');var Redis=require(_0x720e('0x4'));var db=require(_0x720e('0x5'))['db'];var utils=require(_0x720e('0x6'));var logger=require(_0x720e('0x7'))(_0x720e('0x8'));var config=require(_0x720e('0x9'));var jayson=require(_0x720e('0xa'));var client=jayson[_0x720e('0xb')][_0x720e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x455e7d,_0x3b3c0d,_0x6d3d68){return new BPromise(function(_0x46dfff,_0x48c62f){return client[_0x720e('0xd')](_0x455e7d,_0x6d3d68)[_0x720e('0xe')](function(_0x3a136d){logger[_0x720e('0xf')](_0x720e('0x10'),_0x3b3c0d,'request\x20sent');logger[_0x720e('0x11')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x3b3c0d,'request\x20sent',JSON[_0x720e('0x12')](_0x3a136d));if(_0x3a136d[_0x720e('0x13')]){if(_0x3a136d['error'][_0x720e('0x14')]===0x1f4){logger[_0x720e('0x13')](_0x720e('0x10'),_0x3b3c0d,_0x3a136d['error'][_0x720e('0x15')]);return _0x48c62f(_0x3a136d[_0x720e('0x13')][_0x720e('0x15')]);}logger['error'](_0x720e('0x10'),_0x3b3c0d,_0x3a136d[_0x720e('0x13')][_0x720e('0x15')]);return _0x46dfff(_0x3a136d[_0x720e('0x13')]['message']);}else{logger[_0x720e('0xf')](_0x720e('0x10'),_0x3b3c0d,_0x720e('0x16'));_0x46dfff(_0x3a136d[_0x720e('0x17')]['message']);}})[_0x720e('0x18')](function(_0x48ab5c){logger[_0x720e('0x13')](_0x720e('0x10'),_0x3b3c0d,_0x48ab5c);_0x48c62f(_0x48ab5c);});});}exports[_0x720e('0x19')]=function(_0x271821){var _0x1b4c54=this;return new Promise(function(_0x57344b,_0x3f3d55){return db[_0x720e('0x1a')][_0x720e('0x1b')](_0x271821[_0x720e('0x1c')],{'raw':_0x271821[_0x720e('0x1d')]?_0x271821[_0x720e('0x1d')][_0x720e('0x1e')]===undefined?!![]:![]:!![]})[_0x720e('0xe')](function(_0x68d7fc){logger[_0x720e('0xf')](_0x720e('0x19'),_0x271821);logger[_0x720e('0x11')]('CreateVoiceAgentReport',_0x271821,JSON[_0x720e('0x12')](_0x68d7fc));_0x57344b(_0x68d7fc);})[_0x720e('0x18')](function(_0x5e022c){logger['error'](_0x720e('0x19'),_0x5e022c[_0x720e('0x15')],_0x271821);_0x3f3d55(_0x1b4c54[_0x720e('0x13')](0x1f4,_0x5e022c[_0x720e('0x15')]));});});};exports['UpdateVoiceAgentReport']=function(_0x307f01){var _0x3b0a44=this;return new Promise(function(_0x431122,_0x173c5c){return db[_0x720e('0x1a')][_0x720e('0x1f')](_0x307f01['body'],{'raw':_0x307f01['options']?_0x307f01[_0x720e('0x1d')][_0x720e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x307f01[_0x720e('0x1d')]?_0x307f01['options'][_0x720e('0x20')]||null:null,'attributes':_0x307f01['options']?_0x307f01[_0x720e('0x1d')][_0x720e('0x21')]||null:null,'limit':_0x307f01[_0x720e('0x1d')]?_0x307f01[_0x720e('0x1d')][_0x720e('0x22')]||null:null})['then'](function(_0x2eb807){logger[_0x720e('0xf')](_0x720e('0x23'),_0x307f01);logger[_0x720e('0x11')]('UpdateVoiceAgentReport',_0x307f01,JSON[_0x720e('0x12')](_0x2eb807));_0x431122(_0x2eb807);})[_0x720e('0x18')](function(_0x35e05c){logger['error']('UpdateVoiceAgentReport',_0x35e05c[_0x720e('0x15')],_0x307f01);_0x173c5c(_0x3b0a44[_0x720e('0x13')](0x1f4,_0x35e05c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 6af5c6e..82815a1 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 _0x44e8=['show','post','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x3a07d4,_0xa80b88){var _0x2c352=function(_0x27926b){while(--_0x27926b){_0x3a07d4['push'](_0x3a07d4['shift']());}};_0x2c352(++_0xa80b88);}(_0x44e8,0xd7));var _0x844e=function(_0xe776f5,_0x19f716){_0xe776f5=_0xe776f5-0x0;var _0xec20b3=_0x44e8[_0xe776f5];return _0xec20b3;};'use strict';var multer=require(_0x844e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x844e('0x1'));var express=require(_0x844e('0x2'));var router=express[_0x844e('0x3')]();var fs_extra=require(_0x844e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var controller=require(_0x844e('0x7'));router[_0x844e('0x8')]('/',auth['isAuthenticated'](),controller[_0x844e('0x9')]);router[_0x844e('0x8')](_0x844e('0xa'),auth[_0x844e('0xb')](),controller['describe']);router[_0x844e('0x8')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller[_0x844e('0xd')]);router[_0x844e('0xe')]('/',auth[_0x844e('0xb')](),controller['create']);router[_0x844e('0xf')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller[_0x844e('0x10')]);router[_0x844e('0x11')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller['destroy']);module[_0x844e('0x12')]=router; \ No newline at end of file +var _0x2d17=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','post','create','put','/:id','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d17,0x17e));var _0x72d1=function(_0x19698d,_0x116676){_0x19698d=_0x19698d-0x0;var _0xee6db7=_0x2d17[_0x19698d];return _0xee6db7;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var fs_extra=require(_0x72d1('0x4'));var auth=require(_0x72d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72d1('0x6'));var controller=require('./voiceCallReport.controller');router[_0x72d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x72d1('0x8')]);router[_0x72d1('0x7')]('/describe',auth[_0x72d1('0x9')](),controller[_0x72d1('0xa')]);router[_0x72d1('0x7')]('/:id',auth[_0x72d1('0x9')](),controller[_0x72d1('0xb')]);router[_0x72d1('0xc')]('/',auth['isAuthenticated'](),controller[_0x72d1('0xd')]);router[_0x72d1('0xe')](_0x72d1('0xf'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x10')]);router[_0x72d1('0x11')](_0x72d1('0xf'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x12')]);module[_0x72d1('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 c5e1522..fd3cd51 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 _0x46ec=['inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize','ENUM','inbound','internal','outbound'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x46ec,0x145));var _0xc46e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x46ec[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc46e('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc46e('0x1')](_0xc46e('0x2'),_0xc46e('0x3'),_0xc46e('0x4'),_0xc46e('0x5'),_0xc46e('0x6'),'dialer')},'tag':{'type':Sequelize[_0xc46e('0x7')]},'accountcode':{'type':Sequelize[_0xc46e('0x7')]},'source':{'type':Sequelize[_0xc46e('0x7')]},'destination':{'type':Sequelize[_0xc46e('0x7')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc46e('0x7')]},'channel':{'type':Sequelize[_0xc46e('0x7')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc46e('0x8')]},'starttime':{'type':Sequelize[_0xc46e('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xc46e('0x9')]},'endtime':{'type':Sequelize[_0xc46e('0x9')]},'duration':{'type':Sequelize[_0xc46e('0xa')]},'billableseconds':{'type':Sequelize[_0xc46e('0xa')]},'mohtime':{'type':Sequelize[_0xc46e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc46e('0x7')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xc46e('0x7')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xc46e('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc46e('0x7')]},'prefix':{'type':Sequelize[_0xc46e('0x7')]},'routeid':{'type':Sequelize[_0xc46e('0xa')]},'sipcallid':{'type':Sequelize[_0xc46e('0x7')]}}; \ No newline at end of file +var _0x46c2=['ENUM','inbound','internal','outbound','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x2ad56d,_0x9322e3){var _0x3da082=function(_0x4fc813){while(--_0x4fc813){_0x2ad56d['push'](_0x2ad56d['shift']());}};_0x3da082(++_0x9322e3);}(_0x46c2,0x180));var _0x246c=function(_0x372ab6,_0x1b9e57){_0x372ab6=_0x372ab6-0x0;var _0x14b88f=_0x46c2[_0x372ab6];return _0x14b88f;};'use strict';var Sequelize=require(_0x246c('0x0'));module[_0x246c('0x1')]={'uniqueid':{'type':Sequelize[_0x246c('0x2')]},'type':{'type':Sequelize[_0x246c('0x3')](_0x246c('0x4'),_0x246c('0x5'),_0x246c('0x6'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x246c('0x2')]},'destination':{'type':Sequelize[_0x246c('0x2')]},'destinationcontext':{'type':Sequelize[_0x246c('0x2')]},'callerid':{'type':Sequelize[_0x246c('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x246c('0x2')]},'lastapplication':{'type':Sequelize[_0x246c('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x246c('0x7')]},'systemanswertime':{'type':Sequelize[_0x246c('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x246c('0x2')]},'userfield':{'type':Sequelize[_0x246c('0x2')]},'userDisposition':{'type':Sequelize[_0x246c('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x246c('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x246c('0x2')]},'routeid':{'type':Sequelize[_0x246c('0x8')]},'sipcallid':{'type':Sequelize[_0x246c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 19e41ee..aa726fe 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x466a7a,_0x5792bd){_0x466a7a=_0x466a7a-0x0;var _0x31792e=_0x2032[_0x466a7a];return _0x31792e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _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(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0xadb5,0xad));var _0x5adb=function(_0x2f9b0d,_0x2dd212){_0x2f9b0d=_0x2f9b0d-0x0;var _0x323b49=_0xadb5[_0x2f9b0d];return _0x323b49;};'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 f8be2ba..cb103ca 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 _0x71e4=['report_call','uniqueid','lodash','api','moment','request-promise','rimraf','../../config/environment','exports','define','VoiceCallReport'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x71e4,0x65));var _0x471e=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x71e4[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0x471e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x471e('0x1'));var moment=require(_0x471e('0x2'));var BPromise=require('bluebird');var rp=require(_0x471e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x471e('0x4'));var config=require(_0x471e('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0x471e('0x6')]=function(_0x4d77c4,_0x3bab79){return _0x4d77c4[_0x471e('0x7')](_0x471e('0x8'),attributes,{'tableName':_0x471e('0x9'),'paranoid':![],'indexes':[{'fields':[_0x471e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x65fd=['api','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger'];(function(_0x5c6d95,_0x2b311f){var _0x2ecb56=function(_0x45e9d7){while(--_0x45e9d7){_0x5c6d95['push'](_0x5c6d95['shift']());}};_0x2ecb56(++_0x2b311f);}(_0x65fd,0x185));var _0xd65f=function(_0xbbd43e,_0xd974b7){_0xbbd43e=_0xbbd43e-0x0;var _0x5bb007=_0x65fd[_0xbbd43e];return _0x5bb007;};'use strict';var _=require(_0xd65f('0x0'));var util=require(_0xd65f('0x1'));var logger=require(_0xd65f('0x2'))(_0xd65f('0x3'));var moment=require('moment');var BPromise=require(_0xd65f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd65f('0x5'));var rimraf=require(_0xd65f('0x6'));var config=require(_0xd65f('0x7'));var attributes=require(_0xd65f('0x8'));module[_0xd65f('0x9')]=function(_0x4ae3ad,_0x5f1ce8){return _0x4ae3ad[_0xd65f('0xa')](_0xd65f('0xb'),attributes,{'tableName':_0xd65f('0xc'),'paranoid':![],'indexes':[{'fields':[_0xd65f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5b5ab99..f755334 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 _0xe0bc=['CreateVoiceCallReport','create','body','then','UpdateVoiceCallReport','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model'];(function(_0x1f4656,_0x201b59){var _0x35e26e=function(_0x44b72e){while(--_0x44b72e){_0x1f4656['push'](_0x1f4656['shift']());}};_0x35e26e(++_0x201b59);}(_0xe0bc,0x141));var _0xce0b=function(_0x1d4c41,_0x376e14){_0x1d4c41=_0x1d4c41-0x0;var _0x4c4243=_0xe0bc[_0x1d4c41];return _0x4c4243;};'use strict';var _=require(_0xce0b('0x0'));var util=require(_0xce0b('0x1'));var moment=require('moment');var BPromise=require(_0xce0b('0x2'));var rs=require(_0xce0b('0x3'));var fs=require('fs');var Redis=require(_0xce0b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce0b('0x5'))('rpc');var config=require(_0xce0b('0x6'));var jayson=require(_0xce0b('0x7'));var client=jayson[_0xce0b('0x8')][_0xce0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x188e29,_0x47a5cc,_0xa08fdd){return new BPromise(function(_0x2f8a01,_0x322b78){return client[_0xce0b('0xa')](_0x188e29,_0xa08fdd)['then'](function(_0x18e115){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x47a5cc,_0xce0b('0xb'));logger[_0xce0b('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x47a5cc,_0xce0b('0xb'),JSON['stringify'](_0x18e115));if(_0x18e115[_0xce0b('0xd')]){if(_0x18e115[_0xce0b('0xd')][_0xce0b('0xe')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x47a5cc,_0x18e115[_0xce0b('0xd')][_0xce0b('0xf')]);return _0x322b78(_0x18e115[_0xce0b('0xd')]['message']);}logger[_0xce0b('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x47a5cc,_0x18e115[_0xce0b('0xd')][_0xce0b('0xf')]);return _0x2f8a01(_0x18e115[_0xce0b('0xd')][_0xce0b('0xf')]);}else{logger[_0xce0b('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x47a5cc,_0xce0b('0xb'));_0x2f8a01(_0x18e115[_0xce0b('0x11')][_0xce0b('0xf')]);}})[_0xce0b('0x12')](function(_0xc5836f){logger[_0xce0b('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x47a5cc,_0xc5836f);_0x322b78(_0xc5836f);});});}exports[_0xce0b('0x13')]=function(_0x4e872b){var _0x748b07=this;return new Promise(function(_0x48df4c,_0x5eb21f){return db[_0xce0b('0x14')]['findAll']({'raw':_0x4e872b[_0xce0b('0x15')]?_0x4e872b[_0xce0b('0x15')][_0xce0b('0x16')]===undefined?!![]:![]:!![],'where':_0x4e872b[_0xce0b('0x15')]?_0x4e872b[_0xce0b('0x15')][_0xce0b('0x17')]||null:null,'attributes':_0x4e872b[_0xce0b('0x15')]?_0x4e872b[_0xce0b('0x15')][_0xce0b('0x18')]||null:null,'limit':_0x4e872b[_0xce0b('0x15')]?_0x4e872b[_0xce0b('0x15')][_0xce0b('0x19')]||null:null,'include':_0x4e872b['options']?_0x4e872b['options'][_0xce0b('0x1a')]?_[_0xce0b('0x1b')](_0x4e872b[_0xce0b('0x15')][_0xce0b('0x1a')],function(_0x32767b){return{'model':db[_0x32767b[_0xce0b('0x1c')]],'as':_0x32767b['as'],'attributes':_0x32767b[_0xce0b('0x18')],'include':_0x32767b[_0xce0b('0x1a')]?_['map'](_0x32767b[_0xce0b('0x1a')],function(_0xce2073){return{'model':db[_0xce2073['model']],'as':_0xce2073['as'],'attributes':_0xce2073['attributes'],'include':_0xce2073[_0xce0b('0x1a')]?_[_0xce0b('0x1b')](_0xce2073[_0xce0b('0x1a')],function(_0x2a798b){return{'model':db[_0x2a798b[_0xce0b('0x1c')]],'as':_0x2a798b['as'],'attributes':_0x2a798b[_0xce0b('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x64592){logger[_0xce0b('0x10')]('GetVoiceCallReport',_0x4e872b);logger[_0xce0b('0xc')](_0xce0b('0x13'),_0x4e872b,JSON['stringify'](_0x64592));_0x48df4c(_0x64592);})[_0xce0b('0x12')](function(_0x28d5ed){logger['error']('GetVoiceCallReport',_0x28d5ed[_0xce0b('0xf')],_0x4e872b);_0x5eb21f(_0x748b07[_0xce0b('0xd')](0x1f4,_0x28d5ed[_0xce0b('0xf')]));});});};exports[_0xce0b('0x1d')]=function(_0x44d31c){var _0x1f4ce2=this;return new Promise(function(_0x52933f,_0x42486d){return db[_0xce0b('0x14')][_0xce0b('0x1e')](_0x44d31c[_0xce0b('0x1f')],{'raw':_0x44d31c[_0xce0b('0x15')]?_0x44d31c['options'][_0xce0b('0x16')]===undefined?!![]:![]:!![]})[_0xce0b('0x20')](function(_0x277ad6){logger[_0xce0b('0x10')]('CreateVoiceCallReport',_0x44d31c);logger[_0xce0b('0xc')](_0xce0b('0x1d'),_0x44d31c,JSON['stringify'](_0x277ad6));_0x52933f(_0x277ad6);})[_0xce0b('0x12')](function(_0x47186a){logger[_0xce0b('0xd')](_0xce0b('0x1d'),_0x47186a[_0xce0b('0xf')],_0x44d31c);_0x42486d(_0x1f4ce2[_0xce0b('0xd')](0x1f4,_0x47186a['message']));});});};exports[_0xce0b('0x21')]=function(_0x89cab9){var _0xb554cf=this;return new Promise(function(_0x15bb51,_0x5421a2){return db[_0xce0b('0x14')]['update'](_0x89cab9[_0xce0b('0x1f')],{'raw':_0x89cab9[_0xce0b('0x15')]?_0x89cab9[_0xce0b('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x89cab9[_0xce0b('0x15')]?_0x89cab9[_0xce0b('0x15')][_0xce0b('0x17')]||null:null,'attributes':_0x89cab9[_0xce0b('0x15')]?_0x89cab9[_0xce0b('0x15')][_0xce0b('0x18')]||null:null,'limit':_0x89cab9[_0xce0b('0x15')]?_0x89cab9['options'][_0xce0b('0x19')]||null:null})[_0xce0b('0x20')](function(_0x5af211){logger['info']('UpdateVoiceCallReport',_0x89cab9);logger[_0xce0b('0xc')](_0xce0b('0x21'),_0x89cab9,JSON[_0xce0b('0x22')](_0x5af211));_0x15bb51(_0x5af211);})[_0xce0b('0x12')](function(_0x54a881){logger['error'](_0xce0b('0x21'),_0x54a881[_0xce0b('0xf')],_0x89cab9);_0x5421a2(_0xb554cf[_0xce0b('0xd')](0x1f4,_0x54a881[_0xce0b('0xf')]));});});}; \ No newline at end of file +var _0xb248=['request\x20sent','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','map','include','model','then','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','limit','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message'];(function(_0x26f045,_0x265039){var _0x4d0603=function(_0x10ab3e){while(--_0x10ab3e){_0x26f045['push'](_0x26f045['shift']());}};_0x4d0603(++_0x265039);}(_0xb248,0x1db));var _0x8b24=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xb248[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x8b24('0x0'));var util=require('util');var moment=require(_0x8b24('0x1'));var BPromise=require(_0x8b24('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b24('0x3'))['db'];var utils=require(_0x8b24('0x4'));var logger=require(_0x8b24('0x5'))(_0x8b24('0x6'));var config=require(_0x8b24('0x7'));var jayson=require(_0x8b24('0x8'));var client=jayson[_0x8b24('0x9')][_0x8b24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4327e1,_0x77a20a,_0x1e613b){return new BPromise(function(_0x2b190d,_0x129880){return client['request'](_0x4327e1,_0x1e613b)['then'](function(_0x55b41b){logger[_0x8b24('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x77a20a,'request\x20sent');logger[_0x8b24('0xc')](_0x8b24('0xd'),_0x77a20a,'request\x20sent',JSON[_0x8b24('0xe')](_0x55b41b));if(_0x55b41b[_0x8b24('0xf')]){if(_0x55b41b['error'][_0x8b24('0x10')]===0x1f4){logger[_0x8b24('0xf')](_0x8b24('0x11'),_0x77a20a,_0x55b41b[_0x8b24('0xf')][_0x8b24('0x12')]);return _0x129880(_0x55b41b[_0x8b24('0xf')][_0x8b24('0x12')]);}logger[_0x8b24('0xf')](_0x8b24('0x11'),_0x77a20a,_0x55b41b[_0x8b24('0xf')]['message']);return _0x2b190d(_0x55b41b[_0x8b24('0xf')]['message']);}else{logger[_0x8b24('0xb')](_0x8b24('0x11'),_0x77a20a,_0x8b24('0x13'));_0x2b190d(_0x55b41b['result'][_0x8b24('0x12')]);}})[_0x8b24('0x14')](function(_0x458fea){logger[_0x8b24('0xf')](_0x8b24('0x11'),_0x77a20a,_0x458fea);_0x129880(_0x458fea);});});}exports[_0x8b24('0x15')]=function(_0x3fed1b){var _0x2eaec4=this;return new Promise(function(_0x15ccd6,_0xc4cb1f){return db[_0x8b24('0x16')][_0x8b24('0x17')]({'raw':_0x3fed1b[_0x8b24('0x18')]?_0x3fed1b['options'][_0x8b24('0x19')]===undefined?!![]:![]:!![],'where':_0x3fed1b[_0x8b24('0x18')]?_0x3fed1b[_0x8b24('0x18')][_0x8b24('0x1a')]||null:null,'attributes':_0x3fed1b[_0x8b24('0x18')]?_0x3fed1b[_0x8b24('0x18')][_0x8b24('0x1b')]||null:null,'limit':_0x3fed1b[_0x8b24('0x18')]?_0x3fed1b[_0x8b24('0x18')]['limit']||null:null,'include':_0x3fed1b[_0x8b24('0x18')]?_0x3fed1b[_0x8b24('0x18')]['include']?_[_0x8b24('0x1c')](_0x3fed1b['options'][_0x8b24('0x1d')],function(_0x42caac){return{'model':db[_0x42caac[_0x8b24('0x1e')]],'as':_0x42caac['as'],'attributes':_0x42caac['attributes'],'include':_0x42caac[_0x8b24('0x1d')]?_['map'](_0x42caac['include'],function(_0x1dc806){return{'model':db[_0x1dc806[_0x8b24('0x1e')]],'as':_0x1dc806['as'],'attributes':_0x1dc806['attributes'],'include':_0x1dc806[_0x8b24('0x1d')]?_['map'](_0x1dc806['include'],function(_0x41df96){return{'model':db[_0x41df96[_0x8b24('0x1e')]],'as':_0x41df96['as'],'attributes':_0x41df96[_0x8b24('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8b24('0x1f')](function(_0x1be526){logger['info'](_0x8b24('0x15'),_0x3fed1b);logger[_0x8b24('0xc')](_0x8b24('0x15'),_0x3fed1b,JSON[_0x8b24('0xe')](_0x1be526));_0x15ccd6(_0x1be526);})[_0x8b24('0x14')](function(_0x1fcb7f){logger[_0x8b24('0xf')](_0x8b24('0x15'),_0x1fcb7f[_0x8b24('0x12')],_0x3fed1b);_0xc4cb1f(_0x2eaec4['error'](0x1f4,_0x1fcb7f[_0x8b24('0x12')]));});});};exports[_0x8b24('0x20')]=function(_0x5c4607){var _0x1690f9=this;return new Promise(function(_0x228d2f,_0x3b84e2){return db['VoiceCallReport'][_0x8b24('0x21')](_0x5c4607[_0x8b24('0x22')],{'raw':_0x5c4607[_0x8b24('0x18')]?_0x5c4607['options'][_0x8b24('0x19')]===undefined?!![]:![]:!![]})[_0x8b24('0x1f')](function(_0x40a64d){logger['info'](_0x8b24('0x20'),_0x5c4607);logger[_0x8b24('0xc')](_0x8b24('0x20'),_0x5c4607,JSON[_0x8b24('0xe')](_0x40a64d));_0x228d2f(_0x40a64d);})[_0x8b24('0x14')](function(_0x2b4240){logger[_0x8b24('0xf')]('CreateVoiceCallReport',_0x2b4240[_0x8b24('0x12')],_0x5c4607);_0x3b84e2(_0x1690f9[_0x8b24('0xf')](0x1f4,_0x2b4240[_0x8b24('0x12')]));});});};exports[_0x8b24('0x23')]=function(_0x1812b7){var _0x42991a=this;return new Promise(function(_0x48d7ae,_0x93aa41){return db[_0x8b24('0x16')][_0x8b24('0x24')](_0x1812b7[_0x8b24('0x22')],{'raw':_0x1812b7['options']?_0x1812b7[_0x8b24('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1812b7[_0x8b24('0x18')]?_0x1812b7[_0x8b24('0x18')][_0x8b24('0x1a')]||null:null,'attributes':_0x1812b7['options']?_0x1812b7[_0x8b24('0x18')][_0x8b24('0x1b')]||null:null,'limit':_0x1812b7[_0x8b24('0x18')]?_0x1812b7['options'][_0x8b24('0x25')]||null:null})[_0x8b24('0x1f')](function(_0xb65363){logger['info'](_0x8b24('0x23'),_0x1812b7);logger['debug']('UpdateVoiceCallReport',_0x1812b7,JSON[_0x8b24('0xe')](_0xb65363));_0x48d7ae(_0xb65363);})[_0x8b24('0x14')](function(_0x1cd748){logger[_0x8b24('0xf')](_0x8b24('0x23'),_0x1cd748[_0x8b24('0x12')],_0x1812b7);_0x93aa41(_0x42991a['error'](0x1f4,_0x1cd748[_0x8b24('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 79ef5cb..1694477 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 _0xf089=['/:id','show','create','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x5b40ab,_0x15ec5e){var _0x5baa84=function(_0x2edde7){while(--_0x2edde7){_0x5b40ab['push'](_0x5b40ab['shift']());}};_0x5baa84(++_0x15ec5e);}(_0xf089,0x105));var _0x9f08=function(_0x3f9929,_0x3f49e6){_0x3f9929=_0x3f9929-0x0;var _0x207410=_0xf089[_0x3f9929];return _0x207410;};'use strict';var multer=require(_0x9f08('0x0'));var util=require(_0x9f08('0x1'));var path=require(_0x9f08('0x2'));var timeout=require(_0x9f08('0x3'));var express=require('express');var router=express[_0x9f08('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9f08('0x5'));var interaction=require(_0x9f08('0x6'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x9f08('0x7')]('/',auth[_0x9f08('0x8')](),controller['index']);router[_0x9f08('0x7')](_0x9f08('0x9'),auth[_0x9f08('0x8')](),controller[_0x9f08('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9f08('0xb')]);router[_0x9f08('0xc')]('/:id',auth[_0x9f08('0x8')](),controller['update']);router[_0x9f08('0xd')](_0x9f08('0x9'),auth[_0x9f08('0x8')](),controller[_0x9f08('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5b73=['index','/:id','show','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated'];(function(_0x1f2384,_0x1ff547){var _0x4976d0=function(_0x5583e8){while(--_0x5583e8){_0x1f2384['push'](_0x1f2384['shift']());}};_0x4976d0(++_0x1ff547);}(_0x5b73,0x1cb));var _0x35b7=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x5b73[_0x378720];return _0x47920a;};'use strict';var multer=require(_0x35b7('0x0'));var util=require('util');var path=require(_0x35b7('0x1'));var timeout=require('connect-timeout');var express=require(_0x35b7('0x2'));var router=express[_0x35b7('0x3')]();var fs_extra=require(_0x35b7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x35b7('0x5'));var controller=require(_0x35b7('0x6'));router[_0x35b7('0x7')]('/',auth[_0x35b7('0x8')](),controller[_0x35b7('0x9')]);router['get'](_0x35b7('0xa'),auth[_0x35b7('0x8')](),controller[_0x35b7('0xb')]);router[_0x35b7('0xc')]('/',auth[_0x35b7('0x8')](),controller['create']);router[_0x35b7('0xd')](_0x35b7('0xa'),auth['isAuthenticated'](),controller[_0x35b7('0xe')]);router[_0x35b7('0xf')](_0x35b7('0xa'),auth[_0x35b7('0x8')](),controller[_0x35b7('0x10')]);module[_0x35b7('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 23c0ecb..ed52769 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 _0xd934=['options','getDataValue','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x43f552,_0x42808c){var _0x17911b=function(_0x4407a7){while(--_0x4407a7){_0x43f552['push'](_0x43f552['shift']());}};_0x17911b(++_0x42808c);}(_0xd934,0x16f));var _0x4d93=function(_0x30e61c,_0x20c167){_0x30e61c=_0x30e61c-0x0;var _0x4e894c=_0xd934[_0x30e61c];return _0x4e894c;};'use strict';var Sequelize=require(_0x4d93('0x0'));module[_0x4d93('0x1')]={'name':{'type':Sequelize[_0x4d93('0x2')]},'prefix':{'type':Sequelize[_0x4d93('0x2')],'unique':_0x4d93('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x4d93('0x2')],'set':function(_0xbfc66d){this['setDataValue'](_0x4d93('0x4'),_0xbfc66d?_0xbfc66d['join'](''):[]);},'get':function(){return this[_0x4d93('0x5')](_0x4d93('0x4'))?this['getDataValue'](_0x4d93('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x4d93('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x4d93('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4d93('0x2')]},'description':{'type':Sequelize[_0x4d93('0x2')]}}; \ No newline at end of file +var _0xbac7=['join','getDataValue','BOOLEAN','exports','STRING','name','options'];(function(_0x57183a,_0x1ff933){var _0x3bbd53=function(_0x2f60ba){while(--_0x2f60ba){_0x57183a['push'](_0x57183a['shift']());}};_0x3bbd53(++_0x1ff933);}(_0xbac7,0x145));var _0x7bac=function(_0x3bf815,_0x4eeb9f){_0x3bf815=_0x3bf815-0x0;var _0x3989a6=_0xbac7[_0x3bf815];return _0x3989a6;};'use strict';var Sequelize=require('sequelize');module[_0x7bac('0x0')]={'name':{'type':Sequelize[_0x7bac('0x1')]},'prefix':{'type':Sequelize[_0x7bac('0x1')],'unique':_0x7bac('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x7bac('0x1')],'set':function(_0x20a461){this['setDataValue'](_0x7bac('0x3'),_0x20a461?_0x20a461[_0x7bac('0x4')](''):[]);},'get':function(){return this[_0x7bac('0x5')](_0x7bac('0x3'))?this[_0x7bac('0x5')](_0x7bac('0x3'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x7bac('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7bac('0x1')]},'description':{'type':Sequelize[_0x7bac('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2bd556d..168486b 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 _0xb11e=['limit','count','then','destroy','ChanSpies','UserProfileResource','sendStatus','error','name','send','index','VoiceChanSpy','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','find','catch','create','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xb11e,0x7d));var _0xeb11=function(_0x104992,_0x18603b){_0x104992=_0x104992-0x0;var _0x466de6=_0xb11e[_0x104992];return _0x466de6;};'use strict';var emlformat=require(_0xeb11('0x0'));var rimraf=require(_0xeb11('0x1'));var zipdir=require(_0xeb11('0x2'));var jsonpatch=require(_0xeb11('0x3'));var rp=require(_0xeb11('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb11('0x5'));var util=require(_0xeb11('0x6'));var path=require(_0xeb11('0x7'));var sox=require(_0xeb11('0x8'));var csv=require('to-csv');var ejs=require(_0xeb11('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb11('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeb11('0xb'));var toCsv=require(_0xeb11('0xc'));var querystring=require(_0xeb11('0xd'));var Papa=require('papaparse');var Redis=require(_0xeb11('0xe'));var authService=require(_0xeb11('0xf'));var qs=require(_0xeb11('0x10'));var as=require(_0xeb11('0x11'));var hardwareService=require(_0xeb11('0x12'));var logger=require(_0xeb11('0x13'))(_0xeb11('0x14'));var utils=require(_0xeb11('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeb11('0x16'));var db=require(_0xeb11('0x17'))['db'];function respondWithStatusCode(_0x15b1e4,_0x517962){_0x517962=_0x517962||0xcc;return function(_0x44b192){if(_0x44b192){return _0x15b1e4['sendStatus'](_0x517962);}return _0x15b1e4[_0xeb11('0x18')](_0x517962)['end']();};}function respondWithResult(_0x5d183d,_0x146cfa){_0x146cfa=_0x146cfa||0xc8;return function(_0x2e0d2c){if(_0x2e0d2c){return _0x5d183d[_0xeb11('0x18')](_0x146cfa)[_0xeb11('0x19')](_0x2e0d2c);}};}function respondWithFilteredResult(_0x4c6a67,_0x58d276){return function(_0x200730){if(_0x200730){var _0xd1a9bf=typeof _0x58d276[_0xeb11('0x1a')]==='undefined'&&typeof _0x58d276[_0xeb11('0x1b')]==='undefined';var _0x33a996=_0x200730[_0xeb11('0x1c')];var _0x139ff8=_0xd1a9bf?0x0:_0x58d276['offset'];var _0xf36770=_0xd1a9bf?_0x200730[_0xeb11('0x1c')]:_0x58d276['offset']+_0x58d276['limit'];var _0x1906db;if(_0xf36770>=_0x33a996){_0xf36770=_0x33a996;_0x1906db=0xc8;}else{_0x1906db=0xce;}_0x4c6a67[_0xeb11('0x18')](_0x1906db);return _0x4c6a67['set']('Content-Range',_0x139ff8+'-'+_0xf36770+'/'+_0x33a996)[_0xeb11('0x19')](_0x200730);}return null;};}function patchUpdates(_0xf057c){return function(_0x4dfe03){try{jsonpatch['apply'](_0x4dfe03,_0xf057c,!![]);}catch(_0x17af28){return BPromise['reject'](_0x17af28);}return _0x4dfe03['save']();};}function saveUpdates(_0x5779df,_0xeeb427){return function(_0x1caf4f){if(_0x1caf4f){return _0x1caf4f['update'](_0x5779df)[_0xeb11('0x1d')](function(_0x40a4cb){return _0x40a4cb;});}return null;};}function removeEntity(_0x53e48d,_0x1c526d){return function(_0x3b2e1a){if(_0x3b2e1a){return _0x3b2e1a[_0xeb11('0x1e')]()['then'](function(){var _0x640c79=_0x3b2e1a['get']({'plain':!![]});var _0x5b97b5=_0xeb11('0x1f');return db[_0xeb11('0x20')][_0xeb11('0x1e')]({'where':{'type':_0x5b97b5,'resourceId':_0x640c79['id']}})['then'](function(){return _0x3b2e1a;});})['then'](function(){_0x53e48d[_0xeb11('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39c0da,_0x45eeba){return function(_0x377abf){if(!_0x377abf){_0x39c0da[_0xeb11('0x21')](0x194);}return _0x377abf;};}function handleError(_0x289121,_0x4a0501){_0x4a0501=_0x4a0501||0x1f4;return function(_0x1d9bf7){logger[_0xeb11('0x22')](_0x1d9bf7['stack']);if(_0x1d9bf7[_0xeb11('0x23')]){delete _0x1d9bf7['name'];}_0x289121[_0xeb11('0x18')](_0x4a0501)[_0xeb11('0x24')](_0x1d9bf7);};}exports[_0xeb11('0x25')]=function(_0x6adeaa,_0x22e3d2){var _0x80f0d9={},_0x26ca49={},_0x2b7f14={'count':0x0,'rows':[]};var _0x322797=_['map'](db[_0xeb11('0x26')]['rawAttributes'],function(_0x10089d){return{'name':_0x10089d[_0xeb11('0x27')],'type':_0x10089d[_0xeb11('0x28')]['key']};});_0x26ca49['model']=_[_0xeb11('0x29')](_0x322797,_0xeb11('0x23'));_0x26ca49[_0xeb11('0x2a')]=_[_0xeb11('0x2b')](_0x6adeaa['query']);_0x26ca49[_0xeb11('0x2c')]=_[_0xeb11('0x2d')](_0x26ca49[_0xeb11('0x2e')],_0x26ca49['query']);_0x80f0d9[_0xeb11('0x2f')]=_['intersection'](_0x26ca49[_0xeb11('0x2e')],qs['fields'](_0x6adeaa[_0xeb11('0x2a')][_0xeb11('0x30')]));_0x80f0d9[_0xeb11('0x2f')]=_0x80f0d9[_0xeb11('0x2f')][_0xeb11('0x31')]?_0x80f0d9[_0xeb11('0x2f')]:_0x26ca49[_0xeb11('0x2e')];if(!_0x6adeaa['query'][_0xeb11('0x32')]('nolimit')){_0x80f0d9[_0xeb11('0x1b')]=qs['limit'](_0x6adeaa[_0xeb11('0x2a')][_0xeb11('0x1b')]);_0x80f0d9[_0xeb11('0x1a')]=qs[_0xeb11('0x1a')](_0x6adeaa['query'][_0xeb11('0x1a')]);}_0x80f0d9[_0xeb11('0x33')]=qs[_0xeb11('0x34')](_0x6adeaa[_0xeb11('0x2a')][_0xeb11('0x34')]);_0x80f0d9[_0xeb11('0x35')]=qs[_0xeb11('0x2c')](_[_0xeb11('0x36')](_0x6adeaa[_0xeb11('0x2a')],_0x26ca49[_0xeb11('0x2c')]),_0x322797);if(_0x6adeaa[_0xeb11('0x2a')][_0xeb11('0x37')]){_0x80f0d9[_0xeb11('0x35')]=_[_0xeb11('0x38')](_0x80f0d9[_0xeb11('0x35')],{'$or':_['map'](_0x322797,function(_0x16637b){if(_0x16637b['type']!==_0xeb11('0x39')){var _0xcdf358={};_0xcdf358[_0x16637b['name']]={'$like':'%'+_0x6adeaa['query'][_0xeb11('0x37')]+'%'};return _0xcdf358;}})});}_0x80f0d9=_[_0xeb11('0x38')]({},_0x80f0d9,_0x6adeaa[_0xeb11('0x3a')]);var _0x211ead={'where':_0x80f0d9['where']};return db[_0xeb11('0x26')][_0xeb11('0x1c')](_0x211ead)[_0xeb11('0x1d')](function(_0xffa000){_0x2b7f14['count']=_0xffa000;if(_0x6adeaa['query'][_0xeb11('0x3b')]){_0x80f0d9['include']=[{'all':!![]}];}return db[_0xeb11('0x26')][_0xeb11('0x3c')](_0x80f0d9);})[_0xeb11('0x1d')](function(_0xdf32e7){_0x2b7f14[_0xeb11('0x3d')]=_0xdf32e7;return _0x2b7f14;})[_0xeb11('0x1d')](respondWithFilteredResult(_0x22e3d2,_0x80f0d9))['catch'](handleError(_0x22e3d2,null));};exports['show']=function(_0x9a9daa,_0x1fd33c){var _0x28f8b4={'raw':![],'where':{'id':_0x9a9daa[_0xeb11('0x3e')]['id']}},_0x54023c={};_0x54023c[_0xeb11('0x2e')]=_[_0xeb11('0x2b')](db[_0xeb11('0x26')][_0xeb11('0x3f')]);_0x54023c['query']=_['keys'](_0x9a9daa[_0xeb11('0x2a')]);_0x54023c['filters']=_[_0xeb11('0x2d')](_0x54023c[_0xeb11('0x2e')],_0x54023c[_0xeb11('0x2a')]);_0x28f8b4[_0xeb11('0x2f')]=_[_0xeb11('0x2d')](_0x54023c[_0xeb11('0x2e')],qs['fields'](_0x9a9daa[_0xeb11('0x2a')][_0xeb11('0x30')]));_0x28f8b4[_0xeb11('0x2f')]=_0x28f8b4[_0xeb11('0x2f')][_0xeb11('0x31')]?_0x28f8b4['attributes']:_0x54023c[_0xeb11('0x2e')];if(_0x9a9daa[_0xeb11('0x2a')]['includeAll']){_0x28f8b4[_0xeb11('0x40')]=[{'all':!![]}];}_0x28f8b4=_[_0xeb11('0x38')]({},_0x28f8b4,_0x9a9daa[_0xeb11('0x3a')]);return db[_0xeb11('0x26')][_0xeb11('0x41')](_0x28f8b4)['then'](handleEntityNotFound(_0x1fd33c,null))['then'](respondWithResult(_0x1fd33c,null))[_0xeb11('0x42')](handleError(_0x1fd33c,null));};exports['create']=function(_0x355251,_0x2307ff){return db[_0xeb11('0x26')][_0xeb11('0x43')](_0x355251['body'],{})[_0xeb11('0x1d')](function(_0x12c628){var _0xdc38a1=_0x355251[_0xeb11('0x44')][_0xeb11('0x45')]({'plain':!![]});if(!_0xdc38a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xdc38a1['role']==='user'){var _0x315f87=_0x12c628[_0xeb11('0x45')]({'plain':!![]});var _0x49cfac='ChanSpies';return db[_0xeb11('0x46')]['find']({'where':{'name':_0x49cfac,'userProfileId':_0xdc38a1[_0xeb11('0x47')]},'raw':!![]})[_0xeb11('0x1d')](function(_0x362909){if(_0x362909&&_0x362909[_0xeb11('0x48')]===0x0){return db[_0xeb11('0x20')][_0xeb11('0x43')]({'name':_0x315f87[_0xeb11('0x23')],'resourceId':_0x315f87['id'],'type':_0x362909[_0xeb11('0x23')],'sectionId':_0x362909['id']},{})[_0xeb11('0x1d')](function(){return _0x12c628;});}else{return _0x12c628;}})[_0xeb11('0x42')](function(_0x3a4543){logger[_0xeb11('0x22')](_0xeb11('0x49'),_0x3a4543);throw _0x3a4543;});}return _0x12c628;})[_0xeb11('0x1d')](respondWithResult(_0x2307ff,0xc9))[_0xeb11('0x42')](handleError(_0x2307ff,null));};exports[_0xeb11('0x4a')]=function(_0x6ec5de,_0x45f413){if(_0x6ec5de['body']['id']){delete _0x6ec5de[_0xeb11('0x4b')]['id'];}return db[_0xeb11('0x26')][_0xeb11('0x41')]({'where':{'id':_0x6ec5de['params']['id']}})[_0xeb11('0x1d')](handleEntityNotFound(_0x45f413,null))[_0xeb11('0x1d')](saveUpdates(_0x6ec5de[_0xeb11('0x4b')],null))[_0xeb11('0x1d')](respondWithResult(_0x45f413,null))['catch'](handleError(_0x45f413,null));};exports[_0xeb11('0x1e')]=function(_0x6813d2,_0x1d769d){return db['VoiceChanSpy']['find']({'where':{'id':_0x6813d2[_0xeb11('0x3e')]['id']}})[_0xeb11('0x1d')](handleEntityNotFound(_0x1d769d,null))[_0xeb11('0x1d')](removeEntity(_0x1d769d,null))['catch'](handleError(_0x1d769d,null));}; \ No newline at end of file +var _0xab26=['stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error'];(function(_0x575a38,_0x2e83d7){var _0x5a7bdd=function(_0x1bf478){while(--_0x1bf478){_0x575a38['push'](_0x575a38['shift']());}};_0x5a7bdd(++_0x2e83d7);}(_0xab26,0xd2));var _0x6ab2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xab26[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x6ab2('0x0'));var rimraf=require(_0x6ab2('0x1'));var zipdir=require(_0x6ab2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6ab2('0x3'));var moment=require(_0x6ab2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ab2('0x5'));var path=require('path');var sox=require(_0x6ab2('0x6'));var csv=require(_0x6ab2('0x7'));var ejs=require(_0x6ab2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ab2('0x9'));var squel=require(_0x6ab2('0xa'));var crypto=require('crypto');var jsforce=require(_0x6ab2('0xb'));var deskjs=require(_0x6ab2('0xc'));var toCsv=require(_0x6ab2('0x7'));var querystring=require(_0x6ab2('0xd'));var Papa=require(_0x6ab2('0xe'));var Redis=require(_0x6ab2('0xf'));var authService=require(_0x6ab2('0x10'));var qs=require(_0x6ab2('0x11'));var as=require(_0x6ab2('0x12'));var hardwareService=require(_0x6ab2('0x13'));var logger=require(_0x6ab2('0x14'))('api');var utils=require(_0x6ab2('0x15'));var config=require(_0x6ab2('0x16'));var licenseUtil=require(_0x6ab2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b6f7c,_0x10c3b1){_0x10c3b1=_0x10c3b1||0xcc;return function(_0x2bb464){if(_0x2bb464){return _0x5b6f7c[_0x6ab2('0x18')](_0x10c3b1);}return _0x5b6f7c[_0x6ab2('0x19')](_0x10c3b1)[_0x6ab2('0x1a')]();};}function respondWithResult(_0x432df4,_0x9f3aea){_0x9f3aea=_0x9f3aea||0xc8;return function(_0x13d31d){if(_0x13d31d){return _0x432df4['status'](_0x9f3aea)[_0x6ab2('0x1b')](_0x13d31d);}};}function respondWithFilteredResult(_0x55d6f4,_0x1bc335){return function(_0x429aba){if(_0x429aba){var _0x5ced24=typeof _0x1bc335['offset']==='undefined'&&typeof _0x1bc335[_0x6ab2('0x1c')]===_0x6ab2('0x1d');var _0x20f437=_0x429aba[_0x6ab2('0x1e')];var _0x272bd0=_0x5ced24?0x0:_0x1bc335[_0x6ab2('0x1f')];var _0x508376=_0x5ced24?_0x429aba[_0x6ab2('0x1e')]:_0x1bc335[_0x6ab2('0x1f')]+_0x1bc335['limit'];var _0x17f6e0;if(_0x508376>=_0x20f437){_0x508376=_0x20f437;_0x17f6e0=0xc8;}else{_0x17f6e0=0xce;}_0x55d6f4['status'](_0x17f6e0);return _0x55d6f4['set'](_0x6ab2('0x20'),_0x272bd0+'-'+_0x508376+'/'+_0x20f437)[_0x6ab2('0x1b')](_0x429aba);}return null;};}function patchUpdates(_0x2ca855){return function(_0x1851bf){try{jsonpatch[_0x6ab2('0x21')](_0x1851bf,_0x2ca855,!![]);}catch(_0x4a2584){return BPromise[_0x6ab2('0x22')](_0x4a2584);}return _0x1851bf[_0x6ab2('0x23')]();};}function saveUpdates(_0x3b7a1a,_0x3fad2b){return function(_0x25fa3f){if(_0x25fa3f){return _0x25fa3f[_0x6ab2('0x24')](_0x3b7a1a)[_0x6ab2('0x25')](function(_0x2b87a0){return _0x2b87a0;});}return null;};}function removeEntity(_0x2784f8,_0x1caf3d){return function(_0x4fd76d){if(_0x4fd76d){return _0x4fd76d['destroy']()['then'](function(){var _0x11e287=_0x4fd76d[_0x6ab2('0x26')]({'plain':!![]});var _0x273aee='ChanSpies';return db[_0x6ab2('0x27')][_0x6ab2('0x28')]({'where':{'type':_0x273aee,'resourceId':_0x11e287['id']}})[_0x6ab2('0x25')](function(){return _0x4fd76d;});})[_0x6ab2('0x25')](function(){_0x2784f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e29c,_0x22085c){return function(_0x5bb6ac){if(!_0x5bb6ac){_0x58e29c['sendStatus'](0x194);}return _0x5bb6ac;};}function handleError(_0xd40bad,_0x2a1833){_0x2a1833=_0x2a1833||0x1f4;return function(_0x161165){logger[_0x6ab2('0x29')](_0x161165[_0x6ab2('0x2a')]);if(_0x161165[_0x6ab2('0x2b')]){delete _0x161165[_0x6ab2('0x2b')];}_0xd40bad[_0x6ab2('0x19')](_0x2a1833)[_0x6ab2('0x2c')](_0x161165);};}exports['index']=function(_0x3c80ed,_0xd9c398){var _0x4978eb={},_0xbbd61b={},_0x5eca90={'count':0x0,'rows':[]};var _0x390015=_[_0x6ab2('0x2d')](db[_0x6ab2('0x2e')][_0x6ab2('0x2f')],function(_0x6d3c1d){return{'name':_0x6d3c1d[_0x6ab2('0x30')],'type':_0x6d3c1d['type'][_0x6ab2('0x31')]};});_0xbbd61b[_0x6ab2('0x32')]=_[_0x6ab2('0x2d')](_0x390015,_0x6ab2('0x2b'));_0xbbd61b[_0x6ab2('0x33')]=_[_0x6ab2('0x34')](_0x3c80ed[_0x6ab2('0x33')]);_0xbbd61b['filters']=_[_0x6ab2('0x35')](_0xbbd61b[_0x6ab2('0x32')],_0xbbd61b['query']);_0x4978eb['attributes']=_[_0x6ab2('0x35')](_0xbbd61b[_0x6ab2('0x32')],qs[_0x6ab2('0x36')](_0x3c80ed[_0x6ab2('0x33')][_0x6ab2('0x36')]));_0x4978eb[_0x6ab2('0x37')]=_0x4978eb[_0x6ab2('0x37')][_0x6ab2('0x38')]?_0x4978eb['attributes']:_0xbbd61b['model'];if(!_0x3c80ed[_0x6ab2('0x33')][_0x6ab2('0x39')](_0x6ab2('0x3a'))){_0x4978eb[_0x6ab2('0x1c')]=qs[_0x6ab2('0x1c')](_0x3c80ed['query'][_0x6ab2('0x1c')]);_0x4978eb[_0x6ab2('0x1f')]=qs[_0x6ab2('0x1f')](_0x3c80ed['query'][_0x6ab2('0x1f')]);}_0x4978eb[_0x6ab2('0x3b')]=qs['sort'](_0x3c80ed[_0x6ab2('0x33')][_0x6ab2('0x3c')]);_0x4978eb[_0x6ab2('0x3d')]=qs[_0x6ab2('0x3e')](_[_0x6ab2('0x3f')](_0x3c80ed[_0x6ab2('0x33')],_0xbbd61b[_0x6ab2('0x3e')]),_0x390015);if(_0x3c80ed['query'][_0x6ab2('0x40')]){_0x4978eb['where']=_[_0x6ab2('0x41')](_0x4978eb[_0x6ab2('0x3d')],{'$or':_[_0x6ab2('0x2d')](_0x390015,function(_0x5c765b){if(_0x5c765b['type']!==_0x6ab2('0x42')){var _0x4f08ad={};_0x4f08ad[_0x5c765b['name']]={'$like':'%'+_0x3c80ed[_0x6ab2('0x33')][_0x6ab2('0x40')]+'%'};return _0x4f08ad;}})});}_0x4978eb=_[_0x6ab2('0x41')]({},_0x4978eb,_0x3c80ed[_0x6ab2('0x43')]);var _0x1a4818={'where':_0x4978eb['where']};return db[_0x6ab2('0x2e')]['count'](_0x1a4818)[_0x6ab2('0x25')](function(_0x1a3b61){_0x5eca90[_0x6ab2('0x1e')]=_0x1a3b61;if(_0x3c80ed[_0x6ab2('0x33')]['includeAll']){_0x4978eb[_0x6ab2('0x44')]=[{'all':!![]}];}return db[_0x6ab2('0x2e')][_0x6ab2('0x45')](_0x4978eb);})[_0x6ab2('0x25')](function(_0x12d4b6){_0x5eca90[_0x6ab2('0x46')]=_0x12d4b6;return _0x5eca90;})[_0x6ab2('0x25')](respondWithFilteredResult(_0xd9c398,_0x4978eb))[_0x6ab2('0x47')](handleError(_0xd9c398,null));};exports[_0x6ab2('0x48')]=function(_0x2aea88,_0x398274){var _0x32333d={'raw':![],'where':{'id':_0x2aea88[_0x6ab2('0x49')]['id']}},_0x5720af={};_0x5720af[_0x6ab2('0x32')]=_[_0x6ab2('0x34')](db[_0x6ab2('0x2e')][_0x6ab2('0x2f')]);_0x5720af[_0x6ab2('0x33')]=_['keys'](_0x2aea88[_0x6ab2('0x33')]);_0x5720af[_0x6ab2('0x3e')]=_[_0x6ab2('0x35')](_0x5720af[_0x6ab2('0x32')],_0x5720af['query']);_0x32333d['attributes']=_[_0x6ab2('0x35')](_0x5720af[_0x6ab2('0x32')],qs[_0x6ab2('0x36')](_0x2aea88[_0x6ab2('0x33')][_0x6ab2('0x36')]));_0x32333d['attributes']=_0x32333d[_0x6ab2('0x37')][_0x6ab2('0x38')]?_0x32333d[_0x6ab2('0x37')]:_0x5720af[_0x6ab2('0x32')];if(_0x2aea88['query']['includeAll']){_0x32333d[_0x6ab2('0x44')]=[{'all':!![]}];}_0x32333d=_[_0x6ab2('0x41')]({},_0x32333d,_0x2aea88['options']);return db[_0x6ab2('0x2e')]['find'](_0x32333d)['then'](handleEntityNotFound(_0x398274,null))['then'](respondWithResult(_0x398274,null))[_0x6ab2('0x47')](handleError(_0x398274,null));};exports[_0x6ab2('0x4a')]=function(_0x4fffb4,_0x186746){return db['VoiceChanSpy'][_0x6ab2('0x4a')](_0x4fffb4[_0x6ab2('0x4b')],{})[_0x6ab2('0x25')](function(_0x9c5d40){var _0x507695=_0x4fffb4[_0x6ab2('0x4c')][_0x6ab2('0x26')]({'plain':!![]});if(!_0x507695)throw new Error(_0x6ab2('0x4d'));if(_0x507695[_0x6ab2('0x4e')]===_0x6ab2('0x4c')){var _0x301270=_0x9c5d40[_0x6ab2('0x26')]({'plain':!![]});var _0x507da5=_0x6ab2('0x4f');return db[_0x6ab2('0x50')][_0x6ab2('0x51')]({'where':{'name':_0x507da5,'userProfileId':_0x507695[_0x6ab2('0x52')]},'raw':!![]})[_0x6ab2('0x25')](function(_0x1449db){if(_0x1449db&&_0x1449db['autoAssociation']===0x0){return db[_0x6ab2('0x27')]['create']({'name':_0x301270[_0x6ab2('0x2b')],'resourceId':_0x301270['id'],'type':_0x1449db[_0x6ab2('0x2b')],'sectionId':_0x1449db['id']},{})[_0x6ab2('0x25')](function(){return _0x9c5d40;});}else{return _0x9c5d40;}})[_0x6ab2('0x47')](function(_0x145428){logger[_0x6ab2('0x29')](_0x6ab2('0x53'),_0x145428);throw _0x145428;});}return _0x9c5d40;})[_0x6ab2('0x25')](respondWithResult(_0x186746,0xc9))[_0x6ab2('0x47')](handleError(_0x186746,null));};exports['update']=function(_0x326d64,_0x5df5be){if(_0x326d64['body']['id']){delete _0x326d64[_0x6ab2('0x4b')]['id'];}return db[_0x6ab2('0x2e')][_0x6ab2('0x51')]({'where':{'id':_0x326d64[_0x6ab2('0x49')]['id']}})[_0x6ab2('0x25')](handleEntityNotFound(_0x5df5be,null))[_0x6ab2('0x25')](saveUpdates(_0x326d64[_0x6ab2('0x4b')],null))[_0x6ab2('0x25')](respondWithResult(_0x5df5be,null))[_0x6ab2('0x47')](handleError(_0x5df5be,null));};exports[_0x6ab2('0x28')]=function(_0xdd943,_0x409b6e){return db['VoiceChanSpy'][_0x6ab2('0x51')]({'where':{'id':_0xdd943[_0x6ab2('0x49')]['id']}})[_0x6ab2('0x25')](handleEntityNotFound(_0x409b6e,null))[_0x6ab2('0x25')](removeEntity(_0x409b6e,null))[_0x6ab2('0x47')](handleError(_0x409b6e,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 4a71c1a..1abd85b 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 _0xba2e=['password','ChanSpy','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','exports','models','define','voice_chanspy','then','VoiceExtension','destroy','bulkCreate','lodash','util','from-sip','format','%s%s','merge','Set','CDR(type)=%s','chanspy','MixMonitor','auth','push'];(function(_0x450b1b,_0x1847b8){var _0x57481f=function(_0xe0da7b){while(--_0xe0da7b){_0x450b1b['push'](_0x450b1b['shift']());}};_0x57481f(++_0x1847b8);}(_0xba2e,0x15f));var _0xeba2=function(_0x44a3da,_0x1b3f44){_0x44a3da=_0x44a3da-0x0;var _0xaf07f8=_0xba2e[_0x44a3da];return _0xaf07f8;};'use strict';var _=require(_0xeba2('0x0'));var util=require(_0xeba2('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x552596,_0x225a76,_0x43ea54){var _0x39916f=0x1;var _0x599a6a=[];var _0x35c768={'context':_0x225a76['context']||_0xeba2('0x2'),'exten':util[_0xeba2('0x3')](_0xeba2('0x4'),_0x552596['prefix'],_0x43ea54),'type':'system','isApp':![],'ChanSpyId':_0x552596['id'],'UserId':_0x225a76['id']};_0x599a6a['push'](_[_0xeba2('0x5')]({'app':_0xeba2('0x6'),'appdata':util['format'](_0xeba2('0x7'),_0xeba2('0x8')),'priority':_0x39916f++},_0x35c768));if(_0x552596['record']){_0x599a6a['push'](_[_0xeba2('0x5')]({'app':_0xeba2('0x9'),'appdata':util[_0xeba2('0x3')]('${UNIQUEID}.%s,a',_0x552596['recordingFormat']),'priority':_0x39916f++},_0x35c768));}if(_0x552596[_0xeba2('0xa')]){_0x599a6a[_0xeba2('0xb')](_[_0xeba2('0x5')]({'app':'Authenticate','appdata':_0x552596[_0xeba2('0xc')],'priority':_0x39916f++},_0x35c768));}_0x599a6a[_0xeba2('0xb')](_[_0xeba2('0x5')]({'app':_0xeba2('0xd'),'appdata':util['format']('SIP/%s,%s',_0x225a76[_0xeba2('0xe')],_0x552596[_0xeba2('0xf')]?_0x552596[_0xeba2('0xf')][_0xeba2('0x10')](''):''),'priority':_0x39916f++},_0x35c768));if(_0x552596['record']){_0x599a6a[_0xeba2('0xb')](_[_0xeba2('0x5')]({'app':_0xeba2('0x11'),'priority':_0x39916f++},_0x35c768));}return _0x599a6a;};var getChanSpyApplications=function(_0x287089,_0x27ec84){var _0x3807f8=[];for(var _0x527ee8=0x0,_0x3fd867=0x1;_0x527ee8<_0x27ec84[_0xeba2('0x12')];_0x527ee8++,_0x3fd867=0x1){_0x3807f8=_0x3807f8[_0xeba2('0x13')](getUserApplications(_0x287089,_0x27ec84[_0x527ee8],_0x27ec84[_0x527ee8][_0xeba2('0x14')]));if(_0x27ec84[_0x527ee8][_0xeba2('0x14')]!=_0x27ec84[_0x527ee8][_0xeba2('0xe')]){_0x3807f8=_0x3807f8['concat'](getUserApplications(_0x287089,_0x27ec84[_0x527ee8],_0x27ec84[_0x527ee8][_0xeba2('0xe')]));}}return _0x3807f8;};var getChanSpyPromise=function(_0x5a514a,_0x4b9ed7){return new BPromise(function(_0x47e2ee,_0x16177a){return _0x5a514a[_0xeba2('0x15')][_0xeba2('0x16')]({'attributes':['id',_0xeba2('0xe'),_0xeba2('0x14')],'where':{'role':_0xeba2('0x17'),'chanspy':!![]},'raw':!![]})['then'](function(_0x5a7a7a){if(_0x5a7a7a){return _0x47e2ee(getChanSpyApplications(_0x4b9ed7,_0x5a7a7a));}return _0x47e2ee([]);})[_0xeba2('0x18')](function(_0x43bbbf){_0x16177a(_0x43bbbf);});});};module[_0xeba2('0x19')]=function(_0x1963e0,_0x464c0b){var _0x10ca98=_0x1963e0[_0xeba2('0x1a')];return _0x1963e0[_0xeba2('0x1b')]('VoiceChanSpy',attributes,{'tableName':_0xeba2('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x492bf6,_0x32ac86,_0x105453){return getChanSpyPromise(_0x10ca98,_0x492bf6)[_0xeba2('0x1d')](function(_0x51c839){if(_0x51c839&&_0x51c839[_0xeba2('0x12')]){return _0x10ca98[_0xeba2('0x1e')]['bulkCreate'](_0x51c839);}})[_0xeba2('0x1d')](function(){_0x105453();})[_0xeba2('0x18')](function(_0x2363ce){_0x105453(_0x2363ce);});},'afterUpdate':function(_0x2791d8,_0x572f8c,_0x51be33){return _0x10ca98[_0xeba2('0x1e')][_0xeba2('0x1f')]({'where':{'ChanSpyId':_0x2791d8['id']}})[_0xeba2('0x1d')](function(){return getChanSpyPromise(_0x10ca98,_0x2791d8);})[_0xeba2('0x1d')](function(_0x5ed984){if(_0x5ed984&&_0x5ed984['length']){return _0x10ca98[_0xeba2('0x1e')][_0xeba2('0x20')](_0x5ed984);}})[_0xeba2('0x1d')](function(){_0x51be33();})['catch'](function(_0x24895f){_0x51be33(_0x24895f);});},'afterDestroy':function(_0x22645b,_0x5d2796,_0x4416eb){return _0x10ca98[_0xeba2('0x1e')]['destroy']({'where':{'ChanSpyId':_0x22645b['id']}})[_0xeba2('0x1d')](function(){_0x4416eb();})[_0xeba2('0x18')](function(_0xf17643){_0x4416eb(_0xf17643);});}}});}; \ No newline at end of file +var _0x563f=['models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','length','lodash','bluebird','context','from-sip','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s','name','options','join','concat','internal','User','agent','then','catch'];(function(_0xeaad17,_0xf6d4e8){var _0x2e4f6b=function(_0x52d30d){while(--_0x52d30d){_0xeaad17['push'](_0xeaad17['shift']());}};_0x2e4f6b(++_0xf6d4e8);}(_0x563f,0x19f));var _0xf563=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x563f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xf563('0x0'));var util=require('util');var BPromise=require(_0xf563('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x38ffe4,_0x1d2a7e,_0x17f638){var _0x47f26e=0x1;var _0x21b80b=[];var _0x5c742b={'context':_0x1d2a7e[_0xf563('0x2')]||_0xf563('0x3'),'exten':util['format'](_0xf563('0x4'),_0x38ffe4[_0xf563('0x5')],_0x17f638),'type':_0xf563('0x6'),'isApp':![],'ChanSpyId':_0x38ffe4['id'],'UserId':_0x1d2a7e['id']};_0x21b80b[_0xf563('0x7')](_[_0xf563('0x8')]({'app':_0xf563('0x9'),'appdata':util[_0xf563('0xa')](_0xf563('0xb'),_0xf563('0xc')),'priority':_0x47f26e++},_0x5c742b));if(_0x38ffe4[_0xf563('0xd')]){_0x21b80b[_0xf563('0x7')](_[_0xf563('0x8')]({'app':_0xf563('0xe'),'appdata':util[_0xf563('0xa')](_0xf563('0xf'),_0x38ffe4['recordingFormat']),'priority':_0x47f26e++},_0x5c742b));}if(_0x38ffe4[_0xf563('0x10')]){_0x21b80b['push'](_[_0xf563('0x8')]({'app':'Authenticate','appdata':_0x38ffe4[_0xf563('0x11')],'priority':_0x47f26e++},_0x5c742b));}_0x21b80b[_0xf563('0x7')](_['merge']({'app':_0xf563('0x12'),'appdata':util[_0xf563('0xa')](_0xf563('0x13'),_0x1d2a7e[_0xf563('0x14')],_0x38ffe4['options']?_0x38ffe4[_0xf563('0x15')][_0xf563('0x16')](''):''),'priority':_0x47f26e++},_0x5c742b));if(_0x38ffe4[_0xf563('0xd')]){_0x21b80b[_0xf563('0x7')](_[_0xf563('0x8')]({'app':'StopMixMonitor','priority':_0x47f26e++},_0x5c742b));}return _0x21b80b;};var getChanSpyApplications=function(_0x122488,_0xb919ef){var _0x551543=[];for(var _0x4c3d41=0x0,_0x522307=0x1;_0x4c3d41<_0xb919ef['length'];_0x4c3d41++,_0x522307=0x1){_0x551543=_0x551543[_0xf563('0x17')](getUserApplications(_0x122488,_0xb919ef[_0x4c3d41],_0xb919ef[_0x4c3d41][_0xf563('0x18')]));if(_0xb919ef[_0x4c3d41][_0xf563('0x18')]!=_0xb919ef[_0x4c3d41][_0xf563('0x14')]){_0x551543=_0x551543[_0xf563('0x17')](getUserApplications(_0x122488,_0xb919ef[_0x4c3d41],_0xb919ef[_0x4c3d41][_0xf563('0x14')]));}}return _0x551543;};var getChanSpyPromise=function(_0x5be611,_0xe35e92){return new BPromise(function(_0x52b27e,_0x47173a){return _0x5be611[_0xf563('0x19')]['findAll']({'attributes':['id',_0xf563('0x14'),_0xf563('0x18')],'where':{'role':_0xf563('0x1a'),'chanspy':!![]},'raw':!![]})[_0xf563('0x1b')](function(_0x1eea33){if(_0x1eea33){return _0x52b27e(getChanSpyApplications(_0xe35e92,_0x1eea33));}return _0x52b27e([]);})[_0xf563('0x1c')](function(_0x569796){_0x47173a(_0x569796);});});};module['exports']=function(_0x719379,_0x4cccf4){var _0x285459=_0x719379[_0xf563('0x1d')];return _0x719379[_0xf563('0x1e')](_0xf563('0x1f'),attributes,{'tableName':_0xf563('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x9ad99f,_0x92a231,_0x5b29c9){return getChanSpyPromise(_0x285459,_0x9ad99f)[_0xf563('0x1b')](function(_0xd06d6d){if(_0xd06d6d&&_0xd06d6d['length']){return _0x285459[_0xf563('0x21')][_0xf563('0x22')](_0xd06d6d);}})['then'](function(){_0x5b29c9();})[_0xf563('0x1c')](function(_0x1ca2e6){_0x5b29c9(_0x1ca2e6);});},'afterUpdate':function(_0x5e4cc5,_0x3da322,_0xf64573){return _0x285459[_0xf563('0x21')][_0xf563('0x23')]({'where':{'ChanSpyId':_0x5e4cc5['id']}})[_0xf563('0x1b')](function(){return getChanSpyPromise(_0x285459,_0x5e4cc5);})['then'](function(_0x4fe9c9){if(_0x4fe9c9&&_0x4fe9c9[_0xf563('0x24')]){return _0x285459[_0xf563('0x21')]['bulkCreate'](_0x4fe9c9);}})[_0xf563('0x1b')](function(){_0xf64573();})['catch'](function(_0x40d5ad){_0xf64573(_0x40d5ad);});},'afterDestroy':function(_0x3db8a7,_0x357e5d,_0x27f643){return _0x285459[_0xf563('0x21')][_0xf563('0x23')]({'where':{'ChanSpyId':_0x3db8a7['id']}})['then'](function(){_0x27f643();})['catch'](function(_0x3689f0){_0x27f643(_0x3689f0);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b6fd8ed..968231e 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 _0x6308=['stringify','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6308,0x1f2));var _0x8630=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6308[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x8630('0x0'));var util=require('util');var moment=require(_0x8630('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8630('0x2'));var db=require(_0x8630('0x3'))['db'];var utils=require(_0x8630('0x4'));var logger=require(_0x8630('0x5'))(_0x8630('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8630('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x337086,_0x3d5a10,_0x1bcfea){return new BPromise(function(_0x2b87ea,_0x10cc17){return client[_0x8630('0x8')](_0x337086,_0x1bcfea)['then'](function(_0x8b3652){logger['info'](_0x8630('0x9'),_0x3d5a10,_0x8630('0xa'));logger[_0x8630('0xb')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x3d5a10,_0x8630('0xa'),JSON[_0x8630('0xc')](_0x8b3652));if(_0x8b3652[_0x8630('0xd')]){if(_0x8b3652['error'][_0x8630('0xe')]===0x1f4){logger[_0x8630('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3d5a10,_0x8b3652['error'][_0x8630('0xf')]);return _0x10cc17(_0x8b3652[_0x8630('0xd')]['message']);}logger[_0x8630('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3d5a10,_0x8b3652[_0x8630('0xd')]['message']);return _0x2b87ea(_0x8b3652[_0x8630('0xd')]['message']);}else{logger['info'](_0x8630('0x9'),_0x3d5a10,_0x8630('0xa'));_0x2b87ea(_0x8b3652['result']['message']);}})[_0x8630('0x10')](function(_0x547667){logger[_0x8630('0xd')](_0x8630('0x9'),_0x3d5a10,_0x547667);_0x10cc17(_0x547667);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xdb7eb4,_0x36875a){_0xdb7eb4=_0xdb7eb4-0x0;var _0x27f8a7=_0xbdb7[_0xdb7eb4];return _0x27f8a7;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index a540eff..b165346 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 _0x995a=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy','exports','multer','util'];(function(_0x1e271f,_0xf14504){var _0x2b2ac5=function(_0x21c3b6){while(--_0x21c3b6){_0x1e271f['push'](_0x1e271f['shift']());}};_0x2b2ac5(++_0xf14504);}(_0x995a,0xfd));var _0xa995=function(_0x3e7b8c,_0xb6f78d){_0x3e7b8c=_0x3e7b8c-0x0;var _0x40d533=_0x995a[_0x3e7b8c];return _0x40d533;};'use strict';var multer=require(_0xa995('0x0'));var util=require(_0xa995('0x1'));var path=require('path');var timeout=require(_0xa995('0x2'));var express=require(_0xa995('0x3'));var router=express['Router']();var fs_extra=require(_0xa995('0x4'));var auth=require(_0xa995('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa995('0x6'));var controller=require(_0xa995('0x7'));router[_0xa995('0x8')]('/',auth[_0xa995('0x9')](),controller['index']);router[_0xa995('0x8')](_0xa995('0xa'),auth['isAuthenticated'](),controller[_0xa995('0xb')]);router['post']('/',auth[_0xa995('0x9')](),controller[_0xa995('0xc')]);router[_0xa995('0xd')](_0xa995('0xa'),auth[_0xa995('0x9')](),controller['update']);router[_0xa995('0xe')](_0xa995('0xa'),auth['isAuthenticated'](),controller[_0xa995('0xf')]);module[_0xa995('0x10')]=router; \ No newline at end of file +var _0x9129=['../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4cc016,_0x39302e){var _0xf8bc28=function(_0x26327c){while(--_0x26327c){_0x4cc016['push'](_0x4cc016['shift']());}};_0xf8bc28(++_0x39302e);}(_0x9129,0xac));var _0x9912=function(_0x42e495,_0x49d9da){_0x42e495=_0x42e495-0x0;var _0x595da1=_0x9129[_0x42e495];return _0x595da1;};'use strict';var multer=require(_0x9912('0x0'));var util=require(_0x9912('0x1'));var path=require(_0x9912('0x2'));var timeout=require(_0x9912('0x3'));var express=require(_0x9912('0x4'));var router=express[_0x9912('0x5')]();var fs_extra=require(_0x9912('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9912('0x7'));var config=require(_0x9912('0x8'));var controller=require('./voiceContext.controller');router[_0x9912('0x9')]('/',auth['isAuthenticated'](),controller[_0x9912('0xa')]);router[_0x9912('0x9')](_0x9912('0xb'),auth[_0x9912('0xc')](),controller[_0x9912('0xd')]);router[_0x9912('0xe')]('/',auth[_0x9912('0xc')](),controller[_0x9912('0xf')]);router[_0x9912('0x10')](_0x9912('0xb'),auth[_0x9912('0xc')](),controller['update']);router[_0x9912('0x11')]('/:id',auth[_0x9912('0xc')](),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 1c2f330..a2bb098 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 _0xa311=['STRING','name','BOOLEAN','exports'];(function(_0x308502,_0x275f8f){var _0x3004c6=function(_0xab552f){while(--_0xab552f){_0x308502['push'](_0x308502['shift']());}};_0x3004c6(++_0x275f8f);}(_0xa311,0x193));var _0x1a31=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa311[_0x5c3c0b];return _0x52ecd2;};'use strict';var Sequelize=require('sequelize');module[_0x1a31('0x0')]={'name':{'type':Sequelize[_0x1a31('0x1')],'unique':_0x1a31('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x1a31('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1843=['name','BOOLEAN','sequelize','exports'];(function(_0x475389,_0x2deda6){var _0x5aa36d=function(_0x1546a9){while(--_0x1546a9){_0x475389['push'](_0x475389['shift']());}};_0x5aa36d(++_0x2deda6);}(_0x1843,0x6a));var _0x3184=function(_0x3a0dc5,_0x540eb0){_0x3a0dc5=_0x3a0dc5-0x0;var _0x1d48a3=_0x1843[_0x3a0dc5];return _0x1d48a3;};'use strict';var Sequelize=require(_0x3184('0x0'));module[_0x3184('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3184('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x3184('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 407f62a..b5c2c26 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 _0xc9d2=['VoiceContext,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','Contexts','destroy','sendStatus','name','send','map','VoiceContext','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','create','body','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','server/files/templates/context.ejs','render','Reload','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x8edb99,_0x535523){var _0x564460=function(_0x4e13d3){while(--_0x4e13d3){_0x8edb99['push'](_0x8edb99['shift']());}};_0x564460(++_0x535523);}(_0xc9d2,0x184));var _0x2c9d=function(_0x8f8e0b,_0x474bac){_0x8f8e0b=_0x8f8e0b-0x0;var _0x2aa030=_0xc9d2[_0x8f8e0b];return _0x2aa030;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c9d('0x0'));var zipdir=require(_0x2c9d('0x1'));var jsonpatch=require(_0x2c9d('0x2'));var rp=require(_0x2c9d('0x3'));var moment=require(_0x2c9d('0x4'));var BPromise=require(_0x2c9d('0x5'));var Mustache=require(_0x2c9d('0x6'));var util=require(_0x2c9d('0x7'));var path=require('path');var sox=require(_0x2c9d('0x8'));var csv=require('to-csv');var ejs=require(_0x2c9d('0x9'));var fs=require('fs');var fs_extra=require(_0x2c9d('0xa'));var _=require(_0x2c9d('0xb'));var squel=require(_0x2c9d('0xc'));var crypto=require(_0x2c9d('0xd'));var jsforce=require(_0x2c9d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2c9d('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2c9d('0x10'));var authService=require(_0x2c9d('0x11'));var qs=require(_0x2c9d('0x12'));var as=require(_0x2c9d('0x13'));var hardwareService=require(_0x2c9d('0x14'));var logger=require(_0x2c9d('0x15'))(_0x2c9d('0x16'));var utils=require('../../config/utils');var config=require(_0x2c9d('0x17'));var licenseUtil=require(_0x2c9d('0x18'));var db=require(_0x2c9d('0x19'))['db'];var jayson=require(_0x2c9d('0x1a'));var client=jayson[_0x2c9d('0x1b')][_0x2c9d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x339f85,_0xcceb0f,_0x1e5d5b,_0xdef15){return new BPromise(function(_0x2bff3c,_0x25ef0c){var _0x43fa0f=_0xdef15||client;return _0x43fa0f[_0x2c9d('0x1d')](_0x339f85,_0x1e5d5b)['then'](function(_0x2e2969){logger[_0x2c9d('0x1e')]('VoiceContext,\x20%s,\x20%s',_0xcceb0f,_0x2c9d('0x1f'));logger[_0x2c9d('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xcceb0f,_0x2c9d('0x1f'),JSON[_0x2c9d('0x21')](_0x2e2969));if(_0x2e2969[_0x2c9d('0x22')]){if(_0x2e2969[_0x2c9d('0x22')][_0x2c9d('0x23')]===0x1f4){logger[_0x2c9d('0x22')](_0x2c9d('0x24'),_0xcceb0f,_0x2e2969['error'][_0x2c9d('0x25')]);return _0x25ef0c(_0x2e2969[_0x2c9d('0x22')][_0x2c9d('0x25')]);}logger[_0x2c9d('0x22')](_0x2c9d('0x24'),_0xcceb0f,_0x2e2969[_0x2c9d('0x22')]['message']);return _0x2bff3c(_0x2e2969[_0x2c9d('0x22')][_0x2c9d('0x25')]);}else{logger['info'](_0x2c9d('0x24'),_0xcceb0f,_0x2c9d('0x1f'));_0x2bff3c(_0x2e2969[_0x2c9d('0x26')][_0x2c9d('0x25')]);}})[_0x2c9d('0x27')](function(_0x496898){logger['error'](_0x2c9d('0x24'),_0xcceb0f,_0x496898);_0x25ef0c(_0x496898);});});}function respondWithStatusCode(_0x48c596,_0x34abbc){_0x34abbc=_0x34abbc||0xcc;return function(_0x7e2b0e){if(_0x7e2b0e){return _0x48c596['sendStatus'](_0x34abbc);}return _0x48c596[_0x2c9d('0x28')](_0x34abbc)[_0x2c9d('0x29')]();};}function respondWithResult(_0x52d5a8,_0x29c980){_0x29c980=_0x29c980||0xc8;return function(_0x5e5abe){if(_0x5e5abe){return _0x52d5a8[_0x2c9d('0x28')](_0x29c980)['json'](_0x5e5abe);}};}function respondWithFilteredResult(_0x307623,_0x2439b3){return function(_0x43fac5){if(_0x43fac5){var _0x197c80=typeof _0x2439b3[_0x2c9d('0x2a')]===_0x2c9d('0x2b')&&typeof _0x2439b3['limit']==='undefined';var _0x60063f=_0x43fac5[_0x2c9d('0x2c')];var _0x4f78ce=_0x197c80?0x0:_0x2439b3['offset'];var _0x435f59=_0x197c80?_0x43fac5[_0x2c9d('0x2c')]:_0x2439b3[_0x2c9d('0x2a')]+_0x2439b3['limit'];var _0x407c09;if(_0x435f59>=_0x60063f){_0x435f59=_0x60063f;_0x407c09=0xc8;}else{_0x407c09=0xce;}_0x307623[_0x2c9d('0x28')](_0x407c09);return _0x307623['set'](_0x2c9d('0x2d'),_0x4f78ce+'-'+_0x435f59+'/'+_0x60063f)[_0x2c9d('0x2e')](_0x43fac5);}return null;};}function patchUpdates(_0x20dd58){return function(_0x5c3cc1){try{jsonpatch[_0x2c9d('0x2f')](_0x5c3cc1,_0x20dd58,!![]);}catch(_0x539578){return BPromise[_0x2c9d('0x30')](_0x539578);}return _0x5c3cc1[_0x2c9d('0x31')]();};}function saveUpdates(_0x40fc32,_0x14df3a){return function(_0x305b58){if(_0x305b58){return _0x305b58[_0x2c9d('0x32')](_0x40fc32)[_0x2c9d('0x33')](function(_0x3497f1){return _0x3497f1;});}return null;};}function removeEntity(_0x3bf56e,_0xebe91c){return function(_0x2294e9){if(_0x2294e9){return _0x2294e9['destroy']()['then'](function(){var _0x5cf769=_0x2294e9['get']({'plain':!![]});var _0x123460=_0x2c9d('0x34');return db['UserProfileResource'][_0x2c9d('0x35')]({'where':{'type':_0x123460,'resourceId':_0x5cf769['id']}})['then'](function(){return _0x2294e9;});})[_0x2c9d('0x33')](function(){_0x3bf56e['status'](0xcc)[_0x2c9d('0x29')]();});}};}function handleEntityNotFound(_0x31ce0b,_0x1debf5){return function(_0x44ab1b){if(!_0x44ab1b){_0x31ce0b[_0x2c9d('0x36')](0x194);}return _0x44ab1b;};}function handleError(_0x143107,_0x4c41dd){_0x4c41dd=_0x4c41dd||0x1f4;return function(_0x5d3b20){logger['error'](_0x5d3b20['stack']);if(_0x5d3b20['name']){delete _0x5d3b20[_0x2c9d('0x37')];}_0x143107[_0x2c9d('0x28')](_0x4c41dd)[_0x2c9d('0x38')](_0x5d3b20);};}exports['index']=function(_0x4d96b0,_0x52c6a5){var _0x157e53={},_0x12e3d1={},_0xe7d01f={'count':0x0,'rows':[]};var _0x296a67=_[_0x2c9d('0x39')](db[_0x2c9d('0x3a')][_0x2c9d('0x3b')],function(_0x211a69){return{'name':_0x211a69[_0x2c9d('0x3c')],'type':_0x211a69[_0x2c9d('0x3d')]['key']};});_0x12e3d1[_0x2c9d('0x3e')]=_[_0x2c9d('0x39')](_0x296a67,_0x2c9d('0x37'));_0x12e3d1[_0x2c9d('0x3f')]=_[_0x2c9d('0x40')](_0x4d96b0['query']);_0x12e3d1[_0x2c9d('0x41')]=_[_0x2c9d('0x42')](_0x12e3d1[_0x2c9d('0x3e')],_0x12e3d1['query']);_0x157e53[_0x2c9d('0x43')]=_[_0x2c9d('0x42')](_0x12e3d1[_0x2c9d('0x3e')],qs[_0x2c9d('0x44')](_0x4d96b0[_0x2c9d('0x3f')][_0x2c9d('0x44')]));_0x157e53['attributes']=_0x157e53['attributes'][_0x2c9d('0x45')]?_0x157e53[_0x2c9d('0x43')]:_0x12e3d1[_0x2c9d('0x3e')];if(!_0x4d96b0[_0x2c9d('0x3f')][_0x2c9d('0x46')](_0x2c9d('0x47'))){_0x157e53[_0x2c9d('0x48')]=qs[_0x2c9d('0x48')](_0x4d96b0[_0x2c9d('0x3f')]['limit']);_0x157e53[_0x2c9d('0x2a')]=qs['offset'](_0x4d96b0[_0x2c9d('0x3f')][_0x2c9d('0x2a')]);}_0x157e53[_0x2c9d('0x49')]=qs[_0x2c9d('0x4a')](_0x4d96b0['query']['sort']);_0x157e53[_0x2c9d('0x4b')]=qs[_0x2c9d('0x41')](_[_0x2c9d('0x4c')](_0x4d96b0['query'],_0x12e3d1[_0x2c9d('0x41')]),_0x296a67);if(_0x4d96b0[_0x2c9d('0x3f')][_0x2c9d('0x4d')]){_0x157e53['where']=_[_0x2c9d('0x4e')](_0x157e53[_0x2c9d('0x4b')],{'$or':_[_0x2c9d('0x39')](_0x296a67,function(_0x32cae4){if(_0x32cae4[_0x2c9d('0x3d')]!==_0x2c9d('0x4f')){var _0x42a43e={};_0x42a43e[_0x32cae4[_0x2c9d('0x37')]]={'$like':'%'+_0x4d96b0[_0x2c9d('0x3f')][_0x2c9d('0x4d')]+'%'};return _0x42a43e;}})});}_0x157e53=_[_0x2c9d('0x4e')]({},_0x157e53,_0x4d96b0['options']);var _0x1121ec={'where':_0x157e53['where']};return db['VoiceContext'][_0x2c9d('0x2c')](_0x1121ec)[_0x2c9d('0x33')](function(_0x56b6b2){_0xe7d01f['count']=_0x56b6b2;if(_0x4d96b0['query'][_0x2c9d('0x50')]){_0x157e53[_0x2c9d('0x51')]=[{'all':!![]}];}return db[_0x2c9d('0x3a')][_0x2c9d('0x52')](_0x157e53);})['then'](function(_0x5bc96f){_0xe7d01f['rows']=_0x5bc96f;return _0xe7d01f;})[_0x2c9d('0x33')](respondWithFilteredResult(_0x52c6a5,_0x157e53))[_0x2c9d('0x27')](handleError(_0x52c6a5,null));};exports[_0x2c9d('0x53')]=function(_0x32aa8a,_0x424abb){var _0x24f2c4={'raw':![],'where':{'id':_0x32aa8a[_0x2c9d('0x54')]['id']}},_0x155095={};_0x155095[_0x2c9d('0x3e')]=_['keys'](db[_0x2c9d('0x3a')][_0x2c9d('0x3b')]);_0x155095['query']=_[_0x2c9d('0x40')](_0x32aa8a[_0x2c9d('0x3f')]);_0x155095[_0x2c9d('0x41')]=_[_0x2c9d('0x42')](_0x155095['model'],_0x155095[_0x2c9d('0x3f')]);_0x24f2c4[_0x2c9d('0x43')]=_['intersection'](_0x155095[_0x2c9d('0x3e')],qs[_0x2c9d('0x44')](_0x32aa8a['query'][_0x2c9d('0x44')]));_0x24f2c4[_0x2c9d('0x43')]=_0x24f2c4['attributes'][_0x2c9d('0x45')]?_0x24f2c4['attributes']:_0x155095[_0x2c9d('0x3e')];if(_0x32aa8a[_0x2c9d('0x3f')][_0x2c9d('0x50')]){_0x24f2c4[_0x2c9d('0x51')]=[{'all':!![]}];}_0x24f2c4=_['merge']({},_0x24f2c4,_0x32aa8a[_0x2c9d('0x55')]);return db[_0x2c9d('0x3a')][_0x2c9d('0x56')](_0x24f2c4)[_0x2c9d('0x33')](handleEntityNotFound(_0x424abb,null))[_0x2c9d('0x33')](respondWithResult(_0x424abb,null))[_0x2c9d('0x27')](handleError(_0x424abb,null));};exports['create']=function(_0x4cf4da,_0x112387,_0x479a87){var _0x514ffc;return db[_0x2c9d('0x3a')][_0x2c9d('0x57')](_0x4cf4da[_0x2c9d('0x58')],{'raw':!![]})[_0x2c9d('0x33')](function(_0xc61f42){_0x514ffc=_0xc61f42;return db[_0x2c9d('0x3a')][_0x2c9d('0x52')]({'raw':!![]});})[_0x2c9d('0x33')](function(_0x4d688a){var _0x2d7806=fs['readFileSync'](path['join'](config[_0x2c9d('0x59')],'server/files/templates/context.ejs'),_0x2c9d('0x5a'));var _0x154e4d=ejs['render'](_0x2d7806,{'contexts':_0x4d688a||[]});fs[_0x2c9d('0x5b')](_0x2c9d('0x5c'),_0x154e4d);})['then'](function(){return respondWithRpcPromise('Reload',_0x2c9d('0x57'),{'module':_0x2c9d('0x5d')});})[_0x2c9d('0x33')](function(){var _0x16615e=_0x4cf4da['user'][_0x2c9d('0x5e')]({'plain':!![]});if(!_0x16615e)throw new Error(_0x2c9d('0x5f'));if(_0x16615e[_0x2c9d('0x60')]===_0x2c9d('0x61')){var _0x4b1222=_0x514ffc[_0x2c9d('0x5e')]({'plain':!![]});return db[_0x2c9d('0x62')]['find']({'where':{'name':_0x2c9d('0x34'),'userProfileId':_0x16615e[_0x2c9d('0x63')]},'raw':!![]})['then'](function(_0x492c52){if(_0x492c52&&_0x492c52[_0x2c9d('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x4b1222['name'],'resourceId':_0x4b1222['id'],'type':_0x492c52[_0x2c9d('0x37')],'sectionId':_0x492c52['id']},{})[_0x2c9d('0x33')](function(){return _0x514ffc;});}else{return _0x514ffc;}})['catch'](function(_0x575cf6){logger[_0x2c9d('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x575cf6);throw _0x575cf6;});}return _0x514ffc;})[_0x2c9d('0x33')](respondWithResult(_0x112387,0xc9))[_0x2c9d('0x27')](handleError(_0x112387,null));};exports[_0x2c9d('0x32')]=function(_0x11d389,_0x137520,_0x4ae30a){var _0x43c31c;return db['VoiceContext']['find']({'where':{'id':_0x11d389['params']['id']}})[_0x2c9d('0x33')](handleEntityNotFound(_0x137520,null))[_0x2c9d('0x33')](saveUpdates(_0x11d389[_0x2c9d('0x58')],null))['then'](function(_0x29796f){if(_0x29796f){_0x43c31c=_0x29796f;return db[_0x2c9d('0x3a')]['findAll']({'raw':!![]});}})['then'](function(_0x3ff3ec){var _0x19d443=fs[_0x2c9d('0x65')](path[_0x2c9d('0x66')](config['root'],_0x2c9d('0x67')),'utf8');var _0x11fc56=ejs[_0x2c9d('0x68')](_0x19d443,{'contexts':_0x3ff3ec||[]});fs[_0x2c9d('0x5b')](_0x2c9d('0x5c'),_0x11fc56);})['then'](function(){return respondWithRpcPromise('Reload','update',{'module':_0x2c9d('0x5d')});})[_0x2c9d('0x33')](function(){return _0x43c31c;})[_0x2c9d('0x33')](respondWithResult(_0x137520,null))[_0x2c9d('0x27')](handleError(_0x137520,null));};exports[_0x2c9d('0x35')]=function(_0x17b82d,_0x350bf3,_0x12d7a0){var _0x24d4f8;return db['VoiceContext'][_0x2c9d('0x56')]({'where':{'id':_0x17b82d['params']['id']}})[_0x2c9d('0x33')](handleEntityNotFound(_0x350bf3,null))[_0x2c9d('0x33')](removeEntity(_0x350bf3,null))['then'](function(){return db[_0x2c9d('0x3a')]['findAll']({'raw':!![]});})[_0x2c9d('0x33')](function(_0x25c732){var _0x5715bd=fs[_0x2c9d('0x65')](path[_0x2c9d('0x66')](config[_0x2c9d('0x59')],_0x2c9d('0x67')),_0x2c9d('0x5a'));var _0xc1eb75=ejs[_0x2c9d('0x68')](_0x5715bd,{'contexts':_0x25c732});fs['writeFileSync'](_0x2c9d('0x5c'),_0xc1eb75);return respondWithRpcPromise(_0x2c9d('0x69'),_0x2c9d('0x35'),{'module':_0x2c9d('0x5d')});})[_0x2c9d('0x27')](handleError(_0x350bf3,null));}; \ No newline at end of file +var _0xea96=['filter','merge','options','count','include','findAll','show','rawAttributes','includeAll','find','catch','create','body','join','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','utf8','render','Reload','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','client','http','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','apply','update','then','get','Contexts','UserProfileResource','destroy','stack','name','index','VoiceContext','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','VIRTUAL'];(function(_0x14e51e,_0x4da5a8){var _0x1186ed=function(_0x5e7e81){while(--_0x5e7e81){_0x14e51e['push'](_0x14e51e['shift']());}};_0x1186ed(++_0x4da5a8);}(_0xea96,0x13c));var _0x6ea9=function(_0x412f6f,_0x175d7c){_0x412f6f=_0x412f6f-0x0;var _0x22e073=_0xea96[_0x412f6f];return _0x22e073;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ea9('0x0'));var jsonpatch=require(_0x6ea9('0x1'));var rp=require('request-promise');var moment=require(_0x6ea9('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ea9('0x3'));var path=require(_0x6ea9('0x4'));var sox=require(_0x6ea9('0x5'));var csv=require(_0x6ea9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6ea9('0x7'));var crypto=require(_0x6ea9('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x6ea9('0x9'));var toCsv=require('to-csv');var querystring=require(_0x6ea9('0xa'));var Papa=require(_0x6ea9('0xb'));var Redis=require(_0x6ea9('0xc'));var authService=require(_0x6ea9('0xd'));var qs=require(_0x6ea9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ea9('0xf'));var logger=require('../../config/logger')(_0x6ea9('0x10'));var utils=require('../../config/utils');var config=require(_0x6ea9('0x11'));var licenseUtil=require(_0x6ea9('0x12'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6ea9('0x13')][_0x6ea9('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x44769d,_0x5c7374,_0x229f67,_0x2fe294){return new BPromise(function(_0x59f6a4,_0x2dccc9){var _0x55eb08=_0x2fe294||client;return _0x55eb08[_0x6ea9('0x15')](_0x44769d,_0x229f67)['then'](function(_0x3011c6){logger[_0x6ea9('0x16')](_0x6ea9('0x17'),_0x5c7374,'request\x20sent');logger[_0x6ea9('0x18')](_0x6ea9('0x19'),_0x5c7374,'request\x20sent',JSON['stringify'](_0x3011c6));if(_0x3011c6[_0x6ea9('0x1a')]){if(_0x3011c6[_0x6ea9('0x1a')][_0x6ea9('0x1b')]===0x1f4){logger[_0x6ea9('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x5c7374,_0x3011c6[_0x6ea9('0x1a')]['message']);return _0x2dccc9(_0x3011c6[_0x6ea9('0x1a')][_0x6ea9('0x1c')]);}logger[_0x6ea9('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x5c7374,_0x3011c6[_0x6ea9('0x1a')][_0x6ea9('0x1c')]);return _0x59f6a4(_0x3011c6[_0x6ea9('0x1a')][_0x6ea9('0x1c')]);}else{logger[_0x6ea9('0x16')](_0x6ea9('0x17'),_0x5c7374,_0x6ea9('0x1d'));_0x59f6a4(_0x3011c6[_0x6ea9('0x1e')]['message']);}})['catch'](function(_0x137b83){logger['error'](_0x6ea9('0x17'),_0x5c7374,_0x137b83);_0x2dccc9(_0x137b83);});});}function respondWithStatusCode(_0x4de06e,_0x4928ee){_0x4928ee=_0x4928ee||0xcc;return function(_0x42be77){if(_0x42be77){return _0x4de06e[_0x6ea9('0x1f')](_0x4928ee);}return _0x4de06e['status'](_0x4928ee)[_0x6ea9('0x20')]();};}function respondWithResult(_0x339830,_0x51b69b){_0x51b69b=_0x51b69b||0xc8;return function(_0x42ad9d){if(_0x42ad9d){return _0x339830[_0x6ea9('0x21')](_0x51b69b)[_0x6ea9('0x22')](_0x42ad9d);}};}function respondWithFilteredResult(_0x417924,_0x1b3ced){return function(_0x2de97c){if(_0x2de97c){var _0x547acf=typeof _0x1b3ced[_0x6ea9('0x23')]==='undefined'&&typeof _0x1b3ced[_0x6ea9('0x24')]===_0x6ea9('0x25');var _0x87300e=_0x2de97c['count'];var _0x10c47b=_0x547acf?0x0:_0x1b3ced[_0x6ea9('0x23')];var _0x29e2b0=_0x547acf?_0x2de97c['count']:_0x1b3ced[_0x6ea9('0x23')]+_0x1b3ced[_0x6ea9('0x24')];var _0x39187a;if(_0x29e2b0>=_0x87300e){_0x29e2b0=_0x87300e;_0x39187a=0xc8;}else{_0x39187a=0xce;}_0x417924[_0x6ea9('0x21')](_0x39187a);return _0x417924[_0x6ea9('0x26')](_0x6ea9('0x27'),_0x10c47b+'-'+_0x29e2b0+'/'+_0x87300e)[_0x6ea9('0x22')](_0x2de97c);}return null;};}function patchUpdates(_0xbffb42){return function(_0x57f6d5){try{jsonpatch[_0x6ea9('0x28')](_0x57f6d5,_0xbffb42,!![]);}catch(_0x2f4ab6){return BPromise['reject'](_0x2f4ab6);}return _0x57f6d5['save']();};}function saveUpdates(_0x281630,_0x5af5f4){return function(_0x51b900){if(_0x51b900){return _0x51b900[_0x6ea9('0x29')](_0x281630)[_0x6ea9('0x2a')](function(_0x17b58d){return _0x17b58d;});}return null;};}function removeEntity(_0x1b1432,_0x3e7ba0){return function(_0x368378){if(_0x368378){return _0x368378['destroy']()['then'](function(){var _0x480964=_0x368378[_0x6ea9('0x2b')]({'plain':!![]});var _0x57871d=_0x6ea9('0x2c');return db[_0x6ea9('0x2d')][_0x6ea9('0x2e')]({'where':{'type':_0x57871d,'resourceId':_0x480964['id']}})['then'](function(){return _0x368378;});})[_0x6ea9('0x2a')](function(){_0x1b1432[_0x6ea9('0x21')](0xcc)[_0x6ea9('0x20')]();});}};}function handleEntityNotFound(_0xe862ea,_0x42f51c){return function(_0x5b4f36){if(!_0x5b4f36){_0xe862ea[_0x6ea9('0x1f')](0x194);}return _0x5b4f36;};}function handleError(_0x47949d,_0x580d85){_0x580d85=_0x580d85||0x1f4;return function(_0x24f520){logger[_0x6ea9('0x1a')](_0x24f520[_0x6ea9('0x2f')]);if(_0x24f520[_0x6ea9('0x30')]){delete _0x24f520['name'];}_0x47949d['status'](_0x580d85)['send'](_0x24f520);};}exports[_0x6ea9('0x31')]=function(_0x5aa1f6,_0x2e2ca2){var _0x8b8d62={},_0x5cb35f={},_0x3635cb={'count':0x0,'rows':[]};var _0xb0cbc5=_['map'](db[_0x6ea9('0x32')]['rawAttributes'],function(_0x18ac64){return{'name':_0x18ac64[_0x6ea9('0x33')],'type':_0x18ac64[_0x6ea9('0x34')][_0x6ea9('0x35')]};});_0x5cb35f[_0x6ea9('0x36')]=_[_0x6ea9('0x37')](_0xb0cbc5,_0x6ea9('0x30'));_0x5cb35f[_0x6ea9('0x38')]=_[_0x6ea9('0x39')](_0x5aa1f6['query']);_0x5cb35f['filters']=_[_0x6ea9('0x3a')](_0x5cb35f[_0x6ea9('0x36')],_0x5cb35f[_0x6ea9('0x38')]);_0x8b8d62[_0x6ea9('0x3b')]=_[_0x6ea9('0x3a')](_0x5cb35f['model'],qs[_0x6ea9('0x3c')](_0x5aa1f6[_0x6ea9('0x38')][_0x6ea9('0x3c')]));_0x8b8d62[_0x6ea9('0x3b')]=_0x8b8d62[_0x6ea9('0x3b')][_0x6ea9('0x3d')]?_0x8b8d62[_0x6ea9('0x3b')]:_0x5cb35f[_0x6ea9('0x36')];if(!_0x5aa1f6['query']['hasOwnProperty']('nolimit')){_0x8b8d62[_0x6ea9('0x24')]=qs[_0x6ea9('0x24')](_0x5aa1f6['query'][_0x6ea9('0x24')]);_0x8b8d62['offset']=qs['offset'](_0x5aa1f6[_0x6ea9('0x38')][_0x6ea9('0x23')]);}_0x8b8d62[_0x6ea9('0x3e')]=qs[_0x6ea9('0x3f')](_0x5aa1f6[_0x6ea9('0x38')][_0x6ea9('0x3f')]);_0x8b8d62[_0x6ea9('0x40')]=qs[_0x6ea9('0x41')](_[_0x6ea9('0x42')](_0x5aa1f6[_0x6ea9('0x38')],_0x5cb35f[_0x6ea9('0x41')]),_0xb0cbc5);if(_0x5aa1f6[_0x6ea9('0x38')]['filter']){_0x8b8d62['where']=_['merge'](_0x8b8d62[_0x6ea9('0x40')],{'$or':_[_0x6ea9('0x37')](_0xb0cbc5,function(_0x122f28){if(_0x122f28[_0x6ea9('0x34')]!==_0x6ea9('0x43')){var _0x20222d={};_0x20222d[_0x122f28[_0x6ea9('0x30')]]={'$like':'%'+_0x5aa1f6[_0x6ea9('0x38')][_0x6ea9('0x44')]+'%'};return _0x20222d;}})});}_0x8b8d62=_[_0x6ea9('0x45')]({},_0x8b8d62,_0x5aa1f6[_0x6ea9('0x46')]);var _0x2b4273={'where':_0x8b8d62['where']};return db[_0x6ea9('0x32')][_0x6ea9('0x47')](_0x2b4273)[_0x6ea9('0x2a')](function(_0x3a6920){_0x3635cb['count']=_0x3a6920;if(_0x5aa1f6['query']['includeAll']){_0x8b8d62[_0x6ea9('0x48')]=[{'all':!![]}];}return db[_0x6ea9('0x32')][_0x6ea9('0x49')](_0x8b8d62);})['then'](function(_0x487e87){_0x3635cb['rows']=_0x487e87;return _0x3635cb;})[_0x6ea9('0x2a')](respondWithFilteredResult(_0x2e2ca2,_0x8b8d62))['catch'](handleError(_0x2e2ca2,null));};exports[_0x6ea9('0x4a')]=function(_0x93fb1a,_0x58cbfe){var _0x2dbe31={'raw':![],'where':{'id':_0x93fb1a['params']['id']}},_0x24ac72={};_0x24ac72[_0x6ea9('0x36')]=_[_0x6ea9('0x39')](db[_0x6ea9('0x32')][_0x6ea9('0x4b')]);_0x24ac72[_0x6ea9('0x38')]=_[_0x6ea9('0x39')](_0x93fb1a['query']);_0x24ac72[_0x6ea9('0x41')]=_['intersection'](_0x24ac72['model'],_0x24ac72['query']);_0x2dbe31[_0x6ea9('0x3b')]=_[_0x6ea9('0x3a')](_0x24ac72['model'],qs[_0x6ea9('0x3c')](_0x93fb1a[_0x6ea9('0x38')]['fields']));_0x2dbe31[_0x6ea9('0x3b')]=_0x2dbe31[_0x6ea9('0x3b')][_0x6ea9('0x3d')]?_0x2dbe31['attributes']:_0x24ac72[_0x6ea9('0x36')];if(_0x93fb1a[_0x6ea9('0x38')][_0x6ea9('0x4c')]){_0x2dbe31['include']=[{'all':!![]}];}_0x2dbe31=_[_0x6ea9('0x45')]({},_0x2dbe31,_0x93fb1a[_0x6ea9('0x46')]);return db[_0x6ea9('0x32')][_0x6ea9('0x4d')](_0x2dbe31)[_0x6ea9('0x2a')](handleEntityNotFound(_0x58cbfe,null))[_0x6ea9('0x2a')](respondWithResult(_0x58cbfe,null))[_0x6ea9('0x4e')](handleError(_0x58cbfe,null));};exports[_0x6ea9('0x4f')]=function(_0x2d2710,_0xa67fac,_0x145559){var _0x554631;return db[_0x6ea9('0x32')][_0x6ea9('0x4f')](_0x2d2710[_0x6ea9('0x50')],{'raw':!![]})['then'](function(_0x4eaa5e){_0x554631=_0x4eaa5e;return db['VoiceContext'][_0x6ea9('0x49')]({'raw':!![]});})[_0x6ea9('0x2a')](function(_0x7e2ef1){var _0x157dce=fs['readFileSync'](path[_0x6ea9('0x51')](config['root'],_0x6ea9('0x52')),'utf8');var _0x33decd=ejs['render'](_0x157dce,{'contexts':_0x7e2ef1||[]});fs[_0x6ea9('0x53')](_0x6ea9('0x54'),_0x33decd);})[_0x6ea9('0x2a')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x6ea9('0x55')});})[_0x6ea9('0x2a')](function(){var _0x231f27=_0x2d2710[_0x6ea9('0x56')][_0x6ea9('0x2b')]({'plain':!![]});if(!_0x231f27)throw new Error(_0x6ea9('0x57'));if(_0x231f27[_0x6ea9('0x58')]==='user'){var _0x35964f=_0x554631[_0x6ea9('0x2b')]({'plain':!![]});return db[_0x6ea9('0x59')][_0x6ea9('0x4d')]({'where':{'name':_0x6ea9('0x2c'),'userProfileId':_0x231f27['userProfileId']},'raw':!![]})[_0x6ea9('0x2a')](function(_0xabf9c3){if(_0xabf9c3&&_0xabf9c3['autoAssociation']===0x0){return db['UserProfileResource'][_0x6ea9('0x4f')]({'name':_0x35964f[_0x6ea9('0x30')],'resourceId':_0x35964f['id'],'type':_0xabf9c3['name'],'sectionId':_0xabf9c3['id']},{})[_0x6ea9('0x2a')](function(){return _0x554631;});}else{return _0x554631;}})[_0x6ea9('0x4e')](function(_0x10b716){logger[_0x6ea9('0x1a')](_0x6ea9('0x5a'),_0x10b716);throw _0x10b716;});}return _0x554631;})[_0x6ea9('0x2a')](respondWithResult(_0xa67fac,0xc9))['catch'](handleError(_0xa67fac,null));};exports['update']=function(_0x52b444,_0xa1679c,_0x355128){var _0x538829;return db[_0x6ea9('0x32')]['find']({'where':{'id':_0x52b444['params']['id']}})[_0x6ea9('0x2a')](handleEntityNotFound(_0xa1679c,null))['then'](saveUpdates(_0x52b444['body'],null))[_0x6ea9('0x2a')](function(_0xa14699){if(_0xa14699){_0x538829=_0xa14699;return db[_0x6ea9('0x32')][_0x6ea9('0x49')]({'raw':!![]});}})[_0x6ea9('0x2a')](function(_0x17fbda){var _0x422d58=fs[_0x6ea9('0x5b')](path['join'](config[_0x6ea9('0x5c')],_0x6ea9('0x52')),_0x6ea9('0x5d'));var _0x22c3c9=ejs[_0x6ea9('0x5e')](_0x422d58,{'contexts':_0x17fbda||[]});fs[_0x6ea9('0x53')](_0x6ea9('0x54'),_0x22c3c9);})['then'](function(){return respondWithRpcPromise('Reload','update',{'module':_0x6ea9('0x55')});})['then'](function(){return _0x538829;})[_0x6ea9('0x2a')](respondWithResult(_0xa1679c,null))[_0x6ea9('0x4e')](handleError(_0xa1679c,null));};exports[_0x6ea9('0x2e')]=function(_0x25d470,_0x2c1fe2,_0x5376bb){var _0x145fee;return db[_0x6ea9('0x32')]['find']({'where':{'id':_0x25d470['params']['id']}})[_0x6ea9('0x2a')](handleEntityNotFound(_0x2c1fe2,null))[_0x6ea9('0x2a')](removeEntity(_0x2c1fe2,null))[_0x6ea9('0x2a')](function(){return db[_0x6ea9('0x32')][_0x6ea9('0x49')]({'raw':!![]});})['then'](function(_0x48630e){var _0x2dc229=fs['readFileSync'](path['join'](config[_0x6ea9('0x5c')],_0x6ea9('0x52')),'utf8');var _0x545174=ejs[_0x6ea9('0x5e')](_0x2dc229,{'contexts':_0x48630e});fs[_0x6ea9('0x53')](_0x6ea9('0x54'),_0x545174);return respondWithRpcPromise(_0x6ea9('0x5f'),_0x6ea9('0x2e'),{'module':_0x6ea9('0x55')});})[_0x6ea9('0x4e')](handleError(_0x2c1fe2,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 2073f49..56f7aa1 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 _0xfd56=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts'];(function(_0x2a7331,_0x4c166c){var _0x9fdaa0=function(_0x3afb19){while(--_0x3afb19){_0x2a7331['push'](_0x2a7331['shift']());}};_0x9fdaa0(++_0x4c166c);}(_0xfd56,0x1d4));var _0x6fd5=function(_0x5ee4cc,_0x4fe51f){_0x5ee4cc=_0x5ee4cc-0x0;var _0x2e4ae2=_0xfd56[_0x5ee4cc];return _0x2e4ae2;};'use strict';var _=require(_0x6fd5('0x0'));var util=require('util');var logger=require(_0x6fd5('0x1'))(_0x6fd5('0x2'));var moment=require(_0x6fd5('0x3'));var BPromise=require(_0x6fd5('0x4'));var rp=require(_0x6fd5('0x5'));var fs=require('fs');var path=require(_0x6fd5('0x6'));var rimraf=require(_0x6fd5('0x7'));var config=require('../../config/environment');var attributes=require(_0x6fd5('0x8'));module[_0x6fd5('0x9')]=function(_0x2945af,_0x4420c6){return _0x2945af[_0x6fd5('0xa')](_0x6fd5('0xb'),attributes,{'tableName':_0x6fd5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6e6=['bluebird','request-promise','path','rimraf','../../config/environment','VoiceContext','lodash','util','../../config/logger','api','moment'];(function(_0x4eb09f,_0x16eaf1){var _0x23c072=function(_0x3ee8e8){while(--_0x3ee8e8){_0x4eb09f['push'](_0x4eb09f['shift']());}};_0x23c072(++_0x16eaf1);}(_0xf6e6,0x1a8));var _0x6f6e=function(_0x5a9f8d,_0x56097e){_0x5a9f8d=_0x5a9f8d-0x0;var _0x43e517=_0xf6e6[_0x5a9f8d];return _0x43e517;};'use strict';var _=require(_0x6f6e('0x0'));var util=require(_0x6f6e('0x1'));var logger=require(_0x6f6e('0x2'))(_0x6f6e('0x3'));var moment=require(_0x6f6e('0x4'));var BPromise=require(_0x6f6e('0x5'));var rp=require(_0x6f6e('0x6'));var fs=require('fs');var path=require(_0x6f6e('0x7'));var rimraf=require(_0x6f6e('0x8'));var config=require(_0x6f6e('0x9'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x572a51,_0x586ea1){return _0x572a51['define'](_0x6f6e('0xa'),attributes,{'tableName':'voice_contexts','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 64a2163..233a407 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 _0x7fb3=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x57c611,_0x37f9e0){var _0x4c06ff=function(_0x3b3ea9){while(--_0x3b3ea9){_0x57c611['push'](_0x57c611['shift']());}};_0x4c06ff(++_0x37f9e0);}(_0x7fb3,0xf9));var _0x37fb=function(_0x3dd531,_0xedaa84){_0x3dd531=_0x3dd531-0x0;var _0x299141=_0x7fb3[_0x3dd531];return _0x299141;};'use strict';var _=require(_0x37fb('0x0'));var util=require(_0x37fb('0x1'));var moment=require(_0x37fb('0x2'));var BPromise=require(_0x37fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37fb('0x4'));var db=require(_0x37fb('0x5'))['db'];var utils=require(_0x37fb('0x6'));var logger=require(_0x37fb('0x7'))('rpc');var config=require(_0x37fb('0x8'));var jayson=require(_0x37fb('0x9'));var client=jayson[_0x37fb('0xa')][_0x37fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x144254,_0x39d6a3,_0x51b36a){return new BPromise(function(_0x5ab1f3,_0x4ee5e0){return client[_0x37fb('0xc')](_0x144254,_0x51b36a)[_0x37fb('0xd')](function(_0x1f4810){logger[_0x37fb('0xe')](_0x37fb('0xf'),_0x39d6a3,_0x37fb('0x10'));logger[_0x37fb('0x11')](_0x37fb('0x12'),_0x39d6a3,'request\x20sent',JSON['stringify'](_0x1f4810));if(_0x1f4810[_0x37fb('0x13')]){if(_0x1f4810[_0x37fb('0x13')][_0x37fb('0x14')]===0x1f4){logger[_0x37fb('0x13')](_0x37fb('0xf'),_0x39d6a3,_0x1f4810[_0x37fb('0x13')][_0x37fb('0x15')]);return _0x4ee5e0(_0x1f4810[_0x37fb('0x13')]['message']);}logger['error'](_0x37fb('0xf'),_0x39d6a3,_0x1f4810[_0x37fb('0x13')][_0x37fb('0x15')]);return _0x5ab1f3(_0x1f4810[_0x37fb('0x13')]['message']);}else{logger[_0x37fb('0xe')]('VoiceContext,\x20%s,\x20%s',_0x39d6a3,_0x37fb('0x10'));_0x5ab1f3(_0x1f4810[_0x37fb('0x16')][_0x37fb('0x15')]);}})[_0x37fb('0x17')](function(_0x42b5ce){logger[_0x37fb('0x13')](_0x37fb('0xf'),_0x39d6a3,_0x42b5ce);_0x4ee5e0(_0x42b5ce);});});} \ No newline at end of file +var _0x4ad3=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x4ad3,0x1b1));var _0x34ad=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x4ad3[_0x4687df];return _0x32eaef;};'use strict';var _=require(_0x34ad('0x0'));var util=require(_0x34ad('0x1'));var moment=require(_0x34ad('0x2'));var BPromise=require(_0x34ad('0x3'));var rs=require(_0x34ad('0x4'));var fs=require('fs');var Redis=require(_0x34ad('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ad('0x6'));var logger=require(_0x34ad('0x7'))(_0x34ad('0x8'));var config=require(_0x34ad('0x9'));var jayson=require(_0x34ad('0xa'));var client=jayson[_0x34ad('0xb')][_0x34ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b927b,_0x674cc7,_0x10d356){return new BPromise(function(_0x4b6c38,_0x582178){return client[_0x34ad('0xd')](_0x3b927b,_0x10d356)[_0x34ad('0xe')](function(_0xb6c4f5){logger[_0x34ad('0xf')]('VoiceContext,\x20%s,\x20%s',_0x674cc7,_0x34ad('0x10'));logger[_0x34ad('0x11')](_0x34ad('0x12'),_0x674cc7,_0x34ad('0x10'),JSON[_0x34ad('0x13')](_0xb6c4f5));if(_0xb6c4f5[_0x34ad('0x14')]){if(_0xb6c4f5[_0x34ad('0x14')][_0x34ad('0x15')]===0x1f4){logger[_0x34ad('0x14')](_0x34ad('0x16'),_0x674cc7,_0xb6c4f5[_0x34ad('0x14')][_0x34ad('0x17')]);return _0x582178(_0xb6c4f5[_0x34ad('0x14')][_0x34ad('0x17')]);}logger[_0x34ad('0x14')](_0x34ad('0x16'),_0x674cc7,_0xb6c4f5['error'][_0x34ad('0x17')]);return _0x4b6c38(_0xb6c4f5[_0x34ad('0x14')][_0x34ad('0x17')]);}else{logger['info'](_0x34ad('0x16'),_0x674cc7,_0x34ad('0x10'));_0x4b6c38(_0xb6c4f5[_0x34ad('0x18')][_0x34ad('0x17')]);}})[_0x34ad('0x19')](function(_0x48e90a){logger[_0x34ad('0x14')]('VoiceContext,\x20%s,\x20%s',_0x674cc7,_0x48e90a);_0x582178(_0x48e90a);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index f5bd550..9042788 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 _0xcd92=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','describe','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x349598,_0x4382e5){var _0x33fa1b=function(_0x1c9a56){while(--_0x1c9a56){_0x349598['push'](_0x349598['shift']());}};_0x33fa1b(++_0x4382e5);}(_0xcd92,0x1b3));var _0x2cd9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcd92[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x2cd9('0x0'));var util=require(_0x2cd9('0x1'));var path=require(_0x2cd9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2cd9('0x3')]();var fs_extra=require(_0x2cd9('0x4'));var auth=require(_0x2cd9('0x5'));var interaction=require(_0x2cd9('0x6'));var config=require(_0x2cd9('0x7'));var controller=require(_0x2cd9('0x8'));router['get']('/',auth[_0x2cd9('0x9')](),controller[_0x2cd9('0xa')]);router[_0x2cd9('0xb')]('/describe',auth[_0x2cd9('0x9')](),controller[_0x2cd9('0xc')]);router[_0x2cd9('0xb')]('/:id',auth[_0x2cd9('0x9')](),controller['show']);router[_0x2cd9('0xd')]('/',auth[_0x2cd9('0x9')](),controller['create']);router['put'](_0x2cd9('0xe'),auth[_0x2cd9('0x9')](),controller[_0x2cd9('0xf')]);router[_0x2cd9('0x10')]('/:id',auth[_0x2cd9('0x9')](),controller[_0x2cd9('0x11')]);module[_0x2cd9('0x12')]=router; \ No newline at end of file +var _0x37a4=['./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../config/environment'];(function(_0x3c25c9,_0x552da8){var _0x33e149=function(_0x29d615){while(--_0x29d615){_0x3c25c9['push'](_0x3c25c9['shift']());}};_0x33e149(++_0x552da8);}(_0x37a4,0xcb));var _0x437a=function(_0x4ca7bb,_0xfde519){_0x4ca7bb=_0x4ca7bb-0x0;var _0x14e575=_0x37a4[_0x4ca7bb];return _0x14e575;};'use strict';var multer=require(_0x437a('0x0'));var util=require('util');var path=require(_0x437a('0x1'));var timeout=require('connect-timeout');var express=require(_0x437a('0x2'));var router=express[_0x437a('0x3')]();var fs_extra=require(_0x437a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x437a('0x5'));var controller=require(_0x437a('0x6'));router[_0x437a('0x7')]('/',auth[_0x437a('0x8')](),controller['index']);router[_0x437a('0x7')](_0x437a('0x9'),auth['isAuthenticated'](),controller[_0x437a('0xa')]);router[_0x437a('0x7')](_0x437a('0xb'),auth[_0x437a('0x8')](),controller[_0x437a('0xc')]);router[_0x437a('0xd')]('/',auth[_0x437a('0x8')](),controller[_0x437a('0xe')]);router[_0x437a('0xf')](_0x437a('0xb'),auth[_0x437a('0x8')](),controller['update']);router[_0x437a('0x10')](_0x437a('0xb'),auth[_0x437a('0x8')](),controller[_0x437a('0x11')]);module[_0x437a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 90d2458..e45e512 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 _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x2151e3,_0x527b00){var _0x10bd23=function(_0x9d1ae9){while(--_0x9d1ae9){_0x2151e3['push'](_0x2151e3['shift']());}};_0x10bd23(++_0x527b00);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4e1472,_0x4e428b){_0x4e1472=_0x4e1472-0x0;var _0x4cc2da=_0x6f0d[_0x4e1472];return _0x4cc2da;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file +var _0xa41a=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x2f2ce4,_0xe81350){var _0x517cb9=function(_0x170cce){while(--_0x170cce){_0x2f2ce4['push'](_0x2f2ce4['shift']());}};_0x517cb9(++_0xe81350);}(_0xa41a,0x6b));var _0xaa41=function(_0x5e9dc5,_0x1f9a00){_0x5e9dc5=_0x5e9dc5-0x0;var _0x14fcd9=_0xa41a[_0x5e9dc5];return _0x14fcd9;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x2')]},'channelstate':{'type':Sequelize[_0xaa41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'calleridnum':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'language':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa41('0x2')]},'exten':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaa41('0x2')]},'destchannel':{'type':Sequelize[_0xaa41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridname':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'destlanguage':{'type':Sequelize[_0xaa41('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa41('0x2')]},'destcontext':{'type':Sequelize[_0xaa41('0x2')]},'destexten':{'type':Sequelize[_0xaa41('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaa41('0x2')]},'destlinkedid':{'type':Sequelize[_0xaa41('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa41('0x4')]},'lastevent':{'type':Sequelize[_0xaa41('0x2')],'comment':_0xaa41('0x5')},'routeId':{'type':Sequelize[_0xaa41('0x3')]},'duration':{'type':Sequelize[_0xaa41('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 08d551d..6c64c80 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 _0x57f0=['filter','options','VoiceDialReport','then','includeAll','include','findAll','rows','show','params','length','merge','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','end','error','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL'];(function(_0x18cf72,_0x12c3be){var _0x1c7c05=function(_0x52f7e0){while(--_0x52f7e0){_0x18cf72['push'](_0x18cf72['shift']());}};_0x1c7c05(++_0x12c3be);}(_0x57f0,0x14a));var _0x057f=function(_0x252d7e,_0x20a71c){_0x252d7e=_0x252d7e-0x0;var _0x2afaba=_0x57f0[_0x252d7e];return _0x2afaba;};'use strict';var emlformat=require(_0x057f('0x0'));var rimraf=require(_0x057f('0x1'));var zipdir=require(_0x057f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x057f('0x3'));var moment=require(_0x057f('0x4'));var BPromise=require(_0x057f('0x5'));var Mustache=require('mustache');var util=require(_0x057f('0x6'));var path=require(_0x057f('0x7'));var sox=require(_0x057f('0x8'));var csv=require('to-csv');var ejs=require(_0x057f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x057f('0xa'));var squel=require(_0x057f('0xb'));var crypto=require(_0x057f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x057f('0xd'));var querystring=require(_0x057f('0xe'));var Papa=require(_0x057f('0xf'));var Redis=require(_0x057f('0x10'));var authService=require(_0x057f('0x11'));var qs=require(_0x057f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x057f('0x13'));var logger=require(_0x057f('0x14'))(_0x057f('0x15'));var utils=require('../../config/utils');var config=require(_0x057f('0x16'));var licenseUtil=require(_0x057f('0x17'));var db=require(_0x057f('0x18'))['db'];function respondWithStatusCode(_0x4685e8,_0x35e686){_0x35e686=_0x35e686||0xcc;return function(_0x319a99){if(_0x319a99){return _0x4685e8[_0x057f('0x19')](_0x35e686);}return _0x4685e8[_0x057f('0x1a')](_0x35e686)['end']();};}function respondWithResult(_0x332950,_0x1a7625){_0x1a7625=_0x1a7625||0xc8;return function(_0x34f5fa){if(_0x34f5fa){return _0x332950[_0x057f('0x1a')](_0x1a7625)['json'](_0x34f5fa);}};}function respondWithFilteredResult(_0x25fbf8,_0x18b1cf){return function(_0x460ac0){if(_0x460ac0){var _0x24fe68=typeof _0x18b1cf['offset']==='undefined'&&typeof _0x18b1cf[_0x057f('0x1b')]===_0x057f('0x1c');var _0xe4667=_0x460ac0['count'];var _0x55f55e=_0x24fe68?0x0:_0x18b1cf['offset'];var _0x5c8f85=_0x24fe68?_0x460ac0[_0x057f('0x1d')]:_0x18b1cf[_0x057f('0x1e')]+_0x18b1cf[_0x057f('0x1b')];var _0x319ba2;if(_0x5c8f85>=_0xe4667){_0x5c8f85=_0xe4667;_0x319ba2=0xc8;}else{_0x319ba2=0xce;}_0x25fbf8[_0x057f('0x1a')](_0x319ba2);return _0x25fbf8[_0x057f('0x1f')](_0x057f('0x20'),_0x55f55e+'-'+_0x5c8f85+'/'+_0xe4667)[_0x057f('0x21')](_0x460ac0);}return null;};}function patchUpdates(_0x2c6848){return function(_0x55ecdd){try{jsonpatch[_0x057f('0x22')](_0x55ecdd,_0x2c6848,!![]);}catch(_0x530124){return BPromise[_0x057f('0x23')](_0x530124);}return _0x55ecdd[_0x057f('0x24')]();};}function saveUpdates(_0x2b870c,_0x3c3433){return function(_0x35b9ad){if(_0x35b9ad){return _0x35b9ad[_0x057f('0x25')](_0x2b870c)['then'](function(_0x135c90){return _0x135c90;});}return null;};}function removeEntity(_0x244f7,_0x433be7){return function(_0x570263){if(_0x570263){return _0x570263['destroy']()['then'](function(){_0x244f7['status'](0xcc)[_0x057f('0x26')]();});}};}function handleEntityNotFound(_0x5ba746,_0x4b2384){return function(_0xae92b0){if(!_0xae92b0){_0x5ba746[_0x057f('0x19')](0x194);}return _0xae92b0;};}function handleError(_0x592e47,_0x2c0312){_0x2c0312=_0x2c0312||0x1f4;return function(_0xef2291){logger[_0x057f('0x27')](_0xef2291['stack']);if(_0xef2291['name']){delete _0xef2291[_0x057f('0x28')];}_0x592e47[_0x057f('0x1a')](_0x2c0312)['send'](_0xef2291);};}exports[_0x057f('0x29')]=function(_0x2606f5,_0x2f5857){var _0x1350f4={},_0x59c7e6={},_0x18b5a8={'count':0x0,'rows':[]};var _0x15a561=_[_0x057f('0x2a')](db['VoiceDialReport'][_0x057f('0x2b')],function(_0xd08cd0){return{'name':_0xd08cd0[_0x057f('0x2c')],'type':_0xd08cd0[_0x057f('0x2d')]['key']};});_0x59c7e6[_0x057f('0x2e')]=_[_0x057f('0x2a')](_0x15a561,_0x057f('0x28'));_0x59c7e6[_0x057f('0x2f')]=_[_0x057f('0x30')](_0x2606f5[_0x057f('0x2f')]);_0x59c7e6[_0x057f('0x31')]=_[_0x057f('0x32')](_0x59c7e6[_0x057f('0x2e')],_0x59c7e6[_0x057f('0x2f')]);_0x1350f4[_0x057f('0x33')]=_[_0x057f('0x32')](_0x59c7e6['model'],qs[_0x057f('0x34')](_0x2606f5[_0x057f('0x2f')]['fields']));_0x1350f4[_0x057f('0x33')]=_0x1350f4[_0x057f('0x33')]['length']?_0x1350f4[_0x057f('0x33')]:_0x59c7e6[_0x057f('0x2e')];if(!_0x2606f5[_0x057f('0x2f')][_0x057f('0x35')](_0x057f('0x36'))){_0x1350f4[_0x057f('0x1b')]=qs['limit'](_0x2606f5['query'][_0x057f('0x1b')]);_0x1350f4['offset']=qs[_0x057f('0x1e')](_0x2606f5[_0x057f('0x2f')][_0x057f('0x1e')]);}_0x1350f4[_0x057f('0x37')]=qs[_0x057f('0x38')](_0x2606f5[_0x057f('0x2f')][_0x057f('0x38')]);_0x1350f4[_0x057f('0x39')]=qs[_0x057f('0x31')](_[_0x057f('0x3a')](_0x2606f5['query'],_0x59c7e6['filters']),_0x15a561);if(_0x2606f5[_0x057f('0x2f')]['filter']){_0x1350f4[_0x057f('0x39')]=_['merge'](_0x1350f4[_0x057f('0x39')],{'$or':_[_0x057f('0x2a')](_0x15a561,function(_0x2d2eef){if(_0x2d2eef['type']!==_0x057f('0x3b')){var _0x496575={};_0x496575[_0x2d2eef[_0x057f('0x28')]]={'$like':'%'+_0x2606f5[_0x057f('0x2f')][_0x057f('0x3c')]+'%'};return _0x496575;}})});}_0x1350f4=_['merge']({},_0x1350f4,_0x2606f5[_0x057f('0x3d')]);var _0x1b09f4={'where':_0x1350f4['where']};return db[_0x057f('0x3e')][_0x057f('0x1d')](_0x1b09f4)[_0x057f('0x3f')](function(_0x1061f2){_0x18b5a8[_0x057f('0x1d')]=_0x1061f2;if(_0x2606f5[_0x057f('0x2f')][_0x057f('0x40')]){_0x1350f4[_0x057f('0x41')]=[{'all':!![]}];}return db[_0x057f('0x3e')][_0x057f('0x42')](_0x1350f4);})[_0x057f('0x3f')](function(_0x9ba6dd){_0x18b5a8[_0x057f('0x43')]=_0x9ba6dd;return _0x18b5a8;})[_0x057f('0x3f')](respondWithFilteredResult(_0x2f5857,_0x1350f4))['catch'](handleError(_0x2f5857,null));};exports[_0x057f('0x44')]=function(_0x2ca058,_0x440b5a){var _0x12d2cd={'raw':!![],'where':{'id':_0x2ca058[_0x057f('0x45')]['id']}},_0x22709b={};_0x22709b[_0x057f('0x2e')]=_[_0x057f('0x30')](db[_0x057f('0x3e')][_0x057f('0x2b')]);_0x22709b[_0x057f('0x2f')]=_[_0x057f('0x30')](_0x2ca058[_0x057f('0x2f')]);_0x22709b['filters']=_[_0x057f('0x32')](_0x22709b['model'],_0x22709b[_0x057f('0x2f')]);_0x12d2cd[_0x057f('0x33')]=_[_0x057f('0x32')](_0x22709b['model'],qs['fields'](_0x2ca058[_0x057f('0x2f')]['fields']));_0x12d2cd['attributes']=_0x12d2cd[_0x057f('0x33')][_0x057f('0x46')]?_0x12d2cd[_0x057f('0x33')]:_0x22709b[_0x057f('0x2e')];if(_0x2ca058[_0x057f('0x2f')][_0x057f('0x40')]){_0x12d2cd[_0x057f('0x41')]=[{'all':!![]}];}_0x12d2cd=_[_0x057f('0x47')]({},_0x12d2cd,_0x2ca058[_0x057f('0x3d')]);return db[_0x057f('0x3e')]['find'](_0x12d2cd)[_0x057f('0x3f')](handleEntityNotFound(_0x440b5a,null))[_0x057f('0x3f')](respondWithResult(_0x440b5a,null))[_0x057f('0x48')](handleError(_0x440b5a,null));};exports[_0x057f('0x49')]=function(_0x496e17,_0x2f649c){return db[_0x057f('0x3e')][_0x057f('0x49')](_0x496e17[_0x057f('0x4a')],{})[_0x057f('0x3f')](respondWithResult(_0x2f649c,0xc9))[_0x057f('0x48')](handleError(_0x2f649c,null));};exports[_0x057f('0x25')]=function(_0x4bbf64,_0x24cd95){if(_0x4bbf64[_0x057f('0x4a')]['id']){delete _0x4bbf64[_0x057f('0x4a')]['id'];}return db[_0x057f('0x3e')][_0x057f('0x4b')]({'where':{'id':_0x4bbf64[_0x057f('0x45')]['id']}})[_0x057f('0x3f')](handleEntityNotFound(_0x24cd95,null))['then'](saveUpdates(_0x4bbf64['body'],null))['then'](respondWithResult(_0x24cd95,null))['catch'](handleError(_0x24cd95,null));};exports[_0x057f('0x4c')]=function(_0x4d688a,_0x17d5cc){return db[_0x057f('0x3e')][_0x057f('0x4b')]({'where':{'id':_0x4d688a[_0x057f('0x45')]['id']}})[_0x057f('0x3f')](handleEntityNotFound(_0x17d5cc,null))[_0x057f('0x3f')](removeEntity(_0x17d5cc,null))['catch'](handleError(_0x17d5cc,null));};exports[_0x057f('0x4d')]=function(_0x424a26,_0xcbcca9){return db['VoiceDialReport']['describe']()[_0x057f('0x3f')](respondWithResult(_0xcbcca9,null))[_0x057f('0x48')](handleError(_0xcbcca9,null));}; \ No newline at end of file +var _0xfdfa=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','include','VoiceDialReport','findAll','rows','catch','show','create','body','find','params','describe','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','jsforce','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','json','offset','undefined','limit','count','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0x51a6d6,_0x3c9c49){var _0x5ef1a8=function(_0x8ff84a){while(--_0x8ff84a){_0x51a6d6['push'](_0x51a6d6['shift']());}};_0x5ef1a8(++_0x3c9c49);}(_0xfdfa,0x127));var _0xafdf=function(_0x47beeb,_0x8b8e6){_0x47beeb=_0x47beeb-0x0;var _0x7ccb0b=_0xfdfa[_0x47beeb];return _0x7ccb0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xafdf('0x0'));var jsonpatch=require(_0xafdf('0x1'));var rp=require('request-promise');var moment=require(_0xafdf('0x2'));var BPromise=require(_0xafdf('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xafdf('0x4'));var sox=require('sox');var csv=require(_0xafdf('0x5'));var ejs=require(_0xafdf('0x6'));var fs=require('fs');var fs_extra=require(_0xafdf('0x7'));var _=require(_0xafdf('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xafdf('0x9'));var deskjs=require(_0xafdf('0xa'));var toCsv=require(_0xafdf('0x5'));var querystring=require(_0xafdf('0xb'));var Papa=require(_0xafdf('0xc'));var Redis=require('ioredis');var authService=require(_0xafdf('0xd'));var qs=require(_0xafdf('0xe'));var as=require(_0xafdf('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xafdf('0x10'))('api');var utils=require(_0xafdf('0x11'));var config=require(_0xafdf('0x12'));var licenseUtil=require(_0xafdf('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x169215,_0x87fa21){_0x87fa21=_0x87fa21||0xcc;return function(_0x3f9ed0){if(_0x3f9ed0){return _0x169215[_0xafdf('0x14')](_0x87fa21);}return _0x169215[_0xafdf('0x15')](_0x87fa21)[_0xafdf('0x16')]();};}function respondWithResult(_0x56276c,_0x2902cf){_0x2902cf=_0x2902cf||0xc8;return function(_0x3b5d39){if(_0x3b5d39){return _0x56276c['status'](_0x2902cf)[_0xafdf('0x17')](_0x3b5d39);}};}function respondWithFilteredResult(_0x454e46,_0x298c12){return function(_0x1f14fc){if(_0x1f14fc){var _0x6317c2=typeof _0x298c12[_0xafdf('0x18')]===_0xafdf('0x19')&&typeof _0x298c12[_0xafdf('0x1a')]===_0xafdf('0x19');var _0xb69c25=_0x1f14fc[_0xafdf('0x1b')];var _0x3b1125=_0x6317c2?0x0:_0x298c12['offset'];var _0x41dfbb=_0x6317c2?_0x1f14fc[_0xafdf('0x1b')]:_0x298c12[_0xafdf('0x18')]+_0x298c12[_0xafdf('0x1a')];var _0x530e3d;if(_0x41dfbb>=_0xb69c25){_0x41dfbb=_0xb69c25;_0x530e3d=0xc8;}else{_0x530e3d=0xce;}_0x454e46[_0xafdf('0x15')](_0x530e3d);return _0x454e46['set']('Content-Range',_0x3b1125+'-'+_0x41dfbb+'/'+_0xb69c25)[_0xafdf('0x17')](_0x1f14fc);}return null;};}function patchUpdates(_0x149065){return function(_0x34b40f){try{jsonpatch['apply'](_0x34b40f,_0x149065,!![]);}catch(_0x447cdf){return BPromise[_0xafdf('0x1c')](_0x447cdf);}return _0x34b40f[_0xafdf('0x1d')]();};}function saveUpdates(_0x3f99bd,_0x199b55){return function(_0x16aec7){if(_0x16aec7){return _0x16aec7[_0xafdf('0x1e')](_0x3f99bd)[_0xafdf('0x1f')](function(_0x1232b0){return _0x1232b0;});}return null;};}function removeEntity(_0x59f728,_0x1318be){return function(_0x327ba5){if(_0x327ba5){return _0x327ba5[_0xafdf('0x20')]()[_0xafdf('0x1f')](function(){_0x59f728['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bfde0,_0x12f397){return function(_0x9a29e1){if(!_0x9a29e1){_0x1bfde0[_0xafdf('0x14')](0x194);}return _0x9a29e1;};}function handleError(_0x47b154,_0xbaca5e){_0xbaca5e=_0xbaca5e||0x1f4;return function(_0x321df8){logger[_0xafdf('0x21')](_0x321df8['stack']);if(_0x321df8['name']){delete _0x321df8[_0xafdf('0x22')];}_0x47b154[_0xafdf('0x15')](_0xbaca5e)[_0xafdf('0x23')](_0x321df8);};}exports[_0xafdf('0x24')]=function(_0x44bdf3,_0x5179d9){var _0x4075bd={},_0xd87c6b={},_0x1198d6={'count':0x0,'rows':[]};var _0x5b8cf5=_['map'](db['VoiceDialReport'][_0xafdf('0x25')],function(_0x2b4998){return{'name':_0x2b4998[_0xafdf('0x26')],'type':_0x2b4998[_0xafdf('0x27')][_0xafdf('0x28')]};});_0xd87c6b[_0xafdf('0x29')]=_[_0xafdf('0x2a')](_0x5b8cf5,_0xafdf('0x22'));_0xd87c6b[_0xafdf('0x2b')]=_[_0xafdf('0x2c')](_0x44bdf3[_0xafdf('0x2b')]);_0xd87c6b[_0xafdf('0x2d')]=_[_0xafdf('0x2e')](_0xd87c6b[_0xafdf('0x29')],_0xd87c6b[_0xafdf('0x2b')]);_0x4075bd['attributes']=_['intersection'](_0xd87c6b[_0xafdf('0x29')],qs[_0xafdf('0x2f')](_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x2f')]));_0x4075bd['attributes']=_0x4075bd[_0xafdf('0x30')][_0xafdf('0x31')]?_0x4075bd['attributes']:_0xd87c6b['model'];if(!_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x32')](_0xafdf('0x33'))){_0x4075bd[_0xafdf('0x1a')]=qs[_0xafdf('0x1a')](_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x1a')]);_0x4075bd[_0xafdf('0x18')]=qs[_0xafdf('0x18')](_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x18')]);}_0x4075bd['order']=qs['sort'](_0x44bdf3[_0xafdf('0x2b')]['sort']);_0x4075bd[_0xafdf('0x34')]=qs['filters'](_['pick'](_0x44bdf3[_0xafdf('0x2b')],_0xd87c6b[_0xafdf('0x2d')]),_0x5b8cf5);if(_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x35')]){_0x4075bd['where']=_[_0xafdf('0x36')](_0x4075bd[_0xafdf('0x34')],{'$or':_['map'](_0x5b8cf5,function(_0x1ce7ce){if(_0x1ce7ce[_0xafdf('0x27')]!=='VIRTUAL'){var _0x317e47={};_0x317e47[_0x1ce7ce[_0xafdf('0x22')]]={'$like':'%'+_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x35')]+'%'};return _0x317e47;}})});}_0x4075bd=_[_0xafdf('0x36')]({},_0x4075bd,_0x44bdf3[_0xafdf('0x37')]);var _0x5ae138={'where':_0x4075bd['where']};return db['VoiceDialReport'][_0xafdf('0x1b')](_0x5ae138)['then'](function(_0x2ed712){_0x1198d6['count']=_0x2ed712;if(_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x38')]){_0x4075bd[_0xafdf('0x39')]=[{'all':!![]}];}return db[_0xafdf('0x3a')][_0xafdf('0x3b')](_0x4075bd);})[_0xafdf('0x1f')](function(_0x2656eb){_0x1198d6[_0xafdf('0x3c')]=_0x2656eb;return _0x1198d6;})[_0xafdf('0x1f')](respondWithFilteredResult(_0x5179d9,_0x4075bd))[_0xafdf('0x3d')](handleError(_0x5179d9,null));};exports[_0xafdf('0x3e')]=function(_0x23b916,_0x5e9c6c){var _0x3367e8={'raw':!![],'where':{'id':_0x23b916['params']['id']}},_0x1bdef2={};_0x1bdef2[_0xafdf('0x29')]=_[_0xafdf('0x2c')](db[_0xafdf('0x3a')][_0xafdf('0x25')]);_0x1bdef2[_0xafdf('0x2b')]=_[_0xafdf('0x2c')](_0x23b916[_0xafdf('0x2b')]);_0x1bdef2['filters']=_[_0xafdf('0x2e')](_0x1bdef2['model'],_0x1bdef2[_0xafdf('0x2b')]);_0x3367e8['attributes']=_[_0xafdf('0x2e')](_0x1bdef2['model'],qs['fields'](_0x23b916[_0xafdf('0x2b')]['fields']));_0x3367e8['attributes']=_0x3367e8[_0xafdf('0x30')][_0xafdf('0x31')]?_0x3367e8['attributes']:_0x1bdef2[_0xafdf('0x29')];if(_0x23b916['query']['includeAll']){_0x3367e8[_0xafdf('0x39')]=[{'all':!![]}];}_0x3367e8=_[_0xafdf('0x36')]({},_0x3367e8,_0x23b916[_0xafdf('0x37')]);return db['VoiceDialReport']['find'](_0x3367e8)[_0xafdf('0x1f')](handleEntityNotFound(_0x5e9c6c,null))[_0xafdf('0x1f')](respondWithResult(_0x5e9c6c,null))[_0xafdf('0x3d')](handleError(_0x5e9c6c,null));};exports[_0xafdf('0x3f')]=function(_0x57c8be,_0x4cadde){return db[_0xafdf('0x3a')][_0xafdf('0x3f')](_0x57c8be[_0xafdf('0x40')],{})[_0xafdf('0x1f')](respondWithResult(_0x4cadde,0xc9))[_0xafdf('0x3d')](handleError(_0x4cadde,null));};exports[_0xafdf('0x1e')]=function(_0xc04bc7,_0x143fe9){if(_0xc04bc7[_0xafdf('0x40')]['id']){delete _0xc04bc7[_0xafdf('0x40')]['id'];}return db[_0xafdf('0x3a')][_0xafdf('0x41')]({'where':{'id':_0xc04bc7[_0xafdf('0x42')]['id']}})[_0xafdf('0x1f')](handleEntityNotFound(_0x143fe9,null))[_0xafdf('0x1f')](saveUpdates(_0xc04bc7['body'],null))[_0xafdf('0x1f')](respondWithResult(_0x143fe9,null))['catch'](handleError(_0x143fe9,null));};exports['destroy']=function(_0x34809d,_0x54ed56){return db[_0xafdf('0x3a')][_0xafdf('0x41')]({'where':{'id':_0x34809d[_0xafdf('0x42')]['id']}})[_0xafdf('0x1f')](handleEntityNotFound(_0x54ed56,null))[_0xafdf('0x1f')](removeEntity(_0x54ed56,null))[_0xafdf('0x3d')](handleError(_0x54ed56,null));};exports[_0xafdf('0x43')]=function(_0x4c1dec,_0xdc31d0){return db[_0xafdf('0x3a')][_0xafdf('0x43')]()[_0xafdf('0x1f')](respondWithResult(_0xdc31d0,null))[_0xafdf('0x3d')](handleError(_0xdc31d0,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 2b613a3..0e81393 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 _0x7536=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','define','uniqueid'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x7536,0xf3));var _0x6753=function(_0x22663b,_0xc8c6e3){_0x22663b=_0x22663b-0x0;var _0x310d0a=_0x7536[_0x22663b];return _0x310d0a;};'use strict';var _=require(_0x6753('0x0'));var util=require(_0x6753('0x1'));var logger=require(_0x6753('0x2'))(_0x6753('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6753('0x4'));var rimraf=require(_0x6753('0x5'));var config=require(_0x6753('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x208b03,_0xaa3ff){return _0x208b03[_0x6753('0x7')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x6753('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb673=['moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','lodash','util','api'];(function(_0x4b6e55,_0x5c1ece){var _0x43918e=function(_0x1bbcea){while(--_0x1bbcea){_0x4b6e55['push'](_0x4b6e55['shift']());}};_0x43918e(++_0x5c1ece);}(_0xb673,0xa5));var _0x3b67=function(_0x5e4258,_0x2e0494){_0x5e4258=_0x5e4258-0x0;var _0x5660cb=_0xb673[_0x5e4258];return _0x5660cb;};'use strict';var _=require(_0x3b67('0x0'));var util=require(_0x3b67('0x1'));var logger=require('../../config/logger')(_0x3b67('0x2'));var moment=require(_0x3b67('0x3'));var BPromise=require(_0x3b67('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b67('0x5'));var rimraf=require(_0x3b67('0x6'));var config=require(_0x3b67('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x3b67('0x8')]=function(_0x4bb159,_0x296e4c){return _0x4bb159[_0x3b67('0x9')](_0x3b67('0xa'),attributes,{'tableName':_0x3b67('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 53b73c9..39bb3b7 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 _0xa8b6=['VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport'];(function(_0x48f7ca,_0x46131c){var _0x566547=function(_0x29b250){while(--_0x29b250){_0x48f7ca['push'](_0x48f7ca['shift']());}};_0x566547(++_0x46131c);}(_0xa8b6,0x106));var _0x6a8b=function(_0x3ef91f,_0x4c470c){_0x3ef91f=_0x3ef91f-0x0;var _0x4efe8a=_0xa8b6[_0x3ef91f];return _0x4efe8a;};'use strict';var _=require(_0x6a8b('0x0'));var util=require(_0x6a8b('0x1'));var moment=require(_0x6a8b('0x2'));var BPromise=require(_0x6a8b('0x3'));var rs=require(_0x6a8b('0x4'));var fs=require('fs');var Redis=require(_0x6a8b('0x5'));var db=require(_0x6a8b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a8b('0x7'))(_0x6a8b('0x8'));var config=require(_0x6a8b('0x9'));var jayson=require(_0x6a8b('0xa'));var client=jayson[_0x6a8b('0xb')][_0x6a8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x476cab,_0xb1001f,_0x5f56d8){return new BPromise(function(_0x417d26,_0x83f2e8){return client[_0x6a8b('0xd')](_0x476cab,_0x5f56d8)[_0x6a8b('0xe')](function(_0x1e7b29){logger[_0x6a8b('0xf')](_0x6a8b('0x10'),_0xb1001f,_0x6a8b('0x11'));logger[_0x6a8b('0x12')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0xb1001f,_0x6a8b('0x11'),JSON[_0x6a8b('0x13')](_0x1e7b29));if(_0x1e7b29[_0x6a8b('0x14')]){if(_0x1e7b29['error'][_0x6a8b('0x15')]===0x1f4){logger['error'](_0x6a8b('0x10'),_0xb1001f,_0x1e7b29[_0x6a8b('0x14')][_0x6a8b('0x16')]);return _0x83f2e8(_0x1e7b29['error'][_0x6a8b('0x16')]);}logger[_0x6a8b('0x14')](_0x6a8b('0x10'),_0xb1001f,_0x1e7b29[_0x6a8b('0x14')]['message']);return _0x417d26(_0x1e7b29[_0x6a8b('0x14')]['message']);}else{logger[_0x6a8b('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0xb1001f,_0x6a8b('0x11'));_0x417d26(_0x1e7b29[_0x6a8b('0x17')][_0x6a8b('0x16')]);}})[_0x6a8b('0x18')](function(_0x3fc466){logger[_0x6a8b('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0xb1001f,_0x3fc466);_0x83f2e8(_0x3fc466);});});}exports[_0x6a8b('0x19')]=function(_0x5e2aee){var _0x563d7d=this;return new Promise(function(_0x3f33cb,_0x5d9ccd){return db[_0x6a8b('0x1a')][_0x6a8b('0x1b')](_0x5e2aee[_0x6a8b('0x1c')],{'raw':_0x5e2aee[_0x6a8b('0x1d')]?_0x5e2aee[_0x6a8b('0x1d')][_0x6a8b('0x1e')]===undefined?!![]:![]:!![]})[_0x6a8b('0xe')](function(_0x1755c4){logger[_0x6a8b('0xf')](_0x6a8b('0x19'),_0x5e2aee);logger[_0x6a8b('0x12')](_0x6a8b('0x19'),_0x5e2aee,JSON['stringify'](_0x1755c4));_0x3f33cb(_0x1755c4);})[_0x6a8b('0x18')](function(_0x364d8d){logger[_0x6a8b('0x14')](_0x6a8b('0x19'),_0x364d8d[_0x6a8b('0x16')],_0x5e2aee);_0x5d9ccd(_0x563d7d[_0x6a8b('0x14')](0x1f4,_0x364d8d['message']));});});};exports[_0x6a8b('0x1f')]=function(_0x5df517){var _0x2cf0e9=this;return new Promise(function(_0x50012a,_0xe29d98){return db[_0x6a8b('0x1a')][_0x6a8b('0x20')](_0x5df517['body'],{'raw':_0x5df517[_0x6a8b('0x1d')]?_0x5df517[_0x6a8b('0x1d')][_0x6a8b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5df517[_0x6a8b('0x1d')]?_0x5df517[_0x6a8b('0x1d')][_0x6a8b('0x21')]||null:null,'attributes':_0x5df517['options']?_0x5df517[_0x6a8b('0x1d')][_0x6a8b('0x22')]||null:null,'limit':_0x5df517[_0x6a8b('0x1d')]?_0x5df517['options'][_0x6a8b('0x23')]||null:null})['then'](function(_0x275281){logger[_0x6a8b('0xf')](_0x6a8b('0x1f'),_0x5df517);logger[_0x6a8b('0x12')]('UpdateVoiceDialReport',_0x5df517,JSON[_0x6a8b('0x13')](_0x275281));_0x50012a(_0x275281);})[_0x6a8b('0x18')](function(_0x31b66b){logger[_0x6a8b('0x14')](_0x6a8b('0x1f'),_0x31b66b[_0x6a8b('0x16')],_0x5df517);_0xe29d98(_0x2cf0e9[_0x6a8b('0x14')](0x1f4,_0x31b66b['message']));});});}; \ No newline at end of file +var _0xfe02=['where','attributes','limit','UpdateVoiceDialReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','then','update','raw'];(function(_0x45b5db,_0x1cc3c5){var _0x10af94=function(_0x22aaed){while(--_0x22aaed){_0x45b5db['push'](_0x45b5db['shift']());}};_0x10af94(++_0x1cc3c5);}(_0xfe02,0x13f));var _0x2fe0=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xfe02[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require(_0x2fe0('0x0'));var util=require(_0x2fe0('0x1'));var moment=require('moment');var BPromise=require(_0x2fe0('0x2'));var rs=require(_0x2fe0('0x3'));var fs=require('fs');var Redis=require(_0x2fe0('0x4'));var db=require(_0x2fe0('0x5'))['db'];var utils=require(_0x2fe0('0x6'));var logger=require(_0x2fe0('0x7'))(_0x2fe0('0x8'));var config=require(_0x2fe0('0x9'));var jayson=require(_0x2fe0('0xa'));var client=jayson[_0x2fe0('0xb')][_0x2fe0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d635d,_0x29b61e,_0x12a721){return new BPromise(function(_0x2a11c5,_0x513eee){return client['request'](_0x1d635d,_0x12a721)['then'](function(_0x575616){logger[_0x2fe0('0xd')](_0x2fe0('0xe'),_0x29b61e,'request\x20sent');logger[_0x2fe0('0xf')](_0x2fe0('0x10'),_0x29b61e,_0x2fe0('0x11'),JSON[_0x2fe0('0x12')](_0x575616));if(_0x575616[_0x2fe0('0x13')]){if(_0x575616[_0x2fe0('0x13')][_0x2fe0('0x14')]===0x1f4){logger[_0x2fe0('0x13')](_0x2fe0('0xe'),_0x29b61e,_0x575616['error']['message']);return _0x513eee(_0x575616['error'][_0x2fe0('0x15')]);}logger[_0x2fe0('0x13')](_0x2fe0('0xe'),_0x29b61e,_0x575616[_0x2fe0('0x13')]['message']);return _0x2a11c5(_0x575616[_0x2fe0('0x13')]['message']);}else{logger['info'](_0x2fe0('0xe'),_0x29b61e,_0x2fe0('0x11'));_0x2a11c5(_0x575616['result'][_0x2fe0('0x15')]);}})[_0x2fe0('0x16')](function(_0x577690){logger[_0x2fe0('0x13')](_0x2fe0('0xe'),_0x29b61e,_0x577690);_0x513eee(_0x577690);});});}exports[_0x2fe0('0x17')]=function(_0x487905){var _0x10c859=this;return new Promise(function(_0xf2c43a,_0x2d01f7){return db[_0x2fe0('0x18')][_0x2fe0('0x19')](_0x487905[_0x2fe0('0x1a')],{'raw':_0x487905[_0x2fe0('0x1b')]?_0x487905[_0x2fe0('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x2fe0('0x1c')](function(_0x48c9b0){logger['info'](_0x2fe0('0x17'),_0x487905);logger[_0x2fe0('0xf')]('CreateVoiceDialReport',_0x487905,JSON['stringify'](_0x48c9b0));_0xf2c43a(_0x48c9b0);})[_0x2fe0('0x16')](function(_0x3bbcc6){logger[_0x2fe0('0x13')](_0x2fe0('0x17'),_0x3bbcc6[_0x2fe0('0x15')],_0x487905);_0x2d01f7(_0x10c859['error'](0x1f4,_0x3bbcc6['message']));});});};exports['UpdateVoiceDialReport']=function(_0x3cbce6){var _0x2a53a4=this;return new Promise(function(_0x44c3a7,_0x4a8b1e){return db[_0x2fe0('0x18')][_0x2fe0('0x1d')](_0x3cbce6[_0x2fe0('0x1a')],{'raw':_0x3cbce6[_0x2fe0('0x1b')]?_0x3cbce6[_0x2fe0('0x1b')][_0x2fe0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cbce6['options']?_0x3cbce6[_0x2fe0('0x1b')][_0x2fe0('0x1f')]||null:null,'attributes':_0x3cbce6['options']?_0x3cbce6[_0x2fe0('0x1b')][_0x2fe0('0x20')]||null:null,'limit':_0x3cbce6['options']?_0x3cbce6[_0x2fe0('0x1b')][_0x2fe0('0x21')]||null:null})[_0x2fe0('0x1c')](function(_0x31f153){logger['info']('UpdateVoiceDialReport',_0x3cbce6);logger[_0x2fe0('0xf')](_0x2fe0('0x22'),_0x3cbce6,JSON[_0x2fe0('0x12')](_0x31f153));_0x44c3a7(_0x31f153);})[_0x2fe0('0x16')](function(_0x20f635){logger['error'](_0x2fe0('0x22'),_0x20f635[_0x2fe0('0x15')],_0x3cbce6);_0x4a8b1e(_0x2a53a4['error'](0x1f4,_0x20f635['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 927fbab..51dc812 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 _0xf149=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','index','get','/:id','isAuthenticated','post','create','/:id/applications','addApplications','put','update'];(function(_0x1daaa4,_0x2a13f8){var _0x4d6a11=function(_0x52ea7f){while(--_0x52ea7f){_0x1daaa4['push'](_0x1daaa4['shift']());}};_0x4d6a11(++_0x2a13f8);}(_0xf149,0xa3));var _0x9f14=function(_0x35af98,_0x103f33){_0x35af98=_0x35af98-0x0;var _0x5f5a62=_0xf149[_0x35af98];return _0x5f5a62;};'use strict';var multer=require(_0x9f14('0x0'));var util=require(_0x9f14('0x1'));var path=require(_0x9f14('0x2'));var timeout=require(_0x9f14('0x3'));var express=require(_0x9f14('0x4'));var router=express[_0x9f14('0x5')]();var fs_extra=require(_0x9f14('0x6'));var auth=require(_0x9f14('0x7'));var interaction=require(_0x9f14('0x8'));var config=require(_0x9f14('0x9'));var controller=require(_0x9f14('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x9f14('0xb')]);router[_0x9f14('0xc')](_0x9f14('0xd'),auth[_0x9f14('0xe')](),controller['show']);router[_0x9f14('0xf')]('/',auth[_0x9f14('0xe')](),controller[_0x9f14('0x10')]);router[_0x9f14('0xf')](_0x9f14('0x11'),auth['isAuthenticated'](),controller[_0x9f14('0x12')]);router[_0x9f14('0x13')](_0x9f14('0xd'),auth[_0x9f14('0xe')](),controller[_0x9f14('0x14')]);router[_0x9f14('0x15')](_0x9f14('0xd'),auth[_0x9f14('0xe')](),controller[_0x9f14('0x16')]);module['exports']=router; \ No newline at end of file +var _0x441a=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create','post','/:id/applications','addApplications'];(function(_0x38c160,_0x1318fa){var _0x780b56=function(_0x51c44e){while(--_0x51c44e){_0x38c160['push'](_0x38c160['shift']());}};_0x780b56(++_0x1318fa);}(_0x441a,0x9e));var _0xa441=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x441a[_0x26b80e];return _0x84a8a8;};'use strict';var multer=require(_0xa441('0x0'));var util=require(_0xa441('0x1'));var path=require(_0xa441('0x2'));var timeout=require(_0xa441('0x3'));var express=require(_0xa441('0x4'));var router=express[_0xa441('0x5')]();var fs_extra=require(_0xa441('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa441('0x7'));var config=require('../../config/environment');var controller=require(_0xa441('0x8'));router[_0xa441('0x9')]('/',auth[_0xa441('0xa')](),controller[_0xa441('0xb')]);router['get'](_0xa441('0xc'),auth[_0xa441('0xa')](),controller[_0xa441('0xd')]);router['post']('/',auth[_0xa441('0xa')](),controller[_0xa441('0xe')]);router[_0xa441('0xf')](_0xa441('0x10'),auth['isAuthenticated'](),controller[_0xa441('0x11')]);router[_0xa441('0x12')](_0xa441('0xc'),auth['isAuthenticated'](),controller[_0xa441('0x13')]);router['delete'](_0xa441('0xc'),auth[_0xa441('0xa')](),controller[_0xa441('0x14')]);module[_0xa441('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 962732b..2a93530 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 _0x172b=['compositeIndex','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','sequelize','exports','STRING'];(function(_0x483b9b,_0x1d3810){var _0x2b4f57=function(_0x25b926){while(--_0x25b926){_0x483b9b['push'](_0x483b9b['shift']());}};_0x2b4f57(++_0x1d3810);}(_0x172b,0x195));var _0xb172=function(_0x3de0ae,_0x50c5df){_0x3de0ae=_0x3de0ae-0x0;var _0x3dadc4=_0x172b[_0x3de0ae];return _0x3dadc4;};'use strict';var Sequelize=require(_0xb172('0x0'));module[_0xb172('0x1')]={'context':{'type':Sequelize[_0xb172('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xb172('0x2')],'allowNull':![],'unique':_0xb172('0x3')},'priority':{'type':Sequelize[_0xb172('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xb172('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xb172('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xb172('0x4')](_0xb172('0x5'),_0xb172('0x6'),_0xb172('0x7'),_0xb172('0x8'),_0xb172('0x9'),'system',_0xb172('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xb172('0x2')]},'interval':{'type':Sequelize[_0xb172('0x2')],'allowNull':![],'defaultValue':_0xb172('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xb172('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xb172('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xb172('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xb172('0xd')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xb172('0xe')},'answer':{'type':Sequelize[_0xb172('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xb172('0xf')],'get':function(_0x16f7f4){return this[_0xb172('0x10')]('exten');}},'alias':{'type':Sequelize[_0xb172('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xa1a0=['wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN'];(function(_0x5955ca,_0x51a601){var _0x1b7ff6=function(_0xe2cfc2){while(--_0xe2cfc2){_0x5955ca['push'](_0x5955ca['shift']());}};_0x1b7ff6(++_0x51a601);}(_0xa1a0,0x81));var _0x0a1a=function(_0x32ce61,_0x2ba733){_0x32ce61=_0x32ce61-0x0;var _0x28eded=_0xa1a0[_0x32ce61];return _0x28eded;};'use strict';var Sequelize=require(_0x0a1a('0x0'));module[_0x0a1a('0x1')]={'context':{'type':Sequelize[_0x0a1a('0x2')],'allowNull':![],'unique':_0x0a1a('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0a1a('0x2')],'allowNull':![],'unique':_0x0a1a('0x3')},'priority':{'type':Sequelize[_0x0a1a('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a1a('0x4')},'appdata':{'type':Sequelize[_0x0a1a('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0a1a('0x5')]('inbound',_0x0a1a('0x6'),_0x0a1a('0x7'),_0x0a1a('0x8'),_0x0a1a('0x9'),_0x0a1a('0xa'),_0x0a1a('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x0a1a('0x2')]},'interval':{'type':Sequelize[_0x0a1a('0x2')],'allowNull':![],'defaultValue':_0x0a1a('0xc')},'IntervalId':{'type':Sequelize[_0x0a1a('0xd')]},'isApp':{'type':Sequelize[_0x0a1a('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a1a('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x0a1a('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x0a1a('0x2')],'defaultValue':_0x0a1a('0xf')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a1a('0x10')],'get':function(_0x11fe44){return this['getDataValue'](_0x0a1a('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index e361953..985ea2e 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 _0x28f7=['mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','isApp','bulkCreate','findAndCountAll','finally','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','then','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','ignore','value','type','find','name','UserProfileResource','destroy','stack','send','index','map','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','UserProfileSection','autoAssociation','error','update','recordingFormat','cutdigits'];(function(_0x5abb1b,_0x53f881){var _0x582ed6=function(_0x27ced7){while(--_0x27ced7){_0x5abb1b['push'](_0x5abb1b['shift']());}};_0x582ed6(++_0x53f881);}(_0x28f7,0x1ce));var _0x728f=function(_0x460397,_0x2d940c){_0x460397=_0x460397-0x0;var _0x5a4afe=_0x28f7[_0x460397];return _0x5a4afe;};'use strict';var _=require('lodash');var Redis=require(_0x728f('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x728f('0x1'))('api');var config=require(_0x728f('0x2'));var db=require('../../mysqldb')['db'];config[_0x728f('0x3')]=_[_0x728f('0x4')](config[_0x728f('0x3')],{'host':_0x728f('0x5'),'port':0x18eb});var socket=require(_0x728f('0x6'))(new Redis(config[_0x728f('0x3')]));require(_0x728f('0x7'))[_0x728f('0x8')](socket);function respondWithStatusCode(_0x15869c,_0x115de8){_0x115de8=_0x115de8||0xcc;return function(_0x36f25b){if(_0x36f25b){return _0x15869c[_0x728f('0x9')](_0x115de8);}return _0x15869c[_0x728f('0xa')](_0x115de8)[_0x728f('0xb')]();};}function respondWithResult(_0x5c05ce,_0x56dd8b){_0x56dd8b=_0x56dd8b||0xc8;return function(_0xef77d7){if(_0xef77d7){return _0x5c05ce[_0x728f('0xa')](_0x56dd8b)[_0x728f('0xc')](_0xef77d7);}};}function respondWithFilteredResult(_0x23c8fe,_0x53f871){return function(_0x14cdb2){if(_0x14cdb2){var _0x4add10=typeof _0x53f871[_0x728f('0xd')]===_0x728f('0xe')&&typeof _0x53f871[_0x728f('0xf')]==='undefined';var _0x2880c7=_0x14cdb2[_0x728f('0x10')];var _0x5c301e=_0x4add10?0x0:_0x53f871[_0x728f('0xd')];var _0x5a195b=_0x4add10?_0x14cdb2[_0x728f('0x10')]:_0x53f871[_0x728f('0xd')]+_0x53f871['limit'];var _0x408fac;if(_0x5a195b>=_0x2880c7){_0x5a195b=_0x2880c7;_0x408fac=0xc8;}else{_0x408fac=0xce;}_0x23c8fe[_0x728f('0xa')](_0x408fac);return _0x23c8fe[_0x728f('0x11')]('Content-Range',_0x5c301e+'-'+_0x5a195b+'/'+_0x2880c7)[_0x728f('0xc')](_0x14cdb2);}return null;};}function removeEntity(_0x4da2a0){return function(_0x24324c){if(_0x24324c){return _0x24324c['destroy']()[_0x728f('0x12')](function(){var _0x272dd4=_0x24324c['get']({'plain':!![]});var _0x27651c=[{'name':_0x728f('0x13'),'value':_0x728f('0x14'),'ignore':![]},{'name':_0x728f('0x15'),'value':_0x728f('0x16'),'ignore':![]},{'name':'InternalRoutes','value':_0x728f('0x17'),'ignore':![]}];var _0x3b7a79=_(_0x27651c)[_0x728f('0x18')](_0x728f('0x19'))['map'](_0x728f('0x1a'))[_0x728f('0x1a')]();if(_['includes'](_0x3b7a79,_0x272dd4[_0x728f('0x1b')])){return;}var _0x5ea8af=_[_0x728f('0x1c')](_0x27651c,[_0x728f('0x1a'),_0x272dd4[_0x728f('0x1b')]])[_0x728f('0x1d')];return db[_0x728f('0x1e')][_0x728f('0x1f')]({'where':{'type':_0x5ea8af,'resourceId':_0x272dd4['id']}})[_0x728f('0x12')](function(){return _0x24324c;});})['then'](function(){_0x4da2a0[_0x728f('0xa')](0xcc)[_0x728f('0xb')]();});}};}function handleEntityNotFound(_0x4ecce){return function(_0x38c76e){if(!_0x38c76e){_0x4ecce[_0x728f('0x9')](0x194);}return _0x38c76e;};}function handleError(_0x480791,_0x410184){_0x410184=_0x410184||0x1f4;return function(_0x2e4360){logger['error'](_0x2e4360[_0x728f('0x20')]);if(_0x2e4360[_0x728f('0x1d')]){delete _0x2e4360[_0x728f('0x1d')];}_0x480791[_0x728f('0xa')](_0x410184)[_0x728f('0x21')](_0x2e4360);};}exports[_0x728f('0x22')]=function(_0x4202da,_0x430797){var _0x2a6751={},_0x4d37de={},_0x5ac44f={'count':0x0,'rows':[]};var _0x356a53=_[_0x728f('0x23')](db[_0x728f('0x24')][_0x728f('0x25')],function(_0x2a50f1){return{'name':_0x2a50f1[_0x728f('0x26')],'type':_0x2a50f1['type'][_0x728f('0x27')]};});_0x4d37de[_0x728f('0x28')]=_['map'](_0x356a53,_0x728f('0x1d'));_0x4d37de[_0x728f('0x29')]=_[_0x728f('0x2a')](_0x4202da[_0x728f('0x29')]);_0x4d37de[_0x728f('0x2b')]=_[_0x728f('0x2c')](_0x4d37de[_0x728f('0x28')],_0x4d37de['query']);_0x2a6751['attributes']=_[_0x728f('0x2c')](_0x4d37de[_0x728f('0x28')],qs[_0x728f('0x2d')](_0x4202da['query'][_0x728f('0x2d')]));_0x2a6751[_0x728f('0x2e')]=_0x2a6751['attributes'][_0x728f('0x2f')]?_0x2a6751[_0x728f('0x2e')]:_0x4d37de[_0x728f('0x28')];if(!_0x4202da[_0x728f('0x29')][_0x728f('0x30')]('nolimit')){_0x2a6751[_0x728f('0xf')]=qs[_0x728f('0xf')](_0x4202da[_0x728f('0x29')][_0x728f('0xf')]);_0x2a6751[_0x728f('0xd')]=qs[_0x728f('0xd')](_0x4202da[_0x728f('0x29')][_0x728f('0xd')]);}_0x2a6751[_0x728f('0x31')]=qs[_0x728f('0x32')](_0x4202da['query']['sort']);_0x2a6751[_0x728f('0x33')]=qs[_0x728f('0x2b')](_[_0x728f('0x34')](_0x4202da['query'],_0x4d37de[_0x728f('0x2b')]),_0x356a53);if(_0x4202da['query'][_0x728f('0x18')]){_0x2a6751[_0x728f('0x33')]=_[_0x728f('0x35')](_0x2a6751[_0x728f('0x33')],{'$or':_[_0x728f('0x23')](_0x356a53,function(_0x327f60){if(_0x327f60[_0x728f('0x1b')]!==_0x728f('0x36')){var _0x24b715={};_0x24b715[_0x327f60['name']]={'$like':'%'+_0x4202da[_0x728f('0x29')][_0x728f('0x18')]+'%'};return _0x24b715;}})});}_0x2a6751=_[_0x728f('0x35')]({},_0x2a6751,_0x4202da[_0x728f('0x37')]);var _0xddd056={'where':_0x2a6751[_0x728f('0x33')]};return db['VoiceExtension']['count'](_0xddd056)[_0x728f('0x12')](function(_0x2f41a8){_0x5ac44f[_0x728f('0x10')]=_0x2f41a8;if(_0x4202da[_0x728f('0x29')][_0x728f('0x38')]){_0x2a6751[_0x728f('0x39')]=[{'all':!![]}];}return db[_0x728f('0x24')][_0x728f('0x3a')](_0x2a6751);})['then'](function(_0x37e860){_0x5ac44f[_0x728f('0x3b')]=_0x37e860;return _0x5ac44f;})[_0x728f('0x12')](respondWithFilteredResult(_0x430797,_0x2a6751))[_0x728f('0x3c')](handleError(_0x430797,null));};exports[_0x728f('0x3d')]=function(_0x373293,_0x41565e){var _0x45f8e3={'raw':![],'where':{'id':_0x373293[_0x728f('0x3e')]['id']}},_0x2a7726={};_0x2a7726[_0x728f('0x28')]=_['keys'](db[_0x728f('0x24')][_0x728f('0x25')]);_0x2a7726['query']=_[_0x728f('0x2a')](_0x373293[_0x728f('0x29')]);_0x2a7726[_0x728f('0x2b')]=_[_0x728f('0x2c')](_0x2a7726[_0x728f('0x28')],_0x2a7726[_0x728f('0x29')]);_0x45f8e3['attributes']=_[_0x728f('0x2c')](_0x2a7726[_0x728f('0x28')],qs['fields'](_0x373293['query']['fields']));_0x45f8e3[_0x728f('0x2e')]=_0x45f8e3[_0x728f('0x2e')]['length']?_0x45f8e3[_0x728f('0x2e')]:_0x2a7726['model'];if(_0x373293[_0x728f('0x29')]['includeAll']){_0x45f8e3['include']=[{'all':!![]}];}_0x45f8e3=_[_0x728f('0x35')]({},_0x45f8e3,_0x373293[_0x728f('0x37')]);return db['VoiceExtension']['find'](_0x45f8e3)['then'](handleEntityNotFound(_0x41565e,null))[_0x728f('0x12')](respondWithResult(_0x41565e,null))['catch'](handleError(_0x41565e,null));};exports['destroy']=function(_0x527c95,_0x587505){return db[_0x728f('0x24')]['find']({'where':{'id':_0x527c95[_0x728f('0x3e')]['id']}})[_0x728f('0x12')](handleEntityNotFound(_0x587505,null))[_0x728f('0x12')](removeEntity(_0x587505,null))[_0x728f('0x3c')](handleError(_0x587505,null));};exports[_0x728f('0x3f')]=function(_0x4d02be,_0x20e01f){if(_0x4d02be[_0x728f('0x40')]['type']==='outbound'&&!_['startsWith'](_0x4d02be['body'][_0x728f('0x41')],'_')){_0x4d02be[_0x728f('0x40')][_0x728f('0x41')]='_'[_0x728f('0x42')](_0x4d02be[_0x728f('0x40')][_0x728f('0x41')]);}return db[_0x728f('0x24')]['create'](_0x4d02be[_0x728f('0x40')],{'raw':![]})['then'](function(_0x2a2b9a){var _0x485a7c=_0x4d02be[_0x728f('0x43')][_0x728f('0x44')]({'plain':!![]});if(!_0x485a7c)throw new Error(_0x728f('0x45'));if(_0x485a7c[_0x728f('0x46')]===_0x728f('0x43')){var _0x6b6196=_0x2a2b9a[_0x728f('0x44')]({'plain':!![]});var _0x33fa54=[{'name':_0x728f('0x13'),'value':_0x728f('0x14')},{'name':_0x728f('0x15'),'value':'outbound'},{'name':_0x728f('0x47'),'value':'internal'}];var _0x5256b4=_[_0x728f('0x1c')](_0x33fa54,[_0x728f('0x1a'),_0x6b6196[_0x728f('0x1b')]])[_0x728f('0x1d')];return db[_0x728f('0x48')]['find']({'where':{'name':_0x5256b4,'userProfileId':_0x485a7c['userProfileId']},'raw':!![]})['then'](function(_0x23ff7e){if(_0x23ff7e&&_0x23ff7e[_0x728f('0x49')]===0x0){return db[_0x728f('0x1e')][_0x728f('0x3f')]({'name':_0x6b6196[_0x728f('0x1d')],'resourceId':_0x6b6196['id'],'type':_0x23ff7e[_0x728f('0x1d')],'sectionId':_0x23ff7e['id']},{})[_0x728f('0x12')](function(){return _0x2a2b9a;});}else{return _0x2a2b9a;}})['catch'](function(_0x571b4c){logger[_0x728f('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x571b4c);throw _0x571b4c;});}return _0x2a2b9a;})[_0x728f('0x12')](respondWithResult(_0x20e01f,0xc9))[_0x728f('0x3c')](handleError(_0x20e01f,null));};exports[_0x728f('0x4b')]=function(_0x11478b,_0x4cfaec){if(_0x11478b[_0x728f('0x40')]['id']){delete _0x11478b[_0x728f('0x40')]['id'];}return db[_0x728f('0x24')][_0x728f('0x1c')]({'where':{'id':_0x11478b[_0x728f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4cfaec,null))['then'](function(_0x4fa40f){if(_0x4fa40f){return db[_0x728f('0x24')][_0x728f('0x4b')](_[_0x728f('0x34')](_0x11478b[_0x728f('0x40')],[_0x728f('0x41'),'context','description',_0x728f('0x4c'),_0x728f('0x4d'),_0x728f('0x4e'),_0x728f('0x4f')]),{'where':{'context':_0x4fa40f['context'],'exten':_0x4fa40f[_0x728f('0x41')]},'individualHooks':!![]})['then'](function(_0x239bde){return _0x239bde;});}return null;})['then'](respondWithStatusCode(_0x4cfaec,null))[_0x728f('0x3c')](handleError(_0x4cfaec,null));};exports[_0x728f('0x50')]=function(_0x560d04,_0x21d2ba){var _0x11ccb0=_0x560d04[_0x728f('0x3e')]['id'];var _0x47060e=_0x560d04[_0x728f('0x40')];var _0x1768b2=0xc8;var _0x264806=null;return db[_0x728f('0x51')][_0x728f('0x52')]({'isolationLevel':db[_0x728f('0x51')][_0x728f('0x53')][_0x728f('0x54')]['READ_COMMITTED']},function(_0x224884){return db[_0x728f('0x24')][_0x728f('0x55')]({'where':{'id':_0x11ccb0},'transaction':_0x224884})[_0x728f('0x12')](function(_0x6bb307){if(_0x6bb307){return db[_0x728f('0x24')]['destroy']({'where':{'VoiceExtensionId':_0x11ccb0},'transaction':_0x224884})['then'](function(){var _0x2b4a0b=_[_0x728f('0x23')](_0x47060e,function(_0xc6761b){_0xc6761b['VoiceExtensionId']=_0x11ccb0;_0xc6761b[_0x728f('0x56')]=!![];return _0xc6761b;});return _0x6bb307['createRouting'](_0x2b4a0b);})['then'](function(_0xfb6a8f){return db[_0x728f('0x24')][_0x728f('0x57')](_0xfb6a8f,{'transaction':_0x224884});});}else{_0x1768b2=0x194;_0x264806=[];}});})['then'](function(){if(_0x1768b2!==0x194){return db[_0x728f('0x24')][_0x728f('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x11ccb0},'order':'cast(priority\x20as\x20unsigned)'})[_0x728f('0x12')](function(_0x35622c){_0x264806=_0x35622c;});}})['catch'](function(_0x942d3e){_0x1768b2=0x1f4;logger[_0x728f('0x4a')](_0x942d3e[_0x728f('0x20')]);if(_0x942d3e[_0x728f('0x1d')]){delete _0x942d3e[_0x728f('0x1d')];}_0x264806=_0x942d3e;})[_0x728f('0x59')](function(){if(_0x264806===null){_0x21d2ba['sendStatus'](_0x1768b2);}else{if(_0x1768b2===0x1f4){_0x21d2ba[_0x728f('0xa')](_0x1768b2)[_0x728f('0x21')](_0x264806);}else{_0x21d2ba[_0x728f('0xa')](_0x1768b2)[_0x728f('0xc')](_0x264806);}}});}; \ No newline at end of file +var _0xaaa3=['outbound','InternalRoutes','internal','filter','ignore','map','find','type','name','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','includeAll','include','findAll','catch','params','create','body','exten','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','value','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes'];(function(_0x29420e,_0x2113c1){var _0x55b018=function(_0x22c422){while(--_0x22c422){_0x29420e['push'](_0x29420e['shift']());}};_0x55b018(++_0x2113c1);}(_0xaaa3,0x158));var _0x3aaa=function(_0xa11e4c,_0x504d25){_0xa11e4c=_0xa11e4c-0x0;var _0x80b15b=_0xaaa3[_0xa11e4c];return _0x80b15b;};'use strict';var _=require(_0x3aaa('0x0'));var Redis=require('ioredis');var qs=require(_0x3aaa('0x1'));var logger=require(_0x3aaa('0x2'))('api');var config=require('../../config/environment');var db=require(_0x3aaa('0x3'))['db'];config[_0x3aaa('0x4')]=_[_0x3aaa('0x5')](config[_0x3aaa('0x4')],{'host':_0x3aaa('0x6'),'port':0x18eb});var socket=require(_0x3aaa('0x7'))(new Redis(config[_0x3aaa('0x4')]));require(_0x3aaa('0x8'))[_0x3aaa('0x9')](socket);function respondWithStatusCode(_0x112e67,_0x5b31e3){_0x5b31e3=_0x5b31e3||0xcc;return function(_0x182156){if(_0x182156){return _0x112e67[_0x3aaa('0xa')](_0x5b31e3);}return _0x112e67[_0x3aaa('0xb')](_0x5b31e3)[_0x3aaa('0xc')]();};}function respondWithResult(_0x29a3a4,_0x5ae1ab){_0x5ae1ab=_0x5ae1ab||0xc8;return function(_0x57af0b){if(_0x57af0b){return _0x29a3a4[_0x3aaa('0xb')](_0x5ae1ab)[_0x3aaa('0xd')](_0x57af0b);}};}function respondWithFilteredResult(_0x11b87f,_0x4393eb){return function(_0x479c17){if(_0x479c17){var _0x5a8afb=typeof _0x4393eb[_0x3aaa('0xe')]===_0x3aaa('0xf')&&typeof _0x4393eb[_0x3aaa('0x10')]===_0x3aaa('0xf');var _0x30f27d=_0x479c17[_0x3aaa('0x11')];var _0x54127d=_0x5a8afb?0x0:_0x4393eb[_0x3aaa('0xe')];var _0x192f01=_0x5a8afb?_0x479c17[_0x3aaa('0x11')]:_0x4393eb[_0x3aaa('0xe')]+_0x4393eb[_0x3aaa('0x10')];var _0x2c2b11;if(_0x192f01>=_0x30f27d){_0x192f01=_0x30f27d;_0x2c2b11=0xc8;}else{_0x2c2b11=0xce;}_0x11b87f[_0x3aaa('0xb')](_0x2c2b11);return _0x11b87f['set'](_0x3aaa('0x12'),_0x54127d+'-'+_0x192f01+'/'+_0x30f27d)['json'](_0x479c17);}return null;};}function removeEntity(_0x4b7e9b){return function(_0x53a065){if(_0x53a065){return _0x53a065[_0x3aaa('0x13')]()[_0x3aaa('0x14')](function(){var _0xc6774d=_0x53a065['get']({'plain':!![]});var _0x46e4e8=[{'name':_0x3aaa('0x15'),'value':_0x3aaa('0x16'),'ignore':![]},{'name':_0x3aaa('0x17'),'value':_0x3aaa('0x18'),'ignore':![]},{'name':_0x3aaa('0x19'),'value':_0x3aaa('0x1a'),'ignore':![]}];var _0x2aaa22=_(_0x46e4e8)[_0x3aaa('0x1b')](_0x3aaa('0x1c'))[_0x3aaa('0x1d')]('value')['value']();if(_['includes'](_0x2aaa22,_0xc6774d['type'])){return;}var _0xa89602=_[_0x3aaa('0x1e')](_0x46e4e8,['value',_0xc6774d[_0x3aaa('0x1f')]])[_0x3aaa('0x20')];return db['UserProfileResource'][_0x3aaa('0x13')]({'where':{'type':_0xa89602,'resourceId':_0xc6774d['id']}})[_0x3aaa('0x14')](function(){return _0x53a065;});})[_0x3aaa('0x14')](function(){_0x4b7e9b[_0x3aaa('0xb')](0xcc)[_0x3aaa('0xc')]();});}};}function handleEntityNotFound(_0x424523){return function(_0x130b20){if(!_0x130b20){_0x424523[_0x3aaa('0xa')](0x194);}return _0x130b20;};}function handleError(_0x528f4b,_0x52ee7f){_0x52ee7f=_0x52ee7f||0x1f4;return function(_0x52e78f){logger[_0x3aaa('0x21')](_0x52e78f[_0x3aaa('0x22')]);if(_0x52e78f[_0x3aaa('0x20')]){delete _0x52e78f['name'];}_0x528f4b['status'](_0x52ee7f)[_0x3aaa('0x23')](_0x52e78f);};}exports[_0x3aaa('0x24')]=function(_0x55365d,_0x597aa8){var _0x3f7066={},_0x4e2fd7={},_0x57b62f={'count':0x0,'rows':[]};var _0x543d00=_['map'](db[_0x3aaa('0x25')][_0x3aaa('0x26')],function(_0x38dc04){return{'name':_0x38dc04[_0x3aaa('0x27')],'type':_0x38dc04['type']['key']};});_0x4e2fd7['model']=_[_0x3aaa('0x1d')](_0x543d00,'name');_0x4e2fd7[_0x3aaa('0x28')]=_[_0x3aaa('0x29')](_0x55365d[_0x3aaa('0x28')]);_0x4e2fd7['filters']=_[_0x3aaa('0x2a')](_0x4e2fd7['model'],_0x4e2fd7[_0x3aaa('0x28')]);_0x3f7066[_0x3aaa('0x2b')]=_[_0x3aaa('0x2a')](_0x4e2fd7['model'],qs['fields'](_0x55365d[_0x3aaa('0x28')][_0x3aaa('0x2c')]));_0x3f7066[_0x3aaa('0x2b')]=_0x3f7066[_0x3aaa('0x2b')][_0x3aaa('0x2d')]?_0x3f7066[_0x3aaa('0x2b')]:_0x4e2fd7[_0x3aaa('0x2e')];if(!_0x55365d[_0x3aaa('0x28')][_0x3aaa('0x2f')](_0x3aaa('0x30'))){_0x3f7066['limit']=qs[_0x3aaa('0x10')](_0x55365d[_0x3aaa('0x28')]['limit']);_0x3f7066[_0x3aaa('0xe')]=qs[_0x3aaa('0xe')](_0x55365d[_0x3aaa('0x28')][_0x3aaa('0xe')]);}_0x3f7066[_0x3aaa('0x31')]=qs['sort'](_0x55365d['query'][_0x3aaa('0x32')]);_0x3f7066[_0x3aaa('0x33')]=qs[_0x3aaa('0x34')](_[_0x3aaa('0x35')](_0x55365d[_0x3aaa('0x28')],_0x4e2fd7[_0x3aaa('0x34')]),_0x543d00);if(_0x55365d['query'][_0x3aaa('0x1b')]){_0x3f7066['where']=_['merge'](_0x3f7066[_0x3aaa('0x33')],{'$or':_[_0x3aaa('0x1d')](_0x543d00,function(_0x4c81eb){if(_0x4c81eb['type']!=='VIRTUAL'){var _0x100494={};_0x100494[_0x4c81eb[_0x3aaa('0x20')]]={'$like':'%'+_0x55365d['query'][_0x3aaa('0x1b')]+'%'};return _0x100494;}})});}_0x3f7066=_[_0x3aaa('0x36')]({},_0x3f7066,_0x55365d[_0x3aaa('0x37')]);var _0x841d0c={'where':_0x3f7066['where']};return db[_0x3aaa('0x25')]['count'](_0x841d0c)[_0x3aaa('0x14')](function(_0xf924b9){_0x57b62f[_0x3aaa('0x11')]=_0xf924b9;if(_0x55365d['query'][_0x3aaa('0x38')]){_0x3f7066[_0x3aaa('0x39')]=[{'all':!![]}];}return db[_0x3aaa('0x25')][_0x3aaa('0x3a')](_0x3f7066);})[_0x3aaa('0x14')](function(_0x1954be){_0x57b62f['rows']=_0x1954be;return _0x57b62f;})['then'](respondWithFilteredResult(_0x597aa8,_0x3f7066))[_0x3aaa('0x3b')](handleError(_0x597aa8,null));};exports['show']=function(_0x330425,_0x1a5971){var _0x3e1973={'raw':![],'where':{'id':_0x330425[_0x3aaa('0x3c')]['id']}},_0x1eaaef={};_0x1eaaef[_0x3aaa('0x2e')]=_['keys'](db[_0x3aaa('0x25')][_0x3aaa('0x26')]);_0x1eaaef[_0x3aaa('0x28')]=_['keys'](_0x330425[_0x3aaa('0x28')]);_0x1eaaef[_0x3aaa('0x34')]=_[_0x3aaa('0x2a')](_0x1eaaef[_0x3aaa('0x2e')],_0x1eaaef[_0x3aaa('0x28')]);_0x3e1973[_0x3aaa('0x2b')]=_[_0x3aaa('0x2a')](_0x1eaaef[_0x3aaa('0x2e')],qs[_0x3aaa('0x2c')](_0x330425[_0x3aaa('0x28')][_0x3aaa('0x2c')]));_0x3e1973['attributes']=_0x3e1973[_0x3aaa('0x2b')][_0x3aaa('0x2d')]?_0x3e1973[_0x3aaa('0x2b')]:_0x1eaaef[_0x3aaa('0x2e')];if(_0x330425['query'][_0x3aaa('0x38')]){_0x3e1973[_0x3aaa('0x39')]=[{'all':!![]}];}_0x3e1973=_[_0x3aaa('0x36')]({},_0x3e1973,_0x330425[_0x3aaa('0x37')]);return db['VoiceExtension'][_0x3aaa('0x1e')](_0x3e1973)[_0x3aaa('0x14')](handleEntityNotFound(_0x1a5971,null))[_0x3aaa('0x14')](respondWithResult(_0x1a5971,null))[_0x3aaa('0x3b')](handleError(_0x1a5971,null));};exports[_0x3aaa('0x13')]=function(_0x3e3c48,_0xab65d2){return db[_0x3aaa('0x25')][_0x3aaa('0x1e')]({'where':{'id':_0x3e3c48[_0x3aaa('0x3c')]['id']}})[_0x3aaa('0x14')](handleEntityNotFound(_0xab65d2,null))[_0x3aaa('0x14')](removeEntity(_0xab65d2,null))[_0x3aaa('0x3b')](handleError(_0xab65d2,null));};exports[_0x3aaa('0x3d')]=function(_0x55390b,_0x4db508){if(_0x55390b[_0x3aaa('0x3e')][_0x3aaa('0x1f')]===_0x3aaa('0x18')&&!_['startsWith'](_0x55390b[_0x3aaa('0x3e')]['exten'],'_')){_0x55390b[_0x3aaa('0x3e')][_0x3aaa('0x3f')]='_'['concat'](_0x55390b[_0x3aaa('0x3e')]['exten']);}return db[_0x3aaa('0x25')]['create'](_0x55390b[_0x3aaa('0x3e')],{'raw':![]})['then'](function(_0x1c08a2){var _0x4c64e6=_0x55390b[_0x3aaa('0x40')][_0x3aaa('0x41')]({'plain':!![]});if(!_0x4c64e6)throw new Error(_0x3aaa('0x42'));if(_0x4c64e6[_0x3aaa('0x43')]==='user'){var _0x527059=_0x1c08a2['get']({'plain':!![]});var _0x37b12a=[{'name':'InboundRoutes','value':_0x3aaa('0x16')},{'name':'OutboundRoutes','value':_0x3aaa('0x18')},{'name':_0x3aaa('0x19'),'value':'internal'}];var _0x212e55=_[_0x3aaa('0x1e')](_0x37b12a,[_0x3aaa('0x44'),_0x527059['type']])['name'];return db[_0x3aaa('0x45')]['find']({'where':{'name':_0x212e55,'userProfileId':_0x4c64e6[_0x3aaa('0x46')]},'raw':!![]})[_0x3aaa('0x14')](function(_0x225b68){if(_0x225b68&&_0x225b68['autoAssociation']===0x0){return db[_0x3aaa('0x47')][_0x3aaa('0x3d')]({'name':_0x527059['name'],'resourceId':_0x527059['id'],'type':_0x225b68[_0x3aaa('0x20')],'sectionId':_0x225b68['id']},{})[_0x3aaa('0x14')](function(){return _0x1c08a2;});}else{return _0x1c08a2;}})[_0x3aaa('0x3b')](function(_0x5bab71){logger['error'](_0x3aaa('0x48'),_0x5bab71);throw _0x5bab71;});}return _0x1c08a2;})[_0x3aaa('0x14')](respondWithResult(_0x4db508,0xc9))['catch'](handleError(_0x4db508,null));};exports[_0x3aaa('0x49')]=function(_0x3ef819,_0x267893){if(_0x3ef819['body']['id']){delete _0x3ef819['body']['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x3ef819[_0x3aaa('0x3c')]['id']}})['then'](handleEntityNotFound(_0x267893,null))[_0x3aaa('0x14')](function(_0x18e3c7){if(_0x18e3c7){return db[_0x3aaa('0x25')]['update'](_[_0x3aaa('0x35')](_0x3ef819[_0x3aaa('0x3e')],[_0x3aaa('0x3f'),'context',_0x3aaa('0x4a'),_0x3aaa('0x4b'),_0x3aaa('0x4c'),_0x3aaa('0x4d'),_0x3aaa('0x4e')]),{'where':{'context':_0x18e3c7[_0x3aaa('0x4f')],'exten':_0x18e3c7['exten']},'individualHooks':!![]})['then'](function(_0x42c440){return _0x42c440;});}return null;})['then'](respondWithStatusCode(_0x267893,null))[_0x3aaa('0x3b')](handleError(_0x267893,null));};exports[_0x3aaa('0x50')]=function(_0x4c7aeb,_0x593ae7){var _0x25f6ff=_0x4c7aeb[_0x3aaa('0x3c')]['id'];var _0x279726=_0x4c7aeb['body'];var _0x56f0a6=0xc8;var _0x38f794=null;return db[_0x3aaa('0x51')][_0x3aaa('0x52')]({'isolationLevel':db[_0x3aaa('0x51')][_0x3aaa('0x53')]['ISOLATION_LEVELS'][_0x3aaa('0x54')]},function(_0x294861){return db[_0x3aaa('0x25')]['findOne']({'where':{'id':_0x25f6ff},'transaction':_0x294861})[_0x3aaa('0x14')](function(_0x5ae007){if(_0x5ae007){return db['VoiceExtension'][_0x3aaa('0x13')]({'where':{'VoiceExtensionId':_0x25f6ff},'transaction':_0x294861})[_0x3aaa('0x14')](function(){var _0x8b86d0=_['map'](_0x279726,function(_0x28f073){_0x28f073[_0x3aaa('0x55')]=_0x25f6ff;_0x28f073[_0x3aaa('0x56')]=!![];return _0x28f073;});return _0x5ae007[_0x3aaa('0x57')](_0x8b86d0);})[_0x3aaa('0x14')](function(_0x4c231f){return db['VoiceExtension'][_0x3aaa('0x58')](_0x4c231f,{'transaction':_0x294861});});}else{_0x56f0a6=0x194;_0x38f794=[];}});})[_0x3aaa('0x14')](function(){if(_0x56f0a6!==0x194){return db[_0x3aaa('0x25')][_0x3aaa('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x25f6ff},'order':_0x3aaa('0x5a')})[_0x3aaa('0x14')](function(_0x583357){_0x38f794=_0x583357;});}})[_0x3aaa('0x3b')](function(_0x2fa175){_0x56f0a6=0x1f4;logger[_0x3aaa('0x21')](_0x2fa175[_0x3aaa('0x22')]);if(_0x2fa175[_0x3aaa('0x20')]){delete _0x2fa175['name'];}_0x38f794=_0x2fa175;})[_0x3aaa('0x5b')](function(){if(_0x38f794===null){_0x593ae7[_0x3aaa('0xa')](_0x56f0a6);}else{if(_0x56f0a6===0x1f4){_0x593ae7[_0x3aaa('0xb')](_0x56f0a6)[_0x3aaa('0x23')](_0x38f794);}else{_0x593ae7['status'](_0x56f0a6)[_0x3aaa('0xd')](_0x38f794);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index f4e6208..67b0dbb 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 _0xe1a3=['VoiceExtension','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3c38a,_0x590548){var _0x16df15=function(_0x1f8983){while(--_0x1f8983){_0x3c38a['push'](_0x3c38a['shift']());}};_0x16df15(++_0x590548);}(_0xe1a3,0x148));var _0x3e1a=function(_0x3bd4a5,_0x2597bd){_0x3bd4a5=_0x3bd4a5-0x0;var _0x41d843=_0xe1a3[_0x3bd4a5];return _0x41d843;};'use strict';var EventEmitter=require(_0x3e1a('0x0'));var VoiceExtension=require(_0x3e1a('0x1'))['db'][_0x3e1a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1fd929){return function(_0x5a335f,_0x36b0d6,_0x191174){VoiceExtensionEvents[_0x3e1a('0x3')](_0x1fd929+':'+_0x5a335f['id'],_0x5a335f);VoiceExtensionEvents[_0x3e1a('0x3')](_0x1fd929,_0x5a335f);_0x191174(null);};}for(var e in events){if(events[_0x3e1a('0x4')](e)){var event=events[e];VoiceExtension[_0x3e1a('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xfd08=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfd08,0x79));var _0x8fd0=function(_0x108d5f,_0x33f82d){_0x108d5f=_0x108d5f-0x0;var _0x456ea3=_0xfd08[_0x108d5f];return _0x456ea3;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x8fd0('0x0'))['db'][_0x8fd0('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x8fd0('0x2')](0x0);var events={'afterCreate':_0x8fd0('0x3'),'afterUpdate':_0x8fd0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x59e7b8){return function(_0x3b03e1,_0x4e6d29,_0x190e1b){VoiceExtensionEvents['emit'](_0x59e7b8+':'+_0x3b03e1['id'],_0x3b03e1);VoiceExtensionEvents[_0x8fd0('0x5')](_0x59e7b8,_0x3b03e1);_0x190e1b(null);};}for(var e in events){if(events[_0x8fd0('0x6')](e)){var event=events[e];VoiceExtension[_0x8fd0('0x7')](e,emitEvent(event));}}module[_0x8fd0('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index c60bad9..54cbcfb 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 _0x5e17=['CDR(type)=outbound','outbound','CDR(routeAlias)=','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','name','param','phone','prefix','${EXTEN:','SIP','join','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','outboundDial','appdata','priority','concat','last','define','VoiceExtension','voice_extensions','then','Hangup','lodash','type','Set','CDR(type)=','context','exten','alias','NoOp','inbound','push','CDR(routeid)=','MONITOR_OPTIONS=ab'];(function(_0x265e0e,_0x38b2bb){var _0x518157=function(_0x1e3eab){while(--_0x1e3eab){_0x265e0e['push'](_0x265e0e['shift']());}};_0x518157(++_0x38b2bb);}(_0x5e17,0x17a));var _0x75e1=function(_0x33a413,_0xce31ae){_0x33a413=_0x33a413-0x0;var _0x439361=_0x5e17[_0x33a413];return _0x439361;};'use strict';var _=require(_0x75e1('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x4c7527){var _0x55bd67=_0x4c7527['models'];function _0x43afe6(_0x25fc55){var _0x23ec49=0x2;var _0x1e8819=[{'type':_0x25fc55[_0x75e1('0x1')],'app':_0x75e1('0x2'),'appdata':_0x75e1('0x3')+_0x25fc55[_0x75e1('0x1')],'context':_0x25fc55[_0x75e1('0x4')],'exten':_0x25fc55[_0x75e1('0x5')],'priority':_0x23ec49++,'VoiceExtensionId':_0x25fc55['id']},{'type':_0x25fc55[_0x75e1('0x1')],'app':_0x25fc55[_0x75e1('0x6')]?_0x75e1('0x2'):_0x75e1('0x7'),'appdata':_0x25fc55[_0x75e1('0x6')]?'CDR(routeAlias)='+_0x25fc55[_0x75e1('0x6')]:'No\x20alias\x20set','context':_0x25fc55['context'],'exten':_0x25fc55[_0x75e1('0x5')],'priority':_0x23ec49++,'VoiceExtensionId':_0x25fc55['id']}];if(_0x25fc55[_0x75e1('0x1')]===_0x75e1('0x8')){_0x1e8819[_0x75e1('0x9')]({'type':_0x75e1('0x8'),'app':_0x75e1('0x2'),'appdata':_0x75e1('0xa')+_0x25fc55['id'],'context':_0x25fc55[_0x75e1('0x4')],'exten':_0x25fc55['exten'],'priority':_0x23ec49++,'VoiceExtensionId':_0x25fc55['id']});}_0x1e8819[_0x75e1('0x9')]({'type':_0x25fc55[_0x75e1('0x1')],'app':_0x75e1('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x25fc55[_0x75e1('0x4')],'exten':_0x25fc55[_0x75e1('0x5')],'priority':_0x23ec49++,'VoiceExtensionId':_0x25fc55['id']},{'type':_0x25fc55[_0x75e1('0x1')],'app':_0x75e1('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x25fc55[_0x75e1('0x4')],'exten':_0x25fc55[_0x75e1('0x5')],'priority':_0x23ec49++,'VoiceExtensionId':_0x25fc55['id']},{'type':_0x25fc55[_0x75e1('0x1')],'app':_0x75e1('0x2'),'appdata':_0x75e1('0xb'),'context':_0x25fc55[_0x75e1('0x4')],'exten':_0x25fc55[_0x75e1('0x5')],'priority':_0x23ec49++,'VoiceExtensionId':_0x25fc55['id']});return _0x1e8819;}function _0x56c741(_0x4251ea){var _0x14dc9d=0x2;var _0x2128af=[{'type':'outbound','app':_0x75e1('0x2'),'appdata':_0x75e1('0xc'),'context':_0x4251ea['context'],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':_0x4251ea[_0x75e1('0x6')]?'Set':_0x75e1('0x7'),'appdata':_0x4251ea[_0x75e1('0x6')]?_0x75e1('0xe')+_0x4251ea[_0x75e1('0x6')]:_0x75e1('0xf'),'context':_0x4251ea['context'],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':'outbound','app':_0x75e1('0x2'),'appdata':_0x75e1('0x10')+(_0x4251ea[_0x75e1('0x11')]?'${EXTEN:'+_0x4251ea['cutdigits']+'}':_0x75e1('0x12')),'context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':_0x75e1('0x2'),'appdata':_0x75e1('0xa')+_0x4251ea['id'],'context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea['exten'],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':_0x75e1('0x13'),'appdata':_0x75e1('0x14')+(_0x14dc9d+0x2)+_0x75e1('0x15')+(_0x14dc9d+0x1)+')','context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':_0x75e1('0x2'),'appdata':_0x4251ea[_0x75e1('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x4251ea[_0x75e1('0x11')]+'}':_0x75e1('0x16'),'context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea['exten'],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':_0x75e1('0x2'),'appdata':_0x75e1('0x17'),'context':_0x4251ea['context'],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':_0x75e1('0x2'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':'outbound','app':_0x75e1('0x2'),'appdata':_0x75e1('0x18')+_0x4251ea['id'],'context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']}];if(_0x4251ea[_0x75e1('0x19')]('recordingFormat')&&_0x4251ea[_0x75e1('0x1a')]!==_0x75e1('0x1b')){_0x2128af['push']({'type':_0x75e1('0xd'),'app':_0x75e1('0x2'),'appdata':_0x75e1('0x1c'),'context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':'Set','appdata':_0x75e1('0x1d')+_0x4251ea['recordingFormat']||'wav','context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']});}return _0x2128af;}function _0xb5b393(_0x33229d,_0x3682e5){var _0x81c069=[{'name':_0x75e1('0x1e'),'param':0x0},{'name':_0x75e1('0x1f'),'param':0x1},{'name':_0x75e1('0x20'),'param':0x2},{'name':_0x75e1('0x21'),'param':0x3}];var _0x3a6840={};var _0x69520b=_0x3682e5[_0x75e1('0x22')](',');var _0x5779c8=[];for(var _0x2ec108=0x0;_0x2ec108<_0x81c069[_0x75e1('0x23')];_0x2ec108++){switch(_0x81c069[_0x2ec108][_0x75e1('0x24')]){case _0x75e1('0x1e'):_0x3a6840[_0x75e1('0x1e')]=_0x69520b[_0x81c069[_0x2ec108][_0x75e1('0x25')]]['split']('/')[0x1];_0x3a6840[_0x75e1('0x26')]=_0x69520b[_0x81c069[_0x2ec108][_0x75e1('0x25')]][_0x75e1('0x22')]('/')[0x2];_0x3a6840[_0x75e1('0x27')]=_0x3a6840[_0x75e1('0x26')]?_0x3a6840[_0x75e1('0x26')]['split']('$')[0x0]:undefined;_0x3a6840[_0x75e1('0x26')]=_0x33229d[_0x75e1('0x11')]?(_0x3a6840['prefix']||'')+_0x75e1('0x28')+_0x33229d[_0x75e1('0x11')]+'}':(_0x3a6840['prefix']||'')+_0x75e1('0x12');_0x5779c8[_0x81c069[_0x2ec108][_0x75e1('0x25')]]=[_0x75e1('0x29'),_0x3a6840[_0x75e1('0x1e')],_0x3a6840[_0x75e1('0x26')]][_0x75e1('0x2a')]('/');break;case _0x75e1('0x20'):_0x3a6840['options']=_0x69520b[_0x81c069[_0x2ec108][_0x75e1('0x25')]];if(_0x33229d[_0x75e1('0x1a')]!=='none'){if(_0x3a6840[_0x75e1('0x20')]['indexOf'](_0x75e1('0x2b'))<0x0){_0x3a6840[_0x75e1('0x20')]+='U(xcally-mixmonitor-context)';}}else{_0x3a6840['options']=_0x3a6840[_0x75e1('0x20')]['replace'](_0x75e1('0x2b'),'');}_0x5779c8[_0x81c069[_0x2ec108][_0x75e1('0x25')]]=_0x3a6840[_0x75e1('0x20')];break;default:_0x5779c8[_0x81c069[_0x2ec108][_0x75e1('0x25')]]=_0x69520b[_0x81c069[_0x2ec108]['param']];}}return _0x5779c8[_0x75e1('0x2a')](',');}function _0x28e964(_0x17f1de,_0x12137b,_0xb50d2e){return new Promise(function(_0x4f9f13,_0x10c0b0){var _0x221c97=[];if(_[_0x75e1('0x2c')](_0x12137b))return _0x4f9f13(_0x221c97);_0x55bd67[_0x75e1('0x2d')][_0x75e1('0x2e')]({'attributes':['id',_0x75e1('0x2f'),_0x75e1('0x30')],'raw':!![]})['then'](function(_0x3b377b){for(var _0x573c38=0x0,_0x24ddce=0x0;_0x573c38<_0x12137b[_0x75e1('0x23')];_0x573c38++,_0x24ddce=0x0){var _0x127b6e=_0x12137b[_0x573c38];var _0x5501d6=[];var _0x239bcd=[];delete _0x127b6e['id'];if(_0x127b6e['interval']!==_0x75e1('0x31')){_0x127b6e[_0x75e1('0x32')]=[_0x127b6e[_0x75e1('0x2f')]];}else{_0x127b6e[_0x75e1('0x32')]=_0x127b6e['IntervalId']?_[_0x75e1('0x33')](_[_0x75e1('0x34')](_0x3b377b,{'IntervalId':_0x127b6e[_0x75e1('0x30')]}),_0x75e1('0x2f')):[];}_0x127b6e[_0x75e1('0x4')]=_0x17f1de[_0x75e1('0x4')];_0x127b6e[_0x75e1('0x5')]=_0x17f1de[_0x75e1('0x5')];if(_0x127b6e[_0x75e1('0x1')])_0x127b6e[_0x75e1('0x1')]=_0x127b6e[_0x75e1('0x1')][_0x75e1('0x35')]();if(_0x17f1de[_0x75e1('0x1')]===_0x75e1('0xd')){if(_0x127b6e['hasOwnProperty'](_0x75e1('0x36'))&&_0x127b6e[_0x75e1('0x36')]&&_0x127b6e[_0x75e1('0x36')]!=='--'){_0x5501d6[_0x75e1('0x9')]({'type':_0x127b6e['type']['toLowerCase'](),'app':'Set','appdata':_0x75e1('0x37')+_0x127b6e[_0x75e1('0x36')],'context':_0x17f1de[_0x75e1('0x4')],'exten':_0x17f1de['exten'],'priority':_0x127b6e['intervals'][_0x75e1('0x23')]+_0xb50d2e+_0x24ddce++,'VoiceExtensionId':_0x17f1de['id']});}_0x5501d6[_0x75e1('0x9')]({'type':_0x127b6e[_0x75e1('0x1')][_0x75e1('0x35')](),'app':_0x75e1('0x13'),'appdata':_0x75e1('0x38')+(_0x127b6e[_0x75e1('0x39')]?_0x75e1('0x3a')+_0x127b6e['callerID']+')':_0x75e1('0x3b')),'context':_0x17f1de[_0x75e1('0x4')],'exten':_0x17f1de['exten'],'priority':_0x127b6e['intervals'][_0x75e1('0x23')]+_0xb50d2e+_0x24ddce++,'VoiceExtensionId':_0x17f1de['id']});}else{if(_0x127b6e[_0x75e1('0x19')](_0x75e1('0x3c'))){if([_0x75e1('0x3d'),_0x75e1('0x3e')][_0x75e1('0x3f')](_0x127b6e[_0x75e1('0x40')][_0x75e1('0x35')]())&&_0x127b6e['appType']!=='custom'){if(_0x127b6e['answer']){_0x5501d6['push']({'type':_0x127b6e[_0x75e1('0x1')][_0x75e1('0x35')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x17f1de['context'],'exten':_0x17f1de['exten'],'priority':_0x127b6e[_0x75e1('0x32')][_0x75e1('0x23')]+_0xb50d2e+_0x24ddce++,'VoiceExtensionId':_0x17f1de['id']});_0x5501d6[_0x75e1('0x9')]({'type':_0x127b6e[_0x75e1('0x1')][_0x75e1('0x35')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x17f1de[_0x75e1('0x4')],'exten':_0x17f1de[_0x75e1('0x5')],'priority':_0x127b6e[_0x75e1('0x32')][_0x75e1('0x23')]+_0xb50d2e+_0x24ddce++,'VoiceExtensionId':_0x17f1de['id']});}else{_0x5501d6['push']({'type':_0x127b6e[_0x75e1('0x1')][_0x75e1('0x35')](),'app':_0x75e1('0x13'),'appdata':_0x75e1('0x41'),'context':_0x17f1de[_0x75e1('0x4')],'exten':_0x17f1de[_0x75e1('0x5')],'priority':_0x127b6e[_0x75e1('0x32')][_0x75e1('0x23')]+_0xb50d2e+_0x24ddce++,'VoiceExtensionId':_0x17f1de['id']});_0x5501d6['push']({'type':_0x127b6e['type']['toLowerCase'](),'app':_0x75e1('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x17f1de['context'],'exten':_0x17f1de['exten'],'priority':_0x127b6e[_0x75e1('0x32')][_0x75e1('0x23')]+_0xb50d2e+_0x24ddce++,'VoiceExtensionId':_0x17f1de['id']});}}}}for(var _0x9d7a02=0x0;_0x9d7a02<_0x127b6e[_0x75e1('0x32')]['length'];_0x9d7a02++){var _0x527d73=_0xb50d2e+_0x127b6e[_0x75e1('0x32')]['length'];var _0x5551b7=_0x9d7a02===_0x127b6e[_0x75e1('0x32')][_0x75e1('0x23')]-0x1?_0xb50d2e+_0x5501d6[_0x75e1('0x23')]+_0x239bcd[_0x75e1('0x23')]+0x2:_0xb50d2e+_0x9d7a02+0x1;_0x5501d6[_0x75e1('0x42')](_0x9d7a02,0x0,{'type':_0x17f1de[_0x75e1('0x1')],'app':'GotoIfTime','appdata':_0x127b6e[_0x75e1('0x32')][_0x9d7a02]+'?'+_0x17f1de['context']+_0x75e1('0x43')+_0x527d73+':'+_0x17f1de[_0x75e1('0x4')]+_0x75e1('0x43')+_0x5551b7,'exten':_0x17f1de[_0x75e1('0x5')],'context':_0x17f1de[_0x75e1('0x4')],'priority':_0xb50d2e+_0x9d7a02,'VoiceExtensionId':_0x17f1de['id']});}if(_0x127b6e['appType']===_0x75e1('0x44'))_0x127b6e[_0x75e1('0x45')]=_0xb5b393(_0x17f1de,_0x127b6e['appdata']);_0x127b6e[_0x75e1('0x46')]=_0x5501d6['length']?_['last'](_0x5501d6)[_0x75e1('0x46')]+0x1:_0xb50d2e;_0x221c97=_[_0x75e1('0x47')](_0x221c97,_0x5501d6,[_0x127b6e],_0x239bcd);_0xb50d2e=_[_0x75e1('0x48')](_0x221c97)['priority']+0x1;}return _0x4f9f13(_0x221c97);})['catch'](function(_0x3b42a8){_0x10c0b0(_0x3b42a8);});});}return _0x4c7527[_0x75e1('0x49')](_0x75e1('0x4a'),attributes,{'tableName':_0x75e1('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5b9111){var _0x4b1d6e=this['get']({'plain':!![]});var _0x28b141=_0x4b1d6e['type']==='outbound'?_0x56c741(_0x4b1d6e):_0x43afe6(_0x4b1d6e);return _0x28e964(_0x4b1d6e,_0x5b9111,_[_0x75e1('0x48')](_0x28b141)[_0x75e1('0x46')]+0x1)[_0x75e1('0x4c')](function(_0x169cbb){var _0x1012f3=_[_0x75e1('0x47')](_0x28b141,_0x169cbb);_0x1012f3[_0x75e1('0x9')]({'type':_0x4b1d6e[_0x75e1('0x1')],'app':_0x75e1('0x4d'),'exten':_0x4b1d6e[_0x75e1('0x5')],'context':_0x4b1d6e[_0x75e1('0x4')],'priority':_[_0x75e1('0x48')](_0x1012f3)['priority']+0x1,'VoiceExtensionId':_0x4b1d6e['id']});return _0x1012f3;});}}});}; \ No newline at end of file +var _0x102b=['CDR(routeid)=','XCALLY-MOTION-ANSWER=0','CDR(type)=outbound','NoOp','alias','No\x20alias\x20set','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','name','param','phone','split','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','IntervalId','then','*,*,*,*','intervals','interval','tag','length','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','queue','playback','app','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','define','get','Hangup','./voiceExtension.attributes','models','type','CDR(type)=','context','exten','Set','CDR(routeAlias)=','inbound','push'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x102b,0x1be));var _0xb102=function(_0x33fefa,_0x5aa198){_0x33fefa=_0x33fefa-0x0;var _0xa4d9f6=_0x102b[_0x33fefa];return _0xa4d9f6;};'use strict';var _=require('lodash');var attributes=require(_0xb102('0x0'));module['exports']=function(_0x3c503a){var _0x3e1311=_0x3c503a[_0xb102('0x1')];function _0x1be904(_0x1e44cb){var _0x1402fb=0x2;var _0x19e35d=[{'type':_0x1e44cb[_0xb102('0x2')],'app':'Set','appdata':_0xb102('0x3')+_0x1e44cb[_0xb102('0x2')],'context':_0x1e44cb[_0xb102('0x4')],'exten':_0x1e44cb[_0xb102('0x5')],'priority':_0x1402fb++,'VoiceExtensionId':_0x1e44cb['id']},{'type':_0x1e44cb[_0xb102('0x2')],'app':_0x1e44cb['alias']?_0xb102('0x6'):'NoOp','appdata':_0x1e44cb['alias']?_0xb102('0x7')+_0x1e44cb['alias']:'No\x20alias\x20set','context':_0x1e44cb[_0xb102('0x4')],'exten':_0x1e44cb[_0xb102('0x5')],'priority':_0x1402fb++,'VoiceExtensionId':_0x1e44cb['id']}];if(_0x1e44cb['type']===_0xb102('0x8')){_0x19e35d[_0xb102('0x9')]({'type':_0xb102('0x8'),'app':_0xb102('0x6'),'appdata':_0xb102('0xa')+_0x1e44cb['id'],'context':_0x1e44cb[_0xb102('0x4')],'exten':_0x1e44cb[_0xb102('0x5')],'priority':_0x1402fb++,'VoiceExtensionId':_0x1e44cb['id']});}_0x19e35d['push']({'type':_0x1e44cb[_0xb102('0x2')],'app':'Set','appdata':_0xb102('0xb'),'context':_0x1e44cb[_0xb102('0x4')],'exten':_0x1e44cb['exten'],'priority':_0x1402fb++,'VoiceExtensionId':_0x1e44cb['id']},{'type':_0x1e44cb[_0xb102('0x2')],'app':_0xb102('0x6'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1e44cb[_0xb102('0x4')],'exten':_0x1e44cb[_0xb102('0x5')],'priority':_0x1402fb++,'VoiceExtensionId':_0x1e44cb['id']},{'type':_0x1e44cb[_0xb102('0x2')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x1e44cb['context'],'exten':_0x1e44cb[_0xb102('0x5')],'priority':_0x1402fb++,'VoiceExtensionId':_0x1e44cb['id']});return _0x19e35d;}function _0x7f3487(_0x182dcc){var _0xc80615=0x2;var _0x52c8c0=[{'type':'outbound','app':_0xb102('0x6'),'appdata':_0xb102('0xc'),'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':'outbound','app':_0x182dcc['alias']?_0xb102('0x6'):_0xb102('0xd'),'appdata':_0x182dcc[_0xb102('0xe')]?_0xb102('0x7')+_0x182dcc['alias']:_0xb102('0xf'),'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':_0xb102('0x10'),'app':'Set','appdata':'CDR(destination)='+(_0x182dcc[_0xb102('0x11')]?_0xb102('0x12')+_0x182dcc['cutdigits']+'}':_0xb102('0x13')),'context':_0x182dcc['context'],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':_0xb102('0x10'),'app':_0xb102('0x6'),'appdata':_0xb102('0xa')+_0x182dcc['id'],'context':_0x182dcc['context'],'exten':_0x182dcc['exten'],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':_0xb102('0x10'),'app':_0xb102('0x14'),'appdata':_0xb102('0x15')+(_0xc80615+0x2)+_0xb102('0x16')+(_0xc80615+0x1)+')','context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':_0xb102('0x10'),'app':_0xb102('0x6'),'appdata':_0x182dcc['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x182dcc[_0xb102('0x11')]+'}':_0xb102('0x17'),'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':'outbound','app':_0xb102('0x6'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':'outbound','app':_0xb102('0x6'),'appdata':_0xb102('0x18'),'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':_0xb102('0x10'),'app':_0xb102('0x6'),'appdata':_0xb102('0x19'),'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':'outbound','app':_0xb102('0x6'),'appdata':_0xb102('0x1a')+_0x182dcc['id'],'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc['exten'],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']}];if(_0x182dcc[_0xb102('0x1b')](_0xb102('0x1c'))&&_0x182dcc[_0xb102('0x1c')]!==_0xb102('0x1d')){_0x52c8c0['push']({'type':'outbound','app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':'outbound','app':_0xb102('0x6'),'appdata':_0xb102('0x1e')+_0x182dcc[_0xb102('0x1c')]||_0xb102('0x1f'),'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']});}return _0x52c8c0;}function _0x1de300(_0x13c977,_0x634133){var _0x2aff96=[{'name':_0xb102('0x20'),'param':0x0},{'name':_0xb102('0x21'),'param':0x1},{'name':_0xb102('0x22'),'param':0x2},{'name':_0xb102('0x23'),'param':0x3}];var _0x236e87={};var _0x17a24f=_0x634133['split'](',');var _0x25a797=[];for(var _0x195c4a=0x0;_0x195c4a<_0x2aff96['length'];_0x195c4a++){switch(_0x2aff96[_0x195c4a][_0xb102('0x24')]){case _0xb102('0x20'):_0x236e87[_0xb102('0x20')]=_0x17a24f[_0x2aff96[_0x195c4a][_0xb102('0x25')]]['split']('/')[0x1];_0x236e87[_0xb102('0x26')]=_0x17a24f[_0x2aff96[_0x195c4a][_0xb102('0x25')]][_0xb102('0x27')]('/')[0x2];_0x236e87[_0xb102('0x28')]=_0x236e87[_0xb102('0x26')]?_0x236e87[_0xb102('0x26')][_0xb102('0x27')]('$')[0x0]:undefined;_0x236e87['phone']=_0x13c977[_0xb102('0x11')]?(_0x236e87[_0xb102('0x28')]||'')+'${EXTEN:'+_0x13c977[_0xb102('0x11')]+'}':(_0x236e87[_0xb102('0x28')]||'')+_0xb102('0x13');_0x25a797[_0x2aff96[_0x195c4a]['param']]=[_0xb102('0x29'),_0x236e87[_0xb102('0x20')],_0x236e87['phone']][_0xb102('0x2a')]('/');break;case'options':_0x236e87['options']=_0x17a24f[_0x2aff96[_0x195c4a]['param']];if(_0x13c977[_0xb102('0x1c')]!==_0xb102('0x1d')){if(_0x236e87['options'][_0xb102('0x2b')](_0xb102('0x2c'))<0x0){_0x236e87[_0xb102('0x22')]+=_0xb102('0x2c');}}else{_0x236e87[_0xb102('0x22')]=_0x236e87[_0xb102('0x22')][_0xb102('0x2d')](_0xb102('0x2c'),'');}_0x25a797[_0x2aff96[_0x195c4a][_0xb102('0x25')]]=_0x236e87['options'];break;default:_0x25a797[_0x2aff96[_0x195c4a][_0xb102('0x25')]]=_0x17a24f[_0x2aff96[_0x195c4a][_0xb102('0x25')]];}}return _0x25a797[_0xb102('0x2a')](',');}function _0x12fa71(_0x357c8b,_0x46b719,_0x55803b){return new Promise(function(_0x4c1014,_0x217d0e){var _0x15ed28=[];if(_[_0xb102('0x2e')](_0x46b719))return _0x4c1014(_0x15ed28);_0x3e1311[_0xb102('0x2f')]['findAll']({'attributes':['id','interval',_0xb102('0x30')],'raw':!![]})[_0xb102('0x31')](function(_0x45cdb2){for(var _0x9d638e=0x0,_0xb6167d=0x0;_0x9d638e<_0x46b719['length'];_0x9d638e++,_0xb6167d=0x0){var _0x5db346=_0x46b719[_0x9d638e];var _0x1f69cf=[];var _0xae108e=[];delete _0x5db346['id'];if(_0x5db346['interval']!==_0xb102('0x32')){_0x5db346[_0xb102('0x33')]=[_0x5db346['interval']];}else{_0x5db346['intervals']=_0x5db346['IntervalId']?_['map'](_['filter'](_0x45cdb2,{'IntervalId':_0x5db346[_0xb102('0x30')]}),_0xb102('0x34')):[];}_0x5db346[_0xb102('0x4')]=_0x357c8b['context'];_0x5db346[_0xb102('0x5')]=_0x357c8b[_0xb102('0x5')];if(_0x5db346['type'])_0x5db346[_0xb102('0x2')]=_0x5db346[_0xb102('0x2')]['toLowerCase']();if(_0x357c8b[_0xb102('0x2')]==='outbound'){if(_0x5db346['hasOwnProperty'](_0xb102('0x35'))&&_0x5db346['tag']&&_0x5db346[_0xb102('0x35')]!=='--'){_0x1f69cf[_0xb102('0x9')]({'type':_0x5db346[_0xb102('0x2')]['toLowerCase'](),'app':_0xb102('0x6'),'appdata':'CDR(tag)='+_0x5db346[_0xb102('0x35')],'context':_0x357c8b[_0xb102('0x4')],'exten':_0x357c8b[_0xb102('0x5')],'priority':_0x5db346[_0xb102('0x33')][_0xb102('0x36')]+_0x55803b+_0xb6167d++,'VoiceExtensionId':_0x357c8b['id']});}_0x1f69cf[_0xb102('0x9')]({'type':_0x5db346[_0xb102('0x2')][_0xb102('0x37')](),'app':'ExecIf','appdata':_0xb102('0x38')+(_0x5db346[_0xb102('0x39')]?'Set(CALLERID(all)='+_0x5db346[_0xb102('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0x357c8b['context'],'exten':_0x357c8b[_0xb102('0x5')],'priority':_0x5db346['intervals'][_0xb102('0x36')]+_0x55803b+_0xb6167d++,'VoiceExtensionId':_0x357c8b['id']});}else{if(_0x5db346[_0xb102('0x1b')](_0xb102('0x3a'))){if([_0xb102('0x3b'),_0xb102('0x3c')]['includes'](_0x5db346[_0xb102('0x3d')][_0xb102('0x37')]())&&_0x5db346[_0xb102('0x3e')]!==_0xb102('0x3f')){if(_0x5db346[_0xb102('0x3a')]){_0x1f69cf[_0xb102('0x9')]({'type':_0x5db346[_0xb102('0x2')][_0xb102('0x37')](),'app':_0xb102('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x357c8b[_0xb102('0x4')],'exten':_0x357c8b[_0xb102('0x5')],'priority':_0x5db346[_0xb102('0x33')][_0xb102('0x36')]+_0x55803b+_0xb6167d++,'VoiceExtensionId':_0x357c8b['id']});_0x1f69cf[_0xb102('0x9')]({'type':_0x5db346[_0xb102('0x2')][_0xb102('0x37')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x357c8b[_0xb102('0x4')],'exten':_0x357c8b[_0xb102('0x5')],'priority':_0x5db346['intervals'][_0xb102('0x36')]+_0x55803b+_0xb6167d++,'VoiceExtensionId':_0x357c8b['id']});}else{_0x1f69cf[_0xb102('0x9')]({'type':_0x5db346[_0xb102('0x2')]['toLowerCase'](),'app':_0xb102('0x14'),'appdata':_0xb102('0x40'),'context':_0x357c8b['context'],'exten':_0x357c8b[_0xb102('0x5')],'priority':_0x5db346[_0xb102('0x33')]['length']+_0x55803b+_0xb6167d++,'VoiceExtensionId':_0x357c8b['id']});_0x1f69cf['push']({'type':_0x5db346[_0xb102('0x2')][_0xb102('0x37')](),'app':_0xb102('0x6'),'appdata':_0xb102('0x41'),'context':_0x357c8b[_0xb102('0x4')],'exten':_0x357c8b[_0xb102('0x5')],'priority':_0x5db346['intervals']['length']+_0x55803b+_0xb6167d++,'VoiceExtensionId':_0x357c8b['id']});}}}}for(var _0x4a17bd=0x0;_0x4a17bd<_0x5db346[_0xb102('0x33')][_0xb102('0x36')];_0x4a17bd++){var _0x49f24a=_0x55803b+_0x5db346[_0xb102('0x33')]['length'];var _0x20d32a=_0x4a17bd===_0x5db346[_0xb102('0x33')][_0xb102('0x36')]-0x1?_0x55803b+_0x1f69cf[_0xb102('0x36')]+_0xae108e[_0xb102('0x36')]+0x2:_0x55803b+_0x4a17bd+0x1;_0x1f69cf[_0xb102('0x42')](_0x4a17bd,0x0,{'type':_0x357c8b['type'],'app':_0xb102('0x43'),'appdata':_0x5db346[_0xb102('0x33')][_0x4a17bd]+'?'+_0x357c8b[_0xb102('0x4')]+_0xb102('0x44')+_0x49f24a+':'+_0x357c8b[_0xb102('0x4')]+_0xb102('0x44')+_0x20d32a,'exten':_0x357c8b[_0xb102('0x5')],'context':_0x357c8b[_0xb102('0x4')],'priority':_0x55803b+_0x4a17bd,'VoiceExtensionId':_0x357c8b['id']});}if(_0x5db346[_0xb102('0x3e')]==='outboundDial')_0x5db346[_0xb102('0x45')]=_0x1de300(_0x357c8b,_0x5db346[_0xb102('0x45')]);_0x5db346[_0xb102('0x46')]=_0x1f69cf['length']?_[_0xb102('0x47')](_0x1f69cf)['priority']+0x1:_0x55803b;_0x15ed28=_[_0xb102('0x48')](_0x15ed28,_0x1f69cf,[_0x5db346],_0xae108e);_0x55803b=_[_0xb102('0x47')](_0x15ed28)[_0xb102('0x46')]+0x1;}return _0x4c1014(_0x15ed28);})['catch'](function(_0x420215){_0x217d0e(_0x420215);});});}return _0x3c503a[_0xb102('0x49')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5192ec){var _0x58ac4d=this[_0xb102('0x4a')]({'plain':!![]});var _0x2c1773=_0x58ac4d[_0xb102('0x2')]===_0xb102('0x10')?_0x7f3487(_0x58ac4d):_0x1be904(_0x58ac4d);return _0x12fa71(_0x58ac4d,_0x5192ec,_['last'](_0x2c1773)['priority']+0x1)['then'](function(_0x3564bd){var _0x2ee411=_[_0xb102('0x48')](_0x2c1773,_0x3564bd);_0x2ee411[_0xb102('0x9')]({'type':_0x58ac4d[_0xb102('0x2')],'app':_0xb102('0x4b'),'exten':_0x58ac4d[_0xb102('0x5')],'context':_0x58ac4d['context'],'priority':_[_0xb102('0x47')](_0x2ee411)['priority']+0x1,'VoiceExtensionId':_0x58ac4d['id']});return _0x2ee411;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2649f58..bf26942 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 _0xb138=['where','attributes','limit','include','model','map','then','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./voiceExtension.socket','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','message','result','GetVoiceExtension','VoiceExtension','findAll','raw','options'];(function(_0x2f2352,_0x2158a1){var _0x49663d=function(_0x249c8a){while(--_0x249c8a){_0x2f2352['push'](_0x2f2352['shift']());}};_0x49663d(++_0x2158a1);}(_0xb138,0x1dd));var _0x8b13=function(_0x1e8eee,_0x44bfe9){_0x1e8eee=_0x1e8eee-0x0;var _0x55fe4b=_0xb138[_0x1e8eee];return _0x55fe4b;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var BPromise=require(_0x8b13('0x3'));var rs=require(_0x8b13('0x4'));var fs=require('fs');var Redis=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var config=require(_0x8b13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8b13('0xa')][_0x8b13('0xb')]({'port':0x232a});config['redis']=_[_0x8b13('0xc')](config[_0x8b13('0xd')],{'host':_0x8b13('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b13('0xd')]));require(_0x8b13('0xf'))['register'](socket);function respondWithRpcPromise(_0x53ae50,_0x1f2528,_0x21fcd9){return new BPromise(function(_0x13fbd1,_0x439451){return client[_0x8b13('0x10')](_0x53ae50,_0x21fcd9)['then'](function(_0x11bc89){logger[_0x8b13('0x11')](_0x8b13('0x12'),_0x1f2528,_0x8b13('0x13'));logger[_0x8b13('0x14')](_0x8b13('0x15'),_0x1f2528,'request\x20sent',JSON['stringify'](_0x11bc89));if(_0x11bc89[_0x8b13('0x16')]){if(_0x11bc89[_0x8b13('0x16')]['code']===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x1f2528,_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);return _0x439451(_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);}logger[_0x8b13('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x1f2528,_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);return _0x13fbd1(_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);}else{logger[_0x8b13('0x11')](_0x8b13('0x12'),_0x1f2528,_0x8b13('0x13'));_0x13fbd1(_0x11bc89[_0x8b13('0x18')]['message']);}})['catch'](function(_0xae4966){logger[_0x8b13('0x16')](_0x8b13('0x12'),_0x1f2528,_0xae4966);_0x439451(_0xae4966);});});}exports[_0x8b13('0x19')]=function(_0x1e0fe3){var _0x3cc9a0=this;return new Promise(function(_0x559442,_0x1e8a48){return db[_0x8b13('0x1a')][_0x8b13('0x1b')]({'raw':_0x1e0fe3['options']?_0x1e0fe3['options'][_0x8b13('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e0fe3[_0x8b13('0x1d')]?_0x1e0fe3['options'][_0x8b13('0x1e')]||null:null,'attributes':_0x1e0fe3[_0x8b13('0x1d')]?_0x1e0fe3[_0x8b13('0x1d')][_0x8b13('0x1f')]||null:null,'limit':_0x1e0fe3[_0x8b13('0x1d')]?_0x1e0fe3['options'][_0x8b13('0x20')]||null:null,'include':_0x1e0fe3[_0x8b13('0x1d')]?_0x1e0fe3['options'][_0x8b13('0x21')]?_['map'](_0x1e0fe3[_0x8b13('0x1d')][_0x8b13('0x21')],function(_0x54786a){return{'model':db[_0x54786a[_0x8b13('0x22')]],'as':_0x54786a['as'],'attributes':_0x54786a[_0x8b13('0x1f')],'include':_0x54786a['include']?_[_0x8b13('0x23')](_0x54786a[_0x8b13('0x21')],function(_0x410122){return{'model':db[_0x410122[_0x8b13('0x22')]],'as':_0x410122['as'],'attributes':_0x410122[_0x8b13('0x1f')],'include':_0x410122['include']?_[_0x8b13('0x23')](_0x410122[_0x8b13('0x21')],function(_0x3475d8){return{'model':db[_0x3475d8[_0x8b13('0x22')]],'as':_0x3475d8['as'],'attributes':_0x3475d8[_0x8b13('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8b13('0x24')](function(_0x5ab161){logger[_0x8b13('0x11')](_0x8b13('0x19'),_0x1e0fe3);logger[_0x8b13('0x14')](_0x8b13('0x19'),_0x1e0fe3,JSON[_0x8b13('0x25')](_0x5ab161));_0x559442(_0x5ab161);})[_0x8b13('0x26')](function(_0x3304bd){logger[_0x8b13('0x16')](_0x8b13('0x19'),_0x3304bd['message'],_0x1e0fe3);_0x1e8a48(_0x3cc9a0[_0x8b13('0x16')](0x1f4,_0x3304bd[_0x8b13('0x17')]));});});}; \ No newline at end of file +var _0xd9c8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','debug','request\x20sent','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','options','where','attributes','include','map','model','lodash','util'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd9c8[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var moment=require('moment');var BPromise=require(_0x8d9c('0x2'));var rs=require(_0x8d9c('0x3'));var fs=require('fs');var Redis=require(_0x8d9c('0x4'));var db=require(_0x8d9c('0x5'))['db'];var utils=require(_0x8d9c('0x6'));var logger=require(_0x8d9c('0x7'))(_0x8d9c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8d9c('0x9')]({'port':0x232a});config[_0x8d9c('0xa')]=_[_0x8d9c('0xb')](config['redis'],{'host':_0x8d9c('0xc'),'port':0x18eb});var socket=require(_0x8d9c('0xd'))(new Redis(config[_0x8d9c('0xa')]));require(_0x8d9c('0xe'))[_0x8d9c('0xf')](socket);function respondWithRpcPromise(_0xc3a2ff,_0xa2bf79,_0xaa0a72){return new BPromise(function(_0x52de51,_0x26b5b3){return client['request'](_0xc3a2ff,_0xaa0a72)[_0x8d9c('0x10')](function(_0x5d31e7){logger[_0x8d9c('0x11')]('VoiceExtension,\x20%s,\x20%s',_0xa2bf79,'request\x20sent');logger[_0x8d9c('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xa2bf79,_0x8d9c('0x13'),JSON[_0x8d9c('0x14')](_0x5d31e7));if(_0x5d31e7[_0x8d9c('0x15')]){if(_0x5d31e7[_0x8d9c('0x15')][_0x8d9c('0x16')]===0x1f4){logger[_0x8d9c('0x15')](_0x8d9c('0x17'),_0xa2bf79,_0x5d31e7[_0x8d9c('0x15')][_0x8d9c('0x18')]);return _0x26b5b3(_0x5d31e7[_0x8d9c('0x15')]['message']);}logger[_0x8d9c('0x15')](_0x8d9c('0x17'),_0xa2bf79,_0x5d31e7[_0x8d9c('0x15')][_0x8d9c('0x18')]);return _0x52de51(_0x5d31e7[_0x8d9c('0x15')][_0x8d9c('0x18')]);}else{logger[_0x8d9c('0x11')](_0x8d9c('0x17'),_0xa2bf79,_0x8d9c('0x13'));_0x52de51(_0x5d31e7[_0x8d9c('0x19')]['message']);}})[_0x8d9c('0x1a')](function(_0x6671d7){logger['error'](_0x8d9c('0x17'),_0xa2bf79,_0x6671d7);_0x26b5b3(_0x6671d7);});});}exports[_0x8d9c('0x1b')]=function(_0x57a45b){var _0x3ba938=this;return new Promise(function(_0x2ba1c8,_0xa8391d){return db[_0x8d9c('0x1c')]['findAll']({'raw':_0x57a45b[_0x8d9c('0x1d')]?_0x57a45b[_0x8d9c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x57a45b['options']?_0x57a45b[_0x8d9c('0x1d')][_0x8d9c('0x1e')]||null:null,'attributes':_0x57a45b[_0x8d9c('0x1d')]?_0x57a45b[_0x8d9c('0x1d')][_0x8d9c('0x1f')]||null:null,'limit':_0x57a45b[_0x8d9c('0x1d')]?_0x57a45b[_0x8d9c('0x1d')]['limit']||null:null,'include':_0x57a45b[_0x8d9c('0x1d')]?_0x57a45b['options'][_0x8d9c('0x20')]?_[_0x8d9c('0x21')](_0x57a45b[_0x8d9c('0x1d')][_0x8d9c('0x20')],function(_0x171c96){return{'model':db[_0x171c96[_0x8d9c('0x22')]],'as':_0x171c96['as'],'attributes':_0x171c96[_0x8d9c('0x1f')],'include':_0x171c96['include']?_['map'](_0x171c96['include'],function(_0x527302){return{'model':db[_0x527302['model']],'as':_0x527302['as'],'attributes':_0x527302[_0x8d9c('0x1f')],'include':_0x527302[_0x8d9c('0x20')]?_[_0x8d9c('0x21')](_0x527302[_0x8d9c('0x20')],function(_0x5cb119){return{'model':db[_0x5cb119[_0x8d9c('0x22')]],'as':_0x5cb119['as'],'attributes':_0x5cb119[_0x8d9c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5548a7){logger[_0x8d9c('0x11')]('GetVoiceExtension',_0x57a45b);logger[_0x8d9c('0x12')](_0x8d9c('0x1b'),_0x57a45b,JSON[_0x8d9c('0x14')](_0x5548a7));_0x2ba1c8(_0x5548a7);})['catch'](function(_0x5eaa3e){logger[_0x8d9c('0x15')](_0x8d9c('0x1b'),_0x5eaa3e[_0x8d9c('0x18')],_0x57a45b);_0xa8391d(_0x3ba938[_0x8d9c('0x15')](0x1f4,_0x5eaa3e[_0x8d9c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 24c2b28..46a4347 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x1c5441,_0x4ccffe){var _0x569783=function(_0x5b0282){while(--_0x5b0282){_0x1c5441['push'](_0x1c5441['shift']());}};_0x569783(++_0x4ccffe);}(_0x53ec,0x192));var _0xc53e=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x53ec[_0x5951e8];return _0x20a1f5;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x3401f7,_0x9fb50b){var _0x6fe230=function(_0x28ff2f){while(--_0x28ff2f){_0x3401f7['push'](_0x3401f7['shift']());}};_0x6fe230(++_0x9fb50b);}(_0xabce,0x103));var _0xeabc=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xabce[_0x173d7e];return _0x2220d6;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f199fb2..f349f73 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 _0x4888=['/:id/messages','post','create','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x4888,0x198));var _0x8488=function(_0x53b93b,_0x1bfab1){_0x53b93b=_0x53b93b-0x0;var _0x485761=_0x4888[_0x53b93b];return _0x485761;};'use strict';var multer=require('multer');var util=require(_0x8488('0x0'));var path=require(_0x8488('0x1'));var timeout=require(_0x8488('0x2'));var express=require(_0x8488('0x3'));var router=express[_0x8488('0x4')]();var fs_extra=require(_0x8488('0x5'));var auth=require(_0x8488('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8488('0x7'));var controller=require(_0x8488('0x8'));router[_0x8488('0x9')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xb')]);router[_0x8488('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8488('0xc'),auth[_0x8488('0xa')](),controller['getMessages']);router[_0x8488('0xd')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xe')]);router[_0x8488('0xf')]('/:id',auth[_0x8488('0xa')](),controller[_0x8488('0x10')]);router[_0x8488('0x11')](_0x8488('0x12'),auth[_0x8488('0xa')](),controller['destroy']);module[_0x8488('0x13')]=router; \ No newline at end of file +var _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create','update','exports'];(function(_0x49aa3a,_0x4cd1a6){var _0x530886=function(_0x36a9e5){while(--_0x36a9e5){_0x49aa3a['push'](_0x49aa3a['shift']());}};_0x530886(++_0x4cd1a6);}(_0x32f4,0x154));var _0x432f=function(_0x2f376b,_0x3a9efb){_0x2f376b=_0x2f376b-0x0;var _0x341c98=_0x32f4[_0x2f376b];return _0x341c98;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['show']);router[_0x432f('0x9')]('/:id/messages',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')]('/',auth[_0x432f('0xa')](),controller[_0x432f('0xe')]);router['put'](_0x432f('0xb'),auth['isAuthenticated'](),controller[_0x432f('0xf')]);router['delete'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 22d1d56..67c0426 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 _0x9197=['setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','contest_mailbox'];(function(_0x1bc9b7,_0x5cbcb3){var _0x59b9b5=function(_0x9cfce6){while(--_0x9cfce6){_0x1bc9b7['push'](_0x1bc9b7['shift']());}};_0x59b9b5(++_0x5cbcb3);}(_0x9197,0x119));var _0x7919=function(_0x1c43b9,_0x5b32ac){_0x1c43b9=_0x1c43b9-0x0;var _0x30510a=_0x9197[_0x1c43b9];return _0x30510a;};'use strict';var Sequelize=require(_0x7919('0x0'));module[_0x7919('0x1')]={'customer_id':{'type':Sequelize[_0x7919('0x2')]},'context':{'type':Sequelize[_0x7919('0x2')],'defaultValue':'from-voicemail','unique':_0x7919('0x3')},'mailbox':{'type':Sequelize[_0x7919('0x2')],'defaultValue':'','allowNull':![],'unique':_0x7919('0x3')},'password':{'type':Sequelize[_0x7919('0x2')]},'fullname':{'type':Sequelize[_0x7919('0x2')]},'email':{'type':Sequelize[_0x7919('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3fe74e){this[_0x7919('0x4')](_0x7919('0x5'),typeof _0x3fe74e===_0x7919('0x6')&&_0x3fe74e['trim']()?_0x3fe74e[_0x7919('0x7')]():null);}},'pager':{'type':Sequelize[_0x7919('0x2')]},'tz':{'type':Sequelize[_0x7919('0x2')],'defaultValue':_0x7919('0x8')},'attach':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x7919('0x2')]},'review':{'type':Sequelize[_0x7919('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x7919('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7919('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x7919('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':_0x7919('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7919('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x7919('0xa'),'no'),'defaultValue':_0x7919('0xa'),'allowNull':![]},'stamp':{'type':_0x7919('0xc')},'emailsubject':{'type':Sequelize[_0x7919('0x2')]},'emailbody':{'type':Sequelize[_0x7919('0x2')]},'maxsecs':{'type':Sequelize[_0x7919('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7919('0xe')],'get':function(){return this['getDataValue'](_0x7919('0xf'))+_0x7919('0x10')+this[_0x7919('0x11')](_0x7919('0x12'));}}}; \ No newline at end of file +var _0xd110=['STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports'];(function(_0x32d32f,_0x377be2){var _0x3384f8=function(_0x45af70){while(--_0x45af70){_0x32d32f['push'](_0x32d32f['shift']());}};_0x3384f8(++_0x377be2);}(_0xd110,0x7c));var _0x0d11=function(_0x571a00,_0x55bee9){_0x571a00=_0x571a00-0x0;var _0x294f3c=_0xd110[_0x571a00];return _0x294f3c;};'use strict';var Sequelize=require(_0x0d11('0x0'));module[_0x0d11('0x1')]={'customer_id':{'type':Sequelize[_0x0d11('0x2')]},'context':{'type':Sequelize[_0x0d11('0x2')],'defaultValue':_0x0d11('0x3'),'unique':_0x0d11('0x4')},'mailbox':{'type':Sequelize[_0x0d11('0x2')],'defaultValue':'','allowNull':![],'unique':_0x0d11('0x4')},'password':{'type':Sequelize[_0x0d11('0x2')]},'fullname':{'type':Sequelize[_0x0d11('0x2')]},'email':{'type':Sequelize[_0x0d11('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3e8f78){this[_0x0d11('0x5')]('email',typeof _0x3e8f78===_0x0d11('0x6')&&_0x3e8f78[_0x0d11('0x7')]()?_0x3e8f78[_0x0d11('0x7')]():null);}},'pager':{'type':Sequelize[_0x0d11('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x0d11('0x8')},'attach':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':_0x0d11('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x0d11('0xa'),'no'),'defaultValue':_0x0d11('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0d11('0x2')]},'callback':{'type':Sequelize[_0x0d11('0x2')]},'review':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0d11('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':_0x0d11('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':_0x0d11('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x0d11('0x2')]},'emailbody':{'type':Sequelize[_0x0d11('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0d11('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0d11('0xd')],'get':function(){return this[_0x0d11('0xe')](_0x0d11('0xf'))+_0x0d11('0x10')+this[_0x0d11('0xe')](_0x0d11('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 59ec595..9e17aa3 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 _0xcb91=['VoiceMail','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','findOne','VoiceMailMessage','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send'];(function(_0x3d7811,_0x59daeb){var _0x927cfa=function(_0x5ce736){while(--_0x5ce736){_0x3d7811['push'](_0x3d7811['shift']());}};_0x927cfa(++_0x59daeb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0xcb91[_0x4d7116];return _0x4593dc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){var _0x10a419=_0x55b232[_0x1cb9('0x24')]({'plain':!![]});var _0x69b4c8=_0x1cb9('0x25');return db[_0x1cb9('0x26')]['destroy']({'where':{'type':_0x69b4c8,'resourceId':_0x10a419['id']}})[_0x1cb9('0x22')](function(){return _0x55b232;});})[_0x1cb9('0x22')](function(){_0x27db16['status'](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x21effa,_0x41a9a0){return function(_0x1804fd){if(!_0x1804fd){_0x21effa[_0x1cb9('0x16')](0x194);}return _0x1804fd;};}function handleError(_0x21d6f5,_0x2e28fe){_0x2e28fe=_0x2e28fe||0x1f4;return function(_0xb644b3){logger[_0x1cb9('0x27')](_0xb644b3[_0x1cb9('0x28')]);if(_0xb644b3['name']){delete _0xb644b3[_0x1cb9('0x29')];}_0x21d6f5['status'](_0x2e28fe)[_0x1cb9('0x2a')](_0xb644b3);};}exports['index']=function(_0x278327,_0x41011c){var _0x3cd7f5={},_0x2038aa={},_0x561d89={'count':0x0,'rows':[]};var _0x1c701f=_['map'](db[_0x1cb9('0x2b')][_0x1cb9('0x2c')],function(_0x4220d7){return{'name':_0x4220d7['fieldName'],'type':_0x4220d7[_0x1cb9('0x2d')]['key']};});_0x2038aa[_0x1cb9('0x2e')]=_['map'](_0x1c701f,_0x1cb9('0x29'));_0x2038aa[_0x1cb9('0x2f')]=_[_0x1cb9('0x30')](_0x278327[_0x1cb9('0x2f')]);_0x2038aa['filters']=_[_0x1cb9('0x31')](_0x2038aa[_0x1cb9('0x2e')],_0x2038aa[_0x1cb9('0x2f')]);_0x3cd7f5[_0x1cb9('0x32')]=_[_0x1cb9('0x31')](_0x2038aa[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x3cd7f5[_0x1cb9('0x32')]=_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x3cd7f5[_0x1cb9('0x32')]:_0x2038aa['model'];if(!_0x278327['query'][_0x1cb9('0x35')](_0x1cb9('0x36'))){_0x3cd7f5[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x1c')]);_0x3cd7f5[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0x278327['query'][_0x1cb9('0x1a')]);}_0x3cd7f5[_0x1cb9('0x37')]=qs[_0x1cb9('0x38')](_0x278327['query'][_0x1cb9('0x38')]);_0x3cd7f5['where']=qs[_0x1cb9('0x39')](_['pick'](_0x278327[_0x1cb9('0x2f')],_0x2038aa[_0x1cb9('0x39')]),_0x1c701f);if(_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3a')]){_0x3cd7f5[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](_0x3cd7f5[_0x1cb9('0x3b')],{'$or':_['map'](_0x1c701f,function(_0x4ca19e){if(_0x4ca19e[_0x1cb9('0x2d')]!==_0x1cb9('0x3d')){var _0x7a0d8b={};_0x7a0d8b[_0x4ca19e[_0x1cb9('0x29')]]={'$like':'%'+_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3a')]+'%'};return _0x7a0d8b;}})});}_0x3cd7f5=_[_0x1cb9('0x3c')]({},_0x3cd7f5,_0x278327['options']);var _0xbcaa32={'where':_0x3cd7f5['where']};return db['VoiceMail']['count'](_0xbcaa32)[_0x1cb9('0x22')](function(_0x397ff9){_0x561d89[_0x1cb9('0x1d')]=_0x397ff9;if(_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3e')]){_0x3cd7f5['include']=[{'all':!![]}];}return db[_0x1cb9('0x2b')]['findAll'](_0x3cd7f5);})[_0x1cb9('0x22')](function(_0x71db9d){_0x561d89[_0x1cb9('0x3f')]=_0x71db9d;return _0x561d89;})['then'](respondWithFilteredResult(_0x41011c,_0x3cd7f5))[_0x1cb9('0x40')](handleError(_0x41011c,null));};exports['show']=function(_0xda1a44,_0xbc36fc){var _0x51a898={'raw':!![],'where':{'id':_0xda1a44[_0x1cb9('0x41')]['id']}},_0x5839aa={};_0x5839aa[_0x1cb9('0x2e')]=_[_0x1cb9('0x30')](db[_0x1cb9('0x2b')][_0x1cb9('0x2c')]);_0x5839aa['query']=_[_0x1cb9('0x30')](_0xda1a44['query']);_0x5839aa['filters']=_['intersection'](_0x5839aa[_0x1cb9('0x2e')],_0x5839aa[_0x1cb9('0x2f')]);_0x51a898[_0x1cb9('0x32')]=_[_0x1cb9('0x31')](_0x5839aa[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0xda1a44[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x51a898[_0x1cb9('0x32')]=_0x51a898[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x51a898['attributes']:_0x5839aa[_0x1cb9('0x2e')];if(_0xda1a44[_0x1cb9('0x2f')][_0x1cb9('0x3e')]){_0x51a898['include']=[{'all':!![]}];}_0x51a898=_[_0x1cb9('0x3c')]({},_0x51a898,_0xda1a44[_0x1cb9('0x42')]);return db[_0x1cb9('0x2b')][_0x1cb9('0x43')](_0x51a898)[_0x1cb9('0x22')](handleEntityNotFound(_0xbc36fc,null))['then'](respondWithResult(_0xbc36fc,null))[_0x1cb9('0x40')](handleError(_0xbc36fc,null));};exports['create']=function(_0x2eaa11,_0x4ac483){return db[_0x1cb9('0x2b')][_0x1cb9('0x44')](_0x2eaa11[_0x1cb9('0x45')],{})[_0x1cb9('0x22')](function(_0x56d0c5){var _0x298475=_0x2eaa11[_0x1cb9('0x46')][_0x1cb9('0x24')]({'plain':!![]});if(!_0x298475)throw new Error(_0x1cb9('0x47'));if(_0x298475[_0x1cb9('0x48')]===_0x1cb9('0x46')){var _0x17b92a=_0x56d0c5[_0x1cb9('0x24')]({'plain':!![]});var _0xbb500e=_0x1cb9('0x25');return db['UserProfileSection']['find']({'where':{'name':_0xbb500e,'userProfileId':_0x298475[_0x1cb9('0x49')]},'raw':!![]})[_0x1cb9('0x22')](function(_0x19e83a){if(_0x19e83a&&_0x19e83a[_0x1cb9('0x4a')]===0x0){return db[_0x1cb9('0x26')][_0x1cb9('0x44')]({'name':_0x17b92a[_0x1cb9('0x29')],'resourceId':_0x17b92a['id'],'type':_0x19e83a[_0x1cb9('0x29')],'sectionId':_0x19e83a['id']},{})[_0x1cb9('0x22')](function(){return _0x56d0c5;});}else{return _0x56d0c5;}})[_0x1cb9('0x40')](function(_0x4a4b87){logger[_0x1cb9('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a4b87);throw _0x4a4b87;});}return _0x56d0c5;})[_0x1cb9('0x22')](respondWithResult(_0x4ac483,0xc9))['catch'](handleError(_0x4ac483,null));};exports[_0x1cb9('0x21')]=function(_0x53c002,_0x5e5174){if(_0x53c002[_0x1cb9('0x45')]['id']){delete _0x53c002[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x2b')]['find']({'where':{'id':_0x53c002[_0x1cb9('0x41')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x5e5174,null))['then'](saveUpdates(_0x53c002['body'],null))[_0x1cb9('0x22')](respondWithResult(_0x5e5174,null))[_0x1cb9('0x40')](handleError(_0x5e5174,null));};exports[_0x1cb9('0x23')]=function(_0x2b3f2a,_0x3de325){return db[_0x1cb9('0x2b')][_0x1cb9('0x43')]({'where':{'id':_0x2b3f2a['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x3de325,null))[_0x1cb9('0x22')](removeEntity(_0x3de325,null))[_0x1cb9('0x40')](handleError(_0x3de325,null));};exports['getMessages']=function(_0x183bd1,_0x9893a3,_0x1651c5){return db[_0x1cb9('0x2b')][_0x1cb9('0x4b')]({'where':{'id':_0x183bd1[_0x1cb9('0x41')]['id']}})['then'](handleEntityNotFound(_0x9893a3,null))[_0x1cb9('0x22')](function(_0x36c40d){var _0x41e81f;var _0x128c5b={},_0x4ad7cd={};_0x4ad7cd[_0x1cb9('0x2e')]=_[_0x1cb9('0x30')](db[_0x1cb9('0x4c')][_0x1cb9('0x2c')]);_0x4ad7cd[_0x1cb9('0x2f')]=_[_0x1cb9('0x30')](_0x183bd1['query']);_0x4ad7cd[_0x1cb9('0x39')]=_[_0x1cb9('0x31')](_0x4ad7cd[_0x1cb9('0x2e')],_0x4ad7cd[_0x1cb9('0x2f')]);_0x128c5b['attributes']=_['intersection'](_0x4ad7cd[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0x183bd1[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x128c5b[_0x1cb9('0x32')]=_0x128c5b[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x128c5b[_0x1cb9('0x32')]:_0x4ad7cd['model'];if(!_0x183bd1['query'][_0x1cb9('0x35')]('nolimit')){_0x128c5b['limit']=qs['limit'](_0x183bd1['query']['limit']);_0x128c5b[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0x183bd1[_0x1cb9('0x2f')][_0x1cb9('0x1a')]);}_0x128c5b[_0x1cb9('0x37')]=qs[_0x1cb9('0x38')](_0x183bd1['query'][_0x1cb9('0x38')]);_0x128c5b[_0x1cb9('0x3b')]=qs['filters'](_['pick'](_0x183bd1[_0x1cb9('0x2f')],_0x4ad7cd[_0x1cb9('0x39')]));if(_0x183bd1[_0x1cb9('0x2f')][_0x1cb9('0x3a')]){_0x128c5b[_0x1cb9('0x3b')]=_['merge'](_0x128c5b['where'],{'$or':_['map'](_0x128c5b[_0x1cb9('0x32')],function(_0x2fd5a0){var _0x196349={};_0x196349[_0x2fd5a0]={'$like':'%'+_0x183bd1[_0x1cb9('0x2f')][_0x1cb9('0x3a')]+'%'};return _0x196349;})});}_0x128c5b['where']=_[_0x1cb9('0x3c')](_0x128c5b[_0x1cb9('0x3b')],{'mailboxuser':_0x36c40d['mailbox']});_0x128c5b=_['merge']({},_0x128c5b,_0x183bd1[_0x1cb9('0x42')]);return db['VoiceMailMessage'][_0x1cb9('0x4d')](_0x128c5b)[_0x1cb9('0x22')](respondWithFilteredResult(_0x9893a3,_0x128c5b));})[_0x1cb9('0x40')](handleError(_0x9893a3,null));}; \ No newline at end of file +var _0xf4eb=['fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','rows','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','getMessages','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','eml-format','moment','util','path','sox','to-csv','ejs'];(function(_0x18ccd6,_0x1098e8){var _0x587d2c=function(_0x460ad6){while(--_0x460ad6){_0x18ccd6['push'](_0x18ccd6['shift']());}};_0x587d2c(++_0x1098e8);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5f1574,_0x5a8f5c){_0x5f1574=_0x5f1574-0x0;var _0x2ef92d=_0xf4eb[_0x5f1574];return _0x2ef92d;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){var _0x3a5d72=_0x30994d['get']({'plain':!![]});var _0x90635e=_0xbf4e('0x21');return db[_0xbf4e('0x22')]['destroy']({'where':{'type':_0x90635e,'resourceId':_0x3a5d72['id']}})[_0xbf4e('0x1f')](function(){return _0x30994d;});})['then'](function(){_0x51648c['status'](0xcc)[_0xbf4e('0x15')]();});}};}function handleEntityNotFound(_0x5a0a9b,_0x38c923){return function(_0x315df3){if(!_0x315df3){_0x5a0a9b[_0xbf4e('0x13')](0x194);}return _0x315df3;};}function handleError(_0x41f918,_0x5c912f){_0x5c912f=_0x5c912f||0x1f4;return function(_0x2d4686){logger[_0xbf4e('0x23')](_0x2d4686[_0xbf4e('0x24')]);if(_0x2d4686['name']){delete _0x2d4686[_0xbf4e('0x25')];}_0x41f918['status'](_0x5c912f)[_0xbf4e('0x26')](_0x2d4686);};}exports[_0xbf4e('0x27')]=function(_0xb8b58e,_0x498dbd){var _0x1d12e2={},_0x362716={},_0x2f3cf8={'count':0x0,'rows':[]};var _0xc7ca87=_[_0xbf4e('0x28')](db[_0xbf4e('0x29')]['rawAttributes'],function(_0x35c82d){return{'name':_0x35c82d[_0xbf4e('0x2a')],'type':_0x35c82d['type'][_0xbf4e('0x2b')]};});_0x362716[_0xbf4e('0x2c')]=_['map'](_0xc7ca87,_0xbf4e('0x25'));_0x362716['query']=_[_0xbf4e('0x2d')](_0xb8b58e['query']);_0x362716[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],_0x362716['query']);_0x1d12e2[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],qs[_0xbf4e('0x31')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x1d12e2['attributes']=_0x1d12e2[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x1d12e2[_0xbf4e('0x30')]:_0x362716[_0xbf4e('0x2c')];if(!_0xb8b58e[_0xbf4e('0x32')]['hasOwnProperty']('nolimit')){_0x1d12e2['limit']=qs['limit'](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x18')]);_0x1d12e2[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x1d12e2[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0xb8b58e[_0xbf4e('0x32')]['sort']);_0x1d12e2['where']=qs[_0xbf4e('0x2e')](_[_0xbf4e('0x36')](_0xb8b58e[_0xbf4e('0x32')],_0x362716['filters']),_0xc7ca87);if(_0xb8b58e[_0xbf4e('0x32')]['filter']){_0x1d12e2[_0xbf4e('0x37')]=_[_0xbf4e('0x38')](_0x1d12e2[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0xc7ca87,function(_0x5ce339){if(_0x5ce339[_0xbf4e('0x39')]!==_0xbf4e('0x3a')){var _0x3aa308={};_0x3aa308[_0x5ce339[_0xbf4e('0x25')]]={'$like':'%'+_0xb8b58e['query'][_0xbf4e('0x3b')]+'%'};return _0x3aa308;}})});}_0x1d12e2=_[_0xbf4e('0x38')]({},_0x1d12e2,_0xb8b58e[_0xbf4e('0x3c')]);var _0x29fe9d={'where':_0x1d12e2[_0xbf4e('0x37')]};return db[_0xbf4e('0x29')][_0xbf4e('0x19')](_0x29fe9d)['then'](function(_0x176166){_0x2f3cf8[_0xbf4e('0x19')]=_0x176166;if(_0xb8b58e['query']['includeAll']){_0x1d12e2[_0xbf4e('0x3d')]=[{'all':!![]}];}return db[_0xbf4e('0x29')]['findAll'](_0x1d12e2);})['then'](function(_0x2b1bf4){_0x2f3cf8[_0xbf4e('0x3e')]=_0x2b1bf4;return _0x2f3cf8;})[_0xbf4e('0x1f')](respondWithFilteredResult(_0x498dbd,_0x1d12e2))[_0xbf4e('0x3f')](handleError(_0x498dbd,null));};exports[_0xbf4e('0x40')]=function(_0x3ad0a4,_0x5a03c6){var _0x3ecc15={'raw':!![],'where':{'id':_0x3ad0a4['params']['id']}},_0x7bd91={};_0x7bd91['model']=_['keys'](db['VoiceMail'][_0xbf4e('0x41')]);_0x7bd91['query']=_[_0xbf4e('0x2d')](_0x3ad0a4[_0xbf4e('0x32')]);_0x7bd91['filters']=_['intersection'](_0x7bd91[_0xbf4e('0x2c')],_0x7bd91[_0xbf4e('0x32')]);_0x3ecc15[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x7bd91[_0xbf4e('0x2c')],qs['fields'](_0x3ad0a4[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x3ecc15[_0xbf4e('0x30')]=_0x3ecc15[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x3ecc15[_0xbf4e('0x30')]:_0x7bd91[_0xbf4e('0x2c')];if(_0x3ad0a4[_0xbf4e('0x32')]['includeAll']){_0x3ecc15[_0xbf4e('0x3d')]=[{'all':!![]}];}_0x3ecc15=_[_0xbf4e('0x38')]({},_0x3ecc15,_0x3ad0a4[_0xbf4e('0x3c')]);return db[_0xbf4e('0x29')][_0xbf4e('0x42')](_0x3ecc15)[_0xbf4e('0x1f')](handleEntityNotFound(_0x5a03c6,null))[_0xbf4e('0x1f')](respondWithResult(_0x5a03c6,null))[_0xbf4e('0x3f')](handleError(_0x5a03c6,null));};exports[_0xbf4e('0x43')]=function(_0x3447ab,_0x2fdba9){return db[_0xbf4e('0x29')][_0xbf4e('0x43')](_0x3447ab[_0xbf4e('0x44')],{})[_0xbf4e('0x1f')](function(_0x2892ce){var _0x10bc23=_0x3447ab['user'][_0xbf4e('0x45')]({'plain':!![]});if(!_0x10bc23)throw new Error(_0xbf4e('0x46'));if(_0x10bc23[_0xbf4e('0x47')]==='user'){var _0x33ab9a=_0x2892ce['get']({'plain':!![]});var _0x4a050e=_0xbf4e('0x21');return db[_0xbf4e('0x48')]['find']({'where':{'name':_0x4a050e,'userProfileId':_0x10bc23[_0xbf4e('0x49')]},'raw':!![]})[_0xbf4e('0x1f')](function(_0x31d779){if(_0x31d779&&_0x31d779[_0xbf4e('0x4a')]===0x0){return db[_0xbf4e('0x22')][_0xbf4e('0x43')]({'name':_0x33ab9a[_0xbf4e('0x25')],'resourceId':_0x33ab9a['id'],'type':_0x31d779[_0xbf4e('0x25')],'sectionId':_0x31d779['id']},{})[_0xbf4e('0x1f')](function(){return _0x2892ce;});}else{return _0x2892ce;}})[_0xbf4e('0x3f')](function(_0x271ad2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x271ad2);throw _0x271ad2;});}return _0x2892ce;})[_0xbf4e('0x1f')](respondWithResult(_0x2fdba9,0xc9))[_0xbf4e('0x3f')](handleError(_0x2fdba9,null));};exports[_0xbf4e('0x4b')]=function(_0x586f5d,_0x339ce6){if(_0x586f5d[_0xbf4e('0x44')]['id']){delete _0x586f5d['body']['id'];}return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x586f5d['params']['id']}})['then'](handleEntityNotFound(_0x339ce6,null))[_0xbf4e('0x1f')](saveUpdates(_0x586f5d[_0xbf4e('0x44')],null))[_0xbf4e('0x1f')](respondWithResult(_0x339ce6,null))[_0xbf4e('0x3f')](handleError(_0x339ce6,null));};exports[_0xbf4e('0x20')]=function(_0x5ec2d9,_0x242a75){return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x5ec2d9['params']['id']}})[_0xbf4e('0x1f')](handleEntityNotFound(_0x242a75,null))['then'](removeEntity(_0x242a75,null))[_0xbf4e('0x3f')](handleError(_0x242a75,null));};exports[_0xbf4e('0x4c')]=function(_0x3e60e7,_0x16592f,_0xfd54c){return db['VoiceMail']['findOne']({'where':{'id':_0x3e60e7['params']['id']}})['then'](handleEntityNotFound(_0x16592f,null))[_0xbf4e('0x1f')](function(_0x453411){var _0x5cfc26;var _0x200096={},_0x23c335={};_0x23c335[_0xbf4e('0x2c')]=_[_0xbf4e('0x2d')](db[_0xbf4e('0x4d')][_0xbf4e('0x41')]);_0x23c335[_0xbf4e('0x32')]=_['keys'](_0x3e60e7[_0xbf4e('0x32')]);_0x23c335[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x23c335['model'],_0x23c335['query']);_0x200096[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x23c335[_0xbf4e('0x2c')],qs['fields'](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x200096[_0xbf4e('0x30')]=_0x200096[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x200096[_0xbf4e('0x30')]:_0x23c335[_0xbf4e('0x2c')];if(!_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x4e')](_0xbf4e('0x4f'))){_0x200096[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x3e60e7['query'][_0xbf4e('0x18')]);_0x200096['offset']=qs[_0xbf4e('0x16')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x200096[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x35')]);_0x200096[_0xbf4e('0x37')]=qs['filters'](_[_0xbf4e('0x36')](_0x3e60e7[_0xbf4e('0x32')],_0x23c335[_0xbf4e('0x2e')]));if(_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x3b')]){_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0x200096[_0xbf4e('0x30')],function(_0x12f19f){var _0x2c606b={};_0x2c606b[_0x12f19f]={'$like':'%'+_0x3e60e7['query'][_0xbf4e('0x3b')]+'%'};return _0x2c606b;})});}_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'mailboxuser':_0x453411[_0xbf4e('0x50')]});_0x200096=_[_0xbf4e('0x38')]({},_0x200096,_0x3e60e7['options']);return db[_0xbf4e('0x4d')]['findAndCountAll'](_0x200096)['then'](respondWithFilteredResult(_0x16592f,_0x200096));})[_0xbf4e('0x3f')](handleError(_0x16592f,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index f1121d3..d3cb894 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 _0x7b3a=['define','VoiceMail','voice_voicemail','mailbox','context','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x7b3a,0xd7));var _0xa7b3=function(_0x2025ea,_0x52d487){_0x2025ea=_0x2025ea-0x0;var _0x1607ae=_0x7b3a[_0x2025ea];return _0x1607ae;};'use strict';var _=require(_0xa7b3('0x0'));var util=require(_0xa7b3('0x1'));var logger=require('../../config/logger')(_0xa7b3('0x2'));var moment=require(_0xa7b3('0x3'));var BPromise=require(_0xa7b3('0x4'));var rp=require(_0xa7b3('0x5'));var fs=require('fs');var path=require(_0xa7b3('0x6'));var rimraf=require(_0xa7b3('0x7'));var config=require(_0xa7b3('0x8'));var attributes=require(_0xa7b3('0x9'));module['exports']=function(_0x5a4dfe,_0x17e600){return _0x5a4dfe[_0xa7b3('0xa')](_0xa7b3('0xb'),attributes,{'tableName':_0xa7b3('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xa7b3('0xd'),_0xa7b3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x94fe=['context','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox'];(function(_0x42aca7,_0x5acc37){var _0x1ccd4c=function(_0x19b6af){while(--_0x19b6af){_0x42aca7['push'](_0x42aca7['shift']());}};_0x1ccd4c(++_0x5acc37);}(_0x94fe,0xd1));var _0xe94f=function(_0x22d435,_0x1647e4){_0x22d435=_0x22d435-0x0;var _0x639e3f=_0x94fe[_0x22d435];return _0x639e3f;};'use strict';var _=require(_0xe94f('0x0'));var util=require(_0xe94f('0x1'));var logger=require(_0xe94f('0x2'))(_0xe94f('0x3'));var moment=require(_0xe94f('0x4'));var BPromise=require('bluebird');var rp=require(_0xe94f('0x5'));var fs=require('fs');var path=require(_0xe94f('0x6'));var rimraf=require(_0xe94f('0x7'));var config=require(_0xe94f('0x8'));var attributes=require(_0xe94f('0x9'));module[_0xe94f('0xa')]=function(_0x2a36ae,_0x10cbdc){return _0x2a36ae[_0xe94f('0xb')]('VoiceMail',attributes,{'tableName':_0xe94f('0xc'),'paranoid':![],'indexes':[{'name':_0xe94f('0xd'),'fields':[_0xe94f('0xe'),_0xe94f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 521f607..8263e63 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 _0xba71=['error','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0x3ef31b,_0x4be438){var _0x4fe171=function(_0x3df9da){while(--_0x3df9da){_0x3ef31b['push'](_0x3ef31b['shift']());}};_0x4fe171(++_0x4be438);}(_0xba71,0x125));var _0x1ba7=function(_0x1c6085,_0x53f5d9){_0x1c6085=_0x1c6085-0x0;var _0x2e9016=_0xba71[_0x1c6085];return _0x2e9016;};'use strict';var _=require(_0x1ba7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1ba7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ba7('0x2'))['db'];var utils=require(_0x1ba7('0x3'));var logger=require(_0x1ba7('0x4'))(_0x1ba7('0x5'));var config=require('../../config/environment');var jayson=require(_0x1ba7('0x6'));var client=jayson[_0x1ba7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a5c86,_0x46cfac,_0x35a6f1){return new BPromise(function(_0x5f5a2b,_0x55c40d){return client['request'](_0x4a5c86,_0x35a6f1)[_0x1ba7('0x8')](function(_0xcc2e72){logger[_0x1ba7('0x9')]('VoiceMail,\x20%s,\x20%s',_0x46cfac,_0x1ba7('0xa'));logger[_0x1ba7('0xb')](_0x1ba7('0xc'),_0x46cfac,_0x1ba7('0xa'),JSON['stringify'](_0xcc2e72));if(_0xcc2e72[_0x1ba7('0xd')]){if(_0xcc2e72[_0x1ba7('0xd')]['code']===0x1f4){logger[_0x1ba7('0xd')]('VoiceMail,\x20%s,\x20%s',_0x46cfac,_0xcc2e72[_0x1ba7('0xd')][_0x1ba7('0xe')]);return _0x55c40d(_0xcc2e72[_0x1ba7('0xd')][_0x1ba7('0xe')]);}logger[_0x1ba7('0xd')](_0x1ba7('0xf'),_0x46cfac,_0xcc2e72[_0x1ba7('0xd')][_0x1ba7('0xe')]);return _0x5f5a2b(_0xcc2e72[_0x1ba7('0xd')]['message']);}else{logger[_0x1ba7('0x9')](_0x1ba7('0xf'),_0x46cfac,_0x1ba7('0xa'));_0x5f5a2b(_0xcc2e72[_0x1ba7('0x10')][_0x1ba7('0xe')]);}})[_0x1ba7('0x11')](function(_0x36c8a7){logger[_0x1ba7('0xd')](_0x1ba7('0xf'),_0x46cfac,_0x36c8a7);_0x55c40d(_0x36c8a7);});});} \ No newline at end of file +var _0xd56d=['info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','message','catch','util','bluebird','randomstring','ioredis','../../config/utils','client','request'];(function(_0x5bc85f,_0xa9a9e0){var _0x44874d=function(_0x3a0f03){while(--_0x3a0f03){_0x5bc85f['push'](_0x5bc85f['shift']());}};_0x44874d(++_0xa9a9e0);}(_0xd56d,0x134));var _0xdd56=function(_0x484f06,_0x36e4ac){_0x484f06=_0x484f06-0x0;var _0x332d44=_0xd56d[_0x484f06];return _0x332d44;};'use strict';var _=require('lodash');var util=require(_0xdd56('0x0'));var moment=require('moment');var BPromise=require(_0xdd56('0x1'));var rs=require(_0xdd56('0x2'));var fs=require('fs');var Redis=require(_0xdd56('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd56('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdd56('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c67a9,_0xf8bbd6,_0x53b60b){return new BPromise(function(_0x21ad73,_0x502f7b){return client[_0xdd56('0x6')](_0x2c67a9,_0x53b60b)['then'](function(_0x205a3d){logger[_0xdd56('0x7')](_0xdd56('0x8'),_0xf8bbd6,_0xdd56('0x9'));logger[_0xdd56('0xa')](_0xdd56('0xb'),_0xf8bbd6,_0xdd56('0x9'),JSON['stringify'](_0x205a3d));if(_0x205a3d['error']){if(_0x205a3d[_0xdd56('0xc')]['code']===0x1f4){logger[_0xdd56('0xc')](_0xdd56('0x8'),_0xf8bbd6,_0x205a3d['error']['message']);return _0x502f7b(_0x205a3d['error'][_0xdd56('0xd')]);}logger[_0xdd56('0xc')](_0xdd56('0x8'),_0xf8bbd6,_0x205a3d['error'][_0xdd56('0xd')]);return _0x21ad73(_0x205a3d[_0xdd56('0xc')]['message']);}else{logger[_0xdd56('0x7')]('VoiceMail,\x20%s,\x20%s',_0xf8bbd6,_0xdd56('0x9'));_0x21ad73(_0x205a3d['result'][_0xdd56('0xd')]);}})[_0xdd56('0xe')](function(_0x8eb79b){logger[_0xdd56('0xc')](_0xdd56('0x8'),_0xf8bbd6,_0x8eb79b);_0x502f7b(_0x8eb79b);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 8bff22e..9536cc7 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 _0x3666=['destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','create','update'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x3666,0x68));var _0x6366=function(_0x72f807,_0x3d2b60){_0x72f807=_0x72f807-0x0;var _0x337b69=_0x3666[_0x72f807];return _0x337b69;};'use strict';var multer=require(_0x6366('0x0'));var util=require(_0x6366('0x1'));var path=require(_0x6366('0x2'));var timeout=require('connect-timeout');var express=require(_0x6366('0x3'));var router=express[_0x6366('0x4')]();var fs_extra=require(_0x6366('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6366('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x6366('0x7')]('/',auth[_0x6366('0x8')](),controller['index']);router[_0x6366('0x7')](_0x6366('0x9'),auth[_0x6366('0x8')](),controller[_0x6366('0xa')]);router[_0x6366('0x7')](_0x6366('0xb'),auth[_0x6366('0x8')](),controller[_0x6366('0xc')]);router['post']('/',auth[_0x6366('0x8')](),controller[_0x6366('0xd')]);router['put'](_0x6366('0x9'),auth[_0x6366('0x8')](),controller[_0x6366('0xe')]);router['delete'](_0x6366('0x9'),auth[_0x6366('0x8')](),controller[_0x6366('0xf')]);module[_0x6366('0x10')]=router; \ No newline at end of file +var _0x6358=['put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','/:id/download','download','post','create'];(function(_0x5e1cf7,_0x2954cf){var _0x2917db=function(_0x223aee){while(--_0x223aee){_0x5e1cf7['push'](_0x5e1cf7['shift']());}};_0x2917db(++_0x2954cf);}(_0x6358,0x1cf));var _0x8635=function(_0x40a39f,_0x5b92f9){_0x40a39f=_0x40a39f-0x0;var _0x87d929=_0x6358[_0x40a39f];return _0x87d929;};'use strict';var multer=require(_0x8635('0x0'));var util=require(_0x8635('0x1'));var path=require(_0x8635('0x2'));var timeout=require(_0x8635('0x3'));var express=require(_0x8635('0x4'));var router=express[_0x8635('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8635('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8635('0x7'));var controller=require(_0x8635('0x8'));router[_0x8635('0x9')]('/',auth['isAuthenticated'](),controller[_0x8635('0xa')]);router[_0x8635('0x9')](_0x8635('0xb'),auth[_0x8635('0xc')](),controller['show']);router['get'](_0x8635('0xd'),auth[_0x8635('0xc')](),controller[_0x8635('0xe')]);router[_0x8635('0xf')]('/',auth[_0x8635('0xc')](),controller[_0x8635('0x10')]);router[_0x8635('0x11')](_0x8635('0xb'),auth[_0x8635('0xc')](),controller[_0x8635('0x12')]);router[_0x8635('0x13')](_0x8635('0xb'),auth[_0x8635('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 7e6484c..7fde825 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 _0x7208=['INTEGER','STRING','BLOB','long','TIMESTAMP','literal','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x535a47,_0x4a9470){var _0x41bff4=function(_0x3e4ad1){while(--_0x3e4ad1){_0x535a47['push'](_0x535a47['shift']());}};_0x41bff4(++_0x4a9470);}(_0x7208,0x196));var _0x8720=function(_0x3cca79,_0x2abbcd){_0x3cca79=_0x3cca79-0x0;var _0x35fb6f=_0x7208[_0x3cca79];return _0x35fb6f;};'use strict';var Sequelize=require(_0x8720('0x0'));module[_0x8720('0x1')]={'name':{'type':Sequelize[_0x8720('0x2')],'get':function(_0x1089ea){return this[_0x8720('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x8720('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x8720('0x6')](_0x8720('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x8720('0x8'),'defaultValue':Sequelize[_0x8720('0x9')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xa2fd=['STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue'];(function(_0x20c2f4,_0x470117){var _0x2c4823=function(_0x581e46){while(--_0x581e46){_0x20c2f4['push'](_0x20c2f4['shift']());}};_0x2c4823(++_0x470117);}(_0xa2fd,0x96));var _0xda2f=function(_0x40061a,_0x272992){_0x40061a=_0x40061a-0x0;var _0x34067e=_0xa2fd[_0x40061a];return _0x34067e;};'use strict';var Sequelize=require(_0xda2f('0x0'));module[_0xda2f('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x34c337){return this[_0xda2f('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xda2f('0x4')](_0xda2f('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'stamp':{'type':_0xda2f('0x6'),'defaultValue':Sequelize[_0xda2f('0x7')](_0xda2f('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index aa9c2db..d13d48b 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 _0xb88f=['to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','findAll','show','keys','includeAll','include','find','create','body','catch','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x25d21c,_0x2a9f7e){var _0x5cde67=function(_0x173ec3){while(--_0x173ec3){_0x25d21c['push'](_0x25d21c['shift']());}};_0x5cde67(++_0x2a9f7e);}(_0xb88f,0x135));var _0xfb88=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0xb88f[_0x130d82];return _0x112070;};'use strict';var emlformat=require(_0xfb88('0x0'));var rimraf=require(_0xfb88('0x1'));var zipdir=require(_0xfb88('0x2'));var jsonpatch=require(_0xfb88('0x3'));var rp=require(_0xfb88('0x4'));var moment=require(_0xfb88('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfb88('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfb88('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb88('0x8'));var squel=require(_0xfb88('0x9'));var crypto=require(_0xfb88('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfb88('0xb'));var toCsv=require(_0xfb88('0x7'));var querystring=require(_0xfb88('0xc'));var Papa=require(_0xfb88('0xd'));var Redis=require(_0xfb88('0xe'));var authService=require(_0xfb88('0xf'));var qs=require(_0xfb88('0x10'));var as=require(_0xfb88('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfb88('0x12'));var utils=require('../../config/utils');var config=require(_0xfb88('0x13'));var licenseUtil=require(_0xfb88('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a20af,_0x281dd5){_0x281dd5=_0x281dd5||0xcc;return function(_0x30b604){if(_0x30b604){return _0x4a20af[_0xfb88('0x15')](_0x281dd5);}return _0x4a20af['status'](_0x281dd5)[_0xfb88('0x16')]();};}function respondWithResult(_0x1981a1,_0x18e645){_0x18e645=_0x18e645||0xc8;return function(_0x3dcc3a){if(_0x3dcc3a){return _0x1981a1[_0xfb88('0x17')](_0x18e645)[_0xfb88('0x18')](_0x3dcc3a);}};}function respondWithFilteredResult(_0x52aa9f,_0x48afa2){return function(_0x1dff06){if(_0x1dff06){var _0x35c24e=typeof _0x48afa2[_0xfb88('0x19')]==='undefined'&&typeof _0x48afa2['limit']==='undefined';var _0x25db95=_0x1dff06[_0xfb88('0x1a')];var _0x344b4a=_0x35c24e?0x0:_0x48afa2['offset'];var _0x380fbd=_0x35c24e?_0x1dff06['count']:_0x48afa2[_0xfb88('0x19')]+_0x48afa2['limit'];var _0x26705c;if(_0x380fbd>=_0x25db95){_0x380fbd=_0x25db95;_0x26705c=0xc8;}else{_0x26705c=0xce;}_0x52aa9f[_0xfb88('0x17')](_0x26705c);return _0x52aa9f[_0xfb88('0x1b')](_0xfb88('0x1c'),_0x344b4a+'-'+_0x380fbd+'/'+_0x25db95)[_0xfb88('0x18')](_0x1dff06);}return null;};}function patchUpdates(_0x195ecb){return function(_0x3f5c10){try{jsonpatch['apply'](_0x3f5c10,_0x195ecb,!![]);}catch(_0x40e268){return BPromise[_0xfb88('0x1d')](_0x40e268);}return _0x3f5c10[_0xfb88('0x1e')]();};}function saveUpdates(_0x541638,_0x384767){return function(_0x368ed4){if(_0x368ed4){return _0x368ed4[_0xfb88('0x1f')](_0x541638)[_0xfb88('0x20')](function(_0x1aa138){return _0x1aa138;});}return null;};}function removeEntity(_0x58a8c8,_0x3c3085){return function(_0x496cd8){if(_0x496cd8){return _0x496cd8[_0xfb88('0x21')]()[_0xfb88('0x20')](function(){_0x58a8c8[_0xfb88('0x17')](0xcc)[_0xfb88('0x16')]();});}};}function handleEntityNotFound(_0x47da68,_0x9a42b){return function(_0x53dcf8){if(!_0x53dcf8){_0x47da68['sendStatus'](0x194);}return _0x53dcf8;};}function handleError(_0x25339c,_0x196770){_0x196770=_0x196770||0x1f4;return function(_0x34b157){logger['error'](_0x34b157[_0xfb88('0x22')]);if(_0x34b157[_0xfb88('0x23')]){delete _0x34b157[_0xfb88('0x23')];}_0x25339c[_0xfb88('0x17')](_0x196770)[_0xfb88('0x24')](_0x34b157);};}exports[_0xfb88('0x25')]=function(_0x373c98,_0x521d74){var _0x6b8d8a={},_0x230d23={},_0x445041={'count':0x0,'rows':[]};var _0x760614=_[_0xfb88('0x26')](db['VoiceMailMessage'][_0xfb88('0x27')],function(_0xb5139f){return{'name':_0xb5139f[_0xfb88('0x28')],'type':_0xb5139f[_0xfb88('0x29')][_0xfb88('0x2a')]};});_0x230d23[_0xfb88('0x2b')]=_[_0xfb88('0x2c')](_[_0xfb88('0x26')](_0x760614,_0xfb88('0x23')),[_0xfb88('0x23')]);_0x230d23[_0xfb88('0x2d')]=_['keys'](_0x373c98[_0xfb88('0x2d')]);_0x230d23[_0xfb88('0x2e')]=_[_0xfb88('0x2f')](_0x230d23[_0xfb88('0x2b')],_0x230d23[_0xfb88('0x2d')]);_0x6b8d8a[_0xfb88('0x30')]=_[_0xfb88('0x2f')](_0x230d23[_0xfb88('0x2b')],qs[_0xfb88('0x31')](_0x373c98[_0xfb88('0x2d')][_0xfb88('0x31')]));_0x6b8d8a[_0xfb88('0x30')]=_0x6b8d8a[_0xfb88('0x30')][_0xfb88('0x32')]?_0x6b8d8a[_0xfb88('0x30')]:_0x230d23[_0xfb88('0x2b')];if(!_0x373c98[_0xfb88('0x2d')]['hasOwnProperty'](_0xfb88('0x33'))){_0x6b8d8a[_0xfb88('0x34')]=qs[_0xfb88('0x34')](_0x373c98[_0xfb88('0x2d')][_0xfb88('0x34')]);_0x6b8d8a[_0xfb88('0x19')]=qs[_0xfb88('0x19')](_0x373c98[_0xfb88('0x2d')]['offset']);}_0x6b8d8a[_0xfb88('0x35')]=qs[_0xfb88('0x36')](_0x373c98['query']['sort']);_0x6b8d8a[_0xfb88('0x37')]=qs[_0xfb88('0x2e')](_[_0xfb88('0x38')](_0x373c98[_0xfb88('0x2d')],_0x230d23['filters']),_0x760614);if(_0x373c98[_0xfb88('0x2d')][_0xfb88('0x39')]){_0x6b8d8a[_0xfb88('0x37')]=_[_0xfb88('0x3a')](_0x6b8d8a[_0xfb88('0x37')],{'$or':_[_0xfb88('0x26')](_0x760614,function(_0x59f516){if(_0x59f516[_0xfb88('0x29')]!==_0xfb88('0x3b')){var _0x40eece={};_0x40eece[_0x59f516[_0xfb88('0x23')]]={'$like':'%'+_0x373c98[_0xfb88('0x2d')][_0xfb88('0x39')]+'%'};return _0x40eece;}})});}_0x6b8d8a=_[_0xfb88('0x3a')]({},_0x6b8d8a,_0x373c98[_0xfb88('0x3c')]);var _0xfda141={'where':_0x6b8d8a['where']};return db['VoiceMailMessage'][_0xfb88('0x1a')](_0xfda141)[_0xfb88('0x20')](function(_0x122ef9){_0x445041[_0xfb88('0x1a')]=_0x122ef9;if(_0x373c98[_0xfb88('0x2d')]['includeAll']){_0x6b8d8a['include']=[{'all':!![]}];}return db[_0xfb88('0x3d')][_0xfb88('0x3e')](_0x6b8d8a);})[_0xfb88('0x20')](function(_0x506788){_0x445041['rows']=_0x506788;return _0x445041;})['then'](respondWithFilteredResult(_0x521d74,_0x6b8d8a))['catch'](handleError(_0x521d74,null));};exports[_0xfb88('0x3f')]=function(_0x5988f8,_0x265815){var _0x2ac767={'raw':!![],'where':{'id':_0x5988f8['params']['id']}},_0x3ed237={};_0x3ed237[_0xfb88('0x2b')]=_[_0xfb88('0x40')](db[_0xfb88('0x3d')][_0xfb88('0x27')]);_0x3ed237[_0xfb88('0x2d')]=_[_0xfb88('0x40')](_0x5988f8['query']);_0x3ed237['filters']=_[_0xfb88('0x2f')](_0x3ed237[_0xfb88('0x2b')],_0x3ed237['query']);_0x2ac767[_0xfb88('0x30')]=_['intersection'](_0x3ed237[_0xfb88('0x2b')],qs['fields'](_0x5988f8['query'][_0xfb88('0x31')]));_0x2ac767[_0xfb88('0x30')]=_0x2ac767['attributes']['length']?_0x2ac767[_0xfb88('0x30')]:_0x3ed237['model'];if(_0x5988f8[_0xfb88('0x2d')][_0xfb88('0x41')]){_0x2ac767[_0xfb88('0x42')]=[{'all':!![]}];}_0x2ac767=_['merge']({},_0x2ac767,_0x5988f8[_0xfb88('0x3c')]);return db['VoiceMailMessage'][_0xfb88('0x43')](_0x2ac767)[_0xfb88('0x20')](handleEntityNotFound(_0x265815,null))[_0xfb88('0x20')](respondWithResult(_0x265815,null))['catch'](handleError(_0x265815,null));};exports[_0xfb88('0x44')]=function(_0x568019,_0x3d0788){return db[_0xfb88('0x3d')][_0xfb88('0x44')](_0x568019[_0xfb88('0x45')],{})['then'](respondWithResult(_0x3d0788,0xc9))[_0xfb88('0x46')](handleError(_0x3d0788,null));};exports['update']=function(_0x45bbe2,_0x112440){if(_0x45bbe2[_0xfb88('0x45')]['id']){delete _0x45bbe2['body']['id'];}return db['VoiceMailMessage'][_0xfb88('0x43')]({'where':{'id':_0x45bbe2['params']['id']}})[_0xfb88('0x20')](handleEntityNotFound(_0x112440,null))['then'](saveUpdates(_0x45bbe2['body'],null))[_0xfb88('0x20')](respondWithResult(_0x112440,null))[_0xfb88('0x46')](handleError(_0x112440,null));};exports[_0xfb88('0x21')]=function(_0x11c6e7,_0x426dbc){return db[_0xfb88('0x3d')][_0xfb88('0x43')]({'where':{'id':_0x11c6e7[_0xfb88('0x47')]['id']}})['then'](handleEntityNotFound(_0x426dbc,null))['then'](removeEntity(_0x426dbc,null))[_0xfb88('0x46')](handleError(_0x426dbc,null));};exports[_0xfb88('0x48')]=function(_0x3f9f54,_0x34f2b8,_0x117a4b){return db[_0xfb88('0x3d')][_0xfb88('0x43')]({'where':{'id':_0x3f9f54['params']['id']},'attributes':['id',_0xfb88('0x49'),_0xfb88('0x4a')]})[_0xfb88('0x20')](handleEntityNotFound(_0x34f2b8,null))[_0xfb88('0x20')](function(_0x4e0634){if(_0x4e0634){if(!_0x4e0634[_0xfb88('0x49')]){throw new db[(_0xfb88('0x4b'))][(_0xfb88('0x4c'))](_0xfb88('0x4d'));}var _0x13311d={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x4e0634[_0xfb88('0x4a')]){_0x13311d['Content-Disposition']='attachment;\x20filename=\x22'+_0x4e0634[_0xfb88('0x4a')]+_0xfb88('0x4e');}_0x34f2b8['set'](_0x13311d);return _0x34f2b8[_0xfb88('0x24')](new Buffer(_0x4e0634['recording']));}})[_0xfb88('0x46')](handleError(_0x34f2b8,null));}; \ No newline at end of file +var _0x3962=['util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','end','error','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','destroy','find','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','send','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x228800,_0x1a89fe){var _0x5383f9=function(_0x20e98b){while(--_0x20e98b){_0x228800['push'](_0x228800['shift']());}};_0x5383f9(++_0x1a89fe);}(_0x3962,0x199));var _0x2396=function(_0x31efed,_0xdd9a51){_0x31efed=_0x31efed-0x0;var _0x24d4bc=_0x3962[_0x31efed];return _0x24d4bc;};'use strict';var emlformat=require(_0x2396('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2396('0x1'));var jsonpatch=require(_0x2396('0x2'));var rp=require('request-promise');var moment=require(_0x2396('0x3'));var BPromise=require(_0x2396('0x4'));var Mustache=require(_0x2396('0x5'));var util=require(_0x2396('0x6'));var path=require(_0x2396('0x7'));var sox=require(_0x2396('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2396('0x9'));var squel=require(_0x2396('0xa'));var crypto=require('crypto');var jsforce=require(_0x2396('0xb'));var deskjs=require(_0x2396('0xc'));var toCsv=require(_0x2396('0xd'));var querystring=require(_0x2396('0xe'));var Papa=require(_0x2396('0xf'));var Redis=require(_0x2396('0x10'));var authService=require(_0x2396('0x11'));var qs=require(_0x2396('0x12'));var as=require(_0x2396('0x13'));var hardwareService=require(_0x2396('0x14'));var logger=require('../../config/logger')(_0x2396('0x15'));var utils=require(_0x2396('0x16'));var config=require(_0x2396('0x17'));var licenseUtil=require(_0x2396('0x18'));var db=require(_0x2396('0x19'))['db'];function respondWithStatusCode(_0x41ce19,_0x14dc7b){_0x14dc7b=_0x14dc7b||0xcc;return function(_0x1fc755){if(_0x1fc755){return _0x41ce19[_0x2396('0x1a')](_0x14dc7b);}return _0x41ce19[_0x2396('0x1b')](_0x14dc7b)['end']();};}function respondWithResult(_0x292822,_0xdcebf7){_0xdcebf7=_0xdcebf7||0xc8;return function(_0x4a91f1){if(_0x4a91f1){return _0x292822[_0x2396('0x1b')](_0xdcebf7)[_0x2396('0x1c')](_0x4a91f1);}};}function respondWithFilteredResult(_0x6cd7ae,_0x3a2137){return function(_0x362f04){if(_0x362f04){var _0x5949c2=typeof _0x3a2137[_0x2396('0x1d')]===_0x2396('0x1e')&&typeof _0x3a2137[_0x2396('0x1f')]==='undefined';var _0x31eb4a=_0x362f04[_0x2396('0x20')];var _0x62f82f=_0x5949c2?0x0:_0x3a2137[_0x2396('0x1d')];var _0x19b380=_0x5949c2?_0x362f04[_0x2396('0x20')]:_0x3a2137['offset']+_0x3a2137['limit'];var _0x5418d0;if(_0x19b380>=_0x31eb4a){_0x19b380=_0x31eb4a;_0x5418d0=0xc8;}else{_0x5418d0=0xce;}_0x6cd7ae[_0x2396('0x1b')](_0x5418d0);return _0x6cd7ae[_0x2396('0x21')](_0x2396('0x22'),_0x62f82f+'-'+_0x19b380+'/'+_0x31eb4a)['json'](_0x362f04);}return null;};}function patchUpdates(_0xa20190){return function(_0xf48cf7){try{jsonpatch['apply'](_0xf48cf7,_0xa20190,!![]);}catch(_0x1a9386){return BPromise[_0x2396('0x23')](_0x1a9386);}return _0xf48cf7[_0x2396('0x24')]();};}function saveUpdates(_0x471989,_0x1bfaf0){return function(_0x10d47e){if(_0x10d47e){return _0x10d47e['update'](_0x471989)[_0x2396('0x25')](function(_0x312097){return _0x312097;});}return null;};}function removeEntity(_0x43a68a,_0x1d4b63){return function(_0x2f23af){if(_0x2f23af){return _0x2f23af['destroy']()[_0x2396('0x25')](function(){_0x43a68a['status'](0xcc)[_0x2396('0x26')]();});}};}function handleEntityNotFound(_0x53a47b,_0xc51a48){return function(_0x195086){if(!_0x195086){_0x53a47b[_0x2396('0x1a')](0x194);}return _0x195086;};}function handleError(_0x697974,_0x1bc3f3){_0x1bc3f3=_0x1bc3f3||0x1f4;return function(_0x2da688){logger[_0x2396('0x27')](_0x2da688['stack']);if(_0x2da688[_0x2396('0x28')]){delete _0x2da688[_0x2396('0x28')];}_0x697974[_0x2396('0x1b')](_0x1bc3f3)['send'](_0x2da688);};}exports[_0x2396('0x29')]=function(_0x146771,_0x1e5575){var _0x19be80={},_0x4c950f={},_0x45b03b={'count':0x0,'rows':[]};var _0x319fdc=_[_0x2396('0x2a')](db[_0x2396('0x2b')][_0x2396('0x2c')],function(_0xdc498c){return{'name':_0xdc498c[_0x2396('0x2d')],'type':_0xdc498c[_0x2396('0x2e')][_0x2396('0x2f')]};});_0x4c950f[_0x2396('0x30')]=_['differenceBy'](_[_0x2396('0x2a')](_0x319fdc,_0x2396('0x28')),[_0x2396('0x28')]);_0x4c950f[_0x2396('0x31')]=_[_0x2396('0x32')](_0x146771[_0x2396('0x31')]);_0x4c950f['filters']=_[_0x2396('0x33')](_0x4c950f[_0x2396('0x30')],_0x4c950f['query']);_0x19be80['attributes']=_[_0x2396('0x33')](_0x4c950f['model'],qs[_0x2396('0x34')](_0x146771[_0x2396('0x31')][_0x2396('0x34')]));_0x19be80[_0x2396('0x35')]=_0x19be80['attributes'][_0x2396('0x36')]?_0x19be80[_0x2396('0x35')]:_0x4c950f[_0x2396('0x30')];if(!_0x146771[_0x2396('0x31')][_0x2396('0x37')]('nolimit')){_0x19be80[_0x2396('0x1f')]=qs[_0x2396('0x1f')](_0x146771[_0x2396('0x31')]['limit']);_0x19be80[_0x2396('0x1d')]=qs['offset'](_0x146771[_0x2396('0x31')][_0x2396('0x1d')]);}_0x19be80['order']=qs[_0x2396('0x38')](_0x146771[_0x2396('0x31')][_0x2396('0x38')]);_0x19be80['where']=qs['filters'](_[_0x2396('0x39')](_0x146771['query'],_0x4c950f[_0x2396('0x3a')]),_0x319fdc);if(_0x146771['query'][_0x2396('0x3b')]){_0x19be80[_0x2396('0x3c')]=_['merge'](_0x19be80['where'],{'$or':_[_0x2396('0x2a')](_0x319fdc,function(_0x367e07){if(_0x367e07[_0x2396('0x2e')]!=='VIRTUAL'){var _0x1e8330={};_0x1e8330[_0x367e07[_0x2396('0x28')]]={'$like':'%'+_0x146771[_0x2396('0x31')]['filter']+'%'};return _0x1e8330;}})});}_0x19be80=_[_0x2396('0x3d')]({},_0x19be80,_0x146771[_0x2396('0x3e')]);var _0x243a51={'where':_0x19be80['where']};return db[_0x2396('0x2b')][_0x2396('0x20')](_0x243a51)[_0x2396('0x25')](function(_0xa701d5){_0x45b03b[_0x2396('0x20')]=_0xa701d5;if(_0x146771['query'][_0x2396('0x3f')]){_0x19be80[_0x2396('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x2396('0x41')](_0x19be80);})['then'](function(_0x486c57){_0x45b03b[_0x2396('0x42')]=_0x486c57;return _0x45b03b;})[_0x2396('0x25')](respondWithFilteredResult(_0x1e5575,_0x19be80))[_0x2396('0x43')](handleError(_0x1e5575,null));};exports[_0x2396('0x44')]=function(_0x6cd6b6,_0x5bbee1){var _0x2d51f4={'raw':!![],'where':{'id':_0x6cd6b6[_0x2396('0x45')]['id']}},_0x9225cc={};_0x9225cc['model']=_[_0x2396('0x32')](db[_0x2396('0x2b')][_0x2396('0x2c')]);_0x9225cc['query']=_[_0x2396('0x32')](_0x6cd6b6['query']);_0x9225cc['filters']=_[_0x2396('0x33')](_0x9225cc[_0x2396('0x30')],_0x9225cc['query']);_0x2d51f4['attributes']=_[_0x2396('0x33')](_0x9225cc['model'],qs[_0x2396('0x34')](_0x6cd6b6[_0x2396('0x31')][_0x2396('0x34')]));_0x2d51f4[_0x2396('0x35')]=_0x2d51f4[_0x2396('0x35')][_0x2396('0x36')]?_0x2d51f4[_0x2396('0x35')]:_0x9225cc[_0x2396('0x30')];if(_0x6cd6b6[_0x2396('0x31')]['includeAll']){_0x2d51f4['include']=[{'all':!![]}];}_0x2d51f4=_[_0x2396('0x3d')]({},_0x2d51f4,_0x6cd6b6[_0x2396('0x3e')]);return db[_0x2396('0x2b')]['find'](_0x2d51f4)[_0x2396('0x25')](handleEntityNotFound(_0x5bbee1,null))[_0x2396('0x25')](respondWithResult(_0x5bbee1,null))[_0x2396('0x43')](handleError(_0x5bbee1,null));};exports['create']=function(_0x3c61c5,_0x45f9d9){return db['VoiceMailMessage'][_0x2396('0x46')](_0x3c61c5[_0x2396('0x47')],{})[_0x2396('0x25')](respondWithResult(_0x45f9d9,0xc9))['catch'](handleError(_0x45f9d9,null));};exports[_0x2396('0x48')]=function(_0x525a3e,_0x16f9b3){if(_0x525a3e[_0x2396('0x47')]['id']){delete _0x525a3e[_0x2396('0x47')]['id'];}return db[_0x2396('0x2b')]['find']({'where':{'id':_0x525a3e[_0x2396('0x45')]['id']}})[_0x2396('0x25')](handleEntityNotFound(_0x16f9b3,null))['then'](saveUpdates(_0x525a3e[_0x2396('0x47')],null))[_0x2396('0x25')](respondWithResult(_0x16f9b3,null))[_0x2396('0x43')](handleError(_0x16f9b3,null));};exports[_0x2396('0x49')]=function(_0x9befd2,_0x42b028){return db[_0x2396('0x2b')][_0x2396('0x4a')]({'where':{'id':_0x9befd2[_0x2396('0x45')]['id']}})[_0x2396('0x25')](handleEntityNotFound(_0x42b028,null))[_0x2396('0x25')](removeEntity(_0x42b028,null))[_0x2396('0x43')](handleError(_0x42b028,null));};exports['download']=function(_0x2d8773,_0x15a253,_0xe2ee0c){return db[_0x2396('0x2b')]['find']({'where':{'id':_0x2d8773[_0x2396('0x45')]['id']},'attributes':['id',_0x2396('0x4b'),_0x2396('0x4c')]})[_0x2396('0x25')](handleEntityNotFound(_0x15a253,null))['then'](function(_0x33e649){if(_0x33e649){if(!_0x33e649[_0x2396('0x4b')]){throw new db['Sequelize'][(_0x2396('0x4d'))](_0x2396('0x4e'));}var _0x5bfa30={'Content-Type':'audio/wav','Content-Disposition':_0x2396('0x4f')};if(_0x33e649[_0x2396('0x4c')]){_0x5bfa30[_0x2396('0x50')]=_0x2396('0x51')+_0x33e649[_0x2396('0x4c')]+'.wav\x22';}_0x15a253[_0x2396('0x21')](_0x5bfa30);return _0x15a253[_0x2396('0x52')](new Buffer(_0x33e649['recording']));}})[_0x2396('0x43')](handleError(_0x15a253,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 7d291e6..794fa17 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 _0x1898=['request-promise','rimraf','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','bluebird'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x1898,0x98));var _0x8189=function(_0x31c918,_0x59e824){_0x31c918=_0x31c918-0x0;var _0x3056d3=_0x1898[_0x31c918];return _0x3056d3;};'use strict';var _=require(_0x8189('0x0'));var util=require(_0x8189('0x1'));var logger=require('../../config/logger')(_0x8189('0x2'));var moment=require('moment');var BPromise=require(_0x8189('0x3'));var rp=require(_0x8189('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8189('0x5'));var config=require(_0x8189('0x6'));var attributes=require('./voiceMailMessage.attributes');module[_0x8189('0x7')]=function(_0x5a0201,_0x2b4209){return _0x5a0201[_0x8189('0x8')](_0x8189('0x9'),attributes,{'tableName':_0x8189('0xa'),'paranoid':![],'indexes':[{'name':_0x8189('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x4bbe=['dir','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x2e98a4,_0x1beee2){var _0x1e31d9=function(_0x3d4605){while(--_0x3d4605){_0x2e98a4['push'](_0x2e98a4['shift']());}};_0x1e31d9(++_0x1beee2);}(_0x4bbe,0xe5));var _0xe4bb=function(_0x1a6c24,_0xe10515){_0x1a6c24=_0x1a6c24-0x0;var _0x40a9fd=_0x4bbe[_0x1a6c24];return _0x40a9fd;};'use strict';var _=require(_0xe4bb('0x0'));var util=require('util');var logger=require(_0xe4bb('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe4bb('0x2'));var rp=require(_0xe4bb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4bb('0x4'));var config=require(_0xe4bb('0x5'));var attributes=require(_0xe4bb('0x6'));module[_0xe4bb('0x7')]=function(_0x4d3719,_0x448891){return _0x4d3719[_0xe4bb('0x8')](_0xe4bb('0x9'),attributes,{'tableName':_0xe4bb('0xa'),'paranoid':![],'indexes':[{'name':_0xe4bb('0xb'),'fields':[_0xe4bb('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0a6ee5e..057a58a 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 _0x42b2=['client','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2ecfca,_0x4f5d2c){var _0x3cbd36=function(_0x3f7c17){while(--_0x3f7c17){_0x2ecfca['push'](_0x2ecfca['shift']());}};_0x3cbd36(++_0x4f5d2c);}(_0x42b2,0x107));var _0x242b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x42b2[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x242b('0x0'));var util=require(_0x242b('0x1'));var moment=require(_0x242b('0x2'));var BPromise=require(_0x242b('0x3'));var rs=require(_0x242b('0x4'));var fs=require('fs');var Redis=require(_0x242b('0x5'));var db=require(_0x242b('0x6'))['db'];var utils=require(_0x242b('0x7'));var logger=require(_0x242b('0x8'))(_0x242b('0x9'));var config=require(_0x242b('0xa'));var jayson=require(_0x242b('0xb'));var client=jayson[_0x242b('0xc')][_0x242b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2aa2a8,_0x304213,_0x2fd43d){return new BPromise(function(_0x5c8ac1,_0x1b7eb4){return client['request'](_0x2aa2a8,_0x2fd43d)['then'](function(_0x577f21){logger[_0x242b('0xe')](_0x242b('0xf'),_0x304213,_0x242b('0x10'));logger[_0x242b('0x11')](_0x242b('0x12'),_0x304213,_0x242b('0x10'),JSON[_0x242b('0x13')](_0x577f21));if(_0x577f21[_0x242b('0x14')]){if(_0x577f21[_0x242b('0x14')][_0x242b('0x15')]===0x1f4){logger[_0x242b('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x304213,_0x577f21[_0x242b('0x14')]['message']);return _0x1b7eb4(_0x577f21['error'][_0x242b('0x16')]);}logger[_0x242b('0x14')](_0x242b('0xf'),_0x304213,_0x577f21[_0x242b('0x14')][_0x242b('0x16')]);return _0x5c8ac1(_0x577f21[_0x242b('0x14')][_0x242b('0x16')]);}else{logger[_0x242b('0xe')](_0x242b('0xf'),_0x304213,_0x242b('0x10'));_0x5c8ac1(_0x577f21[_0x242b('0x17')]['message']);}})[_0x242b('0x18')](function(_0x4cb971){logger[_0x242b('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x304213,_0x4cb971);_0x1b7eb4(_0x4cb971);});});} \ No newline at end of file +var _0xd9d9=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5c33d4,_0x1f8d84){var _0x4e407f=function(_0x47d6af){while(--_0x47d6af){_0x5c33d4['push'](_0x5c33d4['shift']());}};_0x4e407f(++_0x1f8d84);}(_0xd9d9,0x1de));var _0x9d9d=function(_0x3f56cf,_0x3882f7){_0x3f56cf=_0x3f56cf-0x0;var _0x3cd779=_0xd9d9[_0x3f56cf];return _0x3cd779;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9d9d('0x0'));var BPromise=require(_0x9d9d('0x1'));var rs=require(_0x9d9d('0x2'));var fs=require('fs');var Redis=require(_0x9d9d('0x3'));var db=require(_0x9d9d('0x4'))['db'];var utils=require(_0x9d9d('0x5'));var logger=require('../../config/logger')(_0x9d9d('0x6'));var config=require(_0x9d9d('0x7'));var jayson=require(_0x9d9d('0x8'));var client=jayson['client'][_0x9d9d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25682f,_0x5cd93b,_0x5a92b3){return new BPromise(function(_0x30831c,_0x1c1449){return client[_0x9d9d('0xa')](_0x25682f,_0x5a92b3)[_0x9d9d('0xb')](function(_0x482b85){logger[_0x9d9d('0xc')](_0x9d9d('0xd'),_0x5cd93b,_0x9d9d('0xe'));logger[_0x9d9d('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x5cd93b,_0x9d9d('0xe'),JSON[_0x9d9d('0x10')](_0x482b85));if(_0x482b85[_0x9d9d('0x11')]){if(_0x482b85[_0x9d9d('0x11')]['code']===0x1f4){logger[_0x9d9d('0x11')](_0x9d9d('0xd'),_0x5cd93b,_0x482b85[_0x9d9d('0x11')][_0x9d9d('0x12')]);return _0x1c1449(_0x482b85['error'][_0x9d9d('0x12')]);}logger[_0x9d9d('0x11')](_0x9d9d('0xd'),_0x5cd93b,_0x482b85[_0x9d9d('0x11')][_0x9d9d('0x12')]);return _0x30831c(_0x482b85['error'][_0x9d9d('0x12')]);}else{logger[_0x9d9d('0xc')](_0x9d9d('0xd'),_0x5cd93b,_0x9d9d('0xe'));_0x30831c(_0x482b85[_0x9d9d('0x13')][_0x9d9d('0x12')]);}})[_0x9d9d('0x14')](function(_0x132ac0){logger[_0x9d9d('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x5cd93b,_0x132ac0);_0x1c1449(_0x132ac0);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 7ea966c..f9239d4 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 _0x30d2=['put','/:id','update','delete','destroy','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','show','get','/:id/sounds','getSounds','create','post','addSound'];(function(_0x2dc5b5,_0x10d82c){var _0x2a8ccc=function(_0x2de9da){while(--_0x2de9da){_0x2dc5b5['push'](_0x2dc5b5['shift']());}};_0x2a8ccc(++_0x10d82c);}(_0x30d2,0x125));var _0x230d=function(_0x4200e3,_0xb34e23){_0x4200e3=_0x4200e3-0x0;var _0x26ac37=_0x30d2[_0x4200e3];return _0x26ac37;};'use strict';var multer=require(_0x230d('0x0'));var util=require(_0x230d('0x1'));var path=require(_0x230d('0x2'));var timeout=require(_0x230d('0x3'));var express=require('express');var router=express[_0x230d('0x4')]();var fs_extra=require(_0x230d('0x5'));var auth=require(_0x230d('0x6'));var interaction=require(_0x230d('0x7'));var config=require(_0x230d('0x8'));var controller=require(_0x230d('0x9'));router['get']('/',auth[_0x230d('0xa')](),controller[_0x230d('0xb')]);router['get']('/:id',auth[_0x230d('0xa')](),controller[_0x230d('0xc')]);router[_0x230d('0xd')](_0x230d('0xe'),auth[_0x230d('0xa')](),controller[_0x230d('0xf')]);router['post']('/',auth[_0x230d('0xa')](),controller[_0x230d('0x10')]);router[_0x230d('0x11')](_0x230d('0xe'),auth['isAuthenticated'](),controller[_0x230d('0x12')]);router[_0x230d('0x13')](_0x230d('0x14'),auth[_0x230d('0xa')](),controller[_0x230d('0x15')]);router[_0x230d('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x230d('0x17')]);router[_0x230d('0x16')](_0x230d('0x18'),auth[_0x230d('0xa')](),controller['removeSound']);module[_0x230d('0x19')]=router; \ No newline at end of file +var _0x78c8=['/:id/sounds','addSound','put','update','destroy','delete','/:id/sounds/:id2','multer','util','path','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSounds','post','create'];(function(_0x5c2e7e,_0x35ad6b){var _0x83db0=function(_0x278d53){while(--_0x278d53){_0x5c2e7e['push'](_0x5c2e7e['shift']());}};_0x83db0(++_0x35ad6b);}(_0x78c8,0x1ab));var _0x878c=function(_0x1c9a98,_0x39f1c4){_0x1c9a98=_0x1c9a98-0x0;var _0x5e9786=_0x78c8[_0x1c9a98];return _0x5e9786;};'use strict';var multer=require(_0x878c('0x0'));var util=require(_0x878c('0x1'));var path=require(_0x878c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x878c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x878c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x878c('0x5'));var controller=require('./voiceMusicOnHold.controller');router[_0x878c('0x6')]('/',auth[_0x878c('0x7')](),controller[_0x878c('0x8')]);router[_0x878c('0x6')](_0x878c('0x9'),auth[_0x878c('0x7')](),controller[_0x878c('0xa')]);router[_0x878c('0x6')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x878c('0xb')]);router[_0x878c('0xc')]('/',auth[_0x878c('0x7')](),controller[_0x878c('0xd')]);router[_0x878c('0xc')](_0x878c('0xe'),auth['isAuthenticated'](),controller[_0x878c('0xf')]);router[_0x878c('0x10')](_0x878c('0x9'),auth[_0x878c('0x7')](),controller[_0x878c('0x11')]);router['delete'](_0x878c('0x9'),auth[_0x878c('0x7')](),controller[_0x878c('0x12')]);router[_0x878c('0x13')](_0x878c('0x14'),auth[_0x878c('0x7')](),controller['removeSound']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 7f98162..e072c7d 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 _0x40ca=['quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','custom','files','mp3nb'];(function(_0x9e575,_0x5894d4){var _0x522277=function(_0x1f5458){while(--_0x1f5458){_0x9e575['push'](_0x9e575['shift']());}};_0x522277(++_0x5894d4);}(_0x40ca,0x1d9));var _0xa40c=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x40ca[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0xa40c('0x0'));module[_0xa40c('0x1')]={'name':{'type':Sequelize[_0xa40c('0x2')],'allowNull':![],'unique':_0xa40c('0x3')},'mode':{'type':Sequelize['ENUM'](_0xa40c('0x4'),_0xa40c('0x5'),_0xa40c('0x6'),'quietmp3nb',_0xa40c('0x7'),_0xa40c('0x8')),'allowNull':!![],'defaultValue':_0xa40c('0x5')},'directory':{'type':Sequelize[_0xa40c('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa40c('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa40c('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa40c('0x2')],'allowNull':!![],'defaultValue':_0xa40c('0x9')},'format':{'type':Sequelize[_0xa40c('0x2')],'allowNull':!![]},'stamp':{'type':_0xa40c('0xa')},'defaultEntry':{'type':Sequelize[_0xa40c('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x96fe=['ENUM','files','mp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','name'];(function(_0x5b54c1,_0x51aba9){var _0x592f7d=function(_0x43eb8d){while(--_0x43eb8d){_0x5b54c1['push'](_0x5b54c1['shift']());}};_0x592f7d(++_0x51aba9);}(_0x96fe,0x127));var _0xe96f=function(_0x3b698d,_0xf2146e){_0x3b698d=_0x3b698d-0x0;var _0x2bd341=_0x96fe[_0x3b698d];return _0x2bd341;};'use strict';var Sequelize=require(_0xe96f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe96f('0x1')},'mode':{'type':Sequelize[_0xe96f('0x2')]('custom',_0xe96f('0x3'),_0xe96f('0x4'),'quietmp3nb',_0xe96f('0x5'),_0xe96f('0x6')),'allowNull':!![],'defaultValue':_0xe96f('0x3')},'directory':{'type':Sequelize[_0xe96f('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0xe96f('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe96f('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe96f('0x7')],'allowNull':!![],'defaultValue':_0xe96f('0x8')},'format':{'type':Sequelize[_0xe96f('0x7')],'allowNull':!![]},'stamp':{'type':_0xe96f('0x9')},'defaultEntry':{'type':Sequelize[_0xe96f('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index e7504c6..77dc711 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 _0xe704=['rows','fields','length','includeAll','include','find','catch','body','params','create','sequelize','transaction','mode','files','directory','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','readdirSync','unlinkSync','join','rmdirSync','Sequelize','ValidationError','addSound','findOne','save_name','converted_format','createdAt','root','%s.%s','symlinkSync','removeSound','id2','format','message','getSounds','Sound','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','VoiceMusicOnHold','fieldName','key','model','map','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0xe704,0x1cd));var _0x4e70=function(_0x173591,_0x559922){_0x173591=_0x173591-0x0;var _0x1b1233=_0xe704[_0x173591];return _0x1b1233;};'use strict';var emlformat=require(_0x4e70('0x0'));var rimraf=require(_0x4e70('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e70('0x2'));var rp=require(_0x4e70('0x3'));var moment=require(_0x4e70('0x4'));var BPromise=require(_0x4e70('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4e70('0x6'));var sox=require(_0x4e70('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e70('0x8'));var _=require(_0x4e70('0x9'));var squel=require(_0x4e70('0xa'));var crypto=require('crypto');var jsforce=require(_0x4e70('0xb'));var deskjs=require(_0x4e70('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e70('0xd'));var authService=require(_0x4e70('0xe'));var qs=require(_0x4e70('0xf'));var as=require(_0x4e70('0x10'));var hardwareService=require(_0x4e70('0x11'));var logger=require('../../config/logger')(_0x4e70('0x12'));var utils=require('../../config/utils');var config=require(_0x4e70('0x13'));var licenseUtil=require(_0x4e70('0x14'));var db=require(_0x4e70('0x15'))['db'];function respondWithStatusCode(_0x187259,_0x122f49){_0x122f49=_0x122f49||0xcc;return function(_0x30b338){if(_0x30b338){return _0x187259[_0x4e70('0x16')](_0x122f49);}return _0x187259[_0x4e70('0x17')](_0x122f49)[_0x4e70('0x18')]();};}function respondWithResult(_0x20098b,_0x5fb63b){_0x5fb63b=_0x5fb63b||0xc8;return function(_0x28f67f){if(_0x28f67f){return _0x20098b[_0x4e70('0x17')](_0x5fb63b)[_0x4e70('0x19')](_0x28f67f);}};}function respondWithFilteredResult(_0x21e7b2,_0x1d3711){return function(_0x4c4677){if(_0x4c4677){var _0x3f1468=typeof _0x1d3711[_0x4e70('0x1a')]===_0x4e70('0x1b')&&typeof _0x1d3711[_0x4e70('0x1c')]===_0x4e70('0x1b');var _0x2e0148=_0x4c4677[_0x4e70('0x1d')];var _0x455671=_0x3f1468?0x0:_0x1d3711['offset'];var _0x2dcb68=_0x3f1468?_0x4c4677[_0x4e70('0x1d')]:_0x1d3711['offset']+_0x1d3711[_0x4e70('0x1c')];var _0x32ecb8;if(_0x2dcb68>=_0x2e0148){_0x2dcb68=_0x2e0148;_0x32ecb8=0xc8;}else{_0x32ecb8=0xce;}_0x21e7b2[_0x4e70('0x17')](_0x32ecb8);return _0x21e7b2[_0x4e70('0x1e')](_0x4e70('0x1f'),_0x455671+'-'+_0x2dcb68+'/'+_0x2e0148)[_0x4e70('0x19')](_0x4c4677);}return null;};}function patchUpdates(_0x525d68){return function(_0x49434b){try{jsonpatch[_0x4e70('0x20')](_0x49434b,_0x525d68,!![]);}catch(_0x461695){return BPromise['reject'](_0x461695);}return _0x49434b[_0x4e70('0x21')]();};}function saveUpdates(_0x13956b,_0x13310d){return function(_0x2932df){if(_0x2932df){return _0x2932df[_0x4e70('0x22')](_0x13956b)[_0x4e70('0x23')](function(_0x1c4db8){return _0x1c4db8;});}return null;};}function removeEntity(_0x5a7e19,_0x188ed3){return function(_0x2657b8){if(_0x2657b8){return _0x2657b8[_0x4e70('0x24')]()[_0x4e70('0x23')](function(){var _0x5580c3=_0x2657b8[_0x4e70('0x25')]({'plain':!![]});var _0x26ede7=_0x4e70('0x26');return db[_0x4e70('0x27')][_0x4e70('0x24')]({'where':{'type':_0x26ede7,'resourceId':_0x5580c3['id']}})['then'](function(){return _0x2657b8;});})['then'](function(){_0x5a7e19[_0x4e70('0x17')](0xcc)[_0x4e70('0x18')]();});}};}function handleEntityNotFound(_0x2b68eb,_0x5ec4df){return function(_0x5176b7){if(!_0x5176b7){_0x2b68eb[_0x4e70('0x16')](0x194);}return _0x5176b7;};}function handleError(_0x2b6d89,_0x1d87f6){_0x1d87f6=_0x1d87f6||0x1f4;return function(_0x174bd5){logger[_0x4e70('0x28')](_0x174bd5[_0x4e70('0x29')]);if(_0x174bd5[_0x4e70('0x2a')]){delete _0x174bd5['name'];}_0x2b6d89[_0x4e70('0x17')](_0x1d87f6)['send'](_0x174bd5);};}exports['index']=function(_0x7156e0,_0x134a23){var _0xf2ee5={},_0x217bf7={},_0xa695c4={'count':0x0,'rows':[]};var _0x1cf367=_['map'](db[_0x4e70('0x2b')]['rawAttributes'],function(_0x86c0b3){return{'name':_0x86c0b3[_0x4e70('0x2c')],'type':_0x86c0b3['type'][_0x4e70('0x2d')]};});_0x217bf7[_0x4e70('0x2e')]=_[_0x4e70('0x2f')](_0x1cf367,'name');_0x217bf7[_0x4e70('0x30')]=_[_0x4e70('0x31')](_0x7156e0['query']);_0x217bf7[_0x4e70('0x32')]=_['intersection'](_0x217bf7[_0x4e70('0x2e')],_0x217bf7[_0x4e70('0x30')]);_0xf2ee5[_0x4e70('0x33')]=_[_0x4e70('0x34')](_0x217bf7['model'],qs['fields'](_0x7156e0[_0x4e70('0x30')]['fields']));_0xf2ee5[_0x4e70('0x33')]=_0xf2ee5[_0x4e70('0x33')]['length']?_0xf2ee5['attributes']:_0x217bf7['model'];if(!_0x7156e0['query'][_0x4e70('0x35')](_0x4e70('0x36'))){_0xf2ee5['limit']=qs[_0x4e70('0x1c')](_0x7156e0[_0x4e70('0x30')][_0x4e70('0x1c')]);_0xf2ee5[_0x4e70('0x1a')]=qs[_0x4e70('0x1a')](_0x7156e0[_0x4e70('0x30')][_0x4e70('0x1a')]);}_0xf2ee5[_0x4e70('0x37')]=qs['sort'](_0x7156e0[_0x4e70('0x30')][_0x4e70('0x38')]);delete _0x7156e0[_0x4e70('0x30')][_0x4e70('0x38')];_0xf2ee5[_0x4e70('0x39')]=qs['filters'](_[_0x4e70('0x3a')](_0x7156e0[_0x4e70('0x30')],_0x217bf7[_0x4e70('0x32')]),_0x1cf367);if(_0x7156e0[_0x4e70('0x30')][_0x4e70('0x3b')]){_0xf2ee5[_0x4e70('0x39')]=_[_0x4e70('0x3c')](_0xf2ee5[_0x4e70('0x39')],{'$or':_[_0x4e70('0x2f')](_0x1cf367,function(_0x311cb5){if(_0x311cb5[_0x4e70('0x3d')]!==_0x4e70('0x3e')){var _0x3d81f2={};_0x3d81f2[_0x311cb5[_0x4e70('0x2a')]]={'$like':'%'+_0x7156e0[_0x4e70('0x30')][_0x4e70('0x3b')]+'%'};return _0x3d81f2;}})});}_0xf2ee5=_[_0x4e70('0x3c')]({},_0xf2ee5,_0x7156e0[_0x4e70('0x3f')]);var _0x2106dd={'where':_0xf2ee5[_0x4e70('0x39')]};return db[_0x4e70('0x2b')][_0x4e70('0x1d')](_0x2106dd)[_0x4e70('0x23')](function(_0x4ac4b2){_0xa695c4[_0x4e70('0x1d')]=_0x4ac4b2;if(_0x7156e0[_0x4e70('0x30')]['includeAll']){_0xf2ee5['include']=[{'all':!![]}];}return db[_0x4e70('0x2b')]['findAll'](_0xf2ee5);})[_0x4e70('0x23')](function(_0xb1d88){_0xa695c4[_0x4e70('0x40')]=_0xb1d88;return _0xa695c4;})[_0x4e70('0x23')](respondWithFilteredResult(_0x134a23,_0xf2ee5))['catch'](handleError(_0x134a23,null));};exports['show']=function(_0x537ec7,_0x1c24aa){var _0x123ba1={'raw':![],'where':{'id':_0x537ec7['params']['id']}},_0x519195={};_0x519195[_0x4e70('0x2e')]=_[_0x4e70('0x31')](db['VoiceMusicOnHold']['rawAttributes']);_0x519195[_0x4e70('0x30')]=_[_0x4e70('0x31')](_0x537ec7['query']);_0x519195[_0x4e70('0x32')]=_[_0x4e70('0x34')](_0x519195['model'],_0x519195[_0x4e70('0x30')]);_0x123ba1[_0x4e70('0x33')]=_[_0x4e70('0x34')](_0x519195[_0x4e70('0x2e')],qs[_0x4e70('0x41')](_0x537ec7[_0x4e70('0x30')][_0x4e70('0x41')]));_0x123ba1[_0x4e70('0x33')]=_0x123ba1['attributes'][_0x4e70('0x42')]?_0x123ba1[_0x4e70('0x33')]:_0x519195['model'];if(_0x537ec7['query'][_0x4e70('0x43')]){_0x123ba1[_0x4e70('0x44')]=[{'all':!![]}];}_0x123ba1=_[_0x4e70('0x3c')]({},_0x123ba1,_0x537ec7[_0x4e70('0x3f')]);return db['VoiceMusicOnHold'][_0x4e70('0x45')](_0x123ba1)['then'](handleEntityNotFound(_0x1c24aa,null))[_0x4e70('0x23')](respondWithResult(_0x1c24aa,null))[_0x4e70('0x46')](handleError(_0x1c24aa,null));};exports[_0x4e70('0x22')]=function(_0x1d26e1,_0x36b958){if(_0x1d26e1[_0x4e70('0x47')]['id']){delete _0x1d26e1[_0x4e70('0x47')]['id'];}return db[_0x4e70('0x2b')]['find']({'where':{'id':_0x1d26e1[_0x4e70('0x48')]['id']}})['then'](handleEntityNotFound(_0x36b958,null))[_0x4e70('0x23')](saveUpdates(_0x1d26e1[_0x4e70('0x47')],null))[_0x4e70('0x23')](respondWithResult(_0x36b958,null))[_0x4e70('0x46')](handleError(_0x36b958,null));};exports[_0x4e70('0x49')]=function(_0x96756d,_0x17c4e1,_0x55f67b){return db[_0x4e70('0x4a')][_0x4e70('0x4b')](function(_0x4b5734){if(_0x96756d[_0x4e70('0x47')][_0x4e70('0x4c')]===_0x4e70('0x4d')){_0x96756d[_0x4e70('0x47')]['directory']=path['join'](config['root'],'server/files/moh',_0x96756d['body']['name']);}return db[_0x4e70('0x2b')]['create'](_0x96756d['body'],{'transaction':_0x4b5734})[_0x4e70('0x23')](function(_0x41fdf2){if(_0x96756d[_0x4e70('0x47')]['mode']===_0x4e70('0x4d')){fs['mkdirSync'](_0x41fdf2[_0x4e70('0x4e')],parseInt('0777',0x8));}var _0x33bb07=_0x96756d[_0x4e70('0x4f')][_0x4e70('0x25')]({'plain':!![]});if(!_0x33bb07)throw new Error(_0x4e70('0x50'));if(_0x33bb07[_0x4e70('0x51')]===_0x4e70('0x4f')){var _0x1ed6c8=_0x41fdf2[_0x4e70('0x25')]({'plain':!![]});return db[_0x4e70('0x52')][_0x4e70('0x45')]({'where':{'name':_0x4e70('0x26'),'userProfileId':_0x33bb07[_0x4e70('0x53')]},'raw':!![]})[_0x4e70('0x23')](function(_0x3f5c7c){if(_0x3f5c7c&&_0x3f5c7c[_0x4e70('0x54')]===0x0){return db[_0x4e70('0x27')]['create']({'name':_0x1ed6c8[_0x4e70('0x2a')],'resourceId':_0x1ed6c8['id'],'type':_0x3f5c7c[_0x4e70('0x2a')],'sectionId':_0x3f5c7c['id']},{})[_0x4e70('0x23')](function(){return _0x41fdf2;});}else{return _0x41fdf2;}})[_0x4e70('0x46')](function(_0x22f46f){logger[_0x4e70('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22f46f);});}return _0x41fdf2;});})['then'](respondWithResult(_0x17c4e1,0xc9))[_0x4e70('0x46')](handleError(_0x17c4e1,null));};exports['destroy']=function(_0x3bf7b0,_0x386a74,_0x22eb19){var _0x4c5e3d;return db[_0x4e70('0x2b')][_0x4e70('0x45')]({'where':{'id':_0x3bf7b0[_0x4e70('0x48')]['id']}})[_0x4e70('0x23')](function(_0x2eccb7){if(_0x2eccb7){return db[_0x4e70('0x4a')]['transaction'](function(_0x517bf6){return _0x2eccb7[_0x4e70('0x24')]({'transaction':_0x517bf6,'raw':!![]})[_0x4e70('0x23')](function(_0x1962d5){if(_0x1962d5['directory']){fs[_0x4e70('0x55')](_0x1962d5[_0x4e70('0x4e')])['forEach'](function(_0x2b370e){fs[_0x4e70('0x56')](path[_0x4e70('0x57')](_0x1962d5['directory'],_0x2b370e));});fs[_0x4e70('0x58')](_0x1962d5['directory']);}return _0x1962d5;});})[_0x4e70('0x46')](function(_0x49c2f8){throw new db[(_0x4e70('0x59'))][(_0x4e70('0x5a'))](_0x49c2f8['message']);});}})[_0x4e70('0x23')](handleEntityNotFound(_0x386a74,null))['then'](removeEntity(_0x386a74,null))[_0x4e70('0x46')](handleError(_0x386a74,null));};exports[_0x4e70('0x5b')]=function(_0x3cef2c,_0x5b4781,_0x2310a3){return db['sequelize'][_0x4e70('0x4b')](function(_0x3a459e){var _0x43a3c5;return db[_0x4e70('0x2b')][_0x4e70('0x45')]({'where':{'id':_0x3cef2c['params']['id']}})[_0x4e70('0x23')](function(_0x11af13){if(_0x11af13){_0x43a3c5=_0x11af13;return _0x11af13[_0x4e70('0x5b')](_0x3cef2c[_0x4e70('0x47')]['id'],{'transaction':_0x3a459e});}})[_0x4e70('0x23')](function(_0x26a96d){if(_0x26a96d){return db['Sound'][_0x4e70('0x5c')]({'where':{'id':_0x3cef2c[_0x4e70('0x47')]['id']},'attributes':['id',_0x4e70('0x2a'),_0x4e70('0x5d'),_0x4e70('0x5e'),_0x4e70('0x5f')],'raw':!![]});}})[_0x4e70('0x23')](function(_0x16f2d1){if(_0x16f2d1){var _0x198a0f=path[_0x4e70('0x57')](config[_0x4e70('0x60')],'server/files/sounds/converted',util['format'](_0x4e70('0x61'),path['basename'](_0x16f2d1['save_name'],path['extname'](_0x16f2d1['save_name'])),_0x16f2d1[_0x4e70('0x5e')]));var _0x5bebc3=path[_0x4e70('0x57')](config['root'],'server/files/moh',_0x43a3c5[_0x4e70('0x2a')],util['format'](_0x4e70('0x61'),_0x16f2d1[_0x4e70('0x2a')],_0x16f2d1[_0x4e70('0x5e')]));fs[_0x4e70('0x62')](_0x198a0f,_0x5bebc3);return _0x16f2d1;}})[_0x4e70('0x46')](function(_0x1337a3){throw new db['Sequelize'][(_0x4e70('0x5a'))](_0x1337a3['message']);});})['then'](handleEntityNotFound(_0x5b4781,null))[_0x4e70('0x23')](respondWithResult(_0x5b4781,0xc9))['catch'](handleError(_0x5b4781,null));};exports[_0x4e70('0x63')]=function(_0x31b47c,_0x325184,_0x5c19e6){return db[_0x4e70('0x4a')][_0x4e70('0x4b')](function(_0x46b028){var _0x3ffbd9;return db[_0x4e70('0x2b')]['findOne']({'where':{'id':_0x31b47c[_0x4e70('0x48')]['id']}})[_0x4e70('0x23')](handleEntityNotFound(_0x325184,null))[_0x4e70('0x23')](function(_0x559d73){if(_0x559d73){_0x3ffbd9=_0x559d73;return _0x559d73[_0x4e70('0x63')](_0x31b47c[_0x4e70('0x48')][_0x4e70('0x64')]);}})[_0x4e70('0x23')](function(_0x4ce7f4){if(_0x4ce7f4){return db['Sound']['findOne']({'where':{'id':_0x31b47c[_0x4e70('0x48')][_0x4e70('0x64')]},'attributes':['id',_0x4e70('0x2a'),_0x4e70('0x5d'),_0x4e70('0x5e'),_0x4e70('0x5f')],'raw':!![]});}})[_0x4e70('0x23')](function(_0x3cd50c){if(_0x3cd50c){fs[_0x4e70('0x56')](path[_0x4e70('0x57')](_0x3ffbd9[_0x4e70('0x4e')],util[_0x4e70('0x65')](_0x4e70('0x61'),_0x3cd50c['name'],_0x3cd50c[_0x4e70('0x5e')])));return _0x3cd50c;}})['catch'](function(_0x5c53b9){throw new db[(_0x4e70('0x59'))]['ValidationError'](_0x5c53b9[_0x4e70('0x66')]);});})[_0x4e70('0x23')](handleEntityNotFound(_0x325184,null))[_0x4e70('0x23')](respondWithStatusCode(_0x325184,0xcc))[_0x4e70('0x46')](handleError(_0x325184,null));};exports[_0x4e70('0x67')]=function(_0x383b50,_0x5aede0,_0xf62adc){var _0x3f6589={};var _0x3b2f1c={};var _0x2da862;var _0x5e129b;return db['VoiceMusicOnHold'][_0x4e70('0x5c')]({'where':{'id':_0x383b50[_0x4e70('0x48')]['id']}})[_0x4e70('0x23')](handleEntityNotFound(_0x5aede0,null))[_0x4e70('0x23')](function(_0x2ff769){if(_0x2ff769){_0x2da862=_0x2ff769;_0x3b2f1c[_0x4e70('0x2e')]=_[_0x4e70('0x31')](db[_0x4e70('0x68')]['rawAttributes']);_0x3b2f1c[_0x4e70('0x30')]=_['keys'](_0x383b50[_0x4e70('0x30')]);_0x3b2f1c[_0x4e70('0x32')]=_[_0x4e70('0x34')](_0x3b2f1c[_0x4e70('0x2e')],_0x3b2f1c['query']);_0x3f6589['attributes']=_['intersection'](_0x3b2f1c[_0x4e70('0x2e')],qs['fields'](_0x383b50[_0x4e70('0x30')]['fields']));_0x3f6589[_0x4e70('0x33')]=_0x3f6589['attributes'][_0x4e70('0x42')]?_0x3f6589[_0x4e70('0x33')]:_0x3b2f1c[_0x4e70('0x2e')];_0x3f6589[_0x4e70('0x37')]=qs[_0x4e70('0x38')](_0x383b50['query']['sort']);_0x3f6589[_0x4e70('0x39')]=qs['filters'](_['pick'](_0x383b50[_0x4e70('0x30')],_0x3b2f1c[_0x4e70('0x32')]));if(_0x383b50[_0x4e70('0x30')][_0x4e70('0x3b')]){_0x3f6589[_0x4e70('0x39')]=_['merge'](_0x3f6589[_0x4e70('0x39')],{'$or':_['map'](_0x3f6589[_0x4e70('0x33')],function(_0x3b0c51){var _0x4b4336={};_0x4b4336[_0x3b0c51]={'$like':'%'+_0x383b50[_0x4e70('0x30')][_0x4e70('0x3b')]+'%'};return _0x4b4336;})});}_0x3f6589=_['merge']({},_0x3f6589,_0x383b50[_0x4e70('0x3f')]);return _0x2da862[_0x4e70('0x67')](_0x3f6589);}})[_0x4e70('0x23')](function(_0xdc585d){if(_0xdc585d){_0x5e129b=_0xdc585d[_0x4e70('0x42')];if(!_0x383b50[_0x4e70('0x30')]['hasOwnProperty'](_0x4e70('0x36'))){_0x3f6589[_0x4e70('0x1c')]=qs[_0x4e70('0x1c')](_0x383b50[_0x4e70('0x30')]['limit']);_0x3f6589[_0x4e70('0x1a')]=qs[_0x4e70('0x1a')](_0x383b50[_0x4e70('0x30')][_0x4e70('0x1a')]);}return _0x2da862[_0x4e70('0x67')](_0x3f6589);}})['then'](function(_0x4ab0ee){if(_0x4ab0ee){return _0x4ab0ee?{'count':_0x5e129b,'rows':_0x4ab0ee}:null;}})[_0x4e70('0x23')](respondWithResult(_0x5aede0,null))['catch'](handleError(_0x5aede0,null));}; \ No newline at end of file +var _0xe188=['set','Content-Range','reject','save','update','then','destroy','get','MusicOnHolds','sendStatus','error','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','body','find','sequelize','transaction','mode','files','directory','join','root','server/files/moh','create','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','readdirSync','forEach','unlinkSync','ValidationError','message','addSound','Sound','save_name','createdAt','server/files/sounds/converted','format','basename','extname','%s.%s','symlinkSync','Sequelize','removeSound','findOne','id2','converted_format','getSounds','nolimit','rimraf','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x41ba82,_0x2c9ab0){var _0x5c9789=function(_0x41ba51){while(--_0x41ba51){_0x41ba82['push'](_0x41ba82['shift']());}};_0x5c9789(++_0x2c9ab0);}(_0xe188,0xb7));var _0x8e18=function(_0x243625,_0x193a87){_0x243625=_0x243625-0x0;var _0x3fa2f2=_0xe188[_0x243625];return _0x3fa2f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e18('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(_0x8e18('0x1'));var util=require(_0x8e18('0x2'));var path=require(_0x8e18('0x3'));var sox=require(_0x8e18('0x4'));var csv=require(_0x8e18('0x5'));var ejs=require(_0x8e18('0x6'));var fs=require('fs');var fs_extra=require(_0x8e18('0x7'));var _=require(_0x8e18('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8e18('0x9'));var deskjs=require(_0x8e18('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8e18('0xb'));var Redis=require(_0x8e18('0xc'));var authService=require(_0x8e18('0xd'));var qs=require(_0x8e18('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e18('0xf'));var logger=require('../../config/logger')(_0x8e18('0x10'));var utils=require(_0x8e18('0x11'));var config=require(_0x8e18('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e18('0x13'))['db'];function respondWithStatusCode(_0x4c0dad,_0x3c50fb){_0x3c50fb=_0x3c50fb||0xcc;return function(_0x27c682){if(_0x27c682){return _0x4c0dad['sendStatus'](_0x3c50fb);}return _0x4c0dad[_0x8e18('0x14')](_0x3c50fb)[_0x8e18('0x15')]();};}function respondWithResult(_0x10385d,_0x216cf4){_0x216cf4=_0x216cf4||0xc8;return function(_0x323f61){if(_0x323f61){return _0x10385d[_0x8e18('0x14')](_0x216cf4)[_0x8e18('0x16')](_0x323f61);}};}function respondWithFilteredResult(_0x48786c,_0x13b687){return function(_0x33d3ad){if(_0x33d3ad){var _0x44a9a8=typeof _0x13b687[_0x8e18('0x17')]===_0x8e18('0x18')&&typeof _0x13b687[_0x8e18('0x19')]===_0x8e18('0x18');var _0x316bf6=_0x33d3ad[_0x8e18('0x1a')];var _0x2eed99=_0x44a9a8?0x0:_0x13b687[_0x8e18('0x17')];var _0x1b507d=_0x44a9a8?_0x33d3ad['count']:_0x13b687['offset']+_0x13b687['limit'];var _0x16a155;if(_0x1b507d>=_0x316bf6){_0x1b507d=_0x316bf6;_0x16a155=0xc8;}else{_0x16a155=0xce;}_0x48786c[_0x8e18('0x14')](_0x16a155);return _0x48786c[_0x8e18('0x1b')](_0x8e18('0x1c'),_0x2eed99+'-'+_0x1b507d+'/'+_0x316bf6)[_0x8e18('0x16')](_0x33d3ad);}return null;};}function patchUpdates(_0x594194){return function(_0x31ebeb){try{jsonpatch['apply'](_0x31ebeb,_0x594194,!![]);}catch(_0x5606a8){return BPromise[_0x8e18('0x1d')](_0x5606a8);}return _0x31ebeb[_0x8e18('0x1e')]();};}function saveUpdates(_0x4b2a35,_0x3cb8f6){return function(_0x20c4f8){if(_0x20c4f8){return _0x20c4f8[_0x8e18('0x1f')](_0x4b2a35)[_0x8e18('0x20')](function(_0x5d5187){return _0x5d5187;});}return null;};}function removeEntity(_0x1bbc9e,_0x27c6f6){return function(_0x5b2d92){if(_0x5b2d92){return _0x5b2d92[_0x8e18('0x21')]()[_0x8e18('0x20')](function(){var _0xe6f88e=_0x5b2d92[_0x8e18('0x22')]({'plain':!![]});var _0x2292e6=_0x8e18('0x23');return db['UserProfileResource'][_0x8e18('0x21')]({'where':{'type':_0x2292e6,'resourceId':_0xe6f88e['id']}})['then'](function(){return _0x5b2d92;});})['then'](function(){_0x1bbc9e[_0x8e18('0x14')](0xcc)[_0x8e18('0x15')]();});}};}function handleEntityNotFound(_0x128394,_0x222dbf){return function(_0x428f54){if(!_0x428f54){_0x128394[_0x8e18('0x24')](0x194);}return _0x428f54;};}function handleError(_0x287770,_0xcc1cc1){_0xcc1cc1=_0xcc1cc1||0x1f4;return function(_0x42d66d){logger[_0x8e18('0x25')](_0x42d66d['stack']);if(_0x42d66d[_0x8e18('0x26')]){delete _0x42d66d['name'];}_0x287770['status'](_0xcc1cc1)['send'](_0x42d66d);};}exports[_0x8e18('0x27')]=function(_0x33428e,_0x3a30b7){var _0x5c23cc={},_0x51bc33={},_0x34dff4={'count':0x0,'rows':[]};var _0x5e5063=_[_0x8e18('0x28')](db[_0x8e18('0x29')][_0x8e18('0x2a')],function(_0x4add4f){return{'name':_0x4add4f[_0x8e18('0x2b')],'type':_0x4add4f[_0x8e18('0x2c')]['key']};});_0x51bc33[_0x8e18('0x2d')]=_['map'](_0x5e5063,_0x8e18('0x26'));_0x51bc33[_0x8e18('0x2e')]=_[_0x8e18('0x2f')](_0x33428e[_0x8e18('0x2e')]);_0x51bc33['filters']=_[_0x8e18('0x30')](_0x51bc33[_0x8e18('0x2d')],_0x51bc33[_0x8e18('0x2e')]);_0x5c23cc[_0x8e18('0x31')]=_[_0x8e18('0x30')](_0x51bc33[_0x8e18('0x2d')],qs[_0x8e18('0x32')](_0x33428e[_0x8e18('0x2e')][_0x8e18('0x32')]));_0x5c23cc[_0x8e18('0x31')]=_0x5c23cc['attributes'][_0x8e18('0x33')]?_0x5c23cc['attributes']:_0x51bc33['model'];if(!_0x33428e[_0x8e18('0x2e')][_0x8e18('0x34')]('nolimit')){_0x5c23cc[_0x8e18('0x19')]=qs[_0x8e18('0x19')](_0x33428e[_0x8e18('0x2e')][_0x8e18('0x19')]);_0x5c23cc[_0x8e18('0x17')]=qs[_0x8e18('0x17')](_0x33428e[_0x8e18('0x2e')][_0x8e18('0x17')]);}_0x5c23cc[_0x8e18('0x35')]=qs[_0x8e18('0x36')](_0x33428e[_0x8e18('0x2e')][_0x8e18('0x36')]);delete _0x33428e[_0x8e18('0x2e')][_0x8e18('0x36')];_0x5c23cc[_0x8e18('0x37')]=qs['filters'](_['pick'](_0x33428e[_0x8e18('0x2e')],_0x51bc33[_0x8e18('0x38')]),_0x5e5063);if(_0x33428e[_0x8e18('0x2e')][_0x8e18('0x39')]){_0x5c23cc[_0x8e18('0x37')]=_[_0x8e18('0x3a')](_0x5c23cc[_0x8e18('0x37')],{'$or':_['map'](_0x5e5063,function(_0x9aae95){if(_0x9aae95[_0x8e18('0x2c')]!==_0x8e18('0x3b')){var _0x44715c={};_0x44715c[_0x9aae95[_0x8e18('0x26')]]={'$like':'%'+_0x33428e['query'][_0x8e18('0x39')]+'%'};return _0x44715c;}})});}_0x5c23cc=_[_0x8e18('0x3a')]({},_0x5c23cc,_0x33428e[_0x8e18('0x3c')]);var _0x42b61f={'where':_0x5c23cc[_0x8e18('0x37')]};return db[_0x8e18('0x29')][_0x8e18('0x1a')](_0x42b61f)['then'](function(_0x2d8f2b){_0x34dff4[_0x8e18('0x1a')]=_0x2d8f2b;if(_0x33428e[_0x8e18('0x2e')][_0x8e18('0x3d')]){_0x5c23cc[_0x8e18('0x3e')]=[{'all':!![]}];}return db[_0x8e18('0x29')][_0x8e18('0x3f')](_0x5c23cc);})[_0x8e18('0x20')](function(_0x3e31fa){_0x34dff4['rows']=_0x3e31fa;return _0x34dff4;})['then'](respondWithFilteredResult(_0x3a30b7,_0x5c23cc))[_0x8e18('0x40')](handleError(_0x3a30b7,null));};exports[_0x8e18('0x41')]=function(_0x15a35e,_0x5c1a55){var _0x268e8d={'raw':![],'where':{'id':_0x15a35e[_0x8e18('0x42')]['id']}},_0xf84858={};_0xf84858[_0x8e18('0x2d')]=_['keys'](db[_0x8e18('0x29')]['rawAttributes']);_0xf84858['query']=_[_0x8e18('0x2f')](_0x15a35e[_0x8e18('0x2e')]);_0xf84858['filters']=_[_0x8e18('0x30')](_0xf84858['model'],_0xf84858[_0x8e18('0x2e')]);_0x268e8d[_0x8e18('0x31')]=_['intersection'](_0xf84858[_0x8e18('0x2d')],qs[_0x8e18('0x32')](_0x15a35e['query']['fields']));_0x268e8d['attributes']=_0x268e8d[_0x8e18('0x31')]['length']?_0x268e8d[_0x8e18('0x31')]:_0xf84858[_0x8e18('0x2d')];if(_0x15a35e[_0x8e18('0x2e')][_0x8e18('0x3d')]){_0x268e8d['include']=[{'all':!![]}];}_0x268e8d=_[_0x8e18('0x3a')]({},_0x268e8d,_0x15a35e['options']);return db['VoiceMusicOnHold']['find'](_0x268e8d)[_0x8e18('0x20')](handleEntityNotFound(_0x5c1a55,null))[_0x8e18('0x20')](respondWithResult(_0x5c1a55,null))['catch'](handleError(_0x5c1a55,null));};exports['update']=function(_0x12800a,_0x3f4aa6){if(_0x12800a[_0x8e18('0x43')]['id']){delete _0x12800a[_0x8e18('0x43')]['id'];}return db[_0x8e18('0x29')][_0x8e18('0x44')]({'where':{'id':_0x12800a[_0x8e18('0x42')]['id']}})[_0x8e18('0x20')](handleEntityNotFound(_0x3f4aa6,null))['then'](saveUpdates(_0x12800a['body'],null))[_0x8e18('0x20')](respondWithResult(_0x3f4aa6,null))[_0x8e18('0x40')](handleError(_0x3f4aa6,null));};exports['create']=function(_0x886495,_0x1f04dd,_0x1703bf){return db[_0x8e18('0x45')][_0x8e18('0x46')](function(_0x3b9637){if(_0x886495[_0x8e18('0x43')][_0x8e18('0x47')]===_0x8e18('0x48')){_0x886495[_0x8e18('0x43')][_0x8e18('0x49')]=path[_0x8e18('0x4a')](config[_0x8e18('0x4b')],_0x8e18('0x4c'),_0x886495[_0x8e18('0x43')][_0x8e18('0x26')]);}return db[_0x8e18('0x29')][_0x8e18('0x4d')](_0x886495[_0x8e18('0x43')],{'transaction':_0x3b9637})[_0x8e18('0x20')](function(_0x37166e){if(_0x886495[_0x8e18('0x43')][_0x8e18('0x47')]==='files'){fs['mkdirSync'](_0x37166e[_0x8e18('0x49')],parseInt(_0x8e18('0x4e'),0x8));}var _0x2f7cea=_0x886495['user'][_0x8e18('0x22')]({'plain':!![]});if(!_0x2f7cea)throw new Error(_0x8e18('0x4f'));if(_0x2f7cea[_0x8e18('0x50')]==='user'){var _0x140e42=_0x37166e['get']({'plain':!![]});return db['UserProfileSection'][_0x8e18('0x44')]({'where':{'name':_0x8e18('0x23'),'userProfileId':_0x2f7cea['userProfileId']},'raw':!![]})[_0x8e18('0x20')](function(_0x2f64fe){if(_0x2f64fe&&_0x2f64fe[_0x8e18('0x51')]===0x0){return db[_0x8e18('0x52')][_0x8e18('0x4d')]({'name':_0x140e42[_0x8e18('0x26')],'resourceId':_0x140e42['id'],'type':_0x2f64fe[_0x8e18('0x26')],'sectionId':_0x2f64fe['id']},{})[_0x8e18('0x20')](function(){return _0x37166e;});}else{return _0x37166e;}})[_0x8e18('0x40')](function(_0x52b65d){logger[_0x8e18('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52b65d);});}return _0x37166e;});})[_0x8e18('0x20')](respondWithResult(_0x1f04dd,0xc9))['catch'](handleError(_0x1f04dd,null));};exports[_0x8e18('0x21')]=function(_0x1eb61e,_0x59846d,_0xd0e13b){var _0x28b836;return db['VoiceMusicOnHold'][_0x8e18('0x44')]({'where':{'id':_0x1eb61e[_0x8e18('0x42')]['id']}})[_0x8e18('0x20')](function(_0x33cbce){if(_0x33cbce){return db[_0x8e18('0x45')]['transaction'](function(_0x4f481e){return _0x33cbce['destroy']({'transaction':_0x4f481e,'raw':!![]})[_0x8e18('0x20')](function(_0x1e2516){if(_0x1e2516[_0x8e18('0x49')]){fs[_0x8e18('0x53')](_0x1e2516[_0x8e18('0x49')])[_0x8e18('0x54')](function(_0x27399c){fs[_0x8e18('0x55')](path[_0x8e18('0x4a')](_0x1e2516[_0x8e18('0x49')],_0x27399c));});fs['rmdirSync'](_0x1e2516[_0x8e18('0x49')]);}return _0x1e2516;});})[_0x8e18('0x40')](function(_0x121500){throw new db['Sequelize'][(_0x8e18('0x56'))](_0x121500[_0x8e18('0x57')]);});}})[_0x8e18('0x20')](handleEntityNotFound(_0x59846d,null))[_0x8e18('0x20')](removeEntity(_0x59846d,null))[_0x8e18('0x40')](handleError(_0x59846d,null));};exports[_0x8e18('0x58')]=function(_0xee8150,_0x4eb5c6,_0x5afc1e){return db[_0x8e18('0x45')][_0x8e18('0x46')](function(_0x39b71e){var _0x354711;return db[_0x8e18('0x29')]['find']({'where':{'id':_0xee8150[_0x8e18('0x42')]['id']}})[_0x8e18('0x20')](function(_0x3b80f7){if(_0x3b80f7){_0x354711=_0x3b80f7;return _0x3b80f7['addSound'](_0xee8150[_0x8e18('0x43')]['id'],{'transaction':_0x39b71e});}})[_0x8e18('0x20')](function(_0x47d669){if(_0x47d669){return db[_0x8e18('0x59')]['findOne']({'where':{'id':_0xee8150[_0x8e18('0x43')]['id']},'attributes':['id',_0x8e18('0x26'),_0x8e18('0x5a'),'converted_format',_0x8e18('0x5b')],'raw':!![]});}})[_0x8e18('0x20')](function(_0x1935b4){if(_0x1935b4){var _0xee5e12=path['join'](config[_0x8e18('0x4b')],_0x8e18('0x5c'),util[_0x8e18('0x5d')]('%s.%s',path[_0x8e18('0x5e')](_0x1935b4['save_name'],path[_0x8e18('0x5f')](_0x1935b4[_0x8e18('0x5a')])),_0x1935b4['converted_format']));var _0x531a82=path[_0x8e18('0x4a')](config['root'],'server/files/moh',_0x354711[_0x8e18('0x26')],util[_0x8e18('0x5d')](_0x8e18('0x60'),_0x1935b4['name'],_0x1935b4['converted_format']));fs[_0x8e18('0x61')](_0xee5e12,_0x531a82);return _0x1935b4;}})[_0x8e18('0x40')](function(_0x13ccb4){throw new db[(_0x8e18('0x62'))][(_0x8e18('0x56'))](_0x13ccb4[_0x8e18('0x57')]);});})[_0x8e18('0x20')](handleEntityNotFound(_0x4eb5c6,null))[_0x8e18('0x20')](respondWithResult(_0x4eb5c6,0xc9))[_0x8e18('0x40')](handleError(_0x4eb5c6,null));};exports[_0x8e18('0x63')]=function(_0xa72ec9,_0x503299,_0x2bb080){return db[_0x8e18('0x45')][_0x8e18('0x46')](function(_0x3be73b){var _0x1ead91;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0xa72ec9[_0x8e18('0x42')]['id']}})['then'](handleEntityNotFound(_0x503299,null))[_0x8e18('0x20')](function(_0x1c6fdd){if(_0x1c6fdd){_0x1ead91=_0x1c6fdd;return _0x1c6fdd[_0x8e18('0x63')](_0xa72ec9[_0x8e18('0x42')]['id2']);}})['then'](function(_0xfcccb2){if(_0xfcccb2){return db[_0x8e18('0x59')][_0x8e18('0x64')]({'where':{'id':_0xa72ec9[_0x8e18('0x42')][_0x8e18('0x65')]},'attributes':['id','name',_0x8e18('0x5a'),_0x8e18('0x66'),_0x8e18('0x5b')],'raw':!![]});}})[_0x8e18('0x20')](function(_0x26f75b){if(_0x26f75b){fs[_0x8e18('0x55')](path[_0x8e18('0x4a')](_0x1ead91['directory'],util[_0x8e18('0x5d')](_0x8e18('0x60'),_0x26f75b[_0x8e18('0x26')],_0x26f75b[_0x8e18('0x66')])));return _0x26f75b;}})['catch'](function(_0x1207af){throw new db[(_0x8e18('0x62'))][(_0x8e18('0x56'))](_0x1207af[_0x8e18('0x57')]);});})[_0x8e18('0x20')](handleEntityNotFound(_0x503299,null))[_0x8e18('0x20')](respondWithStatusCode(_0x503299,0xcc))['catch'](handleError(_0x503299,null));};exports[_0x8e18('0x67')]=function(_0x422af9,_0x2e1dce,_0xb5a04a){var _0xbb7998={};var _0x1626ac={};var _0xbae89c;var _0x181d90;return db[_0x8e18('0x29')][_0x8e18('0x64')]({'where':{'id':_0x422af9['params']['id']}})['then'](handleEntityNotFound(_0x2e1dce,null))['then'](function(_0x5f24f1){if(_0x5f24f1){_0xbae89c=_0x5f24f1;_0x1626ac[_0x8e18('0x2d')]=_[_0x8e18('0x2f')](db[_0x8e18('0x59')][_0x8e18('0x2a')]);_0x1626ac[_0x8e18('0x2e')]=_[_0x8e18('0x2f')](_0x422af9[_0x8e18('0x2e')]);_0x1626ac[_0x8e18('0x38')]=_['intersection'](_0x1626ac[_0x8e18('0x2d')],_0x1626ac[_0x8e18('0x2e')]);_0xbb7998['attributes']=_[_0x8e18('0x30')](_0x1626ac[_0x8e18('0x2d')],qs[_0x8e18('0x32')](_0x422af9['query'][_0x8e18('0x32')]));_0xbb7998['attributes']=_0xbb7998[_0x8e18('0x31')][_0x8e18('0x33')]?_0xbb7998['attributes']:_0x1626ac['model'];_0xbb7998[_0x8e18('0x35')]=qs[_0x8e18('0x36')](_0x422af9[_0x8e18('0x2e')]['sort']);_0xbb7998['where']=qs['filters'](_['pick'](_0x422af9[_0x8e18('0x2e')],_0x1626ac[_0x8e18('0x38')]));if(_0x422af9[_0x8e18('0x2e')][_0x8e18('0x39')]){_0xbb7998[_0x8e18('0x37')]=_['merge'](_0xbb7998['where'],{'$or':_[_0x8e18('0x28')](_0xbb7998[_0x8e18('0x31')],function(_0x1435ca){var _0x908314={};_0x908314[_0x1435ca]={'$like':'%'+_0x422af9[_0x8e18('0x2e')][_0x8e18('0x39')]+'%'};return _0x908314;})});}_0xbb7998=_[_0x8e18('0x3a')]({},_0xbb7998,_0x422af9[_0x8e18('0x3c')]);return _0xbae89c['getSounds'](_0xbb7998);}})[_0x8e18('0x20')](function(_0x458373){if(_0x458373){_0x181d90=_0x458373[_0x8e18('0x33')];if(!_0x422af9[_0x8e18('0x2e')][_0x8e18('0x34')](_0x8e18('0x68'))){_0xbb7998[_0x8e18('0x19')]=qs['limit'](_0x422af9[_0x8e18('0x2e')]['limit']);_0xbb7998[_0x8e18('0x17')]=qs[_0x8e18('0x17')](_0x422af9[_0x8e18('0x2e')][_0x8e18('0x17')]);}return _0xbae89c[_0x8e18('0x67')](_0xbb7998);}})[_0x8e18('0x20')](function(_0x329372){if(_0x329372){return _0x329372?{'count':_0x181d90,'rows':_0x329372}:null;}})[_0x8e18('0x20')](respondWithResult(_0x2e1dce,null))[_0x8e18('0x40')](handleError(_0x2e1dce,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index aa4a008..135e61c 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 _0x3bdb=['api','moment','request-promise','path','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x3bdb,0x173));var _0xb3bd=function(_0x5ce0e5,_0xe794f0){_0x5ce0e5=_0x5ce0e5-0x0;var _0x3f99fc=_0x3bdb[_0x5ce0e5];return _0x3f99fc;};'use strict';var _=require(_0xb3bd('0x0'));var util=require(_0xb3bd('0x1'));var logger=require(_0xb3bd('0x2'))(_0xb3bd('0x3'));var moment=require(_0xb3bd('0x4'));var BPromise=require('bluebird');var rp=require(_0xb3bd('0x5'));var fs=require('fs');var path=require(_0xb3bd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb3bd('0x7'));module['exports']=function(_0x54a099,_0x12ae3c){return _0x54a099[_0xb3bd('0x8')](_0xb3bd('0x9'),attributes,{'tableName':_0xb3bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f20=['define','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x11c539,_0x52de82){var _0x2da1e3=function(_0x3d3652){while(--_0x3d3652){_0x11c539['push'](_0x11c539['shift']());}};_0x2da1e3(++_0x52de82);}(_0x2f20,0x92));var _0x02f2=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x2f20[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x02f2('0x0'));var util=require(_0x02f2('0x1'));var logger=require(_0x02f2('0x2'))(_0x02f2('0x3'));var moment=require(_0x02f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x02f2('0x5'));var fs=require('fs');var path=require(_0x02f2('0x6'));var rimraf=require(_0x02f2('0x7'));var config=require(_0x02f2('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x02f2('0x9')]=function(_0x1dd12d,_0x57b108){return _0x1dd12d[_0x02f2('0xa')](_0x02f2('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 787b7b2..0a6f836 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x1589da,_0x520f28){var _0x2df507=function(_0x2ff4cc){while(--_0x2ff4cc){_0x1589da['push'](_0x1589da['shift']());}};_0x2df507(++_0x520f28);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xcb91[_0x270adf];return _0x29eda9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x12b10e,_0x50ce6a){var _0x6d097b=function(_0x2be178){while(--_0x2be178){_0x12b10e['push'](_0x12b10e['shift']());}};_0x6d097b(++_0x50ce6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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/voicePrefix/index.js b/server/api/voicePrefix/index.js index aef2cc5..4557a2d 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 _0xf569=['addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','/describe','get','/:id','/:id/users','/:id/teams','post'];(function(_0x5a6dcd,_0x39fb72){var _0x4900a7=function(_0x147a39){while(--_0x147a39){_0x5a6dcd['push'](_0x5a6dcd['shift']());}};_0x4900a7(++_0x39fb72);}(_0xf569,0xd0));var _0x9f56=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xf569[_0x599e60];return _0x468e19;};'use strict';var multer=require('multer');var util=require(_0x9f56('0x0'));var path=require(_0x9f56('0x1'));var timeout=require(_0x9f56('0x2'));var express=require(_0x9f56('0x3'));var router=express[_0x9f56('0x4')]();var fs_extra=require(_0x9f56('0x5'));var auth=require(_0x9f56('0x6'));var interaction=require(_0x9f56('0x7'));var config=require('../../config/environment');var controller=require(_0x9f56('0x8'));router['get']('/',auth[_0x9f56('0x9')](),controller[_0x9f56('0xa')]);router['get'](_0x9f56('0xb'),auth[_0x9f56('0x9')](),controller['describe']);router[_0x9f56('0xc')](_0x9f56('0xd'),auth[_0x9f56('0x9')](),controller['show']);router['get'](_0x9f56('0xe'),auth[_0x9f56('0x9')](),controller['getAgents']);router[_0x9f56('0xc')](_0x9f56('0xf'),auth[_0x9f56('0x9')](),controller['getTeams']);router['post']('/',auth[_0x9f56('0x9')](),controller['create']);router[_0x9f56('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0x9f56('0x11')]);router[_0x9f56('0x10')]('/:id/teams',auth[_0x9f56('0x9')](),controller[_0x9f56('0x12')]);router[_0x9f56('0x13')](_0x9f56('0xd'),auth[_0x9f56('0x9')](),controller[_0x9f56('0x14')]);router[_0x9f56('0x15')](_0x9f56('0xd'),auth[_0x9f56('0x9')](),controller[_0x9f56('0x16')]);router[_0x9f56('0x15')](_0x9f56('0xe'),auth[_0x9f56('0x9')](),controller[_0x9f56('0x17')]);router[_0x9f56('0x15')](_0x9f56('0xf'),auth[_0x9f56('0x9')](),controller[_0x9f56('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1413=['update','destroy','removeAgents','delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','get','/describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addTeams','put'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x1413,0x170));var _0x3141=function(_0x39b126,_0x57060e){_0x39b126=_0x39b126-0x0;var _0x3fd917=_0x1413[_0x39b126];return _0x3fd917;};'use strict';var multer=require('multer');var util=require(_0x3141('0x0'));var path=require(_0x3141('0x1'));var timeout=require(_0x3141('0x2'));var express=require(_0x3141('0x3'));var router=express['Router']();var fs_extra=require(_0x3141('0x4'));var auth=require(_0x3141('0x5'));var interaction=require(_0x3141('0x6'));var config=require(_0x3141('0x7'));var controller=require(_0x3141('0x8'));router['get']('/',auth[_0x3141('0x9')](),controller['index']);router[_0x3141('0xa')](_0x3141('0xb'),auth[_0x3141('0x9')](),controller['describe']);router[_0x3141('0xa')](_0x3141('0xc'),auth['isAuthenticated'](),controller[_0x3141('0xd')]);router[_0x3141('0xa')](_0x3141('0xe'),auth[_0x3141('0x9')](),controller[_0x3141('0xf')]);router['get'](_0x3141('0x10'),auth[_0x3141('0x9')](),controller[_0x3141('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3141('0x12')]);router[_0x3141('0x13')](_0x3141('0xe'),auth['isAuthenticated'](),controller['addAgents']);router[_0x3141('0x13')]('/:id/teams',auth[_0x3141('0x9')](),controller[_0x3141('0x14')]);router[_0x3141('0x15')]('/:id',auth[_0x3141('0x9')](),controller[_0x3141('0x16')]);router['delete'](_0x3141('0xc'),auth[_0x3141('0x9')](),controller[_0x3141('0x17')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x3141('0x18')]);router[_0x3141('0x19')]('/:id/teams',auth[_0x3141('0x9')](),controller['removeTeams']);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 ca74561..1ce9a8c 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 _0x3251=['VIRTUAL','system-','INTEGER','sequelize','exports','STRING','name'];(function(_0x2fb812,_0x34ab89){var _0x469ae7=function(_0x1c8022){while(--_0x1c8022){_0x2fb812['push'](_0x2fb812['shift']());}};_0x469ae7(++_0x34ab89);}(_0x3251,0x65));var _0x1325=function(_0x4f348b,_0x23a6d7){_0x4f348b=_0x4f348b-0x0;var _0x59ea7f=_0x3251[_0x4f348b];return _0x59ea7f;};'use strict';var Sequelize=require(_0x1325('0x0'));module[_0x1325('0x1')]={'name':{'type':Sequelize[_0x1325('0x2')],'allowNull':![],'unique':_0x1325('0x3')},'prefix':{'type':Sequelize[_0x1325('0x4')],'get':function(_0x394a28){return _0x1325('0x5')+this['getDataValue'](_0x1325('0x3'))+'-';}},'description':{'type':Sequelize[_0x1325('0x2')]},'callerIdAll':{'type':Sequelize[_0x1325('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x1325('0x6')]}}; \ No newline at end of file +var _0xd2b6=['INTEGER','STRING','name','system-','getDataValue'];(function(_0x28d979,_0x1927d1){var _0x3a2d92=function(_0x487e82){while(--_0x487e82){_0x28d979['push'](_0x28d979['shift']());}};_0x3a2d92(++_0x1927d1);}(_0xd2b6,0x173));var _0x6d2b=function(_0x3f6131,_0x531acc){_0x3f6131=_0x3f6131-0x0;var _0x18d856=_0xd2b6[_0x3f6131];return _0x18d856;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6d2b('0x0')],'allowNull':![],'unique':_0x6d2b('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2a5e5b){return _0x6d2b('0x2')+this[_0x6d2b('0x3')](_0x6d2b('0x1'))+'-';}},'description':{'type':Sequelize[_0x6d2b('0x0')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x6d2b('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index f7032bc..62045ea 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 _0x2272=['Voice\x20Prefix\x20Extension','priority','NoOp','VoicePrefixId','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','context','${EXTEN:','charAt','update','system-','findById','addAgents','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','User','order','pick','getTeams','findOne','addTeams','Team','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','SELECT','every','TeamId','includes','all','union','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','system','description'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2272,0xd8));var _0x2227=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2272[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2227('0x0'));var rimraf=require(_0x2227('0x1'));var zipdir=require(_0x2227('0x2'));var jsonpatch=require(_0x2227('0x3'));var rp=require(_0x2227('0x4'));var moment=require('moment');var BPromise=require(_0x2227('0x5'));var Mustache=require(_0x2227('0x6'));var util=require(_0x2227('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2227('0x8'));var ejs=require(_0x2227('0x9'));var fs=require('fs');var fs_extra=require(_0x2227('0xa'));var _=require(_0x2227('0xb'));var squel=require(_0x2227('0xc'));var crypto=require(_0x2227('0xd'));var jsforce=require(_0x2227('0xe'));var deskjs=require(_0x2227('0xf'));var toCsv=require(_0x2227('0x8'));var querystring=require(_0x2227('0x10'));var Papa=require('papaparse');var Redis=require(_0x2227('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2227('0x12'));var as=require(_0x2227('0x13'));var hardwareService=require(_0x2227('0x14'));var logger=require(_0x2227('0x15'))(_0x2227('0x16'));var utils=require('../../config/utils');var config=require(_0x2227('0x17'));var licenseUtil=require(_0x2227('0x18'));var db=require(_0x2227('0x19'))['db'];config[_0x2227('0x1a')]=_[_0x2227('0x1b')](config[_0x2227('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2227('0x1c'))['register'](socket);function respondWithStatusCode(_0x42f60b,_0xb631b0){_0xb631b0=_0xb631b0||0xcc;return function(_0x510b09){if(_0x510b09){return _0x42f60b[_0x2227('0x1d')](_0xb631b0);}return _0x42f60b[_0x2227('0x1e')](_0xb631b0)[_0x2227('0x1f')]();};}function respondWithResult(_0x43e174,_0x42a93c){_0x42a93c=_0x42a93c||0xc8;return function(_0x1e78a8){if(_0x1e78a8){return _0x43e174['status'](_0x42a93c)[_0x2227('0x20')](_0x1e78a8);}};}function respondWithFilteredResult(_0x1cf016,_0x162723){return function(_0x531f75){if(_0x531f75){var _0x11bf80=typeof _0x162723[_0x2227('0x21')]===_0x2227('0x22')&&typeof _0x162723[_0x2227('0x23')]===_0x2227('0x22');var _0x28e642=_0x531f75[_0x2227('0x24')];var _0x4e0bba=_0x11bf80?0x0:_0x162723[_0x2227('0x21')];var _0x59f988=_0x11bf80?_0x531f75[_0x2227('0x24')]:_0x162723[_0x2227('0x21')]+_0x162723[_0x2227('0x23')];var _0x1f28ef;if(_0x59f988>=_0x28e642){_0x59f988=_0x28e642;_0x1f28ef=0xc8;}else{_0x1f28ef=0xce;}_0x1cf016[_0x2227('0x1e')](_0x1f28ef);return _0x1cf016[_0x2227('0x25')](_0x2227('0x26'),_0x4e0bba+'-'+_0x59f988+'/'+_0x28e642)[_0x2227('0x20')](_0x531f75);}return null;};}function patchUpdates(_0x3299fd){return function(_0x34c090){try{jsonpatch[_0x2227('0x27')](_0x34c090,_0x3299fd,!![]);}catch(_0x5a454f){return BPromise[_0x2227('0x28')](_0x5a454f);}return _0x34c090[_0x2227('0x29')]();};}function saveUpdates(_0x5b3a09,_0x2cef4b){return function(_0xbfdce1){if(_0xbfdce1){return _0xbfdce1['update'](_0x5b3a09)['then'](function(_0x17c7a4){return _0x17c7a4;});}return null;};}function removeEntity(_0xa4d18b,_0x35333f){return function(_0x1f30c3){if(_0x1f30c3){return _0x1f30c3['destroy']()[_0x2227('0x2a')](function(){var _0x301304=_0x1f30c3[_0x2227('0x2b')]({'plain':!![]});var _0x1957ee='VoicePrefixes';return db[_0x2227('0x2c')][_0x2227('0x2d')]({'where':{'type':_0x1957ee,'resourceId':_0x301304['id']}})[_0x2227('0x2a')](function(){return _0x1f30c3;});})[_0x2227('0x2a')](function(){_0xa4d18b[_0x2227('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55015e,_0x5d1d56){return function(_0x2dc38d){if(!_0x2dc38d){_0x55015e['sendStatus'](0x194);}return _0x2dc38d;};}function handleError(_0x2ba581,_0x1979d8){_0x1979d8=_0x1979d8||0x1f4;return function(_0x58609e){logger['error'](_0x58609e[_0x2227('0x2e')]);if(_0x58609e[_0x2227('0x2f')]){delete _0x58609e[_0x2227('0x2f')];}_0x2ba581['status'](_0x1979d8)[_0x2227('0x30')](_0x58609e);};}exports['index']=function(_0xaa2bbb,_0x3f108b){var _0x28ad1c={},_0xfa2140={},_0x155095={'count':0x0,'rows':[]};var _0x256b7b=_[_0x2227('0x31')](db[_0x2227('0x32')][_0x2227('0x33')],function(_0x781f79){return{'name':_0x781f79[_0x2227('0x34')],'type':_0x781f79['type'][_0x2227('0x35')]};});_0xfa2140[_0x2227('0x36')]=_[_0x2227('0x31')](_0x256b7b,_0x2227('0x2f'));_0xfa2140['query']=_[_0x2227('0x37')](_0xaa2bbb[_0x2227('0x38')]);_0xfa2140[_0x2227('0x39')]=_[_0x2227('0x3a')](_0xfa2140['model'],_0xfa2140[_0x2227('0x38')]);_0x28ad1c[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0xfa2140['model'],qs['fields'](_0xaa2bbb[_0x2227('0x38')][_0x2227('0x3c')]));_0x28ad1c['attributes']=_0x28ad1c[_0x2227('0x3b')][_0x2227('0x3d')]?_0x28ad1c['attributes']:_0xfa2140[_0x2227('0x36')];if(!_0xaa2bbb['query'][_0x2227('0x3e')](_0x2227('0x3f'))){_0x28ad1c[_0x2227('0x23')]=qs[_0x2227('0x23')](_0xaa2bbb['query'][_0x2227('0x23')]);_0x28ad1c['offset']=qs[_0x2227('0x21')](_0xaa2bbb[_0x2227('0x38')][_0x2227('0x21')]);}_0x28ad1c['order']=qs[_0x2227('0x40')](_0xaa2bbb[_0x2227('0x38')][_0x2227('0x40')]);_0x28ad1c[_0x2227('0x41')]=qs[_0x2227('0x39')](_['pick'](_0xaa2bbb['query'],_0xfa2140[_0x2227('0x39')]),_0x256b7b);if(_0xaa2bbb['query'][_0x2227('0x42')]){_0x28ad1c[_0x2227('0x41')]=_[_0x2227('0x43')](_0x28ad1c[_0x2227('0x41')],{'$or':_[_0x2227('0x31')](_0x256b7b,function(_0xd08cd8){if(_0xd08cd8[_0x2227('0x44')]!==_0x2227('0x45')){var _0x5688b5={};_0x5688b5[_0xd08cd8[_0x2227('0x2f')]]={'$like':'%'+_0xaa2bbb['query'][_0x2227('0x42')]+'%'};return _0x5688b5;}})});}_0x28ad1c=_['merge']({},_0x28ad1c,_0xaa2bbb[_0x2227('0x46')]);var _0x59afc0={'where':_0x28ad1c[_0x2227('0x41')]};return db['VoicePrefix'][_0x2227('0x24')](_0x59afc0)[_0x2227('0x2a')](function(_0x46eb0f){_0x155095[_0x2227('0x24')]=_0x46eb0f;if(_0xaa2bbb[_0x2227('0x38')][_0x2227('0x47')]){_0x28ad1c['include']=[{'all':!![]}];}return db['VoicePrefix'][_0x2227('0x48')](_0x28ad1c);})['then'](function(_0x3552db){_0x155095['rows']=_0x3552db;return _0x155095;})[_0x2227('0x2a')](respondWithFilteredResult(_0x3f108b,_0x28ad1c))[_0x2227('0x49')](handleError(_0x3f108b,null));};exports[_0x2227('0x4a')]=function(_0xa3ae06,_0x3f9787){var _0x2871a6={'raw':![],'where':{'id':_0xa3ae06[_0x2227('0x4b')]['id']}},_0x5f5880={};_0x5f5880[_0x2227('0x36')]=_[_0x2227('0x37')](db[_0x2227('0x32')][_0x2227('0x33')]);_0x5f5880[_0x2227('0x38')]=_[_0x2227('0x37')](_0xa3ae06[_0x2227('0x38')]);_0x5f5880['filters']=_[_0x2227('0x3a')](_0x5f5880[_0x2227('0x36')],_0x5f5880[_0x2227('0x38')]);_0x2871a6[_0x2227('0x3b')]=_['intersection'](_0x5f5880[_0x2227('0x36')],qs[_0x2227('0x3c')](_0xa3ae06['query'][_0x2227('0x3c')]));_0x2871a6[_0x2227('0x3b')]=_0x2871a6[_0x2227('0x3b')][_0x2227('0x3d')]?_0x2871a6[_0x2227('0x3b')]:_0x5f5880[_0x2227('0x36')];if(_0xa3ae06[_0x2227('0x38')]['includeAll']){_0x2871a6[_0x2227('0x4c')]=[{'all':!![]}];}_0x2871a6=_[_0x2227('0x43')]({},_0x2871a6,_0xa3ae06['options']);return db[_0x2227('0x32')]['find'](_0x2871a6)[_0x2227('0x2a')](handleEntityNotFound(_0x3f9787,null))[_0x2227('0x2a')](respondWithResult(_0x3f9787,null))[_0x2227('0x49')](handleError(_0x3f9787,null));};exports[_0x2227('0x2d')]=function(_0x5387fc,_0x4e12c7){return db['VoicePrefix'][_0x2227('0x4d')]({'where':{'id':_0x5387fc[_0x2227('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e12c7,null))[_0x2227('0x2a')](removeEntity(_0x4e12c7,null))[_0x2227('0x49')](handleError(_0x4e12c7,null));};exports[_0x2227('0x4e')]=function(_0x39166b,_0x4ee23c){return db['VoicePrefix'][_0x2227('0x4e')]()[_0x2227('0x2a')](respondWithResult(_0x4ee23c,null))[_0x2227('0x49')](handleError(_0x4ee23c,null));};exports[_0x2227('0x4f')]=function(_0x597f00,_0x26581d){var _0x443933;return db[_0x2227('0x50')][_0x2227('0x51')](function(_0x125fa8){return db[_0x2227('0x32')][_0x2227('0x4f')](_0x597f00[_0x2227('0x52')],{'transaction':_0x125fa8})[_0x2227('0x2a')](function(_0x418ec4){_0x443933=_0x418ec4[_0x2227('0x2b')]({'plain':!![]});return db[_0x2227('0x53')][_0x2227('0x4d')]({'where':{'id':_0x443933[_0x2227('0x54')]},'raw':!![]})[_0x2227('0x2a')](function(_0x10c21a){return createVoicePrefixExtensions(_0x443933,_0x10c21a,_0x125fa8);});});})['then'](function(){var _0xc176c9=_0x597f00[_0x2227('0x55')]['get']({'plain':!![]});if(!_0xc176c9)throw new Error(_0x2227('0x56'));if(_0xc176c9[_0x2227('0x57')]===_0x2227('0x55')){var _0x4e8622=_0x443933;return db['UserProfileSection']['find']({'where':{'name':_0x2227('0x58'),'userProfileId':_0xc176c9[_0x2227('0x59')]},'raw':!![]})['then'](function(_0x2171b1){if(_0x2171b1&&_0x2171b1[_0x2227('0x5a')]===0x0){return db[_0x2227('0x2c')]['create']({'name':_0x4e8622[_0x2227('0x2f')],'resourceId':_0x4e8622['id'],'type':_0x2171b1[_0x2227('0x2f')],'sectionId':_0x2171b1['id']},{})['then'](function(){return _0x443933;});}else{return _0x443933;}})[_0x2227('0x49')](function(_0x1f02be){logger['error'](_0x2227('0x5b'),_0x1f02be);throw _0x1f02be;});}return _0x443933;})[_0x2227('0x2a')](respondWithResult(_0x26581d,null))[_0x2227('0x49')](handleError(_0x26581d,null));};function Extension(_0x1ab7e0,_0x300741,_0x118225,_0x52861f){this['context']=_0x2227('0x5c');this['exten']=_0x1ab7e0;this[_0x2227('0x5d')]=_0x118225;this['type']=_0x2227('0x5e');this[_0x2227('0x5f')]=_0x2227('0x60');this[_0x2227('0x61')]=_0x300741;this['appdata']=_0x52861f;}function createVoicePrefixExtensions(_0x44a025,_0x41359a,_0x10df84){return new BPromise(function(_0x1ec0db,_0x30fbd8){var _0x4fdb8d=new Extension(formatPrefixName(_0x44a025['prefix']),0x1,_0x2227('0x62'),'Voice\x20Prefix');_0x4fdb8d[_0x2227('0x63')]=_0x44a025['id'];return db[_0x2227('0x53')]['create'](_0x4fdb8d,{'transaction':_0x10df84})['then'](function(_0x1aa091){var _0x335798=_0x1aa091[_0x2227('0x2b')]({'plain':!![]});var _0x2f6d49=_[_0x2227('0x31')](addVoicePrefixExtensions(_0x44a025,_0x41359a),function(_0x119d39){_0x119d39[_0x2227('0x54')]=_0x335798['id'];_0x119d39[_0x2227('0x63')]=_0x44a025['id'];return _0x119d39;});return db[_0x2227('0x53')]['bulkCreate'](_0x2f6d49,{'transaction':_0x10df84})[_0x2227('0x2a')](function(_0x1d0e87){if(!_0x1d0e87){return _0x30fbd8('Extensions\x20creation\x20failed');}else{return _0x1ec0db(_0x1d0e87);}})[_0x2227('0x49')](function(_0x108605){return _0x30fbd8(_0x108605);});});;});};function addVoicePrefixExtensions(_0x1b2634,_0x5a41d9){var _0x215fb2=[];var _0xfa23f1=formatPrefixName(_0x1b2634[_0x2227('0x64')]);_0x215fb2[_0x2227('0x65')](new Extension(_0xfa23f1,0x2,_0x2227('0x66'),_0x2227('0x67')+_0x1b2634[_0x2227('0x2f')]));if(_0x1b2634[_0x2227('0x68')]){_0x215fb2[_0x2227('0x65')](new Extension(_0xfa23f1,0x3,_0x2227('0x66'),_0x2227('0x69')+_0x1b2634[_0x2227('0x68')]));}else{_0x215fb2[_0x2227('0x65')](new Extension(_0xfa23f1,0x3,_0x2227('0x62'),'No\x20callerid\x20available'));}_0x215fb2[_0x2227('0x65')](new Extension(_0xfa23f1,0x4,_0x2227('0x6a'),_0x5a41d9[_0x2227('0x6b')]+','+_0x2227('0x6c')+(0x8+_0x1b2634[_0x2227('0x2f')][_0x2227('0x3d')])+'}'+','+0x1));return _0x215fb2;}function formatPrefixName(_0x1e7779){var _0x4633d8='_';for(var _0x4e0ca2=0x0;_0x4e0ca2<_0x1e7779[_0x2227('0x3d')];_0x4e0ca2++){if(_0x1e7779[_0x2227('0x6d')](_0x4e0ca2)=='-'){_0x4633d8+=_0x1e7779[_0x2227('0x6d')](_0x4e0ca2);}else{_0x4633d8+='['+_0x1e7779['charAt'](_0x4e0ca2)+']';}}_0x4633d8+='.';return _0x4633d8;}exports[_0x2227('0x6e')]=function(_0x4258a3,_0x24b5b0,_0x5bd233){var _0x398d76=_0x4258a3['body'];_0x398d76[_0x2227('0x64')]=_0x2227('0x6f')+_0x398d76[_0x2227('0x2f')]+'-';return db[_0x2227('0x50')]['transaction'](function(_0x3a34d8){return db[_0x2227('0x32')]['update'](_0x398d76,{'where':{'id':_0x398d76['id']},'transaction':_0x3a34d8})['then'](function(){return db[_0x2227('0x53')][_0x2227('0x2d')]({'where':{'VoicePrefixId':_0x398d76['id']},'transaction':_0x3a34d8})[_0x2227('0x2a')](function(){return db[_0x2227('0x53')][_0x2227('0x4d')]({'where':{'id':_0x398d76[_0x2227('0x54')]},'raw':!![]})[_0x2227('0x2a')](function(_0x36a85a){return createVoicePrefixExtensions(_0x398d76,_0x36a85a,_0x3a34d8);});});});})['then'](function(){return db[_0x2227('0x32')][_0x2227('0x70')](_0x398d76['id']);})[_0x2227('0x2a')](respondWithResult(_0x24b5b0,null))['catch'](handleError(_0x24b5b0,null));};exports['addAgents']=function(_0x5147fe,_0xf3038b,_0x57b27a){return db[_0x2227('0x32')][_0x2227('0x4d')]({'where':{'id':_0x5147fe[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0xf3038b,null))[_0x2227('0x2a')](function(_0x2435d0){if(_0x2435d0){return _0x2435d0[_0x2227('0x71')](_0x5147fe[_0x2227('0x52')][_0x2227('0x72')],_['omit'](_0x5147fe[_0x2227('0x52')],[_0x2227('0x72'),'id'])||{})[_0x2227('0x73')](function(_0x58e3ee){for(var _0x22a30f=0x0;_0x22a30f<_0x5147fe[_0x2227('0x52')]['ids']['length'];_0x22a30f+=0x1){socket[_0x2227('0x74')]('userVoicePrefix:save',{'UserId':Number(_0x5147fe[_0x2227('0x52')][_0x2227('0x72')][_0x22a30f]),'VoicePrefixId':Number(_0x5147fe[_0x2227('0x4b')]['id'])});}return _0x58e3ee;});}})[_0x2227('0x2a')](respondWithResult(_0xf3038b,null))[_0x2227('0x49')](handleError(_0xf3038b,null));};exports['removeAgents']=function(_0x9b431a,_0x128e74,_0x770f98){return db[_0x2227('0x32')]['find']({'where':{'id':_0x9b431a[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x128e74,null))['then'](function(_0x5af36d){if(_0x5af36d){return _0x5af36d[_0x2227('0x75')](_0x9b431a[_0x2227('0x38')][_0x2227('0x72')])['then'](function(){if(_['isArray'](_0x9b431a[_0x2227('0x38')][_0x2227('0x72')])){for(var _0x13cd17=0x0;_0x13cd17<_0x9b431a[_0x2227('0x38')]['ids']['length'];_0x13cd17+=0x1){socket[_0x2227('0x74')]('userVoicePrefix:remove',{'UserId':Number(_0x9b431a[_0x2227('0x38')][_0x2227('0x72')][_0x13cd17]),'VoicePrefixId':Number(_0x9b431a[_0x2227('0x4b')]['id'])});}}else{socket['emit'](_0x2227('0x76'),{'UserId':Number(_0x9b431a['query'][_0x2227('0x72')]),'VoicePrefixId':Number(_0x9b431a[_0x2227('0x4b')]['id'])});}});}})[_0x2227('0x2a')](respondWithStatusCode(_0x128e74,null))[_0x2227('0x49')](handleError(_0x128e74,null));};exports[_0x2227('0x77')]=function(_0x190760,_0x2eea42,_0x9364ec){var _0x50c689={};var _0x266f3b={};var _0x3e2219;var _0x1f0fc8;return db['VoicePrefix']['findOne']({'where':{'id':_0x190760[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x2eea42,null))[_0x2227('0x2a')](function(_0x5daa8b){if(_0x5daa8b){_0x3e2219=_0x5daa8b;_0x266f3b[_0x2227('0x36')]=_['keys'](db[_0x2227('0x78')]['rawAttributes']);_0x266f3b[_0x2227('0x38')]=_[_0x2227('0x37')](_0x190760['query']);_0x266f3b[_0x2227('0x39')]=_[_0x2227('0x3a')](_0x266f3b[_0x2227('0x36')],_0x266f3b[_0x2227('0x38')]);_0x50c689[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0x266f3b['model'],qs['fields'](_0x190760[_0x2227('0x38')][_0x2227('0x3c')]));_0x50c689[_0x2227('0x3b')]=_0x50c689[_0x2227('0x3b')]['length']?_0x50c689['attributes']:_0x266f3b[_0x2227('0x36')];_0x50c689[_0x2227('0x79')]=qs[_0x2227('0x40')](_0x190760['query']['sort']);_0x50c689[_0x2227('0x41')]=qs[_0x2227('0x39')](_[_0x2227('0x7a')](_0x190760[_0x2227('0x38')],_0x266f3b[_0x2227('0x39')]));if(_0x190760[_0x2227('0x38')][_0x2227('0x42')]){_0x50c689[_0x2227('0x41')]=_[_0x2227('0x43')](_0x50c689['where'],{'$or':_['map'](_0x50c689[_0x2227('0x3b')],function(_0x5732e5){var _0x5f1ade={};_0x5f1ade[_0x5732e5]={'$like':'%'+_0x190760[_0x2227('0x38')]['filter']+'%'};return _0x5f1ade;})});}_0x50c689=_[_0x2227('0x43')]({},_0x50c689,_0x190760[_0x2227('0x46')]);return _0x3e2219['getAgents'](_0x50c689);}})[_0x2227('0x2a')](function(_0x3174ef){if(_0x3174ef){_0x1f0fc8=_0x3174ef[_0x2227('0x3d')];if(!_0x190760['query'][_0x2227('0x3e')]('nolimit')){_0x50c689['limit']=qs[_0x2227('0x23')](_0x190760['query'][_0x2227('0x23')]);_0x50c689[_0x2227('0x21')]=qs[_0x2227('0x21')](_0x190760['query'][_0x2227('0x21')]);}return _0x3e2219[_0x2227('0x77')](_0x50c689);}})[_0x2227('0x2a')](function(_0x467380){if(_0x467380){return _0x467380?{'count':_0x1f0fc8,'rows':_0x467380}:null;}})['then'](respondWithResult(_0x2eea42,null))['catch'](handleError(_0x2eea42,null));};exports[_0x2227('0x7b')]=function(_0x3b653f,_0x35c9ea,_0x2e4a1b){var _0x4cd27e={};var _0x1a2852={};var _0x4599ab;var _0x3d592a;return db[_0x2227('0x32')][_0x2227('0x7c')]({'where':{'id':_0x3b653f[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x35c9ea,null))['then'](function(_0x524e6a){if(_0x524e6a){_0x4599ab=_0x524e6a;_0x1a2852[_0x2227('0x36')]=_[_0x2227('0x37')](db['Team'][_0x2227('0x33')]);_0x1a2852[_0x2227('0x38')]=_[_0x2227('0x37')](_0x3b653f[_0x2227('0x38')]);_0x1a2852['filters']=_[_0x2227('0x3a')](_0x1a2852['model'],_0x1a2852['query']);_0x4cd27e[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0x1a2852[_0x2227('0x36')],qs[_0x2227('0x3c')](_0x3b653f[_0x2227('0x38')][_0x2227('0x3c')]));_0x4cd27e[_0x2227('0x3b')]=_0x4cd27e[_0x2227('0x3b')][_0x2227('0x3d')]?_0x4cd27e['attributes']:_0x1a2852[_0x2227('0x36')];_0x4cd27e[_0x2227('0x79')]=qs[_0x2227('0x40')](_0x3b653f[_0x2227('0x38')][_0x2227('0x40')]);_0x4cd27e['where']=qs[_0x2227('0x39')](_['pick'](_0x3b653f[_0x2227('0x38')],_0x1a2852[_0x2227('0x39')]));if(_0x3b653f[_0x2227('0x38')][_0x2227('0x42')]){_0x4cd27e[_0x2227('0x41')]=_[_0x2227('0x43')](_0x4cd27e[_0x2227('0x41')],{'$or':_[_0x2227('0x31')](_0x4cd27e['attributes'],function(_0x1686d7){var _0x30101f={};_0x30101f[_0x1686d7]={'$like':'%'+_0x3b653f[_0x2227('0x38')]['filter']+'%'};return _0x30101f;})});}_0x4cd27e=_[_0x2227('0x43')]({},_0x4cd27e,_0x3b653f[_0x2227('0x46')]);return _0x4599ab['getTeams'](_0x4cd27e);}})[_0x2227('0x2a')](function(_0x386b5d){if(_0x386b5d){_0x3d592a=_0x386b5d['length'];if(!_0x3b653f[_0x2227('0x38')][_0x2227('0x3e')](_0x2227('0x3f'))){_0x4cd27e[_0x2227('0x23')]=qs[_0x2227('0x23')](_0x3b653f[_0x2227('0x38')][_0x2227('0x23')]);_0x4cd27e[_0x2227('0x21')]=qs['offset'](_0x3b653f[_0x2227('0x38')][_0x2227('0x21')]);}return _0x4599ab[_0x2227('0x7b')](_0x4cd27e);}})[_0x2227('0x2a')](function(_0x172b34){if(_0x172b34){return _0x172b34?{'count':_0x3d592a,'rows':_0x172b34}:null;}})[_0x2227('0x2a')](respondWithResult(_0x35c9ea,null))['catch'](handleError(_0x35c9ea,null));};exports[_0x2227('0x7d')]=function(_0x2ffe4f,_0x28d3ca,_0x20def8){var _0x42787b=_0x2ffe4f[_0x2227('0x52')][_0x2227('0x72')];var _0x2cf763;return db[_0x2227('0x7e')][_0x2227('0x48')]({'where':{'id':_0x42787b},'attributes':['id'],'include':[{'model':db[_0x2227('0x78')],'as':_0x2227('0x7f'),'attributes':['id','name',_0x2227('0x80'),_0x2227('0x81'),_0x2227('0x82')],'raw':!![]}]})[_0x2227('0x2a')](function(_0x43af43){if(_0x43af43){_0x2cf763=_0x43af43;var _0x1766e5=_[_0x2227('0x83')](_0x43af43,function(_0x2fdf17){var _0x38e805=_0x2fdf17[_0x2227('0x2b')]({'plain':!![]});return _0x38e805['Agents'];});return db[_0x2227('0x32')][_0x2227('0x4d')]({'where':{'id':_0x2ffe4f[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](function(_0x2fdc19){return db[_0x2227('0x50')][_0x2227('0x51')](function(_0x3f7d5d){return _0x2fdc19['addTeams'](_0x42787b,{'transaction':_0x3f7d5d})[_0x2227('0x2a')](function(){return BPromise[_0x2227('0x84')](_0x2cf763,function(_0x36492d){return db['TeamVoicePrefix'][_0x2227('0x85')]({'TeamId':_0x36492d['id'],'VoicePrefixId':_0x2ffe4f[_0x2227('0x4b')]['id']},{'transaction':_0x3f7d5d});});})['then'](function(){return BPromise[_0x2227('0x84')](_0x1766e5,function(_0x2fb89b){return db[_0x2227('0x86')][_0x2227('0x87')]({'where':{'UserId':_0x2fb89b['id'],'VoicePrefixId':_0x2ffe4f[_0x2227('0x4b')]['id']},'transaction':_0x3f7d5d});});})['then'](function(){_0x1766e5[_0x2227('0x88')](function(_0x12fabe){socket[_0x2227('0x74')](_0x2227('0x89'),{'UserId':_0x12fabe['id'],'VoicePrefixId':_0x2fdc19['id']});});});});});}})[_0x2227('0x2a')](respondWithStatusCode(_0x28d3ca,null))['catch'](handleError(_0x28d3ca,null));};exports['removeTeams']=function(_0x2e153f,_0x312033,_0x1c557d){return db['Team']['findAll']({'where':{'id':_0x2e153f['query'][_0x2227('0x72')]},'attributes':['id'],'include':[{'model':db[_0x2227('0x78')],'as':_0x2227('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x2227('0x2a')](handleEntityNotFound(_0x312033,null))[_0x2227('0x2a')](function(_0x3e5597){var _0x3f58d2=_['map'](_0x3e5597,'id');var _0x2930e9=[];var _0x4505ab=[];var _0x2824b1=squel[_0x2227('0x8a')]();_0x2824b1[_0x2227('0x8b')](_0x2227('0x8c'))[_0x2227('0x8d')](_0x2227('0x8e'),'tq')[_0x2227('0x8f')]('user_has_teams','ut',_0x2227('0x90'))[_0x2227('0x41')](_0x2227('0x91'),_0x2e153f[_0x2227('0x4b')]['id']);for(var _0x3b5b07=0x0;_0x3b5b07<_0x3e5597[_0x2227('0x3d')];_0x3b5b07+=0x1){let _0x19608d=_0x3e5597[_0x3b5b07];for(var _0x5008cc=0x0;_0x5008cc<_0x19608d[_0x2227('0x7f')][_0x2227('0x3d')];_0x5008cc+=0x1){let _0x15b3c4=_0x19608d[_0x2227('0x7f')][_0x5008cc];var _0x1a0805=_0x2824b1[_0x2227('0x92')]();_0x1a0805[_0x2227('0x41')]('ut.UserId\x20=\x20?',_0x15b3c4['id']);_0x4505ab[_0x2227('0x65')](db[_0x2227('0x50')][_0x2227('0x38')](_0x1a0805[_0x2227('0x93')](),{'type':db[_0x2227('0x50')]['QueryTypes'][_0x2227('0x94')]})[_0x2227('0x2a')](function(_0x4f822c){if(_0x4f822c['length']===0x1){return _0x15b3c4['id'];}else{var _0x1bab79=_[_0x2227('0x95')](_[_0x2227('0x31')](_0x4f822c,_0x2227('0x96')),function(_0x26c479){return _[_0x2227('0x97')](_0x3f58d2,_0x26c479);});if(_0x1bab79){return _0x15b3c4['id'];}}}));}}return BPromise[_0x2227('0x98')](_0x4505ab)['then'](function(_0x54db70){_0x2930e9=_(_0x2930e9)[_0x2227('0x99')](_0x54db70)['compact']()['value']();return db[_0x2227('0x32')][_0x2227('0x4d')]({'where':{'id':_0x2e153f[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](function(_0x152b89){return db[_0x2227('0x50')]['transaction'](function(_0x360f72){return _0x152b89[_0x2227('0x9a')](_0x2e153f['query'][_0x2227('0x72')],{'transaction':_0x360f72})[_0x2227('0x2a')](function(){if(!_[_0x2227('0x9b')](_0x2930e9)){return _0x152b89[_0x2227('0x75')](_0x2930e9,{'transaction':_0x360f72});}})[_0x2227('0x2a')](function(){_0x2930e9[_0x2227('0x88')](function(_0x66aa39){socket[_0x2227('0x74')](_0x2227('0x76'),{'UserId':_0x66aa39,'VoicePrefixId':_0x152b89['id']});});});});});});})[_0x2227('0x2a')](respondWithStatusCode(_0x312033,null))['catch'](handleError(_0x312033,null));}; \ No newline at end of file +var _0x4cf8=['forEach','removeTeams','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','map','VoicePrefix','fieldName','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','show','rawAttributes','find','params','describe','create','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','prefix','system-','sequelize','findById','addAgents','body','ids','spread','emit','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','Team','findAll','Agents','voicePause','interface','flatMap','transaction','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate'];(function(_0x1cd9a9,_0x226b55){var _0x15795d=function(_0x238793){while(--_0x238793){_0x1cd9a9['push'](_0x1cd9a9['shift']());}};_0x15795d(++_0x226b55);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x2f02d4,_0x27b24a){_0x2f02d4=_0x2f02d4-0x0;var _0x4b707d=_0x4cf8[_0x2f02d4];return _0x4b707d;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];config[_0x84cf('0x18')]=_[_0x84cf('0x19')](config[_0x84cf('0x18')],{'host':_0x84cf('0x1a'),'port':0x18eb});var socket=require(_0x84cf('0x1b'))(new Redis(config[_0x84cf('0x18')]));require(_0x84cf('0x1c'))[_0x84cf('0x1d')](socket);function respondWithStatusCode(_0x2fc41f,_0x385027){_0x385027=_0x385027||0xcc;return function(_0x7db8f){if(_0x7db8f){return _0x2fc41f[_0x84cf('0x1e')](_0x385027);}return _0x2fc41f[_0x84cf('0x1f')](_0x385027)[_0x84cf('0x20')]();};}function respondWithResult(_0x464e70,_0x240edf){_0x240edf=_0x240edf||0xc8;return function(_0xe12c7b){if(_0xe12c7b){return _0x464e70['status'](_0x240edf)[_0x84cf('0x21')](_0xe12c7b);}};}function respondWithFilteredResult(_0x5d6a93,_0xfa6641){return function(_0x1abe2d){if(_0x1abe2d){var _0x1dad1a=typeof _0xfa6641[_0x84cf('0x22')]===_0x84cf('0x23')&&typeof _0xfa6641['limit']==='undefined';var _0x42d6d4=_0x1abe2d[_0x84cf('0x24')];var _0x346b43=_0x1dad1a?0x0:_0xfa6641[_0x84cf('0x22')];var _0x219afa=_0x1dad1a?_0x1abe2d['count']:_0xfa6641[_0x84cf('0x22')]+_0xfa6641[_0x84cf('0x25')];var _0x3ca1be;if(_0x219afa>=_0x42d6d4){_0x219afa=_0x42d6d4;_0x3ca1be=0xc8;}else{_0x3ca1be=0xce;}_0x5d6a93[_0x84cf('0x1f')](_0x3ca1be);return _0x5d6a93[_0x84cf('0x26')]('Content-Range',_0x346b43+'-'+_0x219afa+'/'+_0x42d6d4)[_0x84cf('0x21')](_0x1abe2d);}return null;};}function patchUpdates(_0x160f86){return function(_0x475b19){try{jsonpatch[_0x84cf('0x27')](_0x475b19,_0x160f86,!![]);}catch(_0x3e5e94){return BPromise[_0x84cf('0x28')](_0x3e5e94);}return _0x475b19[_0x84cf('0x29')]();};}function saveUpdates(_0x4c9d1c,_0x2b2c90){return function(_0x26db3f){if(_0x26db3f){return _0x26db3f[_0x84cf('0x2a')](_0x4c9d1c)[_0x84cf('0x2b')](function(_0x1d220a){return _0x1d220a;});}return null;};}function removeEntity(_0x44d4bf,_0x3c7eda){return function(_0xa44c81){if(_0xa44c81){return _0xa44c81[_0x84cf('0x2c')]()[_0x84cf('0x2b')](function(){var _0x5179c1=_0xa44c81[_0x84cf('0x2d')]({'plain':!![]});var _0x17bc92=_0x84cf('0x2e');return db[_0x84cf('0x2f')]['destroy']({'where':{'type':_0x17bc92,'resourceId':_0x5179c1['id']}})[_0x84cf('0x2b')](function(){return _0xa44c81;});})['then'](function(){_0x44d4bf[_0x84cf('0x1f')](0xcc)[_0x84cf('0x20')]();});}};}function handleEntityNotFound(_0x43b41b,_0xc15298){return function(_0x51adcf){if(!_0x51adcf){_0x43b41b[_0x84cf('0x1e')](0x194);}return _0x51adcf;};}function handleError(_0x2e4653,_0x309398){_0x309398=_0x309398||0x1f4;return function(_0x1bfa56){logger[_0x84cf('0x30')](_0x1bfa56[_0x84cf('0x31')]);if(_0x1bfa56[_0x84cf('0x32')]){delete _0x1bfa56[_0x84cf('0x32')];}_0x2e4653[_0x84cf('0x1f')](_0x309398)['send'](_0x1bfa56);};}exports['index']=function(_0x2795ef,_0x25de3a){var _0x16ebaa={},_0x1e889e={},_0x38eeea={'count':0x0,'rows':[]};var _0x1453cf=_[_0x84cf('0x33')](db[_0x84cf('0x34')]['rawAttributes'],function(_0x113b3e){return{'name':_0x113b3e[_0x84cf('0x35')],'type':_0x113b3e['type'][_0x84cf('0x36')]};});_0x1e889e['model']=_[_0x84cf('0x33')](_0x1453cf,_0x84cf('0x32'));_0x1e889e[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x2795ef[_0x84cf('0x37')]);_0x1e889e['filters']=_[_0x84cf('0x39')](_0x1e889e['model'],_0x1e889e['query']);_0x16ebaa[_0x84cf('0x3a')]=_[_0x84cf('0x39')](_0x1e889e['model'],qs[_0x84cf('0x3b')](_0x2795ef[_0x84cf('0x37')][_0x84cf('0x3b')]));_0x16ebaa[_0x84cf('0x3a')]=_0x16ebaa[_0x84cf('0x3a')][_0x84cf('0x3c')]?_0x16ebaa['attributes']:_0x1e889e[_0x84cf('0x3d')];if(!_0x2795ef[_0x84cf('0x37')][_0x84cf('0x3e')](_0x84cf('0x3f'))){_0x16ebaa[_0x84cf('0x25')]=qs[_0x84cf('0x25')](_0x2795ef['query'][_0x84cf('0x25')]);_0x16ebaa['offset']=qs[_0x84cf('0x22')](_0x2795ef[_0x84cf('0x37')][_0x84cf('0x22')]);}_0x16ebaa[_0x84cf('0x40')]=qs[_0x84cf('0x41')](_0x2795ef[_0x84cf('0x37')][_0x84cf('0x41')]);_0x16ebaa[_0x84cf('0x42')]=qs[_0x84cf('0x43')](_['pick'](_0x2795ef[_0x84cf('0x37')],_0x1e889e['filters']),_0x1453cf);if(_0x2795ef[_0x84cf('0x37')][_0x84cf('0x44')]){_0x16ebaa['where']=_[_0x84cf('0x45')](_0x16ebaa['where'],{'$or':_[_0x84cf('0x33')](_0x1453cf,function(_0x504d32){if(_0x504d32[_0x84cf('0x46')]!=='VIRTUAL'){var _0x2db7dd={};_0x2db7dd[_0x504d32[_0x84cf('0x32')]]={'$like':'%'+_0x2795ef['query'][_0x84cf('0x44')]+'%'};return _0x2db7dd;}})});}_0x16ebaa=_[_0x84cf('0x45')]({},_0x16ebaa,_0x2795ef[_0x84cf('0x47')]);var _0x5ef5fb={'where':_0x16ebaa[_0x84cf('0x42')]};return db['VoicePrefix'][_0x84cf('0x24')](_0x5ef5fb)['then'](function(_0x56b0e5){_0x38eeea['count']=_0x56b0e5;if(_0x2795ef[_0x84cf('0x37')][_0x84cf('0x48')]){_0x16ebaa['include']=[{'all':!![]}];}return db[_0x84cf('0x34')]['findAll'](_0x16ebaa);})[_0x84cf('0x2b')](function(_0x3fe8c1){_0x38eeea['rows']=_0x3fe8c1;return _0x38eeea;})[_0x84cf('0x2b')](respondWithFilteredResult(_0x25de3a,_0x16ebaa))['catch'](handleError(_0x25de3a,null));};exports[_0x84cf('0x49')]=function(_0x593b35,_0x4feb7e){var _0x5d8b69={'raw':![],'where':{'id':_0x593b35['params']['id']}},_0x5498ec={};_0x5498ec['model']=_['keys'](db[_0x84cf('0x34')][_0x84cf('0x4a')]);_0x5498ec[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x593b35['query']);_0x5498ec[_0x84cf('0x43')]=_['intersection'](_0x5498ec[_0x84cf('0x3d')],_0x5498ec[_0x84cf('0x37')]);_0x5d8b69[_0x84cf('0x3a')]=_[_0x84cf('0x39')](_0x5498ec[_0x84cf('0x3d')],qs[_0x84cf('0x3b')](_0x593b35['query'][_0x84cf('0x3b')]));_0x5d8b69[_0x84cf('0x3a')]=_0x5d8b69['attributes'][_0x84cf('0x3c')]?_0x5d8b69[_0x84cf('0x3a')]:_0x5498ec[_0x84cf('0x3d')];if(_0x593b35['query']['includeAll']){_0x5d8b69['include']=[{'all':!![]}];}_0x5d8b69=_[_0x84cf('0x45')]({},_0x5d8b69,_0x593b35[_0x84cf('0x47')]);return db[_0x84cf('0x34')][_0x84cf('0x4b')](_0x5d8b69)[_0x84cf('0x2b')](handleEntityNotFound(_0x4feb7e,null))[_0x84cf('0x2b')](respondWithResult(_0x4feb7e,null))['catch'](handleError(_0x4feb7e,null));};exports[_0x84cf('0x2c')]=function(_0x55316e,_0x44b8b0){return db['VoicePrefix']['find']({'where':{'id':_0x55316e[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x44b8b0,null))[_0x84cf('0x2b')](removeEntity(_0x44b8b0,null))['catch'](handleError(_0x44b8b0,null));};exports['describe']=function(_0x290a4d,_0x1ce99c){return db[_0x84cf('0x34')][_0x84cf('0x4d')]()[_0x84cf('0x2b')](respondWithResult(_0x1ce99c,null))['catch'](handleError(_0x1ce99c,null));};exports[_0x84cf('0x4e')]=function(_0x225fc2,_0x5e4af1){var _0x33145e;return db['sequelize']['transaction'](function(_0x147194){return db[_0x84cf('0x34')]['create'](_0x225fc2['body'],{'transaction':_0x147194})[_0x84cf('0x2b')](function(_0x9f2467){_0x33145e=_0x9f2467[_0x84cf('0x2d')]({'plain':!![]});return db[_0x84cf('0x4f')][_0x84cf('0x4b')]({'where':{'id':_0x33145e[_0x84cf('0x50')]},'raw':!![]})[_0x84cf('0x2b')](function(_0x20ae02){return createVoicePrefixExtensions(_0x33145e,_0x20ae02,_0x147194);});});})['then'](function(){var _0x1bc15c=_0x225fc2[_0x84cf('0x51')]['get']({'plain':!![]});if(!_0x1bc15c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bc15c[_0x84cf('0x52')]===_0x84cf('0x51')){var _0x3912cb=_0x33145e;return db[_0x84cf('0x53')][_0x84cf('0x4b')]({'where':{'name':_0x84cf('0x2e'),'userProfileId':_0x1bc15c[_0x84cf('0x54')]},'raw':!![]})['then'](function(_0x652356){if(_0x652356&&_0x652356['autoAssociation']===0x0){return db[_0x84cf('0x2f')]['create']({'name':_0x3912cb[_0x84cf('0x32')],'resourceId':_0x3912cb['id'],'type':_0x652356[_0x84cf('0x32')],'sectionId':_0x652356['id']},{})['then'](function(){return _0x33145e;});}else{return _0x33145e;}})[_0x84cf('0x55')](function(_0x448260){logger['error'](_0x84cf('0x56'),_0x448260);throw _0x448260;});}return _0x33145e;})['then'](respondWithResult(_0x5e4af1,null))['catch'](handleError(_0x5e4af1,null));};function Extension(_0x5cc371,_0x50cde2,_0x2007a6,_0x39394f){this[_0x84cf('0x57')]=_0x84cf('0x58');this['exten']=_0x5cc371;this[_0x84cf('0x59')]=_0x2007a6;this[_0x84cf('0x46')]='system';this[_0x84cf('0x5a')]=_0x84cf('0x5b');this[_0x84cf('0x5c')]=_0x50cde2;this[_0x84cf('0x5d')]=_0x39394f;}function createVoicePrefixExtensions(_0x2073f1,_0x273711,_0x1f1f76){return new BPromise(function(_0x39a336,_0x553ee2){var _0x155934=new Extension(formatPrefixName(_0x2073f1['prefix']),0x1,_0x84cf('0x5e'),_0x84cf('0x5f'));_0x155934[_0x84cf('0x60')]=_0x2073f1['id'];return db[_0x84cf('0x4f')][_0x84cf('0x4e')](_0x155934,{'transaction':_0x1f1f76})['then'](function(_0xfea0d2){var _0x41ee7a=_0xfea0d2[_0x84cf('0x2d')]({'plain':!![]});var _0x4ebb4b=_[_0x84cf('0x33')](addVoicePrefixExtensions(_0x2073f1,_0x273711),function(_0x240cca){_0x240cca['VoiceExtensionId']=_0x41ee7a['id'];_0x240cca[_0x84cf('0x60')]=_0x2073f1['id'];return _0x240cca;});return db['VoiceExtension'][_0x84cf('0x61')](_0x4ebb4b,{'transaction':_0x1f1f76})[_0x84cf('0x2b')](function(_0x57f1f2){if(!_0x57f1f2){return _0x553ee2(_0x84cf('0x62'));}else{return _0x39a336(_0x57f1f2);}})[_0x84cf('0x55')](function(_0x4a7905){return _0x553ee2(_0x4a7905);});});;});};function addVoicePrefixExtensions(_0x40b33e,_0x2ff1bb){var _0x262ae1=[];var _0x286769=formatPrefixName(_0x40b33e['prefix']);_0x262ae1[_0x84cf('0x63')](new Extension(_0x286769,0x2,_0x84cf('0x64'),'CDR(prefix)='+_0x40b33e['name']));if(_0x40b33e['callerIdAll']){_0x262ae1[_0x84cf('0x63')](new Extension(_0x286769,0x3,_0x84cf('0x64'),_0x84cf('0x65')+_0x40b33e['callerIdAll']));}else{_0x262ae1['push'](new Extension(_0x286769,0x3,_0x84cf('0x5e'),_0x84cf('0x66')));}_0x262ae1[_0x84cf('0x63')](new Extension(_0x286769,0x4,_0x84cf('0x67'),_0x2ff1bb[_0x84cf('0x57')]+','+_0x84cf('0x68')+(0x8+_0x40b33e[_0x84cf('0x32')][_0x84cf('0x3c')])+'}'+','+0x1));return _0x262ae1;}function formatPrefixName(_0x4a5e79){var _0x20b930='_';for(var _0x5350d9=0x0;_0x5350d9<_0x4a5e79[_0x84cf('0x3c')];_0x5350d9++){if(_0x4a5e79[_0x84cf('0x69')](_0x5350d9)=='-'){_0x20b930+=_0x4a5e79['charAt'](_0x5350d9);}else{_0x20b930+='['+_0x4a5e79['charAt'](_0x5350d9)+']';}}_0x20b930+='.';return _0x20b930;}exports[_0x84cf('0x2a')]=function(_0x31e622,_0x373a25,_0x1c6e56){var _0xad54e8=_0x31e622['body'];_0xad54e8[_0x84cf('0x6a')]=_0x84cf('0x6b')+_0xad54e8[_0x84cf('0x32')]+'-';return db[_0x84cf('0x6c')]['transaction'](function(_0x93d687){return db['VoicePrefix']['update'](_0xad54e8,{'where':{'id':_0xad54e8['id']},'transaction':_0x93d687})[_0x84cf('0x2b')](function(){return db[_0x84cf('0x4f')][_0x84cf('0x2c')]({'where':{'VoicePrefixId':_0xad54e8['id']},'transaction':_0x93d687})[_0x84cf('0x2b')](function(){return db['VoiceExtension']['find']({'where':{'id':_0xad54e8['VoiceExtensionId']},'raw':!![]})[_0x84cf('0x2b')](function(_0x53e61f){return createVoicePrefixExtensions(_0xad54e8,_0x53e61f,_0x93d687);});});});})[_0x84cf('0x2b')](function(){return db[_0x84cf('0x34')][_0x84cf('0x6d')](_0xad54e8['id']);})[_0x84cf('0x2b')](respondWithResult(_0x373a25,null))['catch'](handleError(_0x373a25,null));};exports[_0x84cf('0x6e')]=function(_0x14ac69,_0x4e1141,_0xa373e4){return db['VoicePrefix']['find']({'where':{'id':_0x14ac69[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x4e1141,null))['then'](function(_0x5b95b7){if(_0x5b95b7){return _0x5b95b7[_0x84cf('0x6e')](_0x14ac69['body']['ids'],_['omit'](_0x14ac69[_0x84cf('0x6f')],[_0x84cf('0x70'),'id'])||{})[_0x84cf('0x71')](function(_0x58300f){for(var _0x49e6f6=0x0;_0x49e6f6<_0x14ac69[_0x84cf('0x6f')][_0x84cf('0x70')][_0x84cf('0x3c')];_0x49e6f6+=0x1){socket[_0x84cf('0x72')]('userVoicePrefix:save',{'UserId':Number(_0x14ac69['body']['ids'][_0x49e6f6]),'VoicePrefixId':Number(_0x14ac69[_0x84cf('0x4c')]['id'])});}return _0x58300f;});}})[_0x84cf('0x2b')](respondWithResult(_0x4e1141,null))[_0x84cf('0x55')](handleError(_0x4e1141,null));};exports['removeAgents']=function(_0x20693f,_0x29d062,_0x242e39){return db[_0x84cf('0x34')][_0x84cf('0x4b')]({'where':{'id':_0x20693f['params']['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x29d062,null))[_0x84cf('0x2b')](function(_0xc32a6f){if(_0xc32a6f){return _0xc32a6f['removeAgents'](_0x20693f[_0x84cf('0x37')][_0x84cf('0x70')])['then'](function(){if(_[_0x84cf('0x73')](_0x20693f[_0x84cf('0x37')][_0x84cf('0x70')])){for(var _0x132210=0x0;_0x132210<_0x20693f['query']['ids'][_0x84cf('0x3c')];_0x132210+=0x1){socket[_0x84cf('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x20693f['query'][_0x84cf('0x70')][_0x132210]),'VoicePrefixId':Number(_0x20693f[_0x84cf('0x4c')]['id'])});}}else{socket[_0x84cf('0x72')](_0x84cf('0x74'),{'UserId':Number(_0x20693f[_0x84cf('0x37')][_0x84cf('0x70')]),'VoicePrefixId':Number(_0x20693f[_0x84cf('0x4c')]['id'])});}});}})[_0x84cf('0x2b')](respondWithStatusCode(_0x29d062,null))['catch'](handleError(_0x29d062,null));};exports[_0x84cf('0x75')]=function(_0x2323bc,_0x1f7ecd,_0xcb28b4){var _0x4fd3f1={};var _0x3bf924={};var _0x56ea7d;var _0x3ec503;return db['VoicePrefix'][_0x84cf('0x76')]({'where':{'id':_0x2323bc[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x1f7ecd,null))[_0x84cf('0x2b')](function(_0xc4029f){if(_0xc4029f){_0x56ea7d=_0xc4029f;_0x3bf924['model']=_[_0x84cf('0x38')](db[_0x84cf('0x77')][_0x84cf('0x4a')]);_0x3bf924[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x2323bc[_0x84cf('0x37')]);_0x3bf924[_0x84cf('0x43')]=_[_0x84cf('0x39')](_0x3bf924[_0x84cf('0x3d')],_0x3bf924[_0x84cf('0x37')]);_0x4fd3f1[_0x84cf('0x3a')]=_[_0x84cf('0x39')](_0x3bf924[_0x84cf('0x3d')],qs[_0x84cf('0x3b')](_0x2323bc[_0x84cf('0x37')][_0x84cf('0x3b')]));_0x4fd3f1[_0x84cf('0x3a')]=_0x4fd3f1[_0x84cf('0x3a')]['length']?_0x4fd3f1['attributes']:_0x3bf924[_0x84cf('0x3d')];_0x4fd3f1['order']=qs[_0x84cf('0x41')](_0x2323bc[_0x84cf('0x37')]['sort']);_0x4fd3f1[_0x84cf('0x42')]=qs[_0x84cf('0x43')](_[_0x84cf('0x78')](_0x2323bc['query'],_0x3bf924[_0x84cf('0x43')]));if(_0x2323bc['query'][_0x84cf('0x44')]){_0x4fd3f1['where']=_[_0x84cf('0x45')](_0x4fd3f1[_0x84cf('0x42')],{'$or':_['map'](_0x4fd3f1[_0x84cf('0x3a')],function(_0x10e44b){var _0xe11402={};_0xe11402[_0x10e44b]={'$like':'%'+_0x2323bc['query'][_0x84cf('0x44')]+'%'};return _0xe11402;})});}_0x4fd3f1=_['merge']({},_0x4fd3f1,_0x2323bc[_0x84cf('0x47')]);return _0x56ea7d[_0x84cf('0x75')](_0x4fd3f1);}})[_0x84cf('0x2b')](function(_0xff46d2){if(_0xff46d2){_0x3ec503=_0xff46d2[_0x84cf('0x3c')];if(!_0x2323bc[_0x84cf('0x37')]['hasOwnProperty'](_0x84cf('0x3f'))){_0x4fd3f1[_0x84cf('0x25')]=qs[_0x84cf('0x25')](_0x2323bc[_0x84cf('0x37')][_0x84cf('0x25')]);_0x4fd3f1[_0x84cf('0x22')]=qs[_0x84cf('0x22')](_0x2323bc[_0x84cf('0x37')][_0x84cf('0x22')]);}return _0x56ea7d['getAgents'](_0x4fd3f1);}})[_0x84cf('0x2b')](function(_0x4dc17f){if(_0x4dc17f){return _0x4dc17f?{'count':_0x3ec503,'rows':_0x4dc17f}:null;}})['then'](respondWithResult(_0x1f7ecd,null))[_0x84cf('0x55')](handleError(_0x1f7ecd,null));};exports[_0x84cf('0x79')]=function(_0x55da82,_0xf14418,_0x1def45){var _0x13d30b={};var _0x4dad47={};var _0x3152c2;var _0x50e088;return db[_0x84cf('0x34')][_0x84cf('0x76')]({'where':{'id':_0x55da82[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0xf14418,null))[_0x84cf('0x2b')](function(_0x3b5f14){if(_0x3b5f14){_0x3152c2=_0x3b5f14;_0x4dad47['model']=_[_0x84cf('0x38')](db[_0x84cf('0x7a')][_0x84cf('0x4a')]);_0x4dad47[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x55da82[_0x84cf('0x37')]);_0x4dad47[_0x84cf('0x43')]=_[_0x84cf('0x39')](_0x4dad47[_0x84cf('0x3d')],_0x4dad47[_0x84cf('0x37')]);_0x13d30b['attributes']=_['intersection'](_0x4dad47[_0x84cf('0x3d')],qs['fields'](_0x55da82[_0x84cf('0x37')][_0x84cf('0x3b')]));_0x13d30b[_0x84cf('0x3a')]=_0x13d30b['attributes'][_0x84cf('0x3c')]?_0x13d30b[_0x84cf('0x3a')]:_0x4dad47[_0x84cf('0x3d')];_0x13d30b[_0x84cf('0x40')]=qs['sort'](_0x55da82['query'][_0x84cf('0x41')]);_0x13d30b[_0x84cf('0x42')]=qs[_0x84cf('0x43')](_[_0x84cf('0x78')](_0x55da82[_0x84cf('0x37')],_0x4dad47[_0x84cf('0x43')]));if(_0x55da82[_0x84cf('0x37')][_0x84cf('0x44')]){_0x13d30b[_0x84cf('0x42')]=_[_0x84cf('0x45')](_0x13d30b['where'],{'$or':_[_0x84cf('0x33')](_0x13d30b[_0x84cf('0x3a')],function(_0x543607){var _0x4e9be5={};_0x4e9be5[_0x543607]={'$like':'%'+_0x55da82[_0x84cf('0x37')][_0x84cf('0x44')]+'%'};return _0x4e9be5;})});}_0x13d30b=_[_0x84cf('0x45')]({},_0x13d30b,_0x55da82[_0x84cf('0x47')]);return _0x3152c2[_0x84cf('0x79')](_0x13d30b);}})['then'](function(_0x38e27d){if(_0x38e27d){_0x50e088=_0x38e27d[_0x84cf('0x3c')];if(!_0x55da82[_0x84cf('0x37')][_0x84cf('0x3e')](_0x84cf('0x3f'))){_0x13d30b[_0x84cf('0x25')]=qs['limit'](_0x55da82[_0x84cf('0x37')][_0x84cf('0x25')]);_0x13d30b['offset']=qs['offset'](_0x55da82[_0x84cf('0x37')]['offset']);}return _0x3152c2[_0x84cf('0x79')](_0x13d30b);}})['then'](function(_0x127ac0){if(_0x127ac0){return _0x127ac0?{'count':_0x50e088,'rows':_0x127ac0}:null;}})[_0x84cf('0x2b')](respondWithResult(_0xf14418,null))[_0x84cf('0x55')](handleError(_0xf14418,null));};exports['addTeams']=function(_0x2e145c,_0x15ed32,_0x265818){var _0x57c01b=_0x2e145c[_0x84cf('0x6f')][_0x84cf('0x70')];var _0x27492c;return db[_0x84cf('0x7a')][_0x84cf('0x7b')]({'where':{'id':_0x57c01b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x84cf('0x7c'),'attributes':['id',_0x84cf('0x32'),'online',_0x84cf('0x7d'),_0x84cf('0x7e')],'raw':!![]}]})[_0x84cf('0x2b')](function(_0x188afd){if(_0x188afd){_0x27492c=_0x188afd;var _0x2d75f8=_[_0x84cf('0x7f')](_0x188afd,function(_0x5b9da4){var _0x8e16b4=_0x5b9da4[_0x84cf('0x2d')]({'plain':!![]});return _0x8e16b4[_0x84cf('0x7c')];});return db[_0x84cf('0x34')][_0x84cf('0x4b')]({'where':{'id':_0x2e145c[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](function(_0x1a083d){return db[_0x84cf('0x6c')][_0x84cf('0x80')](function(_0x5e41df){return _0x1a083d[_0x84cf('0x81')](_0x57c01b,{'transaction':_0x5e41df})[_0x84cf('0x2b')](function(){return BPromise[_0x84cf('0x82')](_0x27492c,function(_0x33fb10){return db[_0x84cf('0x83')][_0x84cf('0x84')]({'TeamId':_0x33fb10['id'],'VoicePrefixId':_0x2e145c['params']['id']},{'transaction':_0x5e41df});});})['then'](function(){return BPromise[_0x84cf('0x82')](_0x2d75f8,function(_0x166065){return db[_0x84cf('0x85')][_0x84cf('0x86')]({'where':{'UserId':_0x166065['id'],'VoicePrefixId':_0x2e145c[_0x84cf('0x4c')]['id']},'transaction':_0x5e41df});});})['then'](function(){_0x2d75f8[_0x84cf('0x87')](function(_0x4ce3ea){socket['emit']('userVoicePrefix:save',{'UserId':_0x4ce3ea['id'],'VoicePrefixId':_0x1a083d['id']});});});});});}})['then'](respondWithStatusCode(_0x15ed32,null))[_0x84cf('0x55')](handleError(_0x15ed32,null));};exports[_0x84cf('0x88')]=function(_0x5d6832,_0x502910,_0x311d7e){return db[_0x84cf('0x7a')][_0x84cf('0x7b')]({'where':{'id':_0x5d6832[_0x84cf('0x37')][_0x84cf('0x70')]},'attributes':['id'],'include':[{'model':db[_0x84cf('0x77')],'as':_0x84cf('0x7c'),'attributes':['id'],'raw':!![]}]})[_0x84cf('0x2b')](handleEntityNotFound(_0x502910,null))[_0x84cf('0x2b')](function(_0x2d17a1){var _0x5d0481=_[_0x84cf('0x33')](_0x2d17a1,'id');var _0x38c81a=[];var _0x4cb254=[];var _0x2aa96a=squel['select']();_0x2aa96a[_0x84cf('0x89')](_0x84cf('0x8a'))[_0x84cf('0x8b')]('team_has_voice_prefixes','tq')[_0x84cf('0x8c')]('user_has_teams','ut',_0x84cf('0x8d'))[_0x84cf('0x42')]('VoicePrefixId\x20=\x20?',_0x5d6832[_0x84cf('0x4c')]['id']);for(var _0x5b6ced=0x0;_0x5b6ced<_0x2d17a1[_0x84cf('0x3c')];_0x5b6ced+=0x1){let _0x202101=_0x2d17a1[_0x5b6ced];for(var _0x4b06c6=0x0;_0x4b06c6<_0x202101[_0x84cf('0x7c')][_0x84cf('0x3c')];_0x4b06c6+=0x1){let _0x3c05ec=_0x202101[_0x84cf('0x7c')][_0x4b06c6];var _0x145498=_0x2aa96a[_0x84cf('0x8e')]();_0x145498[_0x84cf('0x42')](_0x84cf('0x8f'),_0x3c05ec['id']);_0x4cb254[_0x84cf('0x63')](db[_0x84cf('0x6c')][_0x84cf('0x37')](_0x145498[_0x84cf('0x90')](),{'type':db['sequelize'][_0x84cf('0x91')][_0x84cf('0x92')]})[_0x84cf('0x2b')](function(_0x30b3c9){if(_0x30b3c9[_0x84cf('0x3c')]===0x1){return _0x3c05ec['id'];}else{var _0x562de5=_['every'](_['map'](_0x30b3c9,_0x84cf('0x93')),function(_0x55f411){return _[_0x84cf('0x94')](_0x5d0481,_0x55f411);});if(_0x562de5){return _0x3c05ec['id'];}}}));}}return BPromise[_0x84cf('0x95')](_0x4cb254)[_0x84cf('0x2b')](function(_0x5d4ece){_0x38c81a=_(_0x38c81a)[_0x84cf('0x96')](_0x5d4ece)[_0x84cf('0x97')]()[_0x84cf('0x98')]();return db['VoicePrefix']['find']({'where':{'id':_0x5d6832['params']['id']}})[_0x84cf('0x2b')](function(_0x399112){return db[_0x84cf('0x6c')][_0x84cf('0x80')](function(_0x209b79){return _0x399112['removeTeams'](_0x5d6832[_0x84cf('0x37')][_0x84cf('0x70')],{'transaction':_0x209b79})[_0x84cf('0x2b')](function(){if(!_['isEmpty'](_0x38c81a)){return _0x399112[_0x84cf('0x99')](_0x38c81a,{'transaction':_0x209b79});}})['then'](function(){_0x38c81a[_0x84cf('0x87')](function(_0x194267){socket[_0x84cf('0x72')](_0x84cf('0x74'),{'UserId':_0x194267,'VoicePrefixId':_0x399112['id']});});});});});});})['then'](respondWithStatusCode(_0x502910,null))[_0x84cf('0x55')](handleError(_0x502910,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index a6a62ae..653ce23 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 _0x2756=['../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x2756,0x116));var _0x6275=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x2756[_0x5519a9];return _0x32f2cc;};'use strict';var EventEmitter=require(_0x6275('0x0'));var VoicePrefix=require(_0x6275('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6275('0x2')](0x0);var events={'afterCreate':_0x6275('0x3'),'afterUpdate':_0x6275('0x4'),'afterDestroy':_0x6275('0x5')};function emitEvent(_0x4d2e31){return function(_0x433add,_0x3a8479,_0x4079f7){VoicePrefixEvents['emit'](_0x4d2e31+':'+_0x433add['id'],_0x433add);VoicePrefixEvents['emit'](_0x4d2e31,_0x433add);_0x4079f7(null);};}for(var e in events){if(events[_0x6275('0x6')](e)){var event=events[e];VoicePrefix[_0x6275('0x7')](e,emitEvent(event));}}module[_0x6275('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x36dd=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix'];(function(_0x480529,_0x227832){var _0x586251=function(_0x13283a){while(--_0x13283a){_0x480529['push'](_0x480529['shift']());}};_0x586251(++_0x227832);}(_0x36dd,0x6b));var _0xd36d=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x36dd[_0xbd08b4];return _0x314f1e;};'use strict';var EventEmitter=require(_0xd36d('0x0'));var VoicePrefix=require(_0xd36d('0x1'))['db'][_0xd36d('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd36d('0x3')](0x0);var events={'afterCreate':_0xd36d('0x4'),'afterUpdate':_0xd36d('0x5'),'afterDestroy':_0xd36d('0x6')};function emitEvent(_0x1946d2){return function(_0x588e16,_0x3240c7,_0x448296){VoicePrefixEvents[_0xd36d('0x7')](_0x1946d2+':'+_0x588e16['id'],_0x588e16);VoicePrefixEvents[_0xd36d('0x7')](_0x1946d2,_0x588e16);_0x448296(null);};}for(var e in events){if(events[_0xd36d('0x8')](e)){var event=events[e];VoicePrefix[_0xd36d('0x9')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 59e1fc8..bfa1ca1 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 _0x7318=['VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x3d08ba,_0x15a535){var _0x3b4764=function(_0x57430c){while(--_0x57430c){_0x3d08ba['push'](_0x3d08ba['shift']());}};_0x3b4764(++_0x15a535);}(_0x7318,0x1f0));var _0x8731=function(_0x371974,_0x463561){_0x371974=_0x371974-0x0;var _0x10122c=_0x7318[_0x371974];return _0x10122c;};'use strict';var _=require(_0x8731('0x0'));var util=require(_0x8731('0x1'));var logger=require(_0x8731('0x2'))(_0x8731('0x3'));var moment=require(_0x8731('0x4'));var BPromise=require(_0x8731('0x5'));var rp=require(_0x8731('0x6'));var fs=require('fs');var path=require(_0x8731('0x7'));var rimraf=require('rimraf');var config=require(_0x8731('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x8731('0x9')]=function(_0x45f2e0,_0x451d0b){return _0x45f2e0[_0x8731('0xa')](_0x8731('0xb'),attributes,{'tableName':_0x8731('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5e3=['./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3e09d3,_0x3199e3){var _0x16d05c=function(_0x569009){while(--_0x569009){_0x3e09d3['push'](_0x3e09d3['shift']());}};_0x16d05c(++_0x3199e3);}(_0xf5e3,0x160));var _0x3f5e=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0xf5e3[_0x1cbcf1];return _0x3a06f0;};'use strict';var _=require(_0x3f5e('0x0'));var util=require(_0x3f5e('0x1'));var logger=require(_0x3f5e('0x2'))(_0x3f5e('0x3'));var moment=require(_0x3f5e('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f5e('0x5'));var fs=require('fs');var path=require(_0x3f5e('0x6'));var rimraf=require('rimraf');var config=require(_0x3f5e('0x7'));var attributes=require(_0x3f5e('0x8'));module[_0x3f5e('0x9')]=function(_0x66fe96,_0x1b7b8c){return _0x66fe96[_0x3f5e('0xa')]('VoicePrefix',attributes,{'tableName':_0x3f5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 28d246d..7727089 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 _0x1a85=['catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2d204c,_0x3a3b9d){var _0xf760d6=function(_0x4c28b4){while(--_0x4c28b4){_0x2d204c['push'](_0x2d204c['shift']());}};_0xf760d6(++_0x3a3b9d);}(_0x1a85,0x178));var _0x51a8=function(_0x45081a,_0x3ae384){_0x45081a=_0x45081a-0x0;var _0x55bfe2=_0x1a85[_0x45081a];return _0x55bfe2;};'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});config['redis']=_[_0x51a8('0x8')](config[_0x51a8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0xa'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x51a8('0xb')](socket);function respondWithRpcPromise(_0x2f276b,_0x1a476d,_0x45a3f4){return new BPromise(function(_0x418f06,_0x421fa4){return client[_0x51a8('0xc')](_0x2f276b,_0x45a3f4)[_0x51a8('0xd')](function(_0x34c887){logger[_0x51a8('0xe')](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));logger[_0x51a8('0x11')](_0x51a8('0x12'),_0x1a476d,_0x51a8('0x10'),JSON[_0x51a8('0x13')](_0x34c887));if(_0x34c887[_0x51a8('0x14')]){if(_0x34c887['error'][_0x51a8('0x15')]===0x1f4){logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887['error'][_0x51a8('0x16')]);return _0x421fa4(_0x34c887['error'][_0x51a8('0x16')]);}logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);return _0x418f06(_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);}else{logger['info'](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));_0x418f06(_0x34c887[_0x51a8('0x17')][_0x51a8('0x16')]);}})[_0x51a8('0x18')](function(_0x544886){logger['error'](_0x51a8('0xf'),_0x1a476d,_0x544886);_0x421fa4(_0x544886);});});} \ No newline at end of file +var _0x1203=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x51c657,_0x58d926){var _0x1c4198=function(_0x7c4f9d){while(--_0x7c4f9d){_0x51c657['push'](_0x51c657['shift']());}};_0x1c4198(++_0x58d926);}(_0x1203,0x8c));var _0x3120=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1203[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3120('0x0'));var util=require(_0x3120('0x1'));var moment=require(_0x3120('0x2'));var BPromise=require(_0x3120('0x3'));var rs=require(_0x3120('0x4'));var fs=require('fs');var Redis=require(_0x3120('0x5'));var db=require(_0x3120('0x6'))['db'];var utils=require(_0x3120('0x7'));var logger=require(_0x3120('0x8'))(_0x3120('0x9'));var config=require(_0x3120('0xa'));var jayson=require(_0x3120('0xb'));var client=jayson[_0x3120('0xc')][_0x3120('0xd')]({'port':0x232a});config[_0x3120('0xe')]=_[_0x3120('0xf')](config['redis'],{'host':_0x3120('0x10'),'port':0x18eb});var socket=require(_0x3120('0x11'))(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x6ee01b,_0x39f834,_0x5b2ae3){return new BPromise(function(_0x1493fd,_0x5d0ba8){return client[_0x3120('0x12')](_0x6ee01b,_0x5b2ae3)[_0x3120('0x13')](function(_0x492cda){logger[_0x3120('0x14')](_0x3120('0x15'),_0x39f834,'request\x20sent');logger['debug'](_0x3120('0x16'),_0x39f834,_0x3120('0x17'),JSON[_0x3120('0x18')](_0x492cda));if(_0x492cda[_0x3120('0x19')]){if(_0x492cda[_0x3120('0x19')][_0x3120('0x1a')]===0x1f4){logger[_0x3120('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x39f834,_0x492cda[_0x3120('0x19')][_0x3120('0x1b')]);return _0x5d0ba8(_0x492cda[_0x3120('0x19')][_0x3120('0x1b')]);}logger[_0x3120('0x19')](_0x3120('0x15'),_0x39f834,_0x492cda[_0x3120('0x19')]['message']);return _0x1493fd(_0x492cda[_0x3120('0x19')]['message']);}else{logger[_0x3120('0x14')](_0x3120('0x15'),_0x39f834,_0x3120('0x17'));_0x1493fd(_0x492cda[_0x3120('0x1c')][_0x3120('0x1b')]);}})[_0x3120('0x1d')](function(_0x50429){logger['error'](_0x3120('0x15'),_0x39f834,_0x50429);_0x5d0ba8(_0x50429);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index e4e5175..47d58cf 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 _0x7834=['voicePrefix:','./voicePrefix.events','update','emit','removeListener','register'];(function(_0x10a903,_0x5b6073){var _0x1c0ea7=function(_0x5d996c){while(--_0x5d996c){_0x10a903['push'](_0x10a903['shift']());}};_0x1c0ea7(++_0x5b6073);}(_0x7834,0x13f));var _0x4783=function(_0x4b77a4,_0x238eef){_0x4b77a4=_0x4b77a4-0x0;var _0x434550=_0x7834[_0x4b77a4];return _0x434550;};'use strict';var VoicePrefixEvents=require(_0x4783('0x0'));var events=['save','remove',_0x4783('0x1')];function createListener(_0x51b60a,_0x15dbb4){return function(_0x30c3ee){_0x15dbb4[_0x4783('0x2')](_0x51b60a,_0x30c3ee);};}function removeListener(_0x2ebef6,_0x29566c){return function(){VoicePrefixEvents[_0x4783('0x3')](_0x2ebef6,_0x29566c);};}exports[_0x4783('0x4')]=function(_0x49114c){for(var _0x1cb674=0x0,_0xf8c030=events['length'];_0x1cb674<_0xf8c030;_0x1cb674++){var _0x2dcf46=events[_0x1cb674];var _0x16c83e=createListener(_0x4783('0x5')+_0x2dcf46,_0x49114c);VoicePrefixEvents['on'](_0x2dcf46,_0x16c83e);}}; \ No newline at end of file +var _0x44f8=['remove','update','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x329905,_0x13c144){var _0x3aa42=function(_0x2fac43){while(--_0x2fac43){_0x329905['push'](_0x329905['shift']());}};_0x3aa42(++_0x13c144);}(_0x44f8,0x1de));var _0x844f=function(_0xf53e05,_0x4e603d){_0xf53e05=_0xf53e05-0x0;var _0xbcb5c8=_0x44f8[_0xf53e05];return _0xbcb5c8;};'use strict';var VoicePrefixEvents=require(_0x844f('0x0'));var events=[_0x844f('0x1'),_0x844f('0x2'),_0x844f('0x3')];function createListener(_0x8193a3,_0x24561f){return function(_0x4aad74){_0x24561f['emit'](_0x8193a3,_0x4aad74);};}function removeListener(_0x26151e,_0x5cd939){return function(){VoicePrefixEvents['removeListener'](_0x26151e,_0x5cd939);};}exports['register']=function(_0xe654ca){for(var _0x2cd42=0x0,_0x46eb2c=events[_0x844f('0x4')];_0x2cd42<_0x46eb2c;_0x2cd42++){var _0x37b697=events[_0x2cd42];var _0x1987a9=createListener(_0x844f('0x5')+_0x37b697,_0xe654ca);VoicePrefixEvents['on'](_0x37b697,_0x1987a9);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 56f3e26..77ec24e 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(_0x4c6c46,_0x4d5b50){var _0x4eca5e=function(_0x2478b3){while(--_0x2478b3){_0x4c6c46['push'](_0x4c6c46['shift']());}};_0x4eca5e(++_0x4d5b50);}(_0xb10b,0x12a));var _0xbb10=function(_0x1bfec9,_0x2a863a){_0x1bfec9=_0x1bfec9-0x0;var _0x35cb18=_0xb10b[_0x1bfec9];return _0x35cb18;};'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(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d219c,_0x50820a){_0x1d219c=_0x1d219c-0x0;var _0x3d9fde=_0xb10b[_0x1d219c];return _0x3d9fde;};'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 c7eb6d3..d11d149 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 _0xc9ce=['fewestcalls','linear','wrandom','rrordered','ringall','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','INTEGER','yes','all','once','join','periodic_announce','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','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)','#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','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','mandatoryDisposition','exports','name','ENUM','inbound','outbound','STRING','default','leastrecent'];(function(_0x1fee16,_0x4ec02e){var _0x2018be=function(_0x2452e4){while(--_0x2452e4){_0x1fee16['push'](_0x1fee16['shift']());}};_0x2018be(++_0x4ec02e);}(_0xc9ce,0xee));var _0xec9c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc9ce[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xec9c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xec9c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x3'),_0xec9c('0x4')),'allowNull':![],'defaultValue':_0xec9c('0x3')},'musiconhold':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':_0xec9c('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xec9c('0x2')]('rr','ringall',_0xec9c('0x7'),_0xec9c('0x8'),'random','rrmemory',_0xec9c('0x9'),_0xec9c('0xa'),_0xec9c('0xb')),'allowNull':![],'defaultValue':_0xec9c('0xc'),'set':function(_0x502ec1){this[_0xec9c('0xd')](_0xec9c('0xe'),_0x502ec1?_0x502ec1:_0xec9c('0xf'));},'get':function(){var _0xe1359b=this[_0xec9c('0x10')](_0xec9c('0x11'));var _0x283493=this[_0xec9c('0x10')](_0xec9c('0x12'));var _0x16a32e=this[_0xec9c('0x10')](_0xec9c('0xe'));if(_0xe1359b==='inbound'){return _0x16a32e;}if(_0x283493===_0xec9c('0x13')&&_0x16a32e===_0xec9c('0xf')||_0x283493===_0xec9c('0x13')&&_0x16a32e===_0xec9c('0x14')){return _0x16a32e;}if(_0x283493===_0xec9c('0x15')||_0x283493===_0xec9c('0x16')||_0x283493==='power'){return _0x16a32e;}return null;}},'servicelevel':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xec9c('0x17')](0xb)},'timeout':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xec9c('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defaultValue':_0xec9c('0x18')},'autopause':{'type':Sequelize['ENUM'](_0xec9c('0x18'),'no',_0xec9c('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xec9c('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xec9c('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xec9c('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xec9c('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xec9c('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xec9c('0x2')]('yes','no'),'defaultValue':_0xec9c('0x18')},'announce_holdtime':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no',_0xec9c('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xec9c('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xec9c('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xec9c('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xec9c('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xec9c('0x5')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x369b3e){this[_0xec9c('0xd')]('periodic_announce',_0x369b3e?_0x369b3e[_0xec9c('0x1b')](','):[]);},'get':function(){return this[_0xec9c('0x10')]('periodic_announce')?this[_0xec9c('0x10')](_0xec9c('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':_0xec9c('0x18'),'set':function(_0x515542){this[_0xec9c('0xd')](_0xec9c('0x1d'),_0x515542?_0x515542[_0xec9c('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0xec9c('0x1d'))?this[_0xec9c('0x10')](_0xec9c('0x1d'))[_0xec9c('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':'no','set':function(_0x2a4693){this[_0xec9c('0xd')]('leavewhenempty',_0x2a4693?_0x2a4693['join'](','):undefined);},'get':function(){return this[_0xec9c('0x10')](_0xec9c('0x1f'))?this[_0xec9c('0x10')](_0xec9c('0x1f'))[_0xec9c('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xec9c('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xec9c('0x5')]},'acw':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':0x0,'set':function(_0x2f29b1){this[_0xec9c('0xd')](_0xec9c('0x21'),_0x2f29b1);if(_0x2f29b1){if(this[_0xec9c('0x10')]('wrapuptime')<0x2){this['setDataValue'](_0xec9c('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xec9c('0x15'),_0xec9c('0x23'),'predictive',_0xec9c('0x13')),'defaultValue':_0xec9c('0x15'),'comment':_0xec9c('0x24')},'dialLimitChannel':{'type':Sequelize[_0xec9c('0x17')](0x4)[_0xec9c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xec9c('0x26')},'dialLimitQueue':{'type':Sequelize[_0xec9c('0x17')](0x4)[_0xec9c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xec9c('0x27')},'dialPowerLevel':{'type':Sequelize[_0xec9c('0x28')](0x2)[_0xec9c('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xec9c('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x2a'),_0xec9c('0x2b')),'defaultValue':_0xec9c('0x2b'),'comment':_0xec9c('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xec9c('0x2d')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xec9c('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xec9c('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0xec9c('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xec9c('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0xec9c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x2f')},'dialQueueOptions':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':_0xec9c('0x30'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xec9c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x31')},'dialQueueProject':{'type':Sequelize[_0xec9c('0x5')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xec9c('0x36')},'dialTimezone':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xec9c('0x37')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x38'),'never',_0xec9c('0x39')),'defaultValue':_0xec9c('0x38')},'dialAMDActive':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':0x0,'comment':_0xec9c('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xec9c('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xec9c('0x3b')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xec9c('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xec9c('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xec9c('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xec9c('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xec9c('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xec9c('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0xec9c('0x17')](0x9)[_0xec9c('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xec9c('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xec9c('0x17')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xec9c('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xec9c('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xec9c('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xec9c('0x17')](0x9)[_0xec9c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xec9c('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xec9c('0x44')},'dialRecallInQueue':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':0x0,'comment':_0xec9c('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0xec9c('0x2')]('DESC',_0xec9c('0x46')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xec9c('0x5')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xec9c('0x47')},'dialCutDigit':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xec9c('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x4b')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x4c')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x4d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x4e')},'dialMachineMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x4f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x50')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xec9c('0x17')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x366ed5){if(!_0x366ed5)this[_0xec9c('0xd')]('mandatoryDispositionPauseId',null);this[_0xec9c('0xd')](_0xec9c('0x51'),_0x366ed5);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xec9c('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb891=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','outbound','STRING','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','type','getDataValue','dialMethod','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','periodic_announce','join','joinempty','leavewhenempty','split','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','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','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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x63284e,_0x1dc83d){var _0x977884=function(_0xcdb3a){while(--_0xcdb3a){_0x63284e['push'](_0x63284e['shift']());}};_0x977884(++_0x1dc83d);}(_0xb891,0x1e2));var _0x1b89=function(_0x1fc628,_0xf851bf){_0x1fc628=_0x1fc628-0x0;var _0x166624=_0xb891[_0x1fc628];return _0x166624;};'use strict';var Sequelize=require(_0x1b89('0x0'));module[_0x1b89('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1b89('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x4'),_0x1b89('0x5')),'allowNull':![],'defaultValue':_0x1b89('0x4')},'musiconhold':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x1b89('0x7'),_0x1b89('0x8'),_0x1b89('0x9'),_0x1b89('0xa'),_0x1b89('0xb'),_0x1b89('0xc'),_0x1b89('0xd')),'allowNull':![],'defaultValue':_0x1b89('0xe'),'set':function(_0x48a348){this[_0x1b89('0xf')](_0x1b89('0x10'),_0x48a348?_0x48a348:'rrmemory');},'get':function(){var _0x11160c=this['getDataValue'](_0x1b89('0x11'));var _0x24322d=this[_0x1b89('0x12')](_0x1b89('0x13'));var _0x4d11bd=this['getDataValue'](_0x1b89('0x10'));if(_0x11160c===_0x1b89('0x4')){return _0x4d11bd;}if(_0x24322d==='booked'&&_0x4d11bd===_0x1b89('0xa')||_0x24322d==='booked'&&_0x4d11bd===_0x1b89('0x14')){return _0x4d11bd;}if(_0x24322d===_0x1b89('0x15')||_0x24322d===_0x1b89('0x16')||_0x24322d===_0x1b89('0x17')){return _0x4d11bd;}return null;}},'servicelevel':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1b89('0x6')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1b89('0x3')]('yes','no'),'defaultValue':_0x1b89('0x19')},'autopause':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no',_0x1b89('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1b89('0x18')](0xb)},'autopausebusy':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1b89('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1b89('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1b89('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':_0x1b89('0x19')},'announce_holdtime':{'type':Sequelize[_0x1b89('0x3')]('yes','no',_0x1b89('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0x1b89('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1b89('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1b89('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x1b89('0x6')]},'queue_quantity2':{'type':Sequelize[_0x1b89('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0x1b89('0x6')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x25b867){this[_0x1b89('0xf')](_0x1b89('0x1c'),_0x25b867?_0x25b867[_0x1b89('0x1d')](','):[]);},'get':function(){return this[_0x1b89('0x12')](_0x1b89('0x1c'))?this['getDataValue'](_0x1b89('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':'yes','set':function(_0x225614){this['setDataValue'](_0x1b89('0x1e'),_0x225614?_0x225614['join'](','):undefined);},'get':function(){return this[_0x1b89('0x12')](_0x1b89('0x1e'))?this[_0x1b89('0x12')](_0x1b89('0x1e'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0xacffae){this[_0x1b89('0xf')]('leavewhenempty',_0xacffae?_0xacffae['join'](','):undefined);},'get':function(){return this[_0x1b89('0x12')](_0x1b89('0x1f'))?this[_0x1b89('0x12')](_0x1b89('0x1f'))[_0x1b89('0x20')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1b89('0x6')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':0x0,'set':function(_0x2f75ac){this[_0x1b89('0xf')](_0x1b89('0x22'),_0x2f75ac);if(_0x2f75ac){if(this['getDataValue'](_0x1b89('0x23'))<0x2){this[_0x1b89('0xf')](_0x1b89('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':0x0,'comment':_0x1b89('0x24')},'dialMethod':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x25'),'progressive',_0x1b89('0x17'),_0x1b89('0x16'),'booked'),'defaultValue':_0x1b89('0x15'),'comment':_0x1b89('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x1b89('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x1b89('0x18')](0x4)[_0x1b89('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1b89('0x28')},'dialPowerLevel':{'type':Sequelize[_0x1b89('0x29')](0x2)[_0x1b89('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1b89('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x1b89('0x2b')),'defaultValue':_0x1b89('0x2b'),'comment':_0x1b89('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1b89('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1b89('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1b89('0x6')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1b89('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b89('0x2f')},'dialQueueOptions':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':_0x1b89('0x30'),'comment':_0x1b89('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b89('0x32')},'dialQueueProject':{'type':Sequelize[_0x1b89('0x6')],'comment':_0x1b89('0x33')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b89('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1b89('0x18')](0x5)[_0x1b89('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x1b89('0x18')](0x5)[_0x1b89('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'comment':_0x1b89('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1b89('0x18')](0x5)[_0x1b89('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1b89('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1b89('0x36')},'dialTimezone':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x37'),_0x1b89('0x38'),'onlyIfOpen'),'defaultValue':_0x1b89('0x37')},'dialAMDActive':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':0x0,'comment':_0x1b89('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1b89('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1b89('0x18')](0x9)[_0x1b89('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1b89('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1b89('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1b89('0x18')](0x9)[_0x1b89('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1b89('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x1b89('0x18')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1b89('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1b89('0x18')](0x9)[_0x1b89('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1b89('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1b89('0x18')](0x9)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1b89('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1b89('0x18')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1b89('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x1b89('0x18')](0x5)[_0x1b89('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':0x0,'comment':_0x1b89('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x40'),_0x1b89('0x41')),'defaultValue':_0x1b89('0x40')},'dialQueueProject2':{'type':Sequelize[_0x1b89('0x6')],'comment':_0x1b89('0x33')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x1b89('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1b89('0x42')},'dialCutDigit':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1b89('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b89('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1b89('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b89('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b89('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1b89('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b89('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b89('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1b89('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b89('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1b89('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b89('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x1b89('0x4b')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1b89('0x4c'),'set':function(_0x3c97c6){if(!_0x3c97c6)this['setDataValue'](_0x1b89('0x4d'),null);this[_0x1b89('0xf')](_0x1b89('0x4e'),_0x3c97c6);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x1b89('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index c7f935a..ec82ffd 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 _0x4f0d=['findOrCreate','UserVoiceQueueRt','format','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','compact','isEmpty','userVoiceQueue:remove','addAgents','spread','push','isNil','SIP/%s','all','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','h.ContactId=ci.CmContactId','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','type','find','name','UserProfileResource','error','stack','send','index','VoiceQueue','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','createdAt','updatedAt','omit','UserProfileSection','getHoppers','findOne','CmHopper','nolimit','getHopperHistories','CmHopperHistory','VoiceQueueId','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','forEach','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue'];(function(_0x273ecc,_0x5bb90d){var _0x25467d=function(_0x29cd85){while(--_0x29cd85){_0x273ecc['push'](_0x273ecc['shift']());}};_0x25467d(++_0x5bb90d);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x27062d,_0x24b179){_0x27062d=_0x27062d-0x0;var _0x4f1478=_0x4f0d[_0x27062d];return _0x4f1478;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd4f0('0x0'));var BPromise=require(_0xd4f0('0x1'));var Mustache=require(_0xd4f0('0x2'));var util=require('util');var path=require(_0xd4f0('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4f0('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4f0('0x5'));var squel=require(_0xd4f0('0x6'));var crypto=require('crypto');var jsforce=require(_0xd4f0('0x7'));var deskjs=require(_0xd4f0('0x8'));var toCsv=require(_0xd4f0('0x9'));var querystring=require(_0xd4f0('0xa'));var Papa=require(_0xd4f0('0xb'));var Redis=require('ioredis');var authService=require(_0xd4f0('0xc'));var qs=require(_0xd4f0('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4f0('0xe'))(_0xd4f0('0xf'));var utils=require('../../config/utils');var config=require(_0xd4f0('0x10'));var licenseUtil=require(_0xd4f0('0x11'));var db=require(_0xd4f0('0x12'))['db'];config[_0xd4f0('0x13')]=_[_0xd4f0('0x14')](config['redis'],{'host':_0xd4f0('0x15'),'port':0x18eb});var socket=require(_0xd4f0('0x16'))(new Redis(config[_0xd4f0('0x13')]));require(_0xd4f0('0x17'))[_0xd4f0('0x18')](socket);function respondWithStatusCode(_0x544936,_0x100cd4){_0x100cd4=_0x100cd4||0xcc;return function(_0x386f84){if(_0x386f84){return _0x544936[_0xd4f0('0x19')](_0x100cd4);}return _0x544936[_0xd4f0('0x1a')](_0x100cd4)[_0xd4f0('0x1b')]();};}function respondWithResult(_0x2dd02d,_0x4f8e76){_0x4f8e76=_0x4f8e76||0xc8;return function(_0x5adf8a){if(_0x5adf8a){return _0x2dd02d[_0xd4f0('0x1a')](_0x4f8e76)[_0xd4f0('0x1c')](_0x5adf8a);}};}function respondWithFilteredResult(_0xff90e,_0x7b2ca4){return function(_0x4d0dcc){if(_0x4d0dcc){var _0x5bf265=typeof _0x7b2ca4[_0xd4f0('0x1d')]===_0xd4f0('0x1e')&&typeof _0x7b2ca4[_0xd4f0('0x1f')]===_0xd4f0('0x1e');var _0x7560d6=_0x4d0dcc[_0xd4f0('0x20')];var _0x57d418=_0x5bf265?0x0:_0x7b2ca4[_0xd4f0('0x1d')];var _0x2f0b79=_0x5bf265?_0x4d0dcc[_0xd4f0('0x20')]:_0x7b2ca4['offset']+_0x7b2ca4[_0xd4f0('0x1f')];var _0x474c22;if(_0x2f0b79>=_0x7560d6){_0x2f0b79=_0x7560d6;_0x474c22=0xc8;}else{_0x474c22=0xce;}_0xff90e[_0xd4f0('0x1a')](_0x474c22);return _0xff90e['set'](_0xd4f0('0x21'),_0x57d418+'-'+_0x2f0b79+'/'+_0x7560d6)[_0xd4f0('0x1c')](_0x4d0dcc);}return null;};}function patchUpdates(_0x655480){return function(_0x5b94bb){try{jsonpatch[_0xd4f0('0x22')](_0x5b94bb,_0x655480,!![]);}catch(_0x174e52){return BPromise[_0xd4f0('0x23')](_0x174e52);}return _0x5b94bb[_0xd4f0('0x24')]();};}function saveUpdates(_0x4fd650,_0x1552e9){return function(_0x3345c6){if(_0x3345c6){return _0x3345c6[_0xd4f0('0x25')](_0x4fd650)[_0xd4f0('0x26')](function(_0x5f4858){return _0x5f4858;});}return null;};}function removeEntity(_0x37e8a1,_0x49b94b){return function(_0x15e310){if(_0x15e310){return _0x15e310[_0xd4f0('0x27')]()[_0xd4f0('0x26')](function(){var _0x22d385=_0x15e310[_0xd4f0('0x28')]({'plain':!![]});var _0x2f4291=[{'name':_0xd4f0('0x29'),'value':_0xd4f0('0x2a'),'ignore':![]},{'name':_0xd4f0('0x2b'),'value':_0xd4f0('0x2c'),'ignore':![]}];var _0xe2bf28=_(_0x2f4291)['filter'](_0xd4f0('0x2d'))[_0xd4f0('0x2e')](_0xd4f0('0x2f'))[_0xd4f0('0x2f')]();if(_['includes'](_0xe2bf28,_0x22d385[_0xd4f0('0x30')])){return;}var _0x27427c=_[_0xd4f0('0x31')](_0x2f4291,[_0xd4f0('0x2f'),_0x22d385['type']])[_0xd4f0('0x32')];return db[_0xd4f0('0x33')][_0xd4f0('0x27')]({'where':{'type':_0x27427c,'resourceId':_0x22d385['id']}})[_0xd4f0('0x26')](function(){return _0x15e310;});})['then'](function(){_0x37e8a1[_0xd4f0('0x1a')](0xcc)[_0xd4f0('0x1b')]();});}};}function handleEntityNotFound(_0x39153a,_0x416209){return function(_0x30ef92){if(!_0x30ef92){_0x39153a[_0xd4f0('0x19')](0x194);}return _0x30ef92;};}function handleError(_0x3eb203,_0x283e1b){_0x283e1b=_0x283e1b||0x1f4;return function(_0x177f7c){logger[_0xd4f0('0x34')](_0x177f7c[_0xd4f0('0x35')]);if(_0x177f7c['name']){delete _0x177f7c[_0xd4f0('0x32')];}_0x3eb203[_0xd4f0('0x1a')](_0x283e1b)[_0xd4f0('0x36')](_0x177f7c);};}exports[_0xd4f0('0x37')]=function(_0x1d4777,_0x5a48a3){var _0x1d2d09={},_0x46e74d={},_0x515aad={'count':0x0,'rows':[]};var _0x431118=_[_0xd4f0('0x2e')](db[_0xd4f0('0x38')]['rawAttributes'],function(_0xf63538){return{'name':_0xf63538['fieldName'],'type':_0xf63538['type']['key']};});_0x46e74d[_0xd4f0('0x39')]=_[_0xd4f0('0x2e')](_0x431118,_0xd4f0('0x32'));_0x46e74d[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x1d4777['query']);_0x46e74d['filters']=_[_0xd4f0('0x3c')](_0x46e74d[_0xd4f0('0x39')],_0x46e74d[_0xd4f0('0x3a')]);_0x1d2d09['attributes']=_[_0xd4f0('0x3c')](_0x46e74d[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x1d4777['query'][_0xd4f0('0x3d')]));_0x1d2d09['attributes']=_0x1d2d09[_0xd4f0('0x3e')][_0xd4f0('0x3f')]?_0x1d2d09[_0xd4f0('0x3e')]:_0x46e74d[_0xd4f0('0x39')];if(!_0x1d4777[_0xd4f0('0x3a')][_0xd4f0('0x40')]('nolimit')){_0x1d2d09['limit']=qs[_0xd4f0('0x1f')](_0x1d4777[_0xd4f0('0x3a')]['limit']);_0x1d2d09[_0xd4f0('0x1d')]=qs[_0xd4f0('0x1d')](_0x1d4777[_0xd4f0('0x3a')][_0xd4f0('0x1d')]);}_0x1d2d09[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x1d4777['query'][_0xd4f0('0x42')]);_0x1d2d09[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x1d4777[_0xd4f0('0x3a')],_0x46e74d[_0xd4f0('0x44')]),_0x431118);if(_0x1d4777['query'][_0xd4f0('0x46')]){_0x1d2d09[_0xd4f0('0x43')]=_['merge'](_0x1d2d09['where'],{'$or':_[_0xd4f0('0x2e')](_0x431118,function(_0x1cce51){if(_0x1cce51[_0xd4f0('0x30')]!=='VIRTUAL'){var _0x4af132={};_0x4af132[_0x1cce51[_0xd4f0('0x32')]]={'$like':'%'+_0x1d4777[_0xd4f0('0x3a')][_0xd4f0('0x46')]+'%'};return _0x4af132;}})});}_0x1d2d09=_[_0xd4f0('0x47')]({},_0x1d2d09,_0x1d4777[_0xd4f0('0x48')]);var _0x128e50={'where':_0x1d2d09[_0xd4f0('0x43')]};return db[_0xd4f0('0x38')][_0xd4f0('0x20')](_0x128e50)[_0xd4f0('0x26')](function(_0x2aa578){_0x515aad[_0xd4f0('0x20')]=_0x2aa578;if(_0x1d4777[_0xd4f0('0x3a')]['includeAll']){_0x1d2d09[_0xd4f0('0x49')]=[{'all':!![]}];}return db['VoiceQueue'][_0xd4f0('0x4a')](_0x1d2d09);})['then'](function(_0x2dca62){_0x515aad[_0xd4f0('0x4b')]=_0x2dca62;return _0x515aad;})[_0xd4f0('0x26')](respondWithFilteredResult(_0x5a48a3,_0x1d2d09))['catch'](handleError(_0x5a48a3,null));};exports[_0xd4f0('0x4c')]=function(_0x2cf57a,_0x59a7ea){var _0x3e6a62={'raw':![],'where':{'id':_0x2cf57a[_0xd4f0('0x4d')]['id']}},_0x541e0b={};_0x541e0b[_0xd4f0('0x39')]=_['keys'](db[_0xd4f0('0x38')][_0xd4f0('0x4e')]);_0x541e0b[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x2cf57a[_0xd4f0('0x3a')]);_0x541e0b[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x541e0b[_0xd4f0('0x39')],_0x541e0b[_0xd4f0('0x3a')]);_0x3e6a62[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x541e0b[_0xd4f0('0x39')],qs['fields'](_0x2cf57a[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0x3e6a62[_0xd4f0('0x3e')]=_0x3e6a62[_0xd4f0('0x3e')][_0xd4f0('0x3f')]?_0x3e6a62['attributes']:_0x541e0b[_0xd4f0('0x39')];if(_0x2cf57a[_0xd4f0('0x3a')][_0xd4f0('0x4f')]){_0x3e6a62[_0xd4f0('0x49')]=[{'all':!![]}];}_0x3e6a62=_[_0xd4f0('0x47')]({},_0x3e6a62,_0x2cf57a[_0xd4f0('0x48')]);return db[_0xd4f0('0x38')][_0xd4f0('0x31')](_0x3e6a62)[_0xd4f0('0x26')](handleEntityNotFound(_0x59a7ea,null))[_0xd4f0('0x26')](respondWithResult(_0x59a7ea,null))[_0xd4f0('0x50')](handleError(_0x59a7ea,null));};exports[_0xd4f0('0x51')]=function(_0x38671d,_0x245001){return db[_0xd4f0('0x38')]['create'](_0x38671d[_0xd4f0('0x52')],{})['then'](function(_0x406b3f){var _0x1d42d1=_0x38671d[_0xd4f0('0x53')]['get']({'plain':!![]});if(!_0x1d42d1)throw new Error(_0xd4f0('0x54'));if(_0x1d42d1[_0xd4f0('0x55')]==='user'){var _0x19f971=_0x406b3f[_0xd4f0('0x28')]({'plain':!![]});var _0x1290ee=[{'name':_0xd4f0('0x29'),'value':'inbound'},{'name':_0xd4f0('0x2b'),'value':'outbound'}];var _0x382eaf=_[_0xd4f0('0x31')](_0x1290ee,[_0xd4f0('0x2f'),_0x19f971[_0xd4f0('0x30')]])[_0xd4f0('0x32')];return db['UserProfileSection']['find']({'where':{'name':_0x382eaf,'userProfileId':_0x1d42d1[_0xd4f0('0x56')]},'raw':!![]})[_0xd4f0('0x26')](function(_0x32044d){if(_0x32044d&&_0x32044d[_0xd4f0('0x57')]===0x0){return db[_0xd4f0('0x33')][_0xd4f0('0x51')]({'name':_0x19f971[_0xd4f0('0x32')],'resourceId':_0x19f971['id'],'type':_0x32044d[_0xd4f0('0x32')],'sectionId':_0x32044d['id']},{})[_0xd4f0('0x26')](function(){return _0x406b3f;});}else{return _0x406b3f;}})['catch'](function(_0xde8573){logger[_0xd4f0('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xde8573);throw _0xde8573;});}return _0x406b3f;})[_0xd4f0('0x26')](respondWithResult(_0x245001,0xc9))[_0xd4f0('0x50')](handleError(_0x245001,null));};exports[_0xd4f0('0x58')]=function(_0x1a0ca9,_0x5a4f9e){var _0x504f62={'where':{'id':_0x1a0ca9[_0xd4f0('0x4d')]['id']}},_0x461626={};_0x461626['model']=_['keys'](db[_0xd4f0('0x38')][_0xd4f0('0x4e')]);_0x504f62[_0xd4f0('0x3e')]=_['intersection'](_0x461626[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x1a0ca9[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0x504f62['attributes']=_0x504f62['attributes'][_0xd4f0('0x3f')]?_0x504f62['attributes']:_0x461626[_0xd4f0('0x39')];if(_0x1a0ca9['query'][_0xd4f0('0x4f')]){_0x504f62[_0xd4f0('0x49')]=[{'all':!![]}];}_0x504f62=_['merge']({},_0x504f62,_0x1a0ca9[_0xd4f0('0x48')]);return db[_0xd4f0('0x38')][_0xd4f0('0x31')](_0x504f62)[_0xd4f0('0x26')](handleEntityNotFound(_0x5a4f9e,null))[_0xd4f0('0x26')](function(_0x25c333){if(_0x25c333){var _0x195fd=_0x25c333['get']({'plain':!![]});_0x195fd=qs['omit'](_0x195fd,['id',_0xd4f0('0x59'),_0xd4f0('0x5a')]);_0x1a0ca9['body']=_[_0xd4f0('0x5b')](_0x1a0ca9['body'],['id',_0xd4f0('0x59'),_0xd4f0('0x5a')]);return db[_0xd4f0('0x38')][_0xd4f0('0x51')](_[_0xd4f0('0x47')](_0x195fd,_0x1a0ca9[_0xd4f0('0x52')]),{'include':_0x1a0ca9[_0xd4f0('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0xd4f0('0x26')](function(_0x4d9935){var _0x1c0afe=_0x1a0ca9[_0xd4f0('0x53')][_0xd4f0('0x28')]({'plain':!![]});if(!_0x1c0afe)throw new Error(_0xd4f0('0x54'));if(_0x1c0afe[_0xd4f0('0x55')]==='user'){var _0x259baa=_0x4d9935['get']({'plain':!![]});var _0x32a5d7=[{'name':_0xd4f0('0x29'),'value':'inbound'},{'name':_0xd4f0('0x2b'),'value':_0xd4f0('0x2c')}];var _0x5e330c=_[_0xd4f0('0x31')](_0x32a5d7,[_0xd4f0('0x2f'),_0x259baa[_0xd4f0('0x30')]])[_0xd4f0('0x32')];return db[_0xd4f0('0x5c')][_0xd4f0('0x31')]({'where':{'name':_0x5e330c,'userProfileId':_0x1c0afe['userProfileId']},'raw':!![]})[_0xd4f0('0x26')](function(_0x272b07){if(_0x272b07&&_0x272b07[_0xd4f0('0x57')]===0x0){return db['UserProfileResource'][_0xd4f0('0x51')]({'name':_0x259baa[_0xd4f0('0x32')],'resourceId':_0x259baa['id'],'type':_0x272b07[_0xd4f0('0x32')],'sectionId':_0x272b07['id']},{})[_0xd4f0('0x26')](function(){return _0x4d9935;});}else{return _0x4d9935;}})['catch'](function(_0x53d7cf){logger[_0xd4f0('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53d7cf);throw _0x53d7cf;});}return _0x4d9935;});}})[_0xd4f0('0x26')](respondWithResult(_0x5a4f9e,0xc9))['catch'](handleError(_0x5a4f9e,null));};exports[_0xd4f0('0x25')]=function(_0x304234,_0x2b7674){if(_0x304234[_0xd4f0('0x52')]['id']){delete _0x304234[_0xd4f0('0x52')]['id'];}return db[_0xd4f0('0x38')][_0xd4f0('0x31')]({'where':{'id':_0x304234[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x2b7674,null))[_0xd4f0('0x26')](saveUpdates(_0x304234['body'],null))['then'](respondWithResult(_0x2b7674,null))[_0xd4f0('0x50')](handleError(_0x2b7674,null));};exports[_0xd4f0('0x27')]=function(_0x19c292,_0x3bfd3b){return db['VoiceQueue'][_0xd4f0('0x31')]({'where':{'id':_0x19c292['params']['id']}})['then'](handleEntityNotFound(_0x3bfd3b,null))['then'](removeEntity(_0x3bfd3b,null))[_0xd4f0('0x50')](handleError(_0x3bfd3b,null));};exports[_0xd4f0('0x5d')]=function(_0x57c6fb,_0x2551bc,_0x3e14e7){var _0x187718={'raw':![],'where':{}};var _0x31c2c1={};var _0x2e94f9={'count':0x0,'rows':[]};return db[_0xd4f0('0x38')][_0xd4f0('0x5e')]({'where':{'id':_0x57c6fb[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x2551bc,null))['then'](function(_0x403d3b){if(_0x403d3b){_0x31c2c1[_0xd4f0('0x39')]=_['keys'](db[_0xd4f0('0x5f')][_0xd4f0('0x4e')]);_0x31c2c1[_0xd4f0('0x3a')]=_['keys'](_0x57c6fb[_0xd4f0('0x3a')]);_0x31c2c1[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x31c2c1[_0xd4f0('0x39')],_0x31c2c1['query']);_0x187718[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x31c2c1[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x57c6fb[_0xd4f0('0x3a')]['fields']));_0x187718['attributes']=_0x187718[_0xd4f0('0x3e')][_0xd4f0('0x3f')]?_0x187718[_0xd4f0('0x3e')]:_0x31c2c1[_0xd4f0('0x39')];if(!_0x57c6fb['query'][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0x187718[_0xd4f0('0x1f')]=qs[_0xd4f0('0x1f')](_0x57c6fb['query'][_0xd4f0('0x1f')]);_0x187718['offset']=qs[_0xd4f0('0x1d')](_0x57c6fb[_0xd4f0('0x3a')][_0xd4f0('0x1d')]);}_0x187718[_0xd4f0('0x41')]=qs['sort'](_0x57c6fb[_0xd4f0('0x3a')][_0xd4f0('0x42')]);_0x187718[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x57c6fb['query'],_0x31c2c1[_0xd4f0('0x44')]));_0x187718[_0xd4f0('0x43')]['VoiceQueueId']=_0x403d3b['id'];if(_0x57c6fb[_0xd4f0('0x3a')][_0xd4f0('0x46')]){_0x187718[_0xd4f0('0x43')]=_[_0xd4f0('0x47')](_0x187718[_0xd4f0('0x43')],{'$or':_['map'](_0x187718[_0xd4f0('0x3e')],function(_0x10149b){var _0x14becf={};_0x14becf[_0x10149b]={'$like':'%'+_0x57c6fb[_0xd4f0('0x3a')][_0xd4f0('0x46')]+'%'};return _0x14becf;})});}_0x187718=_[_0xd4f0('0x47')]({},_0x187718,_0x57c6fb[_0xd4f0('0x48')]);return db['CmHopper'][_0xd4f0('0x20')]({'where':_0x187718[_0xd4f0('0x43')]})[_0xd4f0('0x26')](function(_0x139426){_0x2e94f9[_0xd4f0('0x20')]=_0x139426;if(_0x57c6fb[_0xd4f0('0x3a')]['includeAll']){_0x187718['include']=[{'all':!![]}];}return db[_0xd4f0('0x5f')][_0xd4f0('0x4a')](_0x187718);})[_0xd4f0('0x26')](function(_0x110936){_0x2e94f9[_0xd4f0('0x4b')]=_0x110936;return _0x2e94f9;});}})[_0xd4f0('0x26')](respondWithFilteredResult(_0x2551bc,_0x187718))[_0xd4f0('0x50')](handleError(_0x2551bc,null));};exports[_0xd4f0('0x61')]=function(_0x5cd947,_0x29398a,_0x214214){var _0x4fa782={'raw':!![],'where':{}};var _0x335f39={};var _0x4f7a7b={'count':0x0,'rows':[]};return db[_0xd4f0('0x38')]['findOne']({'where':{'id':_0x5cd947[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x29398a,null))['then'](function(_0x5e61a4){if(_0x5e61a4){_0x335f39[_0xd4f0('0x39')]=_['keys'](db[_0xd4f0('0x62')]['rawAttributes']);_0x335f39[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x5cd947['query']);_0x335f39[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x335f39[_0xd4f0('0x39')],_0x335f39[_0xd4f0('0x3a')]);_0x4fa782[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x335f39[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x5cd947[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0x4fa782[_0xd4f0('0x3e')]=_0x4fa782['attributes'][_0xd4f0('0x3f')]?_0x4fa782['attributes']:_0x335f39['model'];if(!_0x5cd947[_0xd4f0('0x3a')][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0x4fa782[_0xd4f0('0x1f')]=qs[_0xd4f0('0x1f')](_0x5cd947[_0xd4f0('0x3a')][_0xd4f0('0x1f')]);_0x4fa782[_0xd4f0('0x1d')]=qs[_0xd4f0('0x1d')](_0x5cd947['query'][_0xd4f0('0x1d')]);}_0x4fa782[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x5cd947[_0xd4f0('0x3a')]['sort']);_0x4fa782[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_['pick'](_0x5cd947[_0xd4f0('0x3a')],_0x335f39[_0xd4f0('0x44')]));_0x4fa782[_0xd4f0('0x43')][_0xd4f0('0x63')]=_0x5e61a4['id'];if(_0x5cd947[_0xd4f0('0x3a')][_0xd4f0('0x46')]){_0x4fa782[_0xd4f0('0x43')]=_['merge'](_0x4fa782[_0xd4f0('0x43')],{'$or':_[_0xd4f0('0x2e')](_0x4fa782[_0xd4f0('0x3e')],function(_0x4db266){var _0x25cec6={};_0x25cec6[_0x4db266]={'$like':'%'+_0x5cd947['query'][_0xd4f0('0x46')]+'%'};return _0x25cec6;})});}_0x4fa782=_['merge']({},_0x4fa782,_0x5cd947[_0xd4f0('0x48')]);return db['CmHopperHistory'][_0xd4f0('0x20')]({'where':_0x4fa782[_0xd4f0('0x43')]})['then'](function(_0x114638){_0x4f7a7b[_0xd4f0('0x20')]=_0x114638;if(_0x5cd947[_0xd4f0('0x3a')][_0xd4f0('0x4f')]){_0x4fa782[_0xd4f0('0x49')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xd4f0('0x4a')](_0x4fa782);})[_0xd4f0('0x26')](function(_0x9956be){_0x4f7a7b['rows']=_0x9956be;return _0x4f7a7b;});}})[_0xd4f0('0x26')](respondWithFilteredResult(_0x29398a,_0x4fa782))[_0xd4f0('0x50')](handleError(_0x29398a,null));};exports['getHopperFinals']=function(_0x54fa49,_0x9c764f,_0x147cae){var _0xdc707a={'raw':!![],'where':{}};var _0x188653={};var _0x597600={'count':0x0,'rows':[]};return db[_0xd4f0('0x38')][_0xd4f0('0x5e')]({'where':{'id':_0x54fa49[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x9c764f,null))['then'](function(_0xc0bd14){if(_0xc0bd14){_0x188653[_0xd4f0('0x39')]=_[_0xd4f0('0x3b')](db['CmHopperFinal'][_0xd4f0('0x4e')]);_0x188653['query']=_[_0xd4f0('0x3b')](_0x54fa49[_0xd4f0('0x3a')]);_0x188653[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x188653[_0xd4f0('0x39')],_0x188653[_0xd4f0('0x3a')]);_0xdc707a[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x188653[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x54fa49[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0xdc707a[_0xd4f0('0x3e')]=_0xdc707a[_0xd4f0('0x3e')][_0xd4f0('0x3f')]?_0xdc707a[_0xd4f0('0x3e')]:_0x188653['model'];if(!_0x54fa49[_0xd4f0('0x3a')][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0xdc707a['limit']=qs['limit'](_0x54fa49[_0xd4f0('0x3a')]['limit']);_0xdc707a[_0xd4f0('0x1d')]=qs[_0xd4f0('0x1d')](_0x54fa49[_0xd4f0('0x3a')]['offset']);}_0xdc707a[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x54fa49[_0xd4f0('0x3a')][_0xd4f0('0x42')]);_0xdc707a[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x54fa49[_0xd4f0('0x3a')],_0x188653[_0xd4f0('0x44')]));_0xdc707a[_0xd4f0('0x43')][_0xd4f0('0x63')]=_0xc0bd14['id'];if(_0x54fa49[_0xd4f0('0x3a')]['filter']){_0xdc707a[_0xd4f0('0x43')]=_['merge'](_0xdc707a[_0xd4f0('0x43')],{'$or':_[_0xd4f0('0x2e')](_0xdc707a['attributes'],function(_0x2eeb0b){var _0x3e3f48={};_0x3e3f48[_0x2eeb0b]={'$like':'%'+_0x54fa49[_0xd4f0('0x3a')][_0xd4f0('0x46')]+'%'};return _0x3e3f48;})});}_0xdc707a=_['merge']({},_0xdc707a,_0x54fa49[_0xd4f0('0x48')]);return db[_0xd4f0('0x64')][_0xd4f0('0x20')]({'where':_0xdc707a[_0xd4f0('0x43')]})[_0xd4f0('0x26')](function(_0x3e3867){_0x597600[_0xd4f0('0x20')]=_0x3e3867;if(_0x54fa49['query'][_0xd4f0('0x4f')]){_0xdc707a[_0xd4f0('0x49')]=[{'all':!![]}];}return db[_0xd4f0('0x64')][_0xd4f0('0x4a')](_0xdc707a);})[_0xd4f0('0x26')](function(_0x3fdf45){_0x597600[_0xd4f0('0x4b')]=_0x3fdf45;return _0x597600;});}})[_0xd4f0('0x26')](respondWithFilteredResult(_0x9c764f,_0xdc707a))[_0xd4f0('0x50')](handleError(_0x9c764f,null));};exports['getHopperBlacks']=function(_0x3d25a8,_0x4ee21e,_0x989814){var _0x1aa8ac={'raw':!![],'where':{}};var _0x15b2cb={};var _0x124e66={'count':0x0,'rows':[]};return db[_0xd4f0('0x38')][_0xd4f0('0x5e')]({'where':{'id':_0x3d25a8[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x4ee21e,null))[_0xd4f0('0x26')](function(_0x3438ab){if(_0x3438ab){_0x15b2cb[_0xd4f0('0x39')]=_[_0xd4f0('0x3b')](db[_0xd4f0('0x65')]['rawAttributes']);_0x15b2cb[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x3d25a8['query']);_0x15b2cb[_0xd4f0('0x44')]=_['intersection'](_0x15b2cb[_0xd4f0('0x39')],_0x15b2cb['query']);_0x1aa8ac['attributes']=_['intersection'](_0x15b2cb[_0xd4f0('0x39')],qs['fields'](_0x3d25a8[_0xd4f0('0x3a')]['fields']));_0x1aa8ac['attributes']=_0x1aa8ac['attributes']['length']?_0x1aa8ac['attributes']:_0x15b2cb[_0xd4f0('0x39')];if(!_0x3d25a8[_0xd4f0('0x3a')][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0x1aa8ac[_0xd4f0('0x1f')]=qs[_0xd4f0('0x1f')](_0x3d25a8[_0xd4f0('0x3a')][_0xd4f0('0x1f')]);_0x1aa8ac[_0xd4f0('0x1d')]=qs[_0xd4f0('0x1d')](_0x3d25a8['query'][_0xd4f0('0x1d')]);}_0x1aa8ac[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x3d25a8[_0xd4f0('0x3a')][_0xd4f0('0x42')]);_0x1aa8ac[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_['pick'](_0x3d25a8['query'],_0x15b2cb['filters']));_0x1aa8ac[_0xd4f0('0x43')]['VoiceQueueId']=_0x3438ab['id'];if(_0x3d25a8[_0xd4f0('0x3a')][_0xd4f0('0x46')]){_0x1aa8ac[_0xd4f0('0x43')]=_['merge'](_0x1aa8ac[_0xd4f0('0x43')],{'$or':_[_0xd4f0('0x2e')](_0x1aa8ac[_0xd4f0('0x3e')],function(_0x26769b){var _0x226ea1={};_0x226ea1[_0x26769b]={'$like':'%'+_0x3d25a8[_0xd4f0('0x3a')]['filter']+'%'};return _0x226ea1;})});}_0x1aa8ac=_['merge']({},_0x1aa8ac,_0x3d25a8['options']);return db[_0xd4f0('0x65')][_0xd4f0('0x20')]({'where':_0x1aa8ac[_0xd4f0('0x43')]})['then'](function(_0x1a7afe){_0x124e66[_0xd4f0('0x20')]=_0x1a7afe;if(_0x3d25a8[_0xd4f0('0x3a')][_0xd4f0('0x4f')]){_0x1aa8ac[_0xd4f0('0x49')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x1aa8ac);})['then'](function(_0x38868c){_0x124e66[_0xd4f0('0x4b')]=_0x38868c;return _0x124e66;});}})[_0xd4f0('0x26')](respondWithFilteredResult(_0x4ee21e,_0x1aa8ac))[_0xd4f0('0x50')](handleError(_0x4ee21e,null));};exports[_0xd4f0('0x66')]=function(_0x3a1ba6,_0x115af2,_0x2bfd00){var _0x326e8b={};var _0x5ae1d2={};var _0x1b6bc0;var _0x790feb;return db[_0xd4f0('0x38')][_0xd4f0('0x5e')]({'where':{'id':_0x3a1ba6[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x115af2,null))[_0xd4f0('0x26')](function(_0x26fe19){if(_0x26fe19){_0x1b6bc0=_0x26fe19;_0x5ae1d2['model']=_[_0xd4f0('0x3b')](db[_0xd4f0('0x67')][_0xd4f0('0x4e')]);_0x5ae1d2[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x3a1ba6[_0xd4f0('0x3a')]);_0x5ae1d2[_0xd4f0('0x44')]=_['intersection'](_0x5ae1d2['model'],_0x5ae1d2['query']);_0x326e8b['attributes']=_[_0xd4f0('0x3c')](_0x5ae1d2['model'],qs[_0xd4f0('0x3d')](_0x3a1ba6[_0xd4f0('0x3a')]['fields']));_0x326e8b[_0xd4f0('0x3e')]=_0x326e8b[_0xd4f0('0x3e')][_0xd4f0('0x3f')]?_0x326e8b[_0xd4f0('0x3e')]:_0x5ae1d2[_0xd4f0('0x39')];_0x326e8b[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x3a1ba6[_0xd4f0('0x3a')]['sort']);_0x326e8b[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x3a1ba6['query'],_0x5ae1d2[_0xd4f0('0x44')]));if(_0x3a1ba6[_0xd4f0('0x3a')]['filter']){_0x326e8b[_0xd4f0('0x43')]=_[_0xd4f0('0x47')](_0x326e8b['where'],{'$or':_[_0xd4f0('0x2e')](_0x326e8b[_0xd4f0('0x3e')],function(_0x166a6c){var _0x9c4661={};_0x9c4661[_0x166a6c]={'$like':'%'+_0x3a1ba6['query'][_0xd4f0('0x46')]+'%'};return _0x9c4661;})});}_0x326e8b=_[_0xd4f0('0x47')]({},_0x326e8b,_0x3a1ba6[_0xd4f0('0x48')]);return _0x1b6bc0[_0xd4f0('0x66')](_0x326e8b);}})[_0xd4f0('0x26')](function(_0x1b9830){if(_0x1b9830){_0x790feb=_0x1b9830[_0xd4f0('0x3f')];if(!_0x3a1ba6[_0xd4f0('0x3a')]['hasOwnProperty'](_0xd4f0('0x60'))){_0x326e8b[_0xd4f0('0x1f')]=qs[_0xd4f0('0x1f')](_0x3a1ba6[_0xd4f0('0x3a')]['limit']);_0x326e8b['offset']=qs['offset'](_0x3a1ba6[_0xd4f0('0x3a')][_0xd4f0('0x1d')]);}return _0x1b6bc0['getTeams'](_0x326e8b);}})[_0xd4f0('0x26')](function(_0x2ae3e3){if(_0x2ae3e3){return _0x2ae3e3?{'count':_0x790feb,'rows':_0x2ae3e3}:null;}})[_0xd4f0('0x26')](respondWithResult(_0x115af2,null))['catch'](handleError(_0x115af2,null));};exports[_0xd4f0('0x68')]=function(_0x5afbc3,_0x3b5747,_0x28a1e7){var _0x472049=_0x5afbc3[_0xd4f0('0x52')][_0xd4f0('0x69')];var _0x1bc15c=_[_0xd4f0('0x2e')](_0x472049,'id');return db['Team'][_0xd4f0('0x4a')]({'where':{'id':_0x1bc15c},'attributes':['id'],'include':[{'model':db[_0xd4f0('0x6a')],'as':_0xd4f0('0x6b'),'attributes':['id',_0xd4f0('0x32'),_0xd4f0('0x6c'),'voicePause',_0xd4f0('0x6d')],'raw':!![]}]})['then'](function(_0x1e0657){if(_0x1e0657){var _0x26e5af=_['flatMap'](_0x1e0657,function(_0x2820a3){var _0x36a38d=_0x2820a3[_0xd4f0('0x28')]({'plain':!![]});_0x36a38d[_0xd4f0('0x6b')][_0xd4f0('0x6e')](function(_0x451d3b){_0x451d3b[_0xd4f0('0x6f')]=_[_0xd4f0('0x31')](_0x472049,{'id':_0x36a38d['id']})[_0xd4f0('0x6f')];});return _0x36a38d[_0xd4f0('0x6b')];});return db[_0xd4f0('0x38')]['find']({'where':{'id':_0x5afbc3[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](function(_0x58dd8a){return db['sequelize'][_0xd4f0('0x70')](function(_0x35a19b){return _0x58dd8a[_0xd4f0('0x68')](_0x1bc15c,{'transaction':_0x35a19b})[_0xd4f0('0x26')](function(){return BPromise[_0xd4f0('0x71')](_0x472049,function(_0x7ebea1){return db[_0xd4f0('0x72')][_0xd4f0('0x73')]({'TeamId':_0x7ebea1['id'],'VoiceQueueId':_0x5afbc3[_0xd4f0('0x4d')]['id'],'penalty':_0x7ebea1['penalty']},{'transaction':_0x35a19b});});})['then'](function(){return BPromise[_0xd4f0('0x71')](_0x26e5af,function(_0x4d91b6){return db[_0xd4f0('0x74')][_0xd4f0('0x75')]({'where':{'UserId':_0x4d91b6['id'],'VoiceQueueId':_0x5afbc3[_0xd4f0('0x4d')]['id']},'defaults':{'penalty':_0x4d91b6[_0xd4f0('0x6f')]},'transaction':_0x35a19b});});})[_0xd4f0('0x26')](function(){return BPromise[_0xd4f0('0x71')](_[_0xd4f0('0x46')](_0x26e5af,{'online':!![]}),function(_0x218358){return db[_0xd4f0('0x76')]['upsert']({'membername':_0x218358[_0xd4f0('0x32')],'UserId':_0x218358['id'],'queue_name':_0x58dd8a[_0xd4f0('0x32')],'VoiceQueueId':_0x58dd8a['id'],'interface':_['isNil'](_0x218358[_0xd4f0('0x6d')])?util[_0xd4f0('0x77')]('SIP/%s',_0x218358['name']):_0x218358[_0xd4f0('0x6d')],'paused':_0x218358[_0xd4f0('0x78')]||![],'penalty':_0x218358[_0xd4f0('0x6f')]},{'transaction':_0x35a19b});});})[_0xd4f0('0x26')](function(){_0x26e5af[_0xd4f0('0x6e')](function(_0x321fd5){socket[_0xd4f0('0x79')](_0xd4f0('0x7a'),{'UserId':_0x321fd5['id'],'VoiceQueueId':_0x58dd8a['id']});});});});});}})[_0xd4f0('0x26')](respondWithStatusCode(_0x3b5747,null))[_0xd4f0('0x50')](handleError(_0x3b5747,null));};exports[_0xd4f0('0x7b')]=function(_0x28573e,_0x1f086a,_0xd08210){return db[_0xd4f0('0x67')][_0xd4f0('0x4a')]({'where':{'id':_0x28573e[_0xd4f0('0x3a')][_0xd4f0('0x7c')]},'attributes':['id'],'include':[{'model':db[_0xd4f0('0x6a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1f086a,null))[_0xd4f0('0x26')](function(_0x21cd76){var _0x23d7e6=_['map'](_0x21cd76,'id');var _0x570c58=[];var _0x52aff5=[];var _0x381d18=squel[_0xd4f0('0x7d')]();_0x381d18[_0xd4f0('0x7e')](_0xd4f0('0x7f'))[_0xd4f0('0x80')](_0xd4f0('0x81'),'tq')[_0xd4f0('0x82')](_0xd4f0('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd4f0('0x84'),_0x28573e['params']['id']);for(var _0x484cd4=0x0;_0x484cd4<_0x21cd76['length'];_0x484cd4+=0x1){let _0x300161=_0x21cd76[_0x484cd4];for(var _0x568184=0x0;_0x568184<_0x300161[_0xd4f0('0x6b')][_0xd4f0('0x3f')];_0x568184+=0x1){let _0x444e5b=_0x300161[_0xd4f0('0x6b')][_0x568184];var _0x103072=_0x381d18[_0xd4f0('0x58')]();_0x103072[_0xd4f0('0x43')](_0xd4f0('0x85'),_0x444e5b['id']);_0x52aff5['push'](db[_0xd4f0('0x86')]['query'](_0x103072[_0xd4f0('0x87')](),{'type':db['sequelize'][_0xd4f0('0x88')][_0xd4f0('0x89')]})[_0xd4f0('0x26')](function(_0x166ce7){if(_0x166ce7['length']===0x1){return _0x444e5b['id'];}else{var _0x284074=_[_0xd4f0('0x8a')](_[_0xd4f0('0x2e')](_0x166ce7,_0xd4f0('0x8b')),function(_0x4fd6f2){return _[_0xd4f0('0x8c')](_0x23d7e6,_0x4fd6f2);});if(_0x284074){return _0x444e5b['id'];}}}));}}return BPromise['all'](_0x52aff5)[_0xd4f0('0x26')](function(_0x720eb){_0x570c58=_(_0x570c58)['union'](_0x720eb)[_0xd4f0('0x8d')]()['value']();return db['VoiceQueue'][_0xd4f0('0x31')]({'where':{'id':_0x28573e[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](function(_0x4adfd6){return db[_0xd4f0('0x86')]['transaction'](function(_0x390f9f){return _0x4adfd6['removeTeams'](_0x28573e[_0xd4f0('0x3a')][_0xd4f0('0x7c')],{'transaction':_0x390f9f})[_0xd4f0('0x26')](function(){if(!_[_0xd4f0('0x8e')](_0x570c58)){return _0x4adfd6['removeAgents'](_0x570c58,{'transaction':_0x390f9f})[_0xd4f0('0x26')](function(){return db[_0xd4f0('0x76')]['destroy']({'where':{'VoiceQueueId':_0x28573e[_0xd4f0('0x4d')]['id'],'UserId':_0x570c58},'transaction':_0x390f9f});});}})[_0xd4f0('0x26')](function(){_0x570c58[_0xd4f0('0x6e')](function(_0x1bd639){socket[_0xd4f0('0x79')](_0xd4f0('0x8f'),{'UserId':_0x1bd639,'VoiceQueueId':_0x4adfd6['id']});});});});});});})['then'](respondWithStatusCode(_0x1f086a,null))[_0xd4f0('0x50')](handleError(_0x1f086a,null));};exports[_0xd4f0('0x90')]=function(_0x6b590,_0x39c3f1,_0x40cb2d){var _0x530ba9,_0x4eb44e;return db[_0xd4f0('0x38')]['find']({'where':{'id':_0x6b590[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x39c3f1,null))['then'](function(_0x4a4577){if(_0x4a4577){_0x4eb44e=_0x4a4577;return _0x4a4577[_0xd4f0('0x90')](_0x6b590[_0xd4f0('0x52')][_0xd4f0('0x7c')],_[_0xd4f0('0x5b')](_0x6b590[_0xd4f0('0x52')],['ids','id'])||{})[_0xd4f0('0x91')](function(_0x4ce9dc){for(var _0x305447=0x0;_0x305447<_0x6b590[_0xd4f0('0x52')][_0xd4f0('0x7c')][_0xd4f0('0x3f')];_0x305447+=0x1){socket[_0xd4f0('0x79')]('userVoiceQueue:save',{'UserId':Number(_0x6b590[_0xd4f0('0x52')][_0xd4f0('0x7c')][_0x305447]),'VoiceQueueId':Number(_0x6b590[_0xd4f0('0x4d')]['id'])});}return _0x4ce9dc;});}})[_0xd4f0('0x26')](function(_0xb8dacb){_0x530ba9=_0xb8dacb||[];if(_0x4eb44e){return db[_0xd4f0('0x6a')][_0xd4f0('0x4a')]({'where':{'id':_0x6b590['body']['ids']},'attributes':['id',_0xd4f0('0x32'),_0xd4f0('0x6c'),_0xd4f0('0x78'),'interface'],'raw':!![]});}})[_0xd4f0('0x26')](function(_0x4e11bc){if(!_['isEmpty'](_0x4e11bc)){var _0x3ca649=[];for(var _0x2a5be5=0x0;_0x2a5be5<_0x4e11bc['length'];_0x2a5be5++){if(_0x4e11bc[_0x2a5be5][_0xd4f0('0x6c')]){_0x3ca649[_0xd4f0('0x92')](db[_0xd4f0('0x76')][_0xd4f0('0x73')]({'membername':_0x4e11bc[_0x2a5be5][_0xd4f0('0x32')],'UserId':_0x4e11bc[_0x2a5be5]['id'],'queue_name':_0x4eb44e[_0xd4f0('0x32')],'VoiceQueueId':_0x4eb44e['id'],'interface':_[_0xd4f0('0x93')](_0x4e11bc[_0x2a5be5]['interface'])?util['format'](_0xd4f0('0x94'),_0x4e11bc[_0x2a5be5]['name']):_0x4e11bc[_0x2a5be5]['interface'],'paused':_0x4e11bc[_0x2a5be5][_0xd4f0('0x78')]||![],'penalty':_0x6b590['body'][_0xd4f0('0x6f')]||0x0}));}}return BPromise[_0xd4f0('0x95')](_0x3ca649);}})[_0xd4f0('0x26')](function(){return _0x530ba9;})[_0xd4f0('0x26')](respondWithResult(_0x39c3f1,null))['catch'](handleError(_0x39c3f1,null));};exports['removeAgents']=function(_0x3d7426,_0x3b4987,_0x11f6ae){return db[_0xd4f0('0x38')][_0xd4f0('0x31')]({'where':{'id':_0x3d7426[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x3b4987,null))['then'](function(_0x28aca6){if(_0x28aca6){return _0x28aca6[_0xd4f0('0x96')](_0x3d7426[_0xd4f0('0x3a')]['ids'])[_0xd4f0('0x26')](function(){if(_[_0xd4f0('0x97')](_0x3d7426['query'][_0xd4f0('0x7c')])){for(var _0x21c2d4=0x0;_0x21c2d4<_0x3d7426[_0xd4f0('0x3a')]['ids']['length'];_0x21c2d4+=0x1){socket[_0xd4f0('0x79')](_0xd4f0('0x8f'),{'UserId':Number(_0x3d7426[_0xd4f0('0x3a')][_0xd4f0('0x7c')][_0x21c2d4]),'VoiceQueueId':Number(_0x3d7426['params']['id'])});}}else{socket[_0xd4f0('0x79')](_0xd4f0('0x8f'),{'UserId':Number(_0x3d7426[_0xd4f0('0x3a')][_0xd4f0('0x7c')]),'VoiceQueueId':Number(_0x3d7426[_0xd4f0('0x4d')]['id'])});}});}})[_0xd4f0('0x26')](function(_0x1d8760){return db[_0xd4f0('0x76')][_0xd4f0('0x27')]({'where':{'VoiceQueueId':_0x3d7426[_0xd4f0('0x4d')]['id'],'UserId':_0x3d7426[_0xd4f0('0x3a')][_0xd4f0('0x7c')]}})[_0xd4f0('0x26')](function(){return _0x1d8760;});})[_0xd4f0('0x26')](respondWithStatusCode(_0x3b4987,null))['catch'](handleError(_0x3b4987,null));};exports[_0xd4f0('0x98')]=function(_0x60b346,_0x329a1b,_0x26b8f8){var _0x247669={};var _0x244bfa={};var _0x356b28;var _0x30bb10;return db[_0xd4f0('0x38')][_0xd4f0('0x5e')]({'where':{'id':_0x60b346[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x329a1b,null))[_0xd4f0('0x26')](function(_0x4e424c){if(_0x4e424c){_0x356b28=_0x4e424c;_0x244bfa[_0xd4f0('0x39')]=_[_0xd4f0('0x3b')](db[_0xd4f0('0x6a')][_0xd4f0('0x4e')]);_0x244bfa['query']=_[_0xd4f0('0x3b')](_0x60b346[_0xd4f0('0x3a')]);_0x244bfa[_0xd4f0('0x44')]=_['intersection'](_0x244bfa[_0xd4f0('0x39')],_0x244bfa[_0xd4f0('0x3a')]);_0x247669['attributes']=_[_0xd4f0('0x3c')](_0x244bfa[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x60b346[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0x247669['attributes']=_0x247669[_0xd4f0('0x3e')][_0xd4f0('0x3f')]?_0x247669[_0xd4f0('0x3e')]:_0x244bfa['model'];_0x247669[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x60b346['query'][_0xd4f0('0x42')]);_0x247669[_0xd4f0('0x43')]=qs['filters'](_['pick'](_0x60b346['query'],_0x244bfa[_0xd4f0('0x44')]));if(_0x60b346[_0xd4f0('0x3a')]['filter']){_0x247669['where']=_[_0xd4f0('0x47')](_0x247669['where'],{'$or':_[_0xd4f0('0x2e')](_0x247669['attributes'],function(_0x1631ca){var _0x2ec0c7={};_0x2ec0c7[_0x1631ca]={'$like':'%'+_0x60b346[_0xd4f0('0x3a')]['filter']+'%'};return _0x2ec0c7;})});}_0x247669=_[_0xd4f0('0x47')]({},_0x247669,_0x60b346[_0xd4f0('0x48')]);return _0x356b28[_0xd4f0('0x98')](_0x247669);}})[_0xd4f0('0x26')](function(_0x395317){if(_0x395317){_0x30bb10=_0x395317[_0xd4f0('0x3f')];if(!_0x60b346['query'][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0x247669[_0xd4f0('0x1f')]=qs[_0xd4f0('0x1f')](_0x60b346[_0xd4f0('0x3a')]['limit']);_0x247669['offset']=qs['offset'](_0x60b346[_0xd4f0('0x3a')][_0xd4f0('0x1d')]);}return _0x356b28[_0xd4f0('0x98')](_0x247669);}})[_0xd4f0('0x26')](function(_0x46167){if(_0x46167){return _0x46167?{'count':_0x30bb10,'rows':_0x46167}:null;}})[_0xd4f0('0x26')](respondWithResult(_0x329a1b,null))[_0xd4f0('0x50')](handleError(_0x329a1b,null));};exports[_0xd4f0('0x99')]=function(_0x2b76df,_0x17172d,_0x101f2f){var _0x5de1f2={};var _0x32d11e={};var _0x194e5e;var _0x12574e;return db['VoiceQueue']['findOne']({'where':{'id':_0x2b76df[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x17172d,null))[_0xd4f0('0x26')](function(_0x38867b){if(_0x38867b){_0x194e5e=_0x38867b;_0x32d11e[_0xd4f0('0x39')]=_[_0xd4f0('0x3b')](db[_0xd4f0('0x76')][_0xd4f0('0x4e')]);_0x32d11e[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x2b76df[_0xd4f0('0x3a')]);_0x32d11e[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x32d11e[_0xd4f0('0x39')],_0x32d11e[_0xd4f0('0x3a')]);_0x5de1f2[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x32d11e[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x2b76df[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0x5de1f2[_0xd4f0('0x3e')]=_0x5de1f2[_0xd4f0('0x3e')]['length']?_0x5de1f2[_0xd4f0('0x3e')]:_0x32d11e['model'];_0x5de1f2['order']=qs[_0xd4f0('0x42')](_0x2b76df['query'][_0xd4f0('0x42')]);_0x5de1f2[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x2b76df[_0xd4f0('0x3a')],_0x32d11e['filters']));if(_0x2b76df['query']['filter']){_0x5de1f2[_0xd4f0('0x43')]=_[_0xd4f0('0x47')](_0x5de1f2[_0xd4f0('0x43')],{'$or':_[_0xd4f0('0x2e')](_0x5de1f2[_0xd4f0('0x3e')],function(_0x52eab8){var _0x5c493a={};_0x5c493a[_0x52eab8]={'$like':'%'+_0x2b76df['query'][_0xd4f0('0x46')]+'%'};return _0x5c493a;})});}_0x5de1f2=_[_0xd4f0('0x47')]({},_0x5de1f2,_0x2b76df[_0xd4f0('0x48')]);return _0x194e5e[_0xd4f0('0x99')](_0x5de1f2);}})[_0xd4f0('0x26')](function(_0x1bc264){if(_0x1bc264){_0x12574e=_0x1bc264['length'];if(!_0x2b76df['query'][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0x5de1f2['limit']=qs['limit'](_0x2b76df[_0xd4f0('0x3a')][_0xd4f0('0x1f')]);_0x5de1f2[_0xd4f0('0x1d')]=qs['offset'](_0x2b76df['query'][_0xd4f0('0x1d')]);}return _0x194e5e[_0xd4f0('0x99')](_0x5de1f2);}})['then'](function(_0x45fcf9){return _0x45fcf9?{'count':_0x12574e,'rows':_0x45fcf9}:null;})[_0xd4f0('0x26')](respondWithResult(_0x17172d,null))[_0xd4f0('0x50')](handleError(_0x17172d,null));};exports[_0xd4f0('0x9a')]=function(_0x27fea8,_0x56de6d,_0xa817ea){var _0x49f66f={};var _0x16dc93={};var _0x26a1fa;var _0x3504ae;return db[_0xd4f0('0x38')][_0xd4f0('0x5e')]({'where':{'id':_0x27fea8[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x56de6d,null))[_0xd4f0('0x26')](function(_0x1e2c57){if(_0x1e2c57){_0x26a1fa=_0x1e2c57;_0x16dc93[_0xd4f0('0x39')]=_['keys'](db[_0xd4f0('0x9b')][_0xd4f0('0x4e')]);_0x16dc93['query']=_[_0xd4f0('0x3b')](_0x27fea8[_0xd4f0('0x3a')]);_0x16dc93[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x16dc93[_0xd4f0('0x39')],_0x16dc93[_0xd4f0('0x3a')]);_0x49f66f[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x16dc93[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x27fea8[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0x49f66f[_0xd4f0('0x3e')]=_0x49f66f['attributes'][_0xd4f0('0x3f')]?_0x49f66f[_0xd4f0('0x3e')]:_0x16dc93[_0xd4f0('0x39')];_0x49f66f[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x27fea8[_0xd4f0('0x3a')]['sort']);_0x49f66f[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x27fea8[_0xd4f0('0x3a')],_0x16dc93[_0xd4f0('0x44')]));if(_0x27fea8[_0xd4f0('0x3a')][_0xd4f0('0x46')]){_0x49f66f[_0xd4f0('0x43')]=_[_0xd4f0('0x47')](_0x49f66f[_0xd4f0('0x43')],{'$or':_[_0xd4f0('0x2e')](_0x49f66f[_0xd4f0('0x3e')],function(_0x2455e3){var _0x2c72c0={};_0x2c72c0[_0x2455e3]={'$like':'%'+_0x27fea8['query'][_0xd4f0('0x46')]+'%'};return _0x2c72c0;})});}_0x49f66f=_[_0xd4f0('0x47')]({},_0x49f66f,_0x27fea8[_0xd4f0('0x48')]);return _0x26a1fa[_0xd4f0('0x9a')](_0x49f66f);}})[_0xd4f0('0x26')](function(_0xc2a673){if(_0xc2a673){_0x3504ae=_0xc2a673['length'];if(!_0x27fea8[_0xd4f0('0x3a')][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0x49f66f[_0xd4f0('0x1f')]=qs[_0xd4f0('0x1f')](_0x27fea8['query'][_0xd4f0('0x1f')]);_0x49f66f[_0xd4f0('0x1d')]=qs[_0xd4f0('0x1d')](_0x27fea8['query']['offset']);}return _0x26a1fa[_0xd4f0('0x9a')](_0x49f66f);}})[_0xd4f0('0x26')](function(_0x2324e1){if(_0x2324e1){return _0x2324e1?{'count':_0x3504ae,'rows':_0x2324e1}:null;}})[_0xd4f0('0x26')](respondWithResult(_0x56de6d,null))[_0xd4f0('0x50')](handleError(_0x56de6d,null));};exports[_0xd4f0('0x9c')]=function(_0xecdb75,_0x49243f,_0x3b6ac4){var _0x441468=moment()[_0xd4f0('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x40ee0,_0x3d64d1;return db[_0xd4f0('0x38')]['find']({'where':{'id':_0xecdb75[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x49243f,null))[_0xd4f0('0x26')](function(_0x3858dd){if(_0x3858dd){_0x3d64d1=_0x3858dd;return _0x3858dd[_0xd4f0('0x9c')](_0xecdb75[_0xd4f0('0x52')][_0xd4f0('0x7c')],_[_0xd4f0('0x5b')](_0xecdb75[_0xd4f0('0x52')],[_0xd4f0('0x7c'),'id'])||{});}return null;})[_0xd4f0('0x91')](function(_0x274f99){var _0xe72e2c;_0x40ee0=_0x274f99||[];var _0x3e0aff=[];if(_0x274f99){for(var _0x12dfe3=0x0;_0x12dfe3<_0x274f99[_0xd4f0('0x3f')];_0x12dfe3+=0x1){var _0x192ae1=_0x274f99[_0x12dfe3][_0xd4f0('0x28')]({'plain':!![]});_0x3d64d1[_0xd4f0('0x9d')]=_0xecdb75['body']['dialCheckDuplicateType']?_0xecdb75[_0xd4f0('0x52')][_0xd4f0('0x9d')]:_0x3d64d1[_0xd4f0('0x9d')];switch(_0x3d64d1['dialCheckDuplicateType']){case _0xd4f0('0x9e'):_0xe72e2c=squel[_0xd4f0('0x9f')]()[_0xd4f0('0xa0')](_0xd4f0('0xa1'))[_0xd4f0('0xa2')]([_0xd4f0('0xa3'),_0xd4f0('0xa4'),_0xd4f0('0xa5'),_0xd4f0('0xa6'),_0xd4f0('0x63'),_0xd4f0('0x59'),'updatedAt'],squel[_0xd4f0('0x7d')]()[_0xd4f0('0x7e')]('phone',_0xd4f0('0xa3'))[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27','scheduledAt')[_0xd4f0('0x7e')]('id',_0xd4f0('0xa5'))['field'](_0x192ae1[_0xd4f0('0xa7')][_0xd4f0('0x87')](),_0xd4f0('0xa6'))[_0xd4f0('0x7e')](_0xecdb75[_0xd4f0('0x4d')]['id']['toString'](),'VoiceQueueId')[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27',_0xd4f0('0x59'))[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27','updatedAt')[_0xd4f0('0x80')](_0xd4f0('0xa8'))['where']('deletedAt\x20IS\x20NULL')[_0xd4f0('0x43')](_0xd4f0('0xa9'),_0x192ae1[_0xd4f0('0xa7')][_0xd4f0('0x87')]())[_0xd4f0('0x43')](_0xd4f0('0xaa'))[_0xd4f0('0x43')](_0xd4f0('0xab'),squel[_0xd4f0('0x7d')]()[_0xd4f0('0x7e')](_0xd4f0('0xac'))[_0xd4f0('0x80')](_0xd4f0('0xad'))[_0xd4f0('0x43')](_0xd4f0('0x84'),_0xecdb75[_0xd4f0('0x4d')]['id'][_0xd4f0('0x87')]()))[_0xd4f0('0x43')](_0xd4f0('0xab'),squel[_0xd4f0('0x7d')]()[_0xd4f0('0x7e')]('COALESCE(phone,\x27\x27)')[_0xd4f0('0x80')](_0xd4f0('0xa1'))['where'](_0xd4f0('0x84'),_0xecdb75[_0xd4f0('0x4d')]['id'][_0xd4f0('0x87')]())))[_0xd4f0('0x87')]();break;case _0xd4f0('0xae'):_0xe72e2c=squel[_0xd4f0('0x9f')]()[_0xd4f0('0xa0')]('cm_hopper')[_0xd4f0('0xa2')]([_0xd4f0('0xa3'),_0xd4f0('0xa4'),'ContactId','ListId',_0xd4f0('0x63'),_0xd4f0('0x59'),_0xd4f0('0x5a')],squel[_0xd4f0('0x7d')]()['field']('phone',_0xd4f0('0xa3'))['field']('\x27'+_0x441468+'\x27',_0xd4f0('0xa4'))[_0xd4f0('0x7e')]('id','ContactId')[_0xd4f0('0x7e')](_0x192ae1[_0xd4f0('0xa7')][_0xd4f0('0x87')](),_0xd4f0('0xa6'))[_0xd4f0('0x7e')](_0xecdb75[_0xd4f0('0x4d')]['id'][_0xd4f0('0x87')](),_0xd4f0('0x63'))[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27',_0xd4f0('0x59'))[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27',_0xd4f0('0x5a'))['from'](_0xd4f0('0xa8'))['where'](_0xd4f0('0xaf'))['where']('ListId\x20=\x20?',_0x192ae1[_0xd4f0('0xa7')]['toString']())[_0xd4f0('0x43')](_0xd4f0('0xaa'))[_0xd4f0('0x43')](_0xd4f0('0xab'),squel[_0xd4f0('0x7d')]()[_0xd4f0('0x7e')]('COALESCE(phone,\x27\x27)')['from'](_0xd4f0('0xa1'))[_0xd4f0('0x43')](_0xd4f0('0x84'),_0xecdb75[_0xd4f0('0x4d')]['id'][_0xd4f0('0x87')]())))[_0xd4f0('0x87')]();break;default:_0xe72e2c=squel[_0xd4f0('0x9f')]()[_0xd4f0('0xa0')](_0xd4f0('0xa1'))[_0xd4f0('0xa2')]([_0xd4f0('0xa3'),_0xd4f0('0xa4'),_0xd4f0('0xa5'),'ListId',_0xd4f0('0x63'),_0xd4f0('0x59'),_0xd4f0('0x5a')],squel['select']()[_0xd4f0('0x7e')]('phone',_0xd4f0('0xa3'))['field']('\x27'+_0x441468+'\x27',_0xd4f0('0xa4'))['field']('id',_0xd4f0('0xa5'))['field'](_0x192ae1['CmListId'][_0xd4f0('0x87')](),'ListId')[_0xd4f0('0x7e')](_0xecdb75[_0xd4f0('0x4d')]['id']['toString'](),_0xd4f0('0x63'))[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27',_0xd4f0('0x59'))['field']('\x27'+_0x441468+'\x27',_0xd4f0('0x5a'))[_0xd4f0('0x80')]('cm_contacts')[_0xd4f0('0x43')]('deletedAt\x20IS\x20NULL')[_0xd4f0('0x43')](_0xd4f0('0xa9'),_0x192ae1[_0xd4f0('0xa7')][_0xd4f0('0x87')]())[_0xd4f0('0x43')](_0xd4f0('0xaa')))[_0xd4f0('0x87')]();}_0x3e0aff[_0xd4f0('0x92')](db[_0xd4f0('0x86')]['query'](_0xe72e2c));}return BPromise[_0xd4f0('0x95')](_0x3e0aff);}})[_0xd4f0('0x26')](function(){var _0x2d0bee=[];var _0xc317e7=squel[_0xd4f0('0x9f')]()[_0xd4f0('0xa0')](_0xd4f0('0xb0'))['fromQuery']([_0xd4f0('0xb1'),_0xd4f0('0xa3'),_0xd4f0('0xb2'),_0xd4f0('0x59'),_0xd4f0('0x5a')],squel[_0xd4f0('0x7d')]()[_0xd4f0('0x7e')](_0xd4f0('0xb3'))[_0xd4f0('0x7e')](_0xd4f0('0xb4'))[_0xd4f0('0x7e')]('ci.OrderBy+1')['field']('\x27'+_0x441468+'\x27',_0xd4f0('0x59'))[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27',_0xd4f0('0x5a'))['from']('cm_contact_has_items','ci')[_0xd4f0('0x82')](_0xd4f0('0xa1'),'h',_0xd4f0('0xb5'))[_0xd4f0('0x43')]('h.scheduledat=?',_0x441468)[_0xd4f0('0x43')](_0xd4f0('0xb6'),'PHONE'))['toString']();_0x2d0bee[_0xd4f0('0x92')](db[_0xd4f0('0x86')][_0xd4f0('0x3a')](_0xc317e7));return BPromise[_0xd4f0('0x95')](_0x2d0bee);})[_0xd4f0('0x26')](function(){return _0x40ee0;})[_0xd4f0('0x26')](respondWithResult(_0x49243f,null))[_0xd4f0('0x50')](handleError(_0x49243f,null));};exports[_0xd4f0('0xb7')]=function(_0x555d5a,_0x23f986,_0x2d3a79){return db['VoiceQueue'][_0xd4f0('0x31')]({'where':{'id':_0x555d5a[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x23f986,null))[_0xd4f0('0x26')](function(_0x51c8fc){if(_0x51c8fc){return _0x51c8fc[_0xd4f0('0xb7')](_0x555d5a[_0xd4f0('0x3a')][_0xd4f0('0x7c')]);}})[_0xd4f0('0x26')](function(_0x6d89a2){if(_0x6d89a2){return db[_0xd4f0('0x5f')][_0xd4f0('0x27')]({'where':{'ListId':_0x555d5a[_0xd4f0('0x3a')][_0xd4f0('0x7c')],'VoiceQueueId':_0x555d5a[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](function(){return _0x6d89a2;});}})['then'](respondWithStatusCode(_0x23f986,null))[_0xd4f0('0x50')](handleError(_0x23f986,null));};exports[_0xd4f0('0xb8')]=function(_0x1c91a7,_0x3a3e47,_0x43c99d){var _0xbd4e9f={};var _0x373fb9={};var _0x12d67b;var _0x4ea804;return db['VoiceQueue'][_0xd4f0('0x5e')]({'where':{'id':_0x1c91a7[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x3a3e47,null))[_0xd4f0('0x26')](function(_0xafcbc5){if(_0xafcbc5){_0x12d67b=_0xafcbc5;_0x373fb9[_0xd4f0('0x39')]=_[_0xd4f0('0x3b')](db[_0xd4f0('0x9b')][_0xd4f0('0x4e')]);_0x373fb9[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x1c91a7[_0xd4f0('0x3a')]);_0x373fb9[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x373fb9[_0xd4f0('0x39')],_0x373fb9[_0xd4f0('0x3a')]);_0xbd4e9f[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x373fb9[_0xd4f0('0x39')],qs['fields'](_0x1c91a7[_0xd4f0('0x3a')]['fields']));_0xbd4e9f[_0xd4f0('0x3e')]=_0xbd4e9f['attributes'][_0xd4f0('0x3f')]?_0xbd4e9f[_0xd4f0('0x3e')]:_0x373fb9['model'];_0xbd4e9f[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x1c91a7['query']['sort']);_0xbd4e9f[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x1c91a7['query'],_0x373fb9['filters']));if(_0x1c91a7[_0xd4f0('0x3a')][_0xd4f0('0x46')]){_0xbd4e9f[_0xd4f0('0x43')]=_[_0xd4f0('0x47')](_0xbd4e9f[_0xd4f0('0x43')],{'$or':_[_0xd4f0('0x2e')](_0xbd4e9f[_0xd4f0('0x3e')],function(_0x16791c){var _0x181c83={};_0x181c83[_0x16791c]={'$like':'%'+_0x1c91a7[_0xd4f0('0x3a')]['filter']+'%'};return _0x181c83;})});}_0xbd4e9f=_[_0xd4f0('0x47')]({},_0xbd4e9f,_0x1c91a7[_0xd4f0('0x48')]);return _0x12d67b[_0xd4f0('0xb8')](_0xbd4e9f);}})['then'](function(_0x3ec838){if(_0x3ec838){_0x4ea804=_0x3ec838['length'];if(!_0x1c91a7['query'][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0xbd4e9f[_0xd4f0('0x1f')]=qs['limit'](_0x1c91a7[_0xd4f0('0x3a')]['limit']);_0xbd4e9f[_0xd4f0('0x1d')]=qs[_0xd4f0('0x1d')](_0x1c91a7[_0xd4f0('0x3a')][_0xd4f0('0x1d')]);}return _0x12d67b['getBlackLists'](_0xbd4e9f);}})[_0xd4f0('0x26')](function(_0x421a9a){if(_0x421a9a){return _0x421a9a?{'count':_0x4ea804,'rows':_0x421a9a}:null;}})['then'](respondWithResult(_0x3a3e47,null))[_0xd4f0('0x50')](handleError(_0x3a3e47,null));};exports[_0xd4f0('0xb9')]=function(_0x59bdde,_0x333b7e,_0x34c7d6){var _0x825fb7,_0x17c9b2;return db[_0xd4f0('0x38')][_0xd4f0('0x31')]({'where':{'id':_0x59bdde[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x333b7e,null))[_0xd4f0('0x26')](function(_0x28c006){if(_0x28c006){_0x17c9b2=_0x28c006;return _0x28c006[_0xd4f0('0xb9')](_0x59bdde['body']['ids'],_[_0xd4f0('0x5b')](_0x59bdde[_0xd4f0('0x52')],[_0xd4f0('0x7c'),'id'])||{});}return null;})[_0xd4f0('0x91')](function(_0x3c3a4d){var _0x4957e9;_0x825fb7=_0x3c3a4d||[];var _0x1c5967=[];if(_0x3c3a4d){for(var _0xed80ec=0x0;_0xed80ec<_0x3c3a4d[_0xd4f0('0x3f')];_0xed80ec+=0x1){var _0xbda04b=_0x3c3a4d[_0xed80ec][_0xd4f0('0x28')]({'plain':!![]});_0x4957e9=squel[_0xd4f0('0x9f')]()[_0xd4f0('0xa0')](_0xd4f0('0xba'))[_0xd4f0('0xa2')](['phone','ContactId',_0xd4f0('0xa6'),_0xd4f0('0x63'),_0xd4f0('0x59'),_0xd4f0('0x5a')],squel[_0xd4f0('0x7d')]()[_0xd4f0('0x7e')]('phone',_0xd4f0('0xa3'))[_0xd4f0('0x7e')]('id',_0xd4f0('0xa5'))[_0xd4f0('0x7e')](_0xbda04b[_0xd4f0('0xa7')][_0xd4f0('0x87')](),_0xd4f0('0xa6'))[_0xd4f0('0x7e')](_0x59bdde[_0xd4f0('0x4d')]['id']['toString'](),_0xd4f0('0x63'))['field']('NOW()','createdAt')['field'](_0xd4f0('0xbb'),_0xd4f0('0x5a'))[_0xd4f0('0x80')](_0xd4f0('0xa8'))[_0xd4f0('0x43')](_0xd4f0('0xaf'))['where']('ListId\x20=\x20?',_0xbda04b[_0xd4f0('0xa7')][_0xd4f0('0x87')]())[_0xd4f0('0x43')](_0xd4f0('0xaa')))[_0xd4f0('0x87')]();_0x1c5967['push'](db['sequelize'][_0xd4f0('0x3a')](_0x4957e9));}return BPromise[_0xd4f0('0x95')](_0x1c5967);}})['then'](function(){return _0x825fb7;})[_0xd4f0('0x26')](respondWithResult(_0x333b7e,null))['catch'](handleError(_0x333b7e,null));};exports[_0xd4f0('0xbc')]=function(_0xa503e7,_0x3eea40,_0x3a4009){return db[_0xd4f0('0x38')][_0xd4f0('0x31')]({'where':{'id':_0xa503e7[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x3eea40,null))['then'](function(_0x5ad970){if(_0x5ad970){return _0x5ad970['removeBlackLists'](_0xa503e7['query'][_0xd4f0('0x7c')]);}})['then'](function(_0x41248a){if(_0x41248a){return db['CmHopperBlack'][_0xd4f0('0x27')]({'where':{'ListId':_0xa503e7[_0xd4f0('0x3a')][_0xd4f0('0x7c')],'VoiceQueueId':_0xa503e7[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](function(){return _0x41248a;});}})[_0xd4f0('0x26')](respondWithStatusCode(_0x3eea40,null))[_0xd4f0('0x50')](handleError(_0x3eea40,null));}; \ No newline at end of file +var _0x5fab=['./voiceQueue.socket','register','end','offset','undefined','limit','count','status','set','json','reject','save','update','then','destroy','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','sendStatus','error','send','index','VoiceQueue','fieldName','model','keys','query','filters','intersection','attributes','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','autoAssociation','CmHopper','hasOwnProperty','nolimit','getHopperHistories','findOne','CmHopperHistory','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','transaction','ids','removeAgents','userVoiceQueue:remove','addAgents','isEmpty','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter'];(function(_0x12f527,_0x46c69c){var _0x1bf550=function(_0x5aaf63){while(--_0x5aaf63){_0x12f527['push'](_0x12f527['shift']());}};_0x1bf550(++_0x46c69c);}(_0x5fab,0x177));var _0xb5fa=function(_0x411172,_0x5f3b53){_0x411172=_0x411172-0x0;var _0x489979=_0x5fab[_0x411172];return _0x489979;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];config['redis']=_[_0xb5fa('0x1a')](config[_0xb5fa('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xb5fa('0x1c'))(new Redis(config['redis']));require(_0xb5fa('0x1d'))[_0xb5fa('0x1e')](socket);function respondWithStatusCode(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xcc;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['sendStatus'](_0xca8d82);}return _0x40c914['status'](_0xca8d82)[_0xb5fa('0x1f')]();};}function respondWithResult(_0x587043,_0x31f252){_0x31f252=_0x31f252||0xc8;return function(_0x27c8f7){if(_0x27c8f7){return _0x587043['status'](_0x31f252)['json'](_0x27c8f7);}};}function respondWithFilteredResult(_0x451a55,_0x1f7f05){return function(_0x32e9e5){if(_0x32e9e5){var _0x46eef0=typeof _0x1f7f05[_0xb5fa('0x20')]===_0xb5fa('0x21')&&typeof _0x1f7f05[_0xb5fa('0x22')]===_0xb5fa('0x21');var _0xc14dc4=_0x32e9e5[_0xb5fa('0x23')];var _0x3c8d53=_0x46eef0?0x0:_0x1f7f05[_0xb5fa('0x20')];var _0x5cd822=_0x46eef0?_0x32e9e5[_0xb5fa('0x23')]:_0x1f7f05['offset']+_0x1f7f05[_0xb5fa('0x22')];var _0x4a6c04;if(_0x5cd822>=_0xc14dc4){_0x5cd822=_0xc14dc4;_0x4a6c04=0xc8;}else{_0x4a6c04=0xce;}_0x451a55[_0xb5fa('0x24')](_0x4a6c04);return _0x451a55[_0xb5fa('0x25')]('Content-Range',_0x3c8d53+'-'+_0x5cd822+'/'+_0xc14dc4)[_0xb5fa('0x26')](_0x32e9e5);}return null;};}function patchUpdates(_0x3a2ab9){return function(_0x283a56){try{jsonpatch['apply'](_0x283a56,_0x3a2ab9,!![]);}catch(_0x32a85c){return BPromise[_0xb5fa('0x27')](_0x32a85c);}return _0x283a56[_0xb5fa('0x28')]();};}function saveUpdates(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x29')](_0x542348)[_0xb5fa('0x2a')](function(_0x11053a){return _0x11053a;});}return null;};}function removeEntity(_0x543edf,_0x2dbd22){return function(_0x3f61cd){if(_0x3f61cd){return _0x3f61cd[_0xb5fa('0x2b')]()[_0xb5fa('0x2a')](function(){var _0x568870=_0x3f61cd['get']({'plain':!![]});var _0x5bdf11=[{'name':'VoiceQueues','value':_0xb5fa('0x2c'),'ignore':![]},{'name':_0xb5fa('0x2d'),'value':_0xb5fa('0x2e'),'ignore':![]}];var _0x2bdf50=_(_0x5bdf11)[_0xb5fa('0x2f')](_0xb5fa('0x30'))[_0xb5fa('0x31')](_0xb5fa('0x32'))[_0xb5fa('0x32')]();if(_[_0xb5fa('0x33')](_0x2bdf50,_0x568870[_0xb5fa('0x34')])){return;}var _0x259d21=_[_0xb5fa('0x35')](_0x5bdf11,[_0xb5fa('0x32'),_0x568870[_0xb5fa('0x34')]])[_0xb5fa('0x36')];return db[_0xb5fa('0x37')][_0xb5fa('0x2b')]({'where':{'type':_0x259d21,'resourceId':_0x568870['id']}})[_0xb5fa('0x2a')](function(){return _0x3f61cd;});})[_0xb5fa('0x2a')](function(){_0x543edf[_0xb5fa('0x24')](0xcc)[_0xb5fa('0x1f')]();});}};}function handleEntityNotFound(_0x10fb43,_0x25fc7c){return function(_0x4cba5a){if(!_0x4cba5a){_0x10fb43[_0xb5fa('0x38')](0x194);}return _0x4cba5a;};}function handleError(_0x4d056c,_0x5c7fdd){_0x5c7fdd=_0x5c7fdd||0x1f4;return function(_0x558708){logger[_0xb5fa('0x39')](_0x558708['stack']);if(_0x558708[_0xb5fa('0x36')]){delete _0x558708['name'];}_0x4d056c['status'](_0x5c7fdd)[_0xb5fa('0x3a')](_0x558708);};}exports[_0xb5fa('0x3b')]=function(_0x4a4bff,_0x59f41d){var _0x3d73c2={},_0x9cf63d={},_0x252421={'count':0x0,'rows':[]};var _0x560b53=_[_0xb5fa('0x31')](db[_0xb5fa('0x3c')]['rawAttributes'],function(_0x18398f){return{'name':_0x18398f[_0xb5fa('0x3d')],'type':_0x18398f[_0xb5fa('0x34')]['key']};});_0x9cf63d[_0xb5fa('0x3e')]=_[_0xb5fa('0x31')](_0x560b53,_0xb5fa('0x36'));_0x9cf63d['query']=_[_0xb5fa('0x3f')](_0x4a4bff[_0xb5fa('0x40')]);_0x9cf63d[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x9cf63d['model'],_0x9cf63d['query']);_0x3d73c2['attributes']=_['intersection'](_0x9cf63d['model'],qs['fields'](_0x4a4bff[_0xb5fa('0x40')]['fields']));_0x3d73c2[_0xb5fa('0x43')]=_0x3d73c2[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x3d73c2[_0xb5fa('0x43')]:_0x9cf63d[_0xb5fa('0x3e')];if(!_0x4a4bff[_0xb5fa('0x40')]['hasOwnProperty']('nolimit')){_0x3d73c2['limit']=qs[_0xb5fa('0x22')](_0x4a4bff['query'][_0xb5fa('0x22')]);_0x3d73c2['offset']=qs['offset'](_0x4a4bff[_0xb5fa('0x40')][_0xb5fa('0x20')]);}_0x3d73c2[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x4a4bff[_0xb5fa('0x40')][_0xb5fa('0x46')]);_0x3d73c2[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x4a4bff[_0xb5fa('0x40')],_0x9cf63d['filters']),_0x560b53);if(_0x4a4bff[_0xb5fa('0x40')]['filter']){_0x3d73c2[_0xb5fa('0x47')]=_[_0xb5fa('0x49')](_0x3d73c2[_0xb5fa('0x47')],{'$or':_[_0xb5fa('0x31')](_0x560b53,function(_0x1c706b){if(_0x1c706b[_0xb5fa('0x34')]!==_0xb5fa('0x4a')){var _0x10c381={};_0x10c381[_0x1c706b['name']]={'$like':'%'+_0x4a4bff[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0x10c381;}})});}_0x3d73c2=_['merge']({},_0x3d73c2,_0x4a4bff[_0xb5fa('0x4b')]);var _0x5a6ae3={'where':_0x3d73c2[_0xb5fa('0x47')]};return db[_0xb5fa('0x3c')]['count'](_0x5a6ae3)['then'](function(_0x2db269){_0x252421[_0xb5fa('0x23')]=_0x2db269;if(_0x4a4bff[_0xb5fa('0x40')][_0xb5fa('0x4c')]){_0x3d73c2[_0xb5fa('0x4d')]=[{'all':!![]}];}return db[_0xb5fa('0x3c')][_0xb5fa('0x4e')](_0x3d73c2);})[_0xb5fa('0x2a')](function(_0x499d36){_0x252421[_0xb5fa('0x4f')]=_0x499d36;return _0x252421;})[_0xb5fa('0x2a')](respondWithFilteredResult(_0x59f41d,_0x3d73c2))['catch'](handleError(_0x59f41d,null));};exports[_0xb5fa('0x50')]=function(_0x2c378a,_0x247999){var _0x43b056={'raw':![],'where':{'id':_0x2c378a[_0xb5fa('0x51')]['id']}},_0x30d0d4={};_0x30d0d4[_0xb5fa('0x3e')]=_[_0xb5fa('0x3f')](db[_0xb5fa('0x3c')][_0xb5fa('0x52')]);_0x30d0d4[_0xb5fa('0x40')]=_[_0xb5fa('0x3f')](_0x2c378a[_0xb5fa('0x40')]);_0x30d0d4[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x30d0d4[_0xb5fa('0x3e')],_0x30d0d4['query']);_0x43b056['attributes']=_[_0xb5fa('0x42')](_0x30d0d4['model'],qs[_0xb5fa('0x53')](_0x2c378a[_0xb5fa('0x40')]['fields']));_0x43b056[_0xb5fa('0x43')]=_0x43b056[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x43b056[_0xb5fa('0x43')]:_0x30d0d4[_0xb5fa('0x3e')];if(_0x2c378a[_0xb5fa('0x40')]['includeAll']){_0x43b056[_0xb5fa('0x4d')]=[{'all':!![]}];}_0x43b056=_['merge']({},_0x43b056,_0x2c378a[_0xb5fa('0x4b')]);return db[_0xb5fa('0x3c')][_0xb5fa('0x35')](_0x43b056)['then'](handleEntityNotFound(_0x247999,null))[_0xb5fa('0x2a')](respondWithResult(_0x247999,null))[_0xb5fa('0x54')](handleError(_0x247999,null));};exports['create']=function(_0x4f6ffa,_0x3f19ee){return db[_0xb5fa('0x3c')][_0xb5fa('0x55')](_0x4f6ffa[_0xb5fa('0x56')],{})[_0xb5fa('0x2a')](function(_0x7775b4){var _0x31c91f=_0x4f6ffa[_0xb5fa('0x57')][_0xb5fa('0x58')]({'plain':!![]});if(!_0x31c91f)throw new Error(_0xb5fa('0x59'));if(_0x31c91f[_0xb5fa('0x5a')]===_0xb5fa('0x57')){var _0x3ccfd1=_0x7775b4[_0xb5fa('0x58')]({'plain':!![]});var _0x23f235=[{'name':_0xb5fa('0x5b'),'value':_0xb5fa('0x2c')},{'name':_0xb5fa('0x2d'),'value':'outbound'}];var _0x1900a5=_[_0xb5fa('0x35')](_0x23f235,[_0xb5fa('0x32'),_0x3ccfd1[_0xb5fa('0x34')]])[_0xb5fa('0x36')];return db[_0xb5fa('0x5c')][_0xb5fa('0x35')]({'where':{'name':_0x1900a5,'userProfileId':_0x31c91f[_0xb5fa('0x5d')]},'raw':!![]})[_0xb5fa('0x2a')](function(_0x1e0547){if(_0x1e0547&&_0x1e0547['autoAssociation']===0x0){return db['UserProfileResource'][_0xb5fa('0x55')]({'name':_0x3ccfd1[_0xb5fa('0x36')],'resourceId':_0x3ccfd1['id'],'type':_0x1e0547[_0xb5fa('0x36')],'sectionId':_0x1e0547['id']},{})['then'](function(){return _0x7775b4;});}else{return _0x7775b4;}})[_0xb5fa('0x54')](function(_0x367f7a){logger[_0xb5fa('0x39')](_0xb5fa('0x5e'),_0x367f7a);throw _0x367f7a;});}return _0x7775b4;})[_0xb5fa('0x2a')](respondWithResult(_0x3f19ee,0xc9))[_0xb5fa('0x54')](handleError(_0x3f19ee,null));};exports[_0xb5fa('0x5f')]=function(_0x4f82f0,_0x7bcd09){var _0x4611f3={'where':{'id':_0x4f82f0[_0xb5fa('0x51')]['id']}},_0x4afc02={};_0x4afc02[_0xb5fa('0x3e')]=_['keys'](db[_0xb5fa('0x3c')][_0xb5fa('0x52')]);_0x4611f3[_0xb5fa('0x43')]=_[_0xb5fa('0x42')](_0x4afc02[_0xb5fa('0x3e')],qs[_0xb5fa('0x53')](_0x4f82f0[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x4611f3[_0xb5fa('0x43')]=_0x4611f3[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x4611f3[_0xb5fa('0x43')]:_0x4afc02[_0xb5fa('0x3e')];if(_0x4f82f0[_0xb5fa('0x40')][_0xb5fa('0x4c')]){_0x4611f3[_0xb5fa('0x4d')]=[{'all':!![]}];}_0x4611f3=_[_0xb5fa('0x49')]({},_0x4611f3,_0x4f82f0[_0xb5fa('0x4b')]);return db[_0xb5fa('0x3c')][_0xb5fa('0x35')](_0x4611f3)[_0xb5fa('0x2a')](handleEntityNotFound(_0x7bcd09,null))[_0xb5fa('0x2a')](function(_0x488563){if(_0x488563){var _0x41fd9c=_0x488563[_0xb5fa('0x58')]({'plain':!![]});_0x41fd9c=qs[_0xb5fa('0x60')](_0x41fd9c,['id','createdAt',_0xb5fa('0x61')]);_0x4f82f0[_0xb5fa('0x56')]=_['omit'](_0x4f82f0[_0xb5fa('0x56')],['id',_0xb5fa('0x62'),_0xb5fa('0x61')]);return db['VoiceQueue']['create'](_[_0xb5fa('0x49')](_0x41fd9c,_0x4f82f0[_0xb5fa('0x56')]),{'include':_0x4f82f0[_0xb5fa('0x40')]['includeAll']?[{'all':!![]}]:undefined})[_0xb5fa('0x2a')](function(_0x30d53b){var _0x199555=_0x4f82f0[_0xb5fa('0x57')]['get']({'plain':!![]});if(!_0x199555)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x199555['role']===_0xb5fa('0x57')){var _0x28a5f1=_0x30d53b[_0xb5fa('0x58')]({'plain':!![]});var _0x4ce1bd=[{'name':_0xb5fa('0x5b'),'value':_0xb5fa('0x2c')},{'name':_0xb5fa('0x2d'),'value':_0xb5fa('0x2e')}];var _0x2a1872=_[_0xb5fa('0x35')](_0x4ce1bd,[_0xb5fa('0x32'),_0x28a5f1[_0xb5fa('0x34')]])[_0xb5fa('0x36')];return db[_0xb5fa('0x5c')][_0xb5fa('0x35')]({'where':{'name':_0x2a1872,'userProfileId':_0x199555[_0xb5fa('0x5d')]},'raw':!![]})[_0xb5fa('0x2a')](function(_0x38faa6){if(_0x38faa6&&_0x38faa6[_0xb5fa('0x63')]===0x0){return db['UserProfileResource'][_0xb5fa('0x55')]({'name':_0x28a5f1['name'],'resourceId':_0x28a5f1['id'],'type':_0x38faa6[_0xb5fa('0x36')],'sectionId':_0x38faa6['id']},{})[_0xb5fa('0x2a')](function(){return _0x30d53b;});}else{return _0x30d53b;}})[_0xb5fa('0x54')](function(_0x3e90c7){logger[_0xb5fa('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e90c7);throw _0x3e90c7;});}return _0x30d53b;});}})[_0xb5fa('0x2a')](respondWithResult(_0x7bcd09,0xc9))['catch'](handleError(_0x7bcd09,null));};exports[_0xb5fa('0x29')]=function(_0x3ab924,_0x118a0e){if(_0x3ab924[_0xb5fa('0x56')]['id']){delete _0x3ab924['body']['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x3ab924[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x118a0e,null))[_0xb5fa('0x2a')](saveUpdates(_0x3ab924[_0xb5fa('0x56')],null))[_0xb5fa('0x2a')](respondWithResult(_0x118a0e,null))[_0xb5fa('0x54')](handleError(_0x118a0e,null));};exports['destroy']=function(_0x9bf200,_0x5c08e1){return db['VoiceQueue'][_0xb5fa('0x35')]({'where':{'id':_0x9bf200['params']['id']}})['then'](handleEntityNotFound(_0x5c08e1,null))['then'](removeEntity(_0x5c08e1,null))[_0xb5fa('0x54')](handleError(_0x5c08e1,null));};exports['getHoppers']=function(_0x46c973,_0xe8f400,_0x1f05f7){var _0x4e4e2a={'raw':![],'where':{}};var _0x5cac2e={};var _0xb1fcac={'count':0x0,'rows':[]};return db[_0xb5fa('0x3c')]['findOne']({'where':{'id':_0x46c973[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0xe8f400,null))[_0xb5fa('0x2a')](function(_0x2aaa2c){if(_0x2aaa2c){_0x5cac2e['model']=_[_0xb5fa('0x3f')](db[_0xb5fa('0x64')][_0xb5fa('0x52')]);_0x5cac2e[_0xb5fa('0x40')]=_[_0xb5fa('0x3f')](_0x46c973[_0xb5fa('0x40')]);_0x5cac2e[_0xb5fa('0x41')]=_['intersection'](_0x5cac2e[_0xb5fa('0x3e')],_0x5cac2e['query']);_0x4e4e2a[_0xb5fa('0x43')]=_[_0xb5fa('0x42')](_0x5cac2e['model'],qs[_0xb5fa('0x53')](_0x46c973[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x4e4e2a[_0xb5fa('0x43')]=_0x4e4e2a[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x4e4e2a[_0xb5fa('0x43')]:_0x5cac2e[_0xb5fa('0x3e')];if(!_0x46c973['query'][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x4e4e2a[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x46c973['query']['limit']);_0x4e4e2a['offset']=qs['offset'](_0x46c973[_0xb5fa('0x40')][_0xb5fa('0x20')]);}_0x4e4e2a[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x46c973['query']['sort']);_0x4e4e2a[_0xb5fa('0x47')]=qs['filters'](_[_0xb5fa('0x48')](_0x46c973[_0xb5fa('0x40')],_0x5cac2e[_0xb5fa('0x41')]));_0x4e4e2a[_0xb5fa('0x47')]['VoiceQueueId']=_0x2aaa2c['id'];if(_0x46c973[_0xb5fa('0x40')]['filter']){_0x4e4e2a[_0xb5fa('0x47')]=_[_0xb5fa('0x49')](_0x4e4e2a['where'],{'$or':_['map'](_0x4e4e2a[_0xb5fa('0x43')],function(_0x3150ac){var _0x64ab9e={};_0x64ab9e[_0x3150ac]={'$like':'%'+_0x46c973[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0x64ab9e;})});}_0x4e4e2a=_[_0xb5fa('0x49')]({},_0x4e4e2a,_0x46c973[_0xb5fa('0x4b')]);return db[_0xb5fa('0x64')][_0xb5fa('0x23')]({'where':_0x4e4e2a[_0xb5fa('0x47')]})[_0xb5fa('0x2a')](function(_0x2d27c1){_0xb1fcac[_0xb5fa('0x23')]=_0x2d27c1;if(_0x46c973['query']['includeAll']){_0x4e4e2a[_0xb5fa('0x4d')]=[{'all':!![]}];}return db['CmHopper'][_0xb5fa('0x4e')](_0x4e4e2a);})[_0xb5fa('0x2a')](function(_0x502946){_0xb1fcac[_0xb5fa('0x4f')]=_0x502946;return _0xb1fcac;});}})[_0xb5fa('0x2a')](respondWithFilteredResult(_0xe8f400,_0x4e4e2a))['catch'](handleError(_0xe8f400,null));};exports[_0xb5fa('0x67')]=function(_0x3ba1d0,_0x4b9d03,_0x138c60){var _0x3a59ed={'raw':!![],'where':{}};var _0x367593={};var _0x5a358d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb5fa('0x68')]({'where':{'id':_0x3ba1d0[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x4b9d03,null))[_0xb5fa('0x2a')](function(_0x397830){if(_0x397830){_0x367593[_0xb5fa('0x3e')]=_[_0xb5fa('0x3f')](db[_0xb5fa('0x69')][_0xb5fa('0x52')]);_0x367593[_0xb5fa('0x40')]=_['keys'](_0x3ba1d0['query']);_0x367593[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x367593[_0xb5fa('0x3e')],_0x367593[_0xb5fa('0x40')]);_0x3a59ed['attributes']=_[_0xb5fa('0x42')](_0x367593[_0xb5fa('0x3e')],qs[_0xb5fa('0x53')](_0x3ba1d0['query'][_0xb5fa('0x53')]));_0x3a59ed[_0xb5fa('0x43')]=_0x3a59ed[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x3a59ed['attributes']:_0x367593[_0xb5fa('0x3e')];if(!_0x3ba1d0[_0xb5fa('0x40')][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x3a59ed[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x3ba1d0[_0xb5fa('0x40')][_0xb5fa('0x22')]);_0x3a59ed[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x3ba1d0[_0xb5fa('0x40')][_0xb5fa('0x20')]);}_0x3a59ed[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x3ba1d0[_0xb5fa('0x40')]['sort']);_0x3a59ed[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x3ba1d0[_0xb5fa('0x40')],_0x367593[_0xb5fa('0x41')]));_0x3a59ed[_0xb5fa('0x47')][_0xb5fa('0x6a')]=_0x397830['id'];if(_0x3ba1d0[_0xb5fa('0x40')]['filter']){_0x3a59ed['where']=_[_0xb5fa('0x49')](_0x3a59ed['where'],{'$or':_['map'](_0x3a59ed[_0xb5fa('0x43')],function(_0x27dbe8){var _0x2faf23={};_0x2faf23[_0x27dbe8]={'$like':'%'+_0x3ba1d0['query'][_0xb5fa('0x2f')]+'%'};return _0x2faf23;})});}_0x3a59ed=_[_0xb5fa('0x49')]({},_0x3a59ed,_0x3ba1d0[_0xb5fa('0x4b')]);return db['CmHopperHistory'][_0xb5fa('0x23')]({'where':_0x3a59ed[_0xb5fa('0x47')]})['then'](function(_0x27ca06){_0x5a358d[_0xb5fa('0x23')]=_0x27ca06;if(_0x3ba1d0[_0xb5fa('0x40')][_0xb5fa('0x4c')]){_0x3a59ed[_0xb5fa('0x4d')]=[{'all':!![]}];}return db[_0xb5fa('0x69')][_0xb5fa('0x4e')](_0x3a59ed);})['then'](function(_0x2c6212){_0x5a358d[_0xb5fa('0x4f')]=_0x2c6212;return _0x5a358d;});}})[_0xb5fa('0x2a')](respondWithFilteredResult(_0x4b9d03,_0x3a59ed))[_0xb5fa('0x54')](handleError(_0x4b9d03,null));};exports['getHopperFinals']=function(_0x48f335,_0x181ad8,_0x21fa37){var _0x3b1fe2={'raw':!![],'where':{}};var _0x1a889a={};var _0x4eb5a0={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x48f335['params']['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x181ad8,null))[_0xb5fa('0x2a')](function(_0x22144f){if(_0x22144f){_0x1a889a[_0xb5fa('0x3e')]=_[_0xb5fa('0x3f')](db[_0xb5fa('0x6b')][_0xb5fa('0x52')]);_0x1a889a[_0xb5fa('0x40')]=_[_0xb5fa('0x3f')](_0x48f335[_0xb5fa('0x40')]);_0x1a889a[_0xb5fa('0x41')]=_['intersection'](_0x1a889a[_0xb5fa('0x3e')],_0x1a889a[_0xb5fa('0x40')]);_0x3b1fe2['attributes']=_[_0xb5fa('0x42')](_0x1a889a[_0xb5fa('0x3e')],qs['fields'](_0x48f335[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x3b1fe2[_0xb5fa('0x43')]=_0x3b1fe2[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x3b1fe2[_0xb5fa('0x43')]:_0x1a889a[_0xb5fa('0x3e')];if(!_0x48f335[_0xb5fa('0x40')][_0xb5fa('0x65')]('nolimit')){_0x3b1fe2[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x48f335[_0xb5fa('0x40')][_0xb5fa('0x22')]);_0x3b1fe2[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x48f335[_0xb5fa('0x40')][_0xb5fa('0x20')]);}_0x3b1fe2['order']=qs[_0xb5fa('0x46')](_0x48f335['query'][_0xb5fa('0x46')]);_0x3b1fe2[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x48f335[_0xb5fa('0x40')],_0x1a889a[_0xb5fa('0x41')]));_0x3b1fe2[_0xb5fa('0x47')][_0xb5fa('0x6a')]=_0x22144f['id'];if(_0x48f335[_0xb5fa('0x40')]['filter']){_0x3b1fe2['where']=_[_0xb5fa('0x49')](_0x3b1fe2[_0xb5fa('0x47')],{'$or':_[_0xb5fa('0x31')](_0x3b1fe2[_0xb5fa('0x43')],function(_0x5378ce){var _0x161c49={};_0x161c49[_0x5378ce]={'$like':'%'+_0x48f335['query'][_0xb5fa('0x2f')]+'%'};return _0x161c49;})});}_0x3b1fe2=_[_0xb5fa('0x49')]({},_0x3b1fe2,_0x48f335['options']);return db[_0xb5fa('0x6b')]['count']({'where':_0x3b1fe2[_0xb5fa('0x47')]})['then'](function(_0x26718c){_0x4eb5a0[_0xb5fa('0x23')]=_0x26718c;if(_0x48f335[_0xb5fa('0x40')][_0xb5fa('0x4c')]){_0x3b1fe2[_0xb5fa('0x4d')]=[{'all':!![]}];}return db[_0xb5fa('0x6b')][_0xb5fa('0x4e')](_0x3b1fe2);})[_0xb5fa('0x2a')](function(_0x3f5d43){_0x4eb5a0[_0xb5fa('0x4f')]=_0x3f5d43;return _0x4eb5a0;});}})[_0xb5fa('0x2a')](respondWithFilteredResult(_0x181ad8,_0x3b1fe2))['catch'](handleError(_0x181ad8,null));};exports[_0xb5fa('0x6c')]=function(_0x284b34,_0x384c8e,_0x497931){var _0x2145d8={'raw':!![],'where':{}};var _0x2ca7d5={};var _0x1e11bc={'count':0x0,'rows':[]};return db[_0xb5fa('0x3c')][_0xb5fa('0x68')]({'where':{'id':_0x284b34[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x384c8e,null))[_0xb5fa('0x2a')](function(_0x59fd75){if(_0x59fd75){_0x2ca7d5[_0xb5fa('0x3e')]=_['keys'](db[_0xb5fa('0x6d')][_0xb5fa('0x52')]);_0x2ca7d5[_0xb5fa('0x40')]=_[_0xb5fa('0x3f')](_0x284b34[_0xb5fa('0x40')]);_0x2ca7d5[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x2ca7d5[_0xb5fa('0x3e')],_0x2ca7d5[_0xb5fa('0x40')]);_0x2145d8[_0xb5fa('0x43')]=_[_0xb5fa('0x42')](_0x2ca7d5[_0xb5fa('0x3e')],qs[_0xb5fa('0x53')](_0x284b34[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x2145d8[_0xb5fa('0x43')]=_0x2145d8[_0xb5fa('0x43')]['length']?_0x2145d8[_0xb5fa('0x43')]:_0x2ca7d5[_0xb5fa('0x3e')];if(!_0x284b34['query'][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x2145d8['limit']=qs['limit'](_0x284b34['query'][_0xb5fa('0x22')]);_0x2145d8[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x284b34[_0xb5fa('0x40')][_0xb5fa('0x20')]);}_0x2145d8[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x284b34['query']['sort']);_0x2145d8['where']=qs[_0xb5fa('0x41')](_['pick'](_0x284b34['query'],_0x2ca7d5[_0xb5fa('0x41')]));_0x2145d8['where'][_0xb5fa('0x6a')]=_0x59fd75['id'];if(_0x284b34[_0xb5fa('0x40')][_0xb5fa('0x2f')]){_0x2145d8[_0xb5fa('0x47')]=_[_0xb5fa('0x49')](_0x2145d8['where'],{'$or':_[_0xb5fa('0x31')](_0x2145d8[_0xb5fa('0x43')],function(_0x2fe715){var _0x3c5ac4={};_0x3c5ac4[_0x2fe715]={'$like':'%'+_0x284b34[_0xb5fa('0x40')]['filter']+'%'};return _0x3c5ac4;})});}_0x2145d8=_[_0xb5fa('0x49')]({},_0x2145d8,_0x284b34[_0xb5fa('0x4b')]);return db[_0xb5fa('0x6d')][_0xb5fa('0x23')]({'where':_0x2145d8[_0xb5fa('0x47')]})[_0xb5fa('0x2a')](function(_0x502d4d){_0x1e11bc[_0xb5fa('0x23')]=_0x502d4d;if(_0x284b34[_0xb5fa('0x40')][_0xb5fa('0x4c')]){_0x2145d8[_0xb5fa('0x4d')]=[{'all':!![]}];}return db[_0xb5fa('0x6d')][_0xb5fa('0x4e')](_0x2145d8);})[_0xb5fa('0x2a')](function(_0x24cfb3){_0x1e11bc[_0xb5fa('0x4f')]=_0x24cfb3;return _0x1e11bc;});}})[_0xb5fa('0x2a')](respondWithFilteredResult(_0x384c8e,_0x2145d8))[_0xb5fa('0x54')](handleError(_0x384c8e,null));};exports[_0xb5fa('0x6e')]=function(_0x1d307c,_0x3b7625,_0x3347eb){var _0x349e0b={};var _0x11bbec={};var _0xaffb14;var _0x334b3a;return db[_0xb5fa('0x3c')][_0xb5fa('0x68')]({'where':{'id':_0x1d307c[_0xb5fa('0x51')]['id']}})['then'](handleEntityNotFound(_0x3b7625,null))['then'](function(_0x33a62e){if(_0x33a62e){_0xaffb14=_0x33a62e;_0x11bbec[_0xb5fa('0x3e')]=_[_0xb5fa('0x3f')](db[_0xb5fa('0x6f')][_0xb5fa('0x52')]);_0x11bbec[_0xb5fa('0x40')]=_['keys'](_0x1d307c['query']);_0x11bbec['filters']=_[_0xb5fa('0x42')](_0x11bbec[_0xb5fa('0x3e')],_0x11bbec['query']);_0x349e0b[_0xb5fa('0x43')]=_[_0xb5fa('0x42')](_0x11bbec['model'],qs[_0xb5fa('0x53')](_0x1d307c[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x349e0b[_0xb5fa('0x43')]=_0x349e0b[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x349e0b[_0xb5fa('0x43')]:_0x11bbec[_0xb5fa('0x3e')];_0x349e0b['order']=qs[_0xb5fa('0x46')](_0x1d307c['query'][_0xb5fa('0x46')]);_0x349e0b[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x1d307c['query'],_0x11bbec[_0xb5fa('0x41')]));if(_0x1d307c[_0xb5fa('0x40')][_0xb5fa('0x2f')]){_0x349e0b[_0xb5fa('0x47')]=_['merge'](_0x349e0b[_0xb5fa('0x47')],{'$or':_[_0xb5fa('0x31')](_0x349e0b[_0xb5fa('0x43')],function(_0x146f1f){var _0x16221f={};_0x16221f[_0x146f1f]={'$like':'%'+_0x1d307c[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0x16221f;})});}_0x349e0b=_['merge']({},_0x349e0b,_0x1d307c[_0xb5fa('0x4b')]);return _0xaffb14['getTeams'](_0x349e0b);}})[_0xb5fa('0x2a')](function(_0x391414){if(_0x391414){_0x334b3a=_0x391414[_0xb5fa('0x44')];if(!_0x1d307c[_0xb5fa('0x40')][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x349e0b[_0xb5fa('0x22')]=qs['limit'](_0x1d307c['query'][_0xb5fa('0x22')]);_0x349e0b[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x1d307c[_0xb5fa('0x40')][_0xb5fa('0x20')]);}return _0xaffb14[_0xb5fa('0x6e')](_0x349e0b);}})[_0xb5fa('0x2a')](function(_0x35b509){if(_0x35b509){return _0x35b509?{'count':_0x334b3a,'rows':_0x35b509}:null;}})['then'](respondWithResult(_0x3b7625,null))[_0xb5fa('0x54')](handleError(_0x3b7625,null));};exports[_0xb5fa('0x70')]=function(_0x270cda,_0x33b2fa,_0x31449a){var _0x39733a=_0x270cda[_0xb5fa('0x56')][_0xb5fa('0x71')];var _0x330d32=_['map'](_0x39733a,'id');return db[_0xb5fa('0x6f')]['findAll']({'where':{'id':_0x330d32},'attributes':['id'],'include':[{'model':db[_0xb5fa('0x72')],'as':_0xb5fa('0x73'),'attributes':['id',_0xb5fa('0x36'),_0xb5fa('0x74'),_0xb5fa('0x75'),_0xb5fa('0x76')],'raw':!![]}]})['then'](function(_0x9618fc){if(_0x9618fc){var _0x3170c1=_[_0xb5fa('0x77')](_0x9618fc,function(_0x327f35){var _0x365087=_0x327f35[_0xb5fa('0x58')]({'plain':!![]});_0x365087[_0xb5fa('0x73')]['forEach'](function(_0x5d0e21){_0x5d0e21[_0xb5fa('0x78')]=_[_0xb5fa('0x35')](_0x39733a,{'id':_0x365087['id']})[_0xb5fa('0x78')];});return _0x365087[_0xb5fa('0x73')];});return db[_0xb5fa('0x3c')][_0xb5fa('0x35')]({'where':{'id':_0x270cda[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](function(_0x31c103){return db[_0xb5fa('0x79')]['transaction'](function(_0x394383){return _0x31c103[_0xb5fa('0x70')](_0x330d32,{'transaction':_0x394383})[_0xb5fa('0x2a')](function(){return BPromise[_0xb5fa('0x7a')](_0x39733a,function(_0x161d37){return db[_0xb5fa('0x7b')][_0xb5fa('0x7c')]({'TeamId':_0x161d37['id'],'VoiceQueueId':_0x270cda[_0xb5fa('0x51')]['id'],'penalty':_0x161d37[_0xb5fa('0x78')]},{'transaction':_0x394383});});})[_0xb5fa('0x2a')](function(){return BPromise[_0xb5fa('0x7a')](_0x3170c1,function(_0x140068){return db[_0xb5fa('0x7d')][_0xb5fa('0x7e')]({'where':{'UserId':_0x140068['id'],'VoiceQueueId':_0x270cda['params']['id']},'defaults':{'penalty':_0x140068['penalty']},'transaction':_0x394383});});})[_0xb5fa('0x2a')](function(){return BPromise[_0xb5fa('0x7a')](_['filter'](_0x3170c1,{'online':!![]}),function(_0x419d0c){return db[_0xb5fa('0x7f')][_0xb5fa('0x7c')]({'membername':_0x419d0c['name'],'UserId':_0x419d0c['id'],'queue_name':_0x31c103[_0xb5fa('0x36')],'VoiceQueueId':_0x31c103['id'],'interface':_[_0xb5fa('0x80')](_0x419d0c[_0xb5fa('0x76')])?util[_0xb5fa('0x81')](_0xb5fa('0x82'),_0x419d0c[_0xb5fa('0x36')]):_0x419d0c[_0xb5fa('0x76')],'paused':_0x419d0c[_0xb5fa('0x75')]||![],'penalty':_0x419d0c['penalty']},{'transaction':_0x394383});});})[_0xb5fa('0x2a')](function(){_0x3170c1[_0xb5fa('0x83')](function(_0x4da81b){socket[_0xb5fa('0x84')](_0xb5fa('0x85'),{'UserId':_0x4da81b['id'],'VoiceQueueId':_0x31c103['id']});});});});});}})['then'](respondWithStatusCode(_0x33b2fa,null))[_0xb5fa('0x54')](handleError(_0x33b2fa,null));};exports[_0xb5fa('0x86')]=function(_0xc4359f,_0x110d6e,_0x413427){return db[_0xb5fa('0x6f')][_0xb5fa('0x4e')]({'where':{'id':_0xc4359f[_0xb5fa('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb5fa('0x72')],'as':_0xb5fa('0x73'),'attributes':['id'],'raw':!![]}]})[_0xb5fa('0x2a')](handleEntityNotFound(_0x110d6e,null))[_0xb5fa('0x2a')](function(_0xe67c27){var _0x486620=_[_0xb5fa('0x31')](_0xe67c27,'id');var _0x32718e=[];var _0x426bcc=[];var _0x5f5aec=squel[_0xb5fa('0x87')]();_0x5f5aec[_0xb5fa('0x88')](_0xb5fa('0x89'))['from'](_0xb5fa('0x8a'),'tq')[_0xb5fa('0x8b')](_0xb5fa('0x8c'),'ut',_0xb5fa('0x8d'))[_0xb5fa('0x47')](_0xb5fa('0x8e'),_0xc4359f[_0xb5fa('0x51')]['id']);for(var _0xae1424=0x0;_0xae1424<_0xe67c27[_0xb5fa('0x44')];_0xae1424+=0x1){let _0x5ca7f7=_0xe67c27[_0xae1424];for(var _0x47f1fa=0x0;_0x47f1fa<_0x5ca7f7[_0xb5fa('0x73')][_0xb5fa('0x44')];_0x47f1fa+=0x1){let _0x4e65cc=_0x5ca7f7['Agents'][_0x47f1fa];var _0x5373fb=_0x5f5aec['clone']();_0x5373fb['where'](_0xb5fa('0x8f'),_0x4e65cc['id']);_0x426bcc[_0xb5fa('0x90')](db[_0xb5fa('0x79')][_0xb5fa('0x40')](_0x5373fb[_0xb5fa('0x91')](),{'type':db[_0xb5fa('0x79')][_0xb5fa('0x92')][_0xb5fa('0x93')]})[_0xb5fa('0x2a')](function(_0x459a9c){if(_0x459a9c['length']===0x1){return _0x4e65cc['id'];}else{var _0x525cc6=_[_0xb5fa('0x94')](_[_0xb5fa('0x31')](_0x459a9c,_0xb5fa('0x95')),function(_0x48a74d){return _['includes'](_0x486620,_0x48a74d);});if(_0x525cc6){return _0x4e65cc['id'];}}}));}}return BPromise[_0xb5fa('0x96')](_0x426bcc)[_0xb5fa('0x2a')](function(_0x326014){_0x32718e=_(_0x32718e)[_0xb5fa('0x97')](_0x326014)[_0xb5fa('0x98')]()[_0xb5fa('0x32')]();return db[_0xb5fa('0x3c')][_0xb5fa('0x35')]({'where':{'id':_0xc4359f[_0xb5fa('0x51')]['id']}})['then'](function(_0x17a3d3){return db[_0xb5fa('0x79')][_0xb5fa('0x99')](function(_0x4277fb){return _0x17a3d3[_0xb5fa('0x86')](_0xc4359f[_0xb5fa('0x40')][_0xb5fa('0x9a')],{'transaction':_0x4277fb})[_0xb5fa('0x2a')](function(){if(!_['isEmpty'](_0x32718e)){return _0x17a3d3[_0xb5fa('0x9b')](_0x32718e,{'transaction':_0x4277fb})[_0xb5fa('0x2a')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xc4359f[_0xb5fa('0x51')]['id'],'UserId':_0x32718e},'transaction':_0x4277fb});});}})['then'](function(){_0x32718e[_0xb5fa('0x83')](function(_0x29dbb8){socket[_0xb5fa('0x84')](_0xb5fa('0x9c'),{'UserId':_0x29dbb8,'VoiceQueueId':_0x17a3d3['id']});});});});});});})[_0xb5fa('0x2a')](respondWithStatusCode(_0x110d6e,null))[_0xb5fa('0x54')](handleError(_0x110d6e,null));};exports[_0xb5fa('0x9d')]=function(_0x1abbf0,_0x5c2255,_0x7c6bfa){var _0x4555c7,_0x38e337;return db[_0xb5fa('0x3c')]['find']({'where':{'id':_0x1abbf0[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x5c2255,null))['then'](function(_0x239e39){if(_0x239e39){_0x38e337=_0x239e39;return _0x239e39[_0xb5fa('0x9d')](_0x1abbf0['body'][_0xb5fa('0x9a')],_[_0xb5fa('0x60')](_0x1abbf0['body'],[_0xb5fa('0x9a'),'id'])||{})['spread'](function(_0x499fe4){for(var _0x2b84a6=0x0;_0x2b84a6<_0x1abbf0[_0xb5fa('0x56')][_0xb5fa('0x9a')][_0xb5fa('0x44')];_0x2b84a6+=0x1){socket[_0xb5fa('0x84')](_0xb5fa('0x85'),{'UserId':Number(_0x1abbf0[_0xb5fa('0x56')]['ids'][_0x2b84a6]),'VoiceQueueId':Number(_0x1abbf0[_0xb5fa('0x51')]['id'])});}return _0x499fe4;});}})[_0xb5fa('0x2a')](function(_0x5e656f){_0x4555c7=_0x5e656f||[];if(_0x38e337){return db['User'][_0xb5fa('0x4e')]({'where':{'id':_0x1abbf0[_0xb5fa('0x56')][_0xb5fa('0x9a')]},'attributes':['id','name',_0xb5fa('0x74'),'voicePause',_0xb5fa('0x76')],'raw':!![]});}})['then'](function(_0x4051b0){if(!_[_0xb5fa('0x9e')](_0x4051b0)){var _0xccf981=[];for(var _0x124c04=0x0;_0x124c04<_0x4051b0[_0xb5fa('0x44')];_0x124c04++){if(_0x4051b0[_0x124c04][_0xb5fa('0x74')]){_0xccf981[_0xb5fa('0x90')](db['UserVoiceQueueRt'][_0xb5fa('0x7c')]({'membername':_0x4051b0[_0x124c04][_0xb5fa('0x36')],'UserId':_0x4051b0[_0x124c04]['id'],'queue_name':_0x38e337['name'],'VoiceQueueId':_0x38e337['id'],'interface':_[_0xb5fa('0x80')](_0x4051b0[_0x124c04]['interface'])?util[_0xb5fa('0x81')](_0xb5fa('0x82'),_0x4051b0[_0x124c04][_0xb5fa('0x36')]):_0x4051b0[_0x124c04][_0xb5fa('0x76')],'paused':_0x4051b0[_0x124c04]['voicePause']||![],'penalty':_0x1abbf0[_0xb5fa('0x56')]['penalty']||0x0}));}}return BPromise[_0xb5fa('0x96')](_0xccf981);}})[_0xb5fa('0x2a')](function(){return _0x4555c7;})['then'](respondWithResult(_0x5c2255,null))[_0xb5fa('0x54')](handleError(_0x5c2255,null));};exports[_0xb5fa('0x9b')]=function(_0x2abe9b,_0x1e4fa1,_0x327b53){return db['VoiceQueue'][_0xb5fa('0x35')]({'where':{'id':_0x2abe9b['params']['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x1e4fa1,null))[_0xb5fa('0x2a')](function(_0x5a57e0){if(_0x5a57e0){return _0x5a57e0[_0xb5fa('0x9b')](_0x2abe9b[_0xb5fa('0x40')]['ids'])['then'](function(){if(_[_0xb5fa('0x9f')](_0x2abe9b[_0xb5fa('0x40')][_0xb5fa('0x9a')])){for(var _0x1a501e=0x0;_0x1a501e<_0x2abe9b[_0xb5fa('0x40')][_0xb5fa('0x9a')][_0xb5fa('0x44')];_0x1a501e+=0x1){socket[_0xb5fa('0x84')](_0xb5fa('0x9c'),{'UserId':Number(_0x2abe9b[_0xb5fa('0x40')]['ids'][_0x1a501e]),'VoiceQueueId':Number(_0x2abe9b['params']['id'])});}}else{socket['emit'](_0xb5fa('0x9c'),{'UserId':Number(_0x2abe9b[_0xb5fa('0x40')]['ids']),'VoiceQueueId':Number(_0x2abe9b['params']['id'])});}});}})['then'](function(_0x5ae447){return db[_0xb5fa('0x7f')]['destroy']({'where':{'VoiceQueueId':_0x2abe9b[_0xb5fa('0x51')]['id'],'UserId':_0x2abe9b[_0xb5fa('0x40')][_0xb5fa('0x9a')]}})['then'](function(){return _0x5ae447;});})[_0xb5fa('0x2a')](respondWithStatusCode(_0x1e4fa1,null))[_0xb5fa('0x54')](handleError(_0x1e4fa1,null));};exports['getAgents']=function(_0x31e2a1,_0xcf6d4d,_0x57dcb6){var _0x5c8559={};var _0x4d88b8={};var _0x17f4d4;var _0x460d3c;return db[_0xb5fa('0x3c')]['findOne']({'where':{'id':_0x31e2a1[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0xcf6d4d,null))[_0xb5fa('0x2a')](function(_0x3a3b73){if(_0x3a3b73){_0x17f4d4=_0x3a3b73;_0x4d88b8[_0xb5fa('0x3e')]=_['keys'](db[_0xb5fa('0x72')]['rawAttributes']);_0x4d88b8[_0xb5fa('0x40')]=_[_0xb5fa('0x3f')](_0x31e2a1[_0xb5fa('0x40')]);_0x4d88b8[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x4d88b8[_0xb5fa('0x3e')],_0x4d88b8[_0xb5fa('0x40')]);_0x5c8559[_0xb5fa('0x43')]=_[_0xb5fa('0x42')](_0x4d88b8['model'],qs['fields'](_0x31e2a1[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x5c8559['attributes']=_0x5c8559[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x5c8559['attributes']:_0x4d88b8[_0xb5fa('0x3e')];_0x5c8559[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x31e2a1['query'][_0xb5fa('0x46')]);_0x5c8559[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x31e2a1[_0xb5fa('0x40')],_0x4d88b8['filters']));if(_0x31e2a1[_0xb5fa('0x40')][_0xb5fa('0x2f')]){_0x5c8559[_0xb5fa('0x47')]=_[_0xb5fa('0x49')](_0x5c8559[_0xb5fa('0x47')],{'$or':_['map'](_0x5c8559['attributes'],function(_0x19a567){var _0xb3a8c1={};_0xb3a8c1[_0x19a567]={'$like':'%'+_0x31e2a1[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0xb3a8c1;})});}_0x5c8559=_[_0xb5fa('0x49')]({},_0x5c8559,_0x31e2a1['options']);return _0x17f4d4['getAgents'](_0x5c8559);}})['then'](function(_0x389fd1){if(_0x389fd1){_0x460d3c=_0x389fd1[_0xb5fa('0x44')];if(!_0x31e2a1['query'][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x5c8559[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x31e2a1[_0xb5fa('0x40')]['limit']);_0x5c8559[_0xb5fa('0x20')]=qs['offset'](_0x31e2a1[_0xb5fa('0x40')][_0xb5fa('0x20')]);}return _0x17f4d4[_0xb5fa('0xa0')](_0x5c8559);}})[_0xb5fa('0x2a')](function(_0x1db92b){if(_0x1db92b){return _0x1db92b?{'count':_0x460d3c,'rows':_0x1db92b}:null;}})[_0xb5fa('0x2a')](respondWithResult(_0xcf6d4d,null))[_0xb5fa('0x54')](handleError(_0xcf6d4d,null));};exports[_0xb5fa('0xa1')]=function(_0x42a3e9,_0x497465,_0x268f7e){var _0x7a3bd4={};var _0x2f8007={};var _0x22a5ec;var _0x5cf2e1;return db[_0xb5fa('0x3c')][_0xb5fa('0x68')]({'where':{'id':_0x42a3e9['params']['id']}})['then'](handleEntityNotFound(_0x497465,null))[_0xb5fa('0x2a')](function(_0x1c296a){if(_0x1c296a){_0x22a5ec=_0x1c296a;_0x2f8007['model']=_['keys'](db[_0xb5fa('0x7f')][_0xb5fa('0x52')]);_0x2f8007[_0xb5fa('0x40')]=_[_0xb5fa('0x3f')](_0x42a3e9[_0xb5fa('0x40')]);_0x2f8007['filters']=_['intersection'](_0x2f8007[_0xb5fa('0x3e')],_0x2f8007['query']);_0x7a3bd4[_0xb5fa('0x43')]=_['intersection'](_0x2f8007[_0xb5fa('0x3e')],qs[_0xb5fa('0x53')](_0x42a3e9['query']['fields']));_0x7a3bd4[_0xb5fa('0x43')]=_0x7a3bd4['attributes'][_0xb5fa('0x44')]?_0x7a3bd4[_0xb5fa('0x43')]:_0x2f8007['model'];_0x7a3bd4[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x42a3e9[_0xb5fa('0x40')]['sort']);_0x7a3bd4[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_['pick'](_0x42a3e9[_0xb5fa('0x40')],_0x2f8007[_0xb5fa('0x41')]));if(_0x42a3e9[_0xb5fa('0x40')][_0xb5fa('0x2f')]){_0x7a3bd4[_0xb5fa('0x47')]=_[_0xb5fa('0x49')](_0x7a3bd4[_0xb5fa('0x47')],{'$or':_[_0xb5fa('0x31')](_0x7a3bd4[_0xb5fa('0x43')],function(_0x10dd98){var _0x2dd8fe={};_0x2dd8fe[_0x10dd98]={'$like':'%'+_0x42a3e9[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0x2dd8fe;})});}_0x7a3bd4=_[_0xb5fa('0x49')]({},_0x7a3bd4,_0x42a3e9[_0xb5fa('0x4b')]);return _0x22a5ec[_0xb5fa('0xa1')](_0x7a3bd4);}})[_0xb5fa('0x2a')](function(_0x3deef3){if(_0x3deef3){_0x5cf2e1=_0x3deef3[_0xb5fa('0x44')];if(!_0x42a3e9[_0xb5fa('0x40')][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x7a3bd4[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x42a3e9['query'][_0xb5fa('0x22')]);_0x7a3bd4[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x42a3e9[_0xb5fa('0x40')][_0xb5fa('0x20')]);}return _0x22a5ec[_0xb5fa('0xa1')](_0x7a3bd4);}})['then'](function(_0x20a8d1){return _0x20a8d1?{'count':_0x5cf2e1,'rows':_0x20a8d1}:null;})[_0xb5fa('0x2a')](respondWithResult(_0x497465,null))[_0xb5fa('0x54')](handleError(_0x497465,null));};exports[_0xb5fa('0xa2')]=function(_0x440432,_0x24d5cf,_0x469df4){var _0x992e57={};var _0x3c75c9={};var _0x39c124;var _0xba4cd0;return db['VoiceQueue'][_0xb5fa('0x68')]({'where':{'id':_0x440432[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x24d5cf,null))[_0xb5fa('0x2a')](function(_0x5345f8){if(_0x5345f8){_0x39c124=_0x5345f8;_0x3c75c9[_0xb5fa('0x3e')]=_['keys'](db[_0xb5fa('0xa3')]['rawAttributes']);_0x3c75c9['query']=_[_0xb5fa('0x3f')](_0x440432[_0xb5fa('0x40')]);_0x3c75c9[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x3c75c9[_0xb5fa('0x3e')],_0x3c75c9[_0xb5fa('0x40')]);_0x992e57[_0xb5fa('0x43')]=_[_0xb5fa('0x42')](_0x3c75c9[_0xb5fa('0x3e')],qs[_0xb5fa('0x53')](_0x440432['query'][_0xb5fa('0x53')]));_0x992e57['attributes']=_0x992e57[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x992e57[_0xb5fa('0x43')]:_0x3c75c9[_0xb5fa('0x3e')];_0x992e57[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x440432[_0xb5fa('0x40')]['sort']);_0x992e57['where']=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x440432[_0xb5fa('0x40')],_0x3c75c9[_0xb5fa('0x41')]));if(_0x440432[_0xb5fa('0x40')][_0xb5fa('0x2f')]){_0x992e57['where']=_[_0xb5fa('0x49')](_0x992e57[_0xb5fa('0x47')],{'$or':_[_0xb5fa('0x31')](_0x992e57[_0xb5fa('0x43')],function(_0x47f1fc){var _0x391545={};_0x391545[_0x47f1fc]={'$like':'%'+_0x440432[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0x391545;})});}_0x992e57=_['merge']({},_0x992e57,_0x440432[_0xb5fa('0x4b')]);return _0x39c124[_0xb5fa('0xa2')](_0x992e57);}})[_0xb5fa('0x2a')](function(_0x525e79){if(_0x525e79){_0xba4cd0=_0x525e79[_0xb5fa('0x44')];if(!_0x440432[_0xb5fa('0x40')][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x992e57[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x440432[_0xb5fa('0x40')][_0xb5fa('0x22')]);_0x992e57['offset']=qs[_0xb5fa('0x20')](_0x440432[_0xb5fa('0x40')][_0xb5fa('0x20')]);}return _0x39c124[_0xb5fa('0xa2')](_0x992e57);}})[_0xb5fa('0x2a')](function(_0xc8ae02){if(_0xc8ae02){return _0xc8ae02?{'count':_0xba4cd0,'rows':_0xc8ae02}:null;}})['then'](respondWithResult(_0x24d5cf,null))[_0xb5fa('0x54')](handleError(_0x24d5cf,null));};exports[_0xb5fa('0xa4')]=function(_0x4ba538,_0x135da7,_0x11718c){var _0x2f70bb=moment()[_0xb5fa('0x81')](_0xb5fa('0xa5'));var _0x30adfb,_0x2415ad;return db[_0xb5fa('0x3c')]['find']({'where':{'id':_0x4ba538['params']['id']}})['then'](handleEntityNotFound(_0x135da7,null))[_0xb5fa('0x2a')](function(_0x1a83de){if(_0x1a83de){_0x2415ad=_0x1a83de;return _0x1a83de[_0xb5fa('0xa4')](_0x4ba538[_0xb5fa('0x56')]['ids'],_[_0xb5fa('0x60')](_0x4ba538[_0xb5fa('0x56')],['ids','id'])||{});}return null;})[_0xb5fa('0xa6')](function(_0x1cc5e9){var _0x9130ef;_0x30adfb=_0x1cc5e9||[];var _0x534af4=[];if(_0x1cc5e9){for(var _0x4bea5f=0x0;_0x4bea5f<_0x1cc5e9['length'];_0x4bea5f+=0x1){var _0x20ee6e=_0x1cc5e9[_0x4bea5f][_0xb5fa('0x58')]({'plain':!![]});_0x2415ad[_0xb5fa('0xa7')]=_0x4ba538['body'][_0xb5fa('0xa7')]?_0x4ba538['body'][_0xb5fa('0xa7')]:_0x2415ad[_0xb5fa('0xa7')];switch(_0x2415ad['dialCheckDuplicateType']){case _0xb5fa('0xa8'):_0x9130ef=squel[_0xb5fa('0xa9')]()[_0xb5fa('0xaa')](_0xb5fa('0xab'))[_0xb5fa('0xac')](['phone',_0xb5fa('0xad'),_0xb5fa('0xae'),_0xb5fa('0xaf'),_0xb5fa('0x6a'),_0xb5fa('0x62'),_0xb5fa('0x61')],squel[_0xb5fa('0x87')]()[_0xb5fa('0x88')](_0xb5fa('0xb0'),'phone')[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0xad'))[_0xb5fa('0x88')]('id',_0xb5fa('0xae'))[_0xb5fa('0x88')](_0x20ee6e[_0xb5fa('0xb1')]['toString'](),'ListId')[_0xb5fa('0x88')](_0x4ba538[_0xb5fa('0x51')]['id']['toString'](),'VoiceQueueId')[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x62'))[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x61'))[_0xb5fa('0xb2')](_0xb5fa('0xb3'))[_0xb5fa('0x47')](_0xb5fa('0xb4'))[_0xb5fa('0x47')](_0xb5fa('0xb5'),_0x20ee6e[_0xb5fa('0xb1')][_0xb5fa('0x91')]())['where'](_0xb5fa('0xb6'))[_0xb5fa('0x47')](_0xb5fa('0xb7'),squel[_0xb5fa('0x87')]()[_0xb5fa('0x88')]('COALESCE(calleridnum,\x27\x27)')[_0xb5fa('0xb2')](_0xb5fa('0xb8'))[_0xb5fa('0x47')](_0xb5fa('0x8e'),_0x4ba538[_0xb5fa('0x51')]['id'][_0xb5fa('0x91')]()))[_0xb5fa('0x47')](_0xb5fa('0xb7'),squel[_0xb5fa('0x87')]()[_0xb5fa('0x88')]('COALESCE(phone,\x27\x27)')[_0xb5fa('0xb2')]('cm_hopper')[_0xb5fa('0x47')](_0xb5fa('0x8e'),_0x4ba538[_0xb5fa('0x51')]['id'][_0xb5fa('0x91')]())))[_0xb5fa('0x91')]();break;case'onlyIfOpen':_0x9130ef=squel[_0xb5fa('0xa9')]()['into'](_0xb5fa('0xab'))[_0xb5fa('0xac')]([_0xb5fa('0xb0'),_0xb5fa('0xad'),_0xb5fa('0xae'),_0xb5fa('0xaf'),_0xb5fa('0x6a'),_0xb5fa('0x62'),_0xb5fa('0x61')],squel[_0xb5fa('0x87')]()[_0xb5fa('0x88')]('phone','phone')[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0xad'))['field']('id','ContactId')[_0xb5fa('0x88')](_0x20ee6e['CmListId'][_0xb5fa('0x91')](),_0xb5fa('0xaf'))[_0xb5fa('0x88')](_0x4ba538[_0xb5fa('0x51')]['id'][_0xb5fa('0x91')](),_0xb5fa('0x6a'))[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x62'))[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x61'))[_0xb5fa('0xb2')](_0xb5fa('0xb3'))[_0xb5fa('0x47')]('deletedAt\x20IS\x20NULL')[_0xb5fa('0x47')](_0xb5fa('0xb5'),_0x20ee6e[_0xb5fa('0xb1')][_0xb5fa('0x91')]())[_0xb5fa('0x47')](_0xb5fa('0xb6'))['where'](_0xb5fa('0xb7'),squel['select']()[_0xb5fa('0x88')]('COALESCE(phone,\x27\x27)')[_0xb5fa('0xb2')](_0xb5fa('0xab'))[_0xb5fa('0x47')](_0xb5fa('0x8e'),_0x4ba538[_0xb5fa('0x51')]['id'][_0xb5fa('0x91')]())))[_0xb5fa('0x91')]();break;default:_0x9130ef=squel[_0xb5fa('0xa9')]()[_0xb5fa('0xaa')](_0xb5fa('0xab'))[_0xb5fa('0xac')]([_0xb5fa('0xb0'),_0xb5fa('0xad'),_0xb5fa('0xae'),_0xb5fa('0xaf'),_0xb5fa('0x6a'),_0xb5fa('0x62'),_0xb5fa('0x61')],squel['select']()[_0xb5fa('0x88')](_0xb5fa('0xb0'),_0xb5fa('0xb0'))['field']('\x27'+_0x2f70bb+'\x27',_0xb5fa('0xad'))[_0xb5fa('0x88')]('id',_0xb5fa('0xae'))[_0xb5fa('0x88')](_0x20ee6e[_0xb5fa('0xb1')][_0xb5fa('0x91')](),_0xb5fa('0xaf'))[_0xb5fa('0x88')](_0x4ba538['params']['id'][_0xb5fa('0x91')](),_0xb5fa('0x6a'))[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x62'))['field']('\x27'+_0x2f70bb+'\x27','updatedAt')[_0xb5fa('0xb2')](_0xb5fa('0xb3'))[_0xb5fa('0x47')](_0xb5fa('0xb4'))['where']('ListId\x20=\x20?',_0x20ee6e[_0xb5fa('0xb1')][_0xb5fa('0x91')]())[_0xb5fa('0x47')](_0xb5fa('0xb6')))[_0xb5fa('0x91')]();}_0x534af4['push'](db[_0xb5fa('0x79')][_0xb5fa('0x40')](_0x9130ef));}return BPromise[_0xb5fa('0x96')](_0x534af4);}})['then'](function(){var _0x127046=[];var _0x1f125d=squel[_0xb5fa('0xa9')]()[_0xb5fa('0xaa')](_0xb5fa('0xb9'))[_0xb5fa('0xac')]([_0xb5fa('0xba'),'phone',_0xb5fa('0xbb'),'createdAt',_0xb5fa('0x61')],squel[_0xb5fa('0x87')]()['field'](_0xb5fa('0xbc'))[_0xb5fa('0x88')](_0xb5fa('0xbd'))['field'](_0xb5fa('0xbe'))[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x62'))[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x61'))[_0xb5fa('0xb2')](_0xb5fa('0xbf'),'ci')['join']('cm_hopper','h',_0xb5fa('0xc0'))[_0xb5fa('0x47')](_0xb5fa('0xc1'),_0x2f70bb)[_0xb5fa('0x47')](_0xb5fa('0xc2'),_0xb5fa('0xc3')))[_0xb5fa('0x91')]();_0x127046['push'](db['sequelize']['query'](_0x1f125d));return BPromise['all'](_0x127046);})[_0xb5fa('0x2a')](function(){return _0x30adfb;})[_0xb5fa('0x2a')](respondWithResult(_0x135da7,null))[_0xb5fa('0x54')](handleError(_0x135da7,null));};exports[_0xb5fa('0xc4')]=function(_0x4bd42c,_0x57e2e7,_0x5bc013){return db['VoiceQueue'][_0xb5fa('0x35')]({'where':{'id':_0x4bd42c['params']['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x57e2e7,null))[_0xb5fa('0x2a')](function(_0x1ab9fa){if(_0x1ab9fa){return _0x1ab9fa['removeLists'](_0x4bd42c[_0xb5fa('0x40')]['ids']);}})[_0xb5fa('0x2a')](function(_0x244f8c){if(_0x244f8c){return db['CmHopper']['destroy']({'where':{'ListId':_0x4bd42c['query']['ids'],'VoiceQueueId':_0x4bd42c[_0xb5fa('0x51')]['id']}})['then'](function(){return _0x244f8c;});}})[_0xb5fa('0x2a')](respondWithStatusCode(_0x57e2e7,null))[_0xb5fa('0x54')](handleError(_0x57e2e7,null));};exports['getBlackLists']=function(_0x401997,_0x243f24,_0x54015b){var _0x252c71={};var _0x1114ec={};var _0x5ec374;var _0x56db90;return db[_0xb5fa('0x3c')][_0xb5fa('0x68')]({'where':{'id':_0x401997[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x243f24,null))[_0xb5fa('0x2a')](function(_0x2aa222){if(_0x2aa222){_0x5ec374=_0x2aa222;_0x1114ec[_0xb5fa('0x3e')]=_[_0xb5fa('0x3f')](db[_0xb5fa('0xa3')][_0xb5fa('0x52')]);_0x1114ec['query']=_[_0xb5fa('0x3f')](_0x401997[_0xb5fa('0x40')]);_0x1114ec[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x1114ec['model'],_0x1114ec[_0xb5fa('0x40')]);_0x252c71['attributes']=_['intersection'](_0x1114ec[_0xb5fa('0x3e')],qs['fields'](_0x401997[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x252c71[_0xb5fa('0x43')]=_0x252c71[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x252c71[_0xb5fa('0x43')]:_0x1114ec[_0xb5fa('0x3e')];_0x252c71['order']=qs[_0xb5fa('0x46')](_0x401997[_0xb5fa('0x40')][_0xb5fa('0x46')]);_0x252c71[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x401997[_0xb5fa('0x40')],_0x1114ec[_0xb5fa('0x41')]));if(_0x401997['query']['filter']){_0x252c71[_0xb5fa('0x47')]=_[_0xb5fa('0x49')](_0x252c71[_0xb5fa('0x47')],{'$or':_[_0xb5fa('0x31')](_0x252c71[_0xb5fa('0x43')],function(_0x3f87c6){var _0x3c9643={};_0x3c9643[_0x3f87c6]={'$like':'%'+_0x401997[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0x3c9643;})});}_0x252c71=_['merge']({},_0x252c71,_0x401997[_0xb5fa('0x4b')]);return _0x5ec374[_0xb5fa('0xc5')](_0x252c71);}})[_0xb5fa('0x2a')](function(_0x1795cd){if(_0x1795cd){_0x56db90=_0x1795cd['length'];if(!_0x401997[_0xb5fa('0x40')][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x252c71[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x401997[_0xb5fa('0x40')][_0xb5fa('0x22')]);_0x252c71[_0xb5fa('0x20')]=qs['offset'](_0x401997[_0xb5fa('0x40')][_0xb5fa('0x20')]);}return _0x5ec374[_0xb5fa('0xc5')](_0x252c71);}})[_0xb5fa('0x2a')](function(_0xe2d44){if(_0xe2d44){return _0xe2d44?{'count':_0x56db90,'rows':_0xe2d44}:null;}})[_0xb5fa('0x2a')](respondWithResult(_0x243f24,null))[_0xb5fa('0x54')](handleError(_0x243f24,null));};exports[_0xb5fa('0xc6')]=function(_0x4a9163,_0x5212f0,_0x2cbb88){var _0x294654,_0x4337db;return db['VoiceQueue'][_0xb5fa('0x35')]({'where':{'id':_0x4a9163[_0xb5fa('0x51')]['id']}})['then'](handleEntityNotFound(_0x5212f0,null))[_0xb5fa('0x2a')](function(_0x553b26){if(_0x553b26){_0x4337db=_0x553b26;return _0x553b26['addBlackLists'](_0x4a9163[_0xb5fa('0x56')][_0xb5fa('0x9a')],_['omit'](_0x4a9163[_0xb5fa('0x56')],[_0xb5fa('0x9a'),'id'])||{});}return null;})[_0xb5fa('0xa6')](function(_0x424caf){var _0x3bb73f;_0x294654=_0x424caf||[];var _0x5646d9=[];if(_0x424caf){for(var _0x36462b=0x0;_0x36462b<_0x424caf[_0xb5fa('0x44')];_0x36462b+=0x1){var _0x525c8e=_0x424caf[_0x36462b][_0xb5fa('0x58')]({'plain':!![]});_0x3bb73f=squel['insert']()['into'](_0xb5fa('0xc7'))[_0xb5fa('0xac')]([_0xb5fa('0xb0'),_0xb5fa('0xae'),_0xb5fa('0xaf'),_0xb5fa('0x6a'),'createdAt',_0xb5fa('0x61')],squel[_0xb5fa('0x87')]()[_0xb5fa('0x88')](_0xb5fa('0xb0'),_0xb5fa('0xb0'))[_0xb5fa('0x88')]('id',_0xb5fa('0xae'))[_0xb5fa('0x88')](_0x525c8e[_0xb5fa('0xb1')]['toString'](),_0xb5fa('0xaf'))['field'](_0x4a9163[_0xb5fa('0x51')]['id'][_0xb5fa('0x91')](),'VoiceQueueId')[_0xb5fa('0x88')](_0xb5fa('0xc8'),_0xb5fa('0x62'))['field'](_0xb5fa('0xc8'),_0xb5fa('0x61'))[_0xb5fa('0xb2')]('cm_contacts')[_0xb5fa('0x47')]('deletedAt\x20IS\x20NULL')['where'](_0xb5fa('0xb5'),_0x525c8e[_0xb5fa('0xb1')][_0xb5fa('0x91')]())[_0xb5fa('0x47')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x5646d9['push'](db[_0xb5fa('0x79')]['query'](_0x3bb73f));}return BPromise['all'](_0x5646d9);}})['then'](function(){return _0x294654;})['then'](respondWithResult(_0x5212f0,null))['catch'](handleError(_0x5212f0,null));};exports['removeBlackLists']=function(_0x3fb210,_0x541c45,_0x399d08){return db[_0xb5fa('0x3c')][_0xb5fa('0x35')]({'where':{'id':_0x3fb210[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x541c45,null))[_0xb5fa('0x2a')](function(_0x3a4984){if(_0x3a4984){return _0x3a4984[_0xb5fa('0xc9')](_0x3fb210[_0xb5fa('0x40')]['ids']);}})[_0xb5fa('0x2a')](function(_0x5772c5){if(_0x5772c5){return db[_0xb5fa('0x6d')]['destroy']({'where':{'ListId':_0x3fb210[_0xb5fa('0x40')][_0xb5fa('0x9a')],'VoiceQueueId':_0x3fb210[_0xb5fa('0x51')]['id']}})['then'](function(){return _0x5772c5;});}})[_0xb5fa('0x2a')](respondWithStatusCode(_0x541c45,null))['catch'](handleError(_0x541c45,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index a5bdaf6..30a957b 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 _0x0654=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue'];(function(_0x283771,_0x3ba4bd){var _0x251945=function(_0x4fefcc){while(--_0x4fefcc){_0x283771['push'](_0x283771['shift']());}};_0x251945(++_0x3ba4bd);}(_0x0654,0x16f));var _0x4065=function(_0x5c7734,_0x5a2a10){_0x5c7734=_0x5c7734-0x0;var _0xdcee38=_0x0654[_0x5c7734];return _0xdcee38;};'use strict';var EventEmitter=require(_0x4065('0x0'));var VoiceQueue=require(_0x4065('0x1'))['db'][_0x4065('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4065('0x3')](0x0);var events={'afterCreate':_0x4065('0x4'),'afterUpdate':_0x4065('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2e4225){return function(_0x1c7694,_0x4098ff,_0x470117){VoiceQueueEvents[_0x4065('0x6')](_0x2e4225+':'+_0x1c7694['id'],_0x1c7694);VoiceQueueEvents['emit'](_0x2e4225,_0x1c7694);_0x470117(null);};}for(var e in events){if(events[_0x4065('0x7')](e)){var event=events[e];VoiceQueue[_0x4065('0x8')](e,emitEvent(event));}}module[_0x4065('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xb97f=['remove','emit','hook','exports','events','../../mysqldb','VoiceQueue','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb97f,0x124));var _0xfb97=function(_0x3004e0,_0x277776){_0x3004e0=_0x3004e0-0x0;var _0x3d175b=_0xb97f[_0x3004e0];return _0x3d175b;};'use strict';var EventEmitter=require(_0xfb97('0x0'));var VoiceQueue=require(_0xfb97('0x1'))['db'][_0xfb97('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfb97('0x3'),'afterDestroy':_0xfb97('0x4')};function emitEvent(_0x2a6d7e){return function(_0x3524c3,_0x2f1e84,_0x2947c1){VoiceQueueEvents[_0xfb97('0x5')](_0x2a6d7e+':'+_0x3524c3['id'],_0x3524c3);VoiceQueueEvents[_0xfb97('0x5')](_0x2a6d7e,_0x3524c3);_0x2947c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xfb97('0x6')](e,emitEvent(event));}}module[_0xfb97('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 2d79eb2..fbcece8 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0xded7ec,_0x7cd9f9){var _0x3e4c42=function(_0x4acf51){while(--_0x4acf51){_0xded7ec['push'](_0xded7ec['shift']());}};_0x3e4c42(++_0x7cd9f9);}(_0x34e8,0x12c));var _0x834e=function(_0x2b21f1,_0x48b6ac){_0x2b21f1=_0x2b21f1-0x0;var _0x1301ec=_0x34e8[_0x2b21f1];return _0x1301ec;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x3d8812,_0x24b648){var _0x3aa4ee=function(_0x1d5e09){while(--_0x1d5e09){_0x3d8812['push'](_0x3d8812['shift']());}};_0x3aa4ee(++_0x24b648);}(_0x008c,0x188));var _0xc008=function(_0x55036a,_0x1e43dc){_0x55036a=_0x55036a-0x0;var _0x2ebe00=_0x008c[_0x55036a];return _0x2ebe00;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index e5ffb35..280c4c2 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 _0x9319=['stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','VoiceQueue','options','raw','where','limit','map','include','attributes','model','GetVoiceQueue','ShowVoiceQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x9319,0x17b));var _0x9931=function(_0x250148,_0x437a83){_0x250148=_0x250148-0x0;var _0x29fc06=_0x9319[_0x250148];return _0x29fc06;};'use strict';var _=require(_0x9931('0x0'));var util=require(_0x9931('0x1'));var moment=require('moment');var BPromise=require(_0x9931('0x2'));var rs=require(_0x9931('0x3'));var fs=require('fs');var Redis=require(_0x9931('0x4'));var db=require(_0x9931('0x5'))['db'];var utils=require(_0x9931('0x6'));var logger=require('../../config/logger')(_0x9931('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9931('0x8')][_0x9931('0x9')]({'port':0x232a});config[_0x9931('0xa')]=_['defaults'](config[_0x9931('0xa')],{'host':_0x9931('0xb'),'port':0x18eb});var socket=require(_0x9931('0xc'))(new Redis(config['redis']));require(_0x9931('0xd'))[_0x9931('0xe')](socket);function respondWithRpcPromise(_0x3631f5,_0x47d363,_0x210617){return new BPromise(function(_0x242b7a,_0x5ce664){return client[_0x9931('0xf')](_0x3631f5,_0x210617)[_0x9931('0x10')](function(_0x1394be){logger[_0x9931('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x47d363,_0x9931('0x12'));logger[_0x9931('0x13')](_0x9931('0x14'),_0x47d363,'request\x20sent',JSON[_0x9931('0x15')](_0x1394be));if(_0x1394be[_0x9931('0x16')]){if(_0x1394be[_0x9931('0x16')][_0x9931('0x17')]===0x1f4){logger['error'](_0x9931('0x18'),_0x47d363,_0x1394be[_0x9931('0x16')][_0x9931('0x19')]);return _0x5ce664(_0x1394be['error'][_0x9931('0x19')]);}logger[_0x9931('0x16')](_0x9931('0x18'),_0x47d363,_0x1394be[_0x9931('0x16')][_0x9931('0x19')]);return _0x242b7a(_0x1394be[_0x9931('0x16')]['message']);}else{logger['info'](_0x9931('0x18'),_0x47d363,_0x9931('0x12'));_0x242b7a(_0x1394be[_0x9931('0x1a')][_0x9931('0x19')]);}})[_0x9931('0x1b')](function(_0x237a64){logger[_0x9931('0x16')](_0x9931('0x18'),_0x47d363,_0x237a64);_0x5ce664(_0x237a64);});});}exports['GetVoiceQueue']=function(_0xe09a8d){var _0x1bce7d=this;return new Promise(function(_0x103538,_0x440fd5){return db[_0x9931('0x1c')]['findAll']({'raw':_0xe09a8d[_0x9931('0x1d')]?_0xe09a8d['options'][_0x9931('0x1e')]===undefined?!![]:![]:!![],'where':_0xe09a8d[_0x9931('0x1d')]?_0xe09a8d[_0x9931('0x1d')][_0x9931('0x1f')]||null:null,'attributes':_0xe09a8d[_0x9931('0x1d')]?_0xe09a8d[_0x9931('0x1d')]['attributes']||null:null,'limit':_0xe09a8d['options']?_0xe09a8d[_0x9931('0x1d')][_0x9931('0x20')]||null:null,'include':_0xe09a8d['options']?_0xe09a8d[_0x9931('0x1d')]['include']?_[_0x9931('0x21')](_0xe09a8d['options'][_0x9931('0x22')],function(_0x3dbdae){return{'model':db[_0x3dbdae['model']],'as':_0x3dbdae['as'],'attributes':_0x3dbdae[_0x9931('0x23')],'include':_0x3dbdae[_0x9931('0x22')]?_['map'](_0x3dbdae[_0x9931('0x22')],function(_0x3159c2){return{'model':db[_0x3159c2['model']],'as':_0x3159c2['as'],'attributes':_0x3159c2[_0x9931('0x23')],'include':_0x3159c2[_0x9931('0x22')]?_[_0x9931('0x21')](_0x3159c2[_0x9931('0x22')],function(_0x34ed6f){return{'model':db[_0x34ed6f[_0x9931('0x24')]],'as':_0x34ed6f['as'],'attributes':_0x34ed6f['attributes']};}):[]};}):[]};}):[]:[]})[_0x9931('0x10')](function(_0x8d5f69){logger['info'](_0x9931('0x25'),_0xe09a8d);logger[_0x9931('0x13')](_0x9931('0x25'),_0xe09a8d,JSON[_0x9931('0x15')](_0x8d5f69));_0x103538(_0x8d5f69);})[_0x9931('0x1b')](function(_0x879265){logger[_0x9931('0x16')](_0x9931('0x25'),_0x879265[_0x9931('0x19')],_0xe09a8d);_0x440fd5(_0x1bce7d[_0x9931('0x16')](0x1f4,_0x879265['message']));});});};exports[_0x9931('0x26')]=function(_0x99b880){var _0x15b2b7=this;return new Promise(function(_0x14e512,_0x4999c2){return db[_0x9931('0x1c')][_0x9931('0x27')]({'raw':_0x99b880[_0x9931('0x1d')]?_0x99b880[_0x9931('0x1d')][_0x9931('0x1e')]===undefined?!![]:![]:!![],'where':_0x99b880[_0x9931('0x1d')]?_0x99b880[_0x9931('0x1d')][_0x9931('0x1f')]||null:null,'attributes':_0x99b880[_0x9931('0x1d')]?_0x99b880[_0x9931('0x1d')][_0x9931('0x23')]||null:null,'include':_0x99b880['options']?_0x99b880[_0x9931('0x1d')][_0x9931('0x22')]?_[_0x9931('0x21')](_0x99b880[_0x9931('0x1d')]['include'],function(_0x257032){return{'model':db[_0x257032[_0x9931('0x24')]],'as':_0x257032['as'],'attributes':_0x257032[_0x9931('0x23')],'include':_0x257032[_0x9931('0x22')]?_['map'](_0x257032['include'],function(_0x19a0cc){return{'model':db[_0x19a0cc[_0x9931('0x24')]],'as':_0x19a0cc['as'],'attributes':_0x19a0cc[_0x9931('0x23')],'include':_0x19a0cc[_0x9931('0x22')]?_[_0x9931('0x21')](_0x19a0cc['include'],function(_0x3e492c){return{'model':db[_0x3e492c[_0x9931('0x24')]],'as':_0x3e492c['as'],'attributes':_0x3e492c[_0x9931('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9931('0x10')](function(_0x4c2252){logger['info'](_0x9931('0x26'),_0x99b880);logger[_0x9931('0x13')]('ShowVoiceQueue',_0x99b880,JSON['stringify'](_0x4c2252));_0x14e512(_0x4c2252);})[_0x9931('0x1b')](function(_0x37ce76){logger[_0x9931('0x16')](_0x9931('0x26'),_0x37ce76[_0x9931('0x19')],_0x99b880);_0x4999c2(_0x15b2b7[_0x9931('0x16')](0x1f4,_0x37ce76[_0x9931('0x19')]));});});}; \ No newline at end of file +var _0xe78e=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowVoiceQueue','find'];(function(_0x1288c5,_0x7de5e6){var _0xf24aad=function(_0x2da39f){while(--_0x2da39f){_0x1288c5['push'](_0x1288c5['shift']());}};_0xf24aad(++_0x7de5e6);}(_0xe78e,0x1b9));var _0xee78=function(_0x2fec0d,_0x4efdf0){_0x2fec0d=_0x2fec0d-0x0;var _0x1762fd=_0xe78e[_0x2fec0d];return _0x1762fd;};'use strict';var _=require('lodash');var util=require(_0xee78('0x0'));var moment=require(_0xee78('0x1'));var BPromise=require(_0xee78('0x2'));var rs=require(_0xee78('0x3'));var fs=require('fs');var Redis=require(_0xee78('0x4'));var db=require(_0xee78('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xee78('0x6'))(_0xee78('0x7'));var config=require('../../config/environment');var jayson=require(_0xee78('0x8'));var client=jayson[_0xee78('0x9')][_0xee78('0xa')]({'port':0x232a});config['redis']=_[_0xee78('0xb')](config[_0xee78('0xc')],{'host':_0xee78('0xd'),'port':0x18eb});var socket=require(_0xee78('0xe'))(new Redis(config[_0xee78('0xc')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x48a49a,_0x343f2c,_0x2bd2f7){return new BPromise(function(_0x37f99a,_0x1a71a5){return client[_0xee78('0xf')](_0x48a49a,_0x2bd2f7)[_0xee78('0x10')](function(_0x44706e){logger[_0xee78('0x11')](_0xee78('0x12'),_0x343f2c,_0xee78('0x13'));logger['debug'](_0xee78('0x14'),_0x343f2c,_0xee78('0x13'),JSON['stringify'](_0x44706e));if(_0x44706e['error']){if(_0x44706e[_0xee78('0x15')][_0xee78('0x16')]===0x1f4){logger[_0xee78('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x343f2c,_0x44706e[_0xee78('0x15')][_0xee78('0x17')]);return _0x1a71a5(_0x44706e[_0xee78('0x15')][_0xee78('0x17')]);}logger[_0xee78('0x15')](_0xee78('0x12'),_0x343f2c,_0x44706e[_0xee78('0x15')][_0xee78('0x17')]);return _0x37f99a(_0x44706e[_0xee78('0x15')]['message']);}else{logger[_0xee78('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x343f2c,'request\x20sent');_0x37f99a(_0x44706e[_0xee78('0x18')][_0xee78('0x17')]);}})['catch'](function(_0x3fbf3a){logger[_0xee78('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x343f2c,_0x3fbf3a);_0x1a71a5(_0x3fbf3a);});});}exports[_0xee78('0x19')]=function(_0x255eaf){var _0x202048=this;return new Promise(function(_0x5214c3,_0x254c85){return db[_0xee78('0x1a')][_0xee78('0x1b')]({'raw':_0x255eaf[_0xee78('0x1c')]?_0x255eaf[_0xee78('0x1c')][_0xee78('0x1d')]===undefined?!![]:![]:!![],'where':_0x255eaf[_0xee78('0x1c')]?_0x255eaf[_0xee78('0x1c')][_0xee78('0x1e')]||null:null,'attributes':_0x255eaf['options']?_0x255eaf['options'][_0xee78('0x1f')]||null:null,'limit':_0x255eaf['options']?_0x255eaf['options'][_0xee78('0x20')]||null:null,'include':_0x255eaf[_0xee78('0x1c')]?_0x255eaf['options'][_0xee78('0x21')]?_[_0xee78('0x22')](_0x255eaf[_0xee78('0x1c')][_0xee78('0x21')],function(_0x3900ce){return{'model':db[_0x3900ce[_0xee78('0x23')]],'as':_0x3900ce['as'],'attributes':_0x3900ce[_0xee78('0x1f')],'include':_0x3900ce[_0xee78('0x21')]?_[_0xee78('0x22')](_0x3900ce[_0xee78('0x21')],function(_0x4e76df){return{'model':db[_0x4e76df[_0xee78('0x23')]],'as':_0x4e76df['as'],'attributes':_0x4e76df['attributes'],'include':_0x4e76df[_0xee78('0x21')]?_['map'](_0x4e76df[_0xee78('0x21')],function(_0x976b30){return{'model':db[_0x976b30[_0xee78('0x23')]],'as':_0x976b30['as'],'attributes':_0x976b30[_0xee78('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee78('0x10')](function(_0x24b92f){logger['info'](_0xee78('0x19'),_0x255eaf);logger[_0xee78('0x24')](_0xee78('0x19'),_0x255eaf,JSON['stringify'](_0x24b92f));_0x5214c3(_0x24b92f);})['catch'](function(_0x58153b){logger[_0xee78('0x15')](_0xee78('0x19'),_0x58153b[_0xee78('0x17')],_0x255eaf);_0x254c85(_0x202048[_0xee78('0x15')](0x1f4,_0x58153b[_0xee78('0x17')]));});});};exports[_0xee78('0x25')]=function(_0x378117){var _0x4b0e85=this;return new Promise(function(_0xf77078,_0x453325){return db[_0xee78('0x1a')][_0xee78('0x26')]({'raw':_0x378117['options']?_0x378117[_0xee78('0x1c')][_0xee78('0x1d')]===undefined?!![]:![]:!![],'where':_0x378117[_0xee78('0x1c')]?_0x378117['options'][_0xee78('0x1e')]||null:null,'attributes':_0x378117[_0xee78('0x1c')]?_0x378117[_0xee78('0x1c')]['attributes']||null:null,'include':_0x378117[_0xee78('0x1c')]?_0x378117[_0xee78('0x1c')][_0xee78('0x21')]?_['map'](_0x378117['options'][_0xee78('0x21')],function(_0x147383){return{'model':db[_0x147383[_0xee78('0x23')]],'as':_0x147383['as'],'attributes':_0x147383['attributes'],'include':_0x147383[_0xee78('0x21')]?_['map'](_0x147383[_0xee78('0x21')],function(_0x296f0e){return{'model':db[_0x296f0e[_0xee78('0x23')]],'as':_0x296f0e['as'],'attributes':_0x296f0e['attributes'],'include':_0x296f0e['include']?_[_0xee78('0x22')](_0x296f0e[_0xee78('0x21')],function(_0x5b25ae){return{'model':db[_0x5b25ae['model']],'as':_0x5b25ae['as'],'attributes':_0x5b25ae[_0xee78('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee78('0x10')](function(_0x4e48ff){logger['info'](_0xee78('0x25'),_0x378117);logger[_0xee78('0x24')](_0xee78('0x25'),_0x378117,JSON['stringify'](_0x4e48ff));_0xf77078(_0x4e48ff);})[_0xee78('0x27')](function(_0x2b5663){logger[_0xee78('0x15')]('ShowVoiceQueue',_0x2b5663[_0xee78('0x17')],_0x378117);_0x453325(_0x4b0e85[_0xee78('0x15')](0x1f4,_0x2b5663[_0xee78('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 8e28aab..dfba7e4 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 _0xa716=['save','update','emit','removeListener','length','voiceQueue:','./voiceQueue.events'];(function(_0x233e08,_0x56a14b){var _0x3f40b2=function(_0x24f6e1){while(--_0x24f6e1){_0x233e08['push'](_0x233e08['shift']());}};_0x3f40b2(++_0x56a14b);}(_0xa716,0xa7));var _0x6a71=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa716[_0x321bb2];return _0x9c12ed;};'use strict';var VoiceQueueEvents=require(_0x6a71('0x0'));var events=[_0x6a71('0x1'),'remove',_0x6a71('0x2')];function createListener(_0x482a8d,_0x4eda15){return function(_0x3bd10f){_0x4eda15[_0x6a71('0x3')](_0x482a8d,_0x3bd10f);};}function removeListener(_0x6865c7,_0x5b0301){return function(){VoiceQueueEvents[_0x6a71('0x4')](_0x6865c7,_0x5b0301);};}exports['register']=function(_0x5e15d5){for(var _0x567dbb=0x0,_0x36e8ca=events[_0x6a71('0x5')];_0x567dbb<_0x36e8ca;_0x567dbb++){var _0x404479=events[_0x567dbb];var _0x2aa558=createListener(_0x6a71('0x6')+_0x404479,_0x5e15d5);VoiceQueueEvents['on'](_0x404479,_0x2aa558);}}; \ No newline at end of file +var _0x937f=['remove','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x2c199f,_0x9bc083){var _0x443416=function(_0x10803e){while(--_0x10803e){_0x2c199f['push'](_0x2c199f['shift']());}};_0x443416(++_0x9bc083);}(_0x937f,0xb2));var _0xf937=function(_0xdd14ac,_0x108a82){_0xdd14ac=_0xdd14ac-0x0;var _0x1dcce2=_0x937f[_0xdd14ac];return _0x1dcce2;};'use strict';var VoiceQueueEvents=require(_0xf937('0x0'));var events=[_0xf937('0x1'),_0xf937('0x2'),_0xf937('0x3')];function createListener(_0x3b7cfe,_0x10d73b){return function(_0x31b9f6){_0x10d73b[_0xf937('0x4')](_0x3b7cfe,_0x31b9f6);};}function removeListener(_0x5ee95f,_0x2afb59){return function(){VoiceQueueEvents[_0xf937('0x5')](_0x5ee95f,_0x2afb59);};}exports[_0xf937('0x6')]=function(_0x8fa8c){for(var _0x331cde=0x0,_0x2e2bf7=events[_0xf937('0x7')];_0x331cde<_0x2e2bf7;_0x331cde++){var _0x19799f=events[_0x331cde];var _0x39622b=createListener(_0xf937('0x8')+_0x19799f,_0x8fa8c);VoiceQueueEvents['on'](_0x19799f,_0x39622b);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 638be1c..0a9bcdd 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 _0xcb7b=['post','put','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/describe','describe','isAuthenticated','getVoiceQueuesReport','/:id','show'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xcb7b,0x16d));var _0xbcb7=function(_0xbc3e84,_0x26f548){_0xbc3e84=_0xbc3e84-0x0;var _0x3190dd=_0xcb7b[_0xbc3e84];return _0x3190dd;};'use strict';var multer=require(_0xbcb7('0x0'));var util=require(_0xbcb7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbcb7('0x2'));var router=express['Router']();var fs_extra=require(_0xbcb7('0x3'));var auth=require(_0xbcb7('0x4'));var interaction=require(_0xbcb7('0x5'));var config=require(_0xbcb7('0x6'));var controller=require(_0xbcb7('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbcb7('0x8')](_0xbcb7('0x9'),auth['isAuthenticated'](),controller[_0xbcb7('0xa')]);router[_0xbcb7('0x8')]('/index',auth[_0xbcb7('0xb')](),controller[_0xbcb7('0xc')]);router['get'](_0xbcb7('0xd'),auth['isAuthenticated'](),controller[_0xbcb7('0xe')]);router[_0xbcb7('0xf')]('/',auth[_0xbcb7('0xb')](),controller['create']);router[_0xbcb7('0x10')](_0xbcb7('0xd'),auth[_0xbcb7('0xb')](),controller['update']);router[_0xbcb7('0x11')](_0xbcb7('0xd'),auth['isAuthenticated'](),controller[_0xbcb7('0x12')]);module['exports']=router; \ No newline at end of file +var _0xff4c=['./voiceQueueReport.controller','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xff4c,0x1db));var _0xcff4=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xff4c[_0x2ca9d4];return _0x258956;};'use strict';var multer=require(_0xcff4('0x0'));var util=require(_0xcff4('0x1'));var path=require(_0xcff4('0x2'));var timeout=require('connect-timeout');var express=require(_0xcff4('0x3'));var router=express['Router']();var fs_extra=require(_0xcff4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcff4('0x5'));router[_0xcff4('0x6')]('/',auth[_0xcff4('0x7')](),controller[_0xcff4('0x8')]);router[_0xcff4('0x6')](_0xcff4('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xcff4('0xa'),auth['isAuthenticated'](),controller[_0xcff4('0xb')]);router[_0xcff4('0x6')](_0xcff4('0xc'),auth[_0xcff4('0x7')](),controller['show']);router[_0xcff4('0xd')]('/',auth[_0xcff4('0x7')](),controller[_0xcff4('0xe')]);router[_0xcff4('0xf')](_0xcff4('0xc'),auth[_0xcff4('0x7')](),controller[_0xcff4('0x10')]);router[_0xcff4('0x11')](_0xcff4('0xc'),auth[_0xcff4('0x7')](),controller[_0xcff4('0x12')]);module[_0xcff4('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 02d60a6..981e874 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 _0x35cb=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format'];(function(_0x166cc7,_0x486d0c){var _0x196799=function(_0x598af5){while(--_0x598af5){_0x166cc7['push'](_0x166cc7['shift']());}};_0x196799(++_0x486d0c);}(_0x35cb,0x18e));var _0xb35c=function(_0x1289a2,_0x3e236f){_0x1289a2=_0x1289a2-0x0;var _0x2afb9f=_0x35cb[_0x1289a2];return _0x2afb9f;};'use strict';var Sequelize=require(_0xb35c('0x0'));var moment=require(_0xb35c('0x1'));module[_0xb35c('0x2')]={'type':{'type':Sequelize[_0xb35c('0x3')]},'uniqueid':{'type':Sequelize[_0xb35c('0x3')]},'calleridnum':{'type':Sequelize[_0xb35c('0x3')]},'calleridname':{'type':Sequelize[_0xb35c('0x3')]},'queue':{'type':Sequelize[_0xb35c('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xb35c('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xb35c('0x4')],'set':function(_0x592bea){var _0x1e0149=moment(_0x592bea);var _0x4b7e58=moment(this['getDataValue'](_0xb35c('0x5')))[_0xb35c('0x6')](_0xb35c('0x7'));var _0x3ac866=_0x1e0149[_0xb35c('0x8')](_0x4b7e58,_0xb35c('0x9'));this[_0xb35c('0xa')]('queuecallerleaveAt',_0x592bea);this[_0xb35c('0xa')](_0xb35c('0xb'),_0x3ac866||null);}},'position':{'type':Sequelize[_0xb35c('0xc')]},'count':{'type':Sequelize[_0xb35c('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xb35c('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xb35c('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xb35c('0x4')]},'queuecallerexit':{'type':Sequelize[_0xb35c('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb35c('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xb35c('0xc')]},'channel':{'type':Sequelize[_0xb35c('0x3')]},'connectedlinenum':{'type':Sequelize[_0xb35c('0x3')]},'connectedlinename':{'type':Sequelize[_0xb35c('0x3')]},'accountcode':{'type':Sequelize[_0xb35c('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb35c('0x3')]},'priority':{'type':Sequelize[_0xb35c('0x3')]},'holdtime':{'type':Sequelize[_0xb35c('0xc')]},'mohtime':{'type':Sequelize[_0xb35c('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb35c('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb35c('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xb35c('0xe')},'transferexten':{'type':Sequelize[_0xb35c('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xb35c('0x3')]},'secondDisposition':{'type':Sequelize[_0xb35c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x309d=['getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE'];(function(_0x26d7b8,_0x597018){var _0x48657d=function(_0x1bc747){while(--_0x1bc747){_0x26d7b8['push'](_0x26d7b8['shift']());}};_0x48657d(++_0x597018);}(_0x309d,0x10e));var _0xd309=function(_0x5243a3,_0x5e8ca2){_0x5243a3=_0x5243a3-0x0;var _0x139fcb=_0x309d[_0x5243a3];return _0x139fcb;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xd309('0x0')]={'type':{'type':Sequelize[_0xd309('0x1')]},'uniqueid':{'type':Sequelize[_0xd309('0x1')]},'calleridnum':{'type':Sequelize[_0xd309('0x1')]},'calleridname':{'type':Sequelize[_0xd309('0x1')]},'queue':{'type':Sequelize[_0xd309('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xd309('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xd309('0x2')],'set':function(_0x476900){var _0xe75258=moment(_0x476900);var _0x407a90=moment(this[_0xd309('0x3')](_0xd309('0x4')))['format'](_0xd309('0x5'));var _0x2ccafa=_0xe75258['diff'](_0x407a90,_0xd309('0x6'));this[_0xd309('0x7')]('queuecallerleaveAt',_0x476900);this[_0xd309('0x7')](_0xd309('0x8'),_0x2ccafa||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xd309('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xd309('0x2')]},'queuecallercomplete':{'type':Sequelize[_0xd309('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xd309('0x2')]},'queuecallerexit':{'type':Sequelize[_0xd309('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xd309('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xd309('0xa')},'originalposition':{'type':Sequelize[_0xd309('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd309('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd309('0x1')]},'context':{'type':Sequelize[_0xd309('0x1')]},'exten':{'type':Sequelize[_0xd309('0x1')]},'priority':{'type':Sequelize[_0xd309('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xd309('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xd309('0x1')]},'transfer':{'type':Sequelize[_0xd309('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xd309('0xc')},'transferexten':{'type':Sequelize[_0xd309('0x1')]},'transferuniqueid':{'type':Sequelize[_0xd309('0x1')]},'disposition':{'type':Sequelize[_0xd309('0x1')]},'secondDisposition':{'type':Sequelize[_0xd309('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index c1bd136..776041b 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 _0x9877=['redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','includeAll','include','rows','show','params','options','find','catch','create','body','destroy','describe','getVoiceQueuesReport','sort','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9877,0x139));var _0x7987=function(_0x45d4a0,_0x364983){_0x45d4a0=_0x45d4a0-0x0;var _0x5db710=_0x9877[_0x45d4a0];return _0x5db710;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7987('0x0'));var zipdir=require(_0x7987('0x1'));var jsonpatch=require(_0x7987('0x2'));var rp=require('request-promise');var moment=require(_0x7987('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7987('0x4'));var util=require(_0x7987('0x5'));var path=require(_0x7987('0x6'));var sox=require(_0x7987('0x7'));var csv=require(_0x7987('0x8'));var ejs=require(_0x7987('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7987('0xa'));var squel=require(_0x7987('0xb'));var crypto=require(_0x7987('0xc'));var jsforce=require(_0x7987('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7987('0x8'));var querystring=require(_0x7987('0xe'));var Papa=require(_0x7987('0xf'));var Redis=require(_0x7987('0x10'));var authService=require(_0x7987('0x11'));var qs=require(_0x7987('0x12'));var as=require(_0x7987('0x13'));var hardwareService=require(_0x7987('0x14'));var logger=require(_0x7987('0x15'))(_0x7987('0x16'));var utils=require(_0x7987('0x17'));var config=require(_0x7987('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7987('0x19'))['db'];config['redis']=_[_0x7987('0x1a')](config[_0x7987('0x1b')],{'host':_0x7987('0x1c'),'port':0x18eb});var socket=require(_0x7987('0x1d'))(new Redis(config['redis']));require(_0x7987('0x1e'))[_0x7987('0x1f')](socket);function respondWithStatusCode(_0xbe48f6,_0x149963){_0x149963=_0x149963||0xcc;return function(_0x592931){if(_0x592931){return _0xbe48f6[_0x7987('0x20')](_0x149963);}return _0xbe48f6[_0x7987('0x21')](_0x149963)['end']();};}function respondWithResult(_0x409464,_0x37019a){_0x37019a=_0x37019a||0xc8;return function(_0x18f0c){if(_0x18f0c){return _0x409464[_0x7987('0x21')](_0x37019a)[_0x7987('0x22')](_0x18f0c);}};}function respondWithFilteredResult(_0x5ec933,_0xa4f5e6){return function(_0x32b418){if(_0x32b418){var _0x2edfcf=typeof _0xa4f5e6[_0x7987('0x23')]===_0x7987('0x24')&&typeof _0xa4f5e6['limit']===_0x7987('0x24');var _0x438ad0=_0x32b418[_0x7987('0x25')];var _0x4afb0b=_0x2edfcf?0x0:_0xa4f5e6[_0x7987('0x23')];var _0x311093=_0x2edfcf?_0x32b418[_0x7987('0x25')]:_0xa4f5e6[_0x7987('0x23')]+_0xa4f5e6[_0x7987('0x26')];var _0x3955d0;if(_0x311093>=_0x438ad0){_0x311093=_0x438ad0;_0x3955d0=0xc8;}else{_0x3955d0=0xce;}_0x5ec933[_0x7987('0x21')](_0x3955d0);return _0x5ec933[_0x7987('0x27')](_0x7987('0x28'),_0x4afb0b+'-'+_0x311093+'/'+_0x438ad0)[_0x7987('0x22')](_0x32b418);}return null;};}function patchUpdates(_0x30fdea){return function(_0x10fe79){try{jsonpatch[_0x7987('0x29')](_0x10fe79,_0x30fdea,!![]);}catch(_0x47b70d){return BPromise[_0x7987('0x2a')](_0x47b70d);}return _0x10fe79[_0x7987('0x2b')]();};}function saveUpdates(_0x43a8aa,_0x399dc2){return function(_0x504e89){if(_0x504e89){return _0x504e89[_0x7987('0x2c')](_0x43a8aa)[_0x7987('0x2d')](function(_0x1d6f47){return _0x1d6f47;});}return null;};}function removeEntity(_0x4b60fc,_0x38ab95){return function(_0x58c3a2){if(_0x58c3a2){return _0x58c3a2['destroy']()[_0x7987('0x2d')](function(){_0x4b60fc[_0x7987('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe269ab,_0x3d8e9e){return function(_0x29934e){if(!_0x29934e){_0xe269ab[_0x7987('0x20')](0x194);}return _0x29934e;};}function handleError(_0x344b2a,_0x1e034b){_0x1e034b=_0x1e034b||0x1f4;return function(_0x49b5cb){logger[_0x7987('0x2e')](_0x49b5cb['stack']);if(_0x49b5cb[_0x7987('0x2f')]){delete _0x49b5cb['name'];}_0x344b2a[_0x7987('0x21')](_0x1e034b)[_0x7987('0x30')](_0x49b5cb);};}exports[_0x7987('0x31')]=function(_0x25e212,_0x23c36f){var _0x463f62={},_0x11900c={},_0x13ca4d={'count':0x0,'rows':[]};var _0x4b6f9c=_[_0x7987('0x32')](db[_0x7987('0x33')][_0x7987('0x34')],function(_0x377d1d){return{'name':_0x377d1d[_0x7987('0x35')],'type':_0x377d1d[_0x7987('0x36')][_0x7987('0x37')]};});_0x11900c[_0x7987('0x38')]=_[_0x7987('0x32')](_0x4b6f9c,_0x7987('0x2f'));_0x11900c[_0x7987('0x39')]=_[_0x7987('0x3a')](_0x25e212[_0x7987('0x39')]);_0x11900c[_0x7987('0x3b')]=_[_0x7987('0x3c')](_0x11900c[_0x7987('0x38')],_0x11900c[_0x7987('0x39')]);_0x463f62['attributes']=_[_0x7987('0x3c')](_0x11900c[_0x7987('0x38')],qs[_0x7987('0x3d')](_0x25e212[_0x7987('0x39')][_0x7987('0x3d')]));_0x463f62[_0x7987('0x3e')]=_0x463f62[_0x7987('0x3e')][_0x7987('0x3f')]?_0x463f62[_0x7987('0x3e')]:_0x11900c[_0x7987('0x38')];if(!_0x25e212[_0x7987('0x39')][_0x7987('0x40')](_0x7987('0x41'))){_0x463f62[_0x7987('0x26')]=qs['limit'](_0x25e212['query'][_0x7987('0x26')]);_0x463f62[_0x7987('0x23')]=qs['offset'](_0x25e212['query'][_0x7987('0x23')]);}_0x463f62[_0x7987('0x42')]=qs['sort'](_0x25e212['query']['sort']);_0x463f62[_0x7987('0x43')]=qs[_0x7987('0x3b')](_['pick'](_0x25e212[_0x7987('0x39')],_0x11900c[_0x7987('0x3b')]),_0x4b6f9c);if(_0x25e212['query'][_0x7987('0x44')]){_0x463f62[_0x7987('0x43')]=_[_0x7987('0x45')](_0x463f62['where'],{'$or':_['map'](_0x4b6f9c,function(_0x207069){if(_0x207069[_0x7987('0x36')]!==_0x7987('0x46')){var _0x4fbdce={};_0x4fbdce[_0x207069[_0x7987('0x2f')]]={'$like':'%'+_0x25e212['query'][_0x7987('0x44')]+'%'};return _0x4fbdce;}})});}_0x463f62=_[_0x7987('0x45')]({},_0x463f62,_0x25e212['options']);var _0x44d1ff={'where':_0x463f62[_0x7987('0x43')]};return db[_0x7987('0x33')][_0x7987('0x25')](_0x44d1ff)[_0x7987('0x2d')](function(_0xfa08bd){_0x13ca4d[_0x7987('0x25')]=_0xfa08bd;if(_0x25e212['query'][_0x7987('0x47')]){_0x463f62[_0x7987('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x463f62);})[_0x7987('0x2d')](function(_0x3da426){_0x13ca4d[_0x7987('0x49')]=_0x3da426;return _0x13ca4d;})['then'](respondWithFilteredResult(_0x23c36f,_0x463f62))['catch'](handleError(_0x23c36f,null));};exports[_0x7987('0x4a')]=function(_0x3da8b8,_0x5a70e4){var _0x213b7d={'raw':![],'where':{'id':_0x3da8b8[_0x7987('0x4b')]['id']}},_0x45fe5c={};_0x45fe5c[_0x7987('0x38')]=_[_0x7987('0x3a')](db[_0x7987('0x33')][_0x7987('0x34')]);_0x45fe5c['query']=_[_0x7987('0x3a')](_0x3da8b8[_0x7987('0x39')]);_0x45fe5c[_0x7987('0x3b')]=_['intersection'](_0x45fe5c[_0x7987('0x38')],_0x45fe5c[_0x7987('0x39')]);_0x213b7d[_0x7987('0x3e')]=_['intersection'](_0x45fe5c[_0x7987('0x38')],qs[_0x7987('0x3d')](_0x3da8b8[_0x7987('0x39')][_0x7987('0x3d')]));_0x213b7d[_0x7987('0x3e')]=_0x213b7d[_0x7987('0x3e')][_0x7987('0x3f')]?_0x213b7d[_0x7987('0x3e')]:_0x45fe5c[_0x7987('0x38')];if(_0x3da8b8['query'][_0x7987('0x47')]){_0x213b7d['include']=[{'all':!![]}];}_0x213b7d=_[_0x7987('0x45')]({},_0x213b7d,_0x3da8b8[_0x7987('0x4c')]);return db['VoiceQueueReport'][_0x7987('0x4d')](_0x213b7d)[_0x7987('0x2d')](handleEntityNotFound(_0x5a70e4,null))[_0x7987('0x2d')](respondWithResult(_0x5a70e4,null))[_0x7987('0x4e')](handleError(_0x5a70e4,null));};exports[_0x7987('0x4f')]=function(_0xc67fab,_0x4c47df){return db[_0x7987('0x33')][_0x7987('0x4f')](_0xc67fab['body'],{})['then'](respondWithResult(_0x4c47df,0xc9))[_0x7987('0x4e')](handleError(_0x4c47df,null));};exports['update']=function(_0x29c4d3,_0x2106f5){if(_0x29c4d3[_0x7987('0x50')]['id']){delete _0x29c4d3['body']['id'];}return db[_0x7987('0x33')]['find']({'where':{'id':_0x29c4d3[_0x7987('0x4b')]['id']}})[_0x7987('0x2d')](handleEntityNotFound(_0x2106f5,null))[_0x7987('0x2d')](saveUpdates(_0x29c4d3[_0x7987('0x50')],null))[_0x7987('0x2d')](respondWithResult(_0x2106f5,null))['catch'](handleError(_0x2106f5,null));};exports[_0x7987('0x51')]=function(_0x56ac8f,_0x50e0b5){return db[_0x7987('0x33')][_0x7987('0x4d')]({'where':{'id':_0x56ac8f[_0x7987('0x4b')]['id']}})[_0x7987('0x2d')](handleEntityNotFound(_0x50e0b5,null))['then'](removeEntity(_0x50e0b5,null))[_0x7987('0x4e')](handleError(_0x50e0b5,null));};exports['describe']=function(_0x5b90ce,_0x436221){return db[_0x7987('0x33')][_0x7987('0x52')]()[_0x7987('0x2d')](respondWithResult(_0x436221,null))[_0x7987('0x4e')](handleError(_0x436221,null));};exports[_0x7987('0x53')]=function(_0x2ba2ef,_0x3f53ae){var _0x10d426={},_0x3faf98={},_0x35681d={'count':0x0,'rows':[]};_0x3faf98[_0x7987('0x38')]=_[_0x7987('0x3a')](db[_0x7987('0x33')]['rawAttributes']);_0x3faf98[_0x7987('0x39')]=_['keys'](_0x2ba2ef[_0x7987('0x39')]);_0x3faf98[_0x7987('0x3b')]=_[_0x7987('0x3c')](_0x3faf98[_0x7987('0x38')],_0x3faf98[_0x7987('0x39')]);_0x10d426['attributes']=_['intersection'](_0x3faf98[_0x7987('0x38')],qs[_0x7987('0x3d')](_0x2ba2ef[_0x7987('0x39')][_0x7987('0x3d')]));_0x10d426['attributes']=_0x10d426[_0x7987('0x3e')][_0x7987('0x3f')]?_0x10d426[_0x7987('0x3e')]:_0x3faf98['model'];if(!_0x2ba2ef['query'][_0x7987('0x40')](_0x7987('0x41'))){_0x10d426[_0x7987('0x26')]=qs[_0x7987('0x26')](_0x2ba2ef[_0x7987('0x39')][_0x7987('0x26')]);_0x10d426[_0x7987('0x23')]=qs[_0x7987('0x23')](_0x2ba2ef[_0x7987('0x39')][_0x7987('0x23')]);}_0x10d426[_0x7987('0x42')]=qs[_0x7987('0x54')](_0x2ba2ef[_0x7987('0x39')][_0x7987('0x54')]);_0x10d426[_0x7987('0x43')]=qs[_0x7987('0x3b')](_['pick'](_0x2ba2ef['query'],_0x3faf98[_0x7987('0x3b')]));if(_0x2ba2ef[_0x7987('0x39')][_0x7987('0x44')]){_0x10d426[_0x7987('0x43')]=_['merge'](_0x10d426['where'],{'$or':_[_0x7987('0x32')](_0x10d426[_0x7987('0x3e')],function(_0x4b305d){var _0x5aae2c={};_0x5aae2c[_0x4b305d]={'$like':'%'+_0x2ba2ef[_0x7987('0x39')][_0x7987('0x44')]+'%'};return _0x5aae2c;})});}_0x10d426=_['merge']({},_0x10d426,_0x2ba2ef[_0x7987('0x4c')]);var _0x4a37f4={'where':_0x10d426[_0x7987('0x43')]};return db['VoiceQueueReport'][_0x7987('0x25')](_0x4a37f4)[_0x7987('0x2d')](function(_0x573f66){_0x35681d[_0x7987('0x25')]=_0x573f66;if(_0x2ba2ef[_0x7987('0x39')]['includeAll']){_0x10d426[_0x7987('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x10d426);})[_0x7987('0x2d')](function(_0x50663b){_0x35681d[_0x7987('0x49')]=_0x50663b;return _0x35681d;})[_0x7987('0x2d')](respondWithFilteredResult(_0x3f53ae,_0x10d426,_0x7987('0x53')))[_0x7987('0x4e')](handleError(_0x3f53ae,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xf673=['./voiceQueueReport.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','VoiceQueueReport','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','keys','fields','options','create','body','catch','find','describe','getVoiceQueuesReport','rows','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x17c042,_0x20062e){var _0x554337=function(_0x25a1db){while(--_0x25a1db){_0x17c042['push'](_0x17c042['shift']());}};_0x554337(++_0x20062e);}(_0xf673,0x120));var _0x3f67=function(_0x216799,_0x44b817){_0x216799=_0x216799-0x0;var _0x3661c3=_0xf673[_0x216799];return _0x3661c3;};'use strict';var emlformat=require(_0x3f67('0x0'));var rimraf=require(_0x3f67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f67('0x2'));var rp=require('request-promise');var moment=require(_0x3f67('0x3'));var BPromise=require(_0x3f67('0x4'));var Mustache=require(_0x3f67('0x5'));var util=require(_0x3f67('0x6'));var path=require(_0x3f67('0x7'));var sox=require('sox');var csv=require(_0x3f67('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f67('0x9'));var _=require(_0x3f67('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3f67('0xb'));var toCsv=require(_0x3f67('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3f67('0xc'));var qs=require(_0x3f67('0xd'));var as=require(_0x3f67('0xe'));var hardwareService=require(_0x3f67('0xf'));var logger=require(_0x3f67('0x10'))(_0x3f67('0x11'));var utils=require(_0x3f67('0x12'));var config=require(_0x3f67('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f67('0x14'))['db'];config[_0x3f67('0x15')]=_[_0x3f67('0x16')](config[_0x3f67('0x15')],{'host':_0x3f67('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f67('0x15')]));require(_0x3f67('0x18'))[_0x3f67('0x19')](socket);function respondWithStatusCode(_0x2873ab,_0x2ee5bf){_0x2ee5bf=_0x2ee5bf||0xcc;return function(_0x32e297){if(_0x32e297){return _0x2873ab['sendStatus'](_0x2ee5bf);}return _0x2873ab[_0x3f67('0x1a')](_0x2ee5bf)[_0x3f67('0x1b')]();};}function respondWithResult(_0x37c9fe,_0x2c837f){_0x2c837f=_0x2c837f||0xc8;return function(_0x1c34cd){if(_0x1c34cd){return _0x37c9fe[_0x3f67('0x1a')](_0x2c837f)[_0x3f67('0x1c')](_0x1c34cd);}};}function respondWithFilteredResult(_0x2ba124,_0x20dbc0){return function(_0x29c7ce){if(_0x29c7ce){var _0x5ca4e9=typeof _0x20dbc0[_0x3f67('0x1d')]==='undefined'&&typeof _0x20dbc0[_0x3f67('0x1e')]===_0x3f67('0x1f');var _0x46ceaf=_0x29c7ce[_0x3f67('0x20')];var _0x4dce4f=_0x5ca4e9?0x0:_0x20dbc0[_0x3f67('0x1d')];var _0x2d7444=_0x5ca4e9?_0x29c7ce['count']:_0x20dbc0['offset']+_0x20dbc0[_0x3f67('0x1e')];var _0x456b05;if(_0x2d7444>=_0x46ceaf){_0x2d7444=_0x46ceaf;_0x456b05=0xc8;}else{_0x456b05=0xce;}_0x2ba124['status'](_0x456b05);return _0x2ba124[_0x3f67('0x21')](_0x3f67('0x22'),_0x4dce4f+'-'+_0x2d7444+'/'+_0x46ceaf)[_0x3f67('0x1c')](_0x29c7ce);}return null;};}function patchUpdates(_0x11a423){return function(_0x3d140b){try{jsonpatch['apply'](_0x3d140b,_0x11a423,!![]);}catch(_0x378e01){return BPromise[_0x3f67('0x23')](_0x378e01);}return _0x3d140b[_0x3f67('0x24')]();};}function saveUpdates(_0x525a0b,_0x4c7ec7){return function(_0x48ae5f){if(_0x48ae5f){return _0x48ae5f[_0x3f67('0x25')](_0x525a0b)[_0x3f67('0x26')](function(_0x9cb927){return _0x9cb927;});}return null;};}function removeEntity(_0x24b681,_0x3089f2){return function(_0x5a46b6){if(_0x5a46b6){return _0x5a46b6[_0x3f67('0x27')]()['then'](function(){_0x24b681[_0x3f67('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c5590,_0x10cf57){return function(_0x5d3705){if(!_0x5d3705){_0x4c5590['sendStatus'](0x194);}return _0x5d3705;};}function handleError(_0x2701a2,_0x810473){_0x810473=_0x810473||0x1f4;return function(_0x27780a){logger[_0x3f67('0x28')](_0x27780a['stack']);if(_0x27780a['name']){delete _0x27780a[_0x3f67('0x29')];}_0x2701a2[_0x3f67('0x1a')](_0x810473)[_0x3f67('0x2a')](_0x27780a);};}exports['index']=function(_0x37cc1a,_0x27acb2){var _0x15dd4a={},_0x5578fa={},_0x14b0e4={'count':0x0,'rows':[]};var _0xc2d5a3=_[_0x3f67('0x2b')](db[_0x3f67('0x2c')][_0x3f67('0x2d')],function(_0x16a778){return{'name':_0x16a778[_0x3f67('0x2e')],'type':_0x16a778['type'][_0x3f67('0x2f')]};});_0x5578fa[_0x3f67('0x30')]=_['map'](_0xc2d5a3,_0x3f67('0x29'));_0x5578fa['query']=_['keys'](_0x37cc1a['query']);_0x5578fa[_0x3f67('0x31')]=_[_0x3f67('0x32')](_0x5578fa['model'],_0x5578fa[_0x3f67('0x33')]);_0x15dd4a[_0x3f67('0x34')]=_[_0x3f67('0x32')](_0x5578fa[_0x3f67('0x30')],qs['fields'](_0x37cc1a[_0x3f67('0x33')]['fields']));_0x15dd4a[_0x3f67('0x34')]=_0x15dd4a['attributes'][_0x3f67('0x35')]?_0x15dd4a[_0x3f67('0x34')]:_0x5578fa[_0x3f67('0x30')];if(!_0x37cc1a[_0x3f67('0x33')][_0x3f67('0x36')]('nolimit')){_0x15dd4a[_0x3f67('0x1e')]=qs[_0x3f67('0x1e')](_0x37cc1a['query'][_0x3f67('0x1e')]);_0x15dd4a[_0x3f67('0x1d')]=qs[_0x3f67('0x1d')](_0x37cc1a[_0x3f67('0x33')][_0x3f67('0x1d')]);}_0x15dd4a[_0x3f67('0x37')]=qs[_0x3f67('0x38')](_0x37cc1a['query']['sort']);_0x15dd4a[_0x3f67('0x39')]=qs[_0x3f67('0x31')](_[_0x3f67('0x3a')](_0x37cc1a['query'],_0x5578fa['filters']),_0xc2d5a3);if(_0x37cc1a['query'][_0x3f67('0x3b')]){_0x15dd4a[_0x3f67('0x39')]=_[_0x3f67('0x3c')](_0x15dd4a['where'],{'$or':_['map'](_0xc2d5a3,function(_0x5d68ec){if(_0x5d68ec[_0x3f67('0x3d')]!==_0x3f67('0x3e')){var _0x5aff57={};_0x5aff57[_0x5d68ec[_0x3f67('0x29')]]={'$like':'%'+_0x37cc1a[_0x3f67('0x33')][_0x3f67('0x3b')]+'%'};return _0x5aff57;}})});}_0x15dd4a=_[_0x3f67('0x3c')]({},_0x15dd4a,_0x37cc1a['options']);var _0x34662d={'where':_0x15dd4a['where']};return db['VoiceQueueReport'][_0x3f67('0x20')](_0x34662d)[_0x3f67('0x26')](function(_0x35644f){_0x14b0e4['count']=_0x35644f;if(_0x37cc1a[_0x3f67('0x33')][_0x3f67('0x3f')]){_0x15dd4a[_0x3f67('0x40')]=[{'all':!![]}];}return db[_0x3f67('0x2c')][_0x3f67('0x41')](_0x15dd4a);})[_0x3f67('0x26')](function(_0x285846){_0x14b0e4['rows']=_0x285846;return _0x14b0e4;})[_0x3f67('0x26')](respondWithFilteredResult(_0x27acb2,_0x15dd4a))['catch'](handleError(_0x27acb2,null));};exports[_0x3f67('0x42')]=function(_0x5b3621,_0x2c1a8d){var _0x2a04a4={'raw':![],'where':{'id':_0x5b3621[_0x3f67('0x43')]['id']}},_0x2a66c7={};_0x2a66c7[_0x3f67('0x30')]=_[_0x3f67('0x44')](db['VoiceQueueReport'][_0x3f67('0x2d')]);_0x2a66c7[_0x3f67('0x33')]=_['keys'](_0x5b3621[_0x3f67('0x33')]);_0x2a66c7[_0x3f67('0x31')]=_[_0x3f67('0x32')](_0x2a66c7[_0x3f67('0x30')],_0x2a66c7[_0x3f67('0x33')]);_0x2a04a4['attributes']=_[_0x3f67('0x32')](_0x2a66c7[_0x3f67('0x30')],qs[_0x3f67('0x45')](_0x5b3621[_0x3f67('0x33')][_0x3f67('0x45')]));_0x2a04a4['attributes']=_0x2a04a4[_0x3f67('0x34')][_0x3f67('0x35')]?_0x2a04a4['attributes']:_0x2a66c7[_0x3f67('0x30')];if(_0x5b3621[_0x3f67('0x33')][_0x3f67('0x3f')]){_0x2a04a4[_0x3f67('0x40')]=[{'all':!![]}];}_0x2a04a4=_['merge']({},_0x2a04a4,_0x5b3621[_0x3f67('0x46')]);return db[_0x3f67('0x2c')]['find'](_0x2a04a4)['then'](handleEntityNotFound(_0x2c1a8d,null))['then'](respondWithResult(_0x2c1a8d,null))['catch'](handleError(_0x2c1a8d,null));};exports['create']=function(_0x5cf09a,_0x19ff67){return db[_0x3f67('0x2c')][_0x3f67('0x47')](_0x5cf09a[_0x3f67('0x48')],{})[_0x3f67('0x26')](respondWithResult(_0x19ff67,0xc9))[_0x3f67('0x49')](handleError(_0x19ff67,null));};exports[_0x3f67('0x25')]=function(_0x49d57c,_0x429707){if(_0x49d57c[_0x3f67('0x48')]['id']){delete _0x49d57c[_0x3f67('0x48')]['id'];}return db[_0x3f67('0x2c')][_0x3f67('0x4a')]({'where':{'id':_0x49d57c[_0x3f67('0x43')]['id']}})[_0x3f67('0x26')](handleEntityNotFound(_0x429707,null))[_0x3f67('0x26')](saveUpdates(_0x49d57c[_0x3f67('0x48')],null))[_0x3f67('0x26')](respondWithResult(_0x429707,null))[_0x3f67('0x49')](handleError(_0x429707,null));};exports[_0x3f67('0x27')]=function(_0x382325,_0x4e8f4b){return db['VoiceQueueReport'][_0x3f67('0x4a')]({'where':{'id':_0x382325[_0x3f67('0x43')]['id']}})[_0x3f67('0x26')](handleEntityNotFound(_0x4e8f4b,null))['then'](removeEntity(_0x4e8f4b,null))[_0x3f67('0x49')](handleError(_0x4e8f4b,null));};exports[_0x3f67('0x4b')]=function(_0x1a0795,_0x2badea){return db[_0x3f67('0x2c')][_0x3f67('0x4b')]()[_0x3f67('0x26')](respondWithResult(_0x2badea,null))[_0x3f67('0x49')](handleError(_0x2badea,null));};exports[_0x3f67('0x4c')]=function(_0x552162,_0xfe700e){var _0x1666f2={},_0x4fa6d8={},_0x1d67cb={'count':0x0,'rows':[]};_0x4fa6d8['model']=_[_0x3f67('0x44')](db[_0x3f67('0x2c')][_0x3f67('0x2d')]);_0x4fa6d8[_0x3f67('0x33')]=_[_0x3f67('0x44')](_0x552162[_0x3f67('0x33')]);_0x4fa6d8[_0x3f67('0x31')]=_[_0x3f67('0x32')](_0x4fa6d8[_0x3f67('0x30')],_0x4fa6d8['query']);_0x1666f2['attributes']=_[_0x3f67('0x32')](_0x4fa6d8[_0x3f67('0x30')],qs[_0x3f67('0x45')](_0x552162['query'][_0x3f67('0x45')]));_0x1666f2[_0x3f67('0x34')]=_0x1666f2['attributes']['length']?_0x1666f2['attributes']:_0x4fa6d8[_0x3f67('0x30')];if(!_0x552162[_0x3f67('0x33')][_0x3f67('0x36')]('nolimit')){_0x1666f2[_0x3f67('0x1e')]=qs[_0x3f67('0x1e')](_0x552162['query'][_0x3f67('0x1e')]);_0x1666f2[_0x3f67('0x1d')]=qs[_0x3f67('0x1d')](_0x552162['query']['offset']);}_0x1666f2[_0x3f67('0x37')]=qs[_0x3f67('0x38')](_0x552162[_0x3f67('0x33')]['sort']);_0x1666f2['where']=qs[_0x3f67('0x31')](_[_0x3f67('0x3a')](_0x552162[_0x3f67('0x33')],_0x4fa6d8[_0x3f67('0x31')]));if(_0x552162[_0x3f67('0x33')]['filter']){_0x1666f2[_0x3f67('0x39')]=_[_0x3f67('0x3c')](_0x1666f2[_0x3f67('0x39')],{'$or':_[_0x3f67('0x2b')](_0x1666f2[_0x3f67('0x34')],function(_0x46b3c1){var _0x517b90={};_0x517b90[_0x46b3c1]={'$like':'%'+_0x552162[_0x3f67('0x33')][_0x3f67('0x3b')]+'%'};return _0x517b90;})});}_0x1666f2=_[_0x3f67('0x3c')]({},_0x1666f2,_0x552162[_0x3f67('0x46')]);var _0x12f06e={'where':_0x1666f2[_0x3f67('0x39')]};return db[_0x3f67('0x2c')][_0x3f67('0x20')](_0x12f06e)[_0x3f67('0x26')](function(_0x4b9b5f){_0x1d67cb[_0x3f67('0x20')]=_0x4b9b5f;if(_0x552162[_0x3f67('0x33')][_0x3f67('0x3f')]){_0x1666f2[_0x3f67('0x40')]=[{'all':!![]}];}return db[_0x3f67('0x2c')][_0x3f67('0x41')](_0x1666f2);})[_0x3f67('0x26')](function(_0x30f322){_0x1d67cb[_0x3f67('0x4d')]=_0x30f322;return _0x1d67cb;})[_0x3f67('0x26')](respondWithFilteredResult(_0xfe700e,_0x1666f2,_0x3f67('0x4c')))[_0x3f67('0x49')](handleError(_0xfe700e,null,_0x3f67('0x4c')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 83f3a13..aad14d5 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 _0x4720=['remove','emit','hook','../../mysqldb','VoiceQueueReport','save','update'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0x4720,0x11b));var _0x0472=function(_0xff5df6,_0x514e73){_0xff5df6=_0xff5df6-0x0;var _0x2634bb=_0x4720[_0xff5df6];return _0x2634bb;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x0472('0x0'))['db'][_0x0472('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0472('0x2'),'afterUpdate':_0x0472('0x3'),'afterDestroy':_0x0472('0x4')};function emitEvent(_0x54846c){return function(_0x2b6015,_0x25ace6,_0x1c25db){VoiceQueueReportEvents[_0x0472('0x5')](_0x54846c+':'+_0x2b6015['id'],_0x2b6015);VoiceQueueReportEvents[_0x0472('0x5')](_0x54846c,_0x2b6015);_0x1c25db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x0472('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x4c6c=['hook','exports','events','VoiceQueueReport','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x2e4fc0,_0x357302){var _0xee288=function(_0x12db53){while(--_0x12db53){_0x2e4fc0['push'](_0x2e4fc0['shift']());}};_0xee288(++_0x357302);}(_0x4c6c,0x1ea));var _0xc4c6=function(_0x471db6,_0x59aa0d){_0x471db6=_0x471db6-0x0;var _0x2d98b3=_0x4c6c[_0x471db6];return _0x2d98b3;};'use strict';var EventEmitter=require(_0xc4c6('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xc4c6('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc4c6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc4c6('0x3')};function emitEvent(_0x3b9912){return function(_0x312008,_0x24db48,_0x237065){VoiceQueueReportEvents['emit'](_0x3b9912+':'+_0x312008['id'],_0x312008);VoiceQueueReportEvents[_0xc4c6('0x4')](_0x3b9912,_0x312008);_0x237065(null);};}for(var e in events){if(events[_0xc4c6('0x5')](e)){var event=events[e];VoiceQueueReport[_0xc4c6('0x6')](e,emitEvent(event));}}module[_0xc4c6('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index d9b8d9d..ede22b0 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 _0xb066=['rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','util','../../config/logger','bluebird','request-promise','path'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xb066,0x1c9));var _0x6b06=function(_0xe9bc1c,_0x3934c3){_0xe9bc1c=_0xe9bc1c-0x0;var _0x377d54=_0xb066[_0xe9bc1c];return _0x377d54;};'use strict';var _=require('lodash');var util=require(_0x6b06('0x0'));var logger=require(_0x6b06('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6b06('0x2'));var rp=require(_0x6b06('0x3'));var fs=require('fs');var path=require(_0x6b06('0x4'));var rimraf=require(_0x6b06('0x5'));var config=require(_0x6b06('0x6'));var attributes=require(_0x6b06('0x7'));module[_0x6b06('0x8')]=function(_0xa85096,_0x1e303d){return _0xa85096[_0x6b06('0x9')]('VoiceQueueReport',attributes,{'tableName':_0x6b06('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xea2b=['moment','bluebird','request-promise','path','rimraf','exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','util','../../config/logger'];(function(_0x489ba5,_0xa1a03c){var _0x3727e9=function(_0x53613e){while(--_0x53613e){_0x489ba5['push'](_0x489ba5['shift']());}};_0x3727e9(++_0xa1a03c);}(_0xea2b,0x1de));var _0xbea2=function(_0x203f03,_0x33aafc){_0x203f03=_0x203f03-0x0;var _0x28879a=_0xea2b[_0x203f03];return _0x28879a;};'use strict';var _=require(_0xbea2('0x0'));var util=require(_0xbea2('0x1'));var logger=require(_0xbea2('0x2'))('api');var moment=require(_0xbea2('0x3'));var BPromise=require(_0xbea2('0x4'));var rp=require(_0xbea2('0x5'));var fs=require('fs');var path=require(_0xbea2('0x6'));var rimraf=require(_0xbea2('0x7'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xbea2('0x8')]=function(_0x5f37d2,_0x20927a){return _0x5f37d2[_0xbea2('0x9')](_0xbea2('0xa'),attributes,{'tableName':_0xbea2('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xbea2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 1736e99..7bfa650 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 _0x3e96=['stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x4b6a9c,_0x2a5b60){var _0x1b8586=function(_0x47a6b0){while(--_0x47a6b0){_0x4b6a9c['push'](_0x4b6a9c['shift']());}};_0x1b8586(++_0x2a5b60);}(_0x3e96,0x1ee));var _0x63e9=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0x3e96[_0x585ee5];return _0x470808;};'use strict';var _=require(_0x63e9('0x0'));var util=require(_0x63e9('0x1'));var moment=require(_0x63e9('0x2'));var BPromise=require(_0x63e9('0x3'));var rs=require(_0x63e9('0x4'));var fs=require('fs');var Redis=require(_0x63e9('0x5'));var db=require(_0x63e9('0x6'))['db'];var utils=require(_0x63e9('0x7'));var logger=require(_0x63e9('0x8'))(_0x63e9('0x9'));var config=require(_0x63e9('0xa'));var jayson=require(_0x63e9('0xb'));var client=jayson[_0x63e9('0xc')][_0x63e9('0xd')]({'port':0x232a});config[_0x63e9('0xe')]=_['defaults'](config['redis'],{'host':_0x63e9('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x63e9('0xe')]));require('./voiceQueueReport.socket')[_0x63e9('0x10')](socket);function respondWithRpcPromise(_0x42a71d,_0x2182f1,_0xf31053){return new BPromise(function(_0x2a1615,_0x1ca4cc){return client['request'](_0x42a71d,_0xf31053)['then'](function(_0x5100e8){logger[_0x63e9('0x11')](_0x63e9('0x12'),_0x2182f1,_0x63e9('0x13'));logger[_0x63e9('0x14')](_0x63e9('0x15'),_0x2182f1,_0x63e9('0x13'),JSON[_0x63e9('0x16')](_0x5100e8));if(_0x5100e8[_0x63e9('0x17')]){if(_0x5100e8['error'][_0x63e9('0x18')]===0x1f4){logger[_0x63e9('0x17')](_0x63e9('0x12'),_0x2182f1,_0x5100e8[_0x63e9('0x17')][_0x63e9('0x19')]);return _0x1ca4cc(_0x5100e8[_0x63e9('0x17')]['message']);}logger[_0x63e9('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x2182f1,_0x5100e8[_0x63e9('0x17')]['message']);return _0x2a1615(_0x5100e8[_0x63e9('0x17')][_0x63e9('0x19')]);}else{logger[_0x63e9('0x11')](_0x63e9('0x12'),_0x2182f1,_0x63e9('0x13'));_0x2a1615(_0x5100e8[_0x63e9('0x1a')][_0x63e9('0x19')]);}})[_0x63e9('0x1b')](function(_0x3ec5b6){logger[_0x63e9('0x17')](_0x63e9('0x12'),_0x2182f1,_0x3ec5b6);_0x1ca4cc(_0x3ec5b6);});});}exports[_0x63e9('0x1c')]=function(_0xc0e269){var _0x55f80f=this;return new Promise(function(_0x2a49f0,_0x925bf){return db[_0x63e9('0x1d')][_0x63e9('0x1e')]({'raw':_0xc0e269[_0x63e9('0x1f')]?_0xc0e269[_0x63e9('0x1f')][_0x63e9('0x20')]===undefined?!![]:![]:!![],'where':_0xc0e269[_0x63e9('0x1f')]?_0xc0e269[_0x63e9('0x1f')][_0x63e9('0x21')]||null:null,'attributes':_0xc0e269[_0x63e9('0x1f')]?_0xc0e269['options'][_0x63e9('0x22')]||null:null,'limit':_0xc0e269[_0x63e9('0x1f')]?_0xc0e269[_0x63e9('0x1f')][_0x63e9('0x23')]||null:null,'include':_0xc0e269[_0x63e9('0x1f')]?_0xc0e269[_0x63e9('0x1f')][_0x63e9('0x24')]?_[_0x63e9('0x25')](_0xc0e269['options'][_0x63e9('0x24')],function(_0x5bf85b){return{'model':db[_0x5bf85b[_0x63e9('0x26')]],'as':_0x5bf85b['as'],'attributes':_0x5bf85b['attributes'],'include':_0x5bf85b[_0x63e9('0x24')]?_['map'](_0x5bf85b['include'],function(_0x81e0ce){return{'model':db[_0x81e0ce['model']],'as':_0x81e0ce['as'],'attributes':_0x81e0ce[_0x63e9('0x22')],'include':_0x81e0ce[_0x63e9('0x24')]?_[_0x63e9('0x25')](_0x81e0ce[_0x63e9('0x24')],function(_0x3575d7){return{'model':db[_0x3575d7[_0x63e9('0x26')]],'as':_0x3575d7['as'],'attributes':_0x3575d7[_0x63e9('0x22')]};}):[]};}):[]};}):[]:[]})[_0x63e9('0x27')](function(_0x37a4b9){logger[_0x63e9('0x11')](_0x63e9('0x1c'),_0xc0e269);logger[_0x63e9('0x14')](_0x63e9('0x1c'),_0xc0e269,JSON[_0x63e9('0x16')](_0x37a4b9));_0x2a49f0(_0x37a4b9);})[_0x63e9('0x1b')](function(_0x17c94f){logger[_0x63e9('0x17')](_0x63e9('0x1c'),_0x17c94f[_0x63e9('0x19')],_0xc0e269);_0x925bf(_0x55f80f[_0x63e9('0x17')](0x1f4,_0x17c94f[_0x63e9('0x19')]));});});};exports[_0x63e9('0x28')]=function(_0x203639){var _0x2f99da=this;return new Promise(function(_0x2b45f9,_0x572b82){return db['VoiceQueueReport']['create'](_0x203639[_0x63e9('0x29')],{'raw':_0x203639[_0x63e9('0x1f')]?_0x203639[_0x63e9('0x1f')][_0x63e9('0x20')]===undefined?!![]:![]:!![]})[_0x63e9('0x27')](function(_0x470a37){logger[_0x63e9('0x11')](_0x63e9('0x28'),_0x203639);logger['debug'](_0x63e9('0x28'),_0x203639,JSON['stringify'](_0x470a37));_0x2b45f9(_0x470a37);})['catch'](function(_0x96c9de){logger[_0x63e9('0x17')](_0x63e9('0x28'),_0x96c9de[_0x63e9('0x19')],_0x203639);_0x572b82(_0x2f99da[_0x63e9('0x17')](0x1f4,_0x96c9de['message']));});});};exports[_0x63e9('0x2a')]=function(_0x5540f0){var _0x3e210e=this;return new Promise(function(_0xbddacc,_0xd10c08){return db[_0x63e9('0x1d')]['update'](_0x5540f0[_0x63e9('0x29')],{'raw':_0x5540f0['options']?_0x5540f0['options'][_0x63e9('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5540f0[_0x63e9('0x1f')]?_0x5540f0[_0x63e9('0x1f')][_0x63e9('0x21')]||null:null,'attributes':_0x5540f0['options']?_0x5540f0[_0x63e9('0x1f')][_0x63e9('0x22')]||null:null,'limit':_0x5540f0['options']?_0x5540f0[_0x63e9('0x1f')][_0x63e9('0x23')]||null:null})[_0x63e9('0x27')](function(_0x4000bf){logger[_0x63e9('0x11')](_0x63e9('0x2a'),_0x5540f0);logger['debug']('UpdateVoiceQueueReport',_0x5540f0,JSON[_0x63e9('0x16')](_0x4000bf));_0xbddacc(_0x4000bf);})[_0x63e9('0x1b')](function(_0x430d74){logger[_0x63e9('0x17')]('UpdateVoiceQueueReport',_0x430d74[_0x63e9('0x19')],_0x5540f0);_0xd10c08(_0x3e210e['error'](0x1f4,_0x430d74[_0x63e9('0x19')]));});});}; \ No newline at end of file +var _0xf933=['then','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','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','./voiceQueueReport.socket','register'];(function(_0x15b082,_0x591c06){var _0x5522cd=function(_0x4039f7){while(--_0x4039f7){_0x15b082['push'](_0x15b082['shift']());}};_0x5522cd(++_0x591c06);}(_0xf933,0x1a0));var _0x3f93=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0xf933[_0x162780];return _0x1ea2dc;};'use strict';var _=require(_0x3f93('0x0'));var util=require(_0x3f93('0x1'));var moment=require(_0x3f93('0x2'));var BPromise=require(_0x3f93('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f93('0x4'))['db'];var utils=require(_0x3f93('0x5'));var logger=require('../../config/logger')(_0x3f93('0x6'));var config=require(_0x3f93('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3f93('0x8')]({'port':0x232a});config[_0x3f93('0x9')]=_[_0x3f93('0xa')](config[_0x3f93('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f93('0x9')]));require(_0x3f93('0xb'))[_0x3f93('0xc')](socket);function respondWithRpcPromise(_0x1c522f,_0x378542,_0x60b4eb){return new BPromise(function(_0x190141,_0x639b75){return client['request'](_0x1c522f,_0x60b4eb)[_0x3f93('0xd')](function(_0x2b2f18){logger[_0x3f93('0xe')](_0x3f93('0xf'),_0x378542,_0x3f93('0x10'));logger['debug'](_0x3f93('0x11'),_0x378542,_0x3f93('0x10'),JSON[_0x3f93('0x12')](_0x2b2f18));if(_0x2b2f18['error']){if(_0x2b2f18[_0x3f93('0x13')][_0x3f93('0x14')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x378542,_0x2b2f18['error'][_0x3f93('0x15')]);return _0x639b75(_0x2b2f18['error'][_0x3f93('0x15')]);}logger[_0x3f93('0x13')](_0x3f93('0xf'),_0x378542,_0x2b2f18[_0x3f93('0x13')]['message']);return _0x190141(_0x2b2f18[_0x3f93('0x13')][_0x3f93('0x15')]);}else{logger[_0x3f93('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x378542,_0x3f93('0x10'));_0x190141(_0x2b2f18[_0x3f93('0x16')][_0x3f93('0x15')]);}})[_0x3f93('0x17')](function(_0x1726e9){logger[_0x3f93('0x13')](_0x3f93('0xf'),_0x378542,_0x1726e9);_0x639b75(_0x1726e9);});});}exports[_0x3f93('0x18')]=function(_0x4e5820){var _0x3af0e0=this;return new Promise(function(_0xe9bc89,_0x2d7dec){return db[_0x3f93('0x19')][_0x3f93('0x1a')]({'raw':_0x4e5820[_0x3f93('0x1b')]?_0x4e5820['options'][_0x3f93('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e5820['options']?_0x4e5820['options']['where']||null:null,'attributes':_0x4e5820[_0x3f93('0x1b')]?_0x4e5820[_0x3f93('0x1b')][_0x3f93('0x1d')]||null:null,'limit':_0x4e5820[_0x3f93('0x1b')]?_0x4e5820['options'][_0x3f93('0x1e')]||null:null,'include':_0x4e5820[_0x3f93('0x1b')]?_0x4e5820[_0x3f93('0x1b')][_0x3f93('0x1f')]?_['map'](_0x4e5820[_0x3f93('0x1b')][_0x3f93('0x1f')],function(_0xa18089){return{'model':db[_0xa18089['model']],'as':_0xa18089['as'],'attributes':_0xa18089[_0x3f93('0x1d')],'include':_0xa18089[_0x3f93('0x1f')]?_['map'](_0xa18089[_0x3f93('0x1f')],function(_0x4b6aa8){return{'model':db[_0x4b6aa8['model']],'as':_0x4b6aa8['as'],'attributes':_0x4b6aa8[_0x3f93('0x1d')],'include':_0x4b6aa8[_0x3f93('0x1f')]?_[_0x3f93('0x20')](_0x4b6aa8[_0x3f93('0x1f')],function(_0xeffcca){return{'model':db[_0xeffcca[_0x3f93('0x21')]],'as':_0xeffcca['as'],'attributes':_0xeffcca['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f93('0xd')](function(_0x4673eb){logger[_0x3f93('0xe')](_0x3f93('0x18'),_0x4e5820);logger[_0x3f93('0x22')](_0x3f93('0x18'),_0x4e5820,JSON[_0x3f93('0x12')](_0x4673eb));_0xe9bc89(_0x4673eb);})[_0x3f93('0x17')](function(_0x485130){logger[_0x3f93('0x13')]('GetVoiceQueueReport',_0x485130['message'],_0x4e5820);_0x2d7dec(_0x3af0e0[_0x3f93('0x13')](0x1f4,_0x485130[_0x3f93('0x15')]));});});};exports[_0x3f93('0x23')]=function(_0x50615c){var _0x49fc23=this;return new Promise(function(_0x58a3d6,_0x2c482b){return db['VoiceQueueReport'][_0x3f93('0x24')](_0x50615c['body'],{'raw':_0x50615c[_0x3f93('0x1b')]?_0x50615c[_0x3f93('0x1b')][_0x3f93('0x1c')]===undefined?!![]:![]:!![]})[_0x3f93('0xd')](function(_0x44a0a9){logger['info'](_0x3f93('0x23'),_0x50615c);logger['debug']('CreateVoiceQueueReport',_0x50615c,JSON[_0x3f93('0x12')](_0x44a0a9));_0x58a3d6(_0x44a0a9);})[_0x3f93('0x17')](function(_0x59f7f7){logger[_0x3f93('0x13')](_0x3f93('0x23'),_0x59f7f7[_0x3f93('0x15')],_0x50615c);_0x2c482b(_0x49fc23[_0x3f93('0x13')](0x1f4,_0x59f7f7[_0x3f93('0x15')]));});});};exports[_0x3f93('0x25')]=function(_0x58b727){var _0x2c44aa=this;return new Promise(function(_0x316c55,_0x46f177){return db[_0x3f93('0x19')]['update'](_0x58b727['body'],{'raw':_0x58b727[_0x3f93('0x1b')]?_0x58b727[_0x3f93('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58b727['options']?_0x58b727['options'][_0x3f93('0x26')]||null:null,'attributes':_0x58b727[_0x3f93('0x1b')]?_0x58b727[_0x3f93('0x1b')][_0x3f93('0x1d')]||null:null,'limit':_0x58b727[_0x3f93('0x1b')]?_0x58b727[_0x3f93('0x1b')]['limit']||null:null})[_0x3f93('0xd')](function(_0x33a6b9){logger[_0x3f93('0xe')]('UpdateVoiceQueueReport',_0x58b727);logger['debug']('UpdateVoiceQueueReport',_0x58b727,JSON[_0x3f93('0x12')](_0x33a6b9));_0x316c55(_0x33a6b9);})['catch'](function(_0x5cbd14){logger[_0x3f93('0x13')](_0x3f93('0x25'),_0x5cbd14[_0x3f93('0x15')],_0x58b727);_0x46f177(_0x2c44aa[_0x3f93('0x13')](0x1f4,_0x5cbd14[_0x3f93('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 444d25c..c1f9d61 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 _0x448a=['removeListener','register','length','save','remove','emit'];(function(_0x13b948,_0x2a5a86){var _0x2f0044=function(_0xc63313){while(--_0xc63313){_0x13b948['push'](_0x13b948['shift']());}};_0x2f0044(++_0x2a5a86);}(_0x448a,0x1ef));var _0xa448=function(_0x1528ba,_0x30ea58){_0x1528ba=_0x1528ba-0x0;var _0x596f42=_0x448a[_0x1528ba];return _0x596f42;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xa448('0x0'),_0xa448('0x1'),'update'];function createListener(_0x3f08b0,_0x47909c){return function(_0x5ea7f4){_0x47909c[_0xa448('0x2')](_0x3f08b0,_0x5ea7f4);};}function removeListener(_0x3206fd,_0x57e1ea){return function(){VoiceQueueReportEvents[_0xa448('0x3')](_0x3206fd,_0x57e1ea);};}exports[_0xa448('0x4')]=function(_0x343b79){for(var _0x2c16e3=0x0,_0x12b0e2=events[_0xa448('0x5')];_0x2c16e3<_0x12b0e2;_0x2c16e3++){var _0x1ec2d8=events[_0x2c16e3];var _0x54bdb0=createListener('voiceQueueReport:'+_0x1ec2d8,_0x343b79);VoiceQueueReportEvents['on'](_0x1ec2d8,_0x54bdb0);}}; \ No newline at end of file +var _0x65ac=['save','remove','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x51c179,_0x4b6dc1){var _0x48f84f=function(_0x11d43f){while(--_0x11d43f){_0x51c179['push'](_0x51c179['shift']());}};_0x48f84f(++_0x4b6dc1);}(_0x65ac,0x100));var _0xc65a=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x65ac[_0x5608a3];return _0x1ed50a;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xc65a('0x0'),_0xc65a('0x1'),_0xc65a('0x2')];function createListener(_0x513bbe,_0x33fbff){return function(_0x4ac309){_0x33fbff[_0xc65a('0x3')](_0x513bbe,_0x4ac309);};}function removeListener(_0x5d98ec,_0x3d84d6){return function(){VoiceQueueReportEvents[_0xc65a('0x4')](_0x5d98ec,_0x3d84d6);};}exports[_0xc65a('0x5')]=function(_0x25abc5){for(var _0x979e5b=0x0,_0x34e48b=events[_0xc65a('0x6')];_0x979e5b<_0x34e48b;_0x979e5b++){var _0x1cbea3=events[_0x979e5b];var _0x29d016=createListener(_0xc65a('0x7')+_0x1cbea3,_0x25abc5);VoiceQueueReportEvents['on'](_0x1cbea3,_0x29d016);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 6ce9661..af5cac8 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 _0xb477=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0xb477,0xac));var _0x7b47=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xb477[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0x7b47('0x0'));var util=require(_0x7b47('0x1'));var path=require(_0x7b47('0x2'));var timeout=require(_0x7b47('0x3'));var express=require('express');var router=express[_0x7b47('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7b47('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7b47('0x6'));var controller=require(_0x7b47('0x7'));router['get']('/',auth[_0x7b47('0x8')](),controller['index']);router[_0x7b47('0x9')](_0x7b47('0xa'),auth[_0x7b47('0x8')](),controller[_0x7b47('0xb')]);router[_0x7b47('0xc')]('/',auth[_0x7b47('0x8')](),controller[_0x7b47('0xd')]);router[_0x7b47('0xe')](_0x7b47('0xa'),auth[_0x7b47('0x8')](),controller[_0x7b47('0xf')]);router[_0x7b47('0x10')]('/:id',auth[_0x7b47('0x8')](),controller[_0x7b47('0x11')]);module[_0x7b47('0x12')]=router; \ No newline at end of file +var _0x953e=['index','/:id','isAuthenticated','show','post','create','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x552dc3,_0x475401){var _0x495c3a=function(_0x55827d){while(--_0x55827d){_0x552dc3['push'](_0x552dc3['shift']());}};_0x495c3a(++_0x475401);}(_0x953e,0xc6));var _0xe953=function(_0x1cf1cd,_0x3677b4){_0x1cf1cd=_0x1cf1cd-0x0;var _0x2682ae=_0x953e[_0x1cf1cd];return _0x2682ae;};'use strict';var multer=require(_0xe953('0x0'));var util=require(_0xe953('0x1'));var path=require(_0xe953('0x2'));var timeout=require(_0xe953('0x3'));var express=require(_0xe953('0x4'));var router=express['Router']();var fs_extra=require(_0xe953('0x5'));var auth=require(_0xe953('0x6'));var interaction=require(_0xe953('0x7'));var config=require(_0xe953('0x8'));var controller=require(_0xe953('0x9'));router[_0xe953('0xa')]('/',auth['isAuthenticated'](),controller[_0xe953('0xb')]);router[_0xe953('0xa')](_0xe953('0xc'),auth[_0xe953('0xd')](),controller[_0xe953('0xe')]);router[_0xe953('0xf')]('/',auth[_0xe953('0xd')](),controller[_0xe953('0x10')]);router[_0xe953('0x11')](_0xe953('0xc'),auth[_0xe953('0xd')](),controller['update']);router['delete'](_0xe953('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe953('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 2f87ed0..8092267 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 _0x0e17=['moment','STRING','sequelize'];(function(_0x3e3edc,_0x4743ca){var _0xd6ffd=function(_0x4bb7d7){while(--_0x4bb7d7){_0x3e3edc['push'](_0x3e3edc['shift']());}};_0xd6ffd(++_0x4743ca);}(_0x0e17,0x83));var _0x70e1=function(_0x291474,_0x2702e7){_0x291474=_0x291474-0x0;var _0x265e24=_0x0e17[_0x291474];return _0x265e24;};'use strict';var Sequelize=require(_0x70e1('0x0'));var moment=require(_0x70e1('0x1'));module['exports']={'time':{'type':Sequelize[_0x70e1('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x76d3=['format','moment','exports','STRING','DATE'];(function(_0xcd5c68,_0x6fa052){var _0x199cdc=function(_0xe6f040){while(--_0xe6f040){_0xcd5c68['push'](_0xcd5c68['shift']());}};_0x199cdc(++_0x6fa052);}(_0x76d3,0x12d));var _0x376d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x76d3[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x376d('0x0'));module[_0x376d('0x1')]={'time':{'type':Sequelize[_0x376d('0x2')]},'callid':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x376d('0x3')],'allowNull':![],'defaultValue':moment()[_0x376d('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f58432d..97a9936 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 _0xc9b3=['key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','catch','show','params','keys','rawAttributes','intersection','length','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','name','send','index','map','VoiceQueuesLog','fieldName','type'];(function(_0x2da8a0,_0x4e5f10){var _0x3be812=function(_0x4984cd){while(--_0x4984cd){_0x2da8a0['push'](_0x2da8a0['shift']());}};_0x3be812(++_0x4e5f10);}(_0xc9b3,0xb0));var _0x3c9b=function(_0x197ca0,_0x4bf088){_0x197ca0=_0x197ca0-0x0;var _0x55858d=_0xc9b3[_0x197ca0];return _0x55858d;};'use strict';var emlformat=require(_0x3c9b('0x0'));var rimraf=require(_0x3c9b('0x1'));var zipdir=require(_0x3c9b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c9b('0x3'));var moment=require(_0x3c9b('0x4'));var BPromise=require(_0x3c9b('0x5'));var Mustache=require('mustache');var util=require(_0x3c9b('0x6'));var path=require('path');var sox=require(_0x3c9b('0x7'));var csv=require('to-csv');var ejs=require(_0x3c9b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c9b('0x9'));var squel=require(_0x3c9b('0xa'));var crypto=require(_0x3c9b('0xb'));var jsforce=require(_0x3c9b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c9b('0xd'));var querystring=require(_0x3c9b('0xe'));var Papa=require('papaparse');var Redis=require(_0x3c9b('0xf'));var authService=require(_0x3c9b('0x10'));var qs=require(_0x3c9b('0x11'));var as=require(_0x3c9b('0x12'));var hardwareService=require(_0x3c9b('0x13'));var logger=require(_0x3c9b('0x14'))(_0x3c9b('0x15'));var utils=require('../../config/utils');var config=require(_0x3c9b('0x16'));var licenseUtil=require(_0x3c9b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8d1ce9,_0x4f88a5){_0x4f88a5=_0x4f88a5||0xcc;return function(_0x5c27b4){if(_0x5c27b4){return _0x8d1ce9[_0x3c9b('0x18')](_0x4f88a5);}return _0x8d1ce9[_0x3c9b('0x19')](_0x4f88a5)[_0x3c9b('0x1a')]();};}function respondWithResult(_0x5e9851,_0x313b5c){_0x313b5c=_0x313b5c||0xc8;return function(_0x6d02bc){if(_0x6d02bc){return _0x5e9851[_0x3c9b('0x19')](_0x313b5c)['json'](_0x6d02bc);}};}function respondWithFilteredResult(_0x5d652b,_0x2eab58){return function(_0x25b6eb){if(_0x25b6eb){var _0x30f568=typeof _0x2eab58[_0x3c9b('0x1b')]===_0x3c9b('0x1c')&&typeof _0x2eab58[_0x3c9b('0x1d')]==='undefined';var _0x536d15=_0x25b6eb['count'];var _0x3347ee=_0x30f568?0x0:_0x2eab58['offset'];var _0x493702=_0x30f568?_0x25b6eb[_0x3c9b('0x1e')]:_0x2eab58[_0x3c9b('0x1b')]+_0x2eab58[_0x3c9b('0x1d')];var _0x34ef22;if(_0x493702>=_0x536d15){_0x493702=_0x536d15;_0x34ef22=0xc8;}else{_0x34ef22=0xce;}_0x5d652b[_0x3c9b('0x19')](_0x34ef22);return _0x5d652b[_0x3c9b('0x1f')](_0x3c9b('0x20'),_0x3347ee+'-'+_0x493702+'/'+_0x536d15)['json'](_0x25b6eb);}return null;};}function patchUpdates(_0x4cae52){return function(_0x32ff22){try{jsonpatch[_0x3c9b('0x21')](_0x32ff22,_0x4cae52,!![]);}catch(_0x55b487){return BPromise[_0x3c9b('0x22')](_0x55b487);}return _0x32ff22[_0x3c9b('0x23')]();};}function saveUpdates(_0x4438d7,_0x44f8b1){return function(_0x29e3df){if(_0x29e3df){return _0x29e3df[_0x3c9b('0x24')](_0x4438d7)['then'](function(_0x1b51b6){return _0x1b51b6;});}return null;};}function removeEntity(_0x289520,_0x57b6cd){return function(_0x7ec580){if(_0x7ec580){return _0x7ec580[_0x3c9b('0x25')]()['then'](function(){_0x289520['status'](0xcc)[_0x3c9b('0x1a')]();});}};}function handleEntityNotFound(_0x55c4bf,_0x5a950f){return function(_0x11b8be){if(!_0x11b8be){_0x55c4bf[_0x3c9b('0x18')](0x194);}return _0x11b8be;};}function handleError(_0x4387e9,_0x4950f0){_0x4950f0=_0x4950f0||0x1f4;return function(_0x308f94){logger[_0x3c9b('0x26')](_0x308f94['stack']);if(_0x308f94[_0x3c9b('0x27')]){delete _0x308f94[_0x3c9b('0x27')];}_0x4387e9[_0x3c9b('0x19')](_0x4950f0)[_0x3c9b('0x28')](_0x308f94);};}exports[_0x3c9b('0x29')]=function(_0x4f0a1b,_0x1a5541){var _0x4a4bf0={},_0x3ccd02={},_0x563eff={'count':0x0,'rows':[]};var _0x59c135=_[_0x3c9b('0x2a')](db[_0x3c9b('0x2b')]['rawAttributes'],function(_0x1d51a8){return{'name':_0x1d51a8[_0x3c9b('0x2c')],'type':_0x1d51a8[_0x3c9b('0x2d')][_0x3c9b('0x2e')]};});_0x3ccd02[_0x3c9b('0x2f')]=_[_0x3c9b('0x2a')](_0x59c135,_0x3c9b('0x27'));_0x3ccd02['query']=_['keys'](_0x4f0a1b[_0x3c9b('0x30')]);_0x3ccd02[_0x3c9b('0x31')]=_['intersection'](_0x3ccd02[_0x3c9b('0x2f')],_0x3ccd02['query']);_0x4a4bf0[_0x3c9b('0x32')]=_['intersection'](_0x3ccd02['model'],qs[_0x3c9b('0x33')](_0x4f0a1b[_0x3c9b('0x30')][_0x3c9b('0x33')]));_0x4a4bf0[_0x3c9b('0x32')]=_0x4a4bf0['attributes']['length']?_0x4a4bf0['attributes']:_0x3ccd02[_0x3c9b('0x2f')];if(!_0x4f0a1b[_0x3c9b('0x30')][_0x3c9b('0x34')](_0x3c9b('0x35'))){_0x4a4bf0[_0x3c9b('0x1d')]=qs[_0x3c9b('0x1d')](_0x4f0a1b[_0x3c9b('0x30')]['limit']);_0x4a4bf0[_0x3c9b('0x1b')]=qs['offset'](_0x4f0a1b[_0x3c9b('0x30')]['offset']);}_0x4a4bf0['order']=qs[_0x3c9b('0x36')](_0x4f0a1b[_0x3c9b('0x30')][_0x3c9b('0x36')]);_0x4a4bf0[_0x3c9b('0x37')]=qs[_0x3c9b('0x31')](_['pick'](_0x4f0a1b['query'],_0x3ccd02[_0x3c9b('0x31')]),_0x59c135);if(_0x4f0a1b['query']['filter']){_0x4a4bf0[_0x3c9b('0x37')]=_[_0x3c9b('0x38')](_0x4a4bf0[_0x3c9b('0x37')],{'$or':_[_0x3c9b('0x2a')](_0x59c135,function(_0x4ede19){if(_0x4ede19[_0x3c9b('0x2d')]!==_0x3c9b('0x39')){var _0x3675a5={};_0x3675a5[_0x4ede19[_0x3c9b('0x27')]]={'$like':'%'+_0x4f0a1b[_0x3c9b('0x30')][_0x3c9b('0x3a')]+'%'};return _0x3675a5;}})});}_0x4a4bf0=_[_0x3c9b('0x38')]({},_0x4a4bf0,_0x4f0a1b[_0x3c9b('0x3b')]);var _0x250f43={'where':_0x4a4bf0['where']};return db['VoiceQueuesLog']['count'](_0x250f43)[_0x3c9b('0x3c')](function(_0x4c0fb1){_0x563eff[_0x3c9b('0x1e')]=_0x4c0fb1;if(_0x4f0a1b['query'][_0x3c9b('0x3d')]){_0x4a4bf0[_0x3c9b('0x3e')]=[{'all':!![]}];}return db[_0x3c9b('0x2b')][_0x3c9b('0x3f')](_0x4a4bf0);})[_0x3c9b('0x3c')](function(_0x44e383){_0x563eff['rows']=_0x44e383;return _0x563eff;})[_0x3c9b('0x3c')](respondWithFilteredResult(_0x1a5541,_0x4a4bf0))[_0x3c9b('0x40')](handleError(_0x1a5541,null));};exports[_0x3c9b('0x41')]=function(_0x35a3a3,_0x15a771){var _0xa27e82={'raw':!![],'where':{'id':_0x35a3a3[_0x3c9b('0x42')]['id']}},_0xd70f17={};_0xd70f17['model']=_[_0x3c9b('0x43')](db[_0x3c9b('0x2b')][_0x3c9b('0x44')]);_0xd70f17[_0x3c9b('0x30')]=_['keys'](_0x35a3a3['query']);_0xd70f17[_0x3c9b('0x31')]=_[_0x3c9b('0x45')](_0xd70f17[_0x3c9b('0x2f')],_0xd70f17['query']);_0xa27e82[_0x3c9b('0x32')]=_['intersection'](_0xd70f17[_0x3c9b('0x2f')],qs[_0x3c9b('0x33')](_0x35a3a3['query'][_0x3c9b('0x33')]));_0xa27e82['attributes']=_0xa27e82[_0x3c9b('0x32')][_0x3c9b('0x46')]?_0xa27e82[_0x3c9b('0x32')]:_0xd70f17['model'];if(_0x35a3a3[_0x3c9b('0x30')]['includeAll']){_0xa27e82[_0x3c9b('0x3e')]=[{'all':!![]}];}_0xa27e82=_[_0x3c9b('0x38')]({},_0xa27e82,_0x35a3a3['options']);return db[_0x3c9b('0x2b')]['find'](_0xa27e82)['then'](handleEntityNotFound(_0x15a771,null))[_0x3c9b('0x3c')](respondWithResult(_0x15a771,null))[_0x3c9b('0x40')](handleError(_0x15a771,null));};exports[_0x3c9b('0x47')]=function(_0x239da1,_0x1e7ed0){return db[_0x3c9b('0x2b')][_0x3c9b('0x47')](_0x239da1['body'],{})[_0x3c9b('0x3c')](respondWithResult(_0x1e7ed0,0xc9))['catch'](handleError(_0x1e7ed0,null));};exports['update']=function(_0x24d7c8,_0x5a6865){if(_0x24d7c8[_0x3c9b('0x48')]['id']){delete _0x24d7c8[_0x3c9b('0x48')]['id'];}return db[_0x3c9b('0x2b')][_0x3c9b('0x49')]({'where':{'id':_0x24d7c8[_0x3c9b('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a6865,null))[_0x3c9b('0x3c')](saveUpdates(_0x24d7c8[_0x3c9b('0x48')],null))[_0x3c9b('0x3c')](respondWithResult(_0x5a6865,null))[_0x3c9b('0x40')](handleError(_0x5a6865,null));};exports[_0x3c9b('0x25')]=function(_0x596f61,_0x35f627){return db[_0x3c9b('0x2b')]['find']({'where':{'id':_0x596f61[_0x3c9b('0x42')]['id']}})['then'](handleEntityNotFound(_0x35f627,null))[_0x3c9b('0x3c')](removeEntity(_0x35f627,null))[_0x3c9b('0x40')](handleError(_0x35f627,null));}; \ No newline at end of file +var _0xea65=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','intersection','options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x535dcf,_0x2b22d0){var _0x18fcae=function(_0x55cbba){while(--_0x55cbba){_0x535dcf['push'](_0x535dcf['shift']());}};_0x18fcae(++_0x2b22d0);}(_0xea65,0x11b));var _0x5ea6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xea65[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x5ea6('0x0'));var rimraf=require(_0x5ea6('0x1'));var zipdir=require(_0x5ea6('0x2'));var jsonpatch=require(_0x5ea6('0x3'));var rp=require('request-promise');var moment=require(_0x5ea6('0x4'));var BPromise=require(_0x5ea6('0x5'));var Mustache=require(_0x5ea6('0x6'));var util=require(_0x5ea6('0x7'));var path=require(_0x5ea6('0x8'));var sox=require('sox');var csv=require(_0x5ea6('0x9'));var ejs=require(_0x5ea6('0xa'));var fs=require('fs');var fs_extra=require(_0x5ea6('0xb'));var _=require(_0x5ea6('0xc'));var squel=require(_0x5ea6('0xd'));var crypto=require(_0x5ea6('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5ea6('0x9'));var querystring=require(_0x5ea6('0xf'));var Papa=require(_0x5ea6('0x10'));var Redis=require('ioredis');var authService=require(_0x5ea6('0x11'));var qs=require(_0x5ea6('0x12'));var as=require(_0x5ea6('0x13'));var hardwareService=require(_0x5ea6('0x14'));var logger=require(_0x5ea6('0x15'))(_0x5ea6('0x16'));var utils=require(_0x5ea6('0x17'));var config=require(_0x5ea6('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4649cf,_0x29bb5d){_0x29bb5d=_0x29bb5d||0xcc;return function(_0x1b64ef){if(_0x1b64ef){return _0x4649cf['sendStatus'](_0x29bb5d);}return _0x4649cf['status'](_0x29bb5d)[_0x5ea6('0x19')]();};}function respondWithResult(_0x3363b9,_0x37929c){_0x37929c=_0x37929c||0xc8;return function(_0x243ce3){if(_0x243ce3){return _0x3363b9[_0x5ea6('0x1a')](_0x37929c)[_0x5ea6('0x1b')](_0x243ce3);}};}function respondWithFilteredResult(_0x47511f,_0x2d81e5){return function(_0x3782d0){if(_0x3782d0){var _0x2e15c4=typeof _0x2d81e5[_0x5ea6('0x1c')]===_0x5ea6('0x1d')&&typeof _0x2d81e5[_0x5ea6('0x1e')]===_0x5ea6('0x1d');var _0x30dde1=_0x3782d0[_0x5ea6('0x1f')];var _0x31186f=_0x2e15c4?0x0:_0x2d81e5[_0x5ea6('0x1c')];var _0x5df2be=_0x2e15c4?_0x3782d0[_0x5ea6('0x1f')]:_0x2d81e5[_0x5ea6('0x1c')]+_0x2d81e5[_0x5ea6('0x1e')];var _0x5e90e5;if(_0x5df2be>=_0x30dde1){_0x5df2be=_0x30dde1;_0x5e90e5=0xc8;}else{_0x5e90e5=0xce;}_0x47511f['status'](_0x5e90e5);return _0x47511f[_0x5ea6('0x20')]('Content-Range',_0x31186f+'-'+_0x5df2be+'/'+_0x30dde1)[_0x5ea6('0x1b')](_0x3782d0);}return null;};}function patchUpdates(_0x2ba00e){return function(_0x5628eb){try{jsonpatch[_0x5ea6('0x21')](_0x5628eb,_0x2ba00e,!![]);}catch(_0x446011){return BPromise['reject'](_0x446011);}return _0x5628eb[_0x5ea6('0x22')]();};}function saveUpdates(_0x2008fb,_0x47617d){return function(_0x9159b8){if(_0x9159b8){return _0x9159b8[_0x5ea6('0x23')](_0x2008fb)[_0x5ea6('0x24')](function(_0x39362f){return _0x39362f;});}return null;};}function removeEntity(_0x15d3b2,_0x507b6a){return function(_0x32198e){if(_0x32198e){return _0x32198e[_0x5ea6('0x25')]()[_0x5ea6('0x24')](function(){_0x15d3b2[_0x5ea6('0x1a')](0xcc)[_0x5ea6('0x19')]();});}};}function handleEntityNotFound(_0x335c5c,_0x270987){return function(_0x49840c){if(!_0x49840c){_0x335c5c['sendStatus'](0x194);}return _0x49840c;};}function handleError(_0x3bcac5,_0x414399){_0x414399=_0x414399||0x1f4;return function(_0x586657){logger[_0x5ea6('0x26')](_0x586657[_0x5ea6('0x27')]);if(_0x586657[_0x5ea6('0x28')]){delete _0x586657[_0x5ea6('0x28')];}_0x3bcac5[_0x5ea6('0x1a')](_0x414399)['send'](_0x586657);};}exports[_0x5ea6('0x29')]=function(_0xb9693d,_0x136089){var _0x26f6d8={},_0x191d37={},_0x4eb69b={'count':0x0,'rows':[]};var _0x47829a=_[_0x5ea6('0x2a')](db[_0x5ea6('0x2b')][_0x5ea6('0x2c')],function(_0x3e98cf){return{'name':_0x3e98cf[_0x5ea6('0x2d')],'type':_0x3e98cf[_0x5ea6('0x2e')][_0x5ea6('0x2f')]};});_0x191d37[_0x5ea6('0x30')]=_[_0x5ea6('0x2a')](_0x47829a,_0x5ea6('0x28'));_0x191d37[_0x5ea6('0x31')]=_[_0x5ea6('0x32')](_0xb9693d[_0x5ea6('0x31')]);_0x191d37[_0x5ea6('0x33')]=_['intersection'](_0x191d37[_0x5ea6('0x30')],_0x191d37[_0x5ea6('0x31')]);_0x26f6d8[_0x5ea6('0x34')]=_['intersection'](_0x191d37[_0x5ea6('0x30')],qs['fields'](_0xb9693d[_0x5ea6('0x31')][_0x5ea6('0x35')]));_0x26f6d8[_0x5ea6('0x34')]=_0x26f6d8[_0x5ea6('0x34')][_0x5ea6('0x36')]?_0x26f6d8['attributes']:_0x191d37[_0x5ea6('0x30')];if(!_0xb9693d[_0x5ea6('0x31')]['hasOwnProperty'](_0x5ea6('0x37'))){_0x26f6d8[_0x5ea6('0x1e')]=qs[_0x5ea6('0x1e')](_0xb9693d[_0x5ea6('0x31')]['limit']);_0x26f6d8['offset']=qs[_0x5ea6('0x1c')](_0xb9693d[_0x5ea6('0x31')]['offset']);}_0x26f6d8[_0x5ea6('0x38')]=qs[_0x5ea6('0x39')](_0xb9693d[_0x5ea6('0x31')][_0x5ea6('0x39')]);_0x26f6d8[_0x5ea6('0x3a')]=qs['filters'](_['pick'](_0xb9693d[_0x5ea6('0x31')],_0x191d37['filters']),_0x47829a);if(_0xb9693d[_0x5ea6('0x31')][_0x5ea6('0x3b')]){_0x26f6d8[_0x5ea6('0x3a')]=_[_0x5ea6('0x3c')](_0x26f6d8[_0x5ea6('0x3a')],{'$or':_[_0x5ea6('0x2a')](_0x47829a,function(_0x257ee6){if(_0x257ee6[_0x5ea6('0x2e')]!==_0x5ea6('0x3d')){var _0x5a0aa3={};_0x5a0aa3[_0x257ee6[_0x5ea6('0x28')]]={'$like':'%'+_0xb9693d['query'][_0x5ea6('0x3b')]+'%'};return _0x5a0aa3;}})});}_0x26f6d8=_['merge']({},_0x26f6d8,_0xb9693d['options']);var _0x16fa40={'where':_0x26f6d8['where']};return db[_0x5ea6('0x2b')][_0x5ea6('0x1f')](_0x16fa40)[_0x5ea6('0x24')](function(_0x3e594a){_0x4eb69b[_0x5ea6('0x1f')]=_0x3e594a;if(_0xb9693d[_0x5ea6('0x31')][_0x5ea6('0x3e')]){_0x26f6d8[_0x5ea6('0x3f')]=[{'all':!![]}];}return db[_0x5ea6('0x2b')][_0x5ea6('0x40')](_0x26f6d8);})[_0x5ea6('0x24')](function(_0x4f7128){_0x4eb69b['rows']=_0x4f7128;return _0x4eb69b;})[_0x5ea6('0x24')](respondWithFilteredResult(_0x136089,_0x26f6d8))[_0x5ea6('0x41')](handleError(_0x136089,null));};exports[_0x5ea6('0x42')]=function(_0x70192e,_0x367d39){var _0x5a91f3={'raw':!![],'where':{'id':_0x70192e[_0x5ea6('0x43')]['id']}},_0x3465f8={};_0x3465f8[_0x5ea6('0x30')]=_['keys'](db['VoiceQueuesLog']['rawAttributes']);_0x3465f8[_0x5ea6('0x31')]=_['keys'](_0x70192e[_0x5ea6('0x31')]);_0x3465f8[_0x5ea6('0x33')]=_[_0x5ea6('0x44')](_0x3465f8[_0x5ea6('0x30')],_0x3465f8['query']);_0x5a91f3[_0x5ea6('0x34')]=_[_0x5ea6('0x44')](_0x3465f8[_0x5ea6('0x30')],qs[_0x5ea6('0x35')](_0x70192e['query']['fields']));_0x5a91f3[_0x5ea6('0x34')]=_0x5a91f3[_0x5ea6('0x34')][_0x5ea6('0x36')]?_0x5a91f3[_0x5ea6('0x34')]:_0x3465f8['model'];if(_0x70192e[_0x5ea6('0x31')][_0x5ea6('0x3e')]){_0x5a91f3[_0x5ea6('0x3f')]=[{'all':!![]}];}_0x5a91f3=_[_0x5ea6('0x3c')]({},_0x5a91f3,_0x70192e[_0x5ea6('0x45')]);return db['VoiceQueuesLog'][_0x5ea6('0x46')](_0x5a91f3)[_0x5ea6('0x24')](handleEntityNotFound(_0x367d39,null))[_0x5ea6('0x24')](respondWithResult(_0x367d39,null))[_0x5ea6('0x41')](handleError(_0x367d39,null));};exports['create']=function(_0x27bb6b,_0x2ee309){return db['VoiceQueuesLog']['create'](_0x27bb6b[_0x5ea6('0x47')],{})[_0x5ea6('0x24')](respondWithResult(_0x2ee309,0xc9))[_0x5ea6('0x41')](handleError(_0x2ee309,null));};exports['update']=function(_0x21ae48,_0x630891){if(_0x21ae48['body']['id']){delete _0x21ae48[_0x5ea6('0x47')]['id'];}return db[_0x5ea6('0x2b')][_0x5ea6('0x46')]({'where':{'id':_0x21ae48[_0x5ea6('0x43')]['id']}})[_0x5ea6('0x24')](handleEntityNotFound(_0x630891,null))[_0x5ea6('0x24')](saveUpdates(_0x21ae48[_0x5ea6('0x47')],null))['then'](respondWithResult(_0x630891,null))[_0x5ea6('0x41')](handleError(_0x630891,null));};exports[_0x5ea6('0x25')]=function(_0x357228,_0x1f854f){return db[_0x5ea6('0x2b')][_0x5ea6('0x46')]({'where':{'id':_0x357228[_0x5ea6('0x43')]['id']}})[_0x5ea6('0x24')](handleEntityNotFound(_0x1f854f,null))[_0x5ea6('0x24')](removeEntity(_0x1f854f,null))[_0x5ea6('0x41')](handleError(_0x1f854f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 1bca232..31094fb 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 _0xd156=['exports','VoiceQueuesLog','voice_queues_log','dtm','../../config/logger','api','moment','path','../../config/environment'];(function(_0x151c7c,_0x8ef319){var _0x15a581=function(_0x3f8de0){while(--_0x3f8de0){_0x151c7c['push'](_0x151c7c['shift']());}};_0x15a581(++_0x8ef319);}(_0xd156,0x151));var _0x6d15=function(_0x44a4de,_0x539e7c){_0x44a4de=_0x44a4de-0x0;var _0x1f3abf=_0xd156[_0x44a4de];return _0x1f3abf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6d15('0x0'))(_0x6d15('0x1'));var moment=require(_0x6d15('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d15('0x3'));var rimraf=require('rimraf');var config=require(_0x6d15('0x4'));var attributes=require('./voiceQueuesLog.attributes');module[_0x6d15('0x5')]=function(_0x3736b8,_0x524c33){return _0x3736b8['define'](_0x6d15('0x6'),attributes,{'tableName':_0x6d15('0x7'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0x6d15('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2917=['event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0x2b9423,_0x534c16){var _0x599196=function(_0x53eab4){while(--_0x53eab4){_0x2b9423['push'](_0x2b9423['shift']());}};_0x599196(++_0x534c16);}(_0x2917,0x142));var _0x7291=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x2917[_0x14e27a];return _0x288688;};'use strict';var _=require(_0x7291('0x0'));var util=require(_0x7291('0x1'));var logger=require(_0x7291('0x2'))(_0x7291('0x3'));var moment=require(_0x7291('0x4'));var BPromise=require(_0x7291('0x5'));var rp=require(_0x7291('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7291('0x7'));var attributes=require(_0x7291('0x8'));module[_0x7291('0x9')]=function(_0x6aac19,_0x1ee790){return _0x6aac19[_0x7291('0xa')](_0x7291('0xb'),attributes,{'tableName':_0x7291('0xc'),'paranoid':![],'indexes':[{'name':_0x7291('0xd'),'fields':[_0x7291('0xe'),_0x7291('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 7868bbe..07a62f0 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 _0x5cd9=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x537d69,_0x2a04ea){var _0x433d2b=function(_0x38d67b){while(--_0x38d67b){_0x537d69['push'](_0x537d69['shift']());}};_0x433d2b(++_0x2a04ea);}(_0x5cd9,0x13c));var _0x95cd=function(_0xe27cee,_0x25bfa0){_0xe27cee=_0xe27cee-0x0;var _0x25db5e=_0x5cd9[_0xe27cee];return _0x25db5e;};'use strict';var _=require('lodash');var util=require(_0x95cd('0x0'));var moment=require(_0x95cd('0x1'));var BPromise=require(_0x95cd('0x2'));var rs=require(_0x95cd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x95cd('0x5'));var config=require(_0x95cd('0x6'));var jayson=require(_0x95cd('0x7'));var client=jayson[_0x95cd('0x8')][_0x95cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a862e,_0xda639a,_0x50f01d){return new BPromise(function(_0x523d56,_0x4fc0f5){return client[_0x95cd('0xa')](_0x2a862e,_0x50f01d)[_0x95cd('0xb')](function(_0x3cac40){logger[_0x95cd('0xc')](_0x95cd('0xd'),_0xda639a,_0x95cd('0xe'));logger[_0x95cd('0xf')](_0x95cd('0x10'),_0xda639a,_0x95cd('0xe'),JSON[_0x95cd('0x11')](_0x3cac40));if(_0x3cac40[_0x95cd('0x12')]){if(_0x3cac40[_0x95cd('0x12')][_0x95cd('0x13')]===0x1f4){logger[_0x95cd('0x12')](_0x95cd('0xd'),_0xda639a,_0x3cac40[_0x95cd('0x12')][_0x95cd('0x14')]);return _0x4fc0f5(_0x3cac40[_0x95cd('0x12')][_0x95cd('0x14')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xda639a,_0x3cac40[_0x95cd('0x12')]['message']);return _0x523d56(_0x3cac40[_0x95cd('0x12')][_0x95cd('0x14')]);}else{logger[_0x95cd('0xc')](_0x95cd('0xd'),_0xda639a,_0x95cd('0xe'));_0x523d56(_0x3cac40[_0x95cd('0x15')][_0x95cd('0x14')]);}})[_0x95cd('0x16')](function(_0x14e6f3){logger[_0x95cd('0x12')](_0x95cd('0xd'),_0xda639a,_0x14e6f3);_0x4fc0f5(_0x14e6f3);});});} \ No newline at end of file +var _0x2a31=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2e456a,_0x282a22){var _0x4cb7b9=function(_0x444173){while(--_0x444173){_0x2e456a['push'](_0x2e456a['shift']());}};_0x4cb7b9(++_0x282a22);}(_0x2a31,0xe4));var _0x12a3=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x2a31[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x12a3('0x0'));var util=require(_0x12a3('0x1'));var moment=require(_0x12a3('0x2'));var BPromise=require(_0x12a3('0x3'));var rs=require(_0x12a3('0x4'));var fs=require('fs');var Redis=require(_0x12a3('0x5'));var db=require(_0x12a3('0x6'))['db'];var utils=require(_0x12a3('0x7'));var logger=require(_0x12a3('0x8'))(_0x12a3('0x9'));var config=require(_0x12a3('0xa'));var jayson=require(_0x12a3('0xb'));var client=jayson[_0x12a3('0xc')][_0x12a3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5411bc,_0xcf401f,_0x5e24b3){return new BPromise(function(_0x25703e,_0x4d6252){return client[_0x12a3('0xe')](_0x5411bc,_0x5e24b3)['then'](function(_0xc38543){logger['info'](_0x12a3('0xf'),_0xcf401f,_0x12a3('0x10'));logger[_0x12a3('0x11')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0xcf401f,'request\x20sent',JSON[_0x12a3('0x12')](_0xc38543));if(_0xc38543[_0x12a3('0x13')]){if(_0xc38543[_0x12a3('0x13')][_0x12a3('0x14')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xcf401f,_0xc38543[_0x12a3('0x13')]['message']);return _0x4d6252(_0xc38543[_0x12a3('0x13')][_0x12a3('0x15')]);}logger['error'](_0x12a3('0xf'),_0xcf401f,_0xc38543[_0x12a3('0x13')]['message']);return _0x25703e(_0xc38543['error'][_0x12a3('0x15')]);}else{logger[_0x12a3('0x16')](_0x12a3('0xf'),_0xcf401f,_0x12a3('0x10'));_0x25703e(_0xc38543[_0x12a3('0x17')][_0x12a3('0x15')]);}})[_0x12a3('0x18')](function(_0x471db6){logger[_0x12a3('0x13')](_0x12a3('0xf'),_0xcf401f,_0x471db6);_0x4d6252(_0x471db6);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 5ace4b5..94d930a 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 _0x9e06=['isAuthenticated','index','/:id','show','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x9e06,0x1be));var _0x69e0=function(_0x4c77a2,_0x451b31){_0x4c77a2=_0x4c77a2-0x0;var _0x1f41dd=_0x9e06[_0x4c77a2];return _0x1f41dd;};'use strict';var multer=require(_0x69e0('0x0'));var util=require(_0x69e0('0x1'));var path=require(_0x69e0('0x2'));var timeout=require(_0x69e0('0x3'));var express=require(_0x69e0('0x4'));var router=express[_0x69e0('0x5')]();var fs_extra=require(_0x69e0('0x6'));var auth=require(_0x69e0('0x7'));var interaction=require(_0x69e0('0x8'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x69e0('0x9')]('/',auth[_0x69e0('0xa')](),controller[_0x69e0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x69e0('0x9')](_0x69e0('0xc'),auth[_0x69e0('0xa')](),controller[_0x69e0('0xd')]);router[_0x69e0('0x9')]('/:id/download',auth[_0x69e0('0xa')](),controller['download']);router[_0x69e0('0x9')](_0x69e0('0xe'),controller[_0x69e0('0xf')]);router[_0x69e0('0x9')](_0x69e0('0x10'),auth[_0x69e0('0xa')](),controller[_0x69e0('0x11')]);router[_0x69e0('0x12')]('/',auth[_0x69e0('0xa')](),controller[_0x69e0('0x13')]);router[_0x69e0('0x12')]('/:id/transcribe',auth[_0x69e0('0xa')](),controller[_0x69e0('0x14')]);router[_0x69e0('0x15')](_0x69e0('0xc'),auth[_0x69e0('0xa')](),controller[_0x69e0('0x16')]);router['delete'](_0x69e0('0xc'),auth[_0x69e0('0xa')](),controller[_0x69e0('0x17')]);module['exports']=router; \ No newline at end of file +var _0xcfc3=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','create','runTranscribe','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x5a2e2a,_0xf1b1ba){var _0x2d4f85=function(_0xcea253){while(--_0xcea253){_0x5a2e2a['push'](_0x5a2e2a['shift']());}};_0x2d4f85(++_0xf1b1ba);}(_0xcfc3,0x18b));var _0x3cfc=function(_0x55fb8f,_0x574d3a){_0x55fb8f=_0x55fb8f-0x0;var _0x2c841a=_0xcfc3[_0x55fb8f];return _0x2c841a;};'use strict';var multer=require('multer');var util=require(_0x3cfc('0x0'));var path=require(_0x3cfc('0x1'));var timeout=require(_0x3cfc('0x2'));var express=require(_0x3cfc('0x3'));var router=express[_0x3cfc('0x4')]();var fs_extra=require(_0x3cfc('0x5'));var auth=require(_0x3cfc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3cfc('0x7'));var controller=require('./voiceRecording.controller');router[_0x3cfc('0x8')]('/',auth[_0x3cfc('0x9')](),controller[_0x3cfc('0xa')]);router['get']('/describe',auth[_0x3cfc('0x9')](),controller[_0x3cfc('0xb')]);router[_0x3cfc('0x8')]('/:id',auth[_0x3cfc('0x9')](),controller['show']);router[_0x3cfc('0x8')](_0x3cfc('0xc'),auth['isAuthenticated'](),controller[_0x3cfc('0xd')]);router['get']('/:id/downloads',controller[_0x3cfc('0xe')]);router[_0x3cfc('0x8')](_0x3cfc('0xf'),auth['isAuthenticated'](),controller[_0x3cfc('0x10')]);router['post']('/',auth[_0x3cfc('0x9')](),controller[_0x3cfc('0x11')]);router['post'](_0x3cfc('0xf'),auth[_0x3cfc('0x9')](),controller[_0x3cfc('0x12')]);router[_0x3cfc('0x13')](_0x3cfc('0x14'),auth[_0x3cfc('0x9')](),controller[_0x3cfc('0x15')]);router[_0x3cfc('0x16')](_0x3cfc('0x14'),auth[_0x3cfc('0x9')](),controller[_0x3cfc('0x17')]);module[_0x3cfc('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 69a78bd..9057a95 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(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 898ffd5..6ff2218 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 _0x08c1=['key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','Not\x20found','downloads','sequelize','col','token','$and','push','existsSync','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','name','send','index','map','VoiceRecording','type'];(function(_0x13ae2a,_0x2cb187){var _0x2f56e1=function(_0x279320){while(--_0x279320){_0x13ae2a['push'](_0x13ae2a['shift']());}};_0x2f56e1(++_0x2cb187);}(_0x08c1,0x1ac));var _0x108c=function(_0x380cd2,_0x3f7c81){_0x380cd2=_0x380cd2-0x0;var _0x1ab58d=_0x08c1[_0x380cd2];return _0x1ab58d;};'use strict';var emlformat=require(_0x108c('0x0'));var rimraf=require(_0x108c('0x1'));var zipdir=require(_0x108c('0x2'));var jsonpatch=require(_0x108c('0x3'));var rp=require(_0x108c('0x4'));var moment=require(_0x108c('0x5'));var BPromise=require(_0x108c('0x6'));var Mustache=require(_0x108c('0x7'));var util=require(_0x108c('0x8'));var path=require(_0x108c('0x9'));var sox=require(_0x108c('0xa'));var csv=require('to-csv');var ejs=require(_0x108c('0xb'));var fs=require('fs');var fs_extra=require(_0x108c('0xc'));var _=require(_0x108c('0xd'));var squel=require(_0x108c('0xe'));var crypto=require(_0x108c('0xf'));var jsforce=require(_0x108c('0x10'));var deskjs=require(_0x108c('0x11'));var toCsv=require(_0x108c('0x12'));var querystring=require(_0x108c('0x13'));var Papa=require(_0x108c('0x14'));var AWS=require(_0x108c('0x15'));var uuidv4=require(_0x108c('0x16'));var Redis=require(_0x108c('0x17'));var authService=require(_0x108c('0x18'));var qs=require(_0x108c('0x19'));var as=require(_0x108c('0x1a'));var hardwareService=require(_0x108c('0x1b'));var logger=require(_0x108c('0x1c'))('api');var utils=require(_0x108c('0x1d'));var config=require(_0x108c('0x1e'));var licenseUtil=require(_0x108c('0x1f'));var db=require(_0x108c('0x20'))['db'];function respondWithStatusCode(_0x13f97b,_0x40399a){_0x40399a=_0x40399a||0xcc;return function(_0x4febb0){if(_0x4febb0){return _0x13f97b[_0x108c('0x21')](_0x40399a);}return _0x13f97b[_0x108c('0x22')](_0x40399a)[_0x108c('0x23')]();};}function respondWithResult(_0x16064,_0x5d3d25){_0x5d3d25=_0x5d3d25||0xc8;return function(_0x47c292){if(_0x47c292){return _0x16064['status'](_0x5d3d25)[_0x108c('0x24')](_0x47c292);}};}function respondWithFilteredResult(_0x556de2,_0x55a841){return function(_0x3d97f5){if(_0x3d97f5){var _0x59289e=typeof _0x55a841[_0x108c('0x25')]===_0x108c('0x26')&&typeof _0x55a841[_0x108c('0x27')]===_0x108c('0x26');var _0x13c30f=_0x3d97f5[_0x108c('0x28')];var _0x4e0994=_0x59289e?0x0:_0x55a841['offset'];var _0x4f4e1b=_0x59289e?_0x3d97f5[_0x108c('0x28')]:_0x55a841[_0x108c('0x25')]+_0x55a841[_0x108c('0x27')];var _0x4bab71;if(_0x4f4e1b>=_0x13c30f){_0x4f4e1b=_0x13c30f;_0x4bab71=0xc8;}else{_0x4bab71=0xce;}_0x556de2[_0x108c('0x22')](_0x4bab71);return _0x556de2[_0x108c('0x29')]('Content-Range',_0x4e0994+'-'+_0x4f4e1b+'/'+_0x13c30f)['json'](_0x3d97f5);}return null;};}function patchUpdates(_0x1500bd){return function(_0x17c8ff){try{jsonpatch['apply'](_0x17c8ff,_0x1500bd,!![]);}catch(_0xd45b03){return BPromise[_0x108c('0x2a')](_0xd45b03);}return _0x17c8ff[_0x108c('0x2b')]();};}function saveUpdates(_0x25cc9f,_0x59bbaf){return function(_0x51dd1c){if(_0x51dd1c){return _0x51dd1c['update'](_0x25cc9f)[_0x108c('0x2c')](function(_0x111be4){return _0x111be4;});}return null;};}function removeEntity(_0x2df54c,_0x380cf9){return function(_0x4046cb){if(_0x4046cb){return _0x4046cb[_0x108c('0x2d')]()['then'](function(){_0x2df54c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb5f2,_0x59cd87){return function(_0x32a5d3){if(!_0x32a5d3){_0x2eb5f2[_0x108c('0x21')](0x194);}return _0x32a5d3;};}function handleError(_0x49eaba,_0x6cd3ad){_0x6cd3ad=_0x6cd3ad||0x1f4;return function(_0x918bc8){logger['error'](_0x918bc8['stack']);if(_0x918bc8[_0x108c('0x2e')]){delete _0x918bc8[_0x108c('0x2e')];}_0x49eaba[_0x108c('0x22')](_0x6cd3ad)[_0x108c('0x2f')](_0x918bc8);};}exports[_0x108c('0x30')]=function(_0x2c5713,_0x182a49){var _0x1cfe27={},_0x12e351={},_0x341243={'count':0x0,'rows':[]};var _0x3c41ea=_[_0x108c('0x31')](db[_0x108c('0x32')]['rawAttributes'],function(_0x51fcb4){return{'name':_0x51fcb4['fieldName'],'type':_0x51fcb4[_0x108c('0x33')][_0x108c('0x34')]};});_0x12e351[_0x108c('0x35')]=_[_0x108c('0x36')](_[_0x108c('0x31')](_0x3c41ea,_0x108c('0x2e')),[_0x108c('0x37')]);_0x12e351[_0x108c('0x38')]=_['keys'](_0x2c5713[_0x108c('0x38')]);_0x12e351[_0x108c('0x39')]=_[_0x108c('0x3a')](_0x12e351[_0x108c('0x35')],_0x12e351[_0x108c('0x38')]);_0x1cfe27['attributes']=_[_0x108c('0x3a')](_0x12e351[_0x108c('0x35')],qs[_0x108c('0x3b')](_0x2c5713[_0x108c('0x38')][_0x108c('0x3b')]));_0x1cfe27[_0x108c('0x3c')]=_0x1cfe27[_0x108c('0x3c')][_0x108c('0x3d')]?_0x1cfe27[_0x108c('0x3c')]:_0x12e351[_0x108c('0x35')];if(!_0x2c5713['query'][_0x108c('0x3e')](_0x108c('0x3f'))){_0x1cfe27['limit']=qs[_0x108c('0x27')](_0x2c5713[_0x108c('0x38')][_0x108c('0x27')]);_0x1cfe27[_0x108c('0x25')]=qs[_0x108c('0x25')](_0x2c5713[_0x108c('0x38')]['offset']);}_0x1cfe27['order']=qs[_0x108c('0x40')](_0x2c5713[_0x108c('0x38')][_0x108c('0x40')]);_0x1cfe27['where']=qs[_0x108c('0x39')](_[_0x108c('0x41')](_0x2c5713['query'],_0x12e351['filters']),_0x3c41ea);if(_0x2c5713[_0x108c('0x38')][_0x108c('0x42')]){_0x1cfe27[_0x108c('0x43')]=_[_0x108c('0x44')](_0x1cfe27[_0x108c('0x43')],{'$or':_[_0x108c('0x31')](_0x3c41ea,function(_0x413100){if(_0x413100[_0x108c('0x33')]!==_0x108c('0x45')){var _0x2d829c={};_0x2d829c[_0x413100[_0x108c('0x2e')]]={'$like':'%'+_0x2c5713['query'][_0x108c('0x42')]+'%'};return _0x2d829c;}})});}_0x1cfe27=_[_0x108c('0x44')]({},_0x1cfe27,_0x2c5713[_0x108c('0x46')]);var _0x577d23={'where':_0x1cfe27[_0x108c('0x43')]};return db[_0x108c('0x32')][_0x108c('0x28')](_0x577d23)[_0x108c('0x2c')](function(_0xe9f6b1){_0x341243[_0x108c('0x28')]=_0xe9f6b1;if(_0x2c5713[_0x108c('0x38')][_0x108c('0x47')]){_0x1cfe27[_0x108c('0x48')]=[{'all':!![]}];}return db['VoiceRecording'][_0x108c('0x49')](_0x1cfe27);})[_0x108c('0x2c')](function(_0x41762a){_0x341243[_0x108c('0x4a')]=_0x41762a;return _0x341243;})[_0x108c('0x2c')](respondWithFilteredResult(_0x182a49,_0x1cfe27))[_0x108c('0x4b')](handleError(_0x182a49,null));};exports[_0x108c('0x4c')]=function(_0x32ac58,_0xd3c80b){var _0x320916={'raw':![],'where':{'id':_0x32ac58[_0x108c('0x4d')]['id']}},_0x1001a4={};_0x1001a4['model']=_[_0x108c('0x4e')](db[_0x108c('0x32')][_0x108c('0x4f')]);_0x1001a4['query']=_['keys'](_0x32ac58[_0x108c('0x38')]);_0x1001a4[_0x108c('0x39')]=_[_0x108c('0x3a')](_0x1001a4[_0x108c('0x35')],_0x1001a4[_0x108c('0x38')]);_0x320916[_0x108c('0x3c')]=_[_0x108c('0x3a')](_0x1001a4[_0x108c('0x35')],qs[_0x108c('0x3b')](_0x32ac58[_0x108c('0x38')][_0x108c('0x3b')]));_0x320916['attributes']=_0x320916[_0x108c('0x3c')][_0x108c('0x3d')]?_0x320916[_0x108c('0x3c')]:_0x1001a4['model'];if(_0x32ac58[_0x108c('0x38')][_0x108c('0x47')]){_0x320916[_0x108c('0x48')]=[{'all':!![]}];}_0x320916=_[_0x108c('0x44')]({},_0x320916,_0x32ac58['options']);return db[_0x108c('0x32')][_0x108c('0x50')](_0x320916)['then'](handleEntityNotFound(_0xd3c80b,null))[_0x108c('0x2c')](respondWithResult(_0xd3c80b,null))['catch'](handleError(_0xd3c80b,null));};exports[_0x108c('0x51')]=function(_0x35d221,_0x2a7b9e){return db[_0x108c('0x32')][_0x108c('0x51')](_0x35d221[_0x108c('0x52')],{})[_0x108c('0x2c')](respondWithResult(_0x2a7b9e,0xc9))['catch'](handleError(_0x2a7b9e,null));};exports['update']=function(_0x59f514,_0x28e62b){if(_0x59f514[_0x108c('0x52')]['id']){delete _0x59f514['body']['id'];}return db[_0x108c('0x32')][_0x108c('0x50')]({'where':{'id':_0x59f514[_0x108c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x28e62b,null))[_0x108c('0x2c')](saveUpdates(_0x59f514['body'],null))[_0x108c('0x2c')](respondWithResult(_0x28e62b,null))['catch'](handleError(_0x28e62b,null));};exports[_0x108c('0x53')]=function(_0x5534c0,_0x579c76){return db[_0x108c('0x32')][_0x108c('0x53')]()[_0x108c('0x2c')](respondWithResult(_0x579c76,null))[_0x108c('0x4b')](handleError(_0x579c76,null));};exports['download']=function(_0x5a2cd6,_0x365fd8,_0x2b4db6){var _0x10b02e=require(_0x108c('0x54'));var _0xd48fa5=![];var _0x150e1d={};if(_0x5a2cd6[_0x108c('0x38')]['type']&&_0x5a2cd6[_0x108c('0x38')]['type']===_0x108c('0x55')){_0x150e1d[_0x108c('0x55')]=_0x5a2cd6[_0x108c('0x4d')]['id'];}else{_0x150e1d['id']=_0x5a2cd6[_0x108c('0x4d')]['id'];}return db[_0x108c('0x32')][_0x108c('0x50')]({'where':_0x150e1d,'attributes':['id','value'],'raw':!![]})[_0x108c('0x2c')](handleEntityNotFound(_0x365fd8,null))[_0x108c('0x2c')](function(_0x1e73bf){if(_0x1e73bf){var _0x41fc1b=_0x1e73bf[_0x108c('0x56')];var _0x434b3e=util[_0x108c('0x37')](_0x108c('0x57'),_0x41fc1b);if(fs['existsSync'](_0x434b3e)){_0xd48fa5=!![];return _0x10b02e[_0x108c('0x58')](_0x434b3e,_0x41fc1b,config[_0x108c('0x59')][_0x108c('0x5a')])[_0x108c('0x2c')](function(){return _0x1e73bf;});}return _0x1e73bf;}})[_0x108c('0x2c')](function(_0xddba5f){if(_0xddba5f){var _0x386086=_0xddba5f[_0x108c('0x56')];if(!fs['existsSync'](_0x386086)){throw new db[(_0x108c('0x5b'))][(_0x108c('0x5c'))](_0x108c('0x5d'));}if(_0xddba5f[_0x108c('0x5e')]){return _0x365fd8[_0x108c('0x5f')](_0x386086,_0xddba5f[_0x108c('0x5e')]+path[_0x108c('0x60')](_0x386086),function(){if(_0xd48fa5){fs[_0x108c('0x61')](_0x386086);}});}else{return _0x365fd8['download'](_0x386086,function(_0x444841){if(_0xd48fa5){fs[_0x108c('0x61')](_0x386086);}});}}})['catch'](function(_0x42d27b){if(_0x42d27b['message']===_0x108c('0x5d')){_0x365fd8[_0x108c('0x22')](0x194)[_0x108c('0x2f')](_0x108c('0x62'));}else{return handleError(_0x365fd8,null);}});};exports[_0x108c('0x63')]=function(_0x223e8d,_0xe46000,_0xc23fdb){var _0x89be00=require(_0x108c('0x54'));var _0x3dbcd2=![];var _0x3ab466={'$and':[db[_0x108c('0x64')][_0x108c('0x43')](db[_0x108c('0x64')]['fn']('MD5',db[_0x108c('0x64')][_0x108c('0x65')](_0x108c('0x55'))),_0x223e8d[_0x108c('0x38')][_0x108c('0x66')])]};if(_0x223e8d[_0x108c('0x38')]['type']&&_0x223e8d[_0x108c('0x38')][_0x108c('0x33')]===_0x108c('0x55')){_0x3ab466[_0x108c('0x67')][_0x108c('0x68')]({'uniqueid':_0x223e8d[_0x108c('0x4d')]['id']});}else{_0x3ab466['$and'][_0x108c('0x68')]({'id':_0x223e8d[_0x108c('0x4d')]['id']});}return db['VoiceRecording']['find']({'where':_0x3ab466,'attributes':['id',_0x108c('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0xe46000,null))[_0x108c('0x2c')](function(_0x2f101d){if(_0x2f101d){var _0x81919f=util[_0x108c('0x37')](_0x108c('0x57'),_0x2f101d[_0x108c('0x56')]);if(fs[_0x108c('0x69')](_0x81919f)){_0x3dbcd2=!![];return _0x89be00[_0x108c('0x58')](_0x81919f,_0x2f101d['value'],config[_0x108c('0x59')][_0x108c('0x5a')])['then'](function(){return _0x2f101d;});}return _0x2f101d;}})['then'](function(_0x52d88e){if(_0x52d88e){if(!fs[_0x108c('0x69')](_0x52d88e[_0x108c('0x56')])){throw new db[(_0x108c('0x5b'))][(_0x108c('0x5c'))](_0x108c('0x5d'));}if(_0x52d88e['filename']){return _0xe46000['download'](_0x52d88e[_0x108c('0x56')],_0x52d88e[_0x108c('0x5e')]+path[_0x108c('0x60')](_0x52d88e[_0x108c('0x56')]),function(){if(_0x3dbcd2){fs[_0x108c('0x61')](_0x52d88e[_0x108c('0x56')]);}});}else{return _0xe46000[_0x108c('0x5f')](_0x52d88e[_0x108c('0x56')],function(_0x31a8eb){if(_0x3dbcd2){fs[_0x108c('0x61')](_0x52d88e[_0x108c('0x56')]);}});}}})[_0x108c('0x4b')](handleError(_0xe46000,null));};exports['destroy']=function(_0x2836b5,_0x3ca49b){return db[_0x108c('0x32')][_0x108c('0x50')]({'where':{'id':_0x2836b5[_0x108c('0x4d')]['id']}})[_0x108c('0x2c')](function(_0x12d0f7){if(_[_0x108c('0x6a')](_0x12d0f7)){throw new ReferenceError(_0x108c('0x6b'));}return _0x12d0f7;})[_0x108c('0x2c')](function(_0x562534){var _0x1f55c6=_0x562534[_0x108c('0x56')];logger[_0x108c('0x6c')](_0x108c('0x6d'),_0x1f55c6);if(!_['isNil'](_0x562534[_0x108c('0x56')])&&fs[_0x108c('0x69')](_0x1f55c6)){logger[_0x108c('0x6c')]('File:\x20\x22'+_0x1f55c6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1f55c6);}_0x1f55c6=_0x1f55c6+_0x108c('0x6e');if(!_[_0x108c('0x6a')](_0x562534[_0x108c('0x56')])&&fs[_0x108c('0x69')](_0x1f55c6)){logger[_0x108c('0x6c')]('File:\x20\x22'+_0x1f55c6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1f55c6);}return _0x562534;})['then'](function(_0x5b496a){if(!_0x5b496a)throw new InternalError();return _0x5b496a[_0x108c('0x2d')]();})['then'](function(){_0x3ca49b[_0x108c('0x22')](0xcc)[_0x108c('0x23')]();})[_0x108c('0x4b')](handleError(_0x3ca49b,null));};function getBucketslist(_0x446317,_0x1f0063,_0x5303e7){return new Promise(function(_0x4ae1b7,_0x46fd57){var _0x842fca=new AWS['S3']({'accessKeyId':_0x1f0063,'secretAccessKey':_0x446317,'region':_0x5303e7});_0x842fca[_0x108c('0x6f')]({},function(_0x3e66ca,_0x55c3c0){if(_0x3e66ca){return _0x46fd57(_0x3e66ca);}else{return _0x4ae1b7(_0x55c3c0);}});});}function createBucket(_0x5d8d2,_0x1e5f19,_0x32856e,_0x3a864e){return new Promise(function(_0x36bd0e,_0x2f4291){var _0x343e93=new AWS['S3']({'accessKeyId':_0x1e5f19,'secretAccessKey':_0x5d8d2,'region':_0x32856e});_0x343e93[_0x108c('0x70')]({'Bucket':_0x3a864e},function(_0x300ddb,_0x31b265){if(_0x300ddb){return _0x2f4291(_0x300ddb);}else{return _0x36bd0e(_0x31b265);}});});}function uploadFile(_0x4c821b,_0x5a540a,_0x2664e2,_0x3a8c15,_0x34de7b,_0x165c37){return new Promise(function(_0x52ea2d,_0x10174f){var _0x3b7849=new AWS['S3']({'accessKeyId':_0x5a540a,'secretAccessKey':_0x4c821b,'region':_0x2664e2});_0x3b7849[_0x108c('0x71')]({'Bucket':_0x3a8c15,'Key':_0x34de7b,'Body':_0x165c37},function(_0x1af29a,_0x5bf790){if(_0x1af29a){return _0x10174f(_0x1af29a);}else{return _0x52ea2d(_0x5bf790);}});});}function startTranscribe(_0x368587,_0x5aa4bf,_0x532def,_0x35f962,_0x398940,_0x244d1d){return new Promise(function(_0x208819,_0x31e044){var _0x32bc22=new AWS[(_0x108c('0x72'))]({'accessKeyId':_0x5aa4bf,'secretAccessKey':_0x368587,'region':_0x532def});_0x32bc22[_0x108c('0x73')]({'TranscriptionJobName':_0x35f962,'LanguageCode':_0x398940,'Media':{'MediaFileUri':_0x244d1d}},function(_0x4e5c82,_0x5309c9){if(_0x4e5c82){return _0x31e044(_0x4e5c82);}else{return _0x208819(_0x5309c9);}});});}function transcribe(_0x38873e,_0x4ab0c7,_0x4c453c,_0x4b7aea,_0x5889a8,_0x1fb204,_0x5b59fa){return new Promise(function(_0x4e3d5c,_0xe3fe07){var _0x2999b0={};logger['info'](util[_0x108c('0x37')](_0x108c('0x74'),_0x38873e,_0x5889a8));return uploadFile(_0x4ab0c7,_0x4c453c,_0x4b7aea,_0x5889a8,path['basename'](_0x1fb204),fs[_0x108c('0x75')](_0x1fb204))[_0x108c('0x2c')](function(_0x2781a8){logger[_0x108c('0x6c')](util[_0x108c('0x37')](_0x108c('0x76'),_0x38873e,_0x5889a8,_0x2781a8[_0x108c('0x77')]));_0x2999b0[_0x108c('0x78')]=_0x2781a8[_0x108c('0x79')];_0x2999b0[_0x108c('0x7a')]=_0x2781a8[_0x108c('0x77')];logger[_0x108c('0x6c')](util['format'](_0x108c('0x7b'),_0x38873e));return startTranscribe(_0x4ab0c7,_0x4c453c,_0x4b7aea,uuidv4(),_0x5b59fa,_0x2781a8[_0x108c('0x77')]);})[_0x108c('0x2c')](function(_0x53ab75){logger[_0x108c('0x6c')](util[_0x108c('0x37')](_0x108c('0x7c'),_0x38873e,_0x53ab75[_0x108c('0x7d')][_0x108c('0x7e')]));_0x2999b0['transcribeName']=_0x53ab75['TranscriptionJob'][_0x108c('0x7e')];_0x2999b0[_0x108c('0x7f')]=_0x53ab75[_0x108c('0x7d')][_0x108c('0x80')];return _0x4e3d5c(_0x2999b0);})[_0x108c('0x4b')](function(_0x5bb2b6){return _0xe3fe07(_0x5bb2b6);});});}exports[_0x108c('0x81')]=function(_0x164a3d,_0x362904,_0x5ca22d){var _0x1baf09;var _0x1ffd38;var _0x561a5a;var _0x3e33ba=require(_0x108c('0x54'));return db[_0x108c('0x32')][_0x108c('0x82')]({'where':{'id':_0x164a3d['params']['id']}})['then'](function(_0x284f67){if(_0x284f67){var _0x21fbcd=util[_0x108c('0x37')](_0x108c('0x57'),_0x284f67[_0x108c('0x56')]);if(fs['existsSync'](_0x21fbcd)){cypher=!![];return _0x3e33ba['decryptFile'](_0x21fbcd,_0x284f67[_0x108c('0x56')],config[_0x108c('0x59')][_0x108c('0x5a')])[_0x108c('0x2c')](function(){return _0x284f67;});}return _0x284f67;}})[_0x108c('0x2c')](function(_0x3b390b){if(!_0x3b390b){throw new db[(_0x108c('0x5b'))]['ValidationError'](_0x108c('0x83'));}_0x1ffd38=_0x3b390b;return db[_0x108c('0x84')]['findOne']({'where':{'id':0x1}});})[_0x108c('0x2c')](handleEntityNotFound(_0x362904,null))[_0x108c('0x2c')](function(_0x52e349){if(_0x52e349){_0x1baf09=_0x52e349;if(!_0x1baf09[_0x108c('0x85')]||!_0x1baf09['transcribeAccountId']||!_0x1baf09['transcribeRegion']||!_0x1baf09['language']||!_0x1baf09[_0x108c('0x78')]){throw new db[(_0x108c('0x5b'))][(_0x108c('0x5c'))](_0x108c('0x86'));}if(_0x164a3d[_0x108c('0x52')][_0x108c('0x87')]&&(!_0x1baf09[_0x108c('0x88')]||!_0x1baf09[_0x108c('0x89')]||!_0x1baf09[_0x108c('0x8a')]||!_0x1baf09[_0x108c('0x8b')]||!_0x1baf09[_0x108c('0x78')])){throw new db[(_0x108c('0x5b'))][(_0x108c('0x5c'))](_0x108c('0x8c'));}return db[_0x108c('0x8d')][_0x108c('0x82')]({'where':{'id':_0x1baf09[_0x108c('0x8e')]}});}})['then'](function(_0x5763a7){if(!_0x5763a7){throw new db[(_0x108c('0x5b'))][(_0x108c('0x5c'))](_0x108c('0x8f'));}if(!_0x5763a7[_0x108c('0x90')]||!_0x5763a7[_0x108c('0x91')]){throw new db['Sequelize'][(_0x108c('0x5c'))]('Cloud\x20Provider\x20not\x20configured');}_0x561a5a=_0x5763a7;return getBucketslist(_0x561a5a[_0x108c('0x90')],_0x561a5a['data2'],_0x1baf09[_0x108c('0x92')]);})[_0x108c('0x2c')](function(_0x784d8e){if(_0x784d8e&&_0x784d8e['Buckets']){var _0x1d8c1e=_[_0x108c('0x50')](_0x784d8e[_0x108c('0x93')],function(_0x23717f){return _0x23717f['Name']===_0x1baf09[_0x108c('0x78')];});if(!_0x1d8c1e){logger[_0x108c('0x6c')](util[_0x108c('0x37')](_0x108c('0x94'),_0x164a3d['params']['id'],_0x1baf09[_0x108c('0x78')]));return createBucket(_0x561a5a[_0x108c('0x90')],_0x561a5a['data2'],_0x1baf09[_0x108c('0x92')],_0x1baf09['bucket']);}logger[_0x108c('0x6c')](util[_0x108c('0x37')](_0x108c('0x95'),_0x164a3d['params']['id'],_0x1baf09[_0x108c('0x78')]));return;}})['then'](function(_0x48fdc0){if(_0x1ffd38[_0x108c('0x7f')]===_0x108c('0x96')){return transcribe(_0x164a3d[_0x108c('0x4d')]['id'],_0x561a5a['data1'],_0x561a5a['data2'],_0x1baf09[_0x108c('0x92')],_0x1baf09['bucket'],_0x1ffd38['value'],_0x1baf09[_0x108c('0x8b')]);}else{logger[_0x108c('0x6c')](util[_0x108c('0x37')](_0x108c('0x97'),_0x164a3d[_0x108c('0x4d')]['id']));return{'transcribeStatus':_0x108c('0x98')};}})['then'](function(_0xd1778d){if(_0xd1778d){_0xd1778d[_0x108c('0x99')]=_0x164a3d[_0x108c('0x52')][_0x108c('0x87')];return _0x1ffd38['updateAttributes'](_0xd1778d);}})[_0x108c('0x2c')](respondWithResult(_0x362904,null))['catch'](handleError(_0x362904,null));};function writeFile(_0x485da5,_0x3ebc45){return new Promise(function(_0xd75564,_0x44facd){fs[_0x108c('0x9a')](_0x3ebc45,_0x485da5,function(_0x4c992f,_0x1f13fb){if(_0x4c992f){return _0x44facd(_0x4c992f);}else{return _0xd75564(_0x1f13fb);}});});}exports[_0x108c('0x9b')]=function(_0x32ed59,_0x23c775,_0x46267f){return db[_0x108c('0x32')][_0x108c('0x82')]({'where':{'id':_0x32ed59[_0x108c('0x4d')]['id']}})[_0x108c('0x2c')](handleEntityNotFound(_0x23c775))[_0x108c('0x2c')](function(_0x230091){if(_0x230091&&_0x230091[_0x108c('0x9c')]){var _0x2a8ce0=_0x230091[_0x108c('0x9c')];var _0x2ccf46=config['root']+_0x108c('0x9d')+_0x230091['id']+_0x108c('0x9e');if(fs[_0x108c('0x69')](_0x2ccf46)){return _0x2ccf46;}return writeFile(_0x2a8ce0,_0x2ccf46)[_0x108c('0x2c')](function(){return _0x2ccf46;});}else{throw new db[(_0x108c('0x5b'))][(_0x108c('0x5c'))](_0x108c('0x9f'));}})['then'](function(_0x353bdd){return _0x23c775[_0x108c('0x5f')](_0x353bdd);})[_0x108c('0x4b')](handleError(_0x23c775));}; \ No newline at end of file +var _0x1f9b=['bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','filters','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','rows','catch','show','params','keys','intersection','includeAll','options','find','body','describe','uniqueid','value','%s.cypher','existsSync','ValidationError','filename','download','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','../../components/encryptor','sequelize','col','token','$and','push','decryptFile','secrets','recording','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload','TranscribeService','basename','Location'];(function(_0x2b0c7b,_0x479338){var _0x15aee=function(_0x54c0eb){while(--_0x54c0eb){_0x2b0c7b['push'](_0x2b0c7b['shift']());}};_0x15aee(++_0x479338);}(_0x1f9b,0x1e7));var _0xb1f9=function(_0x188d57,_0x848da0){_0x188d57=_0x188d57-0x0;var _0x137703=_0x1f9b[_0x188d57];return _0x137703;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1f9('0x1'));var rp=require(_0xb1f9('0x2'));var moment=require(_0xb1f9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb1f9('0x4'));var path=require(_0xb1f9('0x5'));var sox=require(_0xb1f9('0x6'));var csv=require(_0xb1f9('0x7'));var ejs=require(_0xb1f9('0x8'));var fs=require('fs');var fs_extra=require(_0xb1f9('0x9'));var _=require(_0xb1f9('0xa'));var squel=require(_0xb1f9('0xb'));var crypto=require(_0xb1f9('0xc'));var jsforce=require(_0xb1f9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb1f9('0x7'));var querystring=require(_0xb1f9('0xe'));var Papa=require(_0xb1f9('0xf'));var AWS=require(_0xb1f9('0x10'));var uuidv4=require(_0xb1f9('0x11'));var Redis=require(_0xb1f9('0x12'));var authService=require(_0xb1f9('0x13'));var qs=require(_0xb1f9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1f9('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xb1f9('0x16'));var config=require(_0xb1f9('0x17'));var licenseUtil=require(_0xb1f9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35adcf,_0x134ebf){_0x134ebf=_0x134ebf||0xcc;return function(_0x2bb1d6){if(_0x2bb1d6){return _0x35adcf[_0xb1f9('0x19')](_0x134ebf);}return _0x35adcf[_0xb1f9('0x1a')](_0x134ebf)[_0xb1f9('0x1b')]();};}function respondWithResult(_0x4422b5,_0x9b141b){_0x9b141b=_0x9b141b||0xc8;return function(_0x3c99ac){if(_0x3c99ac){return _0x4422b5['status'](_0x9b141b)[_0xb1f9('0x1c')](_0x3c99ac);}};}function respondWithFilteredResult(_0x529051,_0x8882bb){return function(_0x2b9d8d){if(_0x2b9d8d){var _0x499ed4=typeof _0x8882bb[_0xb1f9('0x1d')]==='undefined'&&typeof _0x8882bb[_0xb1f9('0x1e')]===_0xb1f9('0x1f');var _0x4262c0=_0x2b9d8d[_0xb1f9('0x20')];var _0x3ba10a=_0x499ed4?0x0:_0x8882bb[_0xb1f9('0x1d')];var _0x54348c=_0x499ed4?_0x2b9d8d[_0xb1f9('0x20')]:_0x8882bb[_0xb1f9('0x1d')]+_0x8882bb[_0xb1f9('0x1e')];var _0x38d3d9;if(_0x54348c>=_0x4262c0){_0x54348c=_0x4262c0;_0x38d3d9=0xc8;}else{_0x38d3d9=0xce;}_0x529051[_0xb1f9('0x1a')](_0x38d3d9);return _0x529051[_0xb1f9('0x21')](_0xb1f9('0x22'),_0x3ba10a+'-'+_0x54348c+'/'+_0x4262c0)[_0xb1f9('0x1c')](_0x2b9d8d);}return null;};}function patchUpdates(_0x1423c0){return function(_0x50dc7c){try{jsonpatch['apply'](_0x50dc7c,_0x1423c0,!![]);}catch(_0x195a05){return BPromise[_0xb1f9('0x23')](_0x195a05);}return _0x50dc7c[_0xb1f9('0x24')]();};}function saveUpdates(_0x4bdbb9,_0x18ecca){return function(_0x442c75){if(_0x442c75){return _0x442c75[_0xb1f9('0x25')](_0x4bdbb9)[_0xb1f9('0x26')](function(_0x2ab502){return _0x2ab502;});}return null;};}function removeEntity(_0xf815d0,_0x39d128){return function(_0x6ab797){if(_0x6ab797){return _0x6ab797[_0xb1f9('0x27')]()[_0xb1f9('0x26')](function(){_0xf815d0[_0xb1f9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43ae83,_0x7790c3){return function(_0x2cdb36){if(!_0x2cdb36){_0x43ae83['sendStatus'](0x194);}return _0x2cdb36;};}function handleError(_0x3b0799,_0x5d7c7d){_0x5d7c7d=_0x5d7c7d||0x1f4;return function(_0x390c9a){logger[_0xb1f9('0x28')](_0x390c9a[_0xb1f9('0x29')]);if(_0x390c9a[_0xb1f9('0x2a')]){delete _0x390c9a[_0xb1f9('0x2a')];}_0x3b0799['status'](_0x5d7c7d)[_0xb1f9('0x2b')](_0x390c9a);};}exports[_0xb1f9('0x2c')]=function(_0x796c65,_0x2c2587){var _0x1c744b={},_0x361f0b={},_0x546f44={'count':0x0,'rows':[]};var _0x46117e=_[_0xb1f9('0x2d')](db[_0xb1f9('0x2e')]['rawAttributes'],function(_0x231dfd){return{'name':_0x231dfd[_0xb1f9('0x2f')],'type':_0x231dfd[_0xb1f9('0x30')][_0xb1f9('0x31')]};});_0x361f0b[_0xb1f9('0x32')]=_[_0xb1f9('0x33')](_[_0xb1f9('0x2d')](_0x46117e,_0xb1f9('0x2a')),[_0xb1f9('0x34')]);_0x361f0b['query']=_['keys'](_0x796c65[_0xb1f9('0x35')]);_0x361f0b[_0xb1f9('0x36')]=_['intersection'](_0x361f0b[_0xb1f9('0x32')],_0x361f0b['query']);_0x1c744b[_0xb1f9('0x37')]=_['intersection'](_0x361f0b[_0xb1f9('0x32')],qs['fields'](_0x796c65['query'][_0xb1f9('0x38')]));_0x1c744b[_0xb1f9('0x37')]=_0x1c744b[_0xb1f9('0x37')][_0xb1f9('0x39')]?_0x1c744b[_0xb1f9('0x37')]:_0x361f0b['model'];if(!_0x796c65['query']['hasOwnProperty']('nolimit')){_0x1c744b[_0xb1f9('0x1e')]=qs[_0xb1f9('0x1e')](_0x796c65[_0xb1f9('0x35')]['limit']);_0x1c744b[_0xb1f9('0x1d')]=qs[_0xb1f9('0x1d')](_0x796c65['query'][_0xb1f9('0x1d')]);}_0x1c744b[_0xb1f9('0x3a')]=qs['sort'](_0x796c65[_0xb1f9('0x35')][_0xb1f9('0x3b')]);_0x1c744b[_0xb1f9('0x3c')]=qs['filters'](_[_0xb1f9('0x3d')](_0x796c65['query'],_0x361f0b[_0xb1f9('0x36')]),_0x46117e);if(_0x796c65[_0xb1f9('0x35')]['filter']){_0x1c744b[_0xb1f9('0x3c')]=_[_0xb1f9('0x3e')](_0x1c744b[_0xb1f9('0x3c')],{'$or':_[_0xb1f9('0x2d')](_0x46117e,function(_0x5a79da){if(_0x5a79da[_0xb1f9('0x30')]!==_0xb1f9('0x3f')){var _0x4c66e8={};_0x4c66e8[_0x5a79da['name']]={'$like':'%'+_0x796c65[_0xb1f9('0x35')][_0xb1f9('0x40')]+'%'};return _0x4c66e8;}})});}_0x1c744b=_[_0xb1f9('0x3e')]({},_0x1c744b,_0x796c65['options']);var _0x5d9edb={'where':_0x1c744b[_0xb1f9('0x3c')]};return db[_0xb1f9('0x2e')][_0xb1f9('0x20')](_0x5d9edb)[_0xb1f9('0x26')](function(_0x5411dc){_0x546f44[_0xb1f9('0x20')]=_0x5411dc;if(_0x796c65[_0xb1f9('0x35')]['includeAll']){_0x1c744b['include']=[{'all':!![]}];}return db[_0xb1f9('0x2e')]['findAll'](_0x1c744b);})[_0xb1f9('0x26')](function(_0x56ab3e){_0x546f44[_0xb1f9('0x41')]=_0x56ab3e;return _0x546f44;})[_0xb1f9('0x26')](respondWithFilteredResult(_0x2c2587,_0x1c744b))[_0xb1f9('0x42')](handleError(_0x2c2587,null));};exports[_0xb1f9('0x43')]=function(_0x9240bb,_0x3466f3){var _0xe09786={'raw':![],'where':{'id':_0x9240bb[_0xb1f9('0x44')]['id']}},_0x2aaa32={};_0x2aaa32[_0xb1f9('0x32')]=_['keys'](db[_0xb1f9('0x2e')]['rawAttributes']);_0x2aaa32[_0xb1f9('0x35')]=_[_0xb1f9('0x45')](_0x9240bb[_0xb1f9('0x35')]);_0x2aaa32['filters']=_[_0xb1f9('0x46')](_0x2aaa32[_0xb1f9('0x32')],_0x2aaa32[_0xb1f9('0x35')]);_0xe09786[_0xb1f9('0x37')]=_[_0xb1f9('0x46')](_0x2aaa32[_0xb1f9('0x32')],qs[_0xb1f9('0x38')](_0x9240bb['query']['fields']));_0xe09786[_0xb1f9('0x37')]=_0xe09786[_0xb1f9('0x37')][_0xb1f9('0x39')]?_0xe09786[_0xb1f9('0x37')]:_0x2aaa32['model'];if(_0x9240bb[_0xb1f9('0x35')][_0xb1f9('0x47')]){_0xe09786['include']=[{'all':!![]}];}_0xe09786=_['merge']({},_0xe09786,_0x9240bb[_0xb1f9('0x48')]);return db[_0xb1f9('0x2e')][_0xb1f9('0x49')](_0xe09786)[_0xb1f9('0x26')](handleEntityNotFound(_0x3466f3,null))[_0xb1f9('0x26')](respondWithResult(_0x3466f3,null))[_0xb1f9('0x42')](handleError(_0x3466f3,null));};exports['create']=function(_0x403dfc,_0xb0dc20){return db[_0xb1f9('0x2e')]['create'](_0x403dfc[_0xb1f9('0x4a')],{})[_0xb1f9('0x26')](respondWithResult(_0xb0dc20,0xc9))['catch'](handleError(_0xb0dc20,null));};exports[_0xb1f9('0x25')]=function(_0x1f7a54,_0x4db2c1){if(_0x1f7a54[_0xb1f9('0x4a')]['id']){delete _0x1f7a54['body']['id'];}return db['VoiceRecording'][_0xb1f9('0x49')]({'where':{'id':_0x1f7a54['params']['id']}})[_0xb1f9('0x26')](handleEntityNotFound(_0x4db2c1,null))['then'](saveUpdates(_0x1f7a54[_0xb1f9('0x4a')],null))[_0xb1f9('0x26')](respondWithResult(_0x4db2c1,null))['catch'](handleError(_0x4db2c1,null));};exports['describe']=function(_0x12e681,_0xa2c70f){return db[_0xb1f9('0x2e')][_0xb1f9('0x4b')]()['then'](respondWithResult(_0xa2c70f,null))[_0xb1f9('0x42')](handleError(_0xa2c70f,null));};exports['download']=function(_0xe0c923,_0x37d3ae,_0x25ffc9){var _0x53a3fd=require('../../components/encryptor');var _0x2e5d95=![];var _0x3514e8={};if(_0xe0c923['query'][_0xb1f9('0x30')]&&_0xe0c923[_0xb1f9('0x35')]['type']===_0xb1f9('0x4c')){_0x3514e8[_0xb1f9('0x4c')]=_0xe0c923[_0xb1f9('0x44')]['id'];}else{_0x3514e8['id']=_0xe0c923[_0xb1f9('0x44')]['id'];}return db[_0xb1f9('0x2e')][_0xb1f9('0x49')]({'where':_0x3514e8,'attributes':['id','value'],'raw':!![]})[_0xb1f9('0x26')](handleEntityNotFound(_0x37d3ae,null))[_0xb1f9('0x26')](function(_0x396f1d){if(_0x396f1d){var _0x5dd04b=_0x396f1d[_0xb1f9('0x4d')];var _0x3adcc3=util[_0xb1f9('0x34')](_0xb1f9('0x4e'),_0x5dd04b);if(fs[_0xb1f9('0x4f')](_0x3adcc3)){_0x2e5d95=!![];return _0x53a3fd['decryptFile'](_0x3adcc3,_0x5dd04b,config['secrets']['recording'])[_0xb1f9('0x26')](function(){return _0x396f1d;});}return _0x396f1d;}})['then'](function(_0x3dfc8d){if(_0x3dfc8d){var _0x2276dc=_0x3dfc8d[_0xb1f9('0x4d')];if(!fs['existsSync'](_0x2276dc)){throw new db['Sequelize'][(_0xb1f9('0x50'))]('VoiceRecording\x20not\x20found');}if(_0x3dfc8d[_0xb1f9('0x51')]){return _0x37d3ae[_0xb1f9('0x52')](_0x2276dc,_0x3dfc8d[_0xb1f9('0x51')]+path[_0xb1f9('0x53')](_0x2276dc),function(){if(_0x2e5d95){fs[_0xb1f9('0x54')](_0x2276dc);}});}else{return _0x37d3ae[_0xb1f9('0x52')](_0x2276dc,function(_0x2445b3){if(_0x2e5d95){fs[_0xb1f9('0x54')](_0x2276dc);}});}}})[_0xb1f9('0x42')](function(_0x1f0899){if(_0x1f0899[_0xb1f9('0x55')]===_0xb1f9('0x56')){_0x37d3ae[_0xb1f9('0x1a')](0x194)[_0xb1f9('0x2b')](_0xb1f9('0x57'));}else{return handleError(_0x37d3ae,null);}});};exports['downloads']=function(_0x4ca673,_0x294d84,_0x3e9854){var _0x3b2d4b=require(_0xb1f9('0x58'));var _0x222827=![];var _0x4a5b2b={'$and':[db['sequelize'][_0xb1f9('0x3c')](db[_0xb1f9('0x59')]['fn']('MD5',db[_0xb1f9('0x59')][_0xb1f9('0x5a')](_0xb1f9('0x4c'))),_0x4ca673[_0xb1f9('0x35')][_0xb1f9('0x5b')])]};if(_0x4ca673[_0xb1f9('0x35')][_0xb1f9('0x30')]&&_0x4ca673['query'][_0xb1f9('0x30')]==='uniqueid'){_0x4a5b2b[_0xb1f9('0x5c')][_0xb1f9('0x5d')]({'uniqueid':_0x4ca673[_0xb1f9('0x44')]['id']});}else{_0x4a5b2b['$and'][_0xb1f9('0x5d')]({'id':_0x4ca673[_0xb1f9('0x44')]['id']});}return db['VoiceRecording'][_0xb1f9('0x49')]({'where':_0x4a5b2b,'attributes':['id',_0xb1f9('0x4d')],'raw':!![]})[_0xb1f9('0x26')](handleEntityNotFound(_0x294d84,null))[_0xb1f9('0x26')](function(_0x2472a1){if(_0x2472a1){var _0x5eaa01=util[_0xb1f9('0x34')](_0xb1f9('0x4e'),_0x2472a1[_0xb1f9('0x4d')]);if(fs[_0xb1f9('0x4f')](_0x5eaa01)){_0x222827=!![];return _0x3b2d4b[_0xb1f9('0x5e')](_0x5eaa01,_0x2472a1[_0xb1f9('0x4d')],config[_0xb1f9('0x5f')][_0xb1f9('0x60')])[_0xb1f9('0x26')](function(){return _0x2472a1;});}return _0x2472a1;}})[_0xb1f9('0x26')](function(_0x31ceea){if(_0x31ceea){if(!fs['existsSync'](_0x31ceea[_0xb1f9('0x4d')])){throw new db['Sequelize']['ValidationError'](_0xb1f9('0x56'));}if(_0x31ceea[_0xb1f9('0x51')]){return _0x294d84[_0xb1f9('0x52')](_0x31ceea[_0xb1f9('0x4d')],_0x31ceea['filename']+path['extname'](_0x31ceea[_0xb1f9('0x4d')]),function(){if(_0x222827){fs[_0xb1f9('0x54')](_0x31ceea[_0xb1f9('0x4d')]);}});}else{return _0x294d84['download'](_0x31ceea[_0xb1f9('0x4d')],function(_0x521a7d){if(_0x222827){fs[_0xb1f9('0x54')](_0x31ceea[_0xb1f9('0x4d')]);}});}}})[_0xb1f9('0x42')](handleError(_0x294d84,null));};exports[_0xb1f9('0x27')]=function(_0x4870ca,_0x2bbbc6){return db[_0xb1f9('0x2e')][_0xb1f9('0x49')]({'where':{'id':_0x4870ca[_0xb1f9('0x44')]['id']}})[_0xb1f9('0x26')](function(_0x18e4e6){if(_[_0xb1f9('0x61')](_0x18e4e6)){throw new ReferenceError(_0xb1f9('0x62'));}return _0x18e4e6;})[_0xb1f9('0x26')](function(_0xb5dd27){var _0x3b0311=_0xb5dd27[_0xb1f9('0x4d')];logger[_0xb1f9('0x63')](_0xb1f9('0x64'),_0x3b0311);if(!_[_0xb1f9('0x61')](_0xb5dd27[_0xb1f9('0x4d')])&&fs[_0xb1f9('0x4f')](_0x3b0311)){logger[_0xb1f9('0x63')]('File:\x20\x22'+_0x3b0311+_0xb1f9('0x65'));fs[_0xb1f9('0x66')](_0x3b0311);}_0x3b0311=_0x3b0311+_0xb1f9('0x67');if(!_[_0xb1f9('0x61')](_0xb5dd27['value'])&&fs[_0xb1f9('0x4f')](_0x3b0311)){logger[_0xb1f9('0x63')]('File:\x20\x22'+_0x3b0311+_0xb1f9('0x65'));fs[_0xb1f9('0x66')](_0x3b0311);}return _0xb5dd27;})[_0xb1f9('0x26')](function(_0x211e1c){if(!_0x211e1c)throw new InternalError();return _0x211e1c['destroy']();})[_0xb1f9('0x26')](function(){_0x2bbbc6[_0xb1f9('0x1a')](0xcc)[_0xb1f9('0x1b')]();})[_0xb1f9('0x42')](handleError(_0x2bbbc6,null));};function getBucketslist(_0x33fb6a,_0x423f23,_0xebc08b){return new Promise(function(_0x26602d,_0xa7eac3){var _0x3b9b7a=new AWS['S3']({'accessKeyId':_0x423f23,'secretAccessKey':_0x33fb6a,'region':_0xebc08b});_0x3b9b7a['listBuckets']({},function(_0x1168db,_0x2e356f){if(_0x1168db){return _0xa7eac3(_0x1168db);}else{return _0x26602d(_0x2e356f);}});});}function createBucket(_0x373824,_0xb5a756,_0x1d9675,_0x118b49){return new Promise(function(_0x49f791,_0x287a08){var _0x4a4e17=new AWS['S3']({'accessKeyId':_0xb5a756,'secretAccessKey':_0x373824,'region':_0x1d9675});_0x4a4e17[_0xb1f9('0x68')]({'Bucket':_0x118b49},function(_0x5e0070,_0x528477){if(_0x5e0070){return _0x287a08(_0x5e0070);}else{return _0x49f791(_0x528477);}});});}function uploadFile(_0xe92c5d,_0x9de806,_0x4ed4b9,_0x4df435,_0x5ec5c1,_0x5742ee){return new Promise(function(_0x17e15d,_0x505621){var _0x34e650=new AWS['S3']({'accessKeyId':_0x9de806,'secretAccessKey':_0xe92c5d,'region':_0x4ed4b9});_0x34e650[_0xb1f9('0x69')]({'Bucket':_0x4df435,'Key':_0x5ec5c1,'Body':_0x5742ee},function(_0x40413e,_0x5290e7){if(_0x40413e){return _0x505621(_0x40413e);}else{return _0x17e15d(_0x5290e7);}});});}function startTranscribe(_0x3d3235,_0x589680,_0x2a392f,_0x1cb6e9,_0x3eec8d,_0x1a4f7a){return new Promise(function(_0x134dc4,_0x311379){var _0x1d7b6b=new AWS[(_0xb1f9('0x6a'))]({'accessKeyId':_0x589680,'secretAccessKey':_0x3d3235,'region':_0x2a392f});_0x1d7b6b['startTranscriptionJob']({'TranscriptionJobName':_0x1cb6e9,'LanguageCode':_0x3eec8d,'Media':{'MediaFileUri':_0x1a4f7a}},function(_0x4f0c40,_0x2825c0){if(_0x4f0c40){return _0x311379(_0x4f0c40);}else{return _0x134dc4(_0x2825c0);}});});}function transcribe(_0x22cc57,_0x88968f,_0x408ef7,_0x1ab3f6,_0x39cb73,_0x5179d5,_0x1ace45){return new Promise(function(_0x43ec18,_0x2bcf28){var _0xbafa0d={};logger[_0xb1f9('0x63')](util[_0xb1f9('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x22cc57,_0x39cb73));return uploadFile(_0x88968f,_0x408ef7,_0x1ab3f6,_0x39cb73,path[_0xb1f9('0x6b')](_0x5179d5),fs['readFileSync'](_0x5179d5))[_0xb1f9('0x26')](function(_0x5c5331){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x22cc57,_0x39cb73,_0x5c5331[_0xb1f9('0x6c')]));_0xbafa0d[_0xb1f9('0x6d')]=_0x5c5331[_0xb1f9('0x6e')];_0xbafa0d[_0xb1f9('0x6f')]=_0x5c5331[_0xb1f9('0x6c')];logger[_0xb1f9('0x63')](util[_0xb1f9('0x34')](_0xb1f9('0x70'),_0x22cc57));return startTranscribe(_0x88968f,_0x408ef7,_0x1ab3f6,uuidv4(),_0x1ace45,_0x5c5331[_0xb1f9('0x6c')]);})['then'](function(_0x4fb742){logger[_0xb1f9('0x63')](util['format'](_0xb1f9('0x71'),_0x22cc57,_0x4fb742[_0xb1f9('0x72')]['TranscriptionJobName']));_0xbafa0d[_0xb1f9('0x73')]=_0x4fb742[_0xb1f9('0x72')][_0xb1f9('0x74')];_0xbafa0d[_0xb1f9('0x75')]=_0x4fb742['TranscriptionJob']['TranscriptionJobStatus'];return _0x43ec18(_0xbafa0d);})[_0xb1f9('0x42')](function(_0x1d0ed0){return _0x2bcf28(_0x1d0ed0);});});}exports[_0xb1f9('0x76')]=function(_0x24de3d,_0x44a71d,_0x4be729){var _0x4b769d;var _0x34a42c;var _0x121f34;var _0x5714bb=require('../../components/encryptor');return db[_0xb1f9('0x2e')][_0xb1f9('0x77')]({'where':{'id':_0x24de3d[_0xb1f9('0x44')]['id']}})[_0xb1f9('0x26')](function(_0x3d4f02){if(_0x3d4f02){var _0x2ab3dd=util[_0xb1f9('0x34')]('%s.cypher',_0x3d4f02['value']);if(fs[_0xb1f9('0x4f')](_0x2ab3dd)){cypher=!![];return _0x5714bb[_0xb1f9('0x5e')](_0x2ab3dd,_0x3d4f02[_0xb1f9('0x4d')],config[_0xb1f9('0x5f')]['recording'])[_0xb1f9('0x26')](function(){return _0x3d4f02;});}return _0x3d4f02;}})[_0xb1f9('0x26')](function(_0x257c56){if(!_0x257c56){throw new db[(_0xb1f9('0x78'))]['ValidationError'](_0xb1f9('0x79'));}_0x34a42c=_0x257c56;return db[_0xb1f9('0x7a')][_0xb1f9('0x77')]({'where':{'id':0x1}});})[_0xb1f9('0x26')](handleEntityNotFound(_0x44a71d,null))['then'](function(_0x265e34){if(_0x265e34){_0x4b769d=_0x265e34;if(!_0x4b769d[_0xb1f9('0x7b')]||!_0x4b769d[_0xb1f9('0x7c')]||!_0x4b769d[_0xb1f9('0x7d')]||!_0x4b769d[_0xb1f9('0x7e')]||!_0x4b769d[_0xb1f9('0x6d')]){throw new db[(_0xb1f9('0x78'))]['ValidationError'](_0xb1f9('0x7f'));}if(_0x24de3d[_0xb1f9('0x4a')][_0xb1f9('0x80')]&&(!_0x4b769d[_0xb1f9('0x81')]||!_0x4b769d[_0xb1f9('0x82')]||!_0x4b769d['sentimentRegion']||!_0x4b769d[_0xb1f9('0x7e')]||!_0x4b769d['bucket'])){throw new db['Sequelize'][(_0xb1f9('0x50'))](_0xb1f9('0x83'));}return db[_0xb1f9('0x84')]['findOne']({'where':{'id':_0x4b769d['transcribeAccountId']}});}})[_0xb1f9('0x26')](function(_0x41f044){if(!_0x41f044){throw new db[(_0xb1f9('0x78'))][(_0xb1f9('0x50'))](_0xb1f9('0x85'));}if(!_0x41f044[_0xb1f9('0x86')]||!_0x41f044[_0xb1f9('0x87')]){throw new db['Sequelize'][(_0xb1f9('0x50'))](_0xb1f9('0x88'));}_0x121f34=_0x41f044;return getBucketslist(_0x121f34[_0xb1f9('0x86')],_0x121f34[_0xb1f9('0x87')],_0x4b769d['transcribeRegion']);})[_0xb1f9('0x26')](function(_0x3cad70){if(_0x3cad70&&_0x3cad70[_0xb1f9('0x89')]){var _0x10a052=_[_0xb1f9('0x49')](_0x3cad70[_0xb1f9('0x89')],function(_0x37e1d3){return _0x37e1d3[_0xb1f9('0x8a')]===_0x4b769d['bucket'];});if(!_0x10a052){logger[_0xb1f9('0x63')](util['format'](_0xb1f9('0x8b'),_0x24de3d[_0xb1f9('0x44')]['id'],_0x4b769d[_0xb1f9('0x6d')]));return createBucket(_0x121f34['data1'],_0x121f34[_0xb1f9('0x87')],_0x4b769d[_0xb1f9('0x7d')],_0x4b769d['bucket']);}logger[_0xb1f9('0x63')](util['format'](_0xb1f9('0x8c'),_0x24de3d[_0xb1f9('0x44')]['id'],_0x4b769d[_0xb1f9('0x6d')]));return;}})[_0xb1f9('0x26')](function(_0x35838d){if(_0x34a42c[_0xb1f9('0x75')]===_0xb1f9('0x8d')){return transcribe(_0x24de3d[_0xb1f9('0x44')]['id'],_0x121f34['data1'],_0x121f34['data2'],_0x4b769d['transcribeRegion'],_0x4b769d[_0xb1f9('0x6d')],_0x34a42c[_0xb1f9('0x4d')],_0x4b769d[_0xb1f9('0x7e')]);}else{logger[_0xb1f9('0x63')](util[_0xb1f9('0x34')](_0xb1f9('0x8e'),_0x24de3d[_0xb1f9('0x44')]['id']));return{'transcribeStatus':_0xb1f9('0x8f')};}})[_0xb1f9('0x26')](function(_0x45092e){if(_0x45092e){_0x45092e['tempSentiment']=_0x24de3d[_0xb1f9('0x4a')]['runSentiment'];return _0x34a42c[_0xb1f9('0x90')](_0x45092e);}})['then'](respondWithResult(_0x44a71d,null))[_0xb1f9('0x42')](handleError(_0x44a71d,null));};function writeFile(_0xcfeb4e,_0x3c19c5){return new Promise(function(_0x19cc6b,_0xdd8c70){fs['writeFile'](_0x3c19c5,_0xcfeb4e,function(_0x18b803,_0x7d1666){if(_0x18b803){return _0xdd8c70(_0x18b803);}else{return _0x19cc6b(_0x7d1666);}});});}exports['downloadTranscribe']=function(_0x336e58,_0x15854b,_0x4b0cfe){return db[_0xb1f9('0x2e')]['findOne']({'where':{'id':_0x336e58[_0xb1f9('0x44')]['id']}})[_0xb1f9('0x26')](handleEntityNotFound(_0x15854b))['then'](function(_0xd0e274){if(_0xd0e274&&_0xd0e274[_0xb1f9('0x91')]){var _0x49533a=_0xd0e274[_0xb1f9('0x91')];var _0x1279f6=config[_0xb1f9('0x92')]+_0xb1f9('0x93')+_0xd0e274['id']+_0xb1f9('0x94');if(fs[_0xb1f9('0x4f')](_0x1279f6)){return _0x1279f6;}return writeFile(_0x49533a,_0x1279f6)[_0xb1f9('0x26')](function(){return _0x1279f6;});}else{throw new db[(_0xb1f9('0x78'))][(_0xb1f9('0x50'))]('Transcript\x20not\x20available');}})[_0xb1f9('0x26')](function(_0x23b7be){return _0x15854b[_0xb1f9('0x52')](_0x23b7be);})['catch'](handleError(_0x15854b));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index e48e8e0..8d6954e 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 _0xea70=['transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid'];(function(_0x25e545,_0x4939a4){var _0x4c19b5=function(_0x441b83){while(--_0x441b83){_0x25e545['push'](_0x25e545['shift']());}};_0x4c19b5(++_0x4939a4);}(_0xea70,0x175));var _0x0ea7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea70[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x0ea7('0x0'));module[_0x0ea7('0x1')]=function(_0x43f027,_0x5443ee){return _0x43f027[_0x0ea7('0x2')]('VoiceRecording',attributes,{'tableName':_0x0ea7('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0ea7('0x4')]},{'name':_0x0ea7('0x5'),'fields':[_0x0ea7('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5178=['define','VoiceRecording','uniqueid','transcribeStatus','exports'];(function(_0x5f2826,_0x375841){var _0x1f8f43=function(_0x166691){while(--_0x166691){_0x5f2826['push'](_0x5f2826['shift']());}};_0x1f8f43(++_0x375841);}(_0x5178,0x171));var _0x8517=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5178[_0x6131cd];return _0x47e916;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x8517('0x0')]=function(_0x150a6a,_0x27662b){return _0x150a6a[_0x8517('0x1')](_0x8517('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8517('0x3')]},{'name':_0x8517('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index f94bc1e..c2061ef 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 _0x4325=['attributes','CreateVoiceRecording','Setting','findOne','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where'];(function(_0x277a8d,_0x8f4900){var _0x3e1793=function(_0x5e8f41){while(--_0x5e8f41){_0x277a8d['push'](_0x277a8d['shift']());}};_0x3e1793(++_0x8f4900);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')](_0x32fe60[_0x5432('0x1a')],{'raw':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32fe60['options']?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1d')]||null:null,'attributes':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1e')]||null:null,'limit':_0x32fe60['options']?_0x32fe60['options']['limit']||null:null})[_0x5432('0xb')](function(_0xb900f2){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger['debug']('UpdateVoiceRecording',_0x32fe60,JSON[_0x5432('0x10')](_0xb900f2));_0x5f011f(_0xb900f2);})[_0x5432('0x16')](function(_0x4a40fc){logger[_0x5432('0x12')](_0x5432('0x17'),_0x4a40fc[_0x5432('0x13')],_0x32fe60);_0x3f3873(_0x4221a8['error'](0x1f4,_0x4a40fc[_0x5432('0x13')]));});});};exports[_0x5432('0x1f')]=function(_0xe7eda2){var _0x520da1=this;return new Promise(function(_0x4ab09d,_0x1f2055){var _0x2114b8=require('../../components/encryptor');var _0x1abe73;return db[_0x5432('0x20')][_0x5432('0x21')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5432('0xb')](function(_0x5be867){_0x1abe73=_0x5be867;return db['VoiceRecording'][_0x5432('0x22')](_0xe7eda2['body']);})[_0x5432('0xb')](function(_0x578281){if(_0x1abe73['callRecordingEncryption']&&fs[_0x5432('0x23')](_0x578281[_0x5432('0x24')])){var _0x345b51=util['format'](_0x5432('0x25'),_0x578281[_0x5432('0x24')]);return _0x2114b8[_0x5432('0x26')](_0x578281[_0x5432('0x24')],_0x345b51,config[_0x5432('0x27')][_0x5432('0x28')])[_0x5432('0xb')](function(){fs[_0x5432('0x29')](_0x578281[_0x5432('0x24')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x578281;});}return _0x578281;})[_0x5432('0xb')](function(_0x42ab1e){logger[_0x5432('0x14')](_0x5432('0x1f'),_0xe7eda2);logger[_0x5432('0xd')]('CreateVoiceRecording',_0xe7eda2,JSON[_0x5432('0x10')](_0x42ab1e));_0x4ab09d(_0x42ab1e);})['catch'](function(_0x2955e0){logger[_0x5432('0x12')](_0x5432('0x1f'),_0x2955e0[_0x5432('0x13')],_0xe7eda2);_0x1f2055(_0x520da1[_0x5432('0x12')](0x1f4,_0x2955e0[_0x5432('0x13')]));});});}; \ No newline at end of file +var _0x5430=['info','request\x20sent','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','format','%s.cypher','value','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x208d58,_0x165c3b){var _0x1c6bb7=function(_0x42dd2f){while(--_0x42dd2f){_0x208d58['push'](_0x208d58['shift']());}};_0x1c6bb7(++_0x165c3b);}(_0x5430,0x10c));var _0x0543=function(_0x111f9c,_0x114ab5){_0x111f9c=_0x111f9c-0x0;var _0x5b9a82=_0x5430[_0x111f9c];return _0x5b9a82;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['update'](_0x20b396['body'],{'raw':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b396['options']?_0x20b396[_0x0543('0x17')]['where']||null:null,'attributes':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')]['attributes']||null:null,'limit':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x19')]||null:null})[_0x0543('0xb')](function(_0x37347e){logger[_0x0543('0xc')]('UpdateVoiceRecording',_0x20b396);logger['debug']('UpdateVoiceRecording',_0x20b396,JSON[_0x0543('0xf')](_0x37347e));_0x577cf0(_0x37347e);})[_0x0543('0x1a')](function(_0x15ebeb){logger[_0x0543('0x10')](_0x0543('0x15'),_0x15ebeb[_0x0543('0x13')],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x15ebeb[_0x0543('0x13')]));});});};exports[_0x0543('0x1b')]=function(_0xf1eccf){var _0x40a261=this;return new Promise(function(_0x21fc63,_0x547a88){var _0x25e6f1=require(_0x0543('0x1c'));var _0x30ad9e;return db['Setting'][_0x0543('0x1d')]({'attributes':['id',_0x0543('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0543('0xb')](function(_0x10b881){_0x30ad9e=_0x10b881;return db['VoiceRecording'][_0x0543('0x1f')](_0xf1eccf[_0x0543('0x20')]);})['then'](function(_0x576084){if(_0x30ad9e[_0x0543('0x1e')]&&fs[_0x0543('0x21')](_0x576084['value'])){var _0x3b879b=util[_0x0543('0x22')](_0x0543('0x23'),_0x576084[_0x0543('0x24')]);return _0x25e6f1[_0x0543('0x25')](_0x576084[_0x0543('0x24')],_0x3b879b,config[_0x0543('0x26')]['recording'])[_0x0543('0xb')](function(){fs['unlink'](_0x576084[_0x0543('0x24')]);logger[_0x0543('0xc')](_0x0543('0x27'));return _0x576084;});}return _0x576084;})[_0x0543('0xb')](function(_0x28307f){logger['info'](_0x0543('0x1b'),_0xf1eccf);logger['debug'](_0x0543('0x1b'),_0xf1eccf,JSON[_0x0543('0xf')](_0x28307f));_0x21fc63(_0x28307f);})[_0x0543('0x1a')](function(_0x327027){logger['error'](_0x0543('0x1b'),_0x327027['message'],_0xf1eccf);_0x547a88(_0x40a261[_0x0543('0x10')](0x1f4,_0x327027[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c25c7f1..99de93e 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 _0x4d79=['/describe','describe','/:id','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index'];(function(_0x2d3f62,_0x28eeac){var _0x1fdf6c=function(_0x4e5aab){while(--_0x4e5aab){_0x2d3f62['push'](_0x2d3f62['shift']());}};_0x1fdf6c(++_0x28eeac);}(_0x4d79,0x8e));var _0x94d7=function(_0x113afc,_0x2c7d5a){_0x113afc=_0x113afc-0x0;var _0x3a9219=_0x4d79[_0x113afc];return _0x3a9219;};'use strict';var multer=require('multer');var util=require(_0x94d7('0x0'));var path=require('path');var timeout=require(_0x94d7('0x1'));var express=require('express');var router=express[_0x94d7('0x2')]();var fs_extra=require(_0x94d7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x94d7('0x4'));var config=require(_0x94d7('0x5'));var controller=require(_0x94d7('0x6'));router[_0x94d7('0x7')]('/',auth[_0x94d7('0x8')](),controller[_0x94d7('0x9')]);router[_0x94d7('0x7')](_0x94d7('0xa'),auth[_0x94d7('0x8')](),controller[_0x94d7('0xb')]);router[_0x94d7('0x7')](_0x94d7('0xc'),auth[_0x94d7('0x8')](),controller['show']);router[_0x94d7('0xd')]('/',auth[_0x94d7('0x8')](),controller[_0x94d7('0xe')]);router[_0x94d7('0xf')]('/:id',auth[_0x94d7('0x8')](),controller[_0x94d7('0x10')]);router['delete'](_0x94d7('0xc'),auth[_0x94d7('0x8')](),controller[_0x94d7('0x11')]);module[_0x94d7('0x12')]=router; \ No newline at end of file +var _0x05ae=['update','delete','destroy','exports','multer','path','express','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x293e7a,_0x1792a2){var _0xb78342=function(_0x833afe){while(--_0x833afe){_0x293e7a['push'](_0x293e7a['shift']());}};_0xb78342(++_0x1792a2);}(_0x05ae,0x10e));var _0xe05a=function(_0x158b72,_0xc0c898){_0x158b72=_0x158b72-0x0;var _0x3c7fc8=_0x05ae[_0x158b72];return _0x3c7fc8;};'use strict';var multer=require(_0xe05a('0x0'));var util=require('util');var path=require(_0xe05a('0x1'));var timeout=require('connect-timeout');var express=require(_0xe05a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe05a('0x3'));var config=require('../../config/environment');var controller=require(_0xe05a('0x4'));router[_0xe05a('0x5')]('/',auth[_0xe05a('0x6')](),controller[_0xe05a('0x7')]);router[_0xe05a('0x5')](_0xe05a('0x8'),auth[_0xe05a('0x6')](),controller[_0xe05a('0x9')]);router[_0xe05a('0x5')](_0xe05a('0xa'),auth[_0xe05a('0x6')](),controller[_0xe05a('0xb')]);router[_0xe05a('0xc')]('/',auth[_0xe05a('0x6')](),controller[_0xe05a('0xd')]);router[_0xe05a('0xe')](_0xe05a('0xa'),auth[_0xe05a('0x6')](),controller[_0xe05a('0xf')]);router[_0xe05a('0x10')](_0xe05a('0xa'),auth['isAuthenticated'](),controller[_0xe05a('0x11')]);module[_0xe05a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 532c807..25b5fd1 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 _0xf04b=['blind','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0xf04b,0x168));var _0xbf04=function(_0x377f43,_0x5acb1a){_0x377f43=_0x377f43-0x0;var _0xa7a1f=_0xf04b[_0x377f43];return _0xa7a1f;};'use strict';var Sequelize=require(_0xbf04('0x0'));var moment=require(_0xbf04('0x1'));module[_0xbf04('0x2')]={'type':{'type':Sequelize[_0xbf04('0x3')](_0xbf04('0x4'),'attended')},'result':{'type':Sequelize[_0xbf04('0x5')]},'transfererchannel':{'type':Sequelize[_0xbf04('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xbf04('0x5')]},'transferercalleridname':{'type':Sequelize[_0xbf04('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xbf04('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xbf04('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xbf04('0x5')]},'transferercontext':{'type':Sequelize[_0xbf04('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xbf04('0x5')]},'transfereechannel':{'type':Sequelize[_0xbf04('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xbf04('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xbf04('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xbf04('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xbf04('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xbf04('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0xbf04('0x6'),'No')},'context':{'type':Sequelize[_0xbf04('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1a62=['sequelize','moment','exports','ENUM','attended','STRING','Yes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1a62,0xcb));var _0x21a6=function(_0x5d082a,_0x4aa33f){_0x5d082a=_0x5d082a-0x0;var _0xebd7f4=_0x1a62[_0x5d082a];return _0xebd7f4;};'use strict';var Sequelize=require(_0x21a6('0x0'));var moment=require(_0x21a6('0x1'));module[_0x21a6('0x2')]={'type':{'type':Sequelize[_0x21a6('0x3')]('blind',_0x21a6('0x4'))},'result':{'type':Sequelize[_0x21a6('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x21a6('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x21a6('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x21a6('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x21a6('0x5')]},'transferercontext':{'type':Sequelize[_0x21a6('0x5')]},'transfererexten':{'type':Sequelize[_0x21a6('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x21a6('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x21a6('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x21a6('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x21a6('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x21a6('0x5')]},'transfereecontext':{'type':Sequelize[_0x21a6('0x5')]},'transfereeexten':{'type':Sequelize[_0x21a6('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x21a6('0x6'),'No')},'context':{'type':Sequelize[_0x21a6('0x5')]},'extension':{'type':Sequelize[_0x21a6('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 4510496..edec353 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 _0x5ce8=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','params','keys','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','stack','name','map','VoiceTransferReport','rawAttributes','key','query','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ce8,0xb0));var _0x85ce=function(_0x3a3701,_0x91e5ce){_0x3a3701=_0x3a3701-0x0;var _0x532cb8=_0x5ce8[_0x3a3701];return _0x532cb8;};'use strict';var emlformat=require(_0x85ce('0x0'));var rimraf=require(_0x85ce('0x1'));var zipdir=require(_0x85ce('0x2'));var jsonpatch=require(_0x85ce('0x3'));var rp=require(_0x85ce('0x4'));var moment=require(_0x85ce('0x5'));var BPromise=require(_0x85ce('0x6'));var Mustache=require(_0x85ce('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x85ce('0x8'));var fs=require('fs');var fs_extra=require(_0x85ce('0x9'));var _=require(_0x85ce('0xa'));var squel=require(_0x85ce('0xb'));var crypto=require(_0x85ce('0xc'));var jsforce=require(_0x85ce('0xd'));var deskjs=require(_0x85ce('0xe'));var toCsv=require(_0x85ce('0xf'));var querystring=require(_0x85ce('0x10'));var Papa=require(_0x85ce('0x11'));var Redis=require(_0x85ce('0x12'));var authService=require(_0x85ce('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85ce('0x14'));var logger=require(_0x85ce('0x15'))(_0x85ce('0x16'));var utils=require(_0x85ce('0x17'));var config=require(_0x85ce('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x85ce('0x19'))['db'];function respondWithStatusCode(_0x3e365b,_0x14cb04){_0x14cb04=_0x14cb04||0xcc;return function(_0x53b32c){if(_0x53b32c){return _0x3e365b['sendStatus'](_0x14cb04);}return _0x3e365b[_0x85ce('0x1a')](_0x14cb04)[_0x85ce('0x1b')]();};}function respondWithResult(_0x1683d4,_0x29cb40){_0x29cb40=_0x29cb40||0xc8;return function(_0x9a9a19){if(_0x9a9a19){return _0x1683d4['status'](_0x29cb40)['json'](_0x9a9a19);}};}function respondWithFilteredResult(_0x35defd,_0x571776){return function(_0x3f2996){if(_0x3f2996){var _0x520992=typeof _0x571776[_0x85ce('0x1c')]===_0x85ce('0x1d')&&typeof _0x571776[_0x85ce('0x1e')]===_0x85ce('0x1d');var _0x2183e9=_0x3f2996[_0x85ce('0x1f')];var _0x7c03a8=_0x520992?0x0:_0x571776[_0x85ce('0x1c')];var _0x191d9d=_0x520992?_0x3f2996[_0x85ce('0x1f')]:_0x571776[_0x85ce('0x1c')]+_0x571776['limit'];var _0x4114d0;if(_0x191d9d>=_0x2183e9){_0x191d9d=_0x2183e9;_0x4114d0=0xc8;}else{_0x4114d0=0xce;}_0x35defd[_0x85ce('0x1a')](_0x4114d0);return _0x35defd[_0x85ce('0x20')](_0x85ce('0x21'),_0x7c03a8+'-'+_0x191d9d+'/'+_0x2183e9)[_0x85ce('0x22')](_0x3f2996);}return null;};}function patchUpdates(_0x53fe0e){return function(_0x280204){try{jsonpatch['apply'](_0x280204,_0x53fe0e,!![]);}catch(_0x48952f){return BPromise[_0x85ce('0x23')](_0x48952f);}return _0x280204[_0x85ce('0x24')]();};}function saveUpdates(_0x2340b3,_0x14db42){return function(_0x1cff2b){if(_0x1cff2b){return _0x1cff2b[_0x85ce('0x25')](_0x2340b3)[_0x85ce('0x26')](function(_0x3846d2){return _0x3846d2;});}return null;};}function removeEntity(_0x2f8c2a,_0x477d80){return function(_0x3dc6ac){if(_0x3dc6ac){return _0x3dc6ac[_0x85ce('0x27')]()[_0x85ce('0x26')](function(){_0x2f8c2a['status'](0xcc)[_0x85ce('0x1b')]();});}};}function handleEntityNotFound(_0x4cbcef,_0x4bb8c7){return function(_0x5c5a10){if(!_0x5c5a10){_0x4cbcef[_0x85ce('0x28')](0x194);}return _0x5c5a10;};}function handleError(_0x2d97a5,_0x4847be){_0x4847be=_0x4847be||0x1f4;return function(_0x4c767d){logger['error'](_0x4c767d[_0x85ce('0x29')]);if(_0x4c767d[_0x85ce('0x2a')]){delete _0x4c767d[_0x85ce('0x2a')];}_0x2d97a5[_0x85ce('0x1a')](_0x4847be)['send'](_0x4c767d);};}exports['index']=function(_0x4d84d1,_0x160acd){var _0x431c9a={},_0x5ecde7={},_0x5a672d={'count':0x0,'rows':[]};var _0x3456ae=_[_0x85ce('0x2b')](db[_0x85ce('0x2c')][_0x85ce('0x2d')],function(_0x2a650b){return{'name':_0x2a650b['fieldName'],'type':_0x2a650b['type'][_0x85ce('0x2e')]};});_0x5ecde7['model']=_[_0x85ce('0x2b')](_0x3456ae,_0x85ce('0x2a'));_0x5ecde7['query']=_['keys'](_0x4d84d1[_0x85ce('0x2f')]);_0x5ecde7[_0x85ce('0x30')]=_[_0x85ce('0x31')](_0x5ecde7['model'],_0x5ecde7[_0x85ce('0x2f')]);_0x431c9a['attributes']=_[_0x85ce('0x31')](_0x5ecde7[_0x85ce('0x32')],qs[_0x85ce('0x33')](_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x33')]));_0x431c9a[_0x85ce('0x34')]=_0x431c9a[_0x85ce('0x34')][_0x85ce('0x35')]?_0x431c9a[_0x85ce('0x34')]:_0x5ecde7[_0x85ce('0x32')];if(!_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x36')](_0x85ce('0x37'))){_0x431c9a['limit']=qs[_0x85ce('0x1e')](_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x1e')]);_0x431c9a['offset']=qs[_0x85ce('0x1c')](_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x1c')]);}_0x431c9a[_0x85ce('0x38')]=qs[_0x85ce('0x39')](_0x4d84d1['query']['sort']);_0x431c9a[_0x85ce('0x3a')]=qs['filters'](_[_0x85ce('0x3b')](_0x4d84d1[_0x85ce('0x2f')],_0x5ecde7[_0x85ce('0x30')]),_0x3456ae);if(_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x3c')]){_0x431c9a[_0x85ce('0x3a')]=_[_0x85ce('0x3d')](_0x431c9a[_0x85ce('0x3a')],{'$or':_['map'](_0x3456ae,function(_0xff79c){if(_0xff79c[_0x85ce('0x3e')]!==_0x85ce('0x3f')){var _0x1778b9={};_0x1778b9[_0xff79c[_0x85ce('0x2a')]]={'$like':'%'+_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x3c')]+'%'};return _0x1778b9;}})});}_0x431c9a=_['merge']({},_0x431c9a,_0x4d84d1['options']);var _0x385a3e={'where':_0x431c9a['where']};return db[_0x85ce('0x2c')][_0x85ce('0x1f')](_0x385a3e)['then'](function(_0x377825){_0x5a672d[_0x85ce('0x1f')]=_0x377825;if(_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x40')]){_0x431c9a[_0x85ce('0x41')]=[{'all':!![]}];}return db[_0x85ce('0x2c')][_0x85ce('0x42')](_0x431c9a);})['then'](function(_0x4b6d56){_0x5a672d['rows']=_0x4b6d56;return _0x5a672d;})['then'](respondWithFilteredResult(_0x160acd,_0x431c9a))['catch'](handleError(_0x160acd,null));};exports['show']=function(_0x3560d8,_0x44aa73){var _0x59ad8b={'raw':!![],'where':{'id':_0x3560d8[_0x85ce('0x43')]['id']}},_0xe3f799={};_0xe3f799[_0x85ce('0x32')]=_[_0x85ce('0x44')](db[_0x85ce('0x2c')][_0x85ce('0x2d')]);_0xe3f799['query']=_[_0x85ce('0x44')](_0x3560d8[_0x85ce('0x2f')]);_0xe3f799[_0x85ce('0x30')]=_[_0x85ce('0x31')](_0xe3f799[_0x85ce('0x32')],_0xe3f799[_0x85ce('0x2f')]);_0x59ad8b[_0x85ce('0x34')]=_['intersection'](_0xe3f799['model'],qs['fields'](_0x3560d8['query'][_0x85ce('0x33')]));_0x59ad8b[_0x85ce('0x34')]=_0x59ad8b['attributes'][_0x85ce('0x35')]?_0x59ad8b[_0x85ce('0x34')]:_0xe3f799[_0x85ce('0x32')];if(_0x3560d8[_0x85ce('0x2f')][_0x85ce('0x40')]){_0x59ad8b[_0x85ce('0x41')]=[{'all':!![]}];}_0x59ad8b=_[_0x85ce('0x3d')]({},_0x59ad8b,_0x3560d8[_0x85ce('0x45')]);return db['VoiceTransferReport'][_0x85ce('0x46')](_0x59ad8b)[_0x85ce('0x26')](handleEntityNotFound(_0x44aa73,null))[_0x85ce('0x26')](respondWithResult(_0x44aa73,null))[_0x85ce('0x47')](handleError(_0x44aa73,null));};exports[_0x85ce('0x48')]=function(_0x3eec39,_0x15699f){return db[_0x85ce('0x2c')]['create'](_0x3eec39[_0x85ce('0x49')],{})[_0x85ce('0x26')](respondWithResult(_0x15699f,0xc9))[_0x85ce('0x47')](handleError(_0x15699f,null));};exports['update']=function(_0x32915e,_0x2554de){if(_0x32915e[_0x85ce('0x49')]['id']){delete _0x32915e[_0x85ce('0x49')]['id'];}return db[_0x85ce('0x2c')][_0x85ce('0x46')]({'where':{'id':_0x32915e[_0x85ce('0x43')]['id']}})['then'](handleEntityNotFound(_0x2554de,null))[_0x85ce('0x26')](saveUpdates(_0x32915e[_0x85ce('0x49')],null))[_0x85ce('0x26')](respondWithResult(_0x2554de,null))[_0x85ce('0x47')](handleError(_0x2554de,null));};exports[_0x85ce('0x27')]=function(_0x343f7d,_0x16981c){return db[_0x85ce('0x2c')][_0x85ce('0x46')]({'where':{'id':_0x343f7d[_0x85ce('0x43')]['id']}})[_0x85ce('0x26')](handleEntityNotFound(_0x16981c,null))['then'](removeEntity(_0x16981c,null))[_0x85ce('0x47')](handleError(_0x16981c,null));};exports[_0x85ce('0x4a')]=function(_0x1debf2,_0xe21eb6){return db[_0x85ce('0x2c')][_0x85ce('0x4a')]()[_0x85ce('0x26')](respondWithResult(_0xe21eb6,null))[_0x85ce('0x47')](handleError(_0xe21eb6,null));}; \ No newline at end of file +var _0x464f=['papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceTransferReport','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring'];(function(_0x33d7be,_0x594f0d){var _0x1e0e2d=function(_0x1cbcf2){while(--_0x1cbcf2){_0x33d7be['push'](_0x33d7be['shift']());}};_0x1e0e2d(++_0x594f0d);}(_0x464f,0x116));var _0xf464=function(_0x1e5546,_0x3b69d6){_0x1e5546=_0x1e5546-0x0;var _0x3dca0a=_0x464f[_0x1e5546];return _0x3dca0a;};'use strict';var emlformat=require(_0xf464('0x0'));var rimraf=require(_0xf464('0x1'));var zipdir=require(_0xf464('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf464('0x3'));var Mustache=require(_0xf464('0x4'));var util=require(_0xf464('0x5'));var path=require(_0xf464('0x6'));var sox=require(_0xf464('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf464('0x8'));var _=require(_0xf464('0x9'));var squel=require(_0xf464('0xa'));var crypto=require(_0xf464('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf464('0xc'));var querystring=require(_0xf464('0xd'));var Papa=require(_0xf464('0xe'));var Redis=require(_0xf464('0xf'));var authService=require(_0xf464('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf464('0x11'))(_0xf464('0x12'));var utils=require(_0xf464('0x13'));var config=require(_0xf464('0x14'));var licenseUtil=require(_0xf464('0x15'));var db=require(_0xf464('0x16'))['db'];function respondWithStatusCode(_0x8e6f85,_0x561bb1){_0x561bb1=_0x561bb1||0xcc;return function(_0x563923){if(_0x563923){return _0x8e6f85[_0xf464('0x17')](_0x561bb1);}return _0x8e6f85[_0xf464('0x18')](_0x561bb1)['end']();};}function respondWithResult(_0x7a88ca,_0x3e386a){_0x3e386a=_0x3e386a||0xc8;return function(_0x565756){if(_0x565756){return _0x7a88ca[_0xf464('0x18')](_0x3e386a)['json'](_0x565756);}};}function respondWithFilteredResult(_0x3aaa94,_0x3ca95c){return function(_0x3cda41){if(_0x3cda41){var _0x445cb5=typeof _0x3ca95c[_0xf464('0x19')]===_0xf464('0x1a')&&typeof _0x3ca95c[_0xf464('0x1b')]===_0xf464('0x1a');var _0x522774=_0x3cda41[_0xf464('0x1c')];var _0x5936ec=_0x445cb5?0x0:_0x3ca95c[_0xf464('0x19')];var _0x526fb9=_0x445cb5?_0x3cda41['count']:_0x3ca95c[_0xf464('0x19')]+_0x3ca95c['limit'];var _0x342d69;if(_0x526fb9>=_0x522774){_0x526fb9=_0x522774;_0x342d69=0xc8;}else{_0x342d69=0xce;}_0x3aaa94[_0xf464('0x18')](_0x342d69);return _0x3aaa94[_0xf464('0x1d')](_0xf464('0x1e'),_0x5936ec+'-'+_0x526fb9+'/'+_0x522774)['json'](_0x3cda41);}return null;};}function patchUpdates(_0x3233e4){return function(_0x51458d){try{jsonpatch['apply'](_0x51458d,_0x3233e4,!![]);}catch(_0x3b5c7f){return BPromise[_0xf464('0x1f')](_0x3b5c7f);}return _0x51458d[_0xf464('0x20')]();};}function saveUpdates(_0x5daf19,_0x37fb3d){return function(_0x11a614){if(_0x11a614){return _0x11a614[_0xf464('0x21')](_0x5daf19)[_0xf464('0x22')](function(_0x5e6359){return _0x5e6359;});}return null;};}function removeEntity(_0x1ee6a9,_0x8e910a){return function(_0x10f223){if(_0x10f223){return _0x10f223[_0xf464('0x23')]()[_0xf464('0x22')](function(){_0x1ee6a9[_0xf464('0x18')](0xcc)[_0xf464('0x24')]();});}};}function handleEntityNotFound(_0x259809,_0x58458f){return function(_0x3fce56){if(!_0x3fce56){_0x259809['sendStatus'](0x194);}return _0x3fce56;};}function handleError(_0x28b56b,_0x171688){_0x171688=_0x171688||0x1f4;return function(_0x2c55f7){logger['error'](_0x2c55f7[_0xf464('0x25')]);if(_0x2c55f7['name']){delete _0x2c55f7[_0xf464('0x26')];}_0x28b56b[_0xf464('0x18')](_0x171688)['send'](_0x2c55f7);};}exports[_0xf464('0x27')]=function(_0x1ccda0,_0x1491ec){var _0xd5c9ef={},_0x4a6d53={},_0x13906a={'count':0x0,'rows':[]};var _0x505e6=_[_0xf464('0x28')](db['VoiceTransferReport']['rawAttributes'],function(_0x1dba83){return{'name':_0x1dba83[_0xf464('0x29')],'type':_0x1dba83[_0xf464('0x2a')][_0xf464('0x2b')]};});_0x4a6d53[_0xf464('0x2c')]=_[_0xf464('0x28')](_0x505e6,_0xf464('0x26'));_0x4a6d53[_0xf464('0x2d')]=_[_0xf464('0x2e')](_0x1ccda0[_0xf464('0x2d')]);_0x4a6d53[_0xf464('0x2f')]=_[_0xf464('0x30')](_0x4a6d53['model'],_0x4a6d53[_0xf464('0x2d')]);_0xd5c9ef[_0xf464('0x31')]=_[_0xf464('0x30')](_0x4a6d53[_0xf464('0x2c')],qs[_0xf464('0x32')](_0x1ccda0[_0xf464('0x2d')][_0xf464('0x32')]));_0xd5c9ef[_0xf464('0x31')]=_0xd5c9ef['attributes'][_0xf464('0x33')]?_0xd5c9ef['attributes']:_0x4a6d53[_0xf464('0x2c')];if(!_0x1ccda0['query']['hasOwnProperty']('nolimit')){_0xd5c9ef[_0xf464('0x1b')]=qs[_0xf464('0x1b')](_0x1ccda0['query'][_0xf464('0x1b')]);_0xd5c9ef[_0xf464('0x19')]=qs['offset'](_0x1ccda0[_0xf464('0x2d')][_0xf464('0x19')]);}_0xd5c9ef[_0xf464('0x34')]=qs[_0xf464('0x35')](_0x1ccda0[_0xf464('0x2d')]['sort']);_0xd5c9ef[_0xf464('0x36')]=qs[_0xf464('0x2f')](_[_0xf464('0x37')](_0x1ccda0['query'],_0x4a6d53[_0xf464('0x2f')]),_0x505e6);if(_0x1ccda0[_0xf464('0x2d')][_0xf464('0x38')]){_0xd5c9ef['where']=_['merge'](_0xd5c9ef['where'],{'$or':_[_0xf464('0x28')](_0x505e6,function(_0x563c2c){if(_0x563c2c[_0xf464('0x2a')]!==_0xf464('0x39')){var _0x10c3b9={};_0x10c3b9[_0x563c2c[_0xf464('0x26')]]={'$like':'%'+_0x1ccda0[_0xf464('0x2d')][_0xf464('0x38')]+'%'};return _0x10c3b9;}})});}_0xd5c9ef=_[_0xf464('0x3a')]({},_0xd5c9ef,_0x1ccda0[_0xf464('0x3b')]);var _0x4c6396={'where':_0xd5c9ef[_0xf464('0x36')]};return db[_0xf464('0x3c')][_0xf464('0x1c')](_0x4c6396)[_0xf464('0x22')](function(_0x79efd7){_0x13906a[_0xf464('0x1c')]=_0x79efd7;if(_0x1ccda0[_0xf464('0x2d')][_0xf464('0x3d')]){_0xd5c9ef['include']=[{'all':!![]}];}return db[_0xf464('0x3c')][_0xf464('0x3e')](_0xd5c9ef);})[_0xf464('0x22')](function(_0x4e8620){_0x13906a[_0xf464('0x3f')]=_0x4e8620;return _0x13906a;})[_0xf464('0x22')](respondWithFilteredResult(_0x1491ec,_0xd5c9ef))[_0xf464('0x40')](handleError(_0x1491ec,null));};exports[_0xf464('0x41')]=function(_0x4c023e,_0x482345){var _0x31b28f={'raw':!![],'where':{'id':_0x4c023e['params']['id']}},_0x391f51={};_0x391f51['model']=_[_0xf464('0x2e')](db['VoiceTransferReport'][_0xf464('0x42')]);_0x391f51[_0xf464('0x2d')]=_[_0xf464('0x2e')](_0x4c023e[_0xf464('0x2d')]);_0x391f51[_0xf464('0x2f')]=_[_0xf464('0x30')](_0x391f51['model'],_0x391f51[_0xf464('0x2d')]);_0x31b28f['attributes']=_[_0xf464('0x30')](_0x391f51[_0xf464('0x2c')],qs[_0xf464('0x32')](_0x4c023e[_0xf464('0x2d')]['fields']));_0x31b28f[_0xf464('0x31')]=_0x31b28f[_0xf464('0x31')]['length']?_0x31b28f['attributes']:_0x391f51['model'];if(_0x4c023e[_0xf464('0x2d')]['includeAll']){_0x31b28f[_0xf464('0x43')]=[{'all':!![]}];}_0x31b28f=_[_0xf464('0x3a')]({},_0x31b28f,_0x4c023e[_0xf464('0x3b')]);return db['VoiceTransferReport'][_0xf464('0x44')](_0x31b28f)['then'](handleEntityNotFound(_0x482345,null))['then'](respondWithResult(_0x482345,null))[_0xf464('0x40')](handleError(_0x482345,null));};exports[_0xf464('0x45')]=function(_0x2308ae,_0x280ed3){return db[_0xf464('0x3c')]['create'](_0x2308ae['body'],{})['then'](respondWithResult(_0x280ed3,0xc9))[_0xf464('0x40')](handleError(_0x280ed3,null));};exports[_0xf464('0x21')]=function(_0x56c190,_0x4724f6){if(_0x56c190[_0xf464('0x46')]['id']){delete _0x56c190['body']['id'];}return db[_0xf464('0x3c')]['find']({'where':{'id':_0x56c190['params']['id']}})[_0xf464('0x22')](handleEntityNotFound(_0x4724f6,null))[_0xf464('0x22')](saveUpdates(_0x56c190['body'],null))['then'](respondWithResult(_0x4724f6,null))[_0xf464('0x40')](handleError(_0x4724f6,null));};exports[_0xf464('0x23')]=function(_0x5e9b13,_0x31b387){return db[_0xf464('0x3c')][_0xf464('0x44')]({'where':{'id':_0x5e9b13[_0xf464('0x47')]['id']}})[_0xf464('0x22')](handleEntityNotFound(_0x31b387,null))[_0xf464('0x22')](removeEntity(_0x31b387,null))[_0xf464('0x40')](handleError(_0x31b387,null));};exports[_0xf464('0x48')]=function(_0x456844,_0x1ba7fe){return db[_0xf464('0x3c')][_0xf464('0x48')]()[_0xf464('0x22')](respondWithResult(_0x1ba7fe,null))[_0xf464('0x40')](handleError(_0x1ba7fe,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 359cf42..9420444 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 _0x73a9=['define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports'];(function(_0x270bac,_0x2583f8){var _0x13aff1=function(_0x491694){while(--_0x491694){_0x270bac['push'](_0x270bac['shift']());}};_0x13aff1(++_0x2583f8);}(_0x73a9,0x148));var _0x973a=function(_0x597bf8,_0x4fda9c){_0x597bf8=_0x597bf8-0x0;var _0x3833ba=_0x73a9[_0x597bf8];return _0x3833ba;};'use strict';var _=require(_0x973a('0x0'));var util=require('util');var logger=require(_0x973a('0x1'))(_0x973a('0x2'));var moment=require(_0x973a('0x3'));var BPromise=require(_0x973a('0x4'));var rp=require(_0x973a('0x5'));var fs=require('fs');var path=require(_0x973a('0x6'));var rimraf=require('rimraf');var config=require(_0x973a('0x7'));var attributes=require(_0x973a('0x8'));module[_0x973a('0x9')]=function(_0x494897,_0x59e830){return _0x494897[_0x973a('0xa')](_0x973a('0xb'),attributes,{'tableName':_0x973a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdffd=['../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x17f4fc,_0x18d6dd){var _0xb7d90=function(_0x213bb8){while(--_0x213bb8){_0x17f4fc['push'](_0x17f4fc['shift']());}};_0xb7d90(++_0x18d6dd);}(_0xdffd,0x171));var _0xddff=function(_0x443440,_0x2c9f20){_0x443440=_0x443440-0x0;var _0x40eb56=_0xdffd[_0x443440];return _0x40eb56;};'use strict';var _=require(_0xddff('0x0'));var util=require(_0xddff('0x1'));var logger=require(_0xddff('0x2'))('api');var moment=require(_0xddff('0x3'));var BPromise=require(_0xddff('0x4'));var rp=require(_0xddff('0x5'));var fs=require('fs');var path=require(_0xddff('0x6'));var rimraf=require(_0xddff('0x7'));var config=require(_0xddff('0x8'));var attributes=require(_0xddff('0x9'));module[_0xddff('0xa')]=function(_0x4858da,_0x15f6dd){return _0x4858da[_0xddff('0xb')]('VoiceTransferReport',attributes,{'tableName':_0xddff('0xc'),'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 ebe5476..d06e3e9 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 _0xd6ff=['CreateVoiceTransferReport','create','body','options','raw','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd6ff,0xc3));var _0xfd6f=function(_0x4ec618,_0x5ea2ca){_0x4ec618=_0x4ec618-0x0;var _0x3a6b2c=_0xd6ff[_0x4ec618];return _0x3a6b2c;};'use strict';var _=require('lodash');var util=require(_0xfd6f('0x0'));var moment=require(_0xfd6f('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd6f('0x2'));var fs=require('fs');var Redis=require(_0xfd6f('0x3'));var db=require(_0xfd6f('0x4'))['db'];var utils=require(_0xfd6f('0x5'));var logger=require(_0xfd6f('0x6'))('rpc');var config=require(_0xfd6f('0x7'));var jayson=require(_0xfd6f('0x8'));var client=jayson[_0xfd6f('0x9')][_0xfd6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28f0d6,_0x2667a5,_0x399ec1){return new BPromise(function(_0x2d209e,_0x24f221){return client['request'](_0x28f0d6,_0x399ec1)[_0xfd6f('0xb')](function(_0xb7d067){logger[_0xfd6f('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x2667a5,'request\x20sent');logger[_0xfd6f('0xd')](_0xfd6f('0xe'),_0x2667a5,_0xfd6f('0xf'),JSON[_0xfd6f('0x10')](_0xb7d067));if(_0xb7d067['error']){if(_0xb7d067[_0xfd6f('0x11')][_0xfd6f('0x12')]===0x1f4){logger[_0xfd6f('0x11')](_0xfd6f('0x13'),_0x2667a5,_0xb7d067[_0xfd6f('0x11')][_0xfd6f('0x14')]);return _0x24f221(_0xb7d067[_0xfd6f('0x11')]['message']);}logger['error'](_0xfd6f('0x13'),_0x2667a5,_0xb7d067[_0xfd6f('0x11')][_0xfd6f('0x14')]);return _0x2d209e(_0xb7d067[_0xfd6f('0x11')][_0xfd6f('0x14')]);}else{logger[_0xfd6f('0xc')](_0xfd6f('0x13'),_0x2667a5,_0xfd6f('0xf'));_0x2d209e(_0xb7d067['result']['message']);}})['catch'](function(_0x473cb7){logger[_0xfd6f('0x11')](_0xfd6f('0x13'),_0x2667a5,_0x473cb7);_0x24f221(_0x473cb7);});});}exports[_0xfd6f('0x15')]=function(_0x5932e6){var _0x49adfd=this;return new Promise(function(_0xd25ebb,_0x100a4b){return db['VoiceTransferReport'][_0xfd6f('0x16')](_0x5932e6[_0xfd6f('0x17')],{'raw':_0x5932e6['options']?_0x5932e6[_0xfd6f('0x18')][_0xfd6f('0x19')]===undefined?!![]:![]:!![]})[_0xfd6f('0xb')](function(_0x5a20bd){logger[_0xfd6f('0xc')](_0xfd6f('0x15'),_0x5932e6);logger[_0xfd6f('0xd')]('CreateVoiceTransferReport',_0x5932e6,JSON[_0xfd6f('0x10')](_0x5a20bd));_0xd25ebb(_0x5a20bd);})[_0xfd6f('0x1a')](function(_0xd44100){logger['error'](_0xfd6f('0x15'),_0xd44100[_0xfd6f('0x14')],_0x5932e6);_0x100a4b(_0x49adfd[_0xfd6f('0x11')](0x1f4,_0xd44100['message']));});});}; \ No newline at end of file +var _0x55bb=['error','VoiceTransferReport,\x20%s,\x20%s','message','info','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x536db8,_0x1d41e4){var _0x34a9c8=function(_0x3cf1b2){while(--_0x3cf1b2){_0x536db8['push'](_0x536db8['shift']());}};_0x34a9c8(++_0x1d41e4);}(_0x55bb,0x168));var _0xb55b=function(_0x3cc072,_0x78c87e){_0x3cc072=_0x3cc072-0x0;var _0x3339ac=_0x55bb[_0x3cc072];return _0x3339ac;};'use strict';var _=require('lodash');var util=require(_0xb55b('0x0'));var moment=require(_0xb55b('0x1'));var BPromise=require(_0xb55b('0x2'));var rs=require(_0xb55b('0x3'));var fs=require('fs');var Redis=require(_0xb55b('0x4'));var db=require(_0xb55b('0x5'))['db'];var utils=require(_0xb55b('0x6'));var logger=require('../../config/logger')(_0xb55b('0x7'));var config=require('../../config/environment');var jayson=require(_0xb55b('0x8'));var client=jayson[_0xb55b('0x9')][_0xb55b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a358c,_0x21a233,_0x50d3a5){return new BPromise(function(_0x41dad9,_0x282279){return client[_0xb55b('0xb')](_0x2a358c,_0x50d3a5)[_0xb55b('0xc')](function(_0x4e3350){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x21a233,_0xb55b('0xd'));logger[_0xb55b('0xe')](_0xb55b('0xf'),_0x21a233,'request\x20sent',JSON[_0xb55b('0x10')](_0x4e3350));if(_0x4e3350[_0xb55b('0x11')]){if(_0x4e3350[_0xb55b('0x11')]['code']===0x1f4){logger[_0xb55b('0x11')](_0xb55b('0x12'),_0x21a233,_0x4e3350[_0xb55b('0x11')][_0xb55b('0x13')]);return _0x282279(_0x4e3350[_0xb55b('0x11')][_0xb55b('0x13')]);}logger['error'](_0xb55b('0x12'),_0x21a233,_0x4e3350['error'][_0xb55b('0x13')]);return _0x41dad9(_0x4e3350[_0xb55b('0x11')][_0xb55b('0x13')]);}else{logger[_0xb55b('0x14')](_0xb55b('0x12'),_0x21a233,_0xb55b('0xd'));_0x41dad9(_0x4e3350[_0xb55b('0x15')][_0xb55b('0x13')]);}})['catch'](function(_0x1a31c7){logger[_0xb55b('0x11')](_0xb55b('0x12'),_0x21a233,_0x1a31c7);_0x282279(_0x1a31c7);});});}exports[_0xb55b('0x16')]=function(_0x34e56c){var _0x2ce89c=this;return new Promise(function(_0x29de35,_0x65a444){return db[_0xb55b('0x17')][_0xb55b('0x18')](_0x34e56c[_0xb55b('0x19')],{'raw':_0x34e56c[_0xb55b('0x1a')]?_0x34e56c[_0xb55b('0x1a')][_0xb55b('0x1b')]===undefined?!![]:![]:!![]})[_0xb55b('0xc')](function(_0x400d99){logger[_0xb55b('0x14')]('CreateVoiceTransferReport',_0x34e56c);logger[_0xb55b('0xe')](_0xb55b('0x16'),_0x34e56c,JSON['stringify'](_0x400d99));_0x29de35(_0x400d99);})[_0xb55b('0x1c')](function(_0x2c35b2){logger['error'](_0xb55b('0x16'),_0x2c35b2[_0xb55b('0x13')],_0x34e56c);_0x65a444(_0x2ce89c[_0xb55b('0x11')](0x1f4,_0x2c35b2[_0xb55b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 2d85c93..13bae3d 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 _0x9bde=['Router','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','transfer'];(function(_0x2ceb8e,_0x19ba8e){var _0xe283bb=function(_0x104094){while(--_0x104094){_0x2ceb8e['push'](_0x2ceb8e['shift']());}};_0xe283bb(++_0x19ba8e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3089f0,_0x310931){_0x3089f0=_0x3089f0-0x0;var _0x5bab29=_0x9bde[_0x3089f0];return _0x5bab29;};'use strict';var express=require('express');var router=express[_0xe9bd('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe9bd('0x1'));router['post'](_0xe9bd('0x2'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0x5')]);router[_0xe9bd('0x6')](_0xe9bd('0x7'),auth[_0xe9bd('0x3')](),auth['isWebrtcLicence'](),controller[_0xe9bd('0x8')]);router[_0xe9bd('0x6')](_0xe9bd('0x9'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x6')](_0xe9bd('0xb'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['hold']);router['post'](_0xe9bd('0xc'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['unhold']);router[_0xe9bd('0x6')](_0xe9bd('0xd'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['calls']);router[_0xe9bd('0x6')]('/transfer',auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xe')]);module['exports']=router; \ No newline at end of file +var _0x153f=['hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','isWebrtcLicence','hangup','answer','/hold'];(function(_0xfb2935,_0x4ca521){var _0x49394b=function(_0x1241fb){while(--_0x1241fb){_0xfb2935['push'](_0xfb2935['shift']());}};_0x49394b(++_0x4ca521);}(_0x153f,0x15b));var _0xf153=function(_0x46246d,_0x55d892){_0x46246d=_0x46246d-0x0;var _0x59b6b1=_0x153f[_0x46246d];return _0x59b6b1;};'use strict';var express=require(_0xf153('0x0'));var router=express[_0xf153('0x1')]();var auth=require(_0xf153('0x2'));var controller=require(_0xf153('0x3'));router[_0xf153('0x4')](_0xf153('0x5'),auth[_0xf153('0x6')](),auth['isWebrtcLicence'](),controller[_0xf153('0x7')]);router['post'](_0xf153('0x8'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x4')]('/answer',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xb')]);router[_0xf153('0x4')](_0xf153('0xc'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xd')]);router[_0xf153('0x4')](_0xf153('0xe'),auth['isAuthenticated'](),auth[_0xf153('0x9')](),controller[_0xf153('0xf')]);router[_0xf153('0x4')]('/calls',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0x4')](_0xf153('0x11'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x12')]);module[_0xf153('0x13')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index fc13fde..6368edc 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 _0x7980=['webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','UserId','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','log','handleError:','error','name','send','status','NotFound','request','then','code','message','result','User','agent','VoiceChannels','all','filter','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','validate','callNumber','callerId','user:%s','webbar:originate','json','originate\x20executed!','catch','hangup','hangup\x20fired:','userId','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','format','answer\x20executed!','hold\x20fired:'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x7980,0xab));var _0x0798=function(_0x5e6c25,_0x4ecd3c){_0x5e6c25=_0x5e6c25-0x0;var _0x2a5a38=_0x7980[_0x5e6c25];return _0x2a5a38;};'use strict';var path=require(_0x0798('0x0'));var fs=require('fs');var _=require(_0x0798('0x1'));var db=require(_0x0798('0x2'))['db'];var config=require(_0x0798('0x3'));var util=require(_0x0798('0x4'));var BPromise=require('bluebird');var jayson=require(_0x0798('0x5'));var amiClient=jayson[_0x0798('0x6')][_0x0798('0x7')]({'port':0x232a});var logger=require(_0x0798('0x8'))(_0x0798('0x9'));var Redis=require('ioredis');config[_0x0798('0xa')]=_['defaults'](config[_0x0798('0xa')],{'host':_0x0798('0xb'),'port':0x18eb});var io=require(_0x0798('0xc'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],_0x0798('0xe')]},'callNumber':{'type':_0x0798('0xf'),'required':[!![],_0x0798('0x10')]},'callerId':{'type':_0x0798('0xf')},'callbackUrl':{'type':_0x0798('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],_0x0798('0xe')]},'sessionId':{'type':_0x0798('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0798('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0x0798('0x11')]},'transferNumber':{'type':_0x0798('0xf'),'required':[!![],_0x0798('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],_0x0798('0xe')]},'sessionId':{'type':_0x0798('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],_0x0798('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x21c30b,_0x45cae6,_0x258081){logger['info'](_0x21c30b,_0x45cae6,JSON['stringify'](_0x258081));io['to'](_0x21c30b)[_0x0798('0x13')](_0x45cae6,_0x258081);}function handleError(_0x502635){return function(_0x41e217){console[_0x0798('0x14')](_0x0798('0x15'),_0x41e217,_0x41e217 instanceof RangeError);logger[_0x0798('0x16')](_0x41e217['stack']);if(_0x41e217 instanceof RangeError){if(_0x41e217[_0x0798('0x17')]){delete _0x41e217[_0x0798('0x17')];}_0x502635['status'](0x194)[_0x0798('0x18')](_0x41e217);}else{if(_0x41e217[_0x0798('0x17')]){delete _0x41e217[_0x0798('0x17')];}_0x502635[_0x0798('0x19')](0x1f4)[_0x0798('0x18')](_0x41e217);}};}function checkError(){return function(_0x273ba8){if(!_0x273ba8){throw new RangeError(_0x0798('0x1a'));}return _0x273ba8;};}function respondWithRpcPromise(_0x212ad5,_0x23b37d){return new BPromise(function(_0x4a86d5,_0x2aaabf){var _0x35c141=amiClient;return _0x35c141[_0x0798('0x1b')](_0x212ad5,_0x23b37d)[_0x0798('0x1c')](function(_0x20654b){if(_0x20654b[_0x0798('0x16')]){if(_0x20654b['error'][_0x0798('0x1d')]===0x1f4){return _0x2aaabf(_0x20654b[_0x0798('0x16')][_0x0798('0x1e')]);}return _0x4a86d5(_0x20654b[_0x0798('0x16')][_0x0798('0x1e')]);}else{_0x4a86d5(_0x20654b[_0x0798('0x1f')]);}})['catch'](function(_0x43d99f){_0x2aaabf(_0x43d99f);});});}function getAgent(_0x14f828){return db[_0x0798('0x20')]['findOne']({'where':{'id':_0x14f828,'role':_0x0798('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x53a3d7,_0x406030){return new BPromise(function(_0x2dfbff,_0x134d24){var _0xaa949b=respondWithRpcPromise(_0x0798('0x22'));var _0x161244=getAgent(_0x53a3d7);Promise[_0x0798('0x23')]([_0xaa949b,_0x161244])[_0x0798('0x1c')](function(_0x5bbe3d){var _0x167960=_0x5bbe3d[0x0];var _0x4f5d1d=_0x5bbe3d[0x1];var _0x5f1780=_[_0x0798('0x24')](_0x167960['rows'],function(_0x1dabd5){return _0x1dabd5['UserId']==_0x4f5d1d['id']&&_0x1dabd5[_0x0798('0x25')]==_0x406030;});if(_0x5f1780[_0x0798('0x26')]==0x1){_0x2dfbff(_0x4f5d1d);}else{_0x134d24(new RangeError(_0x0798('0x27')+_0x406030+_0x0798('0x28')));}});});}exports[_0x0798('0x29')]=function(_0x1ebd07,_0xa1376e){logger[_0x0798('0x2a')](_0x0798('0x2b'),_0x1ebd07[_0x0798('0x2c')]);var _0x54a955=originateValidation[_0x0798('0x2d')](_0x1ebd07['body']);if(_0x54a955[_0x0798('0x26')]>0x0){return _0xa1376e['status'](0x190)['json'](_0x54a955);}var _0x104d23=_0x1ebd07[_0x0798('0x2c')]['userId'];var _0x49d5b8=_0x1ebd07[_0x0798('0x2c')][_0x0798('0x2e')];var _0x322adf=_0x1ebd07[_0x0798('0x2c')][_0x0798('0x2f')];var _0x2ad922=_0x1ebd07['body']['callbackUrl'];return getAgent(_0x104d23)[_0x0798('0x1c')](function(_0x23a70b){logger[_0x0798('0x2a')]('entityFound:',_0x23a70b['name']);emit(util['format'](_0x0798('0x30'),_0x23a70b[_0x0798('0x17')]),_0x0798('0x31'),{'callNumber':_0x49d5b8,'callerId':_0x322adf,'callbackUrl':_0x2ad922});return _0xa1376e[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x33')});})[_0x0798('0x34')](handleError(_0xa1376e));};exports[_0x0798('0x35')]=function(_0x502556,_0x16dae6){logger['info'](_0x0798('0x36'),_0x502556[_0x0798('0x2c')]);var _0x2caa82=hangupValidation['validate'](_0x502556[_0x0798('0x2c')]);if(_0x2caa82['length']>0x0){return _0x16dae6[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x2caa82);}var _0x223751=_0x502556['body'][_0x0798('0x37')];var _0xb5937b=_0x502556['body'][_0x0798('0x25')];return getAgent(_0x223751)['then'](function(_0x4e9d94){logger[_0x0798('0x2a')](_0x0798('0x38'),_0x4e9d94['name']);emit(util['format'](_0x0798('0x30'),_0x4e9d94[_0x0798('0x17')]),_0x0798('0x39'),{'sessionId':_0xb5937b});return _0x16dae6[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x3a')});})[_0x0798('0x34')](handleError(_0x16dae6));};exports['answer']=function(_0x3aa79c,_0x11c5bf){logger[_0x0798('0x2a')](_0x0798('0x3b'),_0x3aa79c[_0x0798('0x2c')]);var _0x26e9cb=answerValidation['validate'](_0x3aa79c[_0x0798('0x2c')]);if(_0x26e9cb[_0x0798('0x26')]>0x0){return _0x11c5bf[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x26e9cb);}var _0x387450=_0x3aa79c[_0x0798('0x2c')][_0x0798('0x37')];var _0x10a50a=_0x3aa79c[_0x0798('0x2c')][_0x0798('0x25')];return getAgent(_0x387450)[_0x0798('0x1c')](function(_0x31a3cb){logger['info'](_0x0798('0x38'),_0x31a3cb[_0x0798('0x17')]);emit(util[_0x0798('0x3c')](_0x0798('0x30'),_0x31a3cb['name']),'webbar:answer',{'sessionId':_0x10a50a});return _0x11c5bf[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x3d')});})[_0x0798('0x34')](handleError(_0x11c5bf));};exports['hold']=function(_0x21c28c,_0x4858e6){logger['info'](_0x0798('0x3e'),_0x21c28c[_0x0798('0x2c')]);var _0x42c5b8=holdValidation[_0x0798('0x2d')](_0x21c28c[_0x0798('0x2c')]);if(_0x42c5b8[_0x0798('0x26')]>0x0){return _0x4858e6[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x42c5b8);}var _0x182e3b=_0x21c28c['body'][_0x0798('0x37')];var _0x56d438=_0x21c28c[_0x0798('0x2c')][_0x0798('0x25')];return getAgent(_0x182e3b)[_0x0798('0x1c')](function(_0x54634d){logger[_0x0798('0x2a')](_0x0798('0x38'),_0x54634d[_0x0798('0x17')]);emit(util[_0x0798('0x3c')]('user:%s',_0x54634d[_0x0798('0x17')]),_0x0798('0x3f'),{'sessionId':_0x56d438});return _0x4858e6[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x40')});})['catch'](handleError(_0x4858e6));};exports[_0x0798('0x41')]=function(_0x3e1c15,_0x2679b1){logger[_0x0798('0x2a')](_0x0798('0x42'),_0x3e1c15[_0x0798('0x2c')]);var _0x181757=unholdValidation[_0x0798('0x2d')](_0x3e1c15[_0x0798('0x2c')]);if(_0x181757['length']>0x0){return _0x2679b1['status'](0x190)[_0x0798('0x32')](_0x181757);}var _0x499073=_0x3e1c15[_0x0798('0x2c')][_0x0798('0x37')];var _0x40b3d6=_0x3e1c15[_0x0798('0x2c')][_0x0798('0x25')];return getAgent(_0x499073)['then'](function(_0x3cb0b4){logger['info'](_0x0798('0x38'),_0x3cb0b4[_0x0798('0x17')]);emit(util[_0x0798('0x3c')]('user:%s',_0x3cb0b4['name']),'webbar:unhold',{'sessionId':_0x40b3d6});return _0x2679b1[_0x0798('0x19')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x0798('0x34')](handleError(_0x2679b1));};exports[_0x0798('0x43')]=function(_0x455d19,_0x499580){logger[_0x0798('0x2a')](_0x0798('0x44'),_0x499580[_0x0798('0x2c')]);var _0x743d26=callsValidation['validate'](_0x455d19['body']);if(_0x743d26[_0x0798('0x26')]>0x0){return _0x499580[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x743d26);}var _0x59ad6c=_0x455d19['body'][_0x0798('0x37')];var _0x82599=respondWithRpcPromise(_0x0798('0x22'));var _0x190467=getAgent(_0x59ad6c);return Promise[_0x0798('0x23')]([_0x82599,_0x190467])[_0x0798('0x1c')](function(_0x18c0fa){var _0x1a55c0=_0x18c0fa[0x0];var _0x4f35c7=_0x18c0fa[0x1];var _0x349f86=_[_0x0798('0x24')](_0x1a55c0['rows'],function(_0x3ab2cc){return _0x3ab2cc[_0x0798('0x45')]==_0x4f35c7['id'];});return _0x499580['status'](0xc8)[_0x0798('0x32')]({'count':_0x349f86[_0x0798('0x26')],'rows':_0x349f86});})[_0x0798('0x34')](handleError(_0x499580));};exports[_0x0798('0x46')]=function(_0x458a4e,_0x541669){logger[_0x0798('0x2a')](_0x0798('0x47'),_0x458a4e[_0x0798('0x2c')]);var _0x47cfc0=conferenceValidation[_0x0798('0x2d')](_0x458a4e['body']);if(_0x47cfc0[_0x0798('0x26')]>0x0){return _0x541669[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x47cfc0);}var _0x26b393=_0x458a4e[_0x0798('0x2c')][_0x0798('0x37')];return getAgent(_0x26b393)['then'](function(_0x3cc8bd){logger[_0x0798('0x2a')](_0x0798('0x38'),_0x3cc8bd[_0x0798('0x17')]);emit(util['format'](_0x0798('0x30'),_0x3cc8bd[_0x0798('0x17')]),_0x0798('0x48'));return _0x541669[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':'conference\x20executed!'});})[_0x0798('0x34')](handleError(_0x541669));};exports[_0x0798('0x49')]=function(_0x5668b7,_0x48d1d1){logger[_0x0798('0x2a')](_0x0798('0x4a'),_0x5668b7['body']);var _0x2f336a=transferValidation[_0x0798('0x2d')](_0x5668b7[_0x0798('0x2c')]);if(_0x2f336a[_0x0798('0x26')]>0x0){return _0x48d1d1[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x2f336a);}var _0x21c156=_0x5668b7[_0x0798('0x2c')]['userId'];var _0x316762=_0x5668b7[_0x0798('0x2c')][_0x0798('0x25')];var _0xf5100e=_0x5668b7['body'][_0x0798('0x4b')];return getAgent(_0x21c156)[_0x0798('0x1c')](function(_0x11946d){logger[_0x0798('0x2a')](_0x0798('0x38'),_0x11946d[_0x0798('0x17')]);emit(util[_0x0798('0x3c')](_0x0798('0x30'),_0x11946d['name']),_0x0798('0x4c'),{'sessionId':_0x316762,'transferNumber':_0xf5100e});return _0x48d1d1['status'](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x4d')});})[_0x0798('0x34')](handleError(_0x48d1d1));}; \ No newline at end of file +var _0xa588=['client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','emit','handleError:','error','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise'];(function(_0x386187,_0x1ad2ac){var _0x4abeaa=function(_0x251f63){while(--_0x251f63){_0x386187['push'](_0x386187['shift']());}};_0x4abeaa(++_0x1ad2ac);}(_0xa588,0xe1));var _0x8a58=function(_0x2c0b5c,_0x2de2b0){_0x2c0b5c=_0x2c0b5c-0x0;var _0x331c54=_0xa588[_0x2c0b5c];return _0x331c54;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8a58('0x0'));var db=require(_0x8a58('0x1'))['db'];var config=require(_0x8a58('0x2'));var util=require(_0x8a58('0x3'));var BPromise=require(_0x8a58('0x4'));var jayson=require(_0x8a58('0x5'));var amiClient=jayson[_0x8a58('0x6')][_0x8a58('0x7')]({'port':0x232a});var logger=require(_0x8a58('0x8'))('webbarapi');var Redis=require(_0x8a58('0x9'));config[_0x8a58('0xa')]=_[_0x8a58('0xb')](config[_0x8a58('0xa')],{'host':_0x8a58('0xc'),'port':0x18eb});var io=require(_0x8a58('0xd'))(new Redis(config[_0x8a58('0xa')]));var Schema=require(_0x8a58('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'callNumber':{'type':_0x8a58('0x10'),'required':[!![],_0x8a58('0x11')]},'callerId':{'type':_0x8a58('0x10')},'callbackUrl':{'type':_0x8a58('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'sessionId':{'type':_0x8a58('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':[!![],_0x8a58('0x13')]},'transferNumber':{'type':_0x8a58('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]}});function emit(_0x26e3a8,_0xd967db,_0xddfaae){logger['info'](_0x26e3a8,_0xd967db,JSON['stringify'](_0xddfaae));io['to'](_0x26e3a8)[_0x8a58('0x14')](_0xd967db,_0xddfaae);}function handleError(_0x107e0a){return function(_0x18a14d){console['log'](_0x8a58('0x15'),_0x18a14d,_0x18a14d instanceof RangeError);logger[_0x8a58('0x16')](_0x18a14d['stack']);if(_0x18a14d instanceof RangeError){if(_0x18a14d[_0x8a58('0x17')]){delete _0x18a14d[_0x8a58('0x17')];}_0x107e0a[_0x8a58('0x18')](0x194)[_0x8a58('0x19')](_0x18a14d);}else{if(_0x18a14d[_0x8a58('0x17')]){delete _0x18a14d[_0x8a58('0x17')];}_0x107e0a[_0x8a58('0x18')](0x1f4)[_0x8a58('0x19')](_0x18a14d);}};}function checkError(){return function(_0x92951){if(!_0x92951){throw new RangeError(_0x8a58('0x1a'));}return _0x92951;};}function respondWithRpcPromise(_0xb20cfe,_0x844b58){return new BPromise(function(_0x3758fa,_0x34adb8){var _0x561a9a=amiClient;return _0x561a9a[_0x8a58('0x1b')](_0xb20cfe,_0x844b58)[_0x8a58('0x1c')](function(_0x20a6c5){if(_0x20a6c5[_0x8a58('0x16')]){if(_0x20a6c5[_0x8a58('0x16')][_0x8a58('0x1d')]===0x1f4){return _0x34adb8(_0x20a6c5[_0x8a58('0x16')]['message']);}return _0x3758fa(_0x20a6c5[_0x8a58('0x16')][_0x8a58('0x1e')]);}else{_0x3758fa(_0x20a6c5[_0x8a58('0x1f')]);}})[_0x8a58('0x20')](function(_0x4fb0fb){_0x34adb8(_0x4fb0fb);});});}function getAgent(_0x1e9c3b){return db[_0x8a58('0x21')][_0x8a58('0x22')]({'where':{'id':_0x1e9c3b,'role':'agent'}})[_0x8a58('0x1c')](checkError());}function getAgentCheckSession(_0x31abcc,_0x4426ff){return new BPromise(function(_0x27d7c8,_0x367aec){var _0x3e317f=respondWithRpcPromise(_0x8a58('0x23'));var _0x4d5041=getAgent(_0x31abcc);Promise[_0x8a58('0x24')]([_0x3e317f,_0x4d5041])['then'](function(_0x501aa1){var _0x5e7265=_0x501aa1[0x0];var _0x4cfc96=_0x501aa1[0x1];var _0x5a9c53=_[_0x8a58('0x25')](_0x5e7265[_0x8a58('0x26')],function(_0x1b2d9e){return _0x1b2d9e[_0x8a58('0x27')]==_0x4cfc96['id']&&_0x1b2d9e[_0x8a58('0x28')]==_0x4426ff;});if(_0x5a9c53[_0x8a58('0x29')]==0x1){_0x27d7c8(_0x4cfc96);}else{_0x367aec(new RangeError(_0x8a58('0x2a')+_0x4426ff+_0x8a58('0x2b')));}});});}exports[_0x8a58('0x2c')]=function(_0x3d9e3a,_0x8ab99c){logger[_0x8a58('0x2d')](_0x8a58('0x2e'),_0x3d9e3a['body']);var _0x330e8a=originateValidation[_0x8a58('0xe')](_0x3d9e3a[_0x8a58('0x2f')]);if(_0x330e8a[_0x8a58('0x29')]>0x0){return _0x8ab99c[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x330e8a);}var _0x50c73d=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x25ecd6=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x32')];var _0x264cc7=_0x3d9e3a[_0x8a58('0x2f')]['callerId'];var _0x3d1fb0=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x33')];return getAgent(_0x50c73d)['then'](function(_0x5ecfea){logger['info'](_0x8a58('0x34'),_0x5ecfea[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x5ecfea['name']),_0x8a58('0x37'),{'callNumber':_0x25ecd6,'callerId':_0x264cc7,'callbackUrl':_0x3d1fb0});return _0x8ab99c[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x38')});})['catch'](handleError(_0x8ab99c));};exports[_0x8a58('0x39')]=function(_0x2a7c70,_0x5aad83){logger[_0x8a58('0x2d')](_0x8a58('0x3a'),_0x2a7c70[_0x8a58('0x2f')]);var _0x35d930=hangupValidation[_0x8a58('0xe')](_0x2a7c70[_0x8a58('0x2f')]);if(_0x35d930['length']>0x0){return _0x5aad83['status'](0x190)[_0x8a58('0x30')](_0x35d930);}var _0x31b8fe=_0x2a7c70['body'][_0x8a58('0x31')];var _0x2e1d71=_0x2a7c70[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x31b8fe)[_0x8a58('0x1c')](function(_0x4e9e04){logger[_0x8a58('0x2d')]('entityFound:',_0x4e9e04[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x4e9e04[_0x8a58('0x17')]),_0x8a58('0x3b'),{'sessionId':_0x2e1d71});return _0x5aad83[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x5aad83));};exports[_0x8a58('0x3c')]=function(_0x54e454,_0x53fd19){logger[_0x8a58('0x2d')](_0x8a58('0x3d'),_0x54e454[_0x8a58('0x2f')]);var _0x573cd3=answerValidation['validate'](_0x54e454[_0x8a58('0x2f')]);if(_0x573cd3['length']>0x0){return _0x53fd19[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x573cd3);}var _0x3feec0=_0x54e454[_0x8a58('0x2f')]['userId'];var _0x417951=_0x54e454[_0x8a58('0x2f')]['sessionId'];return getAgent(_0x3feec0)[_0x8a58('0x1c')](function(_0xba52de){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0xba52de['name']);emit(util[_0x8a58('0x35')]('user:%s',_0xba52de[_0x8a58('0x17')]),_0x8a58('0x3e'),{'sessionId':_0x417951});return _0x53fd19['status'](0xc8)[_0x8a58('0x30')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x53fd19));};exports[_0x8a58('0x3f')]=function(_0x417b08,_0x177ba9){logger[_0x8a58('0x2d')](_0x8a58('0x40'),_0x417b08[_0x8a58('0x2f')]);var _0x507423=holdValidation['validate'](_0x417b08[_0x8a58('0x2f')]);if(_0x507423[_0x8a58('0x29')]>0x0){return _0x177ba9[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x507423);}var _0x1ec51b=_0x417b08[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x903c85=_0x417b08[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x1ec51b)[_0x8a58('0x1c')](function(_0x392c32){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x392c32['name']);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x392c32[_0x8a58('0x17')]),_0x8a58('0x41'),{'sessionId':_0x903c85});return _0x177ba9[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x42')});})['catch'](handleError(_0x177ba9));};exports['unhold']=function(_0x5ab682,_0x31e12a){logger[_0x8a58('0x2d')](_0x8a58('0x43'),_0x5ab682['body']);var _0x3883ee=unholdValidation[_0x8a58('0xe')](_0x5ab682[_0x8a58('0x2f')]);if(_0x3883ee[_0x8a58('0x29')]>0x0){return _0x31e12a[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x3883ee);}var _0x22f5aa=_0x5ab682[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x2f48ef=_0x5ab682[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x22f5aa)['then'](function(_0xf44eaa){logger[_0x8a58('0x2d')]('entityFound:',_0xf44eaa[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0xf44eaa['name']),_0x8a58('0x44'),{'sessionId':_0x2f48ef});return _0x31e12a['status'](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x45')});})[_0x8a58('0x20')](handleError(_0x31e12a));};exports[_0x8a58('0x46')]=function(_0x3c7225,_0xfd0229){logger[_0x8a58('0x2d')](_0x8a58('0x47'),_0xfd0229[_0x8a58('0x2f')]);var _0x53fbde=callsValidation[_0x8a58('0xe')](_0x3c7225[_0x8a58('0x2f')]);if(_0x53fbde[_0x8a58('0x29')]>0x0){return _0xfd0229[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x53fbde);}var _0x57adf4=_0x3c7225[_0x8a58('0x2f')][_0x8a58('0x31')];var _0xa01a37=respondWithRpcPromise(_0x8a58('0x23'));var _0x1022d5=getAgent(_0x57adf4);return Promise[_0x8a58('0x24')]([_0xa01a37,_0x1022d5])[_0x8a58('0x1c')](function(_0x38e435){var _0x515f26=_0x38e435[0x0];var _0x415dea=_0x38e435[0x1];var _0xbf6332=_[_0x8a58('0x25')](_0x515f26['rows'],function(_0x229e68){return _0x229e68['UserId']==_0x415dea['id'];});return _0xfd0229[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'count':_0xbf6332[_0x8a58('0x29')],'rows':_0xbf6332});})[_0x8a58('0x20')](handleError(_0xfd0229));};exports[_0x8a58('0x48')]=function(_0x2f653d,_0x1b8292){logger[_0x8a58('0x2d')]('conference\x20fired:',_0x2f653d['body']);var _0x455aeb=conferenceValidation[_0x8a58('0xe')](_0x2f653d[_0x8a58('0x2f')]);if(_0x455aeb[_0x8a58('0x29')]>0x0){return _0x1b8292[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x455aeb);}var _0x1b4f68=_0x2f653d['body'][_0x8a58('0x31')];return getAgent(_0x1b4f68)[_0x8a58('0x1c')](function(_0x493ccd){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x493ccd[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x493ccd[_0x8a58('0x17')]),'webbar:conference');return _0x1b8292[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':'conference\x20executed!'});})[_0x8a58('0x20')](handleError(_0x1b8292));};exports[_0x8a58('0x49')]=function(_0x19e256,_0x26b333){logger['info']('transfer\x20fired:',_0x19e256[_0x8a58('0x2f')]);var _0x5ce699=transferValidation[_0x8a58('0xe')](_0x19e256[_0x8a58('0x2f')]);if(_0x5ce699[_0x8a58('0x29')]>0x0){return _0x26b333[_0x8a58('0x18')](0x190)['json'](_0x5ce699);}var _0xb0b5da=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x371930=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x28')];var _0x9046f1=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x4a')];return getAgent(_0xb0b5da)[_0x8a58('0x1c')](function(_0x318acd){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x318acd['name']);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x318acd[_0x8a58('0x17')]),_0x8a58('0x4b'),{'sessionId':_0x371930,'transferNumber':_0x9046f1});return _0x26b333[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x4c')});})[_0x8a58('0x20')](handleError(_0x26b333));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 8c05894..a52fc7a 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 _0x6d38=['get','/describe','/:id','/:id/dispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','update','delete','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index'];(function(_0x456b77,_0x4fed12){var _0x118bb6=function(_0x2ea238){while(--_0x2ea238){_0x456b77['push'](_0x456b77['shift']());}};_0x118bb6(++_0x4fed12);}(_0x6d38,0x1ef));var _0x86d3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6d38[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['get'](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller['getDispositions']);router['get'](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['getAnswers']);router[_0x86d3('0x9')]('/:id/users',auth[_0x86d3('0x7')](),controller[_0x86d3('0xe')]);router[_0x86d3('0x9')](_0x86d3('0xf'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x10')]);router[_0x86d3('0x11')]('/',auth[_0x86d3('0x7')](),controller['create']);router[_0x86d3('0x11')](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x12')]);router[_0x86d3('0x11')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x13')]);router['post'](_0x86d3('0x14'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x15')]);router[_0x86d3('0x11')](_0x86d3('0xf'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x16')]);router[_0x86d3('0x11')](_0x86d3('0x17'),controller['notify']);router[_0x86d3('0x11')]('/:id/send',auth[_0x86d3('0x7')](),controller['send']);router['put'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x18')]);router[_0x86d3('0x19')]('/:id',auth[_0x86d3('0x7')](),controller['destroy']);router[_0x86d3('0x19')](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller['removeDispositions']);router[_0x86d3('0x19')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['removeAnswers']);router['delete'](_0x86d3('0x14'),auth['isAuthenticated'](),controller[_0x86d3('0x1a')]);module[_0x86d3('0x1b')]=router; \ No newline at end of file +var _0x524e=['index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','put','update','delete','destroy','removeAnswers','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get'];(function(_0xe003bd,_0x3fbb70){var _0xd0eda3=function(_0x54e04f){while(--_0x54e04f){_0xe003bd['push'](_0xe003bd['shift']());}};_0xd0eda3(++_0x3fbb70);}(_0x524e,0x15e));var _0xe524=function(_0x45f47a,_0x5687c3){_0x45f47a=_0x45f47a-0x0;var _0x17b4de=_0x524e[_0x45f47a];return _0x17b4de;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x9')](_0xe524('0x10'),auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x9')](_0xe524('0x12'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x9')](_0xe524('0x14'),auth[_0xe524('0xe')](),controller['getAgents']);router['get'](_0xe524('0x15'),auth[_0xe524('0xe')](),controller[_0xe524('0x16')]);router[_0xe524('0x17')]('/',auth[_0xe524('0xe')](),controller['create']);router[_0xe524('0x17')]('/:id/dispositions',auth[_0xe524('0xe')](),controller[_0xe524('0x18')]);router['post'](_0xe524('0x12'),auth['isAuthenticated'](),controller[_0xe524('0x19')]);router['post'](_0xe524('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0xe524('0x15'),auth['isAuthenticated'](),controller[_0xe524('0x1a')]);router[_0xe524('0x17')](_0xe524('0x1b'),controller[_0xe524('0x1c')]);router['post'](_0xe524('0x1d'),auth[_0xe524('0xe')](),controller['send']);router[_0xe524('0x1e')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x1f')]);router[_0xe524('0x20')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x21')]);router[_0xe524('0x20')]('/:id/dispositions',auth[_0xe524('0xe')](),controller['removeDispositions']);router['delete'](_0xe524('0x12'),auth[_0xe524('0xe')](),controller[_0xe524('0x22')]);router[_0xe524('0x20')]('/:id/users',auth[_0xe524('0xe')](),controller['removeAgents']);module[_0xe524('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 1787cf0..9cf4fed 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 _0xe70b=['TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','ENUM','sinch'];(function(_0x2f597d,_0x32addb){var _0x28615a=function(_0xa06d14){while(--_0xa06d14){_0x2f597d['push'](_0x2f597d['shift']());}};_0x28615a(++_0x32addb);}(_0xe70b,0x170));var _0xbe70=function(_0x589c86,_0x2f3130){_0x589c86=_0x589c86-0x0;var _0xf50dc5=_0xe70b[_0x589c86];return _0xf50dc5;};'use strict';var Sequelize=require(_0xbe70('0x0'));var rs=require(_0xbe70('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xbe70('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xbe70('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xbe70('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xbe70('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbe70('0x5')]('twilio',_0xbe70('0x6'))},'accountSid':{'type':Sequelize[_0xbe70('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xbe70('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbe70('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbe70('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbe70('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbe70('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbe70('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xbe70('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xbe70('0x8')],'defaultValue':![],'comment':_0xbe70('0xb'),'set':function(_0x5c8d25){if(!_0x5c8d25){this[_0xbe70('0xc')](_0xbe70('0xd'),null);}this[_0xbe70('0xc')](_0xbe70('0xe'),_0x5c8d25);}},'description':{'type':Sequelize[_0xbe70('0x3')]}}; \ No newline at end of file +var _0xf4a4=['ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate'];(function(_0x55d6d3,_0x23c8ef){var _0x3946bc=function(_0x1c218f){while(--_0x1c218f){_0x55d6d3['push'](_0x55d6d3['shift']());}};_0x3946bc(++_0x23c8ef);}(_0xf4a4,0x173));var _0x4f4a=function(_0x33679d,_0x448096){_0x33679d=_0x33679d-0x0;var _0x408bcc=_0xf4a4[_0x33679d];return _0x408bcc;};'use strict';var Sequelize=require(_0x4f4a('0x0'));var rs=require(_0x4f4a('0x1'));module['exports']={'name':{'type':Sequelize[_0x4f4a('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x4f4a('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4f4a('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x4f4a('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4f4a('0x4')](_0x4f4a('0x5'),_0x4f4a('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x4f4a('0x2')]},'authToken':{'type':Sequelize[_0x4f4a('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4f4a('0x7')],'defaultValue':function(){return _0x4f4a('0x8');}},'notificationSound':{'type':Sequelize[_0x4f4a('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4f4a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4f4a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4f4a('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4f4a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4f4a('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4f4a('0x9')],'defaultValue':![],'comment':_0x4f4a('0xb'),'set':function(_0x4894c4){if(!_0x4894c4){this[_0x4f4a('0xc')](_0x4f4a('0xd'),null);}this['setDataValue'](_0x4f4a('0xe'),_0x4894c4);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 627c29c..c4b2102 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 _0x32c7=['created','ContactId','AttachmentId','UserId','agent','Start','startRouting','receiveMessage','entity\x20found','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','DESC','List','WhatsappInteraction','out','Messages','dataValues','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','redis','localhost','./whatsappAccount.socket','register','jayson/promise','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','WhatsappAccounts','sendStatus','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','Pause','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','findOne','User','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','CmContact','Contacts','list','contact','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x32c7,0x19e));var _0x732c=function(_0x9e377,_0x119bcf){_0x9e377=_0x9e377-0x0;var _0x531f1f=_0x32c7[_0x9e377];return _0x531f1f;};'use strict';var emlformat=require(_0x732c('0x0'));var rimraf=require(_0x732c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x732c('0x2'));var moment=require(_0x732c('0x3'));var BPromise=require(_0x732c('0x4'));var Mustache=require('mustache');var util=require(_0x732c('0x5'));var path=require(_0x732c('0x6'));var sox=require(_0x732c('0x7'));var csv=require(_0x732c('0x8'));var ejs=require(_0x732c('0x9'));var fs=require('fs');var fs_extra=require(_0x732c('0xa'));var _=require(_0x732c('0xb'));var squel=require(_0x732c('0xc'));var crypto=require('crypto');var jsforce=require(_0x732c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x732c('0x8'));var querystring=require(_0x732c('0xe'));var Papa=require(_0x732c('0xf'));var Redis=require(_0x732c('0x10'));var authService=require(_0x732c('0x11'));var qs=require(_0x732c('0x12'));var as=require(_0x732c('0x13'));var hardwareService=require(_0x732c('0x14'));var logger=require('../../config/logger')(_0x732c('0x15'));var utils=require('../../config/utils');var config=require(_0x732c('0x16'));var licenseUtil=require(_0x732c('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x732c('0x18')](config[_0x732c('0x19')],{'host':_0x732c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x732c('0x19')]));require(_0x732c('0x1b'))[_0x732c('0x1c')](socket);var jayson=require(_0x732c('0x1d'));var client=jayson['client'][_0x732c('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x5556a2,_0x4d14e0,_0x514ea7,_0x2548ba){return new BPromise(function(_0x4bedac,_0x1f0af5){var _0x8591b4=_0x2548ba||client;return _0x8591b4[_0x732c('0x1f')](_0x5556a2,_0x514ea7)['then'](function(_0x412b0c){logger[_0x732c('0x20')](_0x732c('0x21'),_0x4d14e0,_0x732c('0x22'));logger[_0x732c('0x23')](_0x732c('0x24'),_0x4d14e0,_0x732c('0x22'),JSON[_0x732c('0x25')](_0x412b0c));if(_0x412b0c[_0x732c('0x26')]){if(_0x412b0c['error'][_0x732c('0x27')]===0x1f4){logger['error'](_0x732c('0x21'),_0x4d14e0,_0x412b0c[_0x732c('0x26')]['message']);return _0x1f0af5(_0x412b0c[_0x732c('0x26')][_0x732c('0x28')]);}logger['error'](_0x732c('0x21'),_0x4d14e0,_0x412b0c[_0x732c('0x26')][_0x732c('0x28')]);return _0x4bedac(_0x412b0c[_0x732c('0x26')][_0x732c('0x28')]);}else{logger[_0x732c('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x4d14e0,'request\x20sent');_0x4bedac(_0x412b0c[_0x732c('0x29')][_0x732c('0x28')]);}})[_0x732c('0x2a')](function(_0x3cb972){logger[_0x732c('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x4d14e0,_0x3cb972);_0x1f0af5(_0x3cb972);});});}function respondWithStatusCode(_0x1ed949,_0x1bcbab){_0x1bcbab=_0x1bcbab||0xcc;return function(_0x162c03){if(_0x162c03){return _0x1ed949['sendStatus'](_0x1bcbab);}return _0x1ed949[_0x732c('0x2b')](_0x1bcbab)[_0x732c('0x2c')]();};}function respondWithResult(_0x10126c,_0x2e1cff){_0x2e1cff=_0x2e1cff||0xc8;return function(_0x49d946){if(_0x49d946){return _0x10126c[_0x732c('0x2b')](_0x2e1cff)[_0x732c('0x2d')](_0x49d946);}};}function respondWithFilteredResult(_0x2a701b,_0x42c50e){return function(_0x3ffcfc){if(_0x3ffcfc){var _0x468ce0=typeof _0x42c50e[_0x732c('0x2e')]===_0x732c('0x2f')&&typeof _0x42c50e[_0x732c('0x30')]==='undefined';var _0x1f502b=_0x3ffcfc['count'];var _0x1d3b52=_0x468ce0?0x0:_0x42c50e['offset'];var _0x4e65bc=_0x468ce0?_0x3ffcfc[_0x732c('0x31')]:_0x42c50e[_0x732c('0x2e')]+_0x42c50e['limit'];var _0x3100e0;if(_0x4e65bc>=_0x1f502b){_0x4e65bc=_0x1f502b;_0x3100e0=0xc8;}else{_0x3100e0=0xce;}_0x2a701b['status'](_0x3100e0);return _0x2a701b['set']('Content-Range',_0x1d3b52+'-'+_0x4e65bc+'/'+_0x1f502b)[_0x732c('0x2d')](_0x3ffcfc);}return null;};}function patchUpdates(_0x439b29){return function(_0x5adbe1){try{jsonpatch[_0x732c('0x32')](_0x5adbe1,_0x439b29,!![]);}catch(_0x3e3fe6){return BPromise[_0x732c('0x33')](_0x3e3fe6);}return _0x5adbe1[_0x732c('0x34')]();};}function saveUpdates(_0x20fb8c,_0x349920){return function(_0x47eece){if(_0x47eece){return _0x47eece[_0x732c('0x35')](_0x20fb8c)[_0x732c('0x36')](function(_0x32d48c){return _0x32d48c;});}return null;};}function removeEntity(_0x5ccbbb,_0x2da11b){return function(_0xb3e292){if(_0xb3e292){return _0xb3e292[_0x732c('0x37')]()[_0x732c('0x36')](function(){var _0x17c0b3=_0xb3e292[_0x732c('0x38')]({'plain':!![]});var _0x1a3b03=_0x732c('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x1a3b03,'resourceId':_0x17c0b3['id']}})[_0x732c('0x36')](function(){return _0xb3e292;});})['then'](function(){_0x5ccbbb[_0x732c('0x2b')](0xcc)[_0x732c('0x2c')]();});}};}function handleEntityNotFound(_0x474d13,_0x4cbef6){return function(_0xcfc29c){if(!_0xcfc29c){_0x474d13[_0x732c('0x3a')](0x194);}return _0xcfc29c;};}function handleError(_0x479d91,_0xc5c850){_0xc5c850=_0xc5c850||0x1f4;return function(_0x5e9a69){logger[_0x732c('0x26')](_0x5e9a69[_0x732c('0x3b')]);if(_0x5e9a69[_0x732c('0x3c')]){delete _0x5e9a69[_0x732c('0x3c')];}_0x479d91[_0x732c('0x2b')](_0xc5c850)['send'](_0x5e9a69);};}exports[_0x732c('0x3d')]=function(_0x3d1525,_0x4c54d9){var _0x2f7b29={'include':[{'model':db['Pause'],'as':_0x732c('0x3e')}]},_0x42f56e={},_0x416842={'count':0x0,'rows':[]};var _0x50c739=_[_0x732c('0x3f')](db[_0x732c('0x40')][_0x732c('0x41')],function(_0x3e8b67){return{'name':_0x3e8b67['fieldName'],'type':_0x3e8b67[_0x732c('0x42')]['key']};});_0x42f56e[_0x732c('0x43')]=_['map'](_0x50c739,'name');_0x42f56e[_0x732c('0x44')]=_['keys'](_0x3d1525[_0x732c('0x44')]);_0x42f56e[_0x732c('0x45')]=_[_0x732c('0x46')](_0x42f56e['model'],_0x42f56e['query']);_0x2f7b29[_0x732c('0x47')]=_[_0x732c('0x46')](_0x42f56e['model'],qs[_0x732c('0x48')](_0x3d1525['query'][_0x732c('0x48')]));_0x2f7b29[_0x732c('0x47')]=_0x2f7b29[_0x732c('0x47')][_0x732c('0x49')]?_0x2f7b29[_0x732c('0x47')]:_0x42f56e[_0x732c('0x43')];if(!_0x3d1525[_0x732c('0x44')][_0x732c('0x4a')](_0x732c('0x4b'))){_0x2f7b29[_0x732c('0x30')]=qs['limit'](_0x3d1525['query'][_0x732c('0x30')]);_0x2f7b29['offset']=qs['offset'](_0x3d1525[_0x732c('0x44')][_0x732c('0x2e')]);}_0x2f7b29['order']=qs[_0x732c('0x4c')](_0x3d1525['query']['sort']);_0x2f7b29['where']=qs['filters'](_[_0x732c('0x4d')](_0x3d1525['query'],_0x42f56e['filters']),_0x50c739);if(_0x3d1525['query']['filter']){_0x2f7b29[_0x732c('0x4e')]=_[_0x732c('0x4f')](_0x2f7b29['where'],{'$or':_['map'](_0x50c739,function(_0x8035d){if(_0x8035d[_0x732c('0x42')]!==_0x732c('0x50')){var _0x4e515e={};_0x4e515e[_0x8035d[_0x732c('0x3c')]]={'$like':'%'+_0x3d1525['query'][_0x732c('0x51')]+'%'};return _0x4e515e;}})});}_0x2f7b29=_[_0x732c('0x4f')]({},_0x2f7b29,_0x3d1525[_0x732c('0x52')]);var _0x181a2e={'where':_0x2f7b29['where']};return db['WhatsappAccount'][_0x732c('0x31')](_0x181a2e)[_0x732c('0x36')](function(_0x4a5025){_0x416842[_0x732c('0x31')]=_0x4a5025;if(_0x3d1525[_0x732c('0x44')][_0x732c('0x53')]){_0x2f7b29['include']=[{'all':!![]}];}return db[_0x732c('0x40')][_0x732c('0x54')](_0x2f7b29);})[_0x732c('0x36')](function(_0x42b9e8){_0x416842['rows']=_0x42b9e8;return _0x416842;})[_0x732c('0x36')](respondWithFilteredResult(_0x4c54d9,_0x2f7b29))['catch'](handleError(_0x4c54d9,null));};exports[_0x732c('0x55')]=function(_0x3c8fe1,_0x4cf4a0){var _0x3deb7a={'raw':![],'where':{'id':_0x3c8fe1[_0x732c('0x56')]['id']},'include':[{'model':db[_0x732c('0x57')],'as':_0x732c('0x3e')}]},_0x3e6501={};_0x3e6501['model']=_[_0x732c('0x58')](db[_0x732c('0x40')][_0x732c('0x41')]);_0x3e6501[_0x732c('0x44')]=_[_0x732c('0x58')](_0x3c8fe1[_0x732c('0x44')]);_0x3e6501['filters']=_['intersection'](_0x3e6501[_0x732c('0x43')],_0x3e6501[_0x732c('0x44')]);_0x3deb7a['attributes']=_[_0x732c('0x46')](_0x3e6501[_0x732c('0x43')],qs[_0x732c('0x48')](_0x3c8fe1[_0x732c('0x44')]['fields']));_0x3deb7a[_0x732c('0x47')]=_0x3deb7a[_0x732c('0x47')][_0x732c('0x49')]?_0x3deb7a['attributes']:_0x3e6501['model'];if(_0x3c8fe1[_0x732c('0x44')][_0x732c('0x53')]){_0x3deb7a[_0x732c('0x59')]=[{'all':!![]}];}_0x3deb7a=_[_0x732c('0x4f')]({},_0x3deb7a,_0x3c8fe1[_0x732c('0x52')]);return db['WhatsappAccount'][_0x732c('0x5a')](_0x3deb7a)[_0x732c('0x36')](handleEntityNotFound(_0x4cf4a0,null))[_0x732c('0x36')](respondWithResult(_0x4cf4a0,null))[_0x732c('0x2a')](handleError(_0x4cf4a0,null));};exports[_0x732c('0x5b')]=function(_0x5985bc,_0x29e9df){return db[_0x732c('0x40')][_0x732c('0x5b')](_0x5985bc['body'],{})['then'](function(_0x518ff3){var _0x42c9bf=_0x5985bc[_0x732c('0x5c')][_0x732c('0x38')]({'plain':!![]});if(!_0x42c9bf)throw new Error(_0x732c('0x5d'));if(_0x42c9bf[_0x732c('0x5e')]===_0x732c('0x5c')){var _0x2c2d63=_0x518ff3[_0x732c('0x38')]({'plain':!![]});var _0x4837bc=_0x732c('0x39');return db[_0x732c('0x5f')][_0x732c('0x5a')]({'where':{'name':_0x4837bc,'userProfileId':_0x42c9bf[_0x732c('0x60')]},'raw':!![]})[_0x732c('0x36')](function(_0x1b1f66){if(_0x1b1f66&&_0x1b1f66[_0x732c('0x61')]===0x0){return db[_0x732c('0x62')][_0x732c('0x5b')]({'name':_0x2c2d63[_0x732c('0x3c')],'resourceId':_0x2c2d63['id'],'type':_0x1b1f66[_0x732c('0x3c')],'sectionId':_0x1b1f66['id']},{})['then'](function(){return _0x518ff3;});}else{return _0x518ff3;}})['catch'](function(_0x252e0d){logger[_0x732c('0x26')](_0x732c('0x63'),_0x252e0d);throw _0x252e0d;});}return _0x518ff3;})['then'](respondWithResult(_0x29e9df,0xc9))['catch'](handleError(_0x29e9df,null));};exports[_0x732c('0x35')]=function(_0x3e7025,_0x4a3a95){if(_0x3e7025[_0x732c('0x64')]['id']){delete _0x3e7025['body']['id'];}return db[_0x732c('0x40')][_0x732c('0x5a')]({'where':{'id':_0x3e7025[_0x732c('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4a3a95,null))[_0x732c('0x36')](saveUpdates(_0x3e7025[_0x732c('0x64')],null))['then'](respondWithResult(_0x4a3a95,null))[_0x732c('0x2a')](handleError(_0x4a3a95,null));};exports['destroy']=function(_0x277750,_0x1354e4){return db[_0x732c('0x40')]['find']({'where':{'id':_0x277750[_0x732c('0x56')]['id']}})['then'](handleEntityNotFound(_0x1354e4,null))['then'](removeEntity(_0x1354e4,null))['catch'](handleError(_0x1354e4,null));};exports[_0x732c('0x65')]=function(_0x3e3aaa,_0x2f6182){return db[_0x732c('0x40')]['describe']()[_0x732c('0x36')](respondWithResult(_0x2f6182,null))[_0x732c('0x2a')](handleError(_0x2f6182,null));};exports['addDisposition']=function(_0x2e5774,_0x4a8fab,_0x2bdf5a){if(_0x2e5774[_0x732c('0x64')]['id']){delete _0x2e5774['body']['id'];}return db['WhatsappAccount'][_0x732c('0x5a')]({'where':{'id':_0x2e5774['params']['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x4a8fab,null))[_0x732c('0x36')](function(_0x488d6f){if(_0x488d6f){_0x2e5774['body'][_0x732c('0x66')]=_0x488d6f['id'];return db[_0x732c('0x67')][_0x732c('0x5b')](_0x2e5774[_0x732c('0x64')]);}})[_0x732c('0x36')](respondWithResult(_0x4a8fab,null))[_0x732c('0x2a')](handleError(_0x4a8fab,null));};exports[_0x732c('0x68')]=function(_0x382e9b,_0x34c11f,_0x5804ee){var _0x166d49={'raw':![],'where':{}};var _0x5d6414={};var _0x550fad={'count':0x0,'rows':[]};return db[_0x732c('0x40')]['findOne']({'where':{'id':_0x382e9b[_0x732c('0x56')]['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x34c11f,null))[_0x732c('0x36')](function(_0x5cf583){if(_0x5cf583){_0x5d6414['model']=_[_0x732c('0x58')](db[_0x732c('0x67')][_0x732c('0x41')]);_0x5d6414[_0x732c('0x44')]=_[_0x732c('0x58')](_0x382e9b['query']);_0x5d6414[_0x732c('0x45')]=_[_0x732c('0x46')](_0x5d6414[_0x732c('0x43')],_0x5d6414[_0x732c('0x44')]);_0x166d49[_0x732c('0x47')]=_[_0x732c('0x46')](_0x5d6414[_0x732c('0x43')],qs[_0x732c('0x48')](_0x382e9b[_0x732c('0x44')][_0x732c('0x48')]));_0x166d49[_0x732c('0x47')]=_0x166d49[_0x732c('0x47')][_0x732c('0x49')]?_0x166d49['attributes']:_0x5d6414['model'];if(!_0x382e9b['query']['hasOwnProperty'](_0x732c('0x4b'))){_0x166d49[_0x732c('0x30')]=qs['limit'](_0x382e9b[_0x732c('0x44')][_0x732c('0x30')]);_0x166d49[_0x732c('0x2e')]=qs[_0x732c('0x2e')](_0x382e9b['query'][_0x732c('0x2e')]);}_0x166d49[_0x732c('0x69')]=qs[_0x732c('0x4c')](_0x382e9b[_0x732c('0x44')][_0x732c('0x4c')]);_0x166d49[_0x732c('0x4e')]=qs['filters'](_[_0x732c('0x4d')](_0x382e9b[_0x732c('0x44')],_0x5d6414['filters']));_0x166d49[_0x732c('0x4e')][_0x732c('0x66')]=_0x5cf583['id'];if(_0x382e9b[_0x732c('0x44')][_0x732c('0x51')]){_0x166d49[_0x732c('0x4e')]=_[_0x732c('0x4f')](_0x166d49[_0x732c('0x4e')],{'$or':_[_0x732c('0x3f')](_0x166d49[_0x732c('0x47')],function(_0x31ab01){var _0x40f710={};_0x40f710[_0x31ab01]={'$like':'%'+_0x382e9b[_0x732c('0x44')][_0x732c('0x51')]+'%'};return _0x40f710;})});}_0x166d49=_[_0x732c('0x4f')]({},_0x166d49,_0x382e9b[_0x732c('0x52')]);return db[_0x732c('0x67')][_0x732c('0x31')]({'where':_0x166d49[_0x732c('0x4e')]})[_0x732c('0x36')](function(_0x202062){_0x550fad[_0x732c('0x31')]=_0x202062;if(_0x382e9b['query'][_0x732c('0x53')]){_0x166d49[_0x732c('0x59')]=[{'all':!![]}];}return db[_0x732c('0x67')][_0x732c('0x54')](_0x166d49);})[_0x732c('0x36')](function(_0xf52233){_0x550fad[_0x732c('0x6a')]=_0xf52233;return _0x550fad;});}})[_0x732c('0x36')](respondWithFilteredResult(_0x34c11f,_0x166d49))[_0x732c('0x2a')](handleError(_0x34c11f,null));};exports[_0x732c('0x6b')]=function(_0x1610aa,_0x26c7db,_0x31f594){return db[_0x732c('0x40')][_0x732c('0x5a')]({'where':{'id':_0x1610aa[_0x732c('0x56')]['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x26c7db,null))[_0x732c('0x36')](function(_0x3d019d){if(_0x3d019d){return _0x3d019d['removeDispositions'](_0x1610aa[_0x732c('0x44')][_0x732c('0x6c')]);}})[_0x732c('0x36')](respondWithStatusCode(_0x26c7db,null))['catch'](handleError(_0x26c7db,null));};exports[_0x732c('0x6d')]=function(_0x1dd0b7,_0x55645f,_0x539698){if(_0x1dd0b7[_0x732c('0x64')]['id']){delete _0x1dd0b7[_0x732c('0x64')]['id'];}return db['WhatsappAccount'][_0x732c('0x5a')]({'where':{'id':_0x1dd0b7[_0x732c('0x56')]['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x55645f,null))['then'](function(_0x4685b0){if(_0x4685b0){_0x1dd0b7['body'][_0x732c('0x66')]=_0x4685b0['id'];return db['CannedAnswer'][_0x732c('0x5b')](_0x1dd0b7[_0x732c('0x64')]);}})[_0x732c('0x36')](respondWithResult(_0x55645f,null))[_0x732c('0x2a')](handleError(_0x55645f,null));};exports['getAnswers']=function(_0x22983f,_0x4b67c0,_0x2f5f03){var _0x568d34={'raw':![],'where':{}};var _0x28c972={};var _0x4202c9={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x22983f[_0x732c('0x56')]['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x4b67c0,null))[_0x732c('0x36')](function(_0x3c26e4){if(_0x3c26e4){_0x28c972[_0x732c('0x43')]=_['keys'](db[_0x732c('0x6e')][_0x732c('0x41')]);_0x28c972['query']=_[_0x732c('0x58')](_0x22983f[_0x732c('0x44')]);_0x28c972[_0x732c('0x45')]=_[_0x732c('0x46')](_0x28c972['model'],_0x28c972['query']);_0x568d34['attributes']=_[_0x732c('0x46')](_0x28c972[_0x732c('0x43')],qs[_0x732c('0x48')](_0x22983f[_0x732c('0x44')][_0x732c('0x48')]));_0x568d34[_0x732c('0x47')]=_0x568d34['attributes'][_0x732c('0x49')]?_0x568d34[_0x732c('0x47')]:_0x28c972[_0x732c('0x43')];if(!_0x22983f[_0x732c('0x44')][_0x732c('0x4a')](_0x732c('0x4b'))){_0x568d34['limit']=qs['limit'](_0x22983f[_0x732c('0x44')][_0x732c('0x30')]);_0x568d34[_0x732c('0x2e')]=qs[_0x732c('0x2e')](_0x22983f['query'][_0x732c('0x2e')]);}_0x568d34[_0x732c('0x69')]=qs[_0x732c('0x4c')](_0x22983f[_0x732c('0x44')][_0x732c('0x4c')]);_0x568d34['where']=qs[_0x732c('0x45')](_['pick'](_0x22983f[_0x732c('0x44')],_0x28c972['filters']));_0x568d34['where']['WhatsappAccountId']=_0x3c26e4['id'];if(_0x22983f[_0x732c('0x44')][_0x732c('0x51')]){_0x568d34['where']=_[_0x732c('0x4f')](_0x568d34['where'],{'$or':_[_0x732c('0x3f')](_0x568d34[_0x732c('0x47')],function(_0x4ba04c){var _0x522640={};_0x522640[_0x4ba04c]={'$like':'%'+_0x22983f['query'][_0x732c('0x51')]+'%'};return _0x522640;})});}_0x568d34=_[_0x732c('0x4f')]({},_0x568d34,_0x22983f[_0x732c('0x52')]);return db[_0x732c('0x6e')][_0x732c('0x31')]({'where':_0x568d34[_0x732c('0x4e')]})[_0x732c('0x36')](function(_0x10fdeb){_0x4202c9[_0x732c('0x31')]=_0x10fdeb;if(_0x22983f['query'][_0x732c('0x53')]){_0x568d34[_0x732c('0x59')]=[{'all':!![]}];}return db[_0x732c('0x6e')][_0x732c('0x54')](_0x568d34);})[_0x732c('0x36')](function(_0x12e358){_0x4202c9[_0x732c('0x6a')]=_0x12e358;return _0x4202c9;});}})[_0x732c('0x36')](respondWithFilteredResult(_0x4b67c0,_0x568d34))[_0x732c('0x2a')](handleError(_0x4b67c0,null));};exports[_0x732c('0x6f')]=function(_0x18c984,_0x42abe1,_0x568623){return db['WhatsappAccount'][_0x732c('0x5a')]({'where':{'id':_0x18c984[_0x732c('0x56')]['id']}})['then'](handleEntityNotFound(_0x42abe1,null))[_0x732c('0x36')](function(_0x5efa5e){if(_0x5efa5e){return _0x5efa5e['removeAnswers'](_0x18c984['query'][_0x732c('0x6c')]);}})[_0x732c('0x36')](respondWithStatusCode(_0x42abe1,null))[_0x732c('0x2a')](handleError(_0x42abe1,null));};exports[_0x732c('0x70')]=function(_0x500d6d,_0x1d53b3,_0x2aaa18){return db[_0x732c('0x40')][_0x732c('0x5a')]({'where':{'id':_0x500d6d['params']['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x1d53b3,null))['then'](function(_0x458858){if(_0x458858){return _0x458858['addAgents'](_0x500d6d[_0x732c('0x64')]['ids'],_['omit'](_0x500d6d['body'],[_0x732c('0x6c'),'id'])||{})['spread'](function(_0x4cfd6b){for(var _0x5c0c7e=0x0;_0x5c0c7e<_0x500d6d['body']['ids'][_0x732c('0x49')];_0x5c0c7e+=0x1){socket[_0x732c('0x71')]('userWhatsappAccount:save',{'UserId':Number(_0x500d6d[_0x732c('0x64')][_0x732c('0x6c')][_0x5c0c7e]),'WhatsappAccountId':Number(_0x500d6d['params']['id'])});}return _0x4cfd6b;});}})[_0x732c('0x36')](respondWithResult(_0x1d53b3,null))[_0x732c('0x2a')](handleError(_0x1d53b3,null));};exports[_0x732c('0x72')]=function(_0x464f14,_0x347d18,_0x3790d7){return db[_0x732c('0x40')]['find']({'where':{'id':_0x464f14[_0x732c('0x56')]['id']}})['then'](handleEntityNotFound(_0x347d18,null))['then'](function(_0x5eb733){if(_0x5eb733){return _0x5eb733[_0x732c('0x72')](_0x464f14['query']['ids'])[_0x732c('0x36')](function(){if(_[_0x732c('0x73')](_0x464f14['query']['ids'])){for(var _0x57ab96=0x0;_0x57ab96<_0x464f14[_0x732c('0x44')][_0x732c('0x6c')][_0x732c('0x49')];_0x57ab96+=0x1){socket[_0x732c('0x71')](_0x732c('0x74'),{'UserId':Number(_0x464f14['query']['ids'][_0x57ab96]),'WhatsappAccountId':Number(_0x464f14['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x464f14[_0x732c('0x44')][_0x732c('0x6c')]),'WhatsappAccountId':Number(_0x464f14[_0x732c('0x56')]['id'])});}});}})[_0x732c('0x36')](respondWithStatusCode(_0x347d18,null))[_0x732c('0x2a')](handleError(_0x347d18,null));};exports[_0x732c('0x75')]=function(_0x2d42e2,_0x4f7d7d,_0x7dde62){var _0x393b48={};var _0x420e14={};var _0x4b5f07;var _0x26b81a;return db['WhatsappAccount'][_0x732c('0x76')]({'where':{'id':_0x2d42e2['params']['id']}})['then'](handleEntityNotFound(_0x4f7d7d,null))[_0x732c('0x36')](function(_0x4722a1){if(_0x4722a1){_0x4b5f07=_0x4722a1;_0x420e14[_0x732c('0x43')]=_['keys'](db[_0x732c('0x77')]['rawAttributes']);_0x420e14['query']=_[_0x732c('0x58')](_0x2d42e2[_0x732c('0x44')]);_0x420e14['filters']=_[_0x732c('0x46')](_0x420e14[_0x732c('0x43')],_0x420e14[_0x732c('0x44')]);_0x393b48['attributes']=_[_0x732c('0x46')](_0x420e14['model'],qs[_0x732c('0x48')](_0x2d42e2[_0x732c('0x44')][_0x732c('0x48')]));_0x393b48[_0x732c('0x47')]=_0x393b48[_0x732c('0x47')]['length']?_0x393b48[_0x732c('0x47')]:_0x420e14['model'];_0x393b48['order']=qs[_0x732c('0x4c')](_0x2d42e2[_0x732c('0x44')][_0x732c('0x4c')]);_0x393b48[_0x732c('0x4e')]=qs[_0x732c('0x45')](_[_0x732c('0x4d')](_0x2d42e2[_0x732c('0x44')],_0x420e14[_0x732c('0x45')]));if(_0x2d42e2[_0x732c('0x44')][_0x732c('0x51')]){_0x393b48[_0x732c('0x4e')]=_[_0x732c('0x4f')](_0x393b48[_0x732c('0x4e')],{'$or':_['map'](_0x393b48[_0x732c('0x47')],function(_0x349e09){var _0xd466cd={};_0xd466cd[_0x349e09]={'$like':'%'+_0x2d42e2[_0x732c('0x44')][_0x732c('0x51')]+'%'};return _0xd466cd;})});}_0x393b48=_[_0x732c('0x4f')]({},_0x393b48,_0x2d42e2['options']);return _0x4b5f07[_0x732c('0x75')](_0x393b48);}})[_0x732c('0x36')](function(_0x5882a5){if(_0x5882a5){_0x26b81a=_0x5882a5['length'];if(!_0x2d42e2[_0x732c('0x44')]['hasOwnProperty'](_0x732c('0x4b'))){_0x393b48['limit']=qs[_0x732c('0x30')](_0x2d42e2['query'][_0x732c('0x30')]);_0x393b48['offset']=qs[_0x732c('0x2e')](_0x2d42e2['query']['offset']);}return _0x4b5f07['getAgents'](_0x393b48);}})[_0x732c('0x36')](function(_0x26cd9d){if(_0x26cd9d){return _0x26cd9d?{'count':_0x26b81a,'rows':_0x26cd9d}:null;}})['then'](respondWithResult(_0x4f7d7d,null))[_0x732c('0x2a')](handleError(_0x4f7d7d,null));};exports['addApplications']=function(_0x5153d8,_0x209815){var _0x436b6f=_0x5153d8['params']['id'];var _0x1eea2b=_0x5153d8['body'];var _0x15b1ef=0xc8;var _0xcbb24a=null;return db['sequelize'][_0x732c('0x78')]({'isolationLevel':db['sequelize'][_0x732c('0x79')][_0x732c('0x7a')][_0x732c('0x7b')]},function(_0x4a27d3){return db['WhatsappAccount']['findOne']({'where':{'id':_0x436b6f},'transaction':_0x4a27d3})[_0x732c('0x36')](function(_0x11b8c5){if(_0x11b8c5){return db[_0x732c('0x7c')]['destroy']({'where':{'WhatsappAccountId':_0x436b6f},'transaction':_0x4a27d3})['then'](function(){var _0x22bb59=_[_0x732c('0x3f')](_0x1eea2b,function(_0x3f2a9f){_0x3f2a9f[_0x732c('0x66')]=_0x436b6f;return _0x3f2a9f;});return db['WhatsappApplication'][_0x732c('0x7d')](_0x22bb59,{'transaction':_0x4a27d3});});}else{_0x15b1ef=0x194;_0xcbb24a=[];}});})[_0x732c('0x36')](function(){if(_0x15b1ef!==0x194){return db[_0x732c('0x7c')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x436b6f},'order':_0x732c('0x7e')})[_0x732c('0x36')](function(_0x5bbb98){_0xcbb24a=_0x5bbb98;});}})[_0x732c('0x2a')](function(_0x18ef9f){_0x15b1ef=0x1f4;logger[_0x732c('0x26')](_0x18ef9f[_0x732c('0x3b')]);if(_0x18ef9f[_0x732c('0x3c')]){delete _0x18ef9f[_0x732c('0x3c')];}_0xcbb24a=_0x18ef9f;})[_0x732c('0x7f')](function(){if(_0xcbb24a===null){_0x209815[_0x732c('0x3a')](_0x15b1ef);}else{if(_0x15b1ef===0x1f4){_0x209815[_0x732c('0x2b')](_0x15b1ef)[_0x732c('0x80')](_0xcbb24a);}else{_0x209815[_0x732c('0x2b')](_0x15b1ef)['json'](_0xcbb24a);}}});};exports[_0x732c('0x81')]=function(_0x85fda3,_0x566083,_0x699c0b){var _0x450da2={};var _0x124d57={};var _0x3de036;var _0x34d3fc;return db[_0x732c('0x40')]['findOne']({'where':{'id':_0x85fda3[_0x732c('0x56')]['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x566083,null))[_0x732c('0x36')](function(_0xda8e31){if(_0xda8e31){_0x3de036=_0xda8e31;_0x124d57['model']=_[_0x732c('0x58')](db[_0x732c('0x7c')][_0x732c('0x41')]);_0x124d57['query']=_['keys'](_0x85fda3[_0x732c('0x44')]);_0x124d57[_0x732c('0x45')]=_[_0x732c('0x46')](_0x124d57[_0x732c('0x43')],_0x124d57[_0x732c('0x44')]);_0x450da2['attributes']=_[_0x732c('0x46')](_0x124d57[_0x732c('0x43')],qs[_0x732c('0x48')](_0x85fda3[_0x732c('0x44')][_0x732c('0x48')]));_0x450da2[_0x732c('0x47')]=_0x450da2['attributes'][_0x732c('0x49')]?_0x450da2[_0x732c('0x47')]:_0x124d57['model'];_0x450da2[_0x732c('0x69')]=qs['sort'](_0x85fda3[_0x732c('0x44')][_0x732c('0x4c')]);_0x450da2[_0x732c('0x4e')]=qs[_0x732c('0x45')](_[_0x732c('0x4d')](_0x85fda3[_0x732c('0x44')],_0x124d57[_0x732c('0x45')]));if(_0x85fda3[_0x732c('0x44')][_0x732c('0x51')]){_0x450da2[_0x732c('0x4e')]=_[_0x732c('0x4f')](_0x450da2[_0x732c('0x4e')],{'$or':_[_0x732c('0x3f')](_0x450da2[_0x732c('0x47')],function(_0x42da92){var _0x140184={};_0x140184[_0x42da92]={'$like':'%'+_0x85fda3['query'][_0x732c('0x51')]+'%'};return _0x140184;})});}_0x450da2=_[_0x732c('0x4f')]({},_0x450da2,_0x85fda3[_0x732c('0x52')]);return _0x3de036[_0x732c('0x81')](_0x450da2);}})[_0x732c('0x36')](function(_0x576454){if(_0x576454){_0x34d3fc=_0x576454['length'];if(!_0x85fda3[_0x732c('0x44')][_0x732c('0x4a')](_0x732c('0x4b'))){_0x450da2['limit']=qs[_0x732c('0x30')](_0x85fda3['query'][_0x732c('0x30')]);_0x450da2['offset']=qs[_0x732c('0x2e')](_0x85fda3['query'][_0x732c('0x2e')]);}return _0x3de036[_0x732c('0x81')](_0x450da2);}})['then'](function(_0x5753b4){if(_0x5753b4){return _0x5753b4?{'count':_0x34d3fc,'rows':_0x5753b4}:null;}})['then'](respondWithResult(_0x566083,null))[_0x732c('0x2a')](handleError(_0x566083,null));};exports[_0x732c('0x82')]=function(_0x3df39a,_0x108c82,_0x381888){var _0x1f6b8f={'channel':_0x732c('0x83')};var _0x4468bf=[];var _0x2e1eea=[];var _0xf8fc7d={};return db[_0x732c('0x40')][_0x732c('0x5a')]({'where':{'id':_0x3df39a[_0x732c('0x56')]['id']},'include':[{'model':db[_0x732c('0x7c')],'as':_0x732c('0x84')}]})['then'](handleEntityNotFound(_0x108c82,null))[_0x732c('0x36')](function(_0x333797){_0x1f6b8f[_0x732c('0x85')]=_0x333797;if(_0x1f6b8f[_0x732c('0x85')]&&_0x1f6b8f['account'][_0x732c('0x42')]===_0x732c('0x86')&&_0x3df39a[_0x732c('0x64')][_0x732c('0x87')]){if(_0x3df39a[_0x732c('0x64')]['statuses']['length']===0x0)return;if(_0x3df39a[_0x732c('0x64')]['statuses'][0x0][_0x732c('0x88')]!==_0x732c('0x89'))return;return db[_0x732c('0x8a')][_0x732c('0x35')]({'read':!![],'readAt':_0x3df39a['body'][_0x732c('0x87')][0x0][_0x732c('0x8b')]},{'where':{'messageId':_0x3df39a[_0x732c('0x64')]['statuses'][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x1f4124){return _0x108c82[_0x732c('0x2b')](0xc8)['json'](_0x1f4124);});}_0x1f6b8f[_0x732c('0x8c')]=_[_0x732c('0x8d')](_0x333797[_0x732c('0x84')],[_0x732c('0x7e')],['asc']);if(_0x1f6b8f['account'][_0x732c('0x84')]){delete _0x1f6b8f[_0x732c('0x85')]['Applications'];}return db['CmContact'][_0x732c('0x65')]()[_0x732c('0x36')](function(_0x441b0e){if(!_0x441b0e){throw new db[(_0x732c('0x8e'))]['ValidationError'](_0x732c('0x8f'));}_0x4468bf=_[_0x732c('0x90')](_[_0x732c('0x58')](_0x441b0e),[_0x732c('0x91'),_0x732c('0x92')]);_0x2e1eea=_[_0x732c('0x90')](_[_0x732c('0x58')](_0x441b0e),['createdAt',_0x732c('0x92'),_0x732c('0x93'),_0x732c('0x94')]);_0x1f6b8f[_0x732c('0x64')]={'mapKey':_0x732c('0x95')};if(_0x1f6b8f['account']&&_0x1f6b8f['account'][_0x732c('0x42')]==='twilio'){_0x1f6b8f[_0x732c('0x64')][_0x732c('0x96')]=_0x3df39a[_0x732c('0x64')]['From'][_0x732c('0x97')](_0x732c('0x98'),'');_0x1f6b8f[_0x732c('0x64')][_0x732c('0x64')]=_0x3df39a[_0x732c('0x64')][_0x732c('0x99')];_0x1f6b8f[_0x732c('0x64')][_0x732c('0x9a')]=_0x3df39a['body'][_0x732c('0x9b')];}if(_0x1f6b8f[_0x732c('0x85')]&&_0x1f6b8f['account'][_0x732c('0x42')]===_0x732c('0x86')){_0x1f6b8f[_0x732c('0x64')][_0x732c('0x96')]=_0x3df39a['body'][_0x732c('0x9c')][0x0][_0x732c('0x96')];_0x1f6b8f[_0x732c('0x64')]['body']=_0x3df39a[_0x732c('0x64')][_0x732c('0x9c')][0x0][_0x732c('0x28')][_0x732c('0x64')];_0x1f6b8f['body'][_0x732c('0x9a')]=_0x3df39a['body']['notifications'][0x0]['message_id'];}if(_0x1f6b8f[_0x732c('0x64')]['id']){delete _0x1f6b8f['body']['id'];}if(_[_0x732c('0x9d')](_0x1f6b8f[_0x732c('0x64')][_0x732c('0x96')])){throw new db[(_0x732c('0x8e'))][(_0x732c('0x9e'))](_0x732c('0x9f'));}if(_[_0x732c('0x9d')](_0x1f6b8f['body'][_0x732c('0x64')])||_0x1f6b8f['body'][_0x732c('0x64')]===''){throw new db[(_0x732c('0x8e'))][(_0x732c('0x9e'))](_0x732c('0xa0'));}if(_[_0x732c('0x9d')](_0x1f6b8f[_0x732c('0x64')]['mapKey'])){throw new db[(_0x732c('0x8e'))][(_0x732c('0x9e'))](_0x732c('0xa1')+_0x2e1eea);}if(!_[_0x732c('0xa2')](_0x2e1eea,_0x1f6b8f[_0x732c('0x64')]['mapKey'])){throw new db['Sequelize'][(_0x732c('0x9e'))](_0x732c('0xa3')+_0x2e1eea);}_0xf8fc7d[_0x1f6b8f['body'][_0x732c('0xa4')]]=_0x1f6b8f[_0x732c('0x64')][_0x732c('0x96')];return db[_0x732c('0xa5')][_0x732c('0x5a')]({'where':{'id':_0x1f6b8f['account']['ListId']},'include':[{'model':db[_0x732c('0xa6')],'as':_0x732c('0xa7'),'where':_0xf8fc7d,'limit':0x1,'order':[[_0x732c('0x92'),'DESC']]}]});})[_0x732c('0x36')](handleEntityNotFound(_0x108c82,null))['then'](function(_0x52f979){if(_0x52f979){_0x1f6b8f[_0x732c('0xa8')]=_['omit'](_0x52f979,[_0x732c('0xa7')]);if(_0x52f979[_0x732c('0xa7')]['length']){return _0x52f979['Contacts'][0x0];}var _0x1c85ff=_[_0x732c('0x18')](_0x1f6b8f[_0x732c('0x64')],{'firstName':_0x1f6b8f[_0x732c('0x64')][_0x732c('0x96')],'ListId':_0x52f979['id']});_0x1c85ff[_0x1f6b8f[_0x732c('0x64')]['mapKey']]=_0x1f6b8f['body'][_0x732c('0x96')];return db[_0x732c('0xa6')][_0x732c('0x5b')](_0x1c85ff,{'fields':_0x4468bf,'raw':!![]});}})['then'](handleEntityNotFound(_0x108c82,null))['then'](function(_0x62b03b){if(_0x62b03b){_0x1f6b8f[_0x732c('0xa9')]=_0x62b03b;var _0x3f193b={'ContactId':_0x62b03b['id'],'phone':_0x1f6b8f[_0x732c('0x64')]['from'],'WhatsappAccountId':_0x3df39a[_0x732c('0x56')]['id']};var _0x297621={'ContactId':_0x62b03b['id'],'WhatsappAccountId':_0x3df39a[_0x732c('0x56')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x732c('0x5a')]({'where':_0x297621})['then'](function(_0x59201c){if(_0x59201c){return[_0x59201c,![]];}return db['WhatsappInteraction'][_0x732c('0x5b')](_0x3f193b)[_0x732c('0x36')](function(_0x694e39){return[_0x694e39,!![]];});});}})[_0x732c('0xaa')](function(_0x41dabf,_0xcb505c){_0x1f6b8f[_0x732c('0xab')]=_0x41dabf[_0x732c('0x38')]({'plain':!![]});_0x1f6b8f[_0x732c('0xab')]['created']=![];if(_0xcb505c){if(_0x1f6b8f['account'][_0x732c('0xac')]){_0x1f6b8f[_0x732c('0x8c')][_0x732c('0xad')]({'id':0x0,'priority':_0x1f6b8f['applications'][_0x732c('0x49')]+0x1,'app':_0x732c('0xae'),'appdata':_0x732c('0xaf'),'interval':_0x732c('0xb0')});}_0x1f6b8f[_0x732c('0xab')][_0x732c('0xb1')]=!![];}return db[_0x732c('0x8a')][_0x732c('0x5b')]({'phone':_0x1f6b8f[_0x732c('0x64')][_0x732c('0x96')],'messageId':_0x1f6b8f['body'][_0x732c('0x9a')],'body':_0x1f6b8f[_0x732c('0x64')]['body'],'WhatsappAccountId':_0x3df39a[_0x732c('0x56')]['id'],'WhatsappInteractionId':_0x41dabf['id'],'direction':'in','ContactId':_0x41dabf[_0x732c('0xb2')],'AttachmentId':_0x1f6b8f[_0x732c('0x64')][_0x732c('0xb3')]});})['then'](function(_0x34de19){_0x1f6b8f[_0x732c('0x28')]=_0x34de19;if(_0x1f6b8f[_0x732c('0xab')][_0x732c('0xb4')]){return db[_0x732c('0x77')][_0x732c('0x5a')]({'attributes':['id','name'],'where':{'id':_0x1f6b8f[_0x732c('0xab')][_0x732c('0xb4')]}})[_0x732c('0x36')](function(_0x32b6e6){if(_0x32b6e6){_0x1f6b8f[_0x732c('0x8c')]['unshift']({'id':0x0,'priority':0x0,'app':_0x732c('0xb5'),'appdata':_0x32b6e6[_0x732c('0x3c')]+','+(_0x1f6b8f[_0x732c('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0x732c('0xb0')});}return respondWithRpcPromise(_0x732c('0xb6'),_0x732c('0xb7'),_0x1f6b8f);});}return respondWithRpcPromise(_0x732c('0xb6'),'startRouting',_0x1f6b8f);})[_0x732c('0x36')](function(_0x2679a){if(_0x2679a){var _0x5669f4=0xc8;var _0x4f87d2=_0x732c('0xb8');logger[_0x732c('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4f87d2,_0x5669f4,_0x732c('0xb9'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4f87d2,_0x5669f4,_0x732c('0xb9'),JSON[_0x732c('0x25')](_0x2679a));if(_0x1f6b8f[_0x732c('0x85')][_0x732c('0x42')]==='twilio'){return _0x108c82[_0x732c('0x2b')](_0x5669f4)[_0x732c('0xba')](_0x732c('0xbb'),_0x732c('0xbc'))['send'](_0x732c('0xbd'));}else{return _0x108c82[_0x732c('0x2b')](_0x5669f4)[_0x732c('0x2d')](_0x2679a);}}});})['catch'](handleError(_0x108c82,null));};exports[_0x732c('0x80')]=function(_0x26eabf,_0x9d01d5,_0x46640c){var _0x4e7978,_0x52d12f,_0x312010;if(_[_0x732c('0x9d')](_0x26eabf[_0x732c('0x64')][_0x732c('0x64')])||_0x26eabf[_0x732c('0x64')][_0x732c('0x64')]===''){throw new db[(_0x732c('0x8e'))][(_0x732c('0x9e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x26eabf[_0x732c('0x64')]['to'])){throw new db[(_0x732c('0x8e'))][(_0x732c('0x9e'))](_0x732c('0xbe'));}_0x4e7978=_0x26eabf[_0x732c('0x64')]['to'];return db[_0x732c('0x40')][_0x732c('0x5a')]({'where':{'id':_0x26eabf[_0x732c('0x56')]['id']},'include':[{'model':db[_0x732c('0xa5')],'as':'List','include':[{'model':db[_0x732c('0xa6')],'as':_0x732c('0xa7'),'where':{'mobile':_0x4e7978},'limit':0x1,'order':[[_0x732c('0x92'),_0x732c('0xbf')]]}]}]})[_0x732c('0x36')](handleEntityNotFound(_0x9d01d5,null))[_0x732c('0x36')](function(_0x42c6ad){if(_0x42c6ad&&_0x42c6ad['List']){_0x52d12f=_0x42c6ad[_0x732c('0x38')]({'plain':!![]});if(_0x52d12f[_0x732c('0xc0')]&&_0x52d12f[_0x732c('0xc0')]['Contacts'][_0x732c('0x49')]){return _0x52d12f[_0x732c('0xc0')][_0x732c('0xa7')][0x0];}return db['CmContact']['create'](_[_0x732c('0x18')](_0x26eabf['body'],{'firstName':_0x4e7978,'mobile':_0x4e7978,'phone':_0x4e7978,'ListId':_0x52d12f[_0x732c('0x94')]}));}})[_0x732c('0x36')](handleEntityNotFound(_0x9d01d5,null))[_0x732c('0x36')](function(_0x31a1f5){if(_0x31a1f5){_0x312010=_0x31a1f5;return db[_0x732c('0xc1')][_0x732c('0x5a')]({'where':{'ContactId':_0x312010['id'],'closed':![],'WhatsappAccountId':_0x52d12f['id']}})[_0x732c('0x36')](function(_0x548447){if(_0x548447){return[_0x548447,![]];}return db['WhatsappInteraction'][_0x732c('0x5b')]({'UserId':_0x26eabf['user']['id'],'ContactId':_0x312010['id'],'WhatsappAccountId':_0x52d12f['id'],'phone':_0x4e7978,'firstMsgDirection':_0x732c('0xc2'),'Messages':[_['merge'](_0x26eabf[_0x732c('0x64')],{'read':![],'body':_0x26eabf['body']['body'],'phone':_0x4e7978,'WhatsappAccountId':_0x52d12f['id'],'UserId':_0x26eabf[_0x732c('0x5c')]['id'],'ContactId':_0x312010['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x732c('0xc3')}]})[_0x732c('0x36')](function(_0x4c23f3){return[_0x4c23f3,!![]];});});}})[_0x732c('0xaa')](function(_0x69fac2,_0x10a328){if(_0x10a328){return _0x69fac2;}return db[_0x732c('0x8a')]['create'](_[_0x732c('0x4f')](_0x26eabf['body'],{'read':![],'body':_0x26eabf[_0x732c('0x64')][_0x732c('0x64')],'phone':_0x4e7978,'WhatsappAccountId':_0x52d12f['id'],'WhatsappInteractionId':_0x69fac2['id'],'UserId':_0x26eabf[_0x732c('0x5c')]['id'],'ContactId':_0x312010['id']}))['then'](function(_0x5d2e3c){_0x69fac2[_0x732c('0xc4')][_0x732c('0xc3')]=[];_0x69fac2[_0x732c('0xc4')][_0x732c('0xc3')]['push'](_0x5d2e3c[_0x732c('0xc4')]);return _0x69fac2;});})['then'](respondWithResult(_0x9d01d5,null))[_0x732c('0x2a')](handleError(_0x9d01d5,null));}; \ No newline at end of file +var _0x7abb=['show','options','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','rows','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','notify','Applications','account','sinch','statuses','WhatsappMessage','message_id','applications','orderBy','asc','CmContact','describe','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','from','From','whatsapp:','messageId','MessageSid','notifications','isNil','ValidationError','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','Contacts','DESC','list','omit','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','update','get','WhatsappAccounts','UserProfileResource','destroy','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x7abb,0x1e6));var _0xb7ab=function(_0x1dfc71,_0x52cbd3){_0x1dfc71=_0x1dfc71-0x0;var _0x449188=_0x7abb[_0x1dfc71];return _0x449188;};'use strict';var emlformat=require(_0xb7ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb7ab('0x1'));var jsonpatch=require(_0xb7ab('0x2'));var rp=require(_0xb7ab('0x3'));var moment=require(_0xb7ab('0x4'));var BPromise=require(_0xb7ab('0x5'));var Mustache=require(_0xb7ab('0x6'));var util=require('util');var path=require(_0xb7ab('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7ab('0x8'));var _=require(_0xb7ab('0x9'));var squel=require(_0xb7ab('0xa'));var crypto=require(_0xb7ab('0xb'));var jsforce=require(_0xb7ab('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb7ab('0xd'));var querystring=require(_0xb7ab('0xe'));var Papa=require(_0xb7ab('0xf'));var Redis=require('ioredis');var authService=require(_0xb7ab('0x10'));var qs=require(_0xb7ab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb7ab('0x12'));var logger=require(_0xb7ab('0x13'))('api');var utils=require(_0xb7ab('0x14'));var config=require(_0xb7ab('0x15'));var licenseUtil=require(_0xb7ab('0x16'));var db=require(_0xb7ab('0x17'))['db'];config[_0xb7ab('0x18')]=_['defaults'](config[_0xb7ab('0x18')],{'host':_0xb7ab('0x19'),'port':0x18eb});var socket=require(_0xb7ab('0x1a'))(new Redis(config[_0xb7ab('0x18')]));require('./whatsappAccount.socket')[_0xb7ab('0x1b')](socket);var jayson=require(_0xb7ab('0x1c'));var client=jayson['client'][_0xb7ab('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0xff4588,_0x2a3730,_0x418c18,_0x147fb2){return new BPromise(function(_0x57725d,_0x55a2da){var _0x50156f=_0x147fb2||client;return _0x50156f[_0xb7ab('0x1e')](_0xff4588,_0x418c18)[_0xb7ab('0x1f')](function(_0x2e1559){logger[_0xb7ab('0x20')](_0xb7ab('0x21'),_0x2a3730,_0xb7ab('0x22'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2a3730,_0xb7ab('0x22'),JSON[_0xb7ab('0x23')](_0x2e1559));if(_0x2e1559[_0xb7ab('0x24')]){if(_0x2e1559[_0xb7ab('0x24')][_0xb7ab('0x25')]===0x1f4){logger[_0xb7ab('0x24')](_0xb7ab('0x21'),_0x2a3730,_0x2e1559[_0xb7ab('0x24')]['message']);return _0x55a2da(_0x2e1559['error'][_0xb7ab('0x26')]);}logger[_0xb7ab('0x24')](_0xb7ab('0x21'),_0x2a3730,_0x2e1559[_0xb7ab('0x24')][_0xb7ab('0x26')]);return _0x57725d(_0x2e1559[_0xb7ab('0x24')][_0xb7ab('0x26')]);}else{logger[_0xb7ab('0x20')](_0xb7ab('0x21'),_0x2a3730,_0xb7ab('0x22'));_0x57725d(_0x2e1559[_0xb7ab('0x27')]['message']);}})[_0xb7ab('0x28')](function(_0x3c7fd1){logger[_0xb7ab('0x24')](_0xb7ab('0x21'),_0x2a3730,_0x3c7fd1);_0x55a2da(_0x3c7fd1);});});}function respondWithStatusCode(_0x101945,_0x17da2a){_0x17da2a=_0x17da2a||0xcc;return function(_0x47c017){if(_0x47c017){return _0x101945['sendStatus'](_0x17da2a);}return _0x101945[_0xb7ab('0x29')](_0x17da2a)[_0xb7ab('0x2a')]();};}function respondWithResult(_0x2d642a,_0x20567b){_0x20567b=_0x20567b||0xc8;return function(_0x467b09){if(_0x467b09){return _0x2d642a[_0xb7ab('0x29')](_0x20567b)[_0xb7ab('0x2b')](_0x467b09);}};}function respondWithFilteredResult(_0x30db68,_0x33df9a){return function(_0x12ff5d){if(_0x12ff5d){var _0xe68c7f=typeof _0x33df9a[_0xb7ab('0x2c')]===_0xb7ab('0x2d')&&typeof _0x33df9a[_0xb7ab('0x2e')]===_0xb7ab('0x2d');var _0x24768e=_0x12ff5d['count'];var _0x12ee79=_0xe68c7f?0x0:_0x33df9a[_0xb7ab('0x2c')];var _0x427ce3=_0xe68c7f?_0x12ff5d[_0xb7ab('0x2f')]:_0x33df9a[_0xb7ab('0x2c')]+_0x33df9a[_0xb7ab('0x2e')];var _0x3e5db1;if(_0x427ce3>=_0x24768e){_0x427ce3=_0x24768e;_0x3e5db1=0xc8;}else{_0x3e5db1=0xce;}_0x30db68[_0xb7ab('0x29')](_0x3e5db1);return _0x30db68[_0xb7ab('0x30')]('Content-Range',_0x12ee79+'-'+_0x427ce3+'/'+_0x24768e)[_0xb7ab('0x2b')](_0x12ff5d);}return null;};}function patchUpdates(_0x485dc5){return function(_0x306b07){try{jsonpatch['apply'](_0x306b07,_0x485dc5,!![]);}catch(_0x2242a6){return BPromise['reject'](_0x2242a6);}return _0x306b07['save']();};}function saveUpdates(_0x4a2aee,_0x18522a){return function(_0x1c65fc){if(_0x1c65fc){return _0x1c65fc[_0xb7ab('0x31')](_0x4a2aee)[_0xb7ab('0x1f')](function(_0x288ee9){return _0x288ee9;});}return null;};}function removeEntity(_0x49e58c,_0x2f4470){return function(_0x311d97){if(_0x311d97){return _0x311d97['destroy']()['then'](function(){var _0x12aa65=_0x311d97[_0xb7ab('0x32')]({'plain':!![]});var _0x422809=_0xb7ab('0x33');return db[_0xb7ab('0x34')][_0xb7ab('0x35')]({'where':{'type':_0x422809,'resourceId':_0x12aa65['id']}})['then'](function(){return _0x311d97;});})[_0xb7ab('0x1f')](function(){_0x49e58c[_0xb7ab('0x29')](0xcc)[_0xb7ab('0x2a')]();});}};}function handleEntityNotFound(_0x3300d9,_0x50f9b2){return function(_0x5bf3e7){if(!_0x5bf3e7){_0x3300d9[_0xb7ab('0x36')](0x194);}return _0x5bf3e7;};}function handleError(_0x47e77d,_0x4b3dc3){_0x4b3dc3=_0x4b3dc3||0x1f4;return function(_0x5889c7){logger[_0xb7ab('0x24')](_0x5889c7['stack']);if(_0x5889c7[_0xb7ab('0x37')]){delete _0x5889c7[_0xb7ab('0x37')];}_0x47e77d[_0xb7ab('0x29')](_0x4b3dc3)[_0xb7ab('0x38')](_0x5889c7);};}exports[_0xb7ab('0x39')]=function(_0x29ba05,_0x2ca248){var _0x95395a={'include':[{'model':db[_0xb7ab('0x3a')],'as':_0xb7ab('0x3b')}]},_0x3da8f6={},_0x490d77={'count':0x0,'rows':[]};var _0x17db90=_[_0xb7ab('0x3c')](db[_0xb7ab('0x3d')][_0xb7ab('0x3e')],function(_0x24feb2){return{'name':_0x24feb2['fieldName'],'type':_0x24feb2['type']['key']};});_0x3da8f6[_0xb7ab('0x3f')]=_[_0xb7ab('0x3c')](_0x17db90,'name');_0x3da8f6[_0xb7ab('0x40')]=_[_0xb7ab('0x41')](_0x29ba05[_0xb7ab('0x40')]);_0x3da8f6[_0xb7ab('0x42')]=_['intersection'](_0x3da8f6[_0xb7ab('0x3f')],_0x3da8f6[_0xb7ab('0x40')]);_0x95395a[_0xb7ab('0x43')]=_[_0xb7ab('0x44')](_0x3da8f6[_0xb7ab('0x3f')],qs[_0xb7ab('0x45')](_0x29ba05['query'][_0xb7ab('0x45')]));_0x95395a[_0xb7ab('0x43')]=_0x95395a['attributes'][_0xb7ab('0x46')]?_0x95395a[_0xb7ab('0x43')]:_0x3da8f6[_0xb7ab('0x3f')];if(!_0x29ba05[_0xb7ab('0x40')][_0xb7ab('0x47')](_0xb7ab('0x48'))){_0x95395a[_0xb7ab('0x2e')]=qs[_0xb7ab('0x2e')](_0x29ba05[_0xb7ab('0x40')]['limit']);_0x95395a['offset']=qs[_0xb7ab('0x2c')](_0x29ba05[_0xb7ab('0x40')][_0xb7ab('0x2c')]);}_0x95395a[_0xb7ab('0x49')]=qs[_0xb7ab('0x4a')](_0x29ba05['query'][_0xb7ab('0x4a')]);_0x95395a[_0xb7ab('0x4b')]=qs[_0xb7ab('0x42')](_[_0xb7ab('0x4c')](_0x29ba05[_0xb7ab('0x40')],_0x3da8f6[_0xb7ab('0x42')]),_0x17db90);if(_0x29ba05[_0xb7ab('0x40')][_0xb7ab('0x4d')]){_0x95395a[_0xb7ab('0x4b')]=_[_0xb7ab('0x4e')](_0x95395a['where'],{'$or':_['map'](_0x17db90,function(_0x3d22b6){if(_0x3d22b6[_0xb7ab('0x4f')]!==_0xb7ab('0x50')){var _0xcbd988={};_0xcbd988[_0x3d22b6['name']]={'$like':'%'+_0x29ba05[_0xb7ab('0x40')]['filter']+'%'};return _0xcbd988;}})});}_0x95395a=_[_0xb7ab('0x4e')]({},_0x95395a,_0x29ba05['options']);var _0x339415={'where':_0x95395a[_0xb7ab('0x4b')]};return db['WhatsappAccount'][_0xb7ab('0x2f')](_0x339415)[_0xb7ab('0x1f')](function(_0x3fa2bb){_0x490d77[_0xb7ab('0x2f')]=_0x3fa2bb;if(_0x29ba05[_0xb7ab('0x40')][_0xb7ab('0x51')]){_0x95395a[_0xb7ab('0x52')]=[{'all':!![]}];}return db[_0xb7ab('0x3d')][_0xb7ab('0x53')](_0x95395a);})['then'](function(_0x44aaae){_0x490d77['rows']=_0x44aaae;return _0x490d77;})[_0xb7ab('0x1f')](respondWithFilteredResult(_0x2ca248,_0x95395a))[_0xb7ab('0x28')](handleError(_0x2ca248,null));};exports[_0xb7ab('0x54')]=function(_0x3e09dd,_0x155c1b){var _0x4b0ba9={'raw':![],'where':{'id':_0x3e09dd['params']['id']},'include':[{'model':db[_0xb7ab('0x3a')],'as':_0xb7ab('0x3b')}]},_0x356fc0={};_0x356fc0[_0xb7ab('0x3f')]=_[_0xb7ab('0x41')](db[_0xb7ab('0x3d')][_0xb7ab('0x3e')]);_0x356fc0['query']=_[_0xb7ab('0x41')](_0x3e09dd[_0xb7ab('0x40')]);_0x356fc0[_0xb7ab('0x42')]=_['intersection'](_0x356fc0[_0xb7ab('0x3f')],_0x356fc0[_0xb7ab('0x40')]);_0x4b0ba9[_0xb7ab('0x43')]=_[_0xb7ab('0x44')](_0x356fc0[_0xb7ab('0x3f')],qs[_0xb7ab('0x45')](_0x3e09dd[_0xb7ab('0x40')][_0xb7ab('0x45')]));_0x4b0ba9['attributes']=_0x4b0ba9[_0xb7ab('0x43')][_0xb7ab('0x46')]?_0x4b0ba9[_0xb7ab('0x43')]:_0x356fc0['model'];if(_0x3e09dd[_0xb7ab('0x40')][_0xb7ab('0x51')]){_0x4b0ba9[_0xb7ab('0x52')]=[{'all':!![]}];}_0x4b0ba9=_[_0xb7ab('0x4e')]({},_0x4b0ba9,_0x3e09dd[_0xb7ab('0x55')]);return db['WhatsappAccount']['find'](_0x4b0ba9)['then'](handleEntityNotFound(_0x155c1b,null))[_0xb7ab('0x1f')](respondWithResult(_0x155c1b,null))['catch'](handleError(_0x155c1b,null));};exports[_0xb7ab('0x56')]=function(_0x35ddf5,_0x1265fa){return db[_0xb7ab('0x3d')][_0xb7ab('0x56')](_0x35ddf5[_0xb7ab('0x57')],{})[_0xb7ab('0x1f')](function(_0xd8b67e){var _0x37a4f7=_0x35ddf5[_0xb7ab('0x58')][_0xb7ab('0x32')]({'plain':!![]});if(!_0x37a4f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37a4f7[_0xb7ab('0x59')]===_0xb7ab('0x58')){var _0x1d2946=_0xd8b67e[_0xb7ab('0x32')]({'plain':!![]});var _0x3dca20='WhatsappAccounts';return db[_0xb7ab('0x5a')]['find']({'where':{'name':_0x3dca20,'userProfileId':_0x37a4f7['userProfileId']},'raw':!![]})[_0xb7ab('0x1f')](function(_0x51d809){if(_0x51d809&&_0x51d809['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1d2946[_0xb7ab('0x37')],'resourceId':_0x1d2946['id'],'type':_0x51d809[_0xb7ab('0x37')],'sectionId':_0x51d809['id']},{})[_0xb7ab('0x1f')](function(){return _0xd8b67e;});}else{return _0xd8b67e;}})[_0xb7ab('0x28')](function(_0x549d9a){logger[_0xb7ab('0x24')](_0xb7ab('0x5b'),_0x549d9a);throw _0x549d9a;});}return _0xd8b67e;})[_0xb7ab('0x1f')](respondWithResult(_0x1265fa,0xc9))[_0xb7ab('0x28')](handleError(_0x1265fa,null));};exports[_0xb7ab('0x31')]=function(_0x5cdc7d,_0x1e1753){if(_0x5cdc7d['body']['id']){delete _0x5cdc7d['body']['id'];}return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x5cdc7d[_0xb7ab('0x5d')]['id']},'include':[{'model':db[_0xb7ab('0x3a')],'as':_0xb7ab('0x3b')}]})[_0xb7ab('0x1f')](handleEntityNotFound(_0x1e1753,null))[_0xb7ab('0x1f')](saveUpdates(_0x5cdc7d['body'],null))[_0xb7ab('0x1f')](respondWithResult(_0x1e1753,null))[_0xb7ab('0x28')](handleError(_0x1e1753,null));};exports[_0xb7ab('0x35')]=function(_0x41b553,_0x15997f){return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x41b553['params']['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x15997f,null))[_0xb7ab('0x1f')](removeEntity(_0x15997f,null))['catch'](handleError(_0x15997f,null));};exports['describe']=function(_0x5ea87f,_0xfa7db8){return db[_0xb7ab('0x3d')]['describe']()[_0xb7ab('0x1f')](respondWithResult(_0xfa7db8,null))[_0xb7ab('0x28')](handleError(_0xfa7db8,null));};exports[_0xb7ab('0x5e')]=function(_0x2e9442,_0x1bed3b,_0x26f480){if(_0x2e9442[_0xb7ab('0x57')]['id']){delete _0x2e9442[_0xb7ab('0x57')]['id'];}return db['WhatsappAccount'][_0xb7ab('0x5c')]({'where':{'id':_0x2e9442[_0xb7ab('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1bed3b,null))[_0xb7ab('0x1f')](function(_0x31d39d){if(_0x31d39d){_0x2e9442[_0xb7ab('0x57')][_0xb7ab('0x5f')]=_0x31d39d['id'];return db[_0xb7ab('0x60')][_0xb7ab('0x56')](_0x2e9442[_0xb7ab('0x57')]);}})[_0xb7ab('0x1f')](respondWithResult(_0x1bed3b,null))['catch'](handleError(_0x1bed3b,null));};exports[_0xb7ab('0x61')]=function(_0x5550cc,_0x17a437,_0x2a917b){var _0x3562c2={'raw':![],'where':{}};var _0x3f920e={};var _0x3144e3={'count':0x0,'rows':[]};return db[_0xb7ab('0x3d')][_0xb7ab('0x62')]({'where':{'id':_0x5550cc[_0xb7ab('0x5d')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x17a437,null))[_0xb7ab('0x1f')](function(_0x5b597f){if(_0x5b597f){_0x3f920e[_0xb7ab('0x3f')]=_['keys'](db[_0xb7ab('0x60')][_0xb7ab('0x3e')]);_0x3f920e[_0xb7ab('0x40')]=_['keys'](_0x5550cc[_0xb7ab('0x40')]);_0x3f920e[_0xb7ab('0x42')]=_[_0xb7ab('0x44')](_0x3f920e[_0xb7ab('0x3f')],_0x3f920e[_0xb7ab('0x40')]);_0x3562c2[_0xb7ab('0x43')]=_[_0xb7ab('0x44')](_0x3f920e[_0xb7ab('0x3f')],qs[_0xb7ab('0x45')](_0x5550cc[_0xb7ab('0x40')]['fields']));_0x3562c2[_0xb7ab('0x43')]=_0x3562c2[_0xb7ab('0x43')]['length']?_0x3562c2[_0xb7ab('0x43')]:_0x3f920e['model'];if(!_0x5550cc[_0xb7ab('0x40')]['hasOwnProperty']('nolimit')){_0x3562c2['limit']=qs[_0xb7ab('0x2e')](_0x5550cc[_0xb7ab('0x40')][_0xb7ab('0x2e')]);_0x3562c2[_0xb7ab('0x2c')]=qs[_0xb7ab('0x2c')](_0x5550cc[_0xb7ab('0x40')][_0xb7ab('0x2c')]);}_0x3562c2[_0xb7ab('0x49')]=qs['sort'](_0x5550cc[_0xb7ab('0x40')][_0xb7ab('0x4a')]);_0x3562c2[_0xb7ab('0x4b')]=qs[_0xb7ab('0x42')](_[_0xb7ab('0x4c')](_0x5550cc[_0xb7ab('0x40')],_0x3f920e[_0xb7ab('0x42')]));_0x3562c2[_0xb7ab('0x4b')][_0xb7ab('0x5f')]=_0x5b597f['id'];if(_0x5550cc[_0xb7ab('0x40')][_0xb7ab('0x4d')]){_0x3562c2[_0xb7ab('0x4b')]=_[_0xb7ab('0x4e')](_0x3562c2[_0xb7ab('0x4b')],{'$or':_['map'](_0x3562c2[_0xb7ab('0x43')],function(_0x13e254){var _0x306c74={};_0x306c74[_0x13e254]={'$like':'%'+_0x5550cc['query'][_0xb7ab('0x4d')]+'%'};return _0x306c74;})});}_0x3562c2=_[_0xb7ab('0x4e')]({},_0x3562c2,_0x5550cc['options']);return db[_0xb7ab('0x60')][_0xb7ab('0x2f')]({'where':_0x3562c2[_0xb7ab('0x4b')]})[_0xb7ab('0x1f')](function(_0x4b2b6d){_0x3144e3[_0xb7ab('0x2f')]=_0x4b2b6d;if(_0x5550cc['query']['includeAll']){_0x3562c2['include']=[{'all':!![]}];}return db[_0xb7ab('0x60')]['findAll'](_0x3562c2);})[_0xb7ab('0x1f')](function(_0x3ff6b6){_0x3144e3['rows']=_0x3ff6b6;return _0x3144e3;});}})[_0xb7ab('0x1f')](respondWithFilteredResult(_0x17a437,_0x3562c2))['catch'](handleError(_0x17a437,null));};exports[_0xb7ab('0x63')]=function(_0x38b8ab,_0x2f80e5,_0x532871){return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x38b8ab[_0xb7ab('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2f80e5,null))[_0xb7ab('0x1f')](function(_0x21676b){if(_0x21676b){return _0x21676b[_0xb7ab('0x63')](_0x38b8ab['query'][_0xb7ab('0x64')]);}})[_0xb7ab('0x1f')](respondWithStatusCode(_0x2f80e5,null))[_0xb7ab('0x28')](handleError(_0x2f80e5,null));};exports[_0xb7ab('0x65')]=function(_0x595fe5,_0x3c6dc5,_0x19bf1f){if(_0x595fe5[_0xb7ab('0x57')]['id']){delete _0x595fe5[_0xb7ab('0x57')]['id'];}return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x595fe5[_0xb7ab('0x5d')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x3c6dc5,null))[_0xb7ab('0x1f')](function(_0x2c82c2){if(_0x2c82c2){_0x595fe5[_0xb7ab('0x57')][_0xb7ab('0x5f')]=_0x2c82c2['id'];return db[_0xb7ab('0x66')][_0xb7ab('0x56')](_0x595fe5[_0xb7ab('0x57')]);}})[_0xb7ab('0x1f')](respondWithResult(_0x3c6dc5,null))[_0xb7ab('0x28')](handleError(_0x3c6dc5,null));};exports['getAnswers']=function(_0x5a0743,_0x335280,_0x560922){var _0x4deb60={'raw':![],'where':{}};var _0x474a37={};var _0x2ac4e7={'count':0x0,'rows':[]};return db[_0xb7ab('0x3d')][_0xb7ab('0x62')]({'where':{'id':_0x5a0743[_0xb7ab('0x5d')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x335280,null))['then'](function(_0x540c9e){if(_0x540c9e){_0x474a37[_0xb7ab('0x3f')]=_['keys'](db['CannedAnswer'][_0xb7ab('0x3e')]);_0x474a37['query']=_['keys'](_0x5a0743['query']);_0x474a37[_0xb7ab('0x42')]=_[_0xb7ab('0x44')](_0x474a37[_0xb7ab('0x3f')],_0x474a37[_0xb7ab('0x40')]);_0x4deb60[_0xb7ab('0x43')]=_[_0xb7ab('0x44')](_0x474a37['model'],qs[_0xb7ab('0x45')](_0x5a0743[_0xb7ab('0x40')][_0xb7ab('0x45')]));_0x4deb60[_0xb7ab('0x43')]=_0x4deb60[_0xb7ab('0x43')][_0xb7ab('0x46')]?_0x4deb60[_0xb7ab('0x43')]:_0x474a37[_0xb7ab('0x3f')];if(!_0x5a0743[_0xb7ab('0x40')][_0xb7ab('0x47')]('nolimit')){_0x4deb60[_0xb7ab('0x2e')]=qs[_0xb7ab('0x2e')](_0x5a0743[_0xb7ab('0x40')][_0xb7ab('0x2e')]);_0x4deb60['offset']=qs[_0xb7ab('0x2c')](_0x5a0743[_0xb7ab('0x40')]['offset']);}_0x4deb60[_0xb7ab('0x49')]=qs[_0xb7ab('0x4a')](_0x5a0743[_0xb7ab('0x40')][_0xb7ab('0x4a')]);_0x4deb60[_0xb7ab('0x4b')]=qs[_0xb7ab('0x42')](_[_0xb7ab('0x4c')](_0x5a0743[_0xb7ab('0x40')],_0x474a37[_0xb7ab('0x42')]));_0x4deb60[_0xb7ab('0x4b')][_0xb7ab('0x5f')]=_0x540c9e['id'];if(_0x5a0743['query'][_0xb7ab('0x4d')]){_0x4deb60[_0xb7ab('0x4b')]=_[_0xb7ab('0x4e')](_0x4deb60[_0xb7ab('0x4b')],{'$or':_['map'](_0x4deb60['attributes'],function(_0x5b1261){var _0x7b3c41={};_0x7b3c41[_0x5b1261]={'$like':'%'+_0x5a0743[_0xb7ab('0x40')][_0xb7ab('0x4d')]+'%'};return _0x7b3c41;})});}_0x4deb60=_[_0xb7ab('0x4e')]({},_0x4deb60,_0x5a0743[_0xb7ab('0x55')]);return db[_0xb7ab('0x66')][_0xb7ab('0x2f')]({'where':_0x4deb60[_0xb7ab('0x4b')]})[_0xb7ab('0x1f')](function(_0x41bf4e){_0x2ac4e7[_0xb7ab('0x2f')]=_0x41bf4e;if(_0x5a0743[_0xb7ab('0x40')][_0xb7ab('0x51')]){_0x4deb60[_0xb7ab('0x52')]=[{'all':!![]}];}return db[_0xb7ab('0x66')][_0xb7ab('0x53')](_0x4deb60);})[_0xb7ab('0x1f')](function(_0x3bdf79){_0x2ac4e7[_0xb7ab('0x67')]=_0x3bdf79;return _0x2ac4e7;});}})[_0xb7ab('0x1f')](respondWithFilteredResult(_0x335280,_0x4deb60))[_0xb7ab('0x28')](handleError(_0x335280,null));};exports[_0xb7ab('0x68')]=function(_0x3e2f58,_0x513b6c,_0x206227){return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x3e2f58[_0xb7ab('0x5d')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x513b6c,null))[_0xb7ab('0x1f')](function(_0x34d292){if(_0x34d292){return _0x34d292['removeAnswers'](_0x3e2f58[_0xb7ab('0x40')][_0xb7ab('0x64')]);}})[_0xb7ab('0x1f')](respondWithStatusCode(_0x513b6c,null))[_0xb7ab('0x28')](handleError(_0x513b6c,null));};exports[_0xb7ab('0x69')]=function(_0x34c500,_0x16b43d,_0x567a2e){return db['WhatsappAccount'][_0xb7ab('0x5c')]({'where':{'id':_0x34c500[_0xb7ab('0x5d')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x16b43d,null))['then'](function(_0x386bb8){if(_0x386bb8){return _0x386bb8['addAgents'](_0x34c500[_0xb7ab('0x57')][_0xb7ab('0x64')],_['omit'](_0x34c500['body'],['ids','id'])||{})[_0xb7ab('0x6a')](function(_0x4b8aac){for(var _0x5b722a=0x0;_0x5b722a<_0x34c500[_0xb7ab('0x57')][_0xb7ab('0x64')][_0xb7ab('0x46')];_0x5b722a+=0x1){socket['emit'](_0xb7ab('0x6b'),{'UserId':Number(_0x34c500[_0xb7ab('0x57')][_0xb7ab('0x64')][_0x5b722a]),'WhatsappAccountId':Number(_0x34c500[_0xb7ab('0x5d')]['id'])});}return _0x4b8aac;});}})[_0xb7ab('0x1f')](respondWithResult(_0x16b43d,null))[_0xb7ab('0x28')](handleError(_0x16b43d,null));};exports[_0xb7ab('0x6c')]=function(_0x3b6a0e,_0x23a9f9,_0x53800b){return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x3b6a0e[_0xb7ab('0x5d')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x23a9f9,null))[_0xb7ab('0x1f')](function(_0x116a08){if(_0x116a08){return _0x116a08[_0xb7ab('0x6c')](_0x3b6a0e['query'][_0xb7ab('0x64')])[_0xb7ab('0x1f')](function(){if(_[_0xb7ab('0x6d')](_0x3b6a0e['query'][_0xb7ab('0x64')])){for(var _0x3f3db8=0x0;_0x3f3db8<_0x3b6a0e[_0xb7ab('0x40')][_0xb7ab('0x64')][_0xb7ab('0x46')];_0x3f3db8+=0x1){socket[_0xb7ab('0x6e')](_0xb7ab('0x6f'),{'UserId':Number(_0x3b6a0e[_0xb7ab('0x40')][_0xb7ab('0x64')][_0x3f3db8]),'WhatsappAccountId':Number(_0x3b6a0e['params']['id'])});}}else{socket[_0xb7ab('0x6e')](_0xb7ab('0x6f'),{'UserId':Number(_0x3b6a0e[_0xb7ab('0x40')][_0xb7ab('0x64')]),'WhatsappAccountId':Number(_0x3b6a0e[_0xb7ab('0x5d')]['id'])});}});}})[_0xb7ab('0x1f')](respondWithStatusCode(_0x23a9f9,null))[_0xb7ab('0x28')](handleError(_0x23a9f9,null));};exports[_0xb7ab('0x70')]=function(_0x5cdb9c,_0x3dd533,_0x2545f7){var _0x39d939={};var _0x4973e5={};var _0x2d131a;var _0xde3443;return db[_0xb7ab('0x3d')][_0xb7ab('0x62')]({'where':{'id':_0x5cdb9c['params']['id']}})['then'](handleEntityNotFound(_0x3dd533,null))['then'](function(_0x26c51e){if(_0x26c51e){_0x2d131a=_0x26c51e;_0x4973e5[_0xb7ab('0x3f')]=_[_0xb7ab('0x41')](db[_0xb7ab('0x71')][_0xb7ab('0x3e')]);_0x4973e5['query']=_[_0xb7ab('0x41')](_0x5cdb9c['query']);_0x4973e5['filters']=_[_0xb7ab('0x44')](_0x4973e5[_0xb7ab('0x3f')],_0x4973e5[_0xb7ab('0x40')]);_0x39d939[_0xb7ab('0x43')]=_['intersection'](_0x4973e5[_0xb7ab('0x3f')],qs['fields'](_0x5cdb9c[_0xb7ab('0x40')][_0xb7ab('0x45')]));_0x39d939[_0xb7ab('0x43')]=_0x39d939['attributes'][_0xb7ab('0x46')]?_0x39d939[_0xb7ab('0x43')]:_0x4973e5[_0xb7ab('0x3f')];_0x39d939[_0xb7ab('0x49')]=qs[_0xb7ab('0x4a')](_0x5cdb9c[_0xb7ab('0x40')][_0xb7ab('0x4a')]);_0x39d939['where']=qs['filters'](_['pick'](_0x5cdb9c[_0xb7ab('0x40')],_0x4973e5['filters']));if(_0x5cdb9c[_0xb7ab('0x40')][_0xb7ab('0x4d')]){_0x39d939['where']=_['merge'](_0x39d939[_0xb7ab('0x4b')],{'$or':_[_0xb7ab('0x3c')](_0x39d939['attributes'],function(_0x55059a){var _0x2a0918={};_0x2a0918[_0x55059a]={'$like':'%'+_0x5cdb9c[_0xb7ab('0x40')][_0xb7ab('0x4d')]+'%'};return _0x2a0918;})});}_0x39d939=_[_0xb7ab('0x4e')]({},_0x39d939,_0x5cdb9c[_0xb7ab('0x55')]);return _0x2d131a[_0xb7ab('0x70')](_0x39d939);}})[_0xb7ab('0x1f')](function(_0x1dc03c){if(_0x1dc03c){_0xde3443=_0x1dc03c[_0xb7ab('0x46')];if(!_0x5cdb9c[_0xb7ab('0x40')]['hasOwnProperty'](_0xb7ab('0x48'))){_0x39d939[_0xb7ab('0x2e')]=qs['limit'](_0x5cdb9c['query']['limit']);_0x39d939[_0xb7ab('0x2c')]=qs[_0xb7ab('0x2c')](_0x5cdb9c[_0xb7ab('0x40')][_0xb7ab('0x2c')]);}return _0x2d131a[_0xb7ab('0x70')](_0x39d939);}})[_0xb7ab('0x1f')](function(_0x265fe0){if(_0x265fe0){return _0x265fe0?{'count':_0xde3443,'rows':_0x265fe0}:null;}})['then'](respondWithResult(_0x3dd533,null))[_0xb7ab('0x28')](handleError(_0x3dd533,null));};exports[_0xb7ab('0x72')]=function(_0x471533,_0xbc8fd){var _0x490048=_0x471533['params']['id'];var _0x53d9d2=_0x471533['body'];var _0x302af8=0xc8;var _0x4cb70b=null;return db[_0xb7ab('0x73')]['transaction']({'isolationLevel':db[_0xb7ab('0x73')][_0xb7ab('0x74')][_0xb7ab('0x75')][_0xb7ab('0x76')]},function(_0x72c5cf){return db[_0xb7ab('0x3d')][_0xb7ab('0x62')]({'where':{'id':_0x490048},'transaction':_0x72c5cf})[_0xb7ab('0x1f')](function(_0x295d1d){if(_0x295d1d){return db['WhatsappApplication'][_0xb7ab('0x35')]({'where':{'WhatsappAccountId':_0x490048},'transaction':_0x72c5cf})['then'](function(){var _0xae7ccd=_['map'](_0x53d9d2,function(_0x176b45){_0x176b45[_0xb7ab('0x5f')]=_0x490048;return _0x176b45;});return db[_0xb7ab('0x77')][_0xb7ab('0x78')](_0xae7ccd,{'transaction':_0x72c5cf});});}else{_0x302af8=0x194;_0x4cb70b=[];}});})[_0xb7ab('0x1f')](function(){if(_0x302af8!==0x194){return db['WhatsappApplication'][_0xb7ab('0x79')]({'where':{'WhatsappAccountId':_0x490048},'order':_0xb7ab('0x7a')})['then'](function(_0x2cd456){_0x4cb70b=_0x2cd456;});}})[_0xb7ab('0x28')](function(_0x250690){_0x302af8=0x1f4;logger['error'](_0x250690[_0xb7ab('0x7b')]);if(_0x250690[_0xb7ab('0x37')]){delete _0x250690[_0xb7ab('0x37')];}_0x4cb70b=_0x250690;})[_0xb7ab('0x7c')](function(){if(_0x4cb70b===null){_0xbc8fd[_0xb7ab('0x36')](_0x302af8);}else{if(_0x302af8===0x1f4){_0xbc8fd[_0xb7ab('0x29')](_0x302af8)[_0xb7ab('0x38')](_0x4cb70b);}else{_0xbc8fd[_0xb7ab('0x29')](_0x302af8)[_0xb7ab('0x2b')](_0x4cb70b);}}});};exports[_0xb7ab('0x7d')]=function(_0x1ecb0a,_0x100967,_0x2ed6b1){var _0xc21602={};var _0x5ee773={};var _0x1b3b58;var _0x1d8297;return db[_0xb7ab('0x3d')]['findOne']({'where':{'id':_0x1ecb0a['params']['id']}})['then'](handleEntityNotFound(_0x100967,null))['then'](function(_0x3ca164){if(_0x3ca164){_0x1b3b58=_0x3ca164;_0x5ee773['model']=_[_0xb7ab('0x41')](db[_0xb7ab('0x77')]['rawAttributes']);_0x5ee773[_0xb7ab('0x40')]=_[_0xb7ab('0x41')](_0x1ecb0a[_0xb7ab('0x40')]);_0x5ee773['filters']=_[_0xb7ab('0x44')](_0x5ee773[_0xb7ab('0x3f')],_0x5ee773[_0xb7ab('0x40')]);_0xc21602['attributes']=_[_0xb7ab('0x44')](_0x5ee773['model'],qs[_0xb7ab('0x45')](_0x1ecb0a[_0xb7ab('0x40')][_0xb7ab('0x45')]));_0xc21602[_0xb7ab('0x43')]=_0xc21602[_0xb7ab('0x43')][_0xb7ab('0x46')]?_0xc21602[_0xb7ab('0x43')]:_0x5ee773[_0xb7ab('0x3f')];_0xc21602[_0xb7ab('0x49')]=qs['sort'](_0x1ecb0a[_0xb7ab('0x40')][_0xb7ab('0x4a')]);_0xc21602[_0xb7ab('0x4b')]=qs[_0xb7ab('0x42')](_[_0xb7ab('0x4c')](_0x1ecb0a[_0xb7ab('0x40')],_0x5ee773['filters']));if(_0x1ecb0a[_0xb7ab('0x40')]['filter']){_0xc21602[_0xb7ab('0x4b')]=_[_0xb7ab('0x4e')](_0xc21602[_0xb7ab('0x4b')],{'$or':_[_0xb7ab('0x3c')](_0xc21602[_0xb7ab('0x43')],function(_0x1237dd){var _0x2c9584={};_0x2c9584[_0x1237dd]={'$like':'%'+_0x1ecb0a[_0xb7ab('0x40')][_0xb7ab('0x4d')]+'%'};return _0x2c9584;})});}_0xc21602=_[_0xb7ab('0x4e')]({},_0xc21602,_0x1ecb0a[_0xb7ab('0x55')]);return _0x1b3b58[_0xb7ab('0x7d')](_0xc21602);}})[_0xb7ab('0x1f')](function(_0x381eec){if(_0x381eec){_0x1d8297=_0x381eec[_0xb7ab('0x46')];if(!_0x1ecb0a[_0xb7ab('0x40')]['hasOwnProperty'](_0xb7ab('0x48'))){_0xc21602[_0xb7ab('0x2e')]=qs['limit'](_0x1ecb0a['query'][_0xb7ab('0x2e')]);_0xc21602[_0xb7ab('0x2c')]=qs[_0xb7ab('0x2c')](_0x1ecb0a[_0xb7ab('0x40')][_0xb7ab('0x2c')]);}return _0x1b3b58[_0xb7ab('0x7d')](_0xc21602);}})[_0xb7ab('0x1f')](function(_0x2d3073){if(_0x2d3073){return _0x2d3073?{'count':_0x1d8297,'rows':_0x2d3073}:null;}})[_0xb7ab('0x1f')](respondWithResult(_0x100967,null))[_0xb7ab('0x28')](handleError(_0x100967,null));};exports[_0xb7ab('0x7e')]=function(_0x567d28,_0xffb54f,_0x3787f9){var _0x3840fb={'channel':'whatsapp'};var _0x307a64=[];var _0x379b02=[];var _0x4d0b59={};return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x567d28[_0xb7ab('0x5d')]['id']},'include':[{'model':db[_0xb7ab('0x77')],'as':_0xb7ab('0x7f')}]})[_0xb7ab('0x1f')](handleEntityNotFound(_0xffb54f,null))[_0xb7ab('0x1f')](function(_0x4501ff){_0x3840fb[_0xb7ab('0x80')]=_0x4501ff;if(_0x3840fb[_0xb7ab('0x80')]&&_0x3840fb['account'][_0xb7ab('0x4f')]===_0xb7ab('0x81')&&_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x82')]){if(_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x82')][_0xb7ab('0x46')]===0x0)return;if(_0x567d28[_0xb7ab('0x57')]['statuses'][0x0]['state']!=='read')return;return db[_0xb7ab('0x83')][_0xb7ab('0x31')]({'read':!![],'readAt':_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x82')][0x0]['timestamp']},{'where':{'messageId':_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x82')][0x0][_0xb7ab('0x84')]},'individualHooks':!![]})[_0xb7ab('0x1f')](function(_0x285815){return _0xffb54f[_0xb7ab('0x29')](0xc8)[_0xb7ab('0x2b')](_0x285815);});}_0x3840fb[_0xb7ab('0x85')]=_[_0xb7ab('0x86')](_0x4501ff['Applications'],[_0xb7ab('0x7a')],[_0xb7ab('0x87')]);if(_0x3840fb[_0xb7ab('0x80')][_0xb7ab('0x7f')]){delete _0x3840fb[_0xb7ab('0x80')][_0xb7ab('0x7f')];}return db[_0xb7ab('0x88')][_0xb7ab('0x89')]()['then'](function(_0x1220b7){if(!_0x1220b7){throw new db[(_0xb7ab('0x8a'))]['ValidationError']('no\x20available\x20attributes');}_0x307a64=_[_0xb7ab('0x8b')](_['keys'](_0x1220b7),[_0xb7ab('0x8c'),_0xb7ab('0x8d')]);_0x379b02=_[_0xb7ab('0x8b')](_[_0xb7ab('0x41')](_0x1220b7),[_0xb7ab('0x8c'),_0xb7ab('0x8d'),_0xb7ab('0x8e'),_0xb7ab('0x8f')]);_0x3840fb[_0xb7ab('0x57')]={'mapKey':'mobile'};if(_0x3840fb['account']&&_0x3840fb['account']['type']==='twilio'){_0x3840fb['body'][_0xb7ab('0x90')]=_0x567d28['body'][_0xb7ab('0x91')]['replace'](_0xb7ab('0x92'),'');_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x57')]=_0x567d28[_0xb7ab('0x57')]['Body'];_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x93')]=_0x567d28['body'][_0xb7ab('0x94')];}if(_0x3840fb['account']&&_0x3840fb['account'][_0xb7ab('0x4f')]===_0xb7ab('0x81')){_0x3840fb['body'][_0xb7ab('0x90')]=_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x95')][0x0][_0xb7ab('0x90')];_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x57')]=_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x95')][0x0]['message'][_0xb7ab('0x57')];_0x3840fb['body'][_0xb7ab('0x93')]=_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x95')][0x0][_0xb7ab('0x84')];}if(_0x3840fb[_0xb7ab('0x57')]['id']){delete _0x3840fb[_0xb7ab('0x57')]['id'];}if(_[_0xb7ab('0x96')](_0x3840fb['body'][_0xb7ab('0x90')])){throw new db[(_0xb7ab('0x8a'))][(_0xb7ab('0x97'))](_0xb7ab('0x98'));}if(_[_0xb7ab('0x96')](_0x3840fb['body'][_0xb7ab('0x57')])||_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x57')]===''){throw new db[(_0xb7ab('0x8a'))][(_0xb7ab('0x97'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3840fb[_0xb7ab('0x57')]['mapKey'])){throw new db[(_0xb7ab('0x8a'))][(_0xb7ab('0x97'))](_0xb7ab('0x99')+_0x379b02);}if(!_[_0xb7ab('0x9a')](_0x379b02,_0x3840fb['body'][_0xb7ab('0x9b')])){throw new db[(_0xb7ab('0x8a'))][(_0xb7ab('0x97'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x379b02);}_0x4d0b59[_0x3840fb[_0xb7ab('0x57')]['mapKey']]=_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x90')];return db['CmList']['find']({'where':{'id':_0x3840fb[_0xb7ab('0x80')][_0xb7ab('0x8f')]},'include':[{'model':db['CmContact'],'as':_0xb7ab('0x9c'),'where':_0x4d0b59,'limit':0x1,'order':[[_0xb7ab('0x8d'),_0xb7ab('0x9d')]]}]});})[_0xb7ab('0x1f')](handleEntityNotFound(_0xffb54f,null))['then'](function(_0x52c247){if(_0x52c247){_0x3840fb[_0xb7ab('0x9e')]=_[_0xb7ab('0x9f')](_0x52c247,['Contacts']);if(_0x52c247['Contacts'][_0xb7ab('0x46')]){return _0x52c247[_0xb7ab('0x9c')][0x0];}var _0x21b42a=_[_0xb7ab('0xa0')](_0x3840fb['body'],{'firstName':_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x90')],'ListId':_0x52c247['id']});_0x21b42a[_0x3840fb['body'][_0xb7ab('0x9b')]]=_0x3840fb[_0xb7ab('0x57')]['from'];return db[_0xb7ab('0x88')]['create'](_0x21b42a,{'fields':_0x307a64,'raw':!![]});}})['then'](handleEntityNotFound(_0xffb54f,null))[_0xb7ab('0x1f')](function(_0x103c46){if(_0x103c46){_0x3840fb[_0xb7ab('0xa1')]=_0x103c46;var _0x18d6a7={'ContactId':_0x103c46['id'],'phone':_0x3840fb[_0xb7ab('0x57')]['from'],'WhatsappAccountId':_0x567d28[_0xb7ab('0x5d')]['id']};var _0x3bfd8c={'ContactId':_0x103c46['id'],'WhatsappAccountId':_0x567d28[_0xb7ab('0x5d')]['id'],'closed':![]};return db[_0xb7ab('0xa2')][_0xb7ab('0x5c')]({'where':_0x3bfd8c})[_0xb7ab('0x1f')](function(_0x4be14e){if(_0x4be14e){return[_0x4be14e,![]];}return db[_0xb7ab('0xa2')][_0xb7ab('0x56')](_0x18d6a7)[_0xb7ab('0x1f')](function(_0x542be3){return[_0x542be3,!![]];});});}})['spread'](function(_0x125fbd,_0xa7b802){_0x3840fb['interaction']=_0x125fbd[_0xb7ab('0x32')]({'plain':!![]});_0x3840fb[_0xb7ab('0xa3')][_0xb7ab('0xa4')]=![];if(_0xa7b802){if(_0x3840fb['account'][_0xb7ab('0xa5')]){_0x3840fb[_0xb7ab('0x85')][_0xb7ab('0xa6')]({'id':0x0,'priority':_0x3840fb[_0xb7ab('0x85')][_0xb7ab('0x46')]+0x1,'app':_0xb7ab('0xa7'),'appdata':_0xb7ab('0xa8'),'interval':_0xb7ab('0xa9')});}_0x3840fb[_0xb7ab('0xa3')][_0xb7ab('0xa4')]=!![];}return db['WhatsappMessage'][_0xb7ab('0x56')]({'phone':_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x90')],'messageId':_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x93')],'body':_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x57')],'WhatsappAccountId':_0x567d28['params']['id'],'WhatsappInteractionId':_0x125fbd['id'],'direction':'in','ContactId':_0x125fbd['ContactId'],'AttachmentId':_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0xaa')]});})['then'](function(_0x5002bc){_0x3840fb[_0xb7ab('0x26')]=_0x5002bc;if(_0x3840fb['interaction']['UserId']){return db[_0xb7ab('0x71')][_0xb7ab('0x5c')]({'attributes':['id',_0xb7ab('0x37')],'where':{'id':_0x3840fb['interaction'][_0xb7ab('0xab')]}})[_0xb7ab('0x1f')](function(_0x3b68df){if(_0x3b68df){_0x3840fb[_0xb7ab('0x85')][_0xb7ab('0xac')]({'id':0x0,'priority':0x0,'app':_0xb7ab('0xad'),'appdata':_0x3b68df['name']+','+(_0x3840fb['account'][_0xb7ab('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb7ab('0xaf'),_0xb7ab('0xb0'),_0x3840fb);});}return respondWithRpcPromise(_0xb7ab('0xaf'),'startRouting',_0x3840fb);})['then'](function(_0xcff844){if(_0xcff844){var _0x423929=0xc8;var _0x3fdecb=_0xb7ab('0xb1');logger[_0xb7ab('0x20')](_0xb7ab('0xb2'),_0x3fdecb,_0x423929,_0xb7ab('0xb3'));logger[_0xb7ab('0xb4')](_0xb7ab('0xb5'),_0x3fdecb,_0x423929,_0xb7ab('0xb3'),JSON[_0xb7ab('0x23')](_0xcff844));if(_0x3840fb[_0xb7ab('0x80')]['type']==='twilio'){return _0xffb54f[_0xb7ab('0x29')](_0x423929)['set'](_0xb7ab('0xb6'),'text/xml')[_0xb7ab('0x38')](_0xb7ab('0xb7'));}else{return _0xffb54f[_0xb7ab('0x29')](_0x423929)['json'](_0xcff844);}}});})[_0xb7ab('0x28')](handleError(_0xffb54f,null));};exports[_0xb7ab('0x38')]=function(_0x11293b,_0x4eadd7,_0x3d4708){var _0xc60fca,_0x2601e8,_0x14370a;if(_[_0xb7ab('0x96')](_0x11293b[_0xb7ab('0x57')][_0xb7ab('0x57')])||_0x11293b['body'][_0xb7ab('0x57')]===''){throw new db[(_0xb7ab('0x8a'))][(_0xb7ab('0x97'))](_0xb7ab('0xb8'));}if(_[_0xb7ab('0x96')](_0x11293b[_0xb7ab('0x57')]['to'])){throw new db['Sequelize'][(_0xb7ab('0x97'))]('to\x20is\x20mandatory');}_0xc60fca=_0x11293b['body']['to'];return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x11293b[_0xb7ab('0x5d')]['id']},'include':[{'model':db[_0xb7ab('0xb9')],'as':_0xb7ab('0xba'),'include':[{'model':db['CmContact'],'as':_0xb7ab('0x9c'),'where':{'mobile':_0xc60fca},'limit':0x1,'order':[[_0xb7ab('0x8d'),_0xb7ab('0x9d')]]}]}]})[_0xb7ab('0x1f')](handleEntityNotFound(_0x4eadd7,null))[_0xb7ab('0x1f')](function(_0xa2fde6){if(_0xa2fde6&&_0xa2fde6[_0xb7ab('0xba')]){_0x2601e8=_0xa2fde6[_0xb7ab('0x32')]({'plain':!![]});if(_0x2601e8['List']&&_0x2601e8[_0xb7ab('0xba')]['Contacts'][_0xb7ab('0x46')]){return _0x2601e8[_0xb7ab('0xba')][_0xb7ab('0x9c')][0x0];}return db[_0xb7ab('0x88')][_0xb7ab('0x56')](_['defaults'](_0x11293b[_0xb7ab('0x57')],{'firstName':_0xc60fca,'mobile':_0xc60fca,'phone':_0xc60fca,'ListId':_0x2601e8[_0xb7ab('0x8f')]}));}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x4eadd7,null))['then'](function(_0x24072c){if(_0x24072c){_0x14370a=_0x24072c;return db[_0xb7ab('0xa2')]['find']({'where':{'ContactId':_0x14370a['id'],'closed':![],'WhatsappAccountId':_0x2601e8['id']}})[_0xb7ab('0x1f')](function(_0x190984){if(_0x190984){return[_0x190984,![]];}return db['WhatsappInteraction'][_0xb7ab('0x56')]({'UserId':_0x11293b['user']['id'],'ContactId':_0x14370a['id'],'WhatsappAccountId':_0x2601e8['id'],'phone':_0xc60fca,'firstMsgDirection':_0xb7ab('0xbb'),'Messages':[_[_0xb7ab('0x4e')](_0x11293b[_0xb7ab('0x57')],{'read':![],'body':_0x11293b[_0xb7ab('0x57')][_0xb7ab('0x57')],'phone':_0xc60fca,'WhatsappAccountId':_0x2601e8['id'],'UserId':_0x11293b[_0xb7ab('0x58')]['id'],'ContactId':_0x14370a['id']})]},{'include':[{'model':db[_0xb7ab('0x83')],'as':_0xb7ab('0xbc')}]})[_0xb7ab('0x1f')](function(_0x5aa89e){return[_0x5aa89e,!![]];});});}})[_0xb7ab('0x6a')](function(_0x3bd2cc,_0x161969){if(_0x161969){return _0x3bd2cc;}return db[_0xb7ab('0x83')][_0xb7ab('0x56')](_['merge'](_0x11293b[_0xb7ab('0x57')],{'read':![],'body':_0x11293b['body']['body'],'phone':_0xc60fca,'WhatsappAccountId':_0x2601e8['id'],'WhatsappInteractionId':_0x3bd2cc['id'],'UserId':_0x11293b[_0xb7ab('0x58')]['id'],'ContactId':_0x14370a['id']}))['then'](function(_0x35e8f9){_0x3bd2cc[_0xb7ab('0xbd')][_0xb7ab('0xbc')]=[];_0x3bd2cc[_0xb7ab('0xbd')][_0xb7ab('0xbc')][_0xb7ab('0xa6')](_0x35e8f9['dataValues']);return _0x3bd2cc;});})[_0xb7ab('0x1f')](respondWithResult(_0x4eadd7,null))['catch'](handleError(_0x4eadd7,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 16333ca..499f4ed 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 _0x993a=['remove','exports','../../mysqldb','WhatsappAccount','setMaxListeners','update'];(function(_0x2a2213,_0xcf1444){var _0x555842=function(_0x75734c){while(--_0x75734c){_0x2a2213['push'](_0x2a2213['shift']());}};_0x555842(++_0xcf1444);}(_0x993a,0xe0));var _0xa993=function(_0x577f93,_0x8570aa){_0x577f93=_0x577f93-0x0;var _0x34efaa=_0x993a[_0x577f93];return _0x34efaa;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xa993('0x0'))['db'][_0xa993('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa993('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa993('0x3'),'afterDestroy':_0xa993('0x4')};function emitEvent(_0x24b516){return function(_0x56fadc,_0x3b7b34,_0x5db4e0){WhatsappAccountEvents['emit'](_0x24b516+':'+_0x56fadc['id'],_0x56fadc);WhatsappAccountEvents['emit'](_0x24b516,_0x56fadc);_0x5db4e0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xa993('0x5')]=WhatsappAccountEvents; \ No newline at end of file +var _0x0910=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x0910,0x186));var _0x0091=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0910[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0091('0x0'));var WhatsappAccount=require(_0x0091('0x1'))['db'][_0x0091('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0091('0x3')](0x0);var events={'afterCreate':_0x0091('0x4'),'afterUpdate':_0x0091('0x5'),'afterDestroy':_0x0091('0x6')};function emitEvent(_0x5e47c8){return function(_0x539be0,_0x1ce02f,_0x2097eb){WhatsappAccountEvents[_0x0091('0x7')](_0x5e47c8+':'+_0x539be0['id'],_0x539be0);WhatsappAccountEvents[_0x0091('0x7')](_0x5e47c8,_0x539be0);_0x2097eb(null);};}for(var e in events){if(events[_0x0091('0x8')](e)){var event=events[e];WhatsappAccount[_0x0091('0x9')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 1fed877..c94a358 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 _0x4edc=['define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x5adf76,_0x33d495){var _0x44d8f9=function(_0x2b94ec){while(--_0x2b94ec){_0x5adf76['push'](_0x5adf76['shift']());}};_0x44d8f9(++_0x33d495);}(_0x4edc,0x1f1));var _0xc4ed=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x4edc[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0xc4ed('0x0'));var util=require(_0xc4ed('0x1'));var logger=require('../../config/logger')(_0xc4ed('0x2'));var moment=require(_0xc4ed('0x3'));var BPromise=require('bluebird');var rp=require(_0xc4ed('0x4'));var fs=require('fs');var path=require(_0xc4ed('0x5'));var rimraf=require(_0xc4ed('0x6'));var config=require(_0xc4ed('0x7'));var attributes=require(_0xc4ed('0x8'));module[_0xc4ed('0x9')]=function(_0x285c20,_0x579879){return _0x285c20[_0xc4ed('0xa')](_0xc4ed('0xb'),attributes,{'tableName':_0xc4ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5e3=['WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x4f58ce,_0x6cad20){var _0x4c7b91=function(_0x5464ea){while(--_0x5464ea){_0x4f58ce['push'](_0x4f58ce['shift']());}};_0x4c7b91(++_0x6cad20);}(_0xf5e3,0xb2));var _0x3f5e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xf5e3[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x3f5e('0x0'));var util=require('util');var logger=require(_0x3f5e('0x1'))(_0x3f5e('0x2'));var moment=require(_0x3f5e('0x3'));var BPromise=require(_0x3f5e('0x4'));var rp=require(_0x3f5e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3f5e('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x3f5e('0x7')]=function(_0x461db3,_0x4b677d){return _0x461db3[_0x3f5e('0x8')](_0x3f5e('0x9'),attributes,{'tableName':_0x3f5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 3f9536b..9f39b13 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 _0xfe4a=['options','raw','where','attributes','map','include','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowWhatsappAccount','find'];(function(_0x2ab61d,_0x4a2fe6){var _0x3d4308=function(_0x4b4054){while(--_0x4b4054){_0x2ab61d['push'](_0x2ab61d['shift']());}};_0x3d4308(++_0x4a2fe6);}(_0xfe4a,0x10b));var _0xafe4=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xfe4a[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xafe4('0x0'));var util=require(_0xafe4('0x1'));var moment=require(_0xafe4('0x2'));var BPromise=require(_0xafe4('0x3'));var rs=require(_0xafe4('0x4'));var fs=require('fs');var Redis=require(_0xafe4('0x5'));var db=require(_0xafe4('0x6'))['db'];var utils=require(_0xafe4('0x7'));var logger=require('../../config/logger')(_0xafe4('0x8'));var config=require(_0xafe4('0x9'));var jayson=require(_0xafe4('0xa'));var client=jayson[_0xafe4('0xb')]['http']({'port':0x232a});config[_0xafe4('0xc')]=_[_0xafe4('0xd')](config['redis'],{'host':_0xafe4('0xe'),'port':0x18eb});var socket=require(_0xafe4('0xf'))(new Redis(config[_0xafe4('0xc')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4bfe6d,_0xb53b6c,_0x4a671e){return new BPromise(function(_0x3363c4,_0x5bd58e){return client[_0xafe4('0x10')](_0x4bfe6d,_0x4a671e)[_0xafe4('0x11')](function(_0xf5c43b){logger[_0xafe4('0x12')](_0xafe4('0x13'),_0xb53b6c,_0xafe4('0x14'));logger['debug'](_0xafe4('0x15'),_0xb53b6c,_0xafe4('0x14'),JSON[_0xafe4('0x16')](_0xf5c43b));if(_0xf5c43b['error']){if(_0xf5c43b['error'][_0xafe4('0x17')]===0x1f4){logger[_0xafe4('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0xb53b6c,_0xf5c43b[_0xafe4('0x18')][_0xafe4('0x19')]);return _0x5bd58e(_0xf5c43b[_0xafe4('0x18')][_0xafe4('0x19')]);}logger['error'](_0xafe4('0x13'),_0xb53b6c,_0xf5c43b['error'][_0xafe4('0x19')]);return _0x3363c4(_0xf5c43b[_0xafe4('0x18')][_0xafe4('0x19')]);}else{logger['info'](_0xafe4('0x13'),_0xb53b6c,'request\x20sent');_0x3363c4(_0xf5c43b['result'][_0xafe4('0x19')]);}})[_0xafe4('0x1a')](function(_0x5c22b9){logger[_0xafe4('0x18')](_0xafe4('0x13'),_0xb53b6c,_0x5c22b9);_0x5bd58e(_0x5c22b9);});});}exports[_0xafe4('0x1b')]=function(_0x1d068a){var _0x3d736e=this;return new Promise(function(_0x4c2107,_0x300af5){return db['WhatsappAccount'][_0xafe4('0x1c')]({'raw':_0x1d068a[_0xafe4('0x1d')]?_0x1d068a['options'][_0xafe4('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d068a['options']?_0x1d068a[_0xafe4('0x1d')][_0xafe4('0x1f')]||null:null,'attributes':_0x1d068a['options']?_0x1d068a[_0xafe4('0x1d')][_0xafe4('0x20')]||null:null,'include':_0x1d068a['options']?_0x1d068a[_0xafe4('0x1d')]['include']?_[_0xafe4('0x21')](_0x1d068a[_0xafe4('0x1d')][_0xafe4('0x22')],function(_0x5830aa){return{'model':db[_0x5830aa[_0xafe4('0x23')]],'as':_0x5830aa['as'],'attributes':_0x5830aa[_0xafe4('0x20')],'include':_0x5830aa[_0xafe4('0x22')]?_['map'](_0x5830aa[_0xafe4('0x22')],function(_0x47ee7d){return{'model':db[_0x47ee7d['model']],'as':_0x47ee7d['as'],'attributes':_0x47ee7d[_0xafe4('0x20')],'include':_0x47ee7d[_0xafe4('0x22')]?_[_0xafe4('0x21')](_0x47ee7d[_0xafe4('0x22')],function(_0x84943a){return{'model':db[_0x84943a[_0xafe4('0x23')]],'as':_0x84943a['as'],'attributes':_0x84943a[_0xafe4('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58c36c){logger[_0xafe4('0x12')]('ShowWhatsappAccount',_0x1d068a);logger[_0xafe4('0x24')](_0xafe4('0x1b'),_0x1d068a,JSON[_0xafe4('0x16')](_0x58c36c));_0x4c2107(_0x58c36c);})[_0xafe4('0x1a')](function(_0x17ab7e){logger[_0xafe4('0x18')]('ShowWhatsappAccount',_0x17ab7e['message'],_0x1d068a);_0x300af5(_0x3d736e[_0xafe4('0x18')](0x1f4,_0x17ab7e[_0xafe4('0x19')]));});});}; \ No newline at end of file +var _0xd4ea=['WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1f3801,_0x20226a){var _0x28b32c=function(_0x38bc55){while(--_0x38bc55){_0x1f3801['push'](_0x1f3801['shift']());}};_0x28b32c(++_0x20226a);}(_0xd4ea,0xb4));var _0xad4e=function(_0x25217f,_0x3368bb){_0x25217f=_0x25217f-0x0;var _0x27bfbb=_0xd4ea[_0x25217f];return _0x27bfbb;};'use strict';var _=require(_0xad4e('0x0'));var util=require(_0xad4e('0x1'));var moment=require(_0xad4e('0x2'));var BPromise=require(_0xad4e('0x3'));var rs=require(_0xad4e('0x4'));var fs=require('fs');var Redis=require(_0xad4e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xad4e('0x6'));var logger=require(_0xad4e('0x7'))(_0xad4e('0x8'));var config=require(_0xad4e('0x9'));var jayson=require(_0xad4e('0xa'));var client=jayson[_0xad4e('0xb')][_0xad4e('0xc')]({'port':0x232a});config[_0xad4e('0xd')]=_[_0xad4e('0xe')](config[_0xad4e('0xd')],{'host':_0xad4e('0xf'),'port':0x18eb});var socket=require(_0xad4e('0x10'))(new Redis(config[_0xad4e('0xd')]));require('./whatsappAccount.socket')[_0xad4e('0x11')](socket);function respondWithRpcPromise(_0x38576f,_0x40d022,_0x4d0089){return new BPromise(function(_0x47989a,_0x1be0b1){return client['request'](_0x38576f,_0x4d0089)['then'](function(_0x219dd3){logger['info'](_0xad4e('0x12'),_0x40d022,_0xad4e('0x13'));logger['debug'](_0xad4e('0x14'),_0x40d022,_0xad4e('0x13'),JSON['stringify'](_0x219dd3));if(_0x219dd3[_0xad4e('0x15')]){if(_0x219dd3[_0xad4e('0x15')][_0xad4e('0x16')]===0x1f4){logger[_0xad4e('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x40d022,_0x219dd3[_0xad4e('0x15')][_0xad4e('0x17')]);return _0x1be0b1(_0x219dd3[_0xad4e('0x15')][_0xad4e('0x17')]);}logger['error'](_0xad4e('0x12'),_0x40d022,_0x219dd3[_0xad4e('0x15')][_0xad4e('0x17')]);return _0x47989a(_0x219dd3[_0xad4e('0x15')][_0xad4e('0x17')]);}else{logger[_0xad4e('0x18')](_0xad4e('0x12'),_0x40d022,_0xad4e('0x13'));_0x47989a(_0x219dd3[_0xad4e('0x19')][_0xad4e('0x17')]);}})[_0xad4e('0x1a')](function(_0x9bae50){logger[_0xad4e('0x15')](_0xad4e('0x12'),_0x40d022,_0x9bae50);_0x1be0b1(_0x9bae50);});});}exports[_0xad4e('0x1b')]=function(_0x28f53a){var _0x1aa015=this;return new Promise(function(_0x28ef41,_0xae4e22){return db[_0xad4e('0x1c')][_0xad4e('0x1d')]({'raw':_0x28f53a['options']?_0x28f53a[_0xad4e('0x1e')][_0xad4e('0x1f')]===undefined?!![]:![]:!![],'where':_0x28f53a[_0xad4e('0x1e')]?_0x28f53a[_0xad4e('0x1e')][_0xad4e('0x20')]||null:null,'attributes':_0x28f53a[_0xad4e('0x1e')]?_0x28f53a[_0xad4e('0x1e')][_0xad4e('0x21')]||null:null,'include':_0x28f53a[_0xad4e('0x1e')]?_0x28f53a[_0xad4e('0x1e')][_0xad4e('0x22')]?_[_0xad4e('0x23')](_0x28f53a[_0xad4e('0x1e')][_0xad4e('0x22')],function(_0xe548cb){return{'model':db[_0xe548cb[_0xad4e('0x24')]],'as':_0xe548cb['as'],'attributes':_0xe548cb[_0xad4e('0x21')],'include':_0xe548cb[_0xad4e('0x22')]?_[_0xad4e('0x23')](_0xe548cb[_0xad4e('0x22')],function(_0x8dc460){return{'model':db[_0x8dc460['model']],'as':_0x8dc460['as'],'attributes':_0x8dc460[_0xad4e('0x21')],'include':_0x8dc460[_0xad4e('0x22')]?_[_0xad4e('0x23')](_0x8dc460['include'],function(_0x669b56){return{'model':db[_0x669b56[_0xad4e('0x24')]],'as':_0x669b56['as'],'attributes':_0x669b56['attributes']};}):[]};}):[]};}):[]:[]})[_0xad4e('0x25')](function(_0x23e420){logger[_0xad4e('0x18')](_0xad4e('0x1b'),_0x28f53a);logger[_0xad4e('0x26')](_0xad4e('0x1b'),_0x28f53a,JSON[_0xad4e('0x27')](_0x23e420));_0x28ef41(_0x23e420);})['catch'](function(_0x325beb){logger[_0xad4e('0x15')](_0xad4e('0x1b'),_0x325beb[_0xad4e('0x17')],_0x28f53a);_0xae4e22(_0x1aa015[_0xad4e('0x15')](0x1f4,_0x325beb['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 6047834..93c232d 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 _0xe785=['update','emit','length','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe785,0x107));var _0x5e78=function(_0x4b288c,_0x4dea83){_0x4b288c=_0x4b288c-0x0;var _0x18e473=_0xe785[_0x4b288c];return _0x18e473;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x5e78('0x0'),_0x5e78('0x1'),_0x5e78('0x2')];function createListener(_0x1ddcc8,_0x43ba0a){return function(_0x1bb71b){_0x43ba0a[_0x5e78('0x3')](_0x1ddcc8,_0x1bb71b);};}function removeListener(_0x49ca32,_0x1f0a9b){return function(){WhatsappAccountEvents['removeListener'](_0x49ca32,_0x1f0a9b);};}exports['register']=function(_0x5f130c){for(var _0x1d31fc=0x0,_0x9671bb=events[_0x5e78('0x4')];_0x1d31fc<_0x9671bb;_0x1d31fc++){var _0x4a745e=events[_0x1d31fc];var _0x51c6f7=createListener('whatsappAccount:'+_0x4a745e,_0x5f130c);WhatsappAccountEvents['on'](_0x4a745e,_0x51c6f7);}}; \ No newline at end of file +var _0x475b=['./whatsappAccount.events','save','remove','emit','removeListener','register','length','whatsappAccount:'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x475b,0x1c8));var _0xb475=function(_0x5a31e2,_0x4a5ca2){_0x5a31e2=_0x5a31e2-0x0;var _0x15ef23=_0x475b[_0x5a31e2];return _0x15ef23;};'use strict';var WhatsappAccountEvents=require(_0xb475('0x0'));var events=[_0xb475('0x1'),_0xb475('0x2'),'update'];function createListener(_0x421d30,_0x328276){return function(_0x3923db){_0x328276[_0xb475('0x3')](_0x421d30,_0x3923db);};}function removeListener(_0x373e1c,_0x2f2829){return function(){WhatsappAccountEvents[_0xb475('0x4')](_0x373e1c,_0x2f2829);};}exports[_0xb475('0x5')]=function(_0x2a9609){for(var _0x1dc4ab=0x0,_0x255922=events[_0xb475('0x6')];_0x1dc4ab<_0x255922;_0x1dc4ab++){var _0x2b5b7f=events[_0x1dc4ab];var _0x71ffc6=createListener(_0xb475('0x7')+_0x2b5b7f,_0x2a9609);WhatsappAccountEvents['on'](_0x2b5b7f,_0x71ffc6);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index bdb5ecc..2c7c975 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 _0xeeee=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','util'];(function(_0x238f08,_0x17b2d6){var _0x306697=function(_0x28a705){while(--_0x28a705){_0x238f08['push'](_0x238f08['shift']());}};_0x306697(++_0x17b2d6);}(_0xeeee,0xdb));var _0xeeee=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xeeee[_0x313c96];return _0x522f53;};'use strict';var multer=require(_0xeeee('0x0'));var util=require(_0xeeee('0x1'));var path=require(_0xeeee('0x2'));var timeout=require(_0xeeee('0x3'));var express=require('express');var router=express[_0xeeee('0x4')]();var fs_extra=require(_0xeeee('0x5'));var auth=require(_0xeeee('0x6'));var interaction=require(_0xeeee('0x7'));var config=require('../../config/environment');var controller=require(_0xeeee('0x8'));router['get']('/',auth[_0xeeee('0x9')](),controller['index']);router['get'](_0xeeee('0xa'),auth['isAuthenticated'](),controller[_0xeeee('0xb')]);router[_0xeeee('0xc')]('/',auth[_0xeeee('0x9')](),controller['create']);router[_0xeeee('0xd')](_0xeeee('0xa'),auth[_0xeeee('0x9')](),controller['update']);router[_0xeeee('0xe')](_0xeeee('0xa'),auth[_0xeeee('0x9')](),controller[_0xeeee('0xf')]);module[_0xeeee('0x10')]=router; \ No newline at end of file +var _0x7372=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','index','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0x32cb17,_0x29f17b){var _0x2c0377=function(_0x3b9188){while(--_0x3b9188){_0x32cb17['push'](_0x32cb17['shift']());}};_0x2c0377(++_0x29f17b);}(_0x7372,0xee));var _0x2737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7372[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2737('0x0'));var timeout=require(_0x2737('0x1'));var express=require('express');var router=express[_0x2737('0x2')]();var fs_extra=require(_0x2737('0x3'));var auth=require(_0x2737('0x4'));var interaction=require(_0x2737('0x5'));var config=require('../../config/environment');var controller=require(_0x2737('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2737('0x7')]);router[_0x2737('0x8')](_0x2737('0x9'),auth[_0x2737('0xa')](),controller['show']);router['post']('/',auth[_0x2737('0xa')](),controller[_0x2737('0xb')]);router[_0x2737('0xc')](_0x2737('0x9'),auth['isAuthenticated'](),controller[_0x2737('0xd')]);router[_0x2737('0xe')](_0x2737('0x9'),auth[_0x2737('0xa')](),controller[_0x2737('0xf')]);module[_0x2737('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index d37350f..7ca106a 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 _0x603d=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x603d,0x14d));var _0xd603=function(_0x1e259c,_0x27c300){_0x1e259c=_0x1e259c-0x0;var _0x16d6e8=_0x603d[_0x1e259c];return _0x16d6e8;};'use strict';var Sequelize=require(_0xd603('0x0'));module[_0xd603('0x1')]={'priority':{'type':Sequelize[_0xd603('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd603('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd603('0x3')]},'interval':{'type':Sequelize[_0xd603('0x3')],'defaultValue':_0xd603('0x4')}}; \ No newline at end of file +var _0x8a61=['noop','TEXT','STRING','*,*,*,*','exports'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x8a61,0x9a));var _0x18a6=function(_0x1f9afb,_0x4e6f1b){_0x1f9afb=_0x1f9afb-0x0;var _0x456466=_0x8a61[_0x1f9afb];return _0x456466;};'use strict';var Sequelize=require('sequelize');module[_0x18a6('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x18a6('0x1')},'appdata':{'type':Sequelize[_0x18a6('0x2')]()},'description':{'type':Sequelize[_0x18a6('0x3')]},'interval':{'type':Sequelize[_0x18a6('0x3')],'defaultValue':_0x18a6('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index ea9fb05..b727b9f 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 _0xba38=['intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','includeAll','create','body','find','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','type','key','model','map','query','keys','filters','attributes'];(function(_0x45aa0c,_0x3b1092){var _0x51b6a5=function(_0x54b824){while(--_0x54b824){_0x45aa0c['push'](_0x45aa0c['shift']());}};_0x51b6a5(++_0x3b1092);}(_0xba38,0x190));var _0x8ba3=function(_0x18a0ba,_0x5b3be9){_0x18a0ba=_0x18a0ba-0x0;var _0xd43374=_0xba38[_0x18a0ba];return _0xd43374;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ba3('0x0'));var zipdir=require(_0x8ba3('0x1'));var jsonpatch=require(_0x8ba3('0x2'));var rp=require('request-promise');var moment=require(_0x8ba3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8ba3('0x4'));var util=require(_0x8ba3('0x5'));var path=require(_0x8ba3('0x6'));var sox=require(_0x8ba3('0x7'));var csv=require(_0x8ba3('0x8'));var ejs=require(_0x8ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x8ba3('0xa'));var _=require(_0x8ba3('0xb'));var squel=require(_0x8ba3('0xc'));var crypto=require(_0x8ba3('0xd'));var jsforce=require(_0x8ba3('0xe'));var deskjs=require(_0x8ba3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8ba3('0x10'));var Papa=require(_0x8ba3('0x11'));var Redis=require('ioredis');var authService=require(_0x8ba3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8ba3('0x13'));var hardwareService=require(_0x8ba3('0x14'));var logger=require(_0x8ba3('0x15'))(_0x8ba3('0x16'));var utils=require(_0x8ba3('0x17'));var config=require(_0x8ba3('0x18'));var licenseUtil=require(_0x8ba3('0x19'));var db=require(_0x8ba3('0x1a'))['db'];function respondWithStatusCode(_0x923aa5,_0x5c8f5b){_0x5c8f5b=_0x5c8f5b||0xcc;return function(_0x1abd6e){if(_0x1abd6e){return _0x923aa5[_0x8ba3('0x1b')](_0x5c8f5b);}return _0x923aa5['status'](_0x5c8f5b)[_0x8ba3('0x1c')]();};}function respondWithResult(_0x4ef1d5,_0x859934){_0x859934=_0x859934||0xc8;return function(_0x59764d){if(_0x59764d){return _0x4ef1d5[_0x8ba3('0x1d')](_0x859934)[_0x8ba3('0x1e')](_0x59764d);}};}function respondWithFilteredResult(_0x57f76d,_0x2842b9){return function(_0x417960){if(_0x417960){var _0x48577c=typeof _0x2842b9[_0x8ba3('0x1f')]===_0x8ba3('0x20')&&typeof _0x2842b9['limit']==='undefined';var _0x47020f=_0x417960['count'];var _0x5a8f04=_0x48577c?0x0:_0x2842b9[_0x8ba3('0x1f')];var _0x563d61=_0x48577c?_0x417960['count']:_0x2842b9[_0x8ba3('0x1f')]+_0x2842b9['limit'];var _0x118c50;if(_0x563d61>=_0x47020f){_0x563d61=_0x47020f;_0x118c50=0xc8;}else{_0x118c50=0xce;}_0x57f76d['status'](_0x118c50);return _0x57f76d[_0x8ba3('0x21')](_0x8ba3('0x22'),_0x5a8f04+'-'+_0x563d61+'/'+_0x47020f)[_0x8ba3('0x1e')](_0x417960);}return null;};}function patchUpdates(_0x5bd852){return function(_0x1a8d6b){try{jsonpatch[_0x8ba3('0x23')](_0x1a8d6b,_0x5bd852,!![]);}catch(_0x2f264d){return BPromise[_0x8ba3('0x24')](_0x2f264d);}return _0x1a8d6b[_0x8ba3('0x25')]();};}function saveUpdates(_0x4a3a50,_0x581daa){return function(_0xb15432){if(_0xb15432){return _0xb15432[_0x8ba3('0x26')](_0x4a3a50)[_0x8ba3('0x27')](function(_0x11e3e7){return _0x11e3e7;});}return null;};}function removeEntity(_0x57f037,_0x543021){return function(_0x10f3e2){if(_0x10f3e2){return _0x10f3e2[_0x8ba3('0x28')]()[_0x8ba3('0x27')](function(){_0x57f037[_0x8ba3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x199ad6,_0x56a391){return function(_0x2f253f){if(!_0x2f253f){_0x199ad6[_0x8ba3('0x1b')](0x194);}return _0x2f253f;};}function handleError(_0x80347a,_0x8b2237){_0x8b2237=_0x8b2237||0x1f4;return function(_0x43e306){logger[_0x8ba3('0x29')](_0x43e306[_0x8ba3('0x2a')]);if(_0x43e306[_0x8ba3('0x2b')]){delete _0x43e306[_0x8ba3('0x2b')];}_0x80347a[_0x8ba3('0x1d')](_0x8b2237)[_0x8ba3('0x2c')](_0x43e306);};}exports[_0x8ba3('0x2d')]=function(_0x16d189,_0x2df77c){var _0x309a89={},_0xee2109={},_0x148aac={'count':0x0,'rows':[]};var _0x4570d3=_['map'](db[_0x8ba3('0x2e')][_0x8ba3('0x2f')],function(_0x4f3b2b){return{'name':_0x4f3b2b['fieldName'],'type':_0x4f3b2b[_0x8ba3('0x30')][_0x8ba3('0x31')]};});_0xee2109[_0x8ba3('0x32')]=_[_0x8ba3('0x33')](_0x4570d3,_0x8ba3('0x2b'));_0xee2109[_0x8ba3('0x34')]=_[_0x8ba3('0x35')](_0x16d189[_0x8ba3('0x34')]);_0xee2109[_0x8ba3('0x36')]=_['intersection'](_0xee2109[_0x8ba3('0x32')],_0xee2109[_0x8ba3('0x34')]);_0x309a89[_0x8ba3('0x37')]=_[_0x8ba3('0x38')](_0xee2109[_0x8ba3('0x32')],qs[_0x8ba3('0x39')](_0x16d189[_0x8ba3('0x34')]['fields']));_0x309a89['attributes']=_0x309a89[_0x8ba3('0x37')][_0x8ba3('0x3a')]?_0x309a89[_0x8ba3('0x37')]:_0xee2109[_0x8ba3('0x32')];if(!_0x16d189['query']['hasOwnProperty'](_0x8ba3('0x3b'))){_0x309a89['limit']=qs['limit'](_0x16d189[_0x8ba3('0x34')]['limit']);_0x309a89[_0x8ba3('0x1f')]=qs[_0x8ba3('0x1f')](_0x16d189['query'][_0x8ba3('0x1f')]);}_0x309a89[_0x8ba3('0x3c')]=qs[_0x8ba3('0x3d')](_0x16d189[_0x8ba3('0x34')][_0x8ba3('0x3d')]);_0x309a89[_0x8ba3('0x3e')]=qs[_0x8ba3('0x36')](_[_0x8ba3('0x3f')](_0x16d189[_0x8ba3('0x34')],_0xee2109[_0x8ba3('0x36')]),_0x4570d3);if(_0x16d189[_0x8ba3('0x34')][_0x8ba3('0x40')]){_0x309a89['where']=_[_0x8ba3('0x41')](_0x309a89[_0x8ba3('0x3e')],{'$or':_[_0x8ba3('0x33')](_0x4570d3,function(_0x2ae0ae){if(_0x2ae0ae[_0x8ba3('0x30')]!==_0x8ba3('0x42')){var _0x3d1b84={};_0x3d1b84[_0x2ae0ae[_0x8ba3('0x2b')]]={'$like':'%'+_0x16d189[_0x8ba3('0x34')][_0x8ba3('0x40')]+'%'};return _0x3d1b84;}})});}_0x309a89=_[_0x8ba3('0x41')]({},_0x309a89,_0x16d189[_0x8ba3('0x43')]);var _0x497d1f={'where':_0x309a89[_0x8ba3('0x3e')]};return db['WhatsappApplication']['count'](_0x497d1f)[_0x8ba3('0x27')](function(_0x47870b){_0x148aac['count']=_0x47870b;if(_0x16d189['query']['includeAll']){_0x309a89[_0x8ba3('0x44')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x309a89);})[_0x8ba3('0x27')](function(_0x4883b7){_0x148aac[_0x8ba3('0x45')]=_0x4883b7;return _0x148aac;})[_0x8ba3('0x27')](respondWithFilteredResult(_0x2df77c,_0x309a89))[_0x8ba3('0x46')](handleError(_0x2df77c,null));};exports['show']=function(_0x5d979d,_0x5cb74a){var _0x4f524d={'raw':!![],'where':{'id':_0x5d979d[_0x8ba3('0x47')]['id']}},_0x31f5c8={};_0x31f5c8[_0x8ba3('0x32')]=_['keys'](db[_0x8ba3('0x2e')][_0x8ba3('0x2f')]);_0x31f5c8['query']=_[_0x8ba3('0x35')](_0x5d979d[_0x8ba3('0x34')]);_0x31f5c8[_0x8ba3('0x36')]=_['intersection'](_0x31f5c8[_0x8ba3('0x32')],_0x31f5c8[_0x8ba3('0x34')]);_0x4f524d[_0x8ba3('0x37')]=_['intersection'](_0x31f5c8[_0x8ba3('0x32')],qs['fields'](_0x5d979d[_0x8ba3('0x34')][_0x8ba3('0x39')]));_0x4f524d[_0x8ba3('0x37')]=_0x4f524d[_0x8ba3('0x37')][_0x8ba3('0x3a')]?_0x4f524d['attributes']:_0x31f5c8[_0x8ba3('0x32')];if(_0x5d979d['query'][_0x8ba3('0x48')]){_0x4f524d['include']=[{'all':!![]}];}_0x4f524d=_['merge']({},_0x4f524d,_0x5d979d['options']);return db[_0x8ba3('0x2e')]['find'](_0x4f524d)[_0x8ba3('0x27')](handleEntityNotFound(_0x5cb74a,null))[_0x8ba3('0x27')](respondWithResult(_0x5cb74a,null))[_0x8ba3('0x46')](handleError(_0x5cb74a,null));};exports[_0x8ba3('0x49')]=function(_0x2620cd,_0x211933){return db[_0x8ba3('0x2e')][_0x8ba3('0x49')](_0x2620cd['body'],{})[_0x8ba3('0x27')](respondWithResult(_0x211933,0xc9))[_0x8ba3('0x46')](handleError(_0x211933,null));};exports[_0x8ba3('0x26')]=function(_0x4c5571,_0x5b7671){if(_0x4c5571[_0x8ba3('0x4a')]['id']){delete _0x4c5571[_0x8ba3('0x4a')]['id'];}return db[_0x8ba3('0x2e')][_0x8ba3('0x4b')]({'where':{'id':_0x4c5571['params']['id']}})[_0x8ba3('0x27')](handleEntityNotFound(_0x5b7671,null))[_0x8ba3('0x27')](saveUpdates(_0x4c5571[_0x8ba3('0x4a')],null))['then'](respondWithResult(_0x5b7671,null))[_0x8ba3('0x46')](handleError(_0x5b7671,null));};exports[_0x8ba3('0x28')]=function(_0x30d962,_0x2ab289){return db[_0x8ba3('0x2e')][_0x8ba3('0x4b')]({'where':{'id':_0x30d962[_0x8ba3('0x47')]['id']}})['then'](handleEntityNotFound(_0x2ab289,null))[_0x8ba3('0x27')](removeEntity(_0x2ab289,null))[_0x8ba3('0x46')](handleError(_0x2ab289,null));}; \ No newline at end of file +var _0x4f7a=['update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','WhatsappApplication','findAll','rows','catch','show','params','intersection','find','create','body','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save'];(function(_0x1ab32e,_0x4fecb8){var _0x38fe19=function(_0x4698e8){while(--_0x4698e8){_0x1ab32e['push'](_0x1ab32e['shift']());}};_0x38fe19(++_0x4fecb8);}(_0x4f7a,0x105));var _0xa4f7=function(_0x41461f,_0x2c2dd3){_0x41461f=_0x41461f-0x0;var _0x550ee5=_0x4f7a[_0x41461f];return _0x550ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa4f7('0x0'));var jsonpatch=require(_0xa4f7('0x1'));var rp=require(_0xa4f7('0x2'));var moment=require('moment');var BPromise=require(_0xa4f7('0x3'));var Mustache=require('mustache');var util=require(_0xa4f7('0x4'));var path=require(_0xa4f7('0x5'));var sox=require(_0xa4f7('0x6'));var csv=require('to-csv');var ejs=require(_0xa4f7('0x7'));var fs=require('fs');var fs_extra=require(_0xa4f7('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa4f7('0x9'));var jsforce=require(_0xa4f7('0xa'));var deskjs=require(_0xa4f7('0xb'));var toCsv=require(_0xa4f7('0xc'));var querystring=require(_0xa4f7('0xd'));var Papa=require('papaparse');var Redis=require(_0xa4f7('0xe'));var authService=require(_0xa4f7('0xf'));var qs=require(_0xa4f7('0x10'));var as=require(_0xa4f7('0x11'));var hardwareService=require(_0xa4f7('0x12'));var logger=require(_0xa4f7('0x13'))(_0xa4f7('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa4f7('0x15'));var db=require(_0xa4f7('0x16'))['db'];function respondWithStatusCode(_0x4a8cf9,_0x14e435){_0x14e435=_0x14e435||0xcc;return function(_0x2dd3d2){if(_0x2dd3d2){return _0x4a8cf9[_0xa4f7('0x17')](_0x14e435);}return _0x4a8cf9['status'](_0x14e435)[_0xa4f7('0x18')]();};}function respondWithResult(_0x321bd7,_0x3666c8){_0x3666c8=_0x3666c8||0xc8;return function(_0x593304){if(_0x593304){return _0x321bd7[_0xa4f7('0x19')](_0x3666c8)[_0xa4f7('0x1a')](_0x593304);}};}function respondWithFilteredResult(_0x2a255f,_0x39d437){return function(_0x492500){if(_0x492500){var _0x3e9fc7=typeof _0x39d437[_0xa4f7('0x1b')]==='undefined'&&typeof _0x39d437['limit']===_0xa4f7('0x1c');var _0x4b4111=_0x492500[_0xa4f7('0x1d')];var _0x44e119=_0x3e9fc7?0x0:_0x39d437['offset'];var _0x1cba51=_0x3e9fc7?_0x492500['count']:_0x39d437[_0xa4f7('0x1b')]+_0x39d437[_0xa4f7('0x1e')];var _0x10b16a;if(_0x1cba51>=_0x4b4111){_0x1cba51=_0x4b4111;_0x10b16a=0xc8;}else{_0x10b16a=0xce;}_0x2a255f[_0xa4f7('0x19')](_0x10b16a);return _0x2a255f[_0xa4f7('0x1f')](_0xa4f7('0x20'),_0x44e119+'-'+_0x1cba51+'/'+_0x4b4111)['json'](_0x492500);}return null;};}function patchUpdates(_0x18bb7a){return function(_0x2ffd9a){try{jsonpatch[_0xa4f7('0x21')](_0x2ffd9a,_0x18bb7a,!![]);}catch(_0x33ef47){return BPromise['reject'](_0x33ef47);}return _0x2ffd9a[_0xa4f7('0x22')]();};}function saveUpdates(_0x392312,_0x3bee6b){return function(_0x1a027c){if(_0x1a027c){return _0x1a027c[_0xa4f7('0x23')](_0x392312)[_0xa4f7('0x24')](function(_0x2a59b4){return _0x2a59b4;});}return null;};}function removeEntity(_0xdbc437,_0x16a342){return function(_0x1201ee){if(_0x1201ee){return _0x1201ee[_0xa4f7('0x25')]()[_0xa4f7('0x24')](function(){_0xdbc437['status'](0xcc)[_0xa4f7('0x18')]();});}};}function handleEntityNotFound(_0x18b3c7,_0x19a20d){return function(_0x2b56fe){if(!_0x2b56fe){_0x18b3c7[_0xa4f7('0x17')](0x194);}return _0x2b56fe;};}function handleError(_0x5c6122,_0x5f1480){_0x5f1480=_0x5f1480||0x1f4;return function(_0x4afd1d){logger[_0xa4f7('0x26')](_0x4afd1d['stack']);if(_0x4afd1d[_0xa4f7('0x27')]){delete _0x4afd1d[_0xa4f7('0x27')];}_0x5c6122[_0xa4f7('0x19')](_0x5f1480)['send'](_0x4afd1d);};}exports[_0xa4f7('0x28')]=function(_0x5366dc,_0x858aa){var _0x513a41={},_0x36704e={},_0x1009d2={'count':0x0,'rows':[]};var _0x24c64b=_[_0xa4f7('0x29')](db['WhatsappApplication'][_0xa4f7('0x2a')],function(_0x16c8b0){return{'name':_0x16c8b0[_0xa4f7('0x2b')],'type':_0x16c8b0[_0xa4f7('0x2c')][_0xa4f7('0x2d')]};});_0x36704e['model']=_[_0xa4f7('0x29')](_0x24c64b,_0xa4f7('0x27'));_0x36704e['query']=_[_0xa4f7('0x2e')](_0x5366dc[_0xa4f7('0x2f')]);_0x36704e[_0xa4f7('0x30')]=_['intersection'](_0x36704e[_0xa4f7('0x31')],_0x36704e[_0xa4f7('0x2f')]);_0x513a41['attributes']=_['intersection'](_0x36704e[_0xa4f7('0x31')],qs[_0xa4f7('0x32')](_0x5366dc[_0xa4f7('0x2f')]['fields']));_0x513a41[_0xa4f7('0x33')]=_0x513a41[_0xa4f7('0x33')][_0xa4f7('0x34')]?_0x513a41[_0xa4f7('0x33')]:_0x36704e[_0xa4f7('0x31')];if(!_0x5366dc[_0xa4f7('0x2f')][_0xa4f7('0x35')](_0xa4f7('0x36'))){_0x513a41[_0xa4f7('0x1e')]=qs['limit'](_0x5366dc[_0xa4f7('0x2f')][_0xa4f7('0x1e')]);_0x513a41[_0xa4f7('0x1b')]=qs[_0xa4f7('0x1b')](_0x5366dc[_0xa4f7('0x2f')][_0xa4f7('0x1b')]);}_0x513a41[_0xa4f7('0x37')]=qs[_0xa4f7('0x38')](_0x5366dc['query'][_0xa4f7('0x38')]);_0x513a41[_0xa4f7('0x39')]=qs['filters'](_['pick'](_0x5366dc[_0xa4f7('0x2f')],_0x36704e[_0xa4f7('0x30')]),_0x24c64b);if(_0x5366dc[_0xa4f7('0x2f')]['filter']){_0x513a41[_0xa4f7('0x39')]=_[_0xa4f7('0x3a')](_0x513a41[_0xa4f7('0x39')],{'$or':_[_0xa4f7('0x29')](_0x24c64b,function(_0x495142){if(_0x495142[_0xa4f7('0x2c')]!==_0xa4f7('0x3b')){var _0x1a5bd3={};_0x1a5bd3[_0x495142[_0xa4f7('0x27')]]={'$like':'%'+_0x5366dc[_0xa4f7('0x2f')][_0xa4f7('0x3c')]+'%'};return _0x1a5bd3;}})});}_0x513a41=_[_0xa4f7('0x3a')]({},_0x513a41,_0x5366dc[_0xa4f7('0x3d')]);var _0x3601f2={'where':_0x513a41[_0xa4f7('0x39')]};return db['WhatsappApplication']['count'](_0x3601f2)['then'](function(_0x22dfdd){_0x1009d2['count']=_0x22dfdd;if(_0x5366dc[_0xa4f7('0x2f')][_0xa4f7('0x3e')]){_0x513a41[_0xa4f7('0x3f')]=[{'all':!![]}];}return db[_0xa4f7('0x40')][_0xa4f7('0x41')](_0x513a41);})['then'](function(_0x1698f2){_0x1009d2[_0xa4f7('0x42')]=_0x1698f2;return _0x1009d2;})[_0xa4f7('0x24')](respondWithFilteredResult(_0x858aa,_0x513a41))[_0xa4f7('0x43')](handleError(_0x858aa,null));};exports[_0xa4f7('0x44')]=function(_0xc26958,_0x41ca2b){var _0x3ccb19={'raw':!![],'where':{'id':_0xc26958[_0xa4f7('0x45')]['id']}},_0x34192f={};_0x34192f['model']=_[_0xa4f7('0x2e')](db['WhatsappApplication']['rawAttributes']);_0x34192f[_0xa4f7('0x2f')]=_[_0xa4f7('0x2e')](_0xc26958[_0xa4f7('0x2f')]);_0x34192f[_0xa4f7('0x30')]=_[_0xa4f7('0x46')](_0x34192f['model'],_0x34192f[_0xa4f7('0x2f')]);_0x3ccb19[_0xa4f7('0x33')]=_[_0xa4f7('0x46')](_0x34192f[_0xa4f7('0x31')],qs[_0xa4f7('0x32')](_0xc26958['query'][_0xa4f7('0x32')]));_0x3ccb19[_0xa4f7('0x33')]=_0x3ccb19['attributes'][_0xa4f7('0x34')]?_0x3ccb19[_0xa4f7('0x33')]:_0x34192f[_0xa4f7('0x31')];if(_0xc26958['query']['includeAll']){_0x3ccb19[_0xa4f7('0x3f')]=[{'all':!![]}];}_0x3ccb19=_[_0xa4f7('0x3a')]({},_0x3ccb19,_0xc26958[_0xa4f7('0x3d')]);return db['WhatsappApplication'][_0xa4f7('0x47')](_0x3ccb19)[_0xa4f7('0x24')](handleEntityNotFound(_0x41ca2b,null))[_0xa4f7('0x24')](respondWithResult(_0x41ca2b,null))[_0xa4f7('0x43')](handleError(_0x41ca2b,null));};exports[_0xa4f7('0x48')]=function(_0x4f4171,_0x4cf939){return db[_0xa4f7('0x40')][_0xa4f7('0x48')](_0x4f4171['body'],{})['then'](respondWithResult(_0x4cf939,0xc9))[_0xa4f7('0x43')](handleError(_0x4cf939,null));};exports[_0xa4f7('0x23')]=function(_0x44e8a1,_0x1a4afb){if(_0x44e8a1[_0xa4f7('0x49')]['id']){delete _0x44e8a1[_0xa4f7('0x49')]['id'];}return db[_0xa4f7('0x40')][_0xa4f7('0x47')]({'where':{'id':_0x44e8a1[_0xa4f7('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a4afb,null))['then'](saveUpdates(_0x44e8a1['body'],null))[_0xa4f7('0x24')](respondWithResult(_0x1a4afb,null))[_0xa4f7('0x43')](handleError(_0x1a4afb,null));};exports[_0xa4f7('0x25')]=function(_0xf793c3,_0x1ea455){return db[_0xa4f7('0x40')][_0xa4f7('0x47')]({'where':{'id':_0xf793c3[_0xa4f7('0x45')]['id']}})[_0xa4f7('0x24')](handleEntityNotFound(_0x1ea455,null))['then'](removeEntity(_0x1ea455,null))['catch'](handleError(_0x1ea455,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5aabfb1..517edf9 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 _0xa631=['api','bluebird','rimraf','../../config/environment','./whatsappApplication.attributes','WhatsappApplication','whatsapp_applications','utf8mb4','util','../../config/logger'];(function(_0x36353c,_0x5d9055){var _0x15a748=function(_0x466d58){while(--_0x466d58){_0x36353c['push'](_0x36353c['shift']());}};_0x15a748(++_0x5d9055);}(_0xa631,0xe4));var _0x1a63=function(_0x7f9376,_0x12334b){_0x7f9376=_0x7f9376-0x0;var _0x1217e4=_0xa631[_0x7f9376];return _0x1217e4;};'use strict';var _=require('lodash');var util=require(_0x1a63('0x0'));var logger=require(_0x1a63('0x1'))(_0x1a63('0x2'));var moment=require('moment');var BPromise=require(_0x1a63('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1a63('0x4'));var config=require(_0x1a63('0x5'));var attributes=require(_0x1a63('0x6'));module['exports']=function(_0x51ff47,_0x5a2067){return _0x51ff47['define'](_0x1a63('0x7'),attributes,{'tableName':_0x1a63('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1a63('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x32ef=['WhatsappApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappApplication.attributes','exports','define'];(function(_0x39cff6,_0x4811ed){var _0x249019=function(_0x339e2f){while(--_0x339e2f){_0x39cff6['push'](_0x39cff6['shift']());}};_0x249019(++_0x4811ed);}(_0x32ef,0xf9));var _0xf32e=function(_0x5a86be,_0x43bede){_0x5a86be=_0x5a86be-0x0;var _0x59249b=_0x32ef[_0x5a86be];return _0x59249b;};'use strict';var _=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var logger=require(_0xf32e('0x2'))(_0xf32e('0x3'));var moment=require(_0xf32e('0x4'));var BPromise=require(_0xf32e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf32e('0x6'));var rimraf=require(_0xf32e('0x7'));var config=require('../../config/environment');var attributes=require(_0xf32e('0x8'));module[_0xf32e('0x9')]=function(_0x1a7d35,_0x1062c8){return _0x1a7d35[_0xf32e('0xa')](_0xf32e('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf32e('0xc'),'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 687cc7e..f1d55ef 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','WhatsappApplication,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x37c20c,_0x307ba5){var _0x4bb42c=function(_0x403e7b){while(--_0x403e7b){_0x37c20c['push'](_0x37c20c['shift']());}};_0x4bb42c(++_0x307ba5);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xd0bb=['debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x217eb1,_0x100654){var _0x326ad9=function(_0x56b6dd){while(--_0x56b6dd){_0x217eb1['push'](_0x217eb1['shift']());}};_0x326ad9(++_0x100654);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3a20ae,_0x3233b1){_0x3a20ae=_0x3a20ae-0x0;var _0x4a012d=_0xd0bb[_0x3a20ae];return _0x4a012d;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 72993e5..32d67a0 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 _0x8c46=['whatsappinteraction:addtags','addTags','update','delete','whatsapp','whatsappinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x3253f8,_0xfb50af){var _0x562c07=function(_0x1e9f49){while(--_0x1e9f49){_0x3253f8['push'](_0x3253f8['shift']());}};_0x562c07(++_0xfb50af);}(_0x8c46,0x171));var _0x68c4=function(_0x33cf66,_0x30e414){_0x33cf66=_0x33cf66-0x0;var _0x3a400b=_0x8c46[_0x33cf66];return _0x3a400b;};'use strict';var multer=require(_0x68c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x68c4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x68c4('0x2'));var auth=require(_0x68c4('0x3'));var interaction=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var controller=require(_0x68c4('0x6'));router[_0x68c4('0x7')]('/',auth[_0x68c4('0x8')](),controller[_0x68c4('0x9')]);router[_0x68c4('0x7')](_0x68c4('0xa'),auth['isAuthenticated'](),controller[_0x68c4('0xb')]);router[_0x68c4('0x7')](_0x68c4('0xc'),auth['isAuthenticated'](),controller[_0x68c4('0xd')]);router[_0x68c4('0x7')](_0x68c4('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0x68c4('0x7')](_0x68c4('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x68c4('0x10')]('/',auth[_0x68c4('0x8')](),controller[_0x68c4('0x11')]);router['post'](_0x68c4('0xe'),auth[_0x68c4('0x8')](),controller[_0x68c4('0x12')]);router['post'](_0x68c4('0x13'),auth[_0x68c4('0x8')](),interaction[_0x68c4('0x14')]('whatsapp',_0x68c4('0x15')),controller[_0x68c4('0x16')]);router['put'](_0x68c4('0xc'),auth['isAuthenticated'](),interaction[_0x68c4('0x14')]('whatsapp','whatsappinteraction:update'),controller[_0x68c4('0x17')]);router[_0x68c4('0x18')]('/:id',auth[_0x68c4('0x8')](),interaction[_0x68c4('0x14')](_0x68c4('0x19'),_0x68c4('0x1a')),controller[_0x68c4('0x1b')]);router[_0x68c4('0x18')](_0x68c4('0x13'),auth[_0x68c4('0x8')](),controller[_0x68c4('0x1c')]);module[_0x68c4('0x1d')]=router; \ No newline at end of file +var _0x9fd4=['../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0x9fd4,0x16c));var _0x49fd=function(_0x3480e9,_0x1ce980){_0x3480e9=_0x3480e9-0x0;var _0x389aad=_0x9fd4[_0x3480e9];return _0x389aad;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var fs_extra=require(_0x49fd('0x6'));var auth=require(_0x49fd('0x7'));var interaction=require(_0x49fd('0x8'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x49fd('0x9')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xb')]);router[_0x49fd('0x9')]('/describe',auth[_0x49fd('0xa')](),controller[_0x49fd('0xc')]);router[_0x49fd('0x9')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller['show']);router[_0x49fd('0x9')](_0x49fd('0xe'),auth[_0x49fd('0xa')](),controller[_0x49fd('0xf')]);router[_0x49fd('0x9')](_0x49fd('0x10'),auth[_0x49fd('0xa')](),controller['download']);router[_0x49fd('0x11')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0x12')]);router[_0x49fd('0x11')](_0x49fd('0xe'),auth[_0x49fd('0xa')](),controller[_0x49fd('0x13')]);router[_0x49fd('0x11')](_0x49fd('0x14'),auth[_0x49fd('0xa')](),interaction[_0x49fd('0x15')](_0x49fd('0x16'),_0x49fd('0x17')),controller[_0x49fd('0x18')]);router[_0x49fd('0x19')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),interaction[_0x49fd('0x15')](_0x49fd('0x16'),_0x49fd('0x1a')),controller[_0x49fd('0x1b')]);router[_0x49fd('0x1c')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),interaction[_0x49fd('0x15')](_0x49fd('0x16'),'whatsappinteraction:destroy'),controller[_0x49fd('0x1d')]);router[_0x49fd('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x49fd('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index f293d19..e9edc81 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 _0x6ec2=['ENUM','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0x6ec2,0x78));var _0x26ec=function(_0x38a507,_0x22abac){_0x38a507=_0x38a507-0x0;var _0x3fd3be=_0x6ec2[_0x38a507];return _0x3fd3be;};'use strict';var Sequelize=require(_0x26ec('0x0'));var moment=require(_0x26ec('0x1'));module[_0x26ec('0x2')]={'closed':{'type':Sequelize[_0x26ec('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x26ec('0x4')]},'disposition':{'type':Sequelize[_0x26ec('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x26ec('0x5')]},'note':{'type':Sequelize[_0x26ec('0x5')]},'phone':{'type':Sequelize[_0x26ec('0x5')]},'read1stAt':{'type':Sequelize[_0x26ec('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x26ec('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x26ec('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x26ec('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x29d4=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x3a05b5,_0x669384){var _0x1760a0=function(_0x1064a9){while(--_0x1064a9){_0x3a05b5['push'](_0x3a05b5['shift']());}};_0x1760a0(++_0x669384);}(_0x29d4,0x1a1));var _0x429d=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x29d4[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x429d('0x0'));var moment=require('moment');module[_0x429d('0x1')]={'closed':{'type':Sequelize[_0x429d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x429d('0x3')]},'disposition':{'type':Sequelize[_0x429d('0x4')]},'secondDisposition':{'type':Sequelize[_0x429d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x429d('0x4')]},'phone':{'type':Sequelize[_0x429d('0x4')]},'read1stAt':{'type':Sequelize[_0x429d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x429d('0x5')]('in',_0x429d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x429d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x429d('0x5')]('in',_0x429d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 441f95b..92ccb7b 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 _0x91ab=['push','fullname','CmContact','Contact','lastName','Messages','createdAt','secret','WhatsappAccount','User','Owner','get','mkdirSync','Whatsapp','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','Attachment','basename','createReadStream','pipe','direction','System','firstName','out','read','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','rimraf','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','whatsapp','query','user','catch','params','model','filters','intersection','attributes','length','includeAll','include','options','find','create','body','describe','addMessage','WhatsappMessage','omit','getMessages','keys','fields','hasOwnProperty','nolimit','limit','order','sort','where','WhatsappInteractionId','filter','merge','$gte','findAll','rows','addTags','ids','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','format'];(function(_0x3421f8,_0x3e5d70){var _0x2d4e8a=function(_0x404bd5){while(--_0x404bd5){_0x3421f8['push'](_0x3421f8['shift']());}};_0x2d4e8a(++_0x3e5d70);}(_0x91ab,0x194));var _0xb91a=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x91ab[_0xe66cf2];return _0x2d84e7;};'use strict';var rimraf=require(_0xb91a('0x0'));var zipdir=require('zip-dir');var moment=require(_0xb91a('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xb91a('0x2'));var ejs=require(_0xb91a('0x3'));var fs=require('fs');var _=require(_0xb91a('0x4'));var Redis=require(_0xb91a('0x5'));var interaction=require(_0xb91a('0x6'));var qs=require(_0xb91a('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xb91a('0x8'))('api');var config=require(_0xb91a('0x9'));var db=require(_0xb91a('0xa'))['db'];config['redis']=_[_0xb91a('0xb')](config['redis'],{'host':_0xb91a('0xc'),'port':0x18eb});var socket=require(_0xb91a('0xd'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xb91a('0xe')](socket);function respondWithStatusCode(_0x5350fa,_0x36152f){_0x36152f=_0x36152f||0xcc;return function(_0x2e1121){if(_0x2e1121){return _0x5350fa[_0xb91a('0xf')](_0x36152f);}return _0x5350fa[_0xb91a('0x10')](_0x36152f)['end']();};}function respondWithResult(_0x4407b7,_0x137cb2){_0x137cb2=_0x137cb2||0xc8;return function(_0x26214c){if(_0x26214c){return _0x4407b7[_0xb91a('0x10')](_0x137cb2)[_0xb91a('0x11')](_0x26214c);}};}function respondWithFilteredResult(_0x3d2cda,_0x1eb3ea){return function(_0x56e409){if(_0x56e409){var _0x38f46e=typeof _0x1eb3ea[_0xb91a('0x12')]===_0xb91a('0x13')&&typeof _0x1eb3ea['limit']===_0xb91a('0x13');var _0xdcb89c=_0x56e409[_0xb91a('0x14')];var _0x8ac259=_0x38f46e?0x0:_0x1eb3ea[_0xb91a('0x12')];var _0x4aea37=_0x38f46e?_0x56e409[_0xb91a('0x14')]:_0x1eb3ea[_0xb91a('0x12')]+_0x1eb3ea['limit'];var _0x16f943;if(_0x4aea37>=_0xdcb89c){_0x4aea37=_0xdcb89c;_0x16f943=0xc8;}else{_0x16f943=0xce;}_0x3d2cda[_0xb91a('0x10')](_0x16f943);return _0x3d2cda[_0xb91a('0x15')](_0xb91a('0x16'),_0x8ac259+'-'+_0x4aea37+'/'+_0xdcb89c)[_0xb91a('0x11')](_0x56e409);}return null;};}function saveUpdates(_0x447df9){return function(_0x19caaf){if(_0x19caaf){return _0x19caaf[_0xb91a('0x17')](_0x447df9)[_0xb91a('0x18')](function(_0x52c4cb){return _0x52c4cb;});}return null;};}function removeEntity(_0x32c20f){return function(_0x216d73){if(_0x216d73){return _0x216d73[_0xb91a('0x19')]()[_0xb91a('0x18')](function(){_0x32c20f[_0xb91a('0x10')](0xcc)[_0xb91a('0x1a')]();});}};}function handleEntityNotFound(_0x5051f9){return function(_0x3d5d27){if(!_0x3d5d27){_0x5051f9[_0xb91a('0xf')](0x194);}return _0x3d5d27;};}function handleError(_0x418b69,_0x14433a){_0x14433a=_0x14433a||0x1f4;return function(_0x50b920){logger[_0xb91a('0x1b')](_0x50b920[_0xb91a('0x1c')]);if(_0x50b920[_0xb91a('0x1d')]){delete _0x50b920['name'];}_0x418b69[_0xb91a('0x10')](_0x14433a)[_0xb91a('0x1e')](_0x50b920);};}exports[_0xb91a('0x1f')]=function(_0x3f2299,_0x18343e){var _0x5f5059={};var _0x4a53a3=_[_0xb91a('0x20')](db[_0xb91a('0x21')][_0xb91a('0x22')],function(_0x182c75){return{'name':_0x182c75[_0xb91a('0x23')],'type':_0x182c75[_0xb91a('0x24')][_0xb91a('0x25')]};});_0x5f5059=qs[_0xb91a('0x26')](_0x4a53a3,_0x3f2299);return interaction['findAll'](_0xb91a('0x27'),_0x3f2299[_0xb91a('0x28')],_0x3f2299[_0xb91a('0x29')],_0x5f5059,_0x4a53a3)[_0xb91a('0x18')](respondWithFilteredResult(_0x18343e,_0x5f5059))[_0xb91a('0x2a')](handleError(_0x18343e,null));};exports['show']=function(_0x2a453b,_0x39afdf){var _0xa99686={'raw':![],'where':{'id':_0x2a453b[_0xb91a('0x2b')]['id']}},_0x205353={};_0x205353[_0xb91a('0x2c')]=_['keys'](db[_0xb91a('0x21')][_0xb91a('0x22')]);_0x205353[_0xb91a('0x28')]=_['keys'](_0x2a453b['query']);_0x205353[_0xb91a('0x2d')]=_[_0xb91a('0x2e')](_0x205353[_0xb91a('0x2c')],_0x205353[_0xb91a('0x28')]);_0xa99686['attributes']=_['intersection'](_0x205353['model'],qs['fields'](_0x2a453b['query']['fields']));_0xa99686[_0xb91a('0x2f')]=_0xa99686[_0xb91a('0x2f')][_0xb91a('0x30')]?_0xa99686['attributes']:_0x205353[_0xb91a('0x2c')];if(_0x2a453b[_0xb91a('0x28')][_0xb91a('0x31')]){_0xa99686[_0xb91a('0x32')]=[{'all':!![]}];}_0xa99686=_['merge']({},_0xa99686,_0x2a453b[_0xb91a('0x33')]);return db[_0xb91a('0x21')][_0xb91a('0x34')](_0xa99686)[_0xb91a('0x18')](handleEntityNotFound(_0x39afdf,null))['then'](respondWithResult(_0x39afdf,null))['catch'](handleError(_0x39afdf,null));};exports[_0xb91a('0x35')]=function(_0x3faa81,_0x16ae20){return db[_0xb91a('0x21')]['create'](_0x3faa81[_0xb91a('0x36')],{})[_0xb91a('0x18')](respondWithResult(_0x16ae20,0xc9))[_0xb91a('0x2a')](handleError(_0x16ae20,null));};exports[_0xb91a('0x17')]=function(_0x592463,_0x19fa0e){if(_0x592463[_0xb91a('0x36')]['id']){delete _0x592463[_0xb91a('0x36')]['id'];}return db['WhatsappInteraction'][_0xb91a('0x34')]({'where':{'id':_0x592463[_0xb91a('0x2b')]['id']}})[_0xb91a('0x18')](handleEntityNotFound(_0x19fa0e,null))[_0xb91a('0x18')](saveUpdates(_0x592463[_0xb91a('0x36')],null))[_0xb91a('0x18')](respondWithResult(_0x19fa0e,null))[_0xb91a('0x2a')](handleError(_0x19fa0e,null));};exports[_0xb91a('0x19')]=function(_0x1c4736,_0x2b716e){return db['WhatsappInteraction']['find']({'where':{'id':_0x1c4736['params']['id']}})[_0xb91a('0x18')](handleEntityNotFound(_0x2b716e,null))['then'](removeEntity(_0x2b716e,null))[_0xb91a('0x2a')](handleError(_0x2b716e,null));};exports['describe']=function(_0x2e674c,_0x2a3c2f){return db[_0xb91a('0x21')][_0xb91a('0x37')]()[_0xb91a('0x18')](respondWithResult(_0x2a3c2f,null))[_0xb91a('0x2a')](handleError(_0x2a3c2f,null));};exports[_0xb91a('0x38')]=function(_0x53401d,_0x10e075){return db[_0xb91a('0x39')][_0xb91a('0x34')]({'where':{'id':_0x53401d[_0xb91a('0x2b')]['id']}})['then'](handleEntityNotFound(_0x10e075,null))[_0xb91a('0x18')](function(_0x6c241){if(_0x6c241){return _0x6c241['addMessage'](_0x53401d[_0xb91a('0x36')]['ids'],_[_0xb91a('0x3a')](_0x53401d[_0xb91a('0x36')],['ids','id'])||{});}})[_0xb91a('0x18')](respondWithResult(_0x10e075,null))[_0xb91a('0x2a')](handleError(_0x10e075,null));};exports[_0xb91a('0x3b')]=function(_0x488919,_0x50d1e7){var _0x2d0f7f={'raw':![],'where':{}};var _0x57192c={};var _0x2a213b={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x488919['params']['id']}})[_0xb91a('0x18')](handleEntityNotFound(_0x50d1e7,null))[_0xb91a('0x18')](function(_0x35c380){if(_0x35c380){_0x57192c[_0xb91a('0x2c')]=_[_0xb91a('0x3c')](db['WhatsappMessage'][_0xb91a('0x22')]);_0x57192c[_0xb91a('0x28')]=_['keys'](_0x488919[_0xb91a('0x28')]);_0x57192c[_0xb91a('0x2d')]=_[_0xb91a('0x2e')](_0x57192c[_0xb91a('0x2c')],_0x57192c[_0xb91a('0x28')]);_0x2d0f7f[_0xb91a('0x2f')]=_['intersection'](_0x57192c[_0xb91a('0x2c')],qs['fields'](_0x488919[_0xb91a('0x28')][_0xb91a('0x3d')]));_0x2d0f7f[_0xb91a('0x2f')]=_0x2d0f7f[_0xb91a('0x2f')][_0xb91a('0x30')]?_0x2d0f7f[_0xb91a('0x2f')]:_0x57192c[_0xb91a('0x2c')];if(!_0x488919[_0xb91a('0x28')][_0xb91a('0x3e')](_0xb91a('0x3f'))){_0x2d0f7f[_0xb91a('0x40')]=qs['limit'](_0x488919[_0xb91a('0x28')]['limit']);_0x2d0f7f[_0xb91a('0x12')]=qs['offset'](_0x488919[_0xb91a('0x28')][_0xb91a('0x12')]);}_0x2d0f7f[_0xb91a('0x41')]=qs[_0xb91a('0x42')](_0x488919[_0xb91a('0x28')][_0xb91a('0x42')]);_0x2d0f7f['where']=qs[_0xb91a('0x2d')](_['pick'](_0x488919[_0xb91a('0x28')],_0x57192c[_0xb91a('0x2d')]));_0x2d0f7f[_0xb91a('0x43')][_0xb91a('0x44')]=_0x35c380['id'];if(_0x488919['query'][_0xb91a('0x45')]){_0x2d0f7f[_0xb91a('0x43')]=_[_0xb91a('0x46')](_0x2d0f7f['where'],{'$or':_[_0xb91a('0x20')](_0x2d0f7f['attributes'],function(_0x3040b0){var _0x511b08={};_0x511b08[_0x3040b0]={'$like':'%'+_0x488919[_0xb91a('0x28')][_0xb91a('0x45')]+'%'};return _0x511b08;})});}if(_0x488919['query']['$gte']){var _0x544c2d=_0x488919[_0xb91a('0x28')][_0xb91a('0x47')]['split'](',');var _0x4c3192={};_0x4c3192[_0x544c2d[0x0]]={'$gte':moment(_0x544c2d[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2d0f7f['where']=_['merge'](_0x2d0f7f['where'],_0x4c3192);}_0x2d0f7f=_[_0xb91a('0x46')]({},_0x2d0f7f,_0x488919[_0xb91a('0x33')]);return db[_0xb91a('0x39')][_0xb91a('0x14')]({'where':_0x2d0f7f[_0xb91a('0x43')]})[_0xb91a('0x18')](function(_0x1e6edb){_0x2a213b[_0xb91a('0x14')]=_0x1e6edb;if(_0x488919[_0xb91a('0x28')]['includeAll']){_0x2d0f7f['include']=[{'all':!![]}];}return db[_0xb91a('0x39')][_0xb91a('0x48')](_0x2d0f7f);})[_0xb91a('0x18')](function(_0x32f5b1){_0x2a213b[_0xb91a('0x49')]=_0x32f5b1;return _0x2a213b;});}})[_0xb91a('0x18')](respondWithFilteredResult(_0x50d1e7,_0x2d0f7f))[_0xb91a('0x2a')](handleError(_0x50d1e7,null));};exports[_0xb91a('0x4a')]=function(_0x19e3a7,_0x58aedf){return db[_0xb91a('0x21')][_0xb91a('0x34')]({'where':{'id':_0x19e3a7[_0xb91a('0x2b')]['id']}})[_0xb91a('0x18')](handleEntityNotFound(_0x58aedf,null))[_0xb91a('0x18')](function(_0x1dd928){if(_0x1dd928){return _0x1dd928['setTags'](_0x19e3a7[_0xb91a('0x36')][_0xb91a('0x4b')],_[_0xb91a('0x3a')](_0x19e3a7['body'],[_0xb91a('0x4b'),'id'])||{})[_0xb91a('0x4c')](function(){return db[_0xb91a('0x4d')]['findAll']({'attributes':['id',_0xb91a('0x1d'),_0xb91a('0x4e')],'where':{'id':_0x19e3a7[_0xb91a('0x36')]['ids']}});})[_0xb91a('0x18')](function(_0x21eee1){socket[_0xb91a('0x4f')](_0xb91a('0x50'),{'id':Number(_0x19e3a7[_0xb91a('0x2b')]['id']),'tags':_0x21eee1||[]});return{'id':Number(_0x19e3a7[_0xb91a('0x2b')]['id']),'tags':_0x21eee1||[]};});}})['then'](respondWithResult(_0x58aedf,null))['catch'](handleError(_0x58aedf,null));};exports[_0xb91a('0x51')]=function(_0x343c36,_0x538af4){return db[_0xb91a('0x21')]['find']({'where':{'id':_0x343c36[_0xb91a('0x2b')]['id']}})[_0xb91a('0x18')](handleEntityNotFound(_0x538af4,null))[_0xb91a('0x18')](function(_0x598ae6){if(_0x598ae6){return _0x598ae6[_0xb91a('0x51')](_0x343c36[_0xb91a('0x28')]['ids']);}})[_0xb91a('0x18')](respondWithStatusCode(_0x538af4,null))[_0xb91a('0x2a')](handleError(_0x538af4,null));};exports[_0xb91a('0x52')]=function(_0x16537e,_0x150d0c){var _0x1251ec=moment()[_0xb91a('0x53')]()[_0xb91a('0x54')]();var _0x3b12ae=path['join'](config[_0xb91a('0x55')],_0xb91a('0x56'),_0xb91a('0x57'),_0xb91a('0x58'));var _0x119622=path[_0xb91a('0x59')](config[_0xb91a('0x55')],_0xb91a('0x56'),_0xb91a('0x57'),_0xb91a('0x5a'));var _0x36ed91=path[_0xb91a('0x59')](_0x3b12ae,_0x1251ec);var _0x2c2af1=util[_0xb91a('0x5b')]('transcript-%d-%s.zip',_0x16537e['params']['id'],_0x1251ec);var _0x157deb=path[_0xb91a('0x59')](_0x3b12ae,_0x2c2af1);var _0x5b148c=[];_0x5b148c[_0xb91a('0x5c')]({'model':db['User'],'as':'User','attributes':['id',_0xb91a('0x5d')],'raw':!![]});_0x5b148c['push']({'model':db[_0xb91a('0x5e')],'as':_0xb91a('0x5f'),'attributes':['id','firstName',_0xb91a('0x60')],'raw':!![]});if(_0x16537e['query'][_0xb91a('0x5a')]){_0x5b148c[_0xb91a('0x5c')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x525dfd=[{'model':db[_0xb91a('0x39')],'as':_0xb91a('0x61'),'attributes':['id',_0xb91a('0x36'),_0xb91a('0x62'),'direction',_0xb91a('0x63'),'read'],'include':_0x5b148c}];_0x525dfd['push']({'model':db[_0xb91a('0x64')],'as':'Account','attributes':['id',_0xb91a('0x1d')]});_0x525dfd[_0xb91a('0x5c')]({'model':db[_0xb91a('0x65')],'as':_0xb91a('0x66'),'attributes':['id',_0xb91a('0x5d')]});return db[_0xb91a('0x21')][_0xb91a('0x34')]({'where':{'id':_0x16537e[_0xb91a('0x2b')]['id']},'include':_0x525dfd})[_0xb91a('0x18')](handleEntityNotFound(_0x150d0c,null))['then'](function(_0x170159){if(_0x170159){var _0x484939=_0x170159[_0xb91a('0x67')]({'plain':!![]});fs[_0xb91a('0x68')](_0x36ed91);var _0x5ccc3d={'channel':_0xb91a('0x69'),'account':_0x484939['Account'][_0xb91a('0x1d')],'agent':_0x484939['Owner']?_0x484939['Owner'][_0xb91a('0x5d')]:'N.A.','createdAt':moment(_0x484939['createdAt'])[_0xb91a('0x5b')](_0xb91a('0x6a'))['toString'](),'closedAt':_0x484939[_0xb91a('0x6b')]?moment(_0x484939[_0xb91a('0x6c')])[_0xb91a('0x5b')](_0xb91a('0x6a'))['toString']():'','disposition':_0x484939['disposition'],'messages':_(_0x484939[_0xb91a('0x61')])['filter']({'secret':![]})[_0xb91a('0x20')](function(_0x9ac739){if(_0x9ac739[_0xb91a('0x6d')]){var _0x2e2fab=path[_0xb91a('0x59')](_0x119622,_0x9ac739['Attachment'][_0xb91a('0x6e')]);if(fs['existsSync'](_0x2e2fab)){fs[_0xb91a('0x6f')](_0x2e2fab)[_0xb91a('0x70')](fs['createWriteStream'](path[_0xb91a('0x59')](_0x36ed91,_0x9ac739[_0xb91a('0x6d')][_0xb91a('0x6e')])));}}return{'date':moment(_0x9ac739[_0xb91a('0x62')])[_0xb91a('0x5b')](_0xb91a('0x6a'))[_0xb91a('0x54')](),'sender':_0x9ac739[_0xb91a('0x71')]==='out'?_0x9ac739[_0xb91a('0x65')]?_0x9ac739[_0xb91a('0x65')][_0xb91a('0x5d')]:_0xb91a('0x72'):_0x9ac739[_0xb91a('0x5f')][_0xb91a('0x73')]+(_0x9ac739[_0xb91a('0x5f')][_0xb91a('0x60')]?'\x20'+_0x9ac739[_0xb91a('0x5f')][_0xb91a('0x60')]:''),'body':_0x9ac739[_0xb91a('0x6d')]?_0x9ac739[_0xb91a('0x6d')][_0xb91a('0x6e')]:_0x9ac739[_0xb91a('0x36')],'direction':_0x9ac739[_0xb91a('0x71')]===_0xb91a('0x74')?'A':'C','secret':_0x9ac739[_0xb91a('0x63')],'read':_0x9ac739[_0xb91a('0x75')],'attachment':_0x9ac739[_0xb91a('0x6d')]};})['value']()};return ejs[_0xb91a('0x76')](path[_0xb91a('0x59')](config['root'],_0xb91a('0x56'),'views',_0xb91a('0x77')),{'interaction':_0x5ccc3d})[_0xb91a('0x18')](function(_0x1914fd){var _0x46df07=path['join'](_0x36ed91,_0xb91a('0x78')+_0x484939['id']+'-'+_0x1251ec+_0xb91a('0x79'));var _0x4d06a0={'path':_0x46df07,'channel':_0xb91a('0x69'),'interactionId':_0x484939['id']};return pdf[_0xb91a('0x7a')](_0x1914fd,_0x4d06a0);})[_0xb91a('0x18')](function(){return new BPromise(function(_0x1267c4,_0x4650ed){zipdir(_0x36ed91,{'saveTo':_0x157deb},function(_0x4a027c,_0x3f238a){if(_0x4a027c)return _0x4650ed(_0x4a027c);return _0x1267c4(_0x3f238a);});})[_0xb91a('0x18')](function(){return new BPromise(function(_0x23eaca,_0x16e431){rimraf(_0x36ed91,function(_0x153975){if(_0x153975)_0x16e431(_0x153975);return _0x23eaca();});});})[_0xb91a('0x18')](function(){return _0x150d0c[_0xb91a('0x52')](_0x157deb,_0x2c2af1,function(_0x42754f){if(_0x42754f){console[_0xb91a('0x7b')]('err',_0x42754f);}else{fs['unlinkSync'](_0x157deb);}});});});}else{return _0x150d0c[_0xb91a('0xf')](0xc8);}})[_0xb91a('0x2a')](handleError(_0x150d0c,null));}; \ No newline at end of file +var _0x5f8e=['CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','name','Owner','fullname','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','existsSync','createReadStream','createWriteStream','basename','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','stack','send','index','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','user','catch','show','params','model','query','filters','intersection','attributes','fields','includeAll','include','merge','find','create','update','body','describe','addMessage','WhatsappMessage','ids','keys','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','unix','toString','join','root','server','tmp','transcript-%d-%s.zip','push','User'];(function(_0x11b7d5,_0x1aaa34){var _0x3a4a86=function(_0x3452eb){while(--_0x3452eb){_0x11b7d5['push'](_0x11b7d5['shift']());}};_0x3a4a86(++_0x1aaa34);}(_0x5f8e,0x1aa));var _0xe5f8=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x5f8e[_0x34d346];return _0x122d76;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe5f8('0x0'));var moment=require(_0xe5f8('0x1'));var BPromise=require(_0xe5f8('0x2'));var util=require(_0xe5f8('0x3'));var path=require(_0xe5f8('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe5f8('0x5'));var Redis=require(_0xe5f8('0x6'));var interaction=require(_0xe5f8('0x7'));var qs=require(_0xe5f8('0x8'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xe5f8('0x9'));var config=require('../../config/environment');var db=require(_0xe5f8('0xa'))['db'];config[_0xe5f8('0xb')]=_[_0xe5f8('0xc')](config[_0xe5f8('0xb')],{'host':_0xe5f8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5f8('0xb')]));require(_0xe5f8('0xe'))[_0xe5f8('0xf')](socket);function respondWithStatusCode(_0x2c90e0,_0x1d5733){_0x1d5733=_0x1d5733||0xcc;return function(_0x2d1ced){if(_0x2d1ced){return _0x2c90e0[_0xe5f8('0x10')](_0x1d5733);}return _0x2c90e0[_0xe5f8('0x11')](_0x1d5733)[_0xe5f8('0x12')]();};}function respondWithResult(_0x4d5adc,_0x11e3ac){_0x11e3ac=_0x11e3ac||0xc8;return function(_0x55ad6e){if(_0x55ad6e){return _0x4d5adc['status'](_0x11e3ac)[_0xe5f8('0x13')](_0x55ad6e);}};}function respondWithFilteredResult(_0x4dc260,_0xcc337c){return function(_0xcc49d4){if(_0xcc49d4){var _0x433e2f=typeof _0xcc337c[_0xe5f8('0x14')]==='undefined'&&typeof _0xcc337c['limit']===_0xe5f8('0x15');var _0x29a956=_0xcc49d4[_0xe5f8('0x16')];var _0x42d014=_0x433e2f?0x0:_0xcc337c[_0xe5f8('0x14')];var _0x7af47e=_0x433e2f?_0xcc49d4[_0xe5f8('0x16')]:_0xcc337c[_0xe5f8('0x14')]+_0xcc337c[_0xe5f8('0x17')];var _0x382d2a;if(_0x7af47e>=_0x29a956){_0x7af47e=_0x29a956;_0x382d2a=0xc8;}else{_0x382d2a=0xce;}_0x4dc260[_0xe5f8('0x11')](_0x382d2a);return _0x4dc260[_0xe5f8('0x18')](_0xe5f8('0x19'),_0x42d014+'-'+_0x7af47e+'/'+_0x29a956)['json'](_0xcc49d4);}return null;};}function saveUpdates(_0x1abe77){return function(_0x5e6c40){if(_0x5e6c40){return _0x5e6c40['update'](_0x1abe77)[_0xe5f8('0x1a')](function(_0x12a1b0){return _0x12a1b0;});}return null;};}function removeEntity(_0x34f632){return function(_0x1ac890){if(_0x1ac890){return _0x1ac890[_0xe5f8('0x1b')]()['then'](function(){_0x34f632[_0xe5f8('0x11')](0xcc)[_0xe5f8('0x12')]();});}};}function handleEntityNotFound(_0x54c8c1){return function(_0x1ff8c0){if(!_0x1ff8c0){_0x54c8c1['sendStatus'](0x194);}return _0x1ff8c0;};}function handleError(_0x2b350d,_0x538be3){_0x538be3=_0x538be3||0x1f4;return function(_0x556158){logger[_0xe5f8('0x1c')](_0x556158[_0xe5f8('0x1d')]);if(_0x556158['name']){delete _0x556158['name'];}_0x2b350d[_0xe5f8('0x11')](_0x538be3)[_0xe5f8('0x1e')](_0x556158);};}exports[_0xe5f8('0x1f')]=function(_0x2bf459,_0x44eabf){var _0x45a65c={};var _0x316226=_['map'](db[_0xe5f8('0x20')][_0xe5f8('0x21')],function(_0x37b42a){return{'name':_0x37b42a[_0xe5f8('0x22')],'type':_0x37b42a[_0xe5f8('0x23')][_0xe5f8('0x24')]};});_0x45a65c=qs[_0xe5f8('0x25')](_0x316226,_0x2bf459);return interaction[_0xe5f8('0x26')](_0xe5f8('0x27'),_0x2bf459['query'],_0x2bf459[_0xe5f8('0x28')],_0x45a65c,_0x316226)['then'](respondWithFilteredResult(_0x44eabf,_0x45a65c))[_0xe5f8('0x29')](handleError(_0x44eabf,null));};exports[_0xe5f8('0x2a')]=function(_0xda513d,_0x4f59ba){var _0x32ed5d={'raw':![],'where':{'id':_0xda513d[_0xe5f8('0x2b')]['id']}},_0x551017={};_0x551017[_0xe5f8('0x2c')]=_['keys'](db[_0xe5f8('0x20')][_0xe5f8('0x21')]);_0x551017['query']=_['keys'](_0xda513d[_0xe5f8('0x2d')]);_0x551017[_0xe5f8('0x2e')]=_[_0xe5f8('0x2f')](_0x551017['model'],_0x551017[_0xe5f8('0x2d')]);_0x32ed5d[_0xe5f8('0x30')]=_['intersection'](_0x551017[_0xe5f8('0x2c')],qs[_0xe5f8('0x31')](_0xda513d['query'][_0xe5f8('0x31')]));_0x32ed5d[_0xe5f8('0x30')]=_0x32ed5d[_0xe5f8('0x30')]['length']?_0x32ed5d[_0xe5f8('0x30')]:_0x551017[_0xe5f8('0x2c')];if(_0xda513d['query'][_0xe5f8('0x32')]){_0x32ed5d[_0xe5f8('0x33')]=[{'all':!![]}];}_0x32ed5d=_[_0xe5f8('0x34')]({},_0x32ed5d,_0xda513d['options']);return db[_0xe5f8('0x20')][_0xe5f8('0x35')](_0x32ed5d)[_0xe5f8('0x1a')](handleEntityNotFound(_0x4f59ba,null))['then'](respondWithResult(_0x4f59ba,null))[_0xe5f8('0x29')](handleError(_0x4f59ba,null));};exports[_0xe5f8('0x36')]=function(_0x597059,_0x387c36){return db[_0xe5f8('0x20')][_0xe5f8('0x36')](_0x597059['body'],{})[_0xe5f8('0x1a')](respondWithResult(_0x387c36,0xc9))['catch'](handleError(_0x387c36,null));};exports[_0xe5f8('0x37')]=function(_0x1de365,_0x2df19a){if(_0x1de365[_0xe5f8('0x38')]['id']){delete _0x1de365[_0xe5f8('0x38')]['id'];}return db[_0xe5f8('0x20')]['find']({'where':{'id':_0x1de365[_0xe5f8('0x2b')]['id']}})[_0xe5f8('0x1a')](handleEntityNotFound(_0x2df19a,null))[_0xe5f8('0x1a')](saveUpdates(_0x1de365[_0xe5f8('0x38')],null))['then'](respondWithResult(_0x2df19a,null))[_0xe5f8('0x29')](handleError(_0x2df19a,null));};exports[_0xe5f8('0x1b')]=function(_0x43fab7,_0x31a42a){return db[_0xe5f8('0x20')]['find']({'where':{'id':_0x43fab7[_0xe5f8('0x2b')]['id']}})['then'](handleEntityNotFound(_0x31a42a,null))[_0xe5f8('0x1a')](removeEntity(_0x31a42a,null))['catch'](handleError(_0x31a42a,null));};exports[_0xe5f8('0x39')]=function(_0x13c0a7,_0x4715c2){return db['WhatsappInteraction'][_0xe5f8('0x39')]()['then'](respondWithResult(_0x4715c2,null))[_0xe5f8('0x29')](handleError(_0x4715c2,null));};exports[_0xe5f8('0x3a')]=function(_0x23dfe4,_0x2f3ab4){return db[_0xe5f8('0x3b')][_0xe5f8('0x35')]({'where':{'id':_0x23dfe4[_0xe5f8('0x2b')]['id']}})[_0xe5f8('0x1a')](handleEntityNotFound(_0x2f3ab4,null))['then'](function(_0x23bb1c){if(_0x23bb1c){return _0x23bb1c['addMessage'](_0x23dfe4[_0xe5f8('0x38')][_0xe5f8('0x3c')],_['omit'](_0x23dfe4['body'],[_0xe5f8('0x3c'),'id'])||{});}})[_0xe5f8('0x1a')](respondWithResult(_0x2f3ab4,null))[_0xe5f8('0x29')](handleError(_0x2f3ab4,null));};exports['getMessages']=function(_0x2b563b,_0x1b2108){var _0x15d6ec={'raw':![],'where':{}};var _0xe73a0f={};var _0x131ba8={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x2b563b[_0xe5f8('0x2b')]['id']}})[_0xe5f8('0x1a')](handleEntityNotFound(_0x1b2108,null))['then'](function(_0x27d455){if(_0x27d455){_0xe73a0f[_0xe5f8('0x2c')]=_[_0xe5f8('0x3d')](db['WhatsappMessage'][_0xe5f8('0x21')]);_0xe73a0f[_0xe5f8('0x2d')]=_['keys'](_0x2b563b[_0xe5f8('0x2d')]);_0xe73a0f['filters']=_[_0xe5f8('0x2f')](_0xe73a0f[_0xe5f8('0x2c')],_0xe73a0f[_0xe5f8('0x2d')]);_0x15d6ec['attributes']=_[_0xe5f8('0x2f')](_0xe73a0f[_0xe5f8('0x2c')],qs[_0xe5f8('0x31')](_0x2b563b[_0xe5f8('0x2d')]['fields']));_0x15d6ec['attributes']=_0x15d6ec[_0xe5f8('0x30')][_0xe5f8('0x3e')]?_0x15d6ec[_0xe5f8('0x30')]:_0xe73a0f[_0xe5f8('0x2c')];if(!_0x2b563b[_0xe5f8('0x2d')][_0xe5f8('0x3f')](_0xe5f8('0x40'))){_0x15d6ec[_0xe5f8('0x17')]=qs[_0xe5f8('0x17')](_0x2b563b[_0xe5f8('0x2d')][_0xe5f8('0x17')]);_0x15d6ec[_0xe5f8('0x14')]=qs['offset'](_0x2b563b[_0xe5f8('0x2d')][_0xe5f8('0x14')]);}_0x15d6ec[_0xe5f8('0x41')]=qs[_0xe5f8('0x42')](_0x2b563b['query'][_0xe5f8('0x42')]);_0x15d6ec[_0xe5f8('0x43')]=qs[_0xe5f8('0x2e')](_[_0xe5f8('0x44')](_0x2b563b[_0xe5f8('0x2d')],_0xe73a0f[_0xe5f8('0x2e')]));_0x15d6ec[_0xe5f8('0x43')][_0xe5f8('0x45')]=_0x27d455['id'];if(_0x2b563b[_0xe5f8('0x2d')]['filter']){_0x15d6ec['where']=_['merge'](_0x15d6ec[_0xe5f8('0x43')],{'$or':_[_0xe5f8('0x46')](_0x15d6ec[_0xe5f8('0x30')],function(_0x244408){var _0x490b25={};_0x490b25[_0x244408]={'$like':'%'+_0x2b563b['query'][_0xe5f8('0x47')]+'%'};return _0x490b25;})});}if(_0x2b563b[_0xe5f8('0x2d')][_0xe5f8('0x48')]){var _0xb18eb9=_0x2b563b[_0xe5f8('0x2d')][_0xe5f8('0x48')][_0xe5f8('0x49')](',');var _0x4d93ac={};_0x4d93ac[_0xb18eb9[0x0]]={'$gte':moment(_0xb18eb9[0x1])[_0xe5f8('0x4a')](_0xe5f8('0x4b'))};_0x15d6ec[_0xe5f8('0x43')]=_[_0xe5f8('0x34')](_0x15d6ec[_0xe5f8('0x43')],_0x4d93ac);}_0x15d6ec=_[_0xe5f8('0x34')]({},_0x15d6ec,_0x2b563b['options']);return db[_0xe5f8('0x3b')][_0xe5f8('0x16')]({'where':_0x15d6ec[_0xe5f8('0x43')]})[_0xe5f8('0x1a')](function(_0x4ddccd){_0x131ba8[_0xe5f8('0x16')]=_0x4ddccd;if(_0x2b563b[_0xe5f8('0x2d')][_0xe5f8('0x32')]){_0x15d6ec['include']=[{'all':!![]}];}return db[_0xe5f8('0x3b')]['findAll'](_0x15d6ec);})[_0xe5f8('0x1a')](function(_0x3557d1){_0x131ba8['rows']=_0x3557d1;return _0x131ba8;});}})[_0xe5f8('0x1a')](respondWithFilteredResult(_0x1b2108,_0x15d6ec))[_0xe5f8('0x29')](handleError(_0x1b2108,null));};exports[_0xe5f8('0x4c')]=function(_0x2b17ee,_0x9ed7b9){return db[_0xe5f8('0x20')][_0xe5f8('0x35')]({'where':{'id':_0x2b17ee['params']['id']}})['then'](handleEntityNotFound(_0x9ed7b9,null))['then'](function(_0x5c9970){if(_0x5c9970){return _0x5c9970[_0xe5f8('0x4d')](_0x2b17ee[_0xe5f8('0x38')][_0xe5f8('0x3c')],_[_0xe5f8('0x4e')](_0x2b17ee[_0xe5f8('0x38')],[_0xe5f8('0x3c'),'id'])||{})[_0xe5f8('0x4f')](function(){return db[_0xe5f8('0x50')][_0xe5f8('0x26')]({'attributes':['id','name',_0xe5f8('0x51')],'where':{'id':_0x2b17ee[_0xe5f8('0x38')]['ids']}});})[_0xe5f8('0x1a')](function(_0x33f414){socket[_0xe5f8('0x52')](_0xe5f8('0x53'),{'id':Number(_0x2b17ee[_0xe5f8('0x2b')]['id']),'tags':_0x33f414||[]});return{'id':Number(_0x2b17ee[_0xe5f8('0x2b')]['id']),'tags':_0x33f414||[]};});}})[_0xe5f8('0x1a')](respondWithResult(_0x9ed7b9,null))[_0xe5f8('0x29')](handleError(_0x9ed7b9,null));};exports['removeTags']=function(_0x4e1acd,_0x1b5418){return db[_0xe5f8('0x20')][_0xe5f8('0x35')]({'where':{'id':_0x4e1acd[_0xe5f8('0x2b')]['id']}})[_0xe5f8('0x1a')](handleEntityNotFound(_0x1b5418,null))[_0xe5f8('0x1a')](function(_0x60f451){if(_0x60f451){return _0x60f451[_0xe5f8('0x54')](_0x4e1acd['query'][_0xe5f8('0x3c')]);}})[_0xe5f8('0x1a')](respondWithStatusCode(_0x1b5418,null))['catch'](handleError(_0x1b5418,null));};exports['download']=function(_0x13927f,_0x119374){var _0x2bcf1c=moment()[_0xe5f8('0x55')]()[_0xe5f8('0x56')]();var _0x4b9a6a=path[_0xe5f8('0x57')](config[_0xe5f8('0x58')],_0xe5f8('0x59'),'files',_0xe5f8('0x5a'));var _0x5e0bfe=path[_0xe5f8('0x57')](config[_0xe5f8('0x58')],_0xe5f8('0x59'),'files','attachments');var _0x5dba23=path[_0xe5f8('0x57')](_0x4b9a6a,_0x2bcf1c);var _0xd0d396=util[_0xe5f8('0x4a')](_0xe5f8('0x5b'),_0x13927f['params']['id'],_0x2bcf1c);var _0x203f80=path[_0xe5f8('0x57')](_0x4b9a6a,_0xd0d396);var _0x30c3d9=[];_0x30c3d9[_0xe5f8('0x5c')]({'model':db[_0xe5f8('0x5d')],'as':_0xe5f8('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x30c3d9['push']({'model':db[_0xe5f8('0x5e')],'as':_0xe5f8('0x5f'),'attributes':['id',_0xe5f8('0x60'),_0xe5f8('0x61')],'raw':!![]});if(_0x13927f['query']['attachments']){_0x30c3d9[_0xe5f8('0x5c')]({'model':db[_0xe5f8('0x62')],'as':_0xe5f8('0x62'),'raw':!![]});}var _0x6f5e20=[{'model':db[_0xe5f8('0x3b')],'as':_0xe5f8('0x63'),'attributes':['id',_0xe5f8('0x38'),_0xe5f8('0x64'),_0xe5f8('0x65'),_0xe5f8('0x66'),_0xe5f8('0x67')],'include':_0x30c3d9}];_0x6f5e20[_0xe5f8('0x5c')]({'model':db[_0xe5f8('0x68')],'as':_0xe5f8('0x69'),'attributes':['id',_0xe5f8('0x6a')]});_0x6f5e20['push']({'model':db[_0xe5f8('0x5d')],'as':_0xe5f8('0x6b'),'attributes':['id',_0xe5f8('0x6c')]});return db[_0xe5f8('0x20')][_0xe5f8('0x35')]({'where':{'id':_0x13927f[_0xe5f8('0x2b')]['id']},'include':_0x6f5e20})[_0xe5f8('0x1a')](handleEntityNotFound(_0x119374,null))[_0xe5f8('0x1a')](function(_0xb26c6a){if(_0xb26c6a){var _0x2cc2d6=_0xb26c6a[_0xe5f8('0x6d')]({'plain':!![]});fs[_0xe5f8('0x6e')](_0x5dba23);var _0x4cf731={'channel':_0xe5f8('0x6f'),'account':_0x2cc2d6[_0xe5f8('0x69')][_0xe5f8('0x6a')],'agent':_0x2cc2d6[_0xe5f8('0x6b')]?_0x2cc2d6[_0xe5f8('0x6b')][_0xe5f8('0x6c')]:_0xe5f8('0x70'),'createdAt':moment(_0x2cc2d6[_0xe5f8('0x64')])[_0xe5f8('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x2cc2d6[_0xe5f8('0x71')]?moment(_0x2cc2d6[_0xe5f8('0x72')])[_0xe5f8('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe5f8('0x56')]():'','disposition':_0x2cc2d6[_0xe5f8('0x73')],'messages':_(_0x2cc2d6[_0xe5f8('0x63')])[_0xe5f8('0x47')]({'secret':![]})['map'](function(_0x48a08f){if(_0x48a08f['Attachment']){var _0x33ba73=path['join'](_0x5e0bfe,_0x48a08f[_0xe5f8('0x62')]['basename']);if(fs[_0xe5f8('0x74')](_0x33ba73)){fs[_0xe5f8('0x75')](_0x33ba73)['pipe'](fs[_0xe5f8('0x76')](path[_0xe5f8('0x57')](_0x5dba23,_0x48a08f['Attachment'][_0xe5f8('0x77')])));}}return{'date':moment(_0x48a08f[_0xe5f8('0x64')])['format'](_0xe5f8('0x4b'))[_0xe5f8('0x56')](),'sender':_0x48a08f[_0xe5f8('0x65')]===_0xe5f8('0x78')?_0x48a08f['User']?_0x48a08f['User'][_0xe5f8('0x6c')]:_0xe5f8('0x79'):_0x48a08f[_0xe5f8('0x5f')][_0xe5f8('0x60')]+(_0x48a08f['Contact']['lastName']?'\x20'+_0x48a08f['Contact'][_0xe5f8('0x61')]:''),'body':_0x48a08f[_0xe5f8('0x62')]?_0x48a08f[_0xe5f8('0x62')]['basename']:_0x48a08f[_0xe5f8('0x38')],'direction':_0x48a08f[_0xe5f8('0x65')]===_0xe5f8('0x78')?'A':'C','secret':_0x48a08f[_0xe5f8('0x66')],'read':_0x48a08f['read'],'attachment':_0x48a08f[_0xe5f8('0x62')]};})[_0xe5f8('0x7a')]()};return ejs[_0xe5f8('0x7b')](path[_0xe5f8('0x57')](config[_0xe5f8('0x58')],'server',_0xe5f8('0x7c'),_0xe5f8('0x7d')),{'interaction':_0x4cf731})['then'](function(_0x479211){var _0x39e0ee=path[_0xe5f8('0x57')](_0x5dba23,_0xe5f8('0x7e')+_0x2cc2d6['id']+'-'+_0x2bcf1c+_0xe5f8('0x7f'));var _0x1fd66a={'path':_0x39e0ee,'channel':'Whatsapp','interactionId':_0x2cc2d6['id']};return pdf[_0xe5f8('0x80')](_0x479211,_0x1fd66a);})[_0xe5f8('0x1a')](function(){return new BPromise(function(_0x3baa63,_0x27f4fa){zipdir(_0x5dba23,{'saveTo':_0x203f80},function(_0xa6f83f,_0x558826){if(_0xa6f83f)return _0x27f4fa(_0xa6f83f);return _0x3baa63(_0x558826);});})[_0xe5f8('0x1a')](function(){return new BPromise(function(_0x523445,_0x3e5ff4){rimraf(_0x5dba23,function(_0x393441){if(_0x393441)_0x3e5ff4(_0x393441);return _0x523445();});});})[_0xe5f8('0x1a')](function(){return _0x119374[_0xe5f8('0x81')](_0x203f80,_0xd0d396,function(_0x2e17a5){if(_0x2e17a5){console['log']('err',_0x2e17a5);}else{fs['unlinkSync'](_0x203f80);}});});});}else{return _0x119374[_0xe5f8('0x10')](0xc8);}})[_0xe5f8('0x29')](handleError(_0x119374,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index e7a2e97..84e1f65 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 _0x4dc0=['getUsers','then','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','remove'];(function(_0x3ae80e,_0xbbb162){var _0x410b30=function(_0xcedfb){while(--_0xcedfb){_0x3ae80e['push'](_0x3ae80e['shift']());}};_0x410b30(++_0xbbb162);}(_0x4dc0,0x13d));var _0x04dc=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x4dc0[_0x30ae5e];return _0x1f2e93;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x04dc('0x0')];var WhatsappMessage=require(_0x04dc('0x1'))['db'][_0x04dc('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x04dc('0x3')](0x0);var events={'afterCreate':_0x04dc('0x4'),'afterUpdate':'update','afterDestroy':_0x04dc('0x5')};function emitEvent(_0x389f53){return function(_0x13a827,_0x5c0e3d,_0x224df5){_0x13a827[_0x04dc('0x6')]({'attributes':['id'],'raw':!![]})[_0x04dc('0x7')](function(_0x53cc43){_0x13a827['setDataValue']('Users',_0x53cc43[_0x04dc('0x8')](function(_0x8bc895){return{'id':_0x8bc895['id']};}));return WhatsappMessage[_0x04dc('0x9')]({'where':{'WhatsappInteractionId':_0x13a827['id'],'direction':'in','read':![]},'raw':!![]});})[_0x04dc('0x7')](function(_0x3cd9c7){_0x13a827[_0x04dc('0xa')](_0x04dc('0xb'),_0x3cd9c7[_0x04dc('0xc')]);WhatsappInteractionEvents['emit'](_0x389f53+':'+_0x13a827['id'],_0x13a827);WhatsappInteractionEvents[_0x04dc('0xd')](_0x389f53,_0x13a827);_0x224df5(null);})[_0x04dc('0xe')](_0x224df5(null));};}for(var e in events){if(events[_0x04dc('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x04dc('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x833b=['remove','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','exports','../../mysqldb','setMaxListeners','update'];(function(_0x1e271f,_0xf14504){var _0x2b2ac5=function(_0x21c3b6){while(--_0x21c3b6){_0x1e271f['push'](_0x1e271f['shift']());}};_0x2b2ac5(++_0xf14504);}(_0x833b,0x131));var _0xb833=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x833b[_0x47aa64];return _0x549c7a;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xb833('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xb833('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb833('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb833('0x2'),'afterDestroy':_0xb833('0x3')};function emitEvent(_0x1f9d90){return function(_0x181a4e,_0x44e55d,_0x35b3f0){_0x181a4e[_0xb833('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3afa71){_0x181a4e[_0xb833('0x5')](_0xb833('0x6'),_0x3afa71[_0xb833('0x7')](function(_0x3b74c4){return{'id':_0x3b74c4['id']};}));return WhatsappMessage[_0xb833('0x8')]({'where':{'WhatsappInteractionId':_0x181a4e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb833('0x9')](function(_0x50cb16){_0x181a4e[_0xb833('0x5')]('unreadMessages',_0x50cb16[_0xb833('0xa')]);WhatsappInteractionEvents[_0xb833('0xb')](_0x1f9d90+':'+_0x181a4e['id'],_0x181a4e);WhatsappInteractionEvents[_0xb833('0xb')](_0x1f9d90,_0x181a4e);_0x35b3f0(null);})[_0xb833('0xc')](_0x35b3f0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xb833('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 0fef026..0695ff5 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 _0x885f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappInteraction','whatsapp_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger'];(function(_0x1e3023,_0x1a6b30){var _0x1706bb=function(_0x429260){while(--_0x429260){_0x1e3023['push'](_0x1e3023['shift']());}};_0x1706bb(++_0x1a6b30);}(_0x885f,0x1b1));var _0xf885=function(_0x117821,_0xaa1933){_0x117821=_0x117821-0x0;var _0x4ae9ff=_0x885f[_0x117821];return _0x4ae9ff;};'use strict';var _=require('lodash');var util=require(_0xf885('0x0'));var logger=require(_0xf885('0x1'))(_0xf885('0x2'));var moment=require(_0xf885('0x3'));var BPromise=require(_0xf885('0x4'));var rp=require(_0xf885('0x5'));var fs=require('fs');var path=require(_0xf885('0x6'));var rimraf=require(_0xf885('0x7'));var config=require(_0xf885('0x8'));var attributes=require('./whatsappInteraction.attributes');module[_0xf885('0x9')]=function(_0x434ac7,_0x16861b){return _0x434ac7['define'](_0xf885('0xa'),attributes,{'tableName':_0xf885('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49b117,_0x532732,_0x17f048){if(_0x49b117['changed'](_0xf885('0xc'))){_0x49b117['closedAt']=moment()[_0xf885('0xd')](_0xf885('0xe'));}_0x17f048(null,_0x49b117);}}});}; \ No newline at end of file +var _0x7341=['lodash','api','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x7341,0x1d1));var _0x1734=function(_0x1e82c2,_0x870e1b){_0x1e82c2=_0x1e82c2-0x0;var _0x4033ac=_0x7341[_0x1e82c2];return _0x4033ac;};'use strict';var _=require(_0x1734('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1734('0x1'));var moment=require('moment');var BPromise=require(_0x1734('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1734('0x3'));var rimraf=require(_0x1734('0x4'));var config=require(_0x1734('0x5'));var attributes=require(_0x1734('0x6'));module[_0x1734('0x7')]=function(_0x52ebe3,_0x47a7cf){return _0x52ebe3['define'](_0x1734('0x8'),attributes,{'tableName':_0x1734('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2520ac,_0x5e357b,_0x3dea13){if(_0x2520ac[_0x1734('0xa')](_0x1734('0xb'))){_0x2520ac[_0x1734('0xc')]=moment()[_0x1734('0xd')](_0x1734('0xe'));}_0x3dea13(null,_0x2520ac);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index cfcf0bf..bdaef7f 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 _0x7154=['find','addTags','omit','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','update','body','options','where','attributes','limit','info','debug','AddTagsToWhatsappInteraction','WhatsappInteraction'];(function(_0x5baf6b,_0x388e21){var _0x1dd8de=function(_0x4a929f){while(--_0x4a929f){_0x5baf6b['push'](_0x5baf6b['shift']());}};_0x1dd8de(++_0x388e21);}(_0x7154,0xa6));var _0x4715=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0x7154[_0x52f159];return _0x156799;};'use strict';var _=require('lodash');var util=require(_0x4715('0x0'));var moment=require('moment');var BPromise=require(_0x4715('0x1'));var rs=require(_0x4715('0x2'));var fs=require('fs');var Redis=require(_0x4715('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4715('0x4'));var logger=require('../../config/logger')(_0x4715('0x5'));var config=require(_0x4715('0x6'));var jayson=require(_0x4715('0x7'));var client=jayson['client'][_0x4715('0x8')]({'port':0x232a});config[_0x4715('0x9')]=_[_0x4715('0xa')](config[_0x4715('0x9')],{'host':_0x4715('0xb'),'port':0x18eb});var socket=require(_0x4715('0xc'))(new Redis(config[_0x4715('0x9')]));require(_0x4715('0xd'))[_0x4715('0xe')](socket);function respondWithRpcPromise(_0x523a7d,_0x29acec,_0x4680c9){return new BPromise(function(_0x21ba89,_0x12abca){return client['request'](_0x523a7d,_0x4680c9)['then'](function(_0x5dc0c8){logger['info'](_0x4715('0xf'),_0x29acec,_0x4715('0x10'));logger['debug'](_0x4715('0x11'),_0x29acec,_0x4715('0x10'),JSON[_0x4715('0x12')](_0x5dc0c8));if(_0x5dc0c8[_0x4715('0x13')]){if(_0x5dc0c8[_0x4715('0x13')]['code']===0x1f4){logger[_0x4715('0x13')](_0x4715('0xf'),_0x29acec,_0x5dc0c8[_0x4715('0x13')][_0x4715('0x14')]);return _0x12abca(_0x5dc0c8[_0x4715('0x13')][_0x4715('0x14')]);}logger[_0x4715('0x13')](_0x4715('0xf'),_0x29acec,_0x5dc0c8[_0x4715('0x13')][_0x4715('0x14')]);return _0x21ba89(_0x5dc0c8['error'][_0x4715('0x14')]);}else{logger['info'](_0x4715('0xf'),_0x29acec,_0x4715('0x10'));_0x21ba89(_0x5dc0c8[_0x4715('0x15')][_0x4715('0x14')]);}})[_0x4715('0x16')](function(_0x482e4e){logger[_0x4715('0x13')](_0x4715('0xf'),_0x29acec,_0x482e4e);_0x12abca(_0x482e4e);});});}exports[_0x4715('0x17')]=function(_0x1abdca){var _0x1504cb=this;return new Promise(function(_0x1fc7a3,_0x195605){return db['WhatsappInteraction'][_0x4715('0x18')](_0x1abdca[_0x4715('0x19')],{'raw':_0x1abdca[_0x4715('0x1a')]?_0x1abdca['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1abdca[_0x4715('0x1a')]?_0x1abdca[_0x4715('0x1a')][_0x4715('0x1b')]||null:null,'attributes':_0x1abdca['options']?_0x1abdca[_0x4715('0x1a')][_0x4715('0x1c')]||null:null,'limit':_0x1abdca[_0x4715('0x1a')]?_0x1abdca['options'][_0x4715('0x1d')]||null:null})['then'](function(_0x29beef){logger[_0x4715('0x1e')](_0x4715('0x17'),_0x1abdca);logger[_0x4715('0x1f')](_0x4715('0x17'),_0x1abdca,JSON[_0x4715('0x12')](_0x29beef));_0x1fc7a3(_0x29beef);})[_0x4715('0x16')](function(_0x5d33d6){logger['error'](_0x4715('0x17'),_0x5d33d6[_0x4715('0x14')],_0x1abdca);_0x195605(_0x1504cb[_0x4715('0x13')](0x1f4,_0x5d33d6[_0x4715('0x14')]));});});};exports[_0x4715('0x20')]=function(_0xe8b93d){return new Promise(function(_0x5704de,_0x122d31){return db[_0x4715('0x21')][_0x4715('0x22')]({'where':_0xe8b93d[_0x4715('0x1a')]?_0xe8b93d[_0x4715('0x1a')][_0x4715('0x1b')]||null:null})['then'](function(_0x5984f8){if(_0x5984f8){return _0x5984f8[_0x4715('0x23')](_0xe8b93d['body']['ids'],_[_0x4715('0x24')](_0xe8b93d[_0x4715('0x19')],[_0x4715('0x25'),'id'])||{});}})[_0x4715('0x26')](function(_0x3145e4){logger['info'](_0x4715('0x27'),_0xe8b93d);logger[_0x4715('0x1f')](_0x4715('0x27'),_0xe8b93d,JSON['stringify'](_0x3145e4));_0x5704de(_0x3145e4);})[_0x4715('0x16')](function(_0x54bbd2){logger['error'](_0x4715('0x27'),_0x54bbd2[_0x4715('0x14')],_0xe8b93d);_0x122d31(_this['error'](0x1f4,_0x54bbd2['message']));});});}; \ No newline at end of file +var _0x0041=['omit','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','limit','catch','AddTagsToWhatsappInteraction','find','addTags','ids'];(function(_0x598152,_0x4230ac){var _0x71af95=function(_0x59f1da){while(--_0x59f1da){_0x598152['push'](_0x598152['shift']());}};_0x71af95(++_0x4230ac);}(_0x0041,0x1a6));var _0x1004=function(_0x255ba1,_0x4e9c8b){_0x255ba1=_0x255ba1-0x0;var _0x2c3437=_0x0041[_0x255ba1];return _0x2c3437;};'use strict';var _=require(_0x1004('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1004('0x1'));var rs=require(_0x1004('0x2'));var fs=require('fs');var Redis=require(_0x1004('0x3'));var db=require(_0x1004('0x4'))['db'];var utils=require(_0x1004('0x5'));var logger=require(_0x1004('0x6'))(_0x1004('0x7'));var config=require(_0x1004('0x8'));var jayson=require(_0x1004('0x9'));var client=jayson[_0x1004('0xa')][_0x1004('0xb')]({'port':0x232a});config[_0x1004('0xc')]=_[_0x1004('0xd')](config['redis'],{'host':_0x1004('0xe'),'port':0x18eb});var socket=require(_0x1004('0xf'))(new Redis(config['redis']));require(_0x1004('0x10'))['register'](socket);function respondWithRpcPromise(_0x5c4f87,_0x55977e,_0x13d769){return new BPromise(function(_0x2aed4b,_0x5cf30a){return client[_0x1004('0x11')](_0x5c4f87,_0x13d769)[_0x1004('0x12')](function(_0x2d3551){logger[_0x1004('0x13')](_0x1004('0x14'),_0x55977e,_0x1004('0x15'));logger[_0x1004('0x16')](_0x1004('0x17'),_0x55977e,'request\x20sent',JSON[_0x1004('0x18')](_0x2d3551));if(_0x2d3551[_0x1004('0x19')]){if(_0x2d3551[_0x1004('0x19')][_0x1004('0x1a')]===0x1f4){logger[_0x1004('0x19')](_0x1004('0x14'),_0x55977e,_0x2d3551[_0x1004('0x19')][_0x1004('0x1b')]);return _0x5cf30a(_0x2d3551[_0x1004('0x19')][_0x1004('0x1b')]);}logger[_0x1004('0x19')](_0x1004('0x14'),_0x55977e,_0x2d3551['error'][_0x1004('0x1b')]);return _0x2aed4b(_0x2d3551[_0x1004('0x19')]['message']);}else{logger['info'](_0x1004('0x14'),_0x55977e,_0x1004('0x15'));_0x2aed4b(_0x2d3551['result']['message']);}})['catch'](function(_0x191e33){logger['error'](_0x1004('0x14'),_0x55977e,_0x191e33);_0x5cf30a(_0x191e33);});});}exports[_0x1004('0x1c')]=function(_0x364be7){var _0x2c294e=this;return new Promise(function(_0x130226,_0x3d28b1){return db[_0x1004('0x1d')][_0x1004('0x1e')](_0x364be7[_0x1004('0x1f')],{'raw':_0x364be7[_0x1004('0x20')]?_0x364be7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x364be7[_0x1004('0x20')]?_0x364be7['options'][_0x1004('0x21')]||null:null,'attributes':_0x364be7['options']?_0x364be7[_0x1004('0x20')]['attributes']||null:null,'limit':_0x364be7['options']?_0x364be7[_0x1004('0x20')][_0x1004('0x22')]||null:null})[_0x1004('0x12')](function(_0x18b377){logger[_0x1004('0x13')](_0x1004('0x1c'),_0x364be7);logger[_0x1004('0x16')]('UpdateWhatsappInteraction',_0x364be7,JSON[_0x1004('0x18')](_0x18b377));_0x130226(_0x18b377);})[_0x1004('0x23')](function(_0x417a84){logger[_0x1004('0x19')](_0x1004('0x1c'),_0x417a84[_0x1004('0x1b')],_0x364be7);_0x3d28b1(_0x2c294e['error'](0x1f4,_0x417a84[_0x1004('0x1b')]));});});};exports[_0x1004('0x24')]=function(_0x484f2b){return new Promise(function(_0x4cbac4,_0xec3aa5){return db[_0x1004('0x1d')][_0x1004('0x25')]({'where':_0x484f2b[_0x1004('0x20')]?_0x484f2b[_0x1004('0x20')]['where']||null:null})[_0x1004('0x12')](function(_0xc5a002){if(_0xc5a002){return _0xc5a002[_0x1004('0x26')](_0x484f2b[_0x1004('0x1f')][_0x1004('0x27')],_[_0x1004('0x28')](_0x484f2b[_0x1004('0x1f')],[_0x1004('0x27'),'id'])||{});}})['spread'](function(_0x1d0e63){logger[_0x1004('0x13')](_0x1004('0x29'),_0x484f2b);logger[_0x1004('0x16')](_0x1004('0x29'),_0x484f2b,JSON[_0x1004('0x18')](_0x1d0e63));_0x4cbac4(_0x1d0e63);})[_0x1004('0x23')](function(_0x2f6164){logger[_0x1004('0x19')]('AddTags',_0x2f6164[_0x1004('0x1b')],_0x484f2b);_0xec3aa5(_this[_0x1004('0x19')](0x1f4,_0x2f6164[_0x1004('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index aaa121f..002fe82 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 _0x98a9=['./whatsappInteraction.events','save','remove','update','removeListener','length','whatsappInteraction:'];(function(_0x3e48c8,_0x3a92ec){var _0x1947b7=function(_0x4e9f88){while(--_0x4e9f88){_0x3e48c8['push'](_0x3e48c8['shift']());}};_0x1947b7(++_0x3a92ec);}(_0x98a9,0x8c));var _0x998a=function(_0x472266,_0x13b9aa){_0x472266=_0x472266-0x0;var _0x5ed7ef=_0x98a9[_0x472266];return _0x5ed7ef;};'use strict';var WhatsappInteractionEvents=require(_0x998a('0x0'));var events=[_0x998a('0x1'),_0x998a('0x2'),_0x998a('0x3')];function createListener(_0x47fe98,_0x15a4e3){return function(_0x4055de){_0x15a4e3['emit'](_0x47fe98,_0x4055de);};}function removeListener(_0xc7e06b,_0x5ecc0b){return function(){WhatsappInteractionEvents[_0x998a('0x4')](_0xc7e06b,_0x5ecc0b);};}exports['register']=function(_0xc0323d){for(var _0x52f5a8=0x0,_0x4c4f3e=events[_0x998a('0x5')];_0x52f5a8<_0x4c4f3e;_0x52f5a8++){var _0x242deb=events[_0x52f5a8];var _0x4e939f=createListener(_0x998a('0x6')+_0x242deb,_0xc0323d);WhatsappInteractionEvents['on'](_0x242deb,_0x4e939f);}}; \ No newline at end of file +var _0xae3c=['whatsappInteraction:','./whatsappInteraction.events','remove','emit','removeListener','register'];(function(_0x5e8b31,_0x177999){var _0x453957=function(_0x417ccb){while(--_0x417ccb){_0x5e8b31['push'](_0x5e8b31['shift']());}};_0x453957(++_0x177999);}(_0xae3c,0x18d));var _0xcae3=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0xae3c[_0x4c98b9];return _0x3a257a;};'use strict';var WhatsappInteractionEvents=require(_0xcae3('0x0'));var events=['save',_0xcae3('0x1'),'update'];function createListener(_0x2cc997,_0x668e26){return function(_0x371eb2){_0x668e26[_0xcae3('0x2')](_0x2cc997,_0x371eb2);};}function removeListener(_0x2f5455,_0x302a5d){return function(){WhatsappInteractionEvents[_0xcae3('0x3')](_0x2f5455,_0x302a5d);};}exports[_0xcae3('0x4')]=function(_0x49af7f){for(var _0x491814=0x0,_0x290a2f=events['length'];_0x491814<_0x290a2f;_0x491814++){var _0x489455=events[_0x491814];var _0x49d3b8=createListener(_0xcae3('0x5')+_0x489455,_0x49af7f);WhatsappInteractionEvents['on'](_0x489455,_0x49d3b8);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 762ed7b..7c969fa 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 _0xc857=['get','index','/describe','isAuthenticated','/:id','post','whatsapp','create','/:id/status','put','/:id/reject','reject','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller'];(function(_0x279b67,_0x5f1b9f){var _0x3b7ccd=function(_0x3744ff){while(--_0x3744ff){_0x279b67['push'](_0x279b67['shift']());}};_0x3b7ccd(++_0x5f1b9f);}(_0xc857,0x185));var _0x7c85=function(_0x20073d,_0x5c1c3c){_0x20073d=_0x20073d-0x0;var _0x4ada37=_0xc857[_0x20073d];return _0x4ada37;};'use strict';var multer=require('multer');var util=require(_0x7c85('0x0'));var path=require(_0x7c85('0x1'));var timeout=require('connect-timeout');var express=require(_0x7c85('0x2'));var router=express[_0x7c85('0x3')]();var fs_extra=require(_0x7c85('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7c85('0x5'));var config=require('../../config/environment');var controller=require(_0x7c85('0x6'));router[_0x7c85('0x7')]('/',auth['isAuthenticated'](),controller[_0x7c85('0x8')]);router[_0x7c85('0x7')](_0x7c85('0x9'),auth[_0x7c85('0xa')](),controller['describe']);router[_0x7c85('0x7')](_0x7c85('0xb'),auth[_0x7c85('0xa')](),controller['show']);router[_0x7c85('0xc')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x7c85('0xd'),'whatsappmessage:create'),controller[_0x7c85('0xe')]);router[_0x7c85('0xc')](_0x7c85('0xf'),controller['status']);router[_0x7c85('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['put']('/:id/accept',auth[_0x7c85('0xa')](),controller['accept']);router[_0x7c85('0x10')](_0x7c85('0x11'),auth[_0x7c85('0xa')](),controller[_0x7c85('0x12')]);router[_0x7c85('0x13')]('/:id',auth[_0x7c85('0xa')](),controller[_0x7c85('0x14')]);module[_0x7c85('0x15')]=router; \ No newline at end of file +var _0x0222=['get','/describe','isAuthenticated','describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','accept','/:id/reject','reject','/:id','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','index'];(function(_0x238210,_0x221e48){var _0x1a0430=function(_0x20d299){while(--_0x20d299){_0x238210['push'](_0x238210['shift']());}};_0x1a0430(++_0x221e48);}(_0x0222,0x12c));var _0x2022=function(_0x10e12a,_0x42b0e8){_0x10e12a=_0x10e12a-0x0;var _0x77ddcd=_0x0222[_0x10e12a];return _0x77ddcd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2022('0x0'));var timeout=require('connect-timeout');var express=require(_0x2022('0x1'));var router=express[_0x2022('0x2')]();var fs_extra=require(_0x2022('0x3'));var auth=require(_0x2022('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2022('0x5'));var controller=require(_0x2022('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2022('0x7')]);router[_0x2022('0x8')](_0x2022('0x9'),auth[_0x2022('0xa')](),controller[_0x2022('0xb')]);router[_0x2022('0x8')]('/:id',auth[_0x2022('0xa')](),controller[_0x2022('0xc')]);router[_0x2022('0xd')]('/',auth['isAuthenticated'](),interaction[_0x2022('0xe')](_0x2022('0xf'),_0x2022('0x10')),controller[_0x2022('0x11')]);router[_0x2022('0xd')](_0x2022('0x12'),controller[_0x2022('0x13')]);router[_0x2022('0x14')]('/:id',auth[_0x2022('0xa')](),controller[_0x2022('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x2022('0x16')]);router[_0x2022('0x14')](_0x2022('0x17'),auth[_0x2022('0xa')](),controller[_0x2022('0x18')]);router['delete'](_0x2022('0x19'),auth[_0x2022('0xa')](),controller[_0x2022('0x1a')]);module[_0x2022('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 8893bd3..bf68ffe 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 _0xe526=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe526,0x18c));var _0x6e52=function(_0x58b67f,_0x49272a){_0x58b67f=_0x58b67f-0x0;var _0x5f3f0e=_0xe526[_0x58b67f];return _0x5f3f0e;};'use strict';var Sequelize=require(_0x6e52('0x0'));module[_0x6e52('0x1')]={'body':{'type':Sequelize[_0x6e52('0x2')](_0x6e52('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6e52('0x5')]('in',_0x6e52('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x6e52('0x7')]},'readAt':{'type':Sequelize[_0x6e52('0x8')]},'secret':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6e52('0x7')]},'providerResponse':{'type':Sequelize[_0x6e52('0x2')]}}; \ No newline at end of file +var _0x5fcb=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5fcb,0x141));var _0xb5fc=function(_0x43dc4f,_0x14beab){_0x43dc4f=_0x43dc4f-0x0;var _0x31c2e2=_0x5fcb[_0x43dc4f];return _0x31c2e2;};'use strict';var Sequelize=require(_0xb5fc('0x0'));module[_0xb5fc('0x1')]={'body':{'type':Sequelize[_0xb5fc('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb5fc('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb5fc('0x4')]('in',_0xb5fc('0x5')),'defaultValue':_0xb5fc('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb5fc('0x6')](0xbe)},'phone':{'type':Sequelize[_0xb5fc('0x6')]},'readAt':{'type':Sequelize[_0xb5fc('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb5fc('0x6')]},'providerResponse':{'type':Sequelize[_0xb5fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 00c6d73..19fe1ac 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 _0xedf6=['ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp','RejectMessage','sequelize','User','internal','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','include','find','catch','create','body','describe','whatsapp-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'];(function(_0x1107b5,_0x30f5bc){var _0x3e7b30=function(_0x576298){while(--_0x576298){_0x1107b5['push'](_0x1107b5['shift']());}};_0x3e7b30(++_0x30f5bc);}(_0xedf6,0x1cf));var _0x6edf=function(_0xf4d811,_0x11d532){_0xf4d811=_0xf4d811-0x0;var _0x1677f9=_0xedf6[_0xf4d811];return _0x1677f9;};'use strict';var emlformat=require(_0x6edf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6edf('0x1'));var jsonpatch=require(_0x6edf('0x2'));var rp=require(_0x6edf('0x3'));var moment=require(_0x6edf('0x4'));var BPromise=require(_0x6edf('0x5'));var Mustache=require(_0x6edf('0x6'));var util=require(_0x6edf('0x7'));var path=require(_0x6edf('0x8'));var sox=require(_0x6edf('0x9'));var csv=require(_0x6edf('0xa'));var ejs=require(_0x6edf('0xb'));var fs=require('fs');var fs_extra=require(_0x6edf('0xc'));var _=require(_0x6edf('0xd'));var squel=require(_0x6edf('0xe'));var crypto=require('crypto');var jsforce=require(_0x6edf('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6edf('0xa'));var querystring=require(_0x6edf('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6edf('0x11'));var qs=require(_0x6edf('0x12'));var as=require(_0x6edf('0x13'));var hardwareService=require(_0x6edf('0x14'));var logger=require(_0x6edf('0x15'))(_0x6edf('0x16'));var utils=require('../../config/utils');var config=require(_0x6edf('0x17'));var licenseUtil=require(_0x6edf('0x18'));var db=require(_0x6edf('0x19'))['db'];config[_0x6edf('0x1a')]=_[_0x6edf('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6edf('0x1c'))(new Redis(config[_0x6edf('0x1a')]));require(_0x6edf('0x1d'))[_0x6edf('0x1e')](socket);var jayson=require(_0x6edf('0x1f'));var client=jayson[_0x6edf('0x20')][_0x6edf('0x21')]({'port':0x232c});var client9002=jayson[_0x6edf('0x20')][_0x6edf('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4b8cd3,_0x3ba402,_0x399ee0,_0x15d2e6){return new BPromise(function(_0x3fff94,_0x23e5ac){var _0x1957cc=_0x15d2e6||client;return _0x1957cc[_0x6edf('0x22')](_0x4b8cd3,_0x399ee0)[_0x6edf('0x23')](function(_0x553d1d){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3ba402,_0x6edf('0x24'));logger[_0x6edf('0x25')](_0x6edf('0x26'),_0x3ba402,_0x6edf('0x24'),JSON[_0x6edf('0x27')](_0x553d1d));if(_0x553d1d[_0x6edf('0x28')]){if(_0x553d1d['error'][_0x6edf('0x29')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x3ba402,_0x553d1d['error'][_0x6edf('0x2a')]);return _0x23e5ac(_0x553d1d[_0x6edf('0x28')]['message']);}logger['error'](_0x6edf('0x2b'),_0x3ba402,_0x553d1d[_0x6edf('0x28')]['message']);return _0x3fff94(_0x553d1d[_0x6edf('0x28')]['message']);}else{logger['info'](_0x6edf('0x2b'),_0x3ba402,_0x6edf('0x24'));_0x3fff94(_0x553d1d[_0x6edf('0x2c')]['message']);}})['catch'](function(_0x537c79){logger[_0x6edf('0x28')](_0x6edf('0x2b'),_0x3ba402,_0x537c79);_0x23e5ac(_0x537c79);});});}function respondWithStatusCode(_0x290d46,_0x12a191){_0x12a191=_0x12a191||0xcc;return function(_0x416a79){if(_0x416a79){return _0x290d46['sendStatus'](_0x12a191);}return _0x290d46[_0x6edf('0x2d')](_0x12a191)[_0x6edf('0x2e')]();};}function respondWithResult(_0x4c238d,_0xfb4a45){_0xfb4a45=_0xfb4a45||0xc8;return function(_0x5d9c93){if(_0x5d9c93){return _0x4c238d[_0x6edf('0x2d')](_0xfb4a45)['json'](_0x5d9c93);}};}function respondWithFilteredResult(_0x418c6b,_0x4491f1){return function(_0x2d0aec){if(_0x2d0aec){var _0x3f479a=typeof _0x4491f1[_0x6edf('0x2f')]===_0x6edf('0x30')&&typeof _0x4491f1[_0x6edf('0x31')]===_0x6edf('0x30');var _0x33d361=_0x2d0aec[_0x6edf('0x32')];var _0x318466=_0x3f479a?0x0:_0x4491f1[_0x6edf('0x2f')];var _0x2cd271=_0x3f479a?_0x2d0aec[_0x6edf('0x32')]:_0x4491f1[_0x6edf('0x2f')]+_0x4491f1[_0x6edf('0x31')];var _0x167a02;if(_0x2cd271>=_0x33d361){_0x2cd271=_0x33d361;_0x167a02=0xc8;}else{_0x167a02=0xce;}_0x418c6b['status'](_0x167a02);return _0x418c6b[_0x6edf('0x33')](_0x6edf('0x34'),_0x318466+'-'+_0x2cd271+'/'+_0x33d361)[_0x6edf('0x35')](_0x2d0aec);}return null;};}function patchUpdates(_0x58e648){return function(_0x585a0a){try{jsonpatch[_0x6edf('0x36')](_0x585a0a,_0x58e648,!![]);}catch(_0x46086d){return BPromise[_0x6edf('0x37')](_0x46086d);}return _0x585a0a[_0x6edf('0x38')]();};}function saveUpdates(_0x1f61b5,_0x16266e){return function(_0x3c79c4){if(_0x3c79c4){return _0x3c79c4[_0x6edf('0x39')](_0x1f61b5)[_0x6edf('0x23')](function(_0x2ad221){return _0x2ad221;});}return null;};}function removeEntity(_0x3d192b,_0x55fd5c){return function(_0xf1ce53){if(_0xf1ce53){return _0xf1ce53[_0x6edf('0x3a')]()['then'](function(){_0x3d192b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee097,_0x1fbafc){return function(_0x278405){if(!_0x278405){_0x1ee097[_0x6edf('0x3b')](0x194);}return _0x278405;};}function handleError(_0xfc6b02,_0x10bf83){_0x10bf83=_0x10bf83||0x1f4;return function(_0x4fb4bc){logger[_0x6edf('0x28')](_0x4fb4bc[_0x6edf('0x3c')]);if(_0x4fb4bc[_0x6edf('0x3d')]){delete _0x4fb4bc[_0x6edf('0x3d')];}_0xfc6b02[_0x6edf('0x2d')](_0x10bf83)[_0x6edf('0x3e')](_0x4fb4bc);};}exports[_0x6edf('0x3f')]=function(_0x252b61,_0x43ce85){var _0x45f065={},_0x1c9e35={},_0x81c1b0={'count':0x0,'rows':[]};var _0x400b4b=_[_0x6edf('0x40')](db[_0x6edf('0x41')][_0x6edf('0x42')],function(_0x554dbd){return{'name':_0x554dbd['fieldName'],'type':_0x554dbd[_0x6edf('0x43')][_0x6edf('0x44')]};});_0x1c9e35['model']=_[_0x6edf('0x40')](_0x400b4b,_0x6edf('0x3d'));_0x1c9e35[_0x6edf('0x45')]=_['keys'](_0x252b61[_0x6edf('0x45')]);_0x1c9e35[_0x6edf('0x46')]=_[_0x6edf('0x47')](_0x1c9e35[_0x6edf('0x48')],_0x1c9e35['query']);_0x45f065[_0x6edf('0x49')]=_[_0x6edf('0x47')](_0x1c9e35[_0x6edf('0x48')],qs['fields'](_0x252b61[_0x6edf('0x45')][_0x6edf('0x4a')]));_0x45f065[_0x6edf('0x49')]=_0x45f065[_0x6edf('0x49')][_0x6edf('0x4b')]?_0x45f065[_0x6edf('0x49')]:_0x1c9e35[_0x6edf('0x48')];if(!_0x252b61[_0x6edf('0x45')]['hasOwnProperty'](_0x6edf('0x4c'))){_0x45f065[_0x6edf('0x31')]=qs[_0x6edf('0x31')](_0x252b61[_0x6edf('0x45')]['limit']);_0x45f065[_0x6edf('0x2f')]=qs['offset'](_0x252b61[_0x6edf('0x45')][_0x6edf('0x2f')]);}_0x45f065['order']=qs[_0x6edf('0x4d')](_0x252b61['query'][_0x6edf('0x4d')]);_0x45f065['where']=qs[_0x6edf('0x46')](_['pick'](_0x252b61[_0x6edf('0x45')],_0x1c9e35[_0x6edf('0x46')]),_0x400b4b);if(_0x252b61[_0x6edf('0x45')][_0x6edf('0x4e')]){_0x45f065[_0x6edf('0x4f')]=_[_0x6edf('0x50')](_0x45f065[_0x6edf('0x4f')],{'$or':_[_0x6edf('0x40')](_0x400b4b,function(_0x2d2a1a){if(_0x2d2a1a[_0x6edf('0x43')]!==_0x6edf('0x51')){var _0xc10a3f={};_0xc10a3f[_0x2d2a1a['name']]={'$like':'%'+_0x252b61[_0x6edf('0x45')][_0x6edf('0x4e')]+'%'};return _0xc10a3f;}})});}_0x45f065=_[_0x6edf('0x50')]({},_0x45f065,_0x252b61[_0x6edf('0x52')]);var _0x1b2b52={'where':_0x45f065[_0x6edf('0x4f')]};return db[_0x6edf('0x41')][_0x6edf('0x32')](_0x1b2b52)['then'](function(_0x584212){_0x81c1b0[_0x6edf('0x32')]=_0x584212;if(_0x252b61[_0x6edf('0x45')][_0x6edf('0x53')]){_0x45f065['include']=[{'all':!![]}];}return db[_0x6edf('0x41')][_0x6edf('0x54')](_0x45f065);})[_0x6edf('0x23')](function(_0x22f743){_0x81c1b0[_0x6edf('0x55')]=_0x22f743;return _0x81c1b0;})[_0x6edf('0x23')](respondWithFilteredResult(_0x43ce85,_0x45f065))['catch'](handleError(_0x43ce85,null));};exports['show']=function(_0x3a3df4,_0x529219){var _0x44668a={'raw':!![],'where':{'id':_0x3a3df4[_0x6edf('0x56')]['id']}},_0x44fcc8={};_0x44fcc8['model']=_[_0x6edf('0x57')](db[_0x6edf('0x41')][_0x6edf('0x42')]);_0x44fcc8[_0x6edf('0x45')]=_[_0x6edf('0x57')](_0x3a3df4[_0x6edf('0x45')]);_0x44fcc8['filters']=_[_0x6edf('0x47')](_0x44fcc8[_0x6edf('0x48')],_0x44fcc8[_0x6edf('0x45')]);_0x44668a[_0x6edf('0x49')]=_['intersection'](_0x44fcc8[_0x6edf('0x48')],qs[_0x6edf('0x4a')](_0x3a3df4[_0x6edf('0x45')][_0x6edf('0x4a')]));_0x44668a['attributes']=_0x44668a['attributes'][_0x6edf('0x4b')]?_0x44668a[_0x6edf('0x49')]:_0x44fcc8['model'];if(_0x3a3df4[_0x6edf('0x45')][_0x6edf('0x53')]){_0x44668a[_0x6edf('0x58')]=[{'all':!![]}];}_0x44668a=_['merge']({},_0x44668a,_0x3a3df4['options']);return db['WhatsappMessage'][_0x6edf('0x59')](_0x44668a)[_0x6edf('0x23')](handleEntityNotFound(_0x529219,null))[_0x6edf('0x23')](respondWithResult(_0x529219,null))[_0x6edf('0x5a')](handleError(_0x529219,null));};exports[_0x6edf('0x5b')]=function(_0x518a9f,_0x185cf4){return db['WhatsappMessage'][_0x6edf('0x5b')](_0x518a9f[_0x6edf('0x5c')],{})[_0x6edf('0x23')](respondWithResult(_0x185cf4,0xc9))[_0x6edf('0x5a')](handleError(_0x185cf4,null));};exports[_0x6edf('0x39')]=function(_0x467fcb,_0x4a8a8e){if(_0x467fcb[_0x6edf('0x5c')]['id']){delete _0x467fcb[_0x6edf('0x5c')]['id'];}return db[_0x6edf('0x41')][_0x6edf('0x59')]({'where':{'id':_0x467fcb[_0x6edf('0x56')]['id']}})[_0x6edf('0x23')](handleEntityNotFound(_0x4a8a8e,null))['then'](saveUpdates(_0x467fcb['body'],null))[_0x6edf('0x23')](respondWithResult(_0x4a8a8e,null))[_0x6edf('0x5a')](handleError(_0x4a8a8e,null));};exports[_0x6edf('0x3a')]=function(_0x5f494e,_0x42aa36){return db[_0x6edf('0x41')][_0x6edf('0x59')]({'where':{'id':_0x5f494e[_0x6edf('0x56')]['id']}})[_0x6edf('0x23')](handleEntityNotFound(_0x42aa36,null))[_0x6edf('0x23')](removeEntity(_0x42aa36,null))[_0x6edf('0x5a')](handleError(_0x42aa36,null));};exports[_0x6edf('0x5d')]=function(_0xda3669,_0x2b6c2c){return db[_0x6edf('0x41')][_0x6edf('0x5d')]()[_0x6edf('0x23')](respondWithResult(_0x2b6c2c,null))[_0x6edf('0x5a')](handleError(_0x2b6c2c,null));};var interaction_log=require(_0x6edf('0x15'))(_0x6edf('0x5e'));exports[_0x6edf('0x5f')]=function(_0x36b1a3,_0x3815d4,_0x5cf0d2){var _0x3bf204={'agent':{},'channel':'whatsapp'};if(_0x36b1a3[_0x6edf('0x5c')]['id']){delete _0x36b1a3[_0x6edf('0x5c')]['id'];}_0x36b1a3['body'][_0x6edf('0x60')]=!![];_0x36b1a3['body'][_0x6edf('0x61')]=moment()['format'](_0x6edf('0x62'));_0x36b1a3[_0x6edf('0x5c')][_0x6edf('0x63')]=_0x36b1a3['body'][_0x6edf('0x63')]||_0x36b1a3[_0x6edf('0x64')]['id'];_0x3bf204[_0x6edf('0x65')]['id']=_0x36b1a3[_0x6edf('0x5c')]['UserId'];return db[_0x6edf('0x41')][_0x6edf('0x59')]({'where':{'id':_0x36b1a3['params']['id'],'UserId':null}})[_0x6edf('0x23')](handleEntityNotFound(_0x3815d4,null))[_0x6edf('0x23')](saveUpdates(_0x36b1a3[_0x6edf('0x5c')],null))['then'](function(_0x1861e4){if(_0x1861e4){_0x3bf204['message']=_0x1861e4[_0x6edf('0x66')]({'plain':!![]});return db[_0x6edf('0x67')][_0x6edf('0x59')]({'where':{'id':_0x1861e4[_0x6edf('0x68')]}});}return null;})[_0x6edf('0x23')](handleEntityNotFound(_0x3815d4,null))['then'](function(_0x21c973){if(_0x21c973){return _0x21c973[_0x6edf('0x39')]({'UserId':_0x36b1a3['body'][_0x6edf('0x63')],'read1stAt':_[_0x6edf('0x69')](_0x21c973['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6edf('0x23')](function(_0x25a053){if(_0x25a053){_0x3bf204['interaction']=_0x25a053['get']({'plain':!![]});interaction_log[_0x6edf('0x6a')](_0x6edf('0x6b'),_0x36b1a3['user']['id'],_0x36b1a3[_0x6edf('0x64')][_0x6edf('0x3d')],_0x36b1a3[_0x6edf('0x64')][_0x6edf('0x6c')],_0x3bf204[_0x6edf('0x6d')]['id'],_0x36b1a3[_0x6edf('0x5c')]?JSON[_0x6edf('0x27')](_0x36b1a3[_0x6edf('0x5c')]):_0x6edf('0x6e'));return respondWithRpcPromise(_0x6edf('0x6f'),'acceptMessage',_0x3bf204);}return null;})[_0x6edf('0x23')](function(_0x1a57b4){var _0x2c4bf0=_0x6edf('0x70')+_0x1a57b4[_0x6edf('0x2a')][_0x6edf('0x71')];return db['sequelize']['query'](_0x2c4bf0,{'type':db[_0x6edf('0x72')][_0x6edf('0x73')][_0x6edf('0x74')],'raw':!![]})[_0x6edf('0x23')](function(_0x2fd2a4){return _0x2fd2a4;});})[_0x6edf('0x23')](function(_0x5d60fe){if(_0x5d60fe){_0x3bf204[_0x6edf('0x2a')][_0x6edf('0x75')]=_0x5d60fe[0x0];if(!_0x36b1a3[_0x6edf('0x5c')]['UserId'])return;return db['User']['find']({'where':{'id':_0x36b1a3[_0x6edf('0x5c')]['UserId'],'role':_0x6edf('0x65')},'attributes':['id',_0x6edf('0x3d'),_0x6edf('0x76'),_0x6edf('0x77'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4df429){if(!_0x4df429)return null;_0x3bf204['message'][_0x6edf('0x65')]=_0x4df429;return _0x3bf204;})[_0x6edf('0x23')](function(_0xfead7){if(_0xfead7){if(_0x36b1a3['body'][_0x6edf('0x78')]){_0x3bf204[_0x6edf('0x2a')][_0x6edf('0x79')]=util[_0x6edf('0x7a')](_0x6edf('0x7b'),_0x36b1a3['user'][_0x6edf('0x3d')]);_0x3bf204[_0x6edf('0x2a')][_0x6edf('0x7c')]=_0x3bf204[_0x6edf('0x7c')];_0x3bf204['message'][_0x6edf('0x7d')]=_0x3bf204['channel'];_0x3bf204[_0x6edf('0x2a')][_0x6edf('0x7e')]=_0x6edf('0x5f');return respondWithRpcPromise('EventManager',_0x6edf('0x7f'),{'event':_0x6edf('0x80'),'message':_0x3bf204[_0x6edf('0x2a')]},client9002)[_0x6edf('0x23')](function(){return _0x3bf204;});}return _0x3bf204;}return null;})[_0x6edf('0x23')](respondWithResult(_0x3815d4,null))[_0x6edf('0x5a')](handleError(_0x3815d4,null));};var interaction_log=require(_0x6edf('0x15'))(_0x6edf('0x5e'));exports['reject']=function(_0x4392e2,_0x1c7c0b,_0x3e72ba){var _0x2ecd6d={'agent':{},'channel':_0x6edf('0x81')};if(_0x4392e2['body']['id']){delete _0x4392e2[_0x6edf('0x5c')]['id'];}_0x4392e2[_0x6edf('0x5c')][_0x6edf('0x63')]=_0x4392e2[_0x6edf('0x5c')][_0x6edf('0x63')]||_0x4392e2[_0x6edf('0x64')]['id'];_0x2ecd6d[_0x6edf('0x65')]['id']=_0x4392e2['body']['UserId'];return db[_0x6edf('0x41')][_0x6edf('0x59')]({'where':{'id':_0x4392e2[_0x6edf('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1c7c0b,null))['then'](function(_0x4cbec2){if(_0x4cbec2){_0x2ecd6d['message']=_0x4cbec2[_0x6edf('0x66')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x4cbec2[_0x6edf('0x68')]}});}return null;})[_0x6edf('0x23')](handleEntityNotFound(_0x1c7c0b,null))[_0x6edf('0x23')](function(_0x19bb2a){if(_0x19bb2a){_0x2ecd6d['interaction']=_0x19bb2a[_0x6edf('0x66')]({'plain':!![]});interaction_log[_0x6edf('0x6a')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4392e2[_0x6edf('0x64')]['id'],_0x4392e2['user'][_0x6edf('0x3d')],_0x4392e2['user']['role'],_0x2ecd6d[_0x6edf('0x6d')]['id'],_0x4392e2['body']?JSON[_0x6edf('0x27')](_0x4392e2[_0x6edf('0x5c')]):_0x6edf('0x6e'));return respondWithRpcPromise(_0x6edf('0x82'),'rejectMessage',_0x2ecd6d);}return null;})[_0x6edf('0x23')](function(_0x41eb72){var _0x2e8e5=_0x6edf('0x70')+_0x41eb72['message'][_0x6edf('0x71')];return db[_0x6edf('0x83')]['query'](_0x2e8e5,{'type':db[_0x6edf('0x72')][_0x6edf('0x73')][_0x6edf('0x74')],'raw':!![]})[_0x6edf('0x23')](function(_0x55551b){return _0x55551b;});})['then'](function(_0x1796bb){if(_0x1796bb){_0x2ecd6d[_0x6edf('0x2a')][_0x6edf('0x75')]=_0x1796bb[0x0];if(!_0x4392e2[_0x6edf('0x5c')][_0x6edf('0x63')])return;return db[_0x6edf('0x84')]['find']({'where':{'id':_0x4392e2[_0x6edf('0x5c')][_0x6edf('0x63')],'role':_0x6edf('0x65')},'attributes':['id',_0x6edf('0x3d'),_0x6edf('0x76'),_0x6edf('0x77'),_0x6edf('0x85')],'raw':!![]});}return null;})[_0x6edf('0x23')](function(_0x2877cc){if(!_0x2877cc)return null;_0x2ecd6d[_0x6edf('0x2a')][_0x6edf('0x65')]=_0x2877cc;return _0x2ecd6d;})['then'](function(_0x43f870){if(_0x43f870){_0x43f870[_0x6edf('0x2a')][_0x6edf('0x79')]=util[_0x6edf('0x7a')](_0x6edf('0x7b'),_0x4392e2[_0x6edf('0x64')][_0x6edf('0x3d')]);_0x43f870[_0x6edf('0x2a')][_0x6edf('0x7c')]=_0x2ecd6d[_0x6edf('0x7c')];_0x43f870[_0x6edf('0x2a')]['motionChannel']=_0x2ecd6d['channel'];_0x43f870[_0x6edf('0x2a')][_0x6edf('0x7e')]=_0x6edf('0x37');respondWithRpcPromise(_0x6edf('0x7f'),_0x6edf('0x7f'),{'event':_0x6edf('0x86'),'message':_0x43f870['message']},client9002);return _0x2ecd6d;}return null;})['then'](respondWithResult(_0x1c7c0b,null))['catch'](handleError(_0x1c7c0b,null));};exports[_0x6edf('0x2d')]=function(_0x33bdd7,_0x5183a3,_0x4b2d44){if(_0x33bdd7[_0x6edf('0x5c')]['id']){delete _0x33bdd7['body']['id'];}var _0x51b4e3;return db[_0x6edf('0x41')][_0x6edf('0x59')]({'where':{'id':_0x33bdd7[_0x6edf('0x56')]['id']}})[_0x6edf('0x23')](handleEntityNotFound(_0x5183a3,null))[_0x6edf('0x23')](function(_0x27f85e){if(_0x27f85e){_0x51b4e3=_0x27f85e;return db['WhatsappAccount'][_0x6edf('0x59')]({'where':{'id':_0x27f85e[_0x6edf('0x87')]}});}})[_0x6edf('0x23')](handleEntityNotFound(_0x5183a3,null))[_0x6edf('0x23')](function(_0x5e7949){if(_0x5e7949){logger[_0x6edf('0x25')](_0x6edf('0x88'),_0x6edf('0x2d'),_0x6edf('0x89'),_0x5e7949['type'],util[_0x6edf('0x8a')](_0x33bdd7[_0x6edf('0x5c')],{'showHidden':![],'depth':null}));switch(_0x5e7949[_0x6edf('0x43')]){case'twilio':if(_0x33bdd7['body'][_0x6edf('0x8b')]&&_0x33bdd7[_0x6edf('0x5c')][_0x6edf('0x8b')]===_0x51b4e3[_0x6edf('0x8c')]&&_0x33bdd7[_0x6edf('0x5c')][_0x6edf('0x8d')]&&_0x33bdd7[_0x6edf('0x5c')]['MessageStatus']===_0x6edf('0x60')){return _0x51b4e3['update']({'read':!![]});}else{logger[_0x6edf('0x28')](_0x6edf('0x8e'),_0x6edf('0x2d'),_0x6edf('0x8f'),util[_0x6edf('0x8a')](_0x33bdd7[_0x6edf('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x51b4e3;}})[_0x6edf('0x23')](respondWithResult(_0x5183a3,null))[_0x6edf('0x5a')](handleError(_0x5183a3,null));}; \ No newline at end of file +var _0xa60a=['event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SELECT','interface','motionChannel','reject','rejectmessage','WhatsappAccount','debug','received\x20delivery\x20report\x20from','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','catch','create','body','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','SIP/%s','user','channel'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa60a,0x1b2));var _0xaa60=function(_0x143be9,_0x5aa1f1){_0x143be9=_0x143be9-0x0;var _0x9e536=_0xa60a[_0x143be9];return _0x9e536;};'use strict';var emlformat=require(_0xaa60('0x0'));var rimraf=require(_0xaa60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa60('0x2'));var rp=require('request-promise');var moment=require(_0xaa60('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa60('0x4'));var path=require(_0xaa60('0x5'));var sox=require(_0xaa60('0x6'));var csv=require(_0xaa60('0x7'));var ejs=require(_0xaa60('0x8'));var fs=require('fs');var fs_extra=require(_0xaa60('0x9'));var _=require(_0xaa60('0xa'));var squel=require('squel');var crypto=require(_0xaa60('0xb'));var jsforce=require(_0xaa60('0xc'));var deskjs=require(_0xaa60('0xd'));var toCsv=require(_0xaa60('0x7'));var querystring=require(_0xaa60('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa60('0xf'));var qs=require(_0xaa60('0x10'));var as=require(_0xaa60('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa60('0x12'))(_0xaa60('0x13'));var utils=require('../../config/utils');var config=require(_0xaa60('0x14'));var licenseUtil=require(_0xaa60('0x15'));var db=require(_0xaa60('0x16'))['db'];config[_0xaa60('0x17')]=_['defaults'](config[_0xaa60('0x17')],{'host':_0xaa60('0x18'),'port':0x18eb});var socket=require(_0xaa60('0x19'))(new Redis(config['redis']));require(_0xaa60('0x1a'))[_0xaa60('0x1b')](socket);var jayson=require(_0xaa60('0x1c'));var client=jayson[_0xaa60('0x1d')][_0xaa60('0x1e')]({'port':0x232c});var client9002=jayson[_0xaa60('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd2eeae,_0x3cdb6c,_0x2a8a72,_0x57a9fc){return new BPromise(function(_0x5cc759,_0xc5b21f){var _0x228b7c=_0x57a9fc||client;return _0x228b7c[_0xaa60('0x1f')](_0xd2eeae,_0x2a8a72)['then'](function(_0x465528){logger[_0xaa60('0x20')](_0xaa60('0x21'),_0x3cdb6c,_0xaa60('0x22'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3cdb6c,_0xaa60('0x22'),JSON['stringify'](_0x465528));if(_0x465528[_0xaa60('0x23')]){if(_0x465528[_0xaa60('0x23')][_0xaa60('0x24')]===0x1f4){logger[_0xaa60('0x23')](_0xaa60('0x21'),_0x3cdb6c,_0x465528[_0xaa60('0x23')][_0xaa60('0x25')]);return _0xc5b21f(_0x465528['error'][_0xaa60('0x25')]);}logger[_0xaa60('0x23')](_0xaa60('0x21'),_0x3cdb6c,_0x465528[_0xaa60('0x23')][_0xaa60('0x25')]);return _0x5cc759(_0x465528[_0xaa60('0x23')]['message']);}else{logger['info'](_0xaa60('0x21'),_0x3cdb6c,_0xaa60('0x22'));_0x5cc759(_0x465528[_0xaa60('0x26')][_0xaa60('0x25')]);}})['catch'](function(_0x4e2fab){logger[_0xaa60('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x3cdb6c,_0x4e2fab);_0xc5b21f(_0x4e2fab);});});}function respondWithStatusCode(_0x22f1ee,_0x59c3a5){_0x59c3a5=_0x59c3a5||0xcc;return function(_0x53e188){if(_0x53e188){return _0x22f1ee[_0xaa60('0x27')](_0x59c3a5);}return _0x22f1ee[_0xaa60('0x28')](_0x59c3a5)[_0xaa60('0x29')]();};}function respondWithResult(_0x42e838,_0x4bdabe){_0x4bdabe=_0x4bdabe||0xc8;return function(_0x3af1d0){if(_0x3af1d0){return _0x42e838[_0xaa60('0x28')](_0x4bdabe)[_0xaa60('0x2a')](_0x3af1d0);}};}function respondWithFilteredResult(_0x54f56c,_0x381693){return function(_0x2a9450){if(_0x2a9450){var _0x1be0a7=typeof _0x381693[_0xaa60('0x2b')]==='undefined'&&typeof _0x381693['limit']===_0xaa60('0x2c');var _0x4f92a4=_0x2a9450[_0xaa60('0x2d')];var _0x46a58b=_0x1be0a7?0x0:_0x381693[_0xaa60('0x2b')];var _0x17c4b4=_0x1be0a7?_0x2a9450[_0xaa60('0x2d')]:_0x381693[_0xaa60('0x2b')]+_0x381693[_0xaa60('0x2e')];var _0x10342c;if(_0x17c4b4>=_0x4f92a4){_0x17c4b4=_0x4f92a4;_0x10342c=0xc8;}else{_0x10342c=0xce;}_0x54f56c['status'](_0x10342c);return _0x54f56c[_0xaa60('0x2f')](_0xaa60('0x30'),_0x46a58b+'-'+_0x17c4b4+'/'+_0x4f92a4)[_0xaa60('0x2a')](_0x2a9450);}return null;};}function patchUpdates(_0x548a71){return function(_0x5d34a0){try{jsonpatch[_0xaa60('0x31')](_0x5d34a0,_0x548a71,!![]);}catch(_0x11944c){return BPromise['reject'](_0x11944c);}return _0x5d34a0[_0xaa60('0x32')]();};}function saveUpdates(_0x9e1397,_0x113e24){return function(_0x511bb4){if(_0x511bb4){return _0x511bb4[_0xaa60('0x33')](_0x9e1397)[_0xaa60('0x34')](function(_0x4abc8a){return _0x4abc8a;});}return null;};}function removeEntity(_0x1bdc34,_0x1f208c){return function(_0x4ee660){if(_0x4ee660){return _0x4ee660['destroy']()['then'](function(){_0x1bdc34[_0xaa60('0x28')](0xcc)[_0xaa60('0x29')]();});}};}function handleEntityNotFound(_0x1e1cad,_0x2fd413){return function(_0x545604){if(!_0x545604){_0x1e1cad[_0xaa60('0x27')](0x194);}return _0x545604;};}function handleError(_0x59c886,_0x7bb899){_0x7bb899=_0x7bb899||0x1f4;return function(_0x3a4ed5){logger[_0xaa60('0x23')](_0x3a4ed5[_0xaa60('0x35')]);if(_0x3a4ed5[_0xaa60('0x36')]){delete _0x3a4ed5[_0xaa60('0x36')];}_0x59c886[_0xaa60('0x28')](_0x7bb899)[_0xaa60('0x37')](_0x3a4ed5);};}exports['index']=function(_0x18af36,_0x580b36){var _0x184fac={},_0x1ca4c={},_0x5b9ba0={'count':0x0,'rows':[]};var _0x597df2=_[_0xaa60('0x38')](db[_0xaa60('0x39')][_0xaa60('0x3a')],function(_0x454613){return{'name':_0x454613[_0xaa60('0x3b')],'type':_0x454613['type'][_0xaa60('0x3c')]};});_0x1ca4c['model']=_[_0xaa60('0x38')](_0x597df2,_0xaa60('0x36'));_0x1ca4c[_0xaa60('0x3d')]=_[_0xaa60('0x3e')](_0x18af36[_0xaa60('0x3d')]);_0x1ca4c[_0xaa60('0x3f')]=_[_0xaa60('0x40')](_0x1ca4c[_0xaa60('0x41')],_0x1ca4c[_0xaa60('0x3d')]);_0x184fac[_0xaa60('0x42')]=_[_0xaa60('0x40')](_0x1ca4c['model'],qs[_0xaa60('0x43')](_0x18af36[_0xaa60('0x3d')]['fields']));_0x184fac['attributes']=_0x184fac[_0xaa60('0x42')][_0xaa60('0x44')]?_0x184fac['attributes']:_0x1ca4c[_0xaa60('0x41')];if(!_0x18af36['query'][_0xaa60('0x45')](_0xaa60('0x46'))){_0x184fac[_0xaa60('0x2e')]=qs['limit'](_0x18af36[_0xaa60('0x3d')][_0xaa60('0x2e')]);_0x184fac[_0xaa60('0x2b')]=qs[_0xaa60('0x2b')](_0x18af36[_0xaa60('0x3d')][_0xaa60('0x2b')]);}_0x184fac['order']=qs[_0xaa60('0x47')](_0x18af36[_0xaa60('0x3d')]['sort']);_0x184fac[_0xaa60('0x48')]=qs['filters'](_[_0xaa60('0x49')](_0x18af36[_0xaa60('0x3d')],_0x1ca4c[_0xaa60('0x3f')]),_0x597df2);if(_0x18af36[_0xaa60('0x3d')]['filter']){_0x184fac[_0xaa60('0x48')]=_[_0xaa60('0x4a')](_0x184fac['where'],{'$or':_[_0xaa60('0x38')](_0x597df2,function(_0x2352d0){if(_0x2352d0[_0xaa60('0x4b')]!==_0xaa60('0x4c')){var _0x4e017c={};_0x4e017c[_0x2352d0[_0xaa60('0x36')]]={'$like':'%'+_0x18af36[_0xaa60('0x3d')][_0xaa60('0x4d')]+'%'};return _0x4e017c;}})});}_0x184fac=_[_0xaa60('0x4a')]({},_0x184fac,_0x18af36[_0xaa60('0x4e')]);var _0x537468={'where':_0x184fac[_0xaa60('0x48')]};return db[_0xaa60('0x39')][_0xaa60('0x2d')](_0x537468)[_0xaa60('0x34')](function(_0x46a06f){_0x5b9ba0['count']=_0x46a06f;if(_0x18af36[_0xaa60('0x3d')][_0xaa60('0x4f')]){_0x184fac[_0xaa60('0x50')]=[{'all':!![]}];}return db[_0xaa60('0x39')]['findAll'](_0x184fac);})[_0xaa60('0x34')](function(_0x69ea5d){_0x5b9ba0[_0xaa60('0x51')]=_0x69ea5d;return _0x5b9ba0;})[_0xaa60('0x34')](respondWithFilteredResult(_0x580b36,_0x184fac))['catch'](handleError(_0x580b36,null));};exports[_0xaa60('0x52')]=function(_0x475246,_0x41c765){var _0xde64b2={'raw':!![],'where':{'id':_0x475246[_0xaa60('0x53')]['id']}},_0x51777f={};_0x51777f[_0xaa60('0x41')]=_[_0xaa60('0x3e')](db[_0xaa60('0x39')]['rawAttributes']);_0x51777f['query']=_['keys'](_0x475246[_0xaa60('0x3d')]);_0x51777f[_0xaa60('0x3f')]=_['intersection'](_0x51777f[_0xaa60('0x41')],_0x51777f[_0xaa60('0x3d')]);_0xde64b2[_0xaa60('0x42')]=_['intersection'](_0x51777f[_0xaa60('0x41')],qs['fields'](_0x475246[_0xaa60('0x3d')][_0xaa60('0x43')]));_0xde64b2[_0xaa60('0x42')]=_0xde64b2[_0xaa60('0x42')][_0xaa60('0x44')]?_0xde64b2[_0xaa60('0x42')]:_0x51777f['model'];if(_0x475246['query']['includeAll']){_0xde64b2[_0xaa60('0x50')]=[{'all':!![]}];}_0xde64b2=_[_0xaa60('0x4a')]({},_0xde64b2,_0x475246[_0xaa60('0x4e')]);return db[_0xaa60('0x39')][_0xaa60('0x54')](_0xde64b2)['then'](handleEntityNotFound(_0x41c765,null))['then'](respondWithResult(_0x41c765,null))[_0xaa60('0x55')](handleError(_0x41c765,null));};exports[_0xaa60('0x56')]=function(_0x436bb2,_0x43f1a3){return db['WhatsappMessage'][_0xaa60('0x56')](_0x436bb2[_0xaa60('0x57')],{})[_0xaa60('0x34')](respondWithResult(_0x43f1a3,0xc9))[_0xaa60('0x55')](handleError(_0x43f1a3,null));};exports[_0xaa60('0x33')]=function(_0x780231,_0x2bcb3a){if(_0x780231[_0xaa60('0x57')]['id']){delete _0x780231[_0xaa60('0x57')]['id'];}return db['WhatsappMessage'][_0xaa60('0x54')]({'where':{'id':_0x780231[_0xaa60('0x53')]['id']}})[_0xaa60('0x34')](handleEntityNotFound(_0x2bcb3a,null))[_0xaa60('0x34')](saveUpdates(_0x780231[_0xaa60('0x57')],null))[_0xaa60('0x34')](respondWithResult(_0x2bcb3a,null))['catch'](handleError(_0x2bcb3a,null));};exports['destroy']=function(_0x3a1d31,_0x2fc4f7){return db[_0xaa60('0x39')][_0xaa60('0x54')]({'where':{'id':_0x3a1d31[_0xaa60('0x53')]['id']}})[_0xaa60('0x34')](handleEntityNotFound(_0x2fc4f7,null))[_0xaa60('0x34')](removeEntity(_0x2fc4f7,null))[_0xaa60('0x55')](handleError(_0x2fc4f7,null));};exports[_0xaa60('0x58')]=function(_0x266f5b,_0x5e3468){return db['WhatsappMessage'][_0xaa60('0x58')]()[_0xaa60('0x34')](respondWithResult(_0x5e3468,null))[_0xaa60('0x55')](handleError(_0x5e3468,null));};var interaction_log=require(_0xaa60('0x12'))(_0xaa60('0x59'));exports[_0xaa60('0x5a')]=function(_0x40d44f,_0x3d572d,_0xde4e8){var _0x3a3c20={'agent':{},'channel':'whatsapp'};if(_0x40d44f[_0xaa60('0x57')]['id']){delete _0x40d44f[_0xaa60('0x57')]['id'];}_0x40d44f[_0xaa60('0x57')][_0xaa60('0x5b')]=!![];_0x40d44f[_0xaa60('0x57')][_0xaa60('0x5c')]=moment()[_0xaa60('0x5d')](_0xaa60('0x5e'));_0x40d44f[_0xaa60('0x57')][_0xaa60('0x5f')]=_0x40d44f[_0xaa60('0x57')][_0xaa60('0x5f')]||_0x40d44f['user']['id'];_0x3a3c20['agent']['id']=_0x40d44f['body'][_0xaa60('0x5f')];return db[_0xaa60('0x39')]['find']({'where':{'id':_0x40d44f[_0xaa60('0x53')]['id'],'UserId':null}})[_0xaa60('0x34')](handleEntityNotFound(_0x3d572d,null))[_0xaa60('0x34')](saveUpdates(_0x40d44f[_0xaa60('0x57')],null))[_0xaa60('0x34')](function(_0x1ebfa9){if(_0x1ebfa9){_0x3a3c20[_0xaa60('0x25')]=_0x1ebfa9[_0xaa60('0x60')]({'plain':!![]});return db['WhatsappInteraction'][_0xaa60('0x54')]({'where':{'id':_0x1ebfa9[_0xaa60('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x3d572d,null))[_0xaa60('0x34')](function(_0x1d68de){if(_0x1d68de){return _0x1d68de[_0xaa60('0x33')]({'UserId':_0x40d44f[_0xaa60('0x57')][_0xaa60('0x5f')],'read1stAt':_['isNil'](_0x1d68de[_0xaa60('0x62')])?moment()['format'](_0xaa60('0x5e')):undefined});}return null;})[_0xaa60('0x34')](function(_0x36dc48){if(_0x36dc48){_0x3a3c20[_0xaa60('0x63')]=_0x36dc48['get']({'plain':!![]});interaction_log[_0xaa60('0x20')](_0xaa60('0x64'),_0x40d44f['user']['id'],_0x40d44f['user']['name'],_0x40d44f['user'][_0xaa60('0x65')],_0x3a3c20[_0xaa60('0x63')]['id'],_0x40d44f[_0xaa60('0x57')]?JSON['stringify'](_0x40d44f[_0xaa60('0x57')]):_0xaa60('0x66'));return respondWithRpcPromise(_0xaa60('0x67'),'acceptMessage',_0x3a3c20);}return null;})['then'](function(_0x1a80a4){var _0x455034=_0xaa60('0x68')+_0x1a80a4[_0xaa60('0x25')][_0xaa60('0x69')];return db[_0xaa60('0x6a')][_0xaa60('0x3d')](_0x455034,{'type':db[_0xaa60('0x6b')][_0xaa60('0x6c')]['SELECT'],'raw':!![]})[_0xaa60('0x34')](function(_0x35834f){return _0x35834f;});})[_0xaa60('0x34')](function(_0x1bab81){if(_0x1bab81){_0x3a3c20[_0xaa60('0x25')][_0xaa60('0x6d')]=_0x1bab81[0x0];if(!_0x40d44f[_0xaa60('0x57')][_0xaa60('0x5f')])return;return db[_0xaa60('0x6e')][_0xaa60('0x54')]({'where':{'id':_0x40d44f['body'][_0xaa60('0x5f')],'role':_0xaa60('0x6f')},'attributes':['id','name',_0xaa60('0x70'),_0xaa60('0x71'),_0xaa60('0x72')],'raw':!![]});}return null;})[_0xaa60('0x34')](function(_0x5b159a){if(!_0x5b159a)return null;_0x3a3c20[_0xaa60('0x25')][_0xaa60('0x6f')]=_0x5b159a;return _0x3a3c20;})[_0xaa60('0x34')](function(_0x5dc445){if(_0x5dc445){if(_0x40d44f[_0xaa60('0x57')]['manual']){_0x3a3c20[_0xaa60('0x25')]['interface']=util[_0xaa60('0x5d')](_0xaa60('0x73'),_0x40d44f[_0xaa60('0x74')]['name']);_0x3a3c20[_0xaa60('0x25')][_0xaa60('0x75')]=_0x3a3c20[_0xaa60('0x75')];_0x3a3c20['message']['motionChannel']=_0x3a3c20['channel'];_0x3a3c20['message'][_0xaa60('0x76')]=_0xaa60('0x5a');return respondWithRpcPromise(_0xaa60('0x77'),_0xaa60('0x77'),{'event':_0xaa60('0x78'),'message':_0x3a3c20[_0xaa60('0x25')]},client9002)[_0xaa60('0x34')](function(){return _0x3a3c20;});}return _0x3a3c20;}return null;})['then'](respondWithResult(_0x3d572d,null))[_0xaa60('0x55')](handleError(_0x3d572d,null));};var interaction_log=require(_0xaa60('0x12'))(_0xaa60('0x59'));exports['reject']=function(_0x2cff8e,_0x23d30d,_0x4f8b0c){var _0x194661={'agent':{},'channel':'whatsapp'};if(_0x2cff8e['body']['id']){delete _0x2cff8e[_0xaa60('0x57')]['id'];}_0x2cff8e[_0xaa60('0x57')]['UserId']=_0x2cff8e['body'][_0xaa60('0x5f')]||_0x2cff8e[_0xaa60('0x74')]['id'];_0x194661[_0xaa60('0x6f')]['id']=_0x2cff8e[_0xaa60('0x57')][_0xaa60('0x5f')];return db[_0xaa60('0x39')]['find']({'where':{'id':_0x2cff8e[_0xaa60('0x53')]['id'],'UserId':null}})[_0xaa60('0x34')](handleEntityNotFound(_0x23d30d,null))[_0xaa60('0x34')](function(_0x83d0bc){if(_0x83d0bc){_0x194661[_0xaa60('0x25')]=_0x83d0bc[_0xaa60('0x60')]({'plain':!![]});return db[_0xaa60('0x79')][_0xaa60('0x54')]({'where':{'id':_0x83d0bc[_0xaa60('0x61')]}});}return null;})[_0xaa60('0x34')](handleEntityNotFound(_0x23d30d,null))[_0xaa60('0x34')](function(_0x1b5315){if(_0x1b5315){_0x194661[_0xaa60('0x63')]=_0x1b5315[_0xaa60('0x60')]({'plain':!![]});interaction_log['info'](_0xaa60('0x7a'),_0x2cff8e[_0xaa60('0x74')]['id'],_0x2cff8e[_0xaa60('0x74')][_0xaa60('0x36')],_0x2cff8e[_0xaa60('0x74')][_0xaa60('0x65')],_0x194661[_0xaa60('0x63')]['id'],_0x2cff8e[_0xaa60('0x57')]?JSON[_0xaa60('0x7b')](_0x2cff8e['body']):'null');return respondWithRpcPromise(_0xaa60('0x7c'),_0xaa60('0x7d'),_0x194661);}return null;})[_0xaa60('0x34')](function(_0x8d8617){var _0x23c6ca=_0xaa60('0x68')+_0x8d8617[_0xaa60('0x25')]['ContactId'];return db[_0xaa60('0x6a')]['query'](_0x23c6ca,{'type':db['Sequelize'][_0xaa60('0x6c')][_0xaa60('0x7e')],'raw':!![]})[_0xaa60('0x34')](function(_0x57e241){return _0x57e241;});})[_0xaa60('0x34')](function(_0x41f729){if(_0x41f729){_0x194661[_0xaa60('0x25')]['contact']=_0x41f729[0x0];if(!_0x2cff8e[_0xaa60('0x57')][_0xaa60('0x5f')])return;return db['User'][_0xaa60('0x54')]({'where':{'id':_0x2cff8e[_0xaa60('0x57')][_0xaa60('0x5f')],'role':'agent'},'attributes':['id',_0xaa60('0x36'),_0xaa60('0x70'),_0xaa60('0x71'),'internal'],'raw':!![]});}return null;})[_0xaa60('0x34')](function(_0x4b4538){if(!_0x4b4538)return null;_0x194661[_0xaa60('0x25')][_0xaa60('0x6f')]=_0x4b4538;return _0x194661;})['then'](function(_0x448839){if(_0x448839){_0x448839[_0xaa60('0x25')][_0xaa60('0x7f')]=util[_0xaa60('0x5d')](_0xaa60('0x73'),_0x2cff8e[_0xaa60('0x74')][_0xaa60('0x36')]);_0x448839[_0xaa60('0x25')][_0xaa60('0x75')]=_0x194661['channel'];_0x448839[_0xaa60('0x25')][_0xaa60('0x80')]=_0x194661[_0xaa60('0x75')];_0x448839['message'][_0xaa60('0x76')]=_0xaa60('0x81');respondWithRpcPromise(_0xaa60('0x77'),'EventManager',{'event':_0xaa60('0x82'),'message':_0x448839[_0xaa60('0x25')]},client9002);return _0x194661;}return null;})[_0xaa60('0x34')](respondWithResult(_0x23d30d,null))[_0xaa60('0x55')](handleError(_0x23d30d,null));};exports[_0xaa60('0x28')]=function(_0x23e8b1,_0x341549,_0x50596c){if(_0x23e8b1[_0xaa60('0x57')]['id']){delete _0x23e8b1[_0xaa60('0x57')]['id'];}var _0x8defd1;return db[_0xaa60('0x39')]['find']({'where':{'id':_0x23e8b1[_0xaa60('0x53')]['id']}})[_0xaa60('0x34')](handleEntityNotFound(_0x341549,null))[_0xaa60('0x34')](function(_0x19aa7c){if(_0x19aa7c){_0x8defd1=_0x19aa7c;return db[_0xaa60('0x83')][_0xaa60('0x54')]({'where':{'id':_0x19aa7c['WhatsappAccountId']}});}})[_0xaa60('0x34')](handleEntityNotFound(_0x341549,null))['then'](function(_0x10c2db){if(_0x10c2db){logger[_0xaa60('0x84')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xaa60('0x28'),_0xaa60('0x85'),_0x10c2db[_0xaa60('0x4b')],util['inspect'](_0x23e8b1[_0xaa60('0x57')],{'showHidden':![],'depth':null}));switch(_0x10c2db[_0xaa60('0x4b')]){case'twilio':if(_0x23e8b1[_0xaa60('0x57')]['MessageSid']&&_0x23e8b1['body']['MessageSid']===_0x8defd1[_0xaa60('0x86')]&&_0x23e8b1[_0xaa60('0x57')]['MessageStatus']&&_0x23e8b1[_0xaa60('0x57')]['MessageStatus']===_0xaa60('0x5b')){return _0x8defd1[_0xaa60('0x33')]({'read':!![]});}else{logger[_0xaa60('0x23')](_0xaa60('0x87'),'status',_0xaa60('0x88'),util[_0xaa60('0x89')](_0x23e8b1[_0xaa60('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x8defd1;}})[_0xaa60('0x34')](respondWithResult(_0x341549,null))[_0xaa60('0x55')](handleError(_0x341549,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 4ffd425..ab95a77 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 _0xd523=['remove','emit','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','update'];(function(_0x21da59,_0x45ae75){var _0x5023f1=function(_0x1a6fd3){while(--_0x1a6fd3){_0x21da59['push'](_0x21da59['shift']());}};_0x5023f1(++_0x45ae75);}(_0xd523,0x153));var _0x3d52=function(_0x2cea55,_0x5806ae){_0x2cea55=_0x2cea55-0x0;var _0x1094d0=_0xd523[_0x2cea55];return _0x1094d0;};'use strict';var EventEmitter=require(_0x3d52('0x0'));var WhatsappMessage=require(_0x3d52('0x1'))['db'][_0x3d52('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x3d52('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3d52('0x4'),'afterDestroy':_0x3d52('0x5')};function emitEvent(_0x2752e7){return function(_0x5103d8,_0x24d3af,_0x3dfd00){WhatsappMessageEvents[_0x3d52('0x6')](_0x2752e7+':'+_0x5103d8['id'],_0x5103d8);WhatsappMessageEvents[_0x3d52('0x6')](_0x2752e7,_0x5103d8);_0x3dfd00(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x3d52('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x0713=['exports','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x3071('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x3071('0x1')](0x0);var events={'afterCreate':_0x3071('0x2'),'afterUpdate':_0x3071('0x3'),'afterDestroy':_0x3071('0x4')};function emitEvent(_0x52b5fb){return function(_0x2c547f,_0x7b18a4,_0x33a70c){WhatsappMessageEvents[_0x3071('0x5')](_0x52b5fb+':'+_0x2c547f['id'],_0x2c547f);WhatsappMessageEvents[_0x3071('0x5')](_0x52b5fb,_0x2c547f);_0x33a70c(null);};}for(var e in events){if(events[_0x3071('0x6')](e)){var event=events[e];WhatsappMessage[_0x3071('0x7')](e,emitEvent(event));}}module[_0x3071('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index d3dd39a..7460436 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 _0xa329=['update','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','get','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','direction','catch','error','secret','find','WhatsappAccountId','type','twilio','authToken','accountSid','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','message_id'];(function(_0x7a1d70,_0x681fba){var _0x57a143=function(_0x36c4ce){while(--_0x36c4ce){_0x7a1d70['push'](_0x7a1d70['shift']());}};_0x57a143(++_0x681fba);}(_0xa329,0x1cc));var _0x9a32=function(_0x167e60,_0x5ce9d7){_0x167e60=_0x167e60-0x0;var _0x53ef7c=_0xa329[_0x167e60];return _0x53ef7c;};'use strict';var _=require(_0x9a32('0x0'));var util=require(_0x9a32('0x1'));var logger=require(_0x9a32('0x2'))('api');var moment=require(_0x9a32('0x3'));var BPromise=require(_0x9a32('0x4'));var rp=require(_0x9a32('0x5'));var fetch=require(_0x9a32('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a32('0x7'));var config=require('../../config/environment');var attributes=require(_0x9a32('0x8'));module[_0x9a32('0x9')]=function(_0x3ac937,_0x58569d){return _0x3ac937[_0x9a32('0xa')](_0x9a32('0xb'),attributes,{'tableName':_0x9a32('0xc'),'paranoid':![],'indexes':[{'name':_0x9a32('0xd'),'fields':[_0x9a32('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0x9a32('0xe')],'type':_0x9a32('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14c7a7,_0x1c476c,_0x3cb2fe){var _0x3c9aa2=_0x3ac937['models'];var _0x234ec4=_0x14c7a7[_0x9a32('0x10')]({'plain':!![]});if(_0x234ec4['direction'][_0x9a32('0x11')]()==='in'||_0x234ec4['direction'][_0x9a32('0x11')]()===_0x9a32('0x12')&&!_0x234ec4['secret']&&!_[_0x9a32('0x13')](_0x234ec4[_0x9a32('0x14')])){_0x3c9aa2[_0x9a32('0x15')][_0x9a32('0x16')]({'where':{'id':_0x234ec4[_0x9a32('0x17')]}})[_0x9a32('0x18')](function(_0x4d2aee){if(_0x4d2aee){_0x4d2aee['update']({'lastMsgAt':_0x234ec4[_0x9a32('0x19')],'lastMsgDirection':_0x234ec4[_0x9a32('0x1a')][_0x9a32('0x11')]()});}})[_0x9a32('0x1b')](function(_0x32ba67){console[_0x9a32('0x1c')](_0x32ba67);});}if(_0x234ec4['direction']===_0x9a32('0x12')&&!_0x234ec4[_0x9a32('0x1d')]){var _0x49fa25;_0x3c9aa2['WhatsappAccount'][_0x9a32('0x1e')]({'where':{'id':_0x234ec4[_0x9a32('0x1f')]},'raw':!![]})[_0x9a32('0x18')](function(_0x34c7bd){_0x49fa25=_0x34c7bd;if(_0x49fa25&&_0x49fa25[_0x9a32('0x20')]){switch(_0x49fa25[_0x9a32('0x20')]){case _0x9a32('0x21'):var _0x4d9e0a=require(_0x9a32('0x21'));if(_0x49fa25['accountSid']&&_0x49fa25[_0x9a32('0x22')]&&_0x49fa25['phone']){var _0x94de66=new _0x4d9e0a(_0x49fa25[_0x9a32('0x23')],_0x49fa25['authToken']);_0x94de66[_0x9a32('0x24')][_0x9a32('0x25')]({'body':_0x234ec4[_0x9a32('0xe')],'to':_0x9a32('0x26')+_0x234ec4['phone'],'from':'whatsapp:'+_0x49fa25[_0x9a32('0x27')],'statusCallback':_0x49fa25[_0x9a32('0x28')]+_0x9a32('0x29')+_0x234ec4['id']+'/status?token='+_0x49fa25[_0x9a32('0x2a')]})[_0x9a32('0x18')](function(_0x145891){if(_0x145891[_0x9a32('0x2b')]){return _0x14c7a7['update']({'messageId':_0x145891['sid']});}})[_0x9a32('0x1b')](function(_0x30274b){logger[_0x9a32('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9a32('0x21'),util['inspect'](_0x30274b,{'showHidden':![],'depth':null}));});}else{logger[_0x9a32('0x1c')](_0x9a32('0x2c'),'afterCreate',_0x9a32('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x9a32('0x2d'):var _0x250d0e=_0x49fa25[_0x9a32('0x23')];var _0x294dc2=_0x49fa25[_0x9a32('0x22')];var _0x4d8377=_0x49fa25['baseUrl']+_0x9a32('0x2e')+_0x250d0e+_0x9a32('0x2f');var _0x481a27={'to':[_0x234ec4[_0x9a32('0x27')]],'message':{'type':'text','text':_0x234ec4['body']}};var _0xf78773={'method':_0x9a32('0x30'),'uri':_0x4d8377,'headers':{'Authorization':_0x9a32('0x31')+_0x294dc2,'Content-Type':_0x9a32('0x32')},'body':_0x481a27,'json':!![]};rp(_0xf78773)[_0x9a32('0x18')](function(_0x58cef2){if(_0x58cef2[_0x9a32('0x33')][0x0][_0x9a32('0x34')]){return _0x14c7a7[_0x9a32('0x35')]({'messageId':_0x58cef2[_0x9a32('0x33')][0x0][_0x9a32('0x34')]});}})[_0x9a32('0x1b')](function(_0xf5f52d){logger['err'](_0x9a32('0x36'),_0xf5f52d);});break;}}})[_0x9a32('0x37')](function(){_0x3cb2fe();});}else{_0x3cb2fe();}}},'charset':_0x9a32('0x38'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4a16=['UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','toLowerCase','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','phone','accountSid','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','authToken','baseUrl','/messages/','text','body','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','models','get','direction','out','secret','isNil'];(function(_0x242c13,_0x473489){var _0x4b2190=function(_0x313784){while(--_0x313784){_0x242c13['push'](_0x242c13['shift']());}};_0x4b2190(++_0x473489);}(_0x4a16,0xd9));var _0x64a1=function(_0x38987e,_0x1a4a8f){_0x38987e=_0x38987e-0x0;var _0x1ba6ce=_0x4a16[_0x38987e];return _0x1ba6ce;};'use strict';var _=require(_0x64a1('0x0'));var util=require(_0x64a1('0x1'));var logger=require(_0x64a1('0x2'))('api');var moment=require(_0x64a1('0x3'));var BPromise=require(_0x64a1('0x4'));var rp=require('request-promise');var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0x64a1('0x5'));var config=require(_0x64a1('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0x64a1('0x7')]=function(_0x55b2fb,_0x86cd45){return _0x55b2fb[_0x64a1('0x8')](_0x64a1('0x9'),attributes,{'tableName':_0x64a1('0xa'),'paranoid':![],'indexes':[{'name':_0x64a1('0xb'),'fields':[_0x64a1('0xb')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x64a1('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x213502,_0x57eb86,_0x591d90){var _0x1d62cd=_0x55b2fb[_0x64a1('0xd')];var _0x4c0519=_0x213502[_0x64a1('0xe')]({'plain':!![]});if(_0x4c0519['direction']['toLowerCase']()==='in'||_0x4c0519[_0x64a1('0xf')]['toLowerCase']()===_0x64a1('0x10')&&!_0x4c0519[_0x64a1('0x11')]&&!_[_0x64a1('0x12')](_0x4c0519[_0x64a1('0x13')])){_0x1d62cd[_0x64a1('0x14')][_0x64a1('0x15')]({'where':{'id':_0x4c0519[_0x64a1('0x16')]}})[_0x64a1('0x17')](function(_0x430c48){if(_0x430c48){_0x430c48['update']({'lastMsgAt':_0x4c0519['createdAt'],'lastMsgDirection':_0x4c0519[_0x64a1('0xf')][_0x64a1('0x18')]()});}})[_0x64a1('0x19')](function(_0x56bfea){console[_0x64a1('0x1a')](_0x56bfea);});}if(_0x4c0519['direction']==='out'&&!_0x4c0519[_0x64a1('0x11')]){var _0x2e3901;_0x1d62cd[_0x64a1('0x1b')]['find']({'where':{'id':_0x4c0519[_0x64a1('0x1c')]},'raw':!![]})['then'](function(_0x580907){_0x2e3901=_0x580907;if(_0x2e3901&&_0x2e3901[_0x64a1('0x1d')]){switch(_0x2e3901[_0x64a1('0x1d')]){case _0x64a1('0x1e'):var _0x8d8e88=require(_0x64a1('0x1e'));if(_0x2e3901['accountSid']&&_0x2e3901['authToken']&&_0x2e3901[_0x64a1('0x1f')]){var _0x263b35=new _0x8d8e88(_0x2e3901[_0x64a1('0x20')],_0x2e3901['authToken']);_0x263b35[_0x64a1('0x21')]['create']({'body':_0x4c0519['body'],'to':'whatsapp:'+_0x4c0519[_0x64a1('0x1f')],'from':_0x64a1('0x22')+_0x2e3901['phone'],'statusCallback':_0x2e3901[_0x64a1('0x23')]+_0x64a1('0x24')+_0x4c0519['id']+_0x64a1('0x25')+_0x2e3901[_0x64a1('0x26')]})[_0x64a1('0x17')](function(_0x1f0a5a){if(_0x1f0a5a[_0x64a1('0x27')]){return _0x213502[_0x64a1('0x28')]({'messageId':_0x1f0a5a['sid']});}})[_0x64a1('0x19')](function(_0x230400){logger[_0x64a1('0x1a')](_0x64a1('0x29'),_0x64a1('0x2a'),_0x64a1('0x1e'),util[_0x64a1('0x2b')](_0x230400,{'showHidden':![],'depth':null}));});}else{logger[_0x64a1('0x1a')](_0x64a1('0x29'),'afterCreate',_0x64a1('0x1e'),_0x64a1('0x2c'));}break;case _0x64a1('0x2d'):var _0x3f8c75=_0x2e3901[_0x64a1('0x20')];var _0x567a69=_0x2e3901[_0x64a1('0x2e')];var _0x1c9bc7=_0x2e3901[_0x64a1('0x2f')]+'/whatsapp/v1/'+_0x3f8c75+_0x64a1('0x30');var _0x2ef081={'to':[_0x4c0519[_0x64a1('0x1f')]],'message':{'type':_0x64a1('0x31'),'text':_0x4c0519[_0x64a1('0x32')]}};var _0x2e91a={'method':_0x64a1('0x33'),'uri':_0x1c9bc7,'headers':{'Authorization':_0x64a1('0x34')+_0x567a69,'Content-Type':'application/json'},'body':_0x2ef081,'json':!![]};rp(_0x2e91a)[_0x64a1('0x17')](function(_0x19b40e){if(_0x19b40e[_0x64a1('0x35')][0x0][_0x64a1('0x36')]){return _0x213502[_0x64a1('0x28')]({'messageId':_0x19b40e[_0x64a1('0x35')][0x0][_0x64a1('0x36')]});}})['catch'](function(_0x350cf4){logger[_0x64a1('0x37')](_0x64a1('0x38'),_0x350cf4);});break;}}})[_0x64a1('0x39')](function(){_0x591d90();});}else{_0x591d90();}}},'charset':'utf8mb4','collate':_0x64a1('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 73c643f..2ad4d32 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 _0xbb92=['request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','lodash','util','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x23d6f9,_0xdaa281){var _0x4c3c70=function(_0x589bf5){while(--_0x589bf5){_0x23d6f9['push'](_0x23d6f9['shift']());}};_0x4c3c70(++_0xdaa281);}(_0xbb92,0x187));var _0x2bb9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbb92[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2bb9('0x0'));var util=require(_0x2bb9('0x1'));var moment=require('moment');var BPromise=require(_0x2bb9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bb9('0x3'));var db=require(_0x2bb9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2bb9('0x5'));var config=require('../../config/environment');var jayson=require(_0x2bb9('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x2bb9('0x7')]=_[_0x2bb9('0x8')](config[_0x2bb9('0x7')],{'host':_0x2bb9('0x9'),'port':0x18eb});var socket=require(_0x2bb9('0xa'))(new Redis(config[_0x2bb9('0x7')]));require('./whatsappMessage.socket')[_0x2bb9('0xb')](socket);function respondWithRpcPromise(_0x28784d,_0x4bd165,_0x57b994){return new BPromise(function(_0x587657,_0x3edc69){return client[_0x2bb9('0xc')](_0x28784d,_0x57b994)[_0x2bb9('0xd')](function(_0x57a369){logger[_0x2bb9('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x4bd165,_0x2bb9('0xf'));logger[_0x2bb9('0x10')](_0x2bb9('0x11'),_0x4bd165,_0x2bb9('0xf'),JSON[_0x2bb9('0x12')](_0x57a369));if(_0x57a369[_0x2bb9('0x13')]){if(_0x57a369[_0x2bb9('0x13')][_0x2bb9('0x14')]===0x1f4){logger[_0x2bb9('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x4bd165,_0x57a369[_0x2bb9('0x13')]['message']);return _0x3edc69(_0x57a369[_0x2bb9('0x13')][_0x2bb9('0x15')]);}logger[_0x2bb9('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x4bd165,_0x57a369['error'][_0x2bb9('0x15')]);return _0x587657(_0x57a369[_0x2bb9('0x13')][_0x2bb9('0x15')]);}else{logger[_0x2bb9('0xe')](_0x2bb9('0x16'),_0x4bd165,_0x2bb9('0xf'));_0x587657(_0x57a369[_0x2bb9('0x17')][_0x2bb9('0x15')]);}})[_0x2bb9('0x18')](function(_0x590c6c){logger[_0x2bb9('0x13')](_0x2bb9('0x16'),_0x4bd165,_0x590c6c);_0x3edc69(_0x590c6c);});});}exports['CreateWhatsappMessage']=function(_0x3824b8){var _0x54b864=this;return new Promise(function(_0xfa295c,_0x1ae29a){return db[_0x2bb9('0x19')][_0x2bb9('0x1a')](_0x3824b8[_0x2bb9('0x1b')],{'raw':_0x3824b8[_0x2bb9('0x1c')]?_0x3824b8[_0x2bb9('0x1c')][_0x2bb9('0x1d')]===undefined?!![]:![]:!![]})[_0x2bb9('0xd')](function(_0x4414ef){logger[_0x2bb9('0xe')](_0x2bb9('0x1e'),_0x3824b8);logger['debug'](_0x2bb9('0x1e'),_0x3824b8,JSON[_0x2bb9('0x12')](_0x4414ef));_0xfa295c(_0x4414ef);})[_0x2bb9('0x18')](function(_0x135d1c){logger[_0x2bb9('0x13')](_0x2bb9('0x1e'),_0x135d1c['message'],_0x3824b8);_0x1ae29a(_0x54b864['error'](0x1f4,_0x135d1c[_0x2bb9('0x15')]));});});}; \ No newline at end of file +var _0x10e5=['redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','options','raw','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x72dbb,_0x238ccf){var _0x1b69ce=function(_0x14bfe0){while(--_0x14bfe0){_0x72dbb['push'](_0x72dbb['shift']());}};_0x1b69ce(++_0x238ccf);}(_0x10e5,0x7c));var _0x510e=function(_0x3eb1c1,_0x1bb418){_0x3eb1c1=_0x3eb1c1-0x0;var _0x53645a=_0x10e5[_0x3eb1c1];return _0x53645a;};'use strict';var _=require(_0x510e('0x0'));var util=require(_0x510e('0x1'));var moment=require(_0x510e('0x2'));var BPromise=require('bluebird');var rs=require(_0x510e('0x3'));var fs=require('fs');var Redis=require(_0x510e('0x4'));var db=require(_0x510e('0x5'))['db'];var utils=require(_0x510e('0x6'));var logger=require(_0x510e('0x7'))('rpc');var config=require(_0x510e('0x8'));var jayson=require(_0x510e('0x9'));var client=jayson[_0x510e('0xa')][_0x510e('0xb')]({'port':0x232a});config[_0x510e('0xc')]=_[_0x510e('0xd')](config[_0x510e('0xc')],{'host':_0x510e('0xe'),'port':0x18eb});var socket=require(_0x510e('0xf'))(new Redis(config[_0x510e('0xc')]));require('./whatsappMessage.socket')[_0x510e('0x10')](socket);function respondWithRpcPromise(_0x2ce661,_0xd97247,_0x59e2e1){return new BPromise(function(_0xd573f9,_0x4a6531){return client[_0x510e('0x11')](_0x2ce661,_0x59e2e1)['then'](function(_0x3f63be){logger[_0x510e('0x12')](_0x510e('0x13'),_0xd97247,_0x510e('0x14'));logger['debug'](_0x510e('0x15'),_0xd97247,_0x510e('0x14'),JSON[_0x510e('0x16')](_0x3f63be));if(_0x3f63be[_0x510e('0x17')]){if(_0x3f63be[_0x510e('0x17')][_0x510e('0x18')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xd97247,_0x3f63be[_0x510e('0x17')]['message']);return _0x4a6531(_0x3f63be[_0x510e('0x17')]['message']);}logger[_0x510e('0x17')](_0x510e('0x13'),_0xd97247,_0x3f63be[_0x510e('0x17')][_0x510e('0x19')]);return _0xd573f9(_0x3f63be[_0x510e('0x17')]['message']);}else{logger[_0x510e('0x12')](_0x510e('0x13'),_0xd97247,_0x510e('0x14'));_0xd573f9(_0x3f63be[_0x510e('0x1a')][_0x510e('0x19')]);}})[_0x510e('0x1b')](function(_0x3ecac1){logger[_0x510e('0x17')](_0x510e('0x13'),_0xd97247,_0x3ecac1);_0x4a6531(_0x3ecac1);});});}exports[_0x510e('0x1c')]=function(_0x17c46f){var _0x1ce1ec=this;return new Promise(function(_0xe03c68,_0x3d7fa7){return db['WhatsappMessage'][_0x510e('0x1d')](_0x17c46f['body'],{'raw':_0x17c46f[_0x510e('0x1e')]?_0x17c46f[_0x510e('0x1e')][_0x510e('0x1f')]===undefined?!![]:![]:!![]})[_0x510e('0x20')](function(_0x387d39){logger[_0x510e('0x12')](_0x510e('0x1c'),_0x17c46f);logger[_0x510e('0x21')](_0x510e('0x1c'),_0x17c46f,JSON[_0x510e('0x16')](_0x387d39));_0xe03c68(_0x387d39);})[_0x510e('0x1b')](function(_0x3beb68){logger[_0x510e('0x17')](_0x510e('0x1c'),_0x3beb68['message'],_0x17c46f);_0x3d7fa7(_0x1ce1ec['error'](0x1f4,_0x3beb68['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 0683110..2488fb7 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 _0x34a4=['emit','removeListener','register','length','save','remove','update'];(function(_0xa6e4c8,_0x52e242){var _0x29e0c8=function(_0x2caaf2){while(--_0x2caaf2){_0xa6e4c8['push'](_0xa6e4c8['shift']());}};_0x29e0c8(++_0x52e242);}(_0x34a4,0x162));var _0x434a=function(_0x5ca54b,_0x51cce0){_0x5ca54b=_0x5ca54b-0x0;var _0x48647b=_0x34a4[_0x5ca54b];return _0x48647b;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x434a('0x0'),_0x434a('0x1'),_0x434a('0x2')];function createListener(_0x32749a,_0x240484){return function(_0x580678){_0x240484[_0x434a('0x3')](_0x32749a,_0x580678);};}function removeListener(_0x440107,_0x12a285){return function(){WhatsappMessageEvents[_0x434a('0x4')](_0x440107,_0x12a285);};}exports[_0x434a('0x5')]=function(_0x4b6de4){for(var _0xa8797b=0x0,_0x3d19ba=events[_0x434a('0x6')];_0xa8797b<_0x3d19ba;_0xa8797b++){var _0x341a74=events[_0xa8797b];var _0x30215f=createListener('whatsappMessage:'+_0x341a74,_0x4b6de4);WhatsappMessageEvents['on'](_0x341a74,_0x30215f);}}; \ No newline at end of file +var _0x2429=['whatsappMessage:','./whatsappMessage.events','save','remove','emit','register'];(function(_0x582628,_0x45dc5d){var _0x4dfea5=function(_0x2ed090){while(--_0x2ed090){_0x582628['push'](_0x582628['shift']());}};_0x4dfea5(++_0x45dc5d);}(_0x2429,0xcd));var _0x9242=function(_0x2ae099,_0x1d9376){_0x2ae099=_0x2ae099-0x0;var _0x2ce323=_0x2429[_0x2ae099];return _0x2ce323;};'use strict';var WhatsappMessageEvents=require(_0x9242('0x0'));var events=[_0x9242('0x1'),_0x9242('0x2'),'update'];function createListener(_0x586e89,_0x4aad0b){return function(_0x296643){_0x4aad0b[_0x9242('0x3')](_0x586e89,_0x296643);};}function removeListener(_0x24bb8d,_0x582c07){return function(){WhatsappMessageEvents['removeListener'](_0x24bb8d,_0x582c07);};}exports[_0x9242('0x4')]=function(_0x46808a){for(var _0x2324d4=0x0,_0x35150a=events['length'];_0x2324d4<_0x35150a;_0x2324d4++){var _0x5a924a=events[_0x2324d4];var _0x456453=createListener(_0x9242('0x5')+_0x5a924a,_0x46808a);WhatsappMessageEvents['on'](_0x5a924a,_0x456453);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 385dc48..14b5552 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 _0x4f11=['create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post'];(function(_0x12939d,_0x24971d){var _0x38f9ab=function(_0x23a8d5){while(--_0x23a8d5){_0x12939d['push'](_0x12939d['shift']());}};_0x38f9ab(++_0x24971d);}(_0x4f11,0xcd));var _0x14f1=function(_0x2df76e,_0x1207c2){_0x2df76e=_0x2df76e-0x0;var _0x2a5d53=_0x4f11[_0x2df76e];return _0x2a5d53;};'use strict';var multer=require(_0x14f1('0x0'));var util=require(_0x14f1('0x1'));var path=require(_0x14f1('0x2'));var timeout=require(_0x14f1('0x3'));var express=require(_0x14f1('0x4'));var router=express['Router']();var fs_extra=require(_0x14f1('0x5'));var auth=require(_0x14f1('0x6'));var interaction=require(_0x14f1('0x7'));var config=require(_0x14f1('0x8'));var controller=require(_0x14f1('0x9'));router[_0x14f1('0xa')]('/',auth[_0x14f1('0xb')](),controller['index']);router[_0x14f1('0xa')]('/describe',auth[_0x14f1('0xb')](),controller[_0x14f1('0xc')]);router[_0x14f1('0xa')](_0x14f1('0xd'),auth[_0x14f1('0xb')](),controller[_0x14f1('0xe')]);router[_0x14f1('0xa')]('/:id/members',auth[_0x14f1('0xb')](),controller[_0x14f1('0xf')]);router[_0x14f1('0xa')](_0x14f1('0x10'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x14f1('0x11'),auth[_0x14f1('0xb')](),controller['getAgents']);router[_0x14f1('0x12')]('/',auth[_0x14f1('0xb')](),controller[_0x14f1('0x13')]);router[_0x14f1('0x12')](_0x14f1('0x10'),auth[_0x14f1('0xb')](),controller[_0x14f1('0x14')]);router[_0x14f1('0x12')](_0x14f1('0x11'),auth[_0x14f1('0xb')](),controller[_0x14f1('0x15')]);router[_0x14f1('0x16')](_0x14f1('0xd'),auth[_0x14f1('0xb')](),controller[_0x14f1('0x17')]);router[_0x14f1('0x18')](_0x14f1('0xd'),auth['isAuthenticated'](),controller[_0x14f1('0x19')]);router[_0x14f1('0x18')](_0x14f1('0x10'),auth[_0x14f1('0xb')](),controller[_0x14f1('0x1a')]);router[_0x14f1('0x18')](_0x14f1('0x11'),auth[_0x14f1('0xb')](),controller['removeAgents']);module[_0x14f1('0x1b')]=router; \ No newline at end of file +var _0x46cf=['express','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/users','getAgents','/:id/teams','addTeams','post','addAgents','put','update','destroy','delete','removeTeams','exports','path','connect-timeout'];(function(_0x25bc0a,_0x555154){var _0x3cfa8c=function(_0xc7391){while(--_0xc7391){_0x25bc0a['push'](_0x25bc0a['shift']());}};_0x3cfa8c(++_0x555154);}(_0x46cf,0x14e));var _0xf46c=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x46cf[_0x35885a];return _0xe86249;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf46c('0x0'));var timeout=require(_0xf46c('0x1'));var express=require(_0xf46c('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf46c('0x3'));var config=require('../../config/environment');var controller=require(_0xf46c('0x4'));router[_0xf46c('0x5')]('/',auth[_0xf46c('0x6')](),controller[_0xf46c('0x7')]);router[_0xf46c('0x5')]('/describe',auth['isAuthenticated'](),controller[_0xf46c('0x8')]);router['get'](_0xf46c('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf46c('0xa'),auth[_0xf46c('0x6')](),controller[_0xf46c('0xb')]);router[_0xf46c('0x5')]('/:id/teams',auth[_0xf46c('0x6')](),controller['getTeams']);router['get'](_0xf46c('0xc'),auth[_0xf46c('0x6')](),controller[_0xf46c('0xd')]);router['post']('/',auth[_0xf46c('0x6')](),controller['create']);router['post'](_0xf46c('0xe'),auth[_0xf46c('0x6')](),controller[_0xf46c('0xf')]);router[_0xf46c('0x10')](_0xf46c('0xc'),auth['isAuthenticated'](),controller[_0xf46c('0x11')]);router[_0xf46c('0x12')](_0xf46c('0x9'),auth[_0xf46c('0x6')](),controller[_0xf46c('0x13')]);router['delete'](_0xf46c('0x9'),auth['isAuthenticated'](),controller[_0xf46c('0x14')]);router[_0xf46c('0x15')](_0xf46c('0xe'),auth[_0xf46c('0x6')](),controller[_0xf46c('0x16')]);router[_0xf46c('0x15')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xf46c('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index c6f060e..52d26a0 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 _0x16e4=['name','INTEGER','ENUM','beepall','sequelize','exports','STRING'];(function(_0x548383,_0x357ab4){var _0x581bfc=function(_0x49f59b){while(--_0x49f59b){_0x548383['push'](_0x548383['shift']());}};_0x581bfc(++_0x357ab4);}(_0x16e4,0x97));var _0x416e=function(_0x4d8e5a,_0x3fd957){_0x4d8e5a=_0x4d8e5a-0x0;var _0x64153f=_0x16e4[_0x4d8e5a];return _0x64153f;};'use strict';var Sequelize=require(_0x416e('0x0'));module[_0x416e('0x1')]={'name':{'type':Sequelize[_0x416e('0x2')],'unique':_0x416e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x416e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x416e('0x5')]('rrmemory',_0x416e('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x416e('0x2')]}}; \ No newline at end of file +var _0x644a=['beepall','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0x644a,0xfd));var _0xa644=function(_0x4796eb,_0x2f8389){_0x4796eb=_0x4796eb-0x0;var _0x1fb1a4=_0x644a[_0x4796eb];return _0x1fb1a4;};'use strict';var Sequelize=require(_0xa644('0x0'));module[_0xa644('0x1')]={'name':{'type':Sequelize[_0xa644('0x2')],'unique':_0xa644('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa644('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa644('0x5'),_0xa644('0x6'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index c10b735..64b2903 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 _0x3eb9=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','order','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents','ids','omit','spread','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','map','WhatsappQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3eb9,0xe3));var _0x93eb=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0x3eb9[_0x231b2e];return _0x3feb2a;};'use strict';var emlformat=require(_0x93eb('0x0'));var rimraf=require(_0x93eb('0x1'));var zipdir=require(_0x93eb('0x2'));var jsonpatch=require(_0x93eb('0x3'));var rp=require(_0x93eb('0x4'));var moment=require(_0x93eb('0x5'));var BPromise=require(_0x93eb('0x6'));var Mustache=require('mustache');var util=require(_0x93eb('0x7'));var path=require(_0x93eb('0x8'));var sox=require(_0x93eb('0x9'));var csv=require(_0x93eb('0xa'));var ejs=require(_0x93eb('0xb'));var fs=require('fs');var fs_extra=require(_0x93eb('0xc'));var _=require(_0x93eb('0xd'));var squel=require(_0x93eb('0xe'));var crypto=require(_0x93eb('0xf'));var jsforce=require(_0x93eb('0x10'));var deskjs=require(_0x93eb('0x11'));var toCsv=require(_0x93eb('0xa'));var querystring=require(_0x93eb('0x12'));var Papa=require(_0x93eb('0x13'));var Redis=require(_0x93eb('0x14'));var authService=require(_0x93eb('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x93eb('0x16'));var hardwareService=require(_0x93eb('0x17'));var logger=require(_0x93eb('0x18'))(_0x93eb('0x19'));var utils=require(_0x93eb('0x1a'));var config=require(_0x93eb('0x1b'));var licenseUtil=require(_0x93eb('0x1c'));var db=require(_0x93eb('0x1d'))['db'];config[_0x93eb('0x1e')]=_['defaults'](config['redis'],{'host':_0x93eb('0x1f'),'port':0x18eb});var socket=require(_0x93eb('0x20'))(new Redis(config['redis']));require(_0x93eb('0x21'))[_0x93eb('0x22')](socket);function respondWithStatusCode(_0x40ea29,_0x15fa9e){_0x15fa9e=_0x15fa9e||0xcc;return function(_0x5406ac){if(_0x5406ac){return _0x40ea29['sendStatus'](_0x15fa9e);}return _0x40ea29[_0x93eb('0x23')](_0x15fa9e)[_0x93eb('0x24')]();};}function respondWithResult(_0x473c07,_0x5b614c){_0x5b614c=_0x5b614c||0xc8;return function(_0x9a4ece){if(_0x9a4ece){return _0x473c07[_0x93eb('0x23')](_0x5b614c)['json'](_0x9a4ece);}};}function respondWithFilteredResult(_0x226231,_0x338156){return function(_0x4980d0){if(_0x4980d0){var _0x3cc05a=typeof _0x338156[_0x93eb('0x25')]===_0x93eb('0x26')&&typeof _0x338156[_0x93eb('0x27')]===_0x93eb('0x26');var _0x12b322=_0x4980d0[_0x93eb('0x28')];var _0x2d1b28=_0x3cc05a?0x0:_0x338156[_0x93eb('0x25')];var _0x496566=_0x3cc05a?_0x4980d0[_0x93eb('0x28')]:_0x338156[_0x93eb('0x25')]+_0x338156['limit'];var _0x353fc4;if(_0x496566>=_0x12b322){_0x496566=_0x12b322;_0x353fc4=0xc8;}else{_0x353fc4=0xce;}_0x226231['status'](_0x353fc4);return _0x226231[_0x93eb('0x29')](_0x93eb('0x2a'),_0x2d1b28+'-'+_0x496566+'/'+_0x12b322)['json'](_0x4980d0);}return null;};}function patchUpdates(_0x3eec09){return function(_0x54031a){try{jsonpatch[_0x93eb('0x2b')](_0x54031a,_0x3eec09,!![]);}catch(_0x2eb6b4){return BPromise[_0x93eb('0x2c')](_0x2eb6b4);}return _0x54031a['save']();};}function saveUpdates(_0x33fad8,_0x3016d6){return function(_0x10de75){if(_0x10de75){return _0x10de75[_0x93eb('0x2d')](_0x33fad8)[_0x93eb('0x2e')](function(_0x4b6b68){return _0x4b6b68;});}return null;};}function removeEntity(_0x4e831d,_0x104129){return function(_0x18a5ae){if(_0x18a5ae){return _0x18a5ae[_0x93eb('0x2f')]()[_0x93eb('0x2e')](function(){var _0x14840e=_0x18a5ae[_0x93eb('0x30')]({'plain':!![]});var _0x72cdb8=_0x93eb('0x31');return db[_0x93eb('0x32')][_0x93eb('0x2f')]({'where':{'type':_0x72cdb8,'resourceId':_0x14840e['id']}})['then'](function(){return _0x18a5ae;});})[_0x93eb('0x2e')](function(){_0x4e831d[_0x93eb('0x23')](0xcc)[_0x93eb('0x24')]();});}};}function handleEntityNotFound(_0x42a7b0,_0x58d850){return function(_0x37c551){if(!_0x37c551){_0x42a7b0['sendStatus'](0x194);}return _0x37c551;};}function handleError(_0x54443a,_0x4d35c4){_0x4d35c4=_0x4d35c4||0x1f4;return function(_0x25a217){logger[_0x93eb('0x33')](_0x25a217['stack']);if(_0x25a217[_0x93eb('0x34')]){delete _0x25a217[_0x93eb('0x34')];}_0x54443a['status'](_0x4d35c4)[_0x93eb('0x35')](_0x25a217);};}exports['index']=function(_0x2b0ca6,_0x34b5dd){var _0xe6ac5d={},_0x118c12={},_0x26971a={'count':0x0,'rows':[]};var _0x363735=_[_0x93eb('0x36')](db[_0x93eb('0x37')][_0x93eb('0x38')],function(_0x1bb117){return{'name':_0x1bb117['fieldName'],'type':_0x1bb117[_0x93eb('0x39')][_0x93eb('0x3a')]};});_0x118c12[_0x93eb('0x3b')]=_[_0x93eb('0x36')](_0x363735,'name');_0x118c12[_0x93eb('0x3c')]=_[_0x93eb('0x3d')](_0x2b0ca6['query']);_0x118c12[_0x93eb('0x3e')]=_[_0x93eb('0x3f')](_0x118c12[_0x93eb('0x3b')],_0x118c12[_0x93eb('0x3c')]);_0xe6ac5d[_0x93eb('0x40')]=_['intersection'](_0x118c12['model'],qs[_0x93eb('0x41')](_0x2b0ca6[_0x93eb('0x3c')]['fields']));_0xe6ac5d[_0x93eb('0x40')]=_0xe6ac5d[_0x93eb('0x40')][_0x93eb('0x42')]?_0xe6ac5d[_0x93eb('0x40')]:_0x118c12['model'];if(!_0x2b0ca6[_0x93eb('0x3c')][_0x93eb('0x43')](_0x93eb('0x44'))){_0xe6ac5d['limit']=qs[_0x93eb('0x27')](_0x2b0ca6[_0x93eb('0x3c')][_0x93eb('0x27')]);_0xe6ac5d[_0x93eb('0x25')]=qs[_0x93eb('0x25')](_0x2b0ca6[_0x93eb('0x3c')][_0x93eb('0x25')]);}_0xe6ac5d['order']=qs[_0x93eb('0x45')](_0x2b0ca6['query'][_0x93eb('0x45')]);_0xe6ac5d[_0x93eb('0x46')]=qs[_0x93eb('0x3e')](_[_0x93eb('0x47')](_0x2b0ca6[_0x93eb('0x3c')],_0x118c12['filters']),_0x363735);if(_0x2b0ca6[_0x93eb('0x3c')][_0x93eb('0x48')]){_0xe6ac5d['where']=_[_0x93eb('0x49')](_0xe6ac5d[_0x93eb('0x46')],{'$or':_['map'](_0x363735,function(_0x435e0b){if(_0x435e0b['type']!==_0x93eb('0x4a')){var _0x11ee4b={};_0x11ee4b[_0x435e0b['name']]={'$like':'%'+_0x2b0ca6['query']['filter']+'%'};return _0x11ee4b;}})});}_0xe6ac5d=_[_0x93eb('0x49')]({},_0xe6ac5d,_0x2b0ca6['options']);var _0x4000ca={'where':_0xe6ac5d[_0x93eb('0x46')]};return db[_0x93eb('0x37')][_0x93eb('0x28')](_0x4000ca)['then'](function(_0x56ff3f){_0x26971a[_0x93eb('0x28')]=_0x56ff3f;if(_0x2b0ca6[_0x93eb('0x3c')][_0x93eb('0x4b')]){_0xe6ac5d[_0x93eb('0x4c')]=[{'all':!![]}];}return db[_0x93eb('0x37')]['findAll'](_0xe6ac5d);})['then'](function(_0x366af7){_0x26971a[_0x93eb('0x4d')]=_0x366af7;return _0x26971a;})[_0x93eb('0x2e')](respondWithFilteredResult(_0x34b5dd,_0xe6ac5d))[_0x93eb('0x4e')](handleError(_0x34b5dd,null));};exports[_0x93eb('0x4f')]=function(_0x391ed2,_0x5141a3){var _0x2b59d4={'raw':!![],'where':{'id':_0x391ed2[_0x93eb('0x50')]['id']}},_0x515ee3={};_0x515ee3[_0x93eb('0x3b')]=_['keys'](db[_0x93eb('0x37')][_0x93eb('0x38')]);_0x515ee3['query']=_[_0x93eb('0x3d')](_0x391ed2[_0x93eb('0x3c')]);_0x515ee3[_0x93eb('0x3e')]=_['intersection'](_0x515ee3[_0x93eb('0x3b')],_0x515ee3[_0x93eb('0x3c')]);_0x2b59d4[_0x93eb('0x40')]=_['intersection'](_0x515ee3['model'],qs[_0x93eb('0x41')](_0x391ed2[_0x93eb('0x3c')][_0x93eb('0x41')]));_0x2b59d4[_0x93eb('0x40')]=_0x2b59d4['attributes'][_0x93eb('0x42')]?_0x2b59d4[_0x93eb('0x40')]:_0x515ee3[_0x93eb('0x3b')];if(_0x391ed2[_0x93eb('0x3c')][_0x93eb('0x4b')]){_0x2b59d4[_0x93eb('0x4c')]=[{'all':!![]}];}_0x2b59d4=_[_0x93eb('0x49')]({},_0x2b59d4,_0x391ed2[_0x93eb('0x51')]);return db[_0x93eb('0x37')][_0x93eb('0x52')](_0x2b59d4)[_0x93eb('0x2e')](handleEntityNotFound(_0x5141a3,null))[_0x93eb('0x2e')](respondWithResult(_0x5141a3,null))[_0x93eb('0x4e')](handleError(_0x5141a3,null));};exports[_0x93eb('0x53')]=function(_0x3457ef,_0x5bf88b){return db[_0x93eb('0x37')][_0x93eb('0x53')](_0x3457ef[_0x93eb('0x54')],{})[_0x93eb('0x2e')](function(_0x3540f2){var _0x12485f=_0x3457ef['user'][_0x93eb('0x30')]({'plain':!![]});if(!_0x12485f)throw new Error(_0x93eb('0x55'));if(_0x12485f[_0x93eb('0x56')]==='user'){var _0x31eaad=_0x3540f2['get']({'plain':!![]});var _0x547f60='WhatsappQueues';return db[_0x93eb('0x57')]['find']({'where':{'name':_0x547f60,'userProfileId':_0x12485f[_0x93eb('0x58')]},'raw':!![]})[_0x93eb('0x2e')](function(_0x390096){if(_0x390096&&_0x390096[_0x93eb('0x59')]===0x0){return db[_0x93eb('0x32')]['create']({'name':_0x31eaad[_0x93eb('0x34')],'resourceId':_0x31eaad['id'],'type':_0x390096[_0x93eb('0x34')],'sectionId':_0x390096['id']},{})['then'](function(){return _0x3540f2;});}else{return _0x3540f2;}})[_0x93eb('0x4e')](function(_0x1d364e){logger['error'](_0x93eb('0x5a'),_0x1d364e);throw _0x1d364e;});}return _0x3540f2;})[_0x93eb('0x2e')](respondWithResult(_0x5bf88b,0xc9))[_0x93eb('0x4e')](handleError(_0x5bf88b,null));};exports['update']=function(_0x5db328,_0x28e7ae){if(_0x5db328[_0x93eb('0x54')]['id']){delete _0x5db328[_0x93eb('0x54')]['id'];}return db[_0x93eb('0x37')][_0x93eb('0x52')]({'where':{'id':_0x5db328[_0x93eb('0x50')]['id']}})[_0x93eb('0x2e')](handleEntityNotFound(_0x28e7ae,null))[_0x93eb('0x2e')](saveUpdates(_0x5db328['body'],null))[_0x93eb('0x2e')](respondWithResult(_0x28e7ae,null))['catch'](handleError(_0x28e7ae,null));};exports[_0x93eb('0x2f')]=function(_0x2dccfe,_0x37afc1){return db[_0x93eb('0x37')][_0x93eb('0x52')]({'where':{'id':_0x2dccfe[_0x93eb('0x50')]['id']}})[_0x93eb('0x2e')](handleEntityNotFound(_0x37afc1,null))[_0x93eb('0x2e')](removeEntity(_0x37afc1,null))[_0x93eb('0x4e')](handleError(_0x37afc1,null));};exports[_0x93eb('0x5b')]=function(_0x18ff22,_0x47409e){return db[_0x93eb('0x37')][_0x93eb('0x5b')]()[_0x93eb('0x2e')](respondWithResult(_0x47409e,null))[_0x93eb('0x4e')](handleError(_0x47409e,null));};exports[_0x93eb('0x5c')]=function(_0xe7562c,_0x2869c5,_0x11de97){var _0x128233={'raw':!![],'where':{}},_0x4bf2c2={},_0x3f5316;return db[_0x93eb('0x37')][_0x93eb('0x5d')]({'where':{'id':_0xe7562c[_0x93eb('0x50')]['id']}})[_0x93eb('0x2e')](handleEntityNotFound(_0x2869c5,null))[_0x93eb('0x2e')](function(_0x23bc24){if(_0x23bc24){_0x3f5316=_0x23bc24[_0x93eb('0x30')]({'plain':!![]});_0x4bf2c2[_0x93eb('0x3b')]=_[_0x93eb('0x3d')](db[_0x93eb('0x5e')]['rawAttributes']);_0x4bf2c2[_0x93eb('0x3c')]=_[_0x93eb('0x3d')](_0xe7562c[_0x93eb('0x3c')]);_0x4bf2c2['filters']=_[_0x93eb('0x3f')](_0x4bf2c2['model'],_0x4bf2c2[_0x93eb('0x3c')]);_0x128233[_0x93eb('0x40')]=_[_0x93eb('0x3f')](_0x4bf2c2[_0x93eb('0x3b')],qs[_0x93eb('0x41')](_0xe7562c[_0x93eb('0x3c')]['fields']));_0x128233[_0x93eb('0x40')]=_0x128233['attributes'][_0x93eb('0x42')]?_0x128233[_0x93eb('0x40')]:_0x4bf2c2[_0x93eb('0x3b')];if(!_0xe7562c[_0x93eb('0x3c')][_0x93eb('0x43')](_0x93eb('0x44'))){_0x128233[_0x93eb('0x27')]=qs[_0x93eb('0x27')](_0xe7562c['query']['limit']);_0x128233['offset']=qs['offset'](_0xe7562c[_0x93eb('0x3c')][_0x93eb('0x25')]);}_0x128233[_0x93eb('0x5f')]=qs[_0x93eb('0x45')](_0xe7562c[_0x93eb('0x3c')][_0x93eb('0x45')]);_0x128233['where']=qs[_0x93eb('0x3e')](_[_0x93eb('0x47')](_0xe7562c[_0x93eb('0x3c')],_0x4bf2c2[_0x93eb('0x3e')]));_0x128233['where'][_0x93eb('0x60')]=_0x23bc24['id'];if(_0xe7562c[_0x93eb('0x3c')][_0x93eb('0x48')]){_0x128233[_0x93eb('0x46')]=_[_0x93eb('0x49')](_0x128233[_0x93eb('0x46')],{'$or':_[_0x93eb('0x36')](_0x128233[_0x93eb('0x40')],function(_0xb98deb){var _0xf0c0e9={};_0xf0c0e9[_0xb98deb]={'$like':'%'+_0xe7562c[_0x93eb('0x3c')][_0x93eb('0x48')]+'%'};return _0xf0c0e9;})});}_0x128233=_['merge']({},_0x128233,_0xe7562c[_0x93eb('0x51')]);return db[_0x93eb('0x5e')][_0x93eb('0x61')](_0x128233);}})[_0x93eb('0x2e')](function(_0x3f4b98){if(_0x3f4b98){return db[_0x93eb('0x62')][_0x93eb('0x63')]({'where':{'id':_[_0x93eb('0x36')](_0x3f4b98,_0x93eb('0x64')),'role':_0x93eb('0x65')},'attributes':['id',_0x93eb('0x34'),_0x93eb('0x66'),_0x93eb('0x67'),_0x93eb('0x68')]});}})[_0x93eb('0x2e')](function(_0x166c37){if(_0x166c37){return{'count':_0x166c37[_0x93eb('0x28')],'rows':_[_0x93eb('0x36')](_0x166c37[_0x93eb('0x4d')],function(_0x52b20f){return{'membername':_0x52b20f[_0x93eb('0x34')],'UserId':_0x52b20f['id'],'queue_name':_0x3f5316[_0x93eb('0x34')],'WhatsappQueueId':_0x3f5316['id'],'interface':util['format'](_0x93eb('0x69'),_0x93eb('0x6a'),_0x52b20f['name']),'penalty':0x0,'paused':_0x52b20f[_0x93eb('0x66')],'createdAt':_0x52b20f[_0x93eb('0x68')],'updatedAt':_0x52b20f[_0x93eb('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2869c5,_0x128233))[_0x93eb('0x4e')](handleError(_0x2869c5,null));};exports[_0x93eb('0x6b')]=function(_0x1e5e75,_0x2686a2,_0x3cf99b){var _0x11ff84={};var _0x261d48={};var _0x35015d;var _0x578d43;return db[_0x93eb('0x37')][_0x93eb('0x5d')]({'where':{'id':_0x1e5e75[_0x93eb('0x50')]['id']}})['then'](handleEntityNotFound(_0x2686a2,null))[_0x93eb('0x2e')](function(_0x463506){if(_0x463506){_0x35015d=_0x463506;_0x261d48['model']=_[_0x93eb('0x3d')](db[_0x93eb('0x6c')][_0x93eb('0x38')]);_0x261d48[_0x93eb('0x3c')]=_[_0x93eb('0x3d')](_0x1e5e75[_0x93eb('0x3c')]);_0x261d48[_0x93eb('0x3e')]=_['intersection'](_0x261d48[_0x93eb('0x3b')],_0x261d48[_0x93eb('0x3c')]);_0x11ff84['attributes']=_[_0x93eb('0x3f')](_0x261d48[_0x93eb('0x3b')],qs[_0x93eb('0x41')](_0x1e5e75[_0x93eb('0x3c')][_0x93eb('0x41')]));_0x11ff84[_0x93eb('0x40')]=_0x11ff84['attributes'][_0x93eb('0x42')]?_0x11ff84['attributes']:_0x261d48['model'];_0x11ff84[_0x93eb('0x5f')]=qs[_0x93eb('0x45')](_0x1e5e75['query'][_0x93eb('0x45')]);_0x11ff84[_0x93eb('0x46')]=qs[_0x93eb('0x3e')](_[_0x93eb('0x47')](_0x1e5e75[_0x93eb('0x3c')],_0x261d48[_0x93eb('0x3e')]));if(_0x1e5e75[_0x93eb('0x3c')]['filter']){_0x11ff84[_0x93eb('0x46')]=_[_0x93eb('0x49')](_0x11ff84[_0x93eb('0x46')],{'$or':_['map'](_0x11ff84[_0x93eb('0x40')],function(_0x3847b4){var _0x16176b={};_0x16176b[_0x3847b4]={'$like':'%'+_0x1e5e75[_0x93eb('0x3c')][_0x93eb('0x48')]+'%'};return _0x16176b;})});}_0x11ff84=_[_0x93eb('0x49')]({},_0x11ff84,_0x1e5e75[_0x93eb('0x51')]);return _0x35015d[_0x93eb('0x6b')](_0x11ff84);}})[_0x93eb('0x2e')](function(_0x31937f){if(_0x31937f){_0x578d43=_0x31937f[_0x93eb('0x42')];if(!_0x1e5e75['query'][_0x93eb('0x43')](_0x93eb('0x44'))){_0x11ff84[_0x93eb('0x27')]=qs[_0x93eb('0x27')](_0x1e5e75[_0x93eb('0x3c')][_0x93eb('0x27')]);_0x11ff84['offset']=qs[_0x93eb('0x25')](_0x1e5e75[_0x93eb('0x3c')][_0x93eb('0x25')]);}return _0x35015d[_0x93eb('0x6b')](_0x11ff84);}})[_0x93eb('0x2e')](function(_0x4af7d7){if(_0x4af7d7){return _0x4af7d7?{'count':_0x578d43,'rows':_0x4af7d7}:null;}})['then'](respondWithResult(_0x2686a2,null))[_0x93eb('0x4e')](handleError(_0x2686a2,null));};exports[_0x93eb('0x6d')]=function(_0x33acc1,_0x5bff04,_0x2a6800){var _0x5b7b85=_0x33acc1[_0x93eb('0x54')]['ids'];return db[_0x93eb('0x6c')][_0x93eb('0x61')]({'where':{'id':_0x5b7b85},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x93eb('0x34'),'online',_0x93eb('0x6e'),_0x93eb('0x6f')],'raw':!![]}]})[_0x93eb('0x2e')](function(_0x15a8a5){if(_0x15a8a5){var _0x2856c5=_[_0x93eb('0x70')](_0x15a8a5,function(_0x2d7760){var _0x214551=_0x2d7760[_0x93eb('0x30')]({'plain':!![]});return _0x214551[_0x93eb('0x71')];});return db['WhatsappQueue'][_0x93eb('0x52')]({'where':{'id':_0x33acc1[_0x93eb('0x50')]['id']}})[_0x93eb('0x2e')](function(_0x4ec4cb){return db[_0x93eb('0x72')][_0x93eb('0x73')](function(_0x31114c){return _0x4ec4cb[_0x93eb('0x6d')](_0x5b7b85,{'transaction':_0x31114c})[_0x93eb('0x2e')](function(){return BPromise[_0x93eb('0x74')](_0x2856c5,function(_0x3abd80){return db['UserWhatsappQueue'][_0x93eb('0x75')]({'where':{'UserId':_0x3abd80['id'],'WhatsappQueueId':_0x33acc1[_0x93eb('0x50')]['id']},'transaction':_0x31114c});});})[_0x93eb('0x2e')](function(){_0x2856c5['forEach'](function(_0x5d4d3f){socket[_0x93eb('0x76')](_0x93eb('0x77'),{'UserId':_0x5d4d3f['id'],'WhatsappQueueId':_0x4ec4cb['id']});});});});});}})[_0x93eb('0x2e')](respondWithStatusCode(_0x5bff04,null))['catch'](handleError(_0x5bff04,null));};exports['removeTeams']=function(_0x1ec62e,_0x550b0f,_0x16beb5){return db[_0x93eb('0x6c')][_0x93eb('0x61')]({'where':{'id':_0x1ec62e['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x93eb('0x62')],'as':_0x93eb('0x71'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x550b0f,null))['then'](function(_0x5ced1b){var _0x44b802=_[_0x93eb('0x36')](_0x5ced1b,'id');var _0x628fbe=[];var _0x33d74c=[];var _0x2e60b5=squel['select']();_0x2e60b5['field'](_0x93eb('0x78'))[_0x93eb('0x79')](_0x93eb('0x7a'),'tq')[_0x93eb('0x7b')](_0x93eb('0x7c'),'ut',_0x93eb('0x7d'))[_0x93eb('0x46')](_0x93eb('0x7e'),_0x1ec62e[_0x93eb('0x50')]['id']);for(var _0x5cc2f5=0x0;_0x5cc2f5<_0x5ced1b[_0x93eb('0x42')];_0x5cc2f5+=0x1){let _0x7f342=_0x5ced1b[_0x5cc2f5];for(var _0x202ce4=0x0;_0x202ce4<_0x7f342[_0x93eb('0x71')][_0x93eb('0x42')];_0x202ce4+=0x1){let _0x1cba23=_0x7f342[_0x93eb('0x71')][_0x202ce4];var _0x438d4c=_0x2e60b5[_0x93eb('0x7f')]();_0x438d4c['where']('ut.UserId\x20=\x20?',_0x1cba23['id']);_0x33d74c[_0x93eb('0x80')](db[_0x93eb('0x72')][_0x93eb('0x3c')](_0x438d4c[_0x93eb('0x81')](),{'type':db['sequelize'][_0x93eb('0x82')][_0x93eb('0x83')]})[_0x93eb('0x2e')](function(_0x23fc13){if(_0x23fc13['length']===0x1){return _0x1cba23['id'];}else{var _0x961fc0=_[_0x93eb('0x84')](_[_0x93eb('0x36')](_0x23fc13,_0x93eb('0x85')),function(_0x26621b){return _['includes'](_0x44b802,_0x26621b);});if(_0x961fc0){return _0x1cba23['id'];}}}));}}return BPromise[_0x93eb('0x86')](_0x33d74c)[_0x93eb('0x2e')](function(_0x5076fa){_0x628fbe=_(_0x628fbe)['union'](_0x5076fa)[_0x93eb('0x87')]()[_0x93eb('0x88')]();return db['WhatsappQueue'][_0x93eb('0x52')]({'where':{'id':_0x1ec62e['params']['id']}})[_0x93eb('0x2e')](function(_0x21d1b6){return db['sequelize'][_0x93eb('0x73')](function(_0x1ec8f0){return _0x21d1b6[_0x93eb('0x89')](_0x1ec62e[_0x93eb('0x3c')]['ids'],{'transaction':_0x1ec8f0})['then'](function(){if(!_[_0x93eb('0x8a')](_0x628fbe)){return _0x21d1b6[_0x93eb('0x8b')](_0x628fbe,{'transaction':_0x1ec8f0});}})[_0x93eb('0x2e')](function(){_0x628fbe[_0x93eb('0x8c')](function(_0x1d3b49){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x1d3b49,'WhatsappQueueId':_0x21d1b6['id']});});});});});});})[_0x93eb('0x2e')](respondWithStatusCode(_0x550b0f,null))[_0x93eb('0x4e')](handleError(_0x550b0f,null));};exports[_0x93eb('0x8d')]=function(_0x289bdc,_0x52c112,_0x13b63c){return db[_0x93eb('0x37')][_0x93eb('0x52')]({'where':{'id':_0x289bdc[_0x93eb('0x50')]['id']}})[_0x93eb('0x2e')](handleEntityNotFound(_0x52c112,null))['then'](function(_0xa1e73d){if(_0xa1e73d){return _0xa1e73d[_0x93eb('0x8d')](_0x289bdc[_0x93eb('0x54')][_0x93eb('0x8e')],_[_0x93eb('0x8f')](_0x289bdc[_0x93eb('0x54')],[_0x93eb('0x8e'),'id'])||{})[_0x93eb('0x90')](function(_0x1a5fff){for(var _0x9ae6f3=0x0;_0x9ae6f3<_0x289bdc[_0x93eb('0x54')][_0x93eb('0x8e')][_0x93eb('0x42')];_0x9ae6f3+=0x1){socket[_0x93eb('0x76')]('userWhatsappQueue:save',{'UserId':Number(_0x289bdc['body'][_0x93eb('0x8e')][_0x9ae6f3]),'WhatsappQueueId':Number(_0x289bdc[_0x93eb('0x50')]['id'])});}return _0x1a5fff;});}})[_0x93eb('0x2e')](respondWithResult(_0x52c112,null))[_0x93eb('0x4e')](handleError(_0x52c112,null));};exports[_0x93eb('0x8b')]=function(_0xd640,_0xc871e1,_0x1ab02f){return db[_0x93eb('0x37')][_0x93eb('0x52')]({'where':{'id':_0xd640['params']['id']}})[_0x93eb('0x2e')](handleEntityNotFound(_0xc871e1,null))['then'](function(_0x1e7c4e){if(_0x1e7c4e){return _0x1e7c4e['removeAgents'](_0xd640['query'][_0x93eb('0x8e')])[_0x93eb('0x2e')](function(){if(_['isArray'](_0xd640[_0x93eb('0x3c')][_0x93eb('0x8e')])){for(var _0x238a2=0x0;_0x238a2<_0xd640[_0x93eb('0x3c')][_0x93eb('0x8e')][_0x93eb('0x42')];_0x238a2+=0x1){socket[_0x93eb('0x76')](_0x93eb('0x91'),{'UserId':Number(_0xd640[_0x93eb('0x3c')][_0x93eb('0x8e')][_0x238a2]),'WhatsappQueueId':Number(_0xd640[_0x93eb('0x50')]['id'])});}}else{socket[_0x93eb('0x76')](_0x93eb('0x91'),{'UserId':Number(_0xd640[_0x93eb('0x3c')][_0x93eb('0x8e')]),'WhatsappQueueId':Number(_0xd640['params']['id'])});}});}})[_0x93eb('0x2e')](respondWithStatusCode(_0xc871e1,null))[_0x93eb('0x4e')](handleError(_0xc871e1,null));};exports['getAgents']=function(_0x4b8adf,_0xa17c60,_0x31c0ed){var _0x2be082={};var _0x566e2c={};var _0x4505ec;var _0x52f877;return db[_0x93eb('0x37')][_0x93eb('0x5d')]({'where':{'id':_0x4b8adf[_0x93eb('0x50')]['id']}})[_0x93eb('0x2e')](handleEntityNotFound(_0xa17c60,null))[_0x93eb('0x2e')](function(_0x31b4ac){if(_0x31b4ac){_0x4505ec=_0x31b4ac;_0x566e2c[_0x93eb('0x3b')]=_[_0x93eb('0x3d')](db[_0x93eb('0x62')][_0x93eb('0x38')]);_0x566e2c[_0x93eb('0x3c')]=_[_0x93eb('0x3d')](_0x4b8adf['query']);_0x566e2c[_0x93eb('0x3e')]=_['intersection'](_0x566e2c[_0x93eb('0x3b')],_0x566e2c[_0x93eb('0x3c')]);_0x2be082[_0x93eb('0x40')]=_['intersection'](_0x566e2c[_0x93eb('0x3b')],qs[_0x93eb('0x41')](_0x4b8adf['query'][_0x93eb('0x41')]));_0x2be082[_0x93eb('0x40')]=_0x2be082['attributes']['length']?_0x2be082[_0x93eb('0x40')]:_0x566e2c['model'];_0x2be082['order']=qs[_0x93eb('0x45')](_0x4b8adf[_0x93eb('0x3c')][_0x93eb('0x45')]);_0x2be082['where']=qs[_0x93eb('0x3e')](_[_0x93eb('0x47')](_0x4b8adf[_0x93eb('0x3c')],_0x566e2c[_0x93eb('0x3e')]));if(_0x4b8adf['query']['filter']){_0x2be082[_0x93eb('0x46')]=_[_0x93eb('0x49')](_0x2be082[_0x93eb('0x46')],{'$or':_['map'](_0x2be082[_0x93eb('0x40')],function(_0x26916c){var _0x1ae608={};_0x1ae608[_0x26916c]={'$like':'%'+_0x4b8adf['query'][_0x93eb('0x48')]+'%'};return _0x1ae608;})});}_0x2be082=_[_0x93eb('0x49')]({},_0x2be082,_0x4b8adf['options']);return _0x4505ec[_0x93eb('0x92')](_0x2be082);}})[_0x93eb('0x2e')](function(_0x5ce3a2){if(_0x5ce3a2){_0x52f877=_0x5ce3a2[_0x93eb('0x42')];if(!_0x4b8adf[_0x93eb('0x3c')][_0x93eb('0x43')](_0x93eb('0x44'))){_0x2be082[_0x93eb('0x27')]=qs[_0x93eb('0x27')](_0x4b8adf['query']['limit']);_0x2be082[_0x93eb('0x25')]=qs['offset'](_0x4b8adf[_0x93eb('0x3c')][_0x93eb('0x25')]);}return _0x4505ec[_0x93eb('0x92')](_0x2be082);}})[_0x93eb('0x2e')](function(_0x4e0e5c){if(_0x4e0e5c){return _0x4e0e5c?{'count':_0x52f877,'rows':_0x4e0e5c}:null;}})['then'](respondWithResult(_0xa17c60,null))['catch'](handleError(_0xa17c60,null));}; \ No newline at end of file +var _0x1df6=['interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','get','WhatsappQueues','destroy','error','stack','name','send','rawAttributes','fieldName','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappQueue','includeAll','include','findAll','rows','show','params','intersection','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','pick','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','Agents'];(function(_0x3dc1e5,_0x2b3ce9){var _0x2c4e8d=function(_0xcb8719){while(--_0xcb8719){_0x3dc1e5['push'](_0x3dc1e5['shift']());}};_0x2c4e8d(++_0x2b3ce9);}(_0x1df6,0x150));var _0x61df=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1df6[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x61df('0x0'));var rimraf=require(_0x61df('0x1'));var zipdir=require(_0x61df('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x61df('0x3'));var moment=require(_0x61df('0x4'));var BPromise=require(_0x61df('0x5'));var Mustache=require(_0x61df('0x6'));var util=require(_0x61df('0x7'));var path=require(_0x61df('0x8'));var sox=require(_0x61df('0x9'));var csv=require(_0x61df('0xa'));var ejs=require(_0x61df('0xb'));var fs=require('fs');var fs_extra=require(_0x61df('0xc'));var _=require(_0x61df('0xd'));var squel=require(_0x61df('0xe'));var crypto=require(_0x61df('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x61df('0x10'));var toCsv=require(_0x61df('0xa'));var querystring=require(_0x61df('0x11'));var Papa=require(_0x61df('0x12'));var Redis=require(_0x61df('0x13'));var authService=require(_0x61df('0x14'));var qs=require(_0x61df('0x15'));var as=require(_0x61df('0x16'));var hardwareService=require(_0x61df('0x17'));var logger=require(_0x61df('0x18'))('api');var utils=require(_0x61df('0x19'));var config=require(_0x61df('0x1a'));var licenseUtil=require(_0x61df('0x1b'));var db=require(_0x61df('0x1c'))['db'];config[_0x61df('0x1d')]=_[_0x61df('0x1e')](config[_0x61df('0x1d')],{'host':_0x61df('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x61df('0x1d')]));require(_0x61df('0x20'))[_0x61df('0x21')](socket);function respondWithStatusCode(_0x2e8698,_0x434ca5){_0x434ca5=_0x434ca5||0xcc;return function(_0x456e0d){if(_0x456e0d){return _0x2e8698[_0x61df('0x22')](_0x434ca5);}return _0x2e8698['status'](_0x434ca5)[_0x61df('0x23')]();};}function respondWithResult(_0x185202,_0xdbe4eb){_0xdbe4eb=_0xdbe4eb||0xc8;return function(_0x40fd7a){if(_0x40fd7a){return _0x185202[_0x61df('0x24')](_0xdbe4eb)['json'](_0x40fd7a);}};}function respondWithFilteredResult(_0x583312,_0x21a6dd){return function(_0x4bb2a7){if(_0x4bb2a7){var _0x42a861=typeof _0x21a6dd[_0x61df('0x25')]==='undefined'&&typeof _0x21a6dd[_0x61df('0x26')]===_0x61df('0x27');var _0x5c4095=_0x4bb2a7[_0x61df('0x28')];var _0xfae1e0=_0x42a861?0x0:_0x21a6dd[_0x61df('0x25')];var _0x6fd508=_0x42a861?_0x4bb2a7['count']:_0x21a6dd[_0x61df('0x25')]+_0x21a6dd[_0x61df('0x26')];var _0x97d2f5;if(_0x6fd508>=_0x5c4095){_0x6fd508=_0x5c4095;_0x97d2f5=0xc8;}else{_0x97d2f5=0xce;}_0x583312[_0x61df('0x24')](_0x97d2f5);return _0x583312[_0x61df('0x29')](_0x61df('0x2a'),_0xfae1e0+'-'+_0x6fd508+'/'+_0x5c4095)[_0x61df('0x2b')](_0x4bb2a7);}return null;};}function patchUpdates(_0x45f998){return function(_0x524704){try{jsonpatch[_0x61df('0x2c')](_0x524704,_0x45f998,!![]);}catch(_0x4272d1){return BPromise['reject'](_0x4272d1);}return _0x524704[_0x61df('0x2d')]();};}function saveUpdates(_0x448f31,_0x4dc508){return function(_0x2949d0){if(_0x2949d0){return _0x2949d0[_0x61df('0x2e')](_0x448f31)[_0x61df('0x2f')](function(_0x323b20){return _0x323b20;});}return null;};}function removeEntity(_0x4f0a37,_0x51575b){return function(_0x248569){if(_0x248569){return _0x248569['destroy']()[_0x61df('0x2f')](function(){var _0x21ee82=_0x248569[_0x61df('0x30')]({'plain':!![]});var _0x2bb136=_0x61df('0x31');return db['UserProfileResource'][_0x61df('0x32')]({'where':{'type':_0x2bb136,'resourceId':_0x21ee82['id']}})[_0x61df('0x2f')](function(){return _0x248569;});})[_0x61df('0x2f')](function(){_0x4f0a37[_0x61df('0x24')](0xcc)[_0x61df('0x23')]();});}};}function handleEntityNotFound(_0x572129,_0x46276d){return function(_0xdab2ec){if(!_0xdab2ec){_0x572129[_0x61df('0x22')](0x194);}return _0xdab2ec;};}function handleError(_0x39735b,_0x4e335e){_0x4e335e=_0x4e335e||0x1f4;return function(_0x4941f5){logger[_0x61df('0x33')](_0x4941f5[_0x61df('0x34')]);if(_0x4941f5[_0x61df('0x35')]){delete _0x4941f5[_0x61df('0x35')];}_0x39735b[_0x61df('0x24')](_0x4e335e)[_0x61df('0x36')](_0x4941f5);};}exports['index']=function(_0x47bf12,_0x266fa5){var _0x3923ca={},_0x2f4683={},_0xa5fccc={'count':0x0,'rows':[]};var _0x391de4=_['map'](db['WhatsappQueue'][_0x61df('0x37')],function(_0x4c09d6){return{'name':_0x4c09d6[_0x61df('0x38')],'type':_0x4c09d6['type']['key']};});_0x2f4683['model']=_[_0x61df('0x39')](_0x391de4,_0x61df('0x35'));_0x2f4683[_0x61df('0x3a')]=_[_0x61df('0x3b')](_0x47bf12[_0x61df('0x3a')]);_0x2f4683[_0x61df('0x3c')]=_['intersection'](_0x2f4683[_0x61df('0x3d')],_0x2f4683[_0x61df('0x3a')]);_0x3923ca[_0x61df('0x3e')]=_['intersection'](_0x2f4683[_0x61df('0x3d')],qs[_0x61df('0x3f')](_0x47bf12[_0x61df('0x3a')][_0x61df('0x3f')]));_0x3923ca[_0x61df('0x3e')]=_0x3923ca[_0x61df('0x3e')][_0x61df('0x40')]?_0x3923ca[_0x61df('0x3e')]:_0x2f4683[_0x61df('0x3d')];if(!_0x47bf12[_0x61df('0x3a')][_0x61df('0x41')](_0x61df('0x42'))){_0x3923ca[_0x61df('0x26')]=qs[_0x61df('0x26')](_0x47bf12[_0x61df('0x3a')][_0x61df('0x26')]);_0x3923ca[_0x61df('0x25')]=qs[_0x61df('0x25')](_0x47bf12[_0x61df('0x3a')]['offset']);}_0x3923ca[_0x61df('0x43')]=qs[_0x61df('0x44')](_0x47bf12[_0x61df('0x3a')][_0x61df('0x44')]);_0x3923ca[_0x61df('0x45')]=qs[_0x61df('0x3c')](_['pick'](_0x47bf12[_0x61df('0x3a')],_0x2f4683[_0x61df('0x3c')]),_0x391de4);if(_0x47bf12[_0x61df('0x3a')][_0x61df('0x46')]){_0x3923ca[_0x61df('0x45')]=_[_0x61df('0x47')](_0x3923ca[_0x61df('0x45')],{'$or':_[_0x61df('0x39')](_0x391de4,function(_0x5c67ce){if(_0x5c67ce['type']!==_0x61df('0x48')){var _0x656100={};_0x656100[_0x5c67ce[_0x61df('0x35')]]={'$like':'%'+_0x47bf12[_0x61df('0x3a')][_0x61df('0x46')]+'%'};return _0x656100;}})});}_0x3923ca=_[_0x61df('0x47')]({},_0x3923ca,_0x47bf12[_0x61df('0x49')]);var _0x376062={'where':_0x3923ca[_0x61df('0x45')]};return db[_0x61df('0x4a')][_0x61df('0x28')](_0x376062)[_0x61df('0x2f')](function(_0x38ef12){_0xa5fccc[_0x61df('0x28')]=_0x38ef12;if(_0x47bf12[_0x61df('0x3a')][_0x61df('0x4b')]){_0x3923ca[_0x61df('0x4c')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x61df('0x4d')](_0x3923ca);})[_0x61df('0x2f')](function(_0x41966f){_0xa5fccc[_0x61df('0x4e')]=_0x41966f;return _0xa5fccc;})['then'](respondWithFilteredResult(_0x266fa5,_0x3923ca))['catch'](handleError(_0x266fa5,null));};exports[_0x61df('0x4f')]=function(_0x1a8dd5,_0x4edfd9){var _0x1e32b5={'raw':!![],'where':{'id':_0x1a8dd5[_0x61df('0x50')]['id']}},_0x5eb1f9={};_0x5eb1f9['model']=_[_0x61df('0x3b')](db[_0x61df('0x4a')][_0x61df('0x37')]);_0x5eb1f9['query']=_[_0x61df('0x3b')](_0x1a8dd5[_0x61df('0x3a')]);_0x5eb1f9[_0x61df('0x3c')]=_[_0x61df('0x51')](_0x5eb1f9[_0x61df('0x3d')],_0x5eb1f9[_0x61df('0x3a')]);_0x1e32b5[_0x61df('0x3e')]=_[_0x61df('0x51')](_0x5eb1f9[_0x61df('0x3d')],qs[_0x61df('0x3f')](_0x1a8dd5['query'][_0x61df('0x3f')]));_0x1e32b5[_0x61df('0x3e')]=_0x1e32b5[_0x61df('0x3e')][_0x61df('0x40')]?_0x1e32b5[_0x61df('0x3e')]:_0x5eb1f9[_0x61df('0x3d')];if(_0x1a8dd5[_0x61df('0x3a')][_0x61df('0x4b')]){_0x1e32b5[_0x61df('0x4c')]=[{'all':!![]}];}_0x1e32b5=_['merge']({},_0x1e32b5,_0x1a8dd5[_0x61df('0x49')]);return db[_0x61df('0x4a')]['find'](_0x1e32b5)[_0x61df('0x2f')](handleEntityNotFound(_0x4edfd9,null))['then'](respondWithResult(_0x4edfd9,null))[_0x61df('0x52')](handleError(_0x4edfd9,null));};exports[_0x61df('0x53')]=function(_0x1c678a,_0x325365){return db[_0x61df('0x4a')][_0x61df('0x53')](_0x1c678a[_0x61df('0x54')],{})['then'](function(_0x1fc217){var _0x3c39b5=_0x1c678a['user'][_0x61df('0x30')]({'plain':!![]});if(!_0x3c39b5)throw new Error(_0x61df('0x55'));if(_0x3c39b5[_0x61df('0x56')]===_0x61df('0x57')){var _0x2f9aec=_0x1fc217[_0x61df('0x30')]({'plain':!![]});var _0x12d849='WhatsappQueues';return db[_0x61df('0x58')][_0x61df('0x59')]({'where':{'name':_0x12d849,'userProfileId':_0x3c39b5['userProfileId']},'raw':!![]})[_0x61df('0x2f')](function(_0x347778){if(_0x347778&&_0x347778[_0x61df('0x5a')]===0x0){return db[_0x61df('0x5b')][_0x61df('0x53')]({'name':_0x2f9aec[_0x61df('0x35')],'resourceId':_0x2f9aec['id'],'type':_0x347778[_0x61df('0x35')],'sectionId':_0x347778['id']},{})[_0x61df('0x2f')](function(){return _0x1fc217;});}else{return _0x1fc217;}})[_0x61df('0x52')](function(_0x514edf){logger['error'](_0x61df('0x5c'),_0x514edf);throw _0x514edf;});}return _0x1fc217;})[_0x61df('0x2f')](respondWithResult(_0x325365,0xc9))['catch'](handleError(_0x325365,null));};exports['update']=function(_0x54ae03,_0x3f8560){if(_0x54ae03[_0x61df('0x54')]['id']){delete _0x54ae03[_0x61df('0x54')]['id'];}return db[_0x61df('0x4a')]['find']({'where':{'id':_0x54ae03[_0x61df('0x50')]['id']}})[_0x61df('0x2f')](handleEntityNotFound(_0x3f8560,null))[_0x61df('0x2f')](saveUpdates(_0x54ae03['body'],null))[_0x61df('0x2f')](respondWithResult(_0x3f8560,null))['catch'](handleError(_0x3f8560,null));};exports[_0x61df('0x32')]=function(_0x4970dd,_0x95c91a){return db[_0x61df('0x4a')][_0x61df('0x59')]({'where':{'id':_0x4970dd[_0x61df('0x50')]['id']}})[_0x61df('0x2f')](handleEntityNotFound(_0x95c91a,null))[_0x61df('0x2f')](removeEntity(_0x95c91a,null))['catch'](handleError(_0x95c91a,null));};exports[_0x61df('0x5d')]=function(_0x4bd1c5,_0x4adc33){return db[_0x61df('0x4a')][_0x61df('0x5d')]()['then'](respondWithResult(_0x4adc33,null))[_0x61df('0x52')](handleError(_0x4adc33,null));};exports[_0x61df('0x5e')]=function(_0x146f37,_0x1c1d49,_0x3c45ee){var _0x2adbc3={'raw':!![],'where':{}},_0x36d183={},_0x470496;return db[_0x61df('0x4a')]['findOne']({'where':{'id':_0x146f37[_0x61df('0x50')]['id']}})[_0x61df('0x2f')](handleEntityNotFound(_0x1c1d49,null))['then'](function(_0x3814bb){if(_0x3814bb){_0x470496=_0x3814bb[_0x61df('0x30')]({'plain':!![]});_0x36d183[_0x61df('0x3d')]=_[_0x61df('0x3b')](db[_0x61df('0x5f')][_0x61df('0x37')]);_0x36d183['query']=_['keys'](_0x146f37[_0x61df('0x3a')]);_0x36d183[_0x61df('0x3c')]=_['intersection'](_0x36d183['model'],_0x36d183[_0x61df('0x3a')]);_0x2adbc3[_0x61df('0x3e')]=_[_0x61df('0x51')](_0x36d183[_0x61df('0x3d')],qs[_0x61df('0x3f')](_0x146f37[_0x61df('0x3a')][_0x61df('0x3f')]));_0x2adbc3[_0x61df('0x3e')]=_0x2adbc3[_0x61df('0x3e')][_0x61df('0x40')]?_0x2adbc3[_0x61df('0x3e')]:_0x36d183[_0x61df('0x3d')];if(!_0x146f37['query'][_0x61df('0x41')](_0x61df('0x42'))){_0x2adbc3[_0x61df('0x26')]=qs[_0x61df('0x26')](_0x146f37[_0x61df('0x3a')][_0x61df('0x26')]);_0x2adbc3[_0x61df('0x25')]=qs[_0x61df('0x25')](_0x146f37[_0x61df('0x3a')][_0x61df('0x25')]);}_0x2adbc3[_0x61df('0x43')]=qs[_0x61df('0x44')](_0x146f37[_0x61df('0x3a')][_0x61df('0x44')]);_0x2adbc3['where']=qs[_0x61df('0x3c')](_[_0x61df('0x60')](_0x146f37['query'],_0x36d183[_0x61df('0x3c')]));_0x2adbc3[_0x61df('0x45')][_0x61df('0x61')]=_0x3814bb['id'];if(_0x146f37[_0x61df('0x3a')]['filter']){_0x2adbc3['where']=_[_0x61df('0x47')](_0x2adbc3['where'],{'$or':_['map'](_0x2adbc3[_0x61df('0x3e')],function(_0x331ad0){var _0x3c4638={};_0x3c4638[_0x331ad0]={'$like':'%'+_0x146f37[_0x61df('0x3a')][_0x61df('0x46')]+'%'};return _0x3c4638;})});}_0x2adbc3=_[_0x61df('0x47')]({},_0x2adbc3,_0x146f37[_0x61df('0x49')]);return db[_0x61df('0x5f')]['findAll'](_0x2adbc3);}})[_0x61df('0x2f')](function(_0x345138){if(_0x345138){return db[_0x61df('0x62')][_0x61df('0x63')]({'where':{'id':_[_0x61df('0x39')](_0x345138,_0x61df('0x64')),'role':_0x61df('0x65')},'attributes':['id',_0x61df('0x35'),_0x61df('0x66'),_0x61df('0x67'),_0x61df('0x68')]});}})[_0x61df('0x2f')](function(_0x50c3fe){if(_0x50c3fe){return{'count':_0x50c3fe[_0x61df('0x28')],'rows':_[_0x61df('0x39')](_0x50c3fe['rows'],function(_0x4a3004){return{'membername':_0x4a3004[_0x61df('0x35')],'UserId':_0x4a3004['id'],'queue_name':_0x470496[_0x61df('0x35')],'WhatsappQueueId':_0x470496['id'],'interface':util[_0x61df('0x69')](_0x61df('0x6a'),_0x61df('0x6b'),_0x4a3004[_0x61df('0x35')]),'penalty':0x0,'paused':_0x4a3004[_0x61df('0x66')],'createdAt':_0x4a3004['createdAt'],'updatedAt':_0x4a3004['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x61df('0x2f')](respondWithFilteredResult(_0x1c1d49,_0x2adbc3))[_0x61df('0x52')](handleError(_0x1c1d49,null));};exports[_0x61df('0x6c')]=function(_0x48d223,_0x361593,_0x3aa181){var _0x273b64={};var _0x124cfc={};var _0x5f14a1;var _0x42841b;return db['WhatsappQueue'][_0x61df('0x6d')]({'where':{'id':_0x48d223[_0x61df('0x50')]['id']}})['then'](handleEntityNotFound(_0x361593,null))[_0x61df('0x2f')](function(_0xa1b5ec){if(_0xa1b5ec){_0x5f14a1=_0xa1b5ec;_0x124cfc[_0x61df('0x3d')]=_['keys'](db[_0x61df('0x6e')]['rawAttributes']);_0x124cfc[_0x61df('0x3a')]=_[_0x61df('0x3b')](_0x48d223[_0x61df('0x3a')]);_0x124cfc['filters']=_[_0x61df('0x51')](_0x124cfc[_0x61df('0x3d')],_0x124cfc[_0x61df('0x3a')]);_0x273b64[_0x61df('0x3e')]=_[_0x61df('0x51')](_0x124cfc[_0x61df('0x3d')],qs['fields'](_0x48d223[_0x61df('0x3a')][_0x61df('0x3f')]));_0x273b64[_0x61df('0x3e')]=_0x273b64[_0x61df('0x3e')][_0x61df('0x40')]?_0x273b64[_0x61df('0x3e')]:_0x124cfc[_0x61df('0x3d')];_0x273b64['order']=qs['sort'](_0x48d223['query'][_0x61df('0x44')]);_0x273b64[_0x61df('0x45')]=qs[_0x61df('0x3c')](_['pick'](_0x48d223[_0x61df('0x3a')],_0x124cfc[_0x61df('0x3c')]));if(_0x48d223[_0x61df('0x3a')][_0x61df('0x46')]){_0x273b64[_0x61df('0x45')]=_[_0x61df('0x47')](_0x273b64[_0x61df('0x45')],{'$or':_['map'](_0x273b64['attributes'],function(_0x2e71af){var _0x3cf4b8={};_0x3cf4b8[_0x2e71af]={'$like':'%'+_0x48d223[_0x61df('0x3a')][_0x61df('0x46')]+'%'};return _0x3cf4b8;})});}_0x273b64=_['merge']({},_0x273b64,_0x48d223[_0x61df('0x49')]);return _0x5f14a1[_0x61df('0x6c')](_0x273b64);}})[_0x61df('0x2f')](function(_0x4ce874){if(_0x4ce874){_0x42841b=_0x4ce874[_0x61df('0x40')];if(!_0x48d223[_0x61df('0x3a')]['hasOwnProperty'](_0x61df('0x42'))){_0x273b64['limit']=qs[_0x61df('0x26')](_0x48d223[_0x61df('0x3a')][_0x61df('0x26')]);_0x273b64[_0x61df('0x25')]=qs['offset'](_0x48d223['query'][_0x61df('0x25')]);}return _0x5f14a1[_0x61df('0x6c')](_0x273b64);}})[_0x61df('0x2f')](function(_0x4304a6){if(_0x4304a6){return _0x4304a6?{'count':_0x42841b,'rows':_0x4304a6}:null;}})[_0x61df('0x2f')](respondWithResult(_0x361593,null))[_0x61df('0x52')](handleError(_0x361593,null));};exports[_0x61df('0x6f')]=function(_0xf44a50,_0xd1d061,_0x1a0fb7){var _0x4459be=_0xf44a50[_0x61df('0x54')][_0x61df('0x70')];return db[_0x61df('0x6e')][_0x61df('0x4d')]({'where':{'id':_0x4459be},'attributes':['id'],'include':[{'model':db['User'],'as':_0x61df('0x71'),'attributes':['id','name','online','voicePause',_0x61df('0x72')],'raw':!![]}]})[_0x61df('0x2f')](function(_0x3d65b9){if(_0x3d65b9){var _0x38a898=_[_0x61df('0x73')](_0x3d65b9,function(_0x10d6cf){var _0x107b32=_0x10d6cf[_0x61df('0x30')]({'plain':!![]});return _0x107b32[_0x61df('0x71')];});return db[_0x61df('0x4a')][_0x61df('0x59')]({'where':{'id':_0xf44a50['params']['id']}})[_0x61df('0x2f')](function(_0x1474c6){return db[_0x61df('0x74')][_0x61df('0x75')](function(_0xcfdaed){return _0x1474c6[_0x61df('0x6f')](_0x4459be,{'transaction':_0xcfdaed})[_0x61df('0x2f')](function(){return BPromise[_0x61df('0x76')](_0x38a898,function(_0x574037){return db[_0x61df('0x5f')][_0x61df('0x77')]({'where':{'UserId':_0x574037['id'],'WhatsappQueueId':_0xf44a50[_0x61df('0x50')]['id']},'transaction':_0xcfdaed});});})[_0x61df('0x2f')](function(){_0x38a898[_0x61df('0x78')](function(_0x5554c6){socket[_0x61df('0x79')](_0x61df('0x7a'),{'UserId':_0x5554c6['id'],'WhatsappQueueId':_0x1474c6['id']});});});});});}})[_0x61df('0x2f')](respondWithStatusCode(_0xd1d061,null))[_0x61df('0x52')](handleError(_0xd1d061,null));};exports[_0x61df('0x7b')]=function(_0x240c5a,_0x377a0d,_0x6b4d27){return db[_0x61df('0x6e')]['findAll']({'where':{'id':_0x240c5a[_0x61df('0x3a')][_0x61df('0x70')]},'attributes':['id'],'include':[{'model':db[_0x61df('0x62')],'as':_0x61df('0x71'),'attributes':['id'],'raw':!![]}]})[_0x61df('0x2f')](handleEntityNotFound(_0x377a0d,null))[_0x61df('0x2f')](function(_0x1e2672){var _0x521988=_[_0x61df('0x39')](_0x1e2672,'id');var _0x59986e=[];var _0x37bf2b=[];var _0x31fc3e=squel['select']();_0x31fc3e[_0x61df('0x7c')](_0x61df('0x7d'))[_0x61df('0x7e')](_0x61df('0x7f'),'tq')[_0x61df('0x80')](_0x61df('0x81'),'ut',_0x61df('0x82'))[_0x61df('0x45')](_0x61df('0x83'),_0x240c5a[_0x61df('0x50')]['id']);for(var _0x21ec57=0x0;_0x21ec57<_0x1e2672[_0x61df('0x40')];_0x21ec57+=0x1){let _0xc48055=_0x1e2672[_0x21ec57];for(var _0xb59af9=0x0;_0xb59af9<_0xc48055['Agents']['length'];_0xb59af9+=0x1){let _0x5c99cd=_0xc48055[_0x61df('0x71')][_0xb59af9];var _0x54e310=_0x31fc3e[_0x61df('0x84')]();_0x54e310['where'](_0x61df('0x85'),_0x5c99cd['id']);_0x37bf2b[_0x61df('0x86')](db['sequelize']['query'](_0x54e310[_0x61df('0x87')](),{'type':db[_0x61df('0x74')][_0x61df('0x88')][_0x61df('0x89')]})[_0x61df('0x2f')](function(_0x23d303){if(_0x23d303[_0x61df('0x40')]===0x1){return _0x5c99cd['id'];}else{var _0x5a5db9=_['every'](_[_0x61df('0x39')](_0x23d303,_0x61df('0x8a')),function(_0x2b1d8b){return _[_0x61df('0x8b')](_0x521988,_0x2b1d8b);});if(_0x5a5db9){return _0x5c99cd['id'];}}}));}}return BPromise[_0x61df('0x8c')](_0x37bf2b)[_0x61df('0x2f')](function(_0x1f18b3){_0x59986e=_(_0x59986e)[_0x61df('0x8d')](_0x1f18b3)[_0x61df('0x8e')]()['value']();return db[_0x61df('0x4a')][_0x61df('0x59')]({'where':{'id':_0x240c5a['params']['id']}})[_0x61df('0x2f')](function(_0x3f292a){return db[_0x61df('0x74')][_0x61df('0x75')](function(_0x5ad7fe){return _0x3f292a[_0x61df('0x7b')](_0x240c5a['query'][_0x61df('0x70')],{'transaction':_0x5ad7fe})['then'](function(){if(!_[_0x61df('0x8f')](_0x59986e)){return _0x3f292a[_0x61df('0x90')](_0x59986e,{'transaction':_0x5ad7fe});}})[_0x61df('0x2f')](function(){_0x59986e[_0x61df('0x78')](function(_0x4679ea){socket[_0x61df('0x79')](_0x61df('0x91'),{'UserId':_0x4679ea,'WhatsappQueueId':_0x3f292a['id']});});});});});});})['then'](respondWithStatusCode(_0x377a0d,null))[_0x61df('0x52')](handleError(_0x377a0d,null));};exports['addAgents']=function(_0x1ee308,_0x468231,_0x4fefa1){return db['WhatsappQueue'][_0x61df('0x59')]({'where':{'id':_0x1ee308['params']['id']}})[_0x61df('0x2f')](handleEntityNotFound(_0x468231,null))[_0x61df('0x2f')](function(_0x3f923c){if(_0x3f923c){return _0x3f923c[_0x61df('0x92')](_0x1ee308[_0x61df('0x54')]['ids'],_['omit'](_0x1ee308[_0x61df('0x54')],[_0x61df('0x70'),'id'])||{})[_0x61df('0x93')](function(_0x473241){for(var _0x4c8e3a=0x0;_0x4c8e3a<_0x1ee308[_0x61df('0x54')]['ids'][_0x61df('0x40')];_0x4c8e3a+=0x1){socket['emit'](_0x61df('0x7a'),{'UserId':Number(_0x1ee308[_0x61df('0x54')][_0x61df('0x70')][_0x4c8e3a]),'WhatsappQueueId':Number(_0x1ee308[_0x61df('0x50')]['id'])});}return _0x473241;});}})['then'](respondWithResult(_0x468231,null))[_0x61df('0x52')](handleError(_0x468231,null));};exports['removeAgents']=function(_0x23981a,_0x33a671,_0x5b05a5){return db['WhatsappQueue'][_0x61df('0x59')]({'where':{'id':_0x23981a[_0x61df('0x50')]['id']}})[_0x61df('0x2f')](handleEntityNotFound(_0x33a671,null))['then'](function(_0x2a2505){if(_0x2a2505){return _0x2a2505[_0x61df('0x90')](_0x23981a[_0x61df('0x3a')][_0x61df('0x70')])[_0x61df('0x2f')](function(){if(_[_0x61df('0x94')](_0x23981a[_0x61df('0x3a')][_0x61df('0x70')])){for(var _0x2612e5=0x0;_0x2612e5<_0x23981a['query'][_0x61df('0x70')][_0x61df('0x40')];_0x2612e5+=0x1){socket[_0x61df('0x79')]('userWhatsappQueue:remove',{'UserId':Number(_0x23981a[_0x61df('0x3a')][_0x61df('0x70')][_0x2612e5]),'WhatsappQueueId':Number(_0x23981a[_0x61df('0x50')]['id'])});}}else{socket[_0x61df('0x79')](_0x61df('0x91'),{'UserId':Number(_0x23981a[_0x61df('0x3a')][_0x61df('0x70')]),'WhatsappQueueId':Number(_0x23981a[_0x61df('0x50')]['id'])});}});}})[_0x61df('0x2f')](respondWithStatusCode(_0x33a671,null))['catch'](handleError(_0x33a671,null));};exports['getAgents']=function(_0x223670,_0x9be2f3,_0x4f6fd1){var _0x433ec8={};var _0x210b9e={};var _0x23b0cf;var _0x11c022;return db[_0x61df('0x4a')][_0x61df('0x6d')]({'where':{'id':_0x223670[_0x61df('0x50')]['id']}})[_0x61df('0x2f')](handleEntityNotFound(_0x9be2f3,null))[_0x61df('0x2f')](function(_0x1ff4fc){if(_0x1ff4fc){_0x23b0cf=_0x1ff4fc;_0x210b9e[_0x61df('0x3d')]=_[_0x61df('0x3b')](db[_0x61df('0x62')]['rawAttributes']);_0x210b9e[_0x61df('0x3a')]=_[_0x61df('0x3b')](_0x223670['query']);_0x210b9e[_0x61df('0x3c')]=_[_0x61df('0x51')](_0x210b9e[_0x61df('0x3d')],_0x210b9e[_0x61df('0x3a')]);_0x433ec8['attributes']=_['intersection'](_0x210b9e[_0x61df('0x3d')],qs[_0x61df('0x3f')](_0x223670[_0x61df('0x3a')][_0x61df('0x3f')]));_0x433ec8[_0x61df('0x3e')]=_0x433ec8[_0x61df('0x3e')]['length']?_0x433ec8[_0x61df('0x3e')]:_0x210b9e[_0x61df('0x3d')];_0x433ec8[_0x61df('0x43')]=qs[_0x61df('0x44')](_0x223670[_0x61df('0x3a')][_0x61df('0x44')]);_0x433ec8[_0x61df('0x45')]=qs['filters'](_[_0x61df('0x60')](_0x223670['query'],_0x210b9e[_0x61df('0x3c')]));if(_0x223670['query']['filter']){_0x433ec8[_0x61df('0x45')]=_[_0x61df('0x47')](_0x433ec8[_0x61df('0x45')],{'$or':_[_0x61df('0x39')](_0x433ec8['attributes'],function(_0x306c8e){var _0x55a941={};_0x55a941[_0x306c8e]={'$like':'%'+_0x223670[_0x61df('0x3a')]['filter']+'%'};return _0x55a941;})});}_0x433ec8=_[_0x61df('0x47')]({},_0x433ec8,_0x223670['options']);return _0x23b0cf[_0x61df('0x95')](_0x433ec8);}})['then'](function(_0x52fd48){if(_0x52fd48){_0x11c022=_0x52fd48['length'];if(!_0x223670[_0x61df('0x3a')][_0x61df('0x41')]('nolimit')){_0x433ec8[_0x61df('0x26')]=qs['limit'](_0x223670['query'][_0x61df('0x26')]);_0x433ec8[_0x61df('0x25')]=qs[_0x61df('0x25')](_0x223670[_0x61df('0x3a')]['offset']);}return _0x23b0cf[_0x61df('0x95')](_0x433ec8);}})[_0x61df('0x2f')](function(_0x397489){if(_0x397489){return _0x397489?{'count':_0x11c022,'rows':_0x397489}:null;}})[_0x61df('0x2f')](respondWithResult(_0x9be2f3,null))['catch'](handleError(_0x9be2f3,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index c175268..2b37084 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 _0x4fb5=['emit','hasOwnProperty','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4fb5,0x12a));var _0x54fb=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4fb5[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0x54fb('0x0'));var WhatsappQueue=require(_0x54fb('0x1'))['db'][_0x54fb('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x54fb('0x3')](0x0);var events={'afterCreate':_0x54fb('0x4'),'afterUpdate':'update','afterDestroy':_0x54fb('0x5')};function emitEvent(_0x8c6c6d){return function(_0x231ad2,_0x20ea31,_0x193c51){WhatsappQueueEvents[_0x54fb('0x6')](_0x8c6c6d+':'+_0x231ad2['id'],_0x231ad2);WhatsappQueueEvents['emit'](_0x8c6c6d,_0x231ad2);_0x193c51(null);};}for(var e in events){if(events[_0x54fb('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x40ff=['emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove'];(function(_0x1ad8fc,_0x378b5e){var _0x222a1e=function(_0x228c9f){while(--_0x228c9f){_0x1ad8fc['push'](_0x1ad8fc['shift']());}};_0x222a1e(++_0x378b5e);}(_0x40ff,0x147));var _0xf40f=function(_0x35d3fb,_0x1406f3){_0x35d3fb=_0x35d3fb-0x0;var _0x5a9d0d=_0x40ff[_0x35d3fb];return _0x5a9d0d;};'use strict';var EventEmitter=require(_0xf40f('0x0'));var WhatsappQueue=require(_0xf40f('0x1'))['db'][_0xf40f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf40f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf40f('0x4'),'afterDestroy':_0xf40f('0x5')};function emitEvent(_0x855818){return function(_0x598a11,_0x371c27,_0x64e7e3){WhatsappQueueEvents[_0xf40f('0x6')](_0x855818+':'+_0x598a11['id'],_0x598a11);WhatsappQueueEvents[_0xf40f('0x6')](_0x855818,_0x598a11);_0x64e7e3(null);};}for(var e in events){if(events[_0xf40f('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xf40f('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 20ac445..50be594 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 _0x40e6=['rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','api','moment','request-promise'];(function(_0x56b0f2,_0x14554d){var _0x5d82ed=function(_0x3f482f){while(--_0x3f482f){_0x56b0f2['push'](_0x56b0f2['shift']());}};_0x5d82ed(++_0x14554d);}(_0x40e6,0x1f3));var _0x640e=function(_0x58c513,_0x15deec){_0x58c513=_0x58c513-0x0;var _0x4da4c4=_0x40e6[_0x58c513];return _0x4da4c4;};'use strict';var _=require(_0x640e('0x0'));var util=require(_0x640e('0x1'));var logger=require('../../config/logger')(_0x640e('0x2'));var moment=require(_0x640e('0x3'));var BPromise=require('bluebird');var rp=require(_0x640e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x640e('0x5'));var config=require(_0x640e('0x6'));var attributes=require(_0x640e('0x7'));module[_0x640e('0x8')]=function(_0x3afffb,_0x5ddc25){return _0x3afffb[_0x640e('0x9')](_0x640e('0xa'),attributes,{'tableName':_0x640e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67a4=['whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue'];(function(_0x2f23ce,_0x14cee0){var _0x2ce8aa=function(_0x9a0e37){while(--_0x9a0e37){_0x2f23ce['push'](_0x2f23ce['shift']());}};_0x2ce8aa(++_0x14cee0);}(_0x67a4,0x145));var _0x467a=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0x67a4[_0x54ccd7];return _0x4e667b;};'use strict';var _=require(_0x467a('0x0'));var util=require(_0x467a('0x1'));var logger=require('../../config/logger')(_0x467a('0x2'));var moment=require(_0x467a('0x3'));var BPromise=require(_0x467a('0x4'));var rp=require(_0x467a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x467a('0x6'));var config=require(_0x467a('0x7'));var attributes=require(_0x467a('0x8'));module[_0x467a('0x9')]=function(_0x154800,_0x5519d5){return _0x154800['define'](_0x467a('0xa'),attributes,{'tableName':_0x467a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 9b8c66d..122e1e4 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 _0x4dc6=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','ShowWhatsappQueue','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x18e711,_0x445de2){var _0x5c7fef=function(_0x464189){while(--_0x464189){_0x18e711['push'](_0x18e711['shift']());}};_0x5c7fef(++_0x445de2);}(_0x4dc6,0xc2));var _0x64dc=function(_0x25018e,_0x4ec973){_0x25018e=_0x25018e-0x0;var _0x49861d=_0x4dc6[_0x25018e];return _0x49861d;};'use strict';var _=require(_0x64dc('0x0'));var util=require(_0x64dc('0x1'));var moment=require('moment');var BPromise=require(_0x64dc('0x2'));var rs=require(_0x64dc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64dc('0x4'))['db'];var utils=require(_0x64dc('0x5'));var logger=require(_0x64dc('0x6'))(_0x64dc('0x7'));var config=require(_0x64dc('0x8'));var jayson=require(_0x64dc('0x9'));var client=jayson[_0x64dc('0xa')][_0x64dc('0xb')]({'port':0x232a});config[_0x64dc('0xc')]=_[_0x64dc('0xd')](config[_0x64dc('0xc')],{'host':_0x64dc('0xe'),'port':0x18eb});var socket=require(_0x64dc('0xf'))(new Redis(config[_0x64dc('0xc')]));require('./whatsappQueue.socket')[_0x64dc('0x10')](socket);function respondWithRpcPromise(_0x4d6d93,_0x399ed5,_0x5e93e4){return new BPromise(function(_0x5c5696,_0x1c873b){return client[_0x64dc('0x11')](_0x4d6d93,_0x5e93e4)[_0x64dc('0x12')](function(_0x47f09c){logger[_0x64dc('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x399ed5,_0x64dc('0x14'));logger[_0x64dc('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x399ed5,'request\x20sent',JSON[_0x64dc('0x16')](_0x47f09c));if(_0x47f09c[_0x64dc('0x17')]){if(_0x47f09c['error'][_0x64dc('0x18')]===0x1f4){logger['error'](_0x64dc('0x19'),_0x399ed5,_0x47f09c[_0x64dc('0x17')][_0x64dc('0x1a')]);return _0x1c873b(_0x47f09c[_0x64dc('0x17')][_0x64dc('0x1a')]);}logger['error'](_0x64dc('0x19'),_0x399ed5,_0x47f09c['error'][_0x64dc('0x1a')]);return _0x5c5696(_0x47f09c[_0x64dc('0x17')]['message']);}else{logger[_0x64dc('0x13')](_0x64dc('0x19'),_0x399ed5,_0x64dc('0x14'));_0x5c5696(_0x47f09c[_0x64dc('0x1b')][_0x64dc('0x1a')]);}})[_0x64dc('0x1c')](function(_0x25d116){logger['error'](_0x64dc('0x19'),_0x399ed5,_0x25d116);_0x1c873b(_0x25d116);});});}exports[_0x64dc('0x1d')]=function(_0x103b87){var _0x583c3e=this;return new Promise(function(_0x1dc358,_0x168421){return db[_0x64dc('0x1e')][_0x64dc('0x1f')]({'raw':_0x103b87[_0x64dc('0x20')]?_0x103b87[_0x64dc('0x20')][_0x64dc('0x21')]===undefined?!![]:![]:!![],'where':_0x103b87[_0x64dc('0x20')]?_0x103b87[_0x64dc('0x20')]['where']||null:null,'attributes':_0x103b87[_0x64dc('0x20')]?_0x103b87[_0x64dc('0x20')][_0x64dc('0x22')]||null:null,'limit':_0x103b87[_0x64dc('0x20')]?_0x103b87[_0x64dc('0x20')][_0x64dc('0x23')]||null:null,'include':_0x103b87['options']?_0x103b87['options'][_0x64dc('0x24')]?_[_0x64dc('0x25')](_0x103b87[_0x64dc('0x20')][_0x64dc('0x24')],function(_0x1e9d22){return{'model':db[_0x1e9d22[_0x64dc('0x26')]],'as':_0x1e9d22['as'],'attributes':_0x1e9d22['attributes'],'include':_0x1e9d22[_0x64dc('0x24')]?_[_0x64dc('0x25')](_0x1e9d22[_0x64dc('0x24')],function(_0x9f74a9){return{'model':db[_0x9f74a9[_0x64dc('0x26')]],'as':_0x9f74a9['as'],'attributes':_0x9f74a9[_0x64dc('0x22')],'include':_0x9f74a9['include']?_['map'](_0x9f74a9[_0x64dc('0x24')],function(_0x29f34f){return{'model':db[_0x29f34f[_0x64dc('0x26')]],'as':_0x29f34f['as'],'attributes':_0x29f34f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x517408){logger[_0x64dc('0x13')](_0x64dc('0x1d'),_0x103b87);logger[_0x64dc('0x15')](_0x64dc('0x1d'),_0x103b87,JSON[_0x64dc('0x16')](_0x517408));_0x1dc358(_0x517408);})['catch'](function(_0x107f33){logger['error'](_0x64dc('0x1d'),_0x107f33[_0x64dc('0x1a')],_0x103b87);_0x168421(_0x583c3e[_0x64dc('0x17')](0x1f4,_0x107f33['message']));});});};exports[_0x64dc('0x27')]=function(_0x20e591){var _0x46ba4a=this;return new Promise(function(_0x1be0fc,_0x516101){return db[_0x64dc('0x1e')]['find']({'raw':_0x20e591['options']?_0x20e591[_0x64dc('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x20e591['options']?_0x20e591['options'][_0x64dc('0x28')]||null:null,'attributes':_0x20e591['options']?_0x20e591['options']['attributes']||null:null,'include':_0x20e591[_0x64dc('0x20')]?_0x20e591[_0x64dc('0x20')]['include']?_[_0x64dc('0x25')](_0x20e591[_0x64dc('0x20')]['include'],function(_0x1e2b20){return{'model':db[_0x1e2b20[_0x64dc('0x26')]],'as':_0x1e2b20['as'],'attributes':_0x1e2b20['attributes'],'include':_0x1e2b20[_0x64dc('0x24')]?_[_0x64dc('0x25')](_0x1e2b20[_0x64dc('0x24')],function(_0x4bd396){return{'model':db[_0x4bd396[_0x64dc('0x26')]],'as':_0x4bd396['as'],'attributes':_0x4bd396[_0x64dc('0x22')],'include':_0x4bd396[_0x64dc('0x24')]?_[_0x64dc('0x25')](_0x4bd396[_0x64dc('0x24')],function(_0x4de9f7){return{'model':db[_0x4de9f7['model']],'as':_0x4de9f7['as'],'attributes':_0x4de9f7[_0x64dc('0x22')]};}):[]};}):[]};}):[]:[]})[_0x64dc('0x12')](function(_0x45986a){logger[_0x64dc('0x13')](_0x64dc('0x27'),_0x20e591);logger[_0x64dc('0x15')](_0x64dc('0x27'),_0x20e591,JSON[_0x64dc('0x16')](_0x45986a));_0x1be0fc(_0x45986a);})[_0x64dc('0x1c')](function(_0x314245){logger[_0x64dc('0x17')](_0x64dc('0x27'),_0x314245[_0x64dc('0x1a')],_0x20e591);_0x516101(_0x46ba4a[_0x64dc('0x17')](0x1f4,_0x314245[_0x64dc('0x1a')]));});});}; \ No newline at end of file +var _0xe95a=['message','info','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s'];(function(_0x18f329,_0x403cdf){var _0x3db824=function(_0x446153){while(--_0x446153){_0x18f329['push'](_0x18f329['shift']());}};_0x3db824(++_0x403cdf);}(_0xe95a,0x1d8));var _0xae95=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xe95a[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xae95('0x0'));var util=require(_0xae95('0x1'));var moment=require(_0xae95('0x2'));var BPromise=require(_0xae95('0x3'));var rs=require(_0xae95('0x4'));var fs=require('fs');var Redis=require(_0xae95('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xae95('0x6'));var logger=require('../../config/logger')(_0xae95('0x7'));var config=require(_0xae95('0x8'));var jayson=require(_0xae95('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xae95('0xa')],{'host':_0xae95('0xb'),'port':0x18eb});var socket=require(_0xae95('0xc'))(new Redis(config['redis']));require(_0xae95('0xd'))['register'](socket);function respondWithRpcPromise(_0x4db3d0,_0x509627,_0x3ef57a){return new BPromise(function(_0x3187c6,_0x3b6821){return client[_0xae95('0xe')](_0x4db3d0,_0x3ef57a)[_0xae95('0xf')](function(_0x56426f){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x509627,_0xae95('0x10'));logger[_0xae95('0x11')](_0xae95('0x12'),_0x509627,_0xae95('0x10'),JSON[_0xae95('0x13')](_0x56426f));if(_0x56426f[_0xae95('0x14')]){if(_0x56426f[_0xae95('0x14')]['code']===0x1f4){logger['error'](_0xae95('0x15'),_0x509627,_0x56426f[_0xae95('0x14')][_0xae95('0x16')]);return _0x3b6821(_0x56426f[_0xae95('0x14')][_0xae95('0x16')]);}logger[_0xae95('0x14')](_0xae95('0x15'),_0x509627,_0x56426f[_0xae95('0x14')][_0xae95('0x16')]);return _0x3187c6(_0x56426f[_0xae95('0x14')][_0xae95('0x16')]);}else{logger[_0xae95('0x17')](_0xae95('0x15'),_0x509627,_0xae95('0x10'));_0x3187c6(_0x56426f['result']['message']);}})['catch'](function(_0x4c63ae){logger[_0xae95('0x14')](_0xae95('0x15'),_0x509627,_0x4c63ae);_0x3b6821(_0x4c63ae);});});}exports[_0xae95('0x18')]=function(_0x1e930e){var _0x1115ee=this;return new Promise(function(_0x57cdfd,_0x4801a4){return db['WhatsappQueue'][_0xae95('0x19')]({'raw':_0x1e930e[_0xae95('0x1a')]?_0x1e930e[_0xae95('0x1a')][_0xae95('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e930e[_0xae95('0x1a')]?_0x1e930e[_0xae95('0x1a')][_0xae95('0x1c')]||null:null,'attributes':_0x1e930e[_0xae95('0x1a')]?_0x1e930e[_0xae95('0x1a')][_0xae95('0x1d')]||null:null,'limit':_0x1e930e['options']?_0x1e930e['options'][_0xae95('0x1e')]||null:null,'include':_0x1e930e[_0xae95('0x1a')]?_0x1e930e[_0xae95('0x1a')][_0xae95('0x1f')]?_['map'](_0x1e930e[_0xae95('0x1a')][_0xae95('0x1f')],function(_0x151e06){return{'model':db[_0x151e06[_0xae95('0x20')]],'as':_0x151e06['as'],'attributes':_0x151e06[_0xae95('0x1d')],'include':_0x151e06['include']?_[_0xae95('0x21')](_0x151e06[_0xae95('0x1f')],function(_0x4ec3b1){return{'model':db[_0x4ec3b1[_0xae95('0x20')]],'as':_0x4ec3b1['as'],'attributes':_0x4ec3b1[_0xae95('0x1d')],'include':_0x4ec3b1[_0xae95('0x1f')]?_[_0xae95('0x21')](_0x4ec3b1['include'],function(_0x809cb8){return{'model':db[_0x809cb8[_0xae95('0x20')]],'as':_0x809cb8['as'],'attributes':_0x809cb8['attributes']};}):[]};}):[]};}):[]:[]})[_0xae95('0xf')](function(_0xb4e6d2){logger[_0xae95('0x17')]('GetWhatsappQueue',_0x1e930e);logger[_0xae95('0x11')](_0xae95('0x18'),_0x1e930e,JSON['stringify'](_0xb4e6d2));_0x57cdfd(_0xb4e6d2);})[_0xae95('0x22')](function(_0x41f2da){logger[_0xae95('0x14')](_0xae95('0x18'),_0x41f2da['message'],_0x1e930e);_0x4801a4(_0x1115ee[_0xae95('0x14')](0x1f4,_0x41f2da[_0xae95('0x16')]));});});};exports[_0xae95('0x23')]=function(_0x23102f){var _0x17b68e=this;return new Promise(function(_0x3a48ad,_0x55a2d8){return db[_0xae95('0x24')][_0xae95('0x25')]({'raw':_0x23102f['options']?_0x23102f[_0xae95('0x1a')][_0xae95('0x1b')]===undefined?!![]:![]:!![],'where':_0x23102f['options']?_0x23102f[_0xae95('0x1a')]['where']||null:null,'attributes':_0x23102f['options']?_0x23102f[_0xae95('0x1a')]['attributes']||null:null,'include':_0x23102f[_0xae95('0x1a')]?_0x23102f[_0xae95('0x1a')]['include']?_[_0xae95('0x21')](_0x23102f[_0xae95('0x1a')][_0xae95('0x1f')],function(_0x4b8eec){return{'model':db[_0x4b8eec[_0xae95('0x20')]],'as':_0x4b8eec['as'],'attributes':_0x4b8eec[_0xae95('0x1d')],'include':_0x4b8eec[_0xae95('0x1f')]?_['map'](_0x4b8eec[_0xae95('0x1f')],function(_0x14ad6e){return{'model':db[_0x14ad6e['model']],'as':_0x14ad6e['as'],'attributes':_0x14ad6e['attributes'],'include':_0x14ad6e[_0xae95('0x1f')]?_[_0xae95('0x21')](_0x14ad6e[_0xae95('0x1f')],function(_0x5c08cb){return{'model':db[_0x5c08cb[_0xae95('0x20')]],'as':_0x5c08cb['as'],'attributes':_0x5c08cb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b484d){logger[_0xae95('0x17')]('ShowWhatsappQueue',_0x23102f);logger[_0xae95('0x11')](_0xae95('0x23'),_0x23102f,JSON[_0xae95('0x13')](_0x3b484d));_0x3a48ad(_0x3b484d);})[_0xae95('0x22')](function(_0xe814b2){logger[_0xae95('0x14')](_0xae95('0x23'),_0xe814b2['message'],_0x23102f);_0x55a2d8(_0x17b68e[_0xae95('0x14')](0x1f4,_0xe814b2[_0xae95('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 378bb3d..7350b64 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 _0x4091=['length','./whatsappQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x3ed6d7,_0x353def){var _0x13c622=function(_0xe7b875){while(--_0xe7b875){_0x3ed6d7['push'](_0x3ed6d7['shift']());}};_0x13c622(++_0x353def);}(_0x4091,0x1d1));var _0x1409=function(_0x510b72,_0x514bb0){_0x510b72=_0x510b72-0x0;var _0x362dbf=_0x4091[_0x510b72];return _0x362dbf;};'use strict';var WhatsappQueueEvents=require(_0x1409('0x0'));var events=[_0x1409('0x1'),_0x1409('0x2'),_0x1409('0x3')];function createListener(_0x3d4dc8,_0x793a54){return function(_0x179e76){_0x793a54[_0x1409('0x4')](_0x3d4dc8,_0x179e76);};}function removeListener(_0x2a3f45,_0x2fa256){return function(){WhatsappQueueEvents[_0x1409('0x5')](_0x2a3f45,_0x2fa256);};}exports[_0x1409('0x6')]=function(_0x5c5a86){for(var _0x22459f=0x0,_0x32afe2=events[_0x1409('0x7')];_0x22459f<_0x32afe2;_0x22459f++){var _0x51dfe8=events[_0x22459f];var _0x3d9b1e=createListener('whatsappQueue:'+_0x51dfe8,_0x5c5a86);WhatsappQueueEvents['on'](_0x51dfe8,_0x3d9b1e);}}; \ No newline at end of file +var _0x12d6=['update','emit','removeListener','register','length','whatsappQueue:','save','remove'];(function(_0x30d020,_0x3f2194){var _0x1fc136=function(_0xa7c321){while(--_0xa7c321){_0x30d020['push'](_0x30d020['shift']());}};_0x1fc136(++_0x3f2194);}(_0x12d6,0x1d6));var _0x612d=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0x12d6[_0x3c6dce];return _0x1450e9;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x612d('0x0'),_0x612d('0x1'),_0x612d('0x2')];function createListener(_0x5e72b4,_0x3cefa3){return function(_0x44a098){_0x3cefa3[_0x612d('0x3')](_0x5e72b4,_0x44a098);};}function removeListener(_0x9f9adb,_0x451b4f){return function(){WhatsappQueueEvents[_0x612d('0x4')](_0x9f9adb,_0x451b4f);};}exports[_0x612d('0x5')]=function(_0x4a58b0){for(var _0x426c57=0x0,_0x457577=events[_0x612d('0x6')];_0x426c57<_0x457577;_0x426c57++){var _0x2a3924=events[_0x426c57];var _0x66d94a=createListener(_0x612d('0x7')+_0x2a3924,_0x4a58b0);WhatsappQueueEvents['on'](_0x2a3924,_0x66d94a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 2753393..656bc34 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 _0xfd76=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','describe','/:id','show','isAuthenticated','put','update','delete','destroy','path','connect-timeout','express','Router'];(function(_0xd2d7f2,_0xfc9871){var _0x2d10fc=function(_0x37cd26){while(--_0x37cd26){_0xd2d7f2['push'](_0xd2d7f2['shift']());}};_0x2d10fc(++_0xfc9871);}(_0xfd76,0x11d));var _0x6fd7=function(_0x418f4f,_0x496861){_0x418f4f=_0x418f4f-0x0;var _0x22261e=_0xfd76[_0x418f4f];return _0x22261e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6fd7('0x0'));var timeout=require(_0x6fd7('0x1'));var express=require(_0x6fd7('0x2'));var router=express[_0x6fd7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6fd7('0x4'));var interaction=require(_0x6fd7('0x5'));var config=require(_0x6fd7('0x6'));var controller=require(_0x6fd7('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6fd7('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x6fd7('0x9')]);router[_0x6fd7('0x8')](_0x6fd7('0xa'),auth['isAuthenticated'](),controller[_0x6fd7('0xb')]);router['post']('/',auth[_0x6fd7('0xc')](),controller['create']);router[_0x6fd7('0xd')](_0x6fd7('0xa'),auth[_0x6fd7('0xc')](),controller[_0x6fd7('0xe')]);router[_0x6fd7('0xf')](_0x6fd7('0xa'),auth[_0x6fd7('0xc')](),controller[_0x6fd7('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4066=['get','index','/describe','isAuthenticated','describe','/:id','create','put','update','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2ddabf,_0x4265fe){var _0x2ab06d=function(_0x413458){while(--_0x413458){_0x2ddabf['push'](_0x2ddabf['shift']());}};_0x2ab06d(++_0x4265fe);}(_0x4066,0x1b3));var _0x6406=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4066[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x6406('0x0'));var util=require('util');var path=require(_0x6406('0x1'));var timeout=require('connect-timeout');var express=require(_0x6406('0x2'));var router=express[_0x6406('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6406('0x4'));var interaction=require(_0x6406('0x5'));var config=require(_0x6406('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0x6406('0x7')]('/',auth['isAuthenticated'](),controller[_0x6406('0x8')]);router[_0x6406('0x7')](_0x6406('0x9'),auth[_0x6406('0xa')](),controller[_0x6406('0xb')]);router[_0x6406('0x7')](_0x6406('0xc'),auth[_0x6406('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6406('0xd')]);router[_0x6406('0xe')](_0x6406('0xc'),auth[_0x6406('0xa')](),controller[_0x6406('0xf')]);router['delete']('/:id',auth[_0x6406('0xa')](),controller['destroy']);module[_0x6406('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index a28647b..42841a1 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(_0x356971,_0x11c80e){var _0x3ae4cc=function(_0x307bf8){while(--_0x307bf8){_0x356971['push'](_0x356971['shift']());}};_0x3ae4cc(++_0x11c80e);}(_0x7a54,0x106));var _0x47a5=function(_0x4077de,_0x1cd85c){_0x4077de=_0x4077de-0x0;var _0x1f1087=_0x7a54[_0x4077de];return _0x1f1087;};'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(_0x1aacf6,_0x4da429){var _0xce43cc=function(_0x4d1797){while(--_0x4d1797){_0x1aacf6['push'](_0x1aacf6['shift']());}};_0xce43cc(++_0x4da429);}(_0x7a54,0x106));var _0x47a5=function(_0x9ee3f,_0x1adc9d){_0x9ee3f=_0x9ee3f-0x0;var _0x3b8d45=_0x7a54[_0x9ee3f];return _0x3b8d45;};'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 abe6100..cd7b9ac 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 _0x96cc=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','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','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2919bc,_0x256334){var _0x1a4743=function(_0x47c44e){while(--_0x47c44e){_0x2919bc['push'](_0x2919bc['shift']());}};_0x1a4743(++_0x256334);}(_0x96cc,0x16c));var _0xc96c=function(_0x5ba513,_0x459c3b){_0x5ba513=_0x5ba513-0x0;var _0x1132a0=_0x96cc[_0x5ba513];return _0x1132a0;};'use strict';var emlformat=require(_0xc96c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc96c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc96c('0x2'));var moment=require(_0xc96c('0x3'));var BPromise=require(_0xc96c('0x4'));var Mustache=require(_0xc96c('0x5'));var util=require(_0xc96c('0x6'));var path=require(_0xc96c('0x7'));var sox=require(_0xc96c('0x8'));var csv=require(_0xc96c('0x9'));var ejs=require(_0xc96c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc96c('0xb'));var squel=require(_0xc96c('0xc'));var crypto=require(_0xc96c('0xd'));var jsforce=require(_0xc96c('0xe'));var deskjs=require(_0xc96c('0xf'));var toCsv=require(_0xc96c('0x9'));var querystring=require(_0xc96c('0x10'));var Papa=require('papaparse');var Redis=require(_0xc96c('0x11'));var authService=require(_0xc96c('0x12'));var qs=require(_0xc96c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc96c('0x14'));var logger=require('../../config/logger')(_0xc96c('0x15'));var utils=require('../../config/utils');var config=require(_0xc96c('0x16'));var licenseUtil=require(_0xc96c('0x17'));var db=require(_0xc96c('0x18'))['db'];function respondWithStatusCode(_0x246a95,_0x5f27f3){_0x5f27f3=_0x5f27f3||0xcc;return function(_0x3fe3d5){if(_0x3fe3d5){return _0x246a95[_0xc96c('0x19')](_0x5f27f3);}return _0x246a95[_0xc96c('0x1a')](_0x5f27f3)[_0xc96c('0x1b')]();};}function respondWithResult(_0x48de8d,_0x35da94){_0x35da94=_0x35da94||0xc8;return function(_0xbed0c9){if(_0xbed0c9){return _0x48de8d[_0xc96c('0x1a')](_0x35da94)[_0xc96c('0x1c')](_0xbed0c9);}};}function respondWithFilteredResult(_0x377dbc,_0x46455a){return function(_0x1765d9){if(_0x1765d9){var _0x23e357=typeof _0x46455a[_0xc96c('0x1d')]===_0xc96c('0x1e')&&typeof _0x46455a[_0xc96c('0x1f')]==='undefined';var _0x509376=_0x1765d9[_0xc96c('0x20')];var _0x99c402=_0x23e357?0x0:_0x46455a[_0xc96c('0x1d')];var _0x2ae19a=_0x23e357?_0x1765d9['count']:_0x46455a[_0xc96c('0x1d')]+_0x46455a[_0xc96c('0x1f')];var _0x2a361c;if(_0x2ae19a>=_0x509376){_0x2ae19a=_0x509376;_0x2a361c=0xc8;}else{_0x2a361c=0xce;}_0x377dbc[_0xc96c('0x1a')](_0x2a361c);return _0x377dbc[_0xc96c('0x21')](_0xc96c('0x22'),_0x99c402+'-'+_0x2ae19a+'/'+_0x509376)[_0xc96c('0x1c')](_0x1765d9);}return null;};}function patchUpdates(_0x41daba){return function(_0x28d762){try{jsonpatch[_0xc96c('0x23')](_0x28d762,_0x41daba,!![]);}catch(_0x2bb397){return BPromise[_0xc96c('0x24')](_0x2bb397);}return _0x28d762[_0xc96c('0x25')]();};}function saveUpdates(_0x45edee,_0x325c54){return function(_0x3b5c6c){if(_0x3b5c6c){return _0x3b5c6c[_0xc96c('0x26')](_0x45edee)['then'](function(_0xd63951){return _0xd63951;});}return null;};}function removeEntity(_0x4be783,_0x4456bf){return function(_0x10ae21){if(_0x10ae21){return _0x10ae21[_0xc96c('0x27')]()[_0xc96c('0x28')](function(){_0x4be783[_0xc96c('0x1a')](0xcc)[_0xc96c('0x1b')]();});}};}function handleEntityNotFound(_0x1a77df,_0x14f171){return function(_0x50fc07){if(!_0x50fc07){_0x1a77df[_0xc96c('0x19')](0x194);}return _0x50fc07;};}function handleError(_0x117f17,_0x3f87cc){_0x3f87cc=_0x3f87cc||0x1f4;return function(_0x294fee){logger['error'](_0x294fee['stack']);if(_0x294fee[_0xc96c('0x29')]){delete _0x294fee[_0xc96c('0x29')];}_0x117f17[_0xc96c('0x1a')](_0x3f87cc)[_0xc96c('0x2a')](_0x294fee);};}exports[_0xc96c('0x2b')]=function(_0x5e1727,_0x427cb2){var _0x1c911b={},_0xa0efbc={},_0x27925f={'count':0x0,'rows':[]};var _0x325cda=_[_0xc96c('0x2c')](db[_0xc96c('0x2d')][_0xc96c('0x2e')],function(_0x556108){return{'name':_0x556108[_0xc96c('0x2f')],'type':_0x556108['type'][_0xc96c('0x30')]};});_0xa0efbc[_0xc96c('0x31')]=_[_0xc96c('0x2c')](_0x325cda,'name');_0xa0efbc[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x5e1727[_0xc96c('0x32')]);_0xa0efbc[_0xc96c('0x34')]=_['intersection'](_0xa0efbc['model'],_0xa0efbc[_0xc96c('0x32')]);_0x1c911b[_0xc96c('0x35')]=_[_0xc96c('0x36')](_0xa0efbc['model'],qs[_0xc96c('0x37')](_0x5e1727[_0xc96c('0x32')][_0xc96c('0x37')]));_0x1c911b[_0xc96c('0x35')]=_0x1c911b['attributes'][_0xc96c('0x38')]?_0x1c911b[_0xc96c('0x35')]:_0xa0efbc['model'];if(!_0x5e1727[_0xc96c('0x32')][_0xc96c('0x39')](_0xc96c('0x3a'))){_0x1c911b[_0xc96c('0x1f')]=qs[_0xc96c('0x1f')](_0x5e1727[_0xc96c('0x32')]['limit']);_0x1c911b[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x5e1727[_0xc96c('0x32')][_0xc96c('0x1d')]);}_0x1c911b[_0xc96c('0x3b')]=qs[_0xc96c('0x3c')](_0x5e1727['query']['sort']);_0x1c911b[_0xc96c('0x3d')]=qs[_0xc96c('0x34')](_['pick'](_0x5e1727['query'],_0xa0efbc[_0xc96c('0x34')]),_0x325cda);if(_0x5e1727[_0xc96c('0x32')][_0xc96c('0x3e')]){_0x1c911b[_0xc96c('0x3d')]=_[_0xc96c('0x3f')](_0x1c911b[_0xc96c('0x3d')],{'$or':_[_0xc96c('0x2c')](_0x325cda,function(_0x257750){if(_0x257750[_0xc96c('0x40')]!==_0xc96c('0x41')){var _0x1b68e6={};_0x1b68e6[_0x257750['name']]={'$like':'%'+_0x5e1727[_0xc96c('0x32')][_0xc96c('0x3e')]+'%'};return _0x1b68e6;}})});}_0x1c911b=_[_0xc96c('0x3f')]({},_0x1c911b,_0x5e1727[_0xc96c('0x42')]);var _0x4eb180={'where':_0x1c911b[_0xc96c('0x3d')]};return db[_0xc96c('0x2d')][_0xc96c('0x20')](_0x4eb180)['then'](function(_0x510252){_0x27925f[_0xc96c('0x20')]=_0x510252;if(_0x5e1727[_0xc96c('0x32')][_0xc96c('0x43')]){_0x1c911b['include']=[{'all':!![]}];}return db[_0xc96c('0x2d')][_0xc96c('0x44')](_0x1c911b);})[_0xc96c('0x28')](function(_0x2a8ea7){_0x27925f[_0xc96c('0x45')]=_0x2a8ea7;return _0x27925f;})[_0xc96c('0x28')](respondWithFilteredResult(_0x427cb2,_0x1c911b))[_0xc96c('0x46')](handleError(_0x427cb2,null));};exports[_0xc96c('0x47')]=function(_0x25df41,_0x4d5a1b){var _0x4c3088={'raw':!![],'where':{'id':_0x25df41[_0xc96c('0x48')]['id']}},_0x30b3ac={};_0x30b3ac[_0xc96c('0x31')]=_[_0xc96c('0x33')](db['WhatsappQueueReport']['rawAttributes']);_0x30b3ac[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x25df41[_0xc96c('0x32')]);_0x30b3ac[_0xc96c('0x34')]=_[_0xc96c('0x36')](_0x30b3ac[_0xc96c('0x31')],_0x30b3ac[_0xc96c('0x32')]);_0x4c3088['attributes']=_[_0xc96c('0x36')](_0x30b3ac[_0xc96c('0x31')],qs[_0xc96c('0x37')](_0x25df41[_0xc96c('0x32')]['fields']));_0x4c3088['attributes']=_0x4c3088[_0xc96c('0x35')][_0xc96c('0x38')]?_0x4c3088[_0xc96c('0x35')]:_0x30b3ac[_0xc96c('0x31')];if(_0x25df41[_0xc96c('0x32')][_0xc96c('0x43')]){_0x4c3088[_0xc96c('0x49')]=[{'all':!![]}];}_0x4c3088=_[_0xc96c('0x3f')]({},_0x4c3088,_0x25df41[_0xc96c('0x42')]);return db[_0xc96c('0x2d')][_0xc96c('0x4a')](_0x4c3088)[_0xc96c('0x28')](handleEntityNotFound(_0x4d5a1b,null))[_0xc96c('0x28')](respondWithResult(_0x4d5a1b,null))['catch'](handleError(_0x4d5a1b,null));};exports[_0xc96c('0x4b')]=function(_0x2e5045,_0x307d58){return db[_0xc96c('0x2d')]['create'](_0x2e5045[_0xc96c('0x4c')],{})['then'](respondWithResult(_0x307d58,0xc9))[_0xc96c('0x46')](handleError(_0x307d58,null));};exports[_0xc96c('0x26')]=function(_0x565812,_0x2581ae){if(_0x565812[_0xc96c('0x4c')]['id']){delete _0x565812[_0xc96c('0x4c')]['id'];}return db[_0xc96c('0x2d')][_0xc96c('0x4a')]({'where':{'id':_0x565812[_0xc96c('0x48')]['id']}})['then'](handleEntityNotFound(_0x2581ae,null))['then'](saveUpdates(_0x565812['body'],null))[_0xc96c('0x28')](respondWithResult(_0x2581ae,null))['catch'](handleError(_0x2581ae,null));};exports[_0xc96c('0x27')]=function(_0x22b2e3,_0x65a0a7){return db[_0xc96c('0x2d')][_0xc96c('0x4a')]({'where':{'id':_0x22b2e3[_0xc96c('0x48')]['id']}})[_0xc96c('0x28')](handleEntityNotFound(_0x65a0a7,null))[_0xc96c('0x28')](removeEntity(_0x65a0a7,null))[_0xc96c('0x46')](handleError(_0x65a0a7,null));};exports[_0xc96c('0x4d')]=function(_0x573177,_0x3adefb){return db[_0xc96c('0x2d')][_0xc96c('0x4d')]()[_0xc96c('0x28')](respondWithResult(_0x3adefb,null))[_0xc96c('0x46')](handleError(_0x3adefb,null));}; \ No newline at end of file +var _0xda3f=['fields','nolimit','sort','filter','where','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','describe','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','map','key','model','query','keys','filters','intersection','attributes'];(function(_0x248c5b,_0x9e18d1){var _0xd464cc=function(_0xcf6e68){while(--_0xcf6e68){_0x248c5b['push'](_0x248c5b['shift']());}};_0xd464cc(++_0x9e18d1);}(_0xda3f,0xec));var _0xfda3=function(_0x29fe71,_0x17f5d4){_0x29fe71=_0x29fe71-0x0;var _0x50e456=_0xda3f[_0x29fe71];return _0x50e456;};'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['index']=function(_0x3c1549,_0x4101b1){var _0x301509={},_0x474992={},_0xe21ec6={'count':0x0,'rows':[]};var _0x3cfeb2=_[_0xfda3('0x28')](db['WhatsappQueueReport']['rawAttributes'],function(_0x3aef3c){return{'name':_0x3aef3c['fieldName'],'type':_0x3aef3c['type'][_0xfda3('0x29')]};});_0x474992[_0xfda3('0x2a')]=_[_0xfda3('0x28')](_0x3cfeb2,_0xfda3('0x26'));_0x474992[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x3c1549[_0xfda3('0x2b')]);_0x474992[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x474992['model'],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2f')]=_[_0xfda3('0x2e')](_0x474992[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x301509[_0xfda3('0x2f')]=_0x301509[_0xfda3('0x2f')]['length']?_0x301509['attributes']:_0x474992[_0xfda3('0x2a')];if(!_0x3c1549[_0xfda3('0x2b')]['hasOwnProperty'](_0xfda3('0x31'))){_0x301509[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x3c1549['query'][_0xfda3('0x1b')]);_0x301509[_0xfda3('0x19')]=qs[_0xfda3('0x19')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x19')]);}_0x301509['order']=qs[_0xfda3('0x32')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x32')]);_0x301509['where']=qs[_0xfda3('0x2d')](_['pick'](_0x3c1549[_0xfda3('0x2b')],_0x474992[_0xfda3('0x2d')]),_0x3cfeb2);if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x33')]){_0x301509[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x301509[_0xfda3('0x34')],{'$or':_[_0xfda3('0x28')](_0x3cfeb2,function(_0x577be8){if(_0x577be8[_0xfda3('0x36')]!==_0xfda3('0x37')){var _0xd2dde0={};_0xd2dde0[_0x577be8[_0xfda3('0x26')]]={'$like':'%'+_0x3c1549['query'][_0xfda3('0x33')]+'%'};return _0xd2dde0;}})});}_0x301509=_[_0xfda3('0x35')]({},_0x301509,_0x3c1549[_0xfda3('0x38')]);var _0x5bad90={'where':_0x301509['where']};return db[_0xfda3('0x39')][_0xfda3('0x1c')](_0x5bad90)[_0xfda3('0x23')](function(_0x1aaa6c){_0xe21ec6[_0xfda3('0x1c')]=_0x1aaa6c;if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x301509[_0xfda3('0x3b')]=[{'all':!![]}];}return db[_0xfda3('0x39')][_0xfda3('0x3c')](_0x301509);})['then'](function(_0x27200f){_0xe21ec6[_0xfda3('0x3d')]=_0x27200f;return _0xe21ec6;})['then'](respondWithFilteredResult(_0x4101b1,_0x301509))[_0xfda3('0x3e')](handleError(_0x4101b1,null));};exports['show']=function(_0x51a314,_0x4e6886){var _0x2208bc={'raw':!![],'where':{'id':_0x51a314[_0xfda3('0x3f')]['id']}},_0x107fb1={};_0x107fb1[_0xfda3('0x2a')]=_['keys'](db[_0xfda3('0x39')][_0xfda3('0x40')]);_0x107fb1[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x51a314['query']);_0x107fb1[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],_0x107fb1['query']);_0x2208bc['attributes']=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x51a314[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x2208bc[_0xfda3('0x2f')]=_0x2208bc[_0xfda3('0x2f')][_0xfda3('0x41')]?_0x2208bc[_0xfda3('0x2f')]:_0x107fb1[_0xfda3('0x2a')];if(_0x51a314[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x2208bc[_0xfda3('0x3b')]=[{'all':!![]}];}_0x2208bc=_[_0xfda3('0x35')]({},_0x2208bc,_0x51a314['options']);return db['WhatsappQueueReport'][_0xfda3('0x42')](_0x2208bc)[_0xfda3('0x23')](handleEntityNotFound(_0x4e6886,null))[_0xfda3('0x23')](respondWithResult(_0x4e6886,null))[_0xfda3('0x3e')](handleError(_0x4e6886,null));};exports[_0xfda3('0x43')]=function(_0x60a89d,_0x192133){return db[_0xfda3('0x39')][_0xfda3('0x43')](_0x60a89d[_0xfda3('0x44')],{})['then'](respondWithResult(_0x192133,0xc9))[_0xfda3('0x3e')](handleError(_0x192133,null));};exports[_0xfda3('0x22')]=function(_0x481356,_0x36aa3a){if(_0x481356[_0xfda3('0x44')]['id']){delete _0x481356['body']['id'];}return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x481356[_0xfda3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x36aa3a,null))[_0xfda3('0x23')](saveUpdates(_0x481356[_0xfda3('0x44')],null))[_0xfda3('0x23')](respondWithResult(_0x36aa3a,null))['catch'](handleError(_0x36aa3a,null));};exports[_0xfda3('0x45')]=function(_0x33565d,_0x2f54eb){return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x33565d['params']['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2f54eb,null))['then'](removeEntity(_0x2f54eb,null))[_0xfda3('0x3e')](handleError(_0x2f54eb,null));};exports['describe']=function(_0x1b5e89,_0x6447){return db[_0xfda3('0x39')][_0xfda3('0x46')]()['then'](respondWithResult(_0x6447,null))[_0xfda3('0x3e')](handleError(_0x6447,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c653390..beb9e74 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 _0x1da7=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5232bb,_0x4fcb6c){var _0x2ba6d1=function(_0x508383){while(--_0x508383){_0x5232bb['push'](_0x5232bb['shift']());}};_0x2ba6d1(++_0x4fcb6c);}(_0x1da7,0x1bb));var _0x71da=function(_0x3f2246,_0x5e37b4){_0x3f2246=_0x3f2246-0x0;var _0x2d7c8b=_0x1da7[_0x3f2246];return _0x2d7c8b;};'use strict';var _=require(_0x71da('0x0'));var util=require('util');var logger=require(_0x71da('0x1'))(_0x71da('0x2'));var moment=require(_0x71da('0x3'));var BPromise=require(_0x71da('0x4'));var rp=require(_0x71da('0x5'));var fs=require('fs');var path=require(_0x71da('0x6'));var rimraf=require(_0x71da('0x7'));var config=require(_0x71da('0x8'));var attributes=require(_0x71da('0x9'));module['exports']=function(_0x184dac,_0x137d29){return _0x184dac[_0x71da('0xa')](_0x71da('0xb'),attributes,{'tableName':_0x71da('0xc'),'paranoid':![],'indexes':[{'name':_0x71da('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8374=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x40a77f,_0x1d5f8d){var _0x415aa1=function(_0x1e45bc){while(--_0x1e45bc){_0x40a77f['push'](_0x40a77f['shift']());}};_0x415aa1(++_0x1d5f8d);}(_0x8374,0x1b0));var _0x4837=function(_0x1e031f,_0x126203){_0x1e031f=_0x1e031f-0x0;var _0x23642b=_0x8374[_0x1e031f];return _0x23642b;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var logger=require(_0x4837('0x2'))(_0x4837('0x3'));var moment=require('moment');var BPromise=require(_0x4837('0x4'));var rp=require(_0x4837('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4837('0x6'));var config=require(_0x4837('0x7'));var attributes=require(_0x4837('0x8'));module['exports']=function(_0x1aabd6,_0x56d2f2){return _0x1aabd6['define'](_0x4837('0x9'),attributes,{'tableName':_0x4837('0xa'),'paranoid':![],'indexes':[{'name':_0x4837('0xb'),'fields':[_0x4837('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 7a00e5f..38651c1 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 _0xca1d=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird'];(function(_0x42b251,_0x1bfdf2){var _0x30cf5d=function(_0x45998e){while(--_0x45998e){_0x42b251['push'](_0x42b251['shift']());}};_0x30cf5d(++_0x1bfdf2);}(_0xca1d,0x1e6));var _0xdca1=function(_0xee50a9,_0x5921af){_0xee50a9=_0xee50a9-0x0;var _0x537d05=_0xca1d[_0xee50a9];return _0x537d05;};'use strict';var _=require(_0xdca1('0x0'));var util=require(_0xdca1('0x1'));var moment=require(_0xdca1('0x2'));var BPromise=require(_0xdca1('0x3'));var rs=require(_0xdca1('0x4'));var fs=require('fs');var Redis=require(_0xdca1('0x5'));var db=require(_0xdca1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdca1('0x7'))(_0xdca1('0x8'));var config=require('../../config/environment');var jayson=require(_0xdca1('0x9'));var client=jayson[_0xdca1('0xa')][_0xdca1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4de495,_0x290b14,_0x124ced){return new BPromise(function(_0x43f029,_0x1837b1){return client[_0xdca1('0xc')](_0x4de495,_0x124ced)['then'](function(_0x319e07){logger[_0xdca1('0xd')](_0xdca1('0xe'),_0x290b14,_0xdca1('0xf'));logger[_0xdca1('0x10')](_0xdca1('0x11'),_0x290b14,'request\x20sent',JSON[_0xdca1('0x12')](_0x319e07));if(_0x319e07[_0xdca1('0x13')]){if(_0x319e07['error'][_0xdca1('0x14')]===0x1f4){logger[_0xdca1('0x13')](_0xdca1('0xe'),_0x290b14,_0x319e07[_0xdca1('0x13')][_0xdca1('0x15')]);return _0x1837b1(_0x319e07[_0xdca1('0x13')]['message']);}logger[_0xdca1('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x290b14,_0x319e07[_0xdca1('0x13')][_0xdca1('0x15')]);return _0x43f029(_0x319e07[_0xdca1('0x13')][_0xdca1('0x15')]);}else{logger[_0xdca1('0xd')](_0xdca1('0xe'),_0x290b14,_0xdca1('0xf'));_0x43f029(_0x319e07['result']['message']);}})[_0xdca1('0x16')](function(_0x2f1a03){logger[_0xdca1('0x13')](_0xdca1('0xe'),_0x290b14,_0x2f1a03);_0x1837b1(_0x2f1a03);});});}exports[_0xdca1('0x17')]=function(_0x1fad53){var _0x29bcfe=this;return new Promise(function(_0x39aded,_0x3baf6a){return db[_0xdca1('0x18')][_0xdca1('0x19')](_0x1fad53[_0xdca1('0x1a')],{'raw':_0x1fad53[_0xdca1('0x1b')]?_0x1fad53[_0xdca1('0x1b')][_0xdca1('0x1c')]===undefined?!![]:![]:!![]})[_0xdca1('0x1d')](function(_0xe84014){logger['info'](_0xdca1('0x17'),_0x1fad53);logger[_0xdca1('0x10')](_0xdca1('0x17'),_0x1fad53,JSON[_0xdca1('0x12')](_0xe84014));_0x39aded(_0xe84014);})[_0xdca1('0x16')](function(_0x2f1d49){logger[_0xdca1('0x13')](_0xdca1('0x17'),_0x2f1d49['message'],_0x1fad53);_0x3baf6a(_0x29bcfe[_0xdca1('0x13')](0x1f4,_0x2f1d49[_0xdca1('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0xd34c45){var _0x348d72=this;return new Promise(function(_0x186c71,_0x89cba8){return db[_0xdca1('0x18')][_0xdca1('0x1e')](_0xd34c45[_0xdca1('0x1a')],{'raw':_0xd34c45[_0xdca1('0x1b')]?_0xd34c45[_0xdca1('0x1b')][_0xdca1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd34c45['options']?_0xd34c45[_0xdca1('0x1b')][_0xdca1('0x1f')]||null:null,'attributes':_0xd34c45[_0xdca1('0x1b')]?_0xd34c45['options'][_0xdca1('0x20')]||null:null,'limit':_0xd34c45[_0xdca1('0x1b')]?_0xd34c45[_0xdca1('0x1b')][_0xdca1('0x21')]||null:null})['then'](function(_0x2269f5){logger[_0xdca1('0xd')](_0xdca1('0x22'),_0xd34c45);logger[_0xdca1('0x10')](_0xdca1('0x22'),_0xd34c45,JSON['stringify'](_0x2269f5));_0x186c71(_0x2269f5);})[_0xdca1('0x16')](function(_0x25bb64){logger[_0xdca1('0x13')](_0xdca1('0x22'),_0x25bb64[_0xdca1('0x15')],_0xd34c45);_0x89cba8(_0x348d72[_0xdca1('0x13')](0x1f4,_0x25bb64[_0xdca1('0x15')]));});});}; \ No newline at end of file +var _0xc08c=['options','raw','update','where','attributes','limit','UpdateWhatsappQueueReport','debug','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','body'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xc08c,0xda));var _0xcc08=function(_0x78a804,_0x3fb22d){_0x78a804=_0x78a804-0x0;var _0x390b13=_0xc08c[_0x78a804];return _0x390b13;};'use strict';var _=require('lodash');var util=require(_0xcc08('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc08('0x1'));var fs=require('fs');var Redis=require(_0xcc08('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc08('0x3'));var logger=require('../../config/logger')(_0xcc08('0x4'));var config=require(_0xcc08('0x5'));var jayson=require(_0xcc08('0x6'));var client=jayson[_0xcc08('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f5197,_0x11b6de,_0x3f8812){return new BPromise(function(_0x34cb6a,_0x2940b6){return client[_0xcc08('0x8')](_0x4f5197,_0x3f8812)[_0xcc08('0x9')](function(_0x57efd6){logger[_0xcc08('0xa')](_0xcc08('0xb'),_0x11b6de,_0xcc08('0xc'));logger['debug'](_0xcc08('0xd'),_0x11b6de,_0xcc08('0xc'),JSON[_0xcc08('0xe')](_0x57efd6));if(_0x57efd6['error']){if(_0x57efd6[_0xcc08('0xf')][_0xcc08('0x10')]===0x1f4){logger[_0xcc08('0xf')](_0xcc08('0xb'),_0x11b6de,_0x57efd6[_0xcc08('0xf')][_0xcc08('0x11')]);return _0x2940b6(_0x57efd6['error'][_0xcc08('0x11')]);}logger[_0xcc08('0xf')](_0xcc08('0xb'),_0x11b6de,_0x57efd6[_0xcc08('0xf')]['message']);return _0x34cb6a(_0x57efd6[_0xcc08('0xf')][_0xcc08('0x11')]);}else{logger[_0xcc08('0xa')](_0xcc08('0xb'),_0x11b6de,_0xcc08('0xc'));_0x34cb6a(_0x57efd6[_0xcc08('0x12')][_0xcc08('0x11')]);}})[_0xcc08('0x13')](function(_0x33b919){logger[_0xcc08('0xf')](_0xcc08('0xb'),_0x11b6de,_0x33b919);_0x2940b6(_0x33b919);});});}exports[_0xcc08('0x14')]=function(_0x42700f){var _0x3d9434=this;return new Promise(function(_0xafabd5,_0x5a9eb5){return db['WhatsappQueueReport']['create'](_0x42700f[_0xcc08('0x15')],{'raw':_0x42700f[_0xcc08('0x16')]?_0x42700f[_0xcc08('0x16')][_0xcc08('0x17')]===undefined?!![]:![]:!![]})[_0xcc08('0x9')](function(_0x54d4fd){logger[_0xcc08('0xa')](_0xcc08('0x14'),_0x42700f);logger['debug'](_0xcc08('0x14'),_0x42700f,JSON[_0xcc08('0xe')](_0x54d4fd));_0xafabd5(_0x54d4fd);})[_0xcc08('0x13')](function(_0x54d263){logger[_0xcc08('0xf')]('CreateWhatsappQueueReport',_0x54d263[_0xcc08('0x11')],_0x42700f);_0x5a9eb5(_0x3d9434['error'](0x1f4,_0x54d263[_0xcc08('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x4d9ee4){var _0x190ec7=this;return new Promise(function(_0x31322f,_0x2f616a){return db['WhatsappQueueReport'][_0xcc08('0x18')](_0x4d9ee4[_0xcc08('0x15')],{'raw':_0x4d9ee4[_0xcc08('0x16')]?_0x4d9ee4[_0xcc08('0x16')][_0xcc08('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d9ee4[_0xcc08('0x16')]?_0x4d9ee4[_0xcc08('0x16')][_0xcc08('0x19')]||null:null,'attributes':_0x4d9ee4[_0xcc08('0x16')]?_0x4d9ee4['options'][_0xcc08('0x1a')]||null:null,'limit':_0x4d9ee4[_0xcc08('0x16')]?_0x4d9ee4[_0xcc08('0x16')][_0xcc08('0x1b')]||null:null})[_0xcc08('0x9')](function(_0x22fdf5){logger[_0xcc08('0xa')](_0xcc08('0x1c'),_0x4d9ee4);logger[_0xcc08('0x1d')](_0xcc08('0x1c'),_0x4d9ee4,JSON[_0xcc08('0xe')](_0x22fdf5));_0x31322f(_0x22fdf5);})[_0xcc08('0x13')](function(_0x3acca2){logger[_0xcc08('0xf')]('UpdateWhatsappQueueReport',_0x3acca2[_0xcc08('0x11')],_0x4d9ee4);_0x2f616a(_0x190ec7[_0xcc08('0xf')](0x1f4,_0x3acca2[_0xcc08('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index fcad78b..6e24489 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 _0x2990=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update'];(function(_0x382282,_0x12308e){var _0x3106d4=function(_0x1a9743){while(--_0x1a9743){_0x382282['push'](_0x382282['shift']());}};_0x3106d4(++_0x12308e);}(_0x2990,0x1bb));var _0x0299=function(_0x4a752b,_0x1a8b9a){_0x4a752b=_0x4a752b-0x0;var _0x4696a4=_0x2990[_0x4a752b];return _0x4696a4;};'use strict';var multer=require(_0x0299('0x0'));var util=require('util');var path=require(_0x0299('0x1'));var timeout=require(_0x0299('0x2'));var express=require(_0x0299('0x3'));var router=express[_0x0299('0x4')]();var fs_extra=require(_0x0299('0x5'));var auth=require(_0x0299('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0299('0x7'));var controller=require(_0x0299('0x8'));router[_0x0299('0x9')]('/',auth['isAuthenticated'](),controller[_0x0299('0xa')]);router[_0x0299('0x9')](_0x0299('0xb'),auth[_0x0299('0xc')](),controller[_0x0299('0xd')]);router[_0x0299('0x9')](_0x0299('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x0299('0xf')]('/',auth['isAuthenticated'](),controller[_0x0299('0x10')]);router[_0x0299('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0299('0x12')]);router[_0x0299('0x13')](_0x0299('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x0299('0x14')]=router; \ No newline at end of file +var _0x193c=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x4498c9,_0xdf55b2){var _0x3dcca2=function(_0x3d22a5){while(--_0x3d22a5){_0x4498c9['push'](_0x4498c9['shift']());}};_0x3dcca2(++_0xdf55b2);}(_0x193c,0xfb));var _0xc193=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x193c[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xc193('0x0'));var util=require('util');var path=require(_0xc193('0x1'));var timeout=require(_0xc193('0x2'));var express=require(_0xc193('0x3'));var router=express[_0xc193('0x4')]();var fs_extra=require(_0xc193('0x5'));var auth=require(_0xc193('0x6'));var interaction=require(_0xc193('0x7'));var config=require(_0xc193('0x8'));var controller=require(_0xc193('0x9'));router[_0xc193('0xa')]('/',auth[_0xc193('0xb')](),controller['index']);router[_0xc193('0xa')](_0xc193('0xc'),auth[_0xc193('0xb')](),controller[_0xc193('0xd')]);router[_0xc193('0xa')](_0xc193('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc193('0xf')]('/',auth['isAuthenticated'](),controller[_0xc193('0x10')]);router[_0xc193('0x11')]('/:id',auth[_0xc193('0xb')](),controller[_0xc193('0x12')]);router[_0xc193('0x13')](_0xc193('0xe'),auth[_0xc193('0xb')](),controller[_0xc193('0x14')]);module[_0xc193('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index ea54475..2f4e91d 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 _0x98b7=['STRING','ENUM','DATE','sequelize','exports'];(function(_0x2942c2,_0x205327){var _0x1844a2=function(_0xe8143a){while(--_0xe8143a){_0x2942c2['push'](_0x2942c2['shift']());}};_0x1844a2(++_0x205327);}(_0x98b7,0xc1));var _0x798b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x98b7[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x798b('0x0'));module[_0x798b('0x1')]={'uniqueid':{'type':Sequelize[_0x798b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x798b('0x3')]('account','agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x798b('0x4')]}}; \ No newline at end of file +var _0xde6f=['queue','DATE','STRING','ENUM','account'];(function(_0x228b0c,_0x78dbd9){var _0xcbfd2f=function(_0x45822b){while(--_0x45822b){_0x228b0c['push'](_0x228b0c['shift']());}};_0xcbfd2f(++_0x78dbd9);}(_0xde6f,0x84));var _0xfde6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde6f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xfde6('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x2'),'agent',_0xfde6('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xfde6('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 6502222..5259a14 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 _0xf74e=['order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','WhatsappTransferReport','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x473fca,_0x550413){var _0x330758=function(_0x554b88){while(--_0x554b88){_0x473fca['push'](_0x473fca['shift']());}};_0x330758(++_0x550413);}(_0xf74e,0x19e));var _0xef74=function(_0x2f3783,_0x14e8e1){_0x2f3783=_0x2f3783-0x0;var _0x5857c4=_0xf74e[_0x2f3783];return _0x5857c4;};'use strict';var emlformat=require(_0xef74('0x0'));var rimraf=require(_0xef74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xef74('0x2'));var moment=require(_0xef74('0x3'));var BPromise=require(_0xef74('0x4'));var Mustache=require(_0xef74('0x5'));var util=require(_0xef74('0x6'));var path=require(_0xef74('0x7'));var sox=require(_0xef74('0x8'));var csv=require('to-csv');var ejs=require(_0xef74('0x9'));var fs=require('fs');var fs_extra=require(_0xef74('0xa'));var _=require(_0xef74('0xb'));var squel=require(_0xef74('0xc'));var crypto=require('crypto');var jsforce=require(_0xef74('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xef74('0xe'));var querystring=require(_0xef74('0xf'));var Papa=require(_0xef74('0x10'));var Redis=require(_0xef74('0x11'));var authService=require(_0xef74('0x12'));var qs=require(_0xef74('0x13'));var as=require(_0xef74('0x14'));var hardwareService=require(_0xef74('0x15'));var logger=require('../../config/logger')(_0xef74('0x16'));var utils=require(_0xef74('0x17'));var config=require(_0xef74('0x18'));var licenseUtil=require(_0xef74('0x19'));var db=require(_0xef74('0x1a'))['db'];function respondWithStatusCode(_0x681c22,_0x423c16){_0x423c16=_0x423c16||0xcc;return function(_0x5cce05){if(_0x5cce05){return _0x681c22[_0xef74('0x1b')](_0x423c16);}return _0x681c22[_0xef74('0x1c')](_0x423c16)[_0xef74('0x1d')]();};}function respondWithResult(_0x2af325,_0x563377){_0x563377=_0x563377||0xc8;return function(_0x559e09){if(_0x559e09){return _0x2af325[_0xef74('0x1c')](_0x563377)[_0xef74('0x1e')](_0x559e09);}};}function respondWithFilteredResult(_0x3db30c,_0x1adf3e){return function(_0x401b12){if(_0x401b12){var _0x13d708=typeof _0x1adf3e[_0xef74('0x1f')]===_0xef74('0x20')&&typeof _0x1adf3e[_0xef74('0x21')]===_0xef74('0x20');var _0x6b2c2a=_0x401b12['count'];var _0x3ab228=_0x13d708?0x0:_0x1adf3e[_0xef74('0x1f')];var _0x423fe4=_0x13d708?_0x401b12[_0xef74('0x22')]:_0x1adf3e[_0xef74('0x1f')]+_0x1adf3e[_0xef74('0x21')];var _0x327d20;if(_0x423fe4>=_0x6b2c2a){_0x423fe4=_0x6b2c2a;_0x327d20=0xc8;}else{_0x327d20=0xce;}_0x3db30c[_0xef74('0x1c')](_0x327d20);return _0x3db30c[_0xef74('0x23')]('Content-Range',_0x3ab228+'-'+_0x423fe4+'/'+_0x6b2c2a)['json'](_0x401b12);}return null;};}function patchUpdates(_0x4ec7e0){return function(_0x5a85d3){try{jsonpatch[_0xef74('0x24')](_0x5a85d3,_0x4ec7e0,!![]);}catch(_0x449742){return BPromise['reject'](_0x449742);}return _0x5a85d3[_0xef74('0x25')]();};}function saveUpdates(_0x36fb08,_0x455197){return function(_0x339031){if(_0x339031){return _0x339031[_0xef74('0x26')](_0x36fb08)[_0xef74('0x27')](function(_0x572781){return _0x572781;});}return null;};}function removeEntity(_0x1ed90e,_0x2c65a1){return function(_0x8e7d36){if(_0x8e7d36){return _0x8e7d36[_0xef74('0x28')]()[_0xef74('0x27')](function(){_0x1ed90e[_0xef74('0x1c')](0xcc)[_0xef74('0x1d')]();});}};}function handleEntityNotFound(_0x3fb0b1,_0x49e538){return function(_0x131226){if(!_0x131226){_0x3fb0b1['sendStatus'](0x194);}return _0x131226;};}function handleError(_0x8e36c1,_0x5e2662){_0x5e2662=_0x5e2662||0x1f4;return function(_0x49b717){logger['error'](_0x49b717[_0xef74('0x29')]);if(_0x49b717[_0xef74('0x2a')]){delete _0x49b717[_0xef74('0x2a')];}_0x8e36c1['status'](_0x5e2662)[_0xef74('0x2b')](_0x49b717);};}exports[_0xef74('0x2c')]=function(_0xafd163,_0x2e87a1){var _0x397510={},_0x3ca299={},_0x17c9da={'count':0x0,'rows':[]};var _0x2d5f6c=_['map'](db[_0xef74('0x2d')]['rawAttributes'],function(_0x1a031e){return{'name':_0x1a031e[_0xef74('0x2e')],'type':_0x1a031e[_0xef74('0x2f')][_0xef74('0x30')]};});_0x3ca299[_0xef74('0x31')]=_[_0xef74('0x32')](_0x2d5f6c,_0xef74('0x2a'));_0x3ca299[_0xef74('0x33')]=_[_0xef74('0x34')](_0xafd163[_0xef74('0x33')]);_0x3ca299[_0xef74('0x35')]=_['intersection'](_0x3ca299[_0xef74('0x31')],_0x3ca299[_0xef74('0x33')]);_0x397510[_0xef74('0x36')]=_[_0xef74('0x37')](_0x3ca299[_0xef74('0x31')],qs[_0xef74('0x38')](_0xafd163[_0xef74('0x33')]['fields']));_0x397510['attributes']=_0x397510['attributes'][_0xef74('0x39')]?_0x397510['attributes']:_0x3ca299[_0xef74('0x31')];if(!_0xafd163[_0xef74('0x33')][_0xef74('0x3a')](_0xef74('0x3b'))){_0x397510['limit']=qs[_0xef74('0x21')](_0xafd163[_0xef74('0x33')][_0xef74('0x21')]);_0x397510['offset']=qs[_0xef74('0x1f')](_0xafd163[_0xef74('0x33')][_0xef74('0x1f')]);}_0x397510[_0xef74('0x3c')]=qs[_0xef74('0x3d')](_0xafd163[_0xef74('0x33')][_0xef74('0x3d')]);_0x397510[_0xef74('0x3e')]=qs[_0xef74('0x35')](_[_0xef74('0x3f')](_0xafd163[_0xef74('0x33')],_0x3ca299[_0xef74('0x35')]),_0x2d5f6c);if(_0xafd163[_0xef74('0x33')][_0xef74('0x40')]){_0x397510[_0xef74('0x3e')]=_[_0xef74('0x41')](_0x397510[_0xef74('0x3e')],{'$or':_[_0xef74('0x32')](_0x2d5f6c,function(_0x31842d){if(_0x31842d[_0xef74('0x2f')]!==_0xef74('0x42')){var _0x18ad25={};_0x18ad25[_0x31842d[_0xef74('0x2a')]]={'$like':'%'+_0xafd163[_0xef74('0x33')][_0xef74('0x40')]+'%'};return _0x18ad25;}})});}_0x397510=_[_0xef74('0x41')]({},_0x397510,_0xafd163[_0xef74('0x43')]);var _0x42892f={'where':_0x397510[_0xef74('0x3e')]};return db['WhatsappTransferReport'][_0xef74('0x22')](_0x42892f)['then'](function(_0x4f5579){_0x17c9da['count']=_0x4f5579;if(_0xafd163[_0xef74('0x33')]['includeAll']){_0x397510[_0xef74('0x44')]=[{'all':!![]}];}return db[_0xef74('0x2d')][_0xef74('0x45')](_0x397510);})[_0xef74('0x27')](function(_0x50f7cc){_0x17c9da[_0xef74('0x46')]=_0x50f7cc;return _0x17c9da;})[_0xef74('0x27')](respondWithFilteredResult(_0x2e87a1,_0x397510))[_0xef74('0x47')](handleError(_0x2e87a1,null));};exports['show']=function(_0x5e63b1,_0x4c860d){var _0x2aaf73={'raw':!![],'where':{'id':_0x5e63b1[_0xef74('0x48')]['id']}},_0x266c83={};_0x266c83[_0xef74('0x31')]=_[_0xef74('0x34')](db[_0xef74('0x2d')][_0xef74('0x49')]);_0x266c83['query']=_[_0xef74('0x34')](_0x5e63b1[_0xef74('0x33')]);_0x266c83[_0xef74('0x35')]=_[_0xef74('0x37')](_0x266c83['model'],_0x266c83[_0xef74('0x33')]);_0x2aaf73[_0xef74('0x36')]=_['intersection'](_0x266c83[_0xef74('0x31')],qs[_0xef74('0x38')](_0x5e63b1[_0xef74('0x33')][_0xef74('0x38')]));_0x2aaf73[_0xef74('0x36')]=_0x2aaf73['attributes'][_0xef74('0x39')]?_0x2aaf73[_0xef74('0x36')]:_0x266c83[_0xef74('0x31')];if(_0x5e63b1['query'][_0xef74('0x4a')]){_0x2aaf73[_0xef74('0x44')]=[{'all':!![]}];}_0x2aaf73=_['merge']({},_0x2aaf73,_0x5e63b1[_0xef74('0x43')]);return db['WhatsappTransferReport'][_0xef74('0x4b')](_0x2aaf73)[_0xef74('0x27')](handleEntityNotFound(_0x4c860d,null))[_0xef74('0x27')](respondWithResult(_0x4c860d,null))[_0xef74('0x47')](handleError(_0x4c860d,null));};exports[_0xef74('0x4c')]=function(_0x398775,_0x5377c5){return db[_0xef74('0x2d')]['create'](_0x398775[_0xef74('0x4d')],{})[_0xef74('0x27')](respondWithResult(_0x5377c5,0xc9))[_0xef74('0x47')](handleError(_0x5377c5,null));};exports[_0xef74('0x26')]=function(_0x568ffe,_0x3fcbb3){if(_0x568ffe[_0xef74('0x4d')]['id']){delete _0x568ffe['body']['id'];}return db['WhatsappTransferReport'][_0xef74('0x4b')]({'where':{'id':_0x568ffe[_0xef74('0x48')]['id']}})[_0xef74('0x27')](handleEntityNotFound(_0x3fcbb3,null))[_0xef74('0x27')](saveUpdates(_0x568ffe[_0xef74('0x4d')],null))['then'](respondWithResult(_0x3fcbb3,null))[_0xef74('0x47')](handleError(_0x3fcbb3,null));};exports[_0xef74('0x28')]=function(_0x3bbf1b,_0x5110b1){return db[_0xef74('0x2d')]['find']({'where':{'id':_0x3bbf1b[_0xef74('0x48')]['id']}})[_0xef74('0x27')](handleEntityNotFound(_0x5110b1,null))[_0xef74('0x27')](removeEntity(_0x5110b1,null))[_0xef74('0x47')](handleError(_0x5110b1,null));};exports['describe']=function(_0x4072f3,_0x1e26d7){return db['WhatsappTransferReport'][_0xef74('0x4e')]()[_0xef74('0x27')](respondWithResult(_0x1e26d7,null))[_0xef74('0x47')](handleError(_0x1e26d7,null));}; \ No newline at end of file +var _0xe978=['destroy','then','sendStatus','error','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','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','limit','count','set','Content-Range','reject','update'];(function(_0x51d810,_0x30b6c3){var _0x2ad77b=function(_0x2bd6eb){while(--_0x2bd6eb){_0x51d810['push'](_0x51d810['shift']());}};_0x2ad77b(++_0x30b6c3);}(_0xe978,0x191));var _0x8e97=function(_0x4aa892,_0x25752e){_0x4aa892=_0x4aa892-0x0;var _0x4444d1=_0xe978[_0x4aa892];return _0x4444d1;};'use strict';var emlformat=require(_0x8e97('0x0'));var rimraf=require(_0x8e97('0x1'));var zipdir=require(_0x8e97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e97('0x3'));var moment=require(_0x8e97('0x4'));var BPromise=require(_0x8e97('0x5'));var Mustache=require(_0x8e97('0x6'));var util=require(_0x8e97('0x7'));var path=require(_0x8e97('0x8'));var sox=require('sox');var csv=require(_0x8e97('0x9'));var ejs=require(_0x8e97('0xa'));var fs=require('fs');var fs_extra=require(_0x8e97('0xb'));var _=require(_0x8e97('0xc'));var squel=require(_0x8e97('0xd'));var crypto=require(_0x8e97('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8e97('0xf'));var toCsv=require(_0x8e97('0x9'));var querystring=require(_0x8e97('0x10'));var Papa=require('papaparse');var Redis=require(_0x8e97('0x11'));var authService=require(_0x8e97('0x12'));var qs=require(_0x8e97('0x13'));var as=require(_0x8e97('0x14'));var hardwareService=require(_0x8e97('0x15'));var logger=require(_0x8e97('0x16'))('api');var utils=require(_0x8e97('0x17'));var config=require(_0x8e97('0x18'));var licenseUtil=require(_0x8e97('0x19'));var db=require(_0x8e97('0x1a'))['db'];function respondWithStatusCode(_0x233e6f,_0xae3a20){_0xae3a20=_0xae3a20||0xcc;return function(_0x46c848){if(_0x46c848){return _0x233e6f['sendStatus'](_0xae3a20);}return _0x233e6f[_0x8e97('0x1b')](_0xae3a20)[_0x8e97('0x1c')]();};}function respondWithResult(_0x5842f6,_0x38ea79){_0x38ea79=_0x38ea79||0xc8;return function(_0x235a17){if(_0x235a17){return _0x5842f6[_0x8e97('0x1b')](_0x38ea79)[_0x8e97('0x1d')](_0x235a17);}};}function respondWithFilteredResult(_0x3315a8,_0x42f7c6){return function(_0x5299e1){if(_0x5299e1){var _0x16bba7=typeof _0x42f7c6[_0x8e97('0x1e')]==='undefined'&&typeof _0x42f7c6[_0x8e97('0x1f')]==='undefined';var _0x5e0191=_0x5299e1[_0x8e97('0x20')];var _0x22b09b=_0x16bba7?0x0:_0x42f7c6['offset'];var _0x130352=_0x16bba7?_0x5299e1[_0x8e97('0x20')]:_0x42f7c6['offset']+_0x42f7c6['limit'];var _0x56495b;if(_0x130352>=_0x5e0191){_0x130352=_0x5e0191;_0x56495b=0xc8;}else{_0x56495b=0xce;}_0x3315a8[_0x8e97('0x1b')](_0x56495b);return _0x3315a8[_0x8e97('0x21')](_0x8e97('0x22'),_0x22b09b+'-'+_0x130352+'/'+_0x5e0191)['json'](_0x5299e1);}return null;};}function patchUpdates(_0x1f7868){return function(_0xc4426d){try{jsonpatch['apply'](_0xc4426d,_0x1f7868,!![]);}catch(_0x4c07fe){return BPromise[_0x8e97('0x23')](_0x4c07fe);}return _0xc4426d['save']();};}function saveUpdates(_0x43f463,_0x47ede9){return function(_0x30ba04){if(_0x30ba04){return _0x30ba04[_0x8e97('0x24')](_0x43f463)['then'](function(_0xf5798a){return _0xf5798a;});}return null;};}function removeEntity(_0x770605,_0x466d09){return function(_0x30c51e){if(_0x30c51e){return _0x30c51e[_0x8e97('0x25')]()[_0x8e97('0x26')](function(){_0x770605[_0x8e97('0x1b')](0xcc)[_0x8e97('0x1c')]();});}};}function handleEntityNotFound(_0x3f52ae,_0x50b35b){return function(_0xe0c9e2){if(!_0xe0c9e2){_0x3f52ae[_0x8e97('0x27')](0x194);}return _0xe0c9e2;};}function handleError(_0x206590,_0x1b3a4c){_0x1b3a4c=_0x1b3a4c||0x1f4;return function(_0x12b54f){logger[_0x8e97('0x28')](_0x12b54f['stack']);if(_0x12b54f[_0x8e97('0x29')]){delete _0x12b54f[_0x8e97('0x29')];}_0x206590[_0x8e97('0x1b')](_0x1b3a4c)[_0x8e97('0x2a')](_0x12b54f);};}exports['index']=function(_0x2c32b5,_0x1c8536){var _0x3bff40={},_0x51255e={},_0x3ef0dc={'count':0x0,'rows':[]};var _0x4f031d=_[_0x8e97('0x2b')](db[_0x8e97('0x2c')][_0x8e97('0x2d')],function(_0x341c92){return{'name':_0x341c92[_0x8e97('0x2e')],'type':_0x341c92[_0x8e97('0x2f')][_0x8e97('0x30')]};});_0x51255e[_0x8e97('0x31')]=_[_0x8e97('0x2b')](_0x4f031d,'name');_0x51255e[_0x8e97('0x32')]=_[_0x8e97('0x33')](_0x2c32b5[_0x8e97('0x32')]);_0x51255e[_0x8e97('0x34')]=_[_0x8e97('0x35')](_0x51255e[_0x8e97('0x31')],_0x51255e[_0x8e97('0x32')]);_0x3bff40[_0x8e97('0x36')]=_['intersection'](_0x51255e['model'],qs[_0x8e97('0x37')](_0x2c32b5['query']['fields']));_0x3bff40[_0x8e97('0x36')]=_0x3bff40[_0x8e97('0x36')]['length']?_0x3bff40[_0x8e97('0x36')]:_0x51255e[_0x8e97('0x31')];if(!_0x2c32b5['query']['hasOwnProperty']('nolimit')){_0x3bff40[_0x8e97('0x1f')]=qs[_0x8e97('0x1f')](_0x2c32b5[_0x8e97('0x32')][_0x8e97('0x1f')]);_0x3bff40[_0x8e97('0x1e')]=qs[_0x8e97('0x1e')](_0x2c32b5[_0x8e97('0x32')]['offset']);}_0x3bff40[_0x8e97('0x38')]=qs[_0x8e97('0x39')](_0x2c32b5['query'][_0x8e97('0x39')]);_0x3bff40[_0x8e97('0x3a')]=qs[_0x8e97('0x34')](_[_0x8e97('0x3b')](_0x2c32b5['query'],_0x51255e[_0x8e97('0x34')]),_0x4f031d);if(_0x2c32b5[_0x8e97('0x32')][_0x8e97('0x3c')]){_0x3bff40['where']=_[_0x8e97('0x3d')](_0x3bff40[_0x8e97('0x3a')],{'$or':_[_0x8e97('0x2b')](_0x4f031d,function(_0x4ea8bc){if(_0x4ea8bc[_0x8e97('0x2f')]!==_0x8e97('0x3e')){var _0x2354c1={};_0x2354c1[_0x4ea8bc['name']]={'$like':'%'+_0x2c32b5[_0x8e97('0x32')][_0x8e97('0x3c')]+'%'};return _0x2354c1;}})});}_0x3bff40=_['merge']({},_0x3bff40,_0x2c32b5[_0x8e97('0x3f')]);var _0xf71c62={'where':_0x3bff40[_0x8e97('0x3a')]};return db[_0x8e97('0x2c')][_0x8e97('0x20')](_0xf71c62)[_0x8e97('0x26')](function(_0x48e4e9){_0x3ef0dc[_0x8e97('0x20')]=_0x48e4e9;if(_0x2c32b5['query']['includeAll']){_0x3bff40[_0x8e97('0x40')]=[{'all':!![]}];}return db[_0x8e97('0x2c')][_0x8e97('0x41')](_0x3bff40);})['then'](function(_0x97c0ff){_0x3ef0dc[_0x8e97('0x42')]=_0x97c0ff;return _0x3ef0dc;})['then'](respondWithFilteredResult(_0x1c8536,_0x3bff40))[_0x8e97('0x43')](handleError(_0x1c8536,null));};exports['show']=function(_0xc1a648,_0x3953ec){var _0x4f9d63={'raw':!![],'where':{'id':_0xc1a648[_0x8e97('0x44')]['id']}},_0x4e7b21={};_0x4e7b21[_0x8e97('0x31')]=_['keys'](db['WhatsappTransferReport'][_0x8e97('0x2d')]);_0x4e7b21[_0x8e97('0x32')]=_[_0x8e97('0x33')](_0xc1a648['query']);_0x4e7b21['filters']=_[_0x8e97('0x35')](_0x4e7b21[_0x8e97('0x31')],_0x4e7b21['query']);_0x4f9d63[_0x8e97('0x36')]=_['intersection'](_0x4e7b21['model'],qs[_0x8e97('0x37')](_0xc1a648[_0x8e97('0x32')][_0x8e97('0x37')]));_0x4f9d63[_0x8e97('0x36')]=_0x4f9d63[_0x8e97('0x36')]['length']?_0x4f9d63['attributes']:_0x4e7b21[_0x8e97('0x31')];if(_0xc1a648['query'][_0x8e97('0x45')]){_0x4f9d63[_0x8e97('0x40')]=[{'all':!![]}];}_0x4f9d63=_[_0x8e97('0x3d')]({},_0x4f9d63,_0xc1a648[_0x8e97('0x3f')]);return db['WhatsappTransferReport'][_0x8e97('0x46')](_0x4f9d63)[_0x8e97('0x26')](handleEntityNotFound(_0x3953ec,null))['then'](respondWithResult(_0x3953ec,null))[_0x8e97('0x43')](handleError(_0x3953ec,null));};exports[_0x8e97('0x47')]=function(_0x9e7c01,_0x27c6f9){return db[_0x8e97('0x2c')][_0x8e97('0x47')](_0x9e7c01['body'],{})[_0x8e97('0x26')](respondWithResult(_0x27c6f9,0xc9))[_0x8e97('0x43')](handleError(_0x27c6f9,null));};exports[_0x8e97('0x24')]=function(_0x4855ce,_0x39279e){if(_0x4855ce['body']['id']){delete _0x4855ce[_0x8e97('0x48')]['id'];}return db[_0x8e97('0x2c')][_0x8e97('0x46')]({'where':{'id':_0x4855ce[_0x8e97('0x44')]['id']}})[_0x8e97('0x26')](handleEntityNotFound(_0x39279e,null))[_0x8e97('0x26')](saveUpdates(_0x4855ce[_0x8e97('0x48')],null))['then'](respondWithResult(_0x39279e,null))[_0x8e97('0x43')](handleError(_0x39279e,null));};exports[_0x8e97('0x25')]=function(_0xf9e76a,_0x49a9a7){return db['WhatsappTransferReport'][_0x8e97('0x46')]({'where':{'id':_0xf9e76a[_0x8e97('0x44')]['id']}})['then'](handleEntityNotFound(_0x49a9a7,null))[_0x8e97('0x26')](removeEntity(_0x49a9a7,null))[_0x8e97('0x43')](handleError(_0x49a9a7,null));};exports['describe']=function(_0x20f5c6,_0x4c1605){return db[_0x8e97('0x2c')]['describe']()[_0x8e97('0x26')](respondWithResult(_0x4c1605,null))[_0x8e97('0x43')](handleError(_0x4c1605,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index fbbfffc..20f672e 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 _0xab63=['define','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x16be59,_0x4596e8){var _0x1dcfdc=function(_0x37284a){while(--_0x37284a){_0x16be59['push'](_0x16be59['shift']());}};_0x1dcfdc(++_0x4596e8);}(_0xab63,0x19b));var _0x3ab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab63[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3ab6('0x0'));var logger=require(_0x3ab6('0x1'))(_0x3ab6('0x2'));var moment=require(_0x3ab6('0x3'));var BPromise=require(_0x3ab6('0x4'));var rp=require(_0x3ab6('0x5'));var fs=require('fs');var path=require(_0x3ab6('0x6'));var rimraf=require(_0x3ab6('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x3ab6('0x8')]=function(_0x22847e,_0x1290b7){return _0x22847e[_0x3ab6('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x3ab6('0xa'),'paranoid':![],'indexes':[{'name':_0x3ab6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a5d=['exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','moment','bluebird','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2a5d,0x9b));var _0xd2a5=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x2a5d[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require('lodash');var util=require(_0xd2a5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd2a5('0x1'));var BPromise=require(_0xd2a5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd2a5('0x3'));var attributes=require(_0xd2a5('0x4'));module[_0xd2a5('0x5')]=function(_0xdf3367,_0x18aa4b){return _0xdf3367[_0xd2a5('0x6')](_0xd2a5('0x7'),attributes,{'tableName':_0xd2a5('0x8'),'paranoid':![],'indexes':[{'name':_0xd2a5('0x9'),'fields':[_0xd2a5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index b23cc30..0552122 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 _0xd8a0=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','error','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x9c1b3c,_0xb712fa){var _0x4be255=function(_0x50b4ad){while(--_0x50b4ad){_0x9c1b3c['push'](_0x9c1b3c['shift']());}};_0x4be255(++_0xb712fa);}(_0xd8a0,0x1a5));var _0x0d8a=function(_0x1053c2,_0x3b7bf5){_0x1053c2=_0x1053c2-0x0;var _0xdee52c=_0xd8a0[_0x1053c2];return _0xdee52c;};'use strict';var _=require(_0x0d8a('0x0'));var util=require(_0x0d8a('0x1'));var moment=require(_0x0d8a('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d8a('0x3'));var fs=require('fs');var Redis=require(_0x0d8a('0x4'));var db=require(_0x0d8a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d8a('0x6'))(_0x0d8a('0x7'));var config=require(_0x0d8a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0d8a('0x9')][_0x0d8a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58f4fa,_0x3cdacf,_0x3616c6){return new BPromise(function(_0xaf5603,_0x35a701){return client['request'](_0x58f4fa,_0x3616c6)['then'](function(_0x494016){logger[_0x0d8a('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3cdacf,_0x0d8a('0xc'));logger[_0x0d8a('0xd')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x3cdacf,'request\x20sent',JSON['stringify'](_0x494016));if(_0x494016[_0x0d8a('0xe')]){if(_0x494016[_0x0d8a('0xe')]['code']===0x1f4){logger['error'](_0x0d8a('0xf'),_0x3cdacf,_0x494016[_0x0d8a('0xe')][_0x0d8a('0x10')]);return _0x35a701(_0x494016['error'][_0x0d8a('0x10')]);}logger[_0x0d8a('0xe')](_0x0d8a('0xf'),_0x3cdacf,_0x494016[_0x0d8a('0xe')][_0x0d8a('0x10')]);return _0xaf5603(_0x494016[_0x0d8a('0xe')][_0x0d8a('0x10')]);}else{logger[_0x0d8a('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3cdacf,_0x0d8a('0xc'));_0xaf5603(_0x494016[_0x0d8a('0x11')][_0x0d8a('0x10')]);}})[_0x0d8a('0x12')](function(_0x54ca7b){logger[_0x0d8a('0xe')](_0x0d8a('0xf'),_0x3cdacf,_0x54ca7b);_0x35a701(_0x54ca7b);});});} \ No newline at end of file +var _0x16ca=['../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x16ca,0x155));var _0xa16c=function(_0xd3bdab,_0x5d784a){_0xd3bdab=_0xd3bdab-0x0;var _0x1c3178=_0x16ca[_0xd3bdab];return _0x1c3178;};'use strict';var _=require(_0xa16c('0x0'));var util=require(_0xa16c('0x1'));var moment=require(_0xa16c('0x2'));var BPromise=require('bluebird');var rs=require(_0xa16c('0x3'));var fs=require('fs');var Redis=require(_0xa16c('0x4'));var db=require(_0xa16c('0x5'))['db'];var utils=require(_0xa16c('0x6'));var logger=require(_0xa16c('0x7'))(_0xa16c('0x8'));var config=require(_0xa16c('0x9'));var jayson=require(_0xa16c('0xa'));var client=jayson[_0xa16c('0xb')][_0xa16c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1428fe,_0x1865ef,_0x5b469e){return new BPromise(function(_0x2014bf,_0x18a79f){return client[_0xa16c('0xd')](_0x1428fe,_0x5b469e)[_0xa16c('0xe')](function(_0x27f273){logger[_0xa16c('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1865ef,'request\x20sent');logger['debug'](_0xa16c('0x10'),_0x1865ef,_0xa16c('0x11'),JSON[_0xa16c('0x12')](_0x27f273));if(_0x27f273[_0xa16c('0x13')]){if(_0x27f273[_0xa16c('0x13')][_0xa16c('0x14')]===0x1f4){logger['error'](_0xa16c('0x15'),_0x1865ef,_0x27f273[_0xa16c('0x13')][_0xa16c('0x16')]);return _0x18a79f(_0x27f273[_0xa16c('0x13')]['message']);}logger['error'](_0xa16c('0x15'),_0x1865ef,_0x27f273[_0xa16c('0x13')][_0xa16c('0x16')]);return _0x2014bf(_0x27f273[_0xa16c('0x13')][_0xa16c('0x16')]);}else{logger[_0xa16c('0xf')](_0xa16c('0x15'),_0x1865ef,_0xa16c('0x11'));_0x2014bf(_0x27f273[_0xa16c('0x17')][_0xa16c('0x16')]);}})[_0xa16c('0x18')](function(_0x2337ab){logger['error'](_0xa16c('0x15'),_0x1865ef,_0x2337ab);_0x18a79f(_0x2337ab);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 7799351..798592d 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb673=['online','join','Offline\x20apps:','status','name','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','default','listen','info','start','then','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','Online\x20apps:','map'];(function(_0x484c61,_0x35b2dd){var _0x53064b=function(_0x2a2e2f){while(--_0x2a2e2f){_0x484c61['push'](_0x484c61['shift']());}};_0x53064b(++_0x35b2dd);}(_0xb673,0xa5));var _0x3b67=function(_0x15cdc5,_0x3da0f0){_0x15cdc5=_0x15cdc5-0x0;var _0x51f299=_0xb673[_0x15cdc5];return _0x51f299;};'use strict';var _=require(_0x3b67('0x0'));var db=require(_0x3b67('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x3b67('0x2'));var rpc=require(_0x3b67('0x3'));var config=require(_0x3b67('0x4'));var logger=require('./config/logger')(_0x3b67('0x5'));var pm2=require(_0x3b67('0x6'));var pm2Config=require(_0x3b67('0x7'));var schedule=require('./config/schedule');var chat=require(_0x3b67('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x3b67('0x9'));var provider=require(_0x3b67('0xa'));function main(){return db[_0x3b67('0xb')][_0x3b67('0xc')]()['then'](function(){if(config['seedDB']){return seedDb['default']();}})['then'](function(){return checkLicense[_0x3b67('0xd')]();})['then'](function(){return rpc[_0x3b67('0xe')]();})['then'](function(_0x1e4d72){logger[_0x3b67('0xf')](_0x1e4d72);return chat[_0x3b67('0x10')]();})[_0x3b67('0x11')](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})['then'](function(){return transcribe[_0x3b67('0x10')]();})[_0x3b67('0x11')](function(){return provider['start']();})[_0x3b67('0x11')](function(_0x150bf1){logger['info'](_0x150bf1);return pm2[_0x3b67('0x10')](pm2Config);})[_0x3b67('0x11')](function(_0x37f47a){var _0xdbd8d4=_0x37f47a[_0x3b67('0x12')](function(_0x46168c){return typeof _0x46168c['exitCode']==='number'&&_0x46168c[_0x3b67('0x13')]>=0x0;});if(_0xdbd8d4[_0x3b67('0x14')]>0x0){throw new Error(_0xdbd8d4[_0x3b67('0x14')]+_0x3b67('0x15')+_['map'](_0xdbd8d4,function(_0x204b66){return'\x22'+_0x204b66[_0x3b67('0x16')]['name']+'\x22';}));}logger[_0x3b67('0xf')](_0x3b67('0x17'),_[_0x3b67('0x18')](_[_0x3b67('0x12')](_0x37f47a,{'status':_0x3b67('0x19')}),'name')[_0x3b67('0x1a')]());logger[_0x3b67('0xf')](_0x3b67('0x1b'),_[_0x3b67('0x18')](_[_0x3b67('0x12')](_0x37f47a,function(_0x47752e){return _0x47752e[_0x3b67('0x1c')]!=='online';}),_0x3b67('0x1d'))[_0x3b67('0x1a')]()||_0x3b67('0x1e'));console['log'](_0x3b67('0x1f'));})[_0x3b67('0x20')](function(_0x2faaf1){console[_0x3b67('0x21')](_0x3b67('0x22'),_0x2faaf1);logger[_0x3b67('0x23')](_0x3b67('0x24'),_0x2faaf1);process[_0x3b67('0x25')](0x1);});}main(); \ No newline at end of file +var _0x624c=['./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','Online\x20apps:','join','Offline\x20apps:','map','status','online','name','None','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe'];(function(_0x64ecc5,_0x52b509){var _0x1cd35b=function(_0x40c0a5){while(--_0x40c0a5){_0x64ecc5['push'](_0x64ecc5['shift']());}};_0x1cd35b(++_0x52b509);}(_0x624c,0x1ee));var _0xc624=function(_0x27766b,_0x155221){_0x27766b=_0x27766b-0x0;var _0x3de10e=_0x624c[_0x27766b];return _0x3de10e;};'use strict';var _=require('lodash');var db=require(_0xc624('0x0'))['db'];var seedDb=require(_0xc624('0x1'));var checkLicense=require(_0xc624('0x2'));var rpc=require(_0xc624('0x3'));var config=require(_0xc624('0x4'));var logger=require('./config/logger')(_0xc624('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0xc624('0x6'));var schedule=require('./config/schedule');var chat=require(_0xc624('0x7'));var whatsapp=require(_0xc624('0x8'));var transcribe=require(_0xc624('0x9'));var provider=require(_0xc624('0xa'));function main(){return db[_0xc624('0xb')][_0xc624('0xc')]()[_0xc624('0xd')](function(){if(config['seedDB']){return seedDb[_0xc624('0xe')]();}})[_0xc624('0xd')](function(){return checkLicense[_0xc624('0xe')]();})['then'](function(){return rpc[_0xc624('0xf')]();})[_0xc624('0xd')](function(_0x4a7cf1){logger[_0xc624('0x10')](_0x4a7cf1);return chat[_0xc624('0x11')]();})[_0xc624('0xd')](function(){return whatsapp[_0xc624('0x11')]();})[_0xc624('0xd')](function(){return schedule['start']();})[_0xc624('0xd')](function(){return transcribe[_0xc624('0x11')]();})[_0xc624('0xd')](function(){return provider[_0xc624('0x11')]();})['then'](function(_0x4f50f3){logger['info'](_0x4f50f3);return pm2[_0xc624('0x11')](pm2Config);})['then'](function(_0x3cbc19){var _0x5c236e=_0x3cbc19[_0xc624('0x12')](function(_0x362a4a){return typeof _0x362a4a[_0xc624('0x13')]===_0xc624('0x14')&&_0x362a4a['exitCode']>=0x0;});if(_0x5c236e[_0xc624('0x15')]>0x0){throw new Error(_0x5c236e[_0xc624('0x15')]+_0xc624('0x16')+_['map'](_0x5c236e,function(_0x190458){return'\x22'+_0x190458[_0xc624('0x17')]['name']+'\x22';}));}logger[_0xc624('0x10')](_0xc624('0x18'),_['map'](_[_0xc624('0x12')](_0x3cbc19,{'status':'online'}),'name')[_0xc624('0x19')]());logger[_0xc624('0x10')](_0xc624('0x1a'),_[_0xc624('0x1b')](_[_0xc624('0x12')](_0x3cbc19,function(_0x55be9e){return _0x55be9e[_0xc624('0x1c')]!==_0xc624('0x1d');}),_0xc624('0x1e'))['join']()||_0xc624('0x1f'));console['log'](_0xc624('0x20'));})['catch'](function(_0xa646e1){console[_0xc624('0x21')](_0xc624('0x22'),_0xa646e1);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0xa646e1);process[_0xc624('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 8ac6f24..84b6402 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 _0x6aa7=['smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','find','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','getUuid','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','hex','floor','now','HS512','toString','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','util','secrets','session','role','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x6aa7,0x178));var _0x76aa=function(_0x1ec5ae,_0xc06719){_0x1ec5ae=_0x1ec5ae-0x0;var _0x2aba99=_0x6aa7[_0x1ec5ae];return _0x2aba99;};'use strict';var db=require(_0x76aa('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x76aa('0x1'));var licenseUtil=require(_0x76aa('0x2'));var encryptor=require(_0x76aa('0x3'));var _=require(_0x76aa('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x76aa('0x5'));var compose=require(_0x76aa('0x6'));var basicAuth=require(_0x76aa('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x76aa('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x76aa('0x9')][_0x76aa('0xa')]});var userAttributes=['id',_0x76aa('0xb'),'fullname',_0x76aa('0xc'),_0x76aa('0xd'),_0x76aa('0xe'),'userpic',_0x76aa('0xf'),_0x76aa('0x10'),_0x76aa('0x11'),_0x76aa('0x12'),_0x76aa('0x13'),_0x76aa('0x14'),_0x76aa('0x15'),_0x76aa('0x16'),_0x76aa('0x17'),_0x76aa('0x18'),'lastLoginAt',_0x76aa('0x19'),'crudPermissions',_0x76aa('0x1a'),_0x76aa('0x1b'),_0x76aa('0x1c'),_0x76aa('0x1d'),_0x76aa('0x1e'),'phoneBarDnd','phoneBarEnableRecording',_0x76aa('0x1f'),'phoneBarEnableSettings',_0x76aa('0x20'),_0x76aa('0x21'),'phoneBarRemoteControl',_0x76aa('0x22'),'hotdesk',_0x76aa('0x23'),'userProfileId',_0x76aa('0x24'),_0x76aa('0x25'),_0x76aa('0x26'),_0x76aa('0x27'),_0x76aa('0x28'),_0x76aa('0x29'),'ignorePauseForPreviewCalls','selectRecallMeCampaign',_0x76aa('0x2a'),_0x76aa('0x2b'),_0x76aa('0x2c'),_0x76aa('0x2d'),_0x76aa('0x2e'),_0x76aa('0x2f'),_0x76aa('0x30'),_0x76aa('0x31'),_0x76aa('0x32'),'faxAutoanswerDelay',_0x76aa('0x33'),_0x76aa('0x34')];exports[_0x76aa('0x35')]=function(){return this['isAuthenticated'](!![])[_0x76aa('0x36')](function(_0x189cb6,_0x31252f,_0x2bd2c6){if(_0x189cb6[_0x76aa('0x37')]){_0x2bd2c6();}else{return db[_0x76aa('0x38')][_0x76aa('0x39')]({'where':{'id':_0x189cb6[_0x76aa('0x3a')]['id']},'attributes':['id',_0x76aa('0x3b'),_0x76aa('0x3c')],'raw':!![]})[_0x76aa('0x3d')](function(_0x26b75e){if(_0x26b75e&&_0x26b75e[_0x76aa('0x3b')]){return _0x31252f['status'](_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?0x195:0x193)[_0x76aa('0x3f')]({'message':_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?_0x76aa('0x40'):_0x76aa('0x41')});}else{_0x2bd2c6();}})[_0x76aa('0x42')](function(_0xd12a99){_0x2bd2c6(_0xd12a99);});}});};exports[_0x76aa('0x43')]=function isAuthenticated(_0x545b06){return compose()[_0x76aa('0x36')](function(_0x5a8030,_0x994550,_0x365ff8){var _0x2dec94;if(_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')]){if(_[_0x76aa('0x46')](_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')],_0x76aa('0x47'))){var _0x3ea05a=basicAuth(_0x5a8030);db['User'][_0x76aa('0x48')]({'where':{'name':_0x3ea05a[_0x76aa('0xc')]}})[_0x76aa('0x3d')](function(_0x928ccf){if(!_0x928ccf||!_0x928ccf[_0x76aa('0x49')](_0x3ea05a[_0x76aa('0x4a')])){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x4c')});}_0x5a8030[_0x76aa('0x37')]={'id':_0x928ccf['id']};_0x365ff8();})['catch'](function(_0x2ee338){_0x365ff8(_0x2ee338);});}else if(_['startsWith'](_0x5a8030[_0x76aa('0x44')]['authorization'],_0x76aa('0x4d'))){validateJwt(_0x5a8030,_0x994550,_0x365ff8);}else{if(_0x545b06){_0x365ff8();}else{return _0x994550['status'](0x193)['json']({'message':_0x76aa('0x4e')});}}}else if(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')]){try{var _0x37dfab={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')],_0x37dfab)[_0x76aa('0x3d')](function(_0x23e2fd){return db[_0x76aa('0x51')]['find']({'where':{'id':_0x23e2fd[_0x76aa('0x52')]}})['then'](function(_0x5086f5){_0x2dec94=_0x5086f5;return db[_0x76aa('0x53')][_0x76aa('0x39')]({'where':{'id':0x1},'attributes':[_0x76aa('0x54'),_0x76aa('0x55')],'raw':!![]});})['then'](function(_0x401c07){if(!_0x2dec94||!_[_0x76aa('0x56')](_0x2dec94[_0x76aa('0x57')],_0x23e2fd['nonce'])){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x58')});}if(_0x2dec94[_0x76aa('0x59')]){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}if(_0x2dec94[_0x76aa('0x5b')]){if(_0x401c07[_0x76aa('0x55')]>0x0){if(moment(_0x2dec94['blockedAt'])[_0x76aa('0x5c')](_0x401c07[_0x76aa('0x55')],_0x76aa('0x5d'))>moment()){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}}else{return _0x994550['status'](0x191)['json']({'message':_0x76aa('0x5a')});}}_0x5a8030[_0x76aa('0x37')]={'id':_0x2dec94['id']};_0x365ff8();});})[_0x76aa('0x42')](function(){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x5a')});});}catch(_0x403084){_0x365ff8(_0x403084);}}else if(_0x545b06){_0x365ff8();}else{return _0x994550[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x4e')});}})['use'](function(_0x13dafe,_0x556f59,_0xbb3136){if(_0x13dafe['user']){db['User']['find']({'where':{'id':_0x13dafe[_0x76aa('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5cf314){if(!_0x5cf314){return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5e')});}_0x13dafe[_0x76aa('0x37')]=_0x5cf314;_0xbb3136();})[_0x76aa('0x42')](function(_0x27a52e){_0xbb3136(_0x27a52e);});}else if(_0x545b06){_0xbb3136();}else{return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5f')});}});};exports[_0x76aa('0x60')]=function canUpdate(){return compose()[_0x76aa('0x36')](function(_0x3800a4,_0x47a308,_0x2f695c){return licenseUtil[_0x76aa('0x61')]()['then'](function(_0x2d3441){if(_0x2d3441['update']){_0x2f695c();}else{return _0x47a308[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})[_0x76aa('0x42')](function(_0x2d0bc4){_0x2f695c(_0x2d0bc4);});});};exports[_0x76aa('0x63')]=function isWebrtcLicence(){return compose()[_0x76aa('0x36')](function(_0x165858,_0xb8d052,_0x3946bd){return licenseUtil['getLicense']()[_0x76aa('0x3d')](function(_0x4b8f12){if(_0x4b8f12[_0x76aa('0x64')]){_0x3946bd();}else{return _0xb8d052[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})['catch'](function(_0x5a3d9c){_0x3946bd(_0x5a3d9c);});});};exports[_0x76aa('0x65')]=function(_0x54b673,_0x8660a4,_0x302a0c){_0x54b673[_0x76aa('0x65')]=!![];return _0x302a0c();};exports[_0x76aa('0x66')]=function signToken(_0x30c577){return signJwt(_0x30c577);};exports[_0x76aa('0x67')]=function(_0x5b567b,_0x564546){if(!_0x5b567b[_0x76aa('0x37')]){return _0x564546[_0x76aa('0x4b')](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x68')});}var _0x18c679={'payload':{'id':_0x5b567b[_0x76aa('0x37')]['id'],'role':_0x5b567b['user'][_0x76aa('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x18c679)[_0x76aa('0x3d')](function(_0x26db69){_0x564546['cookie'](_0x76aa('0x69'),_0x26db69);_0x564546['redirect'](_0x76aa('0x6a'));})['catch'](function(_0x339b0d){return _0x564546[_0x76aa('0x4b')](0x1f4)[_0x76aa('0x6b')](_0x339b0d);});};exports[_0x76aa('0x6c')]=function(_0x37a4d9){if(_[_0x76aa('0x6d')](_0x37a4d9[_0x76aa('0x57')])||_['isNil'](_0x37a4d9[_0x76aa('0x6e')])){return null;}else{return createJwt(_0x37a4d9);}};exports['generateApiKey']=function(_0x3ee32){_0x3ee32[_0x76aa('0x57')]=generateNonce();_0x3ee32[_0x76aa('0x6e')]=generateIssuedAt();return createJwt(_0x3ee32);};exports[_0x76aa('0x6f')]=function(_0x3fa7ec,_0x28f8aa){var _0x336024=_0x3fa7ec['query'][_0x76aa('0x50')];if(_0x336024){var _0x281f73={'nonce':_0x28f8aa[_0x76aa('0x57')],'iat':_0x28f8aa[_0x76aa('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x76aa('0x70')]()};return verifyJwt(_0x336024,_0x281f73)[_0x76aa('0x3d')](function(){return generateApiKey(_0x28f8aa);});}else{throw{'message':_0x76aa('0x71')};}};exports[_0x76aa('0x72')]=function(_0x2027f8){var _0xf7732=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xf7732['test'](_0x2027f8))throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x76aa('0x75'));return;};exports[_0x76aa('0x76')]=function(_0x3967f3,_0x2fdc4f,_0x37babe){var _0x51893b=encryptor['decryptString'](_0x2fdc4f)[_0x76aa('0x77')](',');for(var _0x3b0d8a=0x0;_0x3b0d8a<_0x37babe;_0x3b0d8a++){if(!_0x51893b[_0x3b0d8a])break;if(_0x3967f3['toLowerCase']()===_0x51893b[_0x3b0d8a][_0x76aa('0x78')]()){var _0x1e6f3c=util['format'](_0x76aa('0x79'),_0x37babe);if(_0x37babe===0x1){_0x1e6f3c=_0x76aa('0x7a');}throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x1e6f3c);}}return;};exports[_0x76aa('0x7b')]=function(_0x1f5010,_0x3376ec){var _0x30573a=_0x3376ec?encryptor[_0x76aa('0x7c')](_0x3376ec)['split'](','):[];if(_0x30573a[_0x76aa('0x7d')]===0x5){_0x30573a['splice'](-0x1,0x1);}_0x30573a[_0x76aa('0x7e')](_0x1f5010);return encryptor[_0x76aa('0x7f')](_0x30573a[_0x76aa('0x80')](','));};function signJwt(_0x16cc85){var _0x343cf1=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x82')],{'context':jwt});var _0x431d1c=_0x16cc85[_0x76aa('0x83')]||config['secrets'][_0x76aa('0xa')];return new BPromise(function(_0x3d4025,_0x5c542b){_0x343cf1(_0x16cc85[_0x76aa('0x84')],_0x431d1c,_0x16cc85[_0x76aa('0x85')])[_0x76aa('0x3d')](function(_0x3d6d10){_0x3d4025(_0x3d6d10);})[_0x76aa('0x42')](function(_0x5546b6){_0x5c542b(_0x5546b6);});});}function verifyJwt(_0x364d05,_0x4d3ad0,_0x35bd2b){var _0x35881c=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x86')],{'context':jwt});var _0x3a82fe=_0x35bd2b||config[_0x76aa('0x9')][_0x76aa('0xa')];return new BPromise(function(_0x4a37f1,_0x9ea0af){_0x35881c(_0x364d05,_0x3a82fe,_0x4d3ad0)[_0x76aa('0x3d')](function(_0x543c1d){_0x4a37f1(_0x543c1d);})['catch'](function(_0x40429c){_0x9ea0af(_0x40429c);});});}function generateNonce(){return crypto[_0x76aa('0x87')](0x10)['toString'](_0x76aa('0x88'));}function generateIssuedAt(){return Math[_0x76aa('0x89')](Date[_0x76aa('0x8a')]()/0x3e8)['toString']();}function createJwt(_0x446073){var _0x47f733={'payload':{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')]},'options':{'algorithm':_0x76aa('0x8b'),'subject':_0x446073['id'][_0x76aa('0x8c')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x47f733)[_0x76aa('0x3d')](function(_0x4dfeb3){return{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')],'token':_0x4dfeb3};});} \ No newline at end of file +var _0xedd9=['crypto','bluebird','util','moment','session','fullname','name','internal','email','permissions','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','unshift','join','promisify','secrets','payload','verify','hex','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x51f9bf,_0x24d5b7){var _0x2986e3=function(_0x1fcc2f){while(--_0x1fcc2f){_0x51f9bf['push'](_0x51f9bf['shift']());}};_0x2986e3(++_0x24d5b7);}(_0xedd9,0xfc));var _0x9edd=function(_0x12392c,_0x2f004f){_0x12392c=_0x12392c-0x0;var _0x2875f3=_0xedd9[_0x12392c];return _0x2875f3;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9edd('0x0'));var hardwareConf=require(_0x9edd('0x1'));var licenseUtil=require(_0x9edd('0x2'));var encryptor=require(_0x9edd('0x3'));var _=require(_0x9edd('0x4'));var jwt=require(_0x9edd('0x5'));var expressJwt=require(_0x9edd('0x6'));var compose=require(_0x9edd('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9edd('0x8'));var BPromise=require(_0x9edd('0x9'));var util=require(_0x9edd('0xa'));var moment=require(_0x9edd('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9edd('0xc')]});var userAttributes=['id','role',_0x9edd('0xd'),_0x9edd('0xe'),_0x9edd('0xf'),_0x9edd('0x10'),'userpic',_0x9edd('0x11'),'md5secret',_0x9edd('0x12'),_0x9edd('0x13'),'mailPause',_0x9edd('0x14'),_0x9edd('0x15'),'openchannelPause',_0x9edd('0x16'),_0x9edd('0x17'),_0x9edd('0x18'),_0x9edd('0x19'),_0x9edd('0x1a'),_0x9edd('0x1b'),_0x9edd('0x1c'),_0x9edd('0x1d'),'phoneBarAutoAnswer',_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24'),_0x9edd('0x25'),'phoneBarRemoteControlPort',_0x9edd('0x26'),_0x9edd('0x27'),_0x9edd('0x28'),'privacyEnabled',_0x9edd('0x29'),_0x9edd('0x2a'),_0x9edd('0x2b'),'downloadOmnichannelInteractions',_0x9edd('0x2c'),'ignorePauseForPreviewCalls',_0x9edd('0x2d'),_0x9edd('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x9edd('0x2f'),'smsAutoanswer',_0x9edd('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x9edd('0x31'),_0x9edd('0x32'),'whatsappAutoanswer','whatsappAutoanswerDelay'];exports[_0x9edd('0x33')]=function(){return this[_0x9edd('0x34')](!![])[_0x9edd('0x35')](function(_0x542172,_0x3741c8,_0x1dca43){if(_0x542172[_0x9edd('0x36')]){_0x1dca43();}else{return db[_0x9edd('0x37')][_0x9edd('0x38')]({'where':{'id':_0x542172['params']['id']},'attributes':['id',_0x9edd('0x39'),_0x9edd('0x3a')],'raw':!![]})[_0x9edd('0x3b')](function(_0x2f9f86){if(_0x2f9f86&&_0x2f9f86[_0x9edd('0x39')]){return _0x3741c8['status'](_0x2f9f86['disposition']===_0x9edd('0x3c')?0x195:0x193)[_0x9edd('0x3d')]({'message':_0x2f9f86[_0x9edd('0x3a')]===_0x9edd('0x3c')?_0x9edd('0x3e'):'Forbidden.'});}else{_0x1dca43();}})['catch'](function(_0x214d0a){_0x1dca43(_0x214d0a);});}});};exports[_0x9edd('0x34')]=function isAuthenticated(_0x1c762c){return compose()['use'](function(_0x238b22,_0x28cfae,_0x2ae8dd){var _0x41af53;if(_0x238b22['headers'][_0x9edd('0x3f')]){if(_[_0x9edd('0x40')](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x42'))){var _0x42e664=basicAuth(_0x238b22);db[_0x9edd('0x43')][_0x9edd('0x44')]({'where':{'name':_0x42e664[_0x9edd('0xe')]}})[_0x9edd('0x3b')](function(_0x4fd03f){if(!_0x4fd03f||!_0x4fd03f[_0x9edd('0x45')](_0x42e664[_0x9edd('0x46')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':'Wrong\x20credentials.'});}_0x238b22[_0x9edd('0x36')]={'id':_0x4fd03f['id']};_0x2ae8dd();})[_0x9edd('0x48')](function(_0x267c74){_0x2ae8dd(_0x267c74);});}else if(_['startsWith'](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x49'))){validateJwt(_0x238b22,_0x28cfae,_0x2ae8dd);}else{if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':_0x9edd('0x4a')});}}}else if(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')]){try{var _0xd0fd74={'audience':hardwareConf[_0x9edd('0x4d')](),'issuer':hardwareConf[_0x9edd('0x4d')]()};verifyJwt(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')],_0xd0fd74)[_0x9edd('0x3b')](function(_0x5757fc){return db[_0x9edd('0x43')]['find']({'where':{'id':_0x5757fc[_0x9edd('0x4e')]}})[_0x9edd('0x3b')](function(_0x10d6fd){_0x41af53=_0x10d6fd;return db[_0x9edd('0x4f')][_0x9edd('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9edd('0x50')],'raw':!![]});})[_0x9edd('0x3b')](function(_0x2b3469){if(!_0x41af53||!_[_0x9edd('0x51')](_0x41af53[_0x9edd('0x52')],_0x5757fc[_0x9edd('0x53')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x54')});}if(_0x41af53[_0x9edd('0x55')]){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x41af53[_0x9edd('0x56')]){if(_0x2b3469['blockDuration']>0x0){if(moment(_0x41af53[_0x9edd('0x57')])[_0x9edd('0x58')](_0x2b3469[_0x9edd('0x50')],'minutes')>moment()){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});}}else{return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x238b22[_0x9edd('0x36')]={'id':_0x41af53['id']};_0x2ae8dd();});})[_0x9edd('0x48')](function(){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});});}catch(_0x389f51){_0x2ae8dd(_0x389f51);}}else if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)['json']({'message':_0x9edd('0x4a')});}})['use'](function(_0x2bdb3f,_0xc1e657,_0x587d74){if(_0x2bdb3f[_0x9edd('0x36')]){db['User']['find']({'where':{'id':_0x2bdb3f[_0x9edd('0x36')]['id']},'attributes':userAttributes})[_0x9edd('0x3b')](function(_0x1f276b){if(!_0x1f276b){return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5a')});}_0x2bdb3f[_0x9edd('0x36')]=_0x1f276b;_0x587d74();})[_0x9edd('0x48')](function(_0x18c149){_0x587d74(_0x18c149);});}else if(_0x1c762c){_0x587d74();}else{return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5b')});}});};exports[_0x9edd('0x5c')]=function canUpdate(){return compose()[_0x9edd('0x35')](function(_0x46e9f4,_0x5416f8,_0x13197d){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x1e5805){if(_0x1e5805[_0x9edd('0x5e')]){_0x13197d();}else{return _0x5416f8[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})['catch'](function(_0x4bc7a1){_0x13197d(_0x4bc7a1);});});};exports[_0x9edd('0x5f')]=function isWebrtcLicence(){return compose()['use'](function(_0x8b1fdb,_0x19b56b,_0x2b06d3){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x53005b){if(_0x53005b[_0x9edd('0x60')]){_0x2b06d3();}else{return _0x19b56b[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})[_0x9edd('0x48')](function(_0xfd7bd1){_0x2b06d3(_0xfd7bd1);});});};exports[_0x9edd('0x61')]=function(_0x293b03,_0x1d78c4,_0x35bdec){_0x293b03['isMiddleware']=!![];return _0x35bdec();};exports[_0x9edd('0x62')]=function signToken(_0x237e91){return signJwt(_0x237e91);};exports['setTokenCookie']=function(_0xb93816,_0x8d8701){if(!_0xb93816['user']){return _0x8d8701[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x63')});}var _0x5215b0={'payload':{'id':_0xb93816[_0x9edd('0x36')]['id'],'role':_0xb93816[_0x9edd('0x36')][_0x9edd('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5215b0)[_0x9edd('0x3b')](function(_0x53f6e3){_0x8d8701[_0x9edd('0x65')](_0x9edd('0x66'),_0x53f6e3);_0x8d8701[_0x9edd('0x67')]('/dashboards/general');})[_0x9edd('0x48')](function(_0x21f6ce){return _0x8d8701['status'](0x1f4)[_0x9edd('0x68')](_0x21f6ce);});};exports['retrieveApiKey']=function(_0x336494){if(_[_0x9edd('0x69')](_0x336494[_0x9edd('0x52')])||_[_0x9edd('0x69')](_0x336494[_0x9edd('0x6a')])){return null;}else{return createJwt(_0x336494);}};exports[_0x9edd('0x6b')]=function(_0x2334d4){_0x2334d4[_0x9edd('0x52')]=generateNonce();_0x2334d4[_0x9edd('0x6a')]=generateIssuedAt();return createJwt(_0x2334d4);};exports[_0x9edd('0x6c')]=function(_0x31272d,_0x5a3b1d){var _0x161bea=_0x31272d[_0x9edd('0x4b')][_0x9edd('0x4c')];if(_0x161bea){var _0x58fe29={'nonce':_0x5a3b1d[_0x9edd('0x52')],'iat':_0x5a3b1d['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x161bea,_0x58fe29)[_0x9edd('0x3b')](function(){return generateApiKey(_0x5a3b1d);});}else{throw{'message':_0x9edd('0x6d')};}};exports[_0x9edd('0x6e')]=function(_0x35ddb3){var _0x48a900=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48a900['test'](_0x35ddb3))throw new db['Sequelize'][(_0x9edd('0x6f'))](_0x9edd('0x70'));return;};exports[_0x9edd('0x71')]=function(_0x1091ff,_0x2e2920,_0x41ec97){var _0x25906c=encryptor[_0x9edd('0x72')](_0x2e2920)['split'](',');for(var _0x16dfdc=0x0;_0x16dfdc<_0x41ec97;_0x16dfdc++){if(!_0x25906c[_0x16dfdc])break;if(_0x1091ff['toLowerCase']()===_0x25906c[_0x16dfdc][_0x9edd('0x73')]()){var _0x6a1cfc=util['format'](_0x9edd('0x74'),_0x41ec97);if(_0x41ec97===0x1){_0x6a1cfc=_0x9edd('0x75');}throw new db[(_0x9edd('0x76'))]['ValidationError'](_0x6a1cfc);}}return;};exports[_0x9edd('0x77')]=function(_0x2e1ce3,_0x430eb4){var _0x15ebfa=_0x430eb4?encryptor[_0x9edd('0x72')](_0x430eb4)[_0x9edd('0x78')](','):[];if(_0x15ebfa['length']===0x5){_0x15ebfa['splice'](-0x1,0x1);}_0x15ebfa[_0x9edd('0x79')](_0x2e1ce3);return encryptor['encryptString'](_0x15ebfa[_0x9edd('0x7a')](','));};function signJwt(_0x3e9a3e){var _0x439083=BPromise[_0x9edd('0x7b')](jwt['sign'],{'context':jwt});var _0x21ead2=_0x3e9a3e['secret']||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0xc6bde6,_0x5ca123){_0x439083(_0x3e9a3e[_0x9edd('0x7d')],_0x21ead2,_0x3e9a3e['options'])[_0x9edd('0x3b')](function(_0x4e1eda){_0xc6bde6(_0x4e1eda);})['catch'](function(_0x236b82){_0x5ca123(_0x236b82);});});}function verifyJwt(_0x4a72d0,_0x141137,_0x134c9c){var _0x307a61=BPromise['promisify'](jwt[_0x9edd('0x7e')],{'context':jwt});var _0x321485=_0x134c9c||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0x467512,_0x4d8fbb){_0x307a61(_0x4a72d0,_0x321485,_0x141137)['then'](function(_0x2e1a96){_0x467512(_0x2e1a96);})[_0x9edd('0x48')](function(_0x5516c4){_0x4d8fbb(_0x5516c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9edd('0x7f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x9edd('0x80')]();}function createJwt(_0x32ff46){var _0x589348={'payload':{'iat':_0x32ff46[_0x9edd('0x6a')],'nonce':_0x32ff46[_0x9edd('0x52')]},'options':{'algorithm':_0x9edd('0x81'),'subject':_0x32ff46['id']['toString'](),'issuer':hardwareConf[_0x9edd('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x589348)[_0x9edd('0x3b')](function(_0x18d1a0){return{'iat':_0x32ff46['apiKeyIat'],'nonce':_0x32ff46[_0x9edd('0x52')],'token':_0x18d1a0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index ae684f0..396f9f7 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 _0x5f2f=['rows','catch','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where','fields','user','clause','tags','skip','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts'];(function(_0x5ed04e,_0x5dbc3a){var _0x4232d7=function(_0x27c245){while(--_0x27c245){_0x5ed04e['push'](_0x5ed04e['shift']());}};_0x4232d7(++_0x5dbc3a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x119d80,_0x193e53){_0x119d80=_0x119d80-0x0;var _0x3c505d=_0x5f2f[_0x119d80];return _0x3c505d;};'use strict';var _=require(_0xf5f2('0x0'));var sqlUtils=require(_0xf5f2('0x1'));var db=require(_0xf5f2('0x2'))['db'];exports[_0xf5f2('0x3')]=function(_0x1172dd,_0x174bc7,_0x3c72ee,_0x107cf){var _0x501fbd={'count':0x0,'rows':[]};var _0x4854b6=sqlUtils[_0xf5f2('0x4')](_0x174bc7,_0x1172dd);if(_0x4854b6){return Promise[_0xf5f2('0x5')](_0x501fbd);}var _0xad7f65=sqlUtils[_0xf5f2('0x6')]();var _0x3133bc={};var _0x473100=![];var _0x5907aa=![];return Promise[_0xf5f2('0x5')]()[_0xf5f2('0x7')](function(){if(_0x1172dd[_0xf5f2('0x8')]){return sqlUtils['parseAdvancedSearchFilter'](_0x1172dd[_0xf5f2('0x8')],_0x107cf);}else{return sqlUtils[_0xf5f2('0x9')](_0x1172dd,_0x107cf);}})[_0xf5f2('0x7')](function(_0x4e0e6b){_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b['default']);_0xad7f65['where'](_0x4e0e6b[_0xf5f2('0xb')]);_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b['filter']);_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b[_0xf5f2('0xc')][_0xf5f2('0xd')]);_0x3133bc=_0x4e0e6b[_0xf5f2('0xe')];_0x5907aa=_0x4e0e6b[_0xf5f2('0xc')][_0xf5f2('0xf')];return sqlUtils['checkListsRestrictions'](_0x174bc7,_0x1172dd,_0x5907aa);})[_0xf5f2('0x7')](function(_0xea612c){_0xad7f65[_0xf5f2('0xa')](_0xea612c);var _0x1c1a5c=_0x1172dd[_0xf5f2('0x8')]?_0x3133bc['ids']:_0x1172dd[_0xf5f2('0x10')];_0x473100=_0x1c1a5c?!![]:![];return sqlUtils[_0xf5f2('0x11')](_0xad7f65,_0x1c1a5c);})[_0xf5f2('0x7')](function(_0x1b6dd2){_0x501fbd[_0xf5f2('0x12')]=_0x1b6dd2;if(_0x501fbd[_0xf5f2('0x12')]===0x0){return;}return sqlUtils[_0xf5f2('0x13')](_0xad7f65,_0x1172dd[_0xf5f2('0xb')],_0x3c72ee,_0x473100,_0x3133bc[_0xf5f2('0xd')],_0x5907aa);})[_0xf5f2('0x7')](function(_0x20fccd){if(!_0x20fccd){return[];}return sqlUtils[_0xf5f2('0x14')](_0x20fccd,_0x1172dd,_0x3c72ee);})[_0xf5f2('0x7')](function(_0x3ee69){_0x501fbd[_0xf5f2('0x15')]=_0x3ee69;return _0x501fbd;})[_0xf5f2('0x16')](function(_0x1bf655){throw _0x1bf655;});};exports['describe']=function(){var _0x34706d={};var _0x47101e=[];return db['CmContact']['describe']()[_0xf5f2('0x7')](function(_0x388e6c){_0x34706d=_0x388e6c;var _0x4ae323=Object[_0xf5f2('0x17')](_0x34706d)[_0xf5f2('0x18')](function(_0x39e44a){return _[_0xf5f2('0x19')](_0x39e44a,_0xf5f2('0x1a'))?_0x39e44a:undefined;});var _0x4c691a=_0x4ae323[_0xf5f2('0x1b')](function(_0x4669a6){return db[_0xf5f2('0x1c')][_0xf5f2('0x1d')]({'where':{'id':_0x4669a6[_0xf5f2('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x4c691a);})['then'](function(_0x5f1124){for(var _0x3f79d5=0x0;_0x3f79d5<_0x5f1124[_0xf5f2('0x1f')];_0x3f79d5++){if(_0x5f1124[_0x3f79d5]){var _0x1a5bb3=_0xf5f2('0x1a')+_0x5f1124[_0x3f79d5]['id'];_0x34706d[_0x1a5bb3][_0xf5f2('0x20')]=_0x5f1124[_0x3f79d5][_0xf5f2('0x21')];}}_0x47101e=_[_0xf5f2('0x1b')](Object[_0xf5f2('0x17')](_0x34706d),function(_0x4ab014){return{'name':_0x4ab014,'type':_0x34706d[_0x4ab014][_0xf5f2('0x21')]};});return _0x47101e;})[_0xf5f2('0x16')](function(_0x375ca8){throw _0x375ca8;});}; \ No newline at end of file +var _0x5f66=['buildContactsQuery','getFilteredContacts','catch','CmContact','keys','filter','cf_','CmCustomField','slice','all','length','./sql-utils','findAll','resolve','then','search','parseAdvancedSearchFilter','where','default','fields','clause','user','skip','checkListsRestrictions','ids','tag','count'];(function(_0x49636b,_0x41ec3e){var _0x21f151=function(_0x203cca){while(--_0x203cca){_0x49636b['push'](_0x49636b['shift']());}};_0x21f151(++_0x41ec3e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var sqlUtils=require(_0x65f6('0x0'));var db=require('../../mysqldb')['db'];exports[_0x65f6('0x1')]=function(_0x2f06ae,_0x3461cd,_0xbce843,_0x1a330c){var _0x5eb9ad={'count':0x0,'rows':[]};var _0x3c5029=sqlUtils['skipContactsQuery'](_0x3461cd,_0x2f06ae);if(_0x3c5029){return Promise[_0x65f6('0x2')](_0x5eb9ad);}var _0x22b017=sqlUtils['getContactsSubquery']();var _0x4ed98f={};var _0x1c0e12=![];var _0x2c6571=![];return Promise[_0x65f6('0x2')]()[_0x65f6('0x3')](function(){if(_0x2f06ae[_0x65f6('0x4')]){return sqlUtils[_0x65f6('0x5')](_0x2f06ae['search'],_0x1a330c);}else{return sqlUtils['parseQueryParameters'](_0x2f06ae,_0x1a330c);}})[_0x65f6('0x3')](function(_0x2f6d5b){_0x22b017[_0x65f6('0x6')](_0x2f6d5b[_0x65f6('0x7')]);_0x22b017['where'](_0x2f6d5b[_0x65f6('0x8')]);_0x22b017['where'](_0x2f6d5b['filter']);_0x22b017[_0x65f6('0x6')](_0x2f6d5b['user'][_0x65f6('0x9')]);_0x4ed98f=_0x2f6d5b['tags'];_0x2c6571=_0x2f6d5b[_0x65f6('0xa')][_0x65f6('0xb')];return sqlUtils[_0x65f6('0xc')](_0x3461cd,_0x2f06ae,_0x2c6571);})[_0x65f6('0x3')](function(_0x369f96){_0x22b017[_0x65f6('0x6')](_0x369f96);var _0x44144b=_0x2f06ae[_0x65f6('0x4')]?_0x4ed98f[_0x65f6('0xd')]:_0x2f06ae[_0x65f6('0xe')];_0x1c0e12=_0x44144b?!![]:![];return sqlUtils['countFilteredContacts'](_0x22b017,_0x44144b);})[_0x65f6('0x3')](function(_0x49a913){_0x5eb9ad['count']=_0x49a913;if(_0x5eb9ad[_0x65f6('0xf')]===0x0){return;}return sqlUtils[_0x65f6('0x10')](_0x22b017,_0x2f06ae[_0x65f6('0x8')],_0xbce843,_0x1c0e12,_0x4ed98f[_0x65f6('0x9')],_0x2c6571);})[_0x65f6('0x3')](function(_0x1f974c){if(!_0x1f974c){return[];}return sqlUtils[_0x65f6('0x11')](_0x1f974c,_0x2f06ae,_0xbce843);})[_0x65f6('0x3')](function(_0x495dd6){_0x5eb9ad['rows']=_0x495dd6;return _0x5eb9ad;})[_0x65f6('0x12')](function(_0x5b4055){throw _0x5b4055;});};exports['describe']=function(){var _0x5c5b91={};var _0x365159=[];return db[_0x65f6('0x13')]['describe']()[_0x65f6('0x3')](function(_0x270893){_0x5c5b91=_0x270893;var _0xbee6a4=Object[_0x65f6('0x14')](_0x5c5b91)[_0x65f6('0x15')](function(_0xc139c2){return _['startsWith'](_0xc139c2,_0x65f6('0x16'))?_0xc139c2:undefined;});var _0x4bb39e=_0xbee6a4['map'](function(_0x212247){return db[_0x65f6('0x17')]['findOne']({'where':{'id':_0x212247[_0x65f6('0x18')](0x3)},'raw':!![]});});return Promise[_0x65f6('0x19')](_0x4bb39e);})[_0x65f6('0x3')](function(_0x2774a1){for(var _0x4f5a69=0x0;_0x4f5a69<_0x2774a1[_0x65f6('0x1a')];_0x4f5a69++){if(_0x2774a1[_0x4f5a69]){var _0x59ea32=_0x65f6('0x16')+_0x2774a1[_0x4f5a69]['id'];_0x5c5b91[_0x59ea32]['fieldType']=_0x2774a1[_0x4f5a69]['type'];}}_0x365159=_['map'](Object[_0x65f6('0x14')](_0x5c5b91),function(_0x16cde8){return{'name':_0x16cde8,'type':_0x5c5b91[_0x16cde8]['type']};});return _0x365159;})[_0x65f6('0x12')](function(_0x28f710){throw _0x28f710;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 2517c5c..aafb2a4 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 _0x33a4=['filter','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','order','subqry.','DESC','from','Tag','findAll','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','push','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','firstName','mobile','fax','email','CompanyId','deletedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','DATE','buildExpression','type','default','text','value','start','end','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag'];(function(_0x570c4b,_0x2ec3b7){var _0x3d45aa=function(_0x368131){while(--_0x368131){_0x570c4b['push'](_0x570c4b['shift']());}};_0x3d45aa(++_0x2ec3b7);}(_0x33a4,0x88));var _0x433a=function(_0x177f41,_0x1be600){_0x177f41=_0x177f41-0x0;var _0x5b905e=_0x33a4[_0x177f41];return _0x5b905e;};'use strict';var _=require('lodash');var squel=require(_0x433a('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0x433a('0x1'));var utils=require(_0x433a('0x2'));var db=require(_0x433a('0x3'))['db'];function skipContactsQuery(_0x4909a4,_0x4b7aef){var _0x4f5bc0=![];if(_0x4909a4[_0x433a('0x4')]===_0x433a('0x5')&&!_0x4b7aef[_0x433a('0x6')]&&!_0x4b7aef[_0x433a('0x7')]&&_0x4b7aef[_0x433a('0x8')]!=='true'){_0x4f5bc0=!![];}return _0x4f5bc0;}function getContactsSubquery(){return squel[_0x433a('0x9')]()['from'](_0x433a('0xa'),'c')[_0x433a('0xb')](_0x433a('0xc'));}function applyJoinClauses(_0x4130ee,_0x4c1057){var _0x4ac437=_0x4c1057?'c':_0x433a('0xd');_0x4130ee[_0x433a('0xe')](_0x433a('0xf'),'uc',_0x433a('0x10')+_0x4ac437+_0x433a('0x11'))['left_join']('cm_contact_has_tags','ct',_0x433a('0x12')+_0x4ac437+_0x433a('0x11'))[_0x433a('0xe')](_0x433a('0x13'),'t','t.id\x20=\x20ct.TagId');return _0x4130ee;}function addFieldsToQuery(_0x2d064c,_0x4651e8,_0x4f2168,_0x3c7de8,_0x524a57){var _0x36d1a6=_0x524a57?'c':_0x433a('0xd');if(!_0x4651e8){_0x4651e8=['id',_0x433a('0x14'),'lastName','phone',_0x433a('0x15'),_0x433a('0x16'),_0x433a('0x17'),_0x433a('0x7'),_0x433a('0x18'),'createdAt','updatedAt',_0x433a('0x19'),_0x433a('0x1a')];}var _0x4254c4=_0x4f2168&&_0x524a57||!_0x4f2168&&!_0x524a57;if(_0x3c7de8){_0x4254c4=_0x3c7de8&&_0x524a57||!_0x3c7de8&&!_0x524a57;}_0x4651e8[_0x433a('0x1b')](function(_0x255e47){if(_0x255e47===_0x433a('0x1a')){if(_0x4254c4){_0x2d064c[_0x433a('0x1c')](_0x433a('0x1d'),_0x255e47);}else if(_0x4f2168||_0x3c7de8){_0x2d064c[_0x433a('0x1c')](_0x36d1a6+'.'+_0x255e47);}}else{_0x2d064c[_0x433a('0x1c')](_0x36d1a6+'.'+_0x255e47);}});return _0x2d064c;}function getSqlClauses(){var _0x36db9f={'default':squel['expr'](),'fields':squel[_0x433a('0x1e')](),'filter':squel['expr'](),'tags':{'clause':squel[_0x433a('0x1e')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x36db9f;}function parseTagParameter(_0x4fd99){var _0x46c573=squel[_0x433a('0x1e')]();if(_0x4fd99){var _0xa2dfe5=utils[_0x433a('0x1f')](_0x4fd99);_0xa2dfe5[_0x433a('0x1b')](function(_0x1bbd03){_0x46c573['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1bbd03+',%');});}return _0x46c573;}function parseSearchFilter(_0x5b2ce0){var _0x2a5a13=squel['expr']();if(_0x5b2ce0){var _0x326785=_0x5b2ce0['replace']('\x5c','\x5c\x5c')[_0x433a('0x20')](/'/g,'\x27\x27');if(_0x326785[_0x433a('0x21')]('\x20')[_0x433a('0x22')]>0x1){_0x2a5a13['or'](_0x433a('0x23'),qs[_0x433a('0x24')](_0x326785),null);}else{if(qs[_0x433a('0x25')](_0x326785)){_0x2a5a13['or']('c.id\x20LIKE\x20?',_0x326785+'%');_0x2a5a13['or'](_0x433a('0x26'),_0x326785+'%');_0x2a5a13['or'](_0x433a('0x27'),_0x326785+'%');_0x2a5a13['or']('c.fax\x20LIKE\x20?',_0x326785+'%');}else if(qs[_0x433a('0x28')](_0x326785)){_0x2a5a13['or']('c.email\x20LIKE\x20?',_0x326785+'%');}else{_0x2a5a13['or']('c.firstName\x20LIKE\x20?','%'+_0x326785+'%');_0x2a5a13['or']('c.lastName\x20LIKE\x20?','%'+_0x326785+'%');_0x2a5a13['or'](_0x433a('0x29'),'%'+_0x326785+'%');}}}return _0x2a5a13;}function parseAdvancedSearchFilter(_0x4fcecc,_0x1b0d85){var _0x499e8c=getSqlClauses();var _0x49f03e=as[_0x433a('0x2a')](_0x4fcecc);var _0x1d5d78=_0x49f03e[_0x433a('0x2b')];for(var _0x4fd82c=0x0;_0x4fd82c<_0x49f03e[_0x433a('0x2c')][_0x433a('0x22')];_0x4fd82c++){var _0x469b41=_0x49f03e['conditions'][_0x4fd82c];var _0x4c8d1d='c';var _0x713b41=_[_0x433a('0x2d')](_0x1b0d85,[_0x433a('0x2e'),_0x469b41[_0x433a('0x1c')]]);if(_0x713b41){if(_0x469b41[_0x433a('0x1c')]===_0x433a('0x2f')||_0x713b41[_0x433a('0x30')]===_0x433a('0x31')){_0x469b41['castTo']=_0x433a('0x32');}var _0x2459d7=as[_0x433a('0x33')](_0x4c8d1d,_0x713b41[_0x433a('0x34')],_0x469b41);_0x499e8c[_0x433a('0x35')][_0x1d5d78](_0x2459d7[_0x433a('0x36')],_0x2459d7[_0x433a('0x37')][_0x433a('0x38')],_0x2459d7[_0x433a('0x37')][_0x433a('0x39')]);}else{if(_0x469b41[_0x433a('0x1c')]==='Tag'){var _0x267c69=_0x469b41[_0x433a('0x37')][_0x433a('0x21')](',')[_0x433a('0x3a')](function(_0x2484c1){return Number(_0x2484c1);});var _0x151901=parseTagParameter(_0x267c69);_0x499e8c[_0x433a('0x3b')][_0x433a('0x3c')][_0x433a('0x3d')](_0x151901);_0x499e8c[_0x433a('0x3b')][_0x433a('0x3e')]=_0x267c69;}else if(_0x469b41['field']===_0x433a('0x3f')){_0x499e8c[_0x433a('0x40')]['clause']['and'](_0x433a('0x41'),_0x469b41['value']);_0x499e8c[_0x433a('0x40')][_0x433a('0x42')]=!![];}}}return _0x499e8c;}function parseModelFields(_0x1530b0,_0x4fdf0c){var _0x5bdff7=squel[_0x433a('0x1e')]();var _0x101662=_(_0x1530b0)[_0x433a('0x43')]()[_0x433a('0x3a')](function(_0x3d5750){return _[_0x433a('0x44')](_0x4fdf0c,['name',_0x3d5750])?_0x3d5750:undefined;})['compact']()[_0x433a('0x37')]();if(_0x1530b0[_0x433a('0x45')]){_0x101662['push'](_0x433a('0x45'));}if(_0x101662[_0x433a('0x22')]>0x0){_0x101662[_0x433a('0x1b')](function(_0x796c9f){if(_0x796c9f===_0x433a('0x7')){_0x5bdff7[_0x433a('0x3d')]('c.ListId\x20IN\x20?',[][_0x433a('0x46')](_0x1530b0[_0x796c9f]));}else if(_0x796c9f===_0x433a('0x45')){var _0x15e9f4='%'+_0x1530b0[_0x796c9f]+'%';_0x5bdff7[_0x433a('0x3d')](_0x433a('0x47'),_0x15e9f4);}else{_0x5bdff7[_0x433a('0x3d')]('c.'+_0x796c9f+_0x433a('0x48'),_0x1530b0[_0x796c9f]);}});}return _0x5bdff7;}function parseQueryParameters(_0x51249c,_0x4bb830){var _0x2e56d5=getSqlClauses();return Promise[_0x433a('0x49')]()[_0x433a('0x4a')](function(){return parseModelFields(_0x51249c,_0x4bb830);})['then'](function(_0x384cdf){_0x2e56d5['fields'][_0x433a('0x3d')](_0x384cdf);return parseTagParameter(_0x51249c[_0x433a('0x4b')]);})[_0x433a('0x4a')](function(_0x466fca){_0x2e56d5['tags'][_0x433a('0x3c')][_0x433a('0x3d')](_0x466fca);return parseSearchFilter(_0x51249c[_0x433a('0x4c')]);})[_0x433a('0x4a')](function(_0xa850dc){_0x2e56d5[_0x433a('0x4c')]=_0xa850dc;return _0x2e56d5;});}function checkListsRestrictions(_0x201f24,_0x4c7f1d,_0x3d3359){var _0x449bf0=squel[_0x433a('0x1e')]();return Promise[_0x433a('0x49')]()[_0x433a('0x4a')](function(){if(_0x4c7f1d[_0x433a('0x6')]&&_0x201f24[_0x433a('0x4')]===_0x433a('0x5')&&!_0x3d3359){return _0x201f24[_0x433a('0x4d')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x2e2dc4){if(_0x2e2dc4){if(_0x2e2dc4[_0x433a('0x22')]===0x0){_0x449bf0[_0x433a('0x3d')](_0x433a('0x4e'));}else{_0x449bf0['and'](_0x433a('0x4f'),_[_0x433a('0x3a')](_0x2e2dc4,'id'));}}})[_0x433a('0x4a')](function(){return _0x449bf0;});}function buildContactsQuery(_0x469c1c,_0x486577,_0x55cc44,_0x11c2f6,_0x85c18e,_0xf98f19){if(_0x486577){_0x486577=_0x55cc44[_0x433a('0x50')];}_0x469c1c=addFieldsToQuery(_0x469c1c,_0x486577,_0x11c2f6,_0xf98f19,!![]);var _0x1f4a98=squel[_0x433a('0x9')]();_0x1f4a98=addFieldsToQuery(_0x1f4a98,_0x486577,_0x11c2f6,_0xf98f19,![]);if(_0x11c2f6||_0xf98f19){_0x469c1c=applyJoinClauses(_0x469c1c,!![]);_0x469c1c[_0x433a('0x51')](_0x433a('0x52'));if(_0x55cc44[_0x433a('0x53')]){_0x1f4a98[_0x433a('0x53')](_0x55cc44['limit']);}if(_0x55cc44[_0x433a('0x54')]){_0x1f4a98[_0x433a('0x54')](_0x55cc44[_0x433a('0x54')]);}}else{_0x1f4a98=applyJoinClauses(_0x1f4a98,![]);_0x1f4a98['group']('subqry.id');if(_0x55cc44[_0x433a('0x53')]){_0x469c1c[_0x433a('0x53')](_0x55cc44[_0x433a('0x53')]);}if(_0x55cc44[_0x433a('0x54')]){_0x469c1c[_0x433a('0x54')](_0x55cc44[_0x433a('0x54')]);}}_0x1f4a98['having'](_0x85c18e);if(_0x55cc44[_0x433a('0x55')]){_0x55cc44[_0x433a('0x55')][_0x433a('0x1b')](function(_0x244ac6){_0x469c1c[_0x433a('0x55')]('c.'+_0x244ac6[0x0],_0x244ac6[0x1]==='DESC'?![]:!![]);_0x1f4a98[_0x433a('0x55')](_0x433a('0x56')+_0x244ac6[0x0],_0x244ac6[0x1]===_0x433a('0x57')?![]:!![]);});}_0x1f4a98[_0x433a('0x58')](_0x469c1c,_0x433a('0xd'));return _0x1f4a98;}function getFilteredContacts(_0x55f9c9){var _0x1c2820=[];return db[_0x433a('0x59')][_0x433a('0x5a')]({'attributes':['id','name',_0x433a('0x5b')],'raw':!![]})['then'](function(_0x2ffb14){_0x1c2820=_[_0x433a('0x5c')](_0x2ffb14,'id');var _0x50f475={'type':db['Sequelize'][_0x433a('0x5d')][_0x433a('0x5e')],'model':db[_0x433a('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x433a('0x60')][_0x433a('0x61')](_0x55f9c9[_0x433a('0x62')](),_0x50f475);})[_0x433a('0x4a')](function(_0x31a991){_0x31a991['forEach'](function(_0xfd746b){if(_0xfd746b['TagIds']){_0xfd746b[_0x433a('0x63')]=[];_0xfd746b[_0x433a('0x1a')][_0x433a('0x21')](',')['forEach'](function(_0x171576){_0xfd746b[_0x433a('0x63')][_0x433a('0x64')](_0x1c2820[_0x171576]);});}delete _0xfd746b[_0x433a('0x1a')];});return _0x31a991;});}function countFilteredContacts(_0x1745bd,_0x4c3914){var _0x17e1ce=_0x1745bd[_0x433a('0x65')]();_0x17e1ce['field'](_0x433a('0x66'));_0x17e1ce=applyJoinClauses(_0x17e1ce,!![]);_0x1745bd[_0x433a('0x51')](_0x433a('0x52'));var _0x57ecb5=utils[_0x433a('0x1f')](_0x4c3914);if(!_[_0x433a('0x67')](_0x57ecb5)){_0x17e1ce[_0x433a('0xb')](_0x433a('0x68'),_0x57ecb5);}var _0x2657bb={'type':db['Sequelize']['QueryTypes'][_0x433a('0x5e')],'raw':!![]};return db[_0x433a('0x60')][_0x433a('0x61')](_0x17e1ce[_0x433a('0x62')](),_0x2657bb)[_0x433a('0x4a')](function(_0x4266ca){return _0x4266ca[0x0][_0x433a('0x66')];});}module[_0x433a('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x44d4=['type','value','start','end','Tag','tags','and','ids','User','user','clause','skip','keys','map','compact','Contact','push','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','filter','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','limit','offset','group','subqry.id','having','order','forEach','DESC','from','findAll','color','SELECT','sequelize','query','toString','Tags','clone','COUNT(*)','c.id','isEmpty','Sequelize','QueryTypes','exports','lodash','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','email','deletedAt','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x44d4,0x161));var _0x444d=function(_0x36e7d3,_0xd816e4){_0x36e7d3=_0x36e7d3-0x0;var _0x1b9c66=_0x44d4[_0x36e7d3];return _0x1b9c66;};'use strict';var _=require(_0x444d('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require(_0x444d('0x1'));var db=require(_0x444d('0x2'))['db'];function skipContactsQuery(_0x5a77ed,_0x5da726){var _0x51377d=![];if(_0x5a77ed[_0x444d('0x3')]===_0x444d('0x4')&&!_0x5da726[_0x444d('0x5')]&&!_0x5da726[_0x444d('0x6')]&&_0x5da726[_0x444d('0x7')]!==_0x444d('0x8')){_0x51377d=!![];}return _0x51377d;}function getContactsSubquery(){return squel[_0x444d('0x9')]()['from'](_0x444d('0xa'),'c')['where'](_0x444d('0xb'));}function applyJoinClauses(_0xfd355e,_0x87d3e8){var _0x3982b2=_0x87d3e8?'c':_0x444d('0xc');_0xfd355e[_0x444d('0xd')](_0x444d('0xe'),'uc',_0x444d('0xf')+_0x3982b2+_0x444d('0x10'))[_0x444d('0xd')](_0x444d('0x11'),'ct','ct.CmContactId\x20=\x20'+_0x3982b2+_0x444d('0x10'))[_0x444d('0xd')]('tools_tags','t',_0x444d('0x12'));return _0xfd355e;}function addFieldsToQuery(_0x3a2d03,_0x2807fb,_0x488ef6,_0x3382a4,_0x41b794){var _0x390231=_0x41b794?'c':'subqry';if(!_0x2807fb){_0x2807fb=['id',_0x444d('0x13'),'lastName',_0x444d('0x14'),_0x444d('0x15'),_0x444d('0x16'),_0x444d('0x17'),'ListId','CompanyId','createdAt','updatedAt',_0x444d('0x18'),_0x444d('0x19')];}var _0x171c35=_0x488ef6&&_0x41b794||!_0x488ef6&&!_0x41b794;if(_0x3382a4){_0x171c35=_0x3382a4&&_0x41b794||!_0x3382a4&&!_0x41b794;}_0x2807fb['forEach'](function(_0x54e12a){if(_0x54e12a===_0x444d('0x19')){if(_0x171c35){_0x3a2d03[_0x444d('0x1a')](_0x444d('0x1b'),_0x54e12a);}else if(_0x488ef6||_0x3382a4){_0x3a2d03[_0x444d('0x1a')](_0x390231+'.'+_0x54e12a);}}else{_0x3a2d03[_0x444d('0x1a')](_0x390231+'.'+_0x54e12a);}});return _0x3a2d03;}function getSqlClauses(){var _0x4bbcd1={'default':squel[_0x444d('0x1c')](),'fields':squel[_0x444d('0x1c')](),'filter':squel[_0x444d('0x1c')](),'tags':{'clause':squel[_0x444d('0x1c')](),'ids':null},'user':{'clause':squel[_0x444d('0x1c')](),'skip':![]}};return _0x4bbcd1;}function parseTagParameter(_0x25e6ae){var _0x3365ae=squel['expr']();if(_0x25e6ae){var _0x5e071f=utils[_0x444d('0x1d')](_0x25e6ae);_0x5e071f['forEach'](function(_0x4dd652){_0x3365ae['or'](_0x444d('0x1e'),'%,'+_0x4dd652+',%');});}return _0x3365ae;}function parseSearchFilter(_0x11563d){var _0x546a9f=squel['expr']();if(_0x11563d){var _0x17cc83=_0x11563d[_0x444d('0x1f')]('\x5c','\x5c\x5c')[_0x444d('0x1f')](/'/g,'\x27\x27');if(_0x17cc83[_0x444d('0x20')]('\x20')[_0x444d('0x21')]>0x1){_0x546a9f['or'](_0x444d('0x22'),qs[_0x444d('0x23')](_0x17cc83),null);}else{if(qs[_0x444d('0x24')](_0x17cc83)){_0x546a9f['or'](_0x444d('0x25'),_0x17cc83+'%');_0x546a9f['or']('c.phone\x20LIKE\x20?',_0x17cc83+'%');_0x546a9f['or']('c.mobile\x20LIKE\x20?',_0x17cc83+'%');_0x546a9f['or'](_0x444d('0x26'),_0x17cc83+'%');}else if(qs['isEmail'](_0x17cc83)){_0x546a9f['or']('c.email\x20LIKE\x20?',_0x17cc83+'%');}else{_0x546a9f['or'](_0x444d('0x27'),'%'+_0x17cc83+'%');_0x546a9f['or']('c.lastName\x20LIKE\x20?','%'+_0x17cc83+'%');_0x546a9f['or'](_0x444d('0x28'),'%'+_0x17cc83+'%');}}}return _0x546a9f;}function parseAdvancedSearchFilter(_0x197e30,_0x5eaf02){var _0x1f6a96=getSqlClauses();var _0x262fd2=as[_0x444d('0x29')](_0x197e30);var _0xea2b0b=_0x262fd2['sqlOperator'];for(var _0x24ec2e=0x0;_0x24ec2e<_0x262fd2['conditions'][_0x444d('0x21')];_0x24ec2e++){var _0x4a2930=_0x262fd2[_0x444d('0x2a')][_0x24ec2e];var _0xa8aadc='c';var _0x2dfad8=_[_0x444d('0x2b')](_0x5eaf02,[_0x444d('0x2c'),_0x4a2930['field']]);if(_0x2dfad8){if(_0x4a2930[_0x444d('0x1a')]===_0x444d('0x2d')||_0x2dfad8[_0x444d('0x2e')]===_0x444d('0x2f')){_0x4a2930[_0x444d('0x30')]=_0x444d('0x31');}var _0x428155=as[_0x444d('0x32')](_0xa8aadc,_0x2dfad8[_0x444d('0x33')],_0x4a2930);_0x1f6a96['default'][_0xea2b0b](_0x428155['text'],_0x428155[_0x444d('0x34')][_0x444d('0x35')],_0x428155['value'][_0x444d('0x36')]);}else{if(_0x4a2930[_0x444d('0x1a')]===_0x444d('0x37')){var _0x3dd359=_0x4a2930[_0x444d('0x34')]['split'](',')['map'](function(_0x586d83){return Number(_0x586d83);});var _0xedc655=parseTagParameter(_0x3dd359);_0x1f6a96[_0x444d('0x38')]['clause'][_0x444d('0x39')](_0xedc655);_0x1f6a96['tags'][_0x444d('0x3a')]=_0x3dd359;}else if(_0x4a2930[_0x444d('0x1a')]===_0x444d('0x3b')){_0x1f6a96[_0x444d('0x3c')][_0x444d('0x3d')]['and']('uc.UserId\x20=\x20?',_0x4a2930[_0x444d('0x34')]);_0x1f6a96[_0x444d('0x3c')][_0x444d('0x3e')]=!![];}}}return _0x1f6a96;}function parseModelFields(_0x2297d3,_0x226e8e){var _0x1e459a=squel[_0x444d('0x1c')]();var _0x4d61af=_(_0x2297d3)[_0x444d('0x3f')]()[_0x444d('0x40')](function(_0x58dc9d){return _['some'](_0x226e8e,[_0x444d('0x2c'),_0x58dc9d])?_0x58dc9d:undefined;})[_0x444d('0x41')]()['value']();if(_0x2297d3[_0x444d('0x42')]){_0x4d61af[_0x444d('0x43')](_0x444d('0x42'));}if(_0x4d61af[_0x444d('0x21')]>0x0){_0x4d61af['forEach'](function(_0x4c2d45){if(_0x4c2d45==='ListId'){_0x1e459a[_0x444d('0x39')]('c.ListId\x20IN\x20?',[][_0x444d('0x44')](_0x2297d3[_0x4c2d45]));}else if(_0x4c2d45===_0x444d('0x42')){var _0x4cae30='%'+_0x2297d3[_0x4c2d45]+'%';_0x1e459a[_0x444d('0x39')](_0x444d('0x45'),_0x4cae30);}else{_0x1e459a['and']('c.'+_0x4c2d45+_0x444d('0x46'),_0x2297d3[_0x4c2d45]);}});}return _0x1e459a;}function parseQueryParameters(_0x2fec67,_0xd6dab0){var _0x2fa717=getSqlClauses();return Promise[_0x444d('0x47')]()[_0x444d('0x48')](function(){return parseModelFields(_0x2fec67,_0xd6dab0);})[_0x444d('0x48')](function(_0xc73730){_0x2fa717['fields']['and'](_0xc73730);return parseTagParameter(_0x2fec67['tag']);})[_0x444d('0x48')](function(_0x1e1585){_0x2fa717[_0x444d('0x38')][_0x444d('0x3d')]['and'](_0x1e1585);return parseSearchFilter(_0x2fec67[_0x444d('0x49')]);})[_0x444d('0x48')](function(_0x852d09){_0x2fa717['filter']=_0x852d09;return _0x2fa717;});}function checkListsRestrictions(_0x183f5b,_0x4d86a5,_0x29ecae){var _0x5ffa03=squel[_0x444d('0x1c')]();return Promise[_0x444d('0x47')]()['then'](function(){if(_0x4d86a5[_0x444d('0x5')]&&_0x183f5b[_0x444d('0x3')]===_0x444d('0x4')&&!_0x29ecae){return _0x183f5b[_0x444d('0x4a')]({'attributes':['id'],'raw':!![]});}})[_0x444d('0x48')](function(_0x1c8828){if(_0x1c8828){if(_0x1c8828[_0x444d('0x21')]===0x0){_0x5ffa03[_0x444d('0x39')](_0x444d('0x4b'));}else{_0x5ffa03[_0x444d('0x39')](_0x444d('0x4c'),_[_0x444d('0x40')](_0x1c8828,'id'));}}})[_0x444d('0x48')](function(){return _0x5ffa03;});}function buildContactsQuery(_0x7687bc,_0x278dc1,_0x20a00c,_0x44ef12,_0x52a27b,_0x4899f8){if(_0x278dc1){_0x278dc1=_0x20a00c[_0x444d('0x4d')];}_0x7687bc=addFieldsToQuery(_0x7687bc,_0x278dc1,_0x44ef12,_0x4899f8,!![]);var _0x2014d8=squel[_0x444d('0x9')]();_0x2014d8=addFieldsToQuery(_0x2014d8,_0x278dc1,_0x44ef12,_0x4899f8,![]);if(_0x44ef12||_0x4899f8){_0x7687bc=applyJoinClauses(_0x7687bc,!![]);_0x7687bc['group']('c.id');if(_0x20a00c['limit']){_0x2014d8[_0x444d('0x4e')](_0x20a00c[_0x444d('0x4e')]);}if(_0x20a00c[_0x444d('0x4f')]){_0x2014d8[_0x444d('0x4f')](_0x20a00c[_0x444d('0x4f')]);}}else{_0x2014d8=applyJoinClauses(_0x2014d8,![]);_0x2014d8[_0x444d('0x50')](_0x444d('0x51'));if(_0x20a00c[_0x444d('0x4e')]){_0x7687bc[_0x444d('0x4e')](_0x20a00c[_0x444d('0x4e')]);}if(_0x20a00c[_0x444d('0x4f')]){_0x7687bc[_0x444d('0x4f')](_0x20a00c['offset']);}}_0x2014d8[_0x444d('0x52')](_0x52a27b);if(_0x20a00c['order']){_0x20a00c[_0x444d('0x53')][_0x444d('0x54')](function(_0x579de1){_0x7687bc[_0x444d('0x53')]('c.'+_0x579de1[0x0],_0x579de1[0x1]===_0x444d('0x55')?![]:!![]);_0x2014d8[_0x444d('0x53')]('subqry.'+_0x579de1[0x0],_0x579de1[0x1]==='DESC'?![]:!![]);});}_0x2014d8[_0x444d('0x56')](_0x7687bc,_0x444d('0xc'));return _0x2014d8;}function getFilteredContacts(_0x2b3525){var _0x4c3962=[];return db[_0x444d('0x37')][_0x444d('0x57')]({'attributes':['id',_0x444d('0x2c'),_0x444d('0x58')],'raw':!![]})[_0x444d('0x48')](function(_0x172a8a){_0x4c3962=_['keyBy'](_0x172a8a,'id');var _0x37a11a={'type':db['Sequelize']['QueryTypes'][_0x444d('0x59')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x444d('0x5a')][_0x444d('0x5b')](_0x2b3525[_0x444d('0x5c')](),_0x37a11a);})[_0x444d('0x48')](function(_0x57d76e){_0x57d76e[_0x444d('0x54')](function(_0xb32756){if(_0xb32756[_0x444d('0x19')]){_0xb32756[_0x444d('0x5d')]=[];_0xb32756[_0x444d('0x19')][_0x444d('0x20')](',')[_0x444d('0x54')](function(_0x4905a0){_0xb32756[_0x444d('0x5d')][_0x444d('0x43')](_0x4c3962[_0x4905a0]);});}delete _0xb32756['TagIds'];});return _0x57d76e;});}function countFilteredContacts(_0xacaabe,_0x5d518d){var _0x562ac0=_0xacaabe[_0x444d('0x5e')]();_0x562ac0['field'](_0x444d('0x5f'));_0x562ac0=applyJoinClauses(_0x562ac0,!![]);_0xacaabe[_0x444d('0x50')](_0x444d('0x60'));var _0x1d2803=utils['getSelectedTags'](_0x5d518d);if(!_[_0x444d('0x61')](_0x1d2803)){_0x562ac0['where']('t.id\x20IN\x20?',_0x1d2803);}var _0x13fc76={'type':db[_0x444d('0x62')][_0x444d('0x63')][_0x444d('0x59')],'raw':!![]};return db[_0x444d('0x5a')][_0x444d('0x5b')](_0x562ac0[_0x444d('0x5c')](),_0x13fc76)['then'](function(_0x315916){return _0x315916[0x0][_0x444d('0x5f')];});}module[_0x444d('0x64')]={'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 d66f33d..172cd8f 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 _0xb992=['createWriteStream','createCipher','data','update','binary','write','final','end','unlink','decryptFile','createReadStream','createDecipher','close','secret','utf8','base64','decryptString','crypto','lodash','app','session','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile'];(function(_0x2fc11d,_0x2597d9){var _0x468cf0=function(_0x7a8532){while(--_0x7a8532){_0x2fc11d['push'](_0x2fc11d['shift']());}};_0x468cf0(++_0x2597d9);}(_0xb992,0xb1));var _0x2b99=function(_0x5f376f,_0x2be271){_0x5f376f=_0x5f376f-0x0;var _0x2a403f=_0xb992[_0x5f376f];return _0x2a403f;};'use strict';var crypto=require(_0x2b99('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x2b99('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x2b99('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x2b99('0x3')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x2b99('0x4')};if(config[_0x2b99('0x5')]&&config[_0x2b99('0x5')][_0x2b99('0x6')]){var isSupported=isAlgorithmSupported(config[_0x2b99('0x5')][_0x2b99('0x6')]);if(isSupported){fileOptions[_0x2b99('0x6')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2b99('0x7')](',\x20');logger['error'](config[_0x2b99('0x5')][_0x2b99('0x6')],_0x2b99('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x255a43){return AES_SUPPORTED_RX[_0x2b99('0x9')](_0x255a43);}function getSupportedCiphers(){return crypto[_0x2b99('0xa')]()[_0x2b99('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x12326a){return getSupportedCiphers()[_0x2b99('0xc')](_0x12326a)>-0x1;}function combineOptions(_0x112384){var _0x11a6a4={};for(var _0x1657a4 in fileOptions){if(fileOptions[_0x2b99('0xd')](_0x1657a4)){_0x11a6a4[_0x1657a4]=fileOptions[_0x1657a4];}}if(_0x112384){for(var _0xfbecc5 in _0x112384){if(_0x112384[_0x2b99('0xd')](_0xfbecc5)){_0x11a6a4[_0xfbecc5]=_0x112384[_0xfbecc5];}}}return _0x11a6a4;}exports[_0x2b99('0xe')]=function(_0x4256d1,_0x45b158,_0x5bcc8b,_0x136dc3){return new BPromise(function(_0x18a986,_0x52dd86){_0x136dc3=combineOptions(_0x136dc3);var _0x568e09=new Buffer(_0x5bcc8b);var _0x12b751=fs['createReadStream'](_0x4256d1);var _0x5db098=fs[_0x2b99('0xf')](_0x45b158);var _0x425561=crypto[_0x2b99('0x10')](_0x136dc3[_0x2b99('0x6')],_0x568e09);_0x12b751['on'](_0x2b99('0x11'),function(_0x3401fe){var _0x4c477e=new Buffer(_0x425561[_0x2b99('0x12')](_0x3401fe),_0x2b99('0x13'));_0x5db098[_0x2b99('0x14')](_0x4c477e);});_0x12b751['on']('end',function(){try{var _0x31522a=new Buffer(_0x425561[_0x2b99('0x15')](_0x2b99('0x13')),'binary');_0x5db098[_0x2b99('0x14')](_0x31522a);_0x5db098[_0x2b99('0x16')]();_0x5db098['on']('close',function(){return _0x18a986(_0x45b158);});}catch(_0x4e0ebf){fs[_0x2b99('0x17')](_0x45b158);return _0x52dd86(_0x4e0ebf);}});});};exports[_0x2b99('0x18')]=function(_0x4fda97,_0x441747,_0x4db23f,_0x560ed8){return new BPromise(function(_0x553ef4,_0xec4d0d){_0x560ed8=combineOptions(_0x560ed8);var _0x2b34e9=new Buffer(_0x4db23f);var _0x5e534a=fs[_0x2b99('0x19')](_0x4fda97);var _0x44755c=fs['createWriteStream'](_0x441747);var _0x4a166e=crypto[_0x2b99('0x1a')](_0x560ed8['algorithm'],_0x2b34e9);_0x5e534a['on'](_0x2b99('0x11'),function(_0x995e5d){var _0x26dbe2=new Buffer(_0x4a166e[_0x2b99('0x12')](_0x995e5d),_0x2b99('0x13'));_0x44755c[_0x2b99('0x14')](_0x26dbe2);});_0x5e534a['on'](_0x2b99('0x16'),function(){try{var _0x51ecad=new Buffer(_0x4a166e[_0x2b99('0x15')]('binary'),_0x2b99('0x13'));_0x44755c[_0x2b99('0x14')](_0x51ecad);_0x44755c[_0x2b99('0x16')]();_0x44755c['on'](_0x2b99('0x1b'),function(){return _0x553ef4(_0x441747);});}catch(_0x48e82d){fs[_0x2b99('0x17')](_0x441747);return _0xec4d0d(_0x48e82d);}});});};exports['encryptString']=function(_0x4dd740,_0x3f7308,_0x441b85){var _0x3112b2=_0x441b85||stringOptions[_0x2b99('0x6')];var _0x39d522=_0x3f7308||stringOptions[_0x2b99('0x1c')];var _0x211451=crypto[_0x2b99('0x10')](_0x3112b2,_0x39d522);var _0x1e3f5f=_0x211451[_0x2b99('0x12')](_0x4dd740,_0x2b99('0x1d'),_0x2b99('0x1e'));_0x1e3f5f+=_0x211451[_0x2b99('0x15')](_0x2b99('0x1e'));return _0x1e3f5f;};exports[_0x2b99('0x1f')]=function(_0x50ce42,_0x141e04,_0x310188){var _0x2033be=_0x310188||stringOptions[_0x2b99('0x6')];var _0x11498d=_0x141e04||stringOptions[_0x2b99('0x1c')];var _0x3c2a1b=crypto['createDecipher'](_0x2033be,_0x11498d);var _0x49025b=_0x3c2a1b[_0x2b99('0x12')](_0x50ce42,_0x2b99('0x1e'),_0x2b99('0x1d'));_0x49025b+=_0x3c2a1b['final'](_0x2b99('0x1d'));return _0x49025b;}; \ No newline at end of file +var _0x1acb=['createCipher','utf8','base64','secret','crypto','bluebird','lodash','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','hasOwnProperty','encryptFile','data','binary','write','final','end','close','decryptFile','createReadStream','createWriteStream','createDecipher','update','unlink','encryptString'];(function(_0x1f1e5f,_0x376859){var _0x13b7ea=function(_0x27aa70){while(--_0x27aa70){_0x1f1e5f['push'](_0x1f1e5f['shift']());}};_0x13b7ea(++_0x376859);}(_0x1acb,0x1b1));var _0xb1ac=function(_0x2b5f19,_0x3ac009){_0x2b5f19=_0x2b5f19-0x0;var _0x1b42c5=_0x1acb[_0x2b5f19];return _0x1b42c5;};'use strict';var crypto=require(_0xb1ac('0x0'));var fs=require('fs');var BPromise=require(_0xb1ac('0x1'));var _=require(_0xb1ac('0x2'));var config=require('../../config/environment');var logger=require(_0xb1ac('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xb1ac('0x4')][_0xb1ac('0x5')],'algorithm':_0xb1ac('0x6')};const fileOptions={'algorithm':_0xb1ac('0x7')};if(config[_0xb1ac('0x8')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0xb1ac('0x8')][_0xb1ac('0x9')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0xb1ac('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb1ac('0xa')](',\x20');logger[_0xb1ac('0xb')](config['encrypt'][_0xb1ac('0x9')],_0xb1ac('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x42a423){return AES_SUPPORTED_RX['test'](_0x42a423);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xb1ac('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x61e5d5){return getSupportedCiphers()['indexOf'](_0x61e5d5)>-0x1;}function combineOptions(_0x524356){var _0x3d7ef7={};for(var _0x249b80 in fileOptions){if(fileOptions[_0xb1ac('0xe')](_0x249b80)){_0x3d7ef7[_0x249b80]=fileOptions[_0x249b80];}}if(_0x524356){for(var _0x22b89b in _0x524356){if(_0x524356[_0xb1ac('0xe')](_0x22b89b)){_0x3d7ef7[_0x22b89b]=_0x524356[_0x22b89b];}}}return _0x3d7ef7;}exports[_0xb1ac('0xf')]=function(_0x869805,_0x488f05,_0x325874,_0x2464d2){return new BPromise(function(_0x430873,_0x454d4f){_0x2464d2=combineOptions(_0x2464d2);var _0x85d814=new Buffer(_0x325874);var _0x3b24d5=fs['createReadStream'](_0x869805);var _0x12074a=fs['createWriteStream'](_0x488f05);var _0x1e07fd=crypto['createCipher'](_0x2464d2[_0xb1ac('0x9')],_0x85d814);_0x3b24d5['on'](_0xb1ac('0x10'),function(_0x10236f){var _0x1b8b72=new Buffer(_0x1e07fd['update'](_0x10236f),_0xb1ac('0x11'));_0x12074a[_0xb1ac('0x12')](_0x1b8b72);});_0x3b24d5['on']('end',function(){try{var _0x4ccefe=new Buffer(_0x1e07fd[_0xb1ac('0x13')]('binary'),_0xb1ac('0x11'));_0x12074a[_0xb1ac('0x12')](_0x4ccefe);_0x12074a[_0xb1ac('0x14')]();_0x12074a['on'](_0xb1ac('0x15'),function(){return _0x430873(_0x488f05);});}catch(_0x2f7444){fs['unlink'](_0x488f05);return _0x454d4f(_0x2f7444);}});});};exports[_0xb1ac('0x16')]=function(_0x157152,_0x290c4c,_0x8c9666,_0x2070f6){return new BPromise(function(_0x21fcd3,_0x346434){_0x2070f6=combineOptions(_0x2070f6);var _0x1d79de=new Buffer(_0x8c9666);var _0x4b9484=fs[_0xb1ac('0x17')](_0x157152);var _0x40cda5=fs[_0xb1ac('0x18')](_0x290c4c);var _0x49345f=crypto[_0xb1ac('0x19')](_0x2070f6[_0xb1ac('0x9')],_0x1d79de);_0x4b9484['on'](_0xb1ac('0x10'),function(_0x24710a){var _0x435fc1=new Buffer(_0x49345f[_0xb1ac('0x1a')](_0x24710a),'binary');_0x40cda5[_0xb1ac('0x12')](_0x435fc1);});_0x4b9484['on'](_0xb1ac('0x14'),function(){try{var _0x438edf=new Buffer(_0x49345f[_0xb1ac('0x13')](_0xb1ac('0x11')),_0xb1ac('0x11'));_0x40cda5[_0xb1ac('0x12')](_0x438edf);_0x40cda5[_0xb1ac('0x14')]();_0x40cda5['on'](_0xb1ac('0x15'),function(){return _0x21fcd3(_0x290c4c);});}catch(_0x4ece25){fs[_0xb1ac('0x1b')](_0x290c4c);return _0x346434(_0x4ece25);}});});};exports[_0xb1ac('0x1c')]=function(_0x4c45a7,_0x2a2473,_0x17256c){var _0x3931c9=_0x17256c||stringOptions[_0xb1ac('0x9')];var _0x45ca3b=_0x2a2473||stringOptions['secret'];var _0x59bc2d=crypto[_0xb1ac('0x1d')](_0x3931c9,_0x45ca3b);var _0x1814b0=_0x59bc2d[_0xb1ac('0x1a')](_0x4c45a7,_0xb1ac('0x1e'),_0xb1ac('0x1f'));_0x1814b0+=_0x59bc2d[_0xb1ac('0x13')](_0xb1ac('0x1f'));return _0x1814b0;};exports['decryptString']=function(_0x20112d,_0xad8b1b,_0x26a419){var _0x35f8fc=_0x26a419||stringOptions[_0xb1ac('0x9')];var _0x51dff2=_0xad8b1b||stringOptions[_0xb1ac('0x20')];var _0x2b6cf8=crypto[_0xb1ac('0x19')](_0x35f8fc,_0x51dff2);var _0x2734d8=_0x2b6cf8[_0xb1ac('0x1a')](_0x20112d,_0xb1ac('0x1f'),_0xb1ac('0x1e'));_0x2734d8+=_0x2b6cf8[_0xb1ac('0x13')](_0xb1ac('0x1e'));return _0x2734d8;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index fb2f4e2..5749f13 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 _0x6d2a=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','info','Completed','zip','inspect','Failed','finally','exit','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','query'];(function(_0x9e3086,_0x22e738){var _0x9db120=function(_0x1a2cfe){while(--_0x1a2cfe){_0x9e3086['push'](_0x9e3086['shift']());}};_0x9db120(++_0x22e738);}(_0x6d2a,0x184));var _0xa6d2=function(_0x559233,_0x4f4408){_0x559233=_0x559233-0x0;var _0x1a9acb=_0x6d2a[_0x559233];return _0x1a9acb;};'use strict';var util=require('util');var path=require(_0xa6d2('0x0'));var _=require(_0xa6d2('0x1'));var csv=require(_0xa6d2('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xa6d2('0x3'));var rimraf=require(_0xa6d2('0x4'));var db=require(_0xa6d2('0x5'))['db'];var dbH=require('../../mysqldb')[_0xa6d2('0x6')];var logger=require(_0xa6d2('0x7'))(_0xa6d2('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xa6d2('0x9')][0x2]);var QUERY=process[_0xa6d2('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2731d6,_0x50190f){var _0x429f38={'status':_0x2731d6};var _0x53e0c9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50190f){_0x429f38[_0xa6d2('0xa')]=_0x50190f;}return db['AnalyticExtractedReport'][_0xa6d2('0xb')](_0x429f38,_0x53e0c9);}function main(){var _0x552ffc=0x1388;var _0x2d8e8e;logger['info'](util[_0xa6d2('0xc')](_0xa6d2('0xd'),EXTRACTED_REPORT_ID,_0xa6d2('0xe')));return db[_0xa6d2('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa6d2('0x10'),_0xa6d2('0x11')]})[_0xa6d2('0x12')](function(_0x34ae71){if(_0x34ae71){_0x2d8e8e=_0x34ae71;_0x552ffc=_0x2d8e8e[_0xa6d2('0x11')]||0x1388;}})[_0xa6d2('0x12')](function(){return dbH['sequelize'][_0xa6d2('0x13')](util[_0xa6d2('0xc')](_0xa6d2('0x14'),QUERY),{'type':dbH[_0xa6d2('0x15')]['QueryTypes'][_0xa6d2('0x16')]});})[_0xa6d2('0x12')](function(_0x58f3d4){if(!_0x58f3d4[0x0][_0xa6d2('0x17')]){return analyticExtractedReport(_0xa6d2('0x18'));}var _0x43eacb=[];var _0x5a8d1f=0x0;if(_0x2d8e8e['split']){if(_0x58f3d4&&_0x58f3d4[_0xa6d2('0x19')]){var _0x10741f=_[_0xa6d2('0x1a')](_0x58f3d4[0x0][_0xa6d2('0x17')]/_0x552ffc);var _0x5df963=Number[_0xa6d2('0x1b')](_0x58f3d4[0x0]['num']/_0x552ffc)?_0x58f3d4[0x0][_0xa6d2('0x17')]%_0x552ffc:0x0;_0x10741f[_0xa6d2('0x1c')](function(_0x1cd6dd){if(_0x1cd6dd>0x0){_0x5a8d1f+=_0x552ffc;}_0x43eacb[_0xa6d2('0x1d')](dbH[_0xa6d2('0x15')][_0xa6d2('0x13')](util['format'](_0xa6d2('0x1e'),QUERY,_0x552ffc,_0x5a8d1f),{'type':dbH[_0xa6d2('0x15')][_0xa6d2('0x1f')][_0xa6d2('0x16')]}));});if(_0x5df963>0x0){_0x5a8d1f+=_0x552ffc;_0x43eacb['push'](dbH[_0xa6d2('0x15')][_0xa6d2('0x13')](util[_0xa6d2('0xc')](_0xa6d2('0x1e'),QUERY,_0x5df963,_0x5a8d1f),{'type':dbH[_0xa6d2('0x15')][_0xa6d2('0x1f')][_0xa6d2('0x16')]}));}}}else{_0x43eacb['push'](dbH[_0xa6d2('0x15')][_0xa6d2('0x13')](QUERY,{'type':dbH[_0xa6d2('0x15')][_0xa6d2('0x1f')][_0xa6d2('0x16')]}));}var _0x1cfeea=path[_0xa6d2('0x20')](PATH);var _0x2f7d95=path[_0xa6d2('0x21')](PATH,_0xa6d2('0x22'));var _0x1eadfc=_0x2d8e8e[_0xa6d2('0x10')]&&_0x43eacb['length']>0x1;var _0x3657ce=[];if(!fs[_0xa6d2('0x23')](path[_0xa6d2('0x24')](_0x1cfeea,_0x2f7d95))&&_0x1eadfc){fs[_0xa6d2('0x25')](path[_0xa6d2('0x24')](_0x1cfeea,_0x2f7d95));}return BPromise[_0xa6d2('0x26')](_0x43eacb,function(_0x4b7cf9){_0x3657ce[_0xa6d2('0x1d')](_0x4b7cf9);})[_0xa6d2('0x12')](function(){for(var _0x3ef37e=0x0;_0x3ef37e<_0x3657ce[_0xa6d2('0x19')];_0x3ef37e+=0x1){var _0x2ffb90;var _0xa25f07=_0x3657ce[_0x3ef37e];if(_0x1eadfc){_0x2ffb90=path['join'](_0x1cfeea,_0x2f7d95,util['format'](_0xa6d2('0x27'),_0x2f7d95,_0x3ef37e,_0xa6d2('0x28')));}else{_0x2ffb90=path[_0xa6d2('0x24')](_0x1cfeea,util[_0xa6d2('0xc')](_0xa6d2('0x29'),_0x2f7d95,'csv'));}fs[_0xa6d2('0x2a')](_0x2ffb90,csv(_0xa25f07));}})[_0xa6d2('0x12')](function(){if(_0x1eadfc){return new Promise(function(_0x3345f4){zipdir(path[_0xa6d2('0x24')](_0x1cfeea,_0x2f7d95),{'saveTo':path[_0xa6d2('0x24')](_0x1cfeea,util[_0xa6d2('0xc')]('%s.%s',_0x2f7d95,'zip'))},function(_0x84ef2,_0x1e246c){rimraf(path[_0xa6d2('0x24')](_0x1cfeea,_0x2f7d95),function(){});_0x3345f4(_0xa6d2('0x2b'));});});}})[_0xa6d2('0x12')](function(){logger[_0xa6d2('0x2c')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa6d2('0xe')));return analyticExtractedReport(_0xa6d2('0x2d'),_0x1eadfc?util[_0xa6d2('0xc')](_0xa6d2('0x29'),_0x2f7d95,_0x1eadfc?_0xa6d2('0x2e'):_0xa6d2('0x28')):null);});})['catch'](function(_0x23b13b){logger[_0xa6d2('0x2c')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa6d2('0xe')),util[_0xa6d2('0x2f')](_0x23b13b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa6d2('0x30'));})[_0xa6d2('0x31')](function(){process[_0xa6d2('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe945=['push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','length','range','isInteger','forEach'];(function(_0x30067d,_0x20b6e8){var _0x8495cf=function(_0x478cd4){while(--_0x478cd4){_0x30067d['push'](_0x30067d['shift']());}};_0x8495cf(++_0x20b6e8);}(_0xe945,0xa9));var _0x5e94=function(_0x156187,_0x353a03){_0x156187=_0x156187-0x0;var _0x15d0f6=_0xe945[_0x156187];return _0x15d0f6;};'use strict';var util=require('util');var path=require(_0x5e94('0x0'));var _=require(_0x5e94('0x1'));var csv=require(_0x5e94('0x2'));var fs=require('fs');var BPromise=require(_0x5e94('0x3'));var zipdir=require(_0x5e94('0x4'));var rimraf=require(_0x5e94('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5e94('0x6'))['dbH'];var logger=require('../../config/logger')(_0x5e94('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x5e94('0x8')][0x2]);var QUERY=process[_0x5e94('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2a435b,_0x5ddc5b){var _0x16ed87={'status':_0x2a435b};var _0xee933a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ddc5b){_0x16ed87[_0x5e94('0x9')]=_0x5ddc5b;}return db['AnalyticExtractedReport']['update'](_0x16ed87,_0xee933a);}function main(){var _0x512ce9=0x1388;var _0x57a97f;logger[_0x5e94('0xa')](util[_0x5e94('0xb')](_0x5e94('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x5e94('0xd')][_0x5e94('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5e94('0xf'),_0x5e94('0x10')]})[_0x5e94('0x11')](function(_0x1c3a85){if(_0x1c3a85){_0x57a97f=_0x1c3a85;_0x512ce9=_0x57a97f[_0x5e94('0x10')]||0x1388;}})[_0x5e94('0x11')](function(){return dbH[_0x5e94('0x12')][_0x5e94('0x13')](util['format'](_0x5e94('0x14'),QUERY),{'type':dbH[_0x5e94('0x12')]['QueryTypes'][_0x5e94('0x15')]});})['then'](function(_0x44932f){if(!_0x44932f[0x0][_0x5e94('0x16')]){return analyticExtractedReport('Empty');}var _0x3312f1=[];var _0x404b24=0x0;if(_0x57a97f[_0x5e94('0xf')]){if(_0x44932f&&_0x44932f[_0x5e94('0x17')]){var _0x538e71=_[_0x5e94('0x18')](_0x44932f[0x0][_0x5e94('0x16')]/_0x512ce9);var _0x3965e4=Number[_0x5e94('0x19')](_0x44932f[0x0][_0x5e94('0x16')]/_0x512ce9)?_0x44932f[0x0][_0x5e94('0x16')]%_0x512ce9:0x0;_0x538e71[_0x5e94('0x1a')](function(_0x2a1f05){if(_0x2a1f05>0x0){_0x404b24+=_0x512ce9;}_0x3312f1[_0x5e94('0x1b')](dbH[_0x5e94('0x12')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x512ce9,_0x404b24),{'type':dbH['sequelize']['QueryTypes'][_0x5e94('0x15')]}));});if(_0x3965e4>0x0){_0x404b24+=_0x512ce9;_0x3312f1['push'](dbH[_0x5e94('0x12')]['query'](util[_0x5e94('0xb')](_0x5e94('0x1c'),QUERY,_0x3965e4,_0x404b24),{'type':dbH[_0x5e94('0x12')][_0x5e94('0x1d')]['SELECT']}));}}}else{_0x3312f1[_0x5e94('0x1b')](dbH[_0x5e94('0x12')][_0x5e94('0x13')](QUERY,{'type':dbH[_0x5e94('0x12')][_0x5e94('0x1d')][_0x5e94('0x15')]}));}var _0x3d9252=path[_0x5e94('0x1e')](PATH);var _0x10d611=path['basename'](PATH,_0x5e94('0x1f'));var _0xa29394=_0x57a97f[_0x5e94('0xf')]&&_0x3312f1[_0x5e94('0x17')]>0x1;var _0x9338f4=[];if(!fs[_0x5e94('0x20')](path['join'](_0x3d9252,_0x10d611))&&_0xa29394){fs[_0x5e94('0x21')](path[_0x5e94('0x22')](_0x3d9252,_0x10d611));}return BPromise[_0x5e94('0x23')](_0x3312f1,function(_0x1722b3){_0x9338f4[_0x5e94('0x1b')](_0x1722b3);})[_0x5e94('0x11')](function(){for(var _0x450fd2=0x0;_0x450fd2<_0x9338f4['length'];_0x450fd2+=0x1){var _0x1460a9;var _0x461ba7=_0x9338f4[_0x450fd2];if(_0xa29394){_0x1460a9=path['join'](_0x3d9252,_0x10d611,util[_0x5e94('0xb')](_0x5e94('0x24'),_0x10d611,_0x450fd2,_0x5e94('0x25')));}else{_0x1460a9=path[_0x5e94('0x22')](_0x3d9252,util[_0x5e94('0xb')](_0x5e94('0x26'),_0x10d611,_0x5e94('0x25')));}fs[_0x5e94('0x27')](_0x1460a9,csv(_0x461ba7));}})[_0x5e94('0x11')](function(){if(_0xa29394){return new Promise(function(_0x49d58d){zipdir(path[_0x5e94('0x22')](_0x3d9252,_0x10d611),{'saveTo':path[_0x5e94('0x22')](_0x3d9252,util[_0x5e94('0xb')](_0x5e94('0x26'),_0x10d611,_0x5e94('0x28')))},function(_0x384f0a,_0x42b111){rimraf(path[_0x5e94('0x22')](_0x3d9252,_0x10d611),function(){});_0x49d58d(_0x5e94('0x29'));});});}})['then'](function(){logger[_0x5e94('0xa')](util[_0x5e94('0xb')](_0x5e94('0x2a'),EXTRACTED_REPORT_ID,_0x5e94('0x2b')));return analyticExtractedReport(_0x5e94('0x2c'),_0xa29394?util[_0x5e94('0xb')](_0x5e94('0x26'),_0x10d611,_0xa29394?_0x5e94('0x28'):_0x5e94('0x25')):null);});})['catch'](function(_0x2aad91){logger[_0x5e94('0xa')](util[_0x5e94('0xb')](_0x5e94('0x2d'),EXTRACTED_REPORT_ID,_0x5e94('0x2b')),util[_0x5e94('0x2e')](_0x2aad91,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5e94('0x2f'));})['finally'](function(){process[_0x5e94('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 63326df..eca95aa 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 _0xd2ce=['endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','then','splitSizePdf','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','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','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','toString','value','fill','length','auto','body','push','concat','keys','format','name','startDate'];(function(_0x38900f,_0x4f168c){var _0x5b2a76=function(_0x1f3978){while(--_0x1f3978){_0x38900f['push'](_0x38900f['shift']());}};_0x5b2a76(++_0x4f168c);}(_0xd2ce,0x1ba));var _0xed2c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd2ce[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xed2c('0x0'));var fs=require('fs');var util=require(_0xed2c('0x1'));var path=require(_0xed2c('0x2'));var moment=require(_0xed2c('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xed2c('0x4'));var zipdir=require(_0xed2c('0x5'));var rimraf=require(_0xed2c('0x6'));var JSDOM=require(_0xed2c('0x7'))[_0xed2c('0x8')];var window=new JSDOM('')[_0xed2c('0x9')];var BPromise=require(_0xed2c('0xa'));var db=require(_0xed2c('0xb'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xed2c('0xc'))(_0xed2c('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xed2c('0xe')][0x2]);var QUERY=process[_0xed2c('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xed2c('0xe')][0x5];var FORMAT=_0xed2c('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xb47236,_0x5ba914){var _0x507c88={'status':_0xb47236};var _0xb80992={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ba914){_0x507c88[_0xed2c('0x10')]=_0x5ba914;}return db[_0xed2c('0x11')][_0xed2c('0x12')](_0x507c88,_0xb80992);}function getHeaders(_0xb9871e){return _['map'](_0xb9871e,function(_0x126523){return{'text':_0x126523,'style':_0xed2c('0x13')};});}function getRows(_0xbc4d8f,_0x3ca89a){return _[_0xed2c('0x14')](_0x3ca89a,function(_0x193f9a){return _(_0x193f9a)['pick'](_0xbc4d8f)['map'](function(_0x396077){return _0x396077?_[_0xed2c('0x15')](_0x396077):'';})[_0xed2c('0x16')]();});}function createTable(_0x17339e,_0xc36589){var _0x1198ad={'widths':_[_0xed2c('0x17')](Array(_0x17339e[_0xed2c('0x18')]),0x91),'heights':function(_0x166a9d){return _0x166a9d===0x0?_0xed2c('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4f1cb1=getHeaders(_0x17339e);_0x1198ad[_0xed2c('0x1a')][_0xed2c('0x1b')](_0x4f1cb1);var _0x52b2d3=getRows(_0x17339e,_0xc36589);_0x1198ad[_0xed2c('0x1a')]=_0x1198ad[_0xed2c('0x1a')][_0xed2c('0x1c')](_0x52b2d3);return _0x1198ad;}function createTables(_0x22de92){var _0x53e083=[];var _0x2d2a20=_['chunk'](Object[_0xed2c('0x1d')](_0x22de92[0x0]),0x5);_0x2d2a20['forEach'](function(_0x543b1b){_0x53e083['push'](createTable(_0x543b1b,_0x22de92));});return _0x53e083;}function getPDFDocDefinition(_0x561a94){var _0x198f23=util[_0xed2c('0x1e')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xed2c('0x1f')],moment(EXTRACTED_REPORT[_0xed2c('0x20')])[_0xed2c('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xed2c('0x21')])[_0xed2c('0x1e')](FORMAT));var _0x4ed8ea=[];for(var _0x1072e9=0x0;_0x1072e9<_0x561a94[_0xed2c('0x18')];_0x1072e9++){var _0x24db4b=[];if(_0x1072e9===0x0){_0x24db4b[_0xed2c('0x1b')]({'text':_0x198f23,'style':_0xed2c('0x22')});}var _0x303d67={'table':_0x561a94[_0x1072e9]};if(_0x1072e9>0x0){_0x303d67[_0xed2c('0x23')]=_0xed2c('0x24');_0x303d67[_0xed2c('0x25')]=[0x0,0x46,0x0,0x0];}_0x24db4b['push'](_0x303d67);_0x4ed8ea[_0xed2c('0x1b')](_0x24db4b);}return{'pageSize':'A4','pageOrientation':_0xed2c('0x26'),'content':_0x4ed8ea,'footer':function(_0x365db7,_0x1f914b){return{'text':_0x365db7[_0xed2c('0x15')]()+_0xed2c('0x27')+_0x1f914b,'style':_0xed2c('0x28')};},'defaultStyle':{'font':_0xed2c('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xed2c('0x2a')},'footer':{'alignment':_0xed2c('0x2b'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4c5acc){var _0x1e6a31=0x1388;var _0x30b537;if(!_0x4c5acc[0x0][_0xed2c('0x2c')]){return analyticExtractedReport(_0xed2c('0x2d'));}return db[_0xed2c('0x2e')][_0xed2c('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xed2c('0x30'),'splitSizePdf']})[_0xed2c('0x31')](function(_0x502c67){if(_0x502c67){_0x30b537=_0x502c67;_0x1e6a31=_0x30b537[_0xed2c('0x32')]||0x3e8;}})['then'](function(){var _0x88e2ec=[];var _0x1af437=0x0;if(_0x30b537[_0xed2c('0x30')]){if(_0x4c5acc&&_0x4c5acc[_0xed2c('0x18')]){var _0x2bf48a=_['range'](_0x4c5acc[0x0]['num']/_0x1e6a31);var _0x5086ff=Number['isInteger'](_0x4c5acc[0x0][_0xed2c('0x2c')]/_0x1e6a31)?_0x4c5acc[0x0][_0xed2c('0x2c')]%_0x1e6a31:0x0;_0x2bf48a[_0xed2c('0x33')](function(_0x18a8f3){if(_0x18a8f3>0x0){_0x1af437+=_0x1e6a31;}_0x88e2ec[_0xed2c('0x1b')](dbH[_0xed2c('0x34')][_0xed2c('0x35')](util[_0xed2c('0x1e')](_0xed2c('0x36'),QUERY,_0x1e6a31,_0x1af437),{'type':dbH['sequelize'][_0xed2c('0x37')]['SELECT']}));});if(_0x5086ff>0x0){_0x1af437+=_0x1e6a31;_0x88e2ec['push'](dbH[_0xed2c('0x34')]['query'](util[_0xed2c('0x1e')](_0xed2c('0x36'),QUERY,_0x5086ff,_0x1af437),{'type':dbH[_0xed2c('0x34')][_0xed2c('0x37')][_0xed2c('0x38')]}));}}}else{_0x88e2ec['push'](dbH[_0xed2c('0x34')]['query'](QUERY,{'type':dbH['sequelize'][_0xed2c('0x37')][_0xed2c('0x38')]}));}var _0x4ac67c=path[_0xed2c('0x39')](PATH);var _0x48b2de=path['basename'](PATH,_0xed2c('0x3a'));var _0x43c40c=_0x30b537['split']&&_0x88e2ec[_0xed2c('0x18')]>0x1;var _0x5afcf1=[];if(!fs['existsSync'](path[_0xed2c('0x3b')](_0x4ac67c,_0x48b2de))&&_0x43c40c){fs[_0xed2c('0x3c')](path[_0xed2c('0x3b')](_0x4ac67c,_0x48b2de));}return BPromise[_0xed2c('0x3d')](_0x88e2ec,function(_0x5c47dd){_0x5afcf1[_0xed2c('0x1b')](_0x5c47dd);})[_0xed2c('0x31')](function(){var _0x45fdd9=[];for(var _0x41cc5c=0x0;_0x41cc5c<_0x5afcf1[_0xed2c('0x18')];_0x41cc5c+=0x1){var _0x4221c9=_0x5afcf1[_0x41cc5c];var _0xb90435=createTables(_[_0xed2c('0x3e')](_0x4221c9));var _0x4d7b13;var _0x5f07a2=getPDFDocDefinition(_0xb90435);var _0x298e67=getPDFPrinter();var _0x1e7eac=_0x298e67[_0xed2c('0x3f')](_0x5f07a2);if(_0x43c40c){_0x4d7b13=path[_0xed2c('0x3b')](_0x4ac67c,_0x48b2de,util[_0xed2c('0x1e')]('%s%d.%s',_0x48b2de,_0x41cc5c,_0xed2c('0x40')));}else{_0x4d7b13=path['join'](_0x4ac67c,util[_0xed2c('0x1e')](_0xed2c('0x41'),_0x48b2de,'pdf'));}_0x45fdd9['push'](writePDFDocument(_0x1e7eac,_0x4d7b13));}return Promise['all'](_0x45fdd9);})['then'](function(){if(_0x43c40c){return new Promise(function(_0x13e69f){zipdir(path[_0xed2c('0x3b')](_0x4ac67c,_0x48b2de),{'saveTo':path[_0xed2c('0x3b')](_0x4ac67c,util['format'](_0xed2c('0x41'),_0x48b2de,_0xed2c('0x42')))},function(){rimraf(path[_0xed2c('0x3b')](_0x4ac67c,_0x48b2de),function(){});_0x13e69f('zip\x20finished');});});}})[_0xed2c('0x31')](function(){if(!_0x43c40c)return;rimraf(path['join'](_0x4ac67c,_0x48b2de),function(){});})['then'](function(){logger['info'](util[_0xed2c('0x1e')](_0xed2c('0x43'),EXTRACTED_REPORT_ID,_0xed2c('0x44')));return analyticExtractedReport(_0xed2c('0x45'),_0x43c40c?util[_0xed2c('0x1e')](_0xed2c('0x41'),_0x48b2de,_0x43c40c?_0xed2c('0x42'):_0xed2c('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xed2c('0x1e')](_0xed2c('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xed2c('0x11')][_0xed2c('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xed2c('0x31')](function(_0x445e66){EXTRACTED_REPORT=_0x445e66;return dbH[_0xed2c('0x34')][_0xed2c('0x35')](util[_0xed2c('0x1e')](_0xed2c('0x48'),QUERY),{'type':dbH[_0xed2c('0x34')][_0xed2c('0x37')][_0xed2c('0x38')]});})[_0xed2c('0x31')](extractReport)['catch'](function(_0x148901){logger[_0xed2c('0x49')](util['format'](_0xed2c('0x4a'),EXTRACTED_REPORT_ID,_0xed2c('0x44')),util['inspect'](_0x148901,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xed2c('0x4b'));})[_0xed2c('0x4c')](function(){process[_0xed2c('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x9c0786=new PdfPrinter({'Arial':{'normal':__dirname+_0xed2c('0x4e'),'bold':__dirname+_0xed2c('0x4f'),'italics':__dirname+_0xed2c('0x50'),'bolditalics':__dirname+_0xed2c('0x51')}});return _0x9c0786;}function getPDFDocDefinitionFromHTML(_0x3325fb,_0x493bbb){var _0x69db4c=util[_0xed2c('0x1e')](_0xed2c('0x52'),_0x493bbb[_0xed2c('0x53')],_0x493bbb[_0xed2c('0x54')]);var _0x140422=moment()['format'](_0xed2c('0x55'))['toString']();var _0x15f8e0=htmlToPdfmake(_0x3325fb,{'window':window,'tableAutoSize':!![]});return{'content':[_0x15f8e0],'defaultStyle':{'font':_0xed2c('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xed2c('0x56'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xed2c('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xed2c('0x56')}},'header':function(){return[{'text':_0xed2c('0x57'),'style':_0xed2c('0x22')}];},'footer':function(_0x1898ad,_0x2637f1){return[{'text':util[_0xed2c('0x1e')](_0xed2c('0x58'),_0x69db4c,_0x1898ad,_0x2637f1,_0x140422),'style':'footer'}];}};}function writePDFDocument(_0x277911,_0x318469){return new Promise(function(_0x5b1212,_0x415734){var _0x5c3eed=_0x277911[_0xed2c('0x59')](fs[_0xed2c('0x5a')](_0x318469));_0x5c3eed['on'](_0xed2c('0x5b'),function(){_0x5b1212(_0xed2c('0x5b'));});_0x5c3eed['on']('error',function(_0x29352e){_0x415734(_0x29352e);});_0x277911[_0xed2c('0x5c')]();});}exports[_0xed2c('0x5d')]=function(_0x22362b,_0x44e216){var _0x1aa477=getPDFPrinter();var _0x12700c=getPDFDocDefinitionFromHTML(_0x22362b,_0x44e216);var _0x100a8b=_0x1aa477['createPdfKitDocument'](_0x12700c);return writePDFDocument(_0x100a8b,_0x44e216[_0xed2c('0x2')])[_0xed2c('0x5e')](function(_0x44d156){throw _0x44d156;});}; \ No newline at end of file +var _0x3bbc=['existsSync','join','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','pick','toString','value','fill','length','auto','body','push','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','Arial','black','right','num','Setting','find','split','splitSizePdf','then','range','forEach','sequelize','query','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.pdf'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3bbc,0x19c));var _0xc3bb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3bbc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc3bb('0x0'));var fs=require('fs');var util=require(_0xc3bb('0x1'));var path=require(_0xc3bb('0x2'));var moment=require(_0xc3bb('0x3'));var htmlToPdfmake=require(_0xc3bb('0x4'));var PdfPrinter=require(_0xc3bb('0x5'));var zipdir=require(_0xc3bb('0x6'));var rimraf=require(_0xc3bb('0x7'));var JSDOM=require(_0xc3bb('0x8'))[_0xc3bb('0x9')];var window=new JSDOM('')[_0xc3bb('0xa')];var BPromise=require('bluebird');var db=require(_0xc3bb('0xb'))['db'];var dbH=require(_0xc3bb('0xb'))[_0xc3bb('0xc')];var logger=require(_0xc3bb('0xd'))(_0xc3bb('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0xc3bb('0xf')][0x2]);var QUERY=process[_0xc3bb('0xf')][0x3];var PATH=process[_0xc3bb('0xf')][0x4];var NAME=process[_0xc3bb('0xf')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2dd675,_0x451eef){var _0x1d38a7={'status':_0x2dd675};var _0x21692e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x451eef){_0x1d38a7[_0xc3bb('0x10')]=_0x451eef;}return db[_0xc3bb('0x11')][_0xc3bb('0x12')](_0x1d38a7,_0x21692e);}function getHeaders(_0x20d71b){return _[_0xc3bb('0x13')](_0x20d71b,function(_0x1e33ea){return{'text':_0x1e33ea,'style':'tableHeader'};});}function getRows(_0x5cb2dc,_0x4c957a){return _['map'](_0x4c957a,function(_0x3fdcb0){return _(_0x3fdcb0)[_0xc3bb('0x14')](_0x5cb2dc)[_0xc3bb('0x13')](function(_0x551e59){return _0x551e59?_[_0xc3bb('0x15')](_0x551e59):'';})[_0xc3bb('0x16')]();});}function createTable(_0x2cbe26,_0x8a93e){var _0x3af5b0={'widths':_[_0xc3bb('0x17')](Array(_0x2cbe26[_0xc3bb('0x18')]),0x91),'heights':function(_0x2d15c9){return _0x2d15c9===0x0?_0xc3bb('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5f5cb6=getHeaders(_0x2cbe26);_0x3af5b0[_0xc3bb('0x1a')][_0xc3bb('0x1b')](_0x5f5cb6);var _0x588d6c=getRows(_0x2cbe26,_0x8a93e);_0x3af5b0[_0xc3bb('0x1a')]=_0x3af5b0[_0xc3bb('0x1a')]['concat'](_0x588d6c);return _0x3af5b0;}function createTables(_0x387e03){var _0x2b7c23=[];var _0x449ac9=_[_0xc3bb('0x1c')](Object[_0xc3bb('0x1d')](_0x387e03[0x0]),0x5);_0x449ac9['forEach'](function(_0x72bb77){_0x2b7c23[_0xc3bb('0x1b')](createTable(_0x72bb77,_0x387e03));});return _0x2b7c23;}function getPDFDocDefinition(_0x1962e8){var _0x4781a6=util[_0xc3bb('0x1e')](_0xc3bb('0x1f'),NAME,EXTRACTED_REPORT[_0xc3bb('0x20')],moment(EXTRACTED_REPORT['startDate'])[_0xc3bb('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xc3bb('0x21')])[_0xc3bb('0x1e')](FORMAT));var _0x503c13=[];for(var _0x4fd3dd=0x0;_0x4fd3dd<_0x1962e8['length'];_0x4fd3dd++){var _0x1db711=[];if(_0x4fd3dd===0x0){_0x1db711['push']({'text':_0x4781a6,'style':_0xc3bb('0x22')});}var _0x593ded={'table':_0x1962e8[_0x4fd3dd]};if(_0x4fd3dd>0x0){_0x593ded[_0xc3bb('0x23')]=_0xc3bb('0x24');_0x593ded[_0xc3bb('0x25')]=[0x0,0x46,0x0,0x0];}_0x1db711[_0xc3bb('0x1b')](_0x593ded);_0x503c13[_0xc3bb('0x1b')](_0x1db711);}return{'pageSize':'A4','pageOrientation':_0xc3bb('0x26'),'content':_0x503c13,'footer':function(_0x52a384,_0xb66705){return{'text':_0x52a384[_0xc3bb('0x15')]()+_0xc3bb('0x27')+_0xb66705,'style':'footer'};},'defaultStyle':{'font':_0xc3bb('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc3bb('0x29')},'footer':{'alignment':_0xc3bb('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x8de75e){var _0x3826ab=0x1388;var _0x115a05;if(!_0x8de75e[0x0][_0xc3bb('0x2b')]){return analyticExtractedReport('Empty');}return db[_0xc3bb('0x2c')][_0xc3bb('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc3bb('0x2e'),_0xc3bb('0x2f')]})[_0xc3bb('0x30')](function(_0x55ba0c){if(_0x55ba0c){_0x115a05=_0x55ba0c;_0x3826ab=_0x115a05['splitSizePdf']||0x3e8;}})[_0xc3bb('0x30')](function(){var _0x5c9645=[];var _0x19fd7f=0x0;if(_0x115a05[_0xc3bb('0x2e')]){if(_0x8de75e&&_0x8de75e[_0xc3bb('0x18')]){var _0x2cc14c=_[_0xc3bb('0x31')](_0x8de75e[0x0][_0xc3bb('0x2b')]/_0x3826ab);var _0x21b97f=Number['isInteger'](_0x8de75e[0x0]['num']/_0x3826ab)?_0x8de75e[0x0]['num']%_0x3826ab:0x0;_0x2cc14c[_0xc3bb('0x32')](function(_0x49e092){if(_0x49e092>0x0){_0x19fd7f+=_0x3826ab;}_0x5c9645['push'](dbH[_0xc3bb('0x33')][_0xc3bb('0x34')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3826ab,_0x19fd7f),{'type':dbH['sequelize']['QueryTypes'][_0xc3bb('0x35')]}));});if(_0x21b97f>0x0){_0x19fd7f+=_0x3826ab;_0x5c9645['push'](dbH['sequelize'][_0xc3bb('0x34')](util[_0xc3bb('0x1e')](_0xc3bb('0x36'),QUERY,_0x21b97f,_0x19fd7f),{'type':dbH[_0xc3bb('0x33')][_0xc3bb('0x37')]['SELECT']}));}}}else{_0x5c9645['push'](dbH['sequelize'][_0xc3bb('0x34')](QUERY,{'type':dbH[_0xc3bb('0x33')]['QueryTypes'][_0xc3bb('0x35')]}));}var _0xea252e=path['dirname'](PATH);var _0x30202c=path[_0xc3bb('0x38')](PATH,_0xc3bb('0x39'));var _0x5306d7=_0x115a05[_0xc3bb('0x2e')]&&_0x5c9645[_0xc3bb('0x18')]>0x1;var _0x2a491c=[];if(!fs[_0xc3bb('0x3a')](path[_0xc3bb('0x3b')](_0xea252e,_0x30202c))&&_0x5306d7){fs['mkdirSync'](path[_0xc3bb('0x3b')](_0xea252e,_0x30202c));}return BPromise['each'](_0x5c9645,function(_0x4b578b){_0x2a491c[_0xc3bb('0x1b')](_0x4b578b);})[_0xc3bb('0x30')](function(){var _0x44ebe8=[];for(var _0x4cfe0b=0x0;_0x4cfe0b<_0x2a491c[_0xc3bb('0x18')];_0x4cfe0b+=0x1){var _0x5bbdec=_0x2a491c[_0x4cfe0b];var _0x1d57b0=createTables(_[_0xc3bb('0x3c')](_0x5bbdec));var _0x441425;var _0x39738d=getPDFDocDefinition(_0x1d57b0);var _0x40f7bf=getPDFPrinter();var _0x2a9ee4=_0x40f7bf[_0xc3bb('0x3d')](_0x39738d);if(_0x5306d7){_0x441425=path[_0xc3bb('0x3b')](_0xea252e,_0x30202c,util['format'](_0xc3bb('0x3e'),_0x30202c,_0x4cfe0b,_0xc3bb('0x3f')));}else{_0x441425=path[_0xc3bb('0x3b')](_0xea252e,util[_0xc3bb('0x1e')](_0xc3bb('0x40'),_0x30202c,_0xc3bb('0x3f')));}_0x44ebe8[_0xc3bb('0x1b')](writePDFDocument(_0x2a9ee4,_0x441425));}return Promise[_0xc3bb('0x41')](_0x44ebe8);})[_0xc3bb('0x30')](function(){if(_0x5306d7){return new Promise(function(_0x47f603){zipdir(path['join'](_0xea252e,_0x30202c),{'saveTo':path[_0xc3bb('0x3b')](_0xea252e,util['format'](_0xc3bb('0x40'),_0x30202c,_0xc3bb('0x42')))},function(){rimraf(path[_0xc3bb('0x3b')](_0xea252e,_0x30202c),function(){});_0x47f603('zip\x20finished');});});}})[_0xc3bb('0x30')](function(){if(!_0x5306d7)return;rimraf(path[_0xc3bb('0x3b')](_0xea252e,_0x30202c),function(){});})[_0xc3bb('0x30')](function(){logger[_0xc3bb('0x43')](util['format'](_0xc3bb('0x44'),EXTRACTED_REPORT_ID,_0xc3bb('0x45')));return analyticExtractedReport(_0xc3bb('0x46'),_0x5306d7?util[_0xc3bb('0x1e')]('%s.%s',_0x30202c,_0x5306d7?_0xc3bb('0x42'):_0xc3bb('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xc3bb('0x1e')](_0xc3bb('0x47'),EXTRACTED_REPORT_ID,_0xc3bb('0x45')));return db['AnalyticExtractedReport'][_0xc3bb('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x224411){EXTRACTED_REPORT=_0x224411;return dbH[_0xc3bb('0x33')]['query'](util[_0xc3bb('0x1e')](_0xc3bb('0x49'),QUERY),{'type':dbH[_0xc3bb('0x33')][_0xc3bb('0x37')][_0xc3bb('0x35')]});})['then'](extractReport)['catch'](function(_0xe13d68){logger['info'](util[_0xc3bb('0x1e')](_0xc3bb('0x4a'),EXTRACTED_REPORT_ID,'PDF'),util[_0xc3bb('0x4b')](_0xe13d68,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc3bb('0x4c'));})[_0xc3bb('0x4d')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x55a2ea=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xc3bb('0x4e'),'italics':__dirname+_0xc3bb('0x4f'),'bolditalics':__dirname+_0xc3bb('0x50')}});return _0x55a2ea;}function getPDFDocDefinitionFromHTML(_0x4f1e4a,_0x141bbc){var _0xcc9469=util[_0xc3bb('0x1e')](_0xc3bb('0x51'),_0x141bbc[_0xc3bb('0x52')],_0x141bbc[_0xc3bb('0x53')]);var _0x38680a=moment()[_0xc3bb('0x1e')](_0xc3bb('0x54'))[_0xc3bb('0x15')]();var _0x3ab564=htmlToPdfmake(_0x4f1e4a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3ab564],'defaultStyle':{'font':_0xc3bb('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xc3bb('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xc3bb('0x55')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xc3bb('0x22')}];},'footer':function(_0x316f18,_0xef272){return[{'text':util[_0xc3bb('0x1e')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0xcc9469,_0x316f18,_0xef272,_0x38680a),'style':_0xc3bb('0x56')}];}};}function writePDFDocument(_0x150459,_0x23c5f4){return new Promise(function(_0x1ca453,_0x36ca55){var _0x129508=_0x150459[_0xc3bb('0x57')](fs[_0xc3bb('0x58')](_0x23c5f4));_0x129508['on'](_0xc3bb('0x59'),function(){_0x1ca453(_0xc3bb('0x59'));});_0x129508['on'](_0xc3bb('0x5a'),function(_0x1a39fb){_0x36ca55(_0x1a39fb);});_0x150459[_0xc3bb('0x5b')]();});}exports[_0xc3bb('0x5c')]=function(_0x2bd3f3,_0x2d06f1){var _0x22c48b=getPDFPrinter();var _0x3da80a=getPDFDocDefinitionFromHTML(_0x2bd3f3,_0x2d06f1);var _0x4ace7a=_0x22c48b['createPdfKitDocument'](_0x3da80a);return writePDFDocument(_0x4ace7a,_0x2d06f1[_0xc3bb('0x2')])[_0xc3bb('0x5d')](function(_0x70010){throw _0x70010;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index eb55320..e28a60f 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 _0x46aa=['zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','join','mkdirSync','%s%d.%s','%s.%s','writeFileSync','binary','zip','zip\x20finished','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','lodash'];(function(_0x37e61a,_0x435290){var _0x3ab814=function(_0x27525b){while(--_0x27525b){_0x37e61a['push'](_0x37e61a['shift']());}};_0x3ab814(++_0x435290);}(_0x46aa,0x90));var _0xa46a=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x46aa[_0xb24a3e];return _0x4038d7;};'use strict';var util=require(_0xa46a('0x0'));var path=require(_0xa46a('0x1'));var _=require(_0xa46a('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0xa46a('0x3'));var rimraf=require(_0xa46a('0x4'));var db=require(_0xa46a('0x5'))['db'];var dbH=require(_0xa46a('0x5'))[_0xa46a('0x6')];var logger=require(_0xa46a('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa46a('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xa46a('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x44529e,_0x23ab8f){var _0x34c66e={'status':_0x44529e};var _0x237932={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x23ab8f){_0x34c66e[_0xa46a('0x9')]=_0x23ab8f;}return db[_0xa46a('0xa')][_0xa46a('0xb')](_0x34c66e,_0x237932);}function main(){var _0x3fd2f5=0x1388;var _0x4df886;logger['info'](util[_0xa46a('0xc')](_0xa46a('0xd'),EXTRACTED_REPORT_ID,_0xa46a('0xe')));return db[_0xa46a('0xf')][_0xa46a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa46a('0x11'),_0xa46a('0x12')]})['then'](function(_0x3fc908){if(_0x3fc908){_0x4df886=_0x3fc908;_0x3fd2f5=_0x4df886[_0xa46a('0x12')]||0x1388;}})[_0xa46a('0x13')](function(){return dbH[_0xa46a('0x14')][_0xa46a('0x15')](util[_0xa46a('0xc')](_0xa46a('0x16'),QUERY),{'type':dbH[_0xa46a('0x14')][_0xa46a('0x17')]['SELECT']});})[_0xa46a('0x13')](function(_0x344f87){if(!_0x344f87[0x0][_0xa46a('0x18')]){return analyticExtractedReport(_0xa46a('0x19'));}var _0x5a85cb=[];var _0x3401a3=0x0;if(_0x4df886['split']){if(_0x344f87&&_0x344f87[_0xa46a('0x1a')]){var _0x4fc11e=_[_0xa46a('0x1b')](_0x344f87[0x0][_0xa46a('0x18')]/_0x3fd2f5);var _0x9e081a=Number[_0xa46a('0x1c')](_0x344f87[0x0][_0xa46a('0x18')]/_0x3fd2f5)?_0x344f87[0x0]['num']%_0x3fd2f5:0x0;_0x4fc11e[_0xa46a('0x1d')](function(_0x4e2d1c){if(_0x4e2d1c>0x0){_0x3401a3+=_0x3fd2f5;}_0x5a85cb[_0xa46a('0x1e')](dbH[_0xa46a('0x14')][_0xa46a('0x15')](util['format'](_0xa46a('0x1f'),QUERY,_0x3fd2f5,_0x3401a3),{'type':dbH['sequelize'][_0xa46a('0x17')][_0xa46a('0x20')]}));});if(_0x9e081a>0x0){_0x3401a3+=_0x3fd2f5;_0x5a85cb[_0xa46a('0x1e')](dbH[_0xa46a('0x14')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x9e081a,_0x3401a3),{'type':dbH[_0xa46a('0x14')][_0xa46a('0x17')][_0xa46a('0x20')]}));}}}else{_0x5a85cb[_0xa46a('0x1e')](dbH[_0xa46a('0x14')][_0xa46a('0x15')](QUERY,{'type':dbH[_0xa46a('0x14')][_0xa46a('0x17')][_0xa46a('0x20')]}));}var _0x358c31=path[_0xa46a('0x21')](PATH);var _0x3828cf=path[_0xa46a('0x22')](PATH,_0xa46a('0x23'));var _0x1a9c37=_0x4df886[_0xa46a('0x11')]&&_0x5a85cb[_0xa46a('0x1a')]>0x1;var _0x19ff4a=[];if(!fs['existsSync'](path[_0xa46a('0x24')](_0x358c31,_0x3828cf))&&_0x1a9c37){fs[_0xa46a('0x25')](path[_0xa46a('0x24')](_0x358c31,_0x3828cf));}return BPromise['each'](_0x5a85cb,function(_0xd18cf4){_0x19ff4a[_0xa46a('0x1e')](_0xd18cf4);})[_0xa46a('0x13')](function(){for(var _0x39ce1c=0x0;_0x39ce1c<_0x19ff4a[_0xa46a('0x1a')];_0x39ce1c+=0x1){var _0x4698ed;var _0x2df63d=_0x19ff4a[_0x39ce1c];if(_0x1a9c37){_0x4698ed=path[_0xa46a('0x24')](_0x358c31,_0x3828cf,util[_0xa46a('0xc')](_0xa46a('0x26'),_0x3828cf,_0x39ce1c,'xlsx'));}else{_0x4698ed=path['join'](_0x358c31,util[_0xa46a('0xc')](_0xa46a('0x27'),_0x3828cf,'xlsx'));}fs[_0xa46a('0x28')](_0x4698ed,json2xls(_0x2df63d),_0xa46a('0x29'));}})[_0xa46a('0x13')](function(){if(_0x1a9c37){return new Promise(function(_0x30c6c4){zipdir(path['join'](_0x358c31,_0x3828cf),{'saveTo':path['join'](_0x358c31,util[_0xa46a('0xc')](_0xa46a('0x27'),_0x3828cf,_0xa46a('0x2a')))},function(_0x2d1fba,_0x3ee5a7){rimraf(path['join'](_0x358c31,_0x3828cf),function(){});_0x30c6c4(_0xa46a('0x2b'));});});}})[_0xa46a('0x13')](function(){logger['info'](util[_0xa46a('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa46a('0xe')));return analyticExtractedReport(_0xa46a('0x2c'),_0x1a9c37?util[_0xa46a('0xc')]('%s.%s',_0x3828cf,_0x1a9c37?_0xa46a('0x2a'):'xlsx'):null);});})[_0xa46a('0x2d')](function(_0x1a470f){logger[_0xa46a('0x2e')](util['format'](_0xa46a('0x2f'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xa46a('0x30')](_0x1a470f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1c9e=['then','splitSizeXlsx','sequelize','QueryTypes','SELECT','Empty','length','range','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','Failed','finally','exit','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split'];(function(_0x4e2fef,_0x3599c5){var _0x1f487a=function(_0x15a779){while(--_0x15a779){_0x4e2fef['push'](_0x4e2fef['shift']());}};_0x1f487a(++_0x3599c5);}(_0x1c9e,0x146));var _0xe1c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1c9e[_0x2641f9];return _0x585741;};'use strict';var util=require('util');var path=require(_0xe1c9('0x0'));var _=require(_0xe1c9('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xe1c9('0x2'));var zipdir=require(_0xe1c9('0x3'));var rimraf=require(_0xe1c9('0x4'));var db=require(_0xe1c9('0x5'))['db'];var dbH=require(_0xe1c9('0x5'))[_0xe1c9('0x6')];var logger=require(_0xe1c9('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe1c9('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xe1c9('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x401626,_0x16fcfe){var _0x1b8811={'status':_0x401626};var _0x5e582e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x16fcfe){_0x1b8811[_0xe1c9('0x9')]=_0x16fcfe;}return db['AnalyticExtractedReport']['update'](_0x1b8811,_0x5e582e);}function main(){var _0x547dc0=0x1388;var _0x26a87e;logger[_0xe1c9('0xa')](util[_0xe1c9('0xb')](_0xe1c9('0xc'),EXTRACTED_REPORT_ID,_0xe1c9('0xd')));return db[_0xe1c9('0xe')][_0xe1c9('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe1c9('0x10'),'splitSizeXlsx']})[_0xe1c9('0x11')](function(_0xc323c4){if(_0xc323c4){_0x26a87e=_0xc323c4;_0x547dc0=_0x26a87e[_0xe1c9('0x12')]||0x1388;}})[_0xe1c9('0x11')](function(){return dbH['sequelize']['query'](util[_0xe1c9('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe1c9('0x13')][_0xe1c9('0x14')][_0xe1c9('0x15')]});})[_0xe1c9('0x11')](function(_0x18c79a){if(!_0x18c79a[0x0]['num']){return analyticExtractedReport(_0xe1c9('0x16'));}var _0x43207b=[];var _0x2b3ae1=0x0;if(_0x26a87e[_0xe1c9('0x10')]){if(_0x18c79a&&_0x18c79a[_0xe1c9('0x17')]){var _0x4859f7=_[_0xe1c9('0x18')](_0x18c79a[0x0][_0xe1c9('0x19')]/_0x547dc0);var _0x11e34f=Number['isInteger'](_0x18c79a[0x0]['num']/_0x547dc0)?_0x18c79a[0x0][_0xe1c9('0x19')]%_0x547dc0:0x0;_0x4859f7['forEach'](function(_0x1feea7){if(_0x1feea7>0x0){_0x2b3ae1+=_0x547dc0;}_0x43207b[_0xe1c9('0x1a')](dbH['sequelize']['query'](util[_0xe1c9('0xb')](_0xe1c9('0x1b'),QUERY,_0x547dc0,_0x2b3ae1),{'type':dbH[_0xe1c9('0x13')][_0xe1c9('0x14')][_0xe1c9('0x15')]}));});if(_0x11e34f>0x0){_0x2b3ae1+=_0x547dc0;_0x43207b[_0xe1c9('0x1a')](dbH[_0xe1c9('0x13')][_0xe1c9('0x1c')](util[_0xe1c9('0xb')](_0xe1c9('0x1b'),QUERY,_0x11e34f,_0x2b3ae1),{'type':dbH[_0xe1c9('0x13')][_0xe1c9('0x14')]['SELECT']}));}}}else{_0x43207b[_0xe1c9('0x1a')](dbH[_0xe1c9('0x13')][_0xe1c9('0x1c')](QUERY,{'type':dbH['sequelize'][_0xe1c9('0x14')][_0xe1c9('0x15')]}));}var _0x3c47bc=path[_0xe1c9('0x1d')](PATH);var _0x5ed41c=path[_0xe1c9('0x1e')](PATH,_0xe1c9('0x1f'));var _0x28fcca=_0x26a87e[_0xe1c9('0x10')]&&_0x43207b[_0xe1c9('0x17')]>0x1;var _0x6c3f4f=[];if(!fs[_0xe1c9('0x20')](path[_0xe1c9('0x21')](_0x3c47bc,_0x5ed41c))&&_0x28fcca){fs[_0xe1c9('0x22')](path[_0xe1c9('0x21')](_0x3c47bc,_0x5ed41c));}return BPromise[_0xe1c9('0x23')](_0x43207b,function(_0x4a5fa7){_0x6c3f4f['push'](_0x4a5fa7);})['then'](function(){for(var _0x125f67=0x0;_0x125f67<_0x6c3f4f[_0xe1c9('0x17')];_0x125f67+=0x1){var _0x4a4026;var _0x580b9f=_0x6c3f4f[_0x125f67];if(_0x28fcca){_0x4a4026=path[_0xe1c9('0x21')](_0x3c47bc,_0x5ed41c,util[_0xe1c9('0xb')](_0xe1c9('0x24'),_0x5ed41c,_0x125f67,_0xe1c9('0x25')));}else{_0x4a4026=path['join'](_0x3c47bc,util[_0xe1c9('0xb')](_0xe1c9('0x26'),_0x5ed41c,_0xe1c9('0x25')));}fs[_0xe1c9('0x27')](_0x4a4026,json2xls(_0x580b9f),_0xe1c9('0x28'));}})[_0xe1c9('0x11')](function(){if(_0x28fcca){return new Promise(function(_0x3cf858){zipdir(path['join'](_0x3c47bc,_0x5ed41c),{'saveTo':path[_0xe1c9('0x21')](_0x3c47bc,util[_0xe1c9('0xb')](_0xe1c9('0x26'),_0x5ed41c,_0xe1c9('0x29')))},function(_0x51676b,_0x473869){rimraf(path[_0xe1c9('0x21')](_0x3c47bc,_0x5ed41c),function(){});_0x3cf858(_0xe1c9('0x2a'));});});}})[_0xe1c9('0x11')](function(){logger[_0xe1c9('0xa')](util[_0xe1c9('0xb')](_0xe1c9('0x2b'),EXTRACTED_REPORT_ID,_0xe1c9('0xd')));return analyticExtractedReport(_0xe1c9('0x2c'),_0x28fcca?util[_0xe1c9('0xb')]('%s.%s',_0x5ed41c,_0x28fcca?_0xe1c9('0x29'):_0xe1c9('0x25')):null);});})['catch'](function(_0x3838e8){logger[_0xe1c9('0xa')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe1c9('0xd')),util[_0xe1c9('0x2d')](_0x3838e8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe1c9('0x2e'));})[_0xe1c9('0x2f')](function(){process[_0xe1c9('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 68acb09..efb57bb 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 _0x3c61=['cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','error','rewrite','lodash','models','Interval','findAll','then','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','find','extensions','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','outbound','extension','push'];(function(_0x10732c,_0x336eba){var _0x5f51e5=function(_0x28af22){while(--_0x28af22){_0x10732c['push'](_0x10732c['shift']());}};_0x5f51e5(++_0x336eba);}(_0x3c61,0x1d5));var _0x13c6=function(_0x351f20,_0x58757f){_0x351f20=_0x351f20-0x0;var _0xea6ff3=_0x3c61[_0x351f20];return _0xea6ff3;};'use strict';var _=require(_0x13c6('0x0'));var util=require('util');function rewrite(_0x2b6151,_0xdaabaa){var _0x62e75f=this;return _0x2b6151[_0x13c6('0x1')][_0x13c6('0x2')][_0x13c6('0x3')]({'raw':!![]})[_0x13c6('0x4')](function(_0x2822f2){_0x62e75f['intervals']=_0x2822f2;return _0x2b6151[_0x13c6('0x1')][_0x13c6('0x5')][_0x13c6('0x3')]({'where':{'IntervalId':_0xdaabaa['IntervalId']},'raw':!![]});})[_0x13c6('0x4')](function(_0x362faa){return _0x2b6151[_0x13c6('0x1')][_0x13c6('0x5')][_0x13c6('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x13c6('0x6')](_0x362faa,_0x13c6('0x7')))}},'order':[{'raw':_0x13c6('0x8')}],'raw':!![]});})['then'](function(_0x3d062f){var _0xca82ff=_[_0x13c6('0x9')](_0x3d062f,{'priority':'1'});var _0x55fdd9=_[_0x13c6('0x9')](_0x3d062f,{'isApp':0x1});var _0xffbb28=_[_0x13c6('0xa')](_0x55fdd9,_0x13c6('0x7'));var _0x23db0d=[_0x13c6('0xb'),_0x13c6('0xc')];var _0x42892f=[];var _0x2dd871=[];for(var _0x378102 in _0xffbb28){if(_0xffbb28[_0x13c6('0xd')](_0x378102)){_0x62e75f[_0x13c6('0xe')]=0x2;_0x62e75f['extensions']=[];_0x62e75f['extension']=_[_0x13c6('0xf')](_0xca82ff,{'exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')]});_0x62e75f[_0x13c6('0x10')]['push']({'type':_0xffbb28[_0x378102][0x0]['type'],'app':'Set','appdata':util[_0x13c6('0x11')](_0x13c6('0x12'),_0xffbb28[_0x378102][0x0][_0x13c6('0x13')]),'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});if(_0xffbb28[_0x378102][0x0][_0x13c6('0x13')]===_0x13c6('0x16')){_0x62e75f[_0x13c6('0x10')]['push']({'type':_0xffbb28[_0x378102][0x0]['type'],'app':_0x13c6('0x17'),'appdata':_0x13c6('0x18')+_0xffbb28[_0x378102][0x0][_0x13c6('0x15')],'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0]['VoiceExtensionId']});}else if(_0xffbb28[_0x378102][0x0]['type']===_0x13c6('0x19')){if(_0x62e75f[_0x13c6('0x1a')]){_0x62e75f[_0x13c6('0x10')][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':'CDR(destination)='+(_0x62e75f['extension'][_0x13c6('0x1c')]?_0x13c6('0x1d')+_0x62e75f[_0x13c6('0x1a')][_0x13c6('0x1c')]+'}':_0x13c6('0x1e')),'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0]['VoiceExtensionId']});}_0x62e75f[_0x13c6('0x10')][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':'CDR(routeid)='+_0xffbb28[_0x378102][0x0]['VoiceExtensionId'],'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});var _0xacedd2=_0x62e75f[_0x13c6('0xe')]++;_0x62e75f[_0x13c6('0x10')][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x1f'),'appdata':_0x13c6('0x20')+(_0xacedd2+0x2)+_0x13c6('0x21')+(_0xacedd2+0x1)+')','context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0xacedd2,'VoiceExtensionId':_0xffbb28[_0x378102][0x0]['VoiceExtensionId']});if(_0x62e75f['extension']){_0x62e75f['extensions'][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':_0x62e75f[_0x13c6('0x1a')][_0x13c6('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x62e75f['extension'][_0x13c6('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')],'priority':_0x62e75f['priority']++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});}_0x62e75f[_0x13c6('0x10')]['push']({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':_0x13c6('0x22')+_0xffbb28[_0x378102][0x0][_0x13c6('0x15')],'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});if(_0x62e75f[_0x13c6('0x1a')]&&_0x62e75f['extension'][_0x13c6('0xd')](_0x13c6('0x23'))&&_0x62e75f[_0x13c6('0x1a')][_0x13c6('0x23')]!==_0x13c6('0x24')){_0x62e75f[_0x13c6('0x10')][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':'Set','appdata':_0x13c6('0x25'),'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});_0x62e75f[_0x13c6('0x10')][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0]['type'],'app':'Set','appdata':_0x13c6('0x26')+_0x62e75f['extension'][_0x13c6('0x23')]||_0x13c6('0x27'),'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0]['VoiceExtensionId']});}}_0x62e75f['extensions']['push']({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':_0x13c6('0x28'),'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});_0x62e75f[_0x13c6('0x10')]['push']({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':_0x13c6('0x29'),'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});_0x62e75f[_0x13c6('0x10')]['push']({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':'MONITOR_OPTIONS=ab','context':_0xffbb28[_0x378102][0x0]['context'],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});for(var _0x27a776=0x0,_0x1a86ef=0x0;_0x27a776<_0xffbb28[_0x378102][_0x13c6('0x2a')];_0x27a776+=0x1,_0x1a86ef=0x0){var _0x10e701=_0xffbb28[_0x378102][_0x27a776];if(_0x10e701[_0x13c6('0x13')]){_0x10e701['type']=_0x10e701[_0x13c6('0x13')][_0x13c6('0x2b')]();}var _0x2dc06d=[];var _0x3eed5f=[];delete _0x10e701['id'];delete _0x10e701[_0x13c6('0x2c')];delete _0x10e701[_0x13c6('0x2d')];var _0x58898b=_0x10e701[_0x13c6('0x2e')]!==_0x13c6('0x2f')?[_0x10e701['interval']]:_0x10e701[_0x13c6('0x30')]?_[_0x13c6('0x6')](_[_0x13c6('0x9')](_0x62e75f[_0x13c6('0x31')],{'IntervalId':_0x10e701[_0x13c6('0x30')]}),_0x13c6('0x2e')):[];if(_0x10e701[_0x13c6('0xd')](_0x13c6('0x32'))){if(_0x10e701[_0x13c6('0x32')]&&_0x10e701['tag']!=='--'){_0x2dc06d[_0x13c6('0x1b')]({'type':_0x10e701[_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':_0x13c6('0x33')+_0x10e701['tag'],'context':_0x10e701[_0x13c6('0x14')],'exten':_0x10e701[_0x13c6('0x7')],'priority':_0x58898b[_0x13c6('0x2a')]+_0x62e75f['priority']+_0x1a86ef++,'VoiceExtensionId':_0x10e701[_0x13c6('0x15')]});}}if(_0x10e701['type']===_0x13c6('0x19')&&_0x10e701[_0x13c6('0xd')](_0x13c6('0x34'))){if(_0x10e701[_0x13c6('0x34')]){_0x2dc06d[_0x13c6('0x1b')]({'type':_0x10e701[_0x13c6('0x13')],'app':_0x13c6('0x1f'),'appdata':_0x13c6('0x35')+_0x10e701['callerID']+')','context':_0x10e701[_0x13c6('0x14')],'exten':_0x10e701[_0x13c6('0x7')],'priority':_0x58898b[_0x13c6('0x2a')]+_0x62e75f['priority']+_0x1a86ef++,'VoiceExtensionId':_0x10e701[_0x13c6('0x15')]});}else{_0x2dc06d['push']({'type':_0x10e701[_0x13c6('0x13')],'app':_0x13c6('0x1f'),'appdata':_0x13c6('0x36'),'context':_0x10e701[_0x13c6('0x14')],'exten':_0x10e701[_0x13c6('0x7')],'priority':_0x58898b['length']+_0x62e75f[_0x13c6('0xe')]+_0x1a86ef++,'VoiceExtensionId':_0x10e701[_0x13c6('0x15')]});}}if(_0x10e701[_0x13c6('0xd')](_0x13c6('0x37'))){if(_0x23db0d[_0x13c6('0x38')](_0x10e701[_0x13c6('0x39')]['toLowerCase']())>=0x0&&_0x10e701['appType']!==_0x13c6('0x3a')){if(_0x10e701['answer']){_0x2dc06d[_0x13c6('0x1b')]({'type':_0x10e701['type'],'app':_0x13c6('0x1f'),'appdata':_0x13c6('0x3b'),'context':_0x10e701[_0x13c6('0x14')],'exten':_0x10e701['exten'],'priority':_0x58898b[_0x13c6('0x2a')]+_0x62e75f[_0x13c6('0xe')]+_0x1a86ef++,'VoiceExtensionId':_0x10e701[_0x13c6('0x15')]});_0x2dc06d[_0x13c6('0x1b')]({'type':_0x10e701[_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x10e701['context'],'exten':_0x10e701['exten'],'priority':_0x58898b[_0x13c6('0x2a')]+_0x62e75f[_0x13c6('0xe')]+_0x1a86ef++,'VoiceExtensionId':_0x10e701['VoiceExtensionId']});}else{_0x2dc06d['push']({'type':_0x10e701[_0x13c6('0x13')],'app':_0x13c6('0x1f'),'appdata':_0x13c6('0x3c'),'context':_0x10e701[_0x13c6('0x14')],'exten':_0x10e701[_0x13c6('0x7')],'priority':_0x58898b[_0x13c6('0x2a')]+_0x62e75f[_0x13c6('0xe')]+_0x1a86ef++,'VoiceExtensionId':_0x10e701[_0x13c6('0x15')]});_0x2dc06d[_0x13c6('0x1b')]({'type':_0x10e701['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x10e701[_0x13c6('0x14')],'exten':_0x10e701['exten'],'priority':_0x58898b[_0x13c6('0x2a')]+_0x62e75f[_0x13c6('0xe')]+_0x1a86ef++,'VoiceExtensionId':_0x10e701[_0x13c6('0x15')]});}}}for(var _0x4ef1de=0x0;_0x4ef1de<_0x58898b[_0x13c6('0x2a')];_0x4ef1de+=0x1){var _0x592f7b=_0x62e75f[_0x13c6('0xe')]+_0x58898b[_0x13c6('0x2a')];var _0x3f75e5=_0x4ef1de===_0x58898b[_0x13c6('0x2a')]-0x1?_0x62e75f['priority']+_0x2dc06d[_0x13c6('0x2a')]+_0x3eed5f['length']+0x2:_0x62e75f[_0x13c6('0xe')]+_0x4ef1de+0x1;_0x2dc06d[_0x13c6('0x3d')](_0x4ef1de,0x0,{'type':_0x10e701[_0x13c6('0x13')],'app':_0x13c6('0x3e'),'appdata':_0x58898b[_0x4ef1de]+'?'+_0x10e701['context']+_0x13c6('0x3f')+_0x592f7b+':'+_0x10e701[_0x13c6('0x14')]+_0x13c6('0x3f')+_0x3f75e5,'exten':_0x10e701[_0x13c6('0x7')],'context':_0x10e701[_0x13c6('0x14')],'priority':_0x62e75f[_0x13c6('0xe')]+_0x4ef1de,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});}_0x10e701[_0x13c6('0xe')]=_0x2dc06d[_0x13c6('0x2a')]?_[_0x13c6('0x40')](_0x2dc06d)[_0x13c6('0xe')]+0x1:_0x62e75f['priority'];_0x62e75f[_0x13c6('0xe')]=(_0x3eed5f[_0x13c6('0x2a')]?_[_0x13c6('0x40')](_0x3eed5f)[_0x13c6('0xe')]:_0x10e701['priority'])+0x1;_0x62e75f['extensions']=_['concat'](_0x62e75f[_0x13c6('0x10')],_0x2dc06d,[_0x10e701],_0x3eed5f);}_0x62e75f[_0x13c6('0x10')][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':'Hangup','exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')],'context':_0xffbb28[_0x378102][0x0]['context'],'priority':_0x62e75f['priority'],'VoiceExtensionId':_0xffbb28[_0x378102][0x0]['VoiceExtensionId']});_0x42892f[_0x13c6('0x1b')](_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]);_0x2dd871=_[_0x13c6('0x41')](_0x2dd871,_0x62e75f[_0x13c6('0x10')]);}}return _0x2b6151['transaction'](function(_0x45b4e0){return _0x2b6151[_0x13c6('0x1')]['VoiceExtension'][_0x13c6('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x42892f}},'transaction':_0x45b4e0})[_0x13c6('0x4')](function(_0x20912d){return _0x2b6151[_0x13c6('0x1')][_0x13c6('0x5')][_0x13c6('0x43')](_[_0x13c6('0x44')](_0x2dd871,_0x13c6('0xe')),{'transaction':_0x45b4e0});});});})['catch'](function(_0x5c9347){console[_0x13c6('0x45')](_0x5c9347);});}exports[_0x13c6('0x46')]=rewrite; \ No newline at end of file +var _0xb7e1=['*,*,*,*','tag','CDR(tag)=','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','toLowerCase','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','catch','error','rewrite','util','Interval','findAll','intervals','models','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','hasOwnProperty','priority','extensions','extension','find','type','CDR(type)=%s','VoiceExtensionId','inbound','push','Set','CDR(routeid)=','outbound','${EXTEN:','${EXTEN}','context','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','updatedAt','interval'];(function(_0x3a0538,_0x3f7e29){var _0x49e6ef=function(_0x7fa737){while(--_0x7fa737){_0x3a0538['push'](_0x3a0538['shift']());}};_0x49e6ef(++_0x3f7e29);}(_0xb7e1,0x11a));var _0x1b7e=function(_0x28baab,_0x34af5f){_0x28baab=_0x28baab-0x0;var _0x35a3a5=_0xb7e1[_0x28baab];return _0x35a3a5;};'use strict';var _=require('lodash');var util=require(_0x1b7e('0x0'));function rewrite(_0x52a1eb,_0x404dbb){var _0x312694=this;return _0x52a1eb['models'][_0x1b7e('0x1')][_0x1b7e('0x2')]({'raw':!![]})['then'](function(_0x2e969f){_0x312694[_0x1b7e('0x3')]=_0x2e969f;return _0x52a1eb[_0x1b7e('0x4')][_0x1b7e('0x5')][_0x1b7e('0x2')]({'where':{'IntervalId':_0x404dbb[_0x1b7e('0x6')]},'raw':!![]});})['then'](function(_0x318a66){return _0x52a1eb['models'][_0x1b7e('0x5')][_0x1b7e('0x2')]({'where':{'exten':{'$in':_['uniq'](_[_0x1b7e('0x7')](_0x318a66,_0x1b7e('0x8')))}},'order':[{'raw':_0x1b7e('0x9')}],'raw':!![]});})[_0x1b7e('0xa')](function(_0x4bf42d){var _0x520dff=_[_0x1b7e('0xb')](_0x4bf42d,{'priority':'1'});var _0x4724b4=_[_0x1b7e('0xb')](_0x4bf42d,{'isApp':0x1});var _0x48591a=_[_0x1b7e('0xc')](_0x4724b4,_0x1b7e('0x8'));var _0x49b386=['queue','playback'];var _0x28ff6b=[];var _0x314d6c=[];for(var _0x121142 in _0x48591a){if(_0x48591a[_0x1b7e('0xd')](_0x121142)){_0x312694[_0x1b7e('0xe')]=0x2;_0x312694[_0x1b7e('0xf')]=[];_0x312694[_0x1b7e('0x10')]=_[_0x1b7e('0x11')](_0x520dff,{'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')]});_0x312694['extensions']['push']({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':'Set','appdata':util['format'](_0x1b7e('0x13'),_0x48591a[_0x121142][0x0][_0x1b7e('0x12')]),'context':_0x48591a[_0x121142][0x0]['context'],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694['priority']++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});if(_0x48591a[_0x121142][0x0][_0x1b7e('0x12')]===_0x1b7e('0x15')){_0x312694['extensions'][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x18')+_0x48591a[_0x121142][0x0][_0x1b7e('0x14')],'context':_0x48591a[_0x121142][0x0]['context'],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694['priority']++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});}else if(_0x48591a[_0x121142][0x0][_0x1b7e('0x12')]===_0x1b7e('0x19')){if(_0x312694[_0x1b7e('0x10')]){_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0]['type'],'app':_0x1b7e('0x17'),'appdata':'CDR(destination)='+(_0x312694[_0x1b7e('0x10')]['cutdigits']?_0x1b7e('0x1a')+_0x312694[_0x1b7e('0x10')]['cutdigits']+'}':_0x1b7e('0x1b')),'context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0]['VoiceExtensionId']});}_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':'CDR(routeid)='+_0x48591a[_0x121142][0x0][_0x1b7e('0x14')],'context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});var _0xf0066c=_0x312694['priority']++;_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':'ExecIf','appdata':_0x1b7e('0x1d')+(_0xf0066c+0x2)+_0x1b7e('0x1e')+(_0xf0066c+0x1)+')','context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0]['exten'],'priority':_0xf0066c,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});if(_0x312694['extension']){_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x312694[_0x1b7e('0x10')][_0x1b7e('0x1f')]?_0x1b7e('0x20')+_0x312694[_0x1b7e('0x10')][_0x1b7e('0x1f')]+'}':'CDR(prefix)=noprefix','context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});}_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x21')+_0x48591a[_0x121142][0x0][_0x1b7e('0x14')],'context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});if(_0x312694['extension']&&_0x312694['extension'][_0x1b7e('0xd')](_0x1b7e('0x22'))&&_0x312694[_0x1b7e('0x10')][_0x1b7e('0x22')]!==_0x1b7e('0x23')){_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x48591a[_0x121142][0x0]['context'],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694['priority']++,'VoiceExtensionId':_0x48591a[_0x121142][0x0]['VoiceExtensionId']});_0x312694[_0x1b7e('0xf')]['push']({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x24')+_0x312694[_0x1b7e('0x10')][_0x1b7e('0x22')]||_0x1b7e('0x25'),'context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694['priority']++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});}}_0x312694[_0x1b7e('0xf')]['push']({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x26'),'context':_0x48591a[_0x121142][0x0]['context'],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0]['VoiceExtensionId']});_0x312694[_0x1b7e('0xf')]['push']({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':'Set','appdata':_0x1b7e('0x27'),'context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x28'),'context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});for(var _0x5a0ae6=0x0,_0x4bf6d5=0x0;_0x5a0ae6<_0x48591a[_0x121142]['length'];_0x5a0ae6+=0x1,_0x4bf6d5=0x0){var _0x2ad79b=_0x48591a[_0x121142][_0x5a0ae6];if(_0x2ad79b[_0x1b7e('0x12')]){_0x2ad79b[_0x1b7e('0x12')]=_0x2ad79b['type']['toLowerCase']();}var _0x1d716d=[];var _0x5ecafa=[];delete _0x2ad79b['id'];delete _0x2ad79b['createdAt'];delete _0x2ad79b[_0x1b7e('0x29')];var _0x269fdc=_0x2ad79b[_0x1b7e('0x2a')]!==_0x1b7e('0x2b')?[_0x2ad79b[_0x1b7e('0x2a')]]:_0x2ad79b[_0x1b7e('0x6')]?_['map'](_[_0x1b7e('0xb')](_0x312694[_0x1b7e('0x3')],{'IntervalId':_0x2ad79b[_0x1b7e('0x6')]}),_0x1b7e('0x2a')):[];if(_0x2ad79b[_0x1b7e('0xd')](_0x1b7e('0x2c'))){if(_0x2ad79b[_0x1b7e('0x2c')]&&_0x2ad79b[_0x1b7e('0x2c')]!=='--'){_0x1d716d[_0x1b7e('0x16')]({'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x2d')+_0x2ad79b[_0x1b7e('0x2c')],'context':_0x2ad79b['context'],'exten':_0x2ad79b[_0x1b7e('0x8')],'priority':_0x269fdc[_0x1b7e('0x2e')]+_0x312694[_0x1b7e('0xe')]+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b['VoiceExtensionId']});}}if(_0x2ad79b['type']===_0x1b7e('0x19')&&_0x2ad79b[_0x1b7e('0xd')](_0x1b7e('0x2f'))){if(_0x2ad79b[_0x1b7e('0x2f')]){_0x1d716d[_0x1b7e('0x16')]({'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x30'),'appdata':_0x1b7e('0x31')+_0x2ad79b[_0x1b7e('0x2f')]+')','context':_0x2ad79b['context'],'exten':_0x2ad79b['exten'],'priority':_0x269fdc['length']+_0x312694['priority']+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b['VoiceExtensionId']});}else{_0x1d716d[_0x1b7e('0x16')]({'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x30'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x2ad79b[_0x1b7e('0x1c')],'exten':_0x2ad79b[_0x1b7e('0x8')],'priority':_0x269fdc[_0x1b7e('0x2e')]+_0x312694[_0x1b7e('0xe')]+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b[_0x1b7e('0x14')]});}}if(_0x2ad79b[_0x1b7e('0xd')](_0x1b7e('0x32'))){if(_0x49b386['indexOf'](_0x2ad79b['app'][_0x1b7e('0x33')]())>=0x0&&_0x2ad79b[_0x1b7e('0x34')]!=='custom'){if(_0x2ad79b[_0x1b7e('0x32')]){_0x1d716d[_0x1b7e('0x16')]({'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x30'),'appdata':_0x1b7e('0x35'),'context':_0x2ad79b[_0x1b7e('0x1c')],'exten':_0x2ad79b[_0x1b7e('0x8')],'priority':_0x269fdc[_0x1b7e('0x2e')]+_0x312694[_0x1b7e('0xe')]+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b[_0x1b7e('0x14')]});_0x1d716d[_0x1b7e('0x16')]({'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x36'),'context':_0x2ad79b[_0x1b7e('0x1c')],'exten':_0x2ad79b[_0x1b7e('0x8')],'priority':_0x269fdc[_0x1b7e('0x2e')]+_0x312694[_0x1b7e('0xe')]+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b[_0x1b7e('0x14')]});}else{_0x1d716d['push']({'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x30'),'appdata':_0x1b7e('0x37'),'context':_0x2ad79b[_0x1b7e('0x1c')],'exten':_0x2ad79b['exten'],'priority':_0x269fdc[_0x1b7e('0x2e')]+_0x312694[_0x1b7e('0xe')]+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b[_0x1b7e('0x14')]});_0x1d716d['push']({'type':_0x2ad79b[_0x1b7e('0x12')],'app':'Set','appdata':_0x1b7e('0x38'),'context':_0x2ad79b[_0x1b7e('0x1c')],'exten':_0x2ad79b['exten'],'priority':_0x269fdc['length']+_0x312694['priority']+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b[_0x1b7e('0x14')]});}}}for(var _0x5e6a47=0x0;_0x5e6a47<_0x269fdc['length'];_0x5e6a47+=0x1){var _0x4619dd=_0x312694[_0x1b7e('0xe')]+_0x269fdc[_0x1b7e('0x2e')];var _0x56ce70=_0x5e6a47===_0x269fdc[_0x1b7e('0x2e')]-0x1?_0x312694[_0x1b7e('0xe')]+_0x1d716d[_0x1b7e('0x2e')]+_0x5ecafa[_0x1b7e('0x2e')]+0x2:_0x312694['priority']+_0x5e6a47+0x1;_0x1d716d['splice'](_0x5e6a47,0x0,{'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x39'),'appdata':_0x269fdc[_0x5e6a47]+'?'+_0x2ad79b[_0x1b7e('0x1c')]+_0x1b7e('0x3a')+_0x4619dd+':'+_0x2ad79b['context']+_0x1b7e('0x3a')+_0x56ce70,'exten':_0x2ad79b[_0x1b7e('0x8')],'context':_0x2ad79b[_0x1b7e('0x1c')],'priority':_0x312694[_0x1b7e('0xe')]+_0x5e6a47,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});}_0x2ad79b[_0x1b7e('0xe')]=_0x1d716d[_0x1b7e('0x2e')]?_[_0x1b7e('0x3b')](_0x1d716d)[_0x1b7e('0xe')]+0x1:_0x312694[_0x1b7e('0xe')];_0x312694[_0x1b7e('0xe')]=(_0x5ecafa[_0x1b7e('0x2e')]?_['last'](_0x5ecafa)[_0x1b7e('0xe')]:_0x2ad79b[_0x1b7e('0xe')])+0x1;_0x312694['extensions']=_[_0x1b7e('0x3c')](_0x312694[_0x1b7e('0xf')],_0x1d716d,[_0x2ad79b],_0x5ecafa);}_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':'Hangup','exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'context':_0x48591a[_0x121142][0x0]['context'],'priority':_0x312694[_0x1b7e('0xe')],'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});_0x28ff6b['push'](_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]);_0x314d6c=_[_0x1b7e('0x3c')](_0x314d6c,_0x312694['extensions']);}}return _0x52a1eb[_0x1b7e('0x3d')](function(_0x2d9f3c){return _0x52a1eb[_0x1b7e('0x4')][_0x1b7e('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x28ff6b}},'transaction':_0x2d9f3c})['then'](function(_0x4f344b){return _0x52a1eb[_0x1b7e('0x4')][_0x1b7e('0x5')]['bulkCreate'](_['sortBy'](_0x314d6c,'priority'),{'transaction':_0x2d9f3c});});});})[_0x1b7e('0x3e')](function(_0x3b557d){console[_0x1b7e('0x3f')](_0x3b557d);});}exports[_0x1b7e('0x40')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 05f69a3..47d0c77 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 _0x6877=['redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','find','duplicate','CmContact','create','then','pick','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','select','field','NOW()','toString','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','id\x20IN\x20?','calleridnum','\x20=\x20?','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','push','sequelize','VoiceQueueId','onlyIfOpen','catch','query','all','BlackLists','always','CampaignId','Campaign','Error\x20processing\x20rows\x20block:','stringify','emit','resume','resolve','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api'];(function(_0x1ea4d6,_0x4b3516){var _0x4e77d6=function(_0x114184){while(--_0x114184){_0x1ea4d6['push'](_0x1ea4d6['shift']());}};_0x4e77d6(++_0x4b3516);}(_0x6877,0xd4));var _0x7687=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x6877[_0x267d8d];return _0x11a98f;};'use strict';var BPromise=require(_0x7687('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x7687('0x1'));var db=require(_0x7687('0x2'))['db'];var config=require(_0x7687('0x3'));var logger=require(_0x7687('0x4'))(_0x7687('0x5'));config[_0x7687('0x6')]=_[_0x7687('0x7')](config[_0x7687('0x6')],{'host':_0x7687('0x8'),'port':0x18eb});var socket=require(_0x7687('0x9'))(new Redis(config[_0x7687('0x6')]));require(_0x7687('0xa'))['register'](socket);try{if(!process[_0x7687('0xb')][0x2]||process[_0x7687('0xb')][0x2]===_0x7687('0xc')||process['argv'][0x2]===_0x7687('0xd')){throw new Error(_0x7687('0xe'));}var FILEPATH=process[_0x7687('0xb')][0x2];if(!process[_0x7687('0xb')][0x3]||process[_0x7687('0xb')][0x3]===_0x7687('0xc')||process[_0x7687('0xb')][0x3]===_0x7687('0xd')||!process[_0x7687('0xb')][0x4]||process[_0x7687('0xb')][0x4]==='undefined'||process['argv'][0x4]===_0x7687('0xd')){throw new Error(_0x7687('0xf'));}var FIELDS=_[_0x7687('0x10')](process['argv'][0x3]['split'](','),process[_0x7687('0xb')][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x7687('0xb')][0x5]===_0x7687('0xc')||process['argv'][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7687('0xb')][0x6]&&process[_0x7687('0xb')][0x6]!==_0x7687('0xc')&&process['argv'][0x6]!==_0x7687('0xd')?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x7687('0xb')][0x7]!==_0x7687('0xc')&&process[_0x7687('0xb')][0x7]!=='null'?process[_0x7687('0xb')][0x7]:null;if(!process['argv'][0x8]||process[_0x7687('0xb')][0x8]===_0x7687('0xc')||process['argv'][0x8]===_0x7687('0xd')){throw new Error(_0x7687('0x11'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x32a72c){logger[_0x7687('0x12')](_0x32a72c);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(_0x4e37af,_0x177caa,_0x527baa,_0x2ddb48){var _0x29809a={'message':_0x177caa};_0x29809a[_0x4e37af]=!![];if(_0x527baa){_0x29809a[_0x7687('0x13')]=_0x527baa;}if(_0x2ddb48){_0x29809a[_0x7687('0x14')]=_0x2ddb48;}return _0x29809a;}function isEmail(_0x3a9cd6){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))*$/[_0x7687('0x15')](_0x3a9cd6);}function checkRow(_0x50445b,_0x107c49,_0x18d38f){return new BPromise(function(_0x3e5970,_0x1d31d2){if(_[_0x7687('0x16')](_0x50445b)){return _0x1d31d2(handleCheckRowError(_0x7687('0x12'),_0x7687('0x17'),null,_0x18d38f));}if(_0x50445b[_0x7687('0x18')]&&_0x50445b[_0x7687('0x18')]['length']){var _0x4efd6a=_[_0x7687('0x19')](_0x50445b['errors'],_0x7687('0x1a'))[_0x7687('0x1b')](';');return _0x1d31d2(handleCheckRowError(_0x7687('0x12'),_0x4efd6a,null,_0x18d38f));}var _0x3fd072={};for(var _0x2907fe in FIELDS){if(FIELDS[_0x7687('0x1c')](_0x2907fe)&&FIELDS[_0x2907fe]){_0x3fd072[_0x2907fe]=_0x50445b['data'][0x0][FIELDS[_0x2907fe]]||_0x50445b[_0x7687('0x1d')][0x0]['\ufeff'+FIELDS[_0x2907fe]];}}if(!_0x3fd072['firstName']){return _0x1d31d2(handleCheckRowError(_0x7687('0x12'),_0x7687('0x1e'),null,_0x18d38f));}if(!_0x3fd072['phone']){return _0x1d31d2(handleCheckRowError(_0x7687('0x12'),_0x7687('0x1f'),null,_0x18d38f));}if(_0x3fd072[_0x7687('0x20')]){var _0x2277f8=moment(_0x3fd072['birthDate'],_0x7687('0x21'));if(!_0x2277f8[_0x7687('0x22')]()){return _0x1d31d2(handleCheckRowError(_0x7687('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x18d38f));}}if(_0x3fd072[_0x7687('0x23')]){if(!isEmail(_0x3fd072['email'])){return _0x1d31d2(handleCheckRowError(_0x7687('0x12'),_0x7687('0x24'),null,_0x18d38f));}}_0x3fd072['ListId']=LISTID;_0x3fd072[_0x7687('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7687('0x26')]&&_0x107c49){var _0x516578={};for(var _0x1d97b8=0x0,_0x540232=DUPLICATES['length'];_0x1d97b8<_0x540232;_0x1d97b8+=0x1){_0x516578[DUPLICATES[_0x1d97b8]]=_0x3fd072[DUPLICATES[_0x1d97b8]];}var _0x2fa7eb=_[_0x7687('0x27')](_0x107c49,_0x516578);if(_0x2fa7eb){return _0x1d31d2(handleCheckRowError(_0x7687('0x28'),'Duplicate\x20Contact',_0x2fa7eb,_0x18d38f));}}return db[_0x7687('0x29')][_0x7687('0x2a')](_0x3fd072,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3fd072)})[_0x7687('0x2b')](function(_0x2bfb8a){if(DUPLICATES&&DUPLICATES[_0x7687('0x26')]&&_0x107c49){_0x107c49['push'](_[_0x7687('0x2c')](_0x3fd072,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2bfb8a['id'];return _0x3e5970();})['catch'](function(_0x149ca0){return _0x1d31d2(handleCheckRowError('error',_0x7687('0x2d')+(_0x149ca0[_0x7687('0x1a')]||JSON['stringify'](_0x149ca0)),null,_0x18d38f));});});}function checkHopper(){function _0x2cff99(){return function(_0x2f91d8){logger[_0x7687('0x12')](_0x7687('0x2e'),_0x7687('0x2f'),util[_0x7687('0x30')](_0x2f91d8,{'showHidden':![],'depth':null}));};}var _0x20ae1a=function(_0x1c20e3,_0x25da4a){var _0x21f19c=squel[_0x7687('0x31')]()[_0x7687('0x32')](_0x7687('0x33'))[_0x7687('0x34')]([_0x7687('0x35'),_0x7687('0x36'),_0x7687('0x37'),_0x7687('0x38'),_0x25da4a,_0x7687('0x39'),'updatedAt'],squel[_0x7687('0x3a')]()[_0x7687('0x3b')]('phone','phone')[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x36'))[_0x7687('0x3b')]('id','ContactId')[_0x7687('0x3b')](LISTID[_0x7687('0x3d')](),'ListId')[_0x7687('0x3b')](_0x1c20e3['id'][_0x7687('0x3d')](),_0x25da4a)[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x39'))[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x3e'))[_0x7687('0x3f')](_0x7687('0x40'))['where'](_0x7687('0x41'))[_0x7687('0x42')](_0x7687('0x43'),LISTID[_0x7687('0x3d')]())[_0x7687('0x42')](_0x7687('0x44'))[_0x7687('0x42')](_0x7687('0x45'),squel[_0x7687('0x3a')]()[_0x7687('0x3b')](_0x7687('0x35'))[_0x7687('0x3f')](_0x7687('0x33'))['where'](_0x25da4a+'\x20=\x20?',_0x1c20e3['id'][_0x7687('0x3d')]())))[_0x7687('0x3d')]();return _0x21f19c;};var _0x34b52b=function(_0x167333,_0x5b5000){var _0x1f855a=squel[_0x7687('0x31')]()[_0x7687('0x32')](_0x7687('0x33'))[_0x7687('0x34')]([_0x7687('0x35'),'scheduledAt',_0x7687('0x37'),'ListId',_0x5b5000,_0x7687('0x39'),_0x7687('0x3e')],squel[_0x7687('0x3a')]()[_0x7687('0x3b')](_0x7687('0x35'),_0x7687('0x35'))[_0x7687('0x3b')](_0x7687('0x3c'),'scheduledAt')[_0x7687('0x3b')]('id','ContactId')['field'](LISTID[_0x7687('0x3d')](),_0x7687('0x38'))['field'](_0x167333['id']['toString'](),_0x5b5000)[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x39'))[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x3e'))[_0x7687('0x3f')](_0x7687('0x40'))[_0x7687('0x42')](_0x7687('0x41'))[_0x7687('0x42')]('ListId\x20=\x20?',LISTID[_0x7687('0x3d')]())['where'](_0x7687('0x46'),squel['str'](hopperContacts))[_0x7687('0x42')](_0x7687('0x44'))['where'](_0x7687('0x45'),squel[_0x7687('0x3a')]()['field'](_0x7687('0x47'))[_0x7687('0x3f')]('cm_hopper_final')[_0x7687('0x42')](_0x5b5000+_0x7687('0x48'),_0x167333['id']['toString']()))[_0x7687('0x42')](_0x7687('0x45'),squel[_0x7687('0x3a')]()[_0x7687('0x3b')]('phone')['from']('cm_hopper')['where'](_0x5b5000+'\x20=\x20?',_0x167333['id'][_0x7687('0x3d')]())))['toString']();return _0x1f855a;};function _0x4ae7ab(_0x3e898c,_0x40581e){var _0x3430b5=squel[_0x7687('0x31')]()[_0x7687('0x32')](_0x7687('0x33'))[_0x7687('0x34')]([_0x7687('0x35'),_0x7687('0x36'),'ContactId',_0x7687('0x38'),_0x40581e,_0x7687('0x39'),_0x7687('0x3e')],squel['select']()[_0x7687('0x3b')](_0x7687('0x35'),'phone')['field'](_0x7687('0x3c'),_0x7687('0x36'))[_0x7687('0x3b')]('id','ContactId')[_0x7687('0x3b')](LISTID[_0x7687('0x3d')](),'ListId')[_0x7687('0x3b')](_0x3e898c['id']['toString'](),_0x40581e)[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x39'))['field'](_0x7687('0x3c'),_0x7687('0x3e'))['from'](_0x7687('0x40'))[_0x7687('0x42')](_0x7687('0x41'))[_0x7687('0x42')]('ListId\x20=\x20?',LISTID[_0x7687('0x3d')]())[_0x7687('0x42')](_0x7687('0x46'),squel[_0x7687('0x49')](hopperContacts))[_0x7687('0x42')](_0x7687('0x44')))[_0x7687('0x3d')]();return _0x3430b5;}function _0x599a64(_0x42e3c5,_0x495c36){var _0xcbb366=squel['insert']()[_0x7687('0x32')](_0x7687('0x4a'))['fromQuery']([_0x7687('0x35'),_0x7687('0x37'),'ListId',_0x495c36,_0x7687('0x39'),'updatedAt'],squel['select']()[_0x7687('0x3b')](_0x7687('0x35'),_0x7687('0x35'))[_0x7687('0x3b')]('id',_0x7687('0x37'))[_0x7687('0x3b')](LISTID[_0x7687('0x3d')](),_0x7687('0x38'))['field'](_0x42e3c5['id'][_0x7687('0x3d')](),_0x495c36)[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x39'))[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x3e'))[_0x7687('0x3f')](_0x7687('0x40'))[_0x7687('0x42')](_0x7687('0x41'))['where'](_0x7687('0x43'),LISTID[_0x7687('0x3d')]())[_0x7687('0x42')]('id\x20IN\x20?',squel[_0x7687('0x49')](hopperContacts))[_0x7687('0x42')](_0x7687('0x44')))[_0x7687('0x3d')]();return _0xcbb366;}return db[_0x7687('0x4b')][_0x7687('0x4c')]({'where':{'type':_0x7687('0x4d')},'attributes':['id',_0x7687('0x4e')],'include':[{'model':db[_0x7687('0x4f')],'as':_0x7687('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x54b04f){var _0x80bb82=[];if(_0x54b04f){var _0xdef4e3;for(var _0x4b2913=0x0,_0x3f411f;_0x4b2913<_0x54b04f[_0x7687('0x26')];_0x4b2913+=0x1){_0x3f411f=_0x54b04f[_0x4b2913][_0x7687('0x51')]({'plain':!![]});switch(_0x3f411f['dialCheckDuplicateType']){case'always':_0x80bb82[_0x7687('0x52')](db[_0x7687('0x53')]['query'](_0x34b52b(_0x3f411f,_0x7687('0x54')))[_0x7687('0x2b')](function(){})['catch'](_0x2cff99()));break;case _0x7687('0x55'):_0x80bb82['push'](db['sequelize']['query'](_0x20ae1a(_0x3f411f,_0x7687('0x54')))[_0x7687('0x2b')](function(){})[_0x7687('0x56')](_0x2cff99()));break;default:_0x80bb82['push'](db[_0x7687('0x53')][_0x7687('0x57')](_0x4ae7ab(_0x3f411f,'VoiceQueueId'))[_0x7687('0x2b')](function(){})['catch'](_0x2cff99()));}}}return _0x80bb82;})[_0x7687('0x58')]()[_0x7687('0x2b')](function(){return db[_0x7687('0x4b')][_0x7687('0x4c')]({'where':{'type':_0x7687('0x4d')},'attributes':['id'],'include':[{'model':db[_0x7687('0x4f')],'as':_0x7687('0x59'),'where':{'id':LISTID}}]})[_0x7687('0x2b')](function(_0x901156){var _0x5bd7c1=[];if(_0x901156){var _0x164a13;for(var _0x1edfa9=0x0,_0xe987dc;_0x1edfa9<_0x901156['length'];_0x1edfa9+=0x1){_0xe987dc=_0x901156[_0x1edfa9][_0x7687('0x51')]({'plain':!![]});_0x5bd7c1[_0x7687('0x52')](db[_0x7687('0x53')][_0x7687('0x57')](_0x599a64(_0xe987dc,_0x7687('0x54')))[_0x7687('0x2b')](function(){})[_0x7687('0x56')](_0x2cff99()));}}return _0x5bd7c1;})[_0x7687('0x58')]();})['then'](function(){return db['Campaign'][_0x7687('0x4c')]({'attributes':['id',_0x7687('0x4e')],'include':[{'model':db['CmList'],'as':_0x7687('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x4ec454){var _0x380a4c=[];if(_0x4ec454){for(var _0x468356=0x0,_0x2de082;_0x468356<_0x4ec454['length'];_0x468356+=0x1){_0x2de082=_0x4ec454[_0x468356][_0x7687('0x51')]({'plain':!![]});switch(_0x2de082[_0x7687('0x4e')]){case _0x7687('0x5a'):_0x380a4c['push'](db['sequelize'][_0x7687('0x57')](_0x34b52b(_0x2de082,'CampaignId'))[_0x7687('0x2b')](function(){})[_0x7687('0x56')](_0x2cff99()));break;case'onlyIfOpen':_0x380a4c['push'](db['sequelize'][_0x7687('0x57')](_0x20ae1a(_0x2de082,_0x7687('0x5b')))['then'](function(){})['catch'](_0x2cff99()));break;default:_0x380a4c['push'](db[_0x7687('0x53')]['query'](_0x4ae7ab(_0x2de082,_0x7687('0x5b')))[_0x7687('0x2b')](function(){})[_0x7687('0x56')](_0x2cff99()));}}}return _0x380a4c;})[_0x7687('0x58')]();})[_0x7687('0x2b')](function(){return db[_0x7687('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7687('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x464664){var _0x1a6d87=[];if(_0x464664){for(var _0x274e85=0x0,_0x4ce6a3;_0x274e85<_0x464664[_0x7687('0x26')];_0x274e85+=0x1){_0x4ce6a3=_0x464664[_0x274e85]['get']({'plain':!![]});_0x1a6d87[_0x7687('0x52')](db[_0x7687('0x53')]['query'](_0x599a64(_0x4ce6a3,'CampaignId'))[_0x7687('0x2b')](function(){})[_0x7687('0x56')](_0x2cff99()));}}return _0x1a6d87;})[_0x7687('0x58')]();})[_0x7687('0x56')](function(_0x20fd57){logger[_0x7687('0x12')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x20fd57['message']);});}var processPromises=function(_0x4f82a5){return BPromise[_0x7687('0x58')](promises)[_0x7687('0x2b')](function(_0x137708){})[_0x7687('0x56')](function(_0x519add){logger['error'](_0x7687('0x5d'),JSON[_0x7687('0x5e')](_0x519add));})['finally'](function(){socket[_0x7687('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4f82a5){return _0x4f82a5[_0x7687('0x60')]();}});};var endCsv=function(){return BPromise[_0x7687('0x61')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7687('0x2b')](function(){socket[_0x7687('0x5f')](_0x7687('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7687('0x63')](FILEPATH);}catch(_0x1cb78c){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x7687('0x5e')](_0x1cb78c));}finally{process[_0x7687('0x64')](0x0);}});};process['on'](_0x7687('0x65'),function(){logger['info'](_0x7687('0x66'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x7687('0x29')][_0x7687('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7687('0x2b')](function(_0x48bef1){var _0x48964f=fs[_0x7687('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7687('0x68')](_0x48964f,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5be92d,_0x4069b2){total+=0x1;var _0xcd884d=total;promises[_0x7687('0x52')](checkRow(_0x5be92d,_0x48bef1,_0xcd884d)['then'](function(){success+=0x1;})[_0x7687('0x56')](function(_0x3c6ecf){if(_0x3c6ecf[_0x7687('0x12')]){errors+=0x1;delete _0x3c6ecf[_0x7687('0x12')];}else if(_0x3c6ecf[_0x7687('0x28')]){duplicates+=0x1;delete _0x3c6ecf[_0x7687('0x28')];}rows[_0x7687('0x52')](_0x3c6ecf);}));if(total%0xc8===0x0){_0x4069b2[_0x7687('0x69')]();return processPromises(_0x4069b2);}},'complete':function(){return processPromises()[_0x7687('0x2b')](function(){logger[_0x7687('0x6a')](_0x7687('0x6b'));endCsv();});},'error':function(_0x42263f,_0x37986f){logger['info']('CSV\x20parse\x20error',JSON[_0x7687('0x5e')](_0x42263f));endCsv();}});})[_0x7687('0x56')](function(_0x17b278){logger[_0x7687('0x12')](_0x7687('0x6c'),JSON[_0x7687('0x5e')](_0x17b278));});}main(); \ No newline at end of file +var _0x45ba=['cm_hopper_black','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','sequelize','query','VoiceQueueId','all','CmList','BlackLists','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','hasOwnProperty','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','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','ContactId','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x45ba,0x99));var _0xa45b=function(_0x58e023,_0x5d2c38){_0x58e023=_0x58e023-0x0;var _0x3e96d0=_0x45ba[_0x58e023];return _0x3e96d0;};'use strict';var BPromise=require(_0xa45b('0x0'));var util=require(_0xa45b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xa45b('0x2'));var Papa=require(_0xa45b('0x3'));var Redis=require(_0xa45b('0x4'));var db=require(_0xa45b('0x5'))['db'];var config=require(_0xa45b('0x6'));var logger=require(_0xa45b('0x7'))(_0xa45b('0x8'));config[_0xa45b('0x9')]=_['defaults'](config[_0xa45b('0x9')],{'host':_0xa45b('0xa'),'port':0x18eb});var socket=require(_0xa45b('0xb'))(new Redis(config[_0xa45b('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0xa45b('0xc')](socket);try{if(!process[_0xa45b('0xd')][0x2]||process[_0xa45b('0xd')][0x2]===_0xa45b('0xe')||process[_0xa45b('0xd')][0x2]===_0xa45b('0xf')){throw new Error(_0xa45b('0x10'));}var FILEPATH=process[_0xa45b('0xd')][0x2];if(!process[_0xa45b('0xd')][0x3]||process['argv'][0x3]===_0xa45b('0xe')||process[_0xa45b('0xd')][0x3]===_0xa45b('0xf')||!process[_0xa45b('0xd')][0x4]||process[_0xa45b('0xd')][0x4]===_0xa45b('0xe')||process[_0xa45b('0xd')][0x4]===_0xa45b('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xa45b('0x11')](process[_0xa45b('0xd')][0x3]['split'](','),process['argv'][0x4][_0xa45b('0x12')](','));if(!process[_0xa45b('0xd')][0x5]||process[_0xa45b('0xd')][0x5]===_0xa45b('0xe')||process[_0xa45b('0xd')][0x5]===_0xa45b('0xf')){throw new Error(_0xa45b('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xa45b('0xd')][0x6]!=='undefined'&&process[_0xa45b('0xd')][0x6]!==_0xa45b('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0xa45b('0xd')][0x7]&&process[_0xa45b('0xd')][0x7]!==_0xa45b('0xe')&&process[_0xa45b('0xd')][0x7]!==_0xa45b('0xf')?process[_0xa45b('0xd')][0x7]:null;if(!process[_0xa45b('0xd')][0x8]||process[_0xa45b('0xd')][0x8]==='undefined'||process[_0xa45b('0xd')][0x8]===_0xa45b('0xf')){throw new Error(_0xa45b('0x14'));}var SOCKET_TIMESTAMP=process[_0xa45b('0xd')][0x8];}catch(_0x3b07da){logger[_0xa45b('0x15')](_0x3b07da);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(_0x2e5db8,_0x131593,_0x5e57fb,_0x47e7d8){var _0x4c5e65={'message':_0x131593};_0x4c5e65[_0x2e5db8]=!![];if(_0x5e57fb){_0x4c5e65[_0xa45b('0x16')]=_0x5e57fb;}if(_0x47e7d8){_0x4c5e65[_0xa45b('0x17')]=_0x47e7d8;}return _0x4c5e65;}function isEmail(_0x4ff13b){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))*$/[_0xa45b('0x18')](_0x4ff13b);}function checkRow(_0xbb09ef,_0x4fca7b,_0x476629){return new BPromise(function(_0x212cd9,_0x32ebd7){if(_[_0xa45b('0x19')](_0xbb09ef)){return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0xa45b('0x1a'),null,_0x476629));}if(_0xbb09ef[_0xa45b('0x1b')]&&_0xbb09ef[_0xa45b('0x1b')]['length']){var _0x51bec2=_[_0xa45b('0x1c')](_0xbb09ef[_0xa45b('0x1b')],'message')[_0xa45b('0x1d')](';');return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0x51bec2,null,_0x476629));}var _0x19cc3a={};for(var _0x44b0e9 in FIELDS){if(FIELDS[_0xa45b('0x1e')](_0x44b0e9)&&FIELDS[_0x44b0e9]){_0x19cc3a[_0x44b0e9]=_0xbb09ef[_0xa45b('0x1f')][0x0][FIELDS[_0x44b0e9]]||_0xbb09ef[_0xa45b('0x1f')][0x0]['\ufeff'+FIELDS[_0x44b0e9]];}}if(!_0x19cc3a[_0xa45b('0x20')]){return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0xa45b('0x21'),null,_0x476629));}if(!_0x19cc3a[_0xa45b('0x22')]){return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0xa45b('0x23'),null,_0x476629));}if(_0x19cc3a[_0xa45b('0x24')]){var _0x661163=moment(_0x19cc3a[_0xa45b('0x24')],_0xa45b('0x25'));if(!_0x661163[_0xa45b('0x26')]()){return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0xa45b('0x27'),null,_0x476629));}}if(_0x19cc3a['email']){if(!isEmail(_0x19cc3a[_0xa45b('0x28')])){return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0xa45b('0x29'),null,_0x476629));}}_0x19cc3a[_0xa45b('0x2a')]=LISTID;_0x19cc3a[_0xa45b('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa45b('0x2c')]&&_0x4fca7b){var _0xc45232={};for(var _0x4be11e=0x0,_0x457469=DUPLICATES[_0xa45b('0x2c')];_0x4be11e<_0x457469;_0x4be11e+=0x1){_0xc45232[DUPLICATES[_0x4be11e]]=_0x19cc3a[DUPLICATES[_0x4be11e]];}var _0x1ae697=_[_0xa45b('0x2d')](_0x4fca7b,_0xc45232);if(_0x1ae697){return _0x32ebd7(handleCheckRowError(_0xa45b('0x2e'),'Duplicate\x20Contact',_0x1ae697,_0x476629));}}return db[_0xa45b('0x2f')]['create'](_0x19cc3a,{'raw':!![],'hooks':![],'fields':_[_0xa45b('0x30')](_0x19cc3a)})[_0xa45b('0x31')](function(_0x3ce3e3){if(DUPLICATES&&DUPLICATES[_0xa45b('0x2c')]&&_0x4fca7b){_0x4fca7b[_0xa45b('0x32')](_[_0xa45b('0x33')](_0x19cc3a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3ce3e3['id'];return _0x212cd9();})[_0xa45b('0x34')](function(_0x10461e){return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0xa45b('0x35')+(_0x10461e[_0xa45b('0x36')]||JSON[_0xa45b('0x37')](_0x10461e)),null,_0x476629));});});}function checkHopper(){function _0x26df8b(){return function(_0x194974){logger[_0xa45b('0x15')](_0xa45b('0x38'),_0xa45b('0x39'),util['inspect'](_0x194974,{'showHidden':![],'depth':null}));};}var _0x5b1dc7=function(_0x577aa3,_0x3e0594){var _0xd0cf80=squel[_0xa45b('0x3a')]()[_0xa45b('0x3b')](_0xa45b('0x3c'))[_0xa45b('0x3d')](['phone',_0xa45b('0x3e'),'ContactId','ListId',_0x3e0594,_0xa45b('0x3f'),_0xa45b('0x40')],squel[_0xa45b('0x41')]()['field'](_0xa45b('0x22'),_0xa45b('0x22'))[_0xa45b('0x42')]('NOW()',_0xa45b('0x3e'))[_0xa45b('0x42')]('id',_0xa45b('0x43'))['field'](LISTID['toString'](),_0xa45b('0x2a'))[_0xa45b('0x42')](_0x577aa3['id'][_0xa45b('0x44')](),_0x3e0594)['field']('NOW()',_0xa45b('0x3f'))[_0xa45b('0x42')](_0xa45b('0x45'),_0xa45b('0x40'))[_0xa45b('0x46')](_0xa45b('0x47'))[_0xa45b('0x48')](_0xa45b('0x49'))[_0xa45b('0x48')](_0xa45b('0x4a'),LISTID[_0xa45b('0x44')]())[_0xa45b('0x48')](_0xa45b('0x4b'))[_0xa45b('0x48')](_0xa45b('0x4c'),squel['select']()['field'](_0xa45b('0x22'))[_0xa45b('0x46')]('cm_hopper')[_0xa45b('0x48')](_0x3e0594+_0xa45b('0x4d'),_0x577aa3['id'][_0xa45b('0x44')]())))[_0xa45b('0x44')]();return _0xd0cf80;};var _0x5b317f=function(_0x34d1f8,_0x3d949e){var _0x32cfbf=squel[_0xa45b('0x3a')]()[_0xa45b('0x3b')](_0xa45b('0x3c'))['fromQuery']([_0xa45b('0x22'),_0xa45b('0x3e'),_0xa45b('0x43'),'ListId',_0x3d949e,'createdAt',_0xa45b('0x40')],squel[_0xa45b('0x41')]()['field'](_0xa45b('0x22'),_0xa45b('0x22'))[_0xa45b('0x42')](_0xa45b('0x45'),_0xa45b('0x3e'))[_0xa45b('0x42')]('id',_0xa45b('0x43'))['field'](LISTID[_0xa45b('0x44')](),'ListId')[_0xa45b('0x42')](_0x34d1f8['id'][_0xa45b('0x44')](),_0x3d949e)[_0xa45b('0x42')](_0xa45b('0x45'),_0xa45b('0x3f'))[_0xa45b('0x42')](_0xa45b('0x45'),_0xa45b('0x40'))['from'](_0xa45b('0x47'))[_0xa45b('0x48')]('deletedAt\x20IS\x20NULL')[_0xa45b('0x48')]('ListId\x20=\x20?',LISTID['toString']())[_0xa45b('0x48')]('id\x20IN\x20?',squel[_0xa45b('0x4e')](hopperContacts))[_0xa45b('0x48')](_0xa45b('0x4b'))[_0xa45b('0x48')](_0xa45b('0x4c'),squel[_0xa45b('0x41')]()['field'](_0xa45b('0x4f'))[_0xa45b('0x46')](_0xa45b('0x50'))[_0xa45b('0x48')](_0x3d949e+'\x20=\x20?',_0x34d1f8['id'][_0xa45b('0x44')]()))[_0xa45b('0x48')](_0xa45b('0x4c'),squel[_0xa45b('0x41')]()['field'](_0xa45b('0x22'))[_0xa45b('0x46')](_0xa45b('0x3c'))['where'](_0x3d949e+_0xa45b('0x4d'),_0x34d1f8['id'][_0xa45b('0x44')]())))[_0xa45b('0x44')]();return _0x32cfbf;};function _0x53cd2c(_0xaaf96d,_0xe07593){var _0x4a5b45=squel['insert']()[_0xa45b('0x3b')](_0xa45b('0x3c'))[_0xa45b('0x3d')]([_0xa45b('0x22'),_0xa45b('0x3e'),'ContactId',_0xa45b('0x2a'),_0xe07593,_0xa45b('0x3f'),'updatedAt'],squel['select']()[_0xa45b('0x42')](_0xa45b('0x22'),_0xa45b('0x22'))[_0xa45b('0x42')](_0xa45b('0x45'),_0xa45b('0x3e'))[_0xa45b('0x42')]('id','ContactId')[_0xa45b('0x42')](LISTID[_0xa45b('0x44')](),_0xa45b('0x2a'))[_0xa45b('0x42')](_0xaaf96d['id'][_0xa45b('0x44')](),_0xe07593)[_0xa45b('0x42')]('NOW()',_0xa45b('0x3f'))['field'](_0xa45b('0x45'),_0xa45b('0x40'))[_0xa45b('0x46')](_0xa45b('0x47'))[_0xa45b('0x48')](_0xa45b('0x49'))[_0xa45b('0x48')](_0xa45b('0x4a'),LISTID[_0xa45b('0x44')]())[_0xa45b('0x48')]('id\x20IN\x20?',squel[_0xa45b('0x4e')](hopperContacts))[_0xa45b('0x48')](_0xa45b('0x4b')))[_0xa45b('0x44')]();return _0x4a5b45;}function _0x5f1512(_0x445761,_0x1375e4){var _0x62871a=squel[_0xa45b('0x3a')]()[_0xa45b('0x3b')](_0xa45b('0x51'))[_0xa45b('0x3d')]([_0xa45b('0x22'),'ContactId',_0xa45b('0x2a'),_0x1375e4,_0xa45b('0x3f'),_0xa45b('0x40')],squel['select']()[_0xa45b('0x42')]('phone','phone')['field']('id',_0xa45b('0x43'))[_0xa45b('0x42')](LISTID[_0xa45b('0x44')](),_0xa45b('0x2a'))[_0xa45b('0x42')](_0x445761['id'][_0xa45b('0x44')](),_0x1375e4)[_0xa45b('0x42')](_0xa45b('0x45'),_0xa45b('0x3f'))['field'](_0xa45b('0x45'),_0xa45b('0x40'))[_0xa45b('0x46')](_0xa45b('0x47'))[_0xa45b('0x48')](_0xa45b('0x49'))[_0xa45b('0x48')](_0xa45b('0x4a'),LISTID['toString']())[_0xa45b('0x48')](_0xa45b('0x52'),squel[_0xa45b('0x4e')](hopperContacts))[_0xa45b('0x48')](_0xa45b('0x4b')))[_0xa45b('0x44')]();return _0x62871a;}return db[_0xa45b('0x53')][_0xa45b('0x54')]({'where':{'type':_0xa45b('0x55')},'attributes':['id',_0xa45b('0x56')],'include':[{'model':db['CmList'],'as':_0xa45b('0x57'),'where':{'id':LISTID}}]})[_0xa45b('0x31')](function(_0x1bcea5){var _0x2db574=[];if(_0x1bcea5){var _0x446894;for(var _0x1fa475=0x0,_0x2bebde;_0x1fa475<_0x1bcea5[_0xa45b('0x2c')];_0x1fa475+=0x1){_0x2bebde=_0x1bcea5[_0x1fa475][_0xa45b('0x58')]({'plain':!![]});switch(_0x2bebde[_0xa45b('0x56')]){case _0xa45b('0x59'):_0x2db574['push'](db[_0xa45b('0x5a')][_0xa45b('0x5b')](_0x5b317f(_0x2bebde,_0xa45b('0x5c')))[_0xa45b('0x31')](function(){})[_0xa45b('0x34')](_0x26df8b()));break;case'onlyIfOpen':_0x2db574[_0xa45b('0x32')](db[_0xa45b('0x5a')][_0xa45b('0x5b')](_0x5b1dc7(_0x2bebde,'VoiceQueueId'))[_0xa45b('0x31')](function(){})[_0xa45b('0x34')](_0x26df8b()));break;default:_0x2db574['push'](db[_0xa45b('0x5a')][_0xa45b('0x5b')](_0x53cd2c(_0x2bebde,_0xa45b('0x5c')))['then'](function(){})[_0xa45b('0x34')](_0x26df8b()));}}}return _0x2db574;})[_0xa45b('0x5d')]()[_0xa45b('0x31')](function(){return db[_0xa45b('0x53')]['findAll']({'where':{'type':_0xa45b('0x55')},'attributes':['id'],'include':[{'model':db[_0xa45b('0x5e')],'as':_0xa45b('0x5f'),'where':{'id':LISTID}}]})[_0xa45b('0x31')](function(_0x3a2322){var _0x3ce3d2=[];if(_0x3a2322){var _0x5eb2fb;for(var _0x2596c8=0x0,_0x3c0e6a;_0x2596c8<_0x3a2322['length'];_0x2596c8+=0x1){_0x3c0e6a=_0x3a2322[_0x2596c8][_0xa45b('0x58')]({'plain':!![]});_0x3ce3d2[_0xa45b('0x32')](db[_0xa45b('0x5a')][_0xa45b('0x5b')](_0x5f1512(_0x3c0e6a,_0xa45b('0x5c')))[_0xa45b('0x31')](function(){})[_0xa45b('0x34')](_0x26df8b()));}}return _0x3ce3d2;})[_0xa45b('0x5d')]();})[_0xa45b('0x31')](function(){return db[_0xa45b('0x60')]['findAll']({'attributes':['id',_0xa45b('0x56')],'include':[{'model':db[_0xa45b('0x5e')],'as':_0xa45b('0x57'),'where':{'id':LISTID}}]})[_0xa45b('0x31')](function(_0x79b35c){var _0x3c7ff1=[];if(_0x79b35c){for(var _0x4361e4=0x0,_0x3de3a2;_0x4361e4<_0x79b35c[_0xa45b('0x2c')];_0x4361e4+=0x1){_0x3de3a2=_0x79b35c[_0x4361e4][_0xa45b('0x58')]({'plain':!![]});switch(_0x3de3a2['dialCheckDuplicateType']){case _0xa45b('0x59'):_0x3c7ff1[_0xa45b('0x32')](db[_0xa45b('0x5a')]['query'](_0x5b317f(_0x3de3a2,_0xa45b('0x61')))['then'](function(){})[_0xa45b('0x34')](_0x26df8b()));break;case _0xa45b('0x62'):_0x3c7ff1[_0xa45b('0x32')](db['sequelize']['query'](_0x5b1dc7(_0x3de3a2,_0xa45b('0x61')))[_0xa45b('0x31')](function(){})['catch'](_0x26df8b()));break;default:_0x3c7ff1[_0xa45b('0x32')](db[_0xa45b('0x5a')]['query'](_0x53cd2c(_0x3de3a2,_0xa45b('0x61')))[_0xa45b('0x31')](function(){})[_0xa45b('0x34')](_0x26df8b()));}}}return _0x3c7ff1;})[_0xa45b('0x5d')]();})[_0xa45b('0x31')](function(){return db[_0xa45b('0x60')][_0xa45b('0x54')]({'attributes':['id'],'include':[{'model':db[_0xa45b('0x5e')],'as':_0xa45b('0x5f'),'where':{'id':LISTID}}]})[_0xa45b('0x31')](function(_0x3e2eac){var _0x3fea7c=[];if(_0x3e2eac){for(var _0x2b5f59=0x0,_0x590373;_0x2b5f59<_0x3e2eac[_0xa45b('0x2c')];_0x2b5f59+=0x1){_0x590373=_0x3e2eac[_0x2b5f59][_0xa45b('0x58')]({'plain':!![]});_0x3fea7c['push'](db[_0xa45b('0x5a')][_0xa45b('0x5b')](_0x5f1512(_0x590373,_0xa45b('0x61')))[_0xa45b('0x31')](function(){})[_0xa45b('0x34')](_0x26df8b()));}}return _0x3fea7c;})[_0xa45b('0x5d')]();})[_0xa45b('0x34')](function(_0x4b1336){logger['error'](_0xa45b('0x63'),_0xa45b('0x64'),_0x4b1336[_0xa45b('0x36')]);});}var processPromises=function(_0x3e9a23){return BPromise[_0xa45b('0x5d')](promises)[_0xa45b('0x31')](function(_0x39dbb1){})[_0xa45b('0x34')](function(_0x1e57ce){logger[_0xa45b('0x15')](_0xa45b('0x65'),JSON[_0xa45b('0x37')](_0x1e57ce));})[_0xa45b('0x66')](function(){socket[_0xa45b('0x67')](_0xa45b('0x68')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3e9a23){return _0x3e9a23[_0xa45b('0x69')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xa45b('0x67')](_0xa45b('0x68')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa45b('0x6a')](FILEPATH);}catch(_0x4cd796){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x4cd796));}finally{process[_0xa45b('0x6b')](0x0);}});};process['on'](_0xa45b('0x6c'),function(){logger[_0xa45b('0x6d')](_0xa45b('0x6e'));endCsv();});function main(){return BPromise[_0xa45b('0x6f')]()[_0xa45b('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa45b('0x12')](',');return db[_0xa45b('0x2f')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa45b('0x31')](function(_0xa37188){var _0x5bb0fb=fs[_0xa45b('0x70')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa45b('0x71')](_0x5bb0fb,{'header':!![],'skipEmptyLines':!![],'step':function(_0xd5509d,_0x199a15){total+=0x1;var _0x5f4b63=total;promises[_0xa45b('0x32')](checkRow(_0xd5509d,_0xa37188,_0x5f4b63)['then'](function(){success+=0x1;})['catch'](function(_0x4c6479){if(_0x4c6479[_0xa45b('0x15')]){errors+=0x1;delete _0x4c6479[_0xa45b('0x15')];}else if(_0x4c6479['duplicate']){duplicates+=0x1;delete _0x4c6479[_0xa45b('0x2e')];}rows[_0xa45b('0x32')](_0x4c6479);}));if(total%0xc8===0x0){_0x199a15[_0xa45b('0x72')]();return processPromises(_0x199a15);}},'complete':function(){return processPromises()[_0xa45b('0x31')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xc84131,_0x40694c){logger[_0xa45b('0x6d')](_0xa45b('0x73'),JSON['stringify'](_0xc84131));endCsv();}});})['catch'](function(_0x15c747){logger[_0xa45b('0x15')](_0xa45b('0x74'),JSON[_0xa45b('0x37')](_0x15c747));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index c22218e..152cb47 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 _0xfd58=['bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','test','select','field','from','join','.id\x20=\x20','where','CmContact','findAll','AdditionalPhones','then','push','all','split','length','isNil','filter','findOne','CmContactHasItem','update','updated','PHONE','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.phone','cm_hopper_black','phone','cm_contacts','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','ListId\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','message','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','keys','includes','header','ContactItemType','name','_description','writeFileSync','parse','data','rows','find','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','itemTypeId','description','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','affectedRows','contact:import:','unlink','argv','arguments\x20\x20\x20','existsSync','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util'];(function(_0x597ad5,_0x508711){var _0x4aa714=function(_0x3f58fd){while(--_0x3f58fd){_0x597ad5['push'](_0x597ad5['shift']());}};_0x4aa714(++_0x508711);}(_0xfd58,0xb3));var _0x8fd5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd58[_0x2641f9];return _0x585741;};'use strict';var fs=require('fs');var path=require(_0x8fd5('0x0'));var _=require(_0x8fd5('0x1'));var Papa=require('papaparse');var util=require(_0x8fd5('0x2'));var BPromise=require(_0x8fd5('0x3'));var moment=require('moment');var squel=require(_0x8fd5('0x4'));var Redis=require(_0x8fd5('0x5'));var db=require(_0x8fd5('0x6'))['db'];var config=require(_0x8fd5('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0x8fd5('0x8'))(_0x8fd5('0x9'));config[_0x8fd5('0xa')]=_['defaults'](config[_0x8fd5('0xa')],{'host':_0x8fd5('0xb'),'port':0x18eb});var socket=require(_0x8fd5('0xc'))(new Redis(config[_0x8fd5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x8fd5('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x8fd5('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4db571){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))*$/[_0x8fd5('0xe')](_0x4db571);}function selectNotIn(_0x148ad1,_0x49d8c7,_0x2b8942,_0x346492,_0x5c5c21){return squel[_0x8fd5('0xf')]()[_0x8fd5('0x10')]('phone')[_0x8fd5('0x11')](_0x346492)[_0x8fd5('0x12')](_0x49d8c7,null,_0x49d8c7+_0x8fd5('0x13')+_0x346492+'.'+_0x2b8942)[_0x8fd5('0x14')](_0x346492+'.'+_0x2b8942+'\x20=\x20'+_0x148ad1+'.'+_0x2b8942)['where'](_0x49d8c7+'.dialCheckDuplicateType\x20IN\x20('+_0x5c5c21[_0x8fd5('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1c60c5,_0x3f66d8){promisesAdditionalPhones=[];return db[_0x8fd5('0x15')][_0x8fd5('0x16')]({'raw':!![],'attributes':['id',_0x8fd5('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x8fd5('0x18')](function(_0x3aa9e6){if(_0x3aa9e6!==null){var _0x2f18df=[];for(var _0x10ec68=0x0;_0x10ec68<_0x3aa9e6['length'];_0x10ec68++){var _0x418037=_0x3aa9e6[_0x10ec68];_0x2f18df[_0x8fd5('0x19')](insertAdditionalPhones(_0x418037));}}Promise[_0x8fd5('0x1a')](_0x2f18df)['then'](function(){_0x1c60c5({'val':0x1});});});});}function insertAdditionalPhones(_0x4e8e9d){return new Promise(function(_0x5daea6,_0x8509c8){var _0x220f08=_0x4e8e9d[_0x8fd5('0x17')];var _0x46b728=_0x220f08[_0x8fd5('0x1b')](';');var _0x495ef7=[];orderBy=0x0;for(var _0x52d076=0x0;_0x52d076<_0x46b728[_0x8fd5('0x1c')];_0x52d076++){_0x495ef7['push'](splitAdditionalPhone(_0x4e8e9d['id'],_0x46b728[_0x52d076]));}Promise[_0x8fd5('0x1a')](_0x495ef7)[_0x8fd5('0x18')](function(){_0x5daea6({'val':_0x46b728[_0x8fd5('0x1c')]});});});}function splitAdditionalPhone(_0xadd988,_0x4924cd){return new Promise(function(_0x507689,_0x583293){var _0x36385c=_0x4924cd['split'](':');var _0x180f8d=_0x36385c[0x0];var _0x40f729=_0x36385c[0x1];if(!_[_0x8fd5('0x1d')](_0x40f729)){var _0x6b7da9=_0x40f729['split']('|');var _0x411084=[];for(var _0x42eab8=0x0;_0x42eab8<_0x6b7da9[_0x8fd5('0x1c')];_0x42eab8++){if(_0x6b7da9[_0x42eab8]!==''){var _0x3057eb=_[_0x8fd5('0x1e')](promisesAdditionalPhones,{'contactId':_0xadd988,'phone':_0x6b7da9[_0x42eab8]});if(_0x3057eb['length']==0x0){orderBy++;promisesAdditionalPhones[_0x8fd5('0x19')]({'contactId':_0xadd988,'contactTypeId':_0x180f8d,'phone':_0x6b7da9[_0x42eab8],'orderBy':orderBy});}}}_0x507689({'ok':0x1});}else _0x507689({'res':0x0});});}function createAdditionalPhone(_0x34bf0c,_0x1f496d,_0x5b7d8c,_0x5dd206){var _0x884f79='';var _0x3a849a='';var _0x4ddd3b=_0x5b7d8c[_0x8fd5('0x1b')]('§');_0x884f79=_0x4ddd3b[0x0];if(_0x4ddd3b[_0x8fd5('0x1c')]==0x2)_0x3a849a=_0x4ddd3b[0x1];return new Promise(function(_0x1b10f3,_0x1b5509){return db['CmContactHasItem'][_0x8fd5('0x1f')]({'where':{'CmContactId':_0x34bf0c,'item':_0x884f79}})[_0x8fd5('0x18')](function(_0x4906f1){if(_0x4906f1){return db[_0x8fd5('0x20')][_0x8fd5('0x21')]({'ItemTypeId':_0x1f496d,'description':_0x3a849a,'OrderBy':_0x5dd206},{'where':{'CmContactId':_0x34bf0c,'item':_0x884f79}})[_0x8fd5('0x18')](function(_0x40c3be){_0x1b10f3({'res':_0x8fd5('0x22')});});}else{return db[_0x8fd5('0x20')]['create']({'CmContactId':_0x34bf0c,'item':_0x884f79,'description':_0x3a849a,'ItemTypeId':_0x1f496d,'OrderBy':_0x5dd206,'ItemClass':_0x8fd5('0x23')})[_0x8fd5('0x18')](function(_0x1c1565){_0x1b10f3({'res':'inserted'});});}});});}function insertCmHopper(_0xffa204,_0x386b5c,_0x32db0e,_0x89a42a,_0x4bedbb){var _0x5f3635=['cm_contacts.phone','cm_contacts.scheduledat',_0x8fd5('0x24'),_0x8fd5('0x25'),_0x386b5c+'.'+_0x89a42a,_0x8fd5('0x26'),_0x8fd5('0x27'),'cm_contacts.priority',_0x8fd5('0x28'),'\x22'+_0x4bedbb+'\x22'];return squel[_0x8fd5('0x29')]()[_0x8fd5('0x2a')](_0x8fd5('0x2b'))[_0x8fd5('0x2c')](['phone',_0x8fd5('0x2d'),_0x8fd5('0x2e'),_0x8fd5('0x2f'),_0x89a42a,_0x8fd5('0x30'),_0x8fd5('0x31'),_0x8fd5('0x32'),_0x8fd5('0x33'),_0x8fd5('0x34')],squel[_0x8fd5('0xf')]()[_0x8fd5('0x35')](_0x5f3635)['from'](_0x386b5c)[_0x8fd5('0x12')]('cm_contacts',null,_0x8fd5('0x36')+_0x386b5c+_0x8fd5('0x37'))[_0x8fd5('0x12')](_0x32db0e,null,_0x32db0e+_0x8fd5('0x13')+_0x386b5c+'.'+_0x89a42a)[_0x8fd5('0x14')](_0x386b5c+_0x8fd5('0x38'),_0xffa204)['where'](_0x8fd5('0x39'),NOW)[_0x8fd5('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x386b5c,_0x32db0e,_0x89a42a,'cm_hopper',['\x22always\x22',_0x8fd5('0x3a')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x386b5c,_0x32db0e,_0x89a42a,'cm_hopper',[_0x8fd5('0x3b')])))[_0x8fd5('0x3c')]();}function insertCmHopperBlack(_0x5259b8,_0x2d7590,_0x1218b5,_0x4109b9){var _0x579438=[_0x8fd5('0x3d'),_0x8fd5('0x24'),_0x8fd5('0x25'),_0x2d7590+'.'+_0x4109b9,_0x8fd5('0x26'),_0x8fd5('0x27')];return squel[_0x8fd5('0x29')]()[_0x8fd5('0x2a')](_0x8fd5('0x3e'))[_0x8fd5('0x2c')]([_0x8fd5('0x3f'),'ContactId',_0x8fd5('0x2f'),_0x4109b9,_0x8fd5('0x30'),_0x8fd5('0x31')],squel['select']()['fields'](_0x579438)[_0x8fd5('0x11')](_0x2d7590)[_0x8fd5('0x12')](_0x8fd5('0x40'),null,_0x8fd5('0x36')+_0x2d7590+'.CmListId')[_0x8fd5('0x12')](_0x1218b5,null,_0x1218b5+'.id\x20=\x20'+_0x2d7590+'.'+_0x4109b9)[_0x8fd5('0x14')](_0x2d7590+_0x8fd5('0x38'),_0x5259b8)['where'](_0x8fd5('0x39'),NOW)[_0x8fd5('0x14')](_0x8fd5('0x41'),squel['select']()[_0x8fd5('0x10')](_0x8fd5('0x3f'))['from'](_0x8fd5('0x3e'))[_0x8fd5('0x14')]('ListId\x20=\x20?',_0x5259b8)['where'](_0x4109b9+_0x8fd5('0x42')+_0x2d7590+'.'+_0x4109b9)))[_0x8fd5('0x3c')]();}function insertTzCmHopper(_0x1e8e98,_0x5701b9,_0x44ad4a,_0x2a372c,_0x5be08d,_0x4cc4a1){var _0x1c7d88=[_0x8fd5('0x3d'),_0x8fd5('0x43')+_0x4cc4a1+_0x8fd5('0x44'),_0x8fd5('0x24'),'cm_contacts.ListId',_0x5701b9+'.'+_0x2a372c,'cm_contacts.createdAt',_0x8fd5('0x27'),_0x8fd5('0x45'),_0x8fd5('0x28'),'\x22'+_0x5be08d+'\x22'];var _0xe3106e=squel[_0x8fd5('0x29')]()[_0x8fd5('0x2a')](_0x8fd5('0x2b'))['fromQuery']([_0x8fd5('0x3f'),_0x8fd5('0x2d'),'ContactId',_0x8fd5('0x2f'),_0x2a372c,_0x8fd5('0x30'),'updatedAt',_0x8fd5('0x32'),_0x8fd5('0x33'),_0x8fd5('0x34')],squel[_0x8fd5('0xf')]()[_0x8fd5('0x35')](_0x1c7d88)[_0x8fd5('0x11')](_0x5701b9)[_0x8fd5('0x12')]('cm_contacts',null,_0x8fd5('0x36')+_0x5701b9+'.CmListId')[_0x8fd5('0x12')](_0x44ad4a,null,_0x44ad4a+_0x8fd5('0x13')+_0x5701b9+'.'+_0x2a372c)[_0x8fd5('0x12')](_0x4cc4a1,null,_0x4cc4a1+_0x8fd5('0x13')+_0x5701b9+'.'+_0x2a372c)['where'](_0x5701b9+_0x8fd5('0x38'),_0x1e8e98)['where'](_0x8fd5('0x39'),NOW)[_0x8fd5('0x14')](_0x8fd5('0x41'),selectNotIn(_0x5701b9,_0x44ad4a,_0x2a372c,'cm_hopper',[_0x8fd5('0x3b'),_0x8fd5('0x3a')]))[_0x8fd5('0x14')](_0x8fd5('0x41'),selectNotIn(_0x5701b9,_0x44ad4a,_0x2a372c,_0x8fd5('0x2b'),[_0x8fd5('0x3b')])))[_0x8fd5('0x3c')]();return _0xe3106e;}function insertTzCmHopperBlack(_0x12a2f7,_0x2c7679,_0x5b9611,_0x229ab6){var _0x4886cf=[_0x8fd5('0x3d'),_0x8fd5('0x24'),_0x8fd5('0x25'),_0x2c7679+'.'+_0x229ab6,_0x8fd5('0x26'),_0x8fd5('0x27')];return squel['insert']()['into']('cm_hopper_black')['fromQuery'](['phone','ContactId',_0x8fd5('0x2f'),_0x229ab6,_0x8fd5('0x30'),_0x8fd5('0x31')],squel['select']()[_0x8fd5('0x35')](_0x4886cf)['from'](_0x2c7679)[_0x8fd5('0x12')](_0x8fd5('0x40'),null,_0x8fd5('0x36')+_0x2c7679+'.CmListId')[_0x8fd5('0x12')](_0x5b9611,null,_0x5b9611+_0x8fd5('0x13')+_0x2c7679+'.'+_0x229ab6)[_0x8fd5('0x14')](_0x2c7679+_0x8fd5('0x38'),_0x12a2f7)[_0x8fd5('0x14')](_0x8fd5('0x39'),NOW)[_0x8fd5('0x14')](_0x8fd5('0x41'),squel[_0x8fd5('0xf')]()[_0x8fd5('0x10')](_0x8fd5('0x3f'))[_0x8fd5('0x11')](_0x8fd5('0x3e'))[_0x8fd5('0x14')](_0x8fd5('0x46'),_0x12a2f7)['where'](_0x229ab6+_0x8fd5('0x42')+_0x2c7679+'.'+_0x229ab6)))[_0x8fd5('0x3c')]();}function insertCmHopperAdditionalPhones(_0x1e219f){var _0x5293eb=['cm_hopper.id',_0x8fd5('0x47'),_0x8fd5('0x48'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x8fd5('0x29')]()['into']('cm_hopper_additional_phones')[_0x8fd5('0x2c')](['CmHopperId',_0x8fd5('0x3f'),'OrderBy',_0x8fd5('0x30'),_0x8fd5('0x31')],squel[_0x8fd5('0xf')]()[_0x8fd5('0x35')](_0x5293eb)[_0x8fd5('0x11')]('cm_hopper')['join']('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x8fd5('0x12')](_0x8fd5('0x49'),null,_0x8fd5('0x4a'))[_0x8fd5('0x14')](_0x8fd5('0x4b'),_0x1e219f)[_0x8fd5('0x14')](_0x8fd5('0x39'),NOW))[_0x8fd5('0x3c')]();}function insertCmContact(_0x19a797,_0x456947,_0x3a6d9a,_0xb3eea2){var _0x4c5f44=_[_0x8fd5('0x4c')](_['keys'](_0xb3eea2),[_0x8fd5('0x2f'),_0x8fd5('0x4d'),_0x8fd5('0x30'),_0x8fd5('0x31')]);return squel[_0x8fd5('0x29')]()[_0x8fd5('0x2a')]('cm_contacts')[_0x8fd5('0x2c')](_0x4c5f44,squel['select']()[_0x8fd5('0x35')](_0x4c5f44)[_0x8fd5('0x11')](_0x456947)[_0x8fd5('0x14')]('('+_0x3a6d9a[_0x8fd5('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0x8fd5('0xf')]()[_0x8fd5('0x35')](_0x3a6d9a)[_0x8fd5('0x11')](_0x8fd5('0x40'))['where'](_0x8fd5('0x46'),_0x19a797)[_0x8fd5('0x14')](_0x8fd5('0x4e')))[_0x8fd5('0x14')](_0x8fd5('0x4f'),squel[_0x8fd5('0xf')]()[_0x8fd5('0x10')]('MIN(id)',_0x8fd5('0x50'))[_0x8fd5('0x11')](_0x456947)[_0x8fd5('0x51')](_0x3a6d9a[_0x8fd5('0x12')](','))))[_0x8fd5('0x3c')]();}function handleStop(){logger[_0x8fd5('0x52')](_0x8fd5('0x53'));stopped=!![];}function handleUncaughtException(_0x3099a4){logger[_0x8fd5('0x54')](_0x3099a4['message']);process[_0x8fd5('0x55')](0x1);}function handleError(_0x52cd5a,_0x1afcde){stats[_0x8fd5('0x56')]['push']({'name':_0x1afcde[_0x8fd5('0x57')],'message':_0x1afcde[_0x8fd5('0x58')],'row':_0x52cd5a});}function handleQuery(_0x1310d5){logger[_0x8fd5('0x52')](_0x1310d5);return db[_0x8fd5('0x59')][_0x8fd5('0x5a')](_0x1310d5)[_0x8fd5('0x5b')](function(_0x41d265){results[_0x8fd5('0x19')](_0x41d265);})[_0x8fd5('0x5c')](function(_0x10b7b1){logger[_0x8fd5('0x54')](_0x10b7b1['message']);});}function updateTzCampaigns(_0x358bb8){return new Promise(function(_0x40f960,_0x1cb180){var _0x4f485f=squel[_0x8fd5('0xf')]()[_0x8fd5('0x35')]([_0x8fd5('0x5d'),_0x8fd5('0x5e')])[_0x8fd5('0x11')](_0x8fd5('0x5f'))[_0x8fd5('0x12')](_0x8fd5('0x60'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0x8fd5('0x61')+_0x358bb8);db[_0x8fd5('0x59')][_0x8fd5('0x5a')](_0x4f485f[_0x8fd5('0x3c')]())[_0x8fd5('0x5b')](function(_0x52145f){var _0x3cfcca=[];for(var _0x1e7761=0x0;_0x1e7761<_0x52145f[_0x8fd5('0x1c')];_0x1e7761++){_0x3cfcca[_0x8fd5('0x19')](getTimezoneData(_0x52145f[_0x1e7761],tmp_campaigns));}BPromise[_0x8fd5('0x1a')](_0x3cfcca)['then'](function(){_0x40f960({'val':0x1});});})[_0x8fd5('0x5c')](function(_0x24e115){logger[_0x8fd5('0x54')](_0x24e115[_0x8fd5('0x58')]);_0x40f960({'val':0x0});});});}function updateTzVoiceQueues(_0x128018){return new Promise(function(_0xa948e4,_0x555186){var _0x343f70=squel[_0x8fd5('0xf')]()['fields']([_0x8fd5('0x62'),_0x8fd5('0x63')])[_0x8fd5('0x11')](_0x8fd5('0x64'))[_0x8fd5('0x12')](_0x8fd5('0x65'),null,_0x8fd5('0x66'))[_0x8fd5('0x14')](_0x8fd5('0x67')+_0x128018);db[_0x8fd5('0x59')][_0x8fd5('0x5a')](_0x343f70[_0x8fd5('0x3c')]())[_0x8fd5('0x5b')](function(_0x286abb){var _0x435934=[];for(var _0x32e86a=0x0;_0x32e86a<_0x286abb[_0x8fd5('0x1c')];_0x32e86a++){_0x435934[_0x8fd5('0x19')](getTimezoneData(_0x286abb[_0x32e86a],tmp_voice_queues));}BPromise[_0x8fd5('0x1a')](_0x435934)[_0x8fd5('0x18')](function(){_0xa948e4({'val':0x1});});})[_0x8fd5('0x5c')](function(_0x5651bc){logger['error'](_0x5651bc[_0x8fd5('0x58')]);_0xa948e4({'val':0x0});});});}function getTimezoneData(_0x5d97a7,_0x56b43b){return new Promise(function(_0x22da3a,_0x38eebd){var _0x120ea5=shared[_0x8fd5('0x68')];var _0x494716=_0x120ea5[_0x5d97a7[_0x8fd5('0x69')]];if(_[_0x8fd5('0x1d')](_0x494716)){_0x22da3a({'ret':0x1});}else{var _0x154213=_0x494716[_0x8fd5('0x6a')];var _0x23df6c=squel[_0x8fd5('0x29')]()['into'](_0x56b43b)['set']('id',_0x5d97a7['id'])[_0x8fd5('0x6b')](_0x8fd5('0x6c'),_0x154213)[_0x8fd5('0x6b')](_0x8fd5('0x69'),_0x5d97a7[_0x8fd5('0x69')])[_0x8fd5('0x3c')]();return db[_0x8fd5('0x59')][_0x8fd5('0x5a')](_0x23df6c)['spread'](function(_0x5ba626){_0x22da3a({'ret':0x1});})[_0x8fd5('0x5c')](function(_0xbc3ca6){logger[_0x8fd5('0x54')](_0xbc3ca6['message']);_0x38eebd({'ret':0x1});});}});}function handleTZQuery(_0x390821){logger[_0x8fd5('0x52')](_0x390821);return db[_0x8fd5('0x59')][_0x8fd5('0x5a')](_0x390821)['spread'](function(_0x11f152){})['catch'](function(_0x26165e){logger[_0x8fd5('0x54')](_0x26165e[_0x8fd5('0x58')]);});}function main(_0x398138,_0x59ede6,_0x356926,_0x6c4f84){logger[_0x8fd5('0x52')](_0x8fd5('0x6d'),_0x398138,JSON['stringify'](_0x59ede6));process[_0x8fd5('0x6e')](_0x8fd5('0x6f'));var _0x4608b6=_0x59ede6[_0x8fd5('0x70')];var _0x174cbb=_[_0x8fd5('0x71')](_0x4608b6);var _0x2a6669=_0x59ede6[_0x8fd5('0x72')];var _0x3b91a8=path[_0x8fd5('0x12')](config[_0x8fd5('0x73')],_0x8fd5('0x74'),_0x2a6669+_0x8fd5('0x75'));hasTZ=_[_0x8fd5('0x76')](_0x4608b6)[_0x8fd5('0x77')](_0x8fd5('0x69'));var _0x1b437f=_[_0x8fd5('0x76')](_0x4608b6)[_0x8fd5('0x12')]();logger['info'](_0x8fd5('0x78'),_0x1b437f);db[_0x8fd5('0x79')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x8fd5('0x18')](function(_0x5a7cf1){for(var _0x4772df=0x0;_0x4772df<_0x5a7cf1[_0x8fd5('0x1c')];_0x4772df++){if(_0x5a7cf1[_0x4772df][_0x8fd5('0x7a')]in _0x4608b6){contactItemTypes['push'](_0x5a7cf1[_0x4772df]);delete _0x174cbb[_0x5a7cf1[_0x4772df][_0x8fd5('0x7a')]];hasAdditionalPhones=!![];}for(var _0x592e64 in _0x4608b6){if(_0x5a7cf1[_0x4772df][_0x8fd5('0x7a')]+_0x8fd5('0x7b')===_0x592e64){phoneDescriptions[_0x8fd5('0x19')]({'itemTypeId':_0x5a7cf1[_0x4772df]['id'],'description':_0x592e64});delete _0x174cbb[_0x592e64];}}}if(hasAdditionalPhones)_0x174cbb[_0x8fd5('0x17')]='';var _0x3fa3db=_[_0x8fd5('0x76')](_0x174cbb)[_0x8fd5('0x12')]();logger[_0x8fd5('0x52')](_0x8fd5('0x78'),_0x3fa3db);fs[_0x8fd5('0x7c')](_0x3b91a8,_0x3fa3db+'\x0a');Papa[_0x8fd5('0x7d')](fs['createReadStream'](_0x398138),{'header':!![],'skipEmptyLines':!![],'step':function(_0x86cc40,_0x40787b){try{for(var _0x672be6=0x0,_0x468cb0=[];_0x672be6<_0x86cc40[_0x8fd5('0x7e')][_0x8fd5('0x1c')];_0x672be6++){stats[_0x8fd5('0x7f')]+=0x1;if(_0x86cc40[_0x8fd5('0x56')][_0x672be6]){handleError(_0x86cc40['data'][_0x672be6],_0x86cc40[_0x8fd5('0x56')][_0x672be6]);}else{var _0x37e088=[];var _0x38e498=[];var _0x336111={};for(var _0x2a109e in _0x4608b6){let _0x2cf9d9=contactItemTypes[_0x8fd5('0x80')](_0x3702c3=>_0x3702c3['name']===_0x2a109e);let _0x3407ee=contactItemTypes[_0x8fd5('0x80')](_0xa039e2=>_0xa039e2[_0x8fd5('0x7a')]+_0x8fd5('0x7b')===_0x2a109e);if(_[_0x8fd5('0x1d')](_0x2cf9d9)&&_[_0x8fd5('0x1d')](_0x3407ee)){if(_0x4608b6['hasOwnProperty'](_0x2a109e)){if(_0x86cc40[_0x8fd5('0x7e')][_0x672be6][_0x4608b6[_0x2a109e]]){var _0x27c8d6=_[_0x8fd5('0x81')](_0x86cc40[_0x8fd5('0x7e')][_0x672be6][_0x4608b6[_0x2a109e]][_0x8fd5('0x82')](/"/g,'\x27'));switch(_0x2a109e){case'scheduledat':var _0x1837bb=moment(_0x27c8d6,_0x8fd5('0x83'),!![]);if(_0x1837bb[_0x8fd5('0x84')]()){_0x468cb0['push']('\x22'+_0x27c8d6+'\x22');}else{_0x37e088['push'](_0x8fd5('0x85'));}break;case _0x8fd5('0x32'):var _0x4bef34=parseInt(_0x27c8d6);_0x27c8d6=_[_0x8fd5('0x86')](_0x4bef34)||_0x4bef34<0x0||_0x4bef34>0x4?_0x6c4f84?0x3:0x2:_0x4bef34;_0x468cb0[_0x8fd5('0x19')]('\x22'+_0x27c8d6+'\x22');break;case _0x8fd5('0x33'):var _0x39868d=parseInt(_0x27c8d6);if(_[_0x8fd5('0x87')](_0x39868d)&&_[_0x8fd5('0x77')](_0x356926,_0x39868d)){_0x468cb0[_0x8fd5('0x19')]('\x22'+_0x39868d+'\x22');}else{_0x37e088['push'](_0x8fd5('0x88'));}break;case _0x8fd5('0x89'):if(isEmail(_0x27c8d6)){_0x468cb0['push']('\x22'+_0x27c8d6+'\x22');}else{_0x37e088[_0x8fd5('0x19')](_0x8fd5('0x8a'));}break;case _0x8fd5('0x8b'):var _0x34fd0d=moment(_0x27c8d6,'YYYY-MM-DD',!![]);if(_0x34fd0d[_0x8fd5('0x84')]()){_0x468cb0['push']('\x22'+_0x27c8d6+'\x22');}else{_0x37e088[_0x8fd5('0x19')](_0x8fd5('0x8c'));}break;case _0x8fd5('0x69'):var _0x4996bc=shared[_0x8fd5('0x68')];var _0x5e7be1=_0x4996bc[_0x27c8d6];if(!_['isNil'](_0x5e7be1)){var _0x707a3a=_0x5e7be1[_0x8fd5('0x6a')];_0x468cb0[_0x8fd5('0x19')]('\x22'+_0x27c8d6+'\x22');_0x468cb0[_0x8fd5('0x19')]('\x22'+_0x707a3a+'\x22');}break;default:_0x468cb0[_0x8fd5('0x19')]('\x22'+_0x27c8d6+'\x22');}}else{switch(_0x2a109e){case _0x8fd5('0x8d'):case _0x8fd5('0x3f'):_0x37e088[_0x8fd5('0x19')](_0x2a109e+_0x8fd5('0x8e'));break;default:_0x468cb0['push']('\x22\x22');}}}}else{var _0x52ef7e='';if(!_['isNil'](_0x2cf9d9)){if(!_0x336111[_0x8fd5('0x8f')](_0x2cf9d9['id'])){if(!_[_0x8fd5('0x1d')](_0x86cc40[_0x8fd5('0x7e')][_0x672be6][_0x4608b6[_0x2a109e]])){var _0x27c8d6=_[_0x8fd5('0x81')](_0x86cc40[_0x8fd5('0x7e')][_0x672be6][_0x4608b6[_0x2a109e]][_0x8fd5('0x82')](/"/g,'\x27'));var _0x1acd2b=phoneDescriptions['find'](_0x375ea8=>_0x375ea8[_0x8fd5('0x90')]===_0x2cf9d9['id']);if(!_[_0x8fd5('0x1d')](_0x1acd2b)){var _0x49c732=_[_0x8fd5('0x81')](_0x86cc40['data'][_0x672be6][_0x4608b6[_0x1acd2b[_0x8fd5('0x91')]]]['replace'](/"/g,'\x27'));if(!_[_0x8fd5('0x1d')](_0x49c732))_0x27c8d6=_0x27c8d6+'§'+_0x49c732;}if(_0x52ef7e=='')_0x52ef7e=_0x27c8d6;else _0x52ef7e+='|'+_0x27c8d6;}_0x38e498['push'](_0x2cf9d9['id']+':'+_0x52ef7e);_0x336111[_0x2cf9d9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x468cb0[_0x8fd5('0x19')]('\x22'+_0x38e498[_0x8fd5('0x12')](';')+'\x22');}if(_0x37e088[_0x8fd5('0x1c')]){handleError(_0x86cc40[_0x8fd5('0x7e')][_0x672be6],{'code':_0x8fd5('0x92'),'message':_0x37e088[_0x8fd5('0x12')]()});}else{fs[_0x8fd5('0x93')](_0x3b91a8,_0x468cb0[_0x8fd5('0x12')]()+'\x0a');}_0x468cb0=[];}if(!(stats[_0x8fd5('0x7f')]%0xc8)){socket[_0x8fd5('0x94')]('contact:import:'+_0x2a6669,stats);stats['errors']=[];}}if(stopped){logger[_0x8fd5('0x52')](_0x8fd5('0x95'));_0x40787b[_0x8fd5('0x96')]();}}catch(_0x1687cc){handleError(_0x86cc40[_0x8fd5('0x7e')][_0x672be6],{'code':_0x8fd5('0x97'),'message':_0x1687cc[_0x8fd5('0x58')]});logger[_0x8fd5('0x54')]('step',_0x1687cc[_0x8fd5('0x58')]);}},'complete':function(){try{var _0x224487=[];var _0x237754=[];var _0x380720='cm_contacts';if(_0x59ede6[_0x8fd5('0x98')]&&_0x59ede6[_0x8fd5('0x98')]['length']){_0x380720=_0x8fd5('0x99')+_0x2a6669;_0x224487[_0x8fd5('0x19')](_0x8fd5('0x9a')+_0x380720+_0x8fd5('0x9b'));}tmp_campaigns='campaigns_'+_0x2a6669;tmp_voice_queues=_0x8fd5('0x9c')+_0x2a6669;_0x237754[_0x8fd5('0x19')](_0x8fd5('0x9a')+tmp_campaigns+_0x8fd5('0x9d'));_0x237754['push'](_0x8fd5('0x9a')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x8fd5('0x9e')](_0x237754,handleTZQuery)[_0x8fd5('0x18')](function(_0x1b1ef4){updateTzCampaigns(_0x59ede6['ListId'])[_0x8fd5('0x18')](function(_0xb94220){updateTzVoiceQueues(_0x59ede6[_0x8fd5('0x2f')])[_0x8fd5('0x18')](function(_0x4eed41){if(hasTZ)_0x3fa3db=_0x3fa3db[_0x8fd5('0x82')](_0x8fd5('0x69'),_0x8fd5('0x9f'));var _0x17e55e=util['format'](_0x8fd5('0xa0'),_0x3b91a8,_0x380720,_0x3fa3db,_0x59ede6['ListId'],_0x59ede6[_0x8fd5('0x4d')]||null,NOW,NOW);if(_['isNil'](_0x4608b6[_0x8fd5('0x2d')])){_0x17e55e+=',\x20scheduledAt\x20=\x20NOW()';}_0x224487[_0x8fd5('0x19')](_0x17e55e);if(_0x59ede6[_0x8fd5('0x98')]&&_0x59ede6['duplicates'][_0x8fd5('0x1c')]){_0x224487[_0x8fd5('0x19')](insertCmContact(_0x59ede6['ListId'],_0x380720,_0x59ede6['duplicates'],_0x4608b6));_0x224487[_0x8fd5('0x19')](_0x8fd5('0xa1')+_0x380720+';');}BPromise[_0x8fd5('0x9e')](_0x224487,handleQuery)[_0x8fd5('0x18')](function(_0xd9654b){BPromise[_0x8fd5('0x1a')]([handleAdditionalPhones()])[_0x8fd5('0x18')](function(){_0x224487=[];for(var _0x50d3c1=0x0;_0x50d3c1\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','update','create','PHONE'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0x7948,0x144));var _0x8794=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x7948[_0x41ee16];return _0x1f60de;};'use strict';var fs=require('fs');var path=require(_0x8794('0x0'));var _=require(_0x8794('0x1'));var Papa=require(_0x8794('0x2'));var util=require(_0x8794('0x3'));var BPromise=require(_0x8794('0x4'));var moment=require(_0x8794('0x5'));var squel=require('squel');var Redis=require(_0x8794('0x6'));var db=require(_0x8794('0x7'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require(_0x8794('0x8'))(_0x8794('0x9'));config[_0x8794('0xa')]=_[_0x8794('0xb')](config[_0x8794('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8794('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x8794('0xc')](_0x8794('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x8794('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x8b75a5){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))*$/[_0x8794('0xe')](_0x8b75a5);}function selectNotIn(_0x4aafb5,_0x3612ef,_0x2656df,_0x4db0f1,_0x391472){return squel[_0x8794('0xf')]()[_0x8794('0x10')]('phone')[_0x8794('0x11')](_0x4db0f1)['join'](_0x3612ef,null,_0x3612ef+_0x8794('0x12')+_0x4db0f1+'.'+_0x2656df)[_0x8794('0x13')](_0x4db0f1+'.'+_0x2656df+_0x8794('0x14')+_0x4aafb5+'.'+_0x2656df)[_0x8794('0x13')](_0x3612ef+_0x8794('0x15')+_0x391472['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2f8c97,_0x4b9dd0){promisesAdditionalPhones=[];return db[_0x8794('0x16')][_0x8794('0x17')]({'raw':!![],'attributes':['id',_0x8794('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x8794('0x19')](function(_0x5d073b){if(_0x5d073b!==null){var _0x1ae842=[];for(var _0x57e895=0x0;_0x57e895<_0x5d073b[_0x8794('0x1a')];_0x57e895++){var _0x1fead2=_0x5d073b[_0x57e895];_0x1ae842[_0x8794('0x1b')](insertAdditionalPhones(_0x1fead2));}}Promise[_0x8794('0x1c')](_0x1ae842)['then'](function(){_0x2f8c97({'val':0x1});});});});}function insertAdditionalPhones(_0x3bb73b){return new Promise(function(_0x4bee49,_0x21bcc4){var _0x21d6ea=_0x3bb73b['AdditionalPhones'];var _0x5007e6=_0x21d6ea[_0x8794('0x1d')](';');var _0x2b62f1=[];orderBy=0x0;for(var _0x121cda=0x0;_0x121cda<_0x5007e6[_0x8794('0x1a')];_0x121cda++){_0x2b62f1['push'](splitAdditionalPhone(_0x3bb73b['id'],_0x5007e6[_0x121cda]));}Promise[_0x8794('0x1c')](_0x2b62f1)[_0x8794('0x19')](function(){_0x4bee49({'val':_0x5007e6[_0x8794('0x1a')]});});});}function splitAdditionalPhone(_0x50a9dc,_0xf3cc1b){return new Promise(function(_0x199d7e,_0x370f4c){var _0x4f81d2=_0xf3cc1b[_0x8794('0x1d')](':');var _0x19a3ea=_0x4f81d2[0x0];var _0x3450e5=_0x4f81d2[0x1];if(!_[_0x8794('0x1e')](_0x3450e5)){var _0x383bf4=_0x3450e5[_0x8794('0x1d')]('|');var _0x27ddab=[];for(var _0xd9f592=0x0;_0xd9f592<_0x383bf4[_0x8794('0x1a')];_0xd9f592++){if(_0x383bf4[_0xd9f592]!==''){var _0x46e6d2=_[_0x8794('0x1f')](promisesAdditionalPhones,{'contactId':_0x50a9dc,'phone':_0x383bf4[_0xd9f592]});if(_0x46e6d2[_0x8794('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x8794('0x1b')]({'contactId':_0x50a9dc,'contactTypeId':_0x19a3ea,'phone':_0x383bf4[_0xd9f592],'orderBy':orderBy});}}}_0x199d7e({'ok':0x1});}else _0x199d7e({'res':0x0});});}function createAdditionalPhone(_0x1b094a,_0x450bac,_0x3c1eb9,_0x5c1c2d){var _0x242388='';var _0x582417='';var _0x37b289=_0x3c1eb9[_0x8794('0x1d')]('§');_0x242388=_0x37b289[0x0];if(_0x37b289[_0x8794('0x1a')]==0x2)_0x582417=_0x37b289[0x1];return new Promise(function(_0x251764,_0x1207f5){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x1b094a,'item':_0x242388}})[_0x8794('0x19')](function(_0xa52bee){if(_0xa52bee){return db[_0x8794('0x20')][_0x8794('0x21')]({'ItemTypeId':_0x450bac,'description':_0x582417,'OrderBy':_0x5c1c2d},{'where':{'CmContactId':_0x1b094a,'item':_0x242388}})['then'](function(_0x7f96ab){_0x251764({'res':'updated'});});}else{return db[_0x8794('0x20')][_0x8794('0x22')]({'CmContactId':_0x1b094a,'item':_0x242388,'description':_0x582417,'ItemTypeId':_0x450bac,'OrderBy':_0x5c1c2d,'ItemClass':_0x8794('0x23')})[_0x8794('0x19')](function(_0x2da24a){_0x251764({'res':_0x8794('0x24')});});}});});}function insertCmHopper(_0x38a1f5,_0x5e55aa,_0xfbfa44,_0x4ef13e,_0x3ee9d6){var _0x1454ed=[_0x8794('0x25'),_0x8794('0x26'),_0x8794('0x27'),_0x8794('0x28'),_0x5e55aa+'.'+_0x4ef13e,_0x8794('0x29'),_0x8794('0x2a'),_0x8794('0x2b'),'cm_contacts.UserId','\x22'+_0x3ee9d6+'\x22'];return squel[_0x8794('0x2c')]()[_0x8794('0x2d')](_0x8794('0x2e'))[_0x8794('0x2f')]([_0x8794('0x30'),_0x8794('0x31'),'ContactId',_0x8794('0x32'),_0x4ef13e,_0x8794('0x33'),'updatedAt',_0x8794('0x34'),'UserId',_0x8794('0x35')],squel[_0x8794('0xf')]()[_0x8794('0x36')](_0x1454ed)[_0x8794('0x11')](_0x5e55aa)[_0x8794('0x37')](_0x8794('0x38'),null,_0x8794('0x39')+_0x5e55aa+_0x8794('0x3a'))[_0x8794('0x37')](_0xfbfa44,null,_0xfbfa44+'.id\x20=\x20'+_0x5e55aa+'.'+_0x4ef13e)[_0x8794('0x13')](_0x5e55aa+_0x8794('0x3b'),_0x38a1f5)[_0x8794('0x13')](_0x8794('0x3c'),NOW)[_0x8794('0x13')](_0x8794('0x3d'),selectNotIn(_0x5e55aa,_0xfbfa44,_0x4ef13e,_0x8794('0x2e'),[_0x8794('0x3e'),_0x8794('0x3f')]))[_0x8794('0x13')](_0x8794('0x3d'),selectNotIn(_0x5e55aa,_0xfbfa44,_0x4ef13e,_0x8794('0x2e'),['\x22always\x22'])))[_0x8794('0x40')]();}function insertCmHopperBlack(_0x534af1,_0x37c68d,_0x432757,_0xe274f0){var _0x136378=[_0x8794('0x25'),_0x8794('0x27'),_0x8794('0x28'),_0x37c68d+'.'+_0xe274f0,_0x8794('0x29'),_0x8794('0x2a')];return squel[_0x8794('0x2c')]()['into'](_0x8794('0x41'))[_0x8794('0x2f')]([_0x8794('0x30'),_0x8794('0x42'),'ListId',_0xe274f0,_0x8794('0x33'),_0x8794('0x43')],squel[_0x8794('0xf')]()[_0x8794('0x36')](_0x136378)[_0x8794('0x11')](_0x37c68d)[_0x8794('0x37')](_0x8794('0x38'),null,_0x8794('0x39')+_0x37c68d+_0x8794('0x3a'))[_0x8794('0x37')](_0x432757,null,_0x432757+_0x8794('0x12')+_0x37c68d+'.'+_0xe274f0)[_0x8794('0x13')](_0x37c68d+_0x8794('0x3b'),_0x534af1)['where'](_0x8794('0x3c'),NOW)[_0x8794('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x8794('0xf')]()[_0x8794('0x10')](_0x8794('0x30'))['from'](_0x8794('0x41'))[_0x8794('0x13')](_0x8794('0x44'),_0x534af1)[_0x8794('0x13')](_0xe274f0+_0x8794('0x14')+_0x37c68d+'.'+_0xe274f0)))[_0x8794('0x40')]();}function insertTzCmHopper(_0x2697da,_0x296f8c,_0x1d89dd,_0x1bfb14,_0x3600bd,_0x563ca6){var _0x5c4296=[_0x8794('0x25'),_0x8794('0x45')+_0x563ca6+_0x8794('0x46'),_0x8794('0x27'),_0x8794('0x28'),_0x296f8c+'.'+_0x1bfb14,'cm_contacts.createdAt',_0x8794('0x2a'),_0x8794('0x2b'),'cm_contacts.UserId','\x22'+_0x3600bd+'\x22'];var _0x593a10=squel[_0x8794('0x2c')]()[_0x8794('0x2d')](_0x8794('0x2e'))[_0x8794('0x2f')]([_0x8794('0x30'),_0x8794('0x31'),_0x8794('0x42'),'ListId',_0x1bfb14,_0x8794('0x33'),_0x8794('0x43'),'priority','UserId',_0x8794('0x35')],squel[_0x8794('0xf')]()[_0x8794('0x36')](_0x5c4296)[_0x8794('0x11')](_0x296f8c)['join']('cm_contacts',null,_0x8794('0x39')+_0x296f8c+_0x8794('0x3a'))[_0x8794('0x37')](_0x1d89dd,null,_0x1d89dd+_0x8794('0x12')+_0x296f8c+'.'+_0x1bfb14)[_0x8794('0x37')](_0x563ca6,null,_0x563ca6+_0x8794('0x12')+_0x296f8c+'.'+_0x1bfb14)[_0x8794('0x13')](_0x296f8c+_0x8794('0x3b'),_0x2697da)[_0x8794('0x13')](_0x8794('0x3c'),NOW)['where'](_0x8794('0x3d'),selectNotIn(_0x296f8c,_0x1d89dd,_0x1bfb14,'cm_hopper',[_0x8794('0x3e'),_0x8794('0x3f')]))[_0x8794('0x13')](_0x8794('0x3d'),selectNotIn(_0x296f8c,_0x1d89dd,_0x1bfb14,_0x8794('0x2e'),[_0x8794('0x3e')])))[_0x8794('0x40')]();return _0x593a10;}function insertTzCmHopperBlack(_0x1cdc26,_0x169e7b,_0x63aee5,_0x2b4e9f){var _0x30cc47=[_0x8794('0x25'),_0x8794('0x27'),_0x8794('0x28'),_0x169e7b+'.'+_0x2b4e9f,_0x8794('0x29'),_0x8794('0x2a')];return squel[_0x8794('0x2c')]()[_0x8794('0x2d')](_0x8794('0x41'))['fromQuery']([_0x8794('0x30'),_0x8794('0x42'),_0x8794('0x32'),_0x2b4e9f,'createdAt','updatedAt'],squel[_0x8794('0xf')]()[_0x8794('0x36')](_0x30cc47)['from'](_0x169e7b)[_0x8794('0x37')](_0x8794('0x38'),null,_0x8794('0x39')+_0x169e7b+_0x8794('0x3a'))['join'](_0x63aee5,null,_0x63aee5+_0x8794('0x12')+_0x169e7b+'.'+_0x2b4e9f)[_0x8794('0x13')](_0x169e7b+'.CmListId\x20=\x20?',_0x1cdc26)[_0x8794('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x8794('0xf')]()['field'](_0x8794('0x30'))[_0x8794('0x11')](_0x8794('0x41'))['where'](_0x8794('0x44'),_0x1cdc26)[_0x8794('0x13')](_0x2b4e9f+_0x8794('0x14')+_0x169e7b+'.'+_0x2b4e9f)))[_0x8794('0x40')]();}function insertCmHopperAdditionalPhones(_0x39ddc0){var _0x3a4314=[_0x8794('0x47'),_0x8794('0x48'),'cm_contact_has_items.OrderBy',_0x8794('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0x8794('0x2c')]()['into']('cm_hopper_additional_phones')[_0x8794('0x2f')]([_0x8794('0x4a'),_0x8794('0x30'),_0x8794('0x4b'),_0x8794('0x33'),_0x8794('0x43')],squel[_0x8794('0xf')]()[_0x8794('0x36')](_0x3a4314)[_0x8794('0x11')](_0x8794('0x2e'))[_0x8794('0x37')](_0x8794('0x38'),null,_0x8794('0x4c'))[_0x8794('0x37')](_0x8794('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x8794('0x13')](_0x8794('0x4e'),_0x39ddc0)[_0x8794('0x13')](_0x8794('0x3c'),NOW))[_0x8794('0x40')]();}function insertCmContact(_0x54f601,_0x50934b,_0xbb0255,_0x43822b){var _0x57c4df=_[_0x8794('0x4f')](_['keys'](_0x43822b),[_0x8794('0x32'),_0x8794('0x50'),_0x8794('0x33'),'updatedAt']);return squel[_0x8794('0x2c')]()[_0x8794('0x2d')](_0x8794('0x38'))[_0x8794('0x2f')](_0x57c4df,squel[_0x8794('0xf')]()[_0x8794('0x36')](_0x57c4df)[_0x8794('0x11')](_0x50934b)['where']('('+_0xbb0255[_0x8794('0x37')](',')+_0x8794('0x51'),squel['select']()[_0x8794('0x36')](_0xbb0255)[_0x8794('0x11')]('cm_contacts')[_0x8794('0x13')]('ListId\x20=\x20?',_0x54f601)[_0x8794('0x13')]('deletedAt\x20IS\x20NULL'))[_0x8794('0x13')](_0x8794('0x52'),squel[_0x8794('0xf')]()[_0x8794('0x10')](_0x8794('0x53'),_0x8794('0x54'))['from'](_0x50934b)[_0x8794('0x55')](_0xbb0255['join'](','))))[_0x8794('0x40')]();}function handleStop(){logger[_0x8794('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1eb6d3){logger['error'](_0x1eb6d3[_0x8794('0x57')]);process[_0x8794('0x58')](0x1);}function handleError(_0x221aa0,_0x51958c){stats[_0x8794('0x59')]['push']({'name':_0x51958c['code'],'message':_0x51958c[_0x8794('0x57')],'row':_0x221aa0});}function handleQuery(_0x26ac02){logger[_0x8794('0x56')](_0x26ac02);return db[_0x8794('0x5a')][_0x8794('0x5b')](_0x26ac02)[_0x8794('0x5c')](function(_0x193b46){results[_0x8794('0x1b')](_0x193b46);})[_0x8794('0x5d')](function(_0x515bee){logger['error'](_0x515bee[_0x8794('0x57')]);});}function updateTzCampaigns(_0x4e2919){return new Promise(function(_0x3b1291,_0x25b6e0){var _0x29e69b=squel['select']()[_0x8794('0x36')]([_0x8794('0x5e'),_0x8794('0x5f')])[_0x8794('0x11')](_0x8794('0x60'))['join'](_0x8794('0x61'),null,_0x8794('0x62'))[_0x8794('0x13')]('campaigns_has_cm_lists.CmListId='+_0x4e2919);db[_0x8794('0x5a')][_0x8794('0x5b')](_0x29e69b[_0x8794('0x40')]())[_0x8794('0x5c')](function(_0x4f3417){var _0xe92797=[];for(var _0x4fe178=0x0;_0x4fe178<_0x4f3417[_0x8794('0x1a')];_0x4fe178++){_0xe92797[_0x8794('0x1b')](getTimezoneData(_0x4f3417[_0x4fe178],tmp_campaigns));}BPromise[_0x8794('0x1c')](_0xe92797)[_0x8794('0x19')](function(){_0x3b1291({'val':0x1});});})[_0x8794('0x5d')](function(_0x38817d){logger[_0x8794('0x63')](_0x38817d[_0x8794('0x57')]);_0x3b1291({'val':0x0});});});}function updateTzVoiceQueues(_0x59387e){return new Promise(function(_0x17d4e3,_0x5e0d8e){var _0x7887c6=squel[_0x8794('0xf')]()['fields']([_0x8794('0x64'),'voice_queues.dialTimezone'])[_0x8794('0x11')](_0x8794('0x65'))[_0x8794('0x37')](_0x8794('0x66'),null,_0x8794('0x67'))[_0x8794('0x13')]('voice_queues_has_cm_lists.CmListId='+_0x59387e);db[_0x8794('0x5a')][_0x8794('0x5b')](_0x7887c6[_0x8794('0x40')]())[_0x8794('0x5c')](function(_0x15fb61){var _0x537dfd=[];for(var _0x1ac5dc=0x0;_0x1ac5dc<_0x15fb61['length'];_0x1ac5dc++){_0x537dfd[_0x8794('0x1b')](getTimezoneData(_0x15fb61[_0x1ac5dc],tmp_voice_queues));}BPromise[_0x8794('0x1c')](_0x537dfd)['then'](function(){_0x17d4e3({'val':0x1});});})[_0x8794('0x5d')](function(_0x56a3b5){logger[_0x8794('0x63')](_0x56a3b5[_0x8794('0x57')]);_0x17d4e3({'val':0x0});});});}function getTimezoneData(_0x37714d,_0x2e13be){return new Promise(function(_0x59ee8d,_0x69c025){var _0x2691d5=shared[_0x8794('0x68')];var _0x7e2d15=_0x2691d5[_0x37714d[_0x8794('0x69')]];if(_[_0x8794('0x1e')](_0x7e2d15)){_0x59ee8d({'ret':0x1});}else{var _0x5f3da1=_0x7e2d15['utcOffset'];var _0xa3d29f=squel[_0x8794('0x2c')]()[_0x8794('0x2d')](_0x2e13be)['set']('id',_0x37714d['id'])[_0x8794('0x6a')](_0x8794('0x6b'),_0x5f3da1)['set']('dialTimezone',_0x37714d[_0x8794('0x69')])[_0x8794('0x40')]();return db['sequelize']['query'](_0xa3d29f)['spread'](function(_0x2aa2a0){_0x59ee8d({'ret':0x1});})[_0x8794('0x5d')](function(_0x1618f7){logger['error'](_0x1618f7['message']);_0x69c025({'ret':0x1});});}});}function handleTZQuery(_0x77e43){logger[_0x8794('0x56')](_0x77e43);return db[_0x8794('0x5a')][_0x8794('0x5b')](_0x77e43)[_0x8794('0x5c')](function(_0x3e3e62){})[_0x8794('0x5d')](function(_0x5dcb3d){logger[_0x8794('0x63')](_0x5dcb3d['message']);});}function main(_0xf76909,_0x5e587b,_0x13df99,_0x55c17e){logger[_0x8794('0x56')](_0x8794('0x6c'),_0xf76909,JSON[_0x8794('0x6d')](_0x5e587b));process[_0x8794('0x6e')](_0x8794('0x6f'));var _0x37d1da=_0x5e587b[_0x8794('0x70')];var _0x3c765d=_[_0x8794('0x71')](_0x37d1da);var _0x2476c5=_0x5e587b[_0x8794('0x72')];var _0x482a61=path[_0x8794('0x37')](config[_0x8794('0x73')],'server/files/tmp',_0x2476c5+_0x8794('0x74'));hasTZ=_[_0x8794('0x75')](_0x37d1da)[_0x8794('0x76')](_0x8794('0x69'));var _0x370193=_[_0x8794('0x75')](_0x37d1da)[_0x8794('0x37')]();logger[_0x8794('0x56')](_0x8794('0x77'),_0x370193);db['ContactItemType'][_0x8794('0x17')]({'raw':!![],'attributes':['id',_0x8794('0x78')]})[_0x8794('0x19')](function(_0x1949c4){for(var _0x4d3b39=0x0;_0x4d3b39<_0x1949c4['length'];_0x4d3b39++){if(_0x1949c4[_0x4d3b39]['name']in _0x37d1da){contactItemTypes['push'](_0x1949c4[_0x4d3b39]);delete _0x3c765d[_0x1949c4[_0x4d3b39][_0x8794('0x78')]];hasAdditionalPhones=!![];}for(var _0x37a9e8 in _0x37d1da){if(_0x1949c4[_0x4d3b39][_0x8794('0x78')]+'_description'===_0x37a9e8){phoneDescriptions[_0x8794('0x1b')]({'itemTypeId':_0x1949c4[_0x4d3b39]['id'],'description':_0x37a9e8});delete _0x3c765d[_0x37a9e8];}}}if(hasAdditionalPhones)_0x3c765d['AdditionalPhones']='';var _0x2aa466=_['keys'](_0x3c765d)['join']();logger[_0x8794('0x56')](_0x8794('0x77'),_0x2aa466);fs['writeFileSync'](_0x482a61,_0x2aa466+'\x0a');Papa[_0x8794('0x79')](fs['createReadStream'](_0xf76909),{'header':!![],'skipEmptyLines':!![],'step':function(_0xda5356,_0x5a1b79){try{for(var _0x371364=0x0,_0x4519a3=[];_0x371364<_0xda5356[_0x8794('0x7a')][_0x8794('0x1a')];_0x371364++){stats[_0x8794('0x7b')]+=0x1;if(_0xda5356[_0x8794('0x59')][_0x371364]){handleError(_0xda5356[_0x8794('0x7a')][_0x371364],_0xda5356[_0x8794('0x59')][_0x371364]);}else{var _0x4571b0=[];var _0x3ce3f1=[];var _0x3ed266={};for(var _0x3ab198 in _0x37d1da){let _0xc0c1b7=contactItemTypes['find'](_0x19d893=>_0x19d893[_0x8794('0x78')]===_0x3ab198);let _0x3aeb94=contactItemTypes[_0x8794('0x7c')](_0x494ec1=>_0x494ec1[_0x8794('0x78')]+_0x8794('0x7d')===_0x3ab198);if(_[_0x8794('0x1e')](_0xc0c1b7)&&_['isNil'](_0x3aeb94)){if(_0x37d1da[_0x8794('0x7e')](_0x3ab198)){if(_0xda5356['data'][_0x371364][_0x37d1da[_0x3ab198]]){var _0x4289c6=_[_0x8794('0x7f')](_0xda5356['data'][_0x371364][_0x37d1da[_0x3ab198]]['replace'](/"/g,'\x27'));switch(_0x3ab198){case _0x8794('0x31'):var _0x3f0204=moment(_0x4289c6,_0x8794('0xd'),!![]);if(_0x3f0204[_0x8794('0x80')]()){_0x4519a3[_0x8794('0x1b')]('\x22'+_0x4289c6+'\x22');}else{_0x4571b0[_0x8794('0x1b')](_0x8794('0x81'));}break;case _0x8794('0x34'):var _0xba2a5c=parseInt(_0x4289c6);_0x4289c6=_[_0x8794('0x82')](_0xba2a5c)||_0xba2a5c<0x0||_0xba2a5c>0x4?_0x55c17e?0x3:0x2:_0xba2a5c;_0x4519a3[_0x8794('0x1b')]('\x22'+_0x4289c6+'\x22');break;case _0x8794('0x83'):var _0x3e3dfb=parseInt(_0x4289c6);if(_['isNumber'](_0x3e3dfb)&&_[_0x8794('0x76')](_0x13df99,_0x3e3dfb)){_0x4519a3[_0x8794('0x1b')]('\x22'+_0x3e3dfb+'\x22');}else{_0x4571b0[_0x8794('0x1b')]('agent\x20not\x20exists');}break;case _0x8794('0x84'):if(isEmail(_0x4289c6)){_0x4519a3[_0x8794('0x1b')]('\x22'+_0x4289c6+'\x22');}else{_0x4571b0[_0x8794('0x1b')](_0x8794('0x85'));}break;case'dateOfBirth':var _0x34e54a=moment(_0x4289c6,_0x8794('0x86'),!![]);if(_0x34e54a[_0x8794('0x80')]()){_0x4519a3[_0x8794('0x1b')]('\x22'+_0x4289c6+'\x22');}else{_0x4571b0[_0x8794('0x1b')](_0x8794('0x87'));}break;case _0x8794('0x69'):var _0x55b6fd=shared[_0x8794('0x68')];var _0x1951b3=_0x55b6fd[_0x4289c6];if(!_[_0x8794('0x1e')](_0x1951b3)){var _0x565087=_0x1951b3[_0x8794('0x88')];_0x4519a3[_0x8794('0x1b')]('\x22'+_0x4289c6+'\x22');_0x4519a3[_0x8794('0x1b')]('\x22'+_0x565087+'\x22');}break;default:_0x4519a3[_0x8794('0x1b')]('\x22'+_0x4289c6+'\x22');}}else{switch(_0x3ab198){case _0x8794('0x89'):case _0x8794('0x30'):_0x4571b0[_0x8794('0x1b')](_0x3ab198+_0x8794('0x8a'));break;default:_0x4519a3[_0x8794('0x1b')]('\x22\x22');}}}}else{var _0x32db94='';if(!_[_0x8794('0x1e')](_0xc0c1b7)){if(!_0x3ed266['hasOwnProperty'](_0xc0c1b7['id'])){if(!_[_0x8794('0x1e')](_0xda5356[_0x8794('0x7a')][_0x371364][_0x37d1da[_0x3ab198]])){var _0x4289c6=_[_0x8794('0x7f')](_0xda5356[_0x8794('0x7a')][_0x371364][_0x37d1da[_0x3ab198]][_0x8794('0x8b')](/"/g,'\x27'));var _0x186376=phoneDescriptions[_0x8794('0x7c')](_0x129f79=>_0x129f79[_0x8794('0x8c')]===_0xc0c1b7['id']);if(!_[_0x8794('0x1e')](_0x186376)){var _0x223622=_[_0x8794('0x7f')](_0xda5356['data'][_0x371364][_0x37d1da[_0x186376['description']]]['replace'](/"/g,'\x27'));if(!_[_0x8794('0x1e')](_0x223622))_0x4289c6=_0x4289c6+'§'+_0x223622;}if(_0x32db94=='')_0x32db94=_0x4289c6;else _0x32db94+='|'+_0x4289c6;}_0x3ce3f1['push'](_0xc0c1b7['id']+':'+_0x32db94);_0x3ed266[_0xc0c1b7['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4519a3[_0x8794('0x1b')]('\x22'+_0x3ce3f1[_0x8794('0x37')](';')+'\x22');}if(_0x4571b0['length']){handleError(_0xda5356[_0x8794('0x7a')][_0x371364],{'code':_0x8794('0x8d'),'message':_0x4571b0[_0x8794('0x37')]()});}else{fs['appendFileSync'](_0x482a61,_0x4519a3['join']()+'\x0a');}_0x4519a3=[];}if(!(stats[_0x8794('0x7b')]%0xc8)){socket[_0x8794('0x8e')]('contact:import:'+_0x2476c5,stats);stats[_0x8794('0x59')]=[];}}if(stopped){logger[_0x8794('0x56')](_0x8794('0x8f'));_0x5a1b79['abort']();}}catch(_0x1f1e6c){handleError(_0xda5356['data'][_0x371364],{'code':_0x8794('0x90'),'message':_0x1f1e6c[_0x8794('0x57')]});logger[_0x8794('0x63')](_0x8794('0x91'),_0x1f1e6c[_0x8794('0x57')]);}},'complete':function(){try{var _0x1088c6=[];var _0x1f87c1=[];var _0x53b262=_0x8794('0x38');if(_0x5e587b[_0x8794('0x92')]&&_0x5e587b['duplicates']['length']){_0x53b262=_0x8794('0x93')+_0x2476c5;_0x1088c6[_0x8794('0x1b')](_0x8794('0x94')+_0x53b262+_0x8794('0x95'));}tmp_campaigns=_0x8794('0x96')+_0x2476c5;tmp_voice_queues=_0x8794('0x97')+_0x2476c5;_0x1f87c1[_0x8794('0x1b')](_0x8794('0x94')+tmp_campaigns+_0x8794('0x98'));_0x1f87c1[_0x8794('0x1b')](_0x8794('0x94')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x8794('0x99')](_0x1f87c1,handleTZQuery)[_0x8794('0x19')](function(_0x24595c){updateTzCampaigns(_0x5e587b['ListId'])[_0x8794('0x19')](function(_0x2fab7b){updateTzVoiceQueues(_0x5e587b['ListId'])[_0x8794('0x19')](function(_0x2a99cb){if(hasTZ)_0x2aa466=_0x2aa466[_0x8794('0x8b')]('dialTimezone',_0x8794('0x9a'));var _0x26ad12=util[_0x8794('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x482a61,_0x53b262,_0x2aa466,_0x5e587b[_0x8794('0x32')],_0x5e587b[_0x8794('0x50')]||null,NOW,NOW);if(_[_0x8794('0x1e')](_0x37d1da[_0x8794('0x31')])){_0x26ad12+=_0x8794('0x9b');}_0x1088c6['push'](_0x26ad12);if(_0x5e587b[_0x8794('0x92')]&&_0x5e587b[_0x8794('0x92')][_0x8794('0x1a')]){_0x1088c6[_0x8794('0x1b')](insertCmContact(_0x5e587b[_0x8794('0x32')],_0x53b262,_0x5e587b[_0x8794('0x92')],_0x37d1da));_0x1088c6[_0x8794('0x1b')](_0x8794('0x9c')+_0x53b262+';');}BPromise[_0x8794('0x99')](_0x1088c6,handleQuery)['then'](function(_0x10cee2){BPromise[_0x8794('0x1c')]([handleAdditionalPhones()])[_0x8794('0x19')](function(){_0x1088c6=[];for(var _0x8ab135=0x0;_0x8ab135_0x233ec0[_0x5d54('0x6a')]===_0x2263da);let _0x10bb93=contactItemTypes[_0x5d54('0x71')](_0x3d1e6c=>_0x3d1e6c[_0x5d54('0x6a')]+_0x5d54('0x6b')===_0x2263da);if(_[_0x5d54('0x1a')](_0x26bcd5)&&_[_0x5d54('0x1a')](_0x10bb93)){if(_0x1619de['hasOwnProperty'](_0x2263da)){if(_0x27b4d5[_0x5d54('0x6f')][_0x1ee1cc][_0x1619de[_0x2263da]]){var _0x4a9025=_[_0x5d54('0x72')](_0x27b4d5[_0x5d54('0x6f')][_0x1ee1cc][_0x1619de[_0x2263da]][_0x5d54('0x73')](/"/g,'\x27'));switch(_0x2263da){case _0x5d54('0x74'):var _0x3b36cc=moment(_0x4a9025,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3b36cc[_0x5d54('0x75')]()){_0x381394[_0x5d54('0x1c')]('\x22'+_0x4a9025+'\x22');}else{_0x4b7f70[_0x5d54('0x1c')](_0x5d54('0x76'));}break;case _0x5d54('0x35'):var _0x5c17d4=parseInt(_0x4a9025);_0x4a9025=_[_0x5d54('0x77')](_0x5c17d4)||_0x5c17d4<0x0||_0x5c17d4>0x4?_0x197344?0x3:0x2:_0x5c17d4;_0x381394[_0x5d54('0x1c')]('\x22'+_0x4a9025+'\x22');break;case'UserId':var _0xf54a1e=parseInt(_0x4a9025);if(_[_0x5d54('0x78')](_0xf54a1e)&&_[_0x5d54('0x79')](_0x5d3ac2,_0xf54a1e)){_0x381394[_0x5d54('0x1c')]('\x22'+_0xf54a1e+'\x22');}else{_0x4b7f70['push'](_0x5d54('0x7a'));}break;case _0x5d54('0x7b'):if(isEmail(_0x4a9025)){_0x381394['push']('\x22'+_0x4a9025+'\x22');}else{_0x4b7f70[_0x5d54('0x1c')](_0x5d54('0x7c'));}break;case _0x5d54('0x7d'):var _0x45925d=moment(_0x4a9025,_0x5d54('0x7e'),!![]);if(_0x45925d[_0x5d54('0x75')]()){_0x381394['push']('\x22'+_0x4a9025+'\x22');}else{_0x4b7f70[_0x5d54('0x1c')](_0x5d54('0x7f'));}break;default:_0x381394[_0x5d54('0x1c')]('\x22'+_0x4a9025+'\x22');}}else{switch(_0x2263da){case _0x5d54('0x80'):case _0x5d54('0x10'):_0x4b7f70[_0x5d54('0x1c')](_0x2263da+_0x5d54('0x81'));break;default:_0x381394[_0x5d54('0x1c')]('\x22\x22');}}}}else{var _0x3f6d42='';if(!_[_0x5d54('0x1a')](_0x26bcd5)){if(!_0x5d95d6[_0x5d54('0x82')](_0x26bcd5['id'])){for(var _0x228b2c=0x0;_0x228b2c<_0x1619de[_0x2263da]['length'];_0x228b2c++){var _0x4a9025=_['trim'](_0x27b4d5['data'][_0x1ee1cc][_0x1619de[_0x2263da][_0x228b2c]][_0x5d54('0x73')](/"/g,'\x27'));var _0x2c221a=phoneDescriptions[_0x5d54('0x71')](_0x5cd011=>_0x5cd011[_0x5d54('0x83')]===_0x26bcd5['id']);if(!_[_0x5d54('0x1a')](_0x2c221a)){var _0x4c1e11=_['trim'](_0x27b4d5['data'][_0x1ee1cc][_0x1619de[_0x2c221a[_0x5d54('0x84')]][0x0]][_0x5d54('0x73')](/"/g,'\x27'));if(!_[_0x5d54('0x1a')](_0x4c1e11))_0x4a9025=_0x4a9025+'§'+_0x4c1e11;}if(_0x3f6d42=='')_0x3f6d42=_0x4a9025;else _0x3f6d42+='|'+_0x4a9025;}_0x56bab5[_0x5d54('0x1c')](_0x26bcd5['id']+':'+_0x3f6d42);_0x5d95d6[_0x26bcd5['id']]=0x1;}}}}if(hasAdditionalPhones){_0x381394[_0x5d54('0x1c')]('\x22'+_0x56bab5['join'](';')+'\x22');}if(_0x4b7f70['length']){handleError(_0x27b4d5[_0x5d54('0x6f')][_0x1ee1cc],{'code':_0x5d54('0x85'),'message':_0x4b7f70[_0x5d54('0x11')]()});}else{fs[_0x5d54('0x86')](_0x34bdb9,_0x381394[_0x5d54('0x11')]()+'\x0a');}_0x381394=[];}if(!(stats['rows']%0xc8)){socket[_0x5d54('0x87')](_0x5d54('0x88')+_0x4341c6,stats);stats[_0x5d54('0x5a')]=[];}}if(stopped){logger[_0x5d54('0x5e')](_0x5d54('0x89'));_0x24ba18[_0x5d54('0x8a')]();}}catch(_0x51ed74){handleError(_0x27b4d5['data'][_0x1ee1cc],{'code':_0x5d54('0x8b'),'message':_0x51ed74[_0x5d54('0x20')]});logger[_0x5d54('0x1f')](_0x5d54('0x8c'),_0x51ed74[_0x5d54('0x20')]);}},'complete':function(){try{var _0x17c366=[];var _0x3a242c=tempTableName;_0x17c366[_0x5d54('0x1c')](_0x5d54('0x8d')+_0x3a242c+_0x5d54('0x8e'));logger[_0x5d54('0x5e')]('CIS\x20len',contactItemTypes[_0x5d54('0x19')]);var _0x4d271c=util[_0x5d54('0xb')](_0x5d54('0x8f'),_0x34bdb9,_0x3a242c,_0x1abd5c,_0x7dae7d[_0x5d54('0x32')],_0x7dae7d['CompanyId']||null,NOW,NOW);if(_[_0x5d54('0x1a')](_0x1619de[_0x5d54('0x74')])){_0x4d271c+=_0x5d54('0x90');}_0x17c366[_0x5d54('0x1c')](_0x4d271c);BPromise['each'](_0x17c366,handleQuery)['then'](function(_0x30b597){BPromise[_0x5d54('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x17c366=[];for(var _0xa30651=0x0;_0xa30651\x20\x20');}var _0x11cae0=path['join'](config['root'],_0x5d54('0x65'),process['argv'][0x2]);if(!fs['existsSync'](_0x11cae0)){throw new Error(_0x5d54('0x9a'));}var _0x318138={};try{_0x318138=JSON[_0x5d54('0x9b')](process[_0x5d54('0x99')][0x3]);if(!_0x318138[_0x5d54('0x9c')]){throw new Error(_0x5d54('0x9d'));}var _0x130011=0x0;if(_0x318138[_0x5d54('0x9c')][_0x5d54('0x36')]){_0x130011=0x1;}if(!_0x318138[_0x5d54('0x32')]){throw new Error(_0x5d54('0x9e'));}}catch(_0x3e4022){throw new Error('body\x20id\x20mandatory');}var _0x47a396=[];try{_0x47a396=_[_0x5d54('0x9f')](JSON[_0x5d54('0x9b')](process[_0x5d54('0x99')][0x4]),'id');}catch(_0x3a7325){logger[_0x5d54('0x5e')](_0x5d54('0xa0'));}main(_0x11cae0,_0x318138,_0x47a396,_0x130011);}validate();process['on'](_0x5d54('0xa1'),handleStop);process['on'](_0x5d54('0xa2'),handleUncaughtException); \ No newline at end of file +var _0x62cf=['then','catch','all','split','filter','CmContactHasItem','update','updated','PHONE','inserted','CmContact','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','join','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','cm_hopper_black','cm_contacts','field','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','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',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','message','main','start','binding','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','parse','createReadStream','data','rows','find','_description','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','abort','SystemError','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','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','map','SIGINT','uncaughtException','path','papaparse','bluebird','moment','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','length','isNil','AdditionalPhones','push'];(function(_0x44fe9b,_0x260b8e){var _0x42e6c2=function(_0x3baa2d){while(--_0x3baa2d){_0x44fe9b['push'](_0x44fe9b['shift']());}};_0x42e6c2(++_0x260b8e);}(_0x62cf,0x81));var _0xf62c=function(_0x406c29,_0x1c0c63){_0x406c29=_0x406c29-0x0;var _0x2ad235=_0x62cf[_0x406c29];return _0x2ad235;};'use strict';var fs=require('fs');var path=require(_0xf62c('0x0'));var _=require('lodash');var Papa=require(_0xf62c('0x1'));var util=require('util');var BPromise=require(_0xf62c('0x2'));var moment=require(_0xf62c('0x3'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0xf62c('0x4'))['db'];var config=require(_0xf62c('0x5'));var logger=require(_0xf62c('0x6'))(_0xf62c('0x7'));config[_0xf62c('0x8')]=_[_0xf62c('0x9')](config[_0xf62c('0x8')],{'host':_0xf62c('0xa'),'port':0x18eb});var socket=require(_0xf62c('0xb'))(new Redis(config['redis']));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()[_0xf62c('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xf62c('0xd')+moment()[_0xf62c('0xc')](_0xf62c('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x424bf6){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))*$/[_0xf62c('0xf')](_0x424bf6);}function selectNotIn(_0x250c8c,_0x336122,_0x1d52e9,_0x3b1b62,_0x9a583f){return squel[_0xf62c('0x10')]()['field'](_0xf62c('0x11'))['from'](_0x3b1b62)['join'](_0x336122,null,_0x336122+_0xf62c('0x12')+_0x3b1b62+'.'+_0x1d52e9)[_0xf62c('0x13')](_0x3b1b62+'.'+_0x1d52e9+'\x20=\x20'+_0x250c8c+'.'+_0x1d52e9)[_0xf62c('0x13')](_0x336122+_0xf62c('0x14')+_0x9a583f['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1c47fa,_0x4a5cba){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf62c('0x15')][_0xf62c('0x16')]('select\x20*\x20from\x20'+tempTableName)[_0xf62c('0x17')](function(_0x3ffb03){if(_0x3ffb03!==null){var _0x55bba7=[];for(var _0x29aece=0x0;_0x29aece<_0x3ffb03[_0xf62c('0x18')];_0x29aece++){var _0x28acfb=_0x3ffb03[_0x29aece];if(!_['isNil'](_0x28acfb[_0xf62c('0x11')])){if(!_[_0xf62c('0x19')](_0x28acfb[_0xf62c('0x1a')]))_0x55bba7[_0xf62c('0x1b')](insertAdditionalPhones(_0x28acfb));promisesContact[_0xf62c('0x1b')]({'contact':_0x28acfb});}}}Promise['all'](_0x55bba7)[_0xf62c('0x1c')](function(){_0x1c47fa({'val':0x1});});})[_0xf62c('0x1d')](function(_0x359c25){logger['error'](_0x359c25['message']);});});}function insertAdditionalPhones(_0x3ae15e){return new Promise(function(_0x3c3624,_0x279439){var _0x14d2f5=_0x3ae15e[_0xf62c('0x1a')];if(_['isNil'](_0x14d2f5))_0x279439({'val':0x0});else{var _0x4dc634=_0x14d2f5['split'](';');var _0x11fda3=[];orderBy=0x0;for(var _0x1c883c=0x0;_0x1c883c<_0x4dc634[_0xf62c('0x18')];_0x1c883c++){_0x11fda3[_0xf62c('0x1b')](splitAdditionalPhone(_0x3ae15e['id'],_0x4dc634[_0x1c883c]));}Promise[_0xf62c('0x1e')](_0x11fda3)[_0xf62c('0x1c')](function(){_0x3c3624({'val':_0x4dc634['length']});});}});}function splitAdditionalPhone(_0x33b572,_0x120077){return new Promise(function(_0x424660,_0x53015c){var _0x4f22be=_0x120077['split'](':');var _0x496992=_0x4f22be[0x0];var _0x2165ae=_0x4f22be[0x1];if(_0x2165ae!==''){var _0x5c4e52=_0x2165ae[_0xf62c('0x1f')]('|');var _0x4973a8=[];for(var _0x2e2e54=0x0;_0x2e2e54<_0x5c4e52['length'];_0x2e2e54++){if(_0x5c4e52[_0x2e2e54]!==''){var _0x9da128=_[_0xf62c('0x20')](promisesAdditionalPhones,{'contactId':_0x33b572,'phone':_0x5c4e52[_0x2e2e54]});if(_0x9da128[_0xf62c('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0xf62c('0x1b')]({'contactId':_0x33b572,'contactTypeId':_0x496992,'phone':_0x5c4e52[_0x2e2e54],'orderBy':orderBy});}}}_0x424660({'ok':0x1});}else _0x424660({'res':0x0});});}function createAdditionalPhone(_0xbaa5a0,_0x4d00ab,_0x1ecd60,_0x1d441a){var _0x269222='';var _0x358036='';var _0x9dde25=_0x1ecd60[_0xf62c('0x1f')]('§');_0x269222=_0x9dde25[0x0];if(_0x9dde25[_0xf62c('0x18')]==0x2)_0x358036=_0x9dde25[0x1];return new Promise(function(_0x41b2c8,_0x19b820){return db[_0xf62c('0x21')]['findOne']({'where':{'CmContactId':_0xbaa5a0,'item':_0x269222}})[_0xf62c('0x1c')](function(_0x1aaeb9){if(_0x1aaeb9){return db['CmContactHasItem'][_0xf62c('0x22')]({'ItemTypeId':_0x4d00ab,'description':_0x358036,'OrderBy':_0x1d441a},{'where':{'CmContactId':_0xbaa5a0,'item':_0x269222}})['then'](function(_0x46aeba){_0x41b2c8({'res':_0xf62c('0x23')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0xbaa5a0,'item':_0x269222,'ItemTypeId':_0x4d00ab,'description':_0x358036,'OrderBy':_0x1d441a,'ItemClass':_0xf62c('0x24')})[_0xf62c('0x1c')](function(_0x5931c7){_0x41b2c8({'res':_0xf62c('0x25')});});}});});}function updateContact(_0x55921c){return new Promise(function(_0x396211,_0x127260){var _0x17ba4b=_0x55921c['id'];delete _0x55921c['id'];return db[_0xf62c('0x26')]['update'](_0x55921c,{'where':{'id':_0x17ba4b}})['then'](function(_0x3f6726){updatedRows+=0x1;return db['CmHopper'][_0xf62c('0x22')]({'phone':_0x55921c['phone']},{'where':{'ContactId':_0x17ba4b}})[_0xf62c('0x1c')](function(_0x18fb4f){_0x396211({'ret':'OK'});});});});}function insertCmHopper(_0x337fec,_0x440bdb,_0x5db4cb,_0x29ae19,_0x319447){var _0x1942db=[_0xf62c('0x27'),'cm_contacts.scheduledat',_0xf62c('0x28'),_0xf62c('0x29'),_0x440bdb+'.'+_0x29ae19,'cm_contacts.createdAt',_0xf62c('0x2a'),_0xf62c('0x2b'),_0xf62c('0x2c'),'\x22'+_0x319447+'\x22'];return squel[_0xf62c('0x2d')]()[_0xf62c('0x2e')](_0xf62c('0x2f'))[_0xf62c('0x30')]([_0xf62c('0x11'),_0xf62c('0x31'),_0xf62c('0x32'),_0xf62c('0x33'),_0x29ae19,_0xf62c('0x34'),_0xf62c('0x35'),_0xf62c('0x36'),_0xf62c('0x37'),_0xf62c('0x38')],squel[_0xf62c('0x10')]()[_0xf62c('0x39')](_0x1942db)[_0xf62c('0x3a')](_0x440bdb)[_0xf62c('0x3b')]('cm_contacts',null,_0xf62c('0x3c')+_0x440bdb+_0xf62c('0x3d'))[_0xf62c('0x3b')](_0x5db4cb,null,_0x5db4cb+_0xf62c('0x12')+_0x440bdb+'.'+_0x29ae19)['where'](_0x440bdb+_0xf62c('0x3e'),_0x337fec)[_0xf62c('0x13')](_0xf62c('0x3f'),NOW)[_0xf62c('0x13')](_0xf62c('0x40'),selectNotIn(_0x440bdb,_0x5db4cb,_0x29ae19,'cm_hopper',['\x22always\x22',_0xf62c('0x41')]))['where'](_0xf62c('0x40'),selectNotIn(_0x440bdb,_0x5db4cb,_0x29ae19,_0xf62c('0x2f'),[_0xf62c('0x42')])))['toString']();}function insertCmHopperBlack(_0x22f082,_0x35931b,_0x27218d,_0x3a550c){var _0x9b84ed=[_0xf62c('0x27'),'cm_contacts.id',_0xf62c('0x29'),_0x35931b+'.'+_0x3a550c,'cm_contacts.createdAt',_0xf62c('0x2a')];return squel[_0xf62c('0x2d')]()[_0xf62c('0x2e')](_0xf62c('0x43'))[_0xf62c('0x30')]([_0xf62c('0x11'),_0xf62c('0x32'),_0xf62c('0x33'),_0x3a550c,_0xf62c('0x34'),'updatedAt'],squel[_0xf62c('0x10')]()[_0xf62c('0x39')](_0x9b84ed)['from'](_0x35931b)['join'](_0xf62c('0x44'),null,'cm_contacts.ListId\x20=\x20'+_0x35931b+_0xf62c('0x3d'))[_0xf62c('0x3b')](_0x27218d,null,_0x27218d+'.id\x20=\x20'+_0x35931b+'.'+_0x3a550c)[_0xf62c('0x13')](_0x35931b+'.CmListId\x20=\x20?',_0x22f082)[_0xf62c('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf62c('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xf62c('0x10')]()[_0xf62c('0x45')](_0xf62c('0x11'))[_0xf62c('0x3a')]('cm_hopper_black')[_0xf62c('0x13')](_0xf62c('0x46'),_0x22f082)[_0xf62c('0x13')](_0x3a550c+_0xf62c('0x47'),_0x35931b+'.'+_0x3a550c)))[_0xf62c('0x48')]();}function insertCmHopperAdditionalPhones(_0x55d473){var _0x1ea3a7=[_0xf62c('0x49'),_0xf62c('0x4a'),_0xf62c('0x4b'),_0xf62c('0x4c'),_0xf62c('0x4d')];return squel[_0xf62c('0x2d')]()[_0xf62c('0x2e')]('cm_hopper_additional_phones')[_0xf62c('0x30')]([_0xf62c('0x4e'),'phone',_0xf62c('0x4f'),'createdAt','updatedAt'],squel[_0xf62c('0x10')]()[_0xf62c('0x39')](_0x1ea3a7)['from'](_0xf62c('0x2f'))['join'](_0xf62c('0x44'),null,_0xf62c('0x50'))[_0xf62c('0x3b')](_0xf62c('0x51'),null,_0xf62c('0x52'))[_0xf62c('0x13')](_0xf62c('0x53'),_0x55d473)[_0xf62c('0x13')](_0xf62c('0x3f'),NOW))[_0xf62c('0x48')]();}function insertCmContact(_0xf04483,_0x127619,_0x15259c,_0x4fd2e8){var _0x247276=_[_0xf62c('0x54')](_[_0xf62c('0x55')](_0x4fd2e8),['ListId',_0xf62c('0x56'),_0xf62c('0x34'),_0xf62c('0x35')]);return squel['insert']()[_0xf62c('0x2e')]('cm_contacts')[_0xf62c('0x30')](_0x247276,squel['select']()[_0xf62c('0x39')](_0x247276)['from'](_0x127619)[_0xf62c('0x13')]('('+_0x15259c[_0xf62c('0x3b')](',')+_0xf62c('0x57'),squel['select']()['fields'](_0x15259c)[_0xf62c('0x3a')](_0xf62c('0x44'))[_0xf62c('0x13')](_0xf62c('0x46'),_0xf04483))[_0xf62c('0x13')](_0xf62c('0x58'),squel[_0xf62c('0x10')]()[_0xf62c('0x45')](_0xf62c('0x59'),_0xf62c('0x5a'))[_0xf62c('0x3a')](_0x127619)[_0xf62c('0x5b')](_0x15259c[_0xf62c('0x3b')](','))))[_0xf62c('0x48')]();}function handleStop(){logger[_0xf62c('0x5c')](_0xf62c('0x5d'));stopped=!![];}function handleUncaughtException(_0x4a6833){logger[_0xf62c('0x5e')](_0x4a6833['message']);process[_0xf62c('0x5f')](0x1);}function handleError(_0x44e0d3,_0x1ca4f4){stats[_0xf62c('0x60')][_0xf62c('0x1b')]({'name':_0x1ca4f4[_0xf62c('0x61')],'message':_0x1ca4f4[_0xf62c('0x62')],'row':_0x44e0d3});}function handleQuery(_0x101b1c){logger[_0xf62c('0x5c')](_0x101b1c);return db[_0xf62c('0x15')][_0xf62c('0x16')](_0x101b1c)[_0xf62c('0x17')](function(_0x4d20bf){results[_0xf62c('0x1b')](_0x4d20bf);})[_0xf62c('0x1d')](function(_0x4a59a0){logger[_0xf62c('0x5e')](_0x4a59a0[_0xf62c('0x62')]);});}function main(_0x919e3,_0x4a2067,_0xfb3fa6,_0x568a0c){logger[_0xf62c('0x5c')](_0xf62c('0x63'),_0x919e3,JSON['stringify'](_0x4a2067));process['send'](_0xf62c('0x64'));var _0x16bcac=_0x4a2067[_0xf62c('0x65')];var _0x5ebc7e=_['clone'](_0x16bcac);var _0x50a518=_0x4a2067[_0xf62c('0x66')];var _0x51568e=path[_0xf62c('0x3b')](config[_0xf62c('0x67')],_0xf62c('0x68'),_0x50a518+_0xf62c('0x69'));logger[_0xf62c('0x5c')](_0xf62c('0x6a'),_0x4a2067);db[_0xf62c('0x6b')][_0xf62c('0x6c')]({'raw':!![],'attributes':['id',_0xf62c('0x6d')]})[_0xf62c('0x1c')](function(_0x1b0a9c){for(var _0x4ba340=0x0;_0x4ba340<_0x1b0a9c[_0xf62c('0x18')];_0x4ba340++){if(_0x1b0a9c[_0x4ba340][_0xf62c('0x6d')]in _0x16bcac){contactItemTypes[_0xf62c('0x1b')](_0x1b0a9c[_0x4ba340]);delete _0x5ebc7e[_0x1b0a9c[_0x4ba340][_0xf62c('0x6d')]];hasAdditionalPhones=!![];}for(var _0x3f28fb in _0x16bcac){if(_0x1b0a9c[_0x4ba340]['name']+'_description'===_0x3f28fb){phoneDescriptions[_0xf62c('0x1b')]({'itemTypeId':_0x1b0a9c[_0x4ba340]['id'],'description':_0x3f28fb});delete _0x5ebc7e[_0x3f28fb];}}}if(hasAdditionalPhones)_0x5ebc7e['AdditionalPhones']='';var _0x3a59f7=_['keys'](_0x5ebc7e)[_0xf62c('0x3b')]();logger[_0xf62c('0x5c')]('header',_0x3a59f7);fs['writeFileSync'](_0x51568e,_0x3a59f7+'\x0a');Papa[_0xf62c('0x6e')](fs[_0xf62c('0x6f')](_0x919e3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x30f424,_0x2e2c7e){try{for(var _0x4bd40b=0x0,_0x195d0c=[];_0x4bd40b<_0x30f424[_0xf62c('0x70')][_0xf62c('0x18')];_0x4bd40b++){stats[_0xf62c('0x71')]+=0x1;if(_0x30f424['errors'][_0x4bd40b]){handleError(_0x30f424['data'][_0x4bd40b],_0x30f424[_0xf62c('0x60')][_0x4bd40b]);}else{var _0x17ae5d=[];var _0x476ddc=[];var _0x4ea745={};for(var _0xc7df2c in _0x16bcac){let _0x4b8d5d=contactItemTypes[_0xf62c('0x72')](_0x2e45a3=>_0x2e45a3['name']===_0xc7df2c);let _0x1e70a0=contactItemTypes[_0xf62c('0x72')](_0x27a9cf=>_0x27a9cf['name']+_0xf62c('0x73')===_0xc7df2c);if(_[_0xf62c('0x19')](_0x4b8d5d)&&_[_0xf62c('0x19')](_0x1e70a0)){if(_0x16bcac['hasOwnProperty'](_0xc7df2c)){if(_0x30f424[_0xf62c('0x70')][_0x4bd40b][_0x16bcac[_0xc7df2c]]){var _0x66d980=_[_0xf62c('0x74')](_0x30f424['data'][_0x4bd40b][_0x16bcac[_0xc7df2c]][_0xf62c('0x75')](/"/g,'\x27'));switch(_0xc7df2c){case _0xf62c('0x31'):var _0xcd46d2=moment(_0x66d980,_0xf62c('0x76'),!![]);if(_0xcd46d2[_0xf62c('0x77')]()){_0x195d0c[_0xf62c('0x1b')]('\x22'+_0x66d980+'\x22');}else{_0x17ae5d[_0xf62c('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x44af47=parseInt(_0x66d980);_0x66d980=_[_0xf62c('0x78')](_0x44af47)||_0x44af47<0x0||_0x44af47>0x4?_0x568a0c?0x3:0x2:_0x44af47;_0x195d0c[_0xf62c('0x1b')]('\x22'+_0x66d980+'\x22');break;case _0xf62c('0x37'):var _0x14ef34=parseInt(_0x66d980);if(_[_0xf62c('0x79')](_0x14ef34)&&_['includes'](_0xfb3fa6,_0x14ef34)){_0x195d0c[_0xf62c('0x1b')]('\x22'+_0x14ef34+'\x22');}else{_0x17ae5d[_0xf62c('0x1b')](_0xf62c('0x7a'));}break;case'email':if(isEmail(_0x66d980)){_0x195d0c[_0xf62c('0x1b')]('\x22'+_0x66d980+'\x22');}else{_0x17ae5d[_0xf62c('0x1b')](_0xf62c('0x7b'));}break;case _0xf62c('0x7c'):var _0x5a61cc=moment(_0x66d980,'YYYY-MM-DD',!![]);if(_0x5a61cc[_0xf62c('0x77')]()){_0x195d0c[_0xf62c('0x1b')]('\x22'+_0x66d980+'\x22');}else{_0x17ae5d[_0xf62c('0x1b')](_0xf62c('0x7d'));}break;default:_0x195d0c['push']('\x22'+_0x66d980+'\x22');}}else{switch(_0xc7df2c){case _0xf62c('0x7e'):case _0xf62c('0x11'):_0x17ae5d[_0xf62c('0x1b')](_0xc7df2c+_0xf62c('0x7f'));break;default:_0x195d0c[_0xf62c('0x1b')]('\x22\x22');}}}}else{var _0x5f37db='';if(!_[_0xf62c('0x19')](_0x4b8d5d)){if(!_0x4ea745['hasOwnProperty'](_0x4b8d5d['id'])){for(var _0xf8982c=0x0;_0xf8982c<_0x16bcac[_0xc7df2c][_0xf62c('0x18')];_0xf8982c++){var _0x66d980=_[_0xf62c('0x74')](_0x30f424[_0xf62c('0x70')][_0x4bd40b][_0x16bcac[_0xc7df2c][_0xf8982c]][_0xf62c('0x75')](/"/g,'\x27'));var _0x57a872=phoneDescriptions[_0xf62c('0x72')](_0x53c67f=>_0x53c67f[_0xf62c('0x80')]===_0x4b8d5d['id']);if(!_[_0xf62c('0x19')](_0x57a872)){var _0x484845=_['trim'](_0x30f424['data'][_0x4bd40b][_0x16bcac[_0x57a872[_0xf62c('0x81')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x484845))_0x66d980=_0x66d980+'§'+_0x484845;}if(_0x5f37db=='')_0x5f37db=_0x66d980;else _0x5f37db+='|'+_0x66d980;}_0x476ddc[_0xf62c('0x1b')](_0x4b8d5d['id']+':'+_0x5f37db);_0x4ea745[_0x4b8d5d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x195d0c[_0xf62c('0x1b')]('\x22'+_0x476ddc['join'](';')+'\x22');}if(_0x17ae5d[_0xf62c('0x18')]){handleError(_0x30f424[_0xf62c('0x70')][_0x4bd40b],{'code':_0xf62c('0x82'),'message':_0x17ae5d[_0xf62c('0x3b')]()});}else{fs[_0xf62c('0x83')](_0x51568e,_0x195d0c[_0xf62c('0x3b')]()+'\x0a');}_0x195d0c=[];}if(!(stats['rows']%0xc8)){socket[_0xf62c('0x84')]('contact:import:'+_0x50a518,stats);stats[_0xf62c('0x60')]=[];}}if(stopped){logger[_0xf62c('0x5c')]('Abort\x20parser');_0x2e2c7e[_0xf62c('0x85')]();}}catch(_0x4d41a6){handleError(_0x30f424[_0xf62c('0x70')][_0x4bd40b],{'code':_0xf62c('0x86'),'message':_0x4d41a6[_0xf62c('0x62')]});logger[_0xf62c('0x5e')]('step',_0x4d41a6['message']);}},'complete':function(){try{var _0x2a8290=[];var _0x306c71=tempTableName;_0x2a8290[_0xf62c('0x1b')](_0xf62c('0x87')+_0x306c71+_0xf62c('0x88'));logger[_0xf62c('0x5c')](_0xf62c('0x89'),contactItemTypes[_0xf62c('0x18')]);var _0x2bc2d3=util[_0xf62c('0xc')](_0xf62c('0x8a'),_0x51568e,_0x306c71,_0x3a59f7,_0x4a2067[_0xf62c('0x33')],_0x4a2067[_0xf62c('0x56')]||null,NOW,NOW);if(_[_0xf62c('0x19')](_0x16bcac[_0xf62c('0x31')])){_0x2bc2d3+=_0xf62c('0x8b');}_0x2a8290['push'](_0x2bc2d3);BPromise[_0xf62c('0x8c')](_0x2a8290,handleQuery)[_0xf62c('0x1c')](function(_0x32a4df){BPromise[_0xf62c('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x2a8290=[];for(var _0x1fb126=0x0;_0x1fb126\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','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','sequelize','groupBy','Setting','enableEmailPreview','all','COUNT(*)','unreadMessages','isEmpty','t.id\x20IN\x20?','QueryTypes','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','getAccountFK','role','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','interactions','accounts','a.id\x20=\x20i.','me.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','default','value','read','and','Contact','operator','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','type','text','tags','clause','ids','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','end','body','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL'];(function(_0x263ffd,_0x140cf8){var _0x2b3b8b=function(_0x36331e){while(--_0x36331e){_0x263ffd['push'](_0x263ffd['shift']());}};_0x2b3b8b(++_0x140cf8);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x3a42be,_0x24fe67){_0x3a42be=_0x3a42be-0x0;var _0x232448=_0x1d2d[_0x3a42be];return _0x232448;};'use strict';var _=require(_0xd1d2('0x0'));var squel=require(_0xd1d2('0x1'));var as=require(_0xd1d2('0x2'));var qs=require(_0xd1d2('0x3'));var updateInteraction=require(_0xd1d2('0x4'))['updateInteraction'];var utils=require(_0xd1d2('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x5d3fac,_0x3caa72,_0x2bfabc){var _0x9852c0=![];var _0x269613=utils[_0xd1d2('0x6')](_0x5d3fac);if(_0x3caa72[_0xd1d2('0x7')]==='agent'&&!_0x2bfabc[_0xd1d2('0x8')]&&!_0x2bfabc[_0x269613]){_0x9852c0=!![];}return _0x9852c0;}function getTagsQuery(){return squel[_0xd1d2('0x9')]()[_0xd1d2('0xa')]('id')[_0xd1d2('0xa')](_0xd1d2('0xb'))[_0xd1d2('0xa')](_0xd1d2('0xc'))[_0xd1d2('0xd')](_0xd1d2('0xe'));}function getUsersQuery(_0x353f9b,_0x900ec){var _0x227d7f=utils[_0xd1d2('0xf')](_0x353f9b);var _0x5b21f4=_0xd1d2('0x10')+_0x353f9b+_0xd1d2('0x11');var _0x3ae4ae=squel[_0xd1d2('0x9')]()[_0xd1d2('0xa')](_0xd1d2('0x12'))[_0xd1d2('0xa')](_0xd1d2('0x13'))[_0xd1d2('0xa')](_0xd1d2('0x14')+_0x227d7f)['from'](_0x5b21f4,'ui')[_0xd1d2('0x15')](_0xd1d2('0x16'),'u',_0xd1d2('0x17'));if(_0x900ec['length']>0x0){_0x3ae4ae[_0xd1d2('0x18')](_0xd1d2('0x14')+_0x227d7f+_0xd1d2('0x19'),_[_0xd1d2('0x1a')](_0x900ec,'id'));}return _0x3ae4ae;}function getInteractionsQuery(_0xecac1f){var _0x2723b3=utils[_0xd1d2('0x1b')](_0xecac1f);var _0x57f2f9=utils['getAccountFK'](_0xecac1f);var _0x3be186=utils['getInteractionFK'](_0xecac1f);return squel[_0xd1d2('0x9')]()[_0xd1d2('0xd')](_0x2723b3[_0xd1d2('0x1c')],'i')[_0xd1d2('0x15')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xd1d2('0x15')]('users','o','o.id\x20=\x20i.UserId')[_0xd1d2('0x15')](_0x2723b3[_0xd1d2('0x1d')],'a',_0xd1d2('0x1e')+_0x57f2f9)[_0xd1d2('0x15')](_0x2723b3['messages'],'me',_0xd1d2('0x1f')+_0x3be186+_0xd1d2('0x20'))[_0xd1d2('0x15')](_0x2723b3['interactionsTags'],'it','it.'+_0x3be186+_0xd1d2('0x20'))[_0xd1d2('0x15')](_0xd1d2('0xe'),'t',_0xd1d2('0x21'));}function getSqlClauses(){var _0x3f229c={'body':squel[_0xd1d2('0x22')](),'contact':squel[_0xd1d2('0x22')](),'default':squel['expr'](),'fields':squel[_0xd1d2('0x22')](),'filter':squel[_0xd1d2('0x22')](),'read':squel[_0xd1d2('0x22')](),'tags':{'clause':squel[_0xd1d2('0x22')](),'ids':null},'user':squel[_0xd1d2('0x22')]()};return _0x3f229c;}function parseTagParameter(_0x39e991){var _0x28b8be=squel[_0xd1d2('0x22')]();if(_0x39e991){var _0xe6ef3c=utils[_0xd1d2('0x23')](_0x39e991);_0xe6ef3c[_0xd1d2('0x24')](function(_0x4e1bc2){_0x28b8be['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4e1bc2+',%');});}return _0x28b8be;}function parseReadParameter(_0x133c6c){var _0x442375='';if(_0x133c6c){_0x442375=_0xd1d2('0x25');if(_0x133c6c==='1'){_0x442375=_0x442375[_0xd1d2('0x26')](_0xd1d2('0x27'),'=');}else{_0x442375=_0x442375['replace'](_0xd1d2('0x27'),'>');}}return _0x442375;}function parseSearchFilter(_0x41171c,_0x383947){var _0x4b4134=squel[_0xd1d2('0x22')]();if(_0x383947){var _0x1db17f=_0x383947[_0xd1d2('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd1d2('0x28')](_0x1db17f)){_0x4b4134['or'](_0xd1d2('0x29'),_0x1db17f+'%');if([_0xd1d2('0x2a'),_0xd1d2('0x2b')][_0xd1d2('0x2c')](_0x41171c)){_0x4b4134['or'](_0xd1d2('0x2d'),_0x1db17f+'%');}else if(_0x41171c===_0xd1d2('0x2e')){_0x4b4134['or'](_0xd1d2('0x2f'),_0x1db17f+'%');}else if(_0x41171c===_0xd1d2('0x30')){_0x4b4134['or'](_0xd1d2('0x31'),_0x1db17f+'%');}}else if(_0x41171c===_0xd1d2('0x32')&&qs[_0xd1d2('0x33')](_0x1db17f)){_0x4b4134['or'](_0xd1d2('0x34'),_0x1db17f+'%');}else{if(_0x41171c===_0xd1d2('0x32')){_0x4b4134['or'](_0xd1d2('0x35'),qs[_0xd1d2('0x36')](_0x1db17f))['or'](_0xd1d2('0x37'),qs[_0xd1d2('0x36')](_0x1db17f));}else{if(_0x41171c!=='fax'){_0x4b4134['or'](_0xd1d2('0x38'),qs[_0xd1d2('0x36')](_0x1db17f));}_0x4b4134['or'](_0xd1d2('0x39'),_0x1db17f+'%');}}}return _0x4b4134;}function parseAdvancedSearchFilter(_0x573d27,_0x2ded64){var _0x516049=getSqlClauses();var _0x57a7fb=as[_0xd1d2('0x3a')](_0x573d27);var _0x103c5f=_0x57a7fb[_0xd1d2('0x3b')];for(var _0x1d00e0=0x0;_0x1d00e0<_0x57a7fb[_0xd1d2('0x3c')][_0xd1d2('0x3d')];_0x1d00e0++){var _0x56f48e=_0x57a7fb[_0xd1d2('0x3c')][_0x1d00e0];var _0x168eb8='i';var _0x5bdf40=_[_0xd1d2('0x3e')](_0x2ded64,[_0xd1d2('0xb'),_0x56f48e[_0xd1d2('0xa')]]);if(_0x5bdf40){var _0x2f55a1=as['buildExpression'](_0x168eb8,_0x5bdf40['type'],_0x56f48e);_0x516049[_0xd1d2('0x3f')][_0x103c5f](_0x2f55a1['text'],_0x2f55a1['value']['start'],_0x2f55a1[_0xd1d2('0x40')]['end']);}else{switch(_0x56f48e[_0xd1d2('0xa')]){case'unreadMessages':var _0x47996a=parseReadParameter(_0x56f48e['value']);_0x516049[_0xd1d2('0x41')][_0xd1d2('0x42')](_0x47996a);break;case _0xd1d2('0x43'):if(_0x56f48e[_0xd1d2('0x44')]===_0xd1d2('0x45')){if(_0x56f48e[_0xd1d2('0x40')][_0xd1d2('0x46')]('\x20')[_0xd1d2('0x3d')]>0x1){_0x516049[_0xd1d2('0x47')][_0x103c5f](_0xd1d2('0x48'),qs[_0xd1d2('0x36')](_0x56f48e[_0xd1d2('0x40')]),null);}else{var _0x1c2835='%'+_0x56f48e[_0xd1d2('0x40')]+'%';_0x516049['contact'][_0x103c5f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1c2835,_0x1c2835,_0x1c2835);}}else{_0x5bdf40=_[_0xd1d2('0x3e')](_0x2ded64,[_0xd1d2('0xb'),_0xd1d2('0x49')]);_0x56f48e['field']='ContactId';_0x2f55a1=as[_0xd1d2('0x4a')](_0x168eb8,_0x5bdf40[_0xd1d2('0x4b')],_0x56f48e);_0x516049['contact'][_0x103c5f](_0x2f55a1[_0xd1d2('0x4c')],_0x2f55a1['value']['start'],_0x2f55a1[_0xd1d2('0x40')]['end']);}break;case'Tag':var _0x1825f2=_0x56f48e[_0xd1d2('0x40')][_0xd1d2('0x46')](',')['map'](function(_0x2ba87b){return Number(_0x2ba87b);});var _0x192fa4=parseTagParameter(_0x1825f2);_0x516049[_0xd1d2('0x4d')][_0xd1d2('0x4e')]['and'](_0x192fa4);_0x516049[_0xd1d2('0x4d')][_0xd1d2('0x4f')]=_0x1825f2;break;case'User':if(_0x56f48e[_0xd1d2('0x44')]==='$substring'){_0x516049[_0xd1d2('0x50')][_0x103c5f](_0xd1d2('0x51'),'%'+_0x56f48e[_0xd1d2('0x40')]+'%',null);}else{_0x5bdf40=_[_0xd1d2('0x3e')](_0x2ded64,[_0xd1d2('0xb'),'UserId']);_0x56f48e['field']=_0xd1d2('0x52');_0x2f55a1=as[_0xd1d2('0x4a')](_0x168eb8,_0x5bdf40['type'],_0x56f48e);_0x516049[_0xd1d2('0x50')][_0x103c5f](_0x2f55a1[_0xd1d2('0x4c')],_0x2f55a1[_0xd1d2('0x40')][_0xd1d2('0x53')],_0x2f55a1[_0xd1d2('0x40')][_0xd1d2('0x54')]);}break;case _0xd1d2('0x55'):case'plainBody':_0x2f55a1=as[_0xd1d2('0x4a')]('me',null,_0x56f48e);_0x516049[_0xd1d2('0x55')][_0x103c5f](_0x2f55a1['text'],_0x2f55a1[_0xd1d2('0x40')][_0xd1d2('0x53')],_0x2f55a1['value']['end']);break;}}}return _0x516049;}function parseModelFields(_0x3d4fe3,_0x182ea8,_0x4cb376){var _0x21fdfb=utils[_0xd1d2('0x6')](_0x3d4fe3);var _0x2553df=squel[_0xd1d2('0x22')]();var _0x404ad2=_(_0x182ea8)['keys']()['map'](function(_0x314af3){return _['some'](_0x4cb376,[_0xd1d2('0xb'),_0x314af3])?_0x314af3:undefined;})[_0xd1d2('0x56')]()['value']();if(_0x404ad2[_0xd1d2('0x3d')]>0x0){_0x404ad2[_0xd1d2('0x24')](function(_0x4e780c){if(_0x4e780c===_0x21fdfb){_0x2553df['and']('i.'+_0x21fdfb+_0xd1d2('0x19'),[][_0xd1d2('0x57')](_0x182ea8[_0x4e780c]));}else if(_0x4e780c===_0xd1d2('0x58')){var _0xfd8024=JSON[_0xd1d2('0x59')](_0x182ea8[_0x4e780c])[_0xd1d2('0x5a')];var _0x1f6150=JSON[_0xd1d2('0x59')](_0x182ea8[_0x4e780c])[_0xd1d2('0x5b')];_0x2553df['and'](_0xd1d2('0x5c'),_0xfd8024,_0x1f6150);}else{if(_0x182ea8[_0x4e780c]==='null'){_0x2553df['and']('i.'+_0x4e780c+_0xd1d2('0x5d'));}else{_0x2553df[_0xd1d2('0x42')]('i.'+_0x4e780c+_0xd1d2('0x5e'),_0x182ea8[_0x4e780c]);}}});}return _0x2553df;}function parseQueryParameters(_0x47417f,_0x215dea,_0x459209){var _0x35a51b=getSqlClauses();return Promise[_0xd1d2('0x5f')]()[_0xd1d2('0x60')](function(){return parseModelFields(_0x47417f,_0x215dea,_0x459209);})[_0xd1d2('0x60')](function(_0x28173a){_0x35a51b[_0xd1d2('0x61')][_0xd1d2('0x42')](_0x28173a);return parseReadParameter(_0x215dea['read']);})['then'](function(_0x367f3c){_0x35a51b[_0xd1d2('0x41')][_0xd1d2('0x42')](_0x367f3c);return parseTagParameter(_0x215dea[_0xd1d2('0x62')]);})[_0xd1d2('0x60')](function(_0x1d1d31){_0x35a51b[_0xd1d2('0x4d')][_0xd1d2('0x4e')][_0xd1d2('0x42')](_0x1d1d31);return parseSearchFilter(_0x47417f,_0x215dea[_0xd1d2('0x63')]);})[_0xd1d2('0x60')](function(_0x54406e){_0x35a51b['filter']=_0x54406e;return _0x35a51b;});}function checkAccountsRestrictions(_0x306242,_0x321bc8,_0x3d1da1){var _0x1c6a46=utils['getAccountFK'](_0x306242);var _0x17e149=_0xd1d2('0x64')+_[_0xd1d2('0x65')](_0x306242)+(_0x306242===_0xd1d2('0x66')?_0xd1d2('0x67'):_0xd1d2('0x68'));var _0x1c04e4=squel['expr']();return Promise[_0xd1d2('0x5f')]()[_0xd1d2('0x60')](function(){if(_0x3d1da1[_0xd1d2('0x8')]&&_0x321bc8['role']==='agent'){return _0x321bc8[_0x17e149]({'attributes':['id'],'raw':!![]});}})[_0xd1d2('0x60')](function(_0x3cd7c7){if(_0x3cd7c7){if(_0x3cd7c7[_0xd1d2('0x3d')]===0x0){_0x1c04e4[_0xd1d2('0x42')]('i.'+_0x1c6a46+'\x20IS\x20NULL');}else{_0x1c04e4[_0xd1d2('0x42')]('i.'+_0x1c6a46+_0xd1d2('0x19'),_[_0xd1d2('0x1a')](_0x3cd7c7,'id'));}}else if(!_0x3d1da1[_0x1c6a46]){_0x1c04e4['and']('i.'+_0x1c6a46+_0xd1d2('0x69'));}})[_0xd1d2('0x60')](function(){return _0x1c04e4;});}function getClosedOrderClause(_0x4842f1,_0x69a9e2){var _0x3799b7='';var _0x12201f=[_0xd1d2('0x6a'),'i.secondDisposition',_0xd1d2('0x6b')];if(_0x4842f1===_0xd1d2('0x32')){_0x12201f[_0xd1d2('0x6c')](_0xd1d2('0x6d'));}if(_0x69a9e2[_0xd1d2('0x6e')]==='0'&&_0x4842f1==='mail'){_0x3799b7='i.substatus';}else{if(_0x69a9e2['closed']==='1'){_0x12201f['shift']();}_0x3799b7='CONCAT_WS(\x27\x27,\x20'+_0x12201f[_0xd1d2('0x6f')](',\x20')+')';}return _0x3799b7;}function getFilteredInteractions(_0x271e4a,_0x386b51,_0x5f5043,_0x42d6b8){var _0x17c4eb=utils[_0xd1d2('0xf')](_0x271e4a);var _0x580d83=_[_0xd1d2('0x65')](_0x271e4a)+_0xd1d2('0x70');var _0x47422d=[];var _0x4a42d9=getTagsQuery();var _0x43b43c={'type':db[_0xd1d2('0x71')]['QueryTypes'][_0xd1d2('0x72')],'raw':!![]};var _0x1c3c36=[];var _0x516a57=[];return db['sequelize'][_0xd1d2('0x73')](_0x4a42d9[_0xd1d2('0x74')](),_0x43b43c)[_0xd1d2('0x60')](function(_0x14cd07){_0x47422d=_['keyBy'](_0x14cd07,'id');_0x43b43c=_[_0xd1d2('0x75')](_0x43b43c,{'model':db[_0x580d83],'mapToModel':!![],'nest':!![]});if(_0x5f5043[_0xd1d2('0x61')]){_0x42d6b8[_0xd1d2('0x76')][_0xd1d2('0x24')](function(_0x5d537e){_0x386b51[_0xd1d2('0xa')]('i.'+_0x5d537e);});}else{_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x77'),'unreadMessages');_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x78'),'Account.key');_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x79'),_0xd1d2('0x7a'));if(_0x271e4a===_0xd1d2('0x32')){_0x386b51[_0xd1d2('0xa')]('a.email',_0xd1d2('0x7b'));_0x386b51['field']('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');_0x386b51['field'](_0xd1d2('0x7c'));_0x386b51['field'](_0xd1d2('0x7d'));_0x386b51['field'](_0xd1d2('0x7e'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x7f'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x80'));_0x386b51[_0xd1d2('0xa')]('i.attach');_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x81'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x82'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x83'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x6b'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x84'));_0x386b51['field'](_0xd1d2('0x6a'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x6d'));_0x386b51[_0xd1d2('0xa')]('i.to');_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x85'));_0x386b51[_0xd1d2('0xa')]('i.MailAccountId');_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x86'));}else if(_0x271e4a==='openchannel'){_0x386b51['field'](_0xd1d2('0x87'),_0xd1d2('0x88'));}else{_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x89'),_0xd1d2('0x88'));}if(_0x271e4a!==_0xd1d2('0x32')){_0x386b51[_0xd1d2('0xa')]('i.*');}_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x8a'),_0xd1d2('0x8b'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x8c'),_0xd1d2('0x8d'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x8e'),_0xd1d2('0x8f'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x90'),_0xd1d2('0x91'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x92'),'Contact.mobile');_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x93'),_0xd1d2('0x94'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x95'),_0xd1d2('0x96'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x97'),_0xd1d2('0x98'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x99'),_0xd1d2('0x9a'));}if(_0x42d6b8[_0xd1d2('0x9b')]){_0x386b51['limit'](_0x42d6b8[_0xd1d2('0x9b')]);}if(_0x42d6b8[_0xd1d2('0x9c')]){_0x386b51[_0xd1d2('0x9c')](_0x42d6b8[_0xd1d2('0x9c')]);}return db[_0xd1d2('0x9d')][_0xd1d2('0x73')](_0x386b51[_0xd1d2('0x74')](),_0x43b43c);})[_0xd1d2('0x60')](function(_0x28a351){_0x1c3c36=_0x28a351;var _0x59c11a=getUsersQuery(_0x271e4a,_0x1c3c36);return db[_0xd1d2('0x9d')][_0xd1d2('0x73')](_0x59c11a['toString'](),_0x43b43c);})[_0xd1d2('0x60')](function(_0x234262){_0x516a57=_[_0xd1d2('0x9e')](_0x234262,_0x17c4eb);if(_0x271e4a===_0xd1d2('0x32')){return db[_0xd1d2('0x9f')]['findOne']({'attributes':[_0xd1d2('0xa0')],'raw':!![]});}})[_0xd1d2('0x60')](function(_0x2b4bb8){var _0x720693=_0x2b4bb8?_0x2b4bb8['enableEmailPreview']:undefined;var _0x68f8ba=_0x1c3c36[_0xd1d2('0x1a')](function(_0x3b7fc5){return updateInteraction(_0x3b7fc5,_0x47422d,_0x516a57,_0x720693);});return Promise[_0xd1d2('0xa1')](_0x68f8ba);});}function countFilteredInteractions(_0x39c9f1,_0x18bd6d){var _0x1aa0a5=_0x39c9f1['clone']();_0x1aa0a5[_0xd1d2('0xa')](_0xd1d2('0xa2'));_0x1aa0a5[_0xd1d2('0xa')](_0xd1d2('0x77'),_0xd1d2('0xa3'));var _0x30b8e7=utils[_0xd1d2('0x23')](_0x18bd6d);if(!_[_0xd1d2('0xa4')](_0x30b8e7)){_0x1aa0a5[_0xd1d2('0x18')](_0xd1d2('0xa5'),_0x30b8e7);}var _0x1cad85={'type':db[_0xd1d2('0x71')][_0xd1d2('0xa6')][_0xd1d2('0x72')],'raw':!![]};return db[_0xd1d2('0x9d')][_0xd1d2('0x73')](_0x1aa0a5[_0xd1d2('0x74')](),_0x1cad85);}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 _0x2bc6=['c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','tools_tags','getInteractionFK','user_has_','_interactions','u.fullname','ui.','from','left_join','u.id\x20=\x20ui.UserId','length','\x20IN\x20?','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','sqlOperator','conditions','find','type','default','value','start','end','unreadMessages','read','and','Contact','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','tags','clause','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','tag','filter','get','capitalize','Websites','Accounts','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','SELECT','sequelize','toString','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.secondDisposition','i.to','i.UserId','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*'];(function(_0x2c9461,_0x18e24d){var _0x50e4fb=function(_0x1fc85e){while(--_0x1fc85e){_0x2c9461['push'](_0x2c9461['shift']());}};_0x50e4fb(++_0x18e24d);}(_0x2bc6,0x163));var _0x62bc=function(_0x5f44f6,_0x5bf9cf){_0x5f44f6=_0x5f44f6-0x0;var _0x420ae8=_0x2bc6[_0x5f44f6];return _0x420ae8;};'use strict';var _=require(_0x62bc('0x0'));var squel=require(_0x62bc('0x1'));var as=require(_0x62bc('0x2'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require('./utils');var db=require(_0x62bc('0x3'))['db'];function skipInteractionsQuery(_0x576608,_0x2a1959,_0x2b12de){var _0x4fac5b=![];var _0x3cce26=utils[_0x62bc('0x4')](_0x576608);if(_0x2a1959[_0x62bc('0x5')]===_0x62bc('0x6')&&!_0x2b12de[_0x62bc('0x7')]&&!_0x2b12de[_0x3cce26]){_0x4fac5b=!![];}return _0x4fac5b;}function getTagsQuery(){return squel[_0x62bc('0x8')]()['field']('id')[_0x62bc('0x9')](_0x62bc('0xa'))[_0x62bc('0x9')](_0x62bc('0xb'))['from'](_0x62bc('0xc'));}function getUsersQuery(_0x107bf9,_0x1e3a57){var _0x546acc=utils[_0x62bc('0xd')](_0x107bf9);var _0x22e6c8=_0x62bc('0xe')+_0x107bf9+_0x62bc('0xf');var _0x217456=squel[_0x62bc('0x8')]()[_0x62bc('0x9')]('u.id')[_0x62bc('0x9')](_0x62bc('0x10'))['field'](_0x62bc('0x11')+_0x546acc)[_0x62bc('0x12')](_0x22e6c8,'ui')[_0x62bc('0x13')]('users','u',_0x62bc('0x14'));if(_0x1e3a57[_0x62bc('0x15')]>0x0){_0x217456['where']('ui.'+_0x546acc+_0x62bc('0x16'),_[_0x62bc('0x17')](_0x1e3a57,'id'));}return _0x217456;}function getInteractionsQuery(_0x5bb569){var _0x278893=utils[_0x62bc('0x18')](_0x5bb569);var _0xc1211c=utils[_0x62bc('0x4')](_0x5bb569);var _0xc95407=utils[_0x62bc('0xd')](_0x5bb569);return squel[_0x62bc('0x8')]()[_0x62bc('0x12')](_0x278893[_0x62bc('0x19')],'i')['left_join']('cm_contacts','c',_0x62bc('0x1a'))[_0x62bc('0x13')](_0x62bc('0x1b'),'o','o.id\x20=\x20i.UserId')[_0x62bc('0x13')](_0x278893['accounts'],'a',_0x62bc('0x1c')+_0xc1211c)[_0x62bc('0x13')](_0x278893[_0x62bc('0x1d')],'me','me.'+_0xc95407+_0x62bc('0x1e'))[_0x62bc('0x13')](_0x278893[_0x62bc('0x1f')],'it',_0x62bc('0x20')+_0xc95407+_0x62bc('0x1e'))[_0x62bc('0x13')]('tools_tags','t',_0x62bc('0x21'));}function getSqlClauses(){var _0xb0d0fb={'body':squel[_0x62bc('0x22')](),'contact':squel[_0x62bc('0x22')](),'default':squel[_0x62bc('0x22')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0x62bc('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x62bc('0x22')]()};return _0xb0d0fb;}function parseTagParameter(_0x36af97){var _0x1e046d=squel['expr']();if(_0x36af97){var _0x3d55df=utils[_0x62bc('0x23')](_0x36af97);_0x3d55df[_0x62bc('0x24')](function(_0x5c03ac){_0x1e046d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5c03ac+',%');});}return _0x1e046d;}function parseReadParameter(_0x641626){var _0x410c36='';if(_0x641626){_0x410c36=_0x62bc('0x25');if(_0x641626==='1'){_0x410c36=_0x410c36['replace'](_0x62bc('0x26'),'=');}else{_0x410c36=_0x410c36[_0x62bc('0x27')](_0x62bc('0x26'),'>');}}return _0x410c36;}function parseSearchFilter(_0x444267,_0x5a9302){var _0x4522ef=squel['expr']();if(_0x5a9302){var _0x26701b=_0x5a9302[_0x62bc('0x27')]('\x5c','\x5c\x5c')[_0x62bc('0x27')](/'/g,'\x27\x27');if(qs[_0x62bc('0x28')](_0x26701b)){_0x4522ef['or'](_0x62bc('0x29'),_0x26701b+'%');if([_0x62bc('0x2a'),_0x62bc('0x2b')][_0x62bc('0x2c')](_0x444267)){_0x4522ef['or'](_0x62bc('0x2d'),_0x26701b+'%');}else if(_0x444267===_0x62bc('0x2e')){_0x4522ef['or'](_0x62bc('0x2f'),_0x26701b+'%');}else if(_0x444267===_0x62bc('0x30')){_0x4522ef['or'](_0x62bc('0x31'),_0x26701b+'%');}}else if(_0x444267===_0x62bc('0x32')&&qs[_0x62bc('0x33')](_0x26701b)){_0x4522ef['or'](_0x62bc('0x34'),_0x26701b+'%');}else{if(_0x444267===_0x62bc('0x32')){_0x4522ef['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x62bc('0x35')](_0x26701b))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x26701b));}else{if(_0x444267!==_0x62bc('0x2e')){_0x4522ef['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x26701b));}_0x4522ef['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x26701b+'%');}}}return _0x4522ef;}function parseAdvancedSearchFilter(_0x3f22c1,_0x45f829){var _0x26e043=getSqlClauses();var _0x4efabd=as['parseSearch'](_0x3f22c1);var _0x4cc0d3=_0x4efabd[_0x62bc('0x36')];for(var _0x2245a7=0x0;_0x2245a7<_0x4efabd['conditions']['length'];_0x2245a7++){var _0x33d0f7=_0x4efabd[_0x62bc('0x37')][_0x2245a7];var _0x3aaed8='i';var _0x549013=_[_0x62bc('0x38')](_0x45f829,[_0x62bc('0xa'),_0x33d0f7[_0x62bc('0x9')]]);if(_0x549013){var _0x9482f7=as['buildExpression'](_0x3aaed8,_0x549013[_0x62bc('0x39')],_0x33d0f7);_0x26e043[_0x62bc('0x3a')][_0x4cc0d3](_0x9482f7['text'],_0x9482f7[_0x62bc('0x3b')][_0x62bc('0x3c')],_0x9482f7[_0x62bc('0x3b')][_0x62bc('0x3d')]);}else{switch(_0x33d0f7['field']){case _0x62bc('0x3e'):var _0x50065a=parseReadParameter(_0x33d0f7[_0x62bc('0x3b')]);_0x26e043[_0x62bc('0x3f')][_0x62bc('0x40')](_0x50065a);break;case _0x62bc('0x41'):if(_0x33d0f7['operator']===_0x62bc('0x42')){if(_0x33d0f7[_0x62bc('0x3b')][_0x62bc('0x43')]('\x20')[_0x62bc('0x15')]>0x1){_0x26e043[_0x62bc('0x44')][_0x4cc0d3](_0x62bc('0x45'),qs[_0x62bc('0x35')](_0x33d0f7[_0x62bc('0x3b')]),null);}else{var _0xfef765='%'+_0x33d0f7[_0x62bc('0x3b')]+'%';_0x26e043[_0x62bc('0x44')][_0x4cc0d3]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xfef765,_0xfef765,_0xfef765);}}else{_0x549013=_['find'](_0x45f829,[_0x62bc('0xa'),_0x62bc('0x46')]);_0x33d0f7['field']=_0x62bc('0x46');_0x9482f7=as[_0x62bc('0x47')](_0x3aaed8,_0x549013[_0x62bc('0x39')],_0x33d0f7);_0x26e043[_0x62bc('0x44')][_0x4cc0d3](_0x9482f7[_0x62bc('0x48')],_0x9482f7['value'][_0x62bc('0x3c')],_0x9482f7[_0x62bc('0x3b')]['end']);}break;case'Tag':var _0x12194a=_0x33d0f7[_0x62bc('0x3b')][_0x62bc('0x43')](',')['map'](function(_0x185423){return Number(_0x185423);});var _0x2407b8=parseTagParameter(_0x12194a);_0x26e043[_0x62bc('0x49')][_0x62bc('0x4a')][_0x62bc('0x40')](_0x2407b8);_0x26e043[_0x62bc('0x49')]['ids']=_0x12194a;break;case _0x62bc('0x4b'):if(_0x33d0f7['operator']===_0x62bc('0x42')){_0x26e043[_0x62bc('0x4c')][_0x4cc0d3](_0x62bc('0x4d'),'%'+_0x33d0f7['value']+'%',null);}else{_0x549013=_['find'](_0x45f829,['name',_0x62bc('0x4e')]);_0x33d0f7['field']=_0x62bc('0x4e');_0x9482f7=as[_0x62bc('0x47')](_0x3aaed8,_0x549013['type'],_0x33d0f7);_0x26e043['user'][_0x4cc0d3](_0x9482f7['text'],_0x9482f7[_0x62bc('0x3b')][_0x62bc('0x3c')],_0x9482f7[_0x62bc('0x3b')][_0x62bc('0x3d')]);}break;case _0x62bc('0x4f'):case'plainBody':_0x9482f7=as[_0x62bc('0x47')]('me',null,_0x33d0f7);_0x26e043[_0x62bc('0x4f')][_0x4cc0d3](_0x9482f7['text'],_0x9482f7[_0x62bc('0x3b')]['start'],_0x9482f7[_0x62bc('0x3b')][_0x62bc('0x3d')]);break;}}}return _0x26e043;}function parseModelFields(_0x17e0ec,_0xca6190,_0x162609){var _0x28747b=utils[_0x62bc('0x4')](_0x17e0ec);var _0x481562=squel[_0x62bc('0x22')]();var _0x29916a=_(_0xca6190)['keys']()[_0x62bc('0x17')](function(_0x5b8bab){return _[_0x62bc('0x50')](_0x162609,[_0x62bc('0xa'),_0x5b8bab])?_0x5b8bab:undefined;})['compact']()[_0x62bc('0x3b')]();if(_0x29916a[_0x62bc('0x15')]>0x0){_0x29916a[_0x62bc('0x24')](function(_0x4c9b3e){if(_0x4c9b3e===_0x28747b){_0x481562[_0x62bc('0x40')]('i.'+_0x28747b+_0x62bc('0x16'),[][_0x62bc('0x51')](_0xca6190[_0x4c9b3e]));}else if(_0x4c9b3e===_0x62bc('0x52')){var _0x24b107=JSON[_0x62bc('0x53')](_0xca6190[_0x4c9b3e])[_0x62bc('0x54')];var _0x446160=JSON[_0x62bc('0x53')](_0xca6190[_0x4c9b3e])[_0x62bc('0x55')];_0x481562[_0x62bc('0x40')](_0x62bc('0x56'),_0x24b107,_0x446160);}else{if(_0xca6190[_0x4c9b3e]===_0x62bc('0x57')){_0x481562[_0x62bc('0x40')]('i.'+_0x4c9b3e+_0x62bc('0x58'));}else{_0x481562[_0x62bc('0x40')]('i.'+_0x4c9b3e+'\x20=\x20?',_0xca6190[_0x4c9b3e]);}}});}return _0x481562;}function parseQueryParameters(_0x1f9010,_0x440fd9,_0x3ce3ce){var _0x152045=getSqlClauses();return Promise[_0x62bc('0x59')]()[_0x62bc('0x5a')](function(){return parseModelFields(_0x1f9010,_0x440fd9,_0x3ce3ce);})[_0x62bc('0x5a')](function(_0x3fa883){_0x152045[_0x62bc('0x5b')][_0x62bc('0x40')](_0x3fa883);return parseReadParameter(_0x440fd9[_0x62bc('0x3f')]);})[_0x62bc('0x5a')](function(_0x5ebee0){_0x152045[_0x62bc('0x3f')]['and'](_0x5ebee0);return parseTagParameter(_0x440fd9[_0x62bc('0x5c')]);})[_0x62bc('0x5a')](function(_0x268681){_0x152045[_0x62bc('0x49')][_0x62bc('0x4a')][_0x62bc('0x40')](_0x268681);return parseSearchFilter(_0x1f9010,_0x440fd9[_0x62bc('0x5d')]);})[_0x62bc('0x5a')](function(_0x4934ce){_0x152045['filter']=_0x4934ce;return _0x152045;});}function checkAccountsRestrictions(_0xd35ce2,_0xaa83af,_0x1f72bb){var _0x56bccf=utils[_0x62bc('0x4')](_0xd35ce2);var _0x1325a4=_0x62bc('0x5e')+_[_0x62bc('0x5f')](_0xd35ce2)+(_0xd35ce2==='chat'?_0x62bc('0x60'):_0x62bc('0x61'));var _0x237714=squel[_0x62bc('0x22')]();return Promise[_0x62bc('0x59')]()[_0x62bc('0x5a')](function(){if(_0x1f72bb[_0x62bc('0x7')]&&_0xaa83af['role']===_0x62bc('0x6')){return _0xaa83af[_0x1325a4]({'attributes':['id'],'raw':!![]});}})[_0x62bc('0x5a')](function(_0x39c443){if(_0x39c443){if(_0x39c443['length']===0x0){_0x237714['and']('i.'+_0x56bccf+_0x62bc('0x58'));}else{_0x237714[_0x62bc('0x40')]('i.'+_0x56bccf+_0x62bc('0x16'),_['map'](_0x39c443,'id'));}}else if(!_0x1f72bb[_0x56bccf]){_0x237714[_0x62bc('0x40')]('i.'+_0x56bccf+'\x20IS\x20NOT\x20NULL');}})[_0x62bc('0x5a')](function(){return _0x237714;});}function getClosedOrderClause(_0x15741c,_0x4b593a){var _0x3884b0='';var _0x5d169c=[_0x62bc('0x62'),'i.secondDisposition',_0x62bc('0x63')];if(_0x15741c===_0x62bc('0x32')){_0x5d169c[_0x62bc('0x64')](_0x62bc('0x65'));}if(_0x4b593a[_0x62bc('0x66')]==='0'&&_0x15741c===_0x62bc('0x32')){_0x3884b0='i.substatus';}else{if(_0x4b593a[_0x62bc('0x66')]==='1'){_0x5d169c[_0x62bc('0x67')]();}_0x3884b0=_0x62bc('0x68')+_0x5d169c['join'](',\x20')+')';}return _0x3884b0;}function getFilteredInteractions(_0x107b36,_0x3de486,_0x304bdc,_0x132509){var _0x525590=utils[_0x62bc('0xd')](_0x107b36);var _0x38c171=_[_0x62bc('0x5f')](_0x107b36)+_0x62bc('0x69');var _0x31d5f0=[];var _0x4a6fca=getTagsQuery();var _0x48439f={'type':db[_0x62bc('0x6a')]['QueryTypes'][_0x62bc('0x6b')],'raw':!![]};var _0x18779a=[];var _0x4dc4c8=[];return db[_0x62bc('0x6c')]['query'](_0x4a6fca[_0x62bc('0x6d')](),_0x48439f)['then'](function(_0x468f58){_0x31d5f0=_['keyBy'](_0x468f58,'id');_0x48439f=_[_0x62bc('0x6e')](_0x48439f,{'model':db[_0x38c171],'mapToModel':!![],'nest':!![]});if(_0x304bdc[_0x62bc('0x5b')]){_0x132509[_0x62bc('0x6f')]['forEach'](function(_0x243122){_0x3de486[_0x62bc('0x9')]('i.'+_0x243122);});}else{_0x3de486[_0x62bc('0x9')](_0x62bc('0x70'),_0x62bc('0x3e'));_0x3de486['field'](_0x62bc('0x71'),_0x62bc('0x72'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x73'),_0x62bc('0x74'));if(_0x107b36===_0x62bc('0x32')){_0x3de486[_0x62bc('0x9')](_0x62bc('0x75'),_0x62bc('0x76'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x77'),'contactName');_0x3de486[_0x62bc('0x9')](_0x62bc('0x78'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x79'));_0x3de486['field'](_0x62bc('0x7a'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x7b'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x7c'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x7d'));_0x3de486[_0x62bc('0x9')]('i.lastMsgAt');_0x3de486[_0x62bc('0x9')](_0x62bc('0x7e'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x7f'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x63'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x80'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x62'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x65'));_0x3de486['field'](_0x62bc('0x81'));_0x3de486[_0x62bc('0x9')]('i.ContactId');_0x3de486[_0x62bc('0x9')]('i.MailAccountId');_0x3de486[_0x62bc('0x9')](_0x62bc('0x82'));}else if(_0x107b36==='openchannel'){_0x3de486[_0x62bc('0x9')]('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',_0x62bc('0x83'));}else{_0x3de486['field'](_0x62bc('0x84'),'contactName');}if(_0x107b36!==_0x62bc('0x32')){_0x3de486[_0x62bc('0x9')](_0x62bc('0x85'));}_0x3de486[_0x62bc('0x9')](_0x62bc('0x86'),_0x62bc('0x87'));_0x3de486['field'](_0x62bc('0x88'),_0x62bc('0x89'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x8a'),_0x62bc('0x8b'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x8c'),_0x62bc('0x8d'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x8e'),_0x62bc('0x8f'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x90'),'Contact.fax');_0x3de486['field']('o.fullname',_0x62bc('0x91'));_0x3de486['field'](_0x62bc('0x92'),_0x62bc('0x93'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x94'),_0x62bc('0x95'));}if(_0x132509[_0x62bc('0x96')]){_0x3de486[_0x62bc('0x96')](_0x132509[_0x62bc('0x96')]);}if(_0x132509['offset']){_0x3de486[_0x62bc('0x97')](_0x132509[_0x62bc('0x97')]);}return db[_0x62bc('0x6c')]['query'](_0x3de486[_0x62bc('0x6d')](),_0x48439f);})['then'](function(_0x339248){_0x18779a=_0x339248;var _0x3aa295=getUsersQuery(_0x107b36,_0x18779a);return db['sequelize'][_0x62bc('0x98')](_0x3aa295[_0x62bc('0x6d')](),_0x48439f);})['then'](function(_0x4e2463){_0x4dc4c8=_['groupBy'](_0x4e2463,_0x525590);if(_0x107b36==='mail'){return db[_0x62bc('0x99')][_0x62bc('0x9a')]({'attributes':[_0x62bc('0x9b')],'raw':!![]});}})[_0x62bc('0x5a')](function(_0x3aac90){var _0x5beb17=_0x3aac90?_0x3aac90[_0x62bc('0x9b')]:undefined;var _0xbce458=_0x18779a[_0x62bc('0x17')](function(_0x12ff7a){return updateInteraction(_0x12ff7a,_0x31d5f0,_0x4dc4c8,_0x5beb17);});return Promise[_0x62bc('0x9c')](_0xbce458);});}function countFilteredInteractions(_0x19100f,_0xf5293c){var _0x25488f=_0x19100f[_0x62bc('0x9d')]();_0x25488f[_0x62bc('0x9')](_0x62bc('0x9e'));_0x25488f[_0x62bc('0x9')](_0x62bc('0x70'),_0x62bc('0x3e'));var _0x487bec=utils[_0x62bc('0x23')](_0xf5293c);if(!_[_0x62bc('0x9f')](_0x487bec)){_0x25488f['where'](_0x62bc('0xa0'),_0x487bec);}var _0x132335={'type':db[_0x62bc('0x6a')][_0x62bc('0xa1')]['SELECT'],'raw':!![]};return db[_0x62bc('0x6c')][_0x62bc('0x98')](_0x25488f['toString'](),_0x132335);}module[_0x62bc('0xa2')]={'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 4738770..98220de 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 _0xb166=['lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','map','fullname','split','forEach','waiting','answered','abandoned','closed','UserId','talking','disposition','total','findOne','out','plainBody','then'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xb166,0x1cf));var _0x6b16=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0xb166[_0x588011];return _0x3b3773;};'use strict';var _=require(_0x6b16('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x4491ca,_0x53fd5a){return new Promise(function(_0x589d90,_0x579b62){try{var _0x5c01b9=[];if(_0x53fd5a[_0x4491ca]){_0x5c01b9=_0x53fd5a[_0x4491ca][_0x6b16('0x1')](function(_0x80ba04){return{'id':_0x80ba04['id'],'fullname':_0x80ba04[_0x6b16('0x2')]};});}return _0x589d90(_0x5c01b9);}catch(_0x5dde95){_0x579b62(_0x5dde95);}});}function getInteractionTags(_0x53bc00,_0x42727a){var _0xf6cadc=[];if(_0x53bc00){_0x53bc00[_0x6b16('0x3')](',')[_0x6b16('0x4')](function(_0x11c19e){_0xf6cadc['push'](_0x42727a[_0x11c19e]);});}return _0xf6cadc;}function updateWaitingCounter(_0x3105c6){if(_0x3105c6[_0x6b16('0x5')]){_0x3105c6[_0x6b16('0x5')]-=0x1;}}function updateInteractionCounters(_0x41b681){_0x41b681['waiting']=0x0;_0x41b681['talking']=0x0;_0x41b681[_0x6b16('0x6')]=0x0;_0x41b681['unmanaged']=0x0;_0x41b681[_0x6b16('0x7')]=0x0;_0x41b681['total']=0x0;if(_0x41b681[_0x6b16('0x8')]){if(_0x41b681['disposition']===_0x6b16('0x7')){_0x41b681[_0x6b16('0x7')]+=0x1;updateWaitingCounter(_0x41b681);}if(_0x41b681[_0x6b16('0x9')]){_0x41b681[_0x6b16('0x6')]+=0x1;if(_0x41b681['talking']){_0x41b681[_0x6b16('0xa')]-=0x1;}}else{if(_0x41b681[_0x6b16('0xb')]){_0x41b681['unmanaged']+=0x1;updateWaitingCounter(_0x41b681);}}}else{if(!_0x41b681[_0x6b16('0x9')]){_0x41b681[_0x6b16('0x5')]+=0x1;}if(_0x41b681[_0x6b16('0x9')]){_0x41b681['talking']+=0x1;updateWaitingCounter(_0x41b681);}}_0x41b681[_0x6b16('0xc')]+=0x1;return _0x41b681;}function getLastMessageText(_0x33faa6){return db['MailMessage'][_0x6b16('0xd')]({'where':{'$and':[{'MailInteractionId':_0x33faa6['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x6b16('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x6b16('0xf')],'order':'-id','raw':!![]})[_0x6b16('0x10')](function(_0x602811){if(_0x602811&&_0x602811[_0x6b16('0xf')]){_0x33faa6[_0x6b16('0x11')]=_[_0x6b16('0x12')](_0x602811[_0x6b16('0xf')]);}return _0x33faa6;})[_0x6b16('0x13')](function(_0x36d512){throw _0x36d512;});}exports[_0x6b16('0x14')]=function(_0x3749c8,_0x3b2ae8,_0x5e72bb,_0xe9fd6){return new Promise(function(_0x40a69b,_0x4891ef){return getInteractionUsers(_0x3749c8['id'],_0x5e72bb)['then'](function(_0x31c100){_0x3749c8[_0x6b16('0x15')]=_0x31c100;return getInteractionTags(_0x3749c8[_0x6b16('0x16')],_0x3b2ae8);})['then'](function(_0x26f925){_0x3749c8[_0x6b16('0x17')]=_0x26f925;delete _0x3749c8[_0x6b16('0x16')];return updateInteractionCounters(_0x3749c8);})[_0x6b16('0x10')](function(_0x549418){if(_0xe9fd6){return getLastMessageText(_0x549418);}else{return _0x549418;}})['then'](function(_0x7898ea){_0x40a69b(_0x7898ea);})[_0x6b16('0x13')](function(_0xe7d67f){_0x4891ef(_0xe7d67f);});});}; \ No newline at end of file +var _0x3694=['UserId','MailMessage','out','plainBody','-id','then','trimStart','catch','updateInteraction','Users','Tags','TagIds','lodash','../../mysqldb','fullname','split','forEach','waiting','talking','answered','unmanaged','abandoned','total','disposition'];(function(_0x4a209a,_0x4bf379){var _0x3651d7=function(_0x448b21){while(--_0x448b21){_0x4a209a['push'](_0x4a209a['shift']());}};_0x3651d7(++_0x4bf379);}(_0x3694,0xb4));var _0x4369=function(_0x4f1029,_0x1fd479){_0x4f1029=_0x4f1029-0x0;var _0x34012f=_0x3694[_0x4f1029];return _0x34012f;};'use strict';var _=require(_0x4369('0x0'));var db=require(_0x4369('0x1'))['db'];function getInteractionUsers(_0x592c1c,_0x4f4d65){return new Promise(function(_0x37d521,_0x2e025d){try{var _0x3d75a7=[];if(_0x4f4d65[_0x592c1c]){_0x3d75a7=_0x4f4d65[_0x592c1c]['map'](function(_0x3dd73a){return{'id':_0x3dd73a['id'],'fullname':_0x3dd73a[_0x4369('0x2')]};});}return _0x37d521(_0x3d75a7);}catch(_0x21ffe5){_0x2e025d(_0x21ffe5);}});}function getInteractionTags(_0x5159e1,_0x247bb5){var _0x3e5deb=[];if(_0x5159e1){_0x5159e1[_0x4369('0x3')](',')[_0x4369('0x4')](function(_0xa0e4fb){_0x3e5deb['push'](_0x247bb5[_0xa0e4fb]);});}return _0x3e5deb;}function updateWaitingCounter(_0x4e3706){if(_0x4e3706[_0x4369('0x5')]){_0x4e3706[_0x4369('0x5')]-=0x1;}}function updateInteractionCounters(_0x4c7b86){_0x4c7b86[_0x4369('0x5')]=0x0;_0x4c7b86[_0x4369('0x6')]=0x0;_0x4c7b86[_0x4369('0x7')]=0x0;_0x4c7b86[_0x4369('0x8')]=0x0;_0x4c7b86[_0x4369('0x9')]=0x0;_0x4c7b86[_0x4369('0xa')]=0x0;if(_0x4c7b86['closed']){if(_0x4c7b86[_0x4369('0xb')]===_0x4369('0x9')){_0x4c7b86['abandoned']+=0x1;updateWaitingCounter(_0x4c7b86);}if(_0x4c7b86[_0x4369('0xc')]){_0x4c7b86['answered']+=0x1;if(_0x4c7b86[_0x4369('0x6')]){_0x4c7b86[_0x4369('0x6')]-=0x1;}}else{if(_0x4c7b86[_0x4369('0xb')]){_0x4c7b86[_0x4369('0x8')]+=0x1;updateWaitingCounter(_0x4c7b86);}}}else{if(!_0x4c7b86[_0x4369('0xc')]){_0x4c7b86[_0x4369('0x5')]+=0x1;}if(_0x4c7b86[_0x4369('0xc')]){_0x4c7b86[_0x4369('0x6')]+=0x1;updateWaitingCounter(_0x4c7b86);}}_0x4c7b86[_0x4369('0xa')]+=0x1;return _0x4c7b86;}function getLastMessageText(_0x30eab5){return db[_0x4369('0xd')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x30eab5['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4369('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x4369('0xf')],'order':_0x4369('0x10'),'raw':!![]})[_0x4369('0x11')](function(_0x564b97){if(_0x564b97&&_0x564b97[_0x4369('0xf')]){_0x30eab5['lastMsgText']=_[_0x4369('0x12')](_0x564b97[_0x4369('0xf')]);}return _0x30eab5;})[_0x4369('0x13')](function(_0x404d0e){throw _0x404d0e;});}exports[_0x4369('0x14')]=function(_0x2ab3d5,_0x469b60,_0x570117,_0x397a8d){return new Promise(function(_0x3daea9,_0x3e3f83){return getInteractionUsers(_0x2ab3d5['id'],_0x570117)[_0x4369('0x11')](function(_0x27cf56){_0x2ab3d5[_0x4369('0x15')]=_0x27cf56;return getInteractionTags(_0x2ab3d5['TagIds'],_0x469b60);})[_0x4369('0x11')](function(_0x1f8977){_0x2ab3d5[_0x4369('0x16')]=_0x1f8977;delete _0x2ab3d5[_0x4369('0x17')];return updateInteractionCounters(_0x2ab3d5);})[_0x4369('0x11')](function(_0x19ceb5){if(_0x397a8d){return getLastMessageText(_0x19ceb5);}else{return _0x19ceb5;}})[_0x4369('0x11')](function(_0x3bae4d){_0x3daea9(_0x3bae4d);})['catch'](function(_0x303b49){_0x3e3f83(_0x303b49);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 5848e10..f1ba1b3 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 _0x7f07=['name','role','stringify','null','Interaction','findOne','update','info','catch','error','exports','lodash','openchannel-interactions','mail-interactions','../../config/logger','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x47d454,_0xf3253a){var _0x1188b9=function(_0x1b6f8d){while(--_0x1b6f8d){_0x47d454['push'](_0x47d454['shift']());}};_0x1188b9(++_0xf3253a);}(_0x7f07,0x122));var _0x77f0=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x7f07[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x77f0('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x77f0('0x1')),'mail':require('../../config/logger')(_0x77f0('0x2')),'fax':require(_0x77f0('0x3'))(_0x77f0('0x4')),'sms':require('../../config/logger')(_0x77f0('0x5')),'chat':require(_0x77f0('0x3'))('chat-interactions'),'whatsapp':require(_0x77f0('0x3'))(_0x77f0('0x6'))};function getAccountFK(_0x342624){return _[_0x77f0('0x7')](_0x342624)+(_0x342624===_0x77f0('0x8')?_0x77f0('0x9'):_0x77f0('0xa'))+'Id';}function getInteractionFK(_0x3dd2b5){return _['capitalize'](_0x3dd2b5)+_0x77f0('0xb');}function getInteractionId(_0x316996,_0x3dad4b,_0x2c1345){if(_0x316996&&_0x316996[_[_0x77f0('0xc')](_0x2c1345)+'InteractionId']){return _0x316996[_[_0x77f0('0xc')](_0x2c1345)+_0x77f0('0xb')];}else if(_0x316996&&_0x316996['id']){return _0x316996['id'];}else if(_0x3dad4b&&_0x3dad4b['id']){return _0x3dad4b['id'];}else{return _0x77f0('0xd');}}function getInteractionsTables(_0x5e938a){return{'accounts':_0x5e938a+'_'+(_0x5e938a===_0x77f0('0x8')?'websites':_0x77f0('0xe')),'interactions':_0x5e938a+_0x77f0('0xf'),'interactionsTags':_0x5e938a+_0x77f0('0x10'),'messages':_0x5e938a+'_messages','userInteractions':_0x77f0('0x11')+_0x5e938a+_0x77f0('0xf')};}function getSelectedTags(_0x123e74){var _0x3ea470=[];if(_0x123e74){_0x3ea470=Array[_0x77f0('0x12')](_0x123e74)?_0x123e74:[_0x123e74];}return _0x3ea470;}function log(_0x325f51,_0x4c4e01,_0x7c3509,_0x270c1e,_0x42f2d3,_0x1a12ae){loggers[_0x42f2d3['toLowerCase']()][_0x325f51](_0x77f0('0x13'),_0x1a12ae['toUpperCase'](),_0x4c4e01?_0x4c4e01['id']:null,_0x4c4e01?_0x4c4e01[_0x77f0('0x14')]:null,_0x4c4e01?_0x4c4e01[_0x77f0('0x15')]:null,getInteractionId(_0x7c3509,_0x270c1e,_0x42f2d3),_0x7c3509?JSON[_0x77f0('0x16')](_0x7c3509):_0x77f0('0x17'));}function updateUser(_0x362e5a,_0x44669f,_0x1131a3,_0x12023e,_0x5832ef){db[_['upperFirst'](_0x12023e)+_0x77f0('0x18')][_0x77f0('0x19')]({'where':{'id':getInteractionId(_0x44669f,_0x1131a3,_0x12023e)}})['then'](function(_0x460e66){if(_0x460e66){return _0x460e66[_0x77f0('0x1a')]({'UserId':_0x362e5a?_0x362e5a['id']:null});}})['then'](function(_0x609c54){if(_0x609c54){log(_0x77f0('0x1b'),_0x362e5a,_0x44669f,_0x1131a3,_0x12023e,_0x5832ef);}})[_0x77f0('0x1c')](function(){log(_0x77f0('0x1d'),_0x362e5a,_0x44669f,_0x1131a3,_0x12023e,_0x5832ef);});}module[_0x77f0('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xc202=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','Interaction','findOne','then','update','info','catch','error','../../mysqldb','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase'];(function(_0x25ff9b,_0x1df6ed){var _0x1234ec=function(_0x461167){while(--_0x461167){_0x25ff9b['push'](_0x25ff9b['shift']());}};_0x1234ec(++_0x1df6ed);}(_0xc202,0x14c));var _0x2c20=function(_0x2ebd83,_0x41f041){_0x2ebd83=_0x2ebd83-0x0;var _0x2fabba=_0xc202[_0x2ebd83];return _0x2fabba;};'use strict';var _=require('lodash');var db=require(_0x2c20('0x0'))['db'];var loggers={'openchannel':require(_0x2c20('0x1'))('openchannel-interactions'),'mail':require(_0x2c20('0x1'))('mail-interactions'),'fax':require('../../config/logger')(_0x2c20('0x2')),'sms':require(_0x2c20('0x1'))(_0x2c20('0x3')),'chat':require('../../config/logger')(_0x2c20('0x4')),'whatsapp':require(_0x2c20('0x1'))(_0x2c20('0x5'))};function getAccountFK(_0x21df6b){return _[_0x2c20('0x6')](_0x21df6b)+(_0x21df6b===_0x2c20('0x7')?_0x2c20('0x8'):_0x2c20('0x9'))+'Id';}function getInteractionFK(_0x50547a){return _['capitalize'](_0x50547a)+_0x2c20('0xa');}function getInteractionId(_0x3db1b2,_0xf47e,_0x5400e3){if(_0x3db1b2&&_0x3db1b2[_['upperFirst'](_0x5400e3)+_0x2c20('0xa')]){return _0x3db1b2[_[_0x2c20('0xb')](_0x5400e3)+'InteractionId'];}else if(_0x3db1b2&&_0x3db1b2['id']){return _0x3db1b2['id'];}else if(_0xf47e&&_0xf47e['id']){return _0xf47e['id'];}else{return _0x2c20('0xc');}}function getInteractionsTables(_0x148a5c){return{'accounts':_0x148a5c+'_'+(_0x148a5c===_0x2c20('0x7')?_0x2c20('0xd'):'accounts'),'interactions':_0x148a5c+_0x2c20('0xe'),'interactionsTags':_0x148a5c+_0x2c20('0xf'),'messages':_0x148a5c+_0x2c20('0x10'),'userInteractions':_0x2c20('0x11')+_0x148a5c+'_interactions'};}function getSelectedTags(_0x2c8b09){var _0x204f89=[];if(_0x2c8b09){_0x204f89=Array[_0x2c20('0x12')](_0x2c8b09)?_0x2c8b09:[_0x2c8b09];}return _0x204f89;}function log(_0x1791e5,_0x3369c7,_0x515912,_0x4ccdfd,_0x5e7f3b,_0x20bc91){loggers[_0x5e7f3b[_0x2c20('0x13')]()][_0x1791e5](_0x2c20('0x14'),_0x20bc91[_0x2c20('0x15')](),_0x3369c7?_0x3369c7['id']:null,_0x3369c7?_0x3369c7[_0x2c20('0x16')]:null,_0x3369c7?_0x3369c7['role']:null,getInteractionId(_0x515912,_0x4ccdfd,_0x5e7f3b),_0x515912?JSON[_0x2c20('0x17')](_0x515912):_0x2c20('0x18'));}function updateUser(_0x544766,_0x564312,_0x29a692,_0x642509,_0x2103d3){db[_[_0x2c20('0xb')](_0x642509)+_0x2c20('0x19')][_0x2c20('0x1a')]({'where':{'id':getInteractionId(_0x564312,_0x29a692,_0x642509)}})[_0x2c20('0x1b')](function(_0x25700a){if(_0x25700a){return _0x25700a[_0x2c20('0x1c')]({'UserId':_0x544766?_0x544766['id']:null});}})[_0x2c20('0x1b')](function(_0x5890f4){if(_0x5890f4){log(_0x2c20('0x1d'),_0x544766,_0x564312,_0x29a692,_0x642509,_0x2103d3);}})[_0x2c20('0x1e')](function(){log(_0x2c20('0x1f'),_0x544766,_0x564312,_0x29a692,_0x642509,_0x2103d3);});}module['exports']={'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 7143555..5438c0f 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 _0xe9d2=['update','base64','utf8','final','parse','findOne','then','count','status','json','catch','users','admin','isUserLimit','crypto','composable-middleware','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s'];(function(_0x3546eb,_0x440f3f){var _0xe660bf=function(_0x282566){while(--_0x282566){_0x3546eb['push'](_0x3546eb['shift']());}};_0xe660bf(++_0x440f3f);}(_0xe9d2,0x1da));var _0x2e9d=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xe9d2[_0x2283dc];return _0x16db90;};'use strict';var crypto=require(_0x2e9d('0x0'));var util=require('util');var compose=require(_0x2e9d('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x2e9d('0x2'));function getValueFromLicense(_0x2ce9be,_0x269728){if(_0x2ce9be&&_0x269728){if(_0x269728[_0x2e9d('0x3')]&&_0x269728[_0x2e9d('0x4')]){var _0x41db85=_0x269728[_0x2e9d('0x3')];var _0x140f78=_0x269728['license'];var _0x113f60=_0x41db85[_0x2e9d('0x5')]('-')[0x4];var _0x38102b=_0x41db85[_0x2e9d('0x5')]('-')[0x0];var _0x3c28ef=crypto[_0x2e9d('0x6')]('aes-256-ctr',util[_0x2e9d('0x7')](_0x2e9d('0x8'),_0x113f60,_0x41db85,_0x38102b));var _0x410920=_0x3c28ef[_0x2e9d('0x9')](_0x140f78,_0x2e9d('0xa'),_0x2e9d('0xb'));_0x410920+=_0x3c28ef[_0x2e9d('0xc')](_0x2e9d('0xb'));var _0x2cf4d1=JSON[_0x2e9d('0xd')](_0x410920);return _0x2cf4d1['hasOwnProperty'](_0x2ce9be)?_0x2cf4d1[_0x2ce9be]:null;}}return null;}function isLimit(_0x2a8a52,_0x4b1aff,_0x56022f,_0x246f27){var _0x3f046e=_0x4b1aff;return compose()['use'](function(_0x852ec7,_0x21f006,_0x4ddf2f){return db['License'][_0x2e9d('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x424e4d){var _0x558b33=getValueFromLicense(_0x2a8a52,_0x424e4d);return _0x558b33?_0x558b33:_0x3f046e;})[_0x2e9d('0xf')](function(_0x5440b2){_0x3f046e=_0x5440b2;return _0x56022f[_0x2e9d('0x10')](_0x246f27);})[_0x2e9d('0xf')](function(_0x243823){if(_0x243823>=_0x3f046e){return _0x21f006[_0x2e9d('0x11')](0x193)[_0x2e9d('0x12')]({'message':util[_0x2e9d('0x7')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2a8a52)});}_0x4ddf2f();})[_0x2e9d('0x13')](function(_0x3c58fd){_0x4ddf2f(_0x3c58fd);});});}function isUserLimit(){return isLimit(_0x2e9d('0x14'),0x1,db['User'],{'where':{'$or':[{'role':_0x2e9d('0x15')},{'role':'user'}]}});}exports[_0x2e9d('0x16')]=isUserLimit; \ No newline at end of file +var _0x96f1=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','util','composable-middleware','../../config/environment','data1'];(function(_0x3fd135,_0x818346){var _0x1ab4e8=function(_0x1abc43){while(--_0x1abc43){_0x3fd135['push'](_0x3fd135['shift']());}};_0x1ab4e8(++_0x818346);}(_0x96f1,0x10a));var _0x196f=function(_0x3d4f12,_0x50b967){_0x3d4f12=_0x3d4f12-0x0;var _0x157e3f=_0x96f1[_0x3d4f12];return _0x157e3f;};'use strict';var crypto=require('crypto');var util=require(_0x196f('0x0'));var compose=require(_0x196f('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x196f('0x2'));function getValueFromLicense(_0x341422,_0x5c43cf){if(_0x341422&&_0x5c43cf){if(_0x5c43cf[_0x196f('0x3')]&&_0x5c43cf['license']){var _0xd756d6=_0x5c43cf[_0x196f('0x3')];var _0x5d843f=_0x5c43cf['license'];var _0x5da0c6=_0xd756d6[_0x196f('0x4')]('-')[0x4];var _0x44dc45=_0xd756d6[_0x196f('0x4')]('-')[0x0];var _0x37ba66=crypto[_0x196f('0x5')](_0x196f('0x6'),util[_0x196f('0x7')](_0x196f('0x8'),_0x5da0c6,_0xd756d6,_0x44dc45));var _0x3d3d23=_0x37ba66['update'](_0x5d843f,_0x196f('0x9'),_0x196f('0xa'));_0x3d3d23+=_0x37ba66[_0x196f('0xb')]('utf8');var _0x1fb6a7=JSON[_0x196f('0xc')](_0x3d3d23);return _0x1fb6a7[_0x196f('0xd')](_0x341422)?_0x1fb6a7[_0x341422]:null;}}return null;}function isLimit(_0x587d26,_0x5e2d3f,_0x330cbc,_0x45ae52){var _0x3f5334=_0x5e2d3f;return compose()[_0x196f('0xe')](function(_0x46c6c7,_0x12f0f6,_0x1d5a65){return db[_0x196f('0xf')][_0x196f('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x196f('0x11')](function(_0x52d141){var _0xbaf4c5=getValueFromLicense(_0x587d26,_0x52d141);return _0xbaf4c5?_0xbaf4c5:_0x3f5334;})['then'](function(_0x5141d3){_0x3f5334=_0x5141d3;return _0x330cbc[_0x196f('0x12')](_0x45ae52);})[_0x196f('0x11')](function(_0x2eee4c){if(_0x2eee4c>=_0x3f5334){return _0x12f0f6[_0x196f('0x13')](0x193)[_0x196f('0x14')]({'message':util[_0x196f('0x7')](_0x196f('0x15'),_0x587d26)});}_0x1d5a65();})[_0x196f('0x16')](function(_0x4866ab){_0x1d5a65(_0x4866ab);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x196f('0x17')],{'where':{'$or':[{'role':_0x196f('0x18')},{'role':_0x196f('0x19')}]}});}exports[_0x196f('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index d25bfc7..8b47bcd 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 _0xb564=['split','shift','map','conditions','buildExpression','operator','$eq','$between','value','includes','$gt','add','days','format','castTo','text','CAST(','\x20AS\x20','$ne','$notIn','\x20OR\x20','field','\x20IS\x20NULL)','IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','>\x20?','$lte','<=\x20?','>=\x20?','$in','start','$substring','pop','DATE','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','length','slice','forEach'];(function(_0x2f4454,_0x5def24){var _0x45191f=function(_0x3692c6){while(--_0x3692c6){_0x2f4454['push'](_0x2f4454['shift']());}};_0x45191f(++_0x5def24);}(_0xb564,0x1ca));var _0x4b56=function(_0x3870ff,_0x1fb759){_0x3870ff=_0x3870ff-0x0;var _0x351ab2=_0xb564[_0x3870ff];return _0x351ab2;};'use strict';var _=require(_0x4b56('0x0'));var moment=require(_0x4b56('0x1'));exports[_0x4b56('0x2')]=function(_0x2cb877){var _0x390f05={'conditions':[]};_0x390f05[_0x4b56('0x3')]=_[_0x4b56('0x4')](_0x2cb877,_0x4b56('0x5'))?'or':'and';var _0x25b7a5=_0x2cb877[_0x4b56('0x6')]('[$and]','')[_0x4b56('0x6')](_0x4b56('0x5'),'')['split']('||');for(var _0xaa35a5=0x0;_0xaa35a5<_0x25b7a5[_0x4b56('0x7')];_0xaa35a5++){var _0xb4f017=_0x25b7a5[_0xaa35a5]['split'](':=');var _0x215b4f=_0xb4f017[0x0];var _0x2a0cf8=_0xb4f017[_0x4b56('0x8')](0x1);_0x2a0cf8[_0x4b56('0x9')](function(_0x247a7d){var _0x4b93de=_0x247a7d[_0x4b56('0xa')]('[')[_0x4b56('0xb')]();var _0x1fe4b6=_0x247a7d['match'](/\[(.*?)\]/g);_0x1fe4b6[_0x4b56('0x9')](function(_0x46db10){var _0x3f6357=_0x46db10[_0x4b56('0xa')]('[')['filter'](function(_0xfd0bb0){return _0xfd0bb0['indexOf'](']')>-0x1;})[_0x4b56('0xc')](function(_0x50ed0b){return _0x50ed0b['split'](']')[0x0];})[0x0];_0x390f05[_0x4b56('0xd')]['push']({'field':_0x215b4f,'operator':_0x4b93de,'value':_0x3f6357});});});}return _0x390f05;};exports[_0x4b56('0xe')]=function(_0x3c374d,_0xc0cbe7,_0x1672ee){var _0x3ba6ba={};if(_0xc0cbe7==='DATE'){if(_0x1672ee[_0x4b56('0xf')]===_0x4b56('0x10')){_0x1672ee[_0x4b56('0xf')]=_0x4b56('0x11');_0x1672ee[_0x4b56('0x12')]+=','+_0x1672ee['value'];}else if(_[_0x4b56('0x13')]([_0x4b56('0x14'),'$lte'],_0x1672ee[_0x4b56('0xf')])){_0x1672ee['value']=moment(_0x1672ee['value'])[_0x4b56('0x15')](0x1,_0x4b56('0x16'))[_0x4b56('0x17')]('YYYY-MM-DD');}}if(_0x1672ee[_0x4b56('0x18')]){_0xc0cbe7=_0x1672ee[_0x4b56('0x18')];_0x3ba6ba[_0x4b56('0x19')]=_0x4b56('0x1a')+_0x3c374d+'.'+_0x1672ee['field']+_0x4b56('0x1b')+_0x1672ee[_0x4b56('0x18')]+')\x20'+parseOperator(_0x1672ee['operator']);}else{_0x3ba6ba[_0x4b56('0x19')]=_0x3c374d+'.'+_0x1672ee['field']+'\x20'+parseOperator(_0x1672ee[_0x4b56('0xf')]);}if(_[_0x4b56('0x13')]([_0x4b56('0x1c'),_0x4b56('0x1d')],_0x1672ee[_0x4b56('0xf')]))_0x3ba6ba[_0x4b56('0x19')]='('+_0x3ba6ba[_0x4b56('0x19')]+_0x4b56('0x1e')+_0x3c374d+'.'+_0x1672ee[_0x4b56('0x1f')]+_0x4b56('0x20');_0x3ba6ba[_0x4b56('0x12')]=parseValue(_0xc0cbe7,_0x1672ee[_0x4b56('0xf')],_0x1672ee['value']);return _0x3ba6ba;};function parseOperator(_0x2ec315){var _0x27bf3c;switch(_0x2ec315){case'$in':_0x27bf3c=_0x4b56('0x21');break;case _0x4b56('0x1d'):_0x27bf3c='NOT\x20IN\x20?';break;case'$eq':_0x27bf3c=_0x4b56('0x22');break;case'$ne':_0x27bf3c=_0x4b56('0x23');break;case'$substring':case _0x4b56('0x24'):case _0x4b56('0x25'):_0x27bf3c=_0x4b56('0x26');break;case'$lt':_0x27bf3c='<\x20?';break;case'$gt':_0x27bf3c=_0x4b56('0x27');break;case _0x4b56('0x28'):_0x27bf3c=_0x4b56('0x29');break;case'$gte':_0x27bf3c=_0x4b56('0x2a');break;case _0x4b56('0x11'):_0x27bf3c='BETWEEN\x20?\x20AND\x20?';break;}return _0x27bf3c;}function parseValue(_0x41272d,_0x3af094,_0x6f3503){var _0x291190={'start':undefined,'end':undefined};switch(_0x3af094){case _0x4b56('0x2b'):case'$notIn':_0x291190[_0x4b56('0x2c')]=_0x6f3503[_0x4b56('0xa')](',');break;case _0x4b56('0x2d'):_0x291190[_0x4b56('0x2c')]='%'+_0x6f3503+'%';break;case _0x4b56('0x24'):_0x291190['start']=_0x6f3503+'%';break;case _0x4b56('0x25'):_0x291190['start']='%'+_0x6f3503;break;case _0x4b56('0x11'):var _0x330cd7=_0x6f3503['split'](',');var _0x6f3503=_0x330cd7[_0x4b56('0xb')]();var _0x5d9b59=_0x330cd7[_0x4b56('0x2e')]();if(_0x41272d===_0x4b56('0x2f')){_0x6f3503=moment(_0x6f3503)[_0x4b56('0x30')](0x0,!![])[_0x4b56('0x17')]();_0x5d9b59=moment(_0x5d9b59)['utcOffset'](0x0,!![])[_0x4b56('0x15')](0x17,_0x4b56('0x31'))[_0x4b56('0x15')](0x3b,_0x4b56('0x32'))[_0x4b56('0x15')](0x3b,_0x4b56('0x33'))['format']();}_0x291190={'start':_0x6f3503,'end':_0x5d9b59};break;default:_0x291190['start']=_0x6f3503;break;}return _0x291190;} \ No newline at end of file +var _0x4180=['$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','hours','minutes','seconds','lodash','sqlOperator','startsWith','[$or]','replace','split','length','match','forEach','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','value','$gt'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4180,0x137));var _0x0418=function(_0x450a2c,_0x32600a){_0x450a2c=_0x450a2c-0x0;var _0x527dd5=_0x4180[_0x450a2c];return _0x527dd5;};'use strict';var _=require(_0x0418('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x2121cb){var _0x5b86cf={'conditions':[]};_0x5b86cf[_0x0418('0x1')]=_[_0x0418('0x2')](_0x2121cb,_0x0418('0x3'))?'or':'and';var _0x54ed74=_0x2121cb[_0x0418('0x4')]('[$and]','')[_0x0418('0x4')](_0x0418('0x3'),'')[_0x0418('0x5')]('||');for(var _0x612be7=0x0;_0x612be7<_0x54ed74[_0x0418('0x6')];_0x612be7++){var _0x430a0d=_0x54ed74[_0x612be7][_0x0418('0x5')](':=');var _0x254c8f=_0x430a0d[0x0];var _0x285b3e=_0x430a0d['slice'](0x1);_0x285b3e['forEach'](function(_0x552300){var _0x4caeff=_0x552300['split']('[')['shift']();var _0x519f71=_0x552300[_0x0418('0x7')](/\[(.*?)\]/g);_0x519f71[_0x0418('0x8')](function(_0x5c4a77){var _0x3bcff0=_0x5c4a77[_0x0418('0x5')]('[')['filter'](function(_0x38c974){return _0x38c974[_0x0418('0x9')](']')>-0x1;})[_0x0418('0xa')](function(_0x2242fa){return _0x2242fa[_0x0418('0x5')](']')[0x0];})[0x0];_0x5b86cf[_0x0418('0xb')][_0x0418('0xc')]({'field':_0x254c8f,'operator':_0x4caeff,'value':_0x3bcff0});});});}return _0x5b86cf;};exports[_0x0418('0xd')]=function(_0xdfd503,_0x409003,_0x3be4e1){var _0x1abdad={};if(_0x409003===_0x0418('0xe')){if(_0x3be4e1[_0x0418('0xf')]===_0x0418('0x10')){_0x3be4e1[_0x0418('0xf')]='$between';_0x3be4e1[_0x0418('0x11')]+=','+_0x3be4e1[_0x0418('0x11')];}else if(_['includes']([_0x0418('0x12'),_0x0418('0x13')],_0x3be4e1[_0x0418('0xf')])){_0x3be4e1[_0x0418('0x11')]=moment(_0x3be4e1[_0x0418('0x11')])[_0x0418('0x14')](0x1,'days')[_0x0418('0x15')](_0x0418('0x16'));}}if(_0x3be4e1[_0x0418('0x17')]){_0x409003=_0x3be4e1[_0x0418('0x17')];_0x1abdad[_0x0418('0x18')]=_0x0418('0x19')+_0xdfd503+'.'+_0x3be4e1[_0x0418('0x1a')]+_0x0418('0x1b')+_0x3be4e1[_0x0418('0x17')]+')\x20'+parseOperator(_0x3be4e1[_0x0418('0xf')]);}else{_0x1abdad[_0x0418('0x18')]=_0xdfd503+'.'+_0x3be4e1[_0x0418('0x1a')]+'\x20'+parseOperator(_0x3be4e1[_0x0418('0xf')]);}if(_[_0x0418('0x1c')]([_0x0418('0x1d'),_0x0418('0x1e')],_0x3be4e1[_0x0418('0xf')]))_0x1abdad[_0x0418('0x18')]='('+_0x1abdad[_0x0418('0x18')]+_0x0418('0x1f')+_0xdfd503+'.'+_0x3be4e1[_0x0418('0x1a')]+_0x0418('0x20');_0x1abdad[_0x0418('0x11')]=parseValue(_0x409003,_0x3be4e1[_0x0418('0xf')],_0x3be4e1[_0x0418('0x11')]);return _0x1abdad;};function parseOperator(_0x58d438){var _0x12a501;switch(_0x58d438){case _0x0418('0x21'):_0x12a501='IN\x20?';break;case _0x0418('0x1e'):_0x12a501='NOT\x20IN\x20?';break;case _0x0418('0x10'):_0x12a501=_0x0418('0x22');break;case'$ne':_0x12a501=_0x0418('0x23');break;case _0x0418('0x24'):case _0x0418('0x25'):case _0x0418('0x26'):_0x12a501=_0x0418('0x27');break;case _0x0418('0x28'):_0x12a501=_0x0418('0x29');break;case _0x0418('0x12'):_0x12a501=_0x0418('0x2a');break;case _0x0418('0x13'):_0x12a501=_0x0418('0x2b');break;case _0x0418('0x2c'):_0x12a501=_0x0418('0x2d');break;case _0x0418('0x2e'):_0x12a501=_0x0418('0x2f');break;}return _0x12a501;}function parseValue(_0xc7ef2a,_0x129ec6,_0x14c12a){var _0x375d06={'start':undefined,'end':undefined};switch(_0x129ec6){case _0x0418('0x21'):case'$notIn':_0x375d06[_0x0418('0x30')]=_0x14c12a[_0x0418('0x5')](',');break;case'$substring':_0x375d06['start']='%'+_0x14c12a+'%';break;case'$startsWith':_0x375d06[_0x0418('0x30')]=_0x14c12a+'%';break;case _0x0418('0x26'):_0x375d06[_0x0418('0x30')]='%'+_0x14c12a;break;case _0x0418('0x2e'):var _0x2c89a3=_0x14c12a[_0x0418('0x5')](',');var _0x14c12a=_0x2c89a3[_0x0418('0x31')]();var _0x51c165=_0x2c89a3[_0x0418('0x32')]();if(_0xc7ef2a===_0x0418('0xe')){_0x14c12a=moment(_0x14c12a)['utcOffset'](0x0,!![])['format']();_0x51c165=moment(_0x51c165)[_0x0418('0x33')](0x0,!![])[_0x0418('0x14')](0x17,_0x0418('0x34'))[_0x0418('0x14')](0x3b,_0x0418('0x35'))[_0x0418('0x14')](0x3b,_0x0418('0x36'))['format']();}_0x375d06={'start':_0x14c12a,'end':_0x51c165};break;default:_0x375d06['start']=_0x14c12a;break;}return _0x375d06;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index cb594c7..3050ab0 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 _0x6b8f=['isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','push','getOptions','query','$id','model','intersection','attributes','fields','nolimit','limit','where','pick','filter','columns','value','merge','VIRTUAL','lower','options','sequelize','parse','includes','keys','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray','split','offset','sort','map','indexOf','cast','col','priority','unsigned','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty'];(function(_0x5434c2,_0x26929c){var _0x253006=function(_0x29ed52){while(--_0x29ed52){_0x5434c2['push'](_0x5434c2['shift']());}};_0x253006(++_0x26929c);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x47a489,_0x22180b){_0x47a489=_0x47a489-0x0;var _0x135495=_0x6b8f[_0x47a489];return _0x135495;};'use strict';var _=require('lodash');var sequelize=require(_0xf6b8('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x311ae7){var _0x4e006e=['ne'];try{var _0x5443a1=JSON[_0xf6b8('0x1')](_0x311ae7);var _0x15de3a=Object['keys'](_0x5443a1)[0x0];return _0x4e006e[_0xf6b8('0x2')](_0x15de3a);}catch(_0xf25536){return![];}}function getOperatorValue(_0x347a0b){var _0x549eac=JSON[_0xf6b8('0x1')](_0x347a0b);var _0x79c66d=Object[_0xf6b8('0x3')](_0x549eac)[0x0];var _0x3c3430=_0x549eac[_0x79c66d];return{['$'+_0x79c66d]:_0x3c3430};}exports['fields']=function(_0x5f07f4){var _0x33e9a0=null;if(_0x5f07f4){_0x33e9a0=_0x5f07f4['split'](',');}return _0x33e9a0;};exports[_0xf6b8('0x4')]=function(_0x7ac5fd,_0x16a799){var _0x3e6712={};if(!_[_0xf6b8('0x5')](_0x7ac5fd)){_[_0xf6b8('0x6')](_0x7ac5fd,function(_0x55dad4,_0x481679){try{if(_0x16a799){var _0x5ae09d=_[_0xf6b8('0x7')](_0x16a799,{'name':_0x481679})||{};if(hasSequelizeOperator(_0x55dad4)){_0x3e6712[_0x481679]=getOperatorValue(_0x55dad4);}else if(_0x5ae09d[_0xf6b8('0x8')]===_0xf6b8('0x9')&&_[_0xf6b8('0xa')](_0x55dad4)){var _0x5a6118=JSON['parse'](_0x55dad4);var _0x748e77={'$gte':moment(moment(_0x5a6118[_0xf6b8('0xb')])['format'](_0xf6b8('0xc')))[_0xf6b8('0xd')]()[_0xf6b8('0xe')](),'$lte':moment(moment(_0x5a6118['$lte'])[_0xf6b8('0xe')]('YYYY-MM-DD'))[_0xf6b8('0xd')]()[_0xf6b8('0xf')](0x1,'s')[_0xf6b8('0xe')]()};_0x3e6712[_0x481679]=_0x748e77;}else if(_0x5ae09d[_0xf6b8('0x10')]===_0xf6b8('0x11')){_0x3e6712[_0x481679]=_0x55dad4;}else{_0x3e6712[_0x481679]=_['isArray'](_0x55dad4)?_0x55dad4:JSON['parse'](_0x55dad4);}}else{_0x3e6712[_0x481679]=_[_0xf6b8('0x12')](_0x55dad4)?_0x55dad4:JSON['parse'](_0x55dad4);}}catch(_0x3cf63c){_0x3e6712[_0x481679]=_0x55dad4[_0xf6b8('0x13')](',');}});}return _0x3e6712;};exports['limit']=function(_0x58cd71){_0x58cd71=parseInt(_0x58cd71,0xa);if(!_0x58cd71||_0x58cd71<0x0){_0x58cd71=LIMIT_VALUE;}return _0x58cd71;};exports[_0xf6b8('0x14')]=function(_0x2e2b29){_0x2e2b29=parseInt(_0x2e2b29,0xa);if(!_0x2e2b29||_0x2e2b29<0x0){_0x2e2b29=0x0;}return _0x2e2b29;};exports[_0xf6b8('0x15')]=function(_0x2cac60){var _0x4df5f4,_0x59f9df=null;if(_0x2cac60){_0x4df5f4=_0x2cac60['split'](',');_0x59f9df=_[_0xf6b8('0x16')](_0x4df5f4,function(_0x2a8195){if(_0x2a8195[_0xf6b8('0x17')]('-')===0x0){return[_0x2a8195==='priority'?sequelize[_0xf6b8('0x18')](sequelize[_0xf6b8('0x19')](_0xf6b8('0x1a')),_0xf6b8('0x1b')):_0x2a8195['substr'](0x1),_0xf6b8('0x1c')];}else{return[_0x2a8195==='priority'?sequelize[_0xf6b8('0x18')](sequelize[_0xf6b8('0x19')](_0xf6b8('0x1a')),_0xf6b8('0x1b')):_0x2a8195,_0xf6b8('0x1d')];}});}return _0x59f9df;};exports[_0xf6b8('0x1e')]=function(_0x4edd29,_0x1aca8a){if(_[_0xf6b8('0x5')](_0x4edd29)){return _0x4edd29;}if(_['isArray'](_0x4edd29)){for(var _0x205d6c=0x0;_0x205d6c<_0x4edd29[_0xf6b8('0x1f')];_0x205d6c+=0x1){_0x4edd29[_0x205d6c]=this[_0xf6b8('0x1e')](_0x4edd29[_0x205d6c],_0x1aca8a);}return _0x4edd29;}if(!_[_0xf6b8('0x20')](_0x4edd29)){return _0x4edd29;}if(_[_0xf6b8('0x21')](_0x1aca8a)){_0x1aca8a=[_0x1aca8a];}if(!_['isArray'](_0x1aca8a)){return _0x4edd29;}for(var _0x5e5b1c=0x0;_0x5e5b1c<_0x1aca8a[_0xf6b8('0x1f')];_0x5e5b1c+=0x1){_[_0xf6b8('0x22')](_0x4edd29,_0x1aca8a[_0x5e5b1c]);}for(var _0x5a9514 in _0x4edd29){if(_0x4edd29[_0xf6b8('0x23')](_0x5a9514)){_0x4edd29[_0x5a9514]=this[_0xf6b8('0x1e')](_0x4edd29[_0x5a9514],_0x1aca8a);}}return _0x4edd29;};exports[_0xf6b8('0x24')]=function(_0x5a7f55){return _0x5a7f55[_0xf6b8('0x25')](RegExp(_0xf6b8('0x26')))?!![]:![];};exports['isEmail']=function(_0x309f04){return _0x309f04[_0xf6b8('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xf6b8('0x27')]=function(_0x223ee7){var _0x51ffcf=[];_0x223ee7[_0xf6b8('0x13')](/[ ,]+/)[_0xf6b8('0x28')](function(_0x4006a6){_0x4006a6=_0x4006a6['replace'](/([^:]")"+/g,'$1');_0x4006a6='+'+_0x4006a6+'*';var _0x7c7546=/[ `!@#$%^&*()_\-?~]/;if(_0x4006a6[_0xf6b8('0x25')](_0x7c7546))_0x4006a6='\x22'+_0x4006a6+'\x22';_0x51ffcf[_0xf6b8('0x29')](_0x4006a6);});return _0x51ffcf['join']('\x20');};exports[_0xf6b8('0x2a')]=function(_0x11b040,_0x20ca5e,_0x108a9d){var _0x4be3cb={},_0x1cb84d={};if(_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x2c')]){_0x20ca5e['query']['id']=_0x20ca5e['query'][_0xf6b8('0x2c')];delete _0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x2c')];}_0x4be3cb[_0xf6b8('0x2d')]=_[_0xf6b8('0x16')](_0x11b040,_0xf6b8('0x10'));_0x4be3cb[_0xf6b8('0x2b')]=_[_0xf6b8('0x3')](_0x20ca5e[_0xf6b8('0x2b')]);_0x4be3cb[_0xf6b8('0x4')]=_[_0xf6b8('0x2e')](_0x4be3cb[_0xf6b8('0x2d')],_0x4be3cb[_0xf6b8('0x2b')]);_0x1cb84d[_0xf6b8('0x2f')]=_[_0xf6b8('0x2e')](_0x4be3cb[_0xf6b8('0x2d')],this[_0xf6b8('0x30')](_0x20ca5e[_0xf6b8('0x2b')]['fields']));_0x1cb84d['attributes']=_0x1cb84d[_0xf6b8('0x2f')][_0xf6b8('0x1f')]?_0x1cb84d[_0xf6b8('0x2f')]:_0x4be3cb[_0xf6b8('0x2d')];if(!_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x23')](_0xf6b8('0x31'))){_0x1cb84d[_0xf6b8('0x32')]=this[_0xf6b8('0x32')](_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x32')]);_0x1cb84d[_0xf6b8('0x14')]=this['offset'](_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x14')]);}_0x1cb84d['order']=this[_0xf6b8('0x15')](_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x15')]);_0x1cb84d[_0xf6b8('0x33')]=this[_0xf6b8('0x4')](_[_0xf6b8('0x34')](_0x20ca5e[_0xf6b8('0x2b')],_0x4be3cb[_0xf6b8('0x4')]),_0x11b040);if(_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x35')]){var _0x15a63b=_0x11b040;var _0x3b0554=_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x35')];if(typeof _0x3b0554==='object'){_0x15a63b=_['filter'](_0x11b040,function(_0x5f42c2){return _[_0xf6b8('0x2')](_0x3b0554[_0xf6b8('0x36')],_0x5f42c2[_0xf6b8('0x10')]);});_0x3b0554=_0x3b0554[_0xf6b8('0x37')];}_0x1cb84d[_0xf6b8('0x33')]=_[_0xf6b8('0x38')](_0x1cb84d[_0xf6b8('0x33')],{'$or':_['map'](_0x15a63b,function(_0x1f5e72){if(_0x1f5e72['type']!==_0xf6b8('0x39')){if(_0x108a9d){return sequelize[_0xf6b8('0x33')](sequelize['fn'](_0xf6b8('0x3a'),sequelize[_0xf6b8('0x19')](_0x1f5e72[_0xf6b8('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x35')]+'%')});}else{var _0x126850={};_0x126850[_0x1f5e72[_0xf6b8('0x10')]]={'$like':'%'+_0x20ca5e[_0xf6b8('0x2b')]['filter']+'%'};return _0x126850;}}})});}_0x1cb84d=_[_0xf6b8('0x38')]({},_0x1cb84d,_0x20ca5e[_0xf6b8('0x3b')]);return _0x1cb84d;}; \ No newline at end of file +var _0xd6d6=['merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','isEmpty','forOwn','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','uniqueid','isArray','split','limit','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','getOptions','$id','query','model','name','filters','intersection','attributes','nolimit','offset','order','where','pick','filter','object','columns','value'];(function(_0x2f6cfa,_0x5a8b2c){var _0x345a7d=function(_0x4be0b8){while(--_0x4be0b8){_0x2f6cfa['push'](_0x2f6cfa['shift']());}};_0x345a7d(++_0x5a8b2c);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x29dd43,_0x34c537){_0x29dd43=_0x29dd43-0x0;var _0x3905e1=_0xd6d6[_0x29dd43];return _0x3905e1;};'use strict';var _=require(_0x6d6d('0x0'));var sequelize=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x33226e){var _0x536523=['ne'];try{var _0x2e1aed=JSON[_0x6d6d('0x3')](_0x33226e);var _0x1b8610=Object[_0x6d6d('0x4')](_0x2e1aed)[0x0];return _0x536523[_0x6d6d('0x5')](_0x1b8610);}catch(_0x16e259){return![];}}function getOperatorValue(_0x35a813){var _0x5702dc=JSON[_0x6d6d('0x3')](_0x35a813);var _0x1bf731=Object[_0x6d6d('0x4')](_0x5702dc)[0x0];var _0x18f824=_0x5702dc[_0x1bf731];return{['$'+_0x1bf731]:_0x18f824};}exports[_0x6d6d('0x6')]=function(_0x408f88){var _0x3e69a4=null;if(_0x408f88){_0x3e69a4=_0x408f88['split'](',');}return _0x3e69a4;};exports['filters']=function(_0x404c88,_0x1fa46d){var _0x23b18a={};if(!_[_0x6d6d('0x7')](_0x404c88)){_[_0x6d6d('0x8')](_0x404c88,function(_0x576c88,_0x1f2b86){try{if(_0x1fa46d){var _0x158f82=_['find'](_0x1fa46d,{'name':_0x1f2b86})||{};if(hasSequelizeOperator(_0x576c88)){_0x23b18a[_0x1f2b86]=getOperatorValue(_0x576c88);}else if(_0x158f82['type']===_0x6d6d('0x9')&&_[_0x6d6d('0xa')](_0x576c88)){var _0xe61c36=JSON[_0x6d6d('0x3')](_0x576c88);var _0x2b74ed={'$gte':moment(moment(_0xe61c36[_0x6d6d('0xb')])[_0x6d6d('0xc')](_0x6d6d('0xd')))['utc']()[_0x6d6d('0xc')](),'$lte':moment(moment(_0xe61c36[_0x6d6d('0xe')])[_0x6d6d('0xc')](_0x6d6d('0xd')))[_0x6d6d('0xf')]()['subtract'](0x1,'s')[_0x6d6d('0xc')]()};_0x23b18a[_0x1f2b86]=_0x2b74ed;}else if(_0x158f82['name']===_0x6d6d('0x10')){_0x23b18a[_0x1f2b86]=_0x576c88;}else{_0x23b18a[_0x1f2b86]=_[_0x6d6d('0x11')](_0x576c88)?_0x576c88:JSON[_0x6d6d('0x3')](_0x576c88);}}else{_0x23b18a[_0x1f2b86]=_['isArray'](_0x576c88)?_0x576c88:JSON['parse'](_0x576c88);}}catch(_0x9e1e18){_0x23b18a[_0x1f2b86]=_0x576c88[_0x6d6d('0x12')](',');}});}return _0x23b18a;};exports[_0x6d6d('0x13')]=function(_0x2c5314){_0x2c5314=parseInt(_0x2c5314,0xa);if(!_0x2c5314||_0x2c5314<0x0){_0x2c5314=LIMIT_VALUE;}return _0x2c5314;};exports['offset']=function(_0x554392){_0x554392=parseInt(_0x554392,0xa);if(!_0x554392||_0x554392<0x0){_0x554392=0x0;}return _0x554392;};exports[_0x6d6d('0x14')]=function(_0x5a5855){var _0x26f631,_0xb8590d=null;if(_0x5a5855){_0x26f631=_0x5a5855[_0x6d6d('0x12')](',');_0xb8590d=_[_0x6d6d('0x15')](_0x26f631,function(_0x40d35b){if(_0x40d35b[_0x6d6d('0x16')]('-')===0x0){return[_0x40d35b===_0x6d6d('0x17')?sequelize[_0x6d6d('0x18')](sequelize[_0x6d6d('0x19')](_0x6d6d('0x17')),_0x6d6d('0x1a')):_0x40d35b[_0x6d6d('0x1b')](0x1),_0x6d6d('0x1c')];}else{return[_0x40d35b===_0x6d6d('0x17')?sequelize[_0x6d6d('0x18')](sequelize[_0x6d6d('0x19')](_0x6d6d('0x17')),'unsigned'):_0x40d35b,_0x6d6d('0x1d')];}});}return _0xb8590d;};exports[_0x6d6d('0x1e')]=function(_0x99f7d6,_0x97ec9e){if(_[_0x6d6d('0x7')](_0x99f7d6)){return _0x99f7d6;}if(_[_0x6d6d('0x11')](_0x99f7d6)){for(var _0x554f8e=0x0;_0x554f8e<_0x99f7d6[_0x6d6d('0x1f')];_0x554f8e+=0x1){_0x99f7d6[_0x554f8e]=this[_0x6d6d('0x1e')](_0x99f7d6[_0x554f8e],_0x97ec9e);}return _0x99f7d6;}if(!_[_0x6d6d('0x20')](_0x99f7d6)){return _0x99f7d6;}if(_[_0x6d6d('0x21')](_0x97ec9e)){_0x97ec9e=[_0x97ec9e];}if(!_[_0x6d6d('0x11')](_0x97ec9e)){return _0x99f7d6;}for(var _0x408f98=0x0;_0x408f98<_0x97ec9e[_0x6d6d('0x1f')];_0x408f98+=0x1){_['unset'](_0x99f7d6,_0x97ec9e[_0x408f98]);}for(var _0x298408 in _0x99f7d6){if(_0x99f7d6[_0x6d6d('0x22')](_0x298408)){_0x99f7d6[_0x298408]=this['omit'](_0x99f7d6[_0x298408],_0x97ec9e);}}return _0x99f7d6;};exports['isNumeric']=function(_0x3edcce){return _0x3edcce[_0x6d6d('0x23')](RegExp(_0x6d6d('0x24')))?!![]:![];};exports['isEmail']=function(_0xde3272){return _0xde3272[_0x6d6d('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x6d6d('0x25')]=function(_0x1c8340){var _0x64d1f7=[];_0x1c8340[_0x6d6d('0x12')](/[ ,]+/)[_0x6d6d('0x26')](function(_0x359cfd){_0x359cfd=_0x359cfd[_0x6d6d('0x27')](/([^:]")"+/g,'$1');_0x359cfd='+'+_0x359cfd+'*';var _0x34050a=/[ `!@#$%^&*()_\-?~]/;if(_0x359cfd['match'](_0x34050a))_0x359cfd='\x22'+_0x359cfd+'\x22';_0x64d1f7[_0x6d6d('0x28')](_0x359cfd);});return _0x64d1f7['join']('\x20');};exports[_0x6d6d('0x29')]=function(_0x1ea9b2,_0xf527da,_0x2814ed){var _0x5c6248={},_0x182441={};if(_0xf527da['query'][_0x6d6d('0x2a')]){_0xf527da[_0x6d6d('0x2b')]['id']=_0xf527da['query'][_0x6d6d('0x2a')];delete _0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x2a')];}_0x5c6248[_0x6d6d('0x2c')]=_[_0x6d6d('0x15')](_0x1ea9b2,_0x6d6d('0x2d'));_0x5c6248[_0x6d6d('0x2b')]=_[_0x6d6d('0x4')](_0xf527da[_0x6d6d('0x2b')]);_0x5c6248[_0x6d6d('0x2e')]=_[_0x6d6d('0x2f')](_0x5c6248[_0x6d6d('0x2c')],_0x5c6248[_0x6d6d('0x2b')]);_0x182441[_0x6d6d('0x30')]=_['intersection'](_0x5c6248[_0x6d6d('0x2c')],this[_0x6d6d('0x6')](_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x6')]));_0x182441['attributes']=_0x182441['attributes'][_0x6d6d('0x1f')]?_0x182441[_0x6d6d('0x30')]:_0x5c6248[_0x6d6d('0x2c')];if(!_0xf527da['query'][_0x6d6d('0x22')](_0x6d6d('0x31'))){_0x182441[_0x6d6d('0x13')]=this[_0x6d6d('0x13')](_0xf527da['query']['limit']);_0x182441['offset']=this[_0x6d6d('0x32')](_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x32')]);}_0x182441[_0x6d6d('0x33')]=this['sort'](_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x14')]);_0x182441[_0x6d6d('0x34')]=this[_0x6d6d('0x2e')](_[_0x6d6d('0x35')](_0xf527da[_0x6d6d('0x2b')],_0x5c6248['filters']),_0x1ea9b2);if(_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x36')]){var _0x42aff0=_0x1ea9b2;var _0x1f4160=_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x36')];if(typeof _0x1f4160===_0x6d6d('0x37')){_0x42aff0=_['filter'](_0x1ea9b2,function(_0x2d5cdd){return _[_0x6d6d('0x5')](_0x1f4160[_0x6d6d('0x38')],_0x2d5cdd[_0x6d6d('0x2d')]);});_0x1f4160=_0x1f4160[_0x6d6d('0x39')];}_0x182441['where']=_[_0x6d6d('0x3a')](_0x182441[_0x6d6d('0x34')],{'$or':_['map'](_0x42aff0,function(_0x452de2){if(_0x452de2['type']!==_0x6d6d('0x3b')){if(_0x2814ed){return sequelize[_0x6d6d('0x34')](sequelize['fn']('lower',sequelize[_0x6d6d('0x19')](_0x452de2[_0x6d6d('0x2d')])),{'$like':sequelize['fn'](_0x6d6d('0x3c'),'%'+_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x36')]+'%')});}else{var _0x513506={};_0x513506[_0x452de2['name']]={'$like':'%'+_0xf527da[_0x6d6d('0x2b')]['filter']+'%'};return _0x513506;}}})});}_0x182441=_['merge']({},_0x182441,_0xf527da[_0x6d6d('0x3d')]);return _0x182441;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 514ec39..2b61398 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 _0x847e=['internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','pick','lodash','../../mysqldb','http','client','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','isNil','voiceStatus','pause','openchannelStatus','smsStatus','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','getAgentIdsByQueues','includes','resolve','findAll','name','fullname','mailPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','order','startsWith','DESC','getUpdatedSortOptions'];(function(_0x114448,_0x2be1ad){var _0x14c7d4=function(_0x203064){while(--_0x203064){_0x114448['push'](_0x114448['shift']());}};_0x14c7d4(++_0x2be1ad);}(_0x847e,0x85));var _0xe847=function(_0x108849,_0x357156){_0x108849=_0x108849-0x0;var _0x1b0438=_0x847e[_0x108849];return _0x1b0438;};'use strict';var _=require(_0xe847('0x0'));var jayson=require('jayson/promise');var db=require(_0xe847('0x1'))['db'];var amiClient=jayson['client'][_0xe847('0x2')]({'port':0x232a});var routingClient=jayson[_0xe847('0x3')][_0xe847('0x2')]({'port':0x232c});function isAgentPaused(_0x8684df,_0x55e904){var _0x28426c=[_0x8684df[_0xe847('0x4')],_0x8684df[_0xe847('0x5')],_0x8684df['mailPause'],_0x8684df[_0xe847('0x6')],_0x8684df[_0xe847('0x7')],_0x8684df[_0xe847('0x8')],_0x8684df[_0xe847('0x9')]];if(!_0x55e904)return _[_0xe847('0xa')](_0x28426c);var _0x3128d1=_[_0xe847('0xb')](_0x28426c);return _0x3128d1[_0xe847('0xc')]>0x0&&_0x3128d1[_0xe847('0xc')]<_0x28426c[_0xe847('0xc')]?!![]:![];}function isIdle(_0x5bb52c){return _0x5bb52c===_0xe847('0xd')||_0x5bb52c===_0xe847('0xe')||_0x5bb52c===_0xe847('0xf')||_0x5bb52c==='ringing'||_[_0xe847('0x10')](_0x5bb52c);}function isAgentIdle(_0x1a2c9d){if(_0x1a2c9d[_0xe847('0x11')]!==_0xe847('0xd')&&_0x1a2c9d[_0xe847('0x8')]){_0x1a2c9d[_0xe847('0x11')]=_0xe847('0x12');return![];}return _[_0xe847('0xa')]([_0x1a2c9d['chatStatus'],_0x1a2c9d['faxStatus'],_0x1a2c9d['mailStatus'],_0x1a2c9d[_0xe847('0x13')],_0x1a2c9d[_0xe847('0x14')],_0x1a2c9d[_0xe847('0x11')],_0x1a2c9d['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xe847('0x15'),{})['then'](function(_0x4c1a53){if(_0x4c1a53[_0xe847('0x16')]){throw new Error(_0xe847('0x17'));}var _0x19ba63=_0x4c1a53['result'];return routingClient[_0xe847('0x18')](_0xe847('0x15'),{})[_0xe847('0x19')](function(_0x57d7a5){if(_0x57d7a5[_0xe847('0x16')]){throw new Error(_0xe847('0x1a'));}var _0x56d27c=_0x57d7a5[_0xe847('0x1b')];return _[_0xe847('0x1c')]({},_0x19ba63,_0x56d27c);});})[_0xe847('0x1d')](function(_0x4b0b4a){throw _0x4b0b4a;});}exports[_0xe847('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x593a4d){var _0x3b0c1c='unknown';if(isAgentPaused(_0x593a4d))_0x3b0c1c=_0xe847('0x12');else if(isAgentPaused(_0x593a4d,!![]))_0x3b0c1c=_0xe847('0x1f');else if(isAgentIdle(_0x593a4d))_0x3b0c1c='idle';else _0x3b0c1c=_0xe847('0x20');return _0x3b0c1c;}exports[_0xe847('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x2c7ac2,_0x56534f){var _0x46017d=_[_0xe847('0x22')](_0x2c7ac2)?_0x2c7ac2:[_0x2c7ac2];var _0x291c1b=_[_0xe847('0x23')](_0x56534f)+_0xe847('0x24');var _0x27cc33=_[_0xe847('0x25')](_0x46017d,function(_0x1c2efa){return db[_0x291c1b][_0xe847('0x26')]({'where':{'id':_0x1c2efa}})[_0xe847('0x19')](function(_0x182de8){if(!_0x182de8)return[];return _0x182de8[_0xe847('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xe847('0x28')](_0x27cc33)[_0xe847('0x19')](function(_0x192612){var _0x41b658=_(_0x192612)[_0xe847('0x29')]()[_0xe847('0x25')]('id')[_0xe847('0x2a')]()['value']();return _0x41b658;});}exports[_0xe847('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x329c4c,_0x1cd851,_0x15cc1a){try{if(_0x1cd851[_0xe847('0xc')]>0x0){_0x329c4c=_0x329c4c[_0xe847('0xb')](function(_0x44d6c5){return _0x1cd851[_0xe847('0x2c')](_0x44d6c5['id']);});}var _0x1dff23=_0x329c4c['filter'](function(_0x4eaafe){var _0x81bd07=_0xe847('0x20');if(isAgentIdle(_0x4eaafe)){_0x81bd07=_0xe847('0xd');}return _0x81bd07===_0x15cc1a;});return _[_0xe847('0x25')](_0x1dff23,'id');}catch(_0x5509dc){throw _0x5509dc;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2f55ad,_0x4873a8,_0x127777){return Promise[_0xe847('0x2d')]()[_0xe847('0x19')](function(){if(_0x4873a8[_0xe847('0xc')]>0x0){_0x2f55ad=_0x2f55ad['filter'](function(_0x507e7c){return _0x4873a8['includes'](_0x507e7c['id']);});}return _0x2f55ad;})['then'](function(){return db['User'][_0xe847('0x2e')]({'attributes':['id',_0xe847('0x2f'),_0xe847('0x30'),_0xe847('0x4'),'faxPause',_0xe847('0x31'),_0xe847('0x6'),_0xe847('0x7'),_0xe847('0x8'),'whatsappPause',_0xe847('0x32')],'where':{'id':{'$in':_['map'](_0x2f55ad,'id')}},'raw':!![]});})['then'](function(_0x9bec0c){return _0x9bec0c['map'](function(_0x3d47c0){var _0x1d4675=_[_0xe847('0x33')](_0x2f55ad,['id',_0x3d47c0['id']]);var _0x62db1f=filterAgentAttributes(_0x1d4675);_['merge'](_0x3d47c0,_0x62db1f);_0x3d47c0[_0xe847('0x34')]=getAgentStatus(_0x3d47c0);return _0x3d47c0;});})['then'](function(_0x53bdf5){var _0x5f31b6=sortAgentsByStatus(_0x53bdf5,_0x127777);return _[_0xe847('0x25')](_0x5f31b6,'id');})[_0xe847('0x1d')](function(_0x55df82){throw _0x55df82;});}exports[_0xe847('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1bf206){var _0x332c0a={'fields':[],'order':null};var _0x34777b=_0x1bf206[_0xe847('0x36')](',');_0x332c0a['fields']=_[_0xe847('0xb')](_0x34777b,function(_0x242c12){if(!_0x242c12[_0xe847('0x2c')](_0xe847('0x34'))){return!![];}_0x332c0a[_0xe847('0x37')]=_[_0xe847('0x38')](_0x242c12,'-')?_0xe847('0x39'):'ASC';return![];});return _0x332c0a;}exports[_0xe847('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0xfe0a9c){if(_0xfe0a9c[_0xe847('0x2c')](_0xe847('0x30'))&&!_0xfe0a9c[_0xe847('0x2c')](_0xe847('0x3b'))){var _0x5341f3=_0xfe0a9c[_0xe847('0x3c')](0x0,_0xfe0a9c[_0xe847('0x3d')](_0xe847('0x30')));_0xfe0a9c+=','+_0x5341f3+_0xe847('0x3b');}return _0xfe0a9c;}exports[_0xe847('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x97fb85,_0x235feb){var _0x265e93=_0x97fb85[_0xe847('0x3f')](function(_0x10aa30,_0xbfb7c3){if(_0x10aa30['globalStatus']===_0xbfb7c3[_0xe847('0x34')]){if(_0x10aa30[_0xe847('0x34')]==='pause'){if(_0x235feb==='DESC'){return(_0x10aa30[_0xe847('0x32')]||'')<(_0xbfb7c3[_0xe847('0x32')]||'')||_0x10aa30[_0xe847('0x30')][_0xe847('0x40')]()>_0xbfb7c3[_0xe847('0x30')][_0xe847('0x40')]()?0x1:-0x1;}else{return(_0x10aa30[_0xe847('0x32')]||'')<(_0xbfb7c3['pauseType']||'')||_0x10aa30[_0xe847('0x30')]['toLowerCase']()>_0xbfb7c3[_0xe847('0x30')][_0xe847('0x40')]()?-0x1:0x1;}}else{if(_0x235feb===_0xe847('0x39')){return _0x10aa30[_0xe847('0x30')]['toLowerCase']()<_0xbfb7c3[_0xe847('0x30')]['toLowerCase']()?0x1:-0x1;}else{return _0x10aa30[_0xe847('0x30')][_0xe847('0x40')]()<_0xbfb7c3['fullname'][_0xe847('0x40')]()?-0x1:0x1;}}}else{if(_0x235feb===_0xe847('0x39')){return _0x10aa30['globalStatus']<_0xbfb7c3[_0xe847('0x34')]?0x1:-0x1;}else{return _0x10aa30['globalStatus']<_0xbfb7c3[_0xe847('0x34')]?-0x1:0x1;}}});return _0x265e93;}exports[_0xe847('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x5a34e3){var _0x5f536b=[_0xe847('0x42'),'online','lastLoginAt','lastPauseAt',_0xe847('0x32'),'lastPauseAt',_0xe847('0x3b'),_0xe847('0x43'),_0xe847('0x4'),_0xe847('0x6'),_0xe847('0x31'),_0xe847('0x7'),_0xe847('0x9'),_0xe847('0x5'),_0xe847('0x8'),_0xe847('0x44'),_0xe847('0x45'),_0xe847('0x46'),_0xe847('0x47'),_0xe847('0x48'),_0xe847('0x49'),_0xe847('0x4a'),_0xe847('0x4b'),_0xe847('0x4c'),'smsCurrentCapacity',_0xe847('0x4d'),_0xe847('0x4e'),_0xe847('0x4f'),_0xe847('0x13'),_0xe847('0x50'),'smsStatus','whatsappStatus','faxStatus','voiceStatus',_0xe847('0x51'),_0xe847('0x52'),_0xe847('0x53'),_0xe847('0x54'),_0xe847('0x55'),_0xe847('0x56'),_0xe847('0x57'),_0xe847('0x58'),_0xe847('0x59'),_0xe847('0x5a'),'phoneBarEnableScreenRecordingByAgent',_0xe847('0x5b'),_0xe847('0x5c')];var _0x1b158a=[_0xe847('0x4'),'openchannelPause',_0xe847('0x31'),_0xe847('0x7'),_0xe847('0x9'),_0xe847('0x5'),'voicePause',_0xe847('0x5d')];var _0x576f36=_(_0x5a34e3)[_0xe847('0x5e')](_0x1b158a)[_0xe847('0x5f')](_0x5f536b)['value']();return _0x576f36;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0x13dd=['phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','lodash','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','voiceStatus','faxStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','error','merge','pause','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','includes','busy','User','name','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','order','DESC','ASC','getUpdatedSortOptions','fullname','internal','substring','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','openchannelStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent'];(function(_0xa98a28,_0x18e8b1){var _0x494918=function(_0x9f208d){while(--_0x9f208d){_0xa98a28['push'](_0xa98a28['shift']());}};_0x494918(++_0x18e8b1);}(_0x13dd,0xb1));var _0xd13d=function(_0x1ca502,_0x5953b0){_0x1ca502=_0x1ca502-0x0;var _0xb484dc=_0x13dd[_0x1ca502];return _0xb484dc;};'use strict';var _=require(_0xd13d('0x0'));var jayson=require(_0xd13d('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xd13d('0x2')][_0xd13d('0x3')]({'port':0x232a});var routingClient=jayson[_0xd13d('0x2')][_0xd13d('0x3')]({'port':0x232c});function isAgentPaused(_0x19cbd1,_0x2bfe3b){var _0x16ae9d=[_0x19cbd1[_0xd13d('0x4')],_0x19cbd1[_0xd13d('0x5')],_0x19cbd1[_0xd13d('0x6')],_0x19cbd1[_0xd13d('0x7')],_0x19cbd1[_0xd13d('0x8')],_0x19cbd1[_0xd13d('0x9')],_0x19cbd1[_0xd13d('0xa')]];if(!_0x2bfe3b)return _[_0xd13d('0xb')](_0x16ae9d);var _0x10a2cf=_[_0xd13d('0xc')](_0x16ae9d);return _0x10a2cf['length']>0x0&&_0x10a2cf[_0xd13d('0xd')]<_0x16ae9d[_0xd13d('0xd')]?!![]:![];}function isIdle(_0xaab7d6){return _0xaab7d6===_0xd13d('0xe')||_0xaab7d6===_0xd13d('0xf')||_0xaab7d6===_0xd13d('0x10')||_0xaab7d6===_0xd13d('0x11')||_['isNil'](_0xaab7d6);}function isAgentIdle(_0x410c7a){if(_0x410c7a[_0xd13d('0x12')]!=='idle'&&_0x410c7a['voicePause']){_0x410c7a[_0xd13d('0x12')]='pause';return![];}return _[_0xd13d('0xb')]([_0x410c7a['chatStatus'],_0x410c7a[_0xd13d('0x13')],_0x410c7a[_0xd13d('0x14')],_0x410c7a['openchannelStatus'],_0x410c7a[_0xd13d('0x15')],_0x410c7a[_0xd13d('0x12')],_0x410c7a[_0xd13d('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xd13d('0x17')](_0xd13d('0x18'),{})[_0xd13d('0x19')](function(_0x52190d){if(_0x52190d['error']){throw new Error(_0xd13d('0x1a'));}var _0x372fa6=_0x52190d['result'];return routingClient[_0xd13d('0x17')]('Agents',{})['then'](function(_0x5964f3){if(_0x5964f3[_0xd13d('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x1617b9=_0x5964f3['result'];return _[_0xd13d('0x1c')]({},_0x372fa6,_0x1617b9);});})['catch'](function(_0x1f8ca3){throw _0x1f8ca3;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x181f90){var _0x1ab0cb=_0xd13d('0xf');if(isAgentPaused(_0x181f90))_0x1ab0cb=_0xd13d('0x1d');else if(isAgentPaused(_0x181f90,!![]))_0x1ab0cb='*pause';else if(isAgentIdle(_0x181f90))_0x1ab0cb=_0xd13d('0xe');else _0x1ab0cb='busy';return _0x1ab0cb;}exports[_0xd13d('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x1db6ce,_0x50ae9e){var _0xaaee91=_[_0xd13d('0x1f')](_0x1db6ce)?_0x1db6ce:[_0x1db6ce];var _0xcb2f14=_[_0xd13d('0x20')](_0x50ae9e)+_0xd13d('0x21');var _0x5b73ce=_[_0xd13d('0x22')](_0xaaee91,function(_0x21af2c){return db[_0xcb2f14][_0xd13d('0x23')]({'where':{'id':_0x21af2c}})[_0xd13d('0x19')](function(_0x215043){if(!_0x215043)return[];return _0x215043[_0xd13d('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd13d('0x25')](_0x5b73ce)['then'](function(_0x24f82d){var _0x97e992=_(_0x24f82d)[_0xd13d('0x26')]()['map']('id')[_0xd13d('0x27')]()[_0xd13d('0x28')]();return _0x97e992;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3e901f,_0x25ed6a,_0xbae7fc){try{if(_0x25ed6a['length']>0x0){_0x3e901f=_0x3e901f[_0xd13d('0xc')](function(_0x4a63b9){return _0x25ed6a[_0xd13d('0x29')](_0x4a63b9['id']);});}var _0x362b89=_0x3e901f[_0xd13d('0xc')](function(_0x59d53c){var _0x403bc3=_0xd13d('0x2a');if(isAgentIdle(_0x59d53c)){_0x403bc3=_0xd13d('0xe');}return _0x403bc3===_0xbae7fc;});return _['map'](_0x362b89,'id');}catch(_0x5037ac){throw _0x5037ac;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4a6f85,_0x1959bb,_0x18516d){return Promise['resolve']()[_0xd13d('0x19')](function(){if(_0x1959bb[_0xd13d('0xd')]>0x0){_0x4a6f85=_0x4a6f85[_0xd13d('0xc')](function(_0x22dcf0){return _0x1959bb[_0xd13d('0x29')](_0x22dcf0['id']);});}return _0x4a6f85;})[_0xd13d('0x19')](function(){return db[_0xd13d('0x2b')]['findAll']({'attributes':['id',_0xd13d('0x2c'),'fullname',_0xd13d('0x4'),_0xd13d('0x5'),_0xd13d('0x6'),'openchannelPause','smsPause',_0xd13d('0x9'),'whatsappPause',_0xd13d('0x2d')],'where':{'id':{'$in':_[_0xd13d('0x22')](_0x4a6f85,'id')}},'raw':!![]});})['then'](function(_0x94544c){return _0x94544c[_0xd13d('0x22')](function(_0x4d52ff){var _0x17e35c=_[_0xd13d('0x2e')](_0x4a6f85,['id',_0x4d52ff['id']]);var _0x8519aa=filterAgentAttributes(_0x17e35c);_[_0xd13d('0x1c')](_0x4d52ff,_0x8519aa);_0x4d52ff[_0xd13d('0x2f')]=getAgentStatus(_0x4d52ff);return _0x4d52ff;});})[_0xd13d('0x19')](function(_0x5ee14b){var _0x178a5a=sortAgentsByStatus(_0x5ee14b,_0x18516d);return _[_0xd13d('0x22')](_0x178a5a,'id');})[_0xd13d('0x30')](function(_0xab4a74){throw _0xab4a74;});}exports[_0xd13d('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xb1e71){var _0x30c813={'fields':[],'order':null};var _0x51d2af=_0xb1e71['split'](',');_0x30c813['fields']=_[_0xd13d('0xc')](_0x51d2af,function(_0x1621a1){if(!_0x1621a1[_0xd13d('0x29')](_0xd13d('0x2f'))){return!![];}_0x30c813[_0xd13d('0x32')]=_['startsWith'](_0x1621a1,'-')?_0xd13d('0x33'):_0xd13d('0x34');return![];});return _0x30c813;}exports[_0xd13d('0x35')]=getUpdatedSortOptions;function validateSortParameter(_0x232981){if(_0x232981[_0xd13d('0x29')](_0xd13d('0x36'))&&!_0x232981[_0xd13d('0x29')](_0xd13d('0x37'))){var _0x512ef8=_0x232981[_0xd13d('0x38')](0x0,_0x232981['indexOf'](_0xd13d('0x36')));_0x232981+=','+_0x512ef8+_0xd13d('0x37');}return _0x232981;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x264084,_0x48f3b8){var _0x537be9=_0x264084[_0xd13d('0x39')](function(_0x362b15,_0x560b9b){if(_0x362b15['globalStatus']===_0x560b9b[_0xd13d('0x2f')]){if(_0x362b15[_0xd13d('0x2f')]===_0xd13d('0x1d')){if(_0x48f3b8===_0xd13d('0x33')){return(_0x362b15[_0xd13d('0x2d')]||'')<(_0x560b9b[_0xd13d('0x2d')]||'')||_0x362b15[_0xd13d('0x36')][_0xd13d('0x3a')]()>_0x560b9b[_0xd13d('0x36')][_0xd13d('0x3a')]()?0x1:-0x1;}else{return(_0x362b15[_0xd13d('0x2d')]||'')<(_0x560b9b[_0xd13d('0x2d')]||'')||_0x362b15[_0xd13d('0x36')][_0xd13d('0x3a')]()>_0x560b9b[_0xd13d('0x36')][_0xd13d('0x3a')]()?-0x1:0x1;}}else{if(_0x48f3b8==='DESC'){return _0x362b15[_0xd13d('0x36')][_0xd13d('0x3a')]()<_0x560b9b[_0xd13d('0x36')][_0xd13d('0x3a')]()?0x1:-0x1;}else{return _0x362b15[_0xd13d('0x36')][_0xd13d('0x3a')]()<_0x560b9b[_0xd13d('0x36')][_0xd13d('0x3a')]()?-0x1:0x1;}}}else{if(_0x48f3b8==='DESC'){return _0x362b15[_0xd13d('0x2f')]<_0x560b9b[_0xd13d('0x2f')]?0x1:-0x1;}else{return _0x362b15[_0xd13d('0x2f')]<_0x560b9b[_0xd13d('0x2f')]?-0x1:0x1;}}});return _0x537be9;}exports[_0xd13d('0x3b')]=sortAgentsByStatus;function filterAgentAttributes(_0x4ac4e1){var _0x78e70=[_0xd13d('0x3c'),_0xd13d('0x3d'),_0xd13d('0x3e'),_0xd13d('0x3f'),_0xd13d('0x2d'),_0xd13d('0x3f'),_0xd13d('0x37'),'address',_0xd13d('0x4'),_0xd13d('0x7'),_0xd13d('0x6'),'smsPause','whatsappPause','faxPause','voicePause',_0xd13d('0x40'),_0xd13d('0x41'),'mailCapacity','smsCapacity',_0xd13d('0x42'),'faxCapacity',_0xd13d('0x43'),_0xd13d('0x44'),_0xd13d('0x45'),_0xd13d('0x46'),'whatsappCurrentCapacity','faxCurrentCapacity','chatStatus',_0xd13d('0x47'),_0xd13d('0x14'),_0xd13d('0x15'),_0xd13d('0x16'),_0xd13d('0x13'),_0xd13d('0x12'),_0xd13d('0x48'),_0xd13d('0x49'),_0xd13d('0x4a'),_0xd13d('0x4b'),_0xd13d('0x4c'),_0xd13d('0x4d'),'voiceStatusTime','queue',_0xd13d('0x4e'),_0xd13d('0x4f'),_0xd13d('0x50'),_0xd13d('0x51'),_0xd13d('0x52')];var _0x5dcfc2=['chatPause',_0xd13d('0x7'),_0xd13d('0x6'),_0xd13d('0x8'),_0xd13d('0xa'),'faxPause',_0xd13d('0x9'),'online'];var _0x4aaab2=_(_0x4ac4e1)[_0xd13d('0x53')](_0x5dcfc2)[_0xd13d('0x54')](_0x78e70)[_0xd13d('0x28')]();return _0x4aaab2;}exports[_0xd13d('0x55')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 3620574..cc9414c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x5c12f2,_0x5de043){var _0x5e8344=function(_0x445932){while(--_0x445932){_0x5c12f2['push'](_0x5c12f2['shift']());}};_0x5e8344(++_0x5de043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 238e812..d8cc9a4 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 _0x9e24=['address','127.0.0.1','getFirstInterface','orderBy','map','model','md5','update','digest','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','substring','bimedia-machine-uuid','child_process','execSync','networkInterfaces','length','filter','family','IPv4','internal','concat','head','00:00:00:00:00:00'];(function(_0x168c60,_0x539d96){var _0x29bea4=function(_0x1f7f4e){while(--_0x1f7f4e){_0x168c60['push'](_0x168c60['shift']());}};_0x29bea4(++_0x539d96);}(_0x9e24,0x9e));var _0x49e2=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x9e24[_0x12b8ec];return _0x21af77;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x49e2('0x0'));var exec=require(_0x49e2('0x1'))[_0x49e2('0x2')];var config=require('../environment');function getInterfaces(){var _0x2a5632=[];var _0x18a8dc=os[_0x49e2('0x3')]();var _0x42143c=_['orderBy'](_['keys'](_0x18a8dc));for(var _0x3e5c53=0x0;_0x3e5c53<_0x42143c[_0x49e2('0x4')];_0x3e5c53++){var _0x4d7c88=_0x18a8dc[_0x42143c[_0x3e5c53]][_0x49e2('0x5')](function(_0x31a774){return _0x31a774[_0x49e2('0x6')]===_0x49e2('0x7')&&_0x31a774[_0x49e2('0x8')]===![];});_0x2a5632=_0x2a5632[_0x49e2('0x9')](_0x4d7c88);}return _0x2a5632;}function getFirstInterface(){var _0x3cb097=_[_0x49e2('0xa')](getInterfaces());return{'macAddress':_0x3cb097&&_0x3cb097['mac']?_0x3cb097['mac']:_0x49e2('0xb'),'ipAddress':_0x3cb097&&_0x3cb097[_0x49e2('0xc')]?_0x3cb097['address']:_0x49e2('0xd')};}exports[_0x49e2('0xe')]=getFirstInterface;function getCPUhash(){var _0x2c27ac=_[_0x49e2('0xf')](os['cpus']()[_0x49e2('0x10')](function(_0x243271){return _0x243271[_0x49e2('0x11')];}))['join'](':');return crypto['createHash'](_0x49e2('0x12'))[_0x49e2('0x13')](_0x2c27ac)[_0x49e2('0x14')](_0x49e2('0x15'));}exports[_0x49e2('0x16')]=function(){var _0x525cd6=os['platform']();var _0x5257a1=/[0-9a-f-]{36}/;if(config[_0x49e2('0x17')]&&_0x5257a1[_0x49e2('0x18')](config[_0x49e2('0x17')])){return config[_0x49e2('0x17')];}else if(_0x525cd6===_0x49e2('0x19')){return exec(_0x49e2('0x1a'),{'encoding':_0x49e2('0x1b')})[_0x49e2('0x1c')]('\x0d\x0a','');}else{var _0x2ef4d3=getFirstInterface();var _0x50b5b8=getCPUhash();var _0x402bc4=_0x50b5b8+'|'+os[_0x49e2('0x1d')]()+'|'+_0x2ef4d3[_0x49e2('0x1e')]+'|'+_0x2ef4d3[_0x49e2('0x1f')];var _0x30fe9c=crypto[_0x49e2('0x20')](_0x49e2('0x12'))[_0x49e2('0x13')](_0x402bc4)[_0x49e2('0x14')](_0x49e2('0x15'));return _0x30fe9c[_0x49e2('0x21')](0x0,0x8)+'-'+_0x30fe9c['substring'](0x8,0xc)+'-'+_0x30fe9c['substring'](0xc,0x10)+'-'+_0x30fe9c[_0x49e2('0x21')](0x10,0x14)+'-'+_0x30fe9c['substring'](0x14);}}; \ No newline at end of file +var _0xf87b=['../environment','networkInterfaces','length','family','IPv4','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','digest','hex','platform','test','licenseToken','win32','utf8','hostname','update','substring','lodash','bimedia-machine-uuid','execSync'];(function(_0x488e8f,_0x5c0a85){var _0x58c67b=function(_0x2a86c0){while(--_0x2a86c0){_0x488e8f['push'](_0x488e8f['shift']());}};_0x58c67b(++_0x5c0a85);}(_0xf87b,0x147));var _0xbf87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf87b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbf87('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xbf87('0x1'));var exec=require('child_process')[_0xbf87('0x2')];var config=require(_0xbf87('0x3'));function getInterfaces(){var _0x43ea1d=[];var _0x4c0501=os[_0xbf87('0x4')]();var _0x2b6f42=_['orderBy'](_['keys'](_0x4c0501));for(var _0x39f1c2=0x0;_0x39f1c2<_0x2b6f42[_0xbf87('0x5')];_0x39f1c2++){var _0x32e662=_0x4c0501[_0x2b6f42[_0x39f1c2]]['filter'](function(_0x5b61ef){return _0x5b61ef[_0xbf87('0x6')]===_0xbf87('0x7')&&_0x5b61ef[_0xbf87('0x8')]===![];});_0x43ea1d=_0x43ea1d[_0xbf87('0x9')](_0x32e662);}return _0x43ea1d;}function getFirstInterface(){var _0x43118a=_[_0xbf87('0xa')](getInterfaces());return{'macAddress':_0x43118a&&_0x43118a[_0xbf87('0xb')]?_0x43118a[_0xbf87('0xb')]:'00:00:00:00:00:00','ipAddress':_0x43118a&&_0x43118a['address']?_0x43118a[_0xbf87('0xc')]:_0xbf87('0xd')};}exports[_0xbf87('0xe')]=getFirstInterface;function getCPUhash(){var _0x1352a2=_['orderBy'](os[_0xbf87('0xf')]()[_0xbf87('0x10')](function(_0x42931b){return _0x42931b['model'];}))[_0xbf87('0x11')](':');return crypto[_0xbf87('0x12')](_0xbf87('0x13'))['update'](_0x1352a2)[_0xbf87('0x14')](_0xbf87('0x15'));}exports['getUuid']=function(){var _0x373c1c=os[_0xbf87('0x16')]();var _0x110595=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x110595[_0xbf87('0x17')](config[_0xbf87('0x18')])){return config[_0xbf87('0x18')];}else if(_0x373c1c===_0xbf87('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xbf87('0x1a')})['replace']('\x0d\x0a','');}else{var _0xd4ed0c=getFirstInterface();var _0x4ecbba=getCPUhash();var _0x4da4ca=_0x4ecbba+'|'+os[_0xbf87('0x1b')]()+'|'+_0xd4ed0c['macAddress']+'|'+_0xd4ed0c['ipAddress'];var _0x278e3c=crypto[_0xbf87('0x12')]('md5')[_0xbf87('0x1c')](_0x4da4ca)[_0xbf87('0x14')](_0xbf87('0x15'));return _0x278e3c[_0xbf87('0x1d')](0x0,0x8)+'-'+_0x278e3c[_0xbf87('0x1d')](0x8,0xc)+'-'+_0x278e3c[_0xbf87('0x1d')](0xc,0x10)+'-'+_0x278e3c[_0xbf87('0x1d')](0x10,0x14)+'-'+_0x278e3c[_0xbf87('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index fa7ecf1..d9a9eef 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 _0x92b7=['moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','GET','then','catch','get','data2','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','days','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x92b7,0xd7));var _0x792b=function(_0x317bf0,_0x277c03){_0x317bf0=_0x317bf0-0x0;var _0x225932=_0x92b7[_0x317bf0];return _0x225932;};'use strict';var util=require('util');var moment=require(_0x792b('0x0'));var rp=require(_0x792b('0x1'));var BPromise=require(_0x792b('0x2'));var pkginfo=require(_0x792b('0x3'))(module,'version');var db=require(_0x792b('0x4'))['db'];var encryptor=require(_0x792b('0x5'));var hardware=require(_0x792b('0x6'));var logger=require(_0x792b('0x7'))('license');var HOST=_0x792b('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x66b452){return new BPromise(function(_0x589bc1,_0x47ab01){var _0x23a799=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x66b452,module[_0x792b('0x9')]['version']);if(oldToken){_0x23a799=util[_0x792b('0xa')](_0x792b('0xb'),HOST,_0x66b452,module['exports'][_0x792b('0xc')],oldToken);}var _0x17a191={'uri':_0x23a799,'method':_0x792b('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x17a191)[_0x792b('0xe')](function(_0x561783){_0x589bc1(_0x561783);})[_0x792b('0xf')](function(_0x30358c){_0x47ab01(_0x30358c);});});}function manageLicense(_0x4fd087,_0x2f1431){var _0x14a499=_0x2f1431[_0x792b('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x14a499['data1']!==_0x4fd087&&!_0x14a499[_0x792b('0x11')]){oldToken=_0x14a499['data1'];}httpRequest(_0x4fd087)['then'](function(_0x3e951e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3e951e[_0x792b('0x12')]){isOldTokenSent=![];if(!_0x14a499[_0x792b('0x13')]&&_0x14a499[_0x792b('0x13')]!=_0x3e951e[_0x792b('0x13')]||_0x14a499[_0x792b('0x13')]&&_0x14a499[_0x792b('0x11')]){logger['info'](_0x792b('0x14'));}if(_0x14a499[_0x792b('0x13')]&&!_0x14a499[_0x792b('0x11')]&&_0x14a499[_0x792b('0x13')]!=_0x3e951e[_0x792b('0x13')]){logger[_0x792b('0x15')](_0x792b('0x16'));}if(_0x14a499[_0x792b('0x13')]&&!_0x14a499[_0x792b('0x11')]&&_0x14a499[_0x792b('0x13')]==_0x3e951e[_0x792b('0x13')]){return _0x2f1431;}return _0x2f1431['update']({'data1':_0x4fd087,'data2':null,'license':_0x3e951e['license']});}else{if(_0x3e951e[_0x792b('0x13')]||_0x14a499[_0x792b('0x13')]){if(!_0x14a499[_0x792b('0x11')]){if(_0x14a499[_0x792b('0x17')]==_0x4fd087){GRAY_PERIOD_REASON=_0x792b('0x18');logger[_0x792b('0x15')](_0x792b('0x19'));}else{GRAY_PERIOD_REASON=_0x792b('0x1a');logger[_0x792b('0x15')](_0x792b('0x1b'),_0x14a499[_0x792b('0x17')],_0x4fd087);}logger[_0x792b('0x15')](_0x792b('0x1c'),GRAY_PERIOD_REASON[_0x792b('0x1d')](),moment()['format'](_0x792b('0x1e')));return _0x2f1431[_0x792b('0x1f')]({'data2':encryptor[_0x792b('0x20')](moment()[_0x792b('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x792b('0x21')](encryptor['decryptString'](_0x14a499[_0x792b('0x11')]),_0x792b('0x22'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x792b('0x1e')));isOldTokenSent=![];return _0x2f1431[_0x792b('0x1f')]({'data1':_0x4fd087,'data2':null,'license':null});}}}else{if(_0x14a499[_0x792b('0x17')]!=_0x4fd087){logger[_0x792b('0x15')](_0x792b('0x1b'),_0x14a499[_0x792b('0x17')],_0x4fd087);return _0x2f1431[_0x792b('0x1f')]({'data1':_0x4fd087,'data2':null,'license':null});}}}return _0x2f1431;})[_0x792b('0xe')](function(_0x4c20a3){_0x2f1431=_0x4c20a3;})[_0x792b('0xf')](function(_0x1dddf7){logger['error'](_0x1dddf7['message']);})[_0x792b('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x792b('0x24')](),_0x2f1431);},TIME);});}function defaultLicense(){var _0x1fa5b0=hardware['getUuid']();if(_0x1fa5b0){return db[_0x792b('0x25')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x1fa5b0}})[_0x792b('0x26')](function(_0x2866fe,_0xf22881){logger[_0x792b('0x15')](_0x792b('0x27'),_0x1fa5b0);manageLicense(_0x1fa5b0,_0x2866fe);})[_0x792b('0xf')](function(_0x3b71d5){logger[_0x792b('0x28')](_0x3b71d5[_0x792b('0x29')]);});}}exports[_0x792b('0x2a')]=defaultLicense; \ No newline at end of file +var _0xb458=['%s/api/servers/%s/check?version=%s','exports','then','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','message','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','version','../../mysqldb','license','https://www.xcallymotion.com','format'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0xb458,0xb5));var _0x8b45=function(_0x1741ba,_0x33116f){_0x1741ba=_0x1741ba-0x0;var _0x2a3110=_0xb458[_0x1741ba];return _0x2a3110;};'use strict';var util=require(_0x8b45('0x0'));var moment=require(_0x8b45('0x1'));var rp=require(_0x8b45('0x2'));var BPromise=require(_0x8b45('0x3'));var pkginfo=require('pkginfo')(module,_0x8b45('0x4'));var db=require(_0x8b45('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require('../logger')(_0x8b45('0x6'));var HOST=_0x8b45('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x7448ac){return new BPromise(function(_0x452f97,_0x513d2d){var _0x204a53=util[_0x8b45('0x8')](_0x8b45('0x9'),HOST,_0x7448ac,module['exports'][_0x8b45('0x4')]);if(oldToken){_0x204a53=util[_0x8b45('0x8')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x7448ac,module[_0x8b45('0xa')][_0x8b45('0x4')],oldToken);}var _0x2eb37d={'uri':_0x204a53,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x2eb37d)[_0x8b45('0xb')](function(_0x50472d){_0x452f97(_0x50472d);})['catch'](function(_0xe182f5){_0x513d2d(_0xe182f5);});});}function manageLicense(_0x3432c4,_0x418eaf){var _0x537e58=_0x418eaf[_0x8b45('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x537e58[_0x8b45('0xd')]!==_0x3432c4&&!_0x537e58[_0x8b45('0xe')]){oldToken=_0x537e58[_0x8b45('0xd')];}httpRequest(_0x3432c4)[_0x8b45('0xb')](function(_0x6bfeae){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x6bfeae[_0x8b45('0xf')]){isOldTokenSent=![];if(!_0x537e58[_0x8b45('0x6')]&&_0x537e58[_0x8b45('0x6')]!=_0x6bfeae[_0x8b45('0x6')]||_0x537e58[_0x8b45('0x6')]&&_0x537e58['data2']){logger['info'](_0x8b45('0x10'));}if(_0x537e58[_0x8b45('0x6')]&&!_0x537e58[_0x8b45('0xe')]&&_0x537e58[_0x8b45('0x6')]!=_0x6bfeae[_0x8b45('0x6')]){logger[_0x8b45('0x11')](_0x8b45('0x12'));}if(_0x537e58['license']&&!_0x537e58['data2']&&_0x537e58[_0x8b45('0x6')]==_0x6bfeae[_0x8b45('0x6')]){return _0x418eaf;}return _0x418eaf['update']({'data1':_0x3432c4,'data2':null,'license':_0x6bfeae[_0x8b45('0x6')]});}else{if(_0x6bfeae[_0x8b45('0x6')]||_0x537e58[_0x8b45('0x6')]){if(!_0x537e58[_0x8b45('0xe')]){if(_0x537e58['data1']==_0x3432c4){GRAY_PERIOD_REASON=_0x8b45('0x13');logger[_0x8b45('0x11')](_0x8b45('0x14'));}else{GRAY_PERIOD_REASON=_0x8b45('0x15');logger[_0x8b45('0x11')](_0x8b45('0x16'),_0x537e58[_0x8b45('0xd')],_0x3432c4);}logger['info'](_0x8b45('0x17'),GRAY_PERIOD_REASON[_0x8b45('0x18')](),moment()[_0x8b45('0x8')](_0x8b45('0x19')));return _0x418eaf[_0x8b45('0x1a')]({'data2':encryptor[_0x8b45('0x1b')](moment()[_0x8b45('0x8')](_0x8b45('0x19')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x537e58['data2']),_0x8b45('0x1c'))>DAYS){logger[_0x8b45('0x11')](_0x8b45('0x1d'),moment()[_0x8b45('0x8')](_0x8b45('0x19')));isOldTokenSent=![];return _0x418eaf[_0x8b45('0x1a')]({'data1':_0x3432c4,'data2':null,'license':null});}}}else{if(_0x537e58[_0x8b45('0xd')]!=_0x3432c4){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x537e58[_0x8b45('0xd')],_0x3432c4);return _0x418eaf['update']({'data1':_0x3432c4,'data2':null,'license':null});}}}return _0x418eaf;})['then'](function(_0x1c44f0){_0x418eaf=_0x1c44f0;})[_0x8b45('0x1e')](function(_0x43abb9){logger[_0x8b45('0x1f')](_0x43abb9[_0x8b45('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x8b45('0x21')](),_0x418eaf);},TIME);});}function defaultLicense(){var _0x21efdc=hardware[_0x8b45('0x21')]();if(_0x21efdc){return db[_0x8b45('0x22')][_0x8b45('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x21efdc}})['spread'](function(_0x3fc69e,_0x4247ed){logger['info'](_0x8b45('0x24'),_0x21efdc);manageLicense(_0x21efdc,_0x3fc69e);})['catch'](function(_0x26c542){logger[_0x8b45('0x1f')](_0x26c542[_0x8b45('0x20')]);});}}exports[_0x8b45('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index c63eaa4..3b1aec4 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 _0x948e=['2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','isEmpty','data2','format','%s:%s:%s','demo','decryptString','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','user','telephone','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb'];(function(_0x2df0bf,_0x13990c){var _0x5c46a3=function(_0x5716ea){while(--_0x5716ea){_0x2df0bf['push'](_0x2df0bf['shift']());}};_0x5c46a3(++_0x13990c);}(_0x948e,0x172));var _0xe948=function(_0x4bc4b5,_0x3628b7){_0x4bc4b5=_0x4bc4b5-0x0;var _0x1f6264=_0x948e[_0x4bc4b5];return _0x1f6264;};'use strict';var util=require(_0xe948('0x0'));var _=require(_0xe948('0x1'));var moment=require(_0xe948('0x2'));var BPromise=require(_0xe948('0x3'));var hardware=require('./hardware');var encryptor=require(_0xe948('0x4'));var db=require(_0xe948('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe948('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe948('0x7'),'machineUuid':hardware[_0xe948('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe948('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe948('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4cc1ac){return new BPromise(function(_0x55a96a,_0x43267e){return db[_0xe948('0xa')][_0xe948('0xb')](_[_0xe948('0xc')](_0x4cc1ac,{'raw':!![],'where':{'id':0x1}}))[_0xe948('0xd')](function(_0x4479b8){return checkLicense(_0x4479b8,null);})[_0xe948('0xd')](function(_0x4d7b95){_0x55a96a(_0x4d7b95);return;})['catch'](function(_0xf62c43){_0x43267e(_0xf62c43);});});}function checkLicense(_0x2915c0,_0x398699){if(!_0x2915c0){demoLicense[_0xe948('0xe')]=_0x2915c0[_0xe948('0xf')];return demoLicense;}try{var _0x2630f2=_0x398699||_0x2915c0['license'];if(_[_0xe948('0x10')](_0x2630f2)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1c168d=_0x2915c0['data1'];var _0x49124b=_0x2915c0[_0xe948('0x11')];var _0x305e1b=_0x1c168d['split']('-')[0x4];var _0x1680e8=_0x1c168d['split']('-')[0x0];var _0x2d5da9=encryptor['decryptString'](_0x2630f2,util[_0xe948('0x12')](_0xe948('0x13'),_0x305e1b,_0x1c168d,_0x1680e8));var _0x4a1869=JSON['parse'](_0x2d5da9);_0x4a1869[_0xe948('0x14')]=![];_0x4a1869['uuid']=_0x1c168d;_0x4a1869['machineUuid']=hardware[_0xe948('0x8')]();if(_0x49124b){var _0x14fd0d=encryptor[_0xe948('0x15')](_0x49124b);_0x4a1869[_0xe948('0x16')]=_0x14fd0d;_0x4a1869[_0xe948('0x17')]=moment(_0x14fd0d)[_0xe948('0x18')](0x7,_0xe948('0x19'))['format']();_0x4a1869[_0xe948('0x1a')]=_0x4a1869[_0xe948('0xe')]!=_0x4a1869[_0xe948('0x1b')]?_0xe948('0x1c'):_0xe948('0x1d');}return _0x4a1869;}catch(_0x37f02e){breakingLicense[_0xe948('0xe')]=_0x2915c0[_0xe948('0xf')];breakingLicense[_0xe948('0x1e')]=_0x37f02e['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x211d25,_0x264979){getLicense()[_0xe948('0xd')](function(_0x4eaaee){return db[_0xe948('0x1f')][_0xe948('0x20')]({'attributes':[_0xe948('0x21'),[db[_0xe948('0x22')]['fn'](_0xe948('0x23'),db['sequelize']['col'](_0xe948('0x21'))),_0xe948('0x24')]],'group':_0xe948('0x21'),'where':{'role':{'$or':[_0xe948('0x25'),_0xe948('0x26'),_0xe948('0x27')]}},'raw':!![]})[_0xe948('0xd')](function(_0x7996aa){var _0x5e604d={'user':_0x4eaaee['users']||0x0,'telephone':_0x4eaaee['telephones']||0x0};_0x7996aa[_0xe948('0x28')](function(_0x14b34e){var _0x3248a5=_0x14b34e[_0xe948('0x21')]===_0xe948('0x25')?_0xe948('0x26'):_0x14b34e[_0xe948('0x21')];_0x5e604d[_0x3248a5]-=_0x14b34e[_0xe948('0x24')];if(_0x5e604d[_0x3248a5]<0x0)_0x5e604d[_0x3248a5]=0x0;});_0x211d25(_0x5e604d);return;});})[_0xe948('0x29')](function(_0x21e60a){_0x264979(_0x21e60a);});});}function checkUserLimits(_0x318162){return new BPromise(function(_0x1c9a9a,_0x4a053b){getLimits()[_0xe948('0xd')](function(_0x3d4668){var _0x18f1f3=_[_0xe948('0x2a')](_[_0xe948('0x2b')](_0x318162,_0xe948('0x21')),[_0xe948('0x25'),_0xe948('0x26'),_0xe948('0x27')]);var _0x43ed1a=(_0x18f1f3[_0xe948('0x25')]||0x0)+(_0x18f1f3[_0xe948('0x26')]||0x0);var _0x147c20=_0x18f1f3['telephone']||0x0;if(_0x43ed1a>_0x3d4668[_0xe948('0x26')])return _0x4a053b(_0xe948('0x2c'));if(_0x147c20>_0x3d4668['telephone'])return _0x4a053b(_0xe948('0x2d'));return _0x1c9a9a();})[_0xe948('0x29')](function(_0x4ed34b){_0x4a053b(_0x4ed34b);});});}module[_0xe948('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xdf77=['demo','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','col','count','admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','License','find','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xdf77,0x138));var _0x7df7=function(_0x5caa3f,_0x30de03){_0x5caa3f=_0x5caa3f-0x0;var _0x390078=_0xdf77[_0x5caa3f];return _0x390078;};'use strict';var util=require(_0x7df7('0x0'));var _=require(_0x7df7('0x1'));var moment=require(_0x7df7('0x2'));var BPromise=require(_0x7df7('0x3'));var hardware=require(_0x7df7('0x4'));var encryptor=require(_0x7df7('0x5'));var db=require(_0x7df7('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7df7('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7df7('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7df7('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5f0eaa){return new BPromise(function(_0x50b7a7,_0x8e40a3){return db[_0x7df7('0xa')][_0x7df7('0xb')](_['defaults'](_0x5f0eaa,{'raw':!![],'where':{'id':0x1}}))[_0x7df7('0xc')](function(_0x3afc2f){return checkLicense(_0x3afc2f,null);})[_0x7df7('0xc')](function(_0x3c9b45){_0x50b7a7(_0x3c9b45);return;})[_0x7df7('0xd')](function(_0x1a3022){_0x8e40a3(_0x1a3022);});});}function checkLicense(_0x1f642f,_0x490343){if(!_0x1f642f){demoLicense[_0x7df7('0xe')]=_0x1f642f[_0x7df7('0xf')];return demoLicense;}try{var _0x348f64=_0x490343||_0x1f642f[_0x7df7('0x10')];if(_[_0x7df7('0x11')](_0x348f64)){throw new Error(_0x7df7('0x12'));}var _0xfdad2c=_0x1f642f['data1'];var _0x2ab86e=_0x1f642f[_0x7df7('0x13')];var _0xab77f2=_0xfdad2c[_0x7df7('0x14')]('-')[0x4];var _0x36564b=_0xfdad2c[_0x7df7('0x14')]('-')[0x0];var _0x327e58=encryptor[_0x7df7('0x15')](_0x348f64,util['format'](_0x7df7('0x16'),_0xab77f2,_0xfdad2c,_0x36564b));var _0x2ba070=JSON[_0x7df7('0x17')](_0x327e58);_0x2ba070[_0x7df7('0x18')]=![];_0x2ba070[_0x7df7('0xe')]=_0xfdad2c;_0x2ba070[_0x7df7('0x19')]=hardware['getUuid']();if(_0x2ab86e){var _0x1d9793=encryptor['decryptString'](_0x2ab86e);_0x2ba070[_0x7df7('0x1a')]=_0x1d9793;_0x2ba070[_0x7df7('0x1b')]=moment(_0x1d9793)[_0x7df7('0x1c')](0x7,_0x7df7('0x1d'))['format']();_0x2ba070[_0x7df7('0x1e')]=_0x2ba070[_0x7df7('0xe')]!=_0x2ba070['machineUuid']?_0x7df7('0x1f'):_0x7df7('0x20');}return _0x2ba070;}catch(_0x53064f){breakingLicense[_0x7df7('0xe')]=_0x1f642f['data1'];breakingLicense[_0x7df7('0x21')]=_0x53064f[_0x7df7('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5c6c0c,_0x5b47b6){getLicense()[_0x7df7('0xc')](function(_0x10856b){return db[_0x7df7('0x22')][_0x7df7('0x23')]({'attributes':[_0x7df7('0x24'),[db[_0x7df7('0x25')]['fn']('COUNT',db['sequelize'][_0x7df7('0x26')]('role')),_0x7df7('0x27')]],'group':_0x7df7('0x24'),'where':{'role':{'$or':[_0x7df7('0x28'),_0x7df7('0x29'),_0x7df7('0x2a')]}},'raw':!![]})[_0x7df7('0xc')](function(_0x20692d){var _0xbcda89={'user':_0x10856b['users']||0x0,'telephone':_0x10856b[_0x7df7('0x2b')]||0x0};_0x20692d[_0x7df7('0x2c')](function(_0x2c6338){var _0xea35a8=_0x2c6338[_0x7df7('0x24')]===_0x7df7('0x28')?'user':_0x2c6338['role'];_0xbcda89[_0xea35a8]-=_0x2c6338[_0x7df7('0x27')];if(_0xbcda89[_0xea35a8]<0x0)_0xbcda89[_0xea35a8]=0x0;});_0x5c6c0c(_0xbcda89);return;});})['catch'](function(_0x480f9a){_0x5b47b6(_0x480f9a);});});}function checkUserLimits(_0x1c2cdb){return new BPromise(function(_0x53225d,_0x38d94e){getLimits()[_0x7df7('0xc')](function(_0xd6d9f6){var _0xfaab71=_[_0x7df7('0x2d')](_[_0x7df7('0x2e')](_0x1c2cdb,_0x7df7('0x24')),[_0x7df7('0x28'),_0x7df7('0x29'),_0x7df7('0x2a')]);var _0x7cc8a4=(_0xfaab71[_0x7df7('0x28')]||0x0)+(_0xfaab71[_0x7df7('0x29')]||0x0);var _0x36ed1a=_0xfaab71['telephone']||0x0;if(_0x7cc8a4>_0xd6d9f6[_0x7df7('0x29')])return _0x38d94e('License\x20limit\x20reached\x20for\x20users');if(_0x36ed1a>_0xd6d9f6['telephone'])return _0x38d94e(_0x7df7('0x2f'));return _0x53225d();})[_0x7df7('0xd')](function(_0x97bee2){_0x38d94e(_0x97bee2);});});}module['exports']={'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 22e022e..990f720 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 _0xdb28=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x297d92,_0x2ac038){var _0x6e80cc=function(_0x759748){while(--_0x759748){_0x297d92['push'](_0x297d92['shift']());}};_0x6e80cc(++_0x2ac038);}(_0xdb28,0x106));var _0x8db2=function(_0x5cf73c,_0x2cf729){_0x5cf73c=_0x5cf73c-0x0;var _0x2280e3=_0xdb28[_0x5cf73c];return _0x2280e3;};'use strict';module[_0x8db2('0x0')]={'DOMAIN':_0x8db2('0x1'),'SESSION_SECRET':_0x8db2('0x2'),'GOOGLE_ID':_0x8db2('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x4024=['secret','exports','http://localhost:9000','app-id'];(function(_0x4fc7d6,_0x128e72){var _0x2ec385=function(_0x4cb960){while(--_0x4cb960){_0x4fc7d6['push'](_0x4fc7d6['shift']());}};_0x2ec385(++_0x128e72);}(_0x4024,0x89));var _0x4402=function(_0xc02915,_0x48be3e){_0xc02915=_0xc02915-0x0;var _0x366bb0=_0x4024[_0xc02915];return _0x366bb0;};'use strict';module[_0x4402('0x0')]={'DOMAIN':_0x4402('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4402('0x2'),'GOOGLE_SECRET':_0x4402('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index cda64c7..12bd635 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9c7=['fileLogger','exports','../utils/loggers'];(function(_0x3c4062,_0x3767fc){var _0x3f5bf3=function(_0x105e55){while(--_0x105e55){_0x3c4062['push'](_0x3c4062['shift']());}};_0x3f5bf3(++_0x3767fc);}(_0xd9c7,0x17f));var _0x7d9c=function(_0x33a464,_0x2b36ac){_0x33a464=_0x33a464-0x0;var _0xece740=_0xd9c7[_0x33a464];return _0xece740;};'use strict';var fileLogger=require(_0x7d9c('0x0'))[_0x7d9c('0x1')];module[_0x7d9c('0x2')]=fileLogger; \ No newline at end of file +var _0x44ee=['exports','../utils/loggers','fileLogger'];(function(_0x56b9ee,_0x4a5017){var _0x5bcf31=function(_0x302e8e){while(--_0x302e8e){_0x56b9ee['push'](_0x56b9ee['shift']());}};_0x5bcf31(++_0x4a5017);}(_0x44ee,0x88));var _0xe44e=function(_0x4004ba,_0x3e52a5){_0x4004ba=_0x4004ba-0x0;var _0x4eddc1=_0x44ee[_0x4004ba];return _0x4eddc1;};'use strict';var fileLogger=require(_0xe44e('0x0'))[_0xe44e('0x1')];module[_0xe44e('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2f64265..f9bcd1a 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 _0xefe1=['agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','exports','path','express','join','../../services/express/index.js','ami'];(function(_0x5e761b,_0x355e38){var _0x98502c=function(_0x4e52d5){while(--_0x4e52d5){_0x5e761b['push'](_0x5e761b['shift']());}};_0x98502c(++_0x355e38);}(_0xefe1,0x7f));var _0x1efe=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xefe1[_0x187ee1];return _0x388160;};'use strict';var path=require(_0x1efe('0x0'));var os=require('os');var config={'apps':[{'name':_0x1efe('0x1'),'script':path[_0x1efe('0x2')](__dirname,_0x1efe('0x3'))},{'name':_0x1efe('0x4'),'script':path[_0x1efe('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x1efe('0x5'),'script':path[_0x1efe('0x2')](__dirname,_0x1efe('0x6'))},{'name':_0x1efe('0x7'),'script':path['join'](__dirname,_0x1efe('0x8'))},{'name':'routing','script':path[_0x1efe('0x2')](__dirname,_0x1efe('0x9'))},{'name':'xdr','script':path[_0x1efe('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x1efe('0xa')]=config; \ No newline at end of file +var _0xc161=['../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','express','join'];(function(_0x54516e,_0x5df54c){var _0x4d1e6f=function(_0x454bbc){while(--_0x454bbc){_0x54516e['push'](_0x54516e['shift']());}};_0x4d1e6f(++_0x5df54c);}(_0xc161,0xa7));var _0x1c16=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0xc161[_0x13843f];return _0x1063ae;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x1c16('0x0'),'script':path[_0x1c16('0x1')](__dirname,_0x1c16('0x2'))},{'name':_0x1c16('0x3'),'script':path[_0x1c16('0x1')](__dirname,_0x1c16('0x4'))},{'name':_0x1c16('0x5'),'script':path[_0x1c16('0x1')](__dirname,_0x1c16('0x6'))},{'name':_0x1c16('0x7'),'script':path[_0x1c16('0x1')](__dirname,_0x1c16('0x8'))},{'name':_0x1c16('0x9'),'script':path[_0x1c16('0x1')](__dirname,'../../services/routing/index.js')},{'name':_0x1c16('0xa'),'script':path[_0x1c16('0x1')](__dirname,_0x1c16('0xb'))}]};module[_0x1c16('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 889d362..890a979 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 _0xe52c=['then','describe','delete','dump','saved','bluebird','./config','connect','connected','start','disconnect','stop','restart'];(function(_0x7cf586,_0xd0ff06){var _0x3c38a4=function(_0x509822){while(--_0x509822){_0x7cf586['push'](_0x7cf586['shift']());}};_0x3c38a4(++_0xd0ff06);}(_0xe52c,0x87));var _0xce52=function(_0xb5fa8d,_0x538f47){_0xb5fa8d=_0xb5fa8d-0x0;var _0x463df2=_0xe52c[_0xb5fa8d];return _0x463df2;};'use strict';var pm2=require('pm2');var BPromise=require(_0xce52('0x0'));var config=require(_0xce52('0x1'));function connect(){return new BPromise(function(_0x5fc111,_0x305650){return pm2[_0xce52('0x2')](function(_0x58c065){if(_0x58c065){return _0x305650(_0x58c065);}return _0x5fc111(_0xce52('0x3'));});});};exports[_0xce52('0x4')]=function(_0x106a4b){return connect()['then'](function(){return new BPromise(function(_0x4df1f5,_0x1eeb53){return pm2['start'](_0x106a4b,function(_0x538dbd,_0x5397db){if(_0x538dbd){return _0x1eeb53(_0x538dbd);}pm2[_0xce52('0x5')]();return _0x4df1f5(_0x5397db);});});});};exports[_0xce52('0x6')]=function(_0x53b7f1){return connect()['then'](function(){return new BPromise(function(_0x4ed0bb,_0x163393){return pm2[_0xce52('0x6')](_0x53b7f1,function(_0x316b29,_0x16711a){if(_0x316b29){return _0x163393(_0x316b29);}pm2['disconnect']();return _0x4ed0bb(_0x16711a);});});});};exports[_0xce52('0x7')]=function(_0x3656da){return connect()['then'](function(){return new BPromise(function(_0x87545e,_0x1f13ae){return pm2[_0xce52('0x7')](_0x3656da,function(_0x2aa255,_0x289fb2){if(_0x2aa255){return _0x1f13ae(_0x2aa255);}pm2[_0xce52('0x5')]();return _0x87545e(_0x289fb2);});});});};exports['list']=function(){return connect()[_0xce52('0x8')](function(){return new BPromise(function(_0x1e146c,_0x51080f){return pm2['list'](function(_0x3a8d62,_0x5790c5){if(_0x3a8d62){return _0x51080f(_0x3a8d62);}pm2[_0xce52('0x5')]();return _0x1e146c(_0x5790c5);});});});};exports[_0xce52('0x9')]=function(_0x32feb4){return connect()[_0xce52('0x8')](function(){return new BPromise(function(_0x48b3eb,_0x1bef87){return pm2[_0xce52('0x9')](_0x32feb4,function(_0x459aa4,_0xbd2d89){if(_0x459aa4){return _0x1bef87(_0x459aa4);}pm2[_0xce52('0x5')]();return _0x48b3eb(_0xbd2d89);});});});};exports[_0xce52('0xa')]=function(_0x3d48dc){return connect()[_0xce52('0x8')](function(){return new BPromise(function(_0x4a6dca,_0x32f3da){return pm2[_0xce52('0xa')](_0x3d48dc,function(_0x4deef4,_0x4b2dc4){if(_0x4deef4){return _0x32f3da(_0x4deef4);}pm2[_0xce52('0x5')]();return _0x4a6dca(_0x4b2dc4);});});});};exports['dump']=function(){return connect()[_0xce52('0x8')](function(){return new BPromise(function(_0x558208,_0x2dbf20){return pm2[_0xce52('0xb')](function(_0x4a4b8f){if(_0x4a4b8f){return _0x2dbf20(_0x4a4b8f);}return _0x558208(_0xce52('0xc'));});});});}; \ No newline at end of file +var _0xb382=['connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','connect'];(function(_0x36139d,_0xa45e95){var _0x16eb27=function(_0x2fb633){while(--_0x2fb633){_0x36139d['push'](_0x36139d['shift']());}};_0x16eb27(++_0xa45e95);}(_0xb382,0x193));var _0x2b38=function(_0x2da33a,_0x21cf38){_0x2da33a=_0x2da33a-0x0;var _0xdbb35=_0xb382[_0x2da33a];return _0xdbb35;};'use strict';var pm2=require(_0x2b38('0x0'));var BPromise=require(_0x2b38('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x647bc8,_0x22fc45){return pm2[_0x2b38('0x2')](function(_0xc8524f){if(_0xc8524f){return _0x22fc45(_0xc8524f);}return _0x647bc8(_0x2b38('0x3'));});});};exports[_0x2b38('0x4')]=function(_0x230964){return connect()[_0x2b38('0x5')](function(){return new BPromise(function(_0x5346c8,_0x3faa88){return pm2[_0x2b38('0x4')](_0x230964,function(_0x3dbc2a,_0x17a75e){if(_0x3dbc2a){return _0x3faa88(_0x3dbc2a);}pm2[_0x2b38('0x6')]();return _0x5346c8(_0x17a75e);});});});};exports['stop']=function(_0xb9b0b7){return connect()[_0x2b38('0x5')](function(){return new BPromise(function(_0x2fa1d5,_0x5b412e){return pm2[_0x2b38('0x7')](_0xb9b0b7,function(_0x1ecd77,_0x4191ef){if(_0x1ecd77){return _0x5b412e(_0x1ecd77);}pm2[_0x2b38('0x6')]();return _0x2fa1d5(_0x4191ef);});});});};exports[_0x2b38('0x8')]=function(_0x14d1d2){return connect()['then'](function(){return new BPromise(function(_0x57d98e,_0x39798b){return pm2[_0x2b38('0x8')](_0x14d1d2,function(_0xf3ebf9,_0x39b158){if(_0xf3ebf9){return _0x39798b(_0xf3ebf9);}pm2[_0x2b38('0x6')]();return _0x57d98e(_0x39b158);});});});};exports[_0x2b38('0x9')]=function(){return connect()[_0x2b38('0x5')](function(){return new BPromise(function(_0x2e58c0,_0x59dd5b){return pm2[_0x2b38('0x9')](function(_0x36db2b,_0x5a88cc){if(_0x36db2b){return _0x59dd5b(_0x36db2b);}pm2[_0x2b38('0x6')]();return _0x2e58c0(_0x5a88cc);});});});};exports[_0x2b38('0xa')]=function(_0x82b99f){return connect()['then'](function(){return new BPromise(function(_0x2b2b9a,_0x18848e){return pm2['describe'](_0x82b99f,function(_0x8f9a67,_0x360f6c){if(_0x8f9a67){return _0x18848e(_0x8f9a67);}pm2[_0x2b38('0x6')]();return _0x2b2b9a(_0x360f6c);});});});};exports[_0x2b38('0xb')]=function(_0x4878fc){return connect()['then'](function(){return new BPromise(function(_0x11927c,_0x359673){return pm2[_0x2b38('0xb')](_0x4878fc,function(_0x10a334,_0x631332){if(_0x10a334){return _0x359673(_0x10a334);}pm2[_0x2b38('0x6')]();return _0x11927c(_0x631332);});});});};exports[_0x2b38('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2684a3,_0x3f4888){return pm2['dump'](function(_0x2a05c3){if(_0x2a05c3){return _0x3f4888(_0x2a05c3);}return _0x2684a3(_0x2b38('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 00e2505..b103e23 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 _0xa26d=['start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect'];(function(_0x6d6f7,_0x4ba1a9){var _0x2a6afe=function(_0x2b9c3c){while(--_0x2b9c3c){_0x6d6f7['push'](_0x6d6f7['shift']());}};_0x2a6afe(++_0x4ba1a9);}(_0xa26d,0xe8));var _0xda26=function(_0x3d732d,_0x50b90c){_0x3d732d=_0x3d732d-0x0;var _0x151e38=_0xa26d[_0x3d732d];return _0x151e38;};'use strict';var _=require(_0xda26('0x0'));var moment=require(_0xda26('0x1'));var Redis=require(_0xda26('0x2'));var util=require(_0xda26('0x3'));var config=require(_0xda26('0x4'));var db=require(_0xda26('0x5'))['db'];var logger=require('../logger')('schedule');config[_0xda26('0x6')]=_[_0xda26('0x7')](config[_0xda26('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xda26('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x11fee7=0x0;var _0x21443f=[];return db['Setting'][_0xda26('0x9')]({'raw':!![],'attributes':['id',_0xda26('0xa')],'where':{'id':0x1}})[_0xda26('0xb')](function(_0x113200){_0x11fee7=_0x113200[_0xda26('0xa')];if(_0x11fee7){return db[_0xda26('0xc')][_0xda26('0xd')]({'raw':!![],'attributes':['id',_0xda26('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xda26('0xf')](_0x113200['chatTimeout'],_0xda26('0x10'))}}});}else{return[];}})['then'](function(_0xd915e8){if(_0xd915e8&&_0xd915e8[_0xda26('0x11')]){_0x21443f=_[_0xda26('0x12')](_0xd915e8||[],'id');logger[_0xda26('0x13')](_0xda26('0x14'),_0x21443f[_0xda26('0x15')]());return db['ChatInteraction']['update']({'closeReason':_0xda26('0x16'),'disposition':_0xda26('0x17'),'closed':!![],'closedAt':moment()[_0xda26('0x18')](_0xda26('0x19'))},{'where':{'id':_0x21443f}});}})[_0xda26('0xb')](function(){if(_0x21443f&&_0x21443f[_0xda26('0x11')]){logger[_0xda26('0x13')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x21443f[_0xda26('0x15')]());for(var _0x2343e9=0x0;_0x2343e9<_0x21443f[_0xda26('0x11')];_0x2343e9++){io[_0xda26('0x1a')](_0xda26('0x1b'),{'id':_0x21443f[_0x2343e9],'closed':!![]});}}})[_0xda26('0x1c')](function(_0x24560b){logger[_0xda26('0x1d')](_0xda26('0x1e'),_0x24560b?util[_0xda26('0x1f')](_0x24560b,{'showHidden':![],'depth':null}):'');});}exports[_0xda26('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9ad8=['inspect','lodash','moment','ioredis','util','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0x9ad8,0xe1));var _0x89ad=function(_0x64b57d,_0x2a79d8){_0x64b57d=_0x64b57d-0x0;var _0x2f55bd=_0x9ad8[_0x64b57d];return _0x2f55bd;};'use strict';var _=require(_0x89ad('0x0'));var moment=require(_0x89ad('0x1'));var Redis=require(_0x89ad('0x2'));var util=require(_0x89ad('0x3'));var config=require('../../config/environment');var db=require(_0x89ad('0x4'))['db'];var logger=require('../logger')(_0x89ad('0x5'));config[_0x89ad('0x6')]=_[_0x89ad('0x7')](config[_0x89ad('0x6')],{'host':_0x89ad('0x8'),'port':0x18eb});var io=require(_0x89ad('0x9'))(new Redis(config[_0x89ad('0x6')]));function closeInteractions(){var _0x3dbef7=0x0;var _0x22e266=[];return db[_0x89ad('0xa')]['find']({'raw':!![],'attributes':['id',_0x89ad('0xb')],'where':{'id':0x1}})[_0x89ad('0xc')](function(_0x207b62){_0x3dbef7=_0x207b62['chatTimeout'];if(_0x3dbef7){return db[_0x89ad('0xd')][_0x89ad('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x89ad('0xf')](_0x207b62[_0x89ad('0xb')],_0x89ad('0x10'))}}});}else{return[];}})['then'](function(_0x28b687){if(_0x28b687&&_0x28b687[_0x89ad('0x11')]){_0x22e266=_[_0x89ad('0x12')](_0x28b687||[],'id');logger[_0x89ad('0x13')](_0x89ad('0x14'),_0x22e266[_0x89ad('0x15')]());return db['ChatInteraction'][_0x89ad('0x16')]({'closeReason':_0x89ad('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x89ad('0x18')](_0x89ad('0x19'))},{'where':{'id':_0x22e266}});}})[_0x89ad('0xc')](function(){if(_0x22e266&&_0x22e266[_0x89ad('0x11')]){logger['info'](_0x89ad('0x1a'),_0x22e266[_0x89ad('0x15')]());for(var _0x1ef52e=0x0;_0x1ef52e<_0x22e266[_0x89ad('0x11')];_0x1ef52e++){io[_0x89ad('0x1b')](_0x89ad('0x1c'),{'id':_0x22e266[_0x1ef52e],'closed':!![]});}}})[_0x89ad('0x1d')](function(_0x3f6b70){logger[_0x89ad('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x3f6b70?util[_0x89ad('0x1f')](_0x3f6b70,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 8eae3e7..8f7d733 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 _0x0c5e=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x0c5e,0x1c9));var _0xe0c5=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x0c5e[_0x209941];return _0x1e8729;};'use strict';function start(){var _0x1860f6=require(_0xe0c5('0x0'));return _0x1860f6[_0xe0c5('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x04c1=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x4eb832,_0x324bff){var _0x2e5927=function(_0x4687ce){while(--_0x4687ce){_0x4eb832['push'](_0x4eb832['shift']());}};_0x2e5927(++_0x324bff);}(_0x04c1,0x79));var _0x104c=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x04c1[_0x19dd7a];return _0x3feb6a;};'use strict';function start(){var _0x326780=require(_0x104c('0x0'));return _0x326780[_0x104c('0x1')]();}module[_0x104c('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 828934a..46e8361 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 _0x1504=['cron-job-manager','bluebird','../logger','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','name','email','Smtp','user','bcc','subtractNumber','subtractUnit','join','savename','%s.%s','zip','existsSync','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','error','error\x20mail','catch','stringify','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','then','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','toString','keyBy','difference','length','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','active','endAt','add','start','stop\x20cron','isBetween','startAt','update','update\x20cron','run','path','lodash','moment'];(function(_0x2b3478,_0x58afd7){var _0x1c106f=function(_0x4f12a1){while(--_0x4f12a1){_0x2b3478['push'](_0x2b3478['shift']());}};_0x1c106f(++_0x58afd7);}(_0x1504,0x97));var _0x4150=function(_0x575584,_0x149395){_0x575584=_0x575584-0x0;var _0x120d12=_0x1504[_0x575584];return _0x120d12;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x4150('0x0'));var _=require(_0x4150('0x1'));var moment=require(_0x4150('0x2'));var CronJobManager=require(_0x4150('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x4150('0x4'));var logger=require(_0x4150('0x5'))('schedule');var db=require(_0x4150('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x4150('0x7'));var client=jayson['client'][_0x4150('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5a36b8,_0x394d9e){return function(){logger[_0x4150('0x9')](_0x4150('0xa'),_0x5a36b8['email']);var _0x74fe7c=!![];var _0x14b7a0=_0x5a36b8[_0x4150('0xb')][_0x4150('0xc')]();var _0x4282f0={'account':_0x14b7a0,'message':{'from':util[_0x4150('0xd')]('\x22%s\x22\x20<%s>',_0x5a36b8['MailAccount'][_0x4150('0xe')],_0x5a36b8['MailAccount'][_0x4150('0xf')]||_0x5a36b8[_0x4150('0xb')][_0x4150('0x10')][_0x4150('0x11')]),'to':_0x5a36b8[_0x4150('0xf')],'cc':_0x5a36b8['cc'],'bcc':_0x5a36b8[_0x4150('0x12')],'subject':util[_0x4150('0xd')]('Report\x20%s\x20last\x20%s\x20%s',_0x394d9e[_0x4150('0xe')],_0x5a36b8[_0x4150('0x13')],_0x5a36b8[_0x4150('0x14')])}};var _0x4cbd7f=path[_0x4150('0x15')](__dirname,'../../files/reports');var _0x3bb236=_0x394d9e[_0x4150('0x16')];var _0x1abb05=util[_0x4150('0xd')](_0x4150('0x17'),path['basename'](_0x394d9e[_0x4150('0x16')],path['extname'](_0x394d9e[_0x4150('0x16')])),_0x4150('0x18'));var _0x12a08b=path['join'](_0x4cbd7f,_0x3bb236);var _0x4c2c63=path['join'](_0x4cbd7f,_0x1abb05);if(fs[_0x4150('0x19')](_0x12a08b)){_0x394d9e[_0x4150('0x1a')]='Sent';_0x4282f0[_0x4150('0x1b')][_0x4150('0x1c')]=[{'filename':_0x3bb236,'path':_0x12a08b}];_0x4282f0[_0x4150('0x1b')][_0x4150('0x1d')]=util[_0x4150('0xd')](_0x4150('0x1e'),JSON['stringify'](_0x394d9e,null,0x2));}else if(fs[_0x4150('0x19')](_0x4c2c63)){_0x394d9e[_0x4150('0x1a')]=_0x4150('0x1f');_0x4282f0[_0x4150('0x1b')][_0x4150('0x1c')]=[{'filename':_0x1abb05,'path':_0x4c2c63}];}else{_0x4282f0[_0x4150('0x1b')][_0x4150('0x1d')]=_0x4150('0x20');if(!_0x5a36b8[_0x4150('0x21')]){_0x74fe7c=![];logger[_0x4150('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x74fe7c){return client[_0x4150('0x22')](_0x4150('0x23'),_0x4282f0)['then'](function(_0x2fa41b){if(_0x2fa41b[_0x4150('0x24')]){return logger[_0x4150('0x24')](_0x4150('0x25'),JSON['stringify'](_0x2fa41b));}return logger[_0x4150('0x9')]('email\x20sent');})[_0x4150('0x26')](function(_0x855bed){return logger['error'](_0x4150('0x25'),JSON[_0x4150('0x27')](_0x855bed));});}};}function handleError(){return function(_0x57da22){return logger[_0x4150('0x24')](JSON[_0x4150('0x27')](_0x57da22));};}function handleResult(_0x2d9d3b){return function(_0xdc89d4){logger['info'](_0x4150('0x28'),JSON[_0x4150('0x27')](_0xdc89d4));if(_0x2d9d3b[_0x4150('0xb')]&&_0x2d9d3b['MailAccount'][_0x4150('0x10')]&&!_[_0x4150('0x29')](_0x2d9d3b[_0x4150('0xf')])){setTimeout(handleSendEmail(_0x2d9d3b,_0xdc89d4),0x3c*0x3e8);}};}function handleJob(_0x3c7af8){return function(){try{if(_['isNil'](_0x3c7af8[_0x4150('0x13')])){return logger[_0x4150('0x9')](_0x4150('0x2a'));}if(_[_0x4150('0x29')](_0x3c7af8[_0x4150('0x14')])){return logger['info'](_0x4150('0x2b'));}var _0x39c7b1={'startDate':moment()['subtract'](_0x3c7af8[_0x4150('0x13')],_0x3c7af8[_0x4150('0x14')])[_0x4150('0xd')](_0x4150('0x2c')),'endDate':moment()[_0x4150('0xd')](_0x4150('0x2c')),'type':'scheduled','output':_0x3c7af8['output'],'name':_0x3c7af8[_0x4150('0xe')]};if(!_['isNil'](_0x3c7af8['DefaultReportId'])){logger[_0x4150('0x9')]('exec\x20defaul\x20report\x20id:%s',_0x3c7af8[_0x4150('0x2d')]);return analyticDefaultReportController['runReport']({'id':_0x3c7af8['DefaultReportId']},_0x39c7b1)[_0x4150('0x2e')](handleResult(_0x3c7af8))[_0x4150('0x26')](handleError());}if(!_[_0x4150('0x29')](_0x3c7af8[_0x4150('0x2f')])){logger[_0x4150('0x9')](_0x4150('0x30'),_0x3c7af8['CustomReportId']);return analyticCustomReportController[_0x4150('0x31')]({'id':_0x3c7af8['CustomReportId']},_0x39c7b1)[_0x4150('0x2e')](handleResult(_0x3c7af8))[_0x4150('0x26')](handleError());}}catch(_0x42a40d){logger[_0x4150('0x24')](JSON['stringify'](_0x42a40d));}return logger['info'](_0x4150('0x32'));};}function getJobs(_0x56df1f){var _0x2bd2fd={};if(_0x56df1f){_0x2bd2fd['id']=_0x56df1f;}return db[_0x4150('0x33')][_0x4150('0x34')]({'where':_0x2bd2fd,'include':[{'model':db[_0x4150('0xb')],'attributes':['id',_0x4150('0xe'),_0x4150('0xf')],'include':[{'model':db['MailServerOut'],'as':_0x4150('0x10'),'include':[{'model':db[_0x4150('0x35')],'as':_0x4150('0x35')}]}]}]})[_0x4150('0x2e')](function(_0x6be5b1){var _0x413643=_[_0x4150('0x36')](manager[_0x4150('0x37')]);var _0x5e71ab=_['map'](_0x6be5b1,function(_0x1f6177){return _0x1f6177['id'][_0x4150('0x38')]();});var _0x20999c=_[_0x4150('0x39')](_0x6be5b1,function(_0x24bc70){return _0x24bc70['id']['toString']();});var _0x37b706=_0x56df1f?_0x5e71ab:_[_0x4150('0x3a')](_0x5e71ab,_0x413643);var _0x308b54=_['intersection'](_0x5e71ab,_0x413643);var _0x5ea8ff=_[_0x4150('0x3a')](_0x413643,_0x5e71ab);var _0x4991c2;var _0x3a7db0;for(_0x4991c2=0x0;_0x4991c2<_0x5ea8ff[_0x4150('0x3b')]&&!_0x56df1f;_0x4991c2+=0x1){_0x3a7db0=_0x5ea8ff[_0x4991c2][_0x4150('0x38')]();if(manager['exists'](_0x3a7db0)){manager['stop'](_0x3a7db0);manager[_0x4150('0x3c')](_0x3a7db0);logger['info']('delete\x20cron',_0x3a7db0);}}logger[_0x4150('0x9')](_0x4150('0x3d'),JSON[_0x4150('0x27')](_0x37b706));for(_0x4991c2=0x0;_0x4991c2<_0x37b706[_0x4150('0x3b')];_0x4991c2+=0x1){_0x3a7db0=_0x37b706[_0x4991c2]['toString']();logger[_0x4150('0x9')](_0x4150('0x3e'),_0x3a7db0);if(_0x56df1f){logger[_0x4150('0x9')](_0x4150('0x3f'),_0x56df1f);logger[_0x4150('0x9')](JSON[_0x4150('0x27')](_0x20999c[_0x3a7db0]));BPromise[_0x4150('0x40')]()[_0x4150('0x2e')](handleJob(_0x20999c[_0x3a7db0]));logger['info'](_0x4150('0x41'),_0x20999c[_0x3a7db0][_0x4150('0xe')],_0x20999c[_0x3a7db0]['cron']);}else if(_0x20999c[_0x3a7db0][_0x4150('0x42')]&&_0x20999c[_0x3a7db0][_0x4150('0x43')]&&moment()['isBetween'](_0x20999c[_0x3a7db0]['startAt'],_0x20999c[_0x3a7db0][_0x4150('0x44')])){manager[_0x4150('0x45')](_0x3a7db0,_0x20999c[_0x3a7db0][_0x4150('0x42')],handleJob(_0x20999c[_0x3a7db0]));manager[_0x4150('0x46')](_0x3a7db0);logger[_0x4150('0x9')]('add\x20cron',_0x20999c[_0x3a7db0][_0x4150('0xe')],_0x20999c[_0x3a7db0][_0x4150('0x42')]);}else if(manager['exists'](_0x3a7db0)){manager['stop'](_0x3a7db0);manager[_0x4150('0x3c')](_0x3a7db0);logger[_0x4150('0x9')](_0x4150('0x47'),_0x20999c[_0x3a7db0][_0x4150('0xe')],_0x20999c[_0x3a7db0][_0x4150('0x42')]);}}for(_0x4991c2=0x0,_0x3a7db0;_0x4991c2<_0x308b54[_0x4150('0x3b')]&&!_0x56df1f;_0x4991c2+=0x1){_0x3a7db0=_0x308b54[_0x4991c2][_0x4150('0x38')]();if(manager['exists'](_0x3a7db0)){if(_0x20999c[_0x3a7db0][_0x4150('0x42')]&&_0x20999c[_0x3a7db0][_0x4150('0x43')]&&moment()[_0x4150('0x48')](_0x20999c[_0x3a7db0][_0x4150('0x49')],_0x20999c[_0x3a7db0][_0x4150('0x44')])){manager[_0x4150('0x4a')](_0x3a7db0,_0x20999c[_0x3a7db0][_0x4150('0x42')],handleJob(_0x20999c[_0x3a7db0]));logger[_0x4150('0x9')](_0x4150('0x4b'),_0x20999c[_0x3a7db0][_0x4150('0xe')],_0x20999c[_0x3a7db0]['cron']);}else{manager['stop'](_0x3a7db0);manager[_0x4150('0x3c')](_0x3a7db0);logger[_0x4150('0x9')](_0x4150('0x47'),_0x20999c[_0x3a7db0][_0x4150('0xe')],_0x20999c[_0x3a7db0][_0x4150('0x42')]);}}}})[_0x4150('0x26')](function(_0x24da61){logger[_0x4150('0x24')](JSON[_0x4150('0x27')](_0x24da61));});}exports[_0x4150('0x4c')]=function(_0x5444ce){return getJobs(_0x5444ce);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xbb3e=['keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','update','stop\x20cron','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','extname','zip','join','existsSync','status','Sent','message','text','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','then','error','error\x20mail','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','findAll','CloudProvider'];(function(_0x2d759a,_0x316fda){var _0x4cc6a3=function(_0x34edf1){while(--_0x34edf1){_0x2d759a['push'](_0x2d759a['shift']());}};_0x4cc6a3(++_0x316fda);}(_0xbb3e,0x116));var _0xebb3=function(_0x115819,_0x5ea0c9){_0x115819=_0x115819-0x0;var _0x39a48b=_0xbb3e[_0x115819];return _0x39a48b;};'use strict';var fs=require('fs');var util=require(_0xebb3('0x0'));var path=require(_0xebb3('0x1'));var _=require(_0xebb3('0x2'));var moment=require(_0xebb3('0x3'));var CronJobManager=require(_0xebb3('0x4'));var jayson=require(_0xebb3('0x5'));var BPromise=require('bluebird');var logger=require(_0xebb3('0x6'))(_0xebb3('0x7'));var db=require(_0xebb3('0x8'))['db'];var analyticCustomReportController=require(_0xebb3('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xebb3('0xa')][_0xebb3('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4f1e82,_0x253dfe){return function(){logger[_0xebb3('0xc')](_0xebb3('0xd'),_0x4f1e82[_0xebb3('0xe')]);var _0x14579c=!![];var _0x13f546=_0x4f1e82[_0xebb3('0xf')][_0xebb3('0x10')]();var _0x23d57f={'account':_0x13f546,'message':{'from':util[_0xebb3('0x11')](_0xebb3('0x12'),_0x4f1e82[_0xebb3('0xf')][_0xebb3('0x13')],_0x4f1e82[_0xebb3('0xf')]['email']||_0x4f1e82['MailAccount'][_0xebb3('0x14')][_0xebb3('0x15')]),'to':_0x4f1e82[_0xebb3('0xe')],'cc':_0x4f1e82['cc'],'bcc':_0x4f1e82['bcc'],'subject':util[_0xebb3('0x11')](_0xebb3('0x16'),_0x253dfe[_0xebb3('0x13')],_0x4f1e82[_0xebb3('0x17')],_0x4f1e82[_0xebb3('0x18')])}};var _0xfa7280=path['join'](__dirname,_0xebb3('0x19'));var _0x171921=_0x253dfe[_0xebb3('0x1a')];var _0x230af6=util[_0xebb3('0x11')](_0xebb3('0x1b'),path['basename'](_0x253dfe[_0xebb3('0x1a')],path[_0xebb3('0x1c')](_0x253dfe[_0xebb3('0x1a')])),_0xebb3('0x1d'));var _0x43626a=path[_0xebb3('0x1e')](_0xfa7280,_0x171921);var _0x236da7=path[_0xebb3('0x1e')](_0xfa7280,_0x230af6);if(fs[_0xebb3('0x1f')](_0x43626a)){_0x253dfe[_0xebb3('0x20')]=_0xebb3('0x21');_0x23d57f['message']['attachments']=[{'filename':_0x171921,'path':_0x43626a}];_0x23d57f[_0xebb3('0x22')][_0xebb3('0x23')]=util[_0xebb3('0x11')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xebb3('0x24')](_0x253dfe,null,0x2));}else if(fs[_0xebb3('0x1f')](_0x236da7)){_0x253dfe[_0xebb3('0x20')]=_0xebb3('0x21');_0x23d57f[_0xebb3('0x22')][_0xebb3('0x25')]=[{'filename':_0x230af6,'path':_0x236da7}];}else{_0x23d57f[_0xebb3('0x22')][_0xebb3('0x23')]=_0xebb3('0x26');if(!_0x4f1e82[_0xebb3('0x27')]){_0x14579c=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x14579c){return client[_0xebb3('0x28')]('SendMail',_0x23d57f)[_0xebb3('0x29')](function(_0x3cc5fd){if(_0x3cc5fd['error']){return logger[_0xebb3('0x2a')](_0xebb3('0x2b'),JSON[_0xebb3('0x24')](_0x3cc5fd));}return logger[_0xebb3('0xc')]('email\x20sent');})[_0xebb3('0x2c')](function(_0x3fe8c8){return logger['error'](_0xebb3('0x2b'),JSON['stringify'](_0x3fe8c8));});}};}function handleError(){return function(_0x131e1f){return logger[_0xebb3('0x2a')](JSON[_0xebb3('0x24')](_0x131e1f));};}function handleResult(_0x12eb2d){return function(_0x480697){logger['info']('data',JSON[_0xebb3('0x24')](_0x480697));if(_0x12eb2d[_0xebb3('0xf')]&&_0x12eb2d[_0xebb3('0xf')]['Smtp']&&!_[_0xebb3('0x2d')](_0x12eb2d[_0xebb3('0xe')])){setTimeout(handleSendEmail(_0x12eb2d,_0x480697),0x3c*0x3e8);}};}function handleJob(_0x371196){return function(){try{if(_['isNil'](_0x371196[_0xebb3('0x17')])){return logger[_0xebb3('0xc')](_0xebb3('0x2e'));}if(_[_0xebb3('0x2d')](_0x371196[_0xebb3('0x18')])){return logger[_0xebb3('0xc')](_0xebb3('0x2f'));}var _0x1de16a={'startDate':moment()[_0xebb3('0x30')](_0x371196[_0xebb3('0x17')],_0x371196[_0xebb3('0x18')])[_0xebb3('0x11')](_0xebb3('0x31')),'endDate':moment()['format'](_0xebb3('0x31')),'type':_0xebb3('0x32'),'output':_0x371196[_0xebb3('0x33')],'name':_0x371196['name']};if(!_[_0xebb3('0x2d')](_0x371196[_0xebb3('0x34')])){logger[_0xebb3('0xc')](_0xebb3('0x35'),_0x371196[_0xebb3('0x34')]);return analyticDefaultReportController[_0xebb3('0x36')]({'id':_0x371196[_0xebb3('0x34')]},_0x1de16a)[_0xebb3('0x29')](handleResult(_0x371196))[_0xebb3('0x2c')](handleError());}if(!_[_0xebb3('0x2d')](_0x371196[_0xebb3('0x37')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x371196[_0xebb3('0x37')]);return analyticCustomReportController[_0xebb3('0x36')]({'id':_0x371196['CustomReportId']},_0x1de16a)[_0xebb3('0x29')](handleResult(_0x371196))[_0xebb3('0x2c')](handleError());}}catch(_0x3f9207){logger[_0xebb3('0x2a')](JSON[_0xebb3('0x24')](_0x3f9207));}return logger[_0xebb3('0xc')]('no\x20report\x20id');};}function getJobs(_0x2627d1){var _0xaee70d={};if(_0x2627d1){_0xaee70d['id']=_0x2627d1;}return db['Schedule'][_0xebb3('0x38')]({'where':_0xaee70d,'include':[{'model':db[_0xebb3('0xf')],'attributes':['id',_0xebb3('0x13'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xebb3('0x14'),'include':[{'model':db[_0xebb3('0x39')],'as':_0xebb3('0x39')}]}]}]})[_0xebb3('0x29')](function(_0x4d1a2c){var _0x555a15=_[_0xebb3('0x3a')](manager[_0xebb3('0x3b')]);var _0x463709=_[_0xebb3('0x3c')](_0x4d1a2c,function(_0x4f422c){return _0x4f422c['id'][_0xebb3('0x3d')]();});var _0x490252=_[_0xebb3('0x3e')](_0x4d1a2c,function(_0x2ebe64){return _0x2ebe64['id']['toString']();});var _0x131003=_0x2627d1?_0x463709:_[_0xebb3('0x3f')](_0x463709,_0x555a15);var _0x57e0e5=_[_0xebb3('0x40')](_0x463709,_0x555a15);var _0x17647e=_[_0xebb3('0x3f')](_0x555a15,_0x463709);var _0x14ef19;var _0x2e1eb7;for(_0x14ef19=0x0;_0x14ef19<_0x17647e[_0xebb3('0x41')]&&!_0x2627d1;_0x14ef19+=0x1){_0x2e1eb7=_0x17647e[_0x14ef19][_0xebb3('0x3d')]();if(manager[_0xebb3('0x42')](_0x2e1eb7)){manager[_0xebb3('0x43')](_0x2e1eb7);manager[_0xebb3('0x44')](_0x2e1eb7);logger[_0xebb3('0xc')]('delete\x20cron',_0x2e1eb7);}}logger[_0xebb3('0xc')](_0xebb3('0x45'),JSON[_0xebb3('0x24')](_0x131003));for(_0x14ef19=0x0;_0x14ef19<_0x131003['length'];_0x14ef19+=0x1){_0x2e1eb7=_0x131003[_0x14ef19][_0xebb3('0x3d')]();logger[_0xebb3('0xc')](_0xebb3('0x46'),_0x2e1eb7);if(_0x2627d1){logger[_0xebb3('0xc')](_0xebb3('0x47'),_0x2627d1);logger[_0xebb3('0xc')](JSON[_0xebb3('0x24')](_0x490252[_0x2e1eb7]));BPromise['resolve']()[_0xebb3('0x29')](handleJob(_0x490252[_0x2e1eb7]));logger['info'](_0xebb3('0x48'),_0x490252[_0x2e1eb7][_0xebb3('0x13')],_0x490252[_0x2e1eb7][_0xebb3('0x49')]);}else if(_0x490252[_0x2e1eb7][_0xebb3('0x49')]&&_0x490252[_0x2e1eb7][_0xebb3('0x4a')]&&moment()[_0xebb3('0x4b')](_0x490252[_0x2e1eb7][_0xebb3('0x4c')],_0x490252[_0x2e1eb7][_0xebb3('0x4d')])){manager[_0xebb3('0x4e')](_0x2e1eb7,_0x490252[_0x2e1eb7][_0xebb3('0x49')],handleJob(_0x490252[_0x2e1eb7]));manager['start'](_0x2e1eb7);logger[_0xebb3('0xc')](_0xebb3('0x4f'),_0x490252[_0x2e1eb7]['name'],_0x490252[_0x2e1eb7][_0xebb3('0x49')]);}else if(manager['exists'](_0x2e1eb7)){manager[_0xebb3('0x43')](_0x2e1eb7);manager['deleteJob'](_0x2e1eb7);logger[_0xebb3('0xc')]('stop\x20cron',_0x490252[_0x2e1eb7][_0xebb3('0x13')],_0x490252[_0x2e1eb7][_0xebb3('0x49')]);}}for(_0x14ef19=0x0,_0x2e1eb7;_0x14ef19<_0x57e0e5['length']&&!_0x2627d1;_0x14ef19+=0x1){_0x2e1eb7=_0x57e0e5[_0x14ef19][_0xebb3('0x3d')]();if(manager[_0xebb3('0x42')](_0x2e1eb7)){if(_0x490252[_0x2e1eb7][_0xebb3('0x49')]&&_0x490252[_0x2e1eb7][_0xebb3('0x4a')]&&moment()['isBetween'](_0x490252[_0x2e1eb7][_0xebb3('0x4c')],_0x490252[_0x2e1eb7][_0xebb3('0x4d')])){manager[_0xebb3('0x50')](_0x2e1eb7,_0x490252[_0x2e1eb7][_0xebb3('0x49')],handleJob(_0x490252[_0x2e1eb7]));logger[_0xebb3('0xc')]('update\x20cron',_0x490252[_0x2e1eb7][_0xebb3('0x13')],_0x490252[_0x2e1eb7][_0xebb3('0x49')]);}else{manager[_0xebb3('0x43')](_0x2e1eb7);manager[_0xebb3('0x44')](_0x2e1eb7);logger['info'](_0xebb3('0x51'),_0x490252[_0x2e1eb7][_0xebb3('0x13')],_0x490252[_0x2e1eb7]['cron']);}}}})[_0xebb3('0x2c')](function(_0x3510be){logger[_0xebb3('0x2a')](JSON['stringify'](_0x3510be));});}exports[_0xebb3('0x52')]=function(_0x19334a){return getJobs(_0x19334a);};exports[_0xebb3('0x53')]=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 e3c2015..97cdf08 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 _0x9db7=['forEach','push','all','lodash','aws-sdk','request-promise','util','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','sentimentAccountId','sentimentRegion','bucket','Sequelize','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','language','Sentiment\x20Analysis\x20not\x20configured','Negative','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','transcribeAccountId','Transcribe\x20not\x20configured'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x9db7,0x1bf));var _0x79db=function(_0x1592e9,_0x4653c1){_0x1592e9=_0x1592e9-0x0;var _0x1af852=_0x9db7[_0x1592e9];return _0x1af852;};var _=require(_0x79db('0x0'));var AWS=require(_0x79db('0x1'));var rp=require(_0x79db('0x2'));var util=require(_0x79db('0x3'));var BPromise=require('bluebird');var db=require(_0x79db('0x4'))['db'];var logger=require('../../config/logger')(_0x79db('0x5'));function getTranscriptionJob(_0x3a9568,_0x59ad03,_0x12ef88,_0x7abe17){return new Promise(function(_0xfb8328,_0x45c9d1){var _0x7980b1=new AWS[(_0x79db('0x6'))]({'accessKeyId':_0x59ad03,'secretAccessKey':_0x3a9568,'region':_0x12ef88});_0x7980b1[_0x79db('0x7')]({'TranscriptionJobName':_0x7abe17},function(_0x792510,_0x27d02a){if(_0x792510){return _0x45c9d1(_0x792510);}else{return _0xfb8328(_0x27d02a);}});});}function sentiment(_0x2ab279,_0x2c0547,_0x145a31,_0x5d0155,_0x37a537){return new Promise(function(_0x1d277f,_0x5e7ac7){var _0x210573=new AWS[(_0x79db('0x8'))]({'accessKeyId':_0x2c0547,'secretAccessKey':_0x2ab279,'region':_0x145a31});_0x210573[_0x79db('0x9')]({'Text':_0x5d0155,'LanguageCode':_0x37a537[_0x79db('0xa')](0x0,0x2)},function(_0x3edbfe,_0x300851){if(_0x3edbfe){return _0x5e7ac7(_0x3edbfe);}else{return _0x1d277f(_0x300851);}});});}function checkTranscribeJob(_0x561acd,_0x51e061,_0x49b16c){var _0x308f84;return new BPromise(function(_0x4f774e,_0x1cf90a){logger['info'](util[_0x79db('0xb')](_0x79db('0xc'),_0x561acd['id'],_0x561acd[_0x79db('0xd')]));return getTranscriptionJob(_0x49b16c[_0x79db('0xe')],_0x49b16c[_0x79db('0xf')],_0x51e061[_0x79db('0x10')],_0x561acd[_0x79db('0xd')])[_0x79db('0x11')](function(_0xa1cc87){logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x13'),_0x561acd['id'],_0x561acd[_0x79db('0xd')],_0xa1cc87['TranscriptionJob'][_0x79db('0x14')]));if(!_0x561acd[_0x79db('0x15')]){switch(_0xa1cc87[_0x79db('0x16')][_0x79db('0x14')]){case _0x79db('0x17'):var _0x5ba1b4={'transcribeStatus':_0xa1cc87[_0x79db('0x16')][_0x79db('0x14')],'fileUri':_0xa1cc87['TranscriptionJob'][_0x79db('0x18')][_0x79db('0x19')]};logger['info'](util[_0x79db('0xb')](_0x79db('0x1a'),_0x561acd['id']));return rp({'uri':_0xa1cc87[_0x79db('0x16')][_0x79db('0x18')][_0x79db('0x19')],'json':!![]})[_0x79db('0x11')](function(_0x1f48ff){logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x1b'),_0x561acd['id']));if(_0x1f48ff&&_0x1f48ff[_0x79db('0x1c')]&&_0x1f48ff[_0x79db('0x1c')][_0x79db('0x1d')]&&_0x1f48ff[_0x79db('0x1c')][_0x79db('0x1d')]['length']){_0x5ba1b4[_0x79db('0x15')]='';for(var _0x434681=0x0;_0x434681<_0x1f48ff['results']['transcripts'][_0x79db('0x1e')];_0x434681++){_0x5ba1b4[_0x79db('0x15')]+=_0x1f48ff[_0x79db('0x1c')][_0x79db('0x1d')][_0x434681][_0x79db('0x1f')]+'';}}return _0x561acd[_0x79db('0x20')](_0x5ba1b4);})[_0x79db('0x11')](function(){logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x21'),_0x561acd['id']));if(!_0x561acd[_0x79db('0x22')]){throw new db['Sequelize'][(_0x79db('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x51e061['sentiment']||!_0x51e061[_0x79db('0x24')]||!_0x51e061[_0x79db('0x25')]||!_0x51e061['language']||!_0x51e061[_0x79db('0x26')]){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5ba1b4[_0x79db('0x15')]){throw new Error(_0x79db('0x28'));}if(_0x51e061['sentimentAccountId']===_0x49b16c['id']){return _0x49b16c;}else{return db[_0x79db('0x29')][_0x79db('0x2a')]({'where':{'id':_settings[_0x79db('0x24')]}});}})[_0x79db('0x11')](function(_0x4b2157){if(!_0x4b2157){throw new db[(_0x79db('0x27'))]['ValidationError'](_0x79db('0x2b'));}if(!_0x4b2157['data1']||!_0x4b2157[_0x79db('0xf')]){throw new db[(_0x79db('0x27'))]['ValidationError'](_0x79db('0x2c'));}_0x308f84=_0x4b2157;logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x2d'),_0x561acd['id']));return sentiment(_0x308f84[_0x79db('0xe')],_0x308f84[_0x79db('0xf')],_0x51e061[_0x79db('0x25')],_0x5ba1b4[_0x79db('0x15')],_0x51e061['language']);})[_0x79db('0x11')](function(_0x59d8e8){logger['info'](util[_0x79db('0xb')](_0x79db('0x2e'),_0x561acd['id']));return _0x561acd[_0x79db('0x20')]({'sentiment':_0x59d8e8[_0x79db('0x2f')],'sPositive':_0x59d8e8[_0x79db('0x30')][_0x79db('0x31')],'sNegative':_0x59d8e8['SentimentScore']['Negative'],'sMixed':_0x59d8e8[_0x79db('0x30')][_0x79db('0x32')],'sNeutral':_0x59d8e8[_0x79db('0x30')]['Neutral']});})[_0x79db('0x11')](function(){logger['info'](util[_0x79db('0xb')](_0x79db('0x21'),_0x561acd['id']));_0x4f774e();});case _0x79db('0x33'):return _0x561acd[_0x79db('0x20')]({'transcribeStatus':_0x79db('0x33'),'failureReason':_0xa1cc87[_0x79db('0x16')][_0x79db('0x34')]})[_0x79db('0x11')](function(){logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x21'),_0x561acd['id']));_0x4f774e();});default:logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x35'),_0x561acd['id']));break;}}else{return BPromise[_0x79db('0x36')]()[_0x79db('0x11')](function(){if(!_0x561acd[_0x79db('0x22')]){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))](_0x79db('0x37'));}if(!_0x51e061['sentiment']||!_0x51e061[_0x79db('0x24')]||!_0x51e061[_0x79db('0x25')]||!_0x51e061[_0x79db('0x38')]||!_0x51e061[_0x79db('0x26')]){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))](_0x79db('0x39'));}if(!_0x561acd[_0x79db('0x15')]){throw new Error(_0x79db('0x28'));}if(_0x51e061['sentimentAccountId']===_0x49b16c['id']){return _0x49b16c;}else{return db[_0x79db('0x29')]['findOne']({'where':{'id':_settings[_0x79db('0x24')]}});}})[_0x79db('0x11')](function(_0x539b75){if(!_0x539b75){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))](_0x79db('0x2b'));}if(!_0x539b75['data1']||!_0x539b75[_0x79db('0xf')]){throw new db['Sequelize'][(_0x79db('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x308f84=_0x539b75;logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x2d'),_0x561acd['id']));return sentiment(_0x308f84[_0x79db('0xe')],_0x308f84[_0x79db('0xf')],_0x51e061[_0x79db('0x25')],_0x561acd['fileText'],_0x51e061[_0x79db('0x38')]);})[_0x79db('0x11')](function(_0x2eeea9){logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x2e'),_0x561acd['id']));return _0x561acd[_0x79db('0x20')]({'sentiment':_0x2eeea9['Sentiment'],'sPositive':_0x2eeea9[_0x79db('0x30')]['Positive'],'sNegative':_0x2eeea9[_0x79db('0x30')][_0x79db('0x3a')],'sMixed':_0x2eeea9[_0x79db('0x30')]['Mixed'],'sNeutral':_0x2eeea9[_0x79db('0x30')][_0x79db('0x3b')],'transcribeStatus':'COMPLETED'});})[_0x79db('0x11')](function(){logger[_0x79db('0x12')](util[_0x79db('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x561acd['id']));_0x4f774e();});}})[_0x79db('0x3c')](function(_0x7ff6d4){if(_0x7ff6d4){if(!_0x7ff6d4['name']||_0x7ff6d4[_0x79db('0x3d')]!==_0x79db('0x3e')){logger[_0x79db('0x3f')](util[_0x79db('0xb')](_0x79db('0x40'),_0x561acd['id']),util[_0x79db('0x41')](_0x7ff6d4,{'showHidden':![],'depth':null}));}}_0x4f774e();});});}function checkTranscribe(){var _0x1f703e;var _0x15fee2;var _0x9515fc;return db[_0x79db('0x42')][_0x79db('0x43')]({'where':{'transcribeStatus':_0x79db('0x44')}})[_0x79db('0x11')](function(_0x2840be){if(!_0x2840be||!_0x2840be[_0x79db('0x1e')]){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))]('No\x20transcribe\x20job\x20to\x20check');}_0x1f703e=_0x2840be;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x79db('0x11')](function(_0x2a16f9){if(!_0x2a16f9){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))]('Settings\x20not\x20available');}_0x15fee2=_0x2a16f9;if(!_0x15fee2[_0x79db('0x5')]||!_0x15fee2[_0x79db('0x45')]||!_0x15fee2[_0x79db('0x10')]||!_0x15fee2[_0x79db('0x38')]||!_0x15fee2[_0x79db('0x26')]){throw new db['Sequelize'][(_0x79db('0x23'))](_0x79db('0x46'));}return db[_0x79db('0x29')][_0x79db('0x2a')]({'where':{'id':_0x15fee2[_0x79db('0x45')]}});})[_0x79db('0x11')](function(_0x1862f6){if(!_0x1862f6){throw new db[(_0x79db('0x27'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1862f6['data1']||!_0x1862f6[_0x79db('0xf')]){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))](_0x79db('0x2c'));}_0x9515fc=_0x1862f6;var _0x5ed90a=[];_0x1f703e[_0x79db('0x47')](function(_0x4f0a78){_0x5ed90a[_0x79db('0x48')](checkTranscribeJob(_0x4f0a78,_0x15fee2,_0x9515fc));});return BPromise[_0x79db('0x49')](_0x5ed90a);})[_0x79db('0x3c')](function(_0x3ebda4){if(_0x3ebda4){if(!_0x3ebda4['name']||_0x3ebda4[_0x79db('0x3d')]!==_0x79db('0x3e')){logger['error'](util[_0x79db('0x41')](_0x3ebda4,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe706=['VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','all','catch','error','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','transcribeName','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','fileText','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','findOne','Cloud\x20Provider\x20not\x20available','COMPLETED','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect'];(function(_0x2fa199,_0x4f64ff){var _0x1aae5b=function(_0xce02c2){while(--_0xce02c2){_0x2fa199['push'](_0x2fa199['shift']());}};_0x1aae5b(++_0x4f64ff);}(_0xe706,0xa3));var _0x6e70=function(_0x401ccd,_0x140815){_0x401ccd=_0x401ccd-0x0;var _0x5a57ad=_0xe706[_0x401ccd];return _0x5a57ad;};var _=require(_0x6e70('0x0'));var AWS=require(_0x6e70('0x1'));var rp=require(_0x6e70('0x2'));var util=require('util');var BPromise=require(_0x6e70('0x3'));var db=require(_0x6e70('0x4'))['db'];var logger=require(_0x6e70('0x5'))(_0x6e70('0x6'));function getTranscriptionJob(_0x142c27,_0x2164a4,_0x376a8d,_0x506db9){return new Promise(function(_0x1b0389,_0x4381d1){var _0x36357b=new AWS[(_0x6e70('0x7'))]({'accessKeyId':_0x2164a4,'secretAccessKey':_0x142c27,'region':_0x376a8d});_0x36357b[_0x6e70('0x8')]({'TranscriptionJobName':_0x506db9},function(_0x188ed3,_0x3c4843){if(_0x188ed3){return _0x4381d1(_0x188ed3);}else{return _0x1b0389(_0x3c4843);}});});}function sentiment(_0x449b48,_0x954545,_0x25e61c,_0x100eb7,_0x463853){return new Promise(function(_0x743eb5,_0x3f474a){var _0x37b3e0=new AWS[(_0x6e70('0x9'))]({'accessKeyId':_0x954545,'secretAccessKey':_0x449b48,'region':_0x25e61c});_0x37b3e0['detectSentiment']({'Text':_0x100eb7,'LanguageCode':_0x463853['substring'](0x0,0x2)},function(_0x3594c1,_0x15a1a5){if(_0x3594c1){return _0x3f474a(_0x3594c1);}else{return _0x743eb5(_0x15a1a5);}});});}function checkTranscribeJob(_0x18cf27,_0x27dd9b,_0x3b38f3){var _0x310eb7;return new BPromise(function(_0xa1eb74,_0x181005){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x18cf27['id'],_0x18cf27[_0x6e70('0xa')]));return getTranscriptionJob(_0x3b38f3['data1'],_0x3b38f3['data2'],_0x27dd9b[_0x6e70('0xb')],_0x18cf27[_0x6e70('0xa')])['then'](function(_0x24f3ac){logger['info'](util[_0x6e70('0xc')](_0x6e70('0xd'),_0x18cf27['id'],_0x18cf27['transcribeName'],_0x24f3ac['TranscriptionJob'][_0x6e70('0xe')]));if(!_0x18cf27['fileText']){switch(_0x24f3ac[_0x6e70('0xf')][_0x6e70('0xe')]){case'COMPLETED':var _0x497d61={'transcribeStatus':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0xe')],'fileUri':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0x10')][_0x6e70('0x11')]};logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x13'),_0x18cf27['id']));return rp({'uri':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0x10')]['TranscriptFileUri'],'json':!![]})[_0x6e70('0x14')](function(_0x344b65){logger[_0x6e70('0x12')](util['format'](_0x6e70('0x15'),_0x18cf27['id']));if(_0x344b65&&_0x344b65[_0x6e70('0x16')]&&_0x344b65[_0x6e70('0x16')]['transcripts']&&_0x344b65[_0x6e70('0x16')]['transcripts']['length']){_0x497d61['fileText']='';for(var _0x41e352=0x0;_0x41e352<_0x344b65[_0x6e70('0x16')]['transcripts'][_0x6e70('0x17')];_0x41e352++){_0x497d61[_0x6e70('0x18')]+=_0x344b65['results'][_0x6e70('0x19')][_0x41e352][_0x6e70('0x1a')]+'';}}return _0x18cf27[_0x6e70('0x1b')](_0x497d61);})['then'](function(){logger['info'](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));if(!_0x18cf27[_0x6e70('0x1d')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x27dd9b[_0x6e70('0x20')]||!_0x27dd9b[_0x6e70('0x21')]||!_0x27dd9b[_0x6e70('0x22')]||!_0x27dd9b[_0x6e70('0x23')]||!_0x27dd9b[_0x6e70('0x24')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x25'));}if(!_0x497d61[_0x6e70('0x18')]){throw new Error(_0x6e70('0x26'));}if(_0x27dd9b['sentimentAccountId']===_0x3b38f3['id']){return _0x3b38f3;}else{return db[_0x6e70('0x27')]['findOne']({'where':{'id':_settings[_0x6e70('0x21')]}});}})['then'](function(_0xdd7cc1){if(!_0xdd7cc1){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xdd7cc1[_0x6e70('0x28')]||!_0xdd7cc1[_0x6e70('0x29')]){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x2a'));}_0x310eb7=_0xdd7cc1;logger['info'](util[_0x6e70('0xc')](_0x6e70('0x2b'),_0x18cf27['id']));return sentiment(_0x310eb7[_0x6e70('0x28')],_0x310eb7[_0x6e70('0x29')],_0x27dd9b[_0x6e70('0x22')],_0x497d61[_0x6e70('0x18')],_0x27dd9b[_0x6e70('0x23')]);})[_0x6e70('0x14')](function(_0xf146fd){logger[_0x6e70('0x12')](util['format'](_0x6e70('0x2c'),_0x18cf27['id']));return _0x18cf27['update']({'sentiment':_0xf146fd[_0x6e70('0x2d')],'sPositive':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x2f')],'sNegative':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x30')],'sMixed':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x31')],'sNeutral':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x32')]});})[_0x6e70('0x14')](function(){logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));_0xa1eb74();});case'FAILED':return _0x18cf27['update']({'transcribeStatus':'FAILED','failureReason':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0x33')]})[_0x6e70('0x14')](function(){logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));_0xa1eb74();});default:logger['info'](util[_0x6e70('0xc')](_0x6e70('0x34'),_0x18cf27['id']));break;}}else{return BPromise[_0x6e70('0x35')]()[_0x6e70('0x14')](function(){if(!_0x18cf27[_0x6e70('0x1d')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x36'));}if(!_0x27dd9b['sentiment']||!_0x27dd9b[_0x6e70('0x21')]||!_0x27dd9b[_0x6e70('0x22')]||!_0x27dd9b[_0x6e70('0x23')]||!_0x27dd9b[_0x6e70('0x24')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x25'));}if(!_0x18cf27['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x27dd9b['sentimentAccountId']===_0x3b38f3['id']){return _0x3b38f3;}else{return db[_0x6e70('0x27')][_0x6e70('0x37')]({'where':{'id':_settings[_0x6e70('0x21')]}});}})[_0x6e70('0x14')](function(_0x45c83a){if(!_0x45c83a){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x38'));}if(!_0x45c83a[_0x6e70('0x28')]||!_0x45c83a['data2']){throw new db['Sequelize']['ValidationError'](_0x6e70('0x2a'));}_0x310eb7=_0x45c83a;logger['info'](util[_0x6e70('0xc')](_0x6e70('0x2b'),_0x18cf27['id']));return sentiment(_0x310eb7[_0x6e70('0x28')],_0x310eb7[_0x6e70('0x29')],_0x27dd9b['sentimentRegion'],_0x18cf27[_0x6e70('0x18')],_0x27dd9b['language']);})[_0x6e70('0x14')](function(_0x1e9b06){logger[_0x6e70('0x12')](util[_0x6e70('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x18cf27['id']));return _0x18cf27[_0x6e70('0x1b')]({'sentiment':_0x1e9b06[_0x6e70('0x2d')],'sPositive':_0x1e9b06[_0x6e70('0x2e')][_0x6e70('0x2f')],'sNegative':_0x1e9b06[_0x6e70('0x2e')][_0x6e70('0x30')],'sMixed':_0x1e9b06[_0x6e70('0x2e')]['Mixed'],'sNeutral':_0x1e9b06[_0x6e70('0x2e')][_0x6e70('0x32')],'transcribeStatus':_0x6e70('0x39')});})[_0x6e70('0x14')](function(){logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));_0xa1eb74();});}})['catch'](function(_0x3f5c89){if(_0x3f5c89){if(!_0x3f5c89['name']||_0x3f5c89[_0x6e70('0x3a')]!==_0x6e70('0x3b')){logger['error'](util['format'](_0x6e70('0x3c'),_0x18cf27['id']),util[_0x6e70('0x3d')](_0x3f5c89,{'showHidden':![],'depth':null}));}}_0xa1eb74();});});}function checkTranscribe(){var _0x18fa40;var _0x587f04;var _0x4af9b1;return db[_0x6e70('0x3e')][_0x6e70('0x3f')]({'where':{'transcribeStatus':_0x6e70('0x40')}})[_0x6e70('0x14')](function(_0x2e25d5){if(!_0x2e25d5||!_0x2e25d5[_0x6e70('0x17')]){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x41'));}_0x18fa40=_0x2e25d5;return db[_0x6e70('0x42')][_0x6e70('0x37')]({'where':{'id':0x1}});})[_0x6e70('0x14')](function(_0x4b354e){if(!_0x4b354e){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x43'));}_0x587f04=_0x4b354e;if(!_0x587f04[_0x6e70('0x6')]||!_0x587f04[_0x6e70('0x44')]||!_0x587f04[_0x6e70('0xb')]||!_0x587f04['language']||!_0x587f04[_0x6e70('0x24')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x45'));}return db[_0x6e70('0x27')]['findOne']({'where':{'id':_0x587f04[_0x6e70('0x44')]}});})[_0x6e70('0x14')](function(_0x2c20d3){if(!_0x2c20d3){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x38'));}if(!_0x2c20d3['data1']||!_0x2c20d3[_0x6e70('0x29')]){throw new db[(_0x6e70('0x1e'))]['ValidationError'](_0x6e70('0x2a'));}_0x4af9b1=_0x2c20d3;var _0xebe5f7=[];_0x18fa40['forEach'](function(_0x3cfaa9){_0xebe5f7[_0x6e70('0x46')](checkTranscribeJob(_0x3cfaa9,_0x587f04,_0x4af9b1));});return BPromise[_0x6e70('0x47')](_0xebe5f7);})[_0x6e70('0x48')](function(_0xfcadfe){if(_0xfcadfe){if(!_0xfcadfe['name']||_0xfcadfe[_0x6e70('0x3a')]!==_0x6e70('0x3b')){logger[_0x6e70('0x49')](util[_0x6e70('0x3d')](_0xfcadfe,{'showHidden':![],'depth':null}));}}});}exports[_0x6e70('0x4a')]=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 11e5aea..8869993 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 _0xef0a=['join','update','system','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:'];(function(_0x1c4cd1,_0x447f9d){var _0x53e576=function(_0x57e80b){while(--_0x57e80b){_0x1c4cd1['push'](_0x1c4cd1['shift']());}};_0x53e576(++_0x447f9d);}(_0xef0a,0xdd));var _0xaef0=function(_0x5891d0,_0x375acf){_0x5891d0=_0x5891d0-0x0;var _0x42ace1=_0xef0a[_0x5891d0];return _0x42ace1;};'use strict';var _=require(_0xaef0('0x0'));var moment=require(_0xaef0('0x1'));var Redis=require(_0xaef0('0x2'));var util=require(_0xaef0('0x3'));var config=require(_0xaef0('0x4'));var db=require(_0xaef0('0x5'))['db'];var logger=require(_0xaef0('0x6'))(_0xaef0('0x7'));config[_0xaef0('0x8')]=_[_0xaef0('0x9')](config[_0xaef0('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xaef0('0xa'))(new Redis(config[_0xaef0('0x8')]));function closeInteractions(){var _0x273fae=[];return db[_0xaef0('0xb')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xaef0('0xc')](0x18,_0xaef0('0xd'))}}})[_0xaef0('0xe')](function(_0x280d93){if(_0x280d93&&_0x280d93[_0xaef0('0xf')]){_0x273fae=_[_0xaef0('0x10')](_0x280d93||[],'id');logger[_0xaef0('0x11')](_0xaef0('0x12'),_0x273fae[_0xaef0('0x13')]());return db['WhatsappInteraction'][_0xaef0('0x14')]({'closeReason':_0xaef0('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xaef0('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x273fae}});}})['then'](function(){if(_0x273fae&&_0x273fae[_0xaef0('0xf')]){logger[_0xaef0('0x11')](_0xaef0('0x17'),_0x273fae[_0xaef0('0x13')]());for(var _0x20e24e=0x0;_0x20e24e<_0x273fae[_0xaef0('0xf')];_0x20e24e++){io[_0xaef0('0x18')](_0xaef0('0x19'),{'id':_0x273fae[_0x20e24e],'closed':!![]});}}})[_0xaef0('0x1a')](function(_0x426e82){logger[_0xaef0('0x1b')](_0xaef0('0x1c'),_0x426e82?util[_0xaef0('0x1d')](_0x426e82,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x194e=['info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','join','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','then','length','map'];(function(_0x2795d9,_0x1cb1af){var _0x1c7d47=function(_0x5b4e44){while(--_0x5b4e44){_0x2795d9['push'](_0x2795d9['shift']());}};_0x1c7d47(++_0x1cb1af);}(_0x194e,0x1a2));var _0xe194=function(_0x33880f,_0x39c554){_0x33880f=_0x33880f-0x0;var _0x69d7a2=_0x194e[_0x33880f];return _0x69d7a2;};'use strict';var _=require(_0xe194('0x0'));var moment=require(_0xe194('0x1'));var Redis=require(_0xe194('0x2'));var util=require(_0xe194('0x3'));var config=require('../../config/environment');var db=require(_0xe194('0x4'))['db'];var logger=require('../logger')('schedule');config[_0xe194('0x5')]=_[_0xe194('0x6')](config[_0xe194('0x5')],{'host':_0xe194('0x7'),'port':0x18eb});var io=require(_0xe194('0x8'))(new Redis(config[_0xe194('0x5')]));function closeInteractions(){var _0x3841ab=[];return db[_0xe194('0x9')][_0xe194('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})[_0xe194('0xb')](function(_0x23cdd7){if(_0x23cdd7&&_0x23cdd7[_0xe194('0xc')]){_0x3841ab=_[_0xe194('0xd')](_0x23cdd7||[],'id');logger[_0xe194('0xe')](_0xe194('0xf'),_0x3841ab['join']());return db[_0xe194('0x9')][_0xe194('0x10')]({'closeReason':'system','disposition':_0xe194('0x11'),'closed':!![],'closedAt':moment()[_0xe194('0x12')](_0xe194('0x13'))},{'where':{'id':_0x3841ab}});}})[_0xe194('0xb')](function(){if(_0x3841ab&&_0x3841ab['length']){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x3841ab[_0xe194('0x14')]());for(var _0x548087=0x0;_0x548087<_0x3841ab['length'];_0x548087++){io[_0xe194('0x15')](_0xe194('0x16'),{'id':_0x3841ab[_0x548087],'closed':!![]});}}})['catch'](function(_0x2ceac5){logger[_0xe194('0x17')](_0xe194('0x18'),_0x2ceac5?util[_0xe194('0x19')](_0x2ceac5,{'showHidden':![],'depth':null}):'');});}exports[_0xe194('0x1a')]=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 608d743..c0ccd53 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61ef=['destroy','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','CmContact','bulkCreate','then','log','contacts1','CmHopper'];(function(_0x3bafe6,_0x3432b7){var _0x30bc43=function(_0x1e8389){while(--_0x1e8389){_0x3bafe6['push'](_0x3bafe6['shift']());}};_0x30bc43(++_0x3432b7);}(_0x61ef,0x149));var _0xf61e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x61ef[_0x4ae6ef];return _0x3cbb4e;};'use strict';var util=require(_0xf61e('0x0'));var db=require(_0xf61e('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf61e('0x2')]({'id':i,'firstName':_0xf61e('0x3')+i,'lastName':_0xf61e('0x4')+i,'phone':0xf879fb460+i,'email':_0xf61e('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xf61e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf61e('0x6')](),'updatedAt':Date[_0xf61e('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xf61e('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf61e('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xf61e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf61e('0x6')](),'updatedAt':Date[_0xf61e('0x6')]()});}db['CmContact']['destroy']({'where':{}})['then'](function(){return db[_0xf61e('0x7')][_0xf61e('0x8')](contacts);})[_0xf61e('0x9')](function(){console[_0xf61e('0xa')]('finished\x20populating',_0xf61e('0xb'));return db[_0xf61e('0xc')][_0xf61e('0xd')]({'where':{}});})['then'](function(){return db[_0xf61e('0xc')][_0xf61e('0x8')](hopper);})[_0xf61e('0x9')](function(){console['log'](_0xf61e('0xe'),_0xf61e('0xf'));return db[_0xf61e('0x7')][_0xf61e('0x8')](contacts2);})[_0xf61e('0x9')](function(){console['log']('finished\x20populating',_0xf61e('0x10'));return db['CmHopper'][_0xf61e('0x8')](hopper2);})[_0xf61e('0x9')](function(){console['log'](_0xf61e('0xe'),_0xf61e('0x11'));})[_0xf61e('0x12')](function(_0x5eda4b){console[_0xf61e('0xa')](_0x5eda4b);}); \ No newline at end of file +var _0x413f=['../mysqldb','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','CmContact','then','log','destroy','CmHopper','bulkCreate','finished\x20populating','contacts2','catch','util'];(function(_0x400766,_0x368660){var _0x3ae58b=function(_0x4c6a6e){while(--_0x4c6a6e){_0x400766['push'](_0x400766['shift']());}};_0x3ae58b(++_0x368660);}(_0x413f,0x197));var _0xf413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x413f[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0xf413('0x0'));var db=require(_0xf413('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xf413('0x2')+i,'phone':0xf879fb460+i,'email':_0xf413('0x3')+i+_0xf413('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xf413('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xf413('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf413('0x6')](),'updatedAt':Date[_0xf413('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xf413('0x7')+i,'lastName':_0xf413('0x2')+i,'phone':0xf879fb460+i,'email':_0xf413('0x3')+i+_0xf413('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf413('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xf413('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xf413('0x6')]()});}db[_0xf413('0x8')]['destroy']({'where':{}})[_0xf413('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})[_0xf413('0x9')](function(){console[_0xf413('0xa')]('finished\x20populating','contacts1');return db['CmHopper'][_0xf413('0xb')]({'where':{}});})[_0xf413('0x9')](function(){return db[_0xf413('0xc')][_0xf413('0xd')](hopper);})[_0xf413('0x9')](function(){console[_0xf413('0xa')](_0xf413('0xe'),'hopper1');return db[_0xf413('0x8')][_0xf413('0xd')](contacts2);})[_0xf413('0x9')](function(){console[_0xf413('0xa')](_0xf413('0xe'),_0xf413('0xf'));return db[_0xf413('0xc')][_0xf413('0xd')](hopper2);})[_0xf413('0x9')](function(){console[_0xf413('0xa')](_0xf413('0xe'),'hopper2');})[_0xf413('0x10')](function(_0x503cb2){console[_0xf413('0xa')](_0x503cb2);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 6b816e2..7573965 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9f9=['%s%s','friend','udp','wss','all','format','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','agent'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xa9f9,0x153));var _0x9a9f=function(_0x16549e,_0x909b52){_0x16549e=_0x16549e-0x0;var _0x44c1e4=_0xa9f9[_0x16549e];return _0x44c1e4;};'use strict';var util=require(_0x9a9f('0x0'));var db=require(_0x9a9f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s',_0x9a9f('0x2'),i),'fullname':util['format'](_0x9a9f('0x3'),_0x9a9f('0x2'),i),'email':util['format']('%s%s@xcally.com',_0x9a9f('0x2'),i),'role':_0x9a9f('0x2'),'password':'password','internal':0xfa0+i,'type':_0x9a9f('0x4'),'transport':[_0x9a9f('0x5'),'ws',_0x9a9f('0x6')],'disallow':[_0x9a9f('0x7')],'allow':['ulaw'],'defaultuser':util[_0x9a9f('0x8')]('%s%s',_0x9a9f('0x2'),i),'encryption':_0x9a9f('0x9'),'avpf':_0x9a9f('0x9'),'force_avp':'yes','icesupport':_0x9a9f('0x9'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x9a9f('0xa'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x9a9f('0xb'),'callerid':util[_0x9a9f('0x8')](_0x9a9f('0xc'),util[_0x9a9f('0x8')](_0x9a9f('0x3'),_0x9a9f('0x2'),i),0xfa0+i)});}db['User'][_0x9a9f('0xd')](users)[_0x9a9f('0xe')](function(){console[_0x9a9f('0xf')](_0x9a9f('0x10'));})[_0x9a9f('0x11')](function(_0x467444){console[_0x9a9f('0xf')](_0x467444);}); \ No newline at end of file +var _0x88fb=['log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate','then'];(function(_0x4f46f1,_0x2a39b9){var _0x5e146b=function(_0x5aed22){while(--_0x5aed22){_0x4f46f1['push'](_0x4f46f1['shift']());}};_0x5e146b(++_0x2a39b9);}(_0x88fb,0x13e));var _0xb88f=function(_0x23ed97,_0x58f926){_0x23ed97=_0x23ed97-0x0;var _0x1bcaf5=_0x88fb[_0x23ed97];return _0x1bcaf5;};'use strict';var util=require(_0xb88f('0x0'));var db=require(_0xb88f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb88f('0x2')]({'name':util[_0xb88f('0x3')]('%s%s','agent',i),'fullname':util['format'](_0xb88f('0x4'),_0xb88f('0x5'),i),'email':util[_0xb88f('0x3')](_0xb88f('0x6'),_0xb88f('0x5'),i),'role':_0xb88f('0x5'),'password':_0xb88f('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0xb88f('0x8'),'ws',_0xb88f('0x9')],'disallow':[_0xb88f('0xa')],'allow':[_0xb88f('0xb')],'defaultuser':util[_0xb88f('0x3')](_0xb88f('0x4'),_0xb88f('0x5'),i),'encryption':_0xb88f('0xc'),'avpf':_0xb88f('0xc'),'force_avp':_0xb88f('0xc'),'icesupport':_0xb88f('0xc'),'dtlsenable':_0xb88f('0xc'),'dtlsverify':'no','dtlscertfile':_0xb88f('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util['format'](_0xb88f('0xe'),util['format'](_0xb88f('0x4'),_0xb88f('0x5'),i),0xfa0+i)});}db[_0xb88f('0xf')][_0xb88f('0x10')](users)[_0xb88f('0x11')](function(){console[_0xb88f('0x12')](_0xb88f('0x13'));})[_0xb88f('0x14')](function(_0x1b9c8a){console[_0xb88f('0x12')](_0x1b9c8a);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 06ec526..881272d 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8101=['telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','role','format','%s:queue:%s','length','user:%s','handshake','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','VoiceQueue','SmsQueues','MailQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','voice','chat','fax','sms','mail','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x8101,0xc0));var _0x1810=function(_0x357a01,_0x1e57d0){_0x357a01=_0x357a01-0x0;var _0x252c1f=_0x8101[_0x357a01];return _0x252c1f;};'use strict';var _=require(_0x1810('0x0'));var util=require(_0x1810('0x1'));var BPromise=require(_0x1810('0x2'));var db=require(_0x1810('0x3'))['db'];var config=require(_0x1810('0x4'));var queryQueues={'attributes':['id',_0x1810('0x5')],'include':[{'as':_0x1810('0x6'),'model':db[_0x1810('0x7')],'attributes':['id',_0x1810('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1810('0x5')],'where':{'role':_0x1810('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x1810('0x5')],'where':{'role':_0x1810('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1810('0x5'),_0x1810('0xa')],'where':{'type':_0x1810('0xb')}};function getAssociatedResources(_0x271738,_0x197255,_0x2dde85){return db[_0x1810('0xc')][_0x1810('0xd')]({'where':{'name':_0x271738,'userProfileId':_0x197255},'raw':!![]})[_0x1810('0xe')](function(_0x5126d2){if(_0x5126d2){if(_0x5126d2[_0x1810('0xf')]){switch(_0x271738){case _0x1810('0x10'):case'ChatQueues':case _0x1810('0x11'):case'SmsQueues':case'MailQueues':case _0x1810('0x12'):case _0x1810('0x13'):return db[_0x2dde85][_0x1810('0x14')](queryQueues);case _0x1810('0x15'):return db[_0x2dde85][_0x1810('0x14')](queryTelephones);case _0x1810('0x16'):return db[_0x2dde85]['findAll'](queryTrunks);case _0x1810('0x17'):return db[_0x2dde85][_0x1810('0x14')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x1810('0x18')],'where':{'sectionId':_0x5126d2['id']},'raw':!![]})['then'](function(_0x187dca){if(_0x187dca){var _0xbdebf5={'where':{'id':_[_0x1810('0x19')](_0x187dca,_0x1810('0x18'))},'raw':!![]};switch(_0x2dde85){case _0x1810('0x7'):_0xbdebf5[_0x1810('0x1a')][_0x1810('0x1b')]='telephone';break;case'Campaign':_0xbdebf5['where'][_0x1810('0xa')]='ivr';break;}return db[_0x2dde85][_0x1810('0x14')](_0xbdebf5);}else{return[];}});}}else{return[];}})[_0x1810('0xe')](function(_0x3876b0){return _0x3876b0;});}function joinOrLeaveQueues(_0x27c51b,_0x57477e,_0x1490c3,_0x5c8c36){_0x27c51b[_0x57477e](util[_0x1810('0x1c')](_0x1810('0x1d'),_0x1490c3,_0x5c8c36['name']));if(_0x5c8c36[_0x1810('0x6')]){for(var _0x42672f=0x0;_0x42672f<_0x5c8c36[_0x1810('0x6')][_0x1810('0x1e')];_0x42672f+=0x1){_0x27c51b[_0x57477e](util[_0x1810('0x1c')](_0x1810('0x1f'),_0x5c8c36['Agents'][_0x42672f][_0x1810('0x5')]));}}}function joinOrLeave(_0x198bbc,_0x254062,_0x77b5ed){var _0x53ca63;if(_0x198bbc[_0x1810('0x20')]['query']['id']){db['User'][_0x1810('0x21')]({'attributes':['id',_0x1810('0x5'),_0x1810('0x1b'),_0x1810('0x22')],'where':{'id':_0x198bbc[_0x1810('0x20')]['query']['id']},'include':[{'model':db[_0x1810('0x23')],'as':_0x1810('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x1810('0x25')],'as':_0x1810('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1810('0x27')],'as':_0x1810('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x1810('0x29')],'as':_0x1810('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x1810('0x2b')],'as':_0x1810('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x1810('0xe')](function(_0x3e122b){if(_0x3e122b){_0x53ca63=_0x3e122b;_0x198bbc[_0x254062](util[_0x1810('0x1c')](_0x1810('0x1f'),_0x3e122b[_0x1810('0x5')]));var _0x223638=[];switch(_0x3e122b[_0x1810('0x1b')]){case'admin':_0x198bbc[_0x254062](_0x1810('0x2d'));_0x198bbc[_0x254062](_0x1810('0x2e'));if(queryQueues[_0x1810('0x2f')](_0x1810('0x30'))){delete queryQueues[_0x1810('0x30')];}_0x223638[_0x1810('0x31')](db['VoiceQueue'][_0x1810('0x14')](queryQueues));_0x223638[_0x1810('0x31')](db[_0x1810('0x32')][_0x1810('0x14')](queryQueues));_0x223638[_0x1810('0x31')](db['FaxQueue'][_0x1810('0x14')](queryQueues));_0x223638[_0x1810('0x31')](db[_0x1810('0x33')]['findAll'](queryQueues));_0x223638[_0x1810('0x31')](db[_0x1810('0x34')][_0x1810('0x14')](queryQueues));_0x223638[_0x1810('0x31')](db[_0x1810('0x35')][_0x1810('0x14')](queryQueues));_0x223638[_0x1810('0x31')](db[_0x1810('0x36')][_0x1810('0x14')](queryQueues));_0x223638[_0x1810('0x31')](db[_0x1810('0x7')][_0x1810('0x14')](queryTelephones));_0x223638[_0x1810('0x31')](db[_0x1810('0x37')][_0x1810('0x14')](queryTrunks));_0x223638['push'](db[_0x1810('0x38')]['findAll'](queryCampaigns));_0x223638['push'](db[_0x1810('0x7')][_0x1810('0x14')](queryAgents));break;case'user':_0x198bbc[_0x254062](_0x1810('0x2d'));_0x198bbc[_0x254062](_0x1810('0x2e'));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x10'),_0x3e122b[_0x1810('0x22')],_0x1810('0x39')));_0x223638[_0x1810('0x31')](getAssociatedResources('ChatQueues',_0x3e122b[_0x1810('0x22')],_0x1810('0x32')));_0x223638['push'](getAssociatedResources('FaxQueues',_0x3e122b[_0x1810('0x22')],'FaxQueue'));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x3a'),_0x3e122b[_0x1810('0x22')],_0x1810('0x33')));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x3b'),_0x3e122b[_0x1810('0x22')],_0x1810('0x34')));_0x223638[_0x1810('0x31')](getAssociatedResources('OpenchannelQueues',_0x3e122b[_0x1810('0x22')],'OpenchannelQueue'));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x13'),_0x3e122b[_0x1810('0x22')],_0x1810('0x36')));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x15'),_0x3e122b[_0x1810('0x22')],_0x1810('0x7')));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x16'),_0x3e122b['userProfileId'],_0x1810('0x37')));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x17'),_0x3e122b['userProfileId'],_0x1810('0x38')));_0x223638[_0x1810('0x31')](db[_0x1810('0x7')][_0x1810('0x14')](queryAgents));break;case _0x1810('0x9'):_0x198bbc[_0x254062](_0x1810('0x2d'));_0x198bbc[_0x254062]('voice:outbound');_0x223638[_0x1810('0x31')](_0x3e122b[_0x1810('0x3c')]({'attributes':['id',_0x1810('0x5')]}));_0x223638[_0x1810('0x31')](_0x3e122b[_0x1810('0x3d')]({'attributes':['id','name']}));_0x223638[_0x1810('0x31')](_0x3e122b[_0x1810('0x3e')]({'attributes':['id',_0x1810('0x5')]}));_0x223638[_0x1810('0x31')](_0x3e122b[_0x1810('0x3f')]({'attributes':['id',_0x1810('0x5')]}));_0x223638[_0x1810('0x31')](_0x3e122b[_0x1810('0x40')]({'attributes':['id',_0x1810('0x5')]}));_0x223638[_0x1810('0x31')](_0x3e122b[_0x1810('0x41')]({'attributes':['id','name']}));_0x223638[_0x1810('0x31')](_0x3e122b['getWhatsappQueues']({'attributes':['id',_0x1810('0x5')]}));break;}return BPromise['all'](_0x223638);}})[_0x1810('0xe')](function(_0x18b946){if(_0x18b946&&_0x18b946[_0x1810('0x1e')]){for(var _0x2f3c21=0x0;_0x2f3c21<_0x18b946[_0x1810('0x1e')];_0x2f3c21+=0x1){for(var _0x9446e9=0x0;_0x9446e9<_0x18b946[_0x2f3c21][_0x1810('0x1e')];_0x9446e9+=0x1){switch(_0x2f3c21){case 0x0:joinOrLeaveQueues(_0x198bbc,_0x254062,_0x1810('0x42'),_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x1:joinOrLeaveQueues(_0x198bbc,_0x254062,_0x1810('0x43'),_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x2:joinOrLeaveQueues(_0x198bbc,_0x254062,_0x1810('0x44'),_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x3:joinOrLeaveQueues(_0x198bbc,_0x254062,_0x1810('0x45'),_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x4:joinOrLeaveQueues(_0x198bbc,_0x254062,_0x1810('0x46'),_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x5:joinOrLeaveQueues(_0x198bbc,_0x254062,'openchannel',_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x6:joinOrLeaveQueues(_0x198bbc,_0x254062,'whatsapp',_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x7:if(_0x53ca63[_0x1810('0x1b')]!=='agent')_0x198bbc[_0x254062](util[_0x1810('0x1c')](_0x1810('0x47'),_0x18b946[_0x2f3c21][_0x9446e9]['name']));break;case 0x8:if(_0x53ca63['role']!==_0x1810('0x9'))_0x198bbc[_0x254062](util[_0x1810('0x1c')](_0x1810('0x48'),_0x18b946[_0x2f3c21][_0x9446e9][_0x1810('0x5')]));break;case 0x9:if(_0x53ca63[_0x1810('0x1b')]!=='agent')_0x198bbc[_0x254062](util[_0x1810('0x1c')](_0x1810('0x49'),_0x18b946[_0x2f3c21][_0x9446e9][_0x1810('0xa')],_0x18b946[_0x2f3c21][_0x9446e9][_0x1810('0x5')]));break;case 0xa:_0x198bbc[_0x254062](util[_0x1810('0x1c')](_0x1810('0x1f'),_0x18b946[_0x2f3c21][_0x9446e9][_0x1810('0x5')]));break;}}}}})[_0x1810('0xe')](function(){if(_0x254062===_0x1810('0x4a')){var _0x3eff89=_[_0x1810('0x19')](_0x53ca63['ChatInteractions'],'id');return _0x53ca63[_0x1810('0x4b')](_0x3eff89)[_0x1810('0xe')](function(){for(var _0x236aaa=0x0;_0x236aaa<_0x3eff89[_0x1810('0x1e')];_0x236aaa+=0x1){_0x77b5ed['emit'](_0x1810('0x4c'),{'ChatInteractionId':Number(_0x3eff89[_0x236aaa]),'UserId':Number(_0x53ca63['id'])});}});}})[_0x1810('0xe')](function(){if(_0x254062==='leave'){var _0x8b722e=_['map'](_0x53ca63['MailInteractions'],'id');return _0x53ca63[_0x1810('0x4d')](_0x8b722e)['then'](function(){for(var _0x4207c4=0x0;_0x4207c4<_0x8b722e[_0x1810('0x1e')];_0x4207c4+=0x1){_0x77b5ed[_0x1810('0x4e')](_0x1810('0x4f'),{'MailInteractionId':Number(_0x8b722e[_0x4207c4]),'UserId':Number(_0x53ca63['id'])});}});}})[_0x1810('0xe')](function(){if(_0x254062===_0x1810('0x4a')){var _0x20eba4=_[_0x1810('0x19')](_0x53ca63[_0x1810('0x50')],'id');return _0x53ca63[_0x1810('0x51')](_0x20eba4)[_0x1810('0xe')](function(){for(var _0x4a71a8=0x0;_0x4a71a8<_0x20eba4['length'];_0x4a71a8+=0x1){_0x77b5ed['emit'](_0x1810('0x52'),{'FaxInteractionId':Number(_0x20eba4[_0x4a71a8]),'UserId':Number(_0x53ca63['id'])});}});}})[_0x1810('0xe')](function(){if(_0x254062===_0x1810('0x4a')){var _0x53bec7=_[_0x1810('0x19')](_0x53ca63[_0x1810('0x28')],'id');return _0x53ca63['removeSmsInteractions'](_0x53bec7)[_0x1810('0xe')](function(){for(var _0x2a9cd0=0x0;_0x2a9cd0<_0x53bec7[_0x1810('0x1e')];_0x2a9cd0+=0x1){_0x77b5ed['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x53bec7[_0x2a9cd0]),'UserId':Number(_0x53ca63['id'])});}});}})[_0x1810('0xe')](function(){if(_0x254062===_0x1810('0x4a')){var _0x4590c7=_[_0x1810('0x19')](_0x53ca63[_0x1810('0x2a')],'id');return _0x53ca63['removeOpenchannelInteractions'](_0x4590c7)[_0x1810('0xe')](function(){for(var _0x528355=0x0;_0x528355<_0x4590c7[_0x1810('0x1e')];_0x528355+=0x1){_0x77b5ed['emit'](_0x1810('0x53'),{'OpenchannelInteractionId':Number(_0x4590c7[_0x528355]),'UserId':Number(_0x53ca63['id'])});}});}})[_0x1810('0xe')](function(){if(_0x254062==='leave'){var _0xd81b16=_['map'](_0x53ca63[_0x1810('0x2c')],'id');return _0x53ca63[_0x1810('0x54')](_0xd81b16)[_0x1810('0xe')](function(){for(var _0x4638d2=0x0;_0x4638d2<_0xd81b16[_0x1810('0x1e')];_0x4638d2+=0x1){_0x77b5ed['emit'](_0x1810('0x55'),{'WhatsappInteractionId':Number(_0xd81b16[_0x4638d2]),'UserId':Number(_0x53ca63['id'])});}});}})[_0x1810('0x56')](function(_0x5a5798){_0x198bbc[_0x1810('0x57')](_0x5a5798);});}}function onDisconnect(_0x5e8b6f,_0x59f35c){joinOrLeave(_0x5e8b6f,_0x1810('0x4a'),_0x59f35c);}function onConnect(_0x116287){joinOrLeave(_0x116287,_0x1810('0x58'));}exports[_0x1810('0x59')]=function(_0x4dfae2){_0x4dfae2['on'](_0x1810('0x5a'),function(_0xb99fa0){_0xb99fa0['setMaxListeners'](0x0);_0xb99fa0[_0x1810('0x5b')]=_0xb99fa0[_0x1810('0x5c')][_0x1810('0x5a')][_0x1810('0x5d')]+':'+_0xb99fa0[_0x1810('0x5c')][_0x1810('0x5a')][_0x1810('0x5e')];_0xb99fa0[_0x1810('0x5f')]=new Date();_0xb99fa0[_0x1810('0x57')]=function(_0x41eaef){console[_0x1810('0x57')](_0x1810('0x60')+_0xb99fa0[_0x1810('0x61')][_0x1810('0x5')]+'['+_0xb99fa0[_0x1810('0x5b')]+']',_0x41eaef);};_0xb99fa0['on']('disconnect',function(){onDisconnect(_0xb99fa0,_0x4dfae2);_0xb99fa0[_0x1810('0x57')](_0x1810('0x62'));});onConnect(_0xb99fa0);_0xb99fa0[_0x1810('0x57')](_0x1810('0x63'));});}; \ No newline at end of file +var _0xb7ae=['getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','where','role','format','%s:queue:%s','user:%s','query','find','userProfileId','handshake','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Campaign','user','VoiceQueue','ChatQueues','MailQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x29e6de,_0xdc5364){_0x29e6de=_0x29e6de-0x0;var _0x2eeb24=_0xb7ae[_0x29e6de];return _0x2eeb24;};'use strict';var _=require(_0xeb7a('0x0'));var util=require(_0xeb7a('0x1'));var BPromise=require(_0xeb7a('0x2'));var db=require(_0xeb7a('0x3'))['db'];var config=require(_0xeb7a('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xeb7a('0x5'),'model':db[_0xeb7a('0x6')],'attributes':['id',_0xeb7a('0x7'),'role'],'raw':!![],'where':{'role':_0xeb7a('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xeb7a('0x7')],'where':{'role':_0xeb7a('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xeb7a('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0xeb7a('0x7')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xeb7a('0x7'),_0xeb7a('0xa')],'where':{'type':_0xeb7a('0xb')}};function getAssociatedResources(_0x4f5024,_0x2f42a5,_0x4243b5){return db[_0xeb7a('0xc')][_0xeb7a('0xd')]({'where':{'name':_0x4f5024,'userProfileId':_0x2f42a5},'raw':!![]})[_0xeb7a('0xe')](function(_0x275d58){if(_0x275d58){if(_0x275d58[_0xeb7a('0xf')]){switch(_0x4f5024){case'VoiceQueues':case'ChatQueues':case _0xeb7a('0x10'):case _0xeb7a('0x11'):case _0xeb7a('0x12'):case _0xeb7a('0x13'):case _0xeb7a('0x14'):return db[_0x4243b5][_0xeb7a('0x15')](queryQueues);case _0xeb7a('0x16'):return db[_0x4243b5]['findAll'](queryTelephones);case _0xeb7a('0x17'):return db[_0x4243b5][_0xeb7a('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x4243b5][_0xeb7a('0x15')](queryCampaigns);}}else{return db[_0xeb7a('0x18')]['findAll']({'attributes':[_0xeb7a('0x19')],'where':{'sectionId':_0x275d58['id']},'raw':!![]})['then'](function(_0x5d953f){if(_0x5d953f){var _0x388666={'where':{'id':_['map'](_0x5d953f,'resourceId')},'raw':!![]};switch(_0x4243b5){case _0xeb7a('0x6'):_0x388666[_0xeb7a('0x1a')][_0xeb7a('0x1b')]=_0xeb7a('0x9');break;case'Campaign':_0x388666['where'][_0xeb7a('0xa')]=_0xeb7a('0xb');break;}return db[_0x4243b5]['findAll'](_0x388666);}else{return[];}});}}else{return[];}})['then'](function(_0x326e81){return _0x326e81;});}function joinOrLeaveQueues(_0x25a399,_0x47b62c,_0x268a17,_0x302e41){_0x25a399[_0x47b62c](util[_0xeb7a('0x1c')](_0xeb7a('0x1d'),_0x268a17,_0x302e41[_0xeb7a('0x7')]));if(_0x302e41['Agents']){for(var _0x431d4a=0x0;_0x431d4a<_0x302e41[_0xeb7a('0x5')]['length'];_0x431d4a+=0x1){_0x25a399[_0x47b62c](util['format'](_0xeb7a('0x1e'),_0x302e41[_0xeb7a('0x5')][_0x431d4a][_0xeb7a('0x7')]));}}}function joinOrLeave(_0x4023e2,_0x29db91,_0x44cefc){var _0xfb62a5;if(_0x4023e2['handshake'][_0xeb7a('0x1f')]['id']){db[_0xeb7a('0x6')][_0xeb7a('0x20')]({'attributes':['id','name',_0xeb7a('0x1b'),_0xeb7a('0x21')],'where':{'id':_0x4023e2[_0xeb7a('0x22')][_0xeb7a('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xeb7a('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xeb7a('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xeb7a('0x25')],'as':_0xeb7a('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xeb7a('0x27')],'as':_0xeb7a('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xeb7a('0x29')],'as':_0xeb7a('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xeb7a('0x2b')],'as':_0xeb7a('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xeb7a('0xe')](function(_0x2d2f9f){if(_0x2d2f9f){_0xfb62a5=_0x2d2f9f;_0x4023e2[_0x29db91](util['format'](_0xeb7a('0x1e'),_0x2d2f9f[_0xeb7a('0x7')]));var _0x5c2ddc=[];switch(_0x2d2f9f[_0xeb7a('0x1b')]){case _0xeb7a('0x2d'):_0x4023e2[_0x29db91](_0xeb7a('0x2e'));_0x4023e2[_0x29db91](_0xeb7a('0x2f'));if(queryQueues[_0xeb7a('0x30')](_0xeb7a('0x31'))){delete queryQueues[_0xeb7a('0x31')];}_0x5c2ddc[_0xeb7a('0x32')](db['VoiceQueue'][_0xeb7a('0x15')](queryQueues));_0x5c2ddc[_0xeb7a('0x32')](db[_0xeb7a('0x33')][_0xeb7a('0x15')](queryQueues));_0x5c2ddc['push'](db[_0xeb7a('0x34')][_0xeb7a('0x15')](queryQueues));_0x5c2ddc[_0xeb7a('0x32')](db[_0xeb7a('0x35')][_0xeb7a('0x15')](queryQueues));_0x5c2ddc[_0xeb7a('0x32')](db['MailQueue'][_0xeb7a('0x15')](queryQueues));_0x5c2ddc[_0xeb7a('0x32')](db[_0xeb7a('0x36')][_0xeb7a('0x15')](queryQueues));_0x5c2ddc[_0xeb7a('0x32')](db[_0xeb7a('0x37')]['findAll'](queryQueues));_0x5c2ddc[_0xeb7a('0x32')](db['User'][_0xeb7a('0x15')](queryTelephones));_0x5c2ddc[_0xeb7a('0x32')](db['Trunk'][_0xeb7a('0x15')](queryTrunks));_0x5c2ddc[_0xeb7a('0x32')](db[_0xeb7a('0x38')][_0xeb7a('0x15')](queryCampaigns));_0x5c2ddc[_0xeb7a('0x32')](db[_0xeb7a('0x6')][_0xeb7a('0x15')](queryAgents));break;case _0xeb7a('0x39'):_0x4023e2[_0x29db91]('voice:inbound');_0x4023e2[_0x29db91](_0xeb7a('0x2f'));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources('VoiceQueues',_0x2d2f9f[_0xeb7a('0x21')],_0xeb7a('0x3a')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x3b'),_0x2d2f9f[_0xeb7a('0x21')],_0xeb7a('0x33')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources('FaxQueues',_0x2d2f9f[_0xeb7a('0x21')],_0xeb7a('0x34')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x11'),_0x2d2f9f[_0xeb7a('0x21')],_0xeb7a('0x35')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x12'),_0x2d2f9f[_0xeb7a('0x21')],_0xeb7a('0x3c')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x13'),_0x2d2f9f['userProfileId'],_0xeb7a('0x36')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x14'),_0x2d2f9f[_0xeb7a('0x21')],'WhatsappQueue'));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x16'),_0x2d2f9f[_0xeb7a('0x21')],_0xeb7a('0x6')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x17'),_0x2d2f9f['userProfileId'],_0xeb7a('0x3d')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources('IvrCampaigns',_0x2d2f9f[_0xeb7a('0x21')],'Campaign'));_0x5c2ddc['push'](db['User'][_0xeb7a('0x15')](queryAgents));break;case _0xeb7a('0x8'):_0x4023e2[_0x29db91](_0xeb7a('0x2e'));_0x4023e2[_0x29db91](_0xeb7a('0x2f'));_0x5c2ddc[_0xeb7a('0x32')](_0x2d2f9f[_0xeb7a('0x3e')]({'attributes':['id','name']}));_0x5c2ddc['push'](_0x2d2f9f[_0xeb7a('0x3f')]({'attributes':['id','name']}));_0x5c2ddc[_0xeb7a('0x32')](_0x2d2f9f[_0xeb7a('0x40')]({'attributes':['id',_0xeb7a('0x7')]}));_0x5c2ddc[_0xeb7a('0x32')](_0x2d2f9f['getSmsQueues']({'attributes':['id',_0xeb7a('0x7')]}));_0x5c2ddc[_0xeb7a('0x32')](_0x2d2f9f[_0xeb7a('0x41')]({'attributes':['id',_0xeb7a('0x7')]}));_0x5c2ddc['push'](_0x2d2f9f[_0xeb7a('0x42')]({'attributes':['id','name']}));_0x5c2ddc[_0xeb7a('0x32')](_0x2d2f9f[_0xeb7a('0x43')]({'attributes':['id',_0xeb7a('0x7')]}));break;}return BPromise[_0xeb7a('0x44')](_0x5c2ddc);}})[_0xeb7a('0xe')](function(_0x248f29){if(_0x248f29&&_0x248f29[_0xeb7a('0x45')]){for(var _0x5e3d8e=0x0;_0x5e3d8e<_0x248f29['length'];_0x5e3d8e+=0x1){for(var _0x232350=0x0;_0x232350<_0x248f29[_0x5e3d8e][_0xeb7a('0x45')];_0x232350+=0x1){switch(_0x5e3d8e){case 0x0:joinOrLeaveQueues(_0x4023e2,_0x29db91,_0xeb7a('0x46'),_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x1:joinOrLeaveQueues(_0x4023e2,_0x29db91,_0xeb7a('0x47'),_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x2:joinOrLeaveQueues(_0x4023e2,_0x29db91,_0xeb7a('0x48'),_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x3:joinOrLeaveQueues(_0x4023e2,_0x29db91,'sms',_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x4:joinOrLeaveQueues(_0x4023e2,_0x29db91,'mail',_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x5:joinOrLeaveQueues(_0x4023e2,_0x29db91,_0xeb7a('0x49'),_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x6:joinOrLeaveQueues(_0x4023e2,_0x29db91,'whatsapp',_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x7:if(_0xfb62a5[_0xeb7a('0x1b')]!==_0xeb7a('0x8'))_0x4023e2[_0x29db91](util[_0xeb7a('0x1c')](_0xeb7a('0x4a'),_0x248f29[_0x5e3d8e][_0x232350][_0xeb7a('0x7')]));break;case 0x8:if(_0xfb62a5[_0xeb7a('0x1b')]!==_0xeb7a('0x8'))_0x4023e2[_0x29db91](util[_0xeb7a('0x1c')](_0xeb7a('0x4b'),_0x248f29[_0x5e3d8e][_0x232350][_0xeb7a('0x7')]));break;case 0x9:if(_0xfb62a5[_0xeb7a('0x1b')]!==_0xeb7a('0x8'))_0x4023e2[_0x29db91](util[_0xeb7a('0x1c')](_0xeb7a('0x4c'),_0x248f29[_0x5e3d8e][_0x232350]['type'],_0x248f29[_0x5e3d8e][_0x232350][_0xeb7a('0x7')]));break;case 0xa:_0x4023e2[_0x29db91](util[_0xeb7a('0x1c')](_0xeb7a('0x1e'),_0x248f29[_0x5e3d8e][_0x232350][_0xeb7a('0x7')]));break;}}}}})[_0xeb7a('0xe')](function(){if(_0x29db91===_0xeb7a('0x4d')){var _0x410921=_[_0xeb7a('0x4e')](_0xfb62a5[_0xeb7a('0x23')],'id');return _0xfb62a5[_0xeb7a('0x4f')](_0x410921)[_0xeb7a('0xe')](function(){for(var _0x2bedb0=0x0;_0x2bedb0<_0x410921[_0xeb7a('0x45')];_0x2bedb0+=0x1){_0x44cefc[_0xeb7a('0x50')](_0xeb7a('0x51'),{'ChatInteractionId':Number(_0x410921[_0x2bedb0]),'UserId':Number(_0xfb62a5['id'])});}});}})[_0xeb7a('0xe')](function(){if(_0x29db91===_0xeb7a('0x4d')){var _0x18950c=_[_0xeb7a('0x4e')](_0xfb62a5[_0xeb7a('0x24')],'id');return _0xfb62a5[_0xeb7a('0x52')](_0x18950c)[_0xeb7a('0xe')](function(){for(var _0x196438=0x0;_0x196438<_0x18950c['length'];_0x196438+=0x1){_0x44cefc[_0xeb7a('0x50')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x18950c[_0x196438]),'UserId':Number(_0xfb62a5['id'])});}});}})[_0xeb7a('0xe')](function(){if(_0x29db91==='leave'){var _0xd576e6=_[_0xeb7a('0x4e')](_0xfb62a5[_0xeb7a('0x26')],'id');return _0xfb62a5[_0xeb7a('0x53')](_0xd576e6)[_0xeb7a('0xe')](function(){for(var _0x76c02e=0x0;_0x76c02e<_0xd576e6['length'];_0x76c02e+=0x1){_0x44cefc[_0xeb7a('0x50')](_0xeb7a('0x54'),{'FaxInteractionId':Number(_0xd576e6[_0x76c02e]),'UserId':Number(_0xfb62a5['id'])});}});}})[_0xeb7a('0xe')](function(){if(_0x29db91===_0xeb7a('0x4d')){var _0x4a76c0=_[_0xeb7a('0x4e')](_0xfb62a5[_0xeb7a('0x28')],'id');return _0xfb62a5[_0xeb7a('0x55')](_0x4a76c0)[_0xeb7a('0xe')](function(){for(var _0x19b006=0x0;_0x19b006<_0x4a76c0[_0xeb7a('0x45')];_0x19b006+=0x1){_0x44cefc[_0xeb7a('0x50')](_0xeb7a('0x56'),{'SmsInteractionId':Number(_0x4a76c0[_0x19b006]),'UserId':Number(_0xfb62a5['id'])});}});}})[_0xeb7a('0xe')](function(){if(_0x29db91===_0xeb7a('0x4d')){var _0x40f52f=_[_0xeb7a('0x4e')](_0xfb62a5[_0xeb7a('0x2a')],'id');return _0xfb62a5['removeOpenchannelInteractions'](_0x40f52f)[_0xeb7a('0xe')](function(){for(var _0x1633ef=0x0;_0x1633ef<_0x40f52f[_0xeb7a('0x45')];_0x1633ef+=0x1){_0x44cefc[_0xeb7a('0x50')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x40f52f[_0x1633ef]),'UserId':Number(_0xfb62a5['id'])});}});}})[_0xeb7a('0xe')](function(){if(_0x29db91===_0xeb7a('0x4d')){var _0x16b94f=_[_0xeb7a('0x4e')](_0xfb62a5[_0xeb7a('0x2c')],'id');return _0xfb62a5[_0xeb7a('0x57')](_0x16b94f)[_0xeb7a('0xe')](function(){for(var _0x381bd6=0x0;_0x381bd6<_0x16b94f['length'];_0x381bd6+=0x1){_0x44cefc[_0xeb7a('0x50')](_0xeb7a('0x58'),{'WhatsappInteractionId':Number(_0x16b94f[_0x381bd6]),'UserId':Number(_0xfb62a5['id'])});}});}})[_0xeb7a('0x59')](function(_0x3c3e66){_0x4023e2['log'](_0x3c3e66);});}}function onDisconnect(_0x1291b5,_0xa29957){joinOrLeave(_0x1291b5,_0xeb7a('0x4d'),_0xa29957);}function onConnect(_0x3e45f8){joinOrLeave(_0x3e45f8,'join');}exports[_0xeb7a('0x5a')]=function(_0x50a654){_0x50a654['on']('connection',function(_0x46c194){_0x46c194[_0xeb7a('0x5b')](0x0);_0x46c194[_0xeb7a('0x5c')]=_0x46c194[_0xeb7a('0x5d')][_0xeb7a('0x5e')][_0xeb7a('0x5f')]+':'+_0x46c194[_0xeb7a('0x5d')][_0xeb7a('0x5e')][_0xeb7a('0x60')];_0x46c194[_0xeb7a('0x61')]=new Date();_0x46c194[_0xeb7a('0x62')]=function(_0x2adcb9){console['log'](_0xeb7a('0x63')+_0x46c194[_0xeb7a('0x64')]['name']+'['+_0x46c194[_0xeb7a('0x5c')]+']',_0x2adcb9);};_0x46c194['on']('disconnect',function(){onDisconnect(_0x46c194,_0x50a654);_0x46c194['log'](_0xeb7a('0x65'));});onConnect(_0x46c194);_0x46c194[_0xeb7a('0x62')](_0xeb7a('0x66'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 9b200ad..b5d765c 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 _0x2cce=['Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','then','info','EventManager','error','code','catch','Trigger,\x20%s','get','channel','motionChannel','event','direction','resolve','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','QueryTypes','SELECT','contact','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','UserId','AfterCreate','changed','closed','substatus','Sequelize','interface','AfterUpdate','User','find','fullname','email','internal','default','model','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','newmessage','ChatOfflineMessage','Sms','SmsInteraction'];(function(_0x175761,_0x5c4bd2){var _0x4dcc31=function(_0x1f6223){while(--_0x1f6223){_0x175761['push'](_0x175761['shift']());}};_0x4dcc31(++_0x5c4bd2);}(_0x2cce,0x19a));var _0xe2cc=function(_0x14e58e,_0x2d3499){_0x14e58e=_0x14e58e-0x0;var _0x346d74=_0x2cce[_0x14e58e];return _0x346d74;};'use strict';var util=require(_0xe2cc('0x0'));var db=require(_0xe2cc('0x1'))['db'];var jayson=require(_0xe2cc('0x2'));var logger=require(_0xe2cc('0x3'))('triggers');var client=jayson[_0xe2cc('0x4')][_0xe2cc('0x5')]({'port':0x232a});var triggers=[{'channel':_0xe2cc('0x6'),'model':_0xe2cc('0x7'),'event':_0xe2cc('0x8'),'condition':_0xe2cc('0x9'),'callback':afterCreate},{'channel':_0xe2cc('0x6'),'model':_0xe2cc('0x7'),'event':_0xe2cc('0xa'),'condition':_0xe2cc('0xb'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':'afterCreate','condition':_0xe2cc('0xc'),'callback':afterCreateMessage},{'channel':_0xe2cc('0x6'),'model':_0xe2cc('0xd'),'event':_0xe2cc('0x8'),'condition':_0xe2cc('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0xe2cc('0xe'),'model':_0xe2cc('0xf'),'event':_0xe2cc('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xe2cc('0xe'),'model':_0xe2cc('0xf'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe2cc('0xe'),'model':'SmsMessage','event':_0xe2cc('0x8'),'condition':_0xe2cc('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':'afterCreate','condition':_0xe2cc('0x9'),'callback':afterCreate},{'channel':_0xe2cc('0x10'),'model':_0xe2cc('0x11'),'event':_0xe2cc('0xa'),'condition':_0xe2cc('0xb'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0xe2cc('0x8'),'condition':_0xe2cc('0xc'),'callback':afterCreateMessage},{'channel':_0xe2cc('0x12'),'model':_0xe2cc('0x13'),'event':_0xe2cc('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xe2cc('0x12'),'model':_0xe2cc('0x13'),'event':_0xe2cc('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe2cc('0x12'),'model':_0xe2cc('0x14'),'event':_0xe2cc('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xe2cc('0x15'),'model':'MailInteraction','event':_0xe2cc('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':_0xe2cc('0x16'),'event':_0xe2cc('0xa'),'condition':_0xe2cc('0xb'),'callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0xe2cc('0x8'),'condition':_0xe2cc('0xc'),'callback':afterCreateMessage},{'channel':_0xe2cc('0x17'),'model':_0xe2cc('0x18'),'event':_0xe2cc('0x8'),'condition':_0xe2cc('0x9'),'callback':afterCreate},{'channel':_0xe2cc('0x17'),'model':_0xe2cc('0x18'),'event':_0xe2cc('0xa'),'condition':_0xe2cc('0xb'),'callback':afterUpdate},{'channel':_0xe2cc('0x17'),'model':'OpenchannelMessage','event':_0xe2cc('0x8'),'condition':_0xe2cc('0xc'),'callback':afterCreateMessage}];function request(_0x52d6fe){return client['request']('EventManager',_0x52d6fe)[_0xe2cc('0x19')](function(_0x3b454b){logger[_0xe2cc('0x1a')]('Trigger,\x20%s',_0xe2cc('0x1b'),_0x3b454b);if(_0x3b454b[_0xe2cc('0x1c')]){if(_0x3b454b[_0xe2cc('0x1c')][_0xe2cc('0x1d')]===0x1f4){logger['error']('Trigger,\x20%s',_0xe2cc('0x1b'),_0x3b454b[_0xe2cc('0x1c')]);}}})[_0xe2cc('0x1e')](function(_0x525f4d){logger['error'](_0xe2cc('0x1f'),'EventManager',_0x525f4d);});}function afterCreateMessage(_0x3c098e){return function(_0x44b90){_0x44b90=_0x44b90[_0xe2cc('0x20')]({'plain':!![]});_0x44b90[_0xe2cc('0x21')]=_0x3c098e;_0x44b90[_0xe2cc('0x22')]=_0x3c098e;_0x44b90[_0xe2cc('0x23')]=_0x44b90[_0xe2cc('0x24')];Promise[_0xe2cc('0x25')]()[_0xe2cc('0x19')](function(){if(typeof _0x44b90['ContactId']===_0xe2cc('0x26'))return null;var _0xb5db98=_0xe2cc('0x27')+_0x44b90[_0xe2cc('0x28')];return db[_0xe2cc('0x29')][_0xe2cc('0x2a')](_0xb5db98,{'type':db['Sequelize'][_0xe2cc('0x2b')][_0xe2cc('0x2c')],'raw':!![]});})[_0xe2cc('0x19')](function(_0x9d1d34){if(_0x9d1d34){_0x44b90[_0xe2cc('0x2d')]=_0x9d1d34[0x0];}if(typeof _0x44b90['UserId']===_0xe2cc('0x26'))return;return getAgent(_0x44b90['UserId']);})['then'](function(_0x551ec3){if(_0x551ec3){_0x44b90['interface']=util[_0xe2cc('0x2e')](_0xe2cc('0x2f'),_0x551ec3[_0xe2cc('0x30')]);_0x44b90[_0xe2cc('0x31')]=_0x551ec3;_0x44b90[_0xe2cc('0x21')]=_0x3c098e;return request({'event':_0xe2cc('0x32'),'message':_0x44b90});}else{return request({'event':_0xe2cc('0x33'),'message':_0x44b90});}})[_0xe2cc('0x1e')](function(_0x501000){logger['error']('Trigger,\x20%s',_0xe2cc('0x34'),_0x501000);});};}function afterCreateOfflineMessage(_0xbf331c){return function(_0x2dbcfc){_0x2dbcfc=_0x2dbcfc[_0xe2cc('0x20')]({'plain':!![]});_0x2dbcfc[_0xe2cc('0x21')]=_0xbf331c;_0x2dbcfc[_0xe2cc('0x22')]=_0xbf331c;_0x2dbcfc[_0xe2cc('0x23')]=_0xe2cc('0x35');return request({'event':_0x2dbcfc[_0xe2cc('0x23')],'message':_0x2dbcfc});};}function afterCreate(_0x2fef33,_0x403e67){return function(_0x8018e0){_0x8018e0=_0x8018e0['get']({'plain':!![]});_0x8018e0[_0xe2cc('0x21')]=_0x2fef33;_0x8018e0[_0xe2cc('0x22')]=_0x2fef33;_0x8018e0[_0xe2cc('0x23')]='opened';Promise[_0xe2cc('0x25')]()[_0xe2cc('0x19')](function(){var _0x6ed09b=_0xe2cc('0x27')+_0x8018e0[_0xe2cc('0x28')];return db[_0xe2cc('0x29')]['query'](_0x6ed09b,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]});})[_0xe2cc('0x19')](function(_0xa9aa17){if(_0xa9aa17){_0x8018e0['contact']=_0xa9aa17[0x0];}if(typeof _0x8018e0[_0xe2cc('0x36')]===_0xe2cc('0x26'))return;return getAgent(_0x8018e0[_0xe2cc('0x36')]);})[_0xe2cc('0x19')](function(_0x4b00a9){if(_0x4b00a9){_0x8018e0['interface']=util['format'](_0xe2cc('0x2f'),_0x4b00a9[_0xe2cc('0x30')]);_0x8018e0[_0xe2cc('0x31')]=_0x4b00a9;}return request({'event':_0x403e67,'message':_0x8018e0});})[_0xe2cc('0x1e')](function(_0x2795b8){logger['error'](_0xe2cc('0x1f'),_0xe2cc('0x37'),_0x2795b8);});};}function afterUpdate(_0x471ee3){return function(_0x1e3549){var _0x4befed=_0x1e3549[_0xe2cc('0x38')](_0xe2cc('0x39'))&&_0x1e3549['closed'];var _0x6a3a72=_0x1e3549[_0xe2cc('0x38')](_0xe2cc('0x3a'));if(_0x4befed||_0x6a3a72){var _0x4f31cd=_0x4befed?_0xe2cc('0xb'):_0xe2cc('0x3a');var _0x1983d9=_0x1e3549[_0xe2cc('0x20')]({'plain':!![]});_0x1983d9[_0xe2cc('0x21')]=_0x471ee3;_0x1983d9[_0xe2cc('0x22')]=_0x471ee3;_0x1983d9['event']=_0x4befed?_0xe2cc('0x39'):_0xe2cc('0x3a');var _0x11222a=_0xe2cc('0x27')+_0x1983d9[_0xe2cc('0x28')];return db[_0xe2cc('0x29')][_0xe2cc('0x2a')](_0x11222a,{'type':db[_0xe2cc('0x3b')][_0xe2cc('0x2b')][_0xe2cc('0x2c')],'raw':!![]})[_0xe2cc('0x19')](function(_0x3ad8cd){if(_0x3ad8cd){_0x1983d9['contact']=_0x3ad8cd[0x0];}if(typeof _0x1983d9[_0xe2cc('0x36')]===_0xe2cc('0x26'))return;return getAgent(_0x1983d9[_0xe2cc('0x36')]);})[_0xe2cc('0x19')](function(_0x45df1d){if(_0x45df1d){_0x1983d9[_0xe2cc('0x3c')]=util[_0xe2cc('0x2e')](_0xe2cc('0x2f'),_0x45df1d[_0xe2cc('0x30')]);_0x1983d9[_0xe2cc('0x31')]=_0x45df1d;}return request({'event':_0x4f31cd,'message':_0x1983d9});})[_0xe2cc('0x1e')](function(_0x558858){logger['error'](_0xe2cc('0x1f'),_0xe2cc('0x3d'),_0x558858);});}};}function getAgent(_0x56ea57){return db[_0xe2cc('0x3e')][_0xe2cc('0x3f')]({'where':{'id':_0x56ea57},'attributes':['id',_0xe2cc('0x30'),_0xe2cc('0x40'),_0xe2cc('0x41'),_0xe2cc('0x42')],'raw':!![]})['then'](function(_0x51ac18){return _0x51ac18;});}exports[_0xe2cc('0x43')]=function(){for(var _0x35dd56=0x0;_0x35dd56=_0x20cd45[_0x8d65('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x5e251e(_0x4ebabc);})['catch'](function(_0x2ecbbb){_0x338525(_0x2ecbbb);});});}; \ No newline at end of file +var _0xb2c6=['./license/util','mail','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','then','agents','catch','lodash','bluebird','../mysqldb'];(function(_0x209231,_0x1e8167){var _0x395ad7=function(_0x48b37a){while(--_0x48b37a){_0x209231['push'](_0x209231['shift']());}};_0x395ad7(++_0x1e8167);}(_0xb2c6,0x1e0));var _0x6b2c=function(_0xcd3b93,_0x14d660){_0xcd3b93=_0xcd3b93-0x0;var _0x37ea7e=_0xb2c6[_0xcd3b93];return _0x37ea7e;};'use strict';var _=require(_0x6b2c('0x0'));var BPromise=require(_0x6b2c('0x1'));var db=require(_0x6b2c('0x2'))['db'];var util=require(_0x6b2c('0x3'));var channels=['voice',_0x6b2c('0x4'),'chat',_0x6b2c('0x5'),_0x6b2c('0x6'),_0x6b2c('0x7'),_0x6b2c('0x8')];exports[_0x6b2c('0x9')]=function(){return channels;};exports[_0x6b2c('0xa')]=function(_0x5590f5){_0x5590f5=_0x5590f5[_0x6b2c('0xb')]();return _[_0x6b2c('0xc')](channels,_0x5590f5);};exports['clearBlockUser']=function(_0x2acf40,_0x2bbf4d,_0x379f39,_0x37b9a3){var _0x898f10={'loginAttempts':_0x2bbf4d,'blocked':_0x379f39};if(!_[_0x6b2c('0xd')](_0x37b9a3)){_0x898f10[_0x6b2c('0xe')]=_0x37b9a3;}return _0x2acf40[_0x6b2c('0xf')](_0x898f10);};exports[_0x6b2c('0x10')]=function(_0x521cff){return new BPromise(function(_0x2daee9,_0x547190){var _0x4df06b=0x0;if(_0x521cff[_0x6b2c('0x11')]!==_0x6b2c('0x12')){_0x2daee9(_0x521cff);}db[_0x6b2c('0x13')]['count']({'where':{'role':_0x6b2c('0x12'),'online':!![],'id':{'$ne':_0x521cff['id']}}})[_0x6b2c('0x14')](function(_0xb51611){_0x4df06b=_0xb51611;return util[_0x6b2c('0x10')]();})[_0x6b2c('0x14')](function(_0x20d59e){if(_0x20d59e&&_0x20d59e[_0x6b2c('0x15')]&&_0x4df06b>=_0x20d59e[_0x6b2c('0x15')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x2daee9(_0x521cff);})[_0x6b2c('0x16')](function(_0x240e47){_0x547190(_0x240e47);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index aade072..df706a9 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b5=['name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','error','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error'];(function(_0x26c12c,_0xde2ac0){var _0x485044=function(_0x3e797b){while(--_0x3e797b){_0x26c12c['push'](_0x26c12c['shift']());}};_0x485044(++_0xde2ac0);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x46f3f8,_0x12c74b){_0x46f3f8=_0x46f3f8-0x0;var _0xbc57cd=_0xe5b5[_0x46f3f8];return _0xbc57cd;};'use strict';var util=require(_0x5e5b('0x0'));var logger=require(_0x5e5b('0x1'))(_0x5e5b('0x2'));var APIError=function(_0x3b3efd,_0x208070){this[_0x5e5b('0x3')]=_0x3b3efd||_0x5e5b('0x4');this[_0x5e5b('0x5')]=_0x208070||_0x5e5b('0x6');util[_0x5e5b('0x7')](APIError,Error);};var APIBadRequestError=function(_0xdc6616){this[_0x5e5b('0x3')]=_0xdc6616||_0x5e5b('0x8');this[_0x5e5b('0x5')]=_0x5e5b('0x8');util[_0x5e5b('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0xe089b1){this[_0x5e5b('0x3')]=_0xe089b1||_0x5e5b('0x9');this[_0x5e5b('0x5')]=_0x5e5b('0xa');util[_0x5e5b('0x7')](APINotFoundError,APIError);};function getStatusCode(_0x3f8534){switch(_0x3f8534){case'Bad\x20Request':return 0x190;case _0x5e5b('0xb'),'OutOfInterval':return 0x193;case _0x5e5b('0xa'):return 0x194;default:return 0x1f4;}}function handleError(_0x58185){return function(_0x23e667){logger[_0x5e5b('0xc')](_0x23e667['stack']);var _0x4a1424=getStatusCode(_0x23e667['name']);if(_0x23e667[_0x5e5b('0x5')])delete _0x23e667[_0x5e5b('0x5')];return _0x58185[_0x5e5b('0xd')](_0x4a1424)[_0x5e5b('0xe')](_0x23e667);};}module[_0x5e5b('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xf109=['status','exports','util','../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0xf109,0xce));var _0x9f10=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xf109[_0x346737];return _0x1ade2e;};'use strict';var util=require(_0x9f10('0x0'));var logger=require(_0x9f10('0x1'))(_0x9f10('0x2'));var APIError=function(_0x5d2950,_0x5b381d){this['message']=_0x5d2950||_0x9f10('0x3');this[_0x9f10('0x4')]=_0x5b381d||_0x9f10('0x5');util[_0x9f10('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4027f4){this[_0x9f10('0x7')]=_0x4027f4||_0x9f10('0x8');this[_0x9f10('0x4')]=_0x9f10('0x8');util[_0x9f10('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3fd82f){this['message']=_0x3fd82f||_0x9f10('0x9');this[_0x9f10('0x4')]=_0x9f10('0xa');util[_0x9f10('0x6')](APINotFoundError,APIError);};function getStatusCode(_0x325f22){switch(_0x325f22){case'Bad\x20Request':return 0x190;case _0x9f10('0xb'),_0x9f10('0xc'):return 0x193;case _0x9f10('0xa'):return 0x194;default:return 0x1f4;}}function handleError(_0x4e577d){return function(_0x50215f){logger[_0x9f10('0xd')](_0x50215f[_0x9f10('0xe')]);var _0x407336=getStatusCode(_0x50215f['name']);if(_0x50215f[_0x9f10('0x4')])delete _0x50215f[_0x9f10('0x4')];return _0x4e577d[_0x9f10('0xf')](_0x407336)['send'](_0x50215f);};}module[_0x9f10('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index baecc00..884cfd0 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8804=['status','send','exports','404','render'];(function(_0x51130a,_0x3d5775){var _0x45e953=function(_0x593cb7){while(--_0x593cb7){_0x51130a['push'](_0x51130a['shift']());}};_0x45e953(++_0x3d5775);}(_0x8804,0x160));var _0x4880=function(_0x103002,_0x4ac5ec){_0x103002=_0x103002-0x0;var _0x304723=_0x8804[_0x103002];return _0x304723;};'use strict';module[_0x4880('0x0')][0x194]=function pageNotFound(_0x3c0b1c,_0xb090ed){var _0x3f47a=_0x4880('0x1');var _0x2aa3c8=0x194;var _0x50f7f6={'status':_0x2aa3c8};_0xb090ed['status'](_0x50f7f6['status']);_0xb090ed[_0x4880('0x2')](_0x3f47a,{},function(_0x10fa36,_0x18e027){if(_0x10fa36){return _0xb090ed['status'](_0x50f7f6[_0x4880('0x3')])['json'](_0x50f7f6);}_0xb090ed[_0x4880('0x4')](_0x18e027);});}; \ No newline at end of file +var _0x9857=['exports','404','status','render','json'];(function(_0x461d24,_0x9dd951){var _0x25a523=function(_0x4894da){while(--_0x4894da){_0x461d24['push'](_0x461d24['shift']());}};_0x25a523(++_0x9dd951);}(_0x9857,0x87));var _0x7985=function(_0x112fe2,_0x13d91b){_0x112fe2=_0x112fe2-0x0;var _0x3eaf45=_0x9857[_0x112fe2];return _0x3eaf45;};'use strict';module[_0x7985('0x0')][0x194]=function pageNotFound(_0x10e5f6,_0x209549){var _0x53aa17=_0x7985('0x1');var _0x5305fe=0x194;var _0xfe90c8={'status':_0x5305fe};_0x209549[_0x7985('0x2')](_0xfe90c8[_0x7985('0x2')]);_0x209549[_0x7985('0x3')](_0x53aa17,{},function(_0x20ebae,_0x2cad90){if(_0x20ebae){return _0x209549[_0x7985('0x2')](_0xfe90c8[_0x7985('0x2')])[_0x7985('0x4')](_0xfe90c8);}_0x209549['send'](_0x2cad90);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e72e0b9..0f601d1 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc80e=['ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmHopperAdditionalPhone','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','User','hasOne','UserId','userSetting','cascade','hasMany','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','MailInteraction','UserNotification','UserNotifications','SenderId','UserProfile','userProfileId','Groups','chat_group_has_users','cm_user_has_contacts','belongsToMany','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteractions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueue','VoicePrefix','VoicePrefixes','MailQueues','ChatQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccount','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','VoiceMusicOnHold','Members','VoiceQueueId','CmHopperHistory','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','Trunk','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','Messages','Interactions','List','TemplateId','team_has_mail_queues','MailMessage','Owner','mail_interaction_has_tags','Tags','Tag','ThroughTags','Users','MailInteractionId','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','MailApplication','TagId','Answers','FaxAccountId','Exntensions','ListId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Contacts','CompanyId','CmContactId','Hoppers','JscriptySessionReport','Company','cm_contact_has_tags','CmHopper','CampaignId','OwnerId','Automation','All','OneAll','AutomationAllId','OneAny','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','moh_has_sounds','CmContactHasItem','ContactItemType','ItemType','ItemTypeId','Hopper','CmHopperId','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Field','VariableId','SugarcrmField','Description','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','Subject','VtigerField','Dynamics365Configuration','ChatInternalMessage','ToId','SessionId','SmsQueueReport','ProjectId','VoiceQueues','team_has_chat_queues','FaxQueues','WhatsappQueues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToMailQueueId','ToAccount','FromChatWebsiteId','ToAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','ToFaxAccountId','FromAgent','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','WhatsappAccountId','WhatsappMessage','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','UserSetting','user','exports','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8','sequelizeHistory','defaultsDeep','mysql','utf8mb4','name','utf8_general_ci','database','username','password','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/chatApplication/chatApplication.model'];(function(_0x27a675,_0x44abdc){var _0x35adb6=function(_0x2434c2){while(--_0x2434c2){_0x27a675['push'](_0x27a675['shift']());}};_0x35adb6(++_0x44abdc);}(_0xc80e,0x1a3));var _0xec80=function(_0x503ec3,_0x5f851e){_0x503ec3=_0x503ec3-0x0;var _0x4ce7cf=_0xc80e[_0x503ec3];return _0x4ce7cf;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xec80('0x0'));var _=require(_0xec80('0x1'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0xec80('0x0')]=_['defaultsDeep'](config['sequelize'],{'database':_0xec80('0x2'),'username':_0xec80('0x3'),'password':_0xec80('0x4'),'options':{'host':_0xec80('0x5'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xec80('0x6'),'collate':'utf8_general_ci'}}});config[_0xec80('0x7')]=_[_0xec80('0x8')](config['sequelizeHistory'],{'database':_0xec80('0x2'),'username':_0xec80('0x3'),'password':'xC@LL1234','options':{'host':_0xec80('0x5'),'port':0xcea,'dialect':_0xec80('0x9'),'dialectOptions':{'charset':_0xec80('0xa')},'logging':![],'timezone':timezone[_0xec80('0xb')](),'define':{'charset':_0xec80('0x6'),'collate':_0xec80('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xec80('0x0')][_0xec80('0xd')],config[_0xec80('0x0')][_0xec80('0xe')],config['sequelize'][_0xec80('0xf')],config[_0xec80('0x0')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xec80('0x7')][_0xec80('0xd')],config[_0xec80('0x7')][_0xec80('0xe')],config[_0xec80('0x7')][_0xec80('0xf')],config[_0xec80('0x7')]['options'])};db['User']=db[_0xec80('0x0')][_0xec80('0x10')]('../api/user/user.model');db[_0xec80('0x11')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x12'));db['VoiceContext']=db[_0xec80('0x0')]['import'](_0xec80('0x13'));db[_0xec80('0x14')]=db[_0xec80('0x0')]['import'](_0xec80('0x15'));db['VoiceMusicOnHold']=db['sequelize'][_0xec80('0x10')](_0xec80('0x16'));db['VoiceQueue']=db[_0xec80('0x0')][_0xec80('0x10')]('../api/voiceQueue/voiceQueue.model');db[_0xec80('0x17')]=db['sequelize'][_0xec80('0x10')]('../api/voiceRecording/voiceRecording.model');db[_0xec80('0x18')]=db['sequelize']['import'](_0xec80('0x19'));db[_0xec80('0x1a')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x1b'));db[_0xec80('0x1c')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x1d'));db[_0xec80('0x1e')]=db['sequelize'][_0xec80('0x10')]('../api/voiceCallReport/voiceCallReport.model');db[_0xec80('0x1f')]=db[_0xec80('0x0')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0xec80('0x20')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x21'));db[_0xec80('0x22')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x23'));db[_0xec80('0x24')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x25'));db['Trunk']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x26'));db[_0xec80('0x27')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x28'));db[_0xec80('0x29')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x2a'));db[_0xec80('0x2b')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x2c'));db[_0xec80('0x2d')]=db[_0xec80('0x0')]['import'](_0xec80('0x2e'));db[_0xec80('0x2f')]=db['sequelize']['import'](_0xec80('0x30'));db[_0xec80('0x31')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x32'));db['UserSmsQueue']=db['sequelize']['import'](_0xec80('0x33'));db[_0xec80('0x34')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x35'));db[_0xec80('0x36')]=db['sequelize']['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xec80('0x37')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x38'));db[_0xec80('0x39')]=db[_0xec80('0x0')]['import'](_0xec80('0x3a'));db['MailAccount']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x3b'));db[_0xec80('0x3c')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x3d'));db['MailSubstatus']=db[_0xec80('0x0')][_0xec80('0x10')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db['sequelize'][_0xec80('0x10')](_0xec80('0x3e'));db['MailMessage']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x3f'));db['MailApplication']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x40'));db[_0xec80('0x41')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x42'));db['Dashboard']=db['sequelize'][_0xec80('0x10')](_0xec80('0x43'));db[_0xec80('0x44')]=db[_0xec80('0x0')]['import'](_0xec80('0x45'));db['FaxAccount']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x46'));db[_0xec80('0x47')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x48'));db[_0xec80('0x49')]=db['sequelize']['import'](_0xec80('0x4a'));db[_0xec80('0x4b')]=db[_0xec80('0x0')]['import'](_0xec80('0x4c'));db[_0xec80('0x4d')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x4e'));db[_0xec80('0x4f')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x50'));db[_0xec80('0x51')]=db['sequelize'][_0xec80('0x10')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x52'));db[_0xec80('0x53')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x54'));db[_0xec80('0x55')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/smsMessage/smsMessage.model');db[_0xec80('0x56')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0xec80('0x0')]['import'](_0xec80('0x57'));db[_0xec80('0x58')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x59'));db[_0xec80('0x5a')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x5b'));db['OpenchannelMessage']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x5c'));db[_0xec80('0x5d')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x5e'));db[_0xec80('0x5f')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x60'));db[_0xec80('0x61')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db['sequelize'][_0xec80('0x10')](_0xec80('0x62'));db[_0xec80('0x63')]=db['sequelize']['import'](_0xec80('0x64'));db[_0xec80('0x65')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x66'));db['ChatOfflineMessage']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x67'));db[_0xec80('0x68')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x69'));db[_0xec80('0x6a')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/chatGroup/chatGroup.model');db[_0xec80('0x6b')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x6c'));db[_0xec80('0x6d')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x6e'));db[_0xec80('0x6f')]=db[_0xec80('0x0')]['import'](_0xec80('0x70'));db['CmHopper']=db[_0xec80('0x0')]['import'](_0xec80('0x71'));db[_0xec80('0x72')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x73'));db[_0xec80('0x74')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x75'));db['CmHopperHistory']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x76'));db[_0xec80('0x77')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xec80('0x78')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x79'));db[_0xec80('0x7a')]=db['sequelize'][_0xec80('0x10')]('../api/action/action.model');db['Automation']=db[_0xec80('0x0')]['import'](_0xec80('0x7b'));db[_0xec80('0x7c')]=db[_0xec80('0x0')]['import'](_0xec80('0x7d'));db['Disposition']=db['sequelize'][_0xec80('0x10')]('../api/disposition/disposition.model');db[_0xec80('0x7e')]=db['sequelize']['import']('../api/condition/condition.model');db[_0xec80('0x7f')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x80'));db['Pause']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x81'));db[_0xec80('0x82')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x83'));db[_0xec80('0x84')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x85'));db[_0xec80('0x86')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/schedule/schedule.model');db[_0xec80('0x87')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x88'));db['Tag']=db[_0xec80('0x0')]['import'](_0xec80('0x89'));db['ContactItemType']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x8a'));db['CmContactHasItem']=db[_0xec80('0x0')][_0xec80('0x10')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0xec80('0x8b')]=db['sequelize']['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xec80('0x8c')]=db['sequelize']['import']('../api/template/template.model');db[_0xec80('0x8d')]=db[_0xec80('0x0')]['import'](_0xec80('0x8e'));db[_0xec80('0x8f')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x90'));db[_0xec80('0x91')]=db[_0xec80('0x0')]['import']('../api/integration/integration.model');db[_0xec80('0x92')]=db[_0xec80('0x0')]['import'](_0xec80('0x93'));db[_0xec80('0x94')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x95'));db[_0xec80('0x96')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x97'));db[_0xec80('0x98')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x99'));db[_0xec80('0x9a')]=db['sequelize']['import'](_0xec80('0x9b'));db[_0xec80('0x9c')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x9d'));db['AnalyticTreeReport']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x9e'));db[_0xec80('0x9f')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xa0'));db['SalesforceConfiguration']=db[_0xec80('0x0')][_0xec80('0x10')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xec80('0xa1')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xa2'));db[_0xec80('0xa3')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xa4'));db[_0xec80('0xa5')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xa6'));db['SugarcrmField']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xa7'));db[_0xec80('0xa8')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xa9'));db['DeskConfiguration']=db['sequelize']['import'](_0xec80('0xaa'));db[_0xec80('0xab')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xac'));db['ZohoAccount']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xad'));db['ZohoConfiguration']=db['sequelize'][_0xec80('0x10')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xec80('0xae')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xaf'));db[_0xec80('0xb0')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xb1'));db[_0xec80('0xb2')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xb3'));db['ZendeskField']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xb4'));db[_0xec80('0xb5')]=db['sequelize']['import'](_0xec80('0xb6'));db[_0xec80('0xb7')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xec80('0xb8')]=db['sequelize']['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0xec80('0xb9')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xba'));db[_0xec80('0xbb')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xbc'));db['VtigerField']=db['sequelize'][_0xec80('0x10')](_0xec80('0xbd'));db[_0xec80('0xbe')]=db['sequelize']['import'](_0xec80('0xbf'));db[_0xec80('0xc0')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xec80('0xc1')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xc2'));db[_0xec80('0xc3')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xc4'));db['Dynamics365Configuration']=db['sequelize'][_0xec80('0x10')](_0xec80('0xc5'));db[_0xec80('0xc6')]=db[_0xec80('0x0')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xec80('0xc7')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xc8'));db[_0xec80('0xc9')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xca'));db[_0xec80('0xcb')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xcc'));db[_0xec80('0x91')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xcd'));db[_0xec80('0xce')]=db['sequelize']['import']('../api/network/network.model');db[_0xec80('0xcf')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xd0'));db['ChatInternalMessage']=db[_0xec80('0x0')][_0xec80('0x10')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xec80('0xd1')]=db['sequelize']['import'](_0xec80('0xd2'));db[_0xec80('0xd3')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xd4'));db['JscriptySessionReport']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xd5'));db['SmsQueueReport']=db[_0xec80('0x0')]['import']('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db['sequelize'][_0xec80('0x10')](_0xec80('0xd6'));db[_0xec80('0xd7')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xd8'));db[_0xec80('0xd9')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xda'));db[_0xec80('0xdb')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xdc'));db['SquareOdbc']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xdd'));db[_0xec80('0xde')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xdf'));db['SquareRecording']=db['sequelize'][_0xec80('0x10')](_0xec80('0xe0'));db['SquareMessage']=db['sequelize'][_0xec80('0x10')]('../api/squareMessage/squareMessage.model');db[_0xec80('0xe1')]=db[_0xec80('0x0')]['import'](_0xec80('0xe2'));db[_0xec80('0xe3')]=db['sequelize'][_0xec80('0x10')](_0xec80('0xe4'));db[_0xec80('0xe5')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xe6'));db[_0xec80('0xe7')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xe8'));db[_0xec80('0xe9')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/attachment/attachment.model');db[_0xec80('0xea')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xeb'));db[_0xec80('0xec')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xed'));db[_0xec80('0xee')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xef'));db[_0xec80('0xf0')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xf1'));db[_0xec80('0xf2')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xec80('0xf3')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/smsTransferReport/smsTransferReport.model');db[_0xec80('0xf4')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xf5'));db['VoicePrefix']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xf6'));db['UserProfile']=db['sequelize'][_0xec80('0x10')]('../api/userProfile/userProfile.model');db[_0xec80('0xf7')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/userProfileSection/userProfileSection.model');db[_0xec80('0xf8')]=db['sequelize'][_0xec80('0x10')](_0xec80('0xf9'));db['UserNotification']=db[_0xec80('0x0')]['import']('../api/userNotification/userNotification.model');db[_0xec80('0xfa')]=db['sequelize'][_0xec80('0x10')](_0xec80('0xfb'));db[_0xec80('0xfc')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xfd'));db[_0xec80('0xfe')]=db[_0xec80('0x0')]['import'](_0xec80('0xff'));db['WhatsappMessage']=db[_0xec80('0x0')]['import']('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x100'));db[_0xec80('0x101')]=db[_0xec80('0x0')]['import'](_0xec80('0x102'));db[_0xec80('0x103')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x104'));db[_0xec80('0x105')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x106'));db[_0xec80('0x107')]=db[_0xec80('0x0')]['import'](_0xec80('0x108'));db[_0xec80('0x109')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x10a'));db[_0xec80('0x10b')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x10c'));db['UserSetting']=db[_0xec80('0x0')]['import'](_0xec80('0x10d'));db[_0xec80('0x10e')][_0xec80('0x10f')](db[_0xec80('0x1a')],{'as':_0xec80('0x1a'),'onDelete':'cascade','foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x10f')](db['UserSetting'],{'as':_0xec80('0x111'),'onDelete':_0xec80('0x112'),'foreignKey':'UserId'});db[_0xec80('0x10e')][_0xec80('0x113')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x113')](db[_0xec80('0x29')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0xec80('0x10e')]['hasMany'](db[_0xec80('0x14')],{'as':_0xec80('0x114'),'onDelete':_0xec80('0x112'),'hooks':!![]});db[_0xec80('0x10e')]['hasMany'](db[_0xec80('0x74')],{'as':_0xec80('0x115'),'foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x113')](db['CmHopperHistory'],{'as':_0xec80('0x116'),'foreignKey':_0xec80('0x110')});db['User'][_0xec80('0x113')](db[_0xec80('0x77')],{'as':_0xec80('0x77'),'foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x113')](db['OpenchannelInteraction'],{'as':_0xec80('0x117'),'foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x113')](db[_0xec80('0x63')],{'as':_0xec80('0x118'),'foreignKey':_0xec80('0x110')});db['User'][_0xec80('0x113')](db[_0xec80('0x53')],{'as':'SmsInteractions','foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')]['hasMany'](db[_0xec80('0x49')],{'as':'FaxInteractions','foreignKey':_0xec80('0x110')});db['User'][_0xec80('0x113')](db[_0xec80('0x119')],{'as':'MailInteractions','foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x113')](db[_0xec80('0xfe')],{'as':'WhatsappInteractions','foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x113')](db[_0xec80('0x11a')],{'as':_0xec80('0x11b'),'foreignKey':_0xec80('0x11c')});db['User']['belongsTo'](db[_0xec80('0x11d')],{'as':_0xec80('0x11d'),'foreignKey':_0xec80('0x11e')});db[_0xec80('0x10e')]['belongsToMany'](db[_0xec80('0x6a')],{'as':_0xec80('0x11f'),'through':_0xec80('0x120')});db['User']['belongsToMany'](db[_0xec80('0x6f')],{'as':'Contacts','through':_0xec80('0x121')});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0xf4')],{'as':_0xec80('0x123'),'through':_0xec80('0x124')});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0xe1')],{'through':_0xec80('0x125')});db['User'][_0xec80('0x122')](db[_0xec80('0x119')],{'as':_0xec80('0x126'),'through':_0xec80('0x127')});db[_0xec80('0x10e')][_0xec80('0x122')](db['ChatInteraction'],{'as':_0xec80('0x118'),'through':_0xec80('0x128')});db['User']['belongsToMany'](db[_0xec80('0x49')],{'as':_0xec80('0x129'),'through':_0xec80('0x12a')});db[_0xec80('0x10e')]['belongsToMany'](db[_0xec80('0x53')],{'as':_0xec80('0x12b'),'through':'user_has_sms_interactions'});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0x5a')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0xfe')],{'as':_0xec80('0x12c'),'through':_0xec80('0x12d')});db[_0xec80('0x10e')]['belongsToMany'](db[_0xec80('0x12e')],{'as':'VoiceQueues','through':_0xec80('0x2b'),'required':![]});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0x12f')],{'as':_0xec80('0x130'),'through':_0xec80('0x10b'),'required':![]});db['User'][_0xec80('0x122')](db[_0xec80('0x3c')],{'as':_0xec80('0x131'),'through':_0xec80('0x2f'),'required':![]});db['User']['belongsToMany'](db[_0xec80('0x68')],{'as':_0xec80('0x132'),'through':_0xec80('0x2d'),'required':![],'hooks':!![]});db[_0xec80('0x10e')]['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db['User']['belongsToMany'](db[_0xec80('0x56')],{'as':_0xec80('0x133'),'through':_0xec80('0x134'),'required':![]});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0x5d')],{'as':_0xec80('0x135'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0xec80('0x122')](db[_0xec80('0x103')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0xf4')],{'through':'cm_user_has_lists'});db['User']['belongsToMany'](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xec80('0x136')});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0x137')],{'as':_0xec80('0x138'),'through':_0xec80('0x139')});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0x13a')],{'as':'MailAccounts','through':_0xec80('0x13b')});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0x13c')],{'as':_0xec80('0x13d'),'through':_0xec80('0x13e')});db[_0xec80('0x10e')]['belongsToMany'](db['SmsAccount'],{'as':'SmsAccounts','through':_0xec80('0x13f')});db['User']['belongsToMany'](db[_0xec80('0xfa')],{'as':_0xec80('0x140'),'through':_0xec80('0x141')});db[_0xec80('0x10e')]['belongsToMany'](db[_0xec80('0xde')],{'as':_0xec80('0x142'),'through':_0xec80('0x143')});db['VoiceChanSpy']['hasMany'](db[_0xec80('0x14')],{'as':_0xec80('0x144'),'onDelete':'cascade','foreignKey':_0xec80('0x145')});db[_0xec80('0x146')]['hasMany'](db['VoiceExtension'],{'onDelete':'cascade'});db[_0xec80('0x14')]['hasMany'](db['VoiceExtension'],{'as':_0xec80('0x147'),'onDelete':'cascade'});db[_0xec80('0x148')][_0xec80('0x122')](db['Sound'],{'as':'Sounds','through':'moh_has_sounds'});db[_0xec80('0x12e')][_0xec80('0x113')](db[_0xec80('0x29')],{'as':_0xec80('0x149'),'foreignKey':'VoiceQueueId'});db[_0xec80('0x12e')][_0xec80('0x113')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xec80('0x14a')});db['VoiceQueue'][_0xec80('0x113')](db[_0xec80('0x74')],{'as':_0xec80('0x115'),'foreignKey':_0xec80('0x14a')});db[_0xec80('0x12e')][_0xec80('0x113')](db[_0xec80('0x14b')],{'as':_0xec80('0x14c'),'foreignKey':'VoiceQueueId'});db[_0xec80('0x12e')][_0xec80('0x113')](db['ReportAgentPreview'],{'as':_0xec80('0x77'),'foreignKey':_0xec80('0x14a')});db[_0xec80('0x12e')]['hasMany'](db[_0xec80('0x72')],{'as':_0xec80('0x14d'),'foreignKey':_0xec80('0x14a')});db['VoiceQueue'][_0xec80('0x113')](db['JscriptySessionReport'],{'as':_0xec80('0x14e'),'foreignKey':_0xec80('0x14a')});db[_0xec80('0x12e')][_0xec80('0x14f')](db[_0xec80('0x150')],{'as':_0xec80('0x150'),'foreignKey':_0xec80('0x151')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xec80('0x152')});db[_0xec80('0x12e')][_0xec80('0x14f')](db[_0xec80('0x7f')],{'as':_0xec80('0x7f'),'foreignKey':_0xec80('0x153')});db[_0xec80('0x12e')][_0xec80('0x14f')](db[_0xec80('0x154')],{'as':_0xec80('0x155'),'foreignKey':_0xec80('0x156')});db[_0xec80('0x12e')]['belongsToMany'](db[_0xec80('0xf4')],{'as':_0xec80('0x123'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x2b')});db[_0xec80('0x12e')][_0xec80('0x122')](db['Team'],{'as':_0xec80('0x158'),'through':_0xec80('0x107')});db['VoiceQueue']['belongsToMany'](db[_0xec80('0xf4')],{'as':'BlackLists','through':_0xec80('0x159')});db[_0xec80('0x17')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x10e'),'foreignKey':_0xec80('0x110')});db[_0xec80('0x18')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x10e'),'foreignKey':'UserId'});db[_0xec80('0x1a')][_0xec80('0x113')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x15a'),'sourceKey':_0xec80('0x15b')});db[_0xec80('0x1c')][_0xec80('0x14f')](db['VoiceMail'],{'foreignKey':_0xec80('0x15a'),'targetKey':'mailbox'});db[_0xec80('0x1e')][_0xec80('0x113')](db[_0xec80('0x22')],{'as':_0xec80('0x15c'),'foreignKey':_0xec80('0x15d'),'constraints':![]});db[_0xec80('0x1e')][_0xec80('0x113')](db[_0xec80('0x20')],{'as':_0xec80('0x15e'),'foreignKey':_0xec80('0x15d'),'constraints':![]});db[_0xec80('0x1e')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':'User','foreignKey':_0xec80('0x110')});db[_0xec80('0x1e')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x37')]['belongsTo'](db['MailAccount'],{'as':_0xec80('0x13a'),'foreignKey':_0xec80('0x161')});db[_0xec80('0x37')]['belongsTo'](db[_0xec80('0x105')],{'as':_0xec80('0x105'),'foreignKey':_0xec80('0x162'),'onDelete':_0xec80('0x163')});db[_0xec80('0x39')][_0xec80('0x14f')](db[_0xec80('0x13a')],{'as':_0xec80('0x13a'),'foreignKey':'MailAccountId'});db[_0xec80('0x39')][_0xec80('0x14f')](db[_0xec80('0x105')],{'as':_0xec80('0x105'),'foreignKey':_0xec80('0x162'),'onDelete':_0xec80('0x163')});db[_0xec80('0x13a')]['hasOne'](db[_0xec80('0x37')],{'as':_0xec80('0x164'),'onDelete':_0xec80('0x112')});db[_0xec80('0x13a')][_0xec80('0x10f')](db[_0xec80('0x39')],{'as':_0xec80('0x165'),'onDelete':_0xec80('0x112')});db['MailAccount']['hasMany'](db[_0xec80('0x166')],{'as':_0xec80('0x167'),'foreignKey':'MailAccountId','onDelete':_0xec80('0x112')});db[_0xec80('0x13a')]['hasMany'](db[_0xec80('0x7c')],{'as':'Answers','foreignKey':_0xec80('0x161')});db[_0xec80('0x13a')][_0xec80('0x113')](db['MailMessage'],{'as':_0xec80('0x168'),'foreignKey':_0xec80('0x161')});db['MailAccount'][_0xec80('0x113')](db['MailInteraction'],{'as':_0xec80('0x169')});db[_0xec80('0x13a')]['hasMany'](db['MailApplication'],{'as':_0xec80('0x147')});db['MailAccount'][_0xec80('0x14f')](db['CmList'],{'as':_0xec80('0x16a'),'foreignKey':'ListId'});db[_0xec80('0x13a')][_0xec80('0x14f')](db[_0xec80('0x8c')],{'as':_0xec80('0x8c'),'foreignKey':_0xec80('0x16b')});db[_0xec80('0x13a')]['belongsTo'](db[_0xec80('0x154')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xec80('0x13a')][_0xec80('0x122')](db['User'],{'as':_0xec80('0x157'),'through':_0xec80('0x13b')});db['MailQueue'][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x2f')});db[_0xec80('0x3c')]['belongsToMany'](db[_0xec80('0xe1')],{'through':_0xec80('0x16c'),'as':'Teams'});db[_0xec80('0x119')][_0xec80('0x113')](db[_0xec80('0x16d')],{'as':_0xec80('0x168'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0xec80('0x119')][_0xec80('0x14f')](db[_0xec80('0x13a')],{'as':'Account','foreignKey':_0xec80('0x161')});db[_0xec80('0x119')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x119')]['belongsTo'](db[_0xec80('0x10e')],{'as':_0xec80('0x16e'),'foreignKey':'UserId'});db[_0xec80('0x119')][_0xec80('0x122')](db['Tag'],{'through':_0xec80('0x16f'),'as':_0xec80('0x170')});db['MailInteraction'][_0xec80('0x122')](db[_0xec80('0x171')],{'through':'mail_interaction_has_tags','as':_0xec80('0x172')});db['MailInteraction'][_0xec80('0x122')](db['User'],{'as':_0xec80('0x173'),'through':_0xec80('0x127'),'foreignKey':_0xec80('0x174')});db['MailMessage'][_0xec80('0x113')](db[_0xec80('0xe9')],{'as':_0xec80('0x175'),'onDelete':'cascade'});db[_0xec80('0x16d')]['belongsTo'](db[_0xec80('0x10e')],{'as':_0xec80('0x10e')});db[_0xec80('0x16d')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x15f')});db['MailMessage'][_0xec80('0x14f')](db[_0xec80('0x119')],{'as':_0xec80('0x176'),'foreignKey':_0xec80('0x174')});db[_0xec80('0x16d')][_0xec80('0x14f')](db[_0xec80('0x13a')],{'as':_0xec80('0x177'),'foreignKey':'MailAccountId'});db['MailMessage'][_0xec80('0x14f')](db[_0xec80('0x5f')],{'as':_0xec80('0x5f'),'foreignKey':_0xec80('0x178')});db[_0xec80('0x16d')][_0xec80('0x14f')](db[_0xec80('0x179')],{'as':'ChatOfflineMessage','foreignKey':_0xec80('0x17a')});db[_0xec80('0x17b')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x163')});db[_0xec80('0x17b')]['belongsTo'](db[_0xec80('0x3c')],{'onDelete':'restrict'});db[_0xec80('0x17b')][_0xec80('0x14f')](db['MailAccount'],{'onDelete':_0xec80('0x163')});db[_0xec80('0x17b')][_0xec80('0x14f')](db[_0xec80('0x7f')],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x153')});db['MailApplication'][_0xec80('0x14f')](db[_0xec80('0x171')],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x17c')});db[_0xec80('0x41')]['belongsTo'](db[_0xec80('0x13a')],{});db[_0xec80('0x41')][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':'ListId'});db[_0xec80('0x41')][_0xec80('0x14f')](db['CmContact'],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x41')][_0xec80('0x14f')](db['MailInteraction'],{});db[_0xec80('0x41')][_0xec80('0x14f')](db[_0xec80('0x16d')],{});db[_0xec80('0x41')][_0xec80('0x14f')](db[_0xec80('0x10e')],{});db[_0xec80('0x41')][_0xec80('0x14f')](db[_0xec80('0x3c')],{});db['Dashboard']['hasMany'](db[_0xec80('0x44')],{'as':'Items','onDelete':_0xec80('0x112')});db[_0xec80('0x137')]['hasMany'](db[_0xec80('0x166')],{'as':_0xec80('0x167'),'foreignKey':'FaxAccountId','onDelete':_0xec80('0x112')});db[_0xec80('0x137')][_0xec80('0x113')](db[_0xec80('0x7c')],{'as':_0xec80('0x17d'),'foreignKey':_0xec80('0x17e')});db['FaxAccount']['hasMany'](db[_0xec80('0x49')],{'as':_0xec80('0x169')});db[_0xec80('0x137')]['hasMany'](db['FaxApplication'],{'as':_0xec80('0x147')});db[_0xec80('0x137')][_0xec80('0x113')](db[_0xec80('0x14')],{'as':_0xec80('0x17f'),'onDelete':_0xec80('0x112')});db['FaxAccount'][_0xec80('0x113')](db[_0xec80('0x4b')],{'as':_0xec80('0x168')});db[_0xec80('0x137')][_0xec80('0x14f')](db[_0xec80('0x150')],{'as':'Trunk'});db[_0xec80('0x137')]['belongsTo'](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180')});db[_0xec80('0x137')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xec80('0x137')]['belongsToMany'](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x139')});db[_0xec80('0x47')][_0xec80('0x14f')](db['User'],{'onDelete':_0xec80('0x163')});db[_0xec80('0x47')]['belongsTo'](db[_0xec80('0x4d')],{'onDelete':_0xec80('0x163')});db[_0xec80('0x47')][_0xec80('0x14f')](db['FaxAccount'],{'onDelete':'restrict'});db[_0xec80('0x47')]['belongsTo'](db[_0xec80('0x171')],{'onDelete':'restrict','foreignKey':_0xec80('0x17c')});db[_0xec80('0x49')][_0xec80('0x113')](db[_0xec80('0x4b')],{'as':_0xec80('0x168'),'onDelete':'cascade','foreignKey':_0xec80('0x181')});db[_0xec80('0x49')][_0xec80('0x14f')](db['FaxAccount'],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x17e')});db['FaxInteraction'][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':'Contact','foreignKey':_0xec80('0x160')});db[_0xec80('0x49')][_0xec80('0x14f')](db['User'],{'as':'Owner','foreignKey':_0xec80('0x110')});db[_0xec80('0x49')][_0xec80('0x122')](db['Tag'],{'through':_0xec80('0x182'),'as':_0xec80('0x170')});db['FaxInteraction']['belongsToMany'](db[_0xec80('0x171')],{'through':_0xec80('0x182'),'as':_0xec80('0x172')});db[_0xec80('0x49')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x173'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0xec80('0x4b')]['belongsTo'](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x10e')});db[_0xec80('0x4b')]['belongsTo'](db[_0xec80('0x49')],{'as':_0xec80('0x176'),'foreignKey':_0xec80('0x181')});db['FaxMessage'][_0xec80('0x14f')](db[_0xec80('0x6f')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x15f')});db[_0xec80('0x4b')][_0xec80('0x14f')](db[_0xec80('0xe9')],{'as':_0xec80('0xe9'),'foreignKey':_0xec80('0x183')});db[_0xec80('0x4b')][_0xec80('0x14f')](db[_0xec80('0x137')],{'as':'Account','foreignKey':_0xec80('0x17e')});db[_0xec80('0x4d')][_0xec80('0x122')](db['User'],{'as':_0xec80('0x157'),'through':_0xec80('0x31')});db[_0xec80('0x4d')][_0xec80('0x122')](db[_0xec80('0xe1')],{'through':_0xec80('0x184'),'as':'Teams'});db[_0xec80('0x4f')][_0xec80('0x14f')](db[_0xec80('0x137')],{});db[_0xec80('0x4f')][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180')});db[_0xec80('0x4f')]['belongsTo'](db['CmContact'],{'as':_0xec80('0x15f'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0xec80('0x14f')](db[_0xec80('0x49')],{});db[_0xec80('0x4f')][_0xec80('0x14f')](db[_0xec80('0x4b')],{});db[_0xec80('0x4f')][_0xec80('0x14f')](db[_0xec80('0x10e')],{});db[_0xec80('0x4f')][_0xec80('0x14f')](db[_0xec80('0x4d')],{});db[_0xec80('0x51')][_0xec80('0x113')](db[_0xec80('0x166')],{'as':_0xec80('0x167'),'foreignKey':_0xec80('0x185'),'onDelete':'cascade'});db[_0xec80('0x51')][_0xec80('0x113')](db[_0xec80('0x7c')],{'as':'Answers','foreignKey':'SmsAccountId'});db['SmsAccount'][_0xec80('0x113')](db['SmsMessage'],{'as':'Messages','foreignKey':_0xec80('0x185')});db[_0xec80('0x51')][_0xec80('0x113')](db['SmsInteraction'],{'as':_0xec80('0x169')});db[_0xec80('0x51')][_0xec80('0x113')](db[_0xec80('0x186')],{'as':_0xec80('0x147')});db[_0xec80('0x51')][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':'ListId'});db[_0xec80('0x51')]['belongsTo'](db['Pause'],{'as':_0xec80('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xec80('0x51')]['belongsToMany'](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x13f')});db[_0xec80('0x186')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x163')});db['SmsApplication'][_0xec80('0x14f')](db[_0xec80('0x56')],{'onDelete':'restrict'});db[_0xec80('0x186')][_0xec80('0x14f')](db[_0xec80('0x51')],{'onDelete':_0xec80('0x163')});db['SmsApplication']['belongsTo'](db['Interval'],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x153')});db[_0xec80('0x186')][_0xec80('0x14f')](db['Tag'],{'onDelete':_0xec80('0x163'),'foreignKey':'TagId'});db[_0xec80('0x53')][_0xec80('0x113')](db[_0xec80('0x55')],{'as':_0xec80('0x168'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x187')});db['SmsInteraction']['belongsTo'](db[_0xec80('0x51')],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x185')});db[_0xec80('0x53')]['belongsTo'](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':'ContactId'});db[_0xec80('0x53')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x16e'),'foreignKey':_0xec80('0x110')});db[_0xec80('0x53')][_0xec80('0x122')](db['Tag'],{'through':_0xec80('0x188'),'as':_0xec80('0x170')});db[_0xec80('0x53')]['belongsToMany'](db[_0xec80('0x171')],{'through':_0xec80('0x188'),'as':_0xec80('0x172')});db[_0xec80('0x53')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x173'),'through':_0xec80('0x189'),'foreignKey':_0xec80('0x187')});db['SmsMessage'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x10e')});db[_0xec80('0x55')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'onDelete':'cascade','as':_0xec80('0x15f')});db[_0xec80('0x55')]['belongsTo'](db[_0xec80('0x53')],{'onDelete':_0xec80('0x112'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0xec80('0x55')][_0xec80('0x14f')](db[_0xec80('0x51')],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x185')});db[_0xec80('0x56')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':'Agents','through':_0xec80('0x134'),'foreignKey':_0xec80('0x18a')});db[_0xec80('0x56')][_0xec80('0x122')](db['Team'],{'through':_0xec80('0x18b'),'as':_0xec80('0x158')});db[_0xec80('0x13c')][_0xec80('0x113')](db[_0xec80('0x166')],{'as':'Dispositions','foreignKey':_0xec80('0x18c'),'onDelete':'cascade'});db['OpenchannelAccount'][_0xec80('0x113')](db[_0xec80('0x7c')],{'as':_0xec80('0x17d'),'foreignKey':_0xec80('0x18c')});db[_0xec80('0x13c')][_0xec80('0x113')](db[_0xec80('0x5a')],{'as':_0xec80('0x169'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xec80('0x113')](db[_0xec80('0x18d')],{'as':_0xec80('0x168'),'foreignKey':_0xec80('0x18c')});db[_0xec80('0x13c')][_0xec80('0x113')](db['OpenchannelApplication'],{'as':_0xec80('0x147'),'foreignKey':_0xec80('0x18c')});db[_0xec80('0x13c')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xec80('0x180')});db[_0xec80('0x13c')][_0xec80('0x14f')](db[_0xec80('0x154')],{'as':'mandatoryDispositionPause','foreignKey':_0xec80('0x156')});db[_0xec80('0x13c')]['belongsToMany'](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x13e')});db[_0xec80('0x58')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x163')});db[_0xec80('0x58')][_0xec80('0x14f')](db[_0xec80('0x5d')],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x18e')});db[_0xec80('0x58')][_0xec80('0x14f')](db[_0xec80('0x13c')],{'onDelete':_0xec80('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0xec80('0x58')][_0xec80('0x14f')](db[_0xec80('0x7f')],{'onDelete':_0xec80('0x163'),'foreignKey':'IntervalId'});db[_0xec80('0x58')][_0xec80('0x14f')](db[_0xec80('0x171')],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x17c')});db[_0xec80('0x5a')][_0xec80('0x113')](db[_0xec80('0x18d')],{'as':_0xec80('0x168'),'onDelete':'cascade','foreignKey':_0xec80('0x18f')});db['OpenchannelInteraction']['belongsTo'](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0xec80('0x18c')});db[_0xec80('0x5a')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x5a')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x16e'),'foreignKey':_0xec80('0x110')});db['OpenchannelInteraction'][_0xec80('0x122')](db[_0xec80('0x171')],{'through':'openchannel_interaction_has_tags','as':_0xec80('0x170')});db[_0xec80('0x5a')][_0xec80('0x122')](db['Tag'],{'through':_0xec80('0x190'),'as':_0xec80('0x172')});db[_0xec80('0x5a')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x173'),'through':_0xec80('0x191'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x10e')});db[_0xec80('0x18d')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x15f')});db[_0xec80('0x18d')][_0xec80('0x14f')](db[_0xec80('0x5a')],{'onDelete':'cascade','as':_0xec80('0x176'),'foreignKey':_0xec80('0x18f')});db[_0xec80('0x18d')][_0xec80('0x14f')](db[_0xec80('0xe9')],{'as':'Attachment','foreignKey':_0xec80('0x183')});db['OpenchannelMessage']['belongsTo'](db[_0xec80('0x13c')],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x18c')});db['OpenchannelQueue']['belongsToMany'](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x34'),'foreignKey':_0xec80('0x18e')});db[_0xec80('0x5d')][_0xec80('0x122')](db['Team'],{'through':_0xec80('0x192'),'as':_0xec80('0x158')});db['ChatWebsite']['hasMany'](db[_0xec80('0x166')],{'as':_0xec80('0x167'),'foreignKey':_0xec80('0x178'),'onDelete':'cascade'});db[_0xec80('0x5f')][_0xec80('0x113')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xec80('0x178')});db[_0xec80('0x5f')][_0xec80('0x113')](db['ChatProactiveAction'],{'as':_0xec80('0x193')});db[_0xec80('0x5f')][_0xec80('0x113')](db[_0xec80('0x63')],{'as':_0xec80('0x169')});db['ChatWebsite'][_0xec80('0x113')](db[_0xec80('0x194')],{'as':_0xec80('0x147')});db[_0xec80('0x5f')][_0xec80('0x113')](db[_0xec80('0x65')],{'as':_0xec80('0x168')});db['ChatWebsite'][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':'List','foreignKey':_0xec80('0x180')});db[_0xec80('0x5f')]['belongsTo'](db[_0xec80('0x7f')],{'as':'Interval','foreignKey':_0xec80('0x153')});db[_0xec80('0x5f')]['belongsTo'](db[_0xec80('0x13a')],{'as':_0xec80('0x13a'),'foreignKey':'MailAccountId'});db['ChatWebsite']['belongsTo'](db[_0xec80('0x154')],{'as':_0xec80('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xec80('0x5f')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':'user_has_chat_websites'});db[_0xec80('0x61')][_0xec80('0x14f')](db[_0xec80('0x13c')],{});db[_0xec80('0x61')][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':'List','foreignKey':_0xec80('0x180')});db[_0xec80('0x61')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':'Contact','foreignKey':_0xec80('0x160')});db[_0xec80('0x61')][_0xec80('0x14f')](db[_0xec80('0x5a')],{});db['OpenchannelQueueReport'][_0xec80('0x14f')](db[_0xec80('0x18d')],{});db[_0xec80('0x61')][_0xec80('0x14f')](db[_0xec80('0x10e')],{});db['OpenchannelQueueReport'][_0xec80('0x14f')](db[_0xec80('0x5d')],{});db[_0xec80('0x194')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x195'),'foreignKey':_0xec80('0x110'),'onDelete':_0xec80('0x163')});db[_0xec80('0x194')][_0xec80('0x14f')](db['ChatQueue'],{'as':_0xec80('0x196'),'foreignKey':_0xec80('0x197'),'onDelete':'restrict'});db[_0xec80('0x194')][_0xec80('0x14f')](db['ChatWebsite'],{'as':_0xec80('0x198'),'foreignKey':_0xec80('0x178'),'onDelete':'restrict'});db['ChatApplication'][_0xec80('0x14f')](db['Tag'],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x17c')});db[_0xec80('0x63')][_0xec80('0x113')](db[_0xec80('0x65')],{'as':'Messages','onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x199')});db[_0xec80('0x63')][_0xec80('0x14f')](db[_0xec80('0x5f')],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x178')});db[_0xec80('0x63')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160')});db['ChatInteraction'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x16e'),'foreignKey':'UserId'});db['ChatInteraction']['belongsToMany'](db[_0xec80('0x171')],{'through':_0xec80('0x19a'),'as':'Tags'});db['ChatInteraction'][_0xec80('0x122')](db[_0xec80('0x171')],{'through':_0xec80('0x19a'),'as':_0xec80('0x172')});db[_0xec80('0x63')][_0xec80('0x122')](db['User'],{'as':_0xec80('0x173'),'through':_0xec80('0x128'),'foreignKey':'ChatInteractionId'});db[_0xec80('0x65')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':'cascade','as':_0xec80('0x10e')});db['ChatMessage'][_0xec80('0x14f')](db[_0xec80('0x6f')],{'onDelete':_0xec80('0x112'),'as':'Contact','foreignKey':'ContactId'});db['ChatMessage'][_0xec80('0x14f')](db['ChatInteraction'],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x176'),'foreignKey':_0xec80('0x199')});db[_0xec80('0x65')][_0xec80('0x14f')](db['Attachment'],{'as':_0xec80('0xe9'),'foreignKey':_0xec80('0x183')});db[_0xec80('0x65')]['belongsTo'](db[_0xec80('0x5f')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xec80('0x179')][_0xec80('0x113')](db[_0xec80('0xe9')],{'as':_0xec80('0x175'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0xec80('0x179')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x15f'),'foreignKey':'ContactId'});db[_0xec80('0x179')][_0xec80('0x14f')](db[_0xec80('0x5f')],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x178')});db[_0xec80('0x68')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x2d'),'hooks':!![]});db[_0xec80('0x68')]['belongsToMany'](db['Team'],{'through':'team_has_chat_queues','as':_0xec80('0x158')});db[_0xec80('0x6a')][_0xec80('0x113')](db['ChatInternalMessage'],{'as':_0xec80('0x168'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0xec80('0x6a')][_0xec80('0x122')](db['User'],{'as':_0xec80('0x149'),'through':_0xec80('0x120')});db[_0xec80('0x6b')][_0xec80('0x14f')](db[_0xec80('0x5f')],{'as':_0xec80('0x198'),'foreignKey':_0xec80('0x178')});db[_0xec80('0x6d')][_0xec80('0x113')](db[_0xec80('0x6f')],{'as':_0xec80('0x19b'),'foreignKey':_0xec80('0x19c')});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0xec80('0x19d')});db[_0xec80('0x6f')][_0xec80('0x113')](db['CmHopper'],{'as':_0xec80('0x19e'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x6f')]['hasMany'](db[_0xec80('0x74')],{'as':_0xec80('0x115'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x6f')][_0xec80('0x113')](db['CmHopperHistory'],{'as':_0xec80('0x14c'),'foreignKey':'ContactId'});db['CmContact'][_0xec80('0x113')](db['ReportAgentPreview'],{'as':_0xec80('0x77'),'foreignKey':'ContactId'});db[_0xec80('0x6f')]['hasMany'](db[_0xec80('0x19f')],{'as':_0xec80('0x14e'),'foreignKey':'ContactId'});db[_0xec80('0x6f')][_0xec80('0x113')](db[_0xec80('0x5a')],{'as':_0xec80('0x117'),'foreignKey':_0xec80('0x160'),'onDelete':_0xec80('0x163')});db[_0xec80('0x6f')]['hasMany'](db[_0xec80('0x63')],{'as':_0xec80('0x118'),'foreignKey':_0xec80('0x160'),'onDelete':_0xec80('0x163')});db['CmContact']['hasMany'](db['SmsInteraction'],{'as':_0xec80('0x12b'),'foreignKey':_0xec80('0x160'),'onDelete':_0xec80('0x163')});db[_0xec80('0x6f')][_0xec80('0x113')](db[_0xec80('0x49')],{'as':_0xec80('0x129'),'foreignKey':_0xec80('0x160'),'onDelete':_0xec80('0x163')});db[_0xec80('0x6f')]['hasMany'](db[_0xec80('0x119')],{'as':_0xec80('0x126'),'foreignKey':'ContactId','onDelete':_0xec80('0x163')});db[_0xec80('0x6f')][_0xec80('0x14f')](db[_0xec80('0x6d')],{'as':_0xec80('0x1a0'),'foreignKey':'CompanyId'});db['CmContact'][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180'),'onDelete':_0xec80('0x112')});db[_0xec80('0x6f')]['belongsToMany'](db['User'],{'as':'Users','through':_0xec80('0x121')});db[_0xec80('0x6f')][_0xec80('0x122')](db[_0xec80('0x171')],{'as':'Tags','through':_0xec80('0x1a1')});db[_0xec80('0x6f')][_0xec80('0x122')](db[_0xec80('0x171')],{'through':_0xec80('0x1a1'),'as':_0xec80('0x172')});db[_0xec80('0x1a2')]['hasMany'](db[_0xec80('0x8b')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0xec80('0x1a2')][_0xec80('0x14f')](db['CmContact'],{'as':'Contact','foreignKey':_0xec80('0x160'),'onDelete':_0xec80('0x112')});db['CmHopper'][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180'),'onDelete':_0xec80('0x112')});db[_0xec80('0x1a2')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x195'),'foreignKey':_0xec80('0x110')});db[_0xec80('0x1a2')][_0xec80('0x14f')](db['VoiceQueue'],{'as':_0xec80('0x196'),'foreignKey':_0xec80('0x14a'),'onDelete':'cascade'});db[_0xec80('0x1a2')]['belongsTo'](db['Campaign'],{'as':_0xec80('0xe5'),'foreignKey':_0xec80('0x1a3'),'onDelete':'cascade'});db['CmHopper'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':'Owner','foreignKey':_0xec80('0x1a4')});db['CmHopperBlack'][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160'),'onDelete':_0xec80('0x112')});db[_0xec80('0x72')]['belongsTo'](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180'),'onDelete':_0xec80('0x112')});db[_0xec80('0x72')][_0xec80('0x14f')](db['VoiceQueue'],{'as':_0xec80('0x196'),'foreignKey':_0xec80('0x14a'),'onDelete':_0xec80('0x112')});db[_0xec80('0x72')]['belongsTo'](db[_0xec80('0xe5')],{'as':_0xec80('0xe5'),'foreignKey':_0xec80('0x1a3'),'onDelete':'cascade'});db[_0xec80('0x1a5')][_0xec80('0x113')](db[_0xec80('0x7e')],{'as':{'plural':_0xec80('0x1a6'),'singular':_0xec80('0x1a7')},'foreignKey':_0xec80('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0xec80('0x1a5')]['hasMany'](db[_0xec80('0x7e')],{'as':{'plural':'Any','singular':_0xec80('0x1a9')},'foreignKey':'AutomationAnyId','onDelete':_0xec80('0x112'),'hooks':!![]});db['Automation'][_0xec80('0x113')](db[_0xec80('0x7a')],{'as':'Actions','foreignKey':_0xec80('0x1aa'),'onDelete':_0xec80('0x112'),'hooks':!![]});db['Disposition'][_0xec80('0x113')](db[_0xec80('0x166')],{'as':_0xec80('0x167'),'foreignKey':_0xec80('0x1ab'),'onDelete':_0xec80('0x112')});db[_0xec80('0x7f')][_0xec80('0x113')](db[_0xec80('0x7f')],{'as':_0xec80('0x1ac'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0xec80('0x113')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0xec80('0x153'),'onDelete':_0xec80('0x163')});db[_0xec80('0x7f')][_0xec80('0x113')](db['MailApplication'],{'as':_0xec80('0x1ad'),'foreignKey':'IntervalId'});db['Interval'][_0xec80('0x113')](db[_0xec80('0x194')],{'as':_0xec80('0x1ae'),'foreignKey':_0xec80('0x153')});db[_0xec80('0x7f')][_0xec80('0x113')](db[_0xec80('0x47')],{'as':_0xec80('0x1af'),'foreignKey':_0xec80('0x153')});db[_0xec80('0x7f')][_0xec80('0x113')](db['SmsApplication'],{'as':_0xec80('0x1b0'),'foreignKey':_0xec80('0x153')});db[_0xec80('0x86')][_0xec80('0x14f')](db[_0xec80('0x13a')],{});db[_0xec80('0x86')][_0xec80('0x14f')](db[_0xec80('0x96')],{'foreignKey':_0xec80('0x1b1')});db[_0xec80('0x86')][_0xec80('0x14f')](db[_0xec80('0x94')],{'foreignKey':_0xec80('0x1b2')});db['Sound']['belongsToMany'](db[_0xec80('0x148')],{'as':'Mohs','through':_0xec80('0x1b3'),'onDelete':'restrict'});db[_0xec80('0x171')][_0xec80('0x122')](db[_0xec80('0x6f')],{'through':_0xec80('0x1a1')});db[_0xec80('0x171')][_0xec80('0x122')](db[_0xec80('0x63')],{'through':_0xec80('0x19a')});db[_0xec80('0x171')][_0xec80('0x122')](db[_0xec80('0x119')],{'through':_0xec80('0x16f')});db['Tag'][_0xec80('0x122')](db[_0xec80('0x53')],{'through':_0xec80('0x188')});db[_0xec80('0x171')][_0xec80('0x122')](db[_0xec80('0x49')],{'through':_0xec80('0x182')});db[_0xec80('0x171')][_0xec80('0x122')](db[_0xec80('0x5a')],{'through':_0xec80('0x190')});db[_0xec80('0x171')]['belongsToMany'](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0xec80('0x1b4')][_0xec80('0x14f')](db[_0xec80('0x1b5')],{'as':_0xec80('0x1b6'),'foreignKey':_0xec80('0x1b7')});db['CmHopperAdditionalPhone'][_0xec80('0x14f')](db[_0xec80('0x1a2')],{'as':_0xec80('0x1b8'),'foreignKey':_0xec80('0x1b9')});db[_0xec80('0x1b4')]['belongsTo'](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x19d')});db[_0xec80('0x8d')][_0xec80('0x113')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xec80('0x1ba')},'foreignKey':'TriggerAllId','onDelete':_0xec80('0x112'),'hooks':!![]});db[_0xec80('0x8d')]['hasMany'](db[_0xec80('0x7e')],{'as':{'plural':_0xec80('0x1bb'),'singular':_0xec80('0x1bc')},'foreignKey':_0xec80('0x1bd'),'onDelete':_0xec80('0x112'),'hooks':!![]});db[_0xec80('0x8d')][_0xec80('0x113')](db['Action'],{'as':_0xec80('0x1be'),'foreignKey':_0xec80('0x1bf'),'onDelete':_0xec80('0x112'),'hooks':!![]});db[_0xec80('0x94')][_0xec80('0x113')](db[_0xec80('0x9c')],{'as':_0xec80('0x1c0'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1b2'),'hooks':!![]});db[_0xec80('0x96')][_0xec80('0x113')](db['AnalyticFieldReport'],{'as':_0xec80('0x1c0'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1b1')});db[_0xec80('0x9a')][_0xec80('0x113')](db[_0xec80('0x9c')],{'as':_0xec80('0x1c0'),'onDelete':'cascade','foreignKey':_0xec80('0x1c1')});db['AnalyticFieldReport']['belongsTo'](db[_0xec80('0x9a')],{'foreignKey':'MetricId'});db[_0xec80('0x9f')][_0xec80('0x113')](db[_0xec80('0x1c2')],{'as':_0xec80('0x1c3'),'onDelete':'cascade','foreignKey':_0xec80('0x1c4')});db['SalesforceConfiguration'][_0xec80('0x113')](db[_0xec80('0xa1')],{'as':_0xec80('0x1c5'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0x1c2')][_0xec80('0x113')](db[_0xec80('0xa1')],{'as':_0xec80('0x1c7'),'onDelete':'cascade','foreignKey':_0xec80('0x1c8')});db[_0xec80('0x1c2')][_0xec80('0x113')](db[_0xec80('0xa1')],{'as':_0xec80('0x1c0'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0x1c2')]['belongsTo'](db['SalesforceAccount'],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0xa1')][_0xec80('0x113')](db[_0xec80('0xa1')],{'as':'Subject','foreignKey':_0xec80('0x1c6')});db[_0xec80('0xa1')]['hasMany'](db[_0xec80('0xa1')],{'as':'Description','foreignKey':_0xec80('0x1c8')});db[_0xec80('0xa1')][_0xec80('0x113')](db[_0xec80('0xa1')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0xa1')][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0xa3')][_0xec80('0x113')](db['SugarcrmConfiguration'],{'as':_0xec80('0x1c3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xec80('0xa5')]['hasMany'](db[_0xec80('0x1cc')],{'as':'Subjects','onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0xa5')][_0xec80('0x113')](db['SugarcrmField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xec80('0xa5')][_0xec80('0x113')](db['SugarcrmField'],{'as':_0xec80('0x1c0'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0xa5')][_0xec80('0x14f')](db[_0xec80('0xa3')],{'as':_0xec80('0x177'),'foreignKey':'AccountId'});db['SugarcrmField'][_0xec80('0x113')](db[_0xec80('0x1cc')],{'as':'Subject','foreignKey':_0xec80('0x1c6')});db['SugarcrmField']['hasMany'](db[_0xec80('0x1cc')],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db['SugarcrmField']['hasMany'](db[_0xec80('0x1cc')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0x1cc')]['belongsTo'](db['Variable'],{'as':_0xec80('0x8f'),'foreignKey':'VariableId'});db[_0xec80('0xa8')]['hasMany'](db['DeskConfiguration'],{'as':_0xec80('0x1c3'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0x1ce')][_0xec80('0x113')](db[_0xec80('0xab')],{'as':_0xec80('0x1c5'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xec80('0x1ce')]['hasMany'](db[_0xec80('0xab')],{'as':_0xec80('0x1c7'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xec80('0x1ce')][_0xec80('0x113')](db['DeskField'],{'as':'Fields','onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0x1ce')][_0xec80('0x14f')](db['DeskAccount'],{'as':_0xec80('0x177'),'foreignKey':'AccountId'});db['DeskConfiguration']['belongsToMany'](db[_0xec80('0x171')],{'through':_0xec80('0x1cf')});db[_0xec80('0xab')][_0xec80('0x113')](db[_0xec80('0xab')],{'as':'Subject','foreignKey':_0xec80('0x1c6')});db[_0xec80('0xab')][_0xec80('0x113')](db['DeskField'],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0xab')]['hasMany'](db[_0xec80('0xab')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db['DeskField'][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0x1d0')][_0xec80('0x113')](db[_0xec80('0x1d1')],{'as':_0xec80('0x1c3'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0x1d1')][_0xec80('0x113')](db[_0xec80('0xae')],{'as':_0xec80('0x1c5'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0x1d1')][_0xec80('0x113')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0x1d1')]['hasMany'](db[_0xec80('0xae')],{'as':'Fields','onDelete':_0xec80('0x112'),'foreignKey':'FieldId'});db[_0xec80('0x1d1')][_0xec80('0x14f')](db[_0xec80('0x1d0')],{'as':_0xec80('0x177'),'foreignKey':'AccountId'});db[_0xec80('0xae')]['hasMany'](db[_0xec80('0xae')],{'as':'Subject','foreignKey':_0xec80('0x1c6')});db[_0xec80('0xae')][_0xec80('0x113')](db[_0xec80('0xae')],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db['ZohoField']['hasMany'](db[_0xec80('0xae')],{'as':_0xec80('0x1ca'),'foreignKey':'FieldId'});db['ZohoField']['belongsTo'](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0xb0')][_0xec80('0x113')](db[_0xec80('0xb2')],{'as':_0xec80('0x1c3'),'onDelete':_0xec80('0x112'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xec80('0x113')](db[_0xec80('0x1d2')],{'as':_0xec80('0x1c5'),'foreignKey':'SubjectId'});db[_0xec80('0xb2')][_0xec80('0x113')](db['ZendeskField'],{'as':_0xec80('0x1c7'),'foreignKey':_0xec80('0x1c8')});db['ZendeskConfiguration'][_0xec80('0x113')](db['ZendeskField'],{'as':_0xec80('0x1c0'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0xec80('0x14f')](db['ZendeskAccount'],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0xb2')][_0xec80('0x122')](db['Tag'],{'through':_0xec80('0x1d3')});db[_0xec80('0x1d2')]['hasMany'](db[_0xec80('0x1d2')],{'as':'Subject','foreignKey':_0xec80('0x1c6')});db[_0xec80('0x1d2')]['hasMany'](db[_0xec80('0x1d2')],{'as':'Description','foreignKey':_0xec80('0x1c8')});db[_0xec80('0x1d2')][_0xec80('0x113')](db[_0xec80('0x1d2')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db['ZendeskField'][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':'Variable','foreignKey':_0xec80('0x1cb')});db[_0xec80('0xb5')][_0xec80('0x113')](db[_0xec80('0xb7')],{'as':_0xec80('0x1c3'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0xb7')][_0xec80('0x113')](db['FreshdeskField'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0xec80('0xb7')]['hasMany'](db[_0xec80('0xb8')],{'as':_0xec80('0x1c7'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0xb7')][_0xec80('0x113')](db[_0xec80('0xb8')],{'as':_0xec80('0x1c0'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c9')});db['FreshdeskConfiguration']['belongsTo'](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0xec80('0x1c4')});db[_0xec80('0xb7')][_0xec80('0x122')](db[_0xec80('0x171')],{'through':_0xec80('0x1d4')});db[_0xec80('0xb8')][_0xec80('0x113')](db['FreshdeskField'],{'as':_0xec80('0x1d5'),'foreignKey':'SubjectId'});db[_0xec80('0xb8')][_0xec80('0x113')](db[_0xec80('0xb8')],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0xb8')][_0xec80('0x113')](db[_0xec80('0xb8')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0xb8')][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':'Variable','foreignKey':_0xec80('0x1cb')});db[_0xec80('0xb9')][_0xec80('0x113')](db[_0xec80('0xbb')],{'as':_0xec80('0x1c3'),'onDelete':_0xec80('0x112'),'foreignKey':'AccountId'});db[_0xec80('0xbb')][_0xec80('0x113')](db['VtigerField'],{'as':_0xec80('0x1c5'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0xbb')][_0xec80('0x113')](db['VtigerField'],{'as':_0xec80('0x1c7'),'foreignKey':_0xec80('0x1c8')});db['VtigerConfiguration'][_0xec80('0x113')](db[_0xec80('0x1d6')],{'as':_0xec80('0x1c0'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0xbb')][_0xec80('0x14f')](db['VtigerAccount'],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0x1d6')]['hasMany'](db[_0xec80('0x1d6')],{'as':_0xec80('0x1d5'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0x1d6')][_0xec80('0x113')](db[_0xec80('0x1d6')],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0x1d6')]['hasMany'](db['VtigerField'],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db['VtigerField'][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0xbe')]['hasMany'](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xec80('0xc0')][_0xec80('0x113')](db[_0xec80('0xc1')],{'as':_0xec80('0x1c5'),'foreignKey':'SubjectId'});db['ServicenowConfiguration']['hasMany'](db[_0xec80('0xc1')],{'as':_0xec80('0x1c7'),'foreignKey':'DescriptionId'});db[_0xec80('0xc0')][_0xec80('0x113')](db[_0xec80('0xc1')],{'as':_0xec80('0x1c0'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0xc0')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xec80('0x1c4')});db[_0xec80('0xc1')][_0xec80('0x113')](db[_0xec80('0xc1')],{'as':_0xec80('0x1d5'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0xc1')][_0xec80('0x113')](db['ServicenowField'],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0xc1')][_0xec80('0x113')](db[_0xec80('0xc1')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db['ServicenowField'][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0xc3')][_0xec80('0x113')](db[_0xec80('0x1d7')],{'as':'Configurations','onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c4')});db['Dynamics365Account'][_0xec80('0x14f')](db[_0xec80('0x105')],{'as':_0xec80('0x105'),'foreignKey':_0xec80('0x162')});db[_0xec80('0x1d7')][_0xec80('0x113')](db[_0xec80('0xc6')],{'as':_0xec80('0x1c5'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0x1d7')][_0xec80('0x113')](db['Dynamics365Field'],{'as':_0xec80('0x1c7'),'onDelete':'cascade','foreignKey':_0xec80('0x1c8')});db[_0xec80('0x1d7')][_0xec80('0x113')](db[_0xec80('0xc6')],{'as':_0xec80('0x1c0'),'onDelete':_0xec80('0x112'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0xec80('0x14f')](db[_0xec80('0xc3')],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0xc6')]['hasMany'](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0xec80('0x1c6')});db[_0xec80('0xc6')][_0xec80('0x113')](db[_0xec80('0xc6')],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0xc6')][_0xec80('0x113')](db['Dynamics365Field'],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0xc6')][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0xc7')]['hasMany'](db[_0xec80('0xc9')],{'as':_0xec80('0x1c3'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0xc9')][_0xec80('0x113')](db[_0xec80('0xcb')],{'as':_0xec80('0x1c5'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0xc9')][_0xec80('0x113')](db[_0xec80('0xcb')],{'as':_0xec80('0x1c7'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0xc9')][_0xec80('0x113')](db['FreshsalesField'],{'as':_0xec80('0x1c0'),'foreignKey':'FieldId'});db[_0xec80('0xc9')][_0xec80('0x14f')](db['FreshsalesAccount'],{'as':_0xec80('0x177'),'foreignKey':'AccountId'});db[_0xec80('0xcb')][_0xec80('0x113')](db[_0xec80('0xcb')],{'as':_0xec80('0x1d5'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0xcb')][_0xec80('0x113')](db[_0xec80('0xcb')],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db['FreshsalesField'][_0xec80('0x113')](db[_0xec80('0xcb')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db['FreshsalesField'][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0xcf')][_0xec80('0x14f')](db[_0xec80('0x5f')],{});db[_0xec80('0xcf')]['belongsTo'](db['CmList'],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180')});db['ChatQueueReport'][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':'Contact','foreignKey':_0xec80('0x160')});db[_0xec80('0xcf')][_0xec80('0x14f')](db[_0xec80('0x63')],{});db[_0xec80('0xcf')][_0xec80('0x14f')](db[_0xec80('0x65')],{});db[_0xec80('0xcf')][_0xec80('0x14f')](db[_0xec80('0x10e')],{});db[_0xec80('0xcf')][_0xec80('0x14f')](db[_0xec80('0x68')],{});db[_0xec80('0x1d8')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x112'),'foreignKey':'FromId'});db[_0xec80('0x1d8')][_0xec80('0x14f')](db['User'],{'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1d9')});db['JscriptySessionReport'][_0xec80('0x113')](db[_0xec80('0xd3')],{'foreignKey':'SessionId','onDelete':_0xec80('0x112')});db[_0xec80('0x19f')][_0xec80('0x113')](db[_0xec80('0xd1')],{'foreignKey':_0xec80('0x1da'),'onDelete':_0xec80('0x112')});db[_0xec80('0x1db')][_0xec80('0x14f')](db[_0xec80('0x51')],{});db[_0xec80('0x1db')][_0xec80('0x14f')](db['CmList'],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180')});db['SmsQueueReport'][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x1db')][_0xec80('0x14f')](db[_0xec80('0x53')],{});db[_0xec80('0x1db')][_0xec80('0x14f')](db[_0xec80('0x55')],{});db[_0xec80('0x1db')]['belongsTo'](db[_0xec80('0x10e')],{});db['SmsQueueReport'][_0xec80('0x14f')](db['SmsQueue'],{});db['JscriptyProject'][_0xec80('0x113')](db['JscriptySessionReport'],{'foreignKey':_0xec80('0x1dc')});db[_0xec80('0xd9')][_0xec80('0x113')](db[_0xec80('0xd3')],{'foreignKey':_0xec80('0x1dc')});db[_0xec80('0xd9')][_0xec80('0x113')](db[_0xec80('0xd1')],{'foreignKey':_0xec80('0x1dc')});db[_0xec80('0xde')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x173'),'through':_0xec80('0x143')});db[_0xec80('0xe1')]['belongsToMany'](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x125')});db[_0xec80('0xe1')][_0xec80('0x122')](db['VoiceQueue'],{'through':_0xec80('0x107'),'as':_0xec80('0x1dd')});db[_0xec80('0xe1')][_0xec80('0x122')](db[_0xec80('0x3c')],{'through':_0xec80('0x16c'),'as':_0xec80('0x131')});db['Team']['belongsToMany'](db[_0xec80('0x68')],{'through':_0xec80('0x1de'),'as':_0xec80('0x132')});db[_0xec80('0xe1')]['belongsToMany'](db['FaxQueue'],{'through':_0xec80('0x184'),'as':_0xec80('0x1df')});db[_0xec80('0xe1')][_0xec80('0x122')](db['SmsQueue'],{'through':_0xec80('0x18b'),'as':'SmsQueues'});db['Team'][_0xec80('0x122')](db[_0xec80('0x5d')],{'through':_0xec80('0x192'),'as':_0xec80('0x135')});db[_0xec80('0xe1')][_0xec80('0x122')](db[_0xec80('0x103')],{'through':'team_has_whatsapp_queues','as':_0xec80('0x1e0')});db[_0xec80('0xe1')]['belongsToMany'](db[_0xec80('0x12f')],{'through':_0xec80('0x109'),'as':_0xec80('0x130')});db['Campaign'][_0xec80('0x113')](db[_0xec80('0x1a2')],{'as':'Hoppers','foreignKey':_0xec80('0x1a3')});db[_0xec80('0xe5')][_0xec80('0x113')](db[_0xec80('0x74')],{'as':_0xec80('0x115'),'foreignKey':_0xec80('0x1a3')});db[_0xec80('0xe5')][_0xec80('0x113')](db[_0xec80('0x14b')],{'as':_0xec80('0x14c'),'foreignKey':_0xec80('0x1a3')});db[_0xec80('0xe5')][_0xec80('0x113')](db[_0xec80('0x72')],{'as':'HopperBlacks','foreignKey':_0xec80('0x1a3')});db[_0xec80('0xe5')]['belongsTo'](db[_0xec80('0x150')],{'as':_0xec80('0x150'),'foreignKey':_0xec80('0x151')});db[_0xec80('0xe5')][_0xec80('0x14f')](db[_0xec80('0x150')],{'as':_0xec80('0x1e1'),'foreignKey':_0xec80('0x152')});db[_0xec80('0xe5')][_0xec80('0x14f')](db[_0xec80('0x7f')],{'as':_0xec80('0x7f'),'foreignKey':_0xec80('0x153')});db[_0xec80('0xe5')]['belongsTo'](db[_0xec80('0xde')],{'as':_0xec80('0xde'),'foreignKey':_0xec80('0x1e2')});db['Campaign'][_0xec80('0x122')](db[_0xec80('0xf4')],{'as':'Lists','through':_0xec80('0x1e3')});db[_0xec80('0xe5')]['belongsToMany'](db[_0xec80('0xf4')],{'as':'BlackLists','through':_0xec80('0x1e4')});db[_0xec80('0xe9')][_0xec80('0x14f')](db[_0xec80('0x179')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xec80('0xec')][_0xec80('0x14f')](db[_0xec80('0x16d')],{});db[_0xec80('0xec')][_0xec80('0x14f')](db[_0xec80('0x119')],{});db[_0xec80('0xec')][_0xec80('0x14f')](db[_0xec80('0x13a')],{'foreignKey':_0xec80('0x1e5'),'as':_0xec80('0x1e6')});db[_0xec80('0xec')]['belongsTo'](db['User'],{'foreignKey':_0xec80('0x1e7'),'as':'FromAgent'});db[_0xec80('0xec')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':_0xec80('0x1e8'),'as':'ToAgent'});db['MailTransferReport'][_0xec80('0x14f')](db[_0xec80('0x3c')],{'foreignKey':_0xec80('0x1e9'),'as':'ToQueue'});db[_0xec80('0xec')][_0xec80('0x14f')](db[_0xec80('0x13a')],{'foreignKey':'ToMailAccountId','as':_0xec80('0x1ea')});db[_0xec80('0xee')][_0xec80('0x14f')](db['ChatMessage'],{});db[_0xec80('0xee')][_0xec80('0x14f')](db[_0xec80('0x63')],{});db[_0xec80('0xee')]['belongsTo'](db[_0xec80('0x5f')],{'foreignKey':_0xec80('0x1eb'),'as':_0xec80('0x1e6')});db['ChatTransferReport'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':_0xec80('0x1e7'),'as':'FromAgent'});db['ChatTransferReport'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':_0xec80('0x1e8'),'as':_0xec80('0x1ec')});db[_0xec80('0xee')][_0xec80('0x14f')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0xec80('0xee')][_0xec80('0x14f')](db[_0xec80('0x5f')],{'foreignKey':_0xec80('0x1ed'),'as':_0xec80('0x1ea')});db[_0xec80('0xf0')]['belongsTo'](db[_0xec80('0x4b')],{});db[_0xec80('0xf0')]['belongsTo'](db['FaxInteraction'],{});db[_0xec80('0xf0')][_0xec80('0x14f')](db['FaxAccount'],{'foreignKey':_0xec80('0x1ee'),'as':_0xec80('0x1e6')});db[_0xec80('0xf0')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':_0xec80('0x1e7'),'as':'FromAgent'});db[_0xec80('0xf0')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':_0xec80('0x1e8'),'as':_0xec80('0x1ec')});db[_0xec80('0xf0')][_0xec80('0x14f')](db[_0xec80('0x4d')],{'foreignKey':_0xec80('0x1ef'),'as':_0xec80('0x1f0')});db[_0xec80('0xf0')][_0xec80('0x14f')](db[_0xec80('0x137')],{'foreignKey':_0xec80('0x1f1'),'as':_0xec80('0x1ea')});db['OpenchannelTransferReport'][_0xec80('0x14f')](db['OpenchannelMessage'],{});db[_0xec80('0xf2')][_0xec80('0x14f')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xec80('0x14f')](db[_0xec80('0x13c')],{'foreignKey':'FromOpenchannelAccountId','as':_0xec80('0x1e6')});db[_0xec80('0xf2')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':'FromUserId','as':_0xec80('0x1f2')});db[_0xec80('0xf2')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0xec80('0x1ec')});db['OpenchannelTransferReport'][_0xec80('0x14f')](db[_0xec80('0x5d')],{'foreignKey':'ToOpenchannelQueueId','as':_0xec80('0x1f0')});db['OpenchannelTransferReport']['belongsTo'](db[_0xec80('0x13c')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0xec80('0xf3')][_0xec80('0x14f')](db[_0xec80('0x55')],{});db['SmsTransferReport'][_0xec80('0x14f')](db[_0xec80('0x53')],{});db[_0xec80('0xf3')][_0xec80('0x14f')](db['SmsAccount'],{'foreignKey':_0xec80('0x1f3'),'as':_0xec80('0x1e6')});db['SmsTransferReport'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':'FromUserId','as':_0xec80('0x1f2')});db[_0xec80('0xf3')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':'ToUserId','as':_0xec80('0x1ec')});db['SmsTransferReport'][_0xec80('0x14f')](db[_0xec80('0x56')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport'][_0xec80('0x14f')](db[_0xec80('0x51')],{'foreignKey':_0xec80('0x1f4'),'as':_0xec80('0x1ea')});db['CmList']['hasMany'](db[_0xec80('0x166')],{'as':'Dispositions','foreignKey':'ListId','onDelete':'cascade'});db['CmList']['hasMany'](db[_0xec80('0x78')],{'as':_0xec80('0x1f5'),'foreignKey':_0xec80('0x180')});db['CmList'][_0xec80('0x113')](db[_0xec80('0x6f')],{'as':_0xec80('0x19b'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x180')});db[_0xec80('0xf4')][_0xec80('0x113')](db[_0xec80('0x74')],{'as':'HopperFinals','foreignKey':_0xec80('0x180')});db['CmList']['hasMany'](db[_0xec80('0x14b')],{'as':_0xec80('0x116'),'foreignKey':_0xec80('0x180')});db[_0xec80('0xf4')][_0xec80('0x113')](db[_0xec80('0x77')],{'as':_0xec80('0x77'),'foreignKey':_0xec80('0x180')});db['CmList'][_0xec80('0x122')](db[_0xec80('0x12e')],{'as':_0xec80('0x1f6'),'through':_0xec80('0x1f7')});db[_0xec80('0xf4')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':'Agents','through':_0xec80('0x124')});db[_0xec80('0x12f')][_0xec80('0x113')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0xec80('0x112')});db[_0xec80('0x12f')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x10b')});db[_0xec80('0x12f')][_0xec80('0x122')](db[_0xec80('0xe1')],{'through':_0xec80('0x109'),'as':_0xec80('0x158')});db[_0xec80('0x11d')][_0xec80('0x113')](db[_0xec80('0x10e')],{'as':_0xec80('0x173'),'foreignKey':'userProfileId'});db[_0xec80('0x11d')][_0xec80('0x113')](db[_0xec80('0xf7')],{'as':_0xec80('0x1f8'),'foreignKey':_0xec80('0x11e'),'onDelete':_0xec80('0x112')});db[_0xec80('0xf7')][_0xec80('0x113')](db[_0xec80('0xf8')],{'as':_0xec80('0x1f9'),'foreignKey':'sectionId','onDelete':_0xec80('0x112')});db['WhatsappAccount'][_0xec80('0x113')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xec80('0x1fa'),'onDelete':_0xec80('0x112')});db[_0xec80('0xfa')][_0xec80('0x113')](db[_0xec80('0x7c')],{'as':_0xec80('0x17d'),'foreignKey':_0xec80('0x1fa')});db[_0xec80('0xfa')][_0xec80('0x113')](db[_0xec80('0x1fb')],{'as':_0xec80('0x168'),'foreignKey':'WhatsappAccountId'});db[_0xec80('0xfa')][_0xec80('0x113')](db['WhatsappInteraction'],{'as':_0xec80('0x169')});db['WhatsappAccount']['hasMany'](db[_0xec80('0xfc')],{'as':_0xec80('0x147')});db[_0xec80('0xfa')][_0xec80('0x14f')](db['CmList'],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180')});db[_0xec80('0xfa')][_0xec80('0x14f')](db[_0xec80('0x154')],{'as':_0xec80('0x155'),'foreignKey':_0xec80('0x156')});db[_0xec80('0xfa')]['belongsToMany'](db[_0xec80('0x10e')],{'as':'Agents','through':_0xec80('0x141')});db[_0xec80('0xfc')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x163')});db['WhatsappApplication'][_0xec80('0x14f')](db[_0xec80('0x103')],{'onDelete':_0xec80('0x163')});db['WhatsappApplication'][_0xec80('0x14f')](db[_0xec80('0xfa')],{'onDelete':_0xec80('0x163')});db[_0xec80('0xfc')]['belongsTo'](db['Interval'],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x153')});db['WhatsappApplication'][_0xec80('0x14f')](db[_0xec80('0x171')],{'onDelete':'restrict','foreignKey':_0xec80('0x17c')});db[_0xec80('0xfe')][_0xec80('0x113')](db[_0xec80('0x1fb')],{'as':_0xec80('0x168'),'onDelete':_0xec80('0x112'),'foreignKey':'WhatsappInteractionId'});db[_0xec80('0xfe')][_0xec80('0x14f')](db[_0xec80('0xfa')],{'as':_0xec80('0x177'),'foreignKey':'WhatsappAccountId'});db[_0xec80('0xfe')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':'Contact','foreignKey':_0xec80('0x160')});db[_0xec80('0xfe')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x16e'),'foreignKey':_0xec80('0x110')});db[_0xec80('0xfe')]['belongsToMany'](db[_0xec80('0x171')],{'through':_0xec80('0x1fc'),'as':_0xec80('0x170')});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0xec80('0xfe')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x173'),'through':_0xec80('0x12d'),'foreignKey':_0xec80('0x1fd')});db[_0xec80('0x1fb')]['belongsTo'](db['User'],{'as':'User'});db[_0xec80('0x1fb')][_0xec80('0x14f')](db['CmContact'],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x15f')});db[_0xec80('0x1fb')][_0xec80('0x14f')](db[_0xec80('0xfe')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x176'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xec80('0x14f')](db[_0xec80('0xfa')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0xec80('0x1fe')][_0xec80('0x14f')](db[_0xec80('0xfa')],{});db[_0xec80('0x1fe')]['belongsTo'](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180')});db[_0xec80('0x1fe')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':'ContactId'});db[_0xec80('0x1fe')][_0xec80('0x14f')](db[_0xec80('0xfe')],{});db[_0xec80('0x1fe')]['belongsTo'](db[_0xec80('0x103')],{});db['WhatsappQueueReport'][_0xec80('0x14f')](db[_0xec80('0x1fb')],{});db[_0xec80('0x1fe')][_0xec80('0x14f')](db[_0xec80('0x10e')],{});db[_0xec80('0x101')][_0xec80('0x14f')](db['WhatsappMessage'],{});db[_0xec80('0x101')]['belongsTo'](db[_0xec80('0xfe')],{});db[_0xec80('0x101')][_0xec80('0x14f')](db[_0xec80('0xfa')],{'foreignKey':_0xec80('0x1ff'),'as':_0xec80('0x1e6')});db[_0xec80('0x101')][_0xec80('0x14f')](db[_0xec80('0xfa')],{'foreignKey':_0xec80('0x200'),'as':_0xec80('0x1ea')});db['WhatsappTransferReport'][_0xec80('0x14f')](db['WhatsappQueue'],{'foreignKey':_0xec80('0x201'),'as':_0xec80('0x1f0')});db[_0xec80('0x101')]['belongsTo'](db['User'],{'foreignKey':_0xec80('0x1e7'),'as':'FromAgent'});db[_0xec80('0x101')][_0xec80('0x14f')](db['User'],{'foreignKey':_0xec80('0x1e8'),'as':_0xec80('0x1ec')});db[_0xec80('0x103')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':'Agents','through':_0xec80('0x36'),'foreignKey':_0xec80('0x202')});db[_0xec80('0x103')][_0xec80('0x122')](db[_0xec80('0xe1')],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0xec80('0x203')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x204'),'foreignKey':'UserId','onDelete':_0xec80('0x112'),'hooks':!![]});db[_0xec80('0x105')][_0xec80('0x10f')](db[_0xec80('0xc3')],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0xec80('0x105')]['hasOne'](db[_0xec80('0x37')],{'as':_0xec80('0x164'),'onDelete':_0xec80('0x163')});db[_0xec80('0x105')]['hasOne'](db[_0xec80('0x39')],{'as':'Smtp','onDelete':_0xec80('0x163')});module[_0xec80('0x205')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x697e=['DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','UserId','userSetting','cascade','hasMany','VoiceRecording','Recordings','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','belongsTo','userProfileId','ChatGroup','Groups','belongsToMany','Contacts','Lists','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueue','VoicePrefixes','UserVoicePrefix','MailQueue','MailQueues','ChatQueues','FaxQueue','FaxQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','ScreenRecording','Messages','mailbox','mailboxuser','VoiceQueueReport','uniqueid','VoiceCallReport','MailAccountId','CloudProvider','CloudProviderId','Smtp','Dispositions','Answers','Interactions','List','ListId','Agents','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','ContactId','Items','FaxAccountId','Exntensions','FaxMessage','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Tags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsApplication','user_has_sms_accounts','SmsMessage','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelQueue','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatInternalMessage','ChatGroupId','chat_group_has_users','Phones','CmContactId','CmHopperFinal','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OneAll','OneAny','Actions','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Fields','CustomReportId','AnalyticDefaultReport','DefaultReportId','MetricId','Configurations','AccountId','SalesforceField','Subjects','DescriptionId','FieldId','SubjectId','Description','Field','VariableId','SugarcrmConfiguration','Descriptions','Subject','int_zendesk_configuration_has_tags','FreshdeskField','ServicenowField','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','VoiceQueues','OpenchannelQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromUserId','FromAgent','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','CustomFields','Queues','cm_user_has_lists','VoicePrefix','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','user','Imap','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','database','options','username','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatOfflineMessage','ChatQueue','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model'];(function(_0x156b64,_0x1f199d){var _0x112620=function(_0x719aa4){while(--_0x719aa4){_0x156b64['push'](_0x156b64['shift']());}};_0x112620(++_0x1f199d);}(_0x697e,0x15d));var _0xe697=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x697e[_0x321bb2];return _0x9c12ed;};'use strict';var config=require(_0xe697('0x0'));var Sequelize=require(_0xe697('0x1'));var _=require(_0xe697('0x2'));var jstz=require(_0xe697('0x3'));var timezone=jstz[_0xe697('0x4')]();config[_0xe697('0x1')]=_[_0xe697('0x5')](config[_0xe697('0x1')],{'database':_0xe697('0x6'),'username':_0xe697('0x7'),'password':_0xe697('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xe697('0x9'),'dialectOptions':{'charset':_0xe697('0xa')},'logging':![],'timezone':timezone[_0xe697('0xb')](),'define':{'charset':_0xe697('0xc'),'collate':_0xe697('0xd')}}});config[_0xe697('0xe')]=_[_0xe697('0x5')](config['sequelizeHistory'],{'database':_0xe697('0x6'),'username':'xcall','password':_0xe697('0x8'),'options':{'host':_0xe697('0xf'),'port':0xcea,'dialect':_0xe697('0x9'),'dialectOptions':{'charset':_0xe697('0xa')},'logging':![],'timezone':timezone[_0xe697('0xb')](),'define':{'charset':_0xe697('0xc'),'collate':_0xe697('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xe697('0x10')],config[_0xe697('0x1')]['username'],config[_0xe697('0x1')]['password'],config[_0xe697('0x1')][_0xe697('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe697('0xe')]['database'],config['sequelizeHistory'][_0xe697('0x12')],config['sequelizeHistory'][_0xe697('0x13')],config['sequelizeHistory'][_0xe697('0x11')])};db[_0xe697('0x14')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x16'));db[_0xe697('0x17')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x18'));db[_0xe697('0x19')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x1a'));db[_0xe697('0x1b')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x1c'));db['VoiceMusicOnHold']=db['sequelize'][_0xe697('0x15')](_0xe697('0x1d'));db['VoiceQueue']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x1e'));db['VoiceRecording']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x1f'));db['ScreenRecording']=db['sequelize'][_0xe697('0x15')](_0xe697('0x20'));db['VoiceMail']=db['sequelize']['import'](_0xe697('0x21'));db[_0xe697('0x22')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x23'));db['VoiceCallReport']=db[_0xe697('0x1')]['import'](_0xe697('0x24'));db[_0xe697('0x25')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x26'));db[_0xe697('0x27')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x28'));db['VoiceQueueReport']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x29'));db['MemberReport']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/memberReport/memberReport.model');db['Trunk']=db[_0xe697('0x1')]['import'](_0xe697('0x2a'));db[_0xe697('0x2b')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x2c'));db[_0xe697('0x2d')]=db[_0xe697('0x1')]['import'](_0xe697('0x2e'));db[_0xe697('0x2f')]=db['sequelize'][_0xe697('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xe697('0x30')]=db['sequelize'][_0xe697('0x15')]('../api/userChatQueue/userChatQueue.model');db[_0xe697('0x31')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x32'));db[_0xe697('0x33')]=db['sequelize']['import']('../api/userFaxQueue/userFaxQueue.model');db[_0xe697('0x34')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x35'));db['UserOpenchannelQueue']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x36'));db[_0xe697('0x37')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x38'));db[_0xe697('0x39')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x3a'));db[_0xe697('0x3b')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x3c'));db[_0xe697('0x3d')]=db[_0xe697('0x1')]['import']('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x3e'));db[_0xe697('0x3f')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x40'));db[_0xe697('0x41')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x42'));db[_0xe697('0x43')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x44'));db[_0xe697('0x45')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x46'));db[_0xe697('0x47')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x48'));db[_0xe697('0x49')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x4a'));db[_0xe697('0x4b')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x4c'));db[_0xe697('0x4d')]=db[_0xe697('0x1')]['import'](_0xe697('0x4e'));db[_0xe697('0x4f')]=db[_0xe697('0x1')]['import'](_0xe697('0x50'));db[_0xe697('0x51')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x52'));db['FaxMessage']=db[_0xe697('0x1')]['import'](_0xe697('0x53'));db['FaxQueue']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x54'));db['FaxQueueReport']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x55'));db[_0xe697('0x56')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x57'));db['SmsApplication']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/smsApplication/smsApplication.model');db[_0xe697('0x58')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x59'));db['SmsMessage']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x5a'));db[_0xe697('0x5b')]=db['sequelize']['import'](_0xe697('0x5c'));db[_0xe697('0x5d')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db['sequelize'][_0xe697('0x15')](_0xe697('0x5e'));db[_0xe697('0x5f')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x60'));db['OpenchannelMessage']=db['sequelize']['import'](_0xe697('0x61'));db['OpenchannelQueue']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x62'));db['ChatWebsite']=db[_0xe697('0x1')]['import'](_0xe697('0x63'));db[_0xe697('0x64')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xe697('0x65')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x66'));db['ChatInteraction']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/chatMessage/chatMessage.model');db[_0xe697('0x67')]=db['sequelize']['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xe697('0x68')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db['sequelize'][_0xe697('0x15')](_0xe697('0x69'));db[_0xe697('0x6a')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/cmCompany/cmCompany.model');db[_0xe697('0x6b')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x6c'));db[_0xe697('0x6d')]=db['sequelize'][_0xe697('0x15')]('../api/cmHopper/cmHopper.model');db[_0xe697('0x6e')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xe697('0x6f')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x70'));db['ReportAgentPreview']=db[_0xe697('0x1')]['import'](_0xe697('0x71'));db[_0xe697('0x72')]=db['sequelize'][_0xe697('0x15')]('../api/cmCustomField/cmCustomField.model');db[_0xe697('0x73')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x74'));db[_0xe697('0x75')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x76'));db[_0xe697('0x77')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/cannedAnswer/cannedAnswer.model');db[_0xe697('0x78')]=db['sequelize'][_0xe697('0x15')]('../api/disposition/disposition.model');db[_0xe697('0x79')]=db['sequelize'][_0xe697('0x15')]('../api/condition/condition.model');db[_0xe697('0x7a')]=db['sequelize']['import'](_0xe697('0x7b'));db[_0xe697('0x7c')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x7d'));db[_0xe697('0x7e')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x7f'));db[_0xe697('0x80')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x81'));db[_0xe697('0x82')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x83'));db[_0xe697('0x84')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x85'));db[_0xe697('0x86')]=db['sequelize'][_0xe697('0x15')]('../api/tag/tag.model');db[_0xe697('0x87')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x88'));db[_0xe697('0x89')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x8a'));db[_0xe697('0x8b')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x8c'));db[_0xe697('0x8d')]=db[_0xe697('0x1')]['import'](_0xe697('0x8e'));db[_0xe697('0x8f')]=db[_0xe697('0x1')]['import'](_0xe697('0x90'));db[_0xe697('0x91')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x92'));db[_0xe697('0x93')]=db[_0xe697('0x1')]['import'](_0xe697('0x94'));db[_0xe697('0x95')]=db[_0xe697('0x1')]['import'](_0xe697('0x96'));db[_0xe697('0x97')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x98'));db['AnalyticDefaultReport']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x99'));db[_0xe697('0x9a')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x9b'));db[_0xe697('0x9c')]=db['sequelize'][_0xe697('0x15')]('../api/analyticMetric/analyticMetric.model');db[_0xe697('0x9d')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xe697('0x1')]['import'](_0xe697('0x9e'));db[_0xe697('0x9f')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xe697('0xa0')]=db[_0xe697('0x1')]['import'](_0xe697('0xa1'));db['SalesforceField']=db[_0xe697('0x1')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0xe697('0xa2')]=db[_0xe697('0x1')]['import'](_0xe697('0xa3'));db['SugarcrmConfiguration']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xa4'));db[_0xe697('0xa5')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xa6'));db[_0xe697('0xa7')]=db[_0xe697('0x1')]['import'](_0xe697('0xa8'));db[_0xe697('0xa9')]=db[_0xe697('0x1')]['import'](_0xe697('0xaa'));db[_0xe697('0xab')]=db[_0xe697('0x1')]['import'](_0xe697('0xac'));db[_0xe697('0xad')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xae'));db[_0xe697('0xaf')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xb0'));db[_0xe697('0xb1')]=db['sequelize'][_0xe697('0x15')]('../api/intZohoField/intZohoField.model');db[_0xe697('0xb2')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xe697('0xb3')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xb4'));db[_0xe697('0xb5')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/intZendeskField/intZendeskField.model');db[_0xe697('0xb6')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xb7'));db[_0xe697('0xb8')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xb9'));db['FreshdeskField']=db['sequelize'][_0xe697('0x15')](_0xe697('0xba'));db[_0xe697('0xbb')]=db[_0xe697('0x1')]['import'](_0xe697('0xbc'));db[_0xe697('0xbd')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xbe'));db[_0xe697('0xbf')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/intVtigerField/intVtigerField.model');db[_0xe697('0xc0')]=db['sequelize']['import'](_0xe697('0xc1'));db[_0xe697('0xc2')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xc3'));db['ServicenowField']=db[_0xe697('0x1')]['import'](_0xe697('0xc4'));db[_0xe697('0xc5')]=db['sequelize'][_0xe697('0x15')](_0xe697('0xc6'));db[_0xe697('0xc7')]=db['sequelize'][_0xe697('0x15')](_0xe697('0xc8'));db[_0xe697('0xc9')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xca'));db[_0xe697('0xcb')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xcc'));db[_0xe697('0xcd')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xce'));db[_0xe697('0xcf')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xe697('0x93')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x94'));db[_0xe697('0xd0')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xd1'));db[_0xe697('0xd2')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xd3'));db['ChatInternalMessage']=db['sequelize'][_0xe697('0x15')](_0xe697('0xd4'));db[_0xe697('0xd5')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize'][_0xe697('0x15')](_0xe697('0xd6'));db[_0xe697('0xd7')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xd8'));db[_0xe697('0xd9')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xda'));db[_0xe697('0xdb')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/squareReport/squareReport.model');db[_0xe697('0xdc')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xdd'));db['JscriptyProject']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xde'));db[_0xe697('0xdf')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xe0'));db[_0xe697('0xe1')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xe2'));db[_0xe697('0xe3')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xe4'));db['SquareRecording']=db['sequelize'][_0xe697('0x15')](_0xe697('0xe5'));db[_0xe697('0xe6')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xe7'));db[_0xe697('0xe8')]=db['sequelize'][_0xe697('0x15')](_0xe697('0xe9'));db[_0xe697('0xea')]=db[_0xe697('0x1')]['import'](_0xe697('0xeb'));db[_0xe697('0xec')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xed'));db['Migration']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xee'));db[_0xe697('0xef')]=db['sequelize'][_0xe697('0x15')](_0xe697('0xf0'));db['Plugin']=db['sequelize'][_0xe697('0x15')](_0xe697('0xf1'));db['MailTransferReport']=db['sequelize'][_0xe697('0x15')](_0xe697('0xf2'));db['ChatTransferReport']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xf3'));db[_0xe697('0xf4')]=db['sequelize']['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xe697('0xf5')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xf6'));db[_0xe697('0xf7')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xf8'));db['VoicePrefix']=db['sequelize']['import'](_0xe697('0xf9'));db[_0xe697('0xfa')]=db[_0xe697('0x1')]['import'](_0xe697('0xfb'));db[_0xe697('0xfc')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xfd'));db[_0xe697('0xfe')]=db[_0xe697('0x1')]['import'](_0xe697('0xff'));db[_0xe697('0x100')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/userNotification/userNotification.model');db[_0xe697('0x101')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x102'));db['WhatsappApplication']=db['sequelize'][_0xe697('0x15')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db['sequelize']['import'](_0xe697('0x103'));db[_0xe697('0x104')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x105'));db[_0xe697('0x106')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x107'));db['WhatsappTransferReport']=db[_0xe697('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xe697('0x108')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x109'));db['CloudProvider']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x10a'));db[_0xe697('0x10b')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x10c'));db[_0xe697('0x10d')]=db[_0xe697('0x1')]['import'](_0xe697('0x10e'));db['UserVoicePrefix']=db[_0xe697('0x1')]['import'](_0xe697('0x10f'));db[_0xe697('0x110')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x111'));db['User'][_0xe697('0x112')](db[_0xe697('0x113')],{'as':_0xe697('0x113'),'onDelete':'cascade','foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x112')](db[_0xe697('0x110')],{'as':_0xe697('0x115'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x118')],{'as':_0xe697('0x119'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x1b')],{'as':_0xe697('0x11a'),'onDelete':_0xe697('0x116'),'hooks':!![]});db['User'][_0xe697('0x117')](db['CmHopperFinal'],{'as':_0xe697('0x11b'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x6f')],{'as':_0xe697('0x11c'),'foreignKey':'UserId'});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x11d')],{'as':'ReportAgentPreview','foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x5f')],{'as':_0xe697('0x11e'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x11f')],{'as':_0xe697('0x120'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x58')],{'as':_0xe697('0x121'),'foreignKey':'UserId'});db[_0xe697('0x14')]['hasMany'](db[_0xe697('0x51')],{'as':'FaxInteractions','foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x41')],{'as':_0xe697('0x122'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x123')],{'as':_0xe697('0x124'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x100')],{'as':'UserNotifications','foreignKey':_0xe697('0x125')});db[_0xe697('0x14')][_0xe697('0x126')](db[_0xe697('0xfa')],{'as':_0xe697('0xfa'),'foreignKey':_0xe697('0x127')});db[_0xe697('0x14')]['belongsToMany'](db[_0xe697('0x128')],{'as':_0xe697('0x129'),'through':'chat_group_has_users'});db['User'][_0xe697('0x12a')](db[_0xe697('0x6b')],{'as':_0xe697('0x12b'),'through':'cm_user_has_contacts'});db['User'][_0xe697('0x12a')](db[_0xe697('0xf7')],{'as':_0xe697('0x12c'),'through':'cm_user_has_lists'});db[_0xe697('0x14')][_0xe697('0x12a')](db['Team'],{'through':_0xe697('0x12d')});db['User'][_0xe697('0x12a')](db[_0xe697('0x41')],{'as':'MailInteractions','through':_0xe697('0x12e')});db[_0xe697('0x14')][_0xe697('0x12a')](db['ChatInteraction'],{'as':_0xe697('0x120'),'through':'user_has_chat_interactions'});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0x51')],{'as':_0xe697('0x12f'),'through':_0xe697('0x130')});db['User'][_0xe697('0x12a')](db[_0xe697('0x58')],{'as':_0xe697('0x121'),'through':_0xe697('0x131')});db[_0xe697('0x14')]['belongsToMany'](db[_0xe697('0x5f')],{'as':_0xe697('0x11e'),'through':'user_has_openchannel_interactions'});db['User'][_0xe697('0x12a')](db['WhatsappInteraction'],{'as':_0xe697('0x124'),'through':'user_has_whatsapp_interactions'});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0x132')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0xe697('0x14')]['belongsToMany'](db['VoicePrefix'],{'as':_0xe697('0x133'),'through':_0xe697('0x134'),'required':![]});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0x135')],{'as':_0xe697('0x136'),'through':_0xe697('0x31'),'required':![]});db[_0xe697('0x14')]['belongsToMany'](db[_0xe697('0x68')],{'as':_0xe697('0x137'),'through':_0xe697('0x30'),'required':![],'hooks':!![]});db[_0xe697('0x14')]['belongsToMany'](db[_0xe697('0x138')],{'as':_0xe697('0x139'),'through':_0xe697('0x33'),'required':![]});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0x5b')],{'as':'SmsQueues','through':_0xe697('0x34'),'required':![]});db[_0xe697('0x14')][_0xe697('0x12a')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xe697('0x14')]['belongsToMany'](db[_0xe697('0x108')],{'as':'WhatsappQueues','through':_0xe697('0x37'),'required':![]});db[_0xe697('0x14')]['belongsToMany'](db['CmList'],{'through':'cm_user_has_lists'});db['User'][_0xe697('0x12a')](db[_0xe697('0x13a')],{'as':_0xe697('0x13b'),'through':_0xe697('0x13c')});db[_0xe697('0x14')]['belongsToMany'](db[_0xe697('0x4d')],{'as':_0xe697('0x13d'),'through':'user_has_fax_accounts'});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0x3d')],{'as':_0xe697('0x13e'),'through':_0xe697('0x13f')});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0x5d')],{'as':_0xe697('0x140'),'through':_0xe697('0x141')});db[_0xe697('0x14')][_0xe697('0x12a')](db['SmsAccount'],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db['User']['belongsToMany'](db['WhatsappAccount'],{'as':_0xe697('0x142'),'through':_0xe697('0x143')});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0xe3')],{'as':_0xe697('0x144'),'through':_0xe697('0x145')});db[_0xe697('0x17')][_0xe697('0x117')](db[_0xe697('0x1b')],{'as':_0xe697('0x146'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x147')});db['VoiceContext'][_0xe697('0x117')](db[_0xe697('0x1b')],{'onDelete':_0xe697('0x116')});db[_0xe697('0x1b')]['hasMany'](db[_0xe697('0x1b')],{'as':_0xe697('0x148'),'onDelete':_0xe697('0x116')});db[_0xe697('0x149')][_0xe697('0x12a')](db[_0xe697('0x84')],{'as':_0xe697('0x14a'),'through':_0xe697('0x14b')});db[_0xe697('0x132')][_0xe697('0x117')](db[_0xe697('0x2d')],{'as':_0xe697('0x14c'),'foreignKey':_0xe697('0x14d')});db[_0xe697('0x132')][_0xe697('0x117')](db[_0xe697('0x6d')],{'as':_0xe697('0x14e'),'foreignKey':'VoiceQueueId'});db[_0xe697('0x132')][_0xe697('0x117')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xe697('0x14d')});db[_0xe697('0x132')][_0xe697('0x117')](db[_0xe697('0x6f')],{'as':'HopperHistories','foreignKey':_0xe697('0x14d')});db[_0xe697('0x132')][_0xe697('0x117')](db[_0xe697('0x11d')],{'as':_0xe697('0x11d'),'foreignKey':_0xe697('0x14d')});db[_0xe697('0x132')][_0xe697('0x117')](db[_0xe697('0x6e')],{'as':_0xe697('0x14f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xe697('0x117')](db[_0xe697('0xd7')],{'as':_0xe697('0x150'),'foreignKey':_0xe697('0x14d')});db[_0xe697('0x132')][_0xe697('0x126')](db[_0xe697('0x151')],{'as':_0xe697('0x151'),'foreignKey':_0xe697('0x152')});db[_0xe697('0x132')]['belongsTo'](db[_0xe697('0x151')],{'as':_0xe697('0x153'),'foreignKey':_0xe697('0x154')});db[_0xe697('0x132')][_0xe697('0x126')](db[_0xe697('0x7a')],{'as':_0xe697('0x7a'),'foreignKey':_0xe697('0x155')});db[_0xe697('0x132')][_0xe697('0x126')](db[_0xe697('0x7c')],{'as':_0xe697('0x156'),'foreignKey':_0xe697('0x157')});db[_0xe697('0x132')][_0xe697('0x12a')](db[_0xe697('0xf7')],{'as':_0xe697('0x12c'),'through':_0xe697('0x158')});db[_0xe697('0x132')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':'Agents','through':_0xe697('0x2f')});db['VoiceQueue'][_0xe697('0x12a')](db[_0xe697('0xe8')],{'as':_0xe697('0x159'),'through':'TeamVoiceQueue'});db[_0xe697('0x132')]['belongsToMany'](db[_0xe697('0xf7')],{'as':_0xe697('0x15a'),'through':'voice_queues_has_cm_blacklists'});db[_0xe697('0x118')]['belongsTo'](db[_0xe697('0x14')],{'as':_0xe697('0x14'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x15b')]['belongsTo'](db[_0xe697('0x14')],{'as':_0xe697('0x14'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x113')][_0xe697('0x117')](db['VoiceMailMessage'],{'as':_0xe697('0x15c'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0xe697('0x15d')});db[_0xe697('0x22')]['belongsTo'](db[_0xe697('0x113')],{'foreignKey':_0xe697('0x15e'),'targetKey':'mailbox'});db['VoiceCallReport'][_0xe697('0x117')](db[_0xe697('0x15f')],{'as':'QueueCalls','foreignKey':_0xe697('0x160'),'constraints':![]});db[_0xe697('0x161')][_0xe697('0x117')](db[_0xe697('0x27')],{'as':'AgentReports','foreignKey':_0xe697('0x160'),'constraints':![]});db['VoiceCallReport'][_0xe697('0x126')](db[_0xe697('0x14')],{'as':'User','foreignKey':'UserId'});db[_0xe697('0x161')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':'Contact','foreignKey':'ContactId'});db[_0xe697('0x39')][_0xe697('0x126')](db[_0xe697('0x3d')],{'as':'MailAccount','foreignKey':_0xe697('0x162')});db[_0xe697('0x39')][_0xe697('0x126')](db['CloudProvider'],{'as':_0xe697('0x163'),'foreignKey':_0xe697('0x164'),'onDelete':'restrict'});db[_0xe697('0x3b')][_0xe697('0x126')](db['MailAccount'],{'as':_0xe697('0x3d'),'foreignKey':_0xe697('0x162')});db[_0xe697('0x3b')][_0xe697('0x126')](db[_0xe697('0x163')],{'as':_0xe697('0x163'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0xe697('0x3d')][_0xe697('0x112')](db[_0xe697('0x39')],{'as':'Imap','onDelete':_0xe697('0x116')});db[_0xe697('0x3d')][_0xe697('0x112')](db['MailServerOut'],{'as':_0xe697('0x165'),'onDelete':_0xe697('0x116')});db[_0xe697('0x3d')][_0xe697('0x117')](db['Disposition'],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x162'),'onDelete':_0xe697('0x116')});db[_0xe697('0x3d')][_0xe697('0x117')](db[_0xe697('0x77')],{'as':_0xe697('0x167'),'foreignKey':_0xe697('0x162')});db[_0xe697('0x3d')]['hasMany'](db[_0xe697('0x43')],{'as':_0xe697('0x15c'),'foreignKey':_0xe697('0x162')});db[_0xe697('0x3d')][_0xe697('0x117')](db[_0xe697('0x41')],{'as':_0xe697('0x168')});db[_0xe697('0x3d')][_0xe697('0x117')](db[_0xe697('0x45')],{'as':'Applications'});db[_0xe697('0x3d')]['belongsTo'](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a')});db[_0xe697('0x3d')][_0xe697('0x126')](db[_0xe697('0x8d')],{'as':'Template','foreignKey':'TemplateId'});db[_0xe697('0x3d')]['belongsTo'](db[_0xe697('0x7c')],{'as':_0xe697('0x156'),'foreignKey':_0xe697('0x157')});db[_0xe697('0x3d')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0xe697('0x135')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':'UserMailQueue'});db[_0xe697('0x135')][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':_0xe697('0x16c'),'as':_0xe697('0x159')});db['MailInteraction'][_0xe697('0x117')](db[_0xe697('0x43')],{'as':_0xe697('0x15c'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x16d')});db[_0xe697('0x41')][_0xe697('0x126')](db['MailAccount'],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x162')});db[_0xe697('0x41')]['belongsTo'](db['CmContact'],{'as':_0xe697('0x16f'),'foreignKey':'ContactId'});db[_0xe697('0x41')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x170'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x41')][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0xe697('0x41')][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':_0xe697('0x171'),'as':_0xe697('0x172')});db[_0xe697('0x41')]['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':_0xe697('0x12e'),'foreignKey':_0xe697('0x16d')});db[_0xe697('0x43')]['hasMany'](db[_0xe697('0xef')],{'as':_0xe697('0x174'),'onDelete':_0xe697('0x116')});db['MailMessage'][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x14')});db['MailMessage'][_0xe697('0x126')](db[_0xe697('0x6b')],{'onDelete':_0xe697('0x116'),'as':'Contact'});db[_0xe697('0x43')][_0xe697('0x126')](db[_0xe697('0x41')],{'as':_0xe697('0x175'),'foreignKey':_0xe697('0x16d')});db['MailMessage'][_0xe697('0x126')](db['MailAccount'],{'as':'Account','foreignKey':_0xe697('0x162')});db[_0xe697('0x43')][_0xe697('0x126')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0xe697('0x176')});db[_0xe697('0x43')][_0xe697('0x126')](db[_0xe697('0x67')],{'as':_0xe697('0x67'),'foreignKey':_0xe697('0x177')});db['MailApplication'][_0xe697('0x126')](db['User'],{'onDelete':'restrict'});db[_0xe697('0x45')]['belongsTo'](db[_0xe697('0x135')],{'onDelete':_0xe697('0x178')});db['MailApplication'][_0xe697('0x126')](db['MailAccount'],{'onDelete':_0xe697('0x178')});db[_0xe697('0x45')][_0xe697('0x126')](db[_0xe697('0x7a')],{'onDelete':_0xe697('0x178'),'foreignKey':_0xe697('0x155')});db['MailApplication'][_0xe697('0x126')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xe697('0x179')});db[_0xe697('0x47')][_0xe697('0x126')](db['MailAccount'],{});db['MailQueueReport'][_0xe697('0x126')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['MailQueueReport']['belongsTo'](db['CmContact'],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x17a')});db[_0xe697('0x47')]['belongsTo'](db[_0xe697('0x41')],{});db['MailQueueReport'][_0xe697('0x126')](db[_0xe697('0x43')],{});db[_0xe697('0x47')][_0xe697('0x126')](db[_0xe697('0x14')],{});db[_0xe697('0x47')][_0xe697('0x126')](db[_0xe697('0x135')],{});db[_0xe697('0x49')][_0xe697('0x117')](db[_0xe697('0x4b')],{'as':_0xe697('0x17b'),'onDelete':'cascade'});db[_0xe697('0x4d')]['hasMany'](db[_0xe697('0x78')],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x17c'),'onDelete':_0xe697('0x116')});db[_0xe697('0x4d')][_0xe697('0x117')](db['CannedAnswer'],{'as':_0xe697('0x167'),'foreignKey':_0xe697('0x17c')});db[_0xe697('0x4d')]['hasMany'](db['FaxInteraction'],{'as':_0xe697('0x168')});db[_0xe697('0x4d')]['hasMany'](db[_0xe697('0x4f')],{'as':'Applications'});db[_0xe697('0x4d')]['hasMany'](db['VoiceExtension'],{'as':_0xe697('0x17d'),'onDelete':_0xe697('0x116')});db[_0xe697('0x4d')][_0xe697('0x117')](db[_0xe697('0x17e')],{'as':_0xe697('0x15c')});db[_0xe697('0x4d')][_0xe697('0x126')](db[_0xe697('0x151')],{'as':_0xe697('0x151')});db[_0xe697('0x4d')][_0xe697('0x126')](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a')});db['FaxAccount'][_0xe697('0x126')](db['Pause'],{'as':_0xe697('0x156'),'foreignKey':_0xe697('0x157')});db[_0xe697('0x4d')][_0xe697('0x12a')](db['User'],{'as':_0xe697('0x16b'),'through':_0xe697('0x17f')});db[_0xe697('0x4f')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':'restrict'});db['FaxApplication'][_0xe697('0x126')](db['FaxQueue'],{'onDelete':_0xe697('0x178')});db['FaxApplication'][_0xe697('0x126')](db[_0xe697('0x4d')],{'onDelete':_0xe697('0x178')});db[_0xe697('0x4f')][_0xe697('0x126')](db[_0xe697('0x86')],{'onDelete':_0xe697('0x178'),'foreignKey':'TagId'});db[_0xe697('0x51')][_0xe697('0x117')](db['FaxMessage'],{'as':_0xe697('0x15c'),'onDelete':'cascade','foreignKey':_0xe697('0x180')});db[_0xe697('0x51')][_0xe697('0x126')](db[_0xe697('0x4d')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x17c')});db[_0xe697('0x51')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x17a')});db[_0xe697('0x51')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x170'),'foreignKey':_0xe697('0x114')});db['FaxInteraction'][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':_0xe697('0x181'),'as':_0xe697('0x182')});db['FaxInteraction'][_0xe697('0x12a')](db['Tag'],{'through':_0xe697('0x181'),'as':_0xe697('0x172')});db['FaxInteraction']['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':_0xe697('0x130'),'foreignKey':_0xe697('0x180')});db[_0xe697('0x17e')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':_0xe697('0x116'),'as':_0xe697('0x14')});db[_0xe697('0x17e')]['belongsTo'](db['FaxInteraction'],{'as':_0xe697('0x175'),'foreignKey':_0xe697('0x180')});db[_0xe697('0x17e')][_0xe697('0x126')](db[_0xe697('0x6b')],{'onDelete':_0xe697('0x116'),'as':_0xe697('0x16f')});db['FaxMessage'][_0xe697('0x126')](db['Attachment'],{'as':_0xe697('0xef'),'foreignKey':_0xe697('0x183')});db[_0xe697('0x17e')][_0xe697('0x126')](db[_0xe697('0x4d')],{'as':_0xe697('0x16e'),'foreignKey':'FaxAccountId'});db[_0xe697('0x138')]['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':_0xe697('0x33')});db[_0xe697('0x138')][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':_0xe697('0x184'),'as':_0xe697('0x159')});db[_0xe697('0x185')][_0xe697('0x126')](db[_0xe697('0x4d')],{});db[_0xe697('0x185')][_0xe697('0x126')](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a')});db['FaxQueueReport']['belongsTo'](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':'ContactId'});db[_0xe697('0x185')][_0xe697('0x126')](db[_0xe697('0x51')],{});db[_0xe697('0x185')][_0xe697('0x126')](db[_0xe697('0x17e')],{});db[_0xe697('0x185')][_0xe697('0x126')](db['User'],{});db[_0xe697('0x185')][_0xe697('0x126')](db[_0xe697('0x138')],{});db[_0xe697('0x56')][_0xe697('0x117')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xe697('0x186'),'onDelete':_0xe697('0x116')});db[_0xe697('0x56')]['hasMany'](db[_0xe697('0x77')],{'as':_0xe697('0x167'),'foreignKey':_0xe697('0x186')});db[_0xe697('0x56')][_0xe697('0x117')](db['SmsMessage'],{'as':_0xe697('0x15c'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0xe697('0x117')](db[_0xe697('0x58')],{'as':'Interactions'});db[_0xe697('0x56')][_0xe697('0x117')](db[_0xe697('0x187')],{'as':_0xe697('0x148')});db[_0xe697('0x56')]['belongsTo'](db[_0xe697('0xf7')],{'as':'List','foreignKey':_0xe697('0x16a')});db[_0xe697('0x56')][_0xe697('0x126')](db[_0xe697('0x7c')],{'as':_0xe697('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe697('0x56')]['belongsToMany'](db[_0xe697('0x14')],{'as':'Agents','through':_0xe697('0x188')});db['SmsApplication'][_0xe697('0x126')](db['User'],{'onDelete':_0xe697('0x178')});db['SmsApplication'][_0xe697('0x126')](db[_0xe697('0x5b')],{'onDelete':_0xe697('0x178')});db[_0xe697('0x187')]['belongsTo'](db[_0xe697('0x56')],{'onDelete':_0xe697('0x178')});db[_0xe697('0x187')][_0xe697('0x126')](db['Interval'],{'onDelete':_0xe697('0x178'),'foreignKey':_0xe697('0x155')});db['SmsApplication'][_0xe697('0x126')](db[_0xe697('0x86')],{'onDelete':'restrict','foreignKey':_0xe697('0x179')});db[_0xe697('0x58')][_0xe697('0x117')](db[_0xe697('0x189')],{'as':_0xe697('0x15c'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x18a')});db['SmsInteraction'][_0xe697('0x126')](db[_0xe697('0x56')],{'as':'Account','foreignKey':_0xe697('0x186')});db[_0xe697('0x58')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xe697('0x17a')});db[_0xe697('0x58')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x170'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x58')]['belongsToMany'](db[_0xe697('0x86')],{'through':_0xe697('0x18b'),'as':_0xe697('0x182')});db['SmsInteraction']['belongsToMany'](db[_0xe697('0x86')],{'through':_0xe697('0x18b'),'as':_0xe697('0x172')});db['SmsInteraction'][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':'Users','through':_0xe697('0x131'),'foreignKey':_0xe697('0x18a')});db[_0xe697('0x189')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x14')});db[_0xe697('0x189')][_0xe697('0x126')](db[_0xe697('0x6b')],{'onDelete':_0xe697('0x116'),'as':_0xe697('0x16f')});db[_0xe697('0x189')]['belongsTo'](db[_0xe697('0x58')],{'onDelete':_0xe697('0x116'),'as':'Interaction','foreignKey':_0xe697('0x18a')});db[_0xe697('0x189')][_0xe697('0x126')](db[_0xe697('0x56')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x186')});db[_0xe697('0x5b')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':'Agents','through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0xe697('0x5b')][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':_0xe697('0x18c'),'as':_0xe697('0x159')});db['OpenchannelAccount']['hasMany'](db['Disposition'],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x18d'),'onDelete':_0xe697('0x116')});db[_0xe697('0x5d')][_0xe697('0x117')](db[_0xe697('0x77')],{'as':_0xe697('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0xe697('0x5d')][_0xe697('0x117')](db[_0xe697('0x5f')],{'as':_0xe697('0x168'),'foreignKey':_0xe697('0x18d')});db[_0xe697('0x5d')]['hasMany'](db[_0xe697('0x18e')],{'as':_0xe697('0x15c'),'foreignKey':'OpenchannelAccountId'});db[_0xe697('0x5d')][_0xe697('0x117')](db['OpenchannelApplication'],{'as':_0xe697('0x148'),'foreignKey':_0xe697('0x18d')});db[_0xe697('0x5d')][_0xe697('0x126')](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a')});db[_0xe697('0x5d')][_0xe697('0x126')](db[_0xe697('0x7c')],{'as':_0xe697('0x156'),'foreignKey':_0xe697('0x157')});db[_0xe697('0x5d')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':_0xe697('0x141')});db[_0xe697('0x18f')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':_0xe697('0x178')});db[_0xe697('0x18f')][_0xe697('0x126')](db[_0xe697('0x190')],{'onDelete':_0xe697('0x178'),'foreignKey':_0xe697('0x191')});db[_0xe697('0x18f')][_0xe697('0x126')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0xe697('0x18d')});db[_0xe697('0x18f')][_0xe697('0x126')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xe697('0x155')});db['OpenchannelApplication']['belongsTo'](db[_0xe697('0x86')],{'onDelete':_0xe697('0x178'),'foreignKey':'TagId'});db[_0xe697('0x5f')][_0xe697('0x117')](db[_0xe697('0x18e')],{'as':_0xe697('0x15c'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x192')});db[_0xe697('0x5f')][_0xe697('0x126')](db[_0xe697('0x5d')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x18d')});db[_0xe697('0x5f')][_0xe697('0x126')](db['CmContact'],{'as':_0xe697('0x16f'),'foreignKey':'ContactId'});db[_0xe697('0x5f')][_0xe697('0x126')](db['User'],{'as':_0xe697('0x170'),'foreignKey':_0xe697('0x114')});db['OpenchannelInteraction'][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':_0xe697('0x193'),'as':_0xe697('0x182')});db[_0xe697('0x5f')]['belongsToMany'](db[_0xe697('0x86')],{'through':_0xe697('0x193'),'as':_0xe697('0x172')});db['OpenchannelInteraction']['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':_0xe697('0x194'),'foreignKey':_0xe697('0x192')});db[_0xe697('0x18e')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':_0xe697('0x116'),'as':_0xe697('0x14')});db[_0xe697('0x18e')][_0xe697('0x126')](db[_0xe697('0x6b')],{'onDelete':'cascade','as':_0xe697('0x16f')});db[_0xe697('0x18e')]['belongsTo'](db[_0xe697('0x5f')],{'onDelete':_0xe697('0x116'),'as':_0xe697('0x175'),'foreignKey':_0xe697('0x192')});db[_0xe697('0x18e')][_0xe697('0x126')](db[_0xe697('0xef')],{'as':'Attachment','foreignKey':_0xe697('0x183')});db[_0xe697('0x18e')][_0xe697('0x126')](db[_0xe697('0x5d')],{'as':_0xe697('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0xe697('0x190')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':'UserOpenchannelQueue','foreignKey':_0xe697('0x191')});db[_0xe697('0x190')][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':_0xe697('0x195'),'as':_0xe697('0x159')});db['ChatWebsite'][_0xe697('0x117')](db[_0xe697('0x78')],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x176'),'onDelete':'cascade'});db['ChatWebsite'][_0xe697('0x117')](db[_0xe697('0x77')],{'as':'Answers','foreignKey':_0xe697('0x176')});db[_0xe697('0x13a')][_0xe697('0x117')](db[_0xe697('0x196')],{'as':_0xe697('0x197')});db[_0xe697('0x13a')]['hasMany'](db[_0xe697('0x11f')],{'as':_0xe697('0x168')});db[_0xe697('0x13a')][_0xe697('0x117')](db[_0xe697('0x65')],{'as':'Applications'});db[_0xe697('0x13a')][_0xe697('0x117')](db[_0xe697('0x198')],{'as':_0xe697('0x15c')});db[_0xe697('0x13a')]['belongsTo'](db[_0xe697('0xf7')],{'as':'List','foreignKey':_0xe697('0x16a')});db[_0xe697('0x13a')][_0xe697('0x126')](db[_0xe697('0x7a')],{'as':_0xe697('0x7a'),'foreignKey':_0xe697('0x155')});db['ChatWebsite']['belongsTo'](db[_0xe697('0x3d')],{'as':_0xe697('0x3d'),'foreignKey':'MailAccountId'});db[_0xe697('0x13a')][_0xe697('0x126')](db[_0xe697('0x7c')],{'as':_0xe697('0x156'),'foreignKey':_0xe697('0x157')});db[_0xe697('0x13a')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':'user_has_chat_websites'});db[_0xe697('0x64')][_0xe697('0x126')](db[_0xe697('0x5d')],{});db[_0xe697('0x64')][_0xe697('0x126')](db['CmList'],{'as':_0xe697('0x169'),'foreignKey':'ListId'});db[_0xe697('0x64')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x17a')});db[_0xe697('0x64')][_0xe697('0x126')](db[_0xe697('0x5f')],{});db['OpenchannelQueueReport'][_0xe697('0x126')](db[_0xe697('0x18e')],{});db[_0xe697('0x64')][_0xe697('0x126')](db[_0xe697('0x14')],{});db[_0xe697('0x64')]['belongsTo'](db['OpenchannelQueue'],{});db['ChatApplication'][_0xe697('0x126')](db['User'],{'as':_0xe697('0x199'),'foreignKey':'UserId','onDelete':_0xe697('0x178')});db['ChatApplication'][_0xe697('0x126')](db['ChatQueue'],{'as':_0xe697('0x19a'),'foreignKey':_0xe697('0x19b'),'onDelete':_0xe697('0x178')});db[_0xe697('0x65')][_0xe697('0x126')](db['ChatWebsite'],{'as':_0xe697('0x19c'),'foreignKey':_0xe697('0x176'),'onDelete':_0xe697('0x178')});db[_0xe697('0x65')][_0xe697('0x126')](db[_0xe697('0x86')],{'onDelete':'restrict','foreignKey':_0xe697('0x179')});db[_0xe697('0x11f')][_0xe697('0x117')](db[_0xe697('0x198')],{'as':_0xe697('0x15c'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x19d')});db[_0xe697('0x11f')][_0xe697('0x126')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xe697('0x11f')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':'Contact','foreignKey':'ContactId'});db[_0xe697('0x11f')][_0xe697('0x126')](db['User'],{'as':_0xe697('0x170'),'foreignKey':_0xe697('0x114')});db['ChatInteraction'][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':'chat_interaction_has_tags','as':_0xe697('0x182')});db[_0xe697('0x11f')][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':_0xe697('0x19e'),'as':'ThroughTags'});db[_0xe697('0x11f')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':_0xe697('0x19f'),'foreignKey':_0xe697('0x19d')});db[_0xe697('0x198')]['belongsTo'](db['User'],{'onDelete':'cascade','as':_0xe697('0x14')});db[_0xe697('0x198')][_0xe697('0x126')](db['CmContact'],{'onDelete':_0xe697('0x116'),'as':'Contact','foreignKey':_0xe697('0x17a')});db['ChatMessage'][_0xe697('0x126')](db[_0xe697('0x11f')],{'onDelete':'cascade','as':_0xe697('0x175'),'foreignKey':'ChatInteractionId'});db[_0xe697('0x198')][_0xe697('0x126')](db[_0xe697('0xef')],{'as':'Attachment','foreignKey':_0xe697('0x183')});db[_0xe697('0x198')][_0xe697('0x126')](db[_0xe697('0x13a')],{'as':'Account','foreignKey':_0xe697('0x176')});db[_0xe697('0x67')][_0xe697('0x117')](db[_0xe697('0xef')],{'as':'Attachments','foreignKey':_0xe697('0x177'),'onDelete':_0xe697('0x116'),'hooks':!![]});db[_0xe697('0x67')][_0xe697('0x126')](db['CmContact'],{'onDelete':'cascade','as':_0xe697('0x16f'),'foreignKey':'ContactId'});db[_0xe697('0x67')]['belongsTo'](db[_0xe697('0x13a')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x176')});db[_0xe697('0x68')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':_0xe697('0x30'),'hooks':!![]});db[_0xe697('0x68')][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':'team_has_chat_queues','as':'Teams'});db[_0xe697('0x128')][_0xe697('0x117')](db[_0xe697('0x1a0')],{'as':_0xe697('0x15c'),'foreignKey':_0xe697('0x1a1'),'onDelete':'cascade'});db[_0xe697('0x128')]['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x14c'),'through':_0xe697('0x1a2')});db[_0xe697('0x196')]['belongsTo'](db['ChatWebsite'],{'as':_0xe697('0x19c'),'foreignKey':'ChatWebsiteId'});db[_0xe697('0x6a')][_0xe697('0x117')](db['CmContact'],{'as':_0xe697('0x12b'),'foreignKey':'CompanyId'});db[_0xe697('0x6b')][_0xe697('0x117')](db[_0xe697('0x89')],{'as':_0xe697('0x1a3'),'foreignKey':_0xe697('0x1a4')});db[_0xe697('0x6b')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db['CmContact'][_0xe697('0x117')](db[_0xe697('0x1a5')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xe697('0x6b')][_0xe697('0x117')](db['CmHopperHistory'],{'as':_0xe697('0x1a6'),'foreignKey':_0xe697('0x17a')});db['CmContact']['hasMany'](db[_0xe697('0x11d')],{'as':_0xe697('0x11d'),'foreignKey':_0xe697('0x17a')});db[_0xe697('0x6b')][_0xe697('0x117')](db[_0xe697('0xd7')],{'as':'JscriptySessions','foreignKey':_0xe697('0x17a')});db[_0xe697('0x6b')]['hasMany'](db[_0xe697('0x5f')],{'as':_0xe697('0x11e'),'foreignKey':'ContactId','onDelete':_0xe697('0x178')});db[_0xe697('0x6b')][_0xe697('0x117')](db[_0xe697('0x11f')],{'as':_0xe697('0x120'),'foreignKey':_0xe697('0x17a'),'onDelete':_0xe697('0x178')});db[_0xe697('0x6b')][_0xe697('0x117')](db[_0xe697('0x58')],{'as':_0xe697('0x121'),'foreignKey':_0xe697('0x17a'),'onDelete':_0xe697('0x178')});db[_0xe697('0x6b')]['hasMany'](db[_0xe697('0x51')],{'as':_0xe697('0x12f'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xe697('0x6b')]['hasMany'](db[_0xe697('0x41')],{'as':_0xe697('0x122'),'foreignKey':_0xe697('0x17a'),'onDelete':_0xe697('0x178')});db['CmContact'][_0xe697('0x126')](db[_0xe697('0x6a')],{'as':_0xe697('0x1a7'),'foreignKey':'CompanyId'});db['CmContact'][_0xe697('0x126')](db['CmList'],{'as':_0xe697('0x169'),'foreignKey':'ListId','onDelete':_0xe697('0x116')});db['CmContact']['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':'cm_user_has_contacts'});db['CmContact']['belongsToMany'](db['Tag'],{'as':_0xe697('0x182'),'through':_0xe697('0x1a8')});db['CmContact']['belongsToMany'](db['Tag'],{'through':_0xe697('0x1a8'),'as':_0xe697('0x172')});db[_0xe697('0x6d')]['hasMany'](db[_0xe697('0x8b')],{'as':_0xe697('0x1a9'),'foreignKey':_0xe697('0x1aa')});db[_0xe697('0x6d')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':'ContactId','onDelete':_0xe697('0x116')});db['CmHopper'][_0xe697('0x126')](db['CmList'],{'as':_0xe697('0x169'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xe697('0x6d')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':'Agent','foreignKey':_0xe697('0x114')});db[_0xe697('0x6d')][_0xe697('0x126')](db[_0xe697('0x132')],{'as':_0xe697('0x19a'),'foreignKey':_0xe697('0x14d'),'onDelete':'cascade'});db[_0xe697('0x6d')][_0xe697('0x126')](db[_0xe697('0xec')],{'as':'Campaign','foreignKey':_0xe697('0x1ab'),'onDelete':'cascade'});db[_0xe697('0x6d')][_0xe697('0x126')](db['User'],{'as':_0xe697('0x170'),'foreignKey':'OwnerId'});db[_0xe697('0x6e')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xe697('0x116')});db[_0xe697('0x6e')]['belongsTo'](db['CmList'],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a'),'onDelete':_0xe697('0x116')});db['CmHopperBlack'][_0xe697('0x126')](db[_0xe697('0x132')],{'as':_0xe697('0x19a'),'foreignKey':'VoiceQueueId','onDelete':_0xe697('0x116')});db[_0xe697('0x6e')][_0xe697('0x126')](db[_0xe697('0xec')],{'as':_0xe697('0xec'),'foreignKey':_0xe697('0x1ab'),'onDelete':_0xe697('0x116')});db[_0xe697('0x75')]['hasMany'](db[_0xe697('0x79')],{'as':{'plural':'All','singular':_0xe697('0x1ac')},'foreignKey':'AutomationAllId','onDelete':_0xe697('0x116'),'hooks':!![]});db['Automation']['hasMany'](db[_0xe697('0x79')],{'as':{'plural':'Any','singular':_0xe697('0x1ad')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db['Automation'][_0xe697('0x117')](db[_0xe697('0x73')],{'as':_0xe697('0x1ae'),'foreignKey':_0xe697('0x1af'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0xe697('0x117')](db['Disposition'],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x1b0'),'onDelete':_0xe697('0x116')});db[_0xe697('0x7a')]['hasMany'](db[_0xe697('0x7a')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0xe697('0x7a')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0xe697('0x155'),'onDelete':'restrict'});db['Interval'][_0xe697('0x117')](db[_0xe697('0x45')],{'as':_0xe697('0x1b1'),'foreignKey':'IntervalId'});db[_0xe697('0x7a')][_0xe697('0x117')](db[_0xe697('0x65')],{'as':_0xe697('0x1b2'),'foreignKey':_0xe697('0x155')});db['Interval']['hasMany'](db[_0xe697('0x4f')],{'as':_0xe697('0x1b3'),'foreignKey':_0xe697('0x155')});db['Interval']['hasMany'](db[_0xe697('0x187')],{'as':_0xe697('0x1b4'),'foreignKey':_0xe697('0x155')});db[_0xe697('0x82')][_0xe697('0x126')](db[_0xe697('0x3d')],{});db[_0xe697('0x82')][_0xe697('0x126')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0xe697('0x82')][_0xe697('0x126')](db[_0xe697('0x97')],{'foreignKey':'CustomReportId'});db[_0xe697('0x84')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0xe697('0x1b5'),'through':_0xe697('0x14b'),'onDelete':_0xe697('0x178')});db[_0xe697('0x86')][_0xe697('0x12a')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0xe697('0x86')][_0xe697('0x12a')](db['ChatInteraction'],{'through':_0xe697('0x19e')});db[_0xe697('0x86')]['belongsToMany'](db[_0xe697('0x41')],{'through':_0xe697('0x171')});db[_0xe697('0x86')]['belongsToMany'](db['SmsInteraction'],{'through':_0xe697('0x18b')});db[_0xe697('0x86')][_0xe697('0x12a')](db[_0xe697('0x51')],{'through':_0xe697('0x181')});db[_0xe697('0x86')][_0xe697('0x12a')](db[_0xe697('0x5f')],{'through':'openchannel_interaction_has_tags'});db[_0xe697('0x86')][_0xe697('0x12a')](db[_0xe697('0x123')],{'through':_0xe697('0x1b6')});db[_0xe697('0x89')][_0xe697('0x126')](db['ContactItemType'],{'as':_0xe697('0x1b7'),'foreignKey':_0xe697('0x1b8')});db['CmHopperAdditionalPhone']['belongsTo'](db['CmHopper'],{'as':_0xe697('0x1b9'),'foreignKey':'CmHopperId'});db[_0xe697('0x89')]['belongsTo'](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x1a4')});db['Trigger'][_0xe697('0x117')](db[_0xe697('0x79')],{'as':{'plural':'AllConditions','singular':_0xe697('0x1ba')},'foreignKey':_0xe697('0x1bb'),'onDelete':_0xe697('0x116'),'hooks':!![]});db[_0xe697('0x8f')][_0xe697('0x117')](db[_0xe697('0x79')],{'as':{'plural':_0xe697('0x1bc'),'singular':_0xe697('0x1bd')},'foreignKey':'TriggerAnyId','onDelete':_0xe697('0x116'),'hooks':!![]});db['Trigger'][_0xe697('0x117')](db[_0xe697('0x73')],{'as':_0xe697('0x1ae'),'foreignKey':'TriggerId','onDelete':_0xe697('0x116'),'hooks':!![]});db[_0xe697('0x97')][_0xe697('0x117')](db['AnalyticFieldReport'],{'as':_0xe697('0x1be'),'onDelete':'cascade','foreignKey':_0xe697('0x1bf'),'hooks':!![]});db[_0xe697('0x1c0')][_0xe697('0x117')](db[_0xe697('0x9d')],{'as':_0xe697('0x1be'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c1')});db[_0xe697('0x9c')]['hasMany'](db[_0xe697('0x9d')],{'as':_0xe697('0x1be'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c2')});db[_0xe697('0x9d')][_0xe697('0x126')](db[_0xe697('0x9c')],{'foreignKey':_0xe697('0x1c2')});db[_0xe697('0x9f')]['hasMany'](db['SalesforceConfiguration'],{'as':_0xe697('0x1c3'),'onDelete':'cascade','foreignKey':_0xe697('0x1c4')});db[_0xe697('0xa0')][_0xe697('0x117')](db[_0xe697('0x1c5')],{'as':_0xe697('0x1c6'),'onDelete':_0xe697('0x116'),'foreignKey':'SubjectId'});db[_0xe697('0xa0')][_0xe697('0x117')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c7')});db['SalesforceConfiguration'][_0xe697('0x117')](db['SalesforceField'],{'as':_0xe697('0x1be'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xa0')][_0xe697('0x126')](db[_0xe697('0x9f')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0x1c5')]['hasMany'](db[_0xe697('0x1c5')],{'as':'Subject','foreignKey':_0xe697('0x1c9')});db[_0xe697('0x1c5')]['hasMany'](db[_0xe697('0x1c5')],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0x1c5')][_0xe697('0x117')](db[_0xe697('0x1c5')],{'as':_0xe697('0x1cb'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0x1c5')]['belongsTo'](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':_0xe697('0x1cc')});db[_0xe697('0xa2')]['hasMany'](db[_0xe697('0x1cd')],{'as':'Configurations','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0x1cd')][_0xe697('0x117')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0x1cd')]['hasMany'](db[_0xe697('0xa5')],{'as':_0xe697('0x1ce'),'onDelete':_0xe697('0x116'),'foreignKey':'DescriptionId'});db[_0xe697('0x1cd')][_0xe697('0x117')](db['SugarcrmField'],{'as':_0xe697('0x1be'),'onDelete':'cascade','foreignKey':_0xe697('0x1c8')});db[_0xe697('0x1cd')][_0xe697('0x126')](db[_0xe697('0xa2')],{'as':'Account','foreignKey':_0xe697('0x1c4')});db[_0xe697('0xa5')]['hasMany'](db['SugarcrmField'],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0xa5')][_0xe697('0x117')](db[_0xe697('0xa5')],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0xa5')]['hasMany'](db[_0xe697('0xa5')],{'as':_0xe697('0x1cb'),'foreignKey':_0xe697('0x1c8')});db['SugarcrmField'][_0xe697('0x126')](db['Variable'],{'as':'Variable','foreignKey':_0xe697('0x1cc')});db[_0xe697('0xa7')][_0xe697('0x117')](db[_0xe697('0xa9')],{'as':_0xe697('0x1c3'),'onDelete':'cascade','foreignKey':_0xe697('0x1c4')});db[_0xe697('0xa9')]['hasMany'](db[_0xe697('0xab')],{'as':_0xe697('0x1c6'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0xa9')][_0xe697('0x117')](db[_0xe697('0xab')],{'as':_0xe697('0x1ce'),'onDelete':_0xe697('0x116'),'foreignKey':'DescriptionId'});db[_0xe697('0xa9')][_0xe697('0x117')](db['DeskField'],{'as':_0xe697('0x1be'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xe697('0xa9')][_0xe697('0x126')](db[_0xe697('0xa7')],{'as':'Account','foreignKey':_0xe697('0x1c4')});db[_0xe697('0xa9')][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':'int_desk_configuration_has_tags'});db[_0xe697('0xab')][_0xe697('0x117')](db['DeskField'],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0xab')][_0xe697('0x117')](db[_0xe697('0xab')],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0xab')][_0xe697('0x117')](db[_0xe697('0xab')],{'as':_0xe697('0x1cb'),'foreignKey':'FieldId'});db[_0xe697('0xab')][_0xe697('0x126')](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':'VariableId'});db['ZohoAccount'][_0xe697('0x117')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db['ZohoConfiguration'][_0xe697('0x117')](db[_0xe697('0xb1')],{'as':'Subjects','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c9')});db['ZohoConfiguration'][_0xe697('0x117')](db[_0xe697('0xb1')],{'as':_0xe697('0x1ce'),'onDelete':'cascade','foreignKey':_0xe697('0x1c7')});db[_0xe697('0xaf')][_0xe697('0x117')](db['ZohoField'],{'as':_0xe697('0x1be'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xaf')][_0xe697('0x126')](db['ZohoAccount'],{'as':_0xe697('0x16e'),'foreignKey':'AccountId'});db[_0xe697('0xb1')][_0xe697('0x117')](db['ZohoField'],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0xb1')]['hasMany'](db['ZohoField'],{'as':'Description','foreignKey':_0xe697('0x1c7')});db[_0xe697('0xb1')][_0xe697('0x117')](db[_0xe697('0xb1')],{'as':'Field','foreignKey':_0xe697('0x1c8')});db['ZohoField'][_0xe697('0x126')](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':_0xe697('0x1cc')});db[_0xe697('0xb2')][_0xe697('0x117')](db[_0xe697('0xb3')],{'as':_0xe697('0x1c3'),'onDelete':_0xe697('0x116'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xe697('0x117')](db[_0xe697('0xb5')],{'as':_0xe697('0x1c6'),'foreignKey':'SubjectId'});db[_0xe697('0xb3')][_0xe697('0x117')](db[_0xe697('0xb5')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xe697('0xb3')][_0xe697('0x117')](db[_0xe697('0xb5')],{'as':'Fields','foreignKey':'FieldId'});db['ZendeskConfiguration'][_0xe697('0x126')](db[_0xe697('0xb2')],{'as':'Account','foreignKey':_0xe697('0x1c4')});db[_0xe697('0xb3')]['belongsToMany'](db[_0xe697('0x86')],{'through':_0xe697('0x1d0')});db[_0xe697('0xb5')][_0xe697('0x117')](db[_0xe697('0xb5')],{'as':'Subject','foreignKey':_0xe697('0x1c9')});db[_0xe697('0xb5')][_0xe697('0x117')](db[_0xe697('0xb5')],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0xb5')][_0xe697('0x117')](db[_0xe697('0xb5')],{'as':_0xe697('0x1cb'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xb5')]['belongsTo'](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':_0xe697('0x1cc')});db['FreshdeskAccount'][_0xe697('0x117')](db[_0xe697('0xb8')],{'as':_0xe697('0x1c3'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0xb8')]['hasMany'](db[_0xe697('0x1d1')],{'as':_0xe697('0x1c6'),'onDelete':'cascade','foreignKey':_0xe697('0x1c9')});db[_0xe697('0xb8')][_0xe697('0x117')](db[_0xe697('0x1d1')],{'as':'Descriptions','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0xb8')]['hasMany'](db[_0xe697('0x1d1')],{'as':_0xe697('0x1be'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xb8')]['belongsTo'](db[_0xe697('0xb6')],{'as':'Account','foreignKey':_0xe697('0x1c4')});db[_0xe697('0xb8')]['belongsToMany'](db[_0xe697('0x86')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xe697('0x1d1')][_0xe697('0x117')](db[_0xe697('0x1d1')],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db['FreshdeskField'][_0xe697('0x117')](db['FreshdeskField'],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0x1d1')][_0xe697('0x117')](db[_0xe697('0x1d1')],{'as':'Field','foreignKey':_0xe697('0x1c8')});db['FreshdeskField'][_0xe697('0x126')](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':_0xe697('0x1cc')});db[_0xe697('0xbb')][_0xe697('0x117')](db[_0xe697('0xbd')],{'as':_0xe697('0x1c3'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0xbd')][_0xe697('0x117')](db[_0xe697('0xbf')],{'as':_0xe697('0x1c6'),'foreignKey':'SubjectId'});db[_0xe697('0xbd')][_0xe697('0x117')](db[_0xe697('0xbf')],{'as':'Descriptions','foreignKey':_0xe697('0x1c7')});db[_0xe697('0xbd')][_0xe697('0x117')](db[_0xe697('0xbf')],{'as':_0xe697('0x1be'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xbd')][_0xe697('0x126')](db[_0xe697('0xbb')],{'as':_0xe697('0x16e'),'foreignKey':'AccountId'});db[_0xe697('0xbf')]['hasMany'](db[_0xe697('0xbf')],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db['VtigerField'][_0xe697('0x117')](db[_0xe697('0xbf')],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0xbf')][_0xe697('0x117')](db['VtigerField'],{'as':_0xe697('0x1cb'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xbf')][_0xe697('0x126')](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':_0xe697('0x1cc')});db[_0xe697('0xc0')][_0xe697('0x117')](db[_0xe697('0xc2')],{'as':'Configurations','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0xc2')][_0xe697('0x117')](db[_0xe697('0x1d2')],{'as':_0xe697('0x1c6'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0xc2')][_0xe697('0x117')](db['ServicenowField'],{'as':_0xe697('0x1ce'),'foreignKey':'DescriptionId'});db[_0xe697('0xc2')][_0xe697('0x117')](db[_0xe697('0x1d2')],{'as':_0xe697('0x1be'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xc2')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xe697('0x1c4')});db['ServicenowField'][_0xe697('0x117')](db[_0xe697('0x1d2')],{'as':_0xe697('0x1cf'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0xe697('0x1d2')],{'as':_0xe697('0x1ca'),'foreignKey':'DescriptionId'});db[_0xe697('0x1d2')][_0xe697('0x117')](db['ServicenowField'],{'as':'Field','foreignKey':_0xe697('0x1c8')});db['ServicenowField'][_0xe697('0x126')](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':'VariableId'});db[_0xe697('0xc5')][_0xe697('0x117')](db[_0xe697('0xc7')],{'as':_0xe697('0x1c3'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0xc5')][_0xe697('0x126')](db['CloudProvider'],{'as':_0xe697('0x163'),'foreignKey':'CloudProviderId'});db['Dynamics365Configuration'][_0xe697('0x117')](db['Dynamics365Field'],{'as':_0xe697('0x1c6'),'onDelete':_0xe697('0x116'),'foreignKey':'SubjectId'});db[_0xe697('0xc7')][_0xe697('0x117')](db['Dynamics365Field'],{'as':_0xe697('0x1ce'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c7')});db['Dynamics365Configuration'][_0xe697('0x117')](db[_0xe697('0xc9')],{'as':_0xe697('0x1be'),'onDelete':_0xe697('0x116'),'foreignKey':'FieldId'});db[_0xe697('0xc7')]['belongsTo'](db['Dynamics365Account'],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0xc9')][_0xe697('0x117')](db[_0xe697('0xc9')],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db['Dynamics365Field'][_0xe697('0x117')](db['Dynamics365Field'],{'as':_0xe697('0x1cb'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xc9')]['belongsTo'](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':_0xe697('0x1cc')});db[_0xe697('0xcb')]['hasMany'](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db['FreshsalesConfiguration'][_0xe697('0x117')](db['FreshsalesField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xe697('0xcd')]['hasMany'](db[_0xe697('0xcf')],{'as':_0xe697('0x1ce'),'foreignKey':'DescriptionId'});db[_0xe697('0xcd')][_0xe697('0x117')](db['FreshsalesField'],{'as':'Fields','foreignKey':'FieldId'});db[_0xe697('0xcd')][_0xe697('0x126')](db[_0xe697('0xcb')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0xcf')][_0xe697('0x117')](db[_0xe697('0xcf')],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0xcf')][_0xe697('0x117')](db['FreshsalesField'],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db['FreshsalesField'][_0xe697('0x117')](db[_0xe697('0xcf')],{'as':_0xe697('0x1cb'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xcf')][_0xe697('0x126')](db[_0xe697('0x91')],{'as':'Variable','foreignKey':'VariableId'});db[_0xe697('0xd2')][_0xe697('0x126')](db[_0xe697('0x13a')],{});db['ChatQueueReport']['belongsTo'](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a')});db[_0xe697('0xd2')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x17a')});db[_0xe697('0xd2')]['belongsTo'](db[_0xe697('0x11f')],{});db['ChatQueueReport'][_0xe697('0x126')](db[_0xe697('0x198')],{});db[_0xe697('0xd2')][_0xe697('0x126')](db[_0xe697('0x14')],{});db[_0xe697('0xd2')][_0xe697('0x126')](db[_0xe697('0x68')],{});db[_0xe697('0x1a0')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':_0xe697('0x116'),'foreignKey':'FromId'});db[_0xe697('0x1a0')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':'cascade','foreignKey':_0xe697('0x1d3')});db[_0xe697('0xd7')]['hasMany'](db[_0xe697('0x1d4')],{'foreignKey':_0xe697('0x1d5'),'onDelete':'cascade'});db[_0xe697('0xd7')][_0xe697('0x117')](db[_0xe697('0xd5')],{'foreignKey':_0xe697('0x1d5'),'onDelete':_0xe697('0x116')});db['SmsQueueReport']['belongsTo'](db[_0xe697('0x56')],{});db[_0xe697('0xd9')][_0xe697('0x126')](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a')});db[_0xe697('0xd9')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':'ContactId'});db[_0xe697('0xd9')][_0xe697('0x126')](db['SmsInteraction'],{});db['SmsQueueReport']['belongsTo'](db[_0xe697('0x189')],{});db['SmsQueueReport'][_0xe697('0x126')](db[_0xe697('0x14')],{});db['SmsQueueReport'][_0xe697('0x126')](db[_0xe697('0x5b')],{});db['JscriptyProject'][_0xe697('0x117')](db[_0xe697('0xd7')],{'foreignKey':'ProjectId'});db[_0xe697('0x1d6')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xe697('0x1d7')});db[_0xe697('0x1d6')][_0xe697('0x117')](db[_0xe697('0xd5')],{'foreignKey':_0xe697('0x1d7')});db[_0xe697('0xe3')]['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':_0xe697('0x145')});db[_0xe697('0xe8')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':'user_has_teams'});db['Team']['belongsToMany'](db['VoiceQueue'],{'through':_0xe697('0x10b'),'as':_0xe697('0x1d8')});db[_0xe697('0xe8')][_0xe697('0x12a')](db[_0xe697('0x135')],{'through':_0xe697('0x16c'),'as':_0xe697('0x136')});db[_0xe697('0xe8')][_0xe697('0x12a')](db[_0xe697('0x68')],{'through':'team_has_chat_queues','as':_0xe697('0x137')});db[_0xe697('0xe8')][_0xe697('0x12a')](db['FaxQueue'],{'through':_0xe697('0x184'),'as':_0xe697('0x139')});db['Team'][_0xe697('0x12a')](db[_0xe697('0x5b')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0xe697('0xe8')][_0xe697('0x12a')](db[_0xe697('0x190')],{'through':_0xe697('0x195'),'as':_0xe697('0x1d9')});db[_0xe697('0xe8')][_0xe697('0x12a')](db[_0xe697('0x108')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0xe697('0xe8')]['belongsToMany'](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0xe697('0x133')});db[_0xe697('0xec')][_0xe697('0x117')](db['CmHopper'],{'as':_0xe697('0x14e'),'foreignKey':_0xe697('0x1ab')});db[_0xe697('0xec')][_0xe697('0x117')](db[_0xe697('0x1a5')],{'as':_0xe697('0x11b'),'foreignKey':_0xe697('0x1ab')});db[_0xe697('0xec')]['hasMany'](db[_0xe697('0x6f')],{'as':'HopperHistories','foreignKey':_0xe697('0x1ab')});db[_0xe697('0xec')][_0xe697('0x117')](db[_0xe697('0x6e')],{'as':_0xe697('0x14f'),'foreignKey':'CampaignId'});db[_0xe697('0xec')][_0xe697('0x126')](db['Trunk'],{'as':_0xe697('0x151'),'foreignKey':_0xe697('0x152')});db[_0xe697('0xec')][_0xe697('0x126')](db[_0xe697('0x151')],{'as':'TrunkBackup','foreignKey':_0xe697('0x154')});db[_0xe697('0xec')][_0xe697('0x126')](db['Interval'],{'as':_0xe697('0x7a'),'foreignKey':_0xe697('0x155')});db[_0xe697('0xec')]['belongsTo'](db[_0xe697('0xe3')],{'as':'SquareProject','foreignKey':_0xe697('0x1da')});db[_0xe697('0xec')][_0xe697('0x12a')](db[_0xe697('0xf7')],{'as':'Lists','through':_0xe697('0x1db')});db[_0xe697('0xec')]['belongsToMany'](db['CmList'],{'as':_0xe697('0x15a'),'through':_0xe697('0x1dc')});db[_0xe697('0xef')]['belongsTo'](db[_0xe697('0x67')],{'as':_0xe697('0x67'),'foreignKey':'ChatOfflineMessageId'});db[_0xe697('0x1dd')]['belongsTo'](db[_0xe697('0x43')],{});db[_0xe697('0x1dd')]['belongsTo'](db[_0xe697('0x41')],{});db[_0xe697('0x1dd')][_0xe697('0x126')](db[_0xe697('0x3d')],{'foreignKey':_0xe697('0x1de'),'as':_0xe697('0x1df')});db[_0xe697('0x1dd')][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':'FromUserId','as':'FromAgent'});db['MailTransferReport'][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e0'),'as':_0xe697('0x1e1')});db[_0xe697('0x1dd')][_0xe697('0x126')](db[_0xe697('0x135')],{'foreignKey':_0xe697('0x1e2'),'as':_0xe697('0x1e3')});db[_0xe697('0x1dd')][_0xe697('0x126')](db[_0xe697('0x3d')],{'foreignKey':_0xe697('0x1e4'),'as':_0xe697('0x1e5')});db[_0xe697('0x1e6')]['belongsTo'](db[_0xe697('0x198')],{});db[_0xe697('0x1e6')][_0xe697('0x126')](db[_0xe697('0x11f')],{});db[_0xe697('0x1e6')]['belongsTo'](db[_0xe697('0x13a')],{'foreignKey':_0xe697('0x1e7'),'as':_0xe697('0x1df')});db[_0xe697('0x1e6')][_0xe697('0x126')](db['User'],{'foreignKey':_0xe697('0x1e8'),'as':_0xe697('0x1e9')});db[_0xe697('0x1e6')]['belongsTo'](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e0'),'as':_0xe697('0x1e1')});db[_0xe697('0x1e6')][_0xe697('0x126')](db[_0xe697('0x68')],{'foreignKey':_0xe697('0x1ea'),'as':_0xe697('0x1e3')});db[_0xe697('0x1e6')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xe697('0x1eb'),'as':'ToAccount'});db[_0xe697('0x1ec')][_0xe697('0x126')](db[_0xe697('0x17e')],{});db[_0xe697('0x1ec')][_0xe697('0x126')](db[_0xe697('0x51')],{});db[_0xe697('0x1ec')]['belongsTo'](db[_0xe697('0x4d')],{'foreignKey':_0xe697('0x1ed'),'as':_0xe697('0x1df')});db[_0xe697('0x1ec')][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e8'),'as':_0xe697('0x1e9')});db[_0xe697('0x1ec')][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e0'),'as':'ToAgent'});db[_0xe697('0x1ec')][_0xe697('0x126')](db[_0xe697('0x138')],{'foreignKey':_0xe697('0x1ee'),'as':_0xe697('0x1e3')});db[_0xe697('0x1ec')][_0xe697('0x126')](db[_0xe697('0x4d')],{'foreignKey':_0xe697('0x1ef'),'as':'ToAccount'});db[_0xe697('0xf4')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xe697('0xf4')]['belongsTo'](db[_0xe697('0x5f')],{});db[_0xe697('0xf4')][_0xe697('0x126')](db['OpenchannelAccount'],{'foreignKey':_0xe697('0x1f0'),'as':_0xe697('0x1df')});db['OpenchannelTransferReport'][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e8'),'as':_0xe697('0x1e9')});db[_0xe697('0xf4')][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':'ToUserId','as':_0xe697('0x1e1')});db[_0xe697('0xf4')][_0xe697('0x126')](db[_0xe697('0x190')],{'foreignKey':_0xe697('0x1f1'),'as':_0xe697('0x1e3')});db['OpenchannelTransferReport'][_0xe697('0x126')](db[_0xe697('0x5d')],{'foreignKey':_0xe697('0x1f2'),'as':_0xe697('0x1e5')});db['SmsTransferReport'][_0xe697('0x126')](db[_0xe697('0x189')],{});db[_0xe697('0xf5')][_0xe697('0x126')](db[_0xe697('0x58')],{});db[_0xe697('0xf5')][_0xe697('0x126')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0xe697('0xf5')]['belongsTo'](db['User'],{'foreignKey':_0xe697('0x1e8'),'as':'FromAgent'});db[_0xe697('0xf5')]['belongsTo'](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e0'),'as':_0xe697('0x1e1')});db[_0xe697('0xf5')][_0xe697('0x126')](db[_0xe697('0x5b')],{'foreignKey':_0xe697('0x1f3'),'as':'ToQueue'});db[_0xe697('0xf5')]['belongsTo'](db[_0xe697('0x56')],{'foreignKey':'ToSmsAccountId','as':_0xe697('0x1e5')});db[_0xe697('0xf7')][_0xe697('0x117')](db[_0xe697('0x78')],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x16a'),'onDelete':_0xe697('0x116')});db[_0xe697('0xf7')][_0xe697('0x117')](db[_0xe697('0x72')],{'as':_0xe697('0x1f4'),'foreignKey':_0xe697('0x16a')});db[_0xe697('0xf7')]['hasMany'](db[_0xe697('0x6b')],{'as':_0xe697('0x12b'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x16a')});db[_0xe697('0xf7')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xe697('0x16a')});db['CmList'][_0xe697('0x117')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xe697('0x16a')});db[_0xe697('0xf7')][_0xe697('0x117')](db[_0xe697('0x11d')],{'as':_0xe697('0x11d'),'foreignKey':_0xe697('0x16a')});db['CmList'][_0xe697('0x12a')](db[_0xe697('0x132')],{'as':_0xe697('0x1f5'),'through':_0xe697('0x158')});db['CmList'][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':_0xe697('0x1f6')});db['VoicePrefix'][_0xe697('0x117')](db[_0xe697('0x1b')],{'as':_0xe697('0x11a'),'onDelete':'cascade'});db[_0xe697('0x1f7')][_0xe697('0x12a')](db['User'],{'as':'Agents','through':_0xe697('0x134')});db['VoicePrefix'][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':_0xe697('0x10d'),'as':_0xe697('0x159')});db[_0xe697('0xfa')]['hasMany'](db['User'],{'as':_0xe697('0x173'),'foreignKey':_0xe697('0x127')});db[_0xe697('0xfa')][_0xe697('0x117')](db[_0xe697('0xfc')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0xe697('0x116')});db[_0xe697('0xfc')][_0xe697('0x117')](db[_0xe697('0xfe')],{'as':'Resources','foreignKey':_0xe697('0x1f8'),'onDelete':_0xe697('0x116')});db['WhatsappAccount'][_0xe697('0x117')](db[_0xe697('0x78')],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x1f9'),'onDelete':_0xe697('0x116')});db['WhatsappAccount'][_0xe697('0x117')](db[_0xe697('0x77')],{'as':_0xe697('0x167'),'foreignKey':_0xe697('0x1f9')});db[_0xe697('0x101')][_0xe697('0x117')](db[_0xe697('0x104')],{'as':_0xe697('0x15c'),'foreignKey':_0xe697('0x1f9')});db[_0xe697('0x101')]['hasMany'](db[_0xe697('0x123')],{'as':'Interactions'});db[_0xe697('0x101')][_0xe697('0x117')](db[_0xe697('0x1fa')],{'as':_0xe697('0x148')});db[_0xe697('0x101')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xe697('0x16a')});db[_0xe697('0x101')][_0xe697('0x126')](db[_0xe697('0x7c')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xe697('0x101')]['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':_0xe697('0x143')});db[_0xe697('0x1fa')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':_0xe697('0x178')});db[_0xe697('0x1fa')][_0xe697('0x126')](db['WhatsappQueue'],{'onDelete':_0xe697('0x178')});db[_0xe697('0x1fa')][_0xe697('0x126')](db[_0xe697('0x101')],{'onDelete':_0xe697('0x178')});db['WhatsappApplication'][_0xe697('0x126')](db[_0xe697('0x7a')],{'onDelete':_0xe697('0x178'),'foreignKey':_0xe697('0x155')});db[_0xe697('0x1fa')][_0xe697('0x126')](db[_0xe697('0x86')],{'onDelete':_0xe697('0x178'),'foreignKey':_0xe697('0x179')});db['WhatsappInteraction']['hasMany'](db['WhatsappMessage'],{'as':_0xe697('0x15c'),'onDelete':'cascade','foreignKey':_0xe697('0x1fb')});db[_0xe697('0x123')]['belongsTo'](db[_0xe697('0x101')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x1f9')});db['WhatsappInteraction'][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x17a')});db[_0xe697('0x123')]['belongsTo'](db['User'],{'as':_0xe697('0x170'),'foreignKey':_0xe697('0x114')});db['WhatsappInteraction'][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':_0xe697('0x1b6'),'as':'Tags'});db[_0xe697('0x123')]['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xe697('0x172')});db[_0xe697('0x123')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':_0xe697('0x1fc'),'foreignKey':'WhatsappInteractionId'});db[_0xe697('0x104')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x14')});db['WhatsappMessage'][_0xe697('0x126')](db[_0xe697('0x6b')],{'onDelete':_0xe697('0x116'),'as':'Contact'});db[_0xe697('0x104')][_0xe697('0x126')](db[_0xe697('0x123')],{'onDelete':'cascade','as':_0xe697('0x175'),'foreignKey':_0xe697('0x1fb')});db[_0xe697('0x104')][_0xe697('0x126')](db[_0xe697('0x101')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x1f9')});db[_0xe697('0x106')][_0xe697('0x126')](db[_0xe697('0x101')],{});db[_0xe697('0x106')]['belongsTo'](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x17a')});db['WhatsappQueueReport'][_0xe697('0x126')](db[_0xe697('0x123')],{});db['WhatsappQueueReport'][_0xe697('0x126')](db['WhatsappQueue'],{});db[_0xe697('0x106')][_0xe697('0x126')](db[_0xe697('0x104')],{});db[_0xe697('0x106')][_0xe697('0x126')](db[_0xe697('0x14')],{});db[_0xe697('0x1fd')][_0xe697('0x126')](db[_0xe697('0x104')],{});db[_0xe697('0x1fd')][_0xe697('0x126')](db['WhatsappInteraction'],{});db[_0xe697('0x1fd')][_0xe697('0x126')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0xe697('0x1df')});db['WhatsappTransferReport'][_0xe697('0x126')](db[_0xe697('0x101')],{'foreignKey':_0xe697('0x1fe'),'as':_0xe697('0x1e5')});db['WhatsappTransferReport']['belongsTo'](db[_0xe697('0x108')],{'foreignKey':_0xe697('0x1ff'),'as':_0xe697('0x1e3')});db[_0xe697('0x1fd')][_0xe697('0x126')](db['User'],{'foreignKey':_0xe697('0x1e8'),'as':_0xe697('0x1e9')});db[_0xe697('0x1fd')][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e0'),'as':'ToAgent'});db[_0xe697('0x108')][_0xe697('0x12a')](db['User'],{'as':_0xe697('0x16b'),'through':_0xe697('0x37'),'foreignKey':'WhatsappQueueId'});db[_0xe697('0x108')][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':_0xe697('0x200'),'as':'Teams'});db[_0xe697('0x110')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x201'),'foreignKey':_0xe697('0x114'),'onDelete':_0xe697('0x116'),'hooks':!![]});db[_0xe697('0x163')]['hasOne'](db[_0xe697('0xc5')],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0xe697('0x163')][_0xe697('0x112')](db[_0xe697('0x39')],{'as':_0xe697('0x202'),'onDelete':_0xe697('0x178')});db[_0xe697('0x163')][_0xe697('0x112')](db[_0xe697('0x3b')],{'as':_0xe697('0x165'),'onDelete':_0xe697('0x178')});module[_0xe697('0x203')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 8d981a6..961a607 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba24=['/apidoc','static','join','root','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/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/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/dispositions','./api/disposition','./api/condition','/api/intervals','/api/pauses','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2'];(function(_0x22b2f8,_0x152017){var _0x14702f=function(_0x32c54a){while(--_0x32c54a){_0x22b2f8['push'](_0x22b2f8['shift']());}};_0x14702f(++_0x152017);}(_0xba24,0x11d));var _0x4ba2=function(_0x180b3c,_0x3f2e92){_0x180b3c=_0x180b3c-0x0;var _0x462dfd=_0xba24[_0x180b3c];return _0x462dfd;};'use strict';var path=require(_0x4ba2('0x0'));var express=require('express');var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0x4ba2('0x1')];var clientSideLogs=require(_0x4ba2('0x2'));exports[_0x4ba2('0x3')]=function(_0x59bbff){return setupLoggers(_0x59bbff)[_0x4ba2('0x4')](function(){_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x6'),require(_0x4ba2('0x7')));_0x59bbff[_0x4ba2('0x5')]('/api/voice/chanspy',require(_0x4ba2('0x8')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x9'),require(_0x4ba2('0xa')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xb'),require(_0x4ba2('0xc')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xd'),require(_0x4ba2('0xe')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xf'),require(_0x4ba2('0x10')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x11'),require('./api/voiceRecording'));_0x59bbff[_0x4ba2('0x5')]('/api/screen/recordings',require(_0x4ba2('0x12')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x13'),require('./api/voiceMail'));_0x59bbff['use'](_0x4ba2('0x14'),require(_0x4ba2('0x15')));_0x59bbff[_0x4ba2('0x5')]('/api/voice/calls/reports',require(_0x4ba2('0x16')));_0x59bbff[_0x4ba2('0x5')]('/api/voice/dials/reports',require(_0x4ba2('0x17')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x18'),require(_0x4ba2('0x19')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x1a'),require(_0x4ba2('0x1b')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x1c'),require(_0x4ba2('0x1d')));_0x59bbff[_0x4ba2('0x5')]('/api/trunks',require(_0x4ba2('0x1e')));_0x59bbff['use'](_0x4ba2('0x1f'),require('./api/voiceTransferReport'));_0x59bbff['use'](_0x4ba2('0x20'),require('./api/mailServerOut'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x21'),require(_0x4ba2('0x22')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x23'),require(_0x4ba2('0x24')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x25'),require(_0x4ba2('0x26')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x27'),require('./api/mailInteraction'));_0x59bbff['use'](_0x4ba2('0x28'),require('./api/mailMessage'));_0x59bbff['use'](_0x4ba2('0x29'),require(_0x4ba2('0x2a')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x2b'),require(_0x4ba2('0x2c')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x2d'),require(_0x4ba2('0x2e')));_0x59bbff['use'](_0x4ba2('0x2f'),require('./api/dashboardItem'));_0x59bbff[_0x4ba2('0x5')]('/api/fax/accounts',require(_0x4ba2('0x30')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x31'),require(_0x4ba2('0x32')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x33'),require('./api/faxInteraction'));_0x59bbff['use']('/api/fax/messages',require('./api/faxMessage'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x34'),require(_0x4ba2('0x35')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x36'),require(_0x4ba2('0x37')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x38'),require('./api/smsAccount'));_0x59bbff[_0x4ba2('0x5')]('/api/sms/applications',require('./api/smsApplication'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x39'),require(_0x4ba2('0x3a')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x3b'),require(_0x4ba2('0x3c')));_0x59bbff['use'](_0x4ba2('0x3d'),require(_0x4ba2('0x3e')));_0x59bbff['use']('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x3f'),require(_0x4ba2('0x40')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x41'),require(_0x4ba2('0x42')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x43'),require('./api/openchannelMessage'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x44'),require(_0x4ba2('0x45')));_0x59bbff['use'](_0x4ba2('0x46'),require(_0x4ba2('0x47')));_0x59bbff['use'](_0x4ba2('0x48'),require('./api/openchannelQueueReport'));_0x59bbff[_0x4ba2('0x5')]('/api/chat/applications',require(_0x4ba2('0x49')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x4a'),require('./api/chatInteraction'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x4b'),require('./api/chatMessage'));_0x59bbff[_0x4ba2('0x5')]('/api/chat/offline_messages',require(_0x4ba2('0x4c')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x4d'),require(_0x4ba2('0x4e')));_0x59bbff[_0x4ba2('0x5')]('/api/chat/groups',require(_0x4ba2('0x4f')));_0x59bbff['use'](_0x4ba2('0x50'),require(_0x4ba2('0x51')));_0x59bbff['use'](_0x4ba2('0x52'),require(_0x4ba2('0x53')));_0x59bbff[_0x4ba2('0x5')]('/api/cm/contacts',require('./api/cmContact'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x54'),require(_0x4ba2('0x55')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x56'),require(_0x4ba2('0x57')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x58'),require(_0x4ba2('0x59')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x5a'),require(_0x4ba2('0x5b')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x5c'),require('./api/cmCustomField'));_0x59bbff[_0x4ba2('0x5')]('/api/actions',require(_0x4ba2('0x5d')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x5e'),require(_0x4ba2('0x5f')));_0x59bbff[_0x4ba2('0x5')]('/api/canned_answers',require('./api/cannedAnswer'));_0x59bbff['use'](_0x4ba2('0x60'),require(_0x4ba2('0x61')));_0x59bbff['use']('/api/conditions',require(_0x4ba2('0x62')));_0x59bbff['use'](_0x4ba2('0x63'),require('./api/interval'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x64'),require('./api/pause'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x65'),require('./api/cdr'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x66'),require(_0x4ba2('0x67')));_0x59bbff['use'](_0x4ba2('0x68'),require(_0x4ba2('0x69')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x6a'),require(_0x4ba2('0x6b')));_0x59bbff['use'](_0x4ba2('0x6c'),require('./api/tag'));_0x59bbff['use'](_0x4ba2('0x6d'),require(_0x4ba2('0x6e')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x6f'),require(_0x4ba2('0x70')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x71'),require(_0x4ba2('0x72')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x73'),require(_0x4ba2('0x74')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x75'),require(_0x4ba2('0x76')));_0x59bbff['use']('/api/variables',require(_0x4ba2('0x77')));_0x59bbff['use'](_0x4ba2('0x78'),require(_0x4ba2('0x79')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x7a'),require('./api/integrationReport'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x7b'),require(_0x4ba2('0x7c')));_0x59bbff['use']('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x7d'),require(_0x4ba2('0x7e')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x7f'),require('./api/analyticMetric'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x80'),require('./api/analyticFieldReport'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x81'),require(_0x4ba2('0x82')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x83'),require(_0x4ba2('0x84')));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x85'),require(_0x4ba2('0x86')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x87'),require(_0x4ba2('0x88')));_0x59bbff['use'](_0x4ba2('0x89'),require(_0x4ba2('0x8a')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x8b'),require(_0x4ba2('0x8c')));_0x59bbff['use'](_0x4ba2('0x8d'),require('./api/intDeskAccount'));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/desk/configurations',require(_0x4ba2('0x8e')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x8f'),require('./api/intDeskField'));_0x59bbff['use'](_0x4ba2('0x90'),require('./api/intZohoAccount'));_0x59bbff['use']('/api/integrations/zoho/configurations',require(_0x4ba2('0x91')));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/zoho/fields',require(_0x4ba2('0x92')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x93'),require('./api/intZendeskAccount'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x94'),require(_0x4ba2('0x95')));_0x59bbff['use'](_0x4ba2('0x96'),require(_0x4ba2('0x97')));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x98'),require('./api/intFreshdeskConfiguration'));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/freshdesk/fields',require(_0x4ba2('0x99')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x9a'),require(_0x4ba2('0x9b')));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/vtiger/configurations',require(_0x4ba2('0x9c')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x9d'),require(_0x4ba2('0x9e')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x9f'),require(_0x4ba2('0xa0')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xa1'),require(_0x4ba2('0xa2')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xa3'),require(_0x4ba2('0xa4')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xa5'),require('./api/intDynamics365Account'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xa6'),require('./api/intDynamics365Configuration'));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/dynamics365/fields',require(_0x4ba2('0xa7')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xa8'),require('./api/intFreshsalesAccount'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xa9'),require(_0x4ba2('0xaa')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xab'),require(_0x4ba2('0xac')));_0x59bbff[_0x4ba2('0x5')]('/api/networks',require(_0x4ba2('0xad')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xae'),require(_0x4ba2('0xaf')));_0x59bbff[_0x4ba2('0x5')]('/api/chat/internal/messages',require(_0x4ba2('0xb0')));_0x59bbff['use']('/api/jscripty/answers/reports',require(_0x4ba2('0xb1')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xb2'),require('./api/jscriptyQuestionReport'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xb3'),require(_0x4ba2('0xb4')));_0x59bbff['use'](_0x4ba2('0xb5'),require(_0x4ba2('0xb6')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xb7'),require('./api/squareReport'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xb8'),require(_0x4ba2('0xb9')));_0x59bbff['use'](_0x4ba2('0xba'),require('./api/jscriptyProject'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xbb'),require(_0x4ba2('0xbc')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xbd'),require('./api/squareOdbc'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xbe'),require(_0x4ba2('0xbf')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xc0'),require(_0x4ba2('0xc1')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xc2'),require(_0x4ba2('0xc3')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xc4'),require(_0x4ba2('0xc5')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xc6'),require('./api/license'));_0x59bbff['use'](_0x4ba2('0xc7'),require(_0x4ba2('0xc8')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xc9'),require(_0x4ba2('0xca')));_0x59bbff['use']('/api/attachments',require(_0x4ba2('0xcb')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xcc'),require(_0x4ba2('0xcd')));_0x59bbff[_0x4ba2('0x5')]('/api/mail/reports/transfer',require(_0x4ba2('0xce')));_0x59bbff['use'](_0x4ba2('0xcf'),require(_0x4ba2('0xd0')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xd1'),require(_0x4ba2('0xd2')));_0x59bbff['use'](_0x4ba2('0xd3'),require(_0x4ba2('0xd4')));_0x59bbff['use'](_0x4ba2('0xd5'),require(_0x4ba2('0xd6')));_0x59bbff[_0x4ba2('0x5')]('/api/cm/lists',require(_0x4ba2('0xd7')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xd8'),require('./api/voicePrefix'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xd9'),require(_0x4ba2('0xda')));_0x59bbff['use'](_0x4ba2('0xdb'),require(_0x4ba2('0xdc')));_0x59bbff[_0x4ba2('0x5')]('/api/userProfile/resources',require(_0x4ba2('0xdd')));_0x59bbff[_0x4ba2('0x5')]('/api/userNotifications',require(_0x4ba2('0xde')));_0x59bbff['use'](_0x4ba2('0xdf'),require(_0x4ba2('0xe0')));_0x59bbff[_0x4ba2('0x5')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xe1'),require('./api/whatsappInteraction'));_0x59bbff['use'](_0x4ba2('0xe2'),require(_0x4ba2('0xe3')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xe4'),require(_0x4ba2('0xe5')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xe6'),require('./api/whatsappTransferReport'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xe7'),require('./api/whatsappQueue'));_0x59bbff['use'](_0x4ba2('0xe8'),require(_0x4ba2('0xe9')));_0x59bbff[_0x4ba2('0x5')]('/api/realtime',require(_0x4ba2('0xea')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xeb'),require(_0x4ba2('0xec')));_0x59bbff['use'](_0x4ba2('0xed'),require(_0x4ba2('0xee')));_0x59bbff['use'](_0x4ba2('0xef'),require(_0x4ba2('0xf0')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xf1'),require('./api/authActiveDirectory'));_0x59bbff['use'](_0x4ba2('0xf2'),require('./api/jira'));_0x59bbff['use'](_0x4ba2('0xf3'),require(_0x4ba2('0xf4')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xf5'),require(_0x4ba2('0xf6')));_0x59bbff['use'](_0x4ba2('0xf7'),require(_0x4ba2('0xf8')));_0x59bbff['use'](_0x4ba2('0xf9'),require(_0x4ba2('0xfa')));_0x59bbff['use']('/api/webbar',require('./api/webbar'));_0x59bbff[_0x4ba2('0x5')]('/api/logs',clientSideLogs);_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xfb'),express[_0x4ba2('0xfc')](path[_0x4ba2('0xfd')](config[_0x4ba2('0xfe')],_0x4ba2('0xfb'))));_0x59bbff[_0x4ba2('0x5')]('/www',express['static'](path[_0x4ba2('0xfd')](config[_0x4ba2('0xfe')],'/www')));_0x59bbff['use'](_0x4ba2('0xff'),express['static'](path[_0x4ba2('0xfd')](config['root'],'/demo')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x100'),express[_0x4ba2('0xfc')](path[_0x4ba2('0xfd')](config[_0x4ba2('0xfe')],_0x4ba2('0x101'),_0x4ba2('0x102'))));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x103'),express[_0x4ba2('0xfc')](path[_0x4ba2('0xfd')](config[_0x4ba2('0xfe')],_0x4ba2('0x104'))));_0x59bbff[_0x4ba2('0x105')](_0x4ba2('0x106'))[_0x4ba2('0x107')](errors[0x194]);_0x59bbff[_0x4ba2('0x105')]('/*')[_0x4ba2('0x107')](function(_0x37d038,_0x37f09f){_0x37f09f[_0x4ba2('0x108')](path[_0x4ba2('0x109')](_0x59bbff[_0x4ba2('0x107')](_0x4ba2('0x10a'))+_0x4ba2('0x10b')));});return _0x59bbff;});}; \ No newline at end of file +var _0xeef8=['./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','./api/cmHopper','/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/automations','./api/automation','/api/canned_answers','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations'];(function(_0x192c82,_0xd9460b){var _0x27a0f4=function(_0x5c6f8e){while(--_0x5c6f8e){_0x192c82['push'](_0x192c82['shift']());}};_0x27a0f4(++_0xd9460b);}(_0xeef8,0x1a3));var _0x8eef=function(_0x4b5e38,_0xac796d){_0x4b5e38=_0x4b5e38-0x0;var _0x2b2c13=_0xeef8[_0x4b5e38];return _0x2b2c13;};'use strict';var path=require('path');var express=require(_0x8eef('0x0'));var errors=require(_0x8eef('0x1'));var config=require(_0x8eef('0x2'));var setupLoggers=require(_0x8eef('0x3'))[_0x8eef('0x4')];var clientSideLogs=require(_0x8eef('0x5'));exports[_0x8eef('0x6')]=function(_0x1d4dba){return setupLoggers(_0x1d4dba)['then'](function(){_0x1d4dba[_0x8eef('0x7')]('/api/users',require(_0x8eef('0x8')));_0x1d4dba[_0x8eef('0x7')]('/api/voice/chanspy',require(_0x8eef('0x9')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa'),require(_0x8eef('0xb')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xc'),require(_0x8eef('0xd')));_0x1d4dba['use'](_0x8eef('0xe'),require(_0x8eef('0xf')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x10'),require(_0x8eef('0x11')));_0x1d4dba[_0x8eef('0x7')]('/api/voice/recordings',require(_0x8eef('0x12')));_0x1d4dba['use'](_0x8eef('0x13'),require(_0x8eef('0x14')));_0x1d4dba[_0x8eef('0x7')]('/api/voice/mails',require(_0x8eef('0x15')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x16'),require(_0x8eef('0x17')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x18'),require(_0x8eef('0x19')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x1a'),require(_0x8eef('0x1b')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x1c'),require('./api/voiceAgentReport'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x1d'),require('./api/voiceQueueReport'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x1e'),require('./api/memberReport'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x1f'),require(_0x8eef('0x20')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x21'),require(_0x8eef('0x22')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x23'),require(_0x8eef('0x24')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x25'),require('./api/mailAccount'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x26'),require(_0x8eef('0x27')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x28'),require(_0x8eef('0x29')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x2a'),require(_0x8eef('0x2b')));_0x1d4dba[_0x8eef('0x7')]('/api/mail/messages',require(_0x8eef('0x2c')));_0x1d4dba[_0x8eef('0x7')]('/api/mail/applications',require(_0x8eef('0x2d')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x2e'),require(_0x8eef('0x2f')));_0x1d4dba['use'](_0x8eef('0x30'),require(_0x8eef('0x31')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x32'),require('./api/dashboardItem'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x33'),require(_0x8eef('0x34')));_0x1d4dba['use'](_0x8eef('0x35'),require('./api/faxApplication'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x36'),require(_0x8eef('0x37')));_0x1d4dba['use'](_0x8eef('0x38'),require(_0x8eef('0x39')));_0x1d4dba['use'](_0x8eef('0x3a'),require(_0x8eef('0x3b')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x3c'),require(_0x8eef('0x3d')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x3e'),require(_0x8eef('0x3f')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x40'),require(_0x8eef('0x41')));_0x1d4dba['use'](_0x8eef('0x42'),require(_0x8eef('0x43')));_0x1d4dba[_0x8eef('0x7')]('/api/sms/messages',require(_0x8eef('0x44')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x45'),require(_0x8eef('0x46')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x47'),require(_0x8eef('0x48')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x49'),require('./api/openchannelApplication'));_0x1d4dba['use']('/api/openchannel/interactions',require(_0x8eef('0x4a')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x4b'),require('./api/openchannelMessage'));_0x1d4dba[_0x8eef('0x7')]('/api/openchannel/queues',require(_0x8eef('0x4c')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x4d'),require(_0x8eef('0x4e')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x4f'),require(_0x8eef('0x50')));_0x1d4dba[_0x8eef('0x7')]('/api/chat/applications',require(_0x8eef('0x51')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x52'),require(_0x8eef('0x53')));_0x1d4dba[_0x8eef('0x7')]('/api/chat/messages',require(_0x8eef('0x54')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x55'),require(_0x8eef('0x56')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x57'),require(_0x8eef('0x58')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x59'),require(_0x8eef('0x5a')));_0x1d4dba['use']('/api/chat/proactive_actions',require(_0x8eef('0x5b')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x5c'),require('./api/cmCompany'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x5d'),require(_0x8eef('0x5e')));_0x1d4dba[_0x8eef('0x7')]('/api/cm/hopper',require(_0x8eef('0x5f')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x60'),require(_0x8eef('0x61')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x62'),require(_0x8eef('0x63')));_0x1d4dba['use'](_0x8eef('0x64'),require(_0x8eef('0x65')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x66'),require(_0x8eef('0x67')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x68'),require(_0x8eef('0x69')));_0x1d4dba['use'](_0x8eef('0x6a'),require(_0x8eef('0x6b')));_0x1d4dba['use'](_0x8eef('0x6c'),require('./api/cannedAnswer'));_0x1d4dba['use']('/api/dispositions',require(_0x8eef('0x6d')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x6e'),require(_0x8eef('0x6f')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x70'),require(_0x8eef('0x71')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x72'),require('./api/pause'));_0x1d4dba['use'](_0x8eef('0x73'),require('./api/cdr'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x74'),require(_0x8eef('0x75')));_0x1d4dba['use'](_0x8eef('0x76'),require('./api/schedule'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x77'),require(_0x8eef('0x78')));_0x1d4dba['use'](_0x8eef('0x79'),require(_0x8eef('0x7a')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x7b'),require(_0x8eef('0x7c')));_0x1d4dba[_0x8eef('0x7')]('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x1d4dba['use'](_0x8eef('0x7d'),require(_0x8eef('0x7e')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x7f'),require('./api/template'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x80'),require(_0x8eef('0x81')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x82'),require(_0x8eef('0x83')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x84'),require('./api/integration'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x85'),require(_0x8eef('0x86')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x87'),require(_0x8eef('0x88')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x89'),require('./api/analyticDefaultReport'));_0x1d4dba['use'](_0x8eef('0x8a'),require(_0x8eef('0x8b')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x8c'),require(_0x8eef('0x8d')));_0x1d4dba[_0x8eef('0x7')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x8e'),require(_0x8eef('0x8f')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x90'),require(_0x8eef('0x91')));_0x1d4dba['use']('/api/integrations/salesforce/configurations',require(_0x8eef('0x92')));_0x1d4dba['use'](_0x8eef('0x93'),require('./api/intSalesforceField'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x94'),require(_0x8eef('0x95')));_0x1d4dba['use'](_0x8eef('0x96'),require(_0x8eef('0x97')));_0x1d4dba[_0x8eef('0x7')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x1d4dba['use'](_0x8eef('0x98'),require(_0x8eef('0x99')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x9a'),require(_0x8eef('0x9b')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x9c'),require('./api/intDeskField'));_0x1d4dba['use'](_0x8eef('0x9d'),require('./api/intZohoAccount'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x9e'),require(_0x8eef('0x9f')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa0'),require(_0x8eef('0xa1')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa2'),require(_0x8eef('0xa3')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa4'),require('./api/intZendeskConfiguration'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa5'),require(_0x8eef('0xa6')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa7'),require(_0x8eef('0xa8')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa9'),require('./api/intFreshdeskConfiguration'));_0x1d4dba[_0x8eef('0x7')]('/api/integrations/freshdesk/fields',require(_0x8eef('0xaa')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xab'),require(_0x8eef('0xac')));_0x1d4dba['use']('/api/integrations/vtiger/configurations',require(_0x8eef('0xad')));_0x1d4dba[_0x8eef('0x7')]('/api/integrations/vtiger/fields',require(_0x8eef('0xae')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xaf'),require(_0x8eef('0xb0')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xb1'),require(_0x8eef('0xb2')));_0x1d4dba['use']('/api/integrations/servicenow/fields',require(_0x8eef('0xb3')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xb4'),require('./api/intDynamics365Account'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xb5'),require(_0x8eef('0xb6')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xb7'),require(_0x8eef('0xb8')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xb9'),require('./api/intFreshsalesAccount'));_0x1d4dba[_0x8eef('0x7')]('/api/integrations/freshsales/configurations',require(_0x8eef('0xba')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xbb'),require(_0x8eef('0xbc')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xbd'),require(_0x8eef('0xbe')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xbf'),require(_0x8eef('0xc0')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xc1'),require('./api/chatInternalMessage'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xc2'),require(_0x8eef('0xc3')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xc4'),require(_0x8eef('0xc5')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xc6'),require('./api/jscriptySessionReport'));_0x1d4dba['use'](_0x8eef('0xc7'),require(_0x8eef('0xc8')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xc9'),require(_0x8eef('0xca')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xcb'),require(_0x8eef('0xcc')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xcd'),require('./api/jscriptyProject'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xce'),require('./api/setting'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xcf'),require('./api/squareOdbc'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xd0'),require(_0x8eef('0xd1')));_0x1d4dba['use'](_0x8eef('0xd2'),require(_0x8eef('0xd3')));_0x1d4dba['use'](_0x8eef('0xd4'),require(_0x8eef('0xd5')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xd6'),require(_0x8eef('0xd7')));_0x1d4dba['use'](_0x8eef('0xd8'),require(_0x8eef('0xd9')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xda'),require(_0x8eef('0xdb')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xdc'),require(_0x8eef('0xdd')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xde'),require(_0x8eef('0xdf')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xe0'),require('./api/plugin'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xe1'),require(_0x8eef('0xe2')));_0x1d4dba['use'](_0x8eef('0xe3'),require(_0x8eef('0xe4')));_0x1d4dba['use'](_0x8eef('0xe5'),require('./api/faxTransferReport'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xe6'),require(_0x8eef('0xe7')));_0x1d4dba[_0x8eef('0x7')]('/api/sms/reports/transfer',require(_0x8eef('0xe8')));_0x1d4dba[_0x8eef('0x7')]('/api/cm/lists',require('./api/cmList'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xe9'),require(_0x8eef('0xea')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xeb'),require('./api/userProfile'));_0x1d4dba['use'](_0x8eef('0xec'),require(_0x8eef('0xed')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xee'),require(_0x8eef('0xef')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xf0'),require(_0x8eef('0xf1')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xf2'),require('./api/whatsappAccount'));_0x1d4dba[_0x8eef('0x7')]('/api/whatsapp/applications',require(_0x8eef('0xf3')));_0x1d4dba[_0x8eef('0x7')]('/api/whatsapp/interactions',require(_0x8eef('0xf4')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xf5'),require('./api/whatsappMessage'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xf6'),require('./api/whatsappQueueReport'));_0x1d4dba[_0x8eef('0x7')]('/api/whatsapp/reports/transfer',require(_0x8eef('0xf7')));_0x1d4dba[_0x8eef('0x7')]('/api/whatsapp/queues',require(_0x8eef('0xf8')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xf9'),require(_0x8eef('0xfa')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xfb'),require(_0x8eef('0xfc')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xfd'),require(_0x8eef('0xfe')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xff'),require(_0x8eef('0x100')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x101'),require('./api/authGoogle'));_0x1d4dba[_0x8eef('0x7')]('/api/auth/activedirectory',require(_0x8eef('0x102')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x103'),require(_0x8eef('0x104')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x105'),require(_0x8eef('0x106')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x107'),require(_0x8eef('0x108')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x109'),require('./api/system'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x10a'),require(_0x8eef('0x10b')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x10c'),require(_0x8eef('0x10d')));_0x1d4dba['use'](_0x8eef('0x10e'),clientSideLogs);_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x10f'),express[_0x8eef('0x110')](path[_0x8eef('0x111')](config[_0x8eef('0x112')],'/apidoc')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x113'),express[_0x8eef('0x110')](path['join'](config[_0x8eef('0x112')],_0x8eef('0x113'))));_0x1d4dba['use'](_0x8eef('0x114'),express[_0x8eef('0x110')](path[_0x8eef('0x111')](config[_0x8eef('0x112')],'/demo')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x115'),express[_0x8eef('0x110')](path[_0x8eef('0x111')](config[_0x8eef('0x112')],_0x8eef('0x116'),_0x8eef('0x117'))));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x118'),express[_0x8eef('0x110')](path['join'](config[_0x8eef('0x112')],_0x8eef('0x119'))));_0x1d4dba['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x8eef('0x11a')](errors[0x194]);_0x1d4dba['route']('/*')[_0x8eef('0x11a')](function(_0x42973c,_0x4e34a5){_0x4e34a5[_0x8eef('0x11b')](path[_0x8eef('0x11c')](_0x1d4dba['get'](_0x8eef('0x11d'))+_0x8eef('0x11e')));});return _0x1d4dba;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a70a8ab..eb07d42 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaef0=['../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc'];(function(_0xa2ec7c,_0x5ca918){var _0x1ff134=function(_0xb98b90){while(--_0xb98b90){_0xa2ec7c['push'](_0xa2ec7c['shift']());}};_0x1ff134(++_0x5ca918);}(_0xaef0,0x1c8));var _0x0aef=function(_0x5e2152,_0x172f3d){_0x5e2152=_0x5e2152-0x0;var _0x5ddcf6=_0xaef0[_0x5e2152];return _0x5ddcf6;};'use strict';var jayson=require(_0x0aef('0x0'));var _=require('lodash');var config=require(_0x0aef('0x1'));exports[_0x0aef('0x2')]=function(){return new Promise(function(_0x836cb6,_0x2bca8d){var _0x1462f1={};_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x4')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/voiceExtension/voiceExtension.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x5')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/voiceRecording/voiceRecording.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x6')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x7')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x8')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x9')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0xa')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0xb')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0xc')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0xd')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/mailServerIn/mailServerIn.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0xe')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/mailQueue/mailQueue.rpc'));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0xf')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x10')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x11')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x12')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/faxAccount/faxAccount.rpc'));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x13')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x14')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x15')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x16')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x17')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x18')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x19')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x1a')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x1b')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x1c')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x1d')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x1e')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x1f')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x20')));_0x1462f1=_['merge'](_0x1462f1,require('../api/chatMessage/chatMessage.rpc'));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x21')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x22')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/cmHopper/cmHopper.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x23')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x24')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x25')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/interval/interval.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/pause/pause.rpc'));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x26')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x27')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x28')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/trigger/trigger.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x29')));_0x1462f1=_['merge'](_0x1462f1,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x2a')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x2b')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x2c')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x2d')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x2e')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x2f')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x30')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x31')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x32')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x33')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x34')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x35')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/squareOdbc/squareOdbc.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x36')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/squareRecording/squareRecording.rpc'));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x37')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x38')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x39')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x3a')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x3b')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x3c')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x3d')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x2122d2=jayson[_0x0aef('0x3e')](_0x1462f1)[_0x0aef('0x3f')]();var _0x1a4a40=config[_0x0aef('0x40')]['port']||config[_0x0aef('0x41')]+0x1;var _0x2e0f13=config[_0x0aef('0x40')]['ip']||_0x0aef('0x42');_0x2122d2['on'](_0x0aef('0x43'),function(_0x13fde4){return _0x2bca8d(_0x13fde4);});_0x2122d2['listen'](_0x1a4a40,_0x2e0f13,function(){console[_0x0aef('0x44')](_0x0aef('0x45'),_0x2e0f13,_0x1a4a40);require(_0x0aef('0x46'))['default']();return _0x836cb6(_0x0aef('0x47')+_0x2e0f13+':'+_0x1a4a40);});});}; \ No newline at end of file +var _0x9f9e=['../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/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc'];(function(_0x9577ff,_0x168745){var _0x3465cd=function(_0x46832f){while(--_0x46832f){_0x9577ff['push'](_0x9577ff['shift']());}};_0x3465cd(++_0x168745);}(_0x9f9e,0x183));var _0xe9f9=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x9f9e[_0xb833b1];return _0x1ab87a;};'use strict';var jayson=require(_0xe9f9('0x0'));var _=require('lodash');var config=require(_0xe9f9('0x1'));exports[_0xe9f9('0x2')]=function(){return new Promise(function(_0x4ec936,_0x47d3e4){var _0x12de63={};_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x4')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x5')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x6')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x7')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x8')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x9')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0xa')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0xb')));_0x12de63=_['merge'](_0x12de63,require('../api/trunk/trunk.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0xc')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x12de63=_['merge'](_0x12de63,require('../api/mailServerIn/mailServerIn.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0xd')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0xe')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0xf')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/mailMessage/mailMessage.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x10')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x11')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x12')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x13')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x14')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x15')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x16')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x17')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/smsAccount/smsAccount.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x18')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x19')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x1a')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x1b')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x1c')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x1d')));_0x12de63=_['merge'](_0x12de63,require('../api/chatInteraction/chatInteraction.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x1e')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/chatQueue/chatQueue.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/cmContact/cmContact.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x1f')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x20')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x21')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x22')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x12de63=_['merge'](_0x12de63,require('../api/interval/interval.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/pause/pause.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x23')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x24')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x25')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x26')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x27')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x28')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x29')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x2a')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x2b')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x2c')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x2d')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x2e')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x2f')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x30')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x31')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x32')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x33')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x34')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x35')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x36')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/squareRecording/squareRecording.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x37')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x38')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x39')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x3a')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x3b')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x3c')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x3d')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x3e')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x3f')));var _0x39561e=jayson['server'](_0x12de63)['http']();var _0x593774=config[_0xe9f9('0x40')][_0xe9f9('0x41')]||config['port']+0x1;var _0x1dcff2=config['rpc']['ip']||_0xe9f9('0x42');_0x39561e['on'](_0xe9f9('0x43'),function(_0x2f6624){return _0x47d3e4(_0x2f6624);});_0x39561e[_0xe9f9('0x2')](_0x593774,_0x1dcff2,function(){console['log'](_0xe9f9('0x44'),_0x1dcff2,_0x593774);require('../config/triggers')[_0xe9f9('0x45')]();return _0x4ec936(_0xe9f9('0x46')+_0x1dcff2+':'+_0x593774);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 2fcc152..b9fa59e 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 _0x4dcb=['520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','command','sync','answer','sendRequest','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','format','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setExtension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','setEncoding','setTimeout','utf8','headers','ready','line','toLowerCase','hangup','emit','substring'];(function(_0x5eaf92,_0x2d7bf5){var _0x356f60=function(_0x57c770){while(--_0x57c770){_0x5eaf92['push'](_0x5eaf92['shift']());}};_0x356f60(++_0x2d7bf5);}(_0x4dcb,0x186));var _0xb4dc=function(_0x39ef3f,_0x3c920d){_0x39ef3f=_0x39ef3f-0x0;var _0xb3b499=_0x4dcb[_0x39ef3f];return _0xb3b499;};'use strict';var util=require('util');var _=require(_0xb4dc('0x0'));var EventEmitter=require(_0xb4dc('0x1'))[_0xb4dc('0x2')];var AGIReply=require(_0xb4dc('0x3'));var AGIError=require(_0xb4dc('0x4'));function AGIChannel(_0x1fad90){var _0x21b87a=this,_0x2f9f7c=new AGIReply(),_0x161991=![],_0x56a262={};EventEmitter['call'](_0x21b87a);_0x1fad90[_0xb4dc('0x5')]('utf8');_0x1fad90[_0xb4dc('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2f9f7c[_0xb4dc('0x5')](_0xb4dc('0x7'));_0x2f9f7c['on'](_0xb4dc('0x8'),function(_0x6d25){for(var _0x168305 in _0x6d25){_0x21b87a[_0x168305]=_0x6d25[_0x168305];}_0x21b87a['emit'](_0xb4dc('0x9'));});_0x2f9f7c['on'](_0xb4dc('0xa'),function(_0x9b7f60){if(_0x9b7f60[_0xb4dc('0xb')]()==_0xb4dc('0xc')){_0x21b87a[_0xb4dc('0xd')](_0xb4dc('0xc'));return;}if(_0x9b7f60[_0xb4dc('0xe')](0x0,0xb)==_0xb4dc('0xf')){_0x161991=!![];}if(_0x161991){_0x56a262['rx']+=_0x9b7f60+'\x0a';if(_0x9b7f60[_0xb4dc('0x10')](_0xb4dc('0x11'))!=-0x1){_0x161991=![];}}else{_0x56a262['rx']=_0x9b7f60;}if(_0x161991){return;}if(typeof _0x56a262['cb']==_0xb4dc('0x12')){var _0x41bc3c=_0x56a262['rx'][_0xb4dc('0xe')](0x0,0x3),_0x5d5ec0=null,_0x17669f=null;_0x41bc3c=parseInt(_0x41bc3c);if(isNaN(_0x41bc3c)){_0x56a262['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb4dc('0x13')});return;}if(_0x41bc3c!=0xc8){_0x56a262['cb'](null,{'code':_0x41bc3c,'result':-0x1,'extra':'KO'});return;}_0x5d5ec0=_0x56a262['rx'][_0xb4dc('0xe')](0x4)[_0xb4dc('0x14')]('result=','');if(_0x5d5ec0['indexOf']('\x20')!=-0x1){_0x5d5ec0=_0x5d5ec0[_0xb4dc('0x15')](0x0,_0x5d5ec0[_0xb4dc('0x16')]('\x20'));}if(_[_0xb4dc('0x17')](_0x5d5ec0,'-1')){_0x5d5ec0=parseInt(_0x5d5ec0);}_0x17669f=_0x56a262['rx'][_0xb4dc('0x18')]('\x20');if(_0x17669f[_0xb4dc('0x19')]==0x3){_0x17669f=_0x17669f[0x2][_0xb4dc('0xe')](0x1,_0x17669f[0x2]['length']-0x1);}else if(_0x17669f['length']>0x3){var _0x301ef4=/\((.+)\)/;var _0x1fc58e=_0x56a262['rx'][_0xb4dc('0x1a')](_0x301ef4);if(_0x1fc58e){_0x17669f=_0x1fc58e[0x1];}else{_0x17669f=null;}}else{_0x17669f=null;}_0x56a262['cb'](null,{'code':_0x41bc3c,'result':_0x5d5ec0,'extra':_0x17669f});}});_0x1fad90['on'](_0xb4dc('0x1b'),function(_0x46dc08){_0x21b87a[_0xb4dc('0xd')](_0xb4dc('0x1b'),new AGIError(_0xb4dc('0x1c'),_0x46dc08[_0xb4dc('0x1d')]));});_0x1fad90['on'](_0xb4dc('0x1e'),function(){_0x21b87a[_0xb4dc('0xd')](_0xb4dc('0x1e'),new AGIError(_0xb4dc('0x1f')));});_0x1fad90['on'](_0xb4dc('0x20'),function(){_0x21b87a['emit'](_0xb4dc('0x20'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x1fad90[_0xb4dc('0x21')]();});_0x1fad90[_0xb4dc('0x22')](_0x2f9f7c);this['command']=function(_0x2a38d4,_0x1bd5a4){var _0x2a38d4=_0x2a38d4||'',_0x1bd5a4=typeof _0x1bd5a4==_0xb4dc('0x12')?_0x1bd5a4:new Function();_0x56a262={'tx':_0x2a38d4,'rx':'','cb':_0x1bd5a4};_0x1fad90[_0xb4dc('0x23')](_0x2a38d4+'\x0a');},this[_0xb4dc('0x1e')]=function(){_0x1fad90[_0xb4dc('0x21')]();};}util[_0xb4dc('0x24')](AGIChannel,EventEmitter);AGIChannel[_0xb4dc('0x25')]['sendRequest']=function(_0x5b70bf){return this[_0xb4dc('0x26')][_0xb4dc('0x27')](this,_0x5b70bf);};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x28')]=function(){return this[_0xb4dc('0x29')](_0xb4dc('0x2a'));};AGIChannel['prototype'][_0xb4dc('0x2b')]=function(_0x5c3c87,_0x41b5b9,_0x4f72b7){_0x5c3c87=_0x5c3c87===undefined?'beep':_0x5c3c87;_0x41b5b9=_0x41b5b9===undefined?'5':_0x41b5b9;_0x4f72b7=_0x4f72b7===undefined?'1':_0x4f72b7;return this['sendRequest'](util['format'](_0xb4dc('0x2c'),_0x5c3c87,_0x41b5b9*0x3e8,_0x4f72b7));};AGIChannel['prototype'][_0xb4dc('0x2d')]=function(_0x51d809){_0x51d809=_0x51d809||_0xb4dc('0x2e');return this[_0xb4dc('0x29')](util['format']('VERBOSE\x20\x22%s\x22',_0x51d809));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x2f')]=function(_0xdfe87d,_0x31d0c0){if(_[_0xb4dc('0x30')](_0x31d0c0)){return this[_0xb4dc('0x29')](util[_0xb4dc('0x31')](_0xb4dc('0x32'),_0xdfe87d,_0x31d0c0['join'](',')));}return this['sendRequest'](util[_0xb4dc('0x31')](_0xb4dc('0x32'),_0xdfe87d,_0x31d0c0));};AGIChannel['prototype'][_0xb4dc('0x33')]=function(_0x53e8ab){return this[_0xb4dc('0x29')](util[_0xb4dc('0x31')](_0xb4dc('0x34'),_0x53e8ab));};AGIChannel[_0xb4dc('0x25')]['setExtension']=function(_0x55bf60){return this[_0xb4dc('0x29')](util['format']('SET\x20EXTENSION\x20%s',_0x55bf60));};AGIChannel[_0xb4dc('0x25')]['setPriority']=function(_0x3f64e4){return this[_0xb4dc('0x29')](util['format']('SET\x20PRIORITY\x20%s',_0x3f64e4));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest'](_0xb4dc('0x35'));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x36')]=function(_0x4d30b6,_0x467148){var _0x4516ca=_[_0xb4dc('0x37')](_0x467148)||_[_0xb4dc('0x38')](_0x467148)?_0x467148[_0xb4dc('0x39')]():_0x467148;return this['sendRequest'](util[_0xb4dc('0x31')](_0xb4dc('0x3a'),_0x4d30b6,_0x4516ca?_0x4516ca[_0xb4dc('0x39')]()[_0xb4dc('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb4dc('0x25')]['sayNumber']=function(_0x5286d9,_0x219a71){return this[_0xb4dc('0x29')](util[_0xb4dc('0x31')]('SAY\x20NUMBER\x20%s\x20%s',_0x5286d9,_0x219a71));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x3b')]=function(_0x37e59e,_0x17cf20){return this['sendRequest'](util[_0xb4dc('0x31')](_0xb4dc('0x3c'),_0x37e59e,_0x17cf20));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x3d')]=function(_0x137e49,_0x106c0e){return this[_0xb4dc('0x29')](util[_0xb4dc('0x31')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x137e49,_0x106c0e));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x3e')]=function(_0x59f8ea,_0x506d68,_0x43be18){_0x506d68=_0x506d68||this[_0xb4dc('0x3f')];_0x43be18=_0x43be18||0x1;this[_0xb4dc('0x33')](_0x59f8ea);this[_0xb4dc('0x40')](_0x506d68);this[_0xb4dc('0x41')](_0x43be18);return this[_0xb4dc('0x2d')](util['format'](_0xb4dc('0x42'),_0x59f8ea,_0x506d68,_0x43be18));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x43')]=function(_0x5ceb25){return this[_0xb4dc('0x29')](util[_0xb4dc('0x31')](_0xb4dc('0x44'),_0x5ceb25));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x45')]=function(_0x3ca5b8,_0x376c23,_0x583d7e,_0x535c11,_0x12d718,_0x10cd27){_0x376c23=_0x376c23||'wav';_0x583d7e=_0x583d7e||'';_0x535c11=_0x535c11===undefined?-0x1:_0x535c11==='-1'?-0x1:_0x535c11*0x3e8;_0x12d718=_0x12d718===undefined?'':'s='+_0x12d718;_0x10cd27=_0x10cd27?_0xb4dc('0x46'):'';return this[_0xb4dc('0x29')](util[_0xb4dc('0x31')](_0xb4dc('0x47'),_0x3ca5b8,_0x376c23,_0x583d7e,_0x535c11,_0x10cd27,_0x12d718));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x48')]=function(_0x32c4bc,_0x54e93b){_0x54e93b=_0x54e93b||'';return this['sendRequest'](util[_0xb4dc('0x31')](_0xb4dc('0x49'),_0x32c4bc,_0x54e93b));};AGIChannel['prototype'][_0xb4dc('0x4a')]=function(_0x21097b){return this[_0xb4dc('0x2f')](_0xb4dc('0x4b'),_0x21097b);};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x4c')]=function(_0x486dca){return this[_0xb4dc('0x2f')](_0xb4dc('0x4d'),_0x486dca);};AGIChannel['prototype'][_0xb4dc('0x1b')]=function(_0x24b151,_0xad18fb){this[_0xb4dc('0x2d')](util[_0xb4dc('0x31')](_0xb4dc('0x4e'),_0x24b151['id'],_0x24b151[_0xb4dc('0x4f')],_0xad18fb));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xb4dc('0x50')]=AGIChannel; \ No newline at end of file +var _0xb3a9=['SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','wait','WAIT','label','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520-Invalid','function','replace','result=','indexOf','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','inherits','prototype','sendRequest','command','sync','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','isArray','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber'];(function(_0x5b5347,_0x3c9cbd){var _0x2a6698=function(_0x21ca57){while(--_0x21ca57){_0x5b5347['push'](_0x5b5347['shift']());}};_0x2a6698(++_0x3c9cbd);}(_0xb3a9,0xa2));var _0x9b3a=function(_0x141d91,_0x3b60eb){_0x141d91=_0x141d91-0x0;var _0x1a21eb=_0xb3a9[_0x141d91];return _0x1a21eb;};'use strict';var util=require(_0x9b3a('0x0'));var _=require(_0x9b3a('0x1'));var EventEmitter=require(_0x9b3a('0x2'))[_0x9b3a('0x3')];var AGIReply=require(_0x9b3a('0x4'));var AGIError=require(_0x9b3a('0x5'));function AGIChannel(_0x48fc6f){var _0x2b1e25=this,_0xf3f015=new AGIReply(),_0x49ffcf=![],_0x182913={};EventEmitter[_0x9b3a('0x6')](_0x2b1e25);_0x48fc6f[_0x9b3a('0x7')](_0x9b3a('0x8'));_0x48fc6f[_0x9b3a('0x9')](0x8*0x3c*0x3c*0x3e8);_0xf3f015[_0x9b3a('0x7')](_0x9b3a('0x8'));_0xf3f015['on']('headers',function(_0xd7cb7c){for(var _0x5a9e15 in _0xd7cb7c){_0x2b1e25[_0x5a9e15]=_0xd7cb7c[_0x5a9e15];}_0x2b1e25[_0x9b3a('0xa')](_0x9b3a('0xb'));});_0xf3f015['on']('line',function(_0x3cb1df){if(_0x3cb1df[_0x9b3a('0xc')]()==_0x9b3a('0xd')){_0x2b1e25[_0x9b3a('0xa')](_0x9b3a('0xd'));return;}if(_0x3cb1df[_0x9b3a('0xe')](0x0,0xb)==_0x9b3a('0xf')){_0x49ffcf=!![];}if(_0x49ffcf){_0x182913['rx']+=_0x3cb1df+'\x0a';if(_0x3cb1df['search']('520\x20End\x20of\x20proper')!=-0x1){_0x49ffcf=![];}}else{_0x182913['rx']=_0x3cb1df;}if(_0x49ffcf){return;}if(typeof _0x182913['cb']==_0x9b3a('0x10')){var _0x39e268=_0x182913['rx'][_0x9b3a('0xe')](0x0,0x3),_0x34274c=null,_0x31383d=null;_0x39e268=parseInt(_0x39e268);if(isNaN(_0x39e268)){_0x182913['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39e268!=0xc8){_0x182913['cb'](null,{'code':_0x39e268,'result':-0x1,'extra':'KO'});return;}_0x34274c=_0x182913['rx'][_0x9b3a('0xe')](0x4)[_0x9b3a('0x11')](_0x9b3a('0x12'),'');if(_0x34274c[_0x9b3a('0x13')]('\x20')!=-0x1){_0x34274c=_0x34274c['substr'](0x0,_0x34274c[_0x9b3a('0x13')]('\x20'));}if(_[_0x9b3a('0x14')](_0x34274c,'-1')){_0x34274c=parseInt(_0x34274c);}_0x31383d=_0x182913['rx'][_0x9b3a('0x15')]('\x20');if(_0x31383d['length']==0x3){_0x31383d=_0x31383d[0x2][_0x9b3a('0xe')](0x1,_0x31383d[0x2][_0x9b3a('0x16')]-0x1);}else if(_0x31383d[_0x9b3a('0x16')]>0x3){var _0x1c8a05=/\((.+)\)/;var _0x14f7c6=_0x182913['rx'][_0x9b3a('0x17')](_0x1c8a05);if(_0x14f7c6){_0x31383d=_0x14f7c6[0x1];}else{_0x31383d=null;}}else{_0x31383d=null;}_0x182913['cb'](null,{'code':_0x39e268,'result':_0x34274c,'extra':_0x31383d});}});_0x48fc6f['on'](_0x9b3a('0x18'),function(_0x2950a2){_0x2b1e25[_0x9b3a('0xa')](_0x9b3a('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x2950a2[_0x9b3a('0x19')]));});_0x48fc6f['on'](_0x9b3a('0x1a'),function(){_0x2b1e25[_0x9b3a('0xa')]('close',new AGIError(_0x9b3a('0x1b')));});_0x48fc6f['on'](_0x9b3a('0x1c'),function(){_0x2b1e25[_0x9b3a('0xa')](_0x9b3a('0x1c'),new AGIError(_0x9b3a('0x1d')));_0x48fc6f[_0x9b3a('0x1e')]();});_0x48fc6f[_0x9b3a('0x1f')](_0xf3f015);this['command']=function(_0x3b3308,_0x4cd288){var _0x3b3308=_0x3b3308||'',_0x4cd288=typeof _0x4cd288==_0x9b3a('0x10')?_0x4cd288:new Function();_0x182913={'tx':_0x3b3308,'rx':'','cb':_0x4cd288};_0x48fc6f['write'](_0x3b3308+'\x0a');},this[_0x9b3a('0x1a')]=function(){_0x48fc6f['destroy']();};}util[_0x9b3a('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x22')]=function(_0x4c0e57){return this[_0x9b3a('0x23')][_0x9b3a('0x24')](this,_0x4c0e57);};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x25')]=function(){return this[_0x9b3a('0x22')](_0x9b3a('0x26'));};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x27')]=function(_0xb472,_0x2d7ed6,_0x496004){_0xb472=_0xb472===undefined?'beep':_0xb472;_0x2d7ed6=_0x2d7ed6===undefined?'5':_0x2d7ed6;_0x496004=_0x496004===undefined?'1':_0x496004;return this['sendRequest'](util[_0x9b3a('0x28')](_0x9b3a('0x29'),_0xb472,_0x2d7ed6*0x3e8,_0x496004));};AGIChannel['prototype']['noop']=function(_0x12d3a4){_0x12d3a4=_0x12d3a4||'NO\x20MESSAGE';return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')]('VERBOSE\x20\x22%s\x22',_0x12d3a4));};AGIChannel[_0x9b3a('0x21')]['exec']=function(_0x27a8de,_0x3a3fff){if(_[_0x9b3a('0x2a')](_0x3a3fff)){return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')](_0x9b3a('0x2b'),_0x27a8de,_0x3a3fff['join'](',')));}return this['sendRequest'](util[_0x9b3a('0x28')](_0x9b3a('0x2b'),_0x27a8de,_0x3a3fff));};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x2c')]=function(_0x368375){return this[_0x9b3a('0x22')](util['format']('SET\x20CONTEXT\x20%s',_0x368375));};AGIChannel['prototype'][_0x9b3a('0x2d')]=function(_0x5e7a61){return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')](_0x9b3a('0x2e'),_0x5e7a61));};AGIChannel[_0x9b3a('0x21')]['setPriority']=function(_0x2b502f){return this[_0x9b3a('0x22')](util['format'](_0x9b3a('0x2f'),_0x2b502f));};AGIChannel[_0x9b3a('0x21')]['hangup']=function(){return this[_0x9b3a('0x22')](_0x9b3a('0x30'));};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x31')]=function(_0x6a8720,_0x228777){var _0x10bcd2=_[_0x9b3a('0x32')](_0x228777)||_['isNumber'](_0x228777)?_0x228777[_0x9b3a('0x33')]():_0x228777;return this['sendRequest'](util[_0x9b3a('0x28')](_0x9b3a('0x34'),_0x6a8720,_0x10bcd2?_0x10bcd2[_0x9b3a('0x33')]()[_0x9b3a('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x35')]=function(_0x2c9b0e,_0x2f9bfa){return this['sendRequest'](util['format'](_0x9b3a('0x36'),_0x2c9b0e,_0x2f9bfa));};AGIChannel[_0x9b3a('0x21')]['sayDigits']=function(_0x473ffe,_0x1e9abb){return this['sendRequest'](util[_0x9b3a('0x28')](_0x9b3a('0x37'),_0x473ffe,_0x1e9abb));};AGIChannel['prototype'][_0x9b3a('0x38')]=function(_0xf375f4,_0x615e4){return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')](_0x9b3a('0x39'),_0xf375f4,_0x615e4));};AGIChannel['prototype'][_0x9b3a('0x3a')]=function(_0x50ba7d,_0x19698f,_0x5ea016){_0x19698f=_0x19698f||this[_0x9b3a('0x3b')];_0x5ea016=_0x5ea016||0x1;this[_0x9b3a('0x2c')](_0x50ba7d);this['setExtension'](_0x19698f);this['setPriority'](_0x5ea016);return this[_0x9b3a('0x3c')](util[_0x9b3a('0x28')](_0x9b3a('0x3d'),_0x50ba7d,_0x19698f,_0x5ea016));};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x3e')]=function(_0x5914d4){return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')](_0x9b3a('0x3f'),_0x5914d4));};AGIChannel[_0x9b3a('0x21')]['recordFile']=function(_0x58a003,_0x2f832f,_0xb6c55e,_0x2f546a,_0x3261e3,_0x33d2c8){_0x2f832f=_0x2f832f||_0x9b3a('0x40');_0xb6c55e=_0xb6c55e||'';_0x2f546a=_0x2f546a===undefined?-0x1:_0x2f546a==='-1'?-0x1:_0x2f546a*0x3e8;_0x3261e3=_0x3261e3===undefined?'':'s='+_0x3261e3;_0x33d2c8=_0x33d2c8?'BEEP':'';return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')](_0x9b3a('0x41'),_0x58a003,_0x2f832f,_0xb6c55e,_0x2f546a,_0x33d2c8,_0x3261e3));};AGIChannel[_0x9b3a('0x21')]['streamFile']=function(_0x5dfd68,_0x398cfd){_0x398cfd=_0x398cfd||'';return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')](_0x9b3a('0x42'),_0x5dfd68,_0x398cfd));};AGIChannel['prototype'][_0x9b3a('0x43')]=function(_0x29f67c){return this[_0x9b3a('0x44')]('AGI',_0x29f67c);};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x45')]=function(_0x484791){return this[_0x9b3a('0x44')](_0x9b3a('0x46'),_0x484791);};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x18')]=function(_0x500594,_0x210c7d){this['noop'](util[_0x9b3a('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x500594['id'],_0x500594[_0x9b3a('0x47')],_0x210c7d));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 58802b8..83195c4 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 _0x2d90=['push','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x1ce71f,_0x35e676){var _0x361daf=function(_0x121299){while(--_0x121299){_0x1ce71f['push'](_0x1ce71f['shift']());}};_0x361daf(++_0x35e676);}(_0x2d90,0x85));var _0x02d9=function(_0x3b7d25,_0x3245e3){_0x3b7d25=_0x3b7d25-0x0;var _0x5c77bf=_0x2d90[_0x3b7d25];return _0x5c77bf;};'use strict';var util=require(_0x02d9('0x0'));var error={'E_AGI_UNDEFINED':_0x02d9('0x1'),'E_AGI_ARGUMENT_PORT':_0x02d9('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x02d9('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x02d9('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x02d9('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x02d9('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x02d9('0x7'),'E_AGI_COMMAND_EMPTY':_0x02d9('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x02d9('0x9'),'E_AGI_IVR_ENTRY':_0x02d9('0xa')};function AGIError(_0x43e8c0){var _0x43e8c0=_0x43e8c0||null,_0x147d11=_0x147d11||[],_0x570e11=0x1,_0x32c2d9='';if(!error[_0x43e8c0]){_0x43e8c0='E_AGI_UNDEFINED';}_0x147d11[_0x02d9('0xb')](error[_0x43e8c0]);while(arguments[_0x570e11]){_0x147d11['push'](arguments[_0x570e11]);_0x570e11++;}_0x32c2d9=util['format'][_0x02d9('0xc')](util,_0x147d11);this[_0x02d9('0xd')]=_0x32c2d9;this[_0x02d9('0xe')]=_0x43e8c0;}module[_0x02d9('0xf')]=AGIError; \ No newline at end of file +var _0xbd0e=['name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message'];(function(_0x5e295c,_0x4a2c73){var _0x5899aa=function(_0x25fecf){while(--_0x25fecf){_0x5e295c['push'](_0x5e295c['shift']());}};_0x5899aa(++_0x4a2c73);}(_0xbd0e,0x1a2));var _0xebd0=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0xbd0e[_0xc0d9bc];return _0x32ff73;};'use strict';var util=require(_0xebd0('0x0'));var error={'E_AGI_UNDEFINED':_0xebd0('0x1'),'E_AGI_ARGUMENT_PORT':_0xebd0('0x2'),'E_AGI_SERVER_ERROR':_0xebd0('0x3'),'E_AGI_SERVER_CLOSE':_0xebd0('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xebd0('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xebd0('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xebd0('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xebd0('0x8'),'E_AGI_IVR_ENTRY':_0xebd0('0x9')};function AGIError(_0x3b3ae1){var _0x3b3ae1=_0x3b3ae1||null,_0x45bd90=_0x45bd90||[],_0x13befc=0x1,_0xc6a043='';if(!error[_0x3b3ae1]){_0x3b3ae1='E_AGI_UNDEFINED';}_0x45bd90[_0xebd0('0xa')](error[_0x3b3ae1]);while(arguments[_0x13befc]){_0x45bd90[_0xebd0('0xa')](arguments[_0x13befc]);_0x13befc++;}_0xc6a043=util[_0xebd0('0xb')][_0xebd0('0xc')](util,_0x45bd90);this[_0xebd0('0xd')]=_0xc6a043;this[_0xebd0('0xe')]=_0x3b3ae1;}module[_0xebd0('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 9e2b122..2521d9b 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 _0x55f0=['message','parse','emit','projectUpdate','exports','lodash','ioredis','./error','redis','defaults','subscribe','agi','error'];(function(_0xa4b2a,_0x56d081){var _0x100007=function(_0x11657d){while(--_0x11657d){_0xa4b2a['push'](_0xa4b2a['shift']());}};_0x100007(++_0x56d081);}(_0x55f0,0x7a));var _0x055f=function(_0x505a68,_0xa297b7){_0x505a68=_0x505a68-0x0;var _0x4caac6=_0x55f0[_0x505a68];return _0x4caac6;};'use strict';var _=require(_0x055f('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0x055f('0x1'));var AGIError=require(_0x055f('0x2'));var config=require('../../config/environment');config[_0x055f('0x3')]=_[_0x055f('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x055f('0x5')](_0x055f('0x6'),function(_0x1fe3e8){if(_0x1fe3e8)return eventEmitter['emit'](_0x055f('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x1fe3e8));});sub['on'](_0x055f('0x8'),function(_0x5df8ca,_0x373169){if(_0x5df8ca!==_0x055f('0x6'))return;try{var _0x25c73d=JSON[_0x055f('0x9')](_0x373169);eventEmitter[_0x055f('0xa')](_0x055f('0xb'),_0x25c73d);}catch(_0x44d1e3){eventEmitter[_0x055f('0xa')](_0x055f('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x44d1e3));}});module[_0x055f('0xc')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xfa82=['ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','message','parse','projectUpdate','exports','lodash','events','EventEmitter'];(function(_0x3e76da,_0x2efe2b){var _0x3f433d=function(_0x5002af){while(--_0x5002af){_0x3e76da['push'](_0x3e76da['shift']());}};_0x3f433d(++_0x2efe2b);}(_0xfa82,0x151));var _0x2fa8=function(_0x54c27c,_0x4047e5){_0x54c27c=_0x54c27c-0x0;var _0x224b78=_0xfa82[_0x54c27c];return _0x224b78;};'use strict';var _=require(_0x2fa8('0x0'));var EventEmitter=require(_0x2fa8('0x1'))[_0x2fa8('0x2')];var Redis=require(_0x2fa8('0x3'));var AGIError=require(_0x2fa8('0x4'));var config=require(_0x2fa8('0x5'));config[_0x2fa8('0x6')]=_[_0x2fa8('0x7')](config['redis'],{'host':_0x2fa8('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x2fa8('0x6')]);sub[_0x2fa8('0x9')](_0x2fa8('0xa'),function(_0x398578){if(_0x398578)return eventEmitter[_0x2fa8('0xb')](_0x2fa8('0xc'),new AGIError('E_AGI_SERVER_ERROR',_0x398578));});sub['on'](_0x2fa8('0xd'),function(_0x41eafc,_0x55beb3){if(_0x41eafc!==_0x2fa8('0xa'))return;try{var _0xcc1be=JSON[_0x2fa8('0xe')](_0x55beb3);eventEmitter['emit'](_0x2fa8('0xf'),_0xcc1be);}catch(_0x19f52f){eventEmitter['emit'](_0x2fa8('0xc'),new AGIError('E_AGI_SERVER_ERROR',_0x19f52f));}});module[_0x2fa8('0x10')]={'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 3f9633f..9a6e231 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 _0x64ad=['default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','push','size','getVertex','traverseBFS','info','no\x20vertex\x20found','length','condition','split','agicommand','vswitch','target'];(function(_0x2f852e,_0x54e5bd){var _0x124164=function(_0x14a105){while(--_0x14a105){_0x2f852e['push'](_0x2f852e['shift']());}};_0x124164(++_0x54e5bd);}(_0x64ad,0x1e0));var _0xd64a=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0x64ad[_0x5f6a8a];return _0x2cce4d;};'use strict';var _=require(_0xd64a('0x0'));var logger=require(_0xd64a('0x1'))(_0xd64a('0x2'));var verticesWithRetry=[_0xd64a('0x3'),_0xd64a('0x4'),_0xd64a('0x5')];var Graph=function(){this[_0xd64a('0x6')]={};this['edges']={};this[_0xd64a('0x7')]=0x0;};Graph[_0xd64a('0x8')][_0xd64a('0x9')]=function(_0x2f8415){this[_0xd64a('0x6')][_0x2f8415['id']]=_0x2f8415;this[_0xd64a('0xa')][_0x2f8415['id']]=[];};Graph[_0xd64a('0x8')][_0xd64a('0xb')]=function(_0x4db0a9,_0x29d97d,_0x1dd71b){this[_0xd64a('0xa')][_0x4db0a9][_0xd64a('0xc')]({'target':_0x29d97d,'condition':_0x1dd71b});this['numberOfEdges']+=0x1;};Graph[_0xd64a('0x8')][_0xd64a('0xd')]=function(){return _[_0xd64a('0xd')](this[_0xd64a('0x6')]);};Graph[_0xd64a('0x8')]['relations']=function(){return this[_0xd64a('0x7')];};Graph[_0xd64a('0x8')][_0xd64a('0xe')]=function(_0x2ba7e9){return this[_0xd64a('0x6')][_0x2ba7e9];};Graph['prototype'][_0xd64a('0xf')]=function(_0x20cd13,_0x543894){if(!this[_0xd64a('0x6')][_0x20cd13]){return logger[_0xd64a('0x10')](_0xd64a('0x11'));}var _0x16a3f2=_0x543894(this[_0xd64a('0x6')][_0x20cd13]);if(!_0x16a3f2){return logger[_0xd64a('0x10')]('stop\x20traverse');}if(this[_0xd64a('0xa')][_0x20cd13][_0xd64a('0x12')]===0x0){return logger[_0xd64a('0x10')]('no\x20edge/s\x20available');}for(var _0x3267ad=0x0,_0x4cc7f3=[],_0x5a102e=![];_0x3267ad\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','stack','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup','createSquareReport','then','catch','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'];(function(_0x7a6897,_0x66fa7c){var _0x1d49c1=function(_0x34d363){while(--_0x34d363){_0x7a6897['push'](_0x7a6897['shift']());}};_0x1d49c1(++_0x66fa7c);}(_0x9d36,0x14e));var _0x69d3=function(_0x210a8c,_0x4bca1e){_0x210a8c=_0x210a8c-0x0;var _0x97a453=_0x9d36[_0x210a8c];return _0x97a453;};'use strict';var _=require('lodash');var syncho=require(_0x69d3('0x0'));var util=require('util');var config=require(_0x69d3('0x1'));var logger=require(_0x69d3('0x2'))(_0x69d3('0x3'));var utilLicense=require(_0x69d3('0x4'));var rpc=require('./rpc');var Project=require(_0x69d3('0x5'));var AGIEmitter=require(_0x69d3('0x6'))[_0x69d3('0x7')];var projects=[];config[_0x69d3('0x3')]=_[_0x69d3('0x8')](config[_0x69d3('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x69d3('0x9'),projectUpdateHandler);function connectionHandler(_0x21c83a){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x21c83a);agiHandler(_0x21c83a);}catch(_0x39f161){logger[_0x69d3('0xa')](_0x39f161['stack']);}});});}function projectUpdateHandler(_0x436ce3){try{var _0x4c2dd7=_[_0x69d3('0xb')](projects,['id',_0x436ce3['id']]);if(_0x4c2dd7>-0x1){if(_0x436ce3[_0x69d3('0xc')]===!![]){projects[_0x69d3('0xd')](_0x4c2dd7,0x1);}else{projects[_0x4c2dd7]=_0x436ce3;}}else{projects['push'](_0x436ce3);}}catch(_0x2198c4){logger[_0x69d3('0xa')](_0x2198c4['stack']);}}function listeningHandler(){console[_0x69d3('0xe')](_0x69d3('0xf'),config[_0x69d3('0x3')][_0x69d3('0x10')]);logger[_0x69d3('0x11')](util['format'](_0x69d3('0x12'),config[_0x69d3('0x3')]['ip'],config['agi'][_0x69d3('0x10')]));}function errorHandler(_0x15701b){if(_0x15701b&&_0x15701b['name']&&_0x15701b[_0x69d3('0x13')]){logger['error'](util['format']('[%s]\x20%s',_0x15701b[_0x69d3('0x14')],_0x15701b[_0x69d3('0x13')]));}else{logger[_0x69d3('0xa')](util[_0x69d3('0x15')](_0x69d3('0x16'),_0x15701b['stack']));}}function closeHandler(){logger[_0x69d3('0x11')](util[_0x69d3('0x15')](_0x69d3('0x17'),this[_0x69d3('0x18')],this[_0x69d3('0x19')],this[_0x69d3('0x1a')],this['dnid'],this[_0x69d3('0x1b')]));try{createSquareReport(this);}catch(_0x1e37ad){logger[_0x69d3('0xa')](_0x1e37ad[_0x69d3('0x1c')]);}}function timeoutHandler(){logger['info'](util['format'](_0x69d3('0x1d'),this[_0x69d3('0x18')],this[_0x69d3('0x19')],this[_0x69d3('0x1a')],this['dnid'],this[_0x69d3('0x1b')]));}function hangupHandler(){logger['info'](util[_0x69d3('0x15')](_0x69d3('0x1e'),this[_0x69d3('0x18')],this[_0x69d3('0x19')],this[_0x69d3('0x1a')],this[_0x69d3('0x1f')],this['uniqueid']));this[_0x69d3('0x20')]=!![];}function createSquareReport(_0x3fbeae,_0x3102c2){rpc[_0x69d3('0x21')](_0x3fbeae)[_0x69d3('0x22')](function(_0x329beb){if(_0x3102c2){_0x3102c2(null,_0x329beb);}})[_0x69d3('0x23')](function(_0x37c75a){if(_0x3102c2){_0x3102c2(null,_0x37c75a);}});}function setChannelVariables(_0x52d81e){for(var _0x24bb5a in _0x52d81e){if(_0x52d81e['hasOwnProperty'](_0x24bb5a)){if(_0x24bb5a[_0x69d3('0x24')]('agi_')===0x0){_0x52d81e[_0x24bb5a['substring'](0x4)]=_0x52d81e[_0x24bb5a];delete _0x52d81e[_0x24bb5a];}}}}function agiHandler(_0x2c7670){logger[_0x69d3('0x25')](_0x69d3('0x26'),JSON['stringify'](_0x2c7670,null,0x2));logger['info'](util['format'](_0x69d3('0x27'),_0x2c7670[_0x69d3('0x18')],_0x2c7670[_0x69d3('0x19')],_0x2c7670['callerid'],_0x2c7670['dnid'],_0x2c7670[_0x69d3('0x1b')]));_0x2c7670['on'](_0x69d3('0xa'),errorHandler);_0x2c7670['on'](_0x69d3('0x28'),closeHandler);_0x2c7670['on'](_0x69d3('0x29'),timeoutHandler);_0x2c7670[_0x69d3('0x20')]=![];_0x2c7670['on'](_0x69d3('0x2a'),hangupHandler);var _0x1e461b=_[_0x69d3('0x2b')](projects,[_0x69d3('0x14'),_0x2c7670['arg_1']]);if(!_0x1e461b)return Project[_0x69d3('0x2c')](_0x2c7670);if(!_0x1e461b[_0x69d3('0x2d')])return Project[_0x69d3('0x2e')](_0x2c7670);return Project[_0x69d3('0x2f')](_0x1e461b,_0x2c7670);}function main(){var _0x1bf18c;return utilLicense[_0x69d3('0x30')]()[_0x69d3('0x22')](function(_0x2a5cac){if(!_0x2a5cac)return;if(_0x2a5cac['voice']){if(_0x2a5cac['callysquare']&&_0x2a5cac[_0x69d3('0x31')]>0x0){logger[_0x69d3('0x11')](util[_0x69d3('0x15')](_0x69d3('0x32'),_0x2a5cac[_0x69d3('0x31')]));_0x1bf18c=_0x2a5cac[_0x69d3('0x31')];}else{logger[_0x69d3('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x69d3('0x11')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1bf18c=-0x1;}})[_0x69d3('0x22')](function(){return Project['getAll']();})['then'](function(_0x3546e6){projects=_0x3546e6;return;})['catch'](function(_0x52bc25){logger['error']('[LICENSE]',_0x52bc25[_0x69d3('0x1c')]);})['finally'](function(){var _0x25828b=require(_0x69d3('0x33'))(config[_0x69d3('0x3')][_0x69d3('0x10')],config[_0x69d3('0x3')]['ip'],_0x1bf18c);_0x25828b['on']('error',errorHandler);_0x25828b['on'](_0x69d3('0x34'),listeningHandler);_0x25828b['on'](_0x69d3('0x35'),connectionHandler);_0x25828b['on'](_0x69d3('0x28'),closeHandler);});}main(); \ No newline at end of file +var _0xe35a=['stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','format','message','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','stringify','timeout','hangup','find','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','getAll','./server','connection','close','lodash','syncho','util','../../config/logger','agi','../../config/license/util','EventEmitter','defaults','projectUpdate','nextTick','error'];(function(_0x36b6b4,_0x48813c){var _0x44f801=function(_0x369a62){while(--_0x369a62){_0x36b6b4['push'](_0x36b6b4['shift']());}};_0x44f801(++_0x48813c);}(_0xe35a,0x14b));var _0xae35=function(_0x3b30d6,_0xf98295){_0x3b30d6=_0x3b30d6-0x0;var _0x1ecef4=_0xe35a[_0x3b30d6];return _0x1ecef4;};'use strict';var _=require(_0xae35('0x0'));var syncho=require(_0xae35('0x1'));var util=require(_0xae35('0x2'));var config=require('../../config/environment');var logger=require(_0xae35('0x3'))(_0xae35('0x4'));var utilLicense=require(_0xae35('0x5'));var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require('./events')[_0xae35('0x6')];var projects=[];config[_0xae35('0x4')]=_[_0xae35('0x7')](config[_0xae35('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xae35('0x8'),projectUpdateHandler);function connectionHandler(_0x2b3e2f){process[_0xae35('0x9')](function(){syncho(function(){try{setChannelVariables(_0x2b3e2f);agiHandler(_0x2b3e2f);}catch(_0x5075b6){logger[_0xae35('0xa')](_0x5075b6[_0xae35('0xb')]);}});});}function projectUpdateHandler(_0x2b11ea){try{var _0x430b99=_[_0xae35('0xc')](projects,['id',_0x2b11ea['id']]);if(_0x430b99>-0x1){if(_0x2b11ea[_0xae35('0xd')]===!![]){projects[_0xae35('0xe')](_0x430b99,0x1);}else{projects[_0x430b99]=_0x2b11ea;}}else{projects[_0xae35('0xf')](_0x2b11ea);}}catch(_0x1c8d71){logger[_0xae35('0xa')](_0x1c8d71[_0xae35('0xb')]);}}function listeningHandler(){console[_0xae35('0x10')](_0xae35('0x11'),config[_0xae35('0x4')][_0xae35('0x12')]);logger['info'](util['format'](_0xae35('0x13'),config[_0xae35('0x4')]['ip'],config[_0xae35('0x4')][_0xae35('0x12')]));}function errorHandler(_0x1f31fe){if(_0x1f31fe&&_0x1f31fe[_0xae35('0x14')]&&_0x1f31fe['message']){logger[_0xae35('0xa')](util[_0xae35('0x15')]('[%s]\x20%s',_0x1f31fe['name'],_0x1f31fe[_0xae35('0x16')]));}else{logger[_0xae35('0xa')](util[_0xae35('0x15')](_0xae35('0x17'),_0x1f31fe[_0xae35('0xb')]));}}function closeHandler(){logger[_0xae35('0x18')](util['format'](_0xae35('0x19'),this[_0xae35('0x1a')],this[_0xae35('0x1b')],this['callerid'],this['dnid'],this[_0xae35('0x1c')]));try{createSquareReport(this);}catch(_0x391b3c){logger['error'](_0x391b3c['stack']);}}function timeoutHandler(){logger['info'](util[_0xae35('0x15')](_0xae35('0x1d'),this['arg_1'],this[_0xae35('0x1b')],this[_0xae35('0x1e')],this[_0xae35('0x1f')],this['uniqueid']));}function hangupHandler(){logger[_0xae35('0x18')](util[_0xae35('0x15')](_0xae35('0x20'),this[_0xae35('0x1a')],this[_0xae35('0x1b')],this['callerid'],this[_0xae35('0x1f')],this[_0xae35('0x1c')]));this[_0xae35('0x21')]=!![];}function createSquareReport(_0x419bff,_0x4b3d8c){rpc[_0xae35('0x22')](_0x419bff)[_0xae35('0x23')](function(_0xf91241){if(_0x4b3d8c){_0x4b3d8c(null,_0xf91241);}})[_0xae35('0x24')](function(_0x1f2017){if(_0x4b3d8c){_0x4b3d8c(null,_0x1f2017);}});}function setChannelVariables(_0x31b6d7){for(var _0x23569d in _0x31b6d7){if(_0x31b6d7[_0xae35('0x25')](_0x23569d)){if(_0x23569d[_0xae35('0x26')](_0xae35('0x27'))===0x0){_0x31b6d7[_0x23569d[_0xae35('0x28')](0x4)]=_0x31b6d7[_0x23569d];delete _0x31b6d7[_0x23569d];}}}}function agiHandler(_0x403d7b){logger[_0xae35('0x29')]('variables',JSON[_0xae35('0x2a')](_0x403d7b,null,0x2));logger[_0xae35('0x18')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x403d7b['arg_1'],_0x403d7b[_0xae35('0x1b')],_0x403d7b[_0xae35('0x1e')],_0x403d7b['dnid'],_0x403d7b[_0xae35('0x1c')]));_0x403d7b['on']('error',errorHandler);_0x403d7b['on']('close',closeHandler);_0x403d7b['on'](_0xae35('0x2b'),timeoutHandler);_0x403d7b[_0xae35('0x21')]=![];_0x403d7b['on'](_0xae35('0x2c'),hangupHandler);var _0x2d357f=_[_0xae35('0x2d')](projects,[_0xae35('0x14'),_0x403d7b['arg_1']]);if(!_0x2d357f)return Project[_0xae35('0x2e')](_0x403d7b);if(!_0x2d357f[_0xae35('0x2f')])return Project['handleUnpublished'](_0x403d7b);return Project[_0xae35('0x30')](_0x2d357f,_0x403d7b);}function main(){var _0x4c6043;return utilLicense[_0xae35('0x31')]()[_0xae35('0x23')](function(_0x589cb4){if(!_0x589cb4)return;if(_0x589cb4[_0xae35('0x32')]){if(_0x589cb4[_0xae35('0x33')]&&_0x589cb4['callysquare']>0x0){logger[_0xae35('0x18')](util['format'](_0xae35('0x34'),_0x589cb4[_0xae35('0x33')]));_0x4c6043=_0x589cb4['callysquare'];}else{logger[_0xae35('0x18')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xae35('0x18')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x4c6043=-0x1;}})[_0xae35('0x23')](function(){return Project[_0xae35('0x35')]();})['then'](function(_0x2d557b){projects=_0x2d557b;return;})[_0xae35('0x24')](function(_0x2cb357){logger[_0xae35('0xa')]('[LICENSE]',_0x2cb357[_0xae35('0xb')]);})['finally'](function(){var _0x39c256=require(_0xae35('0x36'))(config['agi'][_0xae35('0x12')],config[_0xae35('0x4')]['ip'],_0x4c6043);_0x39c256['on'](_0xae35('0xa'),errorHandler);_0x39c256['on']('listening',listeningHandler);_0x39c256['on'](_0xae35('0x37'),connectionHandler);_0x39c256['on'](_0xae35('0x38'),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 28b5b7e..4efaa40 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 _0x155b=['SendMail','jayson/promise','client','http','error','message','catch'];(function(_0x2240c5,_0x571b8b){var _0x5669ac=function(_0x23bc70){while(--_0x23bc70){_0x2240c5['push'](_0x2240c5['shift']());}};_0x5669ac(++_0x571b8b);}(_0x155b,0x112));var _0xb155=function(_0x425aff,_0x3ba514){_0x425aff=_0x425aff-0x0;var _0x5a6883=_0x155b[_0x425aff];return _0x5a6883;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xb155('0x0'));var client=jayson[_0xb155('0x1')][_0xb155('0x2')]({'port':0x232b});function request(_0x243860,_0x5ca1b9){return new BPromise(function(_0x28a90a,_0x5435e2){return client['request'](_0x243860,_0x5ca1b9)['then'](function(_0x34185e){if(_0x34185e[_0xb155('0x3')]){return _0x5435e2(_0x34185e[_0xb155('0x3')][_0xb155('0x4')]);}else{return _0x28a90a(_0x34185e['result']);}})[_0xb155('0x5')](function(_0x4a7b5b){return _0x5435e2(_0x4a7b5b);});});}exports['sendMailMessage']=function(_0x28bf45,_0x2a1ddf){return request(_0xb155('0x6'),{'account':_0x28bf45,'message':_0x2a1ddf});}; \ No newline at end of file +var _0x14ca=['client','http','request','error','message','catch','SendMail'];(function(_0x29417d,_0x30066c){var _0x12a18d=function(_0x7f732e){while(--_0x7f732e){_0x29417d['push'](_0x29417d['shift']());}};_0x12a18d(++_0x30066c);}(_0x14ca,0x69));var _0xa14c=function(_0x2e6184,_0xf2fc16){_0x2e6184=_0x2e6184-0x0;var _0x1e4c2c=_0x14ca[_0x2e6184];return _0x1e4c2c;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xa14c('0x0')][_0xa14c('0x1')]({'port':0x232b});function request(_0x139fa2,_0x1d9157){return new BPromise(function(_0x12ca6a,_0x1dcb51){return client[_0xa14c('0x2')](_0x139fa2,_0x1d9157)['then'](function(_0x329d69){if(_0x329d69[_0xa14c('0x3')]){return _0x1dcb51(_0x329d69['error'][_0xa14c('0x4')]);}else{return _0x12ca6a(_0x329d69['result']);}})[_0xa14c('0x5')](function(_0x273286){return _0x1dcb51(_0x273286);});});}exports['sendMailMessage']=function(_0x1424f4,_0x2d17b9){return request(_0xa14c('0x6'),{'account':_0x1424f4,'message':_0x2d17b9});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 53403a1..a6e0289 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 _0x4631=['arg_1','calleridname','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','info','code','result','isUndefined','toString','response','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand\x20not\x20found','stack','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','lodash','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','start','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x490a0b,_0x773d1d){var _0x1834b5=function(_0x48b567){while(--_0x48b567){_0x490a0b['push'](_0x490a0b['shift']());}};_0x1834b5(++_0x773d1d);}(_0x4631,0xd6));var _0x1463=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x4631[_0x912d27];return _0x31b918;};'use strict';var _=require(_0x1463('0x0'));var moment=require('moment');var parser=require(_0x1463('0x1'));var util=require(_0x1463('0x2'));var logger=require('../../config/logger')(_0x1463('0x3'));var rpc=require(_0x1463('0x4'));var mailRpc=require(_0x1463('0x5'));var Graph=require(_0x1463('0x6'));var Vertices=require(_0x1463('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x1463('0x8')](function(_0x14942b){logger[_0x1463('0x9')](_0x1463('0xa'),_0x14942b['stack']);return[];});}function addVertex(_0x52489d,_0x529fee,_0x451702){_0x529fee[_0x1463('0xb')]=_0x451702;if(_0x529fee[_0x1463('0xc')](_0x1463('0xd'))){_0x529fee[_0x1463('0xe')]=parseInt(_0x529fee['retry'],0xa);}_0x52489d[_0x1463('0xf')](_[_0x1463('0x10')](_0x529fee,'mxCell'));}function initGraph(_0x3b87cd,_0x173f24){var _0x5008f8=new Graph();for(var _0x589bbc in _0x3b87cd){if(_0x3b87cd[_0x1463('0xc')](_0x589bbc)){if(_[_0x1463('0x11')](_0x3b87cd[_0x589bbc])){for(var _0x5cc6d7=0x0;_0x5cc6d7<_0x3b87cd[_0x589bbc][_0x1463('0x12')];_0x5cc6d7+=0x1){addVertex(_0x5008f8,_0x3b87cd[_0x589bbc][_0x5cc6d7],_0x589bbc);}}else{addVertex(_0x5008f8,_0x3b87cd[_0x589bbc],_0x589bbc);}}}for(var _0x3525fc=0x0;_0x3525fc<_0x173f24[_0x1463('0x12')];_0x3525fc+=0x1){if(_0x173f24[_0x3525fc][_0x1463('0x13')]&&_0x173f24[_0x3525fc][_0x1463('0x14')]){_0x5008f8[_0x1463('0x15')](_0x173f24[_0x3525fc][_0x1463('0x13')],_0x173f24[_0x3525fc][_0x1463('0x14')],_0x173f24[_0x3525fc][_0x1463('0x16')]);}}return _0x5008f8;}function getRoot(_0x1efed9){return parser[_0x1463('0x17')](_0x1efed9,{'object':!![]})[_0x1463('0x18')][_0x1463('0x19')];}function inspect(_0x1b3a0d){return util[_0x1463('0x1a')](_0x1b3a0d,{'showHidden':![],'depth':null});}function initialize(_0x363a44,_0x51ed61){var _0x591dea=getRoot(_0x363a44['production']);if(!_0x591dea||!_0x591dea[_0x1463('0x1b')])return;var _0x5579ee,_0x9730fc,_0x54d754;logger[_0x1463('0x1c')](_0x1463('0x19'),JSON[_0x1463('0x1d')](_0x591dea,null,0x2));_0x51ed61['joinAt']=moment()[_0x1463('0x1e')](_0x1463('0x1f'));_0x5579ee=initGraph(_[_0x1463('0x10')](_0x591dea,_0x1463('0x20')),_0x591dea[_0x1463('0x20')]);_0x9730fc=new Vertices(_0x51ed61,rpc,mailRpc);logger['info'](util[_0x1463('0x1e')](_0x1463('0x21'),_0x51ed61[_0x1463('0x22')],_0x51ed61[_0x1463('0x23')],_0x51ed61['callerid'],_0x51ed61[_0x1463('0x24')],_0x51ed61[_0x1463('0x25')]));_0x5579ee[_0x1463('0x26')](_0x591dea['start']['id'],function(_0xffb520){try{_0xffb520=_0x9730fc[_0x1463('0x27')](_0xffb520);logger[_0x1463('0x1c')](_0x1463('0x28'),JSON[_0x1463('0x1d')](_0xffb520,null,0x2));if(_0xffb520[_0x1463('0xb')]===_0x1463('0x29')){logger['info'](_0x1463('0x2a'));_0x51ed61['context']=_0xffb520[_0x1463('0x2b')]||_0x51ed61[_0x1463('0x2b')];_0x51ed61[_0x1463('0x2c')]=_0xffb520['extension'];_0x51ed61[_0x1463('0x2d')]=_0xffb520['priority']?_0xffb520[_0x1463('0x2d')]-0x1:0x1;return null;}else if(_0xffb520&&_0x9730fc[_0xffb520[_0x1463('0xb')]]){_0x54d754=_0x9730fc[_0xffb520[_0x1463('0xb')]](_0xffb520);logger[_0x1463('0x2e')]('response',JSON['stringify'](_0x54d754,null,0x2));if(_0x54d754&&_0x54d754[_0x1463('0x2f')]===AGI_CODE_SUCCESS&&_0x54d754[_0x1463('0x30')]!==AGI_RESULT_ERROR&&!_0x51ed61['evtHangup']){logger[_0x1463('0x1c')]('response',inspect(_0x54d754));return _[_0x1463('0x31')](_0x54d754[_0x1463('0x30')])?null:_0x54d754[_0x1463('0x30')][_0x1463('0x32')]();}else{logger[_0x1463('0x9')](_0x1463('0x33'),inspect(_0x54d754));return null;}}else{logger[_0x1463('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x3e8f92){logger['error'](_0x3e8f92['stack']);return null;}});if(_0x591dea[_0x1463('0x34')]){logger[_0x1463('0x2e')](util[_0x1463('0x1e')](_0x1463('0x35'),_0x51ed61[_0x1463('0x22')],_0x51ed61[_0x1463('0x23')],_0x51ed61['callerid'],_0x51ed61[_0x1463('0x24')],_0x51ed61[_0x1463('0x25')]));_0x5579ee['traverseBFS'](_0x591dea['finally']['id'],function(_0x178f56){try{_0x178f56=_0x9730fc['clear'](_0x178f56);logger[_0x1463('0x1c')](_0x1463('0x28'),JSON[_0x1463('0x1d')](_0x178f56,null,0x2));if(_0x178f56&&_0x9730fc[_0x178f56[_0x1463('0xb')]]){_0x54d754=_0x9730fc[_0x178f56[_0x1463('0xb')]](_0x178f56);if(_0x54d754){logger['debug']('response',inspect(_0x54d754));return _[_0x1463('0x31')](_0x54d754[_0x1463('0x30')])?null:_0x54d754[_0x1463('0x30')][_0x1463('0x32')]();}else{logger[_0x1463('0x9')](_0x1463('0x33'),inspect(_0x54d754));return null;}}else{logger[_0x1463('0x9')](_0x1463('0x36'));return null;}}catch(_0x4ddb94){logger[_0x1463('0x9')](_0x4ddb94[_0x1463('0x37')]);return null;}});}logger[_0x1463('0x2e')](util[_0x1463('0x1e')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x51ed61[_0x1463('0x22')],_0x51ed61['calleridname'],_0x51ed61[_0x1463('0x38')],_0x51ed61['dnid'],_0x51ed61[_0x1463('0x25')]));logger[_0x1463('0x2e')](util[_0x1463('0x1e')](_0x1463('0x39'),_0x51ed61[_0x1463('0x2b')],_0x51ed61[_0x1463('0x2c')],parseInt(_0x51ed61[_0x1463('0x2d')],0xa)+0x1));_0x51ed61[_0x1463('0x3a')](_0x51ed61[_0x1463('0x2b')],_0x51ed61[_0x1463('0x2c')],parseInt(_0x51ed61[_0x1463('0x2d')],0xa)+0x1);_0x51ed61[_0x1463('0x3b')]();}function handleNotFound(_0x2e712d){logger[_0x1463('0x9')](util[_0x1463('0x1e')](_0x1463('0x3c'),_0x2e712d[_0x1463('0x22')]));_0x2e712d[_0x1463('0x3a')](_0x2e712d[_0x1463('0x2b')],_0x2e712d[_0x1463('0x2c')],parseInt(_0x2e712d['priority'],0xa)+0x1);_0x2e712d[_0x1463('0x3b')]();}function handleUnpublished(_0x18c58a){logger[_0x1463('0x9')](util[_0x1463('0x1e')](_0x1463('0x3d'),_0x18c58a['arg_1']));_0x18c58a[_0x1463('0x3a')](_0x18c58a[_0x1463('0x2b')],_0x18c58a[_0x1463('0x2c')],parseInt(_0x18c58a[_0x1463('0x2d')],0xa)+0x1);_0x18c58a['close']();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xde6e=['stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','info','response','code','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','result','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','exports','lodash','moment','util','../../config/logger','./rpc','./mailRpc','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','value','toJson','mxGraphModel','root','production','start','debug'];(function(_0x5beb2d,_0x16d8e4){var _0x2c140a=function(_0x2fcc6f){while(--_0x2fcc6f){_0x5beb2d['push'](_0x5beb2d['shift']());}};_0x2c140a(++_0x16d8e4);}(_0xde6e,0x1bd));var _0xede6=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0xde6e[_0x359bbe];return _0x1b3353;};'use strict';var _=require(_0xede6('0x0'));var moment=require(_0xede6('0x1'));var parser=require('xml2json');var util=require(_0xede6('0x2'));var logger=require(_0xede6('0x3'))('agi');var rpc=require(_0xede6('0x4'));var mailRpc=require(_0xede6('0x5'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xede6('0x6')]()['catch'](function(_0x3ff24b){logger[_0xede6('0x7')](_0xede6('0x8'),_0x3ff24b[_0xede6('0x9')]);return[];});}function addVertex(_0x570683,_0x1a5544,_0x4e9749){_0x1a5544[_0xede6('0xa')]=_0x4e9749;if(_0x1a5544[_0xede6('0xb')](_0xede6('0xc'))){_0x1a5544[_0xede6('0xd')]=parseInt(_0x1a5544[_0xede6('0xc')],0xa);}_0x570683[_0xede6('0xe')](_[_0xede6('0xf')](_0x1a5544,'mxCell'));}function initGraph(_0x18d170,_0x17c15a){var _0x310a47=new Graph();for(var _0x125048 in _0x18d170){if(_0x18d170[_0xede6('0xb')](_0x125048)){if(_[_0xede6('0x10')](_0x18d170[_0x125048])){for(var _0x9fb22c=0x0;_0x9fb22c<_0x18d170[_0x125048][_0xede6('0x11')];_0x9fb22c+=0x1){addVertex(_0x310a47,_0x18d170[_0x125048][_0x9fb22c],_0x125048);}}else{addVertex(_0x310a47,_0x18d170[_0x125048],_0x125048);}}}for(var _0x26772b=0x0;_0x26772b<_0x17c15a[_0xede6('0x11')];_0x26772b+=0x1){if(_0x17c15a[_0x26772b][_0xede6('0x12')]&&_0x17c15a[_0x26772b][_0xede6('0x13')]){_0x310a47['addEdge'](_0x17c15a[_0x26772b][_0xede6('0x12')],_0x17c15a[_0x26772b][_0xede6('0x13')],_0x17c15a[_0x26772b][_0xede6('0x14')]);}}return _0x310a47;}function getRoot(_0x1a5c50){return parser[_0xede6('0x15')](_0x1a5c50,{'object':!![]})[_0xede6('0x16')][_0xede6('0x17')];}function inspect(_0x42f10f){return util['inspect'](_0x42f10f,{'showHidden':![],'depth':null});}function initialize(_0x2eafeb,_0xa0353c){var _0x1c0db7=getRoot(_0x2eafeb[_0xede6('0x18')]);if(!_0x1c0db7||!_0x1c0db7[_0xede6('0x19')])return;var _0x4dc734,_0x5e1583,_0x4486a4;logger[_0xede6('0x1a')](_0xede6('0x17'),JSON[_0xede6('0x1b')](_0x1c0db7,null,0x2));_0xa0353c[_0xede6('0x1c')]=moment()[_0xede6('0x1d')](_0xede6('0x1e'));_0x4dc734=initGraph(_[_0xede6('0xf')](_0x1c0db7,_0xede6('0x1f')),_0x1c0db7[_0xede6('0x1f')]);_0x5e1583=new Vertices(_0xa0353c,rpc,mailRpc);logger['info'](util[_0xede6('0x1d')](_0xede6('0x20'),_0xa0353c[_0xede6('0x21')],_0xa0353c[_0xede6('0x22')],_0xa0353c[_0xede6('0x23')],_0xa0353c[_0xede6('0x24')],_0xa0353c[_0xede6('0x25')]));_0x4dc734['traverseBFS'](_0x1c0db7[_0xede6('0x19')]['id'],function(_0x189426){try{_0x189426=_0x5e1583['clear'](_0x189426);logger[_0xede6('0x1a')](_0xede6('0x26'),JSON[_0xede6('0x1b')](_0x189426,null,0x2));if(_0x189426[_0xede6('0xa')]===_0xede6('0x27')){logger['info'](_0xede6('0x28'));_0xa0353c[_0xede6('0x29')]=_0x189426[_0xede6('0x29')]||_0xa0353c[_0xede6('0x29')];_0xa0353c[_0xede6('0x2a')]=_0x189426[_0xede6('0x2a')];_0xa0353c[_0xede6('0x2b')]=_0x189426[_0xede6('0x2b')]?_0x189426[_0xede6('0x2b')]-0x1:0x1;return null;}else if(_0x189426&&_0x5e1583[_0x189426[_0xede6('0xa')]]){_0x4486a4=_0x5e1583[_0x189426[_0xede6('0xa')]](_0x189426);logger[_0xede6('0x2c')](_0xede6('0x2d'),JSON['stringify'](_0x4486a4,null,0x2));if(_0x4486a4&&_0x4486a4[_0xede6('0x2e')]===AGI_CODE_SUCCESS&&_0x4486a4['result']!==AGI_RESULT_ERROR&&!_0xa0353c[_0xede6('0x2f')]){logger[_0xede6('0x1a')]('response',inspect(_0x4486a4));return _[_0xede6('0x30')](_0x4486a4['result'])?null:_0x4486a4['result'][_0xede6('0x31')]();}else{logger[_0xede6('0x7')](_0xede6('0x2d'),inspect(_0x4486a4));return null;}}else{logger[_0xede6('0x7')](_0xede6('0x32'));return null;}}catch(_0x21c29c){logger['error'](_0x21c29c[_0xede6('0x9')]);return null;}});if(_0x1c0db7[_0xede6('0x33')]){logger[_0xede6('0x2c')](util[_0xede6('0x1d')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xa0353c[_0xede6('0x21')],_0xa0353c['calleridname'],_0xa0353c[_0xede6('0x23')],_0xa0353c['dnid'],_0xa0353c[_0xede6('0x25')]));_0x4dc734['traverseBFS'](_0x1c0db7['finally']['id'],function(_0x243d22){try{_0x243d22=_0x5e1583['clear'](_0x243d22);logger[_0xede6('0x1a')]('vertex',JSON['stringify'](_0x243d22,null,0x2));if(_0x243d22&&_0x5e1583[_0x243d22[_0xede6('0xa')]]){_0x4486a4=_0x5e1583[_0x243d22['agicommand']](_0x243d22);if(_0x4486a4){logger['debug'](_0xede6('0x2d'),inspect(_0x4486a4));return _[_0xede6('0x30')](_0x4486a4[_0xede6('0x34')])?null:_0x4486a4[_0xede6('0x34')][_0xede6('0x31')]();}else{logger[_0xede6('0x7')](_0xede6('0x2d'),inspect(_0x4486a4));return null;}}else{logger[_0xede6('0x7')](_0xede6('0x32'));return null;}}catch(_0x402538){logger[_0xede6('0x7')](_0x402538[_0xede6('0x9')]);return null;}});}logger['info'](util[_0xede6('0x1d')](_0xede6('0x35'),_0xa0353c[_0xede6('0x21')],_0xa0353c[_0xede6('0x22')],_0xa0353c['callerid'],_0xa0353c['dnid'],_0xa0353c[_0xede6('0x25')]));logger['info'](util['format'](_0xede6('0x36'),_0xa0353c[_0xede6('0x29')],_0xa0353c[_0xede6('0x2a')],parseInt(_0xa0353c[_0xede6('0x2b')],0xa)+0x1));_0xa0353c[_0xede6('0x37')](_0xa0353c[_0xede6('0x29')],_0xa0353c['extension'],parseInt(_0xa0353c[_0xede6('0x2b')],0xa)+0x1);_0xa0353c['close']();}function handleNotFound(_0xfa3f64){logger[_0xede6('0x7')](util[_0xede6('0x1d')](_0xede6('0x38'),_0xfa3f64[_0xede6('0x21')]));_0xfa3f64[_0xede6('0x37')](_0xfa3f64[_0xede6('0x29')],_0xfa3f64[_0xede6('0x2a')],parseInt(_0xfa3f64[_0xede6('0x2b')],0xa)+0x1);_0xfa3f64['close']();}function handleUnpublished(_0x20b90f){logger[_0xede6('0x7')](util[_0xede6('0x1d')]('Project\x20%s\x20not\x20published',_0x20b90f['arg_1']));_0x20b90f[_0xede6('0x37')](_0x20b90f[_0xede6('0x29')],_0x20b90f[_0xede6('0x2a')],parseInt(_0x20b90f['priority'],0xa)+0x1);_0x20b90f[_0xede6('0x39')]();}module[_0xede6('0x3a')]={'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 ec0c0b8..b0da8ac 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 _0xcfaf=['line','util','call','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length','split','slice','trim','emit'];(function(_0x3f1b16,_0x426057){var _0x25eab3=function(_0x10ca08){while(--_0x10ca08){_0x3f1b16['push'](_0x3f1b16['shift']());}};_0x25eab3(++_0x426057);}(_0xcfaf,0xef));var _0xfcfa=function(_0x46f805,_0x12a01){_0x46f805=_0x46f805-0x0;var _0x38dbd9=_0xcfaf[_0x46f805];return _0x38dbd9;};'use strict';var util=require(_0xfcfa('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x411307){Transform[_0xfcfa('0x1')](this,_0x411307);this[_0xfcfa('0x2')]='';this['_inBody']=![];}util[_0xfcfa('0x3')](AGIReply,Transform);AGIReply[_0xfcfa('0x4')][_0xfcfa('0x5')]=function(_0xae8c73,_0x41f99e,_0x3c5daf){var _0x1e30b1='\x0a',_0x511ddd=['\x0a\x0a',_0xfcfa('0x6')],_0x10b77f=-0x1,_0x3ef6cc=-0x1,_0x26c167='',_0x284e80=0x0,_0xdfca2f='',_0x42622d='';this[_0xfcfa('0x2')]+=_0xae8c73[_0xfcfa('0x7')]();_0xdfca2f=this['_localBuffer'];if(!this[_0xfcfa('0x8')]){_0x284e80=0x0;while(_0x511ddd[_0x284e80]){while((_0x3ef6cc=_0xdfca2f[_0xfcfa('0x9')](_0x511ddd[_0x284e80]))!=-0x1){_0x26c167=_0x511ddd[_0x284e80];_0x42622d=_0xdfca2f['substring'](0x0,_0x3ef6cc);_0xdfca2f=_0xdfca2f[_0xfcfa('0xa')](_0x3ef6cc+_0x26c167[_0xfcfa('0xb')]);var _0x4c1c83=_0x42622d[_0xfcfa('0xc')](_0x1e30b1),_0x58df32=0x0,_0x5f2936={},_0x535a43='',_0x459145='',_0xf47b6f=-0x1;while(_0x4c1c83[_0x58df32]){_0xf47b6f=_0x4c1c83[_0x58df32][_0xfcfa('0x9')](':');if(_0xf47b6f!=-0x1){_0x535a43=_0x4c1c83[_0x58df32][_0xfcfa('0xd')](0x0,_0xf47b6f)[_0xfcfa('0xe')]();_0x459145=_0x4c1c83[_0x58df32]['slice'](_0xf47b6f+0x1)['trim']();if(_0x535a43[_0xfcfa('0xb')]>0x0){_0x5f2936[_0x535a43]=_0x459145;}}else{}_0x58df32++;}this[_0xfcfa('0xf')]('headers',_0x5f2936);this[_0xfcfa('0x8')]=!![];}_0x284e80++;}this[_0xfcfa('0x2')]=_0xdfca2f;}else{while((_0x10b77f=_0xdfca2f[_0xfcfa('0x9')](_0x1e30b1))!=-0x1){_0x42622d=_0xdfca2f[_0xfcfa('0xa')](0x0,_0x10b77f);this['emit'](_0xfcfa('0x10'),_0x42622d);_0xdfca2f=_0xdfca2f[_0xfcfa('0xa')](_0x10b77f+_0x1e30b1['length']);}this[_0xfcfa('0x2')]=_0xdfca2f;}_0x3c5daf();};module['exports']=AGIReply; \ No newline at end of file +var _0xd840=['stream','Transform','call','_localBuffer','_inBody','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','trim','slice','emit','line','exports','util'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xd840,0xd7));var _0x0d84=function(_0x21731c,_0x3b38f0){_0x21731c=_0x21731c-0x0;var _0x168953=_0xd840[_0x21731c];return _0x168953;};'use strict';var util=require(_0x0d84('0x0'));var Transform=require(_0x0d84('0x1'))[_0x0d84('0x2')];function AGIReply(_0x58cd73){Transform[_0x0d84('0x3')](this,_0x58cd73);this[_0x0d84('0x4')]='';this[_0x0d84('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x0d84('0x6')]['_transform']=function(_0x55e3b9,_0x3f5f34,_0x5e83a2){var _0x3f4732='\x0a',_0x5df0e9=['\x0a\x0a',_0x0d84('0x7')],_0x4edba8=-0x1,_0x95403c=-0x1,_0x3147a1='',_0x4e633e=0x0,_0x286d73='',_0x365421='';this['_localBuffer']+=_0x55e3b9[_0x0d84('0x8')]();_0x286d73=this[_0x0d84('0x4')];if(!this[_0x0d84('0x5')]){_0x4e633e=0x0;while(_0x5df0e9[_0x4e633e]){while((_0x95403c=_0x286d73[_0x0d84('0x9')](_0x5df0e9[_0x4e633e]))!=-0x1){_0x3147a1=_0x5df0e9[_0x4e633e];_0x365421=_0x286d73['substring'](0x0,_0x95403c);_0x286d73=_0x286d73[_0x0d84('0xa')](_0x95403c+_0x3147a1[_0x0d84('0xb')]);var _0x489d97=_0x365421[_0x0d84('0xc')](_0x3f4732),_0x418c8d=0x0,_0x4bed18={},_0xb14a7a='',_0x466792='',_0x5a2b57=-0x1;while(_0x489d97[_0x418c8d]){_0x5a2b57=_0x489d97[_0x418c8d][_0x0d84('0x9')](':');if(_0x5a2b57!=-0x1){_0xb14a7a=_0x489d97[_0x418c8d]['slice'](0x0,_0x5a2b57)[_0x0d84('0xd')]();_0x466792=_0x489d97[_0x418c8d][_0x0d84('0xe')](_0x5a2b57+0x1)['trim']();if(_0xb14a7a[_0x0d84('0xb')]>0x0){_0x4bed18[_0xb14a7a]=_0x466792;}}else{}_0x418c8d++;}this[_0x0d84('0xf')]('headers',_0x4bed18);this[_0x0d84('0x5')]=!![];}_0x4e633e++;}this['_localBuffer']=_0x286d73;}else{while((_0x4edba8=_0x286d73[_0x0d84('0x9')](_0x3f4732))!=-0x1){_0x365421=_0x286d73[_0x0d84('0xa')](0x0,_0x4edba8);this[_0x0d84('0xf')](_0x0d84('0x10'),_0x365421);_0x286d73=_0x286d73[_0x0d84('0xa')](_0x4edba8+_0x3f4732['length']);}this[_0x0d84('0x4')]=_0x286d73;}_0x5e83a2();};module[_0x0d84('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 0f15ed9..45e3518 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 _0x61b8=['GetSquareProjects','name','production','ShowSquareProject','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','ShowSmsAccount','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','ListId','then','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','error','message','result','catch','getSquareProjects'];(function(_0x43cca7,_0x167394){var _0x8df5e4=function(_0x5aad00){while(--_0x5aad00){_0x43cca7['push'](_0x43cca7['shift']());}};_0x8df5e4(++_0x167394);}(_0x61b8,0x169));var _0x861b=function(_0x2e8efe,_0x30687a){_0x2e8efe=_0x2e8efe-0x0;var _0xec5586=_0x61b8[_0x2e8efe];return _0xec5586;};'use strict';var _=require(_0x861b('0x0'));var moment=require(_0x861b('0x1'));var jayson=require(_0x861b('0x2'));var client=jayson['client'][_0x861b('0x3')]({'port':0x2329});function request(_0x4e113b,_0x542fea){return new Promise(function(_0x37b79f,_0x10e70b){return client[_0x861b('0x4')](_0x4e113b,_0x542fea)['then'](function(_0x160455){if(_0x160455[_0x861b('0x5')]){return _0x10e70b(_0x160455[_0x861b('0x5')][_0x861b('0x6')]);}else{return _0x37b79f(_0x160455[_0x861b('0x7')]);}})[_0x861b('0x8')](function(_0x436722){return _0x10e70b(_0x436722);});});}exports[_0x861b('0x9')]=function(){return request(_0x861b('0xa'),{'options':{'raw':![],'attributes':['id',_0x861b('0xb'),_0x861b('0xc')]}});};exports['getSquareProject']=function(_0xdc4df8){return request(_0x861b('0xd'),{'options':{'raw':![],'where':{'name':_0xdc4df8},'attributes':[_0x861b('0xc')]}});};exports['getMailAccountById']=function(_0x1e1eec){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x1e1eec},'include':[{'model':_0x861b('0xe'),'as':_0x861b('0xf'),'include':[{'model':'CloudProvider','as':_0x861b('0x10')}]}],'attributes':['id',_0x861b('0xb'),_0x861b('0x11')],'smtp':!![]}});};exports[_0x861b('0x12')]=function(_0x202a74){return request(_0x861b('0xd'),{'options':{'where':{'id':_0x202a74},'attributes':[_0x861b('0xb')]}});};exports[_0x861b('0x13')]=function(_0x44b444){return request(_0x861b('0x14'),{'options':{'where':{'id':_0x44b444},'attributes':[_0x861b('0xb')]}});};exports[_0x861b('0x15')]=function(_0x264ba1){return request(_0x861b('0x16'),{'options':{'where':{'id':_0x264ba1},'attributes':[_0x861b('0xb')]}});};exports[_0x861b('0x17')]=function(_0x5121aa){return request(_0x861b('0x18'),{'options':{'where':{'id':_0x5121aa},'attributes':['dsn']}});};exports['getUserById']=function(_0x3d828f){return request('ShowUser',{'options':{'where':{'id':_0x3d828f},'attributes':[_0x861b('0xb')]}});};exports[_0x861b('0x19')]=function(_0x4aafa8){return request(_0x861b('0x1a'),{'options':{'where':{'phone':_0x4aafa8[_0x861b('0x1b')]},'attributes':['id']}});};exports[_0x861b('0x1c')]=function(_0x11a914){return request('ShowTrunk',{'options':{'where':{'id':_0x11a914},'attributes':['name']}});};exports[_0x861b('0x1d')]=function(_0x426a99){return request(_0x861b('0x1e'),{'options':{'where':{'id':_0x426a99},'attributes':['save_name']}});};exports[_0x861b('0x1f')]=function(_0x4dab89){return request(_0x861b('0x20'),{'options':{'raw':![],'where':{'id':_0x4dab89},'include':[{'model':_0x861b('0x21'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x474f49){return request(_0x861b('0x22'),{'options':{'where':{'id':_0x474f49},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x24aed8){return request('CreateSmsMessage',{'body':_0x24aed8});};exports['createSquareDetailsReport']=function(_0x26c7b9){return request('CreateSquareDetailsReport',{'body':_0x26c7b9});};exports['createSquareReport']=function(_0x1b0cc3){return request(_0x861b('0x23'),{'body':_[_0x861b('0x24')](_0x1b0cc3,{'project_name':_0x1b0cc3[_0x861b('0x25')],'prev_project_name':_0x1b0cc3[_0x861b('0x26')]||'','is_subproject':_0x1b0cc3[_0x861b('0x26')]?!![]:![],'leaveAt':moment()['format'](_0x861b('0x27'))})});};exports[_0x861b('0x28')]=function(_0x2d4ed8){return request(_0x861b('0x29'),{'body':_0x2d4ed8});};exports[_0x861b('0x2a')]=function(_0x27a1b5){return request('CreateSquareMessage',{'body':_0x27a1b5});};exports['createCmContact']=function(_0x3882a1){return request(_0x861b('0x2b'),{'options':{'raw':![],'where':{'phone':_0x3882a1[_0x861b('0x1b')],'ListId':_0x3882a1[_0x861b('0x2c')]}}})[_0x861b('0x2d')](function(_0x31c890){if(_0x31c890){return _0x31c890;}return request('CreateCmContact',{'body':_0x3882a1});});};exports['getPauseById']=function(_0x19ee4e){return request('ShowPause',{'options':{'where':{'id':_0x19ee4e},'attributes':[_0x861b('0xb')]}});};exports[_0x861b('0x2e')]=function(_0x35f343,_0x162102){return request(_0x861b('0x2f'),{'body':{'interface':_0x162102},'options':{'where':_0x35f343}});};exports[_0x861b('0x30')]=function(_0x3d8f60,_0x39f1be,_0x4f17c1){return request('PauseUser',{'body':{'type':_0x39f1be,'uniqueid':_0x4f17c1},'options':{'where':_0x3d8f60}});};exports[_0x861b('0x31')]=function(_0x53b215){return request(_0x861b('0x32'),{'body':{},'options':{'where':_0x53b215}});};exports[_0x861b('0x33')]=function(_0x50e5d8){return request(_0x861b('0x34'),{'body':{},'options':{'where':_0x50e5d8}});}; \ No newline at end of file +var _0x43b1=['ShowCmHopper','ListId','CreateCmContact','getPauseById','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','lodash','moment','jayson/promise','http','request','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','getSquareProject','getMailAccountById','MailServerOut','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','merge','arg_2','format','createSquareMessage','createCmContact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43b1,0x7d));var _0x143b=function(_0x4585a4,_0x362e07){_0x4585a4=_0x4585a4-0x0;var _0x4691cb=_0x43b1[_0x4585a4];return _0x4691cb;};'use strict';var _=require(_0x143b('0x0'));var moment=require(_0x143b('0x1'));var jayson=require(_0x143b('0x2'));var client=jayson['client'][_0x143b('0x3')]({'port':0x2329});function request(_0x4976d0,_0x1e1282){return new Promise(function(_0x4388c5,_0x223e86){return client[_0x143b('0x4')](_0x4976d0,_0x1e1282)[_0x143b('0x5')](function(_0x367a29){if(_0x367a29['error']){return _0x223e86(_0x367a29[_0x143b('0x6')][_0x143b('0x7')]);}else{return _0x4388c5(_0x367a29[_0x143b('0x8')]);}})['catch'](function(_0x453a09){return _0x223e86(_0x453a09);});});}exports[_0x143b('0x9')]=function(){return request(_0x143b('0xa'),{'options':{'raw':![],'attributes':['id',_0x143b('0xb'),_0x143b('0xc')]}});};exports[_0x143b('0xd')]=function(_0xf5e80b){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xf5e80b},'attributes':[_0x143b('0xc')]}});};exports[_0x143b('0xe')]=function(_0x4e49bf){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4e49bf},'include':[{'model':_0x143b('0xf'),'as':'Smtp','include':[{'model':_0x143b('0x10'),'as':_0x143b('0x10')}]}],'attributes':['id','name',_0x143b('0x11')],'smtp':!![]}});};exports[_0x143b('0x12')]=function(_0x8d5095){return request(_0x143b('0x13'),{'options':{'where':{'id':_0x8d5095},'attributes':[_0x143b('0xb')]}});};exports[_0x143b('0x14')]=function(_0x1325c3){return request(_0x143b('0x15'),{'options':{'where':{'id':_0x1325c3},'attributes':[_0x143b('0xb')]}});};exports[_0x143b('0x16')]=function(_0x2bca2c){return request(_0x143b('0x17'),{'options':{'where':{'id':_0x2bca2c},'attributes':[_0x143b('0xb')]}});};exports[_0x143b('0x18')]=function(_0x11d3a9){return request(_0x143b('0x19'),{'options':{'where':{'id':_0x11d3a9},'attributes':[_0x143b('0x1a')]}});};exports['getUserById']=function(_0x520197){return request(_0x143b('0x1b'),{'options':{'where':{'id':_0x520197},'attributes':[_0x143b('0xb')]}});};exports[_0x143b('0x1c')]=function(_0x139aa9){return request(_0x143b('0x1d'),{'options':{'where':{'phone':_0x139aa9[_0x143b('0x1e')]},'attributes':['id']}});};exports[_0x143b('0x1f')]=function(_0x1ca6d2){return request(_0x143b('0x20'),{'options':{'where':{'id':_0x1ca6d2},'attributes':[_0x143b('0xb')]}});};exports[_0x143b('0x21')]=function(_0x59c3d9){return request(_0x143b('0x22'),{'options':{'where':{'id':_0x59c3d9},'attributes':[_0x143b('0x23')]}});};exports[_0x143b('0x24')]=function(_0xfd9194){return request(_0x143b('0x25'),{'options':{'raw':![],'where':{'id':_0xfd9194},'include':[{'model':_0x143b('0x26'),'as':_0x143b('0x27')}]}});};exports[_0x143b('0x28')]=function(_0x5d0684){return request(_0x143b('0x29'),{'options':{'where':{'id':_0x5d0684},'attributes':['id','name']}});};exports[_0x143b('0x2a')]=function(_0x5bdebc){return request('CreateSmsMessage',{'body':_0x5bdebc});};exports[_0x143b('0x2b')]=function(_0x100021){return request('CreateSquareDetailsReport',{'body':_0x100021});};exports['createSquareReport']=function(_0x161f9c){return request('CreateSquareReport',{'body':_[_0x143b('0x2c')](_0x161f9c,{'project_name':_0x161f9c['arg_1'],'prev_project_name':_0x161f9c[_0x143b('0x2d')]||'','is_subproject':_0x161f9c[_0x143b('0x2d')]?!![]:![],'leaveAt':moment()[_0x143b('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x485336){return request('CreateSquareRecording',{'body':_0x485336});};exports[_0x143b('0x2f')]=function(_0x4a4090){return request('CreateSquareMessage',{'body':_0x4a4090});};exports[_0x143b('0x30')]=function(_0x37611b){return request(_0x143b('0x31'),{'options':{'raw':![],'where':{'phone':_0x37611b['phone'],'ListId':_0x37611b[_0x143b('0x32')]}}})[_0x143b('0x5')](function(_0x42e136){if(_0x42e136){return _0x42e136;}return request(_0x143b('0x33'),{'body':_0x37611b});});};exports[_0x143b('0x34')]=function(_0x487101){return request('ShowPause',{'options':{'where':{'id':_0x487101},'attributes':['name']}});};exports['agentLogin']=function(_0x25e9ca,_0x144e60){return request(_0x143b('0x35'),{'body':{'interface':_0x144e60},'options':{'where':_0x25e9ca}});};exports[_0x143b('0x36')]=function(_0x129366,_0x1012d7,_0x10cef8){return request(_0x143b('0x37'),{'body':{'type':_0x1012d7,'uniqueid':_0x10cef8},'options':{'where':_0x129366}});};exports[_0x143b('0x38')]=function(_0x3f6e0e){return request('UnpauseUser',{'body':{},'options':{'where':_0x3f6e0e}});};exports[_0x143b('0x39')]=function(_0x3711a5){return request('LogoutUser',{'body':{},'options':{'where':_0x3711a5}});}; \ 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 ad6b41c..ebfc926 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 _0x3f27=['./lex','exports','./polly'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0x3f27,0x1f4));var _0x73f2=function(_0x16e78d,_0x3175e5){_0x16e78d=_0x16e78d-0x0;var _0x8e91aa=_0x3f27[_0x16e78d];return _0x8e91aa;};var polly=require(_0x73f2('0x0'));var lex=require(_0x73f2('0x1'));module[_0x73f2('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5496=['exports','./polly','./lex'];(function(_0x2892db,_0x37719b){var _0x39089f=function(_0x3731c0){while(--_0x3731c0){_0x2892db['push'](_0x2892db['shift']());}};_0x39089f(++_0x37719b);}(_0x5496,0x175));var _0x6549=function(_0x4c969e,_0x475c50){_0x4c969e=_0x4c969e-0x0;var _0x1cb300=_0x5496[_0x4c969e];return _0x1cb300;};var polly=require(_0x6549('0x0'));var lex=require(_0x6549('0x1'));module[_0x6549('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 74558f2..07a8f2c 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 _0x750a=['exports'];(function(_0x2b0f88,_0x53d553){var _0xb5e6ef=function(_0x2e8e19){while(--_0x2e8e19){_0x2b0f88['push'](_0x2b0f88['shift']());}};_0xb5e6ef(++_0x53d553);}(_0x750a,0x140));var _0xa750=function(_0xa95722,_0x1023b0){_0xa95722=_0xa95722-0x0;var _0x5351ae=_0x750a[_0xa95722];return _0x5351ae;};'use strict';var lex=require('./lib/api');module[_0xa750('0x0')]=function(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f){return lex(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f);}; \ No newline at end of file +var _0x6c76=['./lib/api','exports'];(function(_0x2b9722,_0xbbd987){var _0x11f78a=function(_0x21ffd4){while(--_0x21ffd4){_0x2b9722['push'](_0x2b9722['shift']());}};_0x11f78a(++_0xbbd987);}(_0x6c76,0x184));var _0x66c7=function(_0x1fd4cb,_0x25f3ee){_0x1fd4cb=_0x1fd4cb-0x0;var _0x45e715=_0x6c76[_0x1fd4cb];return _0x45e715;};'use strict';var lex=require(_0x66c7('0x0'));module[_0x66c7('0x1')]=function(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b){return lex(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b);}; \ 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 95deafb..f2485b3 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(_0x4fec1e,_0x44bbaa){var _0x566d20=function(_0x1e25ae){while(--_0x1e25ae){_0x4fec1e['push'](_0x4fec1e['shift']());}};_0x566d20(++_0x44bbaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x4784fe,_0x1af504){var _0x5bfe9c=function(_0x318c96){while(--_0x318c96){_0x4784fe['push'](_0x4784fe['shift']());}};_0x5bfe9c(++_0x1af504);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 c9f1987..0218042 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 _0xf66d=['exports'];(function(_0x249b69,_0x3edb9b){var _0xed236b=function(_0xb3506c){while(--_0xb3506c){_0x249b69['push'](_0x249b69['shift']());}};_0xed236b(++_0x3edb9b);}(_0xf66d,0x103));var _0xdf66=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xf66d[_0x298ed3];return _0x5aad28;};'use strict';var polly=require('./lib/api');module[_0xdf66('0x0')]=function(_0x36c1a3,_0x56db7a,_0x382f94,_0x5bfbc9,_0x4a7eec,_0x4c600c,_0x484fdc){return polly(_0x36c1a3,_0x56db7a,_0x382f94,_0x5bfbc9,_0x4a7eec,_0x4c600c,_0x484fdc);}; \ No newline at end of file +var _0x6d0e=['exports','./lib/api'];(function(_0x5d5e22,_0x58888f){var _0x45ac12=function(_0x24338a){while(--_0x24338a){_0x5d5e22['push'](_0x5d5e22['shift']());}};_0x45ac12(++_0x58888f);}(_0x6d0e,0x1b3));var _0xe6d0=function(_0x2fffbf,_0x17635e){_0x2fffbf=_0x2fffbf-0x0;var _0x59b320=_0x6d0e[_0x2fffbf];return _0x59b320;};'use strict';var polly=require(_0xe6d0('0x0'));module[_0xe6d0('0x1')]=function(_0x572d0e,_0x2570bd,_0x527978,_0x30d05d,_0x3761fb,_0x5e7f07,_0x5197c8){return polly(_0x572d0e,_0x2570bd,_0x527978,_0x30d05d,_0x3761fb,_0x5e7f07,_0x5197c8);}; \ 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 d00a688..7c920c9 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 _0x67c9=['Polly','text','mp3','bluebird','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x1eca20,_0x29506f){var _0x1e3c2b=function(_0x55587a){while(--_0x55587a){_0x1eca20['push'](_0x1eca20['shift']());}};_0x1e3c2b(++_0x29506f);}(_0x67c9,0xdb));var _0x967c=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x67c9[_0x38b14f];return _0x22a324;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x967c('0x0'));var rs=require(_0x967c('0x1'));var AWS=require(_0x967c('0x2'));function pollyResult(_0x2c3b39,_0x192500,_0xe424a9){return new BPromise(function(_0x517e01,_0x195c2c){_0x2c3b39['synthesizeSpeech'](_0x192500,function(_0x410142,_0x310511){if(_0x410142){_0x195c2c(_0x410142);}else if(_0x310511){if(_0x310511[_0x967c('0x3')]instanceof Buffer){fs[_0x967c('0x4')](_0xe424a9,_0x310511[_0x967c('0x3')],function(_0x3cb1cc){if(_0x3cb1cc){_0x195c2c(_0x3cb1cc);}else{_0x517e01();}});}else{_0x195c2c(new Error(_0x967c('0x5')));}}else{_0x195c2c(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x582633,_0x358f0f,_0x1eda12,_0x57fc08,_0x48c63b,_0x54f0d3,_0x2b0fa2){var _0x351113=new AWS[(_0x967c('0x6'))]({'accessKeyId':_0x582633,'secretAccessKey':_0x358f0f,'region':_0x1eda12});var _0x375151={'Text':_0x48c63b,'TextType':_0x54f0d3||_0x967c('0x7'),'OutputFormat':_0x967c('0x8'),'VoiceId':_0x57fc08};return pollyResult(_0x351113,_0x375151,_0x2b0fa2);}; \ No newline at end of file +var _0x42c3=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream'];(function(_0x388800,_0x4a6dd9){var _0x4f1dae=function(_0x59950d){while(--_0x59950d){_0x388800['push'](_0x388800['shift']());}};_0x4f1dae(++_0x4a6dd9);}(_0x42c3,0x90));var _0x342c=function(_0x5289cd,_0x5d4305){_0x5289cd=_0x5289cd-0x0;var _0x782abf=_0x42c3[_0x5289cd];return _0x782abf;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x342c('0x0'));var rs=require(_0x342c('0x1'));var AWS=require(_0x342c('0x2'));function pollyResult(_0x381d25,_0x194c2f,_0x151189){return new BPromise(function(_0x1f23d9,_0x50f717){_0x381d25[_0x342c('0x3')](_0x194c2f,function(_0x3a1d37,_0x1ba839){if(_0x3a1d37){_0x50f717(_0x3a1d37);}else if(_0x1ba839){if(_0x1ba839['AudioStream']instanceof Buffer){fs[_0x342c('0x4')](_0x151189,_0x1ba839[_0x342c('0x5')],function(_0x52232a){if(_0x52232a){_0x50f717(_0x52232a);}else{_0x1f23d9();}});}else{_0x50f717(new Error(_0x342c('0x6')));}}else{_0x50f717(new Error(_0x342c('0x7')));}});});}module[_0x342c('0x8')]=function(_0x5237a9,_0x2a3561,_0x45d72d,_0x4c2bd5,_0x12d8a0,_0x130f1d,_0x96ee79){var _0x4ca715=new AWS[(_0x342c('0x9'))]({'accessKeyId':_0x5237a9,'secretAccessKey':_0x2a3561,'region':_0x45d72d});var _0x4f7fc1={'Text':_0x12d8a0,'TextType':_0x130f1d||'text','OutputFormat':'mp3','VoiceId':_0x4c2bd5};return pollyResult(_0x4ca715,_0x4f7fc1,_0x96ee79);}; \ 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 5fdcbcc..caa591e 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 _0x4691=['./lib/api'];(function(_0x46aea1,_0x5e48ea){var _0x810497=function(_0x25ad6d){while(--_0x25ad6d){_0x46aea1['push'](_0x46aea1['shift']());}};_0x810497(++_0x5e48ea);}(_0x4691,0xae));var _0x1469=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x4691[_0x8c43de];return _0xa6591b;};'use strict';var asr=require(_0x1469('0x0'));module['exports']=function(_0x4aab5a,_0x54944e,_0x50eec8,_0x4d8308){return asr(_0x4aab5a,_0x54944e,_0x50eec8);}; \ No newline at end of file +var _0xcfb7=['./lib/api','exports'];(function(_0x3687eb,_0x1628aa){var _0x4839cf=function(_0x21a11d){while(--_0x21a11d){_0x3687eb['push'](_0x3687eb['shift']());}};_0x4839cf(++_0x1628aa);}(_0xcfb7,0xc2));var _0x7cfb=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xcfb7[_0x18b5e8];return _0x25baed;};'use strict';var asr=require(_0x7cfb('0x0'));module[_0x7cfb('0x1')]=function(_0x2d8706,_0x2b0f86,_0xdd65bb,_0x164861){return asr(_0x2d8706,_0x2b0f86,_0xdd65bb);}; \ 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 d6b6fba..03289a7 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 _0x1e69=['POST','/v1/speech:recognize?key=','8000','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64'];(function(_0x5c1fdc,_0x4904ee){var _0x476d9c=function(_0x1fde51){while(--_0x1fde51){_0x5c1fdc['push'](_0x5c1fdc['shift']());}};_0x476d9c(++_0x4904ee);}(_0x1e69,0x85));var _0x91e6=function(_0x1d16fc,_0xe56c15){_0x1d16fc=_0x1d16fc-0x0;var _0x2c84bc=_0x1e69[_0x1d16fc];return _0x2c84bc;};'use strict';var url=require('url');var BPromise=require(_0x91e6('0x0'));var fs=require('fs');var host=_0x91e6('0x1');module[_0x91e6('0x2')]=function(_0x3a523e,_0x4f5881,_0x537c0e){return new BPromise(function(_0x192f10,_0x351c1d){var _0x2b53b6;if(typeof _0x3a523e!==_0x91e6('0x3')||_0x3a523e[_0x91e6('0x4')]===0x0){return _0x351c1d(_0x91e6('0x5'));}if(typeof _0x4f5881!==_0x91e6('0x3')||_0x4f5881[_0x91e6('0x4')]===0x0){return _0x351c1d(_0x91e6('0x6'));}if(typeof _0x537c0e!==_0x91e6('0x7')&&(typeof _0x537c0e!==_0x91e6('0x3')||_0x537c0e[_0x91e6('0x4')]===0x0)){return _0x351c1d(_0x91e6('0x8'));}try{_0x2b53b6=fs['readFileSync'](_0x3a523e)['toString'](_0x91e6('0x9'));}catch(_0x260c4d){return _0x351c1d(_0x260c4d);}return _0x192f10({'method':_0x91e6('0xa'),'uri':host+_0x91e6('0xb')+_0x4f5881,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x91e6('0xc'),'languageCode':_0x537c0e},'audio':{'content':_0x2b53b6}},'json':!![]});});}; \ No newline at end of file +var _0xde13=['/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','POST'];(function(_0x47f3c4,_0x5823c1){var _0xddab96=function(_0x5d7f5a){while(--_0x5d7f5a){_0x47f3c4['push'](_0x47f3c4['shift']());}};_0xddab96(++_0x5823c1);}(_0xde13,0x146));var _0x3de1=function(_0x1463ae,_0x496ad7){_0x1463ae=_0x1463ae-0x0;var _0x45d090=_0xde13[_0x1463ae];return _0x45d090;};'use strict';var url=require(_0x3de1('0x0'));var BPromise=require(_0x3de1('0x1'));var fs=require('fs');var host=_0x3de1('0x2');module[_0x3de1('0x3')]=function(_0x2dcc03,_0x5c4dbc,_0x1594b3){return new BPromise(function(_0x207db1,_0x420711){var _0x4b5b09;if(typeof _0x2dcc03!==_0x3de1('0x4')||_0x2dcc03['length']===0x0){return _0x420711(_0x3de1('0x5'));}if(typeof _0x5c4dbc!==_0x3de1('0x4')||_0x5c4dbc[_0x3de1('0x6')]===0x0){return _0x420711(_0x3de1('0x7'));}if(typeof _0x1594b3!=='undefined'&&(typeof _0x1594b3!==_0x3de1('0x4')||_0x1594b3[_0x3de1('0x6')]===0x0)){return _0x420711(_0x3de1('0x8'));}try{_0x4b5b09=fs['readFileSync'](_0x2dcc03)['toString']('base64');}catch(_0x39f8ac){return _0x420711(_0x39f8ac);}return _0x207db1({'method':_0x3de1('0x9'),'uri':host+_0x3de1('0xa')+_0x5c4dbc,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x3de1('0xb'),'languageCode':_0x1594b3},'audio':{'content':_0x4b5b09}},'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 a132b0a..8921520 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 _0xd8fe=['./asr','exports'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xd8fe,0x19c));var _0xed8f=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0xd8fe[_0x2f71f6];return _0x2b23ea;};var asr=require(_0xed8f('0x0'));module[_0xed8f('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4d3b=['exports','./asr'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d3b,0x151));var _0xb4d3=function(_0x1e9b46,_0x8174db){_0x1e9b46=_0x1e9b46-0x0;var _0x51c9f5=_0x4d3b[_0x1e9b46];return _0x51c9f5;};var asr=require(_0xb4d3('0x0'));module[_0xb4d3('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 62a4165..45dd1ec 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 _0x954c=['google-tts-api','url','parse','util','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','error','request\x20to\x20','statusMessage','statusCode','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','get','\x20failed,\x20status\x20code\x20=\x20','data','end','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','sessionPath','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','languageCode','queryText','intentDetectionConfidence','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','https','md5','querystring','request-promise','randomstring'];(function(_0x150ef5,_0x3a3644){var _0x3b9b88=function(_0x3640e6){while(--_0x3640e6){_0x150ef5['push'](_0x150ef5['shift']());}};_0x3b9b88(++_0x3a3644);}(_0x954c,0x19c));var _0xc954=function(_0x47fa07,_0x1b5de8){_0x47fa07=_0x47fa07-0x0;var _0x2c2a05=_0x954c[_0x47fa07];return _0x2c2a05;};'use strict';var apiai=require(_0xc954('0x0'));var BPromise=require(_0xc954('0x1'));var dialogflow=require(_0xc954('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xc954('0x3'));var md5=require(_0xc954('0x4'));var path=require('path');var querystring=require(_0xc954('0x5'));var rp=require(_0xc954('0x6'));var rs=require(_0xc954('0x7'));var sox=require('sox');var tts=require(_0xc954('0x8'));var urlParse=require(_0xc954('0x9'))[_0xc954('0xa')];var util=require(_0xc954('0xb'));var aws=require('./aws');var google=require('./google');var sestek=require(_0xc954('0xc'));var tilde=require(_0xc954('0xd'));var logger=require(_0xc954('0xe'))(_0xc954('0xf'));var ISPEECH_API=_0xc954('0x10');function downloadFile(_0x38ee3f,_0x24f92c){return new BPromise(function(_0x10ed3a,_0x5691ba){var _0x569d48=urlParse(_0x38ee3f);var _0x1a4881=_0x569d48[_0xc954('0x11')]===_0xc954('0x12')?https:http;var _0x54c44d={'host':_0x569d48[_0xc954('0x13')],'path':_0x569d48[_0xc954('0x14')],'headers':{'user-agent':_0xc954('0x15')}};_0x1a4881['get'](_0x54c44d,function(_0x47ef6a){if(_0x47ef6a['statusCode']!==0xc8){logger[_0xc954('0x16')](_0xc954('0x17')+_0x38ee3f+'\x20failed,\x20status\x20code\x20=\x20'+_0x47ef6a['statusCode']+'\x20('+_0x47ef6a[_0xc954('0x18')]+')');_0x5691ba(new Error('request\x20to\x20'+_0x38ee3f+'\x20failed,\x20status\x20code\x20=\x20'+_0x47ef6a[_0xc954('0x19')]+'\x20('+_0x47ef6a[_0xc954('0x18')]+')'));return;}var _0x394c51=fs[_0xc954('0x1a')](_0x24f92c);_0x394c51['on'](_0xc954('0x1b'),function(){logger[_0xc954('0x1c')](_0xc954('0x1d'));_0x394c51[_0xc954('0x1e')](_0x10ed3a);});_0x394c51['on'](_0xc954('0x16'),function(_0x3bacf6){fs[_0xc954('0x1f')](_0x24f92c);logger[_0xc954('0x16')]('download\x20error',_0x3bacf6);_0x5691ba(_0x3bacf6);});_0x47ef6a[_0xc954('0x20')](_0x394c51);})['on'](_0xc954('0x16'),function(_0x36f8cb){logger[_0xc954('0x16')](_0x36f8cb);_0x5691ba(_0x36f8cb);})['end']();});}function uploadFile(_0x38bc75){return new BPromise(function(_0x121261,_0x665f8a){var _0x3d1312=urlParse(_0x38bc75);var _0x4c446c=_0x3d1312['protocol']==='https:'?https:http;var _0x38125f={'host':_0x3d1312[_0xc954('0x13')],'path':_0x3d1312[_0xc954('0x14')],'headers':{'user-agent':_0xc954('0x15')}};_0x4c446c[_0xc954('0x21')](_0x38125f,function(_0x498163){if(_0x498163['statusCode']!==0xc8){_0x665f8a(new Error(_0xc954('0x17')+_0x38bc75+_0xc954('0x22')+_0x498163[_0xc954('0x19')]+'\x20('+_0x498163['statusMessage']+')'));return;}var _0x542da2='';_0x498163['on'](_0xc954('0x23'),function(_0x4090fd){_0x542da2+=_0x4090fd;});_0x498163['on'](_0xc954('0x24'),function(){_0x121261(_0x542da2);});})['on'](_0xc954('0x16'),function(_0x3b39a1){_0x665f8a(_0x3b39a1);})[_0xc954('0x24')]();});}function convertFile(_0x580aec,_0x1327af){return new BPromise(function(_0x1cbb26,_0x44f39a){var _0x36b37a=sox['transcode'](_0x580aec,_0x1327af,{'sampleRate':0x1f40,'format':_0xc954('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36b37a['on'](_0xc954('0x16'),function(_0x537184){logger[_0xc954('0x16')](_0xc954('0x26'),_0x537184);_0x44f39a(_0x537184);});_0x36b37a['on'](_0xc954('0x24'),function(){logger[_0xc954('0x1c')](_0xc954('0x27'));_0x1cbb26();});_0x36b37a[_0xc954('0x28')]();});}function base64Decode(_0x37120c,_0x3ad459){var _0x32cea2=path[_0xc954('0x29')](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+'.wav');fs[_0xc954('0x2c')](_0x32cea2,_0x37120c,_0xc954('0x2d'));return convertFile(_0x32cea2,_0x3ad459)[_0xc954('0x2e')](function(){try{fs[_0xc954('0x1f')](_0x32cea2);fs[_0xc954('0x2f')](_0x3ad459,_0xc954('0x30'));}catch(_0x2135e6){logger[_0xc954('0x16')](_0x2135e6);}return _0x3ad459[_0xc954('0x31')]('.')[0x0];});}function base64Encode(_0x166277){var _0x5ec7e3=fs[_0xc954('0x32')](_0x166277);return new Buffer(_0x5ec7e3)[_0xc954('0x33')](_0xc954('0x2d'));}exports[_0xc954('0x34')]=function(_0x310d0b,_0xfc7b83,_0x10e65e,_0x262788,_0x319bec,_0xf337f5){var _0x1804b5,_0x4fe1f2;var _0x464cbb=_0xc954('0x35');var _0x1e6e6f=_0xc954('0x36')+_0x310d0b;var _0x24d349={};if(_0xfc7b83===_0xc954('0x37')){_0x24d349[_0xc954('0x38')]={'ssml':_0x10e65e};}else{_0x24d349['input']={'text':_0x10e65e};};_0x24d349[_0xc954('0x39')]={'languageCode':_0x262788,'ssmlGender':_0x319bec};_0x24d349[_0xc954('0x3a')]={'audioEncoding':_0xc954('0x3b'),'sampleRateHertz':0x1f40};var _0x36a24a={'url':_0x464cbb+_0xc954('0x3c')+_0x1e6e6f,'method':_0xc954('0x3d'),'json':!![],'body':_0x24d349};return rp(_0x36a24a)[_0xc954('0x2e')](function(_0x5ccfee){return new BPromise(function(_0xf06b4b,_0x5a00bf){_0x1804b5=path[_0xc954('0x29')](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+_0xc954('0x3e'));var _0x553942=Buffer[_0xc954('0x3f')](_0x5ccfee[_0xc954('0x40')],'base64');return fs[_0xc954('0x41')](_0x1804b5,_0x553942,function(_0x12301a){_0x5a00bf(_0x12301a);},function(_0x2e81d1){fs[_0xc954('0x2f')](_0x1804b5,_0xc954('0x30'));_0xf06b4b(_0x2e81d1);});});})[_0xc954('0x2e')](function(_0x3bfc07){_0x4fe1f2=path['resolve'](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+_0xc954('0x42'));return convertFile(_0x1804b5,_0x4fe1f2);})[_0xc954('0x2e')](function(){try{fs[_0xc954('0x1f')](_0x1804b5);fs[_0xc954('0x2f')](_0x4fe1f2,_0xc954('0x30'));}catch(_0x507be6){logger['error'](_0x507be6);}logger[_0xc954('0x1c')](_0xc954('0x43'),_0x4fe1f2[_0xc954('0x31')]('.')[0x0]);return _0x4fe1f2[_0xc954('0x31')]('.')[0x0];});};exports[_0xc954('0x44')]=function(_0x39c9a9,_0x26e71a){var _0x4f7c07=_0xc954('0x45');var _0x43bbac,_0x3166a5;var _0x3b873e;var _0x19b7a8={'encoding':'utf8','method':_0xc954('0x3d'),'timeout':0x2710,'url':_0x4f7c07,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xc954('0x46')+encodeURIComponent(JSON[_0xc954('0x47')]([[[_0xc954('0x48'),JSON['stringify']([_0x39c9a9,_0x26e71a||'en',![],_0xc954('0x49')]),null,_0xc954('0x4a')]]]))};return rp(_0x19b7a8)[_0xc954('0x2e')](function(_0xfb09a6){try{_0x3b873e=eval(_0xfb09a6['slice'](0x5))[0x0][0x2];}catch(_0x4b4246){throw new Error(_0xc954('0x4b')+_0xfb09a6[_0xc954('0x23')]);}if(!_0x3b873e){if(_0x39c9a9[_0xc954('0x4c')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x26e71a+_0xc954('0x4d'));}}try{_0x3b873e=eval(_0x3b873e)[0x0];}catch(_0x392d20){throw new Error(_0xc954('0x4b')+res[_0xc954('0x23')]);}const _0x4abfa8=_0x3b873e;_0x43bbac=path['resolve'](__dirname,'tmp',rs[_0xc954('0x2b')](0x4)+_0xc954('0x3e'));fs['writeFileSync'](_0x43bbac,_0x3b873e,{'encoding':_0xc954('0x2d')});_0x3166a5=path['resolve'](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+_0xc954('0x42'));return convertFile(_0x43bbac,_0x3166a5);})['then'](function(){try{fs['unlink'](_0x43bbac);fs[_0xc954('0x2f')](_0x3166a5,_0xc954('0x30'));}catch(_0xe0a288){logger[_0xc954('0x16')](_0xe0a288);}logger[_0xc954('0x1c')](_0xc954('0x4e'),_0x3166a5[_0xc954('0x31')]('.')[0x0]);return _0x3166a5[_0xc954('0x31')]('.')[0x0];});};exports['googleASR']=function(_0x1beb56,_0x39a963,_0x145098){return google[_0xc954('0x4f')](_0x1beb56,_0x39a963,_0x145098)[_0xc954('0x2e')](function(_0x3aef5f){logger[_0xc954('0x1c')](_0x3aef5f[_0xc954('0x50')]);return rp(_0x3aef5f);})[_0xc954('0x2e')](function(_0x5c5d7a){var _0x29a9e9='';var _0x3174a4=0x0;try{fs[_0xc954('0x1f')](_0x1beb56);}catch(_0x486506){logger['error'](_0x486506);}if(_0x5c5d7a&&_0x5c5d7a['results']){_0x29a9e9=_0x5c5d7a[_0xc954('0x51')][_0xc954('0x52')](function(_0x12f86a){return _0x12f86a&&_0x12f86a[_0xc954('0x53')][0x0]&&_0x12f86a['alternatives'][0x0]['transcript']?_0x12f86a[_0xc954('0x53')][0x0][_0xc954('0x54')]:'';})[_0xc954('0x55')]('\x0a');_0x3174a4=_0x5c5d7a[_0xc954('0x51')][_0xc954('0x52')](function(_0x180899){return _0x180899&&_0x180899['alternatives'][0x0]&&_0x180899[_0xc954('0x53')][0x0]['confidence']?_0x180899[_0xc954('0x53')][0x0][_0xc954('0x56')]:0x0;})[_0xc954('0x55')]('\x0a');}logger[_0xc954('0x1c')](_0xc954('0x57'),_0x29a9e9);logger[_0xc954('0x1c')](_0xc954('0x58'),_0x3174a4);return{'transcript':_0x29a9e9,'confidence':_0x3174a4};})['catch'](function(_0xa8a479){logger[_0xc954('0x16')]('[%s]\x20%s:%s',_0xa8a479[_0xc954('0x19')],_0xa8a479[_0xc954('0x59')],_0xa8a479[_0xc954('0x5a')]);});};exports[_0xc954('0x5b')]=function(_0x417cd6,_0x5f4567,_0x2b10c3,_0x201821){var _0x41f60b=apiai(_0x5f4567,{'language':_0x201821||'en'});return _0x41f60b[_0xc954('0x5c')](_0x2b10c3,{'sessionId':md5(_0x417cd6)})[_0xc954('0x2e')](function(_0xf6c302){logger[_0xc954('0x1c')](JSON[_0xc954('0x47')](_0xf6c302));return{'source':_0xf6c302[_0xc954('0x5d')][_0xc954('0x5e')],'resolvedQuery':_0xf6c302[_0xc954('0x5d')][_0xc954('0x5f')],'action':_0xf6c302[_0xc954('0x5d')]['action'],'actionIncomplete':_0xf6c302[_0xc954('0x5d')][_0xc954('0x60')],'speech':_0xf6c302[_0xc954('0x5d')][_0xc954('0x61')][_0xc954('0x62')],'score':_0xf6c302[_0xc954('0x5d')][_0xc954('0x63')],'statusCode':_0xf6c302[_0xc954('0x64')][_0xc954('0x65')],'endConversation':_0xf6c302['result'][_0xc954('0x66')][_0xc954('0x67')]||![],'isFallbackIntent':_0xf6c302[_0xc954('0x5d')][_0xc954('0x66')][_0xc954('0x68')]};});};exports[_0xc954('0x69')]=function(_0x2ad6cc,_0x470a9b,_0x1e6af6,_0x35db30,_0x56a70e,_0x4633f7){var _0x208da3=_0x35db30['replace'](/\\n/g,'\x0a');var _0x589e8c={'credentials':{'private_key':_0x208da3,'client_email':_0x1e6af6}};var _0x5c354a=new dialogflow['SessionsClient'](_0x589e8c);var _0x3d4020=_0x5c354a[_0xc954('0x6a')](_0x470a9b,md5(_0x2ad6cc));var _0x3daa76={'session':_0x3d4020,'queryInput':{'text':{'text':_0x56a70e,'languageCode':_0x4633f7}}};return _0x5c354a['detectIntent'](_0x3daa76)['then'](function(_0x2a330b){if(_0x2a330b&&_0x2a330b['length']){logger[_0xc954('0x1c')](_0xc954('0x6b'),JSON[_0xc954('0x47')](_0x2a330b));var _0x3f0449=_0x2a330b[0x0];if(_0x3f0449){var _0x72464e={'action':_0x3f0449[_0xc954('0x6c')][_0xc954('0x6d')],'allRequiredParamsPresent':_0x3f0449[_0xc954('0x6c')]['allRequiredParamsPresent'],'endConversation':_0x3f0449['queryResult'][_0xc954('0x6e')]&&_0x3f0449[_0xc954('0x6c')][_0xc954('0x6e')]['fields']?_0x3f0449['queryResult'][_0xc954('0x6e')][_0xc954('0x6f')][_0xc954('0x70')][_0xc954('0x71')]:![],'fulfillmentText':_0x3f0449[_0xc954('0x6c')]['fulfillmentText'],'intentName':_0x3f0449[_0xc954('0x6c')][_0xc954('0x72')][_0xc954('0x59')],'intentDisplayName':_0x3f0449['queryResult'][_0xc954('0x72')][_0xc954('0x73')],'isFallbackIntent':_0x3f0449['queryResult'][_0xc954('0x72')]['isFallback'],'languageCode':_0x3f0449['queryResult'][_0xc954('0x74')],'queryText':_0x3f0449[_0xc954('0x6c')][_0xc954('0x75')],'responseId':_0x3f0449['responseId'],'score':_0x3f0449[_0xc954('0x6c')][_0xc954('0x76')],'speech':_0x3f0449[_0xc954('0x6c')]['fulfillmentText'],'providerResponse':JSON[_0xc954('0x47')](_0x2a330b)};return _0x72464e;}}});};exports['tildeASR']=function(_0xc38899,_0xf4b2fb,_0x33aa04,_0x66ba48){return tilde['asr'](_0xc38899,_0xf4b2fb,_0x33aa04,_0x66ba48)[_0xc954('0x2e')](function(_0x4c6ef7){try{fs[_0xc954('0x1f')](_0xc38899);}catch(_0x5db19f){logger[_0xc954('0x16')](_0x5db19f);}logger['info'](_0xc954('0x77'),_0x4c6ef7[_0xc954('0x54')]);logger[_0xc954('0x1c')]('Tilde\x20ASR\x20confidence',_0x4c6ef7[_0xc954('0x56')]);return _0x4c6ef7;});};exports[_0xc954('0x78')]=function(_0x22dfa2,_0x2a9893,_0x463c36,_0x232fe8,_0x210bf6,_0x576668){var _0x230b22=path[_0xc954('0x29')](__dirname,_0xc954('0x2a'),rs['generate'](0x4)+_0xc954('0x3e'));var _0x4928d0;return aws[_0xc954('0x79')](_0x22dfa2,_0x2a9893,_0x463c36,_0x232fe8,_0x210bf6,_0x576668,_0x230b22)[_0xc954('0x2e')](function(){_0x4928d0=path[_0xc954('0x29')](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+_0xc954('0x42'));return convertFile(_0x230b22,_0x4928d0);})[_0xc954('0x2e')](function(){try{fs[_0xc954('0x1f')](_0x230b22);fs[_0xc954('0x2f')](_0x4928d0,_0xc954('0x30'));}catch(_0x464182){logger['error'](_0x464182);}return _0x4928d0[_0xc954('0x31')]('.')[0x0];});};exports[_0xc954('0x7a')]=function(_0x3964bb,_0x58d743,_0x39aa7f,_0x16a524,_0x49b61d,_0x1ade7d){return aws[_0xc954('0x7b')](_0x3964bb,_0x58d743,_0x39aa7f,_0x16a524,_0x49b61d,_0x1ade7d)['then'](function(_0xef30c3){logger[_0xc954('0x1c')](JSON['stringify'](_0xef30c3));return _0xef30c3;});};exports[_0xc954('0x7c')]=function(_0x4728ad,_0x266ea8,_0xba3580,_0x4dbf3f){var _0x405fae=util[_0xc954('0x7d')](_0xc954('0x7e'),ISPEECH_API,_0x4728ad,encodeURIComponent(_0x266ea8),_0xba3580,_0x4dbf3f);var _0x58660d=path['resolve'](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+_0xc954('0x3e'));var _0x14a634;return downloadFile(_0x405fae,_0x58660d)[_0xc954('0x2e')](function(){_0x14a634=path['resolve'](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+_0xc954('0x42'));return convertFile(_0x58660d,_0x14a634);})[_0xc954('0x2e')](function(){try{fs[_0xc954('0x1f')](_0x58660d);fs['chmodSync'](_0x14a634,_0xc954('0x30'));}catch(_0x518cb9){logger[_0xc954('0x16')](_0x518cb9);}return _0x14a634[_0xc954('0x31')]('.')[0x0];});};exports[_0xc954('0x7f')]=function(_0x168317,_0x2a7d88,_0x37fe16,_0x64c4d2){var _0x4f8b52=util[_0xc954('0x7d')](_0xc954('0x80'),ISPEECH_API,_0x2a7d88,_0x37fe16,base64Encode(_0x168317),_0x64c4d2?util['format'](_0xc954('0x81'),encodeURIComponent(_0x64c4d2)):_0xc954('0x82'));return uploadFile(_0x4f8b52)[_0xc954('0x2e')](function(_0x392f29){return querystring[_0xc954('0xa')](_0x392f29);});};exports[_0xc954('0x83')]=function(_0x3888cb,_0x536ddd){return sestek[_0xc954('0x84')](_0x3888cb,_0x536ddd)[_0xc954('0x2e')](function(_0x11c227){logger[_0xc954('0x1c')](JSON[_0xc954('0x47')](_0x11c227));var _0x1ce4c7={'speech':_0x11c227[_0xc954('0x85')],'action':_0x11c227[_0xc954('0x86')]?_0x11c227[_0xc954('0x86')][_0xc954('0x87')]:undefined,'actiondata':_0x11c227[_0xc954('0x86')]?_0x11c227[_0xc954('0x86')][_0xc954('0x88')]:undefined};if(_0x11c227['channelData']&&_0x11c227[_0xc954('0x86')]['AudioFromTts']){return base64Decode(_0x11c227['channelData'][_0xc954('0x89')][_0xc954('0x8a')],path[_0xc954('0x29')](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+'.wav'))[_0xc954('0x2e')](function(_0x78aaeb){_0x1ce4c7[_0xc954('0x8b')]=_0x78aaeb;return _0x1ce4c7;});}return _0x1ce4c7;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x8232=['SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','chmodSync','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','randomstring','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','path','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish','info','finish\x20download\x20file','close','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','777','split','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','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','goggleTTS\x20path','googleASR','asr','uri','results','transcript','map','alternatives','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace'];(function(_0x3649d3,_0x283e04){var _0x44245a=function(_0x569c5a){while(--_0x569c5a){_0x3649d3['push'](_0x3649d3['shift']());}};_0x44245a(++_0x283e04);}(_0x8232,0xaa));var _0x2823=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8232[_0x14add3];return _0x4a174f;};'use strict';var apiai=require(_0x2823('0x0'));var BPromise=require(_0x2823('0x1'));var dialogflow=require(_0x2823('0x2'));var fs=require('fs');var http=require(_0x2823('0x3'));var https=require(_0x2823('0x4'));var md5=require(_0x2823('0x5'));var path=require('path');var querystring=require(_0x2823('0x6'));var rp=require('request-promise');var rs=require(_0x2823('0x7'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0x2823('0x8'))[_0x2823('0x9')];var util=require(_0x2823('0xa'));var aws=require(_0x2823('0xb'));var google=require(_0x2823('0xc'));var sestek=require(_0x2823('0xd'));var tilde=require(_0x2823('0xe'));var logger=require(_0x2823('0xf'))(_0x2823('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x47d93a,_0x4d9c92){return new BPromise(function(_0x2b1b8b,_0x40b398){var _0x201b8b=urlParse(_0x47d93a);var _0x2f00ff=_0x201b8b[_0x2823('0x11')]===_0x2823('0x12')?https:http;var _0x24e05e={'host':_0x201b8b[_0x2823('0x13')],'path':_0x201b8b[_0x2823('0x14')],'headers':{'user-agent':_0x2823('0x15')}};_0x2f00ff[_0x2823('0x16')](_0x24e05e,function(_0x3943dc){if(_0x3943dc['statusCode']!==0xc8){logger[_0x2823('0x17')](_0x2823('0x18')+_0x47d93a+_0x2823('0x19')+_0x3943dc[_0x2823('0x1a')]+'\x20('+_0x3943dc[_0x2823('0x1b')]+')');_0x40b398(new Error(_0x2823('0x18')+_0x47d93a+'\x20failed,\x20status\x20code\x20=\x20'+_0x3943dc['statusCode']+'\x20('+_0x3943dc['statusMessage']+')'));return;}var _0x56d3b9=fs['createWriteStream'](_0x4d9c92);_0x56d3b9['on'](_0x2823('0x1c'),function(){logger[_0x2823('0x1d')](_0x2823('0x1e'));_0x56d3b9[_0x2823('0x1f')](_0x2b1b8b);});_0x56d3b9['on']('error',function(_0xe8f93e){fs['unlink'](_0x4d9c92);logger[_0x2823('0x17')]('download\x20error',_0xe8f93e);_0x40b398(_0xe8f93e);});_0x3943dc[_0x2823('0x20')](_0x56d3b9);})['on'](_0x2823('0x17'),function(_0x34455a){logger[_0x2823('0x17')](_0x34455a);_0x40b398(_0x34455a);})[_0x2823('0x21')]();});}function uploadFile(_0x2d13c9){return new BPromise(function(_0x48579c,_0x2d308d){var _0x453a7f=urlParse(_0x2d13c9);var _0x50fc79=_0x453a7f[_0x2823('0x11')]===_0x2823('0x12')?https:http;var _0x127697={'host':_0x453a7f[_0x2823('0x13')],'path':_0x453a7f[_0x2823('0x14')],'headers':{'user-agent':'WHAT_EVER'}};_0x50fc79[_0x2823('0x16')](_0x127697,function(_0x35d5c1){if(_0x35d5c1[_0x2823('0x1a')]!==0xc8){_0x2d308d(new Error(_0x2823('0x18')+_0x2d13c9+_0x2823('0x19')+_0x35d5c1['statusCode']+'\x20('+_0x35d5c1[_0x2823('0x1b')]+')'));return;}var _0x5710d4='';_0x35d5c1['on'](_0x2823('0x22'),function(_0x2124df){_0x5710d4+=_0x2124df;});_0x35d5c1['on'](_0x2823('0x21'),function(){_0x48579c(_0x5710d4);});})['on']('error',function(_0x30d9fc){_0x2d308d(_0x30d9fc);})[_0x2823('0x21')]();});}function convertFile(_0x44aa1c,_0x2b60ec){return new BPromise(function(_0xf0e5e6,_0x396b3f){var _0x2ca15=sox[_0x2823('0x23')](_0x44aa1c,_0x2b60ec,{'sampleRate':0x1f40,'format':_0x2823('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2ca15['on'](_0x2823('0x17'),function(_0x177411){logger[_0x2823('0x17')](_0x2823('0x25'),_0x177411);_0x396b3f(_0x177411);});_0x2ca15['on'](_0x2823('0x21'),function(){logger['info'](_0x2823('0x26'));_0xf0e5e6();});_0x2ca15['start']();});}function base64Decode(_0xf0bb2c,_0x34d5cf){var _0x4fc8bc=path[_0x2823('0x27')](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x2a'));fs[_0x2823('0x2b')](_0x4fc8bc,_0xf0bb2c,_0x2823('0x2c'));return convertFile(_0x4fc8bc,_0x34d5cf)[_0x2823('0x2d')](function(){try{fs[_0x2823('0x2e')](_0x4fc8bc);fs['chmodSync'](_0x34d5cf,_0x2823('0x2f'));}catch(_0x101dcd){logger[_0x2823('0x17')](_0x101dcd);}return _0x34d5cf[_0x2823('0x30')]('.')[0x0];});}function base64Encode(_0x5af9a7){var _0x5308d0=fs['readFileSync'](_0x5af9a7);return new Buffer(_0x5308d0)['toString'](_0x2823('0x2c'));}exports[_0x2823('0x31')]=function(_0x2bdcd9,_0xfe6057,_0x23e8bf,_0x44a6de,_0x59e9ea,_0x3ce560){var _0x3b54aa,_0xd17de;var _0x2699fb=_0x2823('0x32');var _0x4180b3='?key='+_0x2bdcd9;var _0x27e239={};if(_0xfe6057===_0x2823('0x33')){_0x27e239[_0x2823('0x34')]={'ssml':_0x23e8bf};}else{_0x27e239['input']={'text':_0x23e8bf};};_0x27e239[_0x2823('0x35')]={'languageCode':_0x44a6de,'ssmlGender':_0x59e9ea};_0x27e239['audioConfig']={'audioEncoding':_0x2823('0x36'),'sampleRateHertz':0x1f40};var _0x490142={'url':_0x2699fb+_0x2823('0x37')+_0x4180b3,'method':_0x2823('0x38'),'json':!![],'body':_0x27e239};return rp(_0x490142)[_0x2823('0x2d')](function(_0x410871){return new BPromise(function(_0x4c1fc4,_0x470d15){_0x3b54aa=path['resolve'](__dirname,_0x2823('0x28'),rs['generate'](0x4)+_0x2823('0x39'));var _0x449f9a=Buffer['from'](_0x410871[_0x2823('0x3a')],_0x2823('0x2c'));return fs[_0x2823('0x3b')](_0x3b54aa,_0x449f9a,function(_0x13710e){_0x470d15(_0x13710e);},function(_0x5a030a){fs['chmodSync'](_0x3b54aa,'777');_0x4c1fc4(_0x5a030a);});});})[_0x2823('0x2d')](function(_0x5d9288){_0xd17de=path[_0x2823('0x27')](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x2a'));return convertFile(_0x3b54aa,_0xd17de);})['then'](function(){try{fs['unlink'](_0x3b54aa);fs['chmodSync'](_0xd17de,_0x2823('0x2f'));}catch(_0x394d58){logger[_0x2823('0x17')](_0x394d58);}logger[_0x2823('0x1d')](_0x2823('0x3c'),_0xd17de[_0x2823('0x30')]('.')[0x0]);return _0xd17de[_0x2823('0x30')]('.')[0x0];});};exports[_0x2823('0x3d')]=function(_0x25ed7b,_0x33b761){var _0x5e9656='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x190ade,_0x5f1bfe;var _0x5c56a3;var _0x502801={'encoding':_0x2823('0x3e'),'method':'POST','timeout':0x2710,'url':_0x5e9656,'headers':{'Content-Type':_0x2823('0x3f')},'body':_0x2823('0x40')+encodeURIComponent(JSON[_0x2823('0x41')]([[[_0x2823('0x42'),JSON[_0x2823('0x41')]([_0x25ed7b,_0x33b761||'en',![],_0x2823('0x43')]),null,_0x2823('0x44')]]]))};return rp(_0x502801)[_0x2823('0x2d')](function(_0x4f3730){try{_0x5c56a3=eval(_0x4f3730[_0x2823('0x45')](0x5))[0x0][0x2];}catch(_0x3c9101){throw new Error(_0x2823('0x46')+_0x4f3730[_0x2823('0x22')]);}if(!_0x5c56a3){if(_0x25ed7b[_0x2823('0x47')]>0xc8){throw new Error(_0x2823('0x48'));}else{throw new Error(_0x2823('0x49')+_0x33b761+_0x2823('0x4a'));}}try{_0x5c56a3=eval(_0x5c56a3)[0x0];}catch(_0x3eab21){throw new Error(_0x2823('0x46')+res[_0x2823('0x22')]);}const _0x566d59=_0x5c56a3;_0x190ade=path[_0x2823('0x27')](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x39'));fs[_0x2823('0x2b')](_0x190ade,_0x5c56a3,{'encoding':_0x2823('0x2c')});_0x5f1bfe=path['resolve'](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x2a'));return convertFile(_0x190ade,_0x5f1bfe);})[_0x2823('0x2d')](function(){try{fs[_0x2823('0x2e')](_0x190ade);fs['chmodSync'](_0x5f1bfe,_0x2823('0x2f'));}catch(_0x3d4f63){logger[_0x2823('0x17')](_0x3d4f63);}logger[_0x2823('0x1d')](_0x2823('0x4b'),_0x5f1bfe[_0x2823('0x30')]('.')[0x0]);return _0x5f1bfe[_0x2823('0x30')]('.')[0x0];});};exports[_0x2823('0x4c')]=function(_0x202ec5,_0x419143,_0x959f3f){return google[_0x2823('0x4d')](_0x202ec5,_0x419143,_0x959f3f)[_0x2823('0x2d')](function(_0x280929){logger['info'](_0x280929[_0x2823('0x4e')]);return rp(_0x280929);})[_0x2823('0x2d')](function(_0xfeb50e){var _0xfc49e2='';var _0x3dec1e=0x0;try{fs[_0x2823('0x2e')](_0x202ec5);}catch(_0x37b9cd){logger[_0x2823('0x17')](_0x37b9cd);}if(_0xfeb50e&&_0xfeb50e[_0x2823('0x4f')]){_0xfc49e2=_0xfeb50e[_0x2823('0x4f')]['map'](function(_0x174858){return _0x174858&&_0x174858['alternatives'][0x0]&&_0x174858['alternatives'][0x0][_0x2823('0x50')]?_0x174858['alternatives'][0x0][_0x2823('0x50')]:'';})['join']('\x0a');_0x3dec1e=_0xfeb50e[_0x2823('0x4f')][_0x2823('0x51')](function(_0x28a72f){return _0x28a72f&&_0x28a72f[_0x2823('0x52')][0x0]&&_0x28a72f[_0x2823('0x52')][0x0][_0x2823('0x53')]?_0x28a72f[_0x2823('0x52')][0x0][_0x2823('0x53')]:0x0;})['join']('\x0a');}logger[_0x2823('0x1d')](_0x2823('0x54'),_0xfc49e2);logger['info'](_0x2823('0x55'),_0x3dec1e);return{'transcript':_0xfc49e2,'confidence':_0x3dec1e};})['catch'](function(_0x2c8916){logger[_0x2823('0x17')](_0x2823('0x56'),_0x2c8916['statusCode'],_0x2c8916[_0x2823('0x57')],_0x2c8916['message']);});};exports[_0x2823('0x58')]=function(_0x3e5948,_0xea929d,_0x41bd93,_0x4cd24e){var _0x4db7c1=apiai(_0xea929d,{'language':_0x4cd24e||'en'});return _0x4db7c1[_0x2823('0x59')](_0x41bd93,{'sessionId':md5(_0x3e5948)})[_0x2823('0x2d')](function(_0x420f2c){logger[_0x2823('0x1d')](JSON['stringify'](_0x420f2c));return{'source':_0x420f2c[_0x2823('0x5a')][_0x2823('0x5b')],'resolvedQuery':_0x420f2c[_0x2823('0x5a')]['resolvedQuery'],'action':_0x420f2c[_0x2823('0x5a')][_0x2823('0x5c')],'actionIncomplete':_0x420f2c['result'][_0x2823('0x5d')],'speech':_0x420f2c[_0x2823('0x5a')][_0x2823('0x5e')][_0x2823('0x5f')],'score':_0x420f2c[_0x2823('0x5a')]['score'],'statusCode':_0x420f2c['status'][_0x2823('0x60')],'endConversation':_0x420f2c[_0x2823('0x5a')][_0x2823('0x61')][_0x2823('0x62')]||![],'isFallbackIntent':_0x420f2c[_0x2823('0x5a')][_0x2823('0x61')][_0x2823('0x63')]};});};exports[_0x2823('0x64')]=function(_0x37ddcb,_0x157645,_0x22e062,_0x4a9cb5,_0x14694c,_0x3484c9){var _0x5b2ce8=_0x4a9cb5[_0x2823('0x65')](/\\n/g,'\x0a');var _0x132a3b={'credentials':{'private_key':_0x5b2ce8,'client_email':_0x22e062}};var _0x1e81c3=new dialogflow[(_0x2823('0x66'))](_0x132a3b);var _0x39ce5a=_0x1e81c3['sessionPath'](_0x157645,md5(_0x37ddcb));var _0x54011e={'session':_0x39ce5a,'queryInput':{'text':{'text':_0x14694c,'languageCode':_0x3484c9}}};return _0x1e81c3[_0x2823('0x67')](_0x54011e)['then'](function(_0x4175bc){if(_0x4175bc&&_0x4175bc[_0x2823('0x47')]){logger[_0x2823('0x1d')](_0x2823('0x68'),JSON['stringify'](_0x4175bc));var _0x5bd444=_0x4175bc[0x0];if(_0x5bd444){var _0x2a5c43={'action':_0x5bd444[_0x2823('0x69')]['action'],'allRequiredParamsPresent':_0x5bd444['queryResult']['allRequiredParamsPresent'],'endConversation':_0x5bd444[_0x2823('0x69')][_0x2823('0x6a')]&&_0x5bd444['queryResult'][_0x2823('0x6a')][_0x2823('0x6b')]?_0x5bd444[_0x2823('0x69')]['diagnosticInfo']['fields'][_0x2823('0x6c')]['boolValue']:![],'fulfillmentText':_0x5bd444['queryResult'][_0x2823('0x6d')],'intentName':_0x5bd444[_0x2823('0x69')][_0x2823('0x6e')][_0x2823('0x57')],'intentDisplayName':_0x5bd444[_0x2823('0x69')][_0x2823('0x6e')][_0x2823('0x6f')],'isFallbackIntent':_0x5bd444[_0x2823('0x69')]['intent'][_0x2823('0x70')],'languageCode':_0x5bd444[_0x2823('0x69')][_0x2823('0x71')],'queryText':_0x5bd444['queryResult']['queryText'],'responseId':_0x5bd444['responseId'],'score':_0x5bd444[_0x2823('0x69')][_0x2823('0x72')],'speech':_0x5bd444['queryResult'][_0x2823('0x6d')],'providerResponse':JSON[_0x2823('0x41')](_0x4175bc)};return _0x2a5c43;}}});};exports[_0x2823('0x73')]=function(_0x20edc3,_0x1a612b,_0x45158b,_0x266fec){return tilde[_0x2823('0x4d')](_0x20edc3,_0x1a612b,_0x45158b,_0x266fec)[_0x2823('0x2d')](function(_0x4cc9f7){try{fs['unlink'](_0x20edc3);}catch(_0x1bdc72){logger[_0x2823('0x17')](_0x1bdc72);}logger[_0x2823('0x1d')](_0x2823('0x74'),_0x4cc9f7[_0x2823('0x50')]);logger[_0x2823('0x1d')](_0x2823('0x75'),_0x4cc9f7[_0x2823('0x53')]);return _0x4cc9f7;});};exports[_0x2823('0x76')]=function(_0x560932,_0x4dc115,_0x2df822,_0x519725,_0x2e241d,_0x137448){var _0x8628e5=path[_0x2823('0x27')](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x39'));var _0x15a449;return aws[_0x2823('0x77')](_0x560932,_0x4dc115,_0x2df822,_0x519725,_0x2e241d,_0x137448,_0x8628e5)['then'](function(){_0x15a449=path[_0x2823('0x27')](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x2a'));return convertFile(_0x8628e5,_0x15a449);})[_0x2823('0x2d')](function(){try{fs[_0x2823('0x2e')](_0x8628e5);fs[_0x2823('0x78')](_0x15a449,'777');}catch(_0x1a176f){logger['error'](_0x1a176f);}return _0x15a449[_0x2823('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x3013cd,_0x290e42,_0x2cb02f,_0x186f7b,_0x514903,_0x1c0d05){return aws['lex'](_0x3013cd,_0x290e42,_0x2cb02f,_0x186f7b,_0x514903,_0x1c0d05)['then'](function(_0x3c881c){logger[_0x2823('0x1d')](JSON['stringify'](_0x3c881c));return _0x3c881c;});};exports[_0x2823('0x79')]=function(_0x408dbf,_0x2f3ddf,_0x250e18,_0x44090a){var _0x5ad8d7=util[_0x2823('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x408dbf,encodeURIComponent(_0x2f3ddf),_0x250e18,_0x44090a);var _0x4a5b74=path[_0x2823('0x27')](__dirname,'tmp',rs[_0x2823('0x29')](0x4)+_0x2823('0x39'));var _0x155ac8;return downloadFile(_0x5ad8d7,_0x4a5b74)['then'](function(){_0x155ac8=path[_0x2823('0x27')](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x2a'));return convertFile(_0x4a5b74,_0x155ac8);})[_0x2823('0x2d')](function(){try{fs['unlink'](_0x4a5b74);fs[_0x2823('0x78')](_0x155ac8,_0x2823('0x2f'));}catch(_0x43f190){logger[_0x2823('0x17')](_0x43f190);}return _0x155ac8[_0x2823('0x30')]('.')[0x0];});};exports[_0x2823('0x7b')]=function(_0xcaac87,_0x32d048,_0x21bddb,_0x4bf679){var _0x8f8526=util['format'](_0x2823('0x7c'),ISPEECH_API,_0x32d048,_0x21bddb,base64Encode(_0xcaac87),_0x4bf679?util[_0x2823('0x7a')](_0x2823('0x7d'),encodeURIComponent(_0x4bf679)):_0x2823('0x7e'));return uploadFile(_0x8f8526)['then'](function(_0x4f63ca){return querystring[_0x2823('0x9')](_0x4f63ca);});};exports[_0x2823('0x7f')]=function(_0x5229af,_0x33d271){return sestek[_0x2823('0x80')](_0x5229af,_0x33d271)[_0x2823('0x2d')](function(_0x2e5c66){logger[_0x2823('0x1d')](JSON[_0x2823('0x41')](_0x2e5c66));var _0x30e1c8={'speech':_0x2e5c66[_0x2823('0x81')],'action':_0x2e5c66[_0x2823('0x82')]?_0x2e5c66[_0x2823('0x82')][_0x2823('0x83')]:undefined,'actiondata':_0x2e5c66[_0x2823('0x82')]?_0x2e5c66[_0x2823('0x82')]['CustomActionData']:undefined};if(_0x2e5c66[_0x2823('0x82')]&&_0x2e5c66['channelData'][_0x2823('0x84')]){return base64Decode(_0x2e5c66[_0x2823('0x82')]['AudioFromTts'][_0x2823('0x85')],path[_0x2823('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x2823('0x2a')))[_0x2823('0x2d')](function(_0x40bec5){_0x30e1c8[_0x2823('0x86')]=_0x40bec5;return _0x30e1c8;});}return _0x30e1c8;});};exports[_0x2823('0x87')]=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 f6a09fc..871857c 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 _0xfd9b=['exports','./nda'];(function(_0x21dc4f,_0x50b632){var _0x31838e=function(_0x55de01){while(--_0x55de01){_0x21dc4f['push'](_0x21dc4f['shift']());}};_0x31838e(++_0x50b632);}(_0xfd9b,0x19b));var _0xbfd9=function(_0x34b819,_0x2db518){_0x34b819=_0x34b819-0x0;var _0x463ab2=_0xfd9b[_0x34b819];return _0x463ab2;};var nda=require(_0xbfd9('0x0'));module[_0xbfd9('0x1')]={'nda':nda}; \ No newline at end of file +var _0x449a=['exports','./nda'];(function(_0x2d421e,_0x1a4faa){var _0x40fa3d=function(_0x3a2ecf){while(--_0x3a2ecf){_0x2d421e['push'](_0x2d421e['shift']());}};_0x40fa3d(++_0x1a4faa);}(_0x449a,0xd9));var _0xa449=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x449a[_0xb24a3e];return _0x4038d7;};var nda=require(_0xa449('0x0'));module[_0xa449('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 4ab7714..913d7aa 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 _0x9c5e=['exports','POST','resolve','/token','password','username','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','request-promise','url','../../../../../config/logger','agi'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x4ffc82,_0x23d4f4){_0x4ffc82=_0x4ffc82-0x0;var _0xf05e9f=_0x9c5e[_0x4ffc82];return _0xf05e9f;};'use strict';var rp=require(_0xe9c5('0x0'));var url=require(_0xe9c5('0x1'));var logger=require(_0xe9c5('0x2'))(_0xe9c5('0x3'));module[_0xe9c5('0x4')]=function(_0x5a6ce5,_0x51e921){var _0x595373={'method':_0xe9c5('0x5'),'uri':url[_0xe9c5('0x6')](_0x51e921['ndauth_url'],_0xe9c5('0x7')),'form':{'grant_type':_0xe9c5('0x8'),'username':_0x51e921[_0xe9c5('0x9')],'password':_0x51e921[_0xe9c5('0x8')]},'json':!![]};return rp(_0x595373)['then'](function(_0x2fa290){var _0x34ee69={'method':_0xe9c5('0x5'),'uri':url[_0xe9c5('0x6')](_0x51e921['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x51e921[_0xe9c5('0xa')]||_0xe9c5('0xb'),'channelId':_0xe9c5('0xc'),'conversation':{'id':_0x5a6ce5[_0xe9c5('0xd')]},'from':{'id':_0x5a6ce5[_0xe9c5('0xe')],'name':_0x5a6ce5[_0xe9c5('0xf')]},'recipient':{'id':_0x5a6ce5[_0xe9c5('0x10')],'name':_0x5a6ce5[_0xe9c5('0x11')]},'text':_0x51e921[_0xe9c5('0x12')],'channelData':{}},'headers':{'Authorization':_0xe9c5('0x13')+_0x2fa290[_0xe9c5('0x14')]},'json':!![]};if(_0x51e921[_0xe9c5('0x15')]){_0x34ee69[_0xe9c5('0x16')][_0xe9c5('0x17')][_0xe9c5('0x18')]=_0x51e921[_0xe9c5('0x15')];}if(_0x51e921['ndagenerate_audio']=='1'){_0x34ee69[_0xe9c5('0x16')][_0xe9c5('0x17')][_0xe9c5('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe9c5('0x1a')};}if(_0x51e921[_0xe9c5('0x1b')]){_0x34ee69[_0xe9c5('0x16')]['channelData'][_0xe9c5('0x1c')]=_0x51e921[_0xe9c5('0x1b')];if(_0x51e921['custom_action_data']){_0x34ee69[_0xe9c5('0x16')][_0xe9c5('0x17')][_0xe9c5('0x1d')]=_0x51e921[_0xe9c5('0x1e')];}}logger[_0xe9c5('0x1f')](JSON['stringify'](_0x34ee69));return rp(_0x34ee69);});}; \ No newline at end of file +var _0x49e9=['text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','agi','exports','POST','ndauth_url','/token','password','then','resolve','ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','dnid','extension'];(function(_0x524115,_0x44eb69){var _0x2f22c9=function(_0x27ddd3){while(--_0x27ddd3){_0x524115['push'](_0x524115['shift']());}};_0x2f22c9(++_0x44eb69);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var rp=require(_0x949e('0x0'));var url=require(_0x949e('0x1'));var logger=require('../../../../../config/logger')(_0x949e('0x2'));module[_0x949e('0x3')]=function(_0x259795,_0x5c303a){var _0x4f1295={'method':_0x949e('0x4'),'uri':url['resolve'](_0x5c303a[_0x949e('0x5')],_0x949e('0x6')),'form':{'grant_type':_0x949e('0x7'),'username':_0x5c303a['username'],'password':_0x5c303a[_0x949e('0x7')]},'json':!![]};return rp(_0x4f1295)[_0x949e('0x8')](function(_0xfc4f8a){var _0x34ee57={'method':_0x949e('0x4'),'uri':url[_0x949e('0x9')](_0x5c303a[_0x949e('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5c303a[_0x949e('0xb')]||'message','channelId':_0x949e('0xc'),'conversation':{'id':_0x259795[_0x949e('0xd')]},'from':{'id':_0x259795[_0x949e('0xe')],'name':_0x259795['calleridname']},'recipient':{'id':_0x259795[_0x949e('0xf')],'name':_0x259795[_0x949e('0x10')]},'text':_0x5c303a[_0x949e('0x11')],'channelData':{}},'headers':{'Authorization':_0x949e('0x12')+_0xfc4f8a[_0x949e('0x13')]},'json':!![]};if(_0x5c303a[_0x949e('0x14')]){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')][_0x949e('0x17')]=_0x5c303a[_0x949e('0x14')];}if(_0x5c303a[_0x949e('0x18')]=='1'){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')][_0x949e('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x949e('0x1a')};}if(_0x5c303a['custom_action']){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')][_0x949e('0x1b')]=_0x5c303a[_0x949e('0x1c')];if(_0x5c303a['custom_action_data']){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')]['CustomActionData']=_0x5c303a[_0x949e('0x1d')];}}logger[_0x949e('0x1e')](JSON[_0x949e('0x1f')](_0x34ee57));return rp(_0x34ee57);});}; \ 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 5e7b29d..a217618 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 _0xad20=['exports','./lib/api'];(function(_0x2404ab,_0x33d1de){var _0x5268b8=function(_0x4b8ac6){while(--_0x4b8ac6){_0x2404ab['push'](_0x2404ab['shift']());}};_0x5268b8(++_0x33d1de);}(_0xad20,0x69));var _0x0ad2=function(_0x412c8f,_0x11ec94){_0x412c8f=_0x412c8f-0x0;var _0x27c005=_0xad20[_0x412c8f];return _0x27c005;};'use strict';var asr=require(_0x0ad2('0x0'));module[_0x0ad2('0x1')]=function(_0x3a949e,_0x1a6559,_0x1733a8,_0x4916c6){return asr(_0x3a949e,_0x1a6559,_0x1733a8,_0x4916c6);}; \ No newline at end of file +var _0x955a=['exports','./lib/api'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x955a,0x1c1));var _0xa955=function(_0x3921c3,_0x227be2){_0x3921c3=_0x3921c3-0x0;var _0x35478c=_0x955a[_0x3921c3];return _0x35478c;};'use strict';var asr=require(_0xa955('0x0'));module[_0xa955('0x1')]=function(_0x162324,_0x10bcde,_0x2b15d6,_0x300ffb){return asr(_0x162324,_0x10bcde,_0x2b15d6,_0x300ffb);}; \ 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 eb0effa..d44e8e9 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 _0x92e1=['hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','unix','send','stringify','createReadStream','close','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','transcript'];(function(_0x3249b5,_0x56c2e6){var _0x4a6dff=function(_0x576e8c){while(--_0x576e8c){_0x3249b5['push'](_0x3249b5['shift']());}};_0x4a6dff(++_0x56c2e6);}(_0x92e1,0x198));var _0x192e=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0x92e1[_0x9d14e3];return _0x19bf32;};'use strict';var BPromise=require(_0x192e('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x192e('0x1'));var crypto=require(_0x192e('0x2'));var logger=require(_0x192e('0x3'))(_0x192e('0x4'));module['exports']=function(_0x5d7720,_0x4f7e1a,_0x57021a,_0x22018e){return new BPromise(function(_0xcebe6b,_0x3bba34){logger[_0x192e('0x5')](_0x192e('0x6'),_0x22018e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x374b13=new WebSocket(_0x22018e||_0x192e('0x7'),{'perMessageDeflate':![]});var _0x44e998='';var _0x1e0d40='0';var _0x254113='1';var _0x3eed20=_0x192e('0x8');function _0x7bfdce(_0x505984){var _0x270b05=crypto['createHash'](_0x192e('0x9'));_0x270b05[_0x192e('0xa')](_0x505984);return _0x270b05[_0x192e('0xb')](_0x192e('0xc'));}function _0x2f369f(){try{logger[_0x192e('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x537ed2=moment()[_0x192e('0xd')]();var _0x261ce8=_0x7bfdce(_0x537ed2+_0x4f7e1a+_0x57021a);_0x374b13[_0x192e('0xe')](JSON[_0x192e('0xf')]({'appID':_0x4f7e1a,'timestamp':_0x537ed2,'appKey':_0x261ce8}));var _0x1fdd3e=fs[_0x192e('0x10')](_0x5d7720);_0x1fdd3e['on']('data',function(_0x21f67f){_0x374b13['send'](_0x21f67f);});_0x1fdd3e['on'](_0x192e('0x11'),function(){_0x374b13[_0x192e('0xe')]('EOS');});}catch(_0x477723){logger['error'](_0x192e('0x12'),JSON[_0x192e('0xf')](_0x477723));_0x374b13[_0x192e('0x13')]();}}function _0x1f5fc0(_0x1b8178){try{if(_0x1b8178){var _0x1c9378=JSON[_0x192e('0x14')](_0x1b8178);switch(_0x1c9378[_0x192e('0x15')]){case 0x0:if(_0x1c9378[_0x192e('0x16')]){if(_0x1c9378[_0x192e('0x16')]['final']){logger[_0x192e('0x5')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x1c9378[_0x192e('0x16')]['hypotheses']));_0x44e998=_0x1c9378[_0x192e('0x16')]['hypotheses'][0x0][_0x192e('0x17')];_0x1e0d40=_0x1c9378['result'][_0x192e('0x18')][0x0]['likelihood'];_0x254113='0';_0x3eed20=_0x192e('0x19');_0x374b13['terminate']();}}break;case 0x1:logger[_0x192e('0x5')](_0x192e('0x8'));_0x254113='1';_0x3eed20=_0x192e('0x8');break;case 0x2:logger['info'](_0x192e('0x1a'));_0x254113='2';_0x3eed20=_0x192e('0x1a');break;case 0x9:logger[_0x192e('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x254113='9';_0x3eed20='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x192e('0x5')]('Authentication\x20failed.');_0x254113='10';_0x3eed20=_0x192e('0x1b');break;case 0xb:logger[_0x192e('0x5')](_0x192e('0x1c'));_0x254113='11';_0x3eed20=_0x192e('0x1c');}}}catch(_0x26aaa6){logger['error'](_0x192e('0x1d'),JSON[_0x192e('0xf')](_0x26aaa6));_0x374b13[_0x192e('0x13')]();}}function _0x23b629(){logger[_0x192e('0x5')](_0x192e('0x1e'));_0xcebe6b({'transcript':_0x44e998,'confidence':_0x1e0d40,'status':_0x254113,'status_message':_0x3eed20});}function _0x39487b(_0x7726f7){logger[_0x192e('0x1f')](_0x192e('0x20'));if(!_[_0x192e('0x21')](_0x7726f7)){logger['error'](_['isObject'](_0x7726f7)?JSON[_0x192e('0xf')](_0x7726f7):_0x7726f7);}}_0x374b13['on'](_0x192e('0x22'),_0x2f369f);_0x374b13['on'](_0x192e('0x23'),_0x1f5fc0);_0x374b13['on'](_0x192e('0x11'),_0x23b629);_0x374b13['on'](_0x192e('0x1f'),_0x39487b);});}; \ No newline at end of file +var _0x16b4=['sha1','update','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash'];(function(_0x249b34,_0x1d0399){var _0x4ed150=function(_0x242591){while(--_0x242591){_0x249b34['push'](_0x249b34['shift']());}};_0x4ed150(++_0x1d0399);}(_0x16b4,0x14d));var _0x416b=function(_0x26a2e9,_0x18cb04){_0x26a2e9=_0x26a2e9-0x0;var _0x4012bc=_0x16b4[_0x26a2e9];return _0x4012bc;};'use strict';var BPromise=require(_0x416b('0x0'));var _=require(_0x416b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x416b('0x2'));var crypto=require(_0x416b('0x3'));var logger=require(_0x416b('0x4'))('agi');module[_0x416b('0x5')]=function(_0x42dada,_0x4dfb18,_0x454299,_0x1dcf0e){return new BPromise(function(_0x235af4,_0x4cdea8){logger[_0x416b('0x6')]('Tilde\x20URI',_0x1dcf0e||_0x416b('0x7'));var _0x4a9ec7=new WebSocket(_0x1dcf0e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x28389e='';var _0x2c24f5='0';var _0x56d870='1';var _0x2cebc2='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x5bbffb(_0x33eaaa){var _0x48e43f=crypto[_0x416b('0x8')](_0x416b('0x9'));_0x48e43f[_0x416b('0xa')](_0x33eaaa);return _0x48e43f['digest']('hex');}function _0x32ee3b(){try{logger[_0x416b('0x6')](_0x416b('0xb'));var _0x7f96fd=moment()['unix']();var _0x315cfc=_0x5bbffb(_0x7f96fd+_0x4dfb18+_0x454299);_0x4a9ec7[_0x416b('0xc')](JSON[_0x416b('0xd')]({'appID':_0x4dfb18,'timestamp':_0x7f96fd,'appKey':_0x315cfc}));var _0x3a219a=fs[_0x416b('0xe')](_0x42dada);_0x3a219a['on']('data',function(_0x1889b5){_0x4a9ec7['send'](_0x1889b5);});_0x3a219a['on'](_0x416b('0xf'),function(){_0x4a9ec7[_0x416b('0xc')](_0x416b('0x10'));});}catch(_0xed3510){logger[_0x416b('0x11')](_0x416b('0x12'),JSON[_0x416b('0xd')](_0xed3510));_0x4a9ec7['terminate']();}}function _0x45c277(_0x1a61af){try{if(_0x1a61af){var _0x184383=JSON[_0x416b('0x13')](_0x1a61af);switch(_0x184383['status']){case 0x0:if(_0x184383[_0x416b('0x14')]){if(_0x184383['result'][_0x416b('0x15')]){logger[_0x416b('0x6')](_0x416b('0x16'),JSON[_0x416b('0xd')](_0x184383[_0x416b('0x14')]['hypotheses']));_0x28389e=_0x184383[_0x416b('0x14')][_0x416b('0x17')][0x0][_0x416b('0x18')];_0x2c24f5=_0x184383[_0x416b('0x14')][_0x416b('0x17')][0x0]['likelihood'];_0x56d870='0';_0x2cebc2=_0x416b('0x19');_0x4a9ec7['terminate']();}}break;case 0x1:logger[_0x416b('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x56d870='1';_0x2cebc2='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x416b('0x6')](_0x416b('0x1a'));_0x56d870='2';_0x2cebc2=_0x416b('0x1a');break;case 0x9:logger['info'](_0x416b('0x1b'));_0x56d870='9';_0x2cebc2=_0x416b('0x1b');break;case 0xa:logger[_0x416b('0x6')](_0x416b('0x1c'));_0x56d870='10';_0x2cebc2='Authentication\x20failed.';break;case 0xb:logger[_0x416b('0x6')](_0x416b('0x1d'));_0x56d870='11';_0x2cebc2=_0x416b('0x1d');}}}catch(_0x18137f){logger[_0x416b('0x11')](_0x416b('0x1e'),JSON[_0x416b('0xd')](_0x18137f));_0x4a9ec7[_0x416b('0x1f')]();}}function _0x501b51(){logger['info'](_0x416b('0x20'));_0x235af4({'transcript':_0x28389e,'confidence':_0x2c24f5,'status':_0x56d870,'status_message':_0x2cebc2});}function _0x43b53e(_0x348543){logger[_0x416b('0x11')](_0x416b('0x21'));if(!_[_0x416b('0x22')](_0x348543)){logger[_0x416b('0x11')](_[_0x416b('0x23')](_0x348543)?JSON[_0x416b('0xd')](_0x348543):_0x348543);}}_0x4a9ec7['on'](_0x416b('0x24'),_0x32ee3b);_0x4a9ec7['on'](_0x416b('0x25'),_0x45c277);_0x4a9ec7['on']('close',_0x501b51);_0x4a9ec7['on']('error',_0x43b53e);});}; \ 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 fb83f62..3336fd5 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 _0xab63=['./asr','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab63,0x166));var _0x3ab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab63[_0x3dd15e];return _0x231fd0;};var asr=require(_0x3ab6('0x0'));module[_0x3ab6('0x1')]={'asr':asr}; \ No newline at end of file +var _0x2df1=['./asr'];(function(_0x5c8237,_0x2000d2){var _0x50ff61=function(_0x291a08){while(--_0x291a08){_0x5c8237['push'](_0x5c8237['shift']());}};_0x50ff61(++_0x2000d2);}(_0x2df1,0x85));var _0x12df=function(_0x20a6dd,_0x146025){_0x20a6dd=_0x20a6dd-0x0;var _0x164d02=_0x2df1[_0x20a6dd];return _0x164d02;};var asr=require(_0x12df('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index a987b4d..191495c 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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x46eb6f,_0x2a287f){var _0x1123ac=function(_0x53bcdf){while(--_0x53bcdf){_0x46eb6f['push'](_0x46eb6f['shift']());}};_0x1123ac(++_0x2a287f);}(_0x34e8,0x12c));var _0x834e=function(_0x4eb165,_0x3ce883){_0x4eb165=_0x4eb165-0x0;var _0x50b8bc=_0x34e8[_0x4eb165];return _0x50b8bc;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index cab1c40..b034da4 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 _0x151b=['computedVariables','sync','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','includes','replaceObjectAllVariables','isPlainObject','length','recursiveNodeIndex','replaceAllVariables','saveRestApiResult','%s.%s','isArray','setVariable','stringify','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','label','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','list_id','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','%s/recordings/%s','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','wav','beep','NOBEEP','recordFile','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','true','IFTIME\x20%s\x20%s','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','no\x20variable\x20found','%s[%s]','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','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','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','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unlink','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','join','exports','util','odbc','moment','mustache','request-promise','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawBody','menu','getdigits','mailRpc','prototype','getVariable','rpc','getVariableById','then','name','getVoiceQueue','catch','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','interval','map','Intervals','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','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','url','method','timeout','number','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function'];(function(_0x38c184,_0x4fe373){var _0x1f5324=function(_0x261cf7){while(--_0x261cf7){_0x38c184['push'](_0x38c184['shift']());}};_0x1f5324(++_0x4fe373);}(_0x151b,0x153));var _0xb151=function(_0x13b199,_0xf89da3){_0x13b199=_0x13b199-0x0;var _0x394577=_0x151b[_0x13b199];return _0x394577;};'use strict';var fs=require('fs');var util=require(_0xb151('0x0'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0xb151('0x1'))();var rs=require('randomstring');var moment=require(_0xb151('0x2'));var Mustache=require(_0xb151('0x3'));var rp=require(_0xb151('0x4'));var logger=require('../../config/logger')('agi');var config=require(_0xb151('0x5'));var shared=require(_0xb151('0x6'));var scripts=require('./scripts');var FILES_PATH=_0xb151('0x7');var recursiveMapAttributes=['rawHeaders',_0xb151('0x8')];var verticesWithRetry=[_0xb151('0x9'),_0xb151('0xa'),'getsecretdigits'];var AGIVertices=function(_0x47baa2,_0x15cf84,_0x20f1b2){this['channel']=_0x47baa2;this['rpc']=_0x15cf84;this[_0xb151('0xb')]=_0x20f1b2;};AGIVertices[_0xb151('0xc')][_0xb151('0xd')]=function(_0x22c475,_0x3ee287){this[_0xb151('0xe')][_0xb151('0xf')](_0x22c475)[_0xb151('0x10')](function(_0x39cf22){_0x3ee287(null,_0x39cf22?_0x39cf22[_0xb151('0x11')]:![]);})['catch'](function(_0x1ae9b4){_0x3ee287(_0x1ae9b4);});};AGIVertices['prototype'][_0xb151('0x12')]=function(_0x389a96,_0x27f878){this[_0xb151('0xe')]['getVoiceQueueById'](_0x389a96)[_0xb151('0x10')](function(_0x2a5b24){_0x27f878(null,_0x2a5b24?_0x2a5b24[_0xb151('0x11')]:![]);})['catch'](function(_0x56ea81){_0x27f878(_0x56ea81);});};AGIVertices[_0xb151('0xc')]['getSquareProject']=function(_0x3ff606,_0x4ca435){this[_0xb151('0xe')]['getSquareProjectById'](_0x3ff606)['then'](function(_0x35aa2f){_0x4ca435(null,_0x35aa2f?_0x35aa2f[_0xb151('0x11')]:![]);})[_0xb151('0x13')](function(_0x2ba8bf){_0x4ca435(_0x2ba8bf);});};AGIVertices[_0xb151('0xc')][_0xb151('0x14')]=function(_0x1e2b38,_0x5525fd){this[_0xb151('0xe')][_0xb151('0x15')](_0x1e2b38)['then'](function(_0x1fe113){_0x5525fd(null,_0x1fe113?_0x1fe113[_0xb151('0x16')]:![]);})[_0xb151('0x13')](function(_0x3a211a){_0x5525fd(_0x3a211a);});};AGIVertices[_0xb151('0xc')][_0xb151('0x17')]=function(_0x3f375d,_0x8ab45){this[_0xb151('0xe')][_0xb151('0x18')](_0x3f375d)['then'](function(_0x432dce){_0x8ab45(null,_0x432dce?_0x432dce[_0xb151('0x11')]:![]);})[_0xb151('0x13')](function(_0x41c508){_0x8ab45(_0x41c508);});};AGIVertices[_0xb151('0xc')][_0xb151('0x19')]=function(_0xd22ee1,_0x40580d){this[_0xb151('0xe')]['getTrunkById'](_0xd22ee1)[_0xb151('0x10')](function(_0x46b235){_0x40580d(null,_0x46b235?_0x46b235[_0xb151('0x11')]:![]);})[_0xb151('0x13')](function(_0x2d65f8){_0x40580d(_0x2d65f8);});};AGIVertices[_0xb151('0xc')][_0xb151('0x1a')]=function(_0x2dc1b4,_0x5b6f83){var _0x37ff13=this;this['rpc'][_0xb151('0x1b')](_0x2dc1b4)[_0xb151('0x10')](function(_0x5e494c){_0x5b6f83(null,_0x5e494c?_0x37ff13[_0xb151('0x1c')](_0x5e494c['save_name']):![]);})[_0xb151('0x13')](function(_0x45dc3c){_0x5b6f83(_0x45dc3c);});};AGIVertices[_0xb151('0xc')][_0xb151('0x1d')]=function(_0x3ed573,_0x444af1){this[_0xb151('0xe')][_0xb151('0x1e')](_0x3ed573)['then'](function(_0x37722e){_0x444af1(null,_0x37722e?_0x37722e:![]);})[_0xb151('0x13')](function(_0x29d083){_0x444af1(_0x29d083);});};AGIVertices[_0xb151('0xc')][_0xb151('0x1f')]=function(_0x438888,_0xc363d2,_0x4c8388){this[_0xb151('0xb')][_0xb151('0x1f')](_0x438888,_0xc363d2)[_0xb151('0x10')](function(){_0x4c8388(null);})[_0xb151('0x13')](function(_0x2fdd66){_0x4c8388(_0x2fdd66);});};AGIVertices['prototype']['getIntervals']=function(_0x4032d7,_0x32ee08){this[_0xb151('0xe')][_0xb151('0x20')](_0x4032d7)['then'](function(_0x3e4b06){if(_0x3e4b06){if(_0x3e4b06['IntervalId']){_0x32ee08(null,[_0x3e4b06[_0xb151('0x21')]]);}else{_0x32ee08(null,_[_0xb151('0x22')](_0x3e4b06[_0xb151('0x23')],_0xb151('0x21')));}}else{_0x32ee08(null,![]);}})[_0xb151('0x13')](function(_0x29c011){_0x32ee08(_0x29c011);});};AGIVertices[_0xb151('0xc')][_0xb151('0x1c')]=function(_0x1378e9){return util[_0xb151('0x24')](_0xb151('0x25'),FILES_PATH,_0x1378e9);};AGIVertices['prototype'][_0xb151('0x26')]=function(_0x456de2,_0x260a1f,_0x5f22dd){odbc[_0xb151('0x27')](_0x456de2,function(_0x2f9f48){if(_0x2f9f48){logger[_0xb151('0x28')](_0xb151('0x29'),_0x2f9f48);_0x5f22dd(_0x2f9f48);}else{logger[_0xb151('0x2a')](_0xb151('0x2b'));odbc[_0xb151('0x2c')](_0x260a1f,function(_0x39dc3d,_0x76fc6){if(_0x39dc3d){logger[_0xb151('0x2a')](_0xb151('0x2d'),_0x260a1f);_0x5f22dd(_0x39dc3d);}else{logger['info'](_0xb151('0x2e'),_0x260a1f);odbc['close'](function(_0x31f1fb){if(_0x31f1fb){logger[_0xb151('0x28')](_0xb151('0x2f'),_0x31f1fb);}_0x5f22dd(null,_0x76fc6);});}});}});};AGIVertices[_0xb151('0xc')][_0xb151('0x30')]=function(_0x47035e,_0x88a7){this['rpc'][_0xb151('0x31')](_0x47035e)[_0xb151('0x10')](function(_0x135e52){_0x88a7(null,_0x135e52?_0x135e52:![]);})[_0xb151('0x13')](function(_0x802eba){_0x88a7(_0x802eba);});};AGIVertices[_0xb151('0xc')][_0xb151('0x32')]=function(_0x3b40e3,_0x31f531){this[_0xb151('0xe')][_0xb151('0x32')](_0x3b40e3)[_0xb151('0x10')](function(_0x2b0a07){_0x31f531(null,_0x2b0a07);})[_0xb151('0x13')](function(_0x3499ed){_0x31f531(_0x3499ed);});};AGIVertices[_0xb151('0xc')][_0xb151('0x33')]=function(_0x4075bf,_0x27fbe4,_0x407605){this[_0xb151('0xe')][_0xb151('0x33')]({'uniqueid':this[_0xb151('0x34')][_0xb151('0x35')],'node':_0x4075bf['label'],'application':_0x4075bf[_0xb151('0x36')],'data':_0x27fbe4||null,'project_name':this[_0xb151('0x34')][_0xb151('0x37')],'callerid':this[_0xb151('0x34')][_0xb151('0x38')]})[_0xb151('0x10')](function(_0x5c84b5){if(_0x407605){_0x407605(null,_0x5c84b5);}})[_0xb151('0x13')](function(_0x3ff2c0){if(_0x407605){_0x407605(_0x3ff2c0);}});};AGIVertices[_0xb151('0xc')][_0xb151('0x39')]=function(_0x19fe25,_0x1b9d80,_0xd016a,_0x9003e9){this[_0xb151('0xe')][_0xb151('0x39')]({'uniqueid':this['channel'][_0xb151('0x35')],'callerid':this['channel'][_0xb151('0x38')],'calleridname':this[_0xb151('0x34')][_0xb151('0x3a')],'context':this['channel'][_0xb151('0x3b')],'extension':this['channel'][_0xb151('0x3c')],'priority':this[_0xb151('0x34')][_0xb151('0x3d')],'accountcode':this[_0xb151('0x34')][_0xb151('0x3e')],'dnid':this['channel'][_0xb151('0x3f')],'projectName':this['channel'][_0xb151('0x37')],'saveName':_0x1b9d80,'filename':_0x19fe25[_0xb151('0x40')]||_0x1b9d80,'savePath':_0xd016a})[_0xb151('0x10')](function(_0x2ce3ca){_0x9003e9(null,_0x2ce3ca);})['catch'](function(_0x41b047){_0x9003e9(_0x41b047);});};AGIVertices[_0xb151('0xc')][_0xb151('0x41')]=function(_0x2cb92c,_0x5b722e,_0x409e96,_0x59aa3b,_0x3d67aa){this[_0xb151('0xe')][_0xb151('0x41')]({'uniqueid':this[_0xb151('0x34')][_0xb151('0x35')],'body':_0x2cb92c,'direction':_0x5b722e,'providerName':_0x409e96,'providerResponse':_0x59aa3b})['then'](function(_0x4bae3a){if(_0x3d67aa){_0x3d67aa(null,_0x4bae3a);}})[_0xb151('0x13')](function(_0x261aa5){if(_0x3d67aa){_0x3d67aa(_0x261aa5);}});};AGIVertices[_0xb151('0xc')][_0xb151('0x42')]=function(_0x20edbf,_0x4cb261){this[_0xb151('0xe')]['createCmContact']({'firstName':_[_0xb151('0x43')](_0x20edbf['name'])||_[_0xb151('0x44')](_0x20edbf[_0xb151('0x11')])?'callback_'+Math[_0xb151('0x45')]():_0x20edbf[_0xb151('0x11')],'lastName':_[_0xb151('0x43')](_0x20edbf[_0xb151('0x46')])||_[_0xb151('0x44')](_0x20edbf[_0xb151('0x46')])?null:_0x20edbf['lastName'],'phone':_0x20edbf['phone'],'ListId':_0x20edbf['list_id'],'scheduledat':_0x20edbf[_0xb151('0x47')],'callbackUniqueid':this[_0xb151('0x34')][_0xb151('0x35')],'tags':_0xb151('0x48'),'description':_0xb151('0x49')+_0x20edbf['scheduledAt'][_0xb151('0x4a')](),'priority':_0x20edbf['callback_priority']})['then'](function(_0x43a2bf){_0x4cb261(null,_0x43a2bf);})[_0xb151('0x13')](function(_0x5c6bfd){_0x4cb261(_0x5c6bfd);});};AGIVertices['prototype'][_0xb151('0x4b')]=function(_0x6ab98,_0x112c61){this[_0xb151('0xe')][_0xb151('0x4c')](_0x6ab98)[_0xb151('0x10')](function(_0x1f7eda){_0x112c61(null,_0x1f7eda?_0x1f7eda['name']:![]);})[_0xb151('0x13')](function(_0x15d695){_0x112c61(_0x15d695);});};AGIVertices[_0xb151('0xc')][_0xb151('0x4d')]=function(_0x4ca0fc,_0x1754b2,_0x384424){var _0x1da891={'role':_0xb151('0x4e')};_0x1da891[_0x4ca0fc]=this[_0xb151('0x34')][_0xb151('0x38')];this['rpc']['agentPause'](_0x1da891,_0x1754b2,this[_0xb151('0x34')][_0xb151('0x35')])[_0xb151('0x10')](function(_0xe59243){_0x384424(null,_[_0xb151('0x44')](_0xe59243)?![]:!![]);})['catch'](function(_0x3e8e48){logger[_0xb151('0x28')](_0x3e8e48);_0x384424(null,![]);});};AGIVertices['prototype'][_0xb151('0x4f')]=function(_0x442c8e,_0x213fa5){var _0x4d741e={'role':_0xb151('0x4e')};_0x4d741e[_0x442c8e]=this['channel'][_0xb151('0x38')];this[_0xb151('0xe')][_0xb151('0x4f')](_0x4d741e)[_0xb151('0x10')](function(_0x26a7e4){_0x213fa5(null,_[_0xb151('0x44')](_0x26a7e4)?![]:!![]);})[_0xb151('0x13')](function(_0xfd9abe){logger[_0xb151('0x28')](_0xfd9abe);_0x213fa5(null,![]);});};AGIVertices[_0xb151('0xc')][_0xb151('0x50')]=function(_0x996523,_0x5efd97){var _0x216575={'role':_0xb151('0x4e')};_0x216575[_0x996523]=this['channel'][_0xb151('0x38')];this[_0xb151('0xe')]['agentLogout'](_0x216575)[_0xb151('0x10')](function(_0x2ce42b){_0x5efd97(null,_[_0xb151('0x44')](_0x2ce42b)?![]:!![]);})[_0xb151('0x13')](function(_0x5994c3){logger[_0xb151('0x28')](_0x5994c3);_0x5efd97(null,![]);});};AGIVertices[_0xb151('0xc')][_0xb151('0x51')]=function(_0x50fc7d,_0x1723cb){var _0x197e73={'role':_0xb151('0x4e')};_0x197e73[_0x50fc7d]=this['channel'][_0xb151('0x38')];var _0x448ff0=_0x50fc7d!='internal'?util[_0xb151('0x24')](_0xb151('0x52'),_0xb151('0x53'),this[_0xb151('0x34')][_0xb151('0x38')]):undefined;this[_0xb151('0xe')][_0xb151('0x51')](_0x197e73,_0x448ff0)['then'](function(_0x1dcc8d){_0x1723cb(null,_[_0xb151('0x44')](_0x1dcc8d)?![]:!![]);})['catch'](function(_0x572c51){logger[_0xb151('0x28')](_0x572c51);_0x1723cb(null,![]);});};AGIVertices[_0xb151('0xc')][_0xb151('0x54')]=function(_0x46b7d0,_0x5d41d5){sh[_0xb151('0x55')](_[_0xb151('0x56')](_0x46b7d0),function(_0x4f65a0,_0x49e2fc){var _0x420b0c=_0x49e2fc[_0xb151('0x57')](/(\r\n|\n|\r)/gm,'');_0x5d41d5(null,_0x420b0c);});};AGIVertices['prototype'][_0xb151('0x58')]=function(_0x42a051,_0x326423){scripts['googleCloudTTS'](_0x42a051['apiKey'],_0x42a051[_0xb151('0x59')]||_0xb151('0x5a'),_0x42a051['text'],_0x42a051[_0xb151('0x5b')]||'en-US',_0x42a051[_0xb151('0x5c')]||_0xb151('0x5d'),_0x42a051[_0xb151('0x5e')]||_0xb151('0x5f'))[_0xb151('0x10')](function(_0x961666){_0x326423(null,_0x961666);})['catch'](function(_0x1a14c2){_0x326423(_0x1a14c2);});};AGIVertices[_0xb151('0xc')][_0xb151('0x60')]=function(_0xeb662e,_0x1dfb16){scripts[_0xb151('0x60')](_0xeb662e['text'],_0xeb662e['google_tts_language']||'en',0x1)['then'](function(_0x2ec1d9){_0x1dfb16(null,_0x2ec1d9);})['catch'](function(_0x238faa){_0x1dfb16(_0x238faa);});};AGIVertices['prototype']['restAPI']=function(_0x5f5c24,_0x145b10){var _0x1a9f1a={'uri':_0x5f5c24[_0xb151('0x61')],'method':_0x5f5c24[_0xb151('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5f5c24[_0xb151('0x63')])===_0xb151('0x64')&&parseInt(_0x5f5c24[_0xb151('0x63')])>=0x1?parseInt(_0x5f5c24['timeout'])*0x3e8:0x5*0x3e8};if(_['includes'](['POST','PUT'],_0x1a9f1a[_0xb151('0x62')][_0xb151('0x65')]())){try{_0x1a9f1a[_0xb151('0x66')]=_0x5f5c24[_0xb151('0x8')]?JSON[_0xb151('0x67')](_0x5f5c24[_0xb151('0x8')]):{};}catch(_0x3c946c){logger[_0xb151('0x28')](_0xb151('0x68'),_0x3c946c);}}try{_0x1a9f1a[_0xb151('0x69')]=_0x5f5c24['rawHeaders']?JSON[_0xb151('0x67')](_0x5f5c24['rawHeaders']):{};}catch(_0x64b1f3){logger['error'](_0xb151('0x6a'),_0x64b1f3);}if(_0x5f5c24['computedVariables']){try{var _0x53a2f2=require(_0x5f5c24[_0xb151('0x6b')])[_0xb151('0x6c')](this,_0x1a9f1a);_0x1a9f1a['uri']=Mustache[_0xb151('0x6d')](_0x5f5c24[_0xb151('0x61')],_0x53a2f2,{},['$$','$$']);if(_0x1a9f1a[_0xb151('0x69')]){_0x1a9f1a[_0xb151('0x69')]=JSON[_0xb151('0x67')](Mustache['render'](JSON['stringify'](_0x1a9f1a['headers']),_0x53a2f2,{},['$$','$$']));}if(_0x1a9f1a[_0xb151('0x66')]){_0x1a9f1a['body']=JSON['parse'](Mustache[_0xb151('0x6d')](JSON['stringify'](_0x1a9f1a[_0xb151('0x66')]),_0x53a2f2,{},['$$','$$']));}}catch(_0x3bb298){logger[_0xb151('0x28')](_0xb151('0x6e'),_0x3bb298);}}rp(_0x1a9f1a)[_0xb151('0x10')](function(_0x522684){var _0x520cee={'statusCode':_0x522684[_0xb151('0x6f')]||0xc8,'statusMessage':_0x522684[_0xb151('0x70')]||'OK','headers':_0x522684['headers']||{},'body':_0x522684[_0xb151('0x66')]||{}};_0x145b10(null,_0x520cee);})['catch'](function(_0x3cd8cb){var _0xfc2254={'statusCode':_0x3cd8cb[_0xb151('0x6f')]||0x1f4,'statusMessage':_0x3cd8cb[_0xb151('0x71')]||_0xb151('0x72'),'headers':_0x3cd8cb[_0xb151('0x73')][_0xb151('0x69')]||{},'body':_0x3cd8cb[_0xb151('0x73')][_0xb151('0x66')]||{}};_0x145b10(null,_0xfc2254);});};AGIVertices[_0xb151('0xc')]['googleDialogflow']=function(_0xd4ff2c,_0x233f85){scripts[_0xb151('0x74')](this[_0xb151('0x34')][_0xb151('0x35')],_0xd4ff2c[_0xb151('0x75')],_0xd4ff2c[_0xb151('0x5a')],_0xd4ff2c['dialogflow_language']||'en')['then'](function(_0x5622b7){_0x233f85(null,_0x5622b7);})['catch'](function(_0x45bcd1){_0x233f85(_0x45bcd1);});};AGIVertices[_0xb151('0xc')][_0xb151('0x76')]=function(_0x38e201,_0x29306c){scripts['googleDialogflowV2'](this[_0xb151('0x34')][_0xb151('0x35')],_0x38e201[_0xb151('0x77')],_0x38e201[_0xb151('0x78')],_0x38e201[_0xb151('0x79')],_0x38e201['text'],_0x38e201[_0xb151('0x7a')]||'en')[_0xb151('0x10')](function(_0x2fa331){_0x29306c(null,_0x2fa331);})[_0xb151('0x13')](function(_0x39c762){_0x29306c(_0x39c762);});};AGIVertices['prototype']['sestekNDA']=function(_0x1fb89e,_0x5170d9){scripts['sestekNDA'](this[_0xb151('0x34')],_0x1fb89e)[_0xb151('0x10')](function(_0x24c34d){_0x5170d9(null,_0x24c34d);})[_0xb151('0x13')](function(_0x42aa74){_0x5170d9(_0x42aa74);});};AGIVertices[_0xb151('0xc')]['ispeechTTS']=function(_0xe8e126,_0x4e4641){scripts[_0xb151('0x7b')](_0xe8e126['key'],_0xe8e126[_0xb151('0x5a')],_0xe8e126[_0xb151('0x7c')]||'en-US',_0xe8e126[_0xb151('0x7d')])['then'](function(_0x1ddc17){_0x4e4641(null,_0x1ddc17);})[_0xb151('0x13')](function(_0x86eba7){_0x4e4641(_0x86eba7);});};AGIVertices[_0xb151('0xc')]['ispeechASR']=function(_0x46075c,_0x45576d,_0x54707d){scripts[_0xb151('0x7e')](_0x45576d,_0x46075c['key'],_0x46075c[_0xb151('0x7f')]||_0xb151('0x80'),this[_0xb151('0x81')](_0x46075c[_0xb151('0x82')])?_0x46075c['model']:undefined)[_0xb151('0x10')](function(_0x275b87){_0x54707d(null,_0x275b87);})[_0xb151('0x13')](function(_0xa92c13){_0x54707d(_0xa92c13);});};AGIVertices[_0xb151('0xc')][_0xb151('0x83')]=function(_0x51951d,_0x255a11){scripts[_0xb151('0x83')](_0x51951d[_0xb151('0x84')],_0x51951d['aws_secret_access_key'],_0x51951d[_0xb151('0x85')],_0x51951d[_0xb151('0x86')]||_0xb151('0x87'),_0x51951d[_0xb151('0x5a')],_0x51951d[_0xb151('0x88')]||'text')[_0xb151('0x10')](function(_0x1b7806){_0x255a11(null,_0x1b7806);})[_0xb151('0x13')](function(_0x3e0694){_0x255a11(_0x3e0694);});};AGIVertices[_0xb151('0xc')][_0xb151('0x89')]=function(_0x11fa48,_0x3c03ee){scripts[_0xb151('0x89')](this['channel']['uniqueid'],_0x11fa48[_0xb151('0x84')],_0x11fa48[_0xb151('0x8a')],_0x11fa48['aws_lex_region'],_0x11fa48['text'],_0x11fa48[_0xb151('0x8b')])['then'](function(_0x100273){_0x3c03ee(null,_0x100273);})[_0xb151('0x13')](function(_0x4b51e0){_0x3c03ee(_0x4b51e0);});};AGIVertices[_0xb151('0xc')][_0xb151('0x8c')]=function(_0x558630,_0x57e182,_0x344754){scripts[_0xb151('0x8c')](_0x57e182,_0x558630[_0xb151('0x75')],_0x558630[_0xb151('0x8d')]||_0xb151('0x80'))['then'](function(_0x3d9257){_0x344754(null,_0x3d9257);})[_0xb151('0x13')](function(_0x1e547d){_0x344754(_0x1e547d);});};AGIVertices[_0xb151('0xc')][_0xb151('0x8e')]=function(_0x119fcf,_0x3ba748,_0x29523f){scripts[_0xb151('0x8e')](_0x3ba748,_0x119fcf[_0xb151('0x8f')],_0x119fcf[_0xb151('0x90')],_0x119fcf['uri'])[_0xb151('0x10')](function(_0x1bd1e3){_0x29523f(null,_0x1bd1e3);})[_0xb151('0x13')](function(_0x39e3cd){_0x29523f(_0x39e3cd);});};AGIVertices[_0xb151('0xc')][_0xb151('0x91')]=function(_0x197f3d){var _0x5d87da=_['includes'](verticesWithRetry,_0x197f3d['agicommand'])?_0x197f3d:_[_0xb151('0x92')](_0x197f3d);for(var _0x229319 in _0x5d87da){if(_0x5d87da[_0xb151('0x93')](_0x229319)){if(_0x5d87da[_0x229319]&&_[_0xb151('0x94')](_0x5d87da[_0x229319])){if(_[_0xb151('0x95')](recursiveMapAttributes,_0x229319)){_0x5d87da[_0x229319]=this[_0xb151('0x96')](_0x5d87da[_0x229319]);}else{_0x5d87da[_0x229319]=this['replaceAllVariables'](_0x5d87da[_0x229319]);}}}}return _0x5d87da;};AGIVertices[_0xb151('0xc')]['recursiveNodeIndex']=function(_0x18d210){for(var _0x4229ff in _0x18d210){if(_0x18d210[_0xb151('0x93')](_0x4229ff)){if(_[_0xb151('0x97')](_0x18d210[_0x4229ff])){this['recursiveNodeIndex'](_0x18d210[_0x4229ff]);}else if(_['isArray'](_0x18d210[_0x4229ff])){for(var _0x259f47=0x0;_0x259f47<_0x18d210[_0x4229ff][_0xb151('0x98')];_0x259f47++){this[_0xb151('0x99')](_0x18d210[_0x4229ff][_0x259f47]);}}else if(_[_0xb151('0x94')](_0x18d210[_0x4229ff])){_0x18d210[_0x4229ff]=this[_0xb151('0x9a')](_0x18d210[_0x4229ff]);}}}};AGIVertices[_0xb151('0xc')][_0xb151('0x9b')]=function(_0x2e223c,_0xfeebe2){for(var _0x54d292 in _0x2e223c){if(_0x2e223c[_0xb151('0x93')](_0x54d292)){if(_[_0xb151('0x97')](_0x2e223c[_0x54d292])){if(!_[_0xb151('0x43')](_0x2e223c[_0x54d292])){this[_0xb151('0x9b')](_0x2e223c[_0x54d292],util[_0xb151('0x24')](_0xb151('0x9c'),_0xfeebe2,_0x54d292));}}else if(_[_0xb151('0x9d')](_0x2e223c[_0x54d292])){for(var _0xdcff67=0x0;_0xdcff67<_0x2e223c[_0x54d292][_0xb151('0x98')];_0xdcff67++){this[_0xb151('0x9b')](_0x2e223c[_0x54d292][_0xdcff67],util[_0xb151('0x24')](_0xb151('0x9c'),_0xfeebe2,_0x54d292+'['+_0xdcff67+']'));}}else{if(!_['isNil'](_0x2e223c[_0x54d292])){this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')](_0xb151('0x9c'),_0xfeebe2,_0x54d292),_0x2e223c[_0x54d292]);}}}}};AGIVertices[_0xb151('0xc')][_0xb151('0x96')]=function(_0x4fe2a4){try{var _0x1ba140=JSON[_0xb151('0x67')](_0x4fe2a4);this[_0xb151('0x99')](_0x1ba140);return JSON[_0xb151('0x9f')](_0x1ba140);}catch(_0x143afa){return this['replaceAllVariables'](_0x4fe2a4);}};AGIVertices['prototype'][_0xb151('0x9a')]=function(_0x519037){var _0x2d82df=_0x519037['split']('{');for(var _0x3528d4=0x1;_0x3528d4<_0x2d82df[_0xb151('0x98')];_0x3528d4+=0x1){var _0x1d222e=_0x2d82df[_0x3528d4][_0xb151('0xa0')]('}');if(_0x1d222e[_0xb151('0x98')]>0x1){_0x519037=_0x519037[_0xb151('0xa1')]('{'+_0x1d222e[0x0]+'}',this[_0xb151('0x34')][_0xb151('0xd')](_0x1d222e[0x0])[_0xb151('0xa2')]||_0x1d222e[0x0]);}}if(_0x2d82df['length']===0x1){return _0x519037[_0xb151('0x4a')]();}return this[_0xb151('0x9a')](_0x519037);};AGIVertices['prototype'][_0xb151('0xa3')]=function(_0x2e8f49,_0x173d16){var _0x4638d1=this[_0xb151('0x34')][_0xb151('0xd')](_0x2e8f49);if(_0x4638d1[_0xb151('0xa4')]===-0x1){return _0x4638d1;}logger['info'](util[_0xb151('0x24')](_0xb151('0xa5'),_0x173d16,_0x4638d1['extra']));return this[_0xb151('0x34')]['setVariable'](_0x173d16,_0x4638d1['extra']);};AGIVertices['prototype'][_0xb151('0x81')]=function(_0x357a87){return _0x357a87&&_0x357a87!=='0'&&_0x357a87!=='-1'&&_0x357a87!=='';};AGIVertices[_0xb151('0xc')][_0xb151('0xa6')]=function(_0x4ed97a){this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x4ed97a,'-');_0x4ed97a[_0xb151('0xa7')]=_0x4ed97a['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb151('0xc')][_0xb151('0xa8')]=function(_0x56f185){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xa9'),_0x56f185['label']));if(!this[_0xb151('0x81')](_0x56f185[_0xb151('0x5a')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xab'));}var _0x946625='\x22'+_0x56f185[_0xb151('0x5a')]+'\x22';if(this[_0xb151('0x81')](_0x56f185['options'])){_0x946625+=','+_0x56f185['options'];}var _0x410870=this[_0xb151('0x34')][_0xb151('0x55')]('MRCPSynth',_0x946625);if(_0x410870[_0xb151('0xa4')]===-0x1){return _0x410870;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x946625));};AGIVertices[_0xb151('0xc')]['mrcprecog']=function(_0x5e1319){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x5e1319[_0xb151('0xac')]));if(!this['isConfigured'](_0x5e1319[_0xb151('0xad')])){return this[_0xb151('0x34')]['noop'](_0xb151('0xae'));}var _0x3ce9b7=_0x5e1319[_0xb151('0xad')];if(this['isConfigured'](_0x5e1319['options'])){_0x3ce9b7+=','+_0x5e1319[_0xb151('0x73')];}var _0x226695=this[_0xb151('0x34')]['exec'](_0xb151('0xaf'),_0x3ce9b7);if(_0x226695[_0xb151('0xa4')]===-0x1){return _0x226695;}var _0x33d44d=this[_0xb151('0xa3')](_0xb151('0xb0'),_0xb151('0xb1'));if(_0x33d44d[_0xb151('0xa4')]===-0x1){return _0x33d44d;}var _0xd6d955=this['getAndSetVariable'](_0xb151('0xb2'),'MRCP_RECOG_TRANSCRIPT');if(_0xd6d955[_0xb151('0xa4')]===-0x1){return _0xd6d955;}var _0x5d200f=this[_0xb151('0xa3')](_0xb151('0xb3'),'MRCP_RECOG_INSTANCE');if(_0x5d200f[_0xb151('0xa4')]===-0x1){return _0x5d200f;}return this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xb4'),_0x3ce9b7));};AGIVertices[_0xb151('0xc')][_0xb151('0xb5')]=function(_0x1206e1){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1206e1[_0xb151('0xac')]));return this[_0xb151('0x34')][_0xb151('0xb5')]([_0x1206e1[_0xb151('0xb6')],_0x1206e1[_0xb151('0xb7')]]);};AGIVertices[_0xb151('0xc')][_0xb151('0xb8')]=function(_0x249ce2){logger['info'](util[_0xb151('0x24')](_0xb151('0xb9'),_0x249ce2[_0xb151('0xac')]));if(this[_0xb151('0x81')](_0x249ce2[_0xb151('0x63')])){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x249ce2['timeout']));var _0x177ee8=this[_0xb151('0x34')][_0xb151('0xba')](_0x249ce2[_0xb151('0x63')]);if(_0x177ee8['result']===-0x1){return _0x177ee8;}}return this[_0xb151('0x34')][_0xb151('0xb8')]();};AGIVertices[_0xb151('0xc')]['callback']=function(_0x54fbc2){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xbb'),_0x54fbc2['label']));if(!this[_0xb151('0x81')](_0x54fbc2['list_id'])){return this['channel'][_0xb151('0x28')](_0x54fbc2,'no\x20list\x20selected');}_0x54fbc2['scheduledAt']=moment();if(this[_0xb151('0x81')](_0x54fbc2[_0xb151('0xbc')])){_0x54fbc2['scheduledAt']=moment()[_0xb151('0xbd')](_0x54fbc2[_0xb151('0xbc')],_0xb151('0xbe'));}if(!this['isConfigured'](_0x54fbc2[_0xb151('0xbf')])){_0x54fbc2[_0xb151('0xbf')]=0x2;}this[_0xb151('0x42')][_0xb151('0x6c')](this,_0x54fbc2);return this[_0xb151('0x34')]['noop'](util[_0xb151('0x24')](_0xb151('0xc0'),_0x54fbc2[_0xb151('0xc1')],_0x54fbc2[_0xb151('0xc2')],_0x54fbc2[_0xb151('0x47')]));};AGIVertices[_0xb151('0xc')]['custom_app']=function(_0x14fe65){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x14fe65[_0xb151('0xac')]));var _0x10bee6=this[_0xb151('0x34')][_0xb151('0x55')](_0x14fe65[_0xb151('0xc3')],_0x14fe65[_0xb151('0x73')]);if(_0x10bee6[_0xb151('0xa4')]===-0x1){return _0x10bee6;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xc4'),_0x14fe65[_0xb151('0xc3')],_0x14fe65['options']));};AGIVertices[_0xb151('0xc')][_0xb151('0xc5')]=function(_0x26bd5f){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xc6'),_0x26bd5f[_0xb151('0xac')]));if(!this['isConfigured'](_0x26bd5f[_0xb151('0x5a')])){return this[_0xb151('0x34')][_0xb151('0xaa')]('no\x20text\x20configured');}var _0x3cc2c2='\x22'+_0x26bd5f[_0xb151('0x5a')]+'\x22';if(this[_0xb151('0x81')](_0x26bd5f[_0xb151('0x73')])){_0x3cc2c2+=','+_0x26bd5f['options'];}var _0x4e6167=this['channel'][_0xb151('0x55')](_0xb151('0xc7'),_0x3cc2c2);if(_0x4e6167['result']===-0x1){return _0x4e6167;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xc8'),_0x3cc2c2));};AGIVertices[_0xb151('0xc')]['sestektts']=function(_0x4218f1){logger['info'](util[_0xb151('0x24')](_0xb151('0xc9'),_0x4218f1[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x4218f1['text'])){return this[_0xb151('0x34')]['noop'](_0xb151('0xab'));}var _0x49b7de='\x22'+_0x4218f1[_0xb151('0x5a')]+'\x22';if(this[_0xb151('0x81')](_0x4218f1[_0xb151('0x73')])){_0x49b7de+=','+_0x4218f1[_0xb151('0x73')];}var _0x468c4d=this[_0xb151('0x34')][_0xb151('0x55')]('MRCPSynth',_0x49b7de);if(_0x468c4d[_0xb151('0xa4')]===-0x1){return _0x468c4d;}return this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xc8'),_0x49b7de));};AGIVertices[_0xb151('0xc')][_0xb151('0xca')]=function(_0x308c31){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xcb'),_0x308c31[_0xb151('0xac')]));if(!this['isConfigured'](_0x308c31[_0xb151('0xad')])){return this[_0xb151('0x34')]['noop']('no\x20grammar\x20configured');}var _0x2569ac=_0x308c31[_0xb151('0xad')];if(this[_0xb151('0x81')](_0x308c31['options'])){_0x2569ac+=','+_0x308c31[_0xb151('0x73')];}var _0x296ab1=this[_0xb151('0x34')][_0xb151('0x55')](_0xb151('0xaf'),_0x2569ac);if(_0x296ab1[_0xb151('0xa4')]===-0x1){return _0x296ab1;}var _0x5c8547=this['getAndSetVariable'](_0xb151('0xb0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x5c8547[_0xb151('0xa4')]===-0x1){return _0x5c8547;}var _0x161211=this[_0xb151('0xa3')](_0xb151('0xb2'),_0xb151('0xcc'));if(_0x161211['result']===-0x1){return _0x161211;}var _0x2d8305=this[_0xb151('0xa3')](_0xb151('0xb3'),_0xb151('0xcd'));if(_0x2d8305[_0xb151('0xa4')]===-0x1){return _0x2d8305;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xb4'),_0x2569ac));};AGIVertices[_0xb151('0xc')]['sestekasr']=function(_0x117053){logger[_0xb151('0x2a')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x117053[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x117053['grammar'])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xae'));}var _0x55d9fb=_0x117053[_0xb151('0xad')];if(this[_0xb151('0x81')](_0x117053[_0xb151('0x73')])){_0x55d9fb+=','+_0x117053[_0xb151('0x73')];}var _0x560a18=this['channel'][_0xb151('0x55')](_0xb151('0xaf'),_0x55d9fb);if(_0x560a18[_0xb151('0xa4')]===-0x1){return _0x560a18;}var _0x595a71=this[_0xb151('0xa3')]('RECOG_CONFIDENCE()',_0xb151('0xce'));if(_0x595a71['result']===-0x1){return _0x595a71;}var _0x5a1b46=this['getAndSetVariable'](_0xb151('0xb2'),_0xb151('0xcf'));if(_0x5a1b46['result']===-0x1){return _0x5a1b46;}var _0x4ac5e9=this[_0xb151('0xa3')](_0xb151('0xb3'),'SESTEK_ASR_INSTANCE');if(_0x4ac5e9[_0xb151('0xa4')]===-0x1){return _0x4ac5e9;}return this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xb4'),_0x55d9fb));};AGIVertices[_0xb151('0xc')]['database']=function(_0x25b1a3){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xd0'),_0x25b1a3['label']));if(!this['isConfigured'](_0x25b1a3[_0xb151('0xd1')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x25b1a3,'no\x20database\x20selected');}var _0x291a8e=this['getSquareOdbc'][_0xb151('0x6c')](this,_0x25b1a3[_0xb151('0xd1')]);if(!_0x291a8e){return this[_0xb151('0x34')][_0xb151('0x28')](_0x25b1a3,_0xb151('0xd2'));}if(!this[_0xb151('0x81')](_0x25b1a3[_0xb151('0x2c')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x25b1a3,_0xb151('0xd3'));}var _0x3d0720=_0x25b1a3[_0xb151('0x2c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util['format'](_0xb151('0xd4'),_0x3d0720));var _0x8193e4=this[_0xb151('0x26')][_0xb151('0x6c')](this,_0x291a8e,_0x3d0720);this['createSquareDetailsReport']['sync'](this,_0x25b1a3,_0x3d0720);if(!this[_0xb151('0x81')](_0x25b1a3[_0xb151('0xd5')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xd6'));}var _0x5a7162=this[_0xb151('0xd')][_0xb151('0x6c')](this,_0x25b1a3[_0xb151('0xd5')]);if(!_0x5a7162){return this[_0xb151('0x34')][_0xb151('0x28')](_0x25b1a3,'no\x20variable\x20found');}var _0x4c98f1=this;_0x8193e4[_0xb151('0xd7')](function(_0x22141b,_0x3c0b68){Object[_0xb151('0xd8')](_0x22141b)['forEach'](function(_0x4f7bcb){_0x4c98f1[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')](_0xb151('0xd9'),_0x5a7162,_0x3c0b68,_0x4f7bcb),_0x22141b[_0x4f7bcb]);});});this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')]('%s_ROWS_COUNT',_0x5a7162),_0x8193e4[_0xb151('0x98')]);return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xda'),_0x5a7162));};AGIVertices['prototype'][_0xb151('0xdb')]=function(_0x32b619){logger[_0xb151('0xdc')](util[_0xb151('0x24')](_0xb151('0xdd'),_0x32b619[_0xb151('0xac')]));if(!this['isConfigured'](_0x32b619['sip_id'])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x32b619,'no\x20user\x20selected');}var _0x44581a=this[_0xb151('0x17')]['sync'](this,_0x32b619[_0xb151('0xde')]);if(!_0x44581a){return this[_0xb151('0x34')][_0xb151('0x28')](_0x32b619,_0xb151('0xdf'));}var _0x434112=this[_0xb151('0x34')][_0xb151('0x55')]('DIAL',[util['format'](_0xb151('0xe0'),_0x44581a),_0x32b619[_0xb151('0x63')],_0x32b619[_0xb151('0xe1')],_0x32b619[_0xb151('0x61')]]);if(_0x434112[_0xb151('0xa4')]===-0x1){return _0x434112;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xe2'),_0xb151('0xe3')));};AGIVertices[_0xb151('0xc')][_0xb151('0xe4')]=function(_0x347da5){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xe5'),_0x347da5[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x347da5[_0xb151('0x75')])){return this[_0xb151('0x34')][_0xb151('0xaa')]('no\x20key\x20configured');}if(!this[_0xb151('0x81')](_0x347da5['text'])){return this['channel'][_0xb151('0xaa')](_0xb151('0xab'));}this[_0xb151('0x34')]['bot']=!![];this[_0xb151('0x33')](_0x347da5);this[_0xb151('0x41')](_0x347da5[_0xb151('0x5a')],'in','','');this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xe6'),_0x347da5[_0xb151('0x5a')]));var _0x499f84=this[_0xb151('0x74')][_0xb151('0x6c')](this,_0x347da5);if(_0x499f84){for(var _0x51aaba in _0x499f84){if(_0x499f84[_0xb151('0x93')](_0x51aaba)){this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')](_0xb151('0xe7'),_0x51aaba['toUpperCase']()),_0x499f84[_0x51aaba]);}}this[_0xb151('0x41')](_0x499f84[_0xb151('0xe8')],_0xb151('0xe9'),'dialogflow','');return this[_0xb151('0x34')][_0xb151('0xaa')](util['format'](_0xb151('0xea'),_0x499f84['speech']));}return this[_0xb151('0x34')][_0xb151('0x28')](_0x347da5,_0xb151('0xeb'));};AGIVertices['prototype'][_0xb151('0xec')]=function(_0x278bb7){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xed'),_0x278bb7['label']));if(!this[_0xb151('0x81')](_0x278bb7[_0xb151('0x77')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xee'));}if(!this[_0xb151('0x81')](_0x278bb7[_0xb151('0x78')])){return this[_0xb151('0x34')]['noop'](_0xb151('0xef'));}if(!this[_0xb151('0x81')](_0x278bb7[_0xb151('0x79')])){return this['channel'][_0xb151('0xaa')](_0xb151('0xf0'));}if(!this[_0xb151('0x81')](_0x278bb7[_0xb151('0x7a')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xf1'));}if(!this[_0xb151('0x81')](_0x278bb7[_0xb151('0x5a')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xab'));}this[_0xb151('0x34')][_0xb151('0xf2')]=!![];this[_0xb151('0x33')](_0x278bb7);this[_0xb151('0x41')](_0x278bb7[_0xb151('0x5a')],'in','','');this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('Trying\x20DialogflowV2:\x20%s',_0x278bb7[_0xb151('0x5a')]));var _0x3da3ac=this['googleDialogflowV2'][_0xb151('0x6c')](this,_0x278bb7);if(_0x3da3ac){for(var _0x5392be in _0x3da3ac){if(_0x3da3ac['hasOwnProperty'](_0x5392be)){if(_0x5392be!==_0xb151('0xf3')){this[_0xb151('0x34')]['setVariable'](util[_0xb151('0x24')](_0xb151('0xe7'),_0x5392be[_0xb151('0x65')]()),_0x3da3ac[_0x5392be]);}}}this[_0xb151('0x41')](_0x3da3ac['speech'],_0xb151('0xe9'),'dialogflowV2',_0x3da3ac['providerResponse']);return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xf4'),_0x3da3ac[_0xb151('0xe8')]));}return this[_0xb151('0x34')][_0xb151('0x28')](_0x278bb7,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xb151('0xc')][_0xb151('0xf5')]=function(_0x59b3e6){logger['info'](util[_0xb151('0x24')](_0xb151('0xf6'),_0x59b3e6[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x59b3e6['ndauth_url'])){return this[_0xb151('0x34')]['noop'](_0xb151('0xf7'));}if(!this['isConfigured'](_0x59b3e6['username'])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xf8'));}if(!this['isConfigured'](_0x59b3e6['password'])){return this['channel'][_0xb151('0xaa')](_0xb151('0xf9'));}if(!this[_0xb151('0x81')](_0x59b3e6[_0xb151('0xfa')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xab'));}this[_0xb151('0x34')][_0xb151('0xf2')]=!![];this[_0xb151('0x33')](_0x59b3e6);this['createSquareMessage'](_0x59b3e6['text'],'in','','');this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xfb'),_0x59b3e6['text']));var _0x36b625=this['sestekNDA'][_0xb151('0x6c')](this,_0x59b3e6);if(_0x36b625){for(var _0x5c3dec in _0x36b625){if(_0x36b625[_0xb151('0x93')](_0x5c3dec)){this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')](_0xb151('0xfc'),_0x5c3dec[_0xb151('0x65')]()),_0x36b625[_0x5c3dec]);}}this[_0xb151('0x41')](_0x36b625[_0xb151('0xe8')],_0xb151('0xe9'),_0xb151('0xf5'),'');if(_0x36b625[_0xb151('0xfd')]){this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x36b625[_0xb151('0xfd')]));var _0x591ead=this[_0xb151('0x34')]['streamFile'](_0x36b625[_0xb151('0xfd')]);try{fs['unlink'](_0x36b625[_0xb151('0xfd')]+'.wav');}catch(_0x5f0f1a){logger[_0xb151('0x28')](_0x5f0f1a);}return _0x591ead;}else{return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xfe'),_0x36b625[_0xb151('0xe8')]));}}return this['channel']['error'](_0x59b3e6,_0xb151('0xff'));};AGIVertices['prototype'][_0xb151('0x100')]=function(_0x11b98d){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x101'),_0x11b98d[_0xb151('0xac')]));return this['channel'][_0xb151('0xaa')](_0xb151('0x100'));};AGIVertices['prototype']['ext_dial']=function(_0x4259f2){logger['info'](util[_0xb151('0x24')](_0xb151('0x102'),_0x4259f2[_0xb151('0xac')]));var _0x3e9090='';if(_0x4259f2['trunk_id']){if(!this['isConfigured'](_0x4259f2[_0xb151('0x103')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x4259f2,_0xb151('0x104'));}else{var _0xf1f2d=parseInt(_0x4259f2[_0xb151('0x103')],0xa);if(isNaN(_0xf1f2d)){_0x3e9090=_0x4259f2[_0xb151('0x103')];}else{_0x3e9090=this[_0xb151('0x19')][_0xb151('0x6c')](this,_0x4259f2[_0xb151('0x103')]);if(!_0x3e9090){return this[_0xb151('0x34')][_0xb151('0x28')](_0x4259f2,_0xb151('0x105'));}}}}else if(_0x4259f2[_0xb151('0x106')]){_0x3e9090=_0x4259f2[_0xb151('0x106')];}else{return this[_0xb151('0x34')][_0xb151('0x28')](_0x4259f2,'no\x20trunk\x20selected');}var _0x2839d0=this['channel'][_0xb151('0x55')](_0xb151('0xe3'),[util[_0xb151('0x24')]('SIP/%s/%s',_0x3e9090,_0x4259f2['phone']),_0x4259f2[_0xb151('0x63')],_0x4259f2[_0xb151('0xe1')],_0x4259f2[_0xb151('0x61')]]);if(_0x2839d0['result']===-0x1){return _0x2839d0;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xe2'),'DIAL'));};AGIVertices[_0xb151('0xc')][_0xb151('0x107')]=function(_0x1756d6){logger['info'](util[_0xb151('0x24')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1756d6[_0xb151('0xac')]));return this['channel'][_0xb151('0xaa')]('finally');};AGIVertices[_0xb151('0xc')]['getdigits']=function(_0x90cc05){logger[_0xb151('0x2a')](util['format'](_0xb151('0x108'),_0x90cc05[_0xb151('0xac')]));if(_0x90cc05[_0xb151('0xa7')]===0x0){return this['maxRetry'](_0x90cc05);}_0x90cc05[_0xb151('0xa7')]-=0x1;if(!this[_0xb151('0x81')](_0x90cc05[_0xb151('0x109')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x90cc05,_0xb151('0x10a'));}var _0x2b7776=this[_0xb151('0x1a')]['sync'](this,_0x90cc05[_0xb151('0x109')]);if(!_0x2b7776){return this[_0xb151('0x34')][_0xb151('0x28')](_0x90cc05,_0xb151('0x10b'));}if(!this[_0xb151('0x81')](_0x90cc05[_0xb151('0xd5')])){return this['channel'][_0xb151('0x28')](_0xb151('0xd6'));}var _0x1b1b25=this[_0xb151('0x34')][_0xb151('0x10c')](_0x2b7776,_0x90cc05[_0xb151('0x10d')],_0x90cc05['maxdigit']);var _0x376ce8=_0x1b1b25[_0xb151('0xa4')]?_0x1b1b25[_0xb151('0xa4')][_0xb151('0x4a')]():'';logger[_0xb151('0x2a')](_0xb151('0x10e'),JSON['stringify'](_0x1b1b25));if(_0x1b1b25[_0xb151('0xa4')]===-0x1){this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x90cc05,_0x376ce8);return _0x1b1b25;}else if(_0x1b1b25['extra']===_0xb151('0x63')){_0x1b1b25[_0xb151('0xa4')]=_0x376ce8[_0xb151('0x98')]>=parseInt(_0x90cc05['mindigit'])?'x':'i';}else{_0x1b1b25[_0xb151('0xa4')]=_0x376ce8[_0xb151('0x98')]>=parseInt(_0x90cc05[_0xb151('0x10f')])&&_0x376ce8[_0xb151('0x98')]<=parseInt(_0x90cc05[_0xb151('0x110')])?'x':'i';}var _0x2e81c5=this[_0xb151('0xd')][_0xb151('0x6c')](this,_0x90cc05[_0xb151('0xd5')]);if(!_0x2e81c5){return this[_0xb151('0x34')]['error'](_0x90cc05,'no\x20variable\x20found');}this[_0xb151('0x34')]['setVariable'](_0x2e81c5,_0x376ce8);if(this[_0xb151('0x81')](_0x90cc05['hiddendigitsnum'])){var _0x4eba8c=parseInt(_0x90cc05[_0xb151('0x111')],0xa);var _0xccdf4=rs[_0xb151('0x112')]({'charset':'*','length':_0x4eba8c});var _0x4a6209=_0x376ce8[_0xb151('0x98')];if(_0x4a6209>0x0){if(_0x4a6209>_0x4eba8c){this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x90cc05,_0x90cc05[_0xb151('0x113')]===_0xb151('0x114')?_0xccdf4+_0x376ce8['substr'](_0x4eba8c):_0x376ce8[_0xb151('0x115')](0x0,_0x4a6209-_0x4eba8c)+_0xccdf4);}else{this['createSquareDetailsReport'][_0xb151('0x6c')](this,_0x90cc05,rs['generate']({'charset':'*','length':_0x4a6209}));}}else{this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x90cc05,'');}}else{this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x90cc05,_0x376ce8);}return _0x1b1b25;};AGIVertices[_0xb151('0xc')][_0xb151('0x116')]=function(_0x34fb7a){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x34fb7a[_0xb151('0xac')]));return this['getdigits'](_0x34fb7a);};AGIVertices[_0xb151('0xc')]['goal']=function(_0x359879){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x117'),_0x359879[_0xb151('0xac')]));this['createSquareDetailsReport'][_0xb151('0x6c')](this,_0x359879,_0x359879[_0xb151('0x118')]);return this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x119'),_0x359879[_0xb151('0x118')]));};AGIVertices[_0xb151('0xc')][_0xb151('0x11a')]=function(_0x81f9b0){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x81f9b0[_0xb151('0xac')]));if(!this['isConfigured'](_0x81f9b0[_0xb151('0x84')])||!this[_0xb151('0x81')](_0x81f9b0['aws_secret_access_key'])){return this[_0xb151('0x34')][_0xb151('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xb151('0x81')](_0x81f9b0[_0xb151('0x5a')])){return this['channel'][_0xb151('0xaa')]('no\x20text\x20configured');}this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')]('Trying\x20aws\x20Polly\x20%s',_0x81f9b0[_0xb151('0x5a')]));var _0x15d1f4=this['awsPolly']['sync'](this,_0x81f9b0);if(_0x15d1f4){this['channel']['noop'](util['format'](_0xb151('0x11b'),_0x15d1f4));var _0x4117c6=this[_0xb151('0x34')][_0xb151('0x11c')](_0x15d1f4);try{fs['unlink'](_0x15d1f4+_0xb151('0x11d'));}catch(_0x188926){logger['error'](_0x188926);}return _0x4117c6;}return this['channel'][_0xb151('0x28')](_0x81f9b0,_0xb151('0x11e'));};AGIVertices[_0xb151('0xc')][_0xb151('0x11f')]=function(_0xc5e512){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x120'),_0xc5e512[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0xc5e512['aws_access_key_id'])||!this[_0xb151('0x81')](_0xc5e512[_0xb151('0x8a')])){return this[_0xb151('0x34')]['noop'](_0xb151('0x121'));}if(!this[_0xb151('0x81')](_0xc5e512[_0xb151('0x8b')])){return this['channel']['noop'](_0xb151('0x122'));}if(!this[_0xb151('0x81')](_0xc5e512[_0xb151('0x5a')])){return this['channel']['noop'](_0xb151('0xab'));}this[_0xb151('0x34')][_0xb151('0xf2')]=!![];this[_0xb151('0x33')](_0xc5e512);this[_0xb151('0x41')](_0xc5e512['text'],'in','','');this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('Trying\x20Amazon\x20Lex:\x20%s',_0xc5e512[_0xb151('0x5a')]));var _0x41d612=this['awsLex']['sync'](this,_0xc5e512);if(_0x41d612){for(var _0x1a69d1 in _0x41d612){if(_0x41d612[_0xb151('0x93')](_0x1a69d1)&&_['isString'](_0x41d612[_0x1a69d1])){this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')]('AWS_LEX_%s',_0x1a69d1[_0xb151('0x65')]()),_0x41d612[_0x1a69d1]);}}if(_['isNil'](_0x41d612[_0xb151('0x71')])){return this[_0xb151('0x34')][_0xb151('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x41d612[_0xb151('0x71')],_0xb151('0xe9'),_0xb151('0x123'),'');return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('Amazon\x20Lex\x20Result\x20%s',_0x41d612[_0xb151('0x71')]));}}return this['channel']['error'](_0xc5e512,_0xb151('0x124'));};AGIVertices[_0xb151('0xc')][_0xb151('0x125')]=function(_0x322935){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x126'),_0x322935['label'],_0x322935[_0xb151('0x63')]));if(!this[_0xb151('0x81')](_0x322935['key'])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x127'));}var _0x528a54='wav';var _0x607c62=util[_0xb151('0x24')](_0xb151('0x128'),FILES_PATH,rs['generate'](0x4));var _0x16cae7=util[_0xb151('0x24')](_0xb151('0x9c'),_0x607c62,_0x528a54);var _0x420617=!![];if(_0x322935['beep']==='NOBEEP'){_0x420617=![];}var _0x44170c=this[_0xb151('0x34')]['recordFile'](_0x607c62,_0x528a54,_0x322935[_0xb151('0x129')],_0x322935[_0xb151('0x63')],undefined,_0x420617);if(_0x44170c[_0xb151('0xa4')]!==-0x1){this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x12a'),_0x16cae7));var _0x560edb=this['googleASR'][_0xb151('0x6c')](this,_0x322935,_0x16cae7);if(_0x560edb){for(var _0x23659b in _0x560edb){if(_0x560edb[_0xb151('0x93')](_0x23659b)){this['channel'][_0xb151('0x9e')](util['format'](_0xb151('0x12b'),_0x23659b[_0xb151('0x65')]()),_0x560edb[_0x23659b]);}}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x12c'),JSON[_0xb151('0x9f')](_0x560edb)));}}return _0x44170c;};AGIVertices['prototype'][_0xb151('0x12d')]=function(_0x2b212f){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x12e'),_0x2b212f[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x2b212f[_0xb151('0x8f')])){return this[_0xb151('0x34')][_0xb151('0xaa')]('no\x20appid\x20configured');}if(!this[_0xb151('0x81')](_0x2b212f['appsecret'])){return this['channel'][_0xb151('0xaa')]('no\x20appsecret\x20configured');}var _0x121788=_0xb151('0x12f');var _0x596d23=util[_0xb151('0x24')](_0xb151('0x128'),FILES_PATH,rs[_0xb151('0x112')](0x4));var _0x35c15c=util[_0xb151('0x24')](_0xb151('0x9c'),_0x596d23,_0x121788);var _0x8421e3=!![];if(_0x2b212f[_0xb151('0x130')]===_0xb151('0x131')){_0x8421e3=![];}var _0x2e5e9a=this['channel'][_0xb151('0x132')](_0x596d23,_0x121788,_0x2b212f[_0xb151('0x129')],_0x2b212f[_0xb151('0x63')],undefined,_0x8421e3);if(_0x2e5e9a[_0xb151('0xa4')]!==-0x1){this['channel'][_0xb151('0xaa')](util['format']('tilde\x20%s\x20file\x20created',_0x35c15c));var _0x45e05d=this[_0xb151('0x8e')][_0xb151('0x6c')](this,_0x2b212f,_0x35c15c);if(_0x45e05d){for(var _0x13a425 in _0x45e05d){if(_0x45e05d[_0xb151('0x93')](_0x13a425)){this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')]('TILDE_ASR_%s',_0x13a425[_0xb151('0x65')]()),_0x45e05d[_0x13a425]);}}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x133'),JSON[_0xb151('0x9f')](_0x45e05d)));}}return _0x2e5e9a;};AGIVertices['prototype']['gotoc']=function(_0x542da1){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x134'),_0x542da1[_0xb151('0xac')]));return this[_0xb151('0x34')][_0xb151('0x135')](_0x542da1[_0xb151('0x3b')],_0x542da1[_0xb151('0x3c')],_0x542da1[_0xb151('0x3d')]);};AGIVertices[_0xb151('0xc')][_0xb151('0x136')]=function(_0x2b83e3){logger[_0xb151('0x2a')](util['format'](_0xb151('0x137'),_0x2b83e3[_0xb151('0xac')]));if(!this['isConfigured'](_0x2b83e3[_0xb151('0x138')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x2b83e3,_0xb151('0x139'));}try{var _0x26f610=eval(_0x2b83e3[_0xb151('0x138')])?'true':'false';this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')]('EVAL\x20CONDITION\x20%s\x20%s',_0x2b83e3[_0xb151('0x138')],_0x26f610));return{'code':0xc8,'result':_0x26f610};}catch(_0x4b6286){return{'code':0xc8,'result':_0xb151('0x13a')};}};AGIVertices[_0xb151('0xc')][_0xb151('0x13b')]=function(_0x15f5da){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x13c'),_0x15f5da['label']));if(!this[_0xb151('0x81')](_0x15f5da[_0xb151('0x13d')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x15f5da,_0xb151('0x13e'));}var _0x5280bb=this['getIntervals'][_0xb151('0x6c')](this,_0x15f5da[_0xb151('0x13d')]);if(!_0x5280bb){return this['channel'][_0xb151('0x28')](_0x15f5da,_0xb151('0x13f'));}for(var _0xeb9550=0x0;_0xeb9550<_0x5280bb['length'];_0xeb9550+=0x1){var _0x5dc603=this[_0xb151('0x34')][_0xb151('0xd')](util[_0xb151('0x24')]('IFTIME(%s?true:false)',_0x5280bb[_0xeb9550]));if(_0x5dc603[_0xb151('0xa4')]===-0x1){return _0x5dc603;}logger[_0xb151('0x2a')](util[_0xb151('0x24')]('IFTIME\x20%s\x20%s',_0x5280bb[_0xeb9550],_0x5dc603[_0xb151('0xa2')]));if(_0x5dc603[_0xb151('0xa2')]===_0xb151('0x140')){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('IFTIME\x20%s\x20%s',_0x5280bb[_0xeb9550],_0xb151('0x140')));this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('IFTIME\x20%s\x20%s',_0x5280bb[_0xeb9550],_0xb151('0x140')));return{'code':0xc8,'result':_0xb151('0x140')};}else{logger[_0xb151('0x2a')](util['format'](_0xb151('0x141'),_0x5280bb[_0xeb9550],'false'));this['channel']['noop'](util[_0xb151('0x24')](_0xb151('0x141'),_0x5280bb[_0xeb9550],_0xb151('0x13a')));}}return{'code':0xc8,'result':_0xb151('0x13a')};};AGIVertices[_0xb151('0xc')]['hangup']=function(_0x2630cd){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2630cd['label']));return this['channel']['hangup']();};AGIVertices[_0xb151('0xc')][_0xb151('0x142')]=function(_0x1369e6){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x143'),_0x1369e6['label']));if(!this[_0xb151('0x81')](_0x1369e6[_0xb151('0x75')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x127'));}var _0x24c738=_0xb151('0x12f');var _0x3904ba=util['format'](_0xb151('0x128'),FILES_PATH,rs[_0xb151('0x112')](0x4));var _0xf06043=util['format'](_0xb151('0x9c'),_0x3904ba,_0x24c738);var _0x40b6de=!![];if(_0x1369e6[_0xb151('0x130')]===_0xb151('0x131')){_0x40b6de=![];}var _0x5528b3=this[_0xb151('0x34')][_0xb151('0x132')](_0x3904ba,_0x24c738,_0x1369e6[_0xb151('0x129')],_0x1369e6['timeout'],undefined,_0x40b6de);if(_0x5528b3['result']!==-0x1){this[_0xb151('0x34')][_0xb151('0xaa')](util['format'](_0xb151('0x144'),_0xf06043));var _0x3e272a=this[_0xb151('0x7e')][_0xb151('0x6c')](this,_0x1369e6,_0xf06043);if(_0x3e272a){for(var _0xd70117 in _0x3e272a){if(_0x3e272a['hasOwnProperty'](_0xd70117)){this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')]('ISPEECH_ASR_%s',_0xd70117[_0xb151('0x65')]()),_0x3e272a[_0xd70117]);}}return this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x145'),JSON[_0xb151('0x9f')](_0x3e272a)));}}return _0x5528b3;};AGIVertices['prototype'][_0xb151('0x146')]=function(_0x3a1b93){logger['info'](util[_0xb151('0x24')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3a1b93['label']));if(!this[_0xb151('0x81')](_0x3a1b93[_0xb151('0x75')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x127'));}if(!this[_0xb151('0x81')](_0x3a1b93['text'])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xab'));}this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x147'),_0x3a1b93[_0xb151('0x5a')]));var _0x3c75e5=this[_0xb151('0x7b')][_0xb151('0x6c')](this,_0x3a1b93);if(_0x3c75e5){this[_0xb151('0x34')][_0xb151('0xaa')](util['format'](_0xb151('0x144'),_0x3c75e5));var _0x17076b=this[_0xb151('0x34')][_0xb151('0x11c')](_0x3c75e5,_0x3a1b93[_0xb151('0x129')]);try{fs['unlink'](_0x3c75e5+_0xb151('0x11d'));}catch(_0x320463){logger[_0xb151('0x28')](_0x320463);}return _0x17076b;}return this[_0xb151('0x34')][_0xb151('0x28')](_0x3a1b93,_0xb151('0x148'));};AGIVertices['prototype'][_0xb151('0x149')]=function(_0x45f5de){logger['info'](util['format'](_0xb151('0x14a'),_0x45f5de[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x45f5de[_0xb151('0x14b')])){return this[_0xb151('0x34')]['error'](_0x45f5de,'no\x20find\x20by\x20configured');}logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x14c'),this[_0xb151('0x34')]['callerid'],_0x45f5de[_0xb151('0x14b')]));var _0x44680e=this[_0xb151('0x51')][_0xb151('0x6c')](this,_0x45f5de[_0xb151('0x14b')]);if(_0x44680e){logger[_0xb151('0x2a')](util['format'](_0xb151('0x14d'),this[_0xb151('0x34')][_0xb151('0x38')],_0x45f5de[_0xb151('0x14b')]));this['channel'][_0xb151('0xaa')](util['format'](_0xb151('0x14d'),this[_0xb151('0x34')]['callerid'],_0x45f5de[_0xb151('0x14b')]));return{'code':0xc8,'result':_0xb151('0x14e')};}else{logger[_0xb151('0x2a')](util[_0xb151('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x45f5de[_0xb151('0x14b')]));this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x45f5de[_0xb151('0x14b')]));return{'code':0xc8,'result':_0xb151('0x14f')};}};AGIVertices[_0xb151('0xc')][_0xb151('0x150')]=function(_0x5b1eae){logger[_0xb151('0x2a')](util['format'](_0xb151('0x151'),_0x5b1eae['label']));if(!this[_0xb151('0x81')](_0x5b1eae['findBy'])){return this[_0xb151('0x34')]['error'](_0x5b1eae,_0xb151('0x152'));}logger['info'](util[_0xb151('0x24')](_0xb151('0x14c'),this[_0xb151('0x34')]['callerid'],_0x5b1eae[_0xb151('0x14b')]));var _0x2cd6cf=this[_0xb151('0x50')][_0xb151('0x6c')](this,_0x5b1eae[_0xb151('0x14b')]);if(_0x2cd6cf){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x14d'),this[_0xb151('0x34')][_0xb151('0x38')],_0x5b1eae[_0xb151('0x14b')]));this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x14d'),this['channel'][_0xb151('0x38')],_0x5b1eae[_0xb151('0x14b')]));return{'code':0xc8,'result':_0xb151('0x14e')};}else{logger['info'](util[_0xb151('0x24')](_0xb151('0x153'),this[_0xb151('0x34')][_0xb151('0x38')],_0x5b1eae['findBy']));this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x153'),this[_0xb151('0x34')][_0xb151('0x38')],_0x5b1eae['findBy']));return{'code':0xc8,'result':_0xb151('0x14f')};}};AGIVertices[_0xb151('0xc')][_0xb151('0x154')]=function(_0x5c78c6){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x155'),_0x5c78c6[_0xb151('0xac')]));if(!this['isConfigured'](_0x5c78c6[_0xb151('0x156')])){return this['channel']['error'](_0x5c78c6,_0xb151('0x157'));}this[_0xb151('0x34')][_0xb151('0xaa')](util['format']('math\x20%s',_0x5c78c6[_0xb151('0x156')]));var _0xf9f71d=eval(_0x5c78c6['operation']);if(!this[_0xb151('0x81')](_0x5c78c6[_0xb151('0xd5')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xd6'));}var _0x3d3a97=this[_0xb151('0xd')][_0xb151('0x6c')](this,_0x5c78c6['variable_id']);if(!_0x3d3a97){return this['channel']['error'](_0x5c78c6,_0xb151('0x158'));}if(_[_0xb151('0x9d')](_0xf9f71d)){var _0x16ccc2=this;_0xf9f71d[_0xb151('0xd7')](function(_0x5dda78,_0x39bbac){_0x16ccc2[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')](_0xb151('0x159'),_0x3d3a97,_0x39bbac),_0x5dda78);});return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('variable\x20%s[key]\x20set',_0x3d3a97));}else{return this['channel'][_0xb151('0x9e')](_0x3d3a97,_0xf9f71d);}};AGIVertices['prototype']['menu']=function(_0x2acf45){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x15a'),_0x2acf45['label']));if(_0x2acf45[_0xb151('0xa7')]===0x0){return this[_0xb151('0xa6')](_0x2acf45);}_0x2acf45['retry']-=0x1;if(!this[_0xb151('0x81')](_0x2acf45[_0xb151('0x109')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x2acf45,_0xb151('0x10a'));}var _0x2a0dbd=this[_0xb151('0x1a')]['sync'](this,_0x2acf45[_0xb151('0x109')]);if(!_0x2a0dbd){return this[_0xb151('0x34')][_0xb151('0x28')](_0x2acf45,'no\x20file\x20audio\x20found');}var _0x573526=this[_0xb151('0x34')]['getData'](_0x2a0dbd,_0x2acf45['response'],_0x2acf45[_0xb151('0x15b')]);var _0x2a0122=_0x573526[_0xb151('0xa4')];if(_0x573526['result']===-0x1){this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x2acf45,'-1');return _0x573526;}else if(_0x573526[_0xb151('0xa2')]==='timeout'){_0x573526[_0xb151('0xa4')]=_0x573526[_0xb151('0xa4')]['length']>0x0?_0x573526[_0xb151('0xa4')]:'t';}else if(_[_0xb151('0x43')](_0x573526['result'])){_0x573526[_0xb151('0xa4')]='#';_0x2a0122='#';}if(!this[_0xb151('0x81')](_0x2acf45[_0xb151('0xd5')])){this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xd6'));}else{var _0x1beb01=this[_0xb151('0xd')][_0xb151('0x6c')](this,_0x2acf45[_0xb151('0xd5')]);if(!_0x1beb01){return this[_0xb151('0x34')][_0xb151('0x28')](_0x2acf45,_0xb151('0x158'));}this[_0xb151('0x34')][_0xb151('0x9e')](_0x1beb01,_0x2a0122);}this['createSquareDetailsReport']['sync'](this,_0x2acf45,_0x2a0122);return _0x573526;};AGIVertices[_0xb151('0xc')][_0xb151('0xaa')]=function(_0x12bba0){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x15c'),_0x12bba0[_0xb151('0xac')]));return this['channel']['noop'](_0x12bba0[_0xb151('0x15d')]||_0x12bba0[_0xb151('0xac')]);};AGIVertices[_0xb151('0xc')][_0xb151('0x15e')]=function(_0x58333d){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x15f'),_0x58333d['label']));if(!this[_0xb151('0x81')](_0x58333d['findBy'])){return this['channel']['error'](_0x58333d,_0xb151('0x152'));}logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x14c'),this['channel'][_0xb151('0x38')],_0x58333d[_0xb151('0x14b')]));var _0x110197=this[_0xb151('0x4b')][_0xb151('0x6c')](this,_0x58333d[_0xb151('0x160')]);var _0x59d177=this[_0xb151('0x4d')][_0xb151('0x6c')](this,_0x58333d[_0xb151('0x14b')],_0x110197);if(_0x59d177){logger[_0xb151('0x2a')](util['format'](_0xb151('0x14d'),this[_0xb151('0x34')][_0xb151('0x38')],_0x58333d[_0xb151('0x14b')]));this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x14d'),this[_0xb151('0x34')]['callerid'],_0x58333d[_0xb151('0x14b')]));return{'code':0xc8,'result':_0xb151('0x14e')};}else{logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x153'),this['channel'][_0xb151('0x38')],_0x58333d['findBy']));this[_0xb151('0x34')][_0xb151('0xaa')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xb151('0x34')][_0xb151('0x38')],_0x58333d['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xb151('0x161')]=function(_0x3015ea){logger[_0xb151('0x2a')](util['format'](_0xb151('0x162'),_0x3015ea[_0xb151('0xac')]));if(!this['isConfigured'](_0x3015ea['file_id'])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x3015ea,_0xb151('0x10a'));}var _0x5e79a8=this[_0xb151('0x1a')][_0xb151('0x6c')](this,_0x3015ea[_0xb151('0x109')]);if(!_0x5e79a8){return this['channel'][_0xb151('0x28')](_0x3015ea,_0xb151('0x10b'));}var _0xfd4d9d=this[_0xb151('0x34')]['exec'](_0xb151('0x163'),[_0x5e79a8,_0x3015ea['opts']]);if(_0xfd4d9d[_0xb151('0xa4')]===-0x1){return _0xfd4d9d;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xc4'),'PLAYBACK',_0x5e79a8));};AGIVertices['prototype']['queue']=function(_0x3eff95){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x164'),_0x3eff95[_0xb151('0xac')]));if(!this['isConfigured'](_0x3eff95[_0xb151('0x165')])){return this['channel'][_0xb151('0x28')](_0x3eff95,_0xb151('0x166'));}var _0x4659ec='';var _0x120d5a=parseInt(_0x3eff95['queue_id'],0xa);if(isNaN(_0x120d5a)){_0x4659ec=_0x3eff95[_0xb151('0x165')];}else{_0x4659ec=this[_0xb151('0x12')][_0xb151('0x6c')](this,_0x3eff95[_0xb151('0x165')]);if(!_0x4659ec){return this[_0xb151('0x34')][_0xb151('0x28')](_0x3eff95,'no\x20queue\x20found');}}var _0x5529aa='';if(this[_0xb151('0x81')](_0x3eff95[_0xb151('0x109')])){var _0x28b8e1=this['getSound'][_0xb151('0x6c')](this,_0x3eff95[_0xb151('0x109')]);if(_0x28b8e1){_0x5529aa=_0x28b8e1;}}this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x3eff95,_0x4659ec);if(_0x3eff95[_0xb151('0xe1')][_0xb151('0x167')]('x')<0x0){_0x3eff95[_0xb151('0xe1')]+='x';}if(_0x3eff95['opts'][_0xb151('0x167')]('X')<0x0){_0x3eff95[_0xb151('0xe1')]+='X';}this['channel'][_0xb151('0x9e')]('XMCS-QUEUE',_0x4659ec?_0x4659ec[_0xb151('0x168')]():'');var _0x26e360=this[_0xb151('0x34')][_0xb151('0x55')]('QUEUE',[_0x4659ec,_0x3eff95[_0xb151('0xe1')],_0x3eff95[_0xb151('0x61')],_0x5529aa,_0x3eff95['timeout'],_0x3eff95['agi'],_0x3eff95['macro'],_0x3eff95[_0xb151('0x169')],'',_0x3eff95[_0xb151('0x16a')]]);if(_0x26e360[_0xb151('0xa4')]===-0x1){return _0x26e360;}return this['channel']['noop'](util[_0xb151('0x24')](_0xb151('0xc4'),_0xb151('0x16b'),_0x4659ec));};AGIVertices['prototype'][_0xb151('0x16c')]=function(_0x1fab15){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x16d'),_0x1fab15[_0xb151('0xac')]));var _0x24229a=_0x1fab15[_0xb151('0x16e')]||'wav';var _0x2d5301=util[_0xb151('0x24')]('%s_%s',this['channel']['uniqueid'],rs['generate'](0x5));var _0x22cf08=util[_0xb151('0x24')](_0xb151('0x16f'),FILES_PATH,_0x2d5301,_0x24229a);var _0x2c2262=util[_0xb151('0x24')](_0xb151('0x128'),FILES_PATH,_0x2d5301);this['createSquareRecording'][_0xb151('0x6c')](this,_0x1fab15,_0x2d5301,_0x22cf08);this['channel'][_0xb151('0x9e')](_0xb151('0x170'),_0x2d5301);logger[_0xb151('0x2a')](_0xb151('0x171'),_0x2c2262,_0x24229a,_0x1fab15[_0xb151('0x172')],_0x1fab15[_0xb151('0x63')]);return this['channel'][_0xb151('0x132')](_0x2c2262,_0x24229a,_0x1fab15[_0xb151('0x172')],_0x1fab15['timeout'],undefined,!![]);};AGIVertices[_0xb151('0xc')][_0xb151('0x173')]=function(_0x3b6c24){logger['info'](util[_0xb151('0x24')](_0xb151('0x174'),_0x3b6c24[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x3b6c24[_0xb151('0x61')])){return this[_0xb151('0x34')][_0xb151('0xaa')]('no\x20url\x20configured');}var _0x34b3a2=this[_0xb151('0x175')][_0xb151('0x6c')](this,_0x3b6c24);logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x176'),util[_0xb151('0x177')](_0x34b3a2,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3b6c24[_0xb151('0xd5')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x178'));}var _0x4e7f37=this[_0xb151('0xd')][_0xb151('0x6c')](this,_0x3b6c24[_0xb151('0xd5')]);if(!_0x4e7f37){return this['channel'][_0xb151('0x28')](_0x3b6c24,_0xb151('0x158'));}this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')](_0xb151('0x179'),_0x4e7f37),_0x34b3a2[_0xb151('0x6f')]?_0x34b3a2['statusCode']:_0xb151('0x17a'));this[_0xb151('0x34')]['setVariable'](util[_0xb151('0x24')]('%s_STATUS_MESSAGE',_0x4e7f37),_0x34b3a2[_0xb151('0x70')]?_0x34b3a2[_0xb151('0x70')]:'OK');if(_0x34b3a2[_0xb151('0x66')]){try{this[_0xb151('0x9b')](_0x34b3a2[_0xb151('0x66')],_0x4e7f37);}catch(_0x856f0e){logger['error'](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x4e7f37));}}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('variable\x20%s\x20set',_0x4e7f37));};AGIVertices[_0xb151('0xc')]['saydigits']=function(_0x4dfe15){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x4dfe15[_0xb151('0xac')]));return this['channel'][_0xb151('0x17b')](_0x4dfe15[_0xb151('0x17c')]['replace'](/\s+/g,''),_0x4dfe15[_0xb151('0x172')]);};AGIVertices[_0xb151('0xc')]['saynumber']=function(_0x252d94){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x17d'),_0x252d94[_0xb151('0xac')]));return this['channel'][_0xb151('0x17e')](_0x252d94[_0xb151('0x64')]['replace'](/\s+/g,''),_0x252d94[_0xb151('0x172')]);};AGIVertices['prototype']['sayphonetic']=function(_0x6972e6){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x6972e6[_0xb151('0xac')]));return this[_0xb151('0x34')][_0xb151('0x17f')](_0x6972e6[_0xb151('0x5a')],_0x6972e6[_0xb151('0x172')]);};AGIVertices[_0xb151('0xc')]['sendMail']=function(_0x5336d2){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x180'),_0x5336d2[_0xb151('0xac')]));if(!this['isConfigured'](_0x5336d2[_0xb151('0x181')])){return this[_0xb151('0x34')][_0xb151('0xaa')]('no\x20mail\x20account\x20configured');}var _0x3bd127=this[_0xb151('0x1d')]['sync'](this,_0x5336d2[_0xb151('0x181')]);if(!_0x3bd127||!_0x3bd127['Smtp']){return this[_0xb151('0x34')][_0xb151('0x28')](_0x5336d2,_0xb151('0x182'));}var _0x5d16e4={'from':util[_0xb151('0x24')](_0xb151('0x183'),_0x3bd127[_0xb151('0x11')],_0x3bd127[_0xb151('0x184')]||_0x3bd127[_0xb151('0x185')][_0xb151('0x186')]),'to':_0x5336d2['to']||'','cc':_0x5336d2['cc']||'','bcc':_0x5336d2[_0xb151('0x187')]||'','subject':_0x5336d2['subject'],'html':_0x5336d2[_0xb151('0x5a')],'text':_0x5336d2['text']};if(this[_0xb151('0x81')](_0x5336d2['template_id'])){}logger[_0xb151('0xdc')](_0xb151('0x188'),JSON[_0xb151('0x9f')](_0x5d16e4));this[_0xb151('0x33')]['sync'](this,_0x5336d2,_0x5336d2[_0xb151('0x181')]);this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x189'),_0x3bd127[_0xb151('0x11')]));this['sendMailMessage'][_0xb151('0x6c')](this,_0x3bd127[_0xb151('0x18a')],_0x5d16e4);return this['channel'][_0xb151('0xaa')](_0xb151('0x18b'));};AGIVertices[_0xb151('0xc')][_0xb151('0x18c')]=function(_0x431b4a){logger['info'](util['format'](_0xb151('0x18d'),_0x431b4a[_0xb151('0xac')]));return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x18e'));};AGIVertices[_0xb151('0xc')]['sendSMS']=function(_0xe17671){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x18f'),_0xe17671[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0xe17671[_0xb151('0x190')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x191'));}var _0x12f0ae=this['getSmsAccount'][_0xb151('0x6c')](this,_0xe17671[_0xb151('0x190')]);if(!_0x12f0ae){return this['channel'][_0xb151('0x28')](_0xe17671,_0xb151('0x192'));}var _0x125bb1={'body':_0xe17671[_0xb151('0x193')],'phone':_0xe17671['to']||'','SmsAccountId':_0x12f0ae['id']};logger[_0xb151('0xdc')](_0xb151('0x194'),JSON[_0xb151('0x9f')](_0x125bb1));this[_0xb151('0x33')][_0xb151('0x6c')](this,_0xe17671,_0xe17671[_0xb151('0x190')]);this[_0xb151('0x34')][_0xb151('0xaa')](util['format'](_0xb151('0x195'),_0x12f0ae[_0xb151('0x11')]));this['createSmsMessage'][_0xb151('0x6c')](this,_0x125bb1);return this['channel'][_0xb151('0xaa')](_0xb151('0x196'));};AGIVertices[_0xb151('0xc')][_0xb151('0x197')]=function(_0x5242e3){logger['info'](util[_0xb151('0x24')](_0xb151('0x198'),_0x5242e3[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x5242e3[_0xb151('0xd5')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x5242e3,_0xb151('0x199'));}var _0x374d74=this[_0xb151('0xd')]['sync'](this,_0x5242e3[_0xb151('0xd5')]);if(!_0x374d74){return this['channel'][_0xb151('0x28')](_0x5242e3,_0xb151('0x158'));}return this['channel'][_0xb151('0x9e')](_0x374d74,_0x5242e3[_0xb151('0x19a')]);};AGIVertices[_0xb151('0xc')]['start']=function(_0x5e6bb0){logger['info'](util[_0xb151('0x24')]('Enter\x20in\x20START\x20(%s)\x20block',_0x5e6bb0[_0xb151('0xac')]));this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x19b'));if(_0x5e6bb0[_0xb151('0xb8')]===_0xb151('0x19c')){this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x19d'));return this[_0xb151('0x34')]['answer']();}return this['channel'][_0xb151('0xaa')]('Skipped\x20Answer');};AGIVertices['prototype'][_0xb151('0x19e')]=function(_0x49a619){logger[_0xb151('0x2a')](util['format'](_0xb151('0x19f'),_0x49a619[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x49a619[_0xb151('0x1a0')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x49a619,_0xb151('0x1a1'));}var _0x330d57=this[_0xb151('0x1a2')][_0xb151('0x6c')](this,_0x49a619[_0xb151('0x1a0')]);if(!this[_0xb151('0x81')](_0x330d57)){return this[_0xb151('0x34')][_0xb151('0x28')](_0x49a619,util[_0xb151('0x24')](_0xb151('0x1a3'),_0x49a619['project_id']));}if(_0x330d57===this[_0xb151('0x34')][_0xb151('0x37')]){return this[_0xb151('0x34')][_0xb151('0x28')](_0x49a619,_0xb151('0x1a4'));}this[_0xb151('0x33')]['sync'](this,_0x49a619,_0x330d57);var _0x1f15f2=this['channel'][_0xb151('0x55')](_0xb151('0x1a5'),util[_0xb151('0x24')](_0xb151('0x1a6'),config[_0xb151('0xb5')][_0xb151('0x1a7')]||_0xb151('0x1a8'),_0x330d57,this[_0xb151('0x34')]['arg_1']));if(_0x1f15f2[_0xb151('0xa4')]===-0x1){return _0x1f15f2;}return this[_0xb151('0x34')]['noop'](util[_0xb151('0x24')]('Executed\x20command\x20%s\x20%s',_0xb151('0x1a5'),_0x330d57));};AGIVertices['prototype'][_0xb151('0x1a9')]=function(_0x8322f1){logger[_0xb151('0x2a')](util['format'](_0xb151('0x1aa'),_0x8322f1['label']));var _0x577d98=this[_0xb151('0x54')]['sync'](this,_0x8322f1[_0xb151('0xb6')]);this['createSquareDetailsReport']['sync'](this,_0x8322f1,_0x8322f1[_0xb151('0xb6')]);if(this['isConfigured'](_0x8322f1[_0xb151('0xd5')])){var _0x2b2c6b=this[_0xb151('0xd')][_0xb151('0x6c')](this,_0x8322f1[_0xb151('0xd5')]);if(_0x2b2c6b){this['channel'][_0xb151('0x9e')](_0x2b2c6b,_0x577d98);return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x1ab'),_0x8322f1['command'],_0x2b2c6b));}}return this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x8322f1[_0xb151('0xb6')]));};AGIVertices[_0xb151('0xc')][_0xb151('0x1ac')]=function(_0x42c98e){logger['info'](util[_0xb151('0x24')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x42c98e[_0xb151('0xac')]));_0x42c98e[_0xb151('0x5a')]=_0x42c98e[_0xb151('0x5a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb151('0x81')](_0x42c98e[_0xb151('0x1ad')])){return this[_0xb151('0x34')]['noop'](_0xb151('0x1ae'));}if(!this[_0xb151('0x81')](_0x42c98e[_0xb151('0x5a')])){return this[_0xb151('0x34')]['noop'](_0xb151('0xab'));}this[_0xb151('0x34')][_0xb151('0xaa')](util['format'](_0xb151('0x1af'),_0x42c98e[_0xb151('0x5a')]));var _0x4a0133=this[_0xb151('0x58')]['sync'](this,_0x42c98e);if(_0x4a0133){this[_0xb151('0x34')]['noop'](util[_0xb151('0x24')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x4a0133));var _0x49083d=this[_0xb151('0x34')][_0xb151('0x11c')](_0x4a0133);try{fs['unlink'](_0x4a0133+'.wav');}catch(_0x12c558){logger['error'](_0x12c558);}return _0x49083d;}return this['channel'][_0xb151('0x28')](_0x42c98e,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x3f7294){logger[_0xb151('0x2a')](util['format'](_0xb151('0x1b0'),_0x3f7294[_0xb151('0xac')]));_0x3f7294[_0xb151('0x5a')]=_0x3f7294[_0xb151('0x5a')][_0xb151('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb151('0x81')](_0x3f7294['text'])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xab'));}this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('Trying\x20Google\x20TTS\x20%s',_0x3f7294[_0xb151('0x5a')]));var _0x52076c=this[_0xb151('0x60')][_0xb151('0x6c')](this,_0x3f7294);if(_0x52076c){this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x1b1'),_0x52076c));var _0x17e420=this['channel'][_0xb151('0x11c')](_0x52076c);try{fs[_0xb151('0x1b2')](_0x52076c+_0xb151('0x11d'));}catch(_0x1eb233){logger[_0xb151('0x28')](_0x1eb233);}return _0x17e420;}return this[_0xb151('0x34')]['error'](_0x3f7294,_0xb151('0x1b3'));};AGIVertices[_0xb151('0xc')][_0xb151('0x1b4')]=function(_0x19b2c8){logger[_0xb151('0x2a')](util['format'](_0xb151('0x1b5'),_0x19b2c8[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x19b2c8[_0xb151('0x14b')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x19b2c8,_0xb151('0x152'));}logger['info'](util[_0xb151('0x24')](_0xb151('0x14c'),this[_0xb151('0x34')]['callerid'],_0x19b2c8['findBy']));var _0xb2e367=this[_0xb151('0x4f')][_0xb151('0x6c')](this,_0x19b2c8[_0xb151('0x14b')]);if(_0xb2e367){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x14d'),this['channel'][_0xb151('0x38')],_0x19b2c8[_0xb151('0x14b')]));this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x14d'),this[_0xb151('0x34')]['callerid'],_0x19b2c8[_0xb151('0x14b')]));return{'code':0xc8,'result':'success'};}else{logger[_0xb151('0x2a')](util['format'](_0xb151('0x153'),this[_0xb151('0x34')][_0xb151('0x38')],_0x19b2c8[_0xb151('0x14b')]));this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x153'),this[_0xb151('0x34')]['callerid'],_0x19b2c8[_0xb151('0x14b')]));return{'code':0xc8,'result':_0xb151('0x14f')};}};AGIVertices[_0xb151('0xc')][_0xb151('0x1b6')]=function(_0x430990){logger[_0xb151('0x2a')](util['format'](_0xb151('0x1b7'),_0x430990['label']));var _0x1d3903=this['channel'][_0xb151('0x55')](_0xb151('0x1b8'),[_0x430990[_0xb151('0x1b9')],_0x430990['options']]);if(_0x1d3903[_0xb151('0xa4')]===-0x1){return _0x1d3903;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xc4'),_0xb151('0x1b8'),_0x430990[_0xb151('0x1b9')]));};AGIVertices['prototype'][_0xb151('0x1ba')]=function(_0xd37eb1){logger['info'](util[_0xb151('0x24')](_0xb151('0x1bb'),_0xd37eb1['label']));if(!this[_0xb151('0x81')](_0xd37eb1['variable_id'])){return this[_0xb151('0x34')][_0xb151('0x28')](_0xd37eb1,_0xb151('0x199'));}var _0x12bc9f=this['getVariable'][_0xb151('0x6c')](this,_0xd37eb1[_0xb151('0xd5')]);if(!_0x12bc9f){return this[_0xb151('0x34')]['error'](_0xd37eb1,_0xb151('0x158'));}var _0x231684=this['channel'][_0xb151('0xd')](_0x12bc9f);return{'code':0xc8,'result':_0x231684[_0xb151('0xa2')]?_0x231684[_0xb151('0xa2')]:'-'};};String[_0xb151('0xc')]['replaceAll']=function(_0x2071cf,_0x1589df){return this[_0xb151('0xa0')](_0x2071cf)[_0xb151('0x1bc')](_0x1589df);};module[_0xb151('0x1bd')]=AGIVertices; \ No newline at end of file +var _0xa7b5=['restAPI','method','timeout','includes','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','url','headers','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','agicommand','clone','isString','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','saveRestApiResult','%s.%s','replaceObjectAllVariables','split','replaceAll','getVariable','extra','result','info','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','add','delay','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','createSquareDetailsReport','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','wav','%s/recordings/%s','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','NOBEEP','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','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','agentLogout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','output','getPause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','agi','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','smtpOptions','SENDFAX\x20block\x20not\x20implemented','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','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','../../config/environment/shared','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariableById','name','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','catch','getSquareOdbc','getSquareOdbcById','then','getUser','getUserById','getTrunk','getSoundPath','save_name','getMailAccountById','sendMailMessage','mailRpc','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','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','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','callback_','lastName','phone','scheduledAt','toString','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogin','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','audioEncoding','MP3','google_tts_language'];(function(_0x6d5dac,_0x1235dc){var _0x5ca86d=function(_0x55b3dc){while(--_0x55b3dc){_0x6d5dac['push'](_0x6d5dac['shift']());}};_0x5ca86d(++_0x1235dc);}(_0xa7b5,0x162));var _0x5a7b=function(_0x499ad2,_0x30c092){_0x499ad2=_0x499ad2-0x0;var _0x58f6be=_0xa7b5[_0x499ad2];return _0x58f6be;};'use strict';var fs=require('fs');var util=require(_0x5a7b('0x0'));var _=require(_0x5a7b('0x1'));var sh=require(_0x5a7b('0x2'));var odbc=require(_0x5a7b('0x3'))();var rs=require(_0x5a7b('0x4'));var moment=require('moment');var Mustache=require(_0x5a7b('0x5'));var rp=require(_0x5a7b('0x6'));var logger=require(_0x5a7b('0x7'))('agi');var config=require('../../config/environment');var shared=require(_0x5a7b('0x8'));var scripts=require(_0x5a7b('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x5a7b('0xa'),_0x5a7b('0xb')];var verticesWithRetry=[_0x5a7b('0xc'),_0x5a7b('0xd'),_0x5a7b('0xe')];var AGIVertices=function(_0x5c281b,_0x21a69c,_0x59b6df){this[_0x5a7b('0xf')]=_0x5c281b;this[_0x5a7b('0x10')]=_0x21a69c;this['mailRpc']=_0x59b6df;};AGIVertices[_0x5a7b('0x11')]['getVariable']=function(_0x31d60c,_0x238f76){this[_0x5a7b('0x10')][_0x5a7b('0x12')](_0x31d60c)['then'](function(_0x4d3c4d){_0x238f76(null,_0x4d3c4d?_0x4d3c4d[_0x5a7b('0x13')]:![]);})['catch'](function(_0x5f263c){_0x238f76(_0x5f263c);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x14')]=function(_0x5088a5,_0xda652d){this[_0x5a7b('0x10')][_0x5a7b('0x15')](_0x5088a5)['then'](function(_0x5081){_0xda652d(null,_0x5081?_0x5081[_0x5a7b('0x13')]:![]);})['catch'](function(_0x31fb21){_0xda652d(_0x31fb21);});};AGIVertices['prototype'][_0x5a7b('0x16')]=function(_0x5039dc,_0x34804c){this[_0x5a7b('0x10')][_0x5a7b('0x17')](_0x5039dc)['then'](function(_0xe59f65){_0x34804c(null,_0xe59f65?_0xe59f65[_0x5a7b('0x13')]:![]);})[_0x5a7b('0x18')](function(_0x47ce0f){_0x34804c(_0x47ce0f);});};AGIVertices['prototype'][_0x5a7b('0x19')]=function(_0x5c711c,_0x23583a){this['rpc'][_0x5a7b('0x1a')](_0x5c711c)[_0x5a7b('0x1b')](function(_0x2ea965){_0x23583a(null,_0x2ea965?_0x2ea965['dsn']:![]);})[_0x5a7b('0x18')](function(_0x458511){_0x23583a(_0x458511);});};AGIVertices['prototype'][_0x5a7b('0x1c')]=function(_0x1ae7f1,_0x57ebf9){this[_0x5a7b('0x10')][_0x5a7b('0x1d')](_0x1ae7f1)['then'](function(_0x59fa7f){_0x57ebf9(null,_0x59fa7f?_0x59fa7f[_0x5a7b('0x13')]:![]);})[_0x5a7b('0x18')](function(_0x54d4f8){_0x57ebf9(_0x54d4f8);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x1e')]=function(_0x16b89,_0x300ae9){this['rpc']['getTrunkById'](_0x16b89)[_0x5a7b('0x1b')](function(_0x262cdc){_0x300ae9(null,_0x262cdc?_0x262cdc[_0x5a7b('0x13')]:![]);})[_0x5a7b('0x18')](function(_0x48ee7e){_0x300ae9(_0x48ee7e);});};AGIVertices[_0x5a7b('0x11')]['getSound']=function(_0x63d8eb,_0x3531cf){var _0x3d505f=this;this[_0x5a7b('0x10')]['getSoundById'](_0x63d8eb)[_0x5a7b('0x1b')](function(_0x1147c0){_0x3531cf(null,_0x1147c0?_0x3d505f[_0x5a7b('0x1f')](_0x1147c0[_0x5a7b('0x20')]):![]);})[_0x5a7b('0x18')](function(_0x5dd6b9){_0x3531cf(_0x5dd6b9);});};AGIVertices[_0x5a7b('0x11')]['getMailAccount']=function(_0x4bdf52,_0x517499){this['rpc'][_0x5a7b('0x21')](_0x4bdf52)[_0x5a7b('0x1b')](function(_0x564afa){_0x517499(null,_0x564afa?_0x564afa:![]);})['catch'](function(_0x3d7400){_0x517499(_0x3d7400);});};AGIVertices['prototype'][_0x5a7b('0x22')]=function(_0x2f78d7,_0x53ecc6,_0x44c988){this[_0x5a7b('0x23')][_0x5a7b('0x22')](_0x2f78d7,_0x53ecc6)[_0x5a7b('0x1b')](function(){_0x44c988(null);})[_0x5a7b('0x18')](function(_0x5e6a6f){_0x44c988(_0x5e6a6f);});};AGIVertices[_0x5a7b('0x11')]['getIntervals']=function(_0x77f4ba,_0x51d729){this[_0x5a7b('0x10')]['getIntervalById'](_0x77f4ba)[_0x5a7b('0x1b')](function(_0xb8cb94){if(_0xb8cb94){if(_0xb8cb94[_0x5a7b('0x24')]){_0x51d729(null,[_0xb8cb94[_0x5a7b('0x25')]]);}else{_0x51d729(null,_[_0x5a7b('0x26')](_0xb8cb94[_0x5a7b('0x27')],'interval'));}}else{_0x51d729(null,![]);}})[_0x5a7b('0x18')](function(_0x165420){_0x51d729(_0x165420);});};AGIVertices[_0x5a7b('0x11')]['getSoundPath']=function(_0xa12ce2){return util['format'](_0x5a7b('0x28'),FILES_PATH,_0xa12ce2);};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x29')]=function(_0x2f6ab7,_0x3e5055,_0x375cf7){odbc[_0x5a7b('0x2a')](_0x2f6ab7,function(_0x225dec){if(_0x225dec){logger[_0x5a7b('0x2b')](_0x5a7b('0x2c'),_0x225dec);_0x375cf7(_0x225dec);}else{logger['info'](_0x5a7b('0x2d'));odbc[_0x5a7b('0x2e')](_0x3e5055,function(_0x161bde,_0x38056f){if(_0x161bde){logger['info'](_0x5a7b('0x2f'),_0x3e5055);_0x375cf7(_0x161bde);}else{logger['info'](_0x5a7b('0x30'),_0x3e5055);odbc[_0x5a7b('0x31')](function(_0x56397c){if(_0x56397c){logger['error'](_0x5a7b('0x32'),_0x56397c);}_0x375cf7(null,_0x38056f);});}});}});};AGIVertices['prototype'][_0x5a7b('0x33')]=function(_0x1b1b8a,_0x3ecf62){this[_0x5a7b('0x10')][_0x5a7b('0x34')](_0x1b1b8a)['then'](function(_0x5b53e3){_0x3ecf62(null,_0x5b53e3?_0x5b53e3:![]);})[_0x5a7b('0x18')](function(_0x3ecff8){_0x3ecf62(_0x3ecff8);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x35')]=function(_0x2d9186,_0x4944a6){this[_0x5a7b('0x10')]['createSmsMessage'](_0x2d9186)['then'](function(_0x2fa44e){_0x4944a6(null,_0x2fa44e);})[_0x5a7b('0x18')](function(_0x30676e){_0x4944a6(_0x30676e);});};AGIVertices[_0x5a7b('0x11')]['createSquareDetailsReport']=function(_0x41e3a5,_0x127064,_0x2a8516){this[_0x5a7b('0x10')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0x5a7b('0x36')],'node':_0x41e3a5[_0x5a7b('0x37')],'application':_0x41e3a5['agicommand'],'data':_0x127064||null,'project_name':this[_0x5a7b('0xf')][_0x5a7b('0x38')],'callerid':this['channel'][_0x5a7b('0x39')]})[_0x5a7b('0x1b')](function(_0x5a9953){if(_0x2a8516){_0x2a8516(null,_0x5a9953);}})[_0x5a7b('0x18')](function(_0x4d6754){if(_0x2a8516){_0x2a8516(_0x4d6754);}});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x3a')]=function(_0x11e81b,_0x504496,_0x503533,_0x5bcd19){this['rpc']['createSquareRecording']({'uniqueid':this['channel'][_0x5a7b('0x36')],'callerid':this[_0x5a7b('0xf')][_0x5a7b('0x39')],'calleridname':this[_0x5a7b('0xf')][_0x5a7b('0x3b')],'context':this['channel'][_0x5a7b('0x3c')],'extension':this[_0x5a7b('0xf')][_0x5a7b('0x3d')],'priority':this[_0x5a7b('0xf')][_0x5a7b('0x3e')],'accountcode':this[_0x5a7b('0xf')][_0x5a7b('0x3f')],'dnid':this['channel'][_0x5a7b('0x40')],'projectName':this[_0x5a7b('0xf')][_0x5a7b('0x38')],'saveName':_0x504496,'filename':_0x11e81b['file']||_0x504496,'savePath':_0x503533})[_0x5a7b('0x1b')](function(_0x324ab3){_0x5bcd19(null,_0x324ab3);})['catch'](function(_0x4a1edc){_0x5bcd19(_0x4a1edc);});};AGIVertices['prototype'][_0x5a7b('0x41')]=function(_0x41231d,_0x390ff0,_0x57d6c6,_0x4d6d40,_0x211dc4){this['rpc'][_0x5a7b('0x41')]({'uniqueid':this[_0x5a7b('0xf')][_0x5a7b('0x36')],'body':_0x41231d,'direction':_0x390ff0,'providerName':_0x57d6c6,'providerResponse':_0x4d6d40})[_0x5a7b('0x1b')](function(_0x7837fd){if(_0x211dc4){_0x211dc4(null,_0x7837fd);}})[_0x5a7b('0x18')](function(_0x3b4f24){if(_0x211dc4){_0x211dc4(_0x3b4f24);}});};AGIVertices[_0x5a7b('0x11')]['createCmContact']=function(_0x2d1d3c,_0x837524){this['rpc'][_0x5a7b('0x42')]({'firstName':_[_0x5a7b('0x43')](_0x2d1d3c[_0x5a7b('0x13')])||_['isNil'](_0x2d1d3c[_0x5a7b('0x13')])?_0x5a7b('0x44')+Math['random']():_0x2d1d3c[_0x5a7b('0x13')],'lastName':_[_0x5a7b('0x43')](_0x2d1d3c['lastName'])||_['isNil'](_0x2d1d3c[_0x5a7b('0x45')])?null:_0x2d1d3c[_0x5a7b('0x45')],'phone':_0x2d1d3c[_0x5a7b('0x46')],'ListId':_0x2d1d3c['list_id'],'scheduledat':_0x2d1d3c[_0x5a7b('0x47')],'callbackUniqueid':this['channel']['uniqueid'],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x2d1d3c[_0x5a7b('0x47')][_0x5a7b('0x48')](),'priority':_0x2d1d3c['callback_priority']})[_0x5a7b('0x1b')](function(_0x23fd0b){_0x837524(null,_0x23fd0b);})[_0x5a7b('0x18')](function(_0x5b1441){_0x837524(_0x5b1441);});};AGIVertices['prototype']['getPause']=function(_0x261d7c,_0x3aaae6){this['rpc'][_0x5a7b('0x49')](_0x261d7c)['then'](function(_0x16391f){_0x3aaae6(null,_0x16391f?_0x16391f[_0x5a7b('0x13')]:![]);})['catch'](function(_0x49bb22){_0x3aaae6(_0x49bb22);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x4a')]=function(_0x1fbe4e,_0x46aa17,_0x71bc6c){var _0x5ab3a7={'role':_0x5a7b('0x4b')};_0x5ab3a7[_0x1fbe4e]=this[_0x5a7b('0xf')][_0x5a7b('0x39')];this['rpc']['agentPause'](_0x5ab3a7,_0x46aa17,this[_0x5a7b('0xf')][_0x5a7b('0x36')])['then'](function(_0x59da48){_0x71bc6c(null,_[_0x5a7b('0x4c')](_0x59da48)?![]:!![]);})[_0x5a7b('0x18')](function(_0x271e6f){logger['error'](_0x271e6f);_0x71bc6c(null,![]);});};AGIVertices['prototype'][_0x5a7b('0x4d')]=function(_0x3c61fa,_0x546b9e){var _0x490da5={'role':'agent'};_0x490da5[_0x3c61fa]=this[_0x5a7b('0xf')]['callerid'];this['rpc'][_0x5a7b('0x4d')](_0x490da5)[_0x5a7b('0x1b')](function(_0x9aa727){_0x546b9e(null,_['isNil'](_0x9aa727)?![]:!![]);})[_0x5a7b('0x18')](function(_0x120a91){logger['error'](_0x120a91);_0x546b9e(null,![]);});};AGIVertices[_0x5a7b('0x11')]['agentLogout']=function(_0x3c4ab1,_0x5bdcb6){var _0x3f57d9={'role':_0x5a7b('0x4b')};_0x3f57d9[_0x3c4ab1]=this[_0x5a7b('0xf')][_0x5a7b('0x39')];this['rpc']['agentLogout'](_0x3f57d9)['then'](function(_0x3f1a1e){_0x5bdcb6(null,_[_0x5a7b('0x4c')](_0x3f1a1e)?![]:!![]);})[_0x5a7b('0x18')](function(_0x576df0){logger[_0x5a7b('0x2b')](_0x576df0);_0x5bdcb6(null,![]);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x4e')]=function(_0x5d34a8,_0x4191f4){var _0x1b2b0c={'role':'agent'};_0x1b2b0c[_0x5d34a8]=this[_0x5a7b('0xf')][_0x5a7b('0x39')];var _0xbd5467=_0x5d34a8!='internal'?util[_0x5a7b('0x4f')](_0x5a7b('0x50'),_0x5a7b('0x51'),this[_0x5a7b('0xf')][_0x5a7b('0x39')]):undefined;this[_0x5a7b('0x10')]['agentLogin'](_0x1b2b0c,_0xbd5467)[_0x5a7b('0x1b')](function(_0x7897d2){_0x4191f4(null,_[_0x5a7b('0x4c')](_0x7897d2)?![]:!![]);})['catch'](function(_0x487b5c){logger[_0x5a7b('0x2b')](_0x487b5c);_0x4191f4(null,![]);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x52')]=function(_0x17a656,_0x2ce9ea){sh[_0x5a7b('0x53')](_[_0x5a7b('0x54')](_0x17a656),function(_0x15537f,_0x24f8f4){var _0x225802=_0x24f8f4['replace'](/(\r\n|\n|\r)/gm,'');_0x2ce9ea(null,_0x225802);});};AGIVertices['prototype'][_0x5a7b('0x55')]=function(_0x4f2582,_0x1c1752){scripts[_0x5a7b('0x55')](_0x4f2582[_0x5a7b('0x56')],_0x4f2582[_0x5a7b('0x57')]||_0x5a7b('0x58'),_0x4f2582[_0x5a7b('0x58')],_0x4f2582['languageCode']||_0x5a7b('0x59'),_0x4f2582[_0x5a7b('0x5a')]||'MALE',_0x4f2582[_0x5a7b('0x5b')]||_0x5a7b('0x5c'))[_0x5a7b('0x1b')](function(_0x524d4b){_0x1c1752(null,_0x524d4b);})['catch'](function(_0x5ed990){_0x1c1752(_0x5ed990);});};AGIVertices[_0x5a7b('0x11')]['googleTTS']=function(_0x408105,_0x329923){scripts['googleTTS'](_0x408105['text'],_0x408105[_0x5a7b('0x5d')]||'en',0x1)[_0x5a7b('0x1b')](function(_0x36cd15){_0x329923(null,_0x36cd15);})[_0x5a7b('0x18')](function(_0x1c435d){_0x329923(_0x1c435d);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x5e')]=function(_0x456222,_0x439f40){var _0x18c2ff={'uri':_0x456222['url'],'method':_0x456222[_0x5a7b('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x456222[_0x5a7b('0x60')])==='number'&&parseInt(_0x456222[_0x5a7b('0x60')])>=0x1?parseInt(_0x456222[_0x5a7b('0x60')])*0x3e8:0x5*0x3e8};if(_[_0x5a7b('0x61')]([_0x5a7b('0x62'),_0x5a7b('0x63')],_0x18c2ff[_0x5a7b('0x5f')][_0x5a7b('0x64')]())){try{_0x18c2ff['body']=_0x456222[_0x5a7b('0xb')]?JSON[_0x5a7b('0x65')](_0x456222['rawBody']):{};}catch(_0x5c74f7){logger['error'](_0x5a7b('0x66'),_0x5c74f7);}}try{_0x18c2ff['headers']=_0x456222[_0x5a7b('0xa')]?JSON[_0x5a7b('0x65')](_0x456222['rawHeaders']):{};}catch(_0x20e86a){logger['error'](_0x5a7b('0x67'),_0x20e86a);}if(_0x456222[_0x5a7b('0x68')]){try{var _0x16cfaf=require(_0x456222[_0x5a7b('0x68')])[_0x5a7b('0x69')](this,_0x18c2ff);_0x18c2ff['uri']=Mustache['render'](_0x456222[_0x5a7b('0x6a')],_0x16cfaf,{},['$$','$$']);if(_0x18c2ff[_0x5a7b('0x6b')]){_0x18c2ff[_0x5a7b('0x6b')]=JSON[_0x5a7b('0x65')](Mustache[_0x5a7b('0x6c')](JSON[_0x5a7b('0x6d')](_0x18c2ff[_0x5a7b('0x6b')]),_0x16cfaf,{},['$$','$$']));}if(_0x18c2ff['body']){_0x18c2ff[_0x5a7b('0x6e')]=JSON[_0x5a7b('0x65')](Mustache[_0x5a7b('0x6c')](JSON[_0x5a7b('0x6d')](_0x18c2ff[_0x5a7b('0x6e')]),_0x16cfaf,{},['$$','$$']));}}catch(_0x4e6998){logger[_0x5a7b('0x2b')](_0x5a7b('0x6f'),_0x4e6998);}}rp(_0x18c2ff)[_0x5a7b('0x1b')](function(_0x13e640){var _0x41c54e={'statusCode':_0x13e640[_0x5a7b('0x70')]||0xc8,'statusMessage':_0x13e640['statusMessage']||'OK','headers':_0x13e640[_0x5a7b('0x6b')]||{},'body':_0x13e640[_0x5a7b('0x6e')]||{}};_0x439f40(null,_0x41c54e);})['catch'](function(_0x5ea2be){var _0x5435fa={'statusCode':_0x5ea2be[_0x5a7b('0x70')]||0x1f4,'statusMessage':_0x5ea2be[_0x5a7b('0x71')]||_0x5a7b('0x72'),'headers':_0x5ea2be['options'][_0x5a7b('0x6b')]||{},'body':_0x5ea2be[_0x5a7b('0x73')]['body']||{}};_0x439f40(null,_0x5435fa);});};AGIVertices[_0x5a7b('0x11')]['googleDialogflow']=function(_0xaf82e2,_0x47c8ed){scripts[_0x5a7b('0x74')](this[_0x5a7b('0xf')][_0x5a7b('0x36')],_0xaf82e2[_0x5a7b('0x75')],_0xaf82e2['text'],_0xaf82e2[_0x5a7b('0x76')]||'en')['then'](function(_0x5395f9){_0x47c8ed(null,_0x5395f9);})[_0x5a7b('0x18')](function(_0x23fb30){_0x47c8ed(_0x23fb30);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x77')]=function(_0x2b3dba,_0x3fe1fe){scripts[_0x5a7b('0x77')](this[_0x5a7b('0xf')][_0x5a7b('0x36')],_0x2b3dba['dialogflowV2_project_id'],_0x2b3dba[_0x5a7b('0x78')],_0x2b3dba['private_key'],_0x2b3dba['text'],_0x2b3dba[_0x5a7b('0x79')]||'en')[_0x5a7b('0x1b')](function(_0x15fb80){_0x3fe1fe(null,_0x15fb80);})[_0x5a7b('0x18')](function(_0x41b8ba){_0x3fe1fe(_0x41b8ba);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x7a')]=function(_0x27b87f,_0x2a46fc){scripts[_0x5a7b('0x7a')](this[_0x5a7b('0xf')],_0x27b87f)['then'](function(_0x112ce0){_0x2a46fc(null,_0x112ce0);})[_0x5a7b('0x18')](function(_0x53b02a){_0x2a46fc(_0x53b02a);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x7b')]=function(_0xb1da68,_0x3c0a46){scripts['ispeechTTS'](_0xb1da68[_0x5a7b('0x75')],_0xb1da68[_0x5a7b('0x58')],_0xb1da68[_0x5a7b('0x7c')]||'en-US',_0xb1da68[_0x5a7b('0x7d')])[_0x5a7b('0x1b')](function(_0xeee31){_0x3c0a46(null,_0xeee31);})[_0x5a7b('0x18')](function(_0x41d3f6){_0x3c0a46(_0x41d3f6);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x7e')]=function(_0x4d18ef,_0x5037c2,_0x146764){scripts[_0x5a7b('0x7e')](_0x5037c2,_0x4d18ef['key'],_0x4d18ef['ispeech_asr_language']||_0x5a7b('0x59'),this['isConfigured'](_0x4d18ef[_0x5a7b('0x7f')])?_0x4d18ef[_0x5a7b('0x7f')]:undefined)[_0x5a7b('0x1b')](function(_0x5ebeea){_0x146764(null,_0x5ebeea);})[_0x5a7b('0x18')](function(_0x197d96){_0x146764(_0x197d96);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x80')]=function(_0x3894a2,_0xafa71c){scripts['awsPolly'](_0x3894a2['aws_access_key_id'],_0x3894a2[_0x5a7b('0x81')],_0x3894a2[_0x5a7b('0x82')],_0x3894a2[_0x5a7b('0x83')]||_0x5a7b('0x84'),_0x3894a2[_0x5a7b('0x58')],_0x3894a2[_0x5a7b('0x85')]||'text')['then'](function(_0x3627a3){_0xafa71c(null,_0x3627a3);})[_0x5a7b('0x18')](function(_0x52c404){_0xafa71c(_0x52c404);});};AGIVertices['prototype'][_0x5a7b('0x86')]=function(_0x1910ed,_0x24aa7c){scripts['awsLex'](this[_0x5a7b('0xf')]['uniqueid'],_0x1910ed[_0x5a7b('0x87')],_0x1910ed[_0x5a7b('0x81')],_0x1910ed['aws_lex_region'],_0x1910ed['text'],_0x1910ed[_0x5a7b('0x88')])[_0x5a7b('0x1b')](function(_0x9c3f78){_0x24aa7c(null,_0x9c3f78);})[_0x5a7b('0x18')](function(_0x20dadd){_0x24aa7c(_0x20dadd);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x89')]=function(_0x3febfd,_0xb58bd9,_0x2ae4ff){scripts[_0x5a7b('0x89')](_0xb58bd9,_0x3febfd[_0x5a7b('0x75')],_0x3febfd[_0x5a7b('0x8a')]||'en-US')[_0x5a7b('0x1b')](function(_0x341b6d){_0x2ae4ff(null,_0x341b6d);})[_0x5a7b('0x18')](function(_0x1a181a){_0x2ae4ff(_0x1a181a);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x8b')]=function(_0x397625,_0xb14a0a,_0x58bf1b){scripts['tildeASR'](_0xb14a0a,_0x397625[_0x5a7b('0x8c')],_0x397625[_0x5a7b('0x8d')],_0x397625[_0x5a7b('0x8e')])['then'](function(_0x68aca6){_0x58bf1b(null,_0x68aca6);})[_0x5a7b('0x18')](function(_0x473d63){_0x58bf1b(_0x473d63);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x8f')]=function(_0x3f303d){var _0x5d8c36=_[_0x5a7b('0x61')](verticesWithRetry,_0x3f303d[_0x5a7b('0x90')])?_0x3f303d:_[_0x5a7b('0x91')](_0x3f303d);for(var _0x466f21 in _0x5d8c36){if(_0x5d8c36['hasOwnProperty'](_0x466f21)){if(_0x5d8c36[_0x466f21]&&_[_0x5a7b('0x92')](_0x5d8c36[_0x466f21])){if(_[_0x5a7b('0x61')](recursiveMapAttributes,_0x466f21)){_0x5d8c36[_0x466f21]=this['replaceObjectAllVariables'](_0x5d8c36[_0x466f21]);}else{_0x5d8c36[_0x466f21]=this[_0x5a7b('0x93')](_0x5d8c36[_0x466f21]);}}}}return _0x5d8c36;};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x94')]=function(_0x426cc2){for(var _0x964caf in _0x426cc2){if(_0x426cc2[_0x5a7b('0x95')](_0x964caf)){if(_[_0x5a7b('0x96')](_0x426cc2[_0x964caf])){this[_0x5a7b('0x94')](_0x426cc2[_0x964caf]);}else if(_[_0x5a7b('0x97')](_0x426cc2[_0x964caf])){for(var _0x571ee2=0x0;_0x571ee2<_0x426cc2[_0x964caf][_0x5a7b('0x98')];_0x571ee2++){this[_0x5a7b('0x94')](_0x426cc2[_0x964caf][_0x571ee2]);}}else if(_[_0x5a7b('0x92')](_0x426cc2[_0x964caf])){_0x426cc2[_0x964caf]=this[_0x5a7b('0x93')](_0x426cc2[_0x964caf]);}}}};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x99')]=function(_0x442fe5,_0x5157af){for(var _0x4b6634 in _0x442fe5){if(_0x442fe5[_0x5a7b('0x95')](_0x4b6634)){if(_[_0x5a7b('0x96')](_0x442fe5[_0x4b6634])){if(!_[_0x5a7b('0x43')](_0x442fe5[_0x4b6634])){this[_0x5a7b('0x99')](_0x442fe5[_0x4b6634],util['format'](_0x5a7b('0x9a'),_0x5157af,_0x4b6634));}}else if(_[_0x5a7b('0x97')](_0x442fe5[_0x4b6634])){for(var _0x2ad7f2=0x0;_0x2ad7f2<_0x442fe5[_0x4b6634]['length'];_0x2ad7f2++){this[_0x5a7b('0x99')](_0x442fe5[_0x4b6634][_0x2ad7f2],util[_0x5a7b('0x4f')](_0x5a7b('0x9a'),_0x5157af,_0x4b6634+'['+_0x2ad7f2+']'));}}else{if(!_['isNil'](_0x442fe5[_0x4b6634])){this[_0x5a7b('0xf')]['setVariable'](util[_0x5a7b('0x4f')](_0x5a7b('0x9a'),_0x5157af,_0x4b6634),_0x442fe5[_0x4b6634]);}}}}};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x9b')]=function(_0x3747b3){try{var _0x5a8ede=JSON[_0x5a7b('0x65')](_0x3747b3);this[_0x5a7b('0x94')](_0x5a8ede);return JSON['stringify'](_0x5a8ede);}catch(_0x368652){return this[_0x5a7b('0x93')](_0x3747b3);}};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x93')]=function(_0x1bf803){var _0x3cecaa=_0x1bf803[_0x5a7b('0x9c')]('{');for(var _0x124239=0x1;_0x124239<_0x3cecaa[_0x5a7b('0x98')];_0x124239+=0x1){var _0x2b1475=_0x3cecaa[_0x124239][_0x5a7b('0x9c')]('}');if(_0x2b1475['length']>0x1){_0x1bf803=_0x1bf803[_0x5a7b('0x9d')]('{'+_0x2b1475[0x0]+'}',this[_0x5a7b('0xf')][_0x5a7b('0x9e')](_0x2b1475[0x0])[_0x5a7b('0x9f')]||_0x2b1475[0x0]);}}if(_0x3cecaa[_0x5a7b('0x98')]===0x1){return _0x1bf803[_0x5a7b('0x48')]();}return this[_0x5a7b('0x93')](_0x1bf803);};AGIVertices['prototype']['getAndSetVariable']=function(_0x3bc9ed,_0x50d145){var _0x331d9f=this[_0x5a7b('0xf')][_0x5a7b('0x9e')](_0x3bc9ed);if(_0x331d9f[_0x5a7b('0xa0')]===-0x1){return _0x331d9f;}logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0xa2'),_0x50d145,_0x331d9f[_0x5a7b('0x9f')]));return this[_0x5a7b('0xf')][_0x5a7b('0xa3')](_0x50d145,_0x331d9f['extra']);};AGIVertices[_0x5a7b('0x11')]['isConfigured']=function(_0x45cdd5){return _0x45cdd5&&_0x45cdd5!=='0'&&_0x45cdd5!=='-1'&&_0x45cdd5!=='';};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xa4')]=function(_0x9f88da){this['createSquareDetailsReport'][_0x5a7b('0x69')](this,_0x9f88da,'-');_0x9f88da[_0x5a7b('0xa5')]=_0x9f88da[_0x5a7b('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xa6')]=function(_0x8e4285){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0xa7'),_0x8e4285[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x8e4285['text'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20text\x20configured');}var _0xa299c1='\x22'+_0x8e4285[_0x5a7b('0x58')]+'\x22';if(this[_0x5a7b('0xa8')](_0x8e4285[_0x5a7b('0x73')])){_0xa299c1+=','+_0x8e4285[_0x5a7b('0x73')];}var _0x12a368=this[_0x5a7b('0xf')][_0x5a7b('0x53')]('MRCPSynth',_0xa299c1);if(_0x12a368[_0x5a7b('0xa0')]===-0x1){return _0x12a368;}return this['channel'][_0x5a7b('0xa9')](util['format'](_0x5a7b('0xaa'),_0xa299c1));};AGIVertices[_0x5a7b('0x11')]['mrcprecog']=function(_0x4671d3){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4671d3[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x4671d3[_0x5a7b('0xab')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xac'));}var _0x4c3230=_0x4671d3[_0x5a7b('0xab')];if(this[_0x5a7b('0xa8')](_0x4671d3[_0x5a7b('0x73')])){_0x4c3230+=','+_0x4671d3[_0x5a7b('0x73')];}var _0x1b9256=this[_0x5a7b('0xf')][_0x5a7b('0x53')](_0x5a7b('0xad'),_0x4c3230);if(_0x1b9256[_0x5a7b('0xa0')]===-0x1){return _0x1b9256;}var _0x5314de=this[_0x5a7b('0xae')](_0x5a7b('0xaf'),_0x5a7b('0xb0'));if(_0x5314de['result']===-0x1){return _0x5314de;}var _0x355edf=this[_0x5a7b('0xae')](_0x5a7b('0xb1'),_0x5a7b('0xb2'));if(_0x355edf[_0x5a7b('0xa0')]===-0x1){return _0x355edf;}var _0x6946e0=this['getAndSetVariable'](_0x5a7b('0xb3'),_0x5a7b('0xb4'));if(_0x6946e0[_0x5a7b('0xa0')]===-0x1){return _0x6946e0;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format'](_0x5a7b('0xb5'),_0x4c3230));};AGIVertices[_0x5a7b('0x11')]['agi']=function(_0x4d6981){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0xb6'),_0x4d6981[_0x5a7b('0x37')]));return this[_0x5a7b('0xf')]['agi']([_0x4d6981[_0x5a7b('0xb7')],_0x4d6981['args']]);};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xb8')]=function(_0x156c96){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0xb9'),_0x156c96[_0x5a7b('0x37')]));if(this[_0x5a7b('0xa8')](_0x156c96[_0x5a7b('0x60')])){logger['info'](util[_0x5a7b('0x4f')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x156c96[_0x5a7b('0x60')]));var _0x49a5ab=this[_0x5a7b('0xf')][_0x5a7b('0xba')](_0x156c96['timeout']);if(_0x49a5ab['result']===-0x1){return _0x49a5ab;}}return this[_0x5a7b('0xf')]['answer']();};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xbb')]=function(_0x1f4a0d){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0xbc'),_0x1f4a0d[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x1f4a0d[_0x5a7b('0xbd')])){return this[_0x5a7b('0xf')]['error'](_0x1f4a0d,_0x5a7b('0xbe'));}_0x1f4a0d[_0x5a7b('0x47')]=moment();if(this[_0x5a7b('0xa8')](_0x1f4a0d['delay'])){_0x1f4a0d[_0x5a7b('0x47')]=moment()[_0x5a7b('0xbf')](_0x1f4a0d[_0x5a7b('0xc0')],'minutes');}if(!this['isConfigured'](_0x1f4a0d['callback_priority'])){_0x1f4a0d['callback_priority']=0x2;}this['createCmContact'][_0x5a7b('0x69')](this,_0x1f4a0d);return this['channel']['noop'](util[_0x5a7b('0x4f')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1f4a0d[_0x5a7b('0x46')],_0x1f4a0d['list_id'],_0x1f4a0d[_0x5a7b('0x47')]));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xc1')]=function(_0x386d5d){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0xc2'),_0x386d5d[_0x5a7b('0x37')]));var _0x29e0ea=this[_0x5a7b('0xf')]['exec'](_0x386d5d[_0x5a7b('0xc3')],_0x386d5d['options']);if(_0x29e0ea['result']===-0x1){return _0x29e0ea;}return this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xc4'),_0x386d5d[_0x5a7b('0xc3')],_0x386d5d[_0x5a7b('0x73')]));};AGIVertices['prototype'][_0x5a7b('0xc5')]=function(_0x475928){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x475928['label']));if(!this[_0x5a7b('0xa8')](_0x475928[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20text\x20configured');}var _0x2f41d9='\x22'+_0x475928[_0x5a7b('0x58')]+'\x22';if(this['isConfigured'](_0x475928[_0x5a7b('0x73')])){_0x2f41d9+=','+_0x475928[_0x5a7b('0x73')];}var _0x3e2dfe=this[_0x5a7b('0xf')]['exec'](_0x5a7b('0xc6'),_0x2f41d9);if(_0x3e2dfe[_0x5a7b('0xa0')]===-0x1){return _0x3e2dfe;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xaa'),_0x2f41d9));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xc7')]=function(_0x42ef21){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0xc8'),_0x42ef21[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x42ef21['text'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xc9'));}var _0x12b542='\x22'+_0x42ef21[_0x5a7b('0x58')]+'\x22';if(this[_0x5a7b('0xa8')](_0x42ef21[_0x5a7b('0x73')])){_0x12b542+=','+_0x42ef21['options'];}var _0x1198bb=this[_0x5a7b('0xf')]['exec']('MRCPSynth',_0x12b542);if(_0x1198bb[_0x5a7b('0xa0')]===-0x1){return _0x1198bb;}return this['channel']['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0xaa'),_0x12b542));};AGIVertices[_0x5a7b('0x11')]['lumenvoxasr']=function(_0x48f544){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x48f544[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x48f544[_0x5a7b('0xab')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xac'));}var _0x13b595=_0x48f544[_0x5a7b('0xab')];if(this['isConfigured'](_0x48f544[_0x5a7b('0x73')])){_0x13b595+=','+_0x48f544[_0x5a7b('0x73')];}var _0xbbc417=this[_0x5a7b('0xf')][_0x5a7b('0x53')](_0x5a7b('0xad'),_0x13b595);if(_0xbbc417[_0x5a7b('0xa0')]===-0x1){return _0xbbc417;}var _0x30d8e5=this[_0x5a7b('0xae')](_0x5a7b('0xaf'),_0x5a7b('0xca'));if(_0x30d8e5[_0x5a7b('0xa0')]===-0x1){return _0x30d8e5;}var _0x1bbaf2=this[_0x5a7b('0xae')](_0x5a7b('0xb1'),_0x5a7b('0xcb'));if(_0x1bbaf2[_0x5a7b('0xa0')]===-0x1){return _0x1bbaf2;}var _0x5a23d9=this[_0x5a7b('0xae')](_0x5a7b('0xb3'),_0x5a7b('0xcc'));if(_0x5a23d9[_0x5a7b('0xa0')]===-0x1){return _0x5a23d9;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xb5'),_0x13b595));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xcd')]=function(_0x1713ce){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1713ce[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x1713ce[_0x5a7b('0xab')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xac'));}var _0x3c8e9c=_0x1713ce[_0x5a7b('0xab')];if(this[_0x5a7b('0xa8')](_0x1713ce[_0x5a7b('0x73')])){_0x3c8e9c+=','+_0x1713ce[_0x5a7b('0x73')];}var _0x413ba5=this[_0x5a7b('0xf')][_0x5a7b('0x53')](_0x5a7b('0xad'),_0x3c8e9c);if(_0x413ba5[_0x5a7b('0xa0')]===-0x1){return _0x413ba5;}var _0x5efea5=this[_0x5a7b('0xae')](_0x5a7b('0xaf'),_0x5a7b('0xce'));if(_0x5efea5['result']===-0x1){return _0x5efea5;}var _0x4aad38=this['getAndSetVariable']('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x4aad38[_0x5a7b('0xa0')]===-0x1){return _0x4aad38;}var _0x363f4c=this[_0x5a7b('0xae')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x363f4c['result']===-0x1){return _0x363f4c;}return this['channel']['noop'](util[_0x5a7b('0x4f')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3c8e9c));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xcf')]=function(_0x412cf0){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0xd0'),_0x412cf0[_0x5a7b('0x37')]));if(!this['isConfigured'](_0x412cf0[_0x5a7b('0xd1')])){return this[_0x5a7b('0xf')]['error'](_0x412cf0,_0x5a7b('0xd2'));}var _0x273b6d=this[_0x5a7b('0x19')][_0x5a7b('0x69')](this,_0x412cf0[_0x5a7b('0xd1')]);if(!_0x273b6d){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x412cf0,_0x5a7b('0xd3'));}if(!this[_0x5a7b('0xa8')](_0x412cf0[_0x5a7b('0x2e')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x412cf0,'no\x20query\x20configured');}var _0x5370e5=_0x412cf0[_0x5a7b('0x2e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')]('query:\x20%s',_0x5370e5));var _0x232c27=this[_0x5a7b('0x29')]['sync'](this,_0x273b6d,_0x5370e5);this[_0x5a7b('0xd4')]['sync'](this,_0x412cf0,_0x5370e5);if(!this['isConfigured'](_0x412cf0['variable_id'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xd5'));}var _0x5c0766=this[_0x5a7b('0x9e')][_0x5a7b('0x69')](this,_0x412cf0[_0x5a7b('0xd6')]);if(!_0x5c0766){return this[_0x5a7b('0xf')]['error'](_0x412cf0,_0x5a7b('0xd7'));}var _0x134fe6=this;_0x232c27[_0x5a7b('0xd8')](function(_0x5bc650,_0x3d959e){Object[_0x5a7b('0xd9')](_0x5bc650)[_0x5a7b('0xd8')](function(_0x394363){_0x134fe6[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')](_0x5a7b('0xda'),_0x5c0766,_0x3d959e,_0x394363),_0x5bc650[_0x394363]);});});this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')](_0x5a7b('0xdb'),_0x5c0766),_0x232c27[_0x5a7b('0x98')]);return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format']('variable\x20%s\x20set',_0x5c0766));};AGIVertices[_0x5a7b('0x11')]['dial']=function(_0x2765c2){logger[_0x5a7b('0xdc')](util[_0x5a7b('0x4f')](_0x5a7b('0xdd'),_0x2765c2['label']));if(!this[_0x5a7b('0xa8')](_0x2765c2[_0x5a7b('0xde')])){return this[_0x5a7b('0xf')]['error'](_0x2765c2,'no\x20user\x20selected');}var _0x433a4d=this['getUser'][_0x5a7b('0x69')](this,_0x2765c2['sip_id']);if(!_0x433a4d){return this['channel'][_0x5a7b('0x2b')](_0x2765c2,'no\x20user\x20found');}var _0x53c5ab=this[_0x5a7b('0xf')][_0x5a7b('0x53')](_0x5a7b('0xdf'),[util['format'](_0x5a7b('0xe0'),_0x433a4d),_0x2765c2['timeout'],_0x2765c2[_0x5a7b('0xe1')],_0x2765c2[_0x5a7b('0x6a')]]);if(_0x53c5ab[_0x5a7b('0xa0')]===-0x1){return _0x53c5ab;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xe2')]=function(_0xc411f1){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0xe3'),_0xc411f1[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0xc411f1[_0x5a7b('0x75')])){return this[_0x5a7b('0xf')]['noop']('no\x20key\x20configured');}if(!this[_0x5a7b('0xa8')](_0xc411f1[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20text\x20configured');}this[_0x5a7b('0xf')][_0x5a7b('0xe4')]=!![];this['createSquareDetailsReport'](_0xc411f1);this[_0x5a7b('0x41')](_0xc411f1[_0x5a7b('0x58')],'in','','');this['channel']['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0xe5'),_0xc411f1[_0x5a7b('0x58')]));var _0x8939bd=this[_0x5a7b('0x74')]['sync'](this,_0xc411f1);if(_0x8939bd){for(var _0x135666 in _0x8939bd){if(_0x8939bd['hasOwnProperty'](_0x135666)){this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')]('DIALOGFLOW_%s',_0x135666['toUpperCase']()),_0x8939bd[_0x135666]);}}this[_0x5a7b('0x41')](_0x8939bd[_0x5a7b('0xe6')],_0x5a7b('0xe7'),'dialogflow','');return this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xe8'),_0x8939bd[_0x5a7b('0xe6')]));}return this[_0x5a7b('0xf')]['error'](_0xc411f1,_0x5a7b('0xe9'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xea')]=function(_0x2af8d2){logger['info'](util['format'](_0x5a7b('0xeb'),_0x2af8d2['label']));if(!this[_0x5a7b('0xa8')](_0x2af8d2[_0x5a7b('0xec')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xed'));}if(!this['isConfigured'](_0x2af8d2[_0x5a7b('0x78')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xee'));}if(!this[_0x5a7b('0xa8')](_0x2af8d2[_0x5a7b('0xef')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20private_key\x20configured');}if(!this[_0x5a7b('0xa8')](_0x2af8d2[_0x5a7b('0x79')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xf0'));}if(!this[_0x5a7b('0xa8')](_0x2af8d2[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')]['noop']('no\x20text\x20configured');}this[_0x5a7b('0xf')][_0x5a7b('0xe4')]=!![];this[_0x5a7b('0xd4')](_0x2af8d2);this[_0x5a7b('0x41')](_0x2af8d2[_0x5a7b('0x58')],'in','','');this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xf1'),_0x2af8d2[_0x5a7b('0x58')]));var _0x52b90c=this['googleDialogflowV2'][_0x5a7b('0x69')](this,_0x2af8d2);if(_0x52b90c){for(var _0x565d51 in _0x52b90c){if(_0x52b90c[_0x5a7b('0x95')](_0x565d51)){if(_0x565d51!=='providerResponse'){this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')](_0x5a7b('0xf2'),_0x565d51['toUpperCase']()),_0x52b90c[_0x565d51]);}}}this[_0x5a7b('0x41')](_0x52b90c[_0x5a7b('0xe6')],_0x5a7b('0xe7'),_0x5a7b('0xea'),_0x52b90c[_0x5a7b('0xf3')]);return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xf4'),_0x52b90c[_0x5a7b('0xe6')]));}return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x2af8d2,_0x5a7b('0xf5'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xf6')]=function(_0xa94cf2){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0xf7'),_0xa94cf2['label']));if(!this[_0x5a7b('0xa8')](_0xa94cf2[_0x5a7b('0xf8')])){return this[_0x5a7b('0xf')]['noop'](_0x5a7b('0xf9'));}if(!this['isConfigured'](_0xa94cf2['username'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20username\x20configured');}if(!this[_0x5a7b('0xa8')](_0xa94cf2['password'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xfa'));}if(!this[_0x5a7b('0xa8')](_0xa94cf2['ndassistant_url'])){return this[_0x5a7b('0xf')]['noop'](_0x5a7b('0xc9'));}this[_0x5a7b('0xf')][_0x5a7b('0xe4')]=!![];this[_0x5a7b('0xd4')](_0xa94cf2);this['createSquareMessage'](_0xa94cf2[_0x5a7b('0x58')],'in','','');this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')]('Trying\x20SestekNDA:\x20%s',_0xa94cf2[_0x5a7b('0x58')]));var _0x3874a5=this[_0x5a7b('0x7a')][_0x5a7b('0x69')](this,_0xa94cf2);if(_0x3874a5){for(var _0x1a9dff in _0x3874a5){if(_0x3874a5[_0x5a7b('0x95')](_0x1a9dff)){this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util['format'](_0x5a7b('0xfb'),_0x1a9dff[_0x5a7b('0x64')]()),_0x3874a5[_0x1a9dff]);}}this[_0x5a7b('0x41')](_0x3874a5['speech'],'out',_0x5a7b('0xf6'),'');if(_0x3874a5[_0x5a7b('0xfc')]){this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x3874a5[_0x5a7b('0xfc')]));var _0x4912f8=this[_0x5a7b('0xf')][_0x5a7b('0xfd')](_0x3874a5[_0x5a7b('0xfc')]);try{fs[_0x5a7b('0xfe')](_0x3874a5[_0x5a7b('0xfc')]+_0x5a7b('0xff'));}catch(_0x2f2c83){logger[_0x5a7b('0x2b')](_0x2f2c83);}return _0x4912f8;}else{return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x100'),_0x3874a5[_0x5a7b('0xe6')]));}}return this[_0x5a7b('0xf')]['error'](_0xa94cf2,_0x5a7b('0x101'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x102')]=function(_0x306b4e){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x103'),_0x306b4e[_0x5a7b('0x37')]));return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x102'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x104')]=function(_0x3021d9){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x105'),_0x3021d9[_0x5a7b('0x37')]));var _0x39baa5='';if(_0x3021d9[_0x5a7b('0x106')]){if(!this[_0x5a7b('0xa8')](_0x3021d9[_0x5a7b('0x106')])){return this[_0x5a7b('0xf')]['error'](_0x3021d9,_0x5a7b('0x107'));}else{var _0x2cb118=parseInt(_0x3021d9[_0x5a7b('0x106')],0xa);if(isNaN(_0x2cb118)){_0x39baa5=_0x3021d9['trunk_id'];}else{_0x39baa5=this[_0x5a7b('0x1e')][_0x5a7b('0x69')](this,_0x3021d9[_0x5a7b('0x106')]);if(!_0x39baa5){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x3021d9,_0x5a7b('0x108'));}}}}else if(_0x3021d9['trunk_name']){_0x39baa5=_0x3021d9[_0x5a7b('0x109')];}else{return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x3021d9,_0x5a7b('0x107'));}var _0x2d5af2=this[_0x5a7b('0xf')][_0x5a7b('0x53')]('DIAL',[util[_0x5a7b('0x4f')](_0x5a7b('0x10a'),_0x39baa5,_0x3021d9[_0x5a7b('0x46')]),_0x3021d9[_0x5a7b('0x60')],_0x3021d9[_0x5a7b('0xe1')],_0x3021d9[_0x5a7b('0x6a')]]);if(_0x2d5af2[_0x5a7b('0xa0')]===-0x1){return _0x2d5af2;}return this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x10b'),_0x5a7b('0xdf')));};AGIVertices[_0x5a7b('0x11')]['finally']=function(_0x12d309){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x12d309[_0x5a7b('0x37')]));return this[_0x5a7b('0xf')]['noop'](_0x5a7b('0x10c'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xd')]=function(_0x2c1125){logger['info'](util[_0x5a7b('0x4f')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x2c1125[_0x5a7b('0x37')]));if(_0x2c1125[_0x5a7b('0xa5')]===0x0){return this[_0x5a7b('0xa4')](_0x2c1125);}_0x2c1125[_0x5a7b('0xa5')]-=0x1;if(!this['isConfigured'](_0x2c1125[_0x5a7b('0x10d')])){return this['channel'][_0x5a7b('0x2b')](_0x2c1125,_0x5a7b('0x10e'));}var _0x14ca35=this[_0x5a7b('0x10f')][_0x5a7b('0x69')](this,_0x2c1125['file_id']);if(!_0x14ca35){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x2c1125,_0x5a7b('0x110'));}if(!this[_0x5a7b('0xa8')](_0x2c1125[_0x5a7b('0xd6')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x5a7b('0xd5'));}var _0x46b445=this[_0x5a7b('0xf')][_0x5a7b('0x111')](_0x14ca35,_0x2c1125[_0x5a7b('0x112')],_0x2c1125[_0x5a7b('0x113')]);var _0xc4ca15=_0x46b445['result']?_0x46b445[_0x5a7b('0xa0')][_0x5a7b('0x48')]():'';logger[_0x5a7b('0xa1')](_0x5a7b('0x114'),JSON[_0x5a7b('0x6d')](_0x46b445));if(_0x46b445['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x2c1125,_0xc4ca15);return _0x46b445;}else if(_0x46b445[_0x5a7b('0x9f')]==='timeout'){_0x46b445[_0x5a7b('0xa0')]=_0xc4ca15[_0x5a7b('0x98')]>=parseInt(_0x2c1125[_0x5a7b('0x115')])?'x':'i';}else{_0x46b445['result']=_0xc4ca15[_0x5a7b('0x98')]>=parseInt(_0x2c1125[_0x5a7b('0x115')])&&_0xc4ca15[_0x5a7b('0x98')]<=parseInt(_0x2c1125[_0x5a7b('0x113')])?'x':'i';}var _0x171044=this['getVariable'][_0x5a7b('0x69')](this,_0x2c1125['variable_id']);if(!_0x171044){return this[_0x5a7b('0xf')]['error'](_0x2c1125,_0x5a7b('0xd7'));}this['channel'][_0x5a7b('0xa3')](_0x171044,_0xc4ca15);if(this[_0x5a7b('0xa8')](_0x2c1125[_0x5a7b('0x116')])){var _0x285eef=parseInt(_0x2c1125[_0x5a7b('0x116')],0xa);var _0x41dd7c=rs[_0x5a7b('0x117')]({'charset':'*','length':_0x285eef});var _0x11a204=_0xc4ca15[_0x5a7b('0x98')];if(_0x11a204>0x0){if(_0x11a204>_0x285eef){this[_0x5a7b('0xd4')]['sync'](this,_0x2c1125,_0x2c1125['hiddendigitspos']==='first'?_0x41dd7c+_0xc4ca15[_0x5a7b('0x118')](_0x285eef):_0xc4ca15[_0x5a7b('0x118')](0x0,_0x11a204-_0x285eef)+_0x41dd7c);}else{this[_0x5a7b('0xd4')]['sync'](this,_0x2c1125,rs[_0x5a7b('0x117')]({'charset':'*','length':_0x11a204}));}}else{this[_0x5a7b('0xd4')][_0x5a7b('0x69')](this,_0x2c1125,'');}}else{this[_0x5a7b('0xd4')][_0x5a7b('0x69')](this,_0x2c1125,_0xc4ca15);}return _0x46b445;};AGIVertices[_0x5a7b('0x11')]['getsecretdigits']=function(_0x127aae){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x127aae[_0x5a7b('0x37')]));return this[_0x5a7b('0xd')](_0x127aae);};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x119')]=function(_0x36ff13){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x11a'),_0x36ff13[_0x5a7b('0x37')]));this['createSquareDetailsReport']['sync'](this,_0x36ff13,_0x36ff13[_0x5a7b('0x11b')]);return this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x11c'),_0x36ff13[_0x5a7b('0x11b')]));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x11d')]=function(_0x10d2e7){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x11e'),_0x10d2e7[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x10d2e7['aws_access_key_id'])||!this[_0x5a7b('0xa8')](_0x10d2e7['aws_secret_access_key'])){return this[_0x5a7b('0xf')]['noop'](_0x5a7b('0x11f'));}if(!this[_0x5a7b('0xa8')](_0x10d2e7[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xc9'));}this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x120'),_0x10d2e7['text']));var _0x21056b=this[_0x5a7b('0x80')][_0x5a7b('0x69')](this,_0x10d2e7);if(_0x21056b){this['channel']['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x121'),_0x21056b));var _0x2fe7f3=this[_0x5a7b('0xf')][_0x5a7b('0xfd')](_0x21056b);try{fs[_0x5a7b('0xfe')](_0x21056b+_0x5a7b('0xff'));}catch(_0x46e8e6){logger[_0x5a7b('0x2b')](_0x46e8e6);}return _0x2fe7f3;}return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x10d2e7,_0x5a7b('0x122'));};AGIVertices[_0x5a7b('0x11')]['awslex']=function(_0x24a13e){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x24a13e[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x24a13e[_0x5a7b('0x87')])||!this[_0x5a7b('0xa8')](_0x24a13e[_0x5a7b('0x81')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x11f'));}if(!this[_0x5a7b('0xa8')](_0x24a13e[_0x5a7b('0x88')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20bot\x20name\x20configured');}if(!this[_0x5a7b('0xa8')](_0x24a13e[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xc9'));}this[_0x5a7b('0xf')]['bot']=!![];this[_0x5a7b('0xd4')](_0x24a13e);this[_0x5a7b('0x41')](_0x24a13e[_0x5a7b('0x58')],'in','','');this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x123'),_0x24a13e[_0x5a7b('0x58')]));var _0x1f6453=this[_0x5a7b('0x86')]['sync'](this,_0x24a13e);if(_0x1f6453){for(var _0x5df370 in _0x1f6453){if(_0x1f6453[_0x5a7b('0x95')](_0x5df370)&&_[_0x5a7b('0x92')](_0x1f6453[_0x5df370])){this['channel'][_0x5a7b('0xa3')](util['format'](_0x5a7b('0x124'),_0x5df370[_0x5a7b('0x64')]()),_0x1f6453[_0x5df370]);}}if(_[_0x5a7b('0x4c')](_0x1f6453['message'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x125'));}else{this[_0x5a7b('0x41')](_0x1f6453[_0x5a7b('0x71')],_0x5a7b('0xe7'),_0x5a7b('0x126'),'');return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x127'),_0x1f6453['message']));}}return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x24a13e,_0x5a7b('0x128'));};AGIVertices[_0x5a7b('0x11')]['googleasr']=function(_0x3839fa){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x3839fa[_0x5a7b('0x37')],_0x3839fa[_0x5a7b('0x60')]));if(!this[_0x5a7b('0xa8')](_0x3839fa['key'])){return this['channel'][_0x5a7b('0xa9')]('no\x20key\x20configured');}var _0x2d0c33=_0x5a7b('0x129');var _0x48b83a=util[_0x5a7b('0x4f')](_0x5a7b('0x12a'),FILES_PATH,rs[_0x5a7b('0x117')](0x4));var _0x431137=util[_0x5a7b('0x4f')]('%s.%s',_0x48b83a,_0x2d0c33);var _0x18ce9c=!![];if(_0x3839fa[_0x5a7b('0x12b')]==='NOBEEP'){_0x18ce9c=![];}var _0x2b28aa=this[_0x5a7b('0xf')][_0x5a7b('0x12c')](_0x48b83a,_0x2d0c33,_0x3839fa['intKey'],_0x3839fa[_0x5a7b('0x60')],undefined,_0x18ce9c);if(_0x2b28aa['result']!==-0x1){this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x12d'),_0x431137));var _0x4a4a29=this[_0x5a7b('0x89')][_0x5a7b('0x69')](this,_0x3839fa,_0x431137);if(_0x4a4a29){for(var _0x53f1ea in _0x4a4a29){if(_0x4a4a29[_0x5a7b('0x95')](_0x53f1ea)){this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')](_0x5a7b('0x12e'),_0x53f1ea['toUpperCase']()),_0x4a4a29[_0x53f1ea]);}}return this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x12f'),JSON['stringify'](_0x4a4a29)));}}return _0x2b28aa;};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x130')]=function(_0x38a775){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x131'),_0x38a775['label']));if(!this['isConfigured'](_0x38a775[_0x5a7b('0x8c')])){return this['channel'][_0x5a7b('0xa9')]('no\x20appid\x20configured');}if(!this[_0x5a7b('0xa8')](_0x38a775['appsecret'])){return this['channel']['noop'](_0x5a7b('0x132'));}var _0x1bc88f=_0x5a7b('0x129');var _0x510263=util[_0x5a7b('0x4f')]('%s/recordings/%s',FILES_PATH,rs[_0x5a7b('0x117')](0x4));var _0x4d9959=util[_0x5a7b('0x4f')](_0x5a7b('0x9a'),_0x510263,_0x1bc88f);var _0x1dc19c=!![];if(_0x38a775[_0x5a7b('0x12b')]==='NOBEEP'){_0x1dc19c=![];}var _0x21eb3a=this[_0x5a7b('0xf')]['recordFile'](_0x510263,_0x1bc88f,_0x38a775[_0x5a7b('0x133')],_0x38a775[_0x5a7b('0x60')],undefined,_0x1dc19c);if(_0x21eb3a[_0x5a7b('0xa0')]!==-0x1){this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x134'),_0x4d9959));var _0x4c7a10=this['tildeASR']['sync'](this,_0x38a775,_0x4d9959);if(_0x4c7a10){for(var _0x7eb39f in _0x4c7a10){if(_0x4c7a10[_0x5a7b('0x95')](_0x7eb39f)){this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')](_0x5a7b('0x135'),_0x7eb39f[_0x5a7b('0x64')]()),_0x4c7a10[_0x7eb39f]);}}return this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x136'),JSON[_0x5a7b('0x6d')](_0x4c7a10)));}}return _0x21eb3a;};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x137')]=function(_0x2edac2){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x138'),_0x2edac2[_0x5a7b('0x37')]));return this[_0x5a7b('0xf')][_0x5a7b('0x139')](_0x2edac2[_0x5a7b('0x3c')],_0x2edac2[_0x5a7b('0x3d')],_0x2edac2[_0x5a7b('0x3e')]);};AGIVertices['prototype'][_0x5a7b('0x13a')]=function(_0x3ef5a9){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x13b'),_0x3ef5a9[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x3ef5a9[_0x5a7b('0x13c')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x3ef5a9,_0x5a7b('0x13d'));}try{var _0x9ae416=eval(_0x3ef5a9[_0x5a7b('0x13c')])?_0x5a7b('0x13e'):_0x5a7b('0x13f');this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x140'),_0x3ef5a9[_0x5a7b('0x13c')],_0x9ae416));return{'code':0xc8,'result':_0x9ae416};}catch(_0x4133c2){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0x5a7b('0x141')]=function(_0x27a266){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x142'),_0x27a266[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x27a266[_0x5a7b('0x143')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x27a266,_0x5a7b('0x144'));}var _0x4503e3=this['getIntervals'][_0x5a7b('0x69')](this,_0x27a266['interval_id']);if(!_0x4503e3){return this['channel'][_0x5a7b('0x2b')](_0x27a266,_0x5a7b('0x145'));}for(var _0x1a074d=0x0;_0x1a074d<_0x4503e3[_0x5a7b('0x98')];_0x1a074d+=0x1){var _0x247c12=this['channel'][_0x5a7b('0x9e')](util[_0x5a7b('0x4f')](_0x5a7b('0x146'),_0x4503e3[_0x1a074d]));if(_0x247c12[_0x5a7b('0xa0')]===-0x1){return _0x247c12;}logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x147'),_0x4503e3[_0x1a074d],_0x247c12[_0x5a7b('0x9f')]));if(_0x247c12[_0x5a7b('0x9f')]===_0x5a7b('0x13e')){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('IFTIME\x20%s\x20%s',_0x4503e3[_0x1a074d],'true'));this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x147'),_0x4503e3[_0x1a074d],_0x5a7b('0x13e')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x147'),_0x4503e3[_0x1a074d],_0x5a7b('0x13f')));this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x147'),_0x4503e3[_0x1a074d],'false'));}}return{'code':0xc8,'result':_0x5a7b('0x13f')};};AGIVertices['prototype'][_0x5a7b('0x148')]=function(_0xada860){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x149'),_0xada860['label']));return this[_0x5a7b('0xf')]['hangup']();};AGIVertices['prototype'][_0x5a7b('0x14a')]=function(_0x2bf24b){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x14b'),_0x2bf24b['label']));if(!this[_0x5a7b('0xa8')](_0x2bf24b['key'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x14c'));}var _0x3f95e9=_0x5a7b('0x129');var _0x2ac7c7=util[_0x5a7b('0x4f')](_0x5a7b('0x12a'),FILES_PATH,rs['generate'](0x4));var _0xd9a2ad=util[_0x5a7b('0x4f')](_0x5a7b('0x9a'),_0x2ac7c7,_0x3f95e9);var _0x3689f0=!![];if(_0x2bf24b['beep']===_0x5a7b('0x14d')){_0x3689f0=![];}var _0x24bc77=this['channel'][_0x5a7b('0x12c')](_0x2ac7c7,_0x3f95e9,_0x2bf24b[_0x5a7b('0x133')],_0x2bf24b['timeout'],undefined,_0x3689f0);if(_0x24bc77[_0x5a7b('0xa0')]!==-0x1){this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x14e'),_0xd9a2ad));var _0x3161b1=this[_0x5a7b('0x7e')][_0x5a7b('0x69')](this,_0x2bf24b,_0xd9a2ad);if(_0x3161b1){for(var _0x1e007e in _0x3161b1){if(_0x3161b1[_0x5a7b('0x95')](_0x1e007e)){this[_0x5a7b('0xf')]['setVariable'](util[_0x5a7b('0x4f')]('ISPEECH_ASR_%s',_0x1e007e[_0x5a7b('0x64')]()),_0x3161b1[_0x1e007e]);}}return this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x14f'),JSON[_0x5a7b('0x6d')](_0x3161b1)));}}return _0x24bc77;};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x150')]=function(_0x17793e){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x151'),_0x17793e[_0x5a7b('0x37')]));if(!this['isConfigured'](_0x17793e['key'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x14c'));}if(!this[_0x5a7b('0xa8')](_0x17793e['text'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xc9'));}this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x152'),_0x17793e[_0x5a7b('0x58')]));var _0x4c5d3a=this[_0x5a7b('0x7b')][_0x5a7b('0x69')](this,_0x17793e);if(_0x4c5d3a){this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')]('ispeech\x20%s\x20file\x20created',_0x4c5d3a));var _0xaf9f2e=this[_0x5a7b('0xf')]['streamFile'](_0x4c5d3a,_0x17793e[_0x5a7b('0x133')]);try{fs[_0x5a7b('0xfe')](_0x4c5d3a+'.wav');}catch(_0x2dc2cc){logger[_0x5a7b('0x2b')](_0x2dc2cc);}return _0xaf9f2e;}return this['channel']['error'](_0x17793e,_0x5a7b('0x153'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x154')]=function(_0x538e8b){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x155'),_0x538e8b[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x538e8b[_0x5a7b('0x156')])){return this[_0x5a7b('0xf')]['error'](_0x538e8b,_0x5a7b('0x157'));}logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x158'),this['channel'][_0x5a7b('0x39')],_0x538e8b['findBy']));var _0x26e2a5=this[_0x5a7b('0x4e')]['sync'](this,_0x538e8b[_0x5a7b('0x156')]);if(_0x26e2a5){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x159'),this['channel'][_0x5a7b('0x39')],_0x538e8b['findBy']));this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x538e8b['findBy']));return{'code':0xc8,'result':_0x5a7b('0x15a')};}else{logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x15b'),this['channel'][_0x5a7b('0x39')],_0x538e8b[_0x5a7b('0x156')]));this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x15b'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x538e8b[_0x5a7b('0x156')]));return{'code':0xc8,'result':_0x5a7b('0x15c')};}};AGIVertices['prototype']['logout']=function(_0x5be4dc){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x15d'),_0x5be4dc[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x5be4dc[_0x5a7b('0x156')])){return this['channel'][_0x5a7b('0x2b')](_0x5be4dc,'no\x20find\x20by\x20configured');}logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5a7b('0xf')]['callerid'],_0x5be4dc['findBy']));var _0x5a8457=this[_0x5a7b('0x15e')][_0x5a7b('0x69')](this,_0x5be4dc[_0x5a7b('0x156')]);if(_0x5a8457){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x159'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x5be4dc[_0x5a7b('0x156')]));this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format'](_0x5a7b('0x159'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x5be4dc[_0x5a7b('0x156')]));return{'code':0xc8,'result':_0x5a7b('0x15a')};}else{logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x15b'),this['channel'][_0x5a7b('0x39')],_0x5be4dc[_0x5a7b('0x156')]));this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x15b'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x5be4dc['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x15f')]=function(_0x4f19bf){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x160'),_0x4f19bf[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x4f19bf[_0x5a7b('0x161')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x4f19bf,_0x5a7b('0x162'));}this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x163'),_0x4f19bf['operation']));var _0x1219f6=eval(_0x4f19bf['operation']);if(!this[_0x5a7b('0xa8')](_0x4f19bf[_0x5a7b('0xd6')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xd5'));}var _0x498d03=this[_0x5a7b('0x9e')][_0x5a7b('0x69')](this,_0x4f19bf['variable_id']);if(!_0x498d03){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x4f19bf,'no\x20variable\x20found');}if(_['isArray'](_0x1219f6)){var _0x18a9e2=this;_0x1219f6[_0x5a7b('0xd8')](function(_0x157a4e,_0x5886a2){_0x18a9e2[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')]('%s[%s]',_0x498d03,_0x5886a2),_0x157a4e);});return this[_0x5a7b('0xf')]['noop'](util['format']('variable\x20%s[key]\x20set',_0x498d03));}else{return this['channel']['setVariable'](_0x498d03,_0x1219f6);}};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xc')]=function(_0x169ee7){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x169ee7['label']));if(_0x169ee7[_0x5a7b('0xa5')]===0x0){return this['maxRetry'](_0x169ee7);}_0x169ee7[_0x5a7b('0xa5')]-=0x1;if(!this[_0x5a7b('0xa8')](_0x169ee7[_0x5a7b('0x10d')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x169ee7,_0x5a7b('0x10e'));}var _0x4d4ca7=this[_0x5a7b('0x10f')][_0x5a7b('0x69')](this,_0x169ee7[_0x5a7b('0x10d')]);if(!_0x4d4ca7){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x169ee7,_0x5a7b('0x110'));}var _0x19f6ff=this['channel'][_0x5a7b('0x111')](_0x4d4ca7,_0x169ee7['response'],_0x169ee7['digit']);var _0x314824=_0x19f6ff[_0x5a7b('0xa0')];if(_0x19f6ff['result']===-0x1){this[_0x5a7b('0xd4')][_0x5a7b('0x69')](this,_0x169ee7,'-1');return _0x19f6ff;}else if(_0x19f6ff[_0x5a7b('0x9f')]===_0x5a7b('0x60')){_0x19f6ff[_0x5a7b('0xa0')]=_0x19f6ff['result'][_0x5a7b('0x98')]>0x0?_0x19f6ff[_0x5a7b('0xa0')]:'t';}else if(_[_0x5a7b('0x43')](_0x19f6ff['result'])){_0x19f6ff[_0x5a7b('0xa0')]='#';_0x314824='#';}if(!this[_0x5a7b('0xa8')](_0x169ee7['variable_id'])){this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xd5'));}else{var _0x956bba=this['getVariable'][_0x5a7b('0x69')](this,_0x169ee7['variable_id']);if(!_0x956bba){return this['channel'][_0x5a7b('0x2b')](_0x169ee7,'no\x20variable\x20found');}this[_0x5a7b('0xf')][_0x5a7b('0xa3')](_0x956bba,_0x314824);}this['createSquareDetailsReport']['sync'](this,_0x169ee7,_0x314824);return _0x19f6ff;};AGIVertices['prototype']['noop']=function(_0x2fe077){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x2fe077[_0x5a7b('0x37')]));return this['channel'][_0x5a7b('0xa9')](_0x2fe077[_0x5a7b('0x164')]||_0x2fe077[_0x5a7b('0x37')]);};AGIVertices[_0x5a7b('0x11')]['pause']=function(_0x4406b8){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4406b8[_0x5a7b('0x37')]));if(!this['isConfigured'](_0x4406b8[_0x5a7b('0x156')])){return this[_0x5a7b('0xf')]['error'](_0x4406b8,_0x5a7b('0x157'));}logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x158'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x4406b8[_0x5a7b('0x156')]));var _0x85aaf9=this[_0x5a7b('0x165')][_0x5a7b('0x69')](this,_0x4406b8[_0x5a7b('0x166')]);var _0x6e6fa0=this[_0x5a7b('0x4a')][_0x5a7b('0x69')](this,_0x4406b8['findBy'],_0x85aaf9);if(_0x6e6fa0){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x159'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x4406b8['findBy']));this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x159'),this[_0x5a7b('0xf')]['callerid'],_0x4406b8['findBy']));return{'code':0xc8,'result':_0x5a7b('0x15a')};}else{logger['info'](util[_0x5a7b('0x4f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x4406b8[_0x5a7b('0x156')]));this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x159'),this[_0x5a7b('0xf')]['callerid'],_0x4406b8['findBy']));return{'code':0xc8,'result':_0x5a7b('0x15c')};}};AGIVertices['prototype']['playback']=function(_0x56e16b){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x167'),_0x56e16b[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x56e16b[_0x5a7b('0x10d')])){return this[_0x5a7b('0xf')]['error'](_0x56e16b,'no\x20file\x20audio\x20selected');}var _0x57d863=this['getSound'][_0x5a7b('0x69')](this,_0x56e16b[_0x5a7b('0x10d')]);if(!_0x57d863){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x56e16b,_0x5a7b('0x110'));}var _0x4dc6c5=this[_0x5a7b('0xf')][_0x5a7b('0x53')](_0x5a7b('0x168'),[_0x57d863,_0x56e16b['opts']]);if(_0x4dc6c5[_0x5a7b('0xa0')]===-0x1){return _0x4dc6c5;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xc4'),_0x5a7b('0x168'),_0x57d863));};AGIVertices['prototype']['queue']=function(_0x590c42){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x169'),_0x590c42['label']));if(!this[_0x5a7b('0xa8')](_0x590c42[_0x5a7b('0x16a')])){return this['channel'][_0x5a7b('0x2b')](_0x590c42,'no\x20queue\x20selected');}var _0x9fa902='';var _0x5e5c66=parseInt(_0x590c42[_0x5a7b('0x16a')],0xa);if(isNaN(_0x5e5c66)){_0x9fa902=_0x590c42[_0x5a7b('0x16a')];}else{_0x9fa902=this[_0x5a7b('0x14')]['sync'](this,_0x590c42[_0x5a7b('0x16a')]);if(!_0x9fa902){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x590c42,'no\x20queue\x20found');}}var _0x186d44='';if(this[_0x5a7b('0xa8')](_0x590c42['file_id'])){var _0x2767e4=this[_0x5a7b('0x10f')]['sync'](this,_0x590c42[_0x5a7b('0x10d')]);if(_0x2767e4){_0x186d44=_0x2767e4;}}this[_0x5a7b('0xd4')][_0x5a7b('0x69')](this,_0x590c42,_0x9fa902);if(_0x590c42[_0x5a7b('0xe1')]['indexOf']('x')<0x0){_0x590c42[_0x5a7b('0xe1')]+='x';}if(_0x590c42[_0x5a7b('0xe1')][_0x5a7b('0x16b')]('X')<0x0){_0x590c42[_0x5a7b('0xe1')]+='X';}this[_0x5a7b('0xf')][_0x5a7b('0xa3')](_0x5a7b('0x16c'),_0x9fa902?_0x9fa902[_0x5a7b('0x16d')]():'');var _0x588ecd=this['channel'][_0x5a7b('0x53')](_0x5a7b('0x16e'),[_0x9fa902,_0x590c42[_0x5a7b('0xe1')],_0x590c42[_0x5a7b('0x6a')],_0x186d44,_0x590c42[_0x5a7b('0x60')],_0x590c42[_0x5a7b('0x16f')],_0x590c42[_0x5a7b('0x170')],_0x590c42[_0x5a7b('0x171')],'',_0x590c42['position']]);if(_0x588ecd[_0x5a7b('0xa0')]===-0x1){return _0x588ecd;}return this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0xc4'),_0x5a7b('0x16e'),_0x9fa902));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x172')]=function(_0x1cc497){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x173'),_0x1cc497[_0x5a7b('0x37')]));var _0x1e92ed=_0x1cc497['recordingFormat']||_0x5a7b('0x129');var _0x521a86=util[_0x5a7b('0x4f')](_0x5a7b('0x174'),this[_0x5a7b('0xf')]['uniqueid'],rs[_0x5a7b('0x117')](0x5));var _0x2cf720=util['format'](_0x5a7b('0x175'),FILES_PATH,_0x521a86,_0x1e92ed);var _0x9473a2=util['format'](_0x5a7b('0x12a'),FILES_PATH,_0x521a86);this[_0x5a7b('0x3a')][_0x5a7b('0x69')](this,_0x1cc497,_0x521a86,_0x2cf720);this[_0x5a7b('0xf')][_0x5a7b('0xa3')](_0x5a7b('0x176'),_0x521a86);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x9473a2,_0x1e92ed,_0x1cc497[_0x5a7b('0x177')],_0x1cc497[_0x5a7b('0x60')]);return this['channel'][_0x5a7b('0x12c')](_0x9473a2,_0x1e92ed,_0x1cc497[_0x5a7b('0x177')],_0x1cc497[_0x5a7b('0x60')],undefined,!![]);};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x178')]=function(_0x5a21b7){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x179'),_0x5a21b7[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x5a21b7[_0x5a7b('0x6a')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20url\x20configured');}var _0x4546ca=this[_0x5a7b('0x5e')][_0x5a7b('0x69')](this,_0x5a21b7);logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x17a'),util[_0x5a7b('0x17b')](_0x4546ca,{'showHidden':![],'depth':null})));if(!this[_0x5a7b('0xa8')](_0x5a21b7['variable_id'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x17c'));}var _0x3fe746=this[_0x5a7b('0x9e')]['sync'](this,_0x5a21b7[_0x5a7b('0xd6')]);if(!_0x3fe746){return this[_0x5a7b('0xf')]['error'](_0x5a21b7,_0x5a7b('0xd7'));}this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')](_0x5a7b('0x17d'),_0x3fe746),_0x4546ca[_0x5a7b('0x70')]?_0x4546ca[_0x5a7b('0x70')]:_0x5a7b('0x17e'));this['channel'][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')]('%s_STATUS_MESSAGE',_0x3fe746),_0x4546ca[_0x5a7b('0x17f')]?_0x4546ca['statusMessage']:'OK');if(_0x4546ca['body']){try{this[_0x5a7b('0x99')](_0x4546ca[_0x5a7b('0x6e')],_0x3fe746);}catch(_0xf193a3){logger[_0x5a7b('0x2b')](util[_0x5a7b('0x4f')](_0x5a7b('0x180'),_0x3fe746));}}return this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x181'),_0x3fe746));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x182')]=function(_0x2e9486){logger['info'](util['format'](_0x5a7b('0x183'),_0x2e9486['label']));return this[_0x5a7b('0xf')]['sayDigits'](_0x2e9486[_0x5a7b('0x184')][_0x5a7b('0x185')](/\s+/g,''),_0x2e9486[_0x5a7b('0x177')]);};AGIVertices['prototype'][_0x5a7b('0x186')]=function(_0x30ebbe){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x187'),_0x30ebbe['label']));return this[_0x5a7b('0xf')][_0x5a7b('0x188')](_0x30ebbe['number'][_0x5a7b('0x185')](/\s+/g,''),_0x30ebbe[_0x5a7b('0x177')]);};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x189')]=function(_0x5418a1){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x18a'),_0x5418a1[_0x5a7b('0x37')]));return this[_0x5a7b('0xf')][_0x5a7b('0x18b')](_0x5418a1[_0x5a7b('0x58')],_0x5418a1[_0x5a7b('0x177')]);};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x18c')]=function(_0x1acd70){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x1acd70[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x1acd70[_0x5a7b('0x18d')])){return this['channel'][_0x5a7b('0xa9')](_0x5a7b('0x18e'));}var _0x4c5d64=this[_0x5a7b('0x18f')]['sync'](this,_0x1acd70[_0x5a7b('0x18d')]);if(!_0x4c5d64||!_0x4c5d64[_0x5a7b('0x190')]){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x1acd70,_0x5a7b('0x191'));}var _0x107758={'from':util[_0x5a7b('0x4f')](_0x5a7b('0x192'),_0x4c5d64[_0x5a7b('0x13')],_0x4c5d64[_0x5a7b('0x193')]||_0x4c5d64[_0x5a7b('0x190')][_0x5a7b('0x194')]),'to':_0x1acd70['to']||'','cc':_0x1acd70['cc']||'','bcc':_0x1acd70[_0x5a7b('0x195')]||'','subject':_0x1acd70[_0x5a7b('0x196')],'html':_0x1acd70[_0x5a7b('0x58')],'text':_0x1acd70[_0x5a7b('0x58')]};if(this['isConfigured'](_0x1acd70['template_id'])){}logger[_0x5a7b('0xdc')]('sendMail\x20message',JSON[_0x5a7b('0x6d')](_0x107758));this['createSquareDetailsReport'][_0x5a7b('0x69')](this,_0x1acd70,_0x1acd70[_0x5a7b('0x18d')]);this['channel'][_0x5a7b('0xa9')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x4c5d64[_0x5a7b('0x13')]));this[_0x5a7b('0x22')][_0x5a7b('0x69')](this,_0x4c5d64[_0x5a7b('0x197')],_0x107758);return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x5a7b('0x11')]['sendFax']=function(_0x2e60c0){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x2e60c0['label']));return this['channel'][_0x5a7b('0xa9')](_0x5a7b('0x198'));};AGIVertices[_0x5a7b('0x11')]['sendSMS']=function(_0x30a8f8){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x30a8f8[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x30a8f8[_0x5a7b('0x199')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x19a'));}var _0x2689d7=this[_0x5a7b('0x33')][_0x5a7b('0x69')](this,_0x30a8f8['sms_account_id']);if(!_0x2689d7){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x30a8f8,_0x5a7b('0x19b'));}var _0x5c1b5d={'body':_0x30a8f8[_0x5a7b('0x19c')],'phone':_0x30a8f8['to']||'','SmsAccountId':_0x2689d7['id']};logger[_0x5a7b('0xdc')](_0x5a7b('0x19d'),JSON['stringify'](_0x5c1b5d));this[_0x5a7b('0xd4')][_0x5a7b('0x69')](this,_0x30a8f8,_0x30a8f8[_0x5a7b('0x199')]);this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x19e'),_0x2689d7['name']));this[_0x5a7b('0x35')][_0x5a7b('0x69')](this,_0x5c1b5d);return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x19f'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x1a0')]=function(_0x3f8238){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x3f8238[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x3f8238[_0x5a7b('0xd6')])){return this['channel'][_0x5a7b('0x2b')](_0x3f8238,'no\x20variable\x20selected');}var _0x16f8ae=this[_0x5a7b('0x9e')][_0x5a7b('0x69')](this,_0x3f8238['variable_id']);if(!_0x16f8ae){return this[_0x5a7b('0xf')]['error'](_0x3f8238,_0x5a7b('0xd7'));}return this[_0x5a7b('0xf')]['setVariable'](_0x16f8ae,_0x3f8238[_0x5a7b('0x1a1')]);};AGIVertices[_0x5a7b('0x11')]['start']=function(_0x1bceba){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x1a2'),_0x1bceba[_0x5a7b('0x37')]));this[_0x5a7b('0xf')]['noop']('START\x20CALLY\x20SQUARE');if(_0x1bceba['answer']===_0x5a7b('0x1a3')){this['channel'][_0x5a7b('0xa9')]('Answer');return this[_0x5a7b('0xf')][_0x5a7b('0xb8')]();}return this[_0x5a7b('0xf')]['noop'](_0x5a7b('0x1a4'));};AGIVertices['prototype'][_0x5a7b('0x1a5')]=function(_0x4bea75){logger['info'](util[_0x5a7b('0x4f')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x4bea75[_0x5a7b('0x37')]));if(!this['isConfigured'](_0x4bea75[_0x5a7b('0x1a6')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x4bea75,'no\x20subproject\x20selected');}var _0x30a77f=this['getSquareProject']['sync'](this,_0x4bea75[_0x5a7b('0x1a6')]);if(!this[_0x5a7b('0xa8')](_0x30a77f)){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x4bea75,util[_0x5a7b('0x4f')](_0x5a7b('0x1a7'),_0x4bea75['project_id']));}if(_0x30a77f===this[_0x5a7b('0xf')][_0x5a7b('0x38')]){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x4bea75,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x5a7b('0xd4')]['sync'](this,_0x4bea75,_0x30a77f);var _0xc03ac9=this[_0x5a7b('0xf')][_0x5a7b('0x53')](_0x5a7b('0x1a8'),util[_0x5a7b('0x4f')](_0x5a7b('0x1a9'),config[_0x5a7b('0x16f')][_0x5a7b('0x1aa')]||_0x5a7b('0x1ab'),_0x30a77f,this[_0x5a7b('0xf')]['arg_1']));if(_0xc03ac9['result']===-0x1){return _0xc03ac9;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xc4'),'AGI',_0x30a77f));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x1ac')]=function(_0x18b06a){logger['info'](util[_0x5a7b('0x4f')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x18b06a[_0x5a7b('0x37')]));var _0x1a97f2=this[_0x5a7b('0x52')]['sync'](this,_0x18b06a[_0x5a7b('0xb7')]);this['createSquareDetailsReport'][_0x5a7b('0x69')](this,_0x18b06a,_0x18b06a[_0x5a7b('0xb7')]);if(this[_0x5a7b('0xa8')](_0x18b06a['variable_id'])){var _0x31053d=this['getVariable'][_0x5a7b('0x69')](this,_0x18b06a['variable_id']);if(_0x31053d){this[_0x5a7b('0xf')]['setVariable'](_0x31053d,_0x1a97f2);return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format'](_0x5a7b('0x1ad'),_0x18b06a['command'],_0x31053d));}}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x1ae'),_0x18b06a[_0x5a7b('0xb7')]));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x1af')]=function(_0x897ac8){logger['info'](util[_0x5a7b('0x4f')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x897ac8[_0x5a7b('0x37')]));_0x897ac8[_0x5a7b('0x58')]=_0x897ac8[_0x5a7b('0x58')][_0x5a7b('0x185')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5a7b('0xa8')](_0x897ac8[_0x5a7b('0x56')])){return this['channel']['noop'](_0x5a7b('0x1b0'));}if(!this[_0x5a7b('0xa8')](_0x897ac8[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20text\x20configured');}this[_0x5a7b('0xf')]['noop'](util['format'](_0x5a7b('0x1b1'),_0x897ac8[_0x5a7b('0x58')]));var _0x4b59ed=this['googleCloudTTS'][_0x5a7b('0x69')](this,_0x897ac8);if(_0x4b59ed){this[_0x5a7b('0xf')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x4b59ed));var _0x555123=this[_0x5a7b('0xf')][_0x5a7b('0xfd')](_0x4b59ed);try{fs[_0x5a7b('0xfe')](_0x4b59ed+_0x5a7b('0xff'));}catch(_0x385260){logger[_0x5a7b('0x2b')](_0x385260);}return _0x555123;}return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x897ac8,_0x5a7b('0x1b2'));};AGIVertices['prototype'][_0x5a7b('0x1b3')]=function(_0x27e33b){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x1b4'),_0x27e33b[_0x5a7b('0x37')]));_0x27e33b['text']=_0x27e33b[_0x5a7b('0x58')][_0x5a7b('0x185')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x27e33b[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')]['noop'](_0x5a7b('0xc9'));}this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x1b5'),_0x27e33b[_0x5a7b('0x58')]));var _0x41c3af=this[_0x5a7b('0x1b6')][_0x5a7b('0x69')](this,_0x27e33b);if(_0x41c3af){this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format'](_0x5a7b('0x1b7'),_0x41c3af));var _0x3ea8d2=this[_0x5a7b('0xf')][_0x5a7b('0xfd')](_0x41c3af);try{fs[_0x5a7b('0xfe')](_0x41c3af+_0x5a7b('0xff'));}catch(_0x3c1347){logger[_0x5a7b('0x2b')](_0x3c1347);}return _0x3ea8d2;}return this['channel'][_0x5a7b('0x2b')](_0x27e33b,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['unpause']=function(_0xdc29a8){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x1b8'),_0xdc29a8[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0xdc29a8[_0x5a7b('0x156')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0xdc29a8,_0x5a7b('0x157'));}logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x158'),this[_0x5a7b('0xf')]['callerid'],_0xdc29a8[_0x5a7b('0x156')]));var _0x3157f7=this[_0x5a7b('0x4d')][_0x5a7b('0x69')](this,_0xdc29a8[_0x5a7b('0x156')]);if(_0x3157f7){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x159'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0xdc29a8['findBy']));this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x159'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0xdc29a8['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x5a7b('0x15b'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0xdc29a8[_0x5a7b('0x156')]));this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x15b'),this['channel']['callerid'],_0xdc29a8[_0x5a7b('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x1b9')]=function(_0x1424c8){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1424c8[_0x5a7b('0x37')]));var _0x481dc1=this[_0x5a7b('0xf')][_0x5a7b('0x53')]('VOICEMAIL',[_0x1424c8[_0x5a7b('0x1ba')],_0x1424c8[_0x5a7b('0x73')]]);if(_0x481dc1[_0x5a7b('0xa0')]===-0x1){return _0x481dc1;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')]('Executed\x20command\x20%s\x20%s',_0x5a7b('0x1bb'),_0x1424c8[_0x5a7b('0x1ba')]));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x1bc')]=function(_0x36b2df){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x1bd'),_0x36b2df[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x36b2df[_0x5a7b('0xd6')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x36b2df,_0x5a7b('0x1be'));}var _0x1438fd=this['getVariable'][_0x5a7b('0x69')](this,_0x36b2df['variable_id']);if(!_0x1438fd){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x36b2df,_0x5a7b('0xd7'));}var _0x286c3a=this[_0x5a7b('0xf')][_0x5a7b('0x9e')](_0x1438fd);return{'code':0xc8,'result':_0x286c3a[_0x5a7b('0x9f')]?_0x286c3a['extra']:'-'};};String[_0x5a7b('0x11')][_0x5a7b('0x9d')]=function(_0x59ae66,_0x543233){return this['split'](_0x59ae66)['join'](_0x543233);};module[_0x5a7b('0x1bf')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 2cc1e71..11df026 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 _0xd17f=['queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw'];(function(_0x45cf07,_0xd190e4){var _0x109f1f=function(_0x34afbe){while(--_0x34afbe){_0x45cf07['push'](_0x45cf07['shift']());}};_0x109f1f(++_0xd190e4);}(_0xd17f,0x13f));var _0xfd17=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd17f[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0xfd17('0x0'));var _=require(_0xfd17('0x1'));var moment=require(_0xfd17('0x2'));var ami=require('../ami');var logger=require(_0xfd17('0x3'))(_0xfd17('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xfd17('0x5'));function Acw(_0x406a48){this['voiceQueues']=_0x406a48[_0xfd17('0x6')];this[_0xfd17('0x7')]=_0x406a48[_0xfd17('0x7')];this[_0xfd17('0x8')]=_0x406a48[_0xfd17('0x8')];this[_0xfd17('0x9')]={};ami['on'](_0xfd17('0xa'),this['syncAgentConnect'][_0xfd17('0xb')](this));ami['on'](_0xfd17('0xc'),this['syncHangupRequest'][_0xfd17('0xb')](this));ami['on'](_0xfd17('0xd'),this[_0xfd17('0xe')][_0xfd17('0xb')](this));ami['on'](_0xfd17('0xf'),this[_0xfd17('0x10')][_0xfd17('0xb')](this));ami['on']('attendedtransfer',this[_0xfd17('0x11')][_0xfd17('0xb')](this));ami['on']('blindtransfer',this[_0xfd17('0x12')][_0xfd17('0xb')](this));ami['on'](_0xfd17('0x13'),this[_0xfd17('0x14')][_0xfd17('0xb')](this));}function getDiff(_0x41b0ff){var _0x2ad6ba=moment()[_0xfd17('0x15')](0x0);var _0x55acc1=moment(_0x41b0ff)[_0xfd17('0x15')](0x0);return _0x2ad6ba['diff'](_0x55acc1,_0xfd17('0x16'));}Acw[_0xfd17('0x17')][_0xfd17('0x18')]=function(_0x47a37f){try{var _0x148545=this;var _0x1ffd8a=this[_0xfd17('0x9')][_0x47a37f]['interface'];var _0xdb3343=this[_0xfd17('0x9')][_0x47a37f][_0xfd17('0x19')];var _0x14ccda=this[_0xfd17('0x6')][_0xdb3343];var _0xc7d8c0=![];var _0x5dfe57=_0xfd17('0x1a');if(_0x14ccda[_0xfd17('0x1b')]){if(_0x14ccda[_0xfd17('0x1c')]['name']){_0xc7d8c0=!![];_0x5dfe57=_0x14ccda[_0xfd17('0x1c')][_0xfd17('0x1d')];}}ami[_0xfd17('0x1e')]({'action':'QueuePause','interface':_0x1ffd8a,'paused':!![],'reason':_0x5dfe57})[_0xfd17('0x1f')](function(_0x23ce15){if(_0x148545[_0xfd17('0x7')][_0x1ffd8a]){return RpcUser[_0xfd17('0x20')](_0x148545[_0xfd17('0x7')][_0x1ffd8a]['id'])['then'](function(_0x49c5f8){if(_0x49c5f8&&!_0x49c5f8[_0xfd17('0x21')]){logger[_0xfd17('0x22')](_0xfd17('0x23'),_0x47a37f,_0x1ffd8a,_0xdb3343);var _0x1637e5=_0x148545[_0xfd17('0x9')][_0x47a37f][_0xfd17('0x24')]&&_0x148545[_0xfd17('0x9')][_0x47a37f][_0xfd17('0x25')]?_0x148545[_0xfd17('0x9')][_0x47a37f]['destlinkedid']:_0x47a37f;return RpcUser['savePause'](_0x148545[_0xfd17('0x7')][_0x1ffd8a],_0x5dfe57,_0x1637e5)[_0xfd17('0x1f')](function(_0x511853){if(!_0xc7d8c0){_0x148545['timers'][_0x1ffd8a]={};logger[_0xfd17('0x22')](_0xfd17('0x26'),_0x47a37f,_0x148545[_0xfd17('0x6')][_0xdb3343][_0xfd17('0x27')],_0x1ffd8a,_0xdb3343);_0x148545[_0xfd17('0x8')][_0x1ffd8a][_0xfd17('0x28')]=setTimeout(_0x148545[_0xfd17('0x29')]['bind'](_0x148545,_0x1ffd8a),_0x148545[_0xfd17('0x6')][_0xdb3343][_0xfd17('0x27')]*0x3e8);_0x148545[_0xfd17('0x8')][_0x1ffd8a][_0xfd17('0x2a')]=moment()[_0xfd17('0x2b')](_0xfd17('0x2c'));_0x148545['timers'][_0x1ffd8a]['uniqueid']=_0x47a37f;_0x148545[_0xfd17('0x8')][_0x1ffd8a]['queue']=_0xdb3343;_0x148545[_0xfd17('0x8')][_0x1ffd8a][_0xfd17('0x2d')]=function(){var _0x2c7b1b=getDiff(_0x148545[_0xfd17('0x8')][_0x1ffd8a]['lastPauseAt']);clearTimeout(_0x148545[_0xfd17('0x8')][_0x1ffd8a][_0xfd17('0x28')]);_0x148545[_0xfd17('0x8')][_0x1ffd8a][_0xfd17('0x28')]=![];RpcVoiceAgentReport[_0xfd17('0x2e')]({'acwtime':_0x2c7b1b},_0x148545['timers'][_0x1ffd8a][_0xfd17('0x2f')],_0x1ffd8a)[_0xfd17('0x1f')](function(_0x350c54){logger[_0xfd17('0x22')](_0xfd17('0x30'),_0x47a37f,_0x2c7b1b,_0x350c54);})[_0xfd17('0x31')](function(_0xc2f08){logger[_0xfd17('0x32')](_0xfd17('0x33'),_0x47a37f,_0xc2f08);});delete _0x148545['timers'][_0x1ffd8a];};}});}else{logger['info'](_0xfd17('0x34'),_0x47a37f,_0x1ffd8a,_0xdb3343);}});}})[_0xfd17('0x31')](function(_0x2d48d8){logger[_0xfd17('0x32')](_0xfd17('0x26'),_0x47a37f,_0x148545[_0xfd17('0x6')][_0xdb3343][_0xfd17('0x27')],_0x1ffd8a,_0xdb3343);})[_0xfd17('0x35')](function(){delete _0x148545[_0xfd17('0x9')][_0x47a37f];});}catch(_0x4472c4){logger[_0xfd17('0x32')](_0xfd17('0x36'),_0x4472c4['message']);}};Acw[_0xfd17('0x17')][_0xfd17('0x29')]=function(_0x100baa){try{var _0x245b81=this;if(_0x245b81[_0xfd17('0x8')][_0x100baa]){_0x245b81[_0xfd17('0x8')][_0x100baa][_0xfd17('0x28')]=![];var _0x44df9d=_0x245b81['timers'][_0x100baa][_0xfd17('0x2f')];var _0xeade98=_0x245b81[_0xfd17('0x8')][_0x100baa][_0xfd17('0x19')];var _0x5f5715=_0x245b81['voiceQueues'][_0xeade98][_0xfd17('0x27')];logger[_0xfd17('0x22')](_0xfd17('0x37'),_0x44df9d,_0x100baa);RpcUser[_0xfd17('0x38')](this[_0xfd17('0x7')][_0x100baa]);RpcVoiceAgentReport[_0xfd17('0x2e')]({'acwtime':_0x5f5715,'agentacw':!![]},_0x44df9d,_0x100baa)['then'](function(_0x276bc4){logger[_0xfd17('0x22')](_0xfd17('0x30'),_0x44df9d,_0x5f5715,_0x276bc4);})['catch'](function(_0x1f2401){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x44df9d,_0x1f2401);});}else{logger[_0xfd17('0x32')](_0xfd17('0x39'),_0x100baa);if(_0x245b81[_0xfd17('0x8')]){logger['info'](_0xfd17('0x3a'),JSON[_0xfd17('0x3b')](_0x245b81[_0xfd17('0x8')]));}}}catch(_0x4b2c26){logger[_0xfd17('0x32')](_0xfd17('0x3c'),_0x4b2c26[_0xfd17('0x3d')]);}};Acw[_0xfd17('0x17')]['syncAgentConnect']=function(_0x559dc0){try{if(this['voiceQueues'][_0x559dc0[_0xfd17('0x19')]]&&(this[_0xfd17('0x6')][_0x559dc0[_0xfd17('0x19')]][_0xfd17('0x4')]||this['voiceQueues'][_0x559dc0[_0xfd17('0x19')]][_0xfd17('0x1b')])){if(this[_0xfd17('0x7')][_0x559dc0[_0xfd17('0x3e')]]){this[_0xfd17('0x9')][_0x559dc0[_0xfd17('0x2f')]]={'queue':_0x559dc0[_0xfd17('0x19')],'interface':_0x559dc0[_0xfd17('0x3e')],'destlinkedid':_0x559dc0[_0xfd17('0x25')]};}}}catch(_0x5cae41){logger[_0xfd17('0x32')](_0xfd17('0x3f'),_0x5cae41[_0xfd17('0x3d')]);}};Acw[_0xfd17('0x17')]['syncAgentConnectPreview']=function(_0x2ad83b){try{if(this[_0xfd17('0x6')][_0x2ad83b[_0xfd17('0x19')]]&&(this[_0xfd17('0x6')][_0x2ad83b[_0xfd17('0x19')]]['acw']||this['voiceQueues'][_0x2ad83b['queue']]['mandatoryDisposition'])){if(this[_0xfd17('0x7')][_0x2ad83b['interface']]){this[_0xfd17('0x9')][_0x2ad83b[_0xfd17('0x2f')]]={'queue':_0x2ad83b[_0xfd17('0x19')],'interface':_0x2ad83b[_0xfd17('0x3e')]};}}}catch(_0x27cfe6){logger['error'](_0xfd17('0x40'),_0x27cfe6[_0xfd17('0x3d')]);}};Acw['prototype'][_0xfd17('0x41')]=function(_0x17b9e2){try{if(this[_0xfd17('0x9')][_0x17b9e2[_0xfd17('0x2f')]]&&_[_0xfd17('0x42')](this[_0xfd17('0x9')][_0x17b9e2[_0xfd17('0x2f')]][_0xfd17('0x24')])){logger['info'](_0xfd17('0x43'),_0x17b9e2[_0xfd17('0x2f')]);this[_0xfd17('0x18')](_0x17b9e2[_0xfd17('0x2f')]);}else if(this[_0xfd17('0x9')][_0x17b9e2['linkedid']]&&_[_0xfd17('0x42')](this['channels'][_0x17b9e2['linkedid']]['attended'])){logger[_0xfd17('0x22')]('[%s][HANGUP:LINKEDID]',_0x17b9e2['linkedid']);this['startAcw'](_0x17b9e2[_0xfd17('0x44')]);}}catch(_0x37e50f){logger['error'](_0xfd17('0x45'),_0x37e50f[_0xfd17('0x3d')]);}};Acw[_0xfd17('0x17')]['syncHangup']=function(_0x1c9585){try{if(this[_0xfd17('0x9')][_0x1c9585[_0xfd17('0x2f')]]&&this['channels'][_0x1c9585[_0xfd17('0x2f')]][_0xfd17('0x24')]){logger[_0xfd17('0x22')](_0xfd17('0x46'),_0x1c9585[_0xfd17('0x2f')]);this[_0xfd17('0x18')](_0x1c9585['uniqueid']);}else if(this[_0xfd17('0x9')][_0x1c9585[_0xfd17('0x44')]]&&this[_0xfd17('0x9')][_0x1c9585[_0xfd17('0x44')]][_0xfd17('0x24')]){logger[_0xfd17('0x22')](_0xfd17('0x47'),_0x1c9585[_0xfd17('0x44')]);this['startAcw'](_0x1c9585['linkedid']);}}catch(_0x44787e){logger[_0xfd17('0x32')](_0xfd17('0x48'),_0x44787e[_0xfd17('0x3d')]);}};Acw[_0xfd17('0x17')][_0xfd17('0x11')]=function(_0x25f9db){try{if(!_[_0xfd17('0x49')](this[_0xfd17('0x9')][_0x25f9db[_0xfd17('0x4a')]])){this['startAcw'](_0x25f9db[_0xfd17('0x4a')]);if(this['channels'][_0x25f9db[_0xfd17('0x4b')]]){this[_0xfd17('0x9')][_0x25f9db[_0xfd17('0x4b')]][_0xfd17('0x24')]=!![];this[_0xfd17('0x9')][_0x25f9db[_0xfd17('0x4c')]]=this[_0xfd17('0x9')][_0x25f9db['secondtransfereruniqueid']];delete this[_0xfd17('0x9')][_0x25f9db[_0xfd17('0x4b')]];}}else if(!_[_0xfd17('0x49')](this[_0xfd17('0x9')][_0x25f9db['transfertargetuniqueid']])){this[_0xfd17('0x18')](_0x25f9db[_0xfd17('0x4c')]);if(this[_0xfd17('0x9')][_0x25f9db[_0xfd17('0x4d')]]){this['channels'][_0x25f9db['origtransfereruniqueid']][_0xfd17('0x24')]=!![];this['channels'][_0x25f9db[_0xfd17('0x4a')]]=this['channels'][_0x25f9db[_0xfd17('0x4d')]];delete this[_0xfd17('0x9')][_0x25f9db[_0xfd17('0x4d')]];}}}catch(_0x1d26a0){logger[_0xfd17('0x32')](_0xfd17('0x4e'),_0x1d26a0[_0xfd17('0x3d')]);}};Acw['prototype'][_0xfd17('0x12')]=function(_0x25fd94){try{if(this[_0xfd17('0x9')][_0x25fd94[_0xfd17('0x4f')]]){logger[_0xfd17('0x22')](_0xfd17('0x50'),JSON[_0xfd17('0x3b')](_0x25fd94[_0xfd17('0x4f')]));this[_0xfd17('0x18')](_0x25fd94['transfereruniqueid']);}else if(this['channels'][_0x25fd94[_0xfd17('0x51')]]){logger[_0xfd17('0x22')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x25fd94[_0xfd17('0x51')]));this[_0xfd17('0x18')](_0x25fd94[_0xfd17('0x51')]);}}catch(_0x336013){logger[_0xfd17('0x32')]('[ACW][syncBlindTransfer]\x20%s',_0x336013['message']);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x2ad3b7){try{if(this[_0xfd17('0x6')][_0x2ad3b7[_0xfd17('0x19')]]&&this[_0xfd17('0x6')][_0x2ad3b7[_0xfd17('0x19')]][_0xfd17('0x52')]===_0xfd17('0x53')){if(this[_0xfd17('0x7')][_0x2ad3b7[_0xfd17('0x3e')]]){logger['info'](_0xfd17('0x54'),_0x2ad3b7[_0xfd17('0x2f')],_0x2ad3b7[_0xfd17('0x3e')],_0x2ad3b7[_0xfd17('0x19')]);return RpcUser['savePause'](this[_0xfd17('0x7')][_0x2ad3b7['interface']],'Auto-Pause',_0x2ad3b7[_0xfd17('0x2f')]);}}}catch(_0x4233d2){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x4233d2[_0xfd17('0x3d')]);}};module[_0xfd17('0x55')]=Acw; \ No newline at end of file +var _0x2ba8=['syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','milliseconds','diff','prototype','startAcw','interface','queue','mandatoryDisposition','name','mandatoryDispositionPause','QueuePause','getAgent','info','destlinkedid','savePause','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','format','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup'];(function(_0x5d5171,_0x176f5d){var _0x431958=function(_0x4a2df7){while(--_0x4a2df7){_0x5d5171['push'](_0x5d5171['shift']());}};_0x431958(++_0x176f5d);}(_0x2ba8,0x18d));var _0x82ba=function(_0x3353cb,_0x235a81){_0x3353cb=_0x3353cb-0x0;var _0x461146=_0x2ba8[_0x3353cb];return _0x461146;};'use strict';var util=require(_0x82ba('0x0'));var _=require(_0x82ba('0x1'));var moment=require(_0x82ba('0x2'));var ami=require(_0x82ba('0x3'));var logger=require(_0x82ba('0x4'))(_0x82ba('0x5'));var RpcUser=require(_0x82ba('0x6'));var RpcVoiceAgentReport=require(_0x82ba('0x7'));function Acw(_0x39649d){this['voiceQueues']=_0x39649d[_0x82ba('0x8')];this[_0x82ba('0x9')]=_0x39649d['agents'];this[_0x82ba('0xa')]=_0x39649d[_0x82ba('0xa')];this[_0x82ba('0xb')]={};ami['on'](_0x82ba('0xc'),this[_0x82ba('0xd')][_0x82ba('0xe')](this));ami['on'](_0x82ba('0xf'),this[_0x82ba('0x10')][_0x82ba('0xe')](this));ami['on'](_0x82ba('0x11'),this[_0x82ba('0x12')][_0x82ba('0xe')](this));ami['on'](_0x82ba('0x13'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x82ba('0x14'),this[_0x82ba('0x15')][_0x82ba('0xe')](this));ami['on'](_0x82ba('0x16'),this['syncBlindTransfer']['bind'](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x1433f9){var _0x42e373=moment()[_0x82ba('0x17')](0x0);var _0x591b23=moment(_0x1433f9)[_0x82ba('0x17')](0x0);return _0x42e373[_0x82ba('0x18')](_0x591b23,'seconds');}Acw[_0x82ba('0x19')][_0x82ba('0x1a')]=function(_0x3f44fa){try{var _0x55799e=this;var _0x162d81=this[_0x82ba('0xb')][_0x3f44fa][_0x82ba('0x1b')];var _0x15fd29=this['channels'][_0x3f44fa][_0x82ba('0x1c')];var _0x34626b=this['voiceQueues'][_0x15fd29];var _0x3f1b51=![];var _0x4ae607='ACW';if(_0x34626b[_0x82ba('0x1d')]){if(_0x34626b['mandatoryDispositionPause'][_0x82ba('0x1e')]){_0x3f1b51=!![];_0x4ae607=_0x34626b[_0x82ba('0x1f')][_0x82ba('0x1e')];}}ami['Action']({'action':_0x82ba('0x20'),'interface':_0x162d81,'paused':!![],'reason':_0x4ae607})['then'](function(_0x96901a){if(_0x55799e[_0x82ba('0x9')][_0x162d81]){return RpcUser[_0x82ba('0x21')](_0x55799e[_0x82ba('0x9')][_0x162d81]['id'])['then'](function(_0x231d4f){if(_0x231d4f&&!_0x231d4f['voicePause']){logger[_0x82ba('0x22')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x3f44fa,_0x162d81,_0x15fd29);var _0x4166d9=_0x55799e['channels'][_0x3f44fa]['attended']&&_0x55799e[_0x82ba('0xb')][_0x3f44fa][_0x82ba('0x23')]?_0x55799e[_0x82ba('0xb')][_0x3f44fa][_0x82ba('0x23')]:_0x3f44fa;return RpcUser[_0x82ba('0x24')](_0x55799e[_0x82ba('0x9')][_0x162d81],_0x4ae607,_0x4166d9)[_0x82ba('0x25')](function(_0xd8bfed){if(!_0x3f1b51){_0x55799e['timers'][_0x162d81]={};logger['info'](_0x82ba('0x26'),_0x3f44fa,_0x55799e[_0x82ba('0x8')][_0x15fd29]['acwTimeout'],_0x162d81,_0x15fd29);_0x55799e[_0x82ba('0xa')][_0x162d81][_0x82ba('0x27')]=setTimeout(_0x55799e[_0x82ba('0x28')][_0x82ba('0xe')](_0x55799e,_0x162d81),_0x55799e[_0x82ba('0x8')][_0x15fd29][_0x82ba('0x29')]*0x3e8);_0x55799e[_0x82ba('0xa')][_0x162d81][_0x82ba('0x2a')]=moment()[_0x82ba('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');_0x55799e[_0x82ba('0xa')][_0x162d81]['uniqueid']=_0x3f44fa;_0x55799e[_0x82ba('0xa')][_0x162d81][_0x82ba('0x1c')]=_0x15fd29;_0x55799e[_0x82ba('0xa')][_0x162d81]['updateAcw']=function(){var _0x27fc4f=getDiff(_0x55799e['timers'][_0x162d81][_0x82ba('0x2a')]);clearTimeout(_0x55799e[_0x82ba('0xa')][_0x162d81][_0x82ba('0x27')]);_0x55799e[_0x82ba('0xa')][_0x162d81][_0x82ba('0x27')]=![];RpcVoiceAgentReport[_0x82ba('0x2c')]({'acwtime':_0x27fc4f},_0x55799e['timers'][_0x162d81][_0x82ba('0x2d')],_0x162d81)[_0x82ba('0x25')](function(_0x2ec4c2){logger[_0x82ba('0x22')](_0x82ba('0x2e'),_0x3f44fa,_0x27fc4f,_0x2ec4c2);})[_0x82ba('0x2f')](function(_0x456fe6){logger[_0x82ba('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x3f44fa,_0x456fe6);});delete _0x55799e[_0x82ba('0xa')][_0x162d81];};}});}else{logger[_0x82ba('0x22')](_0x82ba('0x31'),_0x3f44fa,_0x162d81,_0x15fd29);}});}})[_0x82ba('0x2f')](function(_0x441974){logger['error'](_0x82ba('0x26'),_0x3f44fa,_0x55799e[_0x82ba('0x8')][_0x15fd29][_0x82ba('0x29')],_0x162d81,_0x15fd29);})[_0x82ba('0x32')](function(){delete _0x55799e[_0x82ba('0xb')][_0x3f44fa];});}catch(_0xe1e8af){logger[_0x82ba('0x30')]('[ACW][START]\x20%s',_0xe1e8af[_0x82ba('0x33')]);}};Acw[_0x82ba('0x19')]['stopAcw']=function(_0x2798df){try{var _0x25750d=this;if(_0x25750d['timers'][_0x2798df]){_0x25750d[_0x82ba('0xa')][_0x2798df][_0x82ba('0x27')]=![];var _0x4a297f=_0x25750d[_0x82ba('0xa')][_0x2798df][_0x82ba('0x2d')];var _0x39ddd6=_0x25750d[_0x82ba('0xa')][_0x2798df][_0x82ba('0x1c')];var _0x21a1d5=_0x25750d[_0x82ba('0x8')][_0x39ddd6]['acwTimeout'];logger[_0x82ba('0x22')](_0x82ba('0x34'),_0x4a297f,_0x2798df);RpcUser[_0x82ba('0x35')](this[_0x82ba('0x9')][_0x2798df]);RpcVoiceAgentReport[_0x82ba('0x2c')]({'acwtime':_0x21a1d5,'agentacw':!![]},_0x4a297f,_0x2798df)['then'](function(_0x3d1ce9){logger[_0x82ba('0x22')](_0x82ba('0x2e'),_0x4a297f,_0x21a1d5,_0x3d1ce9);})[_0x82ba('0x2f')](function(_0x5ac5ef){logger[_0x82ba('0x30')](_0x82ba('0x36'),_0x4a297f,_0x5ac5ef);});}else{logger[_0x82ba('0x30')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x2798df);if(_0x25750d[_0x82ba('0xa')]){logger['info']('[ACW][TIMERS]',JSON['stringify'](_0x25750d['timers']));}}}catch(_0x5edcc8){logger['error'](_0x82ba('0x37'),_0x5edcc8[_0x82ba('0x33')]);}};Acw['prototype'][_0x82ba('0xd')]=function(_0x232e8a){try{if(this['voiceQueues'][_0x232e8a[_0x82ba('0x1c')]]&&(this[_0x82ba('0x8')][_0x232e8a[_0x82ba('0x1c')]][_0x82ba('0x5')]||this[_0x82ba('0x8')][_0x232e8a[_0x82ba('0x1c')]][_0x82ba('0x1d')])){if(this[_0x82ba('0x9')][_0x232e8a[_0x82ba('0x1b')]]){this[_0x82ba('0xb')][_0x232e8a[_0x82ba('0x2d')]]={'queue':_0x232e8a['queue'],'interface':_0x232e8a[_0x82ba('0x1b')],'destlinkedid':_0x232e8a['destlinkedid']};}}}catch(_0x3f9604){logger[_0x82ba('0x30')](_0x82ba('0x38'),_0x3f9604[_0x82ba('0x33')]);}};Acw[_0x82ba('0x19')]['syncAgentConnectPreview']=function(_0x2a7f25){try{if(this[_0x82ba('0x8')][_0x2a7f25[_0x82ba('0x1c')]]&&(this[_0x82ba('0x8')][_0x2a7f25[_0x82ba('0x1c')]][_0x82ba('0x5')]||this[_0x82ba('0x8')][_0x2a7f25[_0x82ba('0x1c')]][_0x82ba('0x1d')])){if(this[_0x82ba('0x9')][_0x2a7f25[_0x82ba('0x1b')]]){this[_0x82ba('0xb')][_0x2a7f25[_0x82ba('0x2d')]]={'queue':_0x2a7f25[_0x82ba('0x1c')],'interface':_0x2a7f25['interface']};}}}catch(_0x1aff8c){logger['error'](_0x82ba('0x39'),_0x1aff8c[_0x82ba('0x33')]);}};Acw[_0x82ba('0x19')][_0x82ba('0x10')]=function(_0x4de3cb){try{if(this[_0x82ba('0xb')][_0x4de3cb['uniqueid']]&&_[_0x82ba('0x3a')](this[_0x82ba('0xb')][_0x4de3cb[_0x82ba('0x2d')]]['attended'])){logger[_0x82ba('0x22')]('[%s][HANGUP:UNIQUEID]',_0x4de3cb[_0x82ba('0x2d')]);this[_0x82ba('0x1a')](_0x4de3cb[_0x82ba('0x2d')]);}else if(this[_0x82ba('0xb')][_0x4de3cb[_0x82ba('0x3b')]]&&_['isUndefined'](this[_0x82ba('0xb')][_0x4de3cb[_0x82ba('0x3b')]][_0x82ba('0x3c')])){logger[_0x82ba('0x22')](_0x82ba('0x3d'),_0x4de3cb['linkedid']);this[_0x82ba('0x1a')](_0x4de3cb[_0x82ba('0x3b')]);}}catch(_0x3aaba2){logger['error'](_0x82ba('0x3e'),_0x3aaba2[_0x82ba('0x33')]);}};Acw[_0x82ba('0x19')][_0x82ba('0x12')]=function(_0x2e1880){try{if(this[_0x82ba('0xb')][_0x2e1880['uniqueid']]&&this[_0x82ba('0xb')][_0x2e1880[_0x82ba('0x2d')]][_0x82ba('0x3c')]){logger[_0x82ba('0x22')](_0x82ba('0x3f'),_0x2e1880['uniqueid']);this[_0x82ba('0x1a')](_0x2e1880[_0x82ba('0x2d')]);}else if(this['channels'][_0x2e1880[_0x82ba('0x3b')]]&&this[_0x82ba('0xb')][_0x2e1880[_0x82ba('0x3b')]][_0x82ba('0x3c')]){logger[_0x82ba('0x22')](_0x82ba('0x40'),_0x2e1880[_0x82ba('0x3b')]);this[_0x82ba('0x1a')](_0x2e1880[_0x82ba('0x3b')]);}}catch(_0x25c387){logger[_0x82ba('0x30')](_0x82ba('0x41'),_0x25c387[_0x82ba('0x33')]);}};Acw[_0x82ba('0x19')][_0x82ba('0x15')]=function(_0x2f46d4){try{if(!_[_0x82ba('0x42')](this[_0x82ba('0xb')][_0x2f46d4[_0x82ba('0x43')]])){this['startAcw'](_0x2f46d4[_0x82ba('0x43')]);if(this['channels'][_0x2f46d4[_0x82ba('0x44')]]){this['channels'][_0x2f46d4[_0x82ba('0x44')]][_0x82ba('0x3c')]=!![];this['channels'][_0x2f46d4[_0x82ba('0x45')]]=this[_0x82ba('0xb')][_0x2f46d4['secondtransfereruniqueid']];delete this[_0x82ba('0xb')][_0x2f46d4[_0x82ba('0x44')]];}}else if(!_[_0x82ba('0x42')](this['channels'][_0x2f46d4[_0x82ba('0x45')]])){this[_0x82ba('0x1a')](_0x2f46d4[_0x82ba('0x45')]);if(this[_0x82ba('0xb')][_0x2f46d4[_0x82ba('0x46')]]){this[_0x82ba('0xb')][_0x2f46d4['origtransfereruniqueid']][_0x82ba('0x3c')]=!![];this[_0x82ba('0xb')][_0x2f46d4[_0x82ba('0x43')]]=this['channels'][_0x2f46d4[_0x82ba('0x46')]];delete this[_0x82ba('0xb')][_0x2f46d4[_0x82ba('0x46')]];}}}catch(_0x45fe8a){logger['error'](_0x82ba('0x47'),_0x45fe8a['message']);}};Acw[_0x82ba('0x19')]['syncBlindTransfer']=function(_0x33e2b3){try{if(this[_0x82ba('0xb')][_0x33e2b3['transfereruniqueid']]){logger['info'](_0x82ba('0x48'),JSON[_0x82ba('0x49')](_0x33e2b3[_0x82ba('0x4a')]));this[_0x82ba('0x1a')](_0x33e2b3[_0x82ba('0x4a')]);}else if(this[_0x82ba('0xb')][_0x33e2b3[_0x82ba('0x4b')]]){logger[_0x82ba('0x22')](_0x82ba('0x4c'),JSON['stringify'](_0x33e2b3[_0x82ba('0x4b')]));this[_0x82ba('0x1a')](_0x33e2b3[_0x82ba('0x4b')]);}}catch(_0x24bc7b){logger['error'](_0x82ba('0x4d'),_0x24bc7b[_0x82ba('0x33')]);}};Acw[_0x82ba('0x19')][_0x82ba('0x4e')]=function(_0xe3df90){try{if(this['voiceQueues'][_0xe3df90['queue']]&&this[_0x82ba('0x8')][_0xe3df90['queue']][_0x82ba('0x4f')]===_0x82ba('0x50')){if(this[_0x82ba('0x9')][_0xe3df90['interface']]){logger['info'](_0x82ba('0x51'),_0xe3df90[_0x82ba('0x2d')],_0xe3df90[_0x82ba('0x1b')],_0xe3df90[_0x82ba('0x1c')]);return RpcUser[_0x82ba('0x24')](this[_0x82ba('0x9')][_0xe3df90[_0x82ba('0x1b')]],'Auto-Pause',_0xe3df90[_0x82ba('0x2d')]);}}}catch(_0x40042f){logger[_0x82ba('0x30')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x40042f['message']);}};module[_0x82ba('0x52')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 1f755f5..31a67e3 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 _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x154ac3,_0x550800){var _0x1d3a71=function(_0x36e7bf){while(--_0x36e7bf){_0x154ac3['push'](_0x154ac3['shift']());}};_0x1d3a71(++_0x550800);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file +var _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0xd73d3,_0x392d57){var _0x126331=function(_0x12c4f9){while(--_0x12c4f9){_0xd73d3['push'](_0xd73d3['shift']());}};_0x126331(++_0x392d57);}(_0x757a,0xde));var _0xa757=function(_0x58ee94,_0xfa0b16){_0x58ee94=_0x58ee94-0x0;var _0x281361=_0x757a[_0x58ee94];return _0x281361;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 51f12f1..9ff0235 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 _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x471dbb,_0x50a0ed){var _0x16911f=function(_0x9ca5b4){while(--_0x9ca5b4){_0x471dbb['push'](_0x471dbb['shift']());}};_0x16911f(++_0x50a0ed);}(_0xf4eb,0xec));var _0xbf4e=function(_0x193de1,_0x4fa18f){_0x193de1=_0x193de1-0x0;var _0x238912=_0xf4eb[_0x193de1];return _0x238912;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file +var _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x47d4df,_0x437fa4){var _0x5e0ec7=function(_0x41e280){while(--_0x41e280){_0x47d4df['push'](_0x47d4df['shift']());}};_0x5e0ec7(++_0x437fa4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x186b7a,_0x4b7c56){_0x186b7a=_0x186b7a-0x0;var _0x191cc0=_0xf4eb[_0x186b7a];return _0x191cc0;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index f61fafe..b3a9054 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53c2=['originatecalleridname','prototype','getCaller','format','dialCutDigit','queue','exports','util','lodash','moment','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum'];(function(_0x45c7c5,_0x43520e){var _0x596a3e=function(_0x3158c4){while(--_0x3158c4){_0x45c7c5['push'](_0x45c7c5['shift']());}};_0x596a3e(++_0x43520e);}(_0x53c2,0x15f));var _0x253c=function(_0x2ecc30,_0x1b0547){_0x2ecc30=_0x2ecc30-0x0;var _0x2ffa7e=_0x53c2[_0x2ecc30];return _0x2ffa7e;};'use strict';var util=require(_0x253c('0x0'));var _=require(_0x253c('0x1'));var moment=require(_0x253c('0x2'));function checkNameSurname(_0x11ff81,_0x1ae5bb,_0x2fcc7d){var _0x47a0e8='';if(!_['isNil'](_0x1ae5bb)&&'string'===typeof _0x1ae5bb){_0x47a0e8+=_0x1ae5bb;}if(!_['isNil'](_0x2fcc7d)&&_0x253c('0x3')===typeof _0x2fcc7d){_0x47a0e8+='\x20'+_0x2fcc7d;}if(_0x47a0e8!==''){return _0x47a0e8;}return _0x11ff81;}function Action(_0xee2d4,_0x411cf1,_0x49b368){this[_0x253c('0x4')]=_0xee2d4;this[_0x253c('0x5')]=_0x49b368||undefined;this[_0x253c('0x6')]=checkNameSurname(_0x411cf1[_0x253c('0x7')][_0x253c('0x8')],_0x411cf1[_0x253c('0x7')][_0x253c('0x9')],_0x411cf1[_0x253c('0x7')][_0x253c('0xa')]);this[_0x253c('0xb')]=_0x411cf1[_0x253c('0x8')];this['queue']=_0xee2d4[_0x253c('0x6')];this[_0x253c('0xc')]=_0x411cf1[_0x253c('0xc')]||![];this[_0x253c('0xd')]=_0xee2d4[_0x253c('0xd')];this[_0x253c('0xe')]=_0xee2d4[_0x253c('0xe')]||0x3;this[_0x253c('0xf')]=_0x411cf1[_0x253c('0xf')];this[_0x253c('0x10')]=_0x411cf1[_0x253c('0x10')];this[_0x253c('0x11')]=_0x411cf1['countcongestionretry'];this[_0x253c('0x12')]=_0x411cf1[_0x253c('0x12')];this[_0x253c('0x13')]=_0x411cf1[_0x253c('0x13')];this[_0x253c('0x14')]=_0x411cf1[_0x253c('0x14')];this[_0x253c('0x15')]=_0x411cf1['countabandonedretry'];this[_0x253c('0x16')]=_0x411cf1[_0x253c('0x16')];this[_0x253c('0x17')]=_0x411cf1[_0x253c('0x17')];this[_0x253c('0x18')]=_0x411cf1['ContactId'];this[_0x253c('0x19')]=_0x411cf1['ListId'];this[_0x253c('0x1a')]=_0x411cf1[_0x253c('0x1a')];this[_0x253c('0x1b')]=_0x411cf1[_0x253c('0x1b')];this[_0x253c('0x1c')]=_0x411cf1[_0x253c('0x1c')];this['idHopper']=_0x411cf1['id'];this['ContactFirstName']=_0x411cf1[_0x253c('0x7')][_0x253c('0x9')]||'';this[_0x253c('0x1d')]=moment()['format'](_0x253c('0x1e'));this[_0x253c('0x1f')]=_0x411cf1[_0x253c('0x1f')];this[_0x253c('0x20')]=_0x411cf1[_0x253c('0x20')];this[_0x253c('0x21')]=_0x411cf1['callbackat'];this[_0x253c('0x22')]=_0x411cf1[_0x253c('0x22')];this[_0x253c('0x23')]='';this[_0x253c('0x24')]='';}Action[_0x253c('0x25')][_0x253c('0x26')]=function(){return util[_0x253c('0x27')]('\x22%s\x22\x20<%s>',this[_0x253c('0x6')],this[_0x253c('0x4')][_0x253c('0x28')]>0x0?this[_0x253c('0xb')]['substring'](this[_0x253c('0x4')][_0x253c('0x28')]):this[_0x253c('0xb')]);};Action[_0x253c('0x25')]['getQueue']=function(){return this[_0x253c('0x29')];};module[_0x253c('0x2a')]=Action; \ No newline at end of file +var _0x3010=['ListId','UserId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','getQueue','exports','lodash','isNil','string','voiceQueue','name','phone','Contact','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId'];(function(_0x3660fe,_0x591050){var _0x2986c2=function(_0x604063){while(--_0x604063){_0x3660fe['push'](_0x3660fe['shift']());}};_0x2986c2(++_0x591050);}(_0x3010,0x152));var _0x0301=function(_0x68a3f,_0x48d861){_0x68a3f=_0x68a3f-0x0;var _0x7ee19f=_0x3010[_0x68a3f];return _0x7ee19f;};'use strict';var util=require('util');var _=require(_0x0301('0x0'));var moment=require('moment');function checkNameSurname(_0x36becd,_0x1f5d3c,_0x69fe0f){var _0x27c211='';if(!_[_0x0301('0x1')](_0x1f5d3c)&&_0x0301('0x2')===typeof _0x1f5d3c){_0x27c211+=_0x1f5d3c;}if(!_[_0x0301('0x1')](_0x69fe0f)&&_0x0301('0x2')===typeof _0x69fe0f){_0x27c211+='\x20'+_0x69fe0f;}if(_0x27c211!==''){return _0x27c211;}return _0x36becd;}function Action(_0x249dad,_0x5d4142,_0x5d2c63){this[_0x0301('0x3')]=_0x249dad;this['uniqueid']=_0x5d2c63||undefined;this[_0x0301('0x4')]=checkNameSurname(_0x5d4142['Contact'][_0x0301('0x5')],_0x5d4142[_0x0301('0x6')]['firstName'],_0x5d4142['Contact'][_0x0301('0x7')]);this['number']=_0x5d4142[_0x0301('0x5')];this[_0x0301('0x8')]=_0x249dad[_0x0301('0x4')];this[_0x0301('0x9')]=_0x5d4142[_0x0301('0x9')]||![];this[_0x0301('0xa')]=_0x249dad[_0x0301('0xa')];this[_0x0301('0xb')]=_0x249dad[_0x0301('0xb')]||0x3;this['scheduledat']=_0x5d4142[_0x0301('0xc')];this[_0x0301('0xd')]=_0x5d4142[_0x0301('0xd')];this['countcongestionretry']=_0x5d4142[_0x0301('0xe')];this[_0x0301('0xf')]=_0x5d4142[_0x0301('0xf')];this[_0x0301('0x10')]=_0x5d4142['countnosuchnumberretry'];this[_0x0301('0x11')]=_0x5d4142[_0x0301('0x11')];this[_0x0301('0x12')]=_0x5d4142['countabandonedretry'];this[_0x0301('0x13')]=_0x5d4142[_0x0301('0x13')];this['countagentrejectretry']=_0x5d4142[_0x0301('0x14')];this[_0x0301('0x15')]=_0x5d4142[_0x0301('0x15')];this[_0x0301('0x16')]=_0x5d4142[_0x0301('0x16')];this[_0x0301('0x17')]=_0x5d4142[_0x0301('0x17')];this['VoiceQueueId']=_0x5d4142['VoiceQueueId'];this[_0x0301('0x18')]=_0x5d4142[_0x0301('0x18')];this[_0x0301('0x19')]=_0x5d4142['id'];this[_0x0301('0x1a')]=_0x5d4142[_0x0301('0x6')][_0x0301('0x1b')]||'';this[_0x0301('0x1c')]=moment()[_0x0301('0x1d')](_0x0301('0x1e'));this[_0x0301('0x1f')]=_0x5d4142['callback'];this[_0x0301('0x20')]=_0x5d4142[_0x0301('0x20')];this[_0x0301('0x21')]=_0x5d4142[_0x0301('0x21')];this['recallme']=_0x5d4142[_0x0301('0x22')];this[_0x0301('0x23')]='';this[_0x0301('0x24')]='';}Action[_0x0301('0x25')][_0x0301('0x26')]=function(){return util[_0x0301('0x1d')](_0x0301('0x27'),this[_0x0301('0x4')],this['voiceQueue'][_0x0301('0x28')]>0x0?this['number'][_0x0301('0x29')](this[_0x0301('0x3')]['dialCutDigit']):this[_0x0301('0x2a')]);};Action['prototype'][_0x0301('0x2b')]=function(){return this[_0x0301('0x8')];};module[_0x0301('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 98f20e6..34d36fe 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e24=['talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','ringtime','holdtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e24,0x167));var _0x43e2=function(_0x4083da,_0x7aee27){_0x4083da=_0x4083da-0x0;var _0x46dfcc=_0x3e24[_0x4083da];return _0x46dfcc;};'use strict';var util=require(_0x43e2('0x0'));var _=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));function getSeconds(_0x3e321a,_0x1f5951){var _0x582ca4=moment(_0x3e321a)[_0x43e2('0x3')](0x0);var _0x1ff04b=moment(_0x1f5951)['milliseconds'](0x0);return _0x582ca4[_0x43e2('0x4')](_0x1ff04b,_0x43e2('0x5'));}function AgentComplete(_0x1a89fc,_0x28b144){this[_0x43e2('0x6')]=0x4;this[_0x43e2('0x7')]=_0x43e2('0x8');this['scheduledat']=_0x1a89fc[_0x43e2('0x9')];this[_0x43e2('0xa')]=_0x1a89fc['type'];this[_0x43e2('0xb')]=_0x1a89fc[_0x43e2('0xa')]==='outbound'?_0x43e2('0xc'):_0x1a89fc[_0x43e2('0xa')];this['countbusyretry']=_0x1a89fc[_0x43e2('0xd')];this['countcongestionretry']=_0x1a89fc['countcongestionretry'];this['countnoanswerretry']=_0x1a89fc[_0x43e2('0xe')];this[_0x43e2('0xf')]=_0x1a89fc[_0x43e2('0xd')]+_0x1a89fc[_0x43e2('0x10')]+_0x1a89fc[_0x43e2('0xe')]+_0x1a89fc[_0x43e2('0x11')]+_0x1a89fc[_0x43e2('0x12')]+_0x1a89fc[_0x43e2('0x13')]+_0x1a89fc[_0x43e2('0x14')]+_0x1a89fc[_0x43e2('0x15')];this[_0x43e2('0x11')]=_0x1a89fc[_0x43e2('0x11')];this['countdropretry']=_0x1a89fc[_0x43e2('0x12')];this[_0x43e2('0x13')]=_0x1a89fc[_0x43e2('0x13')];this[_0x43e2('0x14')]=_0x1a89fc['countmachineretry'];this['countagentrejectretry']=_0x1a89fc[_0x43e2('0x15')];this[_0x43e2('0x16')]=_0x28b144[_0x43e2('0x16')];this[_0x43e2('0x17')]=_0x1a89fc[_0x43e2('0x18')];this[_0x43e2('0x19')]=_0x1a89fc[_0x43e2('0x1a')];this[_0x43e2('0x1b')]=_0x1a89fc[_0x43e2('0x1b')];this[_0x43e2('0x1c')]=_0x1a89fc['responsetime'];this[_0x43e2('0x1d')]=_0x1a89fc[_0x43e2('0x1d')];this['endtime']=moment()[_0x43e2('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x43e2('0x1f')]=getSeconds(_0x1a89fc[_0x43e2('0x1c')],_0x1a89fc[_0x43e2('0x1b')]);this[_0x43e2('0x20')]=getSeconds(_0x1a89fc[_0x43e2('0x1d')],_0x1a89fc['responsetime']);this[_0x43e2('0x21')]=getSeconds(this[_0x43e2('0x22')],_0x1a89fc[_0x43e2('0x1d')]);this['queue']=_0x28b144[_0x43e2('0xc')];this[_0x43e2('0x23')]=_0x28b144[_0x43e2('0x23')];this[_0x43e2('0x24')]=_0x28b144['reason'];this[_0x43e2('0x25')]=_0x1a89fc[_0x43e2('0x25')];this[_0x43e2('0x26')]=_0x1a89fc[_0x43e2('0x26')];this[_0x43e2('0x27')]=_0x1a89fc[_0x43e2('0x27')];this[_0x43e2('0x28')]=_0x1a89fc[_0x43e2('0x28')];this[_0x43e2('0x29')]=_0x1a89fc[_0x43e2('0x29')];this[_0x43e2('0x2a')]=_0x1a89fc[_0x43e2('0x2a')];this['UserId']=_0x1a89fc[_0x43e2('0x2b')];this[_0x43e2('0x2c')]=_0x1a89fc['VoiceQueueId'];this[_0x43e2('0x2d')]=_0x1a89fc[_0x43e2('0x2d')];this[_0x43e2('0x2e')]=_0x1a89fc[_0x43e2('0x2e')]||'';this[_0x43e2('0x2f')]=_0x1a89fc['originatecalleridname']||'';}module[_0x43e2('0x30')]=AgentComplete; \ No newline at end of file +var _0x384d=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countagentrejectretry','countdropretry','countmachineretry','name','calleridnum','number','starttime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','outbound','queue'];(function(_0x544fdd,_0x2c8e78){var _0x69b17c=function(_0x2722f8){while(--_0x2722f8){_0x544fdd['push'](_0x544fdd['shift']());}};_0x69b17c(++_0x2c8e78);}(_0x384d,0x167));var _0xd384=function(_0x5594e8,_0x3eb9a8){_0x5594e8=_0x5594e8-0x0;var _0x592b3b=_0x384d[_0x5594e8];return _0x592b3b;};'use strict';var util=require(_0xd384('0x0'));var _=require('lodash');var moment=require(_0xd384('0x1'));function getSeconds(_0x3196f0,_0x2861f3){var _0x2e60a9=moment(_0x3196f0)[_0xd384('0x2')](0x0);var _0x171baa=moment(_0x2861f3)['milliseconds'](0x0);return _0x2e60a9[_0xd384('0x3')](_0x171baa,_0xd384('0x4'));}function AgentComplete(_0x57fb51,_0x31b17d){this['state']=0x4;this[_0xd384('0x5')]='Answer';this['scheduledat']=_0x57fb51[_0xd384('0x6')];this[_0xd384('0x7')]=_0x57fb51[_0xd384('0x7')];this['campaigntype']=_0x57fb51[_0xd384('0x7')]===_0xd384('0x8')?_0xd384('0x9'):_0x57fb51['type'];this[_0xd384('0xa')]=_0x57fb51[_0xd384('0xa')];this[_0xd384('0xb')]=_0x57fb51[_0xd384('0xb')];this[_0xd384('0xc')]=_0x57fb51[_0xd384('0xc')];this[_0xd384('0xd')]=_0x57fb51['countbusyretry']+_0x57fb51[_0xd384('0xb')]+_0x57fb51[_0xd384('0xc')]+_0x57fb51['countnosuchnumberretry']+_0x57fb51['countdropretry']+_0x57fb51['countabandonedretry']+_0x57fb51['countmachineretry']+_0x57fb51[_0xd384('0xe')];this['countnosuchnumberretry']=_0x57fb51['countnosuchnumberretry'];this['countdropretry']=_0x57fb51[_0xd384('0xf')];this['countabandonedretry']=_0x57fb51['countabandonedretry'];this[_0xd384('0x10')]=_0x57fb51['countmachineretry'];this[_0xd384('0xe')]=_0x57fb51[_0xd384('0xe')];this['uniqueid']=_0x31b17d['uniqueid'];this['calleridname']=_0x57fb51[_0xd384('0x11')];this[_0xd384('0x12')]=_0x57fb51[_0xd384('0x13')];this[_0xd384('0x14')]=_0x57fb51['starttime'];this['responsetime']=_0x57fb51['responsetime'];this[_0xd384('0x15')]=_0x57fb51[_0xd384('0x15')];this[_0xd384('0x16')]=moment()[_0xd384('0x17')](_0xd384('0x18'));this[_0xd384('0x19')]=getSeconds(_0x57fb51[_0xd384('0x1a')],_0x57fb51['starttime']);this[_0xd384('0x1b')]=getSeconds(_0x57fb51[_0xd384('0x15')],_0x57fb51['responsetime']);this[_0xd384('0x1c')]=getSeconds(this[_0xd384('0x16')],_0x57fb51[_0xd384('0x15')]);this[_0xd384('0x9')]=_0x31b17d[_0xd384('0x9')];this['membername']=_0x31b17d['membername'];this[_0xd384('0x1d')]=_0x31b17d[_0xd384('0x1d')];this[_0xd384('0x1e')]=_0x57fb51[_0xd384('0x1e')];this[_0xd384('0x1f')]=_0x57fb51['callbackuniqueid'];this[_0xd384('0x20')]=_0x57fb51[_0xd384('0x20')];this[_0xd384('0x21')]=_0x57fb51['recallme'];this[_0xd384('0x22')]=_0x57fb51[_0xd384('0x22')];this['ListId']=_0x57fb51[_0xd384('0x23')];this[_0xd384('0x24')]=_0x57fb51['UserId'];this[_0xd384('0x25')]=_0x57fb51[_0xd384('0x25')];this[_0xd384('0x26')]=_0x57fb51[_0xd384('0x26')];this[_0xd384('0x27')]=_0x57fb51['originatecalleridnum']||'';this['originatecalleridname']=_0x57fb51['originatecalleridname']||'';}module[_0xd384('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 8bffda1..aa40966 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc97=['CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xdc97,0x13b));var _0x7dc9=function(_0x48a3bb,_0x507bcc){_0x48a3bb=_0x48a3bb-0x0;var _0x765002=_0xdc97[_0x48a3bb];return _0x765002;};'use strict';var util=require(_0x7dc9('0x0'));var _=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));function getSeconds(_0x5f1f64,_0x2913e6){var _0x4f5c88=moment(_0x5f1f64)[_0x7dc9('0x3')](0x0);var _0x2b86da=moment(_0x2913e6)['milliseconds'](0x0);return _0x4f5c88[_0x7dc9('0x4')](_0x2b86da,_0x7dc9('0x5'));}function Final(_0xb15a0b){this[_0x7dc9('0x6')]=_0xb15a0b['uniqueid'];this[_0x7dc9('0x7')]=_0xb15a0b['scheduledat'];this['type']=_0xb15a0b[_0x7dc9('0x8')];this[_0x7dc9('0x9')]=_0xb15a0b[_0x7dc9('0x8')]===_0x7dc9('0xa')?_0x7dc9('0xb'):_0xb15a0b['type'];this[_0x7dc9('0xc')]=_0xb15a0b[_0x7dc9('0xc')];this[_0x7dc9('0xd')]=_0xb15a0b[_0x7dc9('0xd')];this[_0x7dc9('0xe')]=_0xb15a0b[_0x7dc9('0xe')];this[_0x7dc9('0xf')]=_0xb15a0b['countbusyretry']+_0xb15a0b['countcongestionretry']+_0xb15a0b['countnoanswerretry']+_0xb15a0b['countnosuchnumberretry']+_0xb15a0b[_0x7dc9('0x10')]+_0xb15a0b[_0x7dc9('0x11')]+_0xb15a0b['countmachineretry']+_0xb15a0b[_0x7dc9('0x12')];this[_0x7dc9('0x13')]=_0xb15a0b[_0x7dc9('0x13')];this[_0x7dc9('0x10')]=_0xb15a0b[_0x7dc9('0x10')];this[_0x7dc9('0x11')]=_0xb15a0b['countabandonedretry'];this[_0x7dc9('0x14')]=_0xb15a0b[_0x7dc9('0x14')];this[_0x7dc9('0x12')]=_0xb15a0b[_0x7dc9('0x12')];this[_0x7dc9('0xb')]=_0xb15a0b[_0x7dc9('0xb')];this[_0x7dc9('0x15')]=_0xb15a0b[_0x7dc9('0x15')];this[_0x7dc9('0x16')]=_0xb15a0b['calleridnum'];this[_0x7dc9('0x17')]=_0xb15a0b['starttime'];this[_0x7dc9('0x18')]=_0xb15a0b[_0x7dc9('0x18')];this['endtime']=_0xb15a0b[_0x7dc9('0x18')];this[_0x7dc9('0x19')]=_0xb15a0b[_0x7dc9('0x19')]||0x0;this[_0x7dc9('0x1a')]=_0xb15a0b[_0x7dc9('0x1a')]||0x0;this[_0x7dc9('0x1b')]=_0xb15a0b[_0x7dc9('0x1b')]||0x0;this[_0x7dc9('0x1c')]=_0xb15a0b[_0x7dc9('0x1c')];this[_0x7dc9('0x1d')]=_0xb15a0b['callbackuniqueid'];this['callbackat']=_0xb15a0b[_0x7dc9('0x1e')];this[_0x7dc9('0x1f')]=_0xb15a0b['recallme'];this[_0x7dc9('0x20')]=_0xb15a0b[_0x7dc9('0x20')];this['ListId']=_0xb15a0b[_0x7dc9('0x21')];this[_0x7dc9('0x22')]=_0xb15a0b[_0x7dc9('0x22')];this['VoiceQueueId']=_0xb15a0b[_0x7dc9('0x23')];this[_0x7dc9('0x24')]=_0xb15a0b[_0x7dc9('0x24')];this['originatecalleridnum']=_0xb15a0b['originatecalleridnum']||'';this['originatecalleridname']=_0xb15a0b[_0x7dc9('0x25')]||'';}module[_0x7dc9('0x26')]=Final; \ No newline at end of file +var _0xb66c=['ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xb66c,0x175));var _0xcb66=function(_0x243335,_0x147dbe){_0x243335=_0x243335-0x0;var _0x33a0a1=_0xb66c[_0x243335];return _0x33a0a1;};'use strict';var util=require(_0xcb66('0x0'));var _=require('lodash');var moment=require(_0xcb66('0x1'));function getSeconds(_0x55a57b,_0x2afcb8){var _0x24ea13=moment(_0x55a57b)[_0xcb66('0x2')](0x0);var _0x5f487c=moment(_0x2afcb8)[_0xcb66('0x2')](0x0);return _0x24ea13[_0xcb66('0x3')](_0x5f487c,_0xcb66('0x4'));}function Final(_0x21be55){this['uniqueid']=_0x21be55['uniqueid'];this[_0xcb66('0x5')]=_0x21be55[_0xcb66('0x5')];this[_0xcb66('0x6')]=_0x21be55[_0xcb66('0x6')];this[_0xcb66('0x7')]=_0x21be55['type']===_0xcb66('0x8')?_0xcb66('0x9'):_0x21be55[_0xcb66('0x6')];this[_0xcb66('0xa')]=_0x21be55[_0xcb66('0xa')];this['countcongestionretry']=_0x21be55[_0xcb66('0xb')];this[_0xcb66('0xc')]=_0x21be55[_0xcb66('0xc')];this[_0xcb66('0xd')]=_0x21be55['countbusyretry']+_0x21be55[_0xcb66('0xb')]+_0x21be55[_0xcb66('0xc')]+_0x21be55[_0xcb66('0xe')]+_0x21be55[_0xcb66('0xf')]+_0x21be55['countabandonedretry']+_0x21be55[_0xcb66('0x10')]+_0x21be55[_0xcb66('0x11')];this[_0xcb66('0xe')]=_0x21be55[_0xcb66('0xe')];this['countdropretry']=_0x21be55[_0xcb66('0xf')];this['countabandonedretry']=_0x21be55[_0xcb66('0x12')];this['countmachineretry']=_0x21be55[_0xcb66('0x10')];this['countagentrejectretry']=_0x21be55['countagentrejectretry'];this[_0xcb66('0x9')]=_0x21be55[_0xcb66('0x9')];this[_0xcb66('0x13')]=_0x21be55[_0xcb66('0x13')];this['calleridnum']=_0x21be55[_0xcb66('0x14')];this[_0xcb66('0x15')]=_0x21be55[_0xcb66('0x15')];this['responsetime']=_0x21be55[_0xcb66('0x16')];this['endtime']=_0x21be55[_0xcb66('0x16')];this[_0xcb66('0x17')]=_0x21be55[_0xcb66('0x17')]||0x0;this[_0xcb66('0x18')]=_0x21be55['holdtime']||0x0;this['talktime']=_0x21be55['talktime']||0x0;this[_0xcb66('0x19')]=_0x21be55['callback'];this['callbackuniqueid']=_0x21be55[_0xcb66('0x1a')];this['callbackat']=_0x21be55[_0xcb66('0x1b')];this[_0xcb66('0x1c')]=_0x21be55[_0xcb66('0x1c')];this[_0xcb66('0x1d')]=_0x21be55[_0xcb66('0x1d')];this[_0xcb66('0x1e')]=_0x21be55[_0xcb66('0x1e')];this['UserId']=_0x21be55[_0xcb66('0x1f')];this['VoiceQueueId']=_0x21be55['VoiceQueueId'];this[_0xcb66('0x20')]=_0x21be55[_0xcb66('0x20')];this[_0xcb66('0x21')]=_0x21be55['originatecalleridnum']||'';this[_0xcb66('0x22')]=_0x21be55[_0xcb66('0x22')]||'';}module[_0xcb66('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 3229afd..0eb5780 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe74b=['ringtime','holdtime','talktime','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format'];(function(_0x6505c,_0x5329a7){var _0x1a7a96=function(_0x5bb1c6){while(--_0x5bb1c6){_0x6505c['push'](_0x6505c['shift']());}};_0x1a7a96(++_0x5329a7);}(_0xe74b,0x1f4));var _0xbe74=function(_0x8d3b4b,_0xd1db47){_0x8d3b4b=_0x8d3b4b-0x0;var _0x509753=_0xe74b[_0x8d3b4b];return _0x509753;};'use strict';var util=require(_0xbe74('0x0'));var _=require(_0xbe74('0x1'));var moment=require('moment');function getSeconds(_0xc855f8,_0xdad173){var _0x1e587b=moment(_0xc855f8)['milliseconds'](0x0);var _0xaf5315=moment(_0xdad173)[_0xbe74('0x2')](0x0);return _0x1e587b['diff'](_0xaf5315,_0xbe74('0x3'));}function Hangup(_0x314ce7,_0x3e7680){this[_0xbe74('0x4')]=0x4;this[_0xbe74('0x5')]=_0xbe74('0x6');this[_0xbe74('0x7')]=_0x314ce7[_0xbe74('0x7')];this[_0xbe74('0x8')]=_0x314ce7[_0xbe74('0x8')];this[_0xbe74('0x9')]=_0x314ce7['type']==='outbound'?'queue':_0x314ce7['type'];this[_0xbe74('0xa')]=_0x314ce7['countbusyretry'];this[_0xbe74('0xb')]=_0x314ce7[_0xbe74('0xb')];this[_0xbe74('0xc')]=_0x314ce7[_0xbe74('0xc')];this[_0xbe74('0xd')]=_0x314ce7[_0xbe74('0xa')]+_0x314ce7[_0xbe74('0xb')]+_0x314ce7[_0xbe74('0xc')]+_0x314ce7[_0xbe74('0xe')]+_0x314ce7[_0xbe74('0xf')]+_0x314ce7[_0xbe74('0x10')]+_0x314ce7['countmachineretry']+_0x314ce7[_0xbe74('0x11')];this[_0xbe74('0xe')]=_0x314ce7[_0xbe74('0xe')];this[_0xbe74('0xf')]=_0x314ce7[_0xbe74('0xf')];this['countabandonedretry']=_0x314ce7['countabandonedretry'];this[_0xbe74('0x12')]=_0x314ce7[_0xbe74('0x12')];this[_0xbe74('0x11')]=_0x314ce7['countagentrejectretry'];this['uniqueid']=_0x3e7680[_0xbe74('0x13')];this[_0xbe74('0x14')]=_0x314ce7[_0xbe74('0x15')];this[_0xbe74('0x16')]=_0x314ce7[_0xbe74('0x17')];this[_0xbe74('0x18')]=_0x314ce7[_0xbe74('0x18')];this[_0xbe74('0x19')]=_0x314ce7[_0xbe74('0x19')];this[_0xbe74('0x1a')]=moment()[_0xbe74('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbe74('0x1c')]=getSeconds(_0x314ce7[_0xbe74('0x19')],_0x314ce7['starttime']);this[_0xbe74('0x1d')]=0x0;this[_0xbe74('0x1e')]=getSeconds(this[_0xbe74('0x1a')],_0x314ce7[_0xbe74('0x19')]);this[_0xbe74('0x1f')]=_0x314ce7[_0xbe74('0x1f')];this['membername']=_0xbe74('0x20');this[_0xbe74('0x21')]=_0x3e7680[_0xbe74('0x22')];this[_0xbe74('0x23')]=_0x314ce7[_0xbe74('0x23')];this[_0xbe74('0x24')]=_0x314ce7[_0xbe74('0x24')];this[_0xbe74('0x25')]=_0x314ce7[_0xbe74('0x25')];this['recallme']=_0x314ce7[_0xbe74('0x26')];this[_0xbe74('0x27')]=_0x314ce7[_0xbe74('0x27')];this['ListId']=_0x314ce7[_0xbe74('0x28')];this[_0xbe74('0x29')]=_0x314ce7[_0xbe74('0x29')];this[_0xbe74('0x2a')]=_0x314ce7['VoiceQueueId'];this[_0xbe74('0x2b')]=_0x314ce7['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0xf059=['membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','moment','milliseconds','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime'];(function(_0x2f965f,_0x100aca){var _0x73f2b9=function(_0x25705d){while(--_0x25705d){_0x2f965f['push'](_0x2f965f['shift']());}};_0x73f2b9(++_0x100aca);}(_0xf059,0x1cf));var _0x9f05=function(_0x2aadc1,_0x3d1a36){_0x2aadc1=_0x2aadc1-0x0;var _0x15d9e9=_0xf059[_0x2aadc1];return _0x15d9e9;};'use strict';var util=require(_0x9f05('0x0'));var _=require('lodash');var moment=require(_0x9f05('0x1'));function getSeconds(_0x3a72d8,_0x5ca802){var _0x3a9167=moment(_0x3a72d8)['milliseconds'](0x0);var _0x3af067=moment(_0x5ca802)[_0x9f05('0x2')](0x0);return _0x3a9167['diff'](_0x3af067,_0x9f05('0x3'));}function Hangup(_0x9642e1,_0x55ce17){this[_0x9f05('0x4')]=0x4;this['statedesc']='Answer';this[_0x9f05('0x5')]=_0x9642e1[_0x9f05('0x5')];this['type']=_0x9642e1[_0x9f05('0x6')];this[_0x9f05('0x7')]=_0x9642e1[_0x9f05('0x6')]===_0x9f05('0x8')?_0x9f05('0x9'):_0x9642e1['type'];this[_0x9f05('0xa')]=_0x9642e1['countbusyretry'];this[_0x9f05('0xb')]=_0x9642e1[_0x9f05('0xb')];this[_0x9f05('0xc')]=_0x9642e1['countnoanswerretry'];this['countglobal']=_0x9642e1[_0x9f05('0xa')]+_0x9642e1[_0x9f05('0xb')]+_0x9642e1[_0x9f05('0xc')]+_0x9642e1[_0x9f05('0xd')]+_0x9642e1[_0x9f05('0xe')]+_0x9642e1[_0x9f05('0xf')]+_0x9642e1[_0x9f05('0x10')]+_0x9642e1['countagentrejectretry'];this[_0x9f05('0xd')]=_0x9642e1[_0x9f05('0xd')];this[_0x9f05('0xe')]=_0x9642e1[_0x9f05('0xe')];this[_0x9f05('0xf')]=_0x9642e1[_0x9f05('0xf')];this['countmachineretry']=_0x9642e1['countmachineretry'];this['countagentrejectretry']=_0x9642e1['countagentrejectretry'];this[_0x9f05('0x11')]=_0x55ce17[_0x9f05('0x11')];this[_0x9f05('0x12')]=_0x9642e1[_0x9f05('0x13')];this['calleridnum']=_0x9642e1[_0x9f05('0x14')];this['starttime']=_0x9642e1[_0x9f05('0x15')];this[_0x9f05('0x16')]=_0x9642e1[_0x9f05('0x16')];this[_0x9f05('0x17')]=moment()[_0x9f05('0x18')](_0x9f05('0x19'));this[_0x9f05('0x1a')]=getSeconds(_0x9642e1[_0x9f05('0x16')],_0x9642e1[_0x9f05('0x15')]);this[_0x9f05('0x1b')]=0x0;this[_0x9f05('0x1c')]=getSeconds(this[_0x9f05('0x17')],_0x9642e1[_0x9f05('0x16')]);this[_0x9f05('0x9')]=_0x9642e1[_0x9f05('0x9')];this[_0x9f05('0x1d')]=_0x9f05('0x1e');this['reason']=_0x55ce17[_0x9f05('0x1f')];this[_0x9f05('0x20')]=_0x9642e1[_0x9f05('0x20')];this[_0x9f05('0x21')]=_0x9642e1[_0x9f05('0x21')];this[_0x9f05('0x22')]=_0x9642e1[_0x9f05('0x22')];this[_0x9f05('0x23')]=_0x9642e1['recallme'];this[_0x9f05('0x24')]=_0x9642e1[_0x9f05('0x24')];this[_0x9f05('0x25')]=_0x9642e1['ListId'];this['UserId']=_0x9642e1[_0x9f05('0x26')];this[_0x9f05('0x27')]=_0x9642e1[_0x9f05('0x27')];this[_0x9f05('0x28')]=_0x9642e1['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index f766e36..ae49a3c 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d94=['countnosuchnumberretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry'];(function(_0x5d634e,_0x4c1390){var _0x41e329=function(_0x1165ce){while(--_0x1165ce){_0x5d634e['push'](_0x5d634e['shift']());}};_0x41e329(++_0x4c1390);}(_0x6d94,0x13c));var _0x46d9=function(_0x467c4e,_0x3cee92){_0x467c4e=_0x467c4e-0x0;var _0x348250=_0x6d94[_0x467c4e];return _0x348250;};'use strict';var util=require(_0x46d9('0x0'));var _=require(_0x46d9('0x1'));var moment=require('moment');function getSeconds(_0x44e8e7,_0x291b1a){var _0x4c49f0=moment(_0x44e8e7)[_0x46d9('0x2')](0x0);var _0x2d3f53=moment(_0x291b1a)[_0x46d9('0x2')](0x0);return _0x4c49f0[_0x46d9('0x3')](_0x2d3f53,_0x46d9('0x4'));}function History(_0x4ecda9){this[_0x46d9('0x5')]=_0x4ecda9[_0x46d9('0x5')];this[_0x46d9('0x6')]=_0x4ecda9[_0x46d9('0x6')]||undefined;this[_0x46d9('0x7')]=_0x4ecda9[_0x46d9('0x7')];this[_0x46d9('0x8')]=_0x4ecda9[_0x46d9('0x7')]===_0x46d9('0x9')?_0x46d9('0xa'):_0x4ecda9[_0x46d9('0x7')];this[_0x46d9('0xb')]=_0x4ecda9[_0x46d9('0xb')];this['countcongestionretry']=_0x4ecda9['countcongestionretry'];this[_0x46d9('0xc')]=_0x4ecda9[_0x46d9('0xc')];this[_0x46d9('0xd')]=_0x4ecda9[_0x46d9('0xb')]+_0x4ecda9[_0x46d9('0xe')]+_0x4ecda9[_0x46d9('0xc')]+_0x4ecda9['countnosuchnumberretry']+_0x4ecda9[_0x46d9('0xf')]+_0x4ecda9[_0x46d9('0x10')]+_0x4ecda9['countmachineretry']+_0x4ecda9['countagentrejectretry'];this[_0x46d9('0x11')]=_0x4ecda9[_0x46d9('0x11')];this[_0x46d9('0xf')]=_0x4ecda9[_0x46d9('0xf')];this[_0x46d9('0x10')]=_0x4ecda9[_0x46d9('0x10')];this[_0x46d9('0x12')]=_0x4ecda9[_0x46d9('0x12')];this[_0x46d9('0x13')]=_0x4ecda9[_0x46d9('0x13')];this[_0x46d9('0xa')]=_0x4ecda9['queue'];this[_0x46d9('0x14')]=_0x4ecda9[_0x46d9('0x15')];this[_0x46d9('0x16')]=_0x4ecda9['number'];this['starttime']=_0x4ecda9[_0x46d9('0x17')];this[_0x46d9('0x18')]=_0x4ecda9[_0x46d9('0x18')];this['endtime']=_0x4ecda9[_0x46d9('0x18')];this[_0x46d9('0x19')]=getSeconds(_0x4ecda9[_0x46d9('0x18')],_0x4ecda9[_0x46d9('0x17')]);this['holdtime']=0x0;this[_0x46d9('0x1a')]=0x0;this[_0x46d9('0x1b')]=_0x4ecda9[_0x46d9('0x1b')];this[_0x46d9('0x1c')]=_0x4ecda9[_0x46d9('0x1c')];this['callbackat']=_0x4ecda9[_0x46d9('0x1d')];this['recallme']=_0x4ecda9[_0x46d9('0x1e')];this[_0x46d9('0x1f')]=_0x4ecda9[_0x46d9('0x1f')];this[_0x46d9('0x20')]=_0x4ecda9['ListId'];this[_0x46d9('0x21')]=_0x4ecda9[_0x46d9('0x21')];this[_0x46d9('0x22')]=_0x4ecda9['VoiceQueueId'];this['CampaignId']=_0x4ecda9['CampaignId'];this['originatecalleridnum']=_0x4ecda9[_0x46d9('0x23')]||'';this['originatecalleridname']=_0x4ecda9[_0x46d9('0x24')]||'';}module['exports']=History; \ No newline at end of file +var _0x289d=['seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x289d,0xbf));var _0xd289=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x289d[_0x4d07cc];return _0x42de3b;};'use strict';var util=require(_0xd289('0x0'));var _=require('lodash');var moment=require(_0xd289('0x1'));function getSeconds(_0x32d106,_0xc9d5a1){var _0x1bafeb=moment(_0x32d106)[_0xd289('0x2')](0x0);var _0x3b12f0=moment(_0xc9d5a1)[_0xd289('0x2')](0x0);return _0x1bafeb[_0xd289('0x3')](_0x3b12f0,_0xd289('0x4'));}function History(_0x55fdc5){this[_0xd289('0x5')]=_0x55fdc5[_0xd289('0x5')];this[_0xd289('0x6')]=_0x55fdc5['scheduledat']||undefined;this[_0xd289('0x7')]=_0x55fdc5[_0xd289('0x7')];this[_0xd289('0x8')]=_0x55fdc5[_0xd289('0x7')]===_0xd289('0x9')?_0xd289('0xa'):_0x55fdc5[_0xd289('0x7')];this[_0xd289('0xb')]=_0x55fdc5[_0xd289('0xb')];this['countcongestionretry']=_0x55fdc5['countcongestionretry'];this[_0xd289('0xc')]=_0x55fdc5[_0xd289('0xc')];this[_0xd289('0xd')]=_0x55fdc5[_0xd289('0xb')]+_0x55fdc5[_0xd289('0xe')]+_0x55fdc5[_0xd289('0xc')]+_0x55fdc5['countnosuchnumberretry']+_0x55fdc5[_0xd289('0xf')]+_0x55fdc5[_0xd289('0x10')]+_0x55fdc5[_0xd289('0x11')]+_0x55fdc5[_0xd289('0x12')];this[_0xd289('0x13')]=_0x55fdc5[_0xd289('0x13')];this[_0xd289('0xf')]=_0x55fdc5[_0xd289('0xf')];this[_0xd289('0x10')]=_0x55fdc5[_0xd289('0x10')];this['countmachineretry']=_0x55fdc5[_0xd289('0x11')];this['countagentrejectretry']=_0x55fdc5[_0xd289('0x12')];this['queue']=_0x55fdc5[_0xd289('0xa')];this[_0xd289('0x14')]=_0x55fdc5[_0xd289('0x15')];this[_0xd289('0x16')]=_0x55fdc5[_0xd289('0x17')];this['starttime']=_0x55fdc5['starttime'];this[_0xd289('0x18')]=_0x55fdc5[_0xd289('0x18')];this[_0xd289('0x19')]=_0x55fdc5[_0xd289('0x18')];this[_0xd289('0x1a')]=getSeconds(_0x55fdc5[_0xd289('0x18')],_0x55fdc5['starttime']);this['holdtime']=0x0;this['talktime']=0x0;this[_0xd289('0x1b')]=_0x55fdc5[_0xd289('0x1b')];this['callbackuniqueid']=_0x55fdc5[_0xd289('0x1c')];this[_0xd289('0x1d')]=_0x55fdc5[_0xd289('0x1d')];this['recallme']=_0x55fdc5[_0xd289('0x1e')];this['ContactId']=_0x55fdc5[_0xd289('0x1f')];this[_0xd289('0x20')]=_0x55fdc5[_0xd289('0x20')];this['UserId']=_0x55fdc5[_0xd289('0x21')];this[_0xd289('0x22')]=_0x55fdc5[_0xd289('0x22')];this['CampaignId']=_0x55fdc5[_0xd289('0x23')];this['originatecalleridnum']=_0x55fdc5[_0xd289('0x24')]||'';this[_0xd289('0x25')]=_0x55fdc5['originatecalleridname']||'';}module[_0xd289('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 4d9b816..ccc6634 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 _0xf13f=['NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','custom:agentreject','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalMaxThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','Queue:\x20','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','limitCalls','getContactDialerIvr','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','RUNNING','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','[abandonmentRate]','Error','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','getSettings','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','pTalking','sumBillable','sumDuration','talking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','md5','format','voice:queue:%s','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','debug','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','status','channel','catch','No\x20such\x20channel','ivr','updateOriginated','queue','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','resolve','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact]','Success','isTrunkReachable','active','SIP/%s','reachable','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','custom:amd','buildObj','amd','MACHINE','outboundAnswerCallsDay','Machine','AMD','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','YYYY-MM-DD\x20HH:mm:ss','syncHangup','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','starttime','calleridname','calleridnum','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','interval','content','indexOf','true','iftime\x20%s,%s','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','predictive','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','loggedIn','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','map','checkIfTime','[syncCampaigns]','pow','random','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller'];(function(_0xc8a210,_0x38cb61){var _0x4446dd=function(_0x5252a6){while(--_0x5252a6){_0xc8a210['push'](_0xc8a210['shift']());}};_0x4446dd(++_0x38cb61);}(_0xf13f,0xa2));var _0xff13=function(_0x4bf4c1,_0x3f7335){_0x4bf4c1=_0x4bf4c1-0x0;var _0x20f76f=_0xf13f[_0x4bf4c1];return _0x20f76f;};'use strict';var util=require(_0xff13('0x0'));var _=require(_0xff13('0x1'));var uuid=require(_0xff13('0x2'));var moment=require(_0xff13('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xff13('0x4'));var ut=require(_0xff13('0x5'));var config=require(_0xff13('0x6'));var logger=require(_0xff13('0x7'))(_0xff13('0x8'));var loggerBooked=require(_0xff13('0x7'))(_0xff13('0x9'));var loggerPredictive=require(_0xff13('0x7'))('predictive');var loggerPredictiveCalls=require(_0xff13('0x7'))(_0xff13('0xa'));var loggerSyncQueueSummary=require(_0xff13('0x7'))(_0xff13('0xb'));var ami=require(_0xff13('0xc'));config[_0xff13('0xd')]=_[_0xff13('0xe')](config[_0xff13('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0xff13('0xf'))(new Redis(config[_0xff13('0xd')]));var cmHopper=require(_0xff13('0x10'));var cmHopperHistory=require(_0xff13('0x11'));var cmHopperAdditionalPhone=require(_0xff13('0x12'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xff13('0x13'));var RpcSetting=require('../rpc/setting');var Action=require('./action');var History=require(_0xff13('0x14'));var Final=require('./final');var AgentComplete=require(_0xff13('0x15'));var QueueCallerAbandon=require(_0xff13('0x16'));var Hangup=require(_0xff13('0x17'));var ipAgi=process[_0xff13('0x18')][_0xff13('0x19')]||_0xff13('0x1a');var strategy={'rrmemory':'rrmemory','roundrobin':_0xff13('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xff13('0x1c')][_0xff13('0x1d')]=function(_0x36e15d){this[_0xff13('0x1e')]=this[_0xff13('0x1e')]?this['tail'][_0xff13('0x1f')](_0x36e15d):_0x36e15d();};function Dialer(_0x23ca86,_0x174fa9){this[_0xff13('0x20')]=new Sequence();this[_0xff13('0x21')]=_0x174fa9;this[_0xff13('0x22')]=_0x23ca86['voiceQueues'];this[_0xff13('0x23')]=_0x23ca86[_0xff13('0x23')];this[_0xff13('0x24')]=_0x23ca86[_0xff13('0x24')];this['trunks']=_0x23ca86[_0xff13('0x25')];this[_0xff13('0x26')]=config[_0xff13('0x26')]||0x2;this[_0xff13('0x27')]={};this[_0xff13('0x28')]={};this['contactsId']={};this[_0xff13('0x29')]={};this[_0xff13('0x2a')]={};this[_0xff13('0x2b')]={};this['startProgressive']={};this[_0xff13('0x2c')]={};this[_0xff13('0x2d')]={};this['queueBookedRR']={};ami['on'](_0xff13('0x2e'),this[_0xff13('0x2f')][_0xff13('0x30')](this));ami['on'](_0xff13('0x31'),this[_0xff13('0x32')][_0xff13('0x30')](this));ami['on'](_0xff13('0x33'),this[_0xff13('0x34')][_0xff13('0x30')](this));ami['on']('agentcomplete',this[_0xff13('0x35')]['bind'](this));ami['on'](_0xff13('0x36'),this[_0xff13('0xb')][_0xff13('0x30')](this));ami['on'](_0xff13('0x37'),this['syncQueueSummaryComplete'][_0xff13('0x30')](this));ami['on'](_0xff13('0x38'),this['syncHangup'][_0xff13('0x30')](this));ami['on'](_0xff13('0x39'),this[_0xff13('0x3a')]['bind'](this));ami['on'](_0xff13('0x3b'),this['syncVarSet']['bind'](this));ami['on'](_0xff13('0x3c'),this[_0xff13('0x3d')]['bind'](this));ami['on']('queuestatuscomplete',this[_0xff13('0x3e')][_0xff13('0x30')](this));this['loopCampaigns']();this[_0xff13('0x3f')]();RpcSetting[_0xff13('0x40')]()['then'](function(_0x3112f8){previewRecallmeReminderInterval=_0x3112f8['previewRecallmeReminderInterval'];});}function isNotNull(_0x3331ec){return _0x3331ec!==null&&!_[_0xff13('0x41')](_0x3331ec);}function checkIsLoggedIn(_0x293f82,_0x23a932){return function(){if(_0x23a932<=0x0){_0x293f82[_0xff13('0x42')]=_0xff13('0x43');throw _0x293f82[_0xff13('0x44')]+_0xff13('0x45');}};}function isActive(_0x5c68a1){return _0x5c68a1;}function checkIsActive(_0x96d848,_0x4f788a){return function(){if(!isActive(_0x4f788a)){_0x96d848[_0xff13('0x42')]=_0xff13('0x46');throw _0x96d848['name']+_0xff13('0x47');}};}function checkInterval(_0x5ed1b8){return function(){if(!isNotNull(_0x5ed1b8[_0xff13('0x48')])){_0x5ed1b8['message']='INTERVAL_IS_NULL';throw _0x5ed1b8[_0xff13('0x44')]+_0xff13('0x49');}if(!isNotNull(_0x5ed1b8['Interval'][_0xff13('0x4a')])){_0x5ed1b8[_0xff13('0x42')]=_0xff13('0x4b');throw _0x5ed1b8[_0xff13('0x44')]+_0xff13('0x49');}if(!isNotNull(_[_0xff13('0x4c')](_0x5ed1b8[_0xff13('0x48')][_0xff13('0x4a')]))){_0x5ed1b8[_0xff13('0x42')]=_0xff13('0x4b');throw _0x5ed1b8[_0xff13('0x44')]+_0xff13('0x49');}};}function msgResponse(_0x190d61,_0x6fdd14,_0x5157f6){return{'action':_0x190d61,'response':_0x6fdd14,'message':_0x5157f6,'stack':_0x5157f6};}function myreject(_0x49c6e6){return function(_0x380d20){return _0x49c6e6(msgResponse(_0xff13('0x4d'),'Error',JSON[_0xff13('0x4e')](_0x380d20)));};}function getSeconds(_0x392afb,_0x4d8ff9){var _0x5e02d4=moment(_0x392afb)[_0xff13('0x4f')](0x0);var _0x58fe3b=moment(_0x4d8ff9)[_0xff13('0x4f')](0x0);return _0x5e02d4[_0xff13('0x50')](_0x58fe3b,_0xff13('0x51'));}function emit(_0x266468,_0x157c68,_0x4ff79c){io['to'](_0x266468)[_0xff13('0x52')](_0x157c68,_0x4ff79c);}function emitVoiceQueueSummary(_0x4d3cd9){if(_0x4d3cd9[_0xff13('0x53')]===_0xff13('0x54')){var _0x503808={'id':_0x4d3cd9['id'],'name':_0x4d3cd9['name'],'strategy':_0x4d3cd9[_0xff13('0x55')],'answered':_0x4d3cd9[_0xff13('0x56')],'available':_0x4d3cd9[_0xff13('0x57')],'loggedIn':_0x4d3cd9['loggedIn'],'pTalking':_0x4d3cd9[_0xff13('0x58')],'sumBillable':_0x4d3cd9[_0xff13('0x59')],'sumDuration':_0x4d3cd9[_0xff13('0x5a')],'sumHoldTime':_0x4d3cd9['sumHoldTime']||0x0,'talking':_0x4d3cd9[_0xff13('0x5b')],'total':_0x4d3cd9['total'],'type':_0x4d3cd9[_0xff13('0x53')],'unmanaged':_0x4d3cd9['unmanaged'],'abandoned':_0x4d3cd9['abandoned'],'waiting':_0x4d3cd9['waiting'],'loggedInDb':_0x4d3cd9['loggedInDb'],'dialActive':_0x4d3cd9[_0xff13('0x5c')],'dialMethod':_0x4d3cd9[_0xff13('0x5d')],'dialOriginateCallerIdName':_0x4d3cd9[_0xff13('0x5e')],'dialOriginateCallerIdNumber':_0x4d3cd9[_0xff13('0x5f')],'dialOriginateTimeout':_0x4d3cd9[_0xff13('0x60')],'dialPrefix':_0x4d3cd9[_0xff13('0x61')],'outboundAnswerAgiCallsDay':_0x4d3cd9[_0xff13('0x62')],'outboundAnswerCallsDay':_0x4d3cd9['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4d3cd9[_0xff13('0x63')],'outboundBusyCallsDay':_0x4d3cd9[_0xff13('0x64')],'outboundCongestionCallsDay':_0x4d3cd9[_0xff13('0x65')],'outboundDropCallsDayACS':_0x4d3cd9[_0xff13('0x66')],'outboundDropCallsDayCallersExit':_0x4d3cd9[_0xff13('0x67')],'outboundDropCallsDayTimeout':_0x4d3cd9['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4d3cd9[_0xff13('0x68')],'outboundNoSuchCallsDay':_0x4d3cd9['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4d3cd9[_0xff13('0x69')],'outboundReCallsDay':_0x4d3cd9[_0xff13('0x6a')],'outboundRejectCallsDay':_0x4d3cd9['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4d3cd9[_0xff13('0x6b')],'predictiveIntervalAnsweredCalls':_0x4d3cd9[_0xff13('0x6c')],'predictiveIntervalAvgHoldtime':_0x4d3cd9[_0xff13('0x6d')],'predictiveIntervalAvgTalktime':_0x4d3cd9[_0xff13('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x4d3cd9['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4d3cd9[_0xff13('0x6f')],'predictiveIntervalErlangCalls':_0x4d3cd9['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x4d3cd9[_0xff13('0x70')],'predictiveIntervalHitRate':_0x4d3cd9[_0xff13('0x71')],'predictiveIntervalMultiplicativeFactor':_0x4d3cd9[_0xff13('0x72')],'predictiveIntervalPauses':_0x4d3cd9[_0xff13('0x73')],'predictiveIntervalAvailable':_0x4d3cd9[_0xff13('0x74')],'predictiveIntervalTotalCalls':_0x4d3cd9[_0xff13('0x75')],'message':_0x4d3cd9[_0xff13('0x42')],'originated':_0x4d3cd9[_0xff13('0x76')],'erlangCalls':_0x4d3cd9[_0xff13('0x77')],'erlangCallToSecond':_0x4d3cd9['erlangCallToSecond'],'erlangAbandonmentRate':_0x4d3cd9[_0xff13('0x78')],'erlangBusyFactor':_0x4d3cd9[_0xff13('0x79')],'startPredictive':_0x4d3cd9['startPredictive'],'startProgressive':_0x4d3cd9[_0xff13('0x7a')]};if(_0x4d3cd9[_0xff13('0x7b')]){_0x503808[_0xff13('0x7b')]={'id':_0x4d3cd9[_0xff13('0x7b')]['id'],'name':_0x4d3cd9['Trunk']['name'],'active':_0x4d3cd9['Trunk']['active'],'callerid':_0x4d3cd9[_0xff13('0x7b')][_0xff13('0x7c')]};}if(_0x4d3cd9[_0xff13('0x48')]){_0x503808[_0xff13('0x48')]={'id':_0x4d3cd9['Interval']['id'],'name':_0x4d3cd9[_0xff13('0x48')]['name']};}var _0x59225d=md5(JSON[_0xff13('0x4e')](_0x503808));if(_0x4d3cd9[_0xff13('0x7d')]!==_0x59225d){_0x4d3cd9[_0xff13('0x7d')]=_0x59225d;emit(util[_0xff13('0x7e')](_0xff13('0x7f'),_0x503808['name']),'voice_queue:save',_0x503808);}}}function emitCampaignSummary(_0x4232a0){if(_0x4232a0[_0xff13('0x53')]==='ivr'){emit(util['format'](_0xff13('0x80'),_0x4232a0[_0xff13('0x44')]),_0xff13('0x81'),_0x4232a0);}}function checkGetDataPredictive(_0x3cd5d0){if(isNotNull(_0x3cd5d0)&&!_[_0xff13('0x4c')](_0x3cd5d0)){loggerPredictive[_0xff13('0x82')](_0xff13('0x83'));loggerPredictive[_0xff13('0x82')](_0xff13('0x84'),_0x3cd5d0[_0xff13('0x75')]);loggerPredictive[_0xff13('0x82')](_0xff13('0x85'),_0x3cd5d0['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xff13('0x82')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3cd5d0[_0xff13('0x6f')]);loggerPredictive[_0xff13('0x82')](_0xff13('0x86'),_0x3cd5d0[_0xff13('0x87')]);loggerPredictive[_0xff13('0x82')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3cd5d0['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xff13('0x82')](_0xff13('0x88'),_0x3cd5d0['predictiveIntervalAvgTalktime']);loggerPredictive['info']('---------------------------');if(_0x3cd5d0[_0xff13('0x75')]>0x0){if(!_[_0xff13('0x41')](_0x3cd5d0[_0xff13('0x6e')])&&_0x3cd5d0[_0xff13('0x6e')]>0x0){return!![];}loggerPredictive[_0xff13('0x82')](_0xff13('0x89'));if(!_['isUndefined'](_0x3cd5d0[_0xff13('0x6d')])&&_0x3cd5d0[_0xff13('0x6d')]>0x0){return!![];}loggerPredictive[_0xff13('0x82')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xff13('0x82')](_0xff13('0x8a'));}}else{loggerPredictive[_0xff13('0x82')](_0xff13('0x8b'));}return![];}function mergeDataErlangB(_0x22f184){return function(_0x622a27){loggerPredictive['info'](_0xff13('0x8c'));loggerPredictive[_0xff13('0x82')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x622a27['erlangCalls']);loggerPredictive[_0xff13('0x82')](_0xff13('0x8d'),_0x622a27[_0xff13('0x8e')]);loggerPredictive[_0xff13('0x82')](_0xff13('0x8f'),_0x622a27['erlangAbandonmentRate']);loggerPredictive[_0xff13('0x82')](_0xff13('0x90'),_0x622a27[_0xff13('0x79')]);loggerPredictive[_0xff13('0x82')](_0xff13('0x8f'),_0x622a27[_0xff13('0x78')]);loggerPredictive['info']('---------------------------');_[_0xff13('0x91')](_0x22f184,_0x622a27);};}function getDiff(_0x250b49){var _0x20a71f=moment()[_0xff13('0x4f')](0x0);var _0x252f61=moment(_0x250b49)[_0xff13('0x4f')](0x0);return _0x20a71f['diff'](_0x252f61,'seconds');}function ifInterval(_0x542198,_0x20a1e7){if(_['isUndefined'](_0x20a1e7)){return![];}return getDiff(_0x20a1e7)<_0x542198*0x3c;}function freeVariablesPredictive(_0x181100){if(isNotNull(_0x181100)){if(!_[_0xff13('0x41')](_0x181100['startProgressive'])){_0x181100[_0xff13('0x7a')]=undefined;loggerPredictive[_0xff13('0x82')](_0x181100['name'],_0xff13('0x92'));}if(!_[_0xff13('0x41')](_0x181100[_0xff13('0x2b')])){_0x181100[_0xff13('0x2b')]=undefined;loggerPredictive['info'](_0x181100[_0xff13('0x44')],_0xff13('0x93'));}if(!_['isUndefined'](_0x181100['handlePredictive'])){clearInterval(_0x181100[_0xff13('0x94')]);_0x181100[_0xff13('0x94')]=undefined;loggerPredictive[_0xff13('0x82')](_0x181100[_0xff13('0x44')],_0xff13('0x95'));}}}function erlangb(_0x107786,_0x5e98f8){if(_0x5e98f8===0x0){return 0x0;}var _0x4280ef=0x1;for(var _0x3134e3=0x1;_0x3134e3<=_0x5e98f8;_0x3134e3+=0x1){_0x4280ef=0x1+_0x4280ef*_0x3134e3/_0x107786;}return 0x1/_0x4280ef;}function isVoiceQueueOutbound(_0x5cd9d2){return _0x5cd9d2===_0xff13('0x54');}function isNotPreview(_0x46cde0){return _0x46cde0!=='preview';}function isCampaignIvr(_0xe3e18){return _0xe3e18==='ivr';}function getCallerId(_0x448e5c,_0x4f53c8,_0x22c70b){if(!_[_0xff13('0x41')](_0x22c70b)&&typeof _0x22c70b===_0xff13('0x96')&&!_[_0xff13('0x4c')](_0x22c70b)){if(!_[_0xff13('0x41')](_0x4f53c8)&&typeof _0x4f53c8===_0xff13('0x96')&&!_[_0xff13('0x4c')](_0x4f53c8)){return util['format']('\x22%s\x22\x20<%s>',_0x4f53c8,_0x22c70b);}return util[_0xff13('0x7e')](_0xff13('0x97'),_0x22c70b,_0x22c70b);}if(!_[_0xff13('0x41')](_0x448e5c)&&typeof _0x448e5c===_0xff13('0x96')&&!_[_0xff13('0x4c')](_0x448e5c)){return _0x448e5c;}return _0xff13('0x98');}function loggerCatchQueueSummary(_0x4a7be7,_0x1d13a5){return function(_0x17f8dd){freeVariablesPredictive(_0x1d13a5);emitVoiceQueueSummary(_0x1d13a5);emitCampaignSummary(_0x1d13a5);loggerSyncQueueSummary['debug'](_0x4a7be7,util[_0xff13('0x99')](_0x17f8dd,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1c0b21,_0x27f6f0){return function(_0x490ecf){loggerPredictive['error'](_0x27f6f0[_0xff13('0x44')],_0x1c0b21);loggerPredictive['error'](_0x490ecf['stack']);freeVariablesPredictive(_0x27f6f0);};}function loggerCatch(_0x336699){return function(_0x1e7625){logger[_0xff13('0x9a')](_0x336699,util[_0xff13('0x99')](_0x1e7625,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3d6575){return _0x3d6575&&!_[_0xff13('0x41')](_0x3d6575)&&_0x3d6575[_0xff13('0x9b')]>0x0;}function decremetOriginate(_0x5d6668){if(!_[_0xff13('0x41')](_0x5d6668)&&_0x5d6668!==null){if(typeof _0x5d6668['originated']!=='undefined'){if(_0x5d6668[_0xff13('0x76')]>0x0){_0x5d6668[_0xff13('0x76')]-=0x1;}else{logger['error'](_0xff13('0x9c'));}}}else{logger['error'](_0xff13('0x9d'));}}function checkContactLowerLimitOriginate(_0x5789bc,_0x31736f,_0x4e9f39){if(_0x31736f>_0x4e9f39){for(var _0x32da7e=0x0;_0x32da7e<_0x31736f-_0x4e9f39;_0x32da7e+=0x1){decremetOriginate(_0x5789bc);}}}function loggerGetContactDialer(_0x1bcf36,_0x13a41b,_0x537115){return function(_0x5d4dc1){checkContactLowerLimitOriginate(_0x13a41b,_0x537115,0x0);logger[_0xff13('0x9a')](_0x1bcf36,util['inspect'](_0x5d4dc1,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1acf57){return function(_0x2245bf){if(isNotNull(_0x2245bf)&&isNotNull(_0x2245bf[0x0])){if(_0x2245bf[0x0][_0xff13('0x9e')]>0x0){_0x1acf57[_0xff13('0x42')]='RESCHEDULED_CONTACTS';logger['info'](_0xff13('0x9f')+_0x1acf57[_0xff13('0x44')],_0x2245bf[0x0][_0xff13('0x9e')],'contacts');}else{_0x1acf57[_0xff13('0x42')]=_0xff13('0xa0');logger['info'](_0xff13('0xa1')+_0x1acf57[_0xff13('0x44')]);}}};}function notSendMessagesQueue(_0x5e0dc1){if(_0x5e0dc1[_0xff13('0xa2')]){freeVariablesPredictive(_0x5e0dc1);if(_0x5e0dc1[_0xff13('0x76')]===0x0&&_0x5e0dc1[_0xff13('0x5b')]===0x0&&_0x5e0dc1['waiting']===0x0&&(_0x5e0dc1[_0xff13('0x58')]||0x0)===0x0){_0x5e0dc1[_0xff13('0xa2')]=![];_0x5e0dc1['available']=0x0;_0x5e0dc1[_0xff13('0x42')]=_0xff13('0x46');loggerSyncQueueSummary[_0xff13('0xa3')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5e0dc1[_0xff13('0x44')],_0xff13('0xa4'));}else{_0x5e0dc1[_0xff13('0x42')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xff13('0xa3')](_0xff13('0xa5'),_0x5e0dc1[_0xff13('0x44')],_0xff13('0xa6'));}emitVoiceQueueSummary(_0x5e0dc1);}}function notSendMessagesCampaign(_0x36a1f1){if(_0x36a1f1[_0xff13('0xa2')]){if(_0x36a1f1[_0xff13('0x76')]===0x0){_0x36a1f1[_0xff13('0xa2')]=![];_0x36a1f1[_0xff13('0x42')]=_0xff13('0x46');loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x36a1f1[_0xff13('0x44')],_0xff13('0xa4'));}else{_0x36a1f1[_0xff13('0x42')]=_0xff13('0xa7');loggerSyncQueueSummary[_0xff13('0xa3')](_0xff13('0xa8'),_0x36a1f1[_0xff13('0x44')],_0xff13('0xa6'));}emitCampaignSummary(_0x36a1f1);}}function createObjHistory(_0x400558,_0x432edf,_0x57eca4,_0x108f7d,_0x4a3457){_0x400558[_0xff13('0x42')]=_0x57eca4;var _0x575012=new Action(_0x400558,_0x432edf);var _0x5600ee=new History(_0x575012);_0x5600ee[_0xff13('0xa9')]=_0x108f7d;_0x5600ee[_0xff13('0xaa')]=_0x4a3457;_0x5600ee[_0xff13('0xab')]=_0x575012['starttime'];return _0x5600ee;}Dialer[_0xff13('0x1c')][_0xff13('0x3f')]=function(){var _0x69c1c1=this;setInterval(function(){_0x69c1c1[_0xff13('0xac')](_0x69c1c1[_0xff13('0x29')],_0xff13('0xad'));_0x69c1c1[_0xff13('0xac')](_0x69c1c1['actions'],_0xff13('0xae'));},0x32c8);};Dialer[_0xff13('0x1c')][_0xff13('0xac')]=function(_0x1ebc91,_0xde1a0e){var _0x2f2fe7=this;for(var _0x32cdeb in _0x1ebc91){if(typeof _0x1ebc91[_0x32cdeb]!==_0xff13('0xaf')){this[_0xff13('0x20')]['enqueue'](function(){if(!_[_0xff13('0xb0')](_0x1ebc91[_0x32cdeb])){return ami[_0xff13('0xb1')]({'action':_0xff13('0xb2'),'channel':_0x1ebc91[_0x32cdeb][_0xff13('0xb3')]})[_0xff13('0xb4')](function(_0x35c64b){if(_0x35c64b[_0xff13('0x42')]===_0xff13('0xb5')){setTimeout(function(){if(_0x1ebc91[_0x32cdeb]&&_0x1ebc91[_0x32cdeb][_0xff13('0x53')]!==_0xff13('0xb6')){_0x2f2fe7[_0xff13('0xb7')](_0x2f2fe7[_0xff13('0x22')][_0x1ebc91[_0x32cdeb]['queue']]);logger[_0xff13('0x9a')]('[Dialer][checkChannel]',_0xde1a0e,_0x32cdeb,_0x1ebc91[_0x32cdeb]['queue']);delete _0x1ebc91[_0x32cdeb];}if(_0x1ebc91[_0x32cdeb]&&_0x1ebc91[_0x32cdeb][_0xff13('0x53')]===_0xff13('0xb6')){_0x2f2fe7[_0xff13('0xb7')](_0x2f2fe7['campaigns'][_0x1ebc91[_0x32cdeb][_0xff13('0xb8')]]);logger[_0xff13('0x9a')]('[Dialer][checkChannel][ivr]',_0xde1a0e,_0x32cdeb,_0x1ebc91[_0x32cdeb]['queue']);delete _0x1ebc91[_0x32cdeb];}},0x2328);}});}});}}};Dialer[_0xff13('0x1c')]['countReScheduled']=function(_0x18b9ad){return Promise['resolve']()[_0xff13('0xb9')](cmHopper[_0xff13('0xba')](_0x18b9ad))[_0xff13('0xb4')](loggerCatch(_0xff13('0xbb')));};Dialer['prototype'][_0xff13('0xbc')]=function(_0xf0633d){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopperBlack[_0xff13('0xbc')](_0xf0633d))[_0xff13('0xb4')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xff13('0x1c')][_0xff13('0xbe')]=function(_0x5b87e7,_0x51a387,_0x5ba957){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopperAdditionalPhone[_0xff13('0xbe')](_0x5b87e7,_0x51a387,_0x5ba957))[_0xff13('0xb4')](loggerCatch(_0xff13('0xbf')));};Dialer[_0xff13('0x1c')]['swapAdditionalPhones']=function(_0x430599,_0xa8cd6e,_0x212aee){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopperAdditionalPhone[_0xff13('0xc0')](_0x430599,_0xa8cd6e,_0x212aee))['catch'](loggerCatch(_0xff13('0xc1')));};Dialer[_0xff13('0x1c')][_0xff13('0xc2')]=function(_0x31e567){return Promise[_0xff13('0xbd')]()['then'](cmHopperBlack[_0xff13('0xc2')](_0x31e567))[_0xff13('0xb4')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xff13('0x1c')][_0xff13('0xc3')]=function(_0x56a664){return Promise['resolve']()[_0xff13('0xb9')](cmHopperHistory['avgHandleTime'](_0x56a664))['catch'](loggerCatch(_0xff13('0xc4')));};Dialer[_0xff13('0x1c')]['rescheduleContact']=function(_0x48428a){return Promise['resolve']()[_0xff13('0xb9')](cmHopper[_0xff13('0xc5')](_0x48428a))[_0xff13('0xb4')](loggerCatch(_0xff13('0xc6')));};Dialer['prototype'][_0xff13('0xc7')]=function(_0x2ce48a,_0x32b361,_0x456460){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopper[_0xff13('0xc7')](_0x2ce48a,_0x32b361,_0x456460))['catch'](loggerCatch(_0xff13('0xc8')));};Dialer['prototype'][_0xff13('0xc9')]=function(_0x5e51ba,_0x2139c3,_0x588956,_0x235797,_0x2a9a6a){return Promise[_0xff13('0xbd')]()['then'](cmHopper['getContactDialer'](_0x5e51ba,_0x2139c3,_0x588956,_0x235797))[_0xff13('0xb4')](function(_0x1d9d04){_0x2a9a6a[_0xff13('0xca')]-=_0x588956;_0x2a9a6a[_0xff13('0xca')]=_0x2a9a6a[_0xff13('0xca')]>0x0?_0x2a9a6a[_0xff13('0xca')]:0x0;loggerCatch(_0xff13('0xcb'))(_0x1d9d04);});};Dialer[_0xff13('0x1c')]['getContactDialerIvr']=function(_0x38f743,_0x1f74a2,_0x1c2330,_0x3834ea){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopper['getContactDialerIvr'](_0x38f743,_0x1f74a2,_0x1c2330))[_0xff13('0xb4')](function(_0x38c669){_0x3834ea['temp']-=_0x1f74a2;_0x3834ea[_0xff13('0xca')]=_0x3834ea[_0xff13('0xca')]>0x0?_0x3834ea['temp']:0x0;loggerCatch(_0xff13('0xcc'))(_0x38c669);});};Dialer[_0xff13('0x1c')][_0xff13('0xcd')]=function(_0x375af0){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](voiceQueueRt['getVoiceQueueRtPauses'](_0x375af0))['catch'](loggerCatch(_0xff13('0xce')));};Dialer[_0xff13('0x1c')]['moveContactManagedDialer']=function(_0x175e48){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopper[_0xff13('0xcf')](_0x175e48))[_0xff13('0xb4')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xff13('0x1c')][_0xff13('0xd0')]=function(_0x168eb3){return Promise['resolve']()[_0xff13('0xb9')](cmHopperHistory[_0xff13('0xd0')](_0x168eb3))[_0xff13('0xb4')](loggerCatch(_0xff13('0xd1')));};Dialer[_0xff13('0x1c')][_0xff13('0xb7')]=function(_0x3a1b39){if(!_[_0xff13('0x41')](_0x3a1b39)&&_0x3a1b39!==null){if(typeof _0x3a1b39['originated']!==_0xff13('0xaf')){if(_0x3a1b39[_0xff13('0x76')]>0x0){_0x3a1b39[_0xff13('0x76')]-=0x1;}else{logger[_0xff13('0x9a')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xff13('0x9a')](_0xff13('0xd2'));}};Dialer[_0xff13('0x1c')][_0xff13('0xd3')]=function(_0x3ea1fd,_0x141805){var _0x2219b7=this;return function(_0x15fd51){_0x2219b7[_0xff13('0xb7')](_0x141805);logger['error'](_0x3ea1fd,util[_0xff13('0x99')](_0x15fd51,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x591e05,_0x41dde3,_0x119ba9){var _0x2ad65f={'state':0x19,'statedesc':'notFound'};this[_0xff13('0xb7')](_0x41dde3);this[_0xff13('0xd4')](_[_0xff13('0x91')](_0x2ad65f,_[_0xff13('0xd5')](_0x119ba9,[_0xff13('0xd6'),_0xff13('0xd7'),_0xff13('0xd8'),'VoiceQueueId',_0xff13('0xd9')])),'[emptyContact][createHistory]',_0xff13('0xda'));logger[_0xff13('0x9a')](_0x591e05);};Dialer[_0xff13('0x1c')]['isSuccess']=function(_0x58a65d){return _0x58a65d===_0xff13('0xdb');};Dialer['prototype'][_0xff13('0xdc')]=function(_0x1e8157){return!_[_0xff13('0x41')](_0x1e8157)&&_0x1e8157&&!_[_0xff13('0x41')](_0x1e8157[_0xff13('0x44')])&&!_[_0xff13('0x41')](_0x1e8157[_0xff13('0xdd')])&&_0x1e8157['active']&&(this['trunks'][util[_0xff13('0x7e')](_0xff13('0xde'),_0x1e8157[_0xff13('0x44')])][_0xff13('0xb2')]===_0xff13('0xdf')||this[_0xff13('0x25')][util[_0xff13('0x7e')]('SIP/%s',_0x1e8157[_0xff13('0x44')])]['status']==='unmonitored');};Dialer[_0xff13('0x1c')]['saveInDb']=function(_0x47f133,_0xc92ffd,_0x542b07){this['createHistory'](_0x47f133)[_0xff13('0xb4')](loggerCatch(_0xc92ffd));this['moveContactManagedDialer'](_0x47f133)[_0xff13('0xb4')](loggerCatch(_0x542b07));};Dialer['prototype'][_0xff13('0xe0')]=function(_0x4199d0){var _0x4c385e=this;var _0x3ec8fe=this[_0xff13('0x29')][_0x4199d0[_0xff13('0xe1')]];var _0x5d948b;if(!_[_0xff13('0xb0')](_0x4199d0)&&!_[_0xff13('0xb0')](_0x4199d0[_0xff13('0xe2')])&&!_[_0xff13('0xb0')](_0x4199d0[_0xff13('0xe2')][_0xff13('0xe3')])&&_0x4199d0[_0xff13('0xe4')]===_0xff13('0xe5')&&_0x3ec8fe){if(_0x3ec8fe[_0xff13('0x53')]!==_0xff13('0xb6')&&this[_0xff13('0x22')][_0x3ec8fe['queue']][_0xff13('0xe6')]&&_0x4199d0[_0xff13('0xe7')]===_0xff13('0xe8')){delete this[_0xff13('0x29')][_0x4199d0['uniqueid']];this[_0xff13('0xb7')](this['voiceQueues'][_0x3ec8fe[_0xff13('0xb8')]]);this[_0xff13('0x22')][_0x3ec8fe['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xff13('0x22')][_0x3ec8fe[_0xff13('0xb8')]][_0xff13('0x62')]+=0x1;_0x5d948b=new Hangup(_0x3ec8fe,_0x4199d0);_0x5d948b[_0xff13('0xa9')]=0x12;_0x5d948b[_0xff13('0xaa')]=_0xff13('0xe9');_0x5d948b[_0xff13('0xea')]='AMD';ami[_0xff13('0x52')](_0xff13('0xeb'),ut[_0xff13('0xec')](_0x5d948b,_0xff13('0xed')));this[_0xff13('0xd4')](_0x5d948b,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x3ec8fe[_0xff13('0x53')]!==_0xff13('0xb6')&&this[_0xff13('0x22')][_0x3ec8fe[_0xff13('0xb8')]]['dialAMDActive']&&_0x4199d0[_0xff13('0xe7')]===_0xff13('0xee')){return new Promise(function(_0x577cdb,_0xaba899){delete _0x4c385e[_0xff13('0x29')][_0x4199d0[_0xff13('0xe1')]];_0x4c385e[_0xff13('0xb7')](_0x4c385e[_0xff13('0x22')][_0x3ec8fe['queue']]);_0x4c385e[_0xff13('0x22')][_0x3ec8fe[_0xff13('0xb8')]][_0xff13('0xef')]+=0x1;_0x4c385e['voiceQueues'][_0x3ec8fe[_0xff13('0xb8')]][_0xff13('0x62')]+=0x1;var _0x2e6ded=_0x4c385e['voiceQueues'][_0x3ec8fe['queue']];var _0x5af2c3=new Hangup(_0x3ec8fe,_0x4199d0);_0x5af2c3[_0xff13('0xa9')]=0x13;_0x5af2c3[_0xff13('0xaa')]=_0xff13('0xf0');_0x5af2c3[_0xff13('0xea')]=_0xff13('0xf1');_0x5af2c3[_0xff13('0xf2')]+=0x1;_0x5af2c3[_0xff13('0xf3')]+=0x1;_0x5af2c3['amd']=!![];ami['emit'](_0xff13('0xeb'),ut[_0xff13('0xec')](_0x5af2c3,'amd'));_0x4c385e['createHistory'](_0x5af2c3)[_0xff13('0xb4')](loggerCatch(_0xff13('0xf4')));if(_0x5af2c3[_0xff13('0xf5')]+_0x5af2c3[_0xff13('0xf6')]+_0x5af2c3[_0xff13('0xf7')]+_0x5af2c3[_0xff13('0xf8')]+_0x5af2c3['countdropretry']+_0x5af2c3[_0xff13('0xf9')]+_0x5af2c3['countmachineretry']+_0x5af2c3['countagentrejectretry']>=_0x2e6ded['dialGlobalMaxRetry']){_0x4c385e['stateGlobal'](_0x5af2c3,_0x577cdb,_0xaba899,_0xff13('0xfa'));}else{if(_0x5af2c3[_0xff13('0xf2')]>=_0x2e6ded[_0xff13('0xfb')]){_0x4c385e[_0xff13('0xfc')](_0x5af2c3,_0x577cdb,_0xaba899,_0xff13('0xfd'));}else{_0x4c385e[_0xff13('0xc5')]({'active':![],'countmachineretry':_0x5af2c3[_0xff13('0xf2')],'scheduledat':moment()[_0xff13('0xfe')](_0x2e6ded[_0xff13('0xff')],_0xff13('0x100'))[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5af2c3[_0xff13('0xd6')],'ListId':_0x5af2c3[_0xff13('0xd7')],'VoiceQueueId':_0x5af2c3[_0xff13('0x101')]||undefined,'CampaignId':_0x5af2c3[_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x102')));_0x577cdb({'reschedule':0x1});}}});}if(_0x3ec8fe[_0xff13('0x53')]==='ivr'&&this[_0xff13('0x23')][_0x3ec8fe[_0xff13('0xb8')]][_0xff13('0xe6')]&&_0x4199d0[_0xff13('0xe7')]===_0xff13('0xe8')){delete this[_0xff13('0x29')][_0x4199d0['uniqueid']];this['updateOriginated'](this[_0xff13('0x23')][_0x3ec8fe['queue']]);_0x5d948b=new Hangup(_0x3ec8fe,_0x4199d0);_0x5d948b['state']=0x12;_0x5d948b['statedesc']=_0xff13('0xe9');_0x5d948b[_0xff13('0xea')]=_0xff13('0xf1');ami[_0xff13('0x52')](_0xff13('0xeb'),ut[_0xff13('0xec')](_0x5d948b,_0xff13('0xed')));this[_0xff13('0xd4')](_0x5d948b,_0xff13('0x103'),'[syncHangupInAMDIvr]');}if(_0x3ec8fe[_0xff13('0x53')]===_0xff13('0xb6')&&this[_0xff13('0x23')][_0x3ec8fe[_0xff13('0xb8')]]['dialAMDActive']&&_0x4199d0['value']===_0xff13('0xee')){return new Promise(function(_0x108040,_0x343ef1){delete _0x4c385e['uniqueId'][_0x4199d0['uniqueid']];_0x4c385e[_0xff13('0xb7')](_0x4c385e[_0xff13('0x23')][_0x3ec8fe[_0xff13('0xb8')]]);_0x4c385e['campaigns'][_0x3ec8fe[_0xff13('0xb8')]][_0xff13('0xef')]+=0x1;_0x4c385e[_0xff13('0x23')][_0x3ec8fe['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x34fd8b=_0x4c385e[_0xff13('0x23')][_0x3ec8fe['queue']];var _0x435177=new Hangup(_0x3ec8fe,_0x4199d0);_0x435177['state']=0x13;_0x435177[_0xff13('0xaa')]=_0xff13('0xf0');_0x435177[_0xff13('0xea')]='AMD';_0x435177[_0xff13('0xf2')]+=0x1;_0x435177[_0xff13('0xf3')]+=0x1;_0x435177[_0xff13('0xed')]=!![];ami[_0xff13('0x52')](_0xff13('0xeb'),ut['buildObj'](_0x435177,_0xff13('0xed')));_0x4c385e[_0xff13('0xd0')](_0x435177)[_0xff13('0xb4')](loggerCatch(_0xff13('0xf4')));if(_0x435177[_0xff13('0xf5')]+_0x435177[_0xff13('0xf6')]+_0x435177['countnoanswerretry']+_0x435177['countnosuchnumberretry']+_0x435177[_0xff13('0x104')]+_0x435177[_0xff13('0xf9')]+_0x435177[_0xff13('0xf2')]+_0x435177[_0xff13('0x105')]>=_0x34fd8b[_0xff13('0x106')]){_0x4c385e[_0xff13('0x107')](_0x435177,_0x108040,_0x343ef1,_0xff13('0xfa'));}else{if(_0x435177[_0xff13('0xf2')]>=_0x34fd8b[_0xff13('0xfb')]){_0x4c385e[_0xff13('0xfc')](_0x435177,_0x108040,_0x343ef1,_0xff13('0xfd'));}else{_0x4c385e[_0xff13('0xc5')]({'active':![],'countmachineretry':_0x435177['countmachineretry'],'scheduledat':moment()['add'](_0x34fd8b[_0xff13('0xff')],_0xff13('0x100'))[_0xff13('0x7e')](_0xff13('0x108')),'ContactId':_0x435177[_0xff13('0xd6')],'ListId':_0x435177[_0xff13('0xd7')],'VoiceQueueId':_0x435177[_0xff13('0x101')]||undefined,'CampaignId':_0x435177['CampaignId']||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x102')));_0x108040({'reschedule':0x1});}}});}}};Dialer[_0xff13('0x1c')][_0xff13('0x109')]=function(_0x1bf7e5){var _0x5ea44d=this[_0xff13('0x29')][_0x1bf7e5[_0xff13('0xe1')]];var _0x378430;if(_0x5ea44d&&_0x5ea44d['type']==='ivr'){delete this[_0xff13('0x29')][_0x1bf7e5[_0xff13('0xe1')]];this[_0xff13('0xb7')](this[_0xff13('0x23')][_0x5ea44d['queue']]);this[_0xff13('0x23')][_0x5ea44d[_0xff13('0xb8')]]['ivrAnswerCallsDay']+=0x1;_0x378430=new Hangup(_0x5ea44d,_0x1bf7e5);this[_0xff13('0xd0')](_0x378430)['catch'](loggerCatch(_0xff13('0x10a')));this[_0xff13('0xcf')](_0x378430)[_0xff13('0xb4')](loggerCatch(_0xff13('0x10b')));}if(_0x5ea44d&&_0x5ea44d['type']!==_0xff13('0xb6')&&isNotNull(this[_0xff13('0x22')][_0x5ea44d['queue']][_0xff13('0x10c')])){delete this[_0xff13('0x29')][_0x1bf7e5[_0xff13('0xe1')]];this[_0xff13('0xb7')](this[_0xff13('0x22')][_0x5ea44d[_0xff13('0xb8')]]);this['voiceQueues'][_0x5ea44d[_0xff13('0xb8')]][_0xff13('0xef')]+=0x1;this['voiceQueues'][_0x5ea44d[_0xff13('0xb8')]][_0xff13('0x62')]+=0x1;_0x378430=new Hangup(_0x5ea44d,_0x1bf7e5);_0x378430['state']=0x10;_0x378430[_0xff13('0xaa')]=_0xff13('0x10d');_0x378430[_0xff13('0xea')]='AGI';this['createHistory'](_0x378430)[_0xff13('0xb4')](loggerCatch(_0xff13('0x10a')));this['moveContactManagedDialer'](_0x378430)['catch'](loggerCatch(_0xff13('0x10b')));}if(_0x5ea44d&&_0x5ea44d[_0xff13('0x53')]!==_0xff13('0xb6')&&!isNotNull(this['voiceQueues'][_0x5ea44d['queue']][_0xff13('0x10c')])){delete this[_0xff13('0x29')][_0x1bf7e5[_0xff13('0xe1')]];this[_0xff13('0xb7')](this[_0xff13('0x22')][_0x5ea44d[_0xff13('0xb8')]]);this[_0xff13('0x22')][_0x5ea44d[_0xff13('0xb8')]]['outboundUnknownCallsDay']+=0x1;_0x378430=new Hangup(_0x5ea44d,_0x1bf7e5);_0x378430[_0xff13('0xa9')]=0xc;_0x378430['statedesc']=_0x1bf7e5['cause-txt'];_0x378430[_0xff13('0xea')]=_0xff13('0x10e');this['createHistory'](_0x378430)[_0xff13('0xb4')](loggerCatch(_0xff13('0x10a')));this[_0xff13('0xcf')](_0x378430)[_0xff13('0xb4')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xff13('0x1c')][_0xff13('0x35')]=function(_0x1c342b){var _0xe67532=this[_0xff13('0x29')][_0x1c342b[_0xff13('0xe1')]];if(this[_0xff13('0x22')][_0x1c342b['queue']]){if(_0xe67532&&_0xe67532[_0xff13('0x53')]!==_0xff13('0xb6')){delete this[_0xff13('0x29')][_0x1c342b[_0xff13('0xe1')]];this[_0xff13('0x22')][_0x1c342b[_0xff13('0xb8')]][_0xff13('0xef')]+=0x1;var _0x55f1c4=new AgentComplete(_0xe67532,_0x1c342b);if(_0x1c342b[_0xff13('0x10f')]===_0xff13('0x110')){_0x55f1c4[_0xff13('0x111')]=this['voiceQueues'][_0x1c342b[_0xff13('0xb8')]][_0xff13('0x112')]&&this[_0xff13('0x22')][_0x1c342b[_0xff13('0xb8')]][_0xff13('0x113')]?moment()[_0xff13('0x7e')](_0xff13('0x108')):undefined;}this[_0xff13('0xd0')](_0x55f1c4)[_0xff13('0xb4')](loggerCatch(_0xff13('0x114')));this[_0xff13('0xcf')](_0x55f1c4)[_0xff13('0xb4')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xff13('0x1c')][_0xff13('0x2f')]=function(_0x51478b){if(this['voiceQueues'][_0x51478b[_0xff13('0xb8')]]){if(this[_0xff13('0x29')][_0x51478b[_0xff13('0xe1')]]&&this['uniqueId'][_0x51478b[_0xff13('0xe1')]][_0xff13('0x53')]!==_0xff13('0xb6')){this[_0xff13('0xb7')](this[_0xff13('0x22')][_0x51478b[_0xff13('0xb8')]]);this['uniqueId'][_0x51478b[_0xff13('0xe1')]][_0xff13('0x115')]=moment()[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0xff13('0x116')]=function(_0x48b78a,_0x5656ca){this[_0xff13('0xd0')](_0x48b78a)[_0xff13('0xb4')](loggerCatch(_0xff13('0x114')));if(_0x5656ca==0x0){this[_0xff13('0xcf')](_0x48b78a)[_0xff13('0xb4')](loggerCatch(_0xff13('0x117')));}};Dialer[_0xff13('0x1c')][_0xff13('0x32')]=function(_0x2c6c49){var _0x4dac2f=this['uniqueId'][_0x2c6c49['uniqueid']];var _0x186ae7=this;var _0x9dd5dc=![];var _0x59017c;var _0x36e1e6;if(this[_0xff13('0x22')][_0x2c6c49['queue']]){if(_0x4dac2f&&_0x4dac2f['type']!==_0xff13('0xb6')){delete this[_0xff13('0x29')][_0x2c6c49[_0xff13('0xe1')]];this['updateOriginated'](this['voiceQueues'][_0x2c6c49['queue']]);_0x4dac2f[_0xff13('0x118')]=moment()[_0xff13('0x7e')](_0xff13('0x108'));var _0x687e75=new QueueCallerAbandon(_0x4dac2f,_0x2c6c49);if(getSeconds(_0x4dac2f['droptime'],_0x4dac2f[_0xff13('0x119')])>=_0x4dac2f['dialQueueTimeout']){this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x6f')]+=0x1;this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x11a')]+=0x1;this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x687e75[_0xff13('0xa9')]=0xa;_0x687e75[_0xff13('0xaa')]=_0xff13('0x11b');_0x687e75[_0xff13('0x11c')]=_0xff13('0x11d');_0x687e75['agiafterat']=this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]]['dialQueueProject2']?moment()[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x687e75[_0xff13('0x104')]+=0x1;_0x687e75[_0xff13('0xf3')]+=0x1;_0x59017c=this['voiceQueues'][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x11e')];_0x36e1e6=this[_0xff13('0x22')][_0x2c6c49['queue']][_0xff13('0x11f')];_0x186ae7['verifyAdditionalPhones'](_0x687e75,_0x687e75['state'],_0x4dac2f[_0xff13('0x120')])[_0xff13('0xb9')](function(_0x48160d){_0x9dd5dc=_0x48160d[_0xff13('0x121')]==0x1;if(_0x687e75[_0xff13('0x104')]>=_0x186ae7[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x122')]){_0x186ae7[_0xff13('0x116')](_0x687e75,_0x48160d['additional']);}else{_0x186ae7[_0xff13('0xc5')]({'active':![],'countdropretry':_0x687e75[_0xff13('0x104')],'scheduledat':moment()[_0xff13('0xfe')](_0x186ae7[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x11e')],_0xff13('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4dac2f['ContactId'],'ListId':_0x4dac2f[_0xff13('0xd7')],'VoiceQueueId':_0x4dac2f['VoiceQueueId']||undefined,'CampaignId':_0x4dac2f[_0xff13('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x1c9d7a=new History(_0x687e75);_0x1c9d7a[_0xff13('0xa9')]=0xa;_0x1c9d7a[_0xff13('0xaa')]=_0xff13('0x11b');_0x1c9d7a[_0xff13('0x123')]=moment()[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c9d7a['endtime']=_0x1c9d7a[_0xff13('0x123')];_0x1c9d7a[_0xff13('0x124')]=_0x687e75[_0xff13('0x124')];_0x1c9d7a[_0xff13('0x125')]=_0x687e75['calleridnum'];_0x186ae7[_0xff13('0xd0')](_0x1c9d7a)[_0xff13('0xb4')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x9dd5dc)_0x186ae7[_0xff13('0xc0')](_0x687e75,_0x59017c,_0x36e1e6)['then'](function(){return 0x1;});});}else{this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x87')]+=0x1;this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]]['outboundDropCallsDayCallersExit']+=0x1;_0x687e75[_0xff13('0xa9')]=0xb;_0x687e75['statedesc']='Abandoned';_0x687e75[_0xff13('0x11c')]='CALLEREXIT';_0x687e75['countabandonedretry']+=0x1;_0x687e75['countglobal']+=0x1;_0x59017c=this[_0xff13('0x22')][_0x2c6c49['queue']][_0xff13('0x126')];_0x36e1e6=this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x11f')];_0x186ae7[_0xff13('0xbe')](_0x687e75,_0x687e75[_0xff13('0xa9')],_0x4dac2f[_0xff13('0x120')])['then'](function(_0x1bfd8c){if(_0x687e75[_0xff13('0xf9')]>=_0x186ae7['voiceQueues'][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x127')]){_0x186ae7[_0xff13('0x116')](_0x687e75,_0x1bfd8c[_0xff13('0x121')]);}else{_0x186ae7[_0xff13('0xc5')]({'active':![],'countabandonedretry':_0x687e75[_0xff13('0xf9')],'scheduledat':moment()[_0xff13('0xfe')](_0x186ae7[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x126')],_0xff13('0x100'))['format'](_0xff13('0x108')),'ContactId':_0x4dac2f['ContactId'],'ListId':_0x4dac2f[_0xff13('0xd7')],'VoiceQueueId':_0x4dac2f[_0xff13('0x101')]||undefined,'CampaignId':_0x4dac2f['CampaignId']||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x128')));var _0x230f52=new History(_0x687e75);_0x230f52[_0xff13('0xa9')]=0xb;_0x230f52[_0xff13('0xaa')]=_0xff13('0x129');_0x230f52[_0xff13('0x123')]=moment()[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x230f52['endtime']=_0x230f52[_0xff13('0x123')];_0x230f52['calleridname']=_0x687e75[_0xff13('0x124')];_0x230f52['calleridnum']=_0x687e75['calleridnum'];_0x186ae7[_0xff13('0xd0')](_0x230f52)['catch'](loggerCatch(_0xff13('0x12a')));}})[_0xff13('0xb9')](function(){if(_0x9dd5dc)_0x186ae7[_0xff13('0xc0')](_0x687e75,_0x59017c,_0x36e1e6)[_0xff13('0xb9')](function(){return 0x1;});});}}}};Dialer['prototype'][_0xff13('0x3a')]=function(_0x194347){if(this['actions'][_0x194347['uniqueid']]){this['actions'][_0x194347[_0xff13('0xe1')]][_0xff13('0xb3')]=_0x194347[_0xff13('0xb3')];}if(this[_0xff13('0x29')][_0x194347['uniqueid']]){this['uniqueId'][_0x194347['uniqueid']][_0xff13('0xb3')]=_0x194347[_0xff13('0xb3')];}};Dialer[_0xff13('0x1c')][_0xff13('0x3d')]=function(_0x227449){if(strategy[this[_0xff13('0x22')][this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]]['queue']][_0xff13('0x55')]]===_0xff13('0x1b')){if(this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]]&&_[_0xff13('0xb0')](this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]][_0xff13('0x12c')])&&_0x227449[_0xff13('0xb2')]==='1'&&_0x227449[_0xff13('0x12d')]==='0'){if(this[_0xff13('0x24')][_0x227449[_0xff13('0x12e')]]){if(!this['agents'][_0x227449['stateinterface']][_0xff13('0x12c')]){this['agents'][_0x227449[_0xff13('0x12e')]][_0xff13('0x12c')]=!![];this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]][_0xff13('0x12c')]=!![];this[_0xff13('0x28')][_0x227449['actionid']][_0xff13('0x12e')]=_0x227449[_0xff13('0x12e')];}}}}else if((strategy[this[_0xff13('0x22')][this['actions'][_0x227449[_0xff13('0x12b')]][_0xff13('0xb8')]][_0xff13('0x55')]]||_0xff13('0x12f'))===_0xff13('0x12f')){if(this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]]){if(this[_0xff13('0x24')][_0x227449[_0xff13('0x12e')]]){this['actions'][_0x227449['actionid']]['stateinterface']=_0x227449['stateinterface'];if(_[_0xff13('0xb0')](this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x227449['actionid']][_0xff13('0xb8')]])){this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]][_0xff13('0xb8')]]=[];}this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]][_0xff13('0xb8')]][_0xff13('0x130')](_['merge'](_['pick'](this['actions'][_0x227449[_0xff13('0x12b')]],[_0xff13('0x131'),'stateinterface']),{'status':_0x227449['status'],'paused':_0x227449[_0xff13('0x12d')]}));}}}};function unlockQueueStatus(_0x10f978,_0x49e736){setTimeout(function(){if(_[_0xff13('0x41')](_0x10f978[_0xff13('0x132')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x49e736);}_0x10f978[_0xff13('0x132')]=!![];loggerBooked['info'](_0xff13('0x133'),_0x49e736,JSON[_0xff13('0x4e')](_[_0xff13('0xd5')](_0x10f978,[_0xff13('0x44'),_0xff13('0x132')])));},0x1f3);}Dialer[_0xff13('0x1c')][_0xff13('0x3e')]=function(_0x1a4d3b){var _0x25b451=this;var _0x568ecd=_0x25b451['voiceQueues'][_0x25b451[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0xb8')]];if(strategy[this[_0xff13('0x22')][this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0xb8')]]['strategy']]===_0xff13('0x1b')){if(this[_0xff13('0x28')][_0x1a4d3b['actionid']]&&this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0x12e')]){this[_0xff13('0x21')][_0xff13('0x134')](this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0x131')],this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]['stateinterface'])[_0xff13('0xb4')](function(_0x3a9151){logger[_0xff13('0x9a')](_0xff13('0x135'),util[_0xff13('0x99')](_0x3a9151,{'showHidden':![],'depth':null}));})[_0xff13('0x1f')](function(){_0x25b451[_0xff13('0xb7')](_0x25b451[_0xff13('0x22')][_0x25b451['actions'][_0x1a4d3b['actionid']]['queue']]);_0x25b451['agents'][_0x25b451[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]['stateinterface']][_0xff13('0x12c')]=![];delete _0x25b451[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]];unlockQueueStatus(_0x568ecd);});}else{this[_0xff13('0xb7')](this[_0xff13('0x22')][this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]['queue']]);this[_0xff13('0xc5')]({'active':![],'ContactId':this['actions'][_0x1a4d3b['actionid']][_0xff13('0xd6')],'ListId':this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0xd7')],'VoiceQueueId':this['actions'][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0x101')]||undefined,'CampaignId':this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0xd9')]||undefined})['catch'](loggerCatch(_0xff13('0x136')));delete this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]];unlockQueueStatus(_0x568ecd);}}else if((strategy[this[_0xff13('0x22')][this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]['queue']][_0xff13('0x55')]]||_0xff13('0x12f'))===_0xff13('0x12f')){var _0x26dc23;if(this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]&&!_[_0xff13('0x4c')](this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x1a4d3b['actionid']]['queue']])){if(this[_0xff13('0x137')][_0x25b451[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0xb8')]]){this[_0xff13('0x137')][_0x25b451['actions'][_0x1a4d3b['actionid']][_0xff13('0xb8')]]=this[_0xff13('0x137')][this[_0xff13('0x28')][_0x1a4d3b['actionid']][_0xff13('0xb8')]]?this['queueBookedRR'][this['actions'][_0x1a4d3b[_0xff13('0x12b')]]['queue']]:this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0xb8')]]?this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]['queue']][_0xff13('0x138')]||0x0:0x0;}this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x1a4d3b['actionid']][_0xff13('0xb8')]][_0xff13('0x138')]=this['queueBookedRR'][this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]['queue']];for(var _0x52f662=0x0;_0x52f662=0x0;})[_0xff13('0xb4')](myreject(_0x2b7102)));}}else{_0x180444['push'](ami['Action']({'action':_0xff13('0x151'),'command':util[_0xff13('0x7e')](_0xff13('0x156'),_0x2b23b1,!_[_0xff13('0x41')](config['timezones'][_0x3e8845])?_0x3e8845:'')})[_0xff13('0xb9')](function(_0x11da83){return _0x11da83['content'][_0xff13('0x154')]('true')>=0x0;})['catch'](myreject(_0x2b7102)));}Promise[_0xff13('0x157')](_0x180444)[_0xff13('0xb9')](function(_0x49335b){var _0x2c5750=_[_0xff13('0x158')](_0x49335b);if(_0x2c5750){return _0x4d5d16(_0x2c5750);}else{_0x1a8de3[_0xff13('0x42')]=_0x2c9a8c?'GLOBAL_INTERVAL_IS_OVERTIME':_0xff13('0x159');return _0x2b7102(msgResponse(_0xff13('0x15a'),_0xff13('0x14b'),_0xff13('0x15b')+_0x2c9a8c+'\x20'+_0x4bb609+_0xff13('0x15c')+util['inspect'](_0x2b23b1,{'showHidden':![],'depth':null})+_0xff13('0x15d')+_0x3e8845));}})[_0xff13('0xb4')](function(_0x6ec10c){return _0x2b7102(msgResponse('ifTime',_0xff13('0x14b'),JSON[_0xff13('0x4e')](_0x6ec10c)));});});};Dialer[_0xff13('0x1c')][_0xff13('0x15e')]=function(_0x9d658c){var _0x4996cb=this;return function(){switch(_0x9d658c[_0xff13('0x5d')]){case _0xff13('0x15f'):freeVariablesPredictive(_0x9d658c);_0x4996cb[_0xff13('0x160')](_0x9d658c,0x1);break;case _0xff13('0x161'):freeVariablesPredictive(_0x9d658c);_0x4996cb['handlePower'](_0x9d658c,_0x9d658c[_0xff13('0x162')]);break;case'predictive':_0x4996cb[_0xff13('0x163')](_0x9d658c);break;case'booked':freeVariablesPredictive(_0x9d658c);_0x4996cb[_0xff13('0x160')](_0x9d658c,0x1);break;default:freeVariablesPredictive(_0x9d658c);logger[_0xff13('0x9a')]('Queue',_0x9d658c[_0xff13('0x44')],_0xff13('0x164'));}};};Dialer[_0xff13('0x1c')][_0xff13('0x165')]=function(_0x633989){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopper[_0xff13('0x166')](_0x633989['id'],previewRecallmeReminderInterval))['then'](function(_0x2a67e9){for(var _0x1ac76d=0x0;_0x1ac76d<_0x2a67e9[_0xff13('0x9b')];_0x1ac76d++){var _0x2d8de0=_0x2a67e9[_0x1ac76d][_0xff13('0x167')][_0xff13('0x44')];if(_0x2d8de0)io['to'](util[_0xff13('0x7e')](_0xff13('0x168'),_0x2d8de0))[_0xff13('0x52')](_0xff13('0x169'),{'hopper':_0x2a67e9[_0x1ac76d]});}})[_0xff13('0xb4')](function(){});};Dialer['prototype'][_0xff13('0x16a')]=function(_0x4727c5){var _0x4c5561=this;return function(){_0x4c5561['handleIvr'](_0x4727c5);};};Dialer['prototype'][_0xff13('0xb')]=function(_0x3344f0){var _0xdbb5f8=this;if(isNotPreview(_0x3344f0[_0xff13('0x5d')])){if(isVoiceQueueOutbound(_0x3344f0[_0xff13('0x53')])&&isActive(_0x3344f0[_0xff13('0x5c')])){_0x3344f0[_0xff13('0xa2')]=!![];Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](checkIsLoggedIn(_0x3344f0,_0x3344f0[_0xff13('0x16b')]))['then'](checkIsActive(_0x3344f0,_0x3344f0[_0xff13('0x5c')]))['then'](checkInterval(_0x3344f0))[_0xff13('0xb9')](_0xdbb5f8[_0xff13('0x145')](_0x3344f0))[_0xff13('0xb9')](_0xdbb5f8['checkIfTime'](_0x3344f0[_0xff13('0x16c')],_0x3344f0[_0xff13('0x16d')],_0x3344f0[_0xff13('0x44')],_0x3344f0))[_0xff13('0xb9')](_0xdbb5f8[_0xff13('0x14a')](_0x3344f0[_0xff13('0x48')],_0x3344f0[_0xff13('0x16d')],_0x3344f0[_0xff13('0x44')],_0x3344f0))[_0xff13('0xb9')](_0xdbb5f8[_0xff13('0x15e')](_0x3344f0))[_0xff13('0xb4')](loggerCatchQueueSummary(_0xff13('0x16e'),_0x3344f0));}else{notSendMessagesQueue(_0x3344f0);}}else{freeVariablesPredictive(_0x3344f0);}};Dialer['prototype'][_0xff13('0x16f')]=_[_0xff13('0x170')](function(){var _0x6ec393=_[_0xff13('0x171')](this[_0xff13('0x22')],function(_0x39f0e0){return _0x39f0e0[_0xff13('0x172')];});var _0x1f5567=_[_0xff13('0x171')](this[_0xff13('0x24')],function(_0x3acc27){return _0x3acc27[_0xff13('0x173')]&&_0x3acc27[_0xff13('0xb2')]===_0xff13('0xdf');});if(_0x6ec393[_0xff13('0x9b')]>0x0&&_0x1f5567['length']>0x0){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopper[_0xff13('0x166')](_[_0xff13('0x174')](_0x6ec393,'id'),previewRecallmeReminderInterval,_[_0xff13('0x174')](_0x1f5567,'id')))['then'](function(_0x50d204){for(var _0x41ec7e=0x0;_0x41ec7e<_0x50d204[_0xff13('0x9b')];_0x41ec7e++){var _0x37811a=_0x50d204[_0x41ec7e][_0xff13('0x167')][_0xff13('0x44')];if(_0x37811a)io['to'](util['format'](_0xff13('0x168'),_0x37811a))[_0xff13('0x52')]('user:dialPreviewRecallReminder',{'hopper':_0x50d204[_0x41ec7e]});}})['catch'](function(_0x5a7ceb){logger['error']('checkPreviewRecallReminder',_0x5a7ceb);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xff13('0x1c')][_0xff13('0x144')]=function(){var _0x53ba28=this;var _0x20917b;for(var _0x22eb71 in this[_0xff13('0x23')]){if(typeof this[_0xff13('0x23')][_0x22eb71]!==_0xff13('0xaf')){_0x20917b=this[_0xff13('0x23')][_0x22eb71];if(isCampaignIvr(_0x20917b[_0xff13('0x53')])&&isActive(_0x20917b['active'])){_0x20917b[_0xff13('0xa2')]=!![];Promise['resolve']()[_0xff13('0xb9')](checkIsActive(_0x20917b,_0x20917b[_0xff13('0xdd')]))[_0xff13('0xb9')](checkInterval(_0x20917b))['then'](_0x53ba28[_0xff13('0x145')](_0x20917b))['then'](_0x53ba28[_0xff13('0x175')](_0x20917b['dialGlobalInterval'],_0x20917b[_0xff13('0x16d')],_0x20917b['name'],_0x20917b))[_0xff13('0xb9')](_0x53ba28['checkIfTimeIntervals'](_0x20917b[_0xff13('0x48')],_0x20917b[_0xff13('0x16d')],_0x20917b['name'],_0x20917b))[_0xff13('0xb9')](_0x53ba28[_0xff13('0x16a')](_0x20917b))[_0xff13('0xb4')](loggerCatchQueueSummary(_0xff13('0x176'),_0x20917b));}else{notSendMessagesCampaign(_0x20917b);}}}};function getCallerIdRandom(_0x474a6d,_0x1d12f5){var _0x14f1b8;var _0x267dc4;var _0x3ade9b;if(_0x1d12f5<=0x0){_0x1d12f5=0x1;}_0x14f1b8=new RegExp('\x5cw{0,'+_0x1d12f5+'}$');_0x267dc4=Math[_0xff13('0x177')](0xa,_0x1d12f5-0x1);_0x3ade9b=Math['pow'](0xa,_0x1d12f5)-0x1;return util[_0xff13('0x7e')]('%s',_['replace'](_0x474a6d,_0x14f1b8,_[_0xff13('0x178')](_0x267dc4,_0x3ade9b)));}function extractCalleridName(_0x13a00d){var _0x40ac30=_0x13a00d['match'](/"(.*?)"/);return _0x40ac30?_0x40ac30[0x1]:_0x13a00d;}Dialer[_0xff13('0x1c')][_0xff13('0x179')]=function(_0x3b297f,_0x4c4454){var _0x391f46=this;var _0x598dad=uuid['v4']();this[_0xff13('0x28')][_0x598dad]=new Action(_0x3b297f,_0x4c4454,_0x598dad);return new Promise(function(_0x33797a,_0x532fad){if(_['isUndefined'](_0x3b297f)&&typeof _0x3b297f!=='object'){return _0x532fad(msgResponse(_0xff13('0x17a'),_0xff13('0x14b'),_0xff13('0x17b')));}if(_['isUndefined'](_0x4c4454[_0xff13('0x17c')])||_0x4c4454['phone']===null){return _0x532fad(msgResponse(_0xff13('0x17a'),_0xff13('0x14b'),_0xff13('0x17d')));}var _0x31073a={'XMD-CALLERID':_0x391f46[_0xff13('0x28')][_0x598dad][_0xff13('0x17e')](),'XMD-AGI':_0x3b297f[_0xff13('0x10c')]?util[_0xff13('0x7e')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3b297f['dialQueueProject']):_0xff13('0x17f'),'XMD-AGIAFTER':_0x3b297f[_0xff13('0x112')]?util[_0xff13('0x7e')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3b297f[_0xff13('0x112')]):'NONE','XMD-QUEUE':_0x3b297f[_0xff13('0x53')]===_0xff13('0x54')?util[_0xff13('0x7e')](_0xff13('0x180'),_0x3b297f['name'],_0x3b297f[_0xff13('0x181')]||'',_0x3b297f[_0xff13('0x113')]?'c':'',_0x3b297f[_0xff13('0x182')]||0x3):_0xff13('0x17f'),'XMD-CONTACTID':_0x4c4454[_0xff13('0xd6')],'XMD-CDRTYPE':_0xff13('0x8'),'CALLERID(all)':_0x391f46[_0xff13('0x28')][_0x598dad][_0xff13('0x17e')](),'XMD-AMD':_0x3b297f[_0xff13('0xe6')]?_0xff13('0x183'):_0xff13('0x17f'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3b297f[_0xff13('0xe6')]){_0x31073a[_0xff13('0x184')]=_0x3b297f[_0xff13('0x185')]||0x9c4;_0x31073a[_0xff13('0x186')]=_0x3b297f[_0xff13('0x187')]||0x5dc;_0x31073a[_0xff13('0x188')]=_0x3b297f[_0xff13('0x189')]||0x320;_0x31073a[_0xff13('0x18a')]=_0x3b297f[_0xff13('0x18b')]||0x1388;_0x31073a[_0xff13('0x18c')]=_0x3b297f[_0xff13('0x18d')]||0x64;_0x31073a['XMD-AMDBETWEENWORDSSILENCE']=_0x3b297f[_0xff13('0x18e')]||0x32;_0x31073a[_0xff13('0x18f')]=_0x3b297f['dialAMDMaximumNumberOfWords']||0x3;_0x31073a[_0xff13('0x190')]=_0x3b297f[_0xff13('0x191')]||0x100;_0x31073a[_0xff13('0x192')]=_0x3b297f['dialAMDMaximumWordLength']||0x1388;}if(_0x3b297f['type']===_0xff13('0x54')){_0x31073a['XMD-VOICEQUEUEID']=_0x4c4454[_0xff13('0x101')];}else{_0x31073a[_0xff13('0x193')]=_0x4c4454[_0xff13('0xd9')];}for(var _0x52631a in _0x4c4454[_0xff13('0x194')]){if(typeof _0x4c4454[_0xff13('0x194')][_0x52631a]!==_0xff13('0xaf')){if(isNotNull(_0x4c4454[_0xff13('0x194')][_0x52631a])&&_0x52631a!=='id'&&_0x52631a!==_0xff13('0x195')&&_0x52631a!==_0xff13('0x196')&&_0x52631a!==_0xff13('0x197')){_0x31073a[util[_0xff13('0x7e')]('%s%s',_0xff13('0x198'),_[_0xff13('0x199')](_0x52631a))]=_0x4c4454[_0xff13('0x194')][_0x52631a];}}}var _0xeccb22=_0x391f46[_0xff13('0xdc')](_0x3b297f[_0xff13('0x7b')])?getCallerId(_0x3b297f['Trunk'][_0xff13('0x7c')],_0x3b297f[_0xff13('0x5e')],_0x3b297f[_0xff13('0x19a')]>0x0?getCallerIdRandom(_0x3b297f[_0xff13('0x5f')],_0x3b297f[_0xff13('0x19a')]):_0x3b297f['dialOriginateCallerIdNumber']):getCallerId(_[_0xff13('0xb0')](_0x3b297f['TrunkBackup'])?_0x3b297f['Trunk'][_0xff13('0x7c')]:_0x3b297f['TrunkBackup']['callerid'],_0x3b297f[_0xff13('0x5e')],_0x3b297f['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3b297f[_0xff13('0x5f')],_0x3b297f[_0xff13('0x19a')]):_0x3b297f[_0xff13('0x5f')]);if(_0xeccb22){_0x31073a['XMD-ORIGINATECALLERIDNAME']=_0x391f46[_0xff13('0x28')][_0x598dad][_0xff13('0x19b')]=extractCalleridName(_0xeccb22);_0x31073a[_0xff13('0x19c')]=_0x4c4454[_0xff13('0x17c')];}_0x3b297f['variables']=_0x31073a;return ami[_0xff13('0xb1')]({'actionid':_0x598dad,'action':'originate','channel':_0x391f46[_0xff13('0xdc')](_0x3b297f[_0xff13('0x7b')])?util[_0xff13('0x7e')]('SIP/%s/%s%s',_0x3b297f[_0xff13('0x7b')]['name'],isNotNull(_0x3b297f[_0xff13('0x61')])?_0x3b297f['dialPrefix'][_0xff13('0x19d')]()||'':'',_0x3b297f[_0xff13('0x19e')]>0x0?_0x4c4454[_0xff13('0x17c')][_0xff13('0x19f')](_0x3b297f[_0xff13('0x19e')]):_0x4c4454[_0xff13('0x17c')]):util[_0xff13('0x7e')](_0xff13('0x1a0'),_[_0xff13('0xb0')](_0x3b297f[_0xff13('0x146')])?_0x3b297f[_0xff13('0x7b')][_0xff13('0x44')]:_0x3b297f[_0xff13('0x146')][_0xff13('0x44')],isNotNull(_0x3b297f[_0xff13('0x61')])?_0x3b297f[_0xff13('0x61')]['trim']()||'':'',_0x3b297f[_0xff13('0x19e')]>0x0?_0x4c4454[_0xff13('0x17c')][_0xff13('0x19f')](_0x3b297f[_0xff13('0x19e')]):_0x4c4454[_0xff13('0x17c')]),'callerid':_0xeccb22,'Exten':_0xff13('0xe5'),'Context':_0xff13('0x1a1'),'Priority':'1','variable':_0x31073a,'timeout':(_0x3b297f[_0xff13('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x598dad})[_0xff13('0xb9')](function(_0x5281af){return _0x33797a(_0x5281af);})[_0xff13('0xb4')](function(_0x40ebfa){_0x3b297f['outboundOriginateFailureCallsDay']+=0x1;var _0x572347=new History(_0x391f46[_0xff13('0x28')][_0x598dad]);logger[_0xff13('0x9a')](util[_0xff13('0x7e')](_0xff13('0x1a2'),JSON[_0xff13('0x4e')](_0x40ebfa)));_0x572347['state']=0xe;_0x572347[_0xff13('0xaa')]=_0xff13('0x1a3');_0x572347['starttime']=moment()[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x572347[_0xff13('0xab')]=_0x572347[_0xff13('0x123')];_0x391f46[_0xff13('0xd0')](_0x572347)[_0xff13('0xb4')](loggerCatch(_0xff13('0x1a4')));_0x391f46['moveContactManagedDialer'](_0x572347)[_0xff13('0xb4')](loggerCatch('[originate][error]'))[_0xff13('0x1f')](function(){delete _0x391f46[_0xff13('0x28')][_0x598dad];return _0x532fad(msgResponse(_0xff13('0x17a'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0xff13('0x1c')]['syncOriginateResponse']=function(_0x5cb785){var _0x3a5b7e=this[_0xff13('0x28')][_0x5cb785['actionid']];if(_0x3a5b7e){delete this[_0xff13('0x28')][_0x5cb785[_0xff13('0x12b')]];_0x3a5b7e[_0xff13('0x119')]=moment()[_0xff13('0x7e')](_0xff13('0x108'));var _0x548ac5=_0x3a5b7e[_0xff13('0x53')]===_0xff13('0xb6')?this['campaigns'][_0x3a5b7e[_0xff13('0xb8')]]:this[_0xff13('0x22')][_0x3a5b7e['getQueue']()];if(!this['isSuccess'](_0x5cb785['response'])){this[_0xff13('0xb7')](_0x548ac5);return this[_0xff13('0x1a5')](_0x3a5b7e,_0x548ac5,_0x5cb785)[_0xff13('0xb4')](loggerCatch(_0xff13('0x1a6')));}this[_0xff13('0x29')][_0x5cb785['uniqueid']]=_0x3a5b7e;}};Dialer['prototype'][_0xff13('0x1a7')]=function(_0x2c089a,_0x2b5e0d,_0x276729){var _0xcb46d3=new History(_0x2b5e0d);if(_0xcb46d3['countbusyretry']+_0xcb46d3[_0xff13('0xf6')]+_0xcb46d3[_0xff13('0xf7')]+_0xcb46d3[_0xff13('0xf8')]+_0xcb46d3['countdropretry']+_0xcb46d3[_0xff13('0xf9')]+_0xcb46d3[_0xff13('0xf2')]+_0xcb46d3[_0xff13('0x105')]>=_0x276729[_0xff13('0x106')]-0x1){return!![];}switch(_0x2c089a){case 0x3:if(_0xcb46d3[_0xff13('0xf7')]>=_0x276729[_0xff13('0x1a8')]-0x1){return!![];}this[_0xff13('0xc5')]({'active':![],'countnoanswerretry':_0xcb46d3[_0xff13('0xf7')]+=0x1,'scheduledat':moment()[_0xff13('0xfe')](_0x276729[_0xff13('0x1a9')],'minutes')['format'](_0xff13('0x108')),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3['ListId'],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3['CampaignId']||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x1aa')));break;case 0x5:if(_0xcb46d3[_0xff13('0xf5')]>=_0x276729['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0xcb46d3[_0xff13('0xf5')]+=0x1,'scheduledat':moment()[_0xff13('0xfe')](_0x276729[_0xff13('0x1ab')],_0xff13('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3[_0xff13('0xd7')],'VoiceQueueId':_0xcb46d3['VoiceQueueId']||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})['catch'](loggerCatch(_0xff13('0x1ac')));break;case 0x8:if(_0xcb46d3[_0xff13('0xf6')]>=_0x276729[_0xff13('0x1ad')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0xcb46d3[_0xff13('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x276729[_0xff13('0x1ae')],'minutes')[_0xff13('0x7e')](_0xff13('0x108')),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3[_0xff13('0xd7')],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})['catch'](loggerCatch(_0xff13('0x1af')));break;case 0x0:if(_0xcb46d3['countnosuchnumberretry']>=_0x276729[_0xff13('0x1b0')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0xcb46d3[_0xff13('0xf8')]+=0x1,'scheduledat':moment()[_0xff13('0xfe')](_0x276729[_0xff13('0x1b1')],'minutes')[_0xff13('0x7e')](_0xff13('0x108')),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3[_0xff13('0xd7')],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0xcb46d3[_0xff13('0x104')]>=_0x276729[_0xff13('0x122')]-0x1){return!![];}this[_0xff13('0xc5')]({'active':![],'countdropretry':_0xcb46d3[_0xff13('0x104')]+=0x1,'scheduledat':moment()[_0xff13('0xfe')](_0x276729['dialDropRetryFrequency'],_0xff13('0x100'))['format'](_0xff13('0x108')),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3[_0xff13('0xd7')],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x1b2')));break;case 0xb:if(_0xcb46d3[_0xff13('0xf9')]>=_0x276729['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xff13('0xc5')]({'active':![],'countabandonedretry':_0xcb46d3[_0xff13('0xf9')]+=0x1,'scheduledat':moment()['add'](_0x276729['dialAbandonedRetryFrequency'],_0xff13('0x100'))[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xcb46d3['ContactId'],'ListId':_0xcb46d3[_0xff13('0xd7')],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})['catch'](loggerCatch(_0xff13('0x128')));break;case 0x13:if(_0xcb46d3[_0xff13('0xf2')]>=_0x276729[_0xff13('0xfb')]-0x1){return!![];}this[_0xff13('0xc5')]({'active':![],'countmachineretry':_0xcb46d3[_0xff13('0xf2')]+=0x1,'scheduledat':moment()[_0xff13('0xfe')](_0x276729[_0xff13('0xff')],_0xff13('0x100'))['format'](_0xff13('0x108')),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3[_0xff13('0xd7')],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xcb46d3[_0xff13('0x105')]>=_0x276729['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xff13('0xc5')]({'active':![],'countagentrejectretry':_0xcb46d3[_0xff13('0x105')]+=0x1,'scheduledat':moment()[_0xff13('0xfe')](_0x276729[_0xff13('0x1b3')],_0xff13('0x100'))[_0xff13('0x7e')](_0xff13('0x108')),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3['ListId'],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x1b4')));break;default:return!![];}};Dialer['prototype'][_0xff13('0x1a5')]=function(_0x21140b,_0x5a31a6,_0x50451f){var _0x39226f=this;var _0x52bc6b=new History(_0x21140b);var _0x16907c=![];var _0x2c99a3;var _0x1764a4;return new Promise(function(_0x3e721b,_0x4badfe){if(_[_0xff13('0x41')](_0x5a31a6)&&typeof _0x5a31a6!==_0xff13('0x1b5')){return _0x4badfe(msgResponse(_0xff13('0x1b6'),'Failure',_0xff13('0x1b7')));}if(_[_0xff13('0x41')](_0x50451f)&&typeof _0x50451f!==_0xff13('0x1b5')){return _0x4badfe(msgResponse(_0xff13('0x1b6'),_0xff13('0x14b'),'evt\x20is\x20undefine'));}_0x39226f[_0xff13('0xbe')](_0x52bc6b,_0x50451f['reason'],_0x5a31a6)[_0xff13('0xb9')](function(_0x8647c5){if(_0x8647c5['additional']==0x1)_0x16907c=!![];switch(_0x50451f[_0xff13('0x10f')]){case'0':_0x5a31a6['outboundNoSuchCallsDay']+=0x1;_0x52bc6b[_0xff13('0xa9')]=0x0;_0x52bc6b[_0xff13('0xaa')]=_0xff13('0x1b8');_0x52bc6b[_0xff13('0xf8')]+=0x1;_0x52bc6b[_0xff13('0xf3')]+=0x1;ami['emit'](_0xff13('0x1b9'),ut[_0xff13('0xec')](_0x21140b,_0xff13('0x1ba')));_0x2c99a3=_0x5a31a6[_0xff13('0x1b1')];_0x1764a4=_0x5a31a6[_0xff13('0x11f')];_0x39226f['createHistory'](_0x52bc6b)[_0xff13('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x39226f['checkRetriveMax'](0x0,_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b[_0xff13('0xf8')]>=_0x5a31a6[_0xff13('0x1b0')]){_0x39226f[_0xff13('0xfc')](_0x52bc6b,_0x3e721b,_0x4badfe,'reason\x200\x20no\x20such\x20number....');}else{_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1bb'));}}break;case'3':_0x5a31a6[_0xff13('0x68')]+=0x1;_0x52bc6b[_0xff13('0xa9')]=0x3;_0x52bc6b[_0xff13('0xaa')]='NoAnswer';_0x52bc6b[_0xff13('0xf7')]+=0x1;_0x52bc6b[_0xff13('0xf3')]+=0x1;var _0x2a81cd=ut[_0xff13('0x1bc')](_0x21140b,_0x5a31a6);ami[_0xff13('0x52')]('custom:agentnoanswer',_0x2a81cd);_0x2c99a3=_0x5a31a6['dialNoAnswerRetryFrequency'];_0x1764a4=_0x5a31a6[_0xff13('0x11f')];_0x39226f[_0xff13('0xd0')](_0x52bc6b)[_0xff13('0xb4')](loggerCatch(_0xff13('0x1bd')));if(_0x39226f[_0xff13('0x1a7')](0x3,_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b[_0xff13('0xf7')]>=_0x5a31a6[_0xff13('0x1a8')]){_0x39226f[_0xff13('0xfc')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1be'));}else{_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x5a31a6[_0xff13('0x64')]+=0x1;_0x52bc6b[_0xff13('0xa9')]=0x5;_0x52bc6b[_0xff13('0xaa')]=_0xff13('0x1bf');_0x52bc6b['countbusyretry']+=0x1;_0x52bc6b['countglobal']+=0x1;ami['emit'](_0xff13('0x1c0'),ut[_0xff13('0xec')](_0x21140b,'busy'));_0x2c99a3=_0x5a31a6[_0xff13('0x1ab')];_0x1764a4=_0x5a31a6[_0xff13('0x11f')];_0x39226f[_0xff13('0xd0')](_0x52bc6b)[_0xff13('0xb4')](loggerCatch(_0xff13('0x1c1')));if(_0x39226f[_0xff13('0x1a7')](0x5,_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b[_0xff13('0xf5')]>=_0x5a31a6['dialBusyMaxRetry']){_0x39226f[_0xff13('0xfc')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1c2'));}else{_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1c2'));}}break;case'8':_0x5a31a6[_0xff13('0x65')]+=0x1;_0x52bc6b[_0xff13('0xa9')]=0x8;_0x52bc6b[_0xff13('0xaa')]=_0xff13('0x1c3');_0x52bc6b[_0xff13('0xf6')]+=0x1;_0x52bc6b[_0xff13('0xf3')]+=0x1;_0x2c99a3=_0x5a31a6[_0xff13('0x1ae')];_0x1764a4=_0x5a31a6['callAdditionalPhoneAfterMin'];ami[_0xff13('0x52')](_0xff13('0x1c4'),ut[_0xff13('0xec')](_0x21140b,_0xff13('0x1c5')));_0x39226f[_0xff13('0xd0')](_0x52bc6b)[_0xff13('0xb4')](loggerCatch(_0xff13('0x1c6')));if(_0x39226f[_0xff13('0x1a7')](0x8,_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b['countcongestionretry']>=_0x5a31a6['dialCongestionMaxRetry']){_0x39226f[_0xff13('0xfc')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1c7'));}else{_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1c7'));}}break;case'11':_0x5a31a6['outboundAbandonedCallsDay']+=0x1;_0x52bc6b[_0xff13('0xa9')]=0xb;_0x52bc6b[_0xff13('0xaa')]=_0xff13('0x129');_0x52bc6b['countabandonedretry']+=0x1;_0x52bc6b[_0xff13('0xf3')]+=0x1;_0x2c99a3=_0x5a31a6[_0xff13('0x126')];_0x1764a4=_0x5a31a6[_0xff13('0x11f')];_0x39226f['createHistory'](_0x52bc6b)['catch'](loggerCatch(_0xff13('0x12a')));if(_0x39226f[_0xff13('0x1a7')](0xb,_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b[_0xff13('0xf9')]>=_0x5a31a6['dialAbandonedMaxRetry']){_0x39226f[_0xff13('0xfc')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1c8'));}else{_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1c8'));}}break;case'20':_0x5a31a6['outboundRejectCallsDay']+=0x1;_0x52bc6b[_0xff13('0xa9')]=0x14;_0x52bc6b[_0xff13('0xaa')]='AgentReject';_0x52bc6b['countagentrejectretry']+=0x1;_0x52bc6b[_0xff13('0xf3')]+=0x1;_0x2c99a3=_0x5a31a6['dialAgentRejectRetryFrequency'];_0x1764a4=_0x5a31a6[_0xff13('0x11f')];ami[_0xff13('0x52')](_0xff13('0x1c9'),ut['buildObj'](_0x21140b,_0xff13('0x1ca')));_0x39226f['createHistory'](_0x52bc6b)[_0xff13('0xb4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x39226f['checkRetriveMax'](0x14,_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b[_0xff13('0x105')]>=_0x5a31a6[_0xff13('0x1cb')]){_0x39226f['createStateFinal'](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1cc'));}else{_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1cc'));}}break;default:_0x5a31a6[_0xff13('0x6b')]+=0x1;_0x52bc6b[_0xff13('0xa9')]=0xc;_0x52bc6b[_0xff13('0xaa')]=_0x50451f[_0xff13('0x10f')];_0x2c99a3=_0x5a31a6['dialAgentRejectRetryFrequency'];_0x1764a4=_0x5a31a6[_0xff13('0x11f')];_0x39226f[_0xff13('0xd0')](_0x52bc6b)['catch'](loggerCatch(_0xff13('0x1cd')));if(_0x39226f[_0xff13('0x1a7')](_0x50451f['reason'],_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b['countbusyretry']+_0x52bc6b[_0xff13('0xf6')]+_0x52bc6b[_0xff13('0xf7')]+_0x52bc6b[_0xff13('0xf8')]+_0x52bc6b[_0xff13('0x104')]+_0x52bc6b['countabandonedretry']+_0x52bc6b['countmachineretry']+_0x52bc6b[_0xff13('0x105')]>=_0x5a31a6[_0xff13('0x106')]){_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,_0x50451f[_0xff13('0x10f')]);}else{_0x39226f[_0xff13('0xfc')](_0x52bc6b,_0x3e721b,_0x4badfe,_0x50451f[_0xff13('0x10f')]);}}}})['then'](function(){if(_0x16907c){_0x39226f[_0xff13('0xc0')](_0x52bc6b,_0x2c99a3,_0x1764a4)[_0xff13('0xb9')](function(){return _0x3e721b(0x1);});}});});};Dialer['prototype'][_0xff13('0x107')]=function(_0x591797,_0x2dfaaf,_0x32bdaf,_0x1a8ed7){var _0x28690c=new Final(_0x591797);_0x28690c['state']=0xf;_0x28690c['statedesc']=_0xff13('0x1ce');this[_0xff13('0xfc')](_0x28690c,_0x2dfaaf,_0x32bdaf,_0x1a8ed7);};Dialer[_0xff13('0x1c')][_0xff13('0xfc')]=function(_0x374065,_0x4719f3,_0x23a4e3,_0x3c8c27){this[_0xff13('0xcf')](_0x374065)[_0xff13('0xb9')](function(){return _0x4719f3(msgResponse(_0xff13('0x1b6'),_0xff13('0xdb'),_0x3c8c27));})[_0xff13('0xb4')](function(){return _0x23a4e3(msgResponse(_0xff13('0x1cf'),'Failure',_0xff13('0x1d0')));});};Dialer[_0xff13('0x1c')][_0xff13('0x163')]=function(_0x554b0b){var _0x1dd172=_0x554b0b['dialPredictiveOptimizationPercentage']/0x64;var _0x349c3b=_0x554b0b[_0xff13('0x11a')]/(_0x554b0b[_0xff13('0x11a')]+_0x554b0b[_0xff13('0xef')]);var _0x446f7a=Math['round'](_0x554b0b[_0xff13('0x74')]*(_0x554b0b[_0xff13('0x1d1')]/0x64));var _0x247e98=Math['round'](_0x554b0b[_0xff13('0x74')]*(_0x554b0b['predictiveIntervalMinThreshold']/0x64));var _0x49c22d=_0x554b0b[_0xff13('0x57')]+_0x554b0b[_0xff13('0x5b')];var _0x44233f=Math[_0xff13('0x1d2')](_0x554b0b['erlangCalls']*_0x554b0b['erlangAbandonmentRate']*_0x554b0b[_0xff13('0x71')]*_0x554b0b['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x554b0b[_0xff13('0x7a')])){if(!_['isUndefined'](_0x554b0b['startPredictive'])){_0x554b0b[_0xff13('0x2b')]=undefined;loggerPredictive[_0xff13('0x9a')]('[startMethodPredictive][StartProgressive]',_0xff13('0x1d3'));}if(!_[_0xff13('0x41')](_0x554b0b[_0xff13('0x94')])){loggerPredictive[_0xff13('0x9a')](_0xff13('0x1d4'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x554b0b[_0xff13('0x94')]);_0x554b0b[_0xff13('0x94')]=undefined;}_0x554b0b['startProgressive']=moment()['format'](_0xff13('0x108'));loggerPredictive[_0xff13('0x82')](_0x554b0b[_0xff13('0x44')],_0xff13('0x1d5'),_0x554b0b['startProgressive']);this[_0xff13('0x160')](_0x554b0b,0x1);}else if(ifInterval(_0x554b0b['dialPredictiveInterval'],_0x554b0b[_0xff13('0x7a')])){this['handlePower'](_0x554b0b,0x1);loggerPredictiveCalls[_0xff13('0x82')]('[startMethodPredictive][StartProgressive][Loop]',_0x554b0b[_0xff13('0x7a')],_0x554b0b[_0xff13('0x44')]);_0x554b0b['erlangCalls']=0x0;_0x554b0b[_0xff13('0x70')]=0x0;}else if(_0x1dd172<_0x349c3b&&_0x554b0b['dialPredictiveOptimization']===_0xff13('0x1d6')){freeVariablesPredictive(_0x554b0b);loggerPredictive[_0xff13('0x82')](_0xff13('0x1d7'),_0xff13('0x1d8'),_0x349c3b,_0xff13('0x7a'),_0x554b0b[_0xff13('0x44')]);}else if(_0x44233f<_0x554b0b[_0xff13('0x70')]&&_0x554b0b['dialPredictiveOptimization']===_0xff13('0x1d6')){freeVariablesPredictive(_0x554b0b);loggerPredictive[_0xff13('0x82')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xff13('0x1d9'),_0x44233f,_0xff13('0x1da'),_0x554b0b[_0xff13('0x70')],_0xff13('0x7a'),_0x554b0b['name']);}else if(!ifInterval(_0x554b0b[_0xff13('0x1db')],_0x554b0b[_0xff13('0x7a')])&&_[_0xff13('0x41')](_0x554b0b['startPredictive'])&&!_[_0xff13('0x41')](_0x554b0b[_0xff13('0x7a')])){_0x554b0b['startPredictive']=moment()[_0xff13('0x7e')](_0xff13('0x108'));loggerPredictive[_0xff13('0x82')](_0x554b0b[_0xff13('0x44')],_0xff13('0x1dc'),_0x554b0b['startPredictive']);this[_0xff13('0xc3')](_0x554b0b[_0xff13('0x1db')])[_0xff13('0xb9')](this[_0xff13('0x1dd')](_0x554b0b))[_0xff13('0xb9')](mergeDataErlangB(_0x554b0b))[_0xff13('0xb9')](this[_0xff13('0x1de')](_0x554b0b))[_0xff13('0xb4')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x554b0b));}else if(!ifInterval(_0x554b0b[_0xff13('0x1db')],_0x554b0b[_0xff13('0x2b')])){_0x554b0b[_0xff13('0x70')]=0x0;_0x554b0b['startPredictive']=moment()[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xff13('0x82')](_0x554b0b['name'],_0xff13('0x1df'),_0x554b0b[_0xff13('0x2b')]);clearInterval(_0x554b0b[_0xff13('0x94')]);_0x554b0b[_0xff13('0x94')]=undefined;this[_0xff13('0xc3')](_0x554b0b['dialPredictiveInterval'])['then'](this[_0xff13('0x1dd')](_0x554b0b))[_0xff13('0xb9')](mergeDataErlangB(_0x554b0b))[_0xff13('0xb9')](this[_0xff13('0x1de')](_0x554b0b))[_0xff13('0xb4')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x554b0b));}else if(_0x554b0b[_0xff13('0x74')]&&_0x49c22d<_0x554b0b[_0xff13('0x74')]-_0x247e98){freeVariablesPredictive(_0x554b0b);loggerPredictive[_0xff13('0x82')](_0x554b0b[_0xff13('0x44')],_0xff13('0x1e0'),_0x49c22d,_0xff13('0x1e1'),_0x554b0b[_0xff13('0x74')],'-',_0x247e98,'=',_0x554b0b['predictiveIntervalAvailable']-_0x247e98,')');}else if(_0x554b0b[_0xff13('0x74')]&&_0x49c22d>_0x554b0b[_0xff13('0x74')]+_0x446f7a){freeVariablesPredictive(_0x554b0b);loggerPredictive[_0xff13('0x82')](_0x554b0b[_0xff13('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x49c22d,')\x20are\x20more\x20than\x20threshold\x20(',_0x554b0b['predictiveIntervalAvailable'],'+',_0x446f7a,'=',_0x554b0b[_0xff13('0x74')]+_0x446f7a,')');}};Dialer['prototype'][_0xff13('0x1dd')]=function(_0x52ca27){var _0xa5b2eb=this;return function(_0x396b7e){return new Promise(function(_0x54b8b7,_0xe3f143){_[_0xff13('0x91')](_0x52ca27,_0x396b7e[0x0]);if(checkGetDataPredictive(_0x396b7e[0x0])){var _0x54c4f0=_0x52ca27['predictiveIntervalAvailable']=_0x52ca27[_0xff13('0x5b')]+_0x52ca27[_0xff13('0x57')];var _0x24107c=_0x52ca27[_0xff13('0x1db')]*0x3c;var _0x4ae15d=_0x396b7e[0x0][_0xff13('0x6e')]+_0x396b7e[0x0]['predictiveIntervalAvgHoldtime'];var _0x31d807=(_0x396b7e[0x0][_0xff13('0x6c')]+_0x396b7e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x396b7e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x396b7e[0x0][_0xff13('0x75')];_0x52ca27['predictiveIntervalHitRate']=_0x31d807>0x0?_0x31d807:0x1;switch(_0x52ca27[_0xff13('0x1e2')]){case _0xff13('0x1d6'):var _0x4a29a6=_0x52ca27[_0xff13('0x1e3')]/0x64;return _0xa5b2eb[_0xff13('0x1e4')](_0x54c4f0,_0x24107c,_0x4ae15d,_0x31d807,_0x4a29a6)['then'](function(_0x469cdb){return _0x54b8b7(_0x469cdb);});case _0xff13('0x1e5'):var _0x37dba6=_0x52ca27[_0xff13('0x1e3')]/0x64;return _0xa5b2eb[_0xff13('0x1e6')](_0x54c4f0,_0x24107c,_0x4ae15d,_0x31d807,_0x37dba6)[_0xff13('0xb9')](function(_0x1ba11e){return _0x54b8b7(_0x1ba11e);});default:return _0xe3f143(msgResponse('[getDataPredictive]','Failure',_0xff13('0x1e7')));}}else{return _0xe3f143(msgResponse(_0xff13('0x1e8'),'Failure',_0xff13('0x1e9')));}});};};Dialer[_0xff13('0x1c')][_0xff13('0x1ea')]=function(_0x281457){var _0xe703d7=this;return function(_0x397b0d){return new Promise(function(_0x130a1c,_0x595640){_[_0xff13('0x91')](_0x281457,_0x397b0d[0x0]);if(checkGetDataPredictive(_0x397b0d[0x0])){loggerPredictive[_0xff13('0x82')](JSON['stringify'](_0x397b0d[0x0]));if(_0x281457[_0xff13('0x1e2')]===_0xff13('0x1d6')){return _0xe703d7['getVoiceQueueRtPauses'](_0x281457['id'])[_0xff13('0xb9')](function(_0x35d62c){var _0x2da03f=_0x281457[_0xff13('0x16b')]-_0x35d62c[0x0][_0xff13('0x1eb')];var _0xa0f4b7=_0x281457[_0xff13('0x1db')]*0x3c;var _0x356f11=_0x397b0d[0x0][_0xff13('0x6e')]+_0x397b0d[0x0][_0xff13('0x6d')];var _0x339bf0=(_0x397b0d[0x0]['predictiveIntervalAnsweredCalls']+_0x397b0d[0x0][_0xff13('0x6f')]+_0x397b0d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x397b0d[0x0][_0xff13('0x75')];var _0x2e3e67=_0x281457[_0xff13('0x1e3')]/0x64;_0x281457['predictiveIntervalPauses']=_0x35d62c[0x0][_0xff13('0x1eb')]||0x0;_0x281457[_0xff13('0x71')]=_0x339bf0>0x0?_0x339bf0:0x1;return _0xe703d7[_0xff13('0x1e4')](_0x2da03f,_0xa0f4b7,_0x356f11,_0x339bf0,_0x2e3e67);})[_0xff13('0xb9')](function(_0x2fe6ef){return _0x130a1c(_0x2fe6ef);})[_0xff13('0xb4')](function(_0x23ce08){return _0x595640(msgResponse(_0xff13('0x1ec'),'Failure',JSON['stringify'](_0x23ce08)));});}if(_0x281457['dialPredictiveOptimization']===_0xff13('0x1e5')){return _0xe703d7[_0xff13('0xcd')](_0x281457['id'])[_0xff13('0xb9')](function(_0x2aa5b5){var _0x32216f=_0x281457[_0xff13('0x16b')]-_0x2aa5b5[0x0]['outboundQueuePauses'];var _0x3dbf8e=_0x281457[_0xff13('0x1db')]*0x3c;var _0x811099=_0x397b0d[0x0][_0xff13('0x6e')]+_0x397b0d[0x0]['predictiveIntervalAvgHoldtime'];var _0x58313c=(_0x397b0d[0x0][_0xff13('0x6c')]+_0x397b0d[0x0][_0xff13('0x6f')]+_0x397b0d[0x0][_0xff13('0x87')])/_0x397b0d[0x0]['predictiveIntervalTotalCalls'];var _0x2d879c=_0x281457[_0xff13('0x1e3')]/0x64;_0x281457[_0xff13('0x73')]=_0x2aa5b5[0x0]['outboundQueuePauses']||0x0;_0x281457[_0xff13('0x71')]=_0x58313c>0x0?_0x58313c:0x1;return _0xe703d7[_0xff13('0x1e6')](_0x32216f,_0x3dbf8e,_0x811099,_0x58313c,_0x2d879c);})[_0xff13('0xb9')](function(_0x412fdd){return _0x130a1c(_0x412fdd);})[_0xff13('0xb4')](function(_0x5d4d21){return _0x595640(msgResponse(_0xff13('0x1ec'),_0xff13('0x14b'),JSON[_0xff13('0x4e')](_0x5d4d21)));});}}else{return _0x595640(msgResponse(_0xff13('0x1e8'),_0xff13('0x14b'),_0xff13('0x1e9')));}});};};Dialer[_0xff13('0x1c')]['startMethodPredictive']=function(_0x43fd1e){var _0x2c080b=this;return function(){var _0x263442=0x0;var _0x1be92b=Math[_0xff13('0x1d2')](_0x43fd1e[_0xff13('0x8e')]*0x3e8);if(_0x1be92b>0x0){_0x1be92b=_0x1be92b<0x64?0x64:_0x1be92b;loggerPredictive['info'](_0x43fd1e[_0xff13('0x44')],_0xff13('0x1ed'),_0x1be92b,'milliseconds');_0x43fd1e[_0xff13('0x94')]=setInterval(function(){_0x2c080b[_0xff13('0x94')](_0x43fd1e);loggerPredictiveCalls['info'](_0xff13('0x1ee'),_0x263442+=0x1);},_0x1be92b);}else{loggerPredictive[_0xff13('0x82')](_0x43fd1e[_0xff13('0x44')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xff13('0x1c')][_0xff13('0x1ef')]=function(_0x26e0ab,_0x24dd85){var _0x416c73=this;return function(_0x190d55){if(_['isEmpty'](_0x190d55)){if(_[_0xff13('0xb0')](_0x24dd85[_0xff13('0xd8')])||!_0x24dd85[_0xff13('0x1f0')]){if(_0x26e0ab[_0xff13('0x5d')]===_0xff13('0x9')){_0x26e0ab['queueStatusComplete']=_[_0xff13('0x41')](_0x26e0ab[_0xff13('0x132')])?!![]:_0x26e0ab['queueStatusComplete'];var _0x5da937=uuid['v4']();_0x416c73['actions'][_0x5da937]=new Action(_0x26e0ab,_0x24dd85,_0x5da937);loggerBooked[_0xff13('0x82')]('[booked][checkContactBlack]',_0x5da937,'queueStatusComplete:\x20',JSON['stringify'](_0x26e0ab[_0xff13('0x132')]),_0xff13('0x1f1'),_0x26e0ab[_0xff13('0x44')]);if(_0x26e0ab[_0xff13('0x132')]){_0x26e0ab[_0xff13('0x132')]=![];_0x416c73[_0xff13('0x2d')][_0x416c73[_0xff13('0x28')][_0x5da937][_0xff13('0xb8')]]=[];ami[_0xff13('0xb1')]({'actionid':_0x5da937,'action':'queuestatus','queue':_0x26e0ab['name']})[_0xff13('0xb4')](function(){_0x416c73[_0xff13('0xb7')](_0x26e0ab);_0x416c73[_0xff13('0xc5')]({'active':![],'ContactId':_0x416c73[_0xff13('0x28')][_0x5da937][_0xff13('0xd6')],'ListId':_0x416c73[_0xff13('0x28')][_0x5da937][_0xff13('0xd7')],'VoiceQueueId':_0x416c73[_0xff13('0x28')][_0x5da937][_0xff13('0x101')]||undefined,'CampaignId':_0x416c73['actions'][_0x5da937][_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x416c73[_0xff13('0x28')][_0x5da937];});}else{loggerBooked[_0xff13('0x82')](_0xff13('0x1f2'),JSON[_0xff13('0x4e')](_0x26e0ab[_0xff13('0x132')]),_0xff13('0x1f1'),_0x26e0ab[_0xff13('0x44')]);_0x416c73['updateOriginated'](_0x26e0ab);_0x416c73[_0xff13('0xc5')]({'active':![],'ContactId':_0x416c73[_0xff13('0x28')][_0x5da937]['ContactId'],'ListId':_0x416c73['actions'][_0x5da937][_0xff13('0xd7')],'VoiceQueueId':_0x416c73[_0xff13('0x28')][_0x5da937][_0xff13('0x101')]||undefined,'CampaignId':_0x416c73['actions'][_0x5da937][_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x1f3')));delete _0x416c73[_0xff13('0x28')][_0x5da937];}}else{return _0x416c73[_0xff13('0x179')](_0x26e0ab,_0x24dd85);}}else{if(getDiff(_0x24dd85[_0xff13('0x1f4')])<_0x26e0ab['dialRecallMeTimeout']*0x3c){if(_0x24dd85['Agent']&&!_0x24dd85[_0xff13('0x167')][_0xff13('0x1f5')]){_0x416c73[_0xff13('0x21')][_0xff13('0x134')](_0x24dd85['id'])[_0xff13('0x1f')](function(){_0x416c73[_0xff13('0xb7')](_0x26e0ab);});}else{_0x416c73['unlockContact']({'active':![]},_0x24dd85['id'],0x1)[_0xff13('0x1f')](function(){_0x416c73[_0xff13('0xb7')](_0x26e0ab);});}}else{_0x26e0ab[_0xff13('0x6a')]+=0x1;_0x416c73['updateOriginated'](_0x26e0ab);if(_0x26e0ab['dialRecallInQueue']){_0x416c73[_0xff13('0xc5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x24dd85[_0xff13('0xd6')],'ListId':_0x24dd85[_0xff13('0xd7')],'VoiceQueueId':_0x24dd85[_0xff13('0x101')]||undefined,'CampaignId':_0x24dd85[_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x1f6')));_0x416c73['createHistory'](createObjHistory(_0x26e0ab,_0x24dd85,_0xff13('0x1f7'),0x17,_0xff13('0x1f8')))[_0xff13('0xb4')](loggerCatch(_0xff13('0x1f9')));}else{_0x416c73[_0xff13('0xd4')](createObjHistory(_0x26e0ab,_0x24dd85,_0xff13('0x1fa'),0x16,_0xff13('0x1fb')),_0xff13('0x1fc'),_0xff13('0x1fd'));}}}}else{_0x26e0ab[_0xff13('0x63')]+=0x1;_0x416c73[_0xff13('0xd4')](createObjHistory(_0x26e0ab,_0x24dd85,'BLACKLIST',0xd,_0xff13('0x1fe')),_0xff13('0x1ff'),_0xff13('0x200'));throw'inBlackList';}};};Dialer[_0xff13('0x1c')][_0xff13('0x201')]=function(_0x36c0f7){var _0x5a1c22=this;var _0x4ed386=_0x36c0f7[_0xff13('0x202')]-_0x36c0f7[_0xff13('0x76')]-_0x36c0f7[_0xff13('0xca')];emitCampaignSummary(_0x36c0f7);if(_0x4ed386>0x0){if(_0x4ed386>this[_0xff13('0x26')]){_0x4ed386=this[_0xff13('0x26')];}_0x36c0f7[_0xff13('0xca')]+=_0x4ed386;this[_0xff13('0x203')](_0x36c0f7['id'],_0x4ed386,_0x36c0f7['dialOrderByScheduledAt'],_0x36c0f7)['then'](function(_0xe9fc98){_0x36c0f7[_0xff13('0xca')]-=_0x4ed386;_0x36c0f7[_0xff13('0xca')]=_0x36c0f7[_0xff13('0xca')]>0x0?_0x36c0f7['temp']:0x0;if(!checkContactEmpty(_0xe9fc98)){_0x36c0f7[_0xff13('0x42')]=_0xff13('0xa0');logger[_0xff13('0x82')](_0xff13('0x204')+_0x36c0f7[_0xff13('0x44')]);}else{_0x36c0f7['originated']+=_0xe9fc98[_0xff13('0x9b')];_0x36c0f7['message']='RUNNING';for(var _0x28f566=0x0;_0x28f566<_0xe9fc98[_0xff13('0x9b')];_0x28f566+=0x1){_0x36c0f7[_0xff13('0x205')]+=0x1;if(_[_0xff13('0xb0')](_0xe9fc98[_0x28f566])||_[_0xff13('0xb0')](_0xe9fc98[_0x28f566][_0xff13('0x194')])||_[_0xff13('0xb0')](_0xe9fc98[_0x28f566][_0xff13('0x17c')])){_0x5a1c22[_0xff13('0x206')]('[actionOriginate]\x20',_0x36c0f7,_0xe9fc98[_0x28f566]);}else{_0x5a1c22[_0xff13('0xc2')](_['pick'](_0xe9fc98[_0x28f566],[_0xff13('0xd9'),'phone']))[_0xff13('0xb9')](_0x5a1c22[_0xff13('0x1ef')](_0x36c0f7,_0xe9fc98[_0x28f566]))[_0xff13('0xb4')](_0x5a1c22[_0xff13('0xd3')]('[actionOriginateIvr]\x20',_0x36c0f7));}}}})[_0xff13('0xb4')](loggerGetContactDialer(_0xff13('0x207'),_0x36c0f7,_0x4ed386));}};Dialer[_0xff13('0x1c')][_0xff13('0x160')]=function(_0x48399,_0xaa784e){var _0x2d9a62=this;var _0x3731f5=[];var _0x45d098=_0xaa784e>=0x1?_0xaa784e:0x1;if(_0x48399['dialMethod']===_0xff13('0x9')){_0x45d098=0x1;}var _0x5c33bc=Math[_0xff13('0x1d2')](_0x48399[_0xff13('0x57')]*_0x45d098)-_0x48399['originated']-_0x48399[_0xff13('0xca')];emitVoiceQueueSummary(_0x48399);if(_0x48399[_0xff13('0x208')]>0x0){var _0x33b5b4=_0x48399[_0xff13('0x208')]-_0x48399[_0xff13('0x76')]-_0x48399[_0xff13('0x5b')]-_0x48399[_0xff13('0xca')]-_0x48399[_0xff13('0x58')];if(_0x5c33bc>_0x33b5b4){_0x5c33bc=_0x33b5b4;}}if(_0x5c33bc>0x0){if(_0x48399[_0xff13('0x5d')]==='booked'){_0x5c33bc=0x1;}if(_0x5c33bc>this[_0xff13('0x26')]){_0x5c33bc=this['maxNumberOriginate'];}_0x48399[_0xff13('0xca')]+=_0x5c33bc;for(var _0x422dd6 in this[_0xff13('0x24')]){if(typeof this[_0xff13('0x24')][_0x422dd6]!=='undefined'){if(this['agents'][_0x422dd6]['state']===_0xff13('0x209')&&this[_0xff13('0x24')][_0x422dd6][_0xff13('0xb2')]==='reachable'){_0x3731f5[_0xff13('0x130')](this['agents'][_0x422dd6]['id']);}}}this[_0xff13('0xc9')](_0x48399['id'],_0x3731f5,_0x5c33bc,_0x48399['dialOrderByScheduledAt'],_0x48399)[_0xff13('0xb9')](function(_0x3c45e5){_0x48399[_0xff13('0xca')]-=_0x5c33bc;_0x48399[_0xff13('0xca')]=_0x48399[_0xff13('0xca')]>0x0?_0x48399['temp']:0x0;if(!checkContactEmpty(_0x3c45e5)){_0x2d9a62[_0xff13('0xba')](_0x48399)['then'](sendMessageReschedule(_0x48399))[_0xff13('0xb4')](loggerCatch(_0xff13('0xbb')));}else{_0x48399[_0xff13('0x76')]+=_0x3c45e5[_0xff13('0x9b')];_0x48399[_0xff13('0x42')]=_0x48399[_0xff13('0x5d')]===_0xff13('0x9')?_0xff13('0x183'):'RUNNING';for(var _0x5b02bd=0x0;_0x5b02bd<_0x3c45e5[_0xff13('0x9b')];_0x5b02bd+=0x1){if(_[_0xff13('0xb0')](_0x3c45e5[_0x5b02bd])||_[_0xff13('0xb0')](_0x3c45e5[_0x5b02bd][_0xff13('0x194')])||_[_0xff13('0xb0')](_0x3c45e5[_0x5b02bd][_0xff13('0x17c')])){_0x2d9a62[_0xff13('0x206')]('[actionOriginate]\x20',_0x48399,_0x3c45e5[_0x5b02bd]);}else{_0x2d9a62[_0xff13('0xbc')](_['pick'](_0x3c45e5[_0x5b02bd],['VoiceQueueId',_0xff13('0x17c')]))[_0xff13('0xb9')](_0x2d9a62['checkContactBlack'](_0x48399,_0x3c45e5[_0x5b02bd]))[_0xff13('0xb4')](_0x2d9a62[_0xff13('0xd3')]('[actionOriginate]\x20',_0x48399));}}}})[_0xff13('0xb4')](loggerGetContactDialer(_0xff13('0x20a'),_0x48399,_0x5c33bc));}};Dialer[_0xff13('0x1c')][_0xff13('0x94')]=function(_0x2f4ef0){if(_0x2f4ef0[_0xff13('0x208')]>0x0){var _0x3a07fd=_0x2f4ef0[_0xff13('0x208')]-_0x2f4ef0[_0xff13('0x76')]-_0x2f4ef0[_0xff13('0x5b')];if(_0x3a07fd>0x0){this[_0xff13('0x20b')](_0x2f4ef0);}else{loggerPredictiveCalls[_0xff13('0x82')](_0xff13('0x20c'));}}else{this[_0xff13('0x20b')](_0x2f4ef0);}};Dialer[_0xff13('0x1c')][_0xff13('0x20b')]=function(_0x496098){var _0x46e5f5=this;var _0x470784=[];_0x496098[_0xff13('0x76')]+=0x1;for(var _0x266ad8 in this[_0xff13('0x24')]){if(typeof this[_0xff13('0x24')][_0x266ad8]!==_0xff13('0xaf')){if(this['agents'][_0x266ad8][_0xff13('0xa9')]===_0xff13('0x209')&&this[_0xff13('0x24')][_0x266ad8]['status']===_0xff13('0xdf')){_0x470784[_0xff13('0x130')](this['agents'][_0x266ad8]['id']);}}}this['getContactDialer'](_0x496098['id'],_0x470784,0x1,_0x496098[_0xff13('0x20d')],_0x496098)[_0xff13('0xb9')](function(_0x28deee){if(!checkContactEmpty(_0x28deee)){checkContactLowerLimitOriginate(_0x496098,0x1,0x0);_0x46e5f5[_0xff13('0xba')](_0x496098)[_0xff13('0xb9')](sendMessageReschedule(_0x496098))[_0xff13('0xb4')](loggerCatch(_0xff13('0xbb')));}else{_0x496098[_0xff13('0x42')]=_0xff13('0x20e');if(_[_0xff13('0xb0')](_0x28deee[0x0])||_['isNil'](_0x28deee[0x0][_0xff13('0x194')])||_[_0xff13('0xb0')](_0x28deee[0x0][_0xff13('0x17c')])){_0x46e5f5['emptyContact']('[actionOriginate]\x20',_0x496098,_0x28deee[0x0]);}else{_0x46e5f5[_0xff13('0xbc')](_[_0xff13('0xd5')](_0x28deee[0x0],[_0xff13('0x101'),'phone']))[_0xff13('0xb9')](_0x46e5f5['checkContactBlack'](_0x496098,_0x28deee[0x0]))[_0xff13('0xb4')](_0x46e5f5['loggerHandler'](_0xff13('0x20f'),_0x496098));}}})[_0xff13('0xb4')](loggerGetContactDialer(_0xff13('0x210'),_0x496098,0x1));emitVoiceQueueSummary(_0x496098);};Dialer[_0xff13('0x1c')][_0xff13('0x1e4')]=function(_0x624645,_0xfec824,_0x49c06a,_0x182ce5,_0x416436,_0x54aeb2){loggerPredictive[_0xff13('0x82')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xff13('0x82')](_0xff13('0x211'),_0x624645);loggerPredictive[_0xff13('0x82')](_0xff13('0x212'),_0xfec824);loggerPredictive[_0xff13('0x82')](_0xff13('0x213'),_0x49c06a);loggerPredictive[_0xff13('0x82')](_0xff13('0x214'),_0x182ce5);loggerPredictive[_0xff13('0x82')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x416436);loggerPredictive[_0xff13('0x82')]('---------------------------');return new Promise(function(_0x582fdb,_0x1789ee){if(_0x624645<=0x0||isNaN(_0x624645)){return _0x1789ee(msgResponse(_0xff13('0x215'),_0xff13('0x216'),'m\x20=\x20'+_0x624645));}if(_0x49c06a<=0x0||isNaN(_0x49c06a)){return _0x1789ee(msgResponse(_0xff13('0x215'),_0xff13('0x216'),_0xff13('0x217')+_0x49c06a));}if(_0x182ce5<=0x0||isNaN(_0x182ce5)){return _0x1789ee(msgResponse('[abandonmentRate]',_0xff13('0x216'),_0xff13('0x218')+_0x182ce5));}if(_0xfec824<=0x0||isNaN(_0xfec824)){return _0x1789ee(msgResponse(_0xff13('0x215'),_0xff13('0x216'),_0xff13('0x219')+_0xfec824));}if(_0x416436<=0x0||isNaN(_0x416436)){return _0x1789ee(msgResponse('[abandonmentRate]',_0xff13('0x216'),_0xff13('0x21a')+_0x416436));}_0x54aeb2=_0x54aeb2||0x0;var _0x228bb1=0x1/_0x49c06a;var _0x17c73a=0x0;var _0x2c7277=0x0;var _0x4a807c=0x0;var _0x23488d=0x0;for(var _0xbf2cc2=0x0;_0x4a807c<_0x416436;_0xbf2cc2+=0x1){_0x2c7277=_0xbf2cc2/_0xfec824;_0x17c73a=(_0x182ce5*_0x2c7277+_0x54aeb2)/_0x228bb1;_0x4a807c=erlangb(_0x17c73a,_0x624645);_0x23488d=_0x17c73a/_0x624645*(0x1-erlangb(_0x17c73a,_0x624645));}return _0x582fdb({'erlangCalls':_0xbf2cc2,'erlangCallToSecond':_0xfec824/_0xbf2cc2,'erlangAbandonmentRate':_0x4a807c,'erlangBusyFactor':_0x23488d});});};Dialer[_0xff13('0x1c')][_0xff13('0x1e6')]=function(_0x38f247,_0x39fcec,_0xad0c74,_0x375f46,_0x19a9b1,_0x5c93f5){loggerPredictive[_0xff13('0x82')](_0xff13('0x21b'));loggerPredictive[_0xff13('0x82')]('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',_0x38f247);loggerPredictive[_0xff13('0x82')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x39fcec);loggerPredictive[_0xff13('0x82')](_0xff13('0x213'),_0xad0c74);loggerPredictive[_0xff13('0x82')]('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',_0x375f46);loggerPredictive[_0xff13('0x82')](_0xff13('0x21c'),_0x19a9b1);loggerPredictive[_0xff13('0x82')](_0xff13('0x21d'));return new Promise(function(_0x35b027,_0x4129ea){if(_0x38f247<=0x0||isNaN(_0x38f247)){return _0x4129ea(msgResponse('[busyFactor]','Error','m\x20=\x20'+_0x38f247));}if(_0xad0c74<=0x0||isNaN(_0xad0c74)){return _0x4129ea(msgResponse(_0xff13('0x21e'),_0xff13('0x216'),_0xff13('0x217')+_0xad0c74));}if(_0x375f46<=0x0||isNaN(_0x375f46)){return _0x4129ea(msgResponse('[busyFactor]','Error','p\x20=\x20'+_0x375f46));}if(_0x39fcec<=0x0||isNaN(_0x39fcec)){return _0x4129ea(msgResponse('[busyFactor]',_0xff13('0x216'),_0xff13('0x219')+_0x39fcec));}if(_0x19a9b1<=0x0||isNaN(_0x19a9b1)){return _0x4129ea(msgResponse(_0xff13('0x21e'),_0xff13('0x216'),_0xff13('0x21f')+_0x19a9b1));}_0x5c93f5=_0x5c93f5||0x0;var _0x3bb81c=0x1/_0xad0c74;var _0x26f980=0x0;var _0x26efe1=0x0;var _0x58c728=0x0;var _0xe0e98f=0x0;for(var _0x47212b=0x0;_0xe0e98f<_0x19a9b1;_0x47212b+=0x1){_0x26efe1=_0x47212b/_0x39fcec;_0x26f980=(_0x375f46*_0x26efe1+_0x5c93f5)/_0x3bb81c;_0x58c728=erlangb(_0x26f980,_0x38f247);_0xe0e98f=_0x26f980/_0x38f247*(0x1-erlangb(_0x26f980,_0x38f247));}return _0x35b027({'erlangCalls':_0x47212b,'erlangCallToSecond':_0x39fcec/_0x47212b,'erlangAbandonmentRate':_0x58c728,'erlangBusyFactor':_0xe0e98f});});};module[_0xff13('0x220')]=Dialer; \ No newline at end of file +var _0x518d=['tags','createdAt','updatedAt','%s%s','XMD-','toUpper','TrunkBackup','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','trim','dialCutDigit','substring','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','emptyContact','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts\x20=\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','isEmpty','INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','ivr','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','stack','inspect','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','debug','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','starttime','clearZombieChannels','[actions]','isNil','status','channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','resolve','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','SIP/%s','reachable','uniqueid','variable','amdstatus','value','outboundAnswerAgiCallsDay','membername','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','AMD','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr]','add','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','strategy','actionid','locked','stateinterface','push','pick','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','timezones','\x20Timezone\x20unknow\x20','isArray','length','Action','iftime\x20%s,%s','interval','content','indexOf','true','command','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:dialPreviewRecallReminder','handleIvr','syncQueueSummary','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','user:%s','syncCampaigns','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','getCaller','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-CAMPAIGNID','Contact'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x518d,0x95));var _0xd518=function(_0x256077,_0x5da5de){_0x256077=_0x256077-0x0;var _0x144e2b=_0x518d[_0x256077];return _0x144e2b;};'use strict';var util=require(_0xd518('0x0'));var _=require('lodash');var uuid=require(_0xd518('0x1'));var moment=require(_0xd518('0x2'));var rr=require('rr');var md5=require(_0xd518('0x3'));var Redis=require(_0xd518('0x4'));var ut=require(_0xd518('0x5'));var config=require(_0xd518('0x6'));var logger=require(_0xd518('0x7'))(_0xd518('0x8'));var loggerBooked=require(_0xd518('0x7'))(_0xd518('0x9'));var loggerPredictive=require('../../../config/logger')(_0xd518('0xa'));var loggerPredictiveCalls=require(_0xd518('0x7'))(_0xd518('0xb'));var loggerSyncQueueSummary=require(_0xd518('0x7'))('syncQueueSummary');var ami=require(_0xd518('0xc'));config[_0xd518('0xd')]=_[_0xd518('0xe')](config[_0xd518('0xd')],{'host':_0xd518('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd518('0xd')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xd518('0x10'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0xd518('0x11'));var voiceQueueRt=require(_0xd518('0x12'));var RpcSetting=require('../rpc/setting');var Action=require(_0xd518('0x13'));var History=require('./history');var Final=require(_0xd518('0x14'));var AgentComplete=require(_0xd518('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xd518('0x16'));var ipAgi=process[_0xd518('0x17')][_0xd518('0x18')]||'127.0.0.1';var strategy={'rrmemory':_0xd518('0x19'),'roundrobin':_0xd518('0x1a')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xd518('0x1b')][_0xd518('0x1c')]=function(_0x33fc30){this[_0xd518('0x1d')]=this[_0xd518('0x1d')]?this[_0xd518('0x1d')][_0xd518('0x1e')](_0x33fc30):_0x33fc30();};function Dialer(_0x17451d,_0x1eae47){this[_0xd518('0x1f')]=new Sequence();this[_0xd518('0x20')]=_0x1eae47;this[_0xd518('0x21')]=_0x17451d[_0xd518('0x21')];this['campaigns']=_0x17451d[_0xd518('0x22')];this['agents']=_0x17451d[_0xd518('0x23')];this[_0xd518('0x24')]=_0x17451d[_0xd518('0x24')];this['maxNumberOriginate']=config[_0xd518('0x25')]||0x2;this[_0xd518('0x26')]={};this['actions']={};this[_0xd518('0x27')]={};this[_0xd518('0x28')]={};this['optionPredictive']={};this[_0xd518('0x29')]={};this[_0xd518('0x2a')]={};this[_0xd518('0x2b')]={};this[_0xd518('0x2c')]={};this[_0xd518('0x2d')]={};ami['on'](_0xd518('0x2e'),this[_0xd518('0x2f')]['bind'](this));ami['on'](_0xd518('0x30'),this[_0xd518('0x31')][_0xd518('0x32')](this));ami['on'](_0xd518('0x33'),this[_0xd518('0x34')]['bind'](this));ami['on'](_0xd518('0x35'),this['syncAgentComplete']['bind'](this));ami['on'](_0xd518('0x36'),this['syncQueueSummary'][_0xd518('0x32')](this));ami['on'](_0xd518('0x37'),this[_0xd518('0x38')][_0xd518('0x32')](this));ami['on'](_0xd518('0x39'),this['syncHangup'][_0xd518('0x32')](this));ami['on'](_0xd518('0x3a'),this[_0xd518('0x3b')][_0xd518('0x32')](this));ami['on']('varset',this[_0xd518('0x3c')][_0xd518('0x32')](this));ami['on'](_0xd518('0x3d'),this[_0xd518('0x3e')]['bind'](this));ami['on']('queuestatuscomplete',this[_0xd518('0x3f')][_0xd518('0x32')](this));this[_0xd518('0x40')]();this[_0xd518('0x41')]();RpcSetting[_0xd518('0x42')]()[_0xd518('0x43')](function(_0x55795c){previewRecallmeReminderInterval=_0x55795c[_0xd518('0x44')];});}function isNotNull(_0x2cff47){return _0x2cff47!==null&&!_[_0xd518('0x45')](_0x2cff47);}function checkIsLoggedIn(_0x342d61,_0x204baa){return function(){if(_0x204baa<=0x0){_0x342d61[_0xd518('0x46')]='AGENTS_NOT_LOGGED';throw _0x342d61[_0xd518('0x47')]+_0xd518('0x48');}};}function isActive(_0x4c1e26){return _0x4c1e26;}function checkIsActive(_0xa06daa,_0x4062d9){return function(){if(!isActive(_0x4062d9)){_0xa06daa[_0xd518('0x46')]=_0xd518('0x49');throw _0xa06daa['name']+_0xd518('0x4a');}};}function checkInterval(_0x3a53cc){return function(){if(!isNotNull(_0x3a53cc[_0xd518('0x4b')])){_0x3a53cc[_0xd518('0x46')]='INTERVAL_IS_NULL';throw _0x3a53cc[_0xd518('0x47')]+_0xd518('0x4c');}if(!isNotNull(_0x3a53cc[_0xd518('0x4b')][_0xd518('0x4d')])){_0x3a53cc['message']='INTERVAL_IS_NULL';throw _0x3a53cc[_0xd518('0x47')]+_0xd518('0x4c');}if(!isNotNull(_[_0xd518('0x4e')](_0x3a53cc[_0xd518('0x4b')]['Intervals']))){_0x3a53cc[_0xd518('0x46')]=_0xd518('0x4f');throw _0x3a53cc[_0xd518('0x47')]+_0xd518('0x4c');}};}function msgResponse(_0x3fc2fa,_0x41c7f2,_0x1918af){return{'action':_0x3fc2fa,'response':_0x41c7f2,'message':_0x1918af,'stack':_0x1918af};}function myreject(_0x580352){return function(_0x27e2cf){return _0x580352(msgResponse(_0xd518('0x50'),_0xd518('0x51'),JSON[_0xd518('0x52')](_0x27e2cf)));};}function getSeconds(_0x13c2d2,_0x2bcd70){var _0x1bb6aa=moment(_0x13c2d2)[_0xd518('0x53')](0x0);var _0xfde308=moment(_0x2bcd70)[_0xd518('0x53')](0x0);return _0x1bb6aa[_0xd518('0x54')](_0xfde308,_0xd518('0x55'));}function emit(_0x230bc4,_0x5ac840,_0x3c33c0){io['to'](_0x230bc4)['emit'](_0x5ac840,_0x3c33c0);}function emitVoiceQueueSummary(_0x848a72){if(_0x848a72[_0xd518('0x56')]===_0xd518('0x57')){var _0x17b328={'id':_0x848a72['id'],'name':_0x848a72[_0xd518('0x47')],'strategy':_0x848a72['strategy'],'answered':_0x848a72[_0xd518('0x58')],'available':_0x848a72[_0xd518('0x59')],'loggedIn':_0x848a72[_0xd518('0x5a')],'pTalking':_0x848a72[_0xd518('0x5b')],'sumBillable':_0x848a72[_0xd518('0x5c')],'sumDuration':_0x848a72[_0xd518('0x5d')],'sumHoldTime':_0x848a72[_0xd518('0x5e')]||0x0,'talking':_0x848a72[_0xd518('0x5f')],'total':_0x848a72[_0xd518('0x60')],'type':_0x848a72['type'],'unmanaged':_0x848a72[_0xd518('0x61')],'abandoned':_0x848a72['abandoned'],'waiting':_0x848a72[_0xd518('0x62')],'loggedInDb':_0x848a72[_0xd518('0x63')],'dialActive':_0x848a72[_0xd518('0x64')],'dialMethod':_0x848a72[_0xd518('0x65')],'dialOriginateCallerIdName':_0x848a72[_0xd518('0x66')],'dialOriginateCallerIdNumber':_0x848a72[_0xd518('0x67')],'dialOriginateTimeout':_0x848a72['dialOriginateTimeout'],'dialPrefix':_0x848a72[_0xd518('0x68')],'outboundAnswerAgiCallsDay':_0x848a72['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x848a72[_0xd518('0x69')],'outboundBlacklistCallsDay':_0x848a72[_0xd518('0x6a')],'outboundBusyCallsDay':_0x848a72['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x848a72[_0xd518('0x6b')],'outboundDropCallsDayACS':_0x848a72['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x848a72[_0xd518('0x6c')],'outboundDropCallsDayTimeout':_0x848a72[_0xd518('0x6d')],'outboundNoAnswerCallsDay':_0x848a72[_0xd518('0x6e')],'outboundNoSuchCallsDay':_0x848a72[_0xd518('0x6f')],'outboundOriginateFailureCallsDay':_0x848a72[_0xd518('0x70')],'outboundReCallsDay':_0x848a72[_0xd518('0x71')],'outboundRejectCallsDay':_0x848a72[_0xd518('0x72')],'outboundUnknownCallsDay':_0x848a72[_0xd518('0x73')],'predictiveIntervalAnsweredCalls':_0x848a72[_0xd518('0x74')],'predictiveIntervalAvgHoldtime':_0x848a72[_0xd518('0x75')],'predictiveIntervalAvgTalktime':_0x848a72[_0xd518('0x76')],'predictiveIntervalDroppedCallsCallersExit':_0x848a72['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x848a72[_0xd518('0x77')],'predictiveIntervalErlangCalls':_0x848a72['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x848a72[_0xd518('0x78')],'predictiveIntervalHitRate':_0x848a72[_0xd518('0x79')],'predictiveIntervalMultiplicativeFactor':_0x848a72['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x848a72[_0xd518('0x7a')],'predictiveIntervalAvailable':_0x848a72[_0xd518('0x7b')],'predictiveIntervalTotalCalls':_0x848a72['predictiveIntervalTotalCalls'],'message':_0x848a72[_0xd518('0x46')],'originated':_0x848a72[_0xd518('0x7c')],'erlangCalls':_0x848a72['erlangCalls'],'erlangCallToSecond':_0x848a72['erlangCallToSecond'],'erlangAbandonmentRate':_0x848a72['erlangAbandonmentRate'],'erlangBusyFactor':_0x848a72[_0xd518('0x7d')],'startPredictive':_0x848a72[_0xd518('0x29')],'startProgressive':_0x848a72['startProgressive']};if(_0x848a72[_0xd518('0x7e')]){_0x17b328['Trunk']={'id':_0x848a72[_0xd518('0x7e')]['id'],'name':_0x848a72[_0xd518('0x7e')][_0xd518('0x47')],'active':_0x848a72[_0xd518('0x7e')][_0xd518('0x7f')],'callerid':_0x848a72['Trunk'][_0xd518('0x80')]};}if(_0x848a72[_0xd518('0x4b')]){_0x17b328['Interval']={'id':_0x848a72[_0xd518('0x4b')]['id'],'name':_0x848a72[_0xd518('0x4b')]['name']};}var _0xc947fc=md5(JSON['stringify'](_0x17b328));if(_0x848a72[_0xd518('0x3')]!==_0xc947fc){_0x848a72[_0xd518('0x3')]=_0xc947fc;emit(util[_0xd518('0x81')](_0xd518('0x82'),_0x17b328[_0xd518('0x47')]),'voice_queue:save',_0x17b328);}}}function emitCampaignSummary(_0x1e47d1){if(_0x1e47d1[_0xd518('0x56')]===_0xd518('0x83')){emit(util[_0xd518('0x81')]('campaign:ivr:%s',_0x1e47d1[_0xd518('0x47')]),'campaign:save',_0x1e47d1);}}function checkGetDataPredictive(_0x5d3835){if(isNotNull(_0x5d3835)&&!_[_0xd518('0x4e')](_0x5d3835)){loggerPredictive[_0xd518('0x84')](_0xd518('0x85'));loggerPredictive[_0xd518('0x84')](_0xd518('0x86'),_0x5d3835[_0xd518('0x87')]);loggerPredictive[_0xd518('0x84')](_0xd518('0x88'),_0x5d3835[_0xd518('0x74')]);loggerPredictive['info'](_0xd518('0x89'),_0x5d3835['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0xd518('0x8a'),_0x5d3835[_0xd518('0x8b')]);loggerPredictive['info'](_0xd518('0x8c'),_0x5d3835['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xd518('0x84')](_0xd518('0x8d'),_0x5d3835['predictiveIntervalAvgTalktime']);loggerPredictive[_0xd518('0x84')]('---------------------------');if(_0x5d3835[_0xd518('0x87')]>0x0){if(!_[_0xd518('0x45')](_0x5d3835[_0xd518('0x76')])&&_0x5d3835['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xd518('0x84')](_0xd518('0x8e'));if(!_[_0xd518('0x45')](_0x5d3835[_0xd518('0x75')])&&_0x5d3835[_0xd518('0x75')]>0x0){return!![];}loggerPredictive['info'](_0xd518('0x8f'));}else{loggerPredictive[_0xd518('0x84')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xd518('0x84')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5e5640){return function(_0x54ef1f){loggerPredictive[_0xd518('0x84')](_0xd518('0x90'));loggerPredictive[_0xd518('0x84')](_0xd518('0x91'),_0x54ef1f[_0xd518('0x92')]);loggerPredictive['info'](_0xd518('0x93'),_0x54ef1f['erlangCallToSecond']);loggerPredictive[_0xd518('0x84')](_0xd518('0x94'),_0x54ef1f[_0xd518('0x95')]);loggerPredictive[_0xd518('0x84')](_0xd518('0x96'),_0x54ef1f['erlangBusyFactor']);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54ef1f[_0xd518('0x95')]);loggerPredictive[_0xd518('0x84')](_0xd518('0x97'));_[_0xd518('0x98')](_0x5e5640,_0x54ef1f);};}function getDiff(_0xaafad7){var _0x162442=moment()[_0xd518('0x53')](0x0);var _0x317b50=moment(_0xaafad7)[_0xd518('0x53')](0x0);return _0x162442['diff'](_0x317b50,_0xd518('0x55'));}function ifInterval(_0x30ff51,_0x398804){if(_[_0xd518('0x45')](_0x398804)){return![];}return getDiff(_0x398804)<_0x30ff51*0x3c;}function freeVariablesPredictive(_0x30b71e){if(isNotNull(_0x30b71e)){if(!_['isUndefined'](_0x30b71e[_0xd518('0x2a')])){_0x30b71e[_0xd518('0x2a')]=undefined;loggerPredictive['info'](_0x30b71e['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xd518('0x45')](_0x30b71e[_0xd518('0x29')])){_0x30b71e[_0xd518('0x29')]=undefined;loggerPredictive['info'](_0x30b71e[_0xd518('0x47')],_0xd518('0x99'));}if(!_[_0xd518('0x45')](_0x30b71e[_0xd518('0x9a')])){clearInterval(_0x30b71e[_0xd518('0x9a')]);_0x30b71e[_0xd518('0x9a')]=undefined;loggerPredictive['info'](_0x30b71e[_0xd518('0x47')],_0xd518('0x9b'));}}}function erlangb(_0x1b99ce,_0x16202e){if(_0x16202e===0x0){return 0x0;}var _0x1ec795=0x1;for(var _0x5eac67=0x1;_0x5eac67<=_0x16202e;_0x5eac67+=0x1){_0x1ec795=0x1+_0x1ec795*_0x5eac67/_0x1b99ce;}return 0x1/_0x1ec795;}function isVoiceQueueOutbound(_0x16bbaa){return _0x16bbaa===_0xd518('0x57');}function isNotPreview(_0xc8287){return _0xc8287!==_0xd518('0x20');}function isCampaignIvr(_0x19feae){return _0x19feae===_0xd518('0x83');}function getCallerId(_0x273ee5,_0x3f611c,_0x5b15f0){if(!_['isUndefined'](_0x5b15f0)&&typeof _0x5b15f0===_0xd518('0x9c')&&!_[_0xd518('0x4e')](_0x5b15f0)){if(!_[_0xd518('0x45')](_0x3f611c)&&typeof _0x3f611c===_0xd518('0x9c')&&!_[_0xd518('0x4e')](_0x3f611c)){return util[_0xd518('0x81')]('\x22%s\x22\x20<%s>',_0x3f611c,_0x5b15f0);}return util[_0xd518('0x81')](_0xd518('0x9d'),_0x5b15f0,_0x5b15f0);}if(!_[_0xd518('0x45')](_0x273ee5)&&typeof _0x273ee5===_0xd518('0x9c')&&!_[_0xd518('0x4e')](_0x273ee5)){return _0x273ee5;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x13c2dc,_0x55512a){return function(_0x15074b){freeVariablesPredictive(_0x55512a);emitVoiceQueueSummary(_0x55512a);emitCampaignSummary(_0x55512a);loggerSyncQueueSummary['debug'](_0x13c2dc,util['inspect'](_0x15074b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2ed8c1,_0x190deb){return function(_0x2d7040){loggerPredictive[_0xd518('0x9e')](_0x190deb['name'],_0x2ed8c1);loggerPredictive['error'](_0x2d7040[_0xd518('0x9f')]);freeVariablesPredictive(_0x190deb);};}function loggerCatch(_0x377398){return function(_0x43e20c){logger[_0xd518('0x9e')](_0x377398,util[_0xd518('0xa0')](_0x43e20c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4be65e){return _0x4be65e&&!_[_0xd518('0x45')](_0x4be65e)&&_0x4be65e['length']>0x0;}function decremetOriginate(_0x4e5a93){if(!_[_0xd518('0x45')](_0x4e5a93)&&_0x4e5a93!==null){if(typeof _0x4e5a93[_0xd518('0x7c')]!=='undefined'){if(_0x4e5a93['originated']>0x0){_0x4e5a93['originated']-=0x1;}else{logger[_0xd518('0x9e')](_0xd518('0xa1'));}}}else{logger[_0xd518('0x9e')](_0xd518('0xa2'));}}function checkContactLowerLimitOriginate(_0x2d733c,_0x3c9203,_0xc90a53){if(_0x3c9203>_0xc90a53){for(var _0x2cd591=0x0;_0x2cd591<_0x3c9203-_0xc90a53;_0x2cd591+=0x1){decremetOriginate(_0x2d733c);}}}function loggerGetContactDialer(_0x430367,_0x3eeb7c,_0x2196c3){return function(_0x68add5){checkContactLowerLimitOriginate(_0x3eeb7c,_0x2196c3,0x0);logger[_0xd518('0x9e')](_0x430367,util['inspect'](_0x68add5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5c0430){return function(_0x38d4ed){if(isNotNull(_0x38d4ed)&&isNotNull(_0x38d4ed[0x0])){if(_0x38d4ed[0x0][_0xd518('0xa3')]>0x0){_0x5c0430[_0xd518('0x46')]='RESCHEDULED_CONTACTS';logger[_0xd518('0x84')](_0xd518('0xa4')+_0x5c0430[_0xd518('0x47')],_0x38d4ed[0x0][_0xd518('0xa3')],_0xd518('0xa5'));}else{_0x5c0430['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xd518('0x84')](_0xd518('0xa6')+_0x5c0430['name']);}}};}function notSendMessagesQueue(_0x1886b4){if(_0x1886b4[_0xd518('0xa7')]){freeVariablesPredictive(_0x1886b4);if(_0x1886b4[_0xd518('0x7c')]===0x0&&_0x1886b4['talking']===0x0&&_0x1886b4[_0xd518('0x62')]===0x0&&(_0x1886b4['pTalking']||0x0)===0x0){_0x1886b4['sendMessageOneNotActive']=![];_0x1886b4[_0xd518('0x59')]=0x0;_0x1886b4[_0xd518('0x46')]=_0xd518('0x49');loggerSyncQueueSummary[_0xd518('0xa8')](_0xd518('0xa9'),_0x1886b4[_0xd518('0x47')],'is\x20not\x20active');}else{_0x1886b4[_0xd518('0x46')]='IS_DISACTIVED';loggerSyncQueueSummary['debug'](_0xd518('0xa9'),_0x1886b4[_0xd518('0x47')],_0xd518('0xaa'));}emitVoiceQueueSummary(_0x1886b4);}}function notSendMessagesCampaign(_0x437baa){if(_0x437baa[_0xd518('0xa7')]){if(_0x437baa[_0xd518('0x7c')]===0x0){_0x437baa[_0xd518('0xa7')]=![];_0x437baa['message']=_0xd518('0x49');loggerSyncQueueSummary[_0xd518('0xa8')](_0xd518('0xab'),_0x437baa[_0xd518('0x47')],'is\x20not\x20active');}else{_0x437baa[_0xd518('0x46')]=_0xd518('0xac');loggerSyncQueueSummary[_0xd518('0xa8')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x437baa[_0xd518('0x47')],'is\x20disactive');}emitCampaignSummary(_0x437baa);}}function createObjHistory(_0x2c78c5,_0xcc450a,_0x190cd2,_0x33c453,_0x239867){_0x2c78c5[_0xd518('0x46')]=_0x190cd2;var _0x308dad=new Action(_0x2c78c5,_0xcc450a);var _0x6ab99b=new History(_0x308dad);_0x6ab99b[_0xd518('0xad')]=_0x33c453;_0x6ab99b[_0xd518('0xae')]=_0x239867;_0x6ab99b[_0xd518('0xaf')]=_0x308dad[_0xd518('0xb0')];return _0x6ab99b;}Dialer[_0xd518('0x1b')][_0xd518('0x41')]=function(){var _0x693b12=this;setInterval(function(){_0x693b12[_0xd518('0xb1')](_0x693b12[_0xd518('0x28')],'[uniqueid]');_0x693b12[_0xd518('0xb1')](_0x693b12['actions'],_0xd518('0xb2'));},0x32c8);};Dialer[_0xd518('0x1b')][_0xd518('0xb1')]=function(_0x5aa5d7,_0x236fe9){var _0x16d3b7=this;for(var _0xba005b in _0x5aa5d7){if(typeof _0x5aa5d7[_0xba005b]!=='undefined'){this['sequence'][_0xd518('0x1c')](function(){if(!_[_0xd518('0xb3')](_0x5aa5d7[_0xba005b])){return ami['Action']({'action':_0xd518('0xb4'),'channel':_0x5aa5d7[_0xba005b][_0xd518('0xb5')]})['catch'](function(_0x1f71f6){if(_0x1f71f6[_0xd518('0x46')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5aa5d7[_0xba005b]&&_0x5aa5d7[_0xba005b]['type']!==_0xd518('0x83')){_0x16d3b7[_0xd518('0xb6')](_0x16d3b7['voiceQueues'][_0x5aa5d7[_0xba005b][_0xd518('0xb7')]]);logger['error'](_0xd518('0xb8'),_0x236fe9,_0xba005b,_0x5aa5d7[_0xba005b]['queue']);delete _0x5aa5d7[_0xba005b];}if(_0x5aa5d7[_0xba005b]&&_0x5aa5d7[_0xba005b][_0xd518('0x56')]==='ivr'){_0x16d3b7['updateOriginated'](_0x16d3b7['campaigns'][_0x5aa5d7[_0xba005b][_0xd518('0xb7')]]);logger[_0xd518('0x9e')](_0xd518('0xb9'),_0x236fe9,_0xba005b,_0x5aa5d7[_0xba005b]['queue']);delete _0x5aa5d7[_0xba005b];}},0x2328);}});}});}}};Dialer[_0xd518('0x1b')][_0xd518('0xba')]=function(_0x562a01){return Promise['resolve']()[_0xd518('0x43')](cmHopper[_0xd518('0xba')](_0x562a01))[_0xd518('0xbb')](loggerCatch(_0xd518('0xbc')));};Dialer[_0xd518('0x1b')]['checkIsBlackList']=function(_0x36a683){return Promise['resolve']()[_0xd518('0x43')](cmHopperBlack[_0xd518('0xbd')](_0x36a683))[_0xd518('0xbb')](loggerCatch(_0xd518('0xbe')));};Dialer['prototype']['verifyAdditionalPhones']=function(_0x564e29,_0xfb109b,_0x4500e6){return Promise['resolve']()[_0xd518('0x43')](cmHopperAdditionalPhone[_0xd518('0xbf')](_0x564e29,_0xfb109b,_0x4500e6))[_0xd518('0xbb')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0xd518('0x1b')][_0xd518('0xc0')]=function(_0x512706,_0x46f970,_0x4b422f){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x512706,_0x46f970,_0x4b422f))[_0xd518('0xbb')](loggerCatch(_0xd518('0xc2')));};Dialer[_0xd518('0x1b')][_0xd518('0xc3')]=function(_0x2d4da4){return Promise['resolve']()[_0xd518('0x43')](cmHopperBlack[_0xd518('0xc3')](_0x2d4da4))[_0xd518('0xbb')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xd518('0x1b')][_0xd518('0xc4')]=function(_0x5d497a){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopperHistory[_0xd518('0xc5')](_0x5d497a))['catch'](loggerCatch(_0xd518('0xc6')));};Dialer['prototype'][_0xd518('0xc7')]=function(_0xf1040a){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopper[_0xd518('0xc7')](_0xf1040a))[_0xd518('0xbb')](loggerCatch(_0xd518('0xc8')));};Dialer[_0xd518('0x1b')]['unlockContact']=function(_0x71d07b,_0x235a5f,_0x21af51){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopper[_0xd518('0xc9')](_0x71d07b,_0x235a5f,_0x21af51))[_0xd518('0xbb')](loggerCatch(_0xd518('0xca')));};Dialer[_0xd518('0x1b')]['getContactDialer']=function(_0xd2edc2,_0x2f4f1c,_0x5013ac,_0x4660a9,_0x15f28d){return Promise[_0xd518('0xc1')]()['then'](cmHopper[_0xd518('0xcb')](_0xd2edc2,_0x2f4f1c,_0x5013ac,_0x4660a9))['catch'](function(_0x108479){_0x15f28d[_0xd518('0xcc')]-=_0x5013ac;_0x15f28d[_0xd518('0xcc')]=_0x15f28d[_0xd518('0xcc')]>0x0?_0x15f28d[_0xd518('0xcc')]:0x0;loggerCatch(_0xd518('0xcd'))(_0x108479);});};Dialer['prototype'][_0xd518('0xce')]=function(_0x4f9649,_0x116b45,_0x1d859d,_0x42a8a0){return Promise[_0xd518('0xc1')]()['then'](cmHopper[_0xd518('0xce')](_0x4f9649,_0x116b45,_0x1d859d))['catch'](function(_0xe7af75){_0x42a8a0[_0xd518('0xcc')]-=_0x116b45;_0x42a8a0[_0xd518('0xcc')]=_0x42a8a0[_0xd518('0xcc')]>0x0?_0x42a8a0[_0xd518('0xcc')]:0x0;loggerCatch(_0xd518('0xcf'))(_0xe7af75);});};Dialer[_0xd518('0x1b')]['getVoiceQueueRtPauses']=function(_0x5ed3bb){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5ed3bb))[_0xd518('0xbb')](loggerCatch(_0xd518('0xd0')));};Dialer[_0xd518('0x1b')][_0xd518('0xd1')]=function(_0x5da8f0){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopper['moveContactManagedDialer'](_0x5da8f0))['catch'](loggerCatch(_0xd518('0xd2')));};Dialer['prototype']['createHistory']=function(_0x5e758d){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopperHistory[_0xd518('0xd3')](_0x5e758d))[_0xd518('0xbb')](loggerCatch(_0xd518('0xd4')));};Dialer[_0xd518('0x1b')][_0xd518('0xb6')]=function(_0x56d421){if(!_[_0xd518('0x45')](_0x56d421)&&_0x56d421!==null){if(typeof _0x56d421[_0xd518('0x7c')]!==_0xd518('0xd5')){if(_0x56d421[_0xd518('0x7c')]>0x0){_0x56d421[_0xd518('0x7c')]-=0x1;}else{logger['error'](_0xd518('0xd6'));}}}else{logger[_0xd518('0x9e')](_0xd518('0xd7'));}};Dialer[_0xd518('0x1b')][_0xd518('0xd8')]=function(_0x4e812e,_0x29e8d4){var _0xe536c5=this;return function(_0xd141d4){_0xe536c5[_0xd518('0xb6')](_0x29e8d4);logger[_0xd518('0x9e')](_0x4e812e,util[_0xd518('0xa0')](_0xd141d4,{'showHidden':![],'depth':null}));};};Dialer[_0xd518('0x1b')]['emptyContact']=function(_0x48c411,_0x53414f,_0x407fbf){var _0x90d34e={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x53414f);this[_0xd518('0xd9')](_[_0xd518('0x98')](_0x90d34e,_['pick'](_0x407fbf,[_0xd518('0xda'),_0xd518('0xdb'),_0xd518('0xdc'),_0xd518('0xdd'),_0xd518('0xde')])),'[emptyContact][createHistory]',_0xd518('0xdf'));logger[_0xd518('0x9e')](_0x48c411);};Dialer[_0xd518('0x1b')][_0xd518('0xe0')]=function(_0x4fa987){return _0x4fa987===_0xd518('0xe1');};Dialer[_0xd518('0x1b')]['isTrunkReachable']=function(_0x5d7904){return!_[_0xd518('0x45')](_0x5d7904)&&_0x5d7904&&!_[_0xd518('0x45')](_0x5d7904[_0xd518('0x47')])&&!_[_0xd518('0x45')](_0x5d7904['active'])&&_0x5d7904[_0xd518('0x7f')]&&(this[_0xd518('0x24')][util[_0xd518('0x81')](_0xd518('0xe2'),_0x5d7904[_0xd518('0x47')])]['status']===_0xd518('0xe3')||this['trunks'][util[_0xd518('0x81')]('SIP/%s',_0x5d7904[_0xd518('0x47')])][_0xd518('0xb4')]==='unmonitored');};Dialer[_0xd518('0x1b')][_0xd518('0xd9')]=function(_0x2ae25f,_0x23e85c,_0x2925fa){this[_0xd518('0xd3')](_0x2ae25f)['catch'](loggerCatch(_0x23e85c));this[_0xd518('0xd1')](_0x2ae25f)['catch'](loggerCatch(_0x2925fa));};Dialer[_0xd518('0x1b')][_0xd518('0x3c')]=function(_0x5ab7e2){var _0x27f44a=this;var _0x2bf710=this[_0xd518('0x28')][_0x5ab7e2[_0xd518('0xe4')]];var _0x173c0e;if(!_[_0xd518('0xb3')](_0x5ab7e2)&&!_[_0xd518('0xb3')](_0x5ab7e2[_0xd518('0xe5')])&&!_[_0xd518('0xb3')](_0x5ab7e2[_0xd518('0xe5')][_0xd518('0xe6')])&&_0x5ab7e2['exten']==='xcally-motion-dialer'&&_0x2bf710){if(_0x2bf710[_0xd518('0x56')]!=='ivr'&&this[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]]['dialAMDActive']&&_0x5ab7e2[_0xd518('0xe7')]==='HANGUP'){delete this['uniqueId'][_0x5ab7e2['uniqueid']];this[_0xd518('0xb6')](this[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]]);this[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]][_0xd518('0x69')]+=0x1;this[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]][_0xd518('0xe8')]+=0x1;_0x173c0e=new Hangup(_0x2bf710,_0x5ab7e2);_0x173c0e[_0xd518('0xad')]=0x12;_0x173c0e[_0xd518('0xae')]='HangupInAMD';_0x173c0e[_0xd518('0xe9')]='AMD';ami[_0xd518('0xea')](_0xd518('0xeb'),ut[_0xd518('0xec')](_0x173c0e,_0xd518('0xed')));this[_0xd518('0xd9')](_0x173c0e,_0xd518('0xee'),_0xd518('0xef'));}if(_0x2bf710['type']!=='ivr'&&this[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]][_0xd518('0xf0')]&&_0x5ab7e2[_0xd518('0xe7')]===_0xd518('0xf1')){return new Promise(function(_0x1eafda,_0xa1ec9b){delete _0x27f44a[_0xd518('0x28')][_0x5ab7e2['uniqueid']];_0x27f44a[_0xd518('0xb6')](_0x27f44a[_0xd518('0x21')][_0x2bf710['queue']]);_0x27f44a[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]]['outboundAnswerCallsDay']+=0x1;_0x27f44a[_0xd518('0x21')][_0x2bf710['queue']][_0xd518('0xe8')]+=0x1;var _0x2464d6=_0x27f44a[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]];var _0x33e3e8=new Hangup(_0x2bf710,_0x5ab7e2);_0x33e3e8[_0xd518('0xad')]=0x13;_0x33e3e8[_0xd518('0xae')]=_0xd518('0xf2');_0x33e3e8['membername']=_0xd518('0xf3');_0x33e3e8['countmachineretry']+=0x1;_0x33e3e8[_0xd518('0xf4')]+=0x1;_0x33e3e8['amd']=!![];ami[_0xd518('0xea')](_0xd518('0xeb'),ut[_0xd518('0xec')](_0x33e3e8,_0xd518('0xed')));_0x27f44a[_0xd518('0xd3')](_0x33e3e8)[_0xd518('0xbb')](loggerCatch(_0xd518('0xf5')));if(_0x33e3e8[_0xd518('0xf6')]+_0x33e3e8[_0xd518('0xf7')]+_0x33e3e8[_0xd518('0xf8')]+_0x33e3e8[_0xd518('0xf9')]+_0x33e3e8[_0xd518('0xfa')]+_0x33e3e8[_0xd518('0xfb')]+_0x33e3e8[_0xd518('0xfc')]+_0x33e3e8[_0xd518('0xfd')]>=_0x2464d6[_0xd518('0xfe')]){_0x27f44a[_0xd518('0xff')](_0x33e3e8,_0x1eafda,_0xa1ec9b,_0xd518('0x100'));}else{if(_0x33e3e8[_0xd518('0xfc')]>=_0x2464d6[_0xd518('0x101')]){_0x27f44a[_0xd518('0x102')](_0x33e3e8,_0x1eafda,_0xa1ec9b,_0xd518('0x103'));}else{_0x27f44a[_0xd518('0xc7')]({'active':![],'countmachineretry':_0x33e3e8['countmachineretry'],'scheduledat':moment()['add'](_0x2464d6[_0xd518('0x104')],_0xd518('0x105'))[_0xd518('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33e3e8[_0xd518('0xda')],'ListId':_0x33e3e8[_0xd518('0xdb')],'VoiceQueueId':_0x33e3e8[_0xd518('0xdd')]||undefined,'CampaignId':_0x33e3e8[_0xd518('0xde')]||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x106')));_0x1eafda({'reschedule':0x1});}}});}if(_0x2bf710[_0xd518('0x56')]==='ivr'&&this['campaigns'][_0x2bf710[_0xd518('0xb7')]][_0xd518('0xf0')]&&_0x5ab7e2[_0xd518('0xe7')]===_0xd518('0x107')){delete this[_0xd518('0x28')][_0x5ab7e2[_0xd518('0xe4')]];this['updateOriginated'](this[_0xd518('0x22')][_0x2bf710[_0xd518('0xb7')]]);_0x173c0e=new Hangup(_0x2bf710,_0x5ab7e2);_0x173c0e['state']=0x12;_0x173c0e[_0xd518('0xae')]='HangupInAMD';_0x173c0e[_0xd518('0xe9')]=_0xd518('0xf3');ami[_0xd518('0xea')](_0xd518('0xeb'),ut[_0xd518('0xec')](_0x173c0e,_0xd518('0xed')));this['saveInDb'](_0x173c0e,'[syncHangupInAMDIvr][createHistory]',_0xd518('0x108'));}if(_0x2bf710[_0xd518('0x56')]===_0xd518('0x83')&&this[_0xd518('0x22')][_0x2bf710['queue']][_0xd518('0xf0')]&&_0x5ab7e2[_0xd518('0xe7')]===_0xd518('0xf1')){return new Promise(function(_0x3c8db7,_0x2f2b27){delete _0x27f44a[_0xd518('0x28')][_0x5ab7e2[_0xd518('0xe4')]];_0x27f44a[_0xd518('0xb6')](_0x27f44a['campaigns'][_0x2bf710[_0xd518('0xb7')]]);_0x27f44a[_0xd518('0x22')][_0x2bf710[_0xd518('0xb7')]]['outboundAnswerCallsDay']+=0x1;_0x27f44a[_0xd518('0x22')][_0x2bf710[_0xd518('0xb7')]][_0xd518('0xe8')]+=0x1;var _0x1cadfb=_0x27f44a[_0xd518('0x22')][_0x2bf710[_0xd518('0xb7')]];var _0x55b12f=new Hangup(_0x2bf710,_0x5ab7e2);_0x55b12f['state']=0x13;_0x55b12f[_0xd518('0xae')]='Machine';_0x55b12f['membername']=_0xd518('0xf3');_0x55b12f[_0xd518('0xfc')]+=0x1;_0x55b12f[_0xd518('0xf4')]+=0x1;_0x55b12f[_0xd518('0xed')]=!![];ami['emit'](_0xd518('0xeb'),ut[_0xd518('0xec')](_0x55b12f,'amd'));_0x27f44a['createHistory'](_0x55b12f)[_0xd518('0xbb')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x55b12f[_0xd518('0xf6')]+_0x55b12f[_0xd518('0xf7')]+_0x55b12f['countnoanswerretry']+_0x55b12f[_0xd518('0xf9')]+_0x55b12f['countdropretry']+_0x55b12f[_0xd518('0xfb')]+_0x55b12f['countmachineretry']+_0x55b12f[_0xd518('0xfd')]>=_0x1cadfb[_0xd518('0xfe')]){_0x27f44a[_0xd518('0xff')](_0x55b12f,_0x3c8db7,_0x2f2b27,_0xd518('0x100'));}else{if(_0x55b12f['countmachineretry']>=_0x1cadfb[_0xd518('0x101')]){_0x27f44a[_0xd518('0x102')](_0x55b12f,_0x3c8db7,_0x2f2b27,_0xd518('0x103'));}else{_0x27f44a[_0xd518('0xc7')]({'active':![],'countmachineretry':_0x55b12f[_0xd518('0xfc')],'scheduledat':moment()[_0xd518('0x109')](_0x1cadfb['dialMachineRetryFrequency'],'minutes')[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x55b12f[_0xd518('0xda')],'ListId':_0x55b12f[_0xd518('0xdb')],'VoiceQueueId':_0x55b12f[_0xd518('0xdd')]||undefined,'CampaignId':_0x55b12f[_0xd518('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x3c8db7({'reschedule':0x1});}}});}}};Dialer[_0xd518('0x1b')]['syncHangup']=function(_0x5cbbd5){var _0x2b9b85=this['uniqueId'][_0x5cbbd5[_0xd518('0xe4')]];var _0x578ee9;if(_0x2b9b85&&_0x2b9b85[_0xd518('0x56')]===_0xd518('0x83')){delete this[_0xd518('0x28')][_0x5cbbd5[_0xd518('0xe4')]];this[_0xd518('0xb6')](this[_0xd518('0x22')][_0x2b9b85[_0xd518('0xb7')]]);this[_0xd518('0x22')][_0x2b9b85[_0xd518('0xb7')]][_0xd518('0x10b')]+=0x1;_0x578ee9=new Hangup(_0x2b9b85,_0x5cbbd5);this[_0xd518('0xd3')](_0x578ee9)[_0xd518('0xbb')](loggerCatch(_0xd518('0x10c')));this[_0xd518('0xd1')](_0x578ee9)[_0xd518('0xbb')](loggerCatch('[syncHangupIvr]'));}if(_0x2b9b85&&_0x2b9b85[_0xd518('0x56')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x2b9b85[_0xd518('0xb7')]][_0xd518('0x10d')])){delete this[_0xd518('0x28')][_0x5cbbd5['uniqueid']];this[_0xd518('0xb6')](this[_0xd518('0x21')][_0x2b9b85[_0xd518('0xb7')]]);this[_0xd518('0x21')][_0x2b9b85[_0xd518('0xb7')]][_0xd518('0x69')]+=0x1;this[_0xd518('0x21')][_0x2b9b85[_0xd518('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;_0x578ee9=new Hangup(_0x2b9b85,_0x5cbbd5);_0x578ee9[_0xd518('0xad')]=0x10;_0x578ee9['statedesc']=_0xd518('0x10e');_0x578ee9['membername']=_0xd518('0x10f');this[_0xd518('0xd3')](_0x578ee9)[_0xd518('0xbb')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xd518('0xd1')](_0x578ee9)[_0xd518('0xbb')](loggerCatch(_0xd518('0x110')));}if(_0x2b9b85&&_0x2b9b85[_0xd518('0x56')]!==_0xd518('0x83')&&!isNotNull(this[_0xd518('0x21')][_0x2b9b85['queue']][_0xd518('0x10d')])){delete this[_0xd518('0x28')][_0x5cbbd5[_0xd518('0xe4')]];this[_0xd518('0xb6')](this['voiceQueues'][_0x2b9b85[_0xd518('0xb7')]]);this[_0xd518('0x21')][_0x2b9b85[_0xd518('0xb7')]][_0xd518('0x73')]+=0x1;_0x578ee9=new Hangup(_0x2b9b85,_0x5cbbd5);_0x578ee9[_0xd518('0xad')]=0xc;_0x578ee9[_0xd518('0xae')]=_0x5cbbd5[_0xd518('0x111')];_0x578ee9[_0xd518('0xe9')]=_0xd518('0x112');this[_0xd518('0xd3')](_0x578ee9)[_0xd518('0xbb')](loggerCatch(_0xd518('0x10c')));this[_0xd518('0xd1')](_0x578ee9)[_0xd518('0xbb')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xd518('0x1b')]['syncAgentComplete']=function(_0x54babf){var _0x894468=this[_0xd518('0x28')][_0x54babf['uniqueid']];if(this[_0xd518('0x21')][_0x54babf[_0xd518('0xb7')]]){if(_0x894468&&_0x894468[_0xd518('0x56')]!=='ivr'){delete this[_0xd518('0x28')][_0x54babf['uniqueid']];this['voiceQueues'][_0x54babf['queue']][_0xd518('0x69')]+=0x1;var _0x3bf95c=new AgentComplete(_0x894468,_0x54babf);if(_0x54babf[_0xd518('0x113')]==='agent'){_0x3bf95c[_0xd518('0x114')]=this['voiceQueues'][_0x54babf[_0xd518('0xb7')]][_0xd518('0x115')]&&this[_0xd518('0x21')][_0x54babf['queue']][_0xd518('0x116')]?moment()['format'](_0xd518('0x10a')):undefined;}this['createHistory'](_0x3bf95c)['catch'](loggerCatch(_0xd518('0x117')));this['moveContactManagedDialer'](_0x3bf95c)[_0xd518('0xbb')](loggerCatch(_0xd518('0x118')));}}};Dialer[_0xd518('0x1b')]['syncAgentConnect']=function(_0x45e425){if(this[_0xd518('0x21')][_0x45e425['queue']]){if(this['uniqueId'][_0x45e425[_0xd518('0xe4')]]&&this[_0xd518('0x28')][_0x45e425['uniqueid']][_0xd518('0x56')]!=='ivr'){this[_0xd518('0xb6')](this[_0xd518('0x21')][_0x45e425['queue']]);this[_0xd518('0x28')][_0x45e425[_0xd518('0xe4')]][_0xd518('0x119')]=moment()['format'](_0xd518('0x10a'));}}};Dialer[_0xd518('0x1b')][_0xd518('0x11a')]=function(_0x37d339,_0x391681){this[_0xd518('0xd3')](_0x37d339)[_0xd518('0xbb')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x391681==0x0){this[_0xd518('0xd1')](_0x37d339)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xd518('0x1b')][_0xd518('0x31')]=function(_0x440642){var _0x2f88f2=this[_0xd518('0x28')][_0x440642['uniqueid']];var _0x481bfd=this;var _0x1f4ce3=![];var _0x824852;var _0x1b6f5e;if(this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]]){if(_0x2f88f2&&_0x2f88f2['type']!==_0xd518('0x83')){delete this[_0xd518('0x28')][_0x440642[_0xd518('0xe4')]];this[_0xd518('0xb6')](this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]]);_0x2f88f2[_0xd518('0x11b')]=moment()['format'](_0xd518('0x10a'));var _0x1c484f=new QueueCallerAbandon(_0x2f88f2,_0x440642);if(getSeconds(_0x2f88f2[_0xd518('0x11b')],_0x2f88f2[_0xd518('0x11c')])>=_0x2f88f2[_0xd518('0x11d')]){this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x440642[_0xd518('0xb7')]][_0xd518('0x6d')]+=0x1;this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]][_0xd518('0x78')]+=0x1;_0x1c484f['state']=0xa;_0x1c484f[_0xd518('0xae')]=_0xd518('0x11e');_0x1c484f['dropreason']=_0xd518('0x11f');_0x1c484f[_0xd518('0x114')]=this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]]['dialQueueProject2']?moment()[_0xd518('0x81')](_0xd518('0x10a')):undefined;_0x1c484f['countdropretry']+=0x1;_0x1c484f[_0xd518('0xf4')]+=0x1;_0x824852=this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]][_0xd518('0x120')];_0x1b6f5e=this['voiceQueues'][_0x440642[_0xd518('0xb7')]][_0xd518('0x121')];_0x481bfd[_0xd518('0xbf')](_0x1c484f,_0x1c484f[_0xd518('0xad')],_0x2f88f2[_0xd518('0x122')])[_0xd518('0x43')](function(_0x35a76b){_0x1f4ce3=_0x35a76b[_0xd518('0x123')]==0x1;if(_0x1c484f[_0xd518('0xfa')]>=_0x481bfd[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]][_0xd518('0x124')]){_0x481bfd['queueCallerAbandonCreateState'](_0x1c484f,_0x35a76b['additional']);}else{_0x481bfd[_0xd518('0xc7')]({'active':![],'countdropretry':_0x1c484f[_0xd518('0xfa')],'scheduledat':moment()[_0xd518('0x109')](_0x481bfd['voiceQueues'][_0x440642[_0xd518('0xb7')]][_0xd518('0x120')],_0xd518('0x105'))[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x2f88f2['ContactId'],'ListId':_0x2f88f2['ListId'],'VoiceQueueId':_0x2f88f2['VoiceQueueId']||undefined,'CampaignId':_0x2f88f2[_0xd518('0xde')]||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x125')));var _0x35e37b=new History(_0x1c484f);_0x35e37b['state']=0xa;_0x35e37b[_0xd518('0xae')]=_0xd518('0x11e');_0x35e37b[_0xd518('0xb0')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x35e37b[_0xd518('0xaf')]=_0x35e37b['starttime'];_0x35e37b[_0xd518('0x126')]=_0x1c484f[_0xd518('0x126')];_0x35e37b[_0xd518('0x127')]=_0x1c484f[_0xd518('0x127')];_0x481bfd[_0xd518('0xd3')](_0x35e37b)[_0xd518('0xbb')](loggerCatch(_0xd518('0x128')));}})['then'](function(){if(_0x1f4ce3)_0x481bfd[_0xd518('0xc0')](_0x1c484f,_0x824852,_0x1b6f5e)['then'](function(){return 0x1;});});}else{this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]][_0xd518('0x8b')]+=0x1;this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]]['outboundDropCallsDayCallersExit']+=0x1;_0x1c484f[_0xd518('0xad')]=0xb;_0x1c484f[_0xd518('0xae')]=_0xd518('0x129');_0x1c484f[_0xd518('0x12a')]=_0xd518('0x12b');_0x1c484f['countabandonedretry']+=0x1;_0x1c484f[_0xd518('0xf4')]+=0x1;_0x824852=this[_0xd518('0x21')][_0x440642['queue']][_0xd518('0x12c')];_0x1b6f5e=this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]][_0xd518('0x121')];_0x481bfd[_0xd518('0xbf')](_0x1c484f,_0x1c484f[_0xd518('0xad')],_0x2f88f2[_0xd518('0x122')])[_0xd518('0x43')](function(_0x1a09d8){if(_0x1c484f[_0xd518('0xfb')]>=_0x481bfd['voiceQueues'][_0x440642['queue']]['dialAbandonedMaxRetry']){_0x481bfd['queueCallerAbandonCreateState'](_0x1c484f,_0x1a09d8['additional']);}else{_0x481bfd[_0xd518('0xc7')]({'active':![],'countabandonedretry':_0x1c484f[_0xd518('0xfb')],'scheduledat':moment()['add'](_0x481bfd['voiceQueues'][_0x440642[_0xd518('0xb7')]][_0xd518('0x12c')],'minutes')[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x2f88f2[_0xd518('0xda')],'ListId':_0x2f88f2[_0xd518('0xdb')],'VoiceQueueId':_0x2f88f2[_0xd518('0xdd')]||undefined,'CampaignId':_0x2f88f2['CampaignId']||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x12d')));var _0x29c298=new History(_0x1c484f);_0x29c298[_0xd518('0xad')]=0xb;_0x29c298[_0xd518('0xae')]='Abandoned';_0x29c298[_0xd518('0xb0')]=moment()[_0xd518('0x81')](_0xd518('0x10a'));_0x29c298['endtime']=_0x29c298['starttime'];_0x29c298[_0xd518('0x126')]=_0x1c484f[_0xd518('0x126')];_0x29c298[_0xd518('0x127')]=_0x1c484f[_0xd518('0x127')];_0x481bfd[_0xd518('0xd3')](_0x29c298)[_0xd518('0xbb')](loggerCatch(_0xd518('0x12e')));}})['then'](function(){if(_0x1f4ce3)_0x481bfd[_0xd518('0xc0')](_0x1c484f,_0x824852,_0x1b6f5e)[_0xd518('0x43')](function(){return 0x1;});});}}}};Dialer['prototype'][_0xd518('0x3b')]=function(_0x3a655d){if(this['actions'][_0x3a655d[_0xd518('0xe4')]]){this[_0xd518('0x12f')][_0x3a655d[_0xd518('0xe4')]][_0xd518('0xb5')]=_0x3a655d['channel'];}if(this[_0xd518('0x28')][_0x3a655d[_0xd518('0xe4')]]){this[_0xd518('0x28')][_0x3a655d['uniqueid']][_0xd518('0xb5')]=_0x3a655d[_0xd518('0xb5')];}};Dialer[_0xd518('0x1b')][_0xd518('0x3e')]=function(_0xfd725){if(strategy[this[_0xd518('0x21')][this[_0xd518('0x12f')][_0xfd725['actionid']]['queue']][_0xd518('0x130')]]===_0xd518('0x1a')){if(this['actions'][_0xfd725[_0xd518('0x131')]]&&_[_0xd518('0xb3')](this['actions'][_0xfd725[_0xd518('0x131')]][_0xd518('0x132')])&&_0xfd725[_0xd518('0xb4')]==='1'&&_0xfd725['paused']==='0'){if(this[_0xd518('0x23')][_0xfd725['stateinterface']]){if(!this[_0xd518('0x23')][_0xfd725['stateinterface']][_0xd518('0x132')]){this[_0xd518('0x23')][_0xfd725[_0xd518('0x133')]]['locked']=!![];this[_0xd518('0x12f')][_0xfd725[_0xd518('0x131')]][_0xd518('0x132')]=!![];this['actions'][_0xfd725[_0xd518('0x131')]][_0xd518('0x133')]=_0xfd725[_0xd518('0x133')];}}}}else if((strategy[this[_0xd518('0x21')][this['actions'][_0xfd725[_0xd518('0x131')]][_0xd518('0xb7')]][_0xd518('0x130')]]||_0xd518('0x19'))===_0xd518('0x19')){if(this[_0xd518('0x12f')][_0xfd725['actionid']]){if(this[_0xd518('0x23')][_0xfd725['stateinterface']]){this[_0xd518('0x12f')][_0xfd725[_0xd518('0x131')]]['stateinterface']=_0xfd725[_0xd518('0x133')];if(_[_0xd518('0xb3')](this[_0xd518('0x2c')][this[_0xd518('0x12f')][_0xfd725['actionid']][_0xd518('0xb7')]])){this[_0xd518('0x2c')][this['actions'][_0xfd725[_0xd518('0x131')]][_0xd518('0xb7')]]=[];}this[_0xd518('0x2c')][this[_0xd518('0x12f')][_0xfd725[_0xd518('0x131')]][_0xd518('0xb7')]][_0xd518('0x134')](_[_0xd518('0x98')](_[_0xd518('0x135')](this[_0xd518('0x12f')][_0xfd725[_0xd518('0x131')]],[_0xd518('0x136'),'stateinterface']),{'status':_0xfd725[_0xd518('0xb4')],'paused':_0xfd725[_0xd518('0x137')]}));}}}};function unlockQueueStatus(_0x3f2b97,_0x13d5d2){setTimeout(function(){if(_[_0xd518('0x45')](_0x3f2b97[_0xd518('0x138')])){loggerBooked[_0xd518('0x9e')](_0xd518('0x139'),_0x13d5d2);}_0x3f2b97['queueStatusComplete']=!![];loggerBooked[_0xd518('0x84')](_0xd518('0x13a'),_0x13d5d2,JSON[_0xd518('0x52')](_[_0xd518('0x135')](_0x3f2b97,['name',_0xd518('0x138')])));},0x1f3);}Dialer[_0xd518('0x1b')][_0xd518('0x3f')]=function(_0x54bbe6){var _0x800471=this;var _0x3e1cd9=_0x800471['voiceQueues'][_0x800471[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]];if(strategy[this[_0xd518('0x21')][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]][_0xd518('0x130')]]===_0xd518('0x1a')){if(this['actions'][_0x54bbe6['actionid']]&&this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0x133')]){this['preview'][_0xd518('0x13b')](this[_0xd518('0x12f')][_0x54bbe6['actionid']][_0xd518('0x136')],this[_0xd518('0x12f')][_0x54bbe6['actionid']][_0xd518('0x133')])[_0xd518('0xbb')](function(_0x5c114b){logger['error'](_0xd518('0x13c'),util[_0xd518('0xa0')](_0x5c114b,{'showHidden':![],'depth':null}));})[_0xd518('0x1e')](function(){_0x800471[_0xd518('0xb6')](_0x800471[_0xd518('0x21')][_0x800471['actions'][_0x54bbe6['actionid']][_0xd518('0xb7')]]);_0x800471['agents'][_0x800471['actions'][_0x54bbe6[_0xd518('0x131')]][_0xd518('0x133')]][_0xd518('0x132')]=![];delete _0x800471[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]];unlockQueueStatus(_0x3e1cd9);});}else{this[_0xd518('0xb6')](this[_0xd518('0x21')][this['actions'][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]]);this[_0xd518('0xc7')]({'active':![],'ContactId':this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]]['ContactId'],'ListId':this['actions'][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xdb')],'VoiceQueueId':this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xdd')]||undefined,'CampaignId':this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xde')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xd518('0x12f')][_0x54bbe6['actionid']];unlockQueueStatus(_0x3e1cd9);}}else if((strategy[this['voiceQueues'][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]][_0xd518('0x130')]]||_0xd518('0x19'))==='rrmemory'){var _0x1d8455;if(this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]]&&!_[_0xd518('0x4e')](this[_0xd518('0x2c')][this['actions'][_0x54bbe6[_0xd518('0x131')]]['queue']])){if(this['queueBookedRR'][_0x800471['actions'][_0x54bbe6['actionid']][_0xd518('0xb7')]]){this[_0xd518('0x2d')][_0x800471[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]]=this[_0xd518('0x2d')][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]]?this[_0xd518('0x2d')][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]]:this['queueBooked'][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]]?this['queueBooked'][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]][_0xd518('0x13d')]||0x0:0x0;}this[_0xd518('0x2c')][this[_0xd518('0x12f')][_0x54bbe6['actionid']][_0xd518('0xb7')]][_0xd518('0x13d')]=this[_0xd518('0x2d')][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]];for(var _0x3259a2=0x0;_0x3259a2=0x0;})[_0xd518('0xbb')](myreject(_0x1bd105)));}}else{_0x16bdb7[_0xd518('0x134')](ami['Action']({'action':_0xd518('0x159'),'command':util[_0xd518('0x81')](_0xd518('0x154'),_0x5b39ff,!_[_0xd518('0x45')](config[_0xd518('0x14f')][_0x5d2d40])?_0x5d2d40:'')})[_0xd518('0x43')](function(_0x24b8f2){return _0x24b8f2[_0xd518('0x156')][_0xd518('0x157')](_0xd518('0x158'))>=0x0;})[_0xd518('0xbb')](myreject(_0x1bd105)));}Promise['all'](_0x16bdb7)[_0xd518('0x43')](function(_0x14e143){var _0x107fff=_['some'](_0x14e143);if(_0x107fff){return _0x256f65(_0x107fff);}else{_0x4882cf['message']=_0x1b158b?_0xd518('0x15a'):_0xd518('0x15b');return _0x1bd105(msgResponse(_0xd518('0x15c'),_0xd518('0x14e'),'Global:\x20'+_0x1b158b+'\x20'+_0x1bfeff+'\x20Interval\x20is\x20overtime:\x20'+util[_0xd518('0xa0')](_0x5b39ff,{'showHidden':![],'depth':null})+_0xd518('0x15d')+_0x5d2d40));}})[_0xd518('0xbb')](function(_0x3f0405){return _0x1bd105(msgResponse(_0xd518('0x14b'),_0xd518('0x14e'),JSON[_0xd518('0x52')](_0x3f0405)));});});};Dialer['prototype'][_0xd518('0x15e')]=function(_0x42a6e6){var _0x34d9be=this;return function(){switch(_0x42a6e6[_0xd518('0x65')]){case _0xd518('0x15f'):freeVariablesPredictive(_0x42a6e6);_0x34d9be['handlePower'](_0x42a6e6,0x1);break;case _0xd518('0x160'):freeVariablesPredictive(_0x42a6e6);_0x34d9be[_0xd518('0x161')](_0x42a6e6,_0x42a6e6[_0xd518('0x162')]);break;case _0xd518('0xa'):_0x34d9be[_0xd518('0xa')](_0x42a6e6);break;case'booked':freeVariablesPredictive(_0x42a6e6);_0x34d9be['handlePower'](_0x42a6e6,0x1);break;default:freeVariablesPredictive(_0x42a6e6);logger[_0xd518('0x9e')](_0xd518('0x163'),_0x42a6e6[_0xd518('0x47')],_0xd518('0x164'));}};};Dialer[_0xd518('0x1b')][_0xd518('0x165')]=function(_0x255547){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopper[_0xd518('0x166')](_0x255547['id'],previewRecallmeReminderInterval))[_0xd518('0x43')](function(_0x16ff58){for(var _0x18507b=0x0;_0x18507b<_0x16ff58[_0xd518('0x152')];_0x18507b++){var _0x4a1175=_0x16ff58[_0x18507b][_0xd518('0x167')]['name'];if(_0x4a1175)io['to'](util[_0xd518('0x81')]('user:%s',_0x4a1175))[_0xd518('0xea')](_0xd518('0x168'),{'hopper':_0x16ff58[_0x18507b]});}})[_0xd518('0xbb')](function(){});};Dialer[_0xd518('0x1b')]['launchHandleIvr']=function(_0x1ea944){var _0x585b82=this;return function(){_0x585b82[_0xd518('0x169')](_0x1ea944);};};Dialer[_0xd518('0x1b')][_0xd518('0x16a')]=function(_0x12e71a){var _0x2dddc2=this;if(isNotPreview(_0x12e71a[_0xd518('0x65')])){if(isVoiceQueueOutbound(_0x12e71a[_0xd518('0x56')])&&isActive(_0x12e71a['dialActive'])){_0x12e71a['sendMessageOneNotActive']=!![];Promise['resolve']()[_0xd518('0x43')](checkIsLoggedIn(_0x12e71a,_0x12e71a['loggedIn']))['then'](checkIsActive(_0x12e71a,_0x12e71a['dialActive']))[_0xd518('0x43')](checkInterval(_0x12e71a))[_0xd518('0x43')](_0x2dddc2[_0xd518('0x146')](_0x12e71a))[_0xd518('0x43')](_0x2dddc2[_0xd518('0x16b')](_0x12e71a[_0xd518('0x16c')],_0x12e71a[_0xd518('0x16d')],_0x12e71a[_0xd518('0x47')],_0x12e71a))[_0xd518('0x43')](_0x2dddc2[_0xd518('0x14a')](_0x12e71a[_0xd518('0x4b')],_0x12e71a['dialTimezone'],_0x12e71a['name'],_0x12e71a))[_0xd518('0x43')](_0x2dddc2['checkDialMethod'](_0x12e71a))[_0xd518('0xbb')](loggerCatchQueueSummary(_0xd518('0x16e'),_0x12e71a));}else{notSendMessagesQueue(_0x12e71a);}}else{freeVariablesPredictive(_0x12e71a);}};Dialer[_0xd518('0x1b')]['syncQueueSummaryComplete']=_[_0xd518('0x16f')](function(){var _0x508b08=_[_0xd518('0x170')](this['voiceQueues'],function(_0x3fe996){return _0x3fe996[_0xd518('0x171')];});var _0x3e1fdc=_[_0xd518('0x170')](this[_0xd518('0x23')],function(_0x4d6f4d){return _0x4d6f4d[_0xd518('0x172')]&&_0x4d6f4d[_0xd518('0xb4')]===_0xd518('0xe3');});if(_0x508b08[_0xd518('0x152')]>0x0&&_0x3e1fdc[_0xd518('0x152')]>0x0){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopper[_0xd518('0x166')](_['map'](_0x508b08,'id'),previewRecallmeReminderInterval,_['map'](_0x3e1fdc,'id')))[_0xd518('0x43')](function(_0x376635){for(var _0x5cdad0=0x0;_0x5cdad0<_0x376635[_0xd518('0x152')];_0x5cdad0++){var _0x4c63a4=_0x376635[_0x5cdad0]['Agent'][_0xd518('0x47')];if(_0x4c63a4)io['to'](util[_0xd518('0x81')](_0xd518('0x173'),_0x4c63a4))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x376635[_0x5cdad0]});}})[_0xd518('0xbb')](function(_0x3dffd1){logger[_0xd518('0x9e')](_0xd518('0x165'),_0x3dffd1);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xd518('0x1b')][_0xd518('0x174')]=function(){var _0x54e91e=this;var _0x1fe4de;for(var _0xd797f2 in this['campaigns']){if(typeof this[_0xd518('0x22')][_0xd797f2]!==_0xd518('0xd5')){_0x1fe4de=this[_0xd518('0x22')][_0xd797f2];if(isCampaignIvr(_0x1fe4de[_0xd518('0x56')])&&isActive(_0x1fe4de[_0xd518('0x7f')])){_0x1fe4de[_0xd518('0xa7')]=!![];Promise[_0xd518('0xc1')]()[_0xd518('0x43')](checkIsActive(_0x1fe4de,_0x1fe4de[_0xd518('0x7f')]))[_0xd518('0x43')](checkInterval(_0x1fe4de))[_0xd518('0x43')](_0x54e91e[_0xd518('0x146')](_0x1fe4de))['then'](_0x54e91e[_0xd518('0x16b')](_0x1fe4de[_0xd518('0x16c')],_0x1fe4de[_0xd518('0x16d')],_0x1fe4de[_0xd518('0x47')],_0x1fe4de))[_0xd518('0x43')](_0x54e91e['checkIfTimeIntervals'](_0x1fe4de['Interval'],_0x1fe4de['dialTimezone'],_0x1fe4de[_0xd518('0x47')],_0x1fe4de))['then'](_0x54e91e[_0xd518('0x175')](_0x1fe4de))[_0xd518('0xbb')](loggerCatchQueueSummary(_0xd518('0x176'),_0x1fe4de));}else{notSendMessagesCampaign(_0x1fe4de);}}}};function getCallerIdRandom(_0x3d6536,_0x51d3b5){var _0x71be64;var _0x29cac5;var _0x4ce667;if(_0x51d3b5<=0x0){_0x51d3b5=0x1;}_0x71be64=new RegExp(_0xd518('0x177')+_0x51d3b5+'}$');_0x29cac5=Math[_0xd518('0x178')](0xa,_0x51d3b5-0x1);_0x4ce667=Math[_0xd518('0x178')](0xa,_0x51d3b5)-0x1;return util[_0xd518('0x81')]('%s',_[_0xd518('0x179')](_0x3d6536,_0x71be64,_[_0xd518('0x17a')](_0x29cac5,_0x4ce667)));}function extractCalleridName(_0x270ce7){var _0x2172ac=_0x270ce7[_0xd518('0x17b')](/"(.*?)"/);return _0x2172ac?_0x2172ac[0x1]:_0x270ce7;}Dialer[_0xd518('0x1b')][_0xd518('0x17c')]=function(_0x52f7ce,_0x1c95e3){var _0x451081=this;var _0x4f50d5=uuid['v4']();this[_0xd518('0x12f')][_0x4f50d5]=new Action(_0x52f7ce,_0x1c95e3,_0x4f50d5);return new Promise(function(_0x361afe,_0x313733){if(_[_0xd518('0x45')](_0x52f7ce)&&typeof _0x52f7ce!==_0xd518('0x17d')){return _0x313733(msgResponse('originate',_0xd518('0x14e'),_0xd518('0x17e')));}if(_[_0xd518('0x45')](_0x1c95e3['phone'])||_0x1c95e3[_0xd518('0x17f')]===null){return _0x313733(msgResponse(_0xd518('0x180'),_0xd518('0x14e'),_0xd518('0x181')));}var _0x4877b5={'XMD-CALLERID':_0x451081[_0xd518('0x12f')][_0x4f50d5]['getCaller'](),'XMD-AGI':_0x52f7ce[_0xd518('0x10d')]?util[_0xd518('0x81')](_0xd518('0x182'),ipAgi,_0x52f7ce[_0xd518('0x10d')]):_0xd518('0x183'),'XMD-AGIAFTER':_0x52f7ce['dialQueueProject2']?util['format'](_0xd518('0x182'),ipAgi,_0x52f7ce[_0xd518('0x115')]):_0xd518('0x183'),'XMD-QUEUE':_0x52f7ce[_0xd518('0x56')]===_0xd518('0x57')?util[_0xd518('0x81')](_0xd518('0x184'),_0x52f7ce['name'],_0x52f7ce['dialQueueOptions']||'',_0x52f7ce[_0xd518('0x116')]?'c':'',_0x52f7ce[_0xd518('0x11d')]||0x3):_0xd518('0x183'),'XMD-CONTACTID':_0x1c95e3[_0xd518('0xda')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x451081['actions'][_0x4f50d5][_0xd518('0x185')](),'XMD-AMD':_0x52f7ce['dialAMDActive']?_0xd518('0x186'):_0xd518('0x183'),'XMD-DESTINATION':_0xd518('0x187')};if(_0x52f7ce[_0xd518('0xf0')]){_0x4877b5['XMD-AMDINITIALSILENCE']=_0x52f7ce[_0xd518('0x188')]||0x9c4;_0x4877b5[_0xd518('0x189')]=_0x52f7ce[_0xd518('0x18a')]||0x5dc;_0x4877b5['XMD-AMDAFTERGREETINGSILENCE']=_0x52f7ce[_0xd518('0x18b')]||0x320;_0x4877b5[_0xd518('0x18c')]=_0x52f7ce[_0xd518('0x18d')]||0x1388;_0x4877b5['XMD-AMDMINWORDLENGTH']=_0x52f7ce[_0xd518('0x18e')]||0x64;_0x4877b5['XMD-AMDBETWEENWORDSSILENCE']=_0x52f7ce[_0xd518('0x18f')]||0x32;_0x4877b5[_0xd518('0x190')]=_0x52f7ce[_0xd518('0x191')]||0x3;_0x4877b5[_0xd518('0x192')]=_0x52f7ce[_0xd518('0x193')]||0x100;_0x4877b5['XMD-AMDMAXIMUMWORDLENGTH']=_0x52f7ce['dialAMDMaximumWordLength']||0x1388;}if(_0x52f7ce[_0xd518('0x56')]==='outbound'){_0x4877b5['XMD-VOICEQUEUEID']=_0x1c95e3['VoiceQueueId'];}else{_0x4877b5[_0xd518('0x194')]=_0x1c95e3[_0xd518('0xde')];}for(var _0x6e5e4 in _0x1c95e3[_0xd518('0x195')]){if(typeof _0x1c95e3[_0xd518('0x195')][_0x6e5e4]!==_0xd518('0xd5')){if(isNotNull(_0x1c95e3[_0xd518('0x195')][_0x6e5e4])&&_0x6e5e4!=='id'&&_0x6e5e4!==_0xd518('0x196')&&_0x6e5e4!==_0xd518('0x197')&&_0x6e5e4!==_0xd518('0x198')){_0x4877b5[util[_0xd518('0x81')](_0xd518('0x199'),_0xd518('0x19a'),_[_0xd518('0x19b')](_0x6e5e4))]=_0x1c95e3['Contact'][_0x6e5e4];}}}var _0x2bdde6=_0x451081[_0xd518('0x147')](_0x52f7ce['Trunk'])?getCallerId(_0x52f7ce[_0xd518('0x7e')]['callerid'],_0x52f7ce[_0xd518('0x66')],_0x52f7ce['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x52f7ce[_0xd518('0x67')],_0x52f7ce['dialRandomLastDigitCallerIdNumber']):_0x52f7ce['dialOriginateCallerIdNumber']):getCallerId(_[_0xd518('0xb3')](_0x52f7ce[_0xd518('0x19c')])?_0x52f7ce[_0xd518('0x7e')][_0xd518('0x80')]:_0x52f7ce['TrunkBackup'][_0xd518('0x80')],_0x52f7ce[_0xd518('0x66')],_0x52f7ce[_0xd518('0x19d')]>0x0?getCallerIdRandom(_0x52f7ce['dialOriginateCallerIdNumber'],_0x52f7ce['dialRandomLastDigitCallerIdNumber']):_0x52f7ce['dialOriginateCallerIdNumber']);if(_0x2bdde6){_0x4877b5['XMD-ORIGINATECALLERIDNAME']=_0x451081[_0xd518('0x12f')][_0x4f50d5][_0xd518('0x19e')]=extractCalleridName(_0x2bdde6);_0x4877b5[_0xd518('0x19f')]=_0x1c95e3[_0xd518('0x17f')];}_0x52f7ce[_0xd518('0x1a0')]=_0x4877b5;return ami['Action']({'actionid':_0x4f50d5,'action':_0xd518('0x180'),'channel':_0x451081['isTrunkReachable'](_0x52f7ce[_0xd518('0x7e')])?util[_0xd518('0x81')](_0xd518('0x1a1'),_0x52f7ce[_0xd518('0x7e')][_0xd518('0x47')],isNotNull(_0x52f7ce[_0xd518('0x68')])?_0x52f7ce[_0xd518('0x68')][_0xd518('0x1a2')]()||'':'',_0x52f7ce['dialCutDigit']>0x0?_0x1c95e3[_0xd518('0x17f')]['substring'](_0x52f7ce[_0xd518('0x1a3')]):_0x1c95e3[_0xd518('0x17f')]):util['format'](_0xd518('0x1a1'),_['isNil'](_0x52f7ce[_0xd518('0x19c')])?_0x52f7ce[_0xd518('0x7e')][_0xd518('0x47')]:_0x52f7ce[_0xd518('0x19c')][_0xd518('0x47')],isNotNull(_0x52f7ce[_0xd518('0x68')])?_0x52f7ce[_0xd518('0x68')][_0xd518('0x1a2')]()||'':'',_0x52f7ce[_0xd518('0x1a3')]>0x0?_0x1c95e3['phone'][_0xd518('0x1a4')](_0x52f7ce[_0xd518('0x1a3')]):_0x1c95e3[_0xd518('0x17f')]),'callerid':_0x2bdde6,'Exten':_0xd518('0x187'),'Context':'from-sip','Priority':'1','variable':_0x4877b5,'timeout':(_0x52f7ce[_0xd518('0x1a5')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4f50d5})[_0xd518('0x43')](function(_0x3bc396){return _0x361afe(_0x3bc396);})[_0xd518('0xbb')](function(_0x312b5){_0x52f7ce[_0xd518('0x70')]+=0x1;var _0x51bbf7=new History(_0x451081[_0xd518('0x12f')][_0x4f50d5]);logger[_0xd518('0x9e')](util[_0xd518('0x81')](_0xd518('0x1a6'),JSON[_0xd518('0x52')](_0x312b5)));_0x51bbf7['state']=0xe;_0x51bbf7['statedesc']=_0xd518('0x1a7');_0x51bbf7[_0xd518('0xb0')]=moment()['format'](_0xd518('0x10a'));_0x51bbf7[_0xd518('0xaf')]=_0x51bbf7['starttime'];_0x451081[_0xd518('0xd3')](_0x51bbf7)['catch'](loggerCatch(_0xd518('0x1a8')));_0x451081[_0xd518('0xd1')](_0x51bbf7)['catch'](loggerCatch(_0xd518('0x1a8')))[_0xd518('0x1e')](function(){delete _0x451081[_0xd518('0x12f')][_0x4f50d5];return _0x313733(msgResponse(_0xd518('0x180'),_0xd518('0x51'),_0xd518('0x1a9')));});});});};Dialer[_0xd518('0x1b')][_0xd518('0x34')]=function(_0x322fe6){var _0x1363e1=this[_0xd518('0x12f')][_0x322fe6[_0xd518('0x131')]];if(_0x1363e1){delete this['actions'][_0x322fe6[_0xd518('0x131')]];_0x1363e1[_0xd518('0x11c')]=moment()['format'](_0xd518('0x10a'));var _0x459418=_0x1363e1[_0xd518('0x56')]===_0xd518('0x83')?this['campaigns'][_0x1363e1[_0xd518('0xb7')]]:this[_0xd518('0x21')][_0x1363e1[_0xd518('0x1aa')]()];if(!this[_0xd518('0xe0')](_0x322fe6[_0xd518('0x1ab')])){this[_0xd518('0xb6')](_0x459418);return this[_0xd518('0x1ac')](_0x1363e1,_0x459418,_0x322fe6)['catch'](loggerCatch(_0xd518('0x1ad')));}this[_0xd518('0x28')][_0x322fe6[_0xd518('0xe4')]]=_0x1363e1;}};Dialer[_0xd518('0x1b')][_0xd518('0x1ae')]=function(_0x3f6191,_0x37e875,_0x2c5c02){var _0x4ea2e4=new History(_0x37e875);if(_0x4ea2e4[_0xd518('0xf6')]+_0x4ea2e4[_0xd518('0xf7')]+_0x4ea2e4['countnoanswerretry']+_0x4ea2e4['countnosuchnumberretry']+_0x4ea2e4[_0xd518('0xfa')]+_0x4ea2e4[_0xd518('0xfb')]+_0x4ea2e4[_0xd518('0xfc')]+_0x4ea2e4[_0xd518('0xfd')]>=_0x2c5c02[_0xd518('0xfe')]-0x1){return!![];}switch(_0x3f6191){case 0x3:if(_0x4ea2e4[_0xd518('0xf8')]>=_0x2c5c02[_0xd518('0x1af')]-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countnoanswerretry':_0x4ea2e4['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02['dialNoAnswerRetryFrequency'],_0xd518('0x105'))['format'](_0xd518('0x10a')),'ContactId':_0x4ea2e4[_0xd518('0xda')],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4['VoiceQueueId']||undefined,'CampaignId':_0x4ea2e4[_0xd518('0xde')]||undefined})['catch'](loggerCatch(_0xd518('0x1b0')));break;case 0x5:if(_0x4ea2e4[_0xd518('0xf6')]>=_0x2c5c02[_0xd518('0x1b1')]-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countbusyretry':_0x4ea2e4['countbusyretry']+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02[_0xd518('0x1b2')],_0xd518('0x105'))[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x4ea2e4[_0xd518('0xda')],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4[_0xd518('0xdd')]||undefined,'CampaignId':_0x4ea2e4['CampaignId']||undefined})['catch'](loggerCatch(_0xd518('0x1b3')));break;case 0x8:if(_0x4ea2e4[_0xd518('0xf7')]>=_0x2c5c02['dialCongestionMaxRetry']-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countcongestionretry':_0x4ea2e4[_0xd518('0xf7')]+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02['dialCongestionRetryFrequency'],_0xd518('0x105'))[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x4ea2e4['ContactId'],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4[_0xd518('0xdd')]||undefined,'CampaignId':_0x4ea2e4['CampaignId']||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x1b4')));break;case 0x0:if(_0x4ea2e4[_0xd518('0xf9')]>=_0x2c5c02['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xd518('0xc7')]({'active':![],'countnosuchnumberretry':_0x4ea2e4[_0xd518('0xf9')]+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02[_0xd518('0x1b5')],_0xd518('0x105'))[_0xd518('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4ea2e4[_0xd518('0xda')],'ListId':_0x4ea2e4['ListId'],'VoiceQueueId':_0x4ea2e4[_0xd518('0xdd')]||undefined,'CampaignId':_0x4ea2e4['CampaignId']||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x1b6')));}break;case 0xa:if(_0x4ea2e4['countdropretry']>=_0x2c5c02[_0xd518('0x124')]-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countdropretry':_0x4ea2e4[_0xd518('0xfa')]+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02[_0xd518('0x120')],'minutes')['format'](_0xd518('0x10a')),'ContactId':_0x4ea2e4['ContactId'],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4[_0xd518('0xdd')]||undefined,'CampaignId':_0x4ea2e4[_0xd518('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x4ea2e4[_0xd518('0xfb')]>=_0x2c5c02[_0xd518('0x1b7')]-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countabandonedretry':_0x4ea2e4[_0xd518('0xfb')]+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02[_0xd518('0x12c')],_0xd518('0x105'))[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x4ea2e4[_0xd518('0xda')],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4[_0xd518('0xdd')]||undefined,'CampaignId':_0x4ea2e4[_0xd518('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x4ea2e4[_0xd518('0xfc')]>=_0x2c5c02[_0xd518('0x101')]-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countmachineretry':_0x4ea2e4[_0xd518('0xfc')]+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02[_0xd518('0x104')],_0xd518('0x105'))[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x4ea2e4[_0xd518('0xda')],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4[_0xd518('0xdd')]||undefined,'CampaignId':_0x4ea2e4[_0xd518('0xde')]||undefined})['catch'](loggerCatch(_0xd518('0x106')));break;case 0x14:if(_0x4ea2e4[_0xd518('0xfd')]>=_0x2c5c02[_0xd518('0x1b8')]-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countagentrejectretry':_0x4ea2e4[_0xd518('0xfd')]+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02[_0xd518('0x1b9')],_0xd518('0x105'))[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x4ea2e4[_0xd518('0xda')],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4['VoiceQueueId']||undefined,'CampaignId':_0x4ea2e4['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xd518('0x1b')]['callProgressDetecting']=function(_0x3bce07,_0x5c1cb6,_0x17727d){var _0x471964=this;var _0x55cdcd=new History(_0x3bce07);var _0xa57e6b=![];var _0x4ff934;var _0x102733;return new Promise(function(_0x575d1b,_0x42f081){if(_[_0xd518('0x45')](_0x5c1cb6)&&typeof _0x5c1cb6!==_0xd518('0x17d')){return _0x42f081(msgResponse('[callProgressDetecting]','Failure','entity\x20is\x20undefine'));}if(_[_0xd518('0x45')](_0x17727d)&&typeof _0x17727d!==_0xd518('0x17d')){return _0x42f081(msgResponse(_0xd518('0x1ba'),_0xd518('0x14e'),_0xd518('0x1bb')));}_0x471964[_0xd518('0xbf')](_0x55cdcd,_0x17727d['reason'],_0x5c1cb6)[_0xd518('0x43')](function(_0x3f807f){if(_0x3f807f[_0xd518('0x123')]==0x1)_0xa57e6b=!![];switch(_0x17727d['reason']){case'0':_0x5c1cb6[_0xd518('0x6f')]+=0x1;_0x55cdcd[_0xd518('0xad')]=0x0;_0x55cdcd[_0xd518('0xae')]=_0xd518('0x1bc');_0x55cdcd[_0xd518('0xf9')]+=0x1;_0x55cdcd[_0xd518('0xf4')]+=0x1;ami['emit'](_0xd518('0x1bd'),ut[_0xd518('0xec')](_0x3bce07,_0xd518('0x1be')));_0x4ff934=_0x5c1cb6[_0xd518('0x1b5')];_0x102733=_0x5c1cb6[_0xd518('0x121')];_0x471964[_0xd518('0xd3')](_0x55cdcd)[_0xd518('0xbb')](loggerCatch(_0xd518('0xf5')));if(_0x471964[_0xd518('0x1ae')](0x0,_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd['countnosuchnumberretry']>=_0x5c1cb6[_0xd518('0x1bf')]){_0x471964[_0xd518('0x102')](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1c0'));}else{_0x471964[_0xd518('0xff')](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1c0'));}}break;case'3':_0x5c1cb6[_0xd518('0x6e')]+=0x1;_0x55cdcd[_0xd518('0xad')]=0x3;_0x55cdcd[_0xd518('0xae')]=_0xd518('0x1c1');_0x55cdcd[_0xd518('0xf8')]+=0x1;_0x55cdcd['countglobal']+=0x1;var _0x3c68ca=ut[_0xd518('0x1c2')](_0x3bce07,_0x5c1cb6);ami[_0xd518('0xea')]('custom:agentnoanswer',_0x3c68ca);_0x4ff934=_0x5c1cb6['dialNoAnswerRetryFrequency'];_0x102733=_0x5c1cb6[_0xd518('0x121')];_0x471964[_0xd518('0xd3')](_0x55cdcd)[_0xd518('0xbb')](loggerCatch(_0xd518('0x1c3')));if(_0x471964[_0xd518('0x1ae')](0x3,_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd['countnoanswerretry']>=_0x5c1cb6['dialNoAnswerMaxRetry']){_0x471964[_0xd518('0x102')](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1c4'));}else{_0x471964[_0xd518('0xff')](_0x55cdcd,_0x575d1b,_0x42f081,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x5c1cb6['outboundBusyCallsDay']+=0x1;_0x55cdcd['state']=0x5;_0x55cdcd[_0xd518('0xae')]=_0xd518('0x1c5');_0x55cdcd[_0xd518('0xf6')]+=0x1;_0x55cdcd[_0xd518('0xf4')]+=0x1;ami[_0xd518('0xea')](_0xd518('0x1c6'),ut['buildObj'](_0x3bce07,_0xd518('0x1c7')));_0x4ff934=_0x5c1cb6[_0xd518('0x1b2')];_0x102733=_0x5c1cb6['callAdditionalPhoneAfterMin'];_0x471964['createHistory'](_0x55cdcd)[_0xd518('0xbb')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x471964[_0xd518('0x1ae')](0x5,_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd['countbusyretry']>=_0x5c1cb6[_0xd518('0x1b1')]){_0x471964[_0xd518('0x102')](_0x55cdcd,_0x575d1b,_0x42f081,'reason\x205\x20busy');}else{_0x471964[_0xd518('0xff')](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1c8'));}}break;case'8':_0x5c1cb6[_0xd518('0x6b')]+=0x1;_0x55cdcd[_0xd518('0xad')]=0x8;_0x55cdcd[_0xd518('0xae')]=_0xd518('0x1c9');_0x55cdcd[_0xd518('0xf7')]+=0x1;_0x55cdcd[_0xd518('0xf4')]+=0x1;_0x4ff934=_0x5c1cb6[_0xd518('0x1ca')];_0x102733=_0x5c1cb6['callAdditionalPhoneAfterMin'];ami[_0xd518('0xea')](_0xd518('0x1cb'),ut['buildObj'](_0x3bce07,_0xd518('0x1cc')));_0x471964[_0xd518('0xd3')](_0x55cdcd)[_0xd518('0xbb')](loggerCatch(_0xd518('0x1cd')));if(_0x471964[_0xd518('0x1ae')](0x8,_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd['countcongestionretry']>=_0x5c1cb6[_0xd518('0x1ce')]){_0x471964[_0xd518('0x102')](_0x55cdcd,_0x575d1b,_0x42f081,'reason\x208\x20congestion');}else{_0x471964[_0xd518('0xff')](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1cf'));}}break;case'11':_0x5c1cb6[_0xd518('0x1d0')]+=0x1;_0x55cdcd[_0xd518('0xad')]=0xb;_0x55cdcd['statedesc']='Abandoned';_0x55cdcd[_0xd518('0xfb')]+=0x1;_0x55cdcd[_0xd518('0xf4')]+=0x1;_0x4ff934=_0x5c1cb6[_0xd518('0x12c')];_0x102733=_0x5c1cb6[_0xd518('0x121')];_0x471964[_0xd518('0xd3')](_0x55cdcd)[_0xd518('0xbb')](loggerCatch(_0xd518('0x12e')));if(_0x471964[_0xd518('0x1ae')](0xb,_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd[_0xd518('0xfb')]>=_0x5c1cb6[_0xd518('0x1b7')]){_0x471964['createStateFinal'](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1d1'));}else{_0x471964['stateGlobal'](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1d1'));}}break;case'20':_0x5c1cb6[_0xd518('0x72')]+=0x1;_0x55cdcd[_0xd518('0xad')]=0x14;_0x55cdcd['statedesc']='AgentReject';_0x55cdcd[_0xd518('0xfd')]+=0x1;_0x55cdcd[_0xd518('0xf4')]+=0x1;_0x4ff934=_0x5c1cb6[_0xd518('0x1b9')];_0x102733=_0x5c1cb6[_0xd518('0x121')];ami[_0xd518('0xea')](_0xd518('0x1d2'),ut[_0xd518('0xec')](_0x3bce07,_0xd518('0x1d3')));_0x471964[_0xd518('0xd3')](_0x55cdcd)[_0xd518('0xbb')](loggerCatch(_0xd518('0x1d4')));if(_0x471964[_0xd518('0x1ae')](0x14,_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd[_0xd518('0xfd')]>=_0x5c1cb6['dialAgentRejectMaxRetry']){_0x471964[_0xd518('0x102')](_0x55cdcd,_0x575d1b,_0x42f081,'reason\x2020\x20agentreject');}else{_0x471964['stateGlobal'](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1d5'));}}break;default:_0x5c1cb6[_0xd518('0x73')]+=0x1;_0x55cdcd['state']=0xc;_0x55cdcd['statedesc']=_0x17727d['reason'];_0x4ff934=_0x5c1cb6[_0xd518('0x1b9')];_0x102733=_0x5c1cb6['callAdditionalPhoneAfterMin'];_0x471964[_0xd518('0xd3')](_0x55cdcd)[_0xd518('0xbb')](loggerCatch(_0xd518('0x1d6')));if(_0x471964[_0xd518('0x1ae')](_0x17727d[_0xd518('0x113')],_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd[_0xd518('0xf6')]+_0x55cdcd[_0xd518('0xf7')]+_0x55cdcd[_0xd518('0xf8')]+_0x55cdcd[_0xd518('0xf9')]+_0x55cdcd['countdropretry']+_0x55cdcd[_0xd518('0xfb')]+_0x55cdcd['countmachineretry']+_0x55cdcd[_0xd518('0xfd')]>=_0x5c1cb6['dialGlobalMaxRetry']){_0x471964[_0xd518('0xff')](_0x55cdcd,_0x575d1b,_0x42f081,_0x17727d[_0xd518('0x113')]);}else{_0x471964[_0xd518('0x102')](_0x55cdcd,_0x575d1b,_0x42f081,_0x17727d['reason']);}}}})[_0xd518('0x43')](function(){if(_0xa57e6b){_0x471964['swapAdditionalPhones'](_0x55cdcd,_0x4ff934,_0x102733)[_0xd518('0x43')](function(){return _0x575d1b(0x1);});}});});};Dialer[_0xd518('0x1b')][_0xd518('0xff')]=function(_0x39e04c,_0x34e96e,_0x4a34bf,_0x197bb8){var _0x493b82=new Final(_0x39e04c);_0x493b82['state']=0xf;_0x493b82[_0xd518('0xae')]='Global';this[_0xd518('0x102')](_0x493b82,_0x34e96e,_0x4a34bf,_0x197bb8);};Dialer[_0xd518('0x1b')][_0xd518('0x102')]=function(_0x18cf2d,_0x457559,_0x20a589,_0x3be752){this['moveContactManagedDialer'](_0x18cf2d)[_0xd518('0x43')](function(){return _0x457559(msgResponse(_0xd518('0x1ba'),_0xd518('0xe1'),_0x3be752));})[_0xd518('0xbb')](function(){return _0x20a589(msgResponse(_0xd518('0x1d7'),_0xd518('0x14e'),_0xd518('0x1d8')));});};Dialer['prototype'][_0xd518('0xa')]=function(_0x3069f3){var _0x18d79a=_0x3069f3['dialPredictiveOptimizationPercentage']/0x64;var _0x44eb81=_0x3069f3[_0xd518('0x6d')]/(_0x3069f3['outboundDropCallsDayTimeout']+_0x3069f3[_0xd518('0x69')]);var _0x2728fd=Math[_0xd518('0x1d9')](_0x3069f3[_0xd518('0x7b')]*(_0x3069f3['predictiveIntervalMaxThreshold']/0x64));var _0x5b03b7=Math[_0xd518('0x1d9')](_0x3069f3[_0xd518('0x7b')]*(_0x3069f3['predictiveIntervalMinThreshold']/0x64));var _0x58bffa=_0x3069f3['available']+_0x3069f3['talking'];var _0x19d893=Math[_0xd518('0x1da')](_0x3069f3[_0xd518('0x92')]*_0x3069f3[_0xd518('0x95')]*_0x3069f3[_0xd518('0x79')]*_0x3069f3[_0xd518('0x1db')]);if(_['isUndefined'](_0x3069f3[_0xd518('0x2a')])){if(!_['isUndefined'](_0x3069f3[_0xd518('0x29')])){_0x3069f3[_0xd518('0x29')]=undefined;loggerPredictive[_0xd518('0x9e')](_0xd518('0x1dc'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xd518('0x45')](_0x3069f3['handlePredictive'])){loggerPredictive[_0xd518('0x9e')]('[startMethodPredictive][StartProgressive]',_0xd518('0x1dd'));clearInterval(_0x3069f3[_0xd518('0x9a')]);_0x3069f3[_0xd518('0x9a')]=undefined;}_0x3069f3[_0xd518('0x2a')]=moment()['format'](_0xd518('0x10a'));loggerPredictive['info'](_0x3069f3['name'],_0xd518('0x1de'),_0x3069f3['startProgressive']);this[_0xd518('0x161')](_0x3069f3,0x1);}else if(ifInterval(_0x3069f3[_0xd518('0x1df')],_0x3069f3[_0xd518('0x2a')])){this[_0xd518('0x161')](_0x3069f3,0x1);loggerPredictiveCalls[_0xd518('0x84')]('[startMethodPredictive][StartProgressive][Loop]',_0x3069f3[_0xd518('0x2a')],_0x3069f3['name']);_0x3069f3[_0xd518('0x92')]=0x0;_0x3069f3['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x18d79a<_0x44eb81&&_0x3069f3[_0xd518('0x1e0')]===_0xd518('0x1e1')){freeVariablesPredictive(_0x3069f3);loggerPredictive[_0xd518('0x84')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xd518('0x1e2'),_0x44eb81,_0xd518('0x2a'),_0x3069f3[_0xd518('0x47')]);}else if(_0x19d893<_0x3069f3[_0xd518('0x78')]&&_0x3069f3['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x3069f3);loggerPredictive[_0xd518('0x84')](_0xd518('0x1e3'),_0xd518('0x1e4'),_0x19d893,_0xd518('0x1e5'),_0x3069f3[_0xd518('0x78')],_0xd518('0x2a'),_0x3069f3[_0xd518('0x47')]);}else if(!ifInterval(_0x3069f3[_0xd518('0x1df')],_0x3069f3[_0xd518('0x2a')])&&_['isUndefined'](_0x3069f3[_0xd518('0x29')])&&!_[_0xd518('0x45')](_0x3069f3['startProgressive'])){_0x3069f3[_0xd518('0x29')]=moment()['format'](_0xd518('0x10a'));loggerPredictive['info'](_0x3069f3[_0xd518('0x47')],'started\x20in\x20predictive\x20at',_0x3069f3[_0xd518('0x29')]);this[_0xd518('0xc4')](_0x3069f3[_0xd518('0x1df')])[_0xd518('0x43')](this[_0xd518('0x1e6')](_0x3069f3))['then'](mergeDataErlangB(_0x3069f3))[_0xd518('0x43')](this[_0xd518('0x1e7')](_0x3069f3))[_0xd518('0xbb')](loggerCatchPredictive(_0xd518('0x1e8'),_0x3069f3));}else if(!ifInterval(_0x3069f3[_0xd518('0x1df')],_0x3069f3[_0xd518('0x29')])){_0x3069f3[_0xd518('0x78')]=0x0;_0x3069f3[_0xd518('0x29')]=moment()[_0xd518('0x81')](_0xd518('0x10a'));loggerPredictive[_0xd518('0x84')](_0x3069f3[_0xd518('0x47')],_0xd518('0x1e9'),_0x3069f3[_0xd518('0x29')]);clearInterval(_0x3069f3[_0xd518('0x9a')]);_0x3069f3[_0xd518('0x9a')]=undefined;this[_0xd518('0xc4')](_0x3069f3[_0xd518('0x1df')])[_0xd518('0x43')](this['getDataPredictive'](_0x3069f3))[_0xd518('0x43')](mergeDataErlangB(_0x3069f3))[_0xd518('0x43')](this[_0xd518('0x1e7')](_0x3069f3))['catch'](loggerCatchPredictive(_0xd518('0x1ea'),_0x3069f3));}else if(_0x3069f3[_0xd518('0x7b')]&&_0x58bffa<_0x3069f3[_0xd518('0x7b')]-_0x5b03b7){freeVariablesPredictive(_0x3069f3);loggerPredictive[_0xd518('0x84')](_0x3069f3['name'],_0xd518('0x1eb'),_0x58bffa,_0xd518('0x1ec'),_0x3069f3[_0xd518('0x7b')],'-',_0x5b03b7,'=',_0x3069f3[_0xd518('0x7b')]-_0x5b03b7,')');}else if(_0x3069f3[_0xd518('0x7b')]&&_0x58bffa>_0x3069f3[_0xd518('0x7b')]+_0x2728fd){freeVariablesPredictive(_0x3069f3);loggerPredictive[_0xd518('0x84')](_0x3069f3[_0xd518('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x58bffa,_0xd518('0x1ed'),_0x3069f3[_0xd518('0x7b')],'+',_0x2728fd,'=',_0x3069f3[_0xd518('0x7b')]+_0x2728fd,')');}};Dialer[_0xd518('0x1b')][_0xd518('0x1e6')]=function(_0x13b330){var _0x174529=this;return function(_0x1f8e62){return new Promise(function(_0xb803c6,_0x289616){_[_0xd518('0x98')](_0x13b330,_0x1f8e62[0x0]);if(checkGetDataPredictive(_0x1f8e62[0x0])){var _0xa828e9=_0x13b330[_0xd518('0x7b')]=_0x13b330[_0xd518('0x5f')]+_0x13b330[_0xd518('0x59')];var _0x306195=_0x13b330[_0xd518('0x1df')]*0x3c;var _0x33ffe6=_0x1f8e62[0x0][_0xd518('0x76')]+_0x1f8e62[0x0][_0xd518('0x75')];var _0x317aac=(_0x1f8e62[0x0][_0xd518('0x74')]+_0x1f8e62[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1f8e62[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1f8e62[0x0][_0xd518('0x87')];_0x13b330[_0xd518('0x79')]=_0x317aac>0x0?_0x317aac:0x1;switch(_0x13b330[_0xd518('0x1e0')]){case _0xd518('0x1e1'):var _0x46a92a=_0x13b330[_0xd518('0x1ee')]/0x64;return _0x174529[_0xd518('0x1ef')](_0xa828e9,_0x306195,_0x33ffe6,_0x317aac,_0x46a92a)[_0xd518('0x43')](function(_0x498eae){return _0xb803c6(_0x498eae);});case _0xd518('0x1f0'):var _0x4fd29e=_0x13b330[_0xd518('0x1ee')]/0x64;return _0x174529[_0xd518('0x1f1')](_0xa828e9,_0x306195,_0x33ffe6,_0x317aac,_0x4fd29e)[_0xd518('0x43')](function(_0x18aca8){return _0xb803c6(_0x18aca8);});default:return _0x289616(msgResponse(_0xd518('0x1f2'),_0xd518('0x14e'),_0xd518('0x1f3')));}}else{return _0x289616(msgResponse(_0xd518('0x1f2'),_0xd518('0x14e'),_0xd518('0x1f4')));}});};};Dialer[_0xd518('0x1b')][_0xd518('0x1f5')]=function(_0x25f2a6){var _0x1e0789=this;return function(_0x46d6d0){return new Promise(function(_0x146f8b,_0x2fe5f1){_[_0xd518('0x98')](_0x25f2a6,_0x46d6d0[0x0]);if(checkGetDataPredictive(_0x46d6d0[0x0])){loggerPredictive[_0xd518('0x84')](JSON[_0xd518('0x52')](_0x46d6d0[0x0]));if(_0x25f2a6[_0xd518('0x1e0')]===_0xd518('0x1e1')){return _0x1e0789['getVoiceQueueRtPauses'](_0x25f2a6['id'])['then'](function(_0x376e2a){var _0x2e12f8=_0x25f2a6[_0xd518('0x5a')]-_0x376e2a[0x0][_0xd518('0x1f6')];var _0x373ea2=_0x25f2a6[_0xd518('0x1df')]*0x3c;var _0x3b6c8f=_0x46d6d0[0x0]['predictiveIntervalAvgTalktime']+_0x46d6d0[0x0]['predictiveIntervalAvgHoldtime'];var _0x211ea0=(_0x46d6d0[0x0][_0xd518('0x74')]+_0x46d6d0[0x0][_0xd518('0x77')]+_0x46d6d0[0x0][_0xd518('0x8b')])/_0x46d6d0[0x0][_0xd518('0x87')];var _0x1c1592=_0x25f2a6[_0xd518('0x1ee')]/0x64;_0x25f2a6[_0xd518('0x7a')]=_0x376e2a[0x0][_0xd518('0x1f6')]||0x0;_0x25f2a6[_0xd518('0x79')]=_0x211ea0>0x0?_0x211ea0:0x1;return _0x1e0789[_0xd518('0x1ef')](_0x2e12f8,_0x373ea2,_0x3b6c8f,_0x211ea0,_0x1c1592);})['then'](function(_0x21a1da){return _0x146f8b(_0x21a1da);})[_0xd518('0xbb')](function(_0xbb1092){return _0x2fe5f1(msgResponse('[CatchErlangB]',_0xd518('0x14e'),JSON[_0xd518('0x52')](_0xbb1092)));});}if(_0x25f2a6[_0xd518('0x1e0')]===_0xd518('0x1f0')){return _0x1e0789['getVoiceQueueRtPauses'](_0x25f2a6['id'])[_0xd518('0x43')](function(_0x5329b7){var _0x36f044=_0x25f2a6[_0xd518('0x5a')]-_0x5329b7[0x0][_0xd518('0x1f6')];var _0x4cf8db=_0x25f2a6['dialPredictiveInterval']*0x3c;var _0x2ce243=_0x46d6d0[0x0][_0xd518('0x76')]+_0x46d6d0[0x0][_0xd518('0x75')];var _0x4f971d=(_0x46d6d0[0x0][_0xd518('0x74')]+_0x46d6d0[0x0][_0xd518('0x77')]+_0x46d6d0[0x0][_0xd518('0x8b')])/_0x46d6d0[0x0][_0xd518('0x87')];var _0x45204f=_0x25f2a6['dialPredictiveOptimizationPercentage']/0x64;_0x25f2a6[_0xd518('0x7a')]=_0x5329b7[0x0][_0xd518('0x1f6')]||0x0;_0x25f2a6[_0xd518('0x79')]=_0x4f971d>0x0?_0x4f971d:0x1;return _0x1e0789['busyFactor'](_0x36f044,_0x4cf8db,_0x2ce243,_0x4f971d,_0x45204f);})[_0xd518('0x43')](function(_0x4003d2){return _0x146f8b(_0x4003d2);})[_0xd518('0xbb')](function(_0x3be1fa){return _0x2fe5f1(msgResponse(_0xd518('0x1f7'),_0xd518('0x14e'),JSON[_0xd518('0x52')](_0x3be1fa)));});}}else{return _0x2fe5f1(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0xd518('0x1b')][_0xd518('0x1e7')]=function(_0x30958a){var _0x243ed4=this;return function(){var _0x298ae6=0x0;var _0x2e1a26=Math[_0xd518('0x1da')](_0x30958a[_0xd518('0x1f8')]*0x3e8);if(_0x2e1a26>0x0){_0x2e1a26=_0x2e1a26<0x64?0x64:_0x2e1a26;loggerPredictive[_0xd518('0x84')](_0x30958a[_0xd518('0x47')],_0xd518('0x1f9'),_0x2e1a26,'milliseconds');_0x30958a[_0xd518('0x9a')]=setInterval(function(){_0x243ed4['handlePredictive'](_0x30958a);loggerPredictiveCalls['info'](_0xd518('0x1fa'),_0x298ae6+=0x1);},_0x2e1a26);}else{loggerPredictive[_0xd518('0x84')](_0x30958a[_0xd518('0x47')],_0xd518('0x1fb'));}};};Dialer[_0xd518('0x1b')][_0xd518('0x1fc')]=function(_0x29b607,_0x2c891a){var _0x300e48=this;return function(_0x2f98c2){if(_[_0xd518('0x4e')](_0x2f98c2)){if(_[_0xd518('0xb3')](_0x2c891a[_0xd518('0xdc')])||!_0x2c891a[_0xd518('0x1fd')]){if(_0x29b607[_0xd518('0x65')]===_0xd518('0x9')){_0x29b607[_0xd518('0x138')]=_[_0xd518('0x45')](_0x29b607[_0xd518('0x138')])?!![]:_0x29b607[_0xd518('0x138')];var _0x31a86e=uuid['v4']();_0x300e48[_0xd518('0x12f')][_0x31a86e]=new Action(_0x29b607,_0x2c891a,_0x31a86e);loggerBooked['info']('[booked][checkContactBlack]',_0x31a86e,'queueStatusComplete:\x20',JSON[_0xd518('0x52')](_0x29b607[_0xd518('0x138')]),_0xd518('0x1fe'),_0x29b607[_0xd518('0x47')]);if(_0x29b607[_0xd518('0x138')]){_0x29b607[_0xd518('0x138')]=![];_0x300e48['queueBooked'][_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xb7')]]=[];ami[_0xd518('0x153')]({'actionid':_0x31a86e,'action':'queuestatus','queue':_0x29b607[_0xd518('0x47')]})[_0xd518('0xbb')](function(){_0x300e48[_0xd518('0xb6')](_0x29b607);_0x300e48[_0xd518('0xc7')]({'active':![],'ContactId':_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xda')],'ListId':_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xdb')],'VoiceQueueId':_0x300e48['actions'][_0x31a86e][_0xd518('0xdd')]||undefined,'CampaignId':_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xde')]||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x1ff')));delete _0x300e48[_0xd518('0x12f')][_0x31a86e];});}else{loggerBooked[_0xd518('0x84')](_0xd518('0x200'),JSON[_0xd518('0x52')](_0x29b607[_0xd518('0x138')]),_0xd518('0x1fe'),_0x29b607[_0xd518('0x47')]);_0x300e48[_0xd518('0xb6')](_0x29b607);_0x300e48[_0xd518('0xc7')]({'active':![],'ContactId':_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xda')],'ListId':_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xdb')],'VoiceQueueId':_0x300e48['actions'][_0x31a86e][_0xd518('0xdd')]||undefined,'CampaignId':_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xde')]||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x1ff')));delete _0x300e48[_0xd518('0x12f')][_0x31a86e];}}else{return _0x300e48[_0xd518('0x17c')](_0x29b607,_0x2c891a);}}else{if(getDiff(_0x2c891a[_0xd518('0x201')])<_0x29b607[_0xd518('0x202')]*0x3c){if(_0x2c891a[_0xd518('0x167')]&&!_0x2c891a[_0xd518('0x167')][_0xd518('0x203')]){_0x300e48['preview'][_0xd518('0x13b')](_0x2c891a['id'])[_0xd518('0x1e')](function(){_0x300e48[_0xd518('0xb6')](_0x29b607);});}else{_0x300e48[_0xd518('0xc9')]({'active':![]},_0x2c891a['id'],0x1)['finally'](function(){_0x300e48[_0xd518('0xb6')](_0x29b607);});}}else{_0x29b607[_0xd518('0x71')]+=0x1;_0x300e48['updateOriginated'](_0x29b607);if(_0x29b607['dialRecallInQueue']){_0x300e48[_0xd518('0xc7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2c891a[_0xd518('0xda')],'ListId':_0x2c891a[_0xd518('0xdb')],'VoiceQueueId':_0x2c891a[_0xd518('0xdd')]||undefined,'CampaignId':_0x2c891a[_0xd518('0xde')]||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x204')));_0x300e48[_0xd518('0xd3')](createObjHistory(_0x29b607,_0x2c891a,_0xd518('0x205'),0x17,_0xd518('0x206')))[_0xd518('0xbb')](loggerCatch(_0xd518('0x207')));}else{_0x300e48['saveInDb'](createObjHistory(_0x29b607,_0x2c891a,'RECALLFAILEDTIMEOUT',0x16,_0xd518('0x208')),'[Originate][HistoryRecallClose][historyCatch]',_0xd518('0x209'));}}}}else{_0x29b607['outboundBlacklistCallsDay']+=0x1;_0x300e48[_0xd518('0xd9')](createObjHistory(_0x29b607,_0x2c891a,'BLACKLIST',0xd,'Blacklist'),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0xd518('0x1b')][_0xd518('0x169')]=function(_0x912b75){var _0x260272=this;var _0xf3c657=_0x912b75[_0xd518('0x20a')]-_0x912b75[_0xd518('0x7c')]-_0x912b75[_0xd518('0xcc')];emitCampaignSummary(_0x912b75);if(_0xf3c657>0x0){if(_0xf3c657>this[_0xd518('0x25')]){_0xf3c657=this[_0xd518('0x25')];}_0x912b75[_0xd518('0xcc')]+=_0xf3c657;this[_0xd518('0xce')](_0x912b75['id'],_0xf3c657,_0x912b75[_0xd518('0x20b')],_0x912b75)[_0xd518('0x43')](function(_0x1b8e5f){_0x912b75[_0xd518('0xcc')]-=_0xf3c657;_0x912b75[_0xd518('0xcc')]=_0x912b75[_0xd518('0xcc')]>0x0?_0x912b75[_0xd518('0xcc')]:0x0;if(!checkContactEmpty(_0x1b8e5f)){_0x912b75['message']=_0xd518('0x20c');logger[_0xd518('0x84')](_0xd518('0x20d')+_0x912b75[_0xd518('0x47')]);}else{_0x912b75[_0xd518('0x7c')]+=_0x1b8e5f[_0xd518('0x152')];_0x912b75[_0xd518('0x46')]=_0xd518('0x20e');for(var _0x17e624=0x0;_0x17e624<_0x1b8e5f[_0xd518('0x152')];_0x17e624+=0x1){_0x912b75[_0xd518('0x20f')]+=0x1;if(_['isNil'](_0x1b8e5f[_0x17e624])||_[_0xd518('0xb3')](_0x1b8e5f[_0x17e624][_0xd518('0x195')])||_[_0xd518('0xb3')](_0x1b8e5f[_0x17e624][_0xd518('0x17f')])){_0x260272['emptyContact']('[actionOriginate]\x20',_0x912b75,_0x1b8e5f[_0x17e624]);}else{_0x260272['checkIsBlackListIvr'](_['pick'](_0x1b8e5f[_0x17e624],[_0xd518('0xde'),_0xd518('0x17f')]))['then'](_0x260272[_0xd518('0x1fc')](_0x912b75,_0x1b8e5f[_0x17e624]))[_0xd518('0xbb')](_0x260272[_0xd518('0xd8')](_0xd518('0x210'),_0x912b75));}}}})[_0xd518('0xbb')](loggerGetContactDialer(_0xd518('0x211'),_0x912b75,_0xf3c657));}};Dialer[_0xd518('0x1b')]['handlePower']=function(_0xe310a9,_0x33906f){var _0x1fbf7f=this;var _0x1e29e1=[];var _0x175551=_0x33906f>=0x1?_0x33906f:0x1;if(_0xe310a9[_0xd518('0x65')]===_0xd518('0x9')){_0x175551=0x1;}var _0x40af7e=Math[_0xd518('0x1da')](_0xe310a9['available']*_0x175551)-_0xe310a9[_0xd518('0x7c')]-_0xe310a9['temp'];emitVoiceQueueSummary(_0xe310a9);if(_0xe310a9[_0xd518('0x212')]>0x0){var _0x34292f=_0xe310a9[_0xd518('0x212')]-_0xe310a9['originated']-_0xe310a9['talking']-_0xe310a9['temp']-_0xe310a9[_0xd518('0x5b')];if(_0x40af7e>_0x34292f){_0x40af7e=_0x34292f;}}if(_0x40af7e>0x0){if(_0xe310a9[_0xd518('0x65')]==='booked'){_0x40af7e=0x1;}if(_0x40af7e>this['maxNumberOriginate']){_0x40af7e=this[_0xd518('0x25')];}_0xe310a9[_0xd518('0xcc')]+=_0x40af7e;for(var _0x4e1292 in this['agents']){if(typeof this[_0xd518('0x23')][_0x4e1292]!==_0xd518('0xd5')){if(this['agents'][_0x4e1292]['state']==='not_inuse'&&this[_0xd518('0x23')][_0x4e1292]['status']==='reachable'){_0x1e29e1[_0xd518('0x134')](this[_0xd518('0x23')][_0x4e1292]['id']);}}}this[_0xd518('0xcb')](_0xe310a9['id'],_0x1e29e1,_0x40af7e,_0xe310a9['dialOrderByScheduledAt'],_0xe310a9)[_0xd518('0x43')](function(_0xee294){_0xe310a9['temp']-=_0x40af7e;_0xe310a9['temp']=_0xe310a9[_0xd518('0xcc')]>0x0?_0xe310a9[_0xd518('0xcc')]:0x0;if(!checkContactEmpty(_0xee294)){_0x1fbf7f[_0xd518('0xba')](_0xe310a9)['then'](sendMessageReschedule(_0xe310a9))[_0xd518('0xbb')](loggerCatch(_0xd518('0xbc')));}else{_0xe310a9[_0xd518('0x7c')]+=_0xee294[_0xd518('0x152')];_0xe310a9[_0xd518('0x46')]=_0xe310a9[_0xd518('0x65')]===_0xd518('0x9')?_0xd518('0x186'):'RUNNING';for(var _0x552a4c=0x0;_0x552a4c<_0xee294[_0xd518('0x152')];_0x552a4c+=0x1){if(_[_0xd518('0xb3')](_0xee294[_0x552a4c])||_['isNil'](_0xee294[_0x552a4c][_0xd518('0x195')])||_['isNil'](_0xee294[_0x552a4c]['phone'])){_0x1fbf7f[_0xd518('0x213')](_0xd518('0x214'),_0xe310a9,_0xee294[_0x552a4c]);}else{_0x1fbf7f['checkIsBlackList'](_[_0xd518('0x135')](_0xee294[_0x552a4c],[_0xd518('0xdd'),_0xd518('0x17f')]))['then'](_0x1fbf7f[_0xd518('0x1fc')](_0xe310a9,_0xee294[_0x552a4c]))[_0xd518('0xbb')](_0x1fbf7f[_0xd518('0xd8')]('[actionOriginate]\x20',_0xe310a9));}}}})[_0xd518('0xbb')](loggerGetContactDialer(_0xd518('0x215'),_0xe310a9,_0x40af7e));}};Dialer[_0xd518('0x1b')]['handlePredictive']=function(_0x47b795){if(_0x47b795[_0xd518('0x212')]>0x0){var _0x32acbb=_0x47b795['dialLimitQueue']-_0x47b795[_0xd518('0x7c')]-_0x47b795[_0xd518('0x5f')];if(_0x32acbb>0x0){this[_0xd518('0x216')](_0x47b795);}else{loggerPredictiveCalls[_0xd518('0x84')](_0xd518('0x217'));}}else{this[_0xd518('0x216')](_0x47b795);}};Dialer['prototype'][_0xd518('0x216')]=function(_0x45d1a4){var _0x1cecb2=this;var _0x160ea8=[];_0x45d1a4[_0xd518('0x7c')]+=0x1;for(var _0x1fb13e in this[_0xd518('0x23')]){if(typeof this[_0xd518('0x23')][_0x1fb13e]!==_0xd518('0xd5')){if(this[_0xd518('0x23')][_0x1fb13e][_0xd518('0xad')]===_0xd518('0x218')&&this[_0xd518('0x23')][_0x1fb13e][_0xd518('0xb4')]===_0xd518('0xe3')){_0x160ea8['push'](this[_0xd518('0x23')][_0x1fb13e]['id']);}}}this[_0xd518('0xcb')](_0x45d1a4['id'],_0x160ea8,0x1,_0x45d1a4[_0xd518('0x20b')],_0x45d1a4)[_0xd518('0x43')](function(_0x13dc3a){if(!checkContactEmpty(_0x13dc3a)){checkContactLowerLimitOriginate(_0x45d1a4,0x1,0x0);_0x1cecb2[_0xd518('0xba')](_0x45d1a4)[_0xd518('0x43')](sendMessageReschedule(_0x45d1a4))[_0xd518('0xbb')](loggerCatch(_0xd518('0xbc')));}else{_0x45d1a4[_0xd518('0x46')]=_0xd518('0x20e');if(_['isNil'](_0x13dc3a[0x0])||_['isNil'](_0x13dc3a[0x0]['Contact'])||_['isNil'](_0x13dc3a[0x0]['phone'])){_0x1cecb2[_0xd518('0x213')](_0xd518('0x214'),_0x45d1a4,_0x13dc3a[0x0]);}else{_0x1cecb2[_0xd518('0xbd')](_[_0xd518('0x135')](_0x13dc3a[0x0],['VoiceQueueId',_0xd518('0x17f')]))[_0xd518('0x43')](_0x1cecb2[_0xd518('0x1fc')](_0x45d1a4,_0x13dc3a[0x0]))[_0xd518('0xbb')](_0x1cecb2[_0xd518('0xd8')](_0xd518('0x219'),_0x45d1a4));}}})['catch'](loggerGetContactDialer(_0xd518('0x21a'),_0x45d1a4,0x1));emitVoiceQueueSummary(_0x45d1a4);};Dialer[_0xd518('0x1b')][_0xd518('0x1ef')]=function(_0x53a415,_0x4a26b7,_0x33967a,_0x5bb709,_0x406492,_0x3bf9c4){loggerPredictive[_0xd518('0x84')](_0xd518('0x21b'));loggerPredictive[_0xd518('0x84')](_0xd518('0x21c'),_0x53a415);loggerPredictive['info'](_0xd518('0x21d'),_0x4a26b7);loggerPredictive[_0xd518('0x84')](_0xd518('0x21e'),_0x33967a);loggerPredictive[_0xd518('0x84')](_0xd518('0x21f'),_0x5bb709);loggerPredictive['info'](_0xd518('0x220'),_0x406492);loggerPredictive[_0xd518('0x84')](_0xd518('0x97'));return new Promise(function(_0xd65c13,_0x542951){if(_0x53a415<=0x0||isNaN(_0x53a415)){return _0x542951(msgResponse('[abandonmentRate]',_0xd518('0x51'),_0xd518('0x221')+_0x53a415));}if(_0x33967a<=0x0||isNaN(_0x33967a)){return _0x542951(msgResponse(_0xd518('0x222'),'Error','Ts\x20=\x20'+_0x33967a));}if(_0x5bb709<=0x0||isNaN(_0x5bb709)){return _0x542951(msgResponse(_0xd518('0x222'),_0xd518('0x51'),_0xd518('0x223')+_0x5bb709));}if(_0x4a26b7<=0x0||isNaN(_0x4a26b7)){return _0x542951(msgResponse(_0xd518('0x222'),'Error',_0xd518('0x224')+_0x4a26b7));}if(_0x406492<=0x0||isNaN(_0x406492)){return _0x542951(msgResponse(_0xd518('0x222'),_0xd518('0x51'),_0xd518('0x225')+_0x406492));}_0x3bf9c4=_0x3bf9c4||0x0;var _0xc37a45=0x1/_0x33967a;var _0x2242e8=0x0;var _0x4e0cdd=0x0;var _0xe63342=0x0;var _0x49aa98=0x0;for(var _0x5173c0=0x0;_0xe63342<_0x406492;_0x5173c0+=0x1){_0x4e0cdd=_0x5173c0/_0x4a26b7;_0x2242e8=(_0x5bb709*_0x4e0cdd+_0x3bf9c4)/_0xc37a45;_0xe63342=erlangb(_0x2242e8,_0x53a415);_0x49aa98=_0x2242e8/_0x53a415*(0x1-erlangb(_0x2242e8,_0x53a415));}return _0xd65c13({'erlangCalls':_0x5173c0,'erlangCallToSecond':_0x4a26b7/_0x5173c0,'erlangAbandonmentRate':_0xe63342,'erlangBusyFactor':_0x49aa98});});};Dialer[_0xd518('0x1b')][_0xd518('0x1f1')]=function(_0x30f4b3,_0x497085,_0x426587,_0x3e264b,_0x102af2,_0x14a5d2){loggerPredictive[_0xd518('0x84')](_0xd518('0x226'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30f4b3);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x497085);loggerPredictive[_0xd518('0x84')](_0xd518('0x21e'),_0x426587);loggerPredictive[_0xd518('0x84')](_0xd518('0x21f'),_0x3e264b);loggerPredictive[_0xd518('0x84')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x102af2);loggerPredictive[_0xd518('0x84')](_0xd518('0x97'));return new Promise(function(_0x1c5c0a,_0x18ad85){if(_0x30f4b3<=0x0||isNaN(_0x30f4b3)){return _0x18ad85(msgResponse('[busyFactor]',_0xd518('0x51'),_0xd518('0x221')+_0x30f4b3));}if(_0x426587<=0x0||isNaN(_0x426587)){return _0x18ad85(msgResponse('[busyFactor]',_0xd518('0x51'),_0xd518('0x227')+_0x426587));}if(_0x3e264b<=0x0||isNaN(_0x3e264b)){return _0x18ad85(msgResponse(_0xd518('0x228'),_0xd518('0x51'),_0xd518('0x223')+_0x3e264b));}if(_0x497085<=0x0||isNaN(_0x497085)){return _0x18ad85(msgResponse(_0xd518('0x228'),_0xd518('0x51'),_0xd518('0x224')+_0x497085));}if(_0x102af2<=0x0||isNaN(_0x102af2)){return _0x18ad85(msgResponse(_0xd518('0x228'),_0xd518('0x51'),_0xd518('0x229')+_0x102af2));}_0x14a5d2=_0x14a5d2||0x0;var _0x2c51ee=0x1/_0x426587;var _0x5461cc=0x0;var _0x14f3a2=0x0;var _0x36ddde=0x0;var _0x446ef9=0x0;for(var _0x3e9b41=0x0;_0x446ef9<_0x102af2;_0x3e9b41+=0x1){_0x14f3a2=_0x3e9b41/_0x497085;_0x5461cc=(_0x3e264b*_0x14f3a2+_0x14a5d2)/_0x2c51ee;_0x36ddde=erlangb(_0x5461cc,_0x30f4b3);_0x446ef9=_0x5461cc/_0x30f4b3*(0x1-erlangb(_0x5461cc,_0x30f4b3));}return _0x1c5c0a({'erlangCalls':_0x3e9b41,'erlangCallToSecond':_0x497085/_0x3e9b41,'erlangAbandonmentRate':_0x36ddde,'erlangBusyFactor':_0x446ef9});});};module[_0xd518('0x22a')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 23633cf..e085f0a 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4629=['scheduledat','campaigntype','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds'];(function(_0x44ac95,_0x41f1fb){var _0x5c8401=function(_0x15fceb){while(--_0x15fceb){_0x44ac95['push'](_0x44ac95['shift']());}};_0x5c8401(++_0x41f1fb);}(_0x4629,0x136));var _0x9462=function(_0x542288,_0x52559e){_0x542288=_0x542288-0x0;var _0x157624=_0x4629[_0x542288];return _0x157624;};'use strict';var util=require('util');var _=require(_0x9462('0x0'));var moment=require(_0x9462('0x1'));function getSeconds(_0x5a3d4a,_0x386ee4){var _0x34e7c2=moment(_0x5a3d4a)[_0x9462('0x2')](0x0);var _0x313ede=moment(_0x386ee4)[_0x9462('0x2')](0x0);return _0x34e7c2[_0x9462('0x3')](_0x313ede,_0x9462('0x4'));}function QueueCallerAbandon(_0xbc2300,_0x32bc87){this[_0x9462('0x5')]=_0xbc2300[_0x9462('0x5')];this['type']=_0xbc2300['type'];this[_0x9462('0x6')]=_0xbc2300['type']===_0x9462('0x7')?_0x9462('0x8'):_0xbc2300[_0x9462('0x9')];this[_0x9462('0xa')]=_0xbc2300['countbusyretry'];this[_0x9462('0xb')]=_0xbc2300[_0x9462('0xb')];this['countnoanswerretry']=_0xbc2300[_0x9462('0xc')];this[_0x9462('0xd')]=_0xbc2300[_0x9462('0xa')]+_0xbc2300[_0x9462('0xb')]+_0xbc2300['countnoanswerretry']+_0xbc2300[_0x9462('0xe')]+_0xbc2300[_0x9462('0xf')]+_0xbc2300[_0x9462('0x10')]+_0xbc2300[_0x9462('0x11')]+_0xbc2300[_0x9462('0x12')];this['countnosuchnumberretry']=_0xbc2300[_0x9462('0xe')];this[_0x9462('0xf')]=_0xbc2300[_0x9462('0xf')];this[_0x9462('0x10')]=_0xbc2300['countabandonedretry'];this['countmachineretry']=_0xbc2300['countmachineretry'];this['countagentrejectretry']=_0xbc2300[_0x9462('0x12')];this[_0x9462('0x13')]=_0x32bc87[_0x9462('0x13')];this[_0x9462('0x14')]=_0xbc2300[_0x9462('0x15')];this[_0x9462('0x16')]=_0xbc2300[_0x9462('0x17')];this[_0x9462('0x18')]=_0xbc2300[_0x9462('0x18')];this[_0x9462('0x19')]=_0xbc2300[_0x9462('0x19')];this[_0x9462('0x1a')]=_0xbc2300[_0x9462('0x1a')];this[_0x9462('0x1b')]=this[_0x9462('0x1a')];this[_0x9462('0x1c')]=getSeconds(_0xbc2300[_0x9462('0x19')],_0xbc2300[_0x9462('0x18')]);this[_0x9462('0x1d')]=getSeconds(this['droptime'],_0xbc2300[_0x9462('0x19')]);this[_0x9462('0x1e')]=0x0;this[_0x9462('0x8')]=_0x32bc87[_0x9462('0x8')];this[_0x9462('0x1f')]=_0x32bc87[_0x9462('0x20')];this[_0x9462('0x21')]=_0x32bc87[_0x9462('0x21')];this[_0x9462('0x22')]=_0xbc2300[_0x9462('0x22')];this[_0x9462('0x23')]=_0xbc2300[_0x9462('0x23')];this[_0x9462('0x24')]=_0xbc2300[_0x9462('0x24')];this[_0x9462('0x25')]=_0xbc2300[_0x9462('0x25')];this[_0x9462('0x26')]=_0xbc2300[_0x9462('0x26')];this['ListId']=_0xbc2300[_0x9462('0x27')];this[_0x9462('0x28')]=_0xbc2300[_0x9462('0x28')];this[_0x9462('0x29')]=_0xbc2300[_0x9462('0x29')];this[_0x9462('0x2a')]=_0xbc2300[_0x9462('0x2a')];this[_0x9462('0x2b')]=_0xbc2300[_0x9462('0x2b')]||'';this[_0x9462('0x2c')]=_0xbc2300['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xde06=['countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x851a81,_0xc3d770){var _0x34e35a=function(_0x1e303a){while(--_0x1e303a){_0x851a81['push'](_0x851a81['shift']());}};_0x34e35a(++_0xc3d770);}(_0xde06,0x113));var _0x6de0=function(_0x3244b0,_0xbfc103){_0x3244b0=_0x3244b0-0x0;var _0x1d8199=_0xde06[_0x3244b0];return _0x1d8199;};'use strict';var util=require(_0x6de0('0x0'));var _=require(_0x6de0('0x1'));var moment=require(_0x6de0('0x2'));function getSeconds(_0x26406b,_0x5ba682){var _0x28830d=moment(_0x26406b)[_0x6de0('0x3')](0x0);var _0x39bdd6=moment(_0x5ba682)['milliseconds'](0x0);return _0x28830d[_0x6de0('0x4')](_0x39bdd6,_0x6de0('0x5'));}function QueueCallerAbandon(_0x2db166,_0x2308b5){this[_0x6de0('0x6')]=_0x2db166[_0x6de0('0x6')];this[_0x6de0('0x7')]=_0x2db166[_0x6de0('0x7')];this[_0x6de0('0x8')]=_0x2db166[_0x6de0('0x7')]===_0x6de0('0x9')?_0x6de0('0xa'):_0x2db166[_0x6de0('0x7')];this[_0x6de0('0xb')]=_0x2db166[_0x6de0('0xb')];this[_0x6de0('0xc')]=_0x2db166[_0x6de0('0xc')];this[_0x6de0('0xd')]=_0x2db166[_0x6de0('0xd')];this[_0x6de0('0xe')]=_0x2db166[_0x6de0('0xb')]+_0x2db166['countcongestionretry']+_0x2db166[_0x6de0('0xd')]+_0x2db166[_0x6de0('0xf')]+_0x2db166[_0x6de0('0x10')]+_0x2db166[_0x6de0('0x11')]+_0x2db166['countmachineretry']+_0x2db166[_0x6de0('0x12')];this[_0x6de0('0xf')]=_0x2db166[_0x6de0('0xf')];this[_0x6de0('0x10')]=_0x2db166[_0x6de0('0x10')];this[_0x6de0('0x11')]=_0x2db166[_0x6de0('0x11')];this[_0x6de0('0x13')]=_0x2db166[_0x6de0('0x13')];this[_0x6de0('0x12')]=_0x2db166[_0x6de0('0x12')];this['uniqueid']=_0x2308b5[_0x6de0('0x14')];this[_0x6de0('0x15')]=_0x2db166[_0x6de0('0x16')];this[_0x6de0('0x17')]=_0x2db166['number'];this[_0x6de0('0x18')]=_0x2db166[_0x6de0('0x18')];this[_0x6de0('0x19')]=_0x2db166['responsetime'];this[_0x6de0('0x1a')]=_0x2db166[_0x6de0('0x1a')];this[_0x6de0('0x1b')]=this[_0x6de0('0x1a')];this['ringtime']=getSeconds(_0x2db166[_0x6de0('0x19')],_0x2db166[_0x6de0('0x18')]);this[_0x6de0('0x1c')]=getSeconds(this['droptime'],_0x2db166[_0x6de0('0x19')]);this['talktime']=0x0;this[_0x6de0('0xa')]=_0x2308b5['queue'];this[_0x6de0('0x1d')]=_0x2308b5['connectedlinename'];this[_0x6de0('0x1e')]=_0x2308b5[_0x6de0('0x1e')];this[_0x6de0('0x1f')]=_0x2db166['callback'];this[_0x6de0('0x20')]=_0x2db166[_0x6de0('0x20')];this[_0x6de0('0x21')]=_0x2db166[_0x6de0('0x21')];this[_0x6de0('0x22')]=_0x2db166[_0x6de0('0x22')];this[_0x6de0('0x23')]=_0x2db166[_0x6de0('0x23')];this[_0x6de0('0x24')]=_0x2db166[_0x6de0('0x24')];this['UserId']=_0x2db166['UserId'];this[_0x6de0('0x25')]=_0x2db166['VoiceQueueId'];this['CampaignId']=_0x2db166[_0x6de0('0x26')];this[_0x6de0('0x27')]=_0x2db166['originatecalleridnum']||'';this[_0x6de0('0x28')]=_0x2db166[_0x6de0('0x28')]||'';}module[_0x6de0('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 8985a90..6316362 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(_0x1f09fe,_0x1ffc3b){var _0x4ded1b=function(_0x155c05){while(--_0x155c05){_0x1f09fe['push'](_0x1f09fe['shift']());}};_0x4ded1b(++_0x1ffc3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x220966,_0x120477){var _0x18a244=function(_0x194479){while(--_0x194479){_0x220966['push'](_0x220966['shift']());}};_0x18a244(++_0x120477);}(_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 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 9c399d2..c578abd 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 _0x46f4=['variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','name','.pdf','application/pdf','then','notify','fax','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify','merge','response','reason','update','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','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','format','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channel','uniqueid','\x20syncNewchannel\x20','info'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x46f4,0x13a));var _0x446f=function(_0x4eb376,_0x256fc9){_0x4eb376=_0x4eb376-0x0;var _0x362d9f=_0x46f4[_0x4eb376];return _0x362d9f;};'use strict';var util=require(_0x446f('0x0'));var _=require(_0x446f('0x1'));var BPromise=require('bluebird');var uuid=require(_0x446f('0x2'));var moment=require(_0x446f('0x3'));var path=require('path');var tiff2pdf=require(_0x446f('0x4'));var gs=require(_0x446f('0x5'));var logger=require(_0x446f('0x6'))('fax');var ami=require(_0x446f('0x7'));var rpcDb=require(_0x446f('0x8'));var Channel=require(_0x446f('0x9'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x446f('0xa'));var attachment=require(_0x446f('0xb'));var faxMessage=require(_0x446f('0xc'));function Fax(_0x3e7f1f){this[_0x446f('0xd')]={};this[_0x446f('0xe')]=_0x3e7f1f[_0x446f('0xe')];this[_0x446f('0xf')]=_0x3e7f1f[_0x446f('0xf')];this[_0x446f('0x10')]={};ami['on'](_0x446f('0x11'),this[_0x446f('0x12')]['bind'](this));ami['on'](_0x446f('0x13'),this[_0x446f('0x14')][_0x446f('0x15')](this));ami['on']('newstate',this[_0x446f('0x16')][_0x446f('0x15')](this));ami['on']('newexten',this[_0x446f('0x17')]['bind'](this));ami['on'](_0x446f('0x18'),this[_0x446f('0x19')]['bind'](this));ami['on'](_0x446f('0x1a'),this['syncReceiveFax'][_0x446f('0x15')](this));ami['on']('hangup',this[_0x446f('0x1b')][_0x446f('0x15')](this));ami['on'](_0x446f('0x1c'),this[_0x446f('0x1d')][_0x446f('0x15')](this));}Fax[_0x446f('0x1e')][_0x446f('0x12')]=function(_0x39dc5a){if(_0x39dc5a[_0x446f('0x1f')]===_0x446f('0x20')){for(var _0x4000e9 in this[_0x446f('0xe')]){if(this[_0x446f('0xe')][_0x446f('0x21')](_0x4000e9)){if(_0x39dc5a[_0x446f('0x22')]===this[_0x446f('0xe')][_0x4000e9][_0x446f('0x23')]){this['channels'][_0x39dc5a['uniqueid']]={};this['channels'][_0x39dc5a['uniqueid']][_0x446f('0x24')]=_0x39dc5a[_0x446f('0x24')];this[_0x446f('0xd')][_0x39dc5a[_0x446f('0x25')]]['id']=this[_0x446f('0xe')][_0x4000e9]['id'];this[_0x446f('0xd')][_0x39dc5a[_0x446f('0x25')]]['name']=this[_0x446f('0xe')][_0x4000e9]['name'];logger['info'](_0x39dc5a[_0x446f('0x25')],_0x446f('0x26'));}}}}if(this[_0x446f('0x10')][_0x39dc5a[_0x446f('0x25')]]){this[_0x446f('0xd')][_0x39dc5a[_0x446f('0x25')]]={};this[_0x446f('0xd')][_0x39dc5a[_0x446f('0x25')]][_0x446f('0x24')]=_0x39dc5a[_0x446f('0x24')];logger[_0x446f('0x27')](_0x39dc5a[_0x446f('0x25')],_0x446f('0x26'));}};Fax[_0x446f('0x1e')][_0x446f('0x14')]=function(_0x598232){if(this[_0x446f('0xd')][_0x598232[_0x446f('0x25')]]){for(var _0x3b9be7 in _0x598232[_0x446f('0x28')]){if(_0x598232[_0x446f('0x28')][_0x446f('0x21')](_0x3b9be7)){this['channels'][_0x598232[_0x446f('0x25')]][_0x3b9be7]=_0x598232[_0x446f('0x29')];}}}};Fax[_0x446f('0x1e')]['syncNewState']=function(_0x1ca8c8){if(this['channels'][_0x1ca8c8[_0x446f('0x25')]]){this[_0x446f('0xd')][_0x1ca8c8[_0x446f('0x25')]][_0x446f('0x2a')]=_0x1ca8c8[_0x446f('0x2a')];this['channels'][_0x1ca8c8[_0x446f('0x25')]][_0x446f('0x2b')]=_0x1ca8c8[_0x446f('0x2b')];}};Fax['prototype'][_0x446f('0x17')]=function(_0x2b8eb0){if(this[_0x446f('0xd')][_0x2b8eb0[_0x446f('0x25')]]){for(var _0x258bc7 in _0x2b8eb0[_0x446f('0x28')]){if(_0x2b8eb0[_0x446f('0x28')][_0x446f('0x21')](_0x258bc7)){this[_0x446f('0xd')][_0x2b8eb0[_0x446f('0x25')]][_0x258bc7]=_0x2b8eb0[_0x446f('0x29')];}}}};Fax[_0x446f('0x1e')][_0x446f('0x19')]=function(_0x78975b){if(this[_0x446f('0xd')][_0x78975b['uniqueid']]){this['channels'][_0x78975b[_0x446f('0x25')]]['operation']=_0x78975b[_0x446f('0x2c')];this[_0x446f('0xd')][_0x78975b['uniqueid']][_0x446f('0x2d')]=_0x78975b[_0x446f('0x2d')];this[_0x446f('0xd')][_0x78975b['uniqueid']][_0x446f('0x23')]=_0x78975b['localstationid'];this[_0x446f('0xd')][_0x78975b[_0x446f('0x25')]][_0x446f('0x2e')]=_0x78975b[_0x446f('0x2e')];logger['info'](_0x78975b['uniqueid'],_0x446f('0x2f'));}};Fax['prototype']['syncReceiveFax']=function(_0x1b9643){var _0x447a43=this;if(this[_0x446f('0xd')][_0x1b9643[_0x446f('0x25')]]){var _0x548c2d=this[_0x446f('0xd')][_0x1b9643['uniqueid']]['id'];this['channels'][_0x1b9643[_0x446f('0x25')]][_0x446f('0x30')]=_0x1b9643[_0x446f('0x30')];this[_0x446f('0xd')][_0x1b9643['uniqueid']][_0x446f('0x31')]=_0x1b9643[_0x446f('0x31')];this[_0x446f('0xd')][_0x1b9643[_0x446f('0x25')]][_0x446f('0x23')]=_0x1b9643[_0x446f('0x23')];this[_0x446f('0xd')][_0x1b9643[_0x446f('0x25')]][_0x446f('0x32')]=_0x1b9643[_0x446f('0x32')];this[_0x446f('0xd')][_0x1b9643[_0x446f('0x25')]]['transferrate']=_0x1b9643[_0x446f('0x33')];this['channels'][_0x1b9643['uniqueid']][_0x446f('0x2e')]=_0x1b9643[_0x446f('0x2e')];this[_0x446f('0xd')][_0x1b9643[_0x446f('0x25')]][_0x446f('0x34')]=_0x1b9643[_0x446f('0x34')];if(this[_0x446f('0xd')][_0x1b9643[_0x446f('0x25')]]['pagestransferred']>0x0){tiff2pdf(_0x1b9643[_0x446f('0x2e')],_0x446f('0x35'),function(_0x1e641c){logger['info'](_0x1b9643[_0x446f('0x25')],'\x20result\x20conversion\x20file\x20',_0x1e641c[_0x446f('0x36')]);attachment['create']({'name':path[_0x446f('0x37')](_0x1b9643[_0x446f('0x2e')])[_0x446f('0x38')],'basename':path[_0x446f('0x37')](_0x1b9643[_0x446f('0x2e')])[_0x446f('0x38')]+_0x446f('0x39'),'type':_0x446f('0x3a')})[_0x446f('0x3b')](function(_0x3294bd){faxAccount[_0x446f('0x3c')](_0x548c2d,{'from':_0x1b9643[_0x446f('0x34')],'mapKey':_0x446f('0x3d'),'body':path[_0x446f('0x37')](_0x1b9643[_0x446f('0x2e')])[_0x446f('0x38')]+_0x446f('0x39'),'AttachmentId':_0x3294bd['id']})['catch'](function(_0xebd44){logger[_0x446f('0x3e')](_0x1b9643[_0x446f('0x25')],_0x446f('0x3f'),JSON['stringify'](_0xebd44));});})[_0x446f('0x40')](function(_0x552821){logger[_0x446f('0x3e')](_0x1b9643[_0x446f('0x25')],_0x446f('0x41'),JSON[_0x446f('0x42')](_0x552821));});});}logger[_0x446f('0x27')](_0x1b9643['uniqueid'],_0x446f('0x41'));}};Fax[_0x446f('0x1e')]['syncOriginateResponse']=function(_0x578c71){if(this['actions'][_0x578c71[_0x446f('0x25')]]){_[_0x446f('0x43')](this[_0x446f('0xd')][_0x578c71[_0x446f('0x25')]],_['pick'](_0x578c71,[_0x446f('0x44'),_0x446f('0x45')]));}};function updateStatus(_0x873777){if(_0x873777['AttachmentId']){faxMessage[_0x446f('0x46')](_0x873777[_0x446f('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x4904e3){ut[_0x446f('0x48')](_0x446f('0x49'),_0x4904e3);})['catch'](function(_0x3188bd){ut[_0x446f('0x48')](_0x446f('0x4a'),_0x3188bd);});}else{ut[_0x446f('0x48')](_0x446f('0x4b'));}}Fax[_0x446f('0x1e')][_0x446f('0x4c')]=function(_0x542ed6,_0x3e2b9a,_0x50c930){var _0x20e7b7=this;var _0x49823b={};if(_0x3e2b9a){_0x49823b={'read':_0x3e2b9a};}else{_0x49823b={'failMessage':_0x50c930};}if(this[_0x446f('0x10')][_0x542ed6][_0x446f('0x47')]){faxMessage[_0x446f('0x46')](this[_0x446f('0x10')][_0x542ed6]['AttachmentId'],_0x49823b)[_0x446f('0x3b')](function(_0x116714){ut[_0x446f('0x48')](_0x446f('0x4d'),_0x116714);})[_0x446f('0x40')](function(_0x2908dc){ut[_0x446f('0x48')](_0x446f('0x4e'),_0x2908dc);})[_0x446f('0x4f')](function(){delete _0x20e7b7[_0x446f('0xd')][_0x542ed6];delete _0x20e7b7[_0x446f('0x10')][_0x542ed6];});}else{ut[_0x446f('0x48')](_0x446f('0x50'));delete this[_0x446f('0xd')][_0x542ed6];delete this['actions'][_0x542ed6];}};Fax['prototype']['syncHangup']=function(_0x1d6d13){var _0x2a44b8=this;if(this[_0x446f('0xd')][_0x1d6d13['uniqueid']]){if(this[_0x446f('0x10')][_0x1d6d13['uniqueid']]){this[_0x446f('0xd')][_0x1d6d13['uniqueid']]['id']=this['actions'][_0x1d6d13['uniqueid']]['id'];this[_0x446f('0xd')][_0x1d6d13[_0x446f('0x25')]][_0x446f('0x38')]=this[_0x446f('0x10')][_0x1d6d13[_0x446f('0x25')]][_0x446f('0x38')];}logger[_0x446f('0x27')](_0x1d6d13[_0x446f('0x25')],this[_0x446f('0x10')][_0x1d6d13[_0x446f('0x25')]]?_0x446f('0x51'):_0x446f('0x52'),JSON[_0x446f('0x42')](this[_0x446f('0xd')][_0x1d6d13[_0x446f('0x25')]]));if(this[_0x446f('0x10')][_0x1d6d13[_0x446f('0x25')]]){if(this[_0x446f('0xd')][_0x1d6d13[_0x446f('0x25')]][_0x446f('0x53')]>0x0&&this[_0x446f('0xd')][_0x1d6d13['uniqueid']][_0x446f('0x18')]===_0x446f('0x54')){this[_0x446f('0x4c')](_0x1d6d13['uniqueid'],!![]);}else{this['updateStatus'](_0x1d6d13['uniqueid'],![],this['channels'][_0x1d6d13['uniqueid']][_0x446f('0x55')]?_0x446f('0x56')+this[_0x446f('0xd')][_0x1d6d13[_0x446f('0x25')]][_0x446f('0x55')]:_0x446f('0x57'));}}}};Fax[_0x446f('0x1e')][_0x446f('0x58')]=function(_0x37afbd){var _0x15db8f=this;return new BPromise(function(_0x187955,_0x2b3e48){_0x15db8f[_0x446f('0x59')](_0x37afbd,_0x15db8f[_0x446f('0xe')][_0x37afbd[_0x446f('0x5a')]])[_0x446f('0x3b')](function(_0x582337){ut[_0x446f('0x48')](_0x446f('0x5b'),_0x582337);_0x187955(ut[_0x446f('0x36')]('Fax\x20received'));})['catch'](function(_0x5482a3){ut['logger'](_0x446f('0x5c'),_0x5482a3);updateStatus(_0x37afbd);_0x2b3e48(ut['message'](_0x446f('0x5d')));});});};Fax[_0x446f('0x1e')][_0x446f('0x5e')]=function(_0xb1a052){var _0x1944e1=this;return new BPromise(function(_0x1f21e7,_0x59f9ea){var _0x30ac8e=_0x1944e1[_0x446f('0x5f')](_0x1944e1['faxAccounts'][_0xb1a052[_0x446f('0x5a')]][_0x446f('0x60')],_0xb1a052);if(_0x30ac8e['isValid']){_0x1f21e7(ut[_0x446f('0x36')](_0x446f('0x61')));}else{_0x59f9ea(ut[_0x446f('0x36')](_0x30ac8e[_0x446f('0x36')]));}});};function originate(_0x2625ad,_0x29e235,_0x2b79d0){return new BPromise(function(_0x1f7275,_0x5d9380){if(_0x2b79d0){var _0x30cf22=util['format'](_0x446f('0x62'),path[_0x446f('0x37')](_0x2625ad['path'])['name'],_0x2625ad[_0x446f('0x63')]);gs['execute'](_0x30cf22)['then'](function(){_0x2625ad[_0x446f('0x63')]=util[_0x446f('0x64')](_0x446f('0x65'),path[_0x446f('0x37')](_0x2625ad[_0x446f('0x63')])[_0x446f('0x66')],path[_0x446f('0x37')](_0x2625ad[_0x446f('0x63')])['name']);_0x29e235['XMF-PATH']=_0x2625ad['path'];ut[_0x446f('0x48')](_0x446f('0x67'),'');ami[_0x446f('0x68')](ut['variablesAction'](_0x2625ad,_0x29e235))[_0x446f('0x3b')](function(_0x1f53fc){_0x1f7275(_0x1f53fc);})[_0x446f('0x40')](function(_0x58f247){_0x5d9380(_0x58f247);});})[_0x446f('0x40')](function(_0x47320c){_0x5d9380(_0x47320c);});}else{ami['Action'](ut[_0x446f('0x69')](_0x2625ad,_0x29e235))[_0x446f('0x3b')](function(_0x23c7fd){_0x1f7275(_0x23c7fd);})[_0x446f('0x40')](function(_0x5655ff){_0x5d9380(_0x5655ff);});}});}Fax[_0x446f('0x1e')][_0x446f('0x59')]=function(_0x486eb1,_0x299e15){var _0x313894=this;return new BPromise(function(_0x445603,_0x5eb4c0){var _0x26707d=uuid['v4']();var _0x828bac=ut[_0x446f('0x6a')](_0x486eb1,_0x299e15);_0x313894[_0x446f('0x10')][_0x26707d]=new Action(_0x26707d,_0x299e15,_0x486eb1);var _0x48910b=_0x313894[_0x446f('0x10')][_0x26707d];if(path[_0x446f('0x37')](_0x486eb1[_0x446f('0x63')])['ext']==='.pdf'){originate(_0x48910b,_0x828bac,!![])[_0x446f('0x3b')](function(_0x2cdcd7){_0x445603(_0x2cdcd7);})['catch'](function(_0x10b62a){_0x5eb4c0(_0x10b62a);});}else{originate(_0x48910b,_0x828bac,![])[_0x446f('0x3b')](function(_0x38b45e){_0x445603(_0x38b45e);})[_0x446f('0x40')](function(_0x1b80cd){_0x5eb4c0(_0x1b80cd);});}});};Fax[_0x446f('0x1e')][_0x446f('0x6b')]=function(_0x276c9b){return!_['isNil'](_0x276c9b)&&!_[_0x446f('0x6c')](_0x276c9b['name'])&&!_['isNil'](_0x276c9b[_0x446f('0x6d')])&&_0x276c9b[_0x446f('0x6d')]&&!_[_0x446f('0x6c')](this[_0x446f('0xf')][util[_0x446f('0x64')](_0x446f('0x6e'),_0x276c9b[_0x446f('0x38')])])&&!_[_0x446f('0x6c')](this[_0x446f('0xf')][util[_0x446f('0x64')]('SIP/%s',_0x276c9b[_0x446f('0x38')])][_0x446f('0x2d')])&&(this['trunks'][util[_0x446f('0x64')](_0x446f('0x6e'),_0x276c9b['name'])][_0x446f('0x2d')]==='reachable'||this[_0x446f('0xf')][util[_0x446f('0x64')](_0x446f('0x6e'),_0x276c9b[_0x446f('0x38')])][_0x446f('0x2d')]==='unmonitored');};Fax[_0x446f('0x1e')][_0x446f('0x5f')]=function(_0xa1a082,_0x4196b5){if(!this['isTrunkReachable'](_0xa1a082)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_['isNil'](_0xa1a082)?'':_0xa1a082['name']+_0x446f('0x6f'));return{'isValid':![],'message':_0x446f('0x70')};}if(_[_0x446f('0x6c')](_0x4196b5['fax'])){ut[_0x446f('0x48')](_0x446f('0x71'),JSON['stringify'](_0x4196b5));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x446f('0x6c')](_0x4196b5[_0x446f('0x63')])){ut['logger'](_0x446f('0x72'),JSON['stringify'](_0x4196b5));return{'isValid':![],'message':_0x446f('0x73')};}return{'isValid':!![],'message':_0x446f('0x74')};};module[_0x446f('0x75')]=Fax; \ No newline at end of file +var _0x6005=['notify','.pdf','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','[Fax][execOriginate][success]','message','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','execOriginate','ext','isTrunkReachable','isNil','active','reachable','SIP/%s','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','uuid','moment','path','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','application/pdf'];(function(_0x589c57,_0x5064a9){var _0x1c8a9c=function(_0x17e67d){while(--_0x17e67d){_0x589c57['push'](_0x589c57['shift']());}};_0x1c8a9c(++_0x5064a9);}(_0x6005,0x11e));var _0x5600=function(_0x4ea281,_0x52e87a){_0x4ea281=_0x4ea281-0x0;var _0x37196e=_0x6005[_0x4ea281];return _0x37196e;};'use strict';var util=require(_0x5600('0x0'));var _=require(_0x5600('0x1'));var BPromise=require('bluebird');var uuid=require(_0x5600('0x2'));var moment=require(_0x5600('0x3'));var path=require(_0x5600('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x5600('0x5'));var ami=require(_0x5600('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x5600('0x7'));var ut=require(_0x5600('0x8'));var Action=require(_0x5600('0x9'));var faxAccount=require(_0x5600('0xa'));var attachment=require(_0x5600('0xb'));var faxMessage=require(_0x5600('0xc'));function Fax(_0x531aca){this['channels']={};this[_0x5600('0xd')]=_0x531aca['faxAccounts'];this[_0x5600('0xe')]=_0x531aca[_0x5600('0xe')];this[_0x5600('0xf')]={};ami['on'](_0x5600('0x10'),this[_0x5600('0x11')][_0x5600('0x12')](this));ami['on']('varset',this[_0x5600('0x13')][_0x5600('0x12')](this));ami['on'](_0x5600('0x14'),this['syncNewState'][_0x5600('0x12')](this));ami['on']('newexten',this[_0x5600('0x15')][_0x5600('0x12')](this));ami['on'](_0x5600('0x16'),this[_0x5600('0x17')][_0x5600('0x12')](this));ami['on'](_0x5600('0x18'),this[_0x5600('0x19')][_0x5600('0x12')](this));ami['on'](_0x5600('0x1a'),this[_0x5600('0x1b')][_0x5600('0x12')](this));ami['on']('originateresponse',this[_0x5600('0x1c')][_0x5600('0x12')](this));}Fax[_0x5600('0x1d')][_0x5600('0x11')]=function(_0x47158b){if(_0x47158b[_0x5600('0x1e')]===_0x5600('0x1f')){for(var _0x45d5e4 in this[_0x5600('0xd')]){if(this[_0x5600('0xd')][_0x5600('0x20')](_0x45d5e4)){if(_0x47158b[_0x5600('0x21')]===this[_0x5600('0xd')][_0x45d5e4][_0x5600('0x22')]){this[_0x5600('0x23')][_0x47158b['uniqueid']]={};this[_0x5600('0x23')][_0x47158b[_0x5600('0x24')]][_0x5600('0x25')]=_0x47158b[_0x5600('0x25')];this['channels'][_0x47158b[_0x5600('0x24')]]['id']=this['faxAccounts'][_0x45d5e4]['id'];this[_0x5600('0x23')][_0x47158b[_0x5600('0x24')]][_0x5600('0x26')]=this[_0x5600('0xd')][_0x45d5e4][_0x5600('0x26')];logger[_0x5600('0x27')](_0x47158b[_0x5600('0x24')],'\x20syncNewchannel\x20');}}}}if(this[_0x5600('0xf')][_0x47158b[_0x5600('0x24')]]){this['channels'][_0x47158b[_0x5600('0x24')]]={};this[_0x5600('0x23')][_0x47158b['uniqueid']][_0x5600('0x25')]=_0x47158b[_0x5600('0x25')];logger['info'](_0x47158b['uniqueid'],_0x5600('0x28'));}};Fax[_0x5600('0x1d')]['syncVarSet']=function(_0x56ee47){if(this[_0x5600('0x23')][_0x56ee47[_0x5600('0x24')]]){for(var _0x989b7 in _0x56ee47[_0x5600('0x29')]){if(_0x56ee47[_0x5600('0x29')][_0x5600('0x20')](_0x989b7)){this[_0x5600('0x23')][_0x56ee47[_0x5600('0x24')]][_0x989b7]=_0x56ee47[_0x5600('0x2a')];}}}};Fax[_0x5600('0x1d')][_0x5600('0x2b')]=function(_0x42ad7c){if(this['channels'][_0x42ad7c[_0x5600('0x24')]]){this[_0x5600('0x23')][_0x42ad7c[_0x5600('0x24')]][_0x5600('0x2c')]=_0x42ad7c['channelstate'];this[_0x5600('0x23')][_0x42ad7c[_0x5600('0x24')]][_0x5600('0x2d')]=_0x42ad7c['channelstatedesc'];}};Fax[_0x5600('0x1d')][_0x5600('0x15')]=function(_0x424551){if(this['channels'][_0x424551[_0x5600('0x24')]]){for(var _0x119d22 in _0x424551[_0x5600('0x29')]){if(_0x424551[_0x5600('0x29')][_0x5600('0x20')](_0x119d22)){this[_0x5600('0x23')][_0x424551['uniqueid']][_0x119d22]=_0x424551[_0x5600('0x2a')];}}}};Fax[_0x5600('0x1d')][_0x5600('0x17')]=function(_0x23132a){if(this[_0x5600('0x23')][_0x23132a[_0x5600('0x24')]]){this[_0x5600('0x23')][_0x23132a[_0x5600('0x24')]][_0x5600('0x2e')]=_0x23132a['operation'];this['channels'][_0x23132a[_0x5600('0x24')]][_0x5600('0x2f')]=_0x23132a[_0x5600('0x2f')];this[_0x5600('0x23')][_0x23132a[_0x5600('0x24')]][_0x5600('0x22')]=_0x23132a[_0x5600('0x22')];this[_0x5600('0x23')][_0x23132a['uniqueid']][_0x5600('0x30')]=_0x23132a['filename'];logger['info'](_0x23132a[_0x5600('0x24')],_0x5600('0x31'));}};Fax[_0x5600('0x1d')][_0x5600('0x19')]=function(_0x8b431d){var _0x1ae1ec=this;if(this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]]){var _0x197143=this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]]['id'];this[_0x5600('0x23')][_0x8b431d['uniqueid']][_0x5600('0x32')]=_0x8b431d[_0x5600('0x32')];this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]][_0x5600('0x33')]=_0x8b431d[_0x5600('0x33')];this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]][_0x5600('0x22')]=_0x8b431d[_0x5600('0x22')];this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]][_0x5600('0x34')]=_0x8b431d[_0x5600('0x34')];this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]][_0x5600('0x35')]=_0x8b431d[_0x5600('0x35')];this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]][_0x5600('0x30')]=_0x8b431d[_0x5600('0x30')];this['channels'][_0x8b431d[_0x5600('0x24')]][_0x5600('0x36')]=_0x8b431d[_0x5600('0x36')];if(this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]][_0x5600('0x33')]>0x0){tiff2pdf(_0x8b431d[_0x5600('0x30')],_0x5600('0x37'),function(_0x3b9455){logger['info'](_0x8b431d[_0x5600('0x24')],'\x20result\x20conversion\x20file\x20',_0x3b9455['message']);attachment[_0x5600('0x38')]({'name':path[_0x5600('0x39')](_0x8b431d[_0x5600('0x30')])['name'],'basename':path['parse'](_0x8b431d[_0x5600('0x30')])[_0x5600('0x26')]+'.pdf','type':_0x5600('0x3a')})['then'](function(_0x299706){faxAccount[_0x5600('0x3b')](_0x197143,{'from':_0x8b431d[_0x5600('0x36')],'mapKey':_0x5600('0x5'),'body':path[_0x5600('0x39')](_0x8b431d[_0x5600('0x30')])['name']+_0x5600('0x3c'),'AttachmentId':_0x299706['id']})['catch'](function(_0x13542b){logger[_0x5600('0x3d')](_0x8b431d[_0x5600('0x24')],_0x5600('0x3e'),JSON[_0x5600('0x3f')](_0x13542b));});})[_0x5600('0x40')](function(_0x28793c){logger[_0x5600('0x3d')](_0x8b431d[_0x5600('0x24')],_0x5600('0x41'),JSON[_0x5600('0x3f')](_0x28793c));});});}logger[_0x5600('0x27')](_0x8b431d['uniqueid'],_0x5600('0x41'));}};Fax[_0x5600('0x1d')][_0x5600('0x1c')]=function(_0x3738d4){if(this[_0x5600('0xf')][_0x3738d4[_0x5600('0x24')]]){_[_0x5600('0x42')](this[_0x5600('0x23')][_0x3738d4[_0x5600('0x24')]],_[_0x5600('0x43')](_0x3738d4,[_0x5600('0x44'),_0x5600('0x45')]));}};function updateStatus(_0x4e593c){if(_0x4e593c[_0x5600('0x46')]){faxMessage[_0x5600('0x47')](_0x4e593c[_0x5600('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x5600('0x48')](function(_0x25d34d){ut[_0x5600('0x49')](_0x5600('0x4a'),_0x25d34d);})['catch'](function(_0x5350d9){ut[_0x5600('0x49')](_0x5600('0x4b'),_0x5350d9);});}else{ut['logger'](_0x5600('0x4c'));}}Fax['prototype'][_0x5600('0x4d')]=function(_0x478a61,_0x5edf83,_0xa4642e){var _0x310c02=this;var _0x15a573={};if(_0x5edf83){_0x15a573={'read':_0x5edf83};}else{_0x15a573={'failMessage':_0xa4642e};}if(this['actions'][_0x478a61][_0x5600('0x46')]){faxMessage[_0x5600('0x47')](this['actions'][_0x478a61][_0x5600('0x46')],_0x15a573)['then'](function(_0x12dd67){ut['logger'](_0x5600('0x4e'),_0x12dd67);})[_0x5600('0x40')](function(_0x2ba85f){ut[_0x5600('0x49')](_0x5600('0x4f'),_0x2ba85f);})[_0x5600('0x50')](function(){delete _0x310c02[_0x5600('0x23')][_0x478a61];delete _0x310c02[_0x5600('0xf')][_0x478a61];});}else{ut[_0x5600('0x49')]('[Fax][Message][NoUpdate2]');delete this[_0x5600('0x23')][_0x478a61];delete this[_0x5600('0xf')][_0x478a61];}};Fax[_0x5600('0x1d')]['syncHangup']=function(_0x4f047a){var _0x34b4d2=this;if(this[_0x5600('0x23')][_0x4f047a[_0x5600('0x24')]]){if(this[_0x5600('0xf')][_0x4f047a[_0x5600('0x24')]]){this[_0x5600('0x23')][_0x4f047a['uniqueid']]['id']=this[_0x5600('0xf')][_0x4f047a[_0x5600('0x24')]]['id'];this['channels'][_0x4f047a[_0x5600('0x24')]]['name']=this[_0x5600('0xf')][_0x4f047a['uniqueid']][_0x5600('0x26')];}logger[_0x5600('0x27')](_0x4f047a['uniqueid'],this[_0x5600('0xf')][_0x4f047a['uniqueid']]?_0x5600('0x51'):'\x20hangup\x20faxRiceive\x20',JSON[_0x5600('0x3f')](this[_0x5600('0x23')][_0x4f047a[_0x5600('0x24')]]));if(this['actions'][_0x4f047a[_0x5600('0x24')]]){if(this['channels'][_0x4f047a['uniqueid']][_0x5600('0x52')]>0x0&&this[_0x5600('0x23')][_0x4f047a[_0x5600('0x24')]]['faxstatus']===_0x5600('0x53')){this['updateStatus'](_0x4f047a[_0x5600('0x24')],!![]);}else{this['updateStatus'](_0x4f047a['uniqueid'],![],this['channels'][_0x4f047a['uniqueid']][_0x5600('0x54')]?'SENDING\x20FAILED:\x20'+this[_0x5600('0x23')][_0x4f047a[_0x5600('0x24')]]['faxstatusstring']:_0x5600('0x55'));}}}};Fax[_0x5600('0x1d')][_0x5600('0x56')]=function(_0x59b301){var _0x215b33=this;return new BPromise(function(_0xca068e,_0x45770e){_0x215b33['execOriginate'](_0x59b301,_0x215b33[_0x5600('0xd')][_0x59b301['FaxAccountId']])['then'](function(_0x41e78c){ut[_0x5600('0x49')](_0x5600('0x57'),_0x41e78c);_0xca068e(ut[_0x5600('0x58')]('Fax\x20received'));})['catch'](function(_0x13b81c){ut[_0x5600('0x49')]('[Fax][execOriginate][failure]',_0x13b81c);updateStatus(_0x59b301);_0x45770e(ut['message'](_0x5600('0x59')));});});};Fax['prototype'][_0x5600('0x5a')]=function(_0x191d2e){var _0x561b29=this;return new BPromise(function(_0x5c93d2,_0x23e661){var _0x35f923=_0x561b29['checkTrunk'](_0x561b29[_0x5600('0xd')][_0x191d2e[_0x5600('0x5b')]][_0x5600('0x5c')],_0x191d2e);if(_0x35f923[_0x5600('0x5d')]){_0x5c93d2(ut[_0x5600('0x58')](_0x5600('0x5e')));}else{_0x23e661(ut[_0x5600('0x58')](_0x35f923[_0x5600('0x58')]));}});};function originate(_0x4808a0,_0x58fb0d,_0x36066c){return new BPromise(function(_0x4f4b18,_0x2c02e4){if(_0x36066c){var _0x2f2f47=util[_0x5600('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[_0x5600('0x39')](_0x4808a0['path'])['name'],_0x4808a0[_0x5600('0x4')]);gs[_0x5600('0x60')](_0x2f2f47)[_0x5600('0x48')](function(){_0x4808a0[_0x5600('0x4')]=util[_0x5600('0x5f')](_0x5600('0x61'),path[_0x5600('0x39')](_0x4808a0[_0x5600('0x4')])[_0x5600('0x62')],path[_0x5600('0x39')](_0x4808a0[_0x5600('0x4')])[_0x5600('0x26')]);_0x58fb0d[_0x5600('0x63')]=_0x4808a0['path'];ut[_0x5600('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0x5600('0x64')](ut['variablesAction'](_0x4808a0,_0x58fb0d))[_0x5600('0x48')](function(_0xdadf35){_0x4f4b18(_0xdadf35);})[_0x5600('0x40')](function(_0x5df4ee){_0x2c02e4(_0x5df4ee);});})['catch'](function(_0x248c04){_0x2c02e4(_0x248c04);});}else{ami[_0x5600('0x64')](ut[_0x5600('0x65')](_0x4808a0,_0x58fb0d))[_0x5600('0x48')](function(_0x50b902){_0x4f4b18(_0x50b902);})[_0x5600('0x40')](function(_0x109939){_0x2c02e4(_0x109939);});}});}Fax['prototype'][_0x5600('0x66')]=function(_0x27b995,_0x2d1b33){var _0x6d5946=this;return new BPromise(function(_0x52ade1,_0x36d013){var _0x521d0f=uuid['v4']();var _0x1bb56a=ut['addVariables'](_0x27b995,_0x2d1b33);_0x6d5946['actions'][_0x521d0f]=new Action(_0x521d0f,_0x2d1b33,_0x27b995);var _0x4f06b3=_0x6d5946[_0x5600('0xf')][_0x521d0f];if(path[_0x5600('0x39')](_0x27b995[_0x5600('0x4')])[_0x5600('0x67')]===_0x5600('0x3c')){originate(_0x4f06b3,_0x1bb56a,!![])[_0x5600('0x48')](function(_0x51701d){_0x52ade1(_0x51701d);})['catch'](function(_0x1a74e2){_0x36d013(_0x1a74e2);});}else{originate(_0x4f06b3,_0x1bb56a,![])[_0x5600('0x48')](function(_0x4f36b2){_0x52ade1(_0x4f36b2);})['catch'](function(_0x274141){_0x36d013(_0x274141);});}});};Fax[_0x5600('0x1d')][_0x5600('0x68')]=function(_0x268f27){return!_['isNil'](_0x268f27)&&!_[_0x5600('0x69')](_0x268f27[_0x5600('0x26')])&&!_[_0x5600('0x69')](_0x268f27[_0x5600('0x6a')])&&_0x268f27[_0x5600('0x6a')]&&!_['isNil'](this['trunks'][util[_0x5600('0x5f')]('SIP/%s',_0x268f27[_0x5600('0x26')])])&&!_[_0x5600('0x69')](this[_0x5600('0xe')][util[_0x5600('0x5f')]('SIP/%s',_0x268f27[_0x5600('0x26')])][_0x5600('0x2f')])&&(this[_0x5600('0xe')][util[_0x5600('0x5f')]('SIP/%s',_0x268f27[_0x5600('0x26')])][_0x5600('0x2f')]===_0x5600('0x6b')||this['trunks'][util[_0x5600('0x5f')](_0x5600('0x6c'),_0x268f27[_0x5600('0x26')])][_0x5600('0x2f')]===_0x5600('0x6d'));};Fax[_0x5600('0x1d')][_0x5600('0x6e')]=function(_0x221221,_0x2be20a){if(!this[_0x5600('0x68')](_0x221221)){ut[_0x5600('0x49')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x5600('0x69')](_0x221221)?'':_0x221221[_0x5600('0x26')]+_0x5600('0x6f'));return{'isValid':![],'message':_0x5600('0x70')};}if(_[_0x5600('0x69')](_0x2be20a[_0x5600('0x5')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x5600('0x3f')](_0x2be20a));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x2be20a[_0x5600('0x4')])){ut[_0x5600('0x49')](_0x5600('0x71'),JSON[_0x5600('0x3f')](_0x2be20a));return{'isValid':![],'message':_0x5600('0x72')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 01aac0e..f0a6a15 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 _0xef2b=['catch','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','notify','resolve','then'];(function(_0x84261a,_0x315d87){var _0x4b9d50=function(_0x590a5a){while(--_0x590a5a){_0x84261a['push'](_0x84261a['shift']());}};_0x4b9d50(++_0x315d87);}(_0xef2b,0x88));var _0xbef2=function(_0x303074,_0x1c1b0d){_0x303074=_0x303074-0x0;var _0x3a0f26=_0xef2b[_0x303074];return _0x3a0f26;};'use strict';var util=require('util');var BPromise=require(_0xbef2('0x0'));var logger=require(_0xbef2('0x1'))(_0xbef2('0x2'));var _=require('lodash');var faxAccount=require(_0xbef2('0x3'));function loggerCatch(_0x1c6bd9){return function(_0x173a5d){logger[_0xbef2('0x4')](_0x1c6bd9,util['inspect'](_0x173a5d,{'showHidden':![],'depth':null}));};}exports[_0xbef2('0x5')]=function(_0x556054,_0x2695ac){return BPromise[_0xbef2('0x6')]()[_0xbef2('0x7')](faxAccount[_0xbef2('0x5')](_0x556054,_0x2695ac))[_0xbef2('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xe897=['lodash','error','inspect','notify','resolve','then','[Notify]\x20','bluebird','../../../config/logger'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xe897,0xdf));var _0x7e89=function(_0x2a94d8,_0x47d4fe){_0x2a94d8=_0x2a94d8-0x0;var _0xe1f74d=_0xe897[_0x2a94d8];return _0xe1f74d;};'use strict';var util=require('util');var BPromise=require(_0x7e89('0x0'));var logger=require(_0x7e89('0x1'))('preview');var _=require(_0x7e89('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x23ee2f){return function(_0x43ce7c){logger[_0x7e89('0x3')](_0x23ee2f,util[_0x7e89('0x4')](_0x43ce7c,{'showHidden':![],'depth':null}));};}exports[_0x7e89('0x5')]=function(_0x18536e,_0x2cfe6f){return BPromise[_0x7e89('0x6')]()[_0x7e89('0x7')](faxAccount[_0x7e89('0x5')](_0x18536e,_0x2cfe6f))['catch'](loggerCatch(_0x7e89('0x8')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index c232c51..9901118 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 _0x9c12=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','bluebird'];(function(_0x58afc9,_0x3101c8){var _0x208640=function(_0x21c4df){while(--_0x21c4df){_0x58afc9['push'](_0x58afc9['shift']());}};_0x208640(++_0x3101c8);}(_0x9c12,0x146));var _0x29c1=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x9c12[_0x565ed7];return _0x183ad7;};'use strict';var util=require(_0x29c1('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x29c1('0x1'));var exec=require('child_process')[_0x29c1('0x2')];exports[_0x29c1('0x3')]=function(_0xf4f593){return new BPromise(function(_0x3e1d29,_0xaa3e1d){exec(_0xf4f593,function(_0x43ec22,_0x1e8488,_0x8c8533){logger[_0x29c1('0x4')](_0x29c1('0x5'),_0x1e8488);if(_0x43ec22){logger[_0x29c1('0x4')]('Exec\x20gs',_0x29c1('0x6'),util[_0x29c1('0x7')](_0x43ec22,{'showHidden':![],'depth':null}),_0x1e8488,_0x8c8533);_0xaa3e1d(_0x43ec22);}_0x3e1d29(_0x1e8488);});});}; \ No newline at end of file +var _0x5a9c=['info','Exec\x20gs','inspect','util','../../../../config/logger','bluebird','child_process','exec'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0x5a9c,0x14b));var _0xc5a9=function(_0x1a1b16,_0x11f086){_0x1a1b16=_0x1a1b16-0x0;var _0x5586bf=_0x5a9c[_0x1a1b16];return _0x5586bf;};'use strict';var util=require(_0xc5a9('0x0'));var logger=require(_0xc5a9('0x1'))('fax');var BPromise=require(_0xc5a9('0x2'));var exec=require(_0xc5a9('0x3'))[_0xc5a9('0x4')];exports['execute']=function(_0xaa0e17){return new BPromise(function(_0x489f56,_0x231ecc){exec(_0xaa0e17,function(_0x12b833,_0x1c194c,_0x3a531f){logger[_0xc5a9('0x5')]('Exec\x20gs',_0x1c194c);if(_0x12b833){logger[_0xc5a9('0x5')](_0xc5a9('0x6'),'\x20Error\x20:',util[_0xc5a9('0x7')](_0x12b833,{'showHidden':![],'depth':null}),_0x1c194c,_0x3a531f);_0x231ecc(_0x12b833);}_0x489f56(_0x1c194c);});});}; \ 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 1db32d2..12c5985 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 _0x05d9=['variablesAction','uniqueid','originate','channel','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','localstationid','path'];(function(_0x3efaf7,_0x520312){var _0x17788b=function(_0x1ab7c7){while(--_0x1ab7c7){_0x3efaf7['push'](_0x3efaf7['shift']());}};_0x17788b(++_0x520312);}(_0x05d9,0xde));var _0x905d=function(_0x3b6a26,_0x35faf8){_0x3b6a26=_0x3b6a26-0x0;var _0x12235a=_0x05d9[_0x3b6a26];return _0x12235a;};'use strict';var util=require(_0x905d('0x0'));var _=require(_0x905d('0x1'));var moment=require(_0x905d('0x2'));var logger=require(_0x905d('0x3'))(_0x905d('0x4'));exports[_0x905d('0x5')]=function(_0x560582){return{'message':_0x560582};};exports[_0x905d('0x6')]=function(_0x49f4cc,_0x442df6){logger[_0x905d('0x7')](_0x49f4cc,util[_0x905d('0x8')](_0x442df6,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x555d29,_0xb1d74f){var _0x4979d9={'XMF-ECM':_0xb1d74f[_0x905d('0x9')],'XMF-HEADERINFO':_0xb1d74f['headerinfo'],'XMF-MINRATE':_0xb1d74f[_0x905d('0xa')],'XMF-MAXRATE':_0xb1d74f[_0x905d('0xb')],'XMF-MODEM':util[_0x905d('0xc')](_0x905d('0xd'),_0xb1d74f[_0x905d('0xe')]),'XMF-GATEWAY':_0xb1d74f[_0x905d('0xf')],'XMF-FAXDETECT':_0xb1d74f['faxdetect'],'XMF-T38TIMEOUT':_0xb1d74f['t38timeout'],'XMF-LOCALSTATIONID':_0xb1d74f[_0x905d('0x10')],'XMF-PATH':_0x555d29[_0x905d('0x11')]};return _0x4979d9;};exports[_0x905d('0x12')]=function(_0x248c8b,_0x70c5a6){return{'actionid':_0x248c8b[_0x905d('0x13')],'action':_0x905d('0x14'),'channel':_0x248c8b[_0x905d('0x15')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x905d('0xc')](_0x905d('0x16'),_0x248c8b[_0x905d('0x17')]?_0x248c8b[_0x905d('0x17')]:'',_0x248c8b['localstationid']),'variable':_0x70c5a6,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x248c8b[_0x905d('0x13')]};}; \ No newline at end of file +var _0x6840=['gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','util','lodash','../../../../config/logger','message','logger','info','inspect','addVariables','headerinfo','minrate','format','modem'];(function(_0x44d75f,_0x5a62f2){var _0x55ffd2=function(_0x24f27b){while(--_0x24f27b){_0x44d75f['push'](_0x44d75f['shift']());}};_0x55ffd2(++_0x5a62f2);}(_0x6840,0x9c));var _0x0684=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6840[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x0684('0x0'));var _=require(_0x0684('0x1'));var moment=require('moment');var logger=require(_0x0684('0x2'))('fax');exports[_0x0684('0x3')]=function(_0x183793){return{'message':_0x183793};};exports[_0x0684('0x4')]=function(_0x49d512,_0x2a837b){logger[_0x0684('0x5')](_0x49d512,util[_0x0684('0x6')](_0x2a837b,{'showHidden':![],'depth':null}));};exports[_0x0684('0x7')]=function(_0xec0039,_0x3da415){var _0xe763cb={'XMF-ECM':_0x3da415['ecm'],'XMF-HEADERINFO':_0x3da415[_0x0684('0x8')],'XMF-MINRATE':_0x3da415[_0x0684('0x9')],'XMF-MAXRATE':_0x3da415['maxrate'],'XMF-MODEM':util[_0x0684('0xa')]('\x22%s\x22',_0x3da415[_0x0684('0xb')]),'XMF-GATEWAY':_0x3da415[_0x0684('0xc')],'XMF-FAXDETECT':_0x3da415[_0x0684('0xd')],'XMF-T38TIMEOUT':_0x3da415['t38timeout'],'XMF-LOCALSTATIONID':_0x3da415[_0x0684('0xe')],'XMF-PATH':_0xec0039[_0x0684('0xf')]};return _0xe763cb;};exports[_0x0684('0x10')]=function(_0x578a75,_0x161f47){return{'actionid':_0x578a75[_0x0684('0x11')],'action':_0x0684('0x12'),'channel':_0x578a75[_0x0684('0x13')],'Exten':_0x0684('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0x0684('0xa')]('\x22%s\x22\x20<%s>',_0x578a75[_0x0684('0x8')]?_0x578a75[_0x0684('0x8')]:'',_0x578a75['localstationid']),'variable':_0x161f47,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x578a75['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index e0657e7..44d331f 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 _0xf1f0=['initTemplates','getZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','./server','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTriggers','initTriggers','getTemplates'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0xf1f0,0xe0));var _0x0f1f=function(_0x379a66,_0x291e76){_0x379a66=_0x379a66-0x0;var _0x379ccd=_0xf1f0[_0x379a66];return _0x379ccd;};'use strict';var BPromise=require(_0x0f1f('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x0f1f('0x1'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x0f1f('0x2'));var Trigger=require('./trigger');var Dialer=require(_0x0f1f('0x3'));var Preview=require(_0x0f1f('0x4'));var Fax=require(_0x0f1f('0x5'));var user=require(_0x0f1f('0x6'));var voiceQueue=require(_0x0f1f('0x7'));var voiceQueueReport=require(_0x0f1f('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x0f1f('0x9'));var template=require(_0x0f1f('0xa'));var cmHopperHistory=require(_0x0f1f('0xb'));var campaign=require(_0x0f1f('0xc'));var voiceExtension=require(_0x0f1f('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x0f1f('0xe'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x0f1f('0xf'));var zoho=require(_0x0f1f('0x10'));var vtiger=require(_0x0f1f('0x11'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x0f1f('0x12'));var dynamics365=require(_0x0f1f('0x13'));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(_0x0f1f('0x14'))(_0x0f1f('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0f1f('0x16')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0f1f('0x16')](_0x0f1f('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0f1f('0x18')]()[_0x0f1f('0x19')](user[_0x0f1f('0x1a')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x1b')]())[_0x0f1f('0x19')](user[_0x0f1f('0x1c')]())['then'](realtime['initTelephones']())[_0x0f1f('0x19')](trunk['getTrunks']())[_0x0f1f('0x19')](realtime['initTrunks']())[_0x0f1f('0x19')](voiceQueue['getVoiceQueues']())[_0x0f1f('0x19')](realtime['initVoiceQueues']())[_0x0f1f('0x19')](trigger[_0x0f1f('0x1d')]())['then'](realtime[_0x0f1f('0x1e')]())[_0x0f1f('0x19')](template[_0x0f1f('0x1f')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x20')]())[_0x0f1f('0x19')](zendesk[_0x0f1f('0x21')]())[_0x0f1f('0x19')](realtime['initZendeskAccounts']())[_0x0f1f('0x19')](salesforce['getSalesforceAccounts']())[_0x0f1f('0x19')](realtime[_0x0f1f('0x22')]())['then'](sugarcrm[_0x0f1f('0x23')]())['then'](realtime['initSugarcrmAccounts']())[_0x0f1f('0x19')](freshdesk['getFreshdeskAccounts']())[_0x0f1f('0x19')](realtime[_0x0f1f('0x24')]())[_0x0f1f('0x19')](desk[_0x0f1f('0x25')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x26')]())[_0x0f1f('0x19')](zoho['getZohoAccounts']())[_0x0f1f('0x19')](realtime[_0x0f1f('0x27')]())[_0x0f1f('0x19')](vtiger['getVtigerAccounts']())[_0x0f1f('0x19')](realtime[_0x0f1f('0x28')]())[_0x0f1f('0x19')](freshsales['getFreshsalesAccounts']())[_0x0f1f('0x19')](realtime[_0x0f1f('0x29')]())['then'](servicenow[_0x0f1f('0x2a')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x2b')]())['then'](dynamics365[_0x0f1f('0x2c')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x2d')]())[_0x0f1f('0x19')](campaign['getCampaigns']())[_0x0f1f('0x19')](realtime['initCampaigns']())[_0x0f1f('0x19')](voiceExtension[_0x0f1f('0x2e')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x2f')]())[_0x0f1f('0x19')](faxAccount[_0x0f1f('0x30')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x31')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x0f1f('0x18')]()['then'](voiceQueueReport[_0x0f1f('0x32')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x33')]())[_0x0f1f('0x19')](cmHopperHistory[_0x0f1f('0x34')]())[_0x0f1f('0x19')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x0f1f('0x35')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x36')]())[_0x0f1f('0x19')](voiceCallReport[_0x0f1f('0x37')]())['then'](realtime[_0x0f1f('0x38')]())[_0x0f1f('0x39')](function(_0x22352a){logger[_0x0f1f('0x3a')](_0x0f1f('0x3b'),util[_0x0f1f('0x3c')](_0x22352a,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0f1f('0x3d')](realtime,preview,fax)[_0x0f1f('0x19')](function(_0xc8b2e){return initRealtime();})['then'](function(){return initParams();})[_0x0f1f('0x19')](function(){report[_0x0f1f('0x3e')]();setInterval(initRealtime,0x1388);})[_0x0f1f('0x39')](function(_0x3b76a7){logger[_0x0f1f('0x3a')](_0x0f1f('0x3f'),util['inspect'](_0x3b76a7,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xc060=['initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','moment','./server','./realtime','./report','./acw','./dialer','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','get','resolve','then','getAgents'];(function(_0x3b4626,_0x14d17b){var _0x404a2e=function(_0x1d0e4f){while(--_0x1d0e4f){_0x3b4626['push'](_0x3b4626['shift']());}};_0x404a2e(++_0x14d17b);}(_0xc060,0x1bb));var _0x0c06=function(_0x25115d,_0x17417b){_0x25115d=_0x25115d-0x0;var _0x359867=_0xc060[_0x25115d];return _0x359867;};'use strict';var BPromise=require(_0x0c06('0x0'));var util=require('util');var moment=require(_0x0c06('0x1'));var server=require(_0x0c06('0x2'));var Realtime=require(_0x0c06('0x3'));var Report=require(_0x0c06('0x4'));var Acw=require(_0x0c06('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x0c06('0x6'));var Preview=require(_0x0c06('0x7'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x0c06('0x8'));var voiceQueueReport=require(_0x0c06('0x9'));var voiceCallReport=require(_0x0c06('0xa'));var trunk=require(_0x0c06('0xb'));var trigger=require(_0x0c06('0xc'));var template=require(_0x0c06('0xd'));var cmHopperHistory=require(_0x0c06('0xe'));var campaign=require(_0x0c06('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x0c06('0x10'));var zendesk=require(_0x0c06('0x11'));var salesforce=require(_0x0c06('0x12'));var sugarcrm=require(_0x0c06('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x0c06('0x14'));var zoho=require(_0x0c06('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x0c06('0x16'));var servicenow=require(_0x0c06('0x17'));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(_0x0c06('0x18'))(_0x0c06('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x0c06('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0c06('0x1b')](_0x0c06('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0c06('0x1c')]()[_0x0c06('0x1d')](user[_0x0c06('0x1e')]())['then'](realtime[_0x0c06('0x1f')]())[_0x0c06('0x1d')](user[_0x0c06('0x20')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x21')]())['then'](trunk[_0x0c06('0x22')]())['then'](realtime[_0x0c06('0x23')]())[_0x0c06('0x1d')](voiceQueue[_0x0c06('0x24')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x25')]())[_0x0c06('0x1d')](trigger[_0x0c06('0x26')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x27')]())[_0x0c06('0x1d')](template[_0x0c06('0x28')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x29')]())[_0x0c06('0x1d')](zendesk[_0x0c06('0x2a')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x2b')]())[_0x0c06('0x1d')](salesforce[_0x0c06('0x2c')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x2d')]())[_0x0c06('0x1d')](sugarcrm[_0x0c06('0x2e')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x2f')]())[_0x0c06('0x1d')](freshdesk[_0x0c06('0x30')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x31')]())['then'](desk[_0x0c06('0x32')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x33')]())[_0x0c06('0x1d')](zoho[_0x0c06('0x34')]())['then'](realtime[_0x0c06('0x35')]())[_0x0c06('0x1d')](vtiger[_0x0c06('0x36')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x37')]())['then'](freshsales[_0x0c06('0x38')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x39')]())[_0x0c06('0x1d')](servicenow['getServicenowAccounts']())[_0x0c06('0x1d')](realtime[_0x0c06('0x3a')]())[_0x0c06('0x1d')](dynamics365[_0x0c06('0x3b')]())['then'](realtime['initDynamics365Accounts']())[_0x0c06('0x1d')](campaign[_0x0c06('0x3c')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x3d')]())[_0x0c06('0x1d')](voiceExtension['getVoiceExtensions']())[_0x0c06('0x1d')](realtime[_0x0c06('0x3e')]())['then'](faxAccount[_0x0c06('0x3f')]())['then'](realtime[_0x0c06('0x40')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x0c06('0x1c')]()[_0x0c06('0x1d')](voiceQueueReport[_0x0c06('0x41')]())['then'](realtime[_0x0c06('0x42')]())[_0x0c06('0x1d')](cmHopperHistory[_0x0c06('0x43')]())[_0x0c06('0x1d')](realtime['initVoiceQueueHopperHistory']())[_0x0c06('0x1d')](cmHopperHistory[_0x0c06('0x44')]())['then'](realtime[_0x0c06('0x45')]())[_0x0c06('0x1d')](voiceCallReport[_0x0c06('0x46')]())['then'](realtime[_0x0c06('0x47')]())[_0x0c06('0x48')](function(_0x333095){logger[_0x0c06('0x49')](_0x0c06('0x4a'),util[_0x0c06('0x4b')](_0x333095,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0c06('0x4c')](realtime,preview,fax)[_0x0c06('0x1d')](function(_0x1d4a2f){return initRealtime();})[_0x0c06('0x1d')](function(){return initParams();})[_0x0c06('0x1d')](function(){report[_0x0c06('0x4d')]();setInterval(initRealtime,0x1388);})[_0x0c06('0x48')](function(_0x303ed3){logger[_0x0c06('0x49')](_0x0c06('0x4e'),util[_0x0c06('0x4b')](_0x303ed3,{'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 4091359..6e090de 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 _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xedd9,0xfc));var _0x9edd=function(_0xf392f6,_0x8037c4){_0xf392f6=_0xf392f6-0x0;var _0x443f38=_0xedd9[_0xf392f6];return _0x443f38;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x386081,_0x490292){var _0x26a92c=function(_0x58f5f3){while(--_0x58f5f3){_0x386081['push'](_0x386081['shift']());}};_0x26a92c(++_0x490292);}(_0xe706,0xa3));var _0x6e70=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0xe706[_0x5ee3d3];return _0x4b272f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 26c8f6c..3c2b3fd 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 _0xb35c=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x1c6c66,_0x1ae960){var _0x4f620c=function(_0x4b2540){while(--_0x4b2540){_0x1c6c66['push'](_0x1c6c66['shift']());}};_0x4f620c(++_0x1ae960);}(_0xb35c,0xba));var _0xcb35=function(_0x3a49c4,_0x3d6e0c){_0x3a49c4=_0x3a49c4-0x0;var _0x568d62=_0xb35c[_0x3a49c4];return _0x568d62;};'use strict';function Campaign(_0x15c746){this['id']=_0x15c746['id']||0x0;this[_0xcb35('0x0')]=_0x15c746[_0xcb35('0x0')]||'';this[_0xcb35('0x1')]=_0x15c746['type']||_0xcb35('0x2');this[_0xcb35('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xcb35('0x4')]=0x0;this['message']='';this[_0xcb35('0x5')]=!![];this['active']=_0x15c746[_0xcb35('0x6')];this[_0xcb35('0x7')]=_0x15c746['limitCalls'];this[_0xcb35('0x8')]=_0x15c746[_0xcb35('0x8')]||null;this[_0xcb35('0x9')]=_0x15c746[_0xcb35('0x9')]?_0x15c746[_0xcb35('0x9')]:null;this[_0xcb35('0xa')]=_0x15c746['dialOriginateCallerIdName'];this[_0xcb35('0xb')]=_0x15c746['dialOriginateCallerIdNumber'];this[_0xcb35('0xc')]=_0x15c746[_0xcb35('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x15c746['dialCongestionMaxRetry'];this[_0xcb35('0xd')]=_0x15c746[_0xcb35('0xd')];this[_0xcb35('0xe')]=_0x15c746['dialBusyMaxRetry'];this[_0xcb35('0xf')]=_0x15c746[_0xcb35('0xf')];this[_0xcb35('0x10')]=_0x15c746['dialNoAnswerMaxRetry'];this[_0xcb35('0x11')]=_0x15c746[_0xcb35('0x11')];this[_0xcb35('0x12')]=_0x15c746['dialGlobalMaxRetry'];this[_0xcb35('0x13')]=_0x15c746[_0xcb35('0x13')]||0x3;this[_0xcb35('0x14')]=_0x15c746[_0xcb35('0x14')]||0x96;this[_0xcb35('0x15')]=_0x15c746[_0xcb35('0x15')]||0x3;this[_0xcb35('0x16')]=_0x15c746[_0xcb35('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x15c746[_0xcb35('0x17')]||0x3;this[_0xcb35('0x18')]=_0x15c746[_0xcb35('0x18')]||0x96;this[_0xcb35('0x19')]=_0x15c746[_0xcb35('0x19')]||0x3;this[_0xcb35('0x1a')]=_0x15c746[_0xcb35('0x1a')]||0x96;this[_0xcb35('0x1b')]=_0x15c746[_0xcb35('0x1b')]||0x3;this[_0xcb35('0x1c')]=_0x15c746[_0xcb35('0x1c')]||0x96;this[_0xcb35('0x1d')]=_0x15c746[_0xcb35('0x1d')]||'DESC';this[_0xcb35('0x1e')]=_0x15c746[_0xcb35('0x1e')]||undefined;this[_0xcb35('0x1f')]=_0x15c746[_0xcb35('0x1f')]||undefined;this[_0xcb35('0x20')]=_0x15c746[_0xcb35('0x20')]||undefined;this[_0xcb35('0x21')]=_0x15c746['TrunkBackup']?_0x15c746[_0xcb35('0x21')]:undefined;this[_0xcb35('0x22')]=_0x15c746[_0xcb35('0x22')]?_0x15c746['Trunk']:undefined;this[_0xcb35('0x23')]=_0x15c746[_0xcb35('0x23')]?_0x15c746[_0xcb35('0x23')]:undefined;this['SquareProject']=_0x15c746[_0xcb35('0x24')]?_0x15c746[_0xcb35('0x24')]:undefined;this[_0xcb35('0x25')]=_0x15c746['SquareProject']?_0x15c746[_0xcb35('0x24')][_0xcb35('0x0')]:undefined;this[_0xcb35('0x26')]=_0x15c746['dialAMDActive']||![];this[_0xcb35('0x27')]=_0x15c746[_0xcb35('0x27')];this[_0xcb35('0x28')]=_0x15c746[_0xcb35('0x28')];this[_0xcb35('0x29')]=_0x15c746['dialAMDAfterGreetingSilence'];this[_0xcb35('0x2a')]=_0x15c746['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x15c746[_0xcb35('0x2b')];this[_0xcb35('0x2c')]=_0x15c746[_0xcb35('0x2c')];this[_0xcb35('0x2d')]=_0x15c746[_0xcb35('0x2d')];this['dialAMDSilenceThreshold']=_0x15c746[_0xcb35('0x2e')];this['dialAMDMaximumWordLength']=_0x15c746[_0xcb35('0x2f')];}module[_0xcb35('0x30')]=Campaign; \ No newline at end of file +var _0x454b=['dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x5130bb,_0x38f6c6){var _0x2a1b2b=function(_0x37d626){while(--_0x37d626){_0x5130bb['push'](_0x5130bb['shift']());}};_0x2a1b2b(++_0x38f6c6);}(_0x454b,0x19b));var _0xb454=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x454b[_0x4bf96c];return _0x281d09;};'use strict';function Campaign(_0x435c3a){this['id']=_0x435c3a['id']||0x0;this[_0xb454('0x0')]=_0x435c3a['name']||'';this['type']=_0x435c3a[_0xb454('0x1')]||_0xb454('0x2');this[_0xb454('0x3')]=0x0;this[_0xb454('0x4')]=0x0;this[_0xb454('0x5')]=0x0;this[_0xb454('0x6')]=0x0;this[_0xb454('0x7')]='';this[_0xb454('0x8')]=!![];this[_0xb454('0x9')]=_0x435c3a[_0xb454('0x9')];this[_0xb454('0xa')]=_0x435c3a['limitCalls'];this['dialTimezone']=_0x435c3a[_0xb454('0xb')]||null;this[_0xb454('0xc')]=_0x435c3a[_0xb454('0xc')]?_0x435c3a[_0xb454('0xc')]:null;this[_0xb454('0xd')]=_0x435c3a['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x435c3a['dialOriginateCallerIdNumber'];this[_0xb454('0xe')]=_0x435c3a['dialOriginateTimeout']||0x1e;this[_0xb454('0xf')]=_0x435c3a['dialCongestionMaxRetry'];this[_0xb454('0x10')]=_0x435c3a[_0xb454('0x10')];this['dialBusyMaxRetry']=_0x435c3a[_0xb454('0x11')];this['dialBusyRetryFrequency']=_0x435c3a[_0xb454('0x12')];this['dialNoAnswerMaxRetry']=_0x435c3a[_0xb454('0x13')];this[_0xb454('0x14')]=_0x435c3a[_0xb454('0x14')];this[_0xb454('0x15')]=_0x435c3a[_0xb454('0x15')];this[_0xb454('0x16')]=_0x435c3a[_0xb454('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x435c3a[_0xb454('0x17')]||0x96;this['dialDropMaxRetry']=_0x435c3a[_0xb454('0x18')]||0x3;this['dialDropRetryFrequency']=_0x435c3a['dialDropRetryFrequency']||0x96;this[_0xb454('0x19')]=_0x435c3a[_0xb454('0x19')]||0x3;this[_0xb454('0x1a')]=_0x435c3a[_0xb454('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x435c3a['dialMachineMaxRetry']||0x3;this[_0xb454('0x1b')]=_0x435c3a[_0xb454('0x1b')]||0x96;this[_0xb454('0x1c')]=_0x435c3a[_0xb454('0x1c')]||0x3;this[_0xb454('0x1d')]=_0x435c3a[_0xb454('0x1d')]||0x96;this[_0xb454('0x1e')]=_0x435c3a[_0xb454('0x1e')]||'DESC';this[_0xb454('0x1f')]=_0x435c3a[_0xb454('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x435c3a[_0xb454('0x20')]||undefined;this[_0xb454('0x21')]=_0x435c3a[_0xb454('0x21')]||undefined;this[_0xb454('0x22')]=_0x435c3a['TrunkBackup']?_0x435c3a['TrunkBackup']:undefined;this['Trunk']=_0x435c3a[_0xb454('0x23')]?_0x435c3a[_0xb454('0x23')]:undefined;this[_0xb454('0x24')]=_0x435c3a[_0xb454('0x24')]?_0x435c3a[_0xb454('0x24')]:undefined;this['SquareProject']=_0x435c3a[_0xb454('0x25')]?_0x435c3a[_0xb454('0x25')]:undefined;this['dialQueueProject']=_0x435c3a[_0xb454('0x25')]?_0x435c3a[_0xb454('0x25')][_0xb454('0x0')]:undefined;this['dialAMDActive']=_0x435c3a[_0xb454('0x26')]||![];this[_0xb454('0x27')]=_0x435c3a[_0xb454('0x27')];this[_0xb454('0x28')]=_0x435c3a[_0xb454('0x28')];this[_0xb454('0x29')]=_0x435c3a[_0xb454('0x29')];this[_0xb454('0x2a')]=_0x435c3a[_0xb454('0x2a')];this[_0xb454('0x2b')]=_0x435c3a['dialAMDMinWordLength'];this[_0xb454('0x2c')]=_0x435c3a[_0xb454('0x2c')];this[_0xb454('0x2d')]=_0x435c3a[_0xb454('0x2d')];this[_0xb454('0x2e')]=_0x435c3a['dialAMDSilenceThreshold'];this[_0xb454('0x2f')]=_0x435c3a['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index e853b9f..55ff2f6 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 _0xeec6=['calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','exten','answered','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','tag','monitor','monitorFilename','queue','transferType','starttime'];(function(_0x256ea9,_0x390904){var _0x32127e=function(_0x23cb8a){while(--_0x23cb8a){_0x256ea9['push'](_0x256ea9['shift']());}};_0x32127e(++_0x390904);}(_0xeec6,0x125));var _0x6eec=function(_0x3116d6,_0x2d574f){_0x3116d6=_0x3116d6-0x0;var _0x18729d=_0xeec6[_0x3116d6];return _0x18729d;};'use strict';function Channel(){this[_0x6eec('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x6eec('0x1')]=0x0;this[_0x6eec('0x2')]='';this[_0x6eec('0x3')]=undefined;this[_0x6eec('0x4')]=undefined;this['accountcode']=0x0;this[_0x6eec('0x5')]='';this[_0x6eec('0x6')]=0x0;this['linkedid']=0x0;this[_0x6eec('0x7')]=0x0;this[_0x6eec('0x8')]=![];this['answertime']=null;this[_0x6eec('0x9')]=null;this[_0x6eec('0xa')]=![];this[_0x6eec('0xb')]=![];this[_0x6eec('0xc')]='';this['lastdata']='';this[_0x6eec('0xd')]=0x0;this[_0x6eec('0xe')]=0x0;this[_0x6eec('0xf')]=0x0;this['type']=null;this[_0x6eec('0x10')]=null;this['disposition']=null;this[_0x6eec('0x11')]=![];this[_0x6eec('0x12')]=null;this[_0x6eec('0x13')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x6eec('0x14')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xf269=['endtime','unmanaged','abandoned','lastapplication','holdtime','type','monitor','monitorFilename','queue','monitors','mohtime','exports','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','context','linkedid','exten','answered','answertime'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xf269,0xd2));var _0x9f26=function(_0x110bea,_0x28a529){_0x110bea=_0x110bea-0x0;var _0x33768f=_0xf269[_0x110bea];return _0x33768f;};'use strict';function Channel(){this['starttime']=null;this[_0x9f26('0x0')]='';this[_0x9f26('0x1')]='';this['calleridnum']=0x0;this[_0x9f26('0x2')]='';this[_0x9f26('0x3')]=undefined;this[_0x9f26('0x4')]=undefined;this['accountcode']=0x0;this[_0x9f26('0x5')]='';this['uniqueid']=0x0;this[_0x9f26('0x6')]=0x0;this[_0x9f26('0x7')]=0x0;this[_0x9f26('0x8')]=![];this[_0x9f26('0x9')]=null;this[_0x9f26('0xa')]=null;this[_0x9f26('0xb')]=![];this[_0x9f26('0xc')]=![];this[_0x9f26('0xd')]='';this['lastdata']='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x9f26('0xe')]=0x0;this[_0x9f26('0xf')]=null;this['tag']=null;this['disposition']=null;this[_0x9f26('0x10')]=![];this[_0x9f26('0x11')]=null;this[_0x9f26('0x12')]=null;this[_0x9f26('0x13')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x9f26('0x14')]=0x0;}module[_0x9f26('0x15')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index e168f94..77993d0 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 _0xef66=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x12c45d,_0x97707a){var _0x4f2a58=function(_0x1a2c78){while(--_0x1a2c78){_0x12c45d['push'](_0x12c45d['shift']());}};_0x4f2a58(++_0x97707a);}(_0xef66,0x16b));var _0x6ef6=function(_0xb78efc,_0x5f4c39){_0xb78efc=_0xb78efc-0x0;var _0x2e2650=_0xef66[_0xb78efc];return _0x2e2650;};'use strict';function DeskAccount(_0x9eb3c2){this['id']=_0x9eb3c2['id']||0x0;this[_0x6ef6('0x0')]=_0x9eb3c2[_0x6ef6('0x0')]||'';this[_0x6ef6('0x1')]=_0x9eb3c2[_0x6ef6('0x1')]||'';this[_0x6ef6('0x2')]=_0x9eb3c2[_0x6ef6('0x2')]||'';this[_0x6ef6('0x3')]=_0x9eb3c2[_0x6ef6('0x3')]||'';this['password']=_0x9eb3c2[_0x6ef6('0x4')]||'';this[_0x6ef6('0x5')]=_0x9eb3c2[_0x6ef6('0x5')]||'';this[_0x6ef6('0x6')]=_0x9eb3c2[_0x6ef6('0x6')]||'';this[_0x6ef6('0x7')]=_0x9eb3c2['token']||'';this[_0x6ef6('0x8')]=_0x9eb3c2[_0x6ef6('0x8')]||'';this[_0x6ef6('0x9')]=_0x9eb3c2[_0x6ef6('0x9')]||'';this['serverUrl']=_0x9eb3c2[_0x6ef6('0xa')]||'';this['Configurations']=_0x9eb3c2[_0x6ef6('0xb')]||{};}module[_0x6ef6('0xc')]=DeskAccount; \ No newline at end of file +var _0xb7e7=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','remoteUri'];(function(_0x290af3,_0x5442b6){var _0x39e480=function(_0x2b9557){while(--_0x2b9557){_0x290af3['push'](_0x290af3['shift']());}};_0x39e480(++_0x5442b6);}(_0xb7e7,0x15e));var _0x7b7e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xb7e7[_0x3c4737];return _0x2bb926;};'use strict';function DeskAccount(_0x3e8ebe){this['id']=_0x3e8ebe['id']||0x0;this[_0x7b7e('0x0')]=_0x3e8ebe[_0x7b7e('0x0')]||'';this['username']=_0x3e8ebe['username']||'';this[_0x7b7e('0x1')]=_0x3e8ebe[_0x7b7e('0x1')]||'';this[_0x7b7e('0x2')]=_0x3e8ebe[_0x7b7e('0x2')]||'';this[_0x7b7e('0x3')]=_0x3e8ebe[_0x7b7e('0x3')]||'';this[_0x7b7e('0x4')]=_0x3e8ebe[_0x7b7e('0x4')]||'';this[_0x7b7e('0x5')]=_0x3e8ebe['consumerSecret']||'';this[_0x7b7e('0x6')]=_0x3e8ebe[_0x7b7e('0x6')]||'';this['tokenSecret']=_0x3e8ebe[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x3e8ebe[_0x7b7e('0x8')]||'';this[_0x7b7e('0x9')]=_0x3e8ebe['serverUrl']||'';this['Configurations']=_0x3e8ebe[_0x7b7e('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 600bddf..e6c67ca 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 _0x1efd=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x3f397a,_0x5e6677){var _0x2e2625=function(_0x4acb58){while(--_0x4acb58){_0x3f397a['push'](_0x3f397a['shift']());}};_0x2e2625(++_0x5e6677);}(_0x1efd,0xa1));var _0xd1ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1efd[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x4ef4cb){this['id']=_0x4ef4cb['id']||0x0;this[_0xd1ef('0x0')]=_0x4ef4cb['name']||'';this[_0xd1ef('0x1')]=_0x4ef4cb[_0xd1ef('0x1')]||'';this['password']=_0x4ef4cb[_0xd1ef('0x2')]||'';this[_0xd1ef('0x3')]=_0x4ef4cb['remoteUri']||'';this[_0xd1ef('0x4')]=_0x4ef4cb['tenantId']||'';this[_0xd1ef('0x5')]=_0x4ef4cb[_0xd1ef('0x5')]||'';this['clientSecret']=_0x4ef4cb[_0xd1ef('0x6')]||{};this[_0xd1ef('0x7')]=_0x4ef4cb['serverUrl']||'';this[_0xd1ef('0x8')]=_0x4ef4cb[_0xd1ef('0x8')]||![];this[_0xd1ef('0x9')]=_0x4ef4cb['Configurations']||{};this[_0xd1ef('0xa')]=_0x4ef4cb['CloudProvider']||{};}module[_0xd1ef('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xe8cb=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe8cb,0x142));var _0xbe8c=function(_0x22e102,_0x481e57){_0x22e102=_0x22e102-0x0;var _0x8e8bb3=_0xe8cb[_0x22e102];return _0x8e8bb3;};'use strict';function Dynamics365Account(_0x47ed4e){this['id']=_0x47ed4e['id']||0x0;this[_0xbe8c('0x0')]=_0x47ed4e[_0xbe8c('0x0')]||'';this[_0xbe8c('0x1')]=_0x47ed4e[_0xbe8c('0x1')]||'';this[_0xbe8c('0x2')]=_0x47ed4e['password']||'';this[_0xbe8c('0x3')]=_0x47ed4e[_0xbe8c('0x3')]||'';this[_0xbe8c('0x4')]=_0x47ed4e[_0xbe8c('0x4')]||'';this[_0xbe8c('0x5')]=_0x47ed4e[_0xbe8c('0x5')]||'';this[_0xbe8c('0x6')]=_0x47ed4e[_0xbe8c('0x6')]||{};this[_0xbe8c('0x7')]=_0x47ed4e['serverUrl']||'';this[_0xbe8c('0x8')]=_0x47ed4e[_0xbe8c('0x8')]||![];this[_0xbe8c('0x9')]=_0x47ed4e[_0xbe8c('0x9')]||{};this[_0xbe8c('0xa')]=_0x47ed4e[_0xbe8c('0xa')]||{};}module[_0xbe8c('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 7741bf0..6afd7a6 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 _0xffe1=['tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x2050d1,_0xbc3574){var _0x4b76e1=function(_0x5d0c39){while(--_0x5d0c39){_0x2050d1['push'](_0x2050d1['shift']());}};_0x4b76e1(++_0xbc3574);}(_0xffe1,0xcc));var _0x1ffe=function(_0x21de65,_0x3655c5){_0x21de65=_0x21de65-0x0;var _0x3f744a=_0xffe1[_0x21de65];return _0x3f744a;};'use strict';function FaxAccount(_0x237af7){this['id']=_0x237af7['id']||0x0;this[_0x1ffe('0x0')]=_0x237af7[_0x1ffe('0x0')]||'';this[_0x1ffe('0x1')]=_0x237af7[_0x1ffe('0x1')];this[_0x1ffe('0x2')]=_0x237af7[_0x1ffe('0x2')];this[_0x1ffe('0x3')]=_0x237af7['headerinfo'];this[_0x1ffe('0x4')]=_0x237af7[_0x1ffe('0x4')];this[_0x1ffe('0x5')]=_0x237af7[_0x1ffe('0x5')]||0x960;this[_0x1ffe('0x6')]=_0x237af7['maxrate']||0x3840;this[_0x1ffe('0x7')]=_0x237af7[_0x1ffe('0x7')]||_0x1ffe('0x8');this[_0x1ffe('0x9')]=_0x237af7[_0x1ffe('0x9')]||'no';this[_0x1ffe('0xa')]=_0x237af7[_0x1ffe('0xa')]||'no';this[_0x1ffe('0xb')]=_0x237af7[_0x1ffe('0xb')]||0x1388;this[_0x1ffe('0xc')]=_0x237af7[_0x1ffe('0xc')]||_0x1ffe('0xd');this[_0x1ffe('0xe')]=_0x237af7['Trunk']?_0x237af7[_0x1ffe('0xe')]:undefined;this[_0x1ffe('0xf')]=_0x237af7[_0x1ffe('0xf')];this[_0x1ffe('0x10')]=_0x237af7[_0x1ffe('0x10')];}module[_0x1ffe('0x11')]=FaxAccount; \ No newline at end of file +var _0xe5ef=['localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0xe5ef,0x9d));var _0xfe5e=function(_0x127770,_0x1631f){_0x127770=_0x127770-0x0;var _0x563208=_0xe5ef[_0x127770];return _0x563208;};'use strict';function FaxAccount(_0x35573f){this['id']=_0x35573f['id']||0x0;this[_0xfe5e('0x0')]=_0x35573f[_0xfe5e('0x0')]||'';this[_0xfe5e('0x1')]=_0x35573f[_0xfe5e('0x1')];this[_0xfe5e('0x2')]=_0x35573f['ecm'];this['headerinfo']=_0x35573f['headerinfo'];this[_0xfe5e('0x3')]=_0x35573f[_0xfe5e('0x3')];this['minrate']=_0x35573f[_0xfe5e('0x4')]||0x960;this[_0xfe5e('0x5')]=_0x35573f['maxrate']||0x3840;this[_0xfe5e('0x6')]=_0x35573f[_0xfe5e('0x6')]||'v17,v27,v29';this[_0xfe5e('0x7')]=_0x35573f[_0xfe5e('0x7')]||'no';this[_0xfe5e('0x8')]=_0x35573f[_0xfe5e('0x8')]||'no';this['t38timeout']=_0x35573f[_0xfe5e('0x9')]||0x1388;this['tech']=_0x35573f[_0xfe5e('0xa')]||_0xfe5e('0xb');this[_0xfe5e('0xc')]=_0x35573f[_0xfe5e('0xc')]?_0x35573f[_0xfe5e('0xc')]:undefined;this[_0xfe5e('0xd')]=_0x35573f[_0xfe5e('0xd')];this['key']=_0x35573f[_0xfe5e('0xe')];}module[_0xfe5e('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 3731e3f..78c67bf 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 _0x2dc0=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0x2dc0,0x67));var _0x02dc=function(_0x330b67,_0x477566){_0x330b67=_0x330b67-0x0;var _0x58ca9d=_0x2dc0[_0x330b67];return _0x58ca9d;};'use strict';function FreshdeskAccount(_0x33fa99){this['id']=_0x33fa99['id']||0x0;this[_0x02dc('0x0')]=_0x33fa99[_0x02dc('0x0')]||'';this['username']=_0x33fa99[_0x02dc('0x1')]||'';this[_0x02dc('0x2')]=_0x33fa99[_0x02dc('0x3')]||'';this[_0x02dc('0x4')]=_0x33fa99['remoteUri']||'';this[_0x02dc('0x5')]=_0x33fa99[_0x02dc('0x5')]||'';this['Configurations']=_0x33fa99[_0x02dc('0x6')]||{};}module[_0x02dc('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x7313=['remoteUri','Configurations','name','username','apiKey','token'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x7313,0x17c));var _0x3731=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x7313[_0x5608a3];return _0x1ed50a;};'use strict';function FreshdeskAccount(_0x23b685){this['id']=_0x23b685['id']||0x0;this[_0x3731('0x0')]=_0x23b685[_0x3731('0x0')]||'';this['username']=_0x23b685[_0x3731('0x1')]||'';this[_0x3731('0x2')]=_0x23b685[_0x3731('0x3')]||'';this[_0x3731('0x4')]=_0x23b685[_0x3731('0x4')]||'';this['serverUrl']=_0x23b685['serverUrl']||'';this[_0x3731('0x5')]=_0x23b685[_0x3731('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 66d6ffd..313fef5 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 _0x6bac=['serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x52a10e,_0xc26ed6){var _0x5be064=function(_0x3a983b){while(--_0x3a983b){_0x52a10e['push'](_0x52a10e['shift']());}};_0x5be064(++_0xc26ed6);}(_0x6bac,0xa5));var _0xc6ba=function(_0xdec2e,_0x2301e3){_0xdec2e=_0xdec2e-0x0;var _0x33e269=_0x6bac[_0xdec2e];return _0x33e269;};'use strict';function FreshsalesAccount(_0xf320e2){this['id']=_0xf320e2['id']||0x0;this['name']=_0xf320e2[_0xc6ba('0x0')]||'';this[_0xc6ba('0x1')]=_0xf320e2[_0xc6ba('0x1')]||'';this[_0xc6ba('0x2')]=_0xf320e2['token']||'';this['remoteUri']=_0xf320e2['remoteUri']||'';this[_0xc6ba('0x3')]=_0xf320e2[_0xc6ba('0x3')]||'';this['Configurations']=_0xf320e2[_0xc6ba('0x4')]||{};}module[_0xc6ba('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x448a=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x448a,0x1ef));var _0xa448=function(_0x3ab2e6,_0x312027){_0x3ab2e6=_0x3ab2e6-0x0;var _0x3f59a8=_0x448a[_0x3ab2e6];return _0x3f59a8;};'use strict';function FreshsalesAccount(_0x526c52){this['id']=_0x526c52['id']||0x0;this[_0xa448('0x0')]=_0x526c52[_0xa448('0x0')]||'';this['username']=_0x526c52[_0xa448('0x1')]||'';this['apiKey']=_0x526c52['token']||'';this[_0xa448('0x2')]=_0x526c52[_0xa448('0x2')]||'';this['serverUrl']=_0x526c52[_0xa448('0x3')]||'';this[_0xa448('0x4')]=_0x526c52[_0xa448('0x4')]||{};}module[_0xa448('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 0b20006..304e8c6 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 _0x170e=['priority','holdtime','assigned','lastAssignedTo','motionChannel','variables','exports','type','calleridnum','queue','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x170e,0xb7));var _0xe170=function(_0x51df00,_0x4ac573){_0x51df00=_0x51df00-0x0;var _0x198328=_0x170e[_0x51df00];return _0x198328;};'use strict';function QueueReport(){this[_0xe170('0x0')]='inbound';this['uniqueid']='';this[_0xe170('0x1')]='';this['calleridname']='';this[_0xe170('0x2')]='';this['queuecallerjoinAt']=null;this[_0xe170('0x3')]=null;this[_0xe170('0x4')]=0x1;this[_0xe170('0x5')]=0x1;this['queuecallerabandon']=![];this[_0xe170('0x6')]=null;this[_0xe170('0x7')]=![];this[_0xe170('0x8')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xe170('0x9')]=0x1;this[_0xe170('0xa')]='';this[_0xe170('0xb')]='';this[_0xe170('0xc')]='';this['accountcode']='';this[_0xe170('0xd')]='';this[_0xe170('0xe')]='';this[_0xe170('0xf')]='';this[_0xe170('0x10')]=0x0;this[_0xe170('0x11')]=![];this[_0xe170('0x12')]='';this[_0xe170('0x13')]='voice';this['mohtime']=0x0;this[_0xe170('0x14')]={};}module[_0xe170('0x15')]=QueueReport; \ No newline at end of file +var _0xae76=['originalposition','connectedlinename','context','exten','priority','assigned','lastAssignedTo','motionChannel','voice','variables','exports','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0xae76,0x83));var _0x6ae7=function(_0x1553be,_0x4b167f){_0x1553be=_0x1553be-0x0;var _0x418597=_0xae76[_0x1553be];return _0x418597;};'use strict';function QueueReport(){this['type']=_0x6ae7('0x0');this[_0x6ae7('0x1')]='';this['calleridnum']='';this[_0x6ae7('0x2')]='';this[_0x6ae7('0x3')]='';this[_0x6ae7('0x4')]=null;this[_0x6ae7('0x5')]=null;this[_0x6ae7('0x6')]=0x1;this[_0x6ae7('0x7')]=0x1;this[_0x6ae7('0x8')]=![];this['queuecallerabandonAt']=null;this[_0x6ae7('0x9')]=![];this[_0x6ae7('0xa')]=null;this[_0x6ae7('0xb')]=![];this[_0x6ae7('0xc')]=null;this[_0x6ae7('0xd')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x6ae7('0xe')]='';this['accountcode']='';this[_0x6ae7('0xf')]='';this[_0x6ae7('0x10')]='';this[_0x6ae7('0x11')]='';this['holdtime']=0x0;this[_0x6ae7('0x12')]=![];this[_0x6ae7('0x13')]='';this[_0x6ae7('0x14')]=_0x6ae7('0x15');this['mohtime']=0x0;this[_0x6ae7('0x16')]={};}module[_0x6ae7('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 07bb87c..6d31bef 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 _0x5809=['clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x486a89,_0x5cbb88){var _0x156863=function(_0x266ee7){while(--_0x266ee7){_0x486a89['push'](_0x486a89['shift']());}};_0x156863(++_0x5cbb88);}(_0x5809,0x6a));var _0x9580=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5809[_0x40a045];return _0x1a687c;};'use strict';function SalesforceAccount(_0xcc582f){this['id']=_0xcc582f['id']||0x0;this[_0x9580('0x0')]=_0xcc582f[_0x9580('0x0')]||'';this[_0x9580('0x1')]=_0xcc582f[_0x9580('0x1')]||'';this[_0x9580('0x2')]=_0xcc582f['remoteUri']||'';this[_0x9580('0x3')]=_0xcc582f[_0x9580('0x3')]||'';this[_0x9580('0x4')]=_0xcc582f[_0x9580('0x4')]||'';this[_0x9580('0x5')]=_0xcc582f[_0x9580('0x5')]||'';this['securityToken']=_0xcc582f[_0x9580('0x6')]||'';this[_0x9580('0x7')]=_0xcc582f[_0x9580('0x7')]||'integrationTab';this[_0x9580('0x8')]=_0xcc582f[_0x9580('0x8')]||'';this[_0x9580('0x9')]=_0xcc582f['Configurations']||{};}module[_0x9580('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x22f0=['clientSecret','securityToken','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId'];(function(_0x514ac3,_0x497d2c){var _0x116919=function(_0x410a22){while(--_0x410a22){_0x514ac3['push'](_0x514ac3['shift']());}};_0x116919(++_0x497d2c);}(_0x22f0,0x159));var _0x022f=function(_0x216e72,_0x5cd161){_0x216e72=_0x216e72-0x0;var _0x2ff28d=_0x22f0[_0x216e72];return _0x2ff28d;};'use strict';function SalesforceAccount(_0x275d93){this['id']=_0x275d93['id']||0x0;this[_0x022f('0x0')]=_0x275d93[_0x022f('0x0')]||'';this[_0x022f('0x1')]=_0x275d93[_0x022f('0x1')]||'';this[_0x022f('0x2')]=_0x275d93[_0x022f('0x2')]||'';this[_0x022f('0x3')]=_0x275d93[_0x022f('0x3')]||'';this[_0x022f('0x4')]=_0x275d93[_0x022f('0x4')]||'';this[_0x022f('0x5')]=_0x275d93['clientSecret']||'';this[_0x022f('0x6')]=_0x275d93[_0x022f('0x6')]||'';this['type']=_0x275d93['type']||_0x022f('0x7');this[_0x022f('0x8')]=_0x275d93[_0x022f('0x8')]||'';this[_0x022f('0x9')]=_0x275d93[_0x022f('0x9')]||{};}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 43fdf91..55503bf 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 _0x65a9=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x4a1353,_0x2fbe86){var _0x3805cc=function(_0x39a7ee){while(--_0x39a7ee){_0x4a1353['push'](_0x4a1353['shift']());}};_0x3805cc(++_0x2fbe86);}(_0x65a9,0x1df));var _0x965a=function(_0x1df6a7,_0x21e3c4){_0x1df6a7=_0x1df6a7-0x0;var _0x5e09cf=_0x65a9[_0x1df6a7];return _0x5e09cf;};'use strict';function ServicenowAccount(_0x32f35a){this['id']=_0x32f35a['id']||0x0;this['name']=_0x32f35a[_0x965a('0x0')]||'';this[_0x965a('0x1')]=_0x32f35a['username']||'';this[_0x965a('0x2')]=_0x32f35a[_0x965a('0x2')]||'';this['remoteUri']=_0x32f35a[_0x965a('0x3')]||'';this[_0x965a('0x4')]=_0x32f35a['serverUrl']||'';this['Configurations']=_0x32f35a[_0x965a('0x5')]||{};}module[_0x965a('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xeca5=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x12a9ac,_0x18d78e){var _0xeb7540=function(_0x2d5932){while(--_0x2d5932){_0x12a9ac['push'](_0x12a9ac['shift']());}};_0xeb7540(++_0x18d78e);}(_0xeca5,0x1d6));var _0x5eca=function(_0x1db02d,_0x16a4ef){_0x1db02d=_0x1db02d-0x0;var _0x5d26a8=_0xeca5[_0x1db02d];return _0x5d26a8;};'use strict';function ServicenowAccount(_0x788118){this['id']=_0x788118['id']||0x0;this[_0x5eca('0x0')]=_0x788118[_0x5eca('0x0')]||'';this[_0x5eca('0x1')]=_0x788118[_0x5eca('0x1')]||'';this[_0x5eca('0x2')]=_0x788118[_0x5eca('0x2')]||'';this[_0x5eca('0x3')]=_0x788118['remoteUri']||'';this['serverUrl']=_0x788118[_0x5eca('0x4')]||'';this['Configurations']=_0x788118[_0x5eca('0x5')]||{};}module[_0x5eca('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 8f54603..14a02d8 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 _0x757d=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x47e26b,_0x54393c){var _0x3e8d29=function(_0x254aa5){while(--_0x254aa5){_0x47e26b['push'](_0x47e26b['shift']());}};_0x3e8d29(++_0x54393c);}(_0x757d,0x193));var _0xd757=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x757d[_0xe8129c];return _0x709fc5;};'use strict';function SugarcrmAccount(_0x1aadc5){this['id']=_0x1aadc5['id']||0x0;this['name']=_0x1aadc5[_0xd757('0x0')]||'';this['username']=_0x1aadc5[_0xd757('0x1')]||'';this[_0xd757('0x2')]=_0x1aadc5[_0xd757('0x2')]||'';this[_0xd757('0x3')]=_0x1aadc5[_0xd757('0x3')]||'';this[_0xd757('0x4')]=_0x1aadc5['serverUrl']||'';this[_0xd757('0x5')]=_0x1aadc5[_0xd757('0x5')]||{};}module[_0xd757('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x5f7c=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x4d8608,_0x46a674){var _0x52823c=function(_0x21ed7a){while(--_0x21ed7a){_0x4d8608['push'](_0x4d8608['shift']());}};_0x52823c(++_0x46a674);}(_0x5f7c,0x1a8));var _0xc5f7=function(_0x530948,_0x189fb9){_0x530948=_0x530948-0x0;var _0x442d73=_0x5f7c[_0x530948];return _0x442d73;};'use strict';function SugarcrmAccount(_0x39829a){this['id']=_0x39829a['id']||0x0;this['name']=_0x39829a[_0xc5f7('0x0')]||'';this[_0xc5f7('0x1')]=_0x39829a['username']||'';this[_0xc5f7('0x2')]=_0x39829a['password']||'';this['remoteUri']=_0x39829a[_0xc5f7('0x3')]||'';this[_0xc5f7('0x4')]=_0x39829a[_0xc5f7('0x4')]||'';this[_0xc5f7('0x5')]=_0x39829a[_0xc5f7('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index d7fd919..3e49e48 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 _0x6f75=['status','address','exports','name','accountcode','state','unknown'];(function(_0x1b0cc9,_0x1eb60a){var _0x4f0fe1=function(_0x5c19b6){while(--_0x5c19b6){_0x1b0cc9['push'](_0x1b0cc9['shift']());}};_0x4f0fe1(++_0x1eb60a);}(_0x6f75,0x15a));var _0x56f7=function(_0xa951fe,_0x4ba978){_0xa951fe=_0xa951fe-0x0;var _0x4da18f=_0x6f75[_0xa951fe];return _0x4da18f;};'use strict';function Telephone(_0x508743){this['id']=_0x508743['id']||0x0;this['name']=_0x508743[_0x56f7('0x0')]||'';this['accountcode']=_0x508743[_0x56f7('0x1')]||'';this[_0x56f7('0x2')]=_0x56f7('0x3');this['stateTime']=0x0;this[_0x56f7('0x4')]='unknown';this[_0x56f7('0x5')]='';}module[_0x56f7('0x6')]=Telephone; \ No newline at end of file +var _0xc00b=['status','address','exports','name','accountcode','unknown'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0xc00b,0x135));var _0xbc00=function(_0x5161fc,_0x37c5f6){_0x5161fc=_0x5161fc-0x0;var _0x38490b=_0xc00b[_0x5161fc];return _0x38490b;};'use strict';function Telephone(_0x533bba){this['id']=_0x533bba['id']||0x0;this[_0xbc00('0x0')]=_0x533bba['name']||'';this['accountcode']=_0x533bba[_0xbc00('0x1')]||'';this['state']=_0xbc00('0x2');this['stateTime']=0x0;this[_0xbc00('0x3')]=_0xbc00('0x2');this[_0xbc00('0x4')]='';}module[_0xbc00('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 96b1f37..72cf8c6 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x429ba5,_0x5d7231){var _0x269d04=function(_0x3b5d70){while(--_0x3b5d70){_0x429ba5['push'](_0x429ba5['shift']());}};_0x269d04(++_0x5d7231);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x2132a7,_0xf4cd64){var _0x39086b=function(_0x52f91b){while(--_0x52f91b){_0x2132a7['push'](_0x2132a7['shift']());}};_0x39086b(++_0xf4cd64);}(_0xb10b,0x12a));var _0xbb10=function(_0x98459f,_0x4dfb55){_0x98459f=_0x98459f-0x0;var _0x128f94=_0xb10b[_0x98459f];return _0x128f94;};'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 19bf8a9..2ef57be 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 _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1a85,0x178));var _0x51a8=function(_0xa4f047,_0x30cffe){_0xa4f047=_0xa4f047-0x0;var _0x280a03=_0x1a85[_0xa4f047];return _0x280a03;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index bb32d56..40d90f9 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 _0x463f=['domainport','registrationtime','defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','split','port'];(function(_0x4e027f,_0x5ee901){var _0x578d11=function(_0x31831b){while(--_0x31831b){_0x4e027f['push'](_0x4e027f['shift']());}};_0x578d11(++_0x5ee901);}(_0x463f,0xc7));var _0xf463=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x463f[_0x4e676e];return _0x336a3c;};'use strict';function Trunk(_0x59291c){this['id']=_0x59291c['id']||0x0;this[_0xf463('0x0')]=_0x59291c[_0xf463('0x0')]||![];this[_0xf463('0x1')]=_0x59291c['name']||'';this['state']=_0xf463('0x2');this[_0xf463('0x3')]=0x0;this[_0xf463('0x4')]='unknown';this[_0xf463('0x5')]=_0x59291c['registry']&&_0x59291c[_0xf463('0x5')][_0xf463('0x6')](':')?_0x59291c[_0xf463('0x5')][_0xf463('0x7')](':')[0x0]:'';this['host']='';this[_0xf463('0x8')]='';this['domain']='';this[_0xf463('0x9')]='';this['refresh']='';this['stateRegistry']=_0xf463('0x2');this[_0xf463('0xa')]='';this['address']='';this[_0xf463('0xb')]=_0x59291c['defaultuser']||'';}module[_0xf463('0xc')]=Trunk; \ No newline at end of file +var _0xba3f=['domain','stateRegistry','registrationtime','address','defaultuser','exports','active','name','status','unknown','registry','indexOf','split','host','port'];(function(_0x255a63,_0x2b8f0c){var _0xf6a438=function(_0x1c3a0f){while(--_0x1c3a0f){_0x255a63['push'](_0x255a63['shift']());}};_0xf6a438(++_0x2b8f0c);}(_0xba3f,0x1aa));var _0xfba3=function(_0x46c954,_0x9dc2ae){_0x46c954=_0x46c954-0x0;var _0x1c1a41=_0xba3f[_0x46c954];return _0x1c1a41;};'use strict';function Trunk(_0x4c9f95){this['id']=_0x4c9f95['id']||0x0;this[_0xfba3('0x0')]=_0x4c9f95['active']||![];this['name']=_0x4c9f95[_0xfba3('0x1')]||'';this['state']='unknown';this['stateTime']=0x0;this[_0xfba3('0x2')]=_0xfba3('0x3');this['registry']=_0x4c9f95[_0xfba3('0x4')]&&_0x4c9f95[_0xfba3('0x4')][_0xfba3('0x5')](':')?_0x4c9f95[_0xfba3('0x4')][_0xfba3('0x6')](':')[0x0]:'';this[_0xfba3('0x7')]='';this[_0xfba3('0x8')]='';this[_0xfba3('0x9')]='';this['domainport']='';this['refresh']='';this[_0xfba3('0xa')]=_0xfba3('0x3');this[_0xfba3('0xb')]='';this[_0xfba3('0xc')]='';this[_0xfba3('0xd')]=_0x4c9f95[_0xfba3('0xd')]||'';}module[_0xfba3('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 8a491d0..f406ef0 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 _0xa2b4=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x4a0be4,_0xdb0076){var _0x320489=function(_0x4605ea){while(--_0x4605ea){_0x4a0be4['push'](_0x4a0be4['shift']());}};_0x320489(++_0xdb0076);}(_0xa2b4,0x111));var _0x4a2b=function(_0x4b0d5,_0x588199){_0x4b0d5=_0x4b0d5-0x0;var _0x2e8607=_0xa2b4[_0x4b0d5];return _0x2e8607;};'use strict';function voiceExtension(_0x49693e){this['id']=_0x49693e['id']||0x0;this[_0x4a2b('0x0')]=_0x49693e['exten']||'';this['recordingFormat']=_0x49693e[_0x4a2b('0x1')]||_0x4a2b('0x2');this[_0x4a2b('0x3')]=_0x49693e[_0x4a2b('0x3')]||![];}module[_0x4a2b('0x4')]=voiceExtension; \ No newline at end of file +var _0x9781=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x4519a7,_0x3303d5){var _0x3188dc=function(_0x15e540){while(--_0x15e540){_0x4519a7['push'](_0x4519a7['shift']());}};_0x3188dc(++_0x3303d5);}(_0x9781,0x70));var _0x1978=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0x9781[_0x12c280];return _0x3638d3;};'use strict';function voiceExtension(_0x24482b){this['id']=_0x24482b['id']||0x0;this['exten']=_0x24482b[_0x1978('0x0')]||'';this[_0x1978('0x1')]=_0x24482b[_0x1978('0x1')]||_0x1978('0x2');this[_0x1978('0x3')]=_0x24482b['mandatoryDisposition']||![];}module[_0x1978('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 469f271..80cb1f3 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 _0xd37c=['anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName'];(function(_0x159a82,_0x16f604){var _0x515198=function(_0x224fbb){while(--_0x224fbb){_0x159a82['push'](_0x159a82['shift']());}};_0x515198(++_0x16f604);}(_0xd37c,0x137));var _0xcd37=function(_0x2301d0,_0x53af71){_0x2301d0=_0x2301d0-0x0;var _0x101190=_0xd37c[_0x2301d0];return _0x101190;};'use strict';var statusDesc=[_0xcd37('0x0'),_0xcd37('0x1'),_0xcd37('0x2'),'busy',_0xcd37('0x3'),_0xcd37('0x4'),_0xcd37('0x5'),_0xcd37('0x6'),_0xcd37('0x7')];var monitorFormat={'wav':_0xcd37('0x8'),'wav49':'wav49','gsm':_0xcd37('0x9')};var strategy={'rrmemory':_0xcd37('0xa'),'roundrobin':_0xcd37('0xb')};function VoiceQueue(_0x1e9d30){this['id']=_0x1e9d30['id']||0x0;this[_0xcd37('0xc')]=_0x1e9d30[_0xcd37('0xc')]||'';this[_0xcd37('0xd')]=_0x1e9d30[_0xcd37('0xd')]||'';this['type']=_0x1e9d30[_0xcd37('0xe')]||_0xcd37('0xf');this['waiting']=0x0;this['talking']=0x0;this['total']=0x0;this['answered']=0x0;this[_0xcd37('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0xcd37('0x11')]=0x0;this[_0xcd37('0x12')]=0x0;this[_0xcd37('0x13')]=0x0;this[_0xcd37('0x14')]=0x0;this['available']=0x0;this[_0xcd37('0x15')]=_0x1e9d30[_0xcd37('0x15')]||![];this[_0xcd37('0x16')]=_0x1e9d30[_0xcd37('0x16')]||0xa;this[_0xcd37('0x17')]=_0x1e9d30[_0xcd37('0x17')]||'no';this[_0xcd37('0x18')]=!![];this[_0xcd37('0x19')]='';this[_0xcd37('0x1a')]=0x0;this[_0xcd37('0x1b')]=0x0;this[_0xcd37('0x1c')]=_0x1e9d30[_0xcd37('0x1c')]||null;this[_0xcd37('0x1d')]=_0x1e9d30['dialGlobalInterval']?_0x1e9d30[_0xcd37('0x1d')]:null;this[_0xcd37('0x1e')]=_0x1e9d30['dialActive'];this['dialMethod']=_0x1e9d30[_0xcd37('0x1f')]||_0xcd37('0x20');this['dialLimitChannel']=_0x1e9d30[_0xcd37('0x21')]||0x0;this['dialLimitQueue']=_0x1e9d30['dialLimitQueue']||0x0;this[_0xcd37('0x22')]=_0x1e9d30[_0xcd37('0x22')]||0x1;this[_0xcd37('0x23')]=_0x1e9d30[_0xcd37('0x23')]||_0xcd37('0x24');this['dialPredictiveOptimizationPercentage']=_0x1e9d30[_0xcd37('0x25')]||0.03;this[_0xcd37('0x26')]=_0x1e9d30[_0xcd37('0x26')]||0x258;this['dialOriginateCallerIdName']=_0x1e9d30[_0xcd37('0x27')]||_0xcd37('0x28');this[_0xcd37('0x29')]=_0x1e9d30[_0xcd37('0x29')]||_0xcd37('0x28');this[_0xcd37('0x2a')]=_0x1e9d30[_0xcd37('0x2a')]||0x1e;this[_0xcd37('0x2b')]=_0x1e9d30['dialQueueOptions']||'tTxX';this[_0xcd37('0x2c')]=_0x1e9d30[_0xcd37('0x2c')]||0x3;this['dialQueueProject']=_0x1e9d30[_0xcd37('0x2d')]||undefined;this[_0xcd37('0x2e')]=_0x1e9d30[_0xcd37('0x2e')]||0x3;this[_0xcd37('0x2f')]=_0x1e9d30['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x1e9d30['dialBusyMaxRetry']||0x3;this[_0xcd37('0x30')]=_0x1e9d30[_0xcd37('0x30')]||0x96;this['dialNoAnswerMaxRetry']=_0x1e9d30['dialNoAnswerMaxRetry']||0x3;this[_0xcd37('0x31')]=_0x1e9d30[_0xcd37('0x31')]||0x96;this[_0xcd37('0x32')]=_0x1e9d30[_0xcd37('0x32')]||0x3;this[_0xcd37('0x33')]=_0x1e9d30[_0xcd37('0x33')]||0x96;this[_0xcd37('0x34')]=_0x1e9d30[_0xcd37('0x34')]||0x3;this[_0xcd37('0x35')]=_0x1e9d30['dialDropRetryFrequency']||0x96;this[_0xcd37('0x36')]=_0x1e9d30[_0xcd37('0x36')]||0x3;this['dialAbandonedRetryFrequency']=_0x1e9d30[_0xcd37('0x37')]||0x96;this[_0xcd37('0x38')]=_0x1e9d30[_0xcd37('0x38')]||0x3;this[_0xcd37('0x39')]=_0x1e9d30[_0xcd37('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x1e9d30[_0xcd37('0x3a')]||0x3;this[_0xcd37('0x3b')]=_0x1e9d30[_0xcd37('0x3b')]||0x96;this[_0xcd37('0x3c')]=_0x1e9d30[_0xcd37('0x3c')]||0x3;this['dialGlobalMaxRetry']=_0x1e9d30[_0xcd37('0x3d')]||0x4;this[_0xcd37('0x3e')]=_0x1e9d30[_0xcd37('0x3e')]?_0x1e9d30['Trunk']:undefined;this['TrunkBackup']=_0x1e9d30[_0xcd37('0x3f')]?_0x1e9d30[_0xcd37('0x3f')]:undefined;this[_0xcd37('0x40')]=_0x1e9d30[_0xcd37('0x40')]||undefined;this['Interval']=_0x1e9d30['Interval']?_0x1e9d30[_0xcd37('0x41')]:undefined;this[_0xcd37('0x42')]=_0x1e9d30[_0xcd37('0x42')]||_0xcd37('0x43');this[_0xcd37('0x44')]=_0x1e9d30[_0xcd37('0x44')]||undefined;this[_0xcd37('0x45')]=_0x1e9d30[_0xcd37('0x45')]||undefined;this[_0xcd37('0x46')]=strategy[_0x1e9d30['strategy']]||_0xcd37('0xa');this['queueStatusComplete']=!![];this[_0xcd37('0x47')]=_0x1e9d30[_0xcd37('0x47')]||![];this[_0xcd37('0x48')]=_0x1e9d30[_0xcd37('0x48')];this[_0xcd37('0x49')]=_0x1e9d30[_0xcd37('0x49')];this[_0xcd37('0x4a')]=_0x1e9d30['dialAMDAfterGreetingSilence'];this[_0xcd37('0x4b')]=_0x1e9d30[_0xcd37('0x4b')];this[_0xcd37('0x4c')]=_0x1e9d30[_0xcd37('0x4c')];this[_0xcd37('0x4d')]=_0x1e9d30[_0xcd37('0x4d')];this[_0xcd37('0x4e')]=_0x1e9d30['dialAMDMaximumNumberOfWords'];this[_0xcd37('0x4f')]=_0x1e9d30['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x1e9d30[_0xcd37('0x50')];this[_0xcd37('0x51')]=0x0;this[_0xcd37('0x52')]=0x0;this[_0xcd37('0x53')]=_0x1e9d30[_0xcd37('0x53')];this['outboundAnswerCallsDay']=0x0;this[_0xcd37('0x54')]=0x0;this[_0xcd37('0x55')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xcd37('0x56')]=0x0;this[_0xcd37('0x57')]=0x0;this[_0xcd37('0x58')]=0x0;this[_0xcd37('0x59')]=0x0;this[_0xcd37('0x5a')]=0x0;this[_0xcd37('0x5b')]=0x0;this[_0xcd37('0x5c')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xcd37('0x5d')]=0x0;this[_0xcd37('0x5e')]=0x0;this['startProgressive']=undefined;this[_0xcd37('0x5f')]=undefined;this[_0xcd37('0x60')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xcd37('0x61')]=0x0;this[_0xcd37('0x62')]=0x0;this[_0xcd37('0x63')]=0x0;this[_0xcd37('0x64')]=0x0;this[_0xcd37('0x65')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xcd37('0x66')]=0x0;this['predictiveIntervalMaxThreshold']=_0x1e9d30[_0xcd37('0x67')]||0x14;this[_0xcd37('0x68')]=_0x1e9d30[_0xcd37('0x67')]||0xa;this[_0xcd37('0x69')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0xcd37('0x6a')]=0x0;this[_0xcd37('0x6b')]=0x0;this['dialRecallMeTimeout']=_0x1e9d30['dialRecallMeTimeout']||0x1e;this[_0xcd37('0x6c')]=_0x1e9d30['dialRecallInQueue']||![];this[_0xcd37('0x6d')]=!!_0x1e9d30['dialPreviewAutoRecallMe']||![];this[_0xcd37('0x6e')]=!!_0x1e9d30[_0xcd37('0x6e')]||![];this[_0xcd37('0x6f')]=_0x1e9d30[_0xcd37('0x6f')]||undefined;this[_0xcd37('0x70')]=_0x1e9d30[_0xcd37('0x70')]||![];this[_0xcd37('0x71')]=_0x1e9d30[_0xcd37('0x71')]||![];this[_0xcd37('0xd')]=monitorFormat[_0x1e9d30['monitor_format']]?monitorFormat[_0x1e9d30[_0xcd37('0xd')]]:undefined;this[_0xcd37('0x72')]=_0x1e9d30[_0xcd37('0x72')]||![];this[_0xcd37('0x73')]=_0x1e9d30[_0xcd37('0x73')]?_0x1e9d30[_0xcd37('0x73')]:undefined;}module[_0xcd37('0x74')]=VoiceQueue; \ No newline at end of file +var _0xcbe6=['inbound','waiting','talking','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','roundrobin','monitor_format','type'];(function(_0x111bab,_0x271498){var _0x5999fa=function(_0x9512f4){while(--_0x9512f4){_0x111bab['push'](_0x111bab['shift']());}};_0x5999fa(++_0x271498);}(_0xcbe6,0x72));var _0x6cbe=function(_0x2ad39d,_0x4168dc){_0x2ad39d=_0x2ad39d-0x0;var _0x29495f=_0xcbe6[_0x2ad39d];return _0x29495f;};'use strict';var statusDesc=[_0x6cbe('0x0'),_0x6cbe('0x1'),_0x6cbe('0x2'),_0x6cbe('0x3'),_0x6cbe('0x4'),_0x6cbe('0x5'),_0x6cbe('0x6'),_0x6cbe('0x7'),_0x6cbe('0x8')];var monitorFormat={'wav':_0x6cbe('0x9'),'wav49':'wav49','gsm':_0x6cbe('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x6cbe('0xb')};function VoiceQueue(_0x9e7b1b){this['id']=_0x9e7b1b['id']||0x0;this['name']=_0x9e7b1b['name']||'';this[_0x6cbe('0xc')]=_0x9e7b1b[_0x6cbe('0xc')]||'';this['type']=_0x9e7b1b[_0x6cbe('0xd')]||_0x6cbe('0xe');this[_0x6cbe('0xf')]=0x0;this[_0x6cbe('0x10')]=0x0;this[_0x6cbe('0x11')]=0x0;this[_0x6cbe('0x12')]=0x0;this['sumDuration']=0x0;this[_0x6cbe('0x13')]=0x0;this[_0x6cbe('0x14')]=0x0;this[_0x6cbe('0x15')]=0x0;this[_0x6cbe('0x16')]=0x0;this[_0x6cbe('0x17')]=0x0;this['available']=0x0;this[_0x6cbe('0x18')]=_0x9e7b1b[_0x6cbe('0x18')]||![];this['acwTimeout']=_0x9e7b1b[_0x6cbe('0x19')]||0xa;this['autopause']=_0x9e7b1b['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x6cbe('0x1a')]='';this[_0x6cbe('0x1b')]=0x0;this['temp']=0x0;this[_0x6cbe('0x1c')]=_0x9e7b1b['dialTimezone']||null;this['dialGlobalInterval']=_0x9e7b1b['dialGlobalInterval']?_0x9e7b1b[_0x6cbe('0x1d')]:null;this['dialActive']=_0x9e7b1b[_0x6cbe('0x1e')];this[_0x6cbe('0x1f')]=_0x9e7b1b[_0x6cbe('0x1f')]||_0x6cbe('0x20');this[_0x6cbe('0x21')]=_0x9e7b1b[_0x6cbe('0x21')]||0x0;this[_0x6cbe('0x22')]=_0x9e7b1b[_0x6cbe('0x22')]||0x0;this[_0x6cbe('0x23')]=_0x9e7b1b[_0x6cbe('0x23')]||0x1;this[_0x6cbe('0x24')]=_0x9e7b1b[_0x6cbe('0x24')]||_0x6cbe('0x25');this[_0x6cbe('0x26')]=_0x9e7b1b[_0x6cbe('0x26')]||0.03;this[_0x6cbe('0x27')]=_0x9e7b1b[_0x6cbe('0x27')]||0x258;this[_0x6cbe('0x28')]=_0x9e7b1b[_0x6cbe('0x28')]||'anonymous';this[_0x6cbe('0x29')]=_0x9e7b1b[_0x6cbe('0x29')]||_0x6cbe('0x2a');this[_0x6cbe('0x2b')]=_0x9e7b1b[_0x6cbe('0x2b')]||0x1e;this['dialQueueOptions']=_0x9e7b1b['dialQueueOptions']||_0x6cbe('0x2c');this[_0x6cbe('0x2d')]=_0x9e7b1b[_0x6cbe('0x2d')]||0x3;this[_0x6cbe('0x2e')]=_0x9e7b1b[_0x6cbe('0x2e')]||undefined;this[_0x6cbe('0x2f')]=_0x9e7b1b[_0x6cbe('0x2f')]||0x3;this[_0x6cbe('0x30')]=_0x9e7b1b[_0x6cbe('0x30')]||0x96;this[_0x6cbe('0x31')]=_0x9e7b1b[_0x6cbe('0x31')]||0x3;this[_0x6cbe('0x32')]=_0x9e7b1b['dialBusyRetryFrequency']||0x96;this[_0x6cbe('0x33')]=_0x9e7b1b[_0x6cbe('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x9e7b1b[_0x6cbe('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x9e7b1b[_0x6cbe('0x35')]||0x3;this[_0x6cbe('0x36')]=_0x9e7b1b[_0x6cbe('0x36')]||0x96;this[_0x6cbe('0x37')]=_0x9e7b1b[_0x6cbe('0x37')]||0x3;this[_0x6cbe('0x38')]=_0x9e7b1b[_0x6cbe('0x38')]||0x96;this[_0x6cbe('0x39')]=_0x9e7b1b[_0x6cbe('0x39')]||0x3;this['dialAbandonedRetryFrequency']=_0x9e7b1b[_0x6cbe('0x3a')]||0x96;this[_0x6cbe('0x3b')]=_0x9e7b1b[_0x6cbe('0x3b')]||0x3;this[_0x6cbe('0x3c')]=_0x9e7b1b[_0x6cbe('0x3c')]||0x96;this[_0x6cbe('0x3d')]=_0x9e7b1b[_0x6cbe('0x3d')]||0x3;this[_0x6cbe('0x3e')]=_0x9e7b1b[_0x6cbe('0x3e')]||0x96;this[_0x6cbe('0x3f')]=_0x9e7b1b[_0x6cbe('0x3f')]||0x3;this[_0x6cbe('0x40')]=_0x9e7b1b[_0x6cbe('0x40')]||0x4;this[_0x6cbe('0x41')]=_0x9e7b1b[_0x6cbe('0x41')]?_0x9e7b1b['Trunk']:undefined;this[_0x6cbe('0x42')]=_0x9e7b1b[_0x6cbe('0x42')]?_0x9e7b1b[_0x6cbe('0x42')]:undefined;this[_0x6cbe('0x43')]=_0x9e7b1b['dialPrefix']||undefined;this['Interval']=_0x9e7b1b[_0x6cbe('0x44')]?_0x9e7b1b['Interval']:undefined;this[_0x6cbe('0x45')]=_0x9e7b1b[_0x6cbe('0x45')]||'DESC';this[_0x6cbe('0x46')]=_0x9e7b1b[_0x6cbe('0x46')]||undefined;this[_0x6cbe('0x47')]=_0x9e7b1b[_0x6cbe('0x47')]||undefined;this[_0x6cbe('0x48')]=strategy[_0x9e7b1b['strategy']]||_0x6cbe('0x49');this[_0x6cbe('0x4a')]=!![];this[_0x6cbe('0x4b')]=_0x9e7b1b[_0x6cbe('0x4b')]||![];this['dialAMDInitialSilence']=_0x9e7b1b[_0x6cbe('0x4c')];this['dialAMDGreeting']=_0x9e7b1b[_0x6cbe('0x4d')];this[_0x6cbe('0x4e')]=_0x9e7b1b[_0x6cbe('0x4e')];this[_0x6cbe('0x4f')]=_0x9e7b1b[_0x6cbe('0x4f')];this['dialAMDMinWordLength']=_0x9e7b1b[_0x6cbe('0x50')];this[_0x6cbe('0x51')]=_0x9e7b1b[_0x6cbe('0x51')];this[_0x6cbe('0x52')]=_0x9e7b1b[_0x6cbe('0x52')];this[_0x6cbe('0x53')]=_0x9e7b1b[_0x6cbe('0x53')];this[_0x6cbe('0x54')]=_0x9e7b1b['dialAMDMaximumWordLength'];this[_0x6cbe('0x55')]=0x0;this[_0x6cbe('0x56')]=0x0;this[_0x6cbe('0x57')]=_0x9e7b1b[_0x6cbe('0x57')];this[_0x6cbe('0x58')]=0x0;this[_0x6cbe('0x59')]=0x0;this[_0x6cbe('0x5a')]=0x0;this[_0x6cbe('0x5b')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x6cbe('0x5c')]=0x0;this[_0x6cbe('0x5d')]=0x0;this[_0x6cbe('0x5e')]=0x0;this[_0x6cbe('0x5f')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x6cbe('0x60')]=0x0;this[_0x6cbe('0x61')]=0x0;this['outboundReCallsDay']=0x0;this[_0x6cbe('0x62')]=0x0;this[_0x6cbe('0x63')]=undefined;this[_0x6cbe('0x64')]=undefined;this[_0x6cbe('0x65')]=undefined;this[_0x6cbe('0x66')]=1.05;this[_0x6cbe('0x67')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x6cbe('0x68')]=0x0;this[_0x6cbe('0x69')]=0x0;this[_0x6cbe('0x6a')]=0x0;this[_0x6cbe('0x6b')]=0x0;this[_0x6cbe('0x6c')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x6cbe('0x6d')]=_0x9e7b1b[_0x6cbe('0x6e')]||0x14;this[_0x6cbe('0x6f')]=_0x9e7b1b['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x6cbe('0x70')]=0x0;this[_0x6cbe('0x71')]=0x0;this[_0x6cbe('0x72')]=0x1;this[_0x6cbe('0x73')]=0x0;this[_0x6cbe('0x74')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x6cbe('0x75')]=0x0;this[_0x6cbe('0x76')]=_0x9e7b1b[_0x6cbe('0x76')]||0x1e;this[_0x6cbe('0x77')]=_0x9e7b1b[_0x6cbe('0x77')]||![];this[_0x6cbe('0x78')]=!!_0x9e7b1b[_0x6cbe('0x78')]||![];this[_0x6cbe('0x79')]=!!_0x9e7b1b[_0x6cbe('0x79')]||![];this[_0x6cbe('0x7a')]=_0x9e7b1b[_0x6cbe('0x7a')]||undefined;this[_0x6cbe('0x7b')]=_0x9e7b1b[_0x6cbe('0x7b')]||![];this['dialAgiAfterHangupAgent']=_0x9e7b1b[_0x6cbe('0x7c')]||![];this['monitor_format']=monitorFormat[_0x9e7b1b[_0x6cbe('0xc')]]?monitorFormat[_0x9e7b1b['monitor_format']]:undefined;this['mandatoryDisposition']=_0x9e7b1b[_0x6cbe('0x7d')]||![];this['mandatoryDispositionPause']=_0x9e7b1b[_0x6cbe('0x7e')]?_0x9e7b1b[_0x6cbe('0x7e')]:undefined;}module[_0x6cbe('0x7f')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index dfbc923..257bb6d 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 _0x39e0=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x212d06,_0x312158){var _0x742812=function(_0x29d819){while(--_0x29d819){_0x212d06['push'](_0x212d06['shift']());}};_0x742812(++_0x312158);}(_0x39e0,0x18e));var _0x039e=function(_0x225e61,_0xb3c102){_0x225e61=_0x225e61-0x0;var _0x41bdad=_0x39e0[_0x225e61];return _0x41bdad;};'use strict';function VtigerAccount(_0x5e28f9){this['id']=_0x5e28f9['id']||0x0;this[_0x039e('0x0')]=_0x5e28f9[_0x039e('0x0')]||'';this[_0x039e('0x1')]=_0x5e28f9['username']||'';this[_0x039e('0x2')]=_0x5e28f9[_0x039e('0x2')]||'';this[_0x039e('0x3')]=_0x5e28f9['remoteUri']||'';this[_0x039e('0x4')]=_0x5e28f9[_0x039e('0x4')]||'';this[_0x039e('0x5')]=_0x5e28f9[_0x039e('0x5')]||{};}module[_0x039e('0x6')]=VtigerAccount; \ No newline at end of file +var _0x0d37=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x43a995,_0x2921f7){var _0x24d91b=function(_0x1c4f86){while(--_0x1c4f86){_0x43a995['push'](_0x43a995['shift']());}};_0x24d91b(++_0x2921f7);}(_0x0d37,0x1ba));var _0x70d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0d37[_0x321bb2];return _0x9c12ed;};'use strict';function VtigerAccount(_0x4fcd5c){this['id']=_0x4fcd5c['id']||0x0;this[_0x70d3('0x0')]=_0x4fcd5c['name']||'';this[_0x70d3('0x1')]=_0x4fcd5c[_0x70d3('0x1')]||'';this[_0x70d3('0x2')]=_0x4fcd5c['accessKey']||'';this[_0x70d3('0x3')]=_0x4fcd5c[_0x70d3('0x3')]||'';this[_0x70d3('0x4')]=_0x4fcd5c[_0x70d3('0x4')]||'';this[_0x70d3('0x5')]=_0x4fcd5c[_0x70d3('0x5')]||{};}module[_0x70d3('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 7dd230c..bcd41ac 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 _0xdd65=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x50d7fd,_0x30cd62){var _0x512b17=function(_0x305414){while(--_0x305414){_0x50d7fd['push'](_0x50d7fd['shift']());}};_0x512b17(++_0x30cd62);}(_0xdd65,0x18b));var _0x5dd6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xdd65[_0x21a9d9];return _0x46adce;};'use strict';function ZendeskAccount(_0x27ccf7){this['id']=_0x27ccf7['id']||0x0;this[_0x5dd6('0x0')]=_0x27ccf7[_0x5dd6('0x0')]||'';this[_0x5dd6('0x1')]=_0x27ccf7[_0x5dd6('0x1')]||'';this[_0x5dd6('0x2')]=_0x27ccf7[_0x5dd6('0x2')]||'';this['token']=_0x27ccf7[_0x5dd6('0x3')]||'';this[_0x5dd6('0x4')]=_0x27ccf7[_0x5dd6('0x4')]||'';this[_0x5dd6('0x5')]=_0x27ccf7[_0x5dd6('0x5')]||'';this['type']=_0x27ccf7[_0x5dd6('0x6')]||_0x5dd6('0x7');this[_0x5dd6('0x8')]=_0x27ccf7[_0x5dd6('0x8')]||'';this[_0x5dd6('0x9')]=_0x27ccf7['Configurations']||{};}module[_0x5dd6('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x9d1e=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x9d1e,0xbc));var _0xe9d1=function(_0x1e61f7,_0x9acdc){_0x1e61f7=_0x1e61f7-0x0;var _0x279354=_0x9d1e[_0x1e61f7];return _0x279354;};'use strict';function ZendeskAccount(_0x43a245){this['id']=_0x43a245['id']||0x0;this['name']=_0x43a245[_0xe9d1('0x0')]||'';this[_0xe9d1('0x1')]=_0x43a245[_0xe9d1('0x1')]||'';this['password']=_0x43a245[_0xe9d1('0x2')]||'';this[_0xe9d1('0x3')]=_0x43a245[_0xe9d1('0x3')]||'';this[_0xe9d1('0x4')]=_0x43a245[_0xe9d1('0x4')]||'';this[_0xe9d1('0x5')]=_0x43a245[_0xe9d1('0x5')]||'';this[_0xe9d1('0x6')]=_0x43a245['type']||_0xe9d1('0x7');this[_0xe9d1('0x8')]=_0x43a245[_0xe9d1('0x8')]||'';this[_0xe9d1('0x9')]=_0x43a245[_0xe9d1('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 704efd3..c1d81ae 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 _0xb5d7=['Configurations','exports','name','description','host','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x555069,_0x23d66a){var _0x100af7=function(_0x1606bd){while(--_0x1606bd){_0x555069['push'](_0x555069['shift']());}};_0x100af7(++_0x23d66a);}(_0xb5d7,0xa2));var _0x7b5d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb5d7[_0x1035c1];return _0x308d67;};'use strict';function ZohoAccount(_0x439835){this['id']=_0x439835['id']||0x0;this['name']=_0x439835[_0x7b5d('0x0')]||'';this[_0x7b5d('0x1')]=_0x439835['description']||'';this[_0x7b5d('0x2')]=_0x439835[_0x7b5d('0x2')]||'';this['zone']=_0x439835['zone']||'';this[_0x7b5d('0x3')]=_0x439835[_0x7b5d('0x3')]||'';this[_0x7b5d('0x4')]=_0x439835[_0x7b5d('0x4')]||'';this[_0x7b5d('0x5')]=_0x439835[_0x7b5d('0x5')]||'';this[_0x7b5d('0x6')]=_0x439835['code']||'';this[_0x7b5d('0x7')]=_0x439835[_0x7b5d('0x7')]||'';this[_0x7b5d('0x8')]=_0x439835['Configurations']||{};}module[_0x7b5d('0x9')]=ZohoAccount; \ No newline at end of file +var _0x3611=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x268396,_0x864c1c){var _0x2d7b5d=function(_0x4a3a6a){while(--_0x4a3a6a){_0x268396['push'](_0x268396['shift']());}};_0x2d7b5d(++_0x864c1c);}(_0x3611,0xfe));var _0x1361=function(_0x3654d7,_0x15cf2e){_0x3654d7=_0x3654d7-0x0;var _0xeba933=_0x3611[_0x3654d7];return _0xeba933;};'use strict';function ZohoAccount(_0x391b43){this['id']=_0x391b43['id']||0x0;this[_0x1361('0x0')]=_0x391b43[_0x1361('0x0')]||'';this[_0x1361('0x1')]=_0x391b43['description']||'';this[_0x1361('0x2')]=_0x391b43[_0x1361('0x2')]||'';this[_0x1361('0x3')]=_0x391b43[_0x1361('0x3')]||'';this[_0x1361('0x4')]=_0x391b43['clientId']||'';this[_0x1361('0x5')]=_0x391b43[_0x1361('0x5')]||'';this['serverUrl']=_0x391b43[_0x1361('0x6')]||'';this[_0x1361('0x7')]=_0x391b43[_0x1361('0x7')]||'';this[_0x1361('0x8')]=_0x391b43[_0x1361('0x8')]||'';this[_0x1361('0x9')]=_0x391b43['Configurations']||{};}module[_0x1361('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 2a1669b..d2431ae 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 _0xa30a=['Agent','channelAgent','membername','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype'];(function(_0x351dcd,_0x292f43){var _0x24185c=function(_0x4340a3){while(--_0x4340a3){_0x351dcd['push'](_0x351dcd['shift']());}};_0x24185c(++_0x292f43);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xaa30('0x0'));var _=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));function checkNameSurname(_0x4dfa7e,_0x49b545,_0x1ebf61){var _0x36f517='';if(!_[_0xaa30('0x3')](_0x49b545)&&_0xaa30('0x4')===typeof _0x49b545){_0x36f517+=_0x49b545;}if(!_[_0xaa30('0x3')](_0x1ebf61)&&_0xaa30('0x4')===typeof _0x1ebf61){_0x36f517+='\x20'+_0x1ebf61;}if(_0x36f517!==''){return _0x36f517;}return _0x4dfa7e;}function Action(_0x555947,_0x347cd5,_0x4efe89,_0x8af448,_0x14fe09){this[_0xaa30('0x5')]=_0x4efe89||undefined;this['idContact']=_0x555947['id'];this[_0xaa30('0x6')]=_0x347cd5[_0xaa30('0x7')];this[_0xaa30('0x8')]=_0x347cd5[_0xaa30('0x8')];this[_0xaa30('0x9')]=_0xaa30('0x6');this['dialAnswer']=![];this['membername']=_[_0xaa30('0x3')](_0x555947['Agent'])?undefined:_0x555947[_0xaa30('0xa')][_0xaa30('0x7')];this[_0xaa30('0xb')]=this[_0xaa30('0xc')]?util['format'](_0xaa30('0xd'),this[_0xaa30('0xc')]):_0x8af448||undefined;this[_0xaa30('0xe')]=checkNameSurname(_0x555947['Contact'][_0xaa30('0xf')],_0x555947[_0xaa30('0x10')][_0xaa30('0x11')],_0x555947[_0xaa30('0x10')][_0xaa30('0x12')]);this[_0xaa30('0x13')]=_0x555947[_0xaa30('0x13')]||![];this[_0xaa30('0x14')]=_0x555947[_0xaa30('0xf')];this[_0xaa30('0x15')]=_0x555947['scheduledat'];this[_0xaa30('0x16')]=_0x555947['countbusyretry']||0x0;this['countcongestionretry']=_0x555947[_0xaa30('0x17')]||0x0;this[_0xaa30('0x18')]=_0x555947[_0xaa30('0x18')]||0x0;this['countglobal']=(_0x555947['countbusyretry']||0x0)+(_0x555947['countcongestionretry']||0x0)+(_0x555947[_0xaa30('0x18')]||0x0)+(_0x555947['countnosuchnumberretry']||0x0)+(_0x555947[_0xaa30('0x19')]||0x0)+(_0x555947[_0xaa30('0x1a')]||0x0)+(_0x555947['countmachineretry']||0x0)+(_0x555947['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x555947[_0xaa30('0x1b')]||0x0;this[_0xaa30('0x19')]=_0x555947[_0xaa30('0x19')]||0x0;this[_0xaa30('0x1a')]=_0x555947[_0xaa30('0x1a')]||0x0;this['countmachineretry']=_0x555947[_0xaa30('0x1c')]||0x0;this[_0xaa30('0x1d')]=_0x555947[_0xaa30('0x1d')]||0x0;this[_0xaa30('0x1e')]=_0x555947[_0xaa30('0x1e')];this['callbackuniqueid']=_0x555947[_0xaa30('0x1f')];this[_0xaa30('0x20')]=_0x555947[_0xaa30('0x20')];this[_0xaa30('0x21')]=_0x555947['recallme'];this[_0xaa30('0x22')]=_0x555947[_0xaa30('0x22')];this[_0xaa30('0x23')]=_0x555947[_0xaa30('0x23')];this[_0xaa30('0x24')]=_[_0xaa30('0x3')](_0x555947['Agent'])?_0x555947[_0xaa30('0x24')]:_0x555947[_0xaa30('0xa')]['id'];this['VoiceQueueId']=_0x555947[_0xaa30('0x25')];this['originatecalleridnum']='';this[_0xaa30('0x26')]='';}Action[_0xaa30('0x27')][_0xaa30('0x28')]=function(){return util[_0xaa30('0x29')](_0xaa30('0x2a'),this[_0xaa30('0xe')],this[_0xaa30('0x2b')]);};module[_0xaa30('0x2c')]=Action; \ No newline at end of file +var _0xb03e=['format','SIP/%s','calleridname','Contact','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','number','exports','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent'];(function(_0x3e3064,_0x3dd6f5){var _0x4547e1=function(_0x785d07){while(--_0x785d07){_0x3e3064['push'](_0x3e3064['shift']());}};_0x4547e1(++_0x3dd6f5);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1524e4,_0x5b01a8){_0x1524e4=_0x1524e4-0x0;var _0x4de023=_0xb03e[_0x1524e4];return _0x4de023;};'use strict';var util=require('util');var _=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));function checkNameSurname(_0x868905,_0x3c5e68,_0x1c58b5){var _0x2db660='';if(!_[_0xeb03('0x2')](_0x3c5e68)&&_0xeb03('0x3')===typeof _0x3c5e68){_0x2db660+=_0x3c5e68;}if(!_[_0xeb03('0x2')](_0x1c58b5)&&_0xeb03('0x3')===typeof _0x1c58b5){_0x2db660+='\x20'+_0x1c58b5;}if(_0x2db660!==''){return _0x2db660;}return _0x868905;}function Action(_0x88925b,_0xee2291,_0x4e1cea,_0x3b58a2,_0x3d3322){this[_0xeb03('0x4')]=_0x4e1cea||undefined;this[_0xeb03('0x5')]=_0x88925b['id'];this[_0xeb03('0x6')]=_0xee2291[_0xeb03('0x7')];this['type']=_0xee2291[_0xeb03('0x8')];this[_0xeb03('0x9')]=_0xeb03('0x6');this['dialAnswer']=![];this[_0xeb03('0xa')]=_['isNil'](_0x88925b[_0xeb03('0xb')])?undefined:_0x88925b[_0xeb03('0xb')][_0xeb03('0x7')];this[_0xeb03('0xc')]=this[_0xeb03('0xa')]?util[_0xeb03('0xd')](_0xeb03('0xe'),this[_0xeb03('0xa')]):_0x3b58a2||undefined;this[_0xeb03('0xf')]=checkNameSurname(_0x88925b[_0xeb03('0x10')][_0xeb03('0x11')],_0x88925b[_0xeb03('0x10')]['firstName'],_0x88925b[_0xeb03('0x10')][_0xeb03('0x12')]);this[_0xeb03('0x13')]=_0x88925b[_0xeb03('0x13')]||![];this['calleridnum']=_0x88925b[_0xeb03('0x11')];this[_0xeb03('0x14')]=_0x88925b[_0xeb03('0x14')];this['countbusyretry']=_0x88925b[_0xeb03('0x15')]||0x0;this[_0xeb03('0x16')]=_0x88925b[_0xeb03('0x16')]||0x0;this[_0xeb03('0x17')]=_0x88925b[_0xeb03('0x17')]||0x0;this[_0xeb03('0x18')]=(_0x88925b[_0xeb03('0x15')]||0x0)+(_0x88925b[_0xeb03('0x16')]||0x0)+(_0x88925b[_0xeb03('0x17')]||0x0)+(_0x88925b[_0xeb03('0x19')]||0x0)+(_0x88925b[_0xeb03('0x1a')]||0x0)+(_0x88925b[_0xeb03('0x1b')]||0x0)+(_0x88925b[_0xeb03('0x1c')]||0x0)+(_0x88925b[_0xeb03('0x1d')]||0x0);this['countnosuchnumberretry']=_0x88925b[_0xeb03('0x19')]||0x0;this[_0xeb03('0x1a')]=_0x88925b[_0xeb03('0x1a')]||0x0;this[_0xeb03('0x1b')]=_0x88925b[_0xeb03('0x1b')]||0x0;this[_0xeb03('0x1c')]=_0x88925b[_0xeb03('0x1c')]||0x0;this[_0xeb03('0x1d')]=_0x88925b[_0xeb03('0x1d')]||0x0;this['callback']=_0x88925b[_0xeb03('0x1e')];this[_0xeb03('0x1f')]=_0x88925b[_0xeb03('0x1f')];this[_0xeb03('0x20')]=_0x88925b[_0xeb03('0x20')];this['recallme']=_0x88925b[_0xeb03('0x21')];this[_0xeb03('0x22')]=_0x88925b[_0xeb03('0x22')];this[_0xeb03('0x23')]=_0x88925b[_0xeb03('0x23')];this[_0xeb03('0x24')]=_[_0xeb03('0x2')](_0x88925b[_0xeb03('0xb')])?_0x88925b[_0xeb03('0x24')]:_0x88925b['Agent']['id'];this[_0xeb03('0x25')]=_0x88925b[_0xeb03('0x25')];this[_0xeb03('0x26')]='';this[_0xeb03('0x27')]='';}Action['prototype']['getCaller']=function(){return util[_0xeb03('0xd')]('\x22%s\x22\x20<%s>',this[_0xeb03('0xf')],this[_0xeb03('0x28')]);};module[_0xeb03('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 4b1c0b5..87b99e1 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 _0xfbd4=['dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','lookAgent','responsetime','YYYY-MM-DD\x20HH:mm:ss','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','starttime','Answer','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','transfer','destlinkedid','addVariable','filterKey','variable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','util','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','./util/util','redis','defaults','socket.io-emitter','prototype','tail','finally','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','loopCampaigns','campaignsPreview','emit','type','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','info','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','syncCampaigns','hasOwnProperty','preview','dialMethod','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','enqueue','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','agentReadyId','then','length','dialRecallMeTimeout','Agent','logger2','[RecallMe]','disableContact','RecallInQueue','dialRecallInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','idContact','swapAdditionalPhones','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','incrementPreviewCounters','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','object','isUndefined','reason','[callProgressDetectingAgent][logNoSuch]','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','logger','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','run','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfbd4,0x182));var _0x4fbd=function(_0x19bbd6,_0x7beb2a){_0x19bbd6=_0x19bbd6-0x0;var _0xb38a0=_0xfbd4[_0x19bbd6];return _0xb38a0;};'use strict';var util=require(_0x4fbd('0x0'));var _=require('lodash');var uuid=require(_0x4fbd('0x1'));var moment=require(_0x4fbd('0x2'));var md5=require(_0x4fbd('0x3'));var Redis=require(_0x4fbd('0x4'));var config=require(_0x4fbd('0x5'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x4fbd('0x6'))('actionPreview');var ami=require(_0x4fbd('0x7'));var rpcDb=require(_0x4fbd('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x4fbd('0x9'));var ut=require(_0x4fbd('0xa'));config[_0x4fbd('0xb')]=_[_0x4fbd('0xc')](config[_0x4fbd('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x4fbd('0xd'))(new Redis(config[_0x4fbd('0xb')]));var Sequence=function(){};Sequence[_0x4fbd('0xe')]['enqueue']=function(_0x195bda){this['tail']=this['tail']?this[_0x4fbd('0xf')][_0x4fbd('0x10')](_0x195bda):_0x195bda();};function Preview(_0x47d36b){this['sequence']=new Sequence();this['campaignsPreview']=_0x47d36b['voiceQueues'];this[_0x4fbd('0x11')]=_0x47d36b[_0x4fbd('0x11')];this[_0x4fbd('0x12')]={};this[_0x4fbd('0x13')]=_0x47d36b[_0x4fbd('0x13')];this[_0x4fbd('0x14')]=0x0;ami['on'](_0x4fbd('0x15'),this[_0x4fbd('0x16')][_0x4fbd('0x17')](this));ami['on'](_0x4fbd('0x18'),this[_0x4fbd('0x19')][_0x4fbd('0x17')](this));ami['on']('hanguprequest',this[_0x4fbd('0x1a')][_0x4fbd('0x17')](this));ami['on'](_0x4fbd('0x1b'),this[_0x4fbd('0x1c')][_0x4fbd('0x17')](this));ami['on'](_0x4fbd('0x1d'),this[_0x4fbd('0x1e')][_0x4fbd('0x17')](this));ami['on'](_0x4fbd('0x1f'),this[_0x4fbd('0x20')]['bind'](this));ami['on']('attendedtransfer',this[_0x4fbd('0x21')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x4fbd('0x17')](this));this[_0x4fbd('0x22')](this[_0x4fbd('0x23')]);}function emit(_0x1d4750,_0x1780fc,_0x24ab51){io['to'](_0x1d4750)[_0x4fbd('0x24')](_0x1780fc,_0x24ab51);}function emitCampaignPreview(_0x4efa35){if(_0x4efa35[_0x4fbd('0x25')]==='outbound'){var _0x1fc9f5={'id':_0x4efa35['id'],'name':_0x4efa35[_0x4fbd('0x26')],'strategy':_0x4efa35[_0x4fbd('0x27')],'answered':_0x4efa35[_0x4fbd('0x28')],'available':_0x4efa35[_0x4fbd('0x29')],'loggedIn':_0x4efa35[_0x4fbd('0x2a')],'pTalking':_0x4efa35[_0x4fbd('0x2b')],'sumBillable':_0x4efa35[_0x4fbd('0x2c')],'sumDuration':_0x4efa35[_0x4fbd('0x2d')],'sumHoldTime':_0x4efa35[_0x4fbd('0x2e')]||0x0,'talking':_0x4efa35[_0x4fbd('0x2f')],'total':_0x4efa35[_0x4fbd('0x30')],'type':_0x4efa35[_0x4fbd('0x25')],'unmanaged':_0x4efa35[_0x4fbd('0x31')],'abandoned':_0x4efa35[_0x4fbd('0x32')],'waiting':_0x4efa35['waiting'],'loggedInDb':_0x4efa35[_0x4fbd('0x33')],'dialActive':_0x4efa35[_0x4fbd('0x34')],'dialMethod':_0x4efa35['dialMethod'],'dialOriginateCallerIdName':_0x4efa35[_0x4fbd('0x35')],'dialOriginateCallerIdNumber':_0x4efa35['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4efa35[_0x4fbd('0x36')],'dialPrefix':_0x4efa35[_0x4fbd('0x37')],'outboundAnswerAgiCallsDay':_0x4efa35[_0x4fbd('0x38')],'outboundAnswerCallsDay':_0x4efa35['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4efa35['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4efa35[_0x4fbd('0x39')],'outboundCongestionCallsDay':_0x4efa35['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x4efa35[_0x4fbd('0x3a')],'outboundDropCallsDayCallersExit':_0x4efa35[_0x4fbd('0x3b')],'outboundDropCallsDayTimeout':_0x4efa35[_0x4fbd('0x3c')],'outboundNoAnswerCallsDay':_0x4efa35[_0x4fbd('0x3d')],'outboundNoSuchCallsDay':_0x4efa35[_0x4fbd('0x3e')],'outboundOriginateFailureCallsDay':_0x4efa35['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4efa35[_0x4fbd('0x3f')],'outboundRejectCallsDay':_0x4efa35[_0x4fbd('0x40')],'outboundUnknownCallsDay':_0x4efa35['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x4efa35['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x4efa35[_0x4fbd('0x41')],'predictiveIntervalAvgHoldtime':_0x4efa35[_0x4fbd('0x42')],'predictiveIntervalAvgTalktime':_0x4efa35[_0x4fbd('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x4efa35[_0x4fbd('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x4efa35[_0x4fbd('0x45')],'predictiveIntervalErlangCalls':_0x4efa35['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x4efa35['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4efa35[_0x4fbd('0x46')],'predictiveIntervalMultiplicativeFactor':_0x4efa35[_0x4fbd('0x47')],'predictiveIntervalPauses':_0x4efa35[_0x4fbd('0x48')],'predictiveIntervalAvailable':_0x4efa35[_0x4fbd('0x49')],'predictiveIntervalTotalCalls':_0x4efa35['predictiveIntervalTotalCalls'],'message':_0x4efa35[_0x4fbd('0x4a')],'originated':_0x4efa35['originated'],'erlangCalls':_0x4efa35[_0x4fbd('0x4b')],'erlangCallToSecond':_0x4efa35['erlangCallToSecond'],'erlangAbandonmentRate':_0x4efa35[_0x4fbd('0x4c')],'erlangBusyFactor':_0x4efa35[_0x4fbd('0x4d')],'startPredictive':_0x4efa35[_0x4fbd('0x4e')],'startProgressive':_0x4efa35[_0x4fbd('0x4f')]};if(_0x4efa35[_0x4fbd('0x50')]){_0x1fc9f5[_0x4fbd('0x50')]={'id':_0x4efa35[_0x4fbd('0x50')]['id'],'name':_0x4efa35[_0x4fbd('0x50')][_0x4fbd('0x26')],'active':_0x4efa35['Trunk'][_0x4fbd('0x51')],'callerid':_0x4efa35['Trunk'][_0x4fbd('0x52')]};}if(_0x4efa35[_0x4fbd('0x53')]){_0x1fc9f5['Interval']={'id':_0x4efa35['Interval']['id'],'name':_0x4efa35[_0x4fbd('0x53')][_0x4fbd('0x26')]};}var _0x491f69=md5(JSON[_0x4fbd('0x54')](_0x1fc9f5));if(_0x4efa35['md5']!==_0x491f69){_0x4efa35[_0x4fbd('0x3')]=_0x491f69;emit(util[_0x4fbd('0x55')](_0x4fbd('0x56'),_0x1fc9f5[_0x4fbd('0x26')]),'voice_queue:save',_0x1fc9f5);}}}function emitVoiceQueueChannelRemove(_0x30ae30){logger[_0x4fbd('0x57')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x30ae30));emit(util[_0x4fbd('0x55')](_0x4fbd('0x56'),_0x30ae30[_0x4fbd('0x26')]),'voice_queue_channel:remove',_0x30ae30);io[_0x4fbd('0x24')](_0x4fbd('0x58'),_0x30ae30);}function notSendMessagesQueue(_0x35ef4e){if(_0x35ef4e[_0x4fbd('0x59')]){if(_0x35ef4e[_0x4fbd('0x5a')]===0x0&&_0x35ef4e[_0x4fbd('0x2b')]===0x0){_0x35ef4e['sendMessageOneNotActive']=![];_0x35ef4e[_0x4fbd('0x29')]=0x0;_0x35ef4e[_0x4fbd('0x5b')]=0x0;_0x35ef4e[_0x4fbd('0x4a')]='NOT_ACTIVE';ut['logger'](_0x4fbd('0x5c'),_0x35ef4e['name']+'\x20is\x20not\x20active');}else{_0x35ef4e['message']=_0x4fbd('0x5d');ut['logger'](_0x4fbd('0x5c'),_0x35ef4e[_0x4fbd('0x26')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x35ef4e);}}Preview[_0x4fbd('0xe')][_0x4fbd('0x22')]=function(){var _0x2d089d=this;setInterval(function(){_0x2d089d[_0x4fbd('0x5e')]();},0x7cf);};Preview[_0x4fbd('0xe')][_0x4fbd('0x5e')]=function(){var _0x33fdf1=this[_0x4fbd('0x23')];this[_0x4fbd('0x14')]+=0x1;for(var _0x86450 in _0x33fdf1){if(_0x33fdf1[_0x4fbd('0x5f')](_0x86450)&&(_0x33fdf1[_0x86450]['dialMethod']===_0x4fbd('0x60')||_0x33fdf1[_0x86450]['dialMethod']==='booked')&&_0x33fdf1[_0x86450][_0x4fbd('0x25')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x4fbd('0x14')]=0x0;this['clearZombieChannels']();}}if(_0x33fdf1['hasOwnProperty'](_0x86450)&&_0x33fdf1[_0x86450][_0x4fbd('0x61')]===_0x4fbd('0x60')&&_0x33fdf1[_0x86450][_0x4fbd('0x25')]==='outbound'){if(_0x33fdf1[_0x86450][_0x4fbd('0x34')]){this[_0x4fbd('0x62')](_0x33fdf1[_0x86450]);if(_0x33fdf1[_0x86450][_0x4fbd('0x63')])this[_0x4fbd('0x64')](_0x33fdf1[_0x86450]);}else{notSendMessagesQueue(_0x33fdf1[_0x86450]);}}}};Preview['prototype'][_0x4fbd('0x65')]=function(_0x2ca8f0){var _0x58d090=this;this[_0x4fbd('0x66')][_0x4fbd('0x67')](function(){if(!_[_0x4fbd('0x68')](_0x58d090[_0x4fbd('0x12')][_0x2ca8f0])){loggerAction['info']('[clearZombieChannels][talking]',_0x2ca8f0,_0x4fbd('0x69'),_0x58d090['actions'][_0x2ca8f0][_0x4fbd('0x6a')],_0x4fbd('0x6b'),JSON['stringify'](_0x58d090[_0x4fbd('0x23')][_0x58d090[_0x4fbd('0x12')][_0x2ca8f0]['queue']][_0x4fbd('0x5a')]),_0x4fbd('0x6c'),JSON[_0x4fbd('0x54')](_0x58d090[_0x4fbd('0x23')][_0x58d090['actions'][_0x2ca8f0]['queue']]['pTalking']),JSON[_0x4fbd('0x54')](_0x58d090[_0x4fbd('0x12')][_0x2ca8f0][_0x4fbd('0x6d')]),JSON[_0x4fbd('0x54')](_[_0x4fbd('0x6e')](_0x58d090[_0x4fbd('0x12')][_0x2ca8f0],[_0x4fbd('0x6f'),_0x4fbd('0x70'),_0x4fbd('0x71'),_0x4fbd('0x72')])));return ami[_0x4fbd('0x73')]({'action':'status','channel':_0x58d090['actions'][_0x2ca8f0][_0x4fbd('0x74')]})[_0x4fbd('0x75')](function(_0x27d480){if(_0x27d480[_0x4fbd('0x4a')]===_0x4fbd('0x76')){setTimeout(function(){if(_0x58d090[_0x4fbd('0x12')][_0x2ca8f0]){ut[_0x4fbd('0x77')](_0x58d090[_0x4fbd('0x23')][_0x58d090[_0x4fbd('0x12')][_0x2ca8f0]['queue']],_0x4fbd('0x78'));if(_0x58d090[_0x4fbd('0x12')][_0x2ca8f0][_0x4fbd('0x6d')]===!![]){ut[_0x4fbd('0x79')](_0x58d090[_0x4fbd('0x23')][_0x58d090[_0x4fbd('0x12')][_0x2ca8f0][_0x4fbd('0x6a')]],_0x4fbd('0x78'));ut[_0x4fbd('0x7a')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2ca8f0,_0x58d090[_0x4fbd('0x12')][_0x2ca8f0][_0x4fbd('0x6a')]);}ut['loggerError'](_0x4fbd('0x7b')+_0x2ca8f0,_0x58d090[_0x4fbd('0x12')][_0x2ca8f0][_0x4fbd('0x6a')]);delete _0x58d090[_0x4fbd('0x12')][_0x2ca8f0];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x1ef788=this;loggerAction['info'](_0x4fbd('0x7c'),_['size'](this[_0x4fbd('0x12')]));for(var _0xd27193 in this['actions']){if(_0x1ef788[_0x4fbd('0x12')][_0x4fbd('0x5f')](_0xd27193)){_0x1ef788[_0x4fbd('0x65')](_0xd27193);}}};Preview[_0x4fbd('0xe')][_0x4fbd('0x64')]=function(_0x334683){var _0x298015=this;rpcDb['getContactRecallMe'](_0x334683['id'],ut[_0x4fbd('0x7d')](this[_0x4fbd('0x13')]))[_0x4fbd('0x7e')](function(_0x4a72cf){if(!_[_0x4fbd('0x68')](_0x4a72cf)){for(var _0x560754=0x0;_0x560754<_0x4a72cf[_0x4fbd('0x7f')];_0x560754+=0x1){if(ut['getDiff'](_0x4a72cf[_0x560754]['scheduledat'])<_0x334683[_0x4fbd('0x80')]*0x3c){if(_0x4a72cf[_0x560754][_0x4fbd('0x81')]&&!_0x4a72cf[_0x560754]['Agent']['voicePause']){_0x298015['run'](_0x4a72cf[_0x560754]['id'])[_0x4fbd('0x7e')](ut[_0x4fbd('0x82')]('[RecallMe]'))['catch'](ut[_0x4fbd('0x82')](_0x4fbd('0x83')));}else{rpcDb[_0x4fbd('0x84')](_0x4a72cf[_0x560754]['id']);}}else{var _0x5d2a19=new Action(_0x4a72cf[_0x560754],_0x334683);_0x5d2a19['starttime']=moment()[_0x4fbd('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x334683[_0x4fbd('0x3f')]+=0x1;ut['logCustomer'](_0x5d2a19,0x17,_0x4fbd('0x85'));if(_0x334683[_0x4fbd('0x86')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x4a72cf[_0x560754]));rpcDb[_0x4fbd('0x87')](_0x5d2a19,_0x4fbd('0x88'));}else{ut[_0x4fbd('0x89')](_0x5d2a19,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x5d2a19,_0x4fbd('0x8a'));rpcDb['createCustomerFinal'](_0x5d2a19,_0x4fbd('0x8a'));}}}}})[_0x4fbd('0x75')](ut['logger2'](_0x4fbd('0x8b')));};Preview['prototype'][_0x4fbd('0x62')]=function(_0x2b6a8d){_0x2b6a8d[_0x4fbd('0x59')]=!![];if(ut[_0x4fbd('0x8c')](_0x2b6a8d[_0x4fbd('0x2a')])){_0x2b6a8d[_0x4fbd('0x4a')]=_0x4fbd('0x8d');}else if(!ut[_0x4fbd('0x8e')](_0x2b6a8d[_0x4fbd('0x34')])){_0x2b6a8d[_0x4fbd('0x4a')]=_0x4fbd('0x8f');}else if(!this['isTrunkReachable'](_0x2b6a8d[_0x4fbd('0x50')])){if(!this[_0x4fbd('0x90')](_0x2b6a8d['TrunkBackup'])){_0x2b6a8d[_0x4fbd('0x4a')]=_0x4fbd('0x91');}else{_0x2b6a8d[_0x4fbd('0x4a')]='ACTIVE';}}else{_0x2b6a8d['message']='ACTIVE';}emitCampaignPreview(_0x2b6a8d);};Preview[_0x4fbd('0xe')][_0x4fbd('0x92')]=function(_0x43fb24,_0x19f213,_0x4b9ff3){var _0x498709=this;var _0x582f58=this[_0x4fbd('0x12')][_0x19f213];var _0x4ce191=this[_0x4fbd('0x23')][_0x582f58[_0x4fbd('0x6a')]];var _0x3a8d83;var _0x904ad7=![];var _0x44825c=0x2;var _0x841e9=0x3;if(_0x4ce191){switch(_0x4b9ff3){case'1':_0x4ce191['outboundNoSuchCallsDay']+=0x1;_0x582f58[_0x4fbd('0x93')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0x0,_0x4fbd('0x96'));ami['emit'](_0x4fbd('0x97'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0x99')));rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0x9a'));_0x498709[_0x4fbd('0x9b')](_0x582f58,'0',_0x4ce191)[_0x4fbd('0x7e')](function(_0xe68ef9){_0x904ad7=_0xe68ef9[_0x4fbd('0x9c')]==0x1;_0x44825c=_0x4ce191['dialNoSuchNumberRetryFrequency'];_0x841e9=_0x4ce191[_0x4fbd('0x9d')];if(!_0x904ad7){if(ut[_0x4fbd('0x95')](_0x582f58)>=_0x4ce191[_0x4fbd('0x9e')]){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0xf,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,_0x4fbd('0xa2'));}else{if(_0x582f58[_0x4fbd('0x93')]>=_0x4ce191[_0x4fbd('0xa3')]){rpcDb[_0x4fbd('0xa1')](_0x582f58,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x4fbd('0xa4')](ut[_0x4fbd('0xa5')](_0x582f58,_0x4fbd('0x93'),_0x4ce191[_0x4fbd('0xa6')]),_0x582f58[_0x4fbd('0xa7')],_0x582f58[_0x4fbd('0xa8')]);}}delete this['actions'][_0x43fb24[_0x4fbd('0xa9')]];}else{_0x582f58['countnosuchnumberretry']++;logger[_0x4fbd('0x57')]('actioncountonusuch',_0x582f58[_0x4fbd('0x93')]);logger[_0x4fbd('0x57')]('id',_0x582f58['idContact']);_0x498709['incrementPreviewCounters']({'id':_0x582f58[_0x4fbd('0xaa')],'field':{'countnosuchnumberretry':_0x582f58[_0x4fbd('0x93')]}})[_0x4fbd('0x7e')](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});break;case _0x4fbd('0xac'):var _0x6561dd=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x582f58['responsetime']=_0x6561dd;_0x582f58[_0x4fbd('0xad')]=_0x6561dd;_0x582f58[_0x4fbd('0x6d')]=!![];_0x4ce191[_0x4fbd('0x2b')]+=0x1;logger[_0x4fbd('0x57')](_0x4fbd('0xae'),_0x582f58[_0x4fbd('0xaf')],_0x4fbd('0xb0'),_0x4ce191[_0x4fbd('0x26')],_0x4fbd('0x6c'),_0x4ce191[_0x4fbd('0x2b')]);ami[_0x4fbd('0x24')](_0x4fbd('0xb1'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xb2'),this[_0x4fbd('0x23')][_0x582f58[_0x4fbd('0x6a')]]));if(_0x4ce191[_0x4fbd('0xb3')]){ami['emit']('custom:agentConnectPreview',ut['buildAcw'](_0x582f58));}break;case'16':ami['emit'](_0x4fbd('0xb4'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xb5'),this['campaignsPreview'][_0x582f58['queue']]));emitVoiceQueueChannelRemove(ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xb5')));_0x4ce191[_0x4fbd('0xb6')]+=0x1;_0x4ce191[_0x4fbd('0x30')]+=0x1;_0x4ce191['answered']+=0x1;ut[_0x4fbd('0x79')](_0x4ce191,_0x4fbd('0xb7'));_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0x4,'Answer');rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xb8'));rpcDb[_0x4fbd('0xa1')](_0x582f58,_0x4fbd('0xb9'));rpcDb[_0x4fbd('0xba')](_0x582f58);_0x4ce191['sumDuration']+=_0x582f58[_0x4fbd('0xbb')];_0x4ce191[_0x4fbd('0x2c')]+=_0x582f58[_0x4fbd('0xbb')];logger[_0x4fbd('0x57')](_0x4fbd('0xbc'),_0x582f58['uniqueid'],_0x4fbd('0xb0'),_0x4ce191[_0x4fbd('0x26')],'pTalking:\x20',_0x4ce191[_0x4fbd('0x2b')]);delete this[_0x4fbd('0x12')][_0x43fb24['linkedid']];break;case _0x4fbd('0xbd'):_0x4ce191['outboundBusyCallsDay']+=0x1;_0x582f58[_0x4fbd('0xbe')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut['logCustomer'](_0x582f58,0x5,_0x4fbd('0xbf'));_0x44825c=_0x4ce191[_0x4fbd('0xc0')];_0x841e9=_0x4ce191[_0x4fbd('0x9d')];ami['emit'](_0x4fbd('0xc1'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xc2')));rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xc3'));_0x498709['verifyAdditionalPhones'](_0x582f58,'5',_0x4ce191)['then'](function(_0x5b2462){_0x904ad7=_0x5b2462[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut['totalGlobal'](_0x582f58)>=_0x4ce191['dialGlobalMaxRetry']){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0xf,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,_0x4fbd('0xc4'));}else{if(_0x582f58[_0x4fbd('0xbe')]>=_0x4ce191[_0x4fbd('0xc5')]){rpcDb[_0x4fbd('0xa1')](_0x582f58,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x4fbd('0xa4')](ut[_0x4fbd('0xa5')](_0x582f58,'countbusyretry',_0x4ce191[_0x4fbd('0xc0')]),_0x582f58['unlockAgent'],_0x582f58[_0x4fbd('0xa8')]);}}}else{_0x582f58[_0x4fbd('0xbe')]++;_0x498709[_0x4fbd('0xc6')]({'id':_0x582f58[_0x4fbd('0xaa')],'field':{'countbusyretry':_0x582f58[_0x4fbd('0xbe')]}})[_0x4fbd('0x7e')](function(){_0x498709['swapAdditionalPhones'](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});break;case'NOANSWER':_0x4ce191[_0x4fbd('0x3d')]+=0x1;_0x582f58[_0x4fbd('0xc7')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut['logCustomer'](_0x582f58,0x3,_0x4fbd('0xc8'));_0x44825c=_0x4ce191[_0x4fbd('0xc9')];_0x841e9=_0x4ce191[_0x4fbd('0x9d')];var _0x16e75a=ut[_0x4fbd('0xca')](_0x582f58,_0x4ce191);ami[_0x4fbd('0x24')](_0x4fbd('0xcb'),_0x16e75a);rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xcc'));_0x498709['verifyAdditionalPhones'](_0x582f58,'3',_0x4ce191)['then'](function(_0x4ba66e){_0x904ad7=_0x4ba66e[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut['totalGlobal'](_0x582f58)>=_0x4ce191[_0x4fbd('0x9e')]){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0xf,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x582f58[_0x4fbd('0xc7')]>=_0x4ce191['dialNoAnswerMaxRetry']){rpcDb[_0x4fbd('0xa1')](_0x582f58,_0x4fbd('0xcc'));}else{rpcDb['rescheduleContact'](ut[_0x4fbd('0xa5')](_0x582f58,_0x4fbd('0xc7'),_0x4ce191[_0x4fbd('0xc9')]),_0x582f58[_0x4fbd('0xa7')],_0x582f58['activeContact']);}}}else{_0x582f58[_0x4fbd('0xc7')]++;_0x498709[_0x4fbd('0xc6')]({'id':_0x582f58[_0x4fbd('0xaa')],'field':{'countnoanswerretry':_0x582f58['countnoanswerretry']}})['then'](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});break;case _0x4fbd('0xcd'):_0x4ce191[_0x4fbd('0xce')]+=0x1;_0x582f58[_0x4fbd('0xcf')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut['totalGlobal'](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0x8,_0x4fbd('0xd0'));_0x44825c=_0x4ce191[_0x4fbd('0xd1')];_0x841e9=_0x4ce191[_0x4fbd('0x9d')];ami[_0x4fbd('0x24')](_0x4fbd('0xd2'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xd3')));rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xd4'));_0x498709['verifyAdditionalPhones'](_0x582f58,'8',_0x4ce191)[_0x4fbd('0x7e')](function(_0x3c2a23){_0x904ad7=_0x3c2a23['additional']==0x1;if(!_0x904ad7){if(ut['totalGlobal'](_0x582f58)>=_0x4ce191['dialGlobalMaxRetry']){_0x3a8d83=ut['cloneAction'](_0x582f58,0xf,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,_0x4fbd('0xd5'));}else{if(_0x582f58['countcongestionretry']>=_0x4ce191['dialCongestionMaxRetry']){rpcDb[_0x4fbd('0xa1')](_0x582f58,_0x4fbd('0xd4'));}else{rpcDb['rescheduleContact'](ut[_0x4fbd('0xa5')](_0x582f58,_0x4fbd('0xcf'),_0x4ce191[_0x4fbd('0xc0')]),_0x582f58[_0x4fbd('0xa7')],_0x582f58[_0x4fbd('0xa8')]);}}}else{_0x582f58[_0x4fbd('0xcf')]++;_0x498709[_0x4fbd('0xc6')]({'id':_0x582f58[_0x4fbd('0xaa')],'field':{'countcongestionretry':_0x582f58[_0x4fbd('0xcf')]}})[_0x4fbd('0x7e')](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});break;case _0x4fbd('0xd6'):_0x4ce191[_0x4fbd('0x40')]+=0x1;_0x582f58[_0x4fbd('0xd7')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut['logCustomer'](_0x582f58,0x14,'AgentReject');_0x44825c=_0x4ce191['dialAgentRejectRetryFrequency'];_0x841e9=_0x4ce191[_0x4fbd('0x9d')];ami[_0x4fbd('0x24')](_0x4fbd('0xd8'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xd9')));rpcDb['createCustomerHistory'](_0x582f58,_0x4fbd('0xda'));_0x498709['verifyAdditionalPhones'](_0x582f58,'20',_0x4ce191)[_0x4fbd('0x7e')](function(_0xe9d802){_0x904ad7=_0xe9d802[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut[_0x4fbd('0x95')](_0x582f58)>=_0x4ce191[_0x4fbd('0x9e')]){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0x14,'AgentReject');rpcDb[_0x4fbd('0xa1')](_0x3a8d83,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x582f58['countagentrejectretry']>=_0x4ce191['dialAgentRejectMaxRetry']){rpcDb[_0x4fbd('0xa1')](_0x582f58,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x4fbd('0xa4')](ut[_0x4fbd('0xa5')](_0x582f58,'countagentrejectretry',_0x4ce191[_0x4fbd('0xdb')]),_0x582f58[_0x4fbd('0xa7')],_0x582f58['activeContact']);}}}else{_0x582f58[_0x4fbd('0xc7')]++;_0x498709['incrementPreviewCounters']({'id':_0x582f58['idContact'],'field':{'countnoanswerretry':_0x582f58[_0x4fbd('0xc7')]}})[_0x4fbd('0x7e')](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});break;case'ABANDONED':_0x4ce191[_0x4fbd('0xdc')]+=0x1;_0x582f58[_0x4fbd('0xdd')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0xb,'Abandoned');rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xde'));_0x498709['verifyAdditionalPhones'](_0x582f58,'11',_0x4ce191)[_0x4fbd('0x7e')](function(_0x28b61b){_0x904ad7=_0x28b61b[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut[_0x4fbd('0x95')](_0x582f58)>=_0x4ce191[_0x4fbd('0x9e')]){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0xf,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,_0x4fbd('0xde'));}else{if(_0x582f58['countabandonedetry']>=_0x4ce191[_0x4fbd('0xdf')]){rpcDb[_0x4fbd('0xa1')](_0x582f58,_0x4fbd('0xde'));}else{rpcDb[_0x4fbd('0xa4')](ut[_0x4fbd('0xa5')](_0x582f58,_0x4fbd('0xdd'),_0x4ce191['dialAbandonedRetryFrequency']),_0x582f58[_0x4fbd('0xa7')],_0x582f58[_0x4fbd('0xa8')]);}}}else{_0x582f58['countnoanswerretry']++;_0x498709[_0x4fbd('0xc6')]({'id':_0x582f58[_0x4fbd('0xaa')],'field':{'countnoanswerretry':_0x582f58['countnoanswerretry']}})[_0x4fbd('0x7e')](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});break;case'18':_0x4ce191[_0x4fbd('0xe0')]+=0x1;_0x582f58[_0x4fbd('0xe1')]+=0x1;_0x582f58['countglobal']=ut['totalGlobal'](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0x12,_0x43fb24[_0x4fbd('0xe2')]||_0x43fb24[_0x4fbd('0xe3')]);ami['emit'](_0x4fbd('0xe4'),ut[_0x4fbd('0x98')](_0x582f58,'amd'));rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xe5'));_0x498709[_0x4fbd('0x9b')](_0x582f58,'18',_0x4ce191)[_0x4fbd('0x7e')](function(_0x3b2996){_0x904ad7=_0x3b2996[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut[_0x4fbd('0x95')](_0x582f58)>=_0x4ce191['dialGlobalMaxRetry']){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0x12,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x582f58,_0x4fbd('0xe5'));}}else{_0x582f58[_0x4fbd('0xc7')]++;_0x498709[_0x4fbd('0xc6')]({'id':_0x582f58['idContact'],'field':{'countnoanswerretry':_0x582f58[_0x4fbd('0xc7')]}})[_0x4fbd('0x7e')](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});delete this[_0x4fbd('0x12')][_0x43fb24[_0x4fbd('0xa9')]];break;case'19':_0x4ce191[_0x4fbd('0xe0')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0x13,_0x43fb24[_0x4fbd('0xe2')]||_0x43fb24['dialstatus']);ami['emit'](_0x4fbd('0xe4'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xe6')));rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xe7'));_0x498709[_0x4fbd('0x9b')](_0x582f58,'18',_0x4ce191)[_0x4fbd('0x7e')](function(_0x26f448){_0x904ad7=_0x26f448[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut[_0x4fbd('0x95')](_0x582f58)>=_0x4ce191['dialGlobalMaxRetry']){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0xf,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,_0x4fbd('0xe7'));}else{rpcDb[_0x4fbd('0xa1')](_0x582f58,'[callProgressDetectingCustomer][machine]');}}else{_0x582f58[_0x4fbd('0xc7')]++;_0x498709[_0x4fbd('0xc6')]({'id':_0x582f58[_0x4fbd('0xaa')],'field':{'countnoanswerretry':_0x582f58['countnoanswerretry']}})[_0x4fbd('0x7e')](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)['then'](function(){});});}});delete this[_0x4fbd('0x12')][_0x43fb24[_0x4fbd('0xa9')]];break;default:if(_0x582f58['dialAnswer']){ut['decrementTalkink'](_0x4ce191,_0x4fbd('0xe8'));ut[_0x4fbd('0x7a')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x4ce191[_0x4fbd('0x26')],_0x43fb24);}_0x4ce191[_0x4fbd('0xe0')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0xc,_0x43fb24[_0x4fbd('0xe2')]||_0x43fb24[_0x4fbd('0xe3')]);_0x44825c=_0x4ce191[_0x4fbd('0xdb')];_0x841e9=_0x4ce191[_0x4fbd('0x9d')];rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xe9'));_0x498709[_0x4fbd('0x9b')](_0x582f58,'20',_0x4ce191)[_0x4fbd('0x7e')](function(_0x2bc4e1){_0x904ad7=_0x2bc4e1[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut[_0x4fbd('0x95')](_0x582f58)>=_0x4ce191[_0x4fbd('0x9e')]){_0x3a8d83=ut['cloneAction'](_0x582f58,0xf,'Global');rpcDb[_0x4fbd('0xa1')](_0x3a8d83,_0x4fbd('0xea'));}else{rpcDb[_0x4fbd('0xa1')](_0x582f58,_0x4fbd('0xea'));}delete this[_0x4fbd('0x12')][_0x43fb24[_0x4fbd('0xa9')]];}else{_0x498709['swapAdditionalPhones'](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});}});}if(!(_0x582f58[_0x4fbd('0x6d')]&&_0x4b9ff3==='16')){ut['updateOriginated'](_0x4ce191,'[callProgressDetectingCustomer]');logger[_0x4fbd('0x57')](_0x4fbd('0xeb'),_0x582f58[_0x4fbd('0xaf')],_0x4fbd('0xb0'),_0x4ce191[_0x4fbd('0x26')],_0x4fbd('0x6b'),_0x4ce191[_0x4fbd('0x5a')]);}if(_0x4b9ff3!==_0x4fbd('0xac')){delete this[_0x4fbd('0x12')][_0x43fb24[_0x4fbd('0xa9')]];delete this[_0x4fbd('0x12')][_0x43fb24['destlinkedid']];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x3045a8,_0x4f53a8,_0x9fdb42){if(_['isUndefined'](_0x4f53a8)&&_0x4fbd('0xec')!==typeof _0x4f53a8){return;}if(_[_0x4fbd('0xed')](_0x9fdb42)&&_0x4fbd('0xec')!==typeof _0x9fdb42){return;}switch(_0x9fdb42[_0x4fbd('0xee')]){case'0':ut['logAgent'](_0x3045a8,0x0,_0x4fbd('0x96'));rpcDb['createAgentHistory'](_0x3045a8,_0x4fbd('0xef'));break;case'3':ut[_0x4fbd('0xf0')](_0x3045a8,0x3,_0x4fbd('0xc8'));rpcDb[_0x4fbd('0xf1')](_0x3045a8,_0x4fbd('0xf2'));break;case'5':ut[_0x4fbd('0xf0')](_0x3045a8,0x5,'Busy');rpcDb['createAgentHistory'](_0x3045a8,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x4fbd('0xf0')](_0x3045a8,0x8,_0x4fbd('0xd0'));rpcDb[_0x4fbd('0xf1')](_0x3045a8,_0x4fbd('0xf3'));break;case'22':ut['logAgent'](_0x3045a8,0x16,'AnswerAGI');rpcDb[_0x4fbd('0xf1')](_0x3045a8,_0x4fbd('0xf4'));break;default:ut[_0x4fbd('0xf0')](_0x3045a8,0xc,_0x9fdb42[_0x4fbd('0xee')]);rpcDb['createAgentHistory'](_0x3045a8,_0x4fbd('0xf3'));}ut['updateOriginated'](_0x4f53a8,_0x4fbd('0xf5'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x3045a8[_0x4fbd('0xaf')],_0x4fbd('0xb0'),_0x4f53a8['name'],'originated:\x20',_0x4f53a8[_0x4fbd('0x5a')]);delete this[_0x4fbd('0x12')][_0x3045a8[_0x4fbd('0xaf')]];};Preview[_0x4fbd('0xe')][_0x4fbd('0x9b')]=function(_0xfaf899,_0x44b652,_0x18f6a3){return Promise[_0x4fbd('0xf6')]()[_0x4fbd('0x7e')](cmHopperAdditionalPhone[_0x4fbd('0x9b')](_0xfaf899,_0x44b652,_0x18f6a3))[_0x4fbd('0x75')](logger[_0x4fbd('0x57')](_0x4fbd('0xf7')));};Preview[_0x4fbd('0xe')]['swapAdditionalPhones']=function(_0x1bdbf0,_0x503fbd,_0x378b57){return Promise[_0x4fbd('0xf6')]()[_0x4fbd('0x7e')](cmHopperAdditionalPhone[_0x4fbd('0xab')](_0x1bdbf0,_0x503fbd,_0x378b57))[_0x4fbd('0x75')](logger[_0x4fbd('0x57')](_0x4fbd('0xf8')));};Preview['prototype']['incrementPreviewCounters']=function(_0xaa649a){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0x4fbd('0xc6')](_0xaa649a))[_0x4fbd('0x75')](logger[_0x4fbd('0x57')](_0x4fbd('0xf9')));};Preview[_0x4fbd('0xe')][_0x4fbd('0xfa')]=function(_0x5dbd9b,_0x3e695b,_0x3a4c3b,_0x325fd2,_0x36d9d7){var _0x36f018=this;return new Promise(function(_0x266205,_0x491f8c){if(_[_0x4fbd('0x68')](_0x3e695b)||_[_0x4fbd('0x68')](_0x3e695b[_0x4fbd('0xfb')])||_['isNil'](_0x3e695b[_0x4fbd('0xfc')])||_['isNil'](_0x3e695b['VoiceQueueId'])){_0x491f8c(ut[_0x4fbd('0x4a')](_0x4fbd('0xfd'),_0x325fd2,_0x36d9d7));return;}var _0x4620e2=uuid['v4']();var _0x25e187=_0x36f018[_0x4fbd('0x23')][_0x3e695b[_0x4fbd('0x69')][_0x4fbd('0x26')]];var _0x294554=_0x3a4c3b?_0x36f018['agents'][_0x3a4c3b]['id']:undefined;_0x36f018[_0x4fbd('0x12')][_0x4620e2]=new Action(_0x3e695b,_0x25e187,_0x4620e2,_0x3a4c3b,_0x294554);var _0x5f326a=_0x36f018[_0x4fbd('0x12')][_0x4620e2];_0x5f326a['unlockAgent']=_0x325fd2;_0x5f326a['activeContact']=_0x36d9d7;_0x5f326a['lookAgent']=_0x3a4c3b;if(_[_0x4fbd('0xfe')](_0x5dbd9b)){_0x36f018[_0x4fbd('0xff')](_0x5f326a,_0x25e187,_0x3e695b,_0x3a4c3b)['then'](function(_0x4c4131){logger[_0x4fbd('0x57')]('[Preview][execCall][success]',_0x4fbd('0x100')+_0x5f326a[_0x4fbd('0x6a')]+_0x4fbd('0x101')+_0x5f326a[_0x4fbd('0xaa')],JSON[_0x4fbd('0x54')](_0x4c4131));ami[_0x4fbd('0x24')](_0x4fbd('0x102'),ut[_0x4fbd('0x98')](_0x5f326a,_0x4fbd('0x103'),_0x36f018[_0x4fbd('0x23')][_0x5f326a[_0x4fbd('0x6a')]]));_0x266205(ut[_0x4fbd('0x4a')](_0x4fbd('0x104')));})['catch'](function(_0x175239){ut[_0x4fbd('0x105')](_0x4fbd('0x106'),_0x175239);_0x491f8c(ut['message'](_0x4fbd('0x107'),_0x325fd2,_0x36d9d7));});}else{_0x25e187[_0x4fbd('0x108')]+=0x1;ut[_0x4fbd('0x109')](_0x5f326a);rpcDb[_0x4fbd('0x10a')](_0x5f326a,'[Blacklist][error]');delete _0x36f018[_0x4fbd('0x12')][_0x4620e2];_0x491f8c(ut[_0x4fbd('0x4a')](_0x4fbd('0x10b'),_0x325fd2,_0x36d9d7));}});};Preview[_0x4fbd('0xe')][_0x4fbd('0x90')]=function(_0x2aabf9){return!_['isNil'](_0x2aabf9)&&!_[_0x4fbd('0x68')](_0x2aabf9[_0x4fbd('0x26')])&&!_['isNil'](_0x2aabf9[_0x4fbd('0x51')])&&_0x2aabf9[_0x4fbd('0x51')]&&!_[_0x4fbd('0x68')](this[_0x4fbd('0x11')][util[_0x4fbd('0x55')](_0x4fbd('0x10c'),_0x2aabf9['name'])])&&!_[_0x4fbd('0x68')](this[_0x4fbd('0x11')][util[_0x4fbd('0x55')](_0x4fbd('0x10c'),_0x2aabf9[_0x4fbd('0x26')])]['status'])&&(this[_0x4fbd('0x11')][util['format'](_0x4fbd('0x10c'),_0x2aabf9['name'])][_0x4fbd('0x10d')]===_0x4fbd('0x10e')||this['trunks'][util['format'](_0x4fbd('0x10c'),_0x2aabf9[_0x4fbd('0x26')])][_0x4fbd('0x10d')]===_0x4fbd('0x10f'));};Preview['prototype'][_0x4fbd('0x110')]=function(_0x4bb0ad,_0x4b24dc){var _0x533284=this;return new Promise(function(_0x1de862,_0xc96e89){_0x533284['execRun'](_0x4bb0ad,_0x4b24dc)[_0x4fbd('0x7e')](function(_0x3a6a80){_0x1de862(_[_0x4fbd('0x6e')](_0x3a6a80,[_0x4fbd('0x4a')]));})['catch'](function(_0x1ee3a7){if(_0x1ee3a7[_0x4fbd('0x111')]){rpcDb[_0x4fbd('0x112')](_0x4bb0ad);}if(_0x1ee3a7[_0x4fbd('0x51')]){rpcDb[_0x4fbd('0x84')](_0x4bb0ad);}_0xc96e89(_[_0x4fbd('0x6e')](_0x1ee3a7,['message']));});});};Preview['prototype'][_0x4fbd('0x113')]=function(_0x1daa42,_0x35c381){var _0x58c76b=this;return new Promise(function(_0x4b7212,_0x4d6858){var _0x126093,_0x2a96bd;rpcDb[_0x4fbd('0x114')](_0x1daa42)[_0x4fbd('0x7e')](function(_0x514d38){if(!_['isNil'](_0x514d38[0x0])){_0x2a96bd=_0x514d38[0x0][_0x4fbd('0x115')]?![]:!![];_0x126093=_0x514d38[0x0][_0x4fbd('0x115')]?!![]:![];_0x126093=_0x35c381?!![]:_0x126093;}var _0x124e5d=_0x58c76b[_0x4fbd('0x116')](_0x514d38);if(_0x124e5d[_0x4fbd('0x117')]){rpcDb[_0x4fbd('0x118')](_[_0x4fbd('0x6e')](_0x514d38[0x0],[_0x4fbd('0x71'),_0x4fbd('0xfc')]))[_0x4fbd('0x7e')](function(_0x32e6f7){_0x58c76b[_0x4fbd('0xfa')](_0x32e6f7,_0x514d38[0x0],_0x35c381,_0x2a96bd,_0x126093)['then'](function(_0x5ac6eb){_0x4b7212(_0x5ac6eb);})['catch'](function(_0x1b7f6f){_0x4d6858(_0x1b7f6f);});})[_0x4fbd('0x75')](function(_0x272f88){ut['logger'](_0x4fbd('0x119'),_0x272f88);_0x4d6858(ut['message'](_0x4fbd('0x11a'),_0x2a96bd,_0x126093));});}else{_0x4d6858(ut[_0x4fbd('0x4a')](_0x124e5d['message'],_0x2a96bd,_0x126093));}})[_0x4fbd('0x75')](function(_0x10ba7f){ut['logger'](_0x4fbd('0x11b'),_0x10ba7f);_0x4d6858(ut['message'](_0x4fbd('0x11a'),![],!![]));});});};Preview[_0x4fbd('0xe')][_0x4fbd('0x116')]=function(_0x3c41c4){if(_[_0x4fbd('0x68')](_0x3c41c4)||_[_0x4fbd('0xfe')](_0x3c41c4)||!_[_0x4fbd('0x68')](_0x3c41c4[0x0][_0x4fbd('0x81')])&&_[_0x4fbd('0x68')](_0x3c41c4[0x0][_0x4fbd('0x81')][_0x4fbd('0x26')])){ut['logger'](_0x4fbd('0x11c'),_0x3c41c4);return{'isValid':![],'message':_0x4fbd('0x11d')};}var _0xf18bb7=this[_0x4fbd('0x23')][_0x3c41c4[0x0][_0x4fbd('0x69')][_0x4fbd('0x26')]];_0xf18bb7[_0x4fbd('0x4a')]=_0x4fbd('0x11e');if(_[_0x4fbd('0x68')](_0xf18bb7)){ut[_0x4fbd('0x105')](_0x4fbd('0x11f'),_0xf18bb7);return{'isValid':![],'message':_0x4fbd('0x120')};}if(!this[_0x4fbd('0x90')](_0xf18bb7[_0x4fbd('0x50')])){ut['logger'](_0x4fbd('0x121'),_0x4fbd('0x122')+_0xf18bb7[_0x4fbd('0x26')]+_0x4fbd('0x123'));if(!this[_0x4fbd('0x90')](_0xf18bb7[_0x4fbd('0x124')])){ut[_0x4fbd('0x105')](_0x4fbd('0x121'),_0xf18bb7[_0x4fbd('0x26')]+_0x4fbd('0x125'));return{'isValid':![],'message':_0x4fbd('0x126')};}}if(!ut['isActive'](_0xf18bb7['dialActive'])){ut['logger'](_0x4fbd('0x127'),_0xf18bb7[_0x4fbd('0x26')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x4fbd('0x122')+_0xf18bb7[_0x4fbd('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x4fbd('0x128')};};Preview['prototype']['execCall']=function(_0x50e075,_0x55a9d4,_0x136b0b,_0x2a26f9){var _0x2d1bbf=this;return new Promise(function(_0x889845,_0x3e107f){var _0x2c31fa=_0x50e075[_0x4fbd('0xaf')];var _0xfaf6a4=_0x2d1bbf[_0x4fbd('0x90')](_0x55a9d4['Trunk'])?util['format'](_0x4fbd('0x129'),_0x55a9d4[_0x4fbd('0x50')]['name'],_[_0x4fbd('0x68')](_0x55a9d4[_0x4fbd('0x37')])?'':_0x55a9d4[_0x4fbd('0x37')][_0x4fbd('0x12a')]()||'',_0x55a9d4[_0x4fbd('0x12b')]>0x0?_0x136b0b['phone']['substring'](_0x55a9d4['dialCutDigit']):_0x136b0b[_0x4fbd('0xfc')]):util[_0x4fbd('0x55')](_0x4fbd('0x129'),_[_0x4fbd('0x68')](_0x55a9d4['TrunkBackup'])?_0x55a9d4['Trunk'][_0x4fbd('0x26')]:_0x55a9d4['TrunkBackup'][_0x4fbd('0x26')],_['isNil'](_0x55a9d4['dialPrefix'])?'':_0x55a9d4[_0x4fbd('0x37')][_0x4fbd('0x12a')]()||'',_0x55a9d4[_0x4fbd('0x12b')]>0x0?_0x136b0b['phone'][_0x4fbd('0x12c')](_0x55a9d4[_0x4fbd('0x12b')]):_0x136b0b[_0x4fbd('0xfc')]);var _0x4fdda8=_0x2d1bbf[_0x4fbd('0x90')](_0x55a9d4[_0x4fbd('0x50')])?ut[_0x4fbd('0x12d')](_0x55a9d4[_0x4fbd('0x50')][_0x4fbd('0x52')],_0x55a9d4['dialOriginateCallerIdName'],_0x55a9d4[_0x4fbd('0x12e')]>0x0?ut[_0x4fbd('0x12f')](_0x55a9d4['dialOriginateCallerIdNumber'],_0x55a9d4[_0x4fbd('0x12e')]):_0x55a9d4[_0x4fbd('0x130')]):ut['getCallerId'](_[_0x4fbd('0x68')](_0x55a9d4[_0x4fbd('0x124')])?_0x55a9d4[_0x4fbd('0x50')][_0x4fbd('0x52')]:_0x55a9d4[_0x4fbd('0x124')][_0x4fbd('0x52')],_0x55a9d4[_0x4fbd('0x35')],_0x55a9d4['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x4fbd('0x12f')](_0x55a9d4['dialOriginateCallerIdNumber'],_0x55a9d4[_0x4fbd('0x12e')]):_0x55a9d4[_0x4fbd('0x130')]);if(_0x4fdda8){_0x50e075[_0x4fbd('0x131')]=ut[_0x4fbd('0x132')](_0x4fdda8);_0x50e075['originatecalleridnum']=ut[_0x4fbd('0x133')](_0x4fdda8);}var _0x204e5a=ut[_0x4fbd('0x134')](_0x55a9d4,_0x136b0b,_0xfaf6a4,_0x4fdda8,_0x2c31fa,_0x50e075);_[_0x4fbd('0x135')](_0x50e075,ut['toLowerVariables'](_0x204e5a));_0x50e075['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55a9d4[_0x4fbd('0x136')]=_0x204e5a;ami[_0x4fbd('0x73')](ut[_0x4fbd('0x137')](_0x50e075,_0x55a9d4,_0x204e5a,_0x50e075[_0x4fbd('0xa8')],_0x2a26f9))[_0x4fbd('0x7e')](function(_0xf8efbc){_0x55a9d4['originated']+=0x1;logger[_0x4fbd('0x57')](_0x4fbd('0x138'),_0x2c31fa,_0x4fbd('0xb0'),_0x55a9d4[_0x4fbd('0x26')],_0x4fbd('0x6b'),_0x55a9d4[_0x4fbd('0x5a')]);_0x889845(_0xf8efbc);})[_0x4fbd('0x75')](function(_0x3e5c8f){ut[_0x4fbd('0xf0')](_0x50e075,0xe,_0x4fbd('0x139'));rpcDb['createAgentHistory'](_0x50e075,_0x4fbd('0x13a'));_0x3e107f(_0x3e5c8f);});});};Preview['prototype'][_0x4fbd('0x1e')]=function(_0x4ce09a){if(this[_0x4fbd('0x12')][_0x4ce09a[_0x4fbd('0xa9')]]){this[_0x4fbd('0x12')][_0x4ce09a[_0x4fbd('0xa9')]][_0x4fbd('0x74')]=_0x4ce09a[_0x4fbd('0x74')];}};Preview[_0x4fbd('0xe')][_0x4fbd('0x16')]=function(_0x2003ca){var _0x1f482b=this;var _0x521d1f=this[_0x4fbd('0x12')][_0x2003ca[_0x4fbd('0x13b')]];if(_0x521d1f){if(_0x521d1f['lookAgent']&&this['agents'][_0x521d1f['lookAgent']]){ut[_0x4fbd('0x13c')](_0x521d1f,this[_0x4fbd('0x13')][_0x521d1f['lookAgent']][_0x4fbd('0x26')],this[_0x4fbd('0x13')][_0x521d1f[_0x4fbd('0x13d')]]['id']);}var _0x1fa98c=_['clone'](_0x521d1f);_0x1fa98c[_0x4fbd('0x13e')]=moment()[_0x4fbd('0x55')](_0x4fbd('0x13f'));var _0x4be990=_0x1f482b[_0x4fbd('0x23')][_0x521d1f[_0x4fbd('0x6a')]];if(ut[_0x4fbd('0x140')](_0x2003ca[_0x4fbd('0x141')])){if(_0x521d1f[_0x4fbd('0xa7')]){rpcDb[_0x4fbd('0x112')](_0x521d1f[_0x4fbd('0xaa')]);}if(_0x521d1f[_0x4fbd('0xa8')]){rpcDb['disableContact'](_0x521d1f[_0x4fbd('0xaa')]);}ami[_0x4fbd('0x24')](_0x4fbd('0x142'),ut[_0x4fbd('0x98')](_0x521d1f,_0x4fbd('0x143'),this[_0x4fbd('0x23')][_0x521d1f[_0x4fbd('0x6a')]]));this[_0x4fbd('0x144')](_0x1fa98c,_0x4be990,_0x2003ca);}else{_0x521d1f[_0x4fbd('0x145')]=moment()[_0x4fbd('0x55')](_0x4fbd('0x13f'));ut[_0x4fbd('0xf0')](_0x1fa98c,0x4,_0x4fbd('0x146'));rpcDb[_0x4fbd('0xf1')](_0x1fa98c,_0x4fbd('0x147'));}}};Preview[_0x4fbd('0xe')][_0x4fbd('0x19')]=function(_0x5c19bd){var _0x5e275a=this[_0x4fbd('0x12')][_0x5c19bd[_0x4fbd('0xa9')]];var _0xd7530;if(_0x5e275a){_0xd7530=this[_0x4fbd('0x23')][_0x5e275a['queue']];logger[_0x4fbd('0x57')]('[syncHangup][talking]',_0x5c19bd[_0x4fbd('0xa9')],'\x20Queue',_0xd7530[_0x4fbd('0x26')],_0x4fbd('0x6c'),_0xd7530[_0x4fbd('0x2b')]);}if(this[_0x4fbd('0x12')][_0x5c19bd[_0x4fbd('0xa9')]]&&_0x5c19bd[_0x4fbd('0xa9')]!==_0x5c19bd[_0x4fbd('0xaf')]){if(_0x5c19bd[_0x4fbd('0x148')]==='16'&&this[_0x4fbd('0x12')][_0x5c19bd['linkedid']][_0x4fbd('0x6d')]){this[_0x4fbd('0x92')](_0x5c19bd,_0x5c19bd['linkedid'],_0x5c19bd['cause']);}else if(this[_0x4fbd('0x12')][_0x5c19bd[_0x4fbd('0xa9')]]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x5c19bd[_0x4fbd('0xa9')],_0x5c19bd[_0x4fbd('0x148')],'\x20Queue',_0xd7530[_0x4fbd('0x26')],'pTalking:\x20',_0xd7530['pTalking']);this[_0x4fbd('0x92')](_0x5c19bd,_0x5c19bd[_0x4fbd('0xa9')],_0x5c19bd['cause']);}}else if(_0x5e275a&&_['isNil'](_0x5e275a[_0x4fbd('0x149')])&&_0xd7530[_0x4fbd('0x14a')]&&_0x5c19bd[_0x4fbd('0xa9')]===_0x5c19bd[_0x4fbd('0xaf')]&&_[_0x4fbd('0x68')](_0x5c19bd['reason'])&&_0x5c19bd[_0x4fbd('0x148')]==='16'&&_0x5c19bd['channelstate']==='6'&&_[_0x4fbd('0xed')](_0x5e275a[_0x4fbd('0x14b')])){if(_0x5e275a[_0x4fbd('0xa7')]){rpcDb[_0x4fbd('0x112')](_0x5e275a[_0x4fbd('0xaa')]);}if(_0x5e275a['activeContact']){rpcDb[_0x4fbd('0x84')](_0x5e275a[_0x4fbd('0xaa')]);}_0x5c19bd[_0x4fbd('0xee')]='22';this['callProgressDetectingAgent'](_0x5e275a,_0xd7530,_0x5c19bd);}else if(_0x5e275a&&_0x5e275a['transfer']){if(_0x5c19bd[_0x4fbd('0x148')]==='16'&&this[_0x4fbd('0x12')][_0x5c19bd[_0x4fbd('0xa9')]][_0x4fbd('0x6d')]){logger[_0x4fbd('0x57')]('[syncHangup][talking][transfer]',_0x5c19bd['linkedid'],_0x5c19bd[_0x4fbd('0x148')],_0x4fbd('0xb0'),_0xd7530[_0x4fbd('0x26')],_0x4fbd('0x6c'),_0xd7530[_0x4fbd('0x2b')]);this[_0x4fbd('0x92')](_0x5c19bd,_0x5c19bd['linkedid'],_0x5c19bd['cause']);}else if(this[_0x4fbd('0x12')][_0x5c19bd[_0x4fbd('0xa9')]][_0x4fbd('0x6d')]){logger[_0x4fbd('0x57')]('[syncHangup][talking][cause]',_0x5c19bd[_0x4fbd('0xa9')],_0x5c19bd['cause'],'\x20Queue',_0xd7530['name'],_0x4fbd('0x6c'),_0xd7530[_0x4fbd('0x2b')]);this[_0x4fbd('0x92')](_0x5c19bd,_0x5c19bd[_0x4fbd('0xa9')],_0x5c19bd['cause']);}}};Preview['prototype'][_0x4fbd('0x1c')]=function(_0x25b710){if(this['actions'][_0x25b710['destlinkedid']]&&_0x25b710[_0x4fbd('0x14c')]!==_0x25b710['destuniqueid']){this[_0x4fbd('0x92')](_0x25b710,_0x25b710[_0x4fbd('0x14c')],_0x25b710[_0x4fbd('0xe3')]);}};Preview[_0x4fbd('0xe')][_0x4fbd('0x1a')]=function(_0x322037){if(this[_0x4fbd('0x12')][_0x322037[_0x4fbd('0xa9')]]&&_0x322037[_0x4fbd('0xa9')]!==_0x322037[_0x4fbd('0xaf')]&&!this[_0x4fbd('0x12')][_0x322037[_0x4fbd('0xa9')]][_0x4fbd('0x6d')]){if(_0x322037['cause']==='1'){this[_0x4fbd('0x92')](_0x322037,_0x322037[_0x4fbd('0xa9')],_0x322037[_0x4fbd('0x148')]);}}};Preview['prototype'][_0x4fbd('0x14d')]=function(_0x416421,_0x4a9e87,_0x1ec77e){if(this[_0x4fbd('0x12')][_0x416421]){if(_[_0x4fbd('0x68')](this['actions'][_0x416421][_0x4fbd('0x136')])){this[_0x4fbd('0x12')][_0x416421][_0x4fbd('0x136')]={};}this[_0x4fbd('0x12')][_0x416421]['variables'][_0x4a9e87]=_0x1ec77e;}};Preview[_0x4fbd('0xe')][_0x4fbd('0x20')]=function(_0x5c8880){try{if(!_[_0x4fbd('0x68')](_0x5c8880)){if(ut[_0x4fbd('0x14e')](_['keys'](_0x5c8880[_0x4fbd('0x14f')])[0x0])){this[_0x4fbd('0x14d')](_0x5c8880['uniqueid'],_[_0x4fbd('0x150')](_0x5c8880[_0x4fbd('0x14f')])[0x0],_0x5c8880[_0x4fbd('0x151')]);}}}catch(_0x58e7d3){logger[_0x4fbd('0x152')](_0x4fbd('0x153'),util[_0x4fbd('0x154')](_0x58e7d3,{'showHidden':![],'depth':null}));}};Preview[_0x4fbd('0xe')][_0x4fbd('0x21')]=function(_0x34e0cf){if(_0x34e0cf){if(this[_0x4fbd('0x12')][_0x34e0cf[_0x4fbd('0x155')]]){this[_0x4fbd('0x12')][_0x34e0cf['transfertargetlinkedid']]['transfer']=!![];}}};Preview['prototype'][_0x4fbd('0x156')]=function(_0x2cc362){if(_0x2cc362){if(this[_0x4fbd('0x12')][_0x2cc362[_0x4fbd('0x157')]]){this[_0x4fbd('0x12')][_0x2cc362[_0x4fbd('0x157')]][_0x4fbd('0x14b')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x0465=['ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','outboundBlacklistCallsDay','[Blacklist][error]','SIP/%s','status','reachable','execRun','unlock','unlockContact','disableContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','originatecalleridnum','addVariables','merge','toLowerVariables','variables','[originated][increment]','OriginateError','logLookAgent','lookAgent','clone','response','custom:agentringnoanswer','callProgressDetectingAgent','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','reason','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','keys','variable','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','util','lodash','uuid','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','logger','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','recallMe','getContactRecallMe','agentReadyId','then','isNil','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','callAdditionalPhoneAfterMin','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','additional','dialBusyMaxRetry','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','dialAgentRejectRetryFrequency'];(function(_0x222361,_0x1e350d){var _0x50814b=function(_0x1bc6ef){while(--_0x1bc6ef){_0x222361['push'](_0x222361['shift']());}};_0x50814b(++_0x1e350d);}(_0x0465,0x1cf));var _0x5046=function(_0x1800f7,_0x517232){_0x1800f7=_0x1800f7-0x0;var _0x518c0c=_0x0465[_0x1800f7];return _0x518c0c;};'use strict';var util=require(_0x5046('0x0'));var _=require(_0x5046('0x1'));var uuid=require(_0x5046('0x2'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x5046('0x3'));var config=require(_0x5046('0x4'));var logger=require('../../../config/logger')(_0x5046('0x5'));var loggerAction=require(_0x5046('0x6'))(_0x5046('0x7'));var ami=require('../ami');var rpcDb=require(_0x5046('0x8'));var cmHopperAdditionalPhone=require(_0x5046('0x9'));var Action=require(_0x5046('0xa'));var ut=require(_0x5046('0xb'));config[_0x5046('0xc')]=_[_0x5046('0xd')](config[_0x5046('0xc')],{'host':_0x5046('0xe'),'port':0x18eb});var io=require(_0x5046('0xf'))(new Redis(config[_0x5046('0xc')]));var Sequence=function(){};Sequence[_0x5046('0x10')][_0x5046('0x11')]=function(_0x44827d){this[_0x5046('0x12')]=this['tail']?this[_0x5046('0x12')][_0x5046('0x13')](_0x44827d):_0x44827d();};function Preview(_0x556ce1){this[_0x5046('0x14')]=new Sequence();this[_0x5046('0x15')]=_0x556ce1[_0x5046('0x16')];this['trunks']=_0x556ce1[_0x5046('0x17')];this[_0x5046('0x18')]={};this[_0x5046('0x19')]=_0x556ce1[_0x5046('0x19')];this[_0x5046('0x1a')]=0x0;ami['on'](_0x5046('0x1b'),this[_0x5046('0x1c')][_0x5046('0x1d')](this));ami['on'](_0x5046('0x1e'),this['syncHangup'][_0x5046('0x1d')](this));ami['on'](_0x5046('0x1f'),this['syncHangupRequest'][_0x5046('0x1d')](this));ami['on'](_0x5046('0x20'),this[_0x5046('0x21')][_0x5046('0x1d')](this));ami['on']('newexten',this[_0x5046('0x22')]['bind'](this));ami['on'](_0x5046('0x23'),this[_0x5046('0x24')][_0x5046('0x1d')](this));ami['on'](_0x5046('0x25'),this[_0x5046('0x26')][_0x5046('0x1d')](this));ami['on'](_0x5046('0x27'),this['syncBlindTransfer'][_0x5046('0x1d')](this));this[_0x5046('0x28')](this['campaignsPreview']);}function emit(_0x3e80f6,_0x2ad173,_0x135995){io['to'](_0x3e80f6)[_0x5046('0x29')](_0x2ad173,_0x135995);}function emitCampaignPreview(_0x15b689){if(_0x15b689[_0x5046('0x2a')]===_0x5046('0x2b')){var _0x35d2fe={'id':_0x15b689['id'],'name':_0x15b689[_0x5046('0x2c')],'strategy':_0x15b689[_0x5046('0x2d')],'answered':_0x15b689[_0x5046('0x2e')],'available':_0x15b689['available'],'loggedIn':_0x15b689[_0x5046('0x2f')],'pTalking':_0x15b689[_0x5046('0x30')],'sumBillable':_0x15b689[_0x5046('0x31')],'sumDuration':_0x15b689[_0x5046('0x32')],'sumHoldTime':_0x15b689[_0x5046('0x33')]||0x0,'talking':_0x15b689[_0x5046('0x34')],'total':_0x15b689[_0x5046('0x35')],'type':_0x15b689[_0x5046('0x2a')],'unmanaged':_0x15b689[_0x5046('0x36')],'abandoned':_0x15b689[_0x5046('0x37')],'waiting':_0x15b689[_0x5046('0x38')],'loggedInDb':_0x15b689['loggedInDb'],'dialActive':_0x15b689[_0x5046('0x39')],'dialMethod':_0x15b689[_0x5046('0x3a')],'dialOriginateCallerIdName':_0x15b689[_0x5046('0x3b')],'dialOriginateCallerIdNumber':_0x15b689[_0x5046('0x3c')],'dialOriginateTimeout':_0x15b689['dialOriginateTimeout'],'dialPrefix':_0x15b689[_0x5046('0x3d')],'outboundAnswerAgiCallsDay':_0x15b689[_0x5046('0x3e')],'outboundAnswerCallsDay':_0x15b689[_0x5046('0x3f')],'outboundBlacklistCallsDay':_0x15b689['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x15b689[_0x5046('0x40')],'outboundCongestionCallsDay':_0x15b689[_0x5046('0x41')],'outboundDropCallsDayACS':_0x15b689['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x15b689[_0x5046('0x42')],'outboundDropCallsDayTimeout':_0x15b689[_0x5046('0x43')],'outboundNoAnswerCallsDay':_0x15b689[_0x5046('0x44')],'outboundNoSuchCallsDay':_0x15b689[_0x5046('0x45')],'outboundOriginateFailureCallsDay':_0x15b689[_0x5046('0x46')],'outboundReCallsDay':_0x15b689['outboundReCallsDay'],'outboundRejectCallsDay':_0x15b689[_0x5046('0x47')],'outboundUnknownCallsDay':_0x15b689[_0x5046('0x48')],'outboundAbandonedCallsDay':_0x15b689[_0x5046('0x49')],'predictiveIntervalAnsweredCalls':_0x15b689['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x15b689[_0x5046('0x4a')],'predictiveIntervalAvgTalktime':_0x15b689[_0x5046('0x4b')],'predictiveIntervalDroppedCallsCallersExit':_0x15b689[_0x5046('0x4c')],'predictiveIntervalDroppedCallsTimeout':_0x15b689['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x15b689[_0x5046('0x4d')],'predictiveIntervalErlangCallsDroppedCalls':_0x15b689[_0x5046('0x4e')],'predictiveIntervalHitRate':_0x15b689[_0x5046('0x4f')],'predictiveIntervalMultiplicativeFactor':_0x15b689[_0x5046('0x50')],'predictiveIntervalPauses':_0x15b689['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x15b689[_0x5046('0x51')],'predictiveIntervalTotalCalls':_0x15b689[_0x5046('0x52')],'message':_0x15b689[_0x5046('0x53')],'originated':_0x15b689['originated'],'erlangCalls':_0x15b689['erlangCalls'],'erlangCallToSecond':_0x15b689[_0x5046('0x54')],'erlangAbandonmentRate':_0x15b689[_0x5046('0x55')],'erlangBusyFactor':_0x15b689[_0x5046('0x56')],'startPredictive':_0x15b689['startPredictive'],'startProgressive':_0x15b689[_0x5046('0x57')]};if(_0x15b689[_0x5046('0x58')]){_0x35d2fe[_0x5046('0x58')]={'id':_0x15b689[_0x5046('0x58')]['id'],'name':_0x15b689['Trunk'][_0x5046('0x2c')],'active':_0x15b689[_0x5046('0x58')][_0x5046('0x59')],'callerid':_0x15b689[_0x5046('0x58')][_0x5046('0x5a')]};}if(_0x15b689['Interval']){_0x35d2fe[_0x5046('0x5b')]={'id':_0x15b689['Interval']['id'],'name':_0x15b689['Interval'][_0x5046('0x2c')]};}var _0xdbdc65=md5(JSON[_0x5046('0x5c')](_0x35d2fe));if(_0x15b689[_0x5046('0x5d')]!==_0xdbdc65){_0x15b689['md5']=_0xdbdc65;emit(util[_0x5046('0x5e')](_0x5046('0x5f'),_0x35d2fe[_0x5046('0x2c')]),_0x5046('0x60'),_0x35d2fe);}}}function emitVoiceQueueChannelRemove(_0x6c1249){logger[_0x5046('0x61')](_0x5046('0x62'),JSON[_0x5046('0x5c')](_0x6c1249));emit(util[_0x5046('0x5e')](_0x5046('0x5f'),_0x6c1249[_0x5046('0x2c')]),_0x5046('0x63'),_0x6c1249);io['emit'](_0x5046('0x64'),_0x6c1249);}function notSendMessagesQueue(_0x1b8b7c){if(_0x1b8b7c[_0x5046('0x65')]){if(_0x1b8b7c[_0x5046('0x66')]===0x0&&_0x1b8b7c['pTalking']===0x0){_0x1b8b7c[_0x5046('0x65')]=![];_0x1b8b7c[_0x5046('0x67')]=0x0;_0x1b8b7c[_0x5046('0x68')]=0x0;_0x1b8b7c['message']=_0x5046('0x69');ut['logger'](_0x5046('0x6a'),_0x1b8b7c[_0x5046('0x2c')]+'\x20is\x20not\x20active');}else{_0x1b8b7c[_0x5046('0x53')]=_0x5046('0x6b');ut[_0x5046('0x6c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x1b8b7c[_0x5046('0x2c')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x1b8b7c);}}Preview['prototype'][_0x5046('0x28')]=function(){var _0x53438c=this;setInterval(function(){_0x53438c[_0x5046('0x6d')]();},0x7cf);};Preview[_0x5046('0x10')]['syncCampaigns']=function(){var _0x1e63e8=this[_0x5046('0x15')];this[_0x5046('0x1a')]+=0x1;for(var _0x1b02e9 in _0x1e63e8){if(_0x1e63e8[_0x5046('0x6e')](_0x1b02e9)&&(_0x1e63e8[_0x1b02e9][_0x5046('0x3a')]==='preview'||_0x1e63e8[_0x1b02e9][_0x5046('0x3a')]===_0x5046('0x6f'))&&_0x1e63e8[_0x1b02e9][_0x5046('0x2a')]===_0x5046('0x2b')){if(this[_0x5046('0x1a')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x5046('0x70')]();}}if(_0x1e63e8['hasOwnProperty'](_0x1b02e9)&&_0x1e63e8[_0x1b02e9][_0x5046('0x3a')]==='preview'&&_0x1e63e8[_0x1b02e9][_0x5046('0x2a')]==='outbound'){if(_0x1e63e8[_0x1b02e9][_0x5046('0x39')]){this[_0x5046('0x71')](_0x1e63e8[_0x1b02e9]);if(_0x1e63e8[_0x1b02e9]['dialPreviewAutoRecallMe'])this['recallMe'](_0x1e63e8[_0x1b02e9]);}else{notSendMessagesQueue(_0x1e63e8[_0x1b02e9]);}}}};Preview[_0x5046('0x10')]['clearZombieChannel']=function(_0x275e59){var _0x23eec6=this;this[_0x5046('0x14')][_0x5046('0x11')](function(){if(!_['isNil'](_0x23eec6[_0x5046('0x18')][_0x275e59])){loggerAction['info']('[clearZombieChannels][talking]',_0x275e59,_0x5046('0x72'),_0x23eec6['actions'][_0x275e59][_0x5046('0x73')],_0x5046('0x74'),JSON[_0x5046('0x5c')](_0x23eec6[_0x5046('0x15')][_0x23eec6[_0x5046('0x18')][_0x275e59][_0x5046('0x73')]][_0x5046('0x66')]),_0x5046('0x75'),JSON[_0x5046('0x5c')](_0x23eec6[_0x5046('0x15')][_0x23eec6[_0x5046('0x18')][_0x275e59]['queue']][_0x5046('0x30')]),JSON[_0x5046('0x5c')](_0x23eec6[_0x5046('0x18')][_0x275e59][_0x5046('0x76')]),JSON[_0x5046('0x5c')](_[_0x5046('0x77')](_0x23eec6[_0x5046('0x18')][_0x275e59],[_0x5046('0x78'),_0x5046('0x79'),_0x5046('0x7a'),_0x5046('0x7b')])));return ami[_0x5046('0x7c')]({'action':'status','channel':_0x23eec6[_0x5046('0x18')][_0x275e59][_0x5046('0x7d')]})[_0x5046('0x7e')](function(_0x5ea228){if(_0x5ea228[_0x5046('0x53')]===_0x5046('0x7f')){setTimeout(function(){if(_0x23eec6[_0x5046('0x18')][_0x275e59]){ut[_0x5046('0x80')](_0x23eec6[_0x5046('0x15')][_0x23eec6[_0x5046('0x18')][_0x275e59][_0x5046('0x73')]],_0x5046('0x81'));if(_0x23eec6[_0x5046('0x18')][_0x275e59][_0x5046('0x76')]===!![]){ut[_0x5046('0x82')](_0x23eec6[_0x5046('0x15')][_0x23eec6[_0x5046('0x18')][_0x275e59][_0x5046('0x73')]],_0x5046('0x81'));ut[_0x5046('0x83')](_0x5046('0x84')+_0x275e59,_0x23eec6['actions'][_0x275e59][_0x5046('0x73')]);}ut[_0x5046('0x83')]('[Dialer][checkChannel][Preview]'+_0x275e59,_0x23eec6['actions'][_0x275e59][_0x5046('0x73')]);delete _0x23eec6[_0x5046('0x18')][_0x275e59];}},0x2328);}});}});};Preview[_0x5046('0x10')]['clearZombieChannels']=function(){var _0x277a0e=this;loggerAction[_0x5046('0x61')]('[action]',_[_0x5046('0x85')](this[_0x5046('0x18')]));for(var _0x429ada in this['actions']){if(_0x277a0e[_0x5046('0x18')][_0x5046('0x6e')](_0x429ada)){_0x277a0e['clearZombieChannel'](_0x429ada);}}};Preview[_0x5046('0x10')][_0x5046('0x86')]=function(_0x5d5830){var _0x483825=this;rpcDb[_0x5046('0x87')](_0x5d5830['id'],ut[_0x5046('0x88')](this[_0x5046('0x19')]))[_0x5046('0x89')](function(_0x4088f7){if(!_[_0x5046('0x8a')](_0x4088f7)){for(var _0x4b497d=0x0;_0x4b497d<_0x4088f7['length'];_0x4b497d+=0x1){if(ut[_0x5046('0x8b')](_0x4088f7[_0x4b497d][_0x5046('0x8c')])<_0x5d5830['dialRecallMeTimeout']*0x3c){if(_0x4088f7[_0x4b497d]['Agent']&&!_0x4088f7[_0x4b497d][_0x5046('0x8d')][_0x5046('0x8e')]){_0x483825[_0x5046('0x8f')](_0x4088f7[_0x4b497d]['id'])['then'](ut[_0x5046('0x90')](_0x5046('0x91')))[_0x5046('0x7e')](ut[_0x5046('0x90')](_0x5046('0x91')));}else{rpcDb['disableContact'](_0x4088f7[_0x4b497d]['id']);}}else{var _0x2707a0=new Action(_0x4088f7[_0x4b497d],_0x5d5830);_0x2707a0[_0x5046('0x92')]=moment()[_0x5046('0x5e')](_0x5046('0x93'));_0x5d5830[_0x5046('0x94')]+=0x1;ut[_0x5046('0x95')](_0x2707a0,0x17,_0x5046('0x96'));if(_0x5d5830[_0x5046('0x97')]){rpcDb[_0x5046('0x98')](ut['createBody'](_0x4088f7[_0x4b497d]));rpcDb[_0x5046('0x99')](_0x2707a0,_0x5046('0x9a'));}else{ut[_0x5046('0x95')](_0x2707a0,0x16,_0x5046('0x9b'));rpcDb[_0x5046('0x99')](_0x2707a0,_0x5046('0x9c'));rpcDb[_0x5046('0x9d')](_0x2707a0,_0x5046('0x9c'));}}}}})[_0x5046('0x7e')](ut[_0x5046('0x90')](_0x5046('0x9e')));};Preview[_0x5046('0x10')][_0x5046('0x71')]=function(_0x34c0c7){_0x34c0c7['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x34c0c7[_0x5046('0x2f')])){_0x34c0c7[_0x5046('0x53')]=_0x5046('0x9f');}else if(!ut[_0x5046('0xa0')](_0x34c0c7[_0x5046('0x39')])){_0x34c0c7['message']=_0x5046('0x69');}else if(!this[_0x5046('0xa1')](_0x34c0c7[_0x5046('0x58')])){if(!this[_0x5046('0xa1')](_0x34c0c7[_0x5046('0xa2')])){_0x34c0c7['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x34c0c7['message']=_0x5046('0xa3');}}else{_0x34c0c7[_0x5046('0x53')]='ACTIVE';}emitCampaignPreview(_0x34c0c7);};Preview[_0x5046('0x10')][_0x5046('0xa4')]=function(_0x1e1c4d,_0x50303d,_0xd33cb8){var _0x4e4661=this;var _0x419c6c=this['actions'][_0x50303d];var _0x191f2f=this['campaignsPreview'][_0x419c6c[_0x5046('0x73')]];var _0x288b06;var _0x304a8f=![];var _0x49b342=0x2;var _0x49619c=0x3;if(_0x191f2f){switch(_0xd33cb8){case'1':_0x191f2f[_0x5046('0x45')]+=0x1;_0x419c6c[_0x5046('0xa5')]+=0x1;_0x419c6c[_0x5046('0xa6')]=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x0,_0x5046('0xa8'));ami[_0x5046('0x29')](_0x5046('0xa9'),ut[_0x5046('0xaa')](_0x419c6c,'nosuchnumber'));rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xab'));_0x4e4661['verifyAdditionalPhones'](_0x419c6c,'0',_0x191f2f)[_0x5046('0x89')](function(_0x4e80d9){_0x304a8f=_0x4e80d9['additional']==0x1;_0x49b342=_0x191f2f['dialNoSuchNumberRetryFrequency'];_0x49619c=_0x191f2f[_0x5046('0xac')];if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f['dialGlobalMaxRetry']){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0xf,'Global');rpcDb['createCustomerFinal'](_0x288b06,_0x5046('0xae'));}else{if(_0x419c6c[_0x5046('0xa5')]>=_0x191f2f[_0x5046('0xaf')]){rpcDb['createCustomerFinal'](_0x419c6c,_0x5046('0xae'));}else{rpcDb[_0x5046('0xb0')](ut[_0x5046('0xb1')](_0x419c6c,_0x5046('0xa5'),_0x191f2f['dialNoSuchNumberRetryFrequency']),_0x419c6c[_0x5046('0xb2')],_0x419c6c[_0x5046('0xb3')]);}}delete this[_0x5046('0x18')][_0x1e1c4d[_0x5046('0xb4')]];}else{_0x419c6c[_0x5046('0xa5')]++;logger[_0x5046('0x61')](_0x5046('0xb5'),_0x419c6c['countnosuchnumberretry']);logger[_0x5046('0x61')]('id',_0x419c6c[_0x5046('0xb6')]);_0x4e4661[_0x5046('0xb7')]({'id':_0x419c6c['idContact'],'field':{'countnosuchnumberretry':_0x419c6c[_0x5046('0xa5')]}})[_0x5046('0x89')](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)[_0x5046('0x89')](function(){});});}});break;case _0x5046('0xb9'):var _0x2972c2=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x419c6c[_0x5046('0xba')]=_0x2972c2;_0x419c6c[_0x5046('0xbb')]=_0x2972c2;_0x419c6c['dialAnswer']=!![];_0x191f2f[_0x5046('0x30')]+=0x1;logger[_0x5046('0x61')]('[syncHangup][talking][increment]',_0x419c6c[_0x5046('0xbc')],_0x5046('0xbd'),_0x191f2f[_0x5046('0x2c')],_0x5046('0x75'),_0x191f2f['pTalking']);ami[_0x5046('0x29')](_0x5046('0xbe'),ut[_0x5046('0xaa')](_0x419c6c,'connect',this[_0x5046('0x15')][_0x419c6c[_0x5046('0x73')]]));if(_0x191f2f[_0x5046('0xbf')]){ami['emit'](_0x5046('0xc0'),ut[_0x5046('0xc1')](_0x419c6c));}break;case'16':ami[_0x5046('0x29')]('custom:agentcomplete',ut[_0x5046('0xaa')](_0x419c6c,_0x5046('0xc2'),this[_0x5046('0x15')][_0x419c6c[_0x5046('0x73')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x419c6c,_0x5046('0xc2')));_0x191f2f[_0x5046('0x3f')]+=0x1;_0x191f2f[_0x5046('0x35')]+=0x1;_0x191f2f[_0x5046('0x2e')]+=0x1;ut[_0x5046('0x82')](_0x191f2f,_0x5046('0xc3'));_0x419c6c['countglobal']=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x4,'Answer');rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xc4'));rpcDb[_0x5046('0x9d')](_0x419c6c,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x5046('0xc5')](_0x419c6c);_0x191f2f[_0x5046('0x32')]+=_0x419c6c['talktime'];_0x191f2f[_0x5046('0x31')]+=_0x419c6c[_0x5046('0xc6')];logger[_0x5046('0x61')](_0x5046('0xc7'),_0x419c6c['uniqueid'],_0x5046('0xbd'),_0x191f2f[_0x5046('0x2c')],_0x5046('0x75'),_0x191f2f[_0x5046('0x30')]);delete this[_0x5046('0x18')][_0x1e1c4d[_0x5046('0xb4')]];break;case _0x5046('0xc8'):_0x191f2f[_0x5046('0x40')]+=0x1;_0x419c6c[_0x5046('0xc9')]+=0x1;_0x419c6c['countglobal']=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x5,'Busy');_0x49b342=_0x191f2f[_0x5046('0xca')];_0x49619c=_0x191f2f['callAdditionalPhoneAfterMin'];ami[_0x5046('0x29')](_0x5046('0xcb'),ut[_0x5046('0xaa')](_0x419c6c,_0x5046('0xcc')));rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xcd'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'5',_0x191f2f)[_0x5046('0x89')](function(_0x3e0edf){_0x304a8f=_0x3e0edf[_0x5046('0xcf')]==0x1;if(!_0x304a8f){if(ut['totalGlobal'](_0x419c6c)>=_0x191f2f['dialGlobalMaxRetry']){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0xf,'Global');rpcDb[_0x5046('0x9d')](_0x288b06,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x419c6c[_0x5046('0xc9')]>=_0x191f2f[_0x5046('0xd0')]){rpcDb[_0x5046('0x9d')](_0x419c6c,_0x5046('0xcd'));}else{rpcDb[_0x5046('0xb0')](ut[_0x5046('0xb1')](_0x419c6c,_0x5046('0xc9'),_0x191f2f[_0x5046('0xca')]),_0x419c6c[_0x5046('0xb2')],_0x419c6c[_0x5046('0xb3')]);}}}else{_0x419c6c[_0x5046('0xc9')]++;_0x4e4661['incrementPreviewCounters']({'id':_0x419c6c['idContact'],'field':{'countbusyretry':_0x419c6c['countbusyretry']}})[_0x5046('0x89')](function(){_0x4e4661['swapAdditionalPhones'](_0x419c6c,_0x49b342,_0x49619c)[_0x5046('0x89')](function(){});});}});break;case'NOANSWER':_0x191f2f[_0x5046('0x44')]+=0x1;_0x419c6c[_0x5046('0xd1')]+=0x1;_0x419c6c[_0x5046('0xa6')]=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x3,_0x5046('0xd2'));_0x49b342=_0x191f2f['dialNoAnswerRetryFrequency'];_0x49619c=_0x191f2f[_0x5046('0xac')];var _0x5e7d13=ut[_0x5046('0xd3')](_0x419c6c,_0x191f2f);ami[_0x5046('0x29')](_0x5046('0xd4'),_0x5e7d13);rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xd5'));_0x4e4661['verifyAdditionalPhones'](_0x419c6c,'3',_0x191f2f)['then'](function(_0xcfb78d){_0x304a8f=_0xcfb78d[_0x5046('0xcf')]==0x1;if(!_0x304a8f){if(ut['totalGlobal'](_0x419c6c)>=_0x191f2f[_0x5046('0xd6')]){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0xf,_0x5046('0xd7'));rpcDb[_0x5046('0x9d')](_0x288b06,_0x5046('0xd8'));}else{if(_0x419c6c[_0x5046('0xd1')]>=_0x191f2f[_0x5046('0xd9')]){rpcDb[_0x5046('0x9d')](_0x419c6c,_0x5046('0xd5'));}else{rpcDb[_0x5046('0xb0')](ut['scheduledAt'](_0x419c6c,'countnoanswerretry',_0x191f2f[_0x5046('0xda')]),_0x419c6c[_0x5046('0xb2')],_0x419c6c['activeContact']);}}}else{_0x419c6c[_0x5046('0xd1')]++;_0x4e4661[_0x5046('0xb7')]({'id':_0x419c6c[_0x5046('0xb6')],'field':{'countnoanswerretry':_0x419c6c['countnoanswerretry']}})['then'](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)['then'](function(){});});}});break;case'CONGESTION':_0x191f2f[_0x5046('0x41')]+=0x1;_0x419c6c[_0x5046('0xdb')]+=0x1;_0x419c6c['countglobal']=ut[_0x5046('0xa7')](_0x419c6c);ut['logCustomer'](_0x419c6c,0x8,_0x5046('0xdc'));_0x49b342=_0x191f2f['dialCongestionRetryFrequency'];_0x49619c=_0x191f2f[_0x5046('0xac')];ami[_0x5046('0x29')](_0x5046('0xdd'),ut[_0x5046('0xaa')](_0x419c6c,_0x5046('0xde')));rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xdf'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'8',_0x191f2f)[_0x5046('0x89')](function(_0xedc938){_0x304a8f=_0xedc938['additional']==0x1;if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f[_0x5046('0xd6')]){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0xf,_0x5046('0xd7'));rpcDb['createCustomerFinal'](_0x288b06,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x419c6c[_0x5046('0xdb')]>=_0x191f2f[_0x5046('0xe0')]){rpcDb[_0x5046('0x9d')](_0x419c6c,_0x5046('0xdf'));}else{rpcDb['rescheduleContact'](ut[_0x5046('0xb1')](_0x419c6c,_0x5046('0xdb'),_0x191f2f[_0x5046('0xca')]),_0x419c6c[_0x5046('0xb2')],_0x419c6c[_0x5046('0xb3')]);}}}else{_0x419c6c['countcongestionretry']++;_0x4e4661['incrementPreviewCounters']({'id':_0x419c6c['idContact'],'field':{'countcongestionretry':_0x419c6c['countcongestionretry']}})[_0x5046('0x89')](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)[_0x5046('0x89')](function(){});});}});break;case _0x5046('0xe1'):_0x191f2f['outboundRejectCallsDay']+=0x1;_0x419c6c['countagentrejectretry']+=0x1;_0x419c6c[_0x5046('0xa6')]=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x14,'AgentReject');_0x49b342=_0x191f2f['dialAgentRejectRetryFrequency'];_0x49619c=_0x191f2f[_0x5046('0xac')];ami[_0x5046('0x29')]('custom:agentreject',ut['buildObj'](_0x419c6c,_0x5046('0xe2')));rpcDb['createCustomerHistory'](_0x419c6c,_0x5046('0xe3'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'20',_0x191f2f)[_0x5046('0x89')](function(_0x1c6c3a){_0x304a8f=_0x1c6c3a[_0x5046('0xcf')]==0x1;if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f[_0x5046('0xd6')]){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0x14,_0x5046('0xe4'));rpcDb[_0x5046('0x9d')](_0x288b06,_0x5046('0xe5'));}else{if(_0x419c6c['countagentrejectretry']>=_0x191f2f[_0x5046('0xe6')]){rpcDb[_0x5046('0x9d')](_0x419c6c,_0x5046('0xe5'));}else{rpcDb['rescheduleContact'](ut[_0x5046('0xb1')](_0x419c6c,_0x5046('0xe7'),_0x191f2f[_0x5046('0xe8')]),_0x419c6c[_0x5046('0xb2')],_0x419c6c[_0x5046('0xb3')]);}}}else{_0x419c6c['countnoanswerretry']++;_0x4e4661[_0x5046('0xb7')]({'id':_0x419c6c[_0x5046('0xb6')],'field':{'countnoanswerretry':_0x419c6c[_0x5046('0xd1')]}})[_0x5046('0x89')](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)['then'](function(){});});}});break;case _0x5046('0xe9'):_0x191f2f['outboundAbandonedCallsDay']+=0x1;_0x419c6c[_0x5046('0xea')]+=0x1;_0x419c6c[_0x5046('0xa6')]=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0xb,'Abandoned');rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xeb'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'11',_0x191f2f)['then'](function(_0x2942b1){_0x304a8f=_0x2942b1['additional']==0x1;if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f[_0x5046('0xd6')]){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0xf,_0x5046('0xd7'));rpcDb[_0x5046('0x9d')](_0x288b06,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x419c6c[_0x5046('0xec')]>=_0x191f2f[_0x5046('0xed')]){rpcDb[_0x5046('0x9d')](_0x419c6c,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x5046('0xb0')](ut[_0x5046('0xb1')](_0x419c6c,_0x5046('0xea'),_0x191f2f[_0x5046('0xee')]),_0x419c6c[_0x5046('0xb2')],_0x419c6c[_0x5046('0xb3')]);}}}else{_0x419c6c[_0x5046('0xd1')]++;_0x4e4661[_0x5046('0xb7')]({'id':_0x419c6c[_0x5046('0xb6')],'field':{'countnoanswerretry':_0x419c6c[_0x5046('0xd1')]}})['then'](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)[_0x5046('0x89')](function(){});});}});break;case'18':_0x191f2f[_0x5046('0x48')]+=0x1;_0x419c6c[_0x5046('0xef')]+=0x1;_0x419c6c['countglobal']=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x12,_0x1e1c4d['cause-txt']||_0x1e1c4d['dialstatus']);ami[_0x5046('0x29')](_0x5046('0xf0'),ut[_0x5046('0xaa')](_0x419c6c,_0x5046('0xf1')));rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xf2'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'18',_0x191f2f)[_0x5046('0x89')](function(_0x3389cb){_0x304a8f=_0x3389cb[_0x5046('0xcf')]==0x1;if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f['dialGlobalMaxRetry']){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0x12,_0x5046('0xd7'));rpcDb[_0x5046('0x9d')](_0x288b06,_0x5046('0xf2'));}else{rpcDb[_0x5046('0x9d')](_0x419c6c,_0x5046('0xf2'));}}else{_0x419c6c[_0x5046('0xd1')]++;_0x4e4661[_0x5046('0xb7')]({'id':_0x419c6c['idContact'],'field':{'countnoanswerretry':_0x419c6c[_0x5046('0xd1')]}})[_0x5046('0x89')](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)[_0x5046('0x89')](function(){});});}});delete this[_0x5046('0x18')][_0x1e1c4d[_0x5046('0xb4')]];break;case'19':_0x191f2f[_0x5046('0x48')]+=0x1;_0x419c6c[_0x5046('0xa6')]=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x13,_0x1e1c4d['cause-txt']||_0x1e1c4d[_0x5046('0xf3')]);ami[_0x5046('0x29')](_0x5046('0xf0'),ut[_0x5046('0xaa')](_0x419c6c,'amd'));rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xf4'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'18',_0x191f2f)[_0x5046('0x89')](function(_0x193c4c){_0x304a8f=_0x193c4c[_0x5046('0xcf')]==0x1;if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f['dialGlobalMaxRetry']){_0x288b06=ut['cloneAction'](_0x419c6c,0xf,'Global');rpcDb[_0x5046('0x9d')](_0x288b06,_0x5046('0xf4'));}else{rpcDb[_0x5046('0x9d')](_0x419c6c,'[callProgressDetectingCustomer][machine]');}}else{_0x419c6c['countnoanswerretry']++;_0x4e4661[_0x5046('0xb7')]({'id':_0x419c6c[_0x5046('0xb6')],'field':{'countnoanswerretry':_0x419c6c[_0x5046('0xd1')]}})[_0x5046('0x89')](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)[_0x5046('0x89')](function(){});});}});delete this[_0x5046('0x18')][_0x1e1c4d[_0x5046('0xb4')]];break;default:if(_0x419c6c['dialAnswer']){ut['decrementTalkink'](_0x191f2f,_0x5046('0xf5'));ut[_0x5046('0x83')](_0x5046('0xf6')+_0x191f2f[_0x5046('0x2c')],_0x1e1c4d);}_0x191f2f[_0x5046('0x48')]+=0x1;_0x419c6c[_0x5046('0xa6')]=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0xc,_0x1e1c4d[_0x5046('0xf7')]||_0x1e1c4d[_0x5046('0xf3')]);_0x49b342=_0x191f2f['dialAgentRejectRetryFrequency'];_0x49619c=_0x191f2f[_0x5046('0xac')];rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xf8'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'20',_0x191f2f)[_0x5046('0x89')](function(_0x50cec5){_0x304a8f=_0x50cec5[_0x5046('0xcf')]==0x1;if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f[_0x5046('0xd6')]){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0xf,_0x5046('0xd7'));rpcDb['createCustomerFinal'](_0x288b06,_0x5046('0xf9'));}else{rpcDb['createCustomerFinal'](_0x419c6c,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x1e1c4d[_0x5046('0xb4')]];}else{_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)['then'](function(){});}});}if(!(_0x419c6c['dialAnswer']&&_0xd33cb8==='16')){ut[_0x5046('0x80')](_0x191f2f,_0x5046('0xfa'));logger['info'](_0x5046('0xfb'),_0x419c6c['uniqueid'],_0x5046('0xbd'),_0x191f2f['name'],_0x5046('0x74'),_0x191f2f[_0x5046('0x66')]);}if(_0xd33cb8!==_0x5046('0xb9')){delete this['actions'][_0x1e1c4d[_0x5046('0xb4')]];delete this[_0x5046('0x18')][_0x1e1c4d[_0x5046('0xfc')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0xfc0f8e,_0x68b170,_0x788f1e){if(_['isUndefined'](_0x68b170)&&'object'!==typeof _0x68b170){return;}if(_[_0x5046('0xfd')](_0x788f1e)&&_0x5046('0xfe')!==typeof _0x788f1e){return;}switch(_0x788f1e['reason']){case'0':ut['logAgent'](_0xfc0f8e,0x0,_0x5046('0xa8'));rpcDb[_0x5046('0xff')](_0xfc0f8e,_0x5046('0x100'));break;case'3':ut[_0x5046('0x101')](_0xfc0f8e,0x3,_0x5046('0xd2'));rpcDb[_0x5046('0xff')](_0xfc0f8e,_0x5046('0x102'));break;case'5':ut[_0x5046('0x101')](_0xfc0f8e,0x5,_0x5046('0x103'));rpcDb[_0x5046('0xff')](_0xfc0f8e,_0x5046('0x104'));break;case'8':ut['logAgent'](_0xfc0f8e,0x8,'Congestion');rpcDb['createAgentHistory'](_0xfc0f8e,_0x5046('0x105'));break;case'22':ut[_0x5046('0x101')](_0xfc0f8e,0x16,_0x5046('0x106'));rpcDb[_0x5046('0xff')](_0xfc0f8e,_0x5046('0x107'));break;default:ut['logAgent'](_0xfc0f8e,0xc,_0x788f1e['reason']);rpcDb[_0x5046('0xff')](_0xfc0f8e,_0x5046('0x105'));}ut[_0x5046('0x80')](_0x68b170,_0x5046('0x108'));logger[_0x5046('0x61')](_0x5046('0x109'),_0xfc0f8e[_0x5046('0xbc')],_0x5046('0xbd'),_0x68b170[_0x5046('0x2c')],'originated:\x20',_0x68b170[_0x5046('0x66')]);delete this[_0x5046('0x18')][_0xfc0f8e[_0x5046('0xbc')]];};Preview[_0x5046('0x10')][_0x5046('0xce')]=function(_0x4cb201,_0x4746c1,_0x3b297a){return Promise[_0x5046('0x10a')]()['then'](cmHopperAdditionalPhone[_0x5046('0xce')](_0x4cb201,_0x4746c1,_0x3b297a))['catch'](logger[_0x5046('0x61')](_0x5046('0x10b')));};Preview[_0x5046('0x10')]['swapAdditionalPhones']=function(_0x13da52,_0x48778a,_0x1d0880){return Promise[_0x5046('0x10a')]()[_0x5046('0x89')](cmHopperAdditionalPhone[_0x5046('0xb8')](_0x13da52,_0x48778a,_0x1d0880))[_0x5046('0x7e')](logger[_0x5046('0x61')](_0x5046('0x10c')));};Preview[_0x5046('0x10')]['incrementPreviewCounters']=function(_0x2f2a22){return Promise[_0x5046('0x10a')]()[_0x5046('0x89')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x2f2a22))['catch'](logger[_0x5046('0x61')](_0x5046('0x10d')));};Preview['prototype'][_0x5046('0x10e')]=function(_0x398979,_0x41e907,_0x1f10e5,_0x49e6fb,_0x220637){var _0x4c6fdf=this;return new Promise(function(_0xea3a71,_0x1af9a1){if(_['isNil'](_0x41e907)||_[_0x5046('0x8a')](_0x41e907[_0x5046('0x10f')])||_[_0x5046('0x8a')](_0x41e907[_0x5046('0x110')])||_[_0x5046('0x8a')](_0x41e907[_0x5046('0x7a')])){_0x1af9a1(ut['message'](_0x5046('0x111'),_0x49e6fb,_0x220637));return;}var _0x959162=uuid['v4']();var _0x41b6af=_0x4c6fdf[_0x5046('0x15')][_0x41e907['Queue']['name']];var _0x113e7a=_0x1f10e5?_0x4c6fdf[_0x5046('0x19')][_0x1f10e5]['id']:undefined;_0x4c6fdf[_0x5046('0x18')][_0x959162]=new Action(_0x41e907,_0x41b6af,_0x959162,_0x1f10e5,_0x113e7a);var _0x27d979=_0x4c6fdf['actions'][_0x959162];_0x27d979['unlockAgent']=_0x49e6fb;_0x27d979['activeContact']=_0x220637;_0x27d979['lookAgent']=_0x1f10e5;if(_['isEmpty'](_0x398979)){_0x4c6fdf['execCall'](_0x27d979,_0x41b6af,_0x41e907,_0x1f10e5)[_0x5046('0x89')](function(_0x25609d){logger[_0x5046('0x61')]('[Preview][execCall][success]',_0x5046('0x112')+_0x27d979[_0x5046('0x73')]+_0x5046('0x113')+_0x27d979[_0x5046('0xb6')],JSON[_0x5046('0x5c')](_0x25609d));ami[_0x5046('0x29')](_0x5046('0x114'),ut['buildObj'](_0x27d979,_0x5046('0x115'),_0x4c6fdf['campaignsPreview'][_0x27d979[_0x5046('0x73')]]));_0xea3a71(ut[_0x5046('0x53')](_0x5046('0x116')));})[_0x5046('0x7e')](function(_0x4f00e0){ut['logger']('[Preview][execCall][failure]',_0x4f00e0);_0x1af9a1(ut['message']('Call\x20failed',_0x49e6fb,_0x220637));});}else{_0x41b6af[_0x5046('0x117')]+=0x1;ut['logBlacklist'](_0x27d979);rpcDb['createHistory'](_0x27d979,_0x5046('0x118'));delete _0x4c6fdf[_0x5046('0x18')][_0x959162];_0x1af9a1(ut[_0x5046('0x53')]('Contact\x20in\x20black\x20List',_0x49e6fb,_0x220637));}});};Preview[_0x5046('0x10')][_0x5046('0xa1')]=function(_0x454e3a){return!_[_0x5046('0x8a')](_0x454e3a)&&!_['isNil'](_0x454e3a[_0x5046('0x2c')])&&!_[_0x5046('0x8a')](_0x454e3a[_0x5046('0x59')])&&_0x454e3a[_0x5046('0x59')]&&!_[_0x5046('0x8a')](this[_0x5046('0x17')][util[_0x5046('0x5e')]('SIP/%s',_0x454e3a[_0x5046('0x2c')])])&&!_[_0x5046('0x8a')](this['trunks'][util[_0x5046('0x5e')](_0x5046('0x119'),_0x454e3a[_0x5046('0x2c')])][_0x5046('0x11a')])&&(this[_0x5046('0x17')][util[_0x5046('0x5e')](_0x5046('0x119'),_0x454e3a[_0x5046('0x2c')])][_0x5046('0x11a')]===_0x5046('0x11b')||this['trunks'][util[_0x5046('0x5e')](_0x5046('0x119'),_0x454e3a['name'])][_0x5046('0x11a')]==='unmonitored');};Preview[_0x5046('0x10')][_0x5046('0x8f')]=function(_0x34cfae,_0x5a234e){var _0x2655b5=this;return new Promise(function(_0x3cb5e7,_0x568740){_0x2655b5[_0x5046('0x11c')](_0x34cfae,_0x5a234e)['then'](function(_0x5c0b7f){_0x3cb5e7(_['pick'](_0x5c0b7f,[_0x5046('0x53')]));})[_0x5046('0x7e')](function(_0x3b30de){if(_0x3b30de[_0x5046('0x11d')]){rpcDb[_0x5046('0x11e')](_0x34cfae);}if(_0x3b30de[_0x5046('0x59')]){rpcDb[_0x5046('0x11f')](_0x34cfae);}_0x568740(_[_0x5046('0x77')](_0x3b30de,[_0x5046('0x53')]));});});};Preview[_0x5046('0x10')]['execRun']=function(_0x21f037,_0x444561){var _0x3b048f=this;return new Promise(function(_0x5ed685,_0xdf5edd){var _0x3504ac,_0x2b70a2;rpcDb['getContactPreview'](_0x21f037)[_0x5046('0x89')](function(_0xcb47d5){if(!_[_0x5046('0x8a')](_0xcb47d5[0x0])){_0x2b70a2=_0xcb47d5[0x0][_0x5046('0x120')]?![]:!![];_0x3504ac=_0xcb47d5[0x0][_0x5046('0x120')]?!![]:![];_0x3504ac=_0x444561?!![]:_0x3504ac;}var _0x511b75=_0x3b048f[_0x5046('0x121')](_0xcb47d5);if(_0x511b75[_0x5046('0x122')]){rpcDb[_0x5046('0x123')](_['pick'](_0xcb47d5[0x0],[_0x5046('0x7a'),_0x5046('0x110')]))[_0x5046('0x89')](function(_0x44ad67){_0x3b048f[_0x5046('0x10e')](_0x44ad67,_0xcb47d5[0x0],_0x444561,_0x2b70a2,_0x3504ac)['then'](function(_0x4a704c){_0x5ed685(_0x4a704c);})[_0x5046('0x7e')](function(_0x3d10a2){_0xdf5edd(_0x3d10a2);});})[_0x5046('0x7e')](function(_0x22b3a1){ut[_0x5046('0x6c')](_0x5046('0x124'),_0x22b3a1);_0xdf5edd(ut[_0x5046('0x53')](_0x5046('0x125'),_0x2b70a2,_0x3504ac));});}else{_0xdf5edd(ut['message'](_0x511b75[_0x5046('0x53')],_0x2b70a2,_0x3504ac));}})[_0x5046('0x7e')](function(_0x179b39){ut['logger'](_0x5046('0x126'),_0x179b39);_0xdf5edd(ut[_0x5046('0x53')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x5046('0x10')][_0x5046('0x121')]=function(_0x8d1b){if(_['isNil'](_0x8d1b)||_[_0x5046('0x127')](_0x8d1b)||!_[_0x5046('0x8a')](_0x8d1b[0x0][_0x5046('0x8d')])&&_['isNil'](_0x8d1b[0x0][_0x5046('0x8d')]['name'])){ut['logger'](_0x5046('0x128'),_0x8d1b);return{'isValid':![],'message':_0x5046('0x129')};}var _0x3145de=this[_0x5046('0x15')][_0x8d1b[0x0][_0x5046('0x72')][_0x5046('0x2c')]];_0x3145de[_0x5046('0x53')]=_0x5046('0xa3');if(_[_0x5046('0x8a')](_0x3145de)){ut[_0x5046('0x6c')](_0x5046('0x12a'),_0x3145de);return{'isValid':![],'message':_0x5046('0x12b')};}if(!this[_0x5046('0xa1')](_0x3145de['Trunk'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x3145de['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x5046('0xa1')](_0x3145de[_0x5046('0xa2')])){ut[_0x5046('0x6c')](_0x5046('0x12c'),_0x3145de[_0x5046('0x2c')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x5046('0x12d')};}}if(!ut['isActive'](_0x3145de[_0x5046('0x39')])){ut[_0x5046('0x6c')](_0x5046('0x12e'),_0x3145de[_0x5046('0x2c')]+_0x5046('0x12f'));return{'isValid':![],'message':_0x5046('0x130')+_0x3145de['name']+_0x5046('0x12f')};}return{'isValid':!![],'message':_0x5046('0x131')};};Preview[_0x5046('0x10')][_0x5046('0x132')]=function(_0x2e1996,_0x354166,_0x346d1c,_0x2d8b34){var _0x4a7eb0=this;return new Promise(function(_0x29b992,_0x4db142){var _0x4fc22b=_0x2e1996['uniqueid'];var _0x153d9f=_0x4a7eb0[_0x5046('0xa1')](_0x354166[_0x5046('0x58')])?util[_0x5046('0x5e')](_0x5046('0x133'),_0x354166[_0x5046('0x58')][_0x5046('0x2c')],_[_0x5046('0x8a')](_0x354166[_0x5046('0x3d')])?'':_0x354166[_0x5046('0x3d')][_0x5046('0x134')]()||'',_0x354166[_0x5046('0x135')]>0x0?_0x346d1c[_0x5046('0x110')][_0x5046('0x136')](_0x354166['dialCutDigit']):_0x346d1c[_0x5046('0x110')]):util[_0x5046('0x5e')](_0x5046('0x133'),_[_0x5046('0x8a')](_0x354166['TrunkBackup'])?_0x354166[_0x5046('0x58')][_0x5046('0x2c')]:_0x354166[_0x5046('0xa2')][_0x5046('0x2c')],_[_0x5046('0x8a')](_0x354166[_0x5046('0x3d')])?'':_0x354166[_0x5046('0x3d')][_0x5046('0x134')]()||'',_0x354166['dialCutDigit']>0x0?_0x346d1c[_0x5046('0x110')][_0x5046('0x136')](_0x354166[_0x5046('0x135')]):_0x346d1c[_0x5046('0x110')]);var _0x3c688f=_0x4a7eb0['isTrunkReachable'](_0x354166[_0x5046('0x58')])?ut['getCallerId'](_0x354166[_0x5046('0x58')][_0x5046('0x5a')],_0x354166[_0x5046('0x3b')],_0x354166[_0x5046('0x137')]>0x0?ut[_0x5046('0x138')](_0x354166[_0x5046('0x3c')],_0x354166[_0x5046('0x137')]):_0x354166['dialOriginateCallerIdNumber']):ut[_0x5046('0x139')](_[_0x5046('0x8a')](_0x354166['TrunkBackup'])?_0x354166['Trunk'][_0x5046('0x5a')]:_0x354166[_0x5046('0xa2')]['callerid'],_0x354166[_0x5046('0x3b')],_0x354166['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x5046('0x138')](_0x354166[_0x5046('0x3c')],_0x354166[_0x5046('0x137')]):_0x354166['dialOriginateCallerIdNumber']);if(_0x3c688f){_0x2e1996[_0x5046('0x13a')]=ut['extractCalleridName'](_0x3c688f);_0x2e1996[_0x5046('0x13b')]=ut['extractCalleridNumber'](_0x3c688f);}var _0x524850=ut[_0x5046('0x13c')](_0x354166,_0x346d1c,_0x153d9f,_0x3c688f,_0x4fc22b,_0x2e1996);_[_0x5046('0x13d')](_0x2e1996,ut[_0x5046('0x13e')](_0x524850));_0x2e1996[_0x5046('0x92')]=moment()[_0x5046('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x354166[_0x5046('0x13f')]=_0x524850;ami[_0x5046('0x7c')](ut['variablesAction'](_0x2e1996,_0x354166,_0x524850,_0x2e1996[_0x5046('0xb3')],_0x2d8b34))['then'](function(_0x44e258){_0x354166[_0x5046('0x66')]+=0x1;logger['info'](_0x5046('0x140'),_0x4fc22b,_0x5046('0xbd'),_0x354166[_0x5046('0x2c')],_0x5046('0x74'),_0x354166['originated']);_0x29b992(_0x44e258);})[_0x5046('0x7e')](function(_0x1889d4){ut[_0x5046('0x101')](_0x2e1996,0xe,_0x5046('0x141'));rpcDb[_0x5046('0xff')](_0x2e1996,'[originateFailure][logOriginateFailure]');_0x4db142(_0x1889d4);});});};Preview[_0x5046('0x10')][_0x5046('0x22')]=function(_0x3b721a){if(this['actions'][_0x3b721a[_0x5046('0xb4')]]){this['actions'][_0x3b721a[_0x5046('0xb4')]][_0x5046('0x7d')]=_0x3b721a[_0x5046('0x7d')];}};Preview[_0x5046('0x10')]['syncOriginateResponse']=function(_0x3c959f){var _0x39de58=this;var _0x48ea22=this[_0x5046('0x18')][_0x3c959f['actionid']];if(_0x48ea22){if(_0x48ea22['lookAgent']&&this[_0x5046('0x19')][_0x48ea22['lookAgent']]){ut[_0x5046('0x142')](_0x48ea22,this[_0x5046('0x19')][_0x48ea22[_0x5046('0x143')]][_0x5046('0x2c')],this[_0x5046('0x19')][_0x48ea22[_0x5046('0x143')]]['id']);}var _0x22226b=_[_0x5046('0x144')](_0x48ea22);_0x22226b[_0x5046('0xba')]=moment()[_0x5046('0x5e')](_0x5046('0x93'));var _0x3ea940=_0x39de58[_0x5046('0x15')][_0x48ea22['queue']];if(ut['isFailure'](_0x3c959f[_0x5046('0x145')])){if(_0x48ea22[_0x5046('0xb2')]){rpcDb[_0x5046('0x11e')](_0x48ea22[_0x5046('0xb6')]);}if(_0x48ea22[_0x5046('0xb3')]){rpcDb[_0x5046('0x11f')](_0x48ea22[_0x5046('0xb6')]);}ami[_0x5046('0x29')](_0x5046('0x146'),ut['buildObj'](_0x48ea22,'rejected',this['campaignsPreview'][_0x48ea22[_0x5046('0x73')]]));this[_0x5046('0x147')](_0x22226b,_0x3ea940,_0x3c959f);}else{_0x48ea22[_0x5046('0x92')]=moment()[_0x5046('0x5e')](_0x5046('0x93'));ut['logAgent'](_0x22226b,0x4,_0x5046('0x148'));rpcDb['createAgentHistory'](_0x22226b,_0x5046('0x149'));}}};Preview[_0x5046('0x10')][_0x5046('0x14a')]=function(_0xe45d8b){var _0x5da5ea=this[_0x5046('0x18')][_0xe45d8b[_0x5046('0xb4')]];var _0x39743b;if(_0x5da5ea){_0x39743b=this[_0x5046('0x15')][_0x5da5ea['queue']];logger[_0x5046('0x61')](_0x5046('0x14b'),_0xe45d8b[_0x5046('0xb4')],'\x20Queue',_0x39743b['name'],_0x5046('0x75'),_0x39743b['pTalking']);}if(this[_0x5046('0x18')][_0xe45d8b[_0x5046('0xb4')]]&&_0xe45d8b['linkedid']!==_0xe45d8b['uniqueid']){if(_0xe45d8b[_0x5046('0x14c')]==='16'&&this[_0x5046('0x18')][_0xe45d8b[_0x5046('0xb4')]][_0x5046('0x76')]){this['callProgressDetectingCustomer'](_0xe45d8b,_0xe45d8b[_0x5046('0xb4')],_0xe45d8b[_0x5046('0x14c')]);}else if(this['actions'][_0xe45d8b['linkedid']][_0x5046('0x76')]){logger[_0x5046('0x61')](_0x5046('0x14d'),_0xe45d8b[_0x5046('0xb4')],_0xe45d8b[_0x5046('0x14c')],_0x5046('0xbd'),_0x39743b['name'],'pTalking:\x20',_0x39743b[_0x5046('0x30')]);this[_0x5046('0xa4')](_0xe45d8b,_0xe45d8b['linkedid'],_0xe45d8b['cause']);}}else if(_0x5da5ea&&_[_0x5046('0x8a')](_0x5da5ea[_0x5046('0x14e')])&&_0x39743b['dialQueueProject']&&_0xe45d8b['linkedid']===_0xe45d8b[_0x5046('0xbc')]&&_[_0x5046('0x8a')](_0xe45d8b['reason'])&&_0xe45d8b['cause']==='16'&&_0xe45d8b[_0x5046('0x14f')]==='6'&&_[_0x5046('0xfd')](_0x5da5ea[_0x5046('0x150')])){if(_0x5da5ea[_0x5046('0xb2')]){rpcDb[_0x5046('0x11e')](_0x5da5ea[_0x5046('0xb6')]);}if(_0x5da5ea[_0x5046('0xb3')]){rpcDb['disableContact'](_0x5da5ea[_0x5046('0xb6')]);}_0xe45d8b[_0x5046('0x151')]='22';this[_0x5046('0x147')](_0x5da5ea,_0x39743b,_0xe45d8b);}else if(_0x5da5ea&&_0x5da5ea[_0x5046('0x150')]){if(_0xe45d8b[_0x5046('0x14c')]==='16'&&this[_0x5046('0x18')][_0xe45d8b[_0x5046('0xb4')]][_0x5046('0x76')]){logger['info'](_0x5046('0x152'),_0xe45d8b[_0x5046('0xb4')],_0xe45d8b[_0x5046('0x14c')],_0x5046('0xbd'),_0x39743b['name'],_0x5046('0x75'),_0x39743b[_0x5046('0x30')]);this[_0x5046('0xa4')](_0xe45d8b,_0xe45d8b['linkedid'],_0xe45d8b['cause']);}else if(this['actions'][_0xe45d8b['linkedid']]['dialAnswer']){logger[_0x5046('0x61')](_0x5046('0x14d'),_0xe45d8b['linkedid'],_0xe45d8b[_0x5046('0x14c')],_0x5046('0xbd'),_0x39743b[_0x5046('0x2c')],'pTalking:\x20',_0x39743b[_0x5046('0x30')]);this[_0x5046('0xa4')](_0xe45d8b,_0xe45d8b[_0x5046('0xb4')],_0xe45d8b['cause']);}}};Preview[_0x5046('0x10')][_0x5046('0x21')]=function(_0x471be0){if(this['actions'][_0x471be0['destlinkedid']]&&_0x471be0[_0x5046('0xfc')]!==_0x471be0[_0x5046('0x153')]){this[_0x5046('0xa4')](_0x471be0,_0x471be0[_0x5046('0xfc')],_0x471be0[_0x5046('0xf3')]);}};Preview['prototype'][_0x5046('0x154')]=function(_0x58cc5e){if(this[_0x5046('0x18')][_0x58cc5e['linkedid']]&&_0x58cc5e[_0x5046('0xb4')]!==_0x58cc5e[_0x5046('0xbc')]&&!this[_0x5046('0x18')][_0x58cc5e[_0x5046('0xb4')]][_0x5046('0x76')]){if(_0x58cc5e[_0x5046('0x14c')]==='1'){this[_0x5046('0xa4')](_0x58cc5e,_0x58cc5e['linkedid'],_0x58cc5e[_0x5046('0x14c')]);}}};Preview[_0x5046('0x10')][_0x5046('0x155')]=function(_0x1f3e50,_0x1735f0,_0x51e173){if(this[_0x5046('0x18')][_0x1f3e50]){if(_[_0x5046('0x8a')](this['actions'][_0x1f3e50]['variables'])){this[_0x5046('0x18')][_0x1f3e50][_0x5046('0x13f')]={};}this[_0x5046('0x18')][_0x1f3e50][_0x5046('0x13f')][_0x1735f0]=_0x51e173;}};Preview[_0x5046('0x10')][_0x5046('0x24')]=function(_0x5ea18c){try{if(!_[_0x5046('0x8a')](_0x5ea18c)){if(ut['filterKey'](_[_0x5046('0x156')](_0x5ea18c[_0x5046('0x157')])[0x0])){this[_0x5046('0x155')](_0x5ea18c[_0x5046('0xbc')],_['keys'](_0x5ea18c[_0x5046('0x157')])[0x0],_0x5ea18c['value']);}}}catch(_0x251dbd){logger['error'](_0x5046('0x158'),util['inspect'](_0x251dbd,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0xe886c1){if(_0xe886c1){if(this[_0x5046('0x18')][_0xe886c1[_0x5046('0x159')]]){this[_0x5046('0x18')][_0xe886c1['transfertargetlinkedid']][_0x5046('0x150')]=!![];}}};Preview[_0x5046('0x10')][_0x5046('0x15a')]=function(_0x415072){if(_0x415072){if(this[_0x5046('0x18')][_0x415072[_0x5046('0x15b')]]){this['actions'][_0x415072['transfererlinkedid']][_0x5046('0x150')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 9818f78..c9b2377 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 _0x4b7b=['membername','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','[voiceQueueReport]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4b7b,0x1c3));var _0xb4b7=function(_0x4f8297,_0x22d98d){_0x4f8297=_0x4f8297-0x0;var _0x1e2dc6=_0x4b7b[_0x4f8297];return _0x1e2dc6;};'use strict';var util=require(_0xb4b7('0x0'));var BPromise=require(_0xb4b7('0x1'));var logger=require(_0xb4b7('0x2'))(_0xb4b7('0x3'));var _=require(_0xb4b7('0x4'));var cmHopper=require(_0xb4b7('0x5'));var cmHopperFinal=require(_0xb4b7('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xb4b7('0x7'));var voiceQueueRt=require(_0xb4b7('0x8'));var agentReportPreview=require(_0xb4b7('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4b5cbe){return function(_0x5d1fd5){logger['error'](_0x4b5cbe,util[_0xb4b7('0xa')](_0x5d1fd5,{'showHidden':![],'depth':null}));};}function create(_0x64fcf3){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopperHistory[_0xb4b7('0xd')](_0x64fcf3))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0xf')));}function createAgent(_0x5b9b64){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](agentReportPreview[_0xb4b7('0xd')](_0x5b9b64))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0xf')));}function moveContact(_0x16eaa8){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper[_0xb4b7('0x10')](_0x16eaa8,!![]))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0x11')));}exports[_0xb4b7('0x12')]=function(_0x21e9f2){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopperBlack[_0xb4b7('0x12')](_0x21e9f2))['catch'](loggerCatch(_0xb4b7('0x13')));};exports['getContactPreview']=function(_0x16f62c){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper[_0xb4b7('0x14')](_0x16f62c))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0x15')));};exports[_0xb4b7('0xd')]=function(_0x1a3088,_0x41689f){create(_0x1a3088)[_0xb4b7('0xe')](loggerCatch(_0x41689f));moveContact(_0x1a3088)[_0xb4b7('0xe')](loggerCatch(_0x41689f));};exports['createAgentHistory']=function(_0x13f5f9,_0x3eda01){createAgent(_0x13f5f9)[_0xb4b7('0xe')](loggerCatch(_0x3eda01));};exports[_0xb4b7('0x16')]=function(_0x21c494,_0x5fd966){create(_0x21c494)[_0xb4b7('0xe')](loggerCatch(_0x5fd966));};exports[_0xb4b7('0x17')]=function(_0x1f1d1f,_0x580cdf){moveContact(_0x1f1d1f)['catch'](loggerCatch(_0x580cdf));};exports[_0xb4b7('0x18')]=function(_0x4a09c8,_0x2d31a1,_0x2d767b){if(_0x2d31a1){_0x4a09c8[_0xb4b7('0x19')]=null;}if(_0x2d767b){_0x4a09c8[_0xb4b7('0x1a')]=![];}return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper['rescheduleContact'](_0x4a09c8))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0xb4b7('0x1b')]=function(_0x50363b){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper[_0xb4b7('0x1b')](_0x50363b))['catch'](loggerCatch(_0xb4b7('0x1c')));};exports[_0xb4b7('0x1d')]=function(_0x372a19){return BPromise['resolve']()[_0xb4b7('0xc')](cmHopper['unlockContact']({'UserId':null},_0x372a19,0x1))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0x1e')));};exports['disableContact']=function(_0x4a6662){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper['unlockContact']({'active':![]},_0x4a6662,0x1))['catch'](loggerCatch(_0xb4b7('0x1f')));};exports[_0xb4b7('0x20')]=function(_0x44a8a3){var _0x2acaa7={};_0x2acaa7['type']=_0x44a8a3[_0xb4b7('0x21')];_0x2acaa7[_0xb4b7('0x22')]=_0x44a8a3['uniqueid'];_0x2acaa7['calleridnum']=_0x44a8a3[_0xb4b7('0x23')];_0x2acaa7[_0xb4b7('0x24')]=_0x44a8a3['calleridname'];_0x2acaa7[_0xb4b7('0x25')]=_0x44a8a3[_0xb4b7('0x25')];_0x2acaa7[_0xb4b7('0x26')]=_0x44a8a3[_0xb4b7('0x27')];_0x2acaa7['queuecallerleaveAt']=_0x44a8a3[_0xb4b7('0x27')];_0x2acaa7[_0xb4b7('0x28')]=0x1;_0x2acaa7[_0xb4b7('0x29')]=_0x44a8a3[_0xb4b7('0x2a')];_0x2acaa7[_0xb4b7('0x2b')]=_0x44a8a3[_0xb4b7('0x2c')];_0x2acaa7[_0xb4b7('0x2d')]=_0xb4b7('0x2e');_0x2acaa7['exten']=_0xb4b7('0x2f');_0x2acaa7[_0xb4b7('0x30')]=0x0;_0x2acaa7[_0xb4b7('0x31')]=0x1;_0x2acaa7[_0xb4b7('0x32')]=_0x44a8a3[_0xb4b7('0x2c')];_0x2acaa7['queuecallerexitreason']=_0xb4b7('0x33');return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](voiceQueueReport['create'](_0x2acaa7))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0x34')));};exports['getContactRecallMe']=function(_0x14c99b,_0x520a2a){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper['getContactRecallMe'](_0x14c99b,_0x520a2a))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xb4b7('0x35')]=function(_0xdf742e){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper[_0xb4b7('0x18')](_0xdf742e,!![],!![]))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0x36')));}; \ No newline at end of file +var _0x9e81=['rescheduleContact','UserId','active','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x9e81,0x87));var _0x19e8=function(_0x59e7e0,_0x3ec148){_0x59e7e0=_0x59e7e0-0x0;var _0x26b058=_0x9e81[_0x59e7e0];return _0x26b058;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x19e8('0x0'))(_0x19e8('0x1'));var _=require(_0x19e8('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x19e8('0x3'));var cmHopperHistory=require(_0x19e8('0x4'));var cmHopperBlack=require(_0x19e8('0x5'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x19e8('0x6'));var voiceQueueReport=require(_0x19e8('0x7'));function loggerCatch(_0x2abcdf){return function(_0x5b42f2){logger[_0x19e8('0x8')](_0x2abcdf,util[_0x19e8('0x9')](_0x5b42f2,{'showHidden':![],'depth':null}));};}function create(_0x2ee370){return BPromise[_0x19e8('0xa')]()[_0x19e8('0xb')](cmHopperHistory[_0x19e8('0xc')](_0x2ee370))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x458038){return BPromise[_0x19e8('0xa')]()[_0x19e8('0xb')](agentReportPreview[_0x19e8('0xc')](_0x458038))[_0x19e8('0xd')](loggerCatch(_0x19e8('0xe')));}function moveContact(_0x480742){return BPromise[_0x19e8('0xa')]()[_0x19e8('0xb')](cmHopper['moveContactManagedDialer'](_0x480742,!![]))[_0x19e8('0xd')](loggerCatch(_0x19e8('0xf')));}exports[_0x19e8('0x10')]=function(_0x5e909b){return BPromise[_0x19e8('0xa')]()[_0x19e8('0xb')](cmHopperBlack['checkIsBlackList'](_0x5e909b))[_0x19e8('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x19e8('0x11')]=function(_0x29de8d){return BPromise[_0x19e8('0xa')]()['then'](cmHopper[_0x19e8('0x11')](_0x29de8d))[_0x19e8('0xd')](loggerCatch('[getContactPreview]\x20'));};exports[_0x19e8('0xc')]=function(_0x4e7868,_0x406325){create(_0x4e7868)['catch'](loggerCatch(_0x406325));moveContact(_0x4e7868)[_0x19e8('0xd')](loggerCatch(_0x406325));};exports[_0x19e8('0x12')]=function(_0x20aab3,_0x2e9b3b){createAgent(_0x20aab3)[_0x19e8('0xd')](loggerCatch(_0x2e9b3b));};exports[_0x19e8('0x13')]=function(_0x1f87dc,_0x3ff45b){create(_0x1f87dc)['catch'](loggerCatch(_0x3ff45b));};exports[_0x19e8('0x14')]=function(_0x5c61c7,_0x34b647){moveContact(_0x5c61c7)[_0x19e8('0xd')](loggerCatch(_0x34b647));};exports[_0x19e8('0x15')]=function(_0xc6e6b7,_0x531f92,_0x1458fc){if(_0x531f92){_0xc6e6b7[_0x19e8('0x16')]=null;}if(_0x1458fc){_0xc6e6b7[_0x19e8('0x17')]=![];}return BPromise['resolve']()[_0x19e8('0xb')](cmHopper[_0x19e8('0x15')](_0xc6e6b7))[_0x19e8('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x3c9163){return BPromise[_0x19e8('0xa')]()['then'](cmHopper[_0x19e8('0x18')](_0x3c9163))[_0x19e8('0xd')](loggerCatch('[countReScheduled]\x20'));};exports[_0x19e8('0x19')]=function(_0x1e0e7c){return BPromise['resolve']()[_0x19e8('0xb')](cmHopper['unlockContact']({'UserId':null},_0x1e0e7c,0x1))[_0x19e8('0xd')](loggerCatch(_0x19e8('0x1a')));};exports[_0x19e8('0x1b')]=function(_0x43db86){return BPromise[_0x19e8('0xa')]()[_0x19e8('0xb')](cmHopper[_0x19e8('0x19')]({'active':![]},_0x43db86,0x1))[_0x19e8('0xd')](loggerCatch(_0x19e8('0x1c')));};exports['crateCustomerReportQueue']=function(_0x1b2cf9){var _0x156e0b={};_0x156e0b[_0x19e8('0x1d')]=_0x1b2cf9[_0x19e8('0x1d')];_0x156e0b['uniqueid']=_0x1b2cf9['uniqueid'];_0x156e0b[_0x19e8('0x1e')]=_0x1b2cf9[_0x19e8('0x1e')];_0x156e0b[_0x19e8('0x1f')]=_0x1b2cf9['calleridname'];_0x156e0b[_0x19e8('0x20')]=_0x1b2cf9['queue'];_0x156e0b[_0x19e8('0x21')]=_0x1b2cf9[_0x19e8('0x22')];_0x156e0b[_0x19e8('0x23')]=_0x1b2cf9[_0x19e8('0x22')];_0x156e0b['queuecallercomplete']=0x1;_0x156e0b[_0x19e8('0x24')]=_0x1b2cf9[_0x19e8('0x25')];_0x156e0b[_0x19e8('0x26')]=_0x1b2cf9[_0x19e8('0x27')];_0x156e0b[_0x19e8('0x28')]='from-sip';_0x156e0b[_0x19e8('0x29')]=_0x19e8('0x2a');_0x156e0b[_0x19e8('0x2b')]=0x0;_0x156e0b[_0x19e8('0x2c')]=0x1;_0x156e0b[_0x19e8('0x2d')]=_0x1b2cf9[_0x19e8('0x27')];_0x156e0b['queuecallerexitreason']=_0x19e8('0x2e');return BPromise[_0x19e8('0xa')]()[_0x19e8('0xb')](voiceQueueReport[_0x19e8('0x2f')](_0x156e0b))[_0x19e8('0xd')](loggerCatch(_0x19e8('0x30')));};exports[_0x19e8('0x31')]=function(_0x4dc03a,_0x442281){return BPromise['resolve']()[_0x19e8('0xb')](cmHopper[_0x19e8('0x31')](_0x4dc03a,_0x442281))['catch'](loggerCatch(_0x19e8('0x32')));};exports['rescheduleContactInQueue']=function(_0x1cd3a4){return BPromise['resolve']()[_0x19e8('0xb')](cmHopper[_0x19e8('0x15')](_0x1cd3a4,!![],!![]))['catch'](loggerCatch(_0x19e8('0x33')));}; \ 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 f8da8cc..26a4f3d 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 _0x82fb=['format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','logLookAgent','UserId','endtime','ringtime','talktime','answertime','Failure','BOOKED','uniqueid','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','active','scheduledat','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','voice','mandatoryDisposition','buildObj','buildAcw','interface','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','channelAgent','countcongestionretry','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty'];(function(_0x11471d,_0x47f2ad){var _0x197d16=function(_0x47a4a2){while(--_0x47a4a2){_0x11471d['push'](_0x11471d['shift']());}};_0x197d16(++_0x47f2ad);}(_0x82fb,0x194));var _0xb82f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x82fb[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0xb82f('0x0'));var _=require(_0xb82f('0x1'));var moment=require(_0xb82f('0x2'));var logger=require(_0xb82f('0x3'))(_0xb82f('0x4'));var ipAgi=process['env'][_0xb82f('0x5')]||_0xb82f('0x6');function getSeconds(_0x70e62d,_0x387ebb){var _0x33d7c8=moment(_0x70e62d)[_0xb82f('0x7')](0x0);var _0x37ad12=moment(_0x387ebb)[_0xb82f('0x7')](0x0);return _0x33d7c8[_0xb82f('0x8')](_0x37ad12,_0xb82f('0x9'));}exports[_0xb82f('0xa')]=function(_0xaca1f6){return function(_0x11b55b){logger[_0xb82f('0xb')](_0xaca1f6,util[_0xb82f('0xc')](_0x11b55b,{'showHidden':![],'depth':null}));};};exports[_0xb82f('0xd')]=function(_0x288035,_0x2f1121){logger[_0xb82f('0xe')](_0x288035,util[_0xb82f('0xc')](_0x2f1121,{'showHidden':![],'depth':null}));};exports[_0xb82f('0xf')]=function(_0x31ab13,_0x3c4201){logger[_0xb82f('0xb')](_0x31ab13,util[_0xb82f('0xc')](_0x3c4201,{'showHidden':![],'depth':null}));};exports[_0xb82f('0x10')]=function(_0xd883ed){return function(_0x3e9f87){logger[_0xb82f('0xe')](_0xd883ed,util[_0xb82f('0xc')](_0x3e9f87,{'showHidden':![],'depth':null}));};};exports[_0xb82f('0x11')]=function(_0x1a3686,_0x5697ad,_0x4a9c20){return{'message':_0x1a3686,'unlock':_0x5697ad,'active':_0x4a9c20};};exports[_0xb82f('0x12')]=function(_0x1afb4d,_0x1dd31e,_0x11bece){if(!_[_0xb82f('0x13')](_0x11bece)&&_0xb82f('0x14')===typeof _0x11bece&&!_[_0xb82f('0x15')](_0x11bece)){if(!_['isUndefined'](_0x1dd31e)&&_0xb82f('0x14')===typeof _0x1dd31e&&!_[_0xb82f('0x15')](_0x1dd31e)){return util[_0xb82f('0x16')](_0xb82f('0x17'),_0x1dd31e,_0x11bece);}return util[_0xb82f('0x16')](_0xb82f('0x17'),_0x11bece,_0x11bece);}if(!_[_0xb82f('0x13')](_0x1afb4d)&&_0xb82f('0x14')===typeof _0x1afb4d&&!_['isEmpty'](_0x1afb4d)){return _0x1afb4d;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x52a94d){if(_[_0xb82f('0x18')](_0x52a94d)){return![];}return _0x52a94d;};exports[_0xb82f('0x19')]=function(_0x39d68c,_0x8d0c8b,_0x3103eb,_0x54b96a,_0x44aa39,_0x125737){var _0x8913be={'XMD-QUEUE':_0x8d0c8b['Queue']?_0x8d0c8b[_0xb82f('0x1a')][_0xb82f('0x1b')]:'','XMD-CALLERID':_0x54b96a,'XMD-CALLERID-PREVIEW':_0x125737?util[_0xb82f('0x16')]('\x22%s\x22\x20<%s>',_0x125737['calleridname'],_0x125737[_0xb82f('0x1c')]):_0x54b96a,'XMD-DIALID':_0x44aa39,'XMD-CONTACTID':_0x8d0c8b[_0xb82f('0x1d')],'XMD-CDRTYPE':_0xb82f('0x1e'),'CALLERID(all)':_0x54b96a,'XMD-VOICEQUEUEID':_0x8d0c8b[_0xb82f('0x1f')],'XMD-DIALCHANNEL':_0x3103eb,'XMD-DIALTIMEOUT':_0x39d68c[_0xb82f('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0xb82f('0x16')](_0xb82f('0x21'),_0x39d68c[_0xb82f('0x22')]?'g':'',_[_0xb82f('0x15')](_0x39d68c[_0xb82f('0x23')])?'':_0xb82f('0x24')),'XMD-DIALURL':_0x39d68c[_0xb82f('0x25')]||'','XMD-AGI':_0x39d68c[_0xb82f('0x26')]?util[_0xb82f('0x16')](_0xb82f('0x27'),ipAgi,_0x39d68c[_0xb82f('0x26')]):_0xb82f('0x28'),'XMD-AGIAFTER':_0x39d68c['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x39d68c[_0xb82f('0x22')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x125737?_0x125737[_0xb82f('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0x125737?_0x125737['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xb82f('0x2a')};if(!_[_0xb82f('0x15')](_0x39d68c[_0xb82f('0x23')])){_0x8913be[util[_0xb82f('0x16')]('%s',_0xb82f('0x2b'))]=_0x39d68c['monitor_format'];_0x8913be[util[_0xb82f('0x16')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x44aa39;}if(_0x8d0c8b&&_0x8d0c8b[_0xb82f('0x2c')]){for(var _0x1dd153 in _0x8d0c8b[_0xb82f('0x2c')]){if(_0x8d0c8b[_0xb82f('0x2c')][_0xb82f('0x2d')](_0x1dd153)){if(!_[_0xb82f('0x18')](_0x8d0c8b['Contact'][_0x1dd153])&&_0x1dd153!=='id'&&_0x1dd153!==_0xb82f('0x2e')&&_0x1dd153!==_0xb82f('0x2f')&&_0x1dd153!==_0xb82f('0x30')){_0x8913be[util[_0xb82f('0x16')]('%s%s','XMD-',_['toUpper'](_0x1dd153))]=_0x8d0c8b[_0xb82f('0x2c')][_0x1dd153];}}}}return _0x8913be;};exports['toLowerVariables']=function(_0x541d45){var _0x3c0ec2={};for(var _0x2093f8 in _0x541d45){if(_0x541d45[_0xb82f('0x2d')](_0x2093f8)){_0x3c0ec2[util[_0xb82f('0x16')]('%s',_['toLower'](_0x2093f8))]=_0x541d45[_0x2093f8];}}return{'variables':_0x3c0ec2};};exports[_0xb82f('0x31')]=function(_0x207002,_0x9f4892){if(!_['isNil'](_0x207002)){if(_0x207002[_0xb82f('0x2d')]('originated')){if(_0x207002[_0xb82f('0x32')]>0x0){_0x207002[_0xb82f('0x32')]-=0x1;}else{logger[_0xb82f('0xb')](_0xb82f('0x33'),_0x9f4892);}}}else{logger['error'](_0xb82f('0x34'),_0x9f4892);}};exports[_0xb82f('0x35')]=function(_0x135d62){var _0x4a1126=moment()[_0xb82f('0x16')](_0xb82f('0x36'));_0x135d62[_0xb82f('0x37')]=0xd;_0x135d62[_0xb82f('0x38')]='Blacklist';_0x135d62[_0xb82f('0x39')]=_0x4a1126;_0x135d62[_0xb82f('0x3a')]=_0x4a1126;_0x135d62['endtime']=_0x4a1126;};exports['logAgent']=function(_0x4a00aa,_0x7a291a,_0x22ee03){var _0x19e2ed=moment()['format'](_0xb82f('0x36'));_0x4a00aa[_0xb82f('0x37')]=_0x7a291a;_0x4a00aa[_0xb82f('0x38')]=_0x22ee03;_0x4a00aa['responsetime']=_0x19e2ed;_0x4a00aa['ringtime']=getSeconds(_0x4a00aa['responsetime'],_0x4a00aa[_0xb82f('0x39')]);};exports[_0xb82f('0x3b')]=function(_0x44c7b9,_0x26f914,_0x1a0efa){_0x44c7b9['membername']=_0x26f914;_0x44c7b9[_0xb82f('0x3c')]=_0x1a0efa;};exports['logCustomer']=function(_0x2d1e87,_0x433ed6,_0x4f313b){var _0x5c3565=moment()[_0xb82f('0x16')](_0xb82f('0x36'));_0x2d1e87[_0xb82f('0x37')]=_0x433ed6;_0x2d1e87['statedesc']=_0x4f313b;_0x2d1e87[_0xb82f('0x3a')]=_0x2d1e87[_0xb82f('0x3a')]?_0x2d1e87[_0xb82f('0x3a')]:_0x5c3565;_0x2d1e87[_0xb82f('0x3d')]=_0x2d1e87[_0xb82f('0x3d')]?_0x2d1e87[_0xb82f('0x3d')]:_0x5c3565;_0x2d1e87[_0xb82f('0x3e')]=getSeconds(_0x2d1e87['responsetime']||0x0,_0x2d1e87[_0xb82f('0x39')]||0x0);_0x2d1e87[_0xb82f('0x3f')]=_0x2d1e87['answertime']?getSeconds(_0x2d1e87[_0xb82f('0x3d')],_0x2d1e87[_0xb82f('0x40')]):0x0;};exports['isFailure']=function(_0x220eae){return _0x220eae===_0xb82f('0x41');};exports['variablesAction']=function(_0x41407a,_0x15ed9c,_0x22341e,_0x1bacc0,_0x54945c){var _0x29fa3a=_0x1bacc0?'RECALL':_0x41407a['calleridname'];_0x29fa3a=_0x54945c?_0xb82f('0x42'):_0x29fa3a;return{'actionid':_0x41407a[_0xb82f('0x43')],'action':'originate','channel':_0x41407a['channelAgent'],'callerid':util[_0xb82f('0x16')](_0xb82f('0x17'),_0x29fa3a,_0x41407a[_0xb82f('0x1c')]),'Exten':'xcally-motion-preview','Context':_0xb82f('0x44'),'Priority':'1','variable':_0x22341e,'timeout':(_0x15ed9c[_0xb82f('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x41407a[_0xb82f('0x43')]};};exports[_0xb82f('0x46')]=function(_0x377f4c){return _0x377f4c[_0xb82f('0x47')]+_0x377f4c['countcongestionretry']+_0x377f4c[_0xb82f('0x48')]+_0x377f4c[_0xb82f('0x49')]+_0x377f4c[_0xb82f('0x4a')];};exports[_0xb82f('0x4b')]=function(_0x1729f3){var _0x41a8d0=_['clone'](_0x1729f3);_0x41a8d0[_0xb82f('0x37')]=0xf;_0x41a8d0['statedesc']=_0xb82f('0x4c');return _0x41a8d0;};exports['scheduledAt']=function(_0x2c7e0a,_0x532963,_0x2402bf){var _0x119a55={};_0x119a55[_0x532963]=_0x2c7e0a[_0x532963];_0x119a55[_0xb82f('0x4d')]=![];_0x119a55[_0xb82f('0x4e')]=moment()['add'](_0x2402bf,_0xb82f('0x4f'))[_0xb82f('0x16')](_0xb82f('0x36'));_0x119a55[_0xb82f('0x1d')]=_0x2c7e0a[_0xb82f('0x1d')];_0x119a55[_0xb82f('0x50')]=_0x2c7e0a['ListId'];_0x119a55[_0xb82f('0x1f')]=_0x2c7e0a[_0xb82f('0x1f')]||undefined;return _0x119a55;};exports['decrementTalkink']=function(_0x28009d,_0x1cc914){if(!_[_0xb82f('0x18')](_0x28009d)){if(_0x28009d[_0xb82f('0x51')]>0x0){_0x28009d[_0xb82f('0x51')]-=0x1;}else{logger[_0xb82f('0xb')](_0x1cc914,_0xb82f('0x52'));}}else{logger[_0xb82f('0xb')](_0x1cc914,_0xb82f('0x53'));}};exports['IsNotLoggedIn']=function(_0x37239d){if(_0x37239d<=0x0){return!![];}return![];};function buildObj(_0x353972,_0x11f4e5,_0x29110f){_0x353972[_0xb82f('0x54')]=_0x11f4e5;_0x353972[_0xb82f('0x1b')]=_0x353972[_0xb82f('0x55')];_0x353972['interface']=_0x353972['channelAgent'];_0x353972['motionChannel']=_0xb82f('0x56');if(_0x29110f){_0x353972['mandatoryDisposition']=_0x29110f[_0xb82f('0x57')];}return _0x353972;}exports[_0xb82f('0x58')]=buildObj;exports[_0xb82f('0x59')]=function(_0x37cf97){var _0x43c949={};_0x43c949['queue']=_0x37cf97[_0xb82f('0x55')];_0x43c949[_0xb82f('0x5a')]=_0x37cf97['channelAgent'];_0x43c949[_0xb82f('0x43')]=_0x37cf97[_0xb82f('0x43')];return _0x43c949;};exports['agentReadyId']=function(_0x527d88){var _0x1b474b=[];for(var _0x534427 in _0x527d88){if(_0x527d88[_0xb82f('0x2d')](_0x534427)){if(!_[_0xb82f('0x18')](_0x527d88[_0x534427])&&_0x527d88[_0x534427]['state']===_0xb82f('0x5b')&&_0x527d88[_0x534427][_0xb82f('0x5c')]===_0xb82f('0x5d')){_0x1b474b[_0xb82f('0x5e')](_0x527d88[_0x534427]['id']);}}}return _0x1b474b;};exports[_0xb82f('0x5f')]=function(_0x4d7a27){var _0x260f93=moment()[_0xb82f('0x7')](0x0);var _0x5ae9d8=moment(_0x4d7a27)[_0xb82f('0x7')](0x0);return _0x260f93[_0xb82f('0x8')](_0x5ae9d8,_0xb82f('0x9'));};exports[_0xb82f('0x60')]=function(_0x369f44){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x369f44[_0xb82f('0x1d')],'ListId':_0x369f44[_0xb82f('0x50')],'VoiceQueueId':_0x369f44['VoiceQueueId']||undefined,'CampaignId':_0x369f44[_0xb82f('0x61')]||undefined};};exports[_0xb82f('0x62')]=function(_0x137e81){if(_0x137e81===_0xb82f('0x43')||_0x137e81===_0xb82f('0x63')||_0x137e81===_0xb82f('0x55')||_0x137e81===_0xb82f('0x64')||_0x137e81===_0xb82f('0x65')||_0x137e81===_0xb82f('0x66')||_0x137e81===_0xb82f('0x67')||_0x137e81===_0xb82f('0x68')||_0x137e81==='calleridname'||_0x137e81==='active'||_0x137e81===_0xb82f('0x1c')||_0x137e81===_0xb82f('0x4e')||_0x137e81===_0xb82f('0x47')||_0x137e81===_0xb82f('0x69')||_0x137e81==='countnoanswerretry'||_0x137e81===_0xb82f('0x6a')||_0x137e81===_0xb82f('0x6b')||_0x137e81===_0xb82f('0x6c')||_0x137e81==='callbackat'||_0x137e81===_0xb82f('0x6d')||_0x137e81===_0xb82f('0x1d')||_0x137e81===_0xb82f('0x50')||_0x137e81==='UserId'||_0x137e81==='VoiceQueueId'||_0x137e81===_0xb82f('0x6e')||_0x137e81===_0xb82f('0x6f')||_0x137e81===_0xb82f('0x70')||_0x137e81===_0xb82f('0x71')||_0x137e81==='xmd-listid'||_0x137e81===_0xb82f('0x72')||_0x137e81==='xmd-dialtimeout'||_0x137e81==='xmd-dialoptions'||_0x137e81===_0xb82f('0x73')||_0x137e81==='xmd-dialchannel'||_0x137e81===_0xb82f('0x74')||_0x137e81===_0xb82f('0x75')||_0x137e81===_0xb82f('0x76')||_0x137e81===_0xb82f('0x77')||_0x137e81==='xmd-agi'||_0x137e81===_0xb82f('0x78')||_0x137e81===_0xb82f('0x79')||_0x137e81===_0xb82f('0x7a')||_0x137e81===_0xb82f('0x7b')||_0x137e81==='rtpaudioqosloss'||_0x137e81===_0xb82f('0x7c')||_0x137e81==='rtpaudioqosrtt'||_0x137e81===_0xb82f('0x7d')||_0x137e81==='rtpaudioqos'||_0x137e81===_0xb82f('0x79')||_0x137e81===_0xb82f('0x7a')||_0x137e81===_0xb82f('0x7b')||_0x137e81===_0xb82f('0x7e')||_0x137e81===_0xb82f('0x7c')||_0x137e81===_0xb82f('0x7f')||_0x137e81==='rtpaudioqosrttbridged'||_0x137e81===_0xb82f('0x80')||_0x137e81==='bridgepvtcallid'||_0x137e81==='state'||_0x137e81===_0xb82f('0x38')){return![];}return!![];};exports[_0xb82f('0x81')]=function(_0x47e408,_0xdb5b7b){var _0x339ebf,_0x1870ae,_0xdcf83b;if(_0xdb5b7b<=0x0){_0xdb5b7b=0x1;}_0x339ebf=new RegExp(_0xb82f('0x82')+_0xdb5b7b+'}$');_0x1870ae=Math['pow'](0xa,_0xdb5b7b-0x1);_0xdcf83b=Math[_0xb82f('0x83')](0xa,_0xdb5b7b)-0x1;return util[_0xb82f('0x16')]('%s',_['replace'](_0x47e408,_0x339ebf,_[_0xb82f('0x84')](_0x1870ae,_0xdcf83b)));};exports[_0xb82f('0x85')]=function(_0x33b329){var _0x18268a=_0x33b329[_0xb82f('0x86')](/"(.*?)"/);return _0x18268a?_0x18268a[0x1]:_0x33b329;};exports[_0xb82f('0x87')]=function(_0xd5afb7){var _0x3d8b5c=_0xd5afb7[_0xb82f('0x86')](/<(.*?)>/);return _0x3d8b5c?_0x3d8b5c[0x1]:_0xd5afb7;};function buildNoAnswerEventPayload(_0xeb082f,_0x4354b2){var _0x2315ab=buildObj(_0xeb082f,_0xb82f('0x88'));if(!_[_0xb82f('0x15')](_0x4354b2[_0xb82f('0x89')])){Object[_0xb82f('0x8a')](_0x4354b2[_0xb82f('0x89')])[_0xb82f('0x8b')](function(_0x9df1d9){_0x2315ab[_0x9df1d9[_0xb82f('0x8c')]()]=_0x4354b2[_0xb82f('0x89')][_0x9df1d9];});}return _0x2315ab;}exports[_0xb82f('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x40c5=['toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','diff','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','callback','callbackuniqueid','callbackat','UserId','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','moment','preview','milliseconds','loggerCatch','inspect','info','loggerError','error','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toUpper','toLowerVariables'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x40c5,0xee));var _0x540c=function(_0x51d810,_0x30b6c3){_0x51d810=_0x51d810-0x0;var _0x2ad77b=_0x40c5[_0x51d810];return _0x2ad77b;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x540c('0x0'));var logger=require('../../../../config/logger')(_0x540c('0x1'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0xd50e72,_0x5297a8){var _0x8eb460=moment(_0xd50e72)[_0x540c('0x2')](0x0);var _0x3d5f17=moment(_0x5297a8)[_0x540c('0x2')](0x0);return _0x8eb460['diff'](_0x3d5f17,'seconds');}exports[_0x540c('0x3')]=function(_0x3e19eb){return function(_0x12e4cc){logger['error'](_0x3e19eb,util[_0x540c('0x4')](_0x12e4cc,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x21e202,_0x17eeae){logger[_0x540c('0x5')](_0x21e202,util[_0x540c('0x4')](_0x17eeae,{'showHidden':![],'depth':null}));};exports[_0x540c('0x6')]=function(_0x715236,_0x216778){logger[_0x540c('0x7')](_0x715236,util['inspect'](_0x216778,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x4fd9b9){return function(_0x521ff2){logger['info'](_0x4fd9b9,util[_0x540c('0x4')](_0x521ff2,{'showHidden':![],'depth':null}));};};exports[_0x540c('0x8')]=function(_0x412d67,_0x2dc0a4,_0x3ccd3f){return{'message':_0x412d67,'unlock':_0x2dc0a4,'active':_0x3ccd3f};};exports[_0x540c('0x9')]=function(_0x2247e8,_0x5894f2,_0x282989){if(!_[_0x540c('0xa')](_0x282989)&&_0x540c('0xb')===typeof _0x282989&&!_[_0x540c('0xc')](_0x282989)){if(!_['isUndefined'](_0x5894f2)&&_0x540c('0xb')===typeof _0x5894f2&&!_[_0x540c('0xc')](_0x5894f2)){return util[_0x540c('0xd')]('\x22%s\x22\x20<%s>',_0x5894f2,_0x282989);}return util['format'](_0x540c('0xe'),_0x282989,_0x282989);}if(!_[_0x540c('0xa')](_0x2247e8)&&_0x540c('0xb')===typeof _0x2247e8&&!_[_0x540c('0xc')](_0x2247e8)){return _0x2247e8;}return _0x540c('0xf');};exports[_0x540c('0x10')]=function(_0x3ca756){if(_[_0x540c('0x11')](_0x3ca756)){return![];}return _0x3ca756;};exports[_0x540c('0x12')]=function(_0x27e005,_0x23e059,_0x2fab51,_0x3dc95a,_0x5d8536,_0x1e31a8){var _0x513478={'XMD-QUEUE':_0x23e059['Queue']?_0x23e059[_0x540c('0x13')][_0x540c('0x14')]:'','XMD-CALLERID':_0x3dc95a,'XMD-CALLERID-PREVIEW':_0x1e31a8?util['format'](_0x540c('0xe'),_0x1e31a8[_0x540c('0x15')],_0x1e31a8[_0x540c('0x16')]):_0x3dc95a,'XMD-DIALID':_0x5d8536,'XMD-CONTACTID':_0x23e059[_0x540c('0x17')],'XMD-CDRTYPE':_0x540c('0x18'),'CALLERID(all)':_0x3dc95a,'XMD-VOICEQUEUEID':_0x23e059[_0x540c('0x19')],'XMD-DIALCHANNEL':_0x2fab51,'XMD-DIALTIMEOUT':_0x27e005[_0x540c('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x540c('0xd')](_0x540c('0x1b'),_0x27e005['dialQueueProject2']?'g':'',_['isEmpty'](_0x27e005[_0x540c('0x1c')])?'':_0x540c('0x1d')),'XMD-DIALURL':_0x27e005['dialPreviewUrl']||'','XMD-AGI':_0x27e005[_0x540c('0x1e')]?util[_0x540c('0xd')](_0x540c('0x1f'),ipAgi,_0x27e005[_0x540c('0x1e')]):'NONE','XMD-AGIAFTER':_0x27e005['dialQueueProject2']?util[_0x540c('0xd')]('\x22agi://%s/square,%s\x22',ipAgi,_0x27e005[_0x540c('0x20')]):_0x540c('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x1e31a8?_0x1e31a8[_0x540c('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x1e31a8?_0x1e31a8['originatecalleridname']:'','XMD-DESTINATION':_0x540c('0x23'),'SIPADDHEADER':_0x540c('0x24')};if(!_[_0x540c('0xc')](_0x27e005[_0x540c('0x1c')])){_0x513478[util['format']('%s',_0x540c('0x25'))]=_0x27e005[_0x540c('0x1c')];_0x513478[util[_0x540c('0xd')]('%s',_0x540c('0x26'))]=_0x5d8536;}if(_0x23e059&&_0x23e059[_0x540c('0x27')]){for(var _0x1cf076 in _0x23e059[_0x540c('0x27')]){if(_0x23e059[_0x540c('0x27')][_0x540c('0x28')](_0x1cf076)){if(!_[_0x540c('0x11')](_0x23e059['Contact'][_0x1cf076])&&_0x1cf076!=='id'&&_0x1cf076!=='tags'&&_0x1cf076!=='createdAt'&&_0x1cf076!==_0x540c('0x29')){_0x513478[util[_0x540c('0xd')](_0x540c('0x2a'),_0x540c('0x2b'),_[_0x540c('0x2c')](_0x1cf076))]=_0x23e059[_0x540c('0x27')][_0x1cf076];}}}}return _0x513478;};exports[_0x540c('0x2d')]=function(_0x5b2977){var _0x2a9337={};for(var _0x249084 in _0x5b2977){if(_0x5b2977[_0x540c('0x28')](_0x249084)){_0x2a9337[util[_0x540c('0xd')]('%s',_[_0x540c('0x2e')](_0x249084))]=_0x5b2977[_0x249084];}}return{'variables':_0x2a9337};};exports['updateOriginated']=function(_0x1a8aaf,_0x391b1e){if(!_[_0x540c('0x11')](_0x1a8aaf)){if(_0x1a8aaf[_0x540c('0x28')](_0x540c('0x2f'))){if(_0x1a8aaf['originated']>0x0){_0x1a8aaf[_0x540c('0x2f')]-=0x1;}else{logger[_0x540c('0x7')](_0x540c('0x30'),_0x391b1e);}}}else{logger[_0x540c('0x7')](_0x540c('0x31'),_0x391b1e);}};exports[_0x540c('0x32')]=function(_0x13911f){var _0x40dced=moment()[_0x540c('0xd')](_0x540c('0x33'));_0x13911f[_0x540c('0x34')]=0xd;_0x13911f[_0x540c('0x35')]=_0x540c('0x36');_0x13911f['starttime']=_0x40dced;_0x13911f[_0x540c('0x37')]=_0x40dced;_0x13911f[_0x540c('0x38')]=_0x40dced;};exports[_0x540c('0x39')]=function(_0x4d569e,_0x32f860,_0xef7492){var _0x3d2a37=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4d569e[_0x540c('0x34')]=_0x32f860;_0x4d569e[_0x540c('0x35')]=_0xef7492;_0x4d569e[_0x540c('0x37')]=_0x3d2a37;_0x4d569e[_0x540c('0x3a')]=getSeconds(_0x4d569e['responsetime'],_0x4d569e['starttime']);};exports[_0x540c('0x3b')]=function(_0x2b9dd4,_0x1b24b5,_0x3d8c88){_0x2b9dd4[_0x540c('0x3c')]=_0x1b24b5;_0x2b9dd4['UserId']=_0x3d8c88;};exports[_0x540c('0x3d')]=function(_0x262d02,_0x4c0d3f,_0x2d147f){var _0x3d06d2=moment()[_0x540c('0xd')](_0x540c('0x33'));_0x262d02[_0x540c('0x34')]=_0x4c0d3f;_0x262d02[_0x540c('0x35')]=_0x2d147f;_0x262d02[_0x540c('0x37')]=_0x262d02[_0x540c('0x37')]?_0x262d02['responsetime']:_0x3d06d2;_0x262d02['endtime']=_0x262d02['endtime']?_0x262d02[_0x540c('0x38')]:_0x3d06d2;_0x262d02[_0x540c('0x3a')]=getSeconds(_0x262d02[_0x540c('0x37')]||0x0,_0x262d02['starttime']||0x0);_0x262d02[_0x540c('0x3e')]=_0x262d02[_0x540c('0x3f')]?getSeconds(_0x262d02[_0x540c('0x38')],_0x262d02[_0x540c('0x3f')]):0x0;};exports['isFailure']=function(_0x71575){return _0x71575===_0x540c('0x40');};exports[_0x540c('0x41')]=function(_0x1be359,_0x3cefcd,_0x2c5ecd,_0x419685,_0x14510a){var _0xd27c3f=_0x419685?_0x540c('0x42'):_0x1be359['calleridname'];_0xd27c3f=_0x14510a?_0x540c('0x43'):_0xd27c3f;return{'actionid':_0x1be359[_0x540c('0x44')],'action':'originate','channel':_0x1be359[_0x540c('0x45')],'callerid':util[_0x540c('0xd')]('\x22%s\x22\x20<%s>',_0xd27c3f,_0x1be359[_0x540c('0x16')]),'Exten':_0x540c('0x23'),'Context':_0x540c('0x46'),'Priority':'1','variable':_0x2c5ecd,'timeout':(_0x3cefcd['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1be359['uniqueid']};};exports['totalGlobal']=function(_0x5851fa){return _0x5851fa[_0x540c('0x47')]+_0x5851fa[_0x540c('0x48')]+_0x5851fa[_0x540c('0x49')]+_0x5851fa[_0x540c('0x4a')]+_0x5851fa['countnosuchnumberretry'];};exports[_0x540c('0x4b')]=function(_0x19f8c5){var _0x220c46=_[_0x540c('0x4c')](_0x19f8c5);_0x220c46[_0x540c('0x34')]=0xf;_0x220c46['statedesc']=_0x540c('0x4d');return _0x220c46;};exports[_0x540c('0x4e')]=function(_0x267dd1,_0x1b43ff,_0x482cc2){var _0x1d9686={};_0x1d9686[_0x1b43ff]=_0x267dd1[_0x1b43ff];_0x1d9686[_0x540c('0x4f')]=![];_0x1d9686[_0x540c('0x50')]=moment()[_0x540c('0x51')](_0x482cc2,_0x540c('0x52'))[_0x540c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d9686[_0x540c('0x17')]=_0x267dd1[_0x540c('0x17')];_0x1d9686['ListId']=_0x267dd1[_0x540c('0x53')];_0x1d9686['VoiceQueueId']=_0x267dd1[_0x540c('0x19')]||undefined;return _0x1d9686;};exports[_0x540c('0x54')]=function(_0x5b4a18,_0x1edbdb){if(!_[_0x540c('0x11')](_0x5b4a18)){if(_0x5b4a18['pTalking']>0x0){_0x5b4a18[_0x540c('0x55')]-=0x1;}else{logger['error'](_0x1edbdb,_0x540c('0x56'));}}else{logger[_0x540c('0x7')](_0x1edbdb,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x540c('0x57')]=function(_0x53d306){if(_0x53d306<=0x0){return!![];}return![];};function buildObj(_0x180f7f,_0x3a17f4,_0x9e6ec8){_0x180f7f[_0x540c('0x58')]=_0x3a17f4;_0x180f7f[_0x540c('0x14')]=_0x180f7f[_0x540c('0x59')];_0x180f7f[_0x540c('0x5a')]=_0x180f7f['channelAgent'];_0x180f7f[_0x540c('0x5b')]=_0x540c('0x5c');if(_0x9e6ec8){_0x180f7f[_0x540c('0x5d')]=_0x9e6ec8[_0x540c('0x5d')];}return _0x180f7f;}exports[_0x540c('0x5e')]=buildObj;exports['buildAcw']=function(_0xc5c813){var _0x105542={};_0x105542[_0x540c('0x59')]=_0xc5c813[_0x540c('0x59')];_0x105542[_0x540c('0x5a')]=_0xc5c813[_0x540c('0x45')];_0x105542[_0x540c('0x44')]=_0xc5c813[_0x540c('0x44')];return _0x105542;};exports[_0x540c('0x5f')]=function(_0x48dd78){var _0x43570f=[];for(var _0x5405c7 in _0x48dd78){if(_0x48dd78[_0x540c('0x28')](_0x5405c7)){if(!_[_0x540c('0x11')](_0x48dd78[_0x5405c7])&&_0x48dd78[_0x5405c7][_0x540c('0x34')]===_0x540c('0x60')&&_0x48dd78[_0x5405c7][_0x540c('0x61')]===_0x540c('0x62')){_0x43570f[_0x540c('0x63')](_0x48dd78[_0x5405c7]['id']);}}}return _0x43570f;};exports['getDiff']=function(_0xee82bd){var _0x8c5085=moment()[_0x540c('0x2')](0x0);var _0x180dd3=moment(_0xee82bd)[_0x540c('0x2')](0x0);return _0x8c5085[_0x540c('0x64')](_0x180dd3,_0x540c('0x65'));};exports[_0x540c('0x66')]=function(_0x44a369){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x44a369[_0x540c('0x17')],'ListId':_0x44a369['ListId'],'VoiceQueueId':_0x44a369[_0x540c('0x19')]||undefined,'CampaignId':_0x44a369[_0x540c('0x67')]||undefined};};exports[_0x540c('0x68')]=function(_0x39c235){if(_0x39c235==='uniqueid'||_0x39c235===_0x540c('0x69')||_0x39c235===_0x540c('0x59')||_0x39c235==='type'||_0x39c235===_0x540c('0x6a')||_0x39c235===_0x540c('0x6b')||_0x39c235==='membername'||_0x39c235===_0x540c('0x45')||_0x39c235==='calleridname'||_0x39c235===_0x540c('0x4f')||_0x39c235==='calleridnum'||_0x39c235===_0x540c('0x50')||_0x39c235===_0x540c('0x47')||_0x39c235===_0x540c('0x48')||_0x39c235===_0x540c('0x49')||_0x39c235==='countglobal'||_0x39c235===_0x540c('0x6c')||_0x39c235===_0x540c('0x6d')||_0x39c235===_0x540c('0x6e')||_0x39c235==='recallme'||_0x39c235==='ContactId'||_0x39c235==='ListId'||_0x39c235===_0x540c('0x6f')||_0x39c235===_0x540c('0x19')||_0x39c235==='sipcallid'||_0x39c235==='xmd-voicequeueid'||_0x39c235==='xmd-queue'||_0x39c235===_0x540c('0x70')||_0x39c235===_0x540c('0x71')||_0x39c235==='xmd-dialurl'||_0x39c235==='xmd-dialtimeout'||_0x39c235===_0x540c('0x72')||_0x39c235===_0x540c('0x73')||_0x39c235===_0x540c('0x74')||_0x39c235==='xmd-contactid'||_0x39c235===_0x540c('0x75')||_0x39c235==='xmd-callerid'||_0x39c235==='xmd-agiafter'||_0x39c235===_0x540c('0x76')||_0x39c235===_0x540c('0x77')||_0x39c235==='rtpaudioqosbridged'||_0x39c235===_0x540c('0x78')||_0x39c235===_0x540c('0x79')||_0x39c235===_0x540c('0x7a')||_0x39c235===_0x540c('0x7b')||_0x39c235===_0x540c('0x7c')||_0x39c235===_0x540c('0x7d')||_0x39c235===_0x540c('0x77')||_0x39c235===_0x540c('0x7e')||_0x39c235==='rtpaudioqosjitter'||_0x39c235==='rtpaudioqosjitterbridged'||_0x39c235==='rtpaudioqosloss'||_0x39c235===_0x540c('0x7b')||_0x39c235===_0x540c('0x7c')||_0x39c235===_0x540c('0x7d')||_0x39c235===_0x540c('0x7f')||_0x39c235===_0x540c('0x80')||_0x39c235==='state'||_0x39c235===_0x540c('0x35')){return![];}return!![];};exports[_0x540c('0x81')]=function(_0x285fde,_0x4bf624){var _0x486874,_0x33fc8a,_0x2cf698;if(_0x4bf624<=0x0){_0x4bf624=0x1;}_0x486874=new RegExp('\x5cw{0,'+_0x4bf624+'}$');_0x33fc8a=Math['pow'](0xa,_0x4bf624-0x1);_0x2cf698=Math[_0x540c('0x82')](0xa,_0x4bf624)-0x1;return util[_0x540c('0xd')]('%s',_[_0x540c('0x83')](_0x285fde,_0x486874,_[_0x540c('0x84')](_0x33fc8a,_0x2cf698)));};exports[_0x540c('0x85')]=function(_0x223201){var _0x4593f1=_0x223201[_0x540c('0x86')](/"(.*?)"/);return _0x4593f1?_0x4593f1[0x1]:_0x223201;};exports[_0x540c('0x87')]=function(_0x57aacb){var _0x1b14d0=_0x57aacb[_0x540c('0x86')](/<(.*?)>/);return _0x1b14d0?_0x1b14d0[0x1]:_0x57aacb;};function buildNoAnswerEventPayload(_0x4e403c,_0x58d9a9){var _0x4fb0d2=buildObj(_0x4e403c,_0x540c('0x88'));if(!_[_0x540c('0xc')](_0x58d9a9['variables'])){Object[_0x540c('0x89')](_0x58d9a9[_0x540c('0x8a')])[_0x540c('0x8b')](function(_0x2b266c){_0x4fb0d2[_0x2b266c[_0x540c('0x8c')]()]=_0x58d9a9[_0x540c('0x8a')][_0x2b266c];});}return _0x4fb0d2;}exports[_0x540c('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index d7c13d7..43727ad 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 _0x9237=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queuepause'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x9237,0x149));var _0x7923=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x9237[_0x3f0b30];return _0x2748a5;};'use strict';exports[_0x7923('0x0')]={'queue':{'type':_0x7923('0x1'),'required':!![]},'interface':{'type':_0x7923('0x1'),'required':!![]},'membername':{'type':_0x7923('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x7923('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x7923('0x1'),'required':!![]},'interface':{'type':_0x7923('0x1'),'required':!![]}};exports[_0x7923('0x3')]={'interface':{'type':_0x7923('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x7923('0x1'),'required':![]}};exports[_0x7923('0x4')]={'module':{'type':_0x7923('0x1'),'required':![]}};exports[_0x7923('0x5')]={'uniqueid':{'type':_0x7923('0x1'),'required':!![]}};exports[_0x7923('0x6')]={'uniqueid':{'type':_0x7923('0x1'),'required':!![]},'filename':{'type':_0x7923('0x1')},'format':{'type':_0x7923('0x1')},'mixmonitorid':{'type':_0x7923('0x1')}};exports[_0x7923('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x7923('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x7923('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x4dac=['string','number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x4dac,0xfb));var _0xc4da=function(_0x58bba8,_0x213d48){_0x58bba8=_0x58bba8-0x0;var _0x110a16=_0x4dac[_0x58bba8];return _0x110a16;};'use strict';exports[_0xc4da('0x0')]={'queue':{'type':_0xc4da('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xc4da('0x1'),'required':!![]},'penalty':{'type':_0xc4da('0x2'),'required':![]},'paused':{'type':_0xc4da('0x3'),'required':![]}};exports[_0xc4da('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xc4da('0x1'),'required':!![]},'paused':{'type':_0xc4da('0x3')},'reason':{'type':_0xc4da('0x1'),'required':![]}};exports[_0xc4da('0x5')]={'module':{'type':'string','required':![]}};exports[_0xc4da('0x6')]={'uniqueid':{'type':_0xc4da('0x1'),'required':!![]}};exports[_0xc4da('0x7')]={'uniqueid':{'type':_0xc4da('0x1'),'required':!![]},'filename':{'type':_0xc4da('0x1')},'format':{'type':_0xc4da('0x1')},'mixmonitorid':{'type':_0xc4da('0x1')}};exports[_0xc4da('0x8')]={'uniqueid':{'type':_0xc4da('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xc4da('0x1'),'required':!![]},'context':{'type':_0xc4da('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 1c86cc4..453ef41 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 _0x0f9f=['SIP/%s','isNil','format','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','prototype','mergeFromDatabase','length','name','isUndefined','initTelephones','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','initVoiceCallReports','duration','disposition','ANSWERED','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty'];(function(_0x1b7875,_0x3a95ef){var _0x522377=function(_0x42325c){while(--_0x42325c){_0x1b7875['push'](_0x1b7875['shift']());}};_0x522377(++_0x3a95ef);}(_0x0f9f,0xae));var _0xf0f9=function(_0x2420bd,_0xb58e4e){_0x2420bd=_0x2420bd-0x0;var _0x5610b8=_0x0f9f[_0x2420bd];return _0x5610b8;};'use strict';var util=require(_0xf0f9('0x0'));var _=require(_0xf0f9('0x1'));var moment=require(_0xf0f9('0x2'));var Agent=require(_0xf0f9('0x3'));var Telephone=require(_0xf0f9('0x4'));var Trunk=require(_0xf0f9('0x5'));var VoiceQueue=require(_0xf0f9('0x6'));var Trigger=require(_0xf0f9('0x7'));var Template=require(_0xf0f9('0x8'));var Campaign=require(_0xf0f9('0x9'));var VoiceExtension=require(_0xf0f9('0xa'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xf0f9('0xb'));var FreshdeskAccount=require(_0xf0f9('0xc'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xf0f9('0xd'));var DeskAccount=require(_0xf0f9('0xe'));var VtigerAccount=require(_0xf0f9('0xf'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xf0f9('0x10'));var FreshsalesAccount=require(_0xf0f9('0x11'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xf0f9('0x12')]={};this[_0xf0f9('0x13')]={};this[_0xf0f9('0x14')]={};this[_0xf0f9('0x15')]={};this[_0xf0f9('0x16')]={};this[_0xf0f9('0x17')]={};this[_0xf0f9('0x18')]={};this[_0xf0f9('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf0f9('0x1a')]={};this[_0xf0f9('0x1b')]={};this[_0xf0f9('0x1c')]={};this[_0xf0f9('0x1d')]={};this['settings']={};this[_0xf0f9('0x1e')]={};this[_0xf0f9('0x1f')]={};this['sugarcrmAccounts']={};this[_0xf0f9('0x20')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xf0f9('0x21')]={};this['servicenowAccounts']={};this[_0xf0f9('0x22')]={};this['freshsalesAccounts']={};this[_0xf0f9('0x23')]={};};function freeIsNotKey(_0x336483,_0x1a3a82,_0xf4d805){var _0x236cbd=_[_0xf0f9('0x24')](_0x336483,function(_0x10dae6,_0x50d462){return _0x10dae6[_0xf4d805];});for(var _0x44d248 in _0x1a3a82){if(_0x1a3a82[_0xf0f9('0x25')](_0x44d248)){if(!_0x236cbd[_0x44d248]){delete _0x1a3a82[_0x44d248];}}}}function freeIsNotKeySip(_0x43de16,_0x28cc18){var _0x3dc0e3=_[_0xf0f9('0x24')](_0x43de16,function(_0x1765ad,_0x46db47){return util['format'](_0xf0f9('0x26'),_0x1765ad['name']);});for(var _0x3664ff in _0x28cc18){if(_0x28cc18['hasOwnProperty'](_0x3664ff)){if(!_0x3dc0e3[_0x3664ff]){delete _0x28cc18[_0x3664ff];}}}}function freeIsNotKeyAgent(_0x3f4f97,_0x1d5965){var _0x1d90ad=_[_0xf0f9('0x24')](_0x3f4f97,function(_0xaff53c,_0x1b9740){var _0x49bddc=_[_0xf0f9('0x27')](_0xaff53c['interface'])?util[_0xf0f9('0x28')](_0xf0f9('0x26'),_0xaff53c['name']):_0xaff53c[_0xf0f9('0x29')];return _0x49bddc;});for(var _0x20b5dc in _0x1d5965){if(_0x1d5965['hasOwnProperty'](_0x20b5dc)){if(!_0x1d90ad[_0x20b5dc]){delete _0x1d5965[_0x20b5dc];}}}}function clearVoiceCallReports(_0xbbccd9){_0xbbccd9[_0xf0f9('0x2a')]=0x0;_0xbbccd9[_0xf0f9('0x2b')]=0x0;_0xbbccd9[_0xf0f9('0x2c')]=0x0;_0xbbccd9[_0xf0f9('0x2d')]=0x0;_0xbbccd9[_0xf0f9('0x2e')]=0x0;}function clearCampaigns(_0x4c7c7c){if(!_[_0xf0f9('0x2f')](_0x4c7c7c)){for(var _0x4c31f2 in _0x4c7c7c){if(_0x4c7c7c[_0xf0f9('0x25')](_0x4c31f2)){_0x4c7c7c[_0x4c31f2][_0xf0f9('0x30')]=0x0;_0x4c7c7c[_0x4c31f2][_0xf0f9('0x31')]=0x0;}}}}function clearVoiceQueues(_0x14e40f){if(!_['isEmpty'](_0x14e40f)){for(var _0x100543 in _0x14e40f){if(_0x14e40f[_0xf0f9('0x25')](_0x100543)){_0x14e40f[_0x100543][_0xf0f9('0x2a')]=0x0;_0x14e40f[_0x100543]['answered']=0x0;_0x14e40f[_0x100543][_0xf0f9('0x32')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x33')]=0x0;_0x14e40f[_0x100543]['sumHoldTime']=0x0;_0x14e40f[_0x100543][_0xf0f9('0x2d')]=0x0;_0x14e40f[_0x100543]['sumBillable']=0x0;_0x14e40f[_0x100543][_0xf0f9('0x34')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x35')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x36')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x37')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x38')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x39')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x3a')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x3b')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x3c')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x3d')]=0x0;_0x14e40f[_0x100543]['outboundRejectCallsDay']=0x0;_0x14e40f[_0x100543][_0xf0f9('0x3e')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x34')]=0x0;_0x14e40f[_0x100543]['outboundAnswerCallsDay']=0x0;_0x14e40f[_0x100543]['queueStatusComplete']=!![];}}}}Realtime[_0xf0f9('0x3f')][_0xf0f9('0x40')]=function(_0x3ca015,_0x39f6ed){for(var _0xb54f98 in _0x39f6ed){if(_0x3ca015[_0xf0f9('0x25')](_0xb54f98)){_0x3ca015[_0xb54f98]=_0x39f6ed[_0xb54f98];}}};Realtime[_0xf0f9('0x3f')]['initAgents']=function(){var _0x2733e8=this;return function(_0x51a9d6){if(_0x51a9d6){freeIsNotKeyAgent(_0x51a9d6,_0x2733e8[_0xf0f9('0x12')]);for(var _0x3a2fcc=0x0,_0x232561={},_0x555130={};_0x3a2fcc<_0x51a9d6[_0xf0f9('0x41')];_0x3a2fcc+=0x1){_0x232561=_0x51a9d6[_0x3a2fcc];var _0x559498=_[_0xf0f9('0x27')](_0x232561['interface'])?util['format'](_0xf0f9('0x26'),_0x232561[_0xf0f9('0x42')]):_0x232561[_0xf0f9('0x29')];if(_[_0xf0f9('0x43')](_0x2733e8[_0xf0f9('0x12')][_0x559498])){_0x2733e8[_0xf0f9('0x12')][_0x559498]=new Agent(_0x232561);}else{_0x2733e8['mergeFromDatabase'](_0x2733e8['agents'][_0x559498],_0x232561);}}}return _0x2733e8[_0xf0f9('0x12')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x44')]=function(){var _0x55d3a3=this;return function(_0x5b478b){if(_0x5b478b){freeIsNotKeySip(_0x5b478b,_0x55d3a3[_0xf0f9('0x13')]);for(var _0x56832a=0x0,_0x101b93={},_0x2d74bd={};_0x56832a<_0x5b478b[_0xf0f9('0x41')];_0x56832a+=0x1){_0x101b93=_0x5b478b[_0x56832a];if(_[_0xf0f9('0x43')](_0x55d3a3['telephones'][util[_0xf0f9('0x28')](_0xf0f9('0x26'),_0x101b93[_0xf0f9('0x42')])])){_0x55d3a3[_0xf0f9('0x13')][util['format']('SIP/%s',_0x101b93['name'])]=new Telephone(_0x101b93);}else{_0x55d3a3[_0xf0f9('0x40')](_0x55d3a3[_0xf0f9('0x13')][util[_0xf0f9('0x28')](_0xf0f9('0x26'),_0x101b93[_0xf0f9('0x42')])],_0x101b93);}}}return _0x55d3a3[_0xf0f9('0x13')];};};Realtime[_0xf0f9('0x3f')]['initTrunks']=function(){var _0x39a255=this;return function(_0x472264){if(_0x472264){freeIsNotKeySip(_0x472264,_0x39a255[_0xf0f9('0x14')]);for(var _0x2b06a4=0x0,_0x2ee60e={},_0x2bfa1d={};_0x2b06a4<_0x472264['length'];_0x2b06a4+=0x1){_0x2ee60e=_0x472264[_0x2b06a4];if(_[_0xf0f9('0x43')](_0x39a255['trunks'][util[_0xf0f9('0x28')](_0xf0f9('0x26'),_0x2ee60e[_0xf0f9('0x42')])])){_0x39a255[_0xf0f9('0x14')][util[_0xf0f9('0x28')]('SIP/%s',_0x2ee60e[_0xf0f9('0x42')])]=new Trunk(_0x2ee60e);}else{_0x39a255['mergeFromDatabase'](_0x39a255[_0xf0f9('0x14')][util[_0xf0f9('0x28')](_0xf0f9('0x26'),_0x2ee60e[_0xf0f9('0x42')])],_0x2ee60e);}}}return _0x39a255[_0xf0f9('0x14')];};};Realtime[_0xf0f9('0x3f')]['initVoiceQueues']=function(){var _0x1a4939=this;return function(_0x344d0b){if(_0x344d0b){freeIsNotKey(_0x344d0b,_0x1a4939[_0xf0f9('0x15')],'name');for(var _0x161f45=0x0,_0x4fa0a1={},_0xcb8767={};_0x161f45<_0x344d0b['length'];_0x161f45+=0x1){_0x4fa0a1=_0x344d0b[_0x161f45];if(_['isUndefined'](_0x1a4939['voiceQueues'][_0x4fa0a1['name']])){_0x1a4939[_0xf0f9('0x15')][_0x4fa0a1['name']]=new VoiceQueue(_0x4fa0a1);}else{_0x1a4939[_0xf0f9('0x40')](_0x1a4939[_0xf0f9('0x15')][_0x4fa0a1['name']],_0x4fa0a1);}}}return _0x1a4939[_0xf0f9('0x15')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x45')]=function(){var _0x2789c6=this;return function(_0x21b236){if(_0x21b236){freeIsNotKey(_0x21b236,_0x2789c6['triggers'],'id');for(var _0x1a5353=0x0,_0x9f839c={},_0x10c9b0={};_0x1a5353<_0x21b236[_0xf0f9('0x41')];_0x1a5353+=0x1){_0x9f839c=_0x21b236[_0x1a5353];if(_['isUndefined'](_0x2789c6[_0xf0f9('0x16')][_0x9f839c['id']])){_0x2789c6[_0xf0f9('0x16')][_0x9f839c['id']]=new Trigger(_0x9f839c);}else{_0x2789c6[_0xf0f9('0x40')](_0x2789c6[_0xf0f9('0x16')][_0x9f839c['id']],_0x9f839c);}}}return _0x2789c6[_0xf0f9('0x16')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x46')]=function(){var _0x299cec=this;return function(_0x248dd2){if(_0x248dd2){freeIsNotKey(_0x248dd2,_0x299cec[_0xf0f9('0x18')],'id');for(var _0x1dcb00=0x0,_0x6514f={},_0x499129={};_0x1dcb00<_0x248dd2[_0xf0f9('0x41')];_0x1dcb00+=0x1){_0x6514f=_0x248dd2[_0x1dcb00];if(_[_0xf0f9('0x43')](_0x299cec[_0xf0f9('0x18')][_0x6514f['id']])){_0x299cec['templates'][_0x6514f['id']]=new Template(_0x6514f);}else{_0x299cec[_0xf0f9('0x40')](_0x299cec[_0xf0f9('0x18')][_0x6514f['id']],_0x6514f);}}}return _0x299cec[_0xf0f9('0x18')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x47')]=function(){var _0x214439=this;return function(_0x177d56){if(_0x177d56){freeIsNotKey(_0x177d56,_0x214439[_0xf0f9('0x1e')],'id');for(var _0x4ea226=0x0,_0x850e62={},_0x14280e={};_0x4ea226<_0x177d56['length'];_0x4ea226+=0x1){_0x850e62=_0x177d56[_0x4ea226];if(_[_0xf0f9('0x43')](_0x214439[_0xf0f9('0x1e')][_0x850e62['id']])){_0x214439[_0xf0f9('0x1e')][_0x850e62['id']]=new ZendeskAccount(_0x850e62);}else{_0x214439[_0xf0f9('0x40')](_0x214439['zendeskAccounts'][_0x850e62['id']],_0x850e62);}}}return _0x214439[_0xf0f9('0x1e')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x48')]=function(){var _0x4cacda=this;return function(_0x1c7c33){if(_0x1c7c33){freeIsNotKey(_0x1c7c33,_0x4cacda['salesforceAccounts'],'id');for(var _0x34d364=0x0,_0x6ea364={},_0x364333={};_0x34d364<_0x1c7c33[_0xf0f9('0x41')];_0x34d364+=0x1){_0x6ea364=_0x1c7c33[_0x34d364];if(_[_0xf0f9('0x43')](_0x4cacda['salesforceAccounts'][_0x6ea364['id']])){_0x4cacda[_0xf0f9('0x1f')][_0x6ea364['id']]=new SalesforceAccount(_0x6ea364);}else{_0x4cacda[_0xf0f9('0x40')](_0x4cacda[_0xf0f9('0x1f')][_0x6ea364['id']],_0x6ea364);}}}return _0x4cacda[_0xf0f9('0x1f')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x49')]=function(){var _0xef3fc4=this;return function(_0x296ad9){if(_0x296ad9){freeIsNotKey(_0x296ad9,_0xef3fc4[_0xf0f9('0x20')],'id');for(var _0x266cca=0x0,_0x59b700={},_0x3cbc15={};_0x266cca<_0x296ad9['length'];_0x266cca+=0x1){_0x59b700=_0x296ad9[_0x266cca];if(_[_0xf0f9('0x43')](_0xef3fc4[_0xf0f9('0x20')][_0x59b700['id']])){_0xef3fc4[_0xf0f9('0x20')][_0x59b700['id']]=new FreshdeskAccount(_0x59b700);}else{_0xef3fc4['mergeFromDatabase'](_0xef3fc4[_0xf0f9('0x20')][_0x59b700['id']],_0x59b700);}}}return _0xef3fc4[_0xf0f9('0x20')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x4a')]=function(){var _0x320b39=this;return function(_0x5d150a){if(_0x5d150a){freeIsNotKey(_0x5d150a,_0x320b39[_0xf0f9('0x4b')],'id');for(var _0x24e31f=0x0,_0xf49044={},_0x228d12={};_0x24e31f<_0x5d150a['length'];_0x24e31f+=0x1){_0xf49044=_0x5d150a[_0x24e31f];if(_[_0xf0f9('0x43')](_0x320b39[_0xf0f9('0x4b')][_0xf49044['id']])){_0x320b39['zohoAccounts'][_0xf49044['id']]=new ZohoAccount(_0xf49044);}else{_0x320b39['mergeFromDatabase'](_0x320b39[_0xf0f9('0x4b')][_0xf49044['id']],_0xf49044);}}}return _0x320b39[_0xf0f9('0x4b')];};};Realtime[_0xf0f9('0x3f')]['initDeskAccounts']=function(){var _0x3abb24=this;return function(_0x27175a){if(_0x27175a){freeIsNotKey(_0x27175a,_0x3abb24[_0xf0f9('0x4c')],'id');for(var _0x31cfd0=0x0,_0x464ee7={},_0x189c7a={};_0x31cfd0<_0x27175a[_0xf0f9('0x41')];_0x31cfd0+=0x1){_0x464ee7=_0x27175a[_0x31cfd0];if(_[_0xf0f9('0x43')](_0x3abb24[_0xf0f9('0x4c')][_0x464ee7['id']])){_0x3abb24[_0xf0f9('0x4c')][_0x464ee7['id']]=new DeskAccount(_0x464ee7);}else{_0x3abb24[_0xf0f9('0x40')](_0x3abb24[_0xf0f9('0x4c')][_0x464ee7['id']],_0x464ee7);}}}return _0x3abb24[_0xf0f9('0x4c')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x4d')]=function(){var _0x2e172e=this;return function(_0x50ddb6){if(_0x50ddb6){freeIsNotKey(_0x50ddb6,_0x2e172e['sugarcrmAccounts'],'id');for(var _0x1f6c19=0x0,_0x3e9756={},_0x4efd30={};_0x1f6c19<_0x50ddb6['length'];_0x1f6c19+=0x1){_0x3e9756=_0x50ddb6[_0x1f6c19];if(_[_0xf0f9('0x43')](_0x2e172e['sugarcrmAccounts'][_0x3e9756['id']])){_0x2e172e[_0xf0f9('0x4e')][_0x3e9756['id']]=new SugarcrmAccount(_0x3e9756);}else{_0x2e172e[_0xf0f9('0x40')](_0x2e172e[_0xf0f9('0x4e')][_0x3e9756['id']],_0x3e9756);}}}return _0x2e172e['sugarcrmAccounts'];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x4f')]=function(){var _0x377589=this;return function(_0x258c9f){if(_0x258c9f){freeIsNotKey(_0x258c9f,_0x377589[_0xf0f9('0x21')],'id');for(var _0x2ca137=0x0,_0x3700e0={},_0x5b3ffc={};_0x2ca137<_0x258c9f[_0xf0f9('0x41')];_0x2ca137+=0x1){_0x3700e0=_0x258c9f[_0x2ca137];if(_['isUndefined'](_0x377589['vtigerAccounts'][_0x3700e0['id']])){_0x377589[_0xf0f9('0x21')][_0x3700e0['id']]=new VtigerAccount(_0x3700e0);}else{_0x377589[_0xf0f9('0x40')](_0x377589[_0xf0f9('0x21')][_0x3700e0['id']],_0x3700e0);}}}return _0x377589['vtigerAccounts'];};};Realtime[_0xf0f9('0x3f')]['initServicenowAccounts']=function(){var _0xcf32fa=this;return function(_0x72f66d){if(_0x72f66d){freeIsNotKey(_0x72f66d,_0xcf32fa[_0xf0f9('0x50')],'id');for(var _0x3c7eda=0x0,_0x59313e={},_0x2759d3={};_0x3c7eda<_0x72f66d[_0xf0f9('0x41')];_0x3c7eda+=0x1){_0x59313e=_0x72f66d[_0x3c7eda];if(_[_0xf0f9('0x43')](_0xcf32fa[_0xf0f9('0x50')][_0x59313e['id']])){_0xcf32fa[_0xf0f9('0x50')][_0x59313e['id']]=new ServicenowAccount(_0x59313e);}else{_0xcf32fa[_0xf0f9('0x40')](_0xcf32fa[_0xf0f9('0x50')][_0x59313e['id']],_0x59313e);}}}return _0xcf32fa[_0xf0f9('0x50')];};};Realtime[_0xf0f9('0x3f')]['initDynamics365Accounts']=function(){var _0x5c73fc=this;return function(_0x1664fb){if(_0x1664fb){freeIsNotKey(_0x1664fb,_0x5c73fc[_0xf0f9('0x22')],'id');for(var _0x4bf195=0x0,_0x5a143e={},_0x51a456={};_0x4bf195<_0x1664fb[_0xf0f9('0x41')];_0x4bf195+=0x1){_0x5a143e=_0x1664fb[_0x4bf195];if(_[_0xf0f9('0x43')](_0x5c73fc['dynamics365Accounts'][_0x5a143e['id']])){_0x5c73fc['dynamics365Accounts'][_0x5a143e['id']]=new Dynamics365Account(_0x5a143e);}else{_0x5c73fc[_0xf0f9('0x40')](_0x5c73fc[_0xf0f9('0x22')][_0x5a143e['id']],_0x5a143e);}}}return _0x5c73fc[_0xf0f9('0x22')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x51')]=function(){var _0xf93b89=this;return function(_0x44495e){if(_0x44495e){freeIsNotKey(_0x44495e,_0xf93b89[_0xf0f9('0x52')],'id');for(var _0x54211d=0x0,_0x216c6c={},_0x51503d={};_0x54211d<_0x44495e[_0xf0f9('0x41')];_0x54211d+=0x1){_0x216c6c=_0x44495e[_0x54211d];if(_[_0xf0f9('0x43')](_0xf93b89[_0xf0f9('0x52')][_0x216c6c['id']])){_0xf93b89['freshsalesAccounts'][_0x216c6c['id']]=new FreshsalesAccount(_0x216c6c);}else{_0xf93b89[_0xf0f9('0x40')](_0xf93b89[_0xf0f9('0x52')][_0x216c6c['id']],_0x216c6c);}}}return _0xf93b89[_0xf0f9('0x52')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x53')]=function(){var _0x220d96=this;return function(_0xa55ddb){for(var _0x35b0fe=0x0;_0x35b0fe<_0xa55ddb['length'];_0x35b0fe+=0x1){_[_0xf0f9('0x54')](_0x220d96[_0xf0f9('0x15')][_0xa55ddb[_0x35b0fe][_0xf0f9('0x42')]],_0xa55ddb[_0x35b0fe]);}return _0x220d96[_0xf0f9('0x15')];};};Realtime['prototype'][_0xf0f9('0x55')]=function(){var _0x4baed8=this;return function(_0x82a45a){clearVoiceQueues(_0x4baed8['voiceQueues']);if(_0x82a45a){_0x82a45a=_[_0xf0f9('0x56')](_0x82a45a,_0xf0f9('0x57'));for(var _0x52efee in _0x82a45a){if(_0x82a45a['hasOwnProperty'](_0x52efee)){var _0x1737cc={};for(var _0x57422a=0x0;_0x57422a<_0x82a45a[_0x52efee][_0xf0f9('0x41')];_0x57422a+=0x1){var _0x601d32=_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x58')];if(_0x4baed8[_0xf0f9('0x15')][_0x601d32]){if(_0x82a45a[_0x52efee][_0x57422a]['queuecallerexit']){_0x4baed8[_0xf0f9('0x15')][_0x601d32][_0xf0f9('0x32')]+=0x1;}if(_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x59')]){_0x4baed8[_0xf0f9('0x15')][_0x601d32][_0xf0f9('0x33')]+=0x1;}_0x4baed8['voiceQueues'][_0x601d32]['sumHoldTime']+=moment(_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x5a')])[_0xf0f9('0x5b')](moment(_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x5c')]),_0xf0f9('0x5d'))||0x0;if(_0x57422a===_0x82a45a[_0x52efee][_0xf0f9('0x41')]-0x1){_0x4baed8[_0xf0f9('0x15')][_0x601d32][_0xf0f9('0x2d')]+=moment(_0x82a45a[_0x52efee][_0x57422a]['queuecallercompleteAt']||_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x5e')]||_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x5f')])['diff'](moment(_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x5c')]),_0xf0f9('0x5d'))||0x0;_0x4baed8['voiceQueues'][_0x601d32][_0xf0f9('0x2a')]+=0x1;if(_0x82a45a[_0x52efee][_0x57422a]['queuecallercomplete']){_0x4baed8['voiceQueues'][_0x601d32]['answered']+=0x1;_0x4baed8['voiceQueues'][_0x601d32][_0xf0f9('0x2e')]+=moment(_0x82a45a[_0x52efee][_0x57422a]['queuecallercompleteAt'])['diff'](moment(_0x82a45a[_0x52efee][_0x57422a]['queuecallerleaveAt']),_0xf0f9('0x5d'))||0x0;}}else{_0x4baed8[_0xf0f9('0x15')][_0x601d32][_0xf0f9('0x2d')]+=_0x4baed8['voiceQueues'][_0x601d32][_0xf0f9('0x2c')]||0x0;}}}}}}return _0x4baed8['voiceQueues'];};};Realtime['prototype'][_0xf0f9('0x60')]=function(){var _0x5226bd=this;return function(_0x2d739e){clearVoiceCallReports(_0x5226bd['outbound']);if(_0x2d739e){for(var _0x443f17=0x0;_0x443f17<_0x2d739e[_0xf0f9('0x41')];_0x443f17+=0x1){_0x5226bd[_0xf0f9('0x19')][_0xf0f9('0x2a')]+=0x1;_0x5226bd[_0xf0f9('0x19')][_0xf0f9('0x2d')]+=_0x2d739e[_0x443f17][_0xf0f9('0x61')];if(_0x2d739e[_0x443f17][_0xf0f9('0x62')]===_0xf0f9('0x63')){_0x5226bd[_0xf0f9('0x19')][_0xf0f9('0x2b')]+=0x1;_0x5226bd[_0xf0f9('0x19')][_0xf0f9('0x2c')]+=_0x2d739e[_0x443f17][_0xf0f9('0x61')]-_0x2d739e[_0x443f17]['billableseconds']||0x0;_0x5226bd[_0xf0f9('0x19')]['sumBillable']+=_0x2d739e[_0x443f17]['billableseconds'];}}}return _0x5226bd['outbound'];};};Realtime[_0xf0f9('0x3f')]['initCampaigns']=function(){var _0x3ece7e=this;return function(_0x21c2d5){if(_0x21c2d5){freeIsNotKey(_0x21c2d5,_0x3ece7e[_0xf0f9('0x17')],'name');for(var _0x2609d9=0x0,_0x3b9b17={};_0x2609d9<_0x21c2d5[_0xf0f9('0x41')];_0x2609d9+=0x1){_0x3b9b17=_0x21c2d5[_0x2609d9];if(_[_0xf0f9('0x43')](_0x3ece7e[_0xf0f9('0x17')][_0x3b9b17[_0xf0f9('0x42')]])){_0x3ece7e[_0xf0f9('0x17')][_0x3b9b17[_0xf0f9('0x42')]]=new Campaign(_0x3b9b17);}else{_0x3ece7e[_0xf0f9('0x40')](_0x3ece7e['campaigns'][_0x3b9b17['name']],_0x3b9b17);_0x3ece7e['campaigns'][_0x3b9b17[_0xf0f9('0x42')]][_0xf0f9('0x64')]=_0x3b9b17[_0xf0f9('0x65')]?_0x3b9b17[_0xf0f9('0x65')]['name']:undefined;}}}return _0x3ece7e[_0xf0f9('0x17')];};};Realtime[_0xf0f9('0x3f')]['initVoiceExtensions']=function(){var _0x19a5fc=this;return function(_0x3fe0dc){if(_0x3fe0dc){freeIsNotKey(_0x3fe0dc,_0x19a5fc[_0xf0f9('0x66')],'id');for(var _0x4d9e01=0x0,_0x28e3b5={};_0x4d9e01<_0x3fe0dc[_0xf0f9('0x41')];_0x4d9e01+=0x1){_0x28e3b5=_0x3fe0dc[_0x4d9e01];if(_[_0xf0f9('0x43')](_0x19a5fc[_0xf0f9('0x66')][_0x28e3b5['id']])){_0x19a5fc[_0xf0f9('0x66')][_0x28e3b5['id']]=new VoiceExtension(_0x28e3b5);}else{_0x19a5fc[_0xf0f9('0x40')](_0x19a5fc[_0xf0f9('0x66')][_0x28e3b5['id']],_0x28e3b5);}}}return _0x19a5fc[_0xf0f9('0x66')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x67')]=function(){var _0x20dd41=this;return function(_0x323116){clearCampaigns(_0x20dd41[_0xf0f9('0x17')]);for(var _0x8954a1=0x0;_0x8954a1<_0x323116['length'];_0x8954a1+=0x1){_[_0xf0f9('0x54')](_0x20dd41[_0xf0f9('0x17')][_0x323116[_0x8954a1][_0xf0f9('0x42')]],_0x323116[_0x8954a1]);}return _0x20dd41['campaigns'];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x68')]=function(){var _0x4825c1=this;return function(_0x31ba02){if(_0x31ba02){freeIsNotKey(_0x31ba02,_0x4825c1[_0xf0f9('0x23')],'id');for(var _0x5c6a84=0x0,_0x32881c={},_0x15173a={};_0x5c6a84<_0x31ba02['length'];_0x5c6a84+=0x1){_0x32881c=_0x31ba02[_0x5c6a84];if(_[_0xf0f9('0x43')](_0x4825c1[_0xf0f9('0x23')][_0x32881c['id']])){_0x4825c1['faxAccounts'][_0x32881c['id']]=new FaxAccount(_0x32881c);}else{_0x4825c1['mergeFromDatabase'](_0x4825c1[_0xf0f9('0x23')][_0x32881c['id']],_0x32881c);}}}return _0x4825c1[_0xf0f9('0x23')];};};module[_0xf0f9('0x69')]=Realtime; \ No newline at end of file +var _0xc76e=['outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','initTelephones','initTrunks','trunks','isUndefined','initVoiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','queue','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','sumBillable','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','faxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','sumDuration'];(function(_0x2dd9ba,_0x133df1){var _0x2b971e=function(_0x35d43e){while(--_0x35d43e){_0x2dd9ba['push'](_0x2dd9ba['shift']());}};_0x2b971e(++_0x133df1);}(_0xc76e,0x10c));var _0xec76=function(_0x5a8d04,_0x3b1223){_0x5a8d04=_0x5a8d04-0x0;var _0x1d985e=_0xc76e[_0x5a8d04];return _0x1d985e;};'use strict';var util=require(_0xec76('0x0'));var _=require(_0xec76('0x1'));var moment=require(_0xec76('0x2'));var Agent=require(_0xec76('0x3'));var Telephone=require(_0xec76('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xec76('0x5'));var Template=require(_0xec76('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xec76('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xec76('0x8'));var FreshdeskAccount=require(_0xec76('0x9'));var SugarcrmAccount=require(_0xec76('0xa'));var ZohoAccount=require(_0xec76('0xb'));var DeskAccount=require(_0xec76('0xc'));var VtigerAccount=require(_0xec76('0xd'));var ServicenowAccount=require(_0xec76('0xe'));var Dynamics365Account=require(_0xec76('0xf'));var FreshsalesAccount=require(_0xec76('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xec76('0x11')]={};this[_0xec76('0x12')]={};this['trunks']={};this[_0xec76('0x13')]={};this[_0xec76('0x14')]={};this['campaigns']={};this[_0xec76('0x15')]={};this[_0xec76('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xec76('0x17')]={};this[_0xec76('0x18')]={};this[_0xec76('0x19')]={};this[_0xec76('0x1a')]={};this[_0xec76('0x1b')]={};this[_0xec76('0x1c')]={};this[_0xec76('0x1d')]={};this[_0xec76('0x1e')]={};this[_0xec76('0x1f')]={};this[_0xec76('0x20')]={};this[_0xec76('0x21')]={};this[_0xec76('0x22')]={};this[_0xec76('0x23')]={};this[_0xec76('0x24')]={};this['dynamics365Accounts']={};this[_0xec76('0x25')]={};this['faxAccounts']={};};function freeIsNotKey(_0x2fe444,_0x36347e,_0x4452fd){var _0x91a265=_[_0xec76('0x26')](_0x2fe444,function(_0x17931d,_0x4e7fb0){return _0x17931d[_0x4452fd];});for(var _0x4a591a in _0x36347e){if(_0x36347e[_0xec76('0x27')](_0x4a591a)){if(!_0x91a265[_0x4a591a]){delete _0x36347e[_0x4a591a];}}}}function freeIsNotKeySip(_0x300ee6,_0x2e6c6b){var _0xd40f1c=_[_0xec76('0x26')](_0x300ee6,function(_0xbcd2f3,_0x35f8e1){return util[_0xec76('0x28')](_0xec76('0x29'),_0xbcd2f3[_0xec76('0x2a')]);});for(var _0x55a5f3 in _0x2e6c6b){if(_0x2e6c6b[_0xec76('0x27')](_0x55a5f3)){if(!_0xd40f1c[_0x55a5f3]){delete _0x2e6c6b[_0x55a5f3];}}}}function freeIsNotKeyAgent(_0x5ae445,_0x1ef320){var _0x246860=_[_0xec76('0x26')](_0x5ae445,function(_0x233ee4,_0x3627b5){var _0x175119=_[_0xec76('0x2b')](_0x233ee4['interface'])?util['format'](_0xec76('0x29'),_0x233ee4['name']):_0x233ee4[_0xec76('0x2c')];return _0x175119;});for(var _0x37c904 in _0x1ef320){if(_0x1ef320[_0xec76('0x27')](_0x37c904)){if(!_0x246860[_0x37c904]){delete _0x1ef320[_0x37c904];}}}}function clearVoiceCallReports(_0x2fe9ff){_0x2fe9ff[_0xec76('0x2d')]=0x0;_0x2fe9ff['answered']=0x0;_0x2fe9ff[_0xec76('0x2e')]=0x0;_0x2fe9ff['sumDuration']=0x0;_0x2fe9ff['sumBillable']=0x0;}function clearCampaigns(_0x5bf545){if(!_[_0xec76('0x2f')](_0x5bf545)){for(var _0x3f5662 in _0x5bf545){if(_0x5bf545['hasOwnProperty'](_0x3f5662)){_0x5bf545[_0x3f5662][_0xec76('0x30')]=0x0;_0x5bf545[_0x3f5662][_0xec76('0x31')]=0x0;}}}}function clearVoiceQueues(_0x6585f2){if(!_[_0xec76('0x2f')](_0x6585f2)){for(var _0x26e31a in _0x6585f2){if(_0x6585f2[_0xec76('0x27')](_0x26e31a)){_0x6585f2[_0x26e31a][_0xec76('0x2d')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x32')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x33')]=0x0;_0x6585f2[_0x26e31a]['abandoned']=0x0;_0x6585f2[_0x26e31a][_0xec76('0x2e')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x34')]=0x0;_0x6585f2[_0x26e31a]['sumBillable']=0x0;_0x6585f2[_0x26e31a][_0xec76('0x35')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x36')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x37')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x38')]=0x0;_0x6585f2[_0x26e31a]['outboundNoSuchCallsDay']=0x0;_0x6585f2[_0x26e31a]['outboundUnknownCallsDay']=0x0;_0x6585f2[_0x26e31a][_0xec76('0x39')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x3a')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x3b')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x3c')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x3d')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x3e')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x35')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x3f')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x40')]=!![];}}}}Realtime[_0xec76('0x41')][_0xec76('0x42')]=function(_0xd3beed,_0x1829d8){for(var _0x44cb5d in _0x1829d8){if(_0xd3beed[_0xec76('0x27')](_0x44cb5d)){_0xd3beed[_0x44cb5d]=_0x1829d8[_0x44cb5d];}}};Realtime[_0xec76('0x41')][_0xec76('0x43')]=function(){var _0x2e8300=this;return function(_0x5e758a){if(_0x5e758a){freeIsNotKeyAgent(_0x5e758a,_0x2e8300[_0xec76('0x11')]);for(var _0x30a212=0x0,_0x1ab72f={},_0x2f52ec={};_0x30a212<_0x5e758a[_0xec76('0x44')];_0x30a212+=0x1){_0x1ab72f=_0x5e758a[_0x30a212];var _0x280acd=_[_0xec76('0x2b')](_0x1ab72f[_0xec76('0x2c')])?util['format'](_0xec76('0x29'),_0x1ab72f[_0xec76('0x2a')]):_0x1ab72f['interface'];if(_['isUndefined'](_0x2e8300['agents'][_0x280acd])){_0x2e8300[_0xec76('0x11')][_0x280acd]=new Agent(_0x1ab72f);}else{_0x2e8300[_0xec76('0x42')](_0x2e8300[_0xec76('0x11')][_0x280acd],_0x1ab72f);}}}return _0x2e8300[_0xec76('0x11')];};};Realtime[_0xec76('0x41')][_0xec76('0x45')]=function(){var _0xc4ff43=this;return function(_0x395595){if(_0x395595){freeIsNotKeySip(_0x395595,_0xc4ff43[_0xec76('0x12')]);for(var _0x55b91a=0x0,_0x49caa2={},_0xf3525={};_0x55b91a<_0x395595['length'];_0x55b91a+=0x1){_0x49caa2=_0x395595[_0x55b91a];if(_['isUndefined'](_0xc4ff43[_0xec76('0x12')][util[_0xec76('0x28')](_0xec76('0x29'),_0x49caa2[_0xec76('0x2a')])])){_0xc4ff43[_0xec76('0x12')][util['format'](_0xec76('0x29'),_0x49caa2[_0xec76('0x2a')])]=new Telephone(_0x49caa2);}else{_0xc4ff43[_0xec76('0x42')](_0xc4ff43[_0xec76('0x12')][util[_0xec76('0x28')](_0xec76('0x29'),_0x49caa2[_0xec76('0x2a')])],_0x49caa2);}}}return _0xc4ff43[_0xec76('0x12')];};};Realtime[_0xec76('0x41')][_0xec76('0x46')]=function(){var _0xeb85f8=this;return function(_0x2a21d9){if(_0x2a21d9){freeIsNotKeySip(_0x2a21d9,_0xeb85f8[_0xec76('0x47')]);for(var _0x39828e=0x0,_0x1eb42a={},_0x5b01dc={};_0x39828e<_0x2a21d9[_0xec76('0x44')];_0x39828e+=0x1){_0x1eb42a=_0x2a21d9[_0x39828e];if(_[_0xec76('0x48')](_0xeb85f8[_0xec76('0x47')][util[_0xec76('0x28')](_0xec76('0x29'),_0x1eb42a['name'])])){_0xeb85f8[_0xec76('0x47')][util[_0xec76('0x28')](_0xec76('0x29'),_0x1eb42a['name'])]=new Trunk(_0x1eb42a);}else{_0xeb85f8['mergeFromDatabase'](_0xeb85f8[_0xec76('0x47')][util[_0xec76('0x28')]('SIP/%s',_0x1eb42a[_0xec76('0x2a')])],_0x1eb42a);}}}return _0xeb85f8['trunks'];};};Realtime[_0xec76('0x41')][_0xec76('0x49')]=function(){var _0x3da87e=this;return function(_0x33e6bd){if(_0x33e6bd){freeIsNotKey(_0x33e6bd,_0x3da87e[_0xec76('0x13')],_0xec76('0x2a'));for(var _0xef1340=0x0,_0x10594d={},_0x2b962f={};_0xef1340<_0x33e6bd[_0xec76('0x44')];_0xef1340+=0x1){_0x10594d=_0x33e6bd[_0xef1340];if(_[_0xec76('0x48')](_0x3da87e[_0xec76('0x13')][_0x10594d[_0xec76('0x2a')]])){_0x3da87e[_0xec76('0x13')][_0x10594d[_0xec76('0x2a')]]=new VoiceQueue(_0x10594d);}else{_0x3da87e[_0xec76('0x42')](_0x3da87e[_0xec76('0x13')][_0x10594d[_0xec76('0x2a')]],_0x10594d);}}}return _0x3da87e['voiceQueues'];};};Realtime[_0xec76('0x41')]['initTriggers']=function(){var _0x1168bc=this;return function(_0xc223cc){if(_0xc223cc){freeIsNotKey(_0xc223cc,_0x1168bc[_0xec76('0x14')],'id');for(var _0x2c0dc0=0x0,_0x8fb197={},_0x46e905={};_0x2c0dc0<_0xc223cc['length'];_0x2c0dc0+=0x1){_0x8fb197=_0xc223cc[_0x2c0dc0];if(_[_0xec76('0x48')](_0x1168bc['triggers'][_0x8fb197['id']])){_0x1168bc[_0xec76('0x14')][_0x8fb197['id']]=new Trigger(_0x8fb197);}else{_0x1168bc[_0xec76('0x42')](_0x1168bc['triggers'][_0x8fb197['id']],_0x8fb197);}}}return _0x1168bc['triggers'];};};Realtime[_0xec76('0x41')][_0xec76('0x4a')]=function(){var _0x1cc99c=this;return function(_0x4fc000){if(_0x4fc000){freeIsNotKey(_0x4fc000,_0x1cc99c[_0xec76('0x15')],'id');for(var _0x4e86e4=0x0,_0x30c4b7={},_0x5673cb={};_0x4e86e4<_0x4fc000[_0xec76('0x44')];_0x4e86e4+=0x1){_0x30c4b7=_0x4fc000[_0x4e86e4];if(_[_0xec76('0x48')](_0x1cc99c['templates'][_0x30c4b7['id']])){_0x1cc99c[_0xec76('0x15')][_0x30c4b7['id']]=new Template(_0x30c4b7);}else{_0x1cc99c[_0xec76('0x42')](_0x1cc99c['templates'][_0x30c4b7['id']],_0x30c4b7);}}}return _0x1cc99c['templates'];};};Realtime[_0xec76('0x41')][_0xec76('0x4b')]=function(){var _0xc93409=this;return function(_0x1de618){if(_0x1de618){freeIsNotKey(_0x1de618,_0xc93409['zendeskAccounts'],'id');for(var _0x18fa1e=0x0,_0x4544c3={},_0x10b333={};_0x18fa1e<_0x1de618[_0xec76('0x44')];_0x18fa1e+=0x1){_0x4544c3=_0x1de618[_0x18fa1e];if(_[_0xec76('0x48')](_0xc93409[_0xec76('0x1d')][_0x4544c3['id']])){_0xc93409[_0xec76('0x1d')][_0x4544c3['id']]=new ZendeskAccount(_0x4544c3);}else{_0xc93409['mergeFromDatabase'](_0xc93409[_0xec76('0x1d')][_0x4544c3['id']],_0x4544c3);}}}return _0xc93409[_0xec76('0x1d')];};};Realtime['prototype'][_0xec76('0x4c')]=function(){var _0x544f36=this;return function(_0x4c15a8){if(_0x4c15a8){freeIsNotKey(_0x4c15a8,_0x544f36[_0xec76('0x1e')],'id');for(var _0x3c5ad5=0x0,_0x25ef4b={},_0x67e971={};_0x3c5ad5<_0x4c15a8['length'];_0x3c5ad5+=0x1){_0x25ef4b=_0x4c15a8[_0x3c5ad5];if(_[_0xec76('0x48')](_0x544f36[_0xec76('0x1e')][_0x25ef4b['id']])){_0x544f36[_0xec76('0x1e')][_0x25ef4b['id']]=new SalesforceAccount(_0x25ef4b);}else{_0x544f36[_0xec76('0x42')](_0x544f36[_0xec76('0x1e')][_0x25ef4b['id']],_0x25ef4b);}}}return _0x544f36[_0xec76('0x1e')];};};Realtime[_0xec76('0x41')]['initFreshdeskAccounts']=function(){var _0x481cb6=this;return function(_0x31fd11){if(_0x31fd11){freeIsNotKey(_0x31fd11,_0x481cb6['freshdeskAccounts'],'id');for(var _0x347ade=0x0,_0x504a8b={},_0x2d4302={};_0x347ade<_0x31fd11[_0xec76('0x44')];_0x347ade+=0x1){_0x504a8b=_0x31fd11[_0x347ade];if(_[_0xec76('0x48')](_0x481cb6[_0xec76('0x20')][_0x504a8b['id']])){_0x481cb6[_0xec76('0x20')][_0x504a8b['id']]=new FreshdeskAccount(_0x504a8b);}else{_0x481cb6[_0xec76('0x42')](_0x481cb6[_0xec76('0x20')][_0x504a8b['id']],_0x504a8b);}}}return _0x481cb6['freshdeskAccounts'];};};Realtime[_0xec76('0x41')][_0xec76('0x4d')]=function(){var _0x3f6edd=this;return function(_0x8edc96){if(_0x8edc96){freeIsNotKey(_0x8edc96,_0x3f6edd['zohoAccounts'],'id');for(var _0x35c46e=0x0,_0x21e9f={},_0x3debc2={};_0x35c46e<_0x8edc96[_0xec76('0x44')];_0x35c46e+=0x1){_0x21e9f=_0x8edc96[_0x35c46e];if(_[_0xec76('0x48')](_0x3f6edd['zohoAccounts'][_0x21e9f['id']])){_0x3f6edd[_0xec76('0x21')][_0x21e9f['id']]=new ZohoAccount(_0x21e9f);}else{_0x3f6edd[_0xec76('0x42')](_0x3f6edd['zohoAccounts'][_0x21e9f['id']],_0x21e9f);}}}return _0x3f6edd[_0xec76('0x21')];};};Realtime[_0xec76('0x41')][_0xec76('0x4e')]=function(){var _0x58e5d0=this;return function(_0x4c359b){if(_0x4c359b){freeIsNotKey(_0x4c359b,_0x58e5d0[_0xec76('0x22')],'id');for(var _0x399bb6=0x0,_0x4ab905={},_0x27274f={};_0x399bb6<_0x4c359b['length'];_0x399bb6+=0x1){_0x4ab905=_0x4c359b[_0x399bb6];if(_[_0xec76('0x48')](_0x58e5d0[_0xec76('0x22')][_0x4ab905['id']])){_0x58e5d0['deskAccounts'][_0x4ab905['id']]=new DeskAccount(_0x4ab905);}else{_0x58e5d0[_0xec76('0x42')](_0x58e5d0[_0xec76('0x22')][_0x4ab905['id']],_0x4ab905);}}}return _0x58e5d0[_0xec76('0x22')];};};Realtime[_0xec76('0x41')]['initSugarcrmAccounts']=function(){var _0x217a0c=this;return function(_0x45e465){if(_0x45e465){freeIsNotKey(_0x45e465,_0x217a0c['sugarcrmAccounts'],'id');for(var _0xa95819=0x0,_0x2755af={},_0x4f4e0a={};_0xa95819<_0x45e465[_0xec76('0x44')];_0xa95819+=0x1){_0x2755af=_0x45e465[_0xa95819];if(_[_0xec76('0x48')](_0x217a0c[_0xec76('0x1f')][_0x2755af['id']])){_0x217a0c[_0xec76('0x1f')][_0x2755af['id']]=new SugarcrmAccount(_0x2755af);}else{_0x217a0c[_0xec76('0x42')](_0x217a0c['sugarcrmAccounts'][_0x2755af['id']],_0x2755af);}}}return _0x217a0c['sugarcrmAccounts'];};};Realtime[_0xec76('0x41')]['initVtigerAccounts']=function(){var _0x574e9c=this;return function(_0x31bb11){if(_0x31bb11){freeIsNotKey(_0x31bb11,_0x574e9c[_0xec76('0x23')],'id');for(var _0x2b25bd=0x0,_0x3a8447={},_0x338a7f={};_0x2b25bd<_0x31bb11[_0xec76('0x44')];_0x2b25bd+=0x1){_0x3a8447=_0x31bb11[_0x2b25bd];if(_['isUndefined'](_0x574e9c['vtigerAccounts'][_0x3a8447['id']])){_0x574e9c[_0xec76('0x23')][_0x3a8447['id']]=new VtigerAccount(_0x3a8447);}else{_0x574e9c[_0xec76('0x42')](_0x574e9c[_0xec76('0x23')][_0x3a8447['id']],_0x3a8447);}}}return _0x574e9c[_0xec76('0x23')];};};Realtime['prototype'][_0xec76('0x4f')]=function(){var _0x8f28d9=this;return function(_0x3661bd){if(_0x3661bd){freeIsNotKey(_0x3661bd,_0x8f28d9['servicenowAccounts'],'id');for(var _0x50fcb9=0x0,_0x50c978={},_0x367ee7={};_0x50fcb9<_0x3661bd['length'];_0x50fcb9+=0x1){_0x50c978=_0x3661bd[_0x50fcb9];if(_[_0xec76('0x48')](_0x8f28d9['servicenowAccounts'][_0x50c978['id']])){_0x8f28d9[_0xec76('0x24')][_0x50c978['id']]=new ServicenowAccount(_0x50c978);}else{_0x8f28d9[_0xec76('0x42')](_0x8f28d9[_0xec76('0x24')][_0x50c978['id']],_0x50c978);}}}return _0x8f28d9[_0xec76('0x24')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x22d597=this;return function(_0x597fff){if(_0x597fff){freeIsNotKey(_0x597fff,_0x22d597[_0xec76('0x50')],'id');for(var _0x1c1cdf=0x0,_0x369f0a={},_0x5e803a={};_0x1c1cdf<_0x597fff[_0xec76('0x44')];_0x1c1cdf+=0x1){_0x369f0a=_0x597fff[_0x1c1cdf];if(_[_0xec76('0x48')](_0x22d597['dynamics365Accounts'][_0x369f0a['id']])){_0x22d597[_0xec76('0x50')][_0x369f0a['id']]=new Dynamics365Account(_0x369f0a);}else{_0x22d597[_0xec76('0x42')](_0x22d597[_0xec76('0x50')][_0x369f0a['id']],_0x369f0a);}}}return _0x22d597['dynamics365Accounts'];};};Realtime[_0xec76('0x41')][_0xec76('0x51')]=function(){var _0x1e7ed7=this;return function(_0x7306f6){if(_0x7306f6){freeIsNotKey(_0x7306f6,_0x1e7ed7[_0xec76('0x25')],'id');for(var _0x4c5b1d=0x0,_0x1167a4={},_0x5033ab={};_0x4c5b1d<_0x7306f6[_0xec76('0x44')];_0x4c5b1d+=0x1){_0x1167a4=_0x7306f6[_0x4c5b1d];if(_[_0xec76('0x48')](_0x1e7ed7[_0xec76('0x25')][_0x1167a4['id']])){_0x1e7ed7[_0xec76('0x25')][_0x1167a4['id']]=new FreshsalesAccount(_0x1167a4);}else{_0x1e7ed7[_0xec76('0x42')](_0x1e7ed7['freshsalesAccounts'][_0x1167a4['id']],_0x1167a4);}}}return _0x1e7ed7[_0xec76('0x25')];};};Realtime[_0xec76('0x41')]['initVoiceQueueHopperHistory']=function(){var _0x26e2d7=this;return function(_0x18145d){for(var _0x51a7a4=0x0;_0x51a7a4<_0x18145d[_0xec76('0x44')];_0x51a7a4+=0x1){_['merge'](_0x26e2d7['voiceQueues'][_0x18145d[_0x51a7a4][_0xec76('0x2a')]],_0x18145d[_0x51a7a4]);}return _0x26e2d7[_0xec76('0x13')];};};Realtime[_0xec76('0x41')]['initVoiceQueueReports']=function(){var _0x1ed0e7=this;return function(_0x4868e0){clearVoiceQueues(_0x1ed0e7[_0xec76('0x13')]);if(_0x4868e0){_0x4868e0=_['groupBy'](_0x4868e0,'uniqueid');for(var _0x1fa861 in _0x4868e0){if(_0x4868e0['hasOwnProperty'](_0x1fa861)){var _0x111c1c={};for(var _0x276bb8=0x0;_0x276bb8<_0x4868e0[_0x1fa861][_0xec76('0x44')];_0x276bb8+=0x1){var _0x1f818c=_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x52')];if(_0x1ed0e7[_0xec76('0x13')][_0x1f818c]){if(_0x4868e0[_0x1fa861][_0x276bb8]['queuecallerexit']){_0x1ed0e7[_0xec76('0x13')][_0x1f818c][_0xec76('0x33')]+=0x1;}if(_0x4868e0[_0x1fa861][_0x276bb8]['queuecallerabandon']){_0x1ed0e7['voiceQueues'][_0x1f818c][_0xec76('0x53')]+=0x1;}_0x1ed0e7[_0xec76('0x13')][_0x1f818c]['sumHoldTime']+=moment(_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x54')])[_0xec76('0x55')](moment(_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x56')]),_0xec76('0x57'))||0x0;if(_0x276bb8===_0x4868e0[_0x1fa861][_0xec76('0x44')]-0x1){_0x1ed0e7[_0xec76('0x13')][_0x1f818c]['sumDuration']+=moment(_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x58')]||_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x59')]||_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x5a')])['diff'](moment(_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x56')]),'seconds')||0x0;_0x1ed0e7[_0xec76('0x13')][_0x1f818c][_0xec76('0x2d')]+=0x1;if(_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x5b')]){_0x1ed0e7[_0xec76('0x13')][_0x1f818c][_0xec76('0x32')]+=0x1;_0x1ed0e7[_0xec76('0x13')][_0x1f818c][_0xec76('0x5c')]+=moment(_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x58')])[_0xec76('0x55')](moment(_0x4868e0[_0x1fa861][_0x276bb8]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x1ed0e7[_0xec76('0x13')][_0x1f818c][_0xec76('0x34')]+=_0x1ed0e7[_0xec76('0x13')][_0x1f818c][_0xec76('0x2e')]||0x0;}}}}}}return _0x1ed0e7[_0xec76('0x13')];};};Realtime['prototype'][_0xec76('0x5d')]=function(){var _0x362819=this;return function(_0x26f4f4){clearVoiceCallReports(_0x362819[_0xec76('0x16')]);if(_0x26f4f4){for(var _0x3f6b12=0x0;_0x3f6b12<_0x26f4f4[_0xec76('0x44')];_0x3f6b12+=0x1){_0x362819['outbound'][_0xec76('0x2d')]+=0x1;_0x362819[_0xec76('0x16')][_0xec76('0x34')]+=_0x26f4f4[_0x3f6b12][_0xec76('0x5e')];if(_0x26f4f4[_0x3f6b12]['disposition']===_0xec76('0x5f')){_0x362819[_0xec76('0x16')][_0xec76('0x32')]+=0x1;_0x362819[_0xec76('0x16')][_0xec76('0x2e')]+=_0x26f4f4[_0x3f6b12][_0xec76('0x5e')]-_0x26f4f4[_0x3f6b12][_0xec76('0x60')]||0x0;_0x362819[_0xec76('0x16')][_0xec76('0x5c')]+=_0x26f4f4[_0x3f6b12][_0xec76('0x60')];}}}return _0x362819[_0xec76('0x16')];};};Realtime[_0xec76('0x41')][_0xec76('0x61')]=function(){var _0x316e15=this;return function(_0x14a4c9){if(_0x14a4c9){freeIsNotKey(_0x14a4c9,_0x316e15[_0xec76('0x62')],_0xec76('0x2a'));for(var _0x1c2099=0x0,_0x169ff1={};_0x1c2099<_0x14a4c9[_0xec76('0x44')];_0x1c2099+=0x1){_0x169ff1=_0x14a4c9[_0x1c2099];if(_[_0xec76('0x48')](_0x316e15[_0xec76('0x62')][_0x169ff1[_0xec76('0x2a')]])){_0x316e15[_0xec76('0x62')][_0x169ff1[_0xec76('0x2a')]]=new Campaign(_0x169ff1);}else{_0x316e15[_0xec76('0x42')](_0x316e15[_0xec76('0x62')][_0x169ff1[_0xec76('0x2a')]],_0x169ff1);_0x316e15[_0xec76('0x62')][_0x169ff1['name']][_0xec76('0x63')]=_0x169ff1[_0xec76('0x64')]?_0x169ff1[_0xec76('0x64')][_0xec76('0x2a')]:undefined;}}}return _0x316e15[_0xec76('0x62')];};};Realtime['prototype'][_0xec76('0x65')]=function(){var _0x2eb9a5=this;return function(_0x4201d9){if(_0x4201d9){freeIsNotKey(_0x4201d9,_0x2eb9a5['voiceExtensions'],'id');for(var _0x25da83=0x0,_0x50fa64={};_0x25da83<_0x4201d9[_0xec76('0x44')];_0x25da83+=0x1){_0x50fa64=_0x4201d9[_0x25da83];if(_['isUndefined'](_0x2eb9a5['voiceExtensions'][_0x50fa64['id']])){_0x2eb9a5[_0xec76('0x17')][_0x50fa64['id']]=new VoiceExtension(_0x50fa64);}else{_0x2eb9a5[_0xec76('0x42')](_0x2eb9a5['voiceExtensions'][_0x50fa64['id']],_0x50fa64);}}}return _0x2eb9a5[_0xec76('0x17')];};};Realtime[_0xec76('0x41')][_0xec76('0x66')]=function(){var _0x2fd419=this;return function(_0x43932b){clearCampaigns(_0x2fd419[_0xec76('0x62')]);for(var _0x5680ee=0x0;_0x5680ee<_0x43932b[_0xec76('0x44')];_0x5680ee+=0x1){_[_0xec76('0x67')](_0x2fd419[_0xec76('0x62')][_0x43932b[_0x5680ee][_0xec76('0x2a')]],_0x43932b[_0x5680ee]);}return _0x2fd419[_0xec76('0x62')];};};Realtime[_0xec76('0x41')][_0xec76('0x68')]=function(){var _0x239744=this;return function(_0x20a8e1){if(_0x20a8e1){freeIsNotKey(_0x20a8e1,_0x239744[_0xec76('0x69')],'id');for(var _0xc6f6d4=0x0,_0x5bc303={},_0x1a39e6={};_0xc6f6d4<_0x20a8e1[_0xec76('0x44')];_0xc6f6d4+=0x1){_0x5bc303=_0x20a8e1[_0xc6f6d4];if(_['isUndefined'](_0x239744[_0xec76('0x69')][_0x5bc303['id']])){_0x239744[_0xec76('0x69')][_0x5bc303['id']]=new FaxAccount(_0x5bc303);}else{_0x239744[_0xec76('0x42')](_0x239744[_0xec76('0x69')][_0x5bc303['id']],_0x5bc303);}}}return _0x239744[_0xec76('0x69')];};};module[_0xec76('0x6a')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 58b01e9..afd56f5 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 _0x6f16=['lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','interface','format','SIP/%s','length','findAgent','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','keys','getCallType','channel','split','getAgentByInternal','calleridnum','internal','destination','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','type','UserId','membername','monitors','createdAt','exten','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports'];(function(_0x4f5113,_0x297049){var _0x5e0bd5=function(_0x4d3c6c){while(--_0x4d3c6c){_0x4f5113['push'](_0x4f5113['shift']());}};_0x5e0bd5(++_0x297049);}(_0x6f16,0x1cc));var _0x66f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f16[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x66f1('0x0'));var moment=require(_0x66f1('0x1'));var util=require(_0x66f1('0x2'));var config=require(_0x66f1('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x66f1('0x4'));var RpcVoiceCallReport=require(_0x66f1('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x66f1('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x66f1('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x66f1('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x66f1('0x9'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x66f1('0xa'));function Report(_0x464b9d){this['realtime']=_0x464b9d;this[_0x66f1('0xb')]=_0x464b9d['agents'];this[_0x66f1('0xc')]=_0x464b9d[_0x66f1('0xc')];}Report[_0x66f1('0xd')][_0x66f1('0xe')]=function(_0x5c9dc3){var _0x58ece4=new VoiceQueueReport(this[_0x66f1('0xf')]);var _0x5c5d5f=new VoiceAgentReport(this[_0x66f1('0xf')]);var _0x34f0f6=new VoiceDialReport(this['realtime']);var _0x424e97=new VoiceCallReport(this[_0x66f1('0xf')]);var _0x25c906=new UserReport(this['realtime']);if(config[_0x66f1('0x10')]&&config['xdr'][_0x66f1('0x11')]){ami['on'](_0x66f1('0x12'),this[_0x66f1('0x13')][_0x66f1('0x14')](this));ami['on']('custom:voiceCallReport',this[_0x66f1('0x15')][_0x66f1('0x14')](this));ami['on'](_0x66f1('0x16'),this[_0x66f1('0x17')]['bind'](this));ami['on'](_0x66f1('0x18'),this[_0x66f1('0x19')][_0x66f1('0x14')](this));ami['on'](_0x66f1('0x1a'),this['blindTransfer'][_0x66f1('0x14')](this));ami['on'](_0x66f1('0x1b'),this[_0x66f1('0x1c')]['bind'](this));}};Report[_0x66f1('0xd')]['findAgent']=function(_0x31ef6){var _0x137ec5;_0x137ec5=_[_0x66f1('0x1d')](this[_0x66f1('0xb')],function(_0x39f9a7){return _0x39f9a7[_0x66f1('0x1e')]==_0x31ef6||_0x39f9a7[_0x66f1('0x1f')]==_0x31ef6;});if(_[_0x66f1('0x20')](_0x137ec5)){var _0x4cdc8a=_[_0x66f1('0x1d')](this[_0x66f1('0xc')],function(_0x196edb){return _0x196edb[_0x66f1('0x1e')]==_0x31ef6||_0x196edb[_0x66f1('0x1f')]==_0x31ef6;});if(_0x4cdc8a){_0x137ec5=_[_0x66f1('0x1d')](this[_0x66f1('0xb')],function(_0xa9ecbb){return _0xa9ecbb[_0x66f1('0x21')]==util[_0x66f1('0x22')](_0x66f1('0x23'),_0x4cdc8a[_0x66f1('0x1f')]);});}}return _0x137ec5;};Report[_0x66f1('0xd')]['voiceQueueReport']=function(_0x2c6f61){for(var _0x30da73=0x0;_0x30da73<_0x2c6f61[_0x66f1('0x24')];_0x30da73+=0x1){var _0x2662c7=this[_0x66f1('0x25')](_0x2c6f61[_0x30da73][_0x66f1('0x26')]);if(_0x2662c7){_0x2c6f61[_0x30da73][_0x66f1('0x1e')]=_0x2662c7[_0x66f1('0x1e')];_0x2c6f61[_0x30da73][_0x66f1('0x27')]=!![];_0x2c6f61[_0x30da73][_0x66f1('0x28')]=_0x2662c7['name'];_0x2c6f61[_0x30da73][_0x66f1('0x21')]=_['isNil'](_0x2662c7[_0x66f1('0x21')])?util[_0x66f1('0x22')](_0x66f1('0x23'),_0x2662c7[_0x66f1('0x1f')]):_0x2662c7[_0x66f1('0x21')];if(_0x2c6f61[_0x30da73]['queuecallercomplete']){_0x2c6f61[_0x30da73][_0x66f1('0x29')]=moment()['format'](_0x66f1('0x2a'));}if(_0x2c6f61[_0x30da73][_0x66f1('0x2b')]){_0x2c6f61[_0x30da73][_0x66f1('0x2c')]=moment()[_0x66f1('0x22')](_0x66f1('0x2a'));}RpcMemberReport[_0x66f1('0x13')](_0x2c6f61[_0x30da73]);}RpcVoiceQueueReport[_0x66f1('0x2d')](_0x2c6f61[_0x30da73]);}};function extractCalleridNumber(_0x471e03){var _0x2ea38b=_0x471e03['match'](/<(.*?)>/);return _0x2ea38b?_0x2ea38b[0x1]:_0x471e03;}Report[_0x66f1('0xd')]['getAgentByInternal']=function(_0x557444){for(var _0x52f0bc=0x0;_0x52f0bc/);return _0x317647?_0x317647[0x1]:_0x1036a1;}Report[_0x72df('0x10')][_0x72df('0x2b')]=function(_0x547eea){for(var _0x21309a=0x0;_0x21309a',_0x69ccb5[_0x72df('0x3d')],_0x69ccb5[_0x72df('0x38')]);}if(RpcVoiceTransferReport[_0x72df('0x3e')][_0x69ccb5[_0x72df('0x3f')]]){var _0x26e36a=RpcVoiceTransferReport[_0x72df('0x3e')][_0x69ccb5[_0x72df('0x3f')]];_0x26e36a[_0x72df('0x40')]=_0x69ccb5[_0x72df('0x41')];RpcVoiceTransferReport[_0x72df('0x42')](_0x26e36a);delete RpcVoiceTransferReport[_0x72df('0x3e')][_0x69ccb5['linkedid']];}if(_['isNil'](_0x69ccb5['type'])){_0x69ccb5[_0x72df('0x31')]=this['getCallType'](_0x69ccb5);}if(_[_0x72df('0x1f')](_0x69ccb5[_0x72df('0x43')])){var _0x2696a4=_0x69ccb5[_0x72df('0x2e')][_0x72df('0x2f')]('-')[0x0];var _0x2c4dbb=this['agents'][_0x2696a4];if(!_0x2c4dbb)_0x2c4dbb=this[_0x72df('0x2b')](_0x69ccb5[_0x72df('0x20')]);if(_0x2c4dbb){_0x69ccb5[_0x72df('0x43')]=_0x2c4dbb['id'];_0x69ccb5[_0x72df('0x44')]=_0x2c4dbb[_0x72df('0x1e')];}}RpcVoiceCallReport['create'](_0x69ccb5);if(_0x69ccb5['monitor']){for(var _0x533319=0x0;_0x533319<_0x69ccb5['monitors'][_0x72df('0x22')];_0x533319+=0x1){_0x69ccb5['monitorFilename']=_0x69ccb5[_0x72df('0x45')][_0x533319][_0x72df('0x46')];_0x69ccb5[_0x72df('0x47')]=_0x69ccb5['monitors'][_0x533319]['createdAt'];if(_0x69ccb5['exten']==_0x72df('0x36')){_0x69ccb5[_0x72df('0x38')]=_0x69ccb5[_0x72df('0x23')];_0x69ccb5[_0x72df('0x3d')]=_0x69ccb5[_0x72df('0x48')];_0x69ccb5[_0x72df('0x23')]=_0x69ccb5['accountcode'];_0x69ccb5[_0x72df('0x48')]=_0x69ccb5[_0x72df('0x44')];_0x69ccb5[_0x72df('0x49')]=_0x69ccb5[_0x72df('0x39')];}else if(_0x69ccb5['exten']==_0x72df('0x4a')){_0x69ccb5[_0x72df('0x38')]=_0x69ccb5[_0x72df('0x30')];_0x69ccb5[_0x72df('0x49')]=_0x69ccb5[_0x72df('0x39')];}RpcVoiceRecording['create'](_0x69ccb5);}}};Report['prototype'][_0x72df('0x18')]=function(_0x29ddb4){if(_['isArray'](_0x29ddb4)){_0x29ddb4[_0x72df('0x4b')](function(_0x808aaf){RpcVoiceAgentReport[_0x72df('0x29')](_0x808aaf);});}else{RpcVoiceAgentReport[_0x72df('0x29')](_0x29ddb4);}};Report[_0x72df('0x10')][_0x72df('0x19')]=function(_0x18d7c5){RpcVoiceDialReport[_0x72df('0x29')](_0x18d7c5);var _0x30521f;var _0xea826a;var _0x1f55da=_0x18d7c5['channel'];if(_['startsWith'](_0x1f55da,'Local')){_0xea826a=_0x1f55da[_0x72df('0x4c')](_0x1f55da['indexOf']('/')+0x1,_0x1f55da[_0x72df('0x4d')]('@'));_0x30521f=_['find'](this[_0x72df('0xe')],function(_0xaeed06){return _0xaeed06[_0x72df('0x4e')]==_0xea826a||_0xaeed06[_0x72df('0x4f')]==_0xea826a||_0xaeed06['accountcode']==_0xea826a;});}else{_0xea826a=_0x1f55da['substring'](_0x1f55da[_0x72df('0x4d')]('/')+0x1,_0x1f55da[_0x72df('0x50')]('-'));_0x30521f=this[_0x72df('0x1c')](_0xea826a);}if(_0x30521f){_0x18d7c5['interface']=_['isNil'](_0x30521f[_0x72df('0x24')])?util[_0x72df('0x25')](_0x72df('0x21'),_0x30521f['name']):_0x30521f[_0x72df('0x24')];_0x18d7c5[_0x72df('0x44')]=_0x30521f['name'];_0x18d7c5['accountcode']=_0x30521f[_0x72df('0x20')];RpcMemberReport[_0x72df('0x19')](_0x18d7c5);}};Report[_0x72df('0x10')]['blindTransfer']=function(_0x5a2741){RpcVoiceTransferReport[_0x72df('0x3e')][_0x5a2741[_0x72df('0x51')]]=_0x5a2741;};Report[_0x72df('0x10')][_0x72df('0x1b')]=function(_0xf3b38f){RpcVoiceTransferReport[_0x72df('0x1b')](_0xf3b38f);};module[_0x72df('0x52')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index c968b32..7dfe861 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 _0xca2a=['ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','then','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','emit','syncRegistry','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','stateRegistry','merge','omit','event','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','format','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','trunk:%s','Local','indexOf','phone','peer','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xca2a,0x1bb));var _0xaca2=function(_0x4986f8,_0x1d33e2){_0x4986f8=_0x4986f8-0x0;var _0xa28fc=_0xca2a[_0x4986f8];return _0xa28fc;};'use strict';var _=require(_0xaca2('0x0'));var moment=require(_0xaca2('0x1'));var util=require(_0xaca2('0x2'));var Redis=require(_0xaca2('0x3'));var BPromise=require(_0xaca2('0x4'));var config=require(_0xaca2('0x5'));var logger=require(_0xaca2('0x6'))(_0xaca2('0x7'));var ami=require(_0xaca2('0x8'));config[_0xaca2('0x9')]=_[_0xaca2('0xa')](config[_0xaca2('0x9')],{'host':_0xaca2('0xb'),'port':0x18eb});var io=require(_0xaca2('0xc'))(new Redis(config[_0xaca2('0x9')]));function UserReport(_0x3aecd6){this['trunks']=_0x3aecd6[_0xaca2('0xd')];this[_0xaca2('0xe')]=_0x3aecd6[_0xaca2('0xe')];this['telephones']=_0x3aecd6[_0xaca2('0xf')];ami['on'](_0xaca2('0x10'),this['syncRegistry'][_0xaca2('0x11')](this));ami['on'](_0xaca2('0x12'),this['syncRegistry'][_0xaca2('0x11')](this));ami['on'](_0xaca2('0x13'),this['syncDeviceState'][_0xaca2('0x11')](this));ami['on'](_0xaca2('0x14'),this[_0xaca2('0x15')][_0xaca2('0x11')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xaca2('0x16')]()['then'](ami[_0xaca2('0x17')]())[_0xaca2('0x18')](function(_0x228744){logger[_0xaca2('0x19')](_0xaca2('0x1a'),util[_0xaca2('0x1b')](_0x228744,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xaca2('0x16')]()[_0xaca2('0x1c')](ami['actionDeviceStateList']())[_0xaca2('0x18')](function(_0x3cea32){logger[_0xaca2('0x19')](_0xaca2('0x1d'),util[_0xaca2('0x1b')](_0x3cea32,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xaca2('0x16')]()[_0xaca2('0x1c')](ami[_0xaca2('0x1e')]())['catch'](function(_0x2a6cfc){logger[_0xaca2('0x19')](_0xaca2('0x1f'),util[_0xaca2('0x1b')](_0x2a6cfc,{'showHidden':![],'depth':null}));});}UserReport[_0xaca2('0x20')][_0xaca2('0x21')]=function(){setInterval(function(){BPromise[_0xaca2('0x16')]()[_0xaca2('0x1c')](showSipRegistrations())[_0xaca2('0x1c')](listDeviceStates())[_0xaca2('0x1c')](showPeersStatus());},0x32c8);};UserReport[_0xaca2('0x20')][_0xaca2('0x22')]=function(_0x3484a9){return _0x3484a9!==null&&!_['isUndefined'](_0x3484a9);};UserReport[_0xaca2('0x20')][_0xaca2('0x23')]=function(_0x2c28bb,_0x844ed6,_0x5c081d){io['to'](_0x2c28bb)[_0xaca2('0x23')](_0x844ed6,_0x5c081d);};UserReport[_0xaca2('0x20')][_0xaca2('0x24')]=function(_0x2c51b7){try{if(this['isNotNull'](_0x2c51b7)){logger[_0xaca2('0x25')](_0xaca2('0x26'),_0x2c51b7[_0xaca2('0x27')],_0x2c51b7[_0xaca2('0x28')]);logger['debug'](_0xaca2('0x29'),util[_0xaca2('0x1b')](_0x2c51b7,{'showHidden':![],'depth':null}));var _0x1b7557=_[_0xaca2('0x2a')](this[_0xaca2('0xd')],{'defaultuser':_0x2c51b7['username']});if(_0x1b7557){_0x2c51b7[_0xaca2('0x2b')]=_0x2c51b7[_0xaca2('0x28')];_[_0xaca2('0x2c')](_0x1b7557,_[_0xaca2('0x2d')](_0x2c51b7,[_0xaca2('0x2e'),'actionid','username',_0xaca2('0x28')]));logger[_0xaca2('0x2f')](_0xaca2('0x30'),util['inspect'](_0x1b7557,{'showHidden':![],'depth':null}));this[_0xaca2('0x23')](util['format']('trunk:%s',_0x1b7557[_0xaca2('0x31')]),_0xaca2('0x32'),_0x1b7557);}}}catch(_0x37f958){logger['error'](_0xaca2('0x29'),util['inspect'](_0x37f958,{'showHidden':![],'depth':null}));}};UserReport[_0xaca2('0x20')]['syncDeviceState']=function(_0x451f7f){try{if(this[_0xaca2('0x22')](_0x451f7f)){logger[_0xaca2('0x25')](_0xaca2('0x33'),_0x451f7f[_0xaca2('0x34')],_0x451f7f['state']);logger[_0xaca2('0x2f')](_0xaca2('0x35'),util[_0xaca2('0x1b')](_0x451f7f,{'showHidden':![],'depth':null}));if(this[_0xaca2('0xe')][_0x451f7f[_0xaca2('0x34')]]){if(!this['agents'][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x36')]||_0x451f7f[_0xaca2('0x28')][_0xaca2('0x37')]()=='inuse'){this[_0xaca2('0xe')][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x36')]=![];if(this['agents'][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x28')]!==_0x451f7f[_0xaca2('0x28')][_0xaca2('0x37')]()){this[_0xaca2('0xe')][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x38')]=_[_0xaca2('0x39')](moment()['format']('x'));}this['agents'][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x28')]=_0x451f7f[_0xaca2('0x28')]['toLowerCase']();this[_0xaca2('0xe')][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x3a')](_0x451f7f);}}else if(this[_0xaca2('0xf')][_0x451f7f[_0xaca2('0x34')]]){if(this[_0xaca2('0xf')][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x28')]!==_0x451f7f[_0xaca2('0x28')][_0xaca2('0x37')]()){this[_0xaca2('0xf')][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x38')]=_[_0xaca2('0x39')](moment()[_0xaca2('0x3b')]('x'));}this[_0xaca2('0xf')][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x28')]=_0x451f7f['state'][_0xaca2('0x37')]();logger['debug'](_0xaca2('0x3c'),util[_0xaca2('0x1b')](this[_0xaca2('0xf')][_0x451f7f[_0xaca2('0x34')]],{'showHidden':![],'depth':null}));this[_0xaca2('0x23')](util['format']('telephone:%s',this['telephones'][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x31')]),_0xaca2('0x3d'),this[_0xaca2('0xf')][_0x451f7f[_0xaca2('0x34')]]);}else if(this[_0xaca2('0xd')][_0x451f7f['device']]){if(this[_0xaca2('0xd')][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x28')]!==_0x451f7f[_0xaca2('0x28')][_0xaca2('0x37')]()){this[_0xaca2('0xd')][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x38')]=_[_0xaca2('0x39')](moment()['format']('x'));}this['trunks'][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x28')]=_0x451f7f[_0xaca2('0x28')][_0xaca2('0x37')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xaca2('0x1b')](this[_0xaca2('0xd')][_0x451f7f[_0xaca2('0x34')]],{'showHidden':![],'depth':null}));this[_0xaca2('0x23')](util['format'](_0xaca2('0x3e'),this[_0xaca2('0xd')][_0x451f7f[_0xaca2('0x34')]][_0xaca2('0x31')]),_0xaca2('0x32'),this['trunks'][_0x451f7f[_0xaca2('0x34')]]);}else if(_['startsWith'](_0x451f7f[_0xaca2('0x34')],_0xaca2('0x3f'))){var _0xc960ae=_0x451f7f[_0xaca2('0x34')];var _0xcd698d=_0xc960ae['substring'](_0xc960ae[_0xaca2('0x40')]('/')+0x1,_0xc960ae[_0xaca2('0x40')]('@'));var _0x31dd73=_[_0xaca2('0x2a')](this[_0xaca2('0xe')],function(_0x19ed22){return _0x19ed22['mobile']==_0xcd698d||_0x19ed22[_0xaca2('0x41')]==_0xcd698d||_0x19ed22['accountcode']==_0xcd698d;});if(_0x31dd73){if(_0x31dd73[_0xaca2('0x28')]!==_0x451f7f['state'][_0xaca2('0x37')]()){_0x31dd73[_0xaca2('0x38')]=_[_0xaca2('0x39')](moment()['format']('x'));}_0x31dd73['state']=_0x451f7f[_0xaca2('0x28')]['toLowerCase']();_0x31dd73['local']=!![];_0x31dd73[_0xaca2('0x3a')](_0x451f7f);}}}}catch(_0x56923b){logger[_0xaca2('0x19')]('[userReport][devicestatechange]',util[_0xaca2('0x1b')](_0x56923b,{'showHidden':![],'depth':null}));}};UserReport[_0xaca2('0x20')][_0xaca2('0x15')]=function(_0x1c1695){try{if(this[_0xaca2('0x22')](_0x1c1695)&&this[_0xaca2('0x22')](_0x1c1695['peerstatus'])){logger[_0xaca2('0x25')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x1c1695[_0xaca2('0x42')],_0x1c1695['address'],_0x1c1695[_0xaca2('0x14')]);logger['debug']('[userReport][peerstatus]',util['inspect'](_0x1c1695,{'showHidden':![],'depth':null}));if(this[_0xaca2('0xe')][_0x1c1695[_0xaca2('0x42')]]){if(!this[_0xaca2('0xe')][_0x1c1695['peer']]['local']||_0x1c1695[_0xaca2('0x14')]['toLowerCase']()==_0xaca2('0x43')){this[_0xaca2('0xe')][_0x1c1695['peer']][_0xaca2('0x36')]=![];this[_0xaca2('0xe')][_0x1c1695[_0xaca2('0x42')]][_0xaca2('0x44')]=_0x1c1695[_0xaca2('0x14')]['toLowerCase']();this[_0xaca2('0xe')][_0x1c1695[_0xaca2('0x42')]][_0xaca2('0x45')]=_0x1c1695[_0xaca2('0x45')];this[_0xaca2('0xe')][_0x1c1695['peer']][_0xaca2('0x3a')](_0x1c1695);}}else if(this[_0xaca2('0xf')][_0x1c1695['peer']]){this['telephones'][_0x1c1695['peer']][_0xaca2('0x44')]=_0x1c1695[_0xaca2('0x14')][_0xaca2('0x37')]();this[_0xaca2('0xf')][_0x1c1695[_0xaca2('0x42')]][_0xaca2('0x45')]=_0x1c1695[_0xaca2('0x45')];logger[_0xaca2('0x2f')](_0xaca2('0x46'),util[_0xaca2('0x1b')](this[_0xaca2('0xf')][_0x1c1695[_0xaca2('0x42')]],{'showHidden':![],'depth':null}));this[_0xaca2('0x23')](util[_0xaca2('0x3b')](_0xaca2('0x47'),this[_0xaca2('0xf')][_0x1c1695[_0xaca2('0x42')]][_0xaca2('0x31')]),_0xaca2('0x3d'),this[_0xaca2('0xf')][_0x1c1695[_0xaca2('0x42')]]);}else if(this[_0xaca2('0xd')][_0x1c1695[_0xaca2('0x42')]]){this['trunks'][_0x1c1695[_0xaca2('0x42')]]['status']=_0x1c1695[_0xaca2('0x14')]['toLowerCase']();this[_0xaca2('0xd')][_0x1c1695[_0xaca2('0x42')]]['address']=_0x1c1695[_0xaca2('0x45')];logger[_0xaca2('0x2f')](_0xaca2('0x48'),util['inspect'](this[_0xaca2('0xd')][_0x1c1695['peer']],{'showHidden':![],'depth':null}));this[_0xaca2('0x23')](util[_0xaca2('0x3b')]('trunk:%s',this[_0xaca2('0xd')][_0x1c1695['peer']][_0xaca2('0x31')]),_0xaca2('0x32'),this['trunks'][_0x1c1695[_0xaca2('0x42')]]);}}}catch(_0x3c70da){logger[_0xaca2('0x19')](_0xaca2('0x49'),util[_0xaca2('0x1b')](_0x3c70da,{'showHidden':![],'depth':null}));}};module[_0xaca2('0x4a')]=UserReport; \ No newline at end of file +var _0xd16f=['inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','isNotNull','device','[userReport][devicestatechange]','toLowerCase','local','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','mobile','phone','accountcode','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','util','ioredis','../../../config/environment','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','bind','syncRegistry','devicestatechange','syncDeviceState','peerstatus','resolve','actionSipShowRegistry','catch','[userReport][sipshowregistry]','then','actionDeviceStateList','error'];(function(_0x190385,_0x238c8e){var _0x58275c=function(_0x316fd9){while(--_0x316fd9){_0x190385['push'](_0x190385['shift']());}};_0x58275c(++_0x238c8e);}(_0xd16f,0x19e));var _0xfd16=function(_0x465409,_0x2ae7e7){_0x465409=_0x465409-0x0;var _0x5739af=_0xd16f[_0x465409];return _0x5739af;};'use strict';var _=require(_0xfd16('0x0'));var moment=require('moment');var util=require(_0xfd16('0x1'));var Redis=require(_0xfd16('0x2'));var BPromise=require('bluebird');var config=require(_0xfd16('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0xfd16('0x4'));config[_0xfd16('0x5')]=_[_0xfd16('0x6')](config[_0xfd16('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xfd16('0x7'))(new Redis(config[_0xfd16('0x5')]));function UserReport(_0xdf58ce){this['trunks']=_0xdf58ce[_0xfd16('0x8')];this[_0xfd16('0x9')]=_0xdf58ce[_0xfd16('0x9')];this[_0xfd16('0xa')]=_0xdf58ce[_0xfd16('0xa')];ami['on'](_0xfd16('0xb'),this['syncRegistry'][_0xfd16('0xc')](this));ami['on']('registry',this[_0xfd16('0xd')][_0xfd16('0xc')](this));ami['on'](_0xfd16('0xe'),this[_0xfd16('0xf')]['bind'](this));ami['on'](_0xfd16('0x10'),this['syncPeerStatus'][_0xfd16('0xc')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xfd16('0x11')]()['then'](ami[_0xfd16('0x12')]())[_0xfd16('0x13')](function(_0x597960){logger['error'](_0xfd16('0x14'),util['inspect'](_0x597960,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xfd16('0x15')](ami[_0xfd16('0x16')]())['catch'](function(_0x588a9f){logger[_0xfd16('0x17')]('[userReport][devicestatelist]',util[_0xfd16('0x18')](_0x588a9f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami[_0xfd16('0x19')]())[_0xfd16('0x13')](function(_0x456b90){logger[_0xfd16('0x17')](_0xfd16('0x1a'),util[_0xfd16('0x18')](_0x456b90,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xfd16('0x11')]()['then'](showSipRegistrations())[_0xfd16('0x15')](listDeviceStates())[_0xfd16('0x15')](showPeersStatus());},0x32c8);};UserReport[_0xfd16('0x1b')]['isNotNull']=function(_0x30402c){return _0x30402c!==null&&!_[_0xfd16('0x1c')](_0x30402c);};UserReport[_0xfd16('0x1b')]['emit']=function(_0x48b61d,_0x473b11,_0x53d1ad){io['to'](_0x48b61d)[_0xfd16('0x1d')](_0x473b11,_0x53d1ad);};UserReport[_0xfd16('0x1b')]['syncRegistry']=function(_0x3b5f64){try{if(this['isNotNull'](_0x3b5f64)){logger[_0xfd16('0x1e')](_0xfd16('0x1f'),_0x3b5f64[_0xfd16('0x20')],_0x3b5f64[_0xfd16('0x21')]);logger[_0xfd16('0x22')](_0xfd16('0x23'),util[_0xfd16('0x18')](_0x3b5f64,{'showHidden':![],'depth':null}));var _0x14fe22=_[_0xfd16('0x24')](this[_0xfd16('0x8')],{'defaultuser':_0x3b5f64[_0xfd16('0x20')]});if(_0x14fe22){_0x3b5f64[_0xfd16('0x25')]=_0x3b5f64[_0xfd16('0x21')];_[_0xfd16('0x26')](_0x14fe22,_[_0xfd16('0x27')](_0x3b5f64,[_0xfd16('0x28'),'actionid',_0xfd16('0x20'),'state']));logger[_0xfd16('0x22')](_0xfd16('0x29'),util[_0xfd16('0x18')](_0x14fe22,{'showHidden':![],'depth':null}));this['emit'](util[_0xfd16('0x2a')](_0xfd16('0x2b'),_0x14fe22[_0xfd16('0x2c')]),_0xfd16('0x2d'),_0x14fe22);}}}catch(_0x228eb4){logger[_0xfd16('0x17')]('[userReport][registry]',util['inspect'](_0x228eb4,{'showHidden':![],'depth':null}));}};UserReport[_0xfd16('0x1b')]['syncDeviceState']=function(_0x182a3a){try{if(this[_0xfd16('0x2e')](_0x182a3a)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x182a3a[_0xfd16('0x2f')],_0x182a3a['state']);logger[_0xfd16('0x22')](_0xfd16('0x30'),util[_0xfd16('0x18')](_0x182a3a,{'showHidden':![],'depth':null}));if(this['agents'][_0x182a3a[_0xfd16('0x2f')]]){if(!this[_0xfd16('0x9')][_0x182a3a[_0xfd16('0x2f')]]['local']||_0x182a3a[_0xfd16('0x21')][_0xfd16('0x31')]()=='inuse'){this['agents'][_0x182a3a[_0xfd16('0x2f')]][_0xfd16('0x32')]=![];if(this[_0xfd16('0x9')][_0x182a3a[_0xfd16('0x2f')]]['state']!==_0x182a3a[_0xfd16('0x21')][_0xfd16('0x31')]()){this[_0xfd16('0x9')][_0x182a3a[_0xfd16('0x2f')]][_0xfd16('0x33')]=_[_0xfd16('0x34')](moment()[_0xfd16('0x2a')]('x'));}this[_0xfd16('0x9')][_0x182a3a[_0xfd16('0x2f')]][_0xfd16('0x21')]=_0x182a3a[_0xfd16('0x21')][_0xfd16('0x31')]();this[_0xfd16('0x9')][_0x182a3a['device']][_0xfd16('0x35')](_0x182a3a);}}else if(this[_0xfd16('0xa')][_0x182a3a[_0xfd16('0x2f')]]){if(this[_0xfd16('0xa')][_0x182a3a[_0xfd16('0x2f')]][_0xfd16('0x21')]!==_0x182a3a['state'][_0xfd16('0x31')]()){this['telephones'][_0x182a3a[_0xfd16('0x2f')]]['stateTime']=_[_0xfd16('0x34')](moment()[_0xfd16('0x2a')]('x'));}this[_0xfd16('0xa')][_0x182a3a[_0xfd16('0x2f')]][_0xfd16('0x21')]=_0x182a3a[_0xfd16('0x21')][_0xfd16('0x31')]();logger[_0xfd16('0x22')](_0xfd16('0x36'),util[_0xfd16('0x18')](this[_0xfd16('0xa')][_0x182a3a[_0xfd16('0x2f')]],{'showHidden':![],'depth':null}));this[_0xfd16('0x1d')](util['format'](_0xfd16('0x37'),this['telephones'][_0x182a3a[_0xfd16('0x2f')]][_0xfd16('0x2c')]),_0xfd16('0x38'),this[_0xfd16('0xa')][_0x182a3a[_0xfd16('0x2f')]]);}else if(this[_0xfd16('0x8')][_0x182a3a['device']]){if(this['trunks'][_0x182a3a[_0xfd16('0x2f')]][_0xfd16('0x21')]!==_0x182a3a[_0xfd16('0x21')][_0xfd16('0x31')]()){this['trunks'][_0x182a3a[_0xfd16('0x2f')]][_0xfd16('0x33')]=_[_0xfd16('0x34')](moment()[_0xfd16('0x2a')]('x'));}this['trunks'][_0x182a3a[_0xfd16('0x2f')]]['state']=_0x182a3a['state'][_0xfd16('0x31')]();logger[_0xfd16('0x22')](_0xfd16('0x39'),util[_0xfd16('0x18')](this[_0xfd16('0x8')][_0x182a3a[_0xfd16('0x2f')]],{'showHidden':![],'depth':null}));this[_0xfd16('0x1d')](util[_0xfd16('0x2a')](_0xfd16('0x2b'),this[_0xfd16('0x8')][_0x182a3a[_0xfd16('0x2f')]][_0xfd16('0x2c')]),'trunk:save',this[_0xfd16('0x8')][_0x182a3a[_0xfd16('0x2f')]]);}else if(_[_0xfd16('0x3a')](_0x182a3a[_0xfd16('0x2f')],_0xfd16('0x3b'))){var _0x37b79a=_0x182a3a[_0xfd16('0x2f')];var _0x258c63=_0x37b79a['substring'](_0x37b79a['indexOf']('/')+0x1,_0x37b79a[_0xfd16('0x3c')]('@'));var _0x3355e6=_[_0xfd16('0x24')](this['agents'],function(_0x2082a3){return _0x2082a3[_0xfd16('0x3d')]==_0x258c63||_0x2082a3[_0xfd16('0x3e')]==_0x258c63||_0x2082a3[_0xfd16('0x3f')]==_0x258c63;});if(_0x3355e6){if(_0x3355e6[_0xfd16('0x21')]!==_0x182a3a[_0xfd16('0x21')][_0xfd16('0x31')]()){_0x3355e6[_0xfd16('0x33')]=_['toNumber'](moment()[_0xfd16('0x2a')]('x'));}_0x3355e6[_0xfd16('0x21')]=_0x182a3a[_0xfd16('0x21')][_0xfd16('0x31')]();_0x3355e6[_0xfd16('0x32')]=!![];_0x3355e6[_0xfd16('0x35')](_0x182a3a);}}}}catch(_0x528a26){logger['error'](_0xfd16('0x30'),util[_0xfd16('0x18')](_0x528a26,{'showHidden':![],'depth':null}));}};UserReport[_0xfd16('0x1b')][_0xfd16('0x40')]=function(_0x1b7a18){try{if(this[_0xfd16('0x2e')](_0x1b7a18)&&this[_0xfd16('0x2e')](_0x1b7a18['peerstatus'])){logger[_0xfd16('0x1e')](_0xfd16('0x41'),_0x1b7a18[_0xfd16('0x42')],_0x1b7a18[_0xfd16('0x43')],_0x1b7a18[_0xfd16('0x10')]);logger['debug']('[userReport][peerstatus]',util[_0xfd16('0x18')](_0x1b7a18,{'showHidden':![],'depth':null}));if(this[_0xfd16('0x9')][_0x1b7a18[_0xfd16('0x42')]]){if(!this[_0xfd16('0x9')][_0x1b7a18['peer']][_0xfd16('0x32')]||_0x1b7a18[_0xfd16('0x10')]['toLowerCase']()==_0xfd16('0x44')){this['agents'][_0x1b7a18['peer']][_0xfd16('0x32')]=![];this[_0xfd16('0x9')][_0x1b7a18[_0xfd16('0x42')]][_0xfd16('0x45')]=_0x1b7a18[_0xfd16('0x10')][_0xfd16('0x31')]();this[_0xfd16('0x9')][_0x1b7a18[_0xfd16('0x42')]]['address']=_0x1b7a18[_0xfd16('0x43')];this[_0xfd16('0x9')][_0x1b7a18[_0xfd16('0x42')]][_0xfd16('0x35')](_0x1b7a18);}}else if(this[_0xfd16('0xa')][_0x1b7a18[_0xfd16('0x42')]]){this[_0xfd16('0xa')][_0x1b7a18[_0xfd16('0x42')]]['status']=_0x1b7a18[_0xfd16('0x10')][_0xfd16('0x31')]();this[_0xfd16('0xa')][_0x1b7a18[_0xfd16('0x42')]][_0xfd16('0x43')]=_0x1b7a18[_0xfd16('0x43')];logger[_0xfd16('0x22')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this['telephones'][_0x1b7a18[_0xfd16('0x42')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xfd16('0x2a')](_0xfd16('0x37'),this[_0xfd16('0xa')][_0x1b7a18['peer']][_0xfd16('0x2c')]),_0xfd16('0x38'),this[_0xfd16('0xa')][_0x1b7a18[_0xfd16('0x42')]]);}else if(this[_0xfd16('0x8')][_0x1b7a18[_0xfd16('0x42')]]){this[_0xfd16('0x8')][_0x1b7a18[_0xfd16('0x42')]][_0xfd16('0x45')]=_0x1b7a18[_0xfd16('0x10')][_0xfd16('0x31')]();this[_0xfd16('0x8')][_0x1b7a18[_0xfd16('0x42')]][_0xfd16('0x43')]=_0x1b7a18[_0xfd16('0x43')];logger[_0xfd16('0x22')](_0xfd16('0x46'),util['inspect'](this[_0xfd16('0x8')][_0x1b7a18[_0xfd16('0x42')]],{'showHidden':![],'depth':null}));this[_0xfd16('0x1d')](util[_0xfd16('0x2a')]('trunk:%s',this[_0xfd16('0x8')][_0x1b7a18[_0xfd16('0x42')]][_0xfd16('0x2c')]),_0xfd16('0x2d'),this[_0xfd16('0x8')][_0x1b7a18['peer']]);}}}catch(_0x156d9b){logger[_0xfd16('0x17')](_0xfd16('0x47'),util['inspect'](_0x156d9b,{'showHidden':![],'depth':null}));}};module[_0xfd16('0x48')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 17ed19f..3416c7b 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 _0xb946=['channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','varset','syncVarSet','hangup','syncHangup','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','voice','merge','omit','event','privilege','debug','inspect','custom:agentcalled','interface','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','voiceChannels','routealias','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentcomplete','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','transfer','agent','talktime','acw','acwtime','acwTimeout','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','destaccountcode','user:agentcomplete','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','diff','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:'];(function(_0x3f8b59,_0x1e3b3a){var _0x2af3d5=function(_0x25860c){while(--_0x25860c){_0x3f8b59['push'](_0x3f8b59['shift']());}};_0x2af3d5(++_0x1e3b3a);}(_0xb946,0x1d7));var _0x6b94=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xb946[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0x6b94('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x6b94('0x1'));var config=require(_0x6b94('0x2'));var logger=require(_0x6b94('0x3'))(_0x6b94('0x4'));var ami=require('../ami');config[_0x6b94('0x5')]=_[_0x6b94('0x6')](config[_0x6b94('0x5')],{'host':_0x6b94('0x7'),'port':0x18eb});var io=require(_0x6b94('0x8'))(new Redis(config['redis']));function VoiceAgentReport(_0x297e90){this[_0x6b94('0x9')]={};this['voiceChannels']=_0x297e90[_0x6b94('0x9')];this[_0x6b94('0xa')]=_0x297e90['voiceQueues'];this[_0x6b94('0xb')]=_0x297e90[_0x6b94('0xb')];this[_0x6b94('0xc')]={};ami['on']('agentcalled',this[_0x6b94('0xd')][_0x6b94('0xe')](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x6b94('0xe')](this));ami['on'](_0x6b94('0xf'),this[_0x6b94('0x10')][_0x6b94('0xe')](this));ami['on'](_0x6b94('0x11'),this[_0x6b94('0x12')][_0x6b94('0xe')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x6b94('0xe')](this));ami['on'](_0x6b94('0x13'),this[_0x6b94('0x14')][_0x6b94('0xe')](this));ami['on'](_0x6b94('0x15'),this[_0x6b94('0x16')]['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x6b94('0xe')](this));ami['on'](_0x6b94('0x17'),this[_0x6b94('0x18')][_0x6b94('0xe')](this));ami['on'](_0x6b94('0x19'),this['syncAttendedTransfer'][_0x6b94('0xe')](this));ami['on']('blindtransfer',this[_0x6b94('0x1a')][_0x6b94('0xe')](this));}VoiceAgentReport[_0x6b94('0x1b')][_0x6b94('0x1c')]=function(_0x4acf37,_0x3469c1,_0x1113f0){io['to'](_0x4acf37)[_0x6b94('0x1c')](_0x3469c1,_0x1113f0);};VoiceAgentReport[_0x6b94('0x1b')][_0x6b94('0x1d')]=function(_0xae14da){return _0xae14da!==null&&!_[_0x6b94('0x1e')](_0xae14da);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x4e8bf5){try{if(this[_0x6b94('0x1d')](_0x4e8bf5)){logger[_0x6b94('0x1f')](_0x6b94('0x20'),_0x4e8bf5[_0x6b94('0x21')],_0x4e8bf5['membername'],_0x4e8bf5[_0x6b94('0x22')]);logger['debug'](_0x6b94('0x23'),_0x4e8bf5[_0x6b94('0x21')],util['inspect'](_0x4e8bf5,{'showHidden':![],'depth':null}));if(_[_0x6b94('0x1e')](this['channels'][_0x4e8bf5[_0x6b94('0x21')]])){this[_0x6b94('0x9')][_0x4e8bf5[_0x6b94('0x21')]]={};}if(_[_0x6b94('0x1e')](this[_0x6b94('0x9')][_0x4e8bf5[_0x6b94('0x21')]][_0x4e8bf5[_0x6b94('0x22')]])){this[_0x6b94('0x9')][_0x4e8bf5['uniqueid']][_0x4e8bf5[_0x6b94('0x22')]]={'agentcalledAt':moment()[_0x6b94('0x24')](_0x6b94('0x25')),'lastevent':_0x6b94('0x26'),'mandatoryDisposition':this[_0x6b94('0xa')][_0x4e8bf5[_0x6b94('0x27')]]?this[_0x6b94('0xa')][_0x4e8bf5[_0x6b94('0x27')]][_0x6b94('0x28')]||![]:![],'type':this['voiceQueues'][_0x4e8bf5['queue']]?this['voiceQueues'][_0x4e8bf5['queue']][_0x6b94('0x29')]||_0x6b94('0x2a'):_0x6b94('0x2a'),'variables':this['variables'][_0x4e8bf5[_0x6b94('0x21')]],'motionChannel':_0x6b94('0x2b')};}_[_0x6b94('0x2c')](this[_0x6b94('0x9')][_0x4e8bf5['uniqueid']][_0x4e8bf5[_0x6b94('0x22')]],_[_0x6b94('0x2d')](_0x4e8bf5,[_0x6b94('0x2e'),_0x6b94('0x2f')]));logger[_0x6b94('0x30')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x4e8bf5[_0x6b94('0x21')],util[_0x6b94('0x31')](this[_0x6b94('0x9')][_0x4e8bf5[_0x6b94('0x21')]][_0x4e8bf5['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x6b94('0x1c')](_0x6b94('0x32'),this[_0x6b94('0x9')][_0x4e8bf5[_0x6b94('0x21')]][_0x4e8bf5[_0x6b94('0x22')]]);var _0x3c03c1={'id':this[_0x6b94('0xb')][_0x4e8bf5[_0x6b94('0x33')]]['id'],'calleridnum':this[_0x6b94('0x9')][_0x4e8bf5[_0x6b94('0x21')]][_0x4e8bf5[_0x6b94('0x22')]][_0x6b94('0x34')],'queue':this[_0x6b94('0x9')][_0x4e8bf5[_0x6b94('0x21')]][_0x4e8bf5[_0x6b94('0x22')]][_0x6b94('0x27')],'variables':this['channels'][_0x4e8bf5[_0x6b94('0x21')]][_0x4e8bf5[_0x6b94('0x22')]][_0x6b94('0xc')]};logger[_0x6b94('0x30')](_0x6b94('0x35'),_0x4e8bf5[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x3c03c1,{'showHidden':![],'depth':null}));this[_0x6b94('0x1c')](util[_0x6b94('0x24')](_0x6b94('0x36'),_0x4e8bf5[_0x6b94('0x37')]),_0x6b94('0x38'),_0x3c03c1);}}catch(_0x2e1cd8){logger[_0x6b94('0x39')](_0x6b94('0x3a'),_0x4e8bf5['uniqueid'],util[_0x6b94('0x31')](_0x2e1cd8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6b94('0x3b')]=function(_0x5245aa){try{if(this[_0x6b94('0x1d')](_0x5245aa)){if(this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]]){logger[_0x6b94('0x30')](_0x6b94('0x3c'),_0x5245aa['uniqueid'],util[_0x6b94('0x31')](_0x5245aa,{'showHidden':![],'depth':null}));for(var _0x545591 in this['channels'][_0x5245aa[_0x6b94('0x21')]]){if(this[_0x6b94('0x9')][_0x5245aa['uniqueid']][_0x6b94('0x3d')](_0x545591)){if(_0x5245aa['destuniqueid']===_0x545591){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x5245aa['uniqueid'],_0x5245aa['membername'],_0x5245aa['destuniqueid']);this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x545591][_0x6b94('0x3e')]=moment()[_0x6b94('0x24')](_0x6b94('0x25'));this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x545591][_0x6b94('0x3f')]=_0x5245aa['connectedlinename'];this[_0x6b94('0x9')][_0x5245aa['uniqueid']][_0x545591][_0x6b94('0x40')]=_0x5245aa['connectedlinenum'];this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x545591][_0x6b94('0x41')]=_0x5245aa['destchannelstate'];this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x545591][_0x6b94('0x42')]=_0x5245aa[_0x6b94('0x42')];this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x545591][_0x6b94('0x43')]=_0x5245aa[_0x6b94('0x43')];this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x545591][_0x6b94('0x44')]=_0x6b94('0x45');if(this['voiceChannels'][this[_0x6b94('0x9')][_0x5245aa['uniqueid']][_0x545591][_0x6b94('0x21')]]){var _0x5cf49e=this[_0x6b94('0x46')][this[_0x6b94('0x9')][_0x5245aa['uniqueid']][_0x545591][_0x6b94('0x21')]][_0x6b94('0x47')];this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x545591]['routealias']=_0x5cf49e;_0x5245aa[_0x6b94('0x47')]=_0x5cf49e;}_[_0x6b94('0x2c')](this[_0x6b94('0xb')][_0x5245aa[_0x6b94('0x33')]],_['pick'](_0x5245aa,['queue','destconnectedlinenum',_0x6b94('0x47')]));logger['debug'](_0x6b94('0x48'),_0x5245aa[_0x6b94('0x21')],util[_0x6b94('0x31')](this['channels'][_0x5245aa[_0x6b94('0x21')]][_0x5245aa['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:agentconnect',this['channels'][_0x5245aa['uniqueid']][_0x5245aa[_0x6b94('0x22')]]);logger[_0x6b94('0x30')](_0x6b94('0x49'),_0x5245aa[_0x6b94('0x21')],util[_0x6b94('0x31')](this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x5245aa[_0x6b94('0x22')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x5245aa[_0x6b94('0x37')]),_0x6b94('0x4a'),this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x5245aa[_0x6b94('0x22')]]);}else if(!this['channels'][_0x5245aa['uniqueid']][_0x545591][_0x6b94('0xf')]&&!this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x545591]['agentcomplete']){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x5245aa[_0x6b94('0x21')],this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x545591][_0x6b94('0x37')],_0x545591);this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x545591][_0x6b94('0xf')]=!![];this[_0x6b94('0x9')][_0x5245aa['uniqueid']][_0x545591][_0x6b94('0x4b')]=moment()[_0x6b94('0x24')](_0x6b94('0x25'));this['channels'][_0x5245aa[_0x6b94('0x21')]][_0x545591][_0x6b94('0x4c')]=_0x5245aa[_0x6b94('0x22')];this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x545591][_0x6b94('0x4d')]=_0x5245aa['membername'];this['channels'][_0x5245aa[_0x6b94('0x21')]][_0x545591][_0x6b94('0x44')]=_0x6b94('0x4e');this[_0x6b94('0x9')][_0x5245aa[_0x6b94('0x21')]][_0x545591][_0x6b94('0x4f')]='answered_elsewhere';logger[_0x6b94('0x30')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x5245aa[_0x6b94('0x21')],util[_0x6b94('0x31')](this[_0x6b94('0x9')][_0x5245aa['uniqueid']][_0x545591],{'showHidden':![],'depth':null}));ami[_0x6b94('0x1c')](_0x6b94('0x50'),this['channels'][_0x5245aa[_0x6b94('0x21')]][_0x545591]);}}}}}}catch(_0x135e53){logger[_0x6b94('0x39')](_0x6b94('0x51'),_0x5245aa[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x135e53,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6b94('0x1b')][_0x6b94('0x10')]=function(_0x46bef8){try{if(this[_0x6b94('0x1d')](_0x46bef8)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x46bef8[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x46bef8,{'showHidden':![],'depth':null}));if(this[_0x6b94('0x9')][_0x46bef8[_0x6b94('0x21')]]&&this[_0x6b94('0x9')][_0x46bef8['uniqueid']][_0x46bef8[_0x6b94('0x22')]]){logger[_0x6b94('0x1f')](_0x6b94('0x52'),_0x46bef8[_0x6b94('0x21')],_0x46bef8['membername'],_0x46bef8[_0x6b94('0x22')]);this[_0x6b94('0x9')][_0x46bef8[_0x6b94('0x21')]][_0x46bef8[_0x6b94('0x22')]]['agentringnoanswer']=!![];this[_0x6b94('0x9')][_0x46bef8[_0x6b94('0x21')]][_0x46bef8[_0x6b94('0x22')]][_0x6b94('0x4b')]=moment()[_0x6b94('0x24')](_0x6b94('0x25'));this[_0x6b94('0x9')][_0x46bef8[_0x6b94('0x21')]][_0x46bef8[_0x6b94('0x22')]][_0x6b94('0x44')]=_0x6b94('0x53');this[_0x6b94('0x9')][_0x46bef8[_0x6b94('0x21')]][_0x46bef8['destuniqueid']][_0x6b94('0x4f')]=_0x6b94('0x53');logger['debug'](_0x6b94('0x54'),_0x46bef8['uniqueid'],util[_0x6b94('0x31')](this['channels'][_0x46bef8[_0x6b94('0x21')]][_0x46bef8[_0x6b94('0x22')]],{'showHidden':![],'depth':null}));ami[_0x6b94('0x1c')]('custom:agentringnoanswer',this[_0x6b94('0x9')][_0x46bef8[_0x6b94('0x21')]][_0x46bef8[_0x6b94('0x22')]]);}}}catch(_0x25ed3b){logger[_0x6b94('0x39')](_0x6b94('0x55'),_0x46bef8[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x25ed3b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6b94('0x1b')][_0x6b94('0x12')]=function(_0xd6d3e1){try{if(this[_0x6b94('0x1d')](_0xd6d3e1)){logger[_0x6b94('0x30')](_0x6b94('0x56'),_0xd6d3e1[_0x6b94('0x21')],util[_0x6b94('0x31')](_0xd6d3e1,{'showHidden':![],'depth':null}));if(this[_0x6b94('0x9')][_0xd6d3e1[_0x6b94('0x21')]]){for(var _0x1dbcd6 in this[_0x6b94('0x9')][_0xd6d3e1[_0x6b94('0x21')]]){if(this['channels'][_0xd6d3e1[_0x6b94('0x21')]]['hasOwnProperty'](_0x1dbcd6)&&!this[_0x6b94('0x9')][_0xd6d3e1[_0x6b94('0x21')]][_0x1dbcd6]['agentringnoanswer']&&!this[_0x6b94('0x9')][_0xd6d3e1[_0x6b94('0x21')]][_0x1dbcd6][_0x6b94('0x57')]){logger['info'](_0x6b94('0x58'),_0xd6d3e1['uniqueid'],this['channels'][_0xd6d3e1[_0x6b94('0x21')]][_0x1dbcd6]['membername'],_0x1dbcd6);this[_0x6b94('0x9')][_0xd6d3e1['uniqueid']][_0x1dbcd6][_0x6b94('0xf')]=!![];this['channels'][_0xd6d3e1[_0x6b94('0x21')]][_0x1dbcd6]['agentringnoanswerAt']=moment()[_0x6b94('0x24')](_0x6b94('0x25'));this[_0x6b94('0x9')][_0xd6d3e1[_0x6b94('0x21')]][_0x1dbcd6][_0x6b94('0x44')]=_0x6b94('0x59');this[_0x6b94('0x9')][_0xd6d3e1[_0x6b94('0x21')]][_0x1dbcd6][_0x6b94('0x4f')]=_0x6b94('0x59');logger['debug'](_0x6b94('0x5a'),_0xd6d3e1[_0x6b94('0x21')],util[_0x6b94('0x31')](this['channels'][_0xd6d3e1['uniqueid']][_0x1dbcd6],{'showHidden':![],'depth':null}));ami['emit'](_0x6b94('0x5b'),this['channels'][_0xd6d3e1['uniqueid']][_0x1dbcd6]);}}}}}catch(_0x412a39){logger[_0x6b94('0x39')]('[%s][voiceAgentReport][queuecallerabandon]',_0xd6d3e1[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x412a39,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6b94('0x1b')][_0x6b94('0x5c')]=function(_0x3bdd22){try{if(this[_0x6b94('0x1d')](_0x3bdd22)){logger[_0x6b94('0x30')](_0x6b94('0x5d'),_0x3bdd22[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x3bdd22,{'showHidden':![],'depth':null}));if(this[_0x6b94('0x9')][_0x3bdd22[_0x6b94('0x21')]]){for(var _0xa51da4 in this['channels'][_0x3bdd22[_0x6b94('0x21')]]){if(this[_0x6b94('0x9')][_0x3bdd22[_0x6b94('0x21')]][_0x6b94('0x3d')](_0xa51da4)){if(this['channels'][_0x3bdd22[_0x6b94('0x21')]][_0xa51da4][_0x6b94('0x3e')]&&!this[_0x6b94('0x9')][_0x3bdd22[_0x6b94('0x21')]][_0xa51da4][_0x6b94('0x57')]){logger[_0x6b94('0x1f')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3bdd22[_0x6b94('0x21')],this[_0x6b94('0x9')][_0x3bdd22[_0x6b94('0x21')]][_0xa51da4][_0x6b94('0x37')],_0xa51da4);this['channels'][_0x3bdd22['uniqueid']][_0xa51da4][_0x6b94('0x57')]=!![];this[_0x6b94('0x9')][_0x3bdd22[_0x6b94('0x21')]][_0xa51da4][_0x6b94('0x5e')]=moment()[_0x6b94('0x24')](_0x6b94('0x25'));this[_0x6b94('0x9')][_0x3bdd22['uniqueid']][_0xa51da4][_0x6b94('0x44')]='complete';this[_0x6b94('0x9')][_0x3bdd22[_0x6b94('0x21')]][_0xa51da4][_0x6b94('0x4f')]=_0x3bdd22[_0x6b94('0x4f')]==_0x6b94('0x5f')?_0x6b94('0x60'):_0x3bdd22[_0x6b94('0x4f')];this[_0x6b94('0x9')][_0x3bdd22[_0x6b94('0x21')]][_0xa51da4][_0x6b94('0x61')]=_0x3bdd22['talktime'];if(this[_0x6b94('0xa')][_0x3bdd22[_0x6b94('0x27')]]&&this[_0x6b94('0xa')][_0x3bdd22[_0x6b94('0x27')]][_0x6b94('0x62')]){this[_0x6b94('0x9')][_0x3bdd22[_0x6b94('0x21')]][_0xa51da4][_0x6b94('0x63')]=this[_0x6b94('0xa')][_0x3bdd22[_0x6b94('0x27')]][_0x6b94('0x64')];this['channels'][_0x3bdd22[_0x6b94('0x21')]][_0xa51da4]['agentacw']=!![];}this[_0x6b94('0xb')][_0x3bdd22[_0x6b94('0x33')]]=_[_0x6b94('0x2d')](this[_0x6b94('0xb')][_0x3bdd22['interface']],[_0x6b94('0x27'),_0x6b94('0x65')]);logger[_0x6b94('0x30')](_0x6b94('0x66'),_0x3bdd22[_0x6b94('0x21')],util[_0x6b94('0x31')](this[_0x6b94('0x9')][_0x3bdd22['uniqueid']][_0xa51da4],{'showHidden':![],'depth':null}));ami['emit'](_0x6b94('0x67'),this[_0x6b94('0x9')][_0x3bdd22[_0x6b94('0x21')]][_0xa51da4]);logger[_0x6b94('0x30')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x3bdd22[_0x6b94('0x21')],util[_0x6b94('0x31')]({'id':this[_0x6b94('0xb')][_0x3bdd22[_0x6b94('0x33')]]['id'],'destaccountcode':_0x3bdd22[_0x6b94('0x68')]},{'showHidden':![],'depth':null}));this[_0x6b94('0x1c')](util[_0x6b94('0x24')]('user:%s',_0x3bdd22[_0x6b94('0x37')]),_0x6b94('0x69'),{'id':this[_0x6b94('0xb')][_0x3bdd22[_0x6b94('0x33')]]['id'],'destaccountcode':_0x3bdd22[_0x6b94('0x68')]});}}}}}}catch(_0x47c2ec){logger[_0x6b94('0x39')]('[%s][voiceAgentReport][agentcomplete]',_0x3bdd22[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x47c2ec,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6b94('0x1b')][_0x6b94('0x14')]=function(_0x55767c){try{if(this[_0x6b94('0x1d')](_0x55767c)){logger[_0x6b94('0x30')]('[%s][voiceAgentReport][varset]\x20event:',_0x55767c[_0x6b94('0x21')],util['inspect'](_0x55767c,{'showHidden':![],'depth':null}));this[_0x6b94('0x6a')](_0x55767c[_0x6b94('0x21')],_['keys'](_0x55767c[_0x6b94('0x6b')])[0x0],_0x55767c[_0x6b94('0x6c')]);if(this['channels'][_0x55767c['uniqueid']]){for(var _0xa9e717 in this['channels'][_0x55767c['uniqueid']]){if(this[_0x6b94('0x9')][_0x55767c[_0x6b94('0x21')]][_0x6b94('0x3d')](_0xa9e717)){logger['info'](_0x6b94('0x6d'),_0x55767c[_0x6b94('0x21')],_0xa9e717,_['keys'](_0x55767c['variable'])[0x0],_0x55767c['value']);if(_[_0x6b94('0x1e')](this[_0x6b94('0x9')][_0x55767c['uniqueid']][_0xa9e717][_0x6b94('0xc')])){this['channels'][_0x55767c['uniqueid']][_0xa9e717][_0x6b94('0xc')]={};}this['channels'][_0x55767c[_0x6b94('0x21')]][_0xa9e717][_0x6b94('0xc')]=this['variables'][_0x55767c[_0x6b94('0x21')]];}}}}}catch(_0xe73e25){logger[_0x6b94('0x39')]('[%s][voiceAgentReport][varset]',_0x55767c[_0x6b94('0x21')],util[_0x6b94('0x31')](_0xe73e25,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6b94('0x1b')][_0x6b94('0x6a')]=function(_0x5d0429,_0x2e81bf,_0x15cb9e){var _0xfe72d9=[_0x6b94('0x6e'),_0x6b94('0x6f'),_0x6b94('0x70'),'rtpaudioqosjitterbridged',_0x6b94('0x71'),'rtpaudioqoslossbridged',_0x6b94('0x72'),_0x6b94('0x73'),_0x6b94('0x74'),_0x6b94('0x75'),_0x6b94('0x76'),_0x6b94('0x77'),_0x6b94('0x78'),_0x6b94('0x79'),_0x6b94('0x7a'),_0x6b94('0x7b'),_0x6b94('0x37'),_0x6b94('0x7c'),_0x6b94('0x7d')];if(!_[_0x6b94('0x7e')](_0x2e81bf)&&!_['includes'](_0xfe72d9,_0x2e81bf)){if(_['isUndefined'](this[_0x6b94('0xc')][_0x5d0429])){this[_0x6b94('0xc')][_0x5d0429]={};}this[_0x6b94('0xc')][_0x5d0429][_0x2e81bf]=_0x15cb9e;}};VoiceAgentReport[_0x6b94('0x1b')][_0x6b94('0x16')]=function(_0x5ad5ae){try{if(this[_0x6b94('0x1d')](_0x5ad5ae)){logger[_0x6b94('0x30')](_0x6b94('0x7f'),_0x5ad5ae['uniqueid'],util[_0x6b94('0x31')](_0x5ad5ae,{'showHidden':![],'depth':null}));if(this['channels'][_0x5ad5ae[_0x6b94('0x21')]]){for(var _0x337dd2 in this[_0x6b94('0x9')][_0x5ad5ae['uniqueid']]){if(this[_0x6b94('0x9')][_0x5ad5ae[_0x6b94('0x21')]][_0x6b94('0x3d')](_0x337dd2)){if(this[_0x6b94('0x9')][_0x5ad5ae['uniqueid']][_0x337dd2][_0x6b94('0x4f')]==_0x6b94('0x5f')&&this[_0x6b94('0x9')][_0x5ad5ae['uniqueid']][_0x337dd2]['agentcomplete']){logger[_0x6b94('0x1f')](_0x6b94('0x80'),_0x5ad5ae[_0x6b94('0x21')],_0x337dd2);this[_0x6b94('0x9')][_0x5ad5ae[_0x6b94('0x21')]][_0x337dd2][_0x6b94('0x5e')]=moment()[_0x6b94('0x24')](_0x6b94('0x25'));}}}logger[_0x6b94('0x30')](_0x6b94('0x81'),_0x5ad5ae[_0x6b94('0x21')],util[_0x6b94('0x31')](_[_0x6b94('0x82')](this[_0x6b94('0x9')][_0x5ad5ae['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x6b94('0x1c')](_0x6b94('0x83'),_[_0x6b94('0x82')](this[_0x6b94('0x9')][_0x5ad5ae[_0x6b94('0x21')]]));delete this['channels'][_0x5ad5ae[_0x6b94('0x21')]];}if(this[_0x6b94('0xc')][_0x5ad5ae[_0x6b94('0x21')]]){delete this[_0x6b94('0xc')][_0x5ad5ae['uniqueid']];}}}catch(_0x1433d4){logger[_0x6b94('0x39')]('[%s][voiceAgentReport][hangup]',_0x5ad5ae[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x1433d4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6b94('0x84')]=function(_0x2f42d2){try{if(this['isNotNull'](_0x2f42d2)){logger[_0x6b94('0x30')](_0x6b94('0x85'),_0x2f42d2[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x2f42d2,{'showHidden':![],'depth':null}));if(this[_0x6b94('0x9')][_0x2f42d2['transfereeuniqueid']]){for(var _0x30b207 in this[_0x6b94('0x9')][_0x2f42d2[_0x6b94('0x86')]]){if(this[_0x6b94('0x9')][_0x2f42d2[_0x6b94('0x86')]]['hasOwnProperty'](_0x30b207)){if(_0x2f42d2[_0x6b94('0x87')]===_0x30b207){logger[_0x6b94('0x1f')](_0x6b94('0x88'),_0x2f42d2[_0x6b94('0x21')],this[_0x6b94('0x9')][_0x2f42d2[_0x6b94('0x86')]][_0x30b207][_0x6b94('0x37')],_0x30b207);var _0x1718ca=moment();this[_0x6b94('0x9')][_0x2f42d2[_0x6b94('0x86')]][_0x30b207][_0x6b94('0x57')]=!![];this[_0x6b94('0x9')][_0x2f42d2['transfereeuniqueid']][_0x30b207][_0x6b94('0x5e')]=moment()[_0x6b94('0x24')](_0x6b94('0x25'));this['channels'][_0x2f42d2[_0x6b94('0x86')]][_0x30b207][_0x6b94('0x44')]=_0x6b94('0x89');this[_0x6b94('0x9')][_0x2f42d2[_0x6b94('0x86')]][_0x30b207]['reason']=_0x6b94('0x5f');this[_0x6b94('0x9')][_0x2f42d2[_0x6b94('0x86')]][_0x30b207][_0x6b94('0x61')]=_0x1718ca['diff'](this[_0x6b94('0x9')][_0x2f42d2[_0x6b94('0x86')]][_0x30b207][_0x6b94('0x3e')],'seconds');}}}}if(this[_0x6b94('0x9')][_0x2f42d2[_0x6b94('0x8a')]]){var _0x397489=this[_0x6b94('0x9')][_0x2f42d2['secondtransfereruniqueid']];this[_0x6b94('0x9')][_0x2f42d2[_0x6b94('0x8a')]]=this[_0x6b94('0x9')][_0x2f42d2['transfereeuniqueid']];this[_0x6b94('0x9')][_0x2f42d2['transfereeuniqueid']]=_0x397489;}}}catch(_0x42237f){logger[_0x6b94('0x39')](_0x6b94('0x8b'),_0x2f42d2[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x42237f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6b94('0x1b')][_0x6b94('0x1a')]=function(_0x1f1801){try{if(this[_0x6b94('0x1d')](_0x1f1801)){logger[_0x6b94('0x30')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x1f1801[_0x6b94('0x21')],util['inspect'](_0x1f1801,{'showHidden':![],'depth':null}));if(this[_0x6b94('0x9')][_0x1f1801[_0x6b94('0x86')]]){for(var _0x4911b6 in this[_0x6b94('0x9')][_0x1f1801[_0x6b94('0x86')]]){if(this['channels'][_0x1f1801['transfereeuniqueid']][_0x6b94('0x3d')](_0x4911b6)){if(_0x1f1801[_0x6b94('0x8c')]===_0x4911b6){logger[_0x6b94('0x1f')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1f1801[_0x6b94('0x21')],this['channels'][_0x1f1801[_0x6b94('0x86')]][_0x4911b6][_0x6b94('0x37')],_0x4911b6);var _0x4c6b9d=moment();this[_0x6b94('0x9')][_0x1f1801['transfereeuniqueid']][_0x4911b6][_0x6b94('0x57')]=!![];this[_0x6b94('0x9')][_0x1f1801[_0x6b94('0x86')]][_0x4911b6][_0x6b94('0x5e')]=_0x4c6b9d;this[_0x6b94('0x9')][_0x1f1801[_0x6b94('0x86')]][_0x4911b6]['lastevent']=_0x6b94('0x89');this[_0x6b94('0x9')][_0x1f1801[_0x6b94('0x86')]][_0x4911b6][_0x6b94('0x4f')]='transfer';this[_0x6b94('0x9')][_0x1f1801[_0x6b94('0x86')]][_0x4911b6][_0x6b94('0x61')]=_0x4c6b9d[_0x6b94('0x8d')](this[_0x6b94('0x9')][_0x1f1801[_0x6b94('0x86')]][_0x4911b6][_0x6b94('0x3e')],'seconds');}}}}}}catch(_0x3eb419){logger['error'](_0x6b94('0x8e'),_0x1f1801[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x3eb419,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6b94('0x1b')][_0x6b94('0x8f')]=function(_0x35903e){var _0x1f92f7='';try{if(this[_0x6b94('0x1d')](_0x35903e)){logger[_0x6b94('0x30')](_0x6b94('0x90'),_0x35903e['uniqueid'],util[_0x6b94('0x31')](_0x35903e,{'showHidden':![],'depth':null}));if(_0x35903e[_0x6b94('0x91')]){_0x1f92f7=_0x35903e[_0x6b94('0x91')][_0x6b94('0x92')](0x0,_0x35903e[_0x6b94('0x91')][_0x6b94('0x93')]('-'));if(this[_0x6b94('0xb')][_0x1f92f7]){logger[_0x6b94('0x1f')](_0x6b94('0x94'),_0x35903e[_0x6b94('0x21')],_0x1f92f7);this[_0x6b94('0xb')][_0x1f92f7][_0x6b94('0x95')]=!![];}}}}catch(_0x1dfd7f){logger[_0x6b94('0x39')]('[%s][voiceAgentReport][musiconholdstart]',_0x35903e[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x1dfd7f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6b94('0x18')]=function(_0x1209eb){var _0x298265='';try{if(this[_0x6b94('0x1d')](_0x1209eb)){logger[_0x6b94('0x30')](_0x6b94('0x96'),_0x1209eb[_0x6b94('0x21')],util[_0x6b94('0x31')](_0x1209eb,{'showHidden':![],'depth':null}));if(_0x1209eb[_0x6b94('0x91')]){_0x298265=_0x1209eb['channel'][_0x6b94('0x92')](0x0,_0x1209eb['channel'][_0x6b94('0x93')]('-'));if(this[_0x6b94('0xb')][_0x298265]){logger[_0x6b94('0x1f')](_0x6b94('0x97'),_0x1209eb[_0x6b94('0x21')],_0x298265);this[_0x6b94('0xb')][_0x298265]['onhold']=![];}}}}catch(_0x9340b6){logger[_0x6b94('0x39')](_0x6b94('0x98'),_0x1209eb[_0x6b94('0x21')],util['inspect'](_0x9340b6,{'showHidden':![],'depth':null}));}};module[_0x6b94('0x99')]=VoiceAgentReport; \ No newline at end of file +var _0xb924=['YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','variables','voice','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','merge','interface','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','omit','destconnectedlinenum','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberpenalty','memberrealtime','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','agentcompleteAt','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','ami','../ami','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','destuniqueid','format'];(function(_0x317e43,_0xfadc50){var _0x5c3c82=function(_0x41c42f){while(--_0x41c42f){_0x317e43['push'](_0x317e43['shift']());}};_0x5c3c82(++_0xfadc50);}(_0xb924,0x1a0));var _0x4b92=function(_0x5c78f5,_0x5a7605){_0x5c78f5=_0x5c78f5-0x0;var _0x5cbac9=_0xb924[_0x5c78f5];return _0x5cbac9;};'use strict';var _=require(_0x4b92('0x0'));var moment=require(_0x4b92('0x1'));var util=require(_0x4b92('0x2'));var Redis=require('ioredis');var config=require(_0x4b92('0x3'));var logger=require('../../../config/logger')(_0x4b92('0x4'));var ami=require(_0x4b92('0x5'));config[_0x4b92('0x6')]=_['defaults'](config[_0x4b92('0x6')],{'host':_0x4b92('0x7'),'port':0x18eb});var io=require(_0x4b92('0x8'))(new Redis(config[_0x4b92('0x6')]));function VoiceAgentReport(_0xce75ce){this[_0x4b92('0x9')]={};this[_0x4b92('0xa')]=_0xce75ce['channels'];this[_0x4b92('0xb')]=_0xce75ce[_0x4b92('0xb')];this[_0x4b92('0xc')]=_0xce75ce['agents'];this['variables']={};ami['on'](_0x4b92('0xd'),this[_0x4b92('0xe')]['bind'](this));ami['on'](_0x4b92('0xf'),this[_0x4b92('0x10')][_0x4b92('0x11')](this));ami['on'](_0x4b92('0x12'),this[_0x4b92('0x13')][_0x4b92('0x11')](this));ami['on'](_0x4b92('0x14'),this[_0x4b92('0x15')][_0x4b92('0x11')](this));ami['on'](_0x4b92('0x16'),this['syncAgentComplete']['bind'](this));ami['on']('varset',this[_0x4b92('0x17')]['bind'](this));ami['on']('hangup',this[_0x4b92('0x18')][_0x4b92('0x11')](this));ami['on'](_0x4b92('0x19'),this[_0x4b92('0x1a')][_0x4b92('0x11')](this));ami['on'](_0x4b92('0x1b'),this[_0x4b92('0x1c')]['bind'](this));ami['on'](_0x4b92('0x1d'),this[_0x4b92('0x1e')]['bind'](this));ami['on'](_0x4b92('0x1f'),this[_0x4b92('0x20')]['bind'](this));}VoiceAgentReport[_0x4b92('0x21')][_0x4b92('0x22')]=function(_0x36bfc8,_0x17961c,_0x2bc3d6){io['to'](_0x36bfc8)[_0x4b92('0x22')](_0x17961c,_0x2bc3d6);};VoiceAgentReport['prototype'][_0x4b92('0x23')]=function(_0x2bbabf){return _0x2bbabf!==null&&!_['isUndefined'](_0x2bbabf);};VoiceAgentReport[_0x4b92('0x21')][_0x4b92('0xe')]=function(_0x3b83e0){try{if(this[_0x4b92('0x23')](_0x3b83e0)){logger[_0x4b92('0x24')](_0x4b92('0x25'),_0x3b83e0[_0x4b92('0x26')],_0x3b83e0[_0x4b92('0x27')],_0x3b83e0['destuniqueid']);logger[_0x4b92('0x28')](_0x4b92('0x29'),_0x3b83e0[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x3b83e0,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x4b92('0x9')][_0x3b83e0[_0x4b92('0x26')]])){this[_0x4b92('0x9')][_0x3b83e0[_0x4b92('0x26')]]={};}if(_[_0x4b92('0x2b')](this[_0x4b92('0x9')][_0x3b83e0[_0x4b92('0x26')]][_0x3b83e0['destuniqueid']])){this[_0x4b92('0x9')][_0x3b83e0['uniqueid']][_0x3b83e0[_0x4b92('0x2c')]]={'agentcalledAt':moment()[_0x4b92('0x2d')](_0x4b92('0x2e')),'lastevent':_0x4b92('0x2f'),'mandatoryDisposition':this[_0x4b92('0xb')][_0x3b83e0[_0x4b92('0x30')]]?this['voiceQueues'][_0x3b83e0[_0x4b92('0x30')]][_0x4b92('0x31')]||![]:![],'type':this[_0x4b92('0xb')][_0x3b83e0[_0x4b92('0x30')]]?this[_0x4b92('0xb')][_0x3b83e0[_0x4b92('0x30')]]['type']||'inbound':_0x4b92('0x32'),'variables':this[_0x4b92('0x33')][_0x3b83e0[_0x4b92('0x26')]],'motionChannel':_0x4b92('0x34')};}_['merge'](this[_0x4b92('0x9')][_0x3b83e0['uniqueid']][_0x3b83e0[_0x4b92('0x2c')]],_['omit'](_0x3b83e0,['event',_0x4b92('0x35')]));logger[_0x4b92('0x28')](_0x4b92('0x36'),_0x3b83e0['uniqueid'],util[_0x4b92('0x2a')](this[_0x4b92('0x9')][_0x3b83e0[_0x4b92('0x26')]][_0x3b83e0[_0x4b92('0x2c')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcalled',this[_0x4b92('0x9')][_0x3b83e0[_0x4b92('0x26')]][_0x3b83e0['destuniqueid']]);var _0x1110ec={'id':this['agents'][_0x3b83e0['interface']]['id'],'calleridnum':this[_0x4b92('0x9')][_0x3b83e0[_0x4b92('0x26')]][_0x3b83e0[_0x4b92('0x2c')]][_0x4b92('0x37')],'queue':this[_0x4b92('0x9')][_0x3b83e0[_0x4b92('0x26')]][_0x3b83e0['destuniqueid']]['queue'],'variables':this[_0x4b92('0x9')][_0x3b83e0[_0x4b92('0x26')]][_0x3b83e0[_0x4b92('0x2c')]][_0x4b92('0x33')]};logger[_0x4b92('0x28')](_0x4b92('0x38'),_0x3b83e0[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x1110ec,{'showHidden':![],'depth':null}));this[_0x4b92('0x22')](util[_0x4b92('0x2d')](_0x4b92('0x39'),_0x3b83e0[_0x4b92('0x27')]),'user:called',_0x1110ec);}}catch(_0x53e877){logger[_0x4b92('0x3a')](_0x4b92('0x3b'),_0x3b83e0[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x53e877,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4b92('0x21')][_0x4b92('0x10')]=function(_0x35e13e){try{if(this[_0x4b92('0x23')](_0x35e13e)){if(this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]]){logger[_0x4b92('0x28')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x35e13e['uniqueid'],util[_0x4b92('0x2a')](_0x35e13e,{'showHidden':![],'depth':null}));for(var _0x2460d5 in this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]]){if(this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]]['hasOwnProperty'](_0x2460d5)){if(_0x35e13e[_0x4b92('0x2c')]===_0x2460d5){logger['info'](_0x4b92('0x3c'),_0x35e13e['uniqueid'],_0x35e13e[_0x4b92('0x27')],_0x35e13e[_0x4b92('0x2c')]);this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x2460d5][_0x4b92('0x3d')]=moment()[_0x4b92('0x2d')](_0x4b92('0x2e'));this['channels'][_0x35e13e[_0x4b92('0x26')]][_0x2460d5][_0x4b92('0x3e')]=_0x35e13e[_0x4b92('0x3e')];this['channels'][_0x35e13e['uniqueid']][_0x2460d5][_0x4b92('0x3f')]=_0x35e13e[_0x4b92('0x3f')];this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x2460d5][_0x4b92('0x40')]=_0x35e13e['destchannelstate'];this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x2460d5]['destchannelstatedesc']=_0x35e13e[_0x4b92('0x41')];this['channels'][_0x35e13e['uniqueid']][_0x2460d5][_0x4b92('0x42')]=_0x35e13e['holdtime'];this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x2460d5][_0x4b92('0x43')]=_0x4b92('0x44');if(this[_0x4b92('0xa')][this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x2460d5][_0x4b92('0x26')]]){var _0x2a9fac=this[_0x4b92('0xa')][this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x2460d5][_0x4b92('0x26')]][_0x4b92('0x45')];this['channels'][_0x35e13e[_0x4b92('0x26')]][_0x2460d5][_0x4b92('0x45')]=_0x2a9fac;_0x35e13e[_0x4b92('0x45')]=_0x2a9fac;}_[_0x4b92('0x46')](this[_0x4b92('0xc')][_0x35e13e[_0x4b92('0x47')]],_[_0x4b92('0x48')](_0x35e13e,[_0x4b92('0x30'),'destconnectedlinenum',_0x4b92('0x45')]));logger[_0x4b92('0x28')](_0x4b92('0x49'),_0x35e13e[_0x4b92('0x26')],util[_0x4b92('0x2a')](this['channels'][_0x35e13e['uniqueid']][_0x35e13e[_0x4b92('0x2c')]],{'showHidden':![],'depth':null}));ami['emit'](_0x4b92('0x4a'),this[_0x4b92('0x9')][_0x35e13e['uniqueid']][_0x35e13e['destuniqueid']]);logger[_0x4b92('0x28')](_0x4b92('0x4b'),_0x35e13e[_0x4b92('0x26')],util['inspect'](this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x35e13e['destuniqueid']],{'showHidden':![],'depth':null}));this['emit'](util[_0x4b92('0x2d')]('user:%s',_0x35e13e['membername']),_0x4b92('0x4c'),this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x35e13e[_0x4b92('0x2c')]]);}else if(!this['channels'][_0x35e13e['uniqueid']][_0x2460d5]['agentringnoanswer']&&!this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x2460d5]['agentcomplete']){logger[_0x4b92('0x24')](_0x4b92('0x4d'),_0x35e13e[_0x4b92('0x26')],this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x2460d5][_0x4b92('0x27')],_0x2460d5);this['channels'][_0x35e13e['uniqueid']][_0x2460d5][_0x4b92('0x12')]=!![];this[_0x4b92('0x9')][_0x35e13e['uniqueid']][_0x2460d5]['agentringnoanswerAt']=moment()[_0x4b92('0x2d')](_0x4b92('0x2e'));this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x2460d5][_0x4b92('0x4e')]=_0x35e13e['destuniqueid'];this['channels'][_0x35e13e['uniqueid']][_0x2460d5][_0x4b92('0x4f')]=_0x35e13e[_0x4b92('0x27')];this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x2460d5][_0x4b92('0x43')]=_0x4b92('0x50');this['channels'][_0x35e13e['uniqueid']][_0x2460d5][_0x4b92('0x51')]=_0x4b92('0x50');logger[_0x4b92('0x28')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x35e13e[_0x4b92('0x26')],util['inspect'](this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x2460d5],{'showHidden':![],'depth':null}));ami[_0x4b92('0x22')]('custom:agentansweredelsewhere',this[_0x4b92('0x9')][_0x35e13e[_0x4b92('0x26')]][_0x2460d5]);}}}}}}catch(_0x5d1755){logger[_0x4b92('0x3a')](_0x4b92('0x52'),_0x35e13e[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x5d1755,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4b92('0x21')][_0x4b92('0x13')]=function(_0x32a1d5){try{if(this['isNotNull'](_0x32a1d5)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x32a1d5[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x32a1d5,{'showHidden':![],'depth':null}));if(this[_0x4b92('0x9')][_0x32a1d5[_0x4b92('0x26')]]&&this[_0x4b92('0x9')][_0x32a1d5[_0x4b92('0x26')]][_0x32a1d5[_0x4b92('0x2c')]]){logger['info'](_0x4b92('0x53'),_0x32a1d5[_0x4b92('0x26')],_0x32a1d5['membername'],_0x32a1d5[_0x4b92('0x2c')]);this[_0x4b92('0x9')][_0x32a1d5[_0x4b92('0x26')]][_0x32a1d5[_0x4b92('0x2c')]]['agentringnoanswer']=!![];this['channels'][_0x32a1d5[_0x4b92('0x26')]][_0x32a1d5[_0x4b92('0x2c')]][_0x4b92('0x54')]=moment()[_0x4b92('0x2d')](_0x4b92('0x2e'));this['channels'][_0x32a1d5[_0x4b92('0x26')]][_0x32a1d5[_0x4b92('0x2c')]][_0x4b92('0x43')]=_0x4b92('0x55');this[_0x4b92('0x9')][_0x32a1d5[_0x4b92('0x26')]][_0x32a1d5[_0x4b92('0x2c')]][_0x4b92('0x51')]=_0x4b92('0x55');logger[_0x4b92('0x28')](_0x4b92('0x56'),_0x32a1d5['uniqueid'],util[_0x4b92('0x2a')](this[_0x4b92('0x9')][_0x32a1d5[_0x4b92('0x26')]][_0x32a1d5['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x4b92('0x22')](_0x4b92('0x57'),this[_0x4b92('0x9')][_0x32a1d5['uniqueid']][_0x32a1d5[_0x4b92('0x2c')]]);}}}catch(_0x3c2eb7){logger[_0x4b92('0x3a')](_0x4b92('0x58'),_0x32a1d5[_0x4b92('0x26')],util['inspect'](_0x3c2eb7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4b92('0x21')]['syncQueueCallerAbandon']=function(_0x5896d5){try{if(this[_0x4b92('0x23')](_0x5896d5)){logger[_0x4b92('0x28')](_0x4b92('0x59'),_0x5896d5[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x5896d5,{'showHidden':![],'depth':null}));if(this[_0x4b92('0x9')][_0x5896d5['uniqueid']]){for(var _0x5beeb4 in this[_0x4b92('0x9')][_0x5896d5[_0x4b92('0x26')]]){if(this[_0x4b92('0x9')][_0x5896d5[_0x4b92('0x26')]][_0x4b92('0x5a')](_0x5beeb4)&&!this[_0x4b92('0x9')][_0x5896d5[_0x4b92('0x26')]][_0x5beeb4][_0x4b92('0x12')]&&!this[_0x4b92('0x9')][_0x5896d5[_0x4b92('0x26')]][_0x5beeb4][_0x4b92('0x16')]){logger[_0x4b92('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x5896d5[_0x4b92('0x26')],this['channels'][_0x5896d5[_0x4b92('0x26')]][_0x5beeb4]['membername'],_0x5beeb4);this[_0x4b92('0x9')][_0x5896d5[_0x4b92('0x26')]][_0x5beeb4]['agentringnoanswer']=!![];this[_0x4b92('0x9')][_0x5896d5[_0x4b92('0x26')]][_0x5beeb4][_0x4b92('0x54')]=moment()[_0x4b92('0x2d')](_0x4b92('0x2e'));this[_0x4b92('0x9')][_0x5896d5['uniqueid']][_0x5beeb4][_0x4b92('0x43')]=_0x4b92('0x5b');this[_0x4b92('0x9')][_0x5896d5[_0x4b92('0x26')]][_0x5beeb4][_0x4b92('0x51')]=_0x4b92('0x5b');logger[_0x4b92('0x28')](_0x4b92('0x5c'),_0x5896d5[_0x4b92('0x26')],util[_0x4b92('0x2a')](this[_0x4b92('0x9')][_0x5896d5[_0x4b92('0x26')]][_0x5beeb4],{'showHidden':![],'depth':null}));ami[_0x4b92('0x22')](_0x4b92('0x5d'),this[_0x4b92('0x9')][_0x5896d5[_0x4b92('0x26')]][_0x5beeb4]);}}}}}catch(_0x5f8aa8){logger[_0x4b92('0x3a')](_0x4b92('0x5e'),_0x5896d5[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x5f8aa8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4b92('0x5f')]=function(_0x4e005c){try{if(this[_0x4b92('0x23')](_0x4e005c)){logger[_0x4b92('0x28')](_0x4b92('0x60'),_0x4e005c[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x4e005c,{'showHidden':![],'depth':null}));if(this[_0x4b92('0x9')][_0x4e005c[_0x4b92('0x26')]]){for(var _0x5b6546 in this[_0x4b92('0x9')][_0x4e005c[_0x4b92('0x26')]]){if(this[_0x4b92('0x9')][_0x4e005c[_0x4b92('0x26')]][_0x4b92('0x5a')](_0x5b6546)){if(this[_0x4b92('0x9')][_0x4e005c[_0x4b92('0x26')]][_0x5b6546]['agentconnectAt']&&!this[_0x4b92('0x9')][_0x4e005c[_0x4b92('0x26')]][_0x5b6546][_0x4b92('0x16')]){logger[_0x4b92('0x24')](_0x4b92('0x61'),_0x4e005c[_0x4b92('0x26')],this[_0x4b92('0x9')][_0x4e005c[_0x4b92('0x26')]][_0x5b6546][_0x4b92('0x27')],_0x5b6546);this['channels'][_0x4e005c[_0x4b92('0x26')]][_0x5b6546]['agentcomplete']=!![];this['channels'][_0x4e005c[_0x4b92('0x26')]][_0x5b6546]['agentcompleteAt']=moment()['format'](_0x4b92('0x2e'));this[_0x4b92('0x9')][_0x4e005c[_0x4b92('0x26')]][_0x5b6546][_0x4b92('0x43')]=_0x4b92('0x62');this[_0x4b92('0x9')][_0x4e005c['uniqueid']][_0x5b6546][_0x4b92('0x51')]=_0x4e005c[_0x4b92('0x51')]==_0x4b92('0x63')?_0x4b92('0x64'):_0x4e005c[_0x4b92('0x51')];this[_0x4b92('0x9')][_0x4e005c[_0x4b92('0x26')]][_0x5b6546][_0x4b92('0x65')]=_0x4e005c[_0x4b92('0x65')];if(this[_0x4b92('0xb')][_0x4e005c[_0x4b92('0x30')]]&&this['voiceQueues'][_0x4e005c[_0x4b92('0x30')]][_0x4b92('0x66')]){this[_0x4b92('0x9')][_0x4e005c[_0x4b92('0x26')]][_0x5b6546][_0x4b92('0x67')]=this['voiceQueues'][_0x4e005c['queue']][_0x4b92('0x68')];this[_0x4b92('0x9')][_0x4e005c[_0x4b92('0x26')]][_0x5b6546][_0x4b92('0x69')]=!![];}this[_0x4b92('0xc')][_0x4e005c[_0x4b92('0x47')]]=_[_0x4b92('0x6a')](this[_0x4b92('0xc')][_0x4e005c[_0x4b92('0x47')]],['queue',_0x4b92('0x6b')]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x4e005c[_0x4b92('0x26')],util['inspect'](this[_0x4b92('0x9')][_0x4e005c[_0x4b92('0x26')]][_0x5b6546],{'showHidden':![],'depth':null}));ami['emit'](_0x4b92('0x6c'),this[_0x4b92('0x9')][_0x4e005c[_0x4b92('0x26')]][_0x5b6546]);logger[_0x4b92('0x28')](_0x4b92('0x6d'),_0x4e005c[_0x4b92('0x26')],util[_0x4b92('0x2a')]({'id':this['agents'][_0x4e005c[_0x4b92('0x47')]]['id'],'destaccountcode':_0x4e005c[_0x4b92('0x6e')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x4b92('0x2d')](_0x4b92('0x39'),_0x4e005c['membername']),_0x4b92('0x6f'),{'id':this[_0x4b92('0xc')][_0x4e005c[_0x4b92('0x47')]]['id'],'destaccountcode':_0x4e005c[_0x4b92('0x6e')]});}}}}}}catch(_0xd47279){logger[_0x4b92('0x3a')](_0x4b92('0x70'),_0x4e005c['uniqueid'],util[_0x4b92('0x2a')](_0xd47279,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4b92('0x21')][_0x4b92('0x17')]=function(_0x5366e6){try{if(this['isNotNull'](_0x5366e6)){logger[_0x4b92('0x28')](_0x4b92('0x71'),_0x5366e6[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x5366e6,{'showHidden':![],'depth':null}));this[_0x4b92('0x72')](_0x5366e6[_0x4b92('0x26')],_['keys'](_0x5366e6['variable'])[0x0],_0x5366e6['value']);if(this[_0x4b92('0x9')][_0x5366e6[_0x4b92('0x26')]]){for(var _0x4e2b09 in this[_0x4b92('0x9')][_0x5366e6['uniqueid']]){if(this['channels'][_0x5366e6[_0x4b92('0x26')]][_0x4b92('0x5a')](_0x4e2b09)){logger[_0x4b92('0x24')](_0x4b92('0x73'),_0x5366e6[_0x4b92('0x26')],_0x4e2b09,_[_0x4b92('0x74')](_0x5366e6['variable'])[0x0],_0x5366e6['value']);if(_[_0x4b92('0x2b')](this['channels'][_0x5366e6[_0x4b92('0x26')]][_0x4e2b09][_0x4b92('0x33')])){this['channels'][_0x5366e6[_0x4b92('0x26')]][_0x4e2b09][_0x4b92('0x33')]={};}this[_0x4b92('0x9')][_0x5366e6[_0x4b92('0x26')]][_0x4e2b09][_0x4b92('0x33')]=this[_0x4b92('0x33')][_0x5366e6['uniqueid']];}}}}}catch(_0x40f367){logger[_0x4b92('0x3a')]('[%s][voiceAgentReport][varset]',_0x5366e6[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x40f367,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4b92('0x21')][_0x4b92('0x72')]=function(_0x4ef19d,_0x5a5adf,_0x24faf5){var _0x1bdfbd=[_0x4b92('0x75'),_0x4b92('0x76'),_0x4b92('0x77'),_0x4b92('0x78'),_0x4b92('0x79'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x4b92('0x7a'),_0x4b92('0x7b'),_0x4b92('0x7c'),_0x4b92('0x7d'),_0x4b92('0x7e'),'membercalls','memberdynamic','memberinterface','memberlastcall',_0x4b92('0x27'),_0x4b92('0x7f'),_0x4b92('0x80')];if(!_['isNil'](_0x5a5adf)&&!_['includes'](_0x1bdfbd,_0x5a5adf)){if(_['isUndefined'](this['variables'][_0x4ef19d])){this[_0x4b92('0x33')][_0x4ef19d]={};}this[_0x4b92('0x33')][_0x4ef19d][_0x5a5adf]=_0x24faf5;}};VoiceAgentReport[_0x4b92('0x21')]['syncHangup']=function(_0x3ccf45){try{if(this[_0x4b92('0x23')](_0x3ccf45)){logger[_0x4b92('0x28')](_0x4b92('0x81'),_0x3ccf45['uniqueid'],util[_0x4b92('0x2a')](_0x3ccf45,{'showHidden':![],'depth':null}));if(this[_0x4b92('0x9')][_0x3ccf45['uniqueid']]){for(var _0x48e365 in this[_0x4b92('0x9')][_0x3ccf45[_0x4b92('0x26')]]){if(this[_0x4b92('0x9')][_0x3ccf45[_0x4b92('0x26')]][_0x4b92('0x5a')](_0x48e365)){if(this[_0x4b92('0x9')][_0x3ccf45[_0x4b92('0x26')]][_0x48e365]['reason']==_0x4b92('0x63')&&this[_0x4b92('0x9')][_0x3ccf45['uniqueid']][_0x48e365]['agentcomplete']){logger[_0x4b92('0x24')](_0x4b92('0x82'),_0x3ccf45[_0x4b92('0x26')],_0x48e365);this[_0x4b92('0x9')][_0x3ccf45[_0x4b92('0x26')]][_0x48e365]['agentcompleteAt']=moment()[_0x4b92('0x2d')](_0x4b92('0x2e'));}}}logger[_0x4b92('0x28')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x3ccf45['uniqueid'],util[_0x4b92('0x2a')](_[_0x4b92('0x83')](this[_0x4b92('0x9')][_0x3ccf45[_0x4b92('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x4b92('0x22')](_0x4b92('0x84'),_[_0x4b92('0x83')](this[_0x4b92('0x9')][_0x3ccf45[_0x4b92('0x26')]]));delete this[_0x4b92('0x9')][_0x3ccf45[_0x4b92('0x26')]];}if(this[_0x4b92('0x33')][_0x3ccf45[_0x4b92('0x26')]]){delete this[_0x4b92('0x33')][_0x3ccf45[_0x4b92('0x26')]];}}}catch(_0x2ace9d){logger[_0x4b92('0x3a')](_0x4b92('0x85'),_0x3ccf45[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x2ace9d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4b92('0x21')][_0x4b92('0x1e')]=function(_0x37b761){try{if(this[_0x4b92('0x23')](_0x37b761)){logger[_0x4b92('0x28')](_0x4b92('0x86'),_0x37b761[_0x4b92('0x26')],util['inspect'](_0x37b761,{'showHidden':![],'depth':null}));if(this['channels'][_0x37b761[_0x4b92('0x87')]]){for(var _0x27495f in this[_0x4b92('0x9')][_0x37b761[_0x4b92('0x87')]]){if(this[_0x4b92('0x9')][_0x37b761[_0x4b92('0x87')]][_0x4b92('0x5a')](_0x27495f)){if(_0x37b761[_0x4b92('0x88')]===_0x27495f){logger['info']('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x37b761['uniqueid'],this[_0x4b92('0x9')][_0x37b761['transfereeuniqueid']][_0x27495f][_0x4b92('0x27')],_0x27495f);var _0x4e6ae5=moment();this['channels'][_0x37b761[_0x4b92('0x87')]][_0x27495f][_0x4b92('0x16')]=!![];this[_0x4b92('0x9')][_0x37b761[_0x4b92('0x87')]][_0x27495f][_0x4b92('0x89')]=moment()[_0x4b92('0x2d')](_0x4b92('0x2e'));this[_0x4b92('0x9')][_0x37b761[_0x4b92('0x87')]][_0x27495f]['lastevent']=_0x4b92('0x62');this['channels'][_0x37b761[_0x4b92('0x87')]][_0x27495f][_0x4b92('0x51')]=_0x4b92('0x63');this[_0x4b92('0x9')][_0x37b761[_0x4b92('0x87')]][_0x27495f][_0x4b92('0x65')]=_0x4e6ae5[_0x4b92('0x8a')](this[_0x4b92('0x9')][_0x37b761['transfereeuniqueid']][_0x27495f]['agentconnectAt'],'seconds');}}}}if(this[_0x4b92('0x9')][_0x37b761[_0x4b92('0x8b')]]){var _0x3f7b1f=this['channels'][_0x37b761[_0x4b92('0x8b')]];this[_0x4b92('0x9')][_0x37b761['secondtransfereruniqueid']]=this['channels'][_0x37b761[_0x4b92('0x87')]];this[_0x4b92('0x9')][_0x37b761[_0x4b92('0x87')]]=_0x3f7b1f;}}}catch(_0x4ea686){logger[_0x4b92('0x3a')](_0x4b92('0x8c'),_0x37b761[_0x4b92('0x26')],util['inspect'](_0x4ea686,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4b92('0x21')][_0x4b92('0x20')]=function(_0x221c73){try{if(this[_0x4b92('0x23')](_0x221c73)){logger[_0x4b92('0x28')](_0x4b92('0x8d'),_0x221c73[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x221c73,{'showHidden':![],'depth':null}));if(this[_0x4b92('0x9')][_0x221c73[_0x4b92('0x87')]]){for(var _0x1b9dc4 in this[_0x4b92('0x9')][_0x221c73[_0x4b92('0x87')]]){if(this[_0x4b92('0x9')][_0x221c73[_0x4b92('0x87')]][_0x4b92('0x5a')](_0x1b9dc4)){if(_0x221c73['transfereruniqueid']===_0x1b9dc4){logger[_0x4b92('0x24')](_0x4b92('0x8e'),_0x221c73[_0x4b92('0x26')],this[_0x4b92('0x9')][_0x221c73[_0x4b92('0x87')]][_0x1b9dc4][_0x4b92('0x27')],_0x1b9dc4);var _0x465359=moment();this[_0x4b92('0x9')][_0x221c73[_0x4b92('0x87')]][_0x1b9dc4][_0x4b92('0x16')]=!![];this['channels'][_0x221c73['transfereeuniqueid']][_0x1b9dc4][_0x4b92('0x89')]=_0x465359;this[_0x4b92('0x9')][_0x221c73[_0x4b92('0x87')]][_0x1b9dc4][_0x4b92('0x43')]=_0x4b92('0x62');this['channels'][_0x221c73['transfereeuniqueid']][_0x1b9dc4][_0x4b92('0x51')]=_0x4b92('0x63');this[_0x4b92('0x9')][_0x221c73['transfereeuniqueid']][_0x1b9dc4]['talktime']=_0x465359[_0x4b92('0x8a')](this[_0x4b92('0x9')][_0x221c73['transfereeuniqueid']][_0x1b9dc4][_0x4b92('0x3d')],_0x4b92('0x8f'));}}}}}}catch(_0x102c23){logger['error'](_0x4b92('0x90'),_0x221c73[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x102c23,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4b92('0x21')]['syncMusicOnHoldStart']=function(_0x502757){var _0x4f842c='';try{if(this[_0x4b92('0x23')](_0x502757)){logger['debug'](_0x4b92('0x91'),_0x502757['uniqueid'],util['inspect'](_0x502757,{'showHidden':![],'depth':null}));if(_0x502757[_0x4b92('0x92')]){_0x4f842c=_0x502757[_0x4b92('0x92')][_0x4b92('0x93')](0x0,_0x502757[_0x4b92('0x92')]['lastIndexOf']('-'));if(this[_0x4b92('0xc')][_0x4f842c]){logger[_0x4b92('0x24')](_0x4b92('0x94'),_0x502757['uniqueid'],_0x4f842c);this[_0x4b92('0xc')][_0x4f842c][_0x4b92('0x95')]=!![];}}}}catch(_0x51017c){logger[_0x4b92('0x3a')](_0x4b92('0x96'),_0x502757[_0x4b92('0x26')],util['inspect'](_0x51017c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4b92('0x1c')]=function(_0x69977){var _0x2d4935='';try{if(this[_0x4b92('0x23')](_0x69977)){logger[_0x4b92('0x28')](_0x4b92('0x97'),_0x69977[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x69977,{'showHidden':![],'depth':null}));if(_0x69977[_0x4b92('0x92')]){_0x2d4935=_0x69977[_0x4b92('0x92')][_0x4b92('0x93')](0x0,_0x69977['channel']['lastIndexOf']('-'));if(this[_0x4b92('0xc')][_0x2d4935]){logger['info']('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x69977[_0x4b92('0x26')],_0x2d4935);this[_0x4b92('0xc')][_0x2d4935][_0x4b92('0x95')]=![];}}}}catch(_0x15a622){logger['error'](_0x4b92('0x98'),_0x69977[_0x4b92('0x26')],util[_0x4b92('0x2a')](_0x15a622,{'showHidden':![],'depth':null}));}};module[_0x4b92('0x99')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 0a50ef7..94b986d 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 _0x66a0=['[%s][voiceCallReport][musiconholdstart]','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','util','path','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','localhost','redis','channels','agents','blindTransfers','coreshowchannel','newexten','syncNewExten','newchannel','syncNewChannel','bind','newstate','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','connectedlinenum','name','user:agentconnect','error','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','disposition','toNumber','channelstate','merge','destconnectedlinenum','accountcode','format','user:%s','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','appdata','startsWith','CDR(routeAlias)','applicationdata','toLowerCase','duration','subtract','seconds','includes','lastapplication','match','type','isNil','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','destinationchannel','UserId','membername','YYYY-MM-DD\x20HH:mm:ss','routealias','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','[%s][voiceCallReport][varset]','answertime','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','then','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfereeuniqueid','transfercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','outbound','routeid','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s'];(function(_0xdb3369,_0x6e1a62){var _0x4c5e17=function(_0x4bf71d){while(--_0x4bf71d){_0xdb3369['push'](_0xdb3369['shift']());}};_0x4c5e17(++_0x6e1a62);}(_0x66a0,0x18f));var _0x066a=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0x66a0[_0x1399d6];return _0x4a9db4;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x066a('0x0'));var path=require(_0x066a('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x066a('0x2'))(_0x066a('0x3'));var ami=require(_0x066a('0x4'));var Channel=require(_0x066a('0x5'));var RpcSetting=require(_0x066a('0x6'));var applications=[_0x066a('0x7'),_0x066a('0x8'),_0x066a('0x9'),_0x066a('0xa'),_0x066a('0xb'),_0x066a('0xc')];var dispositions=[_0x066a('0xd'),_0x066a('0xe'),_0x066a('0xe'),_0x066a('0xd'),_0x066a('0xd'),'NO\x20ANSWER',_0x066a('0xf'),_0x066a('0x10'),'FAILED',_0x066a('0xe'),_0x066a('0xe')];config['redis']=_['defaults'](config['redis'],{'host':_0x066a('0x11'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x066a('0x12')]));function VoiceCallReport(_0x3d953d){this[_0x066a('0x13')]=_0x3d953d[_0x066a('0x13')];this[_0x066a('0x14')]=_0x3d953d['agents'];this[_0x066a('0x15')]={};ami['on'](_0x066a('0x16'),this['syncNewExten']['bind'](this));ami['on'](_0x066a('0x17'),this[_0x066a('0x18')]['bind'](this));ami['on'](_0x066a('0x19'),this[_0x066a('0x1a')][_0x066a('0x1b')](this));ami['on'](_0x066a('0x1c'),this['syncNewState']['bind'](this));ami['on'](_0x066a('0x1d'),this[_0x066a('0x1e')]['bind'](this));ami['on']('hangup',this[_0x066a('0x1f')][_0x066a('0x1b')](this));ami['on'](_0x066a('0x20'),this[_0x066a('0x21')]['bind'](this));ami['on']('attendedtransfer',this[_0x066a('0x22')]['bind'](this));ami['on'](_0x066a('0x23'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x066a('0x24'),this['syncMusicOnHoldStart'][_0x066a('0x1b')](this));ami['on'](_0x066a('0x25'),this[_0x066a('0x26')]['bind'](this));try{logger['info'](_0x066a('0x27'));ami['actionCoreShowChannels']();}catch(_0x5f3f3a){logger['error'](_0x066a('0x28'),util[_0x066a('0x29')](_0x5f3f3a,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x066a('0x2a')][_0x066a('0x2b')]=function(_0x525b76){return _0x525b76!==null&&!_[_0x066a('0x2c')](_0x525b76);};VoiceCallReport[_0x066a('0x2a')][_0x066a('0x2d')]=function(_0x399118,_0x391597,_0x3fb7ad){io['to'](_0x399118)[_0x066a('0x2d')](_0x391597,_0x3fb7ad);};VoiceCallReport[_0x066a('0x2a')][_0x066a('0x21')]=function(_0xb25e8d){try{if(this[_0x066a('0x2b')](_0xb25e8d)){logger[_0x066a('0x2e')](_0x066a('0x2f'),_0xb25e8d['uniqueid'],_0xb25e8d[_0x066a('0x30')],_0xb25e8d['calleridnum']);logger[_0x066a('0x31')](_0x066a('0x32'),_0xb25e8d[_0x066a('0x33')],util[_0x066a('0x29')](_0xb25e8d,{'showHidden':![],'depth':null}));if(_0xb25e8d[_0x066a('0x33')]===_0xb25e8d[_0x066a('0x34')]){if(!_[_0x066a('0x2c')](this[_0x066a('0x13')][_0xb25e8d[_0x066a('0x33')]])){_['merge'](this[_0x066a('0x13')][_0xb25e8d['uniqueid']],_[_0x066a('0x35')](_0xb25e8d,_[_0x066a('0x36')](this['channels'][_0xb25e8d[_0x066a('0x33')]])));}}if(_0xb25e8d[_0x066a('0x37')]===_0x066a('0x38')){if(this['agents'][_0xb25e8d[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]]){if(_0xb25e8d[_0x066a('0x3b')]==_0x066a('0x3c')){this[_0x066a('0x14')][_0xb25e8d[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]]['destconnectedlinenum']=_0xb25e8d[_0x066a('0x3d')];this[_0x066a('0x2d')](util['format']('user:%s',this[_0x066a('0x14')][_0xb25e8d['channel'][_0x066a('0x3a')]('-')[0x0]][_0x066a('0x3e')]),_0x066a('0x3f'),{'destaccountcode':this[_0x066a('0x14')][_0xb25e8d[_0x066a('0x39')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0xb25e8d[_0x066a('0x3d')]});}}}}}catch(_0x34f45b){logger[_0x066a('0x40')]('[%s][voiceCallReport][newcallerid]',_0xb25e8d[_0x066a('0x33')],util[_0x066a('0x29')](_0x34f45b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x066a('0x2a')][_0x066a('0x1a')]=function(_0xe858ea){try{if(this['isNotNull'](_0xe858ea)){logger[_0x066a('0x31')](_0x066a('0x41'),_0xe858ea['uniqueid'],util[_0x066a('0x29')](_0xe858ea,{'showHidden':![],'depth':null}));if(this[_0x066a('0x13')][_0xe858ea[_0x066a('0x33')]])return;if(_0xe858ea[_0x066a('0x39')]===_0x066a('0x42'))return;if(_0xe858ea[_0x066a('0x33')]!==_0xe858ea[_0x066a('0x34')]&&!this[_0x066a('0x15')][_0xe858ea['linkedid']])return;logger[_0x066a('0x2e')](_0x066a('0x43'),_0xe858ea[_0x066a('0x33')],_0xe858ea[_0x066a('0x37')],_0xe858ea['exten']);this[_0x066a('0x13')][_0xe858ea[_0x066a('0x33')]]=new Channel();this[_0x066a('0x13')][_0xe858ea[_0x066a('0x33')]][_0x066a('0x44')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x066a('0x13')][_0xe858ea['uniqueid']][_0x066a('0x45')]=dispositions[_[_0x066a('0x46')](_0xe858ea[_0x066a('0x47')])];_[_0x066a('0x48')](this[_0x066a('0x13')][_0xe858ea[_0x066a('0x33')]],_['pick'](_0xe858ea,_[_0x066a('0x36')](this[_0x066a('0x13')][_0xe858ea[_0x066a('0x33')]])));if(_0xe858ea['context']===_0x066a('0x38')){if(this[_0x066a('0x14')][_0xe858ea[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]]){if(_[_0x066a('0x2c')](this[_0x066a('0x14')][_0xe858ea[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]][_0x066a('0x49')])){this['agents'][_0xe858ea['channel']['split']('-')[0x0]][_0x066a('0x49')]=_0xe858ea[_0x066a('0x3b')];logger[_0x066a('0x31')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0xe858ea[_0x066a('0x33')],util[_0x066a('0x29')]({'id':this['agents'][_0xe858ea[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x066a('0x14')][_0xe858ea[_0x066a('0x39')]['split']('-')[0x0]][_0x066a('0x4a')],'destconnectedlinenum':_0xe858ea[_0x066a('0x3b')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x066a('0x4b')](_0x066a('0x4c'),this['agents'][_0xe858ea['channel'][_0x066a('0x3a')]('-')[0x0]][_0x066a('0x3e')]),_0x066a('0x3f'),{'id':this['agents'][_0xe858ea['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0x066a('0x14')][_0xe858ea[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0xe858ea[_0x066a('0x3b')]});}}}}}catch(_0xc32b96){logger['error'](_0x066a('0x4d'),_0xe858ea['uniqueid'],util[_0x066a('0x29')](_0xc32b96,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x066a('0x2a')][_0x066a('0x18')]=function(_0x4e4ed9){try{if(this[_0x066a('0x2b')](_0x4e4ed9)){logger['debug'](_0x066a('0x4e'),_0x4e4ed9[_0x066a('0x33')],util[_0x066a('0x29')](_0x4e4ed9,{'showHidden':![],'depth':null}));if(_0x4e4ed9[_0x066a('0x39')]===_0x066a('0x42')||_0x4e4ed9[_0x066a('0x3b')]==='h')return;if(_0x4e4ed9[_0x066a('0x33')]===_0x4e4ed9[_0x066a('0x34')]||this['blindTransfers'][_0x4e4ed9['linkedid']]){_0x4e4ed9[_0x066a('0x4f')]=_0x4e4ed9[_0x066a('0x4f')]['toLowerCase']();_0x4e4ed9['applicationdata']=_0x4e4ed9[_0x066a('0x50')]||_0x4e4ed9['applicationdata'];if(_0x4e4ed9[_0x066a('0x50')]&&!_0x4e4ed9[_0x066a('0x50')][_0x066a('0x51')](_0x066a('0x52'))&&_0x4e4ed9[_0x066a('0x4f')]!=='queue'){_0x4e4ed9[_0x066a('0x53')]=_0x4e4ed9[_0x066a('0x53')][_0x066a('0x54')]();}logger[_0x066a('0x2e')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x4e4ed9['uniqueid'],_0x4e4ed9[_0x066a('0x4f')],_0x4e4ed9[_0x066a('0x53')]);if(_['isUndefined'](this[_0x066a('0x13')][_0x4e4ed9[_0x066a('0x33')]])){this['channels'][_0x4e4ed9['uniqueid']]=new Channel();this[_0x066a('0x13')][_0x4e4ed9['uniqueid']]['starttime']=_0x4e4ed9[_0x066a('0x55')]?moment()[_0x066a('0x56')](moment['duration'](_0x4e4ed9['duration'])[_0x066a('0x57')](),'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x066a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x066a('0x13')][_0x4e4ed9['uniqueid']]['disposition']='NO\x20ANSWER';}_[_0x066a('0x48')](this[_0x066a('0x13')][_0x4e4ed9[_0x066a('0x33')]],_[_0x066a('0x35')](_0x4e4ed9,_[_0x066a('0x36')](this['channels'][_0x4e4ed9[_0x066a('0x33')]])));if(_[_0x066a('0x58')](applications,_0x4e4ed9[_0x066a('0x4f')])){this[_0x066a('0x13')][_0x4e4ed9[_0x066a('0x33')]][_0x066a('0x59')]=_0x4e4ed9[_0x066a('0x4f')];this['channels'][_0x4e4ed9[_0x066a('0x33')]]['lastdata']=_0x4e4ed9[_0x066a('0x53')];if(_0x4e4ed9['application']===_0x066a('0x7')&&_['startsWith'](_0x4e4ed9[_0x066a('0x53')][_0x066a('0x54')](),'cdr(')){var _0x2c13b0=_0x4e4ed9['applicationdata'][_0x066a('0x3a')]('=');var _0x468ddd=_0x2c13b0[0x0][_0x066a('0x54')]()[_0x066a('0x5a')](/cdr\((.*)\)/);if(_0x468ddd){if(_0x468ddd[0x1]===_0x066a('0x5b')&&!_[_0x066a('0x5c')](this[_0x066a('0x13')][_0x4e4ed9[_0x066a('0x33')]][_0x468ddd[0x1]]))return;this[_0x066a('0x13')][_0x4e4ed9[_0x066a('0x33')]][_0x468ddd[0x1]]=_0x2c13b0[0x1];}}else if(_0x4e4ed9[_0x066a('0x4f')]===_0x066a('0x8')){this[_0x066a('0x13')][_0x4e4ed9[_0x066a('0x33')]]['queue']=_0x4e4ed9[_0x066a('0x53')][_0x066a('0x3a')](',')[0x0];}}}}}catch(_0x119355){logger[_0x066a('0x40')]('[%s][voiceCallReport][newexten]',_0x4e4ed9[_0x066a('0x33')],util[_0x066a('0x29')](_0x119355,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x066a('0x5d')]=function(_0x51e48f){try{if(this['isNotNull'](_0x51e48f)){logger[_0x066a('0x2e')](_0x066a('0x5e'),_0x51e48f[_0x066a('0x33')],_0x51e48f[_0x066a('0x34')],_0x51e48f[_0x066a('0x30')],_0x51e48f[_0x066a('0x5f')]);logger[_0x066a('0x31')](_0x066a('0x60'),_0x51e48f['uniqueid'],util['inspect'](_0x51e48f,{'showHidden':![],'depth':null}));if(_0x51e48f[_0x066a('0x47')]!=='6')return;if(_0x51e48f[_0x066a('0x33')]!==_0x51e48f[_0x066a('0x34')]){var _0x2930b1=moment();if(this['channels'][_0x51e48f[_0x066a('0x34')]]){if(!this['channels'][_0x51e48f['linkedid']][_0x066a('0x61')]){this[_0x066a('0x13')][_0x51e48f[_0x066a('0x34')]][_0x066a('0x61')]=!![];this[_0x066a('0x13')][_0x51e48f['linkedid']]['answertime']=_0x2930b1[_0x066a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x066a('0x13')][_0x51e48f[_0x066a('0x34')]]['starttime']){this[_0x066a('0x13')][_0x51e48f['linkedid']][_0x066a('0x62')]=_0x2930b1[_0x066a('0x63')](this[_0x066a('0x13')][_0x51e48f['linkedid']][_0x066a('0x44')],_0x066a('0x57'));}}this[_0x066a('0x13')][_0x51e48f[_0x066a('0x34')]][_0x066a('0x34')]=_0x51e48f[_0x066a('0x33')];if(_0x51e48f['calleridnum']!==_0x066a('0x3c')){this['channels'][_0x51e48f[_0x066a('0x34')]][_0x066a('0x3d')]=_0x51e48f[_0x066a('0x5f')];}this[_0x066a('0x13')][_0x51e48f['linkedid']]['connectedlinename']=_0x51e48f[_0x066a('0x30')];this[_0x066a('0x13')][_0x51e48f[_0x066a('0x34')]][_0x066a('0x64')]=_0x51e48f[_0x066a('0x39')];this[_0x066a('0x13')][_0x51e48f['linkedid']]['disposition']=dispositions[_[_0x066a('0x46')](_0x51e48f[_0x066a('0x47')])];if(this[_0x066a('0x14')][_0x51e48f['channel']['split']('-')[0x0]]){this[_0x066a('0x13')][_0x51e48f['linkedid']][_0x066a('0x65')]=this[_0x066a('0x14')][_0x51e48f[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]]['id'];this[_0x066a('0x13')][_0x51e48f[_0x066a('0x34')]][_0x066a('0x66')]=this[_0x066a('0x14')][_0x51e48f[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]][_0x066a('0x3e')];}}if(this[_0x066a('0x13')][_0x51e48f[_0x066a('0x33')]]){if(!this[_0x066a('0x13')][_0x51e48f[_0x066a('0x33')]][_0x066a('0x61')]){this['channels'][_0x51e48f[_0x066a('0x33')]][_0x066a('0x61')]=!![];this[_0x066a('0x13')][_0x51e48f[_0x066a('0x33')]]['answertime']=_0x2930b1['format'](_0x066a('0x67'));if(this[_0x066a('0x13')][_0x51e48f['uniqueid']][_0x066a('0x44')]){this[_0x066a('0x13')][_0x51e48f[_0x066a('0x33')]][_0x066a('0x62')]=_0x2930b1[_0x066a('0x63')](this['channels'][_0x51e48f[_0x066a('0x33')]][_0x066a('0x44')],'seconds');}}if(_0x51e48f[_0x066a('0x5f')]!==_0x066a('0x3c')){this['channels'][_0x51e48f[_0x066a('0x33')]][_0x066a('0x3d')]=_0x51e48f[_0x066a('0x5f')];}this[_0x066a('0x13')][_0x51e48f['uniqueid']]['connectedlinename']=_0x51e48f[_0x066a('0x30')];this[_0x066a('0x13')][_0x51e48f['uniqueid']][_0x066a('0x64')]=_0x51e48f[_0x066a('0x39')];this[_0x066a('0x13')][_0x51e48f['uniqueid']]['disposition']=dispositions[_[_0x066a('0x46')](_0x51e48f['channelstate'])];}}else{if(this[_0x066a('0x13')][_0x51e48f['uniqueid']]){if(this[_0x066a('0x14')][_0x51e48f[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]]){this[_0x066a('0x13')][_0x51e48f[_0x066a('0x33')]][_0x066a('0x65')]=this[_0x066a('0x14')][_0x51e48f['channel'][_0x066a('0x3a')]('-')[0x0]]['id'];this[_0x066a('0x13')][_0x51e48f['uniqueid']][_0x066a('0x66')]=this[_0x066a('0x14')][_0x51e48f[_0x066a('0x39')]['split']('-')[0x0]][_0x066a('0x3e')];}}}if(_0x51e48f[_0x066a('0x37')]===_0x066a('0x38')){if(this[_0x066a('0x14')][_0x51e48f[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]]){this[_0x066a('0x14')][_0x51e48f[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]]['destconnectedlinenum']=_0x51e48f[_0x066a('0x3b')];var _0x500720,_0x2df15a;if(this[_0x066a('0x13')][_0x51e48f[_0x066a('0x33')]]){_0x500720=this[_0x066a('0x13')][_0x51e48f['uniqueid']]['routealias'];_0x2df15a=this['channels'][_0x51e48f[_0x066a('0x33')]][_0x066a('0x8')];}else if(this[_0x066a('0x13')][_0x51e48f['linkedid']]){_0x500720=this[_0x066a('0x13')][_0x51e48f[_0x066a('0x34')]][_0x066a('0x68')];_0x2df15a=this['channels'][_0x51e48f[_0x066a('0x34')]][_0x066a('0x8')];}this['agents'][_0x51e48f[_0x066a('0x39')]['split']('-')[0x0]]['queue']=_0x2df15a;this[_0x066a('0x14')][_0x51e48f[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]][_0x066a('0x68')]=_0x500720;logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x51e48f['uniqueid'],util['inspect']({'id':this[_0x066a('0x14')][_0x51e48f[_0x066a('0x39')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x066a('0x14')][_0x51e48f[_0x066a('0x39')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x51e48f[_0x066a('0x3b')],'routealias':_0x500720,'queue':_0x2df15a||undefined},{'showHidden':![],'depth':null}));this[_0x066a('0x2d')](util[_0x066a('0x4b')](_0x066a('0x4c'),this['agents'][_0x51e48f[_0x066a('0x39')]['split']('-')[0x0]][_0x066a('0x3e')]),_0x066a('0x3f'),{'id':this[_0x066a('0x14')][_0x51e48f[_0x066a('0x39')]['split']('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this['agents'][_0x51e48f[_0x066a('0x39')]['split']('-')[0x0]][_0x066a('0x4a')],'destconnectedlinenum':_0x51e48f[_0x066a('0x3b')],'routealias':_0x500720,'queue':_0x2df15a||undefined});}}}}catch(_0x546150){logger[_0x066a('0x40')]('[%s][voiceCallReport][newstate]',_0x51e48f[_0x066a('0x33')],util[_0x066a('0x29')](_0x546150,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x066a('0x2a')][_0x066a('0x69')]=function(_0x5bca64,_0x468401){try{if(this[_0x066a('0x13')][_0x5bca64]){logger[_0x066a('0x2e')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x5bca64,_0x468401);this[_0x066a('0x13')][_0x5bca64][_0x066a('0x6a')]=!![];if(_[_0x066a('0x6b')](_0x468401,_0x066a('0x6c'))){_0x468401=_0x468401[_0x066a('0x6d')]('.wav49','.WAV');}this[_0x066a('0x13')][_0x5bca64][_0x066a('0x6e')]=_0x468401;var _0x35cc16=_[_0x066a('0x6f')](this[_0x066a('0x13')][_0x5bca64][_0x066a('0x70')],{'filename':_0x468401});if(_[_0x066a('0x5c')](_0x35cc16)){this[_0x066a('0x13')][_0x5bca64][_0x066a('0x70')][_0x066a('0x71')]({'filename':_0x468401,'createdAt':moment()[_0x066a('0x4b')](_0x066a('0x67')),'mixmonitorid':'','status':_0x066a('0x72')});}}}catch(_0x40c1c){logger[_0x066a('0x40')](_0x066a('0x73'),_0x5bca64,util['inspect'](_0x40c1c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x066a('0x2a')]['syncVarSet']=function(_0x40627e){try{if(this[_0x066a('0x2b')](_0x40627e)){logger[_0x066a('0x31')](_0x066a('0x74'),_0x40627e[_0x066a('0x33')],util[_0x066a('0x29')](_0x40627e,{'showHidden':![],'depth':null}));if(this[_0x066a('0x13')][_0x40627e[_0x066a('0x33')]]&&_0x40627e['channel']!=_0x066a('0x42')){if(this['isNotNull'](_0x40627e['variable'])){if(this[_0x066a('0x2b')](_0x40627e[_0x066a('0x75')][_0x066a('0x76')])){logger[_0x066a('0x2e')](_0x066a('0x77'),_0x40627e[_0x066a('0x33')],_0x40627e[_0x066a('0x78')]);this[_0x066a('0x69')](_0x40627e['uniqueid'],_0x40627e[_0x066a('0x78')]);}else if(this['isNotNull'](_0x40627e[_0x066a('0x75')][_0x066a('0x79')])){logger['info'](_0x066a('0x7a'),_0x40627e[_0x066a('0x33')],_0x40627e[_0x066a('0x78')]);this['channels'][_0x40627e[_0x066a('0x33')]][_0x066a('0x5f')]=_0x40627e[_0x066a('0x78')];}else if(this[_0x066a('0x2b')](_0x40627e[_0x066a('0x75')][_0x066a('0x7b')])){logger[_0x066a('0x2e')](_0x066a('0x7c'),_0x40627e[_0x066a('0x33')],_0x40627e[_0x066a('0x78')]);this[_0x066a('0x13')][_0x40627e[_0x066a('0x33')]][_0x066a('0x7d')]=_0x40627e[_0x066a('0x78')];}else if(this[_0x066a('0x2b')](_0x40627e[_0x066a('0x75')][_0x066a('0x7e')])){logger[_0x066a('0x2e')](_0x066a('0x7f'),_0x40627e[_0x066a('0x33')],_0x40627e[_0x066a('0x78')]);this['channels'][_0x40627e[_0x066a('0x33')]][_0x066a('0x5b')]=_0x40627e[_0x066a('0x78')];}else if(this['isNotNull'](_0x40627e[_0x066a('0x75')][_0x066a('0x80')])){logger[_0x066a('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x40627e[_0x066a('0x33')],_0x40627e[_0x066a('0x78')]['split'](',')[0x0]);this['channels'][_0x40627e[_0x066a('0x33')]]['queue']=_0x40627e[_0x066a('0x78')][_0x066a('0x3a')](',')[0x0];}else if(this[_0x066a('0x2b')](_0x40627e[_0x066a('0x75')]['xmd-originatecalleridnum'])){logger['info'](_0x066a('0x81'),_0x40627e[_0x066a('0x33')],_0x40627e['value']);this[_0x066a('0x13')][_0x40627e[_0x066a('0x33')]][_0x066a('0x82')]=_0x40627e[_0x066a('0x78')];}else if(this[_0x066a('0x2b')](_0x40627e[_0x066a('0x75')][_0x066a('0x83')])){logger['info'](_0x066a('0x84'),_0x40627e[_0x066a('0x33')],_0x40627e[_0x066a('0x78')]);this[_0x066a('0x13')][_0x40627e[_0x066a('0x33')]][_0x066a('0x85')]=_0x40627e[_0x066a('0x78')];}else if(this[_0x066a('0x2b')](_0x40627e['variable']['xmd-callerid-preview'])){logger[_0x066a('0x2e')](_0x066a('0x86'),_0x40627e[_0x066a('0x33')],_0x40627e[_0x066a('0x78')]);this['channels'][_0x40627e[_0x066a('0x33')]][_0x066a('0x87')]=_0x40627e[_0x066a('0x78')];}else if(this[_0x066a('0x2b')](_0x40627e['variable']['xmcs-queue'])){logger[_0x066a('0x2e')](_0x066a('0x88'),_0x40627e['uniqueid'],_0x40627e[_0x066a('0x78')]);this['channels'][_0x40627e['uniqueid']][_0x066a('0x8')]=_0x40627e[_0x066a('0x78')];}else if(this[_0x066a('0x2b')](_0x40627e[_0x066a('0x75')][_0x066a('0x89')])){logger[_0x066a('0x2e')](_0x066a('0x8a'),_0x40627e[_0x066a('0x33')],_0x40627e['value']);this[_0x066a('0x13')][_0x40627e['uniqueid']]['sipcalluniqueid']=_0x40627e[_0x066a('0x78')];}}}else if(this[_0x066a('0x2b')](_0x40627e[_0x066a('0x75')][_0x066a('0x76')])){if(_0x40627e['value']){var _0x4115e0=path['parse'](_0x40627e['value'])[_0x066a('0x3e')];logger[_0x066a('0x2e')](_0x066a('0x77'),_0x4115e0,_0x40627e[_0x066a('0x78')]);this['syncMixMonitorFilename'](_0x4115e0,_0x40627e['value']);}}else if(this[_0x066a('0x13')][_0x40627e['linkedid']]){if(this[_0x066a('0x2b')](_0x40627e[_0x066a('0x75')])){if(this['isNotNull'](_0x40627e[_0x066a('0x75')][_0x066a('0x89')])){logger[_0x066a('0x2e')](_0x066a('0x8a'),_0x40627e[_0x066a('0x34')],_0x40627e[_0x066a('0x78')]);this[_0x066a('0x13')][_0x40627e[_0x066a('0x34')]]['sipcalllinkedid']=_0x40627e[_0x066a('0x78')];}}}}}catch(_0x18efbc){logger[_0x066a('0x40')](_0x066a('0x8b'),_0x40627e['uniqueid'],util[_0x066a('0x29')](_0x18efbc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x066a('0x2a')][_0x066a('0x1f')]=function(_0x1e6ceb){try{if(this[_0x066a('0x2b')](_0x1e6ceb)){logger[_0x066a('0x31')]('[%s][voiceCallReport][hangup]\x20event:',_0x1e6ceb['uniqueid'],util[_0x066a('0x29')](_0x1e6ceb,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x1e6ceb[_0x066a('0x34')]]){if(this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb[_0x066a('0x34')]]['linkedid']]){this[_0x066a('0x13')][this['blindTransfers'][_0x1e6ceb[_0x066a('0x34')]][_0x066a('0x34')]]['uniqueid']=_0x1e6ceb[_0x066a('0x33')];this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb[_0x066a('0x34')]][_0x066a('0x34')]]['answered']=this[_0x066a('0x13')][_0x1e6ceb[_0x066a('0x33')]][_0x066a('0x61')];this[_0x066a('0x13')][this['blindTransfers'][_0x1e6ceb[_0x066a('0x34')]][_0x066a('0x34')]][_0x066a('0x8c')]=this[_0x066a('0x13')][_0x1e6ceb[_0x066a('0x33')]][_0x066a('0x8c')];this['channels'][this['blindTransfers'][_0x1e6ceb['linkedid']][_0x066a('0x34')]]['destinationchannel']=this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb['linkedid']][_0x066a('0x34')]][_0x066a('0x39')];this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb['linkedid']][_0x066a('0x34')]][_0x066a('0x45')]=this[_0x066a('0x13')][_0x1e6ceb[_0x066a('0x33')]]['disposition'];this[_0x066a('0x13')][_0x1e6ceb[_0x066a('0x33')]]=this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb[_0x066a('0x34')]]['linkedid']];delete this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb['linkedid']]['linkedid']];}else if(this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb[_0x066a('0x34')]][_0x066a('0x33')]]){this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb[_0x066a('0x34')]][_0x066a('0x33')]]['uniqueid']=[this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb[_0x066a('0x34')]][_0x066a('0x33')]][_0x066a('0x34')],this[_0x066a('0x13')][this['blindTransfers'][_0x1e6ceb[_0x066a('0x34')]][_0x066a('0x33')]][_0x066a('0x34')]=this['channels'][this[_0x066a('0x15')][_0x1e6ceb['linkedid']][_0x066a('0x33')]]['uniqueid']][0x0];this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb[_0x066a('0x34')]][_0x066a('0x33')]][_0x066a('0x61')]=this[_0x066a('0x13')][_0x1e6ceb[_0x066a('0x33')]][_0x066a('0x61')];this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb[_0x066a('0x34')]]['uniqueid']][_0x066a('0x8c')]=this[_0x066a('0x13')][_0x1e6ceb[_0x066a('0x33')]]['answertime'];this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb[_0x066a('0x34')]]['uniqueid']][_0x066a('0x64')]=this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb[_0x066a('0x34')]][_0x066a('0x33')]][_0x066a('0x39')];this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb['linkedid']]['uniqueid']][_0x066a('0x45')]=this[_0x066a('0x13')][_0x1e6ceb['uniqueid']]['disposition'];this['channels'][_0x1e6ceb[_0x066a('0x33')]]=this[_0x066a('0x13')][this['blindTransfers'][_0x1e6ceb['linkedid']][_0x066a('0x33')]];delete this[_0x066a('0x13')][this[_0x066a('0x15')][_0x1e6ceb[_0x066a('0x34')]][_0x066a('0x33')]];}}if(this[_0x066a('0x13')][_0x1e6ceb[_0x066a('0x33')]]){logger[_0x066a('0x2e')](_0x066a('0x8d'),_0x1e6ceb[_0x066a('0x33')],_0x1e6ceb[_0x066a('0x8e')]);var _0x5b40de=moment();this[_0x066a('0x13')][_0x1e6ceb['uniqueid']][_0x066a('0x8f')]=_0x5b40de['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x066a('0x13')][_0x1e6ceb[_0x066a('0x33')]][_0x066a('0x55')]=_0x5b40de['diff'](this[_0x066a('0x13')][_0x1e6ceb[_0x066a('0x33')]][_0x066a('0x44')],_0x066a('0x57'));if(this[_0x066a('0x13')][_0x1e6ceb[_0x066a('0x33')]]['answered']){this[_0x066a('0x13')][_0x1e6ceb['uniqueid']][_0x066a('0x90')]=_0x5b40de[_0x066a('0x63')](this['channels'][_0x1e6ceb[_0x066a('0x33')]][_0x066a('0x8c')],_0x066a('0x57'));this[_0x066a('0x13')][_0x1e6ceb['uniqueid']][_0x066a('0x62')]=this[_0x066a('0x13')][_0x1e6ceb[_0x066a('0x33')]][_0x066a('0x55')]-this[_0x066a('0x13')][_0x1e6ceb[_0x066a('0x33')]][_0x066a('0x90')];}if(_0x1e6ceb['context']===_0x066a('0x38')){if(this[_0x066a('0x14')][_0x1e6ceb[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]]){this[_0x066a('0x14')][_0x1e6ceb['channel']['split']('-')[0x0]]=_[_0x066a('0x91')](this[_0x066a('0x14')][_0x1e6ceb[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]],['destconnectedlinenum']);logger[_0x066a('0x31')](_0x066a('0x92'),_0x1e6ceb['uniqueid'],util['inspect']({'id':this['agents'][_0x1e6ceb['channel'][_0x066a('0x3a')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x1e6ceb[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x066a('0x2d')](util[_0x066a('0x4b')](_0x066a('0x4c'),this[_0x066a('0x14')][_0x1e6ceb[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]][_0x066a('0x3e')]),_0x066a('0x93'),{'id':this['agents'][_0x1e6ceb[_0x066a('0x39')][_0x066a('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x066a('0x14')][_0x1e6ceb[_0x066a('0x39')]['split']('-')[0x0]]['accountcode']});for(var _0x403469=0x0;_0x4034690x0?_0x54d2d5:0x0;this['voiceQueues'][_0x47fa64['queue']][_0xfbe5('0x34')]=this[_0xfbe5('0x14')][_0x47fa64[_0xfbe5('0x70')]][_0xfbe5('0x34')]>_[_0xfbe5('0x74')](_0x47fa64[_0xfbe5('0x75')])?_['toNumber'](_0x47fa64[_0xfbe5('0x75')]):this[_0xfbe5('0x14')][_0x47fa64[_0xfbe5('0x70')]][_0xfbe5('0x34')];this[_0xfbe5('0x57')](this[_0xfbe5('0x14')][_0x47fa64[_0xfbe5('0x70')]],'queuesummary');}logger['debug'](_0xfbe5('0x76'),util['inspect'](this[_0xfbe5('0x14')][_0x47fa64['queue']],{'showHidden':![],'depth':null}));ami[_0xfbe5('0x49')](_0xfbe5('0x77'),this['voiceQueues'][_0x47fa64[_0xfbe5('0x70')]]);}}}catch(_0x47c629){logger['error']('[voiceQueueReport][queuesummary]',util['inspect'](_0x47c629,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbe5('0xb')][_0xfbe5('0x19')]=function(_0x4dd357){logger[_0xfbe5('0x4b')](_0xfbe5('0x78'),util[_0xfbe5('0x41')](_0x4dd357,{'showHidden':![],'depth':null}));ami[_0xfbe5('0x49')](_0xfbe5('0x79'),{});this[_0xfbe5('0x6c')]=!![];};VoiceQueueReport[_0xfbe5('0xb')]['syncQueueCallerJoin']=function(_0x1dc22a){try{if(this[_0xfbe5('0x6f')](_0x1dc22a)){logger[_0xfbe5('0x4b')](_0xfbe5('0x7a'),_0x1dc22a[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x1dc22a,{'showHidden':![],'depth':null}));if(_[_0xfbe5('0x68')](this[_0xfbe5('0x10')][_0x1dc22a[_0xfbe5('0x4e')]]))this[_0xfbe5('0x10')][_0x1dc22a['uniqueid']]=[];if(_[_0xfbe5('0x68')](this[_0xfbe5('0x12')][_0x1dc22a[_0xfbe5('0x4e')]]))this[_0xfbe5('0x12')][_0x1dc22a[_0xfbe5('0x4e')]]={};var _0x5b2d22=new QueueReport();_0x5b2d22[_0xfbe5('0x51')]=_0x1dc22a['queue'];_0x5b2d22[_0xfbe5('0x58')]=this[_0xfbe5('0x14')][_0x5b2d22[_0xfbe5('0x51')]]&&this[_0xfbe5('0x14')][_0x5b2d22[_0xfbe5('0x51')]]['type']?this[_0xfbe5('0x14')][_0x5b2d22[_0xfbe5('0x51')]]['type']||_0xfbe5('0x7b'):_0xfbe5('0x7b');_0x5b2d22[_0xfbe5('0x70')]=_0x1dc22a['queue'];_0x5b2d22['queuecallerjoinAt']=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));_0x5b2d22[_0xfbe5('0x7d')]=_0x1dc22a['position'];_0x5b2d22[_0xfbe5('0x7e')]=_0x1dc22a[_0xfbe5('0x7e')];_0x5b2d22[_0xfbe5('0x4e')]=_0x1dc22a[_0xfbe5('0x4e')];_0x5b2d22[_0xfbe5('0x7f')]=this[_0xfbe5('0x12')][_0x1dc22a[_0xfbe5('0x4e')]][_0xfbe5('0x7f')];logger[_0xfbe5('0x80')](_0xfbe5('0x81'),_0x5b2d22[_0xfbe5('0x51')],_0x5b2d22[_0xfbe5('0x58')]);_[_0xfbe5('0x82')](_0x5b2d22,_[_0xfbe5('0x83')](_0x1dc22a,_[_0xfbe5('0x84')](_0x5b2d22)));this[_0xfbe5('0x10')][_0x1dc22a[_0xfbe5('0x4e')]][_0xfbe5('0x85')](_0x5b2d22);this[_0xfbe5('0x12')][_0x1dc22a[_0xfbe5('0x4e')]]=_0x5b2d22;this['emitVoiceQueueChannelSave'](_0x5b2d22,'queuecallerjoin');}}catch(_0x44d434){logger[_0xfbe5('0x43')](_0xfbe5('0x7a'),_0x1dc22a[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x44d434,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbe5('0xb')][_0xfbe5('0x1e')]=function(_0x8b367e){try{if(this[_0xfbe5('0x6f')](_0x8b367e)){logger[_0xfbe5('0x4b')](_0xfbe5('0x86'),_0x8b367e[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x8b367e,{'showHidden':![],'depth':null}));if(this[_0xfbe5('0x10')][_0x8b367e[_0xfbe5('0x4e')]]){var _0x4fbf7c=_[_0xfbe5('0x87')](this[_0xfbe5('0x10')][_0x8b367e[_0xfbe5('0x4e')]]);_0x4fbf7c[_0xfbe5('0x88')]=![];_0x4fbf7c['queuecallercompleteAt']=null;_0x4fbf7c[_0xfbe5('0x89')]=_0x8b367e[_0xfbe5('0x89')];_0x4fbf7c[_0xfbe5('0x8a')]=_0x8b367e['originalposition'];_0x4fbf7c[_0xfbe5('0x1d')]=!![];_0x4fbf7c[_0xfbe5('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4fbf7c['queuecallerexitreason']=_0xfbe5('0x8c');_0x4fbf7c['lastAssignedTo']=null;logger[_0xfbe5('0x80')](_0xfbe5('0x8d'),_0x4fbf7c['name'],_0x4fbf7c[_0xfbe5('0x58')]);this['channels'][_0x8b367e[_0xfbe5('0x4e')]]=_0x4fbf7c;this[_0xfbe5('0x47')](_0x4fbf7c,_0xfbe5('0x1d'));}}}catch(_0x446beb){logger[_0xfbe5('0x43')](_0xfbe5('0x86'),_0x8b367e[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x446beb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x15f1ff){try{if(this['isNotNull'](_0x15f1ff)){logger[_0xfbe5('0x4b')](_0xfbe5('0x8e'),_0x15f1ff[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x15f1ff,{'showHidden':![],'depth':null}));if(this[_0xfbe5('0x10')][_0x15f1ff[_0xfbe5('0x4e')]]){var _0x15030c=_['last'](this[_0xfbe5('0x10')][_0x15f1ff[_0xfbe5('0x4e')]]);_0x15030c[_0xfbe5('0x8f')]=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));_0x15030c['connectedlinenum']=_0x15f1ff[_0xfbe5('0x90')];_0x15030c['connectedlinename']=_0x15f1ff[_0xfbe5('0x91')];logger[_0xfbe5('0x80')](_0xfbe5('0x92'),_0x15030c['name'],_0x15030c[_0xfbe5('0x58')],_0x15f1ff[_0xfbe5('0x90')],_0x15f1ff['connectedlinename']);this[_0xfbe5('0x12')][_0x15f1ff[_0xfbe5('0x4e')]]=_0x15030c;this[_0xfbe5('0x4a')](_0x15030c,_0xfbe5('0x1f'));}}}catch(_0x20129c){logger['error'](_0xfbe5('0x8e'),_0x15f1ff[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x20129c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbe5('0xb')]['syncAgentConnect']=function(_0x470994){try{if(this[_0xfbe5('0x6f')](_0x470994)){logger['debug'](_0xfbe5('0x93'),_0x470994[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x470994,{'showHidden':![],'depth':null}));if(this[_0xfbe5('0x10')][_0x470994[_0xfbe5('0x4e')]]){var _0x59228f=_[_0xfbe5('0x87')](this[_0xfbe5('0x10')][_0x470994[_0xfbe5('0x4e')]]);_0x59228f[_0xfbe5('0x88')]=!![];_0x59228f[_0xfbe5('0x55')]='COMPLETEDBYAGENT';logger['info'](_0xfbe5('0x94'),_0x59228f[_0xfbe5('0x51')],_0x59228f[_0xfbe5('0x58')]);}}}catch(_0x5a792e){logger['error'](_0xfbe5('0x93'),_0x470994[_0xfbe5('0x4e')],util['inspect'](_0x5a792e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbe5('0xb')][_0xfbe5('0x21')]=function(_0x4f558c){try{if(this[_0xfbe5('0x6f')](_0x4f558c)){logger[_0xfbe5('0x4b')](_0xfbe5('0x95'),_0x4f558c[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x4f558c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4f558c[_0xfbe5('0x4e')]]){var _0x34fdba=_[_0xfbe5('0x87')](this[_0xfbe5('0x10')][_0x4f558c[_0xfbe5('0x4e')]]);_0x34fdba[_0xfbe5('0x1d')]=![];_0x34fdba[_0xfbe5('0x8b')]=null;_0x34fdba[_0xfbe5('0x96')]=!![];_0x34fdba[_0xfbe5('0x97')]=_0x4f558c[_0xfbe5('0x98')];_0x34fdba[_0xfbe5('0x89')]=_0x4f558c[_0xfbe5('0x89')];_0x34fdba[_0xfbe5('0x88')]=!![];_0x34fdba[_0xfbe5('0x99')]=![];_0x34fdba[_0xfbe5('0x9a')]=null;if(!_0x34fdba['transfer']){if(_0x4f558c[_0xfbe5('0x9b')]==_0xfbe5('0x9c')){_0x34fdba['queuecallerexitreason']='COMPLETED';logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x34fdba[_0xfbe5('0x51')],_0x34fdba['type']);}else{if(_[_0xfbe5('0x9d')](_0x4f558c[_0xfbe5('0x3c')][_0xfbe5('0x9e')](),_0xfbe5('0x9f'))){if(this[_0xfbe5('0x10')][_0x4f558c[_0xfbe5('0xa0')]]){var _0x598e73=_[_0xfbe5('0x87')](this[_0xfbe5('0x10')][_0x4f558c['linkedid']]);_0x598e73[_0xfbe5('0x88')]=![];_0x598e73[_0xfbe5('0x99')]=!![];_0x598e73[_0xfbe5('0x9a')]=moment(_0x34fdba[_0xfbe5('0xa1')])['add'](_0x4f558c[_0xfbe5('0x89')],'seconds')['format'](_0xfbe5('0x7c'));_0x598e73[_0xfbe5('0x55')]='FORWARDTRANSFER';_0x598e73['transfer']=!![];_0x598e73[_0xfbe5('0xa2')]='FORWARD';_0x598e73[_0xfbe5('0xa3')]=_0x4f558c[_0xfbe5('0xa4')];_0x598e73['transferuniqueid']=_0x4f558c[_0xfbe5('0x4e')];logger['info'](_0xfbe5('0xa5'),_0x598e73['name'],_0x598e73[_0xfbe5('0x58')]);var _0xadb3f0=this[_0xfbe5('0x10')][_0x4f558c[_0xfbe5('0xa0')]];this[_0xfbe5('0x10')][_0x4f558c[_0xfbe5('0xa0')]]=this[_0xfbe5('0x10')][_0x4f558c[_0xfbe5('0x4e')]];this['queueReports'][_0x4f558c[_0xfbe5('0x4e')]]=_0xadb3f0;}}else{_0x34fdba[_0xfbe5('0x55')]=_0xfbe5('0xa6')+_0x4f558c[_0xfbe5('0x9b')][_0xfbe5('0xa7')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x34fdba['name'],_0x34fdba[_0xfbe5('0x58')],_0x34fdba[_0xfbe5('0x55')]);}}}this[_0xfbe5('0x12')][_0x4f558c[_0xfbe5('0x4e')]]=_0x34fdba;this[_0xfbe5('0x47')](_0x34fdba,_0xfbe5('0xa8'));}}}catch(_0xf1cd33){logger[_0xfbe5('0x43')](_0xfbe5('0x95'),_0x4f558c[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0xf1cd33,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbe5('0xb')][_0xfbe5('0x24')]=function(_0x3f062f){try{if(this[_0xfbe5('0x6f')](_0x3f062f)){logger[_0xfbe5('0x4b')](_0xfbe5('0xa9'),_0x3f062f[_0xfbe5('0x4e')],util['inspect'](_0x3f062f,{'showHidden':![],'depth':null}));this['addVariable'](_0x3f062f['uniqueid'],_[_0xfbe5('0x84')](_0x3f062f[_0xfbe5('0xaa')])[0x0],_0x3f062f[_0xfbe5('0xab')]);if(this[_0xfbe5('0x10')][_0x3f062f[_0xfbe5('0x4e')]]){var _0x1e0664=_[_0xfbe5('0x87')](this['queueReports'][_0x3f062f['uniqueid']]);if(_0x1e0664){if(this[_0xfbe5('0x6f')](_0x3f062f['variable'])&&this['isNotNull'](_0x3f062f[_0xfbe5('0xaa')][_0xfbe5('0xac')])){switch(_0x3f062f[_0xfbe5('0xab')]){case _0xfbe5('0xad'):_0x1e0664['queuecallerexit']=![];_0x1e0664['queuecallerexitAt']=null;break;case _0xfbe5('0xae'):_0x1e0664[_0xfbe5('0xaf')]=_0xfbe5('0xb0');_0x1e0664[_0xfbe5('0x99')]=!![];_0x1e0664[_0xfbe5('0x9a')]=moment()[_0xfbe5('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e0664[_0xfbe5('0x8f')]=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));logger[_0xfbe5('0x4b')](_0xfbe5('0xb1'),_0x3f062f[_0xfbe5('0x4e')],util['inspect'](_0x1e0664,{'showHidden':![],'depth':null}));ami[_0xfbe5('0x49')]('custom:timeout',_0x1e0664);break;default:_0x1e0664[_0xfbe5('0x99')]=!![];_0x1e0664[_0xfbe5('0x9a')]=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));_0x1e0664[_0xfbe5('0x8f')]=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));}_0x1e0664[_0xfbe5('0x1d')]=![];_0x1e0664[_0xfbe5('0x8b')]=null;_0x1e0664[_0xfbe5('0x55')]=_0x3f062f[_0xfbe5('0xab')];this['channels'][_0x3f062f[_0xfbe5('0x4e')]]=_0x1e0664;this[_0xfbe5('0x47')](_0x1e0664,'varset');}else if(this[_0xfbe5('0x6f')](_0x3f062f['variable'])&&this[_0xfbe5('0x6f')](_0x3f062f[_0xfbe5('0xaa')][_0xfbe5('0xb2')])){if(!_0x1e0664[_0xfbe5('0x1d')]){_0x1e0664[_0xfbe5('0x99')]=!![];_0x1e0664[_0xfbe5('0x9a')]=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));_0x1e0664['queuecallerexitreason']=_0xfbe5('0xb3');_0x1e0664[_0xfbe5('0x8f')]=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));this[_0xfbe5('0x12')][_0x3f062f[_0xfbe5('0x4e')]]=_0x1e0664;}}logger[_0xfbe5('0x80')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x3f062f[_0xfbe5('0x4e')],_0x1e0664[_0xfbe5('0x51')],_0x1e0664[_0xfbe5('0x58')],_[_0xfbe5('0x84')](_0x3f062f['variable'])[0x0],_0x3f062f['value']);_0x1e0664[_0xfbe5('0x16')]=this['variables'][_0x3f062f[_0xfbe5('0x4e')]];}}}}catch(_0xf8629e){logger[_0xfbe5('0x43')]('[%s][voiceQueueReport][varset]',_0x3f062f['uniqueid'],util[_0xfbe5('0x41')](_0xf8629e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfbe5('0xb4')]=function(_0x113434,_0x29ec29,_0x3ac8b2){var _0x3c6e66=[_0xfbe5('0xb5'),_0xfbe5('0xb6'),_0xfbe5('0xb7'),_0xfbe5('0xb8'),_0xfbe5('0xb9'),_0xfbe5('0xba'),_0xfbe5('0xbb'),_0xfbe5('0xbc'),_0xfbe5('0xbd'),_0xfbe5('0xbe'),_0xfbe5('0xbf'),_0xfbe5('0xc0'),_0xfbe5('0xc1'),_0xfbe5('0xc2'),_0xfbe5('0xc3'),_0xfbe5('0xc4'),'membername',_0xfbe5('0xc5'),'memberrealtime'];if(!_[_0xfbe5('0x3a')](_0x29ec29)&&!_['includes'](_0x3c6e66,_0x29ec29)){if(_['isUndefined'](this['variables'][_0x113434])){this['variables'][_0x113434]={};}this[_0xfbe5('0x16')][_0x113434][_0x29ec29]=_0x3ac8b2;}};VoiceQueueReport[_0xfbe5('0xb')][_0xfbe5('0xc6')]=function(_0x1281df,_0x1eab8c,_0x1bf886){var _0x3b158b={};for(var _0x15f8e9=0x0;_0x15f8e90x0?_0x126e5e:0x0;this[_0x6257('0x14')][_0x403e94[_0x6257('0x69')]][_0x6257('0x57')]=this['voiceQueues'][_0x403e94[_0x6257('0x69')]]['talking']>_[_0x6257('0x6e')](_0x403e94[_0x6257('0x70')])?_['toNumber'](_0x403e94[_0x6257('0x70')]):this['voiceQueues'][_0x403e94[_0x6257('0x69')]]['talking'];this[_0x6257('0x4e')](this[_0x6257('0x14')][_0x403e94['queue']],_0x6257('0x18'));}logger[_0x6257('0x40')](_0x6257('0x71'),util[_0x6257('0x3b')](this[_0x6257('0x14')][_0x403e94[_0x6257('0x69')]],{'showHidden':![],'depth':null}));ami['emit'](_0x6257('0x72'),this[_0x6257('0x14')][_0x403e94[_0x6257('0x69')]]);}}}catch(_0x3a742c){logger[_0x6257('0x3c')](_0x6257('0x68'),util[_0x6257('0x3b')](_0x3a742c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6257('0x1b')]=function(_0x5a9978){logger['debug'](_0x6257('0x73'),util[_0x6257('0x3b')](_0x5a9978,{'showHidden':![],'depth':null}));ami[_0x6257('0x3f')]('custom:queuesummarycomplete',{});this[_0x6257('0x15')]=!![];};VoiceQueueReport[_0x6257('0xb')]['syncQueueCallerJoin']=function(_0x5c8eef){try{if(this[_0x6257('0x63')](_0x5c8eef)){logger[_0x6257('0x40')](_0x6257('0x74'),_0x5c8eef[_0x6257('0x43')],util[_0x6257('0x3b')](_0x5c8eef,{'showHidden':![],'depth':null}));if(_[_0x6257('0x64')](this[_0x6257('0x10')][_0x5c8eef[_0x6257('0x43')]]))this['queueReports'][_0x5c8eef[_0x6257('0x43')]]=[];if(_['isUndefined'](this[_0x6257('0x12')][_0x5c8eef[_0x6257('0x43')]]))this['channels'][_0x5c8eef[_0x6257('0x43')]]={};var _0x3b161d=new QueueReport();_0x3b161d[_0x6257('0x4b')]=_0x5c8eef[_0x6257('0x69')];_0x3b161d[_0x6257('0x4f')]=this[_0x6257('0x14')][_0x3b161d[_0x6257('0x4b')]]&&this[_0x6257('0x14')][_0x3b161d[_0x6257('0x4b')]][_0x6257('0x4f')]?this['voiceQueues'][_0x3b161d[_0x6257('0x4b')]][_0x6257('0x4f')]||_0x6257('0x50'):_0x6257('0x50');_0x3b161d[_0x6257('0x69')]=_0x5c8eef['queue'];_0x3b161d[_0x6257('0x75')]=moment()[_0x6257('0x44')](_0x6257('0x76'));_0x3b161d[_0x6257('0x77')]=_0x5c8eef[_0x6257('0x77')];_0x3b161d[_0x6257('0x78')]=_0x5c8eef[_0x6257('0x78')];_0x3b161d[_0x6257('0x43')]=_0x5c8eef[_0x6257('0x43')];_0x3b161d[_0x6257('0x79')]=this[_0x6257('0x12')][_0x5c8eef[_0x6257('0x43')]][_0x6257('0x79')];logger[_0x6257('0x6b')](_0x6257('0x7a'),_0x3b161d['name'],_0x3b161d[_0x6257('0x4f')]);_[_0x6257('0x7b')](_0x3b161d,_['pick'](_0x5c8eef,_[_0x6257('0x7c')](_0x3b161d)));this['queueReports'][_0x5c8eef[_0x6257('0x43')]]['push'](_0x3b161d);this['channels'][_0x5c8eef[_0x6257('0x43')]]=_0x3b161d;this[_0x6257('0x7d')](_0x3b161d,_0x6257('0x1d'));}}catch(_0x593c8f){logger[_0x6257('0x3c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x5c8eef[_0x6257('0x43')],util[_0x6257('0x3b')](_0x593c8f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6257('0x20')]=function(_0x427728){try{if(this[_0x6257('0x63')](_0x427728)){logger['debug'](_0x6257('0x7e'),_0x427728[_0x6257('0x43')],util[_0x6257('0x3b')](_0x427728,{'showHidden':![],'depth':null}));if(this[_0x6257('0x10')][_0x427728[_0x6257('0x43')]]){var _0x5093a9=_['last'](this[_0x6257('0x10')][_0x427728['uniqueid']]);_0x5093a9[_0x6257('0x7f')]=![];_0x5093a9[_0x6257('0x80')]=null;_0x5093a9['holdtime']=_0x427728[_0x6257('0x81')];_0x5093a9[_0x6257('0x82')]=_0x427728[_0x6257('0x82')];_0x5093a9[_0x6257('0x1f')]=!![];_0x5093a9[_0x6257('0x83')]=moment()['format'](_0x6257('0x76'));_0x5093a9['queuecallerexitreason']=_0x6257('0x84');_0x5093a9[_0x6257('0x85')]=null;logger[_0x6257('0x6b')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5093a9['name'],_0x5093a9[_0x6257('0x4f')]);this[_0x6257('0x12')][_0x427728['uniqueid']]=_0x5093a9;this[_0x6257('0x48')](_0x5093a9,_0x6257('0x1f'));}}}catch(_0x24e3bb){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x427728['uniqueid'],util[_0x6257('0x3b')](_0x24e3bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6257('0xb')][_0x6257('0x22')]=function(_0x438f7a){try{if(this[_0x6257('0x63')](_0x438f7a)){logger[_0x6257('0x40')](_0x6257('0x86'),_0x438f7a[_0x6257('0x43')],util[_0x6257('0x3b')](_0x438f7a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x438f7a[_0x6257('0x43')]]){var _0x489c07=_[_0x6257('0x87')](this['queueReports'][_0x438f7a[_0x6257('0x43')]]);_0x489c07['queuecallerleaveAt']=moment()[_0x6257('0x44')](_0x6257('0x76'));_0x489c07[_0x6257('0x88')]=_0x438f7a[_0x6257('0x88')];_0x489c07[_0x6257('0x89')]=_0x438f7a[_0x6257('0x89')];logger[_0x6257('0x6b')](_0x6257('0x8a'),_0x489c07[_0x6257('0x4b')],_0x489c07[_0x6257('0x4f')],_0x438f7a['connectedlinenum'],_0x438f7a['connectedlinename']);this[_0x6257('0x12')][_0x438f7a['uniqueid']]=_0x489c07;this[_0x6257('0x7d')](_0x489c07,_0x6257('0x21'));}}}catch(_0xe15ee9){logger['error'](_0x6257('0x86'),_0x438f7a[_0x6257('0x43')],util[_0x6257('0x3b')](_0xe15ee9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6257('0xb')][_0x6257('0x25')]=function(_0x4a747a){try{if(this[_0x6257('0x63')](_0x4a747a)){logger[_0x6257('0x40')](_0x6257('0x8b'),_0x4a747a[_0x6257('0x43')],util[_0x6257('0x3b')](_0x4a747a,{'showHidden':![],'depth':null}));if(this[_0x6257('0x10')][_0x4a747a[_0x6257('0x43')]]){var _0x240b0a=_[_0x6257('0x87')](this[_0x6257('0x10')][_0x4a747a['uniqueid']]);_0x240b0a[_0x6257('0x7f')]=!![];_0x240b0a[_0x6257('0x4a')]=_0x6257('0x8c');logger[_0x6257('0x6b')](_0x6257('0x8d'),_0x240b0a[_0x6257('0x4b')],_0x240b0a[_0x6257('0x4f')]);}}}catch(_0xcc6364){logger[_0x6257('0x3c')]('[%s][voiceQueueReport][agentconnect]',_0x4a747a[_0x6257('0x43')],util[_0x6257('0x3b')](_0xcc6364,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6257('0xb')][_0x6257('0x23')]=function(_0x4e75e6){try{if(this['isNotNull'](_0x4e75e6)){logger[_0x6257('0x40')]('[%s][voiceQueueReport][agentcomplete]',_0x4e75e6[_0x6257('0x43')],util[_0x6257('0x3b')](_0x4e75e6,{'showHidden':![],'depth':null}));if(this[_0x6257('0x10')][_0x4e75e6['uniqueid']]){var _0x2557ea=_[_0x6257('0x87')](this[_0x6257('0x10')][_0x4e75e6[_0x6257('0x43')]]);_0x2557ea['queuecallerabandon']=![];_0x2557ea[_0x6257('0x83')]=null;_0x2557ea[_0x6257('0x8e')]=!![];_0x2557ea[_0x6257('0x85')]=_0x4e75e6[_0x6257('0x8f')];_0x2557ea['holdtime']=_0x4e75e6[_0x6257('0x81')];_0x2557ea[_0x6257('0x7f')]=!![];_0x2557ea[_0x6257('0x90')]=![];_0x2557ea['queuecallerexitAt']=null;if(!_0x2557ea[_0x6257('0x91')]){if(_0x4e75e6[_0x6257('0x92')]==_0x6257('0x91')){_0x2557ea['queuecallerexitreason']=_0x6257('0x93');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x2557ea[_0x6257('0x4b')],_0x2557ea[_0x6257('0x4f')]);}else{if(_['startsWith'](_0x4e75e6['channel'][_0x6257('0x94')](),_0x6257('0x95'))){if(this[_0x6257('0x10')][_0x4e75e6[_0x6257('0x96')]]){var _0x1c0bdf=_[_0x6257('0x87')](this[_0x6257('0x10')][_0x4e75e6[_0x6257('0x96')]]);_0x1c0bdf[_0x6257('0x7f')]=![];_0x1c0bdf[_0x6257('0x90')]=!![];_0x1c0bdf[_0x6257('0x97')]=moment(_0x2557ea[_0x6257('0x75')])['add'](_0x4e75e6[_0x6257('0x81')],_0x6257('0x98'))[_0x6257('0x44')](_0x6257('0x76'));_0x1c0bdf[_0x6257('0x4a')]=_0x6257('0x99');_0x1c0bdf['transfer']=!![];_0x1c0bdf[_0x6257('0x9a')]='FORWARD';_0x1c0bdf[_0x6257('0x9b')]=_0x4e75e6['destexten'];_0x1c0bdf['transferuniqueid']=_0x4e75e6[_0x6257('0x43')];logger['info'](_0x6257('0x9c'),_0x1c0bdf['name'],_0x1c0bdf['type']);var _0x4aeb66=this[_0x6257('0x10')][_0x4e75e6[_0x6257('0x96')]];this[_0x6257('0x10')][_0x4e75e6[_0x6257('0x96')]]=this[_0x6257('0x10')][_0x4e75e6[_0x6257('0x43')]];this[_0x6257('0x10')][_0x4e75e6['uniqueid']]=_0x4aeb66;}}else{_0x2557ea['queuecallerexitreason']=_0x6257('0x9d')+_0x4e75e6['reason'][_0x6257('0x9e')]();logger[_0x6257('0x6b')](_0x6257('0x9f'),_0x2557ea[_0x6257('0x4b')],_0x2557ea['type'],_0x2557ea[_0x6257('0x4a')]);}}}this[_0x6257('0x12')][_0x4e75e6[_0x6257('0x43')]]=_0x2557ea;this[_0x6257('0x48')](_0x2557ea,_0x6257('0xa0'));}}}catch(_0x4f6066){logger[_0x6257('0x3c')]('[%s][voiceQueueReport][agentcomplete]',_0x4e75e6['uniqueid'],util['inspect'](_0x4f6066,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6257('0xb')]['syncVarSet']=function(_0x428c0e){try{if(this[_0x6257('0x63')](_0x428c0e)){logger[_0x6257('0x40')](_0x6257('0xa1'),_0x428c0e[_0x6257('0x43')],util['inspect'](_0x428c0e,{'showHidden':![],'depth':null}));this[_0x6257('0xa2')](_0x428c0e['uniqueid'],_[_0x6257('0x7c')](_0x428c0e[_0x6257('0xa3')])[0x0],_0x428c0e[_0x6257('0xa4')]);if(this[_0x6257('0x10')][_0x428c0e[_0x6257('0x43')]]){var _0x1ea9c8=_[_0x6257('0x87')](this[_0x6257('0x10')][_0x428c0e[_0x6257('0x43')]]);if(_0x1ea9c8){if(this[_0x6257('0x63')](_0x428c0e[_0x6257('0xa3')])&&this[_0x6257('0x63')](_0x428c0e['variable'][_0x6257('0xa5')])){switch(_0x428c0e[_0x6257('0xa4')]){case'CONTINUE':_0x1ea9c8[_0x6257('0x90')]=![];_0x1ea9c8[_0x6257('0x97')]=null;break;case _0x6257('0xa6'):_0x1ea9c8[_0x6257('0xa7')]=_0x6257('0xa8');_0x1ea9c8[_0x6257('0x90')]=!![];_0x1ea9c8[_0x6257('0x97')]=moment()[_0x6257('0x44')](_0x6257('0x76'));_0x1ea9c8['queuecallerleaveAt']=moment()['format'](_0x6257('0x76'));logger[_0x6257('0x40')](_0x6257('0xa9'),_0x428c0e[_0x6257('0x43')],util[_0x6257('0x3b')](_0x1ea9c8,{'showHidden':![],'depth':null}));ami[_0x6257('0x3f')]('custom:timeout',_0x1ea9c8);break;default:_0x1ea9c8[_0x6257('0x90')]=!![];_0x1ea9c8[_0x6257('0x97')]=moment()[_0x6257('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ea9c8['queuecallerleaveAt']=moment()[_0x6257('0x44')](_0x6257('0x76'));}_0x1ea9c8['queuecallerabandon']=![];_0x1ea9c8[_0x6257('0x83')]=null;_0x1ea9c8[_0x6257('0x4a')]=_0x428c0e[_0x6257('0xa4')];this['channels'][_0x428c0e[_0x6257('0x43')]]=_0x1ea9c8;this[_0x6257('0x48')](_0x1ea9c8,_0x6257('0x26'));}else if(this[_0x6257('0x63')](_0x428c0e[_0x6257('0xa3')])&&this[_0x6257('0x63')](_0x428c0e[_0x6257('0xa3')]['queueposition'])){if(!_0x1ea9c8[_0x6257('0x1f')]){_0x1ea9c8[_0x6257('0x90')]=!![];_0x1ea9c8[_0x6257('0x97')]=moment()[_0x6257('0x44')](_0x6257('0x76'));_0x1ea9c8[_0x6257('0x4a')]='EXITWITHKEY';_0x1ea9c8[_0x6257('0xaa')]=moment()[_0x6257('0x44')](_0x6257('0x76'));this[_0x6257('0x12')][_0x428c0e[_0x6257('0x43')]]=_0x1ea9c8;}}logger[_0x6257('0x6b')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x428c0e[_0x6257('0x43')],_0x1ea9c8[_0x6257('0x4b')],_0x1ea9c8[_0x6257('0x4f')],_[_0x6257('0x7c')](_0x428c0e[_0x6257('0xa3')])[0x0],_0x428c0e[_0x6257('0xa4')]);_0x1ea9c8[_0x6257('0x17')]=this[_0x6257('0x17')][_0x428c0e['uniqueid']];}}}}catch(_0x205e7e){logger['error']('[%s][voiceQueueReport][varset]',_0x428c0e['uniqueid'],util[_0x6257('0x3b')](_0x205e7e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6257('0xb')][_0x6257('0xa2')]=function(_0x2cc875,_0x155c63,_0x3a7f4f){var _0x37ffb2=[_0x6257('0xab'),'rtpaudioqosbridged',_0x6257('0xac'),_0x6257('0xad'),_0x6257('0xae'),'rtpaudioqoslossbridged',_0x6257('0xaf'),_0x6257('0xb0'),_0x6257('0xb1'),_0x6257('0xb2'),_0x6257('0xb3'),_0x6257('0xb4'),_0x6257('0xb5'),'memberdynamic','memberinterface',_0x6257('0xb6'),'membername',_0x6257('0xb7'),_0x6257('0xb8')];if(!_[_0x6257('0x35')](_0x155c63)&&!_['includes'](_0x37ffb2,_0x155c63)){if(_[_0x6257('0x64')](this['variables'][_0x2cc875])){this[_0x6257('0x17')][_0x2cc875]={};}this[_0x6257('0x17')][_0x2cc875][_0x155c63]=_0x3a7f4f;}};VoiceQueueReport['prototype'][_0x6257('0xb9')]=function(_0x27b53c,_0x531a8f,_0x281f62){var _0x2ecaff={};for(var _0x325c27=0x0;_0x325c27=0x0?moment(_0x582dd1[_0x77a4('0x17')])[_0x77a4('0x18')](_0x582dd1[_0x77a4('0x16')],_0x77a4('0xe')):null,'data1':'outbound','data2':_0x582dd1['accountcode'],'data3':_0x582dd1['exten'],'data4':_0x582dd1['dialstring']||null,'role':_0x77a4('0x19'),'internal':_0x582dd1['accountcode']?_[_0x77a4('0x12')](_0x582dd1[_0x77a4('0x11')]):undefined,'uniqueid':_0x582dd1[_0x77a4('0x13')]},'log':_0x77a4('0x6')});}; \ No newline at end of file +var _0x8df1=['TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','accountcode','toNumber','uniqueid','membername','starttime','endtime','outbound','agent','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','SIP/%s'];(function(_0x29aca7,_0x21c650){var _0x1db0a0=function(_0x45b5ea){while(--_0x45b5ea){_0x29aca7['push'](_0x29aca7['shift']());}};_0x1db0a0(++_0x21c650);}(_0x8df1,0x1eb));var _0x18df=function(_0x261bbb,_0x785e30){_0x261bbb=_0x261bbb-0x0;var _0x30f1f2=_0x8df1[_0x261bbb];return _0x30f1f2;};'use strict';var moment=require(_0x18df('0x0'));var _=require(_0x18df('0x1'));var util=require(_0x18df('0x2'));var client=require('../client');exports[_0x18df('0x3')]=function(_0xc43de9){var _0xadf172=_0xc43de9[_0x18df('0x4')]||_0xc43de9[_0x18df('0x5')];return client[_0x18df('0x6')](_0x18df('0x7'),{'body':{'channel':_0x18df('0x8'),'membername':_0xc43de9['lastAssignedTo'],'interface':_[_0x18df('0x9')](_0xc43de9[_0x18df('0xa')])?util[_0x18df('0xb')](_0x18df('0xc'),_0xc43de9['lastAssignedTo']):_0xc43de9[_0x18df('0xa')],'type':_0x18df('0xd'),'enterAt':_0xc43de9[_0x18df('0xe')],'exitAt':_0xadf172,'duration':moment(_0xadf172)[_0x18df('0xf')](_0xc43de9[_0x18df('0xe')],_0x18df('0x10')),'data1':'inbound','data2':_0xc43de9[_0x18df('0x11')],'data3':_0xc43de9[_0x18df('0x12')],'data4':null,'data5':_0xc43de9[_0x18df('0x13')],'role':'agent','internal':_0xc43de9[_0x18df('0x14')]?_[_0x18df('0x15')](_0xc43de9[_0x18df('0x14')]):undefined,'uniqueid':_0xc43de9[_0x18df('0x16')]},'log':_0x18df('0x7')});};exports['voiceDialReport']=function(_0x5377bd){return client['Request'](_0x18df('0x7'),{'body':{'channel':'voice','membername':_0x5377bd[_0x18df('0x17')],'interface':_0x5377bd[_0x18df('0xa')],'type':_0x18df('0xd'),'enterAt':_0x5377bd[_0x18df('0x18')],'exitAt':_0x5377bd[_0x18df('0x19')],'duration':moment(_0x5377bd['endtime'])[_0x18df('0xf')](_0x5377bd['starttime'],_0x18df('0x10'))>=0x0?moment(_0x5377bd[_0x18df('0x19')])['diff'](_0x5377bd[_0x18df('0x18')],_0x18df('0x10')):null,'data1':_0x18df('0x1a'),'data2':_0x5377bd[_0x18df('0x14')],'data3':_0x5377bd[_0x18df('0x12')],'data4':_0x5377bd['dialstring']||null,'role':_0x18df('0x1b'),'internal':_0x5377bd[_0x18df('0x14')]?_['toNumber'](_0x5377bd[_0x18df('0x14')]):undefined,'uniqueid':_0x5377bd[_0x18df('0x16')]},'log':_0x18df('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index de7b7c1..c2bcf57 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 _0x41fa=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x41fa,0x1f1));var _0xa41f=function(_0x206338,_0x2d800b){_0x206338=_0x206338-0x0;var _0x2b87f2=_0x41fa[_0x206338];return _0x2b87f2;};'use strict';var client=require(_0xa41f('0x0'));exports[_0xa41f('0x1')]=function(){return client[_0xa41f('0x2')](_0xa41f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa41f('0x4'),_0xa41f('0x5')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x7e33=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','stopRecordingOnTransfer'];(function(_0xc91614,_0x4f3a98){var _0x4bf80e=function(_0x4e9c37){while(--_0x4e9c37){_0xc91614['push'](_0xc91614['shift']());}};_0x4bf80e(++_0x4f3a98);}(_0x7e33,0x7a));var _0x37e3=function(_0x22740a,_0x47bae1){_0x22740a=_0x22740a-0x0;var _0x13815b=_0x7e33[_0x22740a];return _0x13815b;};'use strict';var client=require(_0x37e3('0x0'));exports[_0x37e3('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x37e3('0x2'),_0x37e3('0x3')]},'log':_0x37e3('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 2330a64..d93cb6c 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 _0x7f0d=['name','html','GetTemplate'];(function(_0x573a19,_0x5939b5){var _0x1e4cc4=function(_0x54e19e){while(--_0x54e19e){_0x573a19['push'](_0x573a19['shift']());}};_0x1e4cc4(++_0x5939b5);}(_0x7f0d,0x89));var _0xd7f0=function(_0x6252a5,_0x5dea1d){_0x6252a5=_0x6252a5-0x0;var _0x1feb94=_0x7f0d[_0x6252a5];return _0x1feb94;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x548c1f){return function(_0x4949c1){return client['Request'](_0xd7f0('0x0'),{'options':{'raw':!![],'attributes':['id',_0xd7f0('0x1'),_0xd7f0('0x2')]},'log':_0xd7f0('0x0')});};}; \ No newline at end of file +var _0x51ed=['Request','GetTemplate','name','html','../client'];(function(_0x3f217c,_0x15d504){var _0x12825a=function(_0x11eaa5){while(--_0x11eaa5){_0x3f217c['push'](_0x3f217c['shift']());}};_0x12825a(++_0x15d504);}(_0x51ed,0x1a3));var _0xd51e=function(_0x11239b,_0xdfd2b0){_0x11239b=_0x11239b-0x0;var _0x1d51c4=_0x51ed[_0x11239b];return _0x1d51c4;};'use strict';var client=require(_0xd51e('0x0'));exports['getTemplates']=function(_0x534fdd){return function(_0x2f63e8){return client[_0xd51e('0x1')](_0xd51e('0x2'),{'options':{'raw':!![],'attributes':['id',_0xd51e('0x3'),_0xd51e('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7ee0dd9..c4032ea 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 _0x5d42=['GetTrigger','../client','getTriggers','Request','name','channel','status','Condition','operator','value','AnyConditions','Action','data1','data4','data5','data6','data7'];(function(_0x46661a,_0x301e97){var _0x6a59ea=function(_0x52ba77){while(--_0x52ba77){_0x46661a['push'](_0x46661a['shift']());}};_0x6a59ea(++_0x301e97);}(_0x5d42,0x144));var _0x25d4=function(_0x40fa5e,_0x3c0b6a){_0x40fa5e=_0x40fa5e-0x0;var _0x317e8f=_0x5d42[_0x40fa5e];return _0x317e8f;};'use strict';var client=require(_0x25d4('0x0'));exports[_0x25d4('0x1')]=function(_0x3eeeff){return function(_0x498a27){return client[_0x25d4('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x25d4('0x3'),_0x25d4('0x4'),_0x25d4('0x5')],'include':[{'model':_0x25d4('0x6'),'as':'AllConditions','attributes':['id','field',_0x25d4('0x7'),_0x25d4('0x8')]},{'model':'Condition','as':_0x25d4('0x9'),'attributes':['id','field','operator',_0x25d4('0x8')]},{'model':_0x25d4('0xa'),'as':'Actions','attributes':['id','action',_0x25d4('0xb'),'data2','data3',_0x25d4('0xc'),_0x25d4('0xd'),_0x25d4('0xe'),_0x25d4('0xf')]}]},'log':_0x25d4('0x10')});};}; \ No newline at end of file +var _0x8378=['Condition','AnyConditions','Action','Actions','data1','data3','data4','data5','data6','data7','Request','GetTrigger','status','field','operator','value'];(function(_0x36f2b2,_0x4dea08){var _0x4a0f99=function(_0x5442b9){while(--_0x5442b9){_0x36f2b2['push'](_0x36f2b2['shift']());}};_0x4a0f99(++_0x4dea08);}(_0x8378,0x9a));var _0x8837=function(_0x2c7e55,_0x4acf73){_0x2c7e55=_0x2c7e55-0x0;var _0x4ebccc=_0x8378[_0x2c7e55];return _0x4ebccc;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x2c6107){return function(_0x4110b3){return client[_0x8837('0x0')](_0x8837('0x1'),{'options':{'raw':![],'attributes':['id','name','channel',_0x8837('0x2')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x8837('0x3'),_0x8837('0x4'),_0x8837('0x5')]},{'model':_0x8837('0x6'),'as':_0x8837('0x7'),'attributes':['id',_0x8837('0x3'),_0x8837('0x4'),_0x8837('0x5')]},{'model':_0x8837('0x8'),'as':_0x8837('0x9'),'attributes':['id','action',_0x8837('0xa'),'data2',_0x8837('0xb'),_0x8837('0xc'),_0x8837('0xd'),_0x8837('0xe'),_0x8837('0xf')]}]},'log':_0x8837('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 5647ac3..0f3b2ec 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 _0xc6f6=['../client','getTrunks','GetTrunk','registry','defaultuser'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0xc6f6,0xeb));var _0x6c6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc6f6[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x6c6f('0x0'));exports[_0x6c6f('0x1')]=function(_0x82014a){return function(_0x47e593){return client['Request'](_0x6c6f('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x6c6f('0x3'),_0x6c6f('0x4')]},'log':_0x6c6f('0x2')});};}; \ No newline at end of file +var _0x1353=['getTrunks','Request','GetTrunk','registry','defaultuser','../client'];(function(_0x1d897a,_0x5eaf31){var _0x106376=function(_0x1ba8f9){while(--_0x1ba8f9){_0x1d897a['push'](_0x1d897a['shift']());}};_0x106376(++_0x5eaf31);}(_0x1353,0xb3));var _0x3135=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x1353[_0x164eca];return _0x2ce562;};'use strict';var client=require(_0x3135('0x0'));exports[_0x3135('0x1')]=function(_0x40566e){return function(_0xc37eec){return client[_0x3135('0x2')](_0x3135('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x3135('0x4'),_0x3135('0x5')]},'log':_0x3135('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index a316a52..f1741c5 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x1f862d,_0x108173){var _0x97964c=function(_0x56f563){while(--_0x56f563){_0x1f862d['push'](_0x1f862d['shift']());}};_0x97964c(++_0x108173);}(_0x70e0,0x17b));var _0x070e=function(_0x2994d0,_0x44b533){_0x2994d0=_0x2994d0-0x0;var _0x2e2462=_0x70e0[_0x2994d0];return _0x2e2462;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe706,0xa3));var _0x6e70=function(_0x2d4340,_0x14bd7f){_0x2d4340=_0x2d4340-0x0;var _0x5a2e9e=_0xe706[_0x2d4340];return _0x5a2e9e;};'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 diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index dde2e51..f486631 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 _0x74f0=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x5c38a2,_0x40e4e4){var _0x22869c=function(_0x4601ce){while(--_0x4601ce){_0x5c38a2['push'](_0x5c38a2['shift']());}};_0x22869c(++_0x40e4e4);}(_0x74f0,0xfd));var _0x074f=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x74f0[_0x170772];return _0x3ef69c;};'use strict';var client=require(_0x074f('0x0'));exports[_0x074f('0x1')]=function(_0xf3704c){return client[_0x074f('0x2')]('CreateVoiceAgentReport',{'body':_0xf3704c,'log':_0x074f('0x3')});};exports[_0x074f('0x4')]=function(_0x5b96a,_0x465d5c,_0x5239f5){return client[_0x074f('0x2')](_0x074f('0x5'),{'body':_0x5b96a,'options':{'where':{'uniqueid':_0x465d5c,'interface':_0x5239f5,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xfdf0=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0xfdf0,0x176));var _0x0fdf=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0xfdf0[_0x3b632f];return _0x10e788;};'use strict';var client=require(_0x0fdf('0x0'));exports[_0x0fdf('0x1')]=function(_0x1cbba6){return client[_0x0fdf('0x2')](_0x0fdf('0x3'),{'body':_0x1cbba6,'log':_0x0fdf('0x3')});};exports[_0x0fdf('0x4')]=function(_0x3483c6,_0x57148e,_0x4e8f88){return client[_0x0fdf('0x2')](_0x0fdf('0x5'),{'body':_0x3483c6,'options':{'where':{'uniqueid':_0x57148e,'interface':_0x4e8f88,'agentcomplete':!![]}},'log':_0x0fdf('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 78bea7d..2c446c7 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 _0xbac8=['DOCUMENTATION','Request','GetVoiceCallReport','startOf','day','endOf','format','YYYY-MM-DD\x20HH:mm:ss','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','CreateVoiceCallReport','merge','context'];(function(_0xf8dbfa,_0x2aa864){var _0xf44120=function(_0x36f1ec){while(--_0x36f1ec){_0xf8dbfa['push'](_0xf8dbfa['shift']());}};_0xf44120(++_0x2aa864);}(_0xbac8,0x1cd));var _0x8bac=function(_0x2e127a,_0x5548d5){_0x2e127a=_0x2e127a-0x0;var _0x221148=_0xbac8[_0x2e127a];return _0x221148;};'use strict';var moment=require(_0x8bac('0x0'));var util=require(_0x8bac('0x1'));var _=require(_0x8bac('0x2'));var client=require(_0x8bac('0x3'));exports['create']=function(_0x5986da){return client['Request'](_0x8bac('0x4'),{'body':_[_0x8bac('0x5')](_0x5986da,{'source':_0x5986da['calleridnum'],'destinationcontext':_0x5986da[_0x8bac('0x6')],'callerid':_0x5986da['callerid'],'amaflags':_0x8bac('0x7')}),'log':_0x8bac('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x8bac('0x8')](_0x8bac('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x8bac('0xa')](_0x8bac('0xb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x8bac('0xc')](_0x8bac('0xb'))[_0x8bac('0xd')](_0x8bac('0xe'))]}},'attributes':['type','disposition',_0x8bac('0xf'),_0x8bac('0x10')]},'log':_0x8bac('0x11')});};}; \ No newline at end of file +var _0x732d=['context','DOCUMENTATION','getVoiceCallReports','Request','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge'];(function(_0x32b37e,_0x191506){var _0x5083df=function(_0x2cdce8){while(--_0x2cdce8){_0x32b37e['push'](_0x32b37e['shift']());}};_0x5083df(++_0x191506);}(_0x732d,0x119));var _0xd732=function(_0x3d7d11,_0x1e1ab6){_0x3d7d11=_0x3d7d11-0x0;var _0x2481fa=_0x732d[_0x3d7d11];return _0x2481fa;};'use strict';var moment=require(_0xd732('0x0'));var util=require(_0xd732('0x1'));var _=require(_0xd732('0x2'));var client=require(_0xd732('0x3'));exports[_0xd732('0x4')]=function(_0x5a77a9){return client['Request'](_0xd732('0x5'),{'body':_[_0xd732('0x6')](_0x5a77a9,{'source':_0x5a77a9['calleridnum'],'destinationcontext':_0x5a77a9[_0xd732('0x7')],'callerid':_0x5a77a9['callerid'],'amaflags':_0xd732('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0xd732('0x9')]=function(){return function(){return client[_0xd732('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xd732('0xb')],'createdAt':{'$between':[moment()['startOf']('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xd732('0xc'))[_0xd732('0xd')](_0xd732('0xe'))]}},'attributes':['type','disposition',_0xd732('0xf'),_0xd732('0x10')]},'log':_0xd732('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index fadea32..18539e3 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 _0x17d6=['Request','CreateVoiceDialReport','../client'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x17d6,0x86));var _0x617d=function(_0x584bb7,_0x56f051){_0x584bb7=_0x584bb7-0x0;var _0x302722=_0x17d6[_0x584bb7];return _0x302722;};'use strict';var client=require(_0x617d('0x0'));exports['create']=function(_0x2c4665){return client[_0x617d('0x1')]('CreateVoiceDialReport',{'body':_0x2c4665,'log':_0x617d('0x2')});}; \ No newline at end of file +var _0x44c6=['create','Request','CreateVoiceDialReport','../client'];(function(_0xbd2b8f,_0x1abf54){var _0x151694=function(_0x1b60d3){while(--_0x1b60d3){_0xbd2b8f['push'](_0xbd2b8f['shift']());}};_0x151694(++_0x1abf54);}(_0x44c6,0x6b));var _0x644c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x44c6[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x644c('0x0'));exports[_0x644c('0x1')]=function(_0x4f9f28){return client[_0x644c('0x2')](_0x644c('0x3'),{'body':_0x4f9f28,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index b41bf1e..10af251 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 _0xcea2=['getVoiceExtensions','../client','Request','exten','recordingFormat'];(function(_0xcdac34,_0x43f665){var _0x269d23=function(_0x3f2d6f){while(--_0x3f2d6f){_0xcdac34['push'](_0xcdac34['shift']());}};_0x269d23(++_0x43f665);}(_0xcea2,0x15a));var _0x2cea=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xcea2[_0x500419];return _0x241c1a;};'use strict';var client=require(_0x2cea('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x2cea('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x2cea('0x2'),_0x2cea('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x2cea('0x4')});};}; \ No newline at end of file +var _0x152f=['getVoiceExtensions','Request','GetVoiceExtension','exten','../client'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x152f,0x144));var _0xf152=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x152f[_0x2160a9];return _0xa88cf7;};'use strict';var client=require(_0xf152('0x0'));exports[_0xf152('0x1')]=function(){return function(){return client[_0xf152('0x2')](_0xf152('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf152('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xf152('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 10e101d..6307499 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 _0x2fe3=['dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','TrunkBackup','Interval','../client','getVoiceQueues','name','acwTimeout','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialQueueProject2','strategy'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x2fe3,0x87));var _0x32fe=function(_0x37593f,_0x2e505b){_0x37593f=_0x37593f-0x0;var _0x33c524=_0x2fe3[_0x37593f];return _0x33c524;};'use strict';var client=require(_0x32fe('0x0'));exports[_0x32fe('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x32fe('0x2'),'acw',_0x32fe('0x3'),'autopause','monitor_format',_0x32fe('0x4'),_0x32fe('0x5'),'dialMethod',_0x32fe('0x6'),_0x32fe('0x7'),_0x32fe('0x8'),_0x32fe('0x9'),_0x32fe('0xa'),_0x32fe('0xb'),'dialOriginateCallerIdName',_0x32fe('0xc'),_0x32fe('0xd'),_0x32fe('0xe'),_0x32fe('0xf'),'dialQueueProject','dialCongestionMaxRetry',_0x32fe('0x10'),_0x32fe('0x11'),_0x32fe('0x12'),_0x32fe('0x13'),'dialNoAnswerRetryFrequency',_0x32fe('0x14'),'dialTimezone','dialGlobalInterval',_0x32fe('0x15'),_0x32fe('0x16'),_0x32fe('0x17'),_0x32fe('0x18'),_0x32fe('0x19'),_0x32fe('0x1a'),_0x32fe('0x1b'),_0x32fe('0x1c'),_0x32fe('0x1d'),_0x32fe('0x1e'),_0x32fe('0x1f'),_0x32fe('0x20'),_0x32fe('0x21'),_0x32fe('0x22'),_0x32fe('0x23'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x32fe('0x24'),_0x32fe('0x25'),'monitor_format',_0x32fe('0x26'),_0x32fe('0x27'),_0x32fe('0x28'),'dialNoSuchNumberMaxRetry',_0x32fe('0x29'),_0x32fe('0x2a'),_0x32fe('0x2b'),_0x32fe('0x2c'),'dialAbandonedRetryFrequency',_0x32fe('0x2d'),'dialMachineRetryFrequency',_0x32fe('0x2e'),_0x32fe('0x2f'),_0x32fe('0x30'),_0x32fe('0x31'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe',_0x32fe('0x32'),_0x32fe('0x33')],'include':[{'model':_0x32fe('0x34'),'as':_0x32fe('0x34'),'attributes':['id',_0x32fe('0x2'),_0x32fe('0x35'),_0x32fe('0x36')]},{'model':_0x32fe('0x37'),'as':'mandatoryDispositionPause','attributes':['id',_0x32fe('0x2')]},{'model':'Trunk','as':_0x32fe('0x38'),'attributes':['id',_0x32fe('0x2'),'callerid',_0x32fe('0x36')]},{'model':_0x32fe('0x39'),'as':_0x32fe('0x39'),'attributes':['id',_0x32fe('0x2')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x32fe('0x2'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x8b55=['dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','callerid','Pause','mandatoryDispositionPause','Trunk','active','Interval','Intervals','../client','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords'];(function(_0xe7cd0e,_0x4b1667){var _0x1b5ef4=function(_0x2c80b7){while(--_0x2c80b7){_0xe7cd0e['push'](_0xe7cd0e['shift']());}};_0x1b5ef4(++_0x4b1667);}(_0x8b55,0x195));var _0x58b5=function(_0x281e15,_0x42294c){_0x281e15=_0x281e15-0x0;var _0x23ea04=_0x8b55[_0x281e15];return _0x23ea04;};'use strict';var client=require(_0x58b5('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x58b5('0x1')](_0x58b5('0x2'),{'options':{'raw':![],'attributes':['id',_0x58b5('0x3'),'acw',_0x58b5('0x4'),_0x58b5('0x5'),_0x58b5('0x6'),'type',_0x58b5('0x7'),_0x58b5('0x8'),_0x58b5('0x9'),_0x58b5('0xa'),_0x58b5('0xb'),_0x58b5('0xc'),_0x58b5('0xd'),'dialPredictiveInterval',_0x58b5('0xe'),_0x58b5('0xf'),_0x58b5('0x10'),'dialQueueOptions',_0x58b5('0x11'),_0x58b5('0x12'),_0x58b5('0x13'),_0x58b5('0x14'),_0x58b5('0x15'),_0x58b5('0x16'),_0x58b5('0x17'),_0x58b5('0x18'),_0x58b5('0x19'),_0x58b5('0x1a'),_0x58b5('0x1b'),_0x58b5('0x1c'),_0x58b5('0x1d'),'dialAMDActive',_0x58b5('0x1e'),_0x58b5('0x1f'),_0x58b5('0x20'),_0x58b5('0x21'),_0x58b5('0x22'),'dialAMDBetweenWordsSilence',_0x58b5('0x23'),'dialAMDSilenceThreshold',_0x58b5('0x24'),'timeout',_0x58b5('0x25'),'dialRecallInQueue',_0x58b5('0x26'),_0x58b5('0x27'),_0x58b5('0x28'),_0x58b5('0x29'),_0x58b5('0x6'),_0x58b5('0x2a'),'dialRandomLastDigitCallerIdNumber',_0x58b5('0x2b'),_0x58b5('0x2c'),_0x58b5('0x2d'),'dialDropMaxRetry',_0x58b5('0x2e'),_0x58b5('0x2f'),'dialAbandonedRetryFrequency',_0x58b5('0x30'),_0x58b5('0x31'),_0x58b5('0x32'),_0x58b5('0x33'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x58b5('0x34'),_0x58b5('0x35'),_0x58b5('0x36'),_0x58b5('0x37')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id','name',_0x58b5('0x38'),'active']},{'model':_0x58b5('0x39'),'as':_0x58b5('0x3a'),'attributes':['id',_0x58b5('0x3')]},{'model':_0x58b5('0x3b'),'as':'TrunkBackup','attributes':['id',_0x58b5('0x3'),_0x58b5('0x38'),_0x58b5('0x3c')]},{'model':_0x58b5('0x3d'),'as':'Interval','attributes':['id',_0x58b5('0x3')],'include':[{'model':_0x58b5('0x3d'),'as':_0x58b5('0x3e'),'attributes':['id',_0x58b5('0x3'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 40181a5..33a5267 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(_0x30ef7e,_0x4963a5){var _0x244a93=function(_0x4cf486){while(--_0x4cf486){_0x30ef7e['push'](_0x30ef7e['shift']());}};_0x244a93(++_0x4963a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0xb001f0,_0x831652){var _0x403b49=function(_0x4dfdf2){while(--_0x4dfdf2){_0xb001f0['push'](_0xb001f0['shift']());}};_0x403b49(++_0x831652);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 14533ad..46cfb17 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 _0xe398=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x2aaeb1,_0x26224d){var _0x569072=function(_0x1b42d7){while(--_0x1b42d7){_0x2aaeb1['push'](_0x2aaeb1['shift']());}};_0x569072(++_0x26224d);}(_0xe398,0x160));var _0x8e39=function(_0x26ab33,_0x511764){_0x26ab33=_0x26ab33-0x0;var _0x3e639e=_0xe398[_0x26ab33];return _0x3e639e;};'use strict';var client=require(_0x8e39('0x0'));exports[_0x8e39('0x1')]=function(_0x779498){return function(){return client[_0x8e39('0x2')](_0x8e39('0x3'),{'options':{'where':{'VoiceQueueId':_0x779498,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xbcb0=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x27e6b2,_0x7769ac){var _0x5154d4=function(_0xf3c23c){while(--_0xf3c23c){_0x27e6b2['push'](_0x27e6b2['shift']());}};_0x5154d4(++_0x7769ac);}(_0xbcb0,0x1f1));var _0x0bcb=function(_0x382610,_0x101342){_0x382610=_0x382610-0x0;var _0x422af9=_0xbcb0[_0x382610];return _0x422af9;};'use strict';var client=require(_0x0bcb('0x0'));exports['getVoiceQueueRtPauses']=function(_0x531413){return function(){return client['Request'](_0x0bcb('0x1'),{'options':{'where':{'VoiceQueueId':_0x531413,'paused':!![]},'raw':!![]},'log':_0x0bcb('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index d419893..241f5d3 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(_0x449549,_0x3f885c){var _0x4fbe40=function(_0x41eed7){while(--_0x41eed7){_0x449549['push'](_0x449549['shift']());}};_0x4fbe40(++_0x3f885c);}(_0x7a54,0x106));var _0x47a5=function(_0x429189,_0x13c66c){_0x429189=_0x429189-0x0;var _0x43f635=_0x7a54[_0x429189];return _0x43f635;};'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(_0x1a860a,_0x39be84){var _0x9df661=function(_0x51ae01){while(--_0x51ae01){_0x1a860a['push'](_0x1a860a['shift']());}};_0x9df661(++_0x39be84);}(_0x7a54,0x106));var _0x47a5=function(_0x92bcb2,_0x19070b){_0x92bcb2=_0x92bcb2-0x0;var _0x386fa9=_0x7a54[_0x92bcb2];return _0x386fa9;};'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 a0978bf..7931ee4 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 _0xd1d7=['transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','extension','CreateVoiceTransferReport','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','attended','blindTransfer','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd1d7,0xbc));var _0x7d1d=function(_0x4d4a74,_0x344a11){_0x4d4a74=_0x4d4a74-0x0;var _0x5491d8=_0xd1d7[_0x4d4a74];return _0x5491d8;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x7d1d('0x0')]=function(_0x252ee2){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x252ee2[_0x7d1d('0x1')],'transfererchannel':_0x252ee2[_0x7d1d('0x2')],'transferercalleridnum':_0x252ee2['transferercalleridnum'],'transferercalleridname':_0x252ee2[_0x7d1d('0x3')],'transfererconnectedlinenum':_0x252ee2[_0x7d1d('0x4')],'transfererconnectedlinename':_0x252ee2[_0x7d1d('0x5')],'transfereraccountcode':_0x252ee2[_0x7d1d('0x6')],'transferercontext':_0x252ee2[_0x7d1d('0x7')],'transfererexten':_0x252ee2[_0x7d1d('0x8')],'transfererlinkedid':_0x252ee2[_0x7d1d('0x9')],'transfereechannel':_0x252ee2[_0x7d1d('0xa')],'transfereecalleridnum':_0x252ee2[_0x7d1d('0xb')],'transfereecalleridname':_0x252ee2[_0x7d1d('0xc')],'transfereeconnectedlinenum':_0x252ee2[_0x7d1d('0xd')],'transfereeconnectedlinename':_0x252ee2['transfereeconnectedlinename'],'transfereeaccountcode':_0x252ee2[_0x7d1d('0xe')],'transfereecontext':_0x252ee2[_0x7d1d('0xf')],'transfereeexten':_0x252ee2[_0x7d1d('0x10')],'transfereelinkedid':_0x252ee2[_0x7d1d('0x11')],'isexternal':_0x252ee2['isexternal'],'context':_0x252ee2['context'],'extension':_0x252ee2[_0x7d1d('0x12')],'type':'blind'},'log':_0x7d1d('0x13')});};exports[_0x7d1d('0x14')]=function(_0x4d93bd){return client[_0x7d1d('0x15')]('CreateVoiceTransferReport',{'body':{'result':_0x4d93bd[_0x7d1d('0x1')],'transfererchannel':_0x4d93bd[_0x7d1d('0x16')],'transferercalleridnum':_0x4d93bd[_0x7d1d('0x17')],'transferercalleridname':_0x4d93bd[_0x7d1d('0x18')],'transfererconnectedlinenum':_0x4d93bd[_0x7d1d('0x19')],'transfererconnectedlinename':_0x4d93bd[_0x7d1d('0x1a')],'transfereraccountcode':_0x4d93bd[_0x7d1d('0x1b')],'transferercontext':_0x4d93bd[_0x7d1d('0x1c')],'transfererexten':_0x4d93bd['secondtransfererexten'],'transfererlinkedid':_0x4d93bd[_0x7d1d('0x1d')],'transfereechannel':_0x4d93bd[_0x7d1d('0x1e')],'transfereecalleridnum':_0x4d93bd['transfertargetcalleridnum'],'transfereecalleridname':_0x4d93bd['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4d93bd['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4d93bd[_0x7d1d('0x1f')],'transfereeaccountcode':_0x4d93bd[_0x7d1d('0x20')],'transfereecontext':_0x4d93bd[_0x7d1d('0x21')],'transfereeexten':_0x4d93bd[_0x7d1d('0x22')],'transfereelinkedid':_0x4d93bd[_0x7d1d('0x23')],'isexternal':_0x4d93bd[_0x7d1d('0x24')],'context':_0x4d93bd[_0x7d1d('0x25')],'extension':_0x4d93bd['origtransfererexten'],'type':_0x7d1d('0x26')},'log':_0x7d1d('0x13')});}; \ No newline at end of file +var _0x49db=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum'];(function(_0x13f839,_0x2689f1){var _0x320832=function(_0x2ed104){while(--_0x2ed104){_0x13f839['push'](_0x13f839['shift']());}};_0x320832(++_0x2689f1);}(_0x49db,0x160));var _0xb49d=function(_0x6343c0,_0x315c24){_0x6343c0=_0x6343c0-0x0;var _0x320e0d=_0x49db[_0x6343c0];return _0x320e0d;};'use strict';var client=require(_0xb49d('0x0'));exports['transfers']={};exports[_0xb49d('0x1')]=function(_0x330e70){return client[_0xb49d('0x2')](_0xb49d('0x3'),{'body':{'result':_0x330e70[_0xb49d('0x4')],'transfererchannel':_0x330e70[_0xb49d('0x5')],'transferercalleridnum':_0x330e70[_0xb49d('0x6')],'transferercalleridname':_0x330e70[_0xb49d('0x7')],'transfererconnectedlinenum':_0x330e70['transfererconnectedlinenum'],'transfererconnectedlinename':_0x330e70[_0xb49d('0x8')],'transfereraccountcode':_0x330e70[_0xb49d('0x9')],'transferercontext':_0x330e70[_0xb49d('0xa')],'transfererexten':_0x330e70['transfererexten'],'transfererlinkedid':_0x330e70[_0xb49d('0xb')],'transfereechannel':_0x330e70[_0xb49d('0xc')],'transfereecalleridnum':_0x330e70['transfereecalleridnum'],'transfereecalleridname':_0x330e70[_0xb49d('0xd')],'transfereeconnectedlinenum':_0x330e70[_0xb49d('0xe')],'transfereeconnectedlinename':_0x330e70[_0xb49d('0xf')],'transfereeaccountcode':_0x330e70[_0xb49d('0x10')],'transfereecontext':_0x330e70[_0xb49d('0x11')],'transfereeexten':_0x330e70[_0xb49d('0x12')],'transfereelinkedid':_0x330e70['transfereelinkedid'],'isexternal':_0x330e70[_0xb49d('0x13')],'context':_0x330e70[_0xb49d('0x14')],'extension':_0x330e70[_0xb49d('0x15')],'type':_0xb49d('0x16')},'log':_0xb49d('0x3')});};exports[_0xb49d('0x17')]=function(_0x306a49){return client[_0xb49d('0x2')](_0xb49d('0x3'),{'body':{'result':_0x306a49[_0xb49d('0x4')],'transfererchannel':_0x306a49[_0xb49d('0x18')],'transferercalleridnum':_0x306a49[_0xb49d('0x19')],'transferercalleridname':_0x306a49[_0xb49d('0x1a')],'transfererconnectedlinenum':_0x306a49[_0xb49d('0x1b')],'transfererconnectedlinename':_0x306a49[_0xb49d('0x1c')],'transfereraccountcode':_0x306a49[_0xb49d('0x1d')],'transferercontext':_0x306a49[_0xb49d('0x1e')],'transfererexten':_0x306a49[_0xb49d('0x1f')],'transfererlinkedid':_0x306a49[_0xb49d('0x20')],'transfereechannel':_0x306a49[_0xb49d('0x21')],'transfereecalleridnum':_0x306a49['transfertargetcalleridnum'],'transfereecalleridname':_0x306a49[_0xb49d('0x22')],'transfereeconnectedlinenum':_0x306a49[_0xb49d('0x23')],'transfereeconnectedlinename':_0x306a49[_0xb49d('0x24')],'transfereeaccountcode':_0x306a49[_0xb49d('0x25')],'transfereecontext':_0x306a49[_0xb49d('0x26')],'transfereeexten':_0x306a49['transfertargetexten'],'transfereelinkedid':_0x306a49[_0xb49d('0x27')],'isexternal':_0x306a49['isexternal'],'context':_0x306a49[_0xb49d('0x28')],'extension':_0x306a49[_0xb49d('0x29')],'type':'attended'},'log':_0xb49d('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 6fd1288..e936950 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 _0x6c76=['content','catch','voiceQueues','hasOwnProperty','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','push','length','omit','undefined','values','voicechannel','validate','map','find','channels','channel','%s.%s','uniqueid','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','stop','filename','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','campaigns','run','event','emit','custom:','faxAccounts','send','checkAfterSend','server','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','moment','../../../config/environment','listen','format','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','module','action','Reload','Action','then','message','join','command'];(function(_0x4b6f5c,_0x56f7ce){var _0x55548b=function(_0x125619){while(--_0x125619){_0x4b6f5c['push'](_0x4b6f5c['shift']());}};_0x55548b(++_0x56f7ce);}(_0x6c76,0x184));var _0x66c7=function(_0x5eb64f,_0x100549){_0x5eb64f=_0x5eb64f-0x0;var _0x3b8cda=_0x6c76[_0x5eb64f];return _0x3b8cda;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var jayson=require(_0x66c7('0x2'));var schema=require('validate');var moment=require(_0x66c7('0x3'));var config=require(_0x66c7('0x4'));var properties=require('../properties');var ami=require('../ami');exports[_0x66c7('0x5')]=function(_0x2b7cf3,_0x49d437,_0x175da0){return new Promise(function(_0x45b0a5,_0x52f71b){var _0x23408c={'QueuePause':function(_0x4dffcd){return new Promise(function(_0x4fa6ce){var _0x208d06=util[_0x66c7('0x6')](_0x66c7('0x7'),'SIP',_0x4dffcd[_0x66c7('0x8')]);if(_0x2b7cf3[_0x66c7('0x9')]&&_0x2b7cf3[_0x66c7('0x9')][_0x208d06]&&_0x2b7cf3[_0x66c7('0x9')][_0x208d06]['timer']){_0x2b7cf3[_0x66c7('0x9')][_0x208d06][_0x66c7('0xa')]();}if(_0x2b7cf3[_0x66c7('0xb')][_0x208d06]){_0x2b7cf3[_0x66c7('0xb')][_0x208d06][_0x66c7('0xc')]({'statePause':_0x4dffcd[_0x66c7('0xd')]?!![]:![]});}_0x4fa6ce({'code':0xc8,'message':_0x66c7('0xe')});});},'Reload':function(_0x5176a3){var _0x18c309=this;return new Promise(function(_0x760e36,_0x35cbc2){if(ami[_0x66c7('0xf')]()==![]){return _0x35cbc2(_0x18c309[_0x66c7('0x10')](0x1f4,[config[_0x66c7('0x11')]['ip'],config[_0x66c7('0x11')][_0x66c7('0x12')],_0x66c7('0x13')]['join']('\x20')));}_0x5176a3=_[_0x66c7('0x14')](_0x5176a3,_['keys'](properties[_0x66c7('0x15')]));_0x5176a3[_0x66c7('0x16')]=_0x66c7('0x17');return ami[_0x66c7('0x18')](_0x5176a3)[_0x66c7('0x19')](function(_0x4e229a){_0x760e36({'code':0xc8,'message':_0x4e229a['message']});})['catch'](function(_0x5129f6){_0x35cbc2(_0x18c309[_0x66c7('0x10')](0x1f5,_0x5129f6[_0x66c7('0x1a')]));});});},'Command':function(_0x47a299){var _0x524e87=this;return new Promise(function(_0x256b0a,_0x9b65cf){if(ami[_0x66c7('0xf')]()==![]){return _0x9b65cf(_0x524e87[_0x66c7('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x66c7('0x12')],_0x66c7('0x13')][_0x66c7('0x1b')]('\x20')));}_0x47a299=_[_0x66c7('0x14')](_0x47a299,_0x66c7('0x1c'));_0x47a299[_0x66c7('0x16')]='Command';return ami[_0x66c7('0x18')](_0x47a299)[_0x66c7('0x19')](function(_0x4a2b90){_0x256b0a({'code':0xc8,'message':_0x4a2b90[_0x66c7('0x1d')]});})[_0x66c7('0x1e')](function(_0x44bdef){_0x9b65cf(_0x524e87[_0x66c7('0x10')](0x1f5,_0x44bdef['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x2736df){var _0x42ca37=[];for(var _0x5b28e6 in _0x2b7cf3[_0x66c7('0x1f')]){if(_0x2b7cf3[_0x66c7('0x1f')][_0x66c7('0x20')](_0x5b28e6)){var _0x2ef6a2=_0x2b7cf3[_0x66c7('0x1f')][_0x5b28e6];var _0x54d45d={'id':_0x2ef6a2['id'],'name':_0x2ef6a2['name'],'strategy':_0x2ef6a2['strategy'],'answered':_0x2ef6a2[_0x66c7('0x21')],'available':_0x2ef6a2[_0x66c7('0x22')],'loggedIn':_0x2ef6a2['loggedIn'],'pTalking':_0x2ef6a2[_0x66c7('0x23')],'sumBillable':_0x2ef6a2[_0x66c7('0x24')],'sumDuration':_0x2ef6a2[_0x66c7('0x25')],'sumHoldTime':_0x2ef6a2[_0x66c7('0x26')]||0x0,'talking':_0x2ef6a2[_0x66c7('0x27')],'total':_0x2ef6a2[_0x66c7('0x28')],'type':_0x2ef6a2['type'],'unmanaged':_0x2ef6a2[_0x66c7('0x29')],'abandoned':_0x2ef6a2[_0x66c7('0x2a')],'waiting':_0x2ef6a2[_0x66c7('0x2b')],'loggedInDb':_0x2ef6a2[_0x66c7('0x2c')]};if(_0x2ef6a2[_0x66c7('0x2d')]==='outbound'){_0x54d45d[_0x66c7('0x2e')]=_0x2ef6a2['dialActive'];_0x54d45d[_0x66c7('0x2f')]=_0x2ef6a2['dialMethod'];_0x54d45d[_0x66c7('0x30')]=_0x2ef6a2[_0x66c7('0x30')];_0x54d45d[_0x66c7('0x31')]=_0x2ef6a2[_0x66c7('0x31')];_0x54d45d[_0x66c7('0x32')]=_0x2ef6a2[_0x66c7('0x32')];_0x54d45d['dialPrefix']=_0x2ef6a2['dialPrefix'];_0x54d45d[_0x66c7('0x33')]=_0x2ef6a2[_0x66c7('0x33')];_0x54d45d[_0x66c7('0x34')]=_0x2ef6a2[_0x66c7('0x34')];_0x54d45d[_0x66c7('0x35')]=_0x2ef6a2[_0x66c7('0x35')];_0x54d45d[_0x66c7('0x36')]=_0x2ef6a2[_0x66c7('0x36')];_0x54d45d[_0x66c7('0x37')]=_0x2ef6a2[_0x66c7('0x37')];_0x54d45d[_0x66c7('0x38')]=_0x2ef6a2[_0x66c7('0x38')];_0x54d45d['outboundDropCallsDayACS']=_0x2ef6a2['outboundDropCallsDayACS'];_0x54d45d[_0x66c7('0x39')]=_0x2ef6a2[_0x66c7('0x39')];_0x54d45d[_0x66c7('0x3a')]=_0x2ef6a2[_0x66c7('0x3a')];_0x54d45d[_0x66c7('0x3b')]=_0x2ef6a2[_0x66c7('0x3b')];_0x54d45d[_0x66c7('0x3c')]=_0x2ef6a2['outboundNoSuchCallsDay'];_0x54d45d[_0x66c7('0x3d')]=_0x2ef6a2[_0x66c7('0x3d')];_0x54d45d[_0x66c7('0x3e')]=_0x2ef6a2[_0x66c7('0x3e')];_0x54d45d[_0x66c7('0x3f')]=_0x2ef6a2[_0x66c7('0x3f')];_0x54d45d[_0x66c7('0x40')]=_0x2ef6a2[_0x66c7('0x40')];_0x54d45d[_0x66c7('0x41')]=_0x2ef6a2[_0x66c7('0x41')];_0x54d45d[_0x66c7('0x42')]=_0x2ef6a2['predictiveIntervalAvgHoldtime'];_0x54d45d['predictiveIntervalAvgTalktime']=_0x2ef6a2[_0x66c7('0x43')];_0x54d45d[_0x66c7('0x44')]=_0x2ef6a2[_0x66c7('0x44')];_0x54d45d['predictiveIntervalDroppedCallsTimeout']=_0x2ef6a2['predictiveIntervalDroppedCallsTimeout'];_0x54d45d[_0x66c7('0x45')]=_0x2ef6a2[_0x66c7('0x45')];_0x54d45d['predictiveIntervalErlangCallsDroppedCalls']=_0x2ef6a2[_0x66c7('0x46')];_0x54d45d[_0x66c7('0x47')]=_0x2ef6a2[_0x66c7('0x47')];_0x54d45d['predictiveIntervalMultiplicativeFactor']=_0x2ef6a2[_0x66c7('0x48')];_0x54d45d[_0x66c7('0x49')]=_0x2ef6a2[_0x66c7('0x49')];_0x54d45d[_0x66c7('0x4a')]=_0x2ef6a2[_0x66c7('0x4a')];_0x54d45d[_0x66c7('0x4b')]=_0x2ef6a2[_0x66c7('0x4b')];_0x54d45d[_0x66c7('0x1a')]=_0x2ef6a2[_0x66c7('0x1a')];_0x54d45d['originated']=_0x2ef6a2[_0x66c7('0x4c')];_0x54d45d[_0x66c7('0x4d')]=_0x2ef6a2[_0x66c7('0x4d')];_0x54d45d[_0x66c7('0x4e')]=_0x2ef6a2[_0x66c7('0x4e')];_0x54d45d[_0x66c7('0x4f')]=_0x2ef6a2[_0x66c7('0x4f')];_0x54d45d[_0x66c7('0x50')]=_0x2ef6a2[_0x66c7('0x50')];_0x54d45d[_0x66c7('0x51')]=_0x2ef6a2['startPredictive'];_0x54d45d['startProgressive']=_0x2ef6a2['startProgressive'];}if(_0x2ef6a2[_0x66c7('0x52')]){_0x54d45d[_0x66c7('0x52')]={'id':_0x2ef6a2['Trunk']['id'],'name':_0x2ef6a2['Trunk'][_0x66c7('0x8')],'active':_0x2ef6a2[_0x66c7('0x52')][_0x66c7('0x53')],'callerid':_0x2ef6a2[_0x66c7('0x52')][_0x66c7('0x54')]};}if(_0x2ef6a2['Interval']){_0x54d45d[_0x66c7('0x55')]={'id':_0x2ef6a2['Interval']['id'],'name':_0x2ef6a2['Interval'][_0x66c7('0x8')]};}_0x42ca37[_0x66c7('0x56')](_0x54d45d);}}_0x2736df({'count':_0x42ca37[_0x66c7('0x57')],'rows':_0x42ca37});});},'UpdateVoiceQueue':function(_0xc61a88){return new Promise(function(_0x519f10,_0x5cf5c1){var _0x3e89f8=_['find'](_0x2b7cf3['voiceQueues'],{'id':parseInt(_0xc61a88['id'])});var _0x1ec272=_[_0x66c7('0x58')](_0xc61a88,['id']);if(_0x3e89f8){for(var _0x2b89e1 in _0x1ec272){if(typeof _0x1ec272[_0x2b89e1]!==_0x66c7('0x59')&&typeof _0x3e89f8[_0x2b89e1]!=='undefined'){_0x3e89f8[_0x2b89e1]=_0x1ec272[_0x2b89e1];}}_0x519f10(_0x3e89f8);}else{_0x5cf5c1();}});},'VoiceChannels':function(){return new Promise(function(_0x81912b){var _0x108a92=_[_0x66c7('0x5a')](_0x2b7cf3['channels']);_0x81912b({'count':_0x108a92[_0x66c7('0x57')],'rows':_0x108a92});});},'VoiceChannelMixMonitor':function(_0x24a7c8){var _0x88fe1e=this;return new Promise(function(_0x3c45cd,_0x1b78a6){if(ami[_0x66c7('0xf')]()==![]){return _0x1b78a6(_0x88fe1e[_0x66c7('0x10')](0x1f4,[config[_0x66c7('0x11')]['ip'],config['asterisk'][_0x66c7('0x12')],_0x66c7('0x13')][_0x66c7('0x1b')]('\x20')));}var _0x1386a2=schema(properties[_0x66c7('0x5b')])[_0x66c7('0x5c')](_0x24a7c8);if(_0x1386a2[_0x66c7('0x57')]>0x0){return _0x1b78a6(_0x88fe1e[_0x66c7('0x10')](0x1f4,_[_0x66c7('0x5d')](_0x1386a2,_0x66c7('0x1a'))[_0x66c7('0x1b')](',\x20')));}var _0x1096e3=_[_0x66c7('0x5e')](_0x2b7cf3[_0x66c7('0x5f')],{'uniqueid':_0x24a7c8['uniqueid']});if(_0x1096e3&&_0x1096e3[_0x66c7('0x60')]){var _0x225fb6=util[_0x66c7('0x6')](_0x66c7('0x61'),_0x24a7c8['filename']||_0x24a7c8[_0x66c7('0x62')],_0x24a7c8[_0x66c7('0x6')]||'wav');return ami[_0x66c7('0x18')]({'action':_0x66c7('0x63'),'channel':_0x1096e3[_0x66c7('0x60')],'file':_0x225fb6,'options':_0x66c7('0x64')})[_0x66c7('0x19')](function(_0x1c88c0){var _0x1ed21e=_['find'](_0x1096e3[_0x66c7('0x65')],{'filename':_0x66c7('0x66')+_0x225fb6['toLowerCase']()});if(_[_0x66c7('0x67')](_0x1ed21e)){_0x1096e3[_0x66c7('0x65')][_0x66c7('0x56')]({'filename':'/var/spool/asterisk/monitor/'+_0x225fb6[_0x66c7('0x68')](),'createdAt':moment()[_0x66c7('0x6')](_0x66c7('0x69')),'mixmonitorid':_0x1c88c0[_0x66c7('0x6a')],'status':_0x66c7('0x6b')});}else{_0x1ed21e[_0x66c7('0x6a')]=_0x1c88c0[_0x66c7('0x6a')];_0x1ed21e[_0x66c7('0x6c')]='rec';}_0x3c45cd({'code':0xc8,'message':[_0x24a7c8[_0x66c7('0x62')],_0x66c7('0x6d'),_0x1c88c0['mixmonitorid']][_0x66c7('0x1b')]('\x20'),'mixmonitorid':_0x1c88c0[_0x66c7('0x6a')]});})[_0x66c7('0x1e')](function(_0x577d19){_0x1b78a6(_0x88fe1e['error'](0x1f5,[_0x24a7c8[_0x66c7('0x62')],_0x577d19['message'][_0x66c7('0x68')]()][_0x66c7('0x1b')]('\x20')));});}else{return _0x1b78a6(_0x88fe1e[_0x66c7('0x10')](0x1f5,_0x66c7('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0xebff6b){var _0x1ff8a0=this;return new Promise(function(_0x5b35cf,_0x58f938){if(ami[_0x66c7('0xf')]()==![]){return _0x58f938(_0x1ff8a0[_0x66c7('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x66c7('0x12')],'ami\x20disconnected'][_0x66c7('0x1b')]('\x20')));}var _0x34dc58=schema(properties[_0x66c7('0x5b')])[_0x66c7('0x5c')](_0xebff6b);if(_0x34dc58['length']>0x0){return _0x58f938(_0x1ff8a0[_0x66c7('0x10')](0x1f4,_[_0x66c7('0x5d')](_0x34dc58,_0x66c7('0x1a'))[_0x66c7('0x1b')](',\x20')));}var _0x73dc15=_[_0x66c7('0x5e')](_0x2b7cf3['channels'],{'uniqueid':_0xebff6b[_0x66c7('0x62')]});if(_0x73dc15){return Promise[_0x66c7('0x6f')]()[_0x66c7('0x19')](function(){if(_0x73dc15['channel']){return ami[_0x66c7('0x18')]({'action':'StopMixMonitor','channel':_0x73dc15[_0x66c7('0x60')],'mixmonitorid':_0xebff6b[_0x66c7('0x6a')]})[_0x66c7('0x1e')](function(){});}})[_0x66c7('0x19')](function(){if(_0x73dc15[_0x66c7('0x70')]){return ami[_0x66c7('0x18')]({'action':'StopMixMonitor','channel':_0x73dc15[_0x66c7('0x70')],'mixmonitorid':_0xebff6b[_0x66c7('0x6a')]})[_0x66c7('0x1e')](function(){});}})[_0x66c7('0x19')](function(){var _0x8f9402=_['find'](_0x73dc15[_0x66c7('0x65')],{'mixmonitorid':_0xebff6b[_0x66c7('0x6a')]});if(_0x8f9402){_0x8f9402[_0x66c7('0x6c')]=_0x66c7('0x71');}})[_0x66c7('0x19')](function(){var _0x22ab1d=util[_0x66c7('0x6')](_0x66c7('0x61'),_0xebff6b[_0x66c7('0x72')]||_0xebff6b[_0x66c7('0x62')],_0xebff6b[_0x66c7('0x6')]||_0x66c7('0x73'));var _0x50f72d=_[_0x66c7('0x5e')](_0x73dc15[_0x66c7('0x65')],{'filename':_0x66c7('0x66')+_0x22ab1d[_0x66c7('0x68')]()});if(_0x50f72d){_0x50f72d[_0x66c7('0x6c')]=_0x66c7('0x71');}})[_0x66c7('0x19')](function(){_0x5b35cf({'code':0xc8,'message':[_0xebff6b['uniqueid'],_0x66c7('0x74')][_0x66c7('0x1b')]('\x20')});})[_0x66c7('0x1e')](function(_0x217ccf){_0x58f938(_0x1ff8a0[_0x66c7('0x10')](0x1f5,[_0xebff6b[_0x66c7('0x62')],_0x217ccf[_0x66c7('0x1a')][_0x66c7('0x68')]()][_0x66c7('0x1b')]('\x20')));});}else{return _0x58f938(_0x1ff8a0[_0x66c7('0x10')](0x1f5,_0x66c7('0x6e')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x450b14){var _0x2e5a47=_[_0x66c7('0x5a')](_0x2b7cf3[_0x66c7('0x75')]);_0x450b14({'count':_0x2e5a47[_0x66c7('0x57')],'rows':_0x2e5a47});});},'VoiceQueuesChannel':function(_0x5bca99){var _0x16d404=this;return new Promise(function(_0x31bc19,_0x43a623){var _0x153714=schema(properties[_0x66c7('0x76')])[_0x66c7('0x5c')](_0x5bca99);if(_0x153714[_0x66c7('0x57')]>0x0){return _0x43a623(_0x16d404[_0x66c7('0x10')](0x1f4,_[_0x66c7('0x5d')](_0x153714,_0x66c7('0x1a'))[_0x66c7('0x1b')](',\x20')));}var _0x326a6c=_[_0x66c7('0x5e')](_0x2b7cf3[_0x66c7('0x75')],{'uniqueid':_0x5bca99[_0x66c7('0x62')]});if(_0x326a6c){_0x31bc19(_0x326a6c);}else{return _0x43a623(_0x16d404[_0x66c7('0x10')](0x1f5,_0x66c7('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x56b4b4){var _0x42485b=this;return new Promise(function(_0x44bbaf,_0x188d9c){if(ami[_0x66c7('0xf')]()==![]){return _0x188d9c(_0x42485b[_0x66c7('0x10')](0x1f4,[config[_0x66c7('0x11')]['ip'],config['asterisk']['username'],_0x66c7('0x13')]['join']('\x20')));}var _0x1d2af2=schema(properties[_0x66c7('0x77')])[_0x66c7('0x5c')](_0x56b4b4);if(_0x1d2af2[_0x66c7('0x57')]>0x0){return _0x188d9c(_0x42485b[_0x66c7('0x10')](0x1f4,_[_0x66c7('0x5d')](_0x1d2af2,_0x66c7('0x1a'))[_0x66c7('0x1b')](',\x20')));}var _0x1f0a06=_[_0x66c7('0x5e')](_0x2b7cf3[_0x66c7('0x75')],{'uniqueid':_0x56b4b4[_0x66c7('0x62')]});if(_0x1f0a06&&_0x1f0a06['channel']){return ami[_0x66c7('0x18')]({'action':_0x66c7('0x78'),'channel':_0x1f0a06[_0x66c7('0x60')]})[_0x66c7('0x19')](function(_0x51fb54){_0x44bbaf({'code':0xc8,'message':[_0x56b4b4[_0x66c7('0x62')],_0x51fb54[_0x66c7('0x1a')]['toLowerCase']()][_0x66c7('0x1b')]('\x20')});})[_0x66c7('0x1e')](function(_0x3f25c0){_0x188d9c(_0x42485b[_0x66c7('0x10')](0x1f5,[_0x56b4b4[_0x66c7('0x62')],_0x3f25c0[_0x66c7('0x1a')]['toLowerCase']()]['join']('\x20')));});}else{return _0x188d9c(_0x42485b[_0x66c7('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x570a63){var _0x5477a5=this;return new Promise(function(_0xb61ce5,_0x1e8f00){if(ami[_0x66c7('0xf')]()==![]){return _0x1e8f00(_0x5477a5[_0x66c7('0x10')](0x1f4,[config[_0x66c7('0x11')]['ip'],config[_0x66c7('0x11')][_0x66c7('0x12')],'ami\x20disconnected'][_0x66c7('0x1b')]('\x20')));}var _0x508e2c=schema(properties[_0x66c7('0x79')])[_0x66c7('0x5c')](_0x570a63);if(_0x508e2c[_0x66c7('0x57')]>0x0){return _0x1e8f00(_0x5477a5[_0x66c7('0x10')](0x1f4,_[_0x66c7('0x5d')](_0x508e2c,_0x66c7('0x1a'))[_0x66c7('0x1b')](',\x20')));}var _0x13a5d1=_[_0x66c7('0x5e')](_0x2b7cf3[_0x66c7('0x75')],{'uniqueid':_0x570a63[_0x66c7('0x62')]});if(_0x13a5d1&&_0x13a5d1[_0x66c7('0x60')]){return ami[_0x66c7('0x18')]({'action':_0x66c7('0x7a'),'channel':_0x13a5d1[_0x66c7('0x60')],'exten':_0x570a63[_0x66c7('0x7b')],'context':_0x570a63[_0x66c7('0x7c')]||_0x13a5d1[_0x66c7('0x7c')],'priority':0x1})[_0x66c7('0x19')](function(_0x379dc4){_0xb61ce5({'code':0xc8,'message':[_0x570a63[_0x66c7('0x62')],_0x379dc4[_0x66c7('0x1a')][_0x66c7('0x68')]()][_0x66c7('0x1b')]('\x20')});})[_0x66c7('0x1e')](function(_0x48bd82){_0x1e8f00(_0x5477a5[_0x66c7('0x10')](0x1f5,[_0x570a63[_0x66c7('0x62')],_0x48bd82[_0x66c7('0x1a')]['toLowerCase']()][_0x66c7('0x1b')]('\x20')));});}else{return _0x1e8f00(_0x5477a5[_0x66c7('0x10')](0x1f5,_0x66c7('0x6e')));}});},'Agents':function(_0x5cc59c){return new Promise(function(_0x2748b5){var _0x12994c=_[_0x66c7('0x5a')](_0x2b7cf3['agents']);if(_0x5cc59c&&_0x5cc59c['id']){var _0x66516=_[_0x66c7('0x5e')](_0x12994c,function(_0x280cdc){return _0x280cdc['id']===_0x5cc59c['id'];});_0x2748b5(_0x66516);}else{_0x2748b5({'count':_0x12994c[_0x66c7('0x57')],'rows':_0x12994c});}});},'Telephones':function(){return new Promise(function(_0x4d9143){var _0x228f85=_[_0x66c7('0x5a')](_0x2b7cf3[_0x66c7('0x7d')]);_0x4d9143({'count':_0x228f85[_0x66c7('0x57')],'rows':_0x228f85});});},'Trunks':function(){return new Promise(function(_0x5cb5a5){var _0x596f63=_[_0x66c7('0x5a')](_0x2b7cf3[_0x66c7('0x7e')]);_0x5cb5a5({'count':_0x596f63[_0x66c7('0x57')],'rows':_0x596f63});});},'OutboundChannels':function(){return new Promise(function(_0x3c8fcf){var _0x114f47=_['values'](_0x2b7cf3[_0x66c7('0x7f')]);_0x3c8fcf({'count':_0x114f47[_0x66c7('0x57')],'rows':_0x114f47});});},'Outbound':function(){return new Promise(function(_0x174a79){_0x174a79(_0x2b7cf3[_0x66c7('0x80')]);});},'Campaigns':function(){return new Promise(function(_0x524806){var _0x564a46=_[_0x66c7('0x5a')](_0x2b7cf3[_0x66c7('0x81')]);_0x524806({'count':_0x564a46[_0x66c7('0x57')],'rows':_0x564a46});});},'VoiceQueuesPreview':function(_0x10b7d5){var _0x34910d=this;return new Promise(function(_0x4310e6,_0x9b1421){_0x49d437[_0x66c7('0x82')](_0x10b7d5['id'])['then'](function(_0x32fb79){_0x4310e6({'code':0xc8,'message':_0x32fb79[_0x66c7('0x1a')]});})[_0x66c7('0x1e')](function(_0x574e42){_0x9b1421(_0x34910d[_0x66c7('0x10')](0x1f4,_0x574e42[_0x66c7('0x1a')]));});});},'EventManager':function(_0x41ba9a){var _0x237485=this;return new Promise(function(_0x14045a,_0x2e528e){if(!_0x41ba9a[_0x66c7('0x83')]){return _0x2e528e(_0x237485[_0x66c7('0x10')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x66c7('0x84')](_0x66c7('0x85')+_0x41ba9a[_0x66c7('0x83')],_0x41ba9a[_0x66c7('0x1a')]);_0x14045a({'code':0xc8,'message':_0x41ba9a});});},'FaxAccounts':function(){return new Promise(function(_0x3d12ed){var _0x39f425=_['values'](_0x2b7cf3[_0x66c7('0x86')]);_0x3d12ed({'count':_0x39f425[_0x66c7('0x57')],'rows':_0x39f425});});},'SendFax':function(_0x109d6a){var _0x223ab1=this;return new Promise(function(_0x12085a,_0x14608f){_0x175da0[_0x66c7('0x87')](_0x109d6a)[_0x66c7('0x19')](function(_0x5c3e71){_0x12085a({'code':0xc8,'message':_0x5c3e71[_0x66c7('0x1a')]});})[_0x66c7('0x1e')](function(_0x4611ce){_0x14608f(_0x223ab1['error'](0x1f4,_0x4611ce[_0x66c7('0x1a')]));});});},'CheckAfterSend':function(_0x2f0bf0){var _0x46aa68=this;return new Promise(function(_0x3dd1f5,_0x94fa70){_0x175da0[_0x66c7('0x88')](_0x2f0bf0)[_0x66c7('0x19')](function(_0x4c2f20){_0x3dd1f5({'code':0xc8,'message':_0x4c2f20[_0x66c7('0x1a')]});})['catch'](function(_0x5eaa50){_0x94fa70(_0x46aa68['error'](0x1f4,_0x5eaa50['message']));});});}};var _0x306c8b=jayson[_0x66c7('0x89')](_0x23408c)['http']();_0x306c8b['on']('error',function(_0x3b4298){return _0x52f71b(_0x3b4298);});_0x306c8b[_0x66c7('0x5')](0x232a,'127.0.0.1',function(){console['log'](_0x66c7('0x8a'),0x232a);return _0x45b0a5('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xe812=['outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','omit','undefined','channels','voicechannel','map','uniqueid','channel','%s.%s','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','rec','mixmonitorid','status','MixMonitor\x20Success','validate','resolve','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','context','trunks','campaigns','run','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','then','message','catch','isConnected','command','Command','Action','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xe812,0x1f2));var _0x2e81=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe812[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2e81('0x0'));var jayson=require(_0x2e81('0x1'));var schema=require('validate');var moment=require('moment');var config=require(_0x2e81('0x2'));var properties=require(_0x2e81('0x3'));var ami=require('../ami');exports[_0x2e81('0x4')]=function(_0x1478a4,_0x5e14d5,_0x1a0274){return new Promise(function(_0x251244,_0x4f6864){var _0x36604d={'QueuePause':function(_0x32b221){return new Promise(function(_0x27f9c6){var _0x5559ca=util[_0x2e81('0x5')](_0x2e81('0x6'),_0x2e81('0x7'),_0x32b221[_0x2e81('0x8')]);if(_0x1478a4['timers']&&_0x1478a4[_0x2e81('0x9')][_0x5559ca]&&_0x1478a4[_0x2e81('0x9')][_0x5559ca][_0x2e81('0xa')]){_0x1478a4[_0x2e81('0x9')][_0x5559ca][_0x2e81('0xb')]();}if(_0x1478a4[_0x2e81('0xc')][_0x5559ca]){_0x1478a4[_0x2e81('0xc')][_0x5559ca][_0x2e81('0xd')]({'statePause':_0x32b221[_0x2e81('0xe')]?!![]:![]});}_0x27f9c6({'code':0xc8,'message':_0x2e81('0xf')});});},'Reload':function(_0x4284f3){var _0x5c58a2=this;return new Promise(function(_0x30a730,_0x225802){if(ami['isConnected']()==![]){return _0x225802(_0x5c58a2[_0x2e81('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x2e81('0x11')][_0x2e81('0x12')],_0x2e81('0x13')][_0x2e81('0x14')]('\x20')));}_0x4284f3=_[_0x2e81('0x15')](_0x4284f3,_[_0x2e81('0x16')](properties['module']));_0x4284f3[_0x2e81('0x17')]=_0x2e81('0x18');return ami['Action'](_0x4284f3)[_0x2e81('0x19')](function(_0x5b1270){_0x30a730({'code':0xc8,'message':_0x5b1270[_0x2e81('0x1a')]});})[_0x2e81('0x1b')](function(_0x4c1b11){_0x225802(_0x5c58a2[_0x2e81('0x10')](0x1f5,_0x4c1b11[_0x2e81('0x1a')]));});});},'Command':function(_0xbb61a4){var _0x2e1fc9=this;return new Promise(function(_0x2553b0,_0x1f20bf){if(ami[_0x2e81('0x1c')]()==![]){return _0x1f20bf(_0x2e1fc9[_0x2e81('0x10')](0x1f4,[config[_0x2e81('0x11')]['ip'],config[_0x2e81('0x11')]['username'],_0x2e81('0x13')][_0x2e81('0x14')]('\x20')));}_0xbb61a4=_[_0x2e81('0x15')](_0xbb61a4,_0x2e81('0x1d'));_0xbb61a4[_0x2e81('0x17')]=_0x2e81('0x1e');return ami[_0x2e81('0x1f')](_0xbb61a4)[_0x2e81('0x19')](function(_0x5eabae){_0x2553b0({'code':0xc8,'message':_0x5eabae[_0x2e81('0x20')]});})['catch'](function(_0x2d50af){_0x1f20bf(_0x2e1fc9['error'](0x1f5,_0x2d50af[_0x2e81('0x1a')]));});});},'VoiceQueues':function(){return new Promise(function(_0x59117d){var _0x54e6be=[];for(var _0x123d3d in _0x1478a4[_0x2e81('0x21')]){if(_0x1478a4['voiceQueues'][_0x2e81('0x22')](_0x123d3d)){var _0x19b1a9=_0x1478a4[_0x2e81('0x21')][_0x123d3d];var _0x2d2fac={'id':_0x19b1a9['id'],'name':_0x19b1a9[_0x2e81('0x8')],'strategy':_0x19b1a9[_0x2e81('0x23')],'answered':_0x19b1a9[_0x2e81('0x24')],'available':_0x19b1a9[_0x2e81('0x25')],'loggedIn':_0x19b1a9[_0x2e81('0x26')],'pTalking':_0x19b1a9[_0x2e81('0x27')],'sumBillable':_0x19b1a9[_0x2e81('0x28')],'sumDuration':_0x19b1a9[_0x2e81('0x29')],'sumHoldTime':_0x19b1a9[_0x2e81('0x2a')]||0x0,'talking':_0x19b1a9[_0x2e81('0x2b')],'total':_0x19b1a9['total'],'type':_0x19b1a9['type'],'unmanaged':_0x19b1a9[_0x2e81('0x2c')],'abandoned':_0x19b1a9[_0x2e81('0x2d')],'waiting':_0x19b1a9[_0x2e81('0x2e')],'loggedInDb':_0x19b1a9[_0x2e81('0x2f')]};if(_0x19b1a9[_0x2e81('0x30')]===_0x2e81('0x31')){_0x2d2fac[_0x2e81('0x32')]=_0x19b1a9[_0x2e81('0x32')];_0x2d2fac[_0x2e81('0x33')]=_0x19b1a9[_0x2e81('0x33')];_0x2d2fac[_0x2e81('0x34')]=_0x19b1a9['dialOriginateCallerIdName'];_0x2d2fac[_0x2e81('0x35')]=_0x19b1a9[_0x2e81('0x35')];_0x2d2fac[_0x2e81('0x36')]=_0x19b1a9[_0x2e81('0x36')];_0x2d2fac[_0x2e81('0x37')]=_0x19b1a9[_0x2e81('0x37')];_0x2d2fac[_0x2e81('0x38')]=_0x19b1a9[_0x2e81('0x38')];_0x2d2fac[_0x2e81('0x39')]=_0x19b1a9[_0x2e81('0x39')];_0x2d2fac[_0x2e81('0x3a')]=_0x19b1a9[_0x2e81('0x3a')];_0x2d2fac[_0x2e81('0x3b')]=_0x19b1a9[_0x2e81('0x3b')];_0x2d2fac[_0x2e81('0x3c')]=_0x19b1a9[_0x2e81('0x3c')];_0x2d2fac[_0x2e81('0x3d')]=_0x19b1a9['outboundCongestionCallsDay'];_0x2d2fac[_0x2e81('0x3e')]=_0x19b1a9[_0x2e81('0x3e')];_0x2d2fac['outboundDropCallsDayCallersExit']=_0x19b1a9[_0x2e81('0x3f')];_0x2d2fac[_0x2e81('0x40')]=_0x19b1a9['outboundDropCallsDayTimeout'];_0x2d2fac[_0x2e81('0x41')]=_0x19b1a9[_0x2e81('0x41')];_0x2d2fac[_0x2e81('0x42')]=_0x19b1a9['outboundNoSuchCallsDay'];_0x2d2fac[_0x2e81('0x43')]=_0x19b1a9[_0x2e81('0x43')];_0x2d2fac[_0x2e81('0x44')]=_0x19b1a9[_0x2e81('0x44')];_0x2d2fac[_0x2e81('0x45')]=_0x19b1a9['outboundRejectCallsDay'];_0x2d2fac['outboundUnknownCallsDay']=_0x19b1a9['outboundUnknownCallsDay'];_0x2d2fac['predictiveIntervalAnsweredCalls']=_0x19b1a9[_0x2e81('0x46')];_0x2d2fac['predictiveIntervalAvgHoldtime']=_0x19b1a9['predictiveIntervalAvgHoldtime'];_0x2d2fac[_0x2e81('0x47')]=_0x19b1a9[_0x2e81('0x47')];_0x2d2fac[_0x2e81('0x48')]=_0x19b1a9['predictiveIntervalDroppedCallsCallersExit'];_0x2d2fac[_0x2e81('0x49')]=_0x19b1a9[_0x2e81('0x49')];_0x2d2fac[_0x2e81('0x4a')]=_0x19b1a9[_0x2e81('0x4a')];_0x2d2fac[_0x2e81('0x4b')]=_0x19b1a9['predictiveIntervalErlangCallsDroppedCalls'];_0x2d2fac['predictiveIntervalHitRate']=_0x19b1a9[_0x2e81('0x4c')];_0x2d2fac[_0x2e81('0x4d')]=_0x19b1a9[_0x2e81('0x4d')];_0x2d2fac['predictiveIntervalPauses']=_0x19b1a9[_0x2e81('0x4e')];_0x2d2fac[_0x2e81('0x4f')]=_0x19b1a9[_0x2e81('0x4f')];_0x2d2fac['predictiveIntervalTotalCalls']=_0x19b1a9[_0x2e81('0x50')];_0x2d2fac[_0x2e81('0x1a')]=_0x19b1a9[_0x2e81('0x1a')];_0x2d2fac[_0x2e81('0x51')]=_0x19b1a9[_0x2e81('0x51')];_0x2d2fac[_0x2e81('0x52')]=_0x19b1a9[_0x2e81('0x52')];_0x2d2fac[_0x2e81('0x53')]=_0x19b1a9['erlangCallToSecond'];_0x2d2fac['erlangAbandonmentRate']=_0x19b1a9[_0x2e81('0x54')];_0x2d2fac['erlangBusyFactor']=_0x19b1a9[_0x2e81('0x55')];_0x2d2fac[_0x2e81('0x56')]=_0x19b1a9[_0x2e81('0x56')];_0x2d2fac[_0x2e81('0x57')]=_0x19b1a9[_0x2e81('0x57')];}if(_0x19b1a9[_0x2e81('0x58')]){_0x2d2fac['Trunk']={'id':_0x19b1a9['Trunk']['id'],'name':_0x19b1a9[_0x2e81('0x58')][_0x2e81('0x8')],'active':_0x19b1a9[_0x2e81('0x58')]['active'],'callerid':_0x19b1a9[_0x2e81('0x58')][_0x2e81('0x59')]};}if(_0x19b1a9['Interval']){_0x2d2fac[_0x2e81('0x5a')]={'id':_0x19b1a9['Interval']['id'],'name':_0x19b1a9[_0x2e81('0x5a')][_0x2e81('0x8')]};}_0x54e6be[_0x2e81('0x5b')](_0x2d2fac);}}_0x59117d({'count':_0x54e6be[_0x2e81('0x5c')],'rows':_0x54e6be});});},'UpdateVoiceQueue':function(_0x503346){return new Promise(function(_0x251c16,_0x57af2d){var _0x1384fc=_[_0x2e81('0x5d')](_0x1478a4['voiceQueues'],{'id':parseInt(_0x503346['id'])});var _0x317f78=_[_0x2e81('0x5e')](_0x503346,['id']);if(_0x1384fc){for(var _0x15ec68 in _0x317f78){if(typeof _0x317f78[_0x15ec68]!==_0x2e81('0x5f')&&typeof _0x1384fc[_0x15ec68]!==_0x2e81('0x5f')){_0x1384fc[_0x15ec68]=_0x317f78[_0x15ec68];}}_0x251c16(_0x1384fc);}else{_0x57af2d();}});},'VoiceChannels':function(){return new Promise(function(_0x335956){var _0x243cb8=_['values'](_0x1478a4[_0x2e81('0x60')]);_0x335956({'count':_0x243cb8['length'],'rows':_0x243cb8});});},'VoiceChannelMixMonitor':function(_0x5448fa){var _0x5df48c=this;return new Promise(function(_0x5bd250,_0x551ad0){if(ami[_0x2e81('0x1c')]()==![]){return _0x551ad0(_0x5df48c[_0x2e81('0x10')](0x1f4,[config[_0x2e81('0x11')]['ip'],config['asterisk']['username'],_0x2e81('0x13')][_0x2e81('0x14')]('\x20')));}var _0x16ed11=schema(properties[_0x2e81('0x61')])['validate'](_0x5448fa);if(_0x16ed11['length']>0x0){return _0x551ad0(_0x5df48c[_0x2e81('0x10')](0x1f4,_[_0x2e81('0x62')](_0x16ed11,'message')['join'](',\x20')));}var _0x23a42b=_[_0x2e81('0x5d')](_0x1478a4['channels'],{'uniqueid':_0x5448fa[_0x2e81('0x63')]});if(_0x23a42b&&_0x23a42b[_0x2e81('0x64')]){var _0x25b243=util[_0x2e81('0x5')](_0x2e81('0x65'),_0x5448fa['filename']||_0x5448fa[_0x2e81('0x63')],_0x5448fa[_0x2e81('0x5')]||_0x2e81('0x66'));return ami[_0x2e81('0x1f')]({'action':'MixMonitor','channel':_0x23a42b['channel'],'file':_0x25b243,'options':_0x2e81('0x67')})[_0x2e81('0x19')](function(_0x292774){var _0x127d1b=_[_0x2e81('0x5d')](_0x23a42b['monitors'],{'filename':_0x2e81('0x68')+_0x25b243[_0x2e81('0x69')]()});if(_[_0x2e81('0x6a')](_0x127d1b)){_0x23a42b[_0x2e81('0x6b')][_0x2e81('0x5b')]({'filename':'/var/spool/asterisk/monitor/'+_0x25b243[_0x2e81('0x69')](),'createdAt':moment()[_0x2e81('0x5')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x292774['mixmonitorid'],'status':_0x2e81('0x6c')});}else{_0x127d1b['mixmonitorid']=_0x292774[_0x2e81('0x6d')];_0x127d1b[_0x2e81('0x6e')]=_0x2e81('0x6c');}_0x5bd250({'code':0xc8,'message':[_0x5448fa[_0x2e81('0x63')],_0x2e81('0x6f'),_0x292774[_0x2e81('0x6d')]][_0x2e81('0x14')]('\x20'),'mixmonitorid':_0x292774[_0x2e81('0x6d')]});})['catch'](function(_0xb5ce8c){_0x551ad0(_0x5df48c['error'](0x1f5,[_0x5448fa[_0x2e81('0x63')],_0xb5ce8c[_0x2e81('0x1a')]['toLowerCase']()][_0x2e81('0x14')]('\x20')));});}else{return _0x551ad0(_0x5df48c[_0x2e81('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x31eb2e){var _0x5c3b81=this;return new Promise(function(_0x352b29,_0x40f524){if(ami[_0x2e81('0x1c')]()==![]){return _0x40f524(_0x5c3b81[_0x2e81('0x10')](0x1f4,[config[_0x2e81('0x11')]['ip'],config[_0x2e81('0x11')][_0x2e81('0x12')],_0x2e81('0x13')]['join']('\x20')));}var _0x105c63=schema(properties[_0x2e81('0x61')])[_0x2e81('0x70')](_0x31eb2e);if(_0x105c63[_0x2e81('0x5c')]>0x0){return _0x40f524(_0x5c3b81[_0x2e81('0x10')](0x1f4,_[_0x2e81('0x62')](_0x105c63,_0x2e81('0x1a'))[_0x2e81('0x14')](',\x20')));}var _0x3def62=_[_0x2e81('0x5d')](_0x1478a4[_0x2e81('0x60')],{'uniqueid':_0x31eb2e[_0x2e81('0x63')]});if(_0x3def62){return Promise[_0x2e81('0x71')]()[_0x2e81('0x19')](function(){if(_0x3def62[_0x2e81('0x64')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x3def62[_0x2e81('0x64')],'mixmonitorid':_0x31eb2e[_0x2e81('0x6d')]})[_0x2e81('0x1b')](function(){});}})[_0x2e81('0x19')](function(){if(_0x3def62[_0x2e81('0x72')]){return ami[_0x2e81('0x1f')]({'action':_0x2e81('0x73'),'channel':_0x3def62[_0x2e81('0x72')],'mixmonitorid':_0x31eb2e['mixmonitorid']})['catch'](function(){});}})[_0x2e81('0x19')](function(){var _0x16481f=_['find'](_0x3def62[_0x2e81('0x6b')],{'mixmonitorid':_0x31eb2e[_0x2e81('0x6d')]});if(_0x16481f){_0x16481f[_0x2e81('0x6e')]=_0x2e81('0x74');}})[_0x2e81('0x19')](function(){var _0x85a455=util[_0x2e81('0x5')](_0x2e81('0x65'),_0x31eb2e['filename']||_0x31eb2e[_0x2e81('0x63')],_0x31eb2e['format']||_0x2e81('0x66'));var _0x2a47f0=_[_0x2e81('0x5d')](_0x3def62[_0x2e81('0x6b')],{'filename':_0x2e81('0x68')+_0x85a455[_0x2e81('0x69')]()});if(_0x2a47f0){_0x2a47f0[_0x2e81('0x6e')]=_0x2e81('0x74');}})[_0x2e81('0x19')](function(){_0x352b29({'code':0xc8,'message':[_0x31eb2e[_0x2e81('0x63')],_0x2e81('0x75')][_0x2e81('0x14')]('\x20')});})['catch'](function(_0xd01d1d){_0x40f524(_0x5c3b81[_0x2e81('0x10')](0x1f5,[_0x31eb2e[_0x2e81('0x63')],_0xd01d1d[_0x2e81('0x1a')][_0x2e81('0x69')]()]['join']('\x20')));});}else{return _0x40f524(_0x5c3b81[_0x2e81('0x10')](0x1f5,_0x2e81('0x76')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x4a2c43){var _0x46e8e0=_[_0x2e81('0x77')](_0x1478a4[_0x2e81('0x78')]);_0x4a2c43({'count':_0x46e8e0[_0x2e81('0x5c')],'rows':_0x46e8e0});});},'VoiceQueuesChannel':function(_0x1e87f9){var _0x2e289a=this;return new Promise(function(_0x27bb80,_0x17c345){var _0x217242=schema(properties[_0x2e81('0x79')])['validate'](_0x1e87f9);if(_0x217242['length']>0x0){return _0x17c345(_0x2e289a['error'](0x1f4,_[_0x2e81('0x62')](_0x217242,_0x2e81('0x1a'))[_0x2e81('0x14')](',\x20')));}var _0xa2cf6f=_['find'](_0x1478a4[_0x2e81('0x78')],{'uniqueid':_0x1e87f9[_0x2e81('0x63')]});if(_0xa2cf6f){_0x27bb80(_0xa2cf6f);}else{return _0x17c345(_0x2e289a[_0x2e81('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x2652be){var _0x45677d=this;return new Promise(function(_0x53a320,_0x50ce73){if(ami[_0x2e81('0x1c')]()==![]){return _0x50ce73(_0x45677d['error'](0x1f4,[config[_0x2e81('0x11')]['ip'],config[_0x2e81('0x11')]['username'],_0x2e81('0x13')]['join']('\x20')));}var _0x474183=schema(properties['voicequeuechannelhangup'])['validate'](_0x2652be);if(_0x474183['length']>0x0){return _0x50ce73(_0x45677d[_0x2e81('0x10')](0x1f4,_['map'](_0x474183,_0x2e81('0x1a'))[_0x2e81('0x14')](',\x20')));}var _0x48daa3=_[_0x2e81('0x5d')](_0x1478a4[_0x2e81('0x78')],{'uniqueid':_0x2652be[_0x2e81('0x63')]});if(_0x48daa3&&_0x48daa3[_0x2e81('0x64')]){return ami[_0x2e81('0x1f')]({'action':_0x2e81('0x7a'),'channel':_0x48daa3[_0x2e81('0x64')]})[_0x2e81('0x19')](function(_0x2c128c){_0x53a320({'code':0xc8,'message':[_0x2652be[_0x2e81('0x63')],_0x2c128c['message']['toLowerCase']()][_0x2e81('0x14')]('\x20')});})[_0x2e81('0x1b')](function(_0x51e880){_0x50ce73(_0x45677d[_0x2e81('0x10')](0x1f5,[_0x2652be[_0x2e81('0x63')],_0x51e880[_0x2e81('0x1a')][_0x2e81('0x69')]()][_0x2e81('0x14')]('\x20')));});}else{return _0x50ce73(_0x45677d['error'](0x1f5,_0x2e81('0x76')));}});},'VoiceQueuesChannelRedirect':function(_0x217dc1){var _0x14e9ba=this;return new Promise(function(_0x4eb7d8,_0x1db473){if(ami[_0x2e81('0x1c')]()==![]){return _0x1db473(_0x14e9ba[_0x2e81('0x10')](0x1f4,[config[_0x2e81('0x11')]['ip'],config[_0x2e81('0x11')]['username'],_0x2e81('0x13')]['join']('\x20')));}var _0x261fc7=schema(properties[_0x2e81('0x7b')])[_0x2e81('0x70')](_0x217dc1);if(_0x261fc7[_0x2e81('0x5c')]>0x0){return _0x1db473(_0x14e9ba[_0x2e81('0x10')](0x1f4,_[_0x2e81('0x62')](_0x261fc7,_0x2e81('0x1a'))[_0x2e81('0x14')](',\x20')));}var _0x428e2c=_[_0x2e81('0x5d')](_0x1478a4['queueChannels'],{'uniqueid':_0x217dc1[_0x2e81('0x63')]});if(_0x428e2c&&_0x428e2c['channel']){return ami[_0x2e81('0x1f')]({'action':_0x2e81('0x7c'),'channel':_0x428e2c[_0x2e81('0x64')],'exten':_0x217dc1['exten'],'context':_0x217dc1['context']||_0x428e2c[_0x2e81('0x7d')],'priority':0x1})[_0x2e81('0x19')](function(_0x218767){_0x4eb7d8({'code':0xc8,'message':[_0x217dc1['uniqueid'],_0x218767[_0x2e81('0x1a')][_0x2e81('0x69')]()]['join']('\x20')});})[_0x2e81('0x1b')](function(_0x17724c){_0x1db473(_0x14e9ba['error'](0x1f5,[_0x217dc1[_0x2e81('0x63')],_0x17724c['message'][_0x2e81('0x69')]()]['join']('\x20')));});}else{return _0x1db473(_0x14e9ba[_0x2e81('0x10')](0x1f5,_0x2e81('0x76')));}});},'Agents':function(_0x177dc8){return new Promise(function(_0x33517c){var _0xb97446=_['values'](_0x1478a4[_0x2e81('0xc')]);if(_0x177dc8&&_0x177dc8['id']){var _0x48739f=_[_0x2e81('0x5d')](_0xb97446,function(_0x3af9df){return _0x3af9df['id']===_0x177dc8['id'];});_0x33517c(_0x48739f);}else{_0x33517c({'count':_0xb97446[_0x2e81('0x5c')],'rows':_0xb97446});}});},'Telephones':function(){return new Promise(function(_0x1a759b){var _0x33c849=_[_0x2e81('0x77')](_0x1478a4['telephones']);_0x1a759b({'count':_0x33c849[_0x2e81('0x5c')],'rows':_0x33c849});});},'Trunks':function(){return new Promise(function(_0x29eb77){var _0x4030d8=_[_0x2e81('0x77')](_0x1478a4[_0x2e81('0x7e')]);_0x29eb77({'count':_0x4030d8[_0x2e81('0x5c')],'rows':_0x4030d8});});},'OutboundChannels':function(){return new Promise(function(_0x1a1e68){var _0x28a9e3=_['values'](_0x1478a4['outboundChannels']);_0x1a1e68({'count':_0x28a9e3[_0x2e81('0x5c')],'rows':_0x28a9e3});});},'Outbound':function(){return new Promise(function(_0x263391){_0x263391(_0x1478a4['outbound']);});},'Campaigns':function(){return new Promise(function(_0x22734c){var _0x4c37dd=_[_0x2e81('0x77')](_0x1478a4[_0x2e81('0x7f')]);_0x22734c({'count':_0x4c37dd[_0x2e81('0x5c')],'rows':_0x4c37dd});});},'VoiceQueuesPreview':function(_0x10dc4c){var _0xf0292=this;return new Promise(function(_0x5df1c1,_0x18005c){_0x5e14d5[_0x2e81('0x80')](_0x10dc4c['id'])[_0x2e81('0x19')](function(_0x258684){_0x5df1c1({'code':0xc8,'message':_0x258684[_0x2e81('0x1a')]});})['catch'](function(_0x423379){_0x18005c(_0xf0292[_0x2e81('0x10')](0x1f4,_0x423379[_0x2e81('0x1a')]));});});},'EventManager':function(_0x30ea71){var _0x58340d=this;return new Promise(function(_0x2fdbd2,_0x5d104c){if(!_0x30ea71['event']){return _0x5d104c(_0x58340d[_0x2e81('0x10')](0x1f4,_0x2e81('0x81')));}ami[_0x2e81('0x82')](_0x2e81('0x83')+_0x30ea71['event'],_0x30ea71['message']);_0x2fdbd2({'code':0xc8,'message':_0x30ea71});});},'FaxAccounts':function(){return new Promise(function(_0xb2e23f){var _0x3336b1=_[_0x2e81('0x77')](_0x1478a4[_0x2e81('0x84')]);_0xb2e23f({'count':_0x3336b1[_0x2e81('0x5c')],'rows':_0x3336b1});});},'SendFax':function(_0x1715a8){var _0x2cbeac=this;return new Promise(function(_0x879912,_0x5e5854){_0x1a0274[_0x2e81('0x85')](_0x1715a8)['then'](function(_0x1f339c){_0x879912({'code':0xc8,'message':_0x1f339c[_0x2e81('0x1a')]});})['catch'](function(_0x5908db){_0x5e5854(_0x2cbeac[_0x2e81('0x10')](0x1f4,_0x5908db[_0x2e81('0x1a')]));});});},'CheckAfterSend':function(_0x5065f8){var _0x3b827b=this;return new Promise(function(_0xa197c8,_0x14950a){_0x1a0274[_0x2e81('0x86')](_0x5065f8)[_0x2e81('0x19')](function(_0x417e9a){_0xa197c8({'code':0xc8,'message':_0x417e9a['message']});})['catch'](function(_0x3592cb){_0x14950a(_0x3b827b[_0x2e81('0x10')](0x1f4,_0x3592cb[_0x2e81('0x1a')]));});});}};var _0x49e6fa=jayson['server'](_0x36604d)[_0x2e81('0x87')]();_0x49e6fa['on']('error',function(_0x35a64f){return _0x4f6864(_0x35a64f);});_0x49e6fa[_0x2e81('0x4')](0x232a,_0x2e81('0x88'),function(){console['log'](_0x2e81('0x89'),0x232a);return _0x251244(_0x2e81('0x8a')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index b9b304a..29ce6b5 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 _0xa76a=['[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','','Unknown','destcalleridname','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','name','trigger:%s','merge','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','scheduledAt','resolve','getContacts','then','isEmpty','length'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa76a,0xad));var _0xaa76=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa76a[_0x5b78e8];return _0xf2c321;};'use strict';var _=require('lodash');var BPromise=require(_0xaa76('0x0'));var Redis=require(_0xaa76('0x1'));var util=require(_0xaa76('0x2'));var config=require('../../../../config/environment');var logger=require(_0xaa76('0x3'))(_0xaa76('0x4'));var cmContactRpc=require(_0xaa76('0x5'));config[_0xaa76('0x6')]=_[_0xaa76('0x7')](config[_0xaa76('0x6')],{'host':_0xaa76('0x8'),'port':0x18eb});var io=require(_0xaa76('0x9'))(new Redis(config[_0xaa76('0x6')]));function emit(_0x3b869a,_0x5e1f71,_0x3f8790,_0x3a8c79,_0x3717ba){logger[_0xaa76('0xa')](_0xaa76('0xb'),_0x3b869a,_0x5e1f71['id'],_0x3f8790,_0x3a8c79,JSON['stringify'](_0x3717ba));io['to'](_0x3f8790)[_0xaa76('0xc')](_0x3a8c79,_0x3717ba);}exports[_0xaa76('0xd')]=function(_0x60d688,_0x6a5aba,_0x567bdf,_0x1bb0de){var _0x30f5b1,_0x34653a;var _0x40af1d={};var _0x2c965c;var _0xb9de7c=Number(_0x567bdf[_0xaa76('0xe')]);var _0x2dce5a=_0x567bdf[_0xaa76('0xf')]?Boolean(Number(_0x567bdf[_0xaa76('0xf')])):![];var _0x2897ba;var _0x2c9c3d=![];if(!_['isNil'](_0x567bdf[_0xaa76('0x10')])){if(_0x567bdf['data5']=='1')_0x2c9c3d=!![];}if(!_0x2c9c3d){if(_0x1bb0de['xmd-contactid']){_0x40af1d['id']=_0x1bb0de[_0xaa76('0x11')];}}if(!_0x40af1d['id']){_0x40af1d[_0xaa76('0x12')]=_0xb9de7c;_0x2897ba=_0x567bdf['data3']&&_0x567bdf['data3']!=='0'?_0x567bdf[_0xaa76('0x13')][_0xaa76('0x14')](','):['phone'];_0x40af1d['$or']=_[_0xaa76('0x15')](_0x2897ba,function(_0x88a4f0){var _0x15f507={};_0x15f507[_0x88a4f0]=_0x1bb0de[_0xaa76('0x16')]?_0x1bb0de[_0xaa76('0x17')]:_0x1bb0de[_0xaa76('0x18')];return _0x15f507;});_0x2c965c=_0x1bb0de['routeId']?_0x1bb0de[_0xaa76('0x17')]:_0x1bb0de[_0xaa76('0x18')];}var _0xdeae4c=['id',_0xaa76('0x19'),_0xaa76('0x1a'),_0xaa76('0x1b'),_0xaa76('0x1c'),'fax',_0xaa76('0x12'),'createdAt',_0xaa76('0x1d'),'updatedAt'];var _0x3e2ea7=_['union'](_0xdeae4c,_0x2897ba);BPromise[_0xaa76('0x1e')]()['then'](cmContactRpc[_0xaa76('0x1f')]({'attributes':_0x3e2ea7,'where':_0x40af1d,'phone':_0x2c965c}))[_0xaa76('0x20')](function(_0x3cabe5){_0x34653a=_0x3cabe5;if(!_[_0xaa76('0x21')](_0x34653a)){if(_0x34653a[_0xaa76('0x22')]===0x1){_0x30f5b1=_0x34653a[0x0];logger[_0xaa76('0xa')](_0xaa76('0x23'),_0x1bb0de['uniqueid'],_0x6a5aba['id'],_0x30f5b1['id']);}else{logger[_0xaa76('0xa')](_0xaa76('0x24'),_0x1bb0de[_0xaa76('0x25')],_0x6a5aba['id'],_[_0xaa76('0x15')](_0x34653a,'id')[_0xaa76('0x26')](','));}return;}else{logger[_0xaa76('0xa')](_0xaa76('0x27'),_0x1bb0de[_0xaa76('0x25')],_0x6a5aba['id']);var _0x1ce4b5={'ListId':_0xb9de7c};var _0x379ad9=_0x567bdf['data4']&&_0x567bdf['data4']!=='0'?_0x567bdf[_0xaa76('0x28')]:_0xaa76('0x1b');if(_0x2dce5a){logger[_0xaa76('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x1bb0de[_0xaa76('0x25')],_0x6a5aba['id']);_0x1ce4b5[_0x379ad9]=_['isNil'](_0x1bb0de['routeId'])?_0x1bb0de[_0xaa76('0x18')]:_0x1bb0de['destcalleridnum'];if(_[_0xaa76('0x29')](_0x1bb0de[_0xaa76('0x16')])){_0x1ce4b5[_0xaa76('0x19')]=_0x1bb0de[_0xaa76('0x2a')]&&_0x1bb0de['calleridname']!==_0xaa76('0x2b')?_0x1bb0de[_0xaa76('0x2a')]:_0xaa76('0x2c');}else{_0x1ce4b5[_0xaa76('0x19')]=_0x1bb0de[_0xaa76('0x2d')]&&_0x1bb0de[_0xaa76('0x2d')]!==_0xaa76('0x2b')?_0x1bb0de[_0xaa76('0x2d')]:_0xaa76('0x2c');}return BPromise[_0xaa76('0x1e')]()[_0xaa76('0x20')](cmContactRpc['createContact'](_0x1ce4b5))[_0xaa76('0x20')](function(_0x19a836){_0x30f5b1=_0x19a836;_0x34653a['push'](_0x19a836);if(_0x30f5b1){logger[_0xaa76('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x1bb0de[_0xaa76('0x25')],_0x6a5aba['id'],_0x30f5b1['id']);}return;});}else{logger[_0xaa76('0xa')](_0xaa76('0x2e'),_0x1bb0de[_0xaa76('0x25')],_0x6a5aba['id']);_0x1ce4b5[_0x379ad9]=_[_0xaa76('0x29')](_0x1bb0de[_0xaa76('0x16')])?_0x1bb0de[_0xaa76('0x18')]:_0x1bb0de[_0xaa76('0x17')];if(_[_0xaa76('0x29')](_0x1bb0de[_0xaa76('0x16')])){_0x1ce4b5['firstName']=_0x1bb0de['calleridname']&&_0x1bb0de['calleridname']!==_0xaa76('0x2b')?_0x1bb0de[_0xaa76('0x2a')]:_0xaa76('0x2c');}else{_0x1ce4b5['firstName']=_0x1bb0de[_0xaa76('0x2d')]&&_0x1bb0de[_0xaa76('0x2d')]!==''?_0x1bb0de[_0xaa76('0x2d')]:'Unknown';}_0x30f5b1=_0x1ce4b5;_0x34653a[_0xaa76('0x2f')](_0x1ce4b5);return;}}})[_0xaa76('0x20')](function(){if(_0x60d688){emit(_0x1bb0de['uniqueid'],_0x6a5aba,util[_0xaa76('0x30')]('user:%s',_0x60d688[_0xaa76('0x31')]),util['format'](_0xaa76('0x32'),_0x567bdf['action']['toLowerCase']()),{'evt':_[_0xaa76('0x33')](_0x1bb0de,{'autoCreate':_0x2dce5a}),'contact':_0x30f5b1===undefined?{}:_0x30f5b1,'contacts':_0x34653a[_0xaa76('0x22')]===0x0?undefined:_0x34653a});}});}; \ No newline at end of file +var _0xa3fe=['[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','trigger:%s','action','toLowerCase','merge','length','lodash','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','defaults','localhost','socket.io-emitter','redis','stringify','data1','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','updatedAt','resolve','then','getContacts','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','calleridname','','Unknown','destcalleridname','createContact','push'];(function(_0xfa973f,_0x56d1ca){var _0x23e4c0=function(_0x4abc7f){while(--_0x4abc7f){_0xfa973f['push'](_0xfa973f['shift']());}};_0x23e4c0(++_0x56d1ca);}(_0xa3fe,0xd8));var _0xea3f=function(_0x273f21,_0x470137){_0x273f21=_0x273f21-0x0;var _0x34d7ec=_0xa3fe[_0x273f21];return _0x34d7ec;};'use strict';var _=require(_0xea3f('0x0'));var BPromise=require('bluebird');var Redis=require(_0xea3f('0x1'));var util=require(_0xea3f('0x2'));var config=require('../../../../config/environment');var logger=require(_0xea3f('0x3'))(_0xea3f('0x4'));var cmContactRpc=require(_0xea3f('0x5'));config['redis']=_[_0xea3f('0x6')](config['redis'],{'host':_0xea3f('0x7'),'port':0x18eb});var io=require(_0xea3f('0x8'))(new Redis(config[_0xea3f('0x9')]));function emit(_0x49e494,_0x56abd6,_0x187ce0,_0x35ba50,_0x3c4807){logger['info']('[CM][%s][%s]',_0x49e494,_0x56abd6['id'],_0x187ce0,_0x35ba50,JSON[_0xea3f('0xa')](_0x3c4807));io['to'](_0x187ce0)['emit'](_0x35ba50,_0x3c4807);}exports['exec']=function(_0x249e8e,_0xa8b25b,_0x414ddb,_0x5a34f2){var _0x4eeb5b,_0x5c8cd3;var _0x3f6c22={};var _0x14d764;var _0x426577=Number(_0x414ddb[_0xea3f('0xb')]);var _0x4a36da=_0x414ddb['data2']?Boolean(Number(_0x414ddb['data2'])):![];var _0x4538b6;var _0x347578=![];if(!_['isNil'](_0x414ddb[_0xea3f('0xc')])){if(_0x414ddb[_0xea3f('0xc')]=='1')_0x347578=!![];}if(!_0x347578){if(_0x5a34f2['xmd-contactid']){_0x3f6c22['id']=_0x5a34f2[_0xea3f('0xd')];}}if(!_0x3f6c22['id']){_0x3f6c22[_0xea3f('0xe')]=_0x426577;_0x4538b6=_0x414ddb[_0xea3f('0xf')]&&_0x414ddb[_0xea3f('0xf')]!=='0'?_0x414ddb[_0xea3f('0xf')][_0xea3f('0x10')](','):[_0xea3f('0x11')];_0x3f6c22[_0xea3f('0x12')]=_[_0xea3f('0x13')](_0x4538b6,function(_0x403fd2){var _0x3a2f1d={};_0x3a2f1d[_0x403fd2]=_0x5a34f2[_0xea3f('0x14')]?_0x5a34f2[_0xea3f('0x15')]:_0x5a34f2[_0xea3f('0x16')];return _0x3a2f1d;});_0x14d764=_0x5a34f2[_0xea3f('0x14')]?_0x5a34f2[_0xea3f('0x15')]:_0x5a34f2[_0xea3f('0x16')];}var _0x35153d=['id','firstName',_0xea3f('0x17'),_0xea3f('0x11'),_0xea3f('0x18'),_0xea3f('0x19'),_0xea3f('0xe'),'createdAt','scheduledAt',_0xea3f('0x1a')];var _0x29dd1f=_['union'](_0x35153d,_0x4538b6);BPromise[_0xea3f('0x1b')]()[_0xea3f('0x1c')](cmContactRpc[_0xea3f('0x1d')]({'attributes':_0x29dd1f,'where':_0x3f6c22,'phone':_0x14d764}))[_0xea3f('0x1c')](function(_0x5f452b){_0x5c8cd3=_0x5f452b;if(!_['isEmpty'](_0x5c8cd3)){if(_0x5c8cd3['length']===0x1){_0x4eeb5b=_0x5c8cd3[0x0];logger[_0xea3f('0x1e')](_0xea3f('0x1f'),_0x5a34f2[_0xea3f('0x20')],_0xa8b25b['id'],_0x4eeb5b['id']);}else{logger[_0xea3f('0x1e')](_0xea3f('0x21'),_0x5a34f2[_0xea3f('0x20')],_0xa8b25b['id'],_[_0xea3f('0x13')](_0x5c8cd3,'id')['join'](','));}return;}else{logger[_0xea3f('0x1e')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x5a34f2[_0xea3f('0x20')],_0xa8b25b['id']);var _0x22cd02={'ListId':_0x426577};var _0x1f66b3=_0x414ddb[_0xea3f('0x22')]&&_0x414ddb[_0xea3f('0x22')]!=='0'?_0x414ddb['data4']:_0xea3f('0x11');if(_0x4a36da){logger['info'](_0xea3f('0x23'),_0x5a34f2[_0xea3f('0x20')],_0xa8b25b['id']);_0x22cd02[_0x1f66b3]=_[_0xea3f('0x24')](_0x5a34f2['routeId'])?_0x5a34f2[_0xea3f('0x16')]:_0x5a34f2[_0xea3f('0x15')];if(_['isNil'](_0x5a34f2[_0xea3f('0x14')])){_0x22cd02[_0xea3f('0x25')]=_0x5a34f2[_0xea3f('0x26')]&&_0x5a34f2[_0xea3f('0x26')]!==_0xea3f('0x27')?_0x5a34f2[_0xea3f('0x26')]:_0xea3f('0x28');}else{_0x22cd02[_0xea3f('0x25')]=_0x5a34f2[_0xea3f('0x29')]&&_0x5a34f2[_0xea3f('0x29')]!==_0xea3f('0x27')?_0x5a34f2[_0xea3f('0x29')]:_0xea3f('0x28');}return BPromise[_0xea3f('0x1b')]()[_0xea3f('0x1c')](cmContactRpc[_0xea3f('0x2a')](_0x22cd02))[_0xea3f('0x1c')](function(_0x11e9f0){_0x4eeb5b=_0x11e9f0;_0x5c8cd3[_0xea3f('0x2b')](_0x11e9f0);if(_0x4eeb5b){logger['info'](_0xea3f('0x2c'),_0x5a34f2[_0xea3f('0x20')],_0xa8b25b['id'],_0x4eeb5b['id']);}return;});}else{logger[_0xea3f('0x1e')](_0xea3f('0x2d'),_0x5a34f2[_0xea3f('0x20')],_0xa8b25b['id']);_0x22cd02[_0x1f66b3]=_[_0xea3f('0x24')](_0x5a34f2[_0xea3f('0x14')])?_0x5a34f2[_0xea3f('0x16')]:_0x5a34f2[_0xea3f('0x15')];if(_['isNil'](_0x5a34f2[_0xea3f('0x14')])){_0x22cd02[_0xea3f('0x25')]=_0x5a34f2[_0xea3f('0x26')]&&_0x5a34f2[_0xea3f('0x26')]!==_0xea3f('0x27')?_0x5a34f2['calleridname']:'Unknown';}else{_0x22cd02[_0xea3f('0x25')]=_0x5a34f2['destcalleridname']&&_0x5a34f2[_0xea3f('0x29')]!==_0xea3f('0x27')?_0x5a34f2[_0xea3f('0x29')]:_0xea3f('0x28');}_0x4eeb5b=_0x22cd02;_0x5c8cd3[_0xea3f('0x2b')](_0x22cd02);return;}}})[_0xea3f('0x1c')](function(){if(_0x249e8e){emit(_0x5a34f2['uniqueid'],_0xa8b25b,util[_0xea3f('0x2e')]('user:%s',_0x249e8e['name']),util[_0xea3f('0x2e')](_0xea3f('0x2f'),_0x414ddb[_0xea3f('0x30')][_0xea3f('0x31')]()),{'evt':_[_0xea3f('0x32')](_0x5a34f2,{'autoCreate':_0x4a36da}),'contact':_0x4eeb5b===undefined?{}:_0x4eeb5b,'contacts':_0x5c8cd3[_0xea3f('0x33')]===0x0?undefined:_0x5c8cd3});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 188b53c..91c03ea 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 _0xc0d7=['AccountId','message','event','operator','agent','membername','lastevent','substatus','offlineMessage','created','equals','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','popup','url','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','custom:agentringnoanswer','syncCustomEvent','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','clone','motionChannel','undefined','checkTriggers','checkTrigger','interface','toLowerCase','contactmanager','browser','data1','TemplateId','html','render','data2','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','data6','600','winapp','winArguments','user:%s','name','format','trigger:%s','action','merge','integration','exec','queue','routeId','urlforward','script','parse','query','search','replace','channel','every','AllConditions','checkConditions','AnyConditions','length','field','account','chat','ChatWebsiteId','value'];(function(_0x80b11,_0x15aa74){var _0x38fa1a=function(_0x19d884){while(--_0x19d884){_0x80b11['push'](_0x80b11['shift']());}};_0x38fa1a(++_0x15aa74);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x8e09fe,_0x11d5d6){_0x8e09fe=_0x8e09fe-0x0;var _0x40faa3=_0xc0d7[_0x8e09fe];return _0x40faa3;};'use strict';var util=require('util');var _=require('lodash');var url=require('url');var Mustache=require(_0x7c0d('0x0'));var Redis=require(_0x7c0d('0x1'));var urlforward=require(_0x7c0d('0x2'));var integration=require(_0x7c0d('0x3'));var cmContact=require(_0x7c0d('0x4'));var script=require(_0x7c0d('0x5'));var config=require(_0x7c0d('0x6'));var logger=require(_0x7c0d('0x7'))(_0x7c0d('0x8'));var ami=require('../ami');config[_0x7c0d('0x9')]=_[_0x7c0d('0xa')](config[_0x7c0d('0x9')],{'host':_0x7c0d('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7c0d('0x9')]));var operators={'equals':function(_0x15d9ed,_0x230a6b){return _0x15d9ed==_0x230a6b;},'not_equals':function(_0xfd38a0,_0x49621d){return _0xfd38a0!=_0x49621d;}};var barAndWebActions=[_0x7c0d('0xc'),_0x7c0d('0xd'),'winapp'];function Trigger(_0x5320fa){this[_0x7c0d('0xe')]=_0x5320fa[_0x7c0d('0xe')];this['agents']=_0x5320fa[_0x7c0d('0xf')];this[_0x7c0d('0x10')]=_0x5320fa[_0x7c0d('0x10')];this[_0x7c0d('0x11')]=_0x5320fa[_0x7c0d('0x11')];this[_0x7c0d('0x12')]=_0x5320fa['voiceExtensions'];this[_0x7c0d('0x13')]=_0x5320fa[_0x7c0d('0x13')];this[_0x7c0d('0x14')]=_0x5320fa[_0x7c0d('0x14')];this[_0x7c0d('0x15')]=_0x5320fa[_0x7c0d('0x15')];this[_0x7c0d('0x16')]=_0x5320fa[_0x7c0d('0x16')];this['zohoAccounts']=_0x5320fa[_0x7c0d('0x17')];this['deskAccounts']=_0x5320fa[_0x7c0d('0x18')];this['vtigerAccounts']=_0x5320fa[_0x7c0d('0x19')];this[_0x7c0d('0x1a')]=_0x5320fa[_0x7c0d('0x1a')];this[_0x7c0d('0x1b')]=_0x5320fa[_0x7c0d('0x1b')];this[_0x7c0d('0x1c')]=_0x5320fa[_0x7c0d('0x1c')];this[_0x7c0d('0x1d')]={'zendesk':this[_0x7c0d('0x13')],'salesforce':this[_0x7c0d('0x15')],'freshdesk':this[_0x7c0d('0x14')],'sugarcrm':this[_0x7c0d('0x16')],'zoho':this[_0x7c0d('0x17')],'desk':this[_0x7c0d('0x18')],'vtiger':this[_0x7c0d('0x19')],'dynamics365':this[_0x7c0d('0x1b')],'freshsales':this[_0x7c0d('0x1c')],'servicenow':this[_0x7c0d('0x1a')]};ami['on'](_0x7c0d('0x1e'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentconnect',this['syncCustomEvent']['bind'](this));ami['on'](_0x7c0d('0x1f'),this[_0x7c0d('0x20')][_0x7c0d('0x21')](this));ami['on'](_0x7c0d('0x22'),this[_0x7c0d('0x20')][_0x7c0d('0x21')](this));ami['on'](_0x7c0d('0x23'),this['syncCustomEvent'][_0x7c0d('0x21')](this));ami['on'](_0x7c0d('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0x7c0d('0x25'),this['syncCustomEvent'][_0x7c0d('0x21')](this));ami['on'](_0x7c0d('0x26'),this[_0x7c0d('0x20')][_0x7c0d('0x21')](this));ami['on'](_0x7c0d('0x27'),this['syncCustomEvent'][_0x7c0d('0x21')](this));ami['on'](_0x7c0d('0x28'),this[_0x7c0d('0x20')][_0x7c0d('0x21')](this));ami['on'](_0x7c0d('0x29'),this['syncCustomEvent'][_0x7c0d('0x21')](this));ami['on']('custom:timeout',this[_0x7c0d('0x20')][_0x7c0d('0x21')](this));ami['on'](_0x7c0d('0x2a'),this[_0x7c0d('0x2b')][_0x7c0d('0x21')](this));ami['on'](_0x7c0d('0x2c'),this['syncAgentDial'][_0x7c0d('0x21')](this));ami['on']('custom:dialend',this[_0x7c0d('0x2b')][_0x7c0d('0x21')](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0x7c0d('0x21')](this));ami['on']('custom:closedinteraction',this[_0x7c0d('0x20')][_0x7c0d('0x21')](this));ami['on']('custom:substatus',this['syncCustomEvent']['bind'](this));ami['on']('custom:incomingmessage',this[_0x7c0d('0x20')]['bind'](this));ami['on'](_0x7c0d('0x2d'),this[_0x7c0d('0x20')]['bind'](this));ami['on'](_0x7c0d('0x2e'),this[_0x7c0d('0x20')][_0x7c0d('0x21')](this));ami['on'](_0x7c0d('0x2f'),this['syncCustomEvent'][_0x7c0d('0x21')](this));ami['on'](_0x7c0d('0x30'),this[_0x7c0d('0x20')][_0x7c0d('0x21')](this));}Trigger[_0x7c0d('0x31')][_0x7c0d('0x32')]=function(_0x34c2d0,_0x150069,_0x471ab1){logger[_0x7c0d('0x33')](_0x34c2d0,_0x150069,JSON['stringify'](_0x471ab1));io['to'](_0x34c2d0)[_0x7c0d('0x32')](_0x150069,_0x471ab1);};Trigger[_0x7c0d('0x31')]['syncCustomEvent']=function(_0x3ff97b){var _0x142ad0=_[_0x7c0d('0x34')](_0x3ff97b);if(typeof _0x142ad0[_0x7c0d('0x35')]===_0x7c0d('0x36')){_0x142ad0[_0x7c0d('0x35')]='voice';}this[_0x7c0d('0x37')](_0x142ad0);};Trigger[_0x7c0d('0x31')][_0x7c0d('0x2b')]=function(_0xf06cef){if(this[_0x7c0d('0xf')][_0xf06cef['interface']]){this['syncCustomEvent'](_0xf06cef);}};Trigger[_0x7c0d('0x31')][_0x7c0d('0x37')]=function(_0x5c85b6){var _0x38259f;for(var _0x4c87d8 in this[_0x7c0d('0xe')]){if(this[_0x7c0d('0xe')]['hasOwnProperty'](_0x4c87d8)){if(this[_0x7c0d('0xe')][_0x4c87d8]['status']){_0x38259f=this[_0x7c0d('0x38')](this[_0x7c0d('0xe')][_0x4c87d8],_0x5c85b6);if(_0x38259f){_['merge'](_0x5c85b6,_0x5c85b6['variables']);for(var _0x5ca209=0x0,_0x150877,_0x1acba0,_0x1ff57c;_0x5ca2090x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14b,0x93));var _0xbe14=function(_0x365624,_0xaa19b4){_0x365624=_0x365624-0x0;var _0x396b16=_0xe14b[_0x365624];return _0x396b16;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ 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 a94c773..1e1e0ce 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 _0xcc27=['isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','outbound','destcalleridnum','calleridnum','POST','/systemusers(','body','headers','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','length','forEach','includes','picklist','type','nameField','customField','idField','substring','indexOf','content','ticketType','incident','incidents','getString','Subjects','/contacts(','Fields','phonecall','queue','callDirection','phonecalls','assign','Descriptions','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','data7','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','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','remoteUri','CloudProvider','tenantId','resolve','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','userEmail','email','internalemailaddress'];(function(_0x65404,_0x34da3c){var _0x48b94d=function(_0x3d2d68){while(--_0x3d2d68){_0x65404['push'](_0x65404['shift']());}};_0x48b94d(++_0x34da3c);}(_0xcc27,0x19e));var _0x7cc2=function(_0x28996c,_0x4ecba6){_0x28996c=_0x28996c-0x0;var _0x2690eb=_0xcc27[_0x28996c];return _0x2690eb;};'use strict';var _=require('lodash');var rp=require(_0x7cc2('0x0'));var util=require(_0x7cc2('0x1'));var intUtil=require(_0x7cc2('0x2'));var md5=require(_0x7cc2('0x3'));var Redis=require(_0x7cc2('0x4'));var logger=require(_0x7cc2('0x5'))(_0x7cc2('0x6'));var config=require(_0x7cc2('0x7'));config[_0x7cc2('0x8')]=_[_0x7cc2('0x9')](config[_0x7cc2('0x8')],{'host':_0x7cc2('0xa'),'port':0x18eb});var io=require(_0x7cc2('0xb'))(new Redis(config[_0x7cc2('0x8')]));function getAuthToken(_0x5c40cf,_0x205bf5,_0x5aa741){if(_0x5c40cf['modernAuthentication']){_0x5c40cf[_0x7cc2('0xc')]=_0x5c40cf[_0x7cc2('0xd')]['data7'];_0x5c40cf[_0x7cc2('0xe')]=_0x5c40cf[_0x7cc2('0xd')]['data2'];return Promise[_0x7cc2('0xf')](_0x5c40cf[_0x7cc2('0xd')]['data5']);}var _0x2effe4={'method':'POST','uri':_0x205bf5,'form':{'client_id':_0x5c40cf['clientId'],'resource':_0x5c40cf[_0x7cc2('0xc')],'username':_0x5c40cf[_0x7cc2('0x10')],'password':_0x5c40cf['password'],'grant_type':_0x7cc2('0x11'),'client_secret':_0x5c40cf[_0x7cc2('0x12')]},'json':!![]};return rp(_0x2effe4)[_0x7cc2('0x13')](function(_0x2be1c1){return _0x2be1c1[_0x7cc2('0x14')];})[_0x7cc2('0x15')](function(_0x37cc83){logger[_0x7cc2('0x16')]('['+[_0x5aa741[_0x7cc2('0x17')]()]+_0x7cc2('0x18'));return _0x37cc83['message'];});}function getUser(_0x228d33,_0x98874c,_0x1cd2fb,_0x44e81f,_0x1ccb50,_0x1b85e5){return new Promise(function(_0x487f30,_0x357378){return getAuthToken(_0x98874c,_0x44e81f,_0x1b85e5)[_0x7cc2('0x13')](function(_0x331f5a){var _0x2d1052={'method':_0x7cc2('0x19'),'uri':_0x1ccb50+_0x7cc2('0x1a'),'headers':{'Authorization':_0x7cc2('0x1b')+_0x331f5a,'OData-Version':_0x7cc2('0x1c')},'json':!![]};return rp(_0x2d1052);})[_0x7cc2('0x13')](function(_0x53883b){var _0x43cea5=_0x53883b[_0x7cc2('0x1d')];var _0x336ad9=![];var _0xac3b7f=null;if(!_[_0x7cc2('0x1e')](_0x1cd2fb)){if(intUtil['validateEmail'](_0x1cd2fb['email'])){_0x228d33[_0x7cc2('0x1f')]=_0x1cd2fb[_0x7cc2('0x20')];for(_0xac3b7f=0x0;_0xac3b7f<_0x43cea5['length'];_0xac3b7f++){if(_0x43cea5[_0xac3b7f][_0x7cc2('0x21')]===_0x1cd2fb[_0x7cc2('0x20')]&&!_0x43cea5[_0xac3b7f][_0x7cc2('0x22')]){_0x336ad9=!![];logger[_0x7cc2('0x23')]('['+[_0x1b85e5[_0x7cc2('0x17')]()]+_0x7cc2('0x24')+_0x43cea5[_0xac3b7f][_0x7cc2('0x25')]+'!');_0x228d33[_0x7cc2('0x26')]=_0x43cea5[_0xac3b7f]['systemuserid'];}}}}if(!_0x336ad9){logger[_0x7cc2('0x23')]('['+[_0x1b85e5[_0x7cc2('0x17')]()]+_0x7cc2('0x27'));_0x228d33[_0x7cc2('0x1f')]=_0x98874c['username'];for(_0xac3b7f=0x0;_0xac3b7f<_0x43cea5['length'];_0xac3b7f++){if(_0x43cea5[_0xac3b7f][_0x7cc2('0x21')]===_0x98874c['username']){_0x228d33['userId']=_0x43cea5[_0xac3b7f]['systemuserid'];}}}_0x487f30(_0x228d33);})[_0x7cc2('0x15')](function(_0x3ae51a){_0x357378(_0x3ae51a[_0x7cc2('0x28')]);});});}function createEndUser(_0xed3daa,_0x4cbd64,_0x5222f9,_0x53507d,_0x2b6e25,_0x21271b,_0x574747){return new Promise(function(_0x32548f,_0x1436c6){return getAuthToken(_0x4cbd64,_0x5222f9,_0x21271b)[_0x7cc2('0x13')](function(_0x170a19){var _0xe614b6=_0x21271b[_0x7cc2('0x29')]()===_0x7cc2('0x2a')?_0x2b6e25[_0x7cc2('0x2b')]:_0x2b6e25[_0x7cc2('0x2c')];var _0x328f00={'method':_0x7cc2('0x2d'),'uri':_0x53507d+'contacts','body':{'fullname':_0xe614b6,'firstname':_0xe614b6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7cc2('0x2e')+_0xed3daa['userId']+')'},'headers':{'Authorization':_0x7cc2('0x1b')+_0x170a19,'OData-Version':_0x7cc2('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x328f00[_0x7cc2('0x2f')][_0x574747]=_0xe614b6;return rp(_0x328f00);})['then'](function(_0x4eab64){var _0x53f882=_0x4eab64[_0x7cc2('0x30')]['odata-entityid'];var _0x53ced5=_0x53f882['substring'](_0x53f882[_0x7cc2('0x31')]('(')+0x1,_0x53f882[_0x7cc2('0x31')](')'));_0xed3daa[_0x7cc2('0x32')]=_0x53ced5;_0x32548f(_0xed3daa);})[_0x7cc2('0x15')](function(_0x483f48){_0x1436c6(_0x483f48[_0x7cc2('0x28')]);});});}function getEndUser(_0x20de40,_0x18b3cd,_0x50a059,_0x1d4137,_0xb85cef,_0x259f5c,_0x9c0faf,_0xb74009){var _0x164503=_0x259f5c[_0x7cc2('0x29')]()===_0x7cc2('0x2a')?_0xb85cef[_0x7cc2('0x2b')]:_0xb85cef[_0x7cc2('0x2c')];return getAuthToken(_0x18b3cd,_0x50a059,_0x259f5c)[_0x7cc2('0x13')](function(_0x5ef556){_0xb74009=_0xb74009?_0xb74009:_0x7cc2('0x33');var _0x124243={'method':'GET','uri':_0x1d4137+_0x7cc2('0x34')+_0xb74009+_0x7cc2('0x35')+_0xb74009+'\x20eq\x20\x27'+_0x164503[_0x7cc2('0x36')]('+',_0x7cc2('0x37'))+'\x27','headers':{'Authorization':_0x7cc2('0x1b')+_0x5ef556,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x124243);})['then'](function(_0x3ad94d){var _0xbf3192=![];if(!_0x3ad94d)return _0xbf3192;var _0x1f8236=_0x3ad94d[_0x7cc2('0x1d')];for(var _0x4f4193=0x0;_0x4f4193<_0x1f8236['length'];_0x4f4193++){if(_0x1f8236[_0x4f4193][_0xb74009]===_0x164503){_0xbf3192=!![];_0x20de40['enduserId']=_0x1f8236[_0x4f4193][_0x7cc2('0x38')];}}return _0xbf3192;})[_0x7cc2('0x13')](function(_0x447705){if(_0x447705)return _0x20de40;if(_0x9c0faf===_0x7cc2('0x39')){logger['info']('['+[_0x259f5c[_0x7cc2('0x17')]()]+_0x7cc2('0x3a'));return _0x20de40;}return createEndUser(_0x20de40,_0x18b3cd,_0x50a059,_0x1d4137,_0xb85cef,_0x259f5c,_0xb74009)[_0x7cc2('0x13')](function(_0x291945){logger[_0x7cc2('0x23')]('['+[_0x259f5c[_0x7cc2('0x17')]()]+']\x20Enduser\x20created!',_0x291945[_0x7cc2('0x32')]);return _0x291945;});});}function getCustomFields(_0x265387,_0x54a822,_0x43ebf5){var _0x9e3993={};if(_0x265387[_0x7cc2('0x3b')]>0x0){_[_0x7cc2('0x3c')](_0x265387,function(_0xbadbcd){if(_[_0x7cc2('0x3d')](['string',_0x7cc2('0x3e')],_0xbadbcd[_0x7cc2('0x3f')])&&_0xbadbcd[_0x7cc2('0x40')]&&!_0xbadbcd[_0x7cc2('0x41')]){var _0x2d5872=_0xbadbcd[_0x7cc2('0x42')][_0x7cc2('0x29')]();var _0x2bd66f=_0x2d5872[_0x7cc2('0x43')](0x0,_0x2d5872['indexOf']('_'));var _0x6fe220=_0x2d5872[_0x7cc2('0x43')](_0x2d5872[_0x7cc2('0x44')]('_')+0x1);if(_0x2bd66f===_0x43ebf5){_0x9e3993[_0x6fe220]=_0xbadbcd[_0x7cc2('0x45')];}}});}return _0x9e3993;}function getTicket(_0x3481a2,_0x44c294,_0xed2c2a,_0x32f0b7,_0x26bf68,_0x43000e,_0x224018){return new Promise(function(_0x404b92,_0x550a47){var _0x201ebd;return getAuthToken(_0x44c294,_0xed2c2a,_0x224018)[_0x7cc2('0x13')](function(_0x92d222){if(_0x43000e[_0x7cc2('0x46')]===_0x7cc2('0x47')){_0x201ebd={'method':_0x7cc2('0x2d'),'uri':_0x32f0b7+_0x7cc2('0x48'),'body':Object['assign']({},{'title':intUtil[_0x7cc2('0x49')](_0x43000e[_0x7cc2('0x4a')],_0x26bf68,'\x20'),'description':intUtil[_0x7cc2('0x49')](_0x43000e['Descriptions'],_0x26bf68,'\x0a'),'customerid_contact@odata.bind':_0x3481a2['enduserId']?_0x7cc2('0x4b')+_0x3481a2[_0x7cc2('0x32')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3481a2[_0x7cc2('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x43000e[_0x7cc2('0x4c')],_0x26bf68,_0x43000e[_0x7cc2('0x46')])),'headers':{'Authorization':_0x7cc2('0x1b')+_0x92d222,'OData-Version':_0x7cc2('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x43000e['ticketType']===_0x7cc2('0x4d')){var _0x26c9c8=_0x3481a2[_0x7cc2('0x32')]?[{'partyid_systemuser@odata.bind':_0x7cc2('0x2e')+_0x3481a2['userId']+')','participationtypemask':_0x3481a2['callDirection']===_0x7cc2('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x7cc2('0x4b')+_0x3481a2[_0x7cc2('0x32')]+')','participationtypemask':_0x3481a2[_0x7cc2('0x4f')]===_0x7cc2('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3481a2[_0x7cc2('0x26')]+')','participationtypemask':_0x3481a2['callDirection']===_0x7cc2('0x4e')?0x2:0x1}];_0x201ebd={'method':'POST','uri':_0x32f0b7+_0x7cc2('0x50'),'body':Object[_0x7cc2('0x51')]({},{'subject':intUtil[_0x7cc2('0x49')](_0x43000e[_0x7cc2('0x4a')],_0x26bf68,'\x20'),'phonenumber':String(_0x26bf68['calleridnum']),'description':intUtil['getString'](_0x43000e[_0x7cc2('0x52')],_0x26bf68,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3481a2[_0x7cc2('0x32')]?_0x7cc2('0x4b')+_0x3481a2[_0x7cc2('0x32')]+')':undefined,'ownerid@odata.bind':_0x7cc2('0x2e')+_0x3481a2[_0x7cc2('0x26')]+')','directioncode':_0x3481a2[_0x7cc2('0x4f')]===_0x7cc2('0x4e')?![]:!![],'phonecall_activity_parties':_0x26c9c8},getCustomFields(_0x43000e[_0x7cc2('0x4c')],_0x26bf68,_0x43000e[_0x7cc2('0x46')])),'headers':{'Authorization':_0x7cc2('0x1b')+_0x92d222,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x201ebd);})['then'](function(_0x5d69d7){var _0x107434=_0x5d69d7[_0x7cc2('0x30')][_0x7cc2('0x53')];var _0x3f6856=_0x107434[_0x7cc2('0x43')](_0x107434['lastIndexOf']('(')+0x1,_0x107434[_0x7cc2('0x31')](')'));_0x3481a2[_0x7cc2('0x54')]=_0x3f6856;_0x404b92(_0x3481a2);})['catch'](function(_0x26258e){_0x550a47(_0x26258e[_0x7cc2('0x28')]);});});}function emit(_0x3f7c68,_0x73dcea,_0xd19fb8,_0x340b13){var _0x5d24d4={'uri':util[_0x7cc2('0x55')](_0x7cc2('0x56'),_0x3f7c68,_0xd19fb8,_0x340b13)};io['to'](util[_0x7cc2('0x55')](_0x7cc2('0x57'),_0x73dcea))['emit'](_0x7cc2('0x58'),_0x5d24d4);}exports['cs']=function(_0x429d5d,_0x1222ba,_0xb852a7,_0x1b85d0,_0x203602,_0x2b332f,_0x36ed04,_0x3ca3b7){var _0x2464c8={};_0x2b332f[_0x7cc2('0xc')]=_0x2b332f['modernAuthentication']?intUtil[_0x7cc2('0x59')](_0x2b332f[_0x7cc2('0xd')][_0x7cc2('0x5a')]):intUtil[_0x7cc2('0x59')](_0x2b332f['remoteUri']);_0x2b332f['serverUrl']=intUtil[_0x7cc2('0x59')](_0x2b332f[_0x7cc2('0x5b')]);_0x2464c8[_0x7cc2('0x4f')]=_0x3ca3b7==='queue'||_0x3ca3b7===_0x7cc2('0x5c')?_0x7cc2('0x4e'):_0x7cc2('0x2a');var _0x3e414b=_0x2b332f['modernAuthentication']?util['format'](_0x7cc2('0x5d'),_0x2b332f[_0x7cc2('0xd')][_0x7cc2('0x5a')]):util['format']('%s/api/data/v9.0/',_0x2b332f[_0x7cc2('0xc')]);var _0x42c58f=util['format'](_0x7cc2('0x5e'),_0x2b332f[_0x7cc2('0xe')]);var _0x5c4bd9=util[_0x7cc2('0x55')](_0x7cc2('0x5f'),_0x2b332f['serverUrl'],_0x1222ba[_0x7cc2('0x60')],md5(_0x1222ba[_0x7cc2('0x60')]));if(_0x203602&&_0x203602['monitor_format']){logger[_0x7cc2('0x23')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1222ba[_0x7cc2('0x61')]=_0x5c4bd9;}else if(_0x36ed04&&_0x36ed04[_0x7cc2('0x62')]&&_0x36ed04[_0x7cc2('0x62')]!==_0x7cc2('0x63')){logger[_0x7cc2('0x23')]('[OUTBOUND]',_0x7cc2('0x64'));_0x1222ba[_0x7cc2('0x61')]=_0x5c4bd9;}else{_0x1222ba['recordingURL']='';}return getUser(_0x2464c8,_0x2b332f,_0x1b85d0,_0x42c58f,_0x3e414b,_0x3ca3b7)[_0x7cc2('0x13')](function(_0xc1020c){logger[_0x7cc2('0x23')]('['+_0x3ca3b7[_0x7cc2('0x17')]()+']\x20The\x20User\x20ID\x20is:',_0xc1020c[_0x7cc2('0x26')]);logger[_0x7cc2('0x23')]('['+_0x3ca3b7['toUpperCase']()+_0x7cc2('0x65'),_0xc1020c[_0x7cc2('0x1f')]);return getEndUser(_0xc1020c,_0x2b332f,_0x42c58f,_0x3e414b,_0x1222ba,_0x3ca3b7,_0xb852a7[_0x7cc2('0x66')],_0xb852a7[_0x7cc2('0x67')]);})[_0x7cc2('0x13')](function(_0x67f040){logger[_0x7cc2('0x23')]('['+_0x3ca3b7[_0x7cc2('0x17')]()+_0x7cc2('0x68'),_0x67f040[_0x7cc2('0x32')]);logger['info']('['+_0x3ca3b7[_0x7cc2('0x17')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1222ba[_0x7cc2('0x2c')]);return getTicket(_0x67f040,_0x2b332f,_0x42c58f,_0x3e414b,_0x1222ba,_0xb852a7,_0x3ca3b7);})[_0x7cc2('0x13')](function(_0x28a9c0){logger[_0x7cc2('0x23')](util['format']('['+_0x3ca3b7[_0x7cc2('0x17')]()+_0x7cc2('0x69'),_0xb852a7[_0x7cc2('0x46')],_0x28a9c0['ticketId']));logger['info'](util[_0x7cc2('0x55')]('['+_0x3ca3b7['toUpperCase']()+_0x7cc2('0x6a'),_0x3ca3b7));if(_0x3ca3b7!==_0x7cc2('0x5c')&&_0xb852a7[_0x7cc2('0x6b')]){logger[_0x7cc2('0x23')]('['+_0x3ca3b7['toUpperCase']()+']',_0x7cc2('0x6c'));emit(_0x2b332f[_0x7cc2('0xc')],_0x1b85d0[_0x7cc2('0x6d')],_0xb852a7[_0x7cc2('0x46')],_0x28a9c0[_0x7cc2('0x54')]);}})['catch'](function(_0x105e2e){logger['error']('['+_0x3ca3b7[_0x7cc2('0x17')]()+_0x7cc2('0x6e'),_0x105e2e['message']);console['error'](_0x7cc2('0x6f'),_0x105e2e);});}; \ No newline at end of file +var _0xc6dd=['https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','name','catch',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','ioredis','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','data5','POST','username','password','then','error','toUpperCase',']\x20Wrong\x20credentials!','GET','Bearer\x20','isNil','validateEmail','email','userEmail','length','internalemailaddress',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','destcalleridnum','calleridnum','contacts','/systemusers(','4.0','headers','lastIndexOf','message','toLowerCase','contacts?$select=','&$filter=','replace','%2b','value','enduserId','info',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','customField','indexOf','substring','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','phonecall','queue','callDirection','Subjects','Fields','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/'];(function(_0x330fdc,_0x3fdba4){var _0x2edb38=function(_0x4f79e8){while(--_0x4f79e8){_0x330fdc['push'](_0x330fdc['shift']());}};_0x2edb38(++_0x3fdba4);}(_0xc6dd,0x18d));var _0xdc6d=function(_0xfd3034,_0x4ad7a9){_0xfd3034=_0xfd3034-0x0;var _0x8e0e16=_0xc6dd[_0xfd3034];return _0x8e0e16;};'use strict';var _=require(_0xdc6d('0x0'));var rp=require(_0xdc6d('0x1'));var util=require('util');var intUtil=require(_0xdc6d('0x2'));var md5=require('md5');var Redis=require(_0xdc6d('0x3'));var logger=require('../../../../config/logger')(_0xdc6d('0x4'));var config=require(_0xdc6d('0x5'));config[_0xdc6d('0x6')]=_[_0xdc6d('0x7')](config[_0xdc6d('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xdc6d('0x8'))(new Redis(config[_0xdc6d('0x6')]));function getAuthToken(_0x2332e8,_0x4b8977,_0xd6723b){if(_0x2332e8[_0xdc6d('0x9')]){_0x2332e8[_0xdc6d('0xa')]=_0x2332e8[_0xdc6d('0xb')][_0xdc6d('0xc')];_0x2332e8[_0xdc6d('0xd')]=_0x2332e8[_0xdc6d('0xb')][_0xdc6d('0xe')];return Promise['resolve'](_0x2332e8[_0xdc6d('0xb')][_0xdc6d('0xf')]);}var _0x41115c={'method':_0xdc6d('0x10'),'uri':_0x4b8977,'form':{'client_id':_0x2332e8['clientId'],'resource':_0x2332e8[_0xdc6d('0xa')],'username':_0x2332e8[_0xdc6d('0x11')],'password':_0x2332e8[_0xdc6d('0x12')],'grant_type':_0xdc6d('0x12'),'client_secret':_0x2332e8['clientSecret']},'json':!![]};return rp(_0x41115c)[_0xdc6d('0x13')](function(_0x465fdd){return _0x465fdd['access_token'];})['catch'](function(_0x2537f5){logger[_0xdc6d('0x14')]('['+[_0xd6723b[_0xdc6d('0x15')]()]+_0xdc6d('0x16'));return _0x2537f5['message'];});}function getUser(_0x4d2b17,_0x3942cf,_0x237452,_0x4c6e5d,_0x4ed308,_0x2ba446){return new Promise(function(_0x2c9879,_0x5c77d3){return getAuthToken(_0x3942cf,_0x4c6e5d,_0x2ba446)[_0xdc6d('0x13')](function(_0x10ea65){var _0x5e1e08={'method':_0xdc6d('0x17'),'uri':_0x4ed308+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xdc6d('0x18')+_0x10ea65,'OData-Version':'4.0'},'json':!![]};return rp(_0x5e1e08);})[_0xdc6d('0x13')](function(_0x3353c6){var _0x2ba602=_0x3353c6['value'];var _0x51f8c6=![];var _0x326691=null;if(!_[_0xdc6d('0x19')](_0x237452)){if(intUtil[_0xdc6d('0x1a')](_0x237452[_0xdc6d('0x1b')])){_0x4d2b17[_0xdc6d('0x1c')]=_0x237452[_0xdc6d('0x1b')];for(_0x326691=0x0;_0x326691<_0x2ba602[_0xdc6d('0x1d')];_0x326691++){if(_0x2ba602[_0x326691][_0xdc6d('0x1e')]===_0x237452[_0xdc6d('0x1b')]&&!_0x2ba602[_0x326691]['isdisabled']){_0x51f8c6=!![];logger['info']('['+[_0x2ba446[_0xdc6d('0x15')]()]+_0xdc6d('0x1f')+_0x2ba602[_0x326691]['systemuserid']+'!');_0x4d2b17[_0xdc6d('0x20')]=_0x2ba602[_0x326691][_0xdc6d('0x21')];}}}}if(!_0x51f8c6){logger['info']('['+[_0x2ba446['toUpperCase']()]+_0xdc6d('0x22'));_0x4d2b17[_0xdc6d('0x1c')]=_0x3942cf[_0xdc6d('0x11')];for(_0x326691=0x0;_0x326691<_0x2ba602[_0xdc6d('0x1d')];_0x326691++){if(_0x2ba602[_0x326691][_0xdc6d('0x1e')]===_0x3942cf[_0xdc6d('0x11')]){_0x4d2b17[_0xdc6d('0x20')]=_0x2ba602[_0x326691][_0xdc6d('0x21')];}}}_0x2c9879(_0x4d2b17);})['catch'](function(_0x3e0ce7){_0x5c77d3(_0x3e0ce7['message']);});});}function createEndUser(_0x35c5c9,_0x4a8596,_0x4d2e14,_0x3ec2cf,_0x5643b7,_0x2713b2,_0x4ddfe8){return new Promise(function(_0x46af59,_0x430ab8){return getAuthToken(_0x4a8596,_0x4d2e14,_0x2713b2)[_0xdc6d('0x13')](function(_0x13b5ac){var _0x3454eb=_0x2713b2['toLowerCase']()==='outbound'?_0x5643b7[_0xdc6d('0x23')]:_0x5643b7[_0xdc6d('0x24')];var _0x24017e={'method':_0xdc6d('0x10'),'uri':_0x3ec2cf+_0xdc6d('0x25'),'body':{'fullname':_0x3454eb,'firstname':_0x3454eb,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xdc6d('0x26')+_0x35c5c9['userId']+')'},'headers':{'Authorization':_0xdc6d('0x18')+_0x13b5ac,'OData-Version':_0xdc6d('0x27')},'json':!![],'resolveWithFullResponse':!![]};_0x24017e['body'][_0x4ddfe8]=_0x3454eb;return rp(_0x24017e);})[_0xdc6d('0x13')](function(_0x185f70){var _0x1f5bcc=_0x185f70[_0xdc6d('0x28')]['odata-entityid'];var _0x206ec1=_0x1f5bcc['substring'](_0x1f5bcc[_0xdc6d('0x29')]('(')+0x1,_0x1f5bcc[_0xdc6d('0x29')](')'));_0x35c5c9['enduserId']=_0x206ec1;_0x46af59(_0x35c5c9);})['catch'](function(_0x1a6c8e){_0x430ab8(_0x1a6c8e[_0xdc6d('0x2a')]);});});}function getEndUser(_0x2357b3,_0x4153a5,_0x1e52fa,_0x21804e,_0x3ef1a4,_0x1bc518,_0x1650c2,_0x104937){var _0x4791e6=_0x1bc518[_0xdc6d('0x2b')]()==='outbound'?_0x3ef1a4['destcalleridnum']:_0x3ef1a4[_0xdc6d('0x24')];return getAuthToken(_0x4153a5,_0x1e52fa,_0x1bc518)['then'](function(_0xa23353){_0x104937=_0x104937?_0x104937:'telephone1';var _0x1f3b91={'method':_0xdc6d('0x17'),'uri':_0x21804e+_0xdc6d('0x2c')+_0x104937+_0xdc6d('0x2d')+_0x104937+'\x20eq\x20\x27'+_0x4791e6[_0xdc6d('0x2e')]('+',_0xdc6d('0x2f'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0xa23353,'If-None-Match':null,'OData-Version':_0xdc6d('0x27')},'json':!![]};return rp(_0x1f3b91);})[_0xdc6d('0x13')](function(_0x311e5b){var _0x12fd64=![];if(!_0x311e5b)return _0x12fd64;var _0x388703=_0x311e5b[_0xdc6d('0x30')];for(var _0x43f176=0x0;_0x43f176<_0x388703[_0xdc6d('0x1d')];_0x43f176++){if(_0x388703[_0x43f176][_0x104937]===_0x4791e6){_0x12fd64=!![];_0x2357b3[_0xdc6d('0x31')]=_0x388703[_0x43f176]['contactid'];}}return _0x12fd64;})['then'](function(_0x1cf86f){if(_0x1cf86f)return _0x2357b3;if(_0x1650c2==='nothing'){logger[_0xdc6d('0x32')]('['+[_0x1bc518[_0xdc6d('0x15')]()]+_0xdc6d('0x33'));return _0x2357b3;}return createEndUser(_0x2357b3,_0x4153a5,_0x1e52fa,_0x21804e,_0x3ef1a4,_0x1bc518,_0x104937)['then'](function(_0x321a8b){logger['info']('['+[_0x1bc518['toUpperCase']()]+_0xdc6d('0x34'),_0x321a8b[_0xdc6d('0x31')]);return _0x321a8b;});});}function getCustomFields(_0x55ec79,_0x2aca83,_0x5604c3){var _0x38e5d3={};if(_0x55ec79['length']>0x0){_[_0xdc6d('0x35')](_0x55ec79,function(_0x580e4a){if(_['includes']([_0xdc6d('0x36'),'picklist'],_0x580e4a['type'])&&_0x580e4a['nameField']&&!_0x580e4a[_0xdc6d('0x37')]){var _0x1fa6b7=_0x580e4a['idField'][_0xdc6d('0x2b')]();var _0x1fe09a=_0x1fa6b7['substring'](0x0,_0x1fa6b7[_0xdc6d('0x38')]('_'));var _0x188fc7=_0x1fa6b7[_0xdc6d('0x39')](_0x1fa6b7[_0xdc6d('0x38')]('_')+0x1);if(_0x1fe09a===_0x5604c3){_0x38e5d3[_0x188fc7]=_0x580e4a['content'];}}});}return _0x38e5d3;}function getTicket(_0x124c22,_0x372a40,_0x14397c,_0x258cb8,_0x98781b,_0x5e5611,_0x34aa75){return new Promise(function(_0x575487,_0x3a6cc9){var _0x533e4e;return getAuthToken(_0x372a40,_0x14397c,_0x34aa75)[_0xdc6d('0x13')](function(_0x2fba57){if(_0x5e5611[_0xdc6d('0x3a')]===_0xdc6d('0x3b')){_0x533e4e={'method':_0xdc6d('0x10'),'uri':_0x258cb8+_0xdc6d('0x3c'),'body':Object[_0xdc6d('0x3d')]({},{'title':intUtil[_0xdc6d('0x3e')](_0x5e5611['Subjects'],_0x98781b,'\x20'),'description':intUtil[_0xdc6d('0x3e')](_0x5e5611[_0xdc6d('0x3f')],_0x98781b,'\x0a'),'customerid_contact@odata.bind':_0x124c22['enduserId']?_0xdc6d('0x40')+_0x124c22[_0xdc6d('0x31')]+')':undefined,'ownerid@odata.bind':_0xdc6d('0x26')+_0x124c22[_0xdc6d('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x5e5611['Fields'],_0x98781b,_0x5e5611['ticketType'])),'headers':{'Authorization':_0xdc6d('0x18')+_0x2fba57,'OData-Version':_0xdc6d('0x27')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5e5611[_0xdc6d('0x3a')]===_0xdc6d('0x41')){var _0x4dbae2=_0x124c22[_0xdc6d('0x31')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x124c22[_0xdc6d('0x20')]+')','participationtypemask':_0x124c22['callDirection']===_0xdc6d('0x42')?0x2:0x1},{'partyid_contact@odata.bind':_0xdc6d('0x40')+_0x124c22[_0xdc6d('0x31')]+')','participationtypemask':_0x124c22[_0xdc6d('0x43')]===_0xdc6d('0x42')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xdc6d('0x26')+_0x124c22[_0xdc6d('0x20')]+')','participationtypemask':_0x124c22[_0xdc6d('0x43')]===_0xdc6d('0x42')?0x2:0x1}];_0x533e4e={'method':_0xdc6d('0x10'),'uri':_0x258cb8+'phonecalls','body':Object[_0xdc6d('0x3d')]({},{'subject':intUtil[_0xdc6d('0x3e')](_0x5e5611[_0xdc6d('0x44')],_0x98781b,'\x20'),'phonenumber':String(_0x98781b[_0xdc6d('0x24')]),'description':intUtil['getString'](_0x5e5611[_0xdc6d('0x3f')],_0x98781b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x124c22[_0xdc6d('0x31')]?_0xdc6d('0x40')+_0x124c22[_0xdc6d('0x31')]+')':undefined,'ownerid@odata.bind':_0xdc6d('0x26')+_0x124c22[_0xdc6d('0x20')]+')','directioncode':_0x124c22[_0xdc6d('0x43')]==='queue'?![]:!![],'phonecall_activity_parties':_0x4dbae2},getCustomFields(_0x5e5611[_0xdc6d('0x45')],_0x98781b,_0x5e5611[_0xdc6d('0x3a')])),'headers':{'Authorization':_0xdc6d('0x18')+_0x2fba57,'OData-Version':_0xdc6d('0x27')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x533e4e);})[_0xdc6d('0x13')](function(_0x106421){var _0x19e630=_0x106421[_0xdc6d('0x28')]['odata-entityid'];var _0x3e6831=_0x19e630[_0xdc6d('0x39')](_0x19e630[_0xdc6d('0x29')]('(')+0x1,_0x19e630['lastIndexOf'](')'));_0x124c22['ticketId']=_0x3e6831;_0x575487(_0x124c22);})['catch'](function(_0x9bc797){_0x3a6cc9(_0x9bc797['message']);});});}function emit(_0x3d58c0,_0x44699a,_0x1442b4,_0x4bd7c3){var _0x3b1f45={'uri':util[_0xdc6d('0x46')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3d58c0,_0x1442b4,_0x4bd7c3)};io['to'](util[_0xdc6d('0x46')](_0xdc6d('0x47'),_0x44699a))[_0xdc6d('0x48')]('trigger:browser:url',_0x3b1f45);}exports['cs']=function(_0x240edc,_0x371022,_0x4146dd,_0x132b26,_0x505956,_0x376092,_0x476e58,_0x468d38){var _0x10a64b={};_0x376092[_0xdc6d('0xa')]=_0x376092[_0xdc6d('0x9')]?intUtil[_0xdc6d('0x49')](_0x376092[_0xdc6d('0xb')][_0xdc6d('0xc')]):intUtil[_0xdc6d('0x49')](_0x376092[_0xdc6d('0xa')]);_0x376092[_0xdc6d('0x4a')]=intUtil[_0xdc6d('0x49')](_0x376092[_0xdc6d('0x4a')]);_0x10a64b[_0xdc6d('0x43')]=_0x468d38==='queue'||_0x468d38===_0xdc6d('0x4b')?_0xdc6d('0x42'):_0xdc6d('0x4c');var _0x3739ca=_0x376092['modernAuthentication']?util[_0xdc6d('0x46')](_0xdc6d('0x4d'),_0x376092['CloudProvider'][_0xdc6d('0xc')]):util[_0xdc6d('0x46')](_0xdc6d('0x4d'),_0x376092[_0xdc6d('0xa')]);var _0x3e470d=util[_0xdc6d('0x46')](_0xdc6d('0x4e'),_0x376092[_0xdc6d('0xd')]);var _0x34c98d=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x376092[_0xdc6d('0x4a')],_0x371022[_0xdc6d('0x4f')],md5(_0x371022[_0xdc6d('0x4f')]));if(_0x505956&&_0x505956['monitor_format']){logger[_0xdc6d('0x32')](_0xdc6d('0x50'),_0xdc6d('0x51'));_0x371022[_0xdc6d('0x52')]=_0x34c98d;}else if(_0x476e58&&_0x476e58[_0xdc6d('0x53')]&&_0x476e58[_0xdc6d('0x53')]!=='none'){logger[_0xdc6d('0x32')](_0xdc6d('0x54'),_0xdc6d('0x51'));_0x371022[_0xdc6d('0x52')]=_0x34c98d;}else{_0x371022[_0xdc6d('0x52')]='';}return getUser(_0x10a64b,_0x376092,_0x132b26,_0x3e470d,_0x3739ca,_0x468d38)[_0xdc6d('0x13')](function(_0xccf166){logger[_0xdc6d('0x32')]('['+_0x468d38[_0xdc6d('0x15')]()+_0xdc6d('0x55'),_0xccf166[_0xdc6d('0x20')]);logger['info']('['+_0x468d38[_0xdc6d('0x15')]()+']\x20The\x20User\x20email\x20is:',_0xccf166['userEmail']);return getEndUser(_0xccf166,_0x376092,_0x3e470d,_0x3739ca,_0x371022,_0x468d38,_0x4146dd['moduleCreate'],_0x4146dd[_0xdc6d('0x56')]);})[_0xdc6d('0x13')](function(_0x1b7e76){logger[_0xdc6d('0x32')]('['+_0x468d38[_0xdc6d('0x15')]()+_0xdc6d('0x57'),_0x1b7e76['enduserId']);logger[_0xdc6d('0x32')]('['+_0x468d38['toUpperCase']()+_0xdc6d('0x58'),_0x371022[_0xdc6d('0x24')]);return getTicket(_0x1b7e76,_0x376092,_0x3e470d,_0x3739ca,_0x371022,_0x4146dd,_0x468d38);})['then'](function(_0x176ade){logger[_0xdc6d('0x32')](util[_0xdc6d('0x46')]('['+_0x468d38[_0xdc6d('0x15')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x4146dd[_0xdc6d('0x3a')],_0x176ade[_0xdc6d('0x59')]));logger['info'](util[_0xdc6d('0x46')]('['+_0x468d38['toUpperCase']()+_0xdc6d('0x5a'),_0x468d38));if(_0x468d38!=='unmanaged'&&_0x4146dd[_0xdc6d('0x5b')]){logger[_0xdc6d('0x32')]('['+_0x468d38[_0xdc6d('0x15')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x376092[_0xdc6d('0xa')],_0x132b26[_0xdc6d('0x5c')],_0x4146dd['ticketType'],_0x176ade[_0xdc6d('0x59')]);}})[_0xdc6d('0x5d')](function(_0x53dacb){logger[_0xdc6d('0x14')]('['+_0x468d38[_0xdc6d('0x15')]()+_0xdc6d('0x5e'),_0x53dacb[_0xdc6d('0x2a')]);console[_0xdc6d('0x14')]('Error\x20running\x20Dynamics365\x20integration',_0x53dacb);});}; \ 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 bcc0f3a..dc1f979 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 _0x4847=['Authorization','lodash','request-promise','util','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','[HTTP]','stringify','forEach','includes','string','nameField','toLowerCase','content','picklist','type','idField','customField','variable','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','user:%s','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x4847,0x11e));var _0x7484=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4847[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x7484('0x0'));var rp=require(_0x7484('0x1'));var md5=require('md5');var util=require(_0x7484('0x2'));var Redis=require('ioredis');var intUtil=require(_0x7484('0x3'));var config=require('../../../../config/environment');var logger=require(_0x7484('0x4'))(_0x7484('0x5'));config[_0x7484('0x6')]=_[_0x7484('0x7')](config[_0x7484('0x6')],{'host':_0x7484('0x8'),'port':0x18eb});var io=require(_0x7484('0x9'))(new Redis(config[_0x7484('0x6')]));var headers={'Content-Type':_0x7484('0xa'),'Accept':_0x7484('0xa')};function emit(_0x46aa5a,_0x44fd6c,_0x4901c3){io['to'](_0x46aa5a)[_0x7484('0xb')](_0x44fd6c,_0x4901c3);}function getTicket(_0x262cf5,_0x5c7c3a,_0x11ac46,_0x2bfdc1,_0x278359){logger[_0x7484('0xc')](_0x7484('0xd'));var _0x52efa6=_[_0x7484('0xe')]({'responder_id':_0x5c7c3a['id'],'requester_id':_0x11ac46['id'],'name':util[_0x7484('0xf')](_0x7484('0x10'),_0x278359[_0x7484('0x11')]),'phone':_0x278359['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7484('0x12')](_0x2bfdc1['Subjects'],_0x278359,'\x20'),'description':intUtil['getString'](_0x2bfdc1[_0x7484('0x13')],_0x278359,_0x7484('0x14')),'tags':getTags(_0x2bfdc1[_0x7484('0x15')],_0x7484('0x16'))},getCustomFields(_0x2bfdc1[_0x7484('0x17')],_0x278359));_0x52efa6[_0x7484('0x18')]=_[_0x7484('0x19')](_[_0x7484('0x1a')](_0x52efa6[_0x7484('0x18')],'id'),_0x7484('0x1b'));return request({'uri':util[_0x7484('0xf')](_0x7484('0x1c'),_0x262cf5[_0x7484('0x1d')]),'method':_0x7484('0x1e'),'body':_0x52efa6})[_0x7484('0x1f')](function(_0x32274c){logger[_0x7484('0xc')](_0x7484('0x20'));return _0x32274c;});}function getUser(_0x17ec60,_0x5b5997){if(intUtil[_0x7484('0x21')](_0x5b5997)){return request({'uri':util[_0x7484('0xf')]('%s/api/v2/agents',_0x17ec60[_0x7484('0x1d')]),'qs':{'email':_0x5b5997}})['then'](function(_0x47ed1d){if(_0x47ed1d[_0x7484('0x22')]){logger[_0x7484('0xc')](_0x7484('0x23'));return _[_0x7484('0x24')](_0x47ed1d,function(_0x19f12a){return _0x19f12a[_0x7484('0x25')][_0x7484('0x26')]===_0x5b5997;});}else{logger[_0x7484('0xc')](_0x7484('0x27'));return request({'uri':util['format'](_0x7484('0x28'),_0x17ec60[_0x7484('0x1d')])})[_0x7484('0x1f')](function(_0x42c4e0){logger[_0x7484('0xc')](_0x7484('0x29'));return _0x42c4e0;});}});}else{logger[_0x7484('0xc')](_0x7484('0x2a'));return request({'uri':util['format'](_0x7484('0x28'),_0x17ec60['remoteUri'])})[_0x7484('0x1f')](function(_0x5cf355){logger['info'](_0x7484('0x29'));return _0x5cf355;});}}function getEndUser(_0xca0094,_0x2fda3e,_0x335ef0){logger[_0x7484('0xc')]('Searching\x20enduser\x20with\x20phone',_0x335ef0);return request({'uri':util[_0x7484('0xf')](_0x7484('0x2b'),_0xca0094[_0x7484('0x1d')]),'qs':{'phone':_0x335ef0}})[_0x7484('0x1f')](function(_0x44142b){if(_0x44142b[_0x7484('0x22')]){logger[_0x7484('0xc')](_0x7484('0x2c'));return _[_0x7484('0x24')](_0x44142b,{'phone':_0x335ef0});}else{logger[_0x7484('0xc')](_0x7484('0x2d'));return request({'uri':util[_0x7484('0xf')](_0x7484('0x2b'),_0xca0094[_0x7484('0x1d')]),'method':_0x7484('0x1e'),'body':{'name':_0x2fda3e,'phone':_0x335ef0}})['then'](function(_0x7e1fa){logger[_0x7484('0xc')](_0x7484('0x2e'));return _0x7e1fa;});}});}function getAuth(_0xf3270c){return util[_0x7484('0xf')](_0x7484('0x2f'),new Buffer(_0xf3270c[_0x7484('0x30')]+':X')[_0x7484('0x31')]('base64'));}function request(_0x585be2){logger['debug'](_0x7484('0x32'),JSON[_0x7484('0x33')](_0x585be2));return rp(_[_0x7484('0x7')](_0x585be2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x516d20,_0x50751b){var _0x3457a6=[];if(_0x516d20&&_0x516d20[_0x7484('0x22')]>0x0){_0x3457a6=_['map'](_0x516d20,_0x50751b);}return _0x3457a6;}function getCustomFields(_0x5b174d,_0x2dcdb0){var _0x47d929=[];var _0x187c83={'custom_fields':[]};if(_0x5b174d[_0x7484('0x22')]>0x0){_[_0x7484('0x34')](_0x5b174d,function(_0x27840c){if(_[_0x7484('0x35')]([_0x7484('0x36'),'picklist'],_0x27840c['type'])&&_0x27840c[_0x7484('0x37')]&&!_0x27840c['customField']){_0x187c83[_0x27840c['nameField'][_0x7484('0x38')]()]=_0x27840c[_0x7484('0x39')][_0x7484('0x31')]();}else if(_['includes']([_0x7484('0x36'),_0x7484('0x3a')],_0x27840c[_0x7484('0x3b')])&&_0x27840c[_0x7484('0x3c')]&&_0x27840c[_0x7484('0x3d')]){_0x187c83[_0x7484('0x18')]['push']({'id':_0x27840c[_0x7484('0x3c')],'value':_0x27840c[_0x7484('0x39')]['toString']()});}else if(_0x27840c[_0x7484('0x3b')]===_0x7484('0x3e')&&_0x27840c['variableName']&&_0x27840c[_0x7484('0x3c')]&&_0x27840c['customField']){_0x2dcdb0[_0x27840c['variableName']]&&_0x187c83[_0x7484('0x18')][_0x7484('0x3f')]({'id':_0x27840c[_0x7484('0x3c')],'value':_0x2dcdb0[_0x27840c['variableName']]['toString']()});}else if(_0x27840c[_0x7484('0x3b')]===_0x7484('0x40')&&_0x27840c[_0x7484('0x41')]&&_0x27840c[_0x7484('0x41')][_0x7484('0x16')]&&_0x27840c[_0x7484('0x3c')]&&_0x27840c['customField']){_0x2dcdb0[_0x27840c[_0x7484('0x41')][_0x7484('0x16')]['toLowerCase']()]&&_0x187c83['custom_fields'][_0x7484('0x3f')]({'id':_0x27840c[_0x7484('0x3c')],'value':_0x2dcdb0[_0x27840c[_0x7484('0x41')][_0x7484('0x16')][_0x7484('0x38')]()][_0x7484('0x31')]()});}});}return _0x187c83;}exports[_0x7484('0x42')]=function(_0x34b4e0,_0x438a2e,_0x2efe6c,_0x30efe5,_0x3ff4e7,_0x4751a8){var _0x43e3dc,_0x504afb;_0x4751a8['remoteUri']=intUtil[_0x7484('0x43')](_0x4751a8[_0x7484('0x1d')]);_0x4751a8['serverUrl']=intUtil[_0x7484('0x43')](_0x4751a8[_0x7484('0x44')]);if(_0x3ff4e7&&_0x3ff4e7[_0x7484('0x45')]){logger[_0x7484('0xc')](_0x7484('0x46'),'Recording\x20is\x20enabled!');_0x438a2e[_0x7484('0x47')]=util['format'](_0x7484('0x48'),_0x4751a8[_0x7484('0x44')],_0x438a2e[_0x7484('0x49')],md5(_0x438a2e[_0x7484('0x49')]));}else{_0x438a2e[_0x7484('0x47')]='';}headers['Authorization']=getAuth(_0x4751a8);return getUser(_0x4751a8,_0x30efe5[_0x7484('0x26')])['then'](function(_0x25bb91){_0x43e3dc=_0x25bb91;logger[_0x7484('0xc')](_0x7484('0x4a'),_0x43e3dc['id']);return getEndUser(_0x4751a8,_0x438a2e[_0x7484('0x11')],_0x438a2e[_0x7484('0x4b')]);})[_0x7484('0x1f')](function(_0x5ab2b9){_0x504afb=_0x5ab2b9;logger['info'](_0x7484('0x4c'),_0x504afb['id']);return getTicket(_0x4751a8,_0x43e3dc,_0x504afb,_0x2efe6c,_0x438a2e);})['then'](function(_0x47bd2d){if(_0x47bd2d&&_0x47bd2d['id']){logger[_0x7484('0xc')](_0x7484('0x20'));logger[_0x7484('0xc')](_0x7484('0x4d'),_0x47bd2d['id']);logger[_0x7484('0xc')](_0x7484('0x46'),_0x7484('0x4e'));emit(util[_0x7484('0xf')]('user:%s',_0x30efe5[_0x7484('0x16')]),_0x7484('0x4f'),{'uri':util[_0x7484('0xf')](_0x7484('0x50'),_0x4751a8['remoteUri'],_0x47bd2d['id'])});}})[_0x7484('0x51')](function(_0x24b43e){logger[_0x7484('0x52')](_0x7484('0x46'),JSON[_0x7484('0x33')](_0x24b43e));});};exports[_0x7484('0x53')]=function(_0x34dda3,_0x5361b1,_0x36eee6,_0x3c3067,_0x28407d,_0x27a776,_0x4bdf60){var _0x1d9899,_0x578756;_0x27a776['remoteUri']=intUtil[_0x7484('0x43')](_0x27a776[_0x7484('0x1d')]);_0x27a776[_0x7484('0x44')]=intUtil[_0x7484('0x43')](_0x27a776[_0x7484('0x44')]);if(_0x4bdf60&&_0x4bdf60['recordingFormat']&&_0x4bdf60[_0x7484('0x54')]!==_0x7484('0x55')){logger[_0x7484('0xc')](_0x7484('0x56'),'Recording\x20is\x20enabled!');_0x5361b1[_0x7484('0x47')]=util[_0x7484('0xf')](_0x7484('0x48'),_0x27a776[_0x7484('0x44')],_0x5361b1[_0x7484('0x49')],md5(_0x5361b1[_0x7484('0x49')]));}headers['Authorization']=getAuth(_0x27a776);return getUser(_0x27a776,_0x3c3067[_0x7484('0x26')])[_0x7484('0x1f')](function(_0x1a9090){_0x1d9899=_0x1a9090;logger[_0x7484('0xc')](_0x7484('0x4a'),_0x1d9899['id']);return getEndUser(_0x27a776,_0x5361b1[_0x7484('0x57')],_0x5361b1[_0x7484('0x58')]);})[_0x7484('0x1f')](function(_0x4b7773){_0x578756=_0x4b7773;logger[_0x7484('0xc')](_0x7484('0x4c'),_0x578756['id']);return getTicket(_0x27a776,_0x1d9899,_0x578756,_0x36eee6,_0x5361b1);})['then'](function(_0x2f1be7){if(_0x2f1be7&&_0x2f1be7['id']){logger['info'](_0x7484('0x20'));logger[_0x7484('0xc')](_0x7484('0x4d'),_0x2f1be7['id']);logger['info'](_0x7484('0x56'),_0x7484('0x4e'));emit(util[_0x7484('0xf')](_0x7484('0x59'),_0x3c3067[_0x7484('0x16')]),_0x7484('0x4f'),{'uri':util[_0x7484('0xf')](_0x7484('0x50'),_0x27a776[_0x7484('0x1d')],_0x2f1be7['id'])});}})['catch'](function(_0xe3417f){logger[_0x7484('0x52')]('[OUTBOUND]',JSON['stringify'](_0xe3417f));});};exports[_0x7484('0x5a')]=function(_0x3b4198,_0x2943c0,_0x2fc235,_0x23a56c,_0x33738a,_0x22bb67){var _0x529c0b,_0x28e6c5;_0x22bb67[_0x7484('0x1d')]=intUtil[_0x7484('0x43')](_0x22bb67[_0x7484('0x1d')]);_0x22bb67['serverUrl']=intUtil[_0x7484('0x43')](_0x22bb67[_0x7484('0x44')]);if(_0x33738a&&_0x33738a[_0x7484('0x45')]){logger[_0x7484('0xc')]('['+_0x2943c0[_0x7484('0x5b')][_0x7484('0x5c')]()+']',_0x7484('0x5d'));_0x2943c0[_0x7484('0x47')]=util[_0x7484('0xf')](_0x7484('0x48'),_0x22bb67[_0x7484('0x44')],_0x2943c0[_0x7484('0x49')],md5(_0x2943c0[_0x7484('0x49')]));}else{_0x2943c0[_0x7484('0x47')]='';}headers[_0x7484('0x5e')]=getAuth(_0x22bb67);return getUser(_0x22bb67,'')[_0x7484('0x1f')](function(_0x5f554d){_0x529c0b=_0x5f554d;logger[_0x7484('0xc')](_0x7484('0x4a'),_0x529c0b['id']);return getEndUser(_0x22bb67,_0x2943c0[_0x7484('0x11')],_0x2943c0[_0x7484('0x4b')]);})['then'](function(_0x2e8aea){_0x28e6c5=_0x2e8aea;logger[_0x7484('0xc')](_0x7484('0x4c'),_0x28e6c5['id']);return getTicket(_0x22bb67,_0x529c0b,_0x28e6c5,_0x2fc235,_0x2943c0);})['then'](function(_0x4f49f8){if(_0x4f49f8){logger['info'](_0x7484('0x20'));logger[_0x7484('0xc')](_0x7484('0x4d'),_0x4f49f8['id']);}})[_0x7484('0x51')](function(_0x197bab){logger[_0x7484('0x52')]('['+_0x2943c0[_0x7484('0x5b')][_0x7484('0x5c')]()+']',JSON[_0x7484('0x33')](_0x197bab));});}; \ No newline at end of file +var _0x7264=['Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','map','forEach','picklist','type','nameField','customField','content','includes','string','idField','push','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','error','stringify','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','Subjects','getString','Descriptions','Tags','name','custom_fields','keyBy','value','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.'];(function(_0x307d2b,_0x3796e0){var _0xe82587=function(_0x3c9b26){while(--_0x3c9b26){_0x307d2b['push'](_0x307d2b['shift']());}};_0xe82587(++_0x3796e0);}(_0x7264,0x1a8));var _0x4726=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7264[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4726('0x0'));var rp=require(_0x4726('0x1'));var md5=require(_0x4726('0x2'));var util=require(_0x4726('0x3'));var Redis=require(_0x4726('0x4'));var intUtil=require(_0x4726('0x5'));var config=require(_0x4726('0x6'));var logger=require('../../../../config/logger')(_0x4726('0x7'));config['redis']=_[_0x4726('0x8')](config[_0x4726('0x9')],{'host':_0x4726('0xa'),'port':0x18eb});var io=require(_0x4726('0xb'))(new Redis(config[_0x4726('0x9')]));var headers={'Content-Type':_0x4726('0xc'),'Accept':'application/json'};function emit(_0xb65901,_0x143438,_0x3de75f){io['to'](_0xb65901)['emit'](_0x143438,_0x3de75f);}function getTicket(_0x535360,_0x1eee6f,_0xbc29,_0x207c16,_0x5a1fa5){logger[_0x4726('0xd')](_0x4726('0xe'));var _0x101394=_[_0x4726('0xf')]({'responder_id':_0x1eee6f['id'],'requester_id':_0xbc29['id'],'name':util[_0x4726('0x10')](_0x4726('0x11'),_0x5a1fa5['calleridname']),'phone':_0x5a1fa5[_0x4726('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x207c16[_0x4726('0x13')],_0x5a1fa5,'\x20'),'description':intUtil[_0x4726('0x14')](_0x207c16[_0x4726('0x15')],_0x5a1fa5,'
'),'tags':getTags(_0x207c16[_0x4726('0x16')],_0x4726('0x17'))},getCustomFields(_0x207c16['Fields'],_0x5a1fa5));_0x101394[_0x4726('0x18')]=_['mapValues'](_[_0x4726('0x19')](_0x101394[_0x4726('0x18')],'id'),_0x4726('0x1a'));return request({'uri':util[_0x4726('0x10')]('%s/api/v2/tickets',_0x535360['remoteUri']),'method':_0x4726('0x1b'),'body':_0x101394})[_0x4726('0x1c')](function(_0xf9302a){logger[_0x4726('0xd')](_0x4726('0x1d'));return _0xf9302a;});}function getUser(_0x1ca670,_0x59bf4a){if(intUtil[_0x4726('0x1e')](_0x59bf4a)){return request({'uri':util['format'](_0x4726('0x1f'),_0x1ca670[_0x4726('0x20')]),'qs':{'email':_0x59bf4a}})[_0x4726('0x1c')](function(_0x4460e8){if(_0x4460e8[_0x4726('0x21')]){logger[_0x4726('0xd')](_0x4726('0x22'));return _[_0x4726('0x23')](_0x4460e8,function(_0x55dfcf){return _0x55dfcf[_0x4726('0x24')][_0x4726('0x25')]===_0x59bf4a;});}else{logger[_0x4726('0xd')](_0x4726('0x26'));return request({'uri':util['format'](_0x4726('0x27'),_0x1ca670[_0x4726('0x20')])})['then'](function(_0x393ab4){logger[_0x4726('0xd')](_0x4726('0x28'));return _0x393ab4;});}});}else{logger['info'](_0x4726('0x29'));return request({'uri':util[_0x4726('0x10')]('%s/api/v2/agents/me',_0x1ca670['remoteUri'])})[_0x4726('0x1c')](function(_0x3a9bbd){logger[_0x4726('0xd')](_0x4726('0x28'));return _0x3a9bbd;});}}function getEndUser(_0x10a10e,_0x4ca917,_0x2347fd){logger[_0x4726('0xd')](_0x4726('0x2a'),_0x2347fd);return request({'uri':util[_0x4726('0x10')]('%s/api/v2/contacts',_0x10a10e['remoteUri']),'qs':{'phone':_0x2347fd}})[_0x4726('0x1c')](function(_0x16949f){if(_0x16949f[_0x4726('0x21')]){logger['info'](_0x4726('0x2b'));return _[_0x4726('0x23')](_0x16949f,{'phone':_0x2347fd});}else{logger[_0x4726('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/api/v2/contacts',_0x10a10e[_0x4726('0x20')]),'method':'POST','body':{'name':_0x4ca917,'phone':_0x2347fd}})[_0x4726('0x1c')](function(_0x4e5bb4){logger[_0x4726('0xd')](_0x4726('0x2c'));return _0x4e5bb4;});}});}function getAuth(_0x451ccc){return util[_0x4726('0x10')](_0x4726('0x2d'),new Buffer(_0x451ccc[_0x4726('0x2e')]+':X')[_0x4726('0x2f')](_0x4726('0x30')));}function request(_0xd9d9b6){logger[_0x4726('0x31')](_0x4726('0x32'),JSON['stringify'](_0xd9d9b6));return rp(_[_0x4726('0x8')](_0xd9d9b6,{'method':_0x4726('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x5a0845,_0x558215){var _0x4e689a=[];if(_0x5a0845&&_0x5a0845[_0x4726('0x21')]>0x0){_0x4e689a=_[_0x4726('0x34')](_0x5a0845,_0x558215);}return _0x4e689a;}function getCustomFields(_0x4667bc,_0x6fb1db){var _0x386ba3=[];var _0x5397f9={'custom_fields':[]};if(_0x4667bc[_0x4726('0x21')]>0x0){_[_0x4726('0x35')](_0x4667bc,function(_0x5e3422){if(_['includes'](['string',_0x4726('0x36')],_0x5e3422[_0x4726('0x37')])&&_0x5e3422[_0x4726('0x38')]&&!_0x5e3422[_0x4726('0x39')]){_0x5397f9[_0x5e3422[_0x4726('0x38')]['toLowerCase']()]=_0x5e3422[_0x4726('0x3a')][_0x4726('0x2f')]();}else if(_[_0x4726('0x3b')]([_0x4726('0x3c'),_0x4726('0x36')],_0x5e3422['type'])&&_0x5e3422[_0x4726('0x3d')]&&_0x5e3422['customField']){_0x5397f9[_0x4726('0x18')][_0x4726('0x3e')]({'id':_0x5e3422[_0x4726('0x3d')],'value':_0x5e3422[_0x4726('0x3a')][_0x4726('0x2f')]()});}else if(_0x5e3422['type']===_0x4726('0x3f')&&_0x5e3422[_0x4726('0x40')]&&_0x5e3422[_0x4726('0x3d')]&&_0x5e3422[_0x4726('0x39')]){_0x6fb1db[_0x5e3422[_0x4726('0x40')]]&&_0x5397f9[_0x4726('0x18')][_0x4726('0x3e')]({'id':_0x5e3422[_0x4726('0x3d')],'value':_0x6fb1db[_0x5e3422[_0x4726('0x40')]][_0x4726('0x2f')]()});}else if(_0x5e3422[_0x4726('0x37')]==='customVariable'&&_0x5e3422[_0x4726('0x41')]&&_0x5e3422[_0x4726('0x41')][_0x4726('0x17')]&&_0x5e3422[_0x4726('0x3d')]&&_0x5e3422['customField']){_0x6fb1db[_0x5e3422[_0x4726('0x41')][_0x4726('0x17')][_0x4726('0x42')]()]&&_0x5397f9[_0x4726('0x18')][_0x4726('0x3e')]({'id':_0x5e3422[_0x4726('0x3d')],'value':_0x6fb1db[_0x5e3422[_0x4726('0x41')]['name'][_0x4726('0x42')]()]['toString']()});}});}return _0x5397f9;}exports[_0x4726('0x43')]=function(_0x1ca277,_0x2c5114,_0x34aee3,_0x31f1b8,_0x570bd7,_0x2ccadc){var _0x1aa10b,_0x334c65;_0x2ccadc[_0x4726('0x20')]=intUtil[_0x4726('0x44')](_0x2ccadc[_0x4726('0x20')]);_0x2ccadc['serverUrl']=intUtil[_0x4726('0x44')](_0x2ccadc[_0x4726('0x45')]);if(_0x570bd7&&_0x570bd7[_0x4726('0x46')]){logger['info']('[QUEUE]',_0x4726('0x47'));_0x2c5114[_0x4726('0x48')]=util[_0x4726('0x10')](_0x4726('0x49'),_0x2ccadc['serverUrl'],_0x2c5114[_0x4726('0x4a')],md5(_0x2c5114[_0x4726('0x4a')]));}else{_0x2c5114[_0x4726('0x48')]='';}headers['Authorization']=getAuth(_0x2ccadc);return getUser(_0x2ccadc,_0x31f1b8[_0x4726('0x25')])[_0x4726('0x1c')](function(_0x229243){_0x1aa10b=_0x229243;logger[_0x4726('0xd')]('The\x20User\x20ID\x20is:',_0x1aa10b['id']);return getEndUser(_0x2ccadc,_0x2c5114['calleridname'],_0x2c5114[_0x4726('0x12')]);})['then'](function(_0x13bd3c){_0x334c65=_0x13bd3c;logger[_0x4726('0xd')](_0x4726('0x4b'),_0x334c65['id']);return getTicket(_0x2ccadc,_0x1aa10b,_0x334c65,_0x34aee3,_0x2c5114);})[_0x4726('0x1c')](function(_0x32088b){if(_0x32088b&&_0x32088b['id']){logger[_0x4726('0xd')](_0x4726('0x1d'));logger[_0x4726('0xd')]('The\x20Ticket\x20ID\x20is:',_0x32088b['id']);logger[_0x4726('0xd')]('[QUEUE]',_0x4726('0x4c'));emit(util['format']('user:%s',_0x31f1b8['name']),_0x4726('0x4d'),{'uri':util[_0x4726('0x10')](_0x4726('0x4e'),_0x2ccadc[_0x4726('0x20')],_0x32088b['id'])});}})['catch'](function(_0x481edb){logger[_0x4726('0x4f')]('[QUEUE]',JSON[_0x4726('0x50')](_0x481edb));});};exports['outbound']=function(_0x3b0e04,_0x17dfa9,_0x2a23c0,_0x486204,_0x11f437,_0x2a6ce3,_0x77a2b1){var _0x1a2a4a,_0xd42995;_0x2a6ce3[_0x4726('0x20')]=intUtil[_0x4726('0x44')](_0x2a6ce3[_0x4726('0x20')]);_0x2a6ce3[_0x4726('0x45')]=intUtil['stripTrailingSlash'](_0x2a6ce3[_0x4726('0x45')]);if(_0x77a2b1&&_0x77a2b1[_0x4726('0x51')]&&_0x77a2b1[_0x4726('0x51')]!==_0x4726('0x52')){logger[_0x4726('0xd')]('[OUTBOUND]',_0x4726('0x47'));_0x17dfa9[_0x4726('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a6ce3[_0x4726('0x45')],_0x17dfa9[_0x4726('0x4a')],md5(_0x17dfa9[_0x4726('0x4a')]));}headers[_0x4726('0x53')]=getAuth(_0x2a6ce3);return getUser(_0x2a6ce3,_0x486204[_0x4726('0x25')])[_0x4726('0x1c')](function(_0x522b8b){_0x1a2a4a=_0x522b8b;logger[_0x4726('0xd')]('The\x20User\x20ID\x20is:',_0x1a2a4a['id']);return getEndUser(_0x2a6ce3,_0x17dfa9[_0x4726('0x54')],_0x17dfa9[_0x4726('0x55')]);})[_0x4726('0x1c')](function(_0x226edc){_0xd42995=_0x226edc;logger[_0x4726('0xd')](_0x4726('0x4b'),_0xd42995['id']);return getTicket(_0x2a6ce3,_0x1a2a4a,_0xd42995,_0x2a23c0,_0x17dfa9);})[_0x4726('0x1c')](function(_0x288073){if(_0x288073&&_0x288073['id']){logger[_0x4726('0xd')]('Ticket\x20created!');logger[_0x4726('0xd')](_0x4726('0x56'),_0x288073['id']);logger[_0x4726('0xd')](_0x4726('0x57'),_0x4726('0x4c'));emit(util[_0x4726('0x10')](_0x4726('0x58'),_0x486204[_0x4726('0x17')]),'trigger:browser:url',{'uri':util['format'](_0x4726('0x4e'),_0x2a6ce3[_0x4726('0x20')],_0x288073['id'])});}})['catch'](function(_0x2c4876){logger[_0x4726('0x4f')](_0x4726('0x57'),JSON[_0x4726('0x50')](_0x2c4876));});};exports[_0x4726('0x59')]=function(_0x369cca,_0x21e319,_0x175b92,_0x4df664,_0x46b1a9,_0x421ba6){var _0xe83e6,_0x453d6a;_0x421ba6[_0x4726('0x20')]=intUtil['stripTrailingSlash'](_0x421ba6[_0x4726('0x20')]);_0x421ba6[_0x4726('0x45')]=intUtil[_0x4726('0x44')](_0x421ba6['serverUrl']);if(_0x46b1a9&&_0x46b1a9[_0x4726('0x46')]){logger['info']('['+_0x21e319[_0x4726('0x5a')][_0x4726('0x5b')]()+']',_0x4726('0x47'));_0x21e319['recordingURL']=util[_0x4726('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x421ba6[_0x4726('0x45')],_0x21e319['uniqueid'],md5(_0x21e319[_0x4726('0x4a')]));}else{_0x21e319['recordingURL']='';}headers['Authorization']=getAuth(_0x421ba6);return getUser(_0x421ba6,'')[_0x4726('0x1c')](function(_0x245d48){_0xe83e6=_0x245d48;logger[_0x4726('0xd')](_0x4726('0x5c'),_0xe83e6['id']);return getEndUser(_0x421ba6,_0x21e319['calleridname'],_0x21e319[_0x4726('0x12')]);})[_0x4726('0x1c')](function(_0x40498e){_0x453d6a=_0x40498e;logger[_0x4726('0xd')](_0x4726('0x4b'),_0x453d6a['id']);return getTicket(_0x421ba6,_0xe83e6,_0x453d6a,_0x175b92,_0x21e319);})['then'](function(_0x113671){if(_0x113671){logger['info']('Ticket\x20created!');logger[_0x4726('0xd')](_0x4726('0x56'),_0x113671['id']);}})['catch'](function(_0x170493){logger[_0x4726('0x4f')]('['+_0x21e319[_0x4726('0x5a')][_0x4726('0x5b')]()+']',JSON[_0x4726('0x50')](_0x170493));});}; \ 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 00c74c1..6538454 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 _0xfafd=['Descriptions','Contact','add','format','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','username','toLowerCase','outbound','calleridnum','callDirection','queue','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','none','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','localhost','socket.io-emitter','redis','GET','/api/selector/owners','headers','info','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','message','Getting\x20user\x20list','agentEmail','userEmail','userId','User\x20found:','toUpperCase','/api/lookup?q=','&f=','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','POST','/api/tasks','getString'];(function(_0x53accb,_0x1b4eb6){var _0x5a9de8=function(_0xb10d8){while(--_0xb10d8){_0x53accb['push'](_0x53accb['shift']());}};_0x5a9de8(++_0x1b4eb6);}(_0xfafd,0x172));var _0xdfaf=function(_0x2f7612,_0x3e2402){_0x2f7612=_0x2f7612-0x0;var _0x193a44=_0xfafd[_0x2f7612];return _0x193a44;};'use strict';var _=require('lodash');var rp=require(_0xdfaf('0x0'));var md5=require(_0xdfaf('0x1'));var util=require(_0xdfaf('0x2'));var moment=require(_0xdfaf('0x3'));var Promise=require(_0xdfaf('0x4'));var Redis=require(_0xdfaf('0x5'));var intUtil=require(_0xdfaf('0x6'));var config=require(_0xdfaf('0x7'));var logger=require(_0xdfaf('0x8'))(_0xdfaf('0x9'));config['redis']=_['defaults'](config['redis'],{'host':_0xdfaf('0xa'),'port':0x18eb});var io=require(_0xdfaf('0xb'))(new Redis(config[_0xdfaf('0xc')]));function getAdminId(_0x23b036,_0x59fdba,_0x192788,_0x5bac6d){return new Promise(function(_0x4a8fa7,_0x7c6822){var _0x46c72e=![];var _0x2b1277={'method':_0xdfaf('0xd'),'uri':_0x5bac6d+_0xdfaf('0xe'),'json':!![]};_0x2b1277[_0xdfaf('0xf')]=_0x192788;logger[_0xdfaf('0x10')]('Getting\x20admin\x20information');return rp(_0x2b1277)[_0xdfaf('0x11')](function(_0xdf43f5){if(_0xdf43f5){var _0x49a50f=_0xdf43f5[_0xdfaf('0x12')];var _0x2bfce1=null;for(_0x2bfce1=0x0;_0x2bfce1<_0x49a50f[_0xdfaf('0x13')];_0x2bfce1++){if(_0x49a50f[_0x2bfce1]['email']===_0x23b036[_0xdfaf('0x14')]){_0x23b036[_0xdfaf('0x15')]=_0x49a50f[_0x2bfce1]['id'];_0x46c72e=!![];}}if(_0x46c72e){logger[_0xdfaf('0x10')](_0xdfaf('0x16'),_0x23b036[_0xdfaf('0x15')]);_0x4a8fa7(_0x23b036);}else{_0x7c6822({'statusCode':0x194,'message':_0xdfaf('0x17')});}}else{_0x7c6822({'statusCode':0x194,'message':_0xdfaf('0x17')});}})[_0xdfaf('0x18')](function(_0x38917f){logger['error']('['+[_0x59fdba['toUpperCase']()]+']',_0x38917f[_0xdfaf('0x19')]);_0x7c6822(_0x38917f);});});}function getUser(_0x428b82,_0x106a07,_0x43b010){return function(_0x157567){return new Promise(function(_0xde1960,_0x4e34a1){var _0x528132={'method':_0xdfaf('0xd'),'uri':_0x43b010+_0xdfaf('0xe'),'json':!![]};_0x528132[_0xdfaf('0xf')]=_0x106a07;logger[_0xdfaf('0x10')](_0xdfaf('0x1a'));return rp(_0x528132)[_0xdfaf('0x11')](function(_0x162f6e){if(_0x162f6e){var _0x193b42=_0x162f6e[_0xdfaf('0x12')];var _0x167285=![];var _0x37ee6d=null;if(_0x157567[_0xdfaf('0x1b')]!==null){logger[_0xdfaf('0x10')]('Getting\x20user\x20with\x20email',_0x157567[_0xdfaf('0x1b')]);_0x157567[_0xdfaf('0x1c')]=_0x157567[_0xdfaf('0x1b')];for(_0x37ee6d=0x0;_0x37ee6d<_0x193b42[_0xdfaf('0x13')];_0x37ee6d++){if(_0x193b42[_0x37ee6d]['email']===_0x157567[_0xdfaf('0x1b')]){_0x167285=!![];_0x157567[_0xdfaf('0x1d')]=_0x193b42[_0x37ee6d]['id'];logger[_0xdfaf('0x10')](_0xdfaf('0x1e'),_0x157567['userId']);}}}if(!_0x167285){logger['info']('Admin\x20selected');_0x157567[_0xdfaf('0x1c')]=_0x157567[_0xdfaf('0x14')];_0x157567[_0xdfaf('0x1d')]=_0x157567[_0xdfaf('0x15')];_0x167285=!![];}if(_0x167285){_0xde1960(_0x157567);}else{_0x4e34a1({'statusCode':0x194,'message':_0xdfaf('0x17')});}}else{_0x4e34a1({'statusCode':0x194,'message':_0xdfaf('0x17')});}})[_0xdfaf('0x18')](function(_0x591f8d){logger['error']('['+[_0x428b82[_0xdfaf('0x1f')]()]+']',_0x591f8d[_0xdfaf('0x19')]);_0x4e34a1(_0x591f8d);});});};}function searchContact(_0x15729a,_0xe8c6cd,_0x3f48b8,_0x4649b8){return new Promise(function(_0x365627,_0x471bd4){var _0x3f8315={'method':_0xdfaf('0xd'),'headers':_0xe8c6cd,'uri':_0x15729a+_0xdfaf('0x20')+_0x4649b8+_0xdfaf('0x21')+_0x3f48b8+'&entities=contact','json':!![]};rp(_0x3f8315)[_0xdfaf('0x11')](function(_0x28b451){var _0x519c90=_[_0xdfaf('0x22')](_0x28b451[_0xdfaf('0x23')][_0xdfaf('0x23')],[_0x3f48b8,_0x4649b8]);_0x365627(_0x519c90);})[_0xdfaf('0x18')](function(_0x18270e){_0x471bd4(_0x18270e);});});}function getEndUser(_0x150165,_0x6d4106,_0x536d1e){return function(_0x1207cb){return new Promise(function(_0x3778da,_0x2ab953){logger[_0xdfaf('0x10')](util['format'](_0xdfaf('0x24'),_0x1207cb['contactNumber']));searchContact(_0x536d1e,_0x6d4106,_0xdfaf('0x25'),_0x1207cb[_0xdfaf('0x26')])[_0xdfaf('0x11')](function(_0x31e804){if(_0x31e804){_0x1207cb[_0xdfaf('0x27')]=_0x31e804['id'];logger[_0xdfaf('0x10')](_0xdfaf('0x28'),_0x1207cb[_0xdfaf('0x27')]);return _0x3778da(_0x1207cb);}searchContact(_0x536d1e,_0x6d4106,_0xdfaf('0x29'),_0x1207cb['contactNumber'])[_0xdfaf('0x11')](function(_0x5dcc92){if(_0x5dcc92){_0x1207cb[_0xdfaf('0x27')]=_0x5dcc92['id'];logger[_0xdfaf('0x10')](_0xdfaf('0x2a'),_0x1207cb[_0xdfaf('0x27')]);return _0x3778da(_0x1207cb);}createEndUser(_0x1207cb,_0x150165,_0x6d4106,_0x536d1e)[_0xdfaf('0x11')](function(_0x474464){logger['info']('Contact\x20created:',_0x474464['endUserId']);return _0x3778da(_0x474464);});});})['catch'](function(_0x12af8a){_0x2ab953(_0x12af8a);});});};}function createEndUser(_0x3dbba6,_0x484287,_0x18e1f0,_0x4ead75){return new Promise(function(_0x113e40,_0x486cba){var _0x3a6080=moment();var _0x737cbd={'method':'POST','uri':_0x4ead75+_0xdfaf('0x2b'),'body':{'contact':{'last_name':_0x3dbba6[_0xdfaf('0x26')],'work_number':_0x3dbba6[_0xdfaf('0x26')],'mobile_number':_0x3dbba6[_0xdfaf('0x26')],'owner_id':_0x3dbba6['userId'],'created_at':_0x3a6080['format'](_0xdfaf('0x2c'))}},'json':!![]};_0x737cbd['headers']=_0x18e1f0;logger[_0xdfaf('0x10')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x737cbd)[_0xdfaf('0x11')](function(_0x4cfe6d){_0x3dbba6[_0xdfaf('0x27')]=_0x4cfe6d[_0xdfaf('0x2d')]['id'];_0x113e40(_0x3dbba6);})[_0xdfaf('0x18')](function(_0xa7739b){logger['error']('['+[_0x484287[_0xdfaf('0x1f')]()]+']',_0xa7739b[_0xdfaf('0x19')]);_0x486cba(_0xa7739b[_0xdfaf('0x19')]);});});}function getTicket(_0x1e7710,_0x541cc7,_0xbcf1b3,_0x23ddd0,_0x1723a6){return function(_0x425eef){logger[_0xdfaf('0x10')](_0xdfaf('0x2e'));return new Promise(function(_0x3175ff,_0x32959a){var _0x24ab2d=moment();var _0x102d40={'method':_0xdfaf('0x2f'),'uri':_0xbcf1b3+_0xdfaf('0x30'),'body':{'title':intUtil[_0xdfaf('0x31')](_0x23ddd0['Subjects'],_0x1723a6,'\x20'),'description':intUtil[_0xdfaf('0x31')](_0x23ddd0[_0xdfaf('0x32')],_0x1723a6,'\x0a'),'owner_id':_0x425eef['userId'],'creater_id':_0x425eef[_0xdfaf('0x15')],'targetable_id':_0x425eef[_0xdfaf('0x27')],'targetable_type':_0xdfaf('0x33'),'created_at':_0x24ab2d['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x24ab2d[_0xdfaf('0x34')](0x1e,'m')[_0xdfaf('0x35')](_0xdfaf('0x2c'))},'json':!![]};_0x102d40[_0xdfaf('0xf')]=_0x541cc7;return rp(_0x102d40)['then'](function(_0x11416e){_0x425eef[_0xdfaf('0x36')]=_0x11416e[_0xdfaf('0x37')]['id'];logger[_0xdfaf('0x10')]('Task\x20created:',_0x425eef[_0xdfaf('0x36')]);_0x3175ff(_0x425eef);})['catch'](function(_0x5c7925){logger['error']('['+[_0x1e7710[_0xdfaf('0x1f')]()]+']',_0x5c7925[_0xdfaf('0x19')]);_0x32959a(_0x5c7925[_0xdfaf('0x19')]);});});};}function emit(_0xc5b751,_0x55aeea,_0x5e49fe){var _0x1ba806={'uri':_0xc5b751+_0xdfaf('0x38')+_0x5e49fe};io['to'](util[_0xdfaf('0x35')](_0xdfaf('0x39'),_0x55aeea))[_0xdfaf('0x3a')](_0xdfaf('0x3b'),_0x1ba806);}exports['cs']=function(_0x544bfc,_0xd6f13c,_0x520869,_0x5e818b,_0x24f17f,_0x49b4c9,_0x13a568,_0x183c01){var _0x4aed05={};var _0x2c9c0f={'Authorization':_0xdfaf('0x3c')+_0x49b4c9['apiKey']};_0x49b4c9[_0xdfaf('0x3d')]=intUtil[_0xdfaf('0x3e')](_0x49b4c9[_0xdfaf('0x3d')]);_0x49b4c9['serverUrl']=intUtil['stripTrailingSlash'](_0x49b4c9['serverUrl']);var _0x2ac409=_0x49b4c9[_0xdfaf('0x3d')];_0x4aed05[_0xdfaf('0x14')]=_0x49b4c9[_0xdfaf('0x3f')];_0x4aed05[_0xdfaf('0x26')]=_0x183c01[_0xdfaf('0x40')]()===_0xdfaf('0x41')?_0xd6f13c['destcalleridnum']:_0xd6f13c[_0xdfaf('0x42')];_0x4aed05[_0xdfaf('0x43')]=_0x183c01===_0xdfaf('0x44')||_0x183c01==='unmanaged'?_0xdfaf('0x44'):_0xdfaf('0x41');if(_0x5e818b){_0x4aed05[_0xdfaf('0x1b')]=_0x5e818b[_0xdfaf('0x45')];}var _0x1be388=util[_0xdfaf('0x35')](_0xdfaf('0x46'),_0x49b4c9[_0xdfaf('0x47')],_0xd6f13c['uniqueid'],md5(_0xd6f13c[_0xdfaf('0x48')]));if(_0x24f17f&&_0x24f17f[_0xdfaf('0x49')]){logger[_0xdfaf('0x10')](_0xdfaf('0x4a'),_0xdfaf('0x4b'));_0xd6f13c['recordingURL']=_0x1be388;}else if(_0x13a568&&_0x13a568['recordingFormat']&&_0x13a568['recordingFormat']!==_0xdfaf('0x4c')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0xd6f13c['recordingURL']=_0x1be388;}else{_0xd6f13c['recordingURL']='';}return getAdminId(_0x4aed05,_0x183c01,_0x2c9c0f,_0x2ac409)['then'](getUser(_0x183c01,_0x2c9c0f,_0x2ac409))[_0xdfaf('0x11')](getEndUser(_0x183c01,_0x2c9c0f,_0x2ac409))['then'](getTicket(_0x183c01,_0x2c9c0f,_0x2ac409,_0x520869,_0xd6f13c))[_0xdfaf('0x11')](function(_0x21b972){logger[_0xdfaf('0x10')](util[_0xdfaf('0x35')](_0xdfaf('0x4d'),_0x21b972['ticketId']));if(_0x183c01!==_0xdfaf('0x4e')){logger[_0xdfaf('0x10')]('['+[_0x183c01['toUpperCase']()]+']',_0xdfaf('0x4f'));emit(_0x2ac409,_0x5e818b[_0xdfaf('0x50')],_0x21b972[_0xdfaf('0x27')]);}})[_0xdfaf('0x18')](function(_0x509437){logger[_0xdfaf('0x51')]('['+[_0x183c01[_0xdfaf('0x1f')]()]+_0xdfaf('0x52'),util[_0xdfaf('0x53')](_0x509437,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1344=['md5','util','moment','bluebird','ioredis','./util','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','then','users','length','email','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','User\x20found:','userId','Admin\x20selected','userEmail','adminEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash'];(function(_0x5f2a50,_0x4700e0){var _0x7577ca=function(_0x45f47e){while(--_0x45f47e){_0x5f2a50['push'](_0x5f2a50['shift']());}};_0x7577ca(++_0x4700e0);}(_0x1344,0x1ad));var _0x4134=function(_0x56ba58,_0x1697c4){_0x56ba58=_0x56ba58-0x0;var _0x337772=_0x1344[_0x56ba58];return _0x337772;};'use strict';var _=require(_0x4134('0x0'));var rp=require('request-promise');var md5=require(_0x4134('0x1'));var util=require(_0x4134('0x2'));var moment=require(_0x4134('0x3'));var Promise=require(_0x4134('0x4'));var Redis=require(_0x4134('0x5'));var intUtil=require(_0x4134('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4134('0x7'));config[_0x4134('0x8')]=_[_0x4134('0x9')](config[_0x4134('0x8')],{'host':_0x4134('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4134('0x8')]));function getAdminId(_0x1b273f,_0xc2ab20,_0x486bba,_0x2b39db){return new Promise(function(_0x1c3676,_0x31d8a5){var _0x25eb80=![];var _0x2d7142={'method':_0x4134('0xb'),'uri':_0x2b39db+_0x4134('0xc'),'json':!![]};_0x2d7142[_0x4134('0xd')]=_0x486bba;logger['info']('Getting\x20admin\x20information');return rp(_0x2d7142)[_0x4134('0xe')](function(_0x478c73){if(_0x478c73){var _0x615dbf=_0x478c73[_0x4134('0xf')];var _0xd9c456=null;for(_0xd9c456=0x0;_0xd9c456<_0x615dbf[_0x4134('0x10')];_0xd9c456++){if(_0x615dbf[_0xd9c456][_0x4134('0x11')]===_0x1b273f['adminEmail']){_0x1b273f[_0x4134('0x12')]=_0x615dbf[_0xd9c456]['id'];_0x25eb80=!![];}}if(_0x25eb80){logger[_0x4134('0x13')](_0x4134('0x14'),_0x1b273f[_0x4134('0x12')]);_0x1c3676(_0x1b273f);}else{_0x31d8a5({'statusCode':0x194,'message':_0x4134('0x15')});}}else{_0x31d8a5({'statusCode':0x194,'message':_0x4134('0x15')});}})[_0x4134('0x16')](function(_0x120561){logger[_0x4134('0x17')]('['+[_0xc2ab20[_0x4134('0x18')]()]+']',_0x120561[_0x4134('0x19')]);_0x31d8a5(_0x120561);});});}function getUser(_0x5efa96,_0x10d65f,_0x996ad5){return function(_0x392059){return new Promise(function(_0x20936,_0x4232f4){var _0x2a41e6={'method':_0x4134('0xb'),'uri':_0x996ad5+_0x4134('0xc'),'json':!![]};_0x2a41e6['headers']=_0x10d65f;logger['info'](_0x4134('0x1a'));return rp(_0x2a41e6)[_0x4134('0xe')](function(_0x5d3c94){if(_0x5d3c94){var _0x4667d7=_0x5d3c94[_0x4134('0xf')];var _0x7504f4=![];var _0x504e5e=null;if(_0x392059['agentEmail']!==null){logger[_0x4134('0x13')](_0x4134('0x1b'),_0x392059[_0x4134('0x1c')]);_0x392059['userEmail']=_0x392059[_0x4134('0x1c')];for(_0x504e5e=0x0;_0x504e5e<_0x4667d7['length'];_0x504e5e++){if(_0x4667d7[_0x504e5e]['email']===_0x392059[_0x4134('0x1c')]){_0x7504f4=!![];_0x392059['userId']=_0x4667d7[_0x504e5e]['id'];logger[_0x4134('0x13')](_0x4134('0x1d'),_0x392059[_0x4134('0x1e')]);}}}if(!_0x7504f4){logger[_0x4134('0x13')](_0x4134('0x1f'));_0x392059[_0x4134('0x20')]=_0x392059[_0x4134('0x21')];_0x392059[_0x4134('0x1e')]=_0x392059['adminId'];_0x7504f4=!![];}if(_0x7504f4){_0x20936(_0x392059);}else{_0x4232f4({'statusCode':0x194,'message':_0x4134('0x15')});}}else{_0x4232f4({'statusCode':0x194,'message':_0x4134('0x15')});}})[_0x4134('0x16')](function(_0x106978){logger['error']('['+[_0x5efa96['toUpperCase']()]+']',_0x106978['message']);_0x4232f4(_0x106978);});});};}function searchContact(_0x3be4cd,_0x2e9e4b,_0x28df31,_0x3dfbc4){return new Promise(function(_0x3add4c,_0x50f1b9){var _0x312441={'method':'GET','headers':_0x2e9e4b,'uri':_0x3be4cd+_0x4134('0x22')+_0x3dfbc4+_0x4134('0x23')+_0x28df31+_0x4134('0x24'),'json':!![]};rp(_0x312441)[_0x4134('0xe')](function(_0x554047){var _0x22975e=_[_0x4134('0x25')](_0x554047[_0x4134('0x26')][_0x4134('0x26')],[_0x28df31,_0x3dfbc4]);_0x3add4c(_0x22975e);})[_0x4134('0x16')](function(_0x30e034){_0x50f1b9(_0x30e034);});});}function getEndUser(_0x29d306,_0x171ed8,_0x15653b){return function(_0xccb356){return new Promise(function(_0xfb0fae,_0x5b201f){logger[_0x4134('0x13')](util[_0x4134('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0xccb356[_0x4134('0x28')]));searchContact(_0x15653b,_0x171ed8,_0x4134('0x29'),_0xccb356[_0x4134('0x28')])[_0x4134('0xe')](function(_0x5b4aa7){if(_0x5b4aa7){_0xccb356[_0x4134('0x2a')]=_0x5b4aa7['id'];logger[_0x4134('0x13')](_0x4134('0x2b'),_0xccb356['endUserId']);return _0xfb0fae(_0xccb356);}searchContact(_0x15653b,_0x171ed8,_0x4134('0x2c'),_0xccb356[_0x4134('0x28')])['then'](function(_0x12676b){if(_0x12676b){_0xccb356['endUserId']=_0x12676b['id'];logger['info']('Contact\x20found\x20work_number:',_0xccb356['endUserId']);return _0xfb0fae(_0xccb356);}createEndUser(_0xccb356,_0x29d306,_0x171ed8,_0x15653b)[_0x4134('0xe')](function(_0x3778ac){logger[_0x4134('0x13')]('Contact\x20created:',_0x3778ac[_0x4134('0x2a')]);return _0xfb0fae(_0x3778ac);});});})[_0x4134('0x16')](function(_0x9420e1){_0x5b201f(_0x9420e1);});});};}function createEndUser(_0x41bd94,_0x194813,_0x28d013,_0x19a957){return new Promise(function(_0x42331e,_0x343476){var _0x3f6d6c=moment();var _0x5c77ff={'method':_0x4134('0x2d'),'uri':_0x19a957+_0x4134('0x2e'),'body':{'contact':{'last_name':_0x41bd94[_0x4134('0x28')],'work_number':_0x41bd94[_0x4134('0x28')],'mobile_number':_0x41bd94['contactNumber'],'owner_id':_0x41bd94[_0x4134('0x1e')],'created_at':_0x3f6d6c[_0x4134('0x27')](_0x4134('0x2f'))}},'json':!![]};_0x5c77ff['headers']=_0x28d013;logger['info'](_0x4134('0x30'));return rp(_0x5c77ff)[_0x4134('0xe')](function(_0x33a8b6){_0x41bd94[_0x4134('0x2a')]=_0x33a8b6[_0x4134('0x31')]['id'];_0x42331e(_0x41bd94);})[_0x4134('0x16')](function(_0x4c1def){logger[_0x4134('0x17')]('['+[_0x194813[_0x4134('0x18')]()]+']',_0x4c1def[_0x4134('0x19')]);_0x343476(_0x4c1def[_0x4134('0x19')]);});});}function getTicket(_0x4be558,_0x36a36b,_0x17c7a0,_0x3a5ebc,_0xe51d2){return function(_0x252f02){logger[_0x4134('0x13')]('Creating\x20new\x20task');return new Promise(function(_0x3958e9,_0x1529fb){var _0x2caea9=moment();var _0x458d8d={'method':_0x4134('0x2d'),'uri':_0x17c7a0+_0x4134('0x32'),'body':{'title':intUtil[_0x4134('0x33')](_0x3a5ebc[_0x4134('0x34')],_0xe51d2,'\x20'),'description':intUtil['getString'](_0x3a5ebc[_0x4134('0x35')],_0xe51d2,'\x0a'),'owner_id':_0x252f02[_0x4134('0x1e')],'creater_id':_0x252f02['adminId'],'targetable_id':_0x252f02[_0x4134('0x2a')],'targetable_type':_0x4134('0x36'),'created_at':_0x2caea9[_0x4134('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x2caea9[_0x4134('0x37')](0x1e,'m')['format'](_0x4134('0x2f'))},'json':!![]};_0x458d8d[_0x4134('0xd')]=_0x36a36b;return rp(_0x458d8d)[_0x4134('0xe')](function(_0x2d1cb0){_0x252f02[_0x4134('0x38')]=_0x2d1cb0[_0x4134('0x39')]['id'];logger[_0x4134('0x13')](_0x4134('0x3a'),_0x252f02[_0x4134('0x38')]);_0x3958e9(_0x252f02);})[_0x4134('0x16')](function(_0x393e33){logger[_0x4134('0x17')]('['+[_0x4be558[_0x4134('0x18')]()]+']',_0x393e33[_0x4134('0x19')]);_0x1529fb(_0x393e33[_0x4134('0x19')]);});});};}function emit(_0x332073,_0x5dd97f,_0x48b3c5){var _0x2eb27b={'uri':_0x332073+_0x4134('0x3b')+_0x48b3c5};io['to'](util[_0x4134('0x27')](_0x4134('0x3c'),_0x5dd97f))[_0x4134('0x3d')](_0x4134('0x3e'),_0x2eb27b);}exports['cs']=function(_0x438cfb,_0x1a770f,_0x5aecb0,_0x23d268,_0x413ba6,_0x4a5f8a,_0x17938c,_0x20e823){var _0x18ccd7={};var _0x563dbe={'Authorization':_0x4134('0x3f')+_0x4a5f8a[_0x4134('0x40')]};_0x4a5f8a[_0x4134('0x41')]=intUtil[_0x4134('0x42')](_0x4a5f8a[_0x4134('0x41')]);_0x4a5f8a[_0x4134('0x43')]=intUtil[_0x4134('0x42')](_0x4a5f8a[_0x4134('0x43')]);var _0x42feb4=_0x4a5f8a[_0x4134('0x41')];_0x18ccd7[_0x4134('0x21')]=_0x4a5f8a[_0x4134('0x44')];_0x18ccd7[_0x4134('0x28')]=_0x20e823['toLowerCase']()===_0x4134('0x45')?_0x1a770f[_0x4134('0x46')]:_0x1a770f[_0x4134('0x47')];_0x18ccd7['callDirection']=_0x20e823===_0x4134('0x48')||_0x20e823===_0x4134('0x49')?_0x4134('0x48'):_0x4134('0x45');if(_0x23d268){_0x18ccd7[_0x4134('0x1c')]=_0x23d268['email'];}var _0x4ae2ba=util[_0x4134('0x27')](_0x4134('0x4a'),_0x4a5f8a['serverUrl'],_0x1a770f['uniqueid'],md5(_0x1a770f[_0x4134('0x4b')]));if(_0x413ba6&&_0x413ba6[_0x4134('0x4c')]){logger[_0x4134('0x13')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1a770f[_0x4134('0x4d')]=_0x4ae2ba;}else if(_0x17938c&&_0x17938c[_0x4134('0x4e')]&&_0x17938c['recordingFormat']!==_0x4134('0x4f')){logger['info'](_0x4134('0x50'),_0x4134('0x51'));_0x1a770f['recordingURL']=_0x4ae2ba;}else{_0x1a770f[_0x4134('0x4d')]='';}return getAdminId(_0x18ccd7,_0x20e823,_0x563dbe,_0x42feb4)[_0x4134('0xe')](getUser(_0x20e823,_0x563dbe,_0x42feb4))[_0x4134('0xe')](getEndUser(_0x20e823,_0x563dbe,_0x42feb4))[_0x4134('0xe')](getTicket(_0x20e823,_0x563dbe,_0x42feb4,_0x5aecb0,_0x1a770f))[_0x4134('0xe')](function(_0x1f5295){logger[_0x4134('0x13')](util[_0x4134('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1f5295[_0x4134('0x38')]));if(_0x20e823!==_0x4134('0x49')){logger[_0x4134('0x13')]('['+[_0x20e823[_0x4134('0x18')]()]+']',_0x4134('0x52'));emit(_0x42feb4,_0x23d268[_0x4134('0x53')],_0x1f5295[_0x4134('0x2a')]);}})['catch'](function(_0x515144){logger[_0x4134('0x17')]('['+[_0x20e823[_0x4134('0x18')]()]+_0x4134('0x54'),util[_0x4134('0x55')](_0x515144,{'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 b5b4e7b..689ed6e 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 _0x4c82=['log','unmanaged','freshdesk','desk','freshsales','error','format','%s\x20configuration\x20#%s\x20not\x20found','data3','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','zoho','vtiger','dynamics365','servicenow','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound'];(function(_0x2a32a1,_0x252aed){var _0x32813f=function(_0x52cf27){while(--_0x52cf27){_0x2a32a1['push'](_0x2a32a1['shift']());}};_0x32813f(++_0x252aed);}(_0x4c82,0xb5));var _0x24c8=function(_0xc0754,_0x37f107){_0xc0754=_0xc0754-0x0;var _0x195498=_0x4c82[_0xc0754];return _0x195498;};'use strict';var _=require(_0x24c8('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x24c8('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x24c8('0x2'));var zoho=require('./zoho');var desk=require(_0x24c8('0x3'));var vtiger=require(_0x24c8('0x4'));var servicenow=require(_0x24c8('0x5'));var dynamics365=require('./dynamics365');var freshsales=require(_0x24c8('0x6'));var integrations=[_0x24c8('0x7'),_0x24c8('0x8'),_0x24c8('0x9'),'freshdesk',_0x24c8('0xa'),'desk',_0x24c8('0xb'),_0x24c8('0xc'),'freshsales',_0x24c8('0xd')];exports['exec']=function(_0x5e6afe,_0x1c49fa,_0x58cdfd,_0x2b2526,_0x6ce0a2,_0x4193ac){if(_0x58cdfd){if(_[_0x24c8('0xe')](integrations,_0x5e6afe[_0x24c8('0xf')][_0x24c8('0x10')]())){try{var _0x3cef2a=null;var _0xb60b0f='';var _0x286da6=_0x58cdfd[_0x5e6afe['data1'][_0x24c8('0x10')]()];if(_0x286da6){var _0x49d0f6=_0x286da6[_0x5e6afe[_0x24c8('0x11')]];if(_0x49d0f6){var _0x2a8e23=_[_0x24c8('0x12')](_0x49d0f6[_0x24c8('0x13')],{'id':parseInt(_0x5e6afe['data3'],0xa)});if(_0x2a8e23){if(_0x2b2526){if(_0x6ce0a2&&_0x1c49fa[_0x24c8('0x14')]){_0xb60b0f='queue';}else if(_0x1c49fa[_0x24c8('0x15')]){_0xb60b0f=_0x24c8('0x16');}else{console[_0x24c8('0x17')]('EVENT\x20UNKNOWN',_0x1c49fa);}}else{_0xb60b0f=_0x24c8('0x18');}switch(_0x5e6afe[_0x24c8('0xf')][_0x24c8('0x10')]()){case _0x24c8('0x7'):zendesk[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case'salesforce':salesforce[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case'sugarcrm':sugarcrm[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case _0x24c8('0x19'):freshdesk[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case'zoho':zoho[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case _0x24c8('0x1a'):desk[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case'vtiger':vtiger[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case _0x24c8('0x1b'):freshsales['cs'](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac,_0xb60b0f);break;case _0x24c8('0xd'):servicenow['cs'](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac,_0xb60b0f);break;case _0x24c8('0xc'):dynamics365['cs'](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac,_0xb60b0f);break;default:console[_0x24c8('0x17')]('unknown\x20integration');}}else{_0x3cef2a=require('../../../../config/logger')(_0x5e6afe['data1'][_0x24c8('0x10')]());_0x3cef2a[_0x24c8('0x1c')]('[EXEC]',util[_0x24c8('0x1d')](_0x24c8('0x1e'),_0x5e6afe[_0x24c8('0xf')][_0x24c8('0x10')](),_0x5e6afe[_0x24c8('0x1f')]));}}else{_0x3cef2a=require('../../../../config/logger')(_0x5e6afe[_0x24c8('0xf')]['toLowerCase']());_0x3cef2a[_0x24c8('0x1c')](_0x24c8('0x20'),util[_0x24c8('0x1d')](_0x24c8('0x21'),_0x5e6afe[_0x24c8('0xf')][_0x24c8('0x10')](),_0x5e6afe['data2']));}}else{}}catch(_0x3d48df){console[_0x24c8('0x1c')](_0x3d48df);}}}}; \ No newline at end of file +var _0xa801=['salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','toLowerCase','data1','find','Configurations','data3','routeId','outbound','log','desk','error','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','format','%s\x20account\x20#%s\x20not\x20found','data2','util','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xa801,0x1c5));var _0x1a80=function(_0x31c12c,_0x449d7a){_0x31c12c=_0x31c12c-0x0;var _0x3c0791=_0xa801[_0x31c12c];return _0x3c0791;};'use strict';var _=require('lodash');var util=require(_0x1a80('0x0'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x1a80('0x1'));var freshdesk=require(_0x1a80('0x2'));var zoho=require(_0x1a80('0x3'));var desk=require(_0x1a80('0x4'));var vtiger=require(_0x1a80('0x5'));var servicenow=require(_0x1a80('0x6'));var dynamics365=require(_0x1a80('0x7'));var freshsales=require('./freshsales');var integrations=[_0x1a80('0x8'),_0x1a80('0x9'),_0x1a80('0xa'),_0x1a80('0xb'),_0x1a80('0xc'),'desk',_0x1a80('0xd'),_0x1a80('0xe'),_0x1a80('0xf'),_0x1a80('0x10')];exports[_0x1a80('0x11')]=function(_0x34658b,_0x37ce9a,_0x5c036e,_0x200fb6,_0x3d8d66,_0x504352){if(_0x5c036e){if(_['includes'](integrations,_0x34658b['data1'][_0x1a80('0x12')]())){try{var _0x1911f4=null;var _0x5b3029='';var _0x5cf4c2=_0x5c036e[_0x34658b[_0x1a80('0x13')][_0x1a80('0x12')]()];if(_0x5cf4c2){var _0x38b99b=_0x5cf4c2[_0x34658b['data2']];if(_0x38b99b){var _0x35580c=_[_0x1a80('0x14')](_0x38b99b[_0x1a80('0x15')],{'id':parseInt(_0x34658b[_0x1a80('0x16')],0xa)});if(_0x35580c){if(_0x200fb6){if(_0x3d8d66&&_0x37ce9a['queue']){_0x5b3029='queue';}else if(_0x37ce9a[_0x1a80('0x17')]){_0x5b3029=_0x1a80('0x18');}else{console[_0x1a80('0x19')]('EVENT\x20UNKNOWN',_0x37ce9a);}}else{_0x5b3029='unmanaged';}switch(_0x34658b[_0x1a80('0x13')]['toLowerCase']()){case'zendesk':zendesk[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0x9'):salesforce[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0xa'):sugarcrm[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0xb'):freshdesk[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0xc'):zoho[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0x1a'):desk[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0xd'):vtiger[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0xf'):freshsales['cs'](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352,_0x5b3029);break;case'servicenow':servicenow['cs'](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352,_0x5b3029);break;case _0x1a80('0xe'):dynamics365['cs'](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352,_0x5b3029);break;default:console[_0x1a80('0x19')]('unknown\x20integration');}}else{_0x1911f4=require('../../../../config/logger')(_0x34658b['data1'][_0x1a80('0x12')]());_0x1911f4[_0x1a80('0x1b')]('[EXEC]',util['format'](_0x1a80('0x1c'),_0x34658b[_0x1a80('0x13')][_0x1a80('0x12')](),_0x34658b[_0x1a80('0x16')]));}}else{_0x1911f4=require(_0x1a80('0x1d'))(_0x34658b[_0x1a80('0x13')]['toLowerCase']());_0x1911f4[_0x1a80('0x1b')]('[EXEC]',util[_0x1a80('0x1e')](_0x1a80('0x1f'),_0x34658b['data1'][_0x1a80('0x12')](),_0x34658b[_0x1a80('0x20')]));}}else{}}catch(_0x1cdfe8){console[_0x1a80('0x1b')](_0x1cdfe8);}}}}; \ 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 3df2d38..fe2f366 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 _0xd20c=['Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','length','find','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','forEach','picklist','content','variable','variableName','idField','toString','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','error','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','calleridnum','lastevent','toUpperCase','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType'];(function(_0x52412a,_0x5d74b1){var _0x1e1b2c=function(_0x381088){while(--_0x381088){_0x52412a['push'](_0x52412a['shift']());}};_0x1e1b2c(++_0x5d74b1);}(_0xd20c,0x1f1));var _0xcd20=function(_0x2acd00,_0x23ac88){_0x2acd00=_0x2acd00-0x0;var _0x403870=_0xd20c[_0x2acd00];return _0x403870;};'use strict';var _=require(_0xcd20('0x0'));var rp=require(_0xcd20('0x1'));var moment=require(_0xcd20('0x2'));var BPromise=require(_0xcd20('0x3'));var md5=require(_0xcd20('0x4'));var jsforce=require(_0xcd20('0x5'));var util=require(_0xcd20('0x6'));var Redis=require(_0xcd20('0x7'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xcd20('0x8'))(_0xcd20('0x9'));config['redis']=_[_0xcd20('0xa')](config[_0xcd20('0xb')],{'host':_0xcd20('0xc'),'port':0x18eb});var io=require(_0xcd20('0xd'))(new Redis(config['redis']));function emit(_0x2385e2,_0x52c8e2,_0x3f7c02){io['to'](_0x2385e2)[_0xcd20('0xe')](_0x52c8e2,_0x3f7c02);}function getTicket(_0x40de39,_0x156575,_0x129206,_0x41f6da,_0x1fdb7d,_0x2c132a,_0x4b733b,_0x2b34f1){var _0x13766e=Object[_0xcd20('0xf')]({},{'OwnerId':_0x156575['id'],'Subject':intUtil[_0xcd20('0x10')](_0x41f6da[_0xcd20('0x11')],_0x1fdb7d,'\x20'),'Description':intUtil[_0xcd20('0x10')](_0x41f6da['Descriptions'],_0x1fdb7d,'\x0a')},getCustomFields(_0x2c132a,_0x1fdb7d));if(_0x129206){if(_0x41f6da[_0xcd20('0x12')]===_0xcd20('0x13')){_0x13766e[_0xcd20('0x14')]=moment[_0xcd20('0x15')]();_0x13766e[_0xcd20('0x16')]=![];_0x13766e[_0xcd20('0x17')]=![];if(_0x129206[_0xcd20('0x18')]===_0xcd20('0x19')||_0x129206[_0xcd20('0x18')]===_0xcd20('0x1a')){_0x13766e[_0xcd20('0x1b')]=_0x129206['id'];}else if(_0x129206[_0xcd20('0x18')]===_0xcd20('0x1c')){_0x13766e[_0xcd20('0x1d')]=_0x129206['id'];}}else if(_0x41f6da[_0xcd20('0x12')]==='Case'){if(_0x129206['endUserType']===_0xcd20('0x19')){_0x13766e[_0xcd20('0x1e')]=_0x129206['id'];}else if(_0x129206[_0xcd20('0x18')]==='account'){_0x13766e['AccountId']=_0x129206['id'];}else if(_0x129206['endUserType']==='lead'&&_0x41f6da[_0xcd20('0x1f')]){_0x13766e[_0x41f6da['leadId']]=_0x129206['id'];}else{logger[_0xcd20('0x20')](_0xcd20('0x21'));}}}return _0x4b733b[_0xcd20('0x22')](_0x41f6da[_0xcd20('0x12')])[_0xcd20('0x23')](_0x13766e);}function getUser(_0x49e184,_0x781550,_0x331943){if(!_[_0xcd20('0x24')](_0x781550)&&intUtil[_0xcd20('0x25')](_0x781550)){var _0x103eac={'Email':_0x781550};var _0x3ade4c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x331943[_0xcd20('0x22')](_0xcd20('0x26'))['find'](_0x103eac,_0x3ade4c)[_0xcd20('0x27')]()[_0xcd20('0x28')](function(_0x1ae8e6){if(_0x1ae8e6[_0xcd20('0x29')]){var _0x158152=_[_0xcd20('0x2a')](_0x1ae8e6,function(_0x9d1eb8){return _0x9d1eb8[_0xcd20('0x2b')]===_0x781550;});if(_0x158152){logger[_0xcd20('0x20')]('Agent\x20%s\x20found.',_0x781550);return BPromise[_0xcd20('0x2c')]({'id':_0x158152['Id'],'name':_0x158152[_0xcd20('0x2d')]});}}else{logger[_0xcd20('0x20')](_0xcd20('0x2e'),_0x781550);return _0x331943[_0xcd20('0x2f')]()[_0xcd20('0x28')](function(_0x55c98c){return BPromise[_0xcd20('0x2c')]({'id':_0x55c98c['user_id'],'name':_0x55c98c[_0xcd20('0x30')]});});}});}else{logger[_0xcd20('0x20')](_0xcd20('0x2e'),_0x781550);return _0x331943[_0xcd20('0x2f')]()[_0xcd20('0x28')](function(_0x7ccd12){return BPromise[_0xcd20('0x2c')]({'id':_0x7ccd12[_0xcd20('0x31')],'name':_0x7ccd12[_0xcd20('0x30')]});});}}function getEndUser(_0x48112d,_0x2d7c32,_0x261816,_0x2373a1,_0x31bb8a){var _0x5ac8a8={'$or':{'Phone':_0x2373a1}};var _0x96b709={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xcd20('0x2c')]()[_0xcd20('0x28')](function(){logger[_0xcd20('0x20')](_0xcd20('0x32'),_0x2373a1,_0x2d7c32[_0xcd20('0x33')]);switch(_0x2d7c32[_0xcd20('0x33')]){case _0xcd20('0x34'):var _0x29d6d3=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32['additionalSearchContact']){var _0x2aa82c={};_0x2aa82c[_0x2d7c32[_0xcd20('0x36')]]=_0x2373a1;_[_0xcd20('0x37')](_0x29d6d3['$or'],_0x2aa82c);}return _0x31bb8a['sobject']('Contact')[_0xcd20('0x2a')](_0x29d6d3,_0x96b709)[_0xcd20('0x27')]()[_0xcd20('0x28')](function(_0x193639){if(_0x193639&&_0x193639[_0xcd20('0x29')]){return _0x193639;}else{var _0x5acec6=_['cloneDeep'](_0x5ac8a8);if(_0x2d7c32['additionalSearchLead']){var _0x4feb0f={};_0x4feb0f[_0x2d7c32[_0xcd20('0x38')]]=_0x2373a1;_[_0xcd20('0x37')](_0x5acec6[_0xcd20('0x39')],_0x4feb0f);}return _0x31bb8a[_0xcd20('0x22')](_0xcd20('0x3a'))[_0xcd20('0x2a')](_0x5acec6,_0x96b709);}});case _0xcd20('0x3b'):var _0x3df7c8=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32[_0xcd20('0x3c')]){var _0x2aa82c={};_0x2aa82c[_0x2d7c32['additionalSearchAccount']]=_0x2373a1;_['merge'](_0x3df7c8['$or'],_0x2aa82c);}return _0x31bb8a['sobject'](_0xcd20('0x3d'))[_0xcd20('0x2a')](_0x3df7c8,_0x96b709)['execute']()['then'](function(_0xb03ebb){if(_0xb03ebb&&_0xb03ebb[_0xcd20('0x29')]){return _0xb03ebb;}else{var _0xb69e8c=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32[_0xcd20('0x36')]){var _0x4e32f3={};_0x4e32f3[_0x2d7c32['additionalSearchContact']]=_0x2373a1;_['merge'](_0xb69e8c[_0xcd20('0x39')],_0x4e32f3);}return _0x31bb8a[_0xcd20('0x22')](_0xcd20('0x3e'))[_0xcd20('0x2a')](_0xb69e8c,_0x96b709)['then'](function(_0x4d6b79){if(_0x4d6b79&&_0x4d6b79[_0xcd20('0x29')]){return _0x4d6b79;}else{var _0x2688a2=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32[_0xcd20('0x38')]){var _0x24ca3d={};_0x24ca3d[_0x2d7c32[_0xcd20('0x38')]]=_0x2373a1;_[_0xcd20('0x37')](_0x2688a2[_0xcd20('0x39')],_0x24ca3d);}return _0x31bb8a[_0xcd20('0x22')]('Lead')[_0xcd20('0x2a')](_0x2688a2,_0x96b709);}});}});case _0xcd20('0x19'):var _0x29d6d3=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32['additionalSearchContact']){var _0x2aa82c={};_0x2aa82c[_0x2d7c32[_0xcd20('0x36')]]=_0x2373a1;_['merge'](_0x29d6d3['$or'],_0x2aa82c);}return _0x31bb8a['sobject'](_0xcd20('0x3e'))['find'](_0x29d6d3,_0x96b709)['execute']();case'lead':var _0x1e9e4c=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32['additionalSearchLead']){var _0x2aa82c={};_0x2aa82c[_0x2d7c32[_0xcd20('0x38')]]=_0x2373a1;_[_0xcd20('0x37')](_0x1e9e4c[_0xcd20('0x39')],_0x2aa82c);}return _0x31bb8a[_0xcd20('0x22')](_0xcd20('0x3a'))[_0xcd20('0x2a')](_0x1e9e4c,_0x96b709);case _0xcd20('0x1c'):var _0x3df7c8=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32[_0xcd20('0x3c')]){var _0x2aa82c={};_0x2aa82c[_0x2d7c32[_0xcd20('0x3c')]]=_0x2373a1;_['merge'](_0x3df7c8[_0xcd20('0x39')],_0x2aa82c);}return _0x31bb8a[_0xcd20('0x22')]('Account')['find'](_0x3df7c8,_0x96b709);default:return null;}})[_0xcd20('0x28')](function(_0x9b52f4){if(_0x9b52f4&&_0x9b52f4['length']){var _0x312ae6=_[_0xcd20('0x3f')](_0x9b52f4);if(_0x312ae6){return BPromise[_0xcd20('0x2c')]({'id':_0x312ae6['Id'],'name':_0x312ae6[_0xcd20('0x2d')],'phone':_0x312ae6[_0xcd20('0x40')],'endUserType':_0x312ae6[_0xcd20('0x41')][_0xcd20('0x42')][_0xcd20('0x43')]()});}}})[_0xcd20('0x28')](function(_0x49fc65){if(_0x49fc65){logger[_0xcd20('0x20')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x49fc65[_0xcd20('0x18')],_0x2373a1);return BPromise[_0xcd20('0x2c')](_0x49fc65);}else{logger['info'](_0xcd20('0x44'),_0x2373a1);var _0x3455fe={'Phone':_0x2373a1};if(_0x2d7c32[_0xcd20('0x45')]){if(_0x2d7c32['moduleCreate']===_0xcd20('0x19')){logger[_0xcd20('0x20')](_0xcd20('0x46'),_0x2373a1,_0x2d7c32[_0xcd20('0x45')]);_0x3455fe[_0xcd20('0x47')]=_0x261816!==_0xcd20('0x48')?_0x261816:util[_0xcd20('0x49')](_0xcd20('0x4a'),_0x2373a1);}else if(_0x2d7c32[_0xcd20('0x45')]===_0xcd20('0x1a')){logger[_0xcd20('0x20')](_0xcd20('0x46'),_0x2373a1,_0x2d7c32[_0xcd20('0x45')]);_0x3455fe['LastName']=_0x261816!==_0xcd20('0x48')?_0x261816:util[_0xcd20('0x49')]('Caller\x20-\x20%s',_0x2373a1);_0x3455fe[_0xcd20('0x4b')]=_0xcd20('0x4c');}else if(_0x2d7c32[_0xcd20('0x45')]===_0xcd20('0x1c')){logger[_0xcd20('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2373a1,_0x2d7c32[_0xcd20('0x45')]);_0x3455fe['Name']=_0x261816!==_0xcd20('0x48')?_0x261816:util[_0xcd20('0x49')]('Caller\x20-\x20%s',_0x2373a1);}else{return null;}}return _0x31bb8a['sobject'](_['upperFirst'](_0x2d7c32[_0xcd20('0x45')]))[_0xcd20('0x23')](_0x3455fe)[_0xcd20('0x28')](function(_0x34f4a3){return BPromise[_0xcd20('0x2c')]({'id':_0x34f4a3['id'],'endUserType':_0x2d7c32[_0xcd20('0x45')]});});}});}function getCustomFields(_0x1b1d35,_0x1d37f8){var _0x32582c={};if(_0x1b1d35[_0xcd20('0x29')]>0x0){_[_0xcd20('0x4d')](_0x1b1d35,function(_0x4c6b4f){if(_['includes'](['string',_0xcd20('0x4e')],_0x4c6b4f['type'])&&_0x4c6b4f['idField']){_0x32582c[_0x4c6b4f['idField']]=_0x4c6b4f[_0xcd20('0x4f')]['toString']();}else if(_0x4c6b4f['type']===_0xcd20('0x50')&&_0x4c6b4f[_0xcd20('0x51')]&&_0x4c6b4f[_0xcd20('0x52')]){_0x1d37f8[_0x4c6b4f[_0xcd20('0x51')]]&&(_0x32582c[_0x4c6b4f[_0xcd20('0x52')]]=_0x1d37f8[_0x4c6b4f[_0xcd20('0x51')]][_0xcd20('0x53')]());}else if(_0x4c6b4f[_0xcd20('0x42')]===_0xcd20('0x54')&&_0x4c6b4f[_0xcd20('0x55')]&&_0x4c6b4f[_0xcd20('0x55')][_0xcd20('0x56')]&&_0x4c6b4f[_0xcd20('0x52')]){_0x1d37f8[_0x4c6b4f[_0xcd20('0x55')][_0xcd20('0x56')][_0xcd20('0x43')]()]&&(_0x32582c[_0x4c6b4f[_0xcd20('0x52')]]=_0x1d37f8[_0x4c6b4f['Variable'][_0xcd20('0x56')][_0xcd20('0x43')]()][_0xcd20('0x53')]());}});}return _0x32582c;}function getConnection(_0xcbf1d1){var _0x38c401=_0xcbf1d1[_0xcd20('0x57')][_0xcd20('0x58')](_0xcbf1d1[_0xcd20('0x59')]);var _0xb9e89f=new jsforce['Connection']({'oauth2':{'loginUrl':_0xcbf1d1[_0xcd20('0x5a')]||_0xcd20('0x5b'),'clientId':_0xcbf1d1[_0xcd20('0x5c')],'clientSecret':_0xcbf1d1['clientSecret']}});return _0xb9e89f[_0xcd20('0x5d')](_0xcbf1d1[_0xcd20('0x5e')],_0x38c401)[_0xcd20('0x28')](function(){logger[_0xcd20('0x20')](_0xcd20('0x5f'));return _0xb9e89f;});}exports[_0xcd20('0x60')]=function(_0x1a4829,_0x57db39,_0x483ca3,_0x2a683b,_0x3394e1,_0x275e53){var _0x3446e3,_0x2539ca,_0x39a550,_0x5a1f47;_0x275e53[_0xcd20('0x61')]=intUtil[_0xcd20('0x62')](_0x275e53['serverUrl']);_0x275e53['remoteUri']=intUtil[_0xcd20('0x62')](_0x275e53['remoteUri']);if(_0x3394e1&&_0x3394e1[_0xcd20('0x63')]){logger[_0xcd20('0x20')](_0xcd20('0x64'),_0xcd20('0x65'));_0x57db39[_0xcd20('0x66')]=util[_0xcd20('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x275e53[_0xcd20('0x61')],_0x57db39['uniqueid'],md5(_0x57db39[_0xcd20('0x67')]));}else{_0x57db39[_0xcd20('0x66')]='';}return getConnection(_0x275e53)[_0xcd20('0x28')](function(_0x107819){_0x5a1f47=_0x107819;return getUser(_0x275e53,_0x2a683b['email'],_0x5a1f47);})[_0xcd20('0x28')](function(_0x1e46ed){_0x3446e3=_0x1e46ed;return getEndUser(_0x275e53,_0x483ca3,_0x57db39[_0xcd20('0x68')],_0x57db39['calleridnum'],_0x5a1f47);})[_0xcd20('0x28')](function(_0x122b10){_0x2539ca=_0x122b10;return getTicket(_0x275e53,_0x3446e3,_0x2539ca,_0x483ca3,_0x57db39,_0x483ca3['Fields'],_0x5a1f47,_0xcd20('0x60'));})[_0xcd20('0x28')](function(_0x5671b0){_0x39a550=_0x5671b0;logger[_0xcd20('0x20')](_0xcd20('0x69'),_0x39a550['id']);logger['info'](_0xcd20('0x6a'),_0x39a550['id'],_0x2a683b[_0xcd20('0x56')],_0x275e53['type']);switch(_0x275e53[_0xcd20('0x42')]){case _0xcd20('0x6b'):emit(util[_0xcd20('0x49')]('user:%s',_0x2a683b[_0xcd20('0x56')]),_0xcd20('0x6c'),{'recordId':_0x39a550['id']});break;case _0xcd20('0x6d'):emit(util[_0xcd20('0x49')](_0xcd20('0x6e'),_0x2a683b[_0xcd20('0x56')]),_0xcd20('0x6f'),{'uri':util[_0xcd20('0x49')]('%s/%s/e',_0x5a1f47[_0xcd20('0x70')],_0x39a550['id'])});break;default:logger[_0xcd20('0x71')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xcd20('0x72')](function(_0x5e90f8){logger['error'](_0xcd20('0x64'),_0x5e90f8);});};exports[_0xcd20('0x73')]=function(_0x8e5214,_0x1a0534,_0x1f9b69,_0x47f61e,_0x250460,_0x1b77fe,_0x36ee17){var _0x1f6782,_0x4ec806,_0x53b6be,_0x135527;_0x1b77fe['serverUrl']=intUtil['stripTrailingSlash'](_0x1b77fe[_0xcd20('0x61')]);_0x1b77fe[_0xcd20('0x5a')]=intUtil[_0xcd20('0x62')](_0x1b77fe[_0xcd20('0x5a')]);if(_0x36ee17&&_0x36ee17[_0xcd20('0x74')]&&_0x36ee17[_0xcd20('0x74')]!=='none'){logger['info'](_0xcd20('0x75'),_0xcd20('0x65'));_0x1a0534[_0xcd20('0x66')]=util[_0xcd20('0x49')](_0xcd20('0x76'),_0x1b77fe['serverUrl'],_0x1a0534[_0xcd20('0x67')],md5(_0x1a0534['uniqueid']));}return getConnection(_0x1b77fe)[_0xcd20('0x28')](function(_0x70a3fa){_0x135527=_0x70a3fa;return getUser(_0x1b77fe,_0x47f61e[_0xcd20('0x77')],_0x135527);})[_0xcd20('0x28')](function(_0x260bcf){_0x1f6782=_0x260bcf;return getEndUser(_0x1b77fe,_0x1f9b69,_0x1a0534[_0xcd20('0x78')],_0x1a0534['destcalleridnum'],_0x135527);})[_0xcd20('0x28')](function(_0x158e1b){_0x4ec806=_0x158e1b;return getTicket(_0x1b77fe,_0x1f6782,_0x4ec806,_0x1f9b69,_0x1a0534,_0x1f9b69[_0xcd20('0x79')],_0x135527,_0xcd20('0x73'));})[_0xcd20('0x28')](function(_0x2e8813){_0x53b6be=_0x2e8813;logger['info'](_0xcd20('0x7a'),_0x53b6be['id']);logger[_0xcd20('0x20')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x53b6be['id'],_0x47f61e['name'],_0x1b77fe['type']);switch(_0x1b77fe['type']){case _0xcd20('0x6b'):emit(util[_0xcd20('0x49')](_0xcd20('0x6e'),_0x47f61e[_0xcd20('0x56')]),_0xcd20('0x6c'),{'recordId':_0x53b6be['id']});break;case _0xcd20('0x6d'):emit(util[_0xcd20('0x49')](_0xcd20('0x6e'),_0x47f61e[_0xcd20('0x56')]),_0xcd20('0x6f'),{'uri':util['format'](_0xcd20('0x7b'),_0x135527[_0xcd20('0x70')],_0x53b6be['id'])});break;default:logger['error']('[OUTBOUND]',_0xcd20('0x7c'));}})[_0xcd20('0x72')](function(_0x5939ef){logger[_0xcd20('0x71')](_0xcd20('0x75'),_0x5939ef);});};exports[_0xcd20('0x7d')]=function(_0x493a5d,_0x2e93fc,_0x47a0de,_0x1f4d0e,_0x412c45,_0x256681){var _0x2d2415,_0x37cd62,_0x48226f,_0x38b746;_0x256681[_0xcd20('0x61')]=intUtil[_0xcd20('0x62')](_0x256681['serverUrl']);_0x256681[_0xcd20('0x5a')]=intUtil[_0xcd20('0x62')](_0x256681[_0xcd20('0x5a')]);if(_0x412c45&&_0x412c45['monitor_format']){logger['info']('['+_0x2e93fc['lastevent']['toUpperCase']()+']',_0xcd20('0x65'));_0x2e93fc[_0xcd20('0x66')]=util['format'](_0xcd20('0x76'),_0x256681[_0xcd20('0x61')],_0x2e93fc[_0xcd20('0x67')],md5(_0x2e93fc[_0xcd20('0x67')]));}else{_0x2e93fc[_0xcd20('0x66')]='';}return getConnection(_0x256681)[_0xcd20('0x28')](function(_0x54ef9b){_0x38b746=_0x54ef9b;if(!_[_0xcd20('0x24')](_0x1f4d0e)){return getUser(_0x256681,_0x1f4d0e['name'],_0x38b746);}else{return getUser(_0x256681,null,_0x38b746);}})['then'](function(_0x58b5cf){_0x2d2415=_0x58b5cf;return getEndUser(_0x256681,_0x47a0de,_0x2e93fc[_0xcd20('0x68')],_0x2e93fc[_0xcd20('0x7e')],_0x38b746);})['then'](function(_0x38498c){_0x37cd62=_0x38498c;return getTicket(_0x256681,_0x2d2415,_0x37cd62,_0x47a0de,_0x2e93fc,_0x47a0de[_0xcd20('0x79')],_0x38b746);})[_0xcd20('0x28')](function(_0x171adc){_0x48226f=_0x171adc;logger[_0xcd20('0x20')]('['+_0x2e93fc[_0xcd20('0x7f')][_0xcd20('0x80')]()+']\x20Ticket\x20%s\x20created.',_0x48226f['id']);logger[_0xcd20('0x20')]('['+_0x2e93fc['lastevent']['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x256681[_0xcd20('0x42')]);})['catch'](function(_0x4495bb){logger[_0xcd20('0x71')]('['+_0x2e93fc[_0xcd20('0x7f')][_0xcd20('0x80')]()+']',_0x4495bb);});}; \ No newline at end of file +var _0x3b7d=['recordingURL','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','toUpperCase','isNil','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','socket.io-emitter','redis','emit','assign','getString','Subjects','Descriptions','Task','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','validateEmail','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Name','identity','then','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','additionalSearchAccount','first','attributes','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','upperFirst','create','forEach','string','picklist','idField','content','toString','variable','customVariable','Variable','name','concat','remoteUri','login','username','Connection\x20established.','queue','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x3b7d,0x109));var _0xd3b7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3b7d[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xd3b7('0x0'));var rp=require(_0xd3b7('0x1'));var moment=require(_0xd3b7('0x2'));var BPromise=require(_0xd3b7('0x3'));var md5=require(_0xd3b7('0x4'));var jsforce=require(_0xd3b7('0x5'));var util=require(_0xd3b7('0x6'));var Redis=require(_0xd3b7('0x7'));var intUtil=require('./util');var config=require(_0xd3b7('0x8'));var logger=require(_0xd3b7('0x9'))(_0xd3b7('0xa'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd3b7('0xb'))(new Redis(config[_0xd3b7('0xc')]));function emit(_0x573b58,_0x4ad3a6,_0x3757ed){io['to'](_0x573b58)[_0xd3b7('0xd')](_0x4ad3a6,_0x3757ed);}function getTicket(_0x4a89e9,_0x255d6e,_0x92caef,_0x8b69d6,_0x516c28,_0x2ff337,_0x1864ef,_0x44284b){var _0x6f7056=Object[_0xd3b7('0xe')]({},{'OwnerId':_0x255d6e['id'],'Subject':intUtil[_0xd3b7('0xf')](_0x8b69d6[_0xd3b7('0x10')],_0x516c28,'\x20'),'Description':intUtil[_0xd3b7('0xf')](_0x8b69d6[_0xd3b7('0x11')],_0x516c28,'\x0a')},getCustomFields(_0x2ff337,_0x516c28));if(_0x92caef){if(_0x8b69d6['ticketType']===_0xd3b7('0x12')){_0x6f7056['ActivityDate']=moment['utc']();_0x6f7056[_0xd3b7('0x13')]=![];_0x6f7056[_0xd3b7('0x14')]=![];if(_0x92caef[_0xd3b7('0x15')]==='contact'||_0x92caef['endUserType']===_0xd3b7('0x16')){_0x6f7056[_0xd3b7('0x17')]=_0x92caef['id'];}else if(_0x92caef['endUserType']===_0xd3b7('0x18')){_0x6f7056[_0xd3b7('0x19')]=_0x92caef['id'];}}else if(_0x8b69d6[_0xd3b7('0x1a')]===_0xd3b7('0x1b')){if(_0x92caef[_0xd3b7('0x15')]==='contact'){_0x6f7056[_0xd3b7('0x1c')]=_0x92caef['id'];}else if(_0x92caef[_0xd3b7('0x15')]==='account'){_0x6f7056[_0xd3b7('0x1d')]=_0x92caef['id'];}else if(_0x92caef[_0xd3b7('0x15')]===_0xd3b7('0x16')&&_0x8b69d6[_0xd3b7('0x1e')]){_0x6f7056[_0x8b69d6[_0xd3b7('0x1e')]]=_0x92caef['id'];}else{logger[_0xd3b7('0x1f')](_0xd3b7('0x20'));}}}return _0x1864ef[_0xd3b7('0x21')](_0x8b69d6[_0xd3b7('0x1a')])['create'](_0x6f7056);}function getUser(_0x4909e7,_0x191abf,_0x534477){if(!_['isNil'](_0x191abf)&&intUtil[_0xd3b7('0x22')](_0x191abf)){var _0x4a94b3={'Email':_0x191abf};var _0x1772c5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x534477[_0xd3b7('0x21')](_0xd3b7('0x23'))[_0xd3b7('0x24')](_0x4a94b3,_0x1772c5)[_0xd3b7('0x25')]()['then'](function(_0x1ab855){if(_0x1ab855[_0xd3b7('0x26')]){var _0x12af10=_[_0xd3b7('0x24')](_0x1ab855,function(_0x5aa1aa){return _0x5aa1aa[_0xd3b7('0x27')]===_0x191abf;});if(_0x12af10){logger['info'](_0xd3b7('0x28'),_0x191abf);return BPromise[_0xd3b7('0x29')]({'id':_0x12af10['Id'],'name':_0x12af10[_0xd3b7('0x2a')]});}}else{logger[_0xd3b7('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x191abf);return _0x534477[_0xd3b7('0x2b')]()[_0xd3b7('0x2c')](function(_0x279e78){return BPromise['resolve']({'id':_0x279e78[_0xd3b7('0x2d')],'name':_0x279e78[_0xd3b7('0x2e')]});});}});}else{logger[_0xd3b7('0x1f')](_0xd3b7('0x2f'),_0x191abf);return _0x534477[_0xd3b7('0x2b')]()[_0xd3b7('0x2c')](function(_0x191b00){return BPromise[_0xd3b7('0x29')]({'id':_0x191b00[_0xd3b7('0x2d')],'name':_0x191b00[_0xd3b7('0x2e')]});});}}function getEndUser(_0x1b4074,_0x123514,_0x233721,_0x496a98,_0x20e7c3){var _0x283d36={'$or':{'Phone':_0x496a98}};var _0xa86b12={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd3b7('0x29')]()['then'](function(){logger[_0xd3b7('0x1f')](_0xd3b7('0x30'),_0x496a98,_0x123514[_0xd3b7('0x31')]);switch(_0x123514[_0xd3b7('0x31')]){case _0xd3b7('0x32'):var _0x5a5872=_[_0xd3b7('0x33')](_0x283d36);if(_0x123514[_0xd3b7('0x34')]){var _0x21d589={};_0x21d589[_0x123514['additionalSearchContact']]=_0x496a98;_[_0xd3b7('0x35')](_0x5a5872[_0xd3b7('0x36')],_0x21d589);}return _0x20e7c3[_0xd3b7('0x21')](_0xd3b7('0x37'))[_0xd3b7('0x24')](_0x5a5872,_0xa86b12)[_0xd3b7('0x25')]()[_0xd3b7('0x2c')](function(_0x5cab93){if(_0x5cab93&&_0x5cab93[_0xd3b7('0x26')]){return _0x5cab93;}else{var _0x584211=_[_0xd3b7('0x33')](_0x283d36);if(_0x123514['additionalSearchLead']){var _0x238635={};_0x238635[_0x123514[_0xd3b7('0x38')]]=_0x496a98;_['merge'](_0x584211[_0xd3b7('0x36')],_0x238635);}return _0x20e7c3[_0xd3b7('0x21')](_0xd3b7('0x39'))[_0xd3b7('0x24')](_0x584211,_0xa86b12);}});case'account_contact_lead':var _0x4a5497=_[_0xd3b7('0x33')](_0x283d36);if(_0x123514['additionalSearchAccount']){var _0x21d589={};_0x21d589[_0x123514['additionalSearchAccount']]=_0x496a98;_['merge'](_0x4a5497[_0xd3b7('0x36')],_0x21d589);}return _0x20e7c3[_0xd3b7('0x21')]('Account')['find'](_0x4a5497,_0xa86b12)['execute']()[_0xd3b7('0x2c')](function(_0x4c1951){if(_0x4c1951&&_0x4c1951[_0xd3b7('0x26')]){return _0x4c1951;}else{var _0x2f104f=_['cloneDeep'](_0x283d36);if(_0x123514[_0xd3b7('0x34')]){var _0x269a08={};_0x269a08[_0x123514[_0xd3b7('0x34')]]=_0x496a98;_[_0xd3b7('0x35')](_0x2f104f[_0xd3b7('0x36')],_0x269a08);}return _0x20e7c3[_0xd3b7('0x21')]('Contact')['find'](_0x2f104f,_0xa86b12)['then'](function(_0x276f72){if(_0x276f72&&_0x276f72[_0xd3b7('0x26')]){return _0x276f72;}else{var _0x23c121=_[_0xd3b7('0x33')](_0x283d36);if(_0x123514[_0xd3b7('0x38')]){var _0x3dbd96={};_0x3dbd96[_0x123514[_0xd3b7('0x38')]]=_0x496a98;_['merge'](_0x23c121['$or'],_0x3dbd96);}return _0x20e7c3[_0xd3b7('0x21')](_0xd3b7('0x39'))[_0xd3b7('0x24')](_0x23c121,_0xa86b12);}});}});case'contact':var _0x5a5872=_[_0xd3b7('0x33')](_0x283d36);if(_0x123514[_0xd3b7('0x34')]){var _0x21d589={};_0x21d589[_0x123514['additionalSearchContact']]=_0x496a98;_[_0xd3b7('0x35')](_0x5a5872[_0xd3b7('0x36')],_0x21d589);}return _0x20e7c3[_0xd3b7('0x21')](_0xd3b7('0x37'))[_0xd3b7('0x24')](_0x5a5872,_0xa86b12)[_0xd3b7('0x25')]();case _0xd3b7('0x16'):var _0x4999fb=_[_0xd3b7('0x33')](_0x283d36);if(_0x123514[_0xd3b7('0x38')]){var _0x21d589={};_0x21d589[_0x123514[_0xd3b7('0x38')]]=_0x496a98;_[_0xd3b7('0x35')](_0x4999fb[_0xd3b7('0x36')],_0x21d589);}return _0x20e7c3[_0xd3b7('0x21')](_0xd3b7('0x39'))[_0xd3b7('0x24')](_0x4999fb,_0xa86b12);case'account':var _0x4a5497=_['cloneDeep'](_0x283d36);if(_0x123514[_0xd3b7('0x3a')]){var _0x21d589={};_0x21d589[_0x123514['additionalSearchAccount']]=_0x496a98;_[_0xd3b7('0x35')](_0x4a5497[_0xd3b7('0x36')],_0x21d589);}return _0x20e7c3['sobject']('Account')[_0xd3b7('0x24')](_0x4a5497,_0xa86b12);default:return null;}})[_0xd3b7('0x2c')](function(_0x81b054){if(_0x81b054&&_0x81b054['length']){var _0xd9b8a8=_[_0xd3b7('0x3b')](_0x81b054);if(_0xd9b8a8){return BPromise[_0xd3b7('0x29')]({'id':_0xd9b8a8['Id'],'name':_0xd9b8a8['Name'],'phone':_0xd9b8a8['Phone'],'endUserType':_0xd9b8a8[_0xd3b7('0x3c')][_0xd3b7('0x3d')][_0xd3b7('0x3e')]()});}}})['then'](function(_0x3d0e5c){if(_0x3d0e5c){logger[_0xd3b7('0x1f')](_0xd3b7('0x3f'),_0x3d0e5c[_0xd3b7('0x15')],_0x496a98);return BPromise['resolve'](_0x3d0e5c);}else{logger['info'](_0xd3b7('0x40'),_0x496a98);var _0x2c3a40={'Phone':_0x496a98};if(_0x123514[_0xd3b7('0x41')]){if(_0x123514[_0xd3b7('0x41')]==='contact'){logger[_0xd3b7('0x1f')](_0xd3b7('0x42'),_0x496a98,_0x123514[_0xd3b7('0x41')]);_0x2c3a40[_0xd3b7('0x43')]=_0x233721!==_0xd3b7('0x44')?_0x233721:util[_0xd3b7('0x45')](_0xd3b7('0x46'),_0x496a98);}else if(_0x123514[_0xd3b7('0x41')]===_0xd3b7('0x16')){logger['info'](_0xd3b7('0x42'),_0x496a98,_0x123514[_0xd3b7('0x41')]);_0x2c3a40[_0xd3b7('0x43')]=_0x233721!==_0xd3b7('0x44')?_0x233721:util['format'](_0xd3b7('0x46'),_0x496a98);_0x2c3a40[_0xd3b7('0x47')]='No\x20Company';}else if(_0x123514[_0xd3b7('0x41')]===_0xd3b7('0x18')){logger[_0xd3b7('0x1f')](_0xd3b7('0x42'),_0x496a98,_0x123514[_0xd3b7('0x41')]);_0x2c3a40[_0xd3b7('0x2a')]=_0x233721!==_0xd3b7('0x44')?_0x233721:util['format'](_0xd3b7('0x46'),_0x496a98);}else{return null;}}return _0x20e7c3['sobject'](_[_0xd3b7('0x48')](_0x123514[_0xd3b7('0x41')]))[_0xd3b7('0x49')](_0x2c3a40)['then'](function(_0x3881c2){return BPromise[_0xd3b7('0x29')]({'id':_0x3881c2['id'],'endUserType':_0x123514[_0xd3b7('0x41')]});});}});}function getCustomFields(_0x487493,_0x489e54){var _0x449552={};if(_0x487493[_0xd3b7('0x26')]>0x0){_[_0xd3b7('0x4a')](_0x487493,function(_0x42db30){if(_['includes']([_0xd3b7('0x4b'),_0xd3b7('0x4c')],_0x42db30['type'])&&_0x42db30['idField']){_0x449552[_0x42db30[_0xd3b7('0x4d')]]=_0x42db30[_0xd3b7('0x4e')][_0xd3b7('0x4f')]();}else if(_0x42db30['type']===_0xd3b7('0x50')&&_0x42db30['variableName']&&_0x42db30[_0xd3b7('0x4d')]){_0x489e54[_0x42db30['variableName']]&&(_0x449552[_0x42db30['idField']]=_0x489e54[_0x42db30['variableName']]['toString']());}else if(_0x42db30[_0xd3b7('0x3d')]===_0xd3b7('0x51')&&_0x42db30[_0xd3b7('0x52')]&&_0x42db30[_0xd3b7('0x52')][_0xd3b7('0x53')]&&_0x42db30[_0xd3b7('0x4d')]){_0x489e54[_0x42db30[_0xd3b7('0x52')][_0xd3b7('0x53')][_0xd3b7('0x3e')]()]&&(_0x449552[_0x42db30[_0xd3b7('0x4d')]]=_0x489e54[_0x42db30[_0xd3b7('0x52')][_0xd3b7('0x53')][_0xd3b7('0x3e')]()][_0xd3b7('0x4f')]());}});}return _0x449552;}function getConnection(_0x362738){var _0x5af81e=_0x362738['password'][_0xd3b7('0x54')](_0x362738['securityToken']);var _0x5cd7d3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x362738[_0xd3b7('0x55')]||'https://login.salesforce.com','clientId':_0x362738['clientId'],'clientSecret':_0x362738['clientSecret']}});return _0x5cd7d3[_0xd3b7('0x56')](_0x362738[_0xd3b7('0x57')],_0x5af81e)[_0xd3b7('0x2c')](function(){logger[_0xd3b7('0x1f')](_0xd3b7('0x58'));return _0x5cd7d3;});}exports[_0xd3b7('0x59')]=function(_0x27e175,_0xdf014a,_0x505d54,_0x3d59b8,_0x57e8e8,_0x38d9fa){var _0x225757,_0x55a1ab,_0x364dd6,_0x4f3672;_0x38d9fa[_0xd3b7('0x5a')]=intUtil['stripTrailingSlash'](_0x38d9fa[_0xd3b7('0x5a')]);_0x38d9fa[_0xd3b7('0x55')]=intUtil['stripTrailingSlash'](_0x38d9fa[_0xd3b7('0x55')]);if(_0x57e8e8&&_0x57e8e8[_0xd3b7('0x5b')]){logger['info']('[QUEUE]',_0xd3b7('0x5c'));_0xdf014a['recordingURL']=util[_0xd3b7('0x45')](_0xd3b7('0x5d'),_0x38d9fa[_0xd3b7('0x5a')],_0xdf014a[_0xd3b7('0x5e')],md5(_0xdf014a[_0xd3b7('0x5e')]));}else{_0xdf014a['recordingURL']='';}return getConnection(_0x38d9fa)[_0xd3b7('0x2c')](function(_0x3299ed){_0x4f3672=_0x3299ed;return getUser(_0x38d9fa,_0x3d59b8[_0xd3b7('0x5f')],_0x4f3672);})['then'](function(_0x324b7e){_0x225757=_0x324b7e;return getEndUser(_0x38d9fa,_0x505d54,_0xdf014a[_0xd3b7('0x60')],_0xdf014a[_0xd3b7('0x61')],_0x4f3672);})[_0xd3b7('0x2c')](function(_0x5ac3f5){_0x55a1ab=_0x5ac3f5;return getTicket(_0x38d9fa,_0x225757,_0x55a1ab,_0x505d54,_0xdf014a,_0x505d54[_0xd3b7('0x62')],_0x4f3672,_0xd3b7('0x59'));})['then'](function(_0x3eb35c){_0x364dd6=_0x3eb35c;logger[_0xd3b7('0x1f')](_0xd3b7('0x63'),_0x364dd6['id']);logger['info'](_0xd3b7('0x64'),_0x364dd6['id'],_0x3d59b8[_0xd3b7('0x53')],_0x38d9fa[_0xd3b7('0x3d')]);switch(_0x38d9fa[_0xd3b7('0x3d')]){case'integrationTab':emit(util[_0xd3b7('0x45')](_0xd3b7('0x65'),_0x3d59b8[_0xd3b7('0x53')]),_0xd3b7('0x66'),{'recordId':_0x364dd6['id']});break;case _0xd3b7('0x67'):emit(util['format'](_0xd3b7('0x65'),_0x3d59b8[_0xd3b7('0x53')]),_0xd3b7('0x68'),{'uri':util[_0xd3b7('0x45')](_0xd3b7('0x69'),_0x4f3672[_0xd3b7('0x6a')],_0x364dd6['id'])});break;default:logger[_0xd3b7('0x6b')](_0xd3b7('0x6c'));}})[_0xd3b7('0x6d')](function(_0x44f419){logger[_0xd3b7('0x6b')](_0xd3b7('0x6e'),_0x44f419);});};exports[_0xd3b7('0x6f')]=function(_0x6b32f1,_0x4e59fd,_0x2483f5,_0x395c54,_0x223fc1,_0x4144c8,_0x106330){var _0x114583,_0xba2bba,_0x3ac9b6,_0x51a0f0;_0x4144c8[_0xd3b7('0x5a')]=intUtil[_0xd3b7('0x70')](_0x4144c8[_0xd3b7('0x5a')]);_0x4144c8[_0xd3b7('0x55')]=intUtil[_0xd3b7('0x70')](_0x4144c8[_0xd3b7('0x55')]);if(_0x106330&&_0x106330[_0xd3b7('0x71')]&&_0x106330['recordingFormat']!==_0xd3b7('0x72')){logger[_0xd3b7('0x1f')](_0xd3b7('0x73'),_0xd3b7('0x5c'));_0x4e59fd[_0xd3b7('0x74')]=util['format'](_0xd3b7('0x5d'),_0x4144c8[_0xd3b7('0x5a')],_0x4e59fd[_0xd3b7('0x5e')],md5(_0x4e59fd[_0xd3b7('0x5e')]));}return getConnection(_0x4144c8)['then'](function(_0x180a57){_0x51a0f0=_0x180a57;return getUser(_0x4144c8,_0x395c54[_0xd3b7('0x5f')],_0x51a0f0);})[_0xd3b7('0x2c')](function(_0x5adac6){_0x114583=_0x5adac6;return getEndUser(_0x4144c8,_0x2483f5,_0x4e59fd['destcalleridname'],_0x4e59fd[_0xd3b7('0x75')],_0x51a0f0);})[_0xd3b7('0x2c')](function(_0x123a1c){_0xba2bba=_0x123a1c;return getTicket(_0x4144c8,_0x114583,_0xba2bba,_0x2483f5,_0x4e59fd,_0x2483f5[_0xd3b7('0x62')],_0x51a0f0,_0xd3b7('0x6f'));})[_0xd3b7('0x2c')](function(_0x22942e){_0x3ac9b6=_0x22942e;logger[_0xd3b7('0x1f')](_0xd3b7('0x76'),_0x3ac9b6['id']);logger[_0xd3b7('0x1f')](_0xd3b7('0x77'),_0x3ac9b6['id'],_0x395c54['name'],_0x4144c8[_0xd3b7('0x3d')]);switch(_0x4144c8[_0xd3b7('0x3d')]){case _0xd3b7('0x78'):emit(util[_0xd3b7('0x45')](_0xd3b7('0x65'),_0x395c54[_0xd3b7('0x53')]),_0xd3b7('0x66'),{'recordId':_0x3ac9b6['id']});break;case'newTab':emit(util[_0xd3b7('0x45')](_0xd3b7('0x65'),_0x395c54[_0xd3b7('0x53')]),'trigger:browser:url',{'uri':util[_0xd3b7('0x45')](_0xd3b7('0x69'),_0x51a0f0[_0xd3b7('0x6a')],_0x3ac9b6['id'])});break;default:logger[_0xd3b7('0x6b')](_0xd3b7('0x73'),_0xd3b7('0x79'));}})[_0xd3b7('0x6d')](function(_0x3f72a3){logger['error'](_0xd3b7('0x73'),_0x3f72a3);});};exports['unmanaged']=function(_0x4788f9,_0x4acfeb,_0x28fd22,_0x2a1cb6,_0x47b002,_0x2f1d40){var _0x40ce3c,_0x1d34c8,_0x17c916,_0xc22434;_0x2f1d40[_0xd3b7('0x5a')]=intUtil['stripTrailingSlash'](_0x2f1d40[_0xd3b7('0x5a')]);_0x2f1d40[_0xd3b7('0x55')]=intUtil[_0xd3b7('0x70')](_0x2f1d40['remoteUri']);if(_0x47b002&&_0x47b002['monitor_format']){logger[_0xd3b7('0x1f')]('['+_0x4acfeb['lastevent'][_0xd3b7('0x7a')]()+']',_0xd3b7('0x5c'));_0x4acfeb['recordingURL']=util[_0xd3b7('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f1d40[_0xd3b7('0x5a')],_0x4acfeb[_0xd3b7('0x5e')],md5(_0x4acfeb['uniqueid']));}else{_0x4acfeb[_0xd3b7('0x74')]='';}return getConnection(_0x2f1d40)['then'](function(_0x120e2a){_0xc22434=_0x120e2a;if(!_[_0xd3b7('0x7b')](_0x2a1cb6)){return getUser(_0x2f1d40,_0x2a1cb6[_0xd3b7('0x53')],_0xc22434);}else{return getUser(_0x2f1d40,null,_0xc22434);}})[_0xd3b7('0x2c')](function(_0x42d16a){_0x40ce3c=_0x42d16a;return getEndUser(_0x2f1d40,_0x28fd22,_0x4acfeb[_0xd3b7('0x60')],_0x4acfeb[_0xd3b7('0x61')],_0xc22434);})[_0xd3b7('0x2c')](function(_0xd7f86a){_0x1d34c8=_0xd7f86a;return getTicket(_0x2f1d40,_0x40ce3c,_0x1d34c8,_0x28fd22,_0x4acfeb,_0x28fd22[_0xd3b7('0x62')],_0xc22434);})[_0xd3b7('0x2c')](function(_0x25d5f4){_0x17c916=_0x25d5f4;logger['info']('['+_0x4acfeb[_0xd3b7('0x7c')][_0xd3b7('0x7a')]()+_0xd3b7('0x7d'),_0x17c916['id']);logger[_0xd3b7('0x1f')]('['+_0x4acfeb[_0xd3b7('0x7c')][_0xd3b7('0x7a')]()+_0xd3b7('0x7e'),_0x2f1d40[_0xd3b7('0x3d')]);})['catch'](function(_0x249da3){logger[_0xd3b7('0x6b')]('['+_0x4acfeb['lastevent'][_0xd3b7('0x7a')]()+']',_0x249da3);});}; \ 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 52345d2..f89de79 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 _0xa918=['then','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','true','userId','adminId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','nameField','customField','toLowerCase','toString','idField','content','type','variableName','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','POST','incident','getString','Subjects','Fields','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','map','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','stripTrailingSlash','remoteUri','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa918,0x1a0));var _0x8a91=function(_0x4b0733,_0xb0b8c6){_0x4b0733=_0x4b0733-0x0;var _0x5e7a2d=_0xa918[_0x4b0733];return _0x5e7a2d;};'use strict';var _=require('lodash');var Promise=require(_0x8a91('0x0'));var rp=require(_0x8a91('0x1'));var util=require('util');var md5=require(_0x8a91('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x8a91('0x3'));var logger=require(_0x8a91('0x4'))(_0x8a91('0x5'));config[_0x8a91('0x6')]=_[_0x8a91('0x7')](config[_0x8a91('0x6')],{'host':_0x8a91('0x8'),'port':0x18eb});var io=require(_0x8a91('0x9'))(new Redis(config['redis']));function getAdminUser(_0xf16342,_0x16c719,_0x4e270b,_0x40af87,_0x164800,_0x23a29f){return new Promise(function(_0x27a62c,_0x585a52){var _0xec3327={'method':_0x8a91('0xa'),'uri':_0x40af87+_0x8a91('0xb')+'&'+_0x164800+'&'+_0x23a29f,'auth':_0x16c719,'json':!![]};return rp(_0xec3327)[_0x8a91('0xc')](function(_0x13c90d){if(_0x13c90d[_0x8a91('0xd')][_0x8a91('0xe')]>0x0){_0x4e270b['adminId']=_0x13c90d[_0x8a91('0xd')][0x0][_0x8a91('0xf')];}logger[_0x8a91('0x10')]('['+[_0xf16342[_0x8a91('0x11')]()]+_0x8a91('0x12'),_0x4e270b);_0x27a62c(_0x4e270b);})['catch'](function(_0x19a604){logger[_0x8a91('0x13')]('['+[_0xf16342[_0x8a91('0x11')]()]+']',_0x19a604['message']);_0x585a52(_0x19a604[_0x8a91('0x14')]);});});}function getUser(_0x2cdd28,_0x5bb335,_0x298011,_0x3bb4e2,_0x63e8c3){return function(_0x495239){logger[_0x8a91('0x10')]('['+[_0x2cdd28[_0x8a91('0x11')]()]+_0x8a91('0x15'),_0x495239);return new Promise(function(_0x46d8fe,_0x5a2f7e){if(intUtil['validateEmail'](_0x495239[_0x8a91('0x16')])){var _0x268239={'method':_0x8a91('0xa'),'uri':_0x298011+_0x8a91('0x17')+_0x495239[_0x8a91('0x16')]+'&'+_0x3bb4e2+'&'+_0x63e8c3,'auth':_0x5bb335,'json':!![]};logger[_0x8a91('0x10')]('['+[_0x2cdd28[_0x8a91('0x11')]()]+_0x8a91('0x18'),_0x268239);return rp(_0x268239)[_0x8a91('0xc')](function(_0x3245a2){logger[_0x8a91('0x10')]('['+[_0x2cdd28[_0x8a91('0x11')]()]+'],\x20getUser\x20entity',_0x3245a2);if(_0x3245a2[_0x8a91('0xd')][_0x8a91('0xe')]>0x0&&String(_0x3245a2['result'][0x0]['active'])===_0x8a91('0x19')){_0x495239['userId']=_0x3245a2[_0x8a91('0xd')][0x0][_0x8a91('0xf')];}else{_0x495239[_0x8a91('0x1a')]=_0x495239[_0x8a91('0x1b')];_0x495239[_0x8a91('0x16')]=_0x495239[_0x8a91('0x1c')];}logger[_0x8a91('0x10')]('['+[_0x2cdd28[_0x8a91('0x11')]()]+_0x8a91('0x1d'),_0x495239);_0x46d8fe(_0x495239);})[_0x8a91('0x1e')](function(_0x1161c6){logger['error']('['+[_0x2cdd28[_0x8a91('0x11')]()]+']',_0x1161c6[_0x8a91('0x14')]);_0x5a2f7e(_0x1161c6['message']);});}else{logger[_0x8a91('0x10')]('['+[_0x2cdd28[_0x8a91('0x11')]()]+_0x8a91('0x1f'));_0x495239[_0x8a91('0x1a')]=_0x495239['adminId'];_0x495239['userEmail']=_0x495239[_0x8a91('0x1c')];_0x46d8fe(_0x495239);}});};}function createEndUser(_0x3d8f8e,_0x1f2d97,_0x5038a5,_0x56973c,_0x8efb90){logger[_0x8a91('0x10')]('['+[_0x3d8f8e[_0x8a91('0x11')]()]+_0x8a91('0x20'),_0x5038a5);return new Promise(function(_0x540d23,_0x5c50da){var _0xdd5abc={'method':'POST','uri':_0x56973c+_0x8a91('0x21')+_0x8efb90,'body':{'user_name':_0x5038a5[_0x8a91('0x22')],'roles':_0x8a91('0x23'),'first_name':_0x5038a5[_0x8a91('0x22')],'active':_0x8a91('0x19'),'date_format':'System','phone':_0x5038a5[_0x8a91('0x22')]},'auth':_0x1f2d97,'json':!![]};return rp(_0xdd5abc)[_0x8a91('0xc')](function(_0x3fd6e2){logger[_0x8a91('0x10')]('['+[_0x3d8f8e[_0x8a91('0x11')]()]+_0x8a91('0x24'),_0x3fd6e2[_0x8a91('0xd')]);_0x5038a5[_0x8a91('0x25')]=_0x3fd6e2[_0x8a91('0xd')][_0x8a91('0xf')];_0x540d23(_0x5038a5);})[_0x8a91('0x1e')](function(_0x5cb5f6){logger[_0x8a91('0x13')]('['+[_0x3d8f8e[_0x8a91('0x11')]()]+']',_0x5cb5f6['message']);_0x5c50da(_0x5cb5f6['message']);});});}function getEndUser(_0x510df8,_0x5b9cb3,_0x312463,_0x4a70fa,_0x3af5c6){return function(_0x570d51){logger[_0x8a91('0x10')]('['+[_0x510df8[_0x8a91('0x11')]()]+_0x8a91('0x26'),_0x570d51);return new Promise(function(_0x39a90f,_0x4e7fe2){var _0x40006c={'method':'GET','uri':_0x312463+_0x8a91('0x27')+_0x570d51[_0x8a91('0x22')]+'&'+_0x4a70fa+'&'+_0x3af5c6,'auth':_0x5b9cb3,'json':!![]};return rp(_0x40006c)[_0x8a91('0xc')](function(_0x10a795){if(_0x10a795[_0x8a91('0xd')]['length']>0x0){_0x570d51[_0x8a91('0x25')]=_0x10a795[_0x8a91('0xd')][0x0]['sys_id'];logger[_0x8a91('0x10')]('['+[_0x510df8[_0x8a91('0x11')]()]+_0x8a91('0x28'),_0x570d51);_0x39a90f(_0x570d51);}else{return createEndUser(_0x510df8,_0x5b9cb3,_0x570d51,_0x312463,_0x4a70fa)['then'](function(_0x15fba1){logger[_0x8a91('0x10')]('['+[_0x510df8['toUpperCase']()]+_0x8a91('0x29'),_0x15fba1);_0x39a90f(_0x15fba1);});}})[_0x8a91('0x1e')](function(_0x49f7aa){logger[_0x8a91('0x13')]('['+[_0x510df8[_0x8a91('0x11')]()]+']',_0x49f7aa[_0x8a91('0x14')]);_0x4e7fe2(_0x49f7aa['message']);});});};}function getCustomFields(_0x54065e,_0x15043c){var _0x48a46b={};if(_0x54065e[_0x8a91('0xe')]>0x0){_[_0x8a91('0x2a')](_0x54065e,function(_0x71cb9a){if(_[_0x8a91('0x2b')](['string',_0x8a91('0x2c')],_0x71cb9a['type'])&&_0x71cb9a[_0x8a91('0x2d')]&&!_0x71cb9a[_0x8a91('0x2e')]){_0x48a46b[_0x71cb9a[_0x8a91('0x2d')][_0x8a91('0x2f')]()]=_0x71cb9a['content'][_0x8a91('0x30')]();}else if(_[_0x8a91('0x2b')](['string',_0x8a91('0x2c')],_0x71cb9a['type'])&&_0x71cb9a[_0x8a91('0x31')]&&_0x71cb9a[_0x8a91('0x2e')]){_0x48a46b[_0x71cb9a[_0x8a91('0x31')][_0x8a91('0x2f')]()]=_0x71cb9a[_0x8a91('0x32')][_0x8a91('0x30')]();}else if(_0x71cb9a[_0x8a91('0x33')]==='variable'&&_0x71cb9a[_0x8a91('0x34')]&&_0x71cb9a[_0x8a91('0x31')]&&_0x71cb9a[_0x8a91('0x2e')]){_0x48a46b[_0x71cb9a[_0x8a91('0x31')][_0x8a91('0x2f')]()]=_0x15043c[_0x71cb9a['variableName']][_0x8a91('0x30')]();}else if(_0x71cb9a[_0x8a91('0x33')]===_0x8a91('0x35')&&_0x71cb9a[_0x8a91('0x36')]&&_0x71cb9a[_0x8a91('0x36')]['name']&&_0x71cb9a[_0x8a91('0x31')]&&_0x71cb9a[_0x8a91('0x2e')]){_0x48a46b[_0x71cb9a[_0x8a91('0x31')][_0x8a91('0x2f')]()]=_0x15043c[_0x71cb9a[_0x8a91('0x36')]['name'][_0x8a91('0x2f')]()][_0x8a91('0x30')]();}});}return _0x48a46b;}function getTicket(_0x2320e2,_0x32f0e4,_0x6eb7da,_0x1efa39,_0xa41164,_0x3b281b){return function(_0x1ac52d){logger[_0x8a91('0x10')]('['+[_0x2320e2[_0x8a91('0x11')]()]+_0x8a91('0x37'),_0x1ac52d);return new Promise(function(_0x5a5dc1,_0x1ffd70){var _0x939e49=_0x2320e2[_0x8a91('0x2f')]()===_0x8a91('0x38')?_0x1ac52d['userId']:_0x1ac52d[_0x8a91('0x25')];var _0x29ebb8={'method':_0x8a91('0x39'),'uri':_0x6eb7da+_0x8a91('0x3a')+'?'+_0x3b281b,'body':Object['assign']({},{'active':_0x8a91('0x19'),'caller_id':_0x939e49,'assigned_to':_0x1ac52d['userId'],'short_description':intUtil[_0x8a91('0x3b')](_0x1efa39[_0x8a91('0x3c')],_0xa41164,'\x20'),'description':intUtil[_0x8a91('0x3b')](_0x1efa39['Descriptions'],_0xa41164,'\x0a')},getCustomFields(_0x1efa39[_0x8a91('0x3d')],_0xa41164)),'auth':_0x32f0e4,'json':!![]};return rp(_0x29ebb8)[_0x8a91('0xc')](function(_0x325c2d){logger[_0x8a91('0x10')]('['+[_0x2320e2[_0x8a91('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x325c2d[_0x8a91('0xd')]);_0x1ac52d[_0x8a91('0x3e')]=_0x325c2d[_0x8a91('0xd')][_0x8a91('0xf')];_0x1ac52d[_0x8a91('0x3f')]=_0x325c2d['result'][_0x8a91('0x40')];logger[_0x8a91('0x10')]('['+[_0x2320e2[_0x8a91('0x11')]()]+']\x20getTicket\x20crm',_0x1ac52d);_0x5a5dc1(_0x1ac52d);})['catch'](function(_0x57786a){logger[_0x8a91('0x13')]('['+[_0x2320e2[_0x8a91('0x11')]()]+']',_0x57786a['message']);_0x1ffd70(_0x57786a[_0x8a91('0x14')]);});});};}function createRemoteTag(_0x509034,_0x5bc8a3,_0x3a6603,_0x400804){return new Promise(function(_0x54a6f5,_0x370ca7){var _0x1317d7={'method':'POST','uri':_0x3a6603+'label'+'?'+_0x400804,'body':{'short_description':_0x509034,'global':!![],'active':!![],'name':_0x509034},'auth':_0x5bc8a3,'json':!![]};return rp(_0x1317d7)[_0x8a91('0xc')](function(_0x3d2676){var _0x55bd33=_0x3d2676['result'][_0x8a91('0xf')];_0x54a6f5(_0x55bd33);});});}function getRemoteTag(_0x304aa2,_0x3b6470,_0x1acd4e,_0xd621f6,_0x49c13f){return new Promise(function(_0x1b57d1,_0x202600){var _0x5eafaf={'method':_0x8a91('0xa'),'uri':_0x1acd4e+_0x8a91('0x41')+_0x8a91('0x42')+_0x304aa2+'&'+_0xd621f6,'auth':_0x3b6470,'json':!![]};return rp(_0x5eafaf)[_0x8a91('0xc')](function(_0x4d4691){if(_0x4d4691[_0x8a91('0xd')]['length']>0x0){var _0x581b76=_0x4d4691['result'][0x0][_0x8a91('0xf')];_0x1b57d1(_0x581b76);}else{return createRemoteTag(_0x304aa2,_0x3b6470,_0x1acd4e,_0xd621f6)['then'](function(_0x31589a){_0x1b57d1(_0x31589a);});}});});}function assignTagToIncident(_0x58e7b0,_0x333d52,_0x34fa0d,_0x369f41,_0x12e74f){return new Promise(function(_0x2be29f,_0x41201a){var _0x2d9030={'method':_0x8a91('0x39'),'uri':_0x34fa0d+_0x8a91('0x43')+'?'+_0x12e74f,'body':{'label':_0x58e7b0,'table':'incident','id_type':_0x8a91('0x44'),'table_key':_0x369f41[_0x8a91('0x3e')],'title':_0x8a91('0x45')+_0x369f41[_0x8a91('0x3f')],'id_display':_0x369f41['ticketNumber']},'auth':_0x333d52,'json':!![]};return rp(_0x2d9030)['then'](function(_0x487bf2){_0x2be29f();})[_0x8a91('0x1e')](function(){_0x2be29f();});});}function manageTags(_0x3def1c,_0x520511,_0x19c73b,_0x466b7f,_0x3375d5,_0x15e759,_0x1f6d0b){return new Promise(function(_0x462d87,_0x2f8ea4){var _0x3b19e6=[];_0x520511['forEach'](function(_0x13e8f8){_0x3b19e6[_0x8a91('0x46')](getRemoteTag(_0x13e8f8,_0x19c73b,_0x466b7f,_0x15e759,_0x1f6d0b));});return Promise['all'](_0x3b19e6)['then'](function(_0x34327f){if(_0x34327f[_0x8a91('0xe')]){logger['info']('['+[_0x3def1c[_0x8a91('0x11')]()]+_0x8a91('0x47'),_0x34327f);var _0x11d955=[];_0x34327f[_0x8a91('0x2a')](function(_0x465842){_0x11d955[_0x8a91('0x46')](assignTagToIncident(_0x465842,_0x19c73b,_0x466b7f,_0x3375d5,_0x15e759));});return Promise[_0x8a91('0x48')](_0x11d955)['then'](function(){_0x462d87();})[_0x8a91('0x1e')](function(){_0x462d87();});}else{_0x462d87();}});});}function getTags(_0x3daddc,_0x3d7678,_0x8710c4,_0x4d07b7,_0x228767,_0x54ab0a){return function(_0x10499c){return new Promise(function(_0x5951e4,_0x2c03d8){var _0x55aeee=[];var _0x7a4de2=_0x4d07b7['Tags'];if(_0x7a4de2&&_0x7a4de2[_0x8a91('0xe')]>0x0){_0x55aeee=_[_0x8a91('0x49')](_0x7a4de2,_0x8a91('0x4a'));}if(_0x55aeee['length']>0x0){return manageTags(_0x3daddc,_0x55aeee,_0x3d7678,_0x8710c4,_0x10499c,_0x228767,_0x54ab0a)[_0x8a91('0xc')](function(){_0x5951e4(_0x10499c);});}else{_0x5951e4(_0x10499c);}});};}function emit(_0x1cac4a,_0x1c1c33,_0x4a8421){var _0x51bb44=_0x8a91('0x4b')+_0x8a91('0x4c')+_0x8a91('0x4d')+_0x8a91('0x4e');var _0x181dd4={'uri':_0x1cac4a+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x4a8421+_0x51bb44};io['to'](util[_0x8a91('0x4f')](_0x8a91('0x50'),_0x1c1c33))['emit'](_0x8a91('0x51'),_0x181dd4);}exports['cs']=function(_0xfcc0bc,_0x123cee,_0x12496f,_0x14d480,_0x3b8b6a,_0x30195d,_0x3613de,_0x23d29a){var _0x40f78f={};var _0x34a248={'user':_0x30195d[_0x8a91('0x52')],'pass':_0x30195d[_0x8a91('0x53')]};var _0x354e61=_0x8a91('0x54');var _0x5b84e0='sysparm_display_value=true';_0x30195d['remoteUri']=intUtil[_0x8a91('0x55')](_0x30195d[_0x8a91('0x56')]);_0x30195d['serverUrl']=intUtil[_0x8a91('0x55')](_0x30195d['serverUrl']);var _0x2a6947=util[_0x8a91('0x4f')](_0x8a91('0x57'),_0x30195d[_0x8a91('0x56')]);_0x40f78f[_0x8a91('0x16')]=!_[_0x8a91('0x58')](_0x14d480)?_0x14d480[_0x8a91('0x59')]:null;_0x40f78f['adminEmail']=_0x30195d['email'];_0x40f78f[_0x8a91('0x22')]=_0x23d29a[_0x8a91('0x2f')]()===_0x8a91('0x38')?_0x123cee[_0x8a91('0x5a')]:_0x123cee['calleridnum'];_0x40f78f[_0x8a91('0x5b')]=_0x23d29a===_0x8a91('0x5c')||_0x23d29a===_0x8a91('0x5d')?_0x8a91('0x5c'):_0x8a91('0x38');var _0x479988=util[_0x8a91('0x4f')](_0x8a91('0x5e'),_0x30195d[_0x8a91('0x5f')],_0x123cee['uniqueid'],md5(_0x123cee[_0x8a91('0x60')]));if(_0x3b8b6a&&_0x3b8b6a['monitor_format']){logger[_0x8a91('0x10')](_0x8a91('0x61'),_0x8a91('0x62'));_0x123cee[_0x8a91('0x63')]=_0x479988;}else if(_0x3613de&&_0x3613de[_0x8a91('0x64')]&&_0x3613de[_0x8a91('0x64')]!==_0x8a91('0x65')){logger[_0x8a91('0x10')](_0x8a91('0x66'),_0x8a91('0x62'));_0x123cee[_0x8a91('0x63')]=_0x479988;}else{_0x123cee[_0x8a91('0x63')]='';}return getAdminUser(_0x23d29a,_0x34a248,_0x40f78f,_0x2a6947,_0x5b84e0,_0x354e61)[_0x8a91('0xc')](getUser(_0x23d29a,_0x34a248,_0x2a6947,_0x5b84e0,_0x354e61))['then'](getEndUser(_0x23d29a,_0x34a248,_0x2a6947,_0x5b84e0,_0x354e61))[_0x8a91('0xc')](getTicket(_0x23d29a,_0x34a248,_0x2a6947,_0x12496f,_0x123cee,_0x5b84e0))[_0x8a91('0xc')](function(_0x21f16c){logger[_0x8a91('0x10')](util[_0x8a91('0x4f')]('The\x20ticket\x20ID\x20is:\x20%s',_0x21f16c[_0x8a91('0x3e')]));logger[_0x8a91('0x10')](util['format'](_0x8a91('0x67'),_0x23d29a));if(_0x23d29a!=='unmanaged'){logger[_0x8a91('0x10')]('['+[_0x23d29a[_0x8a91('0x11')]()]+']',_0x8a91('0x68'));emit(_0x30195d['remoteUri'],_0x14d480[_0x8a91('0x4a')],_0x21f16c[_0x8a91('0x3e')]);}})[_0x8a91('0x1e')](function(_0x48cfee){logger[_0x8a91('0x13')]('['+[_0x23d29a[_0x8a91('0x11')]()]+_0x8a91('0x69'),util[_0x8a91('0x6a')](_0x48cfee,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x438e=['variable','customVariable','Variable','name','outbound','incident','assign','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','Incident','Incident\x20-\x20','push','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20entity','length','active','true','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','customField','toLowerCase','toString','type','idField','content'];(function(_0x2a2db6,_0x6e4311){var _0x5e895e=function(_0x53b8a2){while(--_0x53b8a2){_0x2a2db6['push'](_0x2a2db6['shift']());}};_0x5e895e(++_0x6e4311);}(_0x438e,0x16d));var _0xe438=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x438e[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0xe438('0x0'));var Promise=require(_0xe438('0x1'));var rp=require(_0xe438('0x2'));var util=require(_0xe438('0x3'));var md5=require(_0xe438('0x4'));var Redis=require(_0xe438('0x5'));var intUtil=require('./util');var config=require(_0xe438('0x6'));var logger=require(_0xe438('0x7'))(_0xe438('0x8'));config['redis']=_[_0xe438('0x9')](config[_0xe438('0xa')],{'host':_0xe438('0xb'),'port':0x18eb});var io=require(_0xe438('0xc'))(new Redis(config[_0xe438('0xa')]));function getAdminUser(_0x514d13,_0x3d0af9,_0x390994,_0x2e4de0,_0x5da5f5,_0x3bb01d){return new Promise(function(_0x33443e,_0x5aa6d5){var _0x2927fd={'method':_0xe438('0xd'),'uri':_0x2e4de0+_0xe438('0xe')+'&'+_0x5da5f5+'&'+_0x3bb01d,'auth':_0x3d0af9,'json':!![]};return rp(_0x2927fd)[_0xe438('0xf')](function(_0x50b882){if(_0x50b882[_0xe438('0x10')]['length']>0x0){_0x390994['adminId']=_0x50b882[_0xe438('0x10')][0x0][_0xe438('0x11')];}logger[_0xe438('0x12')]('['+[_0x514d13[_0xe438('0x13')]()]+_0xe438('0x14'),_0x390994);_0x33443e(_0x390994);})[_0xe438('0x15')](function(_0x54e3eb){logger[_0xe438('0x16')]('['+[_0x514d13['toUpperCase']()]+']',_0x54e3eb[_0xe438('0x17')]);_0x5aa6d5(_0x54e3eb[_0xe438('0x17')]);});});}function getUser(_0xd00ca9,_0x7d1de6,_0x58587a,_0x30e310,_0x47ef02){return function(_0x133c56){logger[_0xe438('0x12')]('['+[_0xd00ca9[_0xe438('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x133c56);return new Promise(function(_0x5dc490,_0x4f339e){if(intUtil[_0xe438('0x18')](_0x133c56['userEmail'])){var _0x5c3061={'method':'GET','uri':_0x58587a+_0xe438('0x19')+_0x133c56[_0xe438('0x1a')]+'&'+_0x30e310+'&'+_0x47ef02,'auth':_0x7d1de6,'json':!![]};logger[_0xe438('0x12')]('['+[_0xd00ca9['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x5c3061);return rp(_0x5c3061)[_0xe438('0xf')](function(_0x55bb48){logger[_0xe438('0x12')]('['+[_0xd00ca9[_0xe438('0x13')]()]+_0xe438('0x1b'),_0x55bb48);if(_0x55bb48[_0xe438('0x10')][_0xe438('0x1c')]>0x0&&String(_0x55bb48[_0xe438('0x10')][0x0][_0xe438('0x1d')])===_0xe438('0x1e')){_0x133c56[_0xe438('0x1f')]=_0x55bb48['result'][0x0][_0xe438('0x11')];}else{_0x133c56[_0xe438('0x1f')]=_0x133c56[_0xe438('0x20')];_0x133c56[_0xe438('0x1a')]=_0x133c56[_0xe438('0x21')];}logger[_0xe438('0x12')]('['+[_0xd00ca9[_0xe438('0x13')]()]+_0xe438('0x22'),_0x133c56);_0x5dc490(_0x133c56);})['catch'](function(_0x243ddc){logger[_0xe438('0x16')]('['+[_0xd00ca9[_0xe438('0x13')]()]+']',_0x243ddc[_0xe438('0x17')]);_0x4f339e(_0x243ddc['message']);});}else{logger['info']('['+[_0xd00ca9[_0xe438('0x13')]()]+_0xe438('0x23'));_0x133c56[_0xe438('0x1f')]=_0x133c56['adminId'];_0x133c56[_0xe438('0x1a')]=_0x133c56[_0xe438('0x21')];_0x5dc490(_0x133c56);}});};}function createEndUser(_0x558083,_0x299877,_0x23058a,_0x3637ba,_0x5c455c){logger['info']('['+[_0x558083['toUpperCase']()]+_0xe438('0x24'),_0x23058a);return new Promise(function(_0x5f1af5,_0x22fa4b){var _0x4dedbb={'method':_0xe438('0x25'),'uri':_0x3637ba+'sys_user?'+_0x5c455c,'body':{'user_name':_0x23058a[_0xe438('0x26')],'roles':'user','first_name':_0x23058a[_0xe438('0x26')],'active':_0xe438('0x1e'),'date_format':_0xe438('0x27'),'phone':_0x23058a[_0xe438('0x26')]},'auth':_0x299877,'json':!![]};return rp(_0x4dedbb)[_0xe438('0xf')](function(_0x3c8c97){logger[_0xe438('0x12')]('['+[_0x558083['toUpperCase']()]+_0xe438('0x28'),_0x3c8c97[_0xe438('0x10')]);_0x23058a[_0xe438('0x29')]=_0x3c8c97['result'][_0xe438('0x11')];_0x5f1af5(_0x23058a);})[_0xe438('0x15')](function(_0x56e168){logger[_0xe438('0x16')]('['+[_0x558083['toUpperCase']()]+']',_0x56e168[_0xe438('0x17')]);_0x22fa4b(_0x56e168[_0xe438('0x17')]);});});}function getEndUser(_0x1041a2,_0x4b6fb8,_0x544ba7,_0x15ff56,_0x4b76be){return function(_0x2074c0){logger['info']('['+[_0x1041a2['toUpperCase']()]+_0xe438('0x2a'),_0x2074c0);return new Promise(function(_0x2e2203,_0x286355){var _0x1d260d={'method':'GET','uri':_0x544ba7+'sys_user?sysparm_query=phone%3D'+_0x2074c0['endUserNumber']+'&'+_0x15ff56+'&'+_0x4b76be,'auth':_0x4b6fb8,'json':!![]};return rp(_0x1d260d)[_0xe438('0xf')](function(_0x15fcad){if(_0x15fcad[_0xe438('0x10')][_0xe438('0x1c')]>0x0){_0x2074c0[_0xe438('0x29')]=_0x15fcad[_0xe438('0x10')][0x0]['sys_id'];logger['info']('['+[_0x1041a2['toUpperCase']()]+_0xe438('0x2b'),_0x2074c0);_0x2e2203(_0x2074c0);}else{return createEndUser(_0x1041a2,_0x4b6fb8,_0x2074c0,_0x544ba7,_0x15ff56)['then'](function(_0x47ed73){logger[_0xe438('0x12')]('['+[_0x1041a2[_0xe438('0x13')]()]+_0xe438('0x2c'),_0x47ed73);_0x2e2203(_0x47ed73);});}})[_0xe438('0x15')](function(_0xc93989){logger['error']('['+[_0x1041a2[_0xe438('0x13')]()]+']',_0xc93989[_0xe438('0x17')]);_0x286355(_0xc93989['message']);});});};}function getCustomFields(_0x73cc2a,_0x3bb0ff){var _0x4a723f={};if(_0x73cc2a[_0xe438('0x1c')]>0x0){_[_0xe438('0x2d')](_0x73cc2a,function(_0x12aff5){if(_[_0xe438('0x2e')]([_0xe438('0x2f'),_0xe438('0x30')],_0x12aff5['type'])&&_0x12aff5['nameField']&&!_0x12aff5[_0xe438('0x31')]){_0x4a723f[_0x12aff5['nameField'][_0xe438('0x32')]()]=_0x12aff5['content'][_0xe438('0x33')]();}else if(_[_0xe438('0x2e')]([_0xe438('0x2f'),_0xe438('0x30')],_0x12aff5[_0xe438('0x34')])&&_0x12aff5[_0xe438('0x35')]&&_0x12aff5[_0xe438('0x31')]){_0x4a723f[_0x12aff5[_0xe438('0x35')][_0xe438('0x32')]()]=_0x12aff5[_0xe438('0x36')]['toString']();}else if(_0x12aff5['type']===_0xe438('0x37')&&_0x12aff5['variableName']&&_0x12aff5[_0xe438('0x35')]&&_0x12aff5[_0xe438('0x31')]){_0x4a723f[_0x12aff5[_0xe438('0x35')][_0xe438('0x32')]()]=_0x3bb0ff[_0x12aff5['variableName']][_0xe438('0x33')]();}else if(_0x12aff5[_0xe438('0x34')]===_0xe438('0x38')&&_0x12aff5[_0xe438('0x39')]&&_0x12aff5[_0xe438('0x39')][_0xe438('0x3a')]&&_0x12aff5[_0xe438('0x35')]&&_0x12aff5[_0xe438('0x31')]){_0x4a723f[_0x12aff5[_0xe438('0x35')]['toLowerCase']()]=_0x3bb0ff[_0x12aff5['Variable']['name']['toLowerCase']()][_0xe438('0x33')]();}});}return _0x4a723f;}function getTicket(_0x486ddd,_0x432a76,_0xea10db,_0x5bb5f5,_0x4659e5,_0x34bc37){return function(_0x37e10a){logger[_0xe438('0x12')]('['+[_0x486ddd['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x37e10a);return new Promise(function(_0x28a1a2,_0x258061){var _0x193f6b=_0x486ddd[_0xe438('0x32')]()===_0xe438('0x3b')?_0x37e10a[_0xe438('0x1f')]:_0x37e10a['endUserId'];var _0x50a0f8={'method':_0xe438('0x25'),'uri':_0xea10db+_0xe438('0x3c')+'?'+_0x34bc37,'body':Object[_0xe438('0x3d')]({},{'active':'true','caller_id':_0x193f6b,'assigned_to':_0x37e10a[_0xe438('0x1f')],'short_description':intUtil['getString'](_0x5bb5f5['Subjects'],_0x4659e5,'\x20'),'description':intUtil['getString'](_0x5bb5f5[_0xe438('0x3e')],_0x4659e5,'\x0a')},getCustomFields(_0x5bb5f5['Fields'],_0x4659e5)),'auth':_0x432a76,'json':!![]};return rp(_0x50a0f8)[_0xe438('0xf')](function(_0x3ee1da){logger['info']('['+[_0x486ddd['toUpperCase']()]+_0xe438('0x3f'),_0x3ee1da[_0xe438('0x10')]);_0x37e10a[_0xe438('0x40')]=_0x3ee1da[_0xe438('0x10')][_0xe438('0x11')];_0x37e10a[_0xe438('0x41')]=_0x3ee1da['result'][_0xe438('0x42')];logger[_0xe438('0x12')]('['+[_0x486ddd['toUpperCase']()]+']\x20getTicket\x20crm',_0x37e10a);_0x28a1a2(_0x37e10a);})[_0xe438('0x15')](function(_0x720c21){logger['error']('['+[_0x486ddd[_0xe438('0x13')]()]+']',_0x720c21[_0xe438('0x17')]);_0x258061(_0x720c21[_0xe438('0x17')]);});});};}function createRemoteTag(_0x59bd89,_0x564f29,_0x248b02,_0xfcc67b){return new Promise(function(_0x483699,_0x450e6e){var _0x194550={'method':'POST','uri':_0x248b02+_0xe438('0x43')+'?'+_0xfcc67b,'body':{'short_description':_0x59bd89,'global':!![],'active':!![],'name':_0x59bd89},'auth':_0x564f29,'json':!![]};return rp(_0x194550)[_0xe438('0xf')](function(_0x1c54ed){var _0x297311=_0x1c54ed['result']['sys_id'];_0x483699(_0x297311);});});}function getRemoteTag(_0x47b608,_0x53f004,_0x522c4f,_0x13b02e,_0x570e73){return new Promise(function(_0x50e8af,_0x91ae07){var _0x14ceb8={'method':_0xe438('0xd'),'uri':_0x522c4f+_0xe438('0x43')+'?sysparm_query=name%3D'+_0x47b608+'&'+_0x13b02e,'auth':_0x53f004,'json':!![]};return rp(_0x14ceb8)['then'](function(_0x550947){if(_0x550947[_0xe438('0x10')][_0xe438('0x1c')]>0x0){var _0x2268e2=_0x550947['result'][0x0][_0xe438('0x11')];_0x50e8af(_0x2268e2);}else{return createRemoteTag(_0x47b608,_0x53f004,_0x522c4f,_0x13b02e)[_0xe438('0xf')](function(_0x19f32f){_0x50e8af(_0x19f32f);});}});});}function assignTagToIncident(_0x2f608a,_0x1c364d,_0x516a19,_0x13ee3f,_0x28224d){return new Promise(function(_0x5e8cba,_0x37552e){var _0x371b29={'method':_0xe438('0x25'),'uri':_0x516a19+'label_entry'+'?'+_0x28224d,'body':{'label':_0x2f608a,'table':_0xe438('0x3c'),'id_type':_0xe438('0x44'),'table_key':_0x13ee3f[_0xe438('0x40')],'title':_0xe438('0x45')+_0x13ee3f['ticketNumber'],'id_display':_0x13ee3f[_0xe438('0x41')]},'auth':_0x1c364d,'json':!![]};return rp(_0x371b29)[_0xe438('0xf')](function(_0x13cb85){_0x5e8cba();})[_0xe438('0x15')](function(){_0x5e8cba();});});}function manageTags(_0x25ced2,_0x52674b,_0x173c92,_0x3ee177,_0x5c4169,_0x1489ff,_0x4b69bc){return new Promise(function(_0x4afceb,_0x390f34){var _0x5de438=[];_0x52674b[_0xe438('0x2d')](function(_0x3d6dfb){_0x5de438[_0xe438('0x46')](getRemoteTag(_0x3d6dfb,_0x173c92,_0x3ee177,_0x1489ff,_0x4b69bc));});return Promise[_0xe438('0x47')](_0x5de438)[_0xe438('0xf')](function(_0x2b4fe6){if(_0x2b4fe6[_0xe438('0x1c')]){logger[_0xe438('0x12')]('['+[_0x25ced2[_0xe438('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x2b4fe6);var _0x26576a=[];_0x2b4fe6[_0xe438('0x2d')](function(_0x19c2db){_0x26576a[_0xe438('0x46')](assignTagToIncident(_0x19c2db,_0x173c92,_0x3ee177,_0x5c4169,_0x1489ff));});return Promise[_0xe438('0x47')](_0x26576a)['then'](function(){_0x4afceb();})[_0xe438('0x15')](function(){_0x4afceb();});}else{_0x4afceb();}});});}function getTags(_0x44c1ea,_0x3a01d2,_0x24dbb6,_0x5bd9d5,_0x292054,_0x513886){return function(_0x10653c){return new Promise(function(_0x28f9e3,_0x412f9b){var _0xc03d42=[];var _0x43fd5e=_0x5bd9d5['Tags'];if(_0x43fd5e&&_0x43fd5e[_0xe438('0x1c')]>0x0){_0xc03d42=_[_0xe438('0x48')](_0x43fd5e,_0xe438('0x3a'));}if(_0xc03d42['length']>0x0){return manageTags(_0x44c1ea,_0xc03d42,_0x3a01d2,_0x24dbb6,_0x10653c,_0x292054,_0x513886)[_0xe438('0xf')](function(){_0x28f9e3(_0x10653c);});}else{_0x28f9e3(_0x10653c);}});};}function emit(_0x20e8f5,_0x2be59b,_0x52c310){var _0x4a6d04=_0xe438('0x49')+_0xe438('0x4a')+_0xe438('0x4b')+_0xe438('0x4c');var _0x4a2922={'uri':_0x20e8f5+_0xe438('0x4d')+_0x52c310+_0x4a6d04};io['to'](util[_0xe438('0x4e')]('user:%s',_0x2be59b))[_0xe438('0x4f')](_0xe438('0x50'),_0x4a2922);}exports['cs']=function(_0xbd410a,_0x459b1a,_0x51a91a,_0x4cca44,_0xd3f6fb,_0x1c9098,_0x46eb2c,_0x32c30d){var _0x47a845={};var _0x51f65b={'user':_0x1c9098['username'],'pass':_0x1c9098[_0xe438('0x51')]};var _0x3d9f16=_0xe438('0x52');var _0x48151c=_0xe438('0x53');_0x1c9098[_0xe438('0x54')]=intUtil[_0xe438('0x55')](_0x1c9098[_0xe438('0x54')]);_0x1c9098['serverUrl']=intUtil[_0xe438('0x55')](_0x1c9098[_0xe438('0x56')]);var _0x317b17=util[_0xe438('0x4e')](_0xe438('0x57'),_0x1c9098[_0xe438('0x54')]);_0x47a845[_0xe438('0x1a')]=!_[_0xe438('0x58')](_0x4cca44)?_0x4cca44[_0xe438('0x59')]:null;_0x47a845[_0xe438('0x21')]=_0x1c9098['email'];_0x47a845['endUserNumber']=_0x32c30d[_0xe438('0x32')]()===_0xe438('0x3b')?_0x459b1a[_0xe438('0x5a')]:_0x459b1a['calleridnum'];_0x47a845[_0xe438('0x5b')]=_0x32c30d===_0xe438('0x5c')||_0x32c30d===_0xe438('0x5d')?'queue':_0xe438('0x3b');var _0x4c4b50=util[_0xe438('0x4e')](_0xe438('0x5e'),_0x1c9098[_0xe438('0x56')],_0x459b1a['uniqueid'],md5(_0x459b1a[_0xe438('0x5f')]));if(_0xd3f6fb&&_0xd3f6fb[_0xe438('0x60')]){logger['info'](_0xe438('0x61'),'Recording\x20is\x20enabled!');_0x459b1a[_0xe438('0x62')]=_0x4c4b50;}else if(_0x46eb2c&&_0x46eb2c['recordingFormat']&&_0x46eb2c[_0xe438('0x63')]!=='none'){logger[_0xe438('0x12')]('[OUTBOUND]',_0xe438('0x64'));_0x459b1a['recordingURL']=_0x4c4b50;}else{_0x459b1a[_0xe438('0x62')]='';}return getAdminUser(_0x32c30d,_0x51f65b,_0x47a845,_0x317b17,_0x48151c,_0x3d9f16)[_0xe438('0xf')](getUser(_0x32c30d,_0x51f65b,_0x317b17,_0x48151c,_0x3d9f16))[_0xe438('0xf')](getEndUser(_0x32c30d,_0x51f65b,_0x317b17,_0x48151c,_0x3d9f16))[_0xe438('0xf')](getTicket(_0x32c30d,_0x51f65b,_0x317b17,_0x51a91a,_0x459b1a,_0x48151c))[_0xe438('0xf')](function(_0x250ae7){logger[_0xe438('0x12')](util[_0xe438('0x4e')](_0xe438('0x65'),_0x250ae7[_0xe438('0x40')]));logger[_0xe438('0x12')](util[_0xe438('0x4e')]('call\x20direction:\x20%s',_0x32c30d));if(_0x32c30d!=='unmanaged'){logger[_0xe438('0x12')]('['+[_0x32c30d[_0xe438('0x13')]()]+']',_0xe438('0x66'));emit(_0x1c9098[_0xe438('0x54')],_0x4cca44[_0xe438('0x3a')],_0x250ae7[_0xe438('0x40')]);}})[_0xe438('0x15')](function(_0x12214a){logger['error']('['+[_0x32c30d[_0xe438('0x13')]()]+_0xe438('0x67'),util[_0xe438('0x68')](_0x12214a,{'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 aa0f6d4..0a8c925 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 _0x669b=['direction','forEach','variableName','push','idField','JSON','stringify','Calls','Basic\x20%s','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','user_name','entry_list','length','find','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','value','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','set_entry','first_name','','Caller\x20-\x20%s','then','Enduser\x20created.','debug','[HTTP]','map','type','nameField','customField','content','string','variable','custom_fields','Variable','toLowerCase','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','unmanaged','isNil','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name'];(function(_0x1df467,_0x3839b3){var _0x30cfff=function(_0x1a8bbb){while(--_0x1a8bbb){_0x1df467['push'](_0x1df467['shift']());}};_0x30cfff(++_0x3839b3);}(_0x669b,0x1bd));var _0xb669=function(_0x368a1e,_0x13e6ce){_0x368a1e=_0x368a1e-0x0;var _0x18d3da=_0x669b[_0x368a1e];return _0x18d3da;};'use strict';var _=require(_0xb669('0x0'));var rp=require(_0xb669('0x1'));var BPromise=require('bluebird');var md5=require(_0xb669('0x2'));var util=require(_0xb669('0x3'));var Redis=require('ioredis');var intUtil=require(_0xb669('0x4'));var config=require('../../../../config/environment');var logger=require(_0xb669('0x5'))(_0xb669('0x6'));config[_0xb669('0x7')]=_[_0xb669('0x8')](config[_0xb669('0x7')],{'host':_0xb669('0x9'),'port':0x18eb});var io=require(_0xb669('0xa'))(new Redis(config['redis']));var def={'method':_0xb669('0xb'),'json':!![]};function emit(_0x44eefe,_0x56007e,_0x248c3e){io['to'](_0x44eefe)[_0xb669('0xc')](_0x56007e,_0x248c3e);}function getTicket(_0x1ca7c0,_0x104f29,_0x3a9361,_0x519f32,_0x2287ad,_0x1c5057,_0x5dab46,_0x43d387){logger[_0xb669('0xd')](_0xb669('0xe'));var _0x3f5b77=new Date();var _0x53b20a=[{'name':'name','value':intUtil[_0xb669('0xf')](_0x519f32[_0xb669('0x10')],_0x2287ad,'\x20')},{'name':_0xb669('0x11'),'value':_0x104f29['id']},{'name':_0xb669('0x12'),'value':_0x104f29['id']},{'name':_0xb669('0x13'),'value':intUtil[_0xb669('0xf')](_0x519f32[_0xb669('0x14')],_0x2287ad,'\x0a')},{'name':'date_start','value':_0x3f5b77['toISOString']()['slice'](0x0,0x13)[_0xb669('0x15')]('T','\x20')},{'name':_0xb669('0x16'),'value':'0'},{'name':_0xb669('0x17'),'value':'15'},{'name':_0xb669('0x18'),'value':_0x3a9361['id']},{'name':'parent_type','value':_0xb669('0x19')},{'name':_0xb669('0x1a'),'value':_0x3a9361['name']},{'name':_0xb669('0x1b'),'value':_0x43d387}];if(_0x1c5057['length']){_[_0xb669('0x1c')](_0x1c5057,function(_0x39968d){if(_0x2287ad[_0x39968d[_0xb669('0x1d')]]){_0x53b20a[_0xb669('0x1e')]({'name':_0x39968d[_0xb669('0x1f')],'value':_0x2287ad[_0x39968d[_0xb669('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xb669('0x20'),'response_type':'JSON','rest_data':JSON[_0xb669('0x21')]({'session':_0x5dab46['id'],'module_name':_0xb669('0x22'),'name_value_list':_0x53b20a})}});}function getAuth(_0x18e5fa){return util['format'](_0xb669('0x23'),new Buffer(_0x18e5fa['apiKey']+':X')[_0xb669('0x24')](_0xb669('0x25')));}function getServerInfo(_0x507c7d){return request({'form':{'method':_0xb669('0x26'),'input_type':_0xb669('0x20'),'response_type':_0xb669('0x20'),'rest_data':JSON['stringify']({'session':_0x507c7d['id']})}});}function getUser(_0xe0ec07,_0x25ed69,_0x3943bd){if(!_['isNil'](_0x25ed69)){logger[_0xb669('0xd')](_0xb669('0x27'),_0x25ed69);return request({'form':{'method':_0xb669('0x28'),'input_type':_0xb669('0x20'),'response_type':_0xb669('0x20'),'rest_data':JSON[_0xb669('0x21')]({'session':_0x3943bd['id'],'module_name':_0xb669('0x29'),'query':util[_0xb669('0x2a')](_0xb669('0x2b'),_0x25ed69),'order_by':'','offset':'0','select_fields':['id',_0xb669('0x2c'),_0xb669('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3770a7){if(_0x3770a7[_0xb669('0x2e')][_0xb669('0x2f')]){var _0x1b9b76=_[_0xb669('0x30')](_0x3770a7[_0xb669('0x2e')],function(_0x6289b7){return _0x6289b7['name_value_list'][_0xb669('0x2d')]['value']===_0x25ed69;});if(_0x1b9b76){logger[_0xb669('0xd')]('Agent\x20found!');return BPromise[_0xb669('0x31')]({'id':_0x1b9b76[_0xb669('0x32')]['id']['value'],'name':_0x1b9b76[_0xb669('0x32')][_0xb669('0x2c')]['value']});}}logger[_0xb669('0xd')](_0xb669('0x33'));return BPromise[_0xb669('0x31')]({'id':_0x3943bd['name_value_list'][_0xb669('0x34')][_0xb669('0x35')],'name':_0x3943bd[_0xb669('0x32')][_0xb669('0x2d')][_0xb669('0x35')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xb669('0x31')]({'id':_0x3943bd[_0xb669('0x32')][_0xb669('0x34')][_0xb669('0x35')],'name':_0x3943bd[_0xb669('0x32')][_0xb669('0x2d')][_0xb669('0x35')]});}}function getEndUser(_0x216c14,_0x4657fe,_0xc95d3b,_0x591dda){logger[_0xb669('0xd')](_0xb669('0x36'),_0xc95d3b);return request({'form':{'method':_0xb669('0x28'),'input_type':_0xb669('0x20'),'response_type':_0xb669('0x20'),'rest_data':JSON[_0xb669('0x21')]({'session':_0x591dda['id'],'module_name':_0xb669('0x19'),'query':util['format'](_0xb669('0x37'),_0xc95d3b),'order_by':'','offset':'0','select_fields':['id','name',_0xb669('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4370db){if(_0x4370db[_0xb669('0x2e')][_0xb669('0x2f')]){var _0x41119d=_[_0xb669('0x30')](_0x4370db[_0xb669('0x2e')],function(_0x804648){return _0x804648['name_value_list'][_0xb669('0x38')][_0xb669('0x35')]===_0xc95d3b;});if(_0x41119d){logger[_0xb669('0xd')]('Enduser\x20found!');return BPromise[_0xb669('0x31')]({'id':_0x41119d[_0xb669('0x32')]['id'][_0xb669('0x35')],'name':_0x41119d['name_value_list'][_0xb669('0x2c')]['value'],'phone':_0x41119d['name_value_list'][_0xb669('0x38')]['value']});}}else{logger[_0xb669('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xb669('0x39'),'input_type':_0xb669('0x20'),'response_type':_0xb669('0x20'),'rest_data':JSON['stringify']({'session':_0x591dda['id'],'module_name':_0xb669('0x19'),'name_value_list':[{'name':_0xb669('0x3a'),'value':_0x4657fe!==_0xb669('0x3b')?_0x4657fe:util[_0xb669('0x2a')](_0xb669('0x3c'),_0xc95d3b)},{'name':_0xb669('0x38'),'value':_0xc95d3b}]})}})[_0xb669('0x3d')](function(_0x208bfa){logger[_0xb669('0xd')](_0xb669('0x3e'));return BPromise[_0xb669('0x31')]({'id':_0x208bfa['id'],'name':_0x208bfa[_0xb669('0x2e')][_0xb669('0x3a')][_0xb669('0x35')],'phone':_0x208bfa[_0xb669('0x2e')][_0xb669('0x38')]['value']});});}});}function request(_0x2a0974){logger[_0xb669('0x3f')](_0xb669('0x40'),JSON[_0xb669('0x21')](_0x2a0974));return rp(_['merge'](def,_0x2a0974));}function getTags(_0x160f65,_0x3dd3a2){var _0x317f42=[];if(_0x160f65&&_0x160f65[_0xb669('0x2f')]>0x0){_0x317f42=_[_0xb669('0x41')](_0x160f65,_0x3dd3a2);}return _0x317f42;}function getCustomFields(_0x4dd5ae,_0x5cd696){var _0xe20593=[];var _0x4c6451={'custom_fields':[]};if(_0x4dd5ae[_0xb669('0x2f')]>0x0){_[_0xb669('0x1c')](_0x4dd5ae,function(_0x1960cb){if(_0x1960cb[_0xb669('0x42')]==='string'&&_0x1960cb[_0xb669('0x43')]&&!_0x1960cb[_0xb669('0x44')]){_0x4c6451[_0x1960cb[_0xb669('0x43')]['toLowerCase']()]=_0x1960cb[_0xb669('0x45')][_0xb669('0x24')]();}else if(_0x1960cb[_0xb669('0x42')]===_0xb669('0x46')&&_0x1960cb[_0xb669('0x1f')]&&_0x1960cb[_0xb669('0x44')]){_0x4c6451['custom_fields'][_0xb669('0x1e')]({'id':_0x1960cb[_0xb669('0x1f')],'value':_0x1960cb[_0xb669('0x45')][_0xb669('0x24')]()});}else if(_0x1960cb[_0xb669('0x42')]===_0xb669('0x47')&&_0x1960cb[_0xb669('0x1d')]&&_0x1960cb[_0xb669('0x1f')]&&_0x1960cb[_0xb669('0x44')]){_0x5cd696[_0x1960cb[_0xb669('0x1d')]]&&_0x4c6451[_0xb669('0x48')][_0xb669('0x1e')]({'id':_0x1960cb[_0xb669('0x1f')],'value':_0x5cd696[_0x1960cb['variableName']][_0xb669('0x24')]()});}else if(_0x1960cb[_0xb669('0x42')]==='customVariable'&&_0x1960cb[_0xb669('0x49')]&&_0x1960cb[_0xb669('0x49')]['name']&&_0x1960cb[_0xb669('0x1f')]&&_0x1960cb[_0xb669('0x44')]){_0x5cd696[_0x1960cb[_0xb669('0x49')][_0xb669('0x2c')][_0xb669('0x4a')]()]&&_0x4c6451['custom_fields'][_0xb669('0x1e')]({'id':_0x1960cb[_0xb669('0x1f')],'value':_0x5cd696[_0x1960cb['Variable'][_0xb669('0x2c')][_0xb669('0x4a')]()][_0xb669('0x24')]()});}});}return _0x4c6451;}function getConnection(_0x2bc5ef){return request({'method':'POST','form':{'method':'login','input_type':_0xb669('0x20'),'response_type':'JSON','rest_data':JSON[_0xb669('0x21')]({'user_auth':{'user_name':_0x2bc5ef['username'],'password':_0x2bc5ef['password'],'encryption':'PLAIN'},'application':_0xb669('0x4b')})}})[_0xb669('0x3d')](function(_0x406a9c){var _0x266b1e=_0x406a9c;if(_0x266b1e['id']){def[_0xb669('0x4c')]=_0x266b1e['id'];return BPromise['resolve'](_0x266b1e);}else{throw new Error(util[_0xb669('0x2a')](_0xb669('0x4d'),_0x2bc5ef['id']));}});}function setRelationship(_0x12b116,_0x330cd8,_0x447f30,_0x56186e){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x12b116['id'],'module_name':'Calls','module_id':_0x447f30['id'],'link_field_name':_0x56186e,'related_ids':[_0x330cd8['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xb669('0x4e')]=function(_0x279c26,_0x2697ce,_0x54fb54,_0xacdbf8,_0xf85d94,_0x5228ac){var _0x206f40,_0x599b2f,_0x1eb8c5,_0x3b7439;_0x5228ac[_0xb669('0x4f')]=intUtil[_0xb669('0x50')](_0x5228ac[_0xb669('0x4f')]);_0x5228ac['serverUrl']=intUtil[_0xb669('0x50')](_0x5228ac[_0xb669('0x51')]);def[_0xb669('0x52')]=util[_0xb669('0x2a')](_0xb669('0x53'),_0x5228ac[_0xb669('0x4f')]);if(_0xf85d94&&_0xf85d94[_0xb669('0x54')]){logger[_0xb669('0xd')](_0xb669('0x55'),_0xb669('0x56'));_0x2697ce['recordingURL']=util[_0xb669('0x2a')](_0xb669('0x57'),_0x5228ac['serverUrl'],_0x2697ce[_0xb669('0x58')],md5(_0x2697ce[_0xb669('0x58')]));}else{_0x2697ce[_0xb669('0x59')]='';}return getConnection(_0x5228ac)['then'](function(_0x38f0d7){_0x3b7439=_0x38f0d7;return getUser(_0x5228ac,_0xacdbf8['name'],_0x3b7439);})['then'](function(_0x25876b){_0x206f40=_0x25876b;logger[_0xb669('0xd')]('The\x20User\x20ID\x20is:',_0x206f40['id']);return getEndUser(_0x5228ac,_0x2697ce[_0xb669('0x5a')],_0x2697ce['calleridnum'],_0x3b7439);})[_0xb669('0x3d')](function(_0x333449){_0x599b2f=_0x333449;logger['info'](_0xb669('0x5b'),_0x599b2f['id']);return getTicket(_0x5228ac,_0x206f40,_0x599b2f,_0x54fb54,_0x2697ce,_0x54fb54[_0xb669('0x5c')],_0x3b7439,_0xb669('0x5d'));})[_0xb669('0x3d')](function(_0x4579a0){_0x1eb8c5=_0x4579a0;logger['info'](_0xb669('0x5e'));logger[_0xb669('0xd')](_0xb669('0x5f'),_0x1eb8c5['id']);return setRelationship(_0x3b7439,_0x206f40,_0x1eb8c5,_0xb669('0x60'));})['then'](function(){return setRelationship(_0x3b7439,_0x599b2f,_0x1eb8c5,_0xb669('0x61'));})['then'](function(){return getServerInfo(_0x3b7439);})[_0xb669('0x3d')](function(_0x1309bc){var _0x4f6d6e=parseInt(_0x1309bc[_0xb669('0x62')][_0xb669('0x63')](0x0));var _0x342a8a=util[_0xb669('0x2a')](_0xb669('0x64'),_0x5228ac[_0xb669('0x4f')],_0x1eb8c5['id']);if(_0x4f6d6e>0x6){_0x342a8a=util[_0xb669('0x2a')](_0xb669('0x65'),_0x5228ac['remoteUri'],_0x1eb8c5['id']);}logger['info'](_0xb669('0x55'),_0xb669('0x66'));emit(util[_0xb669('0x2a')](_0xb669('0x67'),_0xacdbf8[_0xb669('0x2c')]),_0xb669('0x68'),{'uri':_0x342a8a});})[_0xb669('0x69')](function(_0x1350ee){logger[_0xb669('0x6a')](_0xb669('0x55'),JSON[_0xb669('0x21')](_0x1350ee));});};exports[_0xb669('0x6b')]=function(_0x7b0dea,_0x267df6,_0x3bce56,_0x2a0c5c,_0x2f3296,_0x1127e3,_0x2ed693){var _0x29bfda,_0x3262c9,_0x5ad57e,_0x4c6447;_0x1127e3['remoteUri']=intUtil[_0xb669('0x50')](_0x1127e3['remoteUri']);_0x1127e3[_0xb669('0x51')]=intUtil[_0xb669('0x50')](_0x1127e3[_0xb669('0x51')]);def[_0xb669('0x52')]=util['format'](_0xb669('0x53'),_0x1127e3[_0xb669('0x4f')]);if(_0x2ed693&&_0x2ed693[_0xb669('0x6c')]&&_0x2ed693[_0xb669('0x6c')]!==_0xb669('0x6d')){logger[_0xb669('0xd')](_0xb669('0x6e'),_0xb669('0x56'));_0x267df6[_0xb669('0x59')]=util['format'](_0xb669('0x57'),_0x1127e3[_0xb669('0x51')],_0x267df6[_0xb669('0x58')],md5(_0x267df6[_0xb669('0x58')]));}return getConnection(_0x1127e3)[_0xb669('0x3d')](function(_0x22bde8){_0x4c6447=_0x22bde8;return getUser(_0x1127e3,_0x2a0c5c[_0xb669('0x2c')],_0x4c6447);})[_0xb669('0x3d')](function(_0x1cc9a1){_0x29bfda=_0x1cc9a1;logger['info'](_0xb669('0x6f'),_0x29bfda['id']);return getEndUser(_0x1127e3,_0x267df6['destcalleridname'],_0x267df6[_0xb669('0x70')],_0x4c6447);})[_0xb669('0x3d')](function(_0x3341ec){_0x3262c9=_0x3341ec;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3262c9['id']);return getTicket(_0x1127e3,_0x29bfda,_0x3262c9,_0x3bce56,_0x267df6,_0x3bce56[_0xb669('0x5c')],_0x4c6447,_0xb669('0x71'));})[_0xb669('0x3d')](function(_0x5ed4e3){_0x5ad57e=_0x5ed4e3;logger[_0xb669('0xd')](_0xb669('0x5e'));logger[_0xb669('0xd')](_0xb669('0x5f'),_0x5ad57e['id']);return setRelationship(_0x4c6447,_0x29bfda,_0x5ad57e,'users');})[_0xb669('0x3d')](function(){return setRelationship(_0x4c6447,_0x3262c9,_0x5ad57e,'contacts');})[_0xb669('0x3d')](function(){return getServerInfo(_0x4c6447);})[_0xb669('0x3d')](function(_0x126d42){var _0x32cfc4=parseInt(_0x126d42[_0xb669('0x62')][_0xb669('0x63')](0x0));var _0x2a7efc=util[_0xb669('0x2a')](_0xb669('0x64'),_0x1127e3[_0xb669('0x4f')],_0x5ad57e['id']);if(_0x32cfc4>0x6){_0x2a7efc=util[_0xb669('0x2a')](_0xb669('0x65'),_0x1127e3['remoteUri'],_0x5ad57e['id']);}logger['info'](_0xb669('0x6e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb669('0x2a')]('user:%s',_0x2a0c5c[_0xb669('0x2c')]),'trigger:browser:url',{'uri':_0x2a7efc});})[_0xb669('0x69')](function(_0x17c40b){logger[_0xb669('0x6a')](_0xb669('0x6e'),JSON[_0xb669('0x21')](_0x17c40b));});};exports[_0xb669('0x72')]=function(_0x32bc4f,_0x1aa7b4,_0x4a9e15,_0x241235,_0xd14ac1,_0x129ff8){var _0xa3d47d,_0x2f85b8,_0x393199,_0x103529;_0x129ff8[_0xb669('0x4f')]=intUtil[_0xb669('0x50')](_0x129ff8[_0xb669('0x4f')]);_0x129ff8[_0xb669('0x51')]=intUtil['stripTrailingSlash'](_0x129ff8[_0xb669('0x51')]);def[_0xb669('0x52')]=util[_0xb669('0x2a')](_0xb669('0x53'),_0x129ff8[_0xb669('0x4f')]);if(_0xd14ac1&&_0xd14ac1['monitor_format']){logger[_0xb669('0xd')]('['+_0x1aa7b4['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1aa7b4[_0xb669('0x59')]=util[_0xb669('0x2a')](_0xb669('0x57'),_0x129ff8[_0xb669('0x51')],_0x1aa7b4[_0xb669('0x58')],md5(_0x1aa7b4[_0xb669('0x58')]));}else{_0x1aa7b4[_0xb669('0x59')]='';}return getConnection(_0x129ff8)['then'](function(_0x33dc50){_0x103529=_0x33dc50;if(!_[_0xb669('0x73')](_0x241235)){return getUser(_0x129ff8,_0x241235[_0xb669('0x2c')],_0x103529);}else{return getUser(_0x129ff8,null,_0x103529);}})[_0xb669('0x3d')](function(_0x20f7f6){_0xa3d47d=_0x20f7f6;logger[_0xb669('0xd')](_0xb669('0x6f'),_0xa3d47d['id']);return getEndUser(_0x129ff8,_0x1aa7b4[_0xb669('0x5a')],_0x1aa7b4['calleridnum'],_0x103529);})['then'](function(_0x400dd0){_0x2f85b8=_0x400dd0;logger['info'](_0xb669('0x5b'),_0x2f85b8['id']);return getTicket(_0x129ff8,_0xa3d47d,_0x2f85b8,_0x4a9e15,_0x1aa7b4,_0x4a9e15[_0xb669('0x5c')],_0x103529,_0xb669('0x5d'));})[_0xb669('0x3d')](function(_0x432fdf){_0x393199=_0x432fdf;logger[_0xb669('0xd')]('Ticket\x20created!');logger[_0xb669('0xd')](_0xb669('0x5f'),_0x393199['id']);return setRelationship(_0x103529,_0xa3d47d,_0x393199,_0xb669('0x60'));})['then'](function(){return setRelationship(_0x103529,_0x2f85b8,_0x393199,_0xb669('0x61'));})[_0xb669('0x3d')](function(){return getServerInfo(_0x103529);})[_0xb669('0x69')](function(_0x10f464){logger[_0xb669('0x6a')]('['+_0x1aa7b4[_0xb669('0x74')][_0xb669('0x75')]()+']',JSON[_0xb669('0x21')](_0x10f464));});}; \ No newline at end of file +var _0x818d=['description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','push','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','[HTTP]','merge','map','forEach','string','nameField','toLowerCase','content','type','idField','customField','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','users','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','serverUrl','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','The\x20Ticket\x20ID\x20is:','contacts','charAt','[OUTBOUND]','unmanaged','lastevent','toUpperCase','catch','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by'];(function(_0x414152,_0x41ab28){var _0x29de79=function(_0x405681){while(--_0x405681){_0x414152['push'](_0x414152['shift']());}};_0x29de79(++_0x41ab28);}(_0x818d,0x168));var _0xd818=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x818d[_0x284807];return _0x50c774;};'use strict';var _=require('lodash');var rp=require(_0xd818('0x0'));var BPromise=require(_0xd818('0x1'));var md5=require('md5');var util=require(_0xd818('0x2'));var Redis=require(_0xd818('0x3'));var intUtil=require(_0xd818('0x4'));var config=require(_0xd818('0x5'));var logger=require(_0xd818('0x6'))(_0xd818('0x7'));config[_0xd818('0x8')]=_['defaults'](config[_0xd818('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd818('0x8')]));var def={'method':_0xd818('0x9'),'json':!![]};function emit(_0x2e269b,_0x10a91a,_0x3fca34){io['to'](_0x2e269b)[_0xd818('0xa')](_0x10a91a,_0x3fca34);}function getTicket(_0x2b7bf1,_0x2dde03,_0x1a5895,_0x5e6fbd,_0x16a30e,_0x3c466e,_0x18cc23,_0x52394b){logger[_0xd818('0xb')](_0xd818('0xc'));var _0x2b9a9e=new Date();var _0x3f15be=[{'name':_0xd818('0xd'),'value':intUtil[_0xd818('0xe')](_0x5e6fbd[_0xd818('0xf')],_0x16a30e,'\x20')},{'name':_0xd818('0x10'),'value':_0x2dde03['id']},{'name':_0xd818('0x11'),'value':_0x2dde03['id']},{'name':_0xd818('0x12'),'value':intUtil[_0xd818('0xe')](_0x5e6fbd[_0xd818('0x13')],_0x16a30e,'\x0a')},{'name':_0xd818('0x14'),'value':_0x2b9a9e[_0xd818('0x15')]()[_0xd818('0x16')](0x0,0x13)[_0xd818('0x17')]('T','\x20')},{'name':_0xd818('0x18'),'value':'0'},{'name':_0xd818('0x19'),'value':'15'},{'name':_0xd818('0x1a'),'value':_0x1a5895['id']},{'name':_0xd818('0x1b'),'value':_0xd818('0x1c')},{'name':_0xd818('0x1d'),'value':_0x1a5895[_0xd818('0xd')]},{'name':_0xd818('0x1e'),'value':_0x52394b}];if(_0x3c466e[_0xd818('0x1f')]){_['forEach'](_0x3c466e,function(_0xf81bbc){if(_0x16a30e[_0xf81bbc[_0xd818('0x20')]]){_0x3f15be[_0xd818('0x21')]({'name':_0xf81bbc['idField'],'value':_0x16a30e[_0xf81bbc[_0xd818('0x20')]]});}});}return request({'form':{'method':_0xd818('0x22'),'input_type':_0xd818('0x23'),'response_type':_0xd818('0x23'),'rest_data':JSON[_0xd818('0x24')]({'session':_0x18cc23['id'],'module_name':_0xd818('0x25'),'name_value_list':_0x3f15be})}});}function getAuth(_0x1f43bf){return util[_0xd818('0x26')]('Basic\x20%s',new Buffer(_0x1f43bf[_0xd818('0x27')]+':X')[_0xd818('0x28')](_0xd818('0x29')));}function getServerInfo(_0x91a4c3){return request({'form':{'method':_0xd818('0x2a'),'input_type':_0xd818('0x23'),'response_type':_0xd818('0x23'),'rest_data':JSON[_0xd818('0x24')]({'session':_0x91a4c3['id']})}});}function getUser(_0x51c50c,_0x10bf7b,_0x3df254){if(!_[_0xd818('0x2b')](_0x10bf7b)){logger[_0xd818('0xb')](_0xd818('0x2c'),_0x10bf7b);return request({'form':{'method':_0xd818('0x2d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3df254['id'],'module_name':_0xd818('0x2e'),'query':util[_0xd818('0x26')](_0xd818('0x2f'),_0x10bf7b),'order_by':'','offset':'0','select_fields':['id',_0xd818('0xd'),_0xd818('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd818('0x31')](function(_0x519941){if(_0x519941[_0xd818('0x32')]['length']){var _0x4e807b=_[_0xd818('0x33')](_0x519941[_0xd818('0x32')],function(_0x61adb5){return _0x61adb5[_0xd818('0x34')][_0xd818('0x30')][_0xd818('0x35')]===_0x10bf7b;});if(_0x4e807b){logger[_0xd818('0xb')](_0xd818('0x36'));return BPromise[_0xd818('0x37')]({'id':_0x4e807b[_0xd818('0x34')]['id'][_0xd818('0x35')],'name':_0x4e807b['name_value_list'][_0xd818('0xd')]['value']});}}logger[_0xd818('0xb')](_0xd818('0x38'));return BPromise[_0xd818('0x37')]({'id':_0x3df254[_0xd818('0x34')]['user_id'][_0xd818('0x35')],'name':_0x3df254[_0xd818('0x34')][_0xd818('0x30')][_0xd818('0x35')]});});}else{logger[_0xd818('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd818('0x37')]({'id':_0x3df254[_0xd818('0x34')]['user_id'][_0xd818('0x35')],'name':_0x3df254['name_value_list'][_0xd818('0x30')]['value']});}}function getEndUser(_0x196bac,_0x40561c,_0x5dec8f,_0x16b786){logger[_0xd818('0xb')](_0xd818('0x39'),_0x5dec8f);return request({'form':{'method':'get_entry_list','input_type':_0xd818('0x23'),'response_type':_0xd818('0x23'),'rest_data':JSON['stringify']({'session':_0x16b786['id'],'module_name':'Contacts','query':util[_0xd818('0x26')](_0xd818('0x3a'),_0x5dec8f),'order_by':'','offset':'0','select_fields':['id',_0xd818('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd818('0x31')](function(_0xc281eb){if(_0xc281eb[_0xd818('0x32')]['length']){var _0x42b465=_[_0xd818('0x33')](_0xc281eb[_0xd818('0x32')],function(_0x439bf0){return _0x439bf0[_0xd818('0x34')][_0xd818('0x3b')]['value']===_0x5dec8f;});if(_0x42b465){logger[_0xd818('0xb')](_0xd818('0x3c'));return BPromise[_0xd818('0x37')]({'id':_0x42b465[_0xd818('0x34')]['id'][_0xd818('0x35')],'name':_0x42b465['name_value_list'][_0xd818('0xd')][_0xd818('0x35')],'phone':_0x42b465['name_value_list'][_0xd818('0x3b')][_0xd818('0x35')]});}}else{logger[_0xd818('0xb')](_0xd818('0x3d'));return request({'form':{'method':_0xd818('0x22'),'input_type':_0xd818('0x23'),'response_type':_0xd818('0x23'),'rest_data':JSON[_0xd818('0x24')]({'session':_0x16b786['id'],'module_name':_0xd818('0x1c'),'name_value_list':[{'name':'first_name','value':_0x40561c!==''?_0x40561c:util['format'](_0xd818('0x3e'),_0x5dec8f)},{'name':_0xd818('0x3b'),'value':_0x5dec8f}]})}})[_0xd818('0x31')](function(_0x559606){logger[_0xd818('0xb')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x559606['id'],'name':_0x559606[_0xd818('0x32')]['first_name'][_0xd818('0x35')],'phone':_0x559606[_0xd818('0x32')]['phone_home']['value']});});}});}function request(_0x49ab37){logger['debug'](_0xd818('0x3f'),JSON[_0xd818('0x24')](_0x49ab37));return rp(_[_0xd818('0x40')](def,_0x49ab37));}function getTags(_0x2e4b6c,_0x11538b){var _0x15eee8=[];if(_0x2e4b6c&&_0x2e4b6c[_0xd818('0x1f')]>0x0){_0x15eee8=_[_0xd818('0x41')](_0x2e4b6c,_0x11538b);}return _0x15eee8;}function getCustomFields(_0x13f4de,_0x4752dd){var _0x2d7dc4=[];var _0x384c86={'custom_fields':[]};if(_0x13f4de[_0xd818('0x1f')]>0x0){_[_0xd818('0x42')](_0x13f4de,function(_0x3a7824){if(_0x3a7824['type']===_0xd818('0x43')&&_0x3a7824[_0xd818('0x44')]&&!_0x3a7824['customField']){_0x384c86[_0x3a7824['nameField'][_0xd818('0x45')]()]=_0x3a7824[_0xd818('0x46')][_0xd818('0x28')]();}else if(_0x3a7824[_0xd818('0x47')]==='string'&&_0x3a7824[_0xd818('0x48')]&&_0x3a7824[_0xd818('0x49')]){_0x384c86[_0xd818('0x4a')][_0xd818('0x21')]({'id':_0x3a7824[_0xd818('0x48')],'value':_0x3a7824[_0xd818('0x46')][_0xd818('0x28')]()});}else if(_0x3a7824[_0xd818('0x47')]===_0xd818('0x4b')&&_0x3a7824['variableName']&&_0x3a7824[_0xd818('0x48')]&&_0x3a7824[_0xd818('0x49')]){_0x4752dd[_0x3a7824[_0xd818('0x20')]]&&_0x384c86['custom_fields'][_0xd818('0x21')]({'id':_0x3a7824[_0xd818('0x48')],'value':_0x4752dd[_0x3a7824[_0xd818('0x20')]][_0xd818('0x28')]()});}else if(_0x3a7824[_0xd818('0x47')]===_0xd818('0x4c')&&_0x3a7824[_0xd818('0x4d')]&&_0x3a7824[_0xd818('0x4d')]['name']&&_0x3a7824['idField']&&_0x3a7824[_0xd818('0x49')]){_0x4752dd[_0x3a7824[_0xd818('0x4d')]['name'][_0xd818('0x45')]()]&&_0x384c86['custom_fields']['push']({'id':_0x3a7824[_0xd818('0x48')],'value':_0x4752dd[_0x3a7824['Variable'][_0xd818('0xd')][_0xd818('0x45')]()]['toString']()});}});}return _0x384c86;}function getConnection(_0x921427){return request({'method':_0xd818('0x9'),'form':{'method':_0xd818('0x4e'),'input_type':_0xd818('0x23'),'response_type':_0xd818('0x23'),'rest_data':JSON[_0xd818('0x24')]({'user_auth':{'user_name':_0x921427[_0xd818('0x4f')],'password':_0x921427[_0xd818('0x50')],'encryption':_0xd818('0x51')},'application':_0xd818('0x52')})}})[_0xd818('0x31')](function(_0x4688b6){var _0x3a907b=_0x4688b6;if(_0x3a907b['id']){def[_0xd818('0x53')]=_0x3a907b['id'];return BPromise[_0xd818('0x37')](_0x3a907b);}else{throw new Error(util['format'](_0xd818('0x54'),_0x921427['id']));}});}function setRelationship(_0x17da51,_0x1217aa,_0x4aeb4c,_0x2ec6bb){return request({'form':{'method':_0xd818('0x55'),'input_type':_0xd818('0x23'),'response_type':'JSON','rest_data':JSON[_0xd818('0x24')]({'session':_0x17da51['id'],'module_name':'Calls','module_id':_0x4aeb4c['id'],'link_field_name':_0x2ec6bb,'related_ids':[_0x1217aa['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd818('0x56')]=function(_0x201844,_0x402378,_0x1628bf,_0x1bef65,_0x322471,_0x3886d7){var _0x18aaba,_0x50cf8e,_0x27238d,_0x31c0d7;_0x3886d7['remoteUri']=intUtil['stripTrailingSlash'](_0x3886d7[_0xd818('0x57')]);_0x3886d7['serverUrl']=intUtil[_0xd818('0x58')](_0x3886d7['serverUrl']);def[_0xd818('0x59')]=util['format'](_0xd818('0x5a'),_0x3886d7[_0xd818('0x57')]);if(_0x322471&&_0x322471[_0xd818('0x5b')]){logger[_0xd818('0xb')]('[QUEUE]',_0xd818('0x5c'));_0x402378['recordingURL']=util[_0xd818('0x26')](_0xd818('0x5d'),_0x3886d7['serverUrl'],_0x402378[_0xd818('0x5e')],md5(_0x402378[_0xd818('0x5e')]));}else{_0x402378[_0xd818('0x5f')]='';}return getConnection(_0x3886d7)['then'](function(_0x5f5c29){_0x31c0d7=_0x5f5c29;return getUser(_0x3886d7,_0x1bef65['name'],_0x31c0d7);})[_0xd818('0x31')](function(_0x2f885e){_0x18aaba=_0x2f885e;logger[_0xd818('0xb')](_0xd818('0x60'),_0x18aaba['id']);return getEndUser(_0x3886d7,_0x402378[_0xd818('0x61')],_0x402378[_0xd818('0x62')],_0x31c0d7);})[_0xd818('0x31')](function(_0x373c69){_0x50cf8e=_0x373c69;logger['info']('The\x20Enduser\x20ID\x20is:',_0x50cf8e['id']);return getTicket(_0x3886d7,_0x18aaba,_0x50cf8e,_0x1628bf,_0x402378,_0x1628bf[_0xd818('0x63')],_0x31c0d7,_0xd818('0x64'));})['then'](function(_0x3697e8){_0x27238d=_0x3697e8;logger['info'](_0xd818('0x65'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x27238d['id']);return setRelationship(_0x31c0d7,_0x18aaba,_0x27238d,_0xd818('0x66'));})[_0xd818('0x31')](function(){return setRelationship(_0x31c0d7,_0x50cf8e,_0x27238d,'contacts');})[_0xd818('0x31')](function(){return getServerInfo(_0x31c0d7);})['then'](function(_0x320f1c){var _0x2f01d2=parseInt(_0x320f1c[_0xd818('0x67')]['charAt'](0x0));var _0x213e15=util[_0xd818('0x26')](_0xd818('0x68'),_0x3886d7[_0xd818('0x57')],_0x27238d['id']);if(_0x2f01d2>0x6){_0x213e15=util['format'](_0xd818('0x69'),_0x3886d7['remoteUri'],_0x27238d['id']);}logger[_0xd818('0xb')]('[QUEUE]',_0xd818('0x6a'));emit(util[_0xd818('0x26')](_0xd818('0x6b'),_0x1bef65['name']),_0xd818('0x6c'),{'uri':_0x213e15});})['catch'](function(_0xe5461b){logger[_0xd818('0x6d')]('[QUEUE]',JSON[_0xd818('0x24')](_0xe5461b));});};exports[_0xd818('0x6e')]=function(_0x29aedb,_0x3320a7,_0x58a51b,_0x331eef,_0x35a07d,_0x104d1e,_0x5f2180){var _0x3cfb19,_0x25f690,_0x4cc933,_0x27a082;_0x104d1e[_0xd818('0x57')]=intUtil[_0xd818('0x58')](_0x104d1e['remoteUri']);_0x104d1e['serverUrl']=intUtil['stripTrailingSlash'](_0x104d1e[_0xd818('0x6f')]);def[_0xd818('0x59')]=util[_0xd818('0x26')]('%s/service/v4_1/rest.php',_0x104d1e[_0xd818('0x57')]);if(_0x5f2180&&_0x5f2180[_0xd818('0x70')]&&_0x5f2180[_0xd818('0x70')]!==_0xd818('0x71')){logger[_0xd818('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3320a7[_0xd818('0x5f')]=util[_0xd818('0x26')](_0xd818('0x5d'),_0x104d1e[_0xd818('0x6f')],_0x3320a7[_0xd818('0x5e')],md5(_0x3320a7[_0xd818('0x5e')]));}return getConnection(_0x104d1e)[_0xd818('0x31')](function(_0x5c58b0){_0x27a082=_0x5c58b0;return getUser(_0x104d1e,_0x331eef['name'],_0x27a082);})['then'](function(_0x5502ba){_0x3cfb19=_0x5502ba;logger['info'](_0xd818('0x60'),_0x3cfb19['id']);return getEndUser(_0x104d1e,_0x3320a7[_0xd818('0x72')],_0x3320a7[_0xd818('0x73')],_0x27a082);})[_0xd818('0x31')](function(_0x3bd120){_0x25f690=_0x3bd120;logger['info'](_0xd818('0x74'),_0x25f690['id']);return getTicket(_0x104d1e,_0x3cfb19,_0x25f690,_0x58a51b,_0x3320a7,_0x58a51b[_0xd818('0x63')],_0x27a082,_0xd818('0x75'));})[_0xd818('0x31')](function(_0x11e8cd){_0x4cc933=_0x11e8cd;logger[_0xd818('0xb')](_0xd818('0x65'));logger[_0xd818('0xb')](_0xd818('0x76'),_0x4cc933['id']);return setRelationship(_0x27a082,_0x3cfb19,_0x4cc933,_0xd818('0x66'));})['then'](function(){return setRelationship(_0x27a082,_0x25f690,_0x4cc933,_0xd818('0x77'));})['then'](function(){return getServerInfo(_0x27a082);})[_0xd818('0x31')](function(_0xcfeb76){var _0x25aa00=parseInt(_0xcfeb76[_0xd818('0x67')][_0xd818('0x78')](0x0));var _0xc8f816=util[_0xd818('0x26')](_0xd818('0x68'),_0x104d1e['remoteUri'],_0x4cc933['id']);if(_0x25aa00>0x6){_0xc8f816=util[_0xd818('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x104d1e[_0xd818('0x57')],_0x4cc933['id']);}logger[_0xd818('0xb')](_0xd818('0x79'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd818('0x26')](_0xd818('0x6b'),_0x331eef[_0xd818('0xd')]),_0xd818('0x6c'),{'uri':_0xc8f816});})['catch'](function(_0x5567a6){logger[_0xd818('0x6d')](_0xd818('0x79'),JSON['stringify'](_0x5567a6));});};exports[_0xd818('0x7a')]=function(_0x4f2c1a,_0x5d44a1,_0x2946d9,_0x587e05,_0x80a4b1,_0xf7906d){var _0xa10ccd,_0x3a1dcf,_0x10f818,_0x2922f5;_0xf7906d[_0xd818('0x57')]=intUtil[_0xd818('0x58')](_0xf7906d[_0xd818('0x57')]);_0xf7906d[_0xd818('0x6f')]=intUtil['stripTrailingSlash'](_0xf7906d['serverUrl']);def[_0xd818('0x59')]=util['format'](_0xd818('0x5a'),_0xf7906d[_0xd818('0x57')]);if(_0x80a4b1&&_0x80a4b1['monitor_format']){logger[_0xd818('0xb')]('['+_0x5d44a1[_0xd818('0x7b')][_0xd818('0x7c')]()+']',_0xd818('0x5c'));_0x5d44a1['recordingURL']=util[_0xd818('0x26')](_0xd818('0x5d'),_0xf7906d[_0xd818('0x6f')],_0x5d44a1['uniqueid'],md5(_0x5d44a1[_0xd818('0x5e')]));}else{_0x5d44a1[_0xd818('0x5f')]='';}return getConnection(_0xf7906d)[_0xd818('0x31')](function(_0x5d4929){_0x2922f5=_0x5d4929;if(!_[_0xd818('0x2b')](_0x587e05)){return getUser(_0xf7906d,_0x587e05[_0xd818('0xd')],_0x2922f5);}else{return getUser(_0xf7906d,null,_0x2922f5);}})[_0xd818('0x31')](function(_0x1f076a){_0xa10ccd=_0x1f076a;logger[_0xd818('0xb')](_0xd818('0x60'),_0xa10ccd['id']);return getEndUser(_0xf7906d,_0x5d44a1[_0xd818('0x61')],_0x5d44a1[_0xd818('0x62')],_0x2922f5);})['then'](function(_0x39ed94){_0x3a1dcf=_0x39ed94;logger[_0xd818('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3a1dcf['id']);return getTicket(_0xf7906d,_0xa10ccd,_0x3a1dcf,_0x2946d9,_0x5d44a1,_0x2946d9[_0xd818('0x63')],_0x2922f5,_0xd818('0x64'));})[_0xd818('0x31')](function(_0x3cbd53){_0x10f818=_0x3cbd53;logger['info'](_0xd818('0x65'));logger[_0xd818('0xb')](_0xd818('0x76'),_0x10f818['id']);return setRelationship(_0x2922f5,_0xa10ccd,_0x10f818,_0xd818('0x66'));})['then'](function(){return setRelationship(_0x2922f5,_0x3a1dcf,_0x10f818,_0xd818('0x77'));})[_0xd818('0x31')](function(){return getServerInfo(_0x2922f5);})[_0xd818('0x7d')](function(_0x3c4ffb){logger[_0xd818('0x6d')]('['+_0x5d44a1['lastevent']['toUpperCase']()+']',JSON[_0xd818('0x24')](_0x3c4ffb));});}; \ 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 6e34f68..559f1e3 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 _0xc775=['slice','substring','lastIndexOf','isNil','test','util','getString','length','sortBy','string','type','variable','variableName','push','customVariable','Variable','name','toLowerCase','toString','keyValue','key','format','keyType','%s:\x20%s','join','stripTrailingSlash'];(function(_0x154aae,_0x1ea106){var _0x33ebfa=function(_0x56f935){while(--_0x56f935){_0x154aae['push'](_0x154aae['shift']());}};_0x33ebfa(++_0x1ea106);}(_0xc775,0xef));var _0x5c77=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc775[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x5c77('0x0'));exports[_0x5c77('0x1')]=function(_0x2659b7,_0x51ad12,_0x4432d1){var _0x54cc4e=[];if(_0x2659b7[_0x5c77('0x2')]>0x0){var _0x49bc3f=_[_0x5c77('0x3')](_0x2659b7,['id']);for(var _0x167dff=0x0;_0x167dff<_0x49bc3f[_0x5c77('0x2')];_0x167dff++){var _0x4c0c42=_0x49bc3f[_0x167dff];if(_0x4c0c42['type']===_0x5c77('0x4')){_0x54cc4e['push'](_0x4c0c42['content']);}else if(_0x4c0c42[_0x5c77('0x5')]===_0x5c77('0x6')&&_0x4c0c42['variableName']){_0x51ad12[_0x4c0c42[_0x5c77('0x7')]]&&_0x54cc4e[_0x5c77('0x8')](_0x51ad12[_0x4c0c42[_0x5c77('0x7')]]['toString']());}else if(_0x4c0c42[_0x5c77('0x5')]===_0x5c77('0x9')&&_0x4c0c42[_0x5c77('0xa')]&&_0x4c0c42[_0x5c77('0xa')][_0x5c77('0xb')]){_0x51ad12[_0x4c0c42[_0x5c77('0xa')][_0x5c77('0xb')]['toLowerCase']()]&&_0x54cc4e['push'](_0x51ad12[_0x4c0c42[_0x5c77('0xa')][_0x5c77('0xb')][_0x5c77('0xc')]()][_0x5c77('0xd')]());}else if(_0x4c0c42[_0x5c77('0x5')]===_0x5c77('0xe')){if(_0x4c0c42['keyType']===_0x5c77('0x4')&&_0x4c0c42[_0x5c77('0xf')]){_0x54cc4e[_0x5c77('0x8')](util[_0x5c77('0x10')]('%s:\x20%s',_0x4c0c42[_0x5c77('0xf')],_0x4c0c42['keyContent']));}else if(_0x4c0c42[_0x5c77('0x11')]===_0x5c77('0x6')&&_0x4c0c42[_0x5c77('0x7')]&&_0x4c0c42[_0x5c77('0xf')]){_0x51ad12[_0x4c0c42['variableName']]&&_0x54cc4e['push'](util[_0x5c77('0x10')]('%s:\x20%s',_0x4c0c42[_0x5c77('0xf')],_0x51ad12[_0x4c0c42[_0x5c77('0x7')]]));}else if(_0x4c0c42[_0x5c77('0x11')]===_0x5c77('0x9')&&_0x4c0c42[_0x5c77('0xa')]&&_0x4c0c42[_0x5c77('0xa')]['name']&&_0x4c0c42[_0x5c77('0xf')]){_0x51ad12[_0x4c0c42[_0x5c77('0xa')][_0x5c77('0xb')]['toLowerCase']()]&&_0x54cc4e[_0x5c77('0x8')](util[_0x5c77('0x10')](_0x5c77('0x12'),_0x4c0c42['key'],_0x51ad12[_0x4c0c42[_0x5c77('0xa')][_0x5c77('0xb')][_0x5c77('0xc')]()]));}}}}return _0x54cc4e[_0x5c77('0x13')](_0x4432d1);};exports[_0x5c77('0x14')]=function(_0x29f248){var _0x2f60e2=_0x29f248[_0x5c77('0x15')](-0x1);if(_0x2f60e2==='/'){_0x29f248=_0x29f248[_0x5c77('0x16')](0x0,_0x29f248[_0x5c77('0x17')](_0x2f60e2));}return _0x29f248;};exports['validateEmail']=function(_0x4ede50){if(!_[_0x5c77('0x18')](_0x4ede50)&&_0x4ede50!==''){var _0x962042=/^(([^<>()\[\]\\.,;:\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 _0x962042[_0x5c77('0x19')](String(_0x4ede50)[_0x5c77('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x843f=['keyType','key','%s:\x20%s','keyContent','format','join','lastIndexOf','validateEmail','test','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0x3fe260,_0x142428){var _0x55604a=function(_0x4d5ca6){while(--_0x4d5ca6){_0x3fe260['push'](_0x3fe260['shift']());}};_0x55604a(++_0x142428);}(_0x843f,0x167));var _0xf843=function(_0xb39df7,_0x4bc7ed){_0xb39df7=_0xb39df7-0x0;var _0x19c9b6=_0x843f[_0xb39df7];return _0x19c9b6;};'use strict';var _=require(_0xf843('0x0'));var util=require(_0xf843('0x1'));exports[_0xf843('0x2')]=function(_0x4a5128,_0x4ed6af,_0x20b16c){var _0x8ce73=[];if(_0x4a5128[_0xf843('0x3')]>0x0){var _0x16dc97=_[_0xf843('0x4')](_0x4a5128,['id']);for(var _0x7d2bd2=0x0;_0x7d2bd2<_0x16dc97[_0xf843('0x3')];_0x7d2bd2++){var _0x3b7382=_0x16dc97[_0x7d2bd2];if(_0x3b7382[_0xf843('0x5')]===_0xf843('0x6')){_0x8ce73[_0xf843('0x7')](_0x3b7382['content']);}else if(_0x3b7382[_0xf843('0x5')]===_0xf843('0x8')&&_0x3b7382['variableName']){_0x4ed6af[_0x3b7382[_0xf843('0x9')]]&&_0x8ce73[_0xf843('0x7')](_0x4ed6af[_0x3b7382[_0xf843('0x9')]][_0xf843('0xa')]());}else if(_0x3b7382['type']===_0xf843('0xb')&&_0x3b7382[_0xf843('0xc')]&&_0x3b7382['Variable'][_0xf843('0xd')]){_0x4ed6af[_0x3b7382[_0xf843('0xc')][_0xf843('0xd')][_0xf843('0xe')]()]&&_0x8ce73[_0xf843('0x7')](_0x4ed6af[_0x3b7382[_0xf843('0xc')]['name'][_0xf843('0xe')]()][_0xf843('0xa')]());}else if(_0x3b7382[_0xf843('0x5')]===_0xf843('0xf')){if(_0x3b7382[_0xf843('0x10')]===_0xf843('0x6')&&_0x3b7382[_0xf843('0x11')]){_0x8ce73[_0xf843('0x7')](util['format'](_0xf843('0x12'),_0x3b7382['key'],_0x3b7382[_0xf843('0x13')]));}else if(_0x3b7382['keyType']===_0xf843('0x8')&&_0x3b7382['variableName']&&_0x3b7382[_0xf843('0x11')]){_0x4ed6af[_0x3b7382[_0xf843('0x9')]]&&_0x8ce73[_0xf843('0x7')](util[_0xf843('0x14')]('%s:\x20%s',_0x3b7382['key'],_0x4ed6af[_0x3b7382[_0xf843('0x9')]]));}else if(_0x3b7382['keyType']==='customVariable'&&_0x3b7382[_0xf843('0xc')]&&_0x3b7382['Variable'][_0xf843('0xd')]&&_0x3b7382[_0xf843('0x11')]){_0x4ed6af[_0x3b7382[_0xf843('0xc')]['name'][_0xf843('0xe')]()]&&_0x8ce73[_0xf843('0x7')](util[_0xf843('0x14')](_0xf843('0x12'),_0x3b7382[_0xf843('0x11')],_0x4ed6af[_0x3b7382[_0xf843('0xc')]['name'][_0xf843('0xe')]()]));}}}}return _0x8ce73[_0xf843('0x15')](_0x20b16c);};exports['stripTrailingSlash']=function(_0x13b74b){var _0xabceeb=_0x13b74b['slice'](-0x1);if(_0xabceeb==='/'){_0x13b74b=_0x13b74b['substring'](0x0,_0x13b74b[_0xf843('0x16')](_0xabceeb));}return _0x13b74b;};exports[_0xf843('0x17')]=function(_0x180ec6){if(!_['isNil'](_0x180ec6)&&_0x180ec6!==''){var _0x187aa8=/^(([^<>()\[\]\\.,;:\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 _0x187aa8[_0xf843('0x18')](String(_0x180ec6)[_0xf843('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 837afce..366d940 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(_0x3ed720,_0x478e3d){var _0x257fcb=function(_0x3a96b6){while(--_0x3a96b6){_0x3ed720['push'](_0x3ed720['shift']());}};_0x257fcb(++_0x478e3d);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x172581,_0x1c2351){var _0x4b10a9=function(_0x457380){while(--_0x457380){_0x172581['push'](_0x172581['shift']());}};_0x4b10a9(++_0x1c2351);}(_0xe706,0xa3));var _0x6e70=function(_0x4ffafb,_0x20171a){_0x4ffafb=_0x4ffafb-0x0;var _0x4ab472=_0xe706[_0x4ffafb];return _0x4ab472;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 2625f43..b56c9bc 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 _0xa56c=['catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridnum','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','merge','name','getString','Subjects','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','length','filter','end-user','first','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','forEach','string','picklist','nameField','customField','content','includes','custom_fields','push','idField','variable','variableName','type','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error'];(function(_0xca6f18,_0x2adea0){var _0x38495e=function(_0x286939){while(--_0x286939){_0xca6f18['push'](_0xca6f18['shift']());}};_0x38495e(++_0x2adea0);}(_0xa56c,0x1cd));var _0xca56=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xa56c[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0xca56('0x0'));var rp=require(_0xca56('0x1'));var md5=require(_0xca56('0x2'));var util=require(_0xca56('0x3'));var Redis=require(_0xca56('0x4'));var intUtil=require(_0xca56('0x5'));var config=require(_0xca56('0x6'));var logger=require(_0xca56('0x7'))(_0xca56('0x8'));config[_0xca56('0x9')]=_[_0xca56('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xca56('0x9')]));function emit(_0x1df449,_0x4fbe81,_0x4580bf){io['to'](_0x1df449)[_0xca56('0xb')](_0x4fbe81,_0x4580bf);}var headers={'Content-Type':_0xca56('0xc'),'Accept':_0xca56('0xc')};function getTicket(_0x173aec,_0x22810e,_0x4ef59e,_0x3a3922,_0x50ca93){logger[_0xca56('0xd')](_0xca56('0xe'));return request({'uri':util[_0xca56('0xf')](_0xca56('0x10'),_0x173aec['remoteUri']),'method':'POST','body':{'ticket':_[_0xca56('0x11')]({'requester_id':_0x4ef59e['id'],'submitter_id':_0x22810e?_0x22810e['id']:undefined,'assignee_id':_0x22810e?_0x22810e['id']:undefined,'tags':getTags(_0x3a3922['Tags'],_0xca56('0x12')),'subject':intUtil[_0xca56('0x13')](_0x3a3922[_0xca56('0x14')],_0x50ca93,'\x20'),'description':intUtil[_0xca56('0x13')](_0x3a3922[_0xca56('0x15')],_0x50ca93,'\x0a'),'comment':{'public':![],'body':intUtil[_0xca56('0x13')](_0x3a3922['Descriptions'],_0x50ca93,'\x0a')}},getCustomFields(_0x3a3922[_0xca56('0x16')],_0x50ca93))}})[_0xca56('0x17')](function(_0x2e125d){logger[_0xca56('0xd')]('Ticket\x20created!');return _0x2e125d[_0xca56('0x18')];});}function getUser(_0x36e86f,_0x35ccf9){if(intUtil['validateEmail'](_0x35ccf9)){logger[_0xca56('0xd')](_0xca56('0x19'),_0x35ccf9);return request({'uri':util[_0xca56('0xf')](_0xca56('0x1a'),_0x36e86f['remoteUri']),'qs':{'query':util[_0xca56('0xf')](_0xca56('0x1b'),_0x35ccf9)}})[_0xca56('0x17')](function(_0x562add){if(_0x562add['count']){logger[_0xca56('0xd')]('Agent\x20found!');return _[_0xca56('0x1c')](_0x562add['results'],{'email':_0x35ccf9,'role':_0xca56('0x1d')});}else{logger[_0xca56('0xd')](_0xca56('0x1e'));return request({'uri':util[_0xca56('0xf')](_0xca56('0x1f'),_0x36e86f[_0xca56('0x20')])})[_0xca56('0x17')](function(_0x27a687){logger[_0xca56('0xd')](_0xca56('0x21'));return _0x27a687[_0xca56('0x22')];});}});}else{logger[_0xca56('0xd')](_0xca56('0x1e'));return request({'uri':util[_0xca56('0xf')](_0xca56('0x1f'),_0x36e86f[_0xca56('0x20')])})[_0xca56('0x17')](function(_0x4183f4){logger[_0xca56('0xd')](_0xca56('0x21'));return _0x4183f4['user'];});}}function getEndUser(_0x5d8153,_0x82b74a,_0x4cd3ad){logger['info'](_0xca56('0x23'),_0x4cd3ad);return request({'uri':util[_0xca56('0xf')](_0xca56('0x1a'),_0x5d8153[_0xca56('0x20')]),'qs':{'query':util[_0xca56('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x4cd3ad)}})[_0xca56('0x17')](function(_0x2446df){var _0x492c4a;if(_0x2446df[_0xca56('0x24')][_0xca56('0x25')]){_0x2446df[_0xca56('0x24')]=_[_0xca56('0x26')](_0x2446df['results'],{'suspended':![],'role':_0xca56('0x27')});if(_0x2446df[_0xca56('0x24')][_0xca56('0x25')]){_0x492c4a=_[_0xca56('0x28')](_0x2446df[_0xca56('0x24')]);}}if(_0x492c4a){logger['info'](_0xca56('0x29'));return _0x492c4a;}else{logger[_0xca56('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xca56('0xf')](_0xca56('0x2a'),_0x5d8153['remoteUri']),'method':_0xca56('0x2b'),'body':{'user':{'role':_0xca56('0x27'),'name':util[_0xca56('0xf')](_0xca56('0x2c'),_0x82b74a||_0x4cd3ad),'phone':_0x4cd3ad}}})[_0xca56('0x17')](function(_0x375425){logger['info']('Enduser\x20created.');return _0x375425['user'];});}});}function getAuth(_0x2a5e61){var _0x3d5b9a;if(_0x2a5e61['authType']===_0xca56('0x2d')){_0x3d5b9a=util[_0xca56('0xf')](_0xca56('0x2e'),_0x2a5e61[_0xca56('0x2f')],_0x2a5e61[_0xca56('0x2d')]);}else if(_0x2a5e61['authType']===_0xca56('0x30')){_0x3d5b9a=util['format']('%s/token:%s',_0x2a5e61['username'],_0x2a5e61[_0xca56('0x30')]);}return util[_0xca56('0xf')](_0xca56('0x31'),new Buffer(_0x3d5b9a)[_0xca56('0x32')](_0xca56('0x33')));}function request(_0x2b8c35){logger[_0xca56('0x34')](_0xca56('0x35'),JSON[_0xca56('0x36')](_0x2b8c35));return rp(_[_0xca56('0xa')](_0x2b8c35,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x590d93,_0x2b5daf){var _0x5de496=[];if(_0x590d93&&_0x590d93[_0xca56('0x25')]>0x0){_0x5de496=_['map'](_0x590d93,_0x2b5daf);}return _0x5de496;}function getCustomFields(_0x4d69fa,_0x127b01){var _0x2ebd13=[];var _0x48a0ee={'custom_fields':[]};if(_0x4d69fa['length']>0x0){_[_0xca56('0x37')](_0x4d69fa,function(_0xf629b9){if(_['includes']([_0xca56('0x38'),_0xca56('0x39')],_0xf629b9['type'])&&_0xf629b9[_0xca56('0x3a')]&&!_0xf629b9[_0xca56('0x3b')]){_0x48a0ee[_0xf629b9[_0xca56('0x3a')]['toLowerCase']()]=_0xf629b9[_0xca56('0x3c')][_0xca56('0x32')]();}else if(_[_0xca56('0x3d')]([_0xca56('0x38'),_0xca56('0x39')],_0xf629b9['type'])&&_0xf629b9['idField']&&_0xf629b9[_0xca56('0x3b')]){_0x48a0ee[_0xca56('0x3e')][_0xca56('0x3f')]({'id':_0xf629b9[_0xca56('0x40')],'value':_0xf629b9[_0xca56('0x3c')][_0xca56('0x32')]()});}else if(_0xf629b9['type']===_0xca56('0x41')&&_0xf629b9[_0xca56('0x42')]&&_0xf629b9[_0xca56('0x40')]&&_0xf629b9[_0xca56('0x3b')]){_0x127b01[_0xf629b9[_0xca56('0x42')]]&&_0x48a0ee[_0xca56('0x3e')][_0xca56('0x3f')]({'id':_0xf629b9[_0xca56('0x40')],'value':_0x127b01[_0xf629b9['variableName']][_0xca56('0x32')]()});}else if(_0xf629b9[_0xca56('0x43')]===_0xca56('0x44')&&_0xf629b9[_0xca56('0x45')]&&_0xf629b9[_0xca56('0x45')][_0xca56('0x12')]&&_0xf629b9[_0xca56('0x40')]&&_0xf629b9[_0xca56('0x3b')]){_0x127b01[_0xf629b9[_0xca56('0x45')][_0xca56('0x12')]['toLowerCase']()]&&_0x48a0ee[_0xca56('0x3e')]['push']({'id':_0xf629b9['idField'],'value':_0x127b01[_0xf629b9[_0xca56('0x45')][_0xca56('0x12')][_0xca56('0x46')]()][_0xca56('0x32')]()});}});}return _0x48a0ee;}exports[_0xca56('0x47')]=function(_0x40fd08,_0x3e0981,_0x4a3c2c,_0x1bd15a,_0x3b3e95,_0x511b6e){var _0x2f4784,_0x550551;_0x511b6e[_0xca56('0x20')]=intUtil[_0xca56('0x48')](_0x511b6e[_0xca56('0x20')]);_0x511b6e['serverUrl']=intUtil[_0xca56('0x48')](_0x511b6e['serverUrl']);if(_0x3b3e95&&_0x3b3e95[_0xca56('0x49')]){logger['info'](_0xca56('0x4a'),_0xca56('0x4b'));_0x3e0981['recordingURL']=util[_0xca56('0xf')](_0xca56('0x4c'),_0x511b6e[_0xca56('0x4d')],_0x3e0981['uniqueid'],md5(_0x3e0981[_0xca56('0x4e')]));}else{_0x3e0981[_0xca56('0x4f')]='';}headers['Authorization']=getAuth(_0x511b6e);return getUser(_0x511b6e,_0x1bd15a['email'])[_0xca56('0x17')](function(_0x3e04bc){_0x2f4784=_0x3e04bc;logger[_0xca56('0xd')](_0xca56('0x50'),_0x2f4784['id']);return getEndUser(_0x511b6e,_0x3e0981[_0xca56('0x51')],_0x3e0981[_0xca56('0x52')]);})[_0xca56('0x17')](function(_0x1b62ca){_0x550551=_0x1b62ca;logger['info'](_0xca56('0x53'),_0x550551['id']);return getTicket(_0x511b6e,_0x2f4784,_0x550551,_0x4a3c2c,_0x3e0981);})[_0xca56('0x17')](function(_0x3b494b){if(_0x3b494b){logger[_0xca56('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3b494b['id']);switch(_0x511b6e[_0xca56('0x43')]){case _0xca56('0x54'):logger['info'](_0xca56('0x4a'),_0xca56('0x55'));return request({'uri':util[_0xca56('0xf')](_0xca56('0x56'),_0x511b6e[_0xca56('0x20')],_0x2f4784['id'],_0x3b494b['id']),'method':_0xca56('0x2b')});case _0xca56('0x57'):logger['info'](_0xca56('0x4a'),_0xca56('0x58'));emit(util[_0xca56('0xf')]('user:%s',_0x1bd15a['name']),_0xca56('0x59'),{'uri':util['format'](_0xca56('0x5a'),_0x511b6e[_0xca56('0x20')][_0xca56('0x5b')](_0xca56('0x5c'),''),_0x3b494b['id'])});break;default:logger[_0xca56('0x5d')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xca56('0x5e')](function(_0x37542d){logger['error'](_0xca56('0x5f'),util[_0xca56('0x60')](_0x37542d,{'showHidden':!![],'depth':null}));});};exports[_0xca56('0x61')]=function(_0x1c3b53,_0x3e681e,_0x4345a9,_0x42d600,_0xdb9848,_0x3fa31b,_0x102d38){var _0x5a40a9,_0x57f458;_0x3fa31b[_0xca56('0x20')]=intUtil[_0xca56('0x48')](_0x3fa31b[_0xca56('0x20')]);_0x3fa31b['serverUrl']=intUtil[_0xca56('0x48')](_0x3fa31b[_0xca56('0x4d')]);if(_0x102d38&&_0x102d38[_0xca56('0x62')]&&_0x102d38[_0xca56('0x62')]!==_0xca56('0x63')){logger[_0xca56('0xd')](_0xca56('0x64'),_0xca56('0x4b'));_0x3e681e[_0xca56('0x4f')]=util['format'](_0xca56('0x4c'),_0x3fa31b[_0xca56('0x4d')],_0x3e681e[_0xca56('0x4e')],md5(_0x3e681e[_0xca56('0x4e')]));}headers[_0xca56('0x65')]=getAuth(_0x3fa31b);return getUser(_0x3fa31b,_0x42d600[_0xca56('0x66')])['then'](function(_0x58d33){_0x5a40a9=_0x58d33;logger[_0xca56('0xd')](_0xca56('0x50'),_0x5a40a9['id']);return getEndUser(_0x3fa31b,_0x3e681e['destcalleridname'],_0x3e681e[_0xca56('0x67')]);})[_0xca56('0x17')](function(_0x446d86){_0x57f458=_0x446d86;logger[_0xca56('0xd')](_0xca56('0x53'),_0x57f458['id']);return getTicket(_0x3fa31b,_0x5a40a9,_0x57f458,_0x4345a9,_0x3e681e);})['then'](function(_0x13f2ec){if(_0x13f2ec){logger['info']('The\x20Ticket\x20ID\x20is:',_0x13f2ec['id']);switch(_0x3fa31b[_0xca56('0x43')]){case _0xca56('0x54'):logger[_0xca56('0xd')](_0xca56('0x64'),_0xca56('0x55'));return request({'uri':util[_0xca56('0xf')](_0xca56('0x56'),_0x3fa31b['remoteUri'],_0x5a40a9['id'],_0x13f2ec['id']),'method':'POST'});case _0xca56('0x57'):logger[_0xca56('0xd')]('[OUTBOUND]',_0xca56('0x58'));emit(util['format'](_0xca56('0x68'),_0x42d600[_0xca56('0x12')]),_0xca56('0x59'),{'uri':util['format'](_0xca56('0x5a'),_0x3fa31b[_0xca56('0x20')][_0xca56('0x5b')](_0xca56('0x5c'),''),_0x13f2ec['id'])});break;default:logger[_0xca56('0x5d')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xca56('0x5e')](function(_0x165a16){logger[_0xca56('0x5d')](_0xca56('0x69'),util[_0xca56('0x60')](_0x165a16,{'showHidden':!![],'depth':null}));});};exports[_0xca56('0x6a')]=function(_0x534e09,_0x27a0fd,_0xaa41b5,_0x1c8683,_0x5e496e,_0x18600b){var _0x23ec20,_0x412d5b;_0x18600b[_0xca56('0x20')]=intUtil[_0xca56('0x48')](_0x18600b['remoteUri']);_0x18600b['serverUrl']=intUtil[_0xca56('0x48')](_0x18600b[_0xca56('0x4d')]);if(_0x5e496e&&_0x5e496e[_0xca56('0x49')]){logger[_0xca56('0xd')]('['+_0x27a0fd[_0xca56('0x6b')][_0xca56('0x6c')]()+']','Recording\x20is\x20enabled!');_0x27a0fd['recordingURL']=util[_0xca56('0xf')](_0xca56('0x4c'),_0x18600b[_0xca56('0x4d')],_0x27a0fd[_0xca56('0x4e')],md5(_0x27a0fd[_0xca56('0x4e')]));}else{_0x27a0fd[_0xca56('0x4f')]='';}headers[_0xca56('0x65')]=getAuth(_0x18600b);return getUser(_0x18600b)['then'](function(_0x389281){_0x23ec20=_0x389281;logger[_0xca56('0xd')](_0xca56('0x50'),_0x23ec20['id']);return getEndUser(_0x18600b,_0x27a0fd[_0xca56('0x51')],_0x27a0fd[_0xca56('0x52')]);})['then'](function(_0x46b1c6){_0x412d5b=_0x46b1c6;logger[_0xca56('0xd')]('The\x20Enduser\x20ID\x20is:',_0x412d5b['id']);return getTicket(_0x18600b,_0x23ec20,_0x412d5b,_0xaa41b5,_0x27a0fd);})['then'](function(_0x4a3a84){if(_0x4a3a84){logger['info'](_0xca56('0x6d'),_0x4a3a84['id']);}})[_0xca56('0x5e')](function(_0x4ce4fe){logger['error']('['+_0x27a0fd[_0xca56('0x6b')]['toUpperCase']()+']'+_0xca56('0x6e'),util[_0xca56('0x60')](_0x4ce4fe,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2588=['custom_fields','push','variable','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','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','inspect','recordingFormat','none','[OUTBOUND]','Authorization','email','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','Subjects','Descriptions','getString','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Enduser\x20created.','authType','%s:%s','password','token','%s/token:%s','username','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','content','idField'];(function(_0x28edda,_0xbd447a){var _0x21f4a4=function(_0x5ae05e){while(--_0x5ae05e){_0x28edda['push'](_0x28edda['shift']());}};_0x21f4a4(++_0xbd447a);}(_0x2588,0x99));var _0x8258=function(_0x5cb99c,_0x4d325d){_0x5cb99c=_0x5cb99c-0x0;var _0x465e3a=_0x2588[_0x5cb99c];return _0x465e3a;};'use strict';var _=require(_0x8258('0x0'));var rp=require('request-promise');var md5=require(_0x8258('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x8258('0x2'));var config=require(_0x8258('0x3'));var logger=require(_0x8258('0x4'))('zendesk');config[_0x8258('0x5')]=_['defaults'](config[_0x8258('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8258('0x6'))(new Redis(config[_0x8258('0x5')]));function emit(_0x494a17,_0x41da12,_0x533685){io['to'](_0x494a17)[_0x8258('0x7')](_0x41da12,_0x533685);}var headers={'Content-Type':_0x8258('0x8'),'Accept':'application/json'};function getTicket(_0x392f1c,_0x48f5b8,_0x4aade2,_0x130888,_0x1dcdb1){logger[_0x8258('0x9')](_0x8258('0xa'));return request({'uri':util[_0x8258('0xb')](_0x8258('0xc'),_0x392f1c[_0x8258('0xd')]),'method':_0x8258('0xe'),'body':{'ticket':_[_0x8258('0xf')]({'requester_id':_0x4aade2['id'],'submitter_id':_0x48f5b8?_0x48f5b8['id']:undefined,'assignee_id':_0x48f5b8?_0x48f5b8['id']:undefined,'tags':getTags(_0x130888[_0x8258('0x10')],'name'),'subject':intUtil['getString'](_0x130888[_0x8258('0x11')],_0x1dcdb1,'\x20'),'description':intUtil['getString'](_0x130888[_0x8258('0x12')],_0x1dcdb1,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8258('0x13')](_0x130888[_0x8258('0x12')],_0x1dcdb1,'\x0a')}},getCustomFields(_0x130888['Fields'],_0x1dcdb1))}})[_0x8258('0x14')](function(_0x738aae){logger[_0x8258('0x9')](_0x8258('0x15'));return _0x738aae[_0x8258('0x16')];});}function getUser(_0x53bc8e,_0x3bc7bd){if(intUtil[_0x8258('0x17')](_0x3bc7bd)){logger[_0x8258('0x9')](_0x8258('0x18'),_0x3bc7bd);return request({'uri':util[_0x8258('0xb')](_0x8258('0x19'),_0x53bc8e['remoteUri']),'qs':{'query':util[_0x8258('0xb')](_0x8258('0x1a'),_0x3bc7bd)}})['then'](function(_0x3868e5){if(_0x3868e5[_0x8258('0x1b')]){logger['info'](_0x8258('0x1c'));return _[_0x8258('0x1d')](_0x3868e5[_0x8258('0x1e')],{'email':_0x3bc7bd,'role':_0x8258('0x1f')});}else{logger['info'](_0x8258('0x20'));return request({'uri':util[_0x8258('0xb')](_0x8258('0x21'),_0x53bc8e[_0x8258('0xd')])})[_0x8258('0x14')](function(_0x1ce500){logger[_0x8258('0x9')](_0x8258('0x22'));return _0x1ce500[_0x8258('0x23')];});}});}else{logger['info'](_0x8258('0x20'));return request({'uri':util[_0x8258('0xb')]('%s/users/me.json',_0x53bc8e['remoteUri'])})[_0x8258('0x14')](function(_0x4b0d42){logger[_0x8258('0x9')](_0x8258('0x22'));return _0x4b0d42[_0x8258('0x23')];});}}function getEndUser(_0x5a92f9,_0x1a630e,_0x1197f6){logger[_0x8258('0x9')](_0x8258('0x24'),_0x1197f6);return request({'uri':util[_0x8258('0xb')](_0x8258('0x19'),_0x5a92f9[_0x8258('0xd')]),'qs':{'query':util[_0x8258('0xb')]('type:user\x20role:end-user\x20phone:%s',_0x1197f6)}})[_0x8258('0x14')](function(_0xc8e1a2){var _0x49acda;if(_0xc8e1a2[_0x8258('0x1e')]['length']){_0xc8e1a2[_0x8258('0x1e')]=_['filter'](_0xc8e1a2['results'],{'suspended':![],'role':'end-user'});if(_0xc8e1a2[_0x8258('0x1e')][_0x8258('0x25')]){_0x49acda=_['first'](_0xc8e1a2[_0x8258('0x1e')]);}}if(_0x49acda){logger['info']('Enduser\x20found!');return _0x49acda;}else{logger[_0x8258('0x9')](_0x8258('0x26'));return request({'uri':util[_0x8258('0xb')](_0x8258('0x27'),_0x5a92f9[_0x8258('0xd')]),'method':'POST','body':{'user':{'role':_0x8258('0x28'),'name':util[_0x8258('0xb')]('Caller\x20-\x20%s',_0x1a630e||_0x1197f6),'phone':_0x1197f6}}})['then'](function(_0x4ea41f){logger[_0x8258('0x9')](_0x8258('0x29'));return _0x4ea41f['user'];});}});}function getAuth(_0x286003){var _0x2bbbc2;if(_0x286003[_0x8258('0x2a')]==='password'){_0x2bbbc2=util[_0x8258('0xb')](_0x8258('0x2b'),_0x286003['username'],_0x286003[_0x8258('0x2c')]);}else if(_0x286003['authType']===_0x8258('0x2d')){_0x2bbbc2=util['format'](_0x8258('0x2e'),_0x286003[_0x8258('0x2f')],_0x286003[_0x8258('0x2d')]);}return util[_0x8258('0xb')]('Basic\x20%s',new Buffer(_0x2bbbc2)[_0x8258('0x30')](_0x8258('0x31')));}function request(_0x2f127a){logger[_0x8258('0x32')](_0x8258('0x33'),JSON[_0x8258('0x34')](_0x2f127a));return rp(_['defaults'](_0x2f127a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xe5e7e1,_0x478d1a){var _0x2d1e86=[];if(_0xe5e7e1&&_0xe5e7e1[_0x8258('0x25')]>0x0){_0x2d1e86=_[_0x8258('0x35')](_0xe5e7e1,_0x478d1a);}return _0x2d1e86;}function getCustomFields(_0x331dd4,_0x1bb7e6){var _0x163ccb=[];var _0x2aa5a5={'custom_fields':[]};if(_0x331dd4[_0x8258('0x25')]>0x0){_[_0x8258('0x36')](_0x331dd4,function(_0x378195){if(_[_0x8258('0x37')]([_0x8258('0x38'),_0x8258('0x39')],_0x378195[_0x8258('0x3a')])&&_0x378195[_0x8258('0x3b')]&&!_0x378195[_0x8258('0x3c')]){_0x2aa5a5[_0x378195[_0x8258('0x3b')]['toLowerCase']()]=_0x378195[_0x8258('0x3d')]['toString']();}else if(_[_0x8258('0x37')](['string',_0x8258('0x39')],_0x378195['type'])&&_0x378195[_0x8258('0x3e')]&&_0x378195[_0x8258('0x3c')]){_0x2aa5a5[_0x8258('0x3f')][_0x8258('0x40')]({'id':_0x378195[_0x8258('0x3e')],'value':_0x378195[_0x8258('0x3d')]['toString']()});}else if(_0x378195['type']===_0x8258('0x41')&&_0x378195['variableName']&&_0x378195[_0x8258('0x3e')]&&_0x378195[_0x8258('0x3c')]){_0x1bb7e6[_0x378195['variableName']]&&_0x2aa5a5[_0x8258('0x3f')][_0x8258('0x40')]({'id':_0x378195['idField'],'value':_0x1bb7e6[_0x378195[_0x8258('0x42')]][_0x8258('0x30')]()});}else if(_0x378195['type']===_0x8258('0x43')&&_0x378195['Variable']&&_0x378195[_0x8258('0x44')]['name']&&_0x378195['idField']&&_0x378195[_0x8258('0x3c')]){_0x1bb7e6[_0x378195[_0x8258('0x44')][_0x8258('0x45')][_0x8258('0x46')]()]&&_0x2aa5a5['custom_fields'][_0x8258('0x40')]({'id':_0x378195[_0x8258('0x3e')],'value':_0x1bb7e6[_0x378195[_0x8258('0x44')][_0x8258('0x45')][_0x8258('0x46')]()][_0x8258('0x30')]()});}});}return _0x2aa5a5;}exports[_0x8258('0x47')]=function(_0x3c02f6,_0x336a7e,_0x25b5ca,_0x345755,_0x380a95,_0x495ef8){var _0x10377d,_0x310772;_0x495ef8[_0x8258('0xd')]=intUtil[_0x8258('0x48')](_0x495ef8[_0x8258('0xd')]);_0x495ef8[_0x8258('0x49')]=intUtil[_0x8258('0x48')](_0x495ef8['serverUrl']);if(_0x380a95&&_0x380a95[_0x8258('0x4a')]){logger[_0x8258('0x9')](_0x8258('0x4b'),_0x8258('0x4c'));_0x336a7e[_0x8258('0x4d')]=util['format'](_0x8258('0x4e'),_0x495ef8[_0x8258('0x49')],_0x336a7e[_0x8258('0x4f')],md5(_0x336a7e['uniqueid']));}else{_0x336a7e[_0x8258('0x4d')]='';}headers['Authorization']=getAuth(_0x495ef8);return getUser(_0x495ef8,_0x345755['email'])[_0x8258('0x14')](function(_0x196417){_0x10377d=_0x196417;logger[_0x8258('0x9')](_0x8258('0x50'),_0x10377d['id']);return getEndUser(_0x495ef8,_0x336a7e[_0x8258('0x51')],_0x336a7e[_0x8258('0x52')]);})['then'](function(_0x1b3817){_0x310772=_0x1b3817;logger[_0x8258('0x9')](_0x8258('0x53'),_0x310772['id']);return getTicket(_0x495ef8,_0x10377d,_0x310772,_0x25b5ca,_0x336a7e);})[_0x8258('0x14')](function(_0x52e6d4){if(_0x52e6d4){logger[_0x8258('0x9')](_0x8258('0x54'),_0x52e6d4['id']);switch(_0x495ef8[_0x8258('0x3a')]){case'integrationTab':logger[_0x8258('0x9')](_0x8258('0x4b'),_0x8258('0x55'));return request({'uri':util['format'](_0x8258('0x56'),_0x495ef8['remoteUri'],_0x10377d['id'],_0x52e6d4['id']),'method':_0x8258('0xe')});case'newTab':logger[_0x8258('0x9')](_0x8258('0x4b'),_0x8258('0x57'));emit(util[_0x8258('0xb')](_0x8258('0x58'),_0x345755[_0x8258('0x45')]),_0x8258('0x59'),{'uri':util[_0x8258('0xb')](_0x8258('0x5a'),_0x495ef8[_0x8258('0xd')][_0x8258('0x5b')](_0x8258('0x5c'),''),_0x52e6d4['id'])});break;default:logger['error']('[QUEUE]',_0x8258('0x5d'));}}})[_0x8258('0x5e')](function(_0x2e7402){logger[_0x8258('0x5f')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x8258('0x60')](_0x2e7402,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4246aa,_0x41c0d0,_0x528f9e,_0x1d0cc3,_0x47a588,_0x460d54,_0x234ba3){var _0x36cef0,_0x4332f0;_0x460d54[_0x8258('0xd')]=intUtil[_0x8258('0x48')](_0x460d54[_0x8258('0xd')]);_0x460d54[_0x8258('0x49')]=intUtil[_0x8258('0x48')](_0x460d54['serverUrl']);if(_0x234ba3&&_0x234ba3[_0x8258('0x61')]&&_0x234ba3['recordingFormat']!==_0x8258('0x62')){logger['info'](_0x8258('0x63'),'Recording\x20is\x20enabled!');_0x41c0d0[_0x8258('0x4d')]=util[_0x8258('0xb')](_0x8258('0x4e'),_0x460d54[_0x8258('0x49')],_0x41c0d0[_0x8258('0x4f')],md5(_0x41c0d0[_0x8258('0x4f')]));}headers[_0x8258('0x64')]=getAuth(_0x460d54);return getUser(_0x460d54,_0x1d0cc3[_0x8258('0x65')])[_0x8258('0x14')](function(_0x28983c){_0x36cef0=_0x28983c;logger[_0x8258('0x9')](_0x8258('0x50'),_0x36cef0['id']);return getEndUser(_0x460d54,_0x41c0d0['destcalleridname'],_0x41c0d0['destcalleridnum']);})[_0x8258('0x14')](function(_0x15c17a){_0x4332f0=_0x15c17a;logger[_0x8258('0x9')](_0x8258('0x53'),_0x4332f0['id']);return getTicket(_0x460d54,_0x36cef0,_0x4332f0,_0x528f9e,_0x41c0d0);})[_0x8258('0x14')](function(_0x46eea8){if(_0x46eea8){logger[_0x8258('0x9')](_0x8258('0x54'),_0x46eea8['id']);switch(_0x460d54[_0x8258('0x3a')]){case'integrationTab':logger[_0x8258('0x9')](_0x8258('0x63'),_0x8258('0x55'));return request({'uri':util[_0x8258('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x460d54[_0x8258('0xd')],_0x36cef0['id'],_0x46eea8['id']),'method':_0x8258('0xe')});case _0x8258('0x66'):logger[_0x8258('0x9')]('[OUTBOUND]',_0x8258('0x57'));emit(util[_0x8258('0xb')](_0x8258('0x58'),_0x1d0cc3['name']),'trigger:browser:url',{'uri':util[_0x8258('0xb')](_0x8258('0x5a'),_0x460d54[_0x8258('0xd')][_0x8258('0x5b')](_0x8258('0x5c'),''),_0x46eea8['id'])});break;default:logger[_0x8258('0x5f')](_0x8258('0x63'),_0x8258('0x5d'));}}})[_0x8258('0x5e')](function(_0x4b571b){logger['error'](_0x8258('0x67'),util[_0x8258('0x60')](_0x4b571b,{'showHidden':!![],'depth':null}));});};exports[_0x8258('0x68')]=function(_0x3ca6ea,_0x29ecd8,_0x5ee488,_0x418ffa,_0x759d3b,_0x490013){var _0x3d508f,_0x219e93;_0x490013['remoteUri']=intUtil[_0x8258('0x48')](_0x490013['remoteUri']);_0x490013[_0x8258('0x49')]=intUtil[_0x8258('0x48')](_0x490013[_0x8258('0x49')]);if(_0x759d3b&&_0x759d3b['monitor_format']){logger[_0x8258('0x9')]('['+_0x29ecd8[_0x8258('0x69')]['toUpperCase']()+']',_0x8258('0x4c'));_0x29ecd8[_0x8258('0x4d')]=util[_0x8258('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x490013[_0x8258('0x49')],_0x29ecd8[_0x8258('0x4f')],md5(_0x29ecd8[_0x8258('0x4f')]));}else{_0x29ecd8[_0x8258('0x4d')]='';}headers[_0x8258('0x64')]=getAuth(_0x490013);return getUser(_0x490013)[_0x8258('0x14')](function(_0x1f7e11){_0x3d508f=_0x1f7e11;logger['info'](_0x8258('0x50'),_0x3d508f['id']);return getEndUser(_0x490013,_0x29ecd8[_0x8258('0x51')],_0x29ecd8['calleridnum']);})['then'](function(_0x1a29eb){_0x219e93=_0x1a29eb;logger[_0x8258('0x9')]('The\x20Enduser\x20ID\x20is:',_0x219e93['id']);return getTicket(_0x490013,_0x3d508f,_0x219e93,_0x5ee488,_0x29ecd8);})[_0x8258('0x14')](function(_0x4dc391){if(_0x4dc391){logger[_0x8258('0x9')](_0x8258('0x54'),_0x4dc391['id']);}})[_0x8258('0x5e')](function(_0x5c6459){logger[_0x8258('0x5f')]('['+_0x29ecd8['lastevent'][_0x8258('0x6a')]()+']'+_0x8258('0x6b'),util[_0x8258('0x60')](_0x5c6459,{'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 6951675..aa42663 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 _0x6400=['queue','host','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','user:%s','unmanaged','monitor_format','lastevent','toUpperCase','lodash','md5','moment','ioredis','bluebird','../../../../config/environment','zoho','defaults','redis','localhost','socket.io-emitter','debug','stringify','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','email','Agent\x20found!','findIndex','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err'];(function(_0x2f4a7e,_0x4931f2){var _0xacf4a3=function(_0x217d9a){while(--_0x217d9a){_0x2f4a7e['push'](_0x2f4a7e['shift']());}};_0xacf4a3(++_0x4931f2);}(_0x6400,0x1ee));var _0x0640=function(_0x29631f,_0xdb767){_0x29631f=_0x29631f-0x0;var _0x486d87=_0x6400[_0x29631f];return _0x486d87;};'use strict';var _=require(_0x0640('0x0'));var rp=require('request-promise');var md5=require(_0x0640('0x1'));var util=require('util');var intUtil=require('./util');var moment=require(_0x0640('0x2'));var Redis=require(_0x0640('0x3'));var BPromise=require(_0x0640('0x4'));var config=require(_0x0640('0x5'));var logger=require('../../../../config/logger')(_0x0640('0x6'));config['redis']=_[_0x0640('0x7')](config[_0x0640('0x8')],{'host':_0x0640('0x9'),'port':0x18eb});var io=require(_0x0640('0xa'))(new Redis(config[_0x0640('0x8')]));function emit(_0x17655d,_0x36f68b,_0x5cb107){io['to'](_0x17655d)['emit'](_0x36f68b,_0x5cb107);}function request(_0x429bfc){logger[_0x0640('0xb')]('[HTTP]',JSON[_0x0640('0xc')](_0x429bfc));return rp(_0x429bfc);}function getCustomFields(_0xb83ba3,_0x21ec6b){var _0x2d32f5={};if(_0xb83ba3['length']>0x0){_['forEach'](_0xb83ba3,function(_0x378f75){if(_[_0x0640('0xd')]([_0x0640('0xe'),_0x0640('0xf')],_0x378f75[_0x0640('0x10')])&&_0x378f75[_0x0640('0x11')]){_0x2d32f5[_0x378f75['idField']]=_0x378f75['content'][_0x0640('0x12')]();}else if(_0x378f75[_0x0640('0x10')]===_0x0640('0x13')&&_0x378f75[_0x0640('0x14')]&&_0x378f75['idField']&&_0x21ec6b[_0x378f75[_0x0640('0x14')]]){_0x2d32f5[_0x378f75['idField']]=_0x21ec6b[_0x378f75[_0x0640('0x14')]]['toString']();}else if(_0x378f75[_0x0640('0x10')]===_0x0640('0x15')&&_0x378f75[_0x0640('0x16')]&&_0x378f75[_0x0640('0x16')][_0x0640('0x17')]&&_0x378f75[_0x0640('0x11')]&&_0x21ec6b[_0x378f75[_0x0640('0x16')][_0x0640('0x17')][_0x0640('0x18')]()]){_0x2d32f5[_0x378f75[_0x0640('0x11')]]=_0x21ec6b[_0x378f75['Variable'][_0x0640('0x17')][_0x0640('0x18')]()][_0x0640('0x12')]();}});}return _0x2d32f5;}function getName(_0xa01af1){if(_0xa01af1[_0x0640('0x19')]('\x20')>0x0){var _0x532fb0=_0xa01af1[_0x0640('0x1a')](/ (.+)/);if(_0x532fb0[0x1]){return _0x532fb0;}}return[_0xa01af1,_0xa01af1];}var accountsTokens={};function getAccessToken(_0x2ac318){return new Promise(function(_0x585b0b,_0xfee098){if(!_[_0x0640('0x1b')](accountsTokens[_0x2ac318['id']])&&!_[_0x0640('0x1b')](accountsTokens[_0x2ac318['id']][_0x0640('0x1c')])){if(moment()[_0x0640('0x1d')](accountsTokens[_0x2ac318['id']][_0x0640('0x1e')])){_0x585b0b(accountsTokens[_0x2ac318['id']][_0x0640('0x1c')]);}}var _0x1a94e1;switch(_0x2ac318[_0x0640('0x1f')]){case'US':_0x1a94e1='https://accounts.zoho.com';break;case'AU':_0x1a94e1=_0x0640('0x20');break;case'EU':_0x1a94e1=_0x0640('0x21');break;case'IN':_0x1a94e1=_0x0640('0x22');break;case'CN':_0x1a94e1=_0x0640('0x23');break;default:_0x1a94e1=_0x0640('0x21');break;}var _0x1d0b3c={'method':_0x0640('0x24'),'uri':_0x1a94e1+_0x0640('0x25'),'qs':{'refresh_token':_0x2ac318[_0x0640('0x26')],'client_id':_0x2ac318[_0x0640('0x27')],'client_secret':_0x2ac318['clientSecret'],'grant_type':_0x0640('0x28')},'json':!![]};return rp(_0x1d0b3c)[_0x0640('0x29')](function(_0x2e995b){accountsTokens[_0x2ac318['id']]={'access_token':_0x2e995b[_0x0640('0x1c')],'expires_in':moment()[_0x0640('0x2a')](_0x2e995b[_0x0640('0x1e')],_0x0640('0x2b'))};_0x585b0b(_0x2e995b[_0x0640('0x1c')]);})[_0x0640('0x2c')](function(_0x5e619e){logger[_0x0640('0x2d')](_0x0640('0x2e'),_0x5e619e[_0x0640('0x2f')]);_0xfee098(_0x5e619e);});});}function getUser(_0x143457,_0x415dd9,_0x5b278a,_0x31e27c){logger[_0x0640('0x30')]('Search\x20user');return request({'method':_0x0640('0x31'),'uri':util[_0x0640('0x32')](_0x0640('0x33'),_0x415dd9),'qs':{'type':_0x0640('0x34')},'headers':{'Authorization':_0x0640('0x35')+_0x143457},'json':!![]})['then'](function(_0x42919a){if(_0x42919a[_0x0640('0x36')]){var _0x135beb=-0x1;if(_['isArrayLikeObject'](_0x42919a[_0x0640('0x36')])){if(!_[_0x0640('0x1b')](_0x31e27c)){_0x135beb=_['findIndex'](_0x42919a[_0x0640('0x36')],function(_0x125950){return _0x125950[_0x0640('0x37')]===_0x31e27c;});}if(_0x135beb>=0x0){logger[_0x0640('0x30')](_0x0640('0x38'));}else{logger[_0x0640('0x30')]('Using\x20the\x20admin\x20account!');_0x135beb=_[_0x0640('0x39')](_0x42919a[_0x0640('0x36')],function(_0x2bf89b){return _0x2bf89b[_0x0640('0x3a')][_0x0640('0x17')]===_0x0640('0x3b');});}return _0x42919a[_0x0640('0x36')][_0x135beb];}else{if(_0x42919a[_0x0640('0x3c')]['profile']['name']===_0x0640('0x3b')){logger['info'](_0x0640('0x3d'));user=_0x42919a['user'];return user;}else{logger[_0x0640('0x2d')](_0x0640('0x3e'),JSON[_0x0640('0xc')](_0x42919a));throw new Error(_0x0640('0x3f')+JSON[_0x0640('0xc')](_0x42919a));}}}else{logger['error'](_0x0640('0x3e'),JSON[_0x0640('0xc')](_0x42919a));throw new Error(_0x0640('0x3f')+JSON[_0x0640('0xc')](_0x42919a));}})[_0x0640('0x2c')](function(_0x38fce9){console[_0x0640('0x2d')](_0x38fce9);});}function getZohoUser(_0x15a6d7,_0x274e75){return new BPromise(function(_0xaf19c,_0x396abc){request(_0x15a6d7)[_0x0640('0x29')](function(_0xb97a51){var _0x42420=null;if(_0xb97a51){_0x42420=_0xb97a51[_0x0640('0x40')][0x0];_0x42420[_0x0640('0x41')]=_0x274e75;}_0xaf19c(_0x42420);})[_0x0640('0x2c')](function(_0x47cc8b){_0x396abc(_0x47cc8b);});});}function createEndUser(_0x2c7a48,_0x230f9c,_0x1035ba,_0xac4da4,_0x4e2dd3,_0x3c24b9){var _0x1035ba=getName(_0x1035ba);return request({'method':'POST','uri':_0x0640('0x42')+_0x230f9c+_0x0640('0x43')+_[_0x0640('0x44')](_0x3c24b9['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1035ba[0x1],'First_Name':_0x1035ba[0x0],'Phone':_0xac4da4,'Owner':{'name':!_[_0x0640('0x1b')](_0x4e2dd3[_0x0640('0x45')][_0x0640('0x17')])?_0x4e2dd3[_0x0640('0x45')][_0x0640('0x17')]:!_[_0x0640('0x1b')](_0x4e2dd3[_0x0640('0x46')])?_0x4e2dd3['first_name']+'\x20'+_0x4e2dd3['last_name']:_0x4e2dd3[_0x0640('0x47')],'id':_0x4e2dd3['id']}}]},'headers':{'Authorization':_0x0640('0x35')+_0x2c7a48},'json':!![]})[_0x0640('0x29')](function(_0x90dad3){if(_0x90dad3&&_0x90dad3[_0x0640('0x40')][0x0]['code']===_0x0640('0x48')){var _0x4b92b2=_0x90dad3[_0x0640('0x40')][0x0][_0x0640('0x49')];_0x4b92b2[_0x0640('0x41')]=_[_0x0640('0x44')](_0x3c24b9[_0x0640('0x4a')])+'s';return _0x4b92b2;}logger[_0x0640('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x0640('0xc')](data));throw new Error(_0x0640('0x4b')+JSON['stringify'](data));})[_0x0640('0x2c')](function(_0x1fa790){console[_0x0640('0x4c')](_0x0640('0x4d'),_0x1fa790);});}function getEndUser(_0x2a84c2,_0x5f04a5,_0x6bb27a,_0x23c007,_0x5e8e58,_0x24cd4e,_0x1d008c){var _0x187074={'method':_0x0640('0x31'),'uri':'','headers':{'Authorization':_0x0640('0x35')+_0x2a84c2},'json':!![]};switch(_0x1d008c[_0x0640('0x4e')]){case'contact_lead':_0x187074['uri']=_0x0640('0x42')+_0x5f04a5+_0x0640('0x4f')+_0x5e8e58+'))';return getZohoUser(_0x187074,_0x0640('0x50'))[_0x0640('0x29')](function(_0x20f1c4){if(_0x20f1c4)return _0x20f1c4;_0x187074[_0x0640('0x51')]=_0x0640('0x42')+_0x5f04a5+_0x0640('0x52')+_0x5e8e58+'))';return getZohoUser(_0x187074,'Leads')[_0x0640('0x29')](function(_0x17cbda){if(_0x17cbda)return _0x17cbda;if(_0x1d008c[_0x0640('0x4a')]!=_0x0640('0x53')){return createEndUser(_0x2a84c2,_0x5f04a5,_0x23c007,_0x5e8e58,_0x24cd4e,_0x1d008c);}else{return{};}});});break;case _0x0640('0x54'):_0x187074[_0x0640('0x51')]=_0x0640('0x42')+_0x5f04a5+_0x0640('0x4f')+_0x5e8e58+'))';return getZohoUser(_0x187074,_0x0640('0x50'))[_0x0640('0x29')](function(_0x150819){if(_0x150819)return _0x150819;if(_0x1d008c[_0x0640('0x4a')]!=_0x0640('0x53')){return createEndUser(_0x2a84c2,_0x5f04a5,_0x23c007,_0x5e8e58,_0x24cd4e,_0x1d008c);}else{return{};}});break;case _0x0640('0x55'):_0x187074[_0x0640('0x51')]=_0x0640('0x42')+_0x5f04a5+_0x0640('0x52')+_0x5e8e58+'))';return getZohoUser(_0x187074,_0x0640('0x56'))[_0x0640('0x29')](function(_0x2857f0){if(_0x2857f0)return _0x2857f0;if(_0x1d008c[_0x0640('0x4a')]!=_0x0640('0x53')){return createEndUser(_0x2a84c2,_0x5f04a5,_0x23c007,_0x5e8e58,_0x24cd4e,_0x1d008c);}else{return{};}});break;}}function getCall(_0x272517,_0x59ab7a,_0x115b2e,_0x57a351,_0x461e7a,_0x30cc34,_0xe6ea5c,_0xd5cf5){logger[_0x0640('0x30')](_0x0640('0x57'));var _0xa9891d={};_0xa9891d[_0x0640('0x58')]={'name':!_[_0x0640('0x1b')](_0x57a351['role'][_0x0640('0x17')])&&!_['isNil'](_0x57a351[_0x0640('0x3a')][_0x0640('0x17')])&&_0x57a351['profile'][_0x0640('0x17')]===_0x0640('0x59')?_0x57a351['role'][_0x0640('0x17')]:!_[_0x0640('0x1b')](_0x57a351[_0x0640('0x46')])?_0x57a351['first_name']+'\x20'+_0x57a351['last_name']:_0x57a351[_0x0640('0x47')],'id':_0x57a351['id']};_0xa9891d['Subject']=intUtil[_0x0640('0x5a')](_0x30cc34[_0x0640('0x5b')],_0xe6ea5c,'\x20');_0xa9891d[_0x0640('0x5c')]=intUtil[_0x0640('0x5a')](_0x30cc34[_0x0640('0x5d')],_0xe6ea5c,'\x0a');if(_0x461e7a[_0x0640('0x41')]===_0x0640('0x50')){_0xa9891d[_0x0640('0x5e')]={'name':!_[_0x0640('0x1b')](_0x461e7a[_0x0640('0x5f')])?_0x461e7a[_0x0640('0x5f')]:!_['isNil'](_0x461e7a[_0x0640('0x60')])?_0x461e7a[_0x0640('0x60')]+'\x20'+_0x461e7a[_0x0640('0x61')]:_0x461e7a[_0x0640('0x61')],'id':_0x461e7a['id']};}if(_0x461e7a['enduserType']==='Leads'){_0xa9891d[_0x0640('0x62')]={'name':!_[_0x0640('0x1b')](_0x461e7a[_0x0640('0x5f')])?_0x461e7a[_0x0640('0x5f')]:!_['isNil'](_0x461e7a['First_Name'])?_0x461e7a[_0x0640('0x60')]+'\x20'+_0x461e7a[_0x0640('0x61')]:_0x461e7a[_0x0640('0x61')],'id':_0x461e7a['id']};_0xa9891d['$se_module']=_[_0x0640('0x44')](_0x461e7a[_0x0640('0x41')]);}if(_0xe6ea5c[_0x0640('0x63')]){_0xa9891d[_0x0640('0x64')]=moment[_0x0640('0x65')](parseInt(_0xe6ea5c[_0x0640('0x63')])*0x3e8)[_0x0640('0x32')](_0x0640('0x66'));}else if(_0xe6ea5c['answertime']&&_0xe6ea5c[_0x0640('0x67')]){_0xa9891d[_0x0640('0x64')]=moment[_0x0640('0x65')](moment(_0xe6ea5c['endtime'],_0x0640('0x68'))[_0x0640('0x69')](moment(_0xe6ea5c['starttime'],_0x0640('0x68'))))['format']('mm:ss');}switch(_0xe6ea5c['lastevent']){case _0x0640('0x6a'):_0xa9891d[_0x0640('0x6b')]=_0x0640('0x6c');break;case _0x0640('0x6d'):case _0x0640('0x6e'):_0xa9891d['Call_Result']=_0x0640('0x6f');break;case _0x0640('0x70'):_0xa9891d['Call_Result']=_0x0640('0x71');break;case'abandoned':_0xa9891d[_0x0640('0x6b')]=_0x0640('0x72');break;case _0x0640('0x73'):_0xa9891d[_0x0640('0x6b')]='Timeout';default:}_0xa9891d[_0x0640('0x74')]=(_0xd5cf5===_0x0640('0x75')?moment(_0xe6ea5c[_0x0640('0x76')])['format'](_0x0640('0x68')):moment(_0xe6ea5c[_0x0640('0x77')])[_0x0640('0x32')](_0x0640('0x68')))||moment()[_0x0640('0x32')](_0x0640('0x68'));_0xa9891d[_0x0640('0x78')]=_0xd5cf5||_0x0640('0x79');_0xa9891d=_[_0x0640('0x7a')](_0xa9891d,getCustomFields(_0x30cc34['Fields'],_0xe6ea5c));return request({'method':'POST','uri':_0x0640('0x42')+_0x59ab7a+_0x0640('0x7b'),'headers':{'Authorization':_0x0640('0x35')+_0x272517},'body':{'data':[_0xa9891d]},'json':!![]})[_0x0640('0x29')](function(_0xfb1600){if(_0xfb1600&&_0xfb1600[_0x0640('0x40')][0x0]['code']===_0x0640('0x48')){logger[_0x0640('0x30')](_0x0640('0x7c'));return{'id':_0xfb1600[_0x0640('0x40')][0x0][_0x0640('0x49')]['id']};}})['catch'](function(_0x460aba){logger[_0x0640('0x30')]('err',_0x460aba[_0x0640('0x2f')]);console[_0x0640('0x4c')](_0x0640('0x7d'),_0x460aba);});}exports[_0x0640('0x7e')]=function(_0x3fce20,_0x1816df,_0x5b0d21,_0x25286b,_0x1d3543,_0x40175b){var _0x4d729d,_0x657ec8,_0x4f3bee;_0x40175b[_0x0640('0x7f')]=intUtil[_0x0640('0x80')](_0x40175b[_0x0640('0x7f')]);_0x40175b[_0x0640('0x81')]=intUtil['stripTrailingSlash'](_0x40175b['serverUrl']);if(_0x1d3543&&_0x1d3543['monitor_format']){logger[_0x0640('0x30')](_0x0640('0x82'),'Recording\x20is\x20enabled!');_0x1816df[_0x0640('0x83')]=_0x40175b[_0x0640('0x81')]+'/api/voice/recordings/'+_0x1816df[_0x0640('0x84')]+_0x0640('0x85')+md5(_0x1816df[_0x0640('0x84')]);}else{_0x1816df[_0x0640('0x83')]='';}var _0x12736a=_0x40175b[_0x0640('0x7f')]===_0x0640('0x86')?'eu':_0x0640('0x87');return getAccessToken(_0x40175b)['then'](function(_0x17a1b4){_0x4f3bee=_0x17a1b4;return getUser(_0x4f3bee,_0x12736a,_0x40175b,_0x25286b['email']);})[_0x0640('0x29')](function(_0x559d03){_0x4d729d=_0x559d03;logger[_0x0640('0x30')]('The\x20User\x20ID\x20is:',_0x4d729d['id']);return getEndUser(_0x4f3bee,_0x12736a,_0x40175b,_0x1816df[_0x0640('0x88')],_0x1816df['calleridnum'],_0x4d729d,_0x5b0d21);})['then'](function(_0x3b8952){_0x657ec8=_0x3b8952;return getCall(_0x4f3bee,_0x12736a,_0x40175b,_0x4d729d,_0x657ec8,_0x5b0d21,_0x1816df,_0x0640('0x79'));})['then'](function(_0x5030e4){if(_0x5030e4){logger['info'](_0x0640('0x89'),_0x5030e4['id']);logger['info'](_0x0640('0x82'),_0x0640('0x8a'));emit(util[_0x0640('0x32')]('user:%s',_0x25286b[_0x0640('0x17')]),_0x0640('0x8b'),{'uri':_0x0640('0x8c')+_0x40175b['host']+_0x0640('0x8d')+_0x5030e4['id']});}})[_0x0640('0x2c')](function(_0x36a86c){logger[_0x0640('0x2d')]('[QUEUE]',JSON[_0x0640('0xc')](_0x36a86c));});};exports['outbound']=function(_0x24b218,_0x31e7df,_0x25ac29,_0xe0e093,_0x427e6b,_0x4466d4,_0x20ed55){var _0x518609,_0x514141,_0x5c1f26;_0x4466d4[_0x0640('0x7f')]=intUtil[_0x0640('0x80')](_0x4466d4['host']);_0x4466d4[_0x0640('0x81')]=intUtil[_0x0640('0x80')](_0x4466d4['serverUrl']);if(_0x20ed55&&_0x20ed55[_0x0640('0x8e')]&&_0x20ed55[_0x0640('0x8e')]!=='none'){logger['info'](_0x0640('0x8f'),_0x0640('0x90'));_0x31e7df[_0x0640('0x83')]=_0x4466d4[_0x0640('0x81')]+_0x0640('0x91')+_0x31e7df['uniqueid']+_0x0640('0x85')+md5(_0x31e7df[_0x0640('0x84')]);}var _0x1b65a8=_0x4466d4[_0x0640('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x4466d4)[_0x0640('0x29')](function(_0x2ab18e){_0x5c1f26=_0x2ab18e;return getUser(_0x5c1f26,_0x1b65a8,_0x4466d4,_0xe0e093['email']);})[_0x0640('0x29')](function(_0x24dfec){_0x518609=_0x24dfec;logger[_0x0640('0x30')](_0x0640('0x92'),_0x518609['id']);return getEndUser(_0x5c1f26,_0x1b65a8,_0x4466d4,_0x31e7df[_0x0640('0x93')],_0x31e7df[_0x0640('0x94')],_0x518609,_0x25ac29);})[_0x0640('0x29')](function(_0x2116a4){_0x514141=_0x2116a4;return getCall(_0x5c1f26,_0x1b65a8,_0x4466d4,_0x518609,_0x514141,_0x25ac29,_0x31e7df,_0x0640('0x95'));})[_0x0640('0x29')](function(_0x3bcd20){if(_0x3bcd20){logger[_0x0640('0x30')](_0x0640('0x89'),_0x3bcd20['id']);logger[_0x0640('0x30')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x0640('0x96'),_0xe0e093[_0x0640('0x17')]),_0x0640('0x8b'),{'uri':'https://crm.'+_0x4466d4[_0x0640('0x7f')]+_0x0640('0x8d')+_0x3bcd20['id']});}})[_0x0640('0x2c')](function(_0x30b6f5){logger['error'](_0x0640('0x8f'),JSON[_0x0640('0xc')](_0x30b6f5));});};exports[_0x0640('0x97')]=function(_0x22ca9b,_0x271312,_0x5afbac,_0x192072,_0x575485,_0x4ebd13){var _0x479d0f,_0x436f4e,_0x32c1ac;_0x4ebd13[_0x0640('0x7f')]=intUtil['stripTrailingSlash'](_0x4ebd13[_0x0640('0x7f')]);_0x4ebd13['serverUrl']=intUtil[_0x0640('0x80')](_0x4ebd13[_0x0640('0x81')]);if(_0x575485&&_0x575485[_0x0640('0x98')]){logger[_0x0640('0x30')]('['+_0x271312[_0x0640('0x99')][_0x0640('0x9a')]()+']',_0x0640('0x90'));_0x271312['recordingURL']=_0x4ebd13[_0x0640('0x81')]+_0x0640('0x91')+_0x271312[_0x0640('0x84')]+_0x0640('0x85')+md5(_0x271312[_0x0640('0x84')]);}else{_0x271312[_0x0640('0x83')]='';}var _0x2f1010=_0x4ebd13[_0x0640('0x7f')]===_0x0640('0x86')?'eu':_0x0640('0x87');return getAccessToken(_0x4ebd13)[_0x0640('0x29')](function(_0x108e1d){_0x32c1ac=_0x108e1d;return getUser(_0x32c1ac,_0x2f1010,_0x4ebd13);})['then'](function(_0xa9897f){_0x479d0f=_0xa9897f;logger[_0x0640('0x30')](_0x0640('0x92'),_0x479d0f['id']);return getEndUser(_0x32c1ac,_0x2f1010,_0x4ebd13,_0x271312[_0x0640('0x88')],_0x271312['calleridnum'],_0x479d0f,_0x5afbac);})[_0x0640('0x29')](function(_0x19162c){_0x436f4e=_0x19162c;return getCall(_0x32c1ac,_0x2f1010,_0x4ebd13,_0x479d0f,_0x436f4e,_0x5afbac,_0x271312,_0x0640('0x79'));})[_0x0640('0x29')](function(_0x548f5d){if(_0x548f5d){logger[_0x0640('0x30')](_0x0640('0x89'),_0x548f5d['id']);}})[_0x0640('0x2c')](function(_0x393889){logger['error']('['+_0x271312[_0x0640('0x99')]['toUpperCase']()+']',JSON[_0x0640('0xc')](_0x393889));});}; \ No newline at end of file +var _0xb18e=['[OUTBOUND]','com','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','unmanaged','/downloads?type=uniqueid&token=','zoho.eu','calleridname','toUpperCase','lodash','request-promise','md5','./util','moment','ioredis','../../../../config/logger','redis','localhost','socket.io-emitter','emit','debug','length','includes','picklist','type','idField','toString','variable','variableName','customVariable','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','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','email','Agent\x20found!','findIndex','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','enduserType','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb18e,0x147));var _0xeb18=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0xb18e[_0x3d38ae];return _0x3757ee;};'use strict';var _=require(_0xeb18('0x0'));var rp=require(_0xeb18('0x1'));var md5=require(_0xeb18('0x2'));var util=require('util');var intUtil=require(_0xeb18('0x3'));var moment=require(_0xeb18('0x4'));var Redis=require(_0xeb18('0x5'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xeb18('0x6'))('zoho');config['redis']=_['defaults'](config[_0xeb18('0x7')],{'host':_0xeb18('0x8'),'port':0x18eb});var io=require(_0xeb18('0x9'))(new Redis(config[_0xeb18('0x7')]));function emit(_0x293512,_0x3874f1,_0x210203){io['to'](_0x293512)[_0xeb18('0xa')](_0x3874f1,_0x210203);}function request(_0x573558){logger[_0xeb18('0xb')]('[HTTP]',JSON['stringify'](_0x573558));return rp(_0x573558);}function getCustomFields(_0x8325e8,_0x10d859){var _0x5c6941={};if(_0x8325e8[_0xeb18('0xc')]>0x0){_['forEach'](_0x8325e8,function(_0x2750f9){if(_[_0xeb18('0xd')](['string',_0xeb18('0xe')],_0x2750f9[_0xeb18('0xf')])&&_0x2750f9[_0xeb18('0x10')]){_0x5c6941[_0x2750f9['idField']]=_0x2750f9['content'][_0xeb18('0x11')]();}else if(_0x2750f9[_0xeb18('0xf')]===_0xeb18('0x12')&&_0x2750f9[_0xeb18('0x13')]&&_0x2750f9[_0xeb18('0x10')]&&_0x10d859[_0x2750f9[_0xeb18('0x13')]]){_0x5c6941[_0x2750f9[_0xeb18('0x10')]]=_0x10d859[_0x2750f9['variableName']]['toString']();}else if(_0x2750f9[_0xeb18('0xf')]===_0xeb18('0x14')&&_0x2750f9[_0xeb18('0x15')]&&_0x2750f9[_0xeb18('0x15')][_0xeb18('0x16')]&&_0x2750f9[_0xeb18('0x10')]&&_0x10d859[_0x2750f9[_0xeb18('0x15')][_0xeb18('0x16')]['toLowerCase']()]){_0x5c6941[_0x2750f9['idField']]=_0x10d859[_0x2750f9[_0xeb18('0x15')][_0xeb18('0x16')][_0xeb18('0x17')]()][_0xeb18('0x11')]();}});}return _0x5c6941;}function getName(_0x118604){if(_0x118604[_0xeb18('0x18')]('\x20')>0x0){var _0x21b81a=_0x118604[_0xeb18('0x19')](/ (.+)/);if(_0x21b81a[0x1]){return _0x21b81a;}}return[_0x118604,_0x118604];}var accountsTokens={};function getAccessToken(_0x3623bf){return new Promise(function(_0x30e0d4,_0x32ad16){if(!_['isNil'](accountsTokens[_0x3623bf['id']])&&!_[_0xeb18('0x1a')](accountsTokens[_0x3623bf['id']][_0xeb18('0x1b')])){if(moment()[_0xeb18('0x1c')](accountsTokens[_0x3623bf['id']][_0xeb18('0x1d')])){_0x30e0d4(accountsTokens[_0x3623bf['id']][_0xeb18('0x1b')]);}}var _0x2f3a95;switch(_0x3623bf[_0xeb18('0x1e')]){case'US':_0x2f3a95=_0xeb18('0x1f');break;case'AU':_0x2f3a95=_0xeb18('0x20');break;case'EU':_0x2f3a95=_0xeb18('0x21');break;case'IN':_0x2f3a95=_0xeb18('0x22');break;case'CN':_0x2f3a95='https://accounts.zoho.com.cn';break;default:_0x2f3a95='https://accounts.zoho.eu';break;}var _0xd42ba6={'method':_0xeb18('0x23'),'uri':_0x2f3a95+_0xeb18('0x24'),'qs':{'refresh_token':_0x3623bf[_0xeb18('0x25')],'client_id':_0x3623bf[_0xeb18('0x26')],'client_secret':_0x3623bf[_0xeb18('0x27')],'grant_type':_0xeb18('0x28')},'json':!![]};return rp(_0xd42ba6)[_0xeb18('0x29')](function(_0xed79b1){accountsTokens[_0x3623bf['id']]={'access_token':_0xed79b1['access_token'],'expires_in':moment()[_0xeb18('0x2a')](_0xed79b1[_0xeb18('0x1d')],_0xeb18('0x2b'))};_0x30e0d4(_0xed79b1[_0xeb18('0x1b')]);})[_0xeb18('0x2c')](function(_0x69bd6a){logger['error'](_0xeb18('0x2d'),_0x69bd6a[_0xeb18('0x2e')]);_0x32ad16(_0x69bd6a);});});}function getUser(_0x569eca,_0x171bc0,_0x16bc70,_0x4201e9){logger[_0xeb18('0x2f')](_0xeb18('0x30'));return request({'method':_0xeb18('0x31'),'uri':util[_0xeb18('0x32')]('https://www.zohoapis.%s/crm/v2/users',_0x171bc0),'qs':{'type':_0xeb18('0x33')},'headers':{'Authorization':_0xeb18('0x34')+_0x569eca},'json':!![]})['then'](function(_0x25d97d){if(_0x25d97d['users']){var _0x406605=-0x1;if(_['isArrayLikeObject'](_0x25d97d[_0xeb18('0x35')])){if(!_['isNil'](_0x4201e9)){_0x406605=_['findIndex'](_0x25d97d[_0xeb18('0x35')],function(_0x3e166a){return _0x3e166a[_0xeb18('0x36')]===_0x4201e9;});}if(_0x406605>=0x0){logger['info'](_0xeb18('0x37'));}else{logger[_0xeb18('0x2f')]('Using\x20the\x20admin\x20account!');_0x406605=_[_0xeb18('0x38')](_0x25d97d['users'],function(_0x52d985){return _0x52d985[_0xeb18('0x39')][_0xeb18('0x16')]===_0xeb18('0x3a');});}return _0x25d97d[_0xeb18('0x35')][_0x406605];}else{if(_0x25d97d[_0xeb18('0x3b')][_0xeb18('0x39')][_0xeb18('0x16')]===_0xeb18('0x3a')){logger[_0xeb18('0x2f')](_0xeb18('0x3c'));user=_0x25d97d[_0xeb18('0x3b')];return user;}else{logger['error'](_0xeb18('0x3d'),JSON[_0xeb18('0x3e')](_0x25d97d));throw new Error(_0xeb18('0x3f')+JSON[_0xeb18('0x3e')](_0x25d97d));}}}else{logger[_0xeb18('0x40')](_0xeb18('0x3d'),JSON[_0xeb18('0x3e')](_0x25d97d));throw new Error(_0xeb18('0x3f')+JSON[_0xeb18('0x3e')](_0x25d97d));}})['catch'](function(_0x48658f){console['error'](_0x48658f);});}function getZohoUser(_0x126bde,_0xbbd27f){return new BPromise(function(_0x22f79e,_0x4498ba){request(_0x126bde)[_0xeb18('0x29')](function(_0x1618a8){var _0x48de23=null;if(_0x1618a8){_0x48de23=_0x1618a8[_0xeb18('0x41')][0x0];_0x48de23['enduserType']=_0xbbd27f;}_0x22f79e(_0x48de23);})['catch'](function(_0x238dd2){_0x4498ba(_0x238dd2);});});}function createEndUser(_0x1c80a3,_0x41526e,_0xc780fb,_0x3d188d,_0x14228e,_0x43558d){var _0xc780fb=getName(_0xc780fb);return request({'method':_0xeb18('0x23'),'uri':_0xeb18('0x42')+_0x41526e+_0xeb18('0x43')+_[_0xeb18('0x44')](_0x43558d[_0xeb18('0x45')])+'s','body':{'data':[{'Last_Name':_0xc780fb[0x1],'First_Name':_0xc780fb[0x0],'Phone':_0x3d188d,'Owner':{'name':!_[_0xeb18('0x1a')](_0x14228e[_0xeb18('0x46')][_0xeb18('0x16')])?_0x14228e[_0xeb18('0x46')][_0xeb18('0x16')]:!_[_0xeb18('0x1a')](_0x14228e[_0xeb18('0x47')])?_0x14228e['first_name']+'\x20'+_0x14228e[_0xeb18('0x48')]:_0x14228e[_0xeb18('0x48')],'id':_0x14228e['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1c80a3},'json':!![]})[_0xeb18('0x29')](function(_0x20abf9){if(_0x20abf9&&_0x20abf9[_0xeb18('0x41')][0x0][_0xeb18('0x49')]===_0xeb18('0x4a')){var _0x544eef=_0x20abf9[_0xeb18('0x41')][0x0][_0xeb18('0x4b')];_0x544eef['enduserType']=_[_0xeb18('0x44')](_0x43558d[_0xeb18('0x45')])+'s';return _0x544eef;}logger['error'](_0xeb18('0x3d'),JSON[_0xeb18('0x3e')](data));throw new Error(_0xeb18('0x4c')+JSON['stringify'](data));})[_0xeb18('0x2c')](function(_0x2f43a8){console[_0xeb18('0x4d')]('CREATE\x20ERROR',_0x2f43a8);});}function getEndUser(_0x3ec977,_0x49c2b8,_0x11305f,_0x50f0b3,_0x5be4a7,_0x25fa32,_0x1f6f05){var _0x47694f={'method':_0xeb18('0x31'),'uri':'','headers':{'Authorization':_0xeb18('0x34')+_0x3ec977},'json':!![]};switch(_0x1f6f05[_0xeb18('0x4e')]){case _0xeb18('0x4f'):_0x47694f[_0xeb18('0x50')]=_0xeb18('0x42')+_0x49c2b8+_0xeb18('0x51')+_0x5be4a7+'))';return getZohoUser(_0x47694f,_0xeb18('0x52'))[_0xeb18('0x29')](function(_0x44937a){if(_0x44937a)return _0x44937a;_0x47694f[_0xeb18('0x50')]=_0xeb18('0x42')+_0x49c2b8+_0xeb18('0x53')+_0x5be4a7+'))';return getZohoUser(_0x47694f,_0xeb18('0x54'))['then'](function(_0x477435){if(_0x477435)return _0x477435;if(_0x1f6f05[_0xeb18('0x45')]!=_0xeb18('0x55')){return createEndUser(_0x3ec977,_0x49c2b8,_0x50f0b3,_0x5be4a7,_0x25fa32,_0x1f6f05);}else{return{};}});});break;case'contact':_0x47694f['uri']=_0xeb18('0x42')+_0x49c2b8+_0xeb18('0x51')+_0x5be4a7+'))';return getZohoUser(_0x47694f,'Contacts')[_0xeb18('0x29')](function(_0x427a33){if(_0x427a33)return _0x427a33;if(_0x1f6f05[_0xeb18('0x45')]!=_0xeb18('0x55')){return createEndUser(_0x3ec977,_0x49c2b8,_0x50f0b3,_0x5be4a7,_0x25fa32,_0x1f6f05);}else{return{};}});break;case'lead':_0x47694f[_0xeb18('0x50')]='https://www.zohoapis.'+_0x49c2b8+_0xeb18('0x53')+_0x5be4a7+'))';return getZohoUser(_0x47694f,_0xeb18('0x54'))[_0xeb18('0x29')](function(_0x5063e2){if(_0x5063e2)return _0x5063e2;if(_0x1f6f05['moduleCreate']!=_0xeb18('0x55')){return createEndUser(_0x3ec977,_0x49c2b8,_0x50f0b3,_0x5be4a7,_0x25fa32,_0x1f6f05);}else{return{};}});break;}}function getCall(_0x56b92d,_0x4c31d3,_0x3a53cf,_0x20167f,_0x50448e,_0x2ab532,_0x74c06f,_0x495300){logger[_0xeb18('0x2f')](_0xeb18('0x56'));var _0x1bf320={};_0x1bf320['Owner']={'name':!_['isNil'](_0x20167f['role'][_0xeb18('0x16')])&&!_['isNil'](_0x20167f[_0xeb18('0x39')][_0xeb18('0x16')])&&_0x20167f[_0xeb18('0x39')][_0xeb18('0x16')]===_0xeb18('0x57')?_0x20167f[_0xeb18('0x46')][_0xeb18('0x16')]:!_['isNil'](_0x20167f[_0xeb18('0x47')])?_0x20167f[_0xeb18('0x47')]+'\x20'+_0x20167f[_0xeb18('0x48')]:_0x20167f['last_name'],'id':_0x20167f['id']};_0x1bf320[_0xeb18('0x58')]=intUtil[_0xeb18('0x59')](_0x2ab532[_0xeb18('0x5a')],_0x74c06f,'\x20');_0x1bf320[_0xeb18('0x5b')]=intUtil['getString'](_0x2ab532[_0xeb18('0x5c')],_0x74c06f,'\x0a');if(_0x50448e[_0xeb18('0x5d')]==='Contacts'){_0x1bf320[_0xeb18('0x5e')]={'name':!_['isNil'](_0x50448e['Full_Name'])?_0x50448e['Full_Name']:!_[_0xeb18('0x1a')](_0x50448e['First_Name'])?_0x50448e[_0xeb18('0x5f')]+'\x20'+_0x50448e[_0xeb18('0x60')]:_0x50448e[_0xeb18('0x60')],'id':_0x50448e['id']};}if(_0x50448e[_0xeb18('0x5d')]===_0xeb18('0x54')){_0x1bf320[_0xeb18('0x61')]={'name':!_['isNil'](_0x50448e['Full_Name'])?_0x50448e[_0xeb18('0x62')]:!_[_0xeb18('0x1a')](_0x50448e[_0xeb18('0x5f')])?_0x50448e['First_Name']+'\x20'+_0x50448e[_0xeb18('0x60')]:_0x50448e[_0xeb18('0x60')],'id':_0x50448e['id']};_0x1bf320[_0xeb18('0x63')]=_[_0xeb18('0x44')](_0x50448e['enduserType']);}if(_0x74c06f[_0xeb18('0x64')]){_0x1bf320['Call_Duration']=moment[_0xeb18('0x65')](parseInt(_0x74c06f[_0xeb18('0x64')])*0x3e8)[_0xeb18('0x32')](_0xeb18('0x66'));}else if(_0x74c06f[_0xeb18('0x67')]&&_0x74c06f[_0xeb18('0x68')]){_0x1bf320[_0xeb18('0x69')]=moment[_0xeb18('0x65')](moment(_0x74c06f['endtime'],_0xeb18('0x6a'))[_0xeb18('0x6b')](moment(_0x74c06f[_0xeb18('0x6c')],'YYYY-MM-DDTHH:mm:ss')))[_0xeb18('0x32')]('mm:ss');}switch(_0x74c06f[_0xeb18('0x6d')]){case _0xeb18('0x6e'):_0x1bf320[_0xeb18('0x6f')]=_0xeb18('0x70');break;case _0xeb18('0x71'):case _0xeb18('0x72'):_0x1bf320[_0xeb18('0x6f')]=_0xeb18('0x73');break;case'rejected':_0x1bf320[_0xeb18('0x6f')]=_0xeb18('0x74');break;case _0xeb18('0x75'):_0x1bf320[_0xeb18('0x6f')]=_0xeb18('0x76');break;case _0xeb18('0x77'):_0x1bf320[_0xeb18('0x6f')]='Timeout';default:}_0x1bf320['Call_Start_Time']=(_0x495300===_0xeb18('0x78')?moment(_0x74c06f[_0xeb18('0x6c')])[_0xeb18('0x32')](_0xeb18('0x6a')):moment(_0x74c06f[_0xeb18('0x79')])[_0xeb18('0x32')](_0xeb18('0x6a')))||moment()[_0xeb18('0x32')](_0xeb18('0x6a'));_0x1bf320[_0xeb18('0x7a')]=_0x495300||_0xeb18('0x7b');_0x1bf320=_[_0xeb18('0x7c')](_0x1bf320,getCustomFields(_0x2ab532['Fields'],_0x74c06f));return request({'method':_0xeb18('0x23'),'uri':_0xeb18('0x42')+_0x4c31d3+_0xeb18('0x7d'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x56b92d},'body':{'data':[_0x1bf320]},'json':!![]})[_0xeb18('0x29')](function(_0xbfdfeb){if(_0xbfdfeb&&_0xbfdfeb[_0xeb18('0x41')][0x0][_0xeb18('0x49')]===_0xeb18('0x4a')){logger[_0xeb18('0x2f')](_0xeb18('0x7e'));return{'id':_0xbfdfeb['data'][0x0]['details']['id']};}})[_0xeb18('0x2c')](function(_0x55cd0b){logger[_0xeb18('0x2f')]('err',_0x55cd0b[_0xeb18('0x2e')]);console[_0xeb18('0x4d')](_0xeb18('0x7f'),_0x55cd0b);});}exports[_0xeb18('0x80')]=function(_0x2b83d7,_0x4df232,_0x1dedf0,_0x46f09d,_0x46d08f,_0x3239c7){var _0x3b9147,_0x24029c,_0x25c346;_0x3239c7[_0xeb18('0x81')]=intUtil[_0xeb18('0x82')](_0x3239c7[_0xeb18('0x81')]);_0x3239c7[_0xeb18('0x83')]=intUtil['stripTrailingSlash'](_0x3239c7['serverUrl']);if(_0x46d08f&&_0x46d08f[_0xeb18('0x84')]){logger[_0xeb18('0x2f')](_0xeb18('0x85'),_0xeb18('0x86'));_0x4df232[_0xeb18('0x87')]=_0x3239c7[_0xeb18('0x83')]+_0xeb18('0x88')+_0x4df232[_0xeb18('0x89')]+'/downloads?type=uniqueid&token='+md5(_0x4df232[_0xeb18('0x89')]);}else{_0x4df232[_0xeb18('0x87')]='';}var _0x3af321=_0x3239c7[_0xeb18('0x81')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x3239c7)[_0xeb18('0x29')](function(_0x2783a){_0x25c346=_0x2783a;return getUser(_0x25c346,_0x3af321,_0x3239c7,_0x46f09d['email']);})[_0xeb18('0x29')](function(_0x3a6b13){_0x3b9147=_0x3a6b13;logger['info'](_0xeb18('0x8a'),_0x3b9147['id']);return getEndUser(_0x25c346,_0x3af321,_0x3239c7,_0x4df232['calleridname'],_0x4df232[_0xeb18('0x8b')],_0x3b9147,_0x1dedf0);})['then'](function(_0x1086a2){_0x24029c=_0x1086a2;return getCall(_0x25c346,_0x3af321,_0x3239c7,_0x3b9147,_0x24029c,_0x1dedf0,_0x4df232,_0xeb18('0x7b'));})[_0xeb18('0x29')](function(_0x5dc01b){if(_0x5dc01b){logger[_0xeb18('0x2f')](_0xeb18('0x8c'),_0x5dc01b['id']);logger[_0xeb18('0x2f')]('[QUEUE]',_0xeb18('0x8d'));emit(util[_0xeb18('0x32')](_0xeb18('0x8e'),_0x46f09d['name']),'trigger:browser:url',{'uri':_0xeb18('0x8f')+_0x3239c7[_0xeb18('0x81')]+_0xeb18('0x90')+_0x5dc01b['id']});}})['catch'](function(_0x5cd518){logger['error']('[QUEUE]',JSON[_0xeb18('0x3e')](_0x5cd518));});};exports[_0xeb18('0x78')]=function(_0x1b6a68,_0x9a9fc9,_0x76fa26,_0x5d49a8,_0x716817,_0x414d93,_0x34ab88){var _0x588d5,_0xe27c02,_0x1ec581;_0x414d93[_0xeb18('0x81')]=intUtil[_0xeb18('0x82')](_0x414d93[_0xeb18('0x81')]);_0x414d93[_0xeb18('0x83')]=intUtil['stripTrailingSlash'](_0x414d93[_0xeb18('0x83')]);if(_0x34ab88&&_0x34ab88[_0xeb18('0x91')]&&_0x34ab88[_0xeb18('0x91')]!==_0xeb18('0x92')){logger[_0xeb18('0x2f')](_0xeb18('0x93'),_0xeb18('0x86'));_0x9a9fc9[_0xeb18('0x87')]=_0x414d93[_0xeb18('0x83')]+_0xeb18('0x88')+_0x9a9fc9[_0xeb18('0x89')]+'/downloads?type=uniqueid&token='+md5(_0x9a9fc9['uniqueid']);}var _0x3d16d6=_0x414d93[_0xeb18('0x81')]==='zoho.eu'?'eu':_0xeb18('0x94');return getAccessToken(_0x414d93)[_0xeb18('0x29')](function(_0xa70fa0){_0x1ec581=_0xa70fa0;return getUser(_0x1ec581,_0x3d16d6,_0x414d93,_0x5d49a8['email']);})[_0xeb18('0x29')](function(_0x176f10){_0x588d5=_0x176f10;logger['info'](_0xeb18('0x8a'),_0x588d5['id']);return getEndUser(_0x1ec581,_0x3d16d6,_0x414d93,_0x9a9fc9[_0xeb18('0x95')],_0x9a9fc9[_0xeb18('0x96')],_0x588d5,_0x76fa26);})[_0xeb18('0x29')](function(_0x4756dd){_0xe27c02=_0x4756dd;return getCall(_0x1ec581,_0x3d16d6,_0x414d93,_0x588d5,_0xe27c02,_0x76fa26,_0x9a9fc9,_0xeb18('0x97'));})[_0xeb18('0x29')](function(_0x3c1583){if(_0x3c1583){logger[_0xeb18('0x2f')](_0xeb18('0x8c'),_0x3c1583['id']);logger[_0xeb18('0x2f')](_0xeb18('0x93'),_0xeb18('0x8d'));emit(util[_0xeb18('0x32')](_0xeb18('0x8e'),_0x5d49a8[_0xeb18('0x16')]),_0xeb18('0x98'),{'uri':_0xeb18('0x8f')+_0x414d93[_0xeb18('0x81')]+_0xeb18('0x90')+_0x3c1583['id']});}})[_0xeb18('0x2c')](function(_0xab19ad){logger[_0xeb18('0x40')]('[OUTBOUND]',JSON[_0xeb18('0x3e')](_0xab19ad));});};exports[_0xeb18('0x99')]=function(_0x3a24bc,_0x3aff70,_0x4c0c70,_0x574e80,_0x9b1758,_0x2c22e9){var _0x2b4ffb,_0x230cd6,_0x182cf1;_0x2c22e9['host']=intUtil[_0xeb18('0x82')](_0x2c22e9[_0xeb18('0x81')]);_0x2c22e9[_0xeb18('0x83')]=intUtil[_0xeb18('0x82')](_0x2c22e9['serverUrl']);if(_0x9b1758&&_0x9b1758[_0xeb18('0x84')]){logger[_0xeb18('0x2f')]('['+_0x3aff70['lastevent']['toUpperCase']()+']',_0xeb18('0x86'));_0x3aff70[_0xeb18('0x87')]=_0x2c22e9[_0xeb18('0x83')]+_0xeb18('0x88')+_0x3aff70[_0xeb18('0x89')]+_0xeb18('0x9a')+md5(_0x3aff70[_0xeb18('0x89')]);}else{_0x3aff70[_0xeb18('0x87')]='';}var _0x527b65=_0x2c22e9[_0xeb18('0x81')]===_0xeb18('0x9b')?'eu':_0xeb18('0x94');return getAccessToken(_0x2c22e9)['then'](function(_0x4bed08){_0x182cf1=_0x4bed08;return getUser(_0x182cf1,_0x527b65,_0x2c22e9);})['then'](function(_0x110a09){_0x2b4ffb=_0x110a09;logger['info'](_0xeb18('0x8a'),_0x2b4ffb['id']);return getEndUser(_0x182cf1,_0x527b65,_0x2c22e9,_0x3aff70[_0xeb18('0x9c')],_0x3aff70[_0xeb18('0x8b')],_0x2b4ffb,_0x4c0c70);})[_0xeb18('0x29')](function(_0x2968ec){_0x230cd6=_0x2968ec;return getCall(_0x182cf1,_0x527b65,_0x2c22e9,_0x2b4ffb,_0x230cd6,_0x4c0c70,_0x3aff70,'Inbound');})['then'](function(_0x4d7451){if(_0x4d7451){logger[_0xeb18('0x2f')](_0xeb18('0x8c'),_0x4d7451['id']);}})[_0xeb18('0x2c')](function(_0xf86256){logger['error']('['+_0x3aff70[_0xeb18('0x6d')][_0xeb18('0x9d')]()+']',JSON[_0xeb18('0x3e')](_0xf86256));});}; \ 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 46b2a73..5fc1aa2 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 _0xa3ad=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','Script','data3','render','error'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xa3ad,0x1ee));var _0xda3a=function(_0x3f4c15,_0x2c8025){_0x3f4c15=_0x3f4c15-0x0;var _0x546cfa=_0xa3ad[_0x3f4c15];return _0x546cfa;};'use strict';var util=require(_0xda3a('0x0'));var sh=require(_0xda3a('0x1'));var Mustache=require(_0xda3a('0x2'));var logger=require(_0xda3a('0x3'))('trigger');exports[_0xda3a('0x4')]=function(_0x1d4c0a,_0x420a54){var _0x11f3aa=_0x1d4c0a[_0xda3a('0x5')]?_0x1d4c0a['data2']:_0xda3a('0x6');var _0x3d6e82=_0x1d4c0a[_0xda3a('0x7')]?Mustache[_0xda3a('0x8')](_0x1d4c0a[_0xda3a('0x7')],_0x420a54):_0x420a54;sh['exec'](_0x3d6e82,function(_0x52e25c,_0x41402d,_0x2fea2f){if(_0x52e25c!==0x0){logger[_0xda3a('0x9')](util[_0xda3a('0xa')](_0xda3a('0xb'),_0x11f3aa,_0x3d6e82,_0x52e25c,_0x2fea2f));}else{logger[_0xda3a('0xc')](util[_0xda3a('0xa')](_0xda3a('0xd'),_0x11f3aa,_0x3d6e82,_0x41402d));}});}; \ No newline at end of file +var _0x424d=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','data2','data3','error'];(function(_0x2112b7,_0x2dd0a2){var _0x100f93=function(_0x359f66){while(--_0x359f66){_0x2112b7['push'](_0x2112b7['shift']());}};_0x100f93(++_0x2dd0a2);}(_0x424d,0xb7));var _0xd424=function(_0x1c1259,_0x2db8ee){_0x1c1259=_0x1c1259-0x0;var _0x1dab5c=_0x424d[_0x1c1259];return _0x1dab5c;};'use strict';var util=require(_0xd424('0x0'));var sh=require(_0xd424('0x1'));var Mustache=require('mustache');var logger=require(_0xd424('0x2'))('trigger');exports['exec']=function(_0xc5f8ca,_0x349612){var _0x3a252e=_0xc5f8ca[_0xd424('0x3')]?_0xc5f8ca[_0xd424('0x3')]:'Script';var _0x4070c8=_0xc5f8ca['data3']?Mustache['render'](_0xc5f8ca[_0xd424('0x4')],_0x349612):_0x349612;sh['exec'](_0x4070c8,function(_0x390ceb,_0x2cd9b4,_0x51ce6c){if(_0x390ceb!==0x0){logger[_0xd424('0x5')](util['format'](_0xd424('0x6'),_0x3a252e,_0x4070c8,_0x390ceb,_0x51ce6c));}else{logger[_0xd424('0x7')](util['format'](_0xd424('0x8'),_0x3a252e,_0x4070c8,_0x2cd9b4));}});}; \ 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 934e634..98e3153 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 _0x6a93=['util','lodash','mustache','../../../../config/logger','trigger','data1','render','data5','number','headers','data6','error','stack','toUpperCase','GET','DELETE','PUT','parse','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','then','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','message','request-promise'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6a93,0x8b));var _0x36a9=function(_0x4eec2b,_0x4cb198){_0x4eec2b=_0x4eec2b-0x0;var _0x10662c=_0x6a93[_0x4eec2b];return _0x10662c;};'use strict';var rp=require(_0x36a9('0x0'));var util=require(_0x36a9('0x1'));var _=require(_0x36a9('0x2'));var Mustache=require(_0x36a9('0x3'));var logger=require(_0x36a9('0x4'))(_0x36a9('0x5'));exports['exec']=function(_0x4be75d,_0x45dcdd){var _0x2428ac,_0xb78de1;var _0xe2031c={'method':_0x4be75d[_0x36a9('0x6')]['toUpperCase'](),'uri':Mustache[_0x36a9('0x7')](_0x4be75d['data2'],_0x45dcdd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4be75d[_0x36a9('0x8')])===_0x36a9('0x9')&&parseInt(_0x4be75d[_0x36a9('0x8')])>=0x1&&parseInt(_0x4be75d[_0x36a9('0x8')])<=0xa?parseInt(_0x4be75d[_0x36a9('0x8')])*0x3e8:0x5*0x3e8};try{_0xe2031c[_0x36a9('0xa')]=_0x4be75d[_0x36a9('0xb')]?JSON['parse'](Mustache['render'](_0x4be75d['data6'],_0x45dcdd)):{};}catch(_0x1e0ffd){logger[_0x36a9('0xc')](_0x1e0ffd[_0x36a9('0xd')]);}switch(_0x4be75d[_0x36a9('0x6')][_0x36a9('0xe')]()){case _0x36a9('0xf'):case _0x36a9('0x10'):_0x2428ac=null;_0xe2031c['qs']=_0x45dcdd;break;case'POST':case _0x36a9('0x11'):if(_0x4be75d['data7']){try{_0x2428ac=JSON[_0x36a9('0x12')](Mustache[_0x36a9('0x7')](_0x4be75d[_0x36a9('0x13')],_0x45dcdd));_0xe2031c[_0x36a9('0x14')]=_0x2428ac;}catch(_0x833ed){logger[_0x36a9('0xc')](_0x833ed['stack']);logger[_0x36a9('0xc')](_0x36a9('0x15'));}}else{_0x2428ac=_0x45dcdd;_0xe2031c['body']=_0x2428ac;}break;}logger[_0x36a9('0x16')](util[_0x36a9('0x17')](_0x36a9('0x18'),_0x4be75d[_0x36a9('0x6')],_0x4be75d[_0x36a9('0x19')],JSON['stringify'](_0xe2031c)));rp(_0xe2031c)[_0x36a9('0x1a')](function(_0x5a3d23){_0x2428ac=!_[_0x36a9('0x1b')](_0x2428ac)?_0x36a9('0x1c')+_0x2428ac:'';_0xb78de1=typeof _0x5a3d23['body']===_0x36a9('0x1d')?JSON[_0x36a9('0x1e')](_0x5a3d23['body']):_0x5a3d23[_0x36a9('0x14')];logger[_0x36a9('0x16')](util[_0x36a9('0x17')](_0x36a9('0x1f'),_0x4be75d[_0x36a9('0x6')],_0x4be75d[_0x36a9('0x19')],_0x5a3d23[_0x36a9('0x20')],_0xb78de1));})[_0x36a9('0x21')](function(_0x4dedf1){logger[_0x36a9('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x4be75d['data1'],_0x4be75d[_0x36a9('0x19')],_0x4dedf1[_0x36a9('0x20')],_0x4dedf1['name'],_0x4dedf1[_0x36a9('0x22')]));});}; \ No newline at end of file +var _0x57c9=['object','stringify','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','exec','toUpperCase','data2','data5','number','headers','data6','error','stack','data1','GET','DELETE','POST','PUT','parse','render','body','info','format','then','isNil',',\x20request\x20body:\x20'];(function(_0x4d8742,_0xd8d845){var _0x59701d=function(_0x5ab85b){while(--_0x5ab85b){_0x4d8742['push'](_0x4d8742['shift']());}};_0x59701d(++_0xd8d845);}(_0x57c9,0x6d));var _0x957c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x57c9[_0x1ac595];return _0x455fff;};'use strict';var rp=require(_0x957c('0x0'));var util=require(_0x957c('0x1'));var _=require(_0x957c('0x2'));var Mustache=require(_0x957c('0x3'));var logger=require(_0x957c('0x4'))('trigger');exports[_0x957c('0x5')]=function(_0x355d57,_0x1f5031){var _0x3166df,_0x3beb9d;var _0x542dc1={'method':_0x355d57['data1'][_0x957c('0x6')](),'uri':Mustache['render'](_0x355d57[_0x957c('0x7')],_0x1f5031),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x355d57[_0x957c('0x8')])===_0x957c('0x9')&&parseInt(_0x355d57[_0x957c('0x8')])>=0x1&&parseInt(_0x355d57[_0x957c('0x8')])<=0xa?parseInt(_0x355d57[_0x957c('0x8')])*0x3e8:0x5*0x3e8};try{_0x542dc1[_0x957c('0xa')]=_0x355d57['data6']?JSON['parse'](Mustache['render'](_0x355d57[_0x957c('0xb')],_0x1f5031)):{};}catch(_0x5decce){logger[_0x957c('0xc')](_0x5decce[_0x957c('0xd')]);}switch(_0x355d57[_0x957c('0xe')]['toUpperCase']()){case _0x957c('0xf'):case _0x957c('0x10'):_0x3166df=null;_0x542dc1['qs']=_0x1f5031;break;case _0x957c('0x11'):case _0x957c('0x12'):if(_0x355d57['data7']){try{_0x3166df=JSON[_0x957c('0x13')](Mustache[_0x957c('0x14')](_0x355d57['data7'],_0x1f5031));_0x542dc1['body']=_0x3166df;}catch(_0x11b9be){logger[_0x957c('0xc')](_0x11b9be['stack']);logger[_0x957c('0xc')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x3166df=_0x1f5031;_0x542dc1[_0x957c('0x15')]=_0x3166df;}break;}logger[_0x957c('0x16')](util[_0x957c('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x355d57[_0x957c('0xe')],_0x355d57[_0x957c('0x7')],JSON['stringify'](_0x542dc1)));rp(_0x542dc1)[_0x957c('0x18')](function(_0x2eb479){_0x3166df=!_[_0x957c('0x19')](_0x3166df)?_0x957c('0x1a')+_0x3166df:'';_0x3beb9d=typeof _0x2eb479['body']===_0x957c('0x1b')?JSON[_0x957c('0x1c')](_0x2eb479[_0x957c('0x15')]):_0x2eb479['body'];logger[_0x957c('0x16')](util[_0x957c('0x17')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x355d57[_0x957c('0xe')],_0x355d57[_0x957c('0x7')],_0x2eb479[_0x957c('0x1d')],_0x3beb9d));})[_0x957c('0x1e')](function(_0x2a39d6){logger['error'](util[_0x957c('0x17')](_0x957c('0x1f'),_0x355d57[_0x957c('0xe')],_0x355d57['data2'],_0x2a39d6[_0x957c('0x1d')],_0x2a39d6[_0x957c('0x20')],_0x2a39d6[_0x957c('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index ddc747b..06c7cb7 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 _0xef6a=['http','Request','request','then','debug','error','result','catch','rpc','exports','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x51bdda,_0x5666ca){var _0x998aab=function(_0x3f4029){while(--_0x3f4029){_0x51bdda['push'](_0x51bdda['shift']());}};_0x998aab(++_0x5666ca);}(_0xef6a,0x1bd));var _0xaef6=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xef6a[_0x17b6e3];return _0x3906f3;};'use strict';var jayson=require(_0xaef6('0x0'));var BPromise=require(_0xaef6('0x1'));var logger=require(_0xaef6('0x2'))(_0xaef6('0x3'));var client=jayson[_0xaef6('0x4')][_0xaef6('0x5')]({'port':0x2329});client[_0xaef6('0x6')]=function(_0x390ad4,_0x3eb765){return new BPromise(function(_0x29ca02,_0x58e2d1){return client[_0xaef6('0x7')](_0x390ad4,_0x3eb765)[_0xaef6('0x8')](function(_0x38a998){logger[_0xaef6('0x9')]('rpc',_0xaef6('0x3'),_0x390ad4,_0x3eb765,_0x38a998);if(_0x38a998[_0xaef6('0xa')]){logger[_0xaef6('0xa')]('rpc','routing',_0x390ad4,_0x38a998[_0xaef6('0xa')]['message'],_0x3eb765);return _0x58e2d1(_0x38a998['error']['message']);}else{return _0x29ca02(_0x38a998[_0xaef6('0xb')]);}})[_0xaef6('0xc')](function(_0x50f17a){logger['error'](_0xaef6('0xd'),_0xaef6('0x3'),_0x390ad4,_0x50f17a,_0x3eb765);return _0x58e2d1(_0x50f17a);});});};module[_0xaef6('0xe')]=client; \ No newline at end of file +var _0xcf7c=['client','Request','request','then','debug','error','rpc','message','result','catch','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0xcf7c,0xea));var _0xccf7=function(_0x599aaf,_0x3d3622){_0x599aaf=_0x599aaf-0x0;var _0xd995f3=_0xcf7c[_0x599aaf];return _0xd995f3;};'use strict';var jayson=require(_0xccf7('0x0'));var BPromise=require(_0xccf7('0x1'));var logger=require(_0xccf7('0x2'))(_0xccf7('0x3'));var client=jayson[_0xccf7('0x4')]['http']({'port':0x2329});client[_0xccf7('0x5')]=function(_0x10943a,_0x399f93){return new BPromise(function(_0x35e2d8,_0x4084e0){return client[_0xccf7('0x6')](_0x10943a,_0x399f93)[_0xccf7('0x7')](function(_0x458cd8){logger[_0xccf7('0x8')]('rpc','routing',_0x10943a,_0x399f93,_0x458cd8);if(_0x458cd8['error']){logger[_0xccf7('0x9')](_0xccf7('0xa'),_0xccf7('0x3'),_0x10943a,_0x458cd8[_0xccf7('0x9')][_0xccf7('0xb')],_0x399f93);return _0x4084e0(_0x458cd8['error'][_0xccf7('0xb')]);}else{return _0x35e2d8(_0x458cd8[_0xccf7('0xc')]);}})[_0xccf7('0xd')](function(_0x35be27){logger[_0xccf7('0x9')](_0xccf7('0xa'),'routing',_0x10943a,_0x35be27,_0x399f93);return _0x4084e0(_0x35be27);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 839f07d..2481ff0 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 _0x692b=['./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','initMailAccounts','then','refresh','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization'];(function(_0x4b4dd0,_0x4b7586){var _0x42da25=function(_0x48ed2c){while(--_0x48ed2c){_0x4b4dd0['push'](_0x4b4dd0['shift']());}};_0x42da25(++_0x4b7586);}(_0x692b,0x1a4));var _0xb692=function(_0xa58294,_0x13ab28){_0xa58294=_0xa58294-0x0;var _0x3c85fb=_0x692b[_0xa58294];return _0x3c85fb;};'use strict';var server=require(_0xb692('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xb692('0x1'));var mailAccount=require(_0xb692('0x2'));var setting=require(_0xb692('0x3'));var logger=require(_0xb692('0x4'))(_0xb692('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xb692('0x6')]()['then'](mailAccount['getMailAccounts']())['then'](realtime[_0xb692('0x7')]())[_0xb692('0x8')](function(){email[_0xb692('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xb692('0xa')](realtime,email)[_0xb692('0x8')](function(){return initRealtime();})['then'](function(){return setting[_0xb692('0xb')]();})[_0xb692('0x8')](function(_0x3a91c7){return setInterval(initRealtime,_0x3a91c7[_0xb692('0xc')]*0x3e8);})['catch'](function(_0xb5d616){logger[_0xb692('0xd')](_0xb692('0xe'),_0xb5d616);});}main(); \ No newline at end of file +var _0xc250=['then','getMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc250,0xf9));var _0x0c25=function(_0x100868,_0x15270b){_0x100868=_0x100868-0x0;var _0x5f26f3=_0xc250[_0x100868];return _0x5f26f3;};'use strict';var server=require(_0x0c25('0x0'));var Realtime=require(_0x0c25('0x1'));var EmailChannel=require(_0x0c25('0x2'));var mailAccount=require(_0x0c25('0x3'));var setting=require(_0x0c25('0x4'));var logger=require('../../config/logger')(_0x0c25('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0c25('0x6')]()[_0x0c25('0x7')](mailAccount[_0x0c25('0x8')]())['then'](realtime['initMailAccounts']())[_0x0c25('0x7')](function(){email[_0x0c25('0x9')](realtime[_0x0c25('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x0c25('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x0c25('0xb')]();})[_0x0c25('0x7')](function(_0x33a563){return setInterval(initRealtime,_0x33a563[_0x0c25('0xc')]*0x3e8);})[_0x0c25('0xd')](function(_0x5f5547){logger[_0x0c25('0xe')](_0x0c25('0xf'),_0x5f5547);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 4400d51..725983e 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 _0x134d=['localhost','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','emit','key','status','Imap','messageStatus','total','isNil','stringify','hasOwnProperty','active','service','custom','provider','imapAccounts','box','handleImapBox','bind','end','handleImapEnd','handleImapError','disabled','prototype','name','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','error','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','defaults','redis'];(function(_0x562c3d,_0x35cb0b){var _0x247f47=function(_0x68dab6){while(--_0x68dab6){_0x562c3d['push'](_0x562c3d['shift']());}};_0x247f47(++_0x35cb0b);}(_0x134d,0x1bf));var _0xd134=function(_0x48b7e7,_0x51eae1){_0x48b7e7=_0x48b7e7-0x0;var _0xcb810e=_0x134d[_0x48b7e7];return _0xcb810e;};'use strict';var _=require(_0xd134('0x0'));var moment=require(_0xd134('0x1'));var BPromise=require(_0xd134('0x2'));var md5=require(_0xd134('0x3'));var Redis=require(_0xd134('0x4'));var config=require('../../../config/environment');var logger=require(_0xd134('0x5'))(_0xd134('0x6'));config['redis']=_[_0xd134('0x7')](config[_0xd134('0x8')],{'host':_0xd134('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xd134('0xa'));var EmailSmtp=require(_0xd134('0xb'));var mailAccount=require(_0xd134('0xc'));var md5Accounts={};function EmailChannel(_0x3c0d3f){logger['info'](_0xd134('0xd'));this['mailAccounts']=_0x3c0d3f[_0xd134('0xe')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0xd134('0xf')]=function(_0xbe4c10){var _0x4beee9=this[_0xd134('0xe')][_0xbe4c10];var _0x14dbba={'id':_0x4beee9['id'],'name':_0x4beee9['name'],'key':_0x4beee9[_0xd134('0x10')],'active':_0x4beee9['active'],'Imap':{'status':_0x4beee9['Imap'][_0xd134('0x11')],'messageStatus':_0x4beee9[_0xd134('0x12')][_0xd134('0x13')],'total':_0x4beee9[_0xd134('0x12')][_0xd134('0x14')]}};if(_[_0xd134('0x15')](md5Accounts[_0xbe4c10])){md5Accounts[_0xbe4c10]={};}var _0x343ca6=md5(JSON[_0xd134('0x16')](_0x14dbba));if(md5Accounts[_0xbe4c10]['md5']!==_0x343ca6){md5Accounts[_0xbe4c10]['md5']=_0x343ca6;io[_0xd134('0xf')]('mailAccount:update',_0x14dbba);}};EmailChannel['prototype']['refresh']=function(_0x579dcd){for(var _0x489e1f in _0x579dcd){if(_0x579dcd[_0xd134('0x17')](_0x489e1f)){if(_0x579dcd[_0x489e1f]['Imap']&&_0x579dcd[_0x489e1f][_0xd134('0x18')]){var _0x350d78=_0x579dcd[_0x489e1f]['Imap'];if(!_0x350d78[_0xd134('0x19')]&&_0x579dcd[_0x489e1f]['provider']!==_0xd134('0x1a'))_0x350d78[_0xd134('0x19')]=_0x579dcd[_0x489e1f][_0xd134('0x1b')];if(!this[_0xd134('0x1c')]['hasOwnProperty'](_0x350d78['id'])){this['imapAccounts'][_0x350d78['id']]=new EmailImap(_0x350d78,_0x579dcd[_0x489e1f][_0xd134('0x6')]);this[_0xd134('0x1c')][_0x350d78['id']]['on'](_0xd134('0x1d'),this[_0xd134('0x1e')][_0xd134('0x1f')](this,_0x489e1f));this[_0xd134('0x1c')][_0x350d78['id']]['on']('email',this['handleImapEmail']['bind'](this,_0x489e1f));this['imapAccounts'][_0x350d78['id']]['on'](_0xd134('0x20'),this[_0xd134('0x21')][_0xd134('0x1f')](this,_0x489e1f));this[_0xd134('0x1c')][_0x350d78['id']]['on']('error',this[_0xd134('0x22')][_0xd134('0x1f')](this,_0x489e1f));}}else{if(_['isNil'](this[_0xd134('0xe')][_0x489e1f][_0xd134('0x12')])){this[_0xd134('0xe')][_0x489e1f][_0xd134('0x12')]={};}this[_0xd134('0xe')][_0x489e1f][_0xd134('0x12')][_0xd134('0x11')]=_0xd134('0x23');this[_0xd134('0xe')][_0x489e1f][_0xd134('0x12')]['messageStatus']='';this[_0xd134('0xf')](_0x489e1f);}}}};EmailChannel[_0xd134('0x24')][_0xd134('0x1e')]=function(_0x3a680c,_0x167989){if(this[_0xd134('0xe')][_0x3a680c]){this[_0xd134('0xe')][_0x3a680c][_0xd134('0x12')][_0xd134('0x11')]='connected';this[_0xd134('0xe')][_0x3a680c][_0xd134('0x12')]['messageStatus']=_0x167989[_0xd134('0x25')];if(_0x167989[_0xd134('0x26')]){this['mailAccounts'][_0x3a680c][_0xd134('0x12')][_0xd134('0x14')]=_0x167989[_0xd134('0x26')]['total'];}return this[_0xd134('0xf')](_0x3a680c);}};EmailChannel['prototype'][_0xd134('0x27')]=function(_0x3ef366,_0x1ebec5){logger[_0xd134('0x28')](_0xd134('0x29'),_0x1ebec5[_0xd134('0x2a')],_0x1ebec5['lastName'],_0x1ebec5['from'],_0x3ef366);if(this[_0xd134('0xe')][_0x3ef366]){return mailAccount['notify'](_0x3ef366,_0x1ebec5)[_0xd134('0x2b')](function(_0x29f19e){if(_0x29f19e){logger['info'](_0xd134('0x2c'));}})[_0xd134('0x2d')](function(_0x313f8e){logger['error'](_0xd134('0x2e'),JSON[_0xd134('0x16')](_0x313f8e));});}};EmailChannel[_0xd134('0x24')]['handleImapEnd']=function(_0x449398){if(this[_0xd134('0xe')][_0x449398]&&this[_0xd134('0xe')][_0x449398]['Imap']){if(this[_0xd134('0x1c')][this['mailAccounts'][_0x449398]['Imap']['id']]){delete this[_0xd134('0x1c')][this['mailAccounts'][_0x449398][_0xd134('0x12')]['id']];}this[_0xd134('0xe')][_0x449398][_0xd134('0x12')][_0xd134('0x2f')]=moment();this[_0xd134('0xf')](_0x449398);}};EmailChannel['prototype'][_0xd134('0x22')]=function(_0x19850a,_0x1039c9){if(this['mailAccounts'][_0x19850a]){this[_0xd134('0xe')][_0x19850a]['Imap'][_0xd134('0x11')]=_0xd134('0x30');this[_0xd134('0xe')][_0x19850a]['Imap'][_0xd134('0x13')]=_0x1039c9;return this[_0xd134('0xf')](_0x19850a);}};EmailChannel[_0xd134('0x24')][_0xd134('0x31')]=function(_0x54e126,_0x3ca010){return this[_0xd134('0x32')][_0xd134('0x33')](_0x54e126,_0x3ca010);};EmailChannel['prototype'][_0xd134('0x34')]=function(_0x2c4174){var _0x393cf8=this;if(this['mailAccounts'][_0x2c4174['id']]){if(_[_0xd134('0x15')](this[_0xd134('0xe')][_0x2c4174['id']][_0xd134('0x35')])){this[_0xd134('0xe')][_0x2c4174['id']][_0xd134('0x35')]={};}this['mailAccounts'][_0x2c4174['id']]['Smtp'][_0xd134('0x2f')]=moment();return new BPromise(function(_0x267f27,_0x5d45ec){return _0x393cf8[_0xd134('0x32')][_0xd134('0x36')](_0x2c4174)['then'](function(_0x330c7e){_0x393cf8['mailAccounts'][_0x2c4174['id']]['Smtp'][_0xd134('0x11')]=_0xd134('0x37');_0x393cf8[_0xd134('0xe')][_0x2c4174['id']][_0xd134('0x35')][_0xd134('0x13')]='';_0x393cf8['emit'](_0x2c4174['id']);_0x267f27(_0x330c7e);})['catch'](function(_0x37a67e){_0x393cf8['mailAccounts'][_0x2c4174['id']][_0xd134('0x35')][_0xd134('0x11')]='error';_0x393cf8[_0xd134('0xe')][_0x2c4174['id']][_0xd134('0x35')]['messageStatus']=_0x37a67e;_0x393cf8[_0xd134('0xf')](_0x2c4174['id']);_0x5d45ec(_0x37a67e);});});}return this[_0xd134('0x32')][_0xd134('0x36')](_0x2c4174);};module[_0xd134('0x38')]=EmailChannel; \ No newline at end of file +var _0xbd6f=['box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','connected','messages','handleImapEmail','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','total','isNil','mailAccount:update','refresh','hasOwnProperty','custom','service','provider'];(function(_0x5cd8c3,_0x4f608c){var _0xa4b5bf=function(_0x287f78){while(--_0x287f78){_0x5cd8c3['push'](_0x5cd8c3['shift']());}};_0xa4b5bf(++_0x4f608c);}(_0xbd6f,0x1b7));var _0xfbd6=function(_0x18f90e,_0x25a7f8){_0x18f90e=_0x18f90e-0x0;var _0x11cb87=_0xbd6f[_0x18f90e];return _0x11cb87;};'use strict';var _=require(_0xfbd6('0x0'));var moment=require(_0xfbd6('0x1'));var BPromise=require(_0xfbd6('0x2'));var md5=require(_0xfbd6('0x3'));var Redis=require(_0xfbd6('0x4'));var config=require(_0xfbd6('0x5'));var logger=require(_0xfbd6('0x6'))(_0xfbd6('0x7'));config[_0xfbd6('0x8')]=_[_0xfbd6('0x9')](config[_0xfbd6('0x8')],{'host':_0xfbd6('0xa'),'port':0x18eb});var io=require(_0xfbd6('0xb'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0xfbd6('0xc'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4edb34){logger[_0xfbd6('0xd')](_0xfbd6('0xe'));this[_0xfbd6('0xf')]=_0x4edb34[_0xfbd6('0xf')];this[_0xfbd6('0x10')]={};this[_0xfbd6('0x11')]=new EmailSmtp();}EmailChannel[_0xfbd6('0x12')][_0xfbd6('0x13')]=function(_0x2ab3fc){var _0x22e058=this['mailAccounts'][_0x2ab3fc];var _0x28c443={'id':_0x22e058['id'],'name':_0x22e058[_0xfbd6('0x14')],'key':_0x22e058['key'],'active':_0x22e058[_0xfbd6('0x15')],'Imap':{'status':_0x22e058[_0xfbd6('0x16')][_0xfbd6('0x17')],'messageStatus':_0x22e058[_0xfbd6('0x16')][_0xfbd6('0x18')],'total':_0x22e058[_0xfbd6('0x16')][_0xfbd6('0x19')]}};if(_[_0xfbd6('0x1a')](md5Accounts[_0x2ab3fc])){md5Accounts[_0x2ab3fc]={};}var _0x473c88=md5(JSON['stringify'](_0x28c443));if(md5Accounts[_0x2ab3fc][_0xfbd6('0x3')]!==_0x473c88){md5Accounts[_0x2ab3fc]['md5']=_0x473c88;io[_0xfbd6('0x13')](_0xfbd6('0x1b'),_0x28c443);}};EmailChannel['prototype'][_0xfbd6('0x1c')]=function(_0x40b21f){for(var _0x3cb6e5 in _0x40b21f){if(_0x40b21f[_0xfbd6('0x1d')](_0x3cb6e5)){if(_0x40b21f[_0x3cb6e5][_0xfbd6('0x16')]&&_0x40b21f[_0x3cb6e5][_0xfbd6('0x15')]){var _0x5a6cd7=_0x40b21f[_0x3cb6e5][_0xfbd6('0x16')];if(!_0x5a6cd7['service']&&_0x40b21f[_0x3cb6e5]['provider']!==_0xfbd6('0x1e'))_0x5a6cd7[_0xfbd6('0x1f')]=_0x40b21f[_0x3cb6e5][_0xfbd6('0x20')];if(!this[_0xfbd6('0x10')][_0xfbd6('0x1d')](_0x5a6cd7['id'])){this[_0xfbd6('0x10')][_0x5a6cd7['id']]=new EmailImap(_0x5a6cd7,_0x40b21f[_0x3cb6e5]['email']);this['imapAccounts'][_0x5a6cd7['id']]['on'](_0xfbd6('0x21'),this[_0xfbd6('0x22')]['bind'](this,_0x3cb6e5));this[_0xfbd6('0x10')][_0x5a6cd7['id']]['on']('email',this['handleImapEmail'][_0xfbd6('0x23')](this,_0x3cb6e5));this['imapAccounts'][_0x5a6cd7['id']]['on'](_0xfbd6('0x24'),this[_0xfbd6('0x25')]['bind'](this,_0x3cb6e5));this[_0xfbd6('0x10')][_0x5a6cd7['id']]['on'](_0xfbd6('0x26'),this[_0xfbd6('0x27')][_0xfbd6('0x23')](this,_0x3cb6e5));}}else{if(_['isNil'](this['mailAccounts'][_0x3cb6e5][_0xfbd6('0x16')])){this['mailAccounts'][_0x3cb6e5][_0xfbd6('0x16')]={};}this[_0xfbd6('0xf')][_0x3cb6e5][_0xfbd6('0x16')][_0xfbd6('0x17')]=_0xfbd6('0x28');this[_0xfbd6('0xf')][_0x3cb6e5][_0xfbd6('0x16')][_0xfbd6('0x18')]='';this[_0xfbd6('0x13')](_0x3cb6e5);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x366f53,_0x5cdd88){if(this[_0xfbd6('0xf')][_0x366f53]){this[_0xfbd6('0xf')][_0x366f53][_0xfbd6('0x16')][_0xfbd6('0x17')]=_0xfbd6('0x29');this[_0xfbd6('0xf')][_0x366f53]['Imap'][_0xfbd6('0x18')]=_0x5cdd88[_0xfbd6('0x14')];if(_0x5cdd88[_0xfbd6('0x2a')]){this[_0xfbd6('0xf')][_0x366f53][_0xfbd6('0x16')]['total']=_0x5cdd88[_0xfbd6('0x2a')]['total'];}return this[_0xfbd6('0x13')](_0x366f53);}};EmailChannel['prototype'][_0xfbd6('0x2b')]=function(_0x1a1d1e,_0x54733d){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x54733d[_0xfbd6('0x2c')],_0x54733d[_0xfbd6('0x2d')],_0x54733d[_0xfbd6('0x2e')],_0x1a1d1e);if(this['mailAccounts'][_0x1a1d1e]){return mailAccount[_0xfbd6('0x2f')](_0x1a1d1e,_0x54733d)[_0xfbd6('0x30')](function(_0x1b57a8){if(_0x1b57a8){logger[_0xfbd6('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0xfbd6('0x31')](function(_0x3dd381){logger[_0xfbd6('0x26')](_0xfbd6('0x32'),JSON[_0xfbd6('0x33')](_0x3dd381));});}};EmailChannel[_0xfbd6('0x12')][_0xfbd6('0x25')]=function(_0x46d5a7){if(this[_0xfbd6('0xf')][_0x46d5a7]&&this[_0xfbd6('0xf')][_0x46d5a7]['Imap']){if(this[_0xfbd6('0x10')][this[_0xfbd6('0xf')][_0x46d5a7]['Imap']['id']]){delete this[_0xfbd6('0x10')][this[_0xfbd6('0xf')][_0x46d5a7][_0xfbd6('0x16')]['id']];}this[_0xfbd6('0xf')][_0x46d5a7][_0xfbd6('0x16')][_0xfbd6('0x34')]=moment();this[_0xfbd6('0x13')](_0x46d5a7);}};EmailChannel['prototype'][_0xfbd6('0x27')]=function(_0x1ee6be,_0x1051b3){if(this['mailAccounts'][_0x1ee6be]){this[_0xfbd6('0xf')][_0x1ee6be]['Imap'][_0xfbd6('0x17')]=_0xfbd6('0x26');this[_0xfbd6('0xf')][_0x1ee6be]['Imap']['messageStatus']=_0x1051b3;return this['emit'](_0x1ee6be);}};EmailChannel['prototype']['sendMail']=function(_0x5b98fa,_0x4cffd0){return this['smtp'][_0xfbd6('0x35')](_0x5b98fa,_0x4cffd0);};EmailChannel[_0xfbd6('0x12')][_0xfbd6('0x36')]=function(_0x189744){var _0x122482=this;if(this[_0xfbd6('0xf')][_0x189744['id']]){if(_['isNil'](this['mailAccounts'][_0x189744['id']]['Smtp'])){this[_0xfbd6('0xf')][_0x189744['id']]['Smtp']={};}this[_0xfbd6('0xf')][_0x189744['id']][_0xfbd6('0x37')][_0xfbd6('0x34')]=moment();return new BPromise(function(_0x57149a,_0x5cbd86){return _0x122482['smtp'][_0xfbd6('0x38')](_0x189744)[_0xfbd6('0x30')](function(_0x2c3daf){_0x122482[_0xfbd6('0xf')][_0x189744['id']][_0xfbd6('0x37')][_0xfbd6('0x17')]=_0xfbd6('0x39');_0x122482[_0xfbd6('0xf')][_0x189744['id']]['Smtp']['messageStatus']='';_0x122482[_0xfbd6('0x13')](_0x189744['id']);_0x57149a(_0x2c3daf);})['catch'](function(_0x5ebee8){_0x122482[_0xfbd6('0xf')][_0x189744['id']][_0xfbd6('0x37')][_0xfbd6('0x17')]='error';_0x122482[_0xfbd6('0xf')][_0x189744['id']][_0xfbd6('0x37')]['messageStatus']=_0x5ebee8;_0x122482[_0xfbd6('0x13')](_0x189744['id']);_0x5cbd86(_0x5ebee8);});});}return this[_0xfbd6('0x11')][_0xfbd6('0x38')](_0x189744);};module[_0xfbd6('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index ffd9df5..4841da0 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 _0x0af5=['generateXOAuth2Token','CloudProvider','data5','password','host','port','tls','autotls','required','prototype','openBox','mailbox','handleOpenBox','box','readUnseen','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','textCode','upperFirst','exports','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','handleReady','bind','once','end','handleEnd','error','handleError','connect','inherits','connTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2'];(function(_0x47a9ce,_0x1fbda6){var _0x320567=function(_0x2b1abb){while(--_0x2b1abb){_0x47a9ce['push'](_0x47a9ce['shift']());}};_0x320567(++_0x1fbda6);}(_0x0af5,0x158));var _0x50af=function(_0x9faf84,_0x58c079){_0x9faf84=_0x9faf84-0x0;var _0x5aaa3a=_0x0af5[_0x9faf84];return _0x5aaa3a;};'use strict';var _=require('lodash');var util=require(_0x50af('0x0'));var Imap=require(_0x50af('0x1'));var simpleParser=require(_0x50af('0x2'))[_0x50af('0x3')];var Iconv=require(_0x50af('0x4'))[_0x50af('0x5')];var EventEmitter=require(_0x50af('0x6'))[_0x50af('0x7')];var utils=require(_0x50af('0x8'));var logger=require(_0x50af('0x9'))(_0x50af('0xa'));function EmailImap(_0xe37b1,_0x5e94f8){this['mailbox']=_0x50af('0xb');this[_0x50af('0xc')]=this['getAccount'](_0xe37b1,_0x5e94f8);this['imap']=new Imap(this[_0x50af('0xc')]);this[_0x50af('0x1')]['once']('ready',this[_0x50af('0xd')][_0x50af('0xe')](this));this['imap'][_0x50af('0xf')](_0x50af('0x10'),this[_0x50af('0x11')][_0x50af('0xe')](this));this['imap']['on'](_0x50af('0x12'),this[_0x50af('0x13')][_0x50af('0xe')](this));this[_0x50af('0x1')][_0x50af('0x14')]();}util[_0x50af('0x15')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x569851,_0x620389){var _0x561cd2={'connTimeout':_0x569851[_0x50af('0x16')]?_0x569851[_0x50af('0x16')]*0x3e8:0x2710,'authTimeout':_0x569851['authTimeout']?_0x569851['authTimeout']*0x3e8:0x1388};if(_0x569851[_0x50af('0x17')]){_0x561cd2[_0x50af('0x18')]=_0x569851['user'];_0x561cd2['email']=_0x620389||_0x569851[_0x50af('0x18')]||_0x50af('0x19');if(_0x569851[_0x50af('0x1a')]){_0x561cd2[_0x50af('0x1b')]=utils[_0x50af('0x1c')](_0x569851[_0x50af('0x1d')][_0x50af('0x1e')],_0x569851[_0x50af('0x18')]);}else{_0x561cd2[_0x50af('0x1f')]=_0x569851[_0x50af('0x1f')];}}else{if(_0x569851['authentication']){_0x561cd2[_0x50af('0x18')]=_0x569851[_0x50af('0x18')];_0x561cd2[_0x50af('0x1f')]=_0x569851[_0x50af('0x1f')];}}_0x561cd2['host']=_0x569851[_0x50af('0x20')];_0x561cd2[_0x50af('0x21')]=_0x569851[_0x50af('0x21')]||0x3e1;if(_0x569851[_0x50af('0x22')]){_0x561cd2[_0x50af('0x22')]=!![];}else{_0x561cd2[_0x50af('0x22')]=![];_0x561cd2[_0x50af('0x23')]=_0x50af('0x24');}return _0x561cd2;};EmailImap[_0x50af('0x25')][_0x50af('0xd')]=function(){this['imap'][_0x50af('0x26')](this[_0x50af('0x27')],![],this[_0x50af('0x28')][_0x50af('0xe')](this));};EmailImap[_0x50af('0x25')][_0x50af('0x28')]=function(_0x4db72d,_0xb3c15a){if(_0x4db72d){this[_0x50af('0x13')](_0x4db72d,!![]);}else{this['emit'](_0x50af('0x29'),_0xb3c15a);this[_0x50af('0x2a')]();}};EmailImap[_0x50af('0x25')]['handleCloseBox']=function(_0x53af9d){if(_0x53af9d){this[_0x50af('0x13')](_0x53af9d,!![]);}else{this[_0x50af('0x1')][_0x50af('0x10')]();}};EmailImap[_0x50af('0x25')][_0x50af('0x2a')]=function(){this[_0x50af('0x1')][_0x50af('0x2b')]([_0x50af('0x2c')],this['handleReadUnseen'][_0x50af('0xe')](this));};EmailImap[_0x50af('0x25')][_0x50af('0x2d')]=function(_0x4db406,_0x43f1c8){if(_0x4db406){this['handleError'](_0x4db406,!![]);}else{if(_0x43f1c8[_0x50af('0x2e')]){try{var _0x52d65a=this['imap']['fetch'](_0x43f1c8,{'bodies':'','markSeen':!![]});_0x52d65a['on'](_0x50af('0x2f'),this[_0x50af('0x30')][_0x50af('0xe')](this));_0x52d65a[_0x50af('0xf')](_0x50af('0x12'),this[_0x50af('0x31')][_0x50af('0xe')](this));_0x52d65a[_0x50af('0xf')](_0x50af('0x10'),this[_0x50af('0x32')]['bind'](this));}catch(_0x4ad19b){logger[_0x50af('0x12')](_0x4ad19b);}}else{this[_0x50af('0x1')][_0x50af('0x33')](!![],this[_0x50af('0x34')]['bind'](this));}}};EmailImap[_0x50af('0x25')]['handleFetchMessage']=function(_0x5ac19f){_0x5ac19f['on']('body',this[_0x50af('0x35')][_0x50af('0xe')](this));_0x5ac19f[_0x50af('0xf')](_0x50af('0x36'),this[_0x50af('0x37')]['bind'](this));_0x5ac19f['once'](_0x50af('0x10'),this[_0x50af('0x38')][_0x50af('0xe')](this));};EmailImap[_0x50af('0x25')][_0x50af('0x35')]=function(_0x5560e8){simpleParser(_0x5560e8,{'Iconv':Iconv},this[_0x50af('0x39')][_0x50af('0xe')](this));};EmailImap[_0x50af('0x25')][_0x50af('0x37')]=function(){};EmailImap['prototype'][_0x50af('0x38')]=function(){};EmailImap[_0x50af('0x25')][_0x50af('0x39')]=function(_0x4bab50,_0x220fd8){if(_0x4bab50){logger['error'](_0x4bab50);}else{var _0x50ce3f=this;utils['parser'](this[_0x50af('0xc')],_0x220fd8,function(_0x35d38f){_0x50ce3f[_0x50af('0x3a')](_0x50af('0xa'),_0x35d38f);});}};EmailImap[_0x50af('0x25')][_0x50af('0x32')]=function(){this[_0x50af('0x1')][_0x50af('0x33')](!![],this[_0x50af('0x34')][_0x50af('0xe')](this));};EmailImap[_0x50af('0x25')][_0x50af('0x31')]=function(_0x42fc7d){this[_0x50af('0x13')](_0x42fc7d);this[_0x50af('0x1')][_0x50af('0x33')](!![],this['handleCloseBox'][_0x50af('0xe')](this));};EmailImap[_0x50af('0x25')][_0x50af('0x11')]=function(){this['emit']('end');};EmailImap[_0x50af('0x25')][_0x50af('0x13')]=function(_0x18f9dc,_0x456d1c){logger[_0x50af('0x12')](_0x50af('0x13'),this[_0x50af('0xc')][_0x50af('0xa')],JSON['stringify'](_0x18f9dc));var _0x59e451='';if(_0x18f9dc){if(_0x18f9dc[_0x50af('0x3b')]){_0x59e451=_0x18f9dc[_0x50af('0x3b')];}else{for(var _0x52fcb4 in _0x18f9dc){if(_0x18f9dc['hasOwnProperty'](_0x52fcb4)){_0x59e451+=_[_0x50af('0x3c')](_0x52fcb4)+':\x20'+_0x18f9dc[_0x52fcb4]+'\x0a';}}}}if(_0x456d1c){this[_0x50af('0x1')][_0x50af('0x10')]();}else{this['emit'](_0x50af('0x12'),_0x59e451);this[_0x50af('0x3a')](_0x50af('0x10'));}};module[_0x50af('0x3d')]=EmailImap; \ No newline at end of file +var _0xba34=['password','authentication','host','port','tls','autotls','openBox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleSimpleParser','handleMessageAttributes','handleMessageEnd','parser','stringify','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider'];(function(_0x26e159,_0x59d747){var _0x571cf3=function(_0x33af9f){while(--_0x33af9f){_0x26e159['push'](_0x26e159['shift']());}};_0x571cf3(++_0x59d747);}(_0xba34,0x119));var _0x4ba3=function(_0x4b0be9,_0x19ddbb){_0x4b0be9=_0x4b0be9-0x0;var _0x52f617=_0xba34[_0x4b0be9];return _0x52f617;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var Imap=require(_0x4ba3('0x2'));var simpleParser=require(_0x4ba3('0x3'))[_0x4ba3('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require('events')[_0x4ba3('0x5')];var utils=require(_0x4ba3('0x6'));var logger=require(_0x4ba3('0x7'))(_0x4ba3('0x8'));function EmailImap(_0x3590a1,_0xb88621){this[_0x4ba3('0x9')]='INBOX';this[_0x4ba3('0xa')]=this[_0x4ba3('0xb')](_0x3590a1,_0xb88621);this[_0x4ba3('0x2')]=new Imap(this[_0x4ba3('0xa')]);this[_0x4ba3('0x2')][_0x4ba3('0xc')](_0x4ba3('0xd'),this[_0x4ba3('0xe')][_0x4ba3('0xf')](this));this[_0x4ba3('0x2')][_0x4ba3('0xc')]('end',this[_0x4ba3('0x10')][_0x4ba3('0xf')](this));this['imap']['on'](_0x4ba3('0x11'),this['handleError'][_0x4ba3('0xf')](this));this['imap'][_0x4ba3('0x12')]();}util[_0x4ba3('0x13')](EmailImap,EventEmitter);EmailImap[_0x4ba3('0x14')][_0x4ba3('0xb')]=function(_0x2bc796,_0x3d2ace){var _0x3a74f7={'connTimeout':_0x2bc796[_0x4ba3('0x15')]?_0x2bc796[_0x4ba3('0x15')]*0x3e8:0x2710,'authTimeout':_0x2bc796[_0x4ba3('0x16')]?_0x2bc796[_0x4ba3('0x16')]*0x3e8:0x1388};if(_0x2bc796[_0x4ba3('0x17')]){_0x3a74f7[_0x4ba3('0x18')]=_0x2bc796[_0x4ba3('0x18')];_0x3a74f7[_0x4ba3('0x8')]=_0x3d2ace||_0x2bc796[_0x4ba3('0x18')]||'anonymous@xcally.com';if(_0x2bc796[_0x4ba3('0x19')]){_0x3a74f7[_0x4ba3('0x1a')]=utils[_0x4ba3('0x1b')](_0x2bc796[_0x4ba3('0x1c')]['data5'],_0x2bc796[_0x4ba3('0x18')]);}else{_0x3a74f7[_0x4ba3('0x1d')]=_0x2bc796[_0x4ba3('0x1d')];}}else{if(_0x2bc796[_0x4ba3('0x1e')]){_0x3a74f7[_0x4ba3('0x18')]=_0x2bc796[_0x4ba3('0x18')];_0x3a74f7['password']=_0x2bc796['password'];}}_0x3a74f7[_0x4ba3('0x1f')]=_0x2bc796['host'];_0x3a74f7[_0x4ba3('0x20')]=_0x2bc796[_0x4ba3('0x20')]||0x3e1;if(_0x2bc796[_0x4ba3('0x21')]){_0x3a74f7[_0x4ba3('0x21')]=!![];}else{_0x3a74f7[_0x4ba3('0x21')]=![];_0x3a74f7[_0x4ba3('0x22')]='required';}return _0x3a74f7;};EmailImap[_0x4ba3('0x14')][_0x4ba3('0xe')]=function(){this['imap'][_0x4ba3('0x23')](this['mailbox'],![],this[_0x4ba3('0x24')][_0x4ba3('0xf')](this));};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x24')]=function(_0x152e41,_0xe29a49){if(_0x152e41){this[_0x4ba3('0x25')](_0x152e41,!![]);}else{this[_0x4ba3('0x26')](_0x4ba3('0x27'),_0xe29a49);this[_0x4ba3('0x28')]();}};EmailImap['prototype'][_0x4ba3('0x29')]=function(_0x13c353){if(_0x13c353){this[_0x4ba3('0x25')](_0x13c353,!![]);}else{this['imap'][_0x4ba3('0x2a')]();}};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x28')]=function(){this['imap'][_0x4ba3('0x2b')]([_0x4ba3('0x2c')],this[_0x4ba3('0x2d')][_0x4ba3('0xf')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x38ef88,_0x33cad6){if(_0x38ef88){this[_0x4ba3('0x25')](_0x38ef88,!![]);}else{if(_0x33cad6[_0x4ba3('0x2e')]){try{var _0x2cb5d5=this[_0x4ba3('0x2')]['fetch'](_0x33cad6,{'bodies':'','markSeen':!![]});_0x2cb5d5['on'](_0x4ba3('0x2f'),this[_0x4ba3('0x30')][_0x4ba3('0xf')](this));_0x2cb5d5[_0x4ba3('0xc')](_0x4ba3('0x11'),this[_0x4ba3('0x31')][_0x4ba3('0xf')](this));_0x2cb5d5[_0x4ba3('0xc')](_0x4ba3('0x2a'),this[_0x4ba3('0x32')]['bind'](this));}catch(_0x5a453f){logger['error'](_0x5a453f);}}else{this[_0x4ba3('0x2')][_0x4ba3('0x33')](!![],this[_0x4ba3('0x29')][_0x4ba3('0xf')](this));}}};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x30')]=function(_0x137551){_0x137551['on'](_0x4ba3('0x34'),this[_0x4ba3('0x35')][_0x4ba3('0xf')](this));_0x137551[_0x4ba3('0xc')](_0x4ba3('0x36'),this['handleMessageAttributes'][_0x4ba3('0xf')](this));_0x137551[_0x4ba3('0xc')](_0x4ba3('0x2a'),this['handleMessageEnd'][_0x4ba3('0xf')](this));};EmailImap['prototype'][_0x4ba3('0x35')]=function(_0x1cc70e){simpleParser(_0x1cc70e,{'Iconv':Iconv},this[_0x4ba3('0x37')][_0x4ba3('0xf')](this));};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x38')]=function(){};EmailImap['prototype'][_0x4ba3('0x39')]=function(){};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x37')]=function(_0x4b702b,_0x1865b8){if(_0x4b702b){logger[_0x4ba3('0x11')](_0x4b702b);}else{var _0x4d22db=this;utils[_0x4ba3('0x3a')](this['account'],_0x1865b8,function(_0x4c126d){_0x4d22db[_0x4ba3('0x26')](_0x4ba3('0x8'),_0x4c126d);});}};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x32')]=function(){this[_0x4ba3('0x2')]['closeBox'](!![],this[_0x4ba3('0x29')][_0x4ba3('0xf')](this));};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x31')]=function(_0xab7983){this[_0x4ba3('0x25')](_0xab7983);this[_0x4ba3('0x2')][_0x4ba3('0x33')](!![],this['handleCloseBox'][_0x4ba3('0xf')](this));};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x10')]=function(){this[_0x4ba3('0x26')](_0x4ba3('0x2a'));};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x25')]=function(_0xdcc2a2,_0x15d305){logger[_0x4ba3('0x11')](_0x4ba3('0x25'),this[_0x4ba3('0xa')][_0x4ba3('0x8')],JSON[_0x4ba3('0x3b')](_0xdcc2a2));var _0x4a1522='';if(_0xdcc2a2){if(_0xdcc2a2['textCode']){_0x4a1522=_0xdcc2a2['textCode'];}else{for(var _0x48280f in _0xdcc2a2){if(_0xdcc2a2['hasOwnProperty'](_0x48280f)){_0x4a1522+=_[_0x4ba3('0x3c')](_0x48280f)+':\x20'+_0xdcc2a2[_0x48280f]+'\x0a';}}}}if(_0x15d305){this['imap'][_0x4ba3('0x2a')]();}else{this['emit'](_0x4ba3('0x11'),_0x4a1522);this[_0x4ba3('0x26')](_0x4ba3('0x2a'));}};module[_0x4ba3('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index d9343f8..e055d44 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 _0xf717=['compile','toString','verify','createTransport','nodemailer','nodemailer-plugin-inline-base64','prototype','send'];(function(_0x4fb432,_0x32e550){var _0x1d6454=function(_0x4d202e){while(--_0x4d202e){_0x4fb432['push'](_0x4fb432['shift']());}};_0x1d6454(++_0x32e550);}(_0xf717,0x13c));var _0x7f71=function(_0x84d960,_0x3dc95f){_0x84d960=_0x84d960-0x0;var _0x493ee0=_0xf717[_0x84d960];return _0x493ee0;};'use strict';var nodemailer=require(_0x7f71('0x0'));var inlineBase64=require(_0x7f71('0x1'));function EmailSmtp(){}EmailSmtp[_0x7f71('0x2')][_0x7f71('0x3')]=function(_0x2faa38,_0x4b599b){return new Promise(function(_0x38d443,_0x50306e){var _0xbcaaed=nodemailer['createTransport'](_0x2faa38);_0xbcaaed['use'](_0x7f71('0x4'),inlineBase64());_0xbcaaed['sendMail'](_0x4b599b,function(_0x45ae20,_0x66b54e){if(_0x45ae20){_0x50306e(_0x45ae20[_0x7f71('0x5')]());}else{_0x38d443(_0x66b54e);}});});};EmailSmtp[_0x7f71('0x2')][_0x7f71('0x6')]=function(_0x39fab2){return new Promise(function(_0x5032a5,_0x3b9a64){var _0x2eb446=nodemailer[_0x7f71('0x7')](_0x39fab2);_0x2eb446['verify'](function(_0x19ad56,_0x2c521b){if(_0x19ad56){_0x3b9a64(_0x19ad56[_0x7f71('0x5')]());}else{if(_0x2c521b){_0x5032a5(_0x2c521b);}else{_0x3b9a64('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x56d3=['exports','nodemailer-plugin-inline-base64','createTransport','use','compile','sendMail','toString','prototype','verify'];(function(_0x3585ad,_0x2a9e9c){var _0xcd7347=function(_0x59a596){while(--_0x59a596){_0x3585ad['push'](_0x3585ad['shift']());}};_0xcd7347(++_0x2a9e9c);}(_0x56d3,0x17b));var _0x356d=function(_0x56dac6,_0x291782){_0x56dac6=_0x56dac6-0x0;var _0x5766f1=_0x56d3[_0x56dac6];return _0x5766f1;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x356d('0x0'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x50a9c6,_0x4bfa19){return new Promise(function(_0x97f2e5,_0x3be64d){var _0x4caf16=nodemailer[_0x356d('0x1')](_0x50a9c6);_0x4caf16[_0x356d('0x2')](_0x356d('0x3'),inlineBase64());_0x4caf16[_0x356d('0x4')](_0x4bfa19,function(_0x30bb2d,_0x213d33){if(_0x30bb2d){_0x3be64d(_0x30bb2d[_0x356d('0x5')]());}else{_0x97f2e5(_0x213d33);}});});};EmailSmtp[_0x356d('0x6')][_0x356d('0x7')]=function(_0x2e3365){return new Promise(function(_0x2cbc9d,_0x508397){var _0x5e616c=nodemailer['createTransport'](_0x2e3365);_0x5e616c[_0x356d('0x7')](function(_0x4586d4,_0x26f931){if(_0x4586d4){_0x508397(_0x4586d4[_0x356d('0x5')]());}else{if(_0x26f931){_0x2cbc9d(_0x26f931);}else{_0x508397('Not\x20verifired');}}});});};module[_0x356d('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 37238ea..3ff6dd3 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 _0xd24a=['path','../../../config/logger','email','value','address','anonymous','@xcally.com','head','name','substring','indexOf','split','slice','Anonymous','length','pop','isEmpty','generate','html','test','replace','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','join','utf-8','toString','randomstring'];(function(_0x3e8fa1,_0x8c055c){var _0x5e1ab8=function(_0x4205f4){while(--_0x4205f4){_0x3e8fa1['push'](_0x3e8fa1['shift']());}};_0x5e1ab8(++_0x8c055c);}(_0xd24a,0x1c7));var _0xad24=function(_0x4953ea,_0x20a7bc){_0x4953ea=_0x4953ea-0x0;var _0x115f04=_0xd24a[_0x4953ea];return _0x115f04;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0xad24('0x0'));var fs=require('fs');var path=require(_0xad24('0x1'));var util=require('util');var tnef=require('node-tnef');var logger=require(_0xad24('0x2'))(_0xad24('0x3'));var config=require('../../../config/environment');function getAddress(_0x34c86d){var _0x4d8f4a=_['head'](_0x34c86d[_0xad24('0x4')]);return _0x4d8f4a&&_0x4d8f4a['address']?_0x4d8f4a[_0xad24('0x5')]:_0xad24('0x6')+random['generate'](0x6)+_0xad24('0x7');}function getFirstName(_0x184a0c){var _0x2cfcc6=_[_0xad24('0x8')](_0x184a0c['value']);if(_0x2cfcc6&&_0x2cfcc6['name']){if(_0x2cfcc6['name']==_0x2cfcc6['address']){return _0x2cfcc6[_0xad24('0x9')][_0xad24('0xa')](0x0,_0x2cfcc6[_0xad24('0x9')][_0xad24('0xb')]('@'));}var _0x152774=_0x2cfcc6[_0xad24('0x9')][_0xad24('0xc')](/\s+/);return _0x152774['length']>0x1?_0x152774[_0xad24('0xd')](0x0,-0x1)['join']('\x20'):_0x2cfcc6[_0xad24('0x9')];}return _0xad24('0xe');}function getLastName(_0x2f62b1){var _0x11ea90=_[_0xad24('0x8')](_0x2f62b1[_0xad24('0x4')]);if(_0x11ea90&&_0x11ea90[_0xad24('0x9')]){var _0x298b14=_0x11ea90['name'][_0xad24('0xc')](/\s+/);return _0x298b14[_0xad24('0xf')]>0x1?_0x298b14[_0xad24('0x10')]():'';}return'';}function getMails(_0x31e323,_0x4c2f11){var _0x512786='';for(var _0x10a9b7=0x0;_0x10a9b7<_0x4c2f11[_0xad24('0x4')]['length'];_0x10a9b7+=0x1){if(_0x4c2f11[_0xad24('0x4')][_0x10a9b7][_0xad24('0x5')]!==_0x31e323){if(!_[_0xad24('0x11')](_0x512786)){_0x512786+=',';}_0x512786+=_0x4c2f11['value'][_0x10a9b7]['name']||_0x4c2f11[_0xad24('0x4')][_0x10a9b7][_0xad24('0x5')]||'';_0x512786+='\x20<';_0x512786+=_0x4c2f11[_0xad24('0x4')][_0x10a9b7]['address']?_0x4c2f11['value'][_0x10a9b7]['address']:_0xad24('0x6')+random[_0xad24('0x12')](0x6)+_0xad24('0x7');_0x512786+='>';}}return _0x512786;}function parseEmail(_0x1762e1,_0x1c4117,_0x506606){if(_0x1c4117[_0xad24('0x13')]){var _0x380926=/)<[^<]*)*<\/script>/gi;while(_0x380926[_0xad24('0x14')](_0x1c4117[_0xad24('0x13')])){_0x1c4117[_0xad24('0x13')]=_0x1c4117[_0xad24('0x13')][_0xad24('0x15')](_0x380926,'');}if(_0x1c4117[_0xad24('0x13')]['includes']('{_0x4e34b9[_0xad24('0x18')](_0x237af8[_0xad24('0x19')]);});var _0x1bf4cb=/]+>/g;var _0x12fa6f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x57acbb=_0x1c4117[_0xad24('0x13')][_0xad24('0x15')](_0x12fa6f,_0xad24('0x1a'));var _0x306eed=_0x57acbb[_0xad24('0x15')](_0x1bf4cb,'_IMG');for(let _0x4a3030=0x0;_0x4a3030<_0x4e34b9[_0xad24('0xf')];_0x4a3030++){var _0x41dcd5=_0x306eed[_0xad24('0x15')](_0xad24('0x1b'),_0xad24('0x1c')+_0x4e34b9[_0x4a3030]+_0xad24('0x1d'));_0x306eed=_0x41dcd5;}_0x1c4117[_0xad24('0x13')]=_0x306eed;}_0x506606['body']=_0x1c4117[_0xad24('0x13')];}else{_0x506606[_0xad24('0x1e')]=_0x1c4117[_0xad24('0x1f')];}if(_0x506606[_0xad24('0x1e')]){_0x506606[_0xad24('0x1e')]=_0x506606[_0xad24('0x1e')]['replace'](/0x0){var _0x198984=[_0xad24('0x31'),'X-Auto-Response-Suppress:\x20All',_0xad24('0x32')];for(var _0x638725=0x0;_0x638725<_0x1c4117['headerLines'][_0xad24('0xf')];_0x638725++){var _0x2bbe2c=_[_0xad24('0xb')](_0x198984,_0x1c4117[_0xad24('0x30')][_0x638725][_0xad24('0x33')]);if(_0x2bbe2c>=0x0){_0x506606[_0xad24('0x34')]=!![];}}}return _0x506606;}exports[_0xad24('0x35')]=function(_0x143264,_0x2a6050,_0x5aa25e){var _0x445b17={'from':getAddress(_0x2a6050['from']),'firstName':getFirstName(_0x2a6050[_0xad24('0x36')]),'lastName':getLastName(_0x2a6050[_0xad24('0x36')]),'mapKey':'email','message':{'from':getMails(_0x143264['email'],_0x2a6050['from']),'to':_0x143264[_0xad24('0x3')],'cc':'','subject':_0x2a6050[_0xad24('0x37')]||'','messageId':_0x2a6050['messageId'],'inReplyTo':_0x2a6050[_0xad24('0x38')],'sentAt':moment(_0x2a6050['date'])[_0xad24('0x39')](_0xad24('0x3a')),'attach':![],'attachments':[]}};if(!_0x2a6050['html']&&!_0x2a6050[_0xad24('0x1f')]){var _0x3e1fdf=_[_0xad24('0x3b')](_0x2a6050[_0xad24('0x16')],{'contentType':_0xad24('0x3c')});if(_0x3e1fdf[_0xad24('0xf')]){logger[_0xad24('0x3d')](util[_0xad24('0x39')](_0xad24('0x3e'),_0x2a6050[_0xad24('0x3f')]));tnef[_0xad24('0x40')](_[_0xad24('0x41')](_0x3e1fdf)[_0xad24('0x2e')],function(_0x4eae00,_0x2ab428){if(_0x2ab428){_0x2a6050[_0xad24('0x13')]=_0x2ab428[_0xad24('0x42')]||_0xad24('0x43');if(_0x2ab428[_0xad24('0x44')]){for(var _0x491c90=0x0;_0x491c90<_0x2ab428[_0xad24('0x44')]['length'];_0x491c90++){var _0x5275da=_0x2ab428[_0xad24('0x44')][_0x491c90];_0x445b17[_0xad24('0x21')][_0xad24('0x16')][_0xad24('0x18')]({'filename':_0x5275da[_0xad24('0x45')],'content':Buffer[_0xad24('0x36')](_0x5275da[_0xad24('0x46')])});}}}_0x5aa25e(parseEmail(_0x143264,_0x2a6050,_0x445b17));});}else{_0x2a6050[_0xad24('0x13')]='

Empty\x20message

';_0x5aa25e(parseEmail(_0x143264,_0x2a6050,_0x445b17));}}else{_0x5aa25e(parseEmail(_0x143264,_0x2a6050,_0x445b17));}};exports['generateXOAuth2Token']=function(_0x4c7f3b,_0x993208){var _0x1f54fc=[_0xad24('0x47')+(_0x993208||''),_0xad24('0x48')+_0x4c7f3b,'',''];return Buffer[_0xad24('0x36')](_0x1f54fc[_0xad24('0x49')](''),_0xad24('0x4a'))[_0xad24('0x4b')]('base64');}; \ No newline at end of file +var _0xb27b=['node-tnef','../../../config/logger','../../../config/environment','head','address','anonymous','generate','@xcally.com','value','name','substring','indexOf','split','length','slice','join','pop','isEmpty','html','test','','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','base64','lodash','moment','path','util'];(function(_0x13fdc7,_0x4ca0d4){var _0x2f690d=function(_0x14f6b0){while(--_0x14f6b0){_0x13fdc7['push'](_0x13fdc7['shift']());}};_0x2f690d(++_0x4ca0d4);}(_0xb27b,0x169));var _0xbb27=function(_0x25a152,_0x5795f9){_0x25a152=_0x25a152-0x0;var _0x26f30b=_0xb27b[_0x25a152];return _0x26f30b;};'use strict';var _=require(_0xbb27('0x0'));var moment=require(_0xbb27('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xbb27('0x2'));var util=require(_0xbb27('0x3'));var tnef=require(_0xbb27('0x4'));var logger=require(_0xbb27('0x5'))('email');var config=require(_0xbb27('0x6'));function getAddress(_0x4d4cc4){var _0x3607fb=_[_0xbb27('0x7')](_0x4d4cc4['value']);return _0x3607fb&&_0x3607fb[_0xbb27('0x8')]?_0x3607fb[_0xbb27('0x8')]:_0xbb27('0x9')+random[_0xbb27('0xa')](0x6)+_0xbb27('0xb');}function getFirstName(_0x510c41){var _0x300c5e=_[_0xbb27('0x7')](_0x510c41[_0xbb27('0xc')]);if(_0x300c5e&&_0x300c5e[_0xbb27('0xd')]){if(_0x300c5e[_0xbb27('0xd')]==_0x300c5e['address']){return _0x300c5e[_0xbb27('0xd')][_0xbb27('0xe')](0x0,_0x300c5e[_0xbb27('0xd')][_0xbb27('0xf')]('@'));}var _0x3517d1=_0x300c5e[_0xbb27('0xd')][_0xbb27('0x10')](/\s+/);return _0x3517d1[_0xbb27('0x11')]>0x1?_0x3517d1[_0xbb27('0x12')](0x0,-0x1)[_0xbb27('0x13')]('\x20'):_0x300c5e['name'];}return'Anonymous';}function getLastName(_0x4f313b){var _0x1cddf5=_[_0xbb27('0x7')](_0x4f313b['value']);if(_0x1cddf5&&_0x1cddf5['name']){var _0x38f463=_0x1cddf5[_0xbb27('0xd')][_0xbb27('0x10')](/\s+/);return _0x38f463['length']>0x1?_0x38f463[_0xbb27('0x14')]():'';}return'';}function getMails(_0xf5d98f,_0x301860){var _0x411544='';for(var _0x2ead03=0x0;_0x2ead03<_0x301860[_0xbb27('0xc')]['length'];_0x2ead03+=0x1){if(_0x301860[_0xbb27('0xc')][_0x2ead03][_0xbb27('0x8')]!==_0xf5d98f){if(!_[_0xbb27('0x15')](_0x411544)){_0x411544+=',';}_0x411544+=_0x301860[_0xbb27('0xc')][_0x2ead03][_0xbb27('0xd')]||_0x301860['value'][_0x2ead03][_0xbb27('0x8')]||'';_0x411544+='\x20<';_0x411544+=_0x301860[_0xbb27('0xc')][_0x2ead03][_0xbb27('0x8')]?_0x301860[_0xbb27('0xc')][_0x2ead03][_0xbb27('0x8')]:'anonymous'+random[_0xbb27('0xa')](0x6)+_0xbb27('0xb');_0x411544+='>';}}return _0x411544;}function parseEmail(_0x34a58b,_0x6d8137,_0x94bbbf){if(_0x6d8137[_0xbb27('0x16')]){var _0x7677de=/)<[^<]*)*<\/script>/gi;while(_0x7677de[_0xbb27('0x17')](_0x6d8137[_0xbb27('0x16')])){_0x6d8137['html']=_0x6d8137[_0xbb27('0x16')]['replace'](_0x7677de,'');}if(_0x6d8137[_0xbb27('0x16')]['includes'](_0xbb27('0x18'))){var _0x327ccc=[];_0x6d8137[_0xbb27('0x19')][_0xbb27('0x1a')](_0x1b5ac2=>{_0x327ccc[_0xbb27('0x1b')](_0x1b5ac2[_0xbb27('0x1c')]);});var _0x254253=/]+>/g;var _0x5ddb25=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5be61b=_0x6d8137[_0xbb27('0x16')][_0xbb27('0x1d')](_0x5ddb25,_0xbb27('0x1e'));var _0x3f08fe=_0x5be61b[_0xbb27('0x1d')](_0x254253,'_IMG');for(let _0x50f38c=0x0;_0x50f38c<_0x327ccc[_0xbb27('0x11')];_0x50f38c++){var _0x14f35a=_0x3f08fe[_0xbb27('0x1d')](_0xbb27('0x1f'),'\x20[Attachment:\x20'+_0x327ccc[_0x50f38c]+_0xbb27('0x20'));_0x3f08fe=_0x14f35a;}_0x6d8137[_0xbb27('0x16')]=_0x3f08fe;}_0x94bbbf[_0xbb27('0x21')]=_0x6d8137[_0xbb27('0x16')];}else{_0x94bbbf[_0xbb27('0x21')]=_0x6d8137[_0xbb27('0x22')];}if(_0x94bbbf[_0xbb27('0x21')]){_0x94bbbf['body']=_0x94bbbf[_0xbb27('0x21')]['replace'](/0x0){var _0x33693b=['Auto-Submitted:\x20auto-replied',_0xbb27('0x32'),_0xbb27('0x33')];for(var _0x2980c3=0x0;_0x2980c3<_0x6d8137[_0xbb27('0x31')]['length'];_0x2980c3++){var _0x51407f=_[_0xbb27('0xf')](_0x33693b,_0x6d8137['headerLines'][_0x2980c3][_0xbb27('0x34')]);if(_0x51407f>=0x0){_0x94bbbf['isAutoreply']=!![];}}}return _0x94bbbf;}exports[_0xbb27('0x35')]=function(_0x79bfc6,_0x346cd5,_0x25d945){var _0x32ad19={'from':getAddress(_0x346cd5[_0xbb27('0x36')]),'firstName':getFirstName(_0x346cd5[_0xbb27('0x36')]),'lastName':getLastName(_0x346cd5[_0xbb27('0x36')]),'mapKey':_0xbb27('0x25'),'message':{'from':getMails(_0x79bfc6['email'],_0x346cd5[_0xbb27('0x36')]),'to':_0x79bfc6[_0xbb27('0x25')],'cc':'','subject':_0x346cd5['subject']||'','messageId':_0x346cd5[_0xbb27('0x37')],'inReplyTo':_0x346cd5['inReplyTo'],'sentAt':moment(_0x346cd5[_0xbb27('0x38')])[_0xbb27('0x2b')](_0xbb27('0x39')),'attach':![],'attachments':[]}};if(!_0x346cd5[_0xbb27('0x16')]&&!_0x346cd5[_0xbb27('0x22')]){var _0x457daa=_[_0xbb27('0x3a')](_0x346cd5[_0xbb27('0x19')],{'contentType':_0xbb27('0x3b')});if(_0x457daa[_0xbb27('0x11')]){logger['info'](util['format'](_0xbb27('0x3c'),_0x346cd5[_0xbb27('0x37')]));tnef[_0xbb27('0x3d')](_[_0xbb27('0x3e')](_0x457daa)[_0xbb27('0x2f')],function(_0x421f9d,_0x33f36a){if(_0x33f36a){_0x346cd5[_0xbb27('0x16')]=_0x33f36a[_0xbb27('0x3f')]||_0xbb27('0x40');if(_0x33f36a[_0xbb27('0x41')]){for(var _0x3a7f0b=0x0;_0x3a7f0b<_0x33f36a[_0xbb27('0x41')][_0xbb27('0x11')];_0x3a7f0b++){var _0x433709=_0x33f36a[_0xbb27('0x41')][_0x3a7f0b];_0x32ad19[_0xbb27('0x24')][_0xbb27('0x19')]['push']({'filename':_0x433709[_0xbb27('0x42')],'content':Buffer[_0xbb27('0x36')](_0x433709[_0xbb27('0x43')])});}}}_0x25d945(parseEmail(_0x79bfc6,_0x346cd5,_0x32ad19));});}else{_0x346cd5[_0xbb27('0x16')]='

Empty\x20message

';_0x25d945(parseEmail(_0x79bfc6,_0x346cd5,_0x32ad19));}}else{_0x25d945(parseEmail(_0x79bfc6,_0x346cd5,_0x32ad19));}};exports[_0xbb27('0x44')]=function(_0x71650e,_0x4c7551){var _0x5e9f97=[_0xbb27('0x45')+(_0x4c7551||''),_0xbb27('0x46')+_0x71650e,'',''];return Buffer[_0xbb27('0x36')](_0x5e9f97[_0xbb27('0x13')](''),_0xbb27('0x47'))['toString'](_0xbb27('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index df502b0..02fa829 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 _0xb11f=['lodash','name','Service','key','active','Imap','Smtp'];(function(_0x4c79ce,_0x382dc3){var _0x1826d2=function(_0x744ac0){while(--_0x744ac0){_0x4c79ce['push'](_0x4c79ce['shift']());}};_0x1826d2(++_0x382dc3);}(_0xb11f,0x7e));var _0xfb11=function(_0x4caf4f,_0x1f9d37){_0x4caf4f=_0x4caf4f-0x0;var _0xf64dd9=_0xb11f[_0x4caf4f];return _0xf64dd9;};'use strict';var _=require(_0xfb11('0x0'));function MailAccount(_0x5437fb){this['id']=_0x5437fb['id']||0x0;this[_0xfb11('0x1')]=_0x5437fb[_0xfb11('0x1')]||_0xfb11('0x2');this['key']=_0x5437fb[_0xfb11('0x3')]||'SERV';this[_0xfb11('0x4')]=_0x5437fb['active']||![];this[_0xfb11('0x5')]=_0x5437fb['Imap']||[];this[_0xfb11('0x6')]=_0x5437fb[_0xfb11('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x2b6e=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x24cf7d,_0x11b8cf){var _0x238453=function(_0x5ccef8){while(--_0x5ccef8){_0x24cf7d['push'](_0x24cf7d['shift']());}};_0x238453(++_0x11b8cf);}(_0x2b6e,0x185));var _0xe2b6=function(_0x2dd3d5,_0x3cb473){_0x2dd3d5=_0x2dd3d5-0x0;var _0x212ed4=_0x2b6e[_0x2dd3d5];return _0x212ed4;};'use strict';var _=require(_0xe2b6('0x0'));function MailAccount(_0x45614c){this['id']=_0x45614c['id']||0x0;this[_0xe2b6('0x1')]=_0x45614c['name']||_0xe2b6('0x2');this['key']=_0x45614c[_0xe2b6('0x3')]||_0xe2b6('0x4');this[_0xe2b6('0x5')]=_0x45614c[_0xe2b6('0x5')]||![];this[_0xe2b6('0x6')]=_0x45614c[_0xe2b6('0x6')]||[];this[_0xe2b6('0x7')]=_0x45614c[_0xe2b6('0x7')]||[];}module[_0xe2b6('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 80c2ba5..7afa79a 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 _0x0d67=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','merge','lodash'];(function(_0x183a9b,_0x5edd00){var _0x58fa64=function(_0x7d5ad2){while(--_0x7d5ad2){_0x183a9b['push'](_0x183a9b['shift']());}};_0x58fa64(++_0x5edd00);}(_0x0d67,0xc5));var _0x70d6=function(_0x3b5ccb,_0x3c7d78){_0x3b5ccb=_0x3b5ccb-0x0;var _0x2c6c10=_0x0d67[_0x3b5ccb];return _0x2c6c10;};'use strict';var _=require(_0x70d6('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x70d6('0x1')]={};};function freeIsNotKey(_0x141c96,_0x5a1aec,_0x4db3b8){var _0x2c40aa=_[_0x70d6('0x2')](_0x141c96,function(_0xb83dc9,_0x1c2977){return _0xb83dc9[_0x4db3b8];});for(var _0x531f7c in _0x5a1aec){if(_0x5a1aec[_0x70d6('0x3')](_0x531f7c)){if(!_0x2c40aa[_0x531f7c]){delete _0x5a1aec[_0x531f7c];}}}}Realtime[_0x70d6('0x4')][_0x70d6('0x5')]=function(_0x21ca7b,_0x940f07){for(var _0x188737 in _0x940f07){if(_0x21ca7b[_0x70d6('0x3')](_0x188737)){_0x21ca7b[_0x188737]=_0x940f07[_0x188737];}}};Realtime['prototype'][_0x70d6('0x6')]=function(){var _0x351562=this;return function(_0x3e9dd9){if(_0x3e9dd9){freeIsNotKey(_0x3e9dd9,_0x351562[_0x70d6('0x1')],'id');for(var _0x317be6=0x0,_0x2ec434={},_0x3e3037={};_0x317be6<_0x3e9dd9[_0x70d6('0x7')];_0x317be6+=0x1){_0x2ec434=_0x3e9dd9[_0x317be6];if(_['isUndefined'](_0x351562['mailAccounts'][_0x2ec434['id']])){_0x351562[_0x70d6('0x1')][_0x2ec434['id']]=new MailAccount(_0x2ec434);}else{_[_0x70d6('0x8')](_0x351562['mailAccounts'][_0x2ec434['id']],_0x2ec434);}}}return _0x351562[_0x70d6('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0xf7c5=['prototype','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mapKeys','mergeFromDatabase','hasOwnProperty'];(function(_0x115ad0,_0x5dc4f4){var _0x25043c=function(_0x9f1dcc){while(--_0x9f1dcc){_0x115ad0['push'](_0x115ad0['shift']());}};_0x25043c(++_0x5dc4f4);}(_0xf7c5,0x1b3));var _0x5f7c=function(_0x1200e9,_0x1a23a4){_0x1200e9=_0x1200e9-0x0;var _0x2c1ac4=_0xf7c5[_0x1200e9];return _0x2c1ac4;};'use strict';var _=require('lodash');var MailAccount=require(_0x5f7c('0x0'));var Realtime=function(){this[_0x5f7c('0x1')]={};};function freeIsNotKey(_0x13f825,_0x489c7e,_0x3ec86a){var _0x5ca8bc=_[_0x5f7c('0x2')](_0x13f825,function(_0x189cc4,_0x3c735d){return _0x189cc4[_0x3ec86a];});for(var _0x4fa426 in _0x489c7e){if(_0x489c7e['hasOwnProperty'](_0x4fa426)){if(!_0x5ca8bc[_0x4fa426]){delete _0x489c7e[_0x4fa426];}}}}Realtime['prototype'][_0x5f7c('0x3')]=function(_0x5e9974,_0xbb8ea){for(var _0xb7a01c in _0xbb8ea){if(_0x5e9974[_0x5f7c('0x4')](_0xb7a01c)){_0x5e9974[_0xb7a01c]=_0xbb8ea[_0xb7a01c];}}};Realtime[_0x5f7c('0x5')][_0x5f7c('0x6')]=function(){var _0x3b3236=this;return function(_0x33ec53){if(_0x33ec53){freeIsNotKey(_0x33ec53,_0x3b3236['mailAccounts'],'id');for(var _0xaf4177=0x0,_0x5699fa={},_0x6441fc={};_0xaf4177<_0x33ec53[_0x5f7c('0x7')];_0xaf4177+=0x1){_0x5699fa=_0x33ec53[_0xaf4177];if(_[_0x5f7c('0x8')](_0x3b3236[_0x5f7c('0x1')][_0x5699fa['id']])){_0x3b3236[_0x5f7c('0x1')][_0x5699fa['id']]=new MailAccount(_0x5699fa);}else{_[_0x5f7c('0x9')](_0x3b3236['mailAccounts'][_0x5699fa['id']],_0x5699fa);}}}return _0x3b3236[_0x5f7c('0x1')];};};module[_0x5f7c('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 d2ba9ac..6b9d70b 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 _0x147b=['getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','service','email','active','ListId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp'];(function(_0x575934,_0x4a6760){var _0x109a3d=function(_0x1c20a1){while(--_0x1c20a1){_0x575934['push'](_0x575934['shift']());}};_0x109a3d(++_0x4a6760);}(_0x147b,0x193));var _0xb147=function(_0x30af23,_0x1b9d6a){_0x30af23=_0x30af23-0x0;var _0x5cea96=_0x147b[_0x30af23];return _0x5cea96;};'use strict';var client=require(_0xb147('0x0'));exports[_0xb147('0x1')]=function(){return function(){return client['Request'](_0xb147('0x2'),{'options':{'attributes':['id',_0xb147('0x3'),'provider',_0xb147('0x4'),_0xb147('0x5'),_0xb147('0x6'),'key',_0xb147('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0xb147('0x8'),'as':_0xb147('0x9'),'include':[{'model':_0xb147('0xa'),'attributes':['id','name','service',_0xb147('0xb'),_0xb147('0xc')],'as':_0xb147('0xa')}]},{'model':_0xb147('0xd'),'as':_0xb147('0xe'),'include':[{'model':_0xb147('0xa'),'attributes':['id',_0xb147('0x3'),_0xb147('0x4'),'type','data5'],'as':_0xb147('0xa')}]}]},'log':_0xb147('0xf')});};};exports[_0xb147('0x10')]=function(_0x177a8f,_0x2d209e){return client[_0xb147('0x11')](_0xb147('0x12'),{'account':{'id':_0x177a8f},'body':_0x2d209e,'log':_0xb147('0x12')});}; \ No newline at end of file +var _0x7a12=['key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','MailServerOut','data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x7a12,0xe8));var _0x27a1=function(_0x3efb69,_0x17bd16){_0x3efb69=_0x3efb69-0x0;var _0x17a382=_0x7a12[_0x3efb69];return _0x17a382;};'use strict';var client=require(_0x27a1('0x0'));exports[_0x27a1('0x1')]=function(){return function(){return client[_0x27a1('0x2')](_0x27a1('0x3'),{'options':{'attributes':['id',_0x27a1('0x4'),_0x27a1('0x5'),_0x27a1('0x6'),_0x27a1('0x7'),'active',_0x27a1('0x8'),_0x27a1('0x9'),_0x27a1('0xa')],'raw':![],'include':[{'model':_0x27a1('0xb'),'as':_0x27a1('0xc'),'include':[{'model':_0x27a1('0xd'),'attributes':['id','name',_0x27a1('0x6'),_0x27a1('0xe'),'data5'],'as':_0x27a1('0xd')}]},{'model':_0x27a1('0xf'),'as':'Smtp','include':[{'model':_0x27a1('0xd'),'attributes':['id',_0x27a1('0x4'),_0x27a1('0x6'),'type',_0x27a1('0x10')],'as':_0x27a1('0xd')}]}]},'log':_0x27a1('0x11')});};};exports[_0x27a1('0x12')]=function(_0x324e2b,_0x5f3ba9){return client[_0x27a1('0x2')]('NotifyMailAccount',{'account':{'id':_0x324e2b},'body':_0x5f3ba9,'log':_0x27a1('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index e844fd9..965a66c 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 _0xb76e=['getSettings','Request','ShowSetting','GetSettings','../client'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xb76e,0x16c));var _0xeb76=function(_0xc3750e,_0x1618cc){_0xc3750e=_0xc3750e-0x0;var _0x1e2f02=_0xb76e[_0xc3750e];return _0x1e2f02;};'use strict';var client=require(_0xeb76('0x0'));exports[_0xeb76('0x1')]=function(){return client[_0xeb76('0x2')](_0xeb76('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xeb76('0x4')});}; \ No newline at end of file +var _0x92c0=['../client','getSettings','Request','ShowSetting'];(function(_0x19cf1a,_0x4e13b8){var _0x36fc41=function(_0x14a495){while(--_0x14a495){_0x19cf1a['push'](_0x19cf1a['shift']());}};_0x36fc41(++_0x4e13b8);}(_0x92c0,0xdc));var _0x092c=function(_0x230f58,_0x1f8377){_0x230f58=_0x230f58-0x0;var _0x3fdd2c=_0x92c0[_0x230f58];return _0x3fdd2c;};'use strict';var client=require(_0x092c('0x0'));exports[_0x092c('0x1')]=function(){return client[_0x092c('0x2')](_0x092c('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f274fac..1c0b91f 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 5bc0662..c48085a 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 _0xc054=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','express','ioredis','createServer','timeout','listen','socket.io','polling','redis','defaults','localhost','adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','listening'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0xc054,0x174));var _0x4c05=function(_0x32bda5,_0x1a809b){_0x32bda5=_0x32bda5-0x0;var _0x383d68=_0xc054[_0x32bda5];return _0x383d68;};'use strict';var _=require(_0x4c05('0x0'));var http=require('http');var express=require(_0x4c05('0x1'));var sticky=require('sticky-session');var Redis=require(_0x4c05('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0x4c05('0x3')](app);server[_0x4c05('0x4')]=0xdbba0;if(sticky[_0x4c05('0x5')](server,config['port'])){var socketio=require(_0x4c05('0x6'))(server,{'transports':['websocket',_0x4c05('0x7')]});config[_0x4c05('0x8')]=_[_0x4c05('0x9')](config['redis'],{'host':_0x4c05('0xa'),'port':0x18eb});socketio[_0x4c05('0xb')](require(_0x4c05('0xc'))({'pubClient':new Redis(config[_0x4c05('0x8')]),'subClient':new Redis(config[_0x4c05('0x8')])}));require('../../config/triggers')[_0x4c05('0xd')]();require(_0x4c05('0xe'))['default'](socketio);require(_0x4c05('0xf'))[_0x4c05('0xd')](app);require(_0x4c05('0x10'))['default'](app);}else{server[_0x4c05('0x11')](_0x4c05('0x12'),function(){console[_0x4c05('0x13')](_0x4c05('0x14'),config[_0x4c05('0x15')]);});}exports=module[_0x4c05('0x16')]=app; \ No newline at end of file +var _0xb9c2=['createServer','timeout','socket.io','redis','socket.io-redis','../../config/triggers','default','../../routes','once','listening','log','port','exports','lodash','http','sticky-session','ioredis','../../config/environment'];(function(_0xea7461,_0x357cdb){var _0x48a33b=function(_0xb714d7){while(--_0xb714d7){_0xea7461['push'](_0xea7461['shift']());}};_0x48a33b(++_0x357cdb);}(_0xb9c2,0xc1));var _0x2b9c=function(_0x2f7aa6,_0x2072e5){_0x2f7aa6=_0x2f7aa6-0x0;var _0x18d006=_0xb9c2[_0x2f7aa6];return _0x18d006;};'use strict';var _=require(_0x2b9c('0x0'));var http=require(_0x2b9c('0x1'));var express=require('express');var sticky=require(_0x2b9c('0x2'));var Redis=require(_0x2b9c('0x3'));var config=require(_0x2b9c('0x4'));var app=express();var server=http[_0x2b9c('0x5')](app);server[_0x2b9c('0x6')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0x2b9c('0x7'))(server,{'transports':['websocket','polling']});config[_0x2b9c('0x8')]=_['defaults'](config[_0x2b9c('0x8')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0x2b9c('0x9'))({'pubClient':new Redis(config[_0x2b9c('0x8')]),'subClient':new Redis(config[_0x2b9c('0x8')])}));require(_0x2b9c('0xa'))[_0x2b9c('0xb')]();require('../../config/socketio')[_0x2b9c('0xb')](socketio);require('../../config/express')[_0x2b9c('0xb')](app);require(_0x2b9c('0xc'))['default'](app);}else{server[_0x2b9c('0xd')](_0x2b9c('0xe'),function(){console[_0x2b9c('0xf')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x2b9c('0x10')]);});}exports=module[_0x2b9c('0x11')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index b8d3ab8..d99cd3a 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 _0x2077=['routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger'];(function(_0x4fc104,_0x5a0d64){var _0x20515d=function(_0x41813b){while(--_0x41813b){_0x4fc104['push'](_0x4fc104['shift']());}};_0x20515d(++_0x5a0d64);}(_0x2077,0x1de));var _0x7207=function(_0x27456c,_0x2de858){_0x27456c=_0x27456c-0x0;var _0x446b02=_0x2077[_0x27456c];return _0x446b02;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x7207('0x0'));var logger=require(_0x7207('0x1'))(_0x7207('0x2'));var client=jayson[_0x7207('0x3')][_0x7207('0x4')]({'port':0x2329});client[_0x7207('0x5')]=function(_0xbb7ef0,_0x22536e){return new BPromise(function(_0x35d22d,_0x17cca3){return client[_0x7207('0x6')](_0xbb7ef0,_0x22536e)[_0x7207('0x7')](function(_0x57a30e){logger[_0x7207('0x8')](_0x7207('0x9'),'routing',_0xbb7ef0,_0x22536e,_0x57a30e);if(_0x57a30e[_0x7207('0xa')]){logger[_0x7207('0xa')](_0x7207('0x9'),_0x7207('0x2'),_0xbb7ef0,_0x57a30e[_0x7207('0xa')]['message'],_0x22536e);return _0x17cca3(_0x57a30e[_0x7207('0xa')][_0x7207('0xb')]);}else{return _0x35d22d(_0x57a30e[_0x7207('0xc')]);}})[_0x7207('0xd')](function(_0x2554c7){logger[_0x7207('0xa')](_0x7207('0x9'),_0x7207('0x2'),_0xbb7ef0,_0x2554c7,_0x22536e);return _0x17cca3(_0x2554c7);});});};module[_0x7207('0xe')]=client; \ No newline at end of file +var _0x3851=['message','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error'];(function(_0x2549be,_0x1878d8){var _0x3dd872=function(_0x341808){while(--_0x341808){_0x2549be['push'](_0x2549be['shift']());}};_0x3dd872(++_0x1878d8);}(_0x3851,0xe3));var _0x1385=function(_0x48338c,_0x579750){_0x48338c=_0x48338c-0x0;var _0x411564=_0x3851[_0x48338c];return _0x411564;};'use strict';var jayson=require(_0x1385('0x0'));var BPromise=require('bluebird');var logger=require(_0x1385('0x1'))(_0x1385('0x2'));var client=jayson[_0x1385('0x3')][_0x1385('0x4')]({'port':0x2329});client[_0x1385('0x5')]=function(_0x4f9489,_0x47ff6e){return new BPromise(function(_0x42d4dd,_0x10d70d){return client[_0x1385('0x6')](_0x4f9489,_0x47ff6e)[_0x1385('0x7')](function(_0x5afc3d){logger[_0x1385('0x8')](_0x1385('0x9'),_0x1385('0x2'),_0x4f9489,_0x47ff6e,_0x5afc3d);if(_0x5afc3d[_0x1385('0xa')]){logger[_0x1385('0xa')](_0x1385('0x9'),_0x1385('0x2'),_0x4f9489,_0x5afc3d['error']['message'],_0x47ff6e);return _0x10d70d(_0x5afc3d[_0x1385('0xa')][_0x1385('0xb')]);}else{return _0x42d4dd(_0x5afc3d['result']);}})[_0x1385('0xc')](function(_0x491f83){logger[_0x1385('0xa')](_0x1385('0x9'),'routing',_0x4f9489,_0x491f83,_0x47ff6e);return _0x10d70d(_0x491f83);});});};module[_0x1385('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 4a7111a..49c37cd 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 _0xc92e=['initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','getOpenchannelQueues'];(function(_0x44f498,_0x56866c){var _0x45891b=function(_0x1dc3f8){while(--_0x1dc3f8){_0x44f498['push'](_0x44f498['shift']());}};_0x45891b(++_0x56866c);}(_0xc92e,0x14c));var _0xec92=function(_0x4dcf45,_0x4b7b7b){_0x4dcf45=_0x4dcf45-0x0;var _0x4cd6ab=_0xc92e[_0x4dcf45];return _0x4cd6ab;};'use strict';var BPromise=require(_0xec92('0x0'));var server=require(_0xec92('0x1'));var Realtime=require('./realtime');var user=require(_0xec92('0x2'));var interval=require(_0xec92('0x3'));var openchannelQueue=require(_0xec92('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xec92('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xec92('0x6'));var whatsappQueue=require(_0xec92('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xec92('0x8')]()[_0xec92('0x9')](user['getAgents']())[_0xec92('0x9')](realtime[_0xec92('0xa')]())[_0xec92('0x9')](interval[_0xec92('0xb')]())[_0xec92('0x9')](realtime['initIntervals']())[_0xec92('0x9')](openchannelQueue[_0xec92('0xc')]())[_0xec92('0x9')](realtime[_0xec92('0xd')]())[_0xec92('0x9')](chatQueue['getChatQueues']())['then'](realtime[_0xec92('0xe')]())[_0xec92('0x9')](smsQueue[_0xec92('0xf')]())[_0xec92('0x9')](realtime[_0xec92('0x10')]())[_0xec92('0x9')](mailQueue[_0xec92('0x11')]())[_0xec92('0x9')](realtime[_0xec92('0x12')]())['then'](faxQueue['getFaxQueues']())[_0xec92('0x9')](realtime[_0xec92('0x13')]())[_0xec92('0x9')](whatsappQueue['getWhatsappQueues']())[_0xec92('0x9')](realtime['initWhatsappQueues']())[_0xec92('0x9')](function(){return realtime;});}function main(){return server[_0xec92('0x14')](realtime)['then'](function(_0x12ed26){return initRealtime();})[_0xec92('0x9')](function(_0x6a5acd){return setInterval(initRealtime,0x1388);})[_0xec92('0x15')](function(_0x441fb1){console[_0xec92('0x16')](_0x441fb1);});}main(); \ No newline at end of file +var _0x2fc0=['initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','listen','catch','log','./server','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues'];(function(_0xdb6101,_0x2b0dac){var _0x3ce290=function(_0x25697d){while(--_0x25697d){_0xdb6101['push'](_0xdb6101['shift']());}};_0x3ce290(++_0x2b0dac);}(_0x2fc0,0x6a));var _0x02fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fc0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var server=require(_0x02fc('0x0'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x02fc('0x1'));var openchannelQueue=require(_0x02fc('0x2'));var chatQueue=require(_0x02fc('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x02fc('0x4'));var faxQueue=require(_0x02fc('0x5'));var whatsappQueue=require(_0x02fc('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x02fc('0x7')]()[_0x02fc('0x8')](user['getAgents']())[_0x02fc('0x8')](realtime['initAgents']())['then'](interval[_0x02fc('0x9')]())['then'](realtime[_0x02fc('0xa')]())[_0x02fc('0x8')](openchannelQueue[_0x02fc('0xb')]())[_0x02fc('0x8')](realtime[_0x02fc('0xc')]())[_0x02fc('0x8')](chatQueue[_0x02fc('0xd')]())[_0x02fc('0x8')](realtime[_0x02fc('0xe')]())[_0x02fc('0x8')](smsQueue[_0x02fc('0xf')]())['then'](realtime[_0x02fc('0x10')]())['then'](mailQueue[_0x02fc('0x11')]())[_0x02fc('0x8')](realtime[_0x02fc('0x12')]())[_0x02fc('0x8')](faxQueue[_0x02fc('0x13')]())[_0x02fc('0x8')](realtime['initFaxQueues']())[_0x02fc('0x8')](whatsappQueue[_0x02fc('0x14')]())['then'](realtime['initWhatsappQueues']())[_0x02fc('0x8')](function(){return realtime;});}function main(){return server[_0x02fc('0x15')](realtime)[_0x02fc('0x8')](function(_0x2a12bd){return initRealtime();})['then'](function(_0x3658da){return setInterval(initRealtime,0x1388);})[_0x02fc('0x16')](function(_0x2f1efa){console[_0x02fc('0x17')](_0x2f1efa);});}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 47685cc..209718a 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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x13ce62,_0x189733){var _0x659d2=function(_0xe7468b){while(--_0xe7468b){_0x13ce62['push'](_0x13ce62['shift']());}};_0x659d2(++_0x189733);}(_0x326f,0xd1));var _0xf326=function(_0x2651ad,_0x2f4b69){_0x2651ad=_0x2651ad-0x0;var _0x3b7082=_0x326f[_0x2651ad];return _0x3b7082;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x29ae46,_0x1dda5b){var _0x5c4d8b=function(_0x59c666){while(--_0x59c666){_0x29ae46['push'](_0x29ae46['shift']());}};_0x5c4d8b(++_0x1dda5b);}(_0x814b,0x1a2));var _0xb814=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x814b[_0x8a7e38];return _0x228609;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index dc7d016..d92c0a0 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 _0x3375=['bluebird','http','then','error','message','result','catch'];(function(_0x4fdf63,_0x3ff15f){var _0x543c2f=function(_0x4cc6cb){while(--_0x4cc6cb){_0x4fdf63['push'](_0x4fdf63['shift']());}};_0x543c2f(++_0x3ff15f);}(_0x3375,0xcb));var _0x5337=function(_0x55558f,_0xf63628){_0x55558f=_0x55558f-0x0;var _0x2649be=_0x3375[_0x55558f];return _0x2649be;};'use strict';var BPromise=require(_0x5337('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5337('0x1')]({'port':0x232b});function request(_0x1e8686,_0x415bd2){return new BPromise(function(_0x691b83,_0x2f7871){return client['request'](_0x1e8686,_0x415bd2)[_0x5337('0x2')](function(_0x4aa53f){if(_0x4aa53f[_0x5337('0x3')]){return _0x2f7871(_0x4aa53f[_0x5337('0x3')][_0x5337('0x4')]);}else{return _0x691b83(_0x4aa53f[_0x5337('0x5')]);}})[_0x5337('0x6')](function(_0x34d750){return _0x2f7871(_0x34d750);});});}exports['sendMailMessage']=function(_0x599dbb,_0x1fefa0){return request('SendMail',{'account':_0x599dbb,'message':_0x1fefa0});}; \ No newline at end of file +var _0xbfde=['client','http','then','error','result','catch'];(function(_0x2a9e39,_0x357028){var _0x202f44=function(_0x1b7ca8){while(--_0x1b7ca8){_0x2a9e39['push'](_0x2a9e39['shift']());}};_0x202f44(++_0x357028);}(_0xbfde,0x162));var _0xebfd=function(_0x2e9df7,_0x1d2e69){_0x2e9df7=_0x2e9df7-0x0;var _0x454500=_0xbfde[_0x2e9df7];return _0x454500;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xebfd('0x0')][_0xebfd('0x1')]({'port':0x232b});function request(_0x3ba81d,_0x27f8f0){return new BPromise(function(_0xdd7e22,_0xc30d20){return client['request'](_0x3ba81d,_0x27f8f0)[_0xebfd('0x2')](function(_0x22d158){if(_0x22d158[_0xebfd('0x3')]){return _0xc30d20(_0x22d158['error']['message']);}else{return _0xdd7e22(_0x22d158[_0xebfd('0x4')]);}})[_0xebfd('0x5')](function(_0x2ca5c0){return _0xc30d20(_0x2ca5c0);});});}exports['sendMailMessage']=function(_0x4c3551,_0x2c3c33){return request('SendMail',{'account':_0x4c3551,'message':_0x2c3c33});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3424444..f982f28 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 _0x48b1=['unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','mail','chat','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','name','openchannelPause','chatCurrentCapacity','mailCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelCurrentCapacity','emit','user:save','exports','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus'];(function(_0x3cd6d0,_0x4a64f3){var _0x511d29=function(_0x2cc5ad){while(--_0x2cc5ad){_0x3cd6d0['push'](_0x3cd6d0['shift']());}};_0x511d29(++_0x4a64f3);}(_0x48b1,0x197));var _0x148b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x48b1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require('md5');var Redis=require(_0x148b('0x0'));var config=require(_0x148b('0x1'));config[_0x148b('0x2')]=_[_0x148b('0x3')](config[_0x148b('0x2')],{'host':_0x148b('0x4'),'port':0x18eb});var io=require(_0x148b('0x5'))(new Redis(config[_0x148b('0x2')]));function Agent(_0x1d25ef){this['id']=_0x1d25ef['id']||0x0;this['name']=_0x1d25ef['name']||'';this[_0x148b('0x6')]=_0x1d25ef[_0x148b('0x6')]||!![];this[_0x148b('0x7')]=_0x1d25ef[_0x148b('0x7')]||![];this[_0x148b('0x8')]=_0x1d25ef['chatPause']||![];this[_0x148b('0x9')]=_0x1d25ef['mailPause']||![];this[_0x148b('0xa')]=_0x1d25ef[_0x148b('0xa')]||![];this['smsPause']=_0x1d25ef[_0x148b('0xb')]||![];this['openchannelPause']=_0x1d25ef['openchannelPause']||![];this[_0x148b('0xc')]=_0x148b('0xd');this[_0x148b('0xe')]=0x0;this[_0x148b('0xf')]=_0x1d25ef[_0x148b('0xf')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x148b('0x10')]=_0x148b('0xd');this[_0x148b('0x11')]=0x0;this[_0x148b('0x12')]=_0x1d25ef[_0x148b('0x12')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x148b('0x13')]=_0x148b('0xd');this[_0x148b('0x14')]=0x0;this[_0x148b('0x15')]=_0x1d25ef[_0x148b('0x15')]||0x0;this[_0x148b('0x16')]=0x0;this[_0x148b('0x17')]=_0x148b('0xd');this[_0x148b('0x18')]=0x0;this['smsCapacity']=_0x1d25ef[_0x148b('0x19')]||0x0;this[_0x148b('0x1a')]=0x0;this['whatsappStatus']=_0x148b('0xd');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x1d25ef['whatsappCapacity']||0x0;this[_0x148b('0x1b')]=0x0;this[_0x148b('0x1c')]='unknown';this[_0x148b('0x1d')]=0x0;this[_0x148b('0x1e')]=_0x1d25ef['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x148b('0x1f')]=![];this[_0x148b('0x20')]=undefined;this[_0x148b('0x21')]='';this[_0x148b('0x22')]();}Agent[_0x148b('0x23')][_0x148b('0x24')]=function(_0x1fc2f8){if(this[_0x1fc2f8+_0x148b('0x25')]>0x0){if(this[_0x1fc2f8+'Capacity']>0x0&&this[_0x1fc2f8+_0x148b('0x25')]>=this[_0x1fc2f8+'Capacity']){return _0x148b('0x26');}else{return _0x148b('0x27');}}else{return'idle';}};Agent[_0x148b('0x23')][_0x148b('0x22')]=function(){var _0x3253ef=[_0x148b('0x28'),_0x148b('0x29'),_0x148b('0x2a'),'fax',_0x148b('0x2b'),_0x148b('0x2c')];for(var _0x26a107=0x0;_0x26a107<_0x3253ef[_0x148b('0x2d')];_0x26a107+=0x1){var _0x65b099=this[_0x148b('0x24')](_0x3253ef[_0x26a107]);if(this[_0x3253ef[_0x26a107]+_0x148b('0x2e')]!==_0x65b099){this[_0x3253ef[_0x26a107]+_0x148b('0x2f')]=_[_0x148b('0x30')](moment()[_0x148b('0x31')]('x'));}this[_0x3253ef[_0x26a107]+'Status']=_0x65b099;}var _0x246104={'id':this['id'],'name':this[_0x148b('0x32')],'online':this[_0x148b('0x6')],'voicePause':this[_0x148b('0x7')],'chatPause':this[_0x148b('0x8')],'mailPause':this[_0x148b('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0x148b('0xa')],'openchannelPause':this[_0x148b('0x33')],'chatStatus':this[_0x148b('0xc')],'chatStatusTime':this[_0x148b('0xe')],'chatCapacity':this[_0x148b('0xf')],'chatCurrentCapacity':this[_0x148b('0x34')],'mailStatus':this[_0x148b('0x10')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x148b('0x12')],'mailCurrentCapacity':this[_0x148b('0x35')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x148b('0x14')],'faxCapacity':this[_0x148b('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x148b('0x18')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x148b('0x1a')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x148b('0x36')],'whatsappCapacity':this[_0x148b('0x37')],'whatsappCurrentCapacity':this[_0x148b('0x1b')],'openchannelStatus':this[_0x148b('0x1c')],'openchannelStatusTime':this[_0x148b('0x1d')],'openchannelCapacity':this[_0x148b('0x1e')],'openchannelCurrentCapacity':this[_0x148b('0x38')],'busy':this[_0x148b('0x1f')],'busyQueue':this[_0x148b('0x20')]};var _0x4003de=md5(JSON['stringify'](_0x246104));if(this[_0x148b('0x21')]!==_0x4003de){this[_0x148b('0x21')]=_0x4003de;io[_0x148b('0x39')](_0x148b('0x3a'),_0x246104);}};module[_0x148b('0x3b')]=Agent; \ No newline at end of file +var _0x0ad0=['unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel','fax','whatsapp','length','getChannelStatus','Status','faxStatusTime','faxCurrentCapacity','smsStatus','whatsappStatus','openchannelStatusTime','stringify','md5','emit','user:save','exports','lodash','moment','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus'];(function(_0x425738,_0x40109a){var _0x281783=function(_0x4d56ca){while(--_0x4d56ca){_0x425738['push'](_0x425738['shift']());}};_0x281783(++_0x40109a);}(_0x0ad0,0xa2));var _0x00ad=function(_0x1d458a,_0x57f3be){_0x1d458a=_0x1d458a-0x0;var _0x1bba5e=_0x0ad0[_0x1d458a];return _0x1bba5e;};'use strict';var _=require(_0x00ad('0x0'));var moment=require(_0x00ad('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x00ad('0x2'));config[_0x00ad('0x3')]=_[_0x00ad('0x4')](config[_0x00ad('0x3')],{'host':_0x00ad('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x00ad('0x3')]));function Agent(_0x49d17e){this['id']=_0x49d17e['id']||0x0;this[_0x00ad('0x6')]=_0x49d17e[_0x00ad('0x6')]||'';this['online']=_0x49d17e[_0x00ad('0x7')]||!![];this['voicePause']=_0x49d17e[_0x00ad('0x8')]||![];this[_0x00ad('0x9')]=_0x49d17e[_0x00ad('0x9')]||![];this[_0x00ad('0xa')]=_0x49d17e[_0x00ad('0xa')]||![];this['faxPause']=_0x49d17e[_0x00ad('0xb')]||![];this[_0x00ad('0xc')]=_0x49d17e[_0x00ad('0xc')]||![];this['openchannelPause']=_0x49d17e[_0x00ad('0xd')]||![];this[_0x00ad('0xe')]=_0x00ad('0xf');this[_0x00ad('0x10')]=0x0;this[_0x00ad('0x11')]=_0x49d17e['chatCapacity']||0x0;this[_0x00ad('0x12')]=0x0;this[_0x00ad('0x13')]=_0x00ad('0xf');this[_0x00ad('0x14')]=0x0;this['mailCapacity']=_0x49d17e[_0x00ad('0x15')]||0x0;this[_0x00ad('0x16')]=0x0;this[_0x00ad('0x17')]=_0x00ad('0xf');this['faxStatusTime']=0x0;this[_0x00ad('0x18')]=_0x49d17e['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']='unknown';this[_0x00ad('0x19')]=0x0;this[_0x00ad('0x1a')]=_0x49d17e['smsCapacity']||0x0;this[_0x00ad('0x1b')]=0x0;this['whatsappStatus']=_0x00ad('0xf');this[_0x00ad('0x1c')]=0x0;this[_0x00ad('0x1d')]=_0x49d17e['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x00ad('0x1e')]=_0x00ad('0xf');this['openchannelStatusTime']=0x0;this[_0x00ad('0x1f')]=_0x49d17e[_0x00ad('0x1f')]||0x0;this[_0x00ad('0x20')]=0x0;this[_0x00ad('0x21')]=![];this[_0x00ad('0x22')]=undefined;this['md5']='';this[_0x00ad('0x23')]();}Agent[_0x00ad('0x24')]['getChannelStatus']=function(_0x512430){if(this[_0x512430+_0x00ad('0x25')]>0x0){if(this[_0x512430+_0x00ad('0x26')]>0x0&&this[_0x512430+_0x00ad('0x25')]>=this[_0x512430+_0x00ad('0x26')]){return _0x00ad('0x27');}else{return _0x00ad('0x28');}}else{return _0x00ad('0x29');}};Agent[_0x00ad('0x24')][_0x00ad('0x23')]=function(){var _0x21e8ce=['mail',_0x00ad('0x2a'),_0x00ad('0x2b'),_0x00ad('0x2c'),'sms',_0x00ad('0x2d')];for(var _0x2f1714=0x0;_0x2f1714<_0x21e8ce[_0x00ad('0x2e')];_0x2f1714+=0x1){var _0x40b340=this[_0x00ad('0x2f')](_0x21e8ce[_0x2f1714]);if(this[_0x21e8ce[_0x2f1714]+_0x00ad('0x30')]!==_0x40b340){this[_0x21e8ce[_0x2f1714]+'StatusTime']=_['toNumber'](moment()['format']('x'));}this[_0x21e8ce[_0x2f1714]+'Status']=_0x40b340;}var _0x996014={'id':this['id'],'name':this[_0x00ad('0x6')],'online':this[_0x00ad('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x00ad('0x9')],'mailPause':this[_0x00ad('0xa')],'smsPause':this[_0x00ad('0xc')],'faxPause':this[_0x00ad('0xb')],'openchannelPause':this[_0x00ad('0xd')],'chatStatus':this[_0x00ad('0xe')],'chatStatusTime':this[_0x00ad('0x10')],'chatCapacity':this[_0x00ad('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x00ad('0x13')],'mailStatusTime':this[_0x00ad('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x00ad('0x16')],'faxStatus':this[_0x00ad('0x17')],'faxStatusTime':this[_0x00ad('0x31')],'faxCapacity':this[_0x00ad('0x18')],'faxCurrentCapacity':this[_0x00ad('0x32')],'smsStatus':this[_0x00ad('0x33')],'smsStatusTime':this[_0x00ad('0x19')],'smsCapacity':this[_0x00ad('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x00ad('0x34')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x00ad('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x00ad('0x35')],'openchannelCapacity':this[_0x00ad('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x00ad('0x22')]};var _0x55a0aa=md5(JSON[_0x00ad('0x36')](_0x996014));if(this[_0x00ad('0x37')]!==_0x55a0aa){this[_0x00ad('0x37')]=_0x55a0aa;io[_0x00ad('0x38')](_0x00ad('0x39'),_0x996014);}};module[_0x00ad('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index ab9d72e..052c15a 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 _0x920e=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime','paused','length','online','chatPause','available','loggedIn','stringify','format','chat:queue:%s','emit','exports','md5','util','redis','defaults'];(function(_0x1ab758,_0x3dbede){var _0x5788a0=function(_0x324d24){while(--_0x324d24){_0x1ab758['push'](_0x1ab758['shift']());}};_0x5788a0(++_0x3dbede);}(_0x920e,0x1e9));var _0xe920=function(_0x4f68a8,_0x4fbf35){_0x4f68a8=_0x4f68a8-0x0;var _0x11e82c=_0x920e[_0x4f68a8];return _0x11e82c;};'use strict';var _=require('lodash');var md5=require(_0xe920('0x0'));var util=require(_0xe920('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xe920('0x2')]=_[_0xe920('0x3')](config[_0xe920('0x2')],{'host':_0xe920('0x4'),'port':0x18eb});var io=require(_0xe920('0x5'))(new Redis(config[_0xe920('0x2')]));function ChatQueue(_0xaf8d24){this['id']=_0xaf8d24['id']||0x0;this[_0xe920('0x6')]=_0xaf8d24['name']||'';this[_0xe920('0x7')]=_0xaf8d24['timeout']||0xa;this[_0xe920('0x8')]=_0xaf8d24['strategy']||_0xe920('0x9');this[_0xe920('0xa')]=_0xaf8d24['Agents'];this[_0xe920('0xb')]={};this[_0xe920('0xc')]=0x0;this[_0xe920('0x0')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0xe920('0xd')][_0xe920('0xe')]=function(){var _0x1d3278=this[_0xe920('0xb')][_0xe920('0xf')];this[_0xe920('0xb')]=_[_0xe920('0x10')](this['Agents'],'id');this[_0xe920('0xb')][_0xe920('0xf')]=_0x1d3278;};ChatQueue[_0xe920('0xd')][_0xe920('0x11')]=function(){this['loggedIn']=0x0;this[_0xe920('0x12')]=0x0;for(var _0x2cccb5=0x0;_0x2cccb5=0x0?this[_0xe920('0x16')]:0x0;var _0x5289e6={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe920('0x17')],'name':this[_0xe920('0x6')],'paused':this['paused'],'waiting':this[_0xe920('0xc')]};var _0x5b9ee0=md5(JSON[_0xe920('0x18')](_0x5289e6));if(this['md5']!==_0x5b9ee0){this[_0xe920('0x0')]=_0x5b9ee0;io['to'](util[_0xe920('0x19')](_0xe920('0x1a'),_0x5289e6[_0xe920('0x6')]))[_0xe920('0x1b')]('chat_queue:save',_0x5289e6);}};module[_0xe920('0x1c')]=ChatQueue; \ No newline at end of file +var _0x78a2=['chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','paused','available','stringify','md5','format','chat:queue:%s','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x78a2,0x17b));var _0x278a=function(_0x1bb63d,_0x3d6eb9){_0x1bb63d=_0x1bb63d-0x0;var _0x454c9b=_0x78a2[_0x1bb63d];return _0x454c9b;};'use strict';var _=require(_0x278a('0x0'));var md5=require('md5');var util=require(_0x278a('0x1'));var Redis=require(_0x278a('0x2'));var config=require(_0x278a('0x3'));config[_0x278a('0x4')]=_['defaults'](config[_0x278a('0x4')],{'host':_0x278a('0x5'),'port':0x18eb});var io=require(_0x278a('0x6'))(new Redis(config['redis']));function ChatQueue(_0x8df140){this['id']=_0x8df140['id']||0x0;this[_0x278a('0x7')]=_0x8df140['name']||'';this[_0x278a('0x8')]=_0x8df140[_0x278a('0x8')]||0xa;this['strategy']=_0x8df140['strategy']||'beepall';this['Agents']=_0x8df140[_0x278a('0x9')];this[_0x278a('0xa')]={};this[_0x278a('0xb')]=0x0;this['md5']='';this[_0x278a('0xc')]();this[_0x278a('0xd')]();}ChatQueue[_0x278a('0xe')][_0x278a('0xc')]=function(){var _0x412af5=this[_0x278a('0xa')]['_rr'];this[_0x278a('0xa')]=_[_0x278a('0xf')](this[_0x278a('0x9')],'id');this[_0x278a('0xa')][_0x278a('0x10')]=_0x412af5;};ChatQueue['prototype'][_0x278a('0xd')]=function(){this[_0x278a('0x11')]=0x0;this['paused']=0x0;for(var _0xd037c8=0x0;_0xd037c8=0x0?this[_0x278a('0x15')]:0x0;var _0x17dc7f={'id':this['id'],'available':this[_0x278a('0x15')],'loggedIn':this[_0x278a('0x11')],'name':this['name'],'paused':this[_0x278a('0x14')],'waiting':this[_0x278a('0xb')]};var _0x34d8e6=md5(JSON[_0x278a('0x16')](_0x17dc7f));if(this[_0x278a('0x17')]!==_0x34d8e6){this['md5']=_0x34d8e6;io['to'](util[_0x278a('0x18')](_0x278a('0x19'),_0x17dc7f['name']))[_0x278a('0x1a')](_0x278a('0x1b'),_0x17dc7f);}};module[_0x278a('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 88b7752..0a00bac 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 _0x81f7=['format','fax:queue:%s','emit','fax_queue:save','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','map','updateRealtime','loggedIn','paused','length','faxPause','available','stringify'];(function(_0x990980,_0x1301bc){var _0x42f782=function(_0x2843c2){while(--_0x2843c2){_0x990980['push'](_0x990980['shift']());}};_0x42f782(++_0x1301bc);}(_0x81f7,0x156));var _0x781f=function(_0x5d2438,_0x6c8466){_0x5d2438=_0x5d2438-0x0;var _0x26e9d7=_0x81f7[_0x5d2438];return _0x26e9d7;};'use strict';var _=require('lodash');var md5=require(_0x781f('0x0'));var util=require(_0x781f('0x1'));var Redis=require(_0x781f('0x2'));var config=require(_0x781f('0x3'));config[_0x781f('0x4')]=_['defaults'](config[_0x781f('0x4')],{'host':_0x781f('0x5'),'port':0x18eb});var io=require(_0x781f('0x6'))(new Redis(config['redis']));function FaxQueue(_0x3ac765){this['id']=_0x3ac765['id']||0x0;this[_0x781f('0x7')]=_0x3ac765['name']||'';this[_0x781f('0x8')]=_0x3ac765['timeout']||0xa;this[_0x781f('0x9')]=_0x3ac765[_0x781f('0x9')]||'beepall';this[_0x781f('0xa')]=_0x3ac765[_0x781f('0xa')];this[_0x781f('0xb')]={};this[_0x781f('0xc')]=0x0;this[_0x781f('0x0')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue['prototype'][_0x781f('0xd')]=function(){var _0x58a941=this[_0x781f('0xb')]['_rr'];this['mapAgentsId']=_[_0x781f('0xe')](this[_0x781f('0xa')],'id');this[_0x781f('0xb')]['_rr']=_0x58a941;};FaxQueue['prototype'][_0x781f('0xf')]=function(){this[_0x781f('0x10')]=0x0;this[_0x781f('0x11')]=0x0;for(var _0x263286=0x0;_0x263286=0x0?this[_0x781f('0x14')]:0x0;var _0x22eb0d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x781f('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x781f('0xc')]};var _0x3506d6=md5(JSON[_0x781f('0x15')](_0x22eb0d));if(this[_0x781f('0x0')]!==_0x3506d6){this['md5']=_0x3506d6;io['to'](util[_0x781f('0x16')](_0x781f('0x17'),_0x22eb0d[_0x781f('0x7')]))[_0x781f('0x18')](_0x781f('0x19'),_0x22eb0d);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x9e71=['socket.io-emitter','timeout','strategy','beepall','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','Agents','loggedIn','paused','available','name','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','redis','localhost'];(function(_0x19ba87,_0xea5dbc){var _0x343d62=function(_0x3cb331){while(--_0x3cb331){_0x19ba87['push'](_0x19ba87['shift']());}};_0x343d62(++_0xea5dbc);}(_0x9e71,0x192));var _0x19e7=function(_0x285ee2,_0x2b5995){_0x285ee2=_0x285ee2-0x0;var _0x56c97b=_0x9e71[_0x285ee2];return _0x56c97b;};'use strict';var _=require(_0x19e7('0x0'));var md5=require(_0x19e7('0x1'));var util=require(_0x19e7('0x2'));var Redis=require(_0x19e7('0x3'));var config=require('../../../config/environment');config[_0x19e7('0x4')]=_['defaults'](config[_0x19e7('0x4')],{'host':_0x19e7('0x5'),'port':0x18eb});var io=require(_0x19e7('0x6'))(new Redis(config[_0x19e7('0x4')]));function FaxQueue(_0x53d0cc){this['id']=_0x53d0cc['id']||0x0;this['name']=_0x53d0cc['name']||'';this[_0x19e7('0x7')]=_0x53d0cc['timeout']||0xa;this[_0x19e7('0x8')]=_0x53d0cc[_0x19e7('0x8')]||_0x19e7('0x9');this['Agents']=_0x53d0cc['Agents'];this[_0x19e7('0xa')]={};this[_0x19e7('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x19e7('0xc')]();}FaxQueue[_0x19e7('0xd')][_0x19e7('0xe')]=function(){var _0x2d301d=this[_0x19e7('0xa')]['_rr'];this['mapAgentsId']=_['map'](this[_0x19e7('0xf')],'id');this[_0x19e7('0xa')]['_rr']=_0x2d301d;};FaxQueue[_0x19e7('0xd')][_0x19e7('0xc')]=function(){this[_0x19e7('0x10')]=0x0;this[_0x19e7('0x11')]=0x0;for(var _0x39aafb=0x0;_0x39aafb=0x0?this[_0x19e7('0x12')]:0x0;var _0x5643f0={'id':this['id'],'available':this[_0x19e7('0x12')],'loggedIn':this[_0x19e7('0x10')],'name':this[_0x19e7('0x13')],'paused':this['paused'],'waiting':this[_0x19e7('0xb')]};var _0x4895aa=md5(JSON['stringify'](_0x5643f0));if(this['md5']!==_0x4895aa){this['md5']=_0x4895aa;io['to'](util[_0x19e7('0x14')](_0x19e7('0x15'),_0x5643f0[_0x19e7('0x13')]))[_0x19e7('0x16')](_0x19e7('0x17'),_0x5643f0);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 56e074d..1a9fc73 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 _0x7bfc=['Intervals','exports'];(function(_0x310c3c,_0x242559){var _0x3cbb46=function(_0x3c9182){while(--_0x3c9182){_0x310c3c['push'](_0x310c3c['shift']());}};_0x3cbb46(++_0x242559);}(_0x7bfc,0x15c));var _0xc7bf=function(_0xd3e6cf,_0x2335f9){_0xd3e6cf=_0xd3e6cf-0x0;var _0x242782=_0x7bfc[_0xd3e6cf];return _0x242782;};'use strict';function Interval(_0x4c9c9a){this['id']=_0x4c9c9a['id']||0x0;this['name']=_0x4c9c9a['name']||'';this[_0xc7bf('0x0')]=_0x4c9c9a['Intervals']||{};}module[_0xc7bf('0x1')]=Interval; \ No newline at end of file +var _0xdb9d=['exports','Intervals'];(function(_0xfe4e05,_0xbf77a5){var _0x1e6d78=function(_0x1f5449){while(--_0x1f5449){_0xfe4e05['push'](_0xfe4e05['shift']());}};_0x1e6d78(++_0xbf77a5);}(_0xdb9d,0x6f));var _0xddb9=function(_0x27bcf5,_0x236765){_0x27bcf5=_0x27bcf5-0x0;var _0x4ce4cf=_0xdb9d[_0x27bcf5];return _0x4ce4cf;};'use strict';function Interval(_0x1ff65e){this['id']=_0x1ff65e['id']||0x0;this['name']=_0x1ff65e['name']||'';this[_0xddb9('0x0')]=_0x1ff65e['Intervals']||{};}module[_0xddb9('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 5839c25..19eec91 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 _0x721f=['updateRouting','updateRealtime','_rr','map','prototype','paused','online','mailPause','available','loggedIn','stringify','format','emit','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x1f3130,_0x114989){var _0x1c3221=function(_0x44dbc0){while(--_0x44dbc0){_0x1f3130['push'](_0x1f3130['shift']());}};_0x1c3221(++_0x114989);}(_0x721f,0x1ea));var _0xf721=function(_0x4e9c7b,_0x596ba9){_0x4e9c7b=_0x4e9c7b-0x0;var _0x52e053=_0x721f[_0x4e9c7b];return _0x52e053;};'use strict';var _=require(_0xf721('0x0'));var md5=require(_0xf721('0x1'));var util=require(_0xf721('0x2'));var Redis=require(_0xf721('0x3'));var config=require('../../../config/environment');config[_0xf721('0x4')]=_[_0xf721('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf721('0x6'))(new Redis(config['redis']));function MailQueue(_0x5d4f84){this['id']=_0x5d4f84['id']||0x0;this[_0xf721('0x7')]=_0x5d4f84['name']||'';this[_0xf721('0x8')]=_0x5d4f84[_0xf721('0x8')]||0xa;this[_0xf721('0x9')]=_0x5d4f84['strategy']||_0xf721('0xa');this[_0xf721('0xb')]=_0x5d4f84[_0xf721('0xb')];this[_0xf721('0xc')]={};this[_0xf721('0xd')]=0x0;this[_0xf721('0x1')]='';this[_0xf721('0xe')]();this[_0xf721('0xf')]();}MailQueue['prototype'][_0xf721('0xe')]=function(){var _0x5abf71=this[_0xf721('0xc')][_0xf721('0x10')];this[_0xf721('0xc')]=_[_0xf721('0x11')](this[_0xf721('0xb')],'id');this[_0xf721('0xc')][_0xf721('0x10')]=_0x5abf71;};MailQueue[_0xf721('0x12')][_0xf721('0xf')]=function(){this['loggedIn']=0x0;this[_0xf721('0x13')]=0x0;for(var _0x5156b9=0x0;_0x5156b9=0x0?this[_0xf721('0x16')]:0x0;var _0x27f035={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf721('0x17')],'name':this[_0xf721('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x354fdd=md5(JSON[_0xf721('0x18')](_0x27f035));if(this[_0xf721('0x1')]!==_0x354fdd){this['md5']=_0x354fdd;io['to'](util[_0xf721('0x19')]('mail:queue:%s',_0x27f035[_0xf721('0x7')]))[_0xf721('0x1a')]('mail_queue:save',_0x27f035);}};module[_0xf721('0x1b')]=MailQueue; \ No newline at end of file +var _0x2201=['updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','mailPause','available','format','emit','exports','md5','ioredis','../../../config/environment','redis','localhost','name','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x2201,0xcd));var _0x1220=function(_0x40b43e,_0x25cd65){_0x40b43e=_0x40b43e-0x0;var _0x223eb3=_0x2201[_0x40b43e];return _0x223eb3;};'use strict';var _=require('lodash');var md5=require(_0x1220('0x0'));var util=require('util');var Redis=require(_0x1220('0x1'));var config=require(_0x1220('0x2'));config['redis']=_['defaults'](config[_0x1220('0x3')],{'host':_0x1220('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1220('0x3')]));function MailQueue(_0x5a2b6c){this['id']=_0x5a2b6c['id']||0x0;this[_0x1220('0x5')]=_0x5a2b6c[_0x1220('0x5')]||'';this['timeout']=_0x5a2b6c['timeout']||0xa;this['strategy']=_0x5a2b6c['strategy']||_0x1220('0x6');this[_0x1220('0x7')]=_0x5a2b6c[_0x1220('0x7')];this[_0x1220('0x8')]={};this[_0x1220('0x9')]=0x0;this[_0x1220('0x0')]='';this[_0x1220('0xa')]();this[_0x1220('0xb')]();}MailQueue['prototype']['updateRouting']=function(){var _0x2cd2c9=this['mapAgentsId'][_0x1220('0xc')];this[_0x1220('0x8')]=_[_0x1220('0xd')](this['Agents'],'id');this[_0x1220('0x8')][_0x1220('0xc')]=_0x2cd2c9;};MailQueue[_0x1220('0xe')][_0x1220('0xb')]=function(){this[_0x1220('0xf')]=0x0;this[_0x1220('0x10')]=0x0;for(var _0x593b55=0x0;_0x593b55=0x0?this[_0x1220('0x14')]:0x0;var _0x15cdb4={'id':this['id'],'available':this[_0x1220('0x14')],'loggedIn':this[_0x1220('0xf')],'name':this[_0x1220('0x5')],'paused':this[_0x1220('0x10')],'waiting':this[_0x1220('0x9')]};var _0x5127cb=md5(JSON['stringify'](_0x15cdb4));if(this['md5']!==_0x5127cb){this[_0x1220('0x0')]=_0x5127cb;io['to'](util[_0x1220('0x15')]('mail:queue:%s',_0x15cdb4['name']))[_0x1220('0x16')]('mail_queue:save',_0x15cdb4);}};module[_0x1220('0x17')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 0ba4baf..f9c611a 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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0x2ef3,0xba));var _0x32ef=function(_0x2f67c9,_0xf0e24e){_0x2f67c9=_0x2f67c9-0x0;var _0x1f3ab0=_0x2ef3[_0x2f67c9];return _0x1f3ab0;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 2799734..c67c7e7 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 _0xa3e6=['name','timeout','strategy','Agents','md5','updateRealtime','updateRouting','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','smsPause','available','waiting','format','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost'];(function(_0x298abc,_0x3d2c9d){var _0x28051e=function(_0xf7a936){while(--_0xf7a936){_0x298abc['push'](_0x298abc['shift']());}};_0x28051e(++_0x3d2c9d);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x43a07c,_0x45f600){_0x43a07c=_0x43a07c-0x0;var _0x3bc7bc=_0xa3e6[_0x43a07c];return _0x3bc7bc;};'use strict';var _=require(_0x6a3e('0x0'));var md5=require('md5');var util=require(_0x6a3e('0x1'));var Redis=require('ioredis');var config=require(_0x6a3e('0x2'));config[_0x6a3e('0x3')]=_[_0x6a3e('0x4')](config['redis'],{'host':_0x6a3e('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a3e('0x3')]));function SmsQueue(_0x23599b){this['id']=_0x23599b['id']||0x0;this[_0x6a3e('0x6')]=_0x23599b[_0x6a3e('0x6')]||'';this[_0x6a3e('0x7')]=_0x23599b['timeout']||0xa;this[_0x6a3e('0x8')]=_0x23599b[_0x6a3e('0x8')]||'beepall';this['Agents']=_0x23599b[_0x6a3e('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x6a3e('0xa')]='';this['updateRouting']();this[_0x6a3e('0xb')]();}SmsQueue['prototype'][_0x6a3e('0xc')]=function(){var _0x3159db=this[_0x6a3e('0xd')][_0x6a3e('0xe')];this[_0x6a3e('0xd')]=_[_0x6a3e('0xf')](this['Agents'],'id');this[_0x6a3e('0xd')][_0x6a3e('0xe')]=_0x3159db;};SmsQueue[_0x6a3e('0x10')][_0x6a3e('0xb')]=function(){this[_0x6a3e('0x11')]=0x0;this[_0x6a3e('0x12')]=0x0;for(var _0x222f7c=0x0;_0x222f7c=0x0?this[_0x6a3e('0x16')]:0x0;var _0x467e2c={'id':this['id'],'available':this[_0x6a3e('0x16')],'loggedIn':this[_0x6a3e('0x11')],'name':this[_0x6a3e('0x6')],'paused':this[_0x6a3e('0x12')],'waiting':this[_0x6a3e('0x17')]};var _0x2f2150=md5(JSON['stringify'](_0x467e2c));if(this[_0x6a3e('0xa')]!==_0x2f2150){this['md5']=_0x2f2150;io['to'](util[_0x6a3e('0x18')]('sms:queue:%s',_0x467e2c[_0x6a3e('0x6')]))[_0x6a3e('0x19')](_0x6a3e('0x1a'),_0x467e2c);}};module[_0x6a3e('0x1b')]=SmsQueue; \ No newline at end of file +var _0xb90d=['sms_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','length','loggedIn','available','paused','stringify','format','sms:queue:%s','emit'];(function(_0x53acc6,_0x351a19){var _0x195e4b=function(_0x1281d2){while(--_0x1281d2){_0x53acc6['push'](_0x53acc6['shift']());}};_0x195e4b(++_0x351a19);}(_0xb90d,0x17a));var _0xdb90=function(_0x40c6a7,_0x4fc99d){_0x40c6a7=_0x40c6a7-0x0;var _0x37f57d=_0xb90d[_0x40c6a7];return _0x37f57d;};'use strict';var _=require('lodash');var md5=require(_0xdb90('0x0'));var util=require(_0xdb90('0x1'));var Redis=require(_0xdb90('0x2'));var config=require(_0xdb90('0x3'));config[_0xdb90('0x4')]=_[_0xdb90('0x5')](config['redis'],{'host':_0xdb90('0x6'),'port':0x18eb});var io=require(_0xdb90('0x7'))(new Redis(config[_0xdb90('0x4')]));function SmsQueue(_0x532dbc){this['id']=_0x532dbc['id']||0x0;this['name']=_0x532dbc[_0xdb90('0x8')]||'';this[_0xdb90('0x9')]=_0x532dbc[_0xdb90('0x9')]||0xa;this[_0xdb90('0xa')]=_0x532dbc['strategy']||_0xdb90('0xb');this[_0xdb90('0xc')]=_0x532dbc[_0xdb90('0xc')];this['mapAgentsId']={};this[_0xdb90('0xd')]=0x0;this[_0xdb90('0x0')]='';this[_0xdb90('0xe')]();this[_0xdb90('0xf')]();}SmsQueue[_0xdb90('0x10')]['updateRouting']=function(){var _0x597572=this['mapAgentsId'][_0xdb90('0x11')];this[_0xdb90('0x12')]=_[_0xdb90('0x13')](this[_0xdb90('0xc')],'id');this[_0xdb90('0x12')][_0xdb90('0x11')]=_0x597572;};SmsQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x569d40=0x0;_0x569d40=0x0?this[_0xdb90('0x16')]:0x0;var _0xd50abd={'id':this['id'],'available':this[_0xdb90('0x16')],'loggedIn':this[_0xdb90('0x15')],'name':this[_0xdb90('0x8')],'paused':this[_0xdb90('0x17')],'waiting':this[_0xdb90('0xd')]};var _0x19e1bf=md5(JSON[_0xdb90('0x18')](_0xd50abd));if(this['md5']!==_0x19e1bf){this['md5']=_0x19e1bf;io['to'](util[_0xdb90('0x19')](_0xdb90('0x1a'),_0xd50abd[_0xdb90('0x8')]))[_0xdb90('0x1b')](_0xdb90('0x1c'),_0xd50abd);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index e49a8d2..7f9479c 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 _0xc9e9=['whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length','online'];(function(_0x1989e2,_0x5a3b47){var _0x218d38=function(_0x572af8){while(--_0x572af8){_0x1989e2['push'](_0x1989e2['shift']());}};_0x218d38(++_0x5a3b47);}(_0xc9e9,0xe7));var _0x9c9e=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xc9e9[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0x9c9e('0x0'));var md5=require(_0x9c9e('0x1'));var util=require(_0x9c9e('0x2'));var Redis=require(_0x9c9e('0x3'));var config=require('../../../config/environment');config[_0x9c9e('0x4')]=_[_0x9c9e('0x5')](config[_0x9c9e('0x4')],{'host':_0x9c9e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9c9e('0x4')]));function WhatsappQueue(_0x325e2a){this['id']=_0x325e2a['id']||0x0;this[_0x9c9e('0x7')]=_0x325e2a[_0x9c9e('0x7')]||'';this[_0x9c9e('0x8')]=_0x325e2a[_0x9c9e('0x8')]||0xa;this[_0x9c9e('0x9')]=_0x325e2a[_0x9c9e('0x9')]||'beepall';this[_0x9c9e('0xa')]=_0x325e2a['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x9c9e('0x1')]='';this[_0x9c9e('0xb')]();this[_0x9c9e('0xc')]();}WhatsappQueue[_0x9c9e('0xd')][_0x9c9e('0xb')]=function(){var _0x3563f9=this['mapAgentsId'][_0x9c9e('0xe')];this[_0x9c9e('0xf')]=_[_0x9c9e('0x10')](this['Agents'],'id');this[_0x9c9e('0xf')][_0x9c9e('0xe')]=_0x3563f9;};WhatsappQueue[_0x9c9e('0xd')]['updateRealtime']=function(){this[_0x9c9e('0x11')]=0x0;this[_0x9c9e('0x12')]=0x0;for(var _0x165a26=0x0;_0x165a26=0x0?this['available']:0x0;var _0xb454d5={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x9c9e('0x12')],'waiting':this['waiting']};var _0x21d16b=md5(JSON[_0x9c9e('0x17')](_0xb454d5));if(this['md5']!==_0x21d16b){this[_0x9c9e('0x1')]=_0x21d16b;io['to'](util['format'](_0x9c9e('0x18'),_0xb454d5[_0x9c9e('0x7')]))[_0x9c9e('0x19')](_0x9c9e('0x1a'),_0xb454d5);}};module[_0x9c9e('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x61e1=['loggedIn','length','online','whatsappPause','available','paused','waiting','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr'];(function(_0x224449,_0x29ac59){var _0xb92cb5=function(_0x1f54ae){while(--_0x1f54ae){_0x224449['push'](_0x224449['shift']());}};_0xb92cb5(++_0x29ac59);}(_0x61e1,0x129));var _0x161e=function(_0x598524,_0x43afdf){_0x598524=_0x598524-0x0;var _0xccf0eb=_0x61e1[_0x598524];return _0xccf0eb;};'use strict';var _=require(_0x161e('0x0'));var md5=require(_0x161e('0x1'));var util=require(_0x161e('0x2'));var Redis=require(_0x161e('0x3'));var config=require(_0x161e('0x4'));config['redis']=_['defaults'](config[_0x161e('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x161e('0x5')]));function WhatsappQueue(_0x42dcd5){this['id']=_0x42dcd5['id']||0x0;this[_0x161e('0x6')]=_0x42dcd5[_0x161e('0x6')]||'';this[_0x161e('0x7')]=_0x42dcd5['timeout']||0xa;this[_0x161e('0x8')]=_0x42dcd5[_0x161e('0x8')]||'beepall';this[_0x161e('0x9')]=_0x42dcd5['Agents'];this[_0x161e('0xa')]={};this['waiting']=0x0;this['md5']='';this[_0x161e('0xb')]();this[_0x161e('0xc')]();}WhatsappQueue[_0x161e('0xd')][_0x161e('0xb')]=function(){var _0x459ccd=this[_0x161e('0xa')][_0x161e('0xe')];this[_0x161e('0xa')]=_['map'](this[_0x161e('0x9')],'id');this['mapAgentsId'][_0x161e('0xe')]=_0x459ccd;};WhatsappQueue[_0x161e('0xd')][_0x161e('0xc')]=function(){this[_0x161e('0xf')]=0x0;this['paused']=0x0;for(var _0x4f8b87=0x0;_0x4f8b87=0x0?this[_0x161e('0x13')]:0x0;var _0x4d99ab={'id':this['id'],'available':this[_0x161e('0x13')],'loggedIn':this[_0x161e('0xf')],'name':this[_0x161e('0x6')],'paused':this[_0x161e('0x14')],'waiting':this[_0x161e('0x15')]};var _0xec0728=md5(JSON[_0x161e('0x16')](_0x4d99ab));if(this[_0x161e('0x1')]!==_0xec0728){this[_0x161e('0x1')]=_0xec0728;io['to'](util['format'](_0x161e('0x17'),_0x4d99ab['name']))[_0x161e('0x18')](_0x161e('0x19'),_0x4d99ab);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 10f9ea5..abdc2e4 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x2c1f99,_0x24ee3b){var _0x7f6f6a=function(_0x58960c){while(--_0x58960c){_0x2c1f99['push'](_0x2c1f99['shift']());}};_0x7f6f6a(++_0x24ee3b);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f042c,_0x3d2cfe){_0x3f042c=_0x3f042c-0x0;var _0x280d2e=_0xb10b[_0x3f042c];return _0x280d2e;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x2ef549,_0xe3e55e){var _0x59422b=function(_0x2f2156){while(--_0x2f2156){_0x2ef549['push'](_0x2ef549['shift']());}};_0x59422b(++_0xe3e55e);}(_0xb10b,0x12a));var _0xbb10=function(_0x4caf4f,_0x1f9d37){_0x4caf4f=_0x4caf4f-0x0;var _0xf64dd9=_0xb10b[_0x4caf4f];return _0xf64dd9;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 86e7e9d..a7c55cf 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 _0xb0eb=['AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','addTags'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb0eb,0x1b1));var _0xbb0e=function(_0x49b602,_0x5e318a){_0x49b602=_0x49b602-0x0;var _0x343299=_0xb0eb[_0x49b602];return _0x343299;};'use strict';var client=require(_0xbb0e('0x0'));exports[_0xbb0e('0x1')]=function(_0x6cb392,_0x24a6d1){return client[_0xbb0e('0x2')](_0xbb0e('0x3'),{'body':_0x24a6d1,'options':{'where':{'id':_0x6cb392}},'log':'updateChatInteraction'});};exports[_0xbb0e('0x4')]=function(_0xed9e0a,_0x1fb1c7){return client['Request'](_0xbb0e('0x5'),{'body':_0x1fb1c7,'options':{'where':{'id':_0xed9e0a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xc029=['Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','updateChatInteraction','addTags'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc029,0x7a));var _0x9c02=function(_0x20bbe5,_0x189723){_0x20bbe5=_0x20bbe5-0x0;var _0x1d94c7=_0xc029[_0x20bbe5];return _0x1d94c7;};'use strict';var client=require(_0x9c02('0x0'));exports[_0x9c02('0x1')]=function(_0x954092,_0x457753){return client['Request']('UpdateChatInteraction',{'body':_0x457753,'options':{'where':{'id':_0x954092}},'log':_0x9c02('0x2')});};exports[_0x9c02('0x3')]=function(_0x32ac6c,_0x51c908){return client[_0x9c02('0x4')](_0x9c02('0x5'),{'body':_0x51c908,'options':{'where':{'id':_0x32ac6c}},'log':_0x9c02('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 6663b6c..a420d97 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 _0xae71=['createChatMessage','../client','Request'];(function(_0x45efed,_0x375d0b){var _0x20ae3b=function(_0x38996d){while(--_0x38996d){_0x45efed['push'](_0x45efed['shift']());}};_0x20ae3b(++_0x375d0b);}(_0xae71,0xca));var _0x1ae7=function(_0xce84b7,_0x1be375){_0xce84b7=_0xce84b7-0x0;var _0xf02e59=_0xae71[_0xce84b7];return _0xf02e59;};'use strict';var client=require(_0x1ae7('0x0'));exports['create']=function(_0x767e6e){return client[_0x1ae7('0x1')]('CreateChatMessage',{'body':_0x767e6e,'log':_0x1ae7('0x2')});}; \ No newline at end of file +var _0xf9eb=['createChatMessage','create','Request','CreateChatMessage'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0xf9eb,0x169));var _0xbf9e=function(_0x4b040e,_0x5bb95f){_0x4b040e=_0x4b040e-0x0;var _0x1e2f00=_0xf9eb[_0x4b040e];return _0x1e2f00;};'use strict';var client=require('../client');exports[_0xbf9e('0x0')]=function(_0x426969){return client[_0xbf9e('0x1')](_0xbf9e('0x2'),{'body':_0x426969,'log':_0xbf9e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 73d612d..259b706 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 _0x3148=['getChatQueues','GetChatQueue','name','timeout','strategy','Agents','online','chatPause','../client'];(function(_0x145204,_0x30d112){var _0x12cda3=function(_0x21880e){while(--_0x21880e){_0x145204['push'](_0x145204['shift']());}};_0x12cda3(++_0x30d112);}(_0x3148,0x1d3));var _0x8314=function(_0x412686,_0x3fde24){_0x412686=_0x412686-0x0;var _0x18619e=_0x3148[_0x412686];return _0x18619e;};'use strict';var client=require(_0x8314('0x0'));exports[_0x8314('0x1')]=function(){return function(){return client['Request'](_0x8314('0x2'),{'options':{'raw':![],'attributes':['id',_0x8314('0x3'),_0x8314('0x4'),_0x8314('0x5')],'include':[{'model':'User','as':_0x8314('0x6'),'attributes':['id',_0x8314('0x3'),_0x8314('0x7'),_0x8314('0x8')]}]},'log':_0x8314('0x1')});};}; \ No newline at end of file +var _0xc01b=['name','timeout','strategy','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x4cec42,_0x1ea380){var _0x84e435=function(_0x3596b9){while(--_0x3596b9){_0x4cec42['push'](_0x4cec42['shift']());}};_0x84e435(++_0x1ea380);}(_0xc01b,0x74));var _0xbc01=function(_0x52d6a1,_0x4d6211){_0x52d6a1=_0x52d6a1-0x0;var _0x48e9ad=_0xc01b[_0x52d6a1];return _0x48e9ad;};'use strict';var client=require(_0xbc01('0x0'));exports[_0xbc01('0x1')]=function(){return function(){return client[_0xbc01('0x2')](_0xbc01('0x3'),{'options':{'raw':![],'attributes':['id',_0xbc01('0x4'),_0xbc01('0x5'),_0xbc01('0x6')],'include':[{'model':'User','as':_0xbc01('0x7'),'attributes':['id',_0xbc01('0x4'),_0xbc01('0x8'),_0xbc01('0x9')]}]},'log':_0xbc01('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0daf234..3e0ca6e 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 _0xbdeb=['update','DESC','UpdateChatQueueReport','create','Request','CreateChatQueueReport'];(function(_0x57391c,_0x1a2a94){var _0x3de79b=function(_0x573b23){while(--_0x573b23){_0x57391c['push'](_0x57391c['shift']());}};_0x3de79b(++_0x1a2a94);}(_0xbdeb,0x6f));var _0xbbde=function(_0x5e3139,_0x5bad26){_0x5e3139=_0x5e3139-0x0;var _0x3cdf31=_0xbdeb[_0x5e3139];return _0x3cdf31;};'use strict';var client=require('../client');exports[_0xbbde('0x0')]=function(_0x4b7192){return client[_0xbbde('0x1')]('CreateChatQueueReport',{'body':_0x4b7192,'log':_0xbbde('0x2')});};exports[_0xbbde('0x3')]=function(_0x20d4f0,_0x3ee0ec){return client['Request']('UpdateChatQueueReport',{'body':_0x3ee0ec,'options':{'where':{'uniqueid':_0x20d4f0},'order':[['id',_0xbbde('0x4')]],'limit':0x1},'log':_0xbbde('0x5')});}; \ No newline at end of file +var _0x192f=['CreateChatQueueReport','Request','UpdateChatQueueReport','DESC','../client'];(function(_0x1ed9e5,_0x3da20f){var _0x2565b9=function(_0x35e73b){while(--_0x35e73b){_0x1ed9e5['push'](_0x1ed9e5['shift']());}};_0x2565b9(++_0x3da20f);}(_0x192f,0xd6));var _0xf192=function(_0x4108da,_0x5c052f){_0x4108da=_0x4108da-0x0;var _0xdfa050=_0x192f[_0x4108da];return _0xdfa050;};'use strict';var client=require(_0xf192('0x0'));exports['create']=function(_0x2ed899){return client['Request'](_0xf192('0x1'),{'body':_0x2ed899,'log':'CreateChatQueueReport'});};exports['update']=function(_0x3ed9c1,_0x3b704f){return client[_0xf192('0x2')](_0xf192('0x3'),{'body':_0x3b704f,'options':{'where':{'uniqueid':_0x3ed9c1},'order':[['id',_0xf192('0x4')]],'limit':0x1},'log':_0xf192('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 781cae2..543e71e 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x27ac32,_0x42771f){var _0x20c811=function(_0x12d837){while(--_0x12d837){_0x27ac32['push'](_0x27ac32['shift']());}};_0x20c811(++_0x42771f);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0x7a54,0x106));var _0x47a5=function(_0x536e7c,_0x28379a){_0x536e7c=_0x536e7c-0x0;var _0x318b00=_0x7a54[_0x536e7c];return _0x318b00;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index b6bd0c0..9b888fd 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 _0xbc81=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x2027eb,_0x5508f5){var _0x12a791=function(_0x220f59){while(--_0x220f59){_0x2027eb['push'](_0x2027eb['shift']());}};_0x12a791(++_0x5508f5);}(_0xbc81,0x8d));var _0x1bc8=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xbc81[_0x599f41];return _0x2e4d58;};'use strict';var client=require(_0x1bc8('0x0'));exports[_0x1bc8('0x1')]=function(_0xe9f772){return client[_0x1bc8('0x2')](_0x1bc8('0x3'),{'body':_0xe9f772,'log':_0x1bc8('0x4')});}; \ No newline at end of file +var _0x066d=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x54c25e,_0x28174f){var _0x2c4f3f=function(_0x3caa7){while(--_0x3caa7){_0x54c25e['push'](_0x54c25e['shift']());}};_0x2c4f3f(++_0x28174f);}(_0x066d,0xb1));var _0xd066=function(_0x4e6849,_0x1cb237){_0x4e6849=_0x4e6849-0x0;var _0x1b9754=_0x066d[_0x4e6849];return _0x1b9754;};'use strict';var client=require('../client');exports['create']=function(_0x80045){return client[_0xd066('0x0')](_0xd066('0x1'),{'body':_0x80045,'log':_0xd066('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 1371dda..f42b50a 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 _0x0e1f=['Agents','online','faxPause','getFaxQueues','../client','Request','name','timeout','strategy','User'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0x0e1f,0x162));var _0xf0e1=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0e1f[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0xf0e1('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xf0e1('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xf0e1('0x2'),_0xf0e1('0x3'),_0xf0e1('0x4')],'include':[{'model':_0xf0e1('0x5'),'as':_0xf0e1('0x6'),'attributes':['id',_0xf0e1('0x2'),_0xf0e1('0x7'),_0xf0e1('0x8')]}]},'log':_0xf0e1('0x9')});};}; \ No newline at end of file +var _0x390f=['Request','GetFaxQueue','name','strategy','User','Agents','getFaxQueues'];(function(_0x1bd3ac,_0x43eb80){var _0x13dd51=function(_0x2520de){while(--_0x2520de){_0x1bd3ac['push'](_0x1bd3ac['shift']());}};_0x13dd51(++_0x43eb80);}(_0x390f,0x76));var _0xf390=function(_0x2fd111,_0xdcd209){_0x2fd111=_0x2fd111-0x0;var _0x467b0e=_0x390f[_0x2fd111];return _0x467b0e;};'use strict';var client=require('../client');exports[_0xf390('0x0')]=function(){return function(){return client[_0xf390('0x1')](_0xf390('0x2'),{'options':{'raw':![],'attributes':['id',_0xf390('0x3'),'timeout',_0xf390('0x4')],'include':[{'model':_0xf390('0x5'),'as':_0xf390('0x6'),'attributes':['id',_0xf390('0x3'),'online','faxPause']}]},'log':_0xf390('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 34080a1..d814d64 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 _0x9c91=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x43aea8,_0x52fb4e){var _0x408de2=function(_0x4b28c7){while(--_0x4b28c7){_0x43aea8['push'](_0x43aea8['shift']());}};_0x408de2(++_0x52fb4e);}(_0x9c91,0x153));var _0x19c9=function(_0x525c13,_0x3a7272){_0x525c13=_0x525c13-0x0;var _0x3123b6=_0x9c91[_0x525c13];return _0x3123b6;};'use strict';var client=require(_0x19c9('0x0'));exports[_0x19c9('0x1')]=function(_0x38aeaa){return client[_0x19c9('0x2')](_0x19c9('0x3'),{'body':_0x38aeaa,'log':_0x19c9('0x3')});};exports[_0x19c9('0x4')]=function(_0x59bcd9,_0x5d5653){return client[_0x19c9('0x2')](_0x19c9('0x5'),{'body':_0x5d5653,'options':{'where':{'uniqueid':_0x59bcd9},'order':[['id',_0x19c9('0x6')]],'limit':0x1},'log':_0x19c9('0x5')});}; \ No newline at end of file +var _0xb3c5=['UpdateFaxQueueReport','DESC','../client','Request','CreateFaxQueueReport','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb3c5,0xec));var _0x5b3c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb3c5[_0x465028];return _0xb783d4;};'use strict';var client=require(_0x5b3c('0x0'));exports['create']=function(_0xfcecf3){return client[_0x5b3c('0x1')](_0x5b3c('0x2'),{'body':_0xfcecf3,'log':_0x5b3c('0x2')});};exports[_0x5b3c('0x3')]=function(_0x1daa37,_0x157629){return client['Request'](_0x5b3c('0x4'),{'body':_0x157629,'options':{'where':{'uniqueid':_0x1daa37},'order':[['id',_0x5b3c('0x5')]],'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 2da644e..4a93371 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 _0x2674=['interval','../client','getIntervals','name','Interval','Intervals'];(function(_0x1db59b,_0x351d51){var _0x565f5c=function(_0x49e39e){while(--_0x49e39e){_0x1db59b['push'](_0x1db59b['shift']());}};_0x565f5c(++_0x351d51);}(_0x2674,0xa9));var _0x4267=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2674[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x4267('0x0'));exports[_0x4267('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4267('0x2')],'include':[{'model':_0x4267('0x3'),'as':_0x4267('0x4'),'attributes':['id',_0x4267('0x2'),_0x4267('0x5')]}]},'log':_0x4267('0x1')});};}; \ No newline at end of file +var _0x0a0a=['Interval','Intervals','name','interval','getIntervals','Request','GetInterval'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0a0a,0xa5));var _0xa0a0=function(_0x1bf5b2,_0xa0a0ee){_0x1bf5b2=_0x1bf5b2-0x0;var _0x38fec5=_0x0a0a[_0x1bf5b2];return _0x38fec5;};'use strict';var client=require('../client');exports[_0xa0a0('0x0')]=function(){return function(){return client[_0xa0a0('0x1')](_0xa0a0('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xa0a0('0x3'),'as':_0xa0a0('0x4'),'attributes':['id',_0xa0a0('0x5'),_0xa0a0('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f62b56d..7c9768c 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 _0x7916=['Request','addTagsToChatInteraction','../client','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x4375bc,_0x1d2193){var _0x24f7c0=function(_0x5efe75){while(--_0x5efe75){_0x4375bc['push'](_0x4375bc['shift']());}};_0x24f7c0(++_0x1d2193);}(_0x7916,0x128));var _0x6791=function(_0x16a08e,_0x2c9e3b){_0x16a08e=_0x16a08e-0x0;var _0x1594a0=_0x7916[_0x16a08e];return _0x1594a0;};'use strict';var client=require(_0x6791('0x0'));exports['update']=function(_0xeb0b9f,_0xdaaf2b){return client['Request'](_0x6791('0x1'),{'body':_0xdaaf2b,'options':{'where':{'id':_0xeb0b9f}},'log':_0x6791('0x2')});};exports[_0x6791('0x3')]=function(_0x330476,_0x5e6303){return client[_0x6791('0x4')]('AddTagsToMailInteraction',{'body':_0x5e6303,'options':{'where':{'id':_0x330476}},'log':_0x6791('0x5')});}; \ No newline at end of file +var _0x3266=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x2b2469,_0x43a66a){var _0x47606a=function(_0x5c18e4){while(--_0x5c18e4){_0x2b2469['push'](_0x2b2469['shift']());}};_0x47606a(++_0x43a66a);}(_0x3266,0x6a));var _0x6326=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3266[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(_0x3a3ebd,_0x2bed83){return client[_0x6326('0x2')](_0x6326('0x3'),{'body':_0x2bed83,'options':{'where':{'id':_0x3a3ebd}},'log':_0x6326('0x4')});};exports[_0x6326('0x5')]=function(_0x265264,_0x5a6b4d){return client[_0x6326('0x2')]('AddTagsToMailInteraction',{'body':_0x5a6b4d,'options':{'where':{'id':_0x265264}},'log':_0x6326('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 8aa8891..73edb6d 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 _0x77dc=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x43dabb,_0x1dcda3){var _0x44f079=function(_0x43d89c){while(--_0x43d89c){_0x43dabb['push'](_0x43dabb['shift']());}};_0x44f079(++_0x1dcda3);}(_0x77dc,0x114));var _0xc77d=function(_0x4a491c,_0x14fc45){_0x4a491c=_0x4a491c-0x0;var _0x5d52fd=_0x77dc[_0x4a491c];return _0x5d52fd;};'use strict';var client=require(_0xc77d('0x0'));exports[_0xc77d('0x1')]=function(_0x581fc9){return client['Request'](_0xc77d('0x2'),{'body':_0x581fc9,'log':_0xc77d('0x3')});}; \ No newline at end of file +var _0xd2e3=['createMailMessage','../client'];(function(_0x26a5a2,_0x29591b){var _0x2800a4=function(_0x5a7c90){while(--_0x5a7c90){_0x26a5a2['push'](_0x26a5a2['shift']());}};_0x2800a4(++_0x29591b);}(_0xd2e3,0x187));var _0x3d2e=function(_0x570b0e,_0x3e0c2b){_0x570b0e=_0x570b0e-0x0;var _0xe9219d=_0xd2e3[_0x570b0e];return _0xe9219d;};'use strict';var client=require(_0x3d2e('0x0'));exports['create']=function(_0x29f0cb){return client['Request']('CreateMailMessage',{'body':_0x29f0cb,'log':_0x3d2e('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index c259fa3..817ae3c 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 _0xf32f=['getMailQueues','GetMailQueue','name','strategy','User','Agents','online','../client'];(function(_0x2366cf,_0x36bbf9){var _0x2dcef9=function(_0x113766){while(--_0x113766){_0x2366cf['push'](_0x2366cf['shift']());}};_0x2dcef9(++_0x36bbf9);}(_0xf32f,0x1ef));var _0xff32=function(_0x3a234a,_0x16d323){_0x3a234a=_0x3a234a-0x0;var _0x35c10a=_0xf32f[_0x3a234a];return _0x35c10a;};'use strict';var client=require(_0xff32('0x0'));exports[_0xff32('0x1')]=function(){return function(){return client['Request'](_0xff32('0x2'),{'options':{'raw':![],'attributes':['id',_0xff32('0x3'),'timeout',_0xff32('0x4')],'include':[{'model':_0xff32('0x5'),'as':_0xff32('0x6'),'attributes':['id',_0xff32('0x3'),_0xff32('0x7'),'mailPause']}]},'log':_0xff32('0x1')});};}; \ No newline at end of file +var _0x0e10=['Agents','online','../client','getMailQueues','Request','strategy','User'];(function(_0x33f3da,_0x44e14a){var _0x4e4363=function(_0x20bccf){while(--_0x20bccf){_0x33f3da['push'](_0x33f3da['shift']());}};_0x4e4363(++_0x44e14a);}(_0x0e10,0x167));var _0x00e1=function(_0x4ad6df,_0x3e46d3){_0x4ad6df=_0x4ad6df-0x0;var _0x5c8bb0=_0x0e10[_0x4ad6df];return _0x5c8bb0;};'use strict';var client=require(_0x00e1('0x0'));exports[_0x00e1('0x1')]=function(){return function(){return client[_0x00e1('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x00e1('0x3')],'include':[{'model':_0x00e1('0x4'),'as':_0x00e1('0x5'),'attributes':['id','name',_0x00e1('0x6'),'mailPause']}]},'log':_0x00e1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 73134a0..18e215f 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 _0xd0d9=['create','CreateMailQueueReport','Request','UpdateMailQueueReport','../client'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd0d9,0x11c));var _0x9d0d=function(_0xe1a8d0,_0x292e4c){_0xe1a8d0=_0xe1a8d0-0x0;var _0x3a9c90=_0xd0d9[_0xe1a8d0];return _0x3a9c90;};'use strict';var client=require(_0x9d0d('0x0'));exports[_0x9d0d('0x1')]=function(_0x2e59d3){return client['Request'](_0x9d0d('0x2'),{'body':_0x2e59d3,'log':'CreateMailQueueReport'});};exports['update']=function(_0x1fe491,_0x2d5260){return client[_0x9d0d('0x3')](_0x9d0d('0x4'),{'body':_0x2d5260,'options':{'where':{'uniqueid':_0x1fe491},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xfa49=['DESC','UpdateMailQueueReport','../client','Request','CreateMailQueueReport'];(function(_0x11a591,_0x3bf0b9){var _0x1d49ac=function(_0x2ccfd5){while(--_0x2ccfd5){_0x11a591['push'](_0x11a591['shift']());}};_0x1d49ac(++_0x3bf0b9);}(_0xfa49,0xac));var _0x9fa4=function(_0x525114,_0x10589d){_0x525114=_0x525114-0x0;var _0x5cdab8=_0xfa49[_0x525114];return _0x5cdab8;};'use strict';var client=require(_0x9fa4('0x0'));exports['create']=function(_0x3a2b5e){return client[_0x9fa4('0x1')]('CreateMailQueueReport',{'body':_0x3a2b5e,'log':_0x9fa4('0x2')});};exports['update']=function(_0x1393bf,_0x4e55a4){return client[_0x9fa4('0x1')]('UpdateMailQueueReport',{'body':_0x4e55a4,'options':{'where':{'uniqueid':_0x1393bf},'order':[['id',_0x9fa4('0x3')]],'limit':0x1},'log':_0x9fa4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 40697d9..5d7fc43 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 _0x968a=['addTags','AddTagsToOpenchannelInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x968a,0x1b8));var _0xa968=function(_0x577d63,_0x21cf6d){_0x577d63=_0x577d63-0x0;var _0x7bb968=_0x968a[_0x577d63];return _0x7bb968;};'use strict';var client=require(_0xa968('0x0'));exports['update']=function(_0xf5304f,_0x1a4597){return client[_0xa968('0x1')](_0xa968('0x2'),{'body':_0x1a4597,'options':{'where':{'id':_0xf5304f}},'log':_0xa968('0x3')});};exports[_0xa968('0x4')]=function(_0x51c880,_0x15502f){return client['Request'](_0xa968('0x5'),{'body':_0x15502f,'options':{'where':{'id':_0x51c880}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xce88=['Request','UpdateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x4c5ab6,_0x576d83){var _0x5263d5=function(_0x400409){while(--_0x400409){_0x4c5ab6['push'](_0x4c5ab6['shift']());}};_0x5263d5(++_0x576d83);}(_0xce88,0x180));var _0x8ce8=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xce88[_0x1caf6a];return _0x1bf493;};'use strict';var client=require('../client');exports['update']=function(_0x3e72a4,_0x1fe574){return client[_0x8ce8('0x0')](_0x8ce8('0x1'),{'body':_0x1fe574,'options':{'where':{'id':_0x3e72a4}},'log':'updateOpenchannelInteraction'});};exports[_0x8ce8('0x2')]=function(_0x566ea5,_0x5150ec){return client[_0x8ce8('0x0')]('AddTagsToOpenchannelInteraction',{'body':_0x5150ec,'options':{'where':{'id':_0x566ea5}},'log':_0x8ce8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 1494568..042533f 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 _0x0497=['Request','createOpenchannelMessage','../client','create'];(function(_0x546763,_0xf1294d){var _0x21fb72=function(_0x15db31){while(--_0x15db31){_0x546763['push'](_0x546763['shift']());}};_0x21fb72(++_0xf1294d);}(_0x0497,0x96));var _0x7049=function(_0x1469bd,_0x15e0f5){_0x1469bd=_0x1469bd-0x0;var _0x2e560d=_0x0497[_0x1469bd];return _0x2e560d;};'use strict';var client=require(_0x7049('0x0'));exports[_0x7049('0x1')]=function(_0x29a0ad){return client[_0x7049('0x2')]('CreateOpenchannelMessage',{'body':_0x29a0ad,'log':_0x7049('0x3')});}; \ No newline at end of file +var _0x35d5=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x53f49e,_0x43d6ce){var _0x4ba71a=function(_0x1322cc){while(--_0x1322cc){_0x53f49e['push'](_0x53f49e['shift']());}};_0x4ba71a(++_0x43d6ce);}(_0x35d5,0x16f));var _0x535d=function(_0x40a190,_0x128df0){_0x40a190=_0x40a190-0x0;var _0x41ad0e=_0x35d5[_0x40a190];return _0x41ad0e;};'use strict';var client=require(_0x535d('0x0'));exports[_0x535d('0x1')]=function(_0x130330){return client[_0x535d('0x2')](_0x535d('0x3'),{'body':_0x130330,'log':_0x535d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 0dabac6..34888a5 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 _0x3583=['online','getOpenchannelQueues','../client','Request','name','timeout','strategy','User','Agents'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x3583,0xa4));var _0x3358=function(_0x395a69,_0x422258){_0x395a69=_0x395a69-0x0;var _0x969131=_0x3583[_0x395a69];return _0x969131;};'use strict';var client=require(_0x3358('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x3358('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x3358('0x2'),_0x3358('0x3'),_0x3358('0x4')],'include':[{'model':_0x3358('0x5'),'as':_0x3358('0x6'),'attributes':['id',_0x3358('0x2'),_0x3358('0x7'),'openchannelPause']}]},'log':_0x3358('0x8')});};}; \ No newline at end of file +var _0x426a=['Request','GetOpenchannelQueue','name','timeout','User','online','../client','getOpenchannelQueues'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x426a,0x1c6));var _0xa426=function(_0x54ba5d,_0x134d1a){_0x54ba5d=_0x54ba5d-0x0;var _0x1699fe=_0x426a[_0x54ba5d];return _0x1699fe;};'use strict';var client=require(_0xa426('0x0'));exports[_0xa426('0x1')]=function(){return function(){return client[_0xa426('0x2')](_0xa426('0x3'),{'options':{'raw':![],'attributes':['id',_0xa426('0x4'),_0xa426('0x5'),'strategy'],'include':[{'model':_0xa426('0x6'),'as':'Agents','attributes':['id','name',_0xa426('0x7'),'openchannelPause']}]},'log':_0xa426('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a0a09ec..c19ad99 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 _0x1605=['create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC'];(function(_0x31423b,_0x1e0d70){var _0x26110b=function(_0x14119c){while(--_0x14119c){_0x31423b['push'](_0x31423b['shift']());}};_0x26110b(++_0x1e0d70);}(_0x1605,0x1d4));var _0x5160=function(_0x23f723,_0x41393a){_0x23f723=_0x23f723-0x0;var _0x14714c=_0x1605[_0x23f723];return _0x14714c;};'use strict';var client=require('../client');exports[_0x5160('0x0')]=function(_0x12d813){return client['Request'](_0x5160('0x1'),{'body':_0x12d813,'log':_0x5160('0x1')});};exports[_0x5160('0x2')]=function(_0xac9ae6,_0x3bbba1){return client[_0x5160('0x3')](_0x5160('0x4'),{'body':_0x3bbba1,'options':{'where':{'uniqueid':_0xac9ae6},'order':[['id',_0x5160('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x280b=['UpdateOpenchannelQueueReport','DESC','create','CreateOpenchannelQueueReport','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x280b,0x1bf));var _0xb280=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x280b[_0xbca1b1];return _0x4e1686;};'use strict';var client=require('../client');exports[_0xb280('0x0')]=function(_0x96e7a7){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x96e7a7,'log':_0xb280('0x1')});};exports[_0xb280('0x2')]=function(_0x4b5540,_0x536e29){return client['Request'](_0xb280('0x3'),{'body':_0x536e29,'options':{'where':{'uniqueid':_0x4b5540},'order':[['id',_0xb280('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index f68ee66..893171d 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 _0x2fda=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request'];(function(_0x35f704,_0x2fb3b3){var _0xa307a3=function(_0x35ceee){while(--_0x35ceee){_0x35f704['push'](_0x35f704['shift']());}};_0xa307a3(++_0x2fb3b3);}(_0x2fda,0x186));var _0xa2fd=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x2fda[_0x481bf7];return _0x461787;};'use strict';var client=require(_0xa2fd('0x0'));exports['update']=function(_0x5bfb50,_0x2a1c31){return client[_0xa2fd('0x1')](_0xa2fd('0x2'),{'body':_0x2a1c31,'options':{'where':{'id':_0x5bfb50}},'log':_0xa2fd('0x3')});};exports[_0xa2fd('0x4')]=function(_0x5a36d9,_0x497c5f){return client['Request'](_0xa2fd('0x5'),{'body':_0x497c5f,'options':{'where':{'id':_0x5a36d9}},'log':_0xa2fd('0x6')});}; \ No newline at end of file +var _0x97d5=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x55d1b0,_0x46fb94){var _0x17c5f7=function(_0x5e2bb5){while(--_0x5e2bb5){_0x55d1b0['push'](_0x55d1b0['shift']());}};_0x17c5f7(++_0x46fb94);}(_0x97d5,0x199));var _0x597d=function(_0x230b3c,_0x153e98){_0x230b3c=_0x230b3c-0x0;var _0x469bb3=_0x97d5[_0x230b3c];return _0x469bb3;};'use strict';var client=require(_0x597d('0x0'));exports[_0x597d('0x1')]=function(_0x2366b3,_0x552974){return client[_0x597d('0x2')](_0x597d('0x3'),{'body':_0x552974,'options':{'where':{'id':_0x2366b3}},'log':'updateSmsInteraction'});};exports[_0x597d('0x4')]=function(_0x2d89ef,_0x10ecda){return client['Request'](_0x597d('0x5'),{'body':_0x10ecda,'options':{'where':{'id':_0x2d89ef}},'log':_0x597d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 77de704..f69cb09 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 _0x81be=['../client','create','CreateSmsMessage','createSmsMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x81be,0xf4));var _0xe81b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x81be[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0xe81b('0x0'));exports[_0xe81b('0x1')]=function(_0x528009){return client['Request'](_0xe81b('0x2'),{'body':_0x528009,'log':_0xe81b('0x3')});}; \ No newline at end of file +var _0x1070=['../client','createSmsMessage'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1070,0xd0));var _0x0107=function(_0x12cd7c,_0x3732aa){_0x12cd7c=_0x12cd7c-0x0;var _0x326331=_0x1070[_0x12cd7c];return _0x326331;};'use strict';var client=require(_0x0107('0x0'));exports['create']=function(_0x56670b){return client['Request']('CreateSmsMessage',{'body':_0x56670b,'log':_0x0107('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index ba58755..5e6b4d6 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x264e0b,_0x9f827f){var _0x40616b=function(_0x237658){while(--_0x237658){_0x264e0b['push'](_0x264e0b['shift']());}};_0x40616b(++_0x9f827f);}(_0x70e0,0x17b));var _0x070e=function(_0x49cc49,_0x13a261){_0x49cc49=_0x49cc49-0x0;var _0x6cf7b2=_0x70e0[_0x49cc49];return _0x6cf7b2;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x4aa70f,_0x30edac){var _0x446fe9=function(_0x1494c6){while(--_0x1494c6){_0x4aa70f['push'](_0x4aa70f['shift']());}};_0x446fe9(++_0x30edac);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb7e7[_0x2aec52];return _0x3b8835;};'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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index fdc216b..70522c0 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x2cc1d3,_0x2614a2){var _0x249e05=function(_0x20f302){while(--_0x20f302){_0x2cc1d3['push'](_0x2cc1d3['shift']());}};_0x249e05(++_0x2614a2);}(_0x70e0,0x17b));var _0x070e=function(_0x31e71e,_0x29930c){_0x31e71e=_0x31e71e-0x0;var _0x5776ec=_0x70e0[_0x31e71e];return _0x5776ec;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x4ccb33,_0x2e8d20){var _0x30ce82=function(_0x8f0aed){while(--_0x8f0aed){_0x4ccb33['push'](_0x4ccb33['shift']());}};_0x30ce82(++_0x2e8d20);}(_0x3e74,0x175));var _0x43e7=function(_0x53defd,_0x341451){_0x53defd=_0x53defd-0x0;var _0x45d888=_0x3e74[_0x53defd];return _0x45d888;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1d4c95f..5da1cc8 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(_0x73df09,_0x5b217b){var _0x2c23a0=function(_0x11f752){while(--_0x11f752){_0x73df09['push'](_0x73df09['shift']());}};_0x2c23a0(++_0x5b217b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x2f63f2,_0x3805db){var _0x33341d=function(_0x24ad6e){while(--_0x24ad6e){_0x2f63f2['push'](_0x2f63f2['shift']());}};_0x33341d(++_0x3805db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 8c07e48..ee4f2cc 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 _0x2f74=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','../client','Request'];(function(_0x41031d,_0x17a3ee){var _0x2606c8=function(_0x24b03a){while(--_0x24b03a){_0x41031d['push'](_0x41031d['shift']());}};_0x2606c8(++_0x17a3ee);}(_0x2f74,0x7b));var _0x42f7=function(_0x6aa32f,_0x3820f7){_0x6aa32f=_0x6aa32f-0x0;var _0x52bfee=_0x2f74[_0x6aa32f];return _0x52bfee;};'use strict';var client=require(_0x42f7('0x0'));exports['update']=function(_0x216970,_0x32d116){return client[_0x42f7('0x1')](_0x42f7('0x2'),{'body':_0x32d116,'options':{'where':{'id':_0x216970}},'log':_0x42f7('0x3')});};exports[_0x42f7('0x4')]=function(_0x43a650,_0x16d639){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x16d639,'options':{'where':{'id':_0x43a650}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x4148=['../client','update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4148,0xc6));var _0x8414=function(_0x36db65,_0x2b4af1){_0x36db65=_0x36db65-0x0;var _0x5bea6a=_0x4148[_0x36db65];return _0x5bea6a;};'use strict';var client=require(_0x8414('0x0'));exports[_0x8414('0x1')]=function(_0x140433,_0xc19cfb){return client[_0x8414('0x2')]('UpdateWhatsappInteraction',{'body':_0xc19cfb,'options':{'where':{'id':_0x140433}},'log':_0x8414('0x3')});};exports[_0x8414('0x4')]=function(_0x41ddde,_0x361d0b){return client['Request'](_0x8414('0x5'),{'body':_0x361d0b,'options':{'where':{'id':_0x41ddde}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index e630187..63df0ec 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 _0xd601=['create','createWhatsappMessage','../client'];(function(_0x50832e,_0x91fdb8){var _0x8b6132=function(_0x12dd44){while(--_0x12dd44){_0x50832e['push'](_0x50832e['shift']());}};_0x8b6132(++_0x91fdb8);}(_0xd601,0x10d));var _0x1d60=function(_0x54e486,_0xf54b2b){_0x54e486=_0x54e486-0x0;var _0x3d9dc0=_0xd601[_0x54e486];return _0x3d9dc0;};'use strict';var client=require(_0x1d60('0x0'));exports[_0x1d60('0x1')]=function(_0x42050c){return client['Request']('CreateWhatsappMessage',{'body':_0x42050c,'log':_0x1d60('0x2')});}; \ No newline at end of file +var _0x4674=['../client','create','Request','createWhatsappMessage'];(function(_0x5e6120,_0x85f70a){var _0x39f98d=function(_0x1bb8f9){while(--_0x1bb8f9){_0x5e6120['push'](_0x5e6120['shift']());}};_0x39f98d(++_0x85f70a);}(_0x4674,0x8c));var _0x4467=function(_0x2c194a,_0x5a8a59){_0x2c194a=_0x2c194a-0x0;var _0x3df316=_0x4674[_0x2c194a];return _0x3df316;};'use strict';var client=require(_0x4467('0x0'));exports[_0x4467('0x1')]=function(_0x1625f3){return client[_0x4467('0x2')]('CreateWhatsappMessage',{'body':_0x1625f3,'log':_0x4467('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3e486da..d5428c9 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 _0xd77a=['../client','GetWhatsappQueue','name','timeout','strategy','User','online','whatsappPause'];(function(_0xc451b5,_0x396498){var _0x193963=function(_0x420800){while(--_0x420800){_0xc451b5['push'](_0xc451b5['shift']());}};_0x193963(++_0x396498);}(_0xd77a,0xb0));var _0xad77=function(_0x23b3d8,_0x4459c3){_0x23b3d8=_0x23b3d8-0x0;var _0x68eb4=_0xd77a[_0x23b3d8];return _0x68eb4;};'use strict';var client=require(_0xad77('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xad77('0x1'),{'options':{'raw':![],'attributes':['id',_0xad77('0x2'),_0xad77('0x3'),_0xad77('0x4')],'include':[{'model':_0xad77('0x5'),'as':'Agents','attributes':['id',_0xad77('0x2'),_0xad77('0x6'),_0xad77('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x7e5a=['../client','getWhatsappQueues','Request','name','timeout','strategy','User','Agents'];(function(_0x51b8e7,_0x5c70fb){var _0x81fd25=function(_0x20c527){while(--_0x20c527){_0x51b8e7['push'](_0x51b8e7['shift']());}};_0x81fd25(++_0x5c70fb);}(_0x7e5a,0x100));var _0xa7e5=function(_0x52a0be,_0x382e04){_0x52a0be=_0x52a0be-0x0;var _0x6d468f=_0x7e5a[_0x52a0be];return _0x6d468f;};'use strict';var client=require(_0xa7e5('0x0'));exports[_0xa7e5('0x1')]=function(){return function(){return client[_0xa7e5('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xa7e5('0x3'),_0xa7e5('0x4'),_0xa7e5('0x5')],'include':[{'model':_0xa7e5('0x6'),'as':_0xa7e5('0x7'),'attributes':['id',_0xa7e5('0x3'),'online','whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 351e7ff..2867454 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 _0x7d10=['../client','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x41074d,_0x19b20f){var _0x1f61b9=function(_0x34458c){while(--_0x34458c){_0x41074d['push'](_0x41074d['shift']());}};_0x1f61b9(++_0x19b20f);}(_0x7d10,0x12c));var _0x07d1=function(_0x1d817b,_0x3384a1){_0x1d817b=_0x1d817b-0x0;var _0x3c7278=_0x7d10[_0x1d817b];return _0x3c7278;};'use strict';var client=require(_0x07d1('0x0'));exports['create']=function(_0x346643){return client[_0x07d1('0x1')](_0x07d1('0x2'),{'body':_0x346643,'log':'CreateWhatsappQueueReport'});};exports[_0x07d1('0x3')]=function(_0x2cdae9,_0x225e2d){return client[_0x07d1('0x1')](_0x07d1('0x4'),{'body':_0x225e2d,'options':{'where':{'uniqueid':_0x2cdae9},'order':[['id',_0x07d1('0x5')]],'limit':0x1},'log':_0x07d1('0x4')});}; \ No newline at end of file +var _0x6698=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x195bba,_0x5b7581){var _0x4b17dc=function(_0x50ff0e){while(--_0x50ff0e){_0x195bba['push'](_0x195bba['shift']());}};_0x4b17dc(++_0x5b7581);}(_0x6698,0x1c4));var _0x8669=function(_0x20247a,_0x53c24c){_0x20247a=_0x20247a-0x0;var _0x4b122c=_0x6698[_0x20247a];return _0x4b122c;};'use strict';var client=require(_0x8669('0x0'));exports[_0x8669('0x1')]=function(_0x567333){return client[_0x8669('0x2')](_0x8669('0x3'),{'body':_0x567333,'log':_0x8669('0x3')});};exports['update']=function(_0x3c5a84,_0x2108dc){return client[_0x8669('0x2')](_0x8669('0x4'),{'body':_0x2108dc,'options':{'where':{'uniqueid':_0x3c5a84},'order':[['id','DESC']],'limit':0x1},'log':_0x8669('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 eed5e80..d49bccd 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 _0x2d44=['error','message','agents','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length'];(function(_0x2d549a,_0x3f9945){var _0x5f5938=function(_0x1071ca){while(--_0x1071ca){_0x2d549a['push'](_0x2d549a['shift']());}};_0x5f5938(++_0x3f9945);}(_0x2d44,0x1c4));var _0x42d4=function(_0x344cd2,_0x77b6ae){_0x344cd2=_0x344cd2-0x0;var _0x28688f=_0x2d44[_0x344cd2];return _0x28688f;};'use strict';var schema=require(_0x42d4('0x0'));var _=require(_0x42d4('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x42d4('0x2'))(_0x42d4('0x3'));var strategy=require(_0x42d4('0x4'));var queue=schema({'name':{'type':_0x42d4('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x42d4('0x6')}});function writeLog(_0x125c53,_0x339ce7,_0x1ad54c){return logger[_0x42d4('0x7')](util[_0x42d4('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x125c53,_0x339ce7[_0x42d4('0x9')],_0x1ad54c));}function handleFindAgent(_0x2fd7f9){return function(_0x18ca32){return _0x18ca32[_0x42d4('0x9')]['toLowerCase']()===_0x2fd7f9[_0x42d4('0xa')]();};}exports[_0x42d4('0xb')]=function(_0x17a6f6,_0x1e2aa3,_0x49c4d9,_0x25e5bc){return function(_0xf96327){try{var _0x4ec13c={'name':_0x1e2aa3[0x0],'timeout':_0x1e2aa3[0x1]};var _0x2a96d3=queue['validate'](_0x4ec13c,{'typecast':!![]});if(_0x2a96d3[_0x42d4('0xc')]){logger[_0x42d4('0xd')]('[%s][AGENT]\x20%s',_0x17a6f6,_['map'](_0x2a96d3,_0x42d4('0xe'))['join'](',\x20'));_0xf96327['stop']();}else{var _0x459e36=_['find'](_0x49c4d9[_0x42d4('0xf')],handleFindAgent(_0x4ec13c['name']));if(_0x459e36){var _0x53e99c=(_0x4ec13c['timeout']||0xa)*0x3e8;var _0x4d9276,_0x1cfc7a;var _0x3471cb=seqqueue[_0x42d4('0x10')](_0x53e99c);_0x3471cb['id']=_0x17a6f6;_0x3471cb['atimeout']=_0x53e99c;_0x3471cb[_0x42d4('0x11')]=_0x25e5bc[_0x42d4('0x11')];writeLog(_0x17a6f6,_0x459e36,util[_0x42d4('0x8')](_0x42d4('0x12'),_0x53e99c));_0x49c4d9[_0x42d4('0x13')][_0x17a6f6]['on'](_0x42d4('0x14'),function(){logger[_0x42d4('0x7')](_0x42d4('0x15'),_0x17a6f6);clearTimeout(_0x1cfc7a);_0x1cfc7a=undefined;_0x3471cb['close']();if(_0x49c4d9[_0x42d4('0x13')][_0x17a6f6]){delete _0x49c4d9[_0x42d4('0x13')][_0x17a6f6];}_0xf96327[_0x42d4('0x16')]();});_0x49c4d9[_0x42d4('0x13')][_0x17a6f6]['on'](_0x42d4('0x17'),function(){if(_0x49c4d9[_0x42d4('0x13')][_0x17a6f6]){delete _0x49c4d9[_0x42d4('0x13')][_0x17a6f6];}});_0x1cfc7a=setTimeout(function(){logger['info'](_0x42d4('0x18'),_0x17a6f6);clearTimeout(_0x1cfc7a);_0x3471cb[_0x42d4('0x19')]();_0xf96327[_0x42d4('0x1a')]();},_0x53e99c);strategy['agent'](_0x3471cb,_0x459e36,_0x49c4d9,_0x25e5bc);}else{logger[_0x42d4('0xd')](_0x42d4('0x1b'),_0x17a6f6,_0x4ec13c[_0x42d4('0x9')]);_0xf96327['stop']();}}}catch(_0x5b8e81){console[_0x42d4('0x1c')](_0x5b8e81);logger[_0x42d4('0xd')](_0x42d4('0x1d'),_0x17a6f6,_0x5b8e81[_0x42d4('0x1e')]);_0xf96327[_0x42d4('0x16')]();}};}; \ No newline at end of file +var _0xee0c=['atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','util','../../../../config/logger','routing','./strategy','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','length','error','message','join','stop','find','agents','timeout','createQueue'];(function(_0x582ae6,_0x57aa08){var _0x303447=function(_0x158d7b){while(--_0x158d7b){_0x582ae6['push'](_0x582ae6['shift']());}};_0x303447(++_0x57aa08);}(_0xee0c,0x1dc));var _0xcee0=function(_0x2a6fd5,_0x3d6deb){_0x2a6fd5=_0x2a6fd5-0x0;var _0x43c6a4=_0xee0c[_0x2a6fd5];return _0x43c6a4;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xcee0('0x0'));var seqqueue=require('seq-queue');var logger=require(_0xcee0('0x1'))(_0xcee0('0x2'));var strategy=require(_0xcee0('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xcee0('0x4')}});function writeLog(_0x62ac0a,_0x3120f1,_0xee8260){return logger['info'](util[_0xcee0('0x5')](_0xcee0('0x6'),_0x62ac0a,_0x3120f1[_0xcee0('0x7')],_0xee8260));}function handleFindAgent(_0x15f87b){return function(_0x352224){return _0x352224['name'][_0xcee0('0x8')]()===_0x15f87b[_0xcee0('0x8')]();};}exports['consequence']=function(_0x52d569,_0x2ca136,_0x5c5fed,_0x27bc53){return function(_0x4317db){try{var _0x279f6b={'name':_0x2ca136[0x0],'timeout':_0x2ca136[0x1]};var _0xa12270=queue[_0xcee0('0x9')](_0x279f6b,{'typecast':!![]});if(_0xa12270[_0xcee0('0xa')]){logger[_0xcee0('0xb')]('[%s][AGENT]\x20%s',_0x52d569,_['map'](_0xa12270,_0xcee0('0xc'))[_0xcee0('0xd')](',\x20'));_0x4317db[_0xcee0('0xe')]();}else{var _0x35983e=_[_0xcee0('0xf')](_0x5c5fed[_0xcee0('0x10')],handleFindAgent(_0x279f6b['name']));if(_0x35983e){var _0x59e58d=(_0x279f6b[_0xcee0('0x11')]||0xa)*0x3e8;var _0x44df0b,_0x11b486;var _0xf801f9=seqqueue[_0xcee0('0x12')](_0x59e58d);_0xf801f9['id']=_0x52d569;_0xf801f9[_0xcee0('0x13')]=_0x59e58d;_0xf801f9[_0xcee0('0x14')]=_0x27bc53[_0xcee0('0x14')];writeLog(_0x52d569,_0x35983e,util['format'](_0xcee0('0x15'),_0x59e58d));_0x5c5fed[_0xcee0('0x16')][_0x52d569]['on'](_0xcee0('0x17'),function(){logger[_0xcee0('0x18')](_0xcee0('0x19'),_0x52d569);clearTimeout(_0x11b486);_0x11b486=undefined;_0xf801f9['close']();if(_0x5c5fed['rules'][_0x52d569]){delete _0x5c5fed['rules'][_0x52d569];}_0x4317db['stop']();});_0x5c5fed[_0xcee0('0x16')][_0x52d569]['on'](_0xcee0('0x1a'),function(){if(_0x5c5fed[_0xcee0('0x16')][_0x52d569]){delete _0x5c5fed[_0xcee0('0x16')][_0x52d569];}});_0x11b486=setTimeout(function(){logger['info'](_0xcee0('0x1b'),_0x52d569);clearTimeout(_0x11b486);_0xf801f9['close']();_0x4317db['next']();},_0x59e58d);strategy[_0xcee0('0x1c')](_0xf801f9,_0x35983e,_0x5c5fed,_0x27bc53);}else{logger[_0xcee0('0xb')](_0xcee0('0x1d'),_0x52d569,_0x279f6b[_0xcee0('0x7')]);_0x4317db['stop']();}}}catch(_0x40898a){console[_0xcee0('0x1e')](_0x40898a);logger[_0xcee0('0xb')](_0xcee0('0x1f'),_0x52d569,_0x40898a[_0xcee0('0x20')]);_0x4317db['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index dc017a2..bdaf860 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 _0xe589=['Message','create','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','body','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','next','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','UserId','info','[%s][AMAZONLEX]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','InteractionId','interaction','created','isEmpty','getMustacheRender'];(function(_0x24578a,_0x40786a){var _0x1722d3=function(_0x1227f3){while(--_0x1227f3){_0x24578a['push'](_0x24578a['shift']());}};_0x1722d3(++_0x40786a);}(_0xe589,0x10f));var _0x9e58=function(_0x4ec96a,_0x1f08e7){_0x4ec96a=_0x4ec96a-0x0;var _0x3395f5=_0xe589[_0x4ec96a];return _0x3395f5;};'use strict';var _=require(_0x9e58('0x0'));var moment=require(_0x9e58('0x1'));var AWS=require(_0x9e58('0x2'));var utils=require(_0x9e58('0x3'));var logger=require(_0x9e58('0x4'))(_0x9e58('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9e58('0x6')),'smsMessage':require(_0x9e58('0x7')),'faxMessage':require(_0x9e58('0x8')),'whatsappMessage':require(_0x9e58('0x9'))};exports[_0x9e58('0xa')]=function(_0x40e548,_0x607d40){return function(_0x26f3e8){try{if(!_['isNil'](this['interaction'][_0x9e58('0xb')])){logger[_0x9e58('0xc')](_0x9e58('0xd'),_0x40e548,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x26f3e8['next']();}var _0x51b426={'ContactId':this[_0x9e58('0xe')]['id'],'sentAt':moment()[_0x9e58('0xf')](_0x9e58('0x10')),'direction':'out'};if(this[_0x9e58('0x11')]==='sms'||this[_0x9e58('0x11')]===_0x9e58('0x12')){_0x51b426[_0x9e58('0x13')]=this['interaction'][_0x9e58('0x13')];}var _0x211834=this[_0x9e58('0x11')];if(_0x211834===_0x9e58('0x14')){_0x51b426[_0x9e58('0x15')]=this[_0x9e58('0x16')]['id'];}else{_0x51b426[_['upperFirst'](_0x211834)+_0x9e58('0x17')]=this[_0x9e58('0x16')]['id'];}_0x51b426[_['upperFirst'](_0x211834)+_0x9e58('0x18')]=this[_0x9e58('0x19')]['id'];if(this[_0x9e58('0x19')][_0x9e58('0x1a')]){var _0x46edc5=_0x607d40[0x4];if(!_[_0x9e58('0x1b')](_0x46edc5)){_0x51b426['body']=utils[_0x9e58('0x1c')](_0x46edc5,this);return rpc[_0x211834+_0x9e58('0x1d')][_0x9e58('0x1e')](_0x51b426)[_0x9e58('0x1f')](function(_0x25eaef){logger[_0x9e58('0xc')]('[%s][AMAZONLEX]\x20%s',_0x40e548,_0x51b426['body']);})[_0x9e58('0x20')](function(_0x1951f8){logger[_0x9e58('0x21')](_0x9e58('0xd'),_0x40e548,JSON[_0x9e58('0x22')](_0x1951f8));})['finally'](function(){logger['info'](_0x9e58('0x23'),_0x40e548);_0x26f3e8['stop']();});}else{logger[_0x9e58('0xc')](_0x9e58('0x24'),_0x40e548);_0x26f3e8[_0x9e58('0x25')]();}}else{var _0x5c0edf=this;var _0x46792c=new AWS[(_0x9e58('0x26'))]({'accessKeyId':_0x607d40[0x0],'secretAccessKey':_0x607d40[0x1],'region':_0x607d40[0x2]});var _0x3941cb={'botAlias':_0x9e58('0x27'),'botName':_0x607d40[0x3],'inputText':this[_0x9e58('0x28')][_0x9e58('0x29')],'userId':this[_0x9e58('0x11')]+':'+this[_0x9e58('0x19')]['id'][_0x9e58('0x2a')]()};_0x46792c[_0x9e58('0x2b')](_0x3941cb,function(_0x468e2f,_0x2d8888){if(_0x468e2f){logger['error']('[%s][AMAZONLEX]\x20%s',_0x40e548,_0x468e2f[_0x9e58('0x28')]);_0x26f3e8['next']();}else if(_0x2d8888&&_0x2d8888[_0x9e58('0x28')]){_0x5c0edf[_0x9e58('0x29')][_0x9e58('0x2c')]=_0x2d8888;_0x51b426[_0x9e58('0x29')]=_0x2d8888[_0x9e58('0x28')];_0x51b426[_0x9e58('0x2d')]=_0x9e58('0x2c');_0x51b426[_0x9e58('0x2e')]=JSON[_0x9e58('0x22')](_0x2d8888);return rpc[_0x211834+_0x9e58('0x1d')][_0x9e58('0x1e')](_0x51b426)[_0x9e58('0x1f')](function(_0x12cdb9){logger[_0x9e58('0xc')](_0x9e58('0xd'),_0x40e548,_0x51b426[_0x9e58('0x29')]);if(_0x2d8888[_0x9e58('0x2f')]==_0x9e58('0x30')){_0x26f3e8[_0x9e58('0x31')]();}else{_0x26f3e8[_0x9e58('0x25')]();}})[_0x9e58('0x20')](function(_0x2420d5){logger[_0x9e58('0x21')](_0x9e58('0xd'),_0x40e548,JSON['stringify'](_0x2420d5));_0x26f3e8['next']();});}else{_0x26f3e8['next']();}});}}catch(_0x2d5dc7){logger[_0x9e58('0x21')](_0x9e58('0xd'),_0x40e548,JSON[_0x9e58('0x22')](_0x2d5dc7));_0x26f3e8['stop']();}};}; \ No newline at end of file +var _0xcd99=['account','upperFirst','InteractionId','created','getMustacheRender','Message','create','then','body','catch','error','stringify','finally','stop','LexRuntime','toString','postText','message','providerName','amazonlex','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','interaction','chat'];(function(_0x8dba22,_0x452588){var _0x1c67c6=function(_0x774a7f){while(--_0x774a7f){_0x8dba22['push'](_0x8dba22['shift']());}};_0x1c67c6(++_0x452588);}(_0xcd99,0x1c7));var _0x9cd9=function(_0x37f8ba,_0x2f8f08){_0x37f8ba=_0x37f8ba-0x0;var _0x5b2648=_0xcd99[_0x37f8ba];return _0x5b2648;};'use strict';var _=require(_0x9cd9('0x0'));var moment=require(_0x9cd9('0x1'));var AWS=require(_0x9cd9('0x2'));var utils=require(_0x9cd9('0x3'));var logger=require(_0x9cd9('0x4'))(_0x9cd9('0x5'));var rpc={'chatMessage':require(_0x9cd9('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9cd9('0x7')),'smsMessage':require(_0x9cd9('0x8')),'faxMessage':require(_0x9cd9('0x9')),'whatsappMessage':require(_0x9cd9('0xa'))};exports[_0x9cd9('0xb')]=function(_0x5edae4,_0x56d34b){return function(_0x4f18e7){try{if(!_[_0x9cd9('0xc')](this['interaction'][_0x9cd9('0xd')])){logger[_0x9cd9('0xe')](_0x9cd9('0xf'),_0x5edae4,_0x9cd9('0x10'));return _0x4f18e7[_0x9cd9('0x11')]();}var _0x3b3cea={'ContactId':this[_0x9cd9('0x12')]['id'],'sentAt':moment()['format'](_0x9cd9('0x13')),'direction':_0x9cd9('0x14')};if(this[_0x9cd9('0x15')]===_0x9cd9('0x16')||this[_0x9cd9('0x15')]==='whatsapp'){_0x3b3cea['phone']=this[_0x9cd9('0x17')]['phone'];}var _0x2b7377=this['channel'];if(_0x2b7377===_0x9cd9('0x18')){_0x3b3cea['ChatWebsiteId']=this[_0x9cd9('0x19')]['id'];}else{_0x3b3cea[_[_0x9cd9('0x1a')](_0x2b7377)+'AccountId']=this[_0x9cd9('0x19')]['id'];}_0x3b3cea[_['upperFirst'](_0x2b7377)+_0x9cd9('0x1b')]=this[_0x9cd9('0x17')]['id'];if(this[_0x9cd9('0x17')][_0x9cd9('0x1c')]){var _0xc9c2eb=_0x56d34b[0x4];if(!_['isEmpty'](_0xc9c2eb)){_0x3b3cea['body']=utils[_0x9cd9('0x1d')](_0xc9c2eb,this);return rpc[_0x2b7377+_0x9cd9('0x1e')][_0x9cd9('0x1f')](_0x3b3cea)[_0x9cd9('0x20')](function(_0xef78af){logger[_0x9cd9('0xe')](_0x9cd9('0xf'),_0x5edae4,_0x3b3cea[_0x9cd9('0x21')]);})[_0x9cd9('0x22')](function(_0x5f1917){logger[_0x9cd9('0x23')](_0x9cd9('0xf'),_0x5edae4,JSON[_0x9cd9('0x24')](_0x5f1917));})[_0x9cd9('0x25')](function(){logger[_0x9cd9('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5edae4);_0x4f18e7['stop']();});}else{logger[_0x9cd9('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5edae4);_0x4f18e7[_0x9cd9('0x26')]();}}else{var _0x2f2929=this;var _0x2f7a6f=new AWS[(_0x9cd9('0x27'))]({'accessKeyId':_0x56d34b[0x0],'secretAccessKey':_0x56d34b[0x1],'region':_0x56d34b[0x2]});var _0xe98752={'botAlias':'$LATEST','botName':_0x56d34b[0x3],'inputText':this['message'][_0x9cd9('0x21')],'userId':this[_0x9cd9('0x15')]+':'+this['interaction']['id'][_0x9cd9('0x28')]()};_0x2f7a6f[_0x9cd9('0x29')](_0xe98752,function(_0x1e8e58,_0x19603e){if(_0x1e8e58){logger[_0x9cd9('0x23')](_0x9cd9('0xf'),_0x5edae4,_0x1e8e58[_0x9cd9('0x2a')]);_0x4f18e7[_0x9cd9('0x11')]();}else if(_0x19603e&&_0x19603e['message']){_0x2f2929['body']['amazonlex']=_0x19603e;_0x3b3cea[_0x9cd9('0x21')]=_0x19603e[_0x9cd9('0x2a')];_0x3b3cea[_0x9cd9('0x2b')]=_0x9cd9('0x2c');_0x3b3cea[_0x9cd9('0x2d')]=JSON[_0x9cd9('0x24')](_0x19603e);return rpc[_0x2b7377+_0x9cd9('0x1e')][_0x9cd9('0x1f')](_0x3b3cea)[_0x9cd9('0x20')](function(_0x4b5688){logger[_0x9cd9('0xe')](_0x9cd9('0xf'),_0x5edae4,_0x3b3cea[_0x9cd9('0x21')]);if(_0x19603e[_0x9cd9('0x2e')]==_0x9cd9('0x2f')){_0x4f18e7['next']();}else{_0x4f18e7[_0x9cd9('0x26')]();}})[_0x9cd9('0x22')](function(_0xb91c52){logger[_0x9cd9('0x23')](_0x9cd9('0xf'),_0x5edae4,JSON['stringify'](_0xb91c52));_0x4f18e7[_0x9cd9('0x11')]();});}else{_0x4f18e7['next']();}});}}catch(_0x3e5ef0){logger[_0x9cd9('0x23')](_0x9cd9('0xf'),_0x5edae4,JSON[_0x9cd9('0x24')](_0x3e5ef0));_0x4f18e7[_0x9cd9('0x26')]();}};}; \ 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 517a489..c46a3b2 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 _0x236e=['messageId','html','','replace','';_0x21ed49[_0xe236('0x30')]={'Auto-Submitted':_0xe236('0x31'),'X-Auto-Response-Suppress':_0xe236('0x32'),'Precedence':_0xe236('0x33')};return mailRpc[_0xe236('0x34')](this['account'][_0xe236('0x35')],_0x21ed49)[_0xe236('0x36')](function(_0x16376a){logger[_0xe236('0xc')](_0xe236('0x37'),_0x39af8e);_0x21ed49[_0xe236('0x2a')]=_0x16376a['message'][_0xe236('0x2a')];return rpc[_0x5ba3d3+_0xe236('0x28')][_0xe236('0x38')](_0x21ed49);})[_0xe236('0x36')](function(_0x2674f7){logger[_0xe236('0xc')](_0xe236('0x39'),_0x39af8e,JSON[_0xe236('0x3a')](_0x2674f7));})[_0xe236('0x3b')](function(_0x443094){logger[_0xe236('0x3c')](_0xe236('0x3d'),_0x39af8e,JSON[_0xe236('0x3a')](_0x443094));})[_0xe236('0x3e')](function(){Promise[_0xe236('0x3f')]()[_0xe236('0x36')](function(){if(_0x4f9ca2[0x0]!=='2'||_0x435840[_0xe236('0x13')])return;return rpc[_0x5ba3d3+_0xe236('0x40')][_0xe236('0x41')](_0x435840['id'],{'autoreplyExecuted':!![]})[_0xe236('0x36')](function(_0x144ffd){logger[_0xe236('0xc')](_0xe236('0x14'),_0x39af8e,JSON['stringify'](_0x144ffd));})[_0xe236('0x3b')](function(_0x15d245){logger[_0xe236('0x3c')](_0xe236('0x42'),_0x39af8e,JSON[_0xe236('0x3a')](_0x15d245));});})[_0xe236('0x36')](function(){_0x32e83a[_0xe236('0xe')]();});});}else{return rpc[this['channel']+'Message'][_0xe236('0x38')](_0x21ed49)['then'](function(){logger[_0xe236('0xc')](_0xe236('0x39'),_0x39af8e,_0x21ed49[_0xe236('0x1a')]);})['catch'](function(_0x8b42ec){logger[_0xe236('0x3c')](_0xe236('0x39'),_0x39af8e,JSON['stringify'](_0x8b42ec));})[_0xe236('0x3e')](function(){Promise[_0xe236('0x3f')]()[_0xe236('0x36')](function(){if(_0x4f9ca2[0x0]!=='2'||_0x435840['autoreplyExecuted'])return;return rpc[_0x5ba3d3+'Interaction']['update'](_0x435840['id'],{'autoreplyExecuted':!![]})[_0xe236('0x36')](function(_0x32242e){logger[_0xe236('0xc')](_0xe236('0x14'),_0x39af8e,JSON[_0xe236('0x3a')](_0x32242e));})[_0xe236('0x3b')](function(_0x31daa6){logger[_0xe236('0x3c')](_0xe236('0x42'),_0x39af8e,JSON[_0xe236('0x3a')](_0x31daa6));});})[_0xe236('0x36')](function(){_0x32e83a[_0xe236('0xe')]();});});}}}catch(_0x39d27a){logger['error'](_0xe236('0x39'),_0x39af8e,JSON['stringify'](_0x39d27a));_0x32e83a[_0xe236('0x43')]();}};}; \ No newline at end of file +var _0x6050=['../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','account','AccountId','upperFirst','InteractionId','Message','inReplyTo','messageId','','replace','','headers','All','auto_reply','sendMailMessage','smtpOptions','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','autoreplyExecuted','Interaction','resolve','update','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0x6050,0xc7));var _0x0605=function(_0x3d095d,_0x57cbb1){_0x3d095d=_0x3d095d-0x0;var _0x34dce3=_0x6050[_0x3d095d];return _0x34dce3;};'use strict';var _=require(_0x0605('0x0'));var moment=require(_0x0605('0x1'));var utils=require('./utils');var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var rpc={'chatMessage':require(_0x0605('0x4')),'openchannelMessage':require(_0x0605('0x5')),'mailMessage':require(_0x0605('0x6')),'smsMessage':require(_0x0605('0x7')),'faxMessage':require(_0x0605('0x8')),'whatsappMessage':require(_0x0605('0x9')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0605('0xa')),'mailInteraction':require(_0x0605('0xb')),'smsInteraction':require(_0x0605('0xc')),'faxInteraction':require(_0x0605('0xd')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x0605('0xe'));exports['consequence']=function(_0x26ab99,_0x39f350,_0x3c1e30,_0x53912a){return function(_0x5add59){try{var _0x2e717a=this[_0x0605('0xf')];if(_0x2e717a===_0x0605('0x10')&&_0x53912a[_0x0605('0x11')][_0x0605('0x12')]){logger[_0x0605('0x13')](_0x0605('0x14'),_0x26ab99,_0x0605('0x15'));return _0x5add59[_0x0605('0x16')]();}if(_0x39f350[0x0]==='1'&&(_[_0x0605('0x17')](this[_0x0605('0x18')][_0x0605('0x19')])||!this[_0x0605('0x18')][_0x0605('0x19')])){logger[_0x0605('0x13')]('[%s][AUTOREPLY]\x20%s',_0x26ab99,_0x0605('0x1a'));return _0x5add59[_0x0605('0x16')]();}if(_0x39f350[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger['info'](_0x0605('0x1b'),_0x26ab99,_0x0605('0x1c'));return _0x5add59[_0x0605('0x16')]();}var _0x2451d3={'ContactId':this[_0x0605('0x1d')]['id'],'sentAt':moment()[_0x0605('0x1e')](_0x0605('0x1f')),'direction':_0x0605('0x20')};if(this[_0x0605('0xf')]===_0x0605('0x10')){_0x2451d3['body']=utils[_0x0605('0x21')](_0x39f350[0x2],this);}else{_0x2451d3['body']=utils[_0x0605('0x21')](_0x39f350[0x1],this);}if(this[_0x0605('0x22')]){_0x2451d3['to']=this[_0x0605('0x22')][_0x0605('0x23')]||'';if(this[_0x0605('0xf')]===_0x0605('0x10')&&_0x39f350[0x1]==='1'){_0x2451d3['cc']=this[_0x0605('0x22')]['cc']||'';}_0x2451d3[_0x0605('0x23')]=this['message']['to']||'';_0x2451d3[_0x0605('0x24')]=this[_0x0605('0x22')][_0x0605('0x24')]||'';_0x2451d3[_0x0605('0x25')]=!![];if(this[_0x0605('0x22')]['subject']){_0x2451d3[_0x0605('0x26')]='';_0x2451d3[_0x0605('0x26')]+=_['startsWith'](this[_0x0605('0x22')]['subject'],_0x0605('0x27'))?'':_0x0605('0x28');_0x2451d3[_0x0605('0x26')]+=this[_0x0605('0x22')][_0x0605('0x26')];}}if(this[_0x0605('0xf')]==='chat'){_0x2451d3['ChatWebsiteId']=this[_0x0605('0x29')]['id'];}else{_0x2451d3[_['upperFirst'](this[_0x0605('0xf')])+_0x0605('0x2a')]=this[_0x0605('0x29')]['id'];}_0x2451d3[_[_0x0605('0x2b')](this[_0x0605('0xf')])+_0x0605('0x2c')]=this['interaction']['id'];var _0xbee64=this[_0x0605('0x18')];if(rpc[this[_0x0605('0xf')]+_0x0605('0x2d')]){if(this[_0x0605('0xf')]===_0x0605('0x10')){_0x2451d3[_0x0605('0x2e')]=this[_0x0605('0x22')][_0x0605('0x2f')];_0x2451d3['html']=_0x0605('0x30')+_[_0x0605('0x31')](_0x2451d3[_0x0605('0x11')],_0x0605('0x32'),_0x0605('0x33'))+_0x0605('0x34');_0x2451d3[_0x0605('0x35')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x0605('0x36'),'Precedence':_0x0605('0x37')};return mailRpc[_0x0605('0x38')](this['account'][_0x0605('0x39')],_0x2451d3)[_0x0605('0x3a')](function(_0x20a88b){logger[_0x0605('0x13')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x26ab99);_0x2451d3[_0x0605('0x2f')]=_0x20a88b[_0x0605('0x22')][_0x0605('0x2f')];return rpc[_0x2e717a+_0x0605('0x2d')][_0x0605('0x3b')](_0x2451d3);})[_0x0605('0x3a')](function(_0x547d5){logger[_0x0605('0x13')](_0x0605('0x14'),_0x26ab99,JSON[_0x0605('0x3c')](_0x547d5));})[_0x0605('0x3d')](function(_0x3ca06b){logger[_0x0605('0x3e')](_0x0605('0x3f'),_0x26ab99,JSON['stringify'](_0x3ca06b));})[_0x0605('0x40')](function(){Promise['resolve']()[_0x0605('0x3a')](function(){if(_0x39f350[0x0]!=='2'||_0xbee64[_0x0605('0x41')])return;return rpc[_0x2e717a+_0x0605('0x42')]['update'](_0xbee64['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1b7916){logger[_0x0605('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x26ab99,JSON[_0x0605('0x3c')](_0x1b7916));})[_0x0605('0x3d')](function(_0x5a5830){logger[_0x0605('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x26ab99,JSON[_0x0605('0x3c')](_0x5a5830));});})[_0x0605('0x3a')](function(){_0x5add59[_0x0605('0x16')]();});});}else{return rpc[this[_0x0605('0xf')]+_0x0605('0x2d')][_0x0605('0x3b')](_0x2451d3)[_0x0605('0x3a')](function(){logger[_0x0605('0x13')](_0x0605('0x14'),_0x26ab99,_0x2451d3['body']);})[_0x0605('0x3d')](function(_0x5a90d7){logger[_0x0605('0x3e')](_0x0605('0x14'),_0x26ab99,JSON['stringify'](_0x5a90d7));})[_0x0605('0x40')](function(){Promise[_0x0605('0x43')]()[_0x0605('0x3a')](function(){if(_0x39f350[0x0]!=='2'||_0xbee64[_0x0605('0x41')])return;return rpc[_0x2e717a+'Interaction'][_0x0605('0x44')](_0xbee64['id'],{'autoreplyExecuted':!![]})['then'](function(_0x32c474){logger[_0x0605('0x13')](_0x0605('0x1b'),_0x26ab99,JSON[_0x0605('0x3c')](_0x32c474));})[_0x0605('0x3d')](function(_0x12a8ad){logger[_0x0605('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x26ab99,JSON[_0x0605('0x3c')](_0x12a8ad));});})[_0x0605('0x3a')](function(){_0x5add59['next']();});});}}}catch(_0x38bd27){logger[_0x0605('0x3e')](_0x0605('0x14'),_0x26ab99,JSON[_0x0605('0x3c')](_0x38bd27));_0x5add59['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 46b36f5..a9973c2 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ffa=['stop','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','finally','[%s][CLOSE]\x20%s'];(function(_0x1372c8,_0x1ded5e){var _0x53a934=function(_0x538a44){while(--_0x538a44){_0x1372c8['push'](_0x1372c8['shift']());}};_0x53a934(++_0x1ded5e);}(_0x4ffa,0xc9));var _0xa4ff=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4ffa[_0x46698a];return _0x356db0;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0xa4ff('0x0'));var rpc={'chatInteraction':require(_0xa4ff('0x1')),'openchannelInteraction':require(_0xa4ff('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xa4ff('0x3')),'faxInteraction':require(_0xa4ff('0x4')),'whatsappInteraction':require(_0xa4ff('0x5'))};exports['consequence']=function(_0x2cd65d,_0x4ff32b,_0x2bd0b8,_0x4f08af){return function(_0x2460f0){try{logger[_0xa4ff('0x6')](_0xa4ff('0x7'),_0x2cd65d,_0x4ff32b[0x0]);var _0x481610={'closed':0x1,'closedAt':moment()['format'](_0xa4ff('0x8')),'closeReason':_0xa4ff('0x9'),'disposition':_0x4ff32b[0x0]};if(rpc[_0x4f08af['channel']+_0xa4ff('0xa')]){rpc[_0x4f08af[_0xa4ff('0xb')]+_0xa4ff('0xa')][_0xa4ff('0xc')](_0x4f08af[_0xa4ff('0xd')]['id'],_0x481610)['then'](function(_0x14fb00){logger[_0xa4ff('0x6')](_0xa4ff('0xe'),_0x2cd65d,_0x4f08af[_0xa4ff('0xd')]['id']);})[_0xa4ff('0xf')](function(_0x4ad0ec){logger[_0xa4ff('0x10')]('[%s][CLOSE]\x20%s',_0x2cd65d,JSON['stringify'](_0x4ad0ec));})[_0xa4ff('0x11')](function(){_0x2460f0['stop']();});}}catch(_0x2f682d){logger['error'](_0xa4ff('0x12'),_0x2cd65d,JSON['stringify'](_0x2f682d));_0x2460f0[_0xa4ff('0x13')]();}};}; \ No newline at end of file +var _0x9bec=['channel','Interaction','update','interaction','then','error','stringify','stop','[%s][CLOSE]\x20%s','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','YYYY-MM-DD\x20HH:mm:ss','system'];(function(_0x1b9077,_0x27de66){var _0x5cb0ef=function(_0x3c27fa){while(--_0x3c27fa){_0x1b9077['push'](_0x1b9077['shift']());}};_0x5cb0ef(++_0x27de66);}(_0x9bec,0x1ad));var _0xc9be=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x9bec[_0x1cb18a];return _0x22442e;};'use strict';var moment=require('moment');var logger=require(_0xc9be('0x0'))(_0xc9be('0x1'));var rpc={'chatInteraction':require(_0xc9be('0x2')),'openchannelInteraction':require(_0xc9be('0x3')),'smsInteraction':require(_0xc9be('0x4')),'mailInteraction':require(_0xc9be('0x5')),'faxInteraction':require(_0xc9be('0x6')),'whatsappInteraction':require(_0xc9be('0x7'))};exports[_0xc9be('0x8')]=function(_0x43118f,_0x253f45,_0x328f89,_0x449d9a){return function(_0x6e8342){try{logger[_0xc9be('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x43118f,_0x253f45[0x0]);var _0x3fc51d={'closed':0x1,'closedAt':moment()['format'](_0xc9be('0xa')),'closeReason':_0xc9be('0xb'),'disposition':_0x253f45[0x0]};if(rpc[_0x449d9a[_0xc9be('0xc')]+_0xc9be('0xd')]){rpc[_0x449d9a[_0xc9be('0xc')]+'Interaction'][_0xc9be('0xe')](_0x449d9a[_0xc9be('0xf')]['id'],_0x3fc51d)[_0xc9be('0x10')](function(_0x567f6f){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x43118f,_0x449d9a[_0xc9be('0xf')]['id']);})['catch'](function(_0x58b497){logger[_0xc9be('0x11')]('[%s][CLOSE]\x20%s',_0x43118f,JSON[_0xc9be('0x12')](_0x58b497));})['finally'](function(){_0x6e8342[_0xc9be('0x13')]();});}}catch(_0x5ad067){logger['error'](_0xc9be('0x14'),_0x43118f,JSON[_0xc9be('0x12')](_0x5ad067));_0x6e8342[_0xc9be('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 58102ff..d73191b 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1c6=['then','dialogflow','fulfillment','speech','providerResponse','result','metadata','endConversation','error','stringify','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','whatsapp','chat','ChatWebsiteId','account','AccountId','upperFirst','isEmpty','body','getMustacheRender','Message','create','info','catch','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message'];(function(_0x20dd42,_0x11bd6f){var _0x252f57=function(_0xd4fb44){while(--_0xd4fb44){_0x20dd42['push'](_0x20dd42['shift']());}};_0x252f57(++_0x11bd6f);}(_0xf1c6,0x145));var _0x6f1c=function(_0x284c99,_0x23394f){_0x284c99=_0x284c99-0x0;var _0x1c8b0f=_0xf1c6[_0x284c99];return _0x1c8b0f;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0x6f1c('0x0'));var md5=require(_0x6f1c('0x1'));var utils=require(_0x6f1c('0x2'));var logger=require(_0x6f1c('0x3'))(_0x6f1c('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6f1c('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6f1c('0x6')),'whatsappMessage':require(_0x6f1c('0x7'))};exports[_0x6f1c('0x8')]=function(_0x537c4f,_0x1c1751){return function(_0x564a8f){try{if(!_[_0x6f1c('0x9')](this[_0x6f1c('0xa')][_0x6f1c('0xb')])){logger['info'](_0x6f1c('0xc'),_0x537c4f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x564a8f[_0x6f1c('0xd')]();}var _0x13136d={'ContactId':this['contact']['id'],'sentAt':moment()[_0x6f1c('0xe')](_0x6f1c('0xf')),'direction':'out'};if(this['channel']==='sms'||this['channel']===_0x6f1c('0x10')){_0x13136d['phone']=this['interaction']['phone'];}var _0x57dc6a=this['channel'];if(_0x57dc6a===_0x6f1c('0x11')){_0x13136d[_0x6f1c('0x12')]=this[_0x6f1c('0x13')]['id'];}else{_0x13136d[_['upperFirst'](_0x57dc6a)+_0x6f1c('0x14')]=this[_0x6f1c('0x13')]['id'];}_0x13136d[_[_0x6f1c('0x15')](_0x57dc6a)+'InteractionId']=this[_0x6f1c('0xa')]['id'];if(this[_0x6f1c('0xa')]['created']){var _0x28fc5f=_0x1c1751[0x2];if(!_[_0x6f1c('0x16')](_0x28fc5f)){_0x13136d[_0x6f1c('0x17')]=utils[_0x6f1c('0x18')](_0x28fc5f,this);return rpc[_0x57dc6a+_0x6f1c('0x19')][_0x6f1c('0x1a')](_0x13136d)['then'](function(_0x2f9949){logger[_0x6f1c('0x1b')](_0x6f1c('0xc'),_0x537c4f,_0x13136d[_0x6f1c('0x17')]);})[_0x6f1c('0x1c')](function(_0x3e642f){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x537c4f,JSON['stringify'](_0x3e642f));})[_0x6f1c('0x1d')](function(){logger['info'](_0x6f1c('0x1e'),_0x537c4f);_0x564a8f['stop']();});}else{logger[_0x6f1c('0x1b')](_0x6f1c('0x1f'),_0x537c4f);_0x564a8f[_0x6f1c('0x20')]();}}else{var _0x14effb=this;var _0x2ed8f1=apiai(_0x1c1751[0x0],{'language':_0x1c1751[0x1]||'en'});return _0x2ed8f1[_0x6f1c('0x21')](this[_0x6f1c('0x22')][_0x6f1c('0x17')],{'sessionId':md5(this[_0x6f1c('0xa')]['id'])})[_0x6f1c('0x23')](function(_0x130bae){_0x14effb[_0x6f1c('0x17')][_0x6f1c('0x24')]=_0x130bae;_0x13136d[_0x6f1c('0x17')]=_0x130bae['result'][_0x6f1c('0x25')][_0x6f1c('0x26')];_0x13136d['providerName']=_0x6f1c('0x24');_0x13136d[_0x6f1c('0x27')]=JSON['stringify'](_0x130bae);return rpc[_0x57dc6a+'Message']['create'](_0x13136d)['then'](function(_0x16fe5a){logger[_0x6f1c('0x1b')](_0x6f1c('0xc'),_0x537c4f,_0x13136d[_0x6f1c('0x17')]);if(_0x130bae[_0x6f1c('0x28')][_0x6f1c('0x29')][_0x6f1c('0x2a')]){_0x564a8f[_0x6f1c('0xd')]();}else{_0x564a8f[_0x6f1c('0x20')]();}})[_0x6f1c('0x1c')](function(_0x33db9d){logger[_0x6f1c('0x2b')]('[%s][DIALOGFLOW]\x20%s',_0x537c4f,JSON['stringify'](_0x33db9d));_0x564a8f[_0x6f1c('0xd')]();});})[_0x6f1c('0x1c')](function(_0x383802){logger[_0x6f1c('0x2b')](_0x6f1c('0xc'),_0x537c4f,_0x383802['message']);_0x564a8f[_0x6f1c('0xd')]();});}}catch(_0x5061e9){logger[_0x6f1c('0x2b')]('[%s][DIALOGFLOW]\x20%s',_0x537c4f,JSON[_0x6f1c('0x2c')](_0x5061e9));_0x564a8f[_0x6f1c('0x20')]();}};}; \ No newline at end of file +var _0xef17=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','create','catch','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','body','then','dialogflow','speech','providerName','providerResponse','result','endConversation','error','lodash','moment','apiai-promise','md5','./utils'];(function(_0x469ce9,_0x4a9239){var _0x180ebe=function(_0x39aa6f){while(--_0x39aa6f){_0x469ce9['push'](_0x469ce9['shift']());}};_0x180ebe(++_0x4a9239);}(_0xef17,0x136));var _0x7ef1=function(_0x3be93b,_0x506090){_0x3be93b=_0x3be93b-0x0;var _0x399341=_0xef17[_0x3be93b];return _0x399341;};'use strict';var _=require(_0x7ef1('0x0'));var moment=require(_0x7ef1('0x1'));var apiai=require(_0x7ef1('0x2'));var md5=require(_0x7ef1('0x3'));var utils=require(_0x7ef1('0x4'));var logger=require(_0x7ef1('0x5'))(_0x7ef1('0x6'));var rpc={'chatMessage':require(_0x7ef1('0x7')),'openchannelMessage':require(_0x7ef1('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7ef1('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7ef1('0xa'))};exports['consequence']=function(_0x34a040,_0x4ba2f0){return function(_0x5aec63){try{if(!_[_0x7ef1('0xb')](this[_0x7ef1('0xc')]['UserId'])){logger[_0x7ef1('0xd')](_0x7ef1('0xe'),_0x34a040,_0x7ef1('0xf'));return _0x5aec63[_0x7ef1('0x10')]();}var _0x2cb9b0={'ContactId':this[_0x7ef1('0x11')]['id'],'sentAt':moment()[_0x7ef1('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x7ef1('0x13')]==='sms'||this['channel']==='whatsapp'){_0x2cb9b0[_0x7ef1('0x14')]=this['interaction'][_0x7ef1('0x14')];}var _0x29c920=this[_0x7ef1('0x13')];if(_0x29c920===_0x7ef1('0x15')){_0x2cb9b0[_0x7ef1('0x16')]=this[_0x7ef1('0x17')]['id'];}else{_0x2cb9b0[_[_0x7ef1('0x18')](_0x29c920)+_0x7ef1('0x19')]=this['account']['id'];}_0x2cb9b0[_['upperFirst'](_0x29c920)+_0x7ef1('0x1a')]=this['interaction']['id'];if(this[_0x7ef1('0xc')][_0x7ef1('0x1b')]){var _0x55e84e=_0x4ba2f0[0x2];if(!_['isEmpty'](_0x55e84e)){_0x2cb9b0['body']=utils[_0x7ef1('0x1c')](_0x55e84e,this);return rpc[_0x29c920+'Message'][_0x7ef1('0x1d')](_0x2cb9b0)['then'](function(_0x5a7b2b){logger['info'](_0x7ef1('0xe'),_0x34a040,_0x2cb9b0['body']);})[_0x7ef1('0x1e')](function(_0x2a8fab){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x34a040,JSON[_0x7ef1('0x1f')](_0x2a8fab));})['finally'](function(){logger[_0x7ef1('0xd')](_0x7ef1('0x20'),_0x34a040);_0x5aec63[_0x7ef1('0x21')]();});}else{logger[_0x7ef1('0xd')](_0x7ef1('0x22'),_0x34a040);_0x5aec63[_0x7ef1('0x21')]();}}else{var _0x20887b=this;var _0xd71594=apiai(_0x4ba2f0[0x0],{'language':_0x4ba2f0[0x1]||'en'});return _0xd71594['textRequest'](this[_0x7ef1('0x23')][_0x7ef1('0x24')],{'sessionId':md5(this[_0x7ef1('0xc')]['id'])})[_0x7ef1('0x25')](function(_0x31b5bf){_0x20887b[_0x7ef1('0x24')][_0x7ef1('0x26')]=_0x31b5bf;_0x2cb9b0[_0x7ef1('0x24')]=_0x31b5bf['result']['fulfillment'][_0x7ef1('0x27')];_0x2cb9b0[_0x7ef1('0x28')]=_0x7ef1('0x26');_0x2cb9b0[_0x7ef1('0x29')]=JSON[_0x7ef1('0x1f')](_0x31b5bf);return rpc[_0x29c920+'Message'][_0x7ef1('0x1d')](_0x2cb9b0)[_0x7ef1('0x25')](function(_0x445902){logger[_0x7ef1('0xd')](_0x7ef1('0xe'),_0x34a040,_0x2cb9b0[_0x7ef1('0x24')]);if(_0x31b5bf[_0x7ef1('0x2a')]['metadata'][_0x7ef1('0x2b')]){_0x5aec63['next']();}else{_0x5aec63[_0x7ef1('0x21')]();}})[_0x7ef1('0x1e')](function(_0x4b5fde){logger['error'](_0x7ef1('0xe'),_0x34a040,JSON[_0x7ef1('0x1f')](_0x4b5fde));_0x5aec63['next']();});})[_0x7ef1('0x1e')](function(_0x56fe40){logger[_0x7ef1('0x2c')]('[%s][DIALOGFLOW]\x20%s',_0x34a040,_0x56fe40[_0x7ef1('0x23')]);_0x5aec63[_0x7ef1('0x10')]();});}}catch(_0x585238){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x34a040,JSON['stringify'](_0x585238));_0x5aec63[_0x7ef1('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 5c04900..42bba97 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce9b=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','created','getMustacheRender','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','SessionsClient','sessionPath','length','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','message','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','interaction','UserId'];(function(_0x2035ef,_0x3f7d39){var _0x86c909=function(_0x382910){while(--_0x382910){_0x2035ef['push'](_0x2035ef['shift']());}};_0x86c909(++_0x3f7d39);}(_0xce9b,0xed));var _0xbce9=function(_0x487090,_0x5e5eff){_0x487090=_0x487090-0x0;var _0x4fed4e=_0xce9b[_0x487090];return _0x4fed4e;};'use strict';var _=require(_0xbce9('0x0'));var dialogflow=require(_0xbce9('0x1'));var md5=require(_0xbce9('0x2'));var moment=require('moment');var Promise=require(_0xbce9('0x3'));var logger=require(_0xbce9('0x4'))(_0xbce9('0x5'));var utils=require(_0xbce9('0x6'));var rpc={'chatMessage':require(_0xbce9('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xbce9('0x8')),'smsMessage':require(_0xbce9('0x9')),'faxMessage':require(_0xbce9('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x2ee6f8,_0x113c0b,_0x5d2dc6,_0x394a05){return new Promise(function(_0x4441d9,_0x5d0a3b){var _0x4b715a=_[_0xbce9('0xb')](_0x5d2dc6);_0x4b715a[_0xbce9('0xc')]=_0x394a05;return rpc[_0x113c0b+_0xbce9('0xd')][_0xbce9('0xe')](_0x4b715a)[_0xbce9('0xf')](function(){logger[_0xbce9('0x10')](_0xbce9('0x11'),_0x2ee6f8,_0x4b715a[_0xbce9('0xc')]);_0x4441d9();})[_0xbce9('0x12')](function(_0x5c460e){logger['error'](_0xbce9('0x11'),_0x2ee6f8,JSON[_0xbce9('0x13')](_0x5c460e));_0x5d0a3b(_0x5c460e);});});}exports[_0xbce9('0x14')]=function(_0x51ad26,_0x46063f){return function(_0x49e131){try{if(!_['isNil'](this[_0xbce9('0x15')][_0xbce9('0x16')])){logger[_0xbce9('0x10')](_0xbce9('0x11'),_0x51ad26,_0xbce9('0x17'));return _0x49e131[_0xbce9('0x18')]();}var _0x6f3834={'ContactId':this[_0xbce9('0x19')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xbce9('0x1a')]===_0xbce9('0x1b')||this[_0xbce9('0x1a')]===_0xbce9('0x1c')){_0x6f3834[_0xbce9('0x1d')]=this[_0xbce9('0x15')][_0xbce9('0x1d')];}var _0x3d96a0=this[_0xbce9('0x1a')];if(_0x3d96a0==='chat'){_0x6f3834[_0xbce9('0x1e')]=this[_0xbce9('0x1f')]['id'];}else{_0x6f3834[_[_0xbce9('0x20')](_0x3d96a0)+'AccountId']=this['account']['id'];}_0x6f3834[_[_0xbce9('0x20')](_0x3d96a0)+'InteractionId']=this['interaction']['id'];if(this[_0xbce9('0x15')][_0xbce9('0x21')]){var _0x100827=_0x46063f[0x4];if(!_['isEmpty'](_0x100827)){_0x6f3834[_0xbce9('0xc')]=utils[_0xbce9('0x22')](_0x100827,this);return rpc[_0x3d96a0+_0xbce9('0xd')][_0xbce9('0xe')](_0x6f3834)[_0xbce9('0xf')](function(_0x409cdb){logger[_0xbce9('0x10')](_0xbce9('0x11'),_0x51ad26,_0x6f3834[_0xbce9('0xc')]);})['catch'](function(_0x383f7c){logger[_0xbce9('0x23')](_0xbce9('0x11'),_0x51ad26,JSON[_0xbce9('0x13')](_0x383f7c));})[_0xbce9('0x24')](function(){logger[_0xbce9('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x51ad26);_0x49e131['stop']();});}else{logger[_0xbce9('0x10')](_0xbce9('0x25'),_0x51ad26);_0x49e131[_0xbce9('0x26')]();}}else{var _0x6ff02d=this;var _0x129780=_0x46063f[0x2]['replace'](/\\n/g,'\x0a');var _0x587923={'credentials':{'private_key':_0x129780,'client_email':_0x46063f[0x1]}};var _0x569594=new dialogflow[(_0xbce9('0x27'))](_0x587923);var _0x2d1d10=_0x569594[_0xbce9('0x28')](_0x46063f[0x0],md5(_0x6ff02d[_0xbce9('0x15')]['id']));var _0x4bb568={'session':_0x2d1d10,'queryInput':{'text':{'text':_0x6ff02d['message'][_0xbce9('0xc')],'languageCode':_0x46063f[0x3]||'en'}}};return _0x569594['detectIntent'](_0x4bb568)[_0xbce9('0xf')](function(_0x1bc3a0){if(_0x1bc3a0&&_0x1bc3a0[_0xbce9('0x29')]){_0x6ff02d[_0xbce9('0xc')]['dialogflowV2']=_0x1bc3a0;var _0x46d0d4=_0x1bc3a0[0x0];var _0x3ce9e0=_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x2b')]&&_0x46d0d4[_0xbce9('0x2a')]['diagnosticInfo'][_0xbce9('0x2c')]?_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x2b')]['fields']['end_conversation'][_0xbce9('0x2d')]:![];_0x6ff02d[_0xbce9('0xc')][_0xbce9('0x2e')]=_0x46d0d4[_0xbce9('0x2a')]['action'];_0x6ff02d[_0xbce9('0xc')][_0xbce9('0x2f')]=_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x30')];_0x6ff02d[_0xbce9('0xc')][_0xbce9('0x31')]=_0x46d0d4[_0xbce9('0x2a')]['diagnosticInfo']&&_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x2b')][_0xbce9('0x2c')]?_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x2b')][_0xbce9('0x2c')]['end_conversation']['boolValue']:![];_0x6ff02d[_0xbce9('0xc')][_0xbce9('0x32')]=_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x33')]['name'];_0x6ff02d['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x46d0d4['queryResult'][_0xbce9('0x33')][_0xbce9('0x34')];_0x6ff02d[_0xbce9('0xc')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x46d0d4['queryResult'][_0xbce9('0x33')][_0xbce9('0x35')];_0x6ff02d[_0xbce9('0xc')][_0xbce9('0x36')]=_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x37')];_0x6ff02d[_0xbce9('0xc')][_0xbce9('0x38')]=_0x46d0d4['queryResult'][_0xbce9('0x39')];_0x6ff02d[_0xbce9('0xc')]['DIALOGFLOWV2_SCORE']=_0x46d0d4['queryResult'][_0xbce9('0x3a')];_0x6f3834[_0xbce9('0x3b')]='dialogflowV2';_0x6f3834[_0xbce9('0x3c')]=JSON['stringify'](_0x1bc3a0);var _0x5cd1e4=[];for(var _0x2f9953=0x0;_0x2f9953<_0x1bc3a0[_0xbce9('0x29')];_0x2f9953++){var _0x270743=_0x1bc3a0[_0x2f9953];if(_0x270743&&_0x270743[_0xbce9('0x2a')]&&_0x270743[_0xbce9('0x2a')][_0xbce9('0x3d')]){_0x5cd1e4[_0xbce9('0x3e')](createMessage(_0x51ad26,_0x3d96a0,_0x6f3834,_0x270743[_0xbce9('0x2a')]['fulfillmentText']));}}return Promise[_0xbce9('0x3f')](_0x5cd1e4)['then'](function(){if(_0x3ce9e0){_0x49e131[_0xbce9('0x18')]();}else{_0x49e131['stop']();}})['catch'](function(_0x5e7f45){logger['error'](_0xbce9('0x11'),_0x51ad26,JSON['stringify'](_0x5e7f45));_0x49e131['next']();});}})[_0xbce9('0x12')](function(_0x1b4786){logger[_0xbce9('0x23')](_0xbce9('0x11'),_0x51ad26,_0x1b4786[_0xbce9('0x40')]);_0x49e131[_0xbce9('0x18')]();});}}catch(_0x1ba1db){logger['error'](_0xbce9('0x11'),_0x51ad26,JSON[_0xbce9('0x13')](_0x1ba1db));_0x49e131[_0xbce9('0x26')]();}};}; \ No newline at end of file +var _0xb0b4=['isEmpty','getMustacheRender','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','length','fulfillmentText','push','all','next','lodash','moment','bluebird','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','out','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created'];(function(_0x52d4d2,_0x1af8c5){var _0x3336ae=function(_0x34b9c2){while(--_0x34b9c2){_0x52d4d2['push'](_0x52d4d2['shift']());}};_0x3336ae(++_0x1af8c5);}(_0xb0b4,0xb6));var _0x4b0b=function(_0xa7980a,_0x7fc90a){_0xa7980a=_0xa7980a-0x0;var _0x844172=_0xb0b4[_0xa7980a];return _0x844172;};'use strict';var _=require(_0x4b0b('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0x4b0b('0x1'));var Promise=require(_0x4b0b('0x2'));var logger=require('../../../../config/logger')(_0x4b0b('0x3'));var utils=require('./utils');var rpc={'chatMessage':require(_0x4b0b('0x4')),'openchannelMessage':require(_0x4b0b('0x5')),'mailMessage':require(_0x4b0b('0x6')),'smsMessage':require(_0x4b0b('0x7')),'faxMessage':require(_0x4b0b('0x8')),'whatsappMessage':require(_0x4b0b('0x9'))};function createMessage(_0x3d0a0a,_0x19c374,_0x42917b,_0xeaa6a2){return new Promise(function(_0x1fbc36,_0x175bf7){var _0x3edda6=_[_0x4b0b('0xa')](_0x42917b);_0x3edda6[_0x4b0b('0xb')]=_0xeaa6a2;return rpc[_0x19c374+_0x4b0b('0xc')][_0x4b0b('0xd')](_0x3edda6)['then'](function(){logger[_0x4b0b('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x3d0a0a,_0x3edda6[_0x4b0b('0xb')]);_0x1fbc36();})[_0x4b0b('0xf')](function(_0x4ed635){logger[_0x4b0b('0x10')](_0x4b0b('0x11'),_0x3d0a0a,JSON[_0x4b0b('0x12')](_0x4ed635));_0x175bf7(_0x4ed635);});});}exports[_0x4b0b('0x13')]=function(_0x35bd90,_0x269ac6){return function(_0x532d1f){try{if(!_[_0x4b0b('0x14')](this[_0x4b0b('0x15')][_0x4b0b('0x16')])){logger[_0x4b0b('0xe')](_0x4b0b('0x11'),_0x35bd90,_0x4b0b('0x17'));return _0x532d1f['next']();}var _0x30e5c9={'ContactId':this[_0x4b0b('0x18')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4b0b('0x19')};if(this[_0x4b0b('0x1a')]==='sms'||this[_0x4b0b('0x1a')]==='whatsapp'){_0x30e5c9['phone']=this[_0x4b0b('0x15')]['phone'];}var _0x3e74b4=this[_0x4b0b('0x1a')];if(_0x3e74b4===_0x4b0b('0x1b')){_0x30e5c9[_0x4b0b('0x1c')]=this['account']['id'];}else{_0x30e5c9[_[_0x4b0b('0x1d')](_0x3e74b4)+_0x4b0b('0x1e')]=this[_0x4b0b('0x1f')]['id'];}_0x30e5c9[_[_0x4b0b('0x1d')](_0x3e74b4)+_0x4b0b('0x20')]=this[_0x4b0b('0x15')]['id'];if(this[_0x4b0b('0x15')][_0x4b0b('0x21')]){var _0xdd1482=_0x269ac6[0x4];if(!_[_0x4b0b('0x22')](_0xdd1482)){_0x30e5c9[_0x4b0b('0xb')]=utils[_0x4b0b('0x23')](_0xdd1482,this);return rpc[_0x3e74b4+_0x4b0b('0xc')][_0x4b0b('0xd')](_0x30e5c9)[_0x4b0b('0x24')](function(_0x8fb089){logger['info'](_0x4b0b('0x11'),_0x35bd90,_0x30e5c9[_0x4b0b('0xb')]);})['catch'](function(_0x12dd7e){logger[_0x4b0b('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x35bd90,JSON[_0x4b0b('0x12')](_0x12dd7e));})[_0x4b0b('0x25')](function(){logger['info'](_0x4b0b('0x26'),_0x35bd90);_0x532d1f[_0x4b0b('0x27')]();});}else{logger['info'](_0x4b0b('0x28'),_0x35bd90);_0x532d1f[_0x4b0b('0x27')]();}}else{var _0x31218e=this;var _0x9ca813=_0x269ac6[0x2][_0x4b0b('0x29')](/\\n/g,'\x0a');var _0x3f3e37={'credentials':{'private_key':_0x9ca813,'client_email':_0x269ac6[0x1]}};var _0x2110e5=new dialogflow[(_0x4b0b('0x2a'))](_0x3f3e37);var _0x4af6dc=_0x2110e5[_0x4b0b('0x2b')](_0x269ac6[0x0],md5(_0x31218e[_0x4b0b('0x15')]['id']));var _0x46714a={'session':_0x4af6dc,'queryInput':{'text':{'text':_0x31218e[_0x4b0b('0x2c')][_0x4b0b('0xb')],'languageCode':_0x269ac6[0x3]||'en'}}};return _0x2110e5[_0x4b0b('0x2d')](_0x46714a)[_0x4b0b('0x24')](function(_0x48e2d3){if(_0x48e2d3&&_0x48e2d3['length']){_0x31218e['body'][_0x4b0b('0x2e')]=_0x48e2d3;var _0x1145d1=_0x48e2d3[0x0];var _0x4a0738=_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x30')]&&_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x30')]['fields']?_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x30')][_0x4b0b('0x31')][_0x4b0b('0x32')][_0x4b0b('0x33')]:![];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x34')]=_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x35')];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x36')]=_0x1145d1[_0x4b0b('0x2f')]['allRequiredParamsPresent'];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x37')]=_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x30')]&&_0x1145d1['queryResult'][_0x4b0b('0x30')][_0x4b0b('0x31')]?_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x30')]['fields'][_0x4b0b('0x32')]['boolValue']:![];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x38')]=_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x39')]['name'];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x3a')]=_0x1145d1['queryResult'][_0x4b0b('0x39')][_0x4b0b('0x3b')];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x3c')]=_0x1145d1[_0x4b0b('0x2f')]['intent'][_0x4b0b('0x3d')];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x3e')]=_0x1145d1['queryResult'][_0x4b0b('0x3f')];_0x31218e[_0x4b0b('0xb')]['DIALOGFLOWV2_QUERYTEXT']=_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x40')];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x41')]=_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x42')];_0x30e5c9['providerName']=_0x4b0b('0x2e');_0x30e5c9['providerResponse']=JSON['stringify'](_0x48e2d3);var _0x558e55=[];for(var _0x1e5151=0x0;_0x1e5151<_0x48e2d3[_0x4b0b('0x43')];_0x1e5151++){var _0xb9a11f=_0x48e2d3[_0x1e5151];if(_0xb9a11f&&_0xb9a11f[_0x4b0b('0x2f')]&&_0xb9a11f[_0x4b0b('0x2f')][_0x4b0b('0x44')]){_0x558e55[_0x4b0b('0x45')](createMessage(_0x35bd90,_0x3e74b4,_0x30e5c9,_0xb9a11f[_0x4b0b('0x2f')][_0x4b0b('0x44')]));}}return Promise[_0x4b0b('0x46')](_0x558e55)[_0x4b0b('0x24')](function(){if(_0x4a0738){_0x532d1f[_0x4b0b('0x47')]();}else{_0x532d1f[_0x4b0b('0x27')]();}})[_0x4b0b('0xf')](function(_0xa859a7){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x35bd90,JSON[_0x4b0b('0x12')](_0xa859a7));_0x532d1f[_0x4b0b('0x47')]();});}})[_0x4b0b('0xf')](function(_0x32fe3f){logger['error'](_0x4b0b('0x11'),_0x35bd90,_0x32fe3f[_0x4b0b('0x2c')]);_0x532d1f[_0x4b0b('0x47')]();});}}catch(_0x4c25ca){logger[_0x4b0b('0x10')](_0x4b0b('0x11'),_0x35bd90,JSON[_0x4b0b('0x12')](_0x4c25ca));_0x532d1f[_0x4b0b('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 76f6e99..1ab7904 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6fb=['stop','priorityTrue','priorityFalse','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','lodash','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','replace','validate','error','[%s][GOTOIF]\x20%s','map','join'];(function(_0x3c31d1,_0x4d885e){var _0xe62b4=function(_0x206381){while(--_0x206381){_0x3c31d1['push'](_0x3c31d1['shift']());}};_0xe62b4(++_0x4d885e);}(_0xc6fb,0x136));var _0xbc6f=function(_0x2fa1c6,_0x4a5b8d){_0x2fa1c6=_0x2fa1c6-0x0;var _0x5f3257=_0xc6fb[_0x2fa1c6];return _0x5f3257;};'use strict';var schema=require('validate');var _=require(_0xbc6f('0x0'));var htmlToText=require('html-to-text');var utils=require(_0xbc6f('0x1'));var logger=require(_0xbc6f('0x2'))(_0xbc6f('0x3'));var gotoif=schema({'condition':{'type':_0xbc6f('0x4'),'required':!![],'message':_0xbc6f('0x5')},'priorityTrue':{'type':_0xbc6f('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xbc6f('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xbc6f('0x7')]=function(_0x285ea9,_0x349eb7){return function(_0x5b5aa8){try{var _0x1e8b8a={'condition':htmlToText[_0xbc6f('0x8')](utils['getMustacheRender'](_0x349eb7[0x0],this),{'wordwrap':![]})[_0xbc6f('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x349eb7[0x1],'priorityFalse':_0x349eb7[0x2]};var _0x4e91ba=gotoif[_0xbc6f('0xa')](_0x1e8b8a,{'typecast':!![]});if(_0x4e91ba['length']){logger[_0xbc6f('0xb')](_0xbc6f('0xc'),_0x285ea9,_[_0xbc6f('0xd')](_0x4e91ba,'message')[_0xbc6f('0xe')](',\x20'));_0x5b5aa8[_0xbc6f('0xf')]();}else{try{var _0x50bea2=eval('('+_0x1e8b8a['condition']+')');var _0x4843c0=_0x50bea2?_0x1e8b8a[_0xbc6f('0x10')]:_0x1e8b8a[_0xbc6f('0x11')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x285ea9,_0x1e8b8a['condition'],_0x50bea2,_0x4843c0||_0xbc6f('0x12'));if(_0x4843c0){var _0x5aa1d8=_[_0xbc6f('0x13')](_0x5b5aa8['rules'](),{'p':_0x4843c0});if(_0x5aa1d8>=0x0){logger[_0xbc6f('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x285ea9,_0x4843c0||_0xbc6f('0x12'),_0x5aa1d8);_0x5b5aa8[_0xbc6f('0x12')](_0x5aa1d8);}else{logger[_0xbc6f('0x14')](_0xbc6f('0x15'),_0x285ea9,_0x4843c0||_0xbc6f('0x12'));_0x5b5aa8['stop']();}}else{_0x5b5aa8['next']();}}catch(_0x1e643b){logger['error'](_0xbc6f('0x16'),_0x285ea9,_0x1e643b[_0xbc6f('0x17')]);_0x5b5aa8[_0xbc6f('0xf')]();}}}catch(_0x24f479){logger[_0xbc6f('0xb')](_0xbc6f('0xc'),_0x285ea9,JSON[_0xbc6f('0x18')](_0x24f479));_0x5b5aa8[_0xbc6f('0xf')]();}};}; \ No newline at end of file +var _0x1cd8=['validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify'];(function(_0x3e360a,_0x5c87a9){var _0x2f73d1=function(_0x129e6b){while(--_0x129e6b){_0x3e360a['push'](_0x3e360a['shift']());}};_0x2f73d1(++_0x5c87a9);}(_0x1cd8,0xf8));var _0x81cd=function(_0x3d0d25,_0x108611){_0x3d0d25=_0x3d0d25-0x0;var _0x3973d1=_0x1cd8[_0x3d0d25];return _0x3973d1;};'use strict';var schema=require(_0x81cd('0x0'));var _=require(_0x81cd('0x1'));var htmlToText=require(_0x81cd('0x2'));var utils=require(_0x81cd('0x3'));var logger=require(_0x81cd('0x4'))(_0x81cd('0x5'));var gotoif=schema({'condition':{'type':_0x81cd('0x6'),'required':!![],'message':_0x81cd('0x7')},'priorityTrue':{'type':_0x81cd('0x8'),'message':_0x81cd('0x9')},'priorityFalse':{'type':_0x81cd('0x8'),'message':_0x81cd('0xa')}});exports[_0x81cd('0xb')]=function(_0x17076a,_0x2c136d){return function(_0x179f71){try{var _0x12746a={'condition':htmlToText[_0x81cd('0xc')](utils[_0x81cd('0xd')](_0x2c136d[0x0],this),{'wordwrap':![]})[_0x81cd('0xe')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2c136d[0x1],'priorityFalse':_0x2c136d[0x2]};var _0x4585d5=gotoif[_0x81cd('0x0')](_0x12746a,{'typecast':!![]});if(_0x4585d5['length']){logger['error'](_0x81cd('0xf'),_0x17076a,_[_0x81cd('0x10')](_0x4585d5,_0x81cd('0x11'))[_0x81cd('0x12')](',\x20'));_0x179f71['stop']();}else{try{var _0x2cea4f=eval('('+_0x12746a[_0x81cd('0x13')]+')');var _0x1f95eb=_0x2cea4f?_0x12746a[_0x81cd('0x14')]:_0x12746a[_0x81cd('0x15')];logger[_0x81cd('0x16')](_0x81cd('0x17'),_0x17076a,_0x12746a[_0x81cd('0x13')],_0x2cea4f,_0x1f95eb||_0x81cd('0x18'));if(_0x1f95eb){var _0x3539bd=_['findIndex'](_0x179f71['rules'](),{'p':_0x1f95eb});if(_0x3539bd>=0x0){logger[_0x81cd('0x16')](_0x81cd('0x19'),_0x17076a,_0x1f95eb||'next',_0x3539bd);_0x179f71[_0x81cd('0x18')](_0x3539bd);}else{logger[_0x81cd('0x16')](_0x81cd('0x1a'),_0x17076a,_0x1f95eb||'next');_0x179f71[_0x81cd('0x1b')]();}}else{_0x179f71[_0x81cd('0x18')]();}}catch(_0x1ffb26){logger[_0x81cd('0x1c')](_0x81cd('0x1d'),_0x17076a,_0x1ffb26[_0x81cd('0x11')]);_0x179f71[_0x81cd('0x1b')]();}}}catch(_0x41056e){logger[_0x81cd('0x1c')](_0x81cd('0xf'),_0x17076a,JSON[_0x81cd('0x1e')](_0x41056e));_0x179f71['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 6d8d9ed..32857f0 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 _0x516c=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','join','stop','priority','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing'];(function(_0x58f401,_0x1136c9){var _0x146e3d=function(_0x249501){while(--_0x249501){_0x58f401['push'](_0x58f401['shift']());}};_0x146e3d(++_0x1136c9);}(_0x516c,0x1d9));var _0xc516=function(_0x1899f0,_0x12d7e4){_0x1899f0=_0x1899f0-0x0;var _0x14e375=_0x516c[_0x1899f0];return _0x14e375;};'use strict';var schema=require(_0xc516('0x0'));var _=require('lodash');var logger=require(_0xc516('0x1'))(_0xc516('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xc516('0x3')}});exports[_0xc516('0x4')]=function(_0x3e03cf,_0x429a32){return function(_0x11e9ab){try{var _0x51036f={'priority':_0x429a32[0x0]};var _0x152b47=gotop[_0xc516('0x0')](_0x51036f,{'typecast':!![]});if(_0x152b47[_0xc516('0x5')]){logger[_0xc516('0x6')](_0xc516('0x7'),_0x3e03cf,_['map'](_0x152b47,'message')[_0xc516('0x8')](',\x20'));_0x11e9ab[_0xc516('0x9')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x3e03cf,_0x51036f['priority']);if(_0x51036f[_0xc516('0xa')]){var _0x357050=_['findIndex'](_0x11e9ab[_0xc516('0xb')](),{'p':_0x51036f[_0xc516('0xa')]});if(_0x357050>=0x0){logger[_0xc516('0xc')](_0xc516('0xd'),_0x3e03cf,_0x51036f['priority']||_0xc516('0xe'),_0x357050);_0x11e9ab[_0xc516('0xe')](_0x357050);}else{logger['info'](_0xc516('0xf'),_0x3e03cf,_0x51036f[_0xc516('0xa')]||'next');_0x11e9ab[_0xc516('0x9')]();}}else{_0x11e9ab['next']();}}}catch(_0xa845b4){logger[_0xc516('0x6')](_0xc516('0x7'),_0x3e03cf,JSON[_0xc516('0x10')](_0xa845b4));_0x11e9ab[_0xc516('0x9')]();}};}; \ No newline at end of file +var _0x8b13=['map','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8b13,0x1ac));var _0x38b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b13[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x38b1('0x0'));var _=require(_0x38b1('0x1'));var logger=require(_0x38b1('0x2'))(_0x38b1('0x3'));var gotop=schema({'priority':{'type':_0x38b1('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x38b1('0x5')]=function(_0x1f321b,_0x17dd68){return function(_0x2a7859){try{var _0x2f94fd={'priority':_0x17dd68[0x0]};var _0x13f520=gotop[_0x38b1('0x0')](_0x2f94fd,{'typecast':!![]});if(_0x13f520[_0x38b1('0x6')]){logger[_0x38b1('0x7')](_0x38b1('0x8'),_0x1f321b,_[_0x38b1('0x9')](_0x13f520,_0x38b1('0xa'))[_0x38b1('0xb')](',\x20'));_0x2a7859[_0x38b1('0xc')]();}else{logger[_0x38b1('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x1f321b,_0x2f94fd['priority']);if(_0x2f94fd[_0x38b1('0xe')]){var _0xbf6908=_[_0x38b1('0xf')](_0x2a7859[_0x38b1('0x10')](),{'p':_0x2f94fd[_0x38b1('0xe')]});if(_0xbf6908>=0x0){logger[_0x38b1('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1f321b,_0x2f94fd[_0x38b1('0xe')]||'next',_0xbf6908);_0x2a7859['next'](_0xbf6908);}else{logger['info'](_0x38b1('0x11'),_0x1f321b,_0x2f94fd[_0x38b1('0xe')]||'next');_0x2a7859[_0x38b1('0xc')]();}}else{_0x2a7859[_0x38b1('0x12')]();}}}catch(_0x1a7ff0){logger[_0x38b1('0x7')](_0x38b1('0x8'),_0x1f321b,JSON['stringify'](_0x1a7ff0));_0x2a7859[_0x38b1('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 53d5df5..80f49a0 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 _0xd23d=['getMustacheRender','chat','ChatWebsiteId','account','upperFirst','channel','interaction','Message','create','then','info','next','catch','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xd23d,0xa0));var _0xdd23=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xd23d[_0x3e6d5d];return _0x238923;};'use strict';var _=require(_0xdd23('0x0'));var utils=require(_0xdd23('0x1'));var logger=require(_0xdd23('0x2'))(_0xdd23('0x3'));var rpc={'chatMessage':require(_0xdd23('0x4')),'openchannelMessage':require(_0xdd23('0x5')),'mailMessage':require(_0xdd23('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xdd23('0x7')]=function(_0x23d246,_0x7232e8){return function(_0xa5bdac){try{var _0x5933e2={'body':utils[_0xdd23('0x8')](_0x7232e8[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xdd23('0x9')){_0x5933e2[_0xdd23('0xa')]=this[_0xdd23('0xb')]['id'];}else{_0x5933e2[_[_0xdd23('0xc')](this[_0xdd23('0xd')])+'AccountId']=this[_0xdd23('0xb')]['id'];}_0x5933e2[_[_0xdd23('0xc')](this[_0xdd23('0xd')])+'InteractionId']=this[_0xdd23('0xe')]['id'];if(rpc[this[_0xdd23('0xd')]+_0xdd23('0xf')]){return rpc[this[_0xdd23('0xd')]+_0xdd23('0xf')][_0xdd23('0x10')](_0x5933e2)[_0xdd23('0x11')](function(_0x1e4739){logger[_0xdd23('0x12')]('[%s][MESSAGE]\x20%s',_0x23d246,_0x5933e2['body']);_0xa5bdac[_0xdd23('0x13')]();})[_0xdd23('0x14')](function(_0x2f2869){logger['error'](_0xdd23('0x15'),_0x23d246,JSON[_0xdd23('0x16')](_0x2f2869));_0xa5bdac[_0xdd23('0x17')]();});}}catch(_0x3743cf){logger['error'](_0xdd23('0x15'),_0x23d246,JSON[_0xdd23('0x16')](_0x3743cf));_0xa5bdac[_0xdd23('0x17')]();}};}; \ No newline at end of file +var _0x3ce2=['stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','next','error'];(function(_0x4b3266,_0x1c0054){var _0x4fed16=function(_0x2edd75){while(--_0x2edd75){_0x4b3266['push'](_0x4b3266['shift']());}};_0x4fed16(++_0x1c0054);}(_0x3ce2,0x192));var _0x23ce=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x3ce2[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x23ce('0x0'));var utils=require(_0x23ce('0x1'));var logger=require('../../../../config/logger')(_0x23ce('0x2'));var rpc={'chatMessage':require(_0x23ce('0x3')),'openchannelMessage':require(_0x23ce('0x4')),'mailMessage':require(_0x23ce('0x5')),'smsMessage':require(_0x23ce('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x23ce('0x7'))};exports[_0x23ce('0x8')]=function(_0x500895,_0xb3d43b){return function(_0x2571ab){try{var _0x3cc37c={'body':utils[_0x23ce('0x9')](_0xb3d43b[0x0],this),'ContactId':this[_0x23ce('0xa')]['id']};if(this[_0x23ce('0xb')]==='chat'){_0x3cc37c[_0x23ce('0xc')]=this[_0x23ce('0xd')]['id'];}else{_0x3cc37c[_['upperFirst'](this['channel'])+'AccountId']=this['account']['id'];}_0x3cc37c[_[_0x23ce('0xe')](this[_0x23ce('0xb')])+_0x23ce('0xf')]=this[_0x23ce('0x10')]['id'];if(rpc[this[_0x23ce('0xb')]+_0x23ce('0x11')]){return rpc[this[_0x23ce('0xb')]+'Message'][_0x23ce('0x12')](_0x3cc37c)[_0x23ce('0x13')](function(_0x90bfbf){logger['info'](_0x23ce('0x14'),_0x500895,_0x3cc37c['body']);_0x2571ab[_0x23ce('0x15')]();})['catch'](function(_0x5758f5){logger[_0x23ce('0x16')](_0x23ce('0x14'),_0x500895,JSON[_0x23ce('0x17')](_0x5758f5));_0x2571ab[_0x23ce('0x18')]();});}}catch(_0x19d6d3){logger[_0x23ce('0x16')](_0x23ce('0x14'),_0x500895,JSON[_0x23ce('0x17')](_0x19d6d3));_0x2571ab[_0x23ce('0x18')]();}};}; \ 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 372421e..e1de213 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 _0x3344=['../../../../config/logger','routing','consequence','info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stop','./utils'];(function(_0x6d3ee6,_0x2e272b){var _0x12d0b2=function(_0x2ee988){while(--_0x2ee988){_0x6d3ee6['push'](_0x6d3ee6['shift']());}};_0x12d0b2(++_0x2e272b);}(_0x3344,0xdb));var _0x4334=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3344[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0x4334('0x0'));var logger=require(_0x4334('0x1'))(_0x4334('0x2'));exports[_0x4334('0x3')]=function(_0xd350b6,_0xe919e8){return function(_0x216c5a){try{logger[_0x4334('0x4')]('[%s][NOOP]\x20%s',_0xd350b6,utils[_0x4334('0x5')](_0xe919e8[0x0],this));_0x216c5a[_0x4334('0x6')]();}catch(_0x490744){logger[_0x4334('0x7')](_0x4334('0x8'),_0xd350b6,JSON['stringify'](_0x490744));_0x216c5a[_0x4334('0x9')]();}};}; \ No newline at end of file +var _0x1ec6=['getMustacheRender','next','error','stop','./utils','../../../../config/logger','routing','info','[%s][NOOP]\x20%s'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1ec6,0x82));var _0x61ec=function(_0x257a01,_0x143777){_0x257a01=_0x257a01-0x0;var _0xc2cd98=_0x1ec6[_0x257a01];return _0xc2cd98;};'use strict';var utils=require(_0x61ec('0x0'));var logger=require(_0x61ec('0x1'))(_0x61ec('0x2'));exports['consequence']=function(_0x1fd59e,_0x3bc03e){return function(_0x17282d){try{logger[_0x61ec('0x3')](_0x61ec('0x4'),_0x1fd59e,utils[_0x61ec('0x5')](_0x3bc03e[0x0],this));_0x17282d[_0x61ec('0x6')]();}catch(_0x2898cc){logger[_0x61ec('0x7')](_0x61ec('0x4'),_0x1fd59e,JSON['stringify'](_0x2898cc));_0x17282d[_0x61ec('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index e7599ca..d6782ad 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 _0x0d35=['../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save'];(function(_0x1602af,_0x540e07){var _0x3c088e=function(_0x1be346){while(--_0x1be346){_0x1602af['push'](_0x1602af['shift']());}};_0x3c088e(++_0x540e07);}(_0x0d35,0x8a));var _0x50d3=function(_0x278783,_0x4fa832){_0x278783=_0x278783-0x0;var _0x89fb5b=_0x0d35[_0x278783];return _0x89fb5b;};'use strict';var schema=require(_0x50d3('0x0'));var _=require(_0x50d3('0x1'));var util=require(_0x50d3('0x2'));var seqqueue=require(_0x50d3('0x3'));var moment=require(_0x50d3('0x4'));var Redis=require(_0x50d3('0x5'));var config=require(_0x50d3('0x6'));var logger=require(_0x50d3('0x7'))(_0x50d3('0x8'));var strategy=require(_0x50d3('0x9'));config[_0x50d3('0xa')]=_['defaults'](config[_0x50d3('0xa')],{'host':_0x50d3('0xb'),'port':0x18eb});var io=require(_0x50d3('0xc'))(new Redis(config['redis']));var attributes=['id',_0x50d3('0xd'),_0x50d3('0xe'),_0x50d3('0xf'),_0x50d3('0x10'),_0x50d3('0x11')];function emit(_0xb5bd20,_0x4bc365,_0x5cd40e){io['to'](_0xb5bd20)[_0x50d3('0x12')](_0x4bc365,_0x5cd40e);}function emitChannelQueueInteraction(_0x4c7b13,_0x5e137f,_0xf51a73,_0x29f744,_0x1266db,_0x1c8677,_0x171557,_0x33b8ab){var _0x44d6db=_[_0x50d3('0x13')](_0xf51a73);_0x44d6db[_0x50d3('0xd')]=_0x33b8ab;_0x44d6db[_0x50d3('0xf')]=_0x5e137f;_0x44d6db[_0x50d3('0xe')]=_0x29f744;_0x44d6db['id']=_0x1266db;if(_0x1c8677){_0x171557[util['format'](_0x50d3('0x14'),_0x4c7b13)][_0x1266db]=_[_0x50d3('0x15')](_0x44d6db,attributes);}else{delete _0x171557[util['format']('%sQueuesWaitingInteractions',_0x4c7b13)][_0x1266db];}emit(util[_0x50d3('0x16')](_0x50d3('0x17'),_0x4c7b13,_0x5e137f),util['format'](_0x50d3('0x18'),_0x4c7b13,_0x1c8677?_0x50d3('0x19'):'remove'),_['pick'](_0x44d6db,attributes));}var rpc={'openchannelQueueReport':require(_0x50d3('0x1a')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x50d3('0x1b')),'smsQueueReport':require(_0x50d3('0x1c')),'faxQueueReport':require(_0x50d3('0x1d')),'whatsappQueueReport':require(_0x50d3('0x1e'))};var queue=schema({'name':{'type':_0x50d3('0x1f'),'required':!![],'message':_0x50d3('0x20')},'timeout':{'type':_0x50d3('0x21'),'message':_0x50d3('0x22')}});function startRouting(_0x529411,_0x2c2e64,_0xd8c50d,_0x108775){if(_0x529411&&_0x2c2e64&&_0xd8c50d){_0x2c2e64['waiting']+=0x1;var _0x54b129={'uniqueid':_0x529411,'from':_0xd8c50d['body']?_0xd8c50d['body'][_0x50d3('0x10')]:'','joinAt':moment()[_0x50d3('0x16')](_0x50d3('0x23')),'ContactId':_0xd8c50d[_0x50d3('0x24')]?_0xd8c50d[_0x50d3('0x24')]['id']:null,'ListId':_0xd8c50d['list']?_0xd8c50d[_0x50d3('0x25')]['id']:null};_0x54b129[_['upperFirst'](_0xd8c50d[_0x50d3('0x26')])+_0x50d3('0x27')]=_0x2c2e64['id']||null;_0x54b129[_[_0x50d3('0x28')](_0xd8c50d[_0x50d3('0x26')])+'InteractionId']=_0xd8c50d['interaction']?_0xd8c50d['interaction']['id']:null;_0x54b129[_[_0x50d3('0x28')](_0xd8c50d['channel'])+_0x50d3('0x29')]=_0xd8c50d[_0x50d3('0x2a')]?_0xd8c50d[_0x50d3('0x2a')]['id']:null;_0x54b129[_[_0x50d3('0x28')](_0xd8c50d[_0x50d3('0x26')])+(_0xd8c50d[_0x50d3('0x26')]!==_0x50d3('0x2b')?_0x50d3('0x2c'):_0x50d3('0x2d'))]=_0xd8c50d[_0x50d3('0xe')]?_0xd8c50d['account']['id']:null;logger[_0x50d3('0x2e')](util['format'](_0x50d3('0x2f'),_0x529411,_0x2c2e64[_0x50d3('0x30')]));emitChannelQueueInteraction(_0xd8c50d['channel'],_0x2c2e64[_0x50d3('0x30')],_0x54b129,_0xd8c50d[_0x50d3('0xe')][_0x50d3('0x30')],_0xd8c50d['message']['id'],!![],_0x108775,_0x2c2e64['id']);if(rpc[_0xd8c50d[_0x50d3('0x26')]+_0x50d3('0x31')]){return rpc[_0xd8c50d[_0x50d3('0x26')]+'QueueReport'][_0x50d3('0x32')](_0x54b129)[_0x50d3('0x33')](function(_0x222622){logger[_0x50d3('0x34')](_0x50d3('0x35'));});}}}function stopRouting(_0x4e966f,_0x2b222e,_0x5e17a2,_0x40a307){if(_0x4e966f&&_0x2b222e){_0x2b222e[_0x50d3('0x36')]-=0x1;var _0x43df15={'leaveAt':moment()[_0x50d3('0x16')](_0x50d3('0x23')),'acceptAt':moment()[_0x50d3('0x16')](_0x50d3('0x23')),'reason':'accepted'};logger[_0x50d3('0x2e')](util[_0x50d3('0x16')](_0x50d3('0x37'),_0x4e966f,_0x2b222e[_0x50d3('0x30')]));emitChannelQueueInteraction(_0x5e17a2[_0x50d3('0x26')],_0x2b222e[_0x50d3('0x30')],_0x5e17a2[_0x50d3('0x38')],_0x5e17a2[_0x50d3('0xe')][_0x50d3('0x30')],_0x5e17a2[_0x50d3('0x2a')]['id'],![],_0x40a307,_0x2b222e['id']);if(rpc[_0x5e17a2['channel']+_0x50d3('0x31')]){return rpc[_0x5e17a2['channel']+_0x50d3('0x31')][_0x50d3('0x39')](_0x4e966f,_0x43df15)[_0x50d3('0x33')](function(_0x4c2f72){logger['error'](_0x50d3('0x3a'));});}}}function endRouting(_0x2d98dc,_0x61bc62,_0x3d91de,_0x4d4840){if(_0x2d98dc&&_0x61bc62){_0x61bc62[_0x50d3('0x36')]-=0x1;var _0xbbb33f={'leaveAt':moment()['format'](_0x50d3('0x23')),'exitAt':moment()[_0x50d3('0x16')](_0x50d3('0x23')),'reason':_0x50d3('0x3b')};logger[_0x50d3('0x2e')](util[_0x50d3('0x16')](_0x50d3('0x3c'),_0x2d98dc,_0x61bc62[_0x50d3('0x30')]));emitChannelQueueInteraction(_0x3d91de[_0x50d3('0x26')],_0x61bc62['name'],_0x3d91de[_0x50d3('0x38')],_0x3d91de[_0x50d3('0xe')][_0x50d3('0x30')],_0x3d91de[_0x50d3('0x2a')]['id'],![],_0x4d4840);if(rpc[_0x3d91de[_0x50d3('0x26')]+_0x50d3('0x31')]){return rpc[_0x3d91de['channel']+_0x50d3('0x31')][_0x50d3('0x39')](_0x2d98dc,_0xbbb33f)[_0x50d3('0x33')](function(_0x946c11){logger[_0x50d3('0x34')](_0x50d3('0x3a'));});}}}function handleFindQueue(_0x1f6dd1){return function(_0x5b32f1){return _0x5b32f1['name'][_0x50d3('0x3d')]()===_0x1f6dd1[_0x50d3('0x3d')]();};}exports[_0x50d3('0x3e')]=function(_0x383f81,_0x17234a,_0x1100d8,_0x5cb255){return function(_0x59f052){try{var _0x3a8860={'name':_0x17234a[0x0],'timeout':_0x17234a[0x1]};var _0x282efd=queue[_0x50d3('0x0')](_0x3a8860,{'typecast':!![]});if(_0x282efd['length']){logger[_0x50d3('0x34')](_0x50d3('0x3f'),_0x383f81,_[_0x50d3('0x40')](_0x282efd,_0x50d3('0x2a'))['join'](',\x20'));_0x59f052[_0x50d3('0x41')]();}else{var _0x5cc045=_[_0x50d3('0x42')](_0x1100d8[_0x5cb255[_0x50d3('0x26')]+'Queues'],handleFindQueue(_0x3a8860[_0x50d3('0x30')]));if(_0x5cc045){startRouting(_0x383f81,_0x5cc045,_0x5cb255,_0x1100d8);var _0x1694b1=(_0x5cc045[_0x50d3('0x3b')]||0xa)*0x3e8;var _0x277787=(_0x3a8860[_0x50d3('0x3b')]||0x14)*0x3e8;var _0x133e86,_0x4b7a69;if(_0x1694b1>_0x277787){_0x277787=_0x1694b1;}var _0xc59c0b=seqqueue[_0x50d3('0x43')](_0x1694b1);_0xc59c0b['id']=_0x383f81;_0xc59c0b[_0x50d3('0x44')]=_0x1694b1;_0xc59c0b[_0x50d3('0x45')]=_0x277787;_0xc59c0b[_0x50d3('0x26')]=_0x5cb255['channel'];_0x1100d8[_0x50d3('0x46')][_0x383f81]['on'](_0x50d3('0x47'),function(){logger['info'](_0x50d3('0x48'),_0x383f81);stopRouting(_0x383f81,_0x5cc045,_0x5cb255,_0x1100d8);clearTimeout(_0x133e86);_0x133e86=undefined;_0xc59c0b[_0x50d3('0x49')](!![]);if(_0x1100d8[_0x50d3('0x46')][_0x383f81]){delete _0x1100d8[_0x50d3('0x46')][_0x383f81];}_0x59f052[_0x50d3('0x41')]();});_0x1100d8[_0x50d3('0x46')][_0x383f81]['on'](_0x50d3('0x4a'),function(){if(_0x1100d8[_0x50d3('0x46')][_0x383f81]){delete _0x1100d8[_0x50d3('0x46')][_0x383f81];}});_0x133e86=setTimeout(function(){logger[_0x50d3('0x2e')](_0x50d3('0x4b'),_0x383f81);endRouting(_0x383f81,_0x5cc045,_0x5cb255,_0x1100d8);clearTimeout(_0x133e86);_0xc59c0b[_0x50d3('0x49')](!![]);_0x59f052['next']();},_0x277787);switch(_0x5cc045[_0x50d3('0x4c')]){case _0x50d3('0x4d'):strategy[_0x50d3('0x4d')](_0xc59c0b,_0x5cc045,_0x1100d8,_0x5cb255);break;default:strategy[_0x50d3('0x4e')](_0xc59c0b,_0x5cc045,_0x1100d8,_0x5cb255);}}else{logger[_0x50d3('0x34')](_0x50d3('0x4f'),_0x383f81,_0x3a8860[_0x50d3('0x30')]);_0x59f052[_0x50d3('0x41')]();}}}catch(_0x111861){console[_0x50d3('0x50')](_0x111861);logger[_0x50d3('0x34')](_0x50d3('0x3f'),_0x383f81,_0x111861[_0x50d3('0x51')]);_0x59f052[_0x50d3('0x41')]();}};}; \ No newline at end of file +var _0xa887=['util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','queue','joinAt','clone','account','format','%sQueuesWaitingInteractions','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','number','timeout\x20is\x20a\x20number','waiting','body','from','contact','list','channel','QueueId','upperFirst','interaction','message','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','timeout','createQueue','atimeout','qtimeout','rules','end','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xa887,0x89));var _0x7a88=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa887[_0x5447fd];return _0x15b28a;};'use strict';var schema=require(_0x7a88('0x0'));var _=require('lodash');var util=require(_0x7a88('0x1'));var seqqueue=require(_0x7a88('0x2'));var moment=require('moment');var Redis=require(_0x7a88('0x3'));var config=require(_0x7a88('0x4'));var logger=require(_0x7a88('0x5'))(_0x7a88('0x6'));var strategy=require(_0x7a88('0x7'));config[_0x7a88('0x8')]=_[_0x7a88('0x9')](config[_0x7a88('0x8')],{'host':_0x7a88('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a88('0x8')]));var attributes=['id',_0x7a88('0xb'),'account',_0x7a88('0xc'),'from',_0x7a88('0xd')];function emit(_0x179388,_0x2d0893,_0x4b4568){io['to'](_0x179388)['emit'](_0x2d0893,_0x4b4568);}function emitChannelQueueInteraction(_0x11c10e,_0x3c324b,_0x29793d,_0x3cf197,_0x8ccfc,_0x3f8907,_0xd0ef4c,_0x1e0272){var _0x495404=_[_0x7a88('0xe')](_0x29793d);_0x495404['queue_id']=_0x1e0272;_0x495404[_0x7a88('0xc')]=_0x3c324b;_0x495404[_0x7a88('0xf')]=_0x3cf197;_0x495404['id']=_0x8ccfc;if(_0x3f8907){_0xd0ef4c[util[_0x7a88('0x10')](_0x7a88('0x11'),_0x11c10e)][_0x8ccfc]=_['pick'](_0x495404,attributes);}else{delete _0xd0ef4c[util[_0x7a88('0x10')]('%sQueuesWaitingInteractions',_0x11c10e)][_0x8ccfc];}emit(util[_0x7a88('0x10')]('%s:queue:%s',_0x11c10e,_0x3c324b),util['format']('%s_queue_waiting_interaction:%s',_0x11c10e,_0x3f8907?_0x7a88('0x12'):'remove'),_[_0x7a88('0x13')](_0x495404,attributes));}var rpc={'openchannelQueueReport':require(_0x7a88('0x14')),'mailQueueReport':require(_0x7a88('0x15')),'chatQueueReport':require(_0x7a88('0x16')),'smsQueueReport':require(_0x7a88('0x17')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x7a88('0x18'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x7a88('0x19'),'message':_0x7a88('0x1a')}});function startRouting(_0x232a0e,_0x3d684a,_0x1ec86f,_0x1341ca){if(_0x232a0e&&_0x3d684a&&_0x1ec86f){_0x3d684a[_0x7a88('0x1b')]+=0x1;var _0x9d9d08={'uniqueid':_0x232a0e,'from':_0x1ec86f[_0x7a88('0x1c')]?_0x1ec86f[_0x7a88('0x1c')][_0x7a88('0x1d')]:'','joinAt':moment()[_0x7a88('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ec86f['contact']?_0x1ec86f[_0x7a88('0x1e')]['id']:null,'ListId':_0x1ec86f[_0x7a88('0x1f')]?_0x1ec86f['list']['id']:null};_0x9d9d08[_['upperFirst'](_0x1ec86f[_0x7a88('0x20')])+_0x7a88('0x21')]=_0x3d684a['id']||null;_0x9d9d08[_[_0x7a88('0x22')](_0x1ec86f[_0x7a88('0x20')])+'InteractionId']=_0x1ec86f[_0x7a88('0x23')]?_0x1ec86f[_0x7a88('0x23')]['id']:null;_0x9d9d08[_[_0x7a88('0x22')](_0x1ec86f[_0x7a88('0x20')])+'MessageId']=_0x1ec86f['message']?_0x1ec86f[_0x7a88('0x24')]['id']:null;_0x9d9d08[_['upperFirst'](_0x1ec86f[_0x7a88('0x20')])+(_0x1ec86f['channel']!=='chat'?_0x7a88('0x25'):_0x7a88('0x26'))]=_0x1ec86f[_0x7a88('0xf')]?_0x1ec86f[_0x7a88('0xf')]['id']:null;logger[_0x7a88('0x27')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x232a0e,_0x3d684a[_0x7a88('0x28')]));emitChannelQueueInteraction(_0x1ec86f[_0x7a88('0x20')],_0x3d684a[_0x7a88('0x28')],_0x9d9d08,_0x1ec86f[_0x7a88('0xf')][_0x7a88('0x28')],_0x1ec86f[_0x7a88('0x24')]['id'],!![],_0x1341ca,_0x3d684a['id']);if(rpc[_0x1ec86f[_0x7a88('0x20')]+_0x7a88('0x29')]){return rpc[_0x1ec86f[_0x7a88('0x20')]+_0x7a88('0x29')][_0x7a88('0x2a')](_0x9d9d08)[_0x7a88('0x2b')](function(_0x354e9f){logger[_0x7a88('0x2c')](_0x7a88('0x2d'));});}}}function stopRouting(_0xd1cff1,_0x57ab8e,_0x1b77e3,_0x450fbd){if(_0xd1cff1&&_0x57ab8e){_0x57ab8e[_0x7a88('0x1b')]-=0x1;var _0x12964b={'leaveAt':moment()[_0x7a88('0x10')](_0x7a88('0x2e')),'acceptAt':moment()[_0x7a88('0x10')](_0x7a88('0x2e')),'reason':'accepted'};logger['info'](util[_0x7a88('0x10')]('[%s][STOP:QUEUE][NAME:%s]',_0xd1cff1,_0x57ab8e[_0x7a88('0x28')]));emitChannelQueueInteraction(_0x1b77e3[_0x7a88('0x20')],_0x57ab8e[_0x7a88('0x28')],_0x1b77e3[_0x7a88('0x1c')],_0x1b77e3['account'][_0x7a88('0x28')],_0x1b77e3['message']['id'],![],_0x450fbd,_0x57ab8e['id']);if(rpc[_0x1b77e3[_0x7a88('0x20')]+_0x7a88('0x29')]){return rpc[_0x1b77e3[_0x7a88('0x20')]+'QueueReport'][_0x7a88('0x2f')](_0xd1cff1,_0x12964b)[_0x7a88('0x2b')](function(_0x2a6d76){logger['error'](_0x7a88('0x30'));});}}}function endRouting(_0x38bd27,_0x3a6588,_0x29d55f,_0x4a3789){if(_0x38bd27&&_0x3a6588){_0x3a6588[_0x7a88('0x1b')]-=0x1;var _0x257293={'leaveAt':moment()[_0x7a88('0x10')](_0x7a88('0x2e')),'exitAt':moment()[_0x7a88('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0x7a88('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x38bd27,_0x3a6588[_0x7a88('0x28')]));emitChannelQueueInteraction(_0x29d55f[_0x7a88('0x20')],_0x3a6588[_0x7a88('0x28')],_0x29d55f[_0x7a88('0x1c')],_0x29d55f[_0x7a88('0xf')][_0x7a88('0x28')],_0x29d55f[_0x7a88('0x24')]['id'],![],_0x4a3789);if(rpc[_0x29d55f[_0x7a88('0x20')]+'QueueReport']){return rpc[_0x29d55f[_0x7a88('0x20')]+_0x7a88('0x29')][_0x7a88('0x2f')](_0x38bd27,_0x257293)[_0x7a88('0x2b')](function(_0x51741a){logger[_0x7a88('0x2c')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x5aff6c){return function(_0x5dd8ac){return _0x5dd8ac[_0x7a88('0x28')][_0x7a88('0x31')]()===_0x5aff6c[_0x7a88('0x31')]();};}exports['consequence']=function(_0x46e54f,_0x102a45,_0x3e56ab,_0x158259){return function(_0x2ec616){try{var _0x22e18f={'name':_0x102a45[0x0],'timeout':_0x102a45[0x1]};var _0xe5e816=queue[_0x7a88('0x0')](_0x22e18f,{'typecast':!![]});if(_0xe5e816[_0x7a88('0x32')]){logger[_0x7a88('0x2c')](_0x7a88('0x33'),_0x46e54f,_[_0x7a88('0x34')](_0xe5e816,'message')[_0x7a88('0x35')](',\x20'));_0x2ec616[_0x7a88('0x36')]();}else{var _0x331e1a=_[_0x7a88('0x37')](_0x3e56ab[_0x158259['channel']+'Queues'],handleFindQueue(_0x22e18f['name']));if(_0x331e1a){startRouting(_0x46e54f,_0x331e1a,_0x158259,_0x3e56ab);var _0xc3c9f7=(_0x331e1a[_0x7a88('0x38')]||0xa)*0x3e8;var _0x8d00a5=(_0x22e18f[_0x7a88('0x38')]||0x14)*0x3e8;var _0x5f17bf,_0x5b8ab8;if(_0xc3c9f7>_0x8d00a5){_0x8d00a5=_0xc3c9f7;}var _0x5aa888=seqqueue[_0x7a88('0x39')](_0xc3c9f7);_0x5aa888['id']=_0x46e54f;_0x5aa888[_0x7a88('0x3a')]=_0xc3c9f7;_0x5aa888[_0x7a88('0x3b')]=_0x8d00a5;_0x5aa888[_0x7a88('0x20')]=_0x158259[_0x7a88('0x20')];_0x3e56ab[_0x7a88('0x3c')][_0x46e54f]['on'](_0x7a88('0x3d'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x46e54f);stopRouting(_0x46e54f,_0x331e1a,_0x158259,_0x3e56ab);clearTimeout(_0x5f17bf);_0x5f17bf=undefined;_0x5aa888[_0x7a88('0x3e')](!![]);if(_0x3e56ab[_0x7a88('0x3c')][_0x46e54f]){delete _0x3e56ab['rules'][_0x46e54f];}_0x2ec616[_0x7a88('0x36')]();});_0x3e56ab[_0x7a88('0x3c')][_0x46e54f]['on'](_0x7a88('0x3f'),function(){if(_0x3e56ab[_0x7a88('0x3c')][_0x46e54f]){delete _0x3e56ab[_0x7a88('0x3c')][_0x46e54f];}});_0x5f17bf=setTimeout(function(){logger[_0x7a88('0x27')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x46e54f);endRouting(_0x46e54f,_0x331e1a,_0x158259,_0x3e56ab);clearTimeout(_0x5f17bf);_0x5aa888[_0x7a88('0x3e')](!![]);_0x2ec616[_0x7a88('0x40')]();},_0x8d00a5);switch(_0x331e1a[_0x7a88('0x41')]){case _0x7a88('0x42'):strategy['rrmemory'](_0x5aa888,_0x331e1a,_0x3e56ab,_0x158259);break;default:strategy[_0x7a88('0x43')](_0x5aa888,_0x331e1a,_0x3e56ab,_0x158259);}}else{logger['error'](_0x7a88('0x44'),_0x46e54f,_0x22e18f[_0x7a88('0x28')]);_0x2ec616[_0x7a88('0x36')]();}}}catch(_0x48c031){console['log'](_0x48c031);logger[_0x7a88('0x2c')](_0x7a88('0x33'),_0x46e54f,_0x48c031['stack']);_0x2ec616[_0x7a88('0x36')]();}};}; \ 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 9e3b3ec..5428e5d 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 _0xe06a=['showNotification','writeLog',':FORCED','busyQueue','STOP','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','routing','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy'];(function(_0x20d9ff,_0x1bcc4b){var _0x1f78aa=function(_0x4ab48e){while(--_0x4ab48e){_0x20d9ff['push'](_0x20d9ff['shift']());}};_0x1f78aa(++_0x1bcc4b);}(_0xe06a,0x66));var _0xae06=function(_0x5ed2d9,_0x13336b){_0x5ed2d9=_0x5ed2d9-0x0;var _0xfb189e=_0xe06a[_0x5ed2d9];return _0xfb189e;};'use strict';var _=require(_0xae06('0x0'));var uuid=require(_0xae06('0x1'));var util=require(_0xae06('0x2'));var logger=require(_0xae06('0x3'))('routing');var Agent=function(_0x347969,_0x28ae5e,_0x55385d,_0x23b58d){this[_0xae06('0x4')]=uuid['v4']();this[_0xae06('0x5')]=_0x347969;this['agent']=_0x28ae5e;this[_0xae06('0x6')]=_0x55385d;this[_0xae06('0x7')]=_0x23b58d;this[_0xae06('0x5')][_0xae06('0x8')](this[_0xae06('0x9')]['bind'](this),this[_0xae06('0xa')][_0xae06('0xb')](this));this[_0xae06('0x5')]['on'](_0xae06('0xc'),this['handleTimeout'][_0xae06('0xb')](this));this[_0xae06('0x5')]['on'](_0xae06('0xd'),this[_0xae06('0xe')][_0xae06('0xb')](this));};Agent[_0xae06('0xf')][_0xae06('0x8')]=function(){this['squeue'][_0xae06('0x8')](this['handleRun'][_0xae06('0xb')](this),this[_0xae06('0xa')][_0xae06('0xb')](this));};Agent['prototype'][_0xae06('0xe')]=function(){this[_0xae06('0xa')](!![]);};Agent[_0xae06('0xf')][_0xae06('0x9')]=function(){logger[_0xae06('0x10')](_0xae06('0x11'),this['squeue']['id'],this[_0xae06('0x12')]['id']);if(_[_0xae06('0x13')](this['realtime'][_0xae06('0x14')][this[_0xae06('0x12')]['id']])){logger['debug'](_0xae06('0x15'),this[_0xae06('0x5')]['id'],this[_0xae06('0x12')]['id']);setTimeout(this['push'][_0xae06('0xb')](this),0x3e8);}else{if(this[_0xae06('0x7')][_0xae06('0x16')]||util[_0xae06('0x17')](this[_0xae06('0x5')]['id'],this[_0xae06('0x6')][_0xae06('0x14')][this['agent']['id']],this['squeue'][_0xae06('0x18')],![])){this['realtime'][_0xae06('0x14')][this['agent']['id']][_0xae06('0x19')]=!![];this[_0xae06('0x6')][_0xae06('0x14')][this[_0xae06('0x12')]['id']]['busyQueue']=undefined;util[_0xae06('0x1a')](this[_0xae06('0x4')],this[_0xae06('0x5')]['id'],this[_0xae06('0x6')]['agents'][this[_0xae06('0x12')]['id']],null,this[_0xae06('0x7')]);util[_0xae06('0x1b')](this['squeue']['id'],this[_0xae06('0x6')]['agents'][this[_0xae06('0x12')]['id']],'RINGING'+(this['routing'][_0xae06('0x16')]?_0xae06('0x1c'):''));}else{logger[_0xae06('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xae06('0x5')]['id'],this[_0xae06('0x12')]['id']);setTimeout(this[_0xae06('0x8')]['bind'](this),0x3e8);}}};Agent[_0xae06('0xf')][_0xae06('0xa')]=function(_0x259913){if(_[_0xae06('0x13')](this[_0xae06('0x6')][_0xae06('0x14')][this[_0xae06('0x12')]['id']])){return logger['debug'](_0xae06('0x15'),this[_0xae06('0x5')]['id'],this['agent']['id']);}else{logger[_0xae06('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xae06('0x5')]['id'],this[_0xae06('0x12')]['id']);util['hideNotification'](this['notificationId'],this[_0xae06('0x5')]['id'],this[_0xae06('0x6')]['agents'][this[_0xae06('0x12')]['id']],null,this[_0xae06('0x7')]);this[_0xae06('0x6')]['agents'][this[_0xae06('0x12')]['id']][_0xae06('0x19')]=![];this[_0xae06('0x6')][_0xae06('0x14')][this[_0xae06('0x12')]['id']][_0xae06('0x1d')]=undefined;util['writeLog'](this[_0xae06('0x5')]['id'],this['realtime'][_0xae06('0x14')][this[_0xae06('0x12')]['id']],_0x259913?_0xae06('0x1e'):'TIMEOUT');}if(!_0x259913){setTimeout(this[_0xae06('0x8')][_0xae06('0xb')](this),0x3e8);}};function agent(_0x2191a9,_0x320791,_0x509a6d,_0x34120e){return new Agent(_0x2191a9,_0x320791,_0x509a6d,_0x34120e);}module[_0xae06('0x1f')]=agent; \ No newline at end of file +var _0x2109=['prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','busy','busyQueue','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','timeout','drained','bind'];(function(_0x169571,_0x2a94cd){var _0x5bc6a9=function(_0x44d66c){while(--_0x44d66c){_0x169571['push'](_0x169571['shift']());}};_0x5bc6a9(++_0x2a94cd);}(_0x2109,0x109));var _0x9210=function(_0x2b72f1,_0x10ae7d){_0x2b72f1=_0x2b72f1-0x0;var _0xbdd630=_0x2109[_0x2b72f1];return _0xbdd630;};'use strict';var _=require(_0x9210('0x0'));var uuid=require(_0x9210('0x1'));var util=require(_0x9210('0x2'));var logger=require(_0x9210('0x3'))(_0x9210('0x4'));var Agent=function(_0x4c6929,_0x23f024,_0x3b057d,_0x381d0c){this[_0x9210('0x5')]=uuid['v4']();this[_0x9210('0x6')]=_0x4c6929;this[_0x9210('0x7')]=_0x23f024;this[_0x9210('0x8')]=_0x3b057d;this[_0x9210('0x4')]=_0x381d0c;this[_0x9210('0x6')][_0x9210('0x9')](this[_0x9210('0xa')]['bind'](this),this[_0x9210('0xb')]['bind'](this));this[_0x9210('0x6')]['on'](_0x9210('0xc'),this[_0x9210('0xb')]['bind'](this));this[_0x9210('0x6')]['on'](_0x9210('0xd'),this['handleDrained'][_0x9210('0xe')](this));};Agent[_0x9210('0xf')][_0x9210('0x9')]=function(){this[_0x9210('0x6')][_0x9210('0x9')](this['handleRun'][_0x9210('0xe')](this),this[_0x9210('0xb')][_0x9210('0xe')](this));};Agent[_0x9210('0xf')][_0x9210('0x10')]=function(){this[_0x9210('0xb')](!![]);};Agent[_0x9210('0xf')][_0x9210('0xa')]=function(){logger[_0x9210('0x11')](_0x9210('0x12'),this[_0x9210('0x6')]['id'],this['agent']['id']);if(_[_0x9210('0x13')](this[_0x9210('0x8')][_0x9210('0x14')][this['agent']['id']])){logger[_0x9210('0x11')](_0x9210('0x15'),this['squeue']['id'],this[_0x9210('0x7')]['id']);setTimeout(this[_0x9210('0x9')]['bind'](this),0x3e8);}else{if(this[_0x9210('0x4')][_0x9210('0x16')]||util[_0x9210('0x17')](this[_0x9210('0x6')]['id'],this[_0x9210('0x8')][_0x9210('0x14')][this['agent']['id']],this['squeue'][_0x9210('0x18')],![])){this['realtime']['agents'][this[_0x9210('0x7')]['id']]['busy']=!![];this[_0x9210('0x8')][_0x9210('0x14')][this[_0x9210('0x7')]['id']]['busyQueue']=undefined;util[_0x9210('0x19')](this['notificationId'],this['squeue']['id'],this[_0x9210('0x8')][_0x9210('0x14')][this[_0x9210('0x7')]['id']],null,this[_0x9210('0x4')]);util[_0x9210('0x1a')](this['squeue']['id'],this[_0x9210('0x8')]['agents'][this[_0x9210('0x7')]['id']],_0x9210('0x1b')+(this['routing'][_0x9210('0x16')]?_0x9210('0x1c'):''));}else{logger[_0x9210('0x11')](_0x9210('0x1d'),this[_0x9210('0x6')]['id'],this[_0x9210('0x7')]['id']);setTimeout(this['push'][_0x9210('0xe')](this),0x3e8);}}};Agent[_0x9210('0xf')][_0x9210('0xb')]=function(_0x1a869a){if(_[_0x9210('0x13')](this['realtime'][_0x9210('0x14')][this[_0x9210('0x7')]['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x9210('0x6')]['id'],this[_0x9210('0x7')]['id']);}else{logger[_0x9210('0x11')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x9210('0x6')]['id'],this[_0x9210('0x7')]['id']);util['hideNotification'](this[_0x9210('0x5')],this[_0x9210('0x6')]['id'],this[_0x9210('0x8')]['agents'][this[_0x9210('0x7')]['id']],null,this[_0x9210('0x4')]);this['realtime'][_0x9210('0x14')][this[_0x9210('0x7')]['id']][_0x9210('0x1e')]=![];this[_0x9210('0x8')]['agents'][this['agent']['id']][_0x9210('0x1f')]=undefined;util[_0x9210('0x1a')](this['squeue']['id'],this[_0x9210('0x8')][_0x9210('0x14')][this['agent']['id']],_0x1a869a?_0x9210('0x20'):_0x9210('0x21'));}if(!_0x1a869a){setTimeout(this[_0x9210('0x9')][_0x9210('0xe')](this),0x3e8);}};function agent(_0x222643,_0x3bfec4,_0x490129,_0x553d12){return new Agent(_0x222643,_0x3bfec4,_0x490129,_0x553d12);}module[_0x9210('0x22')]=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 39e1acb..737f6e2 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 _0x2242=['isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','RINGING','busy','busyQueue','name','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','lodash','uuid','./util','routing','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype'];(function(_0x5316be,_0x5e07ef){var _0x375ae2=function(_0x3df935){while(--_0x3df935){_0x5316be['push'](_0x5316be['shift']());}};_0x375ae2(++_0x5e07ef);}(_0x2242,0x1a3));var _0x2224=function(_0x16b619,_0x14fc9e){_0x16b619=_0x16b619-0x0;var _0x390526=_0x2242[_0x16b619];return _0x390526;};'use strict';var _=require(_0x2224('0x0'));var uuid=require(_0x2224('0x1'));var util=require(_0x2224('0x2'));var logger=require('../../../../../config/logger')(_0x2224('0x3'));var Beepall=function(_0x317565,_0x4acc10,_0x1993b6,_0xb65b2f){this['notificationId']=uuid['v4']();this[_0x2224('0x4')]=_0x317565;this[_0x2224('0x5')]=_0x4acc10;this[_0x2224('0x6')]=_0x1993b6;this['routing']=_0xb65b2f;this[_0x2224('0x4')][_0x2224('0x7')](this[_0x2224('0x8')][_0x2224('0x9')](this),this[_0x2224('0xa')][_0x2224('0x9')](this));this[_0x2224('0x4')]['on'](_0x2224('0xb'),this[_0x2224('0xa')][_0x2224('0x9')](this));this[_0x2224('0x4')]['on'](_0x2224('0xc'),this[_0x2224('0xd')][_0x2224('0x9')](this));};Beepall[_0x2224('0xe')]['push']=function(){this['squeue'][_0x2224('0x7')](this[_0x2224('0x8')][_0x2224('0x9')](this),this[_0x2224('0xa')]['bind'](this));};Beepall[_0x2224('0xe')][_0x2224('0xd')]=function(){this['handleTimeout'](!![]);};Beepall['prototype'][_0x2224('0x8')]=function(){var _0xd9ca18=!![];if(!_['isNil'](this['queue'])&&!_[_0x2224('0xf')](this[_0x2224('0x5')][_0x2224('0x10')])&&this[_0x2224('0x5')][_0x2224('0x10')][_0x2224('0x11')]>0x0){for(var _0x34d045=0x0,_0x1327dc;_0x34d0450x0){for(var _0x3d4ea1=0x0,_0x593c42;_0x3d4ea10x0&&_0x475970[_0x105535+_0x5507('0x28')]>=_0x475970[_0x105535+'Capacity']){writeLog(_0x501a94,_0x475970,_0x105535[_0x5507('0x29')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x5507('0x2a')]=function(_0x4ea271,_0xa66a01,_0x24668b,_0x4beb0a,_0x5cbb09){return sendNotification(!![],_0x4ea271,_0xa66a01,_0x24668b,_0x4beb0a,_0x5cbb09);};exports[_0x5507('0x2b')]=function(_0x1a18d0,_0x5912d4,_0x2521cb,_0x24574b,_0x85d383){return sendNotification(![],_0x1a18d0,_0x5912d4,_0x2521cb,_0x24574b,_0x85d383);};exports[_0x5507('0x2c')]=writeLog; \ No newline at end of file +var _0x9c5a=['[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','writeLog','lodash','util','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','socket.io-emitter','user:%s','name','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','format','[%s][QUEUE]\x20%s','emit','notification:%s','save','remove','debug'];(function(_0x22e751,_0x15633c){var _0x5c1f14=function(_0x2efbf3){while(--_0x2efbf3){_0x22e751['push'](_0x22e751['shift']());}};_0x5c1f14(++_0x15633c);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1a76e9,_0x166453){_0x1a76e9=_0x1a76e9-0x0;var _0x49876d=_0x9c5a[_0x1a76e9];return _0x49876d;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var utils=require('../utils');var Redis=require(_0xa9c5('0x2'));var config=require(_0xa9c5('0x3'));var logger=require(_0xa9c5('0x4'))(_0xa9c5('0x5'));config['redis']=_[_0xa9c5('0x6')](config[_0xa9c5('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xa9c5('0x8'))(new Redis(config['redis']));function sendNotification(_0x394d84,_0x3df556,_0x4cb597,_0x4b6db6,_0x3d6b50,_0x16f331){io['to'](util['format'](_0xa9c5('0x9'),_0x4b6db6[_0xa9c5('0xa')]))['emit'](_0xa9c5('0xb'),_0x4b6db6);var _0x40a79d=_0x16f331||{};var _0x4a19c0=_0x4cb597['split']('.');var _0x38e106={'uniqueid':_0x3df556,'channel':_0x4a19c0[0x0],'id':_0x4a19c0[0x1],'title':_0x4a19c0[0x0]+_0xa9c5('0xc'),'interactionId':_0x4a19c0[0x2],'queue':_0x3d6b50?_0x3d6b50[_0xa9c5('0xa')]:null,'sound':_0x40a79d[_0xa9c5('0xd')][_0xa9c5('0xe')],'shake':_0x40a79d[_0xa9c5('0xd')][_0xa9c5('0xf')]};try{if(!_0x40a79d[_0xa9c5('0x10')]){_0x40a79d[_0xa9c5('0x10')]={};}if(_0x3d6b50){_0x40a79d[_0xa9c5('0x10')]['queue']=_0x3d6b50;}else if(_0x40a79d[_0xa9c5('0x10')][_0xa9c5('0x11')]){delete _0x40a79d[_0xa9c5('0x10')][_0xa9c5('0x11')];}_0x38e106[_0xa9c5('0x12')]=utils[_0xa9c5('0x13')](_0x40a79d[_0xa9c5('0xd')][_0xa9c5('0x14')],_0x40a79d);}catch(_0x19a43e){_0x38e106[_0xa9c5('0x12')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xa9c5('0x15')](util[_0xa9c5('0x16')](_0xa9c5('0x17'),_0x3df556,_0x19a43e['message']));}io['to'](util[_0xa9c5('0x16')](_0xa9c5('0x9'),_0x4b6db6[_0xa9c5('0xa')]))[_0xa9c5('0x18')](util[_0xa9c5('0x16')](_0xa9c5('0x19'),_0x394d84?_0xa9c5('0x1a'):_0xa9c5('0x1b')),_0x38e106);}function writeLog(_0x2c7cd5,_0x36c486,_0x113c8f){return logger[_0xa9c5('0x1c')](util['format'](_0xa9c5('0x1d'),_0x2c7cd5,_0x36c486[_0xa9c5('0xa')],_0x113c8f));}exports['isAgentAvailable']=function(_0x5d2115,_0xce9af6,_0x366f5c,_0x10b208){if(_0xce9af6[_0xa9c5('0x1e')]){writeLog(_0x5d2115,_0xce9af6,_0xa9c5('0x1f'));return![];}if(!_0xce9af6[_0xa9c5('0x20')]){writeLog(_0x5d2115,_0xce9af6,'OFFLINE');return![];}if(_0xce9af6[_0x366f5c+'Pause']){writeLog(_0x5d2115,_0xce9af6,_0xa9c5('0x21'));return![];}if(_0x10b208&&_0xce9af6[_0xa9c5('0x22')](_0x366f5c+'Capacity')&&_0xce9af6[_0xa9c5('0x22')](_0x366f5c+_0xa9c5('0x23'))){if(_0xce9af6[_0x366f5c+_0xa9c5('0x24')]>0x0&&_0xce9af6[_0x366f5c+_0xa9c5('0x23')]>=_0xce9af6[_0x366f5c+_0xa9c5('0x24')]){writeLog(_0x5d2115,_0xce9af6,_0x366f5c[_0xa9c5('0x25')]()+_0xa9c5('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x4e8a7f,_0x242771,_0x4cd5e6,_0x1762ac,_0x830bad){return sendNotification(!![],_0x4e8a7f,_0x242771,_0x4cd5e6,_0x1762ac,_0x830bad);};exports['hideNotification']=function(_0x11a723,_0x320dc0,_0x5f468b,_0x413edf,_0x32baf9){return sendNotification(![],_0x11a723,_0x320dc0,_0x5f468b,_0x413edf,_0x32baf9);};exports[_0xa9c5('0x27')]=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 4affc97..0213d01 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 _0x0810=['getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x0810,0x95));var _0x0081=function(_0x491411,_0x941b5a){_0x491411=_0x491411-0x0;var _0x4672eb=_0x0810[_0x491411];return _0x4672eb;};'use strict';var schema=require(_0x0081('0x0'));var sh=require(_0x0081('0x1'));var _=require(_0x0081('0x2'));var utils=require(_0x0081('0x3'));var logger=require(_0x0081('0x4'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x0081('0x5')}});exports['consequence']=function(_0x5c73ba,_0x14db28){return function(_0x5cd314){try{var _0x30c217={'command':_0x14db28[0x0]};var _0x5e90a5=system['validate'](_0x30c217,{'typecast':!![]});if(_0x5e90a5['length']){logger[_0x0081('0x6')]('[%s][SYSTEM]\x20%s',_0x5c73ba,_['map'](_0x5e90a5,_0x0081('0x7'))['join'](',\x20'));logger[_0x0081('0x8')](_0x0081('0x9'),_0x5c73ba);_0x5cd314[_0x0081('0xa')]();}else{var _0x3d8088=this;var _0x5a1251=utils[_0x0081('0xb')](_0x14db28[0x0],this);logger['info'](_0x0081('0xc'),_0x5c73ba,_0x5a1251);sh[_0x0081('0xd')](_['trim'](_0x5a1251),function(_0x59e210,_0x3c3ac9){logger[_0x0081('0x8')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x5c73ba,_0x59e210);if(_0x59e210==0x0){var _0x17806f=_0x3c3ac9[_0x0081('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x0081('0xf')](_0x14db28[0x1])||_[_0x0081('0x10')](_0x14db28[0x1])){logger[_0x0081('0x8')]('[%s][SYSTEM]\x20no\x20variable',_0x5c73ba);_0x3d8088[_0x0081('0x11')][_0x14db28[0x1]]=_0x17806f;}else{logger[_0x0081('0x8')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5c73ba,_0x14db28[0x1],_0x17806f);_0x3d8088[_0x0081('0x11')][_0x14db28[0x1]]=_0x17806f;}}_0x5cd314[_0x0081('0xa')]();});}}catch(_0x21de2d){logger[_0x0081('0x6')](_0x0081('0x12'),_0x5c73ba,_[_0x0081('0x13')](_0x21de2d)?JSON['stringify'](_0x21de2d):_0x21de2d);logger['info'](_0x0081('0x9'),_0x5c73ba);_0x5cd314[_0x0081('0xa')]();}};}; \ No newline at end of file +var _0x808a=['exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','error','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','consequence','length','map','message','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x9b1a6,_0xeb2cb){var _0x5363f1=function(_0x23a3bd){while(--_0x23a3bd){_0x9b1a6['push'](_0x9b1a6['shift']());}};_0x5363f1(++_0xeb2cb);}(_0x808a,0x1b7));var _0xa808=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0x808a[_0xd9f102];return _0x2652e4;};'use strict';var schema=require(_0xa808('0x0'));var sh=require(_0xa808('0x1'));var _=require(_0xa808('0x2'));var utils=require(_0xa808('0x3'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa808('0x4')]=function(_0x38ed20,_0x3baf9b){return function(_0x342101){try{var _0x4ff931={'command':_0x3baf9b[0x0]};var _0x14b3bf=system[_0xa808('0x0')](_0x4ff931,{'typecast':!![]});if(_0x14b3bf[_0xa808('0x5')]){logger['error']('[%s][SYSTEM]\x20%s',_0x38ed20,_[_0xa808('0x6')](_0x14b3bf,_0xa808('0x7'))['join'](',\x20'));logger[_0xa808('0x8')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x38ed20);_0x342101['next']();}else{var _0x15b963=this;var _0x13561b=utils[_0xa808('0x9')](_0x3baf9b[0x0],this);logger[_0xa808('0x8')](_0xa808('0xa'),_0x38ed20,_0x13561b);sh[_0xa808('0xb')](_[_0xa808('0xc')](_0x13561b),function(_0x29ca49,_0x519b24){logger['info'](_0xa808('0xd'),_0x38ed20,_0x29ca49);if(_0x29ca49==0x0){var _0x3714fe=_0x519b24[_0xa808('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0xa808('0xf')](_0x3baf9b[0x1])||_[_0xa808('0x10')](_0x3baf9b[0x1])){logger['info'](_0xa808('0x11'),_0x38ed20);_0x15b963[_0xa808('0x12')][_0x3baf9b[0x1]]=_0x3714fe;}else{logger['info'](_0xa808('0x13'),_0x38ed20,_0x3baf9b[0x1],_0x3714fe);_0x15b963[_0xa808('0x12')][_0x3baf9b[0x1]]=_0x3714fe;}}_0x342101[_0xa808('0x14')]();});}}catch(_0x5ca5ba){logger[_0xa808('0x15')](_0xa808('0x16'),_0x38ed20,_[_0xa808('0x17')](_0x5ca5ba)?JSON[_0xa808('0x18')](_0x5ca5ba):_0x5ca5ba);logger[_0xa808('0x8')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x38ed20);_0x342101[_0xa808('0x14')]();}};}; \ 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 e2303cb..372323a 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 _0x133a=['catch','stringify','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x27c7af,_0xf08b4c){var _0x5d1322=function(_0x4510f5){while(--_0x4510f5){_0x27c7af['push'](_0x27c7af['shift']());}};_0x5d1322(++_0xf08b4c);}(_0x133a,0x1b3));var _0xa133=function(_0x5431f6,_0x3a2549){_0x5431f6=_0x5431f6-0x0;var _0x187854=_0x133a[_0x5431f6];return _0x187854;};'use strict';var schema=require(_0xa133('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xa133('0x1')),'openchannelInteraction':require(_0xa133('0x2')),'smsInteraction':require(_0xa133('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xa133('0x4')),'whatsappInteraction':require(_0xa133('0x5'))};var logger=require('../../../../config/logger')(_0xa133('0x6'));var tag=schema({'tag':{'type':_0xa133('0x7'),'required':!![],'message':_0xa133('0x8')}});exports[_0xa133('0x9')]=function(_0xbe02bb,_0x5cabd5,_0x4f1572,_0x4bd758){return function(_0x5db1b3){try{var _0x13aff9={'tag':_0x5cabd5[0x0]};var _0x1698ee=tag['validate'](_0x13aff9,{'typecast':!![]});if(_0x1698ee[_0xa133('0xa')]){logger[_0xa133('0xb')](_0xa133('0xc'),_0xbe02bb,_[_0xa133('0xd')](_0x1698ee,'message')[_0xa133('0xe')](',\x20'));logger[_0xa133('0xf')](_0xa133('0x10'),_0xbe02bb);_0x5db1b3[_0xa133('0x11')]();}else{var _0x5745be={'ids':[_0x5cabd5[0x0]]};if(rpc[_0x4bd758[_0xa133('0x12')]+_0xa133('0x13')]){rpc[_0x4bd758['channel']+'Interaction'][_0xa133('0x14')](_0x4bd758[_0xa133('0x15')]['id'],_0x5745be)[_0xa133('0x16')](function(_0x151fa2){logger['info'](_0xa133('0x17'),_0xbe02bb,_0x5cabd5[0x1],_0x4bd758[_0xa133('0x12')],_0x4bd758['interaction']['id']);})[_0xa133('0x18')](function(_0x4887ce){logger[_0xa133('0xb')]('[%s][TAG]\x20%s',_0xbe02bb,JSON[_0xa133('0x19')](_0x4887ce));logger[_0xa133('0xf')](_0xa133('0x10'),_0xbe02bb);})['finally'](function(){_0x5db1b3['next']();});}}}catch(_0x46e4fe){logger['error'](_0xa133('0xc'),_0xbe02bb,_[_0xa133('0x1a')](_0x46e4fe)?JSON['stringify'](_0x46e4fe):_0x46e4fe);logger[_0xa133('0xf')](_0xa133('0x10'),_0xbe02bb);_0x5db1b3['next']();}};}; \ No newline at end of file +var _0x726f=['../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','map','message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction'];(function(_0x5e5c4c,_0x21abba){var _0x176148=function(_0x59522a){while(--_0x59522a){_0x5e5c4c['push'](_0x5e5c4c['shift']());}};_0x176148(++_0x21abba);}(_0x726f,0x1a5));var _0xf726=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x726f[_0x1d1779];return _0x2377e9;};'use strict';var schema=require(_0xf726('0x0'));var _=require(_0xf726('0x1'));var rpc={'chatInteraction':require(_0xf726('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xf726('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xf726('0x4'))};var logger=require(_0xf726('0x5'))(_0xf726('0x6'));var tag=schema({'tag':{'type':_0xf726('0x7'),'required':!![],'message':_0xf726('0x8')}});exports['consequence']=function(_0x3691ad,_0x20863a,_0x428561,_0x440af6){return function(_0x542806){try{var _0x4a6658={'tag':_0x20863a[0x0]};var _0x38e72e=tag[_0xf726('0x0')](_0x4a6658,{'typecast':!![]});if(_0x38e72e[_0xf726('0x9')]){logger[_0xf726('0xa')](_0xf726('0xb'),_0x3691ad,_[_0xf726('0xc')](_0x38e72e,_0xf726('0xd'))['join'](',\x20'));logger['info'](_0xf726('0xe'),_0x3691ad);_0x542806[_0xf726('0xf')]();}else{var _0x9de620={'ids':[_0x20863a[0x0]]};if(rpc[_0x440af6[_0xf726('0x10')]+_0xf726('0x11')]){rpc[_0x440af6[_0xf726('0x10')]+_0xf726('0x11')]['addTags'](_0x440af6['interaction']['id'],_0x9de620)[_0xf726('0x12')](function(_0x4059ce){logger[_0xf726('0x13')](_0xf726('0x14'),_0x3691ad,_0x20863a[0x1],_0x440af6[_0xf726('0x10')],_0x440af6['interaction']['id']);})[_0xf726('0x15')](function(_0x1da214){logger['error'](_0xf726('0xb'),_0x3691ad,JSON[_0xf726('0x16')](_0x1da214));logger[_0xf726('0x13')](_0xf726('0xe'),_0x3691ad);})[_0xf726('0x17')](function(){_0x542806[_0xf726('0xf')]();});}}}catch(_0x2c7f4b){logger[_0xf726('0xa')]('[%s][TAG]\x20%s',_0x3691ad,_[_0xf726('0x18')](_0x2c7f4b)?JSON[_0xf726('0x16')](_0x2c7f4b):_0x2c7f4b);logger[_0xf726('0x13')](_0xf726('0xe'),_0x3691ad);_0x542806['next']();}};}; \ 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 b5d74e3..f4f2ba1 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 _0x63b9=['urlOnRing','title','jsonrpc','2.0','push','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','urlOnAnswer','?params='];(function(_0xd4b7e3,_0x36c198){var _0x14e1c2=function(_0x2bcc4b){while(--_0x2bcc4b){_0xd4b7e3['push'](_0xd4b7e3['shift']());}};_0x14e1c2(++_0x36c198);}(_0x63b9,0xc4));var _0x963b=function(_0x1092ba,_0x5869e0){_0x1092ba=_0x1092ba-0x0;var _0x410e1f=_0x63b9[_0x1092ba];return _0x410e1f;};'use strict';var rp=require(_0x963b('0x0'));var logger=require(_0x963b('0x1'))('routing');var _=require(_0x963b('0x2'));var arr=[];exports[_0x963b('0x3')]=function(_0x52c7df,_0x809ce7){return function(_0x3d741b){var _0x4f157a=_0x809ce7[0xa];var _0x11e224=_0x809ce7[0xb];var _0x218efb=_0x809ce7[0xc];var _0xdcb8d1=_0x809ce7[0xd];var _0x26c13f=_0x809ce7[0xe];var _0x2d1854=_0x809ce7[0xf][_0x963b('0x4')](/\n/g,_0x963b('0x5'));var _0x4f4bf5=_0x809ce7[0x10][_0x963b('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x11e224)){arr['push'](_0x11e224);var _0x1e8e7d=_0x809ce7[0x3];var _0x2ac05e=_0x809ce7[0x4];var _0x585fac=_0x809ce7[0x1];var _0x1a1a0c=_0x809ce7[0x0];var _0x2b5ca1={};_0x2b5ca1[_0x963b('0x6')]=_0x809ce7[0x8]+_0x963b('0x7')+_0x218efb+'|'+_0x4f157a+'|'+_0xdcb8d1+'|'+_0x11e224+'|'+_0x26c13f;_0x2b5ca1[_0x963b('0x8')]=_0x809ce7[0x7]+_0x963b('0x7')+_0x218efb+'|'+_0x4f157a+'|'+_0xdcb8d1+'|'+_0x11e224+'|'+_0x26c13f+'|'+_0x2d1854+'|'+_0x4f4bf5;_0x2b5ca1[_0x963b('0x9')]=_0x809ce7[0x9];var _0x35fb4a={};_0x35fb4a[_0x963b('0xa')]=_0x963b('0xb');_0x35fb4a['method']='login';var _0x8aece5=[];_0x8aece5[_0x963b('0xc')](_0x809ce7[0x2]);_0x8aece5[_0x963b('0xc')](_0x809ce7[0x5]);_0x8aece5[_0x963b('0xc')](_0x809ce7[0x6]);_0x35fb4a[_0x963b('0xd')]=_0x8aece5;_0x35fb4a['id']=0x1;var _0x26c64a=JSON[_0x963b('0xe')](_0x35fb4a);var _0x43df2e={'encoding':_0x963b('0xf'),'method':_0x963b('0x10'),'timeout':0x2710,'url':_0x1e8e7d,'headers':{'Content-Type':_0x963b('0x11')},'body':_0x26c64a};return rp(_0x43df2e)[_0x963b('0x12')](function(_0x7504ab){const _0x5121f3=JSON[_0x963b('0x13')](_0x7504ab);if(!_0x5121f3[_0x963b('0x14')][_0x963b('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x30cea0=_0x11e224;var _0x2a8c47=_0x963b('0x16')+_0x585fac+_0x963b('0x17')+_0x1a1a0c+_0x963b('0x18')+_0x30cea0+_0x963b('0x19')+JSON['stringify'](_0x2b5ca1);var _0x1a3ba6=_0x2ac05e+'?'+_0x2a8c47;return rp(_0x1a3ba6);})[_0x963b('0x12')](function(_0xb3310e){logger[_0x963b('0x1a')](_0x963b('0x1b'),_0x52c7df,_0xb3310e);_0x3d741b[_0x963b('0x1c')]();})[_0x963b('0x1d')](function(_0x44660b){logger[_0x963b('0x1e')]('[%s][TVOX]\x20%s',_0x52c7df,_[_0x963b('0x1f')](_0x44660b)?JSON[_0x963b('0xe')](_0x44660b):_0x44660b);_0x3d741b[_0x963b('0x1c')]();});}else{logger[_0x963b('0x1a')](_0x963b('0x20'),_0x52c7df);_0x3d741b[_0x963b('0x21')]();}};}; \ No newline at end of file +var _0xb5cb=['parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','stringify','info','stop','catch','error','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','replace','includes','urlOnAnswer','?params=','urlOnRing','title','method','login','push','application/json-rpc','then'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xb5cb,0x179));var _0xbb5c=function(_0x540841,_0x149d1f){_0x540841=_0x540841-0x0;var _0x58c65d=_0xb5cb[_0x540841];return _0x58c65d;};'use strict';var rp=require(_0xbb5c('0x0'));var logger=require(_0xbb5c('0x1'))(_0xbb5c('0x2'));var _=require(_0xbb5c('0x3'));var arr=[];exports['consequence']=function(_0x2e9bb9,_0x4fc9db){return function(_0x1df30a){var _0x3364c8=_0x4fc9db[0xa];var _0x41289d=_0x4fc9db[0xb];var _0x3bc38d=_0x4fc9db[0xc];var _0x32c9aa=_0x4fc9db[0xd];var _0x451a50=_0x4fc9db[0xe];var _0xd49447=_0x4fc9db[0xf][_0xbb5c('0x4')](/\n/g,'\x20-\x20');var _0x1d2c7a=_0x4fc9db[0x10][_0xbb5c('0x4')](/\n/g,'\x20');if(!arr[_0xbb5c('0x5')](_0x41289d)){arr['push'](_0x41289d);var _0x3d56c4=_0x4fc9db[0x3];var _0x3dcbcf=_0x4fc9db[0x4];var _0x37ee53=_0x4fc9db[0x1];var _0x387549=_0x4fc9db[0x0];var _0x12f518={};_0x12f518[_0xbb5c('0x6')]=_0x4fc9db[0x8]+_0xbb5c('0x7')+_0x3bc38d+'|'+_0x3364c8+'|'+_0x32c9aa+'|'+_0x41289d+'|'+_0x451a50;_0x12f518[_0xbb5c('0x8')]=_0x4fc9db[0x7]+_0xbb5c('0x7')+_0x3bc38d+'|'+_0x3364c8+'|'+_0x32c9aa+'|'+_0x41289d+'|'+_0x451a50+'|'+_0xd49447+'|'+_0x1d2c7a;_0x12f518[_0xbb5c('0x9')]=_0x4fc9db[0x9];var _0x5dc45d={};_0x5dc45d['jsonrpc']='2.0';_0x5dc45d[_0xbb5c('0xa')]=_0xbb5c('0xb');var _0x24a99d=[];_0x24a99d['push'](_0x4fc9db[0x2]);_0x24a99d[_0xbb5c('0xc')](_0x4fc9db[0x5]);_0x24a99d[_0xbb5c('0xc')](_0x4fc9db[0x6]);_0x5dc45d['params']=_0x24a99d;_0x5dc45d['id']=0x1;var _0x20502b=JSON['stringify'](_0x5dc45d);var _0x4ba700={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x3d56c4,'headers':{'Content-Type':_0xbb5c('0xd')},'body':_0x20502b};return rp(_0x4ba700)[_0xbb5c('0xe')](function(_0xbc419a){const _0x294942=JSON[_0xbb5c('0xf')](_0xbc419a);if(!_0x294942[_0xbb5c('0x10')][_0xbb5c('0x11')]){throw new Error(_0xbb5c('0x12'));}var _0x356312=_0x41289d;var _0x3c8392=_0xbb5c('0x13')+_0x37ee53+_0xbb5c('0x14')+_0x387549+_0xbb5c('0x15')+_0x356312+'&data='+JSON[_0xbb5c('0x16')](_0x12f518);var _0x35a616=_0x3dcbcf+'?'+_0x3c8392;return rp(_0x35a616);})[_0xbb5c('0xe')](function(_0x873205){logger[_0xbb5c('0x17')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x2e9bb9,_0x873205);_0x1df30a[_0xbb5c('0x18')]();})[_0xbb5c('0x19')](function(_0x11626c){logger[_0xbb5c('0x1a')]('[%s][TVOX]\x20%s',_0x2e9bb9,_['isObject'](_0x11626c)?JSON[_0xbb5c('0x16')](_0x11626c):_0x11626c);_0x1df30a[_0xbb5c('0x18')]();});}else{logger[_0xbb5c('0x17')](_0xbb5c('0x1b'),_0x2e9bb9);_0x1df30a['next']();}};}; \ 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 01f2c38..25129ca 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x4e0529,_0x38696d){var _0x394c29=function(_0x2b8253){while(--_0x2b8253){_0x4e0529['push'](_0x4e0529['shift']());}};_0x394c29(++_0x38696d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x277dcc,_0x537dc3){var _0x1d2c87=function(_0x300c48){while(--_0x300c48){_0x277dcc['push'](_0x277dcc['shift']());}};_0x1d2c87(++_0x537dc3);}(_0xe706,0xa3));var _0x6e70=function(_0x2bcb4d,_0x1b1d96){_0x2bcb4d=_0x2bcb4d-0x0;var _0x423940=_0xe706[_0x2bcb4d];return _0x423940;};'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 1f065f0..c45241d 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 _0x99e9=['%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','mail','push','slice','dialogflow','appdata','split','dialogflowv2','tag','TagId','tvox','account','ContactId','body','%s:%s:%s','condition','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','info','agent','agents','busy','interaction','end','QueueReport','update','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format'];(function(_0x5d664f,_0x481f6b){var _0x45c3fe=function(_0x413796){while(--_0x413796){_0x5d664f['push'](_0x5d664f['shift']());}};_0x45c3fe(++_0x481f6b);}(_0x99e9,0xb4));var _0x999e=function(_0x529059,_0x294a33){_0x529059=_0x529059-0x0;var _0x156bc2=_0x99e9[_0x529059];return _0x156bc2;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var fs=require('fs');var jayson=require(_0x999e('0x2'));var BPromise=require(_0x999e('0x3'));var utils=require('./applications/utils');var logger=require(_0x999e('0x4'))(_0x999e('0x5'));var rpc={'openchannelQueueReport':require(_0x999e('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x999e('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x999e('0x8')),'whatsappQueueReport':require(_0x999e('0x9'))};var RuleEngine=require(_0x999e('0xa'));function getId(_0x18f337,_0x5c1c17,_0x46aeae){return util[_0x999e('0xb')](_0x999e('0xc'),_0x18f337,_0x5c1c17||0x0,_0x46aeae||0x0);}function getIntervals(_0x46f780,_0x2c38cf){var _0x175042=[];if(!_[_0x999e('0xd')](_0x2c38cf[_0x999e('0xe')])&&!_[_0x999e('0xd')](_0x46f780[_0x2c38cf[_0x999e('0xe')]])&&!_[_0x999e('0xd')](_0x46f780[_0x2c38cf[_0x999e('0xe')]][_0x999e('0xf')])){_0x175042=_[_0x999e('0x10')](_0x46f780[_0x2c38cf[_0x999e('0xe')]][_0x999e('0xf')],_0x999e('0x11'));}else if(!_['isNil'](_0x2c38cf[_0x999e('0x11')])){_0x175042=[_0x2c38cf['interval']];}return _0x175042;}exports[_0x999e('0x12')]=function(_0x387924){_0x387924[_0x999e('0x13')]={};return new BPromise(function(_0x538a92,_0x28bdd1){var _0x4d1716={'Start':function(_0xa44e4c){var _0x539598=this;return new Promise(function(_0x549ad4,_0x1eee64){if(_0xa44e4c){try{var _0x22feac=[];var _0x2dd5f4=getId(_0xa44e4c[_0x999e('0x14')],_0xa44e4c[_0x999e('0x15')]?_0xa44e4c[_0x999e('0x15')]['id']:0x0,_0xa44e4c['interaction']?_0xa44e4c['interaction']['id']:0x0);if(_0xa44e4c['applications']&&_[_0x999e('0x16')](_0xa44e4c[_0x999e('0x17')])&&_0xa44e4c[_0x999e('0x17')][_0x999e('0x18')]){for(var _0x229673=0x0;_0x229673<_0xa44e4c[_0x999e('0x17')]['length'];_0x229673+=0x1){var _0x5d86d4=_0xa44e4c[_0x999e('0x17')][_0x229673];if(fs[_0x999e('0x19')](path[_0x999e('0x1a')](__dirname,'applications',_0x5d86d4[_0x999e('0x1b')]+_0x999e('0x1c')))){var _0x3b73f0=[];switch(_0x5d86d4[_0x999e('0x1b')][_0x999e('0x1d')]()){case _0x999e('0x1e'):var _0x427bcf=_0x5d86d4['appdata']['split'](',');if(_0xa44e4c[_0x999e('0x14')]===_0x999e('0x1f')){_0x3b73f0['push'](_0x427bcf[0x0]);_0x3b73f0[_0x999e('0x20')](_0x427bcf[0x1]);_0x3b73f0[_0x999e('0x20')](_0x427bcf[_0x999e('0x21')](0x2,_0x427bcf[_0x999e('0x18')])[_0x999e('0x1a')](','));}else{_0x3b73f0[_0x999e('0x20')](_0x427bcf[0x0]);_0x3b73f0['push'](_0x427bcf[_0x999e('0x21')](0x1,_0x427bcf[_0x999e('0x18')])[_0x999e('0x1a')](','));}break;case _0x999e('0x22'):var _0x1b7adb=_0x5d86d4[_0x999e('0x23')][_0x999e('0x24')](',');_0x3b73f0['push'](_0x1b7adb[0x0]);_0x3b73f0[_0x999e('0x20')](_0x1b7adb[0x1]);_0x3b73f0['push'](_0x1b7adb['slice'](0x2,_0x1b7adb[_0x999e('0x18')])[_0x999e('0x1a')](','));break;case _0x999e('0x25'):var _0x555ca0=_0x5d86d4[_0x999e('0x23')][_0x999e('0x24')](',');_0x3b73f0[_0x999e('0x20')](_0x555ca0[0x0]);_0x3b73f0[_0x999e('0x20')](_0x555ca0[0x1]);_0x3b73f0[_0x999e('0x20')](_0x555ca0[0x2]);_0x3b73f0[_0x999e('0x20')](_0x555ca0[0x3]);_0x3b73f0[_0x999e('0x20')](_0x555ca0[_0x999e('0x21')](0x4,_0x555ca0[_0x999e('0x18')])[_0x999e('0x1a')](','));break;case'amazonlex':var _0x1c8feb=_0x5d86d4[_0x999e('0x23')][_0x999e('0x24')](',');_0x3b73f0['push'](_0x1c8feb[0x0]);_0x3b73f0[_0x999e('0x20')](_0x1c8feb[0x1]);_0x3b73f0['push'](_0x1c8feb[0x2]);_0x3b73f0['push'](_0x1c8feb[0x3]);_0x3b73f0[_0x999e('0x20')](_0x1c8feb[_0x999e('0x21')](0x4,_0x1c8feb['length'])['join'](','));break;case _0x999e('0x15'):_0x3b73f0[_0x999e('0x20')](_0x5d86d4[_0x999e('0x23')]);break;case _0x999e('0x26'):_0x3b73f0['push'](_0x5d86d4[_0x999e('0x27')]);_0x3b73f0[_0x999e('0x20')](_0x5d86d4[_0x999e('0x23')]);break;case _0x999e('0x28'):var _0x4f861f=utils['getMustacheRender'](_0xa44e4c[_0x999e('0x29')]['notificationTemplate'],_0xa44e4c);var _0xd7f2a9=_0x5d86d4[_0x999e('0x23')][_0x999e('0x24')](',');_0x3b73f0[_0x999e('0x20')](_0xd7f2a9[0x0]);_0x3b73f0['push'](_0xd7f2a9[0x1]);_0x3b73f0[_0x999e('0x20')](_0xd7f2a9[0x2]);_0x3b73f0[_0x999e('0x20')](_0xd7f2a9[0x3]);_0x3b73f0['push'](_0xd7f2a9[0x4]);_0x3b73f0['push'](_0xd7f2a9[0x5]);_0x3b73f0[_0x999e('0x20')](_0xd7f2a9[0x6]);_0x3b73f0['push'](_0xd7f2a9[0x7]);_0x3b73f0[_0x999e('0x20')](_0xd7f2a9[0x8]);_0x3b73f0['push'](_0xd7f2a9[0x9]);_0x3b73f0['push'](_0xd7f2a9[0xa]);_0x3b73f0['push'](_0xa44e4c['interaction']['id']);_0x3b73f0[_0x999e('0x20')](_0xa44e4c['message']['id']);_0x3b73f0[_0x999e('0x20')](_0x5d86d4['ChatWebsiteId']);_0x3b73f0['push'](_0xa44e4c['interaction'][_0x999e('0x2a')]);_0x3b73f0[_0x999e('0x20')](_0xa44e4c[_0x999e('0x2b')][_0x999e('0x2b')]);_0x3b73f0[_0x999e('0x20')](_0x4f861f);break;default:_0x3b73f0=_[_0x999e('0xd')](_0x5d86d4[_0x999e('0x23')])?[]:_0x5d86d4[_0x999e('0x23')]['split'](',');}var _0x3ff20a={'id':util[_0x999e('0xb')](_0x999e('0x2c'),_0x2dd5f4,_0x5d86d4['id'],_0x5d86d4[_0x999e('0x1b')]),'condition':require('./interval')[_0x999e('0x2d')](_0x2dd5f4,getIntervals(_0x387924['intervals'],_0x5d86d4),_0x387924),'consequence':require(_0x999e('0x2e')+_0x5d86d4[_0x999e('0x1b')])[_0x999e('0x2f')](_0x2dd5f4,_0x3b73f0,_0x387924,_0xa44e4c),'p':_0x5d86d4[_0x999e('0x30')]||0x0};logger['info'](_0x999e('0x31'),_0x3ff20a['id'],_0x999e('0x32'),getIntervals(_0x387924[_0x999e('0x33')],_0x5d86d4)['join']('\x20|\x20'));_0x22feac[_0x999e('0x20')](_0x3ff20a);}else{logger[_0x999e('0x34')](_0x999e('0x35'),path[_0x999e('0x1a')](__dirname,_0x999e('0x17'),_0x5d86d4[_0x999e('0x1b')]+_0x999e('0x1c')));}}_0x387924[_0x999e('0x13')][_0x2dd5f4]=new RuleEngine(_0x22feac);_0x387924[_0x999e('0x13')][_0x2dd5f4][_0x999e('0x36')](_0xa44e4c,function(_0x55da0b){logger['info'](_0x999e('0x37'),JSON[_0x999e('0x38')](_0x55da0b[_0x999e('0x39')]));if(_0x387924[_0x999e('0x13')][_0x2dd5f4]){_0x387924[_0x999e('0x13')][_0x2dd5f4][_0x999e('0x3a')]('complete');}});return _0x549ad4({'code':0xc8,'message':_0xa44e4c});}else{logger[_0x999e('0x3b')]('No\x20applications\x20to\x20execute');return _0x549ad4({'code':0xc8,'message':_0xa44e4c});}}catch(_0x4caf56){logger[_0x999e('0x34')](_0x4caf56['stack']);return _0x1eee64(_0x539598['error'](0x1f4,_0x4caf56));}}return _0x1eee64('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4f904e){var _0xc89b1=this;return new Promise(function(_0x2841f7,_0x5e50f5){if(_0x4f904e[_0x999e('0x3c')]&&_0x4f904e[_0x999e('0x3c')]['id']){if(_0x387924[_0x999e('0x3d')][_0x4f904e['agent']['id']]){_0x387924['agents'][_0x4f904e[_0x999e('0x3c')]['id']][_0x999e('0x3e')]=![];_0x387924[_0x999e('0x3d')][_0x4f904e['agent']['id']]['busyQueue']=undefined;}}if(_0x4f904e['message']&&_0x4f904e['message']['id']){try{var _0x8f1afa=getId(_0x4f904e['channel'],_0x4f904e['message']?_0x4f904e[_0x999e('0x15')]['id']:0x0,_0x4f904e[_0x999e('0x3f')]?_0x4f904e['interaction']['id']:0x0);if(_0x387924[_0x999e('0x13')][_0x8f1afa]){_0x387924[_0x999e('0x13')][_0x8f1afa]['emit'](_0x999e('0x40'));if(rpc[_0x4f904e['channel']+_0x999e('0x41')]){rpc[_0x4f904e[_0x999e('0x14')]+'QueueReport'][_0x999e('0x42')](_0x8f1afa,{'UserId':_0x4f904e[_0x999e('0x15')]['UserId']})['catch'](function(){logger[_0x999e('0x34')]('error\x20update\x20queue\x20report');});}}return _0x2841f7({'code':0xc8,'message':_0x4f904e});}catch(_0x5ebc95){logger['error'](_0x5ebc95[_0x999e('0x43')]);return _0x5e50f5(_0xc89b1[_0x999e('0x34')](0x1f4,_0x5ebc95));}}logger[_0x999e('0x34')](_0x999e('0x44'));return _0x5e50f5(_0xc89b1[_0x999e('0x34')](0x1f4,_0x999e('0x44')));});},'RejectMessage':function(_0x5b2645){var _0x14f8de=this;return new Promise(function(_0x2317c5,_0x4f1347){if(_0x5b2645[_0x999e('0x3c')]&&_0x5b2645[_0x999e('0x3c')]['id']){try{if(_0x387924[_0x999e('0x3d')][_0x5b2645[_0x999e('0x3c')]['id']]){_0x387924[_0x999e('0x3d')][_0x5b2645[_0x999e('0x3c')]['id']][_0x999e('0x3e')]=![];_0x387924[_0x999e('0x3d')][_0x5b2645[_0x999e('0x3c')]['id']]['busyQueue']=undefined;}return _0x2317c5({'code':0xc8,'message':_0x5b2645});}catch(_0x9f3f7a){logger[_0x999e('0x34')](_0x9f3f7a[_0x999e('0x43')]);return _0x4f1347(_0x14f8de[_0x999e('0x34')](0x1f4,_0x9f3f7a));}}logger['error'](_0x999e('0x44'));return _0x4f1347(_0x14f8de[_0x999e('0x34')](0x1f4,_0x999e('0x44')));});},'AbandonInteraction':function(_0x291b73){var _0x3e475b=this;return new Promise(function(_0xdb368f,_0x3f5790){if(_0x291b73[_0x999e('0x14')]&&_0x291b73['interaction']&&_0x291b73['interaction']['id']){try{var _0xd118f9=getId(_0x291b73[_0x999e('0x14')],_0x291b73[_0x999e('0x15')]?_0x291b73[_0x999e('0x15')]['id']:0x0,_0x291b73[_0x999e('0x3f')]?_0x291b73[_0x999e('0x3f')]['id']:0x0);if(_0x387924[_0x999e('0x13')][_0xd118f9]){_0x387924['rules'][_0xd118f9]['emit'](_0x999e('0x40'));}return _0xdb368f({'code':0xc8,'message':_0x291b73});}catch(_0x55ae5){logger[_0x999e('0x34')](_0x55ae5[_0x999e('0x43')]);return _0x3f5790(_0x3e475b[_0x999e('0x34')](0x1f4,_0x55ae5));}}logger['error'](_0x999e('0x44'));return _0x3f5790(_0x3e475b[_0x999e('0x34')](0x1f4,_0x999e('0x44')));});},'AgentCapacity':function(_0x3c8ecf){var _0x502c9=this;return new Promise(function(_0x434e13,_0x2b4bbe){if(_0x387924['agents'][_0x999e('0x45')](_0x3c8ecf['id'])){for(var _0x521b7a in _0x3c8ecf[_0x999e('0x46')]){if(_0x3c8ecf[_0x999e('0x46')][_0x999e('0x45')](_0x521b7a)){if(_0x387924[_0x999e('0x3d')][_0x3c8ecf['id']][_0x999e('0x45')](_0x521b7a+_0x999e('0x47'))){_0x387924['agents'][_0x3c8ecf['id']][_0x521b7a+_0x999e('0x47')]=parseInt(_0x3c8ecf[_0x999e('0x46')][_0x521b7a],0xa);}}}_0x387924[_0x999e('0x3d')][_0x3c8ecf['id']][_0x999e('0x48')]();return _0x434e13({'code':0xc8,'message':_0x387924[_0x999e('0x3d')][_0x3c8ecf['id']]});}else{return _0x2b4bbe(_0x502c9[_0x999e('0x34')](0x1f4,_0x999e('0x49')));}});},'Agents':function(_0x3d398c){return new Promise(function(_0x455b0e){var _0x7f9dfe=_[_0x999e('0x4a')](_0x387924[_0x999e('0x3d')]);if(_0x3d398c&&_0x3d398c['id']){var _0x77a387=_[_0x999e('0x4b')](_0x7f9dfe,function(_0x26aaeb){return _0x26aaeb['id']===_0x3d398c['id'];});_0x455b0e(_0x77a387);}else{_0x455b0e({'count':_0x7f9dfe['length'],'rows':_0x7f9dfe});}});},'ChatQueues':function(){return new Promise(function(_0x425639){var _0x157c1f=[];for(var _0x296d59 in _0x387924[_0x999e('0x4c')]){if(_0x387924['chatQueues']['hasOwnProperty'](_0x296d59)){var _0x21c8be=_0x387924[_0x999e('0x4c')][_0x296d59];var _0x67267d={'id':_0x21c8be['id'],'available':_0x21c8be[_0x999e('0x4d')],'loggedIn':_0x21c8be[_0x999e('0x4e')],'name':_0x21c8be[_0x999e('0x4f')],'paused':_0x21c8be[_0x999e('0x50')],'waiting':_0x21c8be[_0x999e('0x51')]};_0x157c1f[_0x999e('0x20')](_0x67267d);}}_0x425639({'count':_0x157c1f['length'],'rows':_0x157c1f});});},'MailQueues':function(){return new Promise(function(_0xe137c1){var _0x47c693=[];for(var _0x184b3e in _0x387924[_0x999e('0x52')]){if(_0x387924['mailQueues'][_0x999e('0x45')](_0x184b3e)){var _0x175904=_0x387924[_0x999e('0x52')][_0x184b3e];var _0xcbe77a={'id':_0x175904['id'],'available':_0x175904[_0x999e('0x4d')],'loggedIn':_0x175904['loggedIn'],'name':_0x175904[_0x999e('0x4f')],'paused':_0x175904[_0x999e('0x50')],'waiting':_0x175904['waiting']};_0x47c693['push'](_0xcbe77a);}}_0xe137c1({'count':_0x47c693['length'],'rows':_0x47c693});});},'OpenchannelQueues':function(){return new Promise(function(_0x43ec04){var _0x3f37e8=[];for(var _0x3432fd in _0x387924[_0x999e('0x53')]){if(_0x387924[_0x999e('0x53')]['hasOwnProperty'](_0x3432fd)){var _0x492a5a=_0x387924['openchannelQueues'][_0x3432fd];var _0x49293d={'id':_0x492a5a['id'],'available':_0x492a5a['available'],'loggedIn':_0x492a5a['loggedIn'],'name':_0x492a5a[_0x999e('0x4f')],'paused':_0x492a5a['paused'],'waiting':_0x492a5a[_0x999e('0x51')]};_0x3f37e8[_0x999e('0x20')](_0x49293d);}}_0x43ec04({'count':_0x3f37e8[_0x999e('0x18')],'rows':_0x3f37e8});});},'SmsQueues':function(){return new Promise(function(_0x5b8a0d){var _0x3ca455=[];for(var _0x3c2bce in _0x387924[_0x999e('0x54')]){if(_0x387924[_0x999e('0x54')][_0x999e('0x45')](_0x3c2bce)){var _0x129c3c=_0x387924[_0x999e('0x54')][_0x3c2bce];var _0x525800={'id':_0x129c3c['id'],'available':_0x129c3c[_0x999e('0x4d')],'loggedIn':_0x129c3c[_0x999e('0x4e')],'name':_0x129c3c[_0x999e('0x4f')],'paused':_0x129c3c['paused'],'waiting':_0x129c3c[_0x999e('0x51')]};_0x3ca455[_0x999e('0x20')](_0x525800);}}_0x5b8a0d({'count':_0x3ca455['length'],'rows':_0x3ca455});});},'FaxQueues':function(){return new Promise(function(_0x2f893b){var _0x67c96d=[];for(var _0x3a404d in _0x387924[_0x999e('0x55')]){if(_0x387924[_0x999e('0x55')][_0x999e('0x45')](_0x3a404d)){var _0x42f36f=_0x387924[_0x999e('0x55')][_0x3a404d];var _0x127812={'id':_0x42f36f['id'],'available':_0x42f36f['available'],'loggedIn':_0x42f36f[_0x999e('0x4e')],'name':_0x42f36f[_0x999e('0x4f')],'paused':_0x42f36f[_0x999e('0x50')],'waiting':_0x42f36f['waiting']};_0x67c96d[_0x999e('0x20')](_0x127812);}}_0x2f893b({'count':_0x67c96d['length'],'rows':_0x67c96d});});},'WhatsappQueues':function(){return new Promise(function(_0x14f13a){var _0x115be6=[];for(var _0x3a7596 in _0x387924['whatsappQueues']){if(_0x387924[_0x999e('0x56')][_0x999e('0x45')](_0x3a7596)){var _0x1d6b40=_0x387924[_0x999e('0x56')][_0x3a7596];var _0x436bc5={'id':_0x1d6b40['id'],'available':_0x1d6b40[_0x999e('0x4d')],'loggedIn':_0x1d6b40['loggedIn'],'name':_0x1d6b40[_0x999e('0x4f')],'paused':_0x1d6b40['paused'],'waiting':_0x1d6b40[_0x999e('0x51')]};_0x115be6['push'](_0x436bc5);}}_0x14f13a({'count':_0x115be6['length'],'rows':_0x115be6});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3ef0c0){var _0x5d136c=_[_0x999e('0x4a')](_0x387924[_0x999e('0x57')]);_0x3ef0c0({'count':_0x5d136c['length'],'rows':_0x5d136c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x15c83f){var _0x2d064e=_['values'](_0x387924[_0x999e('0x58')]);_0x15c83f({'count':_0x2d064e[_0x999e('0x18')],'rows':_0x2d064e});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x17a764){var _0x224242=_[_0x999e('0x4a')](_0x387924[_0x999e('0x59')]);_0x17a764({'count':_0x224242[_0x999e('0x18')],'rows':_0x224242});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x25b243){var _0x5cdf6d=_['values'](_0x387924[_0x999e('0x5a')]);_0x25b243({'count':_0x5cdf6d[_0x999e('0x18')],'rows':_0x5cdf6d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x33acf9){var _0x1fad9f=_[_0x999e('0x4a')](_0x387924[_0x999e('0x5b')]);_0x33acf9({'count':_0x1fad9f['length'],'rows':_0x1fad9f});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x368336){var _0x19cb19=_['values'](_0x387924[_0x999e('0x5c')]);_0x368336({'count':_0x19cb19[_0x999e('0x18')],'rows':_0x19cb19});});}};var _0x40d407=jayson['server'](_0x4d1716)[_0x999e('0x5d')]();_0x40d407['on'](_0x999e('0x34'),function(_0x328c2d){logger['error'](JSON[_0x999e('0x38')](_0x328c2d));return _0x28bdd1(_0x328c2d);});_0x40d407[_0x999e('0x12')](0x232c,_0x999e('0x5e'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x538a92(_0x999e('0x5f')+0x232c);});});}; \ No newline at end of file +var _0xc368=['message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','mail','push','slice','dialogflow','appdata','dialogflowv2','split','amazonlex','tag','TagId','tvox','account','ChatWebsiteId','ContactId','body','%s:%s:%s','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','stack'];(function(_0x493dda,_0x1528d3){var _0x31a5a6=function(_0x43c676){while(--_0x43c676){_0x493dda['push'](_0x493dda['shift']());}};_0x31a5a6(++_0x1528d3);}(_0xc368,0x7b));var _0x8c36=function(_0x3525de,_0x4bf473){_0x3525de=_0x3525de-0x0;var _0x26101c=_0xc368[_0x3525de];return _0x26101c;};'use strict';var _=require('lodash');var util=require(_0x8c36('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0x8c36('0x1'));var BPromise=require(_0x8c36('0x2'));var utils=require(_0x8c36('0x3'));var logger=require(_0x8c36('0x4'))(_0x8c36('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x8c36('0x6')),'chatQueueReport':require(_0x8c36('0x7')),'smsQueueReport':require(_0x8c36('0x8')),'faxQueueReport':require(_0x8c36('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x8ed437,_0x384867,_0x3e76be){return util[_0x8c36('0xa')](_0x8c36('0xb'),_0x8ed437,_0x384867||0x0,_0x3e76be||0x0);}function getIntervals(_0x207021,_0x569f29){var _0x5bfbdd=[];if(!_['isNil'](_0x569f29[_0x8c36('0xc')])&&!_[_0x8c36('0xd')](_0x207021[_0x569f29['IntervalId']])&&!_[_0x8c36('0xd')](_0x207021[_0x569f29[_0x8c36('0xc')]][_0x8c36('0xe')])){_0x5bfbdd=_[_0x8c36('0xf')](_0x207021[_0x569f29[_0x8c36('0xc')]][_0x8c36('0xe')],_0x8c36('0x10'));}else if(!_[_0x8c36('0xd')](_0x569f29[_0x8c36('0x10')])){_0x5bfbdd=[_0x569f29[_0x8c36('0x10')]];}return _0x5bfbdd;}exports[_0x8c36('0x11')]=function(_0x25a83e){_0x25a83e[_0x8c36('0x12')]={};return new BPromise(function(_0x220f18,_0x5dfcd5){var _0x31d8bf={'Start':function(_0x5e32ad){var _0xea7509=this;return new Promise(function(_0x3f83aa,_0x29e791){if(_0x5e32ad){try{var _0x1fc68e=[];var _0xcfdbf7=getId(_0x5e32ad[_0x8c36('0x13')],_0x5e32ad[_0x8c36('0x14')]?_0x5e32ad[_0x8c36('0x14')]['id']:0x0,_0x5e32ad[_0x8c36('0x15')]?_0x5e32ad['interaction']['id']:0x0);if(_0x5e32ad[_0x8c36('0x16')]&&_[_0x8c36('0x17')](_0x5e32ad[_0x8c36('0x16')])&&_0x5e32ad[_0x8c36('0x16')][_0x8c36('0x18')]){for(var _0x5e5162=0x0;_0x5e5162<_0x5e32ad[_0x8c36('0x16')][_0x8c36('0x18')];_0x5e5162+=0x1){var _0x2ac843=_0x5e32ad[_0x8c36('0x16')][_0x5e5162];if(fs[_0x8c36('0x19')](path[_0x8c36('0x1a')](__dirname,_0x8c36('0x16'),_0x2ac843[_0x8c36('0x1b')]+_0x8c36('0x1c')))){var _0x474c5d=[];switch(_0x2ac843[_0x8c36('0x1b')][_0x8c36('0x1d')]()){case _0x8c36('0x1e'):var _0x51fd6c=_0x2ac843['appdata']['split'](',');if(_0x5e32ad['channel']===_0x8c36('0x1f')){_0x474c5d[_0x8c36('0x20')](_0x51fd6c[0x0]);_0x474c5d[_0x8c36('0x20')](_0x51fd6c[0x1]);_0x474c5d[_0x8c36('0x20')](_0x51fd6c[_0x8c36('0x21')](0x2,_0x51fd6c[_0x8c36('0x18')])['join'](','));}else{_0x474c5d[_0x8c36('0x20')](_0x51fd6c[0x0]);_0x474c5d['push'](_0x51fd6c[_0x8c36('0x21')](0x1,_0x51fd6c['length'])[_0x8c36('0x1a')](','));}break;case _0x8c36('0x22'):var _0x271ec4=_0x2ac843[_0x8c36('0x23')]['split'](',');_0x474c5d['push'](_0x271ec4[0x0]);_0x474c5d[_0x8c36('0x20')](_0x271ec4[0x1]);_0x474c5d[_0x8c36('0x20')](_0x271ec4['slice'](0x2,_0x271ec4['length'])[_0x8c36('0x1a')](','));break;case _0x8c36('0x24'):var _0x502fa3=_0x2ac843[_0x8c36('0x23')][_0x8c36('0x25')](',');_0x474c5d[_0x8c36('0x20')](_0x502fa3[0x0]);_0x474c5d['push'](_0x502fa3[0x1]);_0x474c5d['push'](_0x502fa3[0x2]);_0x474c5d[_0x8c36('0x20')](_0x502fa3[0x3]);_0x474c5d[_0x8c36('0x20')](_0x502fa3[_0x8c36('0x21')](0x4,_0x502fa3[_0x8c36('0x18')])[_0x8c36('0x1a')](','));break;case _0x8c36('0x26'):var _0x387e66=_0x2ac843[_0x8c36('0x23')][_0x8c36('0x25')](',');_0x474c5d[_0x8c36('0x20')](_0x387e66[0x0]);_0x474c5d[_0x8c36('0x20')](_0x387e66[0x1]);_0x474c5d[_0x8c36('0x20')](_0x387e66[0x2]);_0x474c5d[_0x8c36('0x20')](_0x387e66[0x3]);_0x474c5d[_0x8c36('0x20')](_0x387e66[_0x8c36('0x21')](0x4,_0x387e66[_0x8c36('0x18')])[_0x8c36('0x1a')](','));break;case'message':_0x474c5d['push'](_0x2ac843['appdata']);break;case _0x8c36('0x27'):_0x474c5d[_0x8c36('0x20')](_0x2ac843[_0x8c36('0x28')]);_0x474c5d[_0x8c36('0x20')](_0x2ac843[_0x8c36('0x23')]);break;case _0x8c36('0x29'):var _0xc3f5b4=utils['getMustacheRender'](_0x5e32ad[_0x8c36('0x2a')]['notificationTemplate'],_0x5e32ad);var _0x3def90=_0x2ac843['appdata'][_0x8c36('0x25')](',');_0x474c5d[_0x8c36('0x20')](_0x3def90[0x0]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x1]);_0x474c5d['push'](_0x3def90[0x2]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x3]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x4]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x5]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x6]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x7]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x8]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x9]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0xa]);_0x474c5d[_0x8c36('0x20')](_0x5e32ad[_0x8c36('0x15')]['id']);_0x474c5d[_0x8c36('0x20')](_0x5e32ad[_0x8c36('0x14')]['id']);_0x474c5d[_0x8c36('0x20')](_0x2ac843[_0x8c36('0x2b')]);_0x474c5d[_0x8c36('0x20')](_0x5e32ad[_0x8c36('0x15')][_0x8c36('0x2c')]);_0x474c5d['push'](_0x5e32ad[_0x8c36('0x2d')]['body']);_0x474c5d[_0x8c36('0x20')](_0xc3f5b4);break;default:_0x474c5d=_[_0x8c36('0xd')](_0x2ac843[_0x8c36('0x23')])?[]:_0x2ac843[_0x8c36('0x23')]['split'](',');}var _0x5a50d6={'id':util[_0x8c36('0xa')](_0x8c36('0x2e'),_0xcfdbf7,_0x2ac843['id'],_0x2ac843[_0x8c36('0x1b')]),'condition':require('./interval')['condition'](_0xcfdbf7,getIntervals(_0x25a83e[_0x8c36('0x2f')],_0x2ac843),_0x25a83e),'consequence':require('./applications/'+_0x2ac843['app'])[_0x8c36('0x30')](_0xcfdbf7,_0x474c5d,_0x25a83e,_0x5e32ad),'p':_0x2ac843[_0x8c36('0x31')]||0x0};logger[_0x8c36('0x32')](_0x8c36('0x33'),_0x5a50d6['id'],_0x8c36('0x34'),getIntervals(_0x25a83e[_0x8c36('0x2f')],_0x2ac843)[_0x8c36('0x1a')](_0x8c36('0x35')));_0x1fc68e[_0x8c36('0x20')](_0x5a50d6);}else{logger[_0x8c36('0x36')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x8c36('0x1a')](__dirname,_0x8c36('0x16'),_0x2ac843[_0x8c36('0x1b')]+_0x8c36('0x1c')));}}_0x25a83e[_0x8c36('0x12')][_0xcfdbf7]=new RuleEngine(_0x1fc68e);_0x25a83e['rules'][_0xcfdbf7][_0x8c36('0x37')](_0x5e32ad,function(_0x3dde7b){logger[_0x8c36('0x32')](_0x8c36('0x38'),JSON[_0x8c36('0x39')](_0x3dde7b[_0x8c36('0x3a')]));if(_0x25a83e['rules'][_0xcfdbf7]){_0x25a83e[_0x8c36('0x12')][_0xcfdbf7][_0x8c36('0x3b')](_0x8c36('0x3c'));}});return _0x3f83aa({'code':0xc8,'message':_0x5e32ad});}else{logger[_0x8c36('0x32')](_0x8c36('0x3d'));return _0x3f83aa({'code':0xc8,'message':_0x5e32ad});}}catch(_0x393fd0){logger[_0x8c36('0x36')](_0x393fd0['stack']);return _0x29e791(_0xea7509[_0x8c36('0x36')](0x1f4,_0x393fd0));}}return _0x29e791(_0x8c36('0x3e'));});},'AcceptMessage':function(_0x9d2165){var _0x35fef3=this;return new Promise(function(_0x2b3e58,_0x381060){if(_0x9d2165[_0x8c36('0x3f')]&&_0x9d2165[_0x8c36('0x3f')]['id']){if(_0x25a83e[_0x8c36('0x40')][_0x9d2165[_0x8c36('0x3f')]['id']]){_0x25a83e[_0x8c36('0x40')][_0x9d2165[_0x8c36('0x3f')]['id']]['busy']=![];_0x25a83e['agents'][_0x9d2165[_0x8c36('0x3f')]['id']][_0x8c36('0x41')]=undefined;}}if(_0x9d2165[_0x8c36('0x14')]&&_0x9d2165[_0x8c36('0x14')]['id']){try{var _0x5ea64d=getId(_0x9d2165[_0x8c36('0x13')],_0x9d2165[_0x8c36('0x14')]?_0x9d2165['message']['id']:0x0,_0x9d2165['interaction']?_0x9d2165['interaction']['id']:0x0);if(_0x25a83e[_0x8c36('0x12')][_0x5ea64d]){_0x25a83e[_0x8c36('0x12')][_0x5ea64d][_0x8c36('0x3b')](_0x8c36('0x42'));if(rpc[_0x9d2165[_0x8c36('0x13')]+_0x8c36('0x43')]){rpc[_0x9d2165['channel']+_0x8c36('0x43')][_0x8c36('0x44')](_0x5ea64d,{'UserId':_0x9d2165[_0x8c36('0x14')][_0x8c36('0x45')]})['catch'](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x2b3e58({'code':0xc8,'message':_0x9d2165});}catch(_0x3887e4){logger[_0x8c36('0x36')](_0x3887e4[_0x8c36('0x46')]);return _0x381060(_0x35fef3[_0x8c36('0x36')](0x1f4,_0x3887e4));}}logger[_0x8c36('0x36')](_0x8c36('0x47'));return _0x381060(_0x35fef3[_0x8c36('0x36')](0x1f4,_0x8c36('0x47')));});},'RejectMessage':function(_0x2c9d63){var _0x4e0635=this;return new Promise(function(_0x4cba50,_0x41a120){if(_0x2c9d63['agent']&&_0x2c9d63['agent']['id']){try{if(_0x25a83e[_0x8c36('0x40')][_0x2c9d63['agent']['id']]){_0x25a83e[_0x8c36('0x40')][_0x2c9d63[_0x8c36('0x3f')]['id']]['busy']=![];_0x25a83e[_0x8c36('0x40')][_0x2c9d63['agent']['id']][_0x8c36('0x41')]=undefined;}return _0x4cba50({'code':0xc8,'message':_0x2c9d63});}catch(_0x25ebcc){logger[_0x8c36('0x36')](_0x25ebcc['stack']);return _0x41a120(_0x4e0635[_0x8c36('0x36')](0x1f4,_0x25ebcc));}}logger[_0x8c36('0x36')](_0x8c36('0x47'));return _0x41a120(_0x4e0635[_0x8c36('0x36')](0x1f4,_0x8c36('0x47')));});},'AbandonInteraction':function(_0x1505f3){var _0x242d1a=this;return new Promise(function(_0x5905c0,_0x20f1d9){if(_0x1505f3['channel']&&_0x1505f3['interaction']&&_0x1505f3['interaction']['id']){try{var _0x20c1b0=getId(_0x1505f3['channel'],_0x1505f3['message']?_0x1505f3[_0x8c36('0x14')]['id']:0x0,_0x1505f3[_0x8c36('0x15')]?_0x1505f3[_0x8c36('0x15')]['id']:0x0);if(_0x25a83e[_0x8c36('0x12')][_0x20c1b0]){_0x25a83e[_0x8c36('0x12')][_0x20c1b0]['emit']('end');}return _0x5905c0({'code':0xc8,'message':_0x1505f3});}catch(_0x54c675){logger[_0x8c36('0x36')](_0x54c675[_0x8c36('0x46')]);return _0x20f1d9(_0x242d1a['error'](0x1f4,_0x54c675));}}logger[_0x8c36('0x36')](_0x8c36('0x47'));return _0x20f1d9(_0x242d1a[_0x8c36('0x36')](0x1f4,_0x8c36('0x47')));});},'AgentCapacity':function(_0x32871e){var _0x1094f9=this;return new Promise(function(_0x1c0669,_0x273325){if(_0x25a83e[_0x8c36('0x40')]['hasOwnProperty'](_0x32871e['id'])){for(var _0x529453 in _0x32871e['capacity']){if(_0x32871e[_0x8c36('0x48')][_0x8c36('0x49')](_0x529453)){if(_0x25a83e[_0x8c36('0x40')][_0x32871e['id']][_0x8c36('0x49')](_0x529453+_0x8c36('0x4a'))){_0x25a83e[_0x8c36('0x40')][_0x32871e['id']][_0x529453+'CurrentCapacity']=parseInt(_0x32871e[_0x8c36('0x48')][_0x529453],0xa);}}}_0x25a83e['agents'][_0x32871e['id']][_0x8c36('0x4b')]();return _0x1c0669({'code':0xc8,'message':_0x25a83e[_0x8c36('0x40')][_0x32871e['id']]});}else{return _0x273325(_0x1094f9[_0x8c36('0x36')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xe59f9b){return new Promise(function(_0x51c797){var _0x11acb3=_[_0x8c36('0x4c')](_0x25a83e[_0x8c36('0x40')]);if(_0xe59f9b&&_0xe59f9b['id']){var _0xaa4cea=_[_0x8c36('0x4d')](_0x11acb3,function(_0x51e103){return _0x51e103['id']===_0xe59f9b['id'];});_0x51c797(_0xaa4cea);}else{_0x51c797({'count':_0x11acb3[_0x8c36('0x18')],'rows':_0x11acb3});}});},'ChatQueues':function(){return new Promise(function(_0x4c9a41){var _0x39ab18=[];for(var _0x461290 in _0x25a83e['chatQueues']){if(_0x25a83e[_0x8c36('0x4e')][_0x8c36('0x49')](_0x461290)){var _0x10dfc1=_0x25a83e['chatQueues'][_0x461290];var _0x244634={'id':_0x10dfc1['id'],'available':_0x10dfc1[_0x8c36('0x4f')],'loggedIn':_0x10dfc1[_0x8c36('0x50')],'name':_0x10dfc1[_0x8c36('0x51')],'paused':_0x10dfc1['paused'],'waiting':_0x10dfc1[_0x8c36('0x52')]};_0x39ab18[_0x8c36('0x20')](_0x244634);}}_0x4c9a41({'count':_0x39ab18['length'],'rows':_0x39ab18});});},'MailQueues':function(){return new Promise(function(_0xff22f0){var _0x1bfe8c=[];for(var _0x73b4cc in _0x25a83e['mailQueues']){if(_0x25a83e[_0x8c36('0x53')][_0x8c36('0x49')](_0x73b4cc)){var _0x4e5c82=_0x25a83e[_0x8c36('0x53')][_0x73b4cc];var _0x251a43={'id':_0x4e5c82['id'],'available':_0x4e5c82[_0x8c36('0x4f')],'loggedIn':_0x4e5c82[_0x8c36('0x50')],'name':_0x4e5c82['name'],'paused':_0x4e5c82[_0x8c36('0x54')],'waiting':_0x4e5c82['waiting']};_0x1bfe8c[_0x8c36('0x20')](_0x251a43);}}_0xff22f0({'count':_0x1bfe8c[_0x8c36('0x18')],'rows':_0x1bfe8c});});},'OpenchannelQueues':function(){return new Promise(function(_0x5a820a){var _0x27b88d=[];for(var _0x1c3934 in _0x25a83e[_0x8c36('0x55')]){if(_0x25a83e[_0x8c36('0x55')][_0x8c36('0x49')](_0x1c3934)){var _0x3465f8=_0x25a83e[_0x8c36('0x55')][_0x1c3934];var _0x3471d0={'id':_0x3465f8['id'],'available':_0x3465f8['available'],'loggedIn':_0x3465f8[_0x8c36('0x50')],'name':_0x3465f8[_0x8c36('0x51')],'paused':_0x3465f8[_0x8c36('0x54')],'waiting':_0x3465f8['waiting']};_0x27b88d[_0x8c36('0x20')](_0x3471d0);}}_0x5a820a({'count':_0x27b88d[_0x8c36('0x18')],'rows':_0x27b88d});});},'SmsQueues':function(){return new Promise(function(_0x1554bc){var _0x287d7f=[];for(var _0x12f486 in _0x25a83e['smsQueues']){if(_0x25a83e[_0x8c36('0x56')][_0x8c36('0x49')](_0x12f486)){var _0x7f1a0f=_0x25a83e['smsQueues'][_0x12f486];var _0x29581d={'id':_0x7f1a0f['id'],'available':_0x7f1a0f[_0x8c36('0x4f')],'loggedIn':_0x7f1a0f[_0x8c36('0x50')],'name':_0x7f1a0f[_0x8c36('0x51')],'paused':_0x7f1a0f[_0x8c36('0x54')],'waiting':_0x7f1a0f['waiting']};_0x287d7f[_0x8c36('0x20')](_0x29581d);}}_0x1554bc({'count':_0x287d7f[_0x8c36('0x18')],'rows':_0x287d7f});});},'FaxQueues':function(){return new Promise(function(_0x3378cc){var _0x4ac7f2=[];for(var _0x2599fc in _0x25a83e[_0x8c36('0x57')]){if(_0x25a83e[_0x8c36('0x57')][_0x8c36('0x49')](_0x2599fc)){var _0x2cd946=_0x25a83e[_0x8c36('0x57')][_0x2599fc];var _0x37bc24={'id':_0x2cd946['id'],'available':_0x2cd946['available'],'loggedIn':_0x2cd946['loggedIn'],'name':_0x2cd946['name'],'paused':_0x2cd946[_0x8c36('0x54')],'waiting':_0x2cd946[_0x8c36('0x52')]};_0x4ac7f2[_0x8c36('0x20')](_0x37bc24);}}_0x3378cc({'count':_0x4ac7f2[_0x8c36('0x18')],'rows':_0x4ac7f2});});},'WhatsappQueues':function(){return new Promise(function(_0x3a7a7f){var _0x3a08ed=[];for(var _0x10f392 in _0x25a83e[_0x8c36('0x58')]){if(_0x25a83e[_0x8c36('0x58')][_0x8c36('0x49')](_0x10f392)){var _0x108f6c=_0x25a83e[_0x8c36('0x58')][_0x10f392];var _0x124d9e={'id':_0x108f6c['id'],'available':_0x108f6c[_0x8c36('0x4f')],'loggedIn':_0x108f6c[_0x8c36('0x50')],'name':_0x108f6c[_0x8c36('0x51')],'paused':_0x108f6c[_0x8c36('0x54')],'waiting':_0x108f6c[_0x8c36('0x52')]};_0x3a08ed['push'](_0x124d9e);}}_0x3a7a7f({'count':_0x3a08ed[_0x8c36('0x18')],'rows':_0x3a08ed});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4db694){var _0x4b141c=_[_0x8c36('0x4c')](_0x25a83e['chatQueuesWaitingInteractions']);_0x4db694({'count':_0x4b141c[_0x8c36('0x18')],'rows':_0x4b141c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x28fe7f){var _0x100187=_[_0x8c36('0x4c')](_0x25a83e[_0x8c36('0x59')]);_0x28fe7f({'count':_0x100187[_0x8c36('0x18')],'rows':_0x100187});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xf6760b){var _0x5e13de=_['values'](_0x25a83e[_0x8c36('0x5a')]);_0xf6760b({'count':_0x5e13de[_0x8c36('0x18')],'rows':_0x5e13de});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x5a2043){var _0x10b687=_[_0x8c36('0x4c')](_0x25a83e[_0x8c36('0x5b')]);_0x5a2043({'count':_0x10b687[_0x8c36('0x18')],'rows':_0x10b687});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x49c9af){var _0x35b2b4=_[_0x8c36('0x4c')](_0x25a83e[_0x8c36('0x5c')]);_0x49c9af({'count':_0x35b2b4[_0x8c36('0x18')],'rows':_0x35b2b4});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x429065){var _0x431a8e=_['values'](_0x25a83e[_0x8c36('0x5d')]);_0x429065({'count':_0x431a8e[_0x8c36('0x18')],'rows':_0x431a8e});});}};var _0x1fffd9=jayson[_0x8c36('0x5e')](_0x31d8bf)[_0x8c36('0x5f')]();_0x1fffd9['on'](_0x8c36('0x36'),function(_0x257c2a){logger[_0x8c36('0x36')](JSON[_0x8c36('0x39')](_0x257c2a));return _0x5dfcd5(_0x257c2a);});_0x1fffd9[_0x8c36('0x11')](0x232c,'127.0.0.1',function(){console['log'](_0x8c36('0x60'),0x232c);return _0x220f18('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3b24f0b..eab4294 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 _0x29e3=['Command','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util','bluebird','lodash','../../../config/logger','client','request','then','error','message','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push'];(function(_0x29279c,_0x570176){var _0x279b1f=function(_0xd36d1f){while(--_0xd36d1f){_0x29279c['push'](_0x29279c['shift']());}};_0x279b1f(++_0x570176);}(_0x29e3,0x124));var _0x329e=function(_0x32d25a,_0x559790){_0x32d25a=_0x32d25a-0x0;var _0x316a8d=_0x29e3[_0x32d25a];return _0x316a8d;};'use strict';var util=require(_0x329e('0x0'));var BPromise=require(_0x329e('0x1'));var jayson=require('jayson/promise');var _=require(_0x329e('0x2'));var logger=require(_0x329e('0x3'))('routing');var client=jayson[_0x329e('0x4')]['http']({'port':0x232a});function request(_0x13ead9,_0x1c5f70){return new BPromise(function(_0x11933f,_0x4e65a5){return client[_0x329e('0x5')](_0x13ead9,_0x1c5f70)[_0x329e('0x6')](function(_0x4cb561){if(_0x4cb561[_0x329e('0x7')]){return _0x4e65a5(_0x4cb561[_0x329e('0x7')][_0x329e('0x8')]);}else{return _0x11933f(_0x4cb561['result']);}})[_0x329e('0x9')](function(_0xa3497d){return _0x4e65a5(_0xa3497d);});});}exports[_0x329e('0xa')]=function(_0x39502d,_0x2e2282,_0x2b2147){return function(_0x344639){if(_0x2b2147[_0x329e('0xb')]&&!_0x2b2147[_0x329e('0xb')][_0x39502d]){logger['info'](_0x329e('0xc'),_0x39502d);return _0x344639[_0x329e('0xd')]();}var _0x1e2459=[];for(var _0x4508c6=0x0;_0x4508c6<_0x2e2282[_0x329e('0xe')];_0x4508c6+=0x1){_0x1e2459[_0x329e('0xf')](request(_0x329e('0x10'),{'command':util['format'](_0x329e('0x11'),_0x2e2282[_0x4508c6])})[_0x329e('0x6')](function(_0x2f7706){return _0x2f7706&&_0x2f7706[_0x329e('0x8')]&&_0x2f7706[_0x329e('0x8')][_0x329e('0x12')]('true')>=0x0?!![]:![];})[_0x329e('0x9')](function(_0x1173dd){logger[_0x329e('0x7')](_0x329e('0x13'),_0x39502d,_0x2e2282[_0x4508c6]);}));}BPromise[_0x329e('0x14')](_0x1e2459)['then'](function(_0x863b09){var _0x324ce3=_[_0x329e('0x15')](_0x863b09);logger[_0x329e('0x16')](_0x329e('0x17'),_0x39502d,_0x2e2282[_0x329e('0x18')](_0x329e('0x19')),_0x324ce3);_0x344639['when'](_0x324ce3);})[_0x329e('0x9')](function(_0x577cff){console[_0x329e('0x1a')](_0x577cff);logger['error'](_0x329e('0x17'),_0x39502d,_0x2e2282[_0x329e('0x18')](_0x329e('0x19')),_0x577cff[_0x329e('0x1b')]);_0x344639[_0x329e('0xd')]();});};}; \ No newline at end of file +var _0x014c=['stop','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','join','\x20|\x20','when','stack','bluebird','jayson/promise','../../../config/logger','routing','http','request','then','error','result','catch','rules'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x014c,0x120));var _0xc014=function(_0x4ea955,_0x1eda76){_0x4ea955=_0x4ea955-0x0;var _0x558561=_0x014c[_0x4ea955];return _0x558561;};'use strict';var util=require('util');var BPromise=require(_0xc014('0x0'));var jayson=require(_0xc014('0x1'));var _=require('lodash');var logger=require(_0xc014('0x2'))(_0xc014('0x3'));var client=jayson['client'][_0xc014('0x4')]({'port':0x232a});function request(_0x434b64,_0x20f75e){return new BPromise(function(_0x23fecb,_0x4cc177){return client[_0xc014('0x5')](_0x434b64,_0x20f75e)[_0xc014('0x6')](function(_0x4c897b){if(_0x4c897b['error']){return _0x4cc177(_0x4c897b[_0xc014('0x7')]['message']);}else{return _0x23fecb(_0x4c897b[_0xc014('0x8')]);}})[_0xc014('0x9')](function(_0x59ec3b){return _0x4cc177(_0x59ec3b);});});}exports['condition']=function(_0xce6616,_0x149a72,_0x2aef2d){return function(_0x833f37){if(_0x2aef2d[_0xc014('0xa')]&&!_0x2aef2d[_0xc014('0xa')][_0xce6616]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0xce6616);return _0x833f37[_0xc014('0xb')]();}var _0x254e75=[];for(var _0x28ee54=0x0;_0x28ee54<_0x149a72['length'];_0x28ee54+=0x1){_0x254e75['push'](request(_0xc014('0xc'),{'command':util[_0xc014('0xd')](_0xc014('0xe'),_0x149a72[_0x28ee54])})['then'](function(_0x5c2d0a){return _0x5c2d0a&&_0x5c2d0a['message']&&_0x5c2d0a['message'][_0xc014('0xf')](_0xc014('0x10'))>=0x0?!![]:![];})[_0xc014('0x9')](function(_0x48f3b5){logger['error'](_0xc014('0x11'),_0xce6616,_0x149a72[_0x28ee54]);}));}BPromise[_0xc014('0x12')](_0x254e75)['then'](function(_0x48356e){var _0x3ddc70=_['some'](_0x48356e);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0xce6616,_0x149a72[_0xc014('0x13')](_0xc014('0x14')),_0x3ddc70);_0x833f37[_0xc014('0x15')](_0x3ddc70);})[_0xc014('0x9')](function(_0x23ffcf){console['log'](_0x23ffcf);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0xce6616,_0x149a72['join'](_0xc014('0x14')),_0x23ffcf[_0xc014('0x16')]);_0x833f37['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index f56659b..059d3be 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 _0xb9a7=['connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','transfereeuniqueid','calleridname','agententerreason','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','format','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','ringtime','talktime','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','holdtime','[%s][agents][queuecallerabandon]','agentconnect','agentconnectAt','connectedlinename'];(function(_0x2b817f,_0x31f43b){var _0x4d19f0=function(_0x114c34){while(--_0x114c34){_0x2b817f['push'](_0x2b817f['shift']());}};_0x4d19f0(++_0x31f43b);}(_0xb9a7,0x112));var _0x7b9a=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xb9a7[_0x35885a];return _0xe86249;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x563857,_0x5f1a52){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x2'),_0x563857[_0x7b9a('0x3')],_0x563857[_0x7b9a('0x4')],_0x563857[_0x7b9a('0x5')],_0x563857[_0x7b9a('0x6')],_0x563857[_0x7b9a('0x7')],_0x563857[_0x7b9a('0x8')],_0x563857[_0x7b9a('0x9')],_0x563857[_0x7b9a('0xa')]));if(_0x563857[_0x7b9a('0x5')]){utils['getVoiceQueueByName'](_0x563857[_0x7b9a('0x5')])[_0x7b9a('0xb')](function(_0x56a199){if(_0x56a199){_0x563857['type']=_0x56a199['type'];_0x563857[_0x7b9a('0xc')]=_0x563857[_0x7b9a('0xd')]?_0x56a199['acw']:![];_0x563857[_0x7b9a('0xe')]=_0x563857['agentacw']?_0x56a199[_0x7b9a('0xf')]:0x0;}utils['request'](_0x7b9a('0x10'),_0x563857);});}else{utils[_0x7b9a('0x11')](_0x7b9a('0x10'),_0x563857);}if(_0x5f1a52){delete transfers[_0x563857['uniqueid']];}else{delete agents[_0x563857[_0x7b9a('0x12')]];}}exports[_0x7b9a('0x13')]=function(_0x5e3875){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentcalled]',_0x5e3875[_0x7b9a('0x3')]),_0x5e3875);agents[_0x5e3875[_0x7b9a('0x12')]]=_0x5e3875;agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x18');agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinenum']=null;agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinename']=null;utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x19'),_0x5e3875[_0x7b9a('0x3')],agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x6')],_0x5e3875[_0x7b9a('0x12')]));}catch(_0x283cc3){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x1b'),_0x5e3875[_0x7b9a('0x3')]),_0x283cc3);}};exports[_0x7b9a('0x1c')]=function(_0x58aed7){try{if(!_[_0x7b9a('0x1d')](agents[_0x58aed7['destuniqueid']])){utils[_0x7b9a('0x14')](util['format'](_0x7b9a('0x1e'),_0x58aed7[_0x7b9a('0x3')]),_0x58aed7);utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x1f'),_0x58aed7[_0x7b9a('0x3')],agents[_0x58aed7['destuniqueid']][_0x7b9a('0x6')],_0x58aed7[_0x7b9a('0x12')]));agents[_0x58aed7[_0x7b9a('0x12')]][_0x7b9a('0x1c')]=!![];agents[_0x58aed7[_0x7b9a('0x12')]]['agentringnoanswerAt']=utils[_0x7b9a('0x17')]();agents[_0x58aed7[_0x7b9a('0x12')]]['lastevent']=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']][_0x7b9a('0x21')]=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']]['holdtime']=_0x58aed7[_0x7b9a('0x22')]?parseInt(_0x58aed7['ringtime'])/0x3e8:0x0;agents[_0x58aed7['destuniqueid']][_0x7b9a('0x23')]=0x0;unanswered['push'](_0x58aed7['destuniqueid']);}}catch(_0x3847b4){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x1e'),_0x58aed7['uniqueid']),_0x3847b4);}};exports[_0x7b9a('0x24')]=function(_0x2e6144){try{_[_0x7b9a('0x25')](agents,function(_0x5b64d7,_0x45ccf5){if(_0x5b64d7[_0x7b9a('0x3')]==_0x2e6144[_0x7b9a('0x3')]&&!_[_0x7b9a('0x26')](unanswered,_0x5b64d7[_0x7b9a('0x12')])){utils[_0x7b9a('0x14')](util['format']('[%s][agents][queuecallerabandon]',_0x2e6144[_0x7b9a('0x3')]),_0x2e6144);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e6144[_0x7b9a('0x3')],_0x5b64d7[_0x7b9a('0x6')],_0x5b64d7['destuniqueid']));_0x5b64d7['agentringnoanswer']=!![];_0x5b64d7[_0x7b9a('0x27')]=utils[_0x7b9a('0x17')]();_0x5b64d7['lastevent']=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x21')]=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x29')]=_0x2e6144[_0x7b9a('0x29')];_0x5b64d7['talktime']=0x0;writeDB(_0x5b64d7);}});}catch(_0x46bcd0){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x2a'),_0x2e6144[_0x7b9a('0x3')]),_0x46bcd0);}};exports[_0x7b9a('0x2b')]=function(_0x5f1da4){try{if(agents[_0x5f1da4['destuniqueid']]){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]',_0x5f1da4[_0x7b9a('0x3')]),_0x5f1da4);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x5f1da4[_0x7b9a('0x3')],agents[_0x5f1da4[_0x7b9a('0x12')]]['membername'],_0x5f1da4['destuniqueid']));agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2c')]=utils[_0x7b9a('0x17')]();agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x9')]=_0x5f1da4[_0x7b9a('0x9')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2d')]=_0x5f1da4['connectedlinename'];agents[_0x5f1da4[_0x7b9a('0x12')]]['holdtime']=_0x5f1da4[_0x7b9a('0x22')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x2e');_[_0x7b9a('0x25')](agents,function(_0x89951b,_0x5e504f){if(_0x89951b[_0x7b9a('0x12')]!=_0x5f1da4[_0x7b9a('0x12')]&&_0x89951b[_0x7b9a('0x3')]==_0x5f1da4[_0x7b9a('0x3')]){_0x89951b['talktime']=0x0;_0x89951b[_0x7b9a('0x29')]=_0x5f1da4[_0x7b9a('0x22')];_0x89951b[_0x7b9a('0x1c')]=!![];_0x89951b[_0x7b9a('0x27')]=utils['now']();_0x89951b[_0x7b9a('0xa')]='answered_elsewhere';_0x89951b[_0x7b9a('0x21')]=_0x7b9a('0x2f');_0x89951b[_0x7b9a('0x30')]=_0x5f1da4[_0x7b9a('0x12')];_0x89951b[_0x7b9a('0x31')]=_0x5f1da4[_0x7b9a('0x6')];writeDB(_0x89951b);}});}}catch(_0x56e274){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x32'),_0x5f1da4['uniqueid']),_0x56e274);}};exports['agentcomplete']=function(_0x3724fe){try{if(!_[_0x7b9a('0x1d')](agents[_0x3724fe[_0x7b9a('0x12')]])){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe['uniqueid']),_0x3724fe);utils['info'](util['format'](_0x7b9a('0x34'),_0x3724fe[_0x7b9a('0x3')],agents[_0x3724fe['destuniqueid']][_0x7b9a('0x6')],_0x3724fe[_0x7b9a('0x12')]));agents[_0x3724fe[_0x7b9a('0x12')]]['agentcomplete']=!![];agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt']=utils[_0x7b9a('0x17')]();agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt'],agents[_0x3724fe[_0x7b9a('0x12')]]['agentconnectAt']);agents[_0x3724fe[_0x7b9a('0x12')]]['reason']=_0x3724fe['reason'];agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x36');writeDB(agents[_0x3724fe[_0x7b9a('0x12')]]);}}catch(_0x1cbd5a){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe[_0x7b9a('0x3')]),_0x1cbd5a);}};exports['blindtransfer']=function(_0x1d7957){try{if(!_[_0x7b9a('0x1d')](agents[_0x1d7957['transfereruniqueid']])){utils['debug'](util['format'](_0x7b9a('0x37'),_0x1d7957[_0x7b9a('0x3')]),_0x1d7957);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1d7957[_0x7b9a('0x3')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x6')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')]));agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x39')]=!![];agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x3b');agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3c')]=_0x1d7957['extension'];agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3d')]=agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')];}}catch(_0x2b0db5){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]',_0x1d7957['uniqueid']),_0x2b0db5);}};exports['attendedtransfer']=function(_0x12c5bf){try{utils[_0x7b9a('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf['origtransfereruniqueid']),_0x12c5bf);if(_0x12c5bf['origtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x3e')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf[_0x7b9a('0x3f')]])){utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x40'),_0x12c5bf[_0x7b9a('0x41')],agents[_0x12c5bf[_0x7b9a('0x3f')]]['membername']));agents[_0x12c5bf[_0x7b9a('0x3f')]]['transfer']=!![];agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3c')]=_0x12c5bf['origtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x3f')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x41')];}if(_0x12c5bf[_0x7b9a('0x43')]&&agents[_0x12c5bf[_0x7b9a('0x43')]]){agents[_0x12c5bf['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfereeuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x43')]]);transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x8')]=agents[_0x12c5bf['secondtransfereruniqueid']][_0x7b9a('0x8')];transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x44')]=agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x44')];transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x43')]]['agentconnectAt']=utils['now']();transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x45')]=0x2;}}else if(_0x12c5bf['secondtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x46')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf['origtransfereruniqueid']])){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x40'),_0x12c5bf['origtransfereruniqueid'],agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x6')]));agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x39')]=!![];agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x3c')]=_0x12c5bf['secondtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x41')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x3f')];}if(_0x12c5bf['transfertargetuniqueid']&&agents[_0x12c5bf[_0x7b9a('0x47')]]){agents[_0x12c5bf['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfertargetuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x47')]]);transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x8')]=agents[_0x12c5bf[_0x7b9a('0x41')]]['calleridnum'];transfers[_0x12c5bf[_0x7b9a('0x47')]]['calleridname']=agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x44')];transfers[_0x12c5bf['transfertargetuniqueid']]['agentcalledAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x47')]]['agentconnectAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf['transfertargetuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x45')]=0x2;}}}catch(_0x5118b3){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf[_0x7b9a('0x41')]),_0x5118b3);}};exports[_0x7b9a('0x48')]=function(_0x3fd697){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3fd697);if(agents[_0x3fd697['uniqueid']]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]==='timeout'){if(_0x3fd697[_0x7b9a('0x4a')]==='21'){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='rejected';agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x4b');}utils['info'](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x21')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);var _0x2090ef=unanswered['indexOf'](_0x3fd697['uniqueid']);if(_0x2090ef>-0x1){unanswered[_0x7b9a('0x4c')](_0x2090ef,0x1);}}if(transfers[_0x3fd697[_0x7b9a('0x3')]]){transfers[_0x3fd697['uniqueid']][_0x7b9a('0xd')]=!![];transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')]=utils['now']();transfers[_0x3fd697['uniqueid']][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],transfers[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='agent';transfers[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x36');utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],transfers[_0x3fd697[_0x7b9a('0x3')]]['membername'],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(transfers[_0x3fd697[_0x7b9a('0x3')]],!![]);}if(agents[_0x3fd697[_0x7b9a('0x3')]]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x2c')]){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xd')]=!![];agents[_0x3fd697[_0x7b9a('0x3')]]['agentcompleteAt']=utils['now']();agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x23')]=utils['diffTime'](agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]=agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x39')]?_0x7b9a('0x39'):_0x7b9a('0x4e');agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]='complete';utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x4f'),_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);}}catch(_0x3022e0){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3022e0);}}; \ No newline at end of file +var _0xeb74=['timeout','reason','holdtime','ringtime','talktime','push','error','includes','debug','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','agentcomplete','agentcompleteAt','diffTime','agentconnectAt','complete','[%s][agents][agentcomplete]','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','calleridnum','calleridname','ATTENDED','transfertargetuniqueid','clone','[%s][agents][attendedtransfer]','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','lodash','util','./utils','info','format','uniqueid','channel','queue','membername','interface','connectedlinenum','getVoiceQueueByName','type','agentacw','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb74,0xe3));var _0x4eb7=function(_0x339469,_0xb63953){_0x339469=_0x339469-0x0;var _0xb8d76f=_0xeb74[_0x339469];return _0xb8d76f;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var utils=require(_0x4eb7('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x9b674c,_0x2b5a60){utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x9b674c[_0x4eb7('0x5')],_0x9b674c[_0x4eb7('0x6')],_0x9b674c[_0x4eb7('0x7')],_0x9b674c[_0x4eb7('0x8')],_0x9b674c[_0x4eb7('0x9')],_0x9b674c['calleridnum'],_0x9b674c[_0x4eb7('0xa')],_0x9b674c['lastevent']));if(_0x9b674c[_0x4eb7('0x7')]){utils[_0x4eb7('0xb')](_0x9b674c['queue'])['then'](function(_0xe07330){if(_0xe07330){_0x9b674c[_0x4eb7('0xc')]=_0xe07330['type'];_0x9b674c[_0x4eb7('0xd')]=_0x9b674c['agentcomplete']?_0xe07330[_0x4eb7('0xe')]:![];_0x9b674c[_0x4eb7('0xf')]=_0x9b674c[_0x4eb7('0xd')]?_0xe07330['acwTimeout']:0x0;}utils[_0x4eb7('0x10')](_0x4eb7('0x11'),_0x9b674c);});}else{utils[_0x4eb7('0x10')](_0x4eb7('0x11'),_0x9b674c);}if(_0x2b5a60){delete transfers[_0x9b674c[_0x4eb7('0x5')]];}else{delete agents[_0x9b674c[_0x4eb7('0x12')]];}}exports[_0x4eb7('0x13')]=function(_0x4c27a4){try{utils['debug'](util['format'](_0x4eb7('0x14'),_0x4c27a4['uniqueid']),_0x4c27a4);agents[_0x4c27a4[_0x4eb7('0x12')]]=_0x4c27a4;agents[_0x4c27a4[_0x4eb7('0x12')]][_0x4eb7('0x15')]=utils[_0x4eb7('0x16')]();agents[_0x4c27a4[_0x4eb7('0x12')]][_0x4eb7('0x17')]=_0x4eb7('0x18');agents[_0x4c27a4[_0x4eb7('0x12')]][_0x4eb7('0xa')]=null;agents[_0x4c27a4[_0x4eb7('0x12')]]['connectedlinename']=null;utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x19'),_0x4c27a4[_0x4eb7('0x5')],agents[_0x4c27a4[_0x4eb7('0x12')]][_0x4eb7('0x8')],_0x4c27a4[_0x4eb7('0x12')]));}catch(_0x16c024){utils['error'](util[_0x4eb7('0x4')](_0x4eb7('0x14'),_0x4c27a4[_0x4eb7('0x5')]),_0x16c024);}};exports[_0x4eb7('0x1a')]=function(_0x32f0f5){try{if(!_[_0x4eb7('0x1b')](agents[_0x32f0f5[_0x4eb7('0x12')]])){utils['debug'](util[_0x4eb7('0x4')](_0x4eb7('0x1c'),_0x32f0f5[_0x4eb7('0x5')]),_0x32f0f5);utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x1d'),_0x32f0f5[_0x4eb7('0x5')],agents[_0x32f0f5[_0x4eb7('0x12')]][_0x4eb7('0x8')],_0x32f0f5[_0x4eb7('0x12')]));agents[_0x32f0f5['destuniqueid']][_0x4eb7('0x1a')]=!![];agents[_0x32f0f5[_0x4eb7('0x12')]][_0x4eb7('0x1e')]=utils[_0x4eb7('0x16')]();agents[_0x32f0f5[_0x4eb7('0x12')]][_0x4eb7('0x17')]=_0x4eb7('0x1f');agents[_0x32f0f5[_0x4eb7('0x12')]][_0x4eb7('0x20')]=_0x4eb7('0x1f');agents[_0x32f0f5[_0x4eb7('0x12')]][_0x4eb7('0x21')]=_0x32f0f5[_0x4eb7('0x22')]?parseInt(_0x32f0f5[_0x4eb7('0x22')])/0x3e8:0x0;agents[_0x32f0f5[_0x4eb7('0x12')]][_0x4eb7('0x23')]=0x0;unanswered[_0x4eb7('0x24')](_0x32f0f5[_0x4eb7('0x12')]);}}catch(_0x33a2c1){utils[_0x4eb7('0x25')](util[_0x4eb7('0x4')](_0x4eb7('0x1c'),_0x32f0f5[_0x4eb7('0x5')]),_0x33a2c1);}};exports['queuecallerabandon']=function(_0x34515c){try{_['forIn'](agents,function(_0x446872,_0x13f71a){if(_0x446872[_0x4eb7('0x5')]==_0x34515c[_0x4eb7('0x5')]&&!_[_0x4eb7('0x26')](unanswered,_0x446872[_0x4eb7('0x12')])){utils[_0x4eb7('0x27')](util[_0x4eb7('0x4')](_0x4eb7('0x28'),_0x34515c['uniqueid']),_0x34515c);utils[_0x4eb7('0x3')](util['format'](_0x4eb7('0x29'),_0x34515c[_0x4eb7('0x5')],_0x446872['membername'],_0x446872['destuniqueid']));_0x446872[_0x4eb7('0x1a')]=!![];_0x446872[_0x4eb7('0x1e')]=utils[_0x4eb7('0x16')]();_0x446872[_0x4eb7('0x17')]='abandoned';_0x446872[_0x4eb7('0x20')]=_0x4eb7('0x2a');_0x446872[_0x4eb7('0x21')]=_0x34515c[_0x4eb7('0x21')];_0x446872[_0x4eb7('0x23')]=0x0;writeDB(_0x446872);}});}catch(_0x5ab58d){utils[_0x4eb7('0x25')](util[_0x4eb7('0x4')](_0x4eb7('0x28'),_0x34515c['uniqueid']),_0x5ab58d);}};exports[_0x4eb7('0x2b')]=function(_0xe1cc8f){try{if(agents[_0xe1cc8f[_0x4eb7('0x12')]]){utils['debug'](util[_0x4eb7('0x4')]('[%s][agents][agentconnect]',_0xe1cc8f[_0x4eb7('0x5')]),_0xe1cc8f);utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x2c'),_0xe1cc8f['uniqueid'],agents[_0xe1cc8f[_0x4eb7('0x12')]][_0x4eb7('0x8')],_0xe1cc8f[_0x4eb7('0x12')]));agents[_0xe1cc8f[_0x4eb7('0x12')]]['agentconnectAt']=utils['now']();agents[_0xe1cc8f['destuniqueid']][_0x4eb7('0xa')]=_0xe1cc8f[_0x4eb7('0xa')];agents[_0xe1cc8f[_0x4eb7('0x12')]][_0x4eb7('0x2d')]=_0xe1cc8f[_0x4eb7('0x2d')];agents[_0xe1cc8f[_0x4eb7('0x12')]][_0x4eb7('0x21')]=_0xe1cc8f[_0x4eb7('0x22')];agents[_0xe1cc8f[_0x4eb7('0x12')]][_0x4eb7('0x17')]='connect';_[_0x4eb7('0x2e')](agents,function(_0x38218f,_0xe04d76){if(_0x38218f[_0x4eb7('0x12')]!=_0xe1cc8f[_0x4eb7('0x12')]&&_0x38218f[_0x4eb7('0x5')]==_0xe1cc8f[_0x4eb7('0x5')]){_0x38218f[_0x4eb7('0x23')]=0x0;_0x38218f[_0x4eb7('0x21')]=_0xe1cc8f[_0x4eb7('0x22')];_0x38218f[_0x4eb7('0x1a')]=!![];_0x38218f[_0x4eb7('0x1e')]=utils[_0x4eb7('0x16')]();_0x38218f[_0x4eb7('0x17')]=_0x4eb7('0x2f');_0x38218f[_0x4eb7('0x20')]=_0x4eb7('0x2f');_0x38218f[_0x4eb7('0x30')]=_0xe1cc8f[_0x4eb7('0x12')];_0x38218f[_0x4eb7('0x31')]=_0xe1cc8f['membername'];writeDB(_0x38218f);}});}}catch(_0x2fd5c2){utils[_0x4eb7('0x25')](util[_0x4eb7('0x4')](_0x4eb7('0x32'),_0xe1cc8f[_0x4eb7('0x5')]),_0x2fd5c2);}};exports[_0x4eb7('0x33')]=function(_0x3cd9e5){try{if(!_[_0x4eb7('0x1b')](agents[_0x3cd9e5[_0x4eb7('0x12')]])){utils['debug'](util[_0x4eb7('0x4')]('[%s][agents][agentcomplete]',_0x3cd9e5[_0x4eb7('0x5')]),_0x3cd9e5);utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3cd9e5[_0x4eb7('0x5')],agents[_0x3cd9e5[_0x4eb7('0x12')]][_0x4eb7('0x8')],_0x3cd9e5[_0x4eb7('0x12')]));agents[_0x3cd9e5['destuniqueid']][_0x4eb7('0x33')]=!![];agents[_0x3cd9e5['destuniqueid']][_0x4eb7('0x34')]=utils[_0x4eb7('0x16')]();agents[_0x3cd9e5[_0x4eb7('0x12')]][_0x4eb7('0x23')]=utils[_0x4eb7('0x35')](agents[_0x3cd9e5['destuniqueid']]['agentcompleteAt'],agents[_0x3cd9e5[_0x4eb7('0x12')]][_0x4eb7('0x36')]);agents[_0x3cd9e5[_0x4eb7('0x12')]][_0x4eb7('0x20')]=_0x3cd9e5[_0x4eb7('0x20')];agents[_0x3cd9e5['destuniqueid']][_0x4eb7('0x17')]=_0x4eb7('0x37');writeDB(agents[_0x3cd9e5['destuniqueid']]);}}catch(_0x22e09c){utils[_0x4eb7('0x25')](util['format'](_0x4eb7('0x38'),_0x3cd9e5[_0x4eb7('0x5')]),_0x22e09c);}};exports[_0x4eb7('0x39')]=function(_0x5774d5){try{if(!_[_0x4eb7('0x1b')](agents[_0x5774d5['transfereruniqueid']])){utils['debug'](util[_0x4eb7('0x4')](_0x4eb7('0x3a'),_0x5774d5[_0x4eb7('0x5')]),_0x5774d5);utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x3b'),_0x5774d5[_0x4eb7('0x5')],agents[_0x5774d5[_0x4eb7('0x3c')]][_0x4eb7('0x8')],agents[_0x5774d5[_0x4eb7('0x3c')]][_0x4eb7('0x5')]));agents[_0x5774d5[_0x4eb7('0x3c')]][_0x4eb7('0x3d')]=!![];agents[_0x5774d5[_0x4eb7('0x3c')]][_0x4eb7('0x3e')]=_0x4eb7('0x3f');agents[_0x5774d5[_0x4eb7('0x3c')]][_0x4eb7('0x40')]=_0x5774d5[_0x4eb7('0x41')];agents[_0x5774d5[_0x4eb7('0x3c')]]['transferuniqueid']=agents[_0x5774d5[_0x4eb7('0x3c')]]['uniqueid'];}}catch(_0x4db5f7){utils[_0x4eb7('0x25')](util[_0x4eb7('0x4')](_0x4eb7('0x3a'),_0x5774d5[_0x4eb7('0x5')]),_0x4db5f7);}};exports[_0x4eb7('0x42')]=function(_0x553736){try{utils['debug'](util[_0x4eb7('0x4')]('[%s][agents][attendedtransfer]',_0x553736[_0x4eb7('0x43')]),_0x553736);if(_0x553736[_0x4eb7('0x43')]==_0x553736[_0x4eb7('0x44')]){if(!_[_0x4eb7('0x1b')](agents[_0x553736['secondtransfereruniqueid']])){utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x45'),_0x553736[_0x4eb7('0x43')],agents[_0x553736['secondtransfereruniqueid']][_0x4eb7('0x8')]));agents[_0x553736[_0x4eb7('0x46')]]['transfer']=!![];agents[_0x553736[_0x4eb7('0x46')]][_0x4eb7('0x3e')]='ATTENDED';agents[_0x553736[_0x4eb7('0x46')]]['transferexten']=_0x553736[_0x4eb7('0x47')];agents[_0x553736['secondtransfereruniqueid']][_0x4eb7('0x48')]=_0x553736[_0x4eb7('0x43')];}if(_0x553736[_0x4eb7('0x49')]&&agents[_0x553736[_0x4eb7('0x49')]]){agents[_0x553736[_0x4eb7('0x49')]][_0x4eb7('0x4a')]=0x1;transfers[_0x553736['transfereeuniqueid']]=_['clone'](agents[_0x553736[_0x4eb7('0x49')]]);transfers[_0x553736[_0x4eb7('0x49')]][_0x4eb7('0x4b')]=agents[_0x553736[_0x4eb7('0x46')]]['calleridnum'];transfers[_0x553736[_0x4eb7('0x49')]][_0x4eb7('0x4c')]=agents[_0x553736['secondtransfereruniqueid']][_0x4eb7('0x4c')];transfers[_0x553736[_0x4eb7('0x49')]][_0x4eb7('0x15')]=utils[_0x4eb7('0x16')]();transfers[_0x553736[_0x4eb7('0x49')]][_0x4eb7('0x36')]=utils[_0x4eb7('0x16')]();transfers[_0x553736['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x553736[_0x4eb7('0x49')]]['agententerreason']=0x2;}}else if(_0x553736[_0x4eb7('0x46')]==_0x553736['secondtransfererlinkedid']){if(!_[_0x4eb7('0x1b')](agents[_0x553736['origtransfereruniqueid']])){utils['info'](util[_0x4eb7('0x4')](_0x4eb7('0x45'),_0x553736['origtransfereruniqueid'],agents[_0x553736[_0x4eb7('0x43')]]['membername']));agents[_0x553736[_0x4eb7('0x43')]][_0x4eb7('0x3d')]=!![];agents[_0x553736['origtransfereruniqueid']][_0x4eb7('0x3e')]=_0x4eb7('0x4d');agents[_0x553736['origtransfereruniqueid']]['transferexten']=_0x553736['secondtransfererexten'];agents[_0x553736['origtransfereruniqueid']][_0x4eb7('0x48')]=_0x553736['secondtransfereruniqueid'];}if(_0x553736[_0x4eb7('0x4e')]&&agents[_0x553736[_0x4eb7('0x4e')]]){agents[_0x553736['transfertargetuniqueid']][_0x4eb7('0x4a')]=0x1;transfers[_0x553736[_0x4eb7('0x4e')]]=_[_0x4eb7('0x4f')](agents[_0x553736[_0x4eb7('0x4e')]]);transfers[_0x553736[_0x4eb7('0x4e')]][_0x4eb7('0x4b')]=agents[_0x553736['origtransfereruniqueid']]['calleridnum'];transfers[_0x553736['transfertargetuniqueid']][_0x4eb7('0x4c')]=agents[_0x553736[_0x4eb7('0x43')]][_0x4eb7('0x4c')];transfers[_0x553736[_0x4eb7('0x4e')]][_0x4eb7('0x15')]=utils['now']();transfers[_0x553736['transfertargetuniqueid']][_0x4eb7('0x36')]=utils[_0x4eb7('0x16')]();transfers[_0x553736[_0x4eb7('0x4e')]][_0x4eb7('0x21')]=0x0;transfers[_0x553736[_0x4eb7('0x4e')]]['agententerreason']=0x2;}}}catch(_0x439861){utils[_0x4eb7('0x25')](util[_0x4eb7('0x4')](_0x4eb7('0x50'),_0x553736['origtransfereruniqueid']),_0x439861);}};exports['hangup']=function(_0x3bcbd1){try{utils[_0x4eb7('0x27')](util['format'](_0x4eb7('0x51'),_0x3bcbd1['uniqueid']),_0x3bcbd1);if(agents[_0x3bcbd1[_0x4eb7('0x5')]]&&agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x20')]===_0x4eb7('0x1f')){if(_0x3bcbd1['cause']==='21'){agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x20')]=_0x4eb7('0x52');agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x17')]=_0x4eb7('0x52');}utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x53'),_0x3bcbd1[_0x4eb7('0x5')],agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x8')],agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x20')],agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x17')]));writeDB(agents[_0x3bcbd1[_0x4eb7('0x5')]]);var _0x31e6d2=unanswered[_0x4eb7('0x54')](_0x3bcbd1['uniqueid']);if(_0x31e6d2>-0x1){unanswered['splice'](_0x31e6d2,0x1);}}if(transfers[_0x3bcbd1[_0x4eb7('0x5')]]){transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x33')]=!![];transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x34')]=utils[_0x4eb7('0x16')]();transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x23')]=utils['diffTime'](transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x34')],transfers[_0x3bcbd1[_0x4eb7('0x5')]]['agentconnectAt']);transfers[_0x3bcbd1['uniqueid']][_0x4eb7('0x20')]=_0x4eb7('0x55');transfers[_0x3bcbd1[_0x4eb7('0x5')]]['lastevent']='complete';utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x53'),_0x3bcbd1[_0x4eb7('0x5')],transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x8')],transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x20')],transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x17')]));writeDB(transfers[_0x3bcbd1[_0x4eb7('0x5')]],!![]);}if(agents[_0x3bcbd1[_0x4eb7('0x5')]]&&agents[_0x3bcbd1['uniqueid']]['agentconnectAt']){agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x33')]=!![];agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x34')]=utils[_0x4eb7('0x16')]();agents[_0x3bcbd1[_0x4eb7('0x5')]]['talktime']=utils['diffTime'](agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x34')],agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x36')]);agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x20')]=agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x3d')]?_0x4eb7('0x3d'):_0x4eb7('0x55');agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x17')]=_0x4eb7('0x37');utils[_0x4eb7('0x3')](util['format'](_0x4eb7('0x53'),_0x3bcbd1[_0x4eb7('0x5')],agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x8')],agents[_0x3bcbd1['uniqueid']][_0x4eb7('0x20')],agents[_0x3bcbd1[_0x4eb7('0x5')]]['lastevent']));writeDB(agents[_0x3bcbd1[_0x4eb7('0x5')]]);}}catch(_0x2448a1){utils[_0x4eb7('0x25')](util['format'](_0x4eb7('0x51'),_0x3bcbd1[_0x4eb7('0x5')]),_0x2448a1);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 4eaeaf1..cd55ce3 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 _0x002d=['calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','recording','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','secondtransfererchannel','userfield','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%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','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lastdata','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x002d,0xca));var _0xd002=function(_0x575973,_0x4ec07a){_0x575973=_0x575973-0x0;var _0x4f62ea=_0x002d[_0x575973];return _0x4f62ea;};'use strict';var _=require(_0xd002('0x0'));var util=require(_0xd002('0x1'));var utils=require(_0xd002('0x2'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xd002('0x3'),_0xd002('0x3'),_0xd002('0x4'),_0xd002('0x4'),_0xd002('0x4'),_0xd002('0x5'),_0xd002('0x6'),_0xd002('0x3'),_0xd002('0x3'),_0xd002('0x3')];var channels={};function writeDB(_0x24766e){var _0x45d45f;if(transfers[_0xd002('0x7')][_0x24766e[_0xd002('0x8')]]){_0x45d45f=_0x24766e[_0xd002('0x8')];_0x24766e[_0xd002('0x8')]=transfers[_0xd002('0x7')][_0x24766e['uniqueid']]['transfereeuniqueid'];}utils[_0xd002('0x9')](util[_0xd002('0xa')](_0xd002('0xb'),_0x24766e['uniqueid'],_0x24766e[_0xd002('0xc')],_0x24766e[_0xd002('0xd')],_0x24766e[_0xd002('0xe')],_0x24766e[_0xd002('0xf')],_0x24766e[_0xd002('0x10')],_0x24766e[_0xd002('0x11')],_0x24766e[_0xd002('0x12')]));if(_0x24766e[_0xd002('0x13')]){utils[_0xd002('0x14')](_0x24766e[_0xd002('0x13')])[_0xd002('0x15')](function(_0x4de1c3){if(_0x4de1c3){_0x24766e[_0xd002('0x16')]=_0x4de1c3['id'];}utils[_0xd002('0x17')]('CreateVoiceCallReport',_0x24766e);});}else{utils['request']('CreateVoiceCallReport',_0x24766e);}if(channels[_0x24766e[_0xd002('0x8')]]){delete channels[_0x24766e['uniqueid']];}else if(_0x45d45f&&channels[_0x45d45f]){if(!transfers[_0xd002('0x7')][_0x45d45f][_0xd002('0x18')])delete transfers[_0xd002('0x7')][_0x45d45f];delete channels[_0x45d45f];}}exports[_0xd002('0x19')]=function(_0x3c6f43){try{utils[_0xd002('0x1a')](util[_0xd002('0xa')]('[%s][calls][newchannel]',_0x3c6f43[_0xd002('0x8')]),_0x3c6f43);if(_0x3c6f43[_0xd002('0x8')]==_0x3c6f43[_0xd002('0x1b')]&&_0x3c6f43[_0xd002('0xc')]!=_0xd002('0x1c')){utils['info'](util[_0xd002('0xa')](_0xd002('0x1d'),_0x3c6f43[_0xd002('0x8')],_0x3c6f43[_0xd002('0x1e')],_0x3c6f43[_0xd002('0x1f')]));channels[_0x3c6f43[_0xd002('0x8')]]={'uniqueid':_0x3c6f43['uniqueid'],'accountcode':_0x3c6f43['accountcode'],'source':_0x3c6f43[_0xd002('0x10')],'destination':_0x3c6f43[_0xd002('0x1f')],'destinationcontext':_0x3c6f43[_0xd002('0x1e')],'channel':_0x3c6f43[_0xd002('0xc')],'starttime':utils[_0xd002('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd002('0x4'),'amaflags':_0xd002('0x21')};}}catch(_0x3a99ee){utils[_0xd002('0x22')](util[_0xd002('0xa')](_0xd002('0x23'),_0x3c6f43[_0xd002('0x8')]),_0x3a99ee);}};exports['newstate']=function(_0x25a29d){try{utils[_0xd002('0x1a')](util['format'](_0xd002('0x24'),_0x25a29d[_0xd002('0x8')]),_0x25a29d);if(!_[_0xd002('0x25')](channels[_0x25a29d['uniqueid']])&&_0x25a29d[_0xd002('0x26')]==0x6){utils['info'](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x25a29d[_0xd002('0x8')],_0x25a29d[_0xd002('0x1e')],_0x25a29d[_0xd002('0xc')]));if(_[_0xd002('0x25')](channels[_0x25a29d[_0xd002('0x8')]][_0xd002('0x27')])){channels[_0x25a29d[_0xd002('0x8')]][_0xd002('0x27')]=utils[_0xd002('0x20')]();}}else if(!_[_0xd002('0x25')](channels[_0x25a29d['linkedid']])&&_0x25a29d[_0xd002('0x26')]==0x6&&_0x25a29d[_0xd002('0x1e')]!=_0xd002('0x28')){utils[_0xd002('0x9')](util['format'](_0xd002('0x29'),_0x25a29d['uniqueid'],_0x25a29d[_0xd002('0x1b')],_0x25a29d['context'],_0x25a29d[_0xd002('0xc')]));channels[_0x25a29d[_0xd002('0x1b')]][_0xd002('0x13')]=_0x25a29d[_0xd002('0x13')];channels[_0x25a29d[_0xd002('0x1b')]][_0xd002('0x2a')]=_0x25a29d[_0xd002('0xc')];if(_[_0xd002('0x25')](channels[_0x25a29d['linkedid']][_0xd002('0x2b')])){channels[_0x25a29d[_0xd002('0x1b')]][_0xd002('0x2b')]=utils[_0xd002('0x20')]();}channels[_0x25a29d[_0xd002('0x1b')]][_0xd002('0x2c')]=dispositions[_['toNumber'](_0x25a29d['channelstate'])]||'ANSWERED';}}catch(_0xb4a7e3){utils['error'](util[_0xd002('0xa')](_0xd002('0x24'),_0x25a29d[_0xd002('0x8')]),_0xb4a7e3);}};exports[_0xd002('0x2d')]=function(_0x3e626b){try{if(!_[_0xd002('0x25')](channels[_0x3e626b[_0xd002('0x8')]])){utils[_0xd002('0x1a')](util['format'](_0xd002('0x2e'),_0x3e626b[_0xd002('0x8')]),_0x3e626b);if(_['isNil'](channels[_0x3e626b['uniqueid']][_0xd002('0x2f')])){channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x2f')]=_0x3e626b[_0xd002('0x30')]+'\x20<'+_0x3e626b['calleridnum']+'>';}utils[_0xd002('0x9')](util['format'](_0xd002('0x31'),_0x3e626b[_0xd002('0x8')],channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x2f')],_0x3e626b[_0xd002('0x32')]));channels[_0x3e626b['uniqueid']][_0xd002('0x33')]=utils[_0xd002('0x20')]();channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x34')]=utils[_0xd002('0x35')](channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x33')],channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x36')]);channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x37')]=channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x2b')]?utils[_0xd002('0x35')](channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x33')],channels[_0x3e626b['uniqueid']][_0xd002('0x2b')]):0x0;writeDB(channels[_0x3e626b[_0xd002('0x8')]]);}}catch(_0xf934c1){utils[_0xd002('0x22')](util['format'](_0xd002('0x2e'),_0x3e626b[_0xd002('0x8')]),_0xf934c1);}};exports['attendedtransfer']=function(_0x52484d){try{if(!_[_0xd002('0x25')](channels[_0x52484d[_0xd002('0x38')]])){utils[_0xd002('0x1a')](util['format'](_0xd002('0x39'),_0x52484d['origtransfereruniqueid']),_0x52484d);if(channels[_0x52484d['localtwolinkedid']][_0xd002('0xc')]==_0x52484d['transfereechannel']){utils[_0xd002('0x9')](util[_0xd002('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x52484d[_0xd002('0x3a')],_0x52484d[_0xd002('0x38')],_0x52484d[_0xd002('0x3b')]));channels[_0x52484d[_0xd002('0x38')]][_0xd002('0x2a')]=_0x52484d['secondtransfererchannel'];channels[_0x52484d['localtwolinkedid']][_0xd002('0x3c')]='_attended';}else if(channels[_0x52484d[_0xd002('0x38')]][_0xd002('0xc')]=_0x52484d['transfertargetchannel']){utils['info'](util[_0xd002('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x52484d[_0xd002('0x3a')],_0x52484d['localtwolinkedid'],_0x52484d[_0xd002('0x3d')]));channels[_0x52484d['localtwolinkedid']][_0xd002('0x2a')]=_0x52484d[_0xd002('0x3d')];channels[_0x52484d['localtwolinkedid']][_0xd002('0x3c')]=_0xd002('0x3e');}}}catch(_0x3df610){utils[_0xd002('0x22')](util[_0xd002('0xa')](_0xd002('0x39'),_0x52484d['origtransfereruniqueid']),_0x3df610);}};exports[_0xd002('0x3f')]=function(_0x32018a){try{if(!_[_0xd002('0x25')](channels[_0x32018a[_0xd002('0x8')]])){utils['debug'](util[_0xd002('0xa')](_0xd002('0x40'),_0x32018a[_0xd002('0x8')]),_0x32018a);channels[_0x32018a[_0xd002('0x8')]][_0xd002('0x41')]=utils[_0xd002('0x20')]();utils['info'](util[_0xd002('0xa')](_0xd002('0x42'),_0x32018a[_0xd002('0x8')],channels[_0x32018a[_0xd002('0x8')]][_0xd002('0x41')]));}}catch(_0x2e8cc9){utils[_0xd002('0x22')](util[_0xd002('0xa')](_0xd002('0x40'),_0x32018a[_0xd002('0x8')]),_0x2e8cc9);}};exports['musiconholdstop']=function(_0x3ea5aa){try{if(!_[_0xd002('0x25')](channels[_0x3ea5aa[_0xd002('0x8')]])){utils[_0xd002('0x1a')](util[_0xd002('0xa')](_0xd002('0x43'),_0x3ea5aa[_0xd002('0x8')]),_0x3ea5aa);if(!_[_0xd002('0x25')](channels[_0x3ea5aa['uniqueid']]['musiconholdstartAt'])){channels[_0x3ea5aa[_0xd002('0x8')]][_0xd002('0x44')]+=utils[_0xd002('0x35')](utils[_0xd002('0x20')](),channels[_0x3ea5aa['uniqueid']][_0xd002('0x41')]);utils[_0xd002('0x9')](util[_0xd002('0xa')](_0xd002('0x45'),_0x3ea5aa['uniqueid'],channels[_0x3ea5aa[_0xd002('0x8')]][_0xd002('0x44')]));delete channels[_0x3ea5aa[_0xd002('0x8')]][_0xd002('0x41')];}}}catch(_0x4dd29a){utils[_0xd002('0x22')](util[_0xd002('0xa')](_0xd002('0x43'),_0x3ea5aa['uniqueid']),_0x4dd29a);}};exports[_0xd002('0x46')]=function(_0x532aa6){try{if(!_['isNil'](channels[_0x532aa6[_0xd002('0x8')]])){utils[_0xd002('0x1a')](util[_0xd002('0xa')](_0xd002('0x47'),_0x532aa6['uniqueid']),_0x532aa6);if(!_[_0xd002('0x25')](_0x532aa6['variable'][_0xd002('0x48')])){utils[_0xd002('0x9')](util[_0xd002('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x532aa6['uniqueid'],_0x532aa6[_0xd002('0x49')]));channels[_0x532aa6['uniqueid']]['source']=_0x532aa6['value'];}if(!_[_0xd002('0x25')](_0x532aa6[_0xd002('0x4a')][_0xd002('0x4b')])){utils['info'](util[_0xd002('0xa')](_0xd002('0x4c'),_0x532aa6[_0xd002('0x8')],_0x532aa6[_0xd002('0x49')]));channels[_0x532aa6[_0xd002('0x8')]][_0xd002('0x4d')]=_0x532aa6[_0xd002('0x49')];channels[_0x532aa6[_0xd002('0x8')]][_0xd002('0x2f')]='\x22'+_0x532aa6[_0xd002('0x49')]+'\x22\x20<'+_0x532aa6[_0xd002('0x49')]+'>';}if(!_[_0xd002('0x25')](_0x532aa6['variable'][_0xd002('0x4e')])||!_[_0xd002('0x25')](_0x532aa6[_0xd002('0x4a')][_0xd002('0x4f')])){utils['info'](util[_0xd002('0xa')](_0xd002('0x50'),_0x532aa6[_0xd002('0x8')],!_['isNil'](_0x532aa6[_0xd002('0x4a')][_0xd002('0x4e')])?'xmd-callerid-preview':'xmd-callerid',_0x532aa6[_0xd002('0x49')]));channels[_0x532aa6['uniqueid']][_0xd002('0x2f')]=_0x532aa6[_0xd002('0x49')];}if(!_[_0xd002('0x25')](_0x532aa6[_0xd002('0x4a')]['xmd-queue'])||!_[_0xd002('0x25')](_0x532aa6[_0xd002('0x4a')][_0xd002('0x51')])){utils['info'](util[_0xd002('0xa')](_0xd002('0x50'),_0x532aa6[_0xd002('0x8')],!_['isNil'](_0x532aa6[_0xd002('0x4a')]['xmd-queue'])?_0xd002('0x52'):_0xd002('0x51'),_0x532aa6['value']));channels[_0x532aa6['uniqueid']][_0xd002('0x53')]='Queue';channels[_0x532aa6[_0xd002('0x8')]]['lastdata']=_0x532aa6[_0xd002('0x49')];channels[_0x532aa6[_0xd002('0x8')]][_0xd002('0xd')]=!![];}if(!_['isNil'](_0x532aa6[_0xd002('0x4a')]['xmd-contactid'])){utils[_0xd002('0x9')](util[_0xd002('0xa')](_0xd002('0x54'),_0x532aa6[_0xd002('0x8')],_0x532aa6['value']));channels[_0x532aa6[_0xd002('0x8')]][_0xd002('0x55')]=_0x532aa6['value'];}if(!_[_0xd002('0x25')](_0x532aa6['variable']['xmd-cdrtype'])){utils['info'](util[_0xd002('0xa')](_0xd002('0x56'),_0x532aa6[_0xd002('0x8')],_0x532aa6['value']));channels[_0x532aa6[_0xd002('0x8')]][_0xd002('0x57')]=_0x532aa6[_0xd002('0x49')];}if(!_[_0xd002('0x25')](_0x532aa6[_0xd002('0x4a')][_0xd002('0x58')])){utils[_0xd002('0x9')](util['format'](_0xd002('0x59'),_0x532aa6[_0xd002('0x8')],_0x532aa6[_0xd002('0x49')]));channels[_0x532aa6[_0xd002('0x8')]][_0xd002('0x5a')]=_0x532aa6[_0xd002('0x49')];}if(!_['isNil'](_0x532aa6['variable']['sipcallid'])){utils[_0xd002('0x9')](util['format'](_0xd002('0x5b'),_0x532aa6['uniqueid'],_0x532aa6[_0xd002('0x49')]));channels[_0x532aa6['uniqueid']][_0xd002('0x5c')]=_0x532aa6['value'];}}}catch(_0x5805be){utils[_0xd002('0x22')](util[_0xd002('0xa')](_0xd002('0x47'),_0x532aa6['uniqueid']),_0x5805be);}};exports['newexten']=function(_0x299597){try{if(!_[_0xd002('0x25')](channels[_0x299597[_0xd002('0x8')]])){utils[_0xd002('0x1a')](util[_0xd002('0xa')](_0xd002('0x5d'),_0x299597[_0xd002('0x8')]),_0x299597);utils[_0xd002('0x9')](util[_0xd002('0xa')](_0xd002('0x5e'),_0x299597[_0xd002('0x8')],_0x299597[_0xd002('0x5f')],_0x299597[_0xd002('0x60')]));if(_0x299597['application'][_0xd002('0x61')]()==_0xd002('0x62')&&_[_0xd002('0x63')](_0x299597['appdata'][_0xd002('0x61')](),_0xd002('0x64'))){var _0x3a8d9c=_0x299597[_0xd002('0x60')][_0xd002('0x65')]('=');var _0x324bee=_0x3a8d9c[0x0][_0xd002('0x66')](_0x3a8d9c[0x0][_0xd002('0x67')]('(')+0x1,_0x3a8d9c[0x0][_0xd002('0x67')](')'));var _0x1edc01=_0x3a8d9c[0x1];channels[_0x299597[_0xd002('0x8')]][_0x324bee]=_0x1edc01;}if(!_[_0xd002('0x68')]([_0xd002('0x2d'),_0xd002('0x69'),_0xd002('0x6a'),'set',_0xd002('0x6b')],_0x299597[_0xd002('0x5f')][_0xd002('0x61')]())){channels[_0x299597[_0xd002('0x8')]][_0xd002('0x53')]=_0x299597['application'];channels[_0x299597['uniqueid']][_0xd002('0x6c')]=_0x299597[_0xd002('0x60')];}}}catch(_0x54e3b4){utils[_0xd002('0x22')](util[_0xd002('0xa')]('[%s][calls][newexten]',_0x299597[_0xd002('0x8')]),_0x54e3b4);}}; \ No newline at end of file +var _0x0a01=['endtime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','secondtransfererchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','_attended','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','split','lastIndexOf','includes','noop','[%s][calls][newexten]','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','membername','interface','calleridnum','connectedlinenum','getUserByInternal','accountcode','then','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','channel','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime'];(function(_0x392b1c,_0x307b1f){var _0x23fcb8=function(_0x1d5ccb){while(--_0x1d5ccb){_0x392b1c['push'](_0x392b1c['shift']());}};_0x23fcb8(++_0x307b1f);}(_0x0a01,0x10b));var _0x10a0=function(_0x14ec1f,_0x59ef2f){_0x14ec1f=_0x14ec1f-0x0;var _0x5cecb3=_0x0a01[_0x14ec1f];return _0x5cecb3;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var transfers=require(_0x10a0('0x0'));var dispositions=['NO\x20ANSWER','FAILED',_0x10a0('0x1'),'NO\x20ANSWER',_0x10a0('0x2'),_0x10a0('0x2'),_0x10a0('0x3'),_0x10a0('0x4'),_0x10a0('0x1'),_0x10a0('0x1'),'FAILED'];var channels={};function writeDB(_0x1c479e){var _0x46edde;if(transfers[_0x10a0('0x5')][_0x1c479e[_0x10a0('0x6')]]){_0x46edde=_0x1c479e[_0x10a0('0x6')];_0x1c479e[_0x10a0('0x6')]=transfers['blinds'][_0x1c479e[_0x10a0('0x6')]][_0x10a0('0x7')];}utils[_0x10a0('0x8')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1c479e[_0x10a0('0x6')],_0x1c479e['channel'],_0x1c479e['queue'],_0x1c479e[_0x10a0('0x9')],_0x1c479e[_0x10a0('0xa')],_0x1c479e[_0x10a0('0xb')],_0x1c479e[_0x10a0('0xc')],_0x1c479e['lastevent']));if(_0x1c479e['accountcode']){utils[_0x10a0('0xd')](_0x1c479e[_0x10a0('0xe')])[_0x10a0('0xf')](function(_0x53d0a8){if(_0x53d0a8){_0x1c479e['UserId']=_0x53d0a8['id'];}utils[_0x10a0('0x10')](_0x10a0('0x11'),_0x1c479e);});}else{utils[_0x10a0('0x10')]('CreateVoiceCallReport',_0x1c479e);}if(channels[_0x1c479e[_0x10a0('0x6')]]){delete channels[_0x1c479e[_0x10a0('0x6')]];}else if(_0x46edde&&channels[_0x46edde]){if(!transfers['blinds'][_0x46edde]['recording'])delete transfers[_0x10a0('0x5')][_0x46edde];delete channels[_0x46edde];}}exports[_0x10a0('0x12')]=function(_0x464cb3){try{utils[_0x10a0('0x13')](util[_0x10a0('0x14')](_0x10a0('0x15'),_0x464cb3[_0x10a0('0x6')]),_0x464cb3);if(_0x464cb3['uniqueid']==_0x464cb3['linkedid']&&_0x464cb3[_0x10a0('0x16')]!=_0x10a0('0x17')){utils[_0x10a0('0x8')](util[_0x10a0('0x14')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x464cb3['uniqueid'],_0x464cb3[_0x10a0('0x18')],_0x464cb3[_0x10a0('0x19')]));channels[_0x464cb3['uniqueid']]={'uniqueid':_0x464cb3[_0x10a0('0x6')],'accountcode':_0x464cb3['accountcode'],'source':_0x464cb3[_0x10a0('0xb')],'destination':_0x464cb3[_0x10a0('0x19')],'destinationcontext':_0x464cb3[_0x10a0('0x18')],'channel':_0x464cb3[_0x10a0('0x16')],'starttime':utils[_0x10a0('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x10a0('0x2'),'amaflags':_0x10a0('0x1b')};}}catch(_0xee103a){utils[_0x10a0('0x1c')](util[_0x10a0('0x14')](_0x10a0('0x15'),_0x464cb3[_0x10a0('0x6')]),_0xee103a);}};exports[_0x10a0('0x1d')]=function(_0x23caf4){try{utils[_0x10a0('0x13')](util[_0x10a0('0x14')](_0x10a0('0x1e'),_0x23caf4['uniqueid']),_0x23caf4);if(!_[_0x10a0('0x1f')](channels[_0x23caf4['uniqueid']])&&_0x23caf4[_0x10a0('0x20')]==0x6){utils['info'](util[_0x10a0('0x14')](_0x10a0('0x21'),_0x23caf4[_0x10a0('0x6')],_0x23caf4[_0x10a0('0x18')],_0x23caf4[_0x10a0('0x16')]));if(_[_0x10a0('0x1f')](channels[_0x23caf4['uniqueid']][_0x10a0('0x22')])){channels[_0x23caf4['uniqueid']]['systemanswertime']=utils[_0x10a0('0x1a')]();}}else if(!_[_0x10a0('0x1f')](channels[_0x23caf4['linkedid']])&&_0x23caf4[_0x10a0('0x20')]==0x6&&_0x23caf4['context']!=_0x10a0('0x23')){utils[_0x10a0('0x8')](util[_0x10a0('0x14')](_0x10a0('0x24'),_0x23caf4[_0x10a0('0x6')],_0x23caf4['linkedid'],_0x23caf4[_0x10a0('0x18')],_0x23caf4[_0x10a0('0x16')]));channels[_0x23caf4[_0x10a0('0x25')]][_0x10a0('0xe')]=_0x23caf4['accountcode'];channels[_0x23caf4['linkedid']][_0x10a0('0x26')]=_0x23caf4['channel'];if(_[_0x10a0('0x1f')](channels[_0x23caf4['linkedid']][_0x10a0('0x27')])){channels[_0x23caf4[_0x10a0('0x25')]][_0x10a0('0x27')]=utils['now']();}channels[_0x23caf4[_0x10a0('0x25')]][_0x10a0('0x28')]=dispositions[_[_0x10a0('0x29')](_0x23caf4[_0x10a0('0x20')])]||_0x10a0('0x3');}}catch(_0x5a415c){utils[_0x10a0('0x1c')](util[_0x10a0('0x14')](_0x10a0('0x1e'),_0x23caf4[_0x10a0('0x6')]),_0x5a415c);}};exports[_0x10a0('0x2a')]=function(_0x37939c){try{if(!_['isNil'](channels[_0x37939c[_0x10a0('0x6')]])){utils[_0x10a0('0x13')](util[_0x10a0('0x14')]('[%s][calls][hangup]',_0x37939c['uniqueid']),_0x37939c);if(_[_0x10a0('0x1f')](channels[_0x37939c['uniqueid']][_0x10a0('0x2b')])){channels[_0x37939c['uniqueid']][_0x10a0('0x2b')]=_0x37939c[_0x10a0('0x2c')]+'\x20<'+_0x37939c[_0x10a0('0xb')]+'>';}utils['info'](util['format'](_0x10a0('0x2d'),_0x37939c[_0x10a0('0x6')],channels[_0x37939c['uniqueid']]['callerid'],_0x37939c[_0x10a0('0x2e')]));channels[_0x37939c['uniqueid']]['endtime']=utils[_0x10a0('0x1a')]();channels[_0x37939c[_0x10a0('0x6')]]['duration']=utils[_0x10a0('0x2f')](channels[_0x37939c[_0x10a0('0x6')]][_0x10a0('0x30')],channels[_0x37939c['uniqueid']]['starttime']);channels[_0x37939c['uniqueid']][_0x10a0('0x31')]=channels[_0x37939c[_0x10a0('0x6')]]['answertime']?utils[_0x10a0('0x2f')](channels[_0x37939c[_0x10a0('0x6')]][_0x10a0('0x30')],channels[_0x37939c[_0x10a0('0x6')]][_0x10a0('0x27')]):0x0;writeDB(channels[_0x37939c[_0x10a0('0x6')]]);}}catch(_0x4143a6){utils['error'](util[_0x10a0('0x14')](_0x10a0('0x32'),_0x37939c[_0x10a0('0x6')]),_0x4143a6);}};exports[_0x10a0('0x33')]=function(_0x1e4f22){try{if(!_[_0x10a0('0x1f')](channels[_0x1e4f22[_0x10a0('0x34')]])){utils['debug'](util['format']('[%s][calls][attendedtransfer]',_0x1e4f22[_0x10a0('0x35')]),_0x1e4f22);if(channels[_0x1e4f22[_0x10a0('0x34')]]['channel']==_0x1e4f22[_0x10a0('0x36')]){utils[_0x10a0('0x8')](util[_0x10a0('0x14')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1e4f22[_0x10a0('0x35')],_0x1e4f22[_0x10a0('0x34')],_0x1e4f22[_0x10a0('0x37')]));channels[_0x1e4f22[_0x10a0('0x34')]]['destinationchannel']=_0x1e4f22[_0x10a0('0x37')];channels[_0x1e4f22['localtwolinkedid']]['userfield']='_attended';}else if(channels[_0x1e4f22[_0x10a0('0x34')]]['channel']=_0x1e4f22['transfertargetchannel']){utils[_0x10a0('0x8')](util['format'](_0x10a0('0x38'),_0x1e4f22['origtransfereruniqueid'],_0x1e4f22[_0x10a0('0x34')],_0x1e4f22[_0x10a0('0x39')]));channels[_0x1e4f22[_0x10a0('0x34')]][_0x10a0('0x26')]=_0x1e4f22[_0x10a0('0x39')];channels[_0x1e4f22['localtwolinkedid']][_0x10a0('0x3a')]=_0x10a0('0x3b');}}}catch(_0x59e29a){utils[_0x10a0('0x1c')](util['format'](_0x10a0('0x3c'),_0x1e4f22[_0x10a0('0x35')]),_0x59e29a);}};exports[_0x10a0('0x3d')]=function(_0x432bf9){try{if(!_[_0x10a0('0x1f')](channels[_0x432bf9['uniqueid']])){utils[_0x10a0('0x13')](util[_0x10a0('0x14')](_0x10a0('0x3e'),_0x432bf9[_0x10a0('0x6')]),_0x432bf9);channels[_0x432bf9[_0x10a0('0x6')]][_0x10a0('0x3f')]=utils[_0x10a0('0x1a')]();utils['info'](util[_0x10a0('0x14')](_0x10a0('0x40'),_0x432bf9[_0x10a0('0x6')],channels[_0x432bf9[_0x10a0('0x6')]][_0x10a0('0x3f')]));}}catch(_0x467544){utils['error'](util[_0x10a0('0x14')](_0x10a0('0x3e'),_0x432bf9[_0x10a0('0x6')]),_0x467544);}};exports[_0x10a0('0x41')]=function(_0x2e24d6){try{if(!_['isNil'](channels[_0x2e24d6[_0x10a0('0x6')]])){utils['debug'](util[_0x10a0('0x14')](_0x10a0('0x42'),_0x2e24d6['uniqueid']),_0x2e24d6);if(!_[_0x10a0('0x1f')](channels[_0x2e24d6[_0x10a0('0x6')]][_0x10a0('0x3f')])){channels[_0x2e24d6['uniqueid']][_0x10a0('0x43')]+=utils[_0x10a0('0x2f')](utils[_0x10a0('0x1a')](),channels[_0x2e24d6[_0x10a0('0x6')]][_0x10a0('0x3f')]);utils[_0x10a0('0x8')](util[_0x10a0('0x14')](_0x10a0('0x44'),_0x2e24d6['uniqueid'],channels[_0x2e24d6[_0x10a0('0x6')]][_0x10a0('0x43')]));delete channels[_0x2e24d6[_0x10a0('0x6')]][_0x10a0('0x3f')];}}}catch(_0x4c87a8){utils[_0x10a0('0x1c')](util['format'](_0x10a0('0x42'),_0x2e24d6['uniqueid']),_0x4c87a8);}};exports['varset']=function(_0xe62fd){try{if(!_[_0x10a0('0x1f')](channels[_0xe62fd[_0x10a0('0x6')]])){utils[_0x10a0('0x13')](util[_0x10a0('0x14')](_0x10a0('0x45'),_0xe62fd[_0x10a0('0x6')]),_0xe62fd);if(!_[_0x10a0('0x1f')](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x47')])){utils['info'](util[_0x10a0('0x14')](_0x10a0('0x48'),_0xe62fd[_0x10a0('0x6')],_0xe62fd['value']));channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x49')]=_0xe62fd[_0x10a0('0x4a')];}if(!_['isNil'](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x4b')])){utils[_0x10a0('0x8')](util[_0x10a0('0x14')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0xe62fd['uniqueid'],_0xe62fd[_0x10a0('0x4a')]));channels[_0xe62fd['uniqueid']]['destination']=_0xe62fd[_0x10a0('0x4a')];channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x2b')]='\x22'+_0xe62fd[_0x10a0('0x4a')]+_0x10a0('0x4c')+_0xe62fd[_0x10a0('0x4a')]+'>';}if(!_[_0x10a0('0x1f')](_0xe62fd['variable'][_0x10a0('0x4d')])||!_['isNil'](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x4e')])){utils[_0x10a0('0x8')](util[_0x10a0('0x14')](_0x10a0('0x4f'),_0xe62fd['uniqueid'],!_['isNil'](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x4d')])?_0x10a0('0x4d'):'xmd-callerid',_0xe62fd['value']));channels[_0xe62fd[_0x10a0('0x6')]]['callerid']=_0xe62fd[_0x10a0('0x4a')];}if(!_['isNil'](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x50')])||!_[_0x10a0('0x1f')](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x51')])){utils['info'](util[_0x10a0('0x14')](_0x10a0('0x4f'),_0xe62fd[_0x10a0('0x6')],!_[_0x10a0('0x1f')](_0xe62fd['variable'][_0x10a0('0x50')])?'xmd-queue':_0x10a0('0x51'),_0xe62fd[_0x10a0('0x4a')]));channels[_0xe62fd['uniqueid']]['lastapplication']='Queue';channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x52')]=_0xe62fd[_0x10a0('0x4a')];channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x53')]=!![];}if(!_[_0x10a0('0x1f')](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x54')])){utils[_0x10a0('0x8')](util[_0x10a0('0x14')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xe62fd[_0x10a0('0x6')],_0xe62fd['value']));channels[_0xe62fd['uniqueid']][_0x10a0('0x55')]=_0xe62fd['value'];}if(!_['isNil'](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x56')])){utils[_0x10a0('0x8')](util[_0x10a0('0x14')](_0x10a0('0x57'),_0xe62fd['uniqueid'],_0xe62fd[_0x10a0('0x4a')]));channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x58')]=_0xe62fd[_0x10a0('0x4a')];}if(!_['isNil'](_0xe62fd['variable'][_0x10a0('0x59')])){utils['info'](util['format'](_0x10a0('0x5a'),_0xe62fd['uniqueid'],_0xe62fd[_0x10a0('0x4a')]));channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x5b')]=_0xe62fd[_0x10a0('0x4a')];}if(!_[_0x10a0('0x1f')](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x5c')])){utils[_0x10a0('0x8')](util[_0x10a0('0x14')](_0x10a0('0x5d'),_0xe62fd[_0x10a0('0x6')],_0xe62fd[_0x10a0('0x4a')]));channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x5c')]=_0xe62fd[_0x10a0('0x4a')];}}}catch(_0xb492ca){utils[_0x10a0('0x1c')](util[_0x10a0('0x14')](_0x10a0('0x45'),_0xe62fd[_0x10a0('0x6')]),_0xb492ca);}};exports[_0x10a0('0x5e')]=function(_0x178ecf){try{if(!_[_0x10a0('0x1f')](channels[_0x178ecf[_0x10a0('0x6')]])){utils['debug'](util[_0x10a0('0x14')]('[%s][calls][newexten]',_0x178ecf['uniqueid']),_0x178ecf);utils[_0x10a0('0x8')](util['format'](_0x10a0('0x5f'),_0x178ecf['uniqueid'],_0x178ecf[_0x10a0('0x60')],_0x178ecf['appdata']));if(_0x178ecf[_0x10a0('0x60')][_0x10a0('0x61')]()=='set'&&_[_0x10a0('0x62')](_0x178ecf[_0x10a0('0x63')]['toLowerCase'](),'cdr')){var _0x2e2b23=_0x178ecf[_0x10a0('0x63')][_0x10a0('0x64')]('=');var _0x23bd13=_0x2e2b23[0x0]['substring'](_0x2e2b23[0x0][_0x10a0('0x65')]('(')+0x1,_0x2e2b23[0x0]['lastIndexOf'](')'));var _0xa17824=_0x2e2b23[0x1];channels[_0x178ecf[_0x10a0('0x6')]][_0x23bd13]=_0xa17824;}if(!_[_0x10a0('0x66')](['hangup',_0x10a0('0x67'),'execif','set','gotoif'],_0x178ecf[_0x10a0('0x60')][_0x10a0('0x61')]())){channels[_0x178ecf['uniqueid']]['lastapplication']=_0x178ecf['application'];channels[_0x178ecf[_0x10a0('0x6')]][_0x10a0('0x52')]=_0x178ecf['appdata'];}}}catch(_0x159274){utils[_0x10a0('0x1c')](util[_0x10a0('0x14')](_0x10a0('0x68'),_0x178ecf[_0x10a0('0x6')]),_0x159274);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index eb7093d..5f05553 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 _0x69a2=['fullybooted','error','close','./utils','connect','info','shutdown','[core]\x20shutdown'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x69a2,0x16b));var _0x269a=function(_0x1f2461,_0xefc187){_0x1f2461=_0x1f2461-0x0;var _0x38ad6a=_0x69a2[_0x1f2461];return _0x38ad6a;};'use strict';var utils=require(_0x269a('0x0'));exports[_0x269a('0x1')]=function(){utils[_0x269a('0x2')]('[core]\x20connected');};exports[_0x269a('0x3')]=function(){utils[_0x269a('0x2')](_0x269a('0x4'));};exports[_0x269a('0x5')]=function(){utils[_0x269a('0x2')]('[core]\x20fullybooted');};exports[_0x269a('0x6')]=function(_0x35858e){utils[_0x269a('0x6')]('[core]\x20error',_0x35858e);};exports[_0x269a('0x7')]=function(){utils[_0x269a('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x980964){}; \ No newline at end of file +var _0xd9aa=['[core]\x20connected','[core]\x20shutdown','fullybooted','error','[core]\x20close','./utils','info'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xd9aa,0x75));var _0xad9a=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xd9aa[_0x35885a];return _0xe86249;};'use strict';var utils=require(_0xad9a('0x0'));exports['connect']=function(){utils[_0xad9a('0x1')](_0xad9a('0x2'));};exports['shutdown']=function(){utils[_0xad9a('0x1')](_0xad9a('0x3'));};exports[_0xad9a('0x4')]=function(){utils[_0xad9a('0x1')]('[core]\x20fullybooted');};exports[_0xad9a('0x5')]=function(_0x116f09){utils['error']('[core]\x20error',_0x116f09);};exports['close']=function(){utils['info'](_0xad9a('0x6'));};exports['managerevent']=function(_0x488ae0){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 80acdd9..7caccc4 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 _0x682f=['dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','starttime','billableseconds','util','./utils','info','format','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','split','error','[%s][dials][newexten]','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','[%s][dials][varset]'];(function(_0x1e0567,_0x2979ab){var _0x157968=function(_0x499991){while(--_0x499991){_0x1e0567['push'](_0x1e0567['shift']());}};_0x157968(++_0x2979ab);}(_0x682f,0x117));var _0xf682=function(_0x914ad7,_0x32d15e){_0x914ad7=_0x914ad7-0x0;var _0x2fadc1=_0x682f[_0x914ad7];return _0x2fadc1;};'use strict';var _=require('lodash');var util=require(_0xf682('0x0'));var utils=require(_0xf682('0x1'));var dials={};function writeDB(_0x1d2638){utils[_0xf682('0x2')](util[_0xf682('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x1d2638[_0xf682('0x4')],_0x1d2638['channel'],_0x1d2638[_0xf682('0x5')],_0x1d2638[_0xf682('0x6')],_0x1d2638[_0xf682('0x7')],_0x1d2638[_0xf682('0x8')]));utils[_0xf682('0x9')](_0xf682('0xa'),_0x1d2638);delete dials[_0x1d2638[_0xf682('0x4')]];}exports[_0xf682('0xb')]=function(_0x3dbd18){try{utils[_0xf682('0xc')](util[_0xf682('0x3')]('[%s][dials][newexten]',_0x3dbd18['uniqueid']),_0x3dbd18);utils[_0xf682('0x2')](util[_0xf682('0x3')](_0xf682('0xd'),_0x3dbd18[_0xf682('0x4')],_0x3dbd18['application'],_0x3dbd18['appdata']));if(_0x3dbd18[_0xf682('0xe')][_0xf682('0xf')]()==_0xf682('0x10')&&_['startsWith'](_0x3dbd18['appdata'][_0xf682('0xf')](),'cdr(routeid)')){var _0x281faa=_0x3dbd18[_0xf682('0x11')][_0xf682('0x12')]('=');dials[_0x3dbd18[_0xf682('0x4')]]={'routeId':_0x281faa[0x1]};}}catch(_0x4c677d){utils[_0xf682('0x13')](util[_0xf682('0x3')](_0xf682('0x14'),_0x3dbd18[_0xf682('0x4')]),_0x4c677d);}};exports[_0xf682('0x15')]=function(_0x5a6b30){try{utils[_0xf682('0xc')](util[_0xf682('0x3')]('[%s][dials][varset]',_0x5a6b30[_0xf682('0x4')]),_0x5a6b30);if(!_[_0xf682('0x16')](_0x5a6b30[_0xf682('0x17')][_0xf682('0x18')])){utils[_0xf682('0x2')](util[_0xf682('0x3')](_0xf682('0x19'),_0x5a6b30[_0xf682('0x4')],_0x5a6b30['value']));dials[_0x5a6b30[_0xf682('0x4')]]={'routeId':_0x5a6b30['value']};}}catch(_0x41b424){utils[_0xf682('0x13')](util[_0xf682('0x3')](_0xf682('0x1a'),_0x5a6b30[_0xf682('0x4')]),_0x41b424);}};exports[_0xf682('0x1b')]=function(_0x2e6f91){try{if(!_[_0xf682('0x16')](dials[_0x2e6f91[_0xf682('0x4')]])){utils[_0xf682('0xc')](util[_0xf682('0x3')](_0xf682('0x1c'),_0x2e6f91[_0xf682('0x4')]),_0x2e6f91);dials[_0x2e6f91[_0xf682('0x4')]]=_[_0xf682('0x1d')](dials[_0x2e6f91[_0xf682('0x4')]],_0x2e6f91);dials[_0x2e6f91[_0xf682('0x4')]]['starttime']=utils[_0xf682('0x1e')]();dials[_0x2e6f91['uniqueid']][_0xf682('0x1f')]=_0xf682('0x20');utils[_0xf682('0x2')](util[_0xf682('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x2e6f91[_0xf682('0x4')],dials[_0x2e6f91['uniqueid']]['starttime']));}}catch(_0x97cf7f){utils[_0xf682('0x13')](util[_0xf682('0x3')]('[%s][dials][dialbegin]',_0x2e6f91[_0xf682('0x4')]),_0x97cf7f);}};exports[_0xf682('0x21')]=function(_0xa1954b){try{if(!_[_0xf682('0x16')](dials[_0xa1954b['uniqueid']])){utils[_0xf682('0xc')](util[_0xf682('0x3')](_0xf682('0x22'),_0xa1954b[_0xf682('0x4')]),_0xa1954b);dials[_0xa1954b[_0xf682('0x4')]][_0xf682('0x8')]=_0xa1954b['dialstatus'];if(_0xa1954b['dialstatus']==_0xf682('0x23')){dials[_0xa1954b['uniqueid']]=_['assign'](dials[_0xa1954b[_0xf682('0x4')]],_0xa1954b);dials[_0xa1954b[_0xf682('0x4')]][_0xf682('0x24')]=utils[_0xf682('0x1e')]();dials[_0xa1954b[_0xf682('0x4')]][_0xf682('0x1f')]=_0xf682('0x25');utils[_0xf682('0x2')](util[_0xf682('0x3')](_0xf682('0x26'),_0xa1954b[_0xf682('0x4')],_0xa1954b[_0xf682('0x8')],dials[_0xa1954b[_0xf682('0x4')]][_0xf682('0x24')]));}else{utils[_0xf682('0x2')](util['format'](_0xf682('0x27'),_0xa1954b[_0xf682('0x4')],_0xa1954b[_0xf682('0x8')]));}}}catch(_0x43201e){utils[_0xf682('0x13')](util[_0xf682('0x3')](_0xf682('0x22'),_0xa1954b[_0xf682('0x4')]),_0x43201e);}};exports[_0xf682('0x28')]=function(_0x574f13){try{if(!_[_0xf682('0x16')](dials[_0x574f13[_0xf682('0x4')]])){utils['debug'](util[_0xf682('0x3')](_0xf682('0x29'),_0x574f13[_0xf682('0x4')]),_0x574f13);utils[_0xf682('0x2')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x574f13[_0xf682('0x4')],_0x574f13['calleridnum'],_0x574f13[_0xf682('0x2a')],_0x574f13[_0xf682('0x2b')]));dials[_0x574f13[_0xf682('0x4')]]=_[_0xf682('0x1d')](dials[_0x574f13[_0xf682('0x4')]],{'endtime':utils[_0xf682('0x1e')](),'lastevent':_0xf682('0x2c')});dials[_0x574f13[_0xf682('0x4')]][_0xf682('0x2d')]=utils[_0xf682('0x2e')](dials[_0x574f13[_0xf682('0x4')]]['endtime'],dials[_0x574f13[_0xf682('0x4')]]['starttime']);dials[_0x574f13[_0xf682('0x4')]][_0xf682('0x2f')]=utils[_0xf682('0x2e')](dials[_0x574f13[_0xf682('0x4')]]['answertime']||dials[_0x574f13['uniqueid']][_0xf682('0x30')],dials[_0x574f13[_0xf682('0x4')]][_0xf682('0x31')]);dials[_0x574f13[_0xf682('0x4')]][_0xf682('0x32')]=dials[_0x574f13[_0xf682('0x4')]][_0xf682('0x24')]?utils['diffTime'](dials[_0x574f13[_0xf682('0x4')]][_0xf682('0x30')],dials[_0x574f13[_0xf682('0x4')]]['answertime']):0x0;writeDB(dials[_0x574f13[_0xf682('0x4')]]);}}catch(_0x4fa1ba){utils[_0xf682('0x13')](util['format']('[%s][dials][hangup]',_0x574f13[_0xf682('0x4')]),_0x4fa1ba);}}; \ No newline at end of file +var _0xda24=['[%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','cause-txt','complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','uniqueid','channel','dialstring','calleridnum','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','error','varset','[%s][dials][varset]','variable','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','dialstatus','answertime'];(function(_0x561159,_0x2063fe){var _0x5a71a3=function(_0x2e8712){while(--_0x2e8712){_0x561159['push'](_0x561159['shift']());}};_0x5a71a3(++_0x2063fe);}(_0xda24,0x15b));var _0x4da2=function(_0x5b57ae,_0x31bac6){_0x5b57ae=_0x5b57ae-0x0;var _0x1877c2=_0xda24[_0x5b57ae];return _0x1877c2;};'use strict';var _=require(_0x4da2('0x0'));var util=require(_0x4da2('0x1'));var utils=require(_0x4da2('0x2'));var dials={};function writeDB(_0x554085){utils[_0x4da2('0x3')](util[_0x4da2('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x554085[_0x4da2('0x5')],_0x554085[_0x4da2('0x6')],_0x554085[_0x4da2('0x7')],_0x554085[_0x4da2('0x8')],_0x554085['connectedlinenum'],_0x554085['dialstatus']));utils[_0x4da2('0x9')](_0x4da2('0xa'),_0x554085);delete dials[_0x554085[_0x4da2('0x5')]];}exports['newexten']=function(_0x2bcfa6){try{utils[_0x4da2('0xb')](util[_0x4da2('0x4')](_0x4da2('0xc'),_0x2bcfa6['uniqueid']),_0x2bcfa6);utils[_0x4da2('0x3')](util[_0x4da2('0x4')](_0x4da2('0xd'),_0x2bcfa6[_0x4da2('0x5')],_0x2bcfa6[_0x4da2('0xe')],_0x2bcfa6[_0x4da2('0xf')]));if(_0x2bcfa6['application'][_0x4da2('0x10')]()==_0x4da2('0x11')&&_['startsWith'](_0x2bcfa6[_0x4da2('0xf')][_0x4da2('0x10')](),'cdr(routeid)')){var _0x4ca073=_0x2bcfa6[_0x4da2('0xf')][_0x4da2('0x12')]('=');dials[_0x2bcfa6[_0x4da2('0x5')]]={'routeId':_0x4ca073[0x1]};}}catch(_0x1f0498){utils[_0x4da2('0x13')](util['format'](_0x4da2('0xc'),_0x2bcfa6['uniqueid']),_0x1f0498);}};exports[_0x4da2('0x14')]=function(_0x45b42f){try{utils[_0x4da2('0xb')](util[_0x4da2('0x4')](_0x4da2('0x15'),_0x45b42f['uniqueid']),_0x45b42f);if(!_['isNil'](_0x45b42f[_0x4da2('0x16')]['outboundrouteid'])){utils[_0x4da2('0x3')](util[_0x4da2('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x45b42f['uniqueid'],_0x45b42f[_0x4da2('0x17')]));dials[_0x45b42f[_0x4da2('0x5')]]={'routeId':_0x45b42f['value']};}}catch(_0x3765c2){utils['error'](util[_0x4da2('0x4')](_0x4da2('0x15'),_0x45b42f[_0x4da2('0x5')]),_0x3765c2);}};exports[_0x4da2('0x18')]=function(_0x2caa2f){try{if(!_[_0x4da2('0x19')](dials[_0x2caa2f[_0x4da2('0x5')]])){utils[_0x4da2('0xb')](util['format'](_0x4da2('0x1a'),_0x2caa2f['uniqueid']),_0x2caa2f);dials[_0x2caa2f[_0x4da2('0x5')]]=_[_0x4da2('0x1b')](dials[_0x2caa2f[_0x4da2('0x5')]],_0x2caa2f);dials[_0x2caa2f[_0x4da2('0x5')]]['starttime']=utils[_0x4da2('0x1c')]();dials[_0x2caa2f[_0x4da2('0x5')]][_0x4da2('0x1d')]=_0x4da2('0x1e');utils[_0x4da2('0x3')](util[_0x4da2('0x4')](_0x4da2('0x1f'),_0x2caa2f[_0x4da2('0x5')],dials[_0x2caa2f[_0x4da2('0x5')]][_0x4da2('0x20')]));}}catch(_0x4f62e9){utils[_0x4da2('0x13')](util[_0x4da2('0x4')]('[%s][dials][dialbegin]',_0x2caa2f['uniqueid']),_0x4f62e9);}};exports[_0x4da2('0x21')]=function(_0x25f49c){try{if(!_[_0x4da2('0x19')](dials[_0x25f49c[_0x4da2('0x5')]])){utils[_0x4da2('0xb')](util['format'](_0x4da2('0x22'),_0x25f49c[_0x4da2('0x5')]),_0x25f49c);dials[_0x25f49c[_0x4da2('0x5')]][_0x4da2('0x23')]=_0x25f49c[_0x4da2('0x23')];if(_0x25f49c[_0x4da2('0x23')]=='ANSWER'){dials[_0x25f49c[_0x4da2('0x5')]]=_[_0x4da2('0x1b')](dials[_0x25f49c['uniqueid']],_0x25f49c);dials[_0x25f49c[_0x4da2('0x5')]][_0x4da2('0x24')]=utils['now']();dials[_0x25f49c['uniqueid']]['lastevent']='connect';utils[_0x4da2('0x3')](util[_0x4da2('0x4')](_0x4da2('0x25'),_0x25f49c['uniqueid'],_0x25f49c[_0x4da2('0x23')],dials[_0x25f49c[_0x4da2('0x5')]][_0x4da2('0x24')]));}else{utils['info'](util[_0x4da2('0x4')](_0x4da2('0x26'),_0x25f49c['uniqueid'],_0x25f49c['dialstatus']));}}}catch(_0x5ec4f8){utils[_0x4da2('0x13')](util['format'](_0x4da2('0x22'),_0x25f49c[_0x4da2('0x5')]),_0x5ec4f8);}};exports['hangup']=function(_0x34176e){try{if(!_[_0x4da2('0x19')](dials[_0x34176e[_0x4da2('0x5')]])){utils[_0x4da2('0xb')](util['format'](_0x4da2('0x27'),_0x34176e[_0x4da2('0x5')]),_0x34176e);utils['info'](util['format'](_0x4da2('0x28'),_0x34176e[_0x4da2('0x5')],_0x34176e[_0x4da2('0x8')],_0x34176e[_0x4da2('0x29')],_0x34176e[_0x4da2('0x2a')]));dials[_0x34176e[_0x4da2('0x5')]]=_[_0x4da2('0x1b')](dials[_0x34176e[_0x4da2('0x5')]],{'endtime':utils[_0x4da2('0x1c')](),'lastevent':_0x4da2('0x2b')});dials[_0x34176e['uniqueid']][_0x4da2('0x2c')]=utils[_0x4da2('0x2d')](dials[_0x34176e[_0x4da2('0x5')]][_0x4da2('0x2e')],dials[_0x34176e[_0x4da2('0x5')]][_0x4da2('0x20')]);dials[_0x34176e[_0x4da2('0x5')]]['holdtime']=utils['diffTime'](dials[_0x34176e['uniqueid']][_0x4da2('0x24')]||dials[_0x34176e[_0x4da2('0x5')]][_0x4da2('0x2e')],dials[_0x34176e['uniqueid']][_0x4da2('0x20')]);dials[_0x34176e[_0x4da2('0x5')]][_0x4da2('0x2f')]=dials[_0x34176e[_0x4da2('0x5')]][_0x4da2('0x24')]?utils[_0x4da2('0x2d')](dials[_0x34176e[_0x4da2('0x5')]][_0x4da2('0x2e')],dials[_0x34176e['uniqueid']]['answertime']):0x0;writeDB(dials[_0x34176e['uniqueid']]);}}catch(_0x2d8e9d){utils[_0x4da2('0x13')](util['format'](_0x4da2('0x27'),_0x34176e[_0x4da2('0x5')]),_0x2d8e9d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index b1d75da..dceeb48 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 _0x7426=['port','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','[%s][index][agentcalled]','uniqueid','agentcalled','[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','env','production','local'];(function(_0x41beef,_0x9b28d4){var _0x453bf1=function(_0xc36645){while(--_0xc36645){_0x41beef['push'](_0x41beef['shift']());}};_0x453bf1(++_0x9b28d4);}(_0x7426,0x118));var _0x6742=function(_0x500cd8,_0x1df0a5){_0x500cd8=_0x500cd8-0x0;var _0x2cc571=_0x7426[_0x500cd8];return _0x2cc571;};var AsteriskManager=require(_0x6742('0x0'));var config=require(_0x6742('0x1'));var utils=require(_0x6742('0x2'));var util=require('util');var isXDREnabled=config[_0x6742('0x3')]&&config[_0x6742('0x3')][_0x6742('0x4')]?!config['xdr'][_0x6742('0x4')]:!![];var isProduction=config[_0x6742('0x5')]===_0x6742('0x6')||![];var isLocalAsterisk=config[_0x6742('0x3')]&&config[_0x6742('0x3')][_0x6742('0x7')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x6742('0x8')],config[_0x6742('0x9')]['ip'],config[_0x6742('0x9')][_0x6742('0xa')],config['asterisk'][_0x6742('0xb')],!![]);ami[_0x6742('0xc')]();if(!isXDREnabled){utils[_0x6742('0xd')](_0x6742('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x6742('0xd')](_0x6742('0xf'));}else{var agents=require('./agents.controller');var calls=require(_0x6742('0x10'));var queues=require(_0x6742('0x11'));var recordings=require('./recordings.controller');var members=require(_0x6742('0x12'));var dials=require(_0x6742('0x13'));var transfers=require(_0x6742('0x14'));var core=require(_0x6742('0x15'));ami['on'](_0x6742('0x16'),core[_0x6742('0x16')]);ami['on'](_0x6742('0x17'),core['shutdown']);ami['on'](_0x6742('0x18'),core[_0x6742('0x18')]);ami['on'](_0x6742('0x19'),core['error']);ami['on'](_0x6742('0x1a'),core[_0x6742('0x1a')]);ami['on']('managerevent',core[_0x6742('0x1b')]);ami['on'](_0x6742('0x1c'),function(_0x5a0d8e){try{utils[_0x6742('0x1d')](util['format'](_0x6742('0x1e'),_0x5a0d8e[_0x6742('0x1f')]),_0x5a0d8e);members[_0x6742('0x1c')](_0x5a0d8e);}catch(_0x224892){utils[_0x6742('0x19')](util['format'](_0x6742('0x1e'),_0x5a0d8e[_0x6742('0x1f')]),_0x224892);}});ami['on']('agentcalled',function(_0x1e9583){try{utils['debug'](util[_0x6742('0x20')](_0x6742('0x21'),_0x1e9583[_0x6742('0x22')]),_0x1e9583);agents[_0x6742('0x23')](_0x1e9583);}catch(_0x1368c2){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x21'),_0x1e9583[_0x6742('0x22')]),_0x1368c2);}});ami['on']('agentringnoanswer',function(_0x54396f){try{utils['debug'](util[_0x6742('0x20')](_0x6742('0x24'),_0x54396f[_0x6742('0x22')]),_0x54396f);agents[_0x6742('0x25')](_0x54396f);}catch(_0x29fbc8){utils['error'](util[_0x6742('0x20')](_0x6742('0x24'),_0x54396f['uniqueid']),_0x29fbc8);}});ami['on']('agentconnect',function(_0x3ebdf9){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')](_0x6742('0x26'),_0x3ebdf9[_0x6742('0x22')]),_0x3ebdf9);agents[_0x6742('0x27')](_0x3ebdf9);queues['agentconnect'](_0x3ebdf9);}catch(_0x5f0a69){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x26'),_0x3ebdf9[_0x6742('0x22')]),_0x5f0a69);}});ami['on'](_0x6742('0x28'),function(_0x5d2821){try{utils[_0x6742('0x1d')](util['format'](_0x6742('0x29'),_0x5d2821[_0x6742('0x22')]),_0x5d2821);agents[_0x6742('0x28')](_0x5d2821);queues[_0x6742('0x28')](_0x5d2821);members[_0x6742('0x28')](_0x5d2821);}catch(_0x3d93d0){utils[_0x6742('0x19')](util[_0x6742('0x20')]('[%s][index][agentcomplete]',_0x5d2821[_0x6742('0x22')]),_0x3d93d0);}});ami['on']('queuecallerabandon',function(_0x39b5b8){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')]('[%s][index][queuecallerabandon]',_0x39b5b8['uniqueid']),_0x39b5b8);agents[_0x6742('0x2a')](_0x39b5b8);queues[_0x6742('0x2a')](_0x39b5b8);}catch(_0x60f76f){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x2b'),_0x39b5b8[_0x6742('0x22')]),_0x60f76f);}});ami['on'](_0x6742('0x2c'),function(_0x49155d){try{utils['debug'](util[_0x6742('0x20')](_0x6742('0x2d'),_0x49155d[_0x6742('0x22')]),_0x49155d);queues['queuecallerjoin'](_0x49155d);recordings['queuecallerjoin'](_0x49155d);}catch(_0x675a6c){utils['error'](util['format'](_0x6742('0x2d'),_0x49155d[_0x6742('0x22')]),_0x675a6c);}});ami['on'](_0x6742('0x2e'),function(_0x21a440){try{utils[_0x6742('0x1d')](util['format'](_0x6742('0x2f'),_0x21a440[_0x6742('0x22')]),_0x21a440);queues[_0x6742('0x2e')](_0x21a440);}catch(_0x201d06){utils[_0x6742('0x19')](util['format'](_0x6742('0x2f'),_0x21a440[_0x6742('0x22')]),_0x201d06);}});ami['on'](_0x6742('0x30'),function(_0x26aac6){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')](_0x6742('0x31'),_0x26aac6['uniqueid']),_0x26aac6);queues['musiconholdstart'](_0x26aac6);calls[_0x6742('0x30')](_0x26aac6);}catch(_0x22a832){utils[_0x6742('0x19')](util['format'](_0x6742('0x31'),_0x26aac6[_0x6742('0x22')]),_0x22a832);}});ami['on'](_0x6742('0x32'),function(_0x372c34){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')]('[%s][index][musiconholdstop]',_0x372c34[_0x6742('0x22')]),_0x372c34);queues['musiconholdstop'](_0x372c34);calls[_0x6742('0x32')](_0x372c34);}catch(_0x56011b){utils['error'](util[_0x6742('0x20')](_0x6742('0x33'),_0x372c34['uniqueid']),_0x56011b);}});ami['on'](_0x6742('0x34'),function(_0x319f71){try{utils['debug'](util[_0x6742('0x20')]('[%s][index][newstate]',_0x319f71[_0x6742('0x22')]),_0x319f71);calls[_0x6742('0x34')](_0x319f71);recordings[_0x6742('0x34')](_0x319f71);}catch(_0x1e169b){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x35'),_0x319f71[_0x6742('0x22')]),_0x1e169b);}});ami['on'](_0x6742('0x36'),function(_0x1b61ba){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')](_0x6742('0x37'),_0x1b61ba[_0x6742('0x22')]),_0x1b61ba);calls[_0x6742('0x36')](_0x1b61ba);recordings['hangup'](_0x1b61ba);dials[_0x6742('0x36')](_0x1b61ba);agents[_0x6742('0x36')](_0x1b61ba);queues[_0x6742('0x36')](_0x1b61ba);}catch(_0x36cdc3){utils['error'](util[_0x6742('0x20')]('[%s][index][hangup]',_0x1b61ba[_0x6742('0x22')]),_0x36cdc3);}});ami['on'](_0x6742('0x38'),function(_0x41467f){try{utils[_0x6742('0x1d')](util['format'](_0x6742('0x39'),_0x41467f[_0x6742('0x22')]),_0x41467f);members[_0x6742('0x38')](_0x41467f);}catch(_0x30fe65){utils[_0x6742('0x19')](util['format'](_0x6742('0x39'),_0x41467f[_0x6742('0x22')]),_0x30fe65);}});ami['on'](_0x6742('0x3a'),function(_0x27b892){try{utils['debug'](util[_0x6742('0x20')](_0x6742('0x3b'),_0x27b892['uniqueid']),_0x27b892);queues[_0x6742('0x3a')](_0x27b892);agents[_0x6742('0x3a')](_0x27b892);transfers[_0x6742('0x3a')](_0x27b892);recordings[_0x6742('0x3a')](_0x27b892);}catch(_0x310d64){utils[_0x6742('0x19')](util['format'](_0x6742('0x3b'),_0x27b892[_0x6742('0x22')]),_0x310d64);}});ami['on']('attendedtransfer',function(_0x3b1c39){try{utils['debug'](util['format'](_0x6742('0x3c'),_0x3b1c39[_0x6742('0x3d')]),_0x3b1c39);queues[_0x6742('0x3e')](_0x3b1c39);transfers[_0x6742('0x3e')](_0x3b1c39);agents[_0x6742('0x3e')](_0x3b1c39);calls[_0x6742('0x3e')](_0x3b1c39);}catch(_0x6580cf){utils[_0x6742('0x19')](util[_0x6742('0x20')]('[%s][index][attendedtransfer]',_0x3b1c39[_0x6742('0x3d')]),_0x6580cf);}});ami['on'](_0x6742('0x3f'),function(_0x59546b){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')](_0x6742('0x40'),_0x59546b['uniqueid']),_0x59546b);queues[_0x6742('0x3f')](_0x59546b);recordings[_0x6742('0x3f')](_0x59546b);calls[_0x6742('0x3f')](_0x59546b);dials[_0x6742('0x3f')](_0x59546b);}catch(_0x13566e){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x40'),_0x59546b[_0x6742('0x22')]),_0x13566e);}});ami['on']('newexten',function(_0x1116a4){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')]('[%s][index][newexten]',_0x1116a4['uniqueid']),_0x1116a4);calls[_0x6742('0x41')](_0x1116a4);recordings[_0x6742('0x41')](_0x1116a4);dials[_0x6742('0x41')](_0x1116a4);}catch(_0x3fdf34){utils[_0x6742('0x19')](util[_0x6742('0x20')]('[%s][index][newexten]',_0x1116a4[_0x6742('0x22')]),_0x3fdf34);}});ami['on'](_0x6742('0x42'),function(_0x282bdf){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')](_0x6742('0x43'),_0x282bdf[_0x6742('0x22')]),_0x282bdf);calls[_0x6742('0x42')](_0x282bdf);recordings[_0x6742('0x42')](_0x282bdf);}catch(_0x54fa06){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x43'),_0x282bdf['uniqueid']),_0x54fa06);}});ami['on']('dialbegin',function(_0x54c164){try{utils['debug'](util[_0x6742('0x20')](_0x6742('0x44'),_0x54c164['uniqueid']),_0x54c164);dials[_0x6742('0x45')](_0x54c164);}catch(_0xda087b){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x46'),_0x54c164['uniqueid']),_0xda087b);}});ami['on']('dialend',function(_0x10efa3){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')](_0x6742('0x47'),_0x10efa3[_0x6742('0x22')]),_0x10efa3);dials['dialend'](_0x10efa3);}catch(_0x2e5cf3){utils['error'](util['format'](_0x6742('0x47'),_0x10efa3['uniqueid']),_0x2e5cf3);}});} \ No newline at end of file +var _0x3220=['keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./transfers.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','error','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','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]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','util','xdr','disabled','env','local','asterisk','port','username','password'];(function(_0xd70e5e,_0x25fdd0){var _0x3ec256=function(_0x3e9fc3){while(--_0x3e9fc3){_0xd70e5e['push'](_0xd70e5e['shift']());}};_0x3ec256(++_0x25fdd0);}(_0x3220,0x7e));var _0x0322=function(_0x1cd907,_0x5b7249){_0x1cd907=_0x1cd907-0x0;var _0x37c00d=_0x3220[_0x1cd907];return _0x37c00d;};var AsteriskManager=require('asterisk-manager');var config=require(_0x0322('0x0'));var utils=require('./utils');var util=require(_0x0322('0x1'));var isXDREnabled=config[_0x0322('0x2')]&&config['xdr'][_0x0322('0x3')]?!config[_0x0322('0x2')][_0x0322('0x3')]:!![];var isProduction=config[_0x0322('0x4')]==='production'||![];var isLocalAsterisk=config[_0x0322('0x2')]&&config[_0x0322('0x2')][_0x0322('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0x0322('0x6')][_0x0322('0x7')],config[_0x0322('0x6')]['ip'],config['asterisk'][_0x0322('0x8')],config[_0x0322('0x6')][_0x0322('0x9')],!![]);ami[_0x0322('0xa')]();if(!isXDREnabled){utils['info'](_0x0322('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x0322('0xc')](_0x0322('0xd'));}else{var agents=require(_0x0322('0xe'));var calls=require('./calls.controller');var queues=require(_0x0322('0xf'));var recordings=require(_0x0322('0x10'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x0322('0x11'));var core=require('./core.controller');ami['on'](_0x0322('0x12'),core[_0x0322('0x12')]);ami['on'](_0x0322('0x13'),core[_0x0322('0x13')]);ami['on'](_0x0322('0x14'),core[_0x0322('0x14')]);ami['on']('error',core['error']);ami['on'](_0x0322('0x15'),core[_0x0322('0x15')]);ami['on']('managerevent',core[_0x0322('0x16')]);ami['on'](_0x0322('0x17'),function(_0x986871){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x1a'),_0x986871[_0x0322('0x1b')]),_0x986871);members[_0x0322('0x17')](_0x986871);}catch(_0x11c7b2){utils[_0x0322('0x1c')](util[_0x0322('0x19')]('[%s][index][devicestatechange]',_0x986871[_0x0322('0x1b')]),_0x11c7b2);}});ami['on'](_0x0322('0x1d'),function(_0x308e33){try{utils[_0x0322('0x18')](util[_0x0322('0x19')]('[%s][index][agentcalled]',_0x308e33[_0x0322('0x1e')]),_0x308e33);agents[_0x0322('0x1d')](_0x308e33);}catch(_0x4bd2e2){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x1f'),_0x308e33[_0x0322('0x1e')]),_0x4bd2e2);}});ami['on'](_0x0322('0x20'),function(_0xc7e415){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x21'),_0xc7e415['uniqueid']),_0xc7e415);agents[_0x0322('0x20')](_0xc7e415);}catch(_0x4d5825){utils['error'](util[_0x0322('0x19')]('[%s][index][agentringnoanswer]',_0xc7e415[_0x0322('0x1e')]),_0x4d5825);}});ami['on'](_0x0322('0x22'),function(_0x201f8d){try{utils[_0x0322('0x18')](util['format'](_0x0322('0x23'),_0x201f8d[_0x0322('0x1e')]),_0x201f8d);agents[_0x0322('0x22')](_0x201f8d);queues[_0x0322('0x22')](_0x201f8d);}catch(_0x54f287){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x23'),_0x201f8d[_0x0322('0x1e')]),_0x54f287);}});ami['on'](_0x0322('0x24'),function(_0x217a12){try{utils['debug'](util[_0x0322('0x19')]('[%s][index][agentcomplete]',_0x217a12[_0x0322('0x1e')]),_0x217a12);agents[_0x0322('0x24')](_0x217a12);queues[_0x0322('0x24')](_0x217a12);members[_0x0322('0x24')](_0x217a12);}catch(_0x18e738){utils[_0x0322('0x1c')](util['format'](_0x0322('0x25'),_0x217a12[_0x0322('0x1e')]),_0x18e738);}});ami['on'](_0x0322('0x26'),function(_0x5f4c60){try{utils[_0x0322('0x18')](util[_0x0322('0x19')]('[%s][index][queuecallerabandon]',_0x5f4c60['uniqueid']),_0x5f4c60);agents['queuecallerabandon'](_0x5f4c60);queues['queuecallerabandon'](_0x5f4c60);}catch(_0x27a726){utils['error'](util['format']('[%s][index][queuecallerabandon]',_0x5f4c60[_0x0322('0x1e')]),_0x27a726);}});ami['on'](_0x0322('0x27'),function(_0x4b2d55){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x28'),_0x4b2d55['uniqueid']),_0x4b2d55);queues[_0x0322('0x27')](_0x4b2d55);recordings[_0x0322('0x27')](_0x4b2d55);}catch(_0x50e811){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x28'),_0x4b2d55[_0x0322('0x1e')]),_0x50e811);}});ami['on'](_0x0322('0x29'),function(_0x4c952e){try{utils['debug'](util[_0x0322('0x19')]('[%s][index][queuecallerleave]',_0x4c952e['uniqueid']),_0x4c952e);queues[_0x0322('0x29')](_0x4c952e);}catch(_0x551930){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x2a'),_0x4c952e[_0x0322('0x1e')]),_0x551930);}});ami['on'](_0x0322('0x2b'),function(_0x1937ba){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x2c'),_0x1937ba[_0x0322('0x1e')]),_0x1937ba);queues['musiconholdstart'](_0x1937ba);calls[_0x0322('0x2b')](_0x1937ba);}catch(_0x5b708e){utils['error'](util['format'](_0x0322('0x2c'),_0x1937ba[_0x0322('0x1e')]),_0x5b708e);}});ami['on']('musiconholdstop',function(_0x44c7a4){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x2d'),_0x44c7a4[_0x0322('0x1e')]),_0x44c7a4);queues[_0x0322('0x2e')](_0x44c7a4);calls[_0x0322('0x2e')](_0x44c7a4);}catch(_0x300190){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x2d'),_0x44c7a4['uniqueid']),_0x300190);}});ami['on'](_0x0322('0x2f'),function(_0x551409){try{utils[_0x0322('0x18')](util[_0x0322('0x19')]('[%s][index][newstate]',_0x551409[_0x0322('0x1e')]),_0x551409);calls[_0x0322('0x2f')](_0x551409);recordings[_0x0322('0x2f')](_0x551409);}catch(_0xedeefc){utils['error'](util[_0x0322('0x19')]('[%s][index][newstate]',_0x551409[_0x0322('0x1e')]),_0xedeefc);}});ami['on'](_0x0322('0x30'),function(_0xa57e3){try{utils[_0x0322('0x18')](util['format'](_0x0322('0x31'),_0xa57e3['uniqueid']),_0xa57e3);calls['hangup'](_0xa57e3);recordings[_0x0322('0x30')](_0xa57e3);dials[_0x0322('0x30')](_0xa57e3);agents[_0x0322('0x30')](_0xa57e3);queues[_0x0322('0x30')](_0xa57e3);}catch(_0x498bad){utils[_0x0322('0x1c')](util[_0x0322('0x19')]('[%s][index][hangup]',_0xa57e3[_0x0322('0x1e')]),_0x498bad);}});ami['on'](_0x0322('0x32'),function(_0x49725e){try{utils[_0x0322('0x18')](util[_0x0322('0x19')]('[%s][index][cdr]',_0x49725e[_0x0322('0x1e')]),_0x49725e);members['cdr'](_0x49725e);}catch(_0x3d00f2){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x33'),_0x49725e['uniqueid']),_0x3d00f2);}});ami['on'](_0x0322('0x34'),function(_0x3e1202){try{utils[_0x0322('0x18')](util['format'](_0x0322('0x35'),_0x3e1202[_0x0322('0x1e')]),_0x3e1202);queues['blindtransfer'](_0x3e1202);agents[_0x0322('0x34')](_0x3e1202);transfers['blindtransfer'](_0x3e1202);recordings['blindtransfer'](_0x3e1202);}catch(_0x2f7e96){utils['error'](util['format'](_0x0322('0x35'),_0x3e1202[_0x0322('0x1e')]),_0x2f7e96);}});ami['on'](_0x0322('0x36'),function(_0x12acaa){try{utils[_0x0322('0x18')](util['format'](_0x0322('0x37'),_0x12acaa[_0x0322('0x38')]),_0x12acaa);queues[_0x0322('0x36')](_0x12acaa);transfers[_0x0322('0x36')](_0x12acaa);agents[_0x0322('0x36')](_0x12acaa);calls[_0x0322('0x36')](_0x12acaa);}catch(_0x5d0076){utils['error'](util[_0x0322('0x19')](_0x0322('0x37'),_0x12acaa[_0x0322('0x38')]),_0x5d0076);}});ami['on'](_0x0322('0x39'),function(_0x13efb2){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x3a'),_0x13efb2[_0x0322('0x1e')]),_0x13efb2);queues['varset'](_0x13efb2);recordings[_0x0322('0x39')](_0x13efb2);calls[_0x0322('0x39')](_0x13efb2);dials['varset'](_0x13efb2);}catch(_0x47e84f){utils[_0x0322('0x1c')](util[_0x0322('0x19')]('[%s][index][varset]',_0x13efb2[_0x0322('0x1e')]),_0x47e84f);}});ami['on'](_0x0322('0x3b'),function(_0x3a59c6){try{utils['debug'](util[_0x0322('0x19')](_0x0322('0x3c'),_0x3a59c6['uniqueid']),_0x3a59c6);calls['newexten'](_0x3a59c6);recordings[_0x0322('0x3b')](_0x3a59c6);dials[_0x0322('0x3b')](_0x3a59c6);}catch(_0x28ead3){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x3c'),_0x3a59c6[_0x0322('0x1e')]),_0x28ead3);}});ami['on'](_0x0322('0x3d'),function(_0x312885){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x3e'),_0x312885[_0x0322('0x1e')]),_0x312885);calls['newchannel'](_0x312885);recordings[_0x0322('0x3d')](_0x312885);}catch(_0x2e0c3c){utils['error'](util[_0x0322('0x19')]('[%s][index][newchannel]',_0x312885['uniqueid']),_0x2e0c3c);}});ami['on'](_0x0322('0x3f'),function(_0x225011){try{utils[_0x0322('0x18')](util['format'](_0x0322('0x40'),_0x225011['uniqueid']),_0x225011);dials['dialbegin'](_0x225011);}catch(_0x3dbf35){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x41'),_0x225011[_0x0322('0x1e')]),_0x3dbf35);}});ami['on'](_0x0322('0x42'),function(_0x337f7d){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x43'),_0x337f7d[_0x0322('0x1e')]),_0x337f7d);dials[_0x0322('0x42')](_0x337f7d);}catch(_0x4d8cf3){utils[_0x0322('0x1c')](util['format'](_0x0322('0x43'),_0x337f7d['uniqueid']),_0x4d8cf3);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index aa2a8e5..5088c7b 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 _0xd5b6=['queue','[%s][members][agentcomplete]','[%s][members][cdr]','assign','data1','data2','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','destination','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','error','[%s][members][writeDB]','devicestatechange','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','debug','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s'];(function(_0x2f77ea,_0x195537){var _0x1aab38=function(_0x79ec33){while(--_0x79ec33){_0x2f77ea['push'](_0x2f77ea['shift']());}};_0x1aab38(++_0x195537);}(_0xd5b6,0x73));var _0x6d5b=function(_0x25a6dd,_0x3101b3){_0x25a6dd=_0x25a6dd-0x0;var _0xe62e7=_0xd5b6[_0x25a6dd];return _0xe62e7;};'use strict';var _=require(_0x6d5b('0x0'));var util=require(_0x6d5b('0x1'));var utils=require(_0x6d5b('0x2'));var members={};var exclude=[_0x6d5b('0x3'),_0x6d5b('0x4')];function writeDB(_0x3d9bc9){utils[_0x6d5b('0x5')](util[_0x6d5b('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x3d9bc9[_0x6d5b('0x7')],_0x3d9bc9[_0x6d5b('0x8')],_0x3d9bc9[_0x6d5b('0x9')],_0x3d9bc9['data2'],_0x3d9bc9[_0x6d5b('0xa')],_0x3d9bc9[_0x6d5b('0xb')]));if(_0x3d9bc9[_0x6d5b('0x8')]){utils[_0x6d5b('0xc')](_0x3d9bc9['interface'])['then'](function(_0x309bc9){if(_0x309bc9){_0x3d9bc9[_0x6d5b('0xa')]=_0x309bc9[_0x6d5b('0xd')];_0x3d9bc9[_0x6d5b('0xe')]=_0x309bc9[_0x6d5b('0xe')];utils[_0x6d5b('0xf')](_0x6d5b('0x10'),_0x3d9bc9);}else{utils[_0x6d5b('0x11')](_0x3d9bc9[_0x6d5b('0x8')][_0x6d5b('0x12')]('/')[0x1])[_0x6d5b('0x13')](function(_0x33113f){if(_0x33113f){_0x3d9bc9[_0x6d5b('0xa')]=_0x33113f[_0x6d5b('0xd')];_0x3d9bc9[_0x6d5b('0xe')]=_0x33113f[_0x6d5b('0xe')];utils[_0x6d5b('0xf')](_0x6d5b('0x10'),_0x3d9bc9);}});}})['catch'](function(_0x2be3ab){utils[_0x6d5b('0x14')](util[_0x6d5b('0x6')](_0x6d5b('0x15'),_0x3d9bc9[_0x6d5b('0x7')]),_0x2be3ab);});}delete members[_0x3d9bc9['interface']];}function startsWith(_0x3c8078,_0x1e6814){return _['some'](_0x3c8078,function(_0x2baf47){return _['startsWith'](_0x1e6814,_0x2baf47);});}exports[_0x6d5b('0x16')]=function(_0x4dfd99){try{utils['debug'](util['format'](_0x6d5b('0x17'),members[_0x4dfd99[_0x6d5b('0x18')]]?members[_0x4dfd99[_0x6d5b('0x18')]]['uniqueid']:_0x4dfd99[_0x6d5b('0x18')]),_0x4dfd99);utils[_0x6d5b('0x5')](util[_0x6d5b('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4dfd99[_0x6d5b('0x18')]]?members[_0x4dfd99['device']][_0x6d5b('0x7')]:_0x4dfd99[_0x6d5b('0x18')],_0x4dfd99[_0x6d5b('0x19')],_0x4dfd99['device']));switch(_0x4dfd99[_0x6d5b('0x19')]){case _0x6d5b('0x1a'):case _0x6d5b('0x1b'):if(!startsWith(exclude,_0x4dfd99[_0x6d5b('0x18')])){members[_0x4dfd99[_0x6d5b('0x18')]]={'channel':_0x6d5b('0x1c'),'interface':_0x4dfd99[_0x6d5b('0x18')],'type':_0x6d5b('0x1d'),'enterAt':utils[_0x6d5b('0x1e')](),'role':_0x6d5b('0x1f')};}break;case _0x6d5b('0x20'):if(!_[_0x6d5b('0x21')](members[_0x4dfd99[_0x6d5b('0x18')]])){members[_0x4dfd99[_0x6d5b('0x18')]]['exitAt']=utils[_0x6d5b('0x1e')]();members[_0x4dfd99['device']][_0x6d5b('0x22')]=utils[_0x6d5b('0x23')](members[_0x4dfd99[_0x6d5b('0x18')]][_0x6d5b('0x24')],members[_0x4dfd99[_0x6d5b('0x18')]][_0x6d5b('0x25')]);if(members[_0x4dfd99[_0x6d5b('0x18')]][_0x6d5b('0x7')]){writeDB(members[_0x4dfd99[_0x6d5b('0x18')]]);}}break;default:break;}}catch(_0x2076f1){utils[_0x6d5b('0x14')](util[_0x6d5b('0x6')](_0x6d5b('0x17'),members[_0x4dfd99['device']]?members[_0x4dfd99['device']]['uniqueid']:_0x4dfd99[_0x6d5b('0x18')]),_0x2076f1);}};exports[_0x6d5b('0x26')]=function(_0x2d0da5){try{if(!_['isNil'](members[_0x2d0da5[_0x6d5b('0x8')]])){utils[_0x6d5b('0x27')](util['format']('[%s][members][agentcomplete]',_0x2d0da5[_0x6d5b('0x7')]),_0x2d0da5);utils[_0x6d5b('0x5')](util[_0x6d5b('0x6')](_0x6d5b('0x28'),_0x2d0da5[_0x6d5b('0x7')],_0x2d0da5['interface'],_0x2d0da5['queue']));members[_0x2d0da5[_0x6d5b('0x8')]]=_['assign'](members[_0x2d0da5[_0x6d5b('0x8')]],{'data4':_0x2d0da5[_0x6d5b('0x29')],'uniqueid':_0x2d0da5[_0x6d5b('0x7')]});}}catch(_0x2185b4){utils[_0x6d5b('0x14')](util[_0x6d5b('0x6')](_0x6d5b('0x2a'),_0x2d0da5[_0x6d5b('0x7')]),_0x2185b4);}};exports['cdr']=function(_0x2cea5e){try{utils[_0x6d5b('0x27')](util[_0x6d5b('0x6')](_0x6d5b('0x2b'),_0x2cea5e[_0x6d5b('0x7')]),_0x2cea5e);if(_0x2cea5e[_0x6d5b('0x9')]){var _0x3e7d94=_0x2cea5e[_0x6d5b('0x9')]['split']('-')[0x0];if(!_[_0x6d5b('0x21')](members[_0x3e7d94])){members[_0x3e7d94]=_[_0x6d5b('0x2c')](members[_0x3e7d94],{'data1':members[_0x3e7d94][_0x6d5b('0x2d')]||_0x2cea5e[_0x6d5b('0xb')],'data2':members[_0x3e7d94][_0x6d5b('0x2e')]||_0x2cea5e[_0x6d5b('0x2f')],'data3':members[_0x3e7d94]['data3']||_0x2cea5e['destination'],'uniqueid':members[_0x3e7d94][_0x6d5b('0x7')]||_0x2cea5e[_0x6d5b('0x7')]});utils[_0x6d5b('0x5')](util[_0x6d5b('0x6')](_0x6d5b('0x30'),_0x2cea5e[_0x6d5b('0x7')],members[_0x3e7d94][_0x6d5b('0x2d')],members[_0x3e7d94][_0x6d5b('0x2e')],members[_0x3e7d94][_0x6d5b('0x31')]));if(members[_0x3e7d94][_0x6d5b('0x24')]){writeDB(members[_0x3e7d94]);}}}if(_0x2cea5e[_0x6d5b('0x32')]){var _0x55915a=_0x2cea5e['destinationchannel'][_0x6d5b('0x12')]('-')[0x0];if(!_[_0x6d5b('0x21')](members[_0x55915a])){members[_0x55915a]=_[_0x6d5b('0x2c')](members[_0x55915a],{'data1':members[_0x55915a][_0x6d5b('0x2d')]||_0x2cea5e['type'],'data2':members[_0x55915a][_0x6d5b('0x2e')]||_0x2cea5e[_0x6d5b('0x2f')],'data3':members[_0x55915a][_0x6d5b('0x31')]||_0x2cea5e[_0x6d5b('0x33')],'uniqueid':members[_0x55915a][_0x6d5b('0x7')]||_0x2cea5e[_0x6d5b('0x7')]});utils[_0x6d5b('0x5')](util[_0x6d5b('0x6')](_0x6d5b('0x30'),_0x2cea5e[_0x6d5b('0x7')],members[_0x55915a][_0x6d5b('0x2d')],members[_0x55915a][_0x6d5b('0x2e')],members[_0x55915a][_0x6d5b('0x31')]));if(members[_0x55915a]['exitAt']){writeDB(members[_0x55915a]);}}}}catch(_0x5ae3e4){utils[_0x6d5b('0x14')](util[_0x6d5b('0x6')](_0x6d5b('0x2b'),_0x2cea5e[_0x6d5b('0x7')]),_0x5ae3e4);}}; \ No newline at end of file +var _0x403a=['voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','source','destination','destinationchannel','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','Local/_attended@transfer','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','some','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY'];(function(_0x1c8209,_0x4abf10){var _0x38466e=function(_0x18e324){while(--_0x18e324){_0x1c8209['push'](_0x1c8209['shift']());}};_0x38466e(++_0x4abf10);}(_0x403a,0x19e));var _0xa403=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x403a[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require(_0xa403('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0xa403('0x1'),'Queue:'];function writeDB(_0xc75afa){utils['info'](util[_0xa403('0x2')](_0xa403('0x3'),_0xc75afa[_0xa403('0x4')],_0xc75afa[_0xa403('0x5')],_0xc75afa[_0xa403('0x6')],_0xc75afa[_0xa403('0x7')],_0xc75afa[_0xa403('0x8')],_0xc75afa[_0xa403('0x9')]));if(_0xc75afa[_0xa403('0x5')]){utils[_0xa403('0xa')](_0xc75afa[_0xa403('0x5')])['then'](function(_0x16768e){if(_0x16768e){_0xc75afa[_0xa403('0x8')]=_0x16768e[_0xa403('0xb')];_0xc75afa[_0xa403('0xc')]=_0x16768e[_0xa403('0xc')];utils[_0xa403('0xd')](_0xa403('0xe'),_0xc75afa);}else{utils[_0xa403('0xf')](_0xc75afa[_0xa403('0x5')][_0xa403('0x10')]('/')[0x1])['then'](function(_0x512435){if(_0x512435){_0xc75afa[_0xa403('0x8')]=_0x512435[_0xa403('0xb')];_0xc75afa['internal']=_0x512435[_0xa403('0xc')];utils[_0xa403('0xd')](_0xa403('0xe'),_0xc75afa);}});}})['catch'](function(_0x2f485e){utils[_0xa403('0x11')](util[_0xa403('0x2')](_0xa403('0x12'),_0xc75afa[_0xa403('0x4')]),_0x2f485e);});}delete members[_0xc75afa['interface']];}function startsWith(_0x1fdc33,_0x40958c){return _[_0xa403('0x13')](_0x1fdc33,function(_0x3516ac){return _[_0xa403('0x14')](_0x40958c,_0x3516ac);});}exports['devicestatechange']=function(_0x329b0a){try{utils[_0xa403('0x15')](util[_0xa403('0x2')]('[%s][members][devicestatechange]',members[_0x329b0a[_0xa403('0x16')]]?members[_0x329b0a[_0xa403('0x16')]][_0xa403('0x4')]:_0x329b0a[_0xa403('0x16')]),_0x329b0a);utils['info'](util['format'](_0xa403('0x17'),members[_0x329b0a[_0xa403('0x16')]]?members[_0x329b0a[_0xa403('0x16')]][_0xa403('0x4')]:_0x329b0a[_0xa403('0x16')],_0x329b0a[_0xa403('0x18')],_0x329b0a[_0xa403('0x16')]));switch(_0x329b0a[_0xa403('0x18')]){case _0xa403('0x19'):case _0xa403('0x1a'):if(!startsWith(exclude,_0x329b0a[_0xa403('0x16')])){members[_0x329b0a[_0xa403('0x16')]]={'channel':_0xa403('0x1b'),'interface':_0x329b0a['device'],'type':_0xa403('0x1c'),'enterAt':utils[_0xa403('0x1d')](),'role':_0xa403('0x1e')};}break;case _0xa403('0x1f'):if(!_[_0xa403('0x20')](members[_0x329b0a[_0xa403('0x16')]])){members[_0x329b0a[_0xa403('0x16')]][_0xa403('0x21')]=utils['now']();members[_0x329b0a[_0xa403('0x16')]][_0xa403('0x22')]=utils['diffTime'](members[_0x329b0a['device']][_0xa403('0x21')],members[_0x329b0a['device']]['enterAt']);if(members[_0x329b0a[_0xa403('0x16')]][_0xa403('0x4')]){writeDB(members[_0x329b0a[_0xa403('0x16')]]);}}break;default:break;}}catch(_0x1fbd9c){utils[_0xa403('0x11')](util[_0xa403('0x2')](_0xa403('0x23'),members[_0x329b0a['device']]?members[_0x329b0a[_0xa403('0x16')]][_0xa403('0x4')]:_0x329b0a[_0xa403('0x16')]),_0x1fbd9c);}};exports[_0xa403('0x24')]=function(_0xeff335){try{if(!_['isNil'](members[_0xeff335[_0xa403('0x5')]])){utils[_0xa403('0x15')](util['format'](_0xa403('0x25'),_0xeff335[_0xa403('0x4')]),_0xeff335);utils[_0xa403('0x26')](util['format'](_0xa403('0x27'),_0xeff335[_0xa403('0x4')],_0xeff335[_0xa403('0x5')],_0xeff335[_0xa403('0x28')]));members[_0xeff335[_0xa403('0x5')]]=_[_0xa403('0x29')](members[_0xeff335[_0xa403('0x5')]],{'data4':_0xeff335['queue'],'uniqueid':_0xeff335['uniqueid']});}}catch(_0x50d8b0){utils[_0xa403('0x11')](util[_0xa403('0x2')](_0xa403('0x25'),_0xeff335[_0xa403('0x4')]),_0x50d8b0);}};exports['cdr']=function(_0x4582e6){try{utils[_0xa403('0x15')](util[_0xa403('0x2')](_0xa403('0x2a'),_0x4582e6['uniqueid']),_0x4582e6);if(_0x4582e6[_0xa403('0x6')]){var _0x26f173=_0x4582e6[_0xa403('0x6')][_0xa403('0x10')]('-')[0x0];if(!_[_0xa403('0x20')](members[_0x26f173])){members[_0x26f173]=_['assign'](members[_0x26f173],{'data1':members[_0x26f173][_0xa403('0x2b')]||_0x4582e6[_0xa403('0x9')],'data2':members[_0x26f173][_0xa403('0x7')]||_0x4582e6[_0xa403('0x2c')],'data3':members[_0x26f173]['data3']||_0x4582e6[_0xa403('0x2d')],'uniqueid':members[_0x26f173]['uniqueid']||_0x4582e6[_0xa403('0x4')]});utils[_0xa403('0x26')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4582e6[_0xa403('0x4')],members[_0x26f173][_0xa403('0x2b')],members[_0x26f173][_0xa403('0x7')],members[_0x26f173]['data3']));if(members[_0x26f173][_0xa403('0x21')]){writeDB(members[_0x26f173]);}}}if(_0x4582e6['destinationchannel']){var _0x4dba29=_0x4582e6[_0xa403('0x2e')]['split']('-')[0x0];if(!_[_0xa403('0x20')](members[_0x4dba29])){members[_0x4dba29]=_[_0xa403('0x29')](members[_0x4dba29],{'data1':members[_0x4dba29][_0xa403('0x2b')]||_0x4582e6[_0xa403('0x9')],'data2':members[_0x4dba29][_0xa403('0x7')]||_0x4582e6['source'],'data3':members[_0x4dba29][_0xa403('0x2f')]||_0x4582e6[_0xa403('0x2d')],'uniqueid':members[_0x4dba29]['uniqueid']||_0x4582e6[_0xa403('0x4')]});utils[_0xa403('0x26')](util[_0xa403('0x2')](_0xa403('0x30'),_0x4582e6[_0xa403('0x4')],members[_0x4dba29][_0xa403('0x2b')],members[_0x4dba29][_0xa403('0x7')],members[_0x4dba29][_0xa403('0x2f')]));if(members[_0x4dba29][_0xa403('0x21')]){writeDB(members[_0x4dba29]);}}}}catch(_0xead406){utils[_0xa403('0x11')](util[_0xa403('0x2')](_0xa403('0x2a'),_0x4582e6[_0xa403('0x4')]),_0xead406);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index b9cc146..41c3df8 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 _0x498b=['[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','accountcode','then','type','request','CreateVoiceQueueReport','queuecallerjoin','format','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','queue','position','assign','now','error','[%s][queues][queuecallerjoin]','[%s][queues][hangup]','queuecallerleaveAt','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','debug','[%s][queues][varset]','isNil','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexit','value'];(function(_0x5ccb27,_0x4102d6){var _0x50c39b=function(_0xf080a){while(--_0xf080a){_0x5ccb27['push'](_0x5ccb27['shift']());}};_0x50c39b(++_0x4102d6);}(_0x498b,0x1ce));var _0xb498=function(_0x47c4c2,_0x9c857){_0x47c4c2=_0x47c4c2-0x0;var _0x5d908=_0x498b[_0x47c4c2];return _0x5d908;};'use strict';var _=require(_0xb498('0x0'));var util=require('util');var utils=require(_0xb498('0x1'));var queues={};function writeDB(_0x4d034b){utils['info'](util['format'](_0xb498('0x2'),_0x4d034b[_0xb498('0x3')],_0x4d034b['channel'],_0x4d034b['queue'],_0x4d034b[_0xb498('0x4')],_0x4d034b[_0xb498('0x5')],_0x4d034b[_0xb498('0x6')],_0x4d034b['queuecallerexitreason']));if(_0x4d034b['queue']){utils['getVoiceQueueByName'](_0x4d034b['queue'])[_0xb498('0x7')](function(_0x4fbffd){if(_0x4fbffd){_0x4d034b[_0xb498('0x8')]=_0x4fbffd[_0xb498('0x8')];}utils[_0xb498('0x9')](_0xb498('0xa'),_0x4d034b);});}else{utils[_0xb498('0x9')](_0xb498('0xa'),_0x4d034b);}if(_0x4d034b['transfereduniqueid']){delete queues[_0x4d034b['transfereduniqueid']];}else{delete queues[_0x4d034b[_0xb498('0x3')]];}}exports[_0xb498('0xb')]=function(_0x4f7408){try{utils['debug'](util[_0xb498('0xc')]('[%s][queues][queuecallerjoin]',_0x4f7408[_0xb498('0x3')]),_0x4f7408);utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0xe'),_0x4f7408[_0xb498('0x3')],_0x4f7408[_0xb498('0xf')],_0x4f7408[_0xb498('0x10')]));queues[_0x4f7408[_0xb498('0x3')]]=_[_0xb498('0x11')](_0x4f7408,{'originalposition':_0x4f7408[_0xb498('0x10')],'queuecallerjoinAt':utils[_0xb498('0x12')](),'mohtime':0x0});}catch(_0x2faa27){utils[_0xb498('0x13')](util[_0xb498('0xc')](_0xb498('0x14'),_0x4f7408[_0xb498('0x3')]),_0x2faa27);}};exports['hangup']=function(_0x1a5bc3){try{if(!_['isNil'](queues[_0x1a5bc3[_0xb498('0x3')]])){utils['debug'](util[_0xb498('0xc')](_0xb498('0x15'),_0x1a5bc3[_0xb498('0x3')]),_0x1a5bc3);if(queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x16')]){if(!queues[_0x1a5bc3[_0xb498('0x3')]]['queuecallerabandon']&&!queues[_0x1a5bc3['uniqueid']]['queuecallerexit']){queues[_0x1a5bc3['uniqueid']]['queuecallercomplete']=!![];queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x17')]=utils[_0xb498('0x12')]();queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x18')]=_0xb498('0x19');}utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x1a'),_0x1a5bc3[_0xb498('0x3')],queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x1b')],queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x18')]));writeDB(queues[_0x1a5bc3['uniqueid']]);}else if(queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x1c')]){utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x1d'),_0x1a5bc3['uniqueid'],queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x1b')],queues[_0x1a5bc3['uniqueid']][_0xb498('0x1c')]));queues[queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x1c')]]=queues[_0x1a5bc3[_0xb498('0x3')]];queues[queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x1c')]][_0xb498('0x1e')]=0x2;delete queues[_0x1a5bc3['uniqueid']];}}}catch(_0x16eb4){utils['error'](util[_0xb498('0xc')]('[%s][queues][hangup]',_0x1a5bc3[_0xb498('0x3')]),_0x16eb4);}};exports[_0xb498('0x1f')]=function(_0x109577){try{utils[_0xb498('0x20')](util[_0xb498('0xc')](_0xb498('0x21'),_0x109577[_0xb498('0x3')]),_0x109577);if(!_[_0xb498('0x22')](_0x109577[_0xb498('0x23')][_0xb498('0x24')])&&_0x109577['value'][_0xb498('0x25')]()!==_0xb498('0x26')){if(!_[_0xb498('0x22')](queues[_0x109577[_0xb498('0x3')]])){queues[_0x109577[_0xb498('0x3')]][_0xb498('0x27')]=![];queues[_0x109577[_0xb498('0x3')]][_0xb498('0x28')]=null;queues[_0x109577['uniqueid']][_0xb498('0x29')]=!![];queues[_0x109577[_0xb498('0x3')]]['queuecallerexitAt']=utils[_0xb498('0x12')]();queues[_0x109577[_0xb498('0x3')]][_0xb498('0x18')]=_0x109577[_0xb498('0x2a')][_0xb498('0x25')]();utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x2b'),_0x109577[_0xb498('0x3')],queues[_0x109577['uniqueid']][_0xb498('0x1b')],_0x109577[_0xb498('0x2a')],queues[_0x109577[_0xb498('0x3')]][_0xb498('0x18')]));writeDB(queues[_0x109577[_0xb498('0x3')]]);}}else if(!_['isNil'](_0x109577[_0xb498('0x23')][_0xb498('0x2c')])){if(!_[_0xb498('0x22')](queues[_0x109577['uniqueid']])&&!queues[_0x109577[_0xb498('0x3')]][_0xb498('0x27')]){queues[_0x109577[_0xb498('0x3')]][_0xb498('0x27')]=![];queues[_0x109577[_0xb498('0x3')]]['queuecallerabandonAt']=null;queues[_0x109577[_0xb498('0x3')]][_0xb498('0x29')]=!![];queues[_0x109577['uniqueid']]['queuecallerexitAt']=utils[_0xb498('0x12')]();queues[_0x109577['uniqueid']]['queuecallerexitreason']=_0xb498('0x2d');utils['info'](util['format'](_0xb498('0x2e'),_0x109577[_0xb498('0x3')],queues[_0x109577[_0xb498('0x3')]][_0xb498('0x1b')],_0x109577[_0xb498('0x2a')],queues[_0x109577[_0xb498('0x3')]][_0xb498('0x18')]));}}}catch(_0x296455){utils[_0xb498('0x13')](util[_0xb498('0xc')](_0xb498('0x21'),_0x109577[_0xb498('0x3')]),_0x296455);}};exports['queuecallerabandon']=function(_0x56368b){try{if(!_['isNil'](queues[_0x56368b[_0xb498('0x3')]])){utils['debug'](util[_0xb498('0xc')]('[%s][queues][queuecallerabandon]',_0x56368b[_0xb498('0x3')]),_0x56368b);queues[_0x56368b[_0xb498('0x3')]][_0xb498('0x29')]=![];queues[_0x56368b['uniqueid']][_0xb498('0x2f')]=null;queues[_0x56368b[_0xb498('0x3')]][_0xb498('0x27')]=!![];queues[_0x56368b['uniqueid']][_0xb498('0x28')]=utils[_0xb498('0x12')]();queues[_0x56368b[_0xb498('0x3')]][_0xb498('0x18')]=_0xb498('0x30');utils['info'](util[_0xb498('0xc')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x56368b[_0xb498('0x3')],queues[_0x56368b[_0xb498('0x3')]]['name'],queues[_0x56368b['uniqueid']][_0xb498('0x18')]));}}catch(_0x34d173){utils['error'](util[_0xb498('0xc')](_0xb498('0x31'),_0x56368b[_0xb498('0x3')]),_0x34d173);}};exports['queuecallerleave']=function(_0x17f7e0){try{if(!_[_0xb498('0x22')](queues[_0x17f7e0['uniqueid']])){utils[_0xb498('0x20')](util[_0xb498('0xc')](_0xb498('0x32'),_0x17f7e0[_0xb498('0x3')]),_0x17f7e0);utils['info'](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x17f7e0[_0xb498('0x3')],queues[_0x17f7e0[_0xb498('0x3')]][_0xb498('0x1b')],_0x17f7e0[_0xb498('0x33')],_0x17f7e0[_0xb498('0x34')]));queues[_0x17f7e0[_0xb498('0x3')]]['queuecallerleave']=!![];queues[_0x17f7e0[_0xb498('0x3')]]['queuecallerleaveAt']=utils[_0xb498('0x12')]();queues[_0x17f7e0[_0xb498('0x3')]][_0xb498('0x35')]=utils[_0xb498('0x36')](queues[_0x17f7e0[_0xb498('0x3')]][_0xb498('0x16')],queues[_0x17f7e0['uniqueid']][_0xb498('0x37')]);queues[_0x17f7e0[_0xb498('0x3')]][_0xb498('0x10')]=_0x17f7e0['position'];queues[_0x17f7e0[_0xb498('0x3')]][_0xb498('0x38')]=_0x17f7e0['count'];queues[_0x17f7e0[_0xb498('0x3')]]['connectedlinenum']=_0x17f7e0['connectedlinenum'];queues[_0x17f7e0['uniqueid']][_0xb498('0x34')]=_0x17f7e0[_0xb498('0x34')];}}catch(_0x2c9b54){utils[_0xb498('0x13')](util[_0xb498('0xc')]('[%s][queues][queuecallerleave]',_0x17f7e0[_0xb498('0x3')]),_0x2c9b54);}};exports['agentconnect']=function(_0x2139d8){try{if(!_[_0xb498('0x22')](queues[_0x2139d8[_0xb498('0x3')]])){utils[_0xb498('0x20')](util[_0xb498('0xc')](_0xb498('0x39'),_0x2139d8[_0xb498('0x3')]),_0x2139d8);utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x3a'),_0x2139d8[_0xb498('0x3')],queues[_0x2139d8[_0xb498('0x3')]][_0xb498('0x1b')],_0x2139d8['membername'],_0x2139d8['destaccountcode']));queues[_0x2139d8[_0xb498('0x3')]][_0xb498('0x27')]=![];queues[_0x2139d8['uniqueid']][_0xb498('0x27')]=![];queues[_0x2139d8[_0xb498('0x3')]][_0xb498('0x28')]=null;queues[_0x2139d8[_0xb498('0x3')]][_0xb498('0x29')]=![];queues[_0x2139d8[_0xb498('0x3')]]['queuecallerexitreason']=null;queues[_0x2139d8['uniqueid']][_0xb498('0x2f')]=null;queues[_0x2139d8[_0xb498('0x3')]]['assigned']=!![];queues[_0x2139d8[_0xb498('0x3')]][_0xb498('0x6')]=_0x2139d8['destaccountcode'];queues[_0x2139d8[_0xb498('0x3')]]['lastAssignedTo']=_0x2139d8[_0xb498('0x3b')];}}catch(_0x326e0b){utils[_0xb498('0x13')](util[_0xb498('0xc')](_0xb498('0x39'),_0x2139d8[_0xb498('0x3')]),_0x326e0b);}};exports[_0xb498('0x3c')]=function(_0x40e30f){try{if(!_[_0xb498('0x22')](queues[_0x40e30f[_0xb498('0x3')]])){if(queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x16')]){utils[_0xb498('0x20')](util[_0xb498('0xc')](_0xb498('0x3d'),_0x40e30f[_0xb498('0x3')]),_0x40e30f);queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x27')]=![];queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x27')]=![];queues[_0x40e30f['uniqueid']][_0xb498('0x28')]=null;queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x29')]=![];queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x2f')]=null;queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x3e')]=!![];queues[_0x40e30f['uniqueid']][_0xb498('0x4')]=_0x40e30f[_0xb498('0x3b')];queues[_0x40e30f[_0xb498('0x3')]]['queuecallercomplete']=!![];queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x17')]=utils[_0xb498('0x12')]();if(_0x40e30f[_0xb498('0x3f')]==_0xb498('0x40')){if(!queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x40')]){queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x18')]=_0xb498('0x41');}}else{queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x18')]=_0xb498('0x42')+_0x40e30f[_0xb498('0x3f')]['toUpperCase']();}utils[_0xb498('0xd')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x40e30f['uniqueid'],queues[_0x40e30f[_0xb498('0x3')]]['name'],_0x40e30f[_0xb498('0x3b')],queues[_0x40e30f['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x40e30f[_0xb498('0x3')]]);}}}catch(_0x465e61){utils['error'](util[_0xb498('0xc')](_0xb498('0x3d'),_0x40e30f['uniqueid']),_0x465e61);}};exports[_0xb498('0x43')]=function(_0x328358){try{if(!_[_0xb498('0x22')](queues[_0x328358[_0xb498('0x44')]])){utils['debug'](util[_0xb498('0xc')](_0xb498('0x45'),_0x328358[_0xb498('0x3')]),_0x328358);queues[_0x328358[_0xb498('0x44')]][_0xb498('0x40')]=!![];queues[_0x328358['transfereeuniqueid']][_0xb498('0x46')]=_0xb498('0x47');queues[_0x328358[_0xb498('0x44')]]['transferexten']=_0x328358[_0xb498('0x48')];queues[_0x328358[_0xb498('0x44')]]['transferuniqueid']=_0x328358[_0xb498('0x44')];queues[_0x328358[_0xb498('0x44')]][_0xb498('0x18')]='BLINDTRANSFER';utils[_0xb498('0xd')](util['format'](_0xb498('0x49'),_0x328358[_0xb498('0x3')],queues[_0x328358[_0xb498('0x44')]][_0xb498('0x1b')],_0x328358[_0xb498('0x44')],_0x328358['extension']));}}catch(_0x482d87){utils[_0xb498('0x13')](util[_0xb498('0xc')](_0xb498('0x45'),_0x328358[_0xb498('0x3')]),_0x482d87);}};exports['attendedtransfer']=function(_0x27513f){try{utils[_0xb498('0x20')](util[_0xb498('0xc')](_0xb498('0x4a'),_0x27513f[_0xb498('0x4b')]),_0x27513f);if(_0x27513f[_0xb498('0x4b')]==_0x27513f[_0xb498('0x4c')]){if(!_[_0xb498('0x22')](queues[_0x27513f[_0xb498('0x4d')]])){utils[_0xb498('0xd')](util[_0xb498('0xc')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x27513f[_0xb498('0x4b')],queues[_0x27513f['secondtransfererlinkedid']]['name'],_0x27513f[_0xb498('0x4e')]));queues[_0x27513f[_0xb498('0x4d')]]['transfer']=!![];queues[_0x27513f[_0xb498('0x4d')]][_0xb498('0x46')]=_0xb498('0x4f');queues[_0x27513f['secondtransfererlinkedid']][_0xb498('0x50')]=_0x27513f[_0xb498('0x4e')];queues[_0x27513f[_0xb498('0x4d')]][_0xb498('0x51')]=_0x27513f['origtransfereruniqueid'];queues[_0x27513f[_0xb498('0x4d')]]['queuecallerexitreason']=_0xb498('0x52');}if(!_['isNil'](queues[_0x27513f[_0xb498('0x4c')]])){if(_0x27513f[_0xb498('0x53')]&&queues[_0x27513f[_0xb498('0x53')]]){queues[_0x27513f[_0xb498('0x53')]][_0xb498('0x1e')]=0x1;queues[_0x27513f[_0xb498('0x44')]]=_[_0xb498('0x54')](queues[_0x27513f[_0xb498('0x53')]]);queues[_0x27513f['transfereeuniqueid']]['transfereduniqueid']=_0x27513f[_0xb498('0x55')];queues[_0x27513f[_0xb498('0x44')]]['queuecallerenterreason']=0x2;queues[_0x27513f[_0xb498('0x44')]]['calleridnum']=queues[_0x27513f[_0xb498('0x4d')]]['calleridnum'];queues[_0x27513f[_0xb498('0x44')]]['calleridname']=queues[_0x27513f[_0xb498('0x4d')]]['calleridname'];queues[_0x27513f[_0xb498('0x44')]][_0xb498('0x37')]=utils[_0xb498('0x12')]();queues[_0x27513f[_0xb498('0x44')]][_0xb498('0x16')]=utils[_0xb498('0x12')]();queues[_0x27513f['transfereeuniqueid']]['holdtime']=0x0;queues[_0x27513f[_0xb498('0x44')]][_0xb498('0x56')]=0x0;utils[_0xb498('0xd')](util['format'](_0xb498('0x57'),_0x27513f[_0xb498('0x4b')],queues[_0x27513f[_0xb498('0x44')]][_0xb498('0x1b')],queues[_0x27513f[_0xb498('0x44')]][_0xb498('0x5')],queues[_0x27513f['transfereeuniqueid']][_0xb498('0x58')]));}else{utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x59'),_0x27513f[_0xb498('0x4b')],queues[_0x27513f['origtransfererlinkedid']][_0xb498('0x1b')],_0x27513f[_0xb498('0x4d')]));queues[_0x27513f[_0xb498('0x4c')]]['transfereduniqueid']=_0x27513f[_0xb498('0x4d')];}}}else if(_0x27513f['secondtransfereruniqueid']==_0x27513f[_0xb498('0x4d')]){if(!_['isNil'](queues[_0x27513f[_0xb498('0x4c')]])){utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x5a'),_0x27513f[_0xb498('0x4b')],queues[_0x27513f[_0xb498('0x4c')]][_0xb498('0x1b')],_0x27513f[_0xb498('0x5b')],_0x27513f[_0xb498('0x5c')]));queues[_0x27513f[_0xb498('0x4c')]][_0xb498('0x40')]=!![];queues[_0x27513f['origtransfererlinkedid']][_0xb498('0x46')]=_0xb498('0x4f');queues[_0x27513f['origtransfererlinkedid']][_0xb498('0x50')]=_0x27513f[_0xb498('0x5c')];queues[_0x27513f[_0xb498('0x4c')]][_0xb498('0x51')]=_0x27513f[_0xb498('0x5b')];queues[_0x27513f[_0xb498('0x4c')]][_0xb498('0x18')]=_0xb498('0x52');}if(!_['isNil'](queues[_0x27513f['secondtransfererlinkedid']])){if(_0x27513f[_0xb498('0x5d')]&&queues[_0x27513f['transfertargetlinkedid']]){queues[_0x27513f[_0xb498('0x5d')]][_0xb498('0x1e')]=0x1;queues[_0x27513f[_0xb498('0x55')]]=_[_0xb498('0x54')](queues[_0x27513f['transfertargetlinkedid']]);queues[_0x27513f['transfertargetuniqueid']][_0xb498('0x1c')]=_0x27513f[_0xb498('0x55')];queues[_0x27513f['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x27513f[_0xb498('0x55')]]['calleridnum']=queues[_0x27513f[_0xb498('0x4c')]]['calleridnum'];queues[_0x27513f[_0xb498('0x55')]]['calleridname']=queues[_0x27513f['origtransfererlinkedid']][_0xb498('0x58')];queues[_0x27513f['transfertargetuniqueid']][_0xb498('0x37')]=utils[_0xb498('0x12')]();queues[_0x27513f[_0xb498('0x55')]]['queuecallerleaveAt']=utils[_0xb498('0x12')]();queues[_0x27513f[_0xb498('0x55')]]['holdtime']=0x0;queues[_0x27513f['transfertargetuniqueid']][_0xb498('0x56')]=0x0;utils['info'](util[_0xb498('0xc')](_0xb498('0x5e'),_0x27513f[_0xb498('0x4b')],queues[_0x27513f['transfertargetuniqueid']][_0xb498('0x1b')],queues[_0x27513f['transfertargetuniqueid']][_0xb498('0x1c')],queues[_0x27513f[_0xb498('0x55')]][_0xb498('0x5')],queues[_0x27513f[_0xb498('0x55')]]['calleridname']));}else{utils['info'](util[_0xb498('0xc')](_0xb498('0x59'),_0x27513f[_0xb498('0x4b')],queues[_0x27513f[_0xb498('0x4d')]][_0xb498('0x1b')],_0x27513f[_0xb498('0x4c')]));queues[_0x27513f['secondtransfererlinkedid']][_0xb498('0x1c')]=_0x27513f[_0xb498('0x4c')];}}}}catch(_0x39fe64){utils['error'](util[_0xb498('0xc')](_0xb498('0x4a'),_0x27513f[_0xb498('0x4b')]),_0x39fe64);}};exports[_0xb498('0x5f')]=function(_0x568ecd){try{if(!_[_0xb498('0x22')](queues[_0x568ecd[_0xb498('0x3')]])){utils[_0xb498('0x20')](util[_0xb498('0xc')]('[%s][queues][musiconholdstart]',_0x568ecd[_0xb498('0x3')]),_0x568ecd);queues[_0x568ecd[_0xb498('0x3')]][_0xb498('0x60')]=utils[_0xb498('0x12')]();utils['info'](util['format'](_0xb498('0x61'),_0x568ecd[_0xb498('0x3')],queues[_0x568ecd['uniqueid']][_0xb498('0x1b')],queues[_0x568ecd['uniqueid']]['musiconholdstartAt']));}}catch(_0x53f4ed){utils[_0xb498('0x13')](util['format']('[%s][queues][musiconholdstart]',_0x568ecd[_0xb498('0x3')]),_0x53f4ed);}};exports[_0xb498('0x62')]=function(_0x197f7e){try{if(!_[_0xb498('0x22')](queues[_0x197f7e[_0xb498('0x3')]])){if(!_[_0xb498('0x22')](queues[_0x197f7e[_0xb498('0x3')]][_0xb498('0x60')])){utils[_0xb498('0x20')](util[_0xb498('0xc')](_0xb498('0x63'),_0x197f7e[_0xb498('0x3')]),_0x197f7e);queues[_0x197f7e[_0xb498('0x3')]][_0xb498('0x56')]+=utils[_0xb498('0x36')](utils[_0xb498('0x12')](),queues[_0x197f7e['uniqueid']][_0xb498('0x60')]);utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x64'),_0x197f7e[_0xb498('0x3')],queues[_0x197f7e[_0xb498('0x3')]][_0xb498('0x1b')],queues[_0x197f7e[_0xb498('0x3')]]['mohtime']));delete queues[_0x197f7e['uniqueid']][_0xb498('0x60')];}}}catch(_0x309c44){utils[_0xb498('0x13')](util[_0xb498('0xc')](_0xb498('0x63'),_0x197f7e[_0xb498('0x3')]),_0x309c44);}}; \ No newline at end of file +var _0x8f02=['ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','diffTime','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','variable','queueposition','EXITWITHKEY','error','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten'];(function(_0xeb80e,_0x337608){var _0x68e9d7=function(_0x50c896){while(--_0x50c896){_0xeb80e['push'](_0xeb80e['shift']());}};_0x68e9d7(++_0x337608);}(_0x8f02,0xdd));var _0x28f0=function(_0x34f600,_0x1a7bc9){_0x34f600=_0x34f600-0x0;var _0x3a9123=_0x8f02[_0x34f600];return _0x3a9123;};'use strict';var _=require(_0x28f0('0x0'));var util=require(_0x28f0('0x1'));var utils=require(_0x28f0('0x2'));var queues={};function writeDB(_0x2c6596){utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x5'),_0x2c6596[_0x28f0('0x6')],_0x2c6596[_0x28f0('0x7')],_0x2c6596[_0x28f0('0x8')],_0x2c6596[_0x28f0('0x9')],_0x2c6596[_0x28f0('0xa')],_0x2c6596[_0x28f0('0xb')],_0x2c6596['queuecallerexitreason']));if(_0x2c6596[_0x28f0('0x8')]){utils['getVoiceQueueByName'](_0x2c6596[_0x28f0('0x8')])[_0x28f0('0xc')](function(_0x14bcc2){if(_0x14bcc2){_0x2c6596[_0x28f0('0xd')]=_0x14bcc2[_0x28f0('0xd')];}utils[_0x28f0('0xe')](_0x28f0('0xf'),_0x2c6596);});}else{utils[_0x28f0('0xe')]('CreateVoiceQueueReport',_0x2c6596);}if(_0x2c6596['transfereduniqueid']){delete queues[_0x2c6596[_0x28f0('0x10')]];}else{delete queues[_0x2c6596[_0x28f0('0x6')]];}}exports[_0x28f0('0x11')]=function(_0x230b57){try{utils[_0x28f0('0x12')](util[_0x28f0('0x4')]('[%s][queues][queuecallerjoin]',_0x230b57['uniqueid']),_0x230b57);utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x13'),_0x230b57['uniqueid'],_0x230b57[_0x28f0('0x8')],_0x230b57[_0x28f0('0x14')]));queues[_0x230b57[_0x28f0('0x6')]]=_['assign'](_0x230b57,{'originalposition':_0x230b57['position'],'queuecallerjoinAt':utils[_0x28f0('0x15')](),'mohtime':0x0});}catch(_0x3d0537){utils['error'](util[_0x28f0('0x4')]('[%s][queues][queuecallerjoin]',_0x230b57[_0x28f0('0x6')]),_0x3d0537);}};exports[_0x28f0('0x16')]=function(_0x20e693){try{if(!_[_0x28f0('0x17')](queues[_0x20e693[_0x28f0('0x6')]])){utils['debug'](util['format']('[%s][queues][hangup]',_0x20e693['uniqueid']),_0x20e693);if(queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x18')]){if(!queues[_0x20e693['uniqueid']][_0x28f0('0x19')]&&!queues[_0x20e693['uniqueid']][_0x28f0('0x1a')]){queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x1b')]=!![];queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x1c')]=utils[_0x28f0('0x15')]();queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x1d')]=_0x28f0('0x1e');}utils[_0x28f0('0x3')](util['format'](_0x28f0('0x1f'),_0x20e693['uniqueid'],queues[_0x20e693[_0x28f0('0x6')]]['name'],queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x1d')]));writeDB(queues[_0x20e693[_0x28f0('0x6')]]);}else if(queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x10')]){utils['info'](util[_0x28f0('0x4')](_0x28f0('0x20'),_0x20e693[_0x28f0('0x6')],queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x21')],queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x10')]));queues[queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x10')]]=queues[_0x20e693[_0x28f0('0x6')]];queues[queues[_0x20e693[_0x28f0('0x6')]]['transfereduniqueid']][_0x28f0('0x22')]=0x2;delete queues[_0x20e693[_0x28f0('0x6')]];}}}catch(_0x20ae03){utils['error'](util['format']('[%s][queues][hangup]',_0x20e693[_0x28f0('0x6')]),_0x20ae03);}};exports[_0x28f0('0x23')]=function(_0x4448e0){try{utils[_0x28f0('0x12')](util[_0x28f0('0x4')](_0x28f0('0x24'),_0x4448e0[_0x28f0('0x6')]),_0x4448e0);if(!_[_0x28f0('0x17')](_0x4448e0['variable'][_0x28f0('0x25')])&&_0x4448e0[_0x28f0('0x26')][_0x28f0('0x27')]()!==_0x28f0('0x28')){if(!_[_0x28f0('0x17')](queues[_0x4448e0[_0x28f0('0x6')]])){queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x19')]=![];queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x29')]=null;queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x1a')]=!![];queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x2a')]=utils[_0x28f0('0x15')]();queues[_0x4448e0[_0x28f0('0x6')]]['queuecallerexitreason']=_0x4448e0['value'][_0x28f0('0x27')]();utils[_0x28f0('0x3')](util[_0x28f0('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4448e0[_0x28f0('0x6')],queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x21')],_0x4448e0['value'],queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x1d')]));writeDB(queues[_0x4448e0[_0x28f0('0x6')]]);}}else if(!_[_0x28f0('0x17')](_0x4448e0[_0x28f0('0x2b')][_0x28f0('0x2c')])){if(!_[_0x28f0('0x17')](queues[_0x4448e0[_0x28f0('0x6')]])&&!queues[_0x4448e0[_0x28f0('0x6')]]['queuecallerabandon']){queues[_0x4448e0[_0x28f0('0x6')]]['queuecallerabandon']=![];queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x29')]=null;queues[_0x4448e0[_0x28f0('0x6')]]['queuecallerexit']=!![];queues[_0x4448e0[_0x28f0('0x6')]]['queuecallerexitAt']=utils[_0x28f0('0x15')]();queues[_0x4448e0[_0x28f0('0x6')]]['queuecallerexitreason']=_0x28f0('0x2d');utils['info'](util[_0x28f0('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4448e0[_0x28f0('0x6')],queues[_0x4448e0['uniqueid']]['name'],_0x4448e0[_0x28f0('0x26')],queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x1d')]));}}}catch(_0x46e768){utils[_0x28f0('0x2e')](util['format'](_0x28f0('0x24'),_0x4448e0[_0x28f0('0x6')]),_0x46e768);}};exports[_0x28f0('0x19')]=function(_0xd0625c){try{if(!_[_0x28f0('0x17')](queues[_0xd0625c['uniqueid']])){utils[_0x28f0('0x12')](util[_0x28f0('0x4')](_0x28f0('0x2f'),_0xd0625c[_0x28f0('0x6')]),_0xd0625c);queues[_0xd0625c[_0x28f0('0x6')]][_0x28f0('0x1a')]=![];queues[_0xd0625c[_0x28f0('0x6')]]['queuecallerexitAt']=null;queues[_0xd0625c['uniqueid']]['queuecallerabandon']=!![];queues[_0xd0625c[_0x28f0('0x6')]][_0x28f0('0x29')]=utils[_0x28f0('0x15')]();queues[_0xd0625c[_0x28f0('0x6')]][_0x28f0('0x1d')]=_0x28f0('0x30');utils['info'](util['format'](_0x28f0('0x31'),_0xd0625c[_0x28f0('0x6')],queues[_0xd0625c[_0x28f0('0x6')]][_0x28f0('0x21')],queues[_0xd0625c[_0x28f0('0x6')]][_0x28f0('0x1d')]));}}catch(_0x255a96){utils['error'](util[_0x28f0('0x4')](_0x28f0('0x2f'),_0xd0625c['uniqueid']),_0x255a96);}};exports[_0x28f0('0x32')]=function(_0x18047f){try{if(!_['isNil'](queues[_0x18047f[_0x28f0('0x6')]])){utils[_0x28f0('0x12')](util[_0x28f0('0x4')](_0x28f0('0x33'),_0x18047f['uniqueid']),_0x18047f);utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x34'),_0x18047f[_0x28f0('0x6')],queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x21')],_0x18047f[_0x28f0('0x35')],_0x18047f[_0x28f0('0x36')]));queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x32')]=!![];queues[_0x18047f['uniqueid']]['queuecallerleaveAt']=utils[_0x28f0('0x15')]();queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x37')]=utils['diffTime'](queues[_0x18047f['uniqueid']][_0x28f0('0x18')],queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x38')]);queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x14')]=_0x18047f[_0x28f0('0x14')];queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x39')]=_0x18047f[_0x28f0('0x39')];queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x35')]=_0x18047f[_0x28f0('0x35')];queues[_0x18047f[_0x28f0('0x6')]]['connectedlinename']=_0x18047f[_0x28f0('0x36')];}}catch(_0x1323c9){utils['error'](util[_0x28f0('0x4')]('[%s][queues][queuecallerleave]',_0x18047f[_0x28f0('0x6')]),_0x1323c9);}};exports['agentconnect']=function(_0x3b2d08){try{if(!_[_0x28f0('0x17')](queues[_0x3b2d08['uniqueid']])){utils[_0x28f0('0x12')](util[_0x28f0('0x4')](_0x28f0('0x3a'),_0x3b2d08[_0x28f0('0x6')]),_0x3b2d08);utils[_0x28f0('0x3')](util[_0x28f0('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3b2d08['uniqueid'],queues[_0x3b2d08[_0x28f0('0x6')]][_0x28f0('0x21')],_0x3b2d08[_0x28f0('0x3b')],_0x3b2d08[_0x28f0('0x3c')]));queues[_0x3b2d08[_0x28f0('0x6')]]['queuecallerabandon']=![];queues[_0x3b2d08['uniqueid']]['queuecallerabandon']=![];queues[_0x3b2d08[_0x28f0('0x6')]][_0x28f0('0x29')]=null;queues[_0x3b2d08['uniqueid']][_0x28f0('0x1a')]=![];queues[_0x3b2d08[_0x28f0('0x6')]]['queuecallerexitreason']=null;queues[_0x3b2d08[_0x28f0('0x6')]][_0x28f0('0x2a')]=null;queues[_0x3b2d08[_0x28f0('0x6')]][_0x28f0('0x3d')]=!![];queues[_0x3b2d08[_0x28f0('0x6')]][_0x28f0('0xb')]=_0x3b2d08[_0x28f0('0x3c')];queues[_0x3b2d08[_0x28f0('0x6')]]['lastAssignedTo']=_0x3b2d08[_0x28f0('0x3b')];}}catch(_0x59b8e9){utils[_0x28f0('0x2e')](util[_0x28f0('0x4')](_0x28f0('0x3a'),_0x3b2d08[_0x28f0('0x6')]),_0x59b8e9);}};exports[_0x28f0('0x3e')]=function(_0x48afea){try{if(!_[_0x28f0('0x17')](queues[_0x48afea['uniqueid']])){if(queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x18')]){utils[_0x28f0('0x12')](util['format'](_0x28f0('0x3f'),_0x48afea['uniqueid']),_0x48afea);queues[_0x48afea['uniqueid']][_0x28f0('0x19')]=![];queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x19')]=![];queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x29')]=null;queues[_0x48afea['uniqueid']][_0x28f0('0x1a')]=![];queues[_0x48afea['uniqueid']][_0x28f0('0x2a')]=null;queues[_0x48afea[_0x28f0('0x6')]]['assigned']=!![];queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x9')]=_0x48afea['membername'];queues[_0x48afea[_0x28f0('0x6')]]['queuecallercomplete']=!![];queues[_0x48afea['uniqueid']]['queuecallercompleteAt']=utils['now']();if(_0x48afea['reason']=='transfer'){if(!queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x40')]){queues[_0x48afea[_0x28f0('0x6')]]['queuecallerexitreason']=_0x28f0('0x41');}}else{queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x1d')]='COMPLETEDBY'+_0x48afea['reason'][_0x28f0('0x27')]();}utils[_0x28f0('0x3')](util[_0x28f0('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x48afea[_0x28f0('0x6')],queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x21')],_0x48afea[_0x28f0('0x3b')],queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x1d')]));writeDB(queues[_0x48afea[_0x28f0('0x6')]]);}}}catch(_0x5cfd54){utils['error'](util[_0x28f0('0x4')](_0x28f0('0x3f'),_0x48afea[_0x28f0('0x6')]),_0x5cfd54);}};exports[_0x28f0('0x42')]=function(_0x5bce82){try{if(!_[_0x28f0('0x17')](queues[_0x5bce82[_0x28f0('0x43')]])){utils[_0x28f0('0x12')](util[_0x28f0('0x4')]('[%s][queues][blindtransfer]',_0x5bce82[_0x28f0('0x6')]),_0x5bce82);queues[_0x5bce82[_0x28f0('0x43')]][_0x28f0('0x40')]=!![];queues[_0x5bce82[_0x28f0('0x43')]][_0x28f0('0x44')]='BLIND';queues[_0x5bce82['transfereeuniqueid']][_0x28f0('0x45')]=_0x5bce82[_0x28f0('0x46')];queues[_0x5bce82['transfereeuniqueid']]['transferuniqueid']=_0x5bce82['transfereeuniqueid'];queues[_0x5bce82[_0x28f0('0x43')]][_0x28f0('0x1d')]=_0x28f0('0x47');utils[_0x28f0('0x3')](util[_0x28f0('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x5bce82[_0x28f0('0x6')],queues[_0x5bce82[_0x28f0('0x43')]][_0x28f0('0x21')],_0x5bce82['transfereeuniqueid'],_0x5bce82[_0x28f0('0x46')]));}}catch(_0xce24dd){utils[_0x28f0('0x2e')](util['format']('[%s][queues][blindtransfer]',_0x5bce82[_0x28f0('0x6')]),_0xce24dd);}};exports[_0x28f0('0x48')]=function(_0x13d23d){try{utils['debug'](util[_0x28f0('0x4')](_0x28f0('0x49'),_0x13d23d[_0x28f0('0x4a')]),_0x13d23d);if(_0x13d23d[_0x28f0('0x4a')]==_0x13d23d[_0x28f0('0x4b')]){if(!_[_0x28f0('0x17')](queues[_0x13d23d[_0x28f0('0x4c')]])){utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x4d'),_0x13d23d[_0x28f0('0x4a')],queues[_0x13d23d[_0x28f0('0x4c')]][_0x28f0('0x21')],_0x13d23d[_0x28f0('0x4e')]));queues[_0x13d23d[_0x28f0('0x4c')]]['transfer']=!![];queues[_0x13d23d[_0x28f0('0x4c')]][_0x28f0('0x44')]=_0x28f0('0x4f');queues[_0x13d23d[_0x28f0('0x4c')]]['transferexten']=_0x13d23d['origtransfererexten'];queues[_0x13d23d['secondtransfererlinkedid']][_0x28f0('0x50')]=_0x13d23d[_0x28f0('0x4a')];queues[_0x13d23d['secondtransfererlinkedid']][_0x28f0('0x1d')]=_0x28f0('0x51');}if(!_[_0x28f0('0x17')](queues[_0x13d23d[_0x28f0('0x4b')]])){if(_0x13d23d['transfereelinkedid']&&queues[_0x13d23d[_0x28f0('0x52')]]){queues[_0x13d23d['transfereelinkedid']][_0x28f0('0x22')]=0x1;queues[_0x13d23d[_0x28f0('0x43')]]=_[_0x28f0('0x53')](queues[_0x13d23d[_0x28f0('0x52')]]);queues[_0x13d23d[_0x28f0('0x43')]][_0x28f0('0x10')]=_0x13d23d[_0x28f0('0x54')];queues[_0x13d23d[_0x28f0('0x43')]][_0x28f0('0x22')]=0x2;queues[_0x13d23d['transfereeuniqueid']][_0x28f0('0xa')]=queues[_0x13d23d['secondtransfererlinkedid']][_0x28f0('0xa')];queues[_0x13d23d['transfereeuniqueid']][_0x28f0('0x55')]=queues[_0x13d23d[_0x28f0('0x4c')]]['calleridname'];queues[_0x13d23d[_0x28f0('0x43')]][_0x28f0('0x38')]=utils[_0x28f0('0x15')]();queues[_0x13d23d[_0x28f0('0x43')]]['queuecallerleaveAt']=utils[_0x28f0('0x15')]();queues[_0x13d23d[_0x28f0('0x43')]][_0x28f0('0x37')]=0x0;queues[_0x13d23d['transfereeuniqueid']][_0x28f0('0x56')]=0x0;utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x57'),_0x13d23d[_0x28f0('0x4a')],queues[_0x13d23d['transfereeuniqueid']]['name'],queues[_0x13d23d[_0x28f0('0x43')]][_0x28f0('0xa')],queues[_0x13d23d[_0x28f0('0x43')]]['calleridname']));}else{utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x58'),_0x13d23d[_0x28f0('0x4a')],queues[_0x13d23d[_0x28f0('0x4b')]]['name'],_0x13d23d['secondtransfererlinkedid']));queues[_0x13d23d[_0x28f0('0x4b')]][_0x28f0('0x10')]=_0x13d23d[_0x28f0('0x4c')];}}}else if(_0x13d23d[_0x28f0('0x59')]==_0x13d23d['secondtransfererlinkedid']){if(!_[_0x28f0('0x17')](queues[_0x13d23d['origtransfererlinkedid']])){utils[_0x28f0('0x3')](util['format'](_0x28f0('0x5a'),_0x13d23d[_0x28f0('0x4a')],queues[_0x13d23d['origtransfererlinkedid']][_0x28f0('0x21')],_0x13d23d[_0x28f0('0x59')],_0x13d23d['secondtransfererexten']));queues[_0x13d23d['origtransfererlinkedid']]['transfer']=!![];queues[_0x13d23d[_0x28f0('0x4b')]][_0x28f0('0x44')]='ATTENDED';queues[_0x13d23d['origtransfererlinkedid']]['transferexten']=_0x13d23d[_0x28f0('0x5b')];queues[_0x13d23d[_0x28f0('0x4b')]][_0x28f0('0x50')]=_0x13d23d[_0x28f0('0x59')];queues[_0x13d23d['origtransfererlinkedid']][_0x28f0('0x1d')]=_0x28f0('0x51');}if(!_['isNil'](queues[_0x13d23d[_0x28f0('0x4c')]])){if(_0x13d23d[_0x28f0('0x5c')]&&queues[_0x13d23d[_0x28f0('0x5c')]]){queues[_0x13d23d[_0x28f0('0x5c')]]['queuecallerenterreason']=0x1;queues[_0x13d23d['transfertargetuniqueid']]=_[_0x28f0('0x53')](queues[_0x13d23d[_0x28f0('0x5c')]]);queues[_0x13d23d[_0x28f0('0x54')]]['transfereduniqueid']=_0x13d23d[_0x28f0('0x54')];queues[_0x13d23d[_0x28f0('0x54')]]['queuecallerenterreason']=0x2;queues[_0x13d23d[_0x28f0('0x54')]][_0x28f0('0xa')]=queues[_0x13d23d[_0x28f0('0x4b')]]['calleridnum'];queues[_0x13d23d[_0x28f0('0x54')]][_0x28f0('0x55')]=queues[_0x13d23d[_0x28f0('0x4b')]][_0x28f0('0x55')];queues[_0x13d23d[_0x28f0('0x54')]][_0x28f0('0x38')]=utils[_0x28f0('0x15')]();queues[_0x13d23d[_0x28f0('0x54')]]['queuecallerleaveAt']=utils['now']();queues[_0x13d23d['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x13d23d[_0x28f0('0x54')]][_0x28f0('0x56')]=0x0;utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x5d'),_0x13d23d[_0x28f0('0x4a')],queues[_0x13d23d[_0x28f0('0x54')]][_0x28f0('0x21')],queues[_0x13d23d[_0x28f0('0x54')]]['transfereduniqueid'],queues[_0x13d23d[_0x28f0('0x54')]][_0x28f0('0xa')],queues[_0x13d23d['transfertargetuniqueid']][_0x28f0('0x55')]));}else{utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x58'),_0x13d23d[_0x28f0('0x4a')],queues[_0x13d23d[_0x28f0('0x4c')]][_0x28f0('0x21')],_0x13d23d[_0x28f0('0x4b')]));queues[_0x13d23d[_0x28f0('0x4c')]][_0x28f0('0x10')]=_0x13d23d[_0x28f0('0x4b')];}}}}catch(_0x13b8a5){utils[_0x28f0('0x2e')](util[_0x28f0('0x4')](_0x28f0('0x49'),_0x13d23d[_0x28f0('0x4a')]),_0x13b8a5);}};exports[_0x28f0('0x5e')]=function(_0xc96492){try{if(!_[_0x28f0('0x17')](queues[_0xc96492[_0x28f0('0x6')]])){utils['debug'](util[_0x28f0('0x4')](_0x28f0('0x5f'),_0xc96492['uniqueid']),_0xc96492);queues[_0xc96492[_0x28f0('0x6')]][_0x28f0('0x60')]=utils[_0x28f0('0x15')]();utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x61'),_0xc96492['uniqueid'],queues[_0xc96492[_0x28f0('0x6')]][_0x28f0('0x21')],queues[_0xc96492['uniqueid']][_0x28f0('0x60')]));}}catch(_0x310ee3){utils[_0x28f0('0x2e')](util[_0x28f0('0x4')](_0x28f0('0x5f'),_0xc96492[_0x28f0('0x6')]),_0x310ee3);}};exports['musiconholdstop']=function(_0x50ba69){try{if(!_[_0x28f0('0x17')](queues[_0x50ba69[_0x28f0('0x6')]])){if(!_[_0x28f0('0x17')](queues[_0x50ba69['uniqueid']][_0x28f0('0x60')])){utils['debug'](util[_0x28f0('0x4')]('[%s][queues][musiconholdstop]',_0x50ba69['uniqueid']),_0x50ba69);queues[_0x50ba69['uniqueid']][_0x28f0('0x56')]+=utils[_0x28f0('0x62')](utils[_0x28f0('0x15')](),queues[_0x50ba69['uniqueid']][_0x28f0('0x60')]);utils[_0x28f0('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x50ba69[_0x28f0('0x6')],queues[_0x50ba69['uniqueid']]['name'],queues[_0x50ba69[_0x28f0('0x6')]][_0x28f0('0x56')]));delete queues[_0x50ba69['uniqueid']][_0x28f0('0x60')];}}}catch(_0x53b40e){utils[_0x28f0('0x2e')](util[_0x28f0('0x4')](_0x28f0('0x63'),_0x50ba69[_0x28f0('0x6')]),_0x53b40e);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index be18ad1..597a86c 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 _0x75d9=['split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','lodash','./utils','./transfers.controller','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','context','exten','error','newstate','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','isNil','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith'];(function(_0x4391e2,_0x4f999e){var _0x28418a=function(_0x524f0c){while(--_0x524f0c){_0x4391e2['push'](_0x4391e2['shift']());}};_0x28418a(++_0x4f999e);}(_0x75d9,0xa1));var _0x975d=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0x75d9[_0x366e99];return _0x180bbe;};'use strict';var _=require(_0x975d('0x0'));var util=require('util');var utils=require(_0x975d('0x1'));var transfers=require(_0x975d('0x2'));var recordings={};function writeDB(_0x3b0b9b){var _0x523d3e;utils['info'](util[_0x975d('0x3')](_0x975d('0x4'),_0x3b0b9b[_0x975d('0x5')]));if(transfers['blinds'][_0x3b0b9b['uniqueid']]){_0x523d3e=_0x3b0b9b['uniqueid'];_0x3b0b9b[_0x975d('0x5')]=transfers[_0x975d('0x6')][_0x3b0b9b[_0x975d('0x5')]]['transfereeuniqueid'];}if(_0x3b0b9b[_0x975d('0x7')]){utils[_0x975d('0x8')](_0x3b0b9b['accountcode'])[_0x975d('0x9')](function(_0x3a0bdc){if(_0x3a0bdc){_0x3b0b9b[_0x975d('0xa')]=_0x3a0bdc[_0x975d('0xb')];_0x3b0b9b[_0x975d('0xc')]=_0x3a0bdc['id'];}utils[_0x975d('0xd')](_0x975d('0xe'),_0x3b0b9b);});}else{utils[_0x975d('0xd')](_0x975d('0xe'),_0x3b0b9b);}if(_0x523d3e)delete transfers[_0x975d('0x6')][_0x523d3e];}exports[_0x975d('0xf')]=function(_0x1e63c9){try{utils[_0x975d('0x10')](util[_0x975d('0x3')](_0x975d('0x11'),_0x1e63c9['uniqueid']),_0x1e63c9);if(_0x1e63c9[_0x975d('0x5')]==_0x1e63c9[_0x975d('0x12')]){utils[_0x975d('0x13')](util[_0x975d('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x1e63c9[_0x975d('0x5')],_0x1e63c9[_0x975d('0x14')],_0x1e63c9[_0x975d('0x15')]));recordings[_0x1e63c9['uniqueid']]={'uniqueid':_0x1e63c9['uniqueid'],'accountcode':_0x1e63c9[_0x975d('0x7')],'exten':_0x1e63c9[_0x975d('0x15')],'context':_0x1e63c9[_0x975d('0x14')],'channel':_0x1e63c9['channel'],'monitors':[]};}}catch(_0x262abb){utils[_0x975d('0x16')](util[_0x975d('0x3')]('[%s][recordings][newchannel]',_0x1e63c9[_0x975d('0x5')]),_0x262abb);}};exports[_0x975d('0x17')]=function(_0x16f3cd){try{utils['debug'](util[_0x975d('0x3')]('[%s][recordings][newstate]',_0x16f3cd[_0x975d('0x5')]),_0x16f3cd);if(!_['isNil'](recordings[_0x16f3cd['uniqueid']])&&_0x16f3cd[_0x975d('0x18')]==0x6){utils[_0x975d('0x13')](util[_0x975d('0x3')](_0x975d('0x19'),_0x16f3cd[_0x975d('0x5')],_0x16f3cd[_0x975d('0x14')],_0x16f3cd[_0x975d('0x1a')]));}else if(!_['isNil'](recordings[_0x16f3cd[_0x975d('0x12')]])&&_0x16f3cd['channelstate']==0x6&&_0x16f3cd[_0x975d('0x14')]!=_0x975d('0x1b')){utils[_0x975d('0x13')](util[_0x975d('0x3')](_0x975d('0x1c'),_0x16f3cd[_0x975d('0x5')],_0x16f3cd[_0x975d('0x12')],_0x16f3cd[_0x975d('0x14')],_0x16f3cd[_0x975d('0x1a')]));recordings[_0x16f3cd['linkedid']]['accountcode']=_0x16f3cd[_0x975d('0x7')];}}catch(_0xfe80fd){utils[_0x975d('0x16')](util['format'](_0x975d('0x1d'),_0x16f3cd['uniqueid']),_0xfe80fd);}};exports[_0x975d('0x1e')]=function(_0x22389c){try{if(!_[_0x975d('0x1f')](_0x22389c[_0x975d('0x20')])&&!_['isNil'](_0x22389c[_0x975d('0x20')][_0x975d('0x21')])){utils[_0x975d('0x10')](util[_0x975d('0x3')]('[%s][recordings][varset]',_0x22389c[_0x975d('0x5')]),_0x22389c);utils[_0x975d('0x13')](util[_0x975d('0x3')](_0x975d('0x22'),_0x22389c[_0x975d('0x5')],_0x22389c['variable'],_0x22389c[_0x975d('0x23')]));if(_[_0x975d('0x24')](_0x22389c[_0x975d('0x23')],_0x975d('0x25'))){_0x22389c[_0x975d('0x23')]=_0x22389c[_0x975d('0x23')][_0x975d('0x26')](_0x975d('0x25'),_0x975d('0x27'));}if(recordings[_0x22389c[_0x975d('0x12')]]){var _0x1a28a6=_[_0x975d('0x28')](recordings[_0x22389c['linkedid']][_0x975d('0x29')],{'value':_0x22389c[_0x975d('0x23')]});if(_[_0x975d('0x1f')](_0x1a28a6)){recordings[_0x22389c['linkedid']]['monitors'][_0x975d('0x2a')]({'value':_0x22389c[_0x975d('0x23')]});}}}}catch(_0x39d3d3){utils[_0x975d('0x16')](util['format'](_0x975d('0x2b'),_0x22389c[_0x975d('0x5')]),_0x39d3d3);}};exports['hangup']=function(_0x5e9ca3){try{if(!_[_0x975d('0x1f')](recordings[_0x5e9ca3[_0x975d('0x5')]])){utils[_0x975d('0x10')](util['format'](_0x975d('0x2c'),_0x5e9ca3[_0x975d('0x5')]),_0x5e9ca3);utils[_0x975d('0x13')](util[_0x975d('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x5e9ca3[_0x975d('0x5')],_0x5e9ca3[_0x975d('0x2d')],_0x5e9ca3[_0x975d('0x2e')],_0x5e9ca3[_0x975d('0x2f')]));recordings[_0x5e9ca3['uniqueid']][_0x975d('0x2d')]=_0x5e9ca3[_0x975d('0x2d')];recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x2e')]=_0x5e9ca3[_0x975d('0x2e')];recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x30')]=_0x5e9ca3[_0x975d('0x30')];recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x31')]=_0x5e9ca3[_0x975d('0x31')];if(recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x32')]==_0x975d('0x33')&&recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x7')]){recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x30')]=recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x7')];recordings[_0x5e9ca3[_0x975d('0x5')]]['connectedlinename']='';}recordings[_0x5e9ca3[_0x975d('0x5')]]['monitors'][_0x975d('0x34')](function(_0x14473e){var _0xd84bcb=_[_0x975d('0x35')](recordings[_0x5e9ca3[_0x975d('0x5')]]);_0xd84bcb['value']=_0x14473e[_0x975d('0x23')];writeDB(_0xd84bcb);});delete recordings[_0x5e9ca3[_0x975d('0x5')]];}}catch(_0x413de2){utils[_0x975d('0x16')](util[_0x975d('0x3')](_0x975d('0x2c'),_0x5e9ca3[_0x975d('0x5')]),_0x413de2);}};exports[_0x975d('0x36')]=function(_0xcdf9d8){try{if(!_[_0x975d('0x1f')](recordings[_0xcdf9d8[_0x975d('0x5')]])){utils[_0x975d('0x10')](util['format'](_0x975d('0x37'),_0xcdf9d8[_0x975d('0x5')]),_0xcdf9d8);utils['info'](util[_0x975d('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0xcdf9d8['uniqueid'],_0xcdf9d8[_0x975d('0x38')],_0xcdf9d8[_0x975d('0x39')]));if(_0xcdf9d8[_0x975d('0x38')][_0x975d('0x3a')]()==_0x975d('0x3b')&&_[_0x975d('0x3c')](_0xcdf9d8[_0x975d('0x39')][_0x975d('0x3a')](),'cdr')){var _0x5f53f2=_0xcdf9d8['appdata'][_0x975d('0x3d')]('=');var _0x533ca7=_0x5f53f2[0x0][_0x975d('0x3e')](_0x5f53f2[0x0]['lastIndexOf']('(')+0x1,_0x5f53f2[0x0][_0x975d('0x3f')](')'));var _0x15c6f6=_0x5f53f2[0x1];recordings[_0xcdf9d8['uniqueid']][_0x533ca7]=_0x15c6f6;}}}catch(_0x452c3e){utils['error'](util[_0x975d('0x3')](_0x975d('0x37'),_0xcdf9d8[_0x975d('0x5')]),_0x452c3e);}};exports['queuecallerjoin']=function(_0x5cc6d0){try{if(!_[_0x975d('0x1f')](recordings[_0x5cc6d0[_0x975d('0x5')]])){utils[_0x975d('0x10')](util[_0x975d('0x3')](_0x975d('0x40'),_0x5cc6d0[_0x975d('0x5')]),_0x5cc6d0);utils[_0x975d('0x13')](util[_0x975d('0x3')](_0x975d('0x41'),_0x5cc6d0[_0x975d('0x5')],_0x5cc6d0[_0x975d('0x42')]));recordings[_0x5cc6d0[_0x975d('0x5')]]['queue']=_0x5cc6d0[_0x975d('0x42')];}}catch(_0x38f61b){utils[_0x975d('0x16')](util[_0x975d('0x3')](_0x975d('0x40'),_0x5cc6d0['uniqueid']),_0x38f61b);}};exports[_0x975d('0x43')]=function(_0x261435){try{utils['debug'](util['format'](_0x975d('0x44'),_0x261435[_0x975d('0x5')]),_0x261435);utils[_0x975d('0x13')](util['format'](_0x975d('0x45'),_0x261435[_0x975d('0x5')],_0x261435[_0x975d('0x46')],_0x261435[_0x975d('0x47')],_0x261435['transfereecalleridnum'],_0x261435[_0x975d('0x48')]));if(recordings[_0x261435[_0x975d('0x49')]]&&transfers[_0x975d('0x6')][_0x261435[_0x975d('0x49')]]){transfers[_0x975d('0x6')][_0x261435[_0x975d('0x49')]]['recording']=!![];}}catch(_0x1c5a3e){utils['error'](util['format'](_0x975d('0x44'),_0x261435[_0x975d('0x5')]),_0x1c5a3e);}}; \ No newline at end of file +var _0x3cfe=['recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','membername','name','UserId','request','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','isNil','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','.wav49','value','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinename','outbound','connectedlinenum','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid'];(function(_0x50702f,_0x4f509a){var _0x38cc6a=function(_0x36e905){while(--_0x36e905){_0x50702f['push'](_0x50702f['shift']());}};_0x38cc6a(++_0x4f509a);}(_0x3cfe,0x1eb));var _0xe3cf=function(_0x53c0da,_0x1e32f2){_0x53c0da=_0x53c0da-0x0;var _0x2cfb3c=_0x3cfe[_0x53c0da];return _0x2cfb3c;};'use strict';var _=require(_0xe3cf('0x0'));var util=require(_0xe3cf('0x1'));var utils=require(_0xe3cf('0x2'));var transfers=require(_0xe3cf('0x3'));var recordings={};function writeDB(_0x3007d2){var _0x5f2fb4;utils[_0xe3cf('0x4')](util[_0xe3cf('0x5')](_0xe3cf('0x6'),_0x3007d2[_0xe3cf('0x7')]));if(transfers[_0xe3cf('0x8')][_0x3007d2[_0xe3cf('0x7')]]){_0x5f2fb4=_0x3007d2[_0xe3cf('0x7')];_0x3007d2[_0xe3cf('0x7')]=transfers['blinds'][_0x3007d2[_0xe3cf('0x7')]]['transfereeuniqueid'];}if(_0x3007d2[_0xe3cf('0x9')]){utils[_0xe3cf('0xa')](_0x3007d2[_0xe3cf('0x9')])['then'](function(_0x1b96b4){if(_0x1b96b4){_0x3007d2[_0xe3cf('0xb')]=_0x1b96b4[_0xe3cf('0xc')];_0x3007d2[_0xe3cf('0xd')]=_0x1b96b4['id'];}utils['request']('CreateVoiceRecording',_0x3007d2);});}else{utils[_0xe3cf('0xe')]('CreateVoiceRecording',_0x3007d2);}if(_0x5f2fb4)delete transfers[_0xe3cf('0x8')][_0x5f2fb4];}exports['newchannel']=function(_0x1083e3){try{utils[_0xe3cf('0xf')](util['format']('[%s][recordings][newchannel]',_0x1083e3['uniqueid']),_0x1083e3);if(_0x1083e3[_0xe3cf('0x7')]==_0x1083e3[_0xe3cf('0x10')]){utils[_0xe3cf('0x4')](util['format'](_0xe3cf('0x11'),_0x1083e3[_0xe3cf('0x7')],_0x1083e3[_0xe3cf('0x12')],_0x1083e3[_0xe3cf('0x13')]));recordings[_0x1083e3['uniqueid']]={'uniqueid':_0x1083e3[_0xe3cf('0x7')],'accountcode':_0x1083e3[_0xe3cf('0x9')],'exten':_0x1083e3[_0xe3cf('0x13')],'context':_0x1083e3['context'],'channel':_0x1083e3[_0xe3cf('0x14')],'monitors':[]};}}catch(_0x5a7d47){utils[_0xe3cf('0x15')](util[_0xe3cf('0x5')](_0xe3cf('0x16'),_0x1083e3[_0xe3cf('0x7')]),_0x5a7d47);}};exports['newstate']=function(_0x1f1f1d){try{utils[_0xe3cf('0xf')](util[_0xe3cf('0x5')]('[%s][recordings][newstate]',_0x1f1f1d[_0xe3cf('0x7')]),_0x1f1f1d);if(!_['isNil'](recordings[_0x1f1f1d[_0xe3cf('0x7')]])&&_0x1f1f1d[_0xe3cf('0x17')]==0x6){utils['info'](util[_0xe3cf('0x5')](_0xe3cf('0x18'),_0x1f1f1d[_0xe3cf('0x7')],_0x1f1f1d[_0xe3cf('0x12')],_0x1f1f1d['channel']));}else if(!_['isNil'](recordings[_0x1f1f1d['linkedid']])&&_0x1f1f1d[_0xe3cf('0x17')]==0x6&&_0x1f1f1d[_0xe3cf('0x12')]!='transfer'){utils[_0xe3cf('0x4')](util[_0xe3cf('0x5')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1f1f1d[_0xe3cf('0x7')],_0x1f1f1d[_0xe3cf('0x10')],_0x1f1f1d['context'],_0x1f1f1d[_0xe3cf('0x14')]));recordings[_0x1f1f1d[_0xe3cf('0x10')]]['accountcode']=_0x1f1f1d[_0xe3cf('0x9')];}}catch(_0x2a15bc){utils[_0xe3cf('0x15')](util['format'](_0xe3cf('0x19'),_0x1f1f1d['uniqueid']),_0x2a15bc);}};exports[_0xe3cf('0x1a')]=function(_0x33d9e9){try{if(!_[_0xe3cf('0x1b')](_0x33d9e9[_0xe3cf('0x1c')])&&!_[_0xe3cf('0x1b')](_0x33d9e9[_0xe3cf('0x1c')]['mixmonitor_filename'])){utils[_0xe3cf('0xf')](util[_0xe3cf('0x5')](_0xe3cf('0x1d'),_0x33d9e9[_0xe3cf('0x7')]),_0x33d9e9);utils[_0xe3cf('0x4')](util[_0xe3cf('0x5')](_0xe3cf('0x1e'),_0x33d9e9['uniqueid'],_0x33d9e9[_0xe3cf('0x1c')],_0x33d9e9['value']));if(_['endsWith'](_0x33d9e9['value'],_0xe3cf('0x1f'))){_0x33d9e9['value']=_0x33d9e9[_0xe3cf('0x20')][_0xe3cf('0x21')](_0xe3cf('0x1f'),_0xe3cf('0x22'));}if(recordings[_0x33d9e9[_0xe3cf('0x10')]]){var _0x5c9b8b=_[_0xe3cf('0x23')](recordings[_0x33d9e9[_0xe3cf('0x10')]][_0xe3cf('0x24')],{'value':_0x33d9e9['value']});if(_[_0xe3cf('0x1b')](_0x5c9b8b)){recordings[_0x33d9e9[_0xe3cf('0x10')]][_0xe3cf('0x24')][_0xe3cf('0x25')]({'value':_0x33d9e9[_0xe3cf('0x20')]});}}}}catch(_0x1bd865){utils[_0xe3cf('0x15')](util[_0xe3cf('0x5')]('[%s][recordings][varset]',_0x33d9e9[_0xe3cf('0x7')]),_0x1bd865);}};exports[_0xe3cf('0x26')]=function(_0x32e593){try{if(!_[_0xe3cf('0x1b')](recordings[_0x32e593[_0xe3cf('0x7')]])){utils[_0xe3cf('0xf')](util[_0xe3cf('0x5')](_0xe3cf('0x27'),_0x32e593['uniqueid']),_0x32e593);utils[_0xe3cf('0x4')](util[_0xe3cf('0x5')](_0xe3cf('0x28'),_0x32e593[_0xe3cf('0x7')],_0x32e593['calleridnum'],_0x32e593[_0xe3cf('0x29')],_0x32e593[_0xe3cf('0x2a')]));recordings[_0x32e593[_0xe3cf('0x7')]][_0xe3cf('0x2b')]=_0x32e593[_0xe3cf('0x2b')];recordings[_0x32e593['uniqueid']]['calleridname']=_0x32e593[_0xe3cf('0x29')];recordings[_0x32e593[_0xe3cf('0x7')]]['connectedlinenum']=_0x32e593['connectedlinenum'];recordings[_0x32e593['uniqueid']][_0xe3cf('0x2c')]=_0x32e593[_0xe3cf('0x2c')];if(recordings[_0x32e593[_0xe3cf('0x7')]]['type']==_0xe3cf('0x2d')&&recordings[_0x32e593[_0xe3cf('0x7')]][_0xe3cf('0x9')]){recordings[_0x32e593[_0xe3cf('0x7')]][_0xe3cf('0x2e')]=recordings[_0x32e593[_0xe3cf('0x7')]][_0xe3cf('0x9')];recordings[_0x32e593[_0xe3cf('0x7')]][_0xe3cf('0x2c')]='';}recordings[_0x32e593[_0xe3cf('0x7')]][_0xe3cf('0x24')]['forEach'](function(_0x462375){var _0x5e7304=_[_0xe3cf('0x2f')](recordings[_0x32e593[_0xe3cf('0x7')]]);_0x5e7304[_0xe3cf('0x20')]=_0x462375[_0xe3cf('0x20')];writeDB(_0x5e7304);});delete recordings[_0x32e593[_0xe3cf('0x7')]];}}catch(_0x3071cc){utils[_0xe3cf('0x15')](util[_0xe3cf('0x5')](_0xe3cf('0x27'),_0x32e593[_0xe3cf('0x7')]),_0x3071cc);}};exports[_0xe3cf('0x30')]=function(_0xc3f50e){try{if(!_[_0xe3cf('0x1b')](recordings[_0xc3f50e[_0xe3cf('0x7')]])){utils[_0xe3cf('0xf')](util[_0xe3cf('0x5')](_0xe3cf('0x31'),_0xc3f50e[_0xe3cf('0x7')]),_0xc3f50e);utils[_0xe3cf('0x4')](util[_0xe3cf('0x5')](_0xe3cf('0x32'),_0xc3f50e['uniqueid'],_0xc3f50e['application'],_0xc3f50e[_0xe3cf('0x33')]));if(_0xc3f50e[_0xe3cf('0x34')][_0xe3cf('0x35')]()=='set'&&_[_0xe3cf('0x36')](_0xc3f50e['appdata'][_0xe3cf('0x35')](),_0xe3cf('0x37'))){var _0x5bee70=_0xc3f50e[_0xe3cf('0x33')][_0xe3cf('0x38')]('=');var _0x421d32=_0x5bee70[0x0]['substring'](_0x5bee70[0x0][_0xe3cf('0x39')]('(')+0x1,_0x5bee70[0x0]['lastIndexOf'](')'));var _0x57308e=_0x5bee70[0x1];recordings[_0xc3f50e[_0xe3cf('0x7')]][_0x421d32]=_0x57308e;}}}catch(_0xe82a0e){utils['error'](util[_0xe3cf('0x5')]('[%s][recordings][newexten]',_0xc3f50e['uniqueid']),_0xe82a0e);}};exports[_0xe3cf('0x3a')]=function(_0xa519ab){try{if(!_[_0xe3cf('0x1b')](recordings[_0xa519ab[_0xe3cf('0x7')]])){utils[_0xe3cf('0xf')](util[_0xe3cf('0x5')](_0xe3cf('0x3b'),_0xa519ab[_0xe3cf('0x7')]),_0xa519ab);utils[_0xe3cf('0x4')](util[_0xe3cf('0x5')](_0xe3cf('0x3c'),_0xa519ab[_0xe3cf('0x7')],_0xa519ab[_0xe3cf('0x3d')]));recordings[_0xa519ab[_0xe3cf('0x7')]][_0xe3cf('0x3d')]=_0xa519ab[_0xe3cf('0x3d')];}}catch(_0x5775e7){utils[_0xe3cf('0x15')](util[_0xe3cf('0x5')](_0xe3cf('0x3b'),_0xa519ab[_0xe3cf('0x7')]),_0x5775e7);}};exports[_0xe3cf('0x3e')]=function(_0x5f2494){try{utils[_0xe3cf('0xf')](util['format'](_0xe3cf('0x3f'),_0x5f2494['uniqueid']),_0x5f2494);utils[_0xe3cf('0x4')](util['format'](_0xe3cf('0x40'),_0x5f2494[_0xe3cf('0x7')],_0x5f2494[_0xe3cf('0x41')],_0x5f2494[_0xe3cf('0x42')],_0x5f2494[_0xe3cf('0x43')],_0x5f2494['transfereecalleridname']));if(recordings[_0x5f2494[_0xe3cf('0x44')]]&&transfers[_0xe3cf('0x8')][_0x5f2494[_0xe3cf('0x44')]]){transfers[_0xe3cf('0x8')][_0x5f2494[_0xe3cf('0x44')]][_0xe3cf('0x45')]=!![];}}catch(_0x569584){utils['error'](util[_0xe3cf('0x5')](_0xe3cf('0x3f'),_0x5f2494['uniqueid']),_0x569584);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 45f41f4..3780a78 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 _0x7889=['[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x473fd1,_0x5d61fc){var _0x142dfd=function(_0x12b7a1){while(--_0x12b7a1){_0x473fd1['push'](_0x473fd1['shift']());}};_0x142dfd(++_0x5d61fc);}(_0x7889,0xd8));var _0x9788=function(_0x8674ad,_0x4bac00){_0x8674ad=_0x8674ad-0x0;var _0xae0a35=_0x7889[_0x8674ad];return _0xae0a35;};'use strict';var _=require(_0x9788('0x0'));var util=require(_0x9788('0x1'));var utils=require(_0x9788('0x2'));function writeDB(_0xb62e20){utils[_0x9788('0x3')](util[_0x9788('0x4')](_0x9788('0x5'),_0xb62e20[_0x9788('0x6')]==='attended'?_0xb62e20[_0x9788('0x7')]:_0xb62e20[_0x9788('0x8')],_0xb62e20[_0x9788('0x6')]));utils[_0x9788('0x9')](_0x9788('0xa'),_0xb62e20);}exports[_0x9788('0xb')]={};exports['blindtransfer']=function(_0x35981c){try{utils[_0x9788('0xc')](util['format'](_0x9788('0xd'),_0x35981c['uniqueid']),_0x35981c);utils[_0x9788('0x3')](util['format'](_0x9788('0xe'),_0x35981c[_0x9788('0x8')],_0x35981c[_0x9788('0xf')],_0x35981c[_0x9788('0x10')],_0x35981c[_0x9788('0x11')],_0x35981c[_0x9788('0x12')]));_0x35981c['type']=_0x9788('0x13');exports[_0x9788('0xb')][_0x35981c[_0x9788('0x14')]]=_0x35981c;writeDB(_0x35981c);}catch(_0x4c17e2){utils[_0x9788('0x15')](util[_0x9788('0x4')](_0x9788('0xd'),_0x35981c[_0x9788('0x8')]),_0x4c17e2);}};exports['attendedtransfer']=function(_0x574720){try{utils['debug'](util[_0x9788('0x4')]('[%s][transfers][attendedtransfer]',_0x574720[_0x9788('0x7')]),_0x574720);utils['info'](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x574720[_0x9788('0x7')],_0x574720['origtransferercalleridnum'],_0x574720[_0x9788('0x16')],_0x574720[_0x9788('0x17')],_0x574720[_0x9788('0x18')]));_0x574720=_[_0x9788('0x19')](_0x574720,{'transfererchannel':_0x574720[_0x9788('0x1a')],'transferercalleridnum':_0x574720['origtransferercalleridnum'],'transferercalleridname':_0x574720['origtransferercalleridname'],'transfererconnectedlinenum':_0x574720[_0x9788('0x1b')],'transfererconnectedlinename':_0x574720[_0x9788('0x1c')],'transfereraccountcode':_0x574720['origtransfereraccountcode'],'transferercontext':_0x574720[_0x9788('0x1d')],'transfererexten':_0x574720[_0x9788('0x1e')],'transfererlinkedid':_0x574720[_0x9788('0x1f')],'context':_0x574720[_0x9788('0x20')],'extension':_0x574720[_0x9788('0x21')],'type':_0x9788('0x22')});if(_[_0x9788('0x23')](_0x574720[_0x9788('0x24')])){_0x574720=_[_0x9788('0x19')](_0x574720,{'transfereechannel':_0x574720[_0x9788('0x25')],'transfereecalleridnum':_0x574720[_0x9788('0x17')],'transfereecalleridname':_0x574720[_0x9788('0x18')],'transfereeconnectedlinenum':_0x574720[_0x9788('0x26')],'transfereeconnectedlinename':_0x574720[_0x9788('0x27')],'transfereeaccountcode':_0x574720[_0x9788('0x28')],'transfereecontext':_0x574720[_0x9788('0x29')],'transfereeexten':_0x574720['transfertargetexten'],'transfereelinkedid':_0x574720['transfertargetlinkedid']});}writeDB(_0x574720);}catch(_0x15294f){utils[_0x9788('0x15')](util['format'](_0x9788('0x2a'),_0x574720[_0x9788('0x7')]),_0x15294f);}}; \ No newline at end of file +var _0x8977=['transfertargetexten','transfertargetlinkedid','lodash','./utils','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','blinds','transfereruniqueid','error','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode'];(function(_0x2d9f8b,_0x1eca48){var _0x251209=function(_0x15205f){while(--_0x15205f){_0x2d9f8b['push'](_0x2d9f8b['shift']());}};_0x251209(++_0x1eca48);}(_0x8977,0x161));var _0x7897=function(_0x4d20ff,_0x345261){_0x4d20ff=_0x4d20ff-0x0;var _0x2a7372=_0x8977[_0x4d20ff];return _0x2a7372;};'use strict';var _=require(_0x7897('0x0'));var util=require('util');var utils=require(_0x7897('0x1'));function writeDB(_0x32dba9){utils['info'](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x32dba9['type']===_0x7897('0x2')?_0x32dba9[_0x7897('0x3')]:_0x32dba9[_0x7897('0x4')],_0x32dba9[_0x7897('0x5')]));utils[_0x7897('0x6')](_0x7897('0x7'),_0x32dba9);}exports['blinds']={};exports[_0x7897('0x8')]=function(_0x5df83d){try{utils[_0x7897('0x9')](util[_0x7897('0xa')](_0x7897('0xb'),_0x5df83d[_0x7897('0x4')]),_0x5df83d);utils[_0x7897('0xc')](util[_0x7897('0xa')](_0x7897('0xd'),_0x5df83d[_0x7897('0x4')],_0x5df83d[_0x7897('0xe')],_0x5df83d[_0x7897('0xf')],_0x5df83d[_0x7897('0x10')],_0x5df83d['transfereecalleridname']));_0x5df83d[_0x7897('0x5')]=_0x7897('0x11');exports[_0x7897('0x12')][_0x5df83d[_0x7897('0x13')]]=_0x5df83d;writeDB(_0x5df83d);}catch(_0x41a346){utils[_0x7897('0x14')](util['format'](_0x7897('0xb'),_0x5df83d[_0x7897('0x4')]),_0x41a346);}};exports['attendedtransfer']=function(_0x3251fa){try{utils[_0x7897('0x9')](util[_0x7897('0xa')]('[%s][transfers][attendedtransfer]',_0x3251fa[_0x7897('0x3')]),_0x3251fa);utils[_0x7897('0xc')](util[_0x7897('0xa')](_0x7897('0x15'),_0x3251fa[_0x7897('0x3')],_0x3251fa[_0x7897('0x16')],_0x3251fa['origtransferercalleridname'],_0x3251fa[_0x7897('0x17')],_0x3251fa['transfertargetcalleridname']));_0x3251fa=_[_0x7897('0x18')](_0x3251fa,{'transfererchannel':_0x3251fa[_0x7897('0x19')],'transferercalleridnum':_0x3251fa[_0x7897('0x16')],'transferercalleridname':_0x3251fa[_0x7897('0x1a')],'transfererconnectedlinenum':_0x3251fa[_0x7897('0x1b')],'transfererconnectedlinename':_0x3251fa[_0x7897('0x1c')],'transfereraccountcode':_0x3251fa[_0x7897('0x1d')],'transferercontext':_0x3251fa['secondtransferercontext'],'transfererexten':_0x3251fa[_0x7897('0x1e')],'transfererlinkedid':_0x3251fa[_0x7897('0x1f')],'context':_0x3251fa[_0x7897('0x20')],'extension':_0x3251fa[_0x7897('0x21')],'type':'attended'});if(_['isNil'](_0x3251fa['transfereechannel'])){_0x3251fa=_[_0x7897('0x18')](_0x3251fa,{'transfereechannel':_0x3251fa[_0x7897('0x22')],'transfereecalleridnum':_0x3251fa['transfertargetcalleridnum'],'transfereecalleridname':_0x3251fa['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3251fa[_0x7897('0x23')],'transfereeconnectedlinename':_0x3251fa['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3251fa[_0x7897('0x24')],'transfereecontext':_0x3251fa['transfertargetcontext'],'transfereeexten':_0x3251fa[_0x7897('0x25')],'transfereelinkedid':_0x3251fa[_0x7897('0x26')]});}writeDB(_0x3251fa);}catch(_0x3233e8){utils[_0x7897('0x14')](util[_0x7897('0xa')]('[%s][transfers][attendedtransfer]',_0x3251fa['origtransfereruniqueid']),_0x3233e8);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 3d1f9ce..ece852e 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 _0x65e8=['then','[utils][request]\x20name:%s','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','name','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request'];(function(_0x43366d,_0x18cb56){var _0x52c4d8=function(_0x2a17f3){while(--_0x2a17f3){_0x43366d['push'](_0x43366d['shift']());}};_0x52c4d8(++_0x18cb56);}(_0x65e8,0x1d4));var _0x865e=function(_0x2adeda,_0x252d4c){_0x2adeda=_0x2adeda-0x0;var _0x3dc50e=_0x65e8[_0x2adeda];return _0x3dc50e;};'use strict';var BPromise=require(_0x865e('0x0'));var jayson=require('jayson/promise');var moment=require(_0x865e('0x1'));var util=require(_0x865e('0x2'));var client=jayson[_0x865e('0x3')][_0x865e('0x4')]({'port':0x2329});var logger=require(_0x865e('0x5'))(_0x865e('0x6'));exports[_0x865e('0x7')]=function(_0x2c65f9,_0x36b05a){logger[_0x865e('0x7')](_0x2c65f9,_0x36b05a?util[_0x865e('0x8')](_0x36b05a,{'showHidden':![],'depth':null}):'');};exports[_0x865e('0x9')]=function(_0x53dfc8,_0x5c420d){logger['debug'](_0x53dfc8,_0x5c420d?util['inspect'](_0x5c420d,{'showHidden':![],'depth':null}):'');};exports[_0x865e('0xa')]=function(_0x525c1e,_0x43f218){logger[_0x865e('0xa')](_0x525c1e,_0x43f218?util[_0x865e('0x8')](_0x43f218,{'showHidden':![],'depth':null}):'');};exports[_0x865e('0xb')]=function(_0x27c6d3,_0x4adb20){return client[_0x865e('0xb')](_0x27c6d3,{'body':_0x4adb20})[_0x865e('0xc')](function(_0x1b0fae){logger['debug'](_0x865e('0xd'),_0x27c6d3,_0x1b0fae?util[_0x865e('0x8')](_0x1b0fae,{'showHidden':![],'depth':null}):'');})['catch'](function(_0xd85c05){logger[_0x865e('0xa')](_0x865e('0xd'),_0x27c6d3,_0xd85c05?util[_0x865e('0x8')](_0xd85c05,{'showHidden':![],'depth':null}):'');});};function getUser(_0x196e20){return client['request'](_0x865e('0xe'),{'options':{'raw':!![],'attributes':['id',_0x865e('0xf'),'name',_0x865e('0x10')],'where':_0x196e20,'limit':0x1}})[_0x865e('0xc')](function(_0x339d8e){logger['debug'](_0x865e('0x11'),JSON[_0x865e('0x12')](_0x196e20),_0x339d8e?util[_0x865e('0x8')](_0x339d8e,{'showHidden':![],'depth':null}):'');return _0x339d8e[_0x865e('0x13')][_0x865e('0x14')]?_0x339d8e[_0x865e('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x55c9b9){return new BPromise(function(_0x369f58,_0x1f5d81){if(_0x55c9b9){return getUser({'internal':_0x55c9b9})[_0x865e('0xc')](function(_0x1a6dfb){logger[_0x865e('0x7')](_0x865e('0x15'),_0x55c9b9,_0x1a6dfb?'found':_0x865e('0x16'));return _0x369f58(_0x1a6dfb);})[_0x865e('0x17')](function(_0x4bed01){logger[_0x865e('0xa')](_0x865e('0x18'),_0x4bed01?util[_0x865e('0x8')](_0x4bed01,{'showHidden':![],'depth':null}):'');return _0x369f58(null);});}return _0x369f58(null);});};exports[_0x865e('0x19')]=function(_0x4ff417){return new BPromise(function(_0x388dc5,_0x20a963){if(_0x4ff417){return getUser({'interface':_0x4ff417})[_0x865e('0xc')](function(_0x500a52){logger[_0x865e('0x7')](_0x865e('0x1a'),_0x4ff417,_0x500a52?_0x865e('0x1b'):_0x865e('0x16'));return _0x388dc5(_0x500a52);})[_0x865e('0x17')](function(_0xfbbcf1){logger[_0x865e('0xa')](_0x865e('0x1c'),_0xfbbcf1?util[_0x865e('0x8')](_0xfbbcf1,{'showHidden':![],'depth':null}):'');return _0x388dc5(null);});}return _0x388dc5(null);});};exports[_0x865e('0x1d')]=function(_0x4ce460){return new BPromise(function(_0x28e228,_0x2d7c8c){if(_0x4ce460){return getUser({'name':_0x4ce460})[_0x865e('0xc')](function(_0x2029a2){logger[_0x865e('0x7')](_0x865e('0x1e'),_0x4ce460,_0x2029a2?'found':_0x865e('0x16'));return _0x28e228(_0x2029a2);})[_0x865e('0x17')](function(_0x39af4d){logger[_0x865e('0xa')](_0x865e('0x1f'),_0x39af4d?util[_0x865e('0x8')](_0x39af4d,{'showHidden':![],'depth':null}):'');return _0x28e228(null);});}return _0x28e228(null);});};exports['getVoiceQueueByName']=function(_0x2acdf6){return new BPromise(function(_0x65a27b,_0x7ec001){if(_0x2acdf6){return client[_0x865e('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x865e('0x20'),_0x865e('0x21'),'acw','acwTimeout'],'where':{'name':_0x2acdf6},'limit':0x1}})[_0x865e('0xc')](function(_0xac5c22){logger[_0x865e('0x9')](_0x865e('0x22'),_0x2acdf6,_0xac5c22?util[_0x865e('0x8')](_0xac5c22,{'showHidden':![],'depth':null}):'');logger[_0x865e('0x7')](_0x865e('0x23'),_0x2acdf6,_0xac5c22?_0x865e('0x1b'):_0x865e('0x16'));return _0x65a27b(_0xac5c22['result']['length']?_0xac5c22[_0x865e('0x13')][0x0]:null);})['catch'](function(_0x2c4633){logger['error'](_0x865e('0x24'),_0x2c4633?util[_0x865e('0x8')](_0x2c4633,{'showHidden':![],'depth':null}):'');return _0x65a27b(null);});}return _0x65a27b(null);});};exports[_0x865e('0x25')]=function(_0x535849,_0x28fd51){return moment(_0x535849)[_0x865e('0x26')](_0x28fd51,_0x865e('0x27'))[_0x865e('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x865e('0x29')]=function(_0x5c9cb5,_0x1875c5){return moment(_0x5c9cb5)[_0x865e('0x2a')](_0x1875c5,_0x865e('0x27'))[_0x865e('0x28')](_0x865e('0x2b'));};exports['diffTime']=function(_0x2b5423,_0x22114a){return moment(_0x2b5423)[_0x865e('0x2c')](moment(_0x22114a),'seconds');};exports[_0x865e('0x2d')]=function(_0x139b0c,_0x43fb6f){return parseInt(_0x139b0c,0xa)+parseInt(_0x43fb6f,0xa);};exports['now']=function(){return moment()[_0x865e('0x28')](_0x865e('0x2b'));};exports['isAfter']=function(_0x208fba,_0x4ae224){if(_0x4ae224){return moment(_0x208fba)[_0x865e('0x2e')](_0x4ae224);}return!![];};exports['isBefore']=function(_0x16a120,_0x1be187){if(_0x1be187){return moment(_0x16a120)[_0x865e('0x2f')](_0x1be187);}else if(_0x16a120){return!![];}return![];}; \ No newline at end of file +var _0x22a1=['diffTime','diff','sumTime','YYYY-MM-DD\x20HH:mm:ss','isAfter','isBefore','bluebird','jayson/promise','moment','client','info','inspect','debug','error','[utils][request]\x20name:%s','catch','request','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','found','add','seconds','format','subtractTime','subtract'];(function(_0x34def0,_0x554b5b){var _0x2be1c9=function(_0x45b895){while(--_0x45b895){_0x34def0['push'](_0x34def0['shift']());}};_0x2be1c9(++_0x554b5b);}(_0x22a1,0x19b));var _0x122a=function(_0x2a01c0,_0x2c0da8){_0x2a01c0=_0x2a01c0-0x0;var _0x5994cc=_0x22a1[_0x2a01c0];return _0x5994cc;};'use strict';var BPromise=require(_0x122a('0x0'));var jayson=require(_0x122a('0x1'));var moment=require(_0x122a('0x2'));var util=require('util');var client=jayson[_0x122a('0x3')]['http']({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x122a('0x4')]=function(_0x53d8bf,_0x38e19c){logger[_0x122a('0x4')](_0x53d8bf,_0x38e19c?util[_0x122a('0x5')](_0x38e19c,{'showHidden':![],'depth':null}):'');};exports[_0x122a('0x6')]=function(_0x1e8735,_0x47f80b){logger[_0x122a('0x6')](_0x1e8735,_0x47f80b?util[_0x122a('0x5')](_0x47f80b,{'showHidden':![],'depth':null}):'');};exports[_0x122a('0x7')]=function(_0x436a72,_0x1e5362){logger['error'](_0x436a72,_0x1e5362?util['inspect'](_0x1e5362,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x369d87,_0x4c955c){return client['request'](_0x369d87,{'body':_0x4c955c})['then'](function(_0x38c44a){logger[_0x122a('0x6')](_0x122a('0x8'),_0x369d87,_0x38c44a?util[_0x122a('0x5')](_0x38c44a,{'showHidden':![],'depth':null}):'');})[_0x122a('0x9')](function(_0x479426){logger['error']('[utils][request]\x20name:%s',_0x369d87,_0x479426?util[_0x122a('0x5')](_0x479426,{'showHidden':![],'depth':null}):'');});};function getUser(_0x57b8f6){return client[_0x122a('0xa')](_0x122a('0xb'),{'options':{'raw':!![],'attributes':['id',_0x122a('0xc'),_0x122a('0xd'),_0x122a('0xe')],'where':_0x57b8f6,'limit':0x1}})[_0x122a('0xf')](function(_0x837580){logger[_0x122a('0x6')](_0x122a('0x10'),JSON[_0x122a('0x11')](_0x57b8f6),_0x837580?util[_0x122a('0x5')](_0x837580,{'showHidden':![],'depth':null}):'');return _0x837580['result']['length']?_0x837580[_0x122a('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x493f27){return new BPromise(function(_0x2b5d5d,_0x6f5fd2){if(_0x493f27){return getUser({'internal':_0x493f27})['then'](function(_0x3abd22){logger['info'](_0x122a('0x13'),_0x493f27,_0x3abd22?'found':_0x122a('0x14'));return _0x2b5d5d(_0x3abd22);})[_0x122a('0x9')](function(_0x580786){logger['error']('[utils][getUserByInternal]',_0x580786?util[_0x122a('0x5')](_0x580786,{'showHidden':![],'depth':null}):'');return _0x2b5d5d(null);});}return _0x2b5d5d(null);});};exports[_0x122a('0x15')]=function(_0x1935fd){return new BPromise(function(_0x131a95,_0x116053){if(_0x1935fd){return getUser({'interface':_0x1935fd})[_0x122a('0xf')](function(_0x56c266){logger[_0x122a('0x4')](_0x122a('0x16'),_0x1935fd,_0x56c266?'found':_0x122a('0x14'));return _0x131a95(_0x56c266);})[_0x122a('0x9')](function(_0x21c5fb){logger[_0x122a('0x7')](_0x122a('0x17'),_0x21c5fb?util[_0x122a('0x5')](_0x21c5fb,{'showHidden':![],'depth':null}):'');return _0x131a95(null);});}return _0x131a95(null);});};exports[_0x122a('0x18')]=function(_0x3b2d4a){return new BPromise(function(_0x52111b,_0x567ef8){if(_0x3b2d4a){return getUser({'name':_0x3b2d4a})[_0x122a('0xf')](function(_0x1cb41b){logger[_0x122a('0x4')]('[utils][getUserByName]\x20name:%s\x20%s',_0x3b2d4a,_0x1cb41b?'found':_0x122a('0x14'));return _0x52111b(_0x1cb41b);})[_0x122a('0x9')](function(_0x5d77f0){logger[_0x122a('0x7')](_0x122a('0x19'),_0x5d77f0?util[_0x122a('0x5')](_0x5d77f0,{'showHidden':![],'depth':null}):'');return _0x52111b(null);});}return _0x52111b(null);});};exports[_0x122a('0x1a')]=function(_0x53eee0){return new BPromise(function(_0x1bfcb5,_0x23e55e){if(_0x53eee0){return client[_0x122a('0xa')](_0x122a('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x122a('0xd'),_0x122a('0x1c'),_0x122a('0x1d'),_0x122a('0x1e')],'where':{'name':_0x53eee0},'limit':0x1}})['then'](function(_0x2fc50c){logger[_0x122a('0x6')](_0x122a('0x1f'),_0x53eee0,_0x2fc50c?util[_0x122a('0x5')](_0x2fc50c,{'showHidden':![],'depth':null}):'');logger[_0x122a('0x4')](_0x122a('0x20'),_0x53eee0,_0x2fc50c?_0x122a('0x21'):_0x122a('0x14'));return _0x1bfcb5(_0x2fc50c[_0x122a('0x12')]['length']?_0x2fc50c['result'][0x0]:null);})[_0x122a('0x9')](function(_0x94ec89){logger[_0x122a('0x7')]('[utils][getVoiceQueueByName]',_0x94ec89?util[_0x122a('0x5')](_0x94ec89,{'showHidden':![],'depth':null}):'');return _0x1bfcb5(null);});}return _0x1bfcb5(null);});};exports['addTime']=function(_0x55bcd3,_0x2cd47f){return moment(_0x55bcd3)[_0x122a('0x22')](_0x2cd47f,_0x122a('0x23'))[_0x122a('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x122a('0x25')]=function(_0x25ab68,_0x183c5d){return moment(_0x25ab68)[_0x122a('0x26')](_0x183c5d,'seconds')[_0x122a('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x122a('0x27')]=function(_0x2d1c58,_0x165ad0){return moment(_0x2d1c58)[_0x122a('0x28')](moment(_0x165ad0),'seconds');};exports[_0x122a('0x29')]=function(_0x3fe484,_0x3f9005){return parseInt(_0x3fe484,0xa)+parseInt(_0x3f9005,0xa);};exports['now']=function(){return moment()[_0x122a('0x24')](_0x122a('0x2a'));};exports[_0x122a('0x2b')]=function(_0xab4a59,_0x2f1b40){if(_0x2f1b40){return moment(_0xab4a59)[_0x122a('0x2b')](_0x2f1b40);}return!![];};exports[_0x122a('0x2c')]=function(_0x2a34c4,_0x83ded){if(_0x83ded){return moment(_0x2a34c4)[_0x122a('0x2c')](_0x83ded);}else if(_0x2a34c4){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 48324b8..1629459 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 _0x3bf6=['xcally','client','role','name','ensureDir','then','catch','user','data','error','client-side-logger','use','logger','isEmpty','\x20body=%s','body','x-forwarded-for','headers','connection','remoteAddress','statusCode','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','url','device','other','agent_name','test','setupLoggers','fs-extra','lodash','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log'];(function(_0x113bef,_0x82b4a5){var _0x3b6d82=function(_0xc0df02){while(--_0xc0df02){_0x113bef['push'](_0x113bef['shift']());}};_0x3b6d82(++_0x82b4a5);}(_0x3bf6,0x107));var _0x63bf=function(_0x5c78f2,_0x1430d7){_0x5c78f2=_0x5c78f2-0x0;var _0x5760f2=_0x3bf6[_0x5c78f2];return _0x5760f2;};var fs=require(_0x63bf('0x0'));var _=require(_0x63bf('0x1'));var ewinston=require('express-winston');var path=require(_0x63bf('0x2'));var util=require(_0x63bf('0x3'));var fileLogger=require(_0x63bf('0x4'))[_0x63bf('0x5')];var safeTemplate=require(_0x63bf('0x6'))[_0x63bf('0x7')];var maskSensitiveData=require(_0x63bf('0x8'))[_0x63bf('0x9')];function ClientSideLogger(){function _0x4c4df9(_0x216bd4){var _0x6ad37e=path[_0x63bf('0xa')](_0x63bf('0xb'),_0x63bf('0xc'),_0x63bf('0xd'));var _0x516e3e=path[_0x63bf('0xa')](_0x63bf('0xe'),_0x216bd4[_0x63bf('0xf')]+'-'+_0x216bd4[_0x63bf('0x10')]);return fs[_0x63bf('0x11')](path[_0x63bf('0xa')](_0x6ad37e,_0x516e3e))[_0x63bf('0x12')](function(){var _0x3820e9=fileLogger(_0x63bf('0xe'),path[_0x63bf('0xa')](_0x6ad37e,_0x516e3e));return _0x3820e9;})[_0x63bf('0x13')](function(_0x3f03d9){throw _0x3f03d9;});}this[_0x63bf('0xc')]=function(_0x25d2ea,_0xfd946c,_0x17f47f,_0x531791){return _0x4c4df9(_0x25d2ea[_0x63bf('0x14')])['then'](function(_0x22f1c8){var _0x238cfd=_0x22f1c8[_0xfd946c];return _0x238cfd;})[_0x63bf('0x12')](function(_0x1b8e4f){var _0x52d771=_0x25d2ea[_0x63bf('0x14')]?_0x25d2ea['user']['id']:'no-user';var _0x180a94=_0x531791[_0x63bf('0x15')];var _0x3a5625=_0x531791['timestamp'];var _0x34c7b9=new Date(Number(_0x3a5625));return _0x1b8e4f(_0x52d771,_0x34c7b9,_0x17f47f,_0x180a94);})[_0x63bf('0x13')](function(_0x4b6529){fileLogger(_0x63bf('0xe'))[_0x63bf('0x16')](_0x4b6529);});};}function setupLoggers(_0x257b04){return new Promise(function(_0x4e2a2e){var _0xaac42b=new ClientSideLogger();var _0x447e71=fileLogger('api');var _0x59b3b5=fileLogger('auth');_0x257b04['set'](_0x63bf('0x17'),_0xaac42b);_0x257b04[_0x63bf('0x18')](ewinston[_0x63bf('0x19')]({'winstonInstance':_0x447e71,'meta':![],'statusLevels':!![],'msg':function(_0x1b09d9,_0x4e9564){var _0x470d2e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x63bf('0x1a')](_0x1b09d9['body'])){_0x470d2e+=_0x63bf('0x1b');var _0x505f95=_0x1b09d9[_0x63bf('0x1c')];maskSensitiveData(_0x505f95);}return safeTemplate(util['format'](_0x470d2e,_0x1b09d9['method'],_0x1b09d9['headers'][_0x63bf('0x1d')]?_0x1b09d9[_0x63bf('0x1e')][_0x63bf('0x1d')]:_0x1b09d9[_0x63bf('0x1f')][_0x63bf('0x20')]||_0x1b09d9['ip'],_0x1b09d9['url'],_0x4e9564[_0x63bf('0x21')],_0x4e9564[_0x63bf('0x22')],_0x1b09d9[_0x63bf('0x14')]?_0x1b09d9[_0x63bf('0x14')]['id']:null,_0x1b09d9[_0x63bf('0x14')]?_0x1b09d9['user']['name']:null,_0x1b09d9[_0x63bf('0x14')]?_0x1b09d9['user'][_0x63bf('0xf')]:null,_0x505f95?util['inspect'](_0x505f95,![],null):''));}}));_0x257b04[_0x63bf('0x18')](ewinston[_0x63bf('0x19')]({'winstonInstance':_0x59b3b5,'meta':![],'statusLevels':!![],'msg':function(_0xff6cfe,_0x159a3c){var _0x4c8146=_0x63bf('0x23');if(_0xff6cfe[_0x63bf('0x1c')]&&_0xff6cfe[_0x63bf('0x1c')]['device']&&_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x24')]){_0x4c8146=_0x63bf('0x25');}return util[_0x63bf('0x26')](_0x4c8146,_0xff6cfe[_0x63bf('0x27')],_0xff6cfe[_0x63bf('0x1e')][_0x63bf('0x1d')]?_0xff6cfe[_0x63bf('0x1e')][_0x63bf('0x1d')]:_0xff6cfe[_0x63bf('0x1f')][_0x63bf('0x20')]||_0xff6cfe['ip'],_0xff6cfe[_0x63bf('0x28')],_0x159a3c[_0x63bf('0x21')],_0x159a3c['responseTime'],_0xff6cfe[_0x63bf('0x14')]?_0xff6cfe[_0x63bf('0x14')]['id']:null,_0xff6cfe['user']?_0xff6cfe[_0x63bf('0x14')][_0x63bf('0x10')]:null,_0xff6cfe[_0x63bf('0x14')]?_0xff6cfe[_0x63bf('0x14')]['role']:null,_0xff6cfe[_0x63bf('0x1c')]&&_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x29')]?_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x29')]:_0x63bf('0x2a'),_0xff6cfe[_0x63bf('0x1c')]&&_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x24')]?_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x24')]:'',_0xff6cfe['body']&&_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x2b')]?_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x2b')]:'');},'ignoreRoute':function(_0x56464e){var _0x40f8b3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x40f8b3[_0x63bf('0x2c')](_0x56464e[_0x63bf('0x28')]);}}));return _0x4e2a2e();});}exports[_0x63bf('0x2d')]=setupLoggers; \ No newline at end of file +var _0xdd8f=['catch','user','no-user','data','timestamp','error','api','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','method','x-forwarded-for','connection','remoteAddress','url','statusCode','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','format','headers','device','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','fileLogger','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then'];(function(_0x18a81a,_0x4fc65b){var _0x114027=function(_0x1b7e0f){while(--_0x1b7e0f){_0x18a81a['push'](_0x18a81a['shift']());}};_0x114027(++_0x4fc65b);}(_0xdd8f,0x1a8));var _0xfdd8=function(_0x481011,_0x4afd3c){_0x481011=_0x481011-0x0;var _0x5d7833=_0xdd8f[_0x481011];return _0x5d7833;};var fs=require(_0xfdd8('0x0'));var _=require(_0xfdd8('0x1'));var ewinston=require(_0xfdd8('0x2'));var path=require(_0xfdd8('0x3'));var util=require('util');var fileLogger=require('./loggers')[_0xfdd8('0x4')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0xfdd8('0x5'))[_0xfdd8('0x6')];function ClientSideLogger(){function _0x2a79a7(_0x5af0d7){var _0x511ab7=path[_0xfdd8('0x7')](_0xfdd8('0x8'),_0xfdd8('0x9'),_0xfdd8('0xa'));var _0x832a64=path[_0xfdd8('0x7')](_0xfdd8('0xb'),_0x5af0d7[_0xfdd8('0xc')]+'-'+_0x5af0d7[_0xfdd8('0xd')]);return fs[_0xfdd8('0xe')](path[_0xfdd8('0x7')](_0x511ab7,_0x832a64))[_0xfdd8('0xf')](function(){var _0x47d127=fileLogger('client',path[_0xfdd8('0x7')](_0x511ab7,_0x832a64));return _0x47d127;})[_0xfdd8('0x10')](function(_0xfeee4a){throw _0xfeee4a;});}this[_0xfdd8('0x9')]=function(_0x238765,_0x46c698,_0x2c5031,_0x5ab670){return _0x2a79a7(_0x238765[_0xfdd8('0x11')])['then'](function(_0xb628d4){var _0x339bf3=_0xb628d4[_0x46c698];return _0x339bf3;})[_0xfdd8('0xf')](function(_0x31abae){var _0x1a2ce2=_0x238765[_0xfdd8('0x11')]?_0x238765[_0xfdd8('0x11')]['id']:_0xfdd8('0x12');var _0xcd1110=_0x5ab670[_0xfdd8('0x13')];var _0x563095=_0x5ab670[_0xfdd8('0x14')];var _0x501761=new Date(Number(_0x563095));return _0x31abae(_0x1a2ce2,_0x501761,_0x2c5031,_0xcd1110);})[_0xfdd8('0x10')](function(_0x5a4933){fileLogger(_0xfdd8('0xb'))[_0xfdd8('0x15')](_0x5a4933);});};}function setupLoggers(_0x18e7e9){return new Promise(function(_0x599841){var _0x483ab0=new ClientSideLogger();var _0x454f4f=fileLogger(_0xfdd8('0x16'));var _0x2b9396=fileLogger(_0xfdd8('0x17'));_0x18e7e9['set']('client-side-logger',_0x483ab0);_0x18e7e9[_0xfdd8('0x18')](ewinston[_0xfdd8('0x19')]({'winstonInstance':_0x454f4f,'meta':![],'statusLevels':!![],'msg':function(_0x4e3288,_0x341f25){var _0x52080f=_0xfdd8('0x1a');if(!_['isEmpty'](_0x4e3288[_0xfdd8('0x1b')])){_0x52080f+=_0xfdd8('0x1c');var _0x4d6237=_0x4e3288[_0xfdd8('0x1b')];maskSensitiveData(_0x4d6237);}return safeTemplate(util['format'](_0x52080f,_0x4e3288[_0xfdd8('0x1d')],_0x4e3288['headers'][_0xfdd8('0x1e')]?_0x4e3288['headers'][_0xfdd8('0x1e')]:_0x4e3288[_0xfdd8('0x1f')][_0xfdd8('0x20')]||_0x4e3288['ip'],_0x4e3288[_0xfdd8('0x21')],_0x341f25[_0xfdd8('0x22')],_0x341f25['responseTime'],_0x4e3288[_0xfdd8('0x11')]?_0x4e3288[_0xfdd8('0x11')]['id']:null,_0x4e3288[_0xfdd8('0x11')]?_0x4e3288[_0xfdd8('0x11')]['name']:null,_0x4e3288[_0xfdd8('0x11')]?_0x4e3288[_0xfdd8('0x11')][_0xfdd8('0xc')]:null,_0x4d6237?util['inspect'](_0x4d6237,![],null):''));}}));_0x18e7e9['use'](ewinston['logger']({'winstonInstance':_0x2b9396,'meta':![],'statusLevels':!![],'msg':function(_0x588186,_0x4cfc14){var _0x3ec789=_0xfdd8('0x23');if(_0x588186[_0xfdd8('0x1b')]&&_0x588186[_0xfdd8('0x1b')]['device']&&_0x588186[_0xfdd8('0x1b')][_0xfdd8('0x24')]){_0x3ec789='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xfdd8('0x25')](_0x3ec789,_0x588186['method'],_0x588186[_0xfdd8('0x26')]['x-forwarded-for']?_0x588186['headers'][_0xfdd8('0x1e')]:_0x588186['connection'][_0xfdd8('0x20')]||_0x588186['ip'],_0x588186[_0xfdd8('0x21')],_0x4cfc14['statusCode'],_0x4cfc14['responseTime'],_0x588186[_0xfdd8('0x11')]?_0x588186['user']['id']:null,_0x588186[_0xfdd8('0x11')]?_0x588186['user'][_0xfdd8('0xd')]:null,_0x588186[_0xfdd8('0x11')]?_0x588186['user'][_0xfdd8('0xc')]:null,_0x588186['body']&&_0x588186[_0xfdd8('0x1b')][_0xfdd8('0x27')]?_0x588186['body'][_0xfdd8('0x27')]:_0xfdd8('0x28'),_0x588186['body']&&_0x588186[_0xfdd8('0x1b')][_0xfdd8('0x24')]?_0x588186['body'][_0xfdd8('0x24')]:'',_0x588186[_0xfdd8('0x1b')]&&_0x588186[_0xfdd8('0x1b')][_0xfdd8('0x29')]?_0x588186[_0xfdd8('0x1b')][_0xfdd8('0x29')]:'');},'ignoreRoute':function(_0x3ce6d9){var _0x28f618=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x28f618[_0xfdd8('0x2a')](_0x3ce6d9[_0xfdd8('0x21')]);}}));return _0x599841();});}exports[_0xfdd8('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 684dffd..46a7b13 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bc6=['message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','level','toUpperCase','meta','keys','length','stringify','YYYY-MM-DD\x20HH:mm:ss','Logger','Console','warn','File','%s-%s','error','transports','consoleLogger','fileLogger','path','util','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x3bc6,0x190));var _0x63bc=function(_0x55b347,_0x2011dc){_0x55b347=_0x55b347-0x0;var _0x572b9f=_0x3bc6[_0x55b347];return _0x572b9f;};'use strict';var path=require(_0x63bc('0x0'));var util=require(_0x63bc('0x1'));var moment=require('moment');var winston=require(_0x63bc('0x2'));var config=require(_0x63bc('0x3'));var debugLevel=config[_0x63bc('0x4')]?config[_0x63bc('0x4')][_0x63bc('0x5')]():_0x63bc('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x63bc('0x7'),'error':_0x63bc('0x8'),'warn':_0x63bc('0x9'),'info':_0x63bc('0xa'),'print':_0x63bc('0xb'),'success':_0x63bc('0xc'),'http':_0x63bc('0xd'),'verbose':_0x63bc('0xe'),'debug':'bold\x20blue','silly':_0x63bc('0xf')};winston[_0x63bc('0x10')](XC_LOG_COLORS);function getLogFileName(_0x264f20,_0x298b34,_0x59bebc){var _0x1572c7=_0x264f20||_0x63bc('0x11');return path[_0x63bc('0x12')](_0x1572c7,util['format'](_0x63bc('0x13'),_0x298b34,_0x59bebc));}function formatter(_0x4634f9,_0x4dfa08){_0x4dfa08['message']=_0x4dfa08[_0x63bc('0x14')][_0x63bc('0x15')](/@@{/g,_0x63bc('0x16'))[_0x63bc('0x15')](/}@@/g,_0x63bc('0x17'))[_0x63bc('0x15')](/@{/g,'{{')[_0x63bc('0x15')](/}@/g,'}}');return util['format'](_0x63bc('0x18'),moment()[_0x63bc('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4dfa08[_0x63bc('0x1a')][_0x63bc('0x1b')](),_0x4634f9,_0x4dfa08[_0x63bc('0x14')]);}function fileFormat(_0x37355a,_0x17657e){_0x17657e[_0x63bc('0x14')]=_0x17657e[_0x63bc('0x14')]['replace'](/@@{/g,'{{{')[_0x63bc('0x15')](/}@@/g,_0x63bc('0x17'))[_0x63bc('0x15')](/@{/g,'{{')[_0x63bc('0x15')](/}@/g,'}}');var _0x3ce467=_0x17657e[_0x63bc('0x1c')]&&Object[_0x63bc('0x1d')](_0x17657e[_0x63bc('0x1c')])[_0x63bc('0x1e')]?'\x0a\x09'+JSON[_0x63bc('0x1f')](_0x17657e['meta']):'';return util[_0x63bc('0x19')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x63bc('0x19')](_0x63bc('0x20')),_0x17657e[_0x63bc('0x1a')][_0x63bc('0x1b')](),_0x37355a,_0x17657e['message'],_0x3ce467);}function consoleLogger(){var _0x133fbf=new winston[(_0x63bc('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x63bc('0x22'))]({'level':_0x63bc('0x23'),'json':![],'formatter':function(_0x4ae178){return formatter('',_0x4ae178);}})]});return _0x133fbf;}function fileLogger(_0x58cf4a,_0x59ea0f){var _0x13a08c=new winston[(_0x63bc('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x63bc('0x24'))]({'name':util[_0x63bc('0x19')](_0x63bc('0x25'),_0x58cf4a,'error'),'filename':getLogFileName(_0x59ea0f,_0x58cf4a,_0x63bc('0x26')),'level':_0x63bc('0x26'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1874b0){return fileFormat(_0x58cf4a,_0x1874b0);}}),new winston[(_0x63bc('0x27'))][(_0x63bc('0x24'))]({'name':util[_0x63bc('0x19')](_0x63bc('0x25'),_0x58cf4a,debugLevel),'filename':getLogFileName(_0x59ea0f,_0x58cf4a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xf67929){return fileFormat(_0x58cf4a,_0xf67929);}}),new winston[(_0x63bc('0x27'))][(_0x63bc('0x22'))]({'level':'warn','json':![],'formatter':function(_0x552ff0){return fileFormat(_0x58cf4a,_0x552ff0);}})]});return _0x13a08c;}exports[_0x63bc('0x28')]=consoleLogger;exports[_0x63bc('0x29')]=fileLogger; \ No newline at end of file +var _0x2da7=['consoleLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','white','bold\x20white','gray','bold\x20blue','addColors','/var/log/xcally','join','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','warn','File','%s-%s','error','Console'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2da7,0x17d));var _0x72da=function(_0x16cef7,_0x30c9b9){_0x16cef7=_0x16cef7-0x0;var _0x2845be=_0x2da7[_0x16cef7];return _0x2845be;};'use strict';var path=require(_0x72da('0x0'));var util=require(_0x72da('0x1'));var moment=require(_0x72da('0x2'));var winston=require(_0x72da('0x3'));var config=require(_0x72da('0x4'));var debugLevel=config[_0x72da('0x5')]?config['debugLevel'][_0x72da('0x6')]():_0x72da('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':_0x72da('0x8'),'error':'red','warn':'bold\x20yellow','info':_0x72da('0x9'),'print':_0x72da('0xa'),'success':'bold\x20green','http':_0x72da('0xb'),'verbose':'bold\x20magenta','debug':_0x72da('0xc'),'silly':'bold\x20cyan'};winston[_0x72da('0xd')](XC_LOG_COLORS);function getLogFileName(_0x3e8d68,_0x58d3b1,_0x53c09c){var _0xa26aed=_0x3e8d68||_0x72da('0xe');return path[_0x72da('0xf')](_0xa26aed,util[_0x72da('0x10')](_0x72da('0x11'),_0x58d3b1,_0x53c09c));}function formatter(_0x56d1d8,_0x2dadb5){_0x2dadb5['message']=_0x2dadb5[_0x72da('0x12')]['replace'](/@@{/g,_0x72da('0x13'))[_0x72da('0x14')](/}@@/g,_0x72da('0x15'))[_0x72da('0x14')](/@{/g,'{{')[_0x72da('0x14')](/}@/g,'}}');return util[_0x72da('0x10')](_0x72da('0x16'),moment()[_0x72da('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2dadb5['level'][_0x72da('0x17')](),_0x56d1d8,_0x2dadb5[_0x72da('0x12')]);}function fileFormat(_0x2ea0aa,_0x1e949d){_0x1e949d[_0x72da('0x12')]=_0x1e949d[_0x72da('0x12')][_0x72da('0x14')](/@@{/g,_0x72da('0x13'))[_0x72da('0x14')](/}@@/g,_0x72da('0x15'))[_0x72da('0x14')](/@{/g,'{{')[_0x72da('0x14')](/}@/g,'}}');var _0x5c05e7=_0x1e949d[_0x72da('0x18')]&&Object[_0x72da('0x19')](_0x1e949d['meta'])[_0x72da('0x1a')]?'\x0a\x09'+JSON[_0x72da('0x1b')](_0x1e949d['meta']):'';return util[_0x72da('0x10')](_0x72da('0x1c'),moment()[_0x72da('0x10')](_0x72da('0x1d')),_0x1e949d['level']['toUpperCase'](),_0x2ea0aa,_0x1e949d[_0x72da('0x12')],_0x5c05e7);}function consoleLogger(){var _0xcb79d0=new winston[(_0x72da('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x72da('0x1f'))]['Console']({'level':_0x72da('0x20'),'json':![],'formatter':function(_0x3a8b36){return formatter('',_0x3a8b36);}})]});return _0xcb79d0;}function fileLogger(_0x5694ef,_0x1fb074){var _0x484ce7=new winston[(_0x72da('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x72da('0x21'))]({'name':util[_0x72da('0x10')](_0x72da('0x22'),_0x5694ef,'error'),'filename':getLogFileName(_0x1fb074,_0x5694ef,_0x72da('0x23')),'level':_0x72da('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4d58d8){return fileFormat(_0x5694ef,_0x4d58d8);}}),new winston[(_0x72da('0x1f'))][(_0x72da('0x21'))]({'name':util['format'](_0x72da('0x22'),_0x5694ef,debugLevel),'filename':getLogFileName(_0x1fb074,_0x5694ef,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4cc9cb){return fileFormat(_0x5694ef,_0x4cc9cb);}}),new winston[(_0x72da('0x1f'))][(_0x72da('0x24'))]({'level':_0x72da('0x20'),'json':![],'formatter':function(_0x3f53a7){return fileFormat(_0x5694ef,_0x3f53a7);}})]});return _0x484ce7;}exports[_0x72da('0x25')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index ce6fb45..c8c54e8 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(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0x0295,0x1f0));var _0x5029=function(_0x35d294,_0x3a9b4){_0x35d294=_0x35d294-0x0;var _0xb9ae9a=_0x0295[_0x35d294];return _0xb9ae9a;};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 _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(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x0295,0x1f0));var _0x5029=function(_0x2d489a,_0x25ce3c){_0x2d489a=_0x2d489a-0x0;var _0x11b301=_0x0295[_0x2d489a];return _0x11b301;};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 diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 65d3732..1ea9770 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93e9=['string','map','isPlainObject','keys','reduce','exports','lodash','{\x20{\x20','\x20}\x20}'];(function(_0x474c77,_0xc38c39){var _0x5706ab=function(_0x3a4335){while(--_0x3a4335){_0x474c77['push'](_0x474c77['shift']());}};_0x5706ab(++_0xc38c39);}(_0x93e9,0xcc));var _0x993e=function(_0x1d8d83,_0x5c58da){_0x1d8d83=_0x1d8d83-0x0;var _0x13a3a5=_0x93e9[_0x1d8d83];return _0x13a3a5;};var _=require(_0x993e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xcf3bfd){return _0xcf3bfd==='{{'?_0x993e('0x1'):_0x993e('0x2');}function safeTemplate(_0x43b7b0){var _0x2a63eb=_0x43b7b0;if(typeof _0x43b7b0===_0x993e('0x3')){_0x2a63eb=_0x43b7b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x43b7b0)){_0x2a63eb=_0x43b7b0[_0x993e('0x4')](function(_0x255045){return safeTemplate(_0x255045);});}else if(_[_0x993e('0x5')](_0x43b7b0)){_0x2a63eb=Object[_0x993e('0x6')](_0x43b7b0)[_0x993e('0x7')](function(_0x2366d9,_0x12ac94){_0x2366d9[_0x12ac94]=safeTemplate(_0x43b7b0[_0x12ac94]);return _0x2366d9;},{});}return _0x2a63eb;}module[_0x993e('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0xb10b=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','reduce','exports'];(function(_0x10ee24,_0xb203e5){var _0x36007e=function(_0x2faaf9){while(--_0x2faaf9){_0x10ee24['push'](_0x10ee24['shift']());}};_0x36007e(++_0xb203e5);}(_0xb10b,0x12a));var _0xbb10=function(_0x57a670,_0x30e402){_0x57a670=_0x57a670-0x0;var _0x41ce21=_0xb10b[_0x57a670];return _0x41ce21;};var _=require(_0xbb10('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4bb7bb){return _0x4bb7bb==='{{'?_0xbb10('0x1'):_0xbb10('0x2');}function safeTemplate(_0x1dcb08){var _0x4d688c=_0x1dcb08;if(typeof _0x1dcb08===_0xbb10('0x3')){_0x4d688c=_0x1dcb08[_0xbb10('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xbb10('0x5')](_0x1dcb08)){_0x4d688c=_0x1dcb08[_0xbb10('0x6')](function(_0x49baf4){return safeTemplate(_0x49baf4);});}else if(_[_0xbb10('0x7')](_0x1dcb08)){_0x4d688c=Object['keys'](_0x1dcb08)[_0xbb10('0x8')](function(_0x3cdd53,_0x513741){_0x3cdd53[_0x513741]=safeTemplate(_0x1dcb08[_0x513741]);return _0x3cdd53;},{});}return _0x4d688c;}module[_0xbb10('0x9')][_0xbb10('0xa')]=safeTemplate; \ No newline at end of file